System.Data.SQLite

Login
This project makes use of Eagle, provided by Mistachkin Systems.
Eagle: Secure Software Automation

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

Changes In Branch trunk Excluding Merge-Ins

This is equivalent to a diff from 555d0d530d to 1764d76cee

2024-04-27
15:15
Update version history docs. Leaf check-in: 1764d76cee user: mistachkin tags: trunk
2024-04-15
22:00
Minor adjustments to the test for ticket [ce4d70ea6f]. check-in: abb207e382 user: mistachkin tags: trunk
2010-11-24
14:29
Remove a duplicate DLL whose name differs only in case. check-in: 7f9e634bf5 user: drh tags: trunk
2010-08-15
22:10
Fix guid type Closed-Leaf check-in: 555d0d530d user: rmsimpson tags: sourceforge
2010-08-11
16:17
Updates for take and skip check-in: fc483e780a user: rmsimpson tags: sourceforge

Added .fossil-settings/binary-glob.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
*.bmp
*.chm
*.db
*.dll
*.exe
*.gif
*.msi
*.png
*.resources
*.snk
*.zip

Added .fossil-settings/crnl-glob.



>
1
*

Added .fossil-settings/encoding-glob.



>
1
Tests/data/testlinq.out

Added .fossil-settings/ignore-glob.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
Externals/Eagle/bin/net5/Eagle*.pdb
Externals/Eagle/bin/net6/Eagle*.pdb
Externals/Eagle/bin/netCore20/Eagle*.pdb
Externals/Eagle/bin/netCore30/Eagle*.pdb
Externals/Eagle/bin/netFramework20/Eagle*.pdb
Externals/Eagle/bin/netFramework20/x64/Spilornis.pdb
Externals/Eagle/bin/netFramework20/x86/Spilornis.pdb
Externals/Eagle/bin/netFramework40/Eagle*.pdb
Externals/Eagle/bin/netFramework40/x64/Spilornis.pdb
Externals/Eagle/bin/netFramework40/x86/Spilornis.pdb
Targets/SQLite.NET.Settings.targets.netFx40.user

Added Doc/Extra/Core/images/sqlite370_banner.gif.

cannot compute difference between binary files

Added Doc/Extra/Core/json1.html.









































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>JSON Functions And Operators</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
JSON Functions And Operators
</div>
<div class="fancy_toc">
<a onclick="toggle_toc()">
<span class="fancy_toc_mark" id="toc_mk">&#x25ba;</span>
Table Of Contents
</a>
<div id="toc_sub"><div class="fancy-toc1"><a href="#overview">1. Overview</a></div>
<div class="fancy-toc1"><a href="#compiling_in_json_support">2. Compiling in JSON Support</a></div>
<div class="fancy-toc1"><a href="#interface_overview">3. Interface Overview</a></div>
<div class="fancy-toc2"><a href="#json_arguments">3.1. JSON arguments</a></div>
<div class="fancy-toc2"><a href="#jsonb">3.2. JSONB</a></div>
<div class="fancy-toc3"><a href="#the_jsonb_format">3.2.1. The JSONB format</a></div>
<div class="fancy-toc3"><a href="#handling_of_malformed_jsonb">3.2.2. Handling of malformed JSONB</a></div>
<div class="fancy-toc2"><a href="#path_arguments">3.3. PATH arguments</a></div>
<div class="fancy-toc2"><a href="#value_arguments">3.4. VALUE arguments</a></div>
<div class="fancy-toc2"><a href="#compatibility">3.5. Compatibility</a></div>
<div class="fancy-toc2"><a href="#json5_extensions">3.6. JSON5 Extensions</a></div>
<div class="fancy-toc2"><a href="#performance_considerations">3.7. Performance Considerations</a></div>
<div class="fancy-toc2"><a href="#the_json_blob_input_bug">3.8. The JSON BLOB Input Bug</a></div>
<div class="fancy-toc1"><a href="#function_details">4. Function Details</a></div>
<div class="fancy-toc2"><a href="#the_json_function">4.1. The json() function</a></div>
<div class="fancy-toc2"><a href="#the_jsonb_function">4.2. The jsonb() function</a></div>
<div class="fancy-toc2"><a href="#the_json_array_function">4.3. The json_array() function</a></div>
<div class="fancy-toc2"><a href="#the_jsonb_array_function">4.4. The jsonb_array() function</a></div>
<div class="fancy-toc2"><a href="#the_json_array_length_function">4.5. The json_array_length() function</a></div>
<div class="fancy-toc2"><a href="#the_json_error_position_function">4.6. The json_error_position() function</a></div>
<div class="fancy-toc2"><a href="#the_json_extract_function">4.7. The json_extract() function</a></div>
<div class="fancy-toc2"><a href="#the_jsonb_extract_function">4.8. The jsonb_extract() function</a></div>
<div class="fancy-toc2"><a href="#the_and_operators">4.9. The -> and ->> operators</a></div>
<div class="fancy-toc2"><a href="#the_json_insert_json_replace_and_json_set_functions">4.10. The json_insert(), json_replace, and json_set() functions</a></div>
<div class="fancy-toc2"><a href="#the_jsonb_insert_jsonb_replace_and_jsonb_set_functions">4.11. The jsonb_insert(), jsonb_replace, and jsonb_set() functions</a></div>
<div class="fancy-toc2"><a href="#the_json_object_function">4.12. The json_object() function</a></div>
<div class="fancy-toc2"><a href="#the_jsonb_object_function">4.13. The jsonb_object() function</a></div>
<div class="fancy-toc2"><a href="#the_json_patch_function">4.14. The json_patch() function</a></div>
<div class="fancy-toc2"><a href="#the_jsonb_patch_function">4.15. The jsonb_patch() function</a></div>
<div class="fancy-toc2"><a href="#the_json_remove_function">4.16. The json_remove() function</a></div>
<div class="fancy-toc2"><a href="#the_jsonb_remove_function">4.17. The jsonb_remove() function</a></div>
<div class="fancy-toc2"><a href="#the_json_type_function">4.18. The json_type() function</a></div>
<div class="fancy-toc2"><a href="#the_json_valid_function">4.19. The json_valid() function</a></div>
<div class="fancy-toc2"><a href="#the_json_quote_function">4.20. The json_quote() function</a></div>
<div class="fancy-toc2"><a href="#array_and_object_aggregate_functions">4.21. Array and object aggregate functions</a></div>
<div class="fancy-toc2"><a href="#the_json_each_and_json_tree_table_valued_functions">4.22. The json_each() and json_tree() table-valued functions</a></div>
<div class="fancy-toc3"><a href="#examples_using_json_each_and_json_tree_">4.22.1. Examples using json_each() and json_tree()</a></div>
</div>
</div>
<script>
function toggle_toc(){
var sub = document.getElementById("toc_sub")
var mk = document.getElementById("toc_mk")
if( sub.style.display!="block" ){
sub.style.display = "block";
mk.innerHTML = "&#x25bc;";
} else {
sub.style.display = "none";
mk.innerHTML = "&#x25ba;";
}
}
</script>
</div>





<h1 id="overview"><span>1. </span>Overview</h1>
<p>
By default, SQLite supports twenty-nine functions and two operators for
dealing with JSON values.  There are also two <a href="vtab.html#tabfunc2">table-valued functions</a>
that can be used to decompose a JSON string.

</p><p>
There are 25 scalar functions and operators:

</p><ol>
<li value='1'>
<a href='#jmini'>json</a>(<i>json</i>)
</li>

<li value='2'>
<a href='#jminib'>jsonb</a>(<i>json</i>)
</li>

<li value='3'>
<a href='#jarray'>json_array</a>(<i>value1</i>,<i>value2</i>,...)
</li>

<li value='4'>
<a href='#jarrayb'>jsonb_array</a>(<i>value1</i>,<i>value2</i>,...)
</li>

<li value='5'>
<a href='#jarraylen'>json_array_length</a>(<i>json</i>)<br><a href='#jarraylen'>json_array_length</a>(<i>json</i>,<i>path</i>)
</li>

<li value='6'>
<a href='#jerr'>json_error_position</a>(<i>json</i>)
</li>

<li value='7'>
<a href='#jex'>json_extract</a>(<i>json</i>,<i>path</i>,...)
</li>

<li value='8'>
<a href='#jexb'>jsonb_extract</a>(<i>json</i>,<i>path</i>,...)
</li>

<li value='9'>
<i>json</i> <a href='#jptr'>-></a> <i>path</i>
</li>

<li value='10'>
<i>json</i> <a href='#jptr'>->></a> <i>path</i>
</li>

<li value='11'>
<a href='#jins'>json_insert</a>(<i>json</i>,<i>path</i>,<i>value</i>,...)
</li>

<li value='12'>
<a href='#jinsb'>jsonb_insert</a>(<i>json</i>,<i>path</i>,<i>value</i>,...)
</li>

<li value='13'>
<a href='#jobj'>json_object</a>(<i>label1</i>,<i>value1</i>,...)
</li>

<li value='14'>
<a href='#jobjb'>jsonb_object</a>(<i>label1</i>,<i>value1</i>,...)
</li>

<li value='15'>
<a href='#jpatch'>json_patch</a>(<i>json</i>1,json2)
</li>

<li value='16'>
<a href='#jpatchb'>jsonb_patch</a>(<i>json</i>1,json2)
</li>

<li value='17'>
<a href='#jrm'>json_remove</a>(<i>json</i>,<i>path</i>,...)
</li>

<li value='18'>
<a href='#jrmb'>jsonb_remove</a>(<i>json</i>,<i>path</i>,...)
</li>

<li value='19'>
<a href='#jrepl'>json_replace</a>(<i>json</i>,<i>path</i>,<i>value</i>,...)
</li>

<li value='20'>
<a href='#jreplb'>jsonb_replace</a>(<i>json</i>,<i>path</i>,<i>value</i>,...)
</li>

<li value='21'>
<a href='#jset'>json_set</a>(<i>json</i>,<i>path</i>,<i>value</i>,...)
</li>

<li value='22'>
<a href='#jsetb'>jsonb_set</a>(<i>json</i>,<i>path</i>,<i>value</i>,...)
</li>

<li value='23'>
<a href='#jtype'>json_type</a>(<i>json</i>)<br><a href='#jtype'>json_type</a>(<i>json</i>,<i>path</i>)
</li>

<li value='24'>
<a href='#jvalid'>json_valid</a>(<i>json</i>)<br><a href='#jvalid'>json_valid</a>(<i>json</i>,flags)
</li>

<li value='25'>
<a href='#jquote'>json_quote</a>(<i>value</i>)
</li>


</ol>

<p>There are four <a href="lang_aggfunc.html">aggregate SQL functions</a>:

</p><ol>
<li value='26'>
<a href='#jgrouparray'>json_group_array</a>(<i>value</i>)
</li>

<li value='27'>
<a href='#jgrouparrayb'>jsonb_group_array</a>(<i>value</i>)
</li>

<li value='28'>
<a href='#jgroupobject'>json_group_object</a>(<i>label</i>,<i>value</i>)
</li>

<li value='29'>
<a href='#jgroupobjectb'>jsonb_group_object</a>(name,<i>value</i>)
</li>


</ol>

<p>The two <a href="vtab.html#tabfunc2">table-valued functions</a> are:

</p><ol>
<li value='30'>
<a href='#jeach'>json_each</a>(<i>json</i>)<br><a href='#jeach'>json_each</a>(<i>json</i>,<i>path</i>)
</li>

<li value='31'>
<a href='#jtree'>json_tree</a>(<i>json</i>)<br><a href='#jtree'>json_tree</a>(<i>json</i>,<i>path</i>)
</li>


</ol>



<style>
.jans {color: #050;}
.jex {color: #025;}
</style>


<a name="howtocompile"></a>

<h1 id="compiling_in_json_support"><span>2. </span>Compiling in JSON Support</h1>

<p>
The JSON functions and operators are built into SQLite by default,
as of SQLite version 3.38.0 (2022-02-22).  They can be omitted
by adding the -DSQLITE_OMIT_JSON compile-time option.  Prior to
version 3.38.0, the JSON functions were an extension that would only
be included in builds if the -DSQLITE_ENABLE_JSON1 compile-time option
was included.  In other words, the JSON functions went from being
opt-in with SQLite version 3.37.2 and earlier to opt-out with
SQLite version 3.38.0 and later.

</p><h1 id="interface_overview"><span>3. </span>Interface Overview</h1>

<p>
SQLite stores JSON as ordinary text.
Backwards compatibility constraints mean that SQLite is only able to
store values that are NULL, integers, floating-point numbers, text,
and BLOBs.  It is not possible to add a new "JSON" type.


</p><h2 id="json_arguments"><span>3.1. </span>JSON arguments</h2>

<p>
For functions that accept JSON as their first argument, that argument
can be a JSON object, array, number, string, or null.  SQLite numeric
values and NULL values are interpreted as JSON numbers and nulls, respectively.
SQLite text values can be understood as JSON objects, arrays, or strings.
If an SQLite text value that is not a well-formed JSON object, array, or
string is passed into JSON function, that function will usually throw
an error.  (Exceptions to this rule are <a href="json1.html#jvalid">json_valid()</a>,
<a href="json1.html#jquote">json_quote()</a>, and <a href="json1.html#jerr">json_error_position()</a>.)

</p><p>
These routines understand all
<a href="https://www.rfc-editor.org/rfc/rfc8259.txt">rfc-8259 JSON syntax</a>
and also <a href="https://spec.json5.org/">JSON5 extensions</a>.  JSON text
generated by these routines always strictly conforms to the
<a href="https://json.org">canonical JSON definition</a> and does not contain any JSON5
or other extensions.  The ability to read and understand JSON5 was added in
version 3.42.0 (2023-05-16).
Prior versions of SQLite would only read canonical JSON.

<a name="jsonbx"></a>

</p><h2 id="jsonb"><span>3.2. </span>JSONB</h2>

<p>
Beginning with version 3.45.0 (2024-01-15), SQLite allows its
internal "parse tree" representation of JSON to be stored on disk,
as a BLOB, in a format that we call "JSONB".  By storing SQLite's internal
binary representation of JSON directly in the database, applications
can bypass the overhead of parsing and rendering JSON when reading and
updating JSON values.  The internal JSONB format also uses slightly
less disk space then text JSON.

</p><p>
Any SQL function parameter that accepts text JSON as an input will also
accept a BLOB in the JSONB format.  The function will operate the
same in either case, except that it will run faster when
the input is JSONB, since it does not need to run the JSON parser.

</p><p>
Most SQL functions that return JSON text have a corresponding function
that returns the equivalent JSONB.  The functions that return JSON
in the text format begin with "<tt>json_</tt>" and functions that
return the binary JSONB format begin with "<tt>jsonb_</tt>".

</p><h3 id="the_jsonb_format"><span>3.2.1. </span>The JSONB format</h3>

<p>
JSONB is a binary representation of JSON used by SQLite and
is intended for internal use by SQLite only.  Applications
should not use JSONB outside of SQLite nor try to reverse-engineer the
JSONB format.

</p><p>
The "JSONB" name is inspired by <a href="https://postgresql.org">PostgreSQL</a>, but the
on-disk format for SQLite's JSONB is not the same as PostgreSQL's.
The two formats have the same name, but are not binary compatible.
The PostgreSQL JSONB format claims to offer O(1)
lookup of elements in objects and arrays.  SQLite's JSONB format makes no
such claim.  SQLite's JSONB has O(N) time complexity for
most operations in SQLite, just like text JSON.  The advantage of JSONB in
SQLite is that it is smaller and faster than text JSON - potentially several
times faster. There is space in the
on-disk JSONB format to add enhancements and future versions of SQLite might
include options to provide O(1) lookup of elements in JSONB, but no such
capability is currently available.

</p><h3 id="handling_of_malformed_jsonb"><span>3.2.2. </span>Handling of malformed JSONB</h3>

<p>
The JSONB that is generated by SQLite will always be well-formed.  If you
follow recommended practice and
treat JSONB as an opaque BLOB, then you will not have any problems.  But
JSONB is just a BLOB, so a mischievous programmer could devise BLOBs
that are similar to JSONB but that are technically malformed.  When
misformatted JSONB is feed into JSON functions, any of the following
might happen:

</p><ul>
<li><p>
The SQL statement might abort with a "malformed JSON" error.

</p></li><li><p>
The correct answer might be returned, if the malformed parts of
the JSONB blob do not impact the answer.

</p></li><li><p>
A goofy or nonsensical answer might be returned.
</p></li></ul>

<p>
The way in which SQLite handles invalid JSONB might change
from one version of SQLite to the next.  The system follows
the garbage-in/garbage-out rule:  If you feed the JSON functions invalid
JSONB, you get back an invalid answer.  If you are in doubt about the
validity of our JSONB, use the <a href="json1.html#jvalid">json_valid()</a> function to verify it.

</p><p>
We do make this one promise:
Malformed JSONB will never cause a memory
error or similar problem that might lead to a vulnerability.
Invalid JSONB might lead to crazy answers,
or it might cause queries to abort, but it won't cause a crash.

<a name="jsonpath"></a>

</p><h2 id="path_arguments"><span>3.3. </span>PATH arguments</h2>

<p>
For functions that accept PATH arguments, that PATH must be well-formed or
else the function will throw an error.
A well-formed PATH is a text value that begins with exactly one
'$' character followed by zero or more instances
of ".<i>objectlabel</i>" or "&#91;<i>arrayindex</i>&#93;".

</p><p>
The <i>arrayindex</i> is usually a non-negative integer <i>N</i>.  In
that case, the array element selected is the <i>N</i>-th element
of the array, starting with zero on the left.
The <i>arrayindex</i> can also be of the form "<b>#-</b><i>N</i>"
in which case the element selected is the <i>N</i>-th from the
right.  The last element of the array is "<b>#-1</b>".  Think of
the "#" characters as the "number of elements in the array".  Then
the expression "#-1" evaluates to the integer that corresponds to 
the last entry in the array.  It is sometimes useful for the array
index to be just the <b>#</b> character, for example when appending
a value to an existing JSON array:

<ul>
<li><span class='jex'>json_set('[0,1,2]','$[#]','new')</span>
<span class='jans'>&rarr; '[0,1,2,"new"]'</span></li>

</ul>


<a name="varg"></a>

</p><h2 id="value_arguments"><span>3.4. </span>VALUE arguments</h2>

<p>
For functions that accept "<i>value</i>" arguments (also shown as
"<i>value1</i>" and "<i>value2</i>"),
those arguments are usually understood
to be literal strings that are quoted and become JSON string values
in the result.  Even if the input <i>value</i> strings look like 
well-formed JSON, they are still interpreted as literal strings in the
result.

</p><p>
However, if a <i>value</i> argument comes directly from the result of another
JSON function or from <a href="json1.html#jptr">the -> operator</a> (but not <a href="json1.html#jptr">the ->> operator</a>),
then the argument is understood to be actual JSON and
the complete JSON is inserted rather than a quoted string.

</p><p>
For example, in the following call to json_object(), the <i>value</i>
argument looks like a well-formed JSON array.  However, because it is just
ordinary SQL text, it is interpreted as a literal string and added to the
result as a quoted string:

<ul>
<li><span class='jex'>json_object('ex','[52,3.14159]')</span>
<span class='jans'>&rarr; '{"ex":"[52,3.14159]"}'</span></li>

<li><span class='jex'>json_object('ex',('[52,3.14159]'->>'$'))</span>
<span class='jans'>&rarr; '{"ex":"[52,3.14159]"}'</span></li>

</ul>


</p><p>
But if the <i>value</i> argument in the outer json_object() call is the
result of another JSON function like <a href="json1.html#jmini">json()</a> or <a href="json1.html#jarray">json_array()</a>, then
the value is understood to be actual JSON and is inserted as such:

<ul>
<li><span class='jex'>json_object('ex',json('[52,3.14159]'))</span>
<span class='jans'>&rarr; '{"ex":[52,3.14159]}'</span></li>

<li><span class='jex'>json_object('ex',json_array(52,3.14159))</span>
<span class='jans'>&rarr; '{"ex":[52,3.14159]}'</span></li>

<li><span class='jex'>json_object('ex','[52,3.14159]'->'$')</span>
<span class='jans'>&rarr; '{"ex":[52,3.14159]}'</span></li>

</ul>


</p><p>
To be clear: "<i>json</i>" arguments are always interpreted as JSON
regardless of where the value for that argument comes from.  But
"<i>value</i>" arguments are only interpreted as JSON if those arguments
come directly from another JSON function or <a href="json1.html#jptr">the -> operator</a>.

</p><p>
Within JSON value arguments interpreted as JSON strings, Unicode escape
sequences are not treated as equivalent to the characters or escaped
control characters represented by the expressed Unicode code point.
Such escape sequences are not translated or specially treated; they
are treated as plain text by SQLite's JSON functions.

</p><h2 id="compatibility"><span>3.5. </span>Compatibility</h2>

<p>
The current implementation of this JSON library uses a recursive descent
parser.  In order to avoid using excess stack space, any JSON input that has
more than 1000 levels of nesting is considered invalid.   Limits on nesting
depth are allowed for compatible implementations of JSON by
<a href="https://tools.ietf.org/html/rfc8259#section-9">RFC-8259 section 9</a>.

<a name="json5"></a>

</p><h2 id="json5_extensions"><span>3.6. </span>JSON5 Extensions</h2>

<p>
Beginning in version 3.42.0 (2023-05-16), these routines will
read and interpret input JSON text that includes
<a href="https://spec.json5.org/">JSON5</a> extensions.  However, JSON text generated
by these routines will always be strictly conforming to the 
<a href="https://json.org">canonical definition of JSON</a>.

</p><p>
Here is a synopsis of JSON5 extensions (adapted from the
<a href="https://spec.json5.org/#introduction">JSON5 specification</a>):

</p><ul>
<li> Object keys may be unquoted identifiers.
</li><li> Objects may have a single trailing comma.
</li><li> Arrays may have a single trailing comma.
</li><li> Strings may be single quoted.
</li><li> Strings may span multiple lines by escaping new line characters.
</li><li> Strings may include new character escapes.
</li><li> Numbers may be hexadecimal.
</li><li> Numbers may have a leading or trailing decimal point.
</li><li> Numbers may be "Infinity", "-Infinity", and "NaN".
</li><li> Numbers may begin with an explicit plus sign.
</li><li> Single (//...) and multi-line (/*...*/) comments are allowed.
</li><li> Additional white space characters are allowed.
</li></ul>

<p>
To convert string X from JSON5 into canonical JSON, invoke
"<a href="json1.html#jmini">json(X)</a>".  The output of the "<a href="json1.html#jmini">json()</a>" function will be canonical
JSON regardless of any JSON5 extensions that are present in the input.
For backwards compatibility, the <a href="json1.html#jvalid">json_valid(X)</a> function without a
"flags" argument continues
to report false for inputs that are not canonical JSON, even if the
input is JSON5 that the function is able to understand.  To determine
whether or not an input string is valid JSON5, include the 0x02 bit
in the "flags" argument to json_valid:  "<tt>json_valid(X,2)</tt>".

</p><p>
These routines understand all of JSON5, plus a little more.
SQLite extends the JSON5 syntax in these two ways:

</p><ol>
<li><p>
Strict JSON5 requires that
unquoted object keys must be ECMAScript 5.1 IdentifierNames.  But large
unicode tables and lots of code is required in order to determine whether or
not a key is an ECMAScript 5.1 IdentifierName.  For this reason,
SQLite allows object keys to include any unicode characters
greater than U+007f that are not whitespace characters.  This relaxed
definition of "identifier" greatly simplifies the implementation and allows
the JSON parser to be smaller and run faster.

</p></li><li><p>
JSON5 allows floating-point infinities to be expressed as
"<tt>Infinity</tt>", "<tt>-Infinity</tt>", or "<tt>+Infinity</tt>"
in exactly that case - the initial "I" is capitalized and all other
characters are lower case.  SQLite also allows the abbreviation "<tt>Inf</tt>"
to be used in place of "<tt>Infinity</tt>" and it allows both keywords
to appear in any combination of upper and lower case letters.
Similarly,
JSON5 allows "NaN" for not-a-number.  SQLite extends this to also allow
"QNaN" and "SNaN" in any combination of upper and lower case letters.
Note that SQLite interprets NaN, QNaN, and SNaN as just an alternative
spellings for "null".
This extension has been added because (we are told) there exists a lot
of JSON in the wild that includes these non-standard representations
for infinity and not-a-number.
</p></li></ol>


<h2 id="performance_considerations"><span>3.7. </span>Performance Considerations</h2>

<p>
Most JSON functions do their internal processing using JSONB.  So if the
input is text, they first must translate the input text into JSONB.
If the input is already in the JSONB format, no translation is needed,
that step can be skipped, and performance is faster.

</p><p>
For that reason,
when an argument to one JSON function is supplied by another
JSON function, it is usually more efficient to use the "<tt>jsonb_</tt>"
variant for the function used as the argument.  

</p><ul>
<li>
  <tt>... json_insert(A,'$.b',json(C)) ...</tt>
  &nbsp; &larr; Less efficient.
</li><li>
  <tt>... json_insert(A,'$.b',jsonb(C)) ...</tt>
  &nbsp; &larr; More efficient.
</li></ul>


<p>
The <a href="json1.html#jgroupobjectb">aggregate JSON SQL functions</a> are an exception to this rule.  Those
functions all do their processing using text instead of JSONB.  So for the
aggregate JSON SQL functions, it is more efficient for the arguments
to be supplied using "<tt>json_</tt>" functions than "<tt>jsonb_</tt>"
functions.

</p><ul>
<li>
  <tt>... json_group_array(json(A))) ...</tt>
  &nbsp; &larr; More efficient.
</li><li>
  <tt>... json_group_array(jsonb(A))) ...</tt>
  &nbsp; &larr; Less efficient.
</li></ul>

<a name="jblobbug"></a>

<h2 id="the_json_blob_input_bug"><span>3.8. </span>The JSON BLOB Input Bug</h2>

<p>If a JSON input is a BLOB that is not JSONB and that looks like
text JSON when cast to text, then it is accepted as text JSON.
This is actually a long-standing bug in the original implementation
that the SQLite developers were unaware of.  The documentation stated
that a BLOB input to a JSON function should raise an error.  But in the
actual implementation, the input would be accepted as long
as the BLOB content was a valid JSON string in the text encoding of
the database.

</p><p>This JSON BLOB input bug was accidentally fixed when the JSON routines
were reimplemented for the 3.45.0 release (2024-01-15).
That caused breakage in applications that had come to depend on the old
behavior.  (In defense of those applications:  they were often lured into
using BLOBs as JSON by the <a href="cli.html#fileio">readfile()</a> SQL function
available in the <a href="cli.html">CLI</a>.  Readfile() was used to read JSON from disk files,
but readfile() returns a BLOB.  And that worked for them, so why not just
do it?)

</p><p>For backwards compatibility,
the (formerly incorrect) legacy behavior of interpreting BLOBs as text JSON
if no other interpretation works
is hereby documented and is be officially supported in 
version 3.45.1 (2024-01-30) and all subsequent releases.

</p><h1 id="function_details"><span>4. </span>Function Details</h1>

<p>The following sections provide additional detail on the operation of
the various JSON functions and operators:

<a name="jmini"></a>

</p><h2 id="the_json_function"><span>4.1. </span>The json() function</h2>

<p>The json(X) function verifies that its argument X is a valid
JSON string or JSONB blob and returns a minified version of that JSON string
with all unnecessary whitespace removed.  If X is not a well-formed
JSON string or JSONB blob, then this routine throws an error.

</p><p>If the input is JSON5 text, then it is converted into canonical
RFC-8259 text prior to being returned.

</p><p>If the argument X to json(X) contains JSON objects with duplicate
labels, then it is undefined whether or not the duplicates are
preserved.  The current implementation preserves duplicates.
However, future enhancements
to this routine may choose to silently remove duplicates.

</p><p>
Example:

<ul>
<li><span class='jex'>json(' { "this" : "is", "a": [ "test" ] } ')</span>
<span class='jans'>&rarr; '{"this":"is","a":["test"]}'</span></li>

</ul>


<a name="jminib"></a>

</p><h2 id="the_jsonb_function"><span>4.2. </span>The jsonb() function</h2>

<p>The jsonb(X) function returns the binary JSONB representation
of the JSON provided as argument X.  An error is raised if X is
TEXT that does not have valid JSON syntax.

</p><p>If X is a BLOB and appears to be JSONB,
then this routine simply returns a copy of X.
Only the outer-most element of the JSONB input is examined, however.
The deep structure of the JSONB is not validated.

<a name="jarray"></a>

</p><h2 id="the_json_array_function"><span>4.3. </span>The json_array() function</h2>

<p>The json_array() SQL function accepts zero or more arguments and
returns a well-formed JSON array that is composed from those arguments.
If any argument to json_array() is a BLOB then an error is thrown.

</p><p>An argument with SQL type TEXT is normally converted into a quoted 
JSON string.  However, if the argument is the output from another json1
function, then it is stored as JSON.  This allows calls to json_array()
and <a href="json1.html#jobj">json_object()</a> to be nested.  The <a href="json1.html#jmini">json()</a> function can also
be used to force strings to be recognized as JSON.

</p><p>Examples:

<ul>
<li><span class='jex'>json_array(1,2,'3',4)</span>
<span class='jans'>&rarr; '[1,2,"3",4]'</span></li>

<li><span class='jex'>json_array('[1,2]')</span>
<span class='jans'>&rarr; '["[1,2]"]'</span></li>

<li><span class='jex'>json_array(json_array(1,2))</span>
<span class='jans'>&rarr; '[[1,2]]'</span></li>

<li><span class='jex'>json_array(1,null,'3','[4,5]','{"six":7.7}')</span>
<span class='jans'>&rarr; '[1,null,"3","[4,5]","{\"six\":7.7}"]'</span></li>

<li><span class='jex'>json_array(1,null,'3',json('[4,5]'),json('{"six":7.7}'))</span>
<span class='jans'>&rarr; '[1,null,"3",[4,5],{"six":7.7}]'</span></li>

</ul>



<a name="jarrayb"></a>

</p><h2 id="the_jsonb_array_function"><span>4.4. </span>The jsonb_array() function</h2>

<p>The jsonb_array() SQL function works just like the <a href="json1.html#jarray">json_array()</a>
function except that it returns the constructed JSON array in the
SQLite's private JSONB format rather than in the standard
RFC 8259 text format.

<a name="jarraylen"></a>

</p><h2 id="the_json_array_length_function"><span>4.5. </span>The json_array_length() function</h2>

<p>The json_array_length(X) function returns the number of elements
in the JSON array X, or 0 if X is some kind of JSON value other
than an array.  The json_array_length(X,P) locates the array at path P
within X and returns the length of that array, or 0 if path P locates
an element in X that is not a JSON array, and NULL if path P does not
locate any element of X.  Errors are thrown if either X is not 
well-formed JSON or if P is not a well-formed path.

</p><p>Examples:

<ul>
<li><span class='jex'>json_array_length('[1,2,3,4]')</span>
<span class='jans'>&rarr; 4</span></li>

<li><span class='jex'>json_array_length('[1,2,3,4]', '$')</span>
<span class='jans'>&rarr; 4</span></li>

<li><span class='jex'>json_array_length('[1,2,3,4]', '$[2]')</span>
<span class='jans'>&rarr; 0</span></li>

<li><span class='jex'>json_array_length('{"one":[1,2,3]}')</span>
<span class='jans'>&rarr; 0</span></li>

<li><span class='jex'>json_array_length('{"one":[1,2,3]}', '$.one')</span>
<span class='jans'>&rarr; 3</span></li>

<li><span class='jex'>json_array_length('{"one":[1,2,3]}', '$.two')</span>
<span class='jans'>&rarr; NULL</span></li>

</ul>



<a name="jerr"></a>

</p><h2 id="the_json_error_position_function"><span>4.6. </span>The json_error_position() function</h2>

<p>The json_error_positionf(X) function returns 0 if the input X is a
well-formed JSON or JSON5 string.  If the input X contains one or more
syntax errors, then this function returns the character position of the
first syntax error.  The left-most character is position 1.

</p><p>If the input X is a BLOB, then this routine returns 0 if X is
a well-formed JSONB blob.  If the return value is positive, then it
represents the <i>approximate</i> 1-based position in the BLOB of the
first detected error.

</p><p>
The json_error_position() function was added with
SQLite version 3.42.0 (2023-05-16).


<a name="jex"></a>

</p><h2 id="the_json_extract_function"><span>4.7. </span>The json_extract() function</h2>

<p>The json_extract(X,P1,P2,...) extracts and returns one or more 
values from the
well-formed JSON at X.  If only a single path P1 is provided, then the
SQL datatype of the result is NULL for a JSON null, INTEGER or REAL
for a JSON numeric value, an INTEGER zero for a JSON false value,
an INTEGER one for a JSON true value, the dequoted text for a 
JSON string value, and a text representation for JSON object and array values.
If there are multiple path arguments (P1, P2, and so forth) then this
routine returns SQLite text which is a well-formed JSON array holding
the various values.

</p><p>Examples:

<ul>
<li><span class='jex'>json_extract('{"a":2,"c":[4,5,{"f":7}]}', '$')</span>
<span class='jans'>&rarr; '{"a":2,"c":[4,5,{"f":7}]}'</span></li>

<li><span class='jex'>json_extract('{"a":2,"c":[4,5,{"f":7}]}', '$.c')</span>
<span class='jans'>&rarr; '[4,5,{"f":7}]'</span></li>

<li><span class='jex'>json_extract('{"a":2,"c":[4,5,{"f":7}]}', '$.c[2]')</span>
<span class='jans'>&rarr; '{"f":7}'</span></li>

<li><span class='jex'>json_extract('{"a":2,"c":[4,5,{"f":7}]}', '$.c[2].f')</span>
<span class='jans'>&rarr; 7</span></li>

<li><span class='jex'>json_extract('{"a":2,"c":[4,5],"f":7}','$.c','$.a')</span>
<span class='jans'>&rarr; '[[4,5],2]'</span></li>

<li><span class='jex'>json_extract('{"a":2,"c":[4,5],"f":7}','$.c[#-1]')</span>
<span class='jans'>&rarr; 5</span></li>

<li><span class='jex'>json_extract('{"a":2,"c":[4,5,{"f":7}]}', '$.x')</span>
<span class='jans'>&rarr; NULL</span></li>

<li><span class='jex'>json_extract('{"a":2,"c":[4,5,{"f":7}]}', '$.x', '$.a')</span>
<span class='jans'>&rarr; '[null,2]'</span></li>

<li><span class='jex'>json_extract('{"a":"xyz"}', '$.a')</span>
<span class='jans'>&rarr; 'xyz'</span></li>

<li><span class='jex'>json_extract('{"a":null}', '$.a')</span>
<span class='jans'>&rarr; NULL</span></li>

</ul>


</p><p>There is a subtle incompatibility between the json_extract() function
in SQLite and the json_extract() function in MySQL.  The MySQL version
of json_extract() always returns JSON.  The SQLite version of
json_extract() only returns JSON if there are two or more PATH arguments
(because the result is then a JSON array) or if the single PATH argument
references an array or object.  In SQLite, if json_extract() has only
a single PATH argument and that PATH references a JSON null or a string
or a numeric value, then json_extract() returns the corresponding SQL
NULL, TEXT, INTEGER, or REAL value.

</p><p>The difference between MySQL json_extract() and SQLite json_extract()
really only stands out when accessing individual values within the JSON
that are strings or NULLs.  The following table demonstrates the difference:

</p><center>
<table border="1" cellpadding="3" cellspacing="0">
<tr><th>Operation</th><th>SQLite Result</th><th>MySQL Result
</th></tr><tr><td>json_extract('{"a":null,"b":"xyz"}','$.a')</td><td>NULL</td><td>'null'
</td></tr><tr><td>json_extract('{"a":null,"b":"xyz"}','$.b')</td><td>'xyz'</td><td>'"xyz"'
</td></tr></table></center>

<a name="jexb"></a>

<h2 id="the_jsonb_extract_function"><span>4.8. </span>The jsonb_extract() function</h2>

<p>
The jsonb_extract() function works the same as the <a href="json1.html#jex">json_extract()</a> function,
except in cases where json_extract() would normally return a text
JSON array object, this routine returns the array or object in the
JSONB format.  For the common case where a text, numeric, null, or
boolean JSON element is returned, this routine works exactly the same
as json_extract().


<a name="jptr"></a>

</p><h2 id="the_and_operators"><span>4.9. </span>The -> and ->> operators</h2>

<p>Beginning with SQLite version 3.38.0 (2022-02-22), the ->
and ->> operators are available for extracting subcomponents of JSON.
The SQLite implementation of -> and ->> strives to be
compatible with both MySQL and PostgreSQL.
The -> and ->> operators take a JSON string or JSONB blob
as their left operand and a PATH expression or object field
label or array index as their right operand.  The -> operator
returns a text JSON representation of the selected subcomponent or
NULL if that subcomponent does not exist.  The ->> operator returns
an SQL TEXT, INTEGER, REAL, or NULL value that represents the selected
subcomponent, or NULL if the subcomponent does not exist.

</p><p>Both the -> and ->> operators select the same subcomponent
of the JSON to their left.  The difference is that -> always returns a
JSON representation of that subcomponent and the ->> operator always
returns an SQL representation of that subcomponent.  Thus, these operators
are subtly different from a two-argument <a href="json1.html#jex">json_extract()</a> function call.
A call to json_extract() with two arguments will return a JSON representation
of the subcomponent if and only if the subcomponent is a JSON array or
object, and will return an SQL representation of the subcomponent if the
subcomponent is a JSON null, string, or numeric value.

</p><p>When the -> operator returns JSON, it always returns the
RFC 8565 text representation of that JSON, not JSONB.  Use the
<a href="json1.html#jexb">jsonb_extract()</a> function if you need a subcomponent in the
JSONB format.

</p><p>The right-hand operand to the -> and ->> operators can
be a well-formed JSON path expression.  This is the form used by MySQL.
For compatibility with PostgreSQL,
the -> and ->> operators also accept a text object label or
integer array index as their right-hand operand.
If the right operand is a text
label X, then it is interpreted as the JSON path '$.X'.  If the right
operand is an integer value N, then it is interpreted as the JSON path '$[N]'.

</p><p>Examples:

<ul>
<li><span class='jex'>'{"a":2,"c":[4,5,{"f":7}]}' -> '$'</span>
<span class='jans'>&rarr; '{"a":2,"c":[4,5,{"f":7}]}'</span></li>

<li><span class='jex'>'{"a":2,"c":[4,5,{"f":7}]}' -> '$.c'</span>
<span class='jans'>&rarr; '[4,5,{"f":7}]'</span></li>

<li><span class='jex'>'{"a":2,"c":[4,5,{"f":7}]}' -> 'c'</span>
<span class='jans'>&rarr; '[4,5,{"f":7}]'</span></li>

<li><span class='jex'>'{"a":2,"c":[4,5,{"f":7}]}' -> '$.c[2]'</span>
<span class='jans'>&rarr; '{"f":7}'</span></li>

<li><span class='jex'>'{"a":2,"c":[4,5,{"f":7}]}' -> '$.c[2].f'</span>
<span class='jans'>&rarr; '7'</span></li>

<li><span class='jex'>'{"a":2,"c":[4,5,{"f":7}]}' ->> '$.c[2].f'</span>
<span class='jans'>&rarr; 7</span></li>

<li><span class='jex'>'{"a":2,"c":[4,5,{"f":7}]}' -> 'c' -> 2 ->> 'f'</span>
<span class='jans'>&rarr; 7</span></li>

<li><span class='jex'>'{"a":2,"c":[4,5],"f":7}' -> '$.c[#-1]'</span>
<span class='jans'>&rarr; '5'</span></li>

<li><span class='jex'>'{"a":2,"c":[4,5,{"f":7}]}' -> '$.x'</span>
<span class='jans'>&rarr; NULL</span></li>

<li><span class='jex'>'[11,22,33,44]' -> 3</span>
<span class='jans'>&rarr; '44'</span></li>

<li><span class='jex'>'[11,22,33,44]' ->> 3</span>
<span class='jans'>&rarr; 44</span></li>

<li><span class='jex'>'{"a":"xyz"}' -> '$.a'</span>
<span class='jans'>&rarr; '"xyz"'</span></li>

<li><span class='jex'>'{"a":"xyz"}' ->> '$.a'</span>
<span class='jans'>&rarr; 'xyz'</span></li>

<li><span class='jex'>'{"a":null}' -> '$.a'</span>
<span class='jans'>&rarr; 'null'</span></li>

<li><span class='jex'>'{"a":null}' ->> '$.a'</span>
<span class='jans'>&rarr; NULL</span></li>

</ul>


<a name="jins"></a>

<a name="jrepl"></a>

<a name="jset"></a>

</p><h2 id="the_json_insert_json_replace_and_json_set_functions"><span>4.10. </span>The json_insert(), json_replace, and json_set() functions</h2>

<p>The json_insert(), json_replace, and json_set() functions all take
a single JSON value as their first argument followed by zero or more
pairs of path and value arguments, and return a new JSON string formed
by updating the input JSON by the path/value pairs.  The functions
differ only in how they deal with creating new values and overwriting
preexisting values.

</p><center>
<table border="1" cellpadding="3" cellspacing="0">
<tr>
<th>Function</th><th>Overwrite if already exists?</th><th>Create if does not exist?
</th></tr><tr>
<td>json_insert()</td><td align="center">No</td><td align="center">Yes
</td></tr><tr>
<td>json_replace()</td><td align="center">Yes</td><td align="center">No
</td></tr><tr>
<td>json_set()</td><td align="center">Yes</td><td align="center">Yes
</td></tr></table></center>

<p>The json_insert(), json_replace(), and json_set() functions always
take an odd number of arguments.  The first argument is always the original
JSON to be edited.  Subsequent arguments occur in pairs with the first
element of each pair being a path and the second element being the value
to insert or replace or set on that path.

</p><p>Edits occur sequentially from left to right.  Changes caused by
prior edits can affect the path search for subsequent edits.

</p><p>If the value of a path/value pair is an SQLite TEXT value, then it
is normally inserted as a quoted JSON string, even if the string looks
like valid JSON.  However, if the value is the result of another
json function (such as <a href="json1.html#jmini">json()</a> or <a href="json1.html#jarray">json_array()</a> or <a href="json1.html#jobj">json_object()</a>)
or if it is the result of <a href="json1.html#jptr">the -> operator</a>,
then it is interpreted as JSON and is inserted as JSON retaining all
of its substructure.  Values that are the result of <a href="json1.html#jptr">the ->> operator</a>
are always interpreted as TEXT and are inserted as a JSON string even
if they look like valid JSON.

</p><p>These routines throw an error if the first JSON argument is not
well-formed or if any PATH argument is not well-formed or if any
argument is a BLOB.

</p><p>To append an element onto the end of an array, using json_insert()
with an array index of "#".  Examples:

<ul>
<li><span class='jex'>json_insert('[1,2,3,4]','$[#]',99)</span>
<span class='jans'>&rarr; '[1,2,3,4,99]'</span></li>

<li><span class='jex'>json_insert('[1,[2,3],4]','$[1][#]',99)</span>
<span class='jans'>&rarr; '[1,[2,3,99],4]'</span></li>

</ul>


</p><p>Other examples:

<ul>
<li><span class='jex'>json_insert('{"a":2,"c":4}', '$.a', 99)</span>
<span class='jans'>&rarr; '{"a":2,"c":4}'</span></li>

<li><span class='jex'>json_insert('{"a":2,"c":4}', '$.e', 99)</span>
<span class='jans'>&rarr; '{"a":2,"c":4,"e":99}'</span></li>

<li><span class='jex'>json_replace('{"a":2,"c":4}', '$.a', 99)</span>
<span class='jans'>&rarr; '{"a":99,"c":4}'</span></li>

<li><span class='jex'>json_replace('{"a":2,"c":4}', '$.e', 99)</span>
<span class='jans'>&rarr; '{"a":2,"c":4}'</span></li>

<li><span class='jex'>json_set('{"a":2,"c":4}', '$.a', 99)</span>
<span class='jans'>&rarr; '{"a":99,"c":4}'</span></li>

<li><span class='jex'>json_set('{"a":2,"c":4}', '$.e', 99)</span>
<span class='jans'>&rarr; '{"a":2,"c":4,"e":99}'</span></li>

<li><span class='jex'>json_set('{"a":2,"c":4}', '$.c', '[97,96]')</span>
<span class='jans'>&rarr; '{"a":2,"c":"[97,96]"}'</span></li>

<li><span class='jex'>json_set('{"a":2,"c":4}', '$.c', json('[97,96]'))</span>
<span class='jans'>&rarr; '{"a":2,"c":[97,96]}'</span></li>

<li><span class='jex'>json_set('{"a":2,"c":4}', '$.c', json_array(97,96))</span>
<span class='jans'>&rarr; '{"a":2,"c":[97,96]}'</span></li>

</ul>


<a name="jinsb"></a>

<a name="jreplb"></a>

<a name="jsetb"></a>

</p><h2 id="the_jsonb_insert_jsonb_replace_and_jsonb_set_functions"><span>4.11. </span>The jsonb_insert(), jsonb_replace, and jsonb_set() functions</h2>

<p>The jsonb_insert(), jsonb_replace(), and jsonb_set() functions work the
same as <a href="json1.html#jins">json_insert()</a>, <a href="json1.html#jrepl">json_replace()</a>, and <a href="json1.html#jset">json_set()</a>, respectively,
except that "<tt>jsonb_</tt>" versions return their result in the binary
JSONB format.

<a name="jobj"></a>

</p><h2 id="the_json_object_function"><span>4.12. </span>The json_object() function</h2>

<p>The json_object() SQL function accepts zero or more pairs of arguments
and returns a well-formed JSON object that is composed from those arguments.
The first argument of each pair is the label and the second argument of
each pair is the value.
If any argument to json_object() is a BLOB then an error is thrown.

</p><p>The json_object() function currently allows duplicate labels without
complaint, though this might change in a future enhancement.

</p><p>An argument with SQL type TEXT it is normally converted into a quoted 
JSON string even if the input text is well-formed JSON.  
However, if the argument is the direct result from another JSON
function or <a href="json1.html#jptr">the -> operator</a> (but not <a href="json1.html#jptr">the ->> operator</a>), 
then it is treated as JSON and all of its JSON type information
and substructure is preserved.  This allows calls to json_object()
and <a href="json1.html#jarray">json_array()</a> to be nested.  The <a href="json1.html#jmini">json()</a> function can also
be used to force strings to be recognized as JSON.

</p><p>Examples:

<ul>
<li><span class='jex'>json_object('a',2,'c',4)</span>
<span class='jans'>&rarr; '{"a":2,"c":4}'</span></li>

<li><span class='jex'>json_object('a',2,'c','{e:5}')</span>
<span class='jans'>&rarr; '{"a":2,"c":"{e:5}"}'</span></li>

<li><span class='jex'>json_object('a',2,'c',json_object('e',5))</span>
<span class='jans'>&rarr; '{"a":2,"c":{"e":5}}'</span></li>

</ul>


<a name="jobjb"></a>

</p><h2 id="the_jsonb_object_function"><span>4.13. </span>The jsonb_object() function</h2>

<p>
The jsonb_object() function works just like the <a href="json1.html#jobj">json_object()</a> function
except that the generated object is returned in the binary JSONB format.

<a name="jpatch"></a>

</p><h2 id="the_json_patch_function"><span>4.14. </span>The json_patch() function</h2>

<p>The json_patch(T,P) SQL function runs the
<a href="https://tools.ietf.org/html/rfc7396">RFC-7396</a> MergePatch algorithm
to apply patch P against input T.  The patched copy of T is returned.

</p><p>MergePatch can add, modify, or delete elements of a JSON Object,
and so for JSON Objects, the json_patch() routine is a generalized
replacement for <a href="json1.html#jset">json_set()</a> and <a href="json1.html#jrm">json_remove()</a>.  However, MergePatch
treats JSON Array objects as atomic.  MergePatch cannot append to an
Array nor modify individual elements of an Array.  It can only insert,
replace, or delete the whole Array as a single unit.  Hence, json_patch()
is not as useful when dealing with JSON that includes Arrays,
especially Arrays with lots of substructure.

</p><p>Examples:

<ul>
<li><span class='jex'>json_patch('{"a":1,"b":2}','{"c":3,"d":4}')</span>
<span class='jans'>&rarr; '{"a":1,"b":2,"c":3,"d":4}'</span></li>

<li><span class='jex'>json_patch('{"a":[1,2],"b":2}','{"a":9}')</span>
<span class='jans'>&rarr; '{"a":9,"b":2}'</span></li>

<li><span class='jex'>json_patch('{"a":[1,2],"b":2}','{"a":null}')</span>
<span class='jans'>&rarr; '{"b":2}'</span></li>

<li><span class='jex'>json_patch('{"a":1,"b":2}','{"a":9,"b":null,"c":8}')</span>
<span class='jans'>&rarr; '{"a":9,"c":8}'</span></li>

<li><span class='jex'>json_patch('{"a":{"x":1,"y":2},"b":3}','{"a":{"y":9},"c":8}')</span>
<span class='jans'>&rarr; '{"a":{"x":1,"y":9},"b":3,"c":8}'</span></li>

</ul>



<a name="jpatchb"></a>

</p><h2 id="the_jsonb_patch_function"><span>4.15. </span>The jsonb_patch() function</h2>

<p>
The jsonb_patch() function works just like the <a href="json1.html#jpatch">json_patch()</a> function
except that the patched JSON is returned in the binary JSONB format.

<a name="jrm"></a>

</p><h2 id="the_json_remove_function"><span>4.16. </span>The json_remove() function</h2>

<p>The json_remove(X,P,...) function takes a single JSON value as its
first argument followed by zero or more path arguments.
The json_remove(X,P,...) function returns
a copy of the X parameter with all the elements 
identified by path arguments removed.  Paths that select elements
not found in X are silently ignored.

</p><p>Removals occurs sequentially from left to right.  Changes caused by
prior removals can affect the path search for subsequent arguments.

</p><p>If the json_remove(X) function is called with no path arguments,
then it returns the input X reformatted, with excess whitespace
removed.

</p><p>The json_remove() function throws an error if the first argument
is not well-formed JSON or if any later argument is not a well-formed
path.

</p><p>Examples:

<ul>
<li><span class='jex'>json_remove('[0,1,2,3,4]','$[2]')</span>
<span class='jans'>&rarr; '[0,1,3,4]'</span></li>

<li><span class='jex'>json_remove('[0,1,2,3,4]','$[2]','$[0]')</span>
<span class='jans'>&rarr; '[1,3,4]'</span></li>

<li><span class='jex'>json_remove('[0,1,2,3,4]','$[0]','$[2]')</span>
<span class='jans'>&rarr; '[1,2,4]'</span></li>

<li><span class='jex'>json_remove('[0,1,2,3,4]','$[#-1]','$[0]')</span>
<span class='jans'>&rarr; '[1,2,3]'</span></li>

<li><span class='jex'>json_remove('{"x":25,"y":42}')</span>
<span class='jans'>&rarr; '{"x":25,"y":42}'</span></li>

<li><span class='jex'>json_remove('{"x":25,"y":42}','$.z')</span>
<span class='jans'>&rarr; '{"x":25,"y":42}'</span></li>

<li><span class='jex'>json_remove('{"x":25,"y":42}','$.y')</span>
<span class='jans'>&rarr; '{"x":25}'</span></li>

<li><span class='jex'>json_remove('{"x":25,"y":42}','$')</span>
<span class='jans'>&rarr; NULL</span></li>

</ul>


<a name="jrmb"></a>

</p><h2 id="the_jsonb_remove_function"><span>4.17. </span>The jsonb_remove() function</h2>
<p>
The jsonb_remove() function works just like the <a href="json1.html#jrm">json_remove()</a> function
except that the edited JSON result is returned in the binary JSONB format.

<a name="jtype"></a>

</p><h2 id="the_json_type_function"><span>4.18. </span>The json_type() function</h2>

<p>The json_type(X) function returns the "type" of the outermost element
of X.  The json_type(X,P) function returns the "type" of the element
in X that is selected by path P.  The "type" returned by json_type() is
one of the following SQL text values:
'null', 'true', 'false', 'integer', 'real', 'text', 'array', or 'object'.
If the path P in json_type(X,P) selects an element that does not exist
in X, then this function returns NULL.

</p><p>The json_type() function throws an error if its first argument is
not well-formed JSON or JSONB or if its second argument is not a well-formed
JSON path.

</p><p>Examples:

<ul>
<li><span class='jex'>json_type('{"a":[2,3.5,true,false,null,"x"]}')</span>
<span class='jans'>&rarr; 'object'</span></li>

<li><span class='jex'>json_type('{"a":[2,3.5,true,false,null,"x"]}','$')</span>
<span class='jans'>&rarr; 'object'</span></li>

<li><span class='jex'>json_type('{"a":[2,3.5,true,false,null,"x"]}','$.a')</span>
<span class='jans'>&rarr; 'array'</span></li>

<li><span class='jex'>json_type('{"a":[2,3.5,true,false,null,"x"]}','$.a[0]')</span>
<span class='jans'>&rarr; 'integer'</span></li>

<li><span class='jex'>json_type('{"a":[2,3.5,true,false,null,"x"]}','$.a[1]')</span>
<span class='jans'>&rarr; 'real'</span></li>

<li><span class='jex'>json_type('{"a":[2,3.5,true,false,null,"x"]}','$.a[2]')</span>
<span class='jans'>&rarr; 'true'</span></li>

<li><span class='jex'>json_type('{"a":[2,3.5,true,false,null,"x"]}','$.a[3]')</span>
<span class='jans'>&rarr; 'false'</span></li>

<li><span class='jex'>json_type('{"a":[2,3.5,true,false,null,"x"]}','$.a[4]')</span>
<span class='jans'>&rarr; 'null'</span></li>

<li><span class='jex'>json_type('{"a":[2,3.5,true,false,null,"x"]}','$.a[5]')</span>
<span class='jans'>&rarr; 'text'</span></li>

<li><span class='jex'>json_type('{"a":[2,3.5,true,false,null,"x"]}','$.a[6]')</span>
<span class='jans'>&rarr; NULL</span></li>

</ul>


<a name="jvalid"></a>

</p><h2 id="the_json_valid_function"><span>4.19. </span>The json_valid() function</h2>

<p>The json_valid(X,Y) function return 1 if the argument X is well-formed
JSON, or returns 0 if X is not well-formed.  The Y parameter is an integer
bitmask that defines what is meant by "well-formed".  The following bits
of Y are currently defined:

</p><ul>
<li> <b>0x01</b> &rarr;
The input is text that strictly complies with canonical RFC-8259 JSON,
without any extensions.
</li><li> <b>0x02</b> &rarr;
The input is text that is JSON with <a href="json1.html#json5">JSON5</a> extensions described above.
</li><li> <b>0x04</b> &rarr;
The input is a BLOB that superficially appears to be <a href="json1.html#jsonbx">JSONB</a>.
</li><li> <b>0x08</b> &rarr;
The input is a BLOB that strictly conforms to the internal <a href="json1.html#jsonbx">JSONB</a> format.
</li></ul>

<p>By combining bits, the following useful values of Y can be derived:

</p><ul>
<li> <b>1</b> &rarr; X is RFC-8259 JSON text
</li><li> <b>2</b> &rarr; X is <a href="json1.html#json5">JSON5</a> text
</li><li> <b>4</b> &rarr; X is probably <a href="json1.html#jsonbx">JSONB</a>
</li><li> <b>5</b> &rarr; X is RFC-8259 JSON text or <a href="json1.html#jsonbx">JSONB</a>
</li><li> <b>6</b> &rarr; X is <a href="json1.html#json5">JSON5</a> text or <a href="json1.html#jsonbx">JSONB</a>
     &larr; <i>This is probably the value you want</i>
</li><li> <b>8</b> &rarr; X is strictly conforming <a href="json1.html#jsonbx">JSONB</a>
</li><li> <b>9</b> &rarr; X is RFC-8259 or strictly conforming <a href="json1.html#jsonbx">JSONB</a>
</li><li> <b>10</b> &rarr; X is JSON5 or strictly conforming <a href="json1.html#jsonbx">JSONB</a>
</li></ul>

<p>The Y parameter is optional. If omitted, it defaults to 1, which means
that the default behavior is to return true only if the input X is
strictly conforming RFC-8259 JSON text without any extensions.  This
makes the one-argument version of json_valid() compatible with older
versions of SQLite, prior to the addition of support for
<a href="json1.html#json5">JSON5</a> and <a href="json1.html#jsonbx">JSONB</a>.

</p><p>The difference between 0x04 and 0x08 bits in the Y parameter is that
0x04 only examines the outer wrapper of the BLOB to see if it superficially
looks like <a href="json1.html#jsonbx">JSONB</a>.  This is sufficient for must purposes and is very fast.
The 0x08 bit does a thorough examination of all internal details of the BLOB.
The 0x08 bit takes time that is linear in the size of the X input and is much
slower.  The 0x04 bit is recommended for most purposes.

</p><p>If you just want to know if a value is a plausible input to one of
the other JSON functions, a Y value of 6 is probably what you want to use.

</p><p>Any Y value less than 1 or greater than 15 raises an error, for the
latest version of json_valid().  However, future versions of json_valid()
might be enhanced to accept flag values outside of this range, having new
meanings that we have not yet thought of.

</p><p>If either X or Y inputs to json_valid() are NULL, then the function
returns NULL.

</p><p>Examples:

<ul>
<li><span class='jex'>json_valid('{"x":35}')</span>
<span class='jans'>&rarr; 1</span></li>

<li><span class='jex'>json_valid('{x:35}')</span>
<span class='jans'>&rarr; 0</span></li>

<li><span class='jex'>json_valid('{x:35}',6)</span>
<span class='jans'>&rarr; 1</span></li>

<li><span class='jex'>json_valid('{"x":35')</span>
<span class='jans'>&rarr; 0</span></li>

<li><span class='jex'>json_valid(NULL)</span>
<span class='jans'>&rarr; NULL</span></li>

</ul>


<a name="jquote"></a>

</p><h2 id="the_json_quote_function"><span>4.20. </span>The json_quote() function</h2>

<p>The json_quote(X) function converts the SQL value X (a number or a
string) into its corresponding JSON representation.  If X is a JSON value
returned by another JSON function, then this function is a no-op.

</p><p>Examples:

<ul>
<li><span class='jex'>json_quote(3.14159)</span>
<span class='jans'>&rarr; 3.14159</span></li>

<li><span class='jex'>json_quote('verdant')</span>
<span class='jans'>&rarr; '"verdant"'</span></li>

<li><span class='jex'>json_quote('[1]')</span>
<span class='jans'>&rarr; '"[1]"'</span></li>

<li><span class='jex'>json_quote(json('[1]'))</span>
<span class='jans'>&rarr; '[1]'</span></li>

<li><span class='jex'>json_quote('[1,')</span>
<span class='jans'>&rarr; '"[1,"'</span></li>

</ul>


<a name="jgrouparray"></a>
<a name="jgroupobject"></a>
<a name="jgrouparrayb"></a>
<a name="jgroupobjectb"></a>

</p><h2 id="array_and_object_aggregate_functions"><span>4.21. </span>Array and object aggregate functions</h2>

<p>The json_group_array(X) function is an
<a href="lang_aggfunc.html">aggregate SQL function</a> that returns a JSON array
comprised of all X values in the aggregation.
Similarly, the json_group_object(NAME,VALUE) function returns a JSON object
comprised of all NAME/VALUE pairs in the aggregation.
The "<tt>jsonb_</tt>" variants are the same except that they return their
result in the binary <a href="json1.html#jsonbx">JSONB</a> format.

<a name="jeach"></a>

<a name="jtree"></a>

</p><h2 id="the_json_each_and_json_tree_table_valued_functions"><span>4.22. </span>The json_each() and json_tree() table-valued functions</h2>

<p>The json_each(X) and json_tree(X) <a href="vtab.html#tabfunc2">table-valued functions</a> walk the
JSON value provided as their first argument and return one row for each
element.  The json_each(X) function only walks the immediate children
of the top-level array or object,
or just the top-level element itself if the top-level
element is a primitive value.
The json_tree(X) function recursively walks through the
JSON substructure starting with the top-level element.  

</p><p>The json_each(X,P) and json_tree(X,P) functions work just like
their one-argument counterparts except that they treat the element
identified by path P as the top-level element.

</p><p>The schema for the table returned by json_each() and json_tree() is
as follows:

</p><blockquote><pre>
CREATE TABLE json_tree(
    key ANY,             -- key for current element relative to its parent
    value ANY,           -- value for the current element
    type TEXT,           -- 'object','array','string','integer', etc.
    atom ANY,            -- value for primitive types, null for array & object
    id INTEGER,          -- integer ID for this element
    parent INTEGER,      -- integer ID for the parent of this element
    fullkey TEXT,        -- full path describing the current element
    path TEXT,           -- path to the container of the current row
    json JSON HIDDEN,    -- 1st input parameter: the raw JSON
    root TEXT HIDDEN     -- 2nd input parameter: the PATH at which to start
);
</pre></blockquote>

<p>
The "key" column is the integer array index for elements of a JSON array 
and the text label for elements of a JSON object.  The key column is
NULL in all other cases.

</p><p>
The "atom" column is the SQL value corresponding to primitive elements - 
elements other than JSON arrays and objects.  The "atom" column is NULL
for a JSON array or object.  The "value" column is the same as the
"atom" column for primitive JSON elements but takes on the text JSON value
for arrays and objects.

</p><p>
The "type" column is an SQL text value taken from ('null', 'true', 'false',
'integer', 'real', 'text', 'array', 'object') according to the type of
the current JSON element.

</p><p>
The "id" column is an integer that identifies a specific JSON element
within the complete JSON string.  The "id" integer is an internal housekeeping
number, the computation of which might change in future releases.  The
only guarantee is that the "id" column will be different for every row.

</p><p>
The "parent" column is always NULL for json_each().
For json_tree(),
the "parent" column is the "id" integer for the parent of the current
element, or NULL for the top-level JSON element or the element identified
by the root path in the second argument.

</p><p>
The "fullkey" column is a text path that uniquely identifies the current
row element within the original JSON string.  The complete key to the
true top-level element is returned even if an alternative starting point
is provided by the "root" argument.

</p><p>
The "path" column is the path to the array or object container that holds 
the current row, or the path to the current row in the case where the 
iteration starts on a primitive type and thus only provides a single
row of output.

</p><h3 id="examples_using_json_each_and_json_tree_"><span>4.22.1. </span>Examples using json_each() and json_tree()</h3>

<p>Suppose the table "CREATE TABLE user(name,phone)" stores zero or
more phone numbers as a JSON array object in the user.phone field.
To find all users who have any phone number with a 704 area code:

</p><blockquote><pre>
SELECT DISTINCT user.name
  FROM user, json_each(user.phone)
 WHERE json_each.value LIKE '704-%';
</pre></blockquote>

<p>Now suppose the user.phone field contains plain text if the user
has only a single phone number and a JSON array if the user has multiple
phone numbers.  The same question is posed: "Which users have a phone number
in the 704 area code?"  But now the json_each() function can only be called
for those users that have two or more phone numbers since json_each()
requires well-formed JSON as its first argument:

</p><blockquote><pre>
SELECT name FROM user WHERE phone LIKE '704-%'
UNION
SELECT user.name
  FROM user, json_each(user.phone)
 WHERE json_valid(user.phone)
   AND json_each.value LIKE '704-%';
</pre></blockquote>

<p>Consider a different database with "CREATE TABLE big(json JSON)".
To see a complete line-by-line decomposition of the data:

</p><blockquote><pre>
SELECT big.rowid, fullkey, value
  FROM big, json_tree(big.json)
 WHERE json_tree.type NOT IN ('object','array');
</pre></blockquote>

<p>In the previous, the "type NOT IN ('object','array')" term of the
WHERE clause suppresses containers and only lets through leaf elements.
The same effect could be achieved this way:

</p><blockquote><pre>
SELECT big.rowid, fullkey, atom
  FROM big, json_tree(big.json)
 WHERE atom IS NOT NULL;
</pre></blockquote>

<p>Suppose each entry in the BIG table is a JSON object 
with a '$.id' field that is a unique identifier
and a '$.partlist' field that can be a deeply nested object.
You want to find the id of every entry that contains one
or more references to uuid '6fa5181e-5721-11e5-a04e-57f3d7b32808' anywhere
in its '$.partlist'.

</p><blockquote><pre>
SELECT DISTINCT json_extract(big.json,'$.id')
  FROM big, json_tree(big.json, '$.partlist')
 WHERE json_tree.key='uuid'
   AND json_tree.value='6fa5181e-5721-11e5-a04e-57f3d7b32808';
</pre></blockquote>
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/json1.in?m=5d7bcbf1b3">2024-03-14 14:17:16</a> UTC </small></i></p>

Added Doc/Extra/Core/lang.html.



































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>Query Language Understood by SQLite</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>


<h1 align=center>SQL As Understood By SQLite</h1>

<p>SQLite understands most of the standard SQL
language.  But it does <a href="omitted.html">omit some features</a>
while at the same time
adding a few features of its own.  This document attempts to
describe precisely what parts of the SQL language SQLite does
and does not support.  A list of <a href="lang_keywords.html">SQL keywords</a> is
also provided.  The SQL language syntax is described by
<a href="syntaxdiagrams.html">syntax diagrams</a>.

<p>The following syntax documentation topics are available:</p>

<table width="100%" cellpadding="5" border="0">
<tr><td valign="top"><ul>

<div class='columns' style='columns: 17em auto;'>
<ul style='padding-top:0;'>
<li><a href='lang_aggfunc.html'>aggregate functions</a></li>
<li><a href='lang_altertable.html'>ALTER TABLE</a></li>
<li><a href='lang_analyze.html'>ANALYZE</a></li>
<li><a href='lang_attach.html'>ATTACH DATABASE</a></li>
<li><a href='lang_transaction.html'>BEGIN TRANSACTION</a></li>
<li><a href='lang_comment.html'>comment</a></li>
<li><a href='lang_transaction.html'>COMMIT TRANSACTION</a></li>
<li><a href='lang_corefunc.html'>core functions</a></li>
<li><a href='lang_createindex.html'>CREATE INDEX</a></li>
<li><a href='lang_createtable.html'>CREATE TABLE</a></li>
<li><a href='lang_createtrigger.html'>CREATE TRIGGER</a></li>
<li><a href='lang_createview.html'>CREATE VIEW</a></li>
<li><a href='lang_createvtab.html'>CREATE VIRTUAL TABLE</a></li>
<li><a href='lang_datefunc.html'>date and time functions</a></li>
<li><a href='lang_delete.html'>DELETE</a></li>
<li><a href='lang_detach.html'>DETACH DATABASE</a></li>
<li><a href='lang_dropindex.html'>DROP INDEX</a></li>
<li><a href='lang_droptable.html'>DROP TABLE</a></li>
<li><a href='lang_droptrigger.html'>DROP TRIGGER</a></li>
<li><a href='lang_dropview.html'>DROP VIEW</a></li>
<li><a href='lang_transaction.html'>END TRANSACTION</a></li>
<li><a href='lang_explain.html'>EXPLAIN</a></li>
<li><a href='lang_expr.html'>expression</a></li>
<li><a href='lang_indexedby.html'>INDEXED BY</a></li>
<li><a href='lang_insert.html'>INSERT</a></li>
<li><a href='lang_keywords.html'>keywords</a></li>
<li><a href='lang_conflict.html'>ON CONFLICT clause</a></li>
<li><a href='pragma.html#syntax'>PRAGMA</a></li>
<li><a href='lang_reindex.html'>REINDEX</a></li>
<li><a href='lang_savepoint.html'>RELEASE SAVEPOINT</a></li>
<li><a href='lang_replace.html'>REPLACE</a></li>
<li><a href='lang_returning.html'>RETURNING clause</a></li>
<li><a href='lang_transaction.html'>ROLLBACK TRANSACTION</a></li>
<li><a href='lang_savepoint.html'>SAVEPOINT</a></li>
<li><a href='lang_select.html'>SELECT</a></li>
<li><a href='lang_update.html'>UPDATE</a></li>
<li><a href='lang_upsert.html'>UPSERT</a></li>
<li><a href='lang_vacuum.html'>VACUUM</a></li>
<li><a href='lang_with.html'>WITH clause</a></li>
</ul>
</div>

</ul></td></tr></table>

<p>The routines <a href="c3ref/prepare.html">sqlite3_prepare_v2()</a>, <a href="c3ref/prepare.html">sqlite3_prepare()</a>,
<a href="c3ref/prepare.html">sqlite3_prepare16()</a>, <a href="c3ref/prepare.html">sqlite3_prepare16_v2()</a>,
<a href="c3ref/exec.html">sqlite3_exec()</a>, and <a href="c3ref/free_table.html">sqlite3_get_table()</a> accept
an SQL statement list (sql-stmt-list) which is a semicolon-separated
list of statements.</p>

<p><b><a href="syntax/sql-stmt-list.html">sql-stmt-list:</a></b></p><div class='imgcontainer'>
 <div style="max-width:242px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 242.093 88.776">
<circle cx="5" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M9,55L45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="81,55 69,59 69,50" style="fill:rgb(0,0,0)"/>
<path d="M45,55L75,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M81,70L160,70L160,39L81,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="121" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">sql-stmt</text>
<path d="M160,55L196,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="232,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M196,55L226,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="236" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,82 109,86 109,77" style="fill:rgb(0,0,0)"/>
<path d="M45,55 L 52,55 Q 60,55 60,68 Q 60,82 75,82 L 100,82 L 115,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,82 L 155,82 Q 170,82 170,68 Q 170,55 177,55 L 185,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,32A15 15 0 0 0 136 17L136,17A15 15 0 0 0 121 2A15 15 0 0 0 105 17L105,17A15 15 0 0 0 121 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="121" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">;</text>
<polygon points="136,17 147,12 147,21" style="fill:rgb(0,0,0)"/>
<path d="M196,55 L 204,55 Q 211,55 211,40 L 211,32 Q 211,17 196,17 L 156,17 L 141,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,17 L 33,17 Q 18,17 18,32 L 18,40 Q 18,55 26,55 L 33,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
 </div>


<p>Each SQL statement in the statement list is an instance of the
following:</p>

<p><b><a href="syntax/sql-stmt.html">sql-stmt:</a></b></p><div class='imgcontainer'>
 <div style="max-width:716px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 716.88 1017.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L125,70A15 15 0 0 0 140 55L140,55A15 15 0 0 0 125 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="95" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXPLAIN</text>
<polygon points="176,55 165,59 165,50" style="fill:rgb(0,0,0)"/>
<path d="M140,55L170,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M191,70L235,70A15 15 0 0 0 250 55L250,55A15 15 0 0 0 235 39L191,39A15 15 0 0 0 176 55L176,55A15 15 0 0 0 191 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="213" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">QUERY</text>
<polygon points="267,55 255,59 255,50" style="fill:rgb(0,0,0)"/>
<path d="M250,55L261,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M282,70L311,70A15 15 0 0 0 327 55L327,55A15 15 0 0 0 311 39L282,39A15 15 0 0 0 267 55L267,55A15 15 0 0 0 282 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="297" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PLAN</text>
<polygon points="368,17 357,21 357,12" style="fill:rgb(0,0,0)"/>
<path d="M327,55 L 334,55 Q 342,55 342,40 L 342,32 Q 342,17 352,17 L 362,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="182,17 170,21 170,12" style="fill:rgb(0,0,0)"/>
<path d="M140,55 L 148,55 Q 155,55 155,40 L 155,32 Q 155,17 166,17 L 176,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M182,17L357,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M9,17L170,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="410,17 398,21 398,12" style="fill:rgb(0,0,0)"/>
<path d="M368,17L404,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,32L552,32L552,2L410,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">alter-table-stmt</text>
<polygon points="666,17 654,21 654,12" style="fill:rgb(0,0,0)"/>
<path d="M552,17L660,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="707,17 696,21 696,12" style="fill:rgb(0,0,0)"/>
<path d="M666,17L701,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="711" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,70L528,70L528,39L410,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">analyze-stmt</text>
<polygon points="410,55 398,59 398,50" style="fill:rgb(0,0,0)"/>
<path d="M383,39 L 383,47 Q 383,55 393,55 L 404,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,55 654,59 654,50" style="fill:rgb(0,0,0)"/>
<path d="M528,55L660,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,55 L 673,55 Q 681,55 681,47 L 681,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,108L517,108L517,77L410,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="463" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">attach-stmt</text>
<polygon points="410,92 398,97 398,88" style="fill:rgb(0,0,0)"/>
<path d="M383,77 L 383,85 Q 383,92 393,92 L 404,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,92 654,97 654,88" style="fill:rgb(0,0,0)"/>
<path d="M517,92L660,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,92 L 673,92 Q 681,92 681,85 L 681,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,145L511,145L511,115L410,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="460" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">begin-stmt</text>
<polygon points="410,130 398,135 398,126" style="fill:rgb(0,0,0)"/>
<path d="M383,115 L 383,123 Q 383,130 393,130 L 404,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,130 654,135 654,126" style="fill:rgb(0,0,0)"/>
<path d="M511,130L660,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,130 L 673,130 Q 681,130 681,123 L 681,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,183L527,183L527,153L410,153Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="468" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">commit-stmt</text>
<polygon points="410,168 398,172 398,164" style="fill:rgb(0,0,0)"/>
<path d="M383,153 L 383,160 Q 383,168 393,168 L 404,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,168 654,172 654,164" style="fill:rgb(0,0,0)"/>
<path d="M527,168L660,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,168 L 673,168 Q 681,168 681,160 L 681,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,221L569,221L569,191L410,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="489" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-index-stmt</text>
<polygon points="410,206 398,210 398,201" style="fill:rgb(0,0,0)"/>
<path d="M383,191 L 383,198 Q 383,206 393,206 L 404,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,206 654,210 654,201" style="fill:rgb(0,0,0)"/>
<path d="M569,206L660,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,206 L 673,206 Q 681,206 681,198 L 681,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,259L566,259L566,228L410,228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-table-stmt</text>
<polygon points="410,244 398,248 398,239" style="fill:rgb(0,0,0)"/>
<path d="M383,228 L 383,236 Q 383,244 393,244 L 404,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,244 654,248 654,239" style="fill:rgb(0,0,0)"/>
<path d="M566,244L660,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,244 L 673,244 Q 681,244 681,236 L 681,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,297L582,297L582,266L410,266Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="496" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-trigger-stmt</text>
<polygon points="410,281 398,286 398,277" style="fill:rgb(0,0,0)"/>
<path d="M383,266 L 383,274 Q 383,281 393,281 L 404,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,281 654,286 654,277" style="fill:rgb(0,0,0)"/>
<path d="M582,281L660,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,281 L 673,281 Q 681,281 681,274 L 681,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,334L561,334L561,304L410,304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="486" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-view-stmt</text>
<polygon points="410,319 398,324 398,315" style="fill:rgb(0,0,0)"/>
<path d="M383,304 L 383,312 Q 383,319 393,319 L 404,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,319 654,324 654,315" style="fill:rgb(0,0,0)"/>
<path d="M561,319L660,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,319 L 673,319 Q 681,319 681,312 L 681,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,372L626,372L626,342L410,342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-virtual-table-stmt</text>
<polygon points="410,357 398,361 398,353" style="fill:rgb(0,0,0)"/>
<path d="M383,342 L 383,349 Q 383,357 393,357 L 404,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,357 654,361 654,353" style="fill:rgb(0,0,0)"/>
<path d="M626,357L660,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,357 L 673,357 Q 681,357 681,349 L 681,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,410L516,410L516,380L410,380Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="463" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">delete-stmt</text>
<polygon points="410,395 398,399 398,390" style="fill:rgb(0,0,0)"/>
<path d="M383,380 L 383,387 Q 383,395 393,395 L 404,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,395 654,399 654,390" style="fill:rgb(0,0,0)"/>
<path d="M516,395L660,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,395 L 673,395 Q 681,395 681,387 L 681,380"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,448L581,448L581,417L410,417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">delete-stmt-limited</text>
<polygon points="410,433 398,437 398,428" style="fill:rgb(0,0,0)"/>
<path d="M383,417 L 383,425 Q 383,433 393,433 L 404,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,433 654,437 654,428" style="fill:rgb(0,0,0)"/>
<path d="M581,433L660,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,433 L 673,433 Q 681,433 681,425 L 681,418"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,486L521,486L521,455L410,455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="465" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">detach-stmt</text>
<polygon points="410,470 398,475 398,466" style="fill:rgb(0,0,0)"/>
<path d="M383,455 L 383,463 Q 383,470 393,470 L 404,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,470 654,475 654,466" style="fill:rgb(0,0,0)"/>
<path d="M521,470L660,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,470 L 673,470 Q 681,470 681,463 L 681,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,523L555,523L555,493L410,493Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="508" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-index-stmt</text>
<polygon points="410,508 398,513 398,504" style="fill:rgb(0,0,0)"/>
<path d="M383,493 L 383,501 Q 383,508 393,508 L 404,508"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,508 654,513 654,504" style="fill:rgb(0,0,0)"/>
<path d="M555,508L660,508"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,508 L 673,508 Q 681,508 681,501 L 681,493"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,561L551,561L551,531L410,531Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="480" y="546" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-table-stmt</text>
<polygon points="410,546 398,550 398,542" style="fill:rgb(0,0,0)"/>
<path d="M383,531 L 383,538 Q 383,546 393,546 L 404,546"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,546 654,550 654,542" style="fill:rgb(0,0,0)"/>
<path d="M551,546L660,546"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,546 L 673,546 Q 681,546 681,538 L 681,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,599L568,599L568,569L410,569Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="489" y="584" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-trigger-stmt</text>
<polygon points="410,584 398,588 398,579" style="fill:rgb(0,0,0)"/>
<path d="M383,569 L 383,576 Q 383,584 393,584 L 404,584"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,584 654,588 654,579" style="fill:rgb(0,0,0)"/>
<path d="M568,584L660,584"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,584 L 673,584 Q 681,584 681,576 L 681,569"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,637L547,637L547,606L410,606Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="622" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-view-stmt</text>
<polygon points="410,622 398,626 398,617" style="fill:rgb(0,0,0)"/>
<path d="M383,606 L 383,614 Q 383,622 393,622 L 404,622"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,622 654,626 654,617" style="fill:rgb(0,0,0)"/>
<path d="M547,622L660,622"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,622 L 673,622 Q 681,622 681,614 L 681,607"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,675L513,675L513,644L410,644Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="659" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">insert-stmt</text>
<polygon points="410,659 398,664 398,655" style="fill:rgb(0,0,0)"/>
<path d="M383,644 L 383,652 Q 383,659 393,659 L 404,659"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,659 654,664 654,655" style="fill:rgb(0,0,0)"/>
<path d="M513,659L660,659"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,659 L 673,659 Q 681,659 681,652 L 681,644"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,712L529,712L529,682L410,682Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="697" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">pragma-stmt</text>
<polygon points="410,697 398,702 398,693" style="fill:rgb(0,0,0)"/>
<path d="M383,682 L 383,690 Q 383,697 393,697 L 404,697"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,697 654,702 654,693" style="fill:rgb(0,0,0)"/>
<path d="M529,697L660,697"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,697 L 673,697 Q 681,697 681,690 L 681,682"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,750L528,750L528,720L410,720Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="735" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">reindex-stmt</text>
<polygon points="410,735 398,739 398,731" style="fill:rgb(0,0,0)"/>
<path d="M383,720 L 383,727 Q 383,735 393,735 L 404,735"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,735 654,739 654,731" style="fill:rgb(0,0,0)"/>
<path d="M528,735L660,735"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,735 L 673,735 Q 681,735 681,727 L 681,720"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,788L526,788L526,758L410,758Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="468" y="773" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">release-stmt</text>
<polygon points="410,773 398,777 398,768" style="fill:rgb(0,0,0)"/>
<path d="M383,758 L 383,765 Q 383,773 393,773 L 404,773"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,773 654,777 654,768" style="fill:rgb(0,0,0)"/>
<path d="M526,773L660,773"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,773 L 673,773 Q 681,773 681,765 L 681,758"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,826L533,826L533,795L410,795Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="811" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">rollback-stmt</text>
<polygon points="410,811 398,815 398,806" style="fill:rgb(0,0,0)"/>
<path d="M383,795 L 383,803 Q 383,811 393,811 L 404,811"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,811 654,815 654,806" style="fill:rgb(0,0,0)"/>
<path d="M533,811L660,811"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,811 L 673,811 Q 681,811 681,803 L 681,796"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,864L545,864L545,833L410,833Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="848" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">savepoint-stmt</text>
<polygon points="410,848 398,853 398,844" style="fill:rgb(0,0,0)"/>
<path d="M383,833 L 383,841 Q 383,848 393,848 L 404,848"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,848 654,853 654,844" style="fill:rgb(0,0,0)"/>
<path d="M545,848L660,848"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,848 L 673,848 Q 681,848 681,841 L 681,833"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,901L514,901L514,871L410,871Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="462" y="886" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="410,886 398,891 398,882" style="fill:rgb(0,0,0)"/>
<path d="M383,871 L 383,879 Q 383,886 393,886 L 404,886"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,886 654,891 654,882" style="fill:rgb(0,0,0)"/>
<path d="M514,886L660,886"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,886 L 673,886 Q 681,886 681,879 L 681,871"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,939L522,939L522,909L410,909Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="466" y="924" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">update-stmt</text>
<polygon points="410,924 398,928 398,920" style="fill:rgb(0,0,0)"/>
<path d="M383,909 L 383,916 Q 383,924 393,924 L 404,924"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,924 654,928 654,920" style="fill:rgb(0,0,0)"/>
<path d="M522,924L660,924"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,924 L 673,924 Q 681,924 681,916 L 681,909"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,977L587,977L587,947L410,947Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="498" y="962" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">update-stmt-limited</text>
<polygon points="410,962 398,966 398,957" style="fill:rgb(0,0,0)"/>
<path d="M383,947 L 383,954 Q 383,962 393,962 L 404,962"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,962 654,966 654,957" style="fill:rgb(0,0,0)"/>
<path d="M587,962L660,962"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,962 L 673,962 Q 681,962 681,954 L 681,947"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,1015L529,1015L529,984L410,984Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="1000" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">vacuum-stmt</text>
<polygon points="410,1000 398,1004 398,995" style="fill:rgb(0,0,0)"/>
<path d="M368,17 L 376,17 Q 383,17 383,32 L 383,985 Q 383,1000 393,1000 L 404,1000"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,1000 654,1004 654,995" style="fill:rgb(0,0,0)"/>
<path d="M529,1000L660,1000"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,1000 L 673,1000 Q 681,1000 681,985 L 681,32 Q 681,17 688,17 L 696,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
 </div>

<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang.in?m=fa8ea6422f">2024-04-01 12:41:31</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_aggfunc.html.































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>Built-in Aggregate Functions</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
Built-in Aggregate Functions
</div>
</div>





<h1 id="syntax"><span>1. </span>Syntax</h1>
<p><b><a href="syntax/aggregate-function-invocation.html">aggregate-function-invocation:</a></b>
<button id='x7c5141f9' onclick='hideorshow("x7c5141f9","xda5c185d")'>hide</button></p>
 <div id='xda5c185d' class='imgcontainer'>
 <div style="max-width:909px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 909.533 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,71L156,71A15 15 0 0 0 171 56A15 15 0 0 0 156 41L47,41A15 15 0 0 0 32 56A15 15 0 0 0 47 71Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="102" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">aggregate-func</text>
<polygon points="189,56 178,60 178,52" style="fill:rgb(0,0,0)"/>
<path d="M171,56L183,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M204,71A15 15 0 0 0 219 56A15 15 0 0 0 204 41A15 15 0 0 0 189 56A15 15 0 0 0 204 71Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="56" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="242,56 231,60 231,52" style="fill:rgb(0,0,0)"/>
<path d="M219,56L237,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="277,26 265,30 265,22" style="fill:rgb(0,0,0)"/>
<path d="M242,56 L 248,56 Q 254,56 254,41 L 254,41 Q 254,26 263,26 L 271,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M292,41L360,41A15 15 0 0 0 376 26L376,26A15 15 0 0 0 360 11L292,11A15 15 0 0 0 277 26L277,26A15 15 0 0 0 292 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="326" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="394,26 382,30 382,22" style="fill:rgb(0,0,0)"/>
<path d="M376,26L388,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="428,56 417,60 417,52" style="fill:rgb(0,0,0)"/>
<path d="M394,26 L 399,26 Q 405,26 405,41 L 405,41 Q 405,56 414,56 L 422,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="464,56 453,60 453,52" style="fill:rgb(0,0,0)"/>
<path d="M428,56L458,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M464,71L513,71L513,41L464,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="489" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="657,56 646,60 646,52" style="fill:rgb(0,0,0)"/>
<path d="M513,56L652,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M672,71A15 15 0 0 0 688 56A15 15 0 0 0 672 41A15 15 0 0 0 657 56A15 15 0 0 0 672 71Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="56" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="734,86 722,91 722,82" style="fill:rgb(0,0,0)"/>
<path d="M688,56 L 699,56 Q 711,56 711,71 L 711,71 Q 711,86 719,86 L 728,86"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,101L846,101L846,71L734,71Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="790" y="86" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="900,56 888,60 888,52" style="fill:rgb(0,0,0)"/>
<path d="M846,86 L 855,86 Q 864,86 864,71 L 864,71 Q 864,56 879,56 L 879,56 L 894,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="903" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="790,56 778,60 778,52" style="fill:rgb(0,0,0)"/>
<path d="M688,56L784,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="900,56 888,60 888,52" style="fill:rgb(0,0,0)"/>
<path d="M790,56L894,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="326,56 315,60 315,52" style="fill:rgb(0,0,0)"/>
<path d="M242,56L321,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="428,56 417,60 417,52" style="fill:rgb(0,0,0)"/>
<path d="M326,56L422,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,32A15 15 0 0 0 504 17A15 15 0 0 0 489 2A15 15 0 0 0 474 17A15 15 0 0 0 489 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="489" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="504,17 515,12 515,21" style="fill:rgb(0,0,0)"/>
<path d="M513,56 L 525,56 Q 536,56 536,41 L 536,32 Q 536,17 523,17 L 510,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="464,56 453,60 453,52" style="fill:rgb(0,0,0)"/>
<path d="M474,17 L 456,17 Q 441,17 441,32 L 441,41 Q 441,56 450,56 L 458,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,207A15 15 0 0 0 453 192A15 15 0 0 0 438 177A15 15 0 0 0 423 192A15 15 0 0 0 438 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="423,192 412,196 412,188" style="fill:rgb(0,0,0)"/>
<path d="M242,56 L 248,56 Q 254,56 254,71 L 254,177 Q 254,192 269,192 L 402,192 L 417,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="489,192 477,196 477,188" style="fill:rgb(0,0,0)"/>
<path d="M453,192L483,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,192 L 570,192 Q 585,192 600,192 L 605,192 Q 620,192 620,177 L 620,71 Q 620,56 626,56 L 631,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="438,216 427,221 427,212" style="fill:rgb(0,0,0)"/>
<path d="M326,192 L 392,192 Q 407,192 407,204 Q 407,216 420,216 L 433,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,216 L 453,216 Q 467,216 467,204 Q 467,192 473,192 L 479,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="300,117 289,121 289,112" style="fill:rgb(0,0,0)"/>
<path d="M513,56 L 523,56 Q 533,56 533,71 L 533,71 Q 533,86 518,86 L 292,86 Q 277,86 277,101 L 277,102 Q 277,117 286,117 L 294,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M315,132L360,132A15 15 0 0 0 375 117A15 15 0 0 0 360 101L315,101A15 15 0 0 0 300 117A15 15 0 0 0 315 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="392,117 381,121 381,112" style="fill:rgb(0,0,0)"/>
<path d="M375,117L386,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,132L411,132A15 15 0 0 0 426 117A15 15 0 0 0 411 101L407,101A15 15 0 0 0 392 117A15 15 0 0 0 407 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="455,117 444,121 444,112" style="fill:rgb(0,0,0)"/>
<path d="M426,117L449,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,132L585,132L585,101L455,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="520" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M520,169A15 15 0 0 0 535 154A15 15 0 0 0 520 139A15 15 0 0 0 505 154A15 15 0 0 0 520 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="520" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="535,154 547,150 547,159" style="fill:rgb(0,0,0)"/>
<path d="M585,117 L 591,117 Q 597,117 597,132 L 597,139 Q 597,154 582,154 L 556,154 L 541,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="455,117 444,121 444,112" style="fill:rgb(0,0,0)"/>
<path d="M505,154 L 470,154 Q 455,154 447,154 Q 438,154 438,139 L 438,132 Q 438,117 444,117 L 449,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,117 L 594,117 Q 602,117 602,102 L 602,71 Q 602,56 617,56 L 623,56 L 638,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/expr.html">expr:</a></b>
<button id='x487b760f' onclick='hideorshow("x487b760f","x2500495a")'>show</button></p>
 <div id='x2500495a' style='display:none;' class='imgcontainer'>
 <div style="max-width:963px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 963.96 1068.77">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L158,32L158,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="101" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="954,17 943,21 943,12" style="fill:rgb(0,0,0)"/>
<path d="M158,17L948,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="958" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L172,70A15 15 0 0 0 187 55L187,55A15 15 0 0 0 172 39L60,39A15 15 0 0 0 45 55L45,55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">bind-parameter</text>
<polygon points="916,55 905,59 905,50" style="fill:rgb(0,0,0)"/>
<path d="M187,55L910,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,55 L 924,55 Q 931,55 931,47 L 931,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 31,55 L 39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,130L156,130A15 15 0 0 0 171 115A15 15 0 0 0 156 100L60,100A15 15 0 0 0 45 115A15 15 0 0 0 60 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,115 183,119 183,111" style="fill:rgb(0,0,0)"/>
<path d="M171,115L189,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,130A15 15 0 0 0 225 115A15 15 0 0 0 210 100A15 15 0 0 0 195 115A15 15 0 0 0 210 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M225,115L255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130L351,130A15 15 0 0 0 366 115A15 15 0 0 0 351 100L276,100A15 15 0 0 0 261 115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="389,115 378,119 378,111" style="fill:rgb(0,0,0)"/>
<path d="M366,115L383,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,130A15 15 0 0 0 419 115A15 15 0 0 0 404 100A15 15 0 0 0 389 115A15 15 0 0 0 404 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="404" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="455,115 444,119 444,111" style="fill:rgb(0,0,0)"/>
<path d="M419,115L450,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,130L565,130A15 15 0 0 0 580 115A15 15 0 0 0 565 100L471,100A15 15 0 0 0 455 115A15 15 0 0 0 471 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="916,115 905,119 905,111" style="fill:rgb(0,0,0)"/>
<path d="M580,115L910,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,115 L 924,115 Q 931,115 931,108 L 931,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,115 33,119 33,111" style="fill:rgb(0,0,0)"/>
<path d="M24,100 L 24,108 Q 24,115 31,115 L 39,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,89 97,93 97,84" style="fill:rgb(0,0,0)"/>
<path d="M24,74 L 24,81 Q 24,89 39,89 L 87,89 L 102,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 302,93 302,84" style="fill:rgb(0,0,0)"/>
<path d="M108,89 L 129,89 Q 144,89 159,89 L 293,89 L 308,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,89 L 414,89 Q 429,89 429,102 Q 429,115 436,115 L 444,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M223,89 L 230,89 Q 238,89 238,102 Q 238,115 245,115 L 253,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,168L168,168A15 15 0 0 0 183 153A15 15 0 0 0 168 138L60,138A15 15 0 0 0 45 153A15 15 0 0 0 60 168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">unary-operator</text>
<polygon points="206,153 194,157 194,149" style="fill:rgb(0,0,0)"/>
<path d="M183,153L200,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,168L255,168L255,138L206,138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,153 905,157 905,149" style="fill:rgb(0,0,0)"/>
<path d="M255,153L910,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,153 L 924,153 Q 931,153 931,145 L 931,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,153 33,157 33,149" style="fill:rgb(0,0,0)"/>
<path d="M24,138 L 24,145 Q 24,153 31,153 L 39,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,206L94,206L94,176L45,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,191 106,195 106,186" style="fill:rgb(0,0,0)"/>
<path d="M94,191L111,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,206L245,206A15 15 0 0 0 261 191A15 15 0 0 0 245 176L132,176A15 15 0 0 0 117 191A15 15 0 0 0 132 206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">binary-operator</text>
<polygon points="284,191 272,195 272,186" style="fill:rgb(0,0,0)"/>
<path d="M261,191L278,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,206L333,206L333,176L284,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="308" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,191 905,195 905,186" style="fill:rgb(0,0,0)"/>
<path d="M333,191L910,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,191 L 924,191 Q 931,191 931,183 L 931,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,191 33,195 33,186" style="fill:rgb(0,0,0)"/>
<path d="M24,176 L 24,183 Q 24,191 31,191 L 39,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,245L162,245A15 15 0 0 0 177 230A15 15 0 0 0 162 215L60,215A15 15 0 0 0 45 230A15 15 0 0 0 60 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="111" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-name</text>
<polygon points="194,230 183,234 183,226" style="fill:rgb(0,0,0)"/>
<path d="M177,230L188,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,245A15 15 0 0 0 224 230A15 15 0 0 0 209 215A15 15 0 0 0 194 230A15 15 0 0 0 209 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="260,230 249,234 249,226" style="fill:rgb(0,0,0)"/>
<path d="M224,230L255,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,245L437,245L437,215L260,215Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-arguments</text>
<polygon points="473,230 461,234 461,226" style="fill:rgb(0,0,0)"/>
<path d="M437,230L467,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,245A15 15 0 0 0 503 230A15 15 0 0 0 488 215A15 15 0 0 0 473 230A15 15 0 0 0 488 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="541,260 529,265 529,256" style="fill:rgb(0,0,0)"/>
<path d="M503,230 L 510,230 Q 518,230 518,245 L 518,245 Q 518,260 527,260 L 535,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,275L653,275L653,245L541,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="691,230 680,234 680,226" style="fill:rgb(0,0,0)"/>
<path d="M653,260 L 661,260 Q 668,260 668,245 L 668,245 Q 668,230 677,230 L 685,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="729,260 718,265 718,256" style="fill:rgb(0,0,0)"/>
<path d="M691,230 L 699,230 Q 706,230 706,245 L 706,245 Q 706,260 715,260 L 723,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,275L837,275L837,245L729,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="783" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">over-clause</text>
<polygon points="916,260 905,265 905,256" style="fill:rgb(0,0,0)"/>
<path d="M837,260L910,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,260 L 924,260 Q 931,260 931,253 L 931,245"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,230 33,234 33,226" style="fill:rgb(0,0,0)"/>
<path d="M24,215 L 24,222 Q 24,230 31,230 L 39,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,230 585,234 585,226" style="fill:rgb(0,0,0)"/>
<path d="M503,230L591,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,230L680,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,230 905,234 905,226" style="fill:rgb(0,0,0)"/>
<path d="M691,230L910,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,230 L 924,230 Q 931,230 931,222 L 931,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,321A15 15 0 0 0 75 306A15 15 0 0 0 60 290A15 15 0 0 0 45 306A15 15 0 0 0 60 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,306 100,310 100,301" style="fill:rgb(0,0,0)"/>
<path d="M75,306L105,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M111,321L160,321L160,290L111,290Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="306" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="196,306 185,310 185,301" style="fill:rgb(0,0,0)"/>
<path d="M160,306L191,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,321A15 15 0 0 0 227 306A15 15 0 0 0 211 290A15 15 0 0 0 196 306A15 15 0 0 0 211 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,306 905,310 905,301" style="fill:rgb(0,0,0)"/>
<path d="M227,306L910,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,306 L 924,306 Q 931,306 931,298 L 931,291"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,306 33,310 33,301" style="fill:rgb(0,0,0)"/>
<path d="M24,290 L 24,298 Q 24,306 31,306 L 39,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,284A15 15 0 0 0 151 269A15 15 0 0 0 136 254A15 15 0 0 0 121 269A15 15 0 0 0 136 284Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="269" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="151,269 162,265 162,274" style="fill:rgb(0,0,0)"/>
<path d="M160,306 L 168,306 Q 175,306 175,291 L 175,284 Q 175,269 166,269 L 157,269"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,269 L 103,269 Q 88,269 88,284 L 88,291 Q 88,306 96,306 L 103,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,358L88,358A15 15 0 0 0 103 343A15 15 0 0 0 88 328L60,328A15 15 0 0 0 45 343A15 15 0 0 0 60 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CAST</text>
<polygon points="126,343 114,348 114,339" style="fill:rgb(0,0,0)"/>
<path d="M103,343L120,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M141,358A15 15 0 0 0 156 343A15 15 0 0 0 141 328A15 15 0 0 0 126 343A15 15 0 0 0 141 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="179,343 168,348 168,339" style="fill:rgb(0,0,0)"/>
<path d="M156,343L173,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,358L228,358L228,328L179,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="251,343 240,348 240,339" style="fill:rgb(0,0,0)"/>
<path d="M228,343L246,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,358L271,358A15 15 0 0 0 286 343A15 15 0 0 0 271 328L267,328A15 15 0 0 0 251 343A15 15 0 0 0 267 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="269" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="309,343 297,348 297,339" style="fill:rgb(0,0,0)"/>
<path d="M286,343L303,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,358L408,358L408,328L309,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="358" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="431,343 419,348 419,339" style="fill:rgb(0,0,0)"/>
<path d="M408,343L425,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M446,358A15 15 0 0 0 461 343A15 15 0 0 0 446 328A15 15 0 0 0 431 343A15 15 0 0 0 446 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,343 905,348 905,339" style="fill:rgb(0,0,0)"/>
<path d="M461,343L910,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,343 L 924,343 Q 931,343 931,336 L 931,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,343 33,348 33,339" style="fill:rgb(0,0,0)"/>
<path d="M24,328 L 24,336 Q 24,343 31,343 L 39,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,396L94,396L94,366L45,366Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,381 106,385 106,377" style="fill:rgb(0,0,0)"/>
<path d="M94,381L111,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,396L196,396A15 15 0 0 0 211 381A15 15 0 0 0 196 366L132,366A15 15 0 0 0 117 381A15 15 0 0 0 132 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="234,381 223,385 223,377" style="fill:rgb(0,0,0)"/>
<path d="M211,381L229,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,396L355,396A15 15 0 0 0 370 381A15 15 0 0 0 355 366L250,366A15 15 0 0 0 234 381A15 15 0 0 0 250 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="916,381 905,385 905,377" style="fill:rgb(0,0,0)"/>
<path d="M370,381L910,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,381 L 924,381 Q 931,381 931,374 L 931,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,381 33,385 33,377" style="fill:rgb(0,0,0)"/>
<path d="M24,366 L 24,374 Q 24,381 31,381 L 39,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,434L94,434L94,404L45,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,419 119,423 119,415" style="fill:rgb(0,0,0)"/>
<path d="M94,419L124,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,434L165,434A15 15 0 0 0 180 419A15 15 0 0 0 165 404L145,404A15 15 0 0 0 130 419A15 15 0 0 0 145 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="234,419 223,423 223,415" style="fill:rgb(0,0,0)"/>
<path d="M180,419L229,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,434L273,434A15 15 0 0 0 288 419A15 15 0 0 0 273 404L250,404A15 15 0 0 0 234 419A15 15 0 0 0 250 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIKE</text>
<path d="M250,472L279,472A15 15 0 0 0 294 457A15 15 0 0 0 279 442L250,442A15 15 0 0 0 234 457A15 15 0 0 0 250 472Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="457" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GLOB</text>
<path d="M250,510L302,510A15 15 0 0 0 317 495A15 15 0 0 0 302 479L250,479A15 15 0 0 0 234 495A15 15 0 0 0 250 510Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REGEXP</text>
<path d="M250,547L297,547A15 15 0 0 0 313 532A15 15 0 0 0 297 517L250,517A15 15 0 0 0 234 532A15 15 0 0 0 250 547Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="274" y="532" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<path d="M378,510L427,510L427,479L378,479Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M378,434L427,434L427,404L378,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="465,449 454,454 454,445" style="fill:rgb(0,0,0)"/>
<path d="M427,419 L 435,419 Q 442,419 442,434 L 442,434 Q 442,449 451,449 L 460,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,464L532,464A15 15 0 0 0 547 449A15 15 0 0 0 532 434L480,434A15 15 0 0 0 465 449A15 15 0 0 0 480 464Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="506" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ESCAPE</text>
<polygon points="570,449 559,454 559,445" style="fill:rgb(0,0,0)"/>
<path d="M547,449L565,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M570,464L620,464L620,434L570,434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="595" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="671,419 659,423 659,415" style="fill:rgb(0,0,0)"/>
<path d="M620,449 L 627,449 Q 635,449 635,434 L 635,434 Q 635,419 650,419 L 650,419 L 665,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,419 905,423 905,415" style="fill:rgb(0,0,0)"/>
<path d="M671,419L910,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,419 L 924,419 Q 931,419 931,411 L 931,404"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,419 33,423 33,415" style="fill:rgb(0,0,0)"/>
<path d="M24,404 L 24,411 Q 24,419 31,419 L 39,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M100,419 L 108,419 Q 115,419 115,434 L 115,434 Q 115,449 130,449 L 177,449 Q 192,449 192,434 L 192,434 Q 192,419 199,419 L 207,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,532 223,537 223,528" style="fill:rgb(0,0,0)"/>
<path d="M196,419 L 204,419 Q 211,419 211,434 L 211,517 Q 211,532 220,532 L 229,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,457 223,461 223,452" style="fill:rgb(0,0,0)"/>
<path d="M211,442 L 211,449 Q 211,457 220,457 L 229,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,495 223,499 223,490" style="fill:rgb(0,0,0)"/>
<path d="M211,479 L 211,487 Q 211,495 220,495 L 229,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,419 367,423 367,415" style="fill:rgb(0,0,0)"/>
<path d="M288,419L372,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,532 329,537 329,528" style="fill:rgb(0,0,0)"/>
<path d="M313,532L334,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,495 367,499 367,490" style="fill:rgb(0,0,0)"/>
<path d="M340,532 L 348,532 Q 355,532 355,517 L 355,510 Q 355,495 364,495 L 372,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,495 329,499 329,490" style="fill:rgb(0,0,0)"/>
<path d="M317,495L334,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,495L378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,457 329,461 329,452" style="fill:rgb(0,0,0)"/>
<path d="M294,457L334,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,457 L 348,457 Q 355,457 355,472 L 355,480 Q 355,495 367,495 L 378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="506,419 495,423 495,415" style="fill:rgb(0,0,0)"/>
<path d="M427,419L501,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M506,419L659,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="547,495 536,499 536,490" style="fill:rgb(0,0,0)"/>
<path d="M427,495L542,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,495 L 656,495 Q 671,495 671,480 L 671,434 Q 671,419 686,419 L 692,419 L 707,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,585L94,585L94,555L45,555Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,570 119,574 119,566" style="fill:rgb(0,0,0)"/>
<path d="M94,570L124,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,585L194,585A15 15 0 0 0 209 570A15 15 0 0 0 194 555L145,555A15 15 0 0 0 130 570A15 15 0 0 0 145 585Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="170" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ISNULL</text>
<polygon points="916,570 905,574 905,566" style="fill:rgb(0,0,0)"/>
<path d="M209,570L910,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,570 L 924,570 Q 931,570 931,563 L 931,555"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,570 33,574 33,566" style="fill:rgb(0,0,0)"/>
<path d="M24,555 L 24,563 Q 24,570 31,570 L 39,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,623L215,623A15 15 0 0 0 230 608A15 15 0 0 0 215 593L145,593A15 15 0 0 0 130 608A15 15 0 0 0 145 623Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="608" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTNULL</text>
<path d="M145,661L165,661A15 15 0 0 0 180 646A15 15 0 0 0 165 631L145,631A15 15 0 0 0 130 646A15 15 0 0 0 145 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="203,646 192,650 192,641" style="fill:rgb(0,0,0)"/>
<path d="M180,646L198,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,661L250,661A15 15 0 0 0 265 646A15 15 0 0 0 250 631L219,631A15 15 0 0 0 203 646A15 15 0 0 0 219 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="288,646 276,650 276,641" style="fill:rgb(0,0,0)"/>
<path d="M265,646L282,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="339,570 327,574 327,566" style="fill:rgb(0,0,0)"/>
<path d="M288,646 L 295,646 Q 303,646 303,631 L 303,585 Q 303,570 318,570 L 318,570 L 333,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="288,608 276,612 276,604" style="fill:rgb(0,0,0)"/>
<path d="M230,608L282,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,608 L 295,608 Q 303,608 303,600 L 303,593"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,646 119,650 119,641" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,631 Q 109,646 117,646 L 124,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,608 119,612 119,604" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,593 Q 109,608 117,608 L 124,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,699L94,699L94,668L45,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,684 106,688 106,679" style="fill:rgb(0,0,0)"/>
<path d="M94,684L111,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,699A15 15 0 0 0 147 684A15 15 0 0 0 132 668A15 15 0 0 0 117 684A15 15 0 0 0 132 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IS</text>
<polygon points="183,684 172,688 172,679" style="fill:rgb(0,0,0)"/>
<path d="M147,684L178,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M198,699L219,699A15 15 0 0 0 234 684A15 15 0 0 0 219 668L198,668A15 15 0 0 0 183 684A15 15 0 0 0 198 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="270,684 258,688 258,679" style="fill:rgb(0,0,0)"/>
<path d="M234,684L264,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="306,684 294,688 294,679" style="fill:rgb(0,0,0)"/>
<path d="M270,684L300,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,699L389,699A15 15 0 0 0 404 684A15 15 0 0 0 389 668L321,668A15 15 0 0 0 306 684A15 15 0 0 0 321 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="440,684 429,688 429,679" style="fill:rgb(0,0,0)"/>
<path d="M404,684L434,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,699L490,699A15 15 0 0 0 505 684A15 15 0 0 0 490 668L455,668A15 15 0 0 0 440 684A15 15 0 0 0 455 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="541,684 530,688 530,679" style="fill:rgb(0,0,0)"/>
<path d="M505,684L535,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,699L590,699L590,668L541,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,684 905,688 905,679" style="fill:rgb(0,0,0)"/>
<path d="M590,684L910,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,684 L 924,684 Q 931,684 931,676 L 931,669"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,684 33,688 33,679" style="fill:rgb(0,0,0)"/>
<path d="M24,668 L 24,676 Q 24,684 31,684 L 39,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,684 L 156,684 Q 164,684 164,696 Q 164,708 179,708 L 230,708 Q 245,708 245,696 Q 245,684 253,684 L 260,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,684 L 279,684 Q 286,684 286,696 Q 286,708 301,708 L 502,708 Q 517,708 517,696 Q 517,684 524,684 L 532,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,744L94,744L94,714L45,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,729 119,733 119,725" style="fill:rgb(0,0,0)"/>
<path d="M94,729L124,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,744L165,744A15 15 0 0 0 180 729A15 15 0 0 0 165 714L145,714A15 15 0 0 0 130 729A15 15 0 0 0 145 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,729 205,733 205,725" style="fill:rgb(0,0,0)"/>
<path d="M180,729L211,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,744L304,744A15 15 0 0 0 319 729A15 15 0 0 0 304 714L232,714A15 15 0 0 0 216 729A15 15 0 0 0 232 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="342,729 331,733 331,725" style="fill:rgb(0,0,0)"/>
<path d="M319,729L336,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M342,744L391,744L391,714L342,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="367" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="414,729 403,733 403,725" style="fill:rgb(0,0,0)"/>
<path d="M391,729L409,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M430,744L450,744A15 15 0 0 0 465 729A15 15 0 0 0 450 714L430,714A15 15 0 0 0 414 729A15 15 0 0 0 430 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="488,729 477,733 477,725" style="fill:rgb(0,0,0)"/>
<path d="M465,729L483,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,744L538,744L538,714L488,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="513" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,729 905,733 905,725" style="fill:rgb(0,0,0)"/>
<path d="M538,729L910,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,729 L 924,729 Q 931,729 931,721 L 931,714"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,729 33,733 33,725" style="fill:rgb(0,0,0)"/>
<path d="M24,714 L 24,721 Q 24,729 31,729 L 39,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,729 L 103,729 Q 110,729 110,741 Q 110,753 125,753 L 177,753 Q 192,753 192,741 Q 192,729 199,729 L 207,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,797L94,797L94,767L45,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,782 119,786 119,778" style="fill:rgb(0,0,0)"/>
<path d="M94,782L124,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,797L165,797A15 15 0 0 0 180 782A15 15 0 0 0 165 767L145,767A15 15 0 0 0 130 782A15 15 0 0 0 145 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,782 205,786 205,778" style="fill:rgb(0,0,0)"/>
<path d="M180,782L211,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,797L234,797A15 15 0 0 0 249 782A15 15 0 0 0 234 767L232,767A15 15 0 0 0 216 782A15 15 0 0 0 232 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IN</text>
<polygon points="285,782 273,786 273,778" style="fill:rgb(0,0,0)"/>
<path d="M249,782L279,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,797A15 15 0 0 0 315 782A15 15 0 0 0 300 767A15 15 0 0 0 285 782A15 15 0 0 0 300 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,782 340,786 340,778" style="fill:rgb(0,0,0)"/>
<path d="M315,782L345,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,797L455,797L455,767L351,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="491,782 480,786 480,778" style="fill:rgb(0,0,0)"/>
<path d="M455,782L486,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M507,797A15 15 0 0 0 522 782A15 15 0 0 0 507 767A15 15 0 0 0 491 782A15 15 0 0 0 507 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="507" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,782 905,786 905,778" style="fill:rgb(0,0,0)"/>
<path d="M522,782L910,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,782 L 924,782 Q 931,782 931,774 L 931,767"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,782 33,786 33,778" style="fill:rgb(0,0,0)"/>
<path d="M24,767 L 24,774 Q 24,782 31,782 L 39,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,782 L 103,782 Q 110,782 110,794 Q 110,806 125,806 L 177,806 Q 192,806 192,794 Q 192,782 199,782 L 207,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,782 L 324,782 Q 332,782 332,770 Q 332,758 347,758 L 452,758 Q 467,758 467,770 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M379,835L428,835L428,805L379,805Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="820" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="379,820 367,824 367,815" style="fill:rgb(0,0,0)"/>
<path d="M317,782 L 324,782 Q 332,782 332,797 L 332,805 Q 332,820 347,820 L 358,820 L 373,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M428,820 L 452,820 Q 467,820 467,805 L 467,797 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,873A15 15 0 0 0 418 857A15 15 0 0 0 403 842A15 15 0 0 0 388 857A15 15 0 0 0 403 873Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="857" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,857 430,853 430,862" style="fill:rgb(0,0,0)"/>
<path d="M428,820 L 435,820 Q 443,820 443,835 L 443,842 Q 443,857 434,857 L 424,857"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,857 L 371,857 Q 356,857 356,842 L 356,835 Q 356,820 363,820 L 371,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,925L396,925A15 15 0 0 0 412 910A15 15 0 0 0 396 895L300,895A15 15 0 0 0 285 910A15 15 0 0 0 300 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="429,910 417,915 417,906" style="fill:rgb(0,0,0)"/>
<path d="M412,910L423,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,925A15 15 0 0 0 459 910A15 15 0 0 0 444 895A15 15 0 0 0 429 910A15 15 0 0 0 444 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="513,910 502,915 502,906" style="fill:rgb(0,0,0)"/>
<path d="M459,910L507,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,925L627,925A15 15 0 0 0 642 910A15 15 0 0 0 627 895L528,895A15 15 0 0 0 513 910A15 15 0 0 0 528 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="577" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function</text>
<polygon points="659,910 647,915 647,906" style="fill:rgb(0,0,0)"/>
<path d="M642,910L653,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,925A15 15 0 0 0 689 910A15 15 0 0 0 674 895A15 15 0 0 0 659 910A15 15 0 0 0 674 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="734,910 723,915 723,906" style="fill:rgb(0,0,0)"/>
<path d="M689,910L728,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,925L783,925L783,895L734,895Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="828,910 817,915 817,906" style="fill:rgb(0,0,0)"/>
<path d="M783,910L823,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M844,925A15 15 0 0 0 859 910A15 15 0 0 0 844 895A15 15 0 0 0 828 910A15 15 0 0 0 844 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="844" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,910 905,915 905,906" style="fill:rgb(0,0,0)"/>
<path d="M859,910L910,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,910 L 924,910 Q 931,910 931,903 L 931,895"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,865L603,865A15 15 0 0 0 619 850A15 15 0 0 0 603 835L528,835A15 15 0 0 0 513 850A15 15 0 0 0 528 865Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="850" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="916,850 905,854 905,846" style="fill:rgb(0,0,0)"/>
<path d="M619,850L910,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,850 L 924,850 Q 931,850 931,842 L 931,835"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="513,850 502,854 502,846" style="fill:rgb(0,0,0)"/>
<path d="M475,910 L 483,910 Q 490,910 490,895 L 490,865 Q 490,850 499,850 L 507,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,892A15 15 0 0 0 774 877A15 15 0 0 0 759 862A15 15 0 0 0 744 877A15 15 0 0 0 759 892Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="877" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="774,877 785,873 785,881" style="fill:rgb(0,0,0)"/>
<path d="M783,910 L 791,910 Q 798,910 798,895 L 798,892 Q 798,877 789,877 L 780,877"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M744,877 L 726,877 Q 711,877 711,892 L 711,895 Q 711,910 719,910 L 726,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M689,910 L 697,910 Q 704,910 704,921 Q 704,932 719,932 L 790,932 Q 805,932 805,921 Q 805,910 813,910 L 820,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="285,910 273,915 273,906" style="fill:rgb(0,0,0)"/>
<path d="M249,782 L 256,782 Q 264,782 264,797 L 264,895 Q 264,910 272,910 L 279,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,882 412,886 412,877" style="fill:rgb(0,0,0)"/>
<path d="M264,867 L 264,874 Q 264,882 279,882 L 402,882 L 417,882"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,882 L 456,882 Q 471,882 471,896 Q 471,910 478,910 L 486,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,971L80,971A15 15 0 0 0 95 956A15 15 0 0 0 80 941L60,941A15 15 0 0 0 45 956A15 15 0 0 0 60 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="131,956 120,960 120,951" style="fill:rgb(0,0,0)"/>
<path d="M95,956L125,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,971L191,971A15 15 0 0 0 206 956A15 15 0 0 0 191 941L146,941A15 15 0 0 0 131 956A15 15 0 0 0 146 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="242,956 231,960 231,951" style="fill:rgb(0,0,0)"/>
<path d="M206,956L236,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,971A15 15 0 0 0 272 956A15 15 0 0 0 257 941A15 15 0 0 0 242 956A15 15 0 0 0 257 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="295,956 284,960 284,951" style="fill:rgb(0,0,0)"/>
<path d="M272,956L290,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,971L400,971L400,941L295,941Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="423,956 411,960 411,951" style="fill:rgb(0,0,0)"/>
<path d="M400,956L417,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,971A15 15 0 0 0 453 956A15 15 0 0 0 438 941A15 15 0 0 0 423 956A15 15 0 0 0 438 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,956 905,960 905,951" style="fill:rgb(0,0,0)"/>
<path d="M453,956L910,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,956 L 924,956 Q 931,956 931,948 L 931,941"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,956 33,960 33,951" style="fill:rgb(0,0,0)"/>
<path d="M24,941 L 24,948 Q 24,956 31,956 L 39,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,929 59,934 59,925" style="fill:rgb(0,0,0)"/>
<path d="M24,914 L 24,922 Q 24,929 39,929 L 49,929 L 64,929"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,929 L 201,929 Q 216,929 216,943 Q 216,956 223,956 L 231,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,929 L 101,929 Q 108,929 108,943 Q 108,956 116,956 L 123,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,1009L89,1009A15 15 0 0 0 104 994A15 15 0 0 0 89 978L60,978A15 15 0 0 0 45 994A15 15 0 0 0 60 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASE</text>
<polygon points="140,994 128,998 128,989" style="fill:rgb(0,0,0)"/>
<path d="M104,994L134,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M140,1009L189,1009L189,978L140,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="243,994 232,998 232,989" style="fill:rgb(0,0,0)"/>
<path d="M189,994L237,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,1009L298,1009A15 15 0 0 0 313 994A15 15 0 0 0 298 978L258,978A15 15 0 0 0 243 994A15 15 0 0 0 258 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="336,994 324,998 324,989" style="fill:rgb(0,0,0)"/>
<path d="M313,994L330,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,1009L385,1009L385,978L336,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="408,994 396,998 396,989" style="fill:rgb(0,0,0)"/>
<path d="M385,994L402,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,1009L456,1009A15 15 0 0 0 472 994A15 15 0 0 0 456 978L423,978A15 15 0 0 0 408 994A15 15 0 0 0 423 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">THEN</text>
<polygon points="495,994 483,998 483,989" style="fill:rgb(0,0,0)"/>
<path d="M472,994L489,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M495,1009L544,1009L544,978L495,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="616,994 604,998 604,989" style="fill:rgb(0,0,0)"/>
<path d="M544,994L610,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M631,1009L658,1009A15 15 0 0 0 673 994A15 15 0 0 0 658 978L631,978A15 15 0 0 0 616 994A15 15 0 0 0 631 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="645" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ELSE</text>
<polygon points="696,994 685,998 685,989" style="fill:rgb(0,0,0)"/>
<path d="M673,994L691,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M696,1009L746,1009L746,978L696,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="721" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="782,994 770,998 770,989" style="fill:rgb(0,0,0)"/>
<path d="M746,994L776,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M797,1009L818,1009A15 15 0 0 0 833 994A15 15 0 0 0 818 978L797,978A15 15 0 0 0 782 994A15 15 0 0 0 797 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="807" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="916,994 905,998 905,989" style="fill:rgb(0,0,0)"/>
<path d="M833,994L910,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,994 L 924,994 Q 931,994 931,986 L 931,979"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,994 33,998 33,989" style="fill:rgb(0,0,0)"/>
<path d="M24,978 L 24,986 Q 24,994 31,994 L 39,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,994 L 111,994 Q 119,994 119,1007 Q 119,1021 134,1021 L 186,1021 Q 201,1021 201,1007 Q 201,994 208,994 L 216,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="360,1021 372,1016 372,1025" style="fill:rgb(0,0,0)"/>
<path d="M544,994 L 551,994 Q 559,994 559,1007 Q 559,1021 544,1021 L 381,1021 L 366,1021"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,1021 L 235,1021 Q 220,1021 220,1007 Q 220,994 227,994 L 235,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,994 L 585,994 Q 593,994 593,1007 Q 593,1021 608,1021 L 742,1021 Q 757,1021 757,1007 Q 757,994 765,994 L 772,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,1066L173,1066L173,1036L45,1036Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="1051" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">raise-function</text>
<polygon points="916,1051 905,1055 905,1047" style="fill:rgb(0,0,0)"/>
<path d="M173,1051L910,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,1051 L 924,1051 Q 931,1051 931,1036 L 931,32 Q 931,17 939,17 L 946,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,1051 33,1055 33,1047" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,1036 Q 24,1051 31,1051 L 39,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/function-arguments.html">function-arguments:</a></b>
<button id='xf720640a' onclick='hideorshow("xf720640a","xec008050")'>show</button></p>
 <div id='xec008050' style='display:none;' class='imgcontainer'>
 <div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.566 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,26 55,30 55,22" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,41 L 43,41 Q 43,26 52,26 L 61,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M82,41L150,41A15 15 0 0 0 165 26L165,26A15 15 0 0 0 150 11L82,11A15 15 0 0 0 66 26L66,26A15 15 0 0 0 82 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="183,26 171,30 171,22" style="fill:rgb(0,0,0)"/>
<path d="M165,26L177,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M183,26 L 189,26 Q 194,26 194,41 L 194,41 Q 194,56 203,56 L 212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M218,56L248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,71L303,71L303,41L254,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="447,56 435,60 435,52" style="fill:rgb(0,0,0)"/>
<path d="M303,56L441,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="116,56 104,60 104,52" style="fill:rgb(0,0,0)"/>
<path d="M32,56L110,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M116,56L212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,32A15 15 0 0 0 293 17A15 15 0 0 0 278 2A15 15 0 0 0 263 17A15 15 0 0 0 278 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="293,17 305,12 305,21" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 314,56 Q 326,56 326,41 L 326,32 Q 326,17 312,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M263,17 L 245,17 Q 230,17 230,32 L 230,41 Q 230,56 239,56 L 248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,207A15 15 0 0 0 243 192L243,192A15 15 0 0 0 228 177A15 15 0 0 0 213 192L213,192A15 15 0 0 0 228 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="213,192 201,196 201,188" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,71 L 43,177 Q 43,192 58,192 L 192,192 L 207,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,192 267,196 267,188" style="fill:rgb(0,0,0)"/>
<path d="M243,192L272,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,192 L 360,192 Q 375,192 390,192 L 394,192 Q 409,192 409,177 L 409,71 Q 409,56 415,56 L 421,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="228,216 216,221 216,212" style="fill:rgb(0,0,0)"/>
<path d="M116,192 L 181,192 Q 196,192 196,204 Q 196,216 209,216 L 222,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,216 L 242,216 Q 257,216 257,204 Q 257,192 262,192 L 268,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="90,117 78,121 78,112" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 313,56 Q 323,56 323,71 L 323,71 Q 323,86 308,86 L 81,86 Q 66,86 66,101 L 66,102 Q 66,117 75,117 L 84,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,132L149,132A15 15 0 0 0 164 117L164,117A15 15 0 0 0 149 101L105,101A15 15 0 0 0 90 117L90,117A15 15 0 0 0 105 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="182,117 170,121 170,112" style="fill:rgb(0,0,0)"/>
<path d="M164,117L176,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,132L201,132A15 15 0 0 0 216 117L216,117A15 15 0 0 0 201 101L197,101A15 15 0 0 0 182 117L182,117A15 15 0 0 0 197 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M216,117L239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,132L375,132L375,101L245,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,169A15 15 0 0 0 325 154A15 15 0 0 0 310 139A15 15 0 0 0 294 154A15 15 0 0 0 310 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,154 336,150 336,159" style="fill:rgb(0,0,0)"/>
<path d="M375,117 L 380,117 Q 386,117 386,132 L 386,139 Q 386,154 371,154 L 345,154 L 330,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M294,154 L 260,154 Q 245,154 236,154 Q 227,154 227,139 L 227,132 Q 227,117 233,117 L 239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M375,117 L 383,117 Q 392,117 392,102 L 392,71 Q 392,56 407,56 L 413,56 L 428,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/literal-value.html">literal-value:</a></b>
<button id='x287b0985' onclick='hideorshow("x287b0985","x6166b568")'>show</button></p>
 <div id='x6166b568' style='display:none;' class='imgcontainer'>
 <div style="max-width:341px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 341.376 336.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,319 39,324 39,315" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,304 Q 24,319 34,319 L 45,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,334L252,334A15 15 0 0 0 267 319A15 15 0 0 0 252 304L65,304A15 15 0 0 0 50 319A15 15 0 0 0 65 334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIMESTAMP</text>
<polygon points="290,319 278,324 278,315" style="fill:rgb(0,0,0)"/>
<path d="M267,319L284,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,17 320,21 320,12" style="fill:rgb(0,0,0)"/>
<path d="M290,319 L 297,319 Q 305,319 305,304 L 305,32 Q 305,17 315,17 L 326,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="335" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L172,32A15 15 0 0 0 187 17A15 15 0 0 0 172 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="119" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,17L320,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L153,70A15 15 0 0 0 168 55L168,55A15 15 0 0 0 153 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">string-literal</text>
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,47 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,55 278,59 278,50" style="fill:rgb(0,0,0)"/>
<path d="M168,55L284,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,55 L 297,55 Q 305,55 305,47 L 305,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L140,108A15 15 0 0 0 155 92A15 15 0 0 0 140 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">blob-literal</text>
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,85 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,92 278,97 278,88" style="fill:rgb(0,0,0)"/>
<path d="M155,92L284,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,92 L 297,92 Q 305,92 305,85 L 305,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,145L97,145A15 15 0 0 0 112 130A15 15 0 0 0 97 115L66,115A15 15 0 0 0 50 130A15 15 0 0 0 66 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="50,130 39,135 39,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 34,130 L 45,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,130 278,135 278,126" style="fill:rgb(0,0,0)"/>
<path d="M112,130L284,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,130 L 297,130 Q 305,130 305,123 L 305,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,183L96,183A15 15 0 0 0 111 168A15 15 0 0 0 96 153L66,153A15 15 0 0 0 50 168A15 15 0 0 0 66 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRUE</text>
<polygon points="50,168 39,172 39,164" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,160 Q 24,168 34,168 L 45,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,168 278,172 278,164" style="fill:rgb(0,0,0)"/>
<path d="M111,168L284,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,168 L 297,168 Q 305,168 305,160 L 305,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,221L104,221A15 15 0 0 0 119 206A15 15 0 0 0 104 191L66,191A15 15 0 0 0 50 206A15 15 0 0 0 66 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FALSE</text>
<polygon points="50,206 39,210 39,201" style="fill:rgb(0,0,0)"/>
<path d="M24,191 L 24,198 Q 24,206 34,206 L 45,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,206 278,210 278,201" style="fill:rgb(0,0,0)"/>
<path d="M119,206L284,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,206 L 297,206 Q 305,206 305,198 L 305,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,259L190,259A15 15 0 0 0 205 244A15 15 0 0 0 190 228L66,228A15 15 0 0 0 50 244A15 15 0 0 0 66 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="128" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIME</text>
<polygon points="50,244 39,248 39,239" style="fill:rgb(0,0,0)"/>
<path d="M24,228 L 24,236 Q 24,244 34,244 L 45,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,244 278,248 278,239" style="fill:rgb(0,0,0)"/>
<path d="M205,244L284,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,244 L 297,244 Q 305,244 305,236 L 305,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,297L192,297A15 15 0 0 0 207 281A15 15 0 0 0 192 266L66,266A15 15 0 0 0 50 281A15 15 0 0 0 66 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_DATE</text>
<polygon points="50,281 39,286 39,277" style="fill:rgb(0,0,0)"/>
<path d="M24,266 L 24,274 Q 24,281 34,281 L 45,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,281 278,286 278,277" style="fill:rgb(0,0,0)"/>
<path d="M207,281L284,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,281 L 297,281 Q 305,281 305,274 L 305,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/over-clause.html">over-clause:</a></b>
<button id='xec1a589c' onclick='hideorshow("xec1a589c","x6d42e704")'>show</button></p>
 <div id='x6d42e704' style='display:none;' class='imgcontainer'>
 <div style="max-width:600px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 600.706 418.392">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="129,17 117,21 117,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L123,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M144,32L241,32A15 15 0 0 0 256 17A15 15 0 0 0 241 2L144,2A15 15 0 0 0 129 17A15 15 0 0 0 144 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,17 L 100,17 Q 108,17 108,32 L 108,40 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,70A15 15 0 0 0 165 55L165,55A15 15 0 0 0 149 39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 149 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="149" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="206,82 195,86 195,77" style="fill:rgb(0,0,0)"/>
<path d="M165,55 L 172,55 Q 180,55 180,68 Q 180,82 190,82 L 200,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,97L363,97A15 15 0 0 0 378 82A15 15 0 0 0 363 67L221,67A15 15 0 0 0 206 82A15 15 0 0 0 221 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="292" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M221,173L301,173A15 15 0 0 0 316 157A15 15 0 0 0 301 142L221,142A15 15 0 0 0 206 157A15 15 0 0 0 221 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="339,157 328,162 328,153" style="fill:rgb(0,0,0)"/>
<path d="M316,157L333,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,173L358,173A15 15 0 0 0 373 157A15 15 0 0 0 358 142L354,142A15 15 0 0 0 339 157A15 15 0 0 0 354 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="409,157 398,162 398,153" style="fill:rgb(0,0,0)"/>
<path d="M373,157L404,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,173L459,173L459,142L409,142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M434,210A15 15 0 0 0 449 195A15 15 0 0 0 434 180A15 15 0 0 0 419 195A15 15 0 0 0 434 210Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="195" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="449,195 461,191 461,200" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,180 Q 474,195 464,195 L 455,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,195 L 398,195 Q 383,195 383,180 L 383,172 Q 383,157 390,157 L 398,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,55 280,59 280,50" style="fill:rgb(0,0,0)"/>
<path d="M165,55L286,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,120 304,115 304,124" style="fill:rgb(0,0,0)"/>
<path d="M292,55 L 401,55 Q 416,55 416,70 L 416,105 Q 416,120 401,120 L 313,120 L 298,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,157 195,162 195,153" style="fill:rgb(0,0,0)"/>
<path d="M292,120 L 180,120 Q 165,120 165,135 L 165,142 Q 165,157 180,157 L 185,157 L 200,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="401,82 389,86 389,77" style="fill:rgb(0,0,0)"/>
<path d="M378,82L395,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,82 L 408,82 Q 416,82 416,89 L 416,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,286L266,286A15 15 0 0 0 281 271A15 15 0 0 0 266 256L221,256A15 15 0 0 0 206 271A15 15 0 0 0 221 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="244" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="304,271 292,275 292,266" style="fill:rgb(0,0,0)"/>
<path d="M281,271L298,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M319,286L323,286A15 15 0 0 0 338 271A15 15 0 0 0 323 256L319,256A15 15 0 0 0 304 271A15 15 0 0 0 319 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="321" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="374,271 363,275 363,266" style="fill:rgb(0,0,0)"/>
<path d="M338,271L368,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,286L504,286L504,256L374,256Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M439,324A15 15 0 0 0 454 309A15 15 0 0 0 439 293A15 15 0 0 0 424 309A15 15 0 0 0 439 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="454,309 466,304 466,313" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,294 Q 519,309 504,309 L 475,309 L 460,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,309 L 363,309 Q 348,309 348,294 L 348,286 Q 348,271 355,271 L 363,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,233 304,229 304,237" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,218 Q 474,233 459,233 L 313,233 L 298,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,271 195,275 195,266" style="fill:rgb(0,0,0)"/>
<path d="M292,233 L 180,233 Q 165,233 165,248 L 165,256 Q 165,271 180,271 L 185,271 L 200,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,195 160,184 169,184" style="fill:rgb(0,0,0)"/>
<path d="M165,142L165,189"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,195L165,256"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,399L311,399L311,369L206,369Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="384" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="519,384 508,389 508,380" style="fill:rgb(0,0,0)"/>
<path d="M311,384L513,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M534,399A15 15 0 0 0 549 384A15 15 0 0 0 534 369A15 15 0 0 0 519 384A15 15 0 0 0 534 399Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="384" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="591,17 579,21 579,12" style="fill:rgb(0,0,0)"/>
<path d="M549,384 L 557,384 Q 564,384 564,369 L 564,32 Q 564,17 575,17 L 585,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="594" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,17 508,21 508,12" style="fill:rgb(0,0,0)"/>
<path d="M256,17L513,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,17L579,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,346 304,342 304,351" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,331 Q 519,346 504,346 L 313,346 L 298,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,384 195,389 195,380" style="fill:rgb(0,0,0)"/>
<path d="M292,346 L 180,346 Q 165,346 165,361 L 165,369 Q 165,384 180,384 L 185,384 L 200,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,309 160,297 169,297" style="fill:rgb(0,0,0)"/>
<path d="M165,256L165,303"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,309L165,369"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="258,411 247,416 247,407" style="fill:rgb(0,0,0)"/>
<path d="M165,369 L 165,396 Q 165,411 180,411 L 238,411 L 253,411"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,384 369,389 369,380" style="fill:rgb(0,0,0)"/>
<path d="M258,411 L 335,411 Q 350,411 350,398 Q 350,384 362,384 L 375,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x8e2efd6b' onclick='hideorshow("x8e2efd6b","x690650f7")'>show</button></p>
 <div id='x690650f7' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/raise-function.html">raise-function:</a></b>
<button id='x0d637040' onclick='hideorshow("x0d637040","xd2ff880e")'>show</button></p>
 <div id='xd2ff880e' style='display:none;' class='imgcontainer'>
 <div style="max-width:627px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 627.302 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L82,32A15 15 0 0 0 97 17A15 15 0 0 0 82 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RAISE</text>
<polygon points="120,17 109,21 109,12" style="fill:rgb(0,0,0)"/>
<path d="M97,17L114,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,32L135,32A15 15 0 0 0 150 17A15 15 0 0 0 135 2L135,2A15 15 0 0 0 120 17A15 15 0 0 0 135 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="135" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="192,55 180,59 180,50" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 158,17 Q 165,17 165,32 L 165,40 Q 165,55 176,55 L 186,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,70L285,70A15 15 0 0 0 300 55L300,55A15 15 0 0 0 285 39L207,39A15 15 0 0 0 192 55L192,55A15 15 0 0 0 207 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="336,55 324,59 324,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70A15 15 0 0 0 366 55L366,55A15 15 0 0 0 351 39A15 15 0 0 0 336 55L336,55A15 15 0 0 0 351 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="389,55 378,59 378,50" style="fill:rgb(0,0,0)"/>
<path d="M366,55L383,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,70L508,70A15 15 0 0 0 523 55L523,55A15 15 0 0 0 508 39L404,39A15 15 0 0 0 389 55L389,55A15 15 0 0 0 404 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="456" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">error-message</text>
<polygon points="564,17 553,21 553,12" style="fill:rgb(0,0,0)"/>
<path d="M523,55 L 530,55 Q 538,55 538,40 L 538,32 Q 538,17 548,17 L 558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M579,32A15 15 0 0 0 594 17A15 15 0 0 0 579 2A15 15 0 0 0 564 17A15 15 0 0 0 579 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="617,17 606,21 606,12" style="fill:rgb(0,0,0)"/>
<path d="M594,17L612,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="621" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L259,32A15 15 0 0 0 274 17A15 15 0 0 0 259 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="456,17 444,21 444,12" style="fill:rgb(0,0,0)"/>
<path d="M274,17L450,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,17L553,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,108L249,108A15 15 0 0 0 264 92A15 15 0 0 0 249 77L207,77A15 15 0 0 0 192 92A15 15 0 0 0 207 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="300,92 288,97 288,88" style="fill:rgb(0,0,0)"/>
<path d="M264,92L294,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,92 L 307,92 Q 315,92 315,77 L 315,70 Q 315,55 322,55 L 330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,145L229,145A15 15 0 0 0 244 130A15 15 0 0 0 229 115L207,115A15 15 0 0 0 192 130A15 15 0 0 0 207 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="300,130 288,135 288,126" style="fill:rgb(0,0,0)"/>
<path d="M244,130L294,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,130 L 307,130 Q 315,130 315,115 L 315,92 L 315,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,130 180,135 180,126" style="fill:rgb(0,0,0)"/>
<path d="M165,39 L 165,115 Q 165,130 176,130 L 186,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,92 180,97 180,88" style="fill:rgb(0,0,0)"/>
<path d="M165,77 L 165,85 Q 165,92 176,92 L 186,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/select-stmt.html">select-stmt:</a></b>
<button id='x543e9c72' onclick='hideorshow("x543e9c72","x7bb40fb7")'>show</button></p>
 <div id='x7bb40fb7' style='display:none;' class='imgcontainer'>
 <div style="max-width:669px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 669.677 1162.3">
<path d="M55,845L667,845L667,99L55,99Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="6" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="46,17 34,21 34,12" style="fill:rgb(0,0,0)"/>
<path d="M10,17L40,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M61,32L92,32A15 15 0 0 0 107 17A15 15 0 0 0 92 2L61,2A15 15 0 0 0 46 17A15 15 0 0 0 61 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="76" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M167,62L253,62A15 15 0 0 0 268 47L268,47A15 15 0 0 0 253 32L167,32A15 15 0 0 0 152 47L152,47A15 15 0 0 0 167 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="210,17 198,21 198,12" style="fill:rgb(0,0,0)"/>
<path d="M107,17L204,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M210,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M358,32L584,32L584,2L358,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="152,47 140,51 140,43" style="fill:rgb(0,0,0)"/>
<path d="M107,17 L 114,17 Q 122,17 122,32 L 122,32 Q 122,47 134,47 L 146,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="291,47 279,51 279,43" style="fill:rgb(0,0,0)"/>
<path d="M268,47L285,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,47 L 298,47 Q 306,47 306,32 L 306,32 Q 306,17 321,17 L 331,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,70A15 15 0 0 0 486 55L486,55A15 15 0 0 0 471 39A15 15 0 0 0 456 55L456,55A15 15 0 0 0 471 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="486,55 498,50 498,59" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,40 Q 599,55 584,55 L 507,55 L 492,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,55 L 350,55 Q 335,55 335,40 L 335,32 Q 335,17 340,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,83 307,79 307,88" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,68 Q 599,83 584,83 L 316,83 L 301,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,83 L 40,83 Q 25,83 25,98 L 25,113"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="25,47 20,36 29,36" style="fill:rgb(0,0,0)"/>
<path d="M10,17 L 17,17 Q 25,17 25,29 L 25,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="55,129 43,133 43,124" style="fill:rgb(0,0,0)"/>
<path d="M25,47 L 25,114 Q 25,129 37,129 L 49,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,129 115,133 115,124" style="fill:rgb(0,0,0)"/>
<path d="M55,129L121,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,144L193,144A15 15 0 0 0 208 129A15 15 0 0 0 193 114L142,114A15 15 0 0 0 127 129A15 15 0 0 0 142 144Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="250,159 238,163 238,155" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,144 Q 223,159 233,159 L 244,159"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,174L333,174A15 15 0 0 0 348 159A15 15 0 0 0 333 144L265,144A15 15 0 0 0 250 159A15 15 0 0 0 265 174Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="159" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="417,129 406,133 406,124" style="fill:rgb(0,0,0)"/>
<path d="M348,159 L 356,159 Q 363,159 363,144 L 363,144 Q 363,129 378,129 L 396,129 L 411,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,144L545,144L545,114L417,114Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M481,182A15 15 0 0 0 496 166A15 15 0 0 0 481 151A15 15 0 0 0 466 166A15 15 0 0 0 481 182Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="166" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="496,166 508,162 508,171" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,151 Q 560,166 545,166 L 517,166 L 502,166"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M466,166 L 406,166 Q 391,166 391,151 L 391,144 Q 391,129 398,129 L 406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,129 287,133 287,124" style="fill:rgb(0,0,0)"/>
<path d="M208,129L293,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M299,129L406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,212L280,212A15 15 0 0 0 295 197A15 15 0 0 0 280 182L265,182A15 15 0 0 0 250 197A15 15 0 0 0 265 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="197" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="348,197 337,201 337,192" style="fill:rgb(0,0,0)"/>
<path d="M295,197L342,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,197 L 356,197 Q 363,197 363,182 L 363,159 L 363,144"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="250,197 238,201 238,192" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,182 Q 223,197 233,197 L 244,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,287L203,287A15 15 0 0 0 218 272A15 15 0 0 0 203 257L168,257A15 15 0 0 0 153 272A15 15 0 0 0 168 287Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="186" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="290,272 279,277 279,268" style="fill:rgb(0,0,0)"/>
<path d="M218,272L284,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,287L451,287L451,257L290,257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M320,362L422,362L422,331L320,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M371,324A15 15 0 0 0 386 309A15 15 0 0 0 371 293A15 15 0 0 0 356 309A15 15 0 0 0 371 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="386,309 397,304 397,313" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 459,272 Q 466,272 466,287 L 466,294 Q 466,309 451,309 L 407,309 L 392,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M356,309 L 279,309 Q 264,309 264,294 L 264,287 Q 264,272 271,272 L 279,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="320,346 308,351 308,342" style="fill:rgb(0,0,0)"/>
<path d="M218,272 L 226,272 Q 233,272 233,287 L 233,331 Q 233,346 248,346 L 299,346 L 314,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="484,313 488,325 480,325" style="fill:rgb(0,0,0)"/>
<path d="M422,346 L 436,346 Q 451,346 466,346 L 469,346 Q 484,346 484,333 L 484,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,272 494,277 494,268" style="fill:rgb(0,0,0)"/>
<path d="M484,313 L 484,287 Q 484,272 492,272 L 499,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,272 L 496,272 Q 487,272 487,272 Q 487,272 495,272 L 502,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,197 555,185 564,185" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,176 L 560,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,235 360,230 360,239" style="fill:rgb(0,0,0)"/>
<path d="M560,197 L 560,220 Q 560,235 545,235 L 369,235 L 354,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,272 142,277 142,268" style="fill:rgb(0,0,0)"/>
<path d="M348,235 L 142,235 Q 127,235 127,250 L 127,257 Q 127,272 137,272 L 147,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,437L218,437A15 15 0 0 0 233 422A15 15 0 0 0 218 407L168,407A15 15 0 0 0 153 422A15 15 0 0 0 168 437Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="256,422 244,426 244,418" style="fill:rgb(0,0,0)"/>
<path d="M233,422L250,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,437L305,437L305,407L256,407Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="517,324 513,312 521,312" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 502,272 Q 517,272 517,287 L 517,303 L 517,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,384 382,380 382,389" style="fill:rgb(0,0,0)"/>
<path d="M517,324 L 517,369 Q 517,384 502,384 L 391,384 L 376,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,422 142,426 142,418" style="fill:rgb(0,0,0)"/>
<path d="M371,384 L 142,384 Q 127,384 127,399 L 127,407 Q 127,422 137,422 L 147,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,324 122,312 131,312" style="fill:rgb(0,0,0)"/>
<path d="M127,257L127,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,324L127,407"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,535L212,535A15 15 0 0 0 227 520A15 15 0 0 0 212 505L168,505A15 15 0 0 0 153 520A15 15 0 0 0 168 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="250,520 238,525 238,516" style="fill:rgb(0,0,0)"/>
<path d="M227,520L244,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,535L269,535A15 15 0 0 0 284 520A15 15 0 0 0 269 505L265,505A15 15 0 0 0 250 520A15 15 0 0 0 265 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="320,520 309,525 309,516" style="fill:rgb(0,0,0)"/>
<path d="M284,520L314,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,535L369,535L369,505L320,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="452,520 441,525 441,516" style="fill:rgb(0,0,0)"/>
<path d="M369,520L446,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,535L520,535A15 15 0 0 0 535 520A15 15 0 0 0 520 505L467,505A15 15 0 0 0 452 520A15 15 0 0 0 467 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="558,520 546,525 546,516" style="fill:rgb(0,0,0)"/>
<path d="M535,520L552,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,535L607,535L607,505L558,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M345,573A15 15 0 0 0 360 558A15 15 0 0 0 345 543A15 15 0 0 0 330 558A15 15 0 0 0 345 573Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="558" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="360,558 371,554 371,562" style="fill:rgb(0,0,0)"/>
<path d="M369,520 L 377,520 Q 384,520 384,535 L 384,543 Q 384,558 375,558 L 366,558"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,558 L 309,558 Q 294,558 294,543 L 294,535 Q 294,520 301,520 L 309,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="514,551 503,555 503,546" style="fill:rgb(0,0,0)"/>
<path d="M411,520 L 418,520 Q 426,520 426,535 L 426,536 Q 426,551 441,551 L 493,551 L 508,551"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M514,551 L 607,551 Q 622,551 622,536 L 622,535 Q 622,520 630,520 L 637,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,490 256,494 256,486" style="fill:rgb(0,0,0)"/>
<path d="M127,460 L 127,475 Q 127,490 142,490 L 246,490 L 261,490"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,520 399,525 399,516" style="fill:rgb(0,0,0)"/>
<path d="M267,490 L 369,490 Q 384,490 384,505 L 384,505 Q 384,520 395,520 L 405,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,460 244,455 244,464" style="fill:rgb(0,0,0)"/>
<path d="M305,422 L 313,422 Q 320,422 320,437 L 320,445 Q 320,460 305,460 L 254,460 L 239,460"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,520 142,525 142,516" style="fill:rgb(0,0,0)"/>
<path d="M233,460 L 142,460 Q 127,460 127,475 L 127,505 Q 127,520 137,520 L 147,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,447 122,435 131,435" style="fill:rgb(0,0,0)"/>
<path d="M127,407L127,441"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,447L127,505"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,649L232,649A15 15 0 0 0 247 634A15 15 0 0 0 232 619L168,619A15 15 0 0 0 153 634A15 15 0 0 0 168 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="200" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="283,634 271,638 271,629" style="fill:rgb(0,0,0)"/>
<path d="M247,634L277,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,649L395,649A15 15 0 0 0 410 634A15 15 0 0 0 395 619L298,619A15 15 0 0 0 283 634A15 15 0 0 0 298 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="433,634 422,638 422,629" style="fill:rgb(0,0,0)"/>
<path d="M410,634L427,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,649L452,649A15 15 0 0 0 467 634A15 15 0 0 0 452 619L448,619A15 15 0 0 0 433 634A15 15 0 0 0 448 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="450" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="490,634 479,638 479,629" style="fill:rgb(0,0,0)"/>
<path d="M467,634L485,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,649L609,649L609,619L490,619Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="550" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M446,687A15 15 0 0 0 461 671A15 15 0 0 0 446 656A15 15 0 0 0 431 671A15 15 0 0 0 446 687Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="671" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="461,671 472,667 472,676" style="fill:rgb(0,0,0)"/>
<path d="M609,634 L 616,634 Q 624,634 624,649 L 624,656 Q 624,671 609,671 L 482,671 L 467,671"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,671 L 271,671 Q 256,671 256,656 L 256,649 Q 256,634 264,634 L 271,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="624,692 619,680 628,680" style="fill:rgb(0,0,0)"/>
<path d="M624,656L624,686"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,558 648,547 656,547" style="fill:rgb(0,0,0)"/>
<path d="M607,520 L 637,520 Q 652,520 652,535 L 652,537 L 652,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,596 382,592 382,600" style="fill:rgb(0,0,0)"/>
<path d="M652,558 L 652,581 Q 652,596 637,596 L 391,596 L 376,596"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,634 142,638 142,629" style="fill:rgb(0,0,0)"/>
<path d="M371,596 L 142,596 Q 127,596 127,611 L 127,619 Q 127,634 137,634 L 147,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,558 122,547 131,547" style="fill:rgb(0,0,0)"/>
<path d="M127,505L127,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,709 359,714 359,705" style="fill:rgb(0,0,0)"/>
<path d="M127,558 L 127,694 Q 127,709 142,709 L 350,709 L 365,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,709 597,714 597,705" style="fill:rgb(0,0,0)"/>
<path d="M371,709L603,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,709 L 616,709 Q 624,709 624,717 L 624,724"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,800L194,800A15 15 0 0 0 209 785A15 15 0 0 0 194 770L142,770A15 15 0 0 0 127 785A15 15 0 0 0 142 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="245,785 234,789 234,781" style="fill:rgb(0,0,0)"/>
<path d="M209,785L239,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,800A15 15 0 0 0 275 785A15 15 0 0 0 260 770A15 15 0 0 0 245 785A15 15 0 0 0 260 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="311,785 300,789 300,781" style="fill:rgb(0,0,0)"/>
<path d="M275,785L306,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,800L361,800L361,770L311,770Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="397,785 385,789 385,781" style="fill:rgb(0,0,0)"/>
<path d="M361,785L391,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,800A15 15 0 0 0 427 785A15 15 0 0 0 412 770A15 15 0 0 0 397 785A15 15 0 0 0 412 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="412" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="609,785 597,789 597,781" style="fill:rgb(0,0,0)"/>
<path d="M427,785L603,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,785 L 616,785 Q 624,785 624,792 L 624,800"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,762A15 15 0 0 0 351 747A15 15 0 0 0 336 732A15 15 0 0 0 321 747A15 15 0 0 0 336 762Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="747" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M336,838A15 15 0 0 0 351 823A15 15 0 0 0 336 808A15 15 0 0 0 321 823A15 15 0 0 0 336 838Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="823" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="351,747 363,743 363,751" style="fill:rgb(0,0,0)"/>
<path d="M361,785 L 368,785 Q 376,785 376,770 L 376,762 Q 376,747 366,747 L 357,747"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,747 L 300,747 Q 285,747 285,762 L 285,770 Q 285,785 292,785 L 300,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,823 363,818 363,827" style="fill:rgb(0,0,0)"/>
<path d="M427,785 L 434,785 Q 442,785 442,800 L 442,808 Q 442,823 427,823 L 372,823 L 357,823"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,823 L 234,823 Q 219,823 219,808 L 219,800 Q 219,785 226,785 L 234,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,785 115,789 115,781" style="fill:rgb(0,0,0)"/>
<path d="M55,129 L 62,129 Q 70,129 70,144 L 70,770 Q 70,785 85,785 L 106,785 L 121,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,891L424,891L424,860L248,860Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="876" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="424,876 436,871 436,880" style="fill:rgb(0,0,0)"/>
<path d="M624,692 L 624,861 Q 624,876 609,876 L 445,876 L 430,876"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="6,197 10,208 2,208" style="fill:rgb(0,0,0)"/>
<path d="M248,876 L 21,876 Q 6,876 6,861 L 6,217 L 6,202"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M6,197 L 6,144 Q 6,129 21,129 L 40,129 L 55,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="667" y="275" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" transform="rotate(-90 667,285)" dominant-baseline="central">select-core</text>
<path d="M168,966L213,966A15 15 0 0 0 228 951A15 15 0 0 0 213 936L168,936A15 15 0 0 0 153 951A15 15 0 0 0 168 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="251,951 239,956 239,947" style="fill:rgb(0,0,0)"/>
<path d="M228,951L245,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,966L270,966A15 15 0 0 0 285 951A15 15 0 0 0 270 936L266,936A15 15 0 0 0 251 951A15 15 0 0 0 266 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M168,1072L202,1072A15 15 0 0 0 217 1057A15 15 0 0 0 202 1042L168,1042A15 15 0 0 0 153 1057A15 15 0 0 0 168 1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="240,1057 228,1061 228,1053" style="fill:rgb(0,0,0)"/>
<path d="M217,1057L234,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,1072L289,1072L289,1042L240,1042Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="330,951 319,956 319,947" style="fill:rgb(0,0,0)"/>
<path d="M285,951L324,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,966L460,966L460,936L330,936Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M395,1004A15 15 0 0 0 410 989A15 15 0 0 0 395 974A15 15 0 0 0 380 989A15 15 0 0 0 395 1004Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="989" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="410,989 422,985 422,993" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 468,951 Q 475,951 475,966 L 475,974 Q 475,989 460,989 L 431,989 L 416,989"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,989 L 322,989 Q 307,989 307,974 L 307,966 Q 307,951 313,951 L 319,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,913 348,909 348,918" style="fill:rgb(0,0,0)"/>
<path d="M624,860 L 624,898 Q 624,913 609,913 L 357,913 L 342,913"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,951 142,956 142,947" style="fill:rgb(0,0,0)"/>
<path d="M336,913 L 142,913 Q 127,913 127,928 L 127,936 Q 127,951 137,951 L 147,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,981 492,970 500,970" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 481,951 Q 496,951 496,963 L 496,976"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,1023 318,1019 318,1027" style="fill:rgb(0,0,0)"/>
<path d="M496,981 L 496,1008 Q 496,1023 481,1023 L 327,1023 L 312,1023"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,1057 142,1061 142,1053" style="fill:rgb(0,0,0)"/>
<path d="M307,1023 L 142,1023 Q 127,1023 127,1038 L 127,1042 Q 127,1057 137,1057 L 147,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,989 122,978 131,978" style="fill:rgb(0,0,0)"/>
<path d="M127,936L127,983"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,989L127,1042"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1102L415,1102A15 15 0 0 0 430 1087A15 15 0 0 0 415 1072L363,1072A15 15 0 0 0 348 1087A15 15 0 0 0 363 1102Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="389" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="453,1087 441,1092 441,1083" style="fill:rgb(0,0,0)"/>
<path d="M430,1087L447,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,1102L502,1102L502,1072L453,1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="525,1087 513,1092 513,1083" style="fill:rgb(0,0,0)"/>
<path d="M502,1087L519,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1140A15 15 0 0 0 378 1125A15 15 0 0 0 363 1110A15 15 0 0 0 348 1125A15 15 0 0 0 363 1140Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="1125" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="401,1125 390,1129 390,1121" style="fill:rgb(0,0,0)"/>
<path d="M378,1125L396,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,1140L451,1140L451,1110L401,1110Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="1125" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="312,1057 301,1061 301,1053" style="fill:rgb(0,0,0)"/>
<path d="M289,1057L306,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1125 337,1129 337,1121" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1110 Q 327,1125 335,1125 L 342,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1087 337,1092 337,1083" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1072 Q 327,1087 335,1087 L 342,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1057 513,1061 513,1053" style="fill:rgb(0,0,0)"/>
<path d="M312,1057L519,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="620,1155 609,1160 609,1151" style="fill:rgb(0,0,0)"/>
<path d="M525,1057 L 546,1057 Q 561,1057 561,1072 L 561,1140 Q 561,1155 576,1155 L 599,1155 L 614,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="624" cy="1155" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1087 L 546,1087 Q 561,1087 561,1095 L 561,1102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1125 513,1129 513,1121" style="fill:rgb(0,0,0)"/>
<path d="M451,1125L519,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1125 L 546,1125 Q 561,1125 561,1133 L 561,1140"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1155 513,1160 513,1151" style="fill:rgb(0,0,0)"/>
<path d="M127,1042 L 127,1140 Q 127,1155 142,1155 L 504,1155 L 519,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1155L597,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/common-table-expression.html">common-table-expression:</a></b>
<button id='xaca9470c' onclick='hideorshow("xaca9470c","x8b15cdee")'>show</button></p>
 <div id='x8b15cdee' style='display:none;' class='imgcontainer'>
 <div style="max-width:638px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 638.525 167.4">
<circle cx="5" cy="29" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,29 20,33 20,24" style="fill:rgb(0,0,0)"/>
<path d="M9,29L26,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,44L122,44A15 15 0 0 0 137 29A15 15 0 0 0 122 14L47,14A15 15 0 0 0 32 29A15 15 0 0 0 47 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="160,29 149,33 149,24" style="fill:rgb(0,0,0)"/>
<path d="M137,29L155,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="196,29 185,33 185,24" style="fill:rgb(0,0,0)"/>
<path d="M160,29L191,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,44A15 15 0 0 0 227 29A15 15 0 0 0 211 14A15 15 0 0 0 196 29A15 15 0 0 0 211 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="250,29 238,33 238,24" style="fill:rgb(0,0,0)"/>
<path d="M227,29L244,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="286,29 274,33 274,24" style="fill:rgb(0,0,0)"/>
<path d="M250,29L280,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,44L395,44A15 15 0 0 0 410 29A15 15 0 0 0 395 14L301,14A15 15 0 0 0 286 29A15 15 0 0 0 301 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="446,29 434,33 434,24" style="fill:rgb(0,0,0)"/>
<path d="M410,29L440,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,44A15 15 0 0 0 476 29A15 15 0 0 0 461 14A15 15 0 0 0 446 29A15 15 0 0 0 461 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,29 499,33 499,24" style="fill:rgb(0,0,0)"/>
<path d="M476,29L505,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,165L51,165A15 15 0 0 0 66 150A15 15 0 0 0 51 135L47,135A15 15 0 0 0 32 150A15 15 0 0 0 47 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="49" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<path d="M127,135L147,135A15 15 0 0 0 162 119A15 15 0 0 0 147 104L127,104A15 15 0 0 0 112 119A15 15 0 0 0 127 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<path d="M219,135L337,135A15 15 0 0 0 352 119A15 15 0 0 0 337 104L219,104A15 15 0 0 0 204 119A15 15 0 0 0 219 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<path d="M162,119L204,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,165A15 15 0 0 0 425 150A15 15 0 0 0 410 135A15 15 0 0 0 395 150A15 15 0 0 0 410 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="410" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="448,150 437,154 437,145" style="fill:rgb(0,0,0)"/>
<path d="M425,150L442,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,165L552,165L552,135L448,135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="500" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="575,150 564,154 564,145" style="fill:rgb(0,0,0)"/>
<path d="M552,150L570,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M591,165A15 15 0 0 0 606 150A15 15 0 0 0 591 135A15 15 0 0 0 575 150A15 15 0 0 0 591 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="629,150 617,154 617,145" style="fill:rgb(0,0,0)"/>
<path d="M606,150L623,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="632" cy="150" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,82A15 15 0 0 0 363 66A15 15 0 0 0 348 51A15 15 0 0 0 333 66A15 15 0 0 0 348 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="363,66 374,62 374,71" style="fill:rgb(0,0,0)"/>
<path d="M410,29 L 417,29 Q 425,29 425,44 L 425,51 Q 425,66 410,66 L 384,66 L 369,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M333,66 L 278,66 Q 263,66 263,51 L 263,44 Q 263,29 270,29 L 278,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,93 78,89 78,97" style="fill:rgb(0,0,0)"/>
<path d="M511,29 L 516,29 Q 522,29 522,44 L 522,78 Q 522,93 507,93 L 87,93 L 72,93"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,150 20,154 20,145" style="fill:rgb(0,0,0)"/>
<path d="M66,93 L 30,93 Q 15,93 15,108 L 15,135 Q 15,150 20,150 L 26,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="85,150 73,154 73,145" style="fill:rgb(0,0,0)"/>
<path d="M66,150L79,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="112,119 101,124 101,115" style="fill:rgb(0,0,0)"/>
<path d="M85,150 L 89,150 Q 92,150 92,135 L 92,134 Q 92,119 99,119 L 106,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="204,119 192,124 192,115" style="fill:rgb(0,0,0)"/>
<path d="M66,150 L 147,150 Q 162,150 170,150 Q 177,150 177,135 L 177,134 Q 177,119 188,119 L 198,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,150 383,154 383,145" style="fill:rgb(0,0,0)"/>
<path d="M352,119 L 360,119 Q 367,119 367,134 L 367,135 Q 367,150 378,150 L 389,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150L395,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,6 336,10 336,2" style="fill:rgb(0,0,0)"/>
<path d="M160,29 L 168,29 Q 175,29 175,17 Q 175,6 190,6 L 327,6 L 342,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,6 L 473,6 Q 488,6 488,17 Q 488,29 495,29 L 503,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/compound-operator.html">compound-operator:</a></b>
<button id='xe4463509' onclick='hideorshow("xe4463509","x0bc5ca82")'>show</button></p>
 <div id='x0bc5ca82' style='display:none;' class='imgcontainer'>
 <div style="max-width:293px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 293.842 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L127,32A15 15 0 0 0 142 17A15 15 0 0 0 127 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,70L127,70A15 15 0 0 0 142 55L142,55A15 15 0 0 0 127 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,108L168,108A15 15 0 0 0 183 92A15 15 0 0 0 168 77L83,77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M83,145L135,145A15 15 0 0 0 150 130A15 15 0 0 0 135 115L83,115A15 15 0 0 0 68 130A15 15 0 0 0 83 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M142,55L159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70L195,70A15 15 0 0 0 210 55L210,55A15 15 0 0 0 195 39L180,39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="233,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M210,55L227,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,17 272,21 272,12" style="fill:rgb(0,0,0)"/>
<path d="M233,55 L 240,55 Q 248,55 248,40 L 248,32 Q 248,17 263,17 L 263,17 L 278,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="288" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M47,39 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,92 221,97 221,88" style="fill:rgb(0,0,0)"/>
<path d="M183,92L227,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,92 L 240,92 Q 248,92 248,77 L 248,54 L 248,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,130 56,135 56,126" style="fill:rgb(0,0,0)"/>
<path d="M47,77 L 47,115 Q 47,130 55,130 L 62,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,130 221,135 221,126" style="fill:rgb(0,0,0)"/>
<path d="M150,130L227,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,130 L 240,130 Q 248,130 248,115 L 248,92 L 248,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-clause.html">join-clause:</a></b>
<button id='x81e5a782' onclick='hideorshow("x81e5a782","x35c90381")'>show</button></p>
 <div id='x35c90381' style='display:none;' class='imgcontainer'>
 <div style="max-width:793px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 793.282 84.24">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L193,32L193,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="259,47 247,51 247,43" style="fill:rgb(0,0,0)"/>
<path d="M193,17 L 200,17 Q 208,17 208,32 L 208,32 Q 208,47 223,47 L 238,47 L 253,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,62L380,62L380,32L259,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-operator</text>
<polygon points="403,47 391,51 391,43" style="fill:rgb(0,0,0)"/>
<path d="M380,47L397,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,62L564,62L564,32L403,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="587,47 575,51 575,43" style="fill:rgb(0,0,0)"/>
<path d="M564,47L581,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M587,62L721,62L721,32L587,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="654" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-constraint</text>
<polygon points="783,17 772,21 772,12" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 742,47 Q 757,47 757,32 L 757,32 Q 757,17 767,17 L 778,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="787" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M193,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,17L776,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,77 495,73 495,82" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 728,47 Q 736,47 736,62 L 736,62 Q 736,77 721,77 L 504,77 L 489,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,77 L 247,77 Q 232,77 232,62 L 232,62 Q 232,47 246,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/join-constraint.html">join-constraint:</a></b>
<button id='x83fc0d55' onclick='hideorshow("x83fc0d55","xa2ca092e")'>show</button></p>
 <div id='xa2ca092e' style='display:none;' class='imgcontainer'>
 <div style="max-width:483px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 483.336 126.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L104,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 104 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="143,55 131,59 131,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L137,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,70A15 15 0 0 0 173 55L173,55A15 15 0 0 0 158 39A15 15 0 0 0 143 55L143,55A15 15 0 0 0 158 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="209,55 197,59 197,50" style="fill:rgb(0,0,0)"/>
<path d="M173,55L203,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M224,70L318,70A15 15 0 0 0 333 55L333,55A15 15 0 0 0 318 39L224,39A15 15 0 0 0 209 55L209,55A15 15 0 0 0 224 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="369,55 358,59 358,50" style="fill:rgb(0,0,0)"/>
<path d="M333,55L363,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,70A15 15 0 0 0 399 55L399,55A15 15 0 0 0 384 39A15 15 0 0 0 369 55L369,55A15 15 0 0 0 384 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="422,55 411,59 411,50" style="fill:rgb(0,0,0)"/>
<path d="M399,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="473,17 462,21 462,12" style="fill:rgb(0,0,0)"/>
<path d="M422,55 L 430,55 Q 437,55 437,40 L 437,32 Q 437,17 452,17 L 453,17 L 468,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="477" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,108A15 15 0 0 0 286 92A15 15 0 0 0 271 77A15 15 0 0 0 256 92A15 15 0 0 0 271 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="286,92 298,88 298,97" style="fill:rgb(0,0,0)"/>
<path d="M333,55 L 341,55 Q 348,55 348,70 L 348,77 Q 348,92 333,92 L 307,92 L 292,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,92 L 197,92 Q 182,92 182,77 L 182,70 Q 182,55 190,55 L 197,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L74,32A15 15 0 0 0 90 17A15 15 0 0 0 74 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="113,17 101,21 101,12" style="fill:rgb(0,0,0)"/>
<path d="M90,17L107,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M113,32L162,32L162,2L113,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="422,17 411,21 411,12" style="fill:rgb(0,0,0)"/>
<path d="M162,17L417,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,17L462,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="209,120 197,124 197,115" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,105 Q 24,120 39,120 L 188,120 L 203,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,120 L 422,120 Q 437,120 437,105 L 437,54 L 437,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-operator.html">join-operator:</a></b>
<button id='x74083e06' onclick='hideorshow("x74083e06","x6ae29795")'>show</button></p>
 <div id='x6ae29795' style='display:none;' class='imgcontainer'>
 <div style="max-width:620px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 620.333 255.312">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,71 39,76 39,67" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,56 Q 24,71 34,71 L 45,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,86L133,86A15 15 0 0 0 148 71A15 15 0 0 0 133 56L66,56A15 15 0 0 0 50 71A15 15 0 0 0 66 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="99" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NATURAL</text>
<polygon points="189,41 178,45 178,37" style="fill:rgb(0,0,0)"/>
<path d="M148,71 L 155,71 Q 163,71 163,56 L 163,56 Q 163,41 173,41 L 184,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,71 219,76 219,67" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,56 Q 204,71 215,71 L 225,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,86L273,86A15 15 0 0 0 288 71A15 15 0 0 0 273 56L246,56A15 15 0 0 0 231 71A15 15 0 0 0 246 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LEFT</text>
<polygon points="378,71 366,76 366,67" style="fill:rgb(0,0,0)"/>
<path d="M288,71L372,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,86L437,86A15 15 0 0 0 452 71A15 15 0 0 0 437 56L393,56A15 15 0 0 0 378 71A15 15 0 0 0 393 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OUTER</text>
<polygon points="475,71 463,76 463,67" style="fill:rgb(0,0,0)"/>
<path d="M452,71L469,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="516,41 505,45 505,37" style="fill:rgb(0,0,0)"/>
<path d="M475,71 L 482,71 Q 490,71 490,56 L 490,56 Q 490,41 500,41 L 511,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,56L554,56A15 15 0 0 0 569 41A15 15 0 0 0 554 26L532,26A15 15 0 0 0 516 41A15 15 0 0 0 532 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="543" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">JOIN</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M569,41 L 576,41 Q 584,41 584,29 Q 584,17 594,17 L 605,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="614" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,32A15 15 0 0 0 325 17A15 15 0 0 0 310 2A15 15 0 0 0 295 17A15 15 0 0 0 310 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="295,17 283,21 283,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L289,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M325,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="99,41 88,45 88,37" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,29 Q 24,41 39,41 L 78,41 L 93,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M99,41L178,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,41L505,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,41 366,45 366,37" style="fill:rgb(0,0,0)"/>
<path d="M336,71 L 344,71 Q 351,71 351,56 L 351,56 Q 351,41 362,41 L 372,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,109 219,113 219,105" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,94 Q 204,109 215,109 L 225,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,124L284,124A15 15 0 0 0 299 109A15 15 0 0 0 284 94L246,94A15 15 0 0 0 231 109A15 15 0 0 0 246 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RIGHT</text>
<polygon points="341,71 329,76 329,67" style="fill:rgb(0,0,0)"/>
<path d="M299,109 L 307,109 Q 314,109 314,94 L 314,86 Q 314,71 324,71 L 335,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,147 219,151 219,142" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,132 Q 204,147 215,147 L 225,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,162L274,162A15 15 0 0 0 289 147A15 15 0 0 0 274 132L246,132A15 15 0 0 0 231 147A15 15 0 0 0 246 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FULL</text>
<path d="M289,147 L 302,147 Q 314,147 314,132 L 314,109 L 314,94"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,192 219,196 219,188" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,177 Q 204,192 215,192 L 225,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,207L287,207A15 15 0 0 0 302 192A15 15 0 0 0 287 177L246,177A15 15 0 0 0 231 192A15 15 0 0 0 246 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="192" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INNER</text>
<polygon points="475,192 463,196 463,188" style="fill:rgb(0,0,0)"/>
<path d="M302,192L469,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,192 L 482,192 Q 490,192 490,185 L 490,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,238 219,242 219,233" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,223 Q 24,238 39,238 L 210,238 L 225,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,253L287,253A15 15 0 0 0 303 238A15 15 0 0 0 287 222L246,222A15 15 0 0 0 231 238A15 15 0 0 0 246 253Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="238" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CROSS</text>
<polygon points="475,238 463,242 463,233" style="fill:rgb(0,0,0)"/>
<path d="M303,238L469,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,238 L 482,238 Q 490,238 490,223 L 490,71 L 490,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/result-column.html">result-column:</a></b>
<button id='x0f92d934' onclick='hideorshow("x0f92d934","xb3d76c7b")'>show</button></p>
 <div id='xb3d76c7b' style='display:none;' class='imgcontainer'>
 <div style="max-width:398px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 398.054 163.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L94,32L94,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="136,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M94,17 L 102,17 Q 109,17 109,32 L 109,40 Q 109,55 119,55 L 130,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M151,70L155,70A15 15 0 0 0 170 55L170,55A15 15 0 0 0 155 39L151,39A15 15 0 0 0 136 55L136,55A15 15 0 0 0 151 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="206,55 194,59 194,50" style="fill:rgb(0,0,0)"/>
<path d="M170,55L200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,70L309,70A15 15 0 0 0 324 55L324,55A15 15 0 0 0 309 39L221,39A15 15 0 0 0 206 55L206,55A15 15 0 0 0 221 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="347,55 335,59 335,50" style="fill:rgb(0,0,0)"/>
<path d="M324,55L341,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,17 377,21 377,12" style="fill:rgb(0,0,0)"/>
<path d="M347,55 L 354,55 Q 362,55 362,40 L 362,32 Q 362,17 372,17 L 382,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="392" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,85 141,89 141,81" style="fill:rgb(0,0,0)"/>
<path d="M109,39 L 109,70 Q 109,85 124,85 L 132,85 L 147,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,85 L 170,85 Q 185,85 185,70 L 185,70 Q 185,55 192,55 L 200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="241,17 230,21 230,12" style="fill:rgb(0,0,0)"/>
<path d="M94,17L235,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M241,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,108 39,112 39,103" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,93 Q 24,108 34,108 L 45,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,123A15 15 0 0 0 81 108A15 15 0 0 0 66 92A15 15 0 0 0 50 108A15 15 0 0 0 66 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="108" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,108 335,112 335,103" style="fill:rgb(0,0,0)"/>
<path d="M81,108L341,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,108 L 354,108 Q 362,108 362,93 L 362,54 L 362,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,145 39,150 39,141" style="fill:rgb(0,0,0)"/>
<path d="M24,92 L 24,130 Q 24,145 34,145 L 45,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,160L141,160A15 15 0 0 0 156 145A15 15 0 0 0 141 130L66,130A15 15 0 0 0 50 145A15 15 0 0 0 66 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="145" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="179,145 167,150 167,141" style="fill:rgb(0,0,0)"/>
<path d="M156,145L173,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M194,160A15 15 0 0 0 209 145A15 15 0 0 0 194 130A15 15 0 0 0 179 145A15 15 0 0 0 194 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="232,145 221,150 221,141" style="fill:rgb(0,0,0)"/>
<path d="M209,145L226,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,160A15 15 0 0 0 262 145A15 15 0 0 0 247 130A15 15 0 0 0 232 145A15 15 0 0 0 247 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,145 335,150 335,141" style="fill:rgb(0,0,0)"/>
<path d="M262,145L341,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,145 L 354,145 Q 362,145 362,130 L 362,107 L 362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/table-or-subquery.html">table-or-subquery:</a></b>
<button id='x5683c93c' onclick='hideorshow("x5683c93c","xec0e63c7")'>show</button></p>
 <div id='xec0e63c7' style='display:none;' class='imgcontainer'>
 <div style="max-width:720px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 720.778 457.704">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,74 39,78 39,70" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,59 Q 24,74 34,74 L 45,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,89L162,89A15 15 0 0 0 177 74L177,74A15 15 0 0 0 162 59L66,59A15 15 0 0 0 50 74L50,74A15 15 0 0 0 66 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="194,74 183,78 183,70" style="fill:rgb(0,0,0)"/>
<path d="M177,74L189,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,89A15 15 0 0 0 225 74L225,74A15 15 0 0 0 209 59A15 15 0 0 0 194 74L194,74A15 15 0 0 0 209 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="266,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M225,74 L 232,74 Q 240,74 240,59 L 240,51 Q 240,36 250,36 L 260,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,51L356,51A15 15 0 0 0 371 36A15 15 0 0 0 356 21L281,21A15 15 0 0 0 266 36A15 15 0 0 0 281 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="407,36 396,41 396,32" style="fill:rgb(0,0,0)"/>
<path d="M371,36L402,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,51L427,51A15 15 0 0 0 442 36A15 15 0 0 0 427 21L423,21A15 15 0 0 0 407 36A15 15 0 0 0 423 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="478,36 466,41 466,32" style="fill:rgb(0,0,0)"/>
<path d="M442,36L472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,51L561,51A15 15 0 0 0 577 36A15 15 0 0 0 561 21L493,21A15 15 0 0 0 478 36A15 15 0 0 0 493 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="527" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<path d="M9,36L255,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="422,6 411,10 411,2" style="fill:rgb(0,0,0)"/>
<path d="M371,36 L 379,36 Q 386,36 386,21 L 386,21 Q 386,6 401,6 L 402,6 L 417,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 442,6 Q 457,6 457,21 L 457,21 Q 457,36 464,36 L 472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 577,6 Q 592,6 592,21 L 592,21 Q 592,36 599,36 L 607,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,127L388,127A15 15 0 0 0 403 112A15 15 0 0 0 388 97L323,97A15 15 0 0 0 308 112A15 15 0 0 0 323 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="426,112 415,116 415,108" style="fill:rgb(0,0,0)"/>
<path d="M403,112L420,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,127L445,127A15 15 0 0 0 460 112A15 15 0 0 0 445 97L441,97A15 15 0 0 0 426 112A15 15 0 0 0 441 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="443" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="483,112 472,116 472,108" style="fill:rgb(0,0,0)"/>
<path d="M460,112L478,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,127L577,127A15 15 0 0 0 592 112A15 15 0 0 0 577 97L499,97A15 15 0 0 0 483 112A15 15 0 0 0 499 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="538" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M323,165L343,165A15 15 0 0 0 359 150A15 15 0 0 0 343 135L323,135A15 15 0 0 0 308 150A15 15 0 0 0 323 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="382,150 370,154 370,145" style="fill:rgb(0,0,0)"/>
<path d="M359,150L376,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,165L461,165A15 15 0 0 0 476 150A15 15 0 0 0 461 135L397,135A15 15 0 0 0 382 150A15 15 0 0 0 397 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="527,74 539,70 539,78" style="fill:rgb(0,0,0)"/>
<path d="M577,36 L 607,36 Q 622,36 622,51 L 622,59 Q 622,74 607,74 L 548,74 L 533,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,150 297,154 297,145" style="fill:rgb(0,0,0)"/>
<path d="M527,74 L 297,74 Q 282,74 282,89 L 282,135 Q 282,150 292,150 L 302,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,112 297,116 297,108" style="fill:rgb(0,0,0)"/>
<path d="M282,97 L 282,104 Q 282,112 292,112 L 302,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="266,213 255,217 255,209" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,198 Q 24,213 39,213 L 245,213 L 260,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,228L431,228A15 15 0 0 0 446 213A15 15 0 0 0 431 198L281,198A15 15 0 0 0 266 213A15 15 0 0 0 281 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function-name</text>
<polygon points="463,213 452,217 452,209" style="fill:rgb(0,0,0)"/>
<path d="M446,213L457,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,228A15 15 0 0 0 493 213A15 15 0 0 0 478 198A15 15 0 0 0 463 213A15 15 0 0 0 478 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="529,213 518,217 518,209" style="fill:rgb(0,0,0)"/>
<path d="M493,213L524,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M529,228L579,228L579,198L529,198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="615,213 603,217 603,209" style="fill:rgb(0,0,0)"/>
<path d="M579,213L609,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M630,228A15 15 0 0 0 645 213A15 15 0 0 0 630 198A15 15 0 0 0 615 213A15 15 0 0 0 630 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="630" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="675,187 679,198 671,198" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 660,213 Q 675,213 675,203 L 675,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M554,190A15 15 0 0 0 569 175A15 15 0 0 0 554 160A15 15 0 0 0 539 175A15 15 0 0 0 554 190Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="175" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="569,175 581,171 581,180" style="fill:rgb(0,0,0)"/>
<path d="M579,213 L 586,213 Q 594,213 594,198 L 594,190 Q 594,175 584,175 L 575,175"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,175 L 518,175 Q 503,175 503,190 L 503,198 Q 503,213 510,213 L 518,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,74 L 232,74 Q 240,74 240,89 L 240,198 Q 240,213 247,213 L 255,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,112 648,116 648,108" style="fill:rgb(0,0,0)"/>
<path d="M592,112L654,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,112 L 667,112 Q 675,112 675,104 L 675,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,150 648,154 648,145" style="fill:rgb(0,0,0)"/>
<path d="M476,150L654,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,150 L 667,150 Q 675,150 675,142 L 675,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M577,36L690,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,304L411,304A15 15 0 0 0 426 289A15 15 0 0 0 411 274L407,274A15 15 0 0 0 392 289A15 15 0 0 0 407 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="498,289 487,293 487,284" style="fill:rgb(0,0,0)"/>
<path d="M426,289L492,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M513,304L582,304A15 15 0 0 0 597 289A15 15 0 0 0 582 274L513,274A15 15 0 0 0 498 289A15 15 0 0 0 513 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="548" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<polygon points="660,289 648,293 648,284" style="fill:rgb(0,0,0)"/>
<path d="M597,289L654,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,289 L 667,289 Q 675,289 675,281 L 675,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="548,251 559,247 559,255" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 652,213 Q 660,213 660,228 L 660,236 Q 660,251 645,251 L 568,251 L 553,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M548,251 L 370,251 Q 355,251 355,266 L 355,274 Q 355,289 370,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,251 L 464,251 Q 457,251 457,266 L 457,274 Q 457,289 464,289 L 472,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,327 39,331 39,322" style="fill:rgb(0,0,0)"/>
<path d="M24,198 L 24,312 Q 24,327 34,327 L 45,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,342A15 15 0 0 0 81 327A15 15 0 0 0 66 311A15 15 0 0 0 50 327A15 15 0 0 0 66 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,327 92,331 92,322" style="fill:rgb(0,0,0)"/>
<path d="M81,327L98,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,342L208,342L208,311L104,311Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="327" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="231,327 219,331 219,322" style="fill:rgb(0,0,0)"/>
<path d="M208,327L225,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,342A15 15 0 0 0 261 327A15 15 0 0 0 246 311A15 15 0 0 0 231 327A15 15 0 0 0 246 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M261,327 L 269,327 Q 276,327 276,312 L 276,304 Q 276,289 291,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,327 648,331 648,322" style="fill:rgb(0,0,0)"/>
<path d="M261,327L654,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,327 L 667,327 Q 675,327 675,319 L 675,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,327 L 432,327 Q 439,327 439,312 L 439,304 Q 439,289 447,289 L 454,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,364 39,369 39,360" style="fill:rgb(0,0,0)"/>
<path d="M24,311 L 24,349 Q 24,364 34,364 L 45,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,379A15 15 0 0 0 81 364A15 15 0 0 0 65 349A15 15 0 0 0 50 364A15 15 0 0 0 65 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="135,364 123,369 123,360" style="fill:rgb(0,0,0)"/>
<path d="M81,364L129,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,379L296,379L296,349L135,349Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="364" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="350,364 338,369 338,360" style="fill:rgb(0,0,0)"/>
<path d="M296,364L344,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,379A15 15 0 0 0 380 364A15 15 0 0 0 365 349A15 15 0 0 0 350 364A15 15 0 0 0 365 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="660,364 648,369 648,360" style="fill:rgb(0,0,0)"/>
<path d="M380,364L654,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="711,36 699,41 699,32" style="fill:rgb(0,0,0)"/>
<path d="M660,364 L 667,364 Q 675,364 675,349 L 675,51 Q 675,36 690,36 L 690,36 L 705,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="715" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,417A15 15 0 0 0 230 402A15 15 0 0 0 215 387A15 15 0 0 0 200 402A15 15 0 0 0 215 417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="402" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="230,402 242,398 242,406" style="fill:rgb(0,0,0)"/>
<path d="M296,364 L 303,364 Q 311,364 311,379 L 311,387 Q 311,402 296,402 L 251,402 L 236,402"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,402 L 123,402 Q 108,402 108,387 L 108,379 Q 108,364 116,364 L 123,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="122,440 111,444 111,436" style="fill:rgb(0,0,0)"/>
<path d="M81,364 L 88,364 Q 96,364 96,379 L 96,425 Q 96,440 106,440 L 116,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M122,455L224,455L224,425L122,425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M224,440 L 308,440 Q 323,440 323,425 L 323,379 Q 323,364 331,364 L 338,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/window-defn.html">window-defn:</a></b>
<button id='x99f1bba2' onclick='hideorshow("x99f1bba2","xfbec94cb")'>show</button></p>
 <div id='xfbec94cb' style='display:none;' class='imgcontainer'>
 <div style="max-width:479px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 479.765 380.592">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,44 92,48 92,40" style="fill:rgb(0,0,0)"/>
<path d="M62,17 L 70,17 Q 77,17 77,30 Q 77,44 88,44 L 98,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,59L260,59A15 15 0 0 0 275 44L275,44A15 15 0 0 0 260 29L119,29A15 15 0 0 0 104 44L104,44A15 15 0 0 0 119 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M119,135L198,135A15 15 0 0 0 214 120A15 15 0 0 0 198 104L119,104A15 15 0 0 0 104 120A15 15 0 0 0 119 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="237,120 225,124 225,115" style="fill:rgb(0,0,0)"/>
<path d="M214,120L231,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M252,135L256,135A15 15 0 0 0 271 120A15 15 0 0 0 256 104L252,104A15 15 0 0 0 237 120A15 15 0 0 0 252 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="307,120 295,124 295,115" style="fill:rgb(0,0,0)"/>
<path d="M271,120L301,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,135L356,135L356,104L307,104Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M332,173A15 15 0 0 0 347 157A15 15 0 0 0 332 142A15 15 0 0 0 316 157A15 15 0 0 0 332 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="157" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="347,157 358,153 358,162" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,142 Q 371,157 362,157 L 352,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,157 L 295,157 Q 280,157 280,142 L 280,135 Q 280,120 288,120 L 295,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,17 178,21 178,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L184,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,82 201,77 201,86" style="fill:rgb(0,0,0)"/>
<path d="M190,17 L 298,17 Q 313,17 313,32 L 313,67 Q 313,82 298,82 L 210,82 L 195,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,120 92,124 92,115" style="fill:rgb(0,0,0)"/>
<path d="M190,82 L 77,82 Q 62,82 62,97 L 62,105 Q 62,120 77,120 L 83,120 L 98,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,44 287,48 287,40" style="fill:rgb(0,0,0)"/>
<path d="M275,44L293,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,44 L 306,44 Q 313,44 313,51 L 313,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,248L163,248A15 15 0 0 0 178 233A15 15 0 0 0 163 218L119,218A15 15 0 0 0 104 233A15 15 0 0 0 119 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="201,233 190,237 190,229" style="fill:rgb(0,0,0)"/>
<path d="M178,233L196,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,248L221,248A15 15 0 0 0 236 233A15 15 0 0 0 221 218L217,218A15 15 0 0 0 201 233A15 15 0 0 0 217 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="272,233 260,237 260,229" style="fill:rgb(0,0,0)"/>
<path d="M236,233L266,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,248L402,248L402,218L272,218Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M337,286A15 15 0 0 0 352 271A15 15 0 0 0 337 256A15 15 0 0 0 322 271A15 15 0 0 0 337 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="352,271 363,266 363,275" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,256 Q 417,271 402,271 L 373,271 L 358,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M322,271 L 260,271 Q 245,271 245,256 L 245,248 Q 245,233 253,233 L 260,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,195 201,191 201,200" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,180 Q 371,195 356,195 L 210,195 L 195,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,233 92,237 92,229" style="fill:rgb(0,0,0)"/>
<path d="M190,195 L 77,195 Q 62,195 62,210 L 62,218 Q 62,233 77,233 L 83,233 L 98,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,157 58,146 66,146" style="fill:rgb(0,0,0)"/>
<path d="M62,104L62,152"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,157L62,218"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,362L208,362L208,331L104,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="417,346 405,351 405,342" style="fill:rgb(0,0,0)"/>
<path d="M208,346L411,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,362A15 15 0 0 0 447 346A15 15 0 0 0 432 331A15 15 0 0 0 417 346A15 15 0 0 0 432 362Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="470,346 458,351 458,342" style="fill:rgb(0,0,0)"/>
<path d="M447,346L464,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="474" cy="346" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,309 201,304 201,313" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,294 Q 417,309 402,309 L 210,309 L 195,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,346 92,351 92,342" style="fill:rgb(0,0,0)"/>
<path d="M190,309 L 77,309 Q 62,309 62,324 L 62,331 Q 62,346 77,346 L 83,346 L 98,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,271 58,259 66,259" style="fill:rgb(0,0,0)"/>
<path d="M62,218L62,265"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,271L62,331"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,374 144,378 144,369" style="fill:rgb(0,0,0)"/>
<path d="M62,331 L 62,359 Q 62,374 77,374 L 135,374 L 150,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,346 266,351 266,342" style="fill:rgb(0,0,0)"/>
<path d="M156,374 L 233,374 Q 248,374 248,360 Q 248,346 260,346 L 272,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x25b26622' onclick='hideorshow("x25b26622","xd40ab19a")'>show</button></p>
 <div id='xd40ab19a' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/type-name.html">type-name:</a></b>
<button id='xd3a803cf' onclick='hideorshow("xd3a803cf","x07298b48")'>show</button></p>
 <div id='x07298b48' style='display:none;' class='imgcontainer'>
 <div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.008 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L87,32A15 15 0 0 0 102 17A15 15 0 0 0 87 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="165,92 153,97 153,88" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,77 Q 138,92 149,92 L 159,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,108A15 15 0 0 0 195 92A15 15 0 0 0 180 77A15 15 0 0 0 165 92A15 15 0 0 0 180 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,92 201,97 201,88" style="fill:rgb(0,0,0)"/>
<path d="M195,92L207,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,108L350,108L350,77L212,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,92 356,97 356,88" style="fill:rgb(0,0,0)"/>
<path d="M350,92L362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,108A15 15 0 0 0 398 92A15 15 0 0 0 382 77A15 15 0 0 0 367 92A15 15 0 0 0 382 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="415,92 403,97 403,88" style="fill:rgb(0,0,0)"/>
<path d="M398,92L409,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,108L553,108L553,77L415,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="570,92 558,97 558,88" style="fill:rgb(0,0,0)"/>
<path d="M553,92L564,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,108A15 15 0 0 0 600 92A15 15 0 0 0 585 77A15 15 0 0 0 570 92A15 15 0 0 0 585 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="585" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="651,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M600,92 L 608,92 Q 615,92 615,77 L 615,32 Q 615,17 630,17 L 630,17 L 645,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,40 Q 138,55 149,55 L 159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70A15 15 0 0 0 195 55L195,55A15 15 0 0 0 180 39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,55 201,59 201,50" style="fill:rgb(0,0,0)"/>
<path d="M195,55L207,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,70L350,70L350,39L212,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,55 356,59 356,50" style="fill:rgb(0,0,0)"/>
<path d="M350,55L362,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,70A15 15 0 0 0 398 55L398,55A15 15 0 0 0 382 39A15 15 0 0 0 367 55L367,55A15 15 0 0 0 382 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="600,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M398,55L594,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M600,55 L 608,55 Q 615,55 615,47 L 615,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="74,47 85,43 85,51" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 110,17 Q 117,17 117,32 L 117,32 Q 117,47 102,47 L 94,47 L 79,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47 L 33,47 Q 18,47 18,32 L 18,32 Q 18,17 26,17 L 33,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="382,17 371,21 371,12" style="fill:rgb(0,0,0)"/>
<path d="M102,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,17L630,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='x51075353' onclick='hideorshow("x51075353","x9e10b7e0")'>show</button></p>
 <div id='x9e10b7e0' style='display:none;' class='imgcontainer'>
 <div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/filter-clause.html">filter-clause:</a></b>
<button id='x4ba4425e' onclick='hideorshow("x4ba4425e","xeb26b09e")'>show</button></p>
 <div id='xeb26b09e' style='display:none;' class='imgcontainer'>
 <div style="max-width:422px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 422.381 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L93,32A15 15 0 0 0 108 17A15 15 0 0 0 93 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FILTER</text>
<polygon points="131,17 119,21 119,12" style="fill:rgb(0,0,0)"/>
<path d="M108,17L125,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,32L146,32A15 15 0 0 0 161 17A15 15 0 0 0 146 2L146,2A15 15 0 0 0 131 17A15 15 0 0 0 146 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="184,17 173,21 173,12" style="fill:rgb(0,0,0)"/>
<path d="M161,17L178,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M199,32L249,32A15 15 0 0 0 264 17A15 15 0 0 0 249 2L199,2A15 15 0 0 0 184 17A15 15 0 0 0 199 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="224" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="287,17 275,21 275,12" style="fill:rgb(0,0,0)"/>
<path d="M264,17L281,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,32L336,32L336,2L287,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M336,17L353,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,32A15 15 0 0 0 389 17A15 15 0 0 0 374 2A15 15 0 0 0 359 17A15 15 0 0 0 374 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="374" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="413,17 401,21 401,12" style="fill:rgb(0,0,0)"/>
<path d="M389,17L407,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="416" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x4815349c' onclick='hideorshow("x4815349c","x86ae0b3a")'>show</button></p>
 <div id='x86ae0b3a' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>


<p>
The aggregate functions shown below are available by default. 
There are two more aggregates grouped with the <a href="json1.html">JSON SQL functions</a>.
Applications can define custom aggregate functions using the
<a href="c3ref/create_function.html">sqlite3_create_function()</a> interface.
API.</p>

<p>
In any aggregate function that takes a single argument, that argument
can be preceded by the keyword DISTINCT.  In such cases, duplicate
elements are filtered before being passed into the aggregate function.
For example, the function "count(distinct X)" will return the number
of distinct values of column X instead of the total number of non-null
values in column X.
</p>

<a name="aggfilter"></a>

<p>
If a FILTER clause is provided, then only rows for which the <i>expr</i> is
true are included in the aggregate.
</p>

<a name="aggorderby"></a>

<p>
If an ORDER BY clause is provided, that clause determines the order in which
the inputs to the aggregate are processed.  For aggregate functions like max()
and count(), the input order does not matter.  But for things like
<a href="lang_aggfunc.html#group_concat">string_agg()</a> and <a href="json1.html#jgroupobject">json_group_object()</a>, the ORDER BY clause will make a
difference in the result.  If no ORDER BY clause is specified, the inputs to the
aggregate occur in an arbitrary order that might change from one invocation
to the next.
</p>

<p>
See also: <a href="lang_corefunc.html">scalar functions</a> and <a href="windowfunctions.html">window functions</a>.

<a name="aggfunclist"></a>

</p><h1 id="list_of_built_in_aggregate_functions"><span>2. </span>List of built-in aggregate functions</h1>

<div class='columns' style='columns: 11em auto;'>
<ul style='padding-top:0;'>
<li><a href='lang_aggfunc.html#avg'>avg(X)</a></li>
<li><a href='lang_aggfunc.html#count'>count(*)</a></li>
<li><a href='lang_aggfunc.html#count'>count(X)</a></li>
<li><a href='lang_aggfunc.html#group_concat'>group_concat(X)</a></li>
<li><a href='lang_aggfunc.html#group_concat'>group_concat(X,Y)</a></li>
<li><a href='lang_aggfunc.html#max_agg'>max(X)</a></li>
<li><a href='lang_aggfunc.html#min_agg'>min(X)</a></li>
<li><a href='lang_aggfunc.html#group_concat'>string_agg(X,Y)</a></li>
<li><a href='lang_aggfunc.html#sumunc'>sum(X)</a></li>
<li><a href='lang_aggfunc.html#sumunc'>total(X)</a></li>
</ul>
</div>


<h1 id="descriptions_of_built_in_aggregate_functions"><span>3. </span>Descriptions of built-in aggregate functions</h1>
<dl>

<a name="avg"></a>
<dt><p><b>avg(<i>X</i>)</b></dt><dd><p>
  The avg() function
  returns the average value of all non-NULL <i>X</i> within a
  group.  String and BLOB values that do not look like numbers are
  interpreted as 0.
  The result of avg() is always a floating point value whenever
  there is at least one non-NULL input even if all
  inputs are integers.  The result of avg() is NULL if
  there are no non-NULL inputs.  The result of avg() is computed
  as <a href="lang_aggfunc.html#sumunc">total()</a>/<a href="lang_aggfunc.html#count">count()</a> so all of the constraints that apply to
  <a href="lang_aggfunc.html#sumunc">total()</a> also apply to avg().
</dd>
<a name="count"></a>
<dt><p><b>count(<i>X</i>)<br />count(*)</b></dt><dd><p>
  The count(X) function returns
  a count of the number of times
  that <i>X</i> is not NULL in a group.  The count(*) function
  (with no arguments) returns the total number of rows in the group.
</dd>
<a name="group_concat"></a>
<dt><p><b>group_concat(<i>X</i>)<br />group_concat(<i>X</i>,<i>Y</i>)<br />string_agg(<i>X</i>,<i>Y</i>)</b></dt><dd><p>
  The group_concat() function returns
  a string which is the concatenation of
  all non-NULL values of <i>X</i>.  If parameter <i>Y</i> is present then
  it is used as the separator
  between instances of <i>X</i>.A comma (",") is used as the separator
  if <i>Y</i> is omitted.
  <p>
  The string_agg(X,Y) function is an alias
  for group_concat(X,Y).  String_agg() is compatible with PostgreSQL
  and SQL-Server and group_concat() is compatible with MySQL.
  <p>
  The order of the concatenated elements is arbitrary unless an
  ORDER BY argument is included immediately after the last parameter.
</dd>
<a name="max_agg"></a>
<dt><p><b>max(<i>X</i>)</b></dt><dd><p>
  The max() aggregate function
  returns the maximum value of all values in the group.
  The maximum value is the value that would be returned last in an
  ORDER BY on the same column.  Aggregate max() returns NULL 
  if and only if there are no non-NULL values in the group.
</dd>
<a name="min_agg"></a>
<dt><p><b>min(<i>X</i>)</b></dt><dd><p>
  The min() aggregate function
  returns the minimum non-NULL value of all values in the group.
  The minimum value is the first non-NULL value that would appear
  in an ORDER BY of the column.
  Aggregate min() returns NULL if and only if there are no non-NULL
  values in the group.
</dd>
<a name="sumunc"></a>
<dt><p><b>sum(<i>X</i>)<br />total(<i>X</i>)</b></dt><dd><p>
  The sum() and total() aggregate functions
  return the sum of all non-NULL values in the group.
  If there are no non-NULL input rows then sum() returns
  NULL but total() returns 0.0.
  NULL is not normally a helpful result for the sum of no rows
  but the SQL standard requires it and most other
  SQL database engines implement sum() that way so SQLite does it in the
  same way in order to be compatible.   The non-standard total() function
  is provided as a convenient way to work around this design problem
  in the SQL language.</p>

  <p>The result of total() is always a floating point value.
  The result of sum() is an integer value if all non-NULL inputs are integers.
  If any input to sum() is neither an integer nor a NULL,
  then sum() returns a floating point value
  which is an approximation of the mathematical sum.</p>

  <p>Sum() will throw an "integer overflow" exception if all inputs
  are integers or NULL
  and an integer overflow occurs at any point during the computation.
  No overflow error is ever raised if any prior input was a floating point
  value.
  Total() never throws an integer overflow.

  <p>When summing floating-point values, if the magnitudes of the values
  differ wildly then the resulting sum might be imprecise due to the fact that
  <a href="floatingpoint.html#fpapprox">IEEE 754 floating point values are approximations</a>.
  Use the decimal_sum(X) aggregate in the <a href="floatingpoint.html#decext">decimal extension</a> to obtain
  an exact summation of floating point numbers.  Consider this test case:

<p><blockquote><pre>
CREATE TABLE t1(x REAL);
INSERT INTO t1 VALUES(1.55e+308),(1.23),(3.2e-16),(-1.23),(-1.55e308);
SELECT sum(x), decimal_sum(x) FROM t1;
</pre></blockquote></p>

  <p>The large values &plusmn;1.55e+308 cancel each other out, but the
  cancellation does not occur until the end of the sum and in the meantime
  the large +1.55e+308 swamps the tiny 3.2e-16 value.  The end result is
  an imprecise result for the sum().  The decimal_sum() aggregate
  generates an exact answer, at the cost of additional CPU and memory usage.
  Note also that decimal_sum() is not built into the SQLite core; it is a
  <a href="loadext.html">loadable extension</a>.

  <p>If sum of inputs is too large to represent as a IEEE 754 floating
  point value, then a +Infinity or -Infinity result may be returned.
  If very large values with differing signs are used
  such that the SUM() or TOTAL() function is
  unable to determine if the correct result is +Infinity or -Infinity
  or some other value in between, then the result is NULL.  Hence, for
  example, the following query returns NULL:

<p><blockquote><pre>
WITH t1(x) AS (VALUES(1.0),(-9e+999),(2.0),(+9e+999),(3.0))
 SELECT sum(x) FROM t1;
</pre></blockquote></p>
</dd>

</dl>
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_aggfunc.in?m=d872d05e39">2023-12-05 14:43:20</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_altertable.html.













































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>ALTER TABLE</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
ALTER TABLE
</div>
</div>





<h1 id="overview"><span>1. </span>Overview</h1>

<p><b><a href="syntax/alter-table-stmt.html">alter-table-stmt:</a></b>
<button id='x991b9c08' onclick='hideorshow("x991b9c08","x568da75f")'>hide</button></p>
 <div id='x568da75f' class='imgcontainer'>
 <div style="max-width:754px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 754.521 320.904">
<circle cx="5" cy="32" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="37,32 26,37 26,28" style="fill:rgb(0,0,0)"/>
<path d="M9,32L31,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M37,32L59,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47L113,47A15 15 0 0 0 129 32A15 15 0 0 0 113 17L74,17A15 15 0 0 0 59 32A15 15 0 0 0 74 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="94" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALTER</text>
<polygon points="165,32 153,37 153,28" style="fill:rgb(0,0,0)"/>
<path d="M129,32L159,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,47L219,47A15 15 0 0 0 234 32A15 15 0 0 0 219 17L180,17A15 15 0 0 0 165 32A15 15 0 0 0 180 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TABLE</text>
<polygon points="251,32 240,37 240,28" style="fill:rgb(0,0,0)"/>
<path d="M234,32L245,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="287,32 276,37 276,28" style="fill:rgb(0,0,0)"/>
<path d="M251,32L281,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M302,47L399,47A15 15 0 0 0 414 32A15 15 0 0 0 399 17L302,17A15 15 0 0 0 287 32A15 15 0 0 0 302 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="436,32 425,37 425,28" style="fill:rgb(0,0,0)"/>
<path d="M414,32L431,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M452,47A15 15 0 0 0 467 32A15 15 0 0 0 452 17A15 15 0 0 0 436 32A15 15 0 0 0 452 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="452" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="503,32 491,37 491,28" style="fill:rgb(0,0,0)"/>
<path d="M467,32L497,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M518,47L593,47A15 15 0 0 0 608 32A15 15 0 0 0 593 17L518,17A15 15 0 0 0 503 32A15 15 0 0 0 518 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="555" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="376,6 364,10 364,2" style="fill:rgb(0,0,0)"/>
<path d="M251,32 L 260,32 Q 268,32 268,19 Q 268,6 283,6 L 355,6 L 370,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,6 L 461,6 Q 476,6 476,19 Q 476,32 489,32 L 503,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="626,56 622,45 630,45" style="fill:rgb(0,0,0)"/>
<path d="M608,32 L 617,32 Q 626,32 626,41 L 626,51"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,81 362,76 362,85" style="fill:rgb(0,0,0)"/>
<path d="M626,56 L 626,68 Q 626,81 611,81 L 371,81 L 356,81"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,81 L 20,81 Q 5,81 5,88 L 5,96"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="41,126 30,130 30,122" style="fill:rgb(0,0,0)"/>
<path d="M5,96 L 5,111 Q 5,126 20,126 L 20,126 L 36,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M56,141L117,141A15 15 0 0 0 132 126A15 15 0 0 0 117 111L56,111A15 15 0 0 0 41 126A15 15 0 0 0 56 141Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="126" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RENAME</text>
<polygon points="150,126 139,130 139,122" style="fill:rgb(0,0,0)"/>
<path d="M132,126L144,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,141L171,141A15 15 0 0 0 186 126A15 15 0 0 0 171 111L165,111A15 15 0 0 0 150 126A15 15 0 0 0 165 141Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="126" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TO</text>
<polygon points="204,126 193,130 193,122" style="fill:rgb(0,0,0)"/>
<path d="M186,126L198,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,141L334,141A15 15 0 0 0 349 126A15 15 0 0 0 334 111L219,111A15 15 0 0 0 204 126A15 15 0 0 0 219 141Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="277" y="126" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">new-table-name</text>
<polygon points="41,171 30,176 30,167" style="fill:rgb(0,0,0)"/>
<path d="M5,96 L 5,156 Q 5,171 20,171 L 21,171 L 36,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M56,186L117,186A15 15 0 0 0 132 171A15 15 0 0 0 117 156L56,156A15 15 0 0 0 41 171A15 15 0 0 0 56 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RENAME</text>
<polygon points="149,171 138,176 138,167" style="fill:rgb(0,0,0)"/>
<path d="M132,171L143,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="185,171 174,176 174,167" style="fill:rgb(0,0,0)"/>
<path d="M149,171L179,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,186L263,186A15 15 0 0 0 278 171A15 15 0 0 0 263 156L200,156A15 15 0 0 0 185 171A15 15 0 0 0 200 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="232" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLUMN</text>
<polygon points="314,171 303,176 303,167" style="fill:rgb(0,0,0)"/>
<path d="M278,171L308,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M329,186L423,186A15 15 0 0 0 439 171A15 15 0 0 0 423 156L329,156A15 15 0 0 0 314 171A15 15 0 0 0 329 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="376" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="457,171 445,176 445,167" style="fill:rgb(0,0,0)"/>
<path d="M439,171L451,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,186L477,186A15 15 0 0 0 492 171A15 15 0 0 0 477 156L472,156A15 15 0 0 0 457 171A15 15 0 0 0 472 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="475" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TO</text>
<polygon points="510,171 499,176 499,167" style="fill:rgb(0,0,0)"/>
<path d="M492,171L505,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M526,186L660,186A15 15 0 0 0 675 171A15 15 0 0 0 660 156L526,156A15 15 0 0 0 510 171A15 15 0 0 0 526 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">new-column-name</text>
<polygon points="692,171 680,176 680,167" style="fill:rgb(0,0,0)"/>
<path d="M675,171L686,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="745,126 733,130 733,122" style="fill:rgb(0,0,0)"/>
<path d="M692,171 L 700,171 Q 709,171 709,156 L 709,141 Q 709,126 724,126 L 724,126 L 739,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="748" cy="126" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="745,126 733,130 733,122" style="fill:rgb(0,0,0)"/>
<path d="M349,126L739,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="232,198 220,202 220,193" style="fill:rgb(0,0,0)"/>
<path d="M149,171 L 158,171 Q 166,171 166,184 Q 166,198 181,198 L 211,198 L 226,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="314,171 303,176 303,167" style="fill:rgb(0,0,0)"/>
<path d="M232,198 L 272,198 Q 287,198 287,184 Q 287,171 298,171 L 308,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="41,232 30,236 30,227" style="fill:rgb(0,0,0)"/>
<path d="M5,96 L 5,217 Q 5,232 20,232 L 21,232 L 36,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M56,247L76,247A15 15 0 0 0 91 232A15 15 0 0 0 76 217L56,217A15 15 0 0 0 41 232A15 15 0 0 0 56 247Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="232" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ADD</text>
<polygon points="108,232 97,236 97,227" style="fill:rgb(0,0,0)"/>
<path d="M91,232L102,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="144,232 133,236 133,227" style="fill:rgb(0,0,0)"/>
<path d="M108,232L138,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M159,247L222,247A15 15 0 0 0 237 232A15 15 0 0 0 222 217L159,217A15 15 0 0 0 144 232A15 15 0 0 0 159 247Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="232" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLUMN</text>
<polygon points="273,232 262,236 262,227" style="fill:rgb(0,0,0)"/>
<path d="M237,232L267,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M273,247L378,247L378,217L273,217Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="326" y="232" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-def</text>
<polygon points="692,232 680,236 680,227" style="fill:rgb(0,0,0)"/>
<path d="M378,232L686,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="191,258 179,262 179,254" style="fill:rgb(0,0,0)"/>
<path d="M108,232 L 117,232 Q 125,232 125,245 Q 125,258 140,258 L 170,258 L 185,258"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,232 262,236 262,227" style="fill:rgb(0,0,0)"/>
<path d="M191,258 L 231,258 Q 246,258 246,245 Q 246,232 257,232 L 267,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="745,126 733,130 733,122" style="fill:rgb(0,0,0)"/>
<path d="M692,232 L 700,232 Q 709,232 709,217 L 709,141 Q 709,126 724,126 L 724,126 L 739,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="41,288 30,292 30,283" style="fill:rgb(0,0,0)"/>
<path d="M5,217 L 5,273 Q 5,288 20,288 L 21,288 L 36,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M56,303L87,303A15 15 0 0 0 103 288A15 15 0 0 0 87 273L56,273A15 15 0 0 0 41 288A15 15 0 0 0 56 303Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="72" y="288" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DROP</text>
<polygon points="120,288 108,292 108,283" style="fill:rgb(0,0,0)"/>
<path d="M103,288L114,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,288 144,292 144,283" style="fill:rgb(0,0,0)"/>
<path d="M120,288L150,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M171,303L234,303A15 15 0 0 0 249 288A15 15 0 0 0 234 273L171,273A15 15 0 0 0 156 288A15 15 0 0 0 171 303Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="202" y="288" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLUMN</text>
<polygon points="285,288 273,292 273,283" style="fill:rgb(0,0,0)"/>
<path d="M249,288L279,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,303L394,303A15 15 0 0 0 409 288A15 15 0 0 0 394 273L300,273A15 15 0 0 0 285 288A15 15 0 0 0 300 303Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="288" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="692,288 680,292 680,283" style="fill:rgb(0,0,0)"/>
<path d="M409,288L686,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M692,288 L 700,288 Q 709,288 709,273 L 709,232 L 709,217"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="202,314 191,318 191,310" style="fill:rgb(0,0,0)"/>
<path d="M120,288 L 127,288 Q 135,288 135,301 Q 135,314 150,314 L 181,314 L 196,314"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M202,314 L 245,314 Q 260,314 260,301 Q 260,288 268,288 L 275,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/column-def.html">column-def:</a></b>
<button id='xbab1d40e' onclick='hideorshow("xbab1d40e","x9242c9e5")'>show</button></p>
 <div id='x9242c9e5' style='display:none;' class='imgcontainer'>
 <div style="max-width:614px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 614.333 64.8">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L141,32A15 15 0 0 0 156 17A15 15 0 0 0 141 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="94" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="179,17 168,21 168,12" style="fill:rgb(0,0,0)"/>
<path d="M156,17L173,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="215,17 204,21 204,12" style="fill:rgb(0,0,0)"/>
<path d="M179,17L209,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,32L314,32L314,2L215,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M314,17L354,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M386,62L550,62L550,32L386,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="468" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-constraint</text>
<polygon points="550,17 539,21 539,12" style="fill:rgb(0,0,0)"/>
<path d="M359,17L545,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="604,17 593,21 593,12" style="fill:rgb(0,0,0)"/>
<path d="M550,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="608" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="265,42 253,47 253,38" style="fill:rgb(0,0,0)"/>
<path d="M179,17 L 187,17 Q 194,17 194,30 Q 194,42 209,42 L 244,42 L 259,42"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,42 L 314,42 Q 329,42 329,30 Q 329,17 337,17 L 344,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="550,47 562,43 562,51" style="fill:rgb(0,0,0)"/>
<path d="M550,17 L 562,17 Q 574,17 574,32 L 574,32 Q 574,47 565,47 L 556,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="399,17 388,21 388,12" style="fill:rgb(0,0,0)"/>
<path d="M386,47 L 375,47 Q 363,47 363,32 L 363,32 Q 363,17 378,17 L 379,17 L 394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/column-constraint.html">column-constraint:</a></b>
<button id='x4d609a22' onclick='hideorshow("x4d609a22","x3577858c")'>show</button></p>
 <div id='x3577858c' style='display:none;' class='imgcontainer'>
 <div style="max-width:844px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 844.306 578.88">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,40 43,28 51,28" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,25 L 47,34"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L183,32A15 15 0 0 0 198 17A15 15 0 0 0 183 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="133" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONSTRAINT</text>
<polygon points="221,17 210,21 210,12" style="fill:rgb(0,0,0)"/>
<path d="M198,17L215,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,32L263,32A15 15 0 0 0 279 17A15 15 0 0 0 263 2L236,2A15 15 0 0 0 221 17A15 15 0 0 0 236 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="250" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="173,47 185,43 185,51" style="fill:rgb(0,0,0)"/>
<path d="M279,17 L 300,17 Q 315,17 315,32 L 315,32 Q 315,47 300,47 L 194,47 L 179,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M173,47 L 62,47 Q 47,47 47,55 L 47,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,77 58,82 58,73" style="fill:rgb(0,0,0)"/>
<path d="M47,40 L 47,62 Q 47,77 56,77 L 64,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,92L148,92A15 15 0 0 0 163 77A15 15 0 0 0 148 62L85,62A15 15 0 0 0 70 77A15 15 0 0 0 85 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRIMARY</text>
<polygon points="186,77 174,82 174,73" style="fill:rgb(0,0,0)"/>
<path d="M163,77L180,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M201,92L217,92A15 15 0 0 0 233 77A15 15 0 0 0 217 62L201,62A15 15 0 0 0 186 77A15 15 0 0 0 201 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">KEY</text>
<polygon points="271,138 259,142 259,133" style="fill:rgb(0,0,0)"/>
<path d="M233,77 L 240,77 Q 248,77 248,92 L 248,123 Q 248,138 256,138 L 265,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M286,153L316,153A15 15 0 0 0 331 138A15 15 0 0 0 316 123L286,123A15 15 0 0 0 271 138A15 15 0 0 0 286 153Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="301" y="138" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="354,138 343,142 343,133" style="fill:rgb(0,0,0)"/>
<path d="M331,138L348,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,77 381,82 381,73" style="fill:rgb(0,0,0)"/>
<path d="M354,138 L 362,138 Q 369,138 369,123 L 369,92 Q 369,77 378,77 L 386,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M392,92L525,92L525,62L392,62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="459" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">conflict-clause</text>
<polygon points="549,77 537,82 537,73" style="fill:rgb(0,0,0)"/>
<path d="M525,77L543,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="587,108 575,112 575,103" style="fill:rgb(0,0,0)"/>
<path d="M549,77 L 556,77 Q 564,77 564,92 L 564,93 Q 564,108 572,108 L 581,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M602,123L745,123A15 15 0 0 0 760 108A15 15 0 0 0 745 92L602,92A15 15 0 0 0 587 108A15 15 0 0 0 602 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="673" y="108" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AUTOINCREMENT</text>
<polygon points="783,108 772,112 772,103" style="fill:rgb(0,0,0)"/>
<path d="M760,108L778,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="834,77 823,82 823,73" style="fill:rgb(0,0,0)"/>
<path d="M783,108 L 791,108 Q 798,108 798,93 L 798,92 Q 798,77 813,77 L 814,77 L 829,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="838" cy="77" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="673,77 662,82 662,73" style="fill:rgb(0,0,0)"/>
<path d="M549,77L668,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M673,77L827,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="301,77 289,82 289,73" style="fill:rgb(0,0,0)"/>
<path d="M233,77L295,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,77L381,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="271,100 259,104 259,96" style="fill:rgb(0,0,0)"/>
<path d="M233,77 L 240,77 Q 248,77 248,89 Q 248,100 256,100 L 265,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M286,115L302,115A15 15 0 0 0 318 100A15 15 0 0 0 302 85L286,85A15 15 0 0 0 271 100A15 15 0 0 0 286 115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="294" y="100" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="354,100 343,104 343,96" style="fill:rgb(0,0,0)"/>
<path d="M318,100L348,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,100 L 362,100 Q 369,100 369,92 L 369,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,183 58,187 58,179" style="fill:rgb(0,0,0)"/>
<path d="M47,62 L 47,168 Q 47,183 56,183 L 64,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,198L105,198A15 15 0 0 0 120 183A15 15 0 0 0 105 168L85,168A15 15 0 0 0 70 183A15 15 0 0 0 85 198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="95" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="143,183 132,187 132,179" style="fill:rgb(0,0,0)"/>
<path d="M120,183L138,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,198L190,198A15 15 0 0 0 205 183A15 15 0 0 0 190 168L158,168A15 15 0 0 0 143 183A15 15 0 0 0 158 198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="174" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="228,183 216,187 216,179" style="fill:rgb(0,0,0)"/>
<path d="M205,183L222,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,198L361,198L361,168L228,168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="294" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">conflict-clause</text>
<polygon points="783,183 772,187 772,179" style="fill:rgb(0,0,0)"/>
<path d="M361,183L778,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,183 L 791,183 Q 798,183 798,168 L 798,107 L 798,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,221 58,225 58,217" style="fill:rgb(0,0,0)"/>
<path d="M47,168 L 47,206 Q 47,221 56,221 L 64,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,236L140,236A15 15 0 0 0 155 221A15 15 0 0 0 140 206L85,206A15 15 0 0 0 70 221A15 15 0 0 0 85 236Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="113" y="221" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNIQUE</text>
<polygon points="178,221 167,225 167,217" style="fill:rgb(0,0,0)"/>
<path d="M155,221L172,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M178,236L311,236L311,206L178,206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="245" y="221" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">conflict-clause</text>
<polygon points="783,221 772,225 772,217" style="fill:rgb(0,0,0)"/>
<path d="M311,221L778,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,221 L 791,221 Q 798,221 798,206 L 798,183 L 798,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,259 58,263 58,254" style="fill:rgb(0,0,0)"/>
<path d="M47,206 L 47,244 Q 47,259 56,259 L 64,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,274L131,274A15 15 0 0 0 146 259A15 15 0 0 0 131 244L85,244A15 15 0 0 0 70 259A15 15 0 0 0 85 274Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="259" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CHECK</text>
<polygon points="169,259 157,263 157,254" style="fill:rgb(0,0,0)"/>
<path d="M146,259L163,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M184,274A15 15 0 0 0 199 259A15 15 0 0 0 184 244A15 15 0 0 0 169 259A15 15 0 0 0 184 274Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="259" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="222,259 210,263 210,254" style="fill:rgb(0,0,0)"/>
<path d="M199,259L216,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,274L271,274L271,244L222,244Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="259" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="294,259 283,263 283,254" style="fill:rgb(0,0,0)"/>
<path d="M271,259L288,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,274A15 15 0 0 0 324 259A15 15 0 0 0 309 244A15 15 0 0 0 294 259A15 15 0 0 0 309 274Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="309" y="259" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="783,259 772,263 772,254" style="fill:rgb(0,0,0)"/>
<path d="M324,259L778,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,259 L 791,259 Q 798,259 798,244 L 798,221 L 798,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,297 58,301 58,292" style="fill:rgb(0,0,0)"/>
<path d="M47,244 L 47,282 Q 47,297 56,297 L 64,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,312L150,312A15 15 0 0 0 166 297A15 15 0 0 0 150 281L85,281A15 15 0 0 0 70 297A15 15 0 0 0 85 312Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="118" y="297" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFAULT</text>
<polygon points="189,297 177,301 177,292" style="fill:rgb(0,0,0)"/>
<path d="M166,297L183,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="225,297 213,301 213,292" style="fill:rgb(0,0,0)"/>
<path d="M189,297L219,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,312A15 15 0 0 0 255 297A15 15 0 0 0 240 281A15 15 0 0 0 225 297A15 15 0 0 0 240 312Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="240" y="297" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="278,297 266,301 266,292" style="fill:rgb(0,0,0)"/>
<path d="M255,297L272,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,312L327,312L327,281L278,281Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="297" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="350,297 339,301 339,292" style="fill:rgb(0,0,0)"/>
<path d="M327,297L344,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,312A15 15 0 0 0 380 297A15 15 0 0 0 365 281A15 15 0 0 0 350 297A15 15 0 0 0 365 312Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="297" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="783,297 772,301 772,292" style="fill:rgb(0,0,0)"/>
<path d="M380,297L778,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,297 L 791,297 Q 798,297 798,282 L 798,259 L 798,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="227,334 215,339 215,330" style="fill:rgb(0,0,0)"/>
<path d="M189,297 L 196,297 Q 204,297 204,312 L 204,319 Q 204,334 212,334 L 221,334"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M227,349L340,349L340,319L227,319Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="283" y="334" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="363,334 351,339 351,330" style="fill:rgb(0,0,0)"/>
<path d="M340,334L357,334"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,334 L 395,334 Q 410,334 410,319 L 410,312 Q 410,297 425,297 L 431,297 L 446,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="227,372 215,376 215,368" style="fill:rgb(0,0,0)"/>
<path d="M189,297 L 196,297 Q 204,297 204,312 L 204,357 Q 204,372 212,372 L 221,372"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M227,387L364,387L364,357L227,357Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="372" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="387,372 376,376 376,368" style="fill:rgb(0,0,0)"/>
<path d="M364,372L382,372"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M387,372 L 399,372 Q 410,372 410,357 L 410,312 Q 410,297 425,297 L 431,297 L 446,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,410 58,414 58,406" style="fill:rgb(0,0,0)"/>
<path d="M47,281 L 47,395 Q 47,410 56,410 L 64,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,425L149,425A15 15 0 0 0 164 410A15 15 0 0 0 149 395L85,395A15 15 0 0 0 70 410A15 15 0 0 0 85 425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="117" y="410" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="187,410 176,414 176,406" style="fill:rgb(0,0,0)"/>
<path d="M164,410L182,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M202,425L308,425A15 15 0 0 0 323 410A15 15 0 0 0 308 395L202,395A15 15 0 0 0 187 410A15 15 0 0 0 202 425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="255" y="410" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="783,410 772,414 772,406" style="fill:rgb(0,0,0)"/>
<path d="M323,410L778,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,410 L 791,410 Q 798,410 798,395 L 798,296 L 798,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,448 58,452 58,443" style="fill:rgb(0,0,0)"/>
<path d="M47,395 L 47,433 Q 47,448 56,448 L 64,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,463L236,463L236,433L70,433Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="448" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">foreign-key-clause</text>
<polygon points="783,448 772,452 772,443" style="fill:rgb(0,0,0)"/>
<path d="M236,448L778,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,448 L 791,448 Q 798,448 798,433 L 798,410 L 798,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,486 58,490 58,481" style="fill:rgb(0,0,0)"/>
<path d="M47,433 L 47,471 Q 47,486 56,486 L 64,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,501L178,501A15 15 0 0 0 193 486A15 15 0 0 0 178 470L85,470A15 15 0 0 0 70 486A15 15 0 0 0 85 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="131" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GENERATED</text>
<polygon points="216,486 204,490 204,481" style="fill:rgb(0,0,0)"/>
<path d="M193,486L210,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M231,501L286,501A15 15 0 0 0 301 486A15 15 0 0 0 286 470L231,470A15 15 0 0 0 216 486A15 15 0 0 0 231 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALWAYS</text>
<polygon points="337,486 325,490 325,481" style="fill:rgb(0,0,0)"/>
<path d="M301,486L331,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M352,501L356,501A15 15 0 0 0 371 486A15 15 0 0 0 356 470L352,470A15 15 0 0 0 337 486A15 15 0 0 0 352 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="354" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="394,486 382,490 382,481" style="fill:rgb(0,0,0)"/>
<path d="M371,486L388,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,501A15 15 0 0 0 424 486A15 15 0 0 0 409 470A15 15 0 0 0 394 486A15 15 0 0 0 409 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="486" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="447,486 436,490 436,481" style="fill:rgb(0,0,0)"/>
<path d="M424,486L441,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M447,501L496,501L496,470L447,470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="472" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="519,486 508,490 508,481" style="fill:rgb(0,0,0)"/>
<path d="M496,486L514,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,501A15 15 0 0 0 550 486A15 15 0 0 0 535 470A15 15 0 0 0 519 486A15 15 0 0 0 535 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="535" y="486" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="783,486 772,490 772,481" style="fill:rgb(0,0,0)"/>
<path d="M550,486L778,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,486 L 791,486 Q 798,486 798,471 L 798,448 L 798,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="185,516 174,520 174,511" style="fill:rgb(0,0,0)"/>
<path d="M47,470 L 47,501 Q 47,516 62,516 L 165,516 L 180,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M185,516 L 297,516 Q 312,516 312,501 L 312,501 Q 312,486 320,486 L 327,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="596,561 584,565 584,557" style="fill:rgb(0,0,0)"/>
<path d="M550,486 L 561,486 Q 573,486 573,501 L 573,546 Q 573,561 581,561 L 590,561"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M611,576L670,576A15 15 0 0 0 686 561A15 15 0 0 0 670 546L611,546A15 15 0 0 0 596 561A15 15 0 0 0 611 576Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="641" y="561" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VIRTUAL</text>
<polygon points="783,561 772,565 772,557" style="fill:rgb(0,0,0)"/>
<path d="M686,561L778,561"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,561 L 791,561 Q 798,561 798,546 L 798,485 L 798,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="596,523 584,528 584,519" style="fill:rgb(0,0,0)"/>
<path d="M550,486 L 561,486 Q 573,486 573,501 L 573,508 Q 573,523 581,523 L 590,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M611,538L665,538A15 15 0 0 0 680 523A15 15 0 0 0 665 508L611,508A15 15 0 0 0 596 523A15 15 0 0 0 611 538Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="638" y="523" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">STORED</text>
<polygon points="783,523 772,528 772,519" style="fill:rgb(0,0,0)"/>
<path d="M680,523L778,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,523 L 791,523 Q 798,523 798,516 L 798,508"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/conflict-clause.html">conflict-clause:</a></b>
<button id='x2b2e24f4' onclick='hideorshow("x2b2e24f4","x6e74d323")'>show</button></p>
 <div id='x6e74d323' style='display:none;' class='imgcontainer'>
 <div style="max-width:451px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 451.517 205.2">
<circle cx="5" cy="6" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,6 20,10 20,2" style="fill:rgb(0,0,0)"/>
<path d="M9,6L26,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,36 58,41 58,32" style="fill:rgb(0,0,0)"/>
<path d="M32,6 L 39,6 Q 47,6 47,21 L 47,21 Q 47,36 56,36 L 64,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,51L94,51A15 15 0 0 0 109 36L109,36A15 15 0 0 0 94 21L85,21A15 15 0 0 0 70 36L70,36A15 15 0 0 0 85 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="90" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="132,36 121,41 121,32" style="fill:rgb(0,0,0)"/>
<path d="M109,36L126,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M147,51L222,51A15 15 0 0 0 237 36L237,36A15 15 0 0 0 222 21L147,21A15 15 0 0 0 132 36L132,36A15 15 0 0 0 147 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONFLICT</text>
<polygon points="273,36 261,41 261,32" style="fill:rgb(0,0,0)"/>
<path d="M237,36L267,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,51L365,51A15 15 0 0 0 381 36L381,36A15 15 0 0 0 365 21L288,21A15 15 0 0 0 273 36L273,36A15 15 0 0 0 288 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="327" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<path d="M288,89L330,89A15 15 0 0 0 345 74L345,74A15 15 0 0 0 330 59L288,59A15 15 0 0 0 273 74L273,74A15 15 0 0 0 288 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="309" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<path d="M288,127L310,127A15 15 0 0 0 325 112A15 15 0 0 0 310 97L288,97A15 15 0 0 0 273 112A15 15 0 0 0 288 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<path d="M288,165L340,165A15 15 0 0 0 355 150A15 15 0 0 0 340 135L288,135A15 15 0 0 0 273 150A15 15 0 0 0 288 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="314" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<path d="M288,203L352,203A15 15 0 0 0 367 187A15 15 0 0 0 352 172L288,172A15 15 0 0 0 273 187A15 15 0 0 0 288 203Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="320" y="187" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<polygon points="404,36 392,41 392,32" style="fill:rgb(0,0,0)"/>
<path d="M381,36L398,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="442,6 430,10 430,2" style="fill:rgb(0,0,0)"/>
<path d="M404,36 L 411,36 Q 419,36 419,21 L 419,21 Q 419,6 427,6 L 436,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="445" cy="6" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="225,6 214,10 214,2" style="fill:rgb(0,0,0)"/>
<path d="M9,6L219,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,6L434,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,187 261,192 261,183" style="fill:rgb(0,0,0)"/>
<path d="M237,36 L 244,36 Q 252,36 252,51 L 252,172 Q 252,187 259,187 L 267,187"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,187 392,192 392,183" style="fill:rgb(0,0,0)"/>
<path d="M367,187L398,187"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,187 L 411,187 Q 419,187 419,172 L 419,36 L 419,21"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,74 261,78 261,70" style="fill:rgb(0,0,0)"/>
<path d="M252,59 L 252,66 Q 252,74 259,74 L 267,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,74 392,78 392,70" style="fill:rgb(0,0,0)"/>
<path d="M345,74L398,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,74 L 411,74 Q 419,74 419,67 L 419,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,112 261,116 261,108" style="fill:rgb(0,0,0)"/>
<path d="M252,97 L 252,104 Q 252,112 259,112 L 267,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,112 392,116 392,108" style="fill:rgb(0,0,0)"/>
<path d="M325,112L398,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,112 L 411,112 Q 419,112 419,104 L 419,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,150 261,154 261,145" style="fill:rgb(0,0,0)"/>
<path d="M252,135 L 252,142 Q 252,150 259,150 L 267,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,150 392,154 392,145" style="fill:rgb(0,0,0)"/>
<path d="M355,150L398,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,150 L 411,150 Q 419,150 419,142 L 419,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/expr.html">expr:</a></b>
<button id='x5f686150' onclick='hideorshow("x5f686150","xaaaa5b64")'>show</button></p>
 <div id='xaaaa5b64' style='display:none;' class='imgcontainer'>
 <div style="max-width:963px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 963.96 1068.77">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L158,32L158,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="101" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="954,17 943,21 943,12" style="fill:rgb(0,0,0)"/>
<path d="M158,17L948,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="958" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L172,70A15 15 0 0 0 187 55L187,55A15 15 0 0 0 172 39L60,39A15 15 0 0 0 45 55L45,55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">bind-parameter</text>
<polygon points="916,55 905,59 905,50" style="fill:rgb(0,0,0)"/>
<path d="M187,55L910,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,55 L 924,55 Q 931,55 931,47 L 931,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 31,55 L 39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,130L156,130A15 15 0 0 0 171 115A15 15 0 0 0 156 100L60,100A15 15 0 0 0 45 115A15 15 0 0 0 60 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,115 183,119 183,111" style="fill:rgb(0,0,0)"/>
<path d="M171,115L189,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,130A15 15 0 0 0 225 115A15 15 0 0 0 210 100A15 15 0 0 0 195 115A15 15 0 0 0 210 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M225,115L255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130L351,130A15 15 0 0 0 366 115A15 15 0 0 0 351 100L276,100A15 15 0 0 0 261 115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="389,115 378,119 378,111" style="fill:rgb(0,0,0)"/>
<path d="M366,115L383,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,130A15 15 0 0 0 419 115A15 15 0 0 0 404 100A15 15 0 0 0 389 115A15 15 0 0 0 404 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="404" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="455,115 444,119 444,111" style="fill:rgb(0,0,0)"/>
<path d="M419,115L450,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,130L565,130A15 15 0 0 0 580 115A15 15 0 0 0 565 100L471,100A15 15 0 0 0 455 115A15 15 0 0 0 471 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="916,115 905,119 905,111" style="fill:rgb(0,0,0)"/>
<path d="M580,115L910,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,115 L 924,115 Q 931,115 931,108 L 931,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,115 33,119 33,111" style="fill:rgb(0,0,0)"/>
<path d="M24,100 L 24,108 Q 24,115 31,115 L 39,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,89 97,93 97,84" style="fill:rgb(0,0,0)"/>
<path d="M24,74 L 24,81 Q 24,89 39,89 L 87,89 L 102,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 302,93 302,84" style="fill:rgb(0,0,0)"/>
<path d="M108,89 L 129,89 Q 144,89 159,89 L 293,89 L 308,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,89 L 414,89 Q 429,89 429,102 Q 429,115 436,115 L 444,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M223,89 L 230,89 Q 238,89 238,102 Q 238,115 245,115 L 253,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,168L168,168A15 15 0 0 0 183 153A15 15 0 0 0 168 138L60,138A15 15 0 0 0 45 153A15 15 0 0 0 60 168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">unary-operator</text>
<polygon points="206,153 194,157 194,149" style="fill:rgb(0,0,0)"/>
<path d="M183,153L200,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,168L255,168L255,138L206,138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,153 905,157 905,149" style="fill:rgb(0,0,0)"/>
<path d="M255,153L910,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,153 L 924,153 Q 931,153 931,145 L 931,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,153 33,157 33,149" style="fill:rgb(0,0,0)"/>
<path d="M24,138 L 24,145 Q 24,153 31,153 L 39,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,206L94,206L94,176L45,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,191 106,195 106,186" style="fill:rgb(0,0,0)"/>
<path d="M94,191L111,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,206L245,206A15 15 0 0 0 261 191A15 15 0 0 0 245 176L132,176A15 15 0 0 0 117 191A15 15 0 0 0 132 206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">binary-operator</text>
<polygon points="284,191 272,195 272,186" style="fill:rgb(0,0,0)"/>
<path d="M261,191L278,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,206L333,206L333,176L284,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="308" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,191 905,195 905,186" style="fill:rgb(0,0,0)"/>
<path d="M333,191L910,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,191 L 924,191 Q 931,191 931,183 L 931,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,191 33,195 33,186" style="fill:rgb(0,0,0)"/>
<path d="M24,176 L 24,183 Q 24,191 31,191 L 39,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,245L162,245A15 15 0 0 0 177 230A15 15 0 0 0 162 215L60,215A15 15 0 0 0 45 230A15 15 0 0 0 60 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="111" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-name</text>
<polygon points="194,230 183,234 183,226" style="fill:rgb(0,0,0)"/>
<path d="M177,230L188,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,245A15 15 0 0 0 224 230A15 15 0 0 0 209 215A15 15 0 0 0 194 230A15 15 0 0 0 209 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="260,230 249,234 249,226" style="fill:rgb(0,0,0)"/>
<path d="M224,230L255,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,245L437,245L437,215L260,215Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-arguments</text>
<polygon points="473,230 461,234 461,226" style="fill:rgb(0,0,0)"/>
<path d="M437,230L467,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,245A15 15 0 0 0 503 230A15 15 0 0 0 488 215A15 15 0 0 0 473 230A15 15 0 0 0 488 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="541,260 529,265 529,256" style="fill:rgb(0,0,0)"/>
<path d="M503,230 L 510,230 Q 518,230 518,245 L 518,245 Q 518,260 527,260 L 535,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,275L653,275L653,245L541,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="691,230 680,234 680,226" style="fill:rgb(0,0,0)"/>
<path d="M653,260 L 661,260 Q 668,260 668,245 L 668,245 Q 668,230 677,230 L 685,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="729,260 718,265 718,256" style="fill:rgb(0,0,0)"/>
<path d="M691,230 L 699,230 Q 706,230 706,245 L 706,245 Q 706,260 715,260 L 723,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,275L837,275L837,245L729,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="783" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">over-clause</text>
<polygon points="916,260 905,265 905,256" style="fill:rgb(0,0,0)"/>
<path d="M837,260L910,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,260 L 924,260 Q 931,260 931,253 L 931,245"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,230 33,234 33,226" style="fill:rgb(0,0,0)"/>
<path d="M24,215 L 24,222 Q 24,230 31,230 L 39,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,230 585,234 585,226" style="fill:rgb(0,0,0)"/>
<path d="M503,230L591,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,230L680,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,230 905,234 905,226" style="fill:rgb(0,0,0)"/>
<path d="M691,230L910,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,230 L 924,230 Q 931,230 931,222 L 931,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,321A15 15 0 0 0 75 306A15 15 0 0 0 60 290A15 15 0 0 0 45 306A15 15 0 0 0 60 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,306 100,310 100,301" style="fill:rgb(0,0,0)"/>
<path d="M75,306L105,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M111,321L160,321L160,290L111,290Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="306" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="196,306 185,310 185,301" style="fill:rgb(0,0,0)"/>
<path d="M160,306L191,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,321A15 15 0 0 0 227 306A15 15 0 0 0 211 290A15 15 0 0 0 196 306A15 15 0 0 0 211 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,306 905,310 905,301" style="fill:rgb(0,0,0)"/>
<path d="M227,306L910,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,306 L 924,306 Q 931,306 931,298 L 931,291"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,306 33,310 33,301" style="fill:rgb(0,0,0)"/>
<path d="M24,290 L 24,298 Q 24,306 31,306 L 39,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,284A15 15 0 0 0 151 269A15 15 0 0 0 136 254A15 15 0 0 0 121 269A15 15 0 0 0 136 284Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="269" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="151,269 162,265 162,274" style="fill:rgb(0,0,0)"/>
<path d="M160,306 L 168,306 Q 175,306 175,291 L 175,284 Q 175,269 166,269 L 157,269"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,269 L 103,269 Q 88,269 88,284 L 88,291 Q 88,306 96,306 L 103,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,358L88,358A15 15 0 0 0 103 343A15 15 0 0 0 88 328L60,328A15 15 0 0 0 45 343A15 15 0 0 0 60 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CAST</text>
<polygon points="126,343 114,348 114,339" style="fill:rgb(0,0,0)"/>
<path d="M103,343L120,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M141,358A15 15 0 0 0 156 343A15 15 0 0 0 141 328A15 15 0 0 0 126 343A15 15 0 0 0 141 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="179,343 168,348 168,339" style="fill:rgb(0,0,0)"/>
<path d="M156,343L173,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,358L228,358L228,328L179,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="251,343 240,348 240,339" style="fill:rgb(0,0,0)"/>
<path d="M228,343L246,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,358L271,358A15 15 0 0 0 286 343A15 15 0 0 0 271 328L267,328A15 15 0 0 0 251 343A15 15 0 0 0 267 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="269" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="309,343 297,348 297,339" style="fill:rgb(0,0,0)"/>
<path d="M286,343L303,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,358L408,358L408,328L309,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="358" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="431,343 419,348 419,339" style="fill:rgb(0,0,0)"/>
<path d="M408,343L425,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M446,358A15 15 0 0 0 461 343A15 15 0 0 0 446 328A15 15 0 0 0 431 343A15 15 0 0 0 446 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,343 905,348 905,339" style="fill:rgb(0,0,0)"/>
<path d="M461,343L910,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,343 L 924,343 Q 931,343 931,336 L 931,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,343 33,348 33,339" style="fill:rgb(0,0,0)"/>
<path d="M24,328 L 24,336 Q 24,343 31,343 L 39,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,396L94,396L94,366L45,366Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,381 106,385 106,377" style="fill:rgb(0,0,0)"/>
<path d="M94,381L111,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,396L196,396A15 15 0 0 0 211 381A15 15 0 0 0 196 366L132,366A15 15 0 0 0 117 381A15 15 0 0 0 132 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="234,381 223,385 223,377" style="fill:rgb(0,0,0)"/>
<path d="M211,381L229,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,396L355,396A15 15 0 0 0 370 381A15 15 0 0 0 355 366L250,366A15 15 0 0 0 234 381A15 15 0 0 0 250 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="916,381 905,385 905,377" style="fill:rgb(0,0,0)"/>
<path d="M370,381L910,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,381 L 924,381 Q 931,381 931,374 L 931,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,381 33,385 33,377" style="fill:rgb(0,0,0)"/>
<path d="M24,366 L 24,374 Q 24,381 31,381 L 39,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,434L94,434L94,404L45,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,419 119,423 119,415" style="fill:rgb(0,0,0)"/>
<path d="M94,419L124,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,434L165,434A15 15 0 0 0 180 419A15 15 0 0 0 165 404L145,404A15 15 0 0 0 130 419A15 15 0 0 0 145 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="234,419 223,423 223,415" style="fill:rgb(0,0,0)"/>
<path d="M180,419L229,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,434L273,434A15 15 0 0 0 288 419A15 15 0 0 0 273 404L250,404A15 15 0 0 0 234 419A15 15 0 0 0 250 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIKE</text>
<path d="M250,472L279,472A15 15 0 0 0 294 457A15 15 0 0 0 279 442L250,442A15 15 0 0 0 234 457A15 15 0 0 0 250 472Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="457" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GLOB</text>
<path d="M250,510L302,510A15 15 0 0 0 317 495A15 15 0 0 0 302 479L250,479A15 15 0 0 0 234 495A15 15 0 0 0 250 510Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REGEXP</text>
<path d="M250,547L297,547A15 15 0 0 0 313 532A15 15 0 0 0 297 517L250,517A15 15 0 0 0 234 532A15 15 0 0 0 250 547Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="274" y="532" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<path d="M378,510L427,510L427,479L378,479Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M378,434L427,434L427,404L378,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="465,449 454,454 454,445" style="fill:rgb(0,0,0)"/>
<path d="M427,419 L 435,419 Q 442,419 442,434 L 442,434 Q 442,449 451,449 L 460,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,464L532,464A15 15 0 0 0 547 449A15 15 0 0 0 532 434L480,434A15 15 0 0 0 465 449A15 15 0 0 0 480 464Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="506" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ESCAPE</text>
<polygon points="570,449 559,454 559,445" style="fill:rgb(0,0,0)"/>
<path d="M547,449L565,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M570,464L620,464L620,434L570,434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="595" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="671,419 659,423 659,415" style="fill:rgb(0,0,0)"/>
<path d="M620,449 L 627,449 Q 635,449 635,434 L 635,434 Q 635,419 650,419 L 650,419 L 665,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,419 905,423 905,415" style="fill:rgb(0,0,0)"/>
<path d="M671,419L910,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,419 L 924,419 Q 931,419 931,411 L 931,404"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,419 33,423 33,415" style="fill:rgb(0,0,0)"/>
<path d="M24,404 L 24,411 Q 24,419 31,419 L 39,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M100,419 L 108,419 Q 115,419 115,434 L 115,434 Q 115,449 130,449 L 177,449 Q 192,449 192,434 L 192,434 Q 192,419 199,419 L 207,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,532 223,537 223,528" style="fill:rgb(0,0,0)"/>
<path d="M196,419 L 204,419 Q 211,419 211,434 L 211,517 Q 211,532 220,532 L 229,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,457 223,461 223,452" style="fill:rgb(0,0,0)"/>
<path d="M211,442 L 211,449 Q 211,457 220,457 L 229,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,495 223,499 223,490" style="fill:rgb(0,0,0)"/>
<path d="M211,479 L 211,487 Q 211,495 220,495 L 229,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,419 367,423 367,415" style="fill:rgb(0,0,0)"/>
<path d="M288,419L372,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,532 329,537 329,528" style="fill:rgb(0,0,0)"/>
<path d="M313,532L334,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,495 367,499 367,490" style="fill:rgb(0,0,0)"/>
<path d="M340,532 L 348,532 Q 355,532 355,517 L 355,510 Q 355,495 364,495 L 372,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,495 329,499 329,490" style="fill:rgb(0,0,0)"/>
<path d="M317,495L334,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,495L378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,457 329,461 329,452" style="fill:rgb(0,0,0)"/>
<path d="M294,457L334,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,457 L 348,457 Q 355,457 355,472 L 355,480 Q 355,495 367,495 L 378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="506,419 495,423 495,415" style="fill:rgb(0,0,0)"/>
<path d="M427,419L501,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M506,419L659,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="547,495 536,499 536,490" style="fill:rgb(0,0,0)"/>
<path d="M427,495L542,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,495 L 656,495 Q 671,495 671,480 L 671,434 Q 671,419 686,419 L 692,419 L 707,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,585L94,585L94,555L45,555Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,570 119,574 119,566" style="fill:rgb(0,0,0)"/>
<path d="M94,570L124,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,585L194,585A15 15 0 0 0 209 570A15 15 0 0 0 194 555L145,555A15 15 0 0 0 130 570A15 15 0 0 0 145 585Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="170" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ISNULL</text>
<polygon points="916,570 905,574 905,566" style="fill:rgb(0,0,0)"/>
<path d="M209,570L910,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,570 L 924,570 Q 931,570 931,563 L 931,555"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,570 33,574 33,566" style="fill:rgb(0,0,0)"/>
<path d="M24,555 L 24,563 Q 24,570 31,570 L 39,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,623L215,623A15 15 0 0 0 230 608A15 15 0 0 0 215 593L145,593A15 15 0 0 0 130 608A15 15 0 0 0 145 623Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="608" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTNULL</text>
<path d="M145,661L165,661A15 15 0 0 0 180 646A15 15 0 0 0 165 631L145,631A15 15 0 0 0 130 646A15 15 0 0 0 145 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="203,646 192,650 192,641" style="fill:rgb(0,0,0)"/>
<path d="M180,646L198,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,661L250,661A15 15 0 0 0 265 646A15 15 0 0 0 250 631L219,631A15 15 0 0 0 203 646A15 15 0 0 0 219 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="288,646 276,650 276,641" style="fill:rgb(0,0,0)"/>
<path d="M265,646L282,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="339,570 327,574 327,566" style="fill:rgb(0,0,0)"/>
<path d="M288,646 L 295,646 Q 303,646 303,631 L 303,585 Q 303,570 318,570 L 318,570 L 333,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="288,608 276,612 276,604" style="fill:rgb(0,0,0)"/>
<path d="M230,608L282,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,608 L 295,608 Q 303,608 303,600 L 303,593"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,646 119,650 119,641" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,631 Q 109,646 117,646 L 124,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,608 119,612 119,604" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,593 Q 109,608 117,608 L 124,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,699L94,699L94,668L45,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,684 106,688 106,679" style="fill:rgb(0,0,0)"/>
<path d="M94,684L111,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,699A15 15 0 0 0 147 684A15 15 0 0 0 132 668A15 15 0 0 0 117 684A15 15 0 0 0 132 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IS</text>
<polygon points="183,684 172,688 172,679" style="fill:rgb(0,0,0)"/>
<path d="M147,684L178,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M198,699L219,699A15 15 0 0 0 234 684A15 15 0 0 0 219 668L198,668A15 15 0 0 0 183 684A15 15 0 0 0 198 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="270,684 258,688 258,679" style="fill:rgb(0,0,0)"/>
<path d="M234,684L264,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="306,684 294,688 294,679" style="fill:rgb(0,0,0)"/>
<path d="M270,684L300,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,699L389,699A15 15 0 0 0 404 684A15 15 0 0 0 389 668L321,668A15 15 0 0 0 306 684A15 15 0 0 0 321 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="440,684 429,688 429,679" style="fill:rgb(0,0,0)"/>
<path d="M404,684L434,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,699L490,699A15 15 0 0 0 505 684A15 15 0 0 0 490 668L455,668A15 15 0 0 0 440 684A15 15 0 0 0 455 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="541,684 530,688 530,679" style="fill:rgb(0,0,0)"/>
<path d="M505,684L535,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,699L590,699L590,668L541,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,684 905,688 905,679" style="fill:rgb(0,0,0)"/>
<path d="M590,684L910,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,684 L 924,684 Q 931,684 931,676 L 931,669"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,684 33,688 33,679" style="fill:rgb(0,0,0)"/>
<path d="M24,668 L 24,676 Q 24,684 31,684 L 39,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,684 L 156,684 Q 164,684 164,696 Q 164,708 179,708 L 230,708 Q 245,708 245,696 Q 245,684 253,684 L 260,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,684 L 279,684 Q 286,684 286,696 Q 286,708 301,708 L 502,708 Q 517,708 517,696 Q 517,684 524,684 L 532,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,744L94,744L94,714L45,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,729 119,733 119,725" style="fill:rgb(0,0,0)"/>
<path d="M94,729L124,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,744L165,744A15 15 0 0 0 180 729A15 15 0 0 0 165 714L145,714A15 15 0 0 0 130 729A15 15 0 0 0 145 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,729 205,733 205,725" style="fill:rgb(0,0,0)"/>
<path d="M180,729L211,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,744L304,744A15 15 0 0 0 319 729A15 15 0 0 0 304 714L232,714A15 15 0 0 0 216 729A15 15 0 0 0 232 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="342,729 331,733 331,725" style="fill:rgb(0,0,0)"/>
<path d="M319,729L336,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M342,744L391,744L391,714L342,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="367" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="414,729 403,733 403,725" style="fill:rgb(0,0,0)"/>
<path d="M391,729L409,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M430,744L450,744A15 15 0 0 0 465 729A15 15 0 0 0 450 714L430,714A15 15 0 0 0 414 729A15 15 0 0 0 430 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="488,729 477,733 477,725" style="fill:rgb(0,0,0)"/>
<path d="M465,729L483,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,744L538,744L538,714L488,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="513" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,729 905,733 905,725" style="fill:rgb(0,0,0)"/>
<path d="M538,729L910,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,729 L 924,729 Q 931,729 931,721 L 931,714"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,729 33,733 33,725" style="fill:rgb(0,0,0)"/>
<path d="M24,714 L 24,721 Q 24,729 31,729 L 39,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,729 L 103,729 Q 110,729 110,741 Q 110,753 125,753 L 177,753 Q 192,753 192,741 Q 192,729 199,729 L 207,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,797L94,797L94,767L45,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,782 119,786 119,778" style="fill:rgb(0,0,0)"/>
<path d="M94,782L124,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,797L165,797A15 15 0 0 0 180 782A15 15 0 0 0 165 767L145,767A15 15 0 0 0 130 782A15 15 0 0 0 145 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,782 205,786 205,778" style="fill:rgb(0,0,0)"/>
<path d="M180,782L211,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,797L234,797A15 15 0 0 0 249 782A15 15 0 0 0 234 767L232,767A15 15 0 0 0 216 782A15 15 0 0 0 232 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IN</text>
<polygon points="285,782 273,786 273,778" style="fill:rgb(0,0,0)"/>
<path d="M249,782L279,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,797A15 15 0 0 0 315 782A15 15 0 0 0 300 767A15 15 0 0 0 285 782A15 15 0 0 0 300 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,782 340,786 340,778" style="fill:rgb(0,0,0)"/>
<path d="M315,782L345,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,797L455,797L455,767L351,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="491,782 480,786 480,778" style="fill:rgb(0,0,0)"/>
<path d="M455,782L486,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M507,797A15 15 0 0 0 522 782A15 15 0 0 0 507 767A15 15 0 0 0 491 782A15 15 0 0 0 507 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="507" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,782 905,786 905,778" style="fill:rgb(0,0,0)"/>
<path d="M522,782L910,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,782 L 924,782 Q 931,782 931,774 L 931,767"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,782 33,786 33,778" style="fill:rgb(0,0,0)"/>
<path d="M24,767 L 24,774 Q 24,782 31,782 L 39,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,782 L 103,782 Q 110,782 110,794 Q 110,806 125,806 L 177,806 Q 192,806 192,794 Q 192,782 199,782 L 207,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,782 L 324,782 Q 332,782 332,770 Q 332,758 347,758 L 452,758 Q 467,758 467,770 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M379,835L428,835L428,805L379,805Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="820" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="379,820 367,824 367,815" style="fill:rgb(0,0,0)"/>
<path d="M317,782 L 324,782 Q 332,782 332,797 L 332,805 Q 332,820 347,820 L 358,820 L 373,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M428,820 L 452,820 Q 467,820 467,805 L 467,797 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,873A15 15 0 0 0 418 857A15 15 0 0 0 403 842A15 15 0 0 0 388 857A15 15 0 0 0 403 873Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="857" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,857 430,853 430,862" style="fill:rgb(0,0,0)"/>
<path d="M428,820 L 435,820 Q 443,820 443,835 L 443,842 Q 443,857 434,857 L 424,857"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,857 L 371,857 Q 356,857 356,842 L 356,835 Q 356,820 363,820 L 371,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,925L396,925A15 15 0 0 0 412 910A15 15 0 0 0 396 895L300,895A15 15 0 0 0 285 910A15 15 0 0 0 300 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="429,910 417,915 417,906" style="fill:rgb(0,0,0)"/>
<path d="M412,910L423,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,925A15 15 0 0 0 459 910A15 15 0 0 0 444 895A15 15 0 0 0 429 910A15 15 0 0 0 444 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="513,910 502,915 502,906" style="fill:rgb(0,0,0)"/>
<path d="M459,910L507,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,925L627,925A15 15 0 0 0 642 910A15 15 0 0 0 627 895L528,895A15 15 0 0 0 513 910A15 15 0 0 0 528 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="577" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function</text>
<polygon points="659,910 647,915 647,906" style="fill:rgb(0,0,0)"/>
<path d="M642,910L653,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,925A15 15 0 0 0 689 910A15 15 0 0 0 674 895A15 15 0 0 0 659 910A15 15 0 0 0 674 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="734,910 723,915 723,906" style="fill:rgb(0,0,0)"/>
<path d="M689,910L728,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,925L783,925L783,895L734,895Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="828,910 817,915 817,906" style="fill:rgb(0,0,0)"/>
<path d="M783,910L823,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M844,925A15 15 0 0 0 859 910A15 15 0 0 0 844 895A15 15 0 0 0 828 910A15 15 0 0 0 844 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="844" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,910 905,915 905,906" style="fill:rgb(0,0,0)"/>
<path d="M859,910L910,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,910 L 924,910 Q 931,910 931,903 L 931,895"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,865L603,865A15 15 0 0 0 619 850A15 15 0 0 0 603 835L528,835A15 15 0 0 0 513 850A15 15 0 0 0 528 865Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="850" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="916,850 905,854 905,846" style="fill:rgb(0,0,0)"/>
<path d="M619,850L910,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,850 L 924,850 Q 931,850 931,842 L 931,835"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="513,850 502,854 502,846" style="fill:rgb(0,0,0)"/>
<path d="M475,910 L 483,910 Q 490,910 490,895 L 490,865 Q 490,850 499,850 L 507,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,892A15 15 0 0 0 774 877A15 15 0 0 0 759 862A15 15 0 0 0 744 877A15 15 0 0 0 759 892Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="877" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="774,877 785,873 785,881" style="fill:rgb(0,0,0)"/>
<path d="M783,910 L 791,910 Q 798,910 798,895 L 798,892 Q 798,877 789,877 L 780,877"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M744,877 L 726,877 Q 711,877 711,892 L 711,895 Q 711,910 719,910 L 726,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M689,910 L 697,910 Q 704,910 704,921 Q 704,932 719,932 L 790,932 Q 805,932 805,921 Q 805,910 813,910 L 820,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="285,910 273,915 273,906" style="fill:rgb(0,0,0)"/>
<path d="M249,782 L 256,782 Q 264,782 264,797 L 264,895 Q 264,910 272,910 L 279,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,882 412,886 412,877" style="fill:rgb(0,0,0)"/>
<path d="M264,867 L 264,874 Q 264,882 279,882 L 402,882 L 417,882"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,882 L 456,882 Q 471,882 471,896 Q 471,910 478,910 L 486,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,971L80,971A15 15 0 0 0 95 956A15 15 0 0 0 80 941L60,941A15 15 0 0 0 45 956A15 15 0 0 0 60 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="131,956 120,960 120,951" style="fill:rgb(0,0,0)"/>
<path d="M95,956L125,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,971L191,971A15 15 0 0 0 206 956A15 15 0 0 0 191 941L146,941A15 15 0 0 0 131 956A15 15 0 0 0 146 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="242,956 231,960 231,951" style="fill:rgb(0,0,0)"/>
<path d="M206,956L236,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,971A15 15 0 0 0 272 956A15 15 0 0 0 257 941A15 15 0 0 0 242 956A15 15 0 0 0 257 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="295,956 284,960 284,951" style="fill:rgb(0,0,0)"/>
<path d="M272,956L290,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,971L400,971L400,941L295,941Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="423,956 411,960 411,951" style="fill:rgb(0,0,0)"/>
<path d="M400,956L417,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,971A15 15 0 0 0 453 956A15 15 0 0 0 438 941A15 15 0 0 0 423 956A15 15 0 0 0 438 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,956 905,960 905,951" style="fill:rgb(0,0,0)"/>
<path d="M453,956L910,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,956 L 924,956 Q 931,956 931,948 L 931,941"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,956 33,960 33,951" style="fill:rgb(0,0,0)"/>
<path d="M24,941 L 24,948 Q 24,956 31,956 L 39,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,929 59,934 59,925" style="fill:rgb(0,0,0)"/>
<path d="M24,914 L 24,922 Q 24,929 39,929 L 49,929 L 64,929"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,929 L 201,929 Q 216,929 216,943 Q 216,956 223,956 L 231,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,929 L 101,929 Q 108,929 108,943 Q 108,956 116,956 L 123,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,1009L89,1009A15 15 0 0 0 104 994A15 15 0 0 0 89 978L60,978A15 15 0 0 0 45 994A15 15 0 0 0 60 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASE</text>
<polygon points="140,994 128,998 128,989" style="fill:rgb(0,0,0)"/>
<path d="M104,994L134,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M140,1009L189,1009L189,978L140,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="243,994 232,998 232,989" style="fill:rgb(0,0,0)"/>
<path d="M189,994L237,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,1009L298,1009A15 15 0 0 0 313 994A15 15 0 0 0 298 978L258,978A15 15 0 0 0 243 994A15 15 0 0 0 258 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="336,994 324,998 324,989" style="fill:rgb(0,0,0)"/>
<path d="M313,994L330,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,1009L385,1009L385,978L336,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="408,994 396,998 396,989" style="fill:rgb(0,0,0)"/>
<path d="M385,994L402,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,1009L456,1009A15 15 0 0 0 472 994A15 15 0 0 0 456 978L423,978A15 15 0 0 0 408 994A15 15 0 0 0 423 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">THEN</text>
<polygon points="495,994 483,998 483,989" style="fill:rgb(0,0,0)"/>
<path d="M472,994L489,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M495,1009L544,1009L544,978L495,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="616,994 604,998 604,989" style="fill:rgb(0,0,0)"/>
<path d="M544,994L610,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M631,1009L658,1009A15 15 0 0 0 673 994A15 15 0 0 0 658 978L631,978A15 15 0 0 0 616 994A15 15 0 0 0 631 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="645" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ELSE</text>
<polygon points="696,994 685,998 685,989" style="fill:rgb(0,0,0)"/>
<path d="M673,994L691,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M696,1009L746,1009L746,978L696,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="721" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="782,994 770,998 770,989" style="fill:rgb(0,0,0)"/>
<path d="M746,994L776,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M797,1009L818,1009A15 15 0 0 0 833 994A15 15 0 0 0 818 978L797,978A15 15 0 0 0 782 994A15 15 0 0 0 797 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="807" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="916,994 905,998 905,989" style="fill:rgb(0,0,0)"/>
<path d="M833,994L910,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,994 L 924,994 Q 931,994 931,986 L 931,979"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,994 33,998 33,989" style="fill:rgb(0,0,0)"/>
<path d="M24,978 L 24,986 Q 24,994 31,994 L 39,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,994 L 111,994 Q 119,994 119,1007 Q 119,1021 134,1021 L 186,1021 Q 201,1021 201,1007 Q 201,994 208,994 L 216,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="360,1021 372,1016 372,1025" style="fill:rgb(0,0,0)"/>
<path d="M544,994 L 551,994 Q 559,994 559,1007 Q 559,1021 544,1021 L 381,1021 L 366,1021"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,1021 L 235,1021 Q 220,1021 220,1007 Q 220,994 227,994 L 235,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,994 L 585,994 Q 593,994 593,1007 Q 593,1021 608,1021 L 742,1021 Q 757,1021 757,1007 Q 757,994 765,994 L 772,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,1066L173,1066L173,1036L45,1036Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="1051" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">raise-function</text>
<polygon points="916,1051 905,1055 905,1047" style="fill:rgb(0,0,0)"/>
<path d="M173,1051L910,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,1051 L 924,1051 Q 931,1051 931,1036 L 931,32 Q 931,17 939,17 L 946,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,1051 33,1055 33,1047" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,1036 Q 24,1051 31,1051 L 39,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/filter-clause.html">filter-clause:</a></b>
<button id='xa242d1cf' onclick='hideorshow("xa242d1cf","xf01db535")'>show</button></p>
 <div id='xf01db535' style='display:none;' class='imgcontainer'>
 <div style="max-width:422px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 422.381 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L93,32A15 15 0 0 0 108 17A15 15 0 0 0 93 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FILTER</text>
<polygon points="131,17 119,21 119,12" style="fill:rgb(0,0,0)"/>
<path d="M108,17L125,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,32L146,32A15 15 0 0 0 161 17A15 15 0 0 0 146 2L146,2A15 15 0 0 0 131 17A15 15 0 0 0 146 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="184,17 173,21 173,12" style="fill:rgb(0,0,0)"/>
<path d="M161,17L178,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M199,32L249,32A15 15 0 0 0 264 17A15 15 0 0 0 249 2L199,2A15 15 0 0 0 184 17A15 15 0 0 0 199 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="224" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="287,17 275,21 275,12" style="fill:rgb(0,0,0)"/>
<path d="M264,17L281,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,32L336,32L336,2L287,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M336,17L353,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,32A15 15 0 0 0 389 17A15 15 0 0 0 374 2A15 15 0 0 0 359 17A15 15 0 0 0 374 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="374" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="413,17 401,21 401,12" style="fill:rgb(0,0,0)"/>
<path d="M389,17L407,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="416" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/function-arguments.html">function-arguments:</a></b>
<button id='x200b6f54' onclick='hideorshow("x200b6f54","xd943c26e")'>show</button></p>
 <div id='xd943c26e' style='display:none;' class='imgcontainer'>
 <div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.566 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,26 55,30 55,22" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,41 L 43,41 Q 43,26 52,26 L 61,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M82,41L150,41A15 15 0 0 0 165 26L165,26A15 15 0 0 0 150 11L82,11A15 15 0 0 0 66 26L66,26A15 15 0 0 0 82 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="183,26 171,30 171,22" style="fill:rgb(0,0,0)"/>
<path d="M165,26L177,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M183,26 L 189,26 Q 194,26 194,41 L 194,41 Q 194,56 203,56 L 212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M218,56L248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,71L303,71L303,41L254,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="447,56 435,60 435,52" style="fill:rgb(0,0,0)"/>
<path d="M303,56L441,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="116,56 104,60 104,52" style="fill:rgb(0,0,0)"/>
<path d="M32,56L110,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M116,56L212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,32A15 15 0 0 0 293 17A15 15 0 0 0 278 2A15 15 0 0 0 263 17A15 15 0 0 0 278 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="293,17 305,12 305,21" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 314,56 Q 326,56 326,41 L 326,32 Q 326,17 312,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M263,17 L 245,17 Q 230,17 230,32 L 230,41 Q 230,56 239,56 L 248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,207A15 15 0 0 0 243 192L243,192A15 15 0 0 0 228 177A15 15 0 0 0 213 192L213,192A15 15 0 0 0 228 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="213,192 201,196 201,188" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,71 L 43,177 Q 43,192 58,192 L 192,192 L 207,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,192 267,196 267,188" style="fill:rgb(0,0,0)"/>
<path d="M243,192L272,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,192 L 360,192 Q 375,192 390,192 L 394,192 Q 409,192 409,177 L 409,71 Q 409,56 415,56 L 421,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="228,216 216,221 216,212" style="fill:rgb(0,0,0)"/>
<path d="M116,192 L 181,192 Q 196,192 196,204 Q 196,216 209,216 L 222,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,216 L 242,216 Q 257,216 257,204 Q 257,192 262,192 L 268,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="90,117 78,121 78,112" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 313,56 Q 323,56 323,71 L 323,71 Q 323,86 308,86 L 81,86 Q 66,86 66,101 L 66,102 Q 66,117 75,117 L 84,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,132L149,132A15 15 0 0 0 164 117L164,117A15 15 0 0 0 149 101L105,101A15 15 0 0 0 90 117L90,117A15 15 0 0 0 105 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="182,117 170,121 170,112" style="fill:rgb(0,0,0)"/>
<path d="M164,117L176,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,132L201,132A15 15 0 0 0 216 117L216,117A15 15 0 0 0 201 101L197,101A15 15 0 0 0 182 117L182,117A15 15 0 0 0 197 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M216,117L239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,132L375,132L375,101L245,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,169A15 15 0 0 0 325 154A15 15 0 0 0 310 139A15 15 0 0 0 294 154A15 15 0 0 0 310 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,154 336,150 336,159" style="fill:rgb(0,0,0)"/>
<path d="M375,117 L 380,117 Q 386,117 386,132 L 386,139 Q 386,154 371,154 L 345,154 L 330,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M294,154 L 260,154 Q 245,154 236,154 Q 227,154 227,139 L 227,132 Q 227,117 233,117 L 239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M375,117 L 383,117 Q 392,117 392,102 L 392,71 Q 392,56 407,56 L 413,56 L 428,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x9988546b' onclick='hideorshow("x9988546b","xbe7a6dc2")'>show</button></p>
 <div id='xbe7a6dc2' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/over-clause.html">over-clause:</a></b>
<button id='xae2d7050' onclick='hideorshow("xae2d7050","x3f8a56df")'>show</button></p>
 <div id='x3f8a56df' style='display:none;' class='imgcontainer'>
 <div style="max-width:600px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 600.706 418.392">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="129,17 117,21 117,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L123,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M144,32L241,32A15 15 0 0 0 256 17A15 15 0 0 0 241 2L144,2A15 15 0 0 0 129 17A15 15 0 0 0 144 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,17 L 100,17 Q 108,17 108,32 L 108,40 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,70A15 15 0 0 0 165 55L165,55A15 15 0 0 0 149 39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 149 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="149" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="206,82 195,86 195,77" style="fill:rgb(0,0,0)"/>
<path d="M165,55 L 172,55 Q 180,55 180,68 Q 180,82 190,82 L 200,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,97L363,97A15 15 0 0 0 378 82A15 15 0 0 0 363 67L221,67A15 15 0 0 0 206 82A15 15 0 0 0 221 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="292" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M221,173L301,173A15 15 0 0 0 316 157A15 15 0 0 0 301 142L221,142A15 15 0 0 0 206 157A15 15 0 0 0 221 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="339,157 328,162 328,153" style="fill:rgb(0,0,0)"/>
<path d="M316,157L333,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,173L358,173A15 15 0 0 0 373 157A15 15 0 0 0 358 142L354,142A15 15 0 0 0 339 157A15 15 0 0 0 354 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="409,157 398,162 398,153" style="fill:rgb(0,0,0)"/>
<path d="M373,157L404,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,173L459,173L459,142L409,142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M434,210A15 15 0 0 0 449 195A15 15 0 0 0 434 180A15 15 0 0 0 419 195A15 15 0 0 0 434 210Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="195" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="449,195 461,191 461,200" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,180 Q 474,195 464,195 L 455,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,195 L 398,195 Q 383,195 383,180 L 383,172 Q 383,157 390,157 L 398,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,55 280,59 280,50" style="fill:rgb(0,0,0)"/>
<path d="M165,55L286,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,120 304,115 304,124" style="fill:rgb(0,0,0)"/>
<path d="M292,55 L 401,55 Q 416,55 416,70 L 416,105 Q 416,120 401,120 L 313,120 L 298,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,157 195,162 195,153" style="fill:rgb(0,0,0)"/>
<path d="M292,120 L 180,120 Q 165,120 165,135 L 165,142 Q 165,157 180,157 L 185,157 L 200,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="401,82 389,86 389,77" style="fill:rgb(0,0,0)"/>
<path d="M378,82L395,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,82 L 408,82 Q 416,82 416,89 L 416,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,286L266,286A15 15 0 0 0 281 271A15 15 0 0 0 266 256L221,256A15 15 0 0 0 206 271A15 15 0 0 0 221 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="244" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="304,271 292,275 292,266" style="fill:rgb(0,0,0)"/>
<path d="M281,271L298,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M319,286L323,286A15 15 0 0 0 338 271A15 15 0 0 0 323 256L319,256A15 15 0 0 0 304 271A15 15 0 0 0 319 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="321" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="374,271 363,275 363,266" style="fill:rgb(0,0,0)"/>
<path d="M338,271L368,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,286L504,286L504,256L374,256Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M439,324A15 15 0 0 0 454 309A15 15 0 0 0 439 293A15 15 0 0 0 424 309A15 15 0 0 0 439 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="454,309 466,304 466,313" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,294 Q 519,309 504,309 L 475,309 L 460,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,309 L 363,309 Q 348,309 348,294 L 348,286 Q 348,271 355,271 L 363,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,233 304,229 304,237" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,218 Q 474,233 459,233 L 313,233 L 298,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,271 195,275 195,266" style="fill:rgb(0,0,0)"/>
<path d="M292,233 L 180,233 Q 165,233 165,248 L 165,256 Q 165,271 180,271 L 185,271 L 200,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,195 160,184 169,184" style="fill:rgb(0,0,0)"/>
<path d="M165,142L165,189"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,195L165,256"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,399L311,399L311,369L206,369Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="384" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="519,384 508,389 508,380" style="fill:rgb(0,0,0)"/>
<path d="M311,384L513,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M534,399A15 15 0 0 0 549 384A15 15 0 0 0 534 369A15 15 0 0 0 519 384A15 15 0 0 0 534 399Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="384" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="591,17 579,21 579,12" style="fill:rgb(0,0,0)"/>
<path d="M549,384 L 557,384 Q 564,384 564,369 L 564,32 Q 564,17 575,17 L 585,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="594" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,17 508,21 508,12" style="fill:rgb(0,0,0)"/>
<path d="M256,17L513,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,17L579,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,346 304,342 304,351" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,331 Q 519,346 504,346 L 313,346 L 298,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,384 195,389 195,380" style="fill:rgb(0,0,0)"/>
<path d="M292,346 L 180,346 Q 165,346 165,361 L 165,369 Q 165,384 180,384 L 185,384 L 200,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,309 160,297 169,297" style="fill:rgb(0,0,0)"/>
<path d="M165,256L165,303"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,309L165,369"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="258,411 247,416 247,407" style="fill:rgb(0,0,0)"/>
<path d="M165,369 L 165,396 Q 165,411 180,411 L 238,411 L 253,411"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,384 369,389 369,380" style="fill:rgb(0,0,0)"/>
<path d="M258,411 L 335,411 Q 350,411 350,398 Q 350,384 362,384 L 375,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='xab03784d' onclick='hideorshow("xab03784d","xe274c81c")'>show</button></p>
 <div id='xe274c81c' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='xf560ed50' onclick='hideorshow("xf560ed50","xcd40fc80")'>show</button></p>
 <div id='xcd40fc80' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/raise-function.html">raise-function:</a></b>
<button id='x91ebcf32' onclick='hideorshow("x91ebcf32","x0f242130")'>show</button></p>
 <div id='x0f242130' style='display:none;' class='imgcontainer'>
 <div style="max-width:627px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 627.302 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L82,32A15 15 0 0 0 97 17A15 15 0 0 0 82 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RAISE</text>
<polygon points="120,17 109,21 109,12" style="fill:rgb(0,0,0)"/>
<path d="M97,17L114,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,32L135,32A15 15 0 0 0 150 17A15 15 0 0 0 135 2L135,2A15 15 0 0 0 120 17A15 15 0 0 0 135 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="135" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="192,55 180,59 180,50" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 158,17 Q 165,17 165,32 L 165,40 Q 165,55 176,55 L 186,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,70L285,70A15 15 0 0 0 300 55L300,55A15 15 0 0 0 285 39L207,39A15 15 0 0 0 192 55L192,55A15 15 0 0 0 207 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="336,55 324,59 324,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70A15 15 0 0 0 366 55L366,55A15 15 0 0 0 351 39A15 15 0 0 0 336 55L336,55A15 15 0 0 0 351 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="389,55 378,59 378,50" style="fill:rgb(0,0,0)"/>
<path d="M366,55L383,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,70L508,70A15 15 0 0 0 523 55L523,55A15 15 0 0 0 508 39L404,39A15 15 0 0 0 389 55L389,55A15 15 0 0 0 404 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="456" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">error-message</text>
<polygon points="564,17 553,21 553,12" style="fill:rgb(0,0,0)"/>
<path d="M523,55 L 530,55 Q 538,55 538,40 L 538,32 Q 538,17 548,17 L 558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M579,32A15 15 0 0 0 594 17A15 15 0 0 0 579 2A15 15 0 0 0 564 17A15 15 0 0 0 579 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="617,17 606,21 606,12" style="fill:rgb(0,0,0)"/>
<path d="M594,17L612,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="621" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L259,32A15 15 0 0 0 274 17A15 15 0 0 0 259 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="456,17 444,21 444,12" style="fill:rgb(0,0,0)"/>
<path d="M274,17L450,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,17L553,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,108L249,108A15 15 0 0 0 264 92A15 15 0 0 0 249 77L207,77A15 15 0 0 0 192 92A15 15 0 0 0 207 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="300,92 288,97 288,88" style="fill:rgb(0,0,0)"/>
<path d="M264,92L294,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,92 L 307,92 Q 315,92 315,77 L 315,70 Q 315,55 322,55 L 330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,145L229,145A15 15 0 0 0 244 130A15 15 0 0 0 229 115L207,115A15 15 0 0 0 192 130A15 15 0 0 0 207 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="300,130 288,135 288,126" style="fill:rgb(0,0,0)"/>
<path d="M244,130L294,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,130 L 307,130 Q 315,130 315,115 L 315,92 L 315,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,130 180,135 180,126" style="fill:rgb(0,0,0)"/>
<path d="M165,39 L 165,115 Q 165,130 176,130 L 186,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,92 180,97 180,88" style="fill:rgb(0,0,0)"/>
<path d="M165,77 L 165,85 Q 165,92 176,92 L 186,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/select-stmt.html">select-stmt:</a></b>
<button id='xbb6b589a' onclick='hideorshow("xbb6b589a","x9684ab36")'>show</button></p>
 <div id='x9684ab36' style='display:none;' class='imgcontainer'>
 <div style="max-width:669px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 669.677 1162.3">
<path d="M55,845L667,845L667,99L55,99Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="6" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="46,17 34,21 34,12" style="fill:rgb(0,0,0)"/>
<path d="M10,17L40,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M61,32L92,32A15 15 0 0 0 107 17A15 15 0 0 0 92 2L61,2A15 15 0 0 0 46 17A15 15 0 0 0 61 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="76" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M167,62L253,62A15 15 0 0 0 268 47L268,47A15 15 0 0 0 253 32L167,32A15 15 0 0 0 152 47L152,47A15 15 0 0 0 167 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="210,17 198,21 198,12" style="fill:rgb(0,0,0)"/>
<path d="M107,17L204,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M210,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M358,32L584,32L584,2L358,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="152,47 140,51 140,43" style="fill:rgb(0,0,0)"/>
<path d="M107,17 L 114,17 Q 122,17 122,32 L 122,32 Q 122,47 134,47 L 146,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="291,47 279,51 279,43" style="fill:rgb(0,0,0)"/>
<path d="M268,47L285,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,47 L 298,47 Q 306,47 306,32 L 306,32 Q 306,17 321,17 L 331,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,70A15 15 0 0 0 486 55L486,55A15 15 0 0 0 471 39A15 15 0 0 0 456 55L456,55A15 15 0 0 0 471 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="486,55 498,50 498,59" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,40 Q 599,55 584,55 L 507,55 L 492,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,55 L 350,55 Q 335,55 335,40 L 335,32 Q 335,17 340,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,83 307,79 307,88" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,68 Q 599,83 584,83 L 316,83 L 301,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,83 L 40,83 Q 25,83 25,98 L 25,113"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="25,47 20,36 29,36" style="fill:rgb(0,0,0)"/>
<path d="M10,17 L 17,17 Q 25,17 25,29 L 25,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="55,129 43,133 43,124" style="fill:rgb(0,0,0)"/>
<path d="M25,47 L 25,114 Q 25,129 37,129 L 49,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,129 115,133 115,124" style="fill:rgb(0,0,0)"/>
<path d="M55,129L121,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,144L193,144A15 15 0 0 0 208 129A15 15 0 0 0 193 114L142,114A15 15 0 0 0 127 129A15 15 0 0 0 142 144Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="250,159 238,163 238,155" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,144 Q 223,159 233,159 L 244,159"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,174L333,174A15 15 0 0 0 348 159A15 15 0 0 0 333 144L265,144A15 15 0 0 0 250 159A15 15 0 0 0 265 174Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="159" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="417,129 406,133 406,124" style="fill:rgb(0,0,0)"/>
<path d="M348,159 L 356,159 Q 363,159 363,144 L 363,144 Q 363,129 378,129 L 396,129 L 411,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,144L545,144L545,114L417,114Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M481,182A15 15 0 0 0 496 166A15 15 0 0 0 481 151A15 15 0 0 0 466 166A15 15 0 0 0 481 182Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="166" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="496,166 508,162 508,171" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,151 Q 560,166 545,166 L 517,166 L 502,166"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M466,166 L 406,166 Q 391,166 391,151 L 391,144 Q 391,129 398,129 L 406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,129 287,133 287,124" style="fill:rgb(0,0,0)"/>
<path d="M208,129L293,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M299,129L406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,212L280,212A15 15 0 0 0 295 197A15 15 0 0 0 280 182L265,182A15 15 0 0 0 250 197A15 15 0 0 0 265 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="197" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="348,197 337,201 337,192" style="fill:rgb(0,0,0)"/>
<path d="M295,197L342,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,197 L 356,197 Q 363,197 363,182 L 363,159 L 363,144"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="250,197 238,201 238,192" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,182 Q 223,197 233,197 L 244,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,287L203,287A15 15 0 0 0 218 272A15 15 0 0 0 203 257L168,257A15 15 0 0 0 153 272A15 15 0 0 0 168 287Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="186" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="290,272 279,277 279,268" style="fill:rgb(0,0,0)"/>
<path d="M218,272L284,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,287L451,287L451,257L290,257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M320,362L422,362L422,331L320,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M371,324A15 15 0 0 0 386 309A15 15 0 0 0 371 293A15 15 0 0 0 356 309A15 15 0 0 0 371 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="386,309 397,304 397,313" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 459,272 Q 466,272 466,287 L 466,294 Q 466,309 451,309 L 407,309 L 392,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M356,309 L 279,309 Q 264,309 264,294 L 264,287 Q 264,272 271,272 L 279,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="320,346 308,351 308,342" style="fill:rgb(0,0,0)"/>
<path d="M218,272 L 226,272 Q 233,272 233,287 L 233,331 Q 233,346 248,346 L 299,346 L 314,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="484,313 488,325 480,325" style="fill:rgb(0,0,0)"/>
<path d="M422,346 L 436,346 Q 451,346 466,346 L 469,346 Q 484,346 484,333 L 484,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,272 494,277 494,268" style="fill:rgb(0,0,0)"/>
<path d="M484,313 L 484,287 Q 484,272 492,272 L 499,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,272 L 496,272 Q 487,272 487,272 Q 487,272 495,272 L 502,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,197 555,185 564,185" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,176 L 560,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,235 360,230 360,239" style="fill:rgb(0,0,0)"/>
<path d="M560,197 L 560,220 Q 560,235 545,235 L 369,235 L 354,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,272 142,277 142,268" style="fill:rgb(0,0,0)"/>
<path d="M348,235 L 142,235 Q 127,235 127,250 L 127,257 Q 127,272 137,272 L 147,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,437L218,437A15 15 0 0 0 233 422A15 15 0 0 0 218 407L168,407A15 15 0 0 0 153 422A15 15 0 0 0 168 437Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="256,422 244,426 244,418" style="fill:rgb(0,0,0)"/>
<path d="M233,422L250,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,437L305,437L305,407L256,407Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="517,324 513,312 521,312" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 502,272 Q 517,272 517,287 L 517,303 L 517,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,384 382,380 382,389" style="fill:rgb(0,0,0)"/>
<path d="M517,324 L 517,369 Q 517,384 502,384 L 391,384 L 376,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,422 142,426 142,418" style="fill:rgb(0,0,0)"/>
<path d="M371,384 L 142,384 Q 127,384 127,399 L 127,407 Q 127,422 137,422 L 147,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,324 122,312 131,312" style="fill:rgb(0,0,0)"/>
<path d="M127,257L127,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,324L127,407"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,535L212,535A15 15 0 0 0 227 520A15 15 0 0 0 212 505L168,505A15 15 0 0 0 153 520A15 15 0 0 0 168 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="250,520 238,525 238,516" style="fill:rgb(0,0,0)"/>
<path d="M227,520L244,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,535L269,535A15 15 0 0 0 284 520A15 15 0 0 0 269 505L265,505A15 15 0 0 0 250 520A15 15 0 0 0 265 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="320,520 309,525 309,516" style="fill:rgb(0,0,0)"/>
<path d="M284,520L314,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,535L369,535L369,505L320,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="452,520 441,525 441,516" style="fill:rgb(0,0,0)"/>
<path d="M369,520L446,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,535L520,535A15 15 0 0 0 535 520A15 15 0 0 0 520 505L467,505A15 15 0 0 0 452 520A15 15 0 0 0 467 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="558,520 546,525 546,516" style="fill:rgb(0,0,0)"/>
<path d="M535,520L552,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,535L607,535L607,505L558,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M345,573A15 15 0 0 0 360 558A15 15 0 0 0 345 543A15 15 0 0 0 330 558A15 15 0 0 0 345 573Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="558" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="360,558 371,554 371,562" style="fill:rgb(0,0,0)"/>
<path d="M369,520 L 377,520 Q 384,520 384,535 L 384,543 Q 384,558 375,558 L 366,558"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,558 L 309,558 Q 294,558 294,543 L 294,535 Q 294,520 301,520 L 309,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="514,551 503,555 503,546" style="fill:rgb(0,0,0)"/>
<path d="M411,520 L 418,520 Q 426,520 426,535 L 426,536 Q 426,551 441,551 L 493,551 L 508,551"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M514,551 L 607,551 Q 622,551 622,536 L 622,535 Q 622,520 630,520 L 637,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,490 256,494 256,486" style="fill:rgb(0,0,0)"/>
<path d="M127,460 L 127,475 Q 127,490 142,490 L 246,490 L 261,490"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,520 399,525 399,516" style="fill:rgb(0,0,0)"/>
<path d="M267,490 L 369,490 Q 384,490 384,505 L 384,505 Q 384,520 395,520 L 405,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,460 244,455 244,464" style="fill:rgb(0,0,0)"/>
<path d="M305,422 L 313,422 Q 320,422 320,437 L 320,445 Q 320,460 305,460 L 254,460 L 239,460"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,520 142,525 142,516" style="fill:rgb(0,0,0)"/>
<path d="M233,460 L 142,460 Q 127,460 127,475 L 127,505 Q 127,520 137,520 L 147,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,447 122,435 131,435" style="fill:rgb(0,0,0)"/>
<path d="M127,407L127,441"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,447L127,505"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,649L232,649A15 15 0 0 0 247 634A15 15 0 0 0 232 619L168,619A15 15 0 0 0 153 634A15 15 0 0 0 168 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="200" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="283,634 271,638 271,629" style="fill:rgb(0,0,0)"/>
<path d="M247,634L277,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,649L395,649A15 15 0 0 0 410 634A15 15 0 0 0 395 619L298,619A15 15 0 0 0 283 634A15 15 0 0 0 298 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="433,634 422,638 422,629" style="fill:rgb(0,0,0)"/>
<path d="M410,634L427,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,649L452,649A15 15 0 0 0 467 634A15 15 0 0 0 452 619L448,619A15 15 0 0 0 433 634A15 15 0 0 0 448 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="450" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="490,634 479,638 479,629" style="fill:rgb(0,0,0)"/>
<path d="M467,634L485,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,649L609,649L609,619L490,619Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="550" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M446,687A15 15 0 0 0 461 671A15 15 0 0 0 446 656A15 15 0 0 0 431 671A15 15 0 0 0 446 687Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="671" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="461,671 472,667 472,676" style="fill:rgb(0,0,0)"/>
<path d="M609,634 L 616,634 Q 624,634 624,649 L 624,656 Q 624,671 609,671 L 482,671 L 467,671"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,671 L 271,671 Q 256,671 256,656 L 256,649 Q 256,634 264,634 L 271,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="624,692 619,680 628,680" style="fill:rgb(0,0,0)"/>
<path d="M624,656L624,686"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,558 648,547 656,547" style="fill:rgb(0,0,0)"/>
<path d="M607,520 L 637,520 Q 652,520 652,535 L 652,537 L 652,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,596 382,592 382,600" style="fill:rgb(0,0,0)"/>
<path d="M652,558 L 652,581 Q 652,596 637,596 L 391,596 L 376,596"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,634 142,638 142,629" style="fill:rgb(0,0,0)"/>
<path d="M371,596 L 142,596 Q 127,596 127,611 L 127,619 Q 127,634 137,634 L 147,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,558 122,547 131,547" style="fill:rgb(0,0,0)"/>
<path d="M127,505L127,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,709 359,714 359,705" style="fill:rgb(0,0,0)"/>
<path d="M127,558 L 127,694 Q 127,709 142,709 L 350,709 L 365,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,709 597,714 597,705" style="fill:rgb(0,0,0)"/>
<path d="M371,709L603,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,709 L 616,709 Q 624,709 624,717 L 624,724"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,800L194,800A15 15 0 0 0 209 785A15 15 0 0 0 194 770L142,770A15 15 0 0 0 127 785A15 15 0 0 0 142 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="245,785 234,789 234,781" style="fill:rgb(0,0,0)"/>
<path d="M209,785L239,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,800A15 15 0 0 0 275 785A15 15 0 0 0 260 770A15 15 0 0 0 245 785A15 15 0 0 0 260 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="311,785 300,789 300,781" style="fill:rgb(0,0,0)"/>
<path d="M275,785L306,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,800L361,800L361,770L311,770Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="397,785 385,789 385,781" style="fill:rgb(0,0,0)"/>
<path d="M361,785L391,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,800A15 15 0 0 0 427 785A15 15 0 0 0 412 770A15 15 0 0 0 397 785A15 15 0 0 0 412 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="412" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="609,785 597,789 597,781" style="fill:rgb(0,0,0)"/>
<path d="M427,785L603,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,785 L 616,785 Q 624,785 624,792 L 624,800"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,762A15 15 0 0 0 351 747A15 15 0 0 0 336 732A15 15 0 0 0 321 747A15 15 0 0 0 336 762Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="747" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M336,838A15 15 0 0 0 351 823A15 15 0 0 0 336 808A15 15 0 0 0 321 823A15 15 0 0 0 336 838Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="823" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="351,747 363,743 363,751" style="fill:rgb(0,0,0)"/>
<path d="M361,785 L 368,785 Q 376,785 376,770 L 376,762 Q 376,747 366,747 L 357,747"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,747 L 300,747 Q 285,747 285,762 L 285,770 Q 285,785 292,785 L 300,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,823 363,818 363,827" style="fill:rgb(0,0,0)"/>
<path d="M427,785 L 434,785 Q 442,785 442,800 L 442,808 Q 442,823 427,823 L 372,823 L 357,823"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,823 L 234,823 Q 219,823 219,808 L 219,800 Q 219,785 226,785 L 234,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,785 115,789 115,781" style="fill:rgb(0,0,0)"/>
<path d="M55,129 L 62,129 Q 70,129 70,144 L 70,770 Q 70,785 85,785 L 106,785 L 121,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,891L424,891L424,860L248,860Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="876" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="424,876 436,871 436,880" style="fill:rgb(0,0,0)"/>
<path d="M624,692 L 624,861 Q 624,876 609,876 L 445,876 L 430,876"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="6,197 10,208 2,208" style="fill:rgb(0,0,0)"/>
<path d="M248,876 L 21,876 Q 6,876 6,861 L 6,217 L 6,202"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M6,197 L 6,144 Q 6,129 21,129 L 40,129 L 55,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="667" y="275" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" transform="rotate(-90 667,285)" dominant-baseline="central">select-core</text>
<path d="M168,966L213,966A15 15 0 0 0 228 951A15 15 0 0 0 213 936L168,936A15 15 0 0 0 153 951A15 15 0 0 0 168 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="251,951 239,956 239,947" style="fill:rgb(0,0,0)"/>
<path d="M228,951L245,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,966L270,966A15 15 0 0 0 285 951A15 15 0 0 0 270 936L266,936A15 15 0 0 0 251 951A15 15 0 0 0 266 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M168,1072L202,1072A15 15 0 0 0 217 1057A15 15 0 0 0 202 1042L168,1042A15 15 0 0 0 153 1057A15 15 0 0 0 168 1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="240,1057 228,1061 228,1053" style="fill:rgb(0,0,0)"/>
<path d="M217,1057L234,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,1072L289,1072L289,1042L240,1042Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="330,951 319,956 319,947" style="fill:rgb(0,0,0)"/>
<path d="M285,951L324,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,966L460,966L460,936L330,936Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M395,1004A15 15 0 0 0 410 989A15 15 0 0 0 395 974A15 15 0 0 0 380 989A15 15 0 0 0 395 1004Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="989" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="410,989 422,985 422,993" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 468,951 Q 475,951 475,966 L 475,974 Q 475,989 460,989 L 431,989 L 416,989"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,989 L 322,989 Q 307,989 307,974 L 307,966 Q 307,951 313,951 L 319,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,913 348,909 348,918" style="fill:rgb(0,0,0)"/>
<path d="M624,860 L 624,898 Q 624,913 609,913 L 357,913 L 342,913"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,951 142,956 142,947" style="fill:rgb(0,0,0)"/>
<path d="M336,913 L 142,913 Q 127,913 127,928 L 127,936 Q 127,951 137,951 L 147,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,981 492,970 500,970" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 481,951 Q 496,951 496,963 L 496,976"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,1023 318,1019 318,1027" style="fill:rgb(0,0,0)"/>
<path d="M496,981 L 496,1008 Q 496,1023 481,1023 L 327,1023 L 312,1023"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,1057 142,1061 142,1053" style="fill:rgb(0,0,0)"/>
<path d="M307,1023 L 142,1023 Q 127,1023 127,1038 L 127,1042 Q 127,1057 137,1057 L 147,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,989 122,978 131,978" style="fill:rgb(0,0,0)"/>
<path d="M127,936L127,983"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,989L127,1042"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1102L415,1102A15 15 0 0 0 430 1087A15 15 0 0 0 415 1072L363,1072A15 15 0 0 0 348 1087A15 15 0 0 0 363 1102Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="389" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="453,1087 441,1092 441,1083" style="fill:rgb(0,0,0)"/>
<path d="M430,1087L447,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,1102L502,1102L502,1072L453,1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="525,1087 513,1092 513,1083" style="fill:rgb(0,0,0)"/>
<path d="M502,1087L519,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1140A15 15 0 0 0 378 1125A15 15 0 0 0 363 1110A15 15 0 0 0 348 1125A15 15 0 0 0 363 1140Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="1125" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="401,1125 390,1129 390,1121" style="fill:rgb(0,0,0)"/>
<path d="M378,1125L396,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,1140L451,1140L451,1110L401,1110Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="1125" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="312,1057 301,1061 301,1053" style="fill:rgb(0,0,0)"/>
<path d="M289,1057L306,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1125 337,1129 337,1121" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1110 Q 327,1125 335,1125 L 342,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1087 337,1092 337,1083" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1072 Q 327,1087 335,1087 L 342,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1057 513,1061 513,1053" style="fill:rgb(0,0,0)"/>
<path d="M312,1057L519,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="620,1155 609,1160 609,1151" style="fill:rgb(0,0,0)"/>
<path d="M525,1057 L 546,1057 Q 561,1057 561,1072 L 561,1140 Q 561,1155 576,1155 L 599,1155 L 614,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="624" cy="1155" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1087 L 546,1087 Q 561,1087 561,1095 L 561,1102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1125 513,1129 513,1121" style="fill:rgb(0,0,0)"/>
<path d="M451,1125L519,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1125 L 546,1125 Q 561,1125 561,1133 L 561,1140"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1155 513,1160 513,1151" style="fill:rgb(0,0,0)"/>
<path d="M127,1042 L 127,1140 Q 127,1155 142,1155 L 504,1155 L 519,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1155L597,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/common-table-expression.html">common-table-expression:</a></b>
<button id='x73e10858' onclick='hideorshow("x73e10858","x6311dbc9")'>show</button></p>
 <div id='x6311dbc9' style='display:none;' class='imgcontainer'>
 <div style="max-width:638px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 638.525 167.4">
<circle cx="5" cy="29" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,29 20,33 20,24" style="fill:rgb(0,0,0)"/>
<path d="M9,29L26,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,44L122,44A15 15 0 0 0 137 29A15 15 0 0 0 122 14L47,14A15 15 0 0 0 32 29A15 15 0 0 0 47 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="160,29 149,33 149,24" style="fill:rgb(0,0,0)"/>
<path d="M137,29L155,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="196,29 185,33 185,24" style="fill:rgb(0,0,0)"/>
<path d="M160,29L191,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,44A15 15 0 0 0 227 29A15 15 0 0 0 211 14A15 15 0 0 0 196 29A15 15 0 0 0 211 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="250,29 238,33 238,24" style="fill:rgb(0,0,0)"/>
<path d="M227,29L244,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="286,29 274,33 274,24" style="fill:rgb(0,0,0)"/>
<path d="M250,29L280,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,44L395,44A15 15 0 0 0 410 29A15 15 0 0 0 395 14L301,14A15 15 0 0 0 286 29A15 15 0 0 0 301 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="446,29 434,33 434,24" style="fill:rgb(0,0,0)"/>
<path d="M410,29L440,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,44A15 15 0 0 0 476 29A15 15 0 0 0 461 14A15 15 0 0 0 446 29A15 15 0 0 0 461 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,29 499,33 499,24" style="fill:rgb(0,0,0)"/>
<path d="M476,29L505,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,165L51,165A15 15 0 0 0 66 150A15 15 0 0 0 51 135L47,135A15 15 0 0 0 32 150A15 15 0 0 0 47 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="49" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<path d="M127,135L147,135A15 15 0 0 0 162 119A15 15 0 0 0 147 104L127,104A15 15 0 0 0 112 119A15 15 0 0 0 127 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<path d="M219,135L337,135A15 15 0 0 0 352 119A15 15 0 0 0 337 104L219,104A15 15 0 0 0 204 119A15 15 0 0 0 219 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<path d="M162,119L204,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,165A15 15 0 0 0 425 150A15 15 0 0 0 410 135A15 15 0 0 0 395 150A15 15 0 0 0 410 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="410" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="448,150 437,154 437,145" style="fill:rgb(0,0,0)"/>
<path d="M425,150L442,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,165L552,165L552,135L448,135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="500" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="575,150 564,154 564,145" style="fill:rgb(0,0,0)"/>
<path d="M552,150L570,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M591,165A15 15 0 0 0 606 150A15 15 0 0 0 591 135A15 15 0 0 0 575 150A15 15 0 0 0 591 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="629,150 617,154 617,145" style="fill:rgb(0,0,0)"/>
<path d="M606,150L623,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="632" cy="150" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,82A15 15 0 0 0 363 66A15 15 0 0 0 348 51A15 15 0 0 0 333 66A15 15 0 0 0 348 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="363,66 374,62 374,71" style="fill:rgb(0,0,0)"/>
<path d="M410,29 L 417,29 Q 425,29 425,44 L 425,51 Q 425,66 410,66 L 384,66 L 369,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M333,66 L 278,66 Q 263,66 263,51 L 263,44 Q 263,29 270,29 L 278,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,93 78,89 78,97" style="fill:rgb(0,0,0)"/>
<path d="M511,29 L 516,29 Q 522,29 522,44 L 522,78 Q 522,93 507,93 L 87,93 L 72,93"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,150 20,154 20,145" style="fill:rgb(0,0,0)"/>
<path d="M66,93 L 30,93 Q 15,93 15,108 L 15,135 Q 15,150 20,150 L 26,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="85,150 73,154 73,145" style="fill:rgb(0,0,0)"/>
<path d="M66,150L79,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="112,119 101,124 101,115" style="fill:rgb(0,0,0)"/>
<path d="M85,150 L 89,150 Q 92,150 92,135 L 92,134 Q 92,119 99,119 L 106,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="204,119 192,124 192,115" style="fill:rgb(0,0,0)"/>
<path d="M66,150 L 147,150 Q 162,150 170,150 Q 177,150 177,135 L 177,134 Q 177,119 188,119 L 198,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,150 383,154 383,145" style="fill:rgb(0,0,0)"/>
<path d="M352,119 L 360,119 Q 367,119 367,134 L 367,135 Q 367,150 378,150 L 389,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150L395,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,6 336,10 336,2" style="fill:rgb(0,0,0)"/>
<path d="M160,29 L 168,29 Q 175,29 175,17 Q 175,6 190,6 L 327,6 L 342,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,6 L 473,6 Q 488,6 488,17 Q 488,29 495,29 L 503,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/compound-operator.html">compound-operator:</a></b>
<button id='x51a27004' onclick='hideorshow("x51a27004","xaa710ce9")'>show</button></p>
 <div id='xaa710ce9' style='display:none;' class='imgcontainer'>
 <div style="max-width:293px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 293.842 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L127,32A15 15 0 0 0 142 17A15 15 0 0 0 127 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,70L127,70A15 15 0 0 0 142 55L142,55A15 15 0 0 0 127 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,108L168,108A15 15 0 0 0 183 92A15 15 0 0 0 168 77L83,77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M83,145L135,145A15 15 0 0 0 150 130A15 15 0 0 0 135 115L83,115A15 15 0 0 0 68 130A15 15 0 0 0 83 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M142,55L159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70L195,70A15 15 0 0 0 210 55L210,55A15 15 0 0 0 195 39L180,39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="233,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M210,55L227,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,17 272,21 272,12" style="fill:rgb(0,0,0)"/>
<path d="M233,55 L 240,55 Q 248,55 248,40 L 248,32 Q 248,17 263,17 L 263,17 L 278,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="288" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M47,39 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,92 221,97 221,88" style="fill:rgb(0,0,0)"/>
<path d="M183,92L227,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,92 L 240,92 Q 248,92 248,77 L 248,54 L 248,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,130 56,135 56,126" style="fill:rgb(0,0,0)"/>
<path d="M47,77 L 47,115 Q 47,130 55,130 L 62,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,130 221,135 221,126" style="fill:rgb(0,0,0)"/>
<path d="M150,130L227,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,130 L 240,130 Q 248,130 248,115 L 248,92 L 248,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-clause.html">join-clause:</a></b>
<button id='x002fa5ea' onclick='hideorshow("x002fa5ea","x22b50d0d")'>show</button></p>
 <div id='x22b50d0d' style='display:none;' class='imgcontainer'>
 <div style="max-width:793px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 793.282 84.24">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L193,32L193,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="259,47 247,51 247,43" style="fill:rgb(0,0,0)"/>
<path d="M193,17 L 200,17 Q 208,17 208,32 L 208,32 Q 208,47 223,47 L 238,47 L 253,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,62L380,62L380,32L259,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-operator</text>
<polygon points="403,47 391,51 391,43" style="fill:rgb(0,0,0)"/>
<path d="M380,47L397,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,62L564,62L564,32L403,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="587,47 575,51 575,43" style="fill:rgb(0,0,0)"/>
<path d="M564,47L581,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M587,62L721,62L721,32L587,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="654" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-constraint</text>
<polygon points="783,17 772,21 772,12" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 742,47 Q 757,47 757,32 L 757,32 Q 757,17 767,17 L 778,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="787" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M193,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,17L776,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,77 495,73 495,82" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 728,47 Q 736,47 736,62 L 736,62 Q 736,77 721,77 L 504,77 L 489,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,77 L 247,77 Q 232,77 232,62 L 232,62 Q 232,47 246,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/join-constraint.html">join-constraint:</a></b>
<button id='x1d7cfc63' onclick='hideorshow("x1d7cfc63","xee87f645")'>show</button></p>
 <div id='xee87f645' style='display:none;' class='imgcontainer'>
 <div style="max-width:483px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 483.336 126.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L104,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 104 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="143,55 131,59 131,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L137,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,70A15 15 0 0 0 173 55L173,55A15 15 0 0 0 158 39A15 15 0 0 0 143 55L143,55A15 15 0 0 0 158 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="209,55 197,59 197,50" style="fill:rgb(0,0,0)"/>
<path d="M173,55L203,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M224,70L318,70A15 15 0 0 0 333 55L333,55A15 15 0 0 0 318 39L224,39A15 15 0 0 0 209 55L209,55A15 15 0 0 0 224 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="369,55 358,59 358,50" style="fill:rgb(0,0,0)"/>
<path d="M333,55L363,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,70A15 15 0 0 0 399 55L399,55A15 15 0 0 0 384 39A15 15 0 0 0 369 55L369,55A15 15 0 0 0 384 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="422,55 411,59 411,50" style="fill:rgb(0,0,0)"/>
<path d="M399,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="473,17 462,21 462,12" style="fill:rgb(0,0,0)"/>
<path d="M422,55 L 430,55 Q 437,55 437,40 L 437,32 Q 437,17 452,17 L 453,17 L 468,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="477" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,108A15 15 0 0 0 286 92A15 15 0 0 0 271 77A15 15 0 0 0 256 92A15 15 0 0 0 271 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="286,92 298,88 298,97" style="fill:rgb(0,0,0)"/>
<path d="M333,55 L 341,55 Q 348,55 348,70 L 348,77 Q 348,92 333,92 L 307,92 L 292,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,92 L 197,92 Q 182,92 182,77 L 182,70 Q 182,55 190,55 L 197,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L74,32A15 15 0 0 0 90 17A15 15 0 0 0 74 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="113,17 101,21 101,12" style="fill:rgb(0,0,0)"/>
<path d="M90,17L107,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M113,32L162,32L162,2L113,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="422,17 411,21 411,12" style="fill:rgb(0,0,0)"/>
<path d="M162,17L417,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,17L462,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="209,120 197,124 197,115" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,105 Q 24,120 39,120 L 188,120 L 203,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,120 L 422,120 Q 437,120 437,105 L 437,54 L 437,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-operator.html">join-operator:</a></b>
<button id='x9b7f43ba' onclick='hideorshow("x9b7f43ba","xdedfadcc")'>show</button></p>
 <div id='xdedfadcc' style='display:none;' class='imgcontainer'>
 <div style="max-width:620px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 620.333 255.312">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,71 39,76 39,67" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,56 Q 24,71 34,71 L 45,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,86L133,86A15 15 0 0 0 148 71A15 15 0 0 0 133 56L66,56A15 15 0 0 0 50 71A15 15 0 0 0 66 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="99" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NATURAL</text>
<polygon points="189,41 178,45 178,37" style="fill:rgb(0,0,0)"/>
<path d="M148,71 L 155,71 Q 163,71 163,56 L 163,56 Q 163,41 173,41 L 184,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,71 219,76 219,67" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,56 Q 204,71 215,71 L 225,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,86L273,86A15 15 0 0 0 288 71A15 15 0 0 0 273 56L246,56A15 15 0 0 0 231 71A15 15 0 0 0 246 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LEFT</text>
<polygon points="378,71 366,76 366,67" style="fill:rgb(0,0,0)"/>
<path d="M288,71L372,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,86L437,86A15 15 0 0 0 452 71A15 15 0 0 0 437 56L393,56A15 15 0 0 0 378 71A15 15 0 0 0 393 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OUTER</text>
<polygon points="475,71 463,76 463,67" style="fill:rgb(0,0,0)"/>
<path d="M452,71L469,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="516,41 505,45 505,37" style="fill:rgb(0,0,0)"/>
<path d="M475,71 L 482,71 Q 490,71 490,56 L 490,56 Q 490,41 500,41 L 511,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,56L554,56A15 15 0 0 0 569 41A15 15 0 0 0 554 26L532,26A15 15 0 0 0 516 41A15 15 0 0 0 532 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="543" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">JOIN</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M569,41 L 576,41 Q 584,41 584,29 Q 584,17 594,17 L 605,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="614" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,32A15 15 0 0 0 325 17A15 15 0 0 0 310 2A15 15 0 0 0 295 17A15 15 0 0 0 310 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="295,17 283,21 283,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L289,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M325,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="99,41 88,45 88,37" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,29 Q 24,41 39,41 L 78,41 L 93,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M99,41L178,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,41L505,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,41 366,45 366,37" style="fill:rgb(0,0,0)"/>
<path d="M336,71 L 344,71 Q 351,71 351,56 L 351,56 Q 351,41 362,41 L 372,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,109 219,113 219,105" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,94 Q 204,109 215,109 L 225,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,124L284,124A15 15 0 0 0 299 109A15 15 0 0 0 284 94L246,94A15 15 0 0 0 231 109A15 15 0 0 0 246 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RIGHT</text>
<polygon points="341,71 329,76 329,67" style="fill:rgb(0,0,0)"/>
<path d="M299,109 L 307,109 Q 314,109 314,94 L 314,86 Q 314,71 324,71 L 335,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,147 219,151 219,142" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,132 Q 204,147 215,147 L 225,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,162L274,162A15 15 0 0 0 289 147A15 15 0 0 0 274 132L246,132A15 15 0 0 0 231 147A15 15 0 0 0 246 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FULL</text>
<path d="M289,147 L 302,147 Q 314,147 314,132 L 314,109 L 314,94"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,192 219,196 219,188" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,177 Q 204,192 215,192 L 225,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,207L287,207A15 15 0 0 0 302 192A15 15 0 0 0 287 177L246,177A15 15 0 0 0 231 192A15 15 0 0 0 246 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="192" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INNER</text>
<polygon points="475,192 463,196 463,188" style="fill:rgb(0,0,0)"/>
<path d="M302,192L469,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,192 L 482,192 Q 490,192 490,185 L 490,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,238 219,242 219,233" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,223 Q 24,238 39,238 L 210,238 L 225,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,253L287,253A15 15 0 0 0 303 238A15 15 0 0 0 287 222L246,222A15 15 0 0 0 231 238A15 15 0 0 0 246 253Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="238" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CROSS</text>
<polygon points="475,238 463,242 463,233" style="fill:rgb(0,0,0)"/>
<path d="M303,238L469,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,238 L 482,238 Q 490,238 490,223 L 490,71 L 490,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='xac712b32' onclick='hideorshow("xac712b32","x48947f3f")'>show</button></p>
 <div id='x48947f3f' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/result-column.html">result-column:</a></b>
<button id='xefa2d93b' onclick='hideorshow("xefa2d93b","x4dafeebc")'>show</button></p>
 <div id='x4dafeebc' style='display:none;' class='imgcontainer'>
 <div style="max-width:398px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 398.054 163.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L94,32L94,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="136,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M94,17 L 102,17 Q 109,17 109,32 L 109,40 Q 109,55 119,55 L 130,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M151,70L155,70A15 15 0 0 0 170 55L170,55A15 15 0 0 0 155 39L151,39A15 15 0 0 0 136 55L136,55A15 15 0 0 0 151 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="206,55 194,59 194,50" style="fill:rgb(0,0,0)"/>
<path d="M170,55L200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,70L309,70A15 15 0 0 0 324 55L324,55A15 15 0 0 0 309 39L221,39A15 15 0 0 0 206 55L206,55A15 15 0 0 0 221 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="347,55 335,59 335,50" style="fill:rgb(0,0,0)"/>
<path d="M324,55L341,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,17 377,21 377,12" style="fill:rgb(0,0,0)"/>
<path d="M347,55 L 354,55 Q 362,55 362,40 L 362,32 Q 362,17 372,17 L 382,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="392" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,85 141,89 141,81" style="fill:rgb(0,0,0)"/>
<path d="M109,39 L 109,70 Q 109,85 124,85 L 132,85 L 147,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,85 L 170,85 Q 185,85 185,70 L 185,70 Q 185,55 192,55 L 200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="241,17 230,21 230,12" style="fill:rgb(0,0,0)"/>
<path d="M94,17L235,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M241,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,108 39,112 39,103" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,93 Q 24,108 34,108 L 45,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,123A15 15 0 0 0 81 108A15 15 0 0 0 66 92A15 15 0 0 0 50 108A15 15 0 0 0 66 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="108" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,108 335,112 335,103" style="fill:rgb(0,0,0)"/>
<path d="M81,108L341,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,108 L 354,108 Q 362,108 362,93 L 362,54 L 362,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,145 39,150 39,141" style="fill:rgb(0,0,0)"/>
<path d="M24,92 L 24,130 Q 24,145 34,145 L 45,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,160L141,160A15 15 0 0 0 156 145A15 15 0 0 0 141 130L66,130A15 15 0 0 0 50 145A15 15 0 0 0 66 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="145" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="179,145 167,150 167,141" style="fill:rgb(0,0,0)"/>
<path d="M156,145L173,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M194,160A15 15 0 0 0 209 145A15 15 0 0 0 194 130A15 15 0 0 0 179 145A15 15 0 0 0 194 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="232,145 221,150 221,141" style="fill:rgb(0,0,0)"/>
<path d="M209,145L226,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,160A15 15 0 0 0 262 145A15 15 0 0 0 247 130A15 15 0 0 0 232 145A15 15 0 0 0 247 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,145 335,150 335,141" style="fill:rgb(0,0,0)"/>
<path d="M262,145L341,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,145 L 354,145 Q 362,145 362,130 L 362,107 L 362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/table-or-subquery.html">table-or-subquery:</a></b>
<button id='x597e83ef' onclick='hideorshow("x597e83ef","x4052242d")'>show</button></p>
 <div id='x4052242d' style='display:none;' class='imgcontainer'>
 <div style="max-width:720px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 720.778 457.704">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,74 39,78 39,70" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,59 Q 24,74 34,74 L 45,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,89L162,89A15 15 0 0 0 177 74L177,74A15 15 0 0 0 162 59L66,59A15 15 0 0 0 50 74L50,74A15 15 0 0 0 66 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="194,74 183,78 183,70" style="fill:rgb(0,0,0)"/>
<path d="M177,74L189,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,89A15 15 0 0 0 225 74L225,74A15 15 0 0 0 209 59A15 15 0 0 0 194 74L194,74A15 15 0 0 0 209 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="266,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M225,74 L 232,74 Q 240,74 240,59 L 240,51 Q 240,36 250,36 L 260,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,51L356,51A15 15 0 0 0 371 36A15 15 0 0 0 356 21L281,21A15 15 0 0 0 266 36A15 15 0 0 0 281 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="407,36 396,41 396,32" style="fill:rgb(0,0,0)"/>
<path d="M371,36L402,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,51L427,51A15 15 0 0 0 442 36A15 15 0 0 0 427 21L423,21A15 15 0 0 0 407 36A15 15 0 0 0 423 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="478,36 466,41 466,32" style="fill:rgb(0,0,0)"/>
<path d="M442,36L472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,51L561,51A15 15 0 0 0 577 36A15 15 0 0 0 561 21L493,21A15 15 0 0 0 478 36A15 15 0 0 0 493 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="527" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<path d="M9,36L255,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="422,6 411,10 411,2" style="fill:rgb(0,0,0)"/>
<path d="M371,36 L 379,36 Q 386,36 386,21 L 386,21 Q 386,6 401,6 L 402,6 L 417,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 442,6 Q 457,6 457,21 L 457,21 Q 457,36 464,36 L 472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 577,6 Q 592,6 592,21 L 592,21 Q 592,36 599,36 L 607,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,127L388,127A15 15 0 0 0 403 112A15 15 0 0 0 388 97L323,97A15 15 0 0 0 308 112A15 15 0 0 0 323 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="426,112 415,116 415,108" style="fill:rgb(0,0,0)"/>
<path d="M403,112L420,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,127L445,127A15 15 0 0 0 460 112A15 15 0 0 0 445 97L441,97A15 15 0 0 0 426 112A15 15 0 0 0 441 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="443" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="483,112 472,116 472,108" style="fill:rgb(0,0,0)"/>
<path d="M460,112L478,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,127L577,127A15 15 0 0 0 592 112A15 15 0 0 0 577 97L499,97A15 15 0 0 0 483 112A15 15 0 0 0 499 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="538" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M323,165L343,165A15 15 0 0 0 359 150A15 15 0 0 0 343 135L323,135A15 15 0 0 0 308 150A15 15 0 0 0 323 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="382,150 370,154 370,145" style="fill:rgb(0,0,0)"/>
<path d="M359,150L376,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,165L461,165A15 15 0 0 0 476 150A15 15 0 0 0 461 135L397,135A15 15 0 0 0 382 150A15 15 0 0 0 397 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="527,74 539,70 539,78" style="fill:rgb(0,0,0)"/>
<path d="M577,36 L 607,36 Q 622,36 622,51 L 622,59 Q 622,74 607,74 L 548,74 L 533,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,150 297,154 297,145" style="fill:rgb(0,0,0)"/>
<path d="M527,74 L 297,74 Q 282,74 282,89 L 282,135 Q 282,150 292,150 L 302,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,112 297,116 297,108" style="fill:rgb(0,0,0)"/>
<path d="M282,97 L 282,104 Q 282,112 292,112 L 302,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="266,213 255,217 255,209" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,198 Q 24,213 39,213 L 245,213 L 260,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,228L431,228A15 15 0 0 0 446 213A15 15 0 0 0 431 198L281,198A15 15 0 0 0 266 213A15 15 0 0 0 281 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function-name</text>
<polygon points="463,213 452,217 452,209" style="fill:rgb(0,0,0)"/>
<path d="M446,213L457,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,228A15 15 0 0 0 493 213A15 15 0 0 0 478 198A15 15 0 0 0 463 213A15 15 0 0 0 478 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="529,213 518,217 518,209" style="fill:rgb(0,0,0)"/>
<path d="M493,213L524,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M529,228L579,228L579,198L529,198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="615,213 603,217 603,209" style="fill:rgb(0,0,0)"/>
<path d="M579,213L609,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M630,228A15 15 0 0 0 645 213A15 15 0 0 0 630 198A15 15 0 0 0 615 213A15 15 0 0 0 630 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="630" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="675,187 679,198 671,198" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 660,213 Q 675,213 675,203 L 675,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M554,190A15 15 0 0 0 569 175A15 15 0 0 0 554 160A15 15 0 0 0 539 175A15 15 0 0 0 554 190Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="175" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="569,175 581,171 581,180" style="fill:rgb(0,0,0)"/>
<path d="M579,213 L 586,213 Q 594,213 594,198 L 594,190 Q 594,175 584,175 L 575,175"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,175 L 518,175 Q 503,175 503,190 L 503,198 Q 503,213 510,213 L 518,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,74 L 232,74 Q 240,74 240,89 L 240,198 Q 240,213 247,213 L 255,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,112 648,116 648,108" style="fill:rgb(0,0,0)"/>
<path d="M592,112L654,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,112 L 667,112 Q 675,112 675,104 L 675,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,150 648,154 648,145" style="fill:rgb(0,0,0)"/>
<path d="M476,150L654,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,150 L 667,150 Q 675,150 675,142 L 675,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M577,36L690,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,304L411,304A15 15 0 0 0 426 289A15 15 0 0 0 411 274L407,274A15 15 0 0 0 392 289A15 15 0 0 0 407 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="498,289 487,293 487,284" style="fill:rgb(0,0,0)"/>
<path d="M426,289L492,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M513,304L582,304A15 15 0 0 0 597 289A15 15 0 0 0 582 274L513,274A15 15 0 0 0 498 289A15 15 0 0 0 513 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="548" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<polygon points="660,289 648,293 648,284" style="fill:rgb(0,0,0)"/>
<path d="M597,289L654,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,289 L 667,289 Q 675,289 675,281 L 675,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="548,251 559,247 559,255" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 652,213 Q 660,213 660,228 L 660,236 Q 660,251 645,251 L 568,251 L 553,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M548,251 L 370,251 Q 355,251 355,266 L 355,274 Q 355,289 370,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,251 L 464,251 Q 457,251 457,266 L 457,274 Q 457,289 464,289 L 472,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,327 39,331 39,322" style="fill:rgb(0,0,0)"/>
<path d="M24,198 L 24,312 Q 24,327 34,327 L 45,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,342A15 15 0 0 0 81 327A15 15 0 0 0 66 311A15 15 0 0 0 50 327A15 15 0 0 0 66 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,327 92,331 92,322" style="fill:rgb(0,0,0)"/>
<path d="M81,327L98,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,342L208,342L208,311L104,311Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="327" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="231,327 219,331 219,322" style="fill:rgb(0,0,0)"/>
<path d="M208,327L225,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,342A15 15 0 0 0 261 327A15 15 0 0 0 246 311A15 15 0 0 0 231 327A15 15 0 0 0 246 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M261,327 L 269,327 Q 276,327 276,312 L 276,304 Q 276,289 291,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,327 648,331 648,322" style="fill:rgb(0,0,0)"/>
<path d="M261,327L654,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,327 L 667,327 Q 675,327 675,319 L 675,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,327 L 432,327 Q 439,327 439,312 L 439,304 Q 439,289 447,289 L 454,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,364 39,369 39,360" style="fill:rgb(0,0,0)"/>
<path d="M24,311 L 24,349 Q 24,364 34,364 L 45,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,379A15 15 0 0 0 81 364A15 15 0 0 0 65 349A15 15 0 0 0 50 364A15 15 0 0 0 65 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="135,364 123,369 123,360" style="fill:rgb(0,0,0)"/>
<path d="M81,364L129,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,379L296,379L296,349L135,349Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="364" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="350,364 338,369 338,360" style="fill:rgb(0,0,0)"/>
<path d="M296,364L344,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,379A15 15 0 0 0 380 364A15 15 0 0 0 365 349A15 15 0 0 0 350 364A15 15 0 0 0 365 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="660,364 648,369 648,360" style="fill:rgb(0,0,0)"/>
<path d="M380,364L654,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="711,36 699,41 699,32" style="fill:rgb(0,0,0)"/>
<path d="M660,364 L 667,364 Q 675,364 675,349 L 675,51 Q 675,36 690,36 L 690,36 L 705,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="715" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,417A15 15 0 0 0 230 402A15 15 0 0 0 215 387A15 15 0 0 0 200 402A15 15 0 0 0 215 417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="402" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="230,402 242,398 242,406" style="fill:rgb(0,0,0)"/>
<path d="M296,364 L 303,364 Q 311,364 311,379 L 311,387 Q 311,402 296,402 L 251,402 L 236,402"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,402 L 123,402 Q 108,402 108,387 L 108,379 Q 108,364 116,364 L 123,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="122,440 111,444 111,436" style="fill:rgb(0,0,0)"/>
<path d="M81,364 L 88,364 Q 96,364 96,379 L 96,425 Q 96,440 106,440 L 116,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M122,455L224,455L224,425L122,425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M224,440 L 308,440 Q 323,440 323,425 L 323,379 Q 323,364 331,364 L 338,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/window-defn.html">window-defn:</a></b>
<button id='x0e984fb4' onclick='hideorshow("x0e984fb4","xae724d3d")'>show</button></p>
 <div id='xae724d3d' style='display:none;' class='imgcontainer'>
 <div style="max-width:479px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 479.765 380.592">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,44 92,48 92,40" style="fill:rgb(0,0,0)"/>
<path d="M62,17 L 70,17 Q 77,17 77,30 Q 77,44 88,44 L 98,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,59L260,59A15 15 0 0 0 275 44L275,44A15 15 0 0 0 260 29L119,29A15 15 0 0 0 104 44L104,44A15 15 0 0 0 119 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M119,135L198,135A15 15 0 0 0 214 120A15 15 0 0 0 198 104L119,104A15 15 0 0 0 104 120A15 15 0 0 0 119 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="237,120 225,124 225,115" style="fill:rgb(0,0,0)"/>
<path d="M214,120L231,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M252,135L256,135A15 15 0 0 0 271 120A15 15 0 0 0 256 104L252,104A15 15 0 0 0 237 120A15 15 0 0 0 252 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="307,120 295,124 295,115" style="fill:rgb(0,0,0)"/>
<path d="M271,120L301,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,135L356,135L356,104L307,104Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M332,173A15 15 0 0 0 347 157A15 15 0 0 0 332 142A15 15 0 0 0 316 157A15 15 0 0 0 332 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="157" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="347,157 358,153 358,162" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,142 Q 371,157 362,157 L 352,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,157 L 295,157 Q 280,157 280,142 L 280,135 Q 280,120 288,120 L 295,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,17 178,21 178,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L184,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,82 201,77 201,86" style="fill:rgb(0,0,0)"/>
<path d="M190,17 L 298,17 Q 313,17 313,32 L 313,67 Q 313,82 298,82 L 210,82 L 195,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,120 92,124 92,115" style="fill:rgb(0,0,0)"/>
<path d="M190,82 L 77,82 Q 62,82 62,97 L 62,105 Q 62,120 77,120 L 83,120 L 98,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,44 287,48 287,40" style="fill:rgb(0,0,0)"/>
<path d="M275,44L293,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,44 L 306,44 Q 313,44 313,51 L 313,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,248L163,248A15 15 0 0 0 178 233A15 15 0 0 0 163 218L119,218A15 15 0 0 0 104 233A15 15 0 0 0 119 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="201,233 190,237 190,229" style="fill:rgb(0,0,0)"/>
<path d="M178,233L196,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,248L221,248A15 15 0 0 0 236 233A15 15 0 0 0 221 218L217,218A15 15 0 0 0 201 233A15 15 0 0 0 217 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="272,233 260,237 260,229" style="fill:rgb(0,0,0)"/>
<path d="M236,233L266,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,248L402,248L402,218L272,218Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M337,286A15 15 0 0 0 352 271A15 15 0 0 0 337 256A15 15 0 0 0 322 271A15 15 0 0 0 337 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="352,271 363,266 363,275" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,256 Q 417,271 402,271 L 373,271 L 358,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M322,271 L 260,271 Q 245,271 245,256 L 245,248 Q 245,233 253,233 L 260,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,195 201,191 201,200" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,180 Q 371,195 356,195 L 210,195 L 195,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,233 92,237 92,229" style="fill:rgb(0,0,0)"/>
<path d="M190,195 L 77,195 Q 62,195 62,210 L 62,218 Q 62,233 77,233 L 83,233 L 98,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,157 58,146 66,146" style="fill:rgb(0,0,0)"/>
<path d="M62,104L62,152"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,157L62,218"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,362L208,362L208,331L104,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="417,346 405,351 405,342" style="fill:rgb(0,0,0)"/>
<path d="M208,346L411,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,362A15 15 0 0 0 447 346A15 15 0 0 0 432 331A15 15 0 0 0 417 346A15 15 0 0 0 432 362Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="470,346 458,351 458,342" style="fill:rgb(0,0,0)"/>
<path d="M447,346L464,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="474" cy="346" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,309 201,304 201,313" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,294 Q 417,309 402,309 L 210,309 L 195,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,346 92,351 92,342" style="fill:rgb(0,0,0)"/>
<path d="M190,309 L 77,309 Q 62,309 62,324 L 62,331 Q 62,346 77,346 L 83,346 L 98,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,271 58,259 66,259" style="fill:rgb(0,0,0)"/>
<path d="M62,218L62,265"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,271L62,331"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,374 144,378 144,369" style="fill:rgb(0,0,0)"/>
<path d="M62,331 L 62,359 Q 62,374 77,374 L 135,374 L 150,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,346 266,351 266,342" style="fill:rgb(0,0,0)"/>
<path d="M156,374 L 233,374 Q 248,374 248,360 Q 248,346 260,346 L 272,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x334da50a' onclick='hideorshow("x334da50a","x29a910c5")'>show</button></p>
 <div id='x29a910c5' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/foreign-key-clause.html">foreign-key-clause:</a></b>
<button id='xbd3efe95' onclick='hideorshow("xbd3efe95","x56b9cbfc")'>show</button></p>
 <div id='x56b9cbfc' style='display:none;' class='imgcontainer'>
 <div style="max-width:648px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 648.158 492.48">
<circle cx="5" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,55L39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L164,70A15 15 0 0 0 179 55A15 15 0 0 0 164 39L60,39A15 15 0 0 0 45 55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REFERENCES</text>
<polygon points="202,55 190,59 190,50" style="fill:rgb(0,0,0)"/>
<path d="M179,55L196,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,70L306,70A15 15 0 0 0 322 55A15 15 0 0 0 306 39L217,39A15 15 0 0 0 202 55A15 15 0 0 0 217 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="262" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">foreign-table</text>
<polygon points="358,55 346,59 346,50" style="fill:rgb(0,0,0)"/>
<path d="M322,55L352,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M373,70A15 15 0 0 0 388 55A15 15 0 0 0 373 39A15 15 0 0 0 358 55A15 15 0 0 0 373 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="373" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="424,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M388,55L418,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M439,70L533,70A15 15 0 0 0 548 55A15 15 0 0 0 533 39L439,39A15 15 0 0 0 424 55A15 15 0 0 0 439 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="486" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="584,55 573,59 573,50" style="fill:rgb(0,0,0)"/>
<path d="M548,55L578,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M599,70A15 15 0 0 0 614 55A15 15 0 0 0 599 39A15 15 0 0 0 584 55A15 15 0 0 0 599 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="599" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<path d="M486,32A15 15 0 0 0 501 17L501,17A15 15 0 0 0 486 2A15 15 0 0 0 471 17L471,17A15 15 0 0 0 486 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="486" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="501,17 513,12 513,21" style="fill:rgb(0,0,0)"/>
<path d="M548,55 L 556,55 Q 563,55 563,40 L 563,32 Q 563,17 548,17 L 522,17 L 507,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,17 L 416,17 Q 401,17 401,32 L 401,40 Q 401,55 412,55 L 424,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,176L69,176A15 15 0 0 0 84 160A15 15 0 0 0 69 145L60,145A15 15 0 0 0 45 160A15 15 0 0 0 60 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="64" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="120,160 109,165 109,156" style="fill:rgb(0,0,0)"/>
<path d="M84,160L114,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,176L188,176A15 15 0 0 0 203 160A15 15 0 0 0 188 145L135,145A15 15 0 0 0 120 160A15 15 0 0 0 135 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="162" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DELETE</text>
<polygon points="275,160 264,165 264,156" style="fill:rgb(0,0,0)"/>
<path d="M203,160L269,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,176L306,176A15 15 0 0 0 321 160A15 15 0 0 0 306 145L290,145A15 15 0 0 0 275 160A15 15 0 0 0 290 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="298" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="344,160 332,165 332,156" style="fill:rgb(0,0,0)"/>
<path d="M321,160L338,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M359,176L390,176A15 15 0 0 0 405 160A15 15 0 0 0 390 145L359,145A15 15 0 0 0 344 160A15 15 0 0 0 359 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<path d="M135,213L189,213A15 15 0 0 0 204 198A15 15 0 0 0 189 183L135,183A15 15 0 0 0 120 198A15 15 0 0 0 135 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="162" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="120,198 109,203 109,194" style="fill:rgb(0,0,0)"/>
<path d="M84,160 L 92,160 Q 99,160 99,175 L 99,183 Q 99,198 107,198 L 114,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M204,198 L 212,198 Q 219,198 219,183 L 219,175 Q 219,160 227,160 L 234,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,213L306,213A15 15 0 0 0 321 198A15 15 0 0 0 306 183L290,183A15 15 0 0 0 275 198A15 15 0 0 0 290 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="298" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="344,198 332,203 332,194" style="fill:rgb(0,0,0)"/>
<path d="M321,198L338,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M359,213L424,213A15 15 0 0 0 440 198A15 15 0 0 0 424 183L359,183A15 15 0 0 0 344 198A15 15 0 0 0 359 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="392" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFAULT</text>
<polygon points="463,198 451,203 451,194" style="fill:rgb(0,0,0)"/>
<path d="M440,198L457,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,198 L 470,198 Q 478,198 478,191 L 478,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,251L357,251A15 15 0 0 0 372 236A15 15 0 0 0 357 221L290,221A15 15 0 0 0 275 236A15 15 0 0 0 290 251Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="324" y="236" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASCADE</text>
<polygon points="463,236 451,240 451,232" style="fill:rgb(0,0,0)"/>
<path d="M372,236L457,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,236 L 470,236 Q 478,236 478,229 L 478,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,289L361,289A15 15 0 0 0 376 274A15 15 0 0 0 361 259L290,259A15 15 0 0 0 275 274A15 15 0 0 0 290 289Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="326" y="274" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RESTRICT</text>
<polygon points="463,274 451,278 451,270" style="fill:rgb(0,0,0)"/>
<path d="M376,274L457,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,274 L 470,274 Q 478,274 478,266 L 478,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,327L299,327A15 15 0 0 0 314 312A15 15 0 0 0 299 297L290,297A15 15 0 0 0 275 312A15 15 0 0 0 290 327Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="295" y="312" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="337,312 326,316 326,307" style="fill:rgb(0,0,0)"/>
<path d="M314,312L332,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M353,327L404,327A15 15 0 0 0 419 312A15 15 0 0 0 404 297L353,297A15 15 0 0 0 337 312A15 15 0 0 0 353 327Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="378" y="312" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ACTION</text>
<polygon points="463,312 451,316 451,307" style="fill:rgb(0,0,0)"/>
<path d="M419,312L457,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,312 L 470,312 Q 478,312 478,304 L 478,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,357L108,357A15 15 0 0 0 123 342L123,342A15 15 0 0 0 108 327L60,327A15 15 0 0 0 45 342L45,342A15 15 0 0 0 60 357Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="84" y="342" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<polygon points="146,342 135,346 135,338" style="fill:rgb(0,0,0)"/>
<path d="M123,342L140,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M161,357L188,357A15 15 0 0 0 203 342L203,342A15 15 0 0 0 188 327L161,327A15 15 0 0 0 146 342L146,342A15 15 0 0 0 161 357Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="175" y="342" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="463,342 451,346 451,338" style="fill:rgb(0,0,0)"/>
<path d="M203,342L457,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="442,115 453,111 453,119" style="fill:rgb(0,0,0)"/>
<path d="M463,342 L 470,342 Q 478,342 478,327 L 478,130 Q 478,115 463,115 L 462,115 L 447,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="463,160 451,165 451,156" style="fill:rgb(0,0,0)"/>
<path d="M405,160L457,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,160 L 470,160 Q 478,160 478,153 L 478,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,312 264,316 264,307" style="fill:rgb(0,0,0)"/>
<path d="M237,160 L 245,160 Q 252,160 252,175 L 252,297 Q 252,312 261,312 L 269,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,274 264,278 264,270" style="fill:rgb(0,0,0)"/>
<path d="M252,259 L 252,266 Q 252,274 261,274 L 269,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,236 264,240 264,232" style="fill:rgb(0,0,0)"/>
<path d="M252,221 L 252,228 Q 252,236 261,236 L 269,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,198 264,203 264,194" style="fill:rgb(0,0,0)"/>
<path d="M252,183 L 252,191 Q 252,198 261,198 L 269,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,160 33,165 33,156" style="fill:rgb(0,0,0)"/>
<path d="M614,55 L 623,55 Q 632,55 632,70 L 632,100 Q 632,115 617,115 L 20,115 Q 5,115 5,130 L 5,145 Q 5,160 20,160 L 24,160 L 39,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,342 33,346 33,338" style="fill:rgb(0,0,0)"/>
<path d="M5,145 L 5,327 Q 5,342 20,342 L 24,342 L 39,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="337,91 332,79 341,79" style="fill:rgb(0,0,0)"/>
<path d="M322,55 L 329,55 Q 337,55 337,70 L 337,70 L 337,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M337,91 L 337,103 Q 337,115 329,115 L 322,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,433L80,433A15 15 0 0 0 95 417A15 15 0 0 0 80 402L60,402A15 15 0 0 0 45 417A15 15 0 0 0 60 433Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="417" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="133,387 122,392 122,383" style="fill:rgb(0,0,0)"/>
<path d="M95,417 L 103,417 Q 110,417 110,402 L 110,402 Q 110,387 119,387 L 127,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M148,402L250,402A15 15 0 0 0 265 387A15 15 0 0 0 250 372L148,372A15 15 0 0 0 133 387A15 15 0 0 0 148 402Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="387" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFERRABLE</text>
<polygon points="303,417 292,422 292,413" style="fill:rgb(0,0,0)"/>
<path d="M265,387 L 273,387 Q 280,387 280,402 L 280,402 Q 280,417 289,417 L 297,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M318,433L389,433A15 15 0 0 0 405 417A15 15 0 0 0 389 402L318,402A15 15 0 0 0 303 417A15 15 0 0 0 318 433Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="354" y="417" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INITIALLY</text>
<polygon points="428,417 416,422 416,413" style="fill:rgb(0,0,0)"/>
<path d="M405,417L422,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M443,433L523,433A15 15 0 0 0 538 417A15 15 0 0 0 523 402L443,402A15 15 0 0 0 428 417A15 15 0 0 0 443 433Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="417" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFERRED</text>
<path d="M318,470L389,470A15 15 0 0 0 405 455A15 15 0 0 0 389 440L318,440A15 15 0 0 0 303 455A15 15 0 0 0 318 470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="354" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INITIALLY</text>
<polygon points="428,455 416,460 416,451" style="fill:rgb(0,0,0)"/>
<path d="M405,455L422,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M443,470L531,470A15 15 0 0 0 546 455A15 15 0 0 0 531 440L443,440A15 15 0 0 0 428 455A15 15 0 0 0 443 470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="487" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IMMEDIATE</text>
<polygon points="569,455 558,460 558,451" style="fill:rgb(0,0,0)"/>
<path d="M546,455L564,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="569,417 558,422 558,413" style="fill:rgb(0,0,0)"/>
<path d="M538,417L564,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="569,387 558,392 558,383" style="fill:rgb(0,0,0)"/>
<path d="M265,387L564,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="303,455 292,460 292,451" style="fill:rgb(0,0,0)"/>
<path d="M265,387 L 273,387 Q 280,387 280,402 L 280,440 Q 280,455 289,455 L 297,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="638,486 627,490 627,481" style="fill:rgb(0,0,0)"/>
<path d="M569,387 L 577,387 Q 584,387 584,402 L 584,471 Q 584,486 599,486 L 618,486 L 633,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="642" cy="486" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M569,455 L 577,455 Q 584,455 584,463 L 584,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M569,417 L 577,417 Q 584,417 584,425 L 584,432"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M5,327 L 5,471 Q 5,486 20,486 L 612,486 L 627,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M5,372 L 5,380 Q 5,387 20,387 L 118,387 L 133,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,417 33,422 33,413" style="fill:rgb(0,0,0)"/>
<path d="M5,402 L 5,410 Q 5,417 20,417 L 24,417 L 39,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/literal-value.html">literal-value:</a></b>
<button id='x435a39f9' onclick='hideorshow("x435a39f9","xfaeab42a")'>show</button></p>
 <div id='xfaeab42a' style='display:none;' class='imgcontainer'>
 <div style="max-width:341px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 341.376 336.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,319 39,324 39,315" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,304 Q 24,319 34,319 L 45,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,334L252,334A15 15 0 0 0 267 319A15 15 0 0 0 252 304L65,304A15 15 0 0 0 50 319A15 15 0 0 0 65 334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIMESTAMP</text>
<polygon points="290,319 278,324 278,315" style="fill:rgb(0,0,0)"/>
<path d="M267,319L284,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,17 320,21 320,12" style="fill:rgb(0,0,0)"/>
<path d="M290,319 L 297,319 Q 305,319 305,304 L 305,32 Q 305,17 315,17 L 326,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="335" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L172,32A15 15 0 0 0 187 17A15 15 0 0 0 172 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="119" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,17L320,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L153,70A15 15 0 0 0 168 55L168,55A15 15 0 0 0 153 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">string-literal</text>
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,47 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,55 278,59 278,50" style="fill:rgb(0,0,0)"/>
<path d="M168,55L284,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,55 L 297,55 Q 305,55 305,47 L 305,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L140,108A15 15 0 0 0 155 92A15 15 0 0 0 140 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">blob-literal</text>
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,85 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,92 278,97 278,88" style="fill:rgb(0,0,0)"/>
<path d="M155,92L284,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,92 L 297,92 Q 305,92 305,85 L 305,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,145L97,145A15 15 0 0 0 112 130A15 15 0 0 0 97 115L66,115A15 15 0 0 0 50 130A15 15 0 0 0 66 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="50,130 39,135 39,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 34,130 L 45,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,130 278,135 278,126" style="fill:rgb(0,0,0)"/>
<path d="M112,130L284,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,130 L 297,130 Q 305,130 305,123 L 305,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,183L96,183A15 15 0 0 0 111 168A15 15 0 0 0 96 153L66,153A15 15 0 0 0 50 168A15 15 0 0 0 66 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRUE</text>
<polygon points="50,168 39,172 39,164" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,160 Q 24,168 34,168 L 45,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,168 278,172 278,164" style="fill:rgb(0,0,0)"/>
<path d="M111,168L284,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,168 L 297,168 Q 305,168 305,160 L 305,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,221L104,221A15 15 0 0 0 119 206A15 15 0 0 0 104 191L66,191A15 15 0 0 0 50 206A15 15 0 0 0 66 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FALSE</text>
<polygon points="50,206 39,210 39,201" style="fill:rgb(0,0,0)"/>
<path d="M24,191 L 24,198 Q 24,206 34,206 L 45,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,206 278,210 278,201" style="fill:rgb(0,0,0)"/>
<path d="M119,206L284,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,206 L 297,206 Q 305,206 305,198 L 305,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,259L190,259A15 15 0 0 0 205 244A15 15 0 0 0 190 228L66,228A15 15 0 0 0 50 244A15 15 0 0 0 66 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="128" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIME</text>
<polygon points="50,244 39,248 39,239" style="fill:rgb(0,0,0)"/>
<path d="M24,228 L 24,236 Q 24,244 34,244 L 45,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,244 278,248 278,239" style="fill:rgb(0,0,0)"/>
<path d="M205,244L284,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,244 L 297,244 Q 305,244 305,236 L 305,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,297L192,297A15 15 0 0 0 207 281A15 15 0 0 0 192 266L66,266A15 15 0 0 0 50 281A15 15 0 0 0 66 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_DATE</text>
<polygon points="50,281 39,286 39,277" style="fill:rgb(0,0,0)"/>
<path d="M24,266 L 24,274 Q 24,281 34,281 L 45,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,281 278,286 278,277" style="fill:rgb(0,0,0)"/>
<path d="M207,281L284,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,281 L 297,281 Q 305,281 305,274 L 305,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='x46c37312' onclick='hideorshow("x46c37312","x2dde8d56")'>show</button></p>
 <div id='x2dde8d56' style='display:none;' class='imgcontainer'>
 <div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/type-name.html">type-name:</a></b>
<button id='xfcaebd68' onclick='hideorshow("xfcaebd68","x01286a1d")'>show</button></p>
 <div id='x01286a1d' style='display:none;' class='imgcontainer'>
 <div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.008 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L87,32A15 15 0 0 0 102 17A15 15 0 0 0 87 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="165,92 153,97 153,88" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,77 Q 138,92 149,92 L 159,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,108A15 15 0 0 0 195 92A15 15 0 0 0 180 77A15 15 0 0 0 165 92A15 15 0 0 0 180 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,92 201,97 201,88" style="fill:rgb(0,0,0)"/>
<path d="M195,92L207,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,108L350,108L350,77L212,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,92 356,97 356,88" style="fill:rgb(0,0,0)"/>
<path d="M350,92L362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,108A15 15 0 0 0 398 92A15 15 0 0 0 382 77A15 15 0 0 0 367 92A15 15 0 0 0 382 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="415,92 403,97 403,88" style="fill:rgb(0,0,0)"/>
<path d="M398,92L409,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,108L553,108L553,77L415,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="570,92 558,97 558,88" style="fill:rgb(0,0,0)"/>
<path d="M553,92L564,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,108A15 15 0 0 0 600 92A15 15 0 0 0 585 77A15 15 0 0 0 570 92A15 15 0 0 0 585 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="585" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="651,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M600,92 L 608,92 Q 615,92 615,77 L 615,32 Q 615,17 630,17 L 630,17 L 645,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,40 Q 138,55 149,55 L 159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70A15 15 0 0 0 195 55L195,55A15 15 0 0 0 180 39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,55 201,59 201,50" style="fill:rgb(0,0,0)"/>
<path d="M195,55L207,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,70L350,70L350,39L212,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,55 356,59 356,50" style="fill:rgb(0,0,0)"/>
<path d="M350,55L362,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,70A15 15 0 0 0 398 55L398,55A15 15 0 0 0 382 39A15 15 0 0 0 367 55L367,55A15 15 0 0 0 382 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="600,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M398,55L594,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M600,55 L 608,55 Q 615,55 615,47 L 615,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="74,47 85,43 85,51" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 110,17 Q 117,17 117,32 L 117,32 Q 117,47 102,47 L 94,47 L 79,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47 L 33,47 Q 18,47 18,32 L 18,32 Q 18,17 26,17 L 33,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="382,17 371,21 371,12" style="fill:rgb(0,0,0)"/>
<path d="M102,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,17L630,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='x99cc5adf' onclick='hideorshow("x99cc5adf","xaf63a11d")'>show</button></p>
 <div id='xaf63a11d' style='display:none;' class='imgcontainer'>
 <div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
</div>


<p>SQLite supports a limited subset of ALTER TABLE.
The ALTER TABLE command in SQLite allows
these alterations of an existing table:
it can be renamed;
a column can be renamed;
a column can be added to it;
or
a column can be dropped from it.

<a name="altertabrename"></a>

</p><h1 id="alter_table_rename"><span>2. </span>ALTER TABLE RENAME</h1>

<p> The RENAME TO syntax changes the name of <span class='yyterm'>table-name</span>
to <span class='yyterm'>new-table-name</span>.
This command 
cannot be used to move a table between attached databases, only to rename 
a table within the same database.
If the table being renamed has triggers or indices, then these remain
attached to the table after it has been renamed.

</p><blockquote style="background-color: #ffd0d0;">
<b>Compatibility Note:</b>
The behavior of ALTER TABLE when renaming a table was enhanced
in versions 3.25.0 (2018-09-15) and 3.26.0 (2018-12-01)
in order to carry the rename operation forward into triggers and
views that reference the renamed table.  This is considered an
improvement. Applications that depend on the older (and
arguably buggy) behavior can use the
<a href="pragma.html#pragma_legacy_alter_table">PRAGMA legacy_alter_table=ON</a> statement or the
<a href="c3ref/c_dbconfig_defensive.html#sqlitedbconfiglegacyaltertable">SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</a> configuration parameter
on <a href="c3ref/db_config.html">sqlite3_db_config()</a> interface to make ALTER TABLE RENAME
behave as it did prior to version 3.25.0.
</blockquote>

<p>
Beginning with release 3.25.0 (2018-09-15), references to the table
within trigger bodies and view definitions are also renamed.
</p>

<p> Prior to version 3.26.0 (2018-12-01), FOREIGN KEY references
to a table that is renamed were only edited if the
<a href="pragma.html#pragma_foreign_keys">PRAGMA foreign_keys=ON</a>, or in other words if
<a href="foreignkeys.html">foreign key constraints</a> were being enforced.  With
<a href="pragma.html#pragma_foreign_keys">PRAGMA foreign_keys=OFF</a>, FOREIGN KEY constraints would not be changed
when the table that the foreign key referred to (the "<a href="foreignkeys.html#parentchild">parent table</a>")
was renamed.  Beginning with version 3.26.0, FOREIGN KEY constraints
are always converted when a table is renamed, unless the
<a href="pragma.html#pragma_legacy_alter_table">PRAGMA legacy_alter_table=ON</a> setting is engaged.  The following
table summarizes the difference:</p>

<blockquote>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<th>PRAGMA foreign_keys
</th><th>PRAGMA legacy_alter_table
</th><th><a href="foreignkeys.html#parentchild">Parent Table</a>
references are updated
</th><th>SQLite version
</th></tr><tr><td align="center">Off</td><td align="center">Off</td><td align="center">No</td><td align="center">&lt; 3.26.0
</td></tr><tr><td align="center">Off</td><td align="center">Off</td><td align="center">Yes</td><td align="center">&gt;= 3.26.0
</td></tr><tr><td align="center">On</td><td align="center">Off</td><td align="center">Yes</td><td align="center">all
</td></tr><tr><td align="center">Off</td><td align="center">On</td><td align="center">No</td><td align="center">all
</td></tr><tr><td align="center">On</td><td align="center">On</td><td align="center">Yes</td><td align="center">all
</td></tr></table>
</blockquote>

<a name="altertabmvcol"></a>

<h1 id="alter_table_rename_column"><span>3. </span>ALTER TABLE RENAME COLUMN</h1>

<p> The RENAME COLUMN TO syntax changes the
<span class='yyterm'>column-name</span> of table <span class='yyterm'>table-name</span>
into <span class='yyterm'>new-column-name</span>.  The column name is changed both
within the table definition itself and also within all indexes, triggers,
and views that reference the column.  If the column name change would
result in a semantic ambiguity in a trigger or view, then the RENAME
COLUMN fails with an error and no changes are applied.

<a name="altertabaddcol"></a>

</p><h1 id="alter_table_add_column"><span>4. </span>ALTER TABLE ADD COLUMN</h1>

<p> The ADD COLUMN syntax
is used to add a new column to an existing table.
The new column is always appended to the end of the list of existing columns.
The <a href="syntax/column-def.html">column-def</a> rule defines the characteristics of the new column.
The new column may take any of the forms permissible in a <a href="lang_createtable.html">CREATE TABLE</a>
statement, with the following restrictions:
</p><ul>
<li>The column may not have a PRIMARY KEY or UNIQUE constraint.</li>
<li>The column may not have a default value of CURRENT_TIME, CURRENT_DATE, 
    CURRENT_TIMESTAMP, or an expression in parentheses.</li>
<li>If a NOT NULL constraint is specified, then the column must have a
    default value other than NULL.
</li><li>If <a href="foreignkeys.html">foreign key constraints</a> are <a href="pragma.html#pragma_foreign_keys">enabled</a> and
    a column with a <a href="syntax/foreign-key-clause.html">REFERENCES clause</a>
    is added, the column must have a default value of NULL.
</li><li>The column may not be <a href="gencol.html">GENERATED ALWAYS ... STORED</a>,
though VIRTUAL columns are allowed.
</li></ul>

<p>When adding a column with a <a href="lang_createtable.html#ckconst">CHECK constraint</a>, or a NOT NULL constraint
on a <a href="gencol.html">generated column</a>, the added constraints are tested against all 
preexisting rows in the table and the ADD COLUMN fails
if any constraint fails.  The testing of added constraints
against preexisting rows is a new enhancement as of SQLite version
3.37.0 (2021-11-27).</p>

<p>The ALTER TABLE command works by modifying the SQL text of the schema
stored in the <a href="schematab.html">sqlite_schema table</a>.
No changes are made to table content for renames or column addition without
constraints.
Because of this,
the execution time of such ALTER TABLE commands is independent of
the amount of data in the table and such commands will 
run as quickly on a table with 10 million rows as on a table with 1 row.
When adding new columns that have CHECK constraints, or adding generated
columns with NOT NULL constraints, or when deleting columns, then all
existing data in the table must be either read (to test new constraints
against existing rows) or written (to remove deleted columns).  In those
cases, the ALTER TABLE command takes time that is proportional to the
amount of content in the table being altered.
</p>

<p>After ADD COLUMN has been run on a database, that database will not
be readable by SQLite version 3.1.3 (2005-02-20) and earlier.</p>

<a name="altertabdropcol"></a>

<h1 id="alter_table_drop_column"><span>5. </span>ALTER TABLE DROP COLUMN</h1>

<p> The DROP COLUMN syntax
is used to remove an existing column from a table.
The DROP COLUMN command removes the named column from the table,
and rewrites its content to purge the data associated
with that column.
The DROP COLUMN command only works if the column is not referenced
by any other parts of the schema and is not a PRIMARY KEY and
does not have a UNIQUE constraint.
Possible reasons why the DROP COLUMN command can fail include:
</p><ul>
<li>The column is a PRIMARY KEY or part of one.
</li><li>The column has a UNIQUE constraint.
</li><li>The column is indexed.
</li><li>The column is named in the WHERE clause of a <a href="partialindex.html">partial index</a>.
</li><li>The column is named in a table or column <a href="lang_createtable.html#ckconst">CHECK constraint</a>
not associated with the column being dropped.
</li><li>The column is used in a <a href="foreignkeys.html">foreign key constraint</a>.
</li><li>The column is used in the expression of a <a href="gencol.html">generated column</a>.
</li><li>The column appears in a trigger or view.
</li></ul>

<h2 id="how_it_works"><span>5.1. </span>How It Works</h2>

<p>SQLite stores the schema as plain text in the <a href="schematab.html">sqlite_schema table</a>.
The DROP COLUMN command (and all of the other variations of ALTER TABLE
as well) modify that text and then attempt to reparse the entire schema.
The command is only successful if the schema is still valid after the
text has been modified.  In the case of the DROP COLUMN command, the
only text modified is that the column definition is removed from the
CREATE TABLE statement.  The DROP COLUMN command will fail if there
are any traces of the column in other parts of the schema that will
prevent the schema from parsing after the CREATE TABLE statement has
been modified.

</p><h1 id="disable_error_checking_using_pragma_writable_schema_on"><span>6. </span>Disable Error Checking Using PRAGMA writable_schema=ON</h1>

<p>ALTER TABLE will normally fail and make no changes if it encounters
any entries in the <a href="schematab.html">sqlite_schema table</a> that do not parse.  For
example, if there is a malformed VIEW or TRIGGER associated with
table named "tbl1", then an attempt to rename "tbl1" to "tbl1neo" will
fail because the associated views and triggers could not be parsed.

</p><p>Beginning with SQLite 3.38.0 (2022-02-22), this error checking
can be disabled by setting "<a href="pragma.html#pragma_writable_schema">PRAGMA writable_schema=ON;</a>".  When
the schema is writable, ALTER TABLE silently ignores any rows of the
sqlite_schema table that do not parse.

<a name="otheralter"></a>

</p><h1 id="making_other_kinds_of_table_schema_changes"><span>7. </span>Making Other Kinds Of Table Schema Changes</h1>

<p> The only schema altering commands directly supported by SQLite are the
"<a href="lang_altertable.html#altertabrename">rename table</a>", "<a href="lang_altertable.html#altertabmvcol">rename column</a>", "<a href="lang_altertable.html#altertabaddcol">add column</a>", "<a href="lang_altertable.html#altertabdropcol">drop column</a>"
commands shown above.  However, applications
can make other arbitrary changes to the format of a table using a simple
sequence of operations.
The steps to make arbitrary changes to the schema design of some table X
are as follows:

</p><ol>
<li><p>
If foreign key constraints are enabled, disable them using <a href="pragma.html#pragma_foreign_keys">PRAGMA foreign_keys=OFF</a>.

</p></li><li><p>
Start a transaction.

</p></li><li><p>
Remember the format of all indexes, triggers, and views associated with table X.
This information will be needed in step 8 below.  One way to do this is
to run a query like the following:
SELECT type, sql FROM sqlite_schema WHERE tbl_name='X'.

</p></li><li><p>
Use <a href="lang_createtable.html">CREATE TABLE</a> to construct a new table "new_X" that is in the desired
revised format of table X.  Make sure that the name "new_X" does not collide
with any existing table name, of course.

</p></li><li><p>
Transfer content from X into new_X using a statement
like: INSERT INTO new_X SELECT ... FROM X.

</p></li><li><p>
Drop the old table X:  <a href="lang_droptable.html">DROP TABLE X</a>.

</p></li><li><p>
Change the name of new_X to X using: ALTER TABLE new_X RENAME TO X.

</p></li><li><p>
Use <a href="lang_createindex.html">CREATE INDEX</a>, <a href="lang_createtrigger.html">CREATE TRIGGER</a>, and <a href="lang_createview.html">CREATE VIEW</a>
to reconstruct indexes, triggers, and views
associated with table X.  Perhaps use the old format of the triggers,
indexes, and views saved from step 3 above as a guide, making changes
as appropriate for the alteration.

</p></li><li><p>If any views refer to table X in a way that is affected by the
schema change, then drop those views using <a href="lang_dropview.html">DROP VIEW</a> and recreate them
with whatever changes are necessary to accommodate the schema change
using <a href="lang_createview.html">CREATE VIEW</a>.

</p></li><li><p>
If foreign key constraints were originally enabled
then run <a href="pragma.html#pragma_foreign_key_check">PRAGMA foreign_key_check</a> to verify that the schema
change did not break any foreign key constraints.


</p></li><li><p>
Commit the transaction started in step 2.

</p></li><li><p>
If foreign keys constraints were originally enabled, reenable them now.
</p></li></ol>

<a name="caution"></a>

<p>
<b>Caution:</b>
Take care to follow the procedure above precisely.  The boxes below
summarize two procedures for modifying a table definition.  At first
glance, they both appear to accomplish the same thing.  However, the
procedure on the right does not always work, especially with the
enhanced <a href="lang_altertable.html#altertabrename">rename table</a> capabilities added by versions 3.25.0 and
3.26.0.  In the procedure on the right, the initial rename of the
table to a temporary name might corrupt references to that table in
triggers, views, and foreign key constraints.  The safe procedure on
the left constructs the revised table definition using a new temporary
name, then renames the table into its final name, which does not break
links.

</p><center>
<table border="1" cellpadding="10" cellspacing="0">
<tr>
<td valign="top">
<ol>
<li>Create new table
</li><li>Copy data
</li><li>Drop old table
</li><li>Rename new into old
</li></ol>
</td><td valign="top">
<ol>
<li>Rename old table
</li><li>Create new table
</li><li>Copy data
</li><li>Drop old table
</li></ol>
</td></tr><tr>
<th>&uarr;<br>Correct
</th><th>&uarr;<br>Incorrect
</th></tr></table>
</center>

<p>The 12-step <a href="lang_altertable.html#otheralter">generalized ALTER TABLE procedure</a>
above will work even if the
schema change causes the information stored in the table to change.
So the full 12-step procedure above is appropriate for dropping a column,
changing the order of columns, adding or removing a UNIQUE constraint
or PRIMARY KEY, adding CHECK or FOREIGN KEY or NOT NULL constraints,
or changing the datatype for a column, for example.  However, a simpler
and faster procedure can optionally be used for
some changes that do no affect the on-disk content in any way.
The following simpler procedure is appropriate for removing
CHECK or FOREIGN KEY or NOT NULL constraints,
or adding, removing, or changing default values on
a column.

</p><ol>
<li><p> Start a transaction.

</p></li><li><p> Run <a href="pragma.html#pragma_schema_version">PRAGMA schema_version</a> to determine the current schema
version number.  This number will be needed for step 6 below.

</p></li><li><p> Activate schema editing using 
<a href="pragma.html#pragma_writable_schema">PRAGMA writable_schema=ON</a>.

</p></li><li><p> Run an <a href="lang_update.html">UPDATE</a> statement to change the definition of table X
in the <a href="schematab.html">sqlite_schema table</a>: 
UPDATE sqlite_schema SET sql=... WHERE type='table' AND name='X';
</p><p><em>Caution:</em>  Making a change to the sqlite_schema table like this will
render the database corrupt and unreadable if the change contains
a syntax error.  It is suggested that careful testing of the UPDATE
statement be done on a separate blank database prior to using it on
a database containing important data.

</p></li><li><p> If the change to table X also affects other tables or indexes or
triggers are views within schema, then run <a href="lang_update.html">UPDATE</a> statements to modify
those other tables indexes and views too.  For example, if the name of
a column changes, all FOREIGN KEY constraints, triggers, indexes, and
views that refer to that column must be modified.
</p><p><em>Caution:</em>  Once again, making changes to the sqlite_schema 
table like this will render the database corrupt and unreadable if the 
change contains an error.  Carefully test this entire procedure
on a separate test database prior to using it on
a database containing important data and/or make backup copies of
important databases prior to running this procedure.

</p></li><li><p> Increment the schema version number using
<a href="pragma.html#pragma_schema_version">PRAGMA schema_version=X</a> where X is one
more than the old schema version number found in step 2 above.

</p></li><li><p> Disable schema editing using 
<a href="pragma.html#pragma_writable_schema">PRAGMA writable_schema=OFF</a>.

</p></li><li><p> (Optional) Run <a href="pragma.html#pragma_integrity_check">PRAGMA integrity_check</a> to verify that the
schema changes did not damage the database.

</p></li><li><p> Commit the transaction started on step 1 above.
</p></li></ol>

<p>If some future version of SQLite adds new ALTER TABLE capabilities, 
those capabilities will very likely use one of the two procedures
outlined above.

<a name="altertableishard"></a>

</p><h1 id="why_alter_table_is_such_a_problem_for_sqlite"><span>8. </span>Why ALTER TABLE is such a problem for SQLite</h1>

<p>Most SQL database engines store the schema already parsed into
various system tables.  On those database engines, ALTER TABLE merely 
has to make modifications to the corresponding system tables.

</p><p>SQLite is different in that it stores the schema
in the <a href="schematab.html">sqlite_schema</a> table as the original text of the CREATE
statements that define the schema.  Hence ALTER TABLE needs
to revise the text of the CREATE statement.  Doing
so can be tricky for certain "creative" schema designs.

</p><p>The SQLite approach of storing the schema as text has advantages
for an embedded relational database.  For one, it means that the
schema takes up less space in the database file.  This is important
since a common SQLite usage pattern is to have many small,
separate database files instead of putting everything in one
big global database file, which is the usual approach for client/server
database engines.
Since the schema is duplicated in each separate database file, it is
important to keep the schema representation compact.

</p><p>Storing the schema as text rather than as parsed tables also
give flexibility to the implementation.  Since the internal parse
of the schema is regenerated each time the database is opened, the
internal representation of the schema can change from one release
to the next.  This is important, as sometimes new features require
enhancements to the internal schema representation.  Changing the
internal schema representation would be much more difficult if the
schema representation was exposed in the database file.  So, in other
words, storing the schema as text helps maintain backwards 
compatibility, and helps ensure that older database files can be
read and written by newer versions of SQLite.

</p><p>Storing the schema as text also makes the 
<a href="fileformat2.html">SQLite database file format</a> easier to define, document, and 
understand. This helps make SQLite database files a
<a href="locrsf.html">recommended storage format</a> for long-term archiving of data.

</p><p>The downside of storing schema a text is that it can make
the schema tricky to modify.  And for that reason, the ALTER TABLE
support in SQLite has traditionally lagged behind other SQL
database engines that store their schemas as parsed system tables
that are easier to modify.




</p>

Added Doc/Extra/Core/lang_analyze.html.





























































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>ANALYZE</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
ANALYZE
</div>
</div>




<h1 id="overview"><span>1. </span>Overview</h1>

<p><b><a href="syntax/analyze-stmt.html">analyze-stmt:</a></b>
<button id='x9d08cb93' onclick='hideorshow("x9d08cb93","x6f8054a5")'>hide</button></p>
 <div id='x6f8054a5' class='imgcontainer'>
 <div style="max-width:654px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 654.557 140.4">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L111,32A15 15 0 0 0 127 17A15 15 0 0 0 111 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="79" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ANALYZE</text>
<polygon points="150,17 138,21 138,12" style="fill:rgb(0,0,0)"/>
<path d="M127,17L144,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="188,123 176,127 176,118" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 157,17 Q 165,17 165,32 L 165,108 Q 165,123 173,123 L 182,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M203,138L299,138A15 15 0 0 0 314 123A15 15 0 0 0 299 108L203,108A15 15 0 0 0 188 123A15 15 0 0 0 203 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="337,123 326,127 326,118" style="fill:rgb(0,0,0)"/>
<path d="M314,123L332,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M352,138A15 15 0 0 0 368 123A15 15 0 0 0 352 108A15 15 0 0 0 337 123A15 15 0 0 0 352 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="352" y="123" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="391,123 379,127 379,118" style="fill:rgb(0,0,0)"/>
<path d="M368,123L385,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M406,138L556,138A15 15 0 0 0 571 123A15 15 0 0 0 556 108L406,108A15 15 0 0 0 391 123A15 15 0 0 0 406 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-index-name</text>
<polygon points="594,123 582,127 582,118" style="fill:rgb(0,0,0)"/>
<path d="M571,123L588,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="645,17 633,21 633,12" style="fill:rgb(0,0,0)"/>
<path d="M594,123 L 601,123 Q 609,123 609,108 L 609,32 Q 609,17 624,17 L 624,17 L 639,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="648" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="397,17 386,21 386,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L391,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,17L633,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="188,47 176,51 176,43" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 157,17 Q 165,17 165,32 L 165,32 Q 165,47 173,47 L 182,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M203,62L299,62A15 15 0 0 0 314 47L314,47A15 15 0 0 0 299 32L203,32A15 15 0 0 0 188 47L188,47A15 15 0 0 0 203 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="594,47 582,51 582,43" style="fill:rgb(0,0,0)"/>
<path d="M314,47L588,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M594,47 L 601,47 Q 609,47 609,40 L 609,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="188,85 176,89 176,81" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 157,17 Q 165,17 165,32 L 165,70 Q 165,85 173,85 L 182,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M203,100L353,100A15 15 0 0 0 368 85A15 15 0 0 0 353 70L203,70A15 15 0 0 0 188 85A15 15 0 0 0 203 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-or-table-name</text>
<polygon points="594,85 582,89 582,81" style="fill:rgb(0,0,0)"/>
<path d="M368,85L588,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M594,85 L 601,85 Q 609,85 609,77 L 609,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>


<p> The ANALYZE command gathers statistics about tables and
indices and stores the collected information
in <a href="fileformat2.html#intschema">internal tables</a> of the database where the query optimizer can
access the information and use it to help make better query planning choices.
If no arguments are given, all attached databases are
analyzed.  If a schema name is given as the argument, then all tables
and indices in that one database are analyzed.  
If the argument is a table name, then only that table and the
indices associated with that table are analyzed.  If the argument
is an index name, then only that one index is analyzed.</p>

<a name="req"></a>

<h2 id="recommended_usage_pattern"><span>1.1. </span>Recommended usage pattern</h2>

<p>Applications with long-lived databases that use complex
queries should consider running the following commands just prior
to closing each database connection:

</p><div class="codeblock"><pre>PRAGMA analysis_limit=400;
PRAGMA optimize;
</pre></div>

<p>The <a href="pragma.html#pragma_optimize">optimize pragma</a> is usually a no-op but it will occasionally
run ANALYZE if it seems like doing so will be useful to the query planner.
The <a href="pragma.html#pragma_analysis_limit">analysis_limit pragma</a> limits the scope of any ANALYZE command that
the <a href="pragma.html#pragma_optimize">optimize pragma</a> runs so that it does not consume too many CPU cycles.
The constant "400" can be adjusted as needed.  Values between 100 and
1000 work well for most applications.

</p><h1 id="details"><span>2. </span>Details</h1>

<p> The default implementation stores all statistics in a single
table named "<a href="fileformat2.html#stat1tab">sqlite_stat1</a>".  
 If SQLite is compiled with the
<a href="compile.html#enable_stat4">SQLITE_ENABLE_STAT4</a> option, then additional histogram data is
collected and stored in <a href="fileformat2.html#stat4tab">sqlite_stat4</a>.
Older versions of SQLite would make use of the <a href="fileformat2.html#stat2tab">sqlite_stat2</a> table
or <a href="fileformat2.html#stat3tab">sqlite_stat3</a> table
when compiled with <a href="compile.html#enable_stat2">SQLITE_ENABLE_STAT2</a> or <a href="compile.html#enable_stat3">SQLITE_ENABLE_STAT3</a>,
but all recent versions of
SQLite ignore the sqlite_stat2 and sqlite_stat3 tables.
Future enhancements may create
additional <a href="fileformat2.html#intschema">internal tables</a> with the same name pattern except with
final digit larger than "4".
All of these tables are collectively referred to as "statistics tables".
</p>

<p> The content of the statistics tables can be queried using <a href="lang_select.html">SELECT</a>
and can be changed using the <a href="lang_delete.html">DELETE</a>, <a href="lang_insert.html">INSERT</a>, and <a href="lang_update.html">UPDATE</a> commands.
The <a href="lang_droptable.html">DROP TABLE</a> command works on statistics tables
as of SQLite version 3.7.9. (2011-11-01)
The <a href="lang_altertable.html">ALTER TABLE</a> command does not work on statistics tables.
Appropriate care should be used when changing the content of the statistics
tables as invalid content can cause SQLite to select inefficient
query plans.  Generally speaking, one should not modify the content of
the statistics tables by any mechanism other than invoking the
ANALYZE command.  
See "<a href="optoverview.html#manctrl">Manual Control Of Query Plans Using SQLITE_STAT Tables</a>" for
further information.</p>

<p> Statistics gathered by ANALYZE are not automatically updated as
the content of the database changes.  If the content of the database
changes significantly, or if the database schema changes, then one should
consider rerunning the ANALYZE command in order to update the statistics.</p>

<p> The query planner loads the content of the statistics tables
into memory when the schema is read.  Hence, when an application
changes the statistics tables directly, SQLite will not immediately
notice the changes. An application
can force the query planner to reread the statistics tables by running
<b>ANALYZE sqlite_schema</b>. </p>

<a name="autoanalyze"></a>

<h1 id="automatically_running_analyze"><span>3. </span>Automatically Running ANALYZE</h1>

<p>The <a href="pragma.html#pragma_optimize">PRAGMA optimize</a> command will automatically run ANALYZE on individual
tables on an as-needed basis.  The recommended practice is for applications
to invoke the <a href="pragma.html#pragma_optimize">PRAGMA optimize</a> statement just before closing each database
connection.</p>

<p>Each SQLite <a href="c3ref/sqlite3.html">database connection</a> records cases when the query planner would
benefit from having accurate results of ANALYZE at hand.  These records
are held in memory and accumulate over the life of a database connection.
The <a href="pragma.html#pragma_optimize">PRAGMA optimize</a> command looks at those records and runs ANALYZE on only
those tables for which new or updated ANALYZE data seems likely to be useful.
In most cases <a href="pragma.html#pragma_optimize">PRAGMA optimize</a> will not run ANALYZE, but it will occasionally
do so either for tables that have never before been analyzed, or for tables
that have grown significantly since they were last analyzed.</p>

<p>Since the actions of <a href="pragma.html#pragma_optimize">PRAGMA optimize</a> are determined to some extent by
prior queries that have been evaluated on the same database connection, it
is recommended that <a href="pragma.html#pragma_optimize">PRAGMA optimize</a> be deferred until the database connection
is closing and has thus had an opportunity to accumulate as much usage information
as possible.  It is also reasonable to set a timer to run <a href="pragma.html#pragma_optimize">PRAGMA optimize</a>
every few hours, or every few days, for database connections that stay open
for a long time.</p>

<p>Applications that desire more control can run <a href="pragma.html#pragma_optimize">PRAGMA optimize(0x03)</a> to 
obtain a list of ANALYZE commands that SQLite thinks are appropriate to run,
but without actually running those commands.  If the returned set is 
non-empty, the application can then make a decision about whether or not
to run the suggested ANALYZE commands, perhaps after prompting the user
for guidance.</p>

<p>The <a href="pragma.html#pragma_optimize">PRAGMA optimize</a> command was first introduced with 
SQLite 3.18.0 (2017-03-28) and is a no-op for all prior releases
of SQLite.</p>

<a name="approx"></a>

<h1 id="approximate_analyze_for_large_databases"><span>4. </span>Approximate ANALYZE For Large Databases</h1>

<p>By default, ANALYZE does a full scan of every index.  This can be slow for
large databases.  So beginning with SQLite version 3.32.0 (2020-05-22), the
<a href="pragma.html#pragma_analysis_limit">PRAGMA analysis_limit</a> command can be used to limit the amount of
scanning performed by ANALYZE, and thus help ANALYZE to run faster,
even on very large database files.  We call this running an
"approximate ANALYZE".

</p><p>The recommended usage pattern for the <a href="pragma.html#pragma_analysis_limit">analysis_limit</a> pragma is
like this:

</p><div class="codeblock"><pre>PRAGMA analysis_limit=1000;
</pre></div>

<p>This pragma tells the ANALYZE command to start a full scan
of the index as it normally would.  But when the number of rows visited
reaches 1000 (or whatever other limit is specified by the pragma), the
ANALYZE command will begin taking actions to stop the scan.  If
the left-most column of the index has changed at least once during the
previous 1000 steps, then the analysis stops immediately.  But if the
left-most column has always been the same, then ANALYZE skips ahead to
the first entry with a different left-most column and reads an additional
1000 rows before terminating.

</p><p>The details of the effects of the analysis limit described in the previous
paragraph are subject to change in future versions of SQLite.  But the
core idea will remain the same.  An analysis limit of N will strive to
limit the number of rows visited in each index to approximately N.

</p><p>Values of N between 100 and 1000 are recommended.
Or, to disable the analysis limit, causing ANALYZE to do a
complete scan of each index, set the analysis limit to 0.  The default
value for the analysis limit is 0 for backwards compatibility.

</p><p>The values placed in the sqlite_stat1 table by an approximate ANALYZE
are not exactly the same as what would be computed by an unrestricted 
analysis.  But they are usually close enough.  The index statistics in
the sqlite_stat1 table are approximations in any case, so the fact that
the results of an approximate ANALYZE are slightly different from
a traditional full scan ANALYZE has little practical impact.  It is
possible to construct a pathological case where an approximate ANALYZE
is noticeably inferior to a full-scan ANALYZE, but such cases are rare in
real-world problems.

</p><p>A good rule of thumb seems to be to always set "PRAGMA analysis_limit=N"
for N between 100 and 1000 prior to running either "ANALYZE" or
"<a href="pragma.html#pragma_optimize">PRAGMA optimize</a>".  The results are not quite as precise, but they
are precise enough, and the fact that the results are computed so much
faster means that developers are more likely to compute them.  An
approximate ANALYZE is better than not running ANALYZE at all.

</p><h2 id="limitations_of_approximate_analyze"><span>4.1. </span>Limitations of approximate ANALYZE</h2>

<p>The content in the sqlite_stat4 table cannot be computed with
anything less than a full scan.  Hence, if a non-zero analysis limit
is specified, the sqlite_stat4 table is not computed.
</p>

Added Doc/Extra/Core/lang_attach.html.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>ATTACH DATABASE</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
ATTACH DATABASE
</div>
</div>




<h1 id="overview"><span>1. </span>Overview</h1>
<p><b><a href="syntax/attach-stmt.html">attach-stmt:</a></b>
<button id='xb544a08c' onclick='hideorshow("xb544a08c","x2b4169df")'>hide</button></p>
 <div id='x2b4169df' class='imgcontainer'>
 <div style="max-width:606px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 606.701 47.952">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L101,32A15 15 0 0 0 116 17A15 15 0 0 0 101 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ATTACH</text>
<polygon points="139,17 128,21 128,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L134,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="175,17 164,21 164,12" style="fill:rgb(0,0,0)"/>
<path d="M139,17L170,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M191,32L267,32A15 15 0 0 0 282 17A15 15 0 0 0 267 2L191,2A15 15 0 0 0 175 17A15 15 0 0 0 191 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="229" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DATABASE</text>
<polygon points="318,17 306,21 306,12" style="fill:rgb(0,0,0)"/>
<path d="M282,17L312,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M318,32L367,32L367,2L318,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="342" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="390,17 378,21 378,12" style="fill:rgb(0,0,0)"/>
<path d="M367,17L384,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M405,32L409,32A15 15 0 0 0 424 17A15 15 0 0 0 409 2L405,2A15 15 0 0 0 390 17A15 15 0 0 0 405 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="407" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="447,17 436,21 436,12" style="fill:rgb(0,0,0)"/>
<path d="M424,17L441,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,32L559,32A15 15 0 0 0 574 17A15 15 0 0 0 559 2L462,2A15 15 0 0 0 447 17A15 15 0 0 0 462 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="510" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="597,17 585,21 585,12" style="fill:rgb(0,0,0)"/>
<path d="M574,17L591,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="600" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="229,41 217,45 217,37" style="fill:rgb(0,0,0)"/>
<path d="M139,17 L 147,17 Q 154,17 154,29 Q 154,41 169,41 L 208,41 L 223,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M229,41 L 276,41 Q 291,41 291,29 Q 291,17 298,17 L 306,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/expr.html">expr:</a></b>
<button id='xec4b25bf' onclick='hideorshow("xec4b25bf","xb0f43903")'>show</button></p>
 <div id='xb0f43903' style='display:none;' class='imgcontainer'>
 <div style="max-width:963px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 963.96 1068.77">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L158,32L158,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="101" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="954,17 943,21 943,12" style="fill:rgb(0,0,0)"/>
<path d="M158,17L948,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="958" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L172,70A15 15 0 0 0 187 55L187,55A15 15 0 0 0 172 39L60,39A15 15 0 0 0 45 55L45,55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">bind-parameter</text>
<polygon points="916,55 905,59 905,50" style="fill:rgb(0,0,0)"/>
<path d="M187,55L910,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,55 L 924,55 Q 931,55 931,47 L 931,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 31,55 L 39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,130L156,130A15 15 0 0 0 171 115A15 15 0 0 0 156 100L60,100A15 15 0 0 0 45 115A15 15 0 0 0 60 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,115 183,119 183,111" style="fill:rgb(0,0,0)"/>
<path d="M171,115L189,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,130A15 15 0 0 0 225 115A15 15 0 0 0 210 100A15 15 0 0 0 195 115A15 15 0 0 0 210 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M225,115L255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130L351,130A15 15 0 0 0 366 115A15 15 0 0 0 351 100L276,100A15 15 0 0 0 261 115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="389,115 378,119 378,111" style="fill:rgb(0,0,0)"/>
<path d="M366,115L383,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,130A15 15 0 0 0 419 115A15 15 0 0 0 404 100A15 15 0 0 0 389 115A15 15 0 0 0 404 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="404" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="455,115 444,119 444,111" style="fill:rgb(0,0,0)"/>
<path d="M419,115L450,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,130L565,130A15 15 0 0 0 580 115A15 15 0 0 0 565 100L471,100A15 15 0 0 0 455 115A15 15 0 0 0 471 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="916,115 905,119 905,111" style="fill:rgb(0,0,0)"/>
<path d="M580,115L910,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,115 L 924,115 Q 931,115 931,108 L 931,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,115 33,119 33,111" style="fill:rgb(0,0,0)"/>
<path d="M24,100 L 24,108 Q 24,115 31,115 L 39,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,89 97,93 97,84" style="fill:rgb(0,0,0)"/>
<path d="M24,74 L 24,81 Q 24,89 39,89 L 87,89 L 102,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 302,93 302,84" style="fill:rgb(0,0,0)"/>
<path d="M108,89 L 129,89 Q 144,89 159,89 L 293,89 L 308,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,89 L 414,89 Q 429,89 429,102 Q 429,115 436,115 L 444,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M223,89 L 230,89 Q 238,89 238,102 Q 238,115 245,115 L 253,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,168L168,168A15 15 0 0 0 183 153A15 15 0 0 0 168 138L60,138A15 15 0 0 0 45 153A15 15 0 0 0 60 168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">unary-operator</text>
<polygon points="206,153 194,157 194,149" style="fill:rgb(0,0,0)"/>
<path d="M183,153L200,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,168L255,168L255,138L206,138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,153 905,157 905,149" style="fill:rgb(0,0,0)"/>
<path d="M255,153L910,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,153 L 924,153 Q 931,153 931,145 L 931,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,153 33,157 33,149" style="fill:rgb(0,0,0)"/>
<path d="M24,138 L 24,145 Q 24,153 31,153 L 39,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,206L94,206L94,176L45,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,191 106,195 106,186" style="fill:rgb(0,0,0)"/>
<path d="M94,191L111,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,206L245,206A15 15 0 0 0 261 191A15 15 0 0 0 245 176L132,176A15 15 0 0 0 117 191A15 15 0 0 0 132 206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">binary-operator</text>
<polygon points="284,191 272,195 272,186" style="fill:rgb(0,0,0)"/>
<path d="M261,191L278,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,206L333,206L333,176L284,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="308" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,191 905,195 905,186" style="fill:rgb(0,0,0)"/>
<path d="M333,191L910,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,191 L 924,191 Q 931,191 931,183 L 931,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,191 33,195 33,186" style="fill:rgb(0,0,0)"/>
<path d="M24,176 L 24,183 Q 24,191 31,191 L 39,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,245L162,245A15 15 0 0 0 177 230A15 15 0 0 0 162 215L60,215A15 15 0 0 0 45 230A15 15 0 0 0 60 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="111" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-name</text>
<polygon points="194,230 183,234 183,226" style="fill:rgb(0,0,0)"/>
<path d="M177,230L188,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,245A15 15 0 0 0 224 230A15 15 0 0 0 209 215A15 15 0 0 0 194 230A15 15 0 0 0 209 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="260,230 249,234 249,226" style="fill:rgb(0,0,0)"/>
<path d="M224,230L255,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,245L437,245L437,215L260,215Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-arguments</text>
<polygon points="473,230 461,234 461,226" style="fill:rgb(0,0,0)"/>
<path d="M437,230L467,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,245A15 15 0 0 0 503 230A15 15 0 0 0 488 215A15 15 0 0 0 473 230A15 15 0 0 0 488 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="541,260 529,265 529,256" style="fill:rgb(0,0,0)"/>
<path d="M503,230 L 510,230 Q 518,230 518,245 L 518,245 Q 518,260 527,260 L 535,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,275L653,275L653,245L541,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="691,230 680,234 680,226" style="fill:rgb(0,0,0)"/>
<path d="M653,260 L 661,260 Q 668,260 668,245 L 668,245 Q 668,230 677,230 L 685,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="729,260 718,265 718,256" style="fill:rgb(0,0,0)"/>
<path d="M691,230 L 699,230 Q 706,230 706,245 L 706,245 Q 706,260 715,260 L 723,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,275L837,275L837,245L729,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="783" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">over-clause</text>
<polygon points="916,260 905,265 905,256" style="fill:rgb(0,0,0)"/>
<path d="M837,260L910,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,260 L 924,260 Q 931,260 931,253 L 931,245"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,230 33,234 33,226" style="fill:rgb(0,0,0)"/>
<path d="M24,215 L 24,222 Q 24,230 31,230 L 39,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,230 585,234 585,226" style="fill:rgb(0,0,0)"/>
<path d="M503,230L591,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,230L680,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,230 905,234 905,226" style="fill:rgb(0,0,0)"/>
<path d="M691,230L910,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,230 L 924,230 Q 931,230 931,222 L 931,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,321A15 15 0 0 0 75 306A15 15 0 0 0 60 290A15 15 0 0 0 45 306A15 15 0 0 0 60 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,306 100,310 100,301" style="fill:rgb(0,0,0)"/>
<path d="M75,306L105,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M111,321L160,321L160,290L111,290Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="306" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="196,306 185,310 185,301" style="fill:rgb(0,0,0)"/>
<path d="M160,306L191,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,321A15 15 0 0 0 227 306A15 15 0 0 0 211 290A15 15 0 0 0 196 306A15 15 0 0 0 211 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,306 905,310 905,301" style="fill:rgb(0,0,0)"/>
<path d="M227,306L910,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,306 L 924,306 Q 931,306 931,298 L 931,291"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,306 33,310 33,301" style="fill:rgb(0,0,0)"/>
<path d="M24,290 L 24,298 Q 24,306 31,306 L 39,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,284A15 15 0 0 0 151 269A15 15 0 0 0 136 254A15 15 0 0 0 121 269A15 15 0 0 0 136 284Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="269" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="151,269 162,265 162,274" style="fill:rgb(0,0,0)"/>
<path d="M160,306 L 168,306 Q 175,306 175,291 L 175,284 Q 175,269 166,269 L 157,269"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,269 L 103,269 Q 88,269 88,284 L 88,291 Q 88,306 96,306 L 103,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,358L88,358A15 15 0 0 0 103 343A15 15 0 0 0 88 328L60,328A15 15 0 0 0 45 343A15 15 0 0 0 60 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CAST</text>
<polygon points="126,343 114,348 114,339" style="fill:rgb(0,0,0)"/>
<path d="M103,343L120,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M141,358A15 15 0 0 0 156 343A15 15 0 0 0 141 328A15 15 0 0 0 126 343A15 15 0 0 0 141 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="179,343 168,348 168,339" style="fill:rgb(0,0,0)"/>
<path d="M156,343L173,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,358L228,358L228,328L179,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="251,343 240,348 240,339" style="fill:rgb(0,0,0)"/>
<path d="M228,343L246,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,358L271,358A15 15 0 0 0 286 343A15 15 0 0 0 271 328L267,328A15 15 0 0 0 251 343A15 15 0 0 0 267 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="269" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="309,343 297,348 297,339" style="fill:rgb(0,0,0)"/>
<path d="M286,343L303,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,358L408,358L408,328L309,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="358" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="431,343 419,348 419,339" style="fill:rgb(0,0,0)"/>
<path d="M408,343L425,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M446,358A15 15 0 0 0 461 343A15 15 0 0 0 446 328A15 15 0 0 0 431 343A15 15 0 0 0 446 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,343 905,348 905,339" style="fill:rgb(0,0,0)"/>
<path d="M461,343L910,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,343 L 924,343 Q 931,343 931,336 L 931,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,343 33,348 33,339" style="fill:rgb(0,0,0)"/>
<path d="M24,328 L 24,336 Q 24,343 31,343 L 39,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,396L94,396L94,366L45,366Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,381 106,385 106,377" style="fill:rgb(0,0,0)"/>
<path d="M94,381L111,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,396L196,396A15 15 0 0 0 211 381A15 15 0 0 0 196 366L132,366A15 15 0 0 0 117 381A15 15 0 0 0 132 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="234,381 223,385 223,377" style="fill:rgb(0,0,0)"/>
<path d="M211,381L229,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,396L355,396A15 15 0 0 0 370 381A15 15 0 0 0 355 366L250,366A15 15 0 0 0 234 381A15 15 0 0 0 250 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="916,381 905,385 905,377" style="fill:rgb(0,0,0)"/>
<path d="M370,381L910,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,381 L 924,381 Q 931,381 931,374 L 931,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,381 33,385 33,377" style="fill:rgb(0,0,0)"/>
<path d="M24,366 L 24,374 Q 24,381 31,381 L 39,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,434L94,434L94,404L45,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,419 119,423 119,415" style="fill:rgb(0,0,0)"/>
<path d="M94,419L124,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,434L165,434A15 15 0 0 0 180 419A15 15 0 0 0 165 404L145,404A15 15 0 0 0 130 419A15 15 0 0 0 145 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="234,419 223,423 223,415" style="fill:rgb(0,0,0)"/>
<path d="M180,419L229,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,434L273,434A15 15 0 0 0 288 419A15 15 0 0 0 273 404L250,404A15 15 0 0 0 234 419A15 15 0 0 0 250 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIKE</text>
<path d="M250,472L279,472A15 15 0 0 0 294 457A15 15 0 0 0 279 442L250,442A15 15 0 0 0 234 457A15 15 0 0 0 250 472Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="457" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GLOB</text>
<path d="M250,510L302,510A15 15 0 0 0 317 495A15 15 0 0 0 302 479L250,479A15 15 0 0 0 234 495A15 15 0 0 0 250 510Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REGEXP</text>
<path d="M250,547L297,547A15 15 0 0 0 313 532A15 15 0 0 0 297 517L250,517A15 15 0 0 0 234 532A15 15 0 0 0 250 547Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="274" y="532" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<path d="M378,510L427,510L427,479L378,479Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M378,434L427,434L427,404L378,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="465,449 454,454 454,445" style="fill:rgb(0,0,0)"/>
<path d="M427,419 L 435,419 Q 442,419 442,434 L 442,434 Q 442,449 451,449 L 460,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,464L532,464A15 15 0 0 0 547 449A15 15 0 0 0 532 434L480,434A15 15 0 0 0 465 449A15 15 0 0 0 480 464Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="506" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ESCAPE</text>
<polygon points="570,449 559,454 559,445" style="fill:rgb(0,0,0)"/>
<path d="M547,449L565,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M570,464L620,464L620,434L570,434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="595" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="671,419 659,423 659,415" style="fill:rgb(0,0,0)"/>
<path d="M620,449 L 627,449 Q 635,449 635,434 L 635,434 Q 635,419 650,419 L 650,419 L 665,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,419 905,423 905,415" style="fill:rgb(0,0,0)"/>
<path d="M671,419L910,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,419 L 924,419 Q 931,419 931,411 L 931,404"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,419 33,423 33,415" style="fill:rgb(0,0,0)"/>
<path d="M24,404 L 24,411 Q 24,419 31,419 L 39,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M100,419 L 108,419 Q 115,419 115,434 L 115,434 Q 115,449 130,449 L 177,449 Q 192,449 192,434 L 192,434 Q 192,419 199,419 L 207,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,532 223,537 223,528" style="fill:rgb(0,0,0)"/>
<path d="M196,419 L 204,419 Q 211,419 211,434 L 211,517 Q 211,532 220,532 L 229,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,457 223,461 223,452" style="fill:rgb(0,0,0)"/>
<path d="M211,442 L 211,449 Q 211,457 220,457 L 229,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,495 223,499 223,490" style="fill:rgb(0,0,0)"/>
<path d="M211,479 L 211,487 Q 211,495 220,495 L 229,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,419 367,423 367,415" style="fill:rgb(0,0,0)"/>
<path d="M288,419L372,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,532 329,537 329,528" style="fill:rgb(0,0,0)"/>
<path d="M313,532L334,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,495 367,499 367,490" style="fill:rgb(0,0,0)"/>
<path d="M340,532 L 348,532 Q 355,532 355,517 L 355,510 Q 355,495 364,495 L 372,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,495 329,499 329,490" style="fill:rgb(0,0,0)"/>
<path d="M317,495L334,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,495L378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,457 329,461 329,452" style="fill:rgb(0,0,0)"/>
<path d="M294,457L334,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,457 L 348,457 Q 355,457 355,472 L 355,480 Q 355,495 367,495 L 378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="506,419 495,423 495,415" style="fill:rgb(0,0,0)"/>
<path d="M427,419L501,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M506,419L659,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="547,495 536,499 536,490" style="fill:rgb(0,0,0)"/>
<path d="M427,495L542,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,495 L 656,495 Q 671,495 671,480 L 671,434 Q 671,419 686,419 L 692,419 L 707,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,585L94,585L94,555L45,555Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,570 119,574 119,566" style="fill:rgb(0,0,0)"/>
<path d="M94,570L124,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,585L194,585A15 15 0 0 0 209 570A15 15 0 0 0 194 555L145,555A15 15 0 0 0 130 570A15 15 0 0 0 145 585Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="170" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ISNULL</text>
<polygon points="916,570 905,574 905,566" style="fill:rgb(0,0,0)"/>
<path d="M209,570L910,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,570 L 924,570 Q 931,570 931,563 L 931,555"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,570 33,574 33,566" style="fill:rgb(0,0,0)"/>
<path d="M24,555 L 24,563 Q 24,570 31,570 L 39,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,623L215,623A15 15 0 0 0 230 608A15 15 0 0 0 215 593L145,593A15 15 0 0 0 130 608A15 15 0 0 0 145 623Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="608" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTNULL</text>
<path d="M145,661L165,661A15 15 0 0 0 180 646A15 15 0 0 0 165 631L145,631A15 15 0 0 0 130 646A15 15 0 0 0 145 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="203,646 192,650 192,641" style="fill:rgb(0,0,0)"/>
<path d="M180,646L198,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,661L250,661A15 15 0 0 0 265 646A15 15 0 0 0 250 631L219,631A15 15 0 0 0 203 646A15 15 0 0 0 219 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="288,646 276,650 276,641" style="fill:rgb(0,0,0)"/>
<path d="M265,646L282,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="339,570 327,574 327,566" style="fill:rgb(0,0,0)"/>
<path d="M288,646 L 295,646 Q 303,646 303,631 L 303,585 Q 303,570 318,570 L 318,570 L 333,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="288,608 276,612 276,604" style="fill:rgb(0,0,0)"/>
<path d="M230,608L282,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,608 L 295,608 Q 303,608 303,600 L 303,593"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,646 119,650 119,641" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,631 Q 109,646 117,646 L 124,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,608 119,612 119,604" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,593 Q 109,608 117,608 L 124,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,699L94,699L94,668L45,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,684 106,688 106,679" style="fill:rgb(0,0,0)"/>
<path d="M94,684L111,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,699A15 15 0 0 0 147 684A15 15 0 0 0 132 668A15 15 0 0 0 117 684A15 15 0 0 0 132 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IS</text>
<polygon points="183,684 172,688 172,679" style="fill:rgb(0,0,0)"/>
<path d="M147,684L178,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M198,699L219,699A15 15 0 0 0 234 684A15 15 0 0 0 219 668L198,668A15 15 0 0 0 183 684A15 15 0 0 0 198 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="270,684 258,688 258,679" style="fill:rgb(0,0,0)"/>
<path d="M234,684L264,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="306,684 294,688 294,679" style="fill:rgb(0,0,0)"/>
<path d="M270,684L300,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,699L389,699A15 15 0 0 0 404 684A15 15 0 0 0 389 668L321,668A15 15 0 0 0 306 684A15 15 0 0 0 321 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="440,684 429,688 429,679" style="fill:rgb(0,0,0)"/>
<path d="M404,684L434,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,699L490,699A15 15 0 0 0 505 684A15 15 0 0 0 490 668L455,668A15 15 0 0 0 440 684A15 15 0 0 0 455 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="541,684 530,688 530,679" style="fill:rgb(0,0,0)"/>
<path d="M505,684L535,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,699L590,699L590,668L541,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,684 905,688 905,679" style="fill:rgb(0,0,0)"/>
<path d="M590,684L910,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,684 L 924,684 Q 931,684 931,676 L 931,669"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,684 33,688 33,679" style="fill:rgb(0,0,0)"/>
<path d="M24,668 L 24,676 Q 24,684 31,684 L 39,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,684 L 156,684 Q 164,684 164,696 Q 164,708 179,708 L 230,708 Q 245,708 245,696 Q 245,684 253,684 L 260,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,684 L 279,684 Q 286,684 286,696 Q 286,708 301,708 L 502,708 Q 517,708 517,696 Q 517,684 524,684 L 532,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,744L94,744L94,714L45,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,729 119,733 119,725" style="fill:rgb(0,0,0)"/>
<path d="M94,729L124,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,744L165,744A15 15 0 0 0 180 729A15 15 0 0 0 165 714L145,714A15 15 0 0 0 130 729A15 15 0 0 0 145 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,729 205,733 205,725" style="fill:rgb(0,0,0)"/>
<path d="M180,729L211,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,744L304,744A15 15 0 0 0 319 729A15 15 0 0 0 304 714L232,714A15 15 0 0 0 216 729A15 15 0 0 0 232 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="342,729 331,733 331,725" style="fill:rgb(0,0,0)"/>
<path d="M319,729L336,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M342,744L391,744L391,714L342,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="367" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="414,729 403,733 403,725" style="fill:rgb(0,0,0)"/>
<path d="M391,729L409,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M430,744L450,744A15 15 0 0 0 465 729A15 15 0 0 0 450 714L430,714A15 15 0 0 0 414 729A15 15 0 0 0 430 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="488,729 477,733 477,725" style="fill:rgb(0,0,0)"/>
<path d="M465,729L483,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,744L538,744L538,714L488,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="513" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,729 905,733 905,725" style="fill:rgb(0,0,0)"/>
<path d="M538,729L910,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,729 L 924,729 Q 931,729 931,721 L 931,714"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,729 33,733 33,725" style="fill:rgb(0,0,0)"/>
<path d="M24,714 L 24,721 Q 24,729 31,729 L 39,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,729 L 103,729 Q 110,729 110,741 Q 110,753 125,753 L 177,753 Q 192,753 192,741 Q 192,729 199,729 L 207,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,797L94,797L94,767L45,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,782 119,786 119,778" style="fill:rgb(0,0,0)"/>
<path d="M94,782L124,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,797L165,797A15 15 0 0 0 180 782A15 15 0 0 0 165 767L145,767A15 15 0 0 0 130 782A15 15 0 0 0 145 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,782 205,786 205,778" style="fill:rgb(0,0,0)"/>
<path d="M180,782L211,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,797L234,797A15 15 0 0 0 249 782A15 15 0 0 0 234 767L232,767A15 15 0 0 0 216 782A15 15 0 0 0 232 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IN</text>
<polygon points="285,782 273,786 273,778" style="fill:rgb(0,0,0)"/>
<path d="M249,782L279,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,797A15 15 0 0 0 315 782A15 15 0 0 0 300 767A15 15 0 0 0 285 782A15 15 0 0 0 300 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,782 340,786 340,778" style="fill:rgb(0,0,0)"/>
<path d="M315,782L345,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,797L455,797L455,767L351,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="491,782 480,786 480,778" style="fill:rgb(0,0,0)"/>
<path d="M455,782L486,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M507,797A15 15 0 0 0 522 782A15 15 0 0 0 507 767A15 15 0 0 0 491 782A15 15 0 0 0 507 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="507" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,782 905,786 905,778" style="fill:rgb(0,0,0)"/>
<path d="M522,782L910,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,782 L 924,782 Q 931,782 931,774 L 931,767"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,782 33,786 33,778" style="fill:rgb(0,0,0)"/>
<path d="M24,767 L 24,774 Q 24,782 31,782 L 39,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,782 L 103,782 Q 110,782 110,794 Q 110,806 125,806 L 177,806 Q 192,806 192,794 Q 192,782 199,782 L 207,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,782 L 324,782 Q 332,782 332,770 Q 332,758 347,758 L 452,758 Q 467,758 467,770 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M379,835L428,835L428,805L379,805Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="820" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="379,820 367,824 367,815" style="fill:rgb(0,0,0)"/>
<path d="M317,782 L 324,782 Q 332,782 332,797 L 332,805 Q 332,820 347,820 L 358,820 L 373,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M428,820 L 452,820 Q 467,820 467,805 L 467,797 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,873A15 15 0 0 0 418 857A15 15 0 0 0 403 842A15 15 0 0 0 388 857A15 15 0 0 0 403 873Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="857" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,857 430,853 430,862" style="fill:rgb(0,0,0)"/>
<path d="M428,820 L 435,820 Q 443,820 443,835 L 443,842 Q 443,857 434,857 L 424,857"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,857 L 371,857 Q 356,857 356,842 L 356,835 Q 356,820 363,820 L 371,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,925L396,925A15 15 0 0 0 412 910A15 15 0 0 0 396 895L300,895A15 15 0 0 0 285 910A15 15 0 0 0 300 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="429,910 417,915 417,906" style="fill:rgb(0,0,0)"/>
<path d="M412,910L423,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,925A15 15 0 0 0 459 910A15 15 0 0 0 444 895A15 15 0 0 0 429 910A15 15 0 0 0 444 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="513,910 502,915 502,906" style="fill:rgb(0,0,0)"/>
<path d="M459,910L507,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,925L627,925A15 15 0 0 0 642 910A15 15 0 0 0 627 895L528,895A15 15 0 0 0 513 910A15 15 0 0 0 528 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="577" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function</text>
<polygon points="659,910 647,915 647,906" style="fill:rgb(0,0,0)"/>
<path d="M642,910L653,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,925A15 15 0 0 0 689 910A15 15 0 0 0 674 895A15 15 0 0 0 659 910A15 15 0 0 0 674 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="734,910 723,915 723,906" style="fill:rgb(0,0,0)"/>
<path d="M689,910L728,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,925L783,925L783,895L734,895Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="828,910 817,915 817,906" style="fill:rgb(0,0,0)"/>
<path d="M783,910L823,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M844,925A15 15 0 0 0 859 910A15 15 0 0 0 844 895A15 15 0 0 0 828 910A15 15 0 0 0 844 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="844" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,910 905,915 905,906" style="fill:rgb(0,0,0)"/>
<path d="M859,910L910,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,910 L 924,910 Q 931,910 931,903 L 931,895"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,865L603,865A15 15 0 0 0 619 850A15 15 0 0 0 603 835L528,835A15 15 0 0 0 513 850A15 15 0 0 0 528 865Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="850" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="916,850 905,854 905,846" style="fill:rgb(0,0,0)"/>
<path d="M619,850L910,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,850 L 924,850 Q 931,850 931,842 L 931,835"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="513,850 502,854 502,846" style="fill:rgb(0,0,0)"/>
<path d="M475,910 L 483,910 Q 490,910 490,895 L 490,865 Q 490,850 499,850 L 507,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,892A15 15 0 0 0 774 877A15 15 0 0 0 759 862A15 15 0 0 0 744 877A15 15 0 0 0 759 892Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="877" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="774,877 785,873 785,881" style="fill:rgb(0,0,0)"/>
<path d="M783,910 L 791,910 Q 798,910 798,895 L 798,892 Q 798,877 789,877 L 780,877"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M744,877 L 726,877 Q 711,877 711,892 L 711,895 Q 711,910 719,910 L 726,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M689,910 L 697,910 Q 704,910 704,921 Q 704,932 719,932 L 790,932 Q 805,932 805,921 Q 805,910 813,910 L 820,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="285,910 273,915 273,906" style="fill:rgb(0,0,0)"/>
<path d="M249,782 L 256,782 Q 264,782 264,797 L 264,895 Q 264,910 272,910 L 279,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,882 412,886 412,877" style="fill:rgb(0,0,0)"/>
<path d="M264,867 L 264,874 Q 264,882 279,882 L 402,882 L 417,882"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,882 L 456,882 Q 471,882 471,896 Q 471,910 478,910 L 486,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,971L80,971A15 15 0 0 0 95 956A15 15 0 0 0 80 941L60,941A15 15 0 0 0 45 956A15 15 0 0 0 60 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="131,956 120,960 120,951" style="fill:rgb(0,0,0)"/>
<path d="M95,956L125,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,971L191,971A15 15 0 0 0 206 956A15 15 0 0 0 191 941L146,941A15 15 0 0 0 131 956A15 15 0 0 0 146 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="242,956 231,960 231,951" style="fill:rgb(0,0,0)"/>
<path d="M206,956L236,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,971A15 15 0 0 0 272 956A15 15 0 0 0 257 941A15 15 0 0 0 242 956A15 15 0 0 0 257 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="295,956 284,960 284,951" style="fill:rgb(0,0,0)"/>
<path d="M272,956L290,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,971L400,971L400,941L295,941Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="423,956 411,960 411,951" style="fill:rgb(0,0,0)"/>
<path d="M400,956L417,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,971A15 15 0 0 0 453 956A15 15 0 0 0 438 941A15 15 0 0 0 423 956A15 15 0 0 0 438 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,956 905,960 905,951" style="fill:rgb(0,0,0)"/>
<path d="M453,956L910,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,956 L 924,956 Q 931,956 931,948 L 931,941"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,956 33,960 33,951" style="fill:rgb(0,0,0)"/>
<path d="M24,941 L 24,948 Q 24,956 31,956 L 39,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,929 59,934 59,925" style="fill:rgb(0,0,0)"/>
<path d="M24,914 L 24,922 Q 24,929 39,929 L 49,929 L 64,929"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,929 L 201,929 Q 216,929 216,943 Q 216,956 223,956 L 231,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,929 L 101,929 Q 108,929 108,943 Q 108,956 116,956 L 123,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,1009L89,1009A15 15 0 0 0 104 994A15 15 0 0 0 89 978L60,978A15 15 0 0 0 45 994A15 15 0 0 0 60 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASE</text>
<polygon points="140,994 128,998 128,989" style="fill:rgb(0,0,0)"/>
<path d="M104,994L134,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M140,1009L189,1009L189,978L140,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="243,994 232,998 232,989" style="fill:rgb(0,0,0)"/>
<path d="M189,994L237,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,1009L298,1009A15 15 0 0 0 313 994A15 15 0 0 0 298 978L258,978A15 15 0 0 0 243 994A15 15 0 0 0 258 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="336,994 324,998 324,989" style="fill:rgb(0,0,0)"/>
<path d="M313,994L330,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,1009L385,1009L385,978L336,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="408,994 396,998 396,989" style="fill:rgb(0,0,0)"/>
<path d="M385,994L402,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,1009L456,1009A15 15 0 0 0 472 994A15 15 0 0 0 456 978L423,978A15 15 0 0 0 408 994A15 15 0 0 0 423 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">THEN</text>
<polygon points="495,994 483,998 483,989" style="fill:rgb(0,0,0)"/>
<path d="M472,994L489,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M495,1009L544,1009L544,978L495,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="616,994 604,998 604,989" style="fill:rgb(0,0,0)"/>
<path d="M544,994L610,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M631,1009L658,1009A15 15 0 0 0 673 994A15 15 0 0 0 658 978L631,978A15 15 0 0 0 616 994A15 15 0 0 0 631 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="645" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ELSE</text>
<polygon points="696,994 685,998 685,989" style="fill:rgb(0,0,0)"/>
<path d="M673,994L691,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M696,1009L746,1009L746,978L696,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="721" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="782,994 770,998 770,989" style="fill:rgb(0,0,0)"/>
<path d="M746,994L776,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M797,1009L818,1009A15 15 0 0 0 833 994A15 15 0 0 0 818 978L797,978A15 15 0 0 0 782 994A15 15 0 0 0 797 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="807" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="916,994 905,998 905,989" style="fill:rgb(0,0,0)"/>
<path d="M833,994L910,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,994 L 924,994 Q 931,994 931,986 L 931,979"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,994 33,998 33,989" style="fill:rgb(0,0,0)"/>
<path d="M24,978 L 24,986 Q 24,994 31,994 L 39,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,994 L 111,994 Q 119,994 119,1007 Q 119,1021 134,1021 L 186,1021 Q 201,1021 201,1007 Q 201,994 208,994 L 216,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="360,1021 372,1016 372,1025" style="fill:rgb(0,0,0)"/>
<path d="M544,994 L 551,994 Q 559,994 559,1007 Q 559,1021 544,1021 L 381,1021 L 366,1021"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,1021 L 235,1021 Q 220,1021 220,1007 Q 220,994 227,994 L 235,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,994 L 585,994 Q 593,994 593,1007 Q 593,1021 608,1021 L 742,1021 Q 757,1021 757,1007 Q 757,994 765,994 L 772,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,1066L173,1066L173,1036L45,1036Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="1051" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">raise-function</text>
<polygon points="916,1051 905,1055 905,1047" style="fill:rgb(0,0,0)"/>
<path d="M173,1051L910,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,1051 L 924,1051 Q 931,1051 931,1036 L 931,32 Q 931,17 939,17 L 946,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,1051 33,1055 33,1047" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,1036 Q 24,1051 31,1051 L 39,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/filter-clause.html">filter-clause:</a></b>
<button id='xe941b5aa' onclick='hideorshow("xe941b5aa","x41fd2c58")'>show</button></p>
 <div id='x41fd2c58' style='display:none;' class='imgcontainer'>
 <div style="max-width:422px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 422.381 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L93,32A15 15 0 0 0 108 17A15 15 0 0 0 93 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FILTER</text>
<polygon points="131,17 119,21 119,12" style="fill:rgb(0,0,0)"/>
<path d="M108,17L125,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,32L146,32A15 15 0 0 0 161 17A15 15 0 0 0 146 2L146,2A15 15 0 0 0 131 17A15 15 0 0 0 146 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="184,17 173,21 173,12" style="fill:rgb(0,0,0)"/>
<path d="M161,17L178,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M199,32L249,32A15 15 0 0 0 264 17A15 15 0 0 0 249 2L199,2A15 15 0 0 0 184 17A15 15 0 0 0 199 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="224" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="287,17 275,21 275,12" style="fill:rgb(0,0,0)"/>
<path d="M264,17L281,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,32L336,32L336,2L287,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M336,17L353,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,32A15 15 0 0 0 389 17A15 15 0 0 0 374 2A15 15 0 0 0 359 17A15 15 0 0 0 374 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="374" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="413,17 401,21 401,12" style="fill:rgb(0,0,0)"/>
<path d="M389,17L407,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="416" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/function-arguments.html">function-arguments:</a></b>
<button id='x3adab7da' onclick='hideorshow("x3adab7da","x248b4462")'>show</button></p>
 <div id='x248b4462' style='display:none;' class='imgcontainer'>
 <div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.566 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,26 55,30 55,22" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,41 L 43,41 Q 43,26 52,26 L 61,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M82,41L150,41A15 15 0 0 0 165 26L165,26A15 15 0 0 0 150 11L82,11A15 15 0 0 0 66 26L66,26A15 15 0 0 0 82 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="183,26 171,30 171,22" style="fill:rgb(0,0,0)"/>
<path d="M165,26L177,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M183,26 L 189,26 Q 194,26 194,41 L 194,41 Q 194,56 203,56 L 212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M218,56L248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,71L303,71L303,41L254,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="447,56 435,60 435,52" style="fill:rgb(0,0,0)"/>
<path d="M303,56L441,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="116,56 104,60 104,52" style="fill:rgb(0,0,0)"/>
<path d="M32,56L110,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M116,56L212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,32A15 15 0 0 0 293 17A15 15 0 0 0 278 2A15 15 0 0 0 263 17A15 15 0 0 0 278 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="293,17 305,12 305,21" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 314,56 Q 326,56 326,41 L 326,32 Q 326,17 312,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M263,17 L 245,17 Q 230,17 230,32 L 230,41 Q 230,56 239,56 L 248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,207A15 15 0 0 0 243 192L243,192A15 15 0 0 0 228 177A15 15 0 0 0 213 192L213,192A15 15 0 0 0 228 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="213,192 201,196 201,188" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,71 L 43,177 Q 43,192 58,192 L 192,192 L 207,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,192 267,196 267,188" style="fill:rgb(0,0,0)"/>
<path d="M243,192L272,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,192 L 360,192 Q 375,192 390,192 L 394,192 Q 409,192 409,177 L 409,71 Q 409,56 415,56 L 421,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="228,216 216,221 216,212" style="fill:rgb(0,0,0)"/>
<path d="M116,192 L 181,192 Q 196,192 196,204 Q 196,216 209,216 L 222,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,216 L 242,216 Q 257,216 257,204 Q 257,192 262,192 L 268,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="90,117 78,121 78,112" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 313,56 Q 323,56 323,71 L 323,71 Q 323,86 308,86 L 81,86 Q 66,86 66,101 L 66,102 Q 66,117 75,117 L 84,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,132L149,132A15 15 0 0 0 164 117L164,117A15 15 0 0 0 149 101L105,101A15 15 0 0 0 90 117L90,117A15 15 0 0 0 105 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="182,117 170,121 170,112" style="fill:rgb(0,0,0)"/>
<path d="M164,117L176,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,132L201,132A15 15 0 0 0 216 117L216,117A15 15 0 0 0 201 101L197,101A15 15 0 0 0 182 117L182,117A15 15 0 0 0 197 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M216,117L239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,132L375,132L375,101L245,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,169A15 15 0 0 0 325 154A15 15 0 0 0 310 139A15 15 0 0 0 294 154A15 15 0 0 0 310 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,154 336,150 336,159" style="fill:rgb(0,0,0)"/>
<path d="M375,117 L 380,117 Q 386,117 386,132 L 386,139 Q 386,154 371,154 L 345,154 L 330,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M294,154 L 260,154 Q 245,154 236,154 Q 227,154 227,139 L 227,132 Q 227,117 233,117 L 239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M375,117 L 383,117 Q 392,117 392,102 L 392,71 Q 392,56 407,56 L 413,56 L 428,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x94e106ec' onclick='hideorshow("x94e106ec","x1d852ea4")'>show</button></p>
 <div id='x1d852ea4' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/literal-value.html">literal-value:</a></b>
<button id='x42adb686' onclick='hideorshow("x42adb686","xcc64a89d")'>show</button></p>
 <div id='xcc64a89d' style='display:none;' class='imgcontainer'>
 <div style="max-width:341px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 341.376 336.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,319 39,324 39,315" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,304 Q 24,319 34,319 L 45,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,334L252,334A15 15 0 0 0 267 319A15 15 0 0 0 252 304L65,304A15 15 0 0 0 50 319A15 15 0 0 0 65 334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIMESTAMP</text>
<polygon points="290,319 278,324 278,315" style="fill:rgb(0,0,0)"/>
<path d="M267,319L284,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,17 320,21 320,12" style="fill:rgb(0,0,0)"/>
<path d="M290,319 L 297,319 Q 305,319 305,304 L 305,32 Q 305,17 315,17 L 326,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="335" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L172,32A15 15 0 0 0 187 17A15 15 0 0 0 172 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="119" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,17L320,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L153,70A15 15 0 0 0 168 55L168,55A15 15 0 0 0 153 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">string-literal</text>
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,47 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,55 278,59 278,50" style="fill:rgb(0,0,0)"/>
<path d="M168,55L284,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,55 L 297,55 Q 305,55 305,47 L 305,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L140,108A15 15 0 0 0 155 92A15 15 0 0 0 140 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">blob-literal</text>
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,85 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,92 278,97 278,88" style="fill:rgb(0,0,0)"/>
<path d="M155,92L284,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,92 L 297,92 Q 305,92 305,85 L 305,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,145L97,145A15 15 0 0 0 112 130A15 15 0 0 0 97 115L66,115A15 15 0 0 0 50 130A15 15 0 0 0 66 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="50,130 39,135 39,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 34,130 L 45,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,130 278,135 278,126" style="fill:rgb(0,0,0)"/>
<path d="M112,130L284,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,130 L 297,130 Q 305,130 305,123 L 305,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,183L96,183A15 15 0 0 0 111 168A15 15 0 0 0 96 153L66,153A15 15 0 0 0 50 168A15 15 0 0 0 66 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRUE</text>
<polygon points="50,168 39,172 39,164" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,160 Q 24,168 34,168 L 45,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,168 278,172 278,164" style="fill:rgb(0,0,0)"/>
<path d="M111,168L284,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,168 L 297,168 Q 305,168 305,160 L 305,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,221L104,221A15 15 0 0 0 119 206A15 15 0 0 0 104 191L66,191A15 15 0 0 0 50 206A15 15 0 0 0 66 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FALSE</text>
<polygon points="50,206 39,210 39,201" style="fill:rgb(0,0,0)"/>
<path d="M24,191 L 24,198 Q 24,206 34,206 L 45,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,206 278,210 278,201" style="fill:rgb(0,0,0)"/>
<path d="M119,206L284,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,206 L 297,206 Q 305,206 305,198 L 305,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,259L190,259A15 15 0 0 0 205 244A15 15 0 0 0 190 228L66,228A15 15 0 0 0 50 244A15 15 0 0 0 66 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="128" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIME</text>
<polygon points="50,244 39,248 39,239" style="fill:rgb(0,0,0)"/>
<path d="M24,228 L 24,236 Q 24,244 34,244 L 45,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,244 278,248 278,239" style="fill:rgb(0,0,0)"/>
<path d="M205,244L284,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,244 L 297,244 Q 305,244 305,236 L 305,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,297L192,297A15 15 0 0 0 207 281A15 15 0 0 0 192 266L66,266A15 15 0 0 0 50 281A15 15 0 0 0 66 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_DATE</text>
<polygon points="50,281 39,286 39,277" style="fill:rgb(0,0,0)"/>
<path d="M24,266 L 24,274 Q 24,281 34,281 L 45,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,281 278,286 278,277" style="fill:rgb(0,0,0)"/>
<path d="M207,281L284,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,281 L 297,281 Q 305,281 305,274 L 305,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/over-clause.html">over-clause:</a></b>
<button id='xf0a940ef' onclick='hideorshow("xf0a940ef","x404355f1")'>show</button></p>
 <div id='x404355f1' style='display:none;' class='imgcontainer'>
 <div style="max-width:600px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 600.706 418.392">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="129,17 117,21 117,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L123,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M144,32L241,32A15 15 0 0 0 256 17A15 15 0 0 0 241 2L144,2A15 15 0 0 0 129 17A15 15 0 0 0 144 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,17 L 100,17 Q 108,17 108,32 L 108,40 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,70A15 15 0 0 0 165 55L165,55A15 15 0 0 0 149 39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 149 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="149" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="206,82 195,86 195,77" style="fill:rgb(0,0,0)"/>
<path d="M165,55 L 172,55 Q 180,55 180,68 Q 180,82 190,82 L 200,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,97L363,97A15 15 0 0 0 378 82A15 15 0 0 0 363 67L221,67A15 15 0 0 0 206 82A15 15 0 0 0 221 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="292" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M221,173L301,173A15 15 0 0 0 316 157A15 15 0 0 0 301 142L221,142A15 15 0 0 0 206 157A15 15 0 0 0 221 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="339,157 328,162 328,153" style="fill:rgb(0,0,0)"/>
<path d="M316,157L333,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,173L358,173A15 15 0 0 0 373 157A15 15 0 0 0 358 142L354,142A15 15 0 0 0 339 157A15 15 0 0 0 354 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="409,157 398,162 398,153" style="fill:rgb(0,0,0)"/>
<path d="M373,157L404,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,173L459,173L459,142L409,142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M434,210A15 15 0 0 0 449 195A15 15 0 0 0 434 180A15 15 0 0 0 419 195A15 15 0 0 0 434 210Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="195" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="449,195 461,191 461,200" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,180 Q 474,195 464,195 L 455,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,195 L 398,195 Q 383,195 383,180 L 383,172 Q 383,157 390,157 L 398,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,55 280,59 280,50" style="fill:rgb(0,0,0)"/>
<path d="M165,55L286,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,120 304,115 304,124" style="fill:rgb(0,0,0)"/>
<path d="M292,55 L 401,55 Q 416,55 416,70 L 416,105 Q 416,120 401,120 L 313,120 L 298,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,157 195,162 195,153" style="fill:rgb(0,0,0)"/>
<path d="M292,120 L 180,120 Q 165,120 165,135 L 165,142 Q 165,157 180,157 L 185,157 L 200,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="401,82 389,86 389,77" style="fill:rgb(0,0,0)"/>
<path d="M378,82L395,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,82 L 408,82 Q 416,82 416,89 L 416,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,286L266,286A15 15 0 0 0 281 271A15 15 0 0 0 266 256L221,256A15 15 0 0 0 206 271A15 15 0 0 0 221 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="244" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="304,271 292,275 292,266" style="fill:rgb(0,0,0)"/>
<path d="M281,271L298,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M319,286L323,286A15 15 0 0 0 338 271A15 15 0 0 0 323 256L319,256A15 15 0 0 0 304 271A15 15 0 0 0 319 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="321" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="374,271 363,275 363,266" style="fill:rgb(0,0,0)"/>
<path d="M338,271L368,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,286L504,286L504,256L374,256Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M439,324A15 15 0 0 0 454 309A15 15 0 0 0 439 293A15 15 0 0 0 424 309A15 15 0 0 0 439 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="454,309 466,304 466,313" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,294 Q 519,309 504,309 L 475,309 L 460,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,309 L 363,309 Q 348,309 348,294 L 348,286 Q 348,271 355,271 L 363,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,233 304,229 304,237" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,218 Q 474,233 459,233 L 313,233 L 298,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,271 195,275 195,266" style="fill:rgb(0,0,0)"/>
<path d="M292,233 L 180,233 Q 165,233 165,248 L 165,256 Q 165,271 180,271 L 185,271 L 200,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,195 160,184 169,184" style="fill:rgb(0,0,0)"/>
<path d="M165,142L165,189"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,195L165,256"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,399L311,399L311,369L206,369Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="384" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="519,384 508,389 508,380" style="fill:rgb(0,0,0)"/>
<path d="M311,384L513,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M534,399A15 15 0 0 0 549 384A15 15 0 0 0 534 369A15 15 0 0 0 519 384A15 15 0 0 0 534 399Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="384" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="591,17 579,21 579,12" style="fill:rgb(0,0,0)"/>
<path d="M549,384 L 557,384 Q 564,384 564,369 L 564,32 Q 564,17 575,17 L 585,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="594" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,17 508,21 508,12" style="fill:rgb(0,0,0)"/>
<path d="M256,17L513,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,17L579,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,346 304,342 304,351" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,331 Q 519,346 504,346 L 313,346 L 298,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,384 195,389 195,380" style="fill:rgb(0,0,0)"/>
<path d="M292,346 L 180,346 Q 165,346 165,361 L 165,369 Q 165,384 180,384 L 185,384 L 200,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,309 160,297 169,297" style="fill:rgb(0,0,0)"/>
<path d="M165,256L165,303"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,309L165,369"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="258,411 247,416 247,407" style="fill:rgb(0,0,0)"/>
<path d="M165,369 L 165,396 Q 165,411 180,411 L 238,411 L 253,411"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,384 369,389 369,380" style="fill:rgb(0,0,0)"/>
<path d="M258,411 L 335,411 Q 350,411 350,398 Q 350,384 362,384 L 375,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x1d7f91cc' onclick='hideorshow("x1d7f91cc","x136c9e58")'>show</button></p>
 <div id='x136c9e58' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='xad6797ec' onclick='hideorshow("xad6797ec","xc3a5b88f")'>show</button></p>
 <div id='xc3a5b88f' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/raise-function.html">raise-function:</a></b>
<button id='x813cd4c3' onclick='hideorshow("x813cd4c3","x6cd4c728")'>show</button></p>
 <div id='x6cd4c728' style='display:none;' class='imgcontainer'>
 <div style="max-width:627px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 627.302 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L82,32A15 15 0 0 0 97 17A15 15 0 0 0 82 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RAISE</text>
<polygon points="120,17 109,21 109,12" style="fill:rgb(0,0,0)"/>
<path d="M97,17L114,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,32L135,32A15 15 0 0 0 150 17A15 15 0 0 0 135 2L135,2A15 15 0 0 0 120 17A15 15 0 0 0 135 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="135" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="192,55 180,59 180,50" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 158,17 Q 165,17 165,32 L 165,40 Q 165,55 176,55 L 186,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,70L285,70A15 15 0 0 0 300 55L300,55A15 15 0 0 0 285 39L207,39A15 15 0 0 0 192 55L192,55A15 15 0 0 0 207 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="336,55 324,59 324,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70A15 15 0 0 0 366 55L366,55A15 15 0 0 0 351 39A15 15 0 0 0 336 55L336,55A15 15 0 0 0 351 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="389,55 378,59 378,50" style="fill:rgb(0,0,0)"/>
<path d="M366,55L383,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,70L508,70A15 15 0 0 0 523 55L523,55A15 15 0 0 0 508 39L404,39A15 15 0 0 0 389 55L389,55A15 15 0 0 0 404 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="456" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">error-message</text>
<polygon points="564,17 553,21 553,12" style="fill:rgb(0,0,0)"/>
<path d="M523,55 L 530,55 Q 538,55 538,40 L 538,32 Q 538,17 548,17 L 558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M579,32A15 15 0 0 0 594 17A15 15 0 0 0 579 2A15 15 0 0 0 564 17A15 15 0 0 0 579 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="617,17 606,21 606,12" style="fill:rgb(0,0,0)"/>
<path d="M594,17L612,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="621" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L259,32A15 15 0 0 0 274 17A15 15 0 0 0 259 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="456,17 444,21 444,12" style="fill:rgb(0,0,0)"/>
<path d="M274,17L450,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,17L553,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,108L249,108A15 15 0 0 0 264 92A15 15 0 0 0 249 77L207,77A15 15 0 0 0 192 92A15 15 0 0 0 207 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="300,92 288,97 288,88" style="fill:rgb(0,0,0)"/>
<path d="M264,92L294,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,92 L 307,92 Q 315,92 315,77 L 315,70 Q 315,55 322,55 L 330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,145L229,145A15 15 0 0 0 244 130A15 15 0 0 0 229 115L207,115A15 15 0 0 0 192 130A15 15 0 0 0 207 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="300,130 288,135 288,126" style="fill:rgb(0,0,0)"/>
<path d="M244,130L294,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,130 L 307,130 Q 315,130 315,115 L 315,92 L 315,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,130 180,135 180,126" style="fill:rgb(0,0,0)"/>
<path d="M165,39 L 165,115 Q 165,130 176,130 L 186,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,92 180,97 180,88" style="fill:rgb(0,0,0)"/>
<path d="M165,77 L 165,85 Q 165,92 176,92 L 186,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/select-stmt.html">select-stmt:</a></b>
<button id='xb70f255b' onclick='hideorshow("xb70f255b","x7107a7e6")'>show</button></p>
 <div id='x7107a7e6' style='display:none;' class='imgcontainer'>
 <div style="max-width:669px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 669.677 1162.3">
<path d="M55,845L667,845L667,99L55,99Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="6" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="46,17 34,21 34,12" style="fill:rgb(0,0,0)"/>
<path d="M10,17L40,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M61,32L92,32A15 15 0 0 0 107 17A15 15 0 0 0 92 2L61,2A15 15 0 0 0 46 17A15 15 0 0 0 61 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="76" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M167,62L253,62A15 15 0 0 0 268 47L268,47A15 15 0 0 0 253 32L167,32A15 15 0 0 0 152 47L152,47A15 15 0 0 0 167 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="210,17 198,21 198,12" style="fill:rgb(0,0,0)"/>
<path d="M107,17L204,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M210,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M358,32L584,32L584,2L358,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="152,47 140,51 140,43" style="fill:rgb(0,0,0)"/>
<path d="M107,17 L 114,17 Q 122,17 122,32 L 122,32 Q 122,47 134,47 L 146,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="291,47 279,51 279,43" style="fill:rgb(0,0,0)"/>
<path d="M268,47L285,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,47 L 298,47 Q 306,47 306,32 L 306,32 Q 306,17 321,17 L 331,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,70A15 15 0 0 0 486 55L486,55A15 15 0 0 0 471 39A15 15 0 0 0 456 55L456,55A15 15 0 0 0 471 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="486,55 498,50 498,59" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,40 Q 599,55 584,55 L 507,55 L 492,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,55 L 350,55 Q 335,55 335,40 L 335,32 Q 335,17 340,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,83 307,79 307,88" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,68 Q 599,83 584,83 L 316,83 L 301,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,83 L 40,83 Q 25,83 25,98 L 25,113"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="25,47 20,36 29,36" style="fill:rgb(0,0,0)"/>
<path d="M10,17 L 17,17 Q 25,17 25,29 L 25,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="55,129 43,133 43,124" style="fill:rgb(0,0,0)"/>
<path d="M25,47 L 25,114 Q 25,129 37,129 L 49,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,129 115,133 115,124" style="fill:rgb(0,0,0)"/>
<path d="M55,129L121,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,144L193,144A15 15 0 0 0 208 129A15 15 0 0 0 193 114L142,114A15 15 0 0 0 127 129A15 15 0 0 0 142 144Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="250,159 238,163 238,155" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,144 Q 223,159 233,159 L 244,159"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,174L333,174A15 15 0 0 0 348 159A15 15 0 0 0 333 144L265,144A15 15 0 0 0 250 159A15 15 0 0 0 265 174Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="159" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="417,129 406,133 406,124" style="fill:rgb(0,0,0)"/>
<path d="M348,159 L 356,159 Q 363,159 363,144 L 363,144 Q 363,129 378,129 L 396,129 L 411,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,144L545,144L545,114L417,114Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M481,182A15 15 0 0 0 496 166A15 15 0 0 0 481 151A15 15 0 0 0 466 166A15 15 0 0 0 481 182Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="166" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="496,166 508,162 508,171" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,151 Q 560,166 545,166 L 517,166 L 502,166"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M466,166 L 406,166 Q 391,166 391,151 L 391,144 Q 391,129 398,129 L 406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,129 287,133 287,124" style="fill:rgb(0,0,0)"/>
<path d="M208,129L293,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M299,129L406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,212L280,212A15 15 0 0 0 295 197A15 15 0 0 0 280 182L265,182A15 15 0 0 0 250 197A15 15 0 0 0 265 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="197" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="348,197 337,201 337,192" style="fill:rgb(0,0,0)"/>
<path d="M295,197L342,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,197 L 356,197 Q 363,197 363,182 L 363,159 L 363,144"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="250,197 238,201 238,192" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,182 Q 223,197 233,197 L 244,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,287L203,287A15 15 0 0 0 218 272A15 15 0 0 0 203 257L168,257A15 15 0 0 0 153 272A15 15 0 0 0 168 287Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="186" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="290,272 279,277 279,268" style="fill:rgb(0,0,0)"/>
<path d="M218,272L284,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,287L451,287L451,257L290,257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M320,362L422,362L422,331L320,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M371,324A15 15 0 0 0 386 309A15 15 0 0 0 371 293A15 15 0 0 0 356 309A15 15 0 0 0 371 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="386,309 397,304 397,313" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 459,272 Q 466,272 466,287 L 466,294 Q 466,309 451,309 L 407,309 L 392,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M356,309 L 279,309 Q 264,309 264,294 L 264,287 Q 264,272 271,272 L 279,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="320,346 308,351 308,342" style="fill:rgb(0,0,0)"/>
<path d="M218,272 L 226,272 Q 233,272 233,287 L 233,331 Q 233,346 248,346 L 299,346 L 314,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="484,313 488,325 480,325" style="fill:rgb(0,0,0)"/>
<path d="M422,346 L 436,346 Q 451,346 466,346 L 469,346 Q 484,346 484,333 L 484,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,272 494,277 494,268" style="fill:rgb(0,0,0)"/>
<path d="M484,313 L 484,287 Q 484,272 492,272 L 499,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,272 L 496,272 Q 487,272 487,272 Q 487,272 495,272 L 502,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,197 555,185 564,185" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,176 L 560,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,235 360,230 360,239" style="fill:rgb(0,0,0)"/>
<path d="M560,197 L 560,220 Q 560,235 545,235 L 369,235 L 354,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,272 142,277 142,268" style="fill:rgb(0,0,0)"/>
<path d="M348,235 L 142,235 Q 127,235 127,250 L 127,257 Q 127,272 137,272 L 147,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,437L218,437A15 15 0 0 0 233 422A15 15 0 0 0 218 407L168,407A15 15 0 0 0 153 422A15 15 0 0 0 168 437Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="256,422 244,426 244,418" style="fill:rgb(0,0,0)"/>
<path d="M233,422L250,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,437L305,437L305,407L256,407Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="517,324 513,312 521,312" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 502,272 Q 517,272 517,287 L 517,303 L 517,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,384 382,380 382,389" style="fill:rgb(0,0,0)"/>
<path d="M517,324 L 517,369 Q 517,384 502,384 L 391,384 L 376,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,422 142,426 142,418" style="fill:rgb(0,0,0)"/>
<path d="M371,384 L 142,384 Q 127,384 127,399 L 127,407 Q 127,422 137,422 L 147,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,324 122,312 131,312" style="fill:rgb(0,0,0)"/>
<path d="M127,257L127,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,324L127,407"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,535L212,535A15 15 0 0 0 227 520A15 15 0 0 0 212 505L168,505A15 15 0 0 0 153 520A15 15 0 0 0 168 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="250,520 238,525 238,516" style="fill:rgb(0,0,0)"/>
<path d="M227,520L244,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,535L269,535A15 15 0 0 0 284 520A15 15 0 0 0 269 505L265,505A15 15 0 0 0 250 520A15 15 0 0 0 265 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="320,520 309,525 309,516" style="fill:rgb(0,0,0)"/>
<path d="M284,520L314,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,535L369,535L369,505L320,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="452,520 441,525 441,516" style="fill:rgb(0,0,0)"/>
<path d="M369,520L446,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,535L520,535A15 15 0 0 0 535 520A15 15 0 0 0 520 505L467,505A15 15 0 0 0 452 520A15 15 0 0 0 467 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="558,520 546,525 546,516" style="fill:rgb(0,0,0)"/>
<path d="M535,520L552,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,535L607,535L607,505L558,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M345,573A15 15 0 0 0 360 558A15 15 0 0 0 345 543A15 15 0 0 0 330 558A15 15 0 0 0 345 573Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="558" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="360,558 371,554 371,562" style="fill:rgb(0,0,0)"/>
<path d="M369,520 L 377,520 Q 384,520 384,535 L 384,543 Q 384,558 375,558 L 366,558"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,558 L 309,558 Q 294,558 294,543 L 294,535 Q 294,520 301,520 L 309,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="514,551 503,555 503,546" style="fill:rgb(0,0,0)"/>
<path d="M411,520 L 418,520 Q 426,520 426,535 L 426,536 Q 426,551 441,551 L 493,551 L 508,551"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M514,551 L 607,551 Q 622,551 622,536 L 622,535 Q 622,520 630,520 L 637,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,490 256,494 256,486" style="fill:rgb(0,0,0)"/>
<path d="M127,460 L 127,475 Q 127,490 142,490 L 246,490 L 261,490"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,520 399,525 399,516" style="fill:rgb(0,0,0)"/>
<path d="M267,490 L 369,490 Q 384,490 384,505 L 384,505 Q 384,520 395,520 L 405,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,460 244,455 244,464" style="fill:rgb(0,0,0)"/>
<path d="M305,422 L 313,422 Q 320,422 320,437 L 320,445 Q 320,460 305,460 L 254,460 L 239,460"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,520 142,525 142,516" style="fill:rgb(0,0,0)"/>
<path d="M233,460 L 142,460 Q 127,460 127,475 L 127,505 Q 127,520 137,520 L 147,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,447 122,435 131,435" style="fill:rgb(0,0,0)"/>
<path d="M127,407L127,441"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,447L127,505"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,649L232,649A15 15 0 0 0 247 634A15 15 0 0 0 232 619L168,619A15 15 0 0 0 153 634A15 15 0 0 0 168 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="200" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="283,634 271,638 271,629" style="fill:rgb(0,0,0)"/>
<path d="M247,634L277,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,649L395,649A15 15 0 0 0 410 634A15 15 0 0 0 395 619L298,619A15 15 0 0 0 283 634A15 15 0 0 0 298 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="433,634 422,638 422,629" style="fill:rgb(0,0,0)"/>
<path d="M410,634L427,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,649L452,649A15 15 0 0 0 467 634A15 15 0 0 0 452 619L448,619A15 15 0 0 0 433 634A15 15 0 0 0 448 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="450" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="490,634 479,638 479,629" style="fill:rgb(0,0,0)"/>
<path d="M467,634L485,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,649L609,649L609,619L490,619Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="550" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M446,687A15 15 0 0 0 461 671A15 15 0 0 0 446 656A15 15 0 0 0 431 671A15 15 0 0 0 446 687Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="671" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="461,671 472,667 472,676" style="fill:rgb(0,0,0)"/>
<path d="M609,634 L 616,634 Q 624,634 624,649 L 624,656 Q 624,671 609,671 L 482,671 L 467,671"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,671 L 271,671 Q 256,671 256,656 L 256,649 Q 256,634 264,634 L 271,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="624,692 619,680 628,680" style="fill:rgb(0,0,0)"/>
<path d="M624,656L624,686"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,558 648,547 656,547" style="fill:rgb(0,0,0)"/>
<path d="M607,520 L 637,520 Q 652,520 652,535 L 652,537 L 652,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,596 382,592 382,600" style="fill:rgb(0,0,0)"/>
<path d="M652,558 L 652,581 Q 652,596 637,596 L 391,596 L 376,596"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,634 142,638 142,629" style="fill:rgb(0,0,0)"/>
<path d="M371,596 L 142,596 Q 127,596 127,611 L 127,619 Q 127,634 137,634 L 147,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,558 122,547 131,547" style="fill:rgb(0,0,0)"/>
<path d="M127,505L127,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,709 359,714 359,705" style="fill:rgb(0,0,0)"/>
<path d="M127,558 L 127,694 Q 127,709 142,709 L 350,709 L 365,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,709 597,714 597,705" style="fill:rgb(0,0,0)"/>
<path d="M371,709L603,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,709 L 616,709 Q 624,709 624,717 L 624,724"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,800L194,800A15 15 0 0 0 209 785A15 15 0 0 0 194 770L142,770A15 15 0 0 0 127 785A15 15 0 0 0 142 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="245,785 234,789 234,781" style="fill:rgb(0,0,0)"/>
<path d="M209,785L239,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,800A15 15 0 0 0 275 785A15 15 0 0 0 260 770A15 15 0 0 0 245 785A15 15 0 0 0 260 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="311,785 300,789 300,781" style="fill:rgb(0,0,0)"/>
<path d="M275,785L306,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,800L361,800L361,770L311,770Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="397,785 385,789 385,781" style="fill:rgb(0,0,0)"/>
<path d="M361,785L391,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,800A15 15 0 0 0 427 785A15 15 0 0 0 412 770A15 15 0 0 0 397 785A15 15 0 0 0 412 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="412" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="609,785 597,789 597,781" style="fill:rgb(0,0,0)"/>
<path d="M427,785L603,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,785 L 616,785 Q 624,785 624,792 L 624,800"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,762A15 15 0 0 0 351 747A15 15 0 0 0 336 732A15 15 0 0 0 321 747A15 15 0 0 0 336 762Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="747" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M336,838A15 15 0 0 0 351 823A15 15 0 0 0 336 808A15 15 0 0 0 321 823A15 15 0 0 0 336 838Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="823" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="351,747 363,743 363,751" style="fill:rgb(0,0,0)"/>
<path d="M361,785 L 368,785 Q 376,785 376,770 L 376,762 Q 376,747 366,747 L 357,747"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,747 L 300,747 Q 285,747 285,762 L 285,770 Q 285,785 292,785 L 300,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,823 363,818 363,827" style="fill:rgb(0,0,0)"/>
<path d="M427,785 L 434,785 Q 442,785 442,800 L 442,808 Q 442,823 427,823 L 372,823 L 357,823"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,823 L 234,823 Q 219,823 219,808 L 219,800 Q 219,785 226,785 L 234,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,785 115,789 115,781" style="fill:rgb(0,0,0)"/>
<path d="M55,129 L 62,129 Q 70,129 70,144 L 70,770 Q 70,785 85,785 L 106,785 L 121,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,891L424,891L424,860L248,860Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="876" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="424,876 436,871 436,880" style="fill:rgb(0,0,0)"/>
<path d="M624,692 L 624,861 Q 624,876 609,876 L 445,876 L 430,876"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="6,197 10,208 2,208" style="fill:rgb(0,0,0)"/>
<path d="M248,876 L 21,876 Q 6,876 6,861 L 6,217 L 6,202"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M6,197 L 6,144 Q 6,129 21,129 L 40,129 L 55,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="667" y="275" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" transform="rotate(-90 667,285)" dominant-baseline="central">select-core</text>
<path d="M168,966L213,966A15 15 0 0 0 228 951A15 15 0 0 0 213 936L168,936A15 15 0 0 0 153 951A15 15 0 0 0 168 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="251,951 239,956 239,947" style="fill:rgb(0,0,0)"/>
<path d="M228,951L245,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,966L270,966A15 15 0 0 0 285 951A15 15 0 0 0 270 936L266,936A15 15 0 0 0 251 951A15 15 0 0 0 266 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M168,1072L202,1072A15 15 0 0 0 217 1057A15 15 0 0 0 202 1042L168,1042A15 15 0 0 0 153 1057A15 15 0 0 0 168 1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="240,1057 228,1061 228,1053" style="fill:rgb(0,0,0)"/>
<path d="M217,1057L234,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,1072L289,1072L289,1042L240,1042Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="330,951 319,956 319,947" style="fill:rgb(0,0,0)"/>
<path d="M285,951L324,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,966L460,966L460,936L330,936Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M395,1004A15 15 0 0 0 410 989A15 15 0 0 0 395 974A15 15 0 0 0 380 989A15 15 0 0 0 395 1004Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="989" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="410,989 422,985 422,993" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 468,951 Q 475,951 475,966 L 475,974 Q 475,989 460,989 L 431,989 L 416,989"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,989 L 322,989 Q 307,989 307,974 L 307,966 Q 307,951 313,951 L 319,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,913 348,909 348,918" style="fill:rgb(0,0,0)"/>
<path d="M624,860 L 624,898 Q 624,913 609,913 L 357,913 L 342,913"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,951 142,956 142,947" style="fill:rgb(0,0,0)"/>
<path d="M336,913 L 142,913 Q 127,913 127,928 L 127,936 Q 127,951 137,951 L 147,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,981 492,970 500,970" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 481,951 Q 496,951 496,963 L 496,976"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,1023 318,1019 318,1027" style="fill:rgb(0,0,0)"/>
<path d="M496,981 L 496,1008 Q 496,1023 481,1023 L 327,1023 L 312,1023"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,1057 142,1061 142,1053" style="fill:rgb(0,0,0)"/>
<path d="M307,1023 L 142,1023 Q 127,1023 127,1038 L 127,1042 Q 127,1057 137,1057 L 147,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,989 122,978 131,978" style="fill:rgb(0,0,0)"/>
<path d="M127,936L127,983"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,989L127,1042"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1102L415,1102A15 15 0 0 0 430 1087A15 15 0 0 0 415 1072L363,1072A15 15 0 0 0 348 1087A15 15 0 0 0 363 1102Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="389" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="453,1087 441,1092 441,1083" style="fill:rgb(0,0,0)"/>
<path d="M430,1087L447,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,1102L502,1102L502,1072L453,1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="525,1087 513,1092 513,1083" style="fill:rgb(0,0,0)"/>
<path d="M502,1087L519,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1140A15 15 0 0 0 378 1125A15 15 0 0 0 363 1110A15 15 0 0 0 348 1125A15 15 0 0 0 363 1140Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="1125" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="401,1125 390,1129 390,1121" style="fill:rgb(0,0,0)"/>
<path d="M378,1125L396,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,1140L451,1140L451,1110L401,1110Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="1125" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="312,1057 301,1061 301,1053" style="fill:rgb(0,0,0)"/>
<path d="M289,1057L306,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1125 337,1129 337,1121" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1110 Q 327,1125 335,1125 L 342,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1087 337,1092 337,1083" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1072 Q 327,1087 335,1087 L 342,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1057 513,1061 513,1053" style="fill:rgb(0,0,0)"/>
<path d="M312,1057L519,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="620,1155 609,1160 609,1151" style="fill:rgb(0,0,0)"/>
<path d="M525,1057 L 546,1057 Q 561,1057 561,1072 L 561,1140 Q 561,1155 576,1155 L 599,1155 L 614,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="624" cy="1155" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1087 L 546,1087 Q 561,1087 561,1095 L 561,1102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1125 513,1129 513,1121" style="fill:rgb(0,0,0)"/>
<path d="M451,1125L519,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1125 L 546,1125 Q 561,1125 561,1133 L 561,1140"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1155 513,1160 513,1151" style="fill:rgb(0,0,0)"/>
<path d="M127,1042 L 127,1140 Q 127,1155 142,1155 L 504,1155 L 519,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1155L597,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/common-table-expression.html">common-table-expression:</a></b>
<button id='xbaec200f' onclick='hideorshow("xbaec200f","x0d7bacdd")'>show</button></p>
 <div id='x0d7bacdd' style='display:none;' class='imgcontainer'>
 <div style="max-width:638px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 638.525 167.4">
<circle cx="5" cy="29" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,29 20,33 20,24" style="fill:rgb(0,0,0)"/>
<path d="M9,29L26,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,44L122,44A15 15 0 0 0 137 29A15 15 0 0 0 122 14L47,14A15 15 0 0 0 32 29A15 15 0 0 0 47 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="160,29 149,33 149,24" style="fill:rgb(0,0,0)"/>
<path d="M137,29L155,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="196,29 185,33 185,24" style="fill:rgb(0,0,0)"/>
<path d="M160,29L191,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,44A15 15 0 0 0 227 29A15 15 0 0 0 211 14A15 15 0 0 0 196 29A15 15 0 0 0 211 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="250,29 238,33 238,24" style="fill:rgb(0,0,0)"/>
<path d="M227,29L244,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="286,29 274,33 274,24" style="fill:rgb(0,0,0)"/>
<path d="M250,29L280,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,44L395,44A15 15 0 0 0 410 29A15 15 0 0 0 395 14L301,14A15 15 0 0 0 286 29A15 15 0 0 0 301 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="446,29 434,33 434,24" style="fill:rgb(0,0,0)"/>
<path d="M410,29L440,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,44A15 15 0 0 0 476 29A15 15 0 0 0 461 14A15 15 0 0 0 446 29A15 15 0 0 0 461 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,29 499,33 499,24" style="fill:rgb(0,0,0)"/>
<path d="M476,29L505,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,165L51,165A15 15 0 0 0 66 150A15 15 0 0 0 51 135L47,135A15 15 0 0 0 32 150A15 15 0 0 0 47 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="49" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<path d="M127,135L147,135A15 15 0 0 0 162 119A15 15 0 0 0 147 104L127,104A15 15 0 0 0 112 119A15 15 0 0 0 127 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<path d="M219,135L337,135A15 15 0 0 0 352 119A15 15 0 0 0 337 104L219,104A15 15 0 0 0 204 119A15 15 0 0 0 219 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<path d="M162,119L204,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,165A15 15 0 0 0 425 150A15 15 0 0 0 410 135A15 15 0 0 0 395 150A15 15 0 0 0 410 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="410" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="448,150 437,154 437,145" style="fill:rgb(0,0,0)"/>
<path d="M425,150L442,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,165L552,165L552,135L448,135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="500" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="575,150 564,154 564,145" style="fill:rgb(0,0,0)"/>
<path d="M552,150L570,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M591,165A15 15 0 0 0 606 150A15 15 0 0 0 591 135A15 15 0 0 0 575 150A15 15 0 0 0 591 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="629,150 617,154 617,145" style="fill:rgb(0,0,0)"/>
<path d="M606,150L623,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="632" cy="150" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,82A15 15 0 0 0 363 66A15 15 0 0 0 348 51A15 15 0 0 0 333 66A15 15 0 0 0 348 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="363,66 374,62 374,71" style="fill:rgb(0,0,0)"/>
<path d="M410,29 L 417,29 Q 425,29 425,44 L 425,51 Q 425,66 410,66 L 384,66 L 369,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M333,66 L 278,66 Q 263,66 263,51 L 263,44 Q 263,29 270,29 L 278,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,93 78,89 78,97" style="fill:rgb(0,0,0)"/>
<path d="M511,29 L 516,29 Q 522,29 522,44 L 522,78 Q 522,93 507,93 L 87,93 L 72,93"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,150 20,154 20,145" style="fill:rgb(0,0,0)"/>
<path d="M66,93 L 30,93 Q 15,93 15,108 L 15,135 Q 15,150 20,150 L 26,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="85,150 73,154 73,145" style="fill:rgb(0,0,0)"/>
<path d="M66,150L79,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="112,119 101,124 101,115" style="fill:rgb(0,0,0)"/>
<path d="M85,150 L 89,150 Q 92,150 92,135 L 92,134 Q 92,119 99,119 L 106,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="204,119 192,124 192,115" style="fill:rgb(0,0,0)"/>
<path d="M66,150 L 147,150 Q 162,150 170,150 Q 177,150 177,135 L 177,134 Q 177,119 188,119 L 198,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,150 383,154 383,145" style="fill:rgb(0,0,0)"/>
<path d="M352,119 L 360,119 Q 367,119 367,134 L 367,135 Q 367,150 378,150 L 389,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150L395,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,6 336,10 336,2" style="fill:rgb(0,0,0)"/>
<path d="M160,29 L 168,29 Q 175,29 175,17 Q 175,6 190,6 L 327,6 L 342,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,6 L 473,6 Q 488,6 488,17 Q 488,29 495,29 L 503,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/compound-operator.html">compound-operator:</a></b>
<button id='x3a33a92c' onclick='hideorshow("x3a33a92c","xbc13adaa")'>show</button></p>
 <div id='xbc13adaa' style='display:none;' class='imgcontainer'>
 <div style="max-width:293px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 293.842 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L127,32A15 15 0 0 0 142 17A15 15 0 0 0 127 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,70L127,70A15 15 0 0 0 142 55L142,55A15 15 0 0 0 127 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,108L168,108A15 15 0 0 0 183 92A15 15 0 0 0 168 77L83,77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M83,145L135,145A15 15 0 0 0 150 130A15 15 0 0 0 135 115L83,115A15 15 0 0 0 68 130A15 15 0 0 0 83 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M142,55L159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70L195,70A15 15 0 0 0 210 55L210,55A15 15 0 0 0 195 39L180,39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="233,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M210,55L227,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,17 272,21 272,12" style="fill:rgb(0,0,0)"/>
<path d="M233,55 L 240,55 Q 248,55 248,40 L 248,32 Q 248,17 263,17 L 263,17 L 278,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="288" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M47,39 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,92 221,97 221,88" style="fill:rgb(0,0,0)"/>
<path d="M183,92L227,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,92 L 240,92 Q 248,92 248,77 L 248,54 L 248,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,130 56,135 56,126" style="fill:rgb(0,0,0)"/>
<path d="M47,77 L 47,115 Q 47,130 55,130 L 62,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,130 221,135 221,126" style="fill:rgb(0,0,0)"/>
<path d="M150,130L227,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,130 L 240,130 Q 248,130 248,115 L 248,92 L 248,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-clause.html">join-clause:</a></b>
<button id='x2ceadb0d' onclick='hideorshow("x2ceadb0d","x56f32f52")'>show</button></p>
 <div id='x56f32f52' style='display:none;' class='imgcontainer'>
 <div style="max-width:793px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 793.282 84.24">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L193,32L193,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="259,47 247,51 247,43" style="fill:rgb(0,0,0)"/>
<path d="M193,17 L 200,17 Q 208,17 208,32 L 208,32 Q 208,47 223,47 L 238,47 L 253,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,62L380,62L380,32L259,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-operator</text>
<polygon points="403,47 391,51 391,43" style="fill:rgb(0,0,0)"/>
<path d="M380,47L397,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,62L564,62L564,32L403,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="587,47 575,51 575,43" style="fill:rgb(0,0,0)"/>
<path d="M564,47L581,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M587,62L721,62L721,32L587,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="654" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-constraint</text>
<polygon points="783,17 772,21 772,12" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 742,47 Q 757,47 757,32 L 757,32 Q 757,17 767,17 L 778,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="787" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M193,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,17L776,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,77 495,73 495,82" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 728,47 Q 736,47 736,62 L 736,62 Q 736,77 721,77 L 504,77 L 489,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,77 L 247,77 Q 232,77 232,62 L 232,62 Q 232,47 246,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/join-constraint.html">join-constraint:</a></b>
<button id='xded12a6e' onclick='hideorshow("xded12a6e","x1c77b59d")'>show</button></p>
 <div id='x1c77b59d' style='display:none;' class='imgcontainer'>
 <div style="max-width:483px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 483.336 126.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L104,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 104 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="143,55 131,59 131,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L137,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,70A15 15 0 0 0 173 55L173,55A15 15 0 0 0 158 39A15 15 0 0 0 143 55L143,55A15 15 0 0 0 158 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="209,55 197,59 197,50" style="fill:rgb(0,0,0)"/>
<path d="M173,55L203,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M224,70L318,70A15 15 0 0 0 333 55L333,55A15 15 0 0 0 318 39L224,39A15 15 0 0 0 209 55L209,55A15 15 0 0 0 224 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="369,55 358,59 358,50" style="fill:rgb(0,0,0)"/>
<path d="M333,55L363,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,70A15 15 0 0 0 399 55L399,55A15 15 0 0 0 384 39A15 15 0 0 0 369 55L369,55A15 15 0 0 0 384 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="422,55 411,59 411,50" style="fill:rgb(0,0,0)"/>
<path d="M399,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="473,17 462,21 462,12" style="fill:rgb(0,0,0)"/>
<path d="M422,55 L 430,55 Q 437,55 437,40 L 437,32 Q 437,17 452,17 L 453,17 L 468,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="477" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,108A15 15 0 0 0 286 92A15 15 0 0 0 271 77A15 15 0 0 0 256 92A15 15 0 0 0 271 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="286,92 298,88 298,97" style="fill:rgb(0,0,0)"/>
<path d="M333,55 L 341,55 Q 348,55 348,70 L 348,77 Q 348,92 333,92 L 307,92 L 292,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,92 L 197,92 Q 182,92 182,77 L 182,70 Q 182,55 190,55 L 197,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L74,32A15 15 0 0 0 90 17A15 15 0 0 0 74 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="113,17 101,21 101,12" style="fill:rgb(0,0,0)"/>
<path d="M90,17L107,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M113,32L162,32L162,2L113,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="422,17 411,21 411,12" style="fill:rgb(0,0,0)"/>
<path d="M162,17L417,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,17L462,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="209,120 197,124 197,115" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,105 Q 24,120 39,120 L 188,120 L 203,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,120 L 422,120 Q 437,120 437,105 L 437,54 L 437,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-operator.html">join-operator:</a></b>
<button id='x9cb6f030' onclick='hideorshow("x9cb6f030","xbc65b81b")'>show</button></p>
 <div id='xbc65b81b' style='display:none;' class='imgcontainer'>
 <div style="max-width:620px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 620.333 255.312">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,71 39,76 39,67" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,56 Q 24,71 34,71 L 45,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,86L133,86A15 15 0 0 0 148 71A15 15 0 0 0 133 56L66,56A15 15 0 0 0 50 71A15 15 0 0 0 66 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="99" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NATURAL</text>
<polygon points="189,41 178,45 178,37" style="fill:rgb(0,0,0)"/>
<path d="M148,71 L 155,71 Q 163,71 163,56 L 163,56 Q 163,41 173,41 L 184,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,71 219,76 219,67" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,56 Q 204,71 215,71 L 225,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,86L273,86A15 15 0 0 0 288 71A15 15 0 0 0 273 56L246,56A15 15 0 0 0 231 71A15 15 0 0 0 246 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LEFT</text>
<polygon points="378,71 366,76 366,67" style="fill:rgb(0,0,0)"/>
<path d="M288,71L372,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,86L437,86A15 15 0 0 0 452 71A15 15 0 0 0 437 56L393,56A15 15 0 0 0 378 71A15 15 0 0 0 393 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OUTER</text>
<polygon points="475,71 463,76 463,67" style="fill:rgb(0,0,0)"/>
<path d="M452,71L469,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="516,41 505,45 505,37" style="fill:rgb(0,0,0)"/>
<path d="M475,71 L 482,71 Q 490,71 490,56 L 490,56 Q 490,41 500,41 L 511,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,56L554,56A15 15 0 0 0 569 41A15 15 0 0 0 554 26L532,26A15 15 0 0 0 516 41A15 15 0 0 0 532 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="543" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">JOIN</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M569,41 L 576,41 Q 584,41 584,29 Q 584,17 594,17 L 605,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="614" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,32A15 15 0 0 0 325 17A15 15 0 0 0 310 2A15 15 0 0 0 295 17A15 15 0 0 0 310 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="295,17 283,21 283,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L289,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M325,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="99,41 88,45 88,37" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,29 Q 24,41 39,41 L 78,41 L 93,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M99,41L178,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,41L505,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,41 366,45 366,37" style="fill:rgb(0,0,0)"/>
<path d="M336,71 L 344,71 Q 351,71 351,56 L 351,56 Q 351,41 362,41 L 372,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,109 219,113 219,105" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,94 Q 204,109 215,109 L 225,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,124L284,124A15 15 0 0 0 299 109A15 15 0 0 0 284 94L246,94A15 15 0 0 0 231 109A15 15 0 0 0 246 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RIGHT</text>
<polygon points="341,71 329,76 329,67" style="fill:rgb(0,0,0)"/>
<path d="M299,109 L 307,109 Q 314,109 314,94 L 314,86 Q 314,71 324,71 L 335,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,147 219,151 219,142" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,132 Q 204,147 215,147 L 225,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,162L274,162A15 15 0 0 0 289 147A15 15 0 0 0 274 132L246,132A15 15 0 0 0 231 147A15 15 0 0 0 246 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FULL</text>
<path d="M289,147 L 302,147 Q 314,147 314,132 L 314,109 L 314,94"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,192 219,196 219,188" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,177 Q 204,192 215,192 L 225,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,207L287,207A15 15 0 0 0 302 192A15 15 0 0 0 287 177L246,177A15 15 0 0 0 231 192A15 15 0 0 0 246 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="192" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INNER</text>
<polygon points="475,192 463,196 463,188" style="fill:rgb(0,0,0)"/>
<path d="M302,192L469,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,192 L 482,192 Q 490,192 490,185 L 490,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,238 219,242 219,233" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,223 Q 24,238 39,238 L 210,238 L 225,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,253L287,253A15 15 0 0 0 303 238A15 15 0 0 0 287 222L246,222A15 15 0 0 0 231 238A15 15 0 0 0 246 253Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="238" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CROSS</text>
<polygon points="475,238 463,242 463,233" style="fill:rgb(0,0,0)"/>
<path d="M303,238L469,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,238 L 482,238 Q 490,238 490,223 L 490,71 L 490,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x2f074214' onclick='hideorshow("x2f074214","x3891905f")'>show</button></p>
 <div id='x3891905f' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/result-column.html">result-column:</a></b>
<button id='xc8e8ac06' onclick='hideorshow("xc8e8ac06","x349ac0e2")'>show</button></p>
 <div id='x349ac0e2' style='display:none;' class='imgcontainer'>
 <div style="max-width:398px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 398.054 163.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L94,32L94,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="136,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M94,17 L 102,17 Q 109,17 109,32 L 109,40 Q 109,55 119,55 L 130,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M151,70L155,70A15 15 0 0 0 170 55L170,55A15 15 0 0 0 155 39L151,39A15 15 0 0 0 136 55L136,55A15 15 0 0 0 151 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="206,55 194,59 194,50" style="fill:rgb(0,0,0)"/>
<path d="M170,55L200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,70L309,70A15 15 0 0 0 324 55L324,55A15 15 0 0 0 309 39L221,39A15 15 0 0 0 206 55L206,55A15 15 0 0 0 221 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="347,55 335,59 335,50" style="fill:rgb(0,0,0)"/>
<path d="M324,55L341,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,17 377,21 377,12" style="fill:rgb(0,0,0)"/>
<path d="M347,55 L 354,55 Q 362,55 362,40 L 362,32 Q 362,17 372,17 L 382,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="392" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,85 141,89 141,81" style="fill:rgb(0,0,0)"/>
<path d="M109,39 L 109,70 Q 109,85 124,85 L 132,85 L 147,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,85 L 170,85 Q 185,85 185,70 L 185,70 Q 185,55 192,55 L 200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="241,17 230,21 230,12" style="fill:rgb(0,0,0)"/>
<path d="M94,17L235,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M241,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,108 39,112 39,103" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,93 Q 24,108 34,108 L 45,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,123A15 15 0 0 0 81 108A15 15 0 0 0 66 92A15 15 0 0 0 50 108A15 15 0 0 0 66 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="108" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,108 335,112 335,103" style="fill:rgb(0,0,0)"/>
<path d="M81,108L341,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,108 L 354,108 Q 362,108 362,93 L 362,54 L 362,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,145 39,150 39,141" style="fill:rgb(0,0,0)"/>
<path d="M24,92 L 24,130 Q 24,145 34,145 L 45,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,160L141,160A15 15 0 0 0 156 145A15 15 0 0 0 141 130L66,130A15 15 0 0 0 50 145A15 15 0 0 0 66 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="145" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="179,145 167,150 167,141" style="fill:rgb(0,0,0)"/>
<path d="M156,145L173,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M194,160A15 15 0 0 0 209 145A15 15 0 0 0 194 130A15 15 0 0 0 179 145A15 15 0 0 0 194 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="232,145 221,150 221,141" style="fill:rgb(0,0,0)"/>
<path d="M209,145L226,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,160A15 15 0 0 0 262 145A15 15 0 0 0 247 130A15 15 0 0 0 232 145A15 15 0 0 0 247 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,145 335,150 335,141" style="fill:rgb(0,0,0)"/>
<path d="M262,145L341,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,145 L 354,145 Q 362,145 362,130 L 362,107 L 362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/table-or-subquery.html">table-or-subquery:</a></b>
<button id='x82202bbe' onclick='hideorshow("x82202bbe","x39b000f0")'>show</button></p>
 <div id='x39b000f0' style='display:none;' class='imgcontainer'>
 <div style="max-width:720px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 720.778 457.704">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,74 39,78 39,70" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,59 Q 24,74 34,74 L 45,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,89L162,89A15 15 0 0 0 177 74L177,74A15 15 0 0 0 162 59L66,59A15 15 0 0 0 50 74L50,74A15 15 0 0 0 66 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="194,74 183,78 183,70" style="fill:rgb(0,0,0)"/>
<path d="M177,74L189,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,89A15 15 0 0 0 225 74L225,74A15 15 0 0 0 209 59A15 15 0 0 0 194 74L194,74A15 15 0 0 0 209 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="266,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M225,74 L 232,74 Q 240,74 240,59 L 240,51 Q 240,36 250,36 L 260,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,51L356,51A15 15 0 0 0 371 36A15 15 0 0 0 356 21L281,21A15 15 0 0 0 266 36A15 15 0 0 0 281 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="407,36 396,41 396,32" style="fill:rgb(0,0,0)"/>
<path d="M371,36L402,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,51L427,51A15 15 0 0 0 442 36A15 15 0 0 0 427 21L423,21A15 15 0 0 0 407 36A15 15 0 0 0 423 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="478,36 466,41 466,32" style="fill:rgb(0,0,0)"/>
<path d="M442,36L472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,51L561,51A15 15 0 0 0 577 36A15 15 0 0 0 561 21L493,21A15 15 0 0 0 478 36A15 15 0 0 0 493 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="527" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<path d="M9,36L255,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="422,6 411,10 411,2" style="fill:rgb(0,0,0)"/>
<path d="M371,36 L 379,36 Q 386,36 386,21 L 386,21 Q 386,6 401,6 L 402,6 L 417,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 442,6 Q 457,6 457,21 L 457,21 Q 457,36 464,36 L 472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 577,6 Q 592,6 592,21 L 592,21 Q 592,36 599,36 L 607,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,127L388,127A15 15 0 0 0 403 112A15 15 0 0 0 388 97L323,97A15 15 0 0 0 308 112A15 15 0 0 0 323 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="426,112 415,116 415,108" style="fill:rgb(0,0,0)"/>
<path d="M403,112L420,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,127L445,127A15 15 0 0 0 460 112A15 15 0 0 0 445 97L441,97A15 15 0 0 0 426 112A15 15 0 0 0 441 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="443" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="483,112 472,116 472,108" style="fill:rgb(0,0,0)"/>
<path d="M460,112L478,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,127L577,127A15 15 0 0 0 592 112A15 15 0 0 0 577 97L499,97A15 15 0 0 0 483 112A15 15 0 0 0 499 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="538" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M323,165L343,165A15 15 0 0 0 359 150A15 15 0 0 0 343 135L323,135A15 15 0 0 0 308 150A15 15 0 0 0 323 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="382,150 370,154 370,145" style="fill:rgb(0,0,0)"/>
<path d="M359,150L376,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,165L461,165A15 15 0 0 0 476 150A15 15 0 0 0 461 135L397,135A15 15 0 0 0 382 150A15 15 0 0 0 397 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="527,74 539,70 539,78" style="fill:rgb(0,0,0)"/>
<path d="M577,36 L 607,36 Q 622,36 622,51 L 622,59 Q 622,74 607,74 L 548,74 L 533,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,150 297,154 297,145" style="fill:rgb(0,0,0)"/>
<path d="M527,74 L 297,74 Q 282,74 282,89 L 282,135 Q 282,150 292,150 L 302,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,112 297,116 297,108" style="fill:rgb(0,0,0)"/>
<path d="M282,97 L 282,104 Q 282,112 292,112 L 302,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="266,213 255,217 255,209" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,198 Q 24,213 39,213 L 245,213 L 260,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,228L431,228A15 15 0 0 0 446 213A15 15 0 0 0 431 198L281,198A15 15 0 0 0 266 213A15 15 0 0 0 281 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function-name</text>
<polygon points="463,213 452,217 452,209" style="fill:rgb(0,0,0)"/>
<path d="M446,213L457,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,228A15 15 0 0 0 493 213A15 15 0 0 0 478 198A15 15 0 0 0 463 213A15 15 0 0 0 478 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="529,213 518,217 518,209" style="fill:rgb(0,0,0)"/>
<path d="M493,213L524,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M529,228L579,228L579,198L529,198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="615,213 603,217 603,209" style="fill:rgb(0,0,0)"/>
<path d="M579,213L609,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M630,228A15 15 0 0 0 645 213A15 15 0 0 0 630 198A15 15 0 0 0 615 213A15 15 0 0 0 630 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="630" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="675,187 679,198 671,198" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 660,213 Q 675,213 675,203 L 675,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M554,190A15 15 0 0 0 569 175A15 15 0 0 0 554 160A15 15 0 0 0 539 175A15 15 0 0 0 554 190Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="175" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="569,175 581,171 581,180" style="fill:rgb(0,0,0)"/>
<path d="M579,213 L 586,213 Q 594,213 594,198 L 594,190 Q 594,175 584,175 L 575,175"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,175 L 518,175 Q 503,175 503,190 L 503,198 Q 503,213 510,213 L 518,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,74 L 232,74 Q 240,74 240,89 L 240,198 Q 240,213 247,213 L 255,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,112 648,116 648,108" style="fill:rgb(0,0,0)"/>
<path d="M592,112L654,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,112 L 667,112 Q 675,112 675,104 L 675,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,150 648,154 648,145" style="fill:rgb(0,0,0)"/>
<path d="M476,150L654,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,150 L 667,150 Q 675,150 675,142 L 675,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M577,36L690,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,304L411,304A15 15 0 0 0 426 289A15 15 0 0 0 411 274L407,274A15 15 0 0 0 392 289A15 15 0 0 0 407 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="498,289 487,293 487,284" style="fill:rgb(0,0,0)"/>
<path d="M426,289L492,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M513,304L582,304A15 15 0 0 0 597 289A15 15 0 0 0 582 274L513,274A15 15 0 0 0 498 289A15 15 0 0 0 513 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="548" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<polygon points="660,289 648,293 648,284" style="fill:rgb(0,0,0)"/>
<path d="M597,289L654,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,289 L 667,289 Q 675,289 675,281 L 675,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="548,251 559,247 559,255" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 652,213 Q 660,213 660,228 L 660,236 Q 660,251 645,251 L 568,251 L 553,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M548,251 L 370,251 Q 355,251 355,266 L 355,274 Q 355,289 370,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,251 L 464,251 Q 457,251 457,266 L 457,274 Q 457,289 464,289 L 472,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,327 39,331 39,322" style="fill:rgb(0,0,0)"/>
<path d="M24,198 L 24,312 Q 24,327 34,327 L 45,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,342A15 15 0 0 0 81 327A15 15 0 0 0 66 311A15 15 0 0 0 50 327A15 15 0 0 0 66 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,327 92,331 92,322" style="fill:rgb(0,0,0)"/>
<path d="M81,327L98,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,342L208,342L208,311L104,311Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="327" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="231,327 219,331 219,322" style="fill:rgb(0,0,0)"/>
<path d="M208,327L225,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,342A15 15 0 0 0 261 327A15 15 0 0 0 246 311A15 15 0 0 0 231 327A15 15 0 0 0 246 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M261,327 L 269,327 Q 276,327 276,312 L 276,304 Q 276,289 291,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,327 648,331 648,322" style="fill:rgb(0,0,0)"/>
<path d="M261,327L654,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,327 L 667,327 Q 675,327 675,319 L 675,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,327 L 432,327 Q 439,327 439,312 L 439,304 Q 439,289 447,289 L 454,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,364 39,369 39,360" style="fill:rgb(0,0,0)"/>
<path d="M24,311 L 24,349 Q 24,364 34,364 L 45,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,379A15 15 0 0 0 81 364A15 15 0 0 0 65 349A15 15 0 0 0 50 364A15 15 0 0 0 65 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="135,364 123,369 123,360" style="fill:rgb(0,0,0)"/>
<path d="M81,364L129,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,379L296,379L296,349L135,349Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="364" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="350,364 338,369 338,360" style="fill:rgb(0,0,0)"/>
<path d="M296,364L344,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,379A15 15 0 0 0 380 364A15 15 0 0 0 365 349A15 15 0 0 0 350 364A15 15 0 0 0 365 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="660,364 648,369 648,360" style="fill:rgb(0,0,0)"/>
<path d="M380,364L654,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="711,36 699,41 699,32" style="fill:rgb(0,0,0)"/>
<path d="M660,364 L 667,364 Q 675,364 675,349 L 675,51 Q 675,36 690,36 L 690,36 L 705,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="715" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,417A15 15 0 0 0 230 402A15 15 0 0 0 215 387A15 15 0 0 0 200 402A15 15 0 0 0 215 417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="402" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="230,402 242,398 242,406" style="fill:rgb(0,0,0)"/>
<path d="M296,364 L 303,364 Q 311,364 311,379 L 311,387 Q 311,402 296,402 L 251,402 L 236,402"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,402 L 123,402 Q 108,402 108,387 L 108,379 Q 108,364 116,364 L 123,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="122,440 111,444 111,436" style="fill:rgb(0,0,0)"/>
<path d="M81,364 L 88,364 Q 96,364 96,379 L 96,425 Q 96,440 106,440 L 116,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M122,455L224,455L224,425L122,425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M224,440 L 308,440 Q 323,440 323,425 L 323,379 Q 323,364 331,364 L 338,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/window-defn.html">window-defn:</a></b>
<button id='x39a10e48' onclick='hideorshow("x39a10e48","xeb538061")'>show</button></p>
 <div id='xeb538061' style='display:none;' class='imgcontainer'>
 <div style="max-width:479px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 479.765 380.592">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,44 92,48 92,40" style="fill:rgb(0,0,0)"/>
<path d="M62,17 L 70,17 Q 77,17 77,30 Q 77,44 88,44 L 98,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,59L260,59A15 15 0 0 0 275 44L275,44A15 15 0 0 0 260 29L119,29A15 15 0 0 0 104 44L104,44A15 15 0 0 0 119 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M119,135L198,135A15 15 0 0 0 214 120A15 15 0 0 0 198 104L119,104A15 15 0 0 0 104 120A15 15 0 0 0 119 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="237,120 225,124 225,115" style="fill:rgb(0,0,0)"/>
<path d="M214,120L231,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M252,135L256,135A15 15 0 0 0 271 120A15 15 0 0 0 256 104L252,104A15 15 0 0 0 237 120A15 15 0 0 0 252 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="307,120 295,124 295,115" style="fill:rgb(0,0,0)"/>
<path d="M271,120L301,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,135L356,135L356,104L307,104Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M332,173A15 15 0 0 0 347 157A15 15 0 0 0 332 142A15 15 0 0 0 316 157A15 15 0 0 0 332 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="157" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="347,157 358,153 358,162" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,142 Q 371,157 362,157 L 352,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,157 L 295,157 Q 280,157 280,142 L 280,135 Q 280,120 288,120 L 295,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,17 178,21 178,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L184,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,82 201,77 201,86" style="fill:rgb(0,0,0)"/>
<path d="M190,17 L 298,17 Q 313,17 313,32 L 313,67 Q 313,82 298,82 L 210,82 L 195,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,120 92,124 92,115" style="fill:rgb(0,0,0)"/>
<path d="M190,82 L 77,82 Q 62,82 62,97 L 62,105 Q 62,120 77,120 L 83,120 L 98,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,44 287,48 287,40" style="fill:rgb(0,0,0)"/>
<path d="M275,44L293,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,44 L 306,44 Q 313,44 313,51 L 313,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,248L163,248A15 15 0 0 0 178 233A15 15 0 0 0 163 218L119,218A15 15 0 0 0 104 233A15 15 0 0 0 119 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="201,233 190,237 190,229" style="fill:rgb(0,0,0)"/>
<path d="M178,233L196,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,248L221,248A15 15 0 0 0 236 233A15 15 0 0 0 221 218L217,218A15 15 0 0 0 201 233A15 15 0 0 0 217 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="272,233 260,237 260,229" style="fill:rgb(0,0,0)"/>
<path d="M236,233L266,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,248L402,248L402,218L272,218Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M337,286A15 15 0 0 0 352 271A15 15 0 0 0 337 256A15 15 0 0 0 322 271A15 15 0 0 0 337 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="352,271 363,266 363,275" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,256 Q 417,271 402,271 L 373,271 L 358,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M322,271 L 260,271 Q 245,271 245,256 L 245,248 Q 245,233 253,233 L 260,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,195 201,191 201,200" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,180 Q 371,195 356,195 L 210,195 L 195,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,233 92,237 92,229" style="fill:rgb(0,0,0)"/>
<path d="M190,195 L 77,195 Q 62,195 62,210 L 62,218 Q 62,233 77,233 L 83,233 L 98,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,157 58,146 66,146" style="fill:rgb(0,0,0)"/>
<path d="M62,104L62,152"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,157L62,218"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,362L208,362L208,331L104,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="417,346 405,351 405,342" style="fill:rgb(0,0,0)"/>
<path d="M208,346L411,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,362A15 15 0 0 0 447 346A15 15 0 0 0 432 331A15 15 0 0 0 417 346A15 15 0 0 0 432 362Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="470,346 458,351 458,342" style="fill:rgb(0,0,0)"/>
<path d="M447,346L464,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="474" cy="346" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,309 201,304 201,313" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,294 Q 417,309 402,309 L 210,309 L 195,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,346 92,351 92,342" style="fill:rgb(0,0,0)"/>
<path d="M190,309 L 77,309 Q 62,309 62,324 L 62,331 Q 62,346 77,346 L 83,346 L 98,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,271 58,259 66,259" style="fill:rgb(0,0,0)"/>
<path d="M62,218L62,265"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,271L62,331"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,374 144,378 144,369" style="fill:rgb(0,0,0)"/>
<path d="M62,331 L 62,359 Q 62,374 77,374 L 135,374 L 150,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,346 266,351 266,342" style="fill:rgb(0,0,0)"/>
<path d="M156,374 L 233,374 Q 248,374 248,360 Q 248,346 260,346 L 272,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x6a03f513' onclick='hideorshow("x6a03f513","xe27f0b2d")'>show</button></p>
 <div id='xe27f0b2d' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/type-name.html">type-name:</a></b>
<button id='xfd9a9f7b' onclick='hideorshow("xfd9a9f7b","x9b164881")'>show</button></p>
 <div id='x9b164881' style='display:none;' class='imgcontainer'>
 <div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.008 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L87,32A15 15 0 0 0 102 17A15 15 0 0 0 87 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="165,92 153,97 153,88" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,77 Q 138,92 149,92 L 159,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,108A15 15 0 0 0 195 92A15 15 0 0 0 180 77A15 15 0 0 0 165 92A15 15 0 0 0 180 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,92 201,97 201,88" style="fill:rgb(0,0,0)"/>
<path d="M195,92L207,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,108L350,108L350,77L212,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,92 356,97 356,88" style="fill:rgb(0,0,0)"/>
<path d="M350,92L362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,108A15 15 0 0 0 398 92A15 15 0 0 0 382 77A15 15 0 0 0 367 92A15 15 0 0 0 382 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="415,92 403,97 403,88" style="fill:rgb(0,0,0)"/>
<path d="M398,92L409,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,108L553,108L553,77L415,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="570,92 558,97 558,88" style="fill:rgb(0,0,0)"/>
<path d="M553,92L564,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,108A15 15 0 0 0 600 92A15 15 0 0 0 585 77A15 15 0 0 0 570 92A15 15 0 0 0 585 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="585" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="651,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M600,92 L 608,92 Q 615,92 615,77 L 615,32 Q 615,17 630,17 L 630,17 L 645,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,40 Q 138,55 149,55 L 159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70A15 15 0 0 0 195 55L195,55A15 15 0 0 0 180 39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,55 201,59 201,50" style="fill:rgb(0,0,0)"/>
<path d="M195,55L207,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,70L350,70L350,39L212,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,55 356,59 356,50" style="fill:rgb(0,0,0)"/>
<path d="M350,55L362,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,70A15 15 0 0 0 398 55L398,55A15 15 0 0 0 382 39A15 15 0 0 0 367 55L367,55A15 15 0 0 0 382 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="600,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M398,55L594,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M600,55 L 608,55 Q 615,55 615,47 L 615,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="74,47 85,43 85,51" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 110,17 Q 117,17 117,32 L 117,32 Q 117,47 102,47 L 94,47 L 79,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47 L 33,47 Q 18,47 18,32 L 18,32 Q 18,17 26,17 L 33,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="382,17 371,21 371,12" style="fill:rgb(0,0,0)"/>
<path d="M102,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,17L630,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='x621e3302' onclick='hideorshow("x621e3302","xc7e8a8b1")'>show</button></p>
 <div id='xc7e8a8b1' style='display:none;' class='imgcontainer'>
 <div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
</div>


<p> The ATTACH DATABASE statement adds another database 
file to the current <a href="c3ref/sqlite3.html">database connection</a>. 
Database files that were previously attached can be removed using
the <a href="lang_detach.html">DETACH DATABASE</a> command.

</p><h1 id="details"><span>2. </span>Details</h1>

<p>The filename for the database to be attached is the value of
the expression that occurs before the AS keyword.
The filename of the database follows the same semantics as the
filename argument to <a href="c3ref/open.html">sqlite3_open()</a> and <a href="c3ref/open.html">sqlite3_open_v2()</a>; the
special name "<a href="inmemorydb.html">:memory:</a>" results in an <a href="inmemorydb.html">in-memory database</a> and an
empty string results in a new temporary database.
The filename argument can be a <a href="uri.html">URI filename</a> if URI filename processing
is enabled on the database connection.  The default behavior is for
URI filenames to be disabled, however that might change in a future release
of SQLite, so application developers are advised to plan accordingly.

</p><p>The name that occurs after the AS keyword is the name of the database
used internally by SQLite.
The schema-names 'main' and 
'temp' refer to the main database and the database used for 
temporary tables.  The main and temp databases cannot be attached or
detached.</p>

<p> Tables in an attached database can be referred to using the syntax 
<i>schema-name.table-name</i>.  If the name of the table is unique
across all attached databases and the main and temp databases, then the
<i>schema-name</i> prefix is not required.  If two or more tables in
different databases have the same name and the 
<i>schema-name</i> prefix is not used on a table reference, then the
table chosen is the one in the database that was least recently attached.</p>

<p>
Transactions involving multiple attached databases are atomic,
assuming that the main database is not "<a href="inmemorydb.html">:memory:</a>" and the 
<a href="pragma.html#pragma_journal_mode">journal_mode</a> is not <a href="wal.html">WAL</a>.  If the main
database is ":memory:" or if the journal_mode is WAL, then 
transactions continue to be atomic within each individual
database file. But if the host computer crashes in the middle
of a <a href="lang_transaction.html">COMMIT</a> where two or more database files are updated,
some of those files might get the changes where others
might not.
</p>

<p> There is a limit, set using <a href="c3ref/limit.html">sqlite3_limit()</a> and 
<a href="c3ref/c_limit_attached.html#sqlitelimitattached">SQLITE_LIMIT_ATTACHED</a>, to the number of databases that can be
simultaneously attached to a single database connection.</p>
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_attach.in?m=ef45743b34">2023-12-05 14:43:20</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_comment.html.



































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>SQL Comment Syntax</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
SQL Comment Syntax
</div>
</div>





<p><b><a href="syntax/comment-syntax.html">comment-syntax:</a></b>
<button id='x49aaee40' onclick='hideorshow("x49aaee40","xf6f99226")'>hide</button></p>
 <div id='xf6f99226' class='imgcontainer'>
 <div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.704 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32A15 15 0 0 0 98 17A15 15 0 0 0 83 2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">--</text>
<polygon points="121,17 110,21 110,12" style="fill:rgb(0,0,0)"/>
<path d="M98,17L115,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M172,70L359,70A15 15 0 0 0 374 55L374,55A15 15 0 0 0 359 39L172,39A15 15 0 0 0 157 55L157,55A15 15 0 0 0 172 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="266" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">anything-except-newline</text>
<polygon points="347,17 336,21 336,12" style="fill:rgb(0,0,0)"/>
<path d="M121,17L342,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="374,55 386,50 386,59" style="fill:rgb(0,0,0)"/>
<path d="M347,17 L 382,17 Q 397,17 397,32 L 397,40 Q 397,55 389,55 L 380,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="194,17 183,21 183,12" style="fill:rgb(0,0,0)"/>
<path d="M157,55 L 146,55 Q 134,55 134,40 L 134,32 Q 134,17 149,17 L 173,17 L 188,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="464,17 453,21 453,12" style="fill:rgb(0,0,0)"/>
<path d="M374,17L459,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,32L527,32A15 15 0 0 0 542 17A15 15 0 0 0 527 2L480,2A15 15 0 0 0 464 17A15 15 0 0 0 480 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="503" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">newline</text>
<path d="M480,70L563,70A15 15 0 0 0 578 55L578,55A15 15 0 0 0 563 39L480,39A15 15 0 0 0 464 55L464,55A15 15 0 0 0 480 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="521" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">end-of-input</text>
<polygon points="601,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M578,55L595,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M601,55 L 608,55 Q 616,55 616,40 L 616,32 Q 616,17 631,17 L 631,17 L 646,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M542,17L632,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="464,55 453,59 453,50" style="fill:rgb(0,0,0)"/>
<path d="M374,17 L 412,17 Q 427,17 427,32 L 427,40 Q 427,55 442,55 L 444,55 L 459,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,108A15 15 0 0 0 98 92A15 15 0 0 0 83 77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">/*</text>
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,92 110,97 110,88" style="fill:rgb(0,0,0)"/>
<path d="M98,92L115,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,92L193,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M172,145L308,145A15 15 0 0 0 323 130A15 15 0 0 0 308 115L172,115A15 15 0 0 0 157 130A15 15 0 0 0 172 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="240" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">anything-except-*/</text>
<path d="M480,108A15 15 0 0 0 495 92A15 15 0 0 0 480 77A15 15 0 0 0 464 92A15 15 0 0 0 480 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="480" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*/</text>
<polygon points="323,130 334,126 334,135" style="fill:rgb(0,0,0)"/>
<path d="M323,92 L 334,92 Q 346,92 346,107 L 346,115 Q 346,130 337,130 L 328,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="464,92 453,97 453,88" style="fill:rgb(0,0,0)"/>
<path d="M157,130 L 146,130 Q 134,130 134,115 L 134,107 Q 134,92 149,92 L 444,92 L 459,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="601,92 589,97 589,88" style="fill:rgb(0,0,0)"/>
<path d="M495,92L595,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M601,92 L 608,92 Q 616,92 616,77 L 616,54 L 616,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,92 L 419,92 Q 427,92 427,77 L 427,70 Q 427,55 440,55 L 453,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>


<p>Comments are not SQL commands, but can occur within the text of
SQL queries passed to <a href="c3ref/prepare.html">sqlite3_prepare_v2()</a> and related interfaces.
Comments are treated as whitespace by the parser.
Comments can begin anywhere whitespace 
can be found, including inside expressions that span multiple lines.
</p>

<p>SQL comments begin with two consecutive "-" characters (ASCII 0x2d)
and extend up to and including the next newline character (ASCII 0x0a)
or until the end of input, whichever comes first.</p>

<p>C-style comments begin
with "/*" and extend up to and including the next "*/" character pair
or until the end of input, whichever comes first.  C-style comments
can span multiple lines. </p>

<p>Comments can appear anywhere whitespace can occur,
including inside expressions and in the middle of other SQL statements.
Comments do not nest.
</p>
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_comment.in?m=3ef91cf3ff">2022-01-08 05:02:57</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_conflict.html.













































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>The ON CONFLICT Clause</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
The ON CONFLICT Clause
</div>
</div>




<p><b><a href="syntax/conflict-clause.html">conflict-clause:</a></b>
<button id='x91fb97ac' onclick='hideorshow("x91fb97ac","xe68f90d9")'>hide</button></p>
 <div id='xe68f90d9' class='imgcontainer'>
 <div style="max-width:451px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 451.517 205.2">
<circle cx="5" cy="6" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,6 20,10 20,2" style="fill:rgb(0,0,0)"/>
<path d="M9,6L26,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,36 58,41 58,32" style="fill:rgb(0,0,0)"/>
<path d="M32,6 L 39,6 Q 47,6 47,21 L 47,21 Q 47,36 56,36 L 64,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,51L94,51A15 15 0 0 0 109 36L109,36A15 15 0 0 0 94 21L85,21A15 15 0 0 0 70 36L70,36A15 15 0 0 0 85 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="90" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="132,36 121,41 121,32" style="fill:rgb(0,0,0)"/>
<path d="M109,36L126,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M147,51L222,51A15 15 0 0 0 237 36L237,36A15 15 0 0 0 222 21L147,21A15 15 0 0 0 132 36L132,36A15 15 0 0 0 147 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONFLICT</text>
<polygon points="273,36 261,41 261,32" style="fill:rgb(0,0,0)"/>
<path d="M237,36L267,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,51L365,51A15 15 0 0 0 381 36L381,36A15 15 0 0 0 365 21L288,21A15 15 0 0 0 273 36L273,36A15 15 0 0 0 288 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="327" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<path d="M288,89L330,89A15 15 0 0 0 345 74L345,74A15 15 0 0 0 330 59L288,59A15 15 0 0 0 273 74L273,74A15 15 0 0 0 288 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="309" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<path d="M288,127L310,127A15 15 0 0 0 325 112A15 15 0 0 0 310 97L288,97A15 15 0 0 0 273 112A15 15 0 0 0 288 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<path d="M288,165L340,165A15 15 0 0 0 355 150A15 15 0 0 0 340 135L288,135A15 15 0 0 0 273 150A15 15 0 0 0 288 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="314" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<path d="M288,203L352,203A15 15 0 0 0 367 187A15 15 0 0 0 352 172L288,172A15 15 0 0 0 273 187A15 15 0 0 0 288 203Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="320" y="187" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<polygon points="404,36 392,41 392,32" style="fill:rgb(0,0,0)"/>
<path d="M381,36L398,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="442,6 430,10 430,2" style="fill:rgb(0,0,0)"/>
<path d="M404,36 L 411,36 Q 419,36 419,21 L 419,21 Q 419,6 427,6 L 436,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="445" cy="6" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="225,6 214,10 214,2" style="fill:rgb(0,0,0)"/>
<path d="M9,6L219,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,6L434,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,187 261,192 261,183" style="fill:rgb(0,0,0)"/>
<path d="M237,36 L 244,36 Q 252,36 252,51 L 252,172 Q 252,187 259,187 L 267,187"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,187 392,192 392,183" style="fill:rgb(0,0,0)"/>
<path d="M367,187L398,187"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,187 L 411,187 Q 419,187 419,172 L 419,36 L 419,21"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,74 261,78 261,70" style="fill:rgb(0,0,0)"/>
<path d="M252,59 L 252,66 Q 252,74 259,74 L 267,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,74 392,78 392,70" style="fill:rgb(0,0,0)"/>
<path d="M345,74L398,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,74 L 411,74 Q 419,74 419,67 L 419,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,112 261,116 261,108" style="fill:rgb(0,0,0)"/>
<path d="M252,97 L 252,104 Q 252,112 259,112 L 267,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,112 392,116 392,108" style="fill:rgb(0,0,0)"/>
<path d="M325,112L398,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,112 L 411,112 Q 419,112 419,104 L 419,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,150 261,154 261,145" style="fill:rgb(0,0,0)"/>
<path d="M252,135 L 252,142 Q 252,150 259,150 L 267,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,150 392,154 392,145" style="fill:rgb(0,0,0)"/>
<path d="M355,150L398,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,150 L 411,150 Q 419,150 419,142 L 419,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>


<p>The ON CONFLICT clause is a
non-standard extension specific to SQLite 
that can appear in many other SQL commands.
It is given its own section in this document because it is not
part of standard SQL and therefore might not be familiar.</p>

<p>The ON CONFLICT clause described here has been a part of
SQLite since before version 3.0.0 (2004-06-18).  The phrase
"ON&nbsp;CONFLICT" is also part of <a href="lang_upsert.html">UPSERT</a>, which is an extension
to <a href="lang_insert.html">INSERT</a> added in version 3.24.0 (2018-06-04).  Do not
confuse these two separate uses of the "ON&nbsp;CONFLICT" phrase.

</p><p>The syntax for the ON CONFLICT clause is as shown above for
the CREATE TABLE command.  For the INSERT and
UPDATE commands, the keywords "ON CONFLICT" are replaced by "OR" so that
the syntax reads more naturally.  For example, instead of
"INSERT ON CONFLICT IGNORE" we have "INSERT OR IGNORE".
The keywords change but the meaning of the clause is the same
either way.</p>

<p>The ON CONFLICT clause applies to <a href="lang_createtable.html#uniqueconst">UNIQUE</a>, <a href="lang_createtable.html#notnullconst">NOT NULL</a>,
<a href="lang_createtable.html#ckconst">CHECK</a>, and <a href="lang_createtable.html#primkeyconst">PRIMARY KEY</a> constraints.
The ON CONFLICT algorithm does not
apply to <a href="foreignkeys.html">FOREIGN KEY constraints</a>.
There are five conflict resolution algorithm choices:
ROLLBACK, ABORT, FAIL, IGNORE, and REPLACE.
The default conflict resolution algorithm is ABORT.  This
is what they mean:</p>

<dl>
<dt><b>ROLLBACK</b></dt>
<dd><p> When an applicable constraint violation occurs, the ROLLBACK
resolution algorithm aborts the current SQL statement with
an SQLITE_CONSTRAINT error and rolls back the current transaction.
If no transaction is
active (other than the implied transaction that is created on every
command) then the ROLLBACK resolution algorithm works the same as the
ABORT algorithm.</p></dd>

<dt><b>ABORT</b></dt>
<dd><p> When an applicable constraint violation occurs, the ABORT
resolution algorithm aborts the current SQL statement
with an SQLITE_CONSTRAINT error and backs out any changes
made by the current SQL statement; but changes caused
by prior SQL statements within the same transaction are preserved and the
transaction remains active.
This is the default behavior and the behavior specified by the SQL
standard.</p></dd>

<dt><b>FAIL</b></dt>
<dd><p> When an applicable constraint violation occurs, the FAIL
resolution algorithm aborts the current SQL statement with an
SQLITE_CONSTRAINT error.  But the FAIL resolution does not
back out prior changes of the SQL statement that failed nor does
it end the transaction.
For example, if an UPDATE
statement encountered a constraint violation on the 100th row that
it attempts to update, then the first 99 row changes are preserved
but changes to rows 100 and beyond never occur.</p>

<p>The FAIL behavior only works for uniqueness, NOT NULL, and CHECK 
constraints.  A <a href="foreignkeys.html">foreign key constraint</a> violation causes an ABORT.
</p></dd>

<dt><b>IGNORE</b></dt>
<dd><p> When an applicable constraint violation occurs, 
the IGNORE resolution algorithm skips the one row that contains
the constraint violation and continues processing subsequent rows
of the SQL statement as if nothing went wrong.
Other rows before and after the row that
contained the constraint violation are inserted or updated
normally. No error is returned for uniqueness, NOT NULL, and
UNIQUE constraint errors when the IGNORE conflict resolution
algorithm is used.  However, the IGNORE conflict resolution
algorithm works like ABORT for <a href="foreignkeys.html">foreign key constraint</a> errors.
</p>
</dd>

<dt><b>REPLACE</b></dt>
<dd><p> When a <a href="lang_createtable.html#uniqueconst">UNIQUE</a> or <a href="lang_createtable.html#primkeyconst">PRIMARY KEY</a> constraint violation occurs, 
the REPLACE algorithm
deletes pre-existing rows that are causing the constraint violation
prior to inserting or updating the current row and the command continues 
executing normally.
If a <a href="lang_createtable.html#notnullconst">NOT NULL</a> constraint violation occurs, the REPLACE conflict
resolution replaces the NULL value with
the default value for that column, or if the column has no default
value, then the ABORT algorithm is used.
If a <a href="lang_createtable.html#ckconst">CHECK constraint</a> or <a href="foreignkeys.html">foreign key constraint</a> violation occurs, 
the REPLACE conflict resolution algorithm works like ABORT.</p>

<p>When the REPLACE conflict resolution strategy deletes rows in order to
satisfy a constraint, <a href="lang_createtrigger.html">delete triggers</a> fire if and only if
<a href="pragma.html#pragma_recursive_triggers">recursive triggers</a> are enabled.</p>

<p>The <a href="c3ref/update_hook.html">update hook</a> is not invoked for rows that
are deleted by the REPLACE conflict resolution strategy.  Nor does
REPLACE increment the <a href="c3ref/changes.html">change counter</a>.
The exceptional behaviors defined in this paragraph might change 
in a future release.</p>
</dd></dl>

<p>The algorithm specified in the OR clause of an INSERT or UPDATE
overrides any algorithm specified in a CREATE TABLE.
If no algorithm is specified anywhere, the ABORT algorithm is used.</p>


Added Doc/Extra/Core/lang_corefunc.html.



































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>Built-In Scalar SQL Functions</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
Built-In Scalar SQL Functions
</div>
</div>





<h1 id="overview"><span>1. </span>Overview</h1>

<p>The core functions shown below are available by default. 
<a href="lang_datefunc.html">Date &amp; Time functions</a>,
<a href="lang_aggfunc.html">aggregate functions</a>,
<a href="windowfunctions.html">window functions</a>,
<a href="lang_mathfunc.html">math functions</a>, and
<a href="json1.html">JSON functions</a> are documented separately.  An
application may define additional
functions written in C and added to the database engine using
the <a href="c3ref/create_function.html">sqlite3_create_function()</a> API.</p>

<p><b><a href="syntax/simple-function-invocation.html">simple-function-invocation:</a></b></p><div class='imgcontainer'>
 <div style="max-width:414px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 414.49 126.792">
<circle cx="5" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,55 20,59 20,50" style="fill:rgb(0,0,0)"/>
<path d="M9,55L26,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,70L126,70A15 15 0 0 0 141 55A15 15 0 0 0 126 39L47,39A15 15 0 0 0 32 55A15 15 0 0 0 47 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="86" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">simple-func</text>
<polygon points="164,55 152,59 152,50" style="fill:rgb(0,0,0)"/>
<path d="M141,55L158,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,70A15 15 0 0 0 194 55A15 15 0 0 0 179 39A15 15 0 0 0 164 55A15 15 0 0 0 179 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="179" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="248,55 237,59 237,50" style="fill:rgb(0,0,0)"/>
<path d="M194,55L242,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,70L297,70L297,39L248,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="273" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="351,55 340,59 340,50" style="fill:rgb(0,0,0)"/>
<path d="M297,55L346,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,70A15 15 0 0 0 382 55A15 15 0 0 0 366 39A15 15 0 0 0 351 55A15 15 0 0 0 366 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="366" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="405,55 393,59 393,50" style="fill:rgb(0,0,0)"/>
<path d="M382,55L399,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="408" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M273,32A15 15 0 0 0 288 17L288,17A15 15 0 0 0 273 2A15 15 0 0 0 258 17L258,17A15 15 0 0 0 273 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="273" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="288,17 299,12 299,21" style="fill:rgb(0,0,0)"/>
<path d="M297,55 L 305,55 Q 312,55 312,40 L 312,32 Q 312,17 303,17 L 294,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,17 L 237,17 Q 222,17 222,32 L 222,40 Q 222,55 229,55 L 237,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,82 261,86 261,77" style="fill:rgb(0,0,0)"/>
<path d="M194,55 L 202,55 Q 209,55 209,68 Q 209,82 224,82 L 252,82 L 267,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M273,82 L 310,82 Q 325,82 325,68 Q 325,55 332,55 L 340,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M273,124A15 15 0 0 0 288 109A15 15 0 0 0 273 94A15 15 0 0 0 258 109A15 15 0 0 0 273 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="273" y="109" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="258,109 246,113 246,105" style="fill:rgb(0,0,0)"/>
<path d="M194,55 L 202,55 Q 209,55 209,70 L 209,94 Q 209,109 224,109 L 237,109 L 252,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,109 L 310,109 Q 325,109 325,94 L 325,85 L 325,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
 </div>


<p>
See the <a href="lang_expr.html#*funcinexpr">functions within expressions</a> documentation for
more information about how SQL function invocations fit into the context
of an SQL expression.

</p><h1 id="list_of_core_functions"><span>2. </span>List Of Core Functions</h1>

<p>
<div class='columns' style='columns: 15em auto;'>
<ul style='padding-top:0;'>
<li><a href='lang_corefunc.html#abs'>abs(X)</a></li>
<li><a href='lang_corefunc.html#changes'>changes()</a></li>
<li><a href='lang_corefunc.html#char'>char(X1,X2,...,XN)</a></li>
<li><a href='lang_corefunc.html#coalesce'>coalesce(X,Y,...)</a></li>
<li><a href='lang_corefunc.html#concat'>concat(X,...)</a></li>
<li><a href='lang_corefunc.html#concat_ws'>concat_ws(SEP,X,...)</a></li>
<li><a href='lang_corefunc.html#format'>format(FORMAT,...)</a></li>
<li><a href='lang_corefunc.html#glob'>glob(X,Y)</a></li>
<li><a href='lang_corefunc.html#hex'>hex(X)</a></li>
<li><a href='lang_corefunc.html#ifnull'>ifnull(X,Y)</a></li>
<li><a href='lang_corefunc.html#iif'>iif(X,Y,Z)</a></li>
<li><a href='lang_corefunc.html#instr'>instr(X,Y)</a></li>
<li><a href='lang_corefunc.html#last_insert_rowid'>last_insert_rowid()</a></li>
<li><a href='lang_corefunc.html#length'>length(X)</a></li>
<li><a href='lang_corefunc.html#like'>like(X,Y)</a></li>
<li><a href='lang_corefunc.html#like'>like(X,Y,Z)</a></li>
<li><a href='lang_corefunc.html#likelihood'>likelihood(X,Y)</a></li>
<li><a href='lang_corefunc.html#likely'>likely(X)</a></li>
<li><a href='lang_corefunc.html#load_extension'>load_extension(X)</a></li>
<li><a href='lang_corefunc.html#load_extension'>load_extension(X,Y)</a></li>
<li><a href='lang_corefunc.html#lower'>lower(X)</a></li>
<li><a href='lang_corefunc.html#ltrim'>ltrim(X)</a></li>
<li><a href='lang_corefunc.html#ltrim'>ltrim(X,Y)</a></li>
<li><a href='lang_corefunc.html#max_scalar'>max(X,Y,...)</a></li>
<li><a href='lang_corefunc.html#min_scalar'>min(X,Y,...)</a></li>
<li><a href='lang_corefunc.html#nullif'>nullif(X,Y)</a></li>
<li><a href='lang_corefunc.html#octet_length'>octet_length(X)</a></li>
<li><a href='lang_corefunc.html#printf'>printf(FORMAT,...)</a></li>
<li><a href='lang_corefunc.html#quote'>quote(X)</a></li>
<li><a href='lang_corefunc.html#random'>random()</a></li>
<li><a href='lang_corefunc.html#randomblob'>randomblob(N)</a></li>
<li><a href='lang_corefunc.html#replace'>replace(X,Y,Z)</a></li>
<li><a href='lang_corefunc.html#round'>round(X)</a></li>
<li><a href='lang_corefunc.html#round'>round(X,Y)</a></li>
<li><a href='lang_corefunc.html#rtrim'>rtrim(X)</a></li>
<li><a href='lang_corefunc.html#rtrim'>rtrim(X,Y)</a></li>
<li><a href='lang_corefunc.html#sign'>sign(X)</a></li>
<li><a href='lang_corefunc.html#soundex'>soundex(X)</a></li>
<li><a href='lang_corefunc.html#sqlite_compileoption_get'>sqlite_compileoption_get(N)</a></li>
<li><a href='lang_corefunc.html#sqlite_compileoption_used'>sqlite_compileoption_used(X)</a></li>
<li><a href='lang_corefunc.html#sqlite_offset'>sqlite_offset(X)</a></li>
<li><a href='lang_corefunc.html#sqlite_source_id'>sqlite_source_id()</a></li>
<li><a href='lang_corefunc.html#sqlite_version'>sqlite_version()</a></li>
<li><a href='lang_corefunc.html#substr'>substr(X,Y)</a></li>
<li><a href='lang_corefunc.html#substr'>substr(X,Y,Z)</a></li>
<li><a href='lang_corefunc.html#substr'>substring(X,Y)</a></li>
<li><a href='lang_corefunc.html#substr'>substring(X,Y,Z)</a></li>
<li><a href='lang_corefunc.html#total_changes'>total_changes()</a></li>
<li><a href='lang_corefunc.html#trim'>trim(X)</a></li>
<li><a href='lang_corefunc.html#trim'>trim(X,Y)</a></li>
<li><a href='lang_corefunc.html#typeof'>typeof(X)</a></li>
<li><a href='lang_corefunc.html#unhex'>unhex(X)</a></li>
<li><a href='lang_corefunc.html#unhex'>unhex(X,Y)</a></li>
<li><a href='lang_corefunc.html#unicode'>unicode(X)</a></li>
<li><a href='lang_corefunc.html#unlikely'>unlikely(X)</a></li>
<li><a href='lang_corefunc.html#upper'>upper(X)</a></li>
<li><a href='lang_corefunc.html#zeroblob'>zeroblob(N)</a></li>
</ul>
</div>


<h1 id="descriptions_of_built_in_scalar_sql_functions"><span>3. </span>Descriptions of built-in scalar SQL functions</h1>
<dl>

<a name="abs"></a>
<dt><p><b>abs(<i>X</i>)</b></dt><dd><p>
  The abs(X) function returns the absolute value of the numeric
  argument X.  Abs(X) returns NULL if X is NULL.
  Abs(X) returns 0.0 if X is a string or blob
  that cannot be converted to a numeric value.  If X is the
  integer -9223372036854775808 then abs(X) throws an integer overflow
  error since there is no equivalent positive 64-bit two complement value.
</dd>
<a name="changes"></a>
<dt><p><b>changes()</b></dt><dd><p>
  The changes() function returns the number of database rows that were changed
  or inserted or deleted by the most recently completed INSERT, DELETE,
  or UPDATE statement, exclusive of statements in lower-level triggers.
  The changes() SQL function is a wrapper around the <a href="c3ref/changes.html">sqlite3_changes64()</a>
  C/C++ function and hence follows the same rules for counting changes.
</dd>
<a name="char"></a>
<dt><p><b>char(<i>X1</i>,<i>X2</i>,...,<i>XN</i>)</b></dt><dd><p>
  The char(X1,X2,...,XN) function returns a string composed of characters having the
   unicode code point values of integers X1 through XN, respectively.
</dd>
<a name="coalesce"></a>
<dt><p><b>coalesce(<i>X</i>,<i>Y</i>,...)</b></dt><dd><p>
  The coalesce() function returns a copy of its first non-NULL argument, or
  NULL if all arguments are NULL.  Coalesce() must have at least 
  2 arguments.
</dd>
<a name="concat"></a>
<dt><p><b>concat(<i>X</i>,...)</b></dt><dd><p>
  The concat(...) function returns a string which is the concatenation of the
  string representation of all of its non-NULL arguments.  If all arguments are
  NULL, then concat() returns an empty string.
</dd>
<a name="concat_ws"></a>
<dt><p><b>concat_ws(<i>SEP</i>,<i>X</i>,...)</b></dt><dd><p>
  The concat_ws(SEP,...) function returns a string that is the concatenation of
  all non-null arguments beyond the first argument, using the text value of the
  first argument as a separator.  If the first argument is NULL, then concat_ws()
  returns NULL.  If all arguments other than the first are NULL, then concat_ws()
  returns an empty string.
</dd>
<a name="format"></a>
<dt><p><b>format(<i>FORMAT</i>,...)</b></dt><dd><p>
  The format(FORMAT,...) SQL function works like the <a href="c3ref/mprintf.html">sqlite3_mprintf()</a> C-language
  function and the printf() function from the standard C library.
  The first argument is a format string that specifies how to construct the output
  string using values taken from subsequent arguments.  If the FORMAT argument is
  missing or NULL then the result is NULL.  The %n format is silently ignored and
  does not consume an argument.  The %p format is an alias for %X.  The %z format
  is interchangeable with %s.  If there are too few arguments in the argument list,
  missing arguments are assumed to have a NULL value, which is translated into
  0 or 0.0 for numeric formats or an empty string for %s.  See the
  <a href="printf.html">built-in printf()</a> documentation for additional information.
</dd>
<a name="glob"></a>
<dt><p><b>glob(<i>X</i>,<i>Y</i>)</b></dt><dd><p>
  The glob(X,Y) function is equivalent to the
  expression "<b>Y GLOB X</b>".
  Note that the X and Y arguments are reversed in the glob() function
  relative to the infix <a href="lang_expr.html#glob">GLOB</a> operator.  Y is the string and X is the
  pattern.  So, for example, the following expressions are equivalent:
  <blockquote><pre>
     name GLOB '*helium*'
     glob('*helium*',name)
  </pre></blockquote>
  <p>If the <a href="c3ref/create_function.html">sqlite3_create_function()</a> interface is used to
  override the glob(X,Y) function with an alternative implementation then
  the <a href="lang_expr.html#glob">GLOB</a> operator will invoke the alternative implementation.
</dd>
<a name="hex"></a>
<dt><p><b>hex(<i>X</i>)</b></dt><dd><p>
  The hex() function interprets its argument as a BLOB and returns
  a string which is the upper-case hexadecimal rendering of the content of
  that blob.
  <p>
  If the argument <i>X</i> in "hex(<i>X</i>)" is an
  integer or floating point number, then "interprets its argument as a BLOB" means
  that the binary number is first converted into a UTF8 text representation, then
  that text is interpreted as a BLOB.  Hence, "hex(12345678)" renders
  as "3132333435363738" not the binary representation of the integer value
  "0000000000BC614E".
  <p>
  See also:  <a href="lang_corefunc.html#unhex">unhex()</a>
</dd>
<a name="ifnull"></a>
<dt><p><b>ifnull(<i>X</i>,<i>Y</i>)</b></dt><dd><p>
  The ifnull() function returns a copy of its first non-NULL argument, or
  NULL if both arguments are NULL.  Ifnull() must have exactly 2 arguments.
  The ifnull() function is equivalent to <a href="lang_corefunc.html#coalesce">coalesce()</a> with two arguments.
</dd>
<a name="iif"></a>
<dt><p><b>iif(<i>X</i>,<i>Y</i>,<i>Z</i>)</b></dt><dd><p>
  The iif(X,Y,Z) function returns the value Y if X is true, and Z otherwise.
  The iif(X,Y,Z) function is logically equivalent to and generates the same
  <a href="opcode.html">bytecode</a> as the <a href="lang_expr.html#case">CASE expression</a> "CASE WHEN X THEN Y ELSE Z END".
</dd>
<a name="instr"></a>
<dt><p><b>instr(<i>X</i>,<i>Y</i>)</b></dt><dd><p>
  The instr(X,Y) function finds the first occurrence of string Y within 
  string X and returns the number of prior characters plus 1, or 0 if
  Y is nowhere found within X.
  Or, if X and Y are both BLOBs, then instr(X,Y) returns one
  more than the number bytes prior to the first occurrence of Y, or 0 if
  Y does not occur anywhere within X.
  If both arguments X and Y to instr(X,Y) are non-NULL and are not BLOBs
  then both are interpreted as strings.
  If either X or Y are NULL in instr(X,Y) then the result is NULL.
</dd>
<a name="last_insert_rowid"></a>
<dt><p><b>last_insert_rowid()</b></dt><dd><p>
  The last_insert_rowid() function returns the <a href="lang_createtable.html#rowid">ROWID</a>
  of the last row insert from the database connection which invoked the
  function.
  The last_insert_rowid() SQL function is a wrapper around the
  <a href="c3ref/last_insert_rowid.html">sqlite3_last_insert_rowid()</a> C/C++ interface function.
</dd>
<a name="length"></a>
<dt><p><b>length(<i>X</i>)</b></dt><dd><p>
  For a string value X, the length(X) function returns the number of 
  characters (not bytes) in X prior to the first NUL character.
  Since SQLite strings do not normally contain NUL characters, the length(X)
  function will usually return the total number of characters in the string X.
  For a blob value X, length(X) returns the number of bytes in the blob.
  If X is NULL then length(X) is NULL.
  If X is numeric then length(X) returns the length of a string
  representation of X.
  <p>
  Note that for strings, the length(X) function returns the <i>character</i>
  length of the string, not the byte length.  The character length is the number
  of characters in the string.  The character length is always different from
  the byte length for UTF-16 strings, and can be different from the byte length
  for UTF-8 strings if the string contains multi-byte characters.  Use the
  <a href="lang_corefunc.html#octet_length">octet_length()</a> function to find the byte length of a string.
  <p>
  For BLOB values, length(X) always returns the byte-length of the BLOB.
  <p>
  For string values, length(X) must read the entire string into memory in order
  to compute the character length.  But for BLOB values, that is not necessary as
  SQLite knows how many bytes are in the BLOB.  Hence, for multi-megabyte values,
  the length(X) function is usually much faster for BLOBs than for strings, since
  it does not need to load the value into memory.
</dd>
<a name="like"></a>
<dt><p><b>like(<i>X</i>,<i>Y</i>)<br />like(<i>X</i>,<i>Y</i>,<i>Z</i>)</b></dt><dd><p>
  The like() function is used to implement the
  "<b>Y LIKE X &#91;ESCAPE Z&#93;</b>" expression. 
  If the optional ESCAPE clause is present, then the
  like() function is invoked with three arguments.  Otherwise, it is
  invoked with two arguments only. Note that the X and Y parameters are
  reversed in the like() function relative to the infix <a href="lang_expr.html#like">LIKE</a> operator.
  X is the pattern and Y is the string to match against that pattern.
  Hence, the following expressions are equivalent:
  <blockquote><pre>
     name LIKE '%neon%'
     like('%neon%',name)
  </pre></blockquote>
  <p>The <a href="c3ref/create_function.html">sqlite3_create_function()</a> interface can be used to override the
  like() function and thereby change the operation of the
  <a href="lang_expr.html#like">LIKE</a> operator.  When overriding the like() function, it may be important
  to override both the two and three argument versions of the like() 
  function. Otherwise, different code may be called to implement the
  <a href="lang_expr.html#like">LIKE</a> operator depending on whether or not an ESCAPE clause was 
  specified.
</dd>
<a name="likelihood"></a>
<dt><p><b>likelihood(<i>X</i>,<i>Y</i>)</b></dt><dd><p>
  The likelihood(X,Y) function returns argument X unchanged.
  The value Y in likelihood(X,Y) must be a floating point constant
  between 0.0 and 1.0, inclusive.
  The likelihood(X) function is a no-op that the code generator
  optimizes away so that it consumes no CPU cycles during run-time
  (that is, during calls to <a href="c3ref/step.html">sqlite3_step()</a>).
  The purpose of the likelihood(X,Y) function is to provide a hint
  to the query planner that the argument X is a boolean that is
  true with a probability of approximately Y.
  The <a href="lang_corefunc.html#unlikely">unlikely(X)</a> function is short-hand for likelihood(X,0.0625).
  The <a href="lang_corefunc.html#likely">likely(X)</a> function is short-hand for likelihood(X,0.9375).
</dd>
<a name="likely"></a>
<dt><p><b>likely(<i>X</i>)</b></dt><dd><p>
  The likely(X) function returns the argument X unchanged.
  The likely(X) function is a no-op that the code generator
  optimizes away so that it consumes no CPU cycles at
  run-time (that is, during calls to <a href="c3ref/step.html">sqlite3_step()</a>).
  The purpose of the likely(X) function is to provide a hint
  to the query planner that the argument X is a boolean value
  that is usually true. The likely(X) function is equivalent
  to <a href="lang_corefunc.html#likelihood">likelihood</a>(X,0.9375). See also: <a href="lang_corefunc.html#unlikely">unlikely(X)</a>.
</dd>
<a name="load_extension"></a>
<dt><p><b>load_extension(<i>X</i>)<br />load_extension(<i>X</i>,<i>Y</i>)</b></dt><dd><p>
  The load_extension(X,Y) function loads <a href="loadext.html">SQLite extensions</a> out of the shared
  library file named X using the entry point Y.  The result of load_extension()
  is always a NULL.  If Y is omitted then the default entry point name is used.
  The load_extension() function raises an exception if the extension fails to
  load or initialize correctly.

  <p>The load_extension() function will fail if the extension attempts to 
  modify or delete an SQL function or collating sequence.  The
  extension can add new functions or collating sequences, but cannot
  modify or delete existing functions or collating sequences because
  those functions and/or collating sequences might be used elsewhere
  in the currently running SQL statement.  To load an extension that
  changes or deletes functions or collating sequences, use the
  <a href="c3ref/load_extension.html">sqlite3_load_extension()</a> C-language API.</p>

  <p>For security reasons, extension loading is disabled by default and must
  be enabled by a prior call to <a href="c3ref/enable_load_extension.html">sqlite3_enable_load_extension()</a>.</p>
</dd>
<a name="lower"></a>
<dt><p><b>lower(<i>X</i>)</b></dt><dd><p>
  The lower(X) function returns a copy of string X with all ASCII characters
  converted to lower case.  The default built-in lower() function works
  for ASCII characters only.  To do case conversions on non-ASCII
  characters, load the ICU extension.
</dd>
<a name="ltrim"></a>
<dt><p><b>ltrim(<i>X</i>)<br />ltrim(<i>X</i>,<i>Y</i>)</b></dt><dd><p>
  The ltrim(X,Y) function returns a string formed by removing any and all
  characters that appear in Y from the left side of X.
  If the Y argument is omitted, ltrim(X) removes spaces from the left side
  of X.
</dd>
<a name="max_scalar"></a>
<dt><p><b>max(<i>X</i>,<i>Y</i>,...)</b></dt><dd><p>
  The multi-argument max() function returns the argument with the 
  maximum value, or return NULL if any argument is NULL. 
  The multi-argument max() function searches its arguments from left to right
  for an argument that defines a collating function and uses that collating
  function for all string comparisons.  If none of the arguments to max()
  define a collating function, then the BINARY collating function is used.
  Note that <b>max()</b> is a simple function when
  it has 2 or more arguments but operates as an
  <a href="lang_aggfunc.html#max_agg">aggregate function</a> if given only a single argument.
</dd>
<a name="min_scalar"></a>
<dt><p><b>min(<i>X</i>,<i>Y</i>,...)</b></dt><dd><p>
  The multi-argument min() function returns the argument with the
  minimum value.
  The multi-argument min() function searches its arguments from left to right
  for an argument that defines a collating function and uses that collating
  function for all string comparisons.  If none of the arguments to min()
  define a collating function, then the BINARY collating function is used.
  Note that <b>min()</b> is a simple function when
  it has 2 or more arguments but operates as an 
  <a href="lang_aggfunc.html#min_agg">aggregate function</a> if given
  only a single argument.
</dd>
<a name="nullif"></a>
<dt><p><b>nullif(<i>X</i>,<i>Y</i>)</b></dt><dd><p>
  The nullif(X,Y) function returns its first argument if the arguments are
  different and NULL if the arguments are the same.  The nullif(X,Y) function
  searches its arguments from left to right for an argument that defines a
  collating function and uses that collating function for all string
  comparisons.  If neither argument to nullif() defines a collating function
  then the BINARY collating function is used.
</dd>
<a name="octet_length"></a>
<dt><p><b>octet_length(<i>X</i>)</b></dt><dd><p>
  The octet_length(X) function returns the number of bytes in the encoding
  of text string X.  If X is NULL then octet_length(X) returns NULL.  If X is
  a BLOB value, then octet_length(X) is the same as <a href="lang_corefunc.html#length">length(X)</a>.  If X is a
  numeric value, then octet_length(X) returns the number of bytes in a text
  rendering of that number.
  <p>
  Because octet_length(X) returns the number of bytes in X, not the number
  of characters, the value returned depends on the database encoding.  The
  octet_length() function can return different answers for the same input string
  if the database encoding is UTF16 instead of UTF8.
  <p>
  If argument X is a table column and the value is of type text or blob,
  then octet_length(X) avoids reading the content of X from disk, as the byte
  length can be computed from metadata.  Thus, octet_length(X) is efficient
  even if X is a column containing a multi-megabyte text or blob value.
</dd>
<a name="printf"></a>
<dt><p><b>printf(<i>FORMAT</i>,...)</b></dt><dd><p>
  The printf() SQL function is an alias for the <a href="lang_corefunc.html#format">format() SQL function</a>.
  The format() SQL function was originally named printf(). But the name was
  later changed to format() for compatibility with other database engines.
  The printf() name is retained as an alias so as not to break legacy code.
</dd>
<a name="quote"></a>
<dt><p><b>quote(<i>X</i>)</b></dt><dd><p>
  The quote(X) function returns the text of an SQL literal which
  is the value of its argument suitable for inclusion into an SQL statement.
  Strings are surrounded by single-quotes with escapes on interior quotes
  as needed.  BLOBs are encoded as hexadecimal literals.
  Strings with embedded NUL characters cannot be represented as string
  literals in SQL and hence the returned string literal is truncated prior
  to the first NUL.
</dd>
<a name="random"></a>
<dt><p><b>random()</b></dt><dd><p>
  The random() function returns a pseudo-random integer
  between -9223372036854775808 and +9223372036854775807.
</dd>
<a name="randomblob"></a>
<dt><p><b>randomblob(<i>N</i>)</b></dt><dd><p>
  The randomblob(N) function return an N-byte blob containing pseudo-random
  bytes. If N is less than 1 then a 1-byte random blob is returned.

  <p>Hint:  applications can generate globally unique identifiers
  using this function together with <a href="lang_corefunc.html#hex">hex()</a> and/or
  <a href="lang_corefunc.html#lower">lower()</a> like this:</p>

  <blockquote>
  hex(randomblob(16))<br></br>
  lower(hex(randomblob(16)))
  </blockquote>
</dd>
<a name="replace"></a>
<dt><p><b>replace(<i>X</i>,<i>Y</i>,<i>Z</i>)</b></dt><dd><p>
  The replace(X,Y,Z) function returns a string formed by substituting
  string Z for every occurrence of string Y in string X.  The <a href="datatype3.html#collation">BINARY</a>
  collating sequence is used for comparisons.  If Y is an empty
  string then return X unchanged.  If Z is not initially
  a string, it is cast to a UTF-8 string prior to processing.
</dd>
<a name="round"></a>
<dt><p><b>round(<i>X</i>)<br />round(<i>X</i>,<i>Y</i>)</b></dt><dd><p>
  The round(X,Y) function returns a floating-point
  value X rounded to Y digits to the right of the decimal point.
  If the Y argument is omitted or negative, it is taken to be 0.
</dd>
<a name="rtrim"></a>
<dt><p><b>rtrim(<i>X</i>)<br />rtrim(<i>X</i>,<i>Y</i>)</b></dt><dd><p>
  The rtrim(X,Y) function returns a string formed by removing any and all
  characters that appear in Y from the right side of X.
  If the Y argument is omitted, rtrim(X) removes spaces from the right
  side of X.
</dd>
<a name="sign"></a>
<dt><p><b>sign(<i>X</i>)</b></dt><dd><p>
  The sign(X) function returns -1, 0, or +1 if the argument X is a numeric
  value that is negative, zero, or positive, respectively.  If the argument
  to sign(X) is NULL or is a string or blob that cannot be losslessly converted
  into a number, then sign(X) returns NULL.
</dd>
<a name="soundex"></a>
<dt><p><b>soundex(<i>X</i>)</b></dt><dd><p>
  The soundex(X) function returns a string that is the soundex encoding 
  of the string X.
  The string "?000" is returned if the argument is NULL or contains
  no ASCII alphabetic characters.
  This function is omitted from SQLite by default.
  It is only available if the <a href="compile.html#soundex">SQLITE_SOUNDEX</a> compile-time option
  is used when SQLite is built.
</dd>
<a name="sqlite_compileoption_get"></a>
<dt><p><b>sqlite_compileoption_get(<i>N</i>)</b></dt><dd><p>
  The sqlite_compileoption_get() SQL function is a wrapper around the
  <a href="c3ref/compileoption_get.html">sqlite3_compileoption_get()</a> C/C++ function.
  This routine returns the N-th compile-time option used to build SQLite
  or NULL if N is out of range.  See also the <a href="pragma.html#pragma_compile_options">compile_options pragma</a>.
</dd>
<a name="sqlite_compileoption_used"></a>
<dt><p><b>sqlite_compileoption_used(<i>X</i>)</b></dt><dd><p>
  The sqlite_compileoption_used() SQL function is a wrapper around the
  <a href="c3ref/compileoption_get.html">sqlite3_compileoption_used()</a> C/C++ function.
  When the argument X to sqlite_compileoption_used(X) is a string which
  is the name of a compile-time option, this routine returns true (1) or
  false (0) depending on whether or not that option was used during the
  build.
</dd>
<a name="sqlite_offset"></a>
<dt><p><b>sqlite_offset(<i>X</i>)</b></dt><dd><p>
  The sqlite_offset(X) function returns the byte offset in the database
  file for the beginning of the record from which value would be read.
  If X is not a column in an ordinary table, then sqlite_offset(X) returns
  NULL.  The value returned by sqlite_offset(X) might reference either the
  original table or an index, depending on the query.  If the value X would
  normally be extracted from an index, the sqlite_offset(X) returns the
  offset to the corresponding index record.  If the value X would be
  extracted from the original table, then sqlite_offset(X) returns the offset
  to the table record.

  <p>The sqlite_offset(X) SQL function is only available if SQLite is built
  using the <a href="compile.html#enable_offset_sql_func">-DSQLITE_ENABLE_OFFSET_SQL_FUNC</a> compile-time option.
</dd>
<a name="sqlite_source_id"></a>
<dt><p><b>sqlite_source_id()</b></dt><dd><p>
  The sqlite_source_id() function returns a string that identifies the
  specific version of the source code that was used to build the SQLite
  library.  The string returned by sqlite_source_id() is
  the date and time that the source code was checked in followed by
  the SHA3-256 hash for that check-in.  This function is
  an SQL wrapper around the <a href="c3ref/libversion.html">sqlite3_sourceid()</a> C interface.
</dd>
<a name="sqlite_version"></a>
<dt><p><b>sqlite_version()</b></dt><dd><p>
  The sqlite_version() function returns the version string for the SQLite
  library that is running.  This function is an SQL
  wrapper around the <a href="c3ref/libversion.html">sqlite3_libversion()</a> C-interface.
</dd>
<a name="substr"></a>
<dt><p><b>substr(<i>X</i>,<i>Y</i>,<i>Z</i>)<br />substr(<i>X</i>,<i>Y</i>)<br />substring(<i>X</i>,<i>Y</i>,<i>Z</i>)<br />substring(<i>X</i>,<i>Y</i>)</b></dt><dd><p>
  The substr(X,Y,Z) function returns a substring of input string X that begins
  with the Y-th character and which is Z characters long.
  If Z is omitted then substr(X,Y) returns all characters through the end
  of the string X beginning with the Y-th.
  The left-most character of X is number 1.  If Y is negative
  then the first character of the substring is found by counting from the
  right rather than the left.  If Z is negative then
  the abs(Z) characters preceding the Y-th character are returned.
  If X is a string then characters indices refer to actual UTF-8 
  characters.  If X is a BLOB then the indices refer to bytes.
  <p>
  "substring()" is an alias for "substr()" beginning with SQLite version 3.34.
</dd>
<a name="total_changes"></a>
<dt><p><b>total_changes()</b></dt><dd><p>
  The total_changes() function returns the number of row changes
  caused by INSERT, UPDATE or DELETE
  statements since the current database connection was opened.
  This function is a wrapper around the <a href="c3ref/total_changes.html">sqlite3_total_changes64()</a>
  C/C++ interface.
</dd>
<a name="trim"></a>
<dt><p><b>trim(<i>X</i>)<br />trim(<i>X</i>,<i>Y</i>)</b></dt><dd><p>
  The trim(X,Y) function returns a string formed by removing any and all
  characters that appear in Y from both ends of X.
  If the Y argument is omitted, trim(X) removes spaces from both ends of X.
</dd>
<a name="typeof"></a>
<dt><p><b>typeof(<i>X</i>)</b></dt><dd><p>
  The typeof(X) function returns a string that indicates the <a href="datatype3.html">datatype</a> of
  the expression X: "null", "integer", "real", "text", or "blob".
</dd>
<a name="unhex"></a>
<dt><p><b>unhex(<i>X</i>)<br />unhex(<i>X</i>,<i>Y</i>)</b></dt><dd><p>
  The unhex(X,Y) function returns a BLOB value which is the decoding of the
  hexadecimal string X.  If X contains any
  characters that are not hexadecimal digits and which are not in Y, 
  then unhex(X,Y) returns NULL. If Y is omitted, it is
  understood to be an empty string and hence X must be a pure hexadecimal string.
  All hexadecimal digits in X must occur in pairs, with both digits of each
  pair beginning immediately adjacent to one another, or else unhex(X,Y)
  returns NULL.
  If either parameter X or Y is NULL, then unhex(X,Y) returns NULL.
  The X input may contain an arbitrary mix of upper and lower case hexadecimal
  digits.
  Hexadecimal digits in Y have no affect on the translation of X.  Only
  characters in Y that are not hexadecimal digits are ignored in X.
  <p>
  See also:  <a href="lang_corefunc.html#hex">hex()</a>
</dd>
<a name="unicode"></a>
<dt><p><b>unicode(<i>X</i>)</b></dt><dd><p>
  The unicode(X) function returns the numeric unicode code point corresponding to
  the first character of the string X.  If the argument to unicode(X) is not a string
  then the result is undefined.
</dd>
<a name="unlikely"></a>
<dt><p><b>unlikely(<i>X</i>)</b></dt><dd><p>
  The unlikely(X) function returns the argument X unchanged.
  The unlikely(X) function is a no-op that the code generator
  optimizes away so that it consumes no CPU cycles at
  run-time (that is, during calls to <a href="c3ref/step.html">sqlite3_step()</a>).
  The purpose of the unlikely(X) function is to provide a hint
  to the query planner that the argument X is a boolean value
  that is usually not true. The unlikely(X) function is equivalent
  to <a href="lang_corefunc.html#likelihood">likelihood</a>(X, 0.0625).
</dd>
<a name="upper"></a>
<dt><p><b>upper(<i>X</i>)</b></dt><dd><p>
  The upper(X) function returns a copy of input string X in which all 
  lower-case ASCII characters are converted to their upper-case equivalent.
</dd>
<a name="zeroblob"></a>
<dt><p><b>zeroblob(<i>N</i>)</b></dt><dd><p>
  The zeroblob(N) function returns a BLOB consisting of N bytes of 0x00.
  SQLite manages these zeroblobs very efficiently.  Zeroblobs can be used to
  reserve space for a BLOB that is later written using 
  <a href="c3ref/blob_open.html">incremental BLOB I/O</a>.
  This SQL function is implemented using the <a href="c3ref/result_blob.html">sqlite3_result_zeroblob()</a>
  routine from the C/C++ interface.
</dd>

</dl>
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_corefunc.in?m=a451f26240">2023-12-05 14:43:20</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_createindex.html.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>CREATE INDEX</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
CREATE INDEX
</div>
</div>




<h1 id="syntax"><span>1. </span>Syntax</h1>
<p><b><a href="syntax/create-index-stmt.html">create-index-stmt:</a></b>
<button id='x80fb9fab' onclick='hideorshow("x80fb9fab","x7af438dd")'>hide</button></p>
 <div id='x7af438dd' class='imgcontainer'>
 <div style="max-width:907px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 907.43 232.632">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L100,32A15 15 0 0 0 116 17A15 15 0 0 0 100 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CREATE</text>
<path d="M167,56L222,56A15 15 0 0 0 237 41A15 15 0 0 0 222 26L167,26A15 15 0 0 0 152 41A15 15 0 0 0 167 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNIQUE</text>
<path d="M288,32L327,32A15 15 0 0 0 342 17A15 15 0 0 0 327 2L288,2A15 15 0 0 0 273 17A15 15 0 0 0 288 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="307" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEX</text>
<polygon points="194,17 183,21 183,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L188,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,17 261,21 261,12" style="fill:rgb(0,0,0)"/>
<path d="M194,17L267,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,41 140,45 140,37" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,29 Q 131,41 138,41 L 146,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M237,41 L 244,41 Q 252,41 252,29 Q 252,17 256,17 L 261,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,17 367,21 367,12" style="fill:rgb(0,0,0)"/>
<path d="M342,17L372,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,32A15 15 0 0 0 408 17A15 15 0 0 0 393 2A15 15 0 0 0 378 17A15 15 0 0 0 393 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="393" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="431,17 420,21 420,12" style="fill:rgb(0,0,0)"/>
<path d="M408,17L426,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M447,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L447,2A15 15 0 0 0 431 17A15 15 0 0 0 447 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="457" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="505,17 493,21 493,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L499,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M520,32L565,32A15 15 0 0 0 580 17A15 15 0 0 0 565 2L520,2A15 15 0 0 0 505 17A15 15 0 0 0 520 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="542" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="194,71 206,67 206,76" style="fill:rgb(0,0,0)"/>
<path d="M342,17 L 350,17 Q 357,17 357,32 L 357,56 Q 357,71 342,71 L 215,71 L 200,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,71 516,67 516,76" style="fill:rgb(0,0,0)"/>
<path d="M580,17 L 601,17 Q 616,17 616,32 L 616,56 Q 616,71 601,71 L 526,71 L 511,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,71L273,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,109 17,113 17,105" style="fill:rgb(0,0,0)"/>
<path d="M273,71 L 20,71 Q 5,71 5,86 L 5,94 Q 5,109 14,109 L 23,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,124L140,124A15 15 0 0 0 155 109A15 15 0 0 0 140 94L43,94A15 15 0 0 0 28 109A15 15 0 0 0 43 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="178,109 166,113 166,105" style="fill:rgb(0,0,0)"/>
<path d="M155,109L172,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M193,124A15 15 0 0 0 208 109A15 15 0 0 0 193 94A15 15 0 0 0 178 109A15 15 0 0 0 193 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="109" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="244,109 233,113 233,105" style="fill:rgb(0,0,0)"/>
<path d="M208,109L238,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,124L338,124A15 15 0 0 0 353 109A15 15 0 0 0 338 94L259,94A15 15 0 0 0 244 109A15 15 0 0 0 259 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<polygon points="376,109 364,113 364,105" style="fill:rgb(0,0,0)"/>
<path d="M353,109L370,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,124L400,124A15 15 0 0 0 415 109A15 15 0 0 0 400 94L391,94A15 15 0 0 0 376 109A15 15 0 0 0 391 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="438,109 427,113 427,105" style="fill:rgb(0,0,0)"/>
<path d="M415,109L432,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,124L528,124A15 15 0 0 0 543 109A15 15 0 0 0 528 94L453,94A15 15 0 0 0 438 109A15 15 0 0 0 453 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="491" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="567,109 555,113 555,105" style="fill:rgb(0,0,0)"/>
<path d="M543,109L561,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,124A15 15 0 0 0 597 109A15 15 0 0 0 582 94A15 15 0 0 0 567 109A15 15 0 0 0 582 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="109" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="633,109 621,113 621,105" style="fill:rgb(0,0,0)"/>
<path d="M597,109L627,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M633,124L777,124L777,94L633,94Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="705" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">indexed-column</text>
<polygon points="813,109 802,113 802,105" style="fill:rgb(0,0,0)"/>
<path d="M777,109L808,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M828,124A15 15 0 0 0 844 109A15 15 0 0 0 828 94A15 15 0 0 0 813 109A15 15 0 0 0 828 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="828" y="109" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<path d="M705,162A15 15 0 0 0 720 147A15 15 0 0 0 705 132A15 15 0 0 0 690 147A15 15 0 0 0 705 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="705" y="147" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="720,147 732,142 732,151" style="fill:rgb(0,0,0)"/>
<path d="M777,109 L 785,109 Q 792,109 792,124 L 792,132 Q 792,147 777,147 L 741,147 L 726,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M690,147 L 625,147 Q 610,147 610,132 L 610,124 Q 610,109 617,109 L 625,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="92,139 80,144 80,135" style="fill:rgb(0,0,0)"/>
<path d="M5,94 L 5,124 Q 5,139 20,139 L 71,139 L 86,139"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M92,139 L 205,139 Q 220,139 220,124 L 220,124 Q 220,109 227,109 L 235,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M684,230L733,230A15 15 0 0 0 748 215A15 15 0 0 0 733 200L684,200A15 15 0 0 0 669 215A15 15 0 0 0 684 230Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="709" y="215" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="772,215 760,219 760,211" style="fill:rgb(0,0,0)"/>
<path d="M748,215L766,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M772,230L821,230L821,200L772,200Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="796" y="215" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="898,215 886,219 886,211" style="fill:rgb(0,0,0)"/>
<path d="M821,215L892,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="901" cy="215" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="859,147 854,135 863,135" style="fill:rgb(0,0,0)"/>
<path d="M844,109 L 851,109 Q 859,109 859,124 L 859,126 L 859,141"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M859,147 L 859,200 Q 859,215 872,215 L 886,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="705,177 717,173 717,181" style="fill:rgb(0,0,0)"/>
<path d="M859,147 L 859,162 Q 859,177 844,177 L 726,177 L 711,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="669,215 657,219 657,211" style="fill:rgb(0,0,0)"/>
<path d="M705,177 L 661,177 Q 646,177 646,192 L 646,200 Q 646,215 654,215 L 663,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/expr.html">expr:</a></b>
<button id='x44a3393f' onclick='hideorshow("x44a3393f","x645a052f")'>show</button></p>
 <div id='x645a052f' style='display:none;' class='imgcontainer'>
 <div style="max-width:963px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 963.96 1068.77">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L158,32L158,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="101" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="954,17 943,21 943,12" style="fill:rgb(0,0,0)"/>
<path d="M158,17L948,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="958" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L172,70A15 15 0 0 0 187 55L187,55A15 15 0 0 0 172 39L60,39A15 15 0 0 0 45 55L45,55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">bind-parameter</text>
<polygon points="916,55 905,59 905,50" style="fill:rgb(0,0,0)"/>
<path d="M187,55L910,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,55 L 924,55 Q 931,55 931,47 L 931,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 31,55 L 39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,130L156,130A15 15 0 0 0 171 115A15 15 0 0 0 156 100L60,100A15 15 0 0 0 45 115A15 15 0 0 0 60 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,115 183,119 183,111" style="fill:rgb(0,0,0)"/>
<path d="M171,115L189,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,130A15 15 0 0 0 225 115A15 15 0 0 0 210 100A15 15 0 0 0 195 115A15 15 0 0 0 210 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M225,115L255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130L351,130A15 15 0 0 0 366 115A15 15 0 0 0 351 100L276,100A15 15 0 0 0 261 115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="389,115 378,119 378,111" style="fill:rgb(0,0,0)"/>
<path d="M366,115L383,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,130A15 15 0 0 0 419 115A15 15 0 0 0 404 100A15 15 0 0 0 389 115A15 15 0 0 0 404 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="404" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="455,115 444,119 444,111" style="fill:rgb(0,0,0)"/>
<path d="M419,115L450,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,130L565,130A15 15 0 0 0 580 115A15 15 0 0 0 565 100L471,100A15 15 0 0 0 455 115A15 15 0 0 0 471 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="916,115 905,119 905,111" style="fill:rgb(0,0,0)"/>
<path d="M580,115L910,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,115 L 924,115 Q 931,115 931,108 L 931,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,115 33,119 33,111" style="fill:rgb(0,0,0)"/>
<path d="M24,100 L 24,108 Q 24,115 31,115 L 39,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,89 97,93 97,84" style="fill:rgb(0,0,0)"/>
<path d="M24,74 L 24,81 Q 24,89 39,89 L 87,89 L 102,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 302,93 302,84" style="fill:rgb(0,0,0)"/>
<path d="M108,89 L 129,89 Q 144,89 159,89 L 293,89 L 308,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,89 L 414,89 Q 429,89 429,102 Q 429,115 436,115 L 444,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M223,89 L 230,89 Q 238,89 238,102 Q 238,115 245,115 L 253,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,168L168,168A15 15 0 0 0 183 153A15 15 0 0 0 168 138L60,138A15 15 0 0 0 45 153A15 15 0 0 0 60 168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">unary-operator</text>
<polygon points="206,153 194,157 194,149" style="fill:rgb(0,0,0)"/>
<path d="M183,153L200,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,168L255,168L255,138L206,138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,153 905,157 905,149" style="fill:rgb(0,0,0)"/>
<path d="M255,153L910,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,153 L 924,153 Q 931,153 931,145 L 931,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,153 33,157 33,149" style="fill:rgb(0,0,0)"/>
<path d="M24,138 L 24,145 Q 24,153 31,153 L 39,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,206L94,206L94,176L45,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,191 106,195 106,186" style="fill:rgb(0,0,0)"/>
<path d="M94,191L111,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,206L245,206A15 15 0 0 0 261 191A15 15 0 0 0 245 176L132,176A15 15 0 0 0 117 191A15 15 0 0 0 132 206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">binary-operator</text>
<polygon points="284,191 272,195 272,186" style="fill:rgb(0,0,0)"/>
<path d="M261,191L278,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,206L333,206L333,176L284,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="308" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,191 905,195 905,186" style="fill:rgb(0,0,0)"/>
<path d="M333,191L910,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,191 L 924,191 Q 931,191 931,183 L 931,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,191 33,195 33,186" style="fill:rgb(0,0,0)"/>
<path d="M24,176 L 24,183 Q 24,191 31,191 L 39,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,245L162,245A15 15 0 0 0 177 230A15 15 0 0 0 162 215L60,215A15 15 0 0 0 45 230A15 15 0 0 0 60 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="111" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-name</text>
<polygon points="194,230 183,234 183,226" style="fill:rgb(0,0,0)"/>
<path d="M177,230L188,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,245A15 15 0 0 0 224 230A15 15 0 0 0 209 215A15 15 0 0 0 194 230A15 15 0 0 0 209 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="260,230 249,234 249,226" style="fill:rgb(0,0,0)"/>
<path d="M224,230L255,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,245L437,245L437,215L260,215Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-arguments</text>
<polygon points="473,230 461,234 461,226" style="fill:rgb(0,0,0)"/>
<path d="M437,230L467,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,245A15 15 0 0 0 503 230A15 15 0 0 0 488 215A15 15 0 0 0 473 230A15 15 0 0 0 488 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="541,260 529,265 529,256" style="fill:rgb(0,0,0)"/>
<path d="M503,230 L 510,230 Q 518,230 518,245 L 518,245 Q 518,260 527,260 L 535,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,275L653,275L653,245L541,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="691,230 680,234 680,226" style="fill:rgb(0,0,0)"/>
<path d="M653,260 L 661,260 Q 668,260 668,245 L 668,245 Q 668,230 677,230 L 685,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="729,260 718,265 718,256" style="fill:rgb(0,0,0)"/>
<path d="M691,230 L 699,230 Q 706,230 706,245 L 706,245 Q 706,260 715,260 L 723,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,275L837,275L837,245L729,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="783" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">over-clause</text>
<polygon points="916,260 905,265 905,256" style="fill:rgb(0,0,0)"/>
<path d="M837,260L910,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,260 L 924,260 Q 931,260 931,253 L 931,245"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,230 33,234 33,226" style="fill:rgb(0,0,0)"/>
<path d="M24,215 L 24,222 Q 24,230 31,230 L 39,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,230 585,234 585,226" style="fill:rgb(0,0,0)"/>
<path d="M503,230L591,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,230L680,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,230 905,234 905,226" style="fill:rgb(0,0,0)"/>
<path d="M691,230L910,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,230 L 924,230 Q 931,230 931,222 L 931,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,321A15 15 0 0 0 75 306A15 15 0 0 0 60 290A15 15 0 0 0 45 306A15 15 0 0 0 60 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,306 100,310 100,301" style="fill:rgb(0,0,0)"/>
<path d="M75,306L105,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M111,321L160,321L160,290L111,290Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="306" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="196,306 185,310 185,301" style="fill:rgb(0,0,0)"/>
<path d="M160,306L191,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,321A15 15 0 0 0 227 306A15 15 0 0 0 211 290A15 15 0 0 0 196 306A15 15 0 0 0 211 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,306 905,310 905,301" style="fill:rgb(0,0,0)"/>
<path d="M227,306L910,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,306 L 924,306 Q 931,306 931,298 L 931,291"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,306 33,310 33,301" style="fill:rgb(0,0,0)"/>
<path d="M24,290 L 24,298 Q 24,306 31,306 L 39,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,284A15 15 0 0 0 151 269A15 15 0 0 0 136 254A15 15 0 0 0 121 269A15 15 0 0 0 136 284Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="269" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="151,269 162,265 162,274" style="fill:rgb(0,0,0)"/>
<path d="M160,306 L 168,306 Q 175,306 175,291 L 175,284 Q 175,269 166,269 L 157,269"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,269 L 103,269 Q 88,269 88,284 L 88,291 Q 88,306 96,306 L 103,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,358L88,358A15 15 0 0 0 103 343A15 15 0 0 0 88 328L60,328A15 15 0 0 0 45 343A15 15 0 0 0 60 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CAST</text>
<polygon points="126,343 114,348 114,339" style="fill:rgb(0,0,0)"/>
<path d="M103,343L120,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M141,358A15 15 0 0 0 156 343A15 15 0 0 0 141 328A15 15 0 0 0 126 343A15 15 0 0 0 141 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="179,343 168,348 168,339" style="fill:rgb(0,0,0)"/>
<path d="M156,343L173,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,358L228,358L228,328L179,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="251,343 240,348 240,339" style="fill:rgb(0,0,0)"/>
<path d="M228,343L246,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,358L271,358A15 15 0 0 0 286 343A15 15 0 0 0 271 328L267,328A15 15 0 0 0 251 343A15 15 0 0 0 267 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="269" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="309,343 297,348 297,339" style="fill:rgb(0,0,0)"/>
<path d="M286,343L303,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,358L408,358L408,328L309,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="358" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="431,343 419,348 419,339" style="fill:rgb(0,0,0)"/>
<path d="M408,343L425,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M446,358A15 15 0 0 0 461 343A15 15 0 0 0 446 328A15 15 0 0 0 431 343A15 15 0 0 0 446 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,343 905,348 905,339" style="fill:rgb(0,0,0)"/>
<path d="M461,343L910,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,343 L 924,343 Q 931,343 931,336 L 931,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,343 33,348 33,339" style="fill:rgb(0,0,0)"/>
<path d="M24,328 L 24,336 Q 24,343 31,343 L 39,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,396L94,396L94,366L45,366Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,381 106,385 106,377" style="fill:rgb(0,0,0)"/>
<path d="M94,381L111,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,396L196,396A15 15 0 0 0 211 381A15 15 0 0 0 196 366L132,366A15 15 0 0 0 117 381A15 15 0 0 0 132 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="234,381 223,385 223,377" style="fill:rgb(0,0,0)"/>
<path d="M211,381L229,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,396L355,396A15 15 0 0 0 370 381A15 15 0 0 0 355 366L250,366A15 15 0 0 0 234 381A15 15 0 0 0 250 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="916,381 905,385 905,377" style="fill:rgb(0,0,0)"/>
<path d="M370,381L910,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,381 L 924,381 Q 931,381 931,374 L 931,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,381 33,385 33,377" style="fill:rgb(0,0,0)"/>
<path d="M24,366 L 24,374 Q 24,381 31,381 L 39,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,434L94,434L94,404L45,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,419 119,423 119,415" style="fill:rgb(0,0,0)"/>
<path d="M94,419L124,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,434L165,434A15 15 0 0 0 180 419A15 15 0 0 0 165 404L145,404A15 15 0 0 0 130 419A15 15 0 0 0 145 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="234,419 223,423 223,415" style="fill:rgb(0,0,0)"/>
<path d="M180,419L229,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,434L273,434A15 15 0 0 0 288 419A15 15 0 0 0 273 404L250,404A15 15 0 0 0 234 419A15 15 0 0 0 250 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIKE</text>
<path d="M250,472L279,472A15 15 0 0 0 294 457A15 15 0 0 0 279 442L250,442A15 15 0 0 0 234 457A15 15 0 0 0 250 472Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="457" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GLOB</text>
<path d="M250,510L302,510A15 15 0 0 0 317 495A15 15 0 0 0 302 479L250,479A15 15 0 0 0 234 495A15 15 0 0 0 250 510Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REGEXP</text>
<path d="M250,547L297,547A15 15 0 0 0 313 532A15 15 0 0 0 297 517L250,517A15 15 0 0 0 234 532A15 15 0 0 0 250 547Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="274" y="532" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<path d="M378,510L427,510L427,479L378,479Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M378,434L427,434L427,404L378,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="465,449 454,454 454,445" style="fill:rgb(0,0,0)"/>
<path d="M427,419 L 435,419 Q 442,419 442,434 L 442,434 Q 442,449 451,449 L 460,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,464L532,464A15 15 0 0 0 547 449A15 15 0 0 0 532 434L480,434A15 15 0 0 0 465 449A15 15 0 0 0 480 464Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="506" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ESCAPE</text>
<polygon points="570,449 559,454 559,445" style="fill:rgb(0,0,0)"/>
<path d="M547,449L565,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M570,464L620,464L620,434L570,434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="595" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="671,419 659,423 659,415" style="fill:rgb(0,0,0)"/>
<path d="M620,449 L 627,449 Q 635,449 635,434 L 635,434 Q 635,419 650,419 L 650,419 L 665,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,419 905,423 905,415" style="fill:rgb(0,0,0)"/>
<path d="M671,419L910,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,419 L 924,419 Q 931,419 931,411 L 931,404"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,419 33,423 33,415" style="fill:rgb(0,0,0)"/>
<path d="M24,404 L 24,411 Q 24,419 31,419 L 39,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M100,419 L 108,419 Q 115,419 115,434 L 115,434 Q 115,449 130,449 L 177,449 Q 192,449 192,434 L 192,434 Q 192,419 199,419 L 207,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,532 223,537 223,528" style="fill:rgb(0,0,0)"/>
<path d="M196,419 L 204,419 Q 211,419 211,434 L 211,517 Q 211,532 220,532 L 229,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,457 223,461 223,452" style="fill:rgb(0,0,0)"/>
<path d="M211,442 L 211,449 Q 211,457 220,457 L 229,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,495 223,499 223,490" style="fill:rgb(0,0,0)"/>
<path d="M211,479 L 211,487 Q 211,495 220,495 L 229,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,419 367,423 367,415" style="fill:rgb(0,0,0)"/>
<path d="M288,419L372,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,532 329,537 329,528" style="fill:rgb(0,0,0)"/>
<path d="M313,532L334,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,495 367,499 367,490" style="fill:rgb(0,0,0)"/>
<path d="M340,532 L 348,532 Q 355,532 355,517 L 355,510 Q 355,495 364,495 L 372,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,495 329,499 329,490" style="fill:rgb(0,0,0)"/>
<path d="M317,495L334,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,495L378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,457 329,461 329,452" style="fill:rgb(0,0,0)"/>
<path d="M294,457L334,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,457 L 348,457 Q 355,457 355,472 L 355,480 Q 355,495 367,495 L 378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="506,419 495,423 495,415" style="fill:rgb(0,0,0)"/>
<path d="M427,419L501,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M506,419L659,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="547,495 536,499 536,490" style="fill:rgb(0,0,0)"/>
<path d="M427,495L542,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,495 L 656,495 Q 671,495 671,480 L 671,434 Q 671,419 686,419 L 692,419 L 707,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,585L94,585L94,555L45,555Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,570 119,574 119,566" style="fill:rgb(0,0,0)"/>
<path d="M94,570L124,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,585L194,585A15 15 0 0 0 209 570A15 15 0 0 0 194 555L145,555A15 15 0 0 0 130 570A15 15 0 0 0 145 585Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="170" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ISNULL</text>
<polygon points="916,570 905,574 905,566" style="fill:rgb(0,0,0)"/>
<path d="M209,570L910,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,570 L 924,570 Q 931,570 931,563 L 931,555"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,570 33,574 33,566" style="fill:rgb(0,0,0)"/>
<path d="M24,555 L 24,563 Q 24,570 31,570 L 39,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,623L215,623A15 15 0 0 0 230 608A15 15 0 0 0 215 593L145,593A15 15 0 0 0 130 608A15 15 0 0 0 145 623Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="608" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTNULL</text>
<path d="M145,661L165,661A15 15 0 0 0 180 646A15 15 0 0 0 165 631L145,631A15 15 0 0 0 130 646A15 15 0 0 0 145 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="203,646 192,650 192,641" style="fill:rgb(0,0,0)"/>
<path d="M180,646L198,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,661L250,661A15 15 0 0 0 265 646A15 15 0 0 0 250 631L219,631A15 15 0 0 0 203 646A15 15 0 0 0 219 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="288,646 276,650 276,641" style="fill:rgb(0,0,0)"/>
<path d="M265,646L282,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="339,570 327,574 327,566" style="fill:rgb(0,0,0)"/>
<path d="M288,646 L 295,646 Q 303,646 303,631 L 303,585 Q 303,570 318,570 L 318,570 L 333,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="288,608 276,612 276,604" style="fill:rgb(0,0,0)"/>
<path d="M230,608L282,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,608 L 295,608 Q 303,608 303,600 L 303,593"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,646 119,650 119,641" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,631 Q 109,646 117,646 L 124,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,608 119,612 119,604" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,593 Q 109,608 117,608 L 124,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,699L94,699L94,668L45,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,684 106,688 106,679" style="fill:rgb(0,0,0)"/>
<path d="M94,684L111,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,699A15 15 0 0 0 147 684A15 15 0 0 0 132 668A15 15 0 0 0 117 684A15 15 0 0 0 132 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IS</text>
<polygon points="183,684 172,688 172,679" style="fill:rgb(0,0,0)"/>
<path d="M147,684L178,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M198,699L219,699A15 15 0 0 0 234 684A15 15 0 0 0 219 668L198,668A15 15 0 0 0 183 684A15 15 0 0 0 198 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="270,684 258,688 258,679" style="fill:rgb(0,0,0)"/>
<path d="M234,684L264,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="306,684 294,688 294,679" style="fill:rgb(0,0,0)"/>
<path d="M270,684L300,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,699L389,699A15 15 0 0 0 404 684A15 15 0 0 0 389 668L321,668A15 15 0 0 0 306 684A15 15 0 0 0 321 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="440,684 429,688 429,679" style="fill:rgb(0,0,0)"/>
<path d="M404,684L434,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,699L490,699A15 15 0 0 0 505 684A15 15 0 0 0 490 668L455,668A15 15 0 0 0 440 684A15 15 0 0 0 455 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="541,684 530,688 530,679" style="fill:rgb(0,0,0)"/>
<path d="M505,684L535,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,699L590,699L590,668L541,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,684 905,688 905,679" style="fill:rgb(0,0,0)"/>
<path d="M590,684L910,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,684 L 924,684 Q 931,684 931,676 L 931,669"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,684 33,688 33,679" style="fill:rgb(0,0,0)"/>
<path d="M24,668 L 24,676 Q 24,684 31,684 L 39,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,684 L 156,684 Q 164,684 164,696 Q 164,708 179,708 L 230,708 Q 245,708 245,696 Q 245,684 253,684 L 260,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,684 L 279,684 Q 286,684 286,696 Q 286,708 301,708 L 502,708 Q 517,708 517,696 Q 517,684 524,684 L 532,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,744L94,744L94,714L45,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,729 119,733 119,725" style="fill:rgb(0,0,0)"/>
<path d="M94,729L124,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,744L165,744A15 15 0 0 0 180 729A15 15 0 0 0 165 714L145,714A15 15 0 0 0 130 729A15 15 0 0 0 145 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,729 205,733 205,725" style="fill:rgb(0,0,0)"/>
<path d="M180,729L211,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,744L304,744A15 15 0 0 0 319 729A15 15 0 0 0 304 714L232,714A15 15 0 0 0 216 729A15 15 0 0 0 232 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="342,729 331,733 331,725" style="fill:rgb(0,0,0)"/>
<path d="M319,729L336,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M342,744L391,744L391,714L342,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="367" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="414,729 403,733 403,725" style="fill:rgb(0,0,0)"/>
<path d="M391,729L409,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M430,744L450,744A15 15 0 0 0 465 729A15 15 0 0 0 450 714L430,714A15 15 0 0 0 414 729A15 15 0 0 0 430 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="488,729 477,733 477,725" style="fill:rgb(0,0,0)"/>
<path d="M465,729L483,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,744L538,744L538,714L488,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="513" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,729 905,733 905,725" style="fill:rgb(0,0,0)"/>
<path d="M538,729L910,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,729 L 924,729 Q 931,729 931,721 L 931,714"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,729 33,733 33,725" style="fill:rgb(0,0,0)"/>
<path d="M24,714 L 24,721 Q 24,729 31,729 L 39,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,729 L 103,729 Q 110,729 110,741 Q 110,753 125,753 L 177,753 Q 192,753 192,741 Q 192,729 199,729 L 207,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,797L94,797L94,767L45,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,782 119,786 119,778" style="fill:rgb(0,0,0)"/>
<path d="M94,782L124,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,797L165,797A15 15 0 0 0 180 782A15 15 0 0 0 165 767L145,767A15 15 0 0 0 130 782A15 15 0 0 0 145 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,782 205,786 205,778" style="fill:rgb(0,0,0)"/>
<path d="M180,782L211,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,797L234,797A15 15 0 0 0 249 782A15 15 0 0 0 234 767L232,767A15 15 0 0 0 216 782A15 15 0 0 0 232 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IN</text>
<polygon points="285,782 273,786 273,778" style="fill:rgb(0,0,0)"/>
<path d="M249,782L279,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,797A15 15 0 0 0 315 782A15 15 0 0 0 300 767A15 15 0 0 0 285 782A15 15 0 0 0 300 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,782 340,786 340,778" style="fill:rgb(0,0,0)"/>
<path d="M315,782L345,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,797L455,797L455,767L351,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="491,782 480,786 480,778" style="fill:rgb(0,0,0)"/>
<path d="M455,782L486,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M507,797A15 15 0 0 0 522 782A15 15 0 0 0 507 767A15 15 0 0 0 491 782A15 15 0 0 0 507 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="507" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,782 905,786 905,778" style="fill:rgb(0,0,0)"/>
<path d="M522,782L910,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,782 L 924,782 Q 931,782 931,774 L 931,767"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,782 33,786 33,778" style="fill:rgb(0,0,0)"/>
<path d="M24,767 L 24,774 Q 24,782 31,782 L 39,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,782 L 103,782 Q 110,782 110,794 Q 110,806 125,806 L 177,806 Q 192,806 192,794 Q 192,782 199,782 L 207,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,782 L 324,782 Q 332,782 332,770 Q 332,758 347,758 L 452,758 Q 467,758 467,770 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M379,835L428,835L428,805L379,805Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="820" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="379,820 367,824 367,815" style="fill:rgb(0,0,0)"/>
<path d="M317,782 L 324,782 Q 332,782 332,797 L 332,805 Q 332,820 347,820 L 358,820 L 373,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M428,820 L 452,820 Q 467,820 467,805 L 467,797 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,873A15 15 0 0 0 418 857A15 15 0 0 0 403 842A15 15 0 0 0 388 857A15 15 0 0 0 403 873Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="857" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,857 430,853 430,862" style="fill:rgb(0,0,0)"/>
<path d="M428,820 L 435,820 Q 443,820 443,835 L 443,842 Q 443,857 434,857 L 424,857"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,857 L 371,857 Q 356,857 356,842 L 356,835 Q 356,820 363,820 L 371,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,925L396,925A15 15 0 0 0 412 910A15 15 0 0 0 396 895L300,895A15 15 0 0 0 285 910A15 15 0 0 0 300 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="429,910 417,915 417,906" style="fill:rgb(0,0,0)"/>
<path d="M412,910L423,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,925A15 15 0 0 0 459 910A15 15 0 0 0 444 895A15 15 0 0 0 429 910A15 15 0 0 0 444 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="513,910 502,915 502,906" style="fill:rgb(0,0,0)"/>
<path d="M459,910L507,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,925L627,925A15 15 0 0 0 642 910A15 15 0 0 0 627 895L528,895A15 15 0 0 0 513 910A15 15 0 0 0 528 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="577" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function</text>
<polygon points="659,910 647,915 647,906" style="fill:rgb(0,0,0)"/>
<path d="M642,910L653,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,925A15 15 0 0 0 689 910A15 15 0 0 0 674 895A15 15 0 0 0 659 910A15 15 0 0 0 674 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="734,910 723,915 723,906" style="fill:rgb(0,0,0)"/>
<path d="M689,910L728,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,925L783,925L783,895L734,895Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="828,910 817,915 817,906" style="fill:rgb(0,0,0)"/>
<path d="M783,910L823,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M844,925A15 15 0 0 0 859 910A15 15 0 0 0 844 895A15 15 0 0 0 828 910A15 15 0 0 0 844 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="844" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,910 905,915 905,906" style="fill:rgb(0,0,0)"/>
<path d="M859,910L910,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,910 L 924,910 Q 931,910 931,903 L 931,895"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,865L603,865A15 15 0 0 0 619 850A15 15 0 0 0 603 835L528,835A15 15 0 0 0 513 850A15 15 0 0 0 528 865Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="850" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="916,850 905,854 905,846" style="fill:rgb(0,0,0)"/>
<path d="M619,850L910,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,850 L 924,850 Q 931,850 931,842 L 931,835"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="513,850 502,854 502,846" style="fill:rgb(0,0,0)"/>
<path d="M475,910 L 483,910 Q 490,910 490,895 L 490,865 Q 490,850 499,850 L 507,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,892A15 15 0 0 0 774 877A15 15 0 0 0 759 862A15 15 0 0 0 744 877A15 15 0 0 0 759 892Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="877" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="774,877 785,873 785,881" style="fill:rgb(0,0,0)"/>
<path d="M783,910 L 791,910 Q 798,910 798,895 L 798,892 Q 798,877 789,877 L 780,877"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M744,877 L 726,877 Q 711,877 711,892 L 711,895 Q 711,910 719,910 L 726,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M689,910 L 697,910 Q 704,910 704,921 Q 704,932 719,932 L 790,932 Q 805,932 805,921 Q 805,910 813,910 L 820,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="285,910 273,915 273,906" style="fill:rgb(0,0,0)"/>
<path d="M249,782 L 256,782 Q 264,782 264,797 L 264,895 Q 264,910 272,910 L 279,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,882 412,886 412,877" style="fill:rgb(0,0,0)"/>
<path d="M264,867 L 264,874 Q 264,882 279,882 L 402,882 L 417,882"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,882 L 456,882 Q 471,882 471,896 Q 471,910 478,910 L 486,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,971L80,971A15 15 0 0 0 95 956A15 15 0 0 0 80 941L60,941A15 15 0 0 0 45 956A15 15 0 0 0 60 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="131,956 120,960 120,951" style="fill:rgb(0,0,0)"/>
<path d="M95,956L125,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,971L191,971A15 15 0 0 0 206 956A15 15 0 0 0 191 941L146,941A15 15 0 0 0 131 956A15 15 0 0 0 146 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="242,956 231,960 231,951" style="fill:rgb(0,0,0)"/>
<path d="M206,956L236,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,971A15 15 0 0 0 272 956A15 15 0 0 0 257 941A15 15 0 0 0 242 956A15 15 0 0 0 257 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="295,956 284,960 284,951" style="fill:rgb(0,0,0)"/>
<path d="M272,956L290,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,971L400,971L400,941L295,941Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="423,956 411,960 411,951" style="fill:rgb(0,0,0)"/>
<path d="M400,956L417,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,971A15 15 0 0 0 453 956A15 15 0 0 0 438 941A15 15 0 0 0 423 956A15 15 0 0 0 438 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,956 905,960 905,951" style="fill:rgb(0,0,0)"/>
<path d="M453,956L910,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,956 L 924,956 Q 931,956 931,948 L 931,941"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,956 33,960 33,951" style="fill:rgb(0,0,0)"/>
<path d="M24,941 L 24,948 Q 24,956 31,956 L 39,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,929 59,934 59,925" style="fill:rgb(0,0,0)"/>
<path d="M24,914 L 24,922 Q 24,929 39,929 L 49,929 L 64,929"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,929 L 201,929 Q 216,929 216,943 Q 216,956 223,956 L 231,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,929 L 101,929 Q 108,929 108,943 Q 108,956 116,956 L 123,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,1009L89,1009A15 15 0 0 0 104 994A15 15 0 0 0 89 978L60,978A15 15 0 0 0 45 994A15 15 0 0 0 60 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASE</text>
<polygon points="140,994 128,998 128,989" style="fill:rgb(0,0,0)"/>
<path d="M104,994L134,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M140,1009L189,1009L189,978L140,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="243,994 232,998 232,989" style="fill:rgb(0,0,0)"/>
<path d="M189,994L237,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,1009L298,1009A15 15 0 0 0 313 994A15 15 0 0 0 298 978L258,978A15 15 0 0 0 243 994A15 15 0 0 0 258 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="336,994 324,998 324,989" style="fill:rgb(0,0,0)"/>
<path d="M313,994L330,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,1009L385,1009L385,978L336,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="408,994 396,998 396,989" style="fill:rgb(0,0,0)"/>
<path d="M385,994L402,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,1009L456,1009A15 15 0 0 0 472 994A15 15 0 0 0 456 978L423,978A15 15 0 0 0 408 994A15 15 0 0 0 423 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">THEN</text>
<polygon points="495,994 483,998 483,989" style="fill:rgb(0,0,0)"/>
<path d="M472,994L489,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M495,1009L544,1009L544,978L495,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="616,994 604,998 604,989" style="fill:rgb(0,0,0)"/>
<path d="M544,994L610,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M631,1009L658,1009A15 15 0 0 0 673 994A15 15 0 0 0 658 978L631,978A15 15 0 0 0 616 994A15 15 0 0 0 631 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="645" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ELSE</text>
<polygon points="696,994 685,998 685,989" style="fill:rgb(0,0,0)"/>
<path d="M673,994L691,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M696,1009L746,1009L746,978L696,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="721" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="782,994 770,998 770,989" style="fill:rgb(0,0,0)"/>
<path d="M746,994L776,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M797,1009L818,1009A15 15 0 0 0 833 994A15 15 0 0 0 818 978L797,978A15 15 0 0 0 782 994A15 15 0 0 0 797 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="807" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="916,994 905,998 905,989" style="fill:rgb(0,0,0)"/>
<path d="M833,994L910,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,994 L 924,994 Q 931,994 931,986 L 931,979"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,994 33,998 33,989" style="fill:rgb(0,0,0)"/>
<path d="M24,978 L 24,986 Q 24,994 31,994 L 39,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,994 L 111,994 Q 119,994 119,1007 Q 119,1021 134,1021 L 186,1021 Q 201,1021 201,1007 Q 201,994 208,994 L 216,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="360,1021 372,1016 372,1025" style="fill:rgb(0,0,0)"/>
<path d="M544,994 L 551,994 Q 559,994 559,1007 Q 559,1021 544,1021 L 381,1021 L 366,1021"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,1021 L 235,1021 Q 220,1021 220,1007 Q 220,994 227,994 L 235,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,994 L 585,994 Q 593,994 593,1007 Q 593,1021 608,1021 L 742,1021 Q 757,1021 757,1007 Q 757,994 765,994 L 772,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,1066L173,1066L173,1036L45,1036Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="1051" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">raise-function</text>
<polygon points="916,1051 905,1055 905,1047" style="fill:rgb(0,0,0)"/>
<path d="M173,1051L910,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,1051 L 924,1051 Q 931,1051 931,1036 L 931,32 Q 931,17 939,17 L 946,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,1051 33,1055 33,1047" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,1036 Q 24,1051 31,1051 L 39,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/filter-clause.html">filter-clause:</a></b>
<button id='x2bf9f539' onclick='hideorshow("x2bf9f539","xf485ce62")'>show</button></p>
 <div id='xf485ce62' style='display:none;' class='imgcontainer'>
 <div style="max-width:422px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 422.381 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L93,32A15 15 0 0 0 108 17A15 15 0 0 0 93 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FILTER</text>
<polygon points="131,17 119,21 119,12" style="fill:rgb(0,0,0)"/>
<path d="M108,17L125,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,32L146,32A15 15 0 0 0 161 17A15 15 0 0 0 146 2L146,2A15 15 0 0 0 131 17A15 15 0 0 0 146 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="184,17 173,21 173,12" style="fill:rgb(0,0,0)"/>
<path d="M161,17L178,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M199,32L249,32A15 15 0 0 0 264 17A15 15 0 0 0 249 2L199,2A15 15 0 0 0 184 17A15 15 0 0 0 199 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="224" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="287,17 275,21 275,12" style="fill:rgb(0,0,0)"/>
<path d="M264,17L281,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,32L336,32L336,2L287,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M336,17L353,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,32A15 15 0 0 0 389 17A15 15 0 0 0 374 2A15 15 0 0 0 359 17A15 15 0 0 0 374 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="374" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="413,17 401,21 401,12" style="fill:rgb(0,0,0)"/>
<path d="M389,17L407,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="416" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/function-arguments.html">function-arguments:</a></b>
<button id='xf1abbbf8' onclick='hideorshow("xf1abbbf8","xce496f9c")'>show</button></p>
 <div id='xce496f9c' style='display:none;' class='imgcontainer'>
 <div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.566 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,26 55,30 55,22" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,41 L 43,41 Q 43,26 52,26 L 61,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M82,41L150,41A15 15 0 0 0 165 26L165,26A15 15 0 0 0 150 11L82,11A15 15 0 0 0 66 26L66,26A15 15 0 0 0 82 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="183,26 171,30 171,22" style="fill:rgb(0,0,0)"/>
<path d="M165,26L177,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M183,26 L 189,26 Q 194,26 194,41 L 194,41 Q 194,56 203,56 L 212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M218,56L248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,71L303,71L303,41L254,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="447,56 435,60 435,52" style="fill:rgb(0,0,0)"/>
<path d="M303,56L441,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="116,56 104,60 104,52" style="fill:rgb(0,0,0)"/>
<path d="M32,56L110,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M116,56L212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,32A15 15 0 0 0 293 17A15 15 0 0 0 278 2A15 15 0 0 0 263 17A15 15 0 0 0 278 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="293,17 305,12 305,21" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 314,56 Q 326,56 326,41 L 326,32 Q 326,17 312,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M263,17 L 245,17 Q 230,17 230,32 L 230,41 Q 230,56 239,56 L 248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,207A15 15 0 0 0 243 192L243,192A15 15 0 0 0 228 177A15 15 0 0 0 213 192L213,192A15 15 0 0 0 228 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="213,192 201,196 201,188" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,71 L 43,177 Q 43,192 58,192 L 192,192 L 207,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,192 267,196 267,188" style="fill:rgb(0,0,0)"/>
<path d="M243,192L272,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,192 L 360,192 Q 375,192 390,192 L 394,192 Q 409,192 409,177 L 409,71 Q 409,56 415,56 L 421,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="228,216 216,221 216,212" style="fill:rgb(0,0,0)"/>
<path d="M116,192 L 181,192 Q 196,192 196,204 Q 196,216 209,216 L 222,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,216 L 242,216 Q 257,216 257,204 Q 257,192 262,192 L 268,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="90,117 78,121 78,112" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 313,56 Q 323,56 323,71 L 323,71 Q 323,86 308,86 L 81,86 Q 66,86 66,101 L 66,102 Q 66,117 75,117 L 84,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,132L149,132A15 15 0 0 0 164 117L164,117A15 15 0 0 0 149 101L105,101A15 15 0 0 0 90 117L90,117A15 15 0 0 0 105 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="182,117 170,121 170,112" style="fill:rgb(0,0,0)"/>
<path d="M164,117L176,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,132L201,132A15 15 0 0 0 216 117L216,117A15 15 0 0 0 201 101L197,101A15 15 0 0 0 182 117L182,117A15 15 0 0 0 197 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M216,117L239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,132L375,132L375,101L245,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,169A15 15 0 0 0 325 154A15 15 0 0 0 310 139A15 15 0 0 0 294 154A15 15 0 0 0 310 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,154 336,150 336,159" style="fill:rgb(0,0,0)"/>
<path d="M375,117 L 380,117 Q 386,117 386,132 L 386,139 Q 386,154 371,154 L 345,154 L 330,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M294,154 L 260,154 Q 245,154 236,154 Q 227,154 227,139 L 227,132 Q 227,117 233,117 L 239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M375,117 L 383,117 Q 392,117 392,102 L 392,71 Q 392,56 407,56 L 413,56 L 428,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x942b20e5' onclick='hideorshow("x942b20e5","x8c11ae99")'>show</button></p>
 <div id='x8c11ae99' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/literal-value.html">literal-value:</a></b>
<button id='x96fb8351' onclick='hideorshow("x96fb8351","x3e1019c7")'>show</button></p>
 <div id='x3e1019c7' style='display:none;' class='imgcontainer'>
 <div style="max-width:341px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 341.376 336.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,319 39,324 39,315" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,304 Q 24,319 34,319 L 45,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,334L252,334A15 15 0 0 0 267 319A15 15 0 0 0 252 304L65,304A15 15 0 0 0 50 319A15 15 0 0 0 65 334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIMESTAMP</text>
<polygon points="290,319 278,324 278,315" style="fill:rgb(0,0,0)"/>
<path d="M267,319L284,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,17 320,21 320,12" style="fill:rgb(0,0,0)"/>
<path d="M290,319 L 297,319 Q 305,319 305,304 L 305,32 Q 305,17 315,17 L 326,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="335" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L172,32A15 15 0 0 0 187 17A15 15 0 0 0 172 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="119" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,17L320,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L153,70A15 15 0 0 0 168 55L168,55A15 15 0 0 0 153 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">string-literal</text>
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,47 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,55 278,59 278,50" style="fill:rgb(0,0,0)"/>
<path d="M168,55L284,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,55 L 297,55 Q 305,55 305,47 L 305,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L140,108A15 15 0 0 0 155 92A15 15 0 0 0 140 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">blob-literal</text>
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,85 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,92 278,97 278,88" style="fill:rgb(0,0,0)"/>
<path d="M155,92L284,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,92 L 297,92 Q 305,92 305,85 L 305,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,145L97,145A15 15 0 0 0 112 130A15 15 0 0 0 97 115L66,115A15 15 0 0 0 50 130A15 15 0 0 0 66 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="50,130 39,135 39,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 34,130 L 45,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,130 278,135 278,126" style="fill:rgb(0,0,0)"/>
<path d="M112,130L284,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,130 L 297,130 Q 305,130 305,123 L 305,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,183L96,183A15 15 0 0 0 111 168A15 15 0 0 0 96 153L66,153A15 15 0 0 0 50 168A15 15 0 0 0 66 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRUE</text>
<polygon points="50,168 39,172 39,164" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,160 Q 24,168 34,168 L 45,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,168 278,172 278,164" style="fill:rgb(0,0,0)"/>
<path d="M111,168L284,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,168 L 297,168 Q 305,168 305,160 L 305,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,221L104,221A15 15 0 0 0 119 206A15 15 0 0 0 104 191L66,191A15 15 0 0 0 50 206A15 15 0 0 0 66 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FALSE</text>
<polygon points="50,206 39,210 39,201" style="fill:rgb(0,0,0)"/>
<path d="M24,191 L 24,198 Q 24,206 34,206 L 45,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,206 278,210 278,201" style="fill:rgb(0,0,0)"/>
<path d="M119,206L284,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,206 L 297,206 Q 305,206 305,198 L 305,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,259L190,259A15 15 0 0 0 205 244A15 15 0 0 0 190 228L66,228A15 15 0 0 0 50 244A15 15 0 0 0 66 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="128" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIME</text>
<polygon points="50,244 39,248 39,239" style="fill:rgb(0,0,0)"/>
<path d="M24,228 L 24,236 Q 24,244 34,244 L 45,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,244 278,248 278,239" style="fill:rgb(0,0,0)"/>
<path d="M205,244L284,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,244 L 297,244 Q 305,244 305,236 L 305,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,297L192,297A15 15 0 0 0 207 281A15 15 0 0 0 192 266L66,266A15 15 0 0 0 50 281A15 15 0 0 0 66 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_DATE</text>
<polygon points="50,281 39,286 39,277" style="fill:rgb(0,0,0)"/>
<path d="M24,266 L 24,274 Q 24,281 34,281 L 45,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,281 278,286 278,277" style="fill:rgb(0,0,0)"/>
<path d="M207,281L284,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,281 L 297,281 Q 305,281 305,274 L 305,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/over-clause.html">over-clause:</a></b>
<button id='x738059c4' onclick='hideorshow("x738059c4","x70712042")'>show</button></p>
 <div id='x70712042' style='display:none;' class='imgcontainer'>
 <div style="max-width:600px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 600.706 418.392">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="129,17 117,21 117,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L123,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M144,32L241,32A15 15 0 0 0 256 17A15 15 0 0 0 241 2L144,2A15 15 0 0 0 129 17A15 15 0 0 0 144 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,17 L 100,17 Q 108,17 108,32 L 108,40 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,70A15 15 0 0 0 165 55L165,55A15 15 0 0 0 149 39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 149 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="149" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="206,82 195,86 195,77" style="fill:rgb(0,0,0)"/>
<path d="M165,55 L 172,55 Q 180,55 180,68 Q 180,82 190,82 L 200,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,97L363,97A15 15 0 0 0 378 82A15 15 0 0 0 363 67L221,67A15 15 0 0 0 206 82A15 15 0 0 0 221 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="292" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M221,173L301,173A15 15 0 0 0 316 157A15 15 0 0 0 301 142L221,142A15 15 0 0 0 206 157A15 15 0 0 0 221 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="339,157 328,162 328,153" style="fill:rgb(0,0,0)"/>
<path d="M316,157L333,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,173L358,173A15 15 0 0 0 373 157A15 15 0 0 0 358 142L354,142A15 15 0 0 0 339 157A15 15 0 0 0 354 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="409,157 398,162 398,153" style="fill:rgb(0,0,0)"/>
<path d="M373,157L404,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,173L459,173L459,142L409,142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M434,210A15 15 0 0 0 449 195A15 15 0 0 0 434 180A15 15 0 0 0 419 195A15 15 0 0 0 434 210Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="195" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="449,195 461,191 461,200" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,180 Q 474,195 464,195 L 455,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,195 L 398,195 Q 383,195 383,180 L 383,172 Q 383,157 390,157 L 398,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,55 280,59 280,50" style="fill:rgb(0,0,0)"/>
<path d="M165,55L286,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,120 304,115 304,124" style="fill:rgb(0,0,0)"/>
<path d="M292,55 L 401,55 Q 416,55 416,70 L 416,105 Q 416,120 401,120 L 313,120 L 298,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,157 195,162 195,153" style="fill:rgb(0,0,0)"/>
<path d="M292,120 L 180,120 Q 165,120 165,135 L 165,142 Q 165,157 180,157 L 185,157 L 200,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="401,82 389,86 389,77" style="fill:rgb(0,0,0)"/>
<path d="M378,82L395,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,82 L 408,82 Q 416,82 416,89 L 416,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,286L266,286A15 15 0 0 0 281 271A15 15 0 0 0 266 256L221,256A15 15 0 0 0 206 271A15 15 0 0 0 221 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="244" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="304,271 292,275 292,266" style="fill:rgb(0,0,0)"/>
<path d="M281,271L298,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M319,286L323,286A15 15 0 0 0 338 271A15 15 0 0 0 323 256L319,256A15 15 0 0 0 304 271A15 15 0 0 0 319 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="321" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="374,271 363,275 363,266" style="fill:rgb(0,0,0)"/>
<path d="M338,271L368,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,286L504,286L504,256L374,256Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M439,324A15 15 0 0 0 454 309A15 15 0 0 0 439 293A15 15 0 0 0 424 309A15 15 0 0 0 439 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="454,309 466,304 466,313" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,294 Q 519,309 504,309 L 475,309 L 460,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,309 L 363,309 Q 348,309 348,294 L 348,286 Q 348,271 355,271 L 363,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,233 304,229 304,237" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,218 Q 474,233 459,233 L 313,233 L 298,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,271 195,275 195,266" style="fill:rgb(0,0,0)"/>
<path d="M292,233 L 180,233 Q 165,233 165,248 L 165,256 Q 165,271 180,271 L 185,271 L 200,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,195 160,184 169,184" style="fill:rgb(0,0,0)"/>
<path d="M165,142L165,189"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,195L165,256"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,399L311,399L311,369L206,369Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="384" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="519,384 508,389 508,380" style="fill:rgb(0,0,0)"/>
<path d="M311,384L513,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M534,399A15 15 0 0 0 549 384A15 15 0 0 0 534 369A15 15 0 0 0 519 384A15 15 0 0 0 534 399Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="384" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="591,17 579,21 579,12" style="fill:rgb(0,0,0)"/>
<path d="M549,384 L 557,384 Q 564,384 564,369 L 564,32 Q 564,17 575,17 L 585,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="594" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,17 508,21 508,12" style="fill:rgb(0,0,0)"/>
<path d="M256,17L513,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,17L579,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,346 304,342 304,351" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,331 Q 519,346 504,346 L 313,346 L 298,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,384 195,389 195,380" style="fill:rgb(0,0,0)"/>
<path d="M292,346 L 180,346 Q 165,346 165,361 L 165,369 Q 165,384 180,384 L 185,384 L 200,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,309 160,297 169,297" style="fill:rgb(0,0,0)"/>
<path d="M165,256L165,303"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,309L165,369"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="258,411 247,416 247,407" style="fill:rgb(0,0,0)"/>
<path d="M165,369 L 165,396 Q 165,411 180,411 L 238,411 L 253,411"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,384 369,389 369,380" style="fill:rgb(0,0,0)"/>
<path d="M258,411 L 335,411 Q 350,411 350,398 Q 350,384 362,384 L 375,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x146f63da' onclick='hideorshow("x146f63da","x86695de6")'>show</button></p>
 <div id='x86695de6' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='xa27ee355' onclick='hideorshow("xa27ee355","x5336e884")'>show</button></p>
 <div id='x5336e884' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/raise-function.html">raise-function:</a></b>
<button id='x65673da4' onclick='hideorshow("x65673da4","x6935c1a0")'>show</button></p>
 <div id='x6935c1a0' style='display:none;' class='imgcontainer'>
 <div style="max-width:627px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 627.302 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L82,32A15 15 0 0 0 97 17A15 15 0 0 0 82 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RAISE</text>
<polygon points="120,17 109,21 109,12" style="fill:rgb(0,0,0)"/>
<path d="M97,17L114,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,32L135,32A15 15 0 0 0 150 17A15 15 0 0 0 135 2L135,2A15 15 0 0 0 120 17A15 15 0 0 0 135 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="135" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="192,55 180,59 180,50" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 158,17 Q 165,17 165,32 L 165,40 Q 165,55 176,55 L 186,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,70L285,70A15 15 0 0 0 300 55L300,55A15 15 0 0 0 285 39L207,39A15 15 0 0 0 192 55L192,55A15 15 0 0 0 207 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="336,55 324,59 324,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70A15 15 0 0 0 366 55L366,55A15 15 0 0 0 351 39A15 15 0 0 0 336 55L336,55A15 15 0 0 0 351 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="389,55 378,59 378,50" style="fill:rgb(0,0,0)"/>
<path d="M366,55L383,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,70L508,70A15 15 0 0 0 523 55L523,55A15 15 0 0 0 508 39L404,39A15 15 0 0 0 389 55L389,55A15 15 0 0 0 404 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="456" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">error-message</text>
<polygon points="564,17 553,21 553,12" style="fill:rgb(0,0,0)"/>
<path d="M523,55 L 530,55 Q 538,55 538,40 L 538,32 Q 538,17 548,17 L 558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M579,32A15 15 0 0 0 594 17A15 15 0 0 0 579 2A15 15 0 0 0 564 17A15 15 0 0 0 579 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="617,17 606,21 606,12" style="fill:rgb(0,0,0)"/>
<path d="M594,17L612,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="621" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L259,32A15 15 0 0 0 274 17A15 15 0 0 0 259 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="456,17 444,21 444,12" style="fill:rgb(0,0,0)"/>
<path d="M274,17L450,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,17L553,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,108L249,108A15 15 0 0 0 264 92A15 15 0 0 0 249 77L207,77A15 15 0 0 0 192 92A15 15 0 0 0 207 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="300,92 288,97 288,88" style="fill:rgb(0,0,0)"/>
<path d="M264,92L294,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,92 L 307,92 Q 315,92 315,77 L 315,70 Q 315,55 322,55 L 330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,145L229,145A15 15 0 0 0 244 130A15 15 0 0 0 229 115L207,115A15 15 0 0 0 192 130A15 15 0 0 0 207 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="300,130 288,135 288,126" style="fill:rgb(0,0,0)"/>
<path d="M244,130L294,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,130 L 307,130 Q 315,130 315,115 L 315,92 L 315,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,130 180,135 180,126" style="fill:rgb(0,0,0)"/>
<path d="M165,39 L 165,115 Q 165,130 176,130 L 186,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,92 180,97 180,88" style="fill:rgb(0,0,0)"/>
<path d="M165,77 L 165,85 Q 165,92 176,92 L 186,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/select-stmt.html">select-stmt:</a></b>
<button id='x9ada61e9' onclick='hideorshow("x9ada61e9","x72334ec4")'>show</button></p>
 <div id='x72334ec4' style='display:none;' class='imgcontainer'>
 <div style="max-width:669px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 669.677 1162.3">
<path d="M55,845L667,845L667,99L55,99Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="6" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="46,17 34,21 34,12" style="fill:rgb(0,0,0)"/>
<path d="M10,17L40,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M61,32L92,32A15 15 0 0 0 107 17A15 15 0 0 0 92 2L61,2A15 15 0 0 0 46 17A15 15 0 0 0 61 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="76" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M167,62L253,62A15 15 0 0 0 268 47L268,47A15 15 0 0 0 253 32L167,32A15 15 0 0 0 152 47L152,47A15 15 0 0 0 167 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="210,17 198,21 198,12" style="fill:rgb(0,0,0)"/>
<path d="M107,17L204,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M210,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M358,32L584,32L584,2L358,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="152,47 140,51 140,43" style="fill:rgb(0,0,0)"/>
<path d="M107,17 L 114,17 Q 122,17 122,32 L 122,32 Q 122,47 134,47 L 146,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="291,47 279,51 279,43" style="fill:rgb(0,0,0)"/>
<path d="M268,47L285,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,47 L 298,47 Q 306,47 306,32 L 306,32 Q 306,17 321,17 L 331,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,70A15 15 0 0 0 486 55L486,55A15 15 0 0 0 471 39A15 15 0 0 0 456 55L456,55A15 15 0 0 0 471 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="486,55 498,50 498,59" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,40 Q 599,55 584,55 L 507,55 L 492,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,55 L 350,55 Q 335,55 335,40 L 335,32 Q 335,17 340,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,83 307,79 307,88" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,68 Q 599,83 584,83 L 316,83 L 301,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,83 L 40,83 Q 25,83 25,98 L 25,113"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="25,47 20,36 29,36" style="fill:rgb(0,0,0)"/>
<path d="M10,17 L 17,17 Q 25,17 25,29 L 25,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="55,129 43,133 43,124" style="fill:rgb(0,0,0)"/>
<path d="M25,47 L 25,114 Q 25,129 37,129 L 49,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,129 115,133 115,124" style="fill:rgb(0,0,0)"/>
<path d="M55,129L121,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,144L193,144A15 15 0 0 0 208 129A15 15 0 0 0 193 114L142,114A15 15 0 0 0 127 129A15 15 0 0 0 142 144Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="250,159 238,163 238,155" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,144 Q 223,159 233,159 L 244,159"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,174L333,174A15 15 0 0 0 348 159A15 15 0 0 0 333 144L265,144A15 15 0 0 0 250 159A15 15 0 0 0 265 174Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="159" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="417,129 406,133 406,124" style="fill:rgb(0,0,0)"/>
<path d="M348,159 L 356,159 Q 363,159 363,144 L 363,144 Q 363,129 378,129 L 396,129 L 411,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,144L545,144L545,114L417,114Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M481,182A15 15 0 0 0 496 166A15 15 0 0 0 481 151A15 15 0 0 0 466 166A15 15 0 0 0 481 182Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="166" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="496,166 508,162 508,171" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,151 Q 560,166 545,166 L 517,166 L 502,166"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M466,166 L 406,166 Q 391,166 391,151 L 391,144 Q 391,129 398,129 L 406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,129 287,133 287,124" style="fill:rgb(0,0,0)"/>
<path d="M208,129L293,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M299,129L406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,212L280,212A15 15 0 0 0 295 197A15 15 0 0 0 280 182L265,182A15 15 0 0 0 250 197A15 15 0 0 0 265 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="197" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="348,197 337,201 337,192" style="fill:rgb(0,0,0)"/>
<path d="M295,197L342,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,197 L 356,197 Q 363,197 363,182 L 363,159 L 363,144"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="250,197 238,201 238,192" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,182 Q 223,197 233,197 L 244,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,287L203,287A15 15 0 0 0 218 272A15 15 0 0 0 203 257L168,257A15 15 0 0 0 153 272A15 15 0 0 0 168 287Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="186" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="290,272 279,277 279,268" style="fill:rgb(0,0,0)"/>
<path d="M218,272L284,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,287L451,287L451,257L290,257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M320,362L422,362L422,331L320,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M371,324A15 15 0 0 0 386 309A15 15 0 0 0 371 293A15 15 0 0 0 356 309A15 15 0 0 0 371 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="386,309 397,304 397,313" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 459,272 Q 466,272 466,287 L 466,294 Q 466,309 451,309 L 407,309 L 392,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M356,309 L 279,309 Q 264,309 264,294 L 264,287 Q 264,272 271,272 L 279,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="320,346 308,351 308,342" style="fill:rgb(0,0,0)"/>
<path d="M218,272 L 226,272 Q 233,272 233,287 L 233,331 Q 233,346 248,346 L 299,346 L 314,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="484,313 488,325 480,325" style="fill:rgb(0,0,0)"/>
<path d="M422,346 L 436,346 Q 451,346 466,346 L 469,346 Q 484,346 484,333 L 484,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,272 494,277 494,268" style="fill:rgb(0,0,0)"/>
<path d="M484,313 L 484,287 Q 484,272 492,272 L 499,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,272 L 496,272 Q 487,272 487,272 Q 487,272 495,272 L 502,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,197 555,185 564,185" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,176 L 560,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,235 360,230 360,239" style="fill:rgb(0,0,0)"/>
<path d="M560,197 L 560,220 Q 560,235 545,235 L 369,235 L 354,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,272 142,277 142,268" style="fill:rgb(0,0,0)"/>
<path d="M348,235 L 142,235 Q 127,235 127,250 L 127,257 Q 127,272 137,272 L 147,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,437L218,437A15 15 0 0 0 233 422A15 15 0 0 0 218 407L168,407A15 15 0 0 0 153 422A15 15 0 0 0 168 437Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="256,422 244,426 244,418" style="fill:rgb(0,0,0)"/>
<path d="M233,422L250,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,437L305,437L305,407L256,407Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="517,324 513,312 521,312" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 502,272 Q 517,272 517,287 L 517,303 L 517,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,384 382,380 382,389" style="fill:rgb(0,0,0)"/>
<path d="M517,324 L 517,369 Q 517,384 502,384 L 391,384 L 376,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,422 142,426 142,418" style="fill:rgb(0,0,0)"/>
<path d="M371,384 L 142,384 Q 127,384 127,399 L 127,407 Q 127,422 137,422 L 147,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,324 122,312 131,312" style="fill:rgb(0,0,0)"/>
<path d="M127,257L127,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,324L127,407"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,535L212,535A15 15 0 0 0 227 520A15 15 0 0 0 212 505L168,505A15 15 0 0 0 153 520A15 15 0 0 0 168 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="250,520 238,525 238,516" style="fill:rgb(0,0,0)"/>
<path d="M227,520L244,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,535L269,535A15 15 0 0 0 284 520A15 15 0 0 0 269 505L265,505A15 15 0 0 0 250 520A15 15 0 0 0 265 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="320,520 309,525 309,516" style="fill:rgb(0,0,0)"/>
<path d="M284,520L314,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,535L369,535L369,505L320,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="452,520 441,525 441,516" style="fill:rgb(0,0,0)"/>
<path d="M369,520L446,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,535L520,535A15 15 0 0 0 535 520A15 15 0 0 0 520 505L467,505A15 15 0 0 0 452 520A15 15 0 0 0 467 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="558,520 546,525 546,516" style="fill:rgb(0,0,0)"/>
<path d="M535,520L552,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,535L607,535L607,505L558,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M345,573A15 15 0 0 0 360 558A15 15 0 0 0 345 543A15 15 0 0 0 330 558A15 15 0 0 0 345 573Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="558" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="360,558 371,554 371,562" style="fill:rgb(0,0,0)"/>
<path d="M369,520 L 377,520 Q 384,520 384,535 L 384,543 Q 384,558 375,558 L 366,558"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,558 L 309,558 Q 294,558 294,543 L 294,535 Q 294,520 301,520 L 309,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="514,551 503,555 503,546" style="fill:rgb(0,0,0)"/>
<path d="M411,520 L 418,520 Q 426,520 426,535 L 426,536 Q 426,551 441,551 L 493,551 L 508,551"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M514,551 L 607,551 Q 622,551 622,536 L 622,535 Q 622,520 630,520 L 637,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,490 256,494 256,486" style="fill:rgb(0,0,0)"/>
<path d="M127,460 L 127,475 Q 127,490 142,490 L 246,490 L 261,490"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,520 399,525 399,516" style="fill:rgb(0,0,0)"/>
<path d="M267,490 L 369,490 Q 384,490 384,505 L 384,505 Q 384,520 395,520 L 405,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,460 244,455 244,464" style="fill:rgb(0,0,0)"/>
<path d="M305,422 L 313,422 Q 320,422 320,437 L 320,445 Q 320,460 305,460 L 254,460 L 239,460"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,520 142,525 142,516" style="fill:rgb(0,0,0)"/>
<path d="M233,460 L 142,460 Q 127,460 127,475 L 127,505 Q 127,520 137,520 L 147,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,447 122,435 131,435" style="fill:rgb(0,0,0)"/>
<path d="M127,407L127,441"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,447L127,505"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,649L232,649A15 15 0 0 0 247 634A15 15 0 0 0 232 619L168,619A15 15 0 0 0 153 634A15 15 0 0 0 168 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="200" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="283,634 271,638 271,629" style="fill:rgb(0,0,0)"/>
<path d="M247,634L277,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,649L395,649A15 15 0 0 0 410 634A15 15 0 0 0 395 619L298,619A15 15 0 0 0 283 634A15 15 0 0 0 298 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="433,634 422,638 422,629" style="fill:rgb(0,0,0)"/>
<path d="M410,634L427,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,649L452,649A15 15 0 0 0 467 634A15 15 0 0 0 452 619L448,619A15 15 0 0 0 433 634A15 15 0 0 0 448 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="450" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="490,634 479,638 479,629" style="fill:rgb(0,0,0)"/>
<path d="M467,634L485,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,649L609,649L609,619L490,619Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="550" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M446,687A15 15 0 0 0 461 671A15 15 0 0 0 446 656A15 15 0 0 0 431 671A15 15 0 0 0 446 687Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="671" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="461,671 472,667 472,676" style="fill:rgb(0,0,0)"/>
<path d="M609,634 L 616,634 Q 624,634 624,649 L 624,656 Q 624,671 609,671 L 482,671 L 467,671"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,671 L 271,671 Q 256,671 256,656 L 256,649 Q 256,634 264,634 L 271,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="624,692 619,680 628,680" style="fill:rgb(0,0,0)"/>
<path d="M624,656L624,686"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,558 648,547 656,547" style="fill:rgb(0,0,0)"/>
<path d="M607,520 L 637,520 Q 652,520 652,535 L 652,537 L 652,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,596 382,592 382,600" style="fill:rgb(0,0,0)"/>
<path d="M652,558 L 652,581 Q 652,596 637,596 L 391,596 L 376,596"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,634 142,638 142,629" style="fill:rgb(0,0,0)"/>
<path d="M371,596 L 142,596 Q 127,596 127,611 L 127,619 Q 127,634 137,634 L 147,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,558 122,547 131,547" style="fill:rgb(0,0,0)"/>
<path d="M127,505L127,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,709 359,714 359,705" style="fill:rgb(0,0,0)"/>
<path d="M127,558 L 127,694 Q 127,709 142,709 L 350,709 L 365,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,709 597,714 597,705" style="fill:rgb(0,0,0)"/>
<path d="M371,709L603,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,709 L 616,709 Q 624,709 624,717 L 624,724"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,800L194,800A15 15 0 0 0 209 785A15 15 0 0 0 194 770L142,770A15 15 0 0 0 127 785A15 15 0 0 0 142 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="245,785 234,789 234,781" style="fill:rgb(0,0,0)"/>
<path d="M209,785L239,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,800A15 15 0 0 0 275 785A15 15 0 0 0 260 770A15 15 0 0 0 245 785A15 15 0 0 0 260 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="311,785 300,789 300,781" style="fill:rgb(0,0,0)"/>
<path d="M275,785L306,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,800L361,800L361,770L311,770Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="397,785 385,789 385,781" style="fill:rgb(0,0,0)"/>
<path d="M361,785L391,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,800A15 15 0 0 0 427 785A15 15 0 0 0 412 770A15 15 0 0 0 397 785A15 15 0 0 0 412 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="412" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="609,785 597,789 597,781" style="fill:rgb(0,0,0)"/>
<path d="M427,785L603,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,785 L 616,785 Q 624,785 624,792 L 624,800"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,762A15 15 0 0 0 351 747A15 15 0 0 0 336 732A15 15 0 0 0 321 747A15 15 0 0 0 336 762Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="747" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M336,838A15 15 0 0 0 351 823A15 15 0 0 0 336 808A15 15 0 0 0 321 823A15 15 0 0 0 336 838Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="823" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="351,747 363,743 363,751" style="fill:rgb(0,0,0)"/>
<path d="M361,785 L 368,785 Q 376,785 376,770 L 376,762 Q 376,747 366,747 L 357,747"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,747 L 300,747 Q 285,747 285,762 L 285,770 Q 285,785 292,785 L 300,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,823 363,818 363,827" style="fill:rgb(0,0,0)"/>
<path d="M427,785 L 434,785 Q 442,785 442,800 L 442,808 Q 442,823 427,823 L 372,823 L 357,823"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,823 L 234,823 Q 219,823 219,808 L 219,800 Q 219,785 226,785 L 234,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,785 115,789 115,781" style="fill:rgb(0,0,0)"/>
<path d="M55,129 L 62,129 Q 70,129 70,144 L 70,770 Q 70,785 85,785 L 106,785 L 121,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,891L424,891L424,860L248,860Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="876" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="424,876 436,871 436,880" style="fill:rgb(0,0,0)"/>
<path d="M624,692 L 624,861 Q 624,876 609,876 L 445,876 L 430,876"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="6,197 10,208 2,208" style="fill:rgb(0,0,0)"/>
<path d="M248,876 L 21,876 Q 6,876 6,861 L 6,217 L 6,202"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M6,197 L 6,144 Q 6,129 21,129 L 40,129 L 55,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="667" y="275" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" transform="rotate(-90 667,285)" dominant-baseline="central">select-core</text>
<path d="M168,966L213,966A15 15 0 0 0 228 951A15 15 0 0 0 213 936L168,936A15 15 0 0 0 153 951A15 15 0 0 0 168 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="251,951 239,956 239,947" style="fill:rgb(0,0,0)"/>
<path d="M228,951L245,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,966L270,966A15 15 0 0 0 285 951A15 15 0 0 0 270 936L266,936A15 15 0 0 0 251 951A15 15 0 0 0 266 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M168,1072L202,1072A15 15 0 0 0 217 1057A15 15 0 0 0 202 1042L168,1042A15 15 0 0 0 153 1057A15 15 0 0 0 168 1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="240,1057 228,1061 228,1053" style="fill:rgb(0,0,0)"/>
<path d="M217,1057L234,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,1072L289,1072L289,1042L240,1042Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="330,951 319,956 319,947" style="fill:rgb(0,0,0)"/>
<path d="M285,951L324,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,966L460,966L460,936L330,936Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M395,1004A15 15 0 0 0 410 989A15 15 0 0 0 395 974A15 15 0 0 0 380 989A15 15 0 0 0 395 1004Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="989" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="410,989 422,985 422,993" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 468,951 Q 475,951 475,966 L 475,974 Q 475,989 460,989 L 431,989 L 416,989"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,989 L 322,989 Q 307,989 307,974 L 307,966 Q 307,951 313,951 L 319,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,913 348,909 348,918" style="fill:rgb(0,0,0)"/>
<path d="M624,860 L 624,898 Q 624,913 609,913 L 357,913 L 342,913"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,951 142,956 142,947" style="fill:rgb(0,0,0)"/>
<path d="M336,913 L 142,913 Q 127,913 127,928 L 127,936 Q 127,951 137,951 L 147,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,981 492,970 500,970" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 481,951 Q 496,951 496,963 L 496,976"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,1023 318,1019 318,1027" style="fill:rgb(0,0,0)"/>
<path d="M496,981 L 496,1008 Q 496,1023 481,1023 L 327,1023 L 312,1023"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,1057 142,1061 142,1053" style="fill:rgb(0,0,0)"/>
<path d="M307,1023 L 142,1023 Q 127,1023 127,1038 L 127,1042 Q 127,1057 137,1057 L 147,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,989 122,978 131,978" style="fill:rgb(0,0,0)"/>
<path d="M127,936L127,983"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,989L127,1042"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1102L415,1102A15 15 0 0 0 430 1087A15 15 0 0 0 415 1072L363,1072A15 15 0 0 0 348 1087A15 15 0 0 0 363 1102Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="389" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="453,1087 441,1092 441,1083" style="fill:rgb(0,0,0)"/>
<path d="M430,1087L447,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,1102L502,1102L502,1072L453,1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="525,1087 513,1092 513,1083" style="fill:rgb(0,0,0)"/>
<path d="M502,1087L519,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1140A15 15 0 0 0 378 1125A15 15 0 0 0 363 1110A15 15 0 0 0 348 1125A15 15 0 0 0 363 1140Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="1125" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="401,1125 390,1129 390,1121" style="fill:rgb(0,0,0)"/>
<path d="M378,1125L396,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,1140L451,1140L451,1110L401,1110Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="1125" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="312,1057 301,1061 301,1053" style="fill:rgb(0,0,0)"/>
<path d="M289,1057L306,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1125 337,1129 337,1121" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1110 Q 327,1125 335,1125 L 342,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1087 337,1092 337,1083" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1072 Q 327,1087 335,1087 L 342,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1057 513,1061 513,1053" style="fill:rgb(0,0,0)"/>
<path d="M312,1057L519,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="620,1155 609,1160 609,1151" style="fill:rgb(0,0,0)"/>
<path d="M525,1057 L 546,1057 Q 561,1057 561,1072 L 561,1140 Q 561,1155 576,1155 L 599,1155 L 614,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="624" cy="1155" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1087 L 546,1087 Q 561,1087 561,1095 L 561,1102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1125 513,1129 513,1121" style="fill:rgb(0,0,0)"/>
<path d="M451,1125L519,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1125 L 546,1125 Q 561,1125 561,1133 L 561,1140"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1155 513,1160 513,1151" style="fill:rgb(0,0,0)"/>
<path d="M127,1042 L 127,1140 Q 127,1155 142,1155 L 504,1155 L 519,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1155L597,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/common-table-expression.html">common-table-expression:</a></b>
<button id='x51681226' onclick='hideorshow("x51681226","xbf2b42f6")'>show</button></p>
 <div id='xbf2b42f6' style='display:none;' class='imgcontainer'>
 <div style="max-width:638px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 638.525 167.4">
<circle cx="5" cy="29" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,29 20,33 20,24" style="fill:rgb(0,0,0)"/>
<path d="M9,29L26,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,44L122,44A15 15 0 0 0 137 29A15 15 0 0 0 122 14L47,14A15 15 0 0 0 32 29A15 15 0 0 0 47 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="160,29 149,33 149,24" style="fill:rgb(0,0,0)"/>
<path d="M137,29L155,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="196,29 185,33 185,24" style="fill:rgb(0,0,0)"/>
<path d="M160,29L191,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,44A15 15 0 0 0 227 29A15 15 0 0 0 211 14A15 15 0 0 0 196 29A15 15 0 0 0 211 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="250,29 238,33 238,24" style="fill:rgb(0,0,0)"/>
<path d="M227,29L244,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="286,29 274,33 274,24" style="fill:rgb(0,0,0)"/>
<path d="M250,29L280,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,44L395,44A15 15 0 0 0 410 29A15 15 0 0 0 395 14L301,14A15 15 0 0 0 286 29A15 15 0 0 0 301 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="446,29 434,33 434,24" style="fill:rgb(0,0,0)"/>
<path d="M410,29L440,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,44A15 15 0 0 0 476 29A15 15 0 0 0 461 14A15 15 0 0 0 446 29A15 15 0 0 0 461 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,29 499,33 499,24" style="fill:rgb(0,0,0)"/>
<path d="M476,29L505,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,165L51,165A15 15 0 0 0 66 150A15 15 0 0 0 51 135L47,135A15 15 0 0 0 32 150A15 15 0 0 0 47 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="49" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<path d="M127,135L147,135A15 15 0 0 0 162 119A15 15 0 0 0 147 104L127,104A15 15 0 0 0 112 119A15 15 0 0 0 127 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<path d="M219,135L337,135A15 15 0 0 0 352 119A15 15 0 0 0 337 104L219,104A15 15 0 0 0 204 119A15 15 0 0 0 219 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<path d="M162,119L204,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,165A15 15 0 0 0 425 150A15 15 0 0 0 410 135A15 15 0 0 0 395 150A15 15 0 0 0 410 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="410" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="448,150 437,154 437,145" style="fill:rgb(0,0,0)"/>
<path d="M425,150L442,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,165L552,165L552,135L448,135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="500" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="575,150 564,154 564,145" style="fill:rgb(0,0,0)"/>
<path d="M552,150L570,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M591,165A15 15 0 0 0 606 150A15 15 0 0 0 591 135A15 15 0 0 0 575 150A15 15 0 0 0 591 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="629,150 617,154 617,145" style="fill:rgb(0,0,0)"/>
<path d="M606,150L623,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="632" cy="150" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,82A15 15 0 0 0 363 66A15 15 0 0 0 348 51A15 15 0 0 0 333 66A15 15 0 0 0 348 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="363,66 374,62 374,71" style="fill:rgb(0,0,0)"/>
<path d="M410,29 L 417,29 Q 425,29 425,44 L 425,51 Q 425,66 410,66 L 384,66 L 369,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M333,66 L 278,66 Q 263,66 263,51 L 263,44 Q 263,29 270,29 L 278,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,93 78,89 78,97" style="fill:rgb(0,0,0)"/>
<path d="M511,29 L 516,29 Q 522,29 522,44 L 522,78 Q 522,93 507,93 L 87,93 L 72,93"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,150 20,154 20,145" style="fill:rgb(0,0,0)"/>
<path d="M66,93 L 30,93 Q 15,93 15,108 L 15,135 Q 15,150 20,150 L 26,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="85,150 73,154 73,145" style="fill:rgb(0,0,0)"/>
<path d="M66,150L79,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="112,119 101,124 101,115" style="fill:rgb(0,0,0)"/>
<path d="M85,150 L 89,150 Q 92,150 92,135 L 92,134 Q 92,119 99,119 L 106,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="204,119 192,124 192,115" style="fill:rgb(0,0,0)"/>
<path d="M66,150 L 147,150 Q 162,150 170,150 Q 177,150 177,135 L 177,134 Q 177,119 188,119 L 198,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,150 383,154 383,145" style="fill:rgb(0,0,0)"/>
<path d="M352,119 L 360,119 Q 367,119 367,134 L 367,135 Q 367,150 378,150 L 389,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150L395,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,6 336,10 336,2" style="fill:rgb(0,0,0)"/>
<path d="M160,29 L 168,29 Q 175,29 175,17 Q 175,6 190,6 L 327,6 L 342,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,6 L 473,6 Q 488,6 488,17 Q 488,29 495,29 L 503,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/compound-operator.html">compound-operator:</a></b>
<button id='x884c1486' onclick='hideorshow("x884c1486","xfe21b31a")'>show</button></p>
 <div id='xfe21b31a' style='display:none;' class='imgcontainer'>
 <div style="max-width:293px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 293.842 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L127,32A15 15 0 0 0 142 17A15 15 0 0 0 127 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,70L127,70A15 15 0 0 0 142 55L142,55A15 15 0 0 0 127 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,108L168,108A15 15 0 0 0 183 92A15 15 0 0 0 168 77L83,77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M83,145L135,145A15 15 0 0 0 150 130A15 15 0 0 0 135 115L83,115A15 15 0 0 0 68 130A15 15 0 0 0 83 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M142,55L159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70L195,70A15 15 0 0 0 210 55L210,55A15 15 0 0 0 195 39L180,39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="233,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M210,55L227,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,17 272,21 272,12" style="fill:rgb(0,0,0)"/>
<path d="M233,55 L 240,55 Q 248,55 248,40 L 248,32 Q 248,17 263,17 L 263,17 L 278,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="288" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M47,39 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,92 221,97 221,88" style="fill:rgb(0,0,0)"/>
<path d="M183,92L227,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,92 L 240,92 Q 248,92 248,77 L 248,54 L 248,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,130 56,135 56,126" style="fill:rgb(0,0,0)"/>
<path d="M47,77 L 47,115 Q 47,130 55,130 L 62,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,130 221,135 221,126" style="fill:rgb(0,0,0)"/>
<path d="M150,130L227,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,130 L 240,130 Q 248,130 248,115 L 248,92 L 248,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-clause.html">join-clause:</a></b>
<button id='x131a757e' onclick='hideorshow("x131a757e","xaecfe1cf")'>show</button></p>
 <div id='xaecfe1cf' style='display:none;' class='imgcontainer'>
 <div style="max-width:793px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 793.282 84.24">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L193,32L193,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="259,47 247,51 247,43" style="fill:rgb(0,0,0)"/>
<path d="M193,17 L 200,17 Q 208,17 208,32 L 208,32 Q 208,47 223,47 L 238,47 L 253,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,62L380,62L380,32L259,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-operator</text>
<polygon points="403,47 391,51 391,43" style="fill:rgb(0,0,0)"/>
<path d="M380,47L397,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,62L564,62L564,32L403,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="587,47 575,51 575,43" style="fill:rgb(0,0,0)"/>
<path d="M564,47L581,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M587,62L721,62L721,32L587,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="654" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-constraint</text>
<polygon points="783,17 772,21 772,12" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 742,47 Q 757,47 757,32 L 757,32 Q 757,17 767,17 L 778,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="787" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M193,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,17L776,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,77 495,73 495,82" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 728,47 Q 736,47 736,62 L 736,62 Q 736,77 721,77 L 504,77 L 489,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,77 L 247,77 Q 232,77 232,62 L 232,62 Q 232,47 246,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/join-constraint.html">join-constraint:</a></b>
<button id='x3d0ceebb' onclick='hideorshow("x3d0ceebb","xe35ea308")'>show</button></p>
 <div id='xe35ea308' style='display:none;' class='imgcontainer'>
 <div style="max-width:483px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 483.336 126.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L104,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 104 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="143,55 131,59 131,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L137,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,70A15 15 0 0 0 173 55L173,55A15 15 0 0 0 158 39A15 15 0 0 0 143 55L143,55A15 15 0 0 0 158 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="209,55 197,59 197,50" style="fill:rgb(0,0,0)"/>
<path d="M173,55L203,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M224,70L318,70A15 15 0 0 0 333 55L333,55A15 15 0 0 0 318 39L224,39A15 15 0 0 0 209 55L209,55A15 15 0 0 0 224 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="369,55 358,59 358,50" style="fill:rgb(0,0,0)"/>
<path d="M333,55L363,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,70A15 15 0 0 0 399 55L399,55A15 15 0 0 0 384 39A15 15 0 0 0 369 55L369,55A15 15 0 0 0 384 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="422,55 411,59 411,50" style="fill:rgb(0,0,0)"/>
<path d="M399,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="473,17 462,21 462,12" style="fill:rgb(0,0,0)"/>
<path d="M422,55 L 430,55 Q 437,55 437,40 L 437,32 Q 437,17 452,17 L 453,17 L 468,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="477" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,108A15 15 0 0 0 286 92A15 15 0 0 0 271 77A15 15 0 0 0 256 92A15 15 0 0 0 271 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="286,92 298,88 298,97" style="fill:rgb(0,0,0)"/>
<path d="M333,55 L 341,55 Q 348,55 348,70 L 348,77 Q 348,92 333,92 L 307,92 L 292,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,92 L 197,92 Q 182,92 182,77 L 182,70 Q 182,55 190,55 L 197,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L74,32A15 15 0 0 0 90 17A15 15 0 0 0 74 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="113,17 101,21 101,12" style="fill:rgb(0,0,0)"/>
<path d="M90,17L107,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M113,32L162,32L162,2L113,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="422,17 411,21 411,12" style="fill:rgb(0,0,0)"/>
<path d="M162,17L417,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,17L462,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="209,120 197,124 197,115" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,105 Q 24,120 39,120 L 188,120 L 203,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,120 L 422,120 Q 437,120 437,105 L 437,54 L 437,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-operator.html">join-operator:</a></b>
<button id='x6fb1d7fe' onclick='hideorshow("x6fb1d7fe","x8ac3c307")'>show</button></p>
 <div id='x8ac3c307' style='display:none;' class='imgcontainer'>
 <div style="max-width:620px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 620.333 255.312">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,71 39,76 39,67" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,56 Q 24,71 34,71 L 45,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,86L133,86A15 15 0 0 0 148 71A15 15 0 0 0 133 56L66,56A15 15 0 0 0 50 71A15 15 0 0 0 66 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="99" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NATURAL</text>
<polygon points="189,41 178,45 178,37" style="fill:rgb(0,0,0)"/>
<path d="M148,71 L 155,71 Q 163,71 163,56 L 163,56 Q 163,41 173,41 L 184,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,71 219,76 219,67" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,56 Q 204,71 215,71 L 225,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,86L273,86A15 15 0 0 0 288 71A15 15 0 0 0 273 56L246,56A15 15 0 0 0 231 71A15 15 0 0 0 246 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LEFT</text>
<polygon points="378,71 366,76 366,67" style="fill:rgb(0,0,0)"/>
<path d="M288,71L372,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,86L437,86A15 15 0 0 0 452 71A15 15 0 0 0 437 56L393,56A15 15 0 0 0 378 71A15 15 0 0 0 393 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OUTER</text>
<polygon points="475,71 463,76 463,67" style="fill:rgb(0,0,0)"/>
<path d="M452,71L469,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="516,41 505,45 505,37" style="fill:rgb(0,0,0)"/>
<path d="M475,71 L 482,71 Q 490,71 490,56 L 490,56 Q 490,41 500,41 L 511,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,56L554,56A15 15 0 0 0 569 41A15 15 0 0 0 554 26L532,26A15 15 0 0 0 516 41A15 15 0 0 0 532 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="543" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">JOIN</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M569,41 L 576,41 Q 584,41 584,29 Q 584,17 594,17 L 605,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="614" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,32A15 15 0 0 0 325 17A15 15 0 0 0 310 2A15 15 0 0 0 295 17A15 15 0 0 0 310 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="295,17 283,21 283,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L289,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M325,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="99,41 88,45 88,37" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,29 Q 24,41 39,41 L 78,41 L 93,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M99,41L178,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,41L505,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,41 366,45 366,37" style="fill:rgb(0,0,0)"/>
<path d="M336,71 L 344,71 Q 351,71 351,56 L 351,56 Q 351,41 362,41 L 372,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,109 219,113 219,105" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,94 Q 204,109 215,109 L 225,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,124L284,124A15 15 0 0 0 299 109A15 15 0 0 0 284 94L246,94A15 15 0 0 0 231 109A15 15 0 0 0 246 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RIGHT</text>
<polygon points="341,71 329,76 329,67" style="fill:rgb(0,0,0)"/>
<path d="M299,109 L 307,109 Q 314,109 314,94 L 314,86 Q 314,71 324,71 L 335,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,147 219,151 219,142" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,132 Q 204,147 215,147 L 225,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,162L274,162A15 15 0 0 0 289 147A15 15 0 0 0 274 132L246,132A15 15 0 0 0 231 147A15 15 0 0 0 246 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FULL</text>
<path d="M289,147 L 302,147 Q 314,147 314,132 L 314,109 L 314,94"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,192 219,196 219,188" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,177 Q 204,192 215,192 L 225,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,207L287,207A15 15 0 0 0 302 192A15 15 0 0 0 287 177L246,177A15 15 0 0 0 231 192A15 15 0 0 0 246 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="192" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INNER</text>
<polygon points="475,192 463,196 463,188" style="fill:rgb(0,0,0)"/>
<path d="M302,192L469,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,192 L 482,192 Q 490,192 490,185 L 490,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,238 219,242 219,233" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,223 Q 24,238 39,238 L 210,238 L 225,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,253L287,253A15 15 0 0 0 303 238A15 15 0 0 0 287 222L246,222A15 15 0 0 0 231 238A15 15 0 0 0 246 253Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="238" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CROSS</text>
<polygon points="475,238 463,242 463,233" style="fill:rgb(0,0,0)"/>
<path d="M303,238L469,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,238 L 482,238 Q 490,238 490,223 L 490,71 L 490,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x820908be' onclick='hideorshow("x820908be","x6f61633b")'>show</button></p>
 <div id='x6f61633b' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/result-column.html">result-column:</a></b>
<button id='x5f528ff0' onclick='hideorshow("x5f528ff0","xc8659183")'>show</button></p>
 <div id='xc8659183' style='display:none;' class='imgcontainer'>
 <div style="max-width:398px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 398.054 163.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L94,32L94,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="136,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M94,17 L 102,17 Q 109,17 109,32 L 109,40 Q 109,55 119,55 L 130,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M151,70L155,70A15 15 0 0 0 170 55L170,55A15 15 0 0 0 155 39L151,39A15 15 0 0 0 136 55L136,55A15 15 0 0 0 151 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="206,55 194,59 194,50" style="fill:rgb(0,0,0)"/>
<path d="M170,55L200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,70L309,70A15 15 0 0 0 324 55L324,55A15 15 0 0 0 309 39L221,39A15 15 0 0 0 206 55L206,55A15 15 0 0 0 221 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="347,55 335,59 335,50" style="fill:rgb(0,0,0)"/>
<path d="M324,55L341,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,17 377,21 377,12" style="fill:rgb(0,0,0)"/>
<path d="M347,55 L 354,55 Q 362,55 362,40 L 362,32 Q 362,17 372,17 L 382,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="392" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,85 141,89 141,81" style="fill:rgb(0,0,0)"/>
<path d="M109,39 L 109,70 Q 109,85 124,85 L 132,85 L 147,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,85 L 170,85 Q 185,85 185,70 L 185,70 Q 185,55 192,55 L 200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="241,17 230,21 230,12" style="fill:rgb(0,0,0)"/>
<path d="M94,17L235,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M241,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,108 39,112 39,103" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,93 Q 24,108 34,108 L 45,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,123A15 15 0 0 0 81 108A15 15 0 0 0 66 92A15 15 0 0 0 50 108A15 15 0 0 0 66 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="108" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,108 335,112 335,103" style="fill:rgb(0,0,0)"/>
<path d="M81,108L341,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,108 L 354,108 Q 362,108 362,93 L 362,54 L 362,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,145 39,150 39,141" style="fill:rgb(0,0,0)"/>
<path d="M24,92 L 24,130 Q 24,145 34,145 L 45,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,160L141,160A15 15 0 0 0 156 145A15 15 0 0 0 141 130L66,130A15 15 0 0 0 50 145A15 15 0 0 0 66 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="145" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="179,145 167,150 167,141" style="fill:rgb(0,0,0)"/>
<path d="M156,145L173,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M194,160A15 15 0 0 0 209 145A15 15 0 0 0 194 130A15 15 0 0 0 179 145A15 15 0 0 0 194 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="232,145 221,150 221,141" style="fill:rgb(0,0,0)"/>
<path d="M209,145L226,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,160A15 15 0 0 0 262 145A15 15 0 0 0 247 130A15 15 0 0 0 232 145A15 15 0 0 0 247 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,145 335,150 335,141" style="fill:rgb(0,0,0)"/>
<path d="M262,145L341,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,145 L 354,145 Q 362,145 362,130 L 362,107 L 362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/table-or-subquery.html">table-or-subquery:</a></b>
<button id='xbc3c2934' onclick='hideorshow("xbc3c2934","xaac981d0")'>show</button></p>
 <div id='xaac981d0' style='display:none;' class='imgcontainer'>
 <div style="max-width:720px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 720.778 457.704">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,74 39,78 39,70" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,59 Q 24,74 34,74 L 45,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,89L162,89A15 15 0 0 0 177 74L177,74A15 15 0 0 0 162 59L66,59A15 15 0 0 0 50 74L50,74A15 15 0 0 0 66 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="194,74 183,78 183,70" style="fill:rgb(0,0,0)"/>
<path d="M177,74L189,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,89A15 15 0 0 0 225 74L225,74A15 15 0 0 0 209 59A15 15 0 0 0 194 74L194,74A15 15 0 0 0 209 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="266,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M225,74 L 232,74 Q 240,74 240,59 L 240,51 Q 240,36 250,36 L 260,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,51L356,51A15 15 0 0 0 371 36A15 15 0 0 0 356 21L281,21A15 15 0 0 0 266 36A15 15 0 0 0 281 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="407,36 396,41 396,32" style="fill:rgb(0,0,0)"/>
<path d="M371,36L402,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,51L427,51A15 15 0 0 0 442 36A15 15 0 0 0 427 21L423,21A15 15 0 0 0 407 36A15 15 0 0 0 423 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="478,36 466,41 466,32" style="fill:rgb(0,0,0)"/>
<path d="M442,36L472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,51L561,51A15 15 0 0 0 577 36A15 15 0 0 0 561 21L493,21A15 15 0 0 0 478 36A15 15 0 0 0 493 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="527" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<path d="M9,36L255,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="422,6 411,10 411,2" style="fill:rgb(0,0,0)"/>
<path d="M371,36 L 379,36 Q 386,36 386,21 L 386,21 Q 386,6 401,6 L 402,6 L 417,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 442,6 Q 457,6 457,21 L 457,21 Q 457,36 464,36 L 472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 577,6 Q 592,6 592,21 L 592,21 Q 592,36 599,36 L 607,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,127L388,127A15 15 0 0 0 403 112A15 15 0 0 0 388 97L323,97A15 15 0 0 0 308 112A15 15 0 0 0 323 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="426,112 415,116 415,108" style="fill:rgb(0,0,0)"/>
<path d="M403,112L420,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,127L445,127A15 15 0 0 0 460 112A15 15 0 0 0 445 97L441,97A15 15 0 0 0 426 112A15 15 0 0 0 441 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="443" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="483,112 472,116 472,108" style="fill:rgb(0,0,0)"/>
<path d="M460,112L478,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,127L577,127A15 15 0 0 0 592 112A15 15 0 0 0 577 97L499,97A15 15 0 0 0 483 112A15 15 0 0 0 499 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="538" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M323,165L343,165A15 15 0 0 0 359 150A15 15 0 0 0 343 135L323,135A15 15 0 0 0 308 150A15 15 0 0 0 323 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="382,150 370,154 370,145" style="fill:rgb(0,0,0)"/>
<path d="M359,150L376,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,165L461,165A15 15 0 0 0 476 150A15 15 0 0 0 461 135L397,135A15 15 0 0 0 382 150A15 15 0 0 0 397 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="527,74 539,70 539,78" style="fill:rgb(0,0,0)"/>
<path d="M577,36 L 607,36 Q 622,36 622,51 L 622,59 Q 622,74 607,74 L 548,74 L 533,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,150 297,154 297,145" style="fill:rgb(0,0,0)"/>
<path d="M527,74 L 297,74 Q 282,74 282,89 L 282,135 Q 282,150 292,150 L 302,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,112 297,116 297,108" style="fill:rgb(0,0,0)"/>
<path d="M282,97 L 282,104 Q 282,112 292,112 L 302,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="266,213 255,217 255,209" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,198 Q 24,213 39,213 L 245,213 L 260,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,228L431,228A15 15 0 0 0 446 213A15 15 0 0 0 431 198L281,198A15 15 0 0 0 266 213A15 15 0 0 0 281 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function-name</text>
<polygon points="463,213 452,217 452,209" style="fill:rgb(0,0,0)"/>
<path d="M446,213L457,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,228A15 15 0 0 0 493 213A15 15 0 0 0 478 198A15 15 0 0 0 463 213A15 15 0 0 0 478 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="529,213 518,217 518,209" style="fill:rgb(0,0,0)"/>
<path d="M493,213L524,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M529,228L579,228L579,198L529,198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="615,213 603,217 603,209" style="fill:rgb(0,0,0)"/>
<path d="M579,213L609,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M630,228A15 15 0 0 0 645 213A15 15 0 0 0 630 198A15 15 0 0 0 615 213A15 15 0 0 0 630 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="630" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="675,187 679,198 671,198" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 660,213 Q 675,213 675,203 L 675,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M554,190A15 15 0 0 0 569 175A15 15 0 0 0 554 160A15 15 0 0 0 539 175A15 15 0 0 0 554 190Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="175" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="569,175 581,171 581,180" style="fill:rgb(0,0,0)"/>
<path d="M579,213 L 586,213 Q 594,213 594,198 L 594,190 Q 594,175 584,175 L 575,175"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,175 L 518,175 Q 503,175 503,190 L 503,198 Q 503,213 510,213 L 518,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,74 L 232,74 Q 240,74 240,89 L 240,198 Q 240,213 247,213 L 255,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,112 648,116 648,108" style="fill:rgb(0,0,0)"/>
<path d="M592,112L654,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,112 L 667,112 Q 675,112 675,104 L 675,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,150 648,154 648,145" style="fill:rgb(0,0,0)"/>
<path d="M476,150L654,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,150 L 667,150 Q 675,150 675,142 L 675,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M577,36L690,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,304L411,304A15 15 0 0 0 426 289A15 15 0 0 0 411 274L407,274A15 15 0 0 0 392 289A15 15 0 0 0 407 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="498,289 487,293 487,284" style="fill:rgb(0,0,0)"/>
<path d="M426,289L492,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M513,304L582,304A15 15 0 0 0 597 289A15 15 0 0 0 582 274L513,274A15 15 0 0 0 498 289A15 15 0 0 0 513 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="548" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<polygon points="660,289 648,293 648,284" style="fill:rgb(0,0,0)"/>
<path d="M597,289L654,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,289 L 667,289 Q 675,289 675,281 L 675,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="548,251 559,247 559,255" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 652,213 Q 660,213 660,228 L 660,236 Q 660,251 645,251 L 568,251 L 553,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M548,251 L 370,251 Q 355,251 355,266 L 355,274 Q 355,289 370,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,251 L 464,251 Q 457,251 457,266 L 457,274 Q 457,289 464,289 L 472,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,327 39,331 39,322" style="fill:rgb(0,0,0)"/>
<path d="M24,198 L 24,312 Q 24,327 34,327 L 45,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,342A15 15 0 0 0 81 327A15 15 0 0 0 66 311A15 15 0 0 0 50 327A15 15 0 0 0 66 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,327 92,331 92,322" style="fill:rgb(0,0,0)"/>
<path d="M81,327L98,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,342L208,342L208,311L104,311Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="327" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="231,327 219,331 219,322" style="fill:rgb(0,0,0)"/>
<path d="M208,327L225,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,342A15 15 0 0 0 261 327A15 15 0 0 0 246 311A15 15 0 0 0 231 327A15 15 0 0 0 246 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M261,327 L 269,327 Q 276,327 276,312 L 276,304 Q 276,289 291,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,327 648,331 648,322" style="fill:rgb(0,0,0)"/>
<path d="M261,327L654,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,327 L 667,327 Q 675,327 675,319 L 675,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,327 L 432,327 Q 439,327 439,312 L 439,304 Q 439,289 447,289 L 454,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,364 39,369 39,360" style="fill:rgb(0,0,0)"/>
<path d="M24,311 L 24,349 Q 24,364 34,364 L 45,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,379A15 15 0 0 0 81 364A15 15 0 0 0 65 349A15 15 0 0 0 50 364A15 15 0 0 0 65 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="135,364 123,369 123,360" style="fill:rgb(0,0,0)"/>
<path d="M81,364L129,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,379L296,379L296,349L135,349Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="364" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="350,364 338,369 338,360" style="fill:rgb(0,0,0)"/>
<path d="M296,364L344,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,379A15 15 0 0 0 380 364A15 15 0 0 0 365 349A15 15 0 0 0 350 364A15 15 0 0 0 365 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="660,364 648,369 648,360" style="fill:rgb(0,0,0)"/>
<path d="M380,364L654,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="711,36 699,41 699,32" style="fill:rgb(0,0,0)"/>
<path d="M660,364 L 667,364 Q 675,364 675,349 L 675,51 Q 675,36 690,36 L 690,36 L 705,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="715" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,417A15 15 0 0 0 230 402A15 15 0 0 0 215 387A15 15 0 0 0 200 402A15 15 0 0 0 215 417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="402" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="230,402 242,398 242,406" style="fill:rgb(0,0,0)"/>
<path d="M296,364 L 303,364 Q 311,364 311,379 L 311,387 Q 311,402 296,402 L 251,402 L 236,402"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,402 L 123,402 Q 108,402 108,387 L 108,379 Q 108,364 116,364 L 123,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="122,440 111,444 111,436" style="fill:rgb(0,0,0)"/>
<path d="M81,364 L 88,364 Q 96,364 96,379 L 96,425 Q 96,440 106,440 L 116,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M122,455L224,455L224,425L122,425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M224,440 L 308,440 Q 323,440 323,425 L 323,379 Q 323,364 331,364 L 338,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/window-defn.html">window-defn:</a></b>
<button id='xf705e8b0' onclick='hideorshow("xf705e8b0","xca3effbe")'>show</button></p>
 <div id='xca3effbe' style='display:none;' class='imgcontainer'>
 <div style="max-width:479px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 479.765 380.592">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,44 92,48 92,40" style="fill:rgb(0,0,0)"/>
<path d="M62,17 L 70,17 Q 77,17 77,30 Q 77,44 88,44 L 98,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,59L260,59A15 15 0 0 0 275 44L275,44A15 15 0 0 0 260 29L119,29A15 15 0 0 0 104 44L104,44A15 15 0 0 0 119 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M119,135L198,135A15 15 0 0 0 214 120A15 15 0 0 0 198 104L119,104A15 15 0 0 0 104 120A15 15 0 0 0 119 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="237,120 225,124 225,115" style="fill:rgb(0,0,0)"/>
<path d="M214,120L231,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M252,135L256,135A15 15 0 0 0 271 120A15 15 0 0 0 256 104L252,104A15 15 0 0 0 237 120A15 15 0 0 0 252 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="307,120 295,124 295,115" style="fill:rgb(0,0,0)"/>
<path d="M271,120L301,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,135L356,135L356,104L307,104Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M332,173A15 15 0 0 0 347 157A15 15 0 0 0 332 142A15 15 0 0 0 316 157A15 15 0 0 0 332 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="157" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="347,157 358,153 358,162" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,142 Q 371,157 362,157 L 352,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,157 L 295,157 Q 280,157 280,142 L 280,135 Q 280,120 288,120 L 295,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,17 178,21 178,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L184,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,82 201,77 201,86" style="fill:rgb(0,0,0)"/>
<path d="M190,17 L 298,17 Q 313,17 313,32 L 313,67 Q 313,82 298,82 L 210,82 L 195,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,120 92,124 92,115" style="fill:rgb(0,0,0)"/>
<path d="M190,82 L 77,82 Q 62,82 62,97 L 62,105 Q 62,120 77,120 L 83,120 L 98,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,44 287,48 287,40" style="fill:rgb(0,0,0)"/>
<path d="M275,44L293,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,44 L 306,44 Q 313,44 313,51 L 313,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,248L163,248A15 15 0 0 0 178 233A15 15 0 0 0 163 218L119,218A15 15 0 0 0 104 233A15 15 0 0 0 119 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="201,233 190,237 190,229" style="fill:rgb(0,0,0)"/>
<path d="M178,233L196,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,248L221,248A15 15 0 0 0 236 233A15 15 0 0 0 221 218L217,218A15 15 0 0 0 201 233A15 15 0 0 0 217 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="272,233 260,237 260,229" style="fill:rgb(0,0,0)"/>
<path d="M236,233L266,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,248L402,248L402,218L272,218Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M337,286A15 15 0 0 0 352 271A15 15 0 0 0 337 256A15 15 0 0 0 322 271A15 15 0 0 0 337 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="352,271 363,266 363,275" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,256 Q 417,271 402,271 L 373,271 L 358,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M322,271 L 260,271 Q 245,271 245,256 L 245,248 Q 245,233 253,233 L 260,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,195 201,191 201,200" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,180 Q 371,195 356,195 L 210,195 L 195,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,233 92,237 92,229" style="fill:rgb(0,0,0)"/>
<path d="M190,195 L 77,195 Q 62,195 62,210 L 62,218 Q 62,233 77,233 L 83,233 L 98,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,157 58,146 66,146" style="fill:rgb(0,0,0)"/>
<path d="M62,104L62,152"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,157L62,218"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,362L208,362L208,331L104,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="417,346 405,351 405,342" style="fill:rgb(0,0,0)"/>
<path d="M208,346L411,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,362A15 15 0 0 0 447 346A15 15 0 0 0 432 331A15 15 0 0 0 417 346A15 15 0 0 0 432 362Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="470,346 458,351 458,342" style="fill:rgb(0,0,0)"/>
<path d="M447,346L464,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="474" cy="346" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,309 201,304 201,313" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,294 Q 417,309 402,309 L 210,309 L 195,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,346 92,351 92,342" style="fill:rgb(0,0,0)"/>
<path d="M190,309 L 77,309 Q 62,309 62,324 L 62,331 Q 62,346 77,346 L 83,346 L 98,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,271 58,259 66,259" style="fill:rgb(0,0,0)"/>
<path d="M62,218L62,265"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,271L62,331"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,374 144,378 144,369" style="fill:rgb(0,0,0)"/>
<path d="M62,331 L 62,359 Q 62,374 77,374 L 135,374 L 150,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,346 266,351 266,342" style="fill:rgb(0,0,0)"/>
<path d="M156,374 L 233,374 Q 248,374 248,360 Q 248,346 260,346 L 272,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='xb495468b' onclick='hideorshow("xb495468b","x69a95ea8")'>show</button></p>
 <div id='x69a95ea8' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/type-name.html">type-name:</a></b>
<button id='xc36c8daf' onclick='hideorshow("xc36c8daf","x5462bd57")'>show</button></p>
 <div id='x5462bd57' style='display:none;' class='imgcontainer'>
 <div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.008 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L87,32A15 15 0 0 0 102 17A15 15 0 0 0 87 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="165,92 153,97 153,88" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,77 Q 138,92 149,92 L 159,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,108A15 15 0 0 0 195 92A15 15 0 0 0 180 77A15 15 0 0 0 165 92A15 15 0 0 0 180 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,92 201,97 201,88" style="fill:rgb(0,0,0)"/>
<path d="M195,92L207,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,108L350,108L350,77L212,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,92 356,97 356,88" style="fill:rgb(0,0,0)"/>
<path d="M350,92L362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,108A15 15 0 0 0 398 92A15 15 0 0 0 382 77A15 15 0 0 0 367 92A15 15 0 0 0 382 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="415,92 403,97 403,88" style="fill:rgb(0,0,0)"/>
<path d="M398,92L409,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,108L553,108L553,77L415,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="570,92 558,97 558,88" style="fill:rgb(0,0,0)"/>
<path d="M553,92L564,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,108A15 15 0 0 0 600 92A15 15 0 0 0 585 77A15 15 0 0 0 570 92A15 15 0 0 0 585 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="585" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="651,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M600,92 L 608,92 Q 615,92 615,77 L 615,32 Q 615,17 630,17 L 630,17 L 645,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,40 Q 138,55 149,55 L 159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70A15 15 0 0 0 195 55L195,55A15 15 0 0 0 180 39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,55 201,59 201,50" style="fill:rgb(0,0,0)"/>
<path d="M195,55L207,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,70L350,70L350,39L212,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,55 356,59 356,50" style="fill:rgb(0,0,0)"/>
<path d="M350,55L362,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,70A15 15 0 0 0 398 55L398,55A15 15 0 0 0 382 39A15 15 0 0 0 367 55L367,55A15 15 0 0 0 382 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="600,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M398,55L594,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M600,55 L 608,55 Q 615,55 615,47 L 615,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="74,47 85,43 85,51" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 110,17 Q 117,17 117,32 L 117,32 Q 117,47 102,47 L 94,47 L 79,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47 L 33,47 Q 18,47 18,32 L 18,32 Q 18,17 26,17 L 33,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="382,17 371,21 371,12" style="fill:rgb(0,0,0)"/>
<path d="M102,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,17L630,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='x880ecb9b' onclick='hideorshow("x880ecb9b","xefd52c90")'>show</button></p>
 <div id='xefd52c90' style='display:none;' class='imgcontainer'>
 <div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/indexed-column.html">indexed-column:</a></b>
<button id='xcef0072a' onclick='hideorshow("xcef0072a","xef9a4a14")'>show</button></p>
 <div id='xef9a4a14' style='display:none;' class='imgcontainer'>
 <div style="max-width:696px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 696.36 102.6">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L160,32A15 15 0 0 0 175 17A15 15 0 0 0 160 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="113" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="246,47 235,51 235,43" style="fill:rgb(0,0,0)"/>
<path d="M175,17 L 205,17 Q 220,17 220,32 L 220,32 Q 220,47 230,47 L 240,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M261,62L325,62A15 15 0 0 0 341 47L341,47A15 15 0 0 0 325 32L261,32A15 15 0 0 0 246 47L246,47A15 15 0 0 0 261 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="293" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="358,47 346,51 346,43" style="fill:rgb(0,0,0)"/>
<path d="M341,47L352,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M373,62L478,62A15 15 0 0 0 493 47L493,47A15 15 0 0 0 478 32L373,32A15 15 0 0 0 358 47L358,47A15 15 0 0 0 373 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="511,47 499,51 499,43" style="fill:rgb(0,0,0)"/>
<path d="M493,47L505,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="567,85 556,89 556,81" style="fill:rgb(0,0,0)"/>
<path d="M511,47 L 518,47 Q 526,47 526,32 L 526,32 Q 526,17 533,17 Q 541,17 541,32 L 541,70 Q 541,85 551,85 L 561,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,100L613,100A15 15 0 0 0 628 85L628,85A15 15 0 0 0 613 70L582,70A15 15 0 0 0 567 85L567,85A15 15 0 0 0 582 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="645,85 633,89 633,81" style="fill:rgb(0,0,0)"/>
<path d="M628,85L639,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="687,17 675,21 675,12" style="fill:rgb(0,0,0)"/>
<path d="M645,85 L 652,85 Q 660,85 660,70 L 660,32 Q 660,17 670,17 L 681,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="690" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M50,70L100,70L100,39L50,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="175,55 163,59 163,50" style="fill:rgb(0,0,0)"/>
<path d="M100,55L169,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M175,55 L 182,55 Q 190,55 190,40 L 190,32 Q 190,17 197,17 L 205,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M175,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,17 586,21 586,12" style="fill:rgb(0,0,0)"/>
<path d="M358,17L592,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,17L675,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,62L599,62A15 15 0 0 0 614 47A15 15 0 0 0 599 32L582,32A15 15 0 0 0 567 47A15 15 0 0 0 582 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="645,47 633,51 633,43" style="fill:rgb(0,0,0)"/>
<path d="M614,47L639,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M645,47 L 652,47 Q 660,47 660,40 L 660,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="567,47 556,51 556,43" style="fill:rgb(0,0,0)"/>
<path d="M541,32 L 541,39 Q 541,47 551,47 L 561,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>


<p>The CREATE INDEX command consists of the keywords "CREATE INDEX" followed
by the name of the new index, the keyword "ON", the name of a previously
created table that is to be indexed, and a parenthesized list of table column
names and/or expressions that are used for the index key.
If the optional WHERE clause is included, then the index is a "<a href="partialindex.html">partial index</a>".
</p>

<p>If the optional IF NOT EXISTS clause is present and another index
with the same name already exists, then this command becomes a no-op.</p>

<p>There are no arbitrary limits on the number of indices that can be
attached to a single table.  The number of columns in an index is 
limited to the value set by
<a href="c3ref/limit.html">sqlite3_limit</a>(<a href="c3ref/c_limit_attached.html#sqlitelimitcolumn">SQLITE_LIMIT_COLUMN</a>,...).</p>

<p>Indexes are removed with the <a href="lang_dropindex.html">DROP INDEX</a> command.</p>

<a name="uniqueidx"></a>

<h2 id="unique_indexes"><span>1.1. </span>Unique Indexes</h2>

<p>If the UNIQUE keyword appears between CREATE and INDEX then duplicate
index entries are not allowed.  Any attempt to insert a duplicate entry
will result in an error.</p>

<p>For the purposes of unique indices, all NULL values
are considered different from all other NULL values and are thus unique.
This is one of the two possible interpretations of the SQL-92 standard
(the language in the standard is ambiguous).  The interpretation used
by SQLite is the same and is the interpretation
followed by PostgreSQL, MySQL, Firebird, and Oracle.  Informix and
Microsoft SQL Server follow the other interpretation of the standard, which
is that all NULL values are equal to one another.</p>

<a name="indexexpr"></a>

<h2 id="indexes_on_expressions"><span>1.2. </span>Indexes on Expressions</h2>

<p>Expressions in an index may not reference other tables
and may not use subqueries nor functions whose result might
change (ex: <a href="lang_corefunc.html#random">random()</a> or <a href="lang_corefunc.html#sqlite_version">sqlite_version()</a>).
Expressions in an index may only refer to columns in the table
that is being indexed.
Indexes on expression will not work with versions of SQLite prior
to <a href="releaselog/3_9_0.html">version 3.9.0</a> (2015-10-14).
See the <a href="expridx.html">Indexes On Expressions</a> document for additional information
about using general expressions in CREATE INDEX statements.

<a name="descidx"></a>

</p><h2 id="descending_indexes"><span>1.3. </span>Descending Indexes</h2>

<p>Each column name or expression can be followed by one
of the "ASC" or "DESC" keywords to indicate sort order.
The sort order may or may not be ignored depending
on the database file format, and in particular the <a href="fileformat2.html#schemaformat">schema format number</a>.
The "legacy" schema format (1) ignores index
sort order.  The descending index schema format (4) takes index sort order
into account.  Only versions of SQLite 3.3.0 (2006-01-11)
and later are able to understand
the descending index format. For compatibility, version of SQLite between 3.3.0
and 3.7.9 use the legacy schema format by default.  The newer schema format is
used by default in version 3.7.10 (2012-01-16) and later.
The <a href="pragma.html#pragma_legacy_file_format">legacy_file_format pragma</a> can be used to change set the specific
behavior for any version of SQLite.</p>

<h2 id="nulls_first_and_nulls_last"><span>1.4. </span>NULLS FIRST and NULLS LAST</h2>

<p>The NULLS FIRST and NULLS LAST predicates are not supported
for indexes.  For <a href="datatype3.html#sortorder">sorting purposes</a>, SQLite considers NULL values 
to be smaller than all other values.  Hence NULL values always appear at
the beginning of an ASC index and at the end of a DESC index.</p>

<a name="collidx"></a>

<h2 id="collations"><span>1.5. </span>Collations</h2>

<p>The COLLATE clause optionally following each column name
or expression defines a
collating sequence used for text entries in that column.
The default collating
sequence is the collating sequence defined for that column in the
<a href="lang_createtable.html">CREATE TABLE</a> statement.  Or if no collating sequence is otherwise defined,
the built-in BINARY collating sequence is used.</p>


Added Doc/Extra/Core/lang_createtable.html.





















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>CREATE TABLE</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
CREATE TABLE
</div>
<div class="fancy_toc">
<a onclick="toggle_toc()">
<span class="fancy_toc_mark" id="toc_mk">&#x25ba;</span>
Table Of Contents
</a>
<div id="toc_sub"><div class="fancy-toc1"><a href="#syntax">1. Syntax</a></div>
<div class="fancy-toc1"><a href="#the_create_table_command">2. The CREATE TABLE command</a></div>
<div class="fancy-toc2"><a href="#create_table_as_select_statements">2.1. CREATE TABLE ... AS SELECT Statements</a></div>
<div class="fancy-toc1"><a href="#column_definitions">3. Column Definitions</a></div>
<div class="fancy-toc2"><a href="#column_data_types">3.1. Column Data Types</a></div>
<div class="fancy-toc2"><a href="#the_default_clause">3.2. The DEFAULT clause</a></div>
<div class="fancy-toc2"><a href="#the_collate_clause">3.3. The COLLATE clause</a></div>
<div class="fancy-toc2"><a href="#the_generated_always_as_clause">3.4. The GENERATED ALWAYS AS clause</a></div>
<div class="fancy-toc2"><a href="#the_primary_key">3.5. The PRIMARY KEY</a></div>
<div class="fancy-toc2"><a href="#unique_constraints">3.6. UNIQUE constraints</a></div>
<div class="fancy-toc2"><a href="#check_constraints">3.7. CHECK constraints</a></div>
<div class="fancy-toc2"><a href="#not_null_constraints">3.8. NOT NULL constraints</a></div>
<div class="fancy-toc1"><a href="#constraint_enforcement">4. Constraint enforcement</a></div>
<div class="fancy-toc2"><a href="#response_to_constraint_violations">4.1. Response to constraint violations</a></div>
<div class="fancy-toc1"><a href="#rowids_and_the_integer_primary_key">5. ROWIDs and the INTEGER PRIMARY KEY</a></div>
</div>
</div>
<script>
function toggle_toc(){
var sub = document.getElementById("toc_sub")
var mk = document.getElementById("toc_mk")
if( sub.style.display!="block" ){
sub.style.display = "block";
mk.innerHTML = "&#x25bc;";
} else {
sub.style.display = "none";
mk.innerHTML = "&#x25ba;";
}
}
</script>
</div>




<h1 id="syntax"><span>1. </span>Syntax</h1>

<p><b><a href="syntax/create-table-stmt.html">create-table-stmt:</a></b>
<button id='x84ad63e8' onclick='hideorshow("x84ad63e8","x403f3401")'>hide</button></p>
 <div id='x403f3401' class='imgcontainer'>
 <div style="max-width:718px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 718.33 315.792">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L100,32A15 15 0 0 0 116 17A15 15 0 0 0 100 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CREATE</text>
<path d="M167,56L199,56A15 15 0 0 0 214 41A15 15 0 0 0 199 26L167,26A15 15 0 0 0 152 41A15 15 0 0 0 167 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMP</text>
<path d="M167,94L259,94A15 15 0 0 0 274 79A15 15 0 0 0 259 64L167,64A15 15 0 0 0 152 79A15 15 0 0 0 167 94Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="213" y="79" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMPORARY</text>
<path d="M325,32L365,32A15 15 0 0 0 380 17A15 15 0 0 0 365 2L325,2A15 15 0 0 0 310 17A15 15 0 0 0 325 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TABLE</text>
<polygon points="213,17 201,21 201,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L207,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="310,17 299,21 299,12" style="fill:rgb(0,0,0)"/>
<path d="M213,17L305,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,41 140,45 140,37" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,29 Q 131,41 138,41 L 146,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,79 140,83 140,74" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,32 L 131,64 Q 131,79 138,79 L 146,79"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M274,79 L 282,79 Q 289,79 289,64 L 289,32 Q 289,17 294,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M214,41 L 274,41 Q 289,41 289,33 L 289,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="416,17 404,21 404,12" style="fill:rgb(0,0,0)"/>
<path d="M380,17L410,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,32A15 15 0 0 0 446 17A15 15 0 0 0 431 2A15 15 0 0 0 416 17A15 15 0 0 0 431 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="431" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="469,17 458,21 458,12" style="fill:rgb(0,0,0)"/>
<path d="M446,17L463,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M484,32L504,32A15 15 0 0 0 520 17A15 15 0 0 0 504 2L484,2A15 15 0 0 0 469 17A15 15 0 0 0 484 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="494" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="543,17 531,21 531,12" style="fill:rgb(0,0,0)"/>
<path d="M520,17L537,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,32L602,32A15 15 0 0 0 617 17A15 15 0 0 0 602 2L558,2A15 15 0 0 0 543 17A15 15 0 0 0 558 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="580" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="213,109 224,105 224,113" style="fill:rgb(0,0,0)"/>
<path d="M380,17 L 387,17 Q 395,17 395,32 L 395,94 Q 395,109 380,109 L 234,109 L 219,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="543,109 554,105 554,113" style="fill:rgb(0,0,0)"/>
<path d="M617,17 L 625,17 Q 632,17 632,32 L 632,94 Q 632,109 617,109 L 563,109 L 548,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M543,109L310,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,147 17,151 17,142" style="fill:rgb(0,0,0)"/>
<path d="M310,109 L 20,109 Q 5,109 5,124 L 5,132 Q 5,147 14,147 L 23,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,162L140,162A15 15 0 0 0 155 147A15 15 0 0 0 140 132L43,132A15 15 0 0 0 28 147A15 15 0 0 0 43 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="178,147 166,151 166,142" style="fill:rgb(0,0,0)"/>
<path d="M155,147L172,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M193,162A15 15 0 0 0 208 147A15 15 0 0 0 193 132A15 15 0 0 0 178 147A15 15 0 0 0 193 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="147" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="244,147 233,151 233,142" style="fill:rgb(0,0,0)"/>
<path d="M208,147L238,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,162L334,162A15 15 0 0 0 350 147A15 15 0 0 0 334 132L259,132A15 15 0 0 0 244 147A15 15 0 0 0 259 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="297" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="92,177 80,181 80,173" style="fill:rgb(0,0,0)"/>
<path d="M5,132 L 5,162 Q 5,177 20,177 L 71,177 L 86,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M92,177 L 205,177 Q 220,177 220,162 L 220,162 Q 220,147 227,147 L 235,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="193,222 205,218 205,227" style="fill:rgb(0,0,0)"/>
<path d="M350,147 L 357,147 Q 365,147 365,162 L 365,207 Q 365,222 350,222 L 214,222 L 199,222"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,260 17,265 17,256" style="fill:rgb(0,0,0)"/>
<path d="M193,222 L 20,222 Q 5,222 5,237 L 5,245 Q 5,260 14,260 L 23,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,275A15 15 0 0 0 59 260A15 15 0 0 0 43 245A15 15 0 0 0 28 260A15 15 0 0 0 43 275Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="43" y="260" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="95,260 83,265 83,256" style="fill:rgb(0,0,0)"/>
<path d="M59,260L89,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,275L199,275L199,245L95,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="147" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-def</text>
<path d="M253,313L399,313L399,283L253,283Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="326" y="298" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-constraint</text>
<polygon points="399,298 410,294 410,302" style="fill:rgb(0,0,0)"/>
<path d="M404,298L416,298"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,313A15 15 0 0 0 446 298A15 15 0 0 0 431 283A15 15 0 0 0 416 298A15 15 0 0 0 431 313Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="431" y="298" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M503,275A15 15 0 0 0 518 260A15 15 0 0 0 503 245A15 15 0 0 0 488 260A15 15 0 0 0 503 275Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="503" y="260" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="553,260 541,265 541,256" style="fill:rgb(0,0,0)"/>
<path d="M518,260L547,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M553,275L674,275L674,245L553,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="613" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-options</text>
<path d="M147,313A15 15 0 0 0 162 298A15 15 0 0 0 147 283A15 15 0 0 0 132 298A15 15 0 0 0 147 313Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="147" y="298" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="162,298 174,294 174,302" style="fill:rgb(0,0,0)"/>
<path d="M199,260 L 207,260 Q 214,260 214,275 L 214,283 Q 214,298 199,298 L 183,298 L 168,298"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,298 L 87,298 Q 72,298 72,283 L 72,275 Q 72,260 77,260 L 83,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="235,260 224,265 224,256" style="fill:rgb(0,0,0)"/>
<path d="M199,260L230,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="488,260 476,265 476,256" style="fill:rgb(0,0,0)"/>
<path d="M235,260L482,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,298 458,294 458,302" style="fill:rgb(0,0,0)"/>
<path d="M446,260 L 458,260 Q 469,260 469,275 L 469,283 Q 469,298 460,298 L 452,298"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M253,298 L 246,298 Q 238,298 238,283 L 238,275 Q 238,260 250,260 L 261,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="613,215 602,219 602,211" style="fill:rgb(0,0,0)"/>
<path d="M518,260 L 526,260 Q 533,260 533,245 L 533,230 Q 533,215 548,215 L 592,215 L 607,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="708,215 697,219 697,211" style="fill:rgb(0,0,0)"/>
<path d="M613,215 L 659,215 Q 674,215 688,215 L 703,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="712" cy="215" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="708,215 697,219 697,211" style="fill:rgb(0,0,0)"/>
<path d="M674,260 L 681,260 Q 689,260 689,245 L 689,230 Q 689,215 696,215 L 703,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="440,147 428,151 428,142" style="fill:rgb(0,0,0)"/>
<path d="M350,147L434,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,162L459,162A15 15 0 0 0 474 147A15 15 0 0 0 459 132L455,132A15 15 0 0 0 440 147A15 15 0 0 0 455 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="457" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="497,147 485,151 485,142" style="fill:rgb(0,0,0)"/>
<path d="M474,147L491,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M497,162L601,162L601,132L497,132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="549" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="637,147 626,151 626,142" style="fill:rgb(0,0,0)"/>
<path d="M601,147L631,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M637,147 L 674,147 Q 689,147 689,162 L 689,200 Q 689,215 696,215 L 704,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/column-def.html">column-def:</a></b>
<button id='x9b77352d' onclick='hideorshow("x9b77352d","xf23b4265")'>show</button></p>
 <div id='xf23b4265' style='display:none;' class='imgcontainer'>
 <div style="max-width:614px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 614.333 64.8">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L141,32A15 15 0 0 0 156 17A15 15 0 0 0 141 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="94" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="179,17 168,21 168,12" style="fill:rgb(0,0,0)"/>
<path d="M156,17L173,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="215,17 204,21 204,12" style="fill:rgb(0,0,0)"/>
<path d="M179,17L209,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,32L314,32L314,2L215,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M314,17L354,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M386,62L550,62L550,32L386,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="468" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-constraint</text>
<polygon points="550,17 539,21 539,12" style="fill:rgb(0,0,0)"/>
<path d="M359,17L545,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="604,17 593,21 593,12" style="fill:rgb(0,0,0)"/>
<path d="M550,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="608" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="265,42 253,47 253,38" style="fill:rgb(0,0,0)"/>
<path d="M179,17 L 187,17 Q 194,17 194,30 Q 194,42 209,42 L 244,42 L 259,42"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,42 L 314,42 Q 329,42 329,30 Q 329,17 337,17 L 344,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="550,47 562,43 562,51" style="fill:rgb(0,0,0)"/>
<path d="M550,17 L 562,17 Q 574,17 574,32 L 574,32 Q 574,47 565,47 L 556,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="399,17 388,21 388,12" style="fill:rgb(0,0,0)"/>
<path d="M386,47 L 375,47 Q 363,47 363,32 L 363,32 Q 363,17 378,17 L 379,17 L 394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/column-constraint.html">column-constraint:</a></b>
<button id='x9a52be8b' onclick='hideorshow("x9a52be8b","x3b7e8a4f")'>show</button></p>
 <div id='x3b7e8a4f' style='display:none;' class='imgcontainer'>
 <div style="max-width:844px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 844.306 578.88">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,40 43,28 51,28" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,25 L 47,34"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L183,32A15 15 0 0 0 198 17A15 15 0 0 0 183 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="133" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONSTRAINT</text>
<polygon points="221,17 210,21 210,12" style="fill:rgb(0,0,0)"/>
<path d="M198,17L215,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,32L263,32A15 15 0 0 0 279 17A15 15 0 0 0 263 2L236,2A15 15 0 0 0 221 17A15 15 0 0 0 236 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="250" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="173,47 185,43 185,51" style="fill:rgb(0,0,0)"/>
<path d="M279,17 L 300,17 Q 315,17 315,32 L 315,32 Q 315,47 300,47 L 194,47 L 179,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M173,47 L 62,47 Q 47,47 47,55 L 47,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,77 58,82 58,73" style="fill:rgb(0,0,0)"/>
<path d="M47,40 L 47,62 Q 47,77 56,77 L 64,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,92L148,92A15 15 0 0 0 163 77A15 15 0 0 0 148 62L85,62A15 15 0 0 0 70 77A15 15 0 0 0 85 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRIMARY</text>
<polygon points="186,77 174,82 174,73" style="fill:rgb(0,0,0)"/>
<path d="M163,77L180,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M201,92L217,92A15 15 0 0 0 233 77A15 15 0 0 0 217 62L201,62A15 15 0 0 0 186 77A15 15 0 0 0 201 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">KEY</text>
<polygon points="271,138 259,142 259,133" style="fill:rgb(0,0,0)"/>
<path d="M233,77 L 240,77 Q 248,77 248,92 L 248,123 Q 248,138 256,138 L 265,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M286,153L316,153A15 15 0 0 0 331 138A15 15 0 0 0 316 123L286,123A15 15 0 0 0 271 138A15 15 0 0 0 286 153Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="301" y="138" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="354,138 343,142 343,133" style="fill:rgb(0,0,0)"/>
<path d="M331,138L348,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,77 381,82 381,73" style="fill:rgb(0,0,0)"/>
<path d="M354,138 L 362,138 Q 369,138 369,123 L 369,92 Q 369,77 378,77 L 386,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M392,92L525,92L525,62L392,62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="459" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">conflict-clause</text>
<polygon points="549,77 537,82 537,73" style="fill:rgb(0,0,0)"/>
<path d="M525,77L543,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="587,108 575,112 575,103" style="fill:rgb(0,0,0)"/>
<path d="M549,77 L 556,77 Q 564,77 564,92 L 564,93 Q 564,108 572,108 L 581,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M602,123L745,123A15 15 0 0 0 760 108A15 15 0 0 0 745 92L602,92A15 15 0 0 0 587 108A15 15 0 0 0 602 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="673" y="108" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AUTOINCREMENT</text>
<polygon points="783,108 772,112 772,103" style="fill:rgb(0,0,0)"/>
<path d="M760,108L778,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="834,77 823,82 823,73" style="fill:rgb(0,0,0)"/>
<path d="M783,108 L 791,108 Q 798,108 798,93 L 798,92 Q 798,77 813,77 L 814,77 L 829,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="838" cy="77" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="673,77 662,82 662,73" style="fill:rgb(0,0,0)"/>
<path d="M549,77L668,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M673,77L827,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="301,77 289,82 289,73" style="fill:rgb(0,0,0)"/>
<path d="M233,77L295,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,77L381,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="271,100 259,104 259,96" style="fill:rgb(0,0,0)"/>
<path d="M233,77 L 240,77 Q 248,77 248,89 Q 248,100 256,100 L 265,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M286,115L302,115A15 15 0 0 0 318 100A15 15 0 0 0 302 85L286,85A15 15 0 0 0 271 100A15 15 0 0 0 286 115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="294" y="100" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="354,100 343,104 343,96" style="fill:rgb(0,0,0)"/>
<path d="M318,100L348,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,100 L 362,100 Q 369,100 369,92 L 369,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,183 58,187 58,179" style="fill:rgb(0,0,0)"/>
<path d="M47,62 L 47,168 Q 47,183 56,183 L 64,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,198L105,198A15 15 0 0 0 120 183A15 15 0 0 0 105 168L85,168A15 15 0 0 0 70 183A15 15 0 0 0 85 198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="95" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="143,183 132,187 132,179" style="fill:rgb(0,0,0)"/>
<path d="M120,183L138,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,198L190,198A15 15 0 0 0 205 183A15 15 0 0 0 190 168L158,168A15 15 0 0 0 143 183A15 15 0 0 0 158 198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="174" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="228,183 216,187 216,179" style="fill:rgb(0,0,0)"/>
<path d="M205,183L222,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,198L361,198L361,168L228,168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="294" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">conflict-clause</text>
<polygon points="783,183 772,187 772,179" style="fill:rgb(0,0,0)"/>
<path d="M361,183L778,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,183 L 791,183 Q 798,183 798,168 L 798,107 L 798,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,221 58,225 58,217" style="fill:rgb(0,0,0)"/>
<path d="M47,168 L 47,206 Q 47,221 56,221 L 64,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,236L140,236A15 15 0 0 0 155 221A15 15 0 0 0 140 206L85,206A15 15 0 0 0 70 221A15 15 0 0 0 85 236Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="113" y="221" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNIQUE</text>
<polygon points="178,221 167,225 167,217" style="fill:rgb(0,0,0)"/>
<path d="M155,221L172,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M178,236L311,236L311,206L178,206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="245" y="221" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">conflict-clause</text>
<polygon points="783,221 772,225 772,217" style="fill:rgb(0,0,0)"/>
<path d="M311,221L778,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,221 L 791,221 Q 798,221 798,206 L 798,183 L 798,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,259 58,263 58,254" style="fill:rgb(0,0,0)"/>
<path d="M47,206 L 47,244 Q 47,259 56,259 L 64,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,274L131,274A15 15 0 0 0 146 259A15 15 0 0 0 131 244L85,244A15 15 0 0 0 70 259A15 15 0 0 0 85 274Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="259" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CHECK</text>
<polygon points="169,259 157,263 157,254" style="fill:rgb(0,0,0)"/>
<path d="M146,259L163,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M184,274A15 15 0 0 0 199 259A15 15 0 0 0 184 244A15 15 0 0 0 169 259A15 15 0 0 0 184 274Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="259" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="222,259 210,263 210,254" style="fill:rgb(0,0,0)"/>
<path d="M199,259L216,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,274L271,274L271,244L222,244Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="259" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="294,259 283,263 283,254" style="fill:rgb(0,0,0)"/>
<path d="M271,259L288,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,274A15 15 0 0 0 324 259A15 15 0 0 0 309 244A15 15 0 0 0 294 259A15 15 0 0 0 309 274Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="309" y="259" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="783,259 772,263 772,254" style="fill:rgb(0,0,0)"/>
<path d="M324,259L778,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,259 L 791,259 Q 798,259 798,244 L 798,221 L 798,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,297 58,301 58,292" style="fill:rgb(0,0,0)"/>
<path d="M47,244 L 47,282 Q 47,297 56,297 L 64,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,312L150,312A15 15 0 0 0 166 297A15 15 0 0 0 150 281L85,281A15 15 0 0 0 70 297A15 15 0 0 0 85 312Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="118" y="297" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFAULT</text>
<polygon points="189,297 177,301 177,292" style="fill:rgb(0,0,0)"/>
<path d="M166,297L183,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="225,297 213,301 213,292" style="fill:rgb(0,0,0)"/>
<path d="M189,297L219,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,312A15 15 0 0 0 255 297A15 15 0 0 0 240 281A15 15 0 0 0 225 297A15 15 0 0 0 240 312Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="240" y="297" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="278,297 266,301 266,292" style="fill:rgb(0,0,0)"/>
<path d="M255,297L272,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,312L327,312L327,281L278,281Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="297" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="350,297 339,301 339,292" style="fill:rgb(0,0,0)"/>
<path d="M327,297L344,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,312A15 15 0 0 0 380 297A15 15 0 0 0 365 281A15 15 0 0 0 350 297A15 15 0 0 0 365 312Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="297" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="783,297 772,301 772,292" style="fill:rgb(0,0,0)"/>
<path d="M380,297L778,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,297 L 791,297 Q 798,297 798,282 L 798,259 L 798,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="227,334 215,339 215,330" style="fill:rgb(0,0,0)"/>
<path d="M189,297 L 196,297 Q 204,297 204,312 L 204,319 Q 204,334 212,334 L 221,334"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M227,349L340,349L340,319L227,319Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="283" y="334" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="363,334 351,339 351,330" style="fill:rgb(0,0,0)"/>
<path d="M340,334L357,334"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,334 L 395,334 Q 410,334 410,319 L 410,312 Q 410,297 425,297 L 431,297 L 446,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="227,372 215,376 215,368" style="fill:rgb(0,0,0)"/>
<path d="M189,297 L 196,297 Q 204,297 204,312 L 204,357 Q 204,372 212,372 L 221,372"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M227,387L364,387L364,357L227,357Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="372" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="387,372 376,376 376,368" style="fill:rgb(0,0,0)"/>
<path d="M364,372L382,372"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M387,372 L 399,372 Q 410,372 410,357 L 410,312 Q 410,297 425,297 L 431,297 L 446,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,410 58,414 58,406" style="fill:rgb(0,0,0)"/>
<path d="M47,281 L 47,395 Q 47,410 56,410 L 64,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,425L149,425A15 15 0 0 0 164 410A15 15 0 0 0 149 395L85,395A15 15 0 0 0 70 410A15 15 0 0 0 85 425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="117" y="410" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="187,410 176,414 176,406" style="fill:rgb(0,0,0)"/>
<path d="M164,410L182,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M202,425L308,425A15 15 0 0 0 323 410A15 15 0 0 0 308 395L202,395A15 15 0 0 0 187 410A15 15 0 0 0 202 425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="255" y="410" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="783,410 772,414 772,406" style="fill:rgb(0,0,0)"/>
<path d="M323,410L778,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,410 L 791,410 Q 798,410 798,395 L 798,296 L 798,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,448 58,452 58,443" style="fill:rgb(0,0,0)"/>
<path d="M47,395 L 47,433 Q 47,448 56,448 L 64,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,463L236,463L236,433L70,433Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="448" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">foreign-key-clause</text>
<polygon points="783,448 772,452 772,443" style="fill:rgb(0,0,0)"/>
<path d="M236,448L778,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,448 L 791,448 Q 798,448 798,433 L 798,410 L 798,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,486 58,490 58,481" style="fill:rgb(0,0,0)"/>
<path d="M47,433 L 47,471 Q 47,486 56,486 L 64,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,501L178,501A15 15 0 0 0 193 486A15 15 0 0 0 178 470L85,470A15 15 0 0 0 70 486A15 15 0 0 0 85 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="131" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GENERATED</text>
<polygon points="216,486 204,490 204,481" style="fill:rgb(0,0,0)"/>
<path d="M193,486L210,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M231,501L286,501A15 15 0 0 0 301 486A15 15 0 0 0 286 470L231,470A15 15 0 0 0 216 486A15 15 0 0 0 231 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALWAYS</text>
<polygon points="337,486 325,490 325,481" style="fill:rgb(0,0,0)"/>
<path d="M301,486L331,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M352,501L356,501A15 15 0 0 0 371 486A15 15 0 0 0 356 470L352,470A15 15 0 0 0 337 486A15 15 0 0 0 352 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="354" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="394,486 382,490 382,481" style="fill:rgb(0,0,0)"/>
<path d="M371,486L388,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,501A15 15 0 0 0 424 486A15 15 0 0 0 409 470A15 15 0 0 0 394 486A15 15 0 0 0 409 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="486" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="447,486 436,490 436,481" style="fill:rgb(0,0,0)"/>
<path d="M424,486L441,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M447,501L496,501L496,470L447,470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="472" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="519,486 508,490 508,481" style="fill:rgb(0,0,0)"/>
<path d="M496,486L514,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,501A15 15 0 0 0 550 486A15 15 0 0 0 535 470A15 15 0 0 0 519 486A15 15 0 0 0 535 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="535" y="486" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="783,486 772,490 772,481" style="fill:rgb(0,0,0)"/>
<path d="M550,486L778,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,486 L 791,486 Q 798,486 798,471 L 798,448 L 798,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="185,516 174,520 174,511" style="fill:rgb(0,0,0)"/>
<path d="M47,470 L 47,501 Q 47,516 62,516 L 165,516 L 180,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M185,516 L 297,516 Q 312,516 312,501 L 312,501 Q 312,486 320,486 L 327,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="596,561 584,565 584,557" style="fill:rgb(0,0,0)"/>
<path d="M550,486 L 561,486 Q 573,486 573,501 L 573,546 Q 573,561 581,561 L 590,561"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M611,576L670,576A15 15 0 0 0 686 561A15 15 0 0 0 670 546L611,546A15 15 0 0 0 596 561A15 15 0 0 0 611 576Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="641" y="561" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VIRTUAL</text>
<polygon points="783,561 772,565 772,557" style="fill:rgb(0,0,0)"/>
<path d="M686,561L778,561"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,561 L 791,561 Q 798,561 798,546 L 798,485 L 798,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="596,523 584,528 584,519" style="fill:rgb(0,0,0)"/>
<path d="M550,486 L 561,486 Q 573,486 573,501 L 573,508 Q 573,523 581,523 L 590,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M611,538L665,538A15 15 0 0 0 680 523A15 15 0 0 0 665 508L611,508A15 15 0 0 0 596 523A15 15 0 0 0 611 538Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="638" y="523" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">STORED</text>
<polygon points="783,523 772,528 772,519" style="fill:rgb(0,0,0)"/>
<path d="M680,523L778,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,523 L 791,523 Q 798,523 798,516 L 798,508"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/conflict-clause.html">conflict-clause:</a></b>
<button id='xd547a6a3' onclick='hideorshow("xd547a6a3","x806f2005")'>show</button></p>
 <div id='x806f2005' style='display:none;' class='imgcontainer'>
 <div style="max-width:451px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 451.517 205.2">
<circle cx="5" cy="6" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,6 20,10 20,2" style="fill:rgb(0,0,0)"/>
<path d="M9,6L26,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,36 58,41 58,32" style="fill:rgb(0,0,0)"/>
<path d="M32,6 L 39,6 Q 47,6 47,21 L 47,21 Q 47,36 56,36 L 64,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,51L94,51A15 15 0 0 0 109 36L109,36A15 15 0 0 0 94 21L85,21A15 15 0 0 0 70 36L70,36A15 15 0 0 0 85 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="90" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="132,36 121,41 121,32" style="fill:rgb(0,0,0)"/>
<path d="M109,36L126,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M147,51L222,51A15 15 0 0 0 237 36L237,36A15 15 0 0 0 222 21L147,21A15 15 0 0 0 132 36L132,36A15 15 0 0 0 147 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONFLICT</text>
<polygon points="273,36 261,41 261,32" style="fill:rgb(0,0,0)"/>
<path d="M237,36L267,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,51L365,51A15 15 0 0 0 381 36L381,36A15 15 0 0 0 365 21L288,21A15 15 0 0 0 273 36L273,36A15 15 0 0 0 288 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="327" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<path d="M288,89L330,89A15 15 0 0 0 345 74L345,74A15 15 0 0 0 330 59L288,59A15 15 0 0 0 273 74L273,74A15 15 0 0 0 288 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="309" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<path d="M288,127L310,127A15 15 0 0 0 325 112A15 15 0 0 0 310 97L288,97A15 15 0 0 0 273 112A15 15 0 0 0 288 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<path d="M288,165L340,165A15 15 0 0 0 355 150A15 15 0 0 0 340 135L288,135A15 15 0 0 0 273 150A15 15 0 0 0 288 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="314" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<path d="M288,203L352,203A15 15 0 0 0 367 187A15 15 0 0 0 352 172L288,172A15 15 0 0 0 273 187A15 15 0 0 0 288 203Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="320" y="187" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<polygon points="404,36 392,41 392,32" style="fill:rgb(0,0,0)"/>
<path d="M381,36L398,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="442,6 430,10 430,2" style="fill:rgb(0,0,0)"/>
<path d="M404,36 L 411,36 Q 419,36 419,21 L 419,21 Q 419,6 427,6 L 436,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="445" cy="6" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="225,6 214,10 214,2" style="fill:rgb(0,0,0)"/>
<path d="M9,6L219,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,6L434,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,187 261,192 261,183" style="fill:rgb(0,0,0)"/>
<path d="M237,36 L 244,36 Q 252,36 252,51 L 252,172 Q 252,187 259,187 L 267,187"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,187 392,192 392,183" style="fill:rgb(0,0,0)"/>
<path d="M367,187L398,187"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,187 L 411,187 Q 419,187 419,172 L 419,36 L 419,21"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,74 261,78 261,70" style="fill:rgb(0,0,0)"/>
<path d="M252,59 L 252,66 Q 252,74 259,74 L 267,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,74 392,78 392,70" style="fill:rgb(0,0,0)"/>
<path d="M345,74L398,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,74 L 411,74 Q 419,74 419,67 L 419,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,112 261,116 261,108" style="fill:rgb(0,0,0)"/>
<path d="M252,97 L 252,104 Q 252,112 259,112 L 267,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,112 392,116 392,108" style="fill:rgb(0,0,0)"/>
<path d="M325,112L398,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,112 L 411,112 Q 419,112 419,104 L 419,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,150 261,154 261,145" style="fill:rgb(0,0,0)"/>
<path d="M252,135 L 252,142 Q 252,150 259,150 L 267,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,150 392,154 392,145" style="fill:rgb(0,0,0)"/>
<path d="M355,150L398,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,150 L 411,150 Q 419,150 419,142 L 419,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/expr.html">expr:</a></b>
<button id='x632ce6c9' onclick='hideorshow("x632ce6c9","x3a66457f")'>show</button></p>
 <div id='x3a66457f' style='display:none;' class='imgcontainer'>
 <div style="max-width:963px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 963.96 1068.77">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L158,32L158,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="101" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="954,17 943,21 943,12" style="fill:rgb(0,0,0)"/>
<path d="M158,17L948,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="958" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L172,70A15 15 0 0 0 187 55L187,55A15 15 0 0 0 172 39L60,39A15 15 0 0 0 45 55L45,55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">bind-parameter</text>
<polygon points="916,55 905,59 905,50" style="fill:rgb(0,0,0)"/>
<path d="M187,55L910,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,55 L 924,55 Q 931,55 931,47 L 931,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 31,55 L 39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,130L156,130A15 15 0 0 0 171 115A15 15 0 0 0 156 100L60,100A15 15 0 0 0 45 115A15 15 0 0 0 60 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,115 183,119 183,111" style="fill:rgb(0,0,0)"/>
<path d="M171,115L189,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,130A15 15 0 0 0 225 115A15 15 0 0 0 210 100A15 15 0 0 0 195 115A15 15 0 0 0 210 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M225,115L255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130L351,130A15 15 0 0 0 366 115A15 15 0 0 0 351 100L276,100A15 15 0 0 0 261 115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="389,115 378,119 378,111" style="fill:rgb(0,0,0)"/>
<path d="M366,115L383,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,130A15 15 0 0 0 419 115A15 15 0 0 0 404 100A15 15 0 0 0 389 115A15 15 0 0 0 404 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="404" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="455,115 444,119 444,111" style="fill:rgb(0,0,0)"/>
<path d="M419,115L450,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,130L565,130A15 15 0 0 0 580 115A15 15 0 0 0 565 100L471,100A15 15 0 0 0 455 115A15 15 0 0 0 471 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="916,115 905,119 905,111" style="fill:rgb(0,0,0)"/>
<path d="M580,115L910,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,115 L 924,115 Q 931,115 931,108 L 931,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,115 33,119 33,111" style="fill:rgb(0,0,0)"/>
<path d="M24,100 L 24,108 Q 24,115 31,115 L 39,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,89 97,93 97,84" style="fill:rgb(0,0,0)"/>
<path d="M24,74 L 24,81 Q 24,89 39,89 L 87,89 L 102,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 302,93 302,84" style="fill:rgb(0,0,0)"/>
<path d="M108,89 L 129,89 Q 144,89 159,89 L 293,89 L 308,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,89 L 414,89 Q 429,89 429,102 Q 429,115 436,115 L 444,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M223,89 L 230,89 Q 238,89 238,102 Q 238,115 245,115 L 253,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,168L168,168A15 15 0 0 0 183 153A15 15 0 0 0 168 138L60,138A15 15 0 0 0 45 153A15 15 0 0 0 60 168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">unary-operator</text>
<polygon points="206,153 194,157 194,149" style="fill:rgb(0,0,0)"/>
<path d="M183,153L200,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,168L255,168L255,138L206,138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,153 905,157 905,149" style="fill:rgb(0,0,0)"/>
<path d="M255,153L910,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,153 L 924,153 Q 931,153 931,145 L 931,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,153 33,157 33,149" style="fill:rgb(0,0,0)"/>
<path d="M24,138 L 24,145 Q 24,153 31,153 L 39,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,206L94,206L94,176L45,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,191 106,195 106,186" style="fill:rgb(0,0,0)"/>
<path d="M94,191L111,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,206L245,206A15 15 0 0 0 261 191A15 15 0 0 0 245 176L132,176A15 15 0 0 0 117 191A15 15 0 0 0 132 206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">binary-operator</text>
<polygon points="284,191 272,195 272,186" style="fill:rgb(0,0,0)"/>
<path d="M261,191L278,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,206L333,206L333,176L284,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="308" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,191 905,195 905,186" style="fill:rgb(0,0,0)"/>
<path d="M333,191L910,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,191 L 924,191 Q 931,191 931,183 L 931,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,191 33,195 33,186" style="fill:rgb(0,0,0)"/>
<path d="M24,176 L 24,183 Q 24,191 31,191 L 39,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,245L162,245A15 15 0 0 0 177 230A15 15 0 0 0 162 215L60,215A15 15 0 0 0 45 230A15 15 0 0 0 60 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="111" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-name</text>
<polygon points="194,230 183,234 183,226" style="fill:rgb(0,0,0)"/>
<path d="M177,230L188,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,245A15 15 0 0 0 224 230A15 15 0 0 0 209 215A15 15 0 0 0 194 230A15 15 0 0 0 209 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="260,230 249,234 249,226" style="fill:rgb(0,0,0)"/>
<path d="M224,230L255,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,245L437,245L437,215L260,215Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-arguments</text>
<polygon points="473,230 461,234 461,226" style="fill:rgb(0,0,0)"/>
<path d="M437,230L467,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,245A15 15 0 0 0 503 230A15 15 0 0 0 488 215A15 15 0 0 0 473 230A15 15 0 0 0 488 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="541,260 529,265 529,256" style="fill:rgb(0,0,0)"/>
<path d="M503,230 L 510,230 Q 518,230 518,245 L 518,245 Q 518,260 527,260 L 535,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,275L653,275L653,245L541,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="691,230 680,234 680,226" style="fill:rgb(0,0,0)"/>
<path d="M653,260 L 661,260 Q 668,260 668,245 L 668,245 Q 668,230 677,230 L 685,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="729,260 718,265 718,256" style="fill:rgb(0,0,0)"/>
<path d="M691,230 L 699,230 Q 706,230 706,245 L 706,245 Q 706,260 715,260 L 723,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,275L837,275L837,245L729,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="783" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">over-clause</text>
<polygon points="916,260 905,265 905,256" style="fill:rgb(0,0,0)"/>
<path d="M837,260L910,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,260 L 924,260 Q 931,260 931,253 L 931,245"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,230 33,234 33,226" style="fill:rgb(0,0,0)"/>
<path d="M24,215 L 24,222 Q 24,230 31,230 L 39,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,230 585,234 585,226" style="fill:rgb(0,0,0)"/>
<path d="M503,230L591,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,230L680,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,230 905,234 905,226" style="fill:rgb(0,0,0)"/>
<path d="M691,230L910,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,230 L 924,230 Q 931,230 931,222 L 931,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,321A15 15 0 0 0 75 306A15 15 0 0 0 60 290A15 15 0 0 0 45 306A15 15 0 0 0 60 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,306 100,310 100,301" style="fill:rgb(0,0,0)"/>
<path d="M75,306L105,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M111,321L160,321L160,290L111,290Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="306" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="196,306 185,310 185,301" style="fill:rgb(0,0,0)"/>
<path d="M160,306L191,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,321A15 15 0 0 0 227 306A15 15 0 0 0 211 290A15 15 0 0 0 196 306A15 15 0 0 0 211 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,306 905,310 905,301" style="fill:rgb(0,0,0)"/>
<path d="M227,306L910,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,306 L 924,306 Q 931,306 931,298 L 931,291"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,306 33,310 33,301" style="fill:rgb(0,0,0)"/>
<path d="M24,290 L 24,298 Q 24,306 31,306 L 39,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,284A15 15 0 0 0 151 269A15 15 0 0 0 136 254A15 15 0 0 0 121 269A15 15 0 0 0 136 284Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="269" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="151,269 162,265 162,274" style="fill:rgb(0,0,0)"/>
<path d="M160,306 L 168,306 Q 175,306 175,291 L 175,284 Q 175,269 166,269 L 157,269"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,269 L 103,269 Q 88,269 88,284 L 88,291 Q 88,306 96,306 L 103,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,358L88,358A15 15 0 0 0 103 343A15 15 0 0 0 88 328L60,328A15 15 0 0 0 45 343A15 15 0 0 0 60 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CAST</text>
<polygon points="126,343 114,348 114,339" style="fill:rgb(0,0,0)"/>
<path d="M103,343L120,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M141,358A15 15 0 0 0 156 343A15 15 0 0 0 141 328A15 15 0 0 0 126 343A15 15 0 0 0 141 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="179,343 168,348 168,339" style="fill:rgb(0,0,0)"/>
<path d="M156,343L173,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,358L228,358L228,328L179,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="251,343 240,348 240,339" style="fill:rgb(0,0,0)"/>
<path d="M228,343L246,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,358L271,358A15 15 0 0 0 286 343A15 15 0 0 0 271 328L267,328A15 15 0 0 0 251 343A15 15 0 0 0 267 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="269" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="309,343 297,348 297,339" style="fill:rgb(0,0,0)"/>
<path d="M286,343L303,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,358L408,358L408,328L309,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="358" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="431,343 419,348 419,339" style="fill:rgb(0,0,0)"/>
<path d="M408,343L425,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M446,358A15 15 0 0 0 461 343A15 15 0 0 0 446 328A15 15 0 0 0 431 343A15 15 0 0 0 446 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,343 905,348 905,339" style="fill:rgb(0,0,0)"/>
<path d="M461,343L910,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,343 L 924,343 Q 931,343 931,336 L 931,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,343 33,348 33,339" style="fill:rgb(0,0,0)"/>
<path d="M24,328 L 24,336 Q 24,343 31,343 L 39,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,396L94,396L94,366L45,366Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,381 106,385 106,377" style="fill:rgb(0,0,0)"/>
<path d="M94,381L111,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,396L196,396A15 15 0 0 0 211 381A15 15 0 0 0 196 366L132,366A15 15 0 0 0 117 381A15 15 0 0 0 132 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="234,381 223,385 223,377" style="fill:rgb(0,0,0)"/>
<path d="M211,381L229,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,396L355,396A15 15 0 0 0 370 381A15 15 0 0 0 355 366L250,366A15 15 0 0 0 234 381A15 15 0 0 0 250 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="916,381 905,385 905,377" style="fill:rgb(0,0,0)"/>
<path d="M370,381L910,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,381 L 924,381 Q 931,381 931,374 L 931,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,381 33,385 33,377" style="fill:rgb(0,0,0)"/>
<path d="M24,366 L 24,374 Q 24,381 31,381 L 39,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,434L94,434L94,404L45,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,419 119,423 119,415" style="fill:rgb(0,0,0)"/>
<path d="M94,419L124,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,434L165,434A15 15 0 0 0 180 419A15 15 0 0 0 165 404L145,404A15 15 0 0 0 130 419A15 15 0 0 0 145 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="234,419 223,423 223,415" style="fill:rgb(0,0,0)"/>
<path d="M180,419L229,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,434L273,434A15 15 0 0 0 288 419A15 15 0 0 0 273 404L250,404A15 15 0 0 0 234 419A15 15 0 0 0 250 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIKE</text>
<path d="M250,472L279,472A15 15 0 0 0 294 457A15 15 0 0 0 279 442L250,442A15 15 0 0 0 234 457A15 15 0 0 0 250 472Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="457" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GLOB</text>
<path d="M250,510L302,510A15 15 0 0 0 317 495A15 15 0 0 0 302 479L250,479A15 15 0 0 0 234 495A15 15 0 0 0 250 510Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REGEXP</text>
<path d="M250,547L297,547A15 15 0 0 0 313 532A15 15 0 0 0 297 517L250,517A15 15 0 0 0 234 532A15 15 0 0 0 250 547Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="274" y="532" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<path d="M378,510L427,510L427,479L378,479Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M378,434L427,434L427,404L378,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="465,449 454,454 454,445" style="fill:rgb(0,0,0)"/>
<path d="M427,419 L 435,419 Q 442,419 442,434 L 442,434 Q 442,449 451,449 L 460,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,464L532,464A15 15 0 0 0 547 449A15 15 0 0 0 532 434L480,434A15 15 0 0 0 465 449A15 15 0 0 0 480 464Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="506" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ESCAPE</text>
<polygon points="570,449 559,454 559,445" style="fill:rgb(0,0,0)"/>
<path d="M547,449L565,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M570,464L620,464L620,434L570,434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="595" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="671,419 659,423 659,415" style="fill:rgb(0,0,0)"/>
<path d="M620,449 L 627,449 Q 635,449 635,434 L 635,434 Q 635,419 650,419 L 650,419 L 665,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,419 905,423 905,415" style="fill:rgb(0,0,0)"/>
<path d="M671,419L910,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,419 L 924,419 Q 931,419 931,411 L 931,404"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,419 33,423 33,415" style="fill:rgb(0,0,0)"/>
<path d="M24,404 L 24,411 Q 24,419 31,419 L 39,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M100,419 L 108,419 Q 115,419 115,434 L 115,434 Q 115,449 130,449 L 177,449 Q 192,449 192,434 L 192,434 Q 192,419 199,419 L 207,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,532 223,537 223,528" style="fill:rgb(0,0,0)"/>
<path d="M196,419 L 204,419 Q 211,419 211,434 L 211,517 Q 211,532 220,532 L 229,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,457 223,461 223,452" style="fill:rgb(0,0,0)"/>
<path d="M211,442 L 211,449 Q 211,457 220,457 L 229,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,495 223,499 223,490" style="fill:rgb(0,0,0)"/>
<path d="M211,479 L 211,487 Q 211,495 220,495 L 229,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,419 367,423 367,415" style="fill:rgb(0,0,0)"/>
<path d="M288,419L372,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,532 329,537 329,528" style="fill:rgb(0,0,0)"/>
<path d="M313,532L334,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,495 367,499 367,490" style="fill:rgb(0,0,0)"/>
<path d="M340,532 L 348,532 Q 355,532 355,517 L 355,510 Q 355,495 364,495 L 372,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,495 329,499 329,490" style="fill:rgb(0,0,0)"/>
<path d="M317,495L334,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,495L378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,457 329,461 329,452" style="fill:rgb(0,0,0)"/>
<path d="M294,457L334,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,457 L 348,457 Q 355,457 355,472 L 355,480 Q 355,495 367,495 L 378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="506,419 495,423 495,415" style="fill:rgb(0,0,0)"/>
<path d="M427,419L501,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M506,419L659,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="547,495 536,499 536,490" style="fill:rgb(0,0,0)"/>
<path d="M427,495L542,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,495 L 656,495 Q 671,495 671,480 L 671,434 Q 671,419 686,419 L 692,419 L 707,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,585L94,585L94,555L45,555Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,570 119,574 119,566" style="fill:rgb(0,0,0)"/>
<path d="M94,570L124,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,585L194,585A15 15 0 0 0 209 570A15 15 0 0 0 194 555L145,555A15 15 0 0 0 130 570A15 15 0 0 0 145 585Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="170" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ISNULL</text>
<polygon points="916,570 905,574 905,566" style="fill:rgb(0,0,0)"/>
<path d="M209,570L910,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,570 L 924,570 Q 931,570 931,563 L 931,555"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,570 33,574 33,566" style="fill:rgb(0,0,0)"/>
<path d="M24,555 L 24,563 Q 24,570 31,570 L 39,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,623L215,623A15 15 0 0 0 230 608A15 15 0 0 0 215 593L145,593A15 15 0 0 0 130 608A15 15 0 0 0 145 623Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="608" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTNULL</text>
<path d="M145,661L165,661A15 15 0 0 0 180 646A15 15 0 0 0 165 631L145,631A15 15 0 0 0 130 646A15 15 0 0 0 145 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="203,646 192,650 192,641" style="fill:rgb(0,0,0)"/>
<path d="M180,646L198,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,661L250,661A15 15 0 0 0 265 646A15 15 0 0 0 250 631L219,631A15 15 0 0 0 203 646A15 15 0 0 0 219 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="288,646 276,650 276,641" style="fill:rgb(0,0,0)"/>
<path d="M265,646L282,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="339,570 327,574 327,566" style="fill:rgb(0,0,0)"/>
<path d="M288,646 L 295,646 Q 303,646 303,631 L 303,585 Q 303,570 318,570 L 318,570 L 333,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="288,608 276,612 276,604" style="fill:rgb(0,0,0)"/>
<path d="M230,608L282,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,608 L 295,608 Q 303,608 303,600 L 303,593"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,646 119,650 119,641" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,631 Q 109,646 117,646 L 124,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,608 119,612 119,604" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,593 Q 109,608 117,608 L 124,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,699L94,699L94,668L45,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,684 106,688 106,679" style="fill:rgb(0,0,0)"/>
<path d="M94,684L111,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,699A15 15 0 0 0 147 684A15 15 0 0 0 132 668A15 15 0 0 0 117 684A15 15 0 0 0 132 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IS</text>
<polygon points="183,684 172,688 172,679" style="fill:rgb(0,0,0)"/>
<path d="M147,684L178,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M198,699L219,699A15 15 0 0 0 234 684A15 15 0 0 0 219 668L198,668A15 15 0 0 0 183 684A15 15 0 0 0 198 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="270,684 258,688 258,679" style="fill:rgb(0,0,0)"/>
<path d="M234,684L264,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="306,684 294,688 294,679" style="fill:rgb(0,0,0)"/>
<path d="M270,684L300,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,699L389,699A15 15 0 0 0 404 684A15 15 0 0 0 389 668L321,668A15 15 0 0 0 306 684A15 15 0 0 0 321 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="440,684 429,688 429,679" style="fill:rgb(0,0,0)"/>
<path d="M404,684L434,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,699L490,699A15 15 0 0 0 505 684A15 15 0 0 0 490 668L455,668A15 15 0 0 0 440 684A15 15 0 0 0 455 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="541,684 530,688 530,679" style="fill:rgb(0,0,0)"/>
<path d="M505,684L535,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,699L590,699L590,668L541,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,684 905,688 905,679" style="fill:rgb(0,0,0)"/>
<path d="M590,684L910,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,684 L 924,684 Q 931,684 931,676 L 931,669"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,684 33,688 33,679" style="fill:rgb(0,0,0)"/>
<path d="M24,668 L 24,676 Q 24,684 31,684 L 39,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,684 L 156,684 Q 164,684 164,696 Q 164,708 179,708 L 230,708 Q 245,708 245,696 Q 245,684 253,684 L 260,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,684 L 279,684 Q 286,684 286,696 Q 286,708 301,708 L 502,708 Q 517,708 517,696 Q 517,684 524,684 L 532,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,744L94,744L94,714L45,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,729 119,733 119,725" style="fill:rgb(0,0,0)"/>
<path d="M94,729L124,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,744L165,744A15 15 0 0 0 180 729A15 15 0 0 0 165 714L145,714A15 15 0 0 0 130 729A15 15 0 0 0 145 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,729 205,733 205,725" style="fill:rgb(0,0,0)"/>
<path d="M180,729L211,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,744L304,744A15 15 0 0 0 319 729A15 15 0 0 0 304 714L232,714A15 15 0 0 0 216 729A15 15 0 0 0 232 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="342,729 331,733 331,725" style="fill:rgb(0,0,0)"/>
<path d="M319,729L336,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M342,744L391,744L391,714L342,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="367" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="414,729 403,733 403,725" style="fill:rgb(0,0,0)"/>
<path d="M391,729L409,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M430,744L450,744A15 15 0 0 0 465 729A15 15 0 0 0 450 714L430,714A15 15 0 0 0 414 729A15 15 0 0 0 430 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="488,729 477,733 477,725" style="fill:rgb(0,0,0)"/>
<path d="M465,729L483,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,744L538,744L538,714L488,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="513" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,729 905,733 905,725" style="fill:rgb(0,0,0)"/>
<path d="M538,729L910,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,729 L 924,729 Q 931,729 931,721 L 931,714"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,729 33,733 33,725" style="fill:rgb(0,0,0)"/>
<path d="M24,714 L 24,721 Q 24,729 31,729 L 39,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,729 L 103,729 Q 110,729 110,741 Q 110,753 125,753 L 177,753 Q 192,753 192,741 Q 192,729 199,729 L 207,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,797L94,797L94,767L45,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,782 119,786 119,778" style="fill:rgb(0,0,0)"/>
<path d="M94,782L124,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,797L165,797A15 15 0 0 0 180 782A15 15 0 0 0 165 767L145,767A15 15 0 0 0 130 782A15 15 0 0 0 145 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,782 205,786 205,778" style="fill:rgb(0,0,0)"/>
<path d="M180,782L211,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,797L234,797A15 15 0 0 0 249 782A15 15 0 0 0 234 767L232,767A15 15 0 0 0 216 782A15 15 0 0 0 232 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IN</text>
<polygon points="285,782 273,786 273,778" style="fill:rgb(0,0,0)"/>
<path d="M249,782L279,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,797A15 15 0 0 0 315 782A15 15 0 0 0 300 767A15 15 0 0 0 285 782A15 15 0 0 0 300 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,782 340,786 340,778" style="fill:rgb(0,0,0)"/>
<path d="M315,782L345,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,797L455,797L455,767L351,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="491,782 480,786 480,778" style="fill:rgb(0,0,0)"/>
<path d="M455,782L486,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M507,797A15 15 0 0 0 522 782A15 15 0 0 0 507 767A15 15 0 0 0 491 782A15 15 0 0 0 507 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="507" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,782 905,786 905,778" style="fill:rgb(0,0,0)"/>
<path d="M522,782L910,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,782 L 924,782 Q 931,782 931,774 L 931,767"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,782 33,786 33,778" style="fill:rgb(0,0,0)"/>
<path d="M24,767 L 24,774 Q 24,782 31,782 L 39,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,782 L 103,782 Q 110,782 110,794 Q 110,806 125,806 L 177,806 Q 192,806 192,794 Q 192,782 199,782 L 207,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,782 L 324,782 Q 332,782 332,770 Q 332,758 347,758 L 452,758 Q 467,758 467,770 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M379,835L428,835L428,805L379,805Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="820" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="379,820 367,824 367,815" style="fill:rgb(0,0,0)"/>
<path d="M317,782 L 324,782 Q 332,782 332,797 L 332,805 Q 332,820 347,820 L 358,820 L 373,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M428,820 L 452,820 Q 467,820 467,805 L 467,797 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,873A15 15 0 0 0 418 857A15 15 0 0 0 403 842A15 15 0 0 0 388 857A15 15 0 0 0 403 873Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="857" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,857 430,853 430,862" style="fill:rgb(0,0,0)"/>
<path d="M428,820 L 435,820 Q 443,820 443,835 L 443,842 Q 443,857 434,857 L 424,857"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,857 L 371,857 Q 356,857 356,842 L 356,835 Q 356,820 363,820 L 371,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,925L396,925A15 15 0 0 0 412 910A15 15 0 0 0 396 895L300,895A15 15 0 0 0 285 910A15 15 0 0 0 300 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="429,910 417,915 417,906" style="fill:rgb(0,0,0)"/>
<path d="M412,910L423,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,925A15 15 0 0 0 459 910A15 15 0 0 0 444 895A15 15 0 0 0 429 910A15 15 0 0 0 444 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="513,910 502,915 502,906" style="fill:rgb(0,0,0)"/>
<path d="M459,910L507,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,925L627,925A15 15 0 0 0 642 910A15 15 0 0 0 627 895L528,895A15 15 0 0 0 513 910A15 15 0 0 0 528 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="577" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function</text>
<polygon points="659,910 647,915 647,906" style="fill:rgb(0,0,0)"/>
<path d="M642,910L653,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,925A15 15 0 0 0 689 910A15 15 0 0 0 674 895A15 15 0 0 0 659 910A15 15 0 0 0 674 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="734,910 723,915 723,906" style="fill:rgb(0,0,0)"/>
<path d="M689,910L728,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,925L783,925L783,895L734,895Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="828,910 817,915 817,906" style="fill:rgb(0,0,0)"/>
<path d="M783,910L823,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M844,925A15 15 0 0 0 859 910A15 15 0 0 0 844 895A15 15 0 0 0 828 910A15 15 0 0 0 844 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="844" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,910 905,915 905,906" style="fill:rgb(0,0,0)"/>
<path d="M859,910L910,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,910 L 924,910 Q 931,910 931,903 L 931,895"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,865L603,865A15 15 0 0 0 619 850A15 15 0 0 0 603 835L528,835A15 15 0 0 0 513 850A15 15 0 0 0 528 865Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="850" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="916,850 905,854 905,846" style="fill:rgb(0,0,0)"/>
<path d="M619,850L910,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,850 L 924,850 Q 931,850 931,842 L 931,835"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="513,850 502,854 502,846" style="fill:rgb(0,0,0)"/>
<path d="M475,910 L 483,910 Q 490,910 490,895 L 490,865 Q 490,850 499,850 L 507,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,892A15 15 0 0 0 774 877A15 15 0 0 0 759 862A15 15 0 0 0 744 877A15 15 0 0 0 759 892Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="877" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="774,877 785,873 785,881" style="fill:rgb(0,0,0)"/>
<path d="M783,910 L 791,910 Q 798,910 798,895 L 798,892 Q 798,877 789,877 L 780,877"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M744,877 L 726,877 Q 711,877 711,892 L 711,895 Q 711,910 719,910 L 726,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M689,910 L 697,910 Q 704,910 704,921 Q 704,932 719,932 L 790,932 Q 805,932 805,921 Q 805,910 813,910 L 820,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="285,910 273,915 273,906" style="fill:rgb(0,0,0)"/>
<path d="M249,782 L 256,782 Q 264,782 264,797 L 264,895 Q 264,910 272,910 L 279,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,882 412,886 412,877" style="fill:rgb(0,0,0)"/>
<path d="M264,867 L 264,874 Q 264,882 279,882 L 402,882 L 417,882"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,882 L 456,882 Q 471,882 471,896 Q 471,910 478,910 L 486,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,971L80,971A15 15 0 0 0 95 956A15 15 0 0 0 80 941L60,941A15 15 0 0 0 45 956A15 15 0 0 0 60 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="131,956 120,960 120,951" style="fill:rgb(0,0,0)"/>
<path d="M95,956L125,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,971L191,971A15 15 0 0 0 206 956A15 15 0 0 0 191 941L146,941A15 15 0 0 0 131 956A15 15 0 0 0 146 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="242,956 231,960 231,951" style="fill:rgb(0,0,0)"/>
<path d="M206,956L236,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,971A15 15 0 0 0 272 956A15 15 0 0 0 257 941A15 15 0 0 0 242 956A15 15 0 0 0 257 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="295,956 284,960 284,951" style="fill:rgb(0,0,0)"/>
<path d="M272,956L290,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,971L400,971L400,941L295,941Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="423,956 411,960 411,951" style="fill:rgb(0,0,0)"/>
<path d="M400,956L417,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,971A15 15 0 0 0 453 956A15 15 0 0 0 438 941A15 15 0 0 0 423 956A15 15 0 0 0 438 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,956 905,960 905,951" style="fill:rgb(0,0,0)"/>
<path d="M453,956L910,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,956 L 924,956 Q 931,956 931,948 L 931,941"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,956 33,960 33,951" style="fill:rgb(0,0,0)"/>
<path d="M24,941 L 24,948 Q 24,956 31,956 L 39,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,929 59,934 59,925" style="fill:rgb(0,0,0)"/>
<path d="M24,914 L 24,922 Q 24,929 39,929 L 49,929 L 64,929"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,929 L 201,929 Q 216,929 216,943 Q 216,956 223,956 L 231,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,929 L 101,929 Q 108,929 108,943 Q 108,956 116,956 L 123,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,1009L89,1009A15 15 0 0 0 104 994A15 15 0 0 0 89 978L60,978A15 15 0 0 0 45 994A15 15 0 0 0 60 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASE</text>
<polygon points="140,994 128,998 128,989" style="fill:rgb(0,0,0)"/>
<path d="M104,994L134,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M140,1009L189,1009L189,978L140,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="243,994 232,998 232,989" style="fill:rgb(0,0,0)"/>
<path d="M189,994L237,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,1009L298,1009A15 15 0 0 0 313 994A15 15 0 0 0 298 978L258,978A15 15 0 0 0 243 994A15 15 0 0 0 258 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="336,994 324,998 324,989" style="fill:rgb(0,0,0)"/>
<path d="M313,994L330,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,1009L385,1009L385,978L336,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="408,994 396,998 396,989" style="fill:rgb(0,0,0)"/>
<path d="M385,994L402,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,1009L456,1009A15 15 0 0 0 472 994A15 15 0 0 0 456 978L423,978A15 15 0 0 0 408 994A15 15 0 0 0 423 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">THEN</text>
<polygon points="495,994 483,998 483,989" style="fill:rgb(0,0,0)"/>
<path d="M472,994L489,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M495,1009L544,1009L544,978L495,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="616,994 604,998 604,989" style="fill:rgb(0,0,0)"/>
<path d="M544,994L610,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M631,1009L658,1009A15 15 0 0 0 673 994A15 15 0 0 0 658 978L631,978A15 15 0 0 0 616 994A15 15 0 0 0 631 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="645" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ELSE</text>
<polygon points="696,994 685,998 685,989" style="fill:rgb(0,0,0)"/>
<path d="M673,994L691,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M696,1009L746,1009L746,978L696,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="721" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="782,994 770,998 770,989" style="fill:rgb(0,0,0)"/>
<path d="M746,994L776,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M797,1009L818,1009A15 15 0 0 0 833 994A15 15 0 0 0 818 978L797,978A15 15 0 0 0 782 994A15 15 0 0 0 797 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="807" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="916,994 905,998 905,989" style="fill:rgb(0,0,0)"/>
<path d="M833,994L910,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,994 L 924,994 Q 931,994 931,986 L 931,979"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,994 33,998 33,989" style="fill:rgb(0,0,0)"/>
<path d="M24,978 L 24,986 Q 24,994 31,994 L 39,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,994 L 111,994 Q 119,994 119,1007 Q 119,1021 134,1021 L 186,1021 Q 201,1021 201,1007 Q 201,994 208,994 L 216,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="360,1021 372,1016 372,1025" style="fill:rgb(0,0,0)"/>
<path d="M544,994 L 551,994 Q 559,994 559,1007 Q 559,1021 544,1021 L 381,1021 L 366,1021"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,1021 L 235,1021 Q 220,1021 220,1007 Q 220,994 227,994 L 235,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,994 L 585,994 Q 593,994 593,1007 Q 593,1021 608,1021 L 742,1021 Q 757,1021 757,1007 Q 757,994 765,994 L 772,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,1066L173,1066L173,1036L45,1036Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="1051" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">raise-function</text>
<polygon points="916,1051 905,1055 905,1047" style="fill:rgb(0,0,0)"/>
<path d="M173,1051L910,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,1051 L 924,1051 Q 931,1051 931,1036 L 931,32 Q 931,17 939,17 L 946,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,1051 33,1055 33,1047" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,1036 Q 24,1051 31,1051 L 39,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/filter-clause.html">filter-clause:</a></b>
<button id='x18a9ee90' onclick='hideorshow("x18a9ee90","xc1a69e65")'>show</button></p>
 <div id='xc1a69e65' style='display:none;' class='imgcontainer'>
 <div style="max-width:422px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 422.381 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L93,32A15 15 0 0 0 108 17A15 15 0 0 0 93 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FILTER</text>
<polygon points="131,17 119,21 119,12" style="fill:rgb(0,0,0)"/>
<path d="M108,17L125,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,32L146,32A15 15 0 0 0 161 17A15 15 0 0 0 146 2L146,2A15 15 0 0 0 131 17A15 15 0 0 0 146 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="184,17 173,21 173,12" style="fill:rgb(0,0,0)"/>
<path d="M161,17L178,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M199,32L249,32A15 15 0 0 0 264 17A15 15 0 0 0 249 2L199,2A15 15 0 0 0 184 17A15 15 0 0 0 199 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="224" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="287,17 275,21 275,12" style="fill:rgb(0,0,0)"/>
<path d="M264,17L281,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,32L336,32L336,2L287,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M336,17L353,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,32A15 15 0 0 0 389 17A15 15 0 0 0 374 2A15 15 0 0 0 359 17A15 15 0 0 0 374 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="374" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="413,17 401,21 401,12" style="fill:rgb(0,0,0)"/>
<path d="M389,17L407,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="416" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/function-arguments.html">function-arguments:</a></b>
<button id='xca8b72dc' onclick='hideorshow("xca8b72dc","x026c655e")'>show</button></p>
 <div id='x026c655e' style='display:none;' class='imgcontainer'>
 <div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.566 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,26 55,30 55,22" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,41 L 43,41 Q 43,26 52,26 L 61,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M82,41L150,41A15 15 0 0 0 165 26L165,26A15 15 0 0 0 150 11L82,11A15 15 0 0 0 66 26L66,26A15 15 0 0 0 82 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="183,26 171,30 171,22" style="fill:rgb(0,0,0)"/>
<path d="M165,26L177,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M183,26 L 189,26 Q 194,26 194,41 L 194,41 Q 194,56 203,56 L 212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M218,56L248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,71L303,71L303,41L254,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="447,56 435,60 435,52" style="fill:rgb(0,0,0)"/>
<path d="M303,56L441,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="116,56 104,60 104,52" style="fill:rgb(0,0,0)"/>
<path d="M32,56L110,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M116,56L212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,32A15 15 0 0 0 293 17A15 15 0 0 0 278 2A15 15 0 0 0 263 17A15 15 0 0 0 278 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="293,17 305,12 305,21" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 314,56 Q 326,56 326,41 L 326,32 Q 326,17 312,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M263,17 L 245,17 Q 230,17 230,32 L 230,41 Q 230,56 239,56 L 248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,207A15 15 0 0 0 243 192L243,192A15 15 0 0 0 228 177A15 15 0 0 0 213 192L213,192A15 15 0 0 0 228 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="213,192 201,196 201,188" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,71 L 43,177 Q 43,192 58,192 L 192,192 L 207,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,192 267,196 267,188" style="fill:rgb(0,0,0)"/>
<path d="M243,192L272,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,192 L 360,192 Q 375,192 390,192 L 394,192 Q 409,192 409,177 L 409,71 Q 409,56 415,56 L 421,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="228,216 216,221 216,212" style="fill:rgb(0,0,0)"/>
<path d="M116,192 L 181,192 Q 196,192 196,204 Q 196,216 209,216 L 222,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,216 L 242,216 Q 257,216 257,204 Q 257,192 262,192 L 268,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="90,117 78,121 78,112" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 313,56 Q 323,56 323,71 L 323,71 Q 323,86 308,86 L 81,86 Q 66,86 66,101 L 66,102 Q 66,117 75,117 L 84,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,132L149,132A15 15 0 0 0 164 117L164,117A15 15 0 0 0 149 101L105,101A15 15 0 0 0 90 117L90,117A15 15 0 0 0 105 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="182,117 170,121 170,112" style="fill:rgb(0,0,0)"/>
<path d="M164,117L176,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,132L201,132A15 15 0 0 0 216 117L216,117A15 15 0 0 0 201 101L197,101A15 15 0 0 0 182 117L182,117A15 15 0 0 0 197 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M216,117L239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,132L375,132L375,101L245,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,169A15 15 0 0 0 325 154A15 15 0 0 0 310 139A15 15 0 0 0 294 154A15 15 0 0 0 310 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,154 336,150 336,159" style="fill:rgb(0,0,0)"/>
<path d="M375,117 L 380,117 Q 386,117 386,132 L 386,139 Q 386,154 371,154 L 345,154 L 330,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M294,154 L 260,154 Q 245,154 236,154 Q 227,154 227,139 L 227,132 Q 227,117 233,117 L 239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M375,117 L 383,117 Q 392,117 392,102 L 392,71 Q 392,56 407,56 L 413,56 L 428,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x8221620c' onclick='hideorshow("x8221620c","xdba271d4")'>show</button></p>
 <div id='xdba271d4' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/over-clause.html">over-clause:</a></b>
<button id='x52f00d16' onclick='hideorshow("x52f00d16","x73b94a3c")'>show</button></p>
 <div id='x73b94a3c' style='display:none;' class='imgcontainer'>
 <div style="max-width:600px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 600.706 418.392">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="129,17 117,21 117,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L123,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M144,32L241,32A15 15 0 0 0 256 17A15 15 0 0 0 241 2L144,2A15 15 0 0 0 129 17A15 15 0 0 0 144 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,17 L 100,17 Q 108,17 108,32 L 108,40 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,70A15 15 0 0 0 165 55L165,55A15 15 0 0 0 149 39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 149 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="149" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="206,82 195,86 195,77" style="fill:rgb(0,0,0)"/>
<path d="M165,55 L 172,55 Q 180,55 180,68 Q 180,82 190,82 L 200,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,97L363,97A15 15 0 0 0 378 82A15 15 0 0 0 363 67L221,67A15 15 0 0 0 206 82A15 15 0 0 0 221 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="292" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M221,173L301,173A15 15 0 0 0 316 157A15 15 0 0 0 301 142L221,142A15 15 0 0 0 206 157A15 15 0 0 0 221 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="339,157 328,162 328,153" style="fill:rgb(0,0,0)"/>
<path d="M316,157L333,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,173L358,173A15 15 0 0 0 373 157A15 15 0 0 0 358 142L354,142A15 15 0 0 0 339 157A15 15 0 0 0 354 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="409,157 398,162 398,153" style="fill:rgb(0,0,0)"/>
<path d="M373,157L404,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,173L459,173L459,142L409,142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M434,210A15 15 0 0 0 449 195A15 15 0 0 0 434 180A15 15 0 0 0 419 195A15 15 0 0 0 434 210Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="195" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="449,195 461,191 461,200" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,180 Q 474,195 464,195 L 455,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,195 L 398,195 Q 383,195 383,180 L 383,172 Q 383,157 390,157 L 398,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,55 280,59 280,50" style="fill:rgb(0,0,0)"/>
<path d="M165,55L286,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,120 304,115 304,124" style="fill:rgb(0,0,0)"/>
<path d="M292,55 L 401,55 Q 416,55 416,70 L 416,105 Q 416,120 401,120 L 313,120 L 298,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,157 195,162 195,153" style="fill:rgb(0,0,0)"/>
<path d="M292,120 L 180,120 Q 165,120 165,135 L 165,142 Q 165,157 180,157 L 185,157 L 200,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="401,82 389,86 389,77" style="fill:rgb(0,0,0)"/>
<path d="M378,82L395,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,82 L 408,82 Q 416,82 416,89 L 416,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,286L266,286A15 15 0 0 0 281 271A15 15 0 0 0 266 256L221,256A15 15 0 0 0 206 271A15 15 0 0 0 221 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="244" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="304,271 292,275 292,266" style="fill:rgb(0,0,0)"/>
<path d="M281,271L298,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M319,286L323,286A15 15 0 0 0 338 271A15 15 0 0 0 323 256L319,256A15 15 0 0 0 304 271A15 15 0 0 0 319 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="321" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="374,271 363,275 363,266" style="fill:rgb(0,0,0)"/>
<path d="M338,271L368,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,286L504,286L504,256L374,256Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M439,324A15 15 0 0 0 454 309A15 15 0 0 0 439 293A15 15 0 0 0 424 309A15 15 0 0 0 439 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="454,309 466,304 466,313" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,294 Q 519,309 504,309 L 475,309 L 460,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,309 L 363,309 Q 348,309 348,294 L 348,286 Q 348,271 355,271 L 363,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,233 304,229 304,237" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,218 Q 474,233 459,233 L 313,233 L 298,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,271 195,275 195,266" style="fill:rgb(0,0,0)"/>
<path d="M292,233 L 180,233 Q 165,233 165,248 L 165,256 Q 165,271 180,271 L 185,271 L 200,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,195 160,184 169,184" style="fill:rgb(0,0,0)"/>
<path d="M165,142L165,189"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,195L165,256"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,399L311,399L311,369L206,369Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="384" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="519,384 508,389 508,380" style="fill:rgb(0,0,0)"/>
<path d="M311,384L513,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M534,399A15 15 0 0 0 549 384A15 15 0 0 0 534 369A15 15 0 0 0 519 384A15 15 0 0 0 534 399Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="384" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="591,17 579,21 579,12" style="fill:rgb(0,0,0)"/>
<path d="M549,384 L 557,384 Q 564,384 564,369 L 564,32 Q 564,17 575,17 L 585,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="594" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,17 508,21 508,12" style="fill:rgb(0,0,0)"/>
<path d="M256,17L513,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,17L579,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,346 304,342 304,351" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,331 Q 519,346 504,346 L 313,346 L 298,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,384 195,389 195,380" style="fill:rgb(0,0,0)"/>
<path d="M292,346 L 180,346 Q 165,346 165,361 L 165,369 Q 165,384 180,384 L 185,384 L 200,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,309 160,297 169,297" style="fill:rgb(0,0,0)"/>
<path d="M165,256L165,303"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,309L165,369"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="258,411 247,416 247,407" style="fill:rgb(0,0,0)"/>
<path d="M165,369 L 165,396 Q 165,411 180,411 L 238,411 L 253,411"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,384 369,389 369,380" style="fill:rgb(0,0,0)"/>
<path d="M258,411 L 335,411 Q 350,411 350,398 Q 350,384 362,384 L 375,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x2b14e594' onclick='hideorshow("x2b14e594","xab2f7c72")'>show</button></p>
 <div id='xab2f7c72' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x757584bb' onclick='hideorshow("x757584bb","x628bf177")'>show</button></p>
 <div id='x628bf177' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/raise-function.html">raise-function:</a></b>
<button id='x4839b75d' onclick='hideorshow("x4839b75d","x87e4413d")'>show</button></p>
 <div id='x87e4413d' style='display:none;' class='imgcontainer'>
 <div style="max-width:627px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 627.302 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L82,32A15 15 0 0 0 97 17A15 15 0 0 0 82 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RAISE</text>
<polygon points="120,17 109,21 109,12" style="fill:rgb(0,0,0)"/>
<path d="M97,17L114,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,32L135,32A15 15 0 0 0 150 17A15 15 0 0 0 135 2L135,2A15 15 0 0 0 120 17A15 15 0 0 0 135 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="135" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="192,55 180,59 180,50" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 158,17 Q 165,17 165,32 L 165,40 Q 165,55 176,55 L 186,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,70L285,70A15 15 0 0 0 300 55L300,55A15 15 0 0 0 285 39L207,39A15 15 0 0 0 192 55L192,55A15 15 0 0 0 207 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="336,55 324,59 324,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70A15 15 0 0 0 366 55L366,55A15 15 0 0 0 351 39A15 15 0 0 0 336 55L336,55A15 15 0 0 0 351 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="389,55 378,59 378,50" style="fill:rgb(0,0,0)"/>
<path d="M366,55L383,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,70L508,70A15 15 0 0 0 523 55L523,55A15 15 0 0 0 508 39L404,39A15 15 0 0 0 389 55L389,55A15 15 0 0 0 404 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="456" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">error-message</text>
<polygon points="564,17 553,21 553,12" style="fill:rgb(0,0,0)"/>
<path d="M523,55 L 530,55 Q 538,55 538,40 L 538,32 Q 538,17 548,17 L 558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M579,32A15 15 0 0 0 594 17A15 15 0 0 0 579 2A15 15 0 0 0 564 17A15 15 0 0 0 579 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="617,17 606,21 606,12" style="fill:rgb(0,0,0)"/>
<path d="M594,17L612,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="621" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L259,32A15 15 0 0 0 274 17A15 15 0 0 0 259 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="456,17 444,21 444,12" style="fill:rgb(0,0,0)"/>
<path d="M274,17L450,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,17L553,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,108L249,108A15 15 0 0 0 264 92A15 15 0 0 0 249 77L207,77A15 15 0 0 0 192 92A15 15 0 0 0 207 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="300,92 288,97 288,88" style="fill:rgb(0,0,0)"/>
<path d="M264,92L294,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,92 L 307,92 Q 315,92 315,77 L 315,70 Q 315,55 322,55 L 330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,145L229,145A15 15 0 0 0 244 130A15 15 0 0 0 229 115L207,115A15 15 0 0 0 192 130A15 15 0 0 0 207 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="300,130 288,135 288,126" style="fill:rgb(0,0,0)"/>
<path d="M244,130L294,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,130 L 307,130 Q 315,130 315,115 L 315,92 L 315,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,130 180,135 180,126" style="fill:rgb(0,0,0)"/>
<path d="M165,39 L 165,115 Q 165,130 176,130 L 186,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,92 180,97 180,88" style="fill:rgb(0,0,0)"/>
<path d="M165,77 L 165,85 Q 165,92 176,92 L 186,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/foreign-key-clause.html">foreign-key-clause:</a></b>
<button id='x9a1e0155' onclick='hideorshow("x9a1e0155","xd151b6c6")'>show</button></p>
 <div id='xd151b6c6' style='display:none;' class='imgcontainer'>
 <div style="max-width:648px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 648.158 492.48">
<circle cx="5" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,55L39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L164,70A15 15 0 0 0 179 55A15 15 0 0 0 164 39L60,39A15 15 0 0 0 45 55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REFERENCES</text>
<polygon points="202,55 190,59 190,50" style="fill:rgb(0,0,0)"/>
<path d="M179,55L196,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,70L306,70A15 15 0 0 0 322 55A15 15 0 0 0 306 39L217,39A15 15 0 0 0 202 55A15 15 0 0 0 217 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="262" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">foreign-table</text>
<polygon points="358,55 346,59 346,50" style="fill:rgb(0,0,0)"/>
<path d="M322,55L352,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M373,70A15 15 0 0 0 388 55A15 15 0 0 0 373 39A15 15 0 0 0 358 55A15 15 0 0 0 373 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="373" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="424,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M388,55L418,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M439,70L533,70A15 15 0 0 0 548 55A15 15 0 0 0 533 39L439,39A15 15 0 0 0 424 55A15 15 0 0 0 439 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="486" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="584,55 573,59 573,50" style="fill:rgb(0,0,0)"/>
<path d="M548,55L578,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M599,70A15 15 0 0 0 614 55A15 15 0 0 0 599 39A15 15 0 0 0 584 55A15 15 0 0 0 599 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="599" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<path d="M486,32A15 15 0 0 0 501 17L501,17A15 15 0 0 0 486 2A15 15 0 0 0 471 17L471,17A15 15 0 0 0 486 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="486" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="501,17 513,12 513,21" style="fill:rgb(0,0,0)"/>
<path d="M548,55 L 556,55 Q 563,55 563,40 L 563,32 Q 563,17 548,17 L 522,17 L 507,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,17 L 416,17 Q 401,17 401,32 L 401,40 Q 401,55 412,55 L 424,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,176L69,176A15 15 0 0 0 84 160A15 15 0 0 0 69 145L60,145A15 15 0 0 0 45 160A15 15 0 0 0 60 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="64" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="120,160 109,165 109,156" style="fill:rgb(0,0,0)"/>
<path d="M84,160L114,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,176L188,176A15 15 0 0 0 203 160A15 15 0 0 0 188 145L135,145A15 15 0 0 0 120 160A15 15 0 0 0 135 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="162" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DELETE</text>
<polygon points="275,160 264,165 264,156" style="fill:rgb(0,0,0)"/>
<path d="M203,160L269,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,176L306,176A15 15 0 0 0 321 160A15 15 0 0 0 306 145L290,145A15 15 0 0 0 275 160A15 15 0 0 0 290 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="298" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="344,160 332,165 332,156" style="fill:rgb(0,0,0)"/>
<path d="M321,160L338,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M359,176L390,176A15 15 0 0 0 405 160A15 15 0 0 0 390 145L359,145A15 15 0 0 0 344 160A15 15 0 0 0 359 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<path d="M135,213L189,213A15 15 0 0 0 204 198A15 15 0 0 0 189 183L135,183A15 15 0 0 0 120 198A15 15 0 0 0 135 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="162" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="120,198 109,203 109,194" style="fill:rgb(0,0,0)"/>
<path d="M84,160 L 92,160 Q 99,160 99,175 L 99,183 Q 99,198 107,198 L 114,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M204,198 L 212,198 Q 219,198 219,183 L 219,175 Q 219,160 227,160 L 234,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,213L306,213A15 15 0 0 0 321 198A15 15 0 0 0 306 183L290,183A15 15 0 0 0 275 198A15 15 0 0 0 290 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="298" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="344,198 332,203 332,194" style="fill:rgb(0,0,0)"/>
<path d="M321,198L338,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M359,213L424,213A15 15 0 0 0 440 198A15 15 0 0 0 424 183L359,183A15 15 0 0 0 344 198A15 15 0 0 0 359 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="392" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFAULT</text>
<polygon points="463,198 451,203 451,194" style="fill:rgb(0,0,0)"/>
<path d="M440,198L457,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,198 L 470,198 Q 478,198 478,191 L 478,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,251L357,251A15 15 0 0 0 372 236A15 15 0 0 0 357 221L290,221A15 15 0 0 0 275 236A15 15 0 0 0 290 251Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="324" y="236" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASCADE</text>
<polygon points="463,236 451,240 451,232" style="fill:rgb(0,0,0)"/>
<path d="M372,236L457,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,236 L 470,236 Q 478,236 478,229 L 478,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,289L361,289A15 15 0 0 0 376 274A15 15 0 0 0 361 259L290,259A15 15 0 0 0 275 274A15 15 0 0 0 290 289Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="326" y="274" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RESTRICT</text>
<polygon points="463,274 451,278 451,270" style="fill:rgb(0,0,0)"/>
<path d="M376,274L457,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,274 L 470,274 Q 478,274 478,266 L 478,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,327L299,327A15 15 0 0 0 314 312A15 15 0 0 0 299 297L290,297A15 15 0 0 0 275 312A15 15 0 0 0 290 327Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="295" y="312" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="337,312 326,316 326,307" style="fill:rgb(0,0,0)"/>
<path d="M314,312L332,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M353,327L404,327A15 15 0 0 0 419 312A15 15 0 0 0 404 297L353,297A15 15 0 0 0 337 312A15 15 0 0 0 353 327Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="378" y="312" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ACTION</text>
<polygon points="463,312 451,316 451,307" style="fill:rgb(0,0,0)"/>
<path d="M419,312L457,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,312 L 470,312 Q 478,312 478,304 L 478,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,357L108,357A15 15 0 0 0 123 342L123,342A15 15 0 0 0 108 327L60,327A15 15 0 0 0 45 342L45,342A15 15 0 0 0 60 357Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="84" y="342" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<polygon points="146,342 135,346 135,338" style="fill:rgb(0,0,0)"/>
<path d="M123,342L140,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M161,357L188,357A15 15 0 0 0 203 342L203,342A15 15 0 0 0 188 327L161,327A15 15 0 0 0 146 342L146,342A15 15 0 0 0 161 357Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="175" y="342" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="463,342 451,346 451,338" style="fill:rgb(0,0,0)"/>
<path d="M203,342L457,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="442,115 453,111 453,119" style="fill:rgb(0,0,0)"/>
<path d="M463,342 L 470,342 Q 478,342 478,327 L 478,130 Q 478,115 463,115 L 462,115 L 447,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="463,160 451,165 451,156" style="fill:rgb(0,0,0)"/>
<path d="M405,160L457,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,160 L 470,160 Q 478,160 478,153 L 478,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,312 264,316 264,307" style="fill:rgb(0,0,0)"/>
<path d="M237,160 L 245,160 Q 252,160 252,175 L 252,297 Q 252,312 261,312 L 269,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,274 264,278 264,270" style="fill:rgb(0,0,0)"/>
<path d="M252,259 L 252,266 Q 252,274 261,274 L 269,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,236 264,240 264,232" style="fill:rgb(0,0,0)"/>
<path d="M252,221 L 252,228 Q 252,236 261,236 L 269,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,198 264,203 264,194" style="fill:rgb(0,0,0)"/>
<path d="M252,183 L 252,191 Q 252,198 261,198 L 269,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,160 33,165 33,156" style="fill:rgb(0,0,0)"/>
<path d="M614,55 L 623,55 Q 632,55 632,70 L 632,100 Q 632,115 617,115 L 20,115 Q 5,115 5,130 L 5,145 Q 5,160 20,160 L 24,160 L 39,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,342 33,346 33,338" style="fill:rgb(0,0,0)"/>
<path d="M5,145 L 5,327 Q 5,342 20,342 L 24,342 L 39,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="337,91 332,79 341,79" style="fill:rgb(0,0,0)"/>
<path d="M322,55 L 329,55 Q 337,55 337,70 L 337,70 L 337,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M337,91 L 337,103 Q 337,115 329,115 L 322,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,433L80,433A15 15 0 0 0 95 417A15 15 0 0 0 80 402L60,402A15 15 0 0 0 45 417A15 15 0 0 0 60 433Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="417" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="133,387 122,392 122,383" style="fill:rgb(0,0,0)"/>
<path d="M95,417 L 103,417 Q 110,417 110,402 L 110,402 Q 110,387 119,387 L 127,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M148,402L250,402A15 15 0 0 0 265 387A15 15 0 0 0 250 372L148,372A15 15 0 0 0 133 387A15 15 0 0 0 148 402Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="387" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFERRABLE</text>
<polygon points="303,417 292,422 292,413" style="fill:rgb(0,0,0)"/>
<path d="M265,387 L 273,387 Q 280,387 280,402 L 280,402 Q 280,417 289,417 L 297,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M318,433L389,433A15 15 0 0 0 405 417A15 15 0 0 0 389 402L318,402A15 15 0 0 0 303 417A15 15 0 0 0 318 433Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="354" y="417" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INITIALLY</text>
<polygon points="428,417 416,422 416,413" style="fill:rgb(0,0,0)"/>
<path d="M405,417L422,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M443,433L523,433A15 15 0 0 0 538 417A15 15 0 0 0 523 402L443,402A15 15 0 0 0 428 417A15 15 0 0 0 443 433Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="417" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFERRED</text>
<path d="M318,470L389,470A15 15 0 0 0 405 455A15 15 0 0 0 389 440L318,440A15 15 0 0 0 303 455A15 15 0 0 0 318 470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="354" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INITIALLY</text>
<polygon points="428,455 416,460 416,451" style="fill:rgb(0,0,0)"/>
<path d="M405,455L422,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M443,470L531,470A15 15 0 0 0 546 455A15 15 0 0 0 531 440L443,440A15 15 0 0 0 428 455A15 15 0 0 0 443 470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="487" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IMMEDIATE</text>
<polygon points="569,455 558,460 558,451" style="fill:rgb(0,0,0)"/>
<path d="M546,455L564,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="569,417 558,422 558,413" style="fill:rgb(0,0,0)"/>
<path d="M538,417L564,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="569,387 558,392 558,383" style="fill:rgb(0,0,0)"/>
<path d="M265,387L564,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="303,455 292,460 292,451" style="fill:rgb(0,0,0)"/>
<path d="M265,387 L 273,387 Q 280,387 280,402 L 280,440 Q 280,455 289,455 L 297,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="638,486 627,490 627,481" style="fill:rgb(0,0,0)"/>
<path d="M569,387 L 577,387 Q 584,387 584,402 L 584,471 Q 584,486 599,486 L 618,486 L 633,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="642" cy="486" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M569,455 L 577,455 Q 584,455 584,463 L 584,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M569,417 L 577,417 Q 584,417 584,425 L 584,432"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M5,327 L 5,471 Q 5,486 20,486 L 612,486 L 627,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M5,372 L 5,380 Q 5,387 20,387 L 118,387 L 133,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,417 33,422 33,413" style="fill:rgb(0,0,0)"/>
<path d="M5,402 L 5,410 Q 5,417 20,417 L 24,417 L 39,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/literal-value.html">literal-value:</a></b>
<button id='xa4be9506' onclick='hideorshow("xa4be9506","x13472c50")'>show</button></p>
 <div id='x13472c50' style='display:none;' class='imgcontainer'>
 <div style="max-width:341px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 341.376 336.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,319 39,324 39,315" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,304 Q 24,319 34,319 L 45,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,334L252,334A15 15 0 0 0 267 319A15 15 0 0 0 252 304L65,304A15 15 0 0 0 50 319A15 15 0 0 0 65 334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIMESTAMP</text>
<polygon points="290,319 278,324 278,315" style="fill:rgb(0,0,0)"/>
<path d="M267,319L284,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,17 320,21 320,12" style="fill:rgb(0,0,0)"/>
<path d="M290,319 L 297,319 Q 305,319 305,304 L 305,32 Q 305,17 315,17 L 326,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="335" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L172,32A15 15 0 0 0 187 17A15 15 0 0 0 172 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="119" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,17L320,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L153,70A15 15 0 0 0 168 55L168,55A15 15 0 0 0 153 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">string-literal</text>
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,47 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,55 278,59 278,50" style="fill:rgb(0,0,0)"/>
<path d="M168,55L284,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,55 L 297,55 Q 305,55 305,47 L 305,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L140,108A15 15 0 0 0 155 92A15 15 0 0 0 140 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">blob-literal</text>
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,85 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,92 278,97 278,88" style="fill:rgb(0,0,0)"/>
<path d="M155,92L284,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,92 L 297,92 Q 305,92 305,85 L 305,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,145L97,145A15 15 0 0 0 112 130A15 15 0 0 0 97 115L66,115A15 15 0 0 0 50 130A15 15 0 0 0 66 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="50,130 39,135 39,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 34,130 L 45,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,130 278,135 278,126" style="fill:rgb(0,0,0)"/>
<path d="M112,130L284,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,130 L 297,130 Q 305,130 305,123 L 305,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,183L96,183A15 15 0 0 0 111 168A15 15 0 0 0 96 153L66,153A15 15 0 0 0 50 168A15 15 0 0 0 66 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRUE</text>
<polygon points="50,168 39,172 39,164" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,160 Q 24,168 34,168 L 45,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,168 278,172 278,164" style="fill:rgb(0,0,0)"/>
<path d="M111,168L284,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,168 L 297,168 Q 305,168 305,160 L 305,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,221L104,221A15 15 0 0 0 119 206A15 15 0 0 0 104 191L66,191A15 15 0 0 0 50 206A15 15 0 0 0 66 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FALSE</text>
<polygon points="50,206 39,210 39,201" style="fill:rgb(0,0,0)"/>
<path d="M24,191 L 24,198 Q 24,206 34,206 L 45,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,206 278,210 278,201" style="fill:rgb(0,0,0)"/>
<path d="M119,206L284,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,206 L 297,206 Q 305,206 305,198 L 305,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,259L190,259A15 15 0 0 0 205 244A15 15 0 0 0 190 228L66,228A15 15 0 0 0 50 244A15 15 0 0 0 66 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="128" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIME</text>
<polygon points="50,244 39,248 39,239" style="fill:rgb(0,0,0)"/>
<path d="M24,228 L 24,236 Q 24,244 34,244 L 45,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,244 278,248 278,239" style="fill:rgb(0,0,0)"/>
<path d="M205,244L284,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,244 L 297,244 Q 305,244 305,236 L 305,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,297L192,297A15 15 0 0 0 207 281A15 15 0 0 0 192 266L66,266A15 15 0 0 0 50 281A15 15 0 0 0 66 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_DATE</text>
<polygon points="50,281 39,286 39,277" style="fill:rgb(0,0,0)"/>
<path d="M24,266 L 24,274 Q 24,281 34,281 L 45,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,281 278,286 278,277" style="fill:rgb(0,0,0)"/>
<path d="M207,281L284,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,281 L 297,281 Q 305,281 305,274 L 305,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='x60e748e2' onclick='hideorshow("x60e748e2","x9205f765")'>show</button></p>
 <div id='x9205f765' style='display:none;' class='imgcontainer'>
 <div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/type-name.html">type-name:</a></b>
<button id='x752e405e' onclick='hideorshow("x752e405e","x05efa932")'>show</button></p>
 <div id='x05efa932' style='display:none;' class='imgcontainer'>
 <div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.008 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L87,32A15 15 0 0 0 102 17A15 15 0 0 0 87 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="165,92 153,97 153,88" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,77 Q 138,92 149,92 L 159,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,108A15 15 0 0 0 195 92A15 15 0 0 0 180 77A15 15 0 0 0 165 92A15 15 0 0 0 180 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,92 201,97 201,88" style="fill:rgb(0,0,0)"/>
<path d="M195,92L207,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,108L350,108L350,77L212,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,92 356,97 356,88" style="fill:rgb(0,0,0)"/>
<path d="M350,92L362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,108A15 15 0 0 0 398 92A15 15 0 0 0 382 77A15 15 0 0 0 367 92A15 15 0 0 0 382 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="415,92 403,97 403,88" style="fill:rgb(0,0,0)"/>
<path d="M398,92L409,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,108L553,108L553,77L415,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="570,92 558,97 558,88" style="fill:rgb(0,0,0)"/>
<path d="M553,92L564,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,108A15 15 0 0 0 600 92A15 15 0 0 0 585 77A15 15 0 0 0 570 92A15 15 0 0 0 585 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="585" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="651,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M600,92 L 608,92 Q 615,92 615,77 L 615,32 Q 615,17 630,17 L 630,17 L 645,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,40 Q 138,55 149,55 L 159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70A15 15 0 0 0 195 55L195,55A15 15 0 0 0 180 39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,55 201,59 201,50" style="fill:rgb(0,0,0)"/>
<path d="M195,55L207,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,70L350,70L350,39L212,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,55 356,59 356,50" style="fill:rgb(0,0,0)"/>
<path d="M350,55L362,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,70A15 15 0 0 0 398 55L398,55A15 15 0 0 0 382 39A15 15 0 0 0 367 55L367,55A15 15 0 0 0 382 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="600,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M398,55L594,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M600,55 L 608,55 Q 615,55 615,47 L 615,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="74,47 85,43 85,51" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 110,17 Q 117,17 117,32 L 117,32 Q 117,47 102,47 L 94,47 L 79,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47 L 33,47 Q 18,47 18,32 L 18,32 Q 18,17 26,17 L 33,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="382,17 371,21 371,12" style="fill:rgb(0,0,0)"/>
<path d="M102,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,17L630,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='x751594bf' onclick='hideorshow("x751594bf","x5bf645a5")'>show</button></p>
 <div id='x5bf645a5' style='display:none;' class='imgcontainer'>
 <div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/select-stmt.html">select-stmt:</a></b>
<button id='xf2c35fd6' onclick='hideorshow("xf2c35fd6","xdd71e2f3")'>show</button></p>
 <div id='xdd71e2f3' style='display:none;' class='imgcontainer'>
 <div style="max-width:669px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 669.677 1162.3">
<path d="M55,845L667,845L667,99L55,99Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="6" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="46,17 34,21 34,12" style="fill:rgb(0,0,0)"/>
<path d="M10,17L40,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M61,32L92,32A15 15 0 0 0 107 17A15 15 0 0 0 92 2L61,2A15 15 0 0 0 46 17A15 15 0 0 0 61 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="76" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M167,62L253,62A15 15 0 0 0 268 47L268,47A15 15 0 0 0 253 32L167,32A15 15 0 0 0 152 47L152,47A15 15 0 0 0 167 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="210,17 198,21 198,12" style="fill:rgb(0,0,0)"/>
<path d="M107,17L204,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M210,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M358,32L584,32L584,2L358,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="152,47 140,51 140,43" style="fill:rgb(0,0,0)"/>
<path d="M107,17 L 114,17 Q 122,17 122,32 L 122,32 Q 122,47 134,47 L 146,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="291,47 279,51 279,43" style="fill:rgb(0,0,0)"/>
<path d="M268,47L285,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,47 L 298,47 Q 306,47 306,32 L 306,32 Q 306,17 321,17 L 331,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,70A15 15 0 0 0 486 55L486,55A15 15 0 0 0 471 39A15 15 0 0 0 456 55L456,55A15 15 0 0 0 471 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="486,55 498,50 498,59" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,40 Q 599,55 584,55 L 507,55 L 492,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,55 L 350,55 Q 335,55 335,40 L 335,32 Q 335,17 340,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,83 307,79 307,88" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,68 Q 599,83 584,83 L 316,83 L 301,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,83 L 40,83 Q 25,83 25,98 L 25,113"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="25,47 20,36 29,36" style="fill:rgb(0,0,0)"/>
<path d="M10,17 L 17,17 Q 25,17 25,29 L 25,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="55,129 43,133 43,124" style="fill:rgb(0,0,0)"/>
<path d="M25,47 L 25,114 Q 25,129 37,129 L 49,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,129 115,133 115,124" style="fill:rgb(0,0,0)"/>
<path d="M55,129L121,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,144L193,144A15 15 0 0 0 208 129A15 15 0 0 0 193 114L142,114A15 15 0 0 0 127 129A15 15 0 0 0 142 144Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="250,159 238,163 238,155" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,144 Q 223,159 233,159 L 244,159"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,174L333,174A15 15 0 0 0 348 159A15 15 0 0 0 333 144L265,144A15 15 0 0 0 250 159A15 15 0 0 0 265 174Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="159" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="417,129 406,133 406,124" style="fill:rgb(0,0,0)"/>
<path d="M348,159 L 356,159 Q 363,159 363,144 L 363,144 Q 363,129 378,129 L 396,129 L 411,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,144L545,144L545,114L417,114Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M481,182A15 15 0 0 0 496 166A15 15 0 0 0 481 151A15 15 0 0 0 466 166A15 15 0 0 0 481 182Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="166" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="496,166 508,162 508,171" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,151 Q 560,166 545,166 L 517,166 L 502,166"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M466,166 L 406,166 Q 391,166 391,151 L 391,144 Q 391,129 398,129 L 406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,129 287,133 287,124" style="fill:rgb(0,0,0)"/>
<path d="M208,129L293,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M299,129L406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,212L280,212A15 15 0 0 0 295 197A15 15 0 0 0 280 182L265,182A15 15 0 0 0 250 197A15 15 0 0 0 265 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="197" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="348,197 337,201 337,192" style="fill:rgb(0,0,0)"/>
<path d="M295,197L342,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,197 L 356,197 Q 363,197 363,182 L 363,159 L 363,144"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="250,197 238,201 238,192" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,182 Q 223,197 233,197 L 244,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,287L203,287A15 15 0 0 0 218 272A15 15 0 0 0 203 257L168,257A15 15 0 0 0 153 272A15 15 0 0 0 168 287Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="186" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="290,272 279,277 279,268" style="fill:rgb(0,0,0)"/>
<path d="M218,272L284,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,287L451,287L451,257L290,257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M320,362L422,362L422,331L320,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M371,324A15 15 0 0 0 386 309A15 15 0 0 0 371 293A15 15 0 0 0 356 309A15 15 0 0 0 371 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="386,309 397,304 397,313" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 459,272 Q 466,272 466,287 L 466,294 Q 466,309 451,309 L 407,309 L 392,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M356,309 L 279,309 Q 264,309 264,294 L 264,287 Q 264,272 271,272 L 279,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="320,346 308,351 308,342" style="fill:rgb(0,0,0)"/>
<path d="M218,272 L 226,272 Q 233,272 233,287 L 233,331 Q 233,346 248,346 L 299,346 L 314,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="484,313 488,325 480,325" style="fill:rgb(0,0,0)"/>
<path d="M422,346 L 436,346 Q 451,346 466,346 L 469,346 Q 484,346 484,333 L 484,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,272 494,277 494,268" style="fill:rgb(0,0,0)"/>
<path d="M484,313 L 484,287 Q 484,272 492,272 L 499,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,272 L 496,272 Q 487,272 487,272 Q 487,272 495,272 L 502,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,197 555,185 564,185" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,176 L 560,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,235 360,230 360,239" style="fill:rgb(0,0,0)"/>
<path d="M560,197 L 560,220 Q 560,235 545,235 L 369,235 L 354,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,272 142,277 142,268" style="fill:rgb(0,0,0)"/>
<path d="M348,235 L 142,235 Q 127,235 127,250 L 127,257 Q 127,272 137,272 L 147,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,437L218,437A15 15 0 0 0 233 422A15 15 0 0 0 218 407L168,407A15 15 0 0 0 153 422A15 15 0 0 0 168 437Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="256,422 244,426 244,418" style="fill:rgb(0,0,0)"/>
<path d="M233,422L250,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,437L305,437L305,407L256,407Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="517,324 513,312 521,312" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 502,272 Q 517,272 517,287 L 517,303 L 517,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,384 382,380 382,389" style="fill:rgb(0,0,0)"/>
<path d="M517,324 L 517,369 Q 517,384 502,384 L 391,384 L 376,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,422 142,426 142,418" style="fill:rgb(0,0,0)"/>
<path d="M371,384 L 142,384 Q 127,384 127,399 L 127,407 Q 127,422 137,422 L 147,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,324 122,312 131,312" style="fill:rgb(0,0,0)"/>
<path d="M127,257L127,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,324L127,407"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,535L212,535A15 15 0 0 0 227 520A15 15 0 0 0 212 505L168,505A15 15 0 0 0 153 520A15 15 0 0 0 168 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="250,520 238,525 238,516" style="fill:rgb(0,0,0)"/>
<path d="M227,520L244,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,535L269,535A15 15 0 0 0 284 520A15 15 0 0 0 269 505L265,505A15 15 0 0 0 250 520A15 15 0 0 0 265 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="320,520 309,525 309,516" style="fill:rgb(0,0,0)"/>
<path d="M284,520L314,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,535L369,535L369,505L320,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="452,520 441,525 441,516" style="fill:rgb(0,0,0)"/>
<path d="M369,520L446,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,535L520,535A15 15 0 0 0 535 520A15 15 0 0 0 520 505L467,505A15 15 0 0 0 452 520A15 15 0 0 0 467 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="558,520 546,525 546,516" style="fill:rgb(0,0,0)"/>
<path d="M535,520L552,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,535L607,535L607,505L558,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M345,573A15 15 0 0 0 360 558A15 15 0 0 0 345 543A15 15 0 0 0 330 558A15 15 0 0 0 345 573Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="558" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="360,558 371,554 371,562" style="fill:rgb(0,0,0)"/>
<path d="M369,520 L 377,520 Q 384,520 384,535 L 384,543 Q 384,558 375,558 L 366,558"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,558 L 309,558 Q 294,558 294,543 L 294,535 Q 294,520 301,520 L 309,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="514,551 503,555 503,546" style="fill:rgb(0,0,0)"/>
<path d="M411,520 L 418,520 Q 426,520 426,535 L 426,536 Q 426,551 441,551 L 493,551 L 508,551"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M514,551 L 607,551 Q 622,551 622,536 L 622,535 Q 622,520 630,520 L 637,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,490 256,494 256,486" style="fill:rgb(0,0,0)"/>
<path d="M127,460 L 127,475 Q 127,490 142,490 L 246,490 L 261,490"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,520 399,525 399,516" style="fill:rgb(0,0,0)"/>
<path d="M267,490 L 369,490 Q 384,490 384,505 L 384,505 Q 384,520 395,520 L 405,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,460 244,455 244,464" style="fill:rgb(0,0,0)"/>
<path d="M305,422 L 313,422 Q 320,422 320,437 L 320,445 Q 320,460 305,460 L 254,460 L 239,460"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,520 142,525 142,516" style="fill:rgb(0,0,0)"/>
<path d="M233,460 L 142,460 Q 127,460 127,475 L 127,505 Q 127,520 137,520 L 147,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,447 122,435 131,435" style="fill:rgb(0,0,0)"/>
<path d="M127,407L127,441"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,447L127,505"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,649L232,649A15 15 0 0 0 247 634A15 15 0 0 0 232 619L168,619A15 15 0 0 0 153 634A15 15 0 0 0 168 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="200" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="283,634 271,638 271,629" style="fill:rgb(0,0,0)"/>
<path d="M247,634L277,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,649L395,649A15 15 0 0 0 410 634A15 15 0 0 0 395 619L298,619A15 15 0 0 0 283 634A15 15 0 0 0 298 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="433,634 422,638 422,629" style="fill:rgb(0,0,0)"/>
<path d="M410,634L427,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,649L452,649A15 15 0 0 0 467 634A15 15 0 0 0 452 619L448,619A15 15 0 0 0 433 634A15 15 0 0 0 448 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="450" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="490,634 479,638 479,629" style="fill:rgb(0,0,0)"/>
<path d="M467,634L485,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,649L609,649L609,619L490,619Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="550" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M446,687A15 15 0 0 0 461 671A15 15 0 0 0 446 656A15 15 0 0 0 431 671A15 15 0 0 0 446 687Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="671" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="461,671 472,667 472,676" style="fill:rgb(0,0,0)"/>
<path d="M609,634 L 616,634 Q 624,634 624,649 L 624,656 Q 624,671 609,671 L 482,671 L 467,671"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,671 L 271,671 Q 256,671 256,656 L 256,649 Q 256,634 264,634 L 271,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="624,692 619,680 628,680" style="fill:rgb(0,0,0)"/>
<path d="M624,656L624,686"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,558 648,547 656,547" style="fill:rgb(0,0,0)"/>
<path d="M607,520 L 637,520 Q 652,520 652,535 L 652,537 L 652,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,596 382,592 382,600" style="fill:rgb(0,0,0)"/>
<path d="M652,558 L 652,581 Q 652,596 637,596 L 391,596 L 376,596"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,634 142,638 142,629" style="fill:rgb(0,0,0)"/>
<path d="M371,596 L 142,596 Q 127,596 127,611 L 127,619 Q 127,634 137,634 L 147,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,558 122,547 131,547" style="fill:rgb(0,0,0)"/>
<path d="M127,505L127,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,709 359,714 359,705" style="fill:rgb(0,0,0)"/>
<path d="M127,558 L 127,694 Q 127,709 142,709 L 350,709 L 365,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,709 597,714 597,705" style="fill:rgb(0,0,0)"/>
<path d="M371,709L603,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,709 L 616,709 Q 624,709 624,717 L 624,724"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,800L194,800A15 15 0 0 0 209 785A15 15 0 0 0 194 770L142,770A15 15 0 0 0 127 785A15 15 0 0 0 142 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="245,785 234,789 234,781" style="fill:rgb(0,0,0)"/>
<path d="M209,785L239,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,800A15 15 0 0 0 275 785A15 15 0 0 0 260 770A15 15 0 0 0 245 785A15 15 0 0 0 260 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="311,785 300,789 300,781" style="fill:rgb(0,0,0)"/>
<path d="M275,785L306,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,800L361,800L361,770L311,770Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="397,785 385,789 385,781" style="fill:rgb(0,0,0)"/>
<path d="M361,785L391,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,800A15 15 0 0 0 427 785A15 15 0 0 0 412 770A15 15 0 0 0 397 785A15 15 0 0 0 412 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="412" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="609,785 597,789 597,781" style="fill:rgb(0,0,0)"/>
<path d="M427,785L603,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,785 L 616,785 Q 624,785 624,792 L 624,800"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,762A15 15 0 0 0 351 747A15 15 0 0 0 336 732A15 15 0 0 0 321 747A15 15 0 0 0 336 762Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="747" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M336,838A15 15 0 0 0 351 823A15 15 0 0 0 336 808A15 15 0 0 0 321 823A15 15 0 0 0 336 838Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="823" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="351,747 363,743 363,751" style="fill:rgb(0,0,0)"/>
<path d="M361,785 L 368,785 Q 376,785 376,770 L 376,762 Q 376,747 366,747 L 357,747"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,747 L 300,747 Q 285,747 285,762 L 285,770 Q 285,785 292,785 L 300,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,823 363,818 363,827" style="fill:rgb(0,0,0)"/>
<path d="M427,785 L 434,785 Q 442,785 442,800 L 442,808 Q 442,823 427,823 L 372,823 L 357,823"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,823 L 234,823 Q 219,823 219,808 L 219,800 Q 219,785 226,785 L 234,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,785 115,789 115,781" style="fill:rgb(0,0,0)"/>
<path d="M55,129 L 62,129 Q 70,129 70,144 L 70,770 Q 70,785 85,785 L 106,785 L 121,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,891L424,891L424,860L248,860Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="876" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="424,876 436,871 436,880" style="fill:rgb(0,0,0)"/>
<path d="M624,692 L 624,861 Q 624,876 609,876 L 445,876 L 430,876"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="6,197 10,208 2,208" style="fill:rgb(0,0,0)"/>
<path d="M248,876 L 21,876 Q 6,876 6,861 L 6,217 L 6,202"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M6,197 L 6,144 Q 6,129 21,129 L 40,129 L 55,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="667" y="275" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" transform="rotate(-90 667,285)" dominant-baseline="central">select-core</text>
<path d="M168,966L213,966A15 15 0 0 0 228 951A15 15 0 0 0 213 936L168,936A15 15 0 0 0 153 951A15 15 0 0 0 168 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="251,951 239,956 239,947" style="fill:rgb(0,0,0)"/>
<path d="M228,951L245,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,966L270,966A15 15 0 0 0 285 951A15 15 0 0 0 270 936L266,936A15 15 0 0 0 251 951A15 15 0 0 0 266 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M168,1072L202,1072A15 15 0 0 0 217 1057A15 15 0 0 0 202 1042L168,1042A15 15 0 0 0 153 1057A15 15 0 0 0 168 1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="240,1057 228,1061 228,1053" style="fill:rgb(0,0,0)"/>
<path d="M217,1057L234,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,1072L289,1072L289,1042L240,1042Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="330,951 319,956 319,947" style="fill:rgb(0,0,0)"/>
<path d="M285,951L324,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,966L460,966L460,936L330,936Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M395,1004A15 15 0 0 0 410 989A15 15 0 0 0 395 974A15 15 0 0 0 380 989A15 15 0 0 0 395 1004Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="989" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="410,989 422,985 422,993" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 468,951 Q 475,951 475,966 L 475,974 Q 475,989 460,989 L 431,989 L 416,989"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,989 L 322,989 Q 307,989 307,974 L 307,966 Q 307,951 313,951 L 319,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,913 348,909 348,918" style="fill:rgb(0,0,0)"/>
<path d="M624,860 L 624,898 Q 624,913 609,913 L 357,913 L 342,913"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,951 142,956 142,947" style="fill:rgb(0,0,0)"/>
<path d="M336,913 L 142,913 Q 127,913 127,928 L 127,936 Q 127,951 137,951 L 147,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,981 492,970 500,970" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 481,951 Q 496,951 496,963 L 496,976"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,1023 318,1019 318,1027" style="fill:rgb(0,0,0)"/>
<path d="M496,981 L 496,1008 Q 496,1023 481,1023 L 327,1023 L 312,1023"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,1057 142,1061 142,1053" style="fill:rgb(0,0,0)"/>
<path d="M307,1023 L 142,1023 Q 127,1023 127,1038 L 127,1042 Q 127,1057 137,1057 L 147,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,989 122,978 131,978" style="fill:rgb(0,0,0)"/>
<path d="M127,936L127,983"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,989L127,1042"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1102L415,1102A15 15 0 0 0 430 1087A15 15 0 0 0 415 1072L363,1072A15 15 0 0 0 348 1087A15 15 0 0 0 363 1102Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="389" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="453,1087 441,1092 441,1083" style="fill:rgb(0,0,0)"/>
<path d="M430,1087L447,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,1102L502,1102L502,1072L453,1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="525,1087 513,1092 513,1083" style="fill:rgb(0,0,0)"/>
<path d="M502,1087L519,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1140A15 15 0 0 0 378 1125A15 15 0 0 0 363 1110A15 15 0 0 0 348 1125A15 15 0 0 0 363 1140Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="1125" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="401,1125 390,1129 390,1121" style="fill:rgb(0,0,0)"/>
<path d="M378,1125L396,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,1140L451,1140L451,1110L401,1110Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="1125" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="312,1057 301,1061 301,1053" style="fill:rgb(0,0,0)"/>
<path d="M289,1057L306,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1125 337,1129 337,1121" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1110 Q 327,1125 335,1125 L 342,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1087 337,1092 337,1083" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1072 Q 327,1087 335,1087 L 342,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1057 513,1061 513,1053" style="fill:rgb(0,0,0)"/>
<path d="M312,1057L519,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="620,1155 609,1160 609,1151" style="fill:rgb(0,0,0)"/>
<path d="M525,1057 L 546,1057 Q 561,1057 561,1072 L 561,1140 Q 561,1155 576,1155 L 599,1155 L 614,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="624" cy="1155" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1087 L 546,1087 Q 561,1087 561,1095 L 561,1102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1125 513,1129 513,1121" style="fill:rgb(0,0,0)"/>
<path d="M451,1125L519,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1125 L 546,1125 Q 561,1125 561,1133 L 561,1140"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1155 513,1160 513,1151" style="fill:rgb(0,0,0)"/>
<path d="M127,1042 L 127,1140 Q 127,1155 142,1155 L 504,1155 L 519,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1155L597,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/common-table-expression.html">common-table-expression:</a></b>
<button id='x2600738a' onclick='hideorshow("x2600738a","x1c57bae3")'>show</button></p>
 <div id='x1c57bae3' style='display:none;' class='imgcontainer'>
 <div style="max-width:638px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 638.525 167.4">
<circle cx="5" cy="29" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,29 20,33 20,24" style="fill:rgb(0,0,0)"/>
<path d="M9,29L26,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,44L122,44A15 15 0 0 0 137 29A15 15 0 0 0 122 14L47,14A15 15 0 0 0 32 29A15 15 0 0 0 47 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="160,29 149,33 149,24" style="fill:rgb(0,0,0)"/>
<path d="M137,29L155,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="196,29 185,33 185,24" style="fill:rgb(0,0,0)"/>
<path d="M160,29L191,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,44A15 15 0 0 0 227 29A15 15 0 0 0 211 14A15 15 0 0 0 196 29A15 15 0 0 0 211 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="250,29 238,33 238,24" style="fill:rgb(0,0,0)"/>
<path d="M227,29L244,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="286,29 274,33 274,24" style="fill:rgb(0,0,0)"/>
<path d="M250,29L280,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,44L395,44A15 15 0 0 0 410 29A15 15 0 0 0 395 14L301,14A15 15 0 0 0 286 29A15 15 0 0 0 301 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="446,29 434,33 434,24" style="fill:rgb(0,0,0)"/>
<path d="M410,29L440,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,44A15 15 0 0 0 476 29A15 15 0 0 0 461 14A15 15 0 0 0 446 29A15 15 0 0 0 461 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,29 499,33 499,24" style="fill:rgb(0,0,0)"/>
<path d="M476,29L505,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,165L51,165A15 15 0 0 0 66 150A15 15 0 0 0 51 135L47,135A15 15 0 0 0 32 150A15 15 0 0 0 47 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="49" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<path d="M127,135L147,135A15 15 0 0 0 162 119A15 15 0 0 0 147 104L127,104A15 15 0 0 0 112 119A15 15 0 0 0 127 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<path d="M219,135L337,135A15 15 0 0 0 352 119A15 15 0 0 0 337 104L219,104A15 15 0 0 0 204 119A15 15 0 0 0 219 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<path d="M162,119L204,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,165A15 15 0 0 0 425 150A15 15 0 0 0 410 135A15 15 0 0 0 395 150A15 15 0 0 0 410 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="410" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="448,150 437,154 437,145" style="fill:rgb(0,0,0)"/>
<path d="M425,150L442,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,165L552,165L552,135L448,135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="500" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="575,150 564,154 564,145" style="fill:rgb(0,0,0)"/>
<path d="M552,150L570,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M591,165A15 15 0 0 0 606 150A15 15 0 0 0 591 135A15 15 0 0 0 575 150A15 15 0 0 0 591 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="629,150 617,154 617,145" style="fill:rgb(0,0,0)"/>
<path d="M606,150L623,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="632" cy="150" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,82A15 15 0 0 0 363 66A15 15 0 0 0 348 51A15 15 0 0 0 333 66A15 15 0 0 0 348 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="363,66 374,62 374,71" style="fill:rgb(0,0,0)"/>
<path d="M410,29 L 417,29 Q 425,29 425,44 L 425,51 Q 425,66 410,66 L 384,66 L 369,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M333,66 L 278,66 Q 263,66 263,51 L 263,44 Q 263,29 270,29 L 278,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,93 78,89 78,97" style="fill:rgb(0,0,0)"/>
<path d="M511,29 L 516,29 Q 522,29 522,44 L 522,78 Q 522,93 507,93 L 87,93 L 72,93"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,150 20,154 20,145" style="fill:rgb(0,0,0)"/>
<path d="M66,93 L 30,93 Q 15,93 15,108 L 15,135 Q 15,150 20,150 L 26,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="85,150 73,154 73,145" style="fill:rgb(0,0,0)"/>
<path d="M66,150L79,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="112,119 101,124 101,115" style="fill:rgb(0,0,0)"/>
<path d="M85,150 L 89,150 Q 92,150 92,135 L 92,134 Q 92,119 99,119 L 106,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="204,119 192,124 192,115" style="fill:rgb(0,0,0)"/>
<path d="M66,150 L 147,150 Q 162,150 170,150 Q 177,150 177,135 L 177,134 Q 177,119 188,119 L 198,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,150 383,154 383,145" style="fill:rgb(0,0,0)"/>
<path d="M352,119 L 360,119 Q 367,119 367,134 L 367,135 Q 367,150 378,150 L 389,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150L395,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,6 336,10 336,2" style="fill:rgb(0,0,0)"/>
<path d="M160,29 L 168,29 Q 175,29 175,17 Q 175,6 190,6 L 327,6 L 342,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,6 L 473,6 Q 488,6 488,17 Q 488,29 495,29 L 503,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/compound-operator.html">compound-operator:</a></b>
<button id='xd634cb53' onclick='hideorshow("xd634cb53","x3845c529")'>show</button></p>
 <div id='x3845c529' style='display:none;' class='imgcontainer'>
 <div style="max-width:293px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 293.842 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L127,32A15 15 0 0 0 142 17A15 15 0 0 0 127 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,70L127,70A15 15 0 0 0 142 55L142,55A15 15 0 0 0 127 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,108L168,108A15 15 0 0 0 183 92A15 15 0 0 0 168 77L83,77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M83,145L135,145A15 15 0 0 0 150 130A15 15 0 0 0 135 115L83,115A15 15 0 0 0 68 130A15 15 0 0 0 83 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M142,55L159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70L195,70A15 15 0 0 0 210 55L210,55A15 15 0 0 0 195 39L180,39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="233,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M210,55L227,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,17 272,21 272,12" style="fill:rgb(0,0,0)"/>
<path d="M233,55 L 240,55 Q 248,55 248,40 L 248,32 Q 248,17 263,17 L 263,17 L 278,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="288" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M47,39 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,92 221,97 221,88" style="fill:rgb(0,0,0)"/>
<path d="M183,92L227,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,92 L 240,92 Q 248,92 248,77 L 248,54 L 248,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,130 56,135 56,126" style="fill:rgb(0,0,0)"/>
<path d="M47,77 L 47,115 Q 47,130 55,130 L 62,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,130 221,135 221,126" style="fill:rgb(0,0,0)"/>
<path d="M150,130L227,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,130 L 240,130 Q 248,130 248,115 L 248,92 L 248,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/expr.html">expr:</a></b>
<button id='x5676f734' onclick='hideorshow("x5676f734","xa46e4e32")'>show</button></p>
 <div id='xa46e4e32' style='display:none;' class='imgcontainer'>
 <div style="max-width:963px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 963.96 1068.77">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L158,32L158,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="101" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="954,17 943,21 943,12" style="fill:rgb(0,0,0)"/>
<path d="M158,17L948,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="958" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L172,70A15 15 0 0 0 187 55L187,55A15 15 0 0 0 172 39L60,39A15 15 0 0 0 45 55L45,55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">bind-parameter</text>
<polygon points="916,55 905,59 905,50" style="fill:rgb(0,0,0)"/>
<path d="M187,55L910,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,55 L 924,55 Q 931,55 931,47 L 931,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 31,55 L 39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,130L156,130A15 15 0 0 0 171 115A15 15 0 0 0 156 100L60,100A15 15 0 0 0 45 115A15 15 0 0 0 60 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,115 183,119 183,111" style="fill:rgb(0,0,0)"/>
<path d="M171,115L189,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,130A15 15 0 0 0 225 115A15 15 0 0 0 210 100A15 15 0 0 0 195 115A15 15 0 0 0 210 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M225,115L255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130L351,130A15 15 0 0 0 366 115A15 15 0 0 0 351 100L276,100A15 15 0 0 0 261 115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="389,115 378,119 378,111" style="fill:rgb(0,0,0)"/>
<path d="M366,115L383,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,130A15 15 0 0 0 419 115A15 15 0 0 0 404 100A15 15 0 0 0 389 115A15 15 0 0 0 404 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="404" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="455,115 444,119 444,111" style="fill:rgb(0,0,0)"/>
<path d="M419,115L450,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,130L565,130A15 15 0 0 0 580 115A15 15 0 0 0 565 100L471,100A15 15 0 0 0 455 115A15 15 0 0 0 471 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="916,115 905,119 905,111" style="fill:rgb(0,0,0)"/>
<path d="M580,115L910,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,115 L 924,115 Q 931,115 931,108 L 931,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,115 33,119 33,111" style="fill:rgb(0,0,0)"/>
<path d="M24,100 L 24,108 Q 24,115 31,115 L 39,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,89 97,93 97,84" style="fill:rgb(0,0,0)"/>
<path d="M24,74 L 24,81 Q 24,89 39,89 L 87,89 L 102,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 302,93 302,84" style="fill:rgb(0,0,0)"/>
<path d="M108,89 L 129,89 Q 144,89 159,89 L 293,89 L 308,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,89 L 414,89 Q 429,89 429,102 Q 429,115 436,115 L 444,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M223,89 L 230,89 Q 238,89 238,102 Q 238,115 245,115 L 253,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,168L168,168A15 15 0 0 0 183 153A15 15 0 0 0 168 138L60,138A15 15 0 0 0 45 153A15 15 0 0 0 60 168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">unary-operator</text>
<polygon points="206,153 194,157 194,149" style="fill:rgb(0,0,0)"/>
<path d="M183,153L200,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,168L255,168L255,138L206,138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,153 905,157 905,149" style="fill:rgb(0,0,0)"/>
<path d="M255,153L910,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,153 L 924,153 Q 931,153 931,145 L 931,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,153 33,157 33,149" style="fill:rgb(0,0,0)"/>
<path d="M24,138 L 24,145 Q 24,153 31,153 L 39,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,206L94,206L94,176L45,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,191 106,195 106,186" style="fill:rgb(0,0,0)"/>
<path d="M94,191L111,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,206L245,206A15 15 0 0 0 261 191A15 15 0 0 0 245 176L132,176A15 15 0 0 0 117 191A15 15 0 0 0 132 206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">binary-operator</text>
<polygon points="284,191 272,195 272,186" style="fill:rgb(0,0,0)"/>
<path d="M261,191L278,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,206L333,206L333,176L284,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="308" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,191 905,195 905,186" style="fill:rgb(0,0,0)"/>
<path d="M333,191L910,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,191 L 924,191 Q 931,191 931,183 L 931,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,191 33,195 33,186" style="fill:rgb(0,0,0)"/>
<path d="M24,176 L 24,183 Q 24,191 31,191 L 39,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,245L162,245A15 15 0 0 0 177 230A15 15 0 0 0 162 215L60,215A15 15 0 0 0 45 230A15 15 0 0 0 60 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="111" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-name</text>
<polygon points="194,230 183,234 183,226" style="fill:rgb(0,0,0)"/>
<path d="M177,230L188,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,245A15 15 0 0 0 224 230A15 15 0 0 0 209 215A15 15 0 0 0 194 230A15 15 0 0 0 209 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="260,230 249,234 249,226" style="fill:rgb(0,0,0)"/>
<path d="M224,230L255,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,245L437,245L437,215L260,215Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-arguments</text>
<polygon points="473,230 461,234 461,226" style="fill:rgb(0,0,0)"/>
<path d="M437,230L467,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,245A15 15 0 0 0 503 230A15 15 0 0 0 488 215A15 15 0 0 0 473 230A15 15 0 0 0 488 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="541,260 529,265 529,256" style="fill:rgb(0,0,0)"/>
<path d="M503,230 L 510,230 Q 518,230 518,245 L 518,245 Q 518,260 527,260 L 535,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,275L653,275L653,245L541,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="691,230 680,234 680,226" style="fill:rgb(0,0,0)"/>
<path d="M653,260 L 661,260 Q 668,260 668,245 L 668,245 Q 668,230 677,230 L 685,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="729,260 718,265 718,256" style="fill:rgb(0,0,0)"/>
<path d="M691,230 L 699,230 Q 706,230 706,245 L 706,245 Q 706,260 715,260 L 723,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,275L837,275L837,245L729,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="783" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">over-clause</text>
<polygon points="916,260 905,265 905,256" style="fill:rgb(0,0,0)"/>
<path d="M837,260L910,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,260 L 924,260 Q 931,260 931,253 L 931,245"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,230 33,234 33,226" style="fill:rgb(0,0,0)"/>
<path d="M24,215 L 24,222 Q 24,230 31,230 L 39,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,230 585,234 585,226" style="fill:rgb(0,0,0)"/>
<path d="M503,230L591,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,230L680,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,230 905,234 905,226" style="fill:rgb(0,0,0)"/>
<path d="M691,230L910,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,230 L 924,230 Q 931,230 931,222 L 931,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,321A15 15 0 0 0 75 306A15 15 0 0 0 60 290A15 15 0 0 0 45 306A15 15 0 0 0 60 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,306 100,310 100,301" style="fill:rgb(0,0,0)"/>
<path d="M75,306L105,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M111,321L160,321L160,290L111,290Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="306" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="196,306 185,310 185,301" style="fill:rgb(0,0,0)"/>
<path d="M160,306L191,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,321A15 15 0 0 0 227 306A15 15 0 0 0 211 290A15 15 0 0 0 196 306A15 15 0 0 0 211 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,306 905,310 905,301" style="fill:rgb(0,0,0)"/>
<path d="M227,306L910,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,306 L 924,306 Q 931,306 931,298 L 931,291"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,306 33,310 33,301" style="fill:rgb(0,0,0)"/>
<path d="M24,290 L 24,298 Q 24,306 31,306 L 39,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,284A15 15 0 0 0 151 269A15 15 0 0 0 136 254A15 15 0 0 0 121 269A15 15 0 0 0 136 284Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="269" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="151,269 162,265 162,274" style="fill:rgb(0,0,0)"/>
<path d="M160,306 L 168,306 Q 175,306 175,291 L 175,284 Q 175,269 166,269 L 157,269"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,269 L 103,269 Q 88,269 88,284 L 88,291 Q 88,306 96,306 L 103,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,358L88,358A15 15 0 0 0 103 343A15 15 0 0 0 88 328L60,328A15 15 0 0 0 45 343A15 15 0 0 0 60 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CAST</text>
<polygon points="126,343 114,348 114,339" style="fill:rgb(0,0,0)"/>
<path d="M103,343L120,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M141,358A15 15 0 0 0 156 343A15 15 0 0 0 141 328A15 15 0 0 0 126 343A15 15 0 0 0 141 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="179,343 168,348 168,339" style="fill:rgb(0,0,0)"/>
<path d="M156,343L173,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,358L228,358L228,328L179,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="251,343 240,348 240,339" style="fill:rgb(0,0,0)"/>
<path d="M228,343L246,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,358L271,358A15 15 0 0 0 286 343A15 15 0 0 0 271 328L267,328A15 15 0 0 0 251 343A15 15 0 0 0 267 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="269" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="309,343 297,348 297,339" style="fill:rgb(0,0,0)"/>
<path d="M286,343L303,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,358L408,358L408,328L309,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="358" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="431,343 419,348 419,339" style="fill:rgb(0,0,0)"/>
<path d="M408,343L425,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M446,358A15 15 0 0 0 461 343A15 15 0 0 0 446 328A15 15 0 0 0 431 343A15 15 0 0 0 446 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,343 905,348 905,339" style="fill:rgb(0,0,0)"/>
<path d="M461,343L910,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,343 L 924,343 Q 931,343 931,336 L 931,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,343 33,348 33,339" style="fill:rgb(0,0,0)"/>
<path d="M24,328 L 24,336 Q 24,343 31,343 L 39,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,396L94,396L94,366L45,366Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,381 106,385 106,377" style="fill:rgb(0,0,0)"/>
<path d="M94,381L111,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,396L196,396A15 15 0 0 0 211 381A15 15 0 0 0 196 366L132,366A15 15 0 0 0 117 381A15 15 0 0 0 132 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="234,381 223,385 223,377" style="fill:rgb(0,0,0)"/>
<path d="M211,381L229,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,396L355,396A15 15 0 0 0 370 381A15 15 0 0 0 355 366L250,366A15 15 0 0 0 234 381A15 15 0 0 0 250 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="916,381 905,385 905,377" style="fill:rgb(0,0,0)"/>
<path d="M370,381L910,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,381 L 924,381 Q 931,381 931,374 L 931,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,381 33,385 33,377" style="fill:rgb(0,0,0)"/>
<path d="M24,366 L 24,374 Q 24,381 31,381 L 39,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,434L94,434L94,404L45,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,419 119,423 119,415" style="fill:rgb(0,0,0)"/>
<path d="M94,419L124,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,434L165,434A15 15 0 0 0 180 419A15 15 0 0 0 165 404L145,404A15 15 0 0 0 130 419A15 15 0 0 0 145 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="234,419 223,423 223,415" style="fill:rgb(0,0,0)"/>
<path d="M180,419L229,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,434L273,434A15 15 0 0 0 288 419A15 15 0 0 0 273 404L250,404A15 15 0 0 0 234 419A15 15 0 0 0 250 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIKE</text>
<path d="M250,472L279,472A15 15 0 0 0 294 457A15 15 0 0 0 279 442L250,442A15 15 0 0 0 234 457A15 15 0 0 0 250 472Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="457" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GLOB</text>
<path d="M250,510L302,510A15 15 0 0 0 317 495A15 15 0 0 0 302 479L250,479A15 15 0 0 0 234 495A15 15 0 0 0 250 510Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REGEXP</text>
<path d="M250,547L297,547A15 15 0 0 0 313 532A15 15 0 0 0 297 517L250,517A15 15 0 0 0 234 532A15 15 0 0 0 250 547Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="274" y="532" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<path d="M378,510L427,510L427,479L378,479Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M378,434L427,434L427,404L378,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="465,449 454,454 454,445" style="fill:rgb(0,0,0)"/>
<path d="M427,419 L 435,419 Q 442,419 442,434 L 442,434 Q 442,449 451,449 L 460,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,464L532,464A15 15 0 0 0 547 449A15 15 0 0 0 532 434L480,434A15 15 0 0 0 465 449A15 15 0 0 0 480 464Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="506" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ESCAPE</text>
<polygon points="570,449 559,454 559,445" style="fill:rgb(0,0,0)"/>
<path d="M547,449L565,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M570,464L620,464L620,434L570,434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="595" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="671,419 659,423 659,415" style="fill:rgb(0,0,0)"/>
<path d="M620,449 L 627,449 Q 635,449 635,434 L 635,434 Q 635,419 650,419 L 650,419 L 665,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,419 905,423 905,415" style="fill:rgb(0,0,0)"/>
<path d="M671,419L910,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,419 L 924,419 Q 931,419 931,411 L 931,404"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,419 33,423 33,415" style="fill:rgb(0,0,0)"/>
<path d="M24,404 L 24,411 Q 24,419 31,419 L 39,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M100,419 L 108,419 Q 115,419 115,434 L 115,434 Q 115,449 130,449 L 177,449 Q 192,449 192,434 L 192,434 Q 192,419 199,419 L 207,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,532 223,537 223,528" style="fill:rgb(0,0,0)"/>
<path d="M196,419 L 204,419 Q 211,419 211,434 L 211,517 Q 211,532 220,532 L 229,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,457 223,461 223,452" style="fill:rgb(0,0,0)"/>
<path d="M211,442 L 211,449 Q 211,457 220,457 L 229,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,495 223,499 223,490" style="fill:rgb(0,0,0)"/>
<path d="M211,479 L 211,487 Q 211,495 220,495 L 229,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,419 367,423 367,415" style="fill:rgb(0,0,0)"/>
<path d="M288,419L372,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,532 329,537 329,528" style="fill:rgb(0,0,0)"/>
<path d="M313,532L334,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,495 367,499 367,490" style="fill:rgb(0,0,0)"/>
<path d="M340,532 L 348,532 Q 355,532 355,517 L 355,510 Q 355,495 364,495 L 372,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,495 329,499 329,490" style="fill:rgb(0,0,0)"/>
<path d="M317,495L334,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,495L378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,457 329,461 329,452" style="fill:rgb(0,0,0)"/>
<path d="M294,457L334,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,457 L 348,457 Q 355,457 355,472 L 355,480 Q 355,495 367,495 L 378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="506,419 495,423 495,415" style="fill:rgb(0,0,0)"/>
<path d="M427,419L501,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M506,419L659,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="547,495 536,499 536,490" style="fill:rgb(0,0,0)"/>
<path d="M427,495L542,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,495 L 656,495 Q 671,495 671,480 L 671,434 Q 671,419 686,419 L 692,419 L 707,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,585L94,585L94,555L45,555Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,570 119,574 119,566" style="fill:rgb(0,0,0)"/>
<path d="M94,570L124,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,585L194,585A15 15 0 0 0 209 570A15 15 0 0 0 194 555L145,555A15 15 0 0 0 130 570A15 15 0 0 0 145 585Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="170" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ISNULL</text>
<polygon points="916,570 905,574 905,566" style="fill:rgb(0,0,0)"/>
<path d="M209,570L910,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,570 L 924,570 Q 931,570 931,563 L 931,555"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,570 33,574 33,566" style="fill:rgb(0,0,0)"/>
<path d="M24,555 L 24,563 Q 24,570 31,570 L 39,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,623L215,623A15 15 0 0 0 230 608A15 15 0 0 0 215 593L145,593A15 15 0 0 0 130 608A15 15 0 0 0 145 623Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="608" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTNULL</text>
<path d="M145,661L165,661A15 15 0 0 0 180 646A15 15 0 0 0 165 631L145,631A15 15 0 0 0 130 646A15 15 0 0 0 145 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="203,646 192,650 192,641" style="fill:rgb(0,0,0)"/>
<path d="M180,646L198,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,661L250,661A15 15 0 0 0 265 646A15 15 0 0 0 250 631L219,631A15 15 0 0 0 203 646A15 15 0 0 0 219 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="288,646 276,650 276,641" style="fill:rgb(0,0,0)"/>
<path d="M265,646L282,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="339,570 327,574 327,566" style="fill:rgb(0,0,0)"/>
<path d="M288,646 L 295,646 Q 303,646 303,631 L 303,585 Q 303,570 318,570 L 318,570 L 333,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="288,608 276,612 276,604" style="fill:rgb(0,0,0)"/>
<path d="M230,608L282,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,608 L 295,608 Q 303,608 303,600 L 303,593"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,646 119,650 119,641" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,631 Q 109,646 117,646 L 124,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,608 119,612 119,604" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,593 Q 109,608 117,608 L 124,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,699L94,699L94,668L45,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,684 106,688 106,679" style="fill:rgb(0,0,0)"/>
<path d="M94,684L111,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,699A15 15 0 0 0 147 684A15 15 0 0 0 132 668A15 15 0 0 0 117 684A15 15 0 0 0 132 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IS</text>
<polygon points="183,684 172,688 172,679" style="fill:rgb(0,0,0)"/>
<path d="M147,684L178,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M198,699L219,699A15 15 0 0 0 234 684A15 15 0 0 0 219 668L198,668A15 15 0 0 0 183 684A15 15 0 0 0 198 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="270,684 258,688 258,679" style="fill:rgb(0,0,0)"/>
<path d="M234,684L264,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="306,684 294,688 294,679" style="fill:rgb(0,0,0)"/>
<path d="M270,684L300,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,699L389,699A15 15 0 0 0 404 684A15 15 0 0 0 389 668L321,668A15 15 0 0 0 306 684A15 15 0 0 0 321 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="440,684 429,688 429,679" style="fill:rgb(0,0,0)"/>
<path d="M404,684L434,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,699L490,699A15 15 0 0 0 505 684A15 15 0 0 0 490 668L455,668A15 15 0 0 0 440 684A15 15 0 0 0 455 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="541,684 530,688 530,679" style="fill:rgb(0,0,0)"/>
<path d="M505,684L535,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,699L590,699L590,668L541,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,684 905,688 905,679" style="fill:rgb(0,0,0)"/>
<path d="M590,684L910,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,684 L 924,684 Q 931,684 931,676 L 931,669"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,684 33,688 33,679" style="fill:rgb(0,0,0)"/>
<path d="M24,668 L 24,676 Q 24,684 31,684 L 39,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,684 L 156,684 Q 164,684 164,696 Q 164,708 179,708 L 230,708 Q 245,708 245,696 Q 245,684 253,684 L 260,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,684 L 279,684 Q 286,684 286,696 Q 286,708 301,708 L 502,708 Q 517,708 517,696 Q 517,684 524,684 L 532,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,744L94,744L94,714L45,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,729 119,733 119,725" style="fill:rgb(0,0,0)"/>
<path d="M94,729L124,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,744L165,744A15 15 0 0 0 180 729A15 15 0 0 0 165 714L145,714A15 15 0 0 0 130 729A15 15 0 0 0 145 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,729 205,733 205,725" style="fill:rgb(0,0,0)"/>
<path d="M180,729L211,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,744L304,744A15 15 0 0 0 319 729A15 15 0 0 0 304 714L232,714A15 15 0 0 0 216 729A15 15 0 0 0 232 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="342,729 331,733 331,725" style="fill:rgb(0,0,0)"/>
<path d="M319,729L336,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M342,744L391,744L391,714L342,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="367" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="414,729 403,733 403,725" style="fill:rgb(0,0,0)"/>
<path d="M391,729L409,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M430,744L450,744A15 15 0 0 0 465 729A15 15 0 0 0 450 714L430,714A15 15 0 0 0 414 729A15 15 0 0 0 430 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="488,729 477,733 477,725" style="fill:rgb(0,0,0)"/>
<path d="M465,729L483,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,744L538,744L538,714L488,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="513" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,729 905,733 905,725" style="fill:rgb(0,0,0)"/>
<path d="M538,729L910,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,729 L 924,729 Q 931,729 931,721 L 931,714"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,729 33,733 33,725" style="fill:rgb(0,0,0)"/>
<path d="M24,714 L 24,721 Q 24,729 31,729 L 39,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,729 L 103,729 Q 110,729 110,741 Q 110,753 125,753 L 177,753 Q 192,753 192,741 Q 192,729 199,729 L 207,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,797L94,797L94,767L45,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,782 119,786 119,778" style="fill:rgb(0,0,0)"/>
<path d="M94,782L124,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,797L165,797A15 15 0 0 0 180 782A15 15 0 0 0 165 767L145,767A15 15 0 0 0 130 782A15 15 0 0 0 145 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,782 205,786 205,778" style="fill:rgb(0,0,0)"/>
<path d="M180,782L211,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,797L234,797A15 15 0 0 0 249 782A15 15 0 0 0 234 767L232,767A15 15 0 0 0 216 782A15 15 0 0 0 232 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IN</text>
<polygon points="285,782 273,786 273,778" style="fill:rgb(0,0,0)"/>
<path d="M249,782L279,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,797A15 15 0 0 0 315 782A15 15 0 0 0 300 767A15 15 0 0 0 285 782A15 15 0 0 0 300 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,782 340,786 340,778" style="fill:rgb(0,0,0)"/>
<path d="M315,782L345,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,797L455,797L455,767L351,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="491,782 480,786 480,778" style="fill:rgb(0,0,0)"/>
<path d="M455,782L486,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M507,797A15 15 0 0 0 522 782A15 15 0 0 0 507 767A15 15 0 0 0 491 782A15 15 0 0 0 507 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="507" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,782 905,786 905,778" style="fill:rgb(0,0,0)"/>
<path d="M522,782L910,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,782 L 924,782 Q 931,782 931,774 L 931,767"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,782 33,786 33,778" style="fill:rgb(0,0,0)"/>
<path d="M24,767 L 24,774 Q 24,782 31,782 L 39,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,782 L 103,782 Q 110,782 110,794 Q 110,806 125,806 L 177,806 Q 192,806 192,794 Q 192,782 199,782 L 207,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,782 L 324,782 Q 332,782 332,770 Q 332,758 347,758 L 452,758 Q 467,758 467,770 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M379,835L428,835L428,805L379,805Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="820" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="379,820 367,824 367,815" style="fill:rgb(0,0,0)"/>
<path d="M317,782 L 324,782 Q 332,782 332,797 L 332,805 Q 332,820 347,820 L 358,820 L 373,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M428,820 L 452,820 Q 467,820 467,805 L 467,797 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,873A15 15 0 0 0 418 857A15 15 0 0 0 403 842A15 15 0 0 0 388 857A15 15 0 0 0 403 873Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="857" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,857 430,853 430,862" style="fill:rgb(0,0,0)"/>
<path d="M428,820 L 435,820 Q 443,820 443,835 L 443,842 Q 443,857 434,857 L 424,857"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,857 L 371,857 Q 356,857 356,842 L 356,835 Q 356,820 363,820 L 371,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,925L396,925A15 15 0 0 0 412 910A15 15 0 0 0 396 895L300,895A15 15 0 0 0 285 910A15 15 0 0 0 300 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="429,910 417,915 417,906" style="fill:rgb(0,0,0)"/>
<path d="M412,910L423,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,925A15 15 0 0 0 459 910A15 15 0 0 0 444 895A15 15 0 0 0 429 910A15 15 0 0 0 444 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="513,910 502,915 502,906" style="fill:rgb(0,0,0)"/>
<path d="M459,910L507,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,925L627,925A15 15 0 0 0 642 910A15 15 0 0 0 627 895L528,895A15 15 0 0 0 513 910A15 15 0 0 0 528 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="577" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function</text>
<polygon points="659,910 647,915 647,906" style="fill:rgb(0,0,0)"/>
<path d="M642,910L653,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,925A15 15 0 0 0 689 910A15 15 0 0 0 674 895A15 15 0 0 0 659 910A15 15 0 0 0 674 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="734,910 723,915 723,906" style="fill:rgb(0,0,0)"/>
<path d="M689,910L728,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,925L783,925L783,895L734,895Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="828,910 817,915 817,906" style="fill:rgb(0,0,0)"/>
<path d="M783,910L823,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M844,925A15 15 0 0 0 859 910A15 15 0 0 0 844 895A15 15 0 0 0 828 910A15 15 0 0 0 844 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="844" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,910 905,915 905,906" style="fill:rgb(0,0,0)"/>
<path d="M859,910L910,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,910 L 924,910 Q 931,910 931,903 L 931,895"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,865L603,865A15 15 0 0 0 619 850A15 15 0 0 0 603 835L528,835A15 15 0 0 0 513 850A15 15 0 0 0 528 865Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="850" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="916,850 905,854 905,846" style="fill:rgb(0,0,0)"/>
<path d="M619,850L910,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,850 L 924,850 Q 931,850 931,842 L 931,835"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="513,850 502,854 502,846" style="fill:rgb(0,0,0)"/>
<path d="M475,910 L 483,910 Q 490,910 490,895 L 490,865 Q 490,850 499,850 L 507,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,892A15 15 0 0 0 774 877A15 15 0 0 0 759 862A15 15 0 0 0 744 877A15 15 0 0 0 759 892Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="877" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="774,877 785,873 785,881" style="fill:rgb(0,0,0)"/>
<path d="M783,910 L 791,910 Q 798,910 798,895 L 798,892 Q 798,877 789,877 L 780,877"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M744,877 L 726,877 Q 711,877 711,892 L 711,895 Q 711,910 719,910 L 726,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M689,910 L 697,910 Q 704,910 704,921 Q 704,932 719,932 L 790,932 Q 805,932 805,921 Q 805,910 813,910 L 820,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="285,910 273,915 273,906" style="fill:rgb(0,0,0)"/>
<path d="M249,782 L 256,782 Q 264,782 264,797 L 264,895 Q 264,910 272,910 L 279,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,882 412,886 412,877" style="fill:rgb(0,0,0)"/>
<path d="M264,867 L 264,874 Q 264,882 279,882 L 402,882 L 417,882"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,882 L 456,882 Q 471,882 471,896 Q 471,910 478,910 L 486,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,971L80,971A15 15 0 0 0 95 956A15 15 0 0 0 80 941L60,941A15 15 0 0 0 45 956A15 15 0 0 0 60 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="131,956 120,960 120,951" style="fill:rgb(0,0,0)"/>
<path d="M95,956L125,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,971L191,971A15 15 0 0 0 206 956A15 15 0 0 0 191 941L146,941A15 15 0 0 0 131 956A15 15 0 0 0 146 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="242,956 231,960 231,951" style="fill:rgb(0,0,0)"/>
<path d="M206,956L236,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,971A15 15 0 0 0 272 956A15 15 0 0 0 257 941A15 15 0 0 0 242 956A15 15 0 0 0 257 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="295,956 284,960 284,951" style="fill:rgb(0,0,0)"/>
<path d="M272,956L290,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,971L400,971L400,941L295,941Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="423,956 411,960 411,951" style="fill:rgb(0,0,0)"/>
<path d="M400,956L417,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,971A15 15 0 0 0 453 956A15 15 0 0 0 438 941A15 15 0 0 0 423 956A15 15 0 0 0 438 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,956 905,960 905,951" style="fill:rgb(0,0,0)"/>
<path d="M453,956L910,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,956 L 924,956 Q 931,956 931,948 L 931,941"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,956 33,960 33,951" style="fill:rgb(0,0,0)"/>
<path d="M24,941 L 24,948 Q 24,956 31,956 L 39,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,929 59,934 59,925" style="fill:rgb(0,0,0)"/>
<path d="M24,914 L 24,922 Q 24,929 39,929 L 49,929 L 64,929"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,929 L 201,929 Q 216,929 216,943 Q 216,956 223,956 L 231,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,929 L 101,929 Q 108,929 108,943 Q 108,956 116,956 L 123,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,1009L89,1009A15 15 0 0 0 104 994A15 15 0 0 0 89 978L60,978A15 15 0 0 0 45 994A15 15 0 0 0 60 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASE</text>
<polygon points="140,994 128,998 128,989" style="fill:rgb(0,0,0)"/>
<path d="M104,994L134,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M140,1009L189,1009L189,978L140,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="243,994 232,998 232,989" style="fill:rgb(0,0,0)"/>
<path d="M189,994L237,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,1009L298,1009A15 15 0 0 0 313 994A15 15 0 0 0 298 978L258,978A15 15 0 0 0 243 994A15 15 0 0 0 258 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="336,994 324,998 324,989" style="fill:rgb(0,0,0)"/>
<path d="M313,994L330,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,1009L385,1009L385,978L336,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="408,994 396,998 396,989" style="fill:rgb(0,0,0)"/>
<path d="M385,994L402,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,1009L456,1009A15 15 0 0 0 472 994A15 15 0 0 0 456 978L423,978A15 15 0 0 0 408 994A15 15 0 0 0 423 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">THEN</text>
<polygon points="495,994 483,998 483,989" style="fill:rgb(0,0,0)"/>
<path d="M472,994L489,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M495,1009L544,1009L544,978L495,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="616,994 604,998 604,989" style="fill:rgb(0,0,0)"/>
<path d="M544,994L610,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M631,1009L658,1009A15 15 0 0 0 673 994A15 15 0 0 0 658 978L631,978A15 15 0 0 0 616 994A15 15 0 0 0 631 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="645" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ELSE</text>
<polygon points="696,994 685,998 685,989" style="fill:rgb(0,0,0)"/>
<path d="M673,994L691,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M696,1009L746,1009L746,978L696,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="721" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="782,994 770,998 770,989" style="fill:rgb(0,0,0)"/>
<path d="M746,994L776,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M797,1009L818,1009A15 15 0 0 0 833 994A15 15 0 0 0 818 978L797,978A15 15 0 0 0 782 994A15 15 0 0 0 797 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="807" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="916,994 905,998 905,989" style="fill:rgb(0,0,0)"/>
<path d="M833,994L910,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,994 L 924,994 Q 931,994 931,986 L 931,979"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,994 33,998 33,989" style="fill:rgb(0,0,0)"/>
<path d="M24,978 L 24,986 Q 24,994 31,994 L 39,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,994 L 111,994 Q 119,994 119,1007 Q 119,1021 134,1021 L 186,1021 Q 201,1021 201,1007 Q 201,994 208,994 L 216,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="360,1021 372,1016 372,1025" style="fill:rgb(0,0,0)"/>
<path d="M544,994 L 551,994 Q 559,994 559,1007 Q 559,1021 544,1021 L 381,1021 L 366,1021"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,1021 L 235,1021 Q 220,1021 220,1007 Q 220,994 227,994 L 235,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,994 L 585,994 Q 593,994 593,1007 Q 593,1021 608,1021 L 742,1021 Q 757,1021 757,1007 Q 757,994 765,994 L 772,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,1066L173,1066L173,1036L45,1036Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="1051" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">raise-function</text>
<polygon points="916,1051 905,1055 905,1047" style="fill:rgb(0,0,0)"/>
<path d="M173,1051L910,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,1051 L 924,1051 Q 931,1051 931,1036 L 931,32 Q 931,17 939,17 L 946,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,1051 33,1055 33,1047" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,1036 Q 24,1051 31,1051 L 39,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/filter-clause.html">filter-clause:</a></b>
<button id='x3ab543d8' onclick='hideorshow("x3ab543d8","x10cdc471")'>show</button></p>
 <div id='x10cdc471' style='display:none;' class='imgcontainer'>
 <div style="max-width:422px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 422.381 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L93,32A15 15 0 0 0 108 17A15 15 0 0 0 93 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FILTER</text>
<polygon points="131,17 119,21 119,12" style="fill:rgb(0,0,0)"/>
<path d="M108,17L125,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,32L146,32A15 15 0 0 0 161 17A15 15 0 0 0 146 2L146,2A15 15 0 0 0 131 17A15 15 0 0 0 146 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="184,17 173,21 173,12" style="fill:rgb(0,0,0)"/>
<path d="M161,17L178,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M199,32L249,32A15 15 0 0 0 264 17A15 15 0 0 0 249 2L199,2A15 15 0 0 0 184 17A15 15 0 0 0 199 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="224" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="287,17 275,21 275,12" style="fill:rgb(0,0,0)"/>
<path d="M264,17L281,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,32L336,32L336,2L287,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M336,17L353,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,32A15 15 0 0 0 389 17A15 15 0 0 0 374 2A15 15 0 0 0 359 17A15 15 0 0 0 374 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="374" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="413,17 401,21 401,12" style="fill:rgb(0,0,0)"/>
<path d="M389,17L407,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="416" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/function-arguments.html">function-arguments:</a></b>
<button id='xe029fd7b' onclick='hideorshow("xe029fd7b","xd755dca7")'>show</button></p>
 <div id='xd755dca7' style='display:none;' class='imgcontainer'>
 <div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.566 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,26 55,30 55,22" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,41 L 43,41 Q 43,26 52,26 L 61,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M82,41L150,41A15 15 0 0 0 165 26L165,26A15 15 0 0 0 150 11L82,11A15 15 0 0 0 66 26L66,26A15 15 0 0 0 82 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="183,26 171,30 171,22" style="fill:rgb(0,0,0)"/>
<path d="M165,26L177,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M183,26 L 189,26 Q 194,26 194,41 L 194,41 Q 194,56 203,56 L 212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M218,56L248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,71L303,71L303,41L254,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="447,56 435,60 435,52" style="fill:rgb(0,0,0)"/>
<path d="M303,56L441,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="116,56 104,60 104,52" style="fill:rgb(0,0,0)"/>
<path d="M32,56L110,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M116,56L212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,32A15 15 0 0 0 293 17A15 15 0 0 0 278 2A15 15 0 0 0 263 17A15 15 0 0 0 278 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="293,17 305,12 305,21" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 314,56 Q 326,56 326,41 L 326,32 Q 326,17 312,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M263,17 L 245,17 Q 230,17 230,32 L 230,41 Q 230,56 239,56 L 248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,207A15 15 0 0 0 243 192L243,192A15 15 0 0 0 228 177A15 15 0 0 0 213 192L213,192A15 15 0 0 0 228 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="213,192 201,196 201,188" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,71 L 43,177 Q 43,192 58,192 L 192,192 L 207,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,192 267,196 267,188" style="fill:rgb(0,0,0)"/>
<path d="M243,192L272,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,192 L 360,192 Q 375,192 390,192 L 394,192 Q 409,192 409,177 L 409,71 Q 409,56 415,56 L 421,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="228,216 216,221 216,212" style="fill:rgb(0,0,0)"/>
<path d="M116,192 L 181,192 Q 196,192 196,204 Q 196,216 209,216 L 222,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,216 L 242,216 Q 257,216 257,204 Q 257,192 262,192 L 268,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="90,117 78,121 78,112" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 313,56 Q 323,56 323,71 L 323,71 Q 323,86 308,86 L 81,86 Q 66,86 66,101 L 66,102 Q 66,117 75,117 L 84,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,132L149,132A15 15 0 0 0 164 117L164,117A15 15 0 0 0 149 101L105,101A15 15 0 0 0 90 117L90,117A15 15 0 0 0 105 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="182,117 170,121 170,112" style="fill:rgb(0,0,0)"/>
<path d="M164,117L176,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,132L201,132A15 15 0 0 0 216 117L216,117A15 15 0 0 0 201 101L197,101A15 15 0 0 0 182 117L182,117A15 15 0 0 0 197 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M216,117L239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,132L375,132L375,101L245,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,169A15 15 0 0 0 325 154A15 15 0 0 0 310 139A15 15 0 0 0 294 154A15 15 0 0 0 310 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,154 336,150 336,159" style="fill:rgb(0,0,0)"/>
<path d="M375,117 L 380,117 Q 386,117 386,132 L 386,139 Q 386,154 371,154 L 345,154 L 330,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M294,154 L 260,154 Q 245,154 236,154 Q 227,154 227,139 L 227,132 Q 227,117 233,117 L 239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M375,117 L 383,117 Q 392,117 392,102 L 392,71 Q 392,56 407,56 L 413,56 L 428,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/literal-value.html">literal-value:</a></b>
<button id='x3d76fc11' onclick='hideorshow("x3d76fc11","xbf9cc2f0")'>show</button></p>
 <div id='xbf9cc2f0' style='display:none;' class='imgcontainer'>
 <div style="max-width:341px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 341.376 336.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,319 39,324 39,315" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,304 Q 24,319 34,319 L 45,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,334L252,334A15 15 0 0 0 267 319A15 15 0 0 0 252 304L65,304A15 15 0 0 0 50 319A15 15 0 0 0 65 334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIMESTAMP</text>
<polygon points="290,319 278,324 278,315" style="fill:rgb(0,0,0)"/>
<path d="M267,319L284,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,17 320,21 320,12" style="fill:rgb(0,0,0)"/>
<path d="M290,319 L 297,319 Q 305,319 305,304 L 305,32 Q 305,17 315,17 L 326,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="335" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L172,32A15 15 0 0 0 187 17A15 15 0 0 0 172 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="119" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,17L320,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L153,70A15 15 0 0 0 168 55L168,55A15 15 0 0 0 153 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">string-literal</text>
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,47 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,55 278,59 278,50" style="fill:rgb(0,0,0)"/>
<path d="M168,55L284,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,55 L 297,55 Q 305,55 305,47 L 305,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L140,108A15 15 0 0 0 155 92A15 15 0 0 0 140 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">blob-literal</text>
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,85 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,92 278,97 278,88" style="fill:rgb(0,0,0)"/>
<path d="M155,92L284,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,92 L 297,92 Q 305,92 305,85 L 305,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,145L97,145A15 15 0 0 0 112 130A15 15 0 0 0 97 115L66,115A15 15 0 0 0 50 130A15 15 0 0 0 66 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="50,130 39,135 39,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 34,130 L 45,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,130 278,135 278,126" style="fill:rgb(0,0,0)"/>
<path d="M112,130L284,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,130 L 297,130 Q 305,130 305,123 L 305,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,183L96,183A15 15 0 0 0 111 168A15 15 0 0 0 96 153L66,153A15 15 0 0 0 50 168A15 15 0 0 0 66 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRUE</text>
<polygon points="50,168 39,172 39,164" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,160 Q 24,168 34,168 L 45,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,168 278,172 278,164" style="fill:rgb(0,0,0)"/>
<path d="M111,168L284,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,168 L 297,168 Q 305,168 305,160 L 305,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,221L104,221A15 15 0 0 0 119 206A15 15 0 0 0 104 191L66,191A15 15 0 0 0 50 206A15 15 0 0 0 66 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FALSE</text>
<polygon points="50,206 39,210 39,201" style="fill:rgb(0,0,0)"/>
<path d="M24,191 L 24,198 Q 24,206 34,206 L 45,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,206 278,210 278,201" style="fill:rgb(0,0,0)"/>
<path d="M119,206L284,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,206 L 297,206 Q 305,206 305,198 L 305,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,259L190,259A15 15 0 0 0 205 244A15 15 0 0 0 190 228L66,228A15 15 0 0 0 50 244A15 15 0 0 0 66 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="128" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIME</text>
<polygon points="50,244 39,248 39,239" style="fill:rgb(0,0,0)"/>
<path d="M24,228 L 24,236 Q 24,244 34,244 L 45,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,244 278,248 278,239" style="fill:rgb(0,0,0)"/>
<path d="M205,244L284,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,244 L 297,244 Q 305,244 305,236 L 305,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,297L192,297A15 15 0 0 0 207 281A15 15 0 0 0 192 266L66,266A15 15 0 0 0 50 281A15 15 0 0 0 66 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_DATE</text>
<polygon points="50,281 39,286 39,277" style="fill:rgb(0,0,0)"/>
<path d="M24,266 L 24,274 Q 24,281 34,281 L 45,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,281 278,286 278,277" style="fill:rgb(0,0,0)"/>
<path d="M207,281L284,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,281 L 297,281 Q 305,281 305,274 L 305,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/over-clause.html">over-clause:</a></b>
<button id='x3d7504df' onclick='hideorshow("x3d7504df","xcdd8ce35")'>show</button></p>
 <div id='xcdd8ce35' style='display:none;' class='imgcontainer'>
 <div style="max-width:600px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 600.706 418.392">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="129,17 117,21 117,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L123,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M144,32L241,32A15 15 0 0 0 256 17A15 15 0 0 0 241 2L144,2A15 15 0 0 0 129 17A15 15 0 0 0 144 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,17 L 100,17 Q 108,17 108,32 L 108,40 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,70A15 15 0 0 0 165 55L165,55A15 15 0 0 0 149 39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 149 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="149" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="206,82 195,86 195,77" style="fill:rgb(0,0,0)"/>
<path d="M165,55 L 172,55 Q 180,55 180,68 Q 180,82 190,82 L 200,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,97L363,97A15 15 0 0 0 378 82A15 15 0 0 0 363 67L221,67A15 15 0 0 0 206 82A15 15 0 0 0 221 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="292" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M221,173L301,173A15 15 0 0 0 316 157A15 15 0 0 0 301 142L221,142A15 15 0 0 0 206 157A15 15 0 0 0 221 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="339,157 328,162 328,153" style="fill:rgb(0,0,0)"/>
<path d="M316,157L333,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,173L358,173A15 15 0 0 0 373 157A15 15 0 0 0 358 142L354,142A15 15 0 0 0 339 157A15 15 0 0 0 354 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="409,157 398,162 398,153" style="fill:rgb(0,0,0)"/>
<path d="M373,157L404,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,173L459,173L459,142L409,142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M434,210A15 15 0 0 0 449 195A15 15 0 0 0 434 180A15 15 0 0 0 419 195A15 15 0 0 0 434 210Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="195" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="449,195 461,191 461,200" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,180 Q 474,195 464,195 L 455,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,195 L 398,195 Q 383,195 383,180 L 383,172 Q 383,157 390,157 L 398,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,55 280,59 280,50" style="fill:rgb(0,0,0)"/>
<path d="M165,55L286,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,120 304,115 304,124" style="fill:rgb(0,0,0)"/>
<path d="M292,55 L 401,55 Q 416,55 416,70 L 416,105 Q 416,120 401,120 L 313,120 L 298,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,157 195,162 195,153" style="fill:rgb(0,0,0)"/>
<path d="M292,120 L 180,120 Q 165,120 165,135 L 165,142 Q 165,157 180,157 L 185,157 L 200,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="401,82 389,86 389,77" style="fill:rgb(0,0,0)"/>
<path d="M378,82L395,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,82 L 408,82 Q 416,82 416,89 L 416,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,286L266,286A15 15 0 0 0 281 271A15 15 0 0 0 266 256L221,256A15 15 0 0 0 206 271A15 15 0 0 0 221 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="244" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="304,271 292,275 292,266" style="fill:rgb(0,0,0)"/>
<path d="M281,271L298,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M319,286L323,286A15 15 0 0 0 338 271A15 15 0 0 0 323 256L319,256A15 15 0 0 0 304 271A15 15 0 0 0 319 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="321" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="374,271 363,275 363,266" style="fill:rgb(0,0,0)"/>
<path d="M338,271L368,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,286L504,286L504,256L374,256Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M439,324A15 15 0 0 0 454 309A15 15 0 0 0 439 293A15 15 0 0 0 424 309A15 15 0 0 0 439 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="454,309 466,304 466,313" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,294 Q 519,309 504,309 L 475,309 L 460,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,309 L 363,309 Q 348,309 348,294 L 348,286 Q 348,271 355,271 L 363,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,233 304,229 304,237" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,218 Q 474,233 459,233 L 313,233 L 298,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,271 195,275 195,266" style="fill:rgb(0,0,0)"/>
<path d="M292,233 L 180,233 Q 165,233 165,248 L 165,256 Q 165,271 180,271 L 185,271 L 200,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,195 160,184 169,184" style="fill:rgb(0,0,0)"/>
<path d="M165,142L165,189"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,195L165,256"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,399L311,399L311,369L206,369Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="384" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="519,384 508,389 508,380" style="fill:rgb(0,0,0)"/>
<path d="M311,384L513,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M534,399A15 15 0 0 0 549 384A15 15 0 0 0 534 369A15 15 0 0 0 519 384A15 15 0 0 0 534 399Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="384" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="591,17 579,21 579,12" style="fill:rgb(0,0,0)"/>
<path d="M549,384 L 557,384 Q 564,384 564,369 L 564,32 Q 564,17 575,17 L 585,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="594" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,17 508,21 508,12" style="fill:rgb(0,0,0)"/>
<path d="M256,17L513,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,17L579,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,346 304,342 304,351" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,331 Q 519,346 504,346 L 313,346 L 298,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,384 195,389 195,380" style="fill:rgb(0,0,0)"/>
<path d="M292,346 L 180,346 Q 165,346 165,361 L 165,369 Q 165,384 180,384 L 185,384 L 200,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,309 160,297 169,297" style="fill:rgb(0,0,0)"/>
<path d="M165,256L165,303"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,309L165,369"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="258,411 247,416 247,407" style="fill:rgb(0,0,0)"/>
<path d="M165,369 L 165,396 Q 165,411 180,411 L 238,411 L 253,411"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,384 369,389 369,380" style="fill:rgb(0,0,0)"/>
<path d="M258,411 L 335,411 Q 350,411 350,398 Q 350,384 362,384 L 375,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x68210920' onclick='hideorshow("x68210920","xa789cd22")'>show</button></p>
 <div id='xa789cd22' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/raise-function.html">raise-function:</a></b>
<button id='x4c4af5b4' onclick='hideorshow("x4c4af5b4","xb8a58e2d")'>show</button></p>
 <div id='xb8a58e2d' style='display:none;' class='imgcontainer'>
 <div style="max-width:627px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 627.302 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L82,32A15 15 0 0 0 97 17A15 15 0 0 0 82 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RAISE</text>
<polygon points="120,17 109,21 109,12" style="fill:rgb(0,0,0)"/>
<path d="M97,17L114,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,32L135,32A15 15 0 0 0 150 17A15 15 0 0 0 135 2L135,2A15 15 0 0 0 120 17A15 15 0 0 0 135 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="135" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="192,55 180,59 180,50" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 158,17 Q 165,17 165,32 L 165,40 Q 165,55 176,55 L 186,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,70L285,70A15 15 0 0 0 300 55L300,55A15 15 0 0 0 285 39L207,39A15 15 0 0 0 192 55L192,55A15 15 0 0 0 207 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="336,55 324,59 324,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70A15 15 0 0 0 366 55L366,55A15 15 0 0 0 351 39A15 15 0 0 0 336 55L336,55A15 15 0 0 0 351 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="389,55 378,59 378,50" style="fill:rgb(0,0,0)"/>
<path d="M366,55L383,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,70L508,70A15 15 0 0 0 523 55L523,55A15 15 0 0 0 508 39L404,39A15 15 0 0 0 389 55L389,55A15 15 0 0 0 404 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="456" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">error-message</text>
<polygon points="564,17 553,21 553,12" style="fill:rgb(0,0,0)"/>
<path d="M523,55 L 530,55 Q 538,55 538,40 L 538,32 Q 538,17 548,17 L 558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M579,32A15 15 0 0 0 594 17A15 15 0 0 0 579 2A15 15 0 0 0 564 17A15 15 0 0 0 579 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="617,17 606,21 606,12" style="fill:rgb(0,0,0)"/>
<path d="M594,17L612,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="621" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L259,32A15 15 0 0 0 274 17A15 15 0 0 0 259 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="456,17 444,21 444,12" style="fill:rgb(0,0,0)"/>
<path d="M274,17L450,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,17L553,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,108L249,108A15 15 0 0 0 264 92A15 15 0 0 0 249 77L207,77A15 15 0 0 0 192 92A15 15 0 0 0 207 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="300,92 288,97 288,88" style="fill:rgb(0,0,0)"/>
<path d="M264,92L294,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,92 L 307,92 Q 315,92 315,77 L 315,70 Q 315,55 322,55 L 330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,145L229,145A15 15 0 0 0 244 130A15 15 0 0 0 229 115L207,115A15 15 0 0 0 192 130A15 15 0 0 0 207 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="300,130 288,135 288,126" style="fill:rgb(0,0,0)"/>
<path d="M244,130L294,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,130 L 307,130 Q 315,130 315,115 L 315,92 L 315,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,130 180,135 180,126" style="fill:rgb(0,0,0)"/>
<path d="M165,39 L 165,115 Q 165,130 176,130 L 186,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,92 180,97 180,88" style="fill:rgb(0,0,0)"/>
<path d="M165,77 L 165,85 Q 165,92 176,92 L 186,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/type-name.html">type-name:</a></b>
<button id='x0305ad81' onclick='hideorshow("x0305ad81","x073aed85")'>show</button></p>
 <div id='x073aed85' style='display:none;' class='imgcontainer'>
 <div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.008 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L87,32A15 15 0 0 0 102 17A15 15 0 0 0 87 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="165,92 153,97 153,88" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,77 Q 138,92 149,92 L 159,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,108A15 15 0 0 0 195 92A15 15 0 0 0 180 77A15 15 0 0 0 165 92A15 15 0 0 0 180 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,92 201,97 201,88" style="fill:rgb(0,0,0)"/>
<path d="M195,92L207,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,108L350,108L350,77L212,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,92 356,97 356,88" style="fill:rgb(0,0,0)"/>
<path d="M350,92L362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,108A15 15 0 0 0 398 92A15 15 0 0 0 382 77A15 15 0 0 0 367 92A15 15 0 0 0 382 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="415,92 403,97 403,88" style="fill:rgb(0,0,0)"/>
<path d="M398,92L409,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,108L553,108L553,77L415,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="570,92 558,97 558,88" style="fill:rgb(0,0,0)"/>
<path d="M553,92L564,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,108A15 15 0 0 0 600 92A15 15 0 0 0 585 77A15 15 0 0 0 570 92A15 15 0 0 0 585 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="585" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="651,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M600,92 L 608,92 Q 615,92 615,77 L 615,32 Q 615,17 630,17 L 630,17 L 645,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,40 Q 138,55 149,55 L 159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70A15 15 0 0 0 195 55L195,55A15 15 0 0 0 180 39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,55 201,59 201,50" style="fill:rgb(0,0,0)"/>
<path d="M195,55L207,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,70L350,70L350,39L212,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,55 356,59 356,50" style="fill:rgb(0,0,0)"/>
<path d="M350,55L362,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,70A15 15 0 0 0 398 55L398,55A15 15 0 0 0 382 39A15 15 0 0 0 367 55L367,55A15 15 0 0 0 382 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="600,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M398,55L594,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M600,55 L 608,55 Q 615,55 615,47 L 615,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="74,47 85,43 85,51" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 110,17 Q 117,17 117,32 L 117,32 Q 117,47 102,47 L 94,47 L 79,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47 L 33,47 Q 18,47 18,32 L 18,32 Q 18,17 26,17 L 33,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="382,17 371,21 371,12" style="fill:rgb(0,0,0)"/>
<path d="M102,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,17L630,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='xc4224d74' onclick='hideorshow("xc4224d74","x8567ce26")'>show</button></p>
 <div id='x8567ce26' style='display:none;' class='imgcontainer'>
 <div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/join-clause.html">join-clause:</a></b>
<button id='xe7480a56' onclick='hideorshow("xe7480a56","xec171eca")'>show</button></p>
 <div id='xec171eca' style='display:none;' class='imgcontainer'>
 <div style="max-width:793px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 793.282 84.24">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L193,32L193,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="259,47 247,51 247,43" style="fill:rgb(0,0,0)"/>
<path d="M193,17 L 200,17 Q 208,17 208,32 L 208,32 Q 208,47 223,47 L 238,47 L 253,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,62L380,62L380,32L259,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-operator</text>
<polygon points="403,47 391,51 391,43" style="fill:rgb(0,0,0)"/>
<path d="M380,47L397,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,62L564,62L564,32L403,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="587,47 575,51 575,43" style="fill:rgb(0,0,0)"/>
<path d="M564,47L581,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M587,62L721,62L721,32L587,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="654" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-constraint</text>
<polygon points="783,17 772,21 772,12" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 742,47 Q 757,47 757,32 L 757,32 Q 757,17 767,17 L 778,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="787" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M193,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,17L776,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,77 495,73 495,82" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 728,47 Q 736,47 736,62 L 736,62 Q 736,77 721,77 L 504,77 L 489,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,77 L 247,77 Q 232,77 232,62 L 232,62 Q 232,47 246,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/join-constraint.html">join-constraint:</a></b>
<button id='xeabdf241' onclick='hideorshow("xeabdf241","x93826e0b")'>show</button></p>
 <div id='x93826e0b' style='display:none;' class='imgcontainer'>
 <div style="max-width:483px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 483.336 126.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L104,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 104 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="143,55 131,59 131,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L137,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,70A15 15 0 0 0 173 55L173,55A15 15 0 0 0 158 39A15 15 0 0 0 143 55L143,55A15 15 0 0 0 158 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="209,55 197,59 197,50" style="fill:rgb(0,0,0)"/>
<path d="M173,55L203,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M224,70L318,70A15 15 0 0 0 333 55L333,55A15 15 0 0 0 318 39L224,39A15 15 0 0 0 209 55L209,55A15 15 0 0 0 224 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="369,55 358,59 358,50" style="fill:rgb(0,0,0)"/>
<path d="M333,55L363,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,70A15 15 0 0 0 399 55L399,55A15 15 0 0 0 384 39A15 15 0 0 0 369 55L369,55A15 15 0 0 0 384 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="422,55 411,59 411,50" style="fill:rgb(0,0,0)"/>
<path d="M399,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="473,17 462,21 462,12" style="fill:rgb(0,0,0)"/>
<path d="M422,55 L 430,55 Q 437,55 437,40 L 437,32 Q 437,17 452,17 L 453,17 L 468,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="477" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,108A15 15 0 0 0 286 92A15 15 0 0 0 271 77A15 15 0 0 0 256 92A15 15 0 0 0 271 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="286,92 298,88 298,97" style="fill:rgb(0,0,0)"/>
<path d="M333,55 L 341,55 Q 348,55 348,70 L 348,77 Q 348,92 333,92 L 307,92 L 292,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,92 L 197,92 Q 182,92 182,77 L 182,70 Q 182,55 190,55 L 197,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L74,32A15 15 0 0 0 90 17A15 15 0 0 0 74 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="113,17 101,21 101,12" style="fill:rgb(0,0,0)"/>
<path d="M90,17L107,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M113,32L162,32L162,2L113,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="422,17 411,21 411,12" style="fill:rgb(0,0,0)"/>
<path d="M162,17L417,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,17L462,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="209,120 197,124 197,115" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,105 Q 24,120 39,120 L 188,120 L 203,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,120 L 422,120 Q 437,120 437,105 L 437,54 L 437,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-operator.html">join-operator:</a></b>
<button id='x71693918' onclick='hideorshow("x71693918","x5f6a9f20")'>show</button></p>
 <div id='x5f6a9f20' style='display:none;' class='imgcontainer'>
 <div style="max-width:620px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 620.333 255.312">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,71 39,76 39,67" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,56 Q 24,71 34,71 L 45,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,86L133,86A15 15 0 0 0 148 71A15 15 0 0 0 133 56L66,56A15 15 0 0 0 50 71A15 15 0 0 0 66 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="99" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NATURAL</text>
<polygon points="189,41 178,45 178,37" style="fill:rgb(0,0,0)"/>
<path d="M148,71 L 155,71 Q 163,71 163,56 L 163,56 Q 163,41 173,41 L 184,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,71 219,76 219,67" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,56 Q 204,71 215,71 L 225,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,86L273,86A15 15 0 0 0 288 71A15 15 0 0 0 273 56L246,56A15 15 0 0 0 231 71A15 15 0 0 0 246 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LEFT</text>
<polygon points="378,71 366,76 366,67" style="fill:rgb(0,0,0)"/>
<path d="M288,71L372,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,86L437,86A15 15 0 0 0 452 71A15 15 0 0 0 437 56L393,56A15 15 0 0 0 378 71A15 15 0 0 0 393 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OUTER</text>
<polygon points="475,71 463,76 463,67" style="fill:rgb(0,0,0)"/>
<path d="M452,71L469,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="516,41 505,45 505,37" style="fill:rgb(0,0,0)"/>
<path d="M475,71 L 482,71 Q 490,71 490,56 L 490,56 Q 490,41 500,41 L 511,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,56L554,56A15 15 0 0 0 569 41A15 15 0 0 0 554 26L532,26A15 15 0 0 0 516 41A15 15 0 0 0 532 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="543" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">JOIN</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M569,41 L 576,41 Q 584,41 584,29 Q 584,17 594,17 L 605,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="614" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,32A15 15 0 0 0 325 17A15 15 0 0 0 310 2A15 15 0 0 0 295 17A15 15 0 0 0 310 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="295,17 283,21 283,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L289,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M325,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="99,41 88,45 88,37" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,29 Q 24,41 39,41 L 78,41 L 93,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M99,41L178,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,41L505,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,41 366,45 366,37" style="fill:rgb(0,0,0)"/>
<path d="M336,71 L 344,71 Q 351,71 351,56 L 351,56 Q 351,41 362,41 L 372,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,109 219,113 219,105" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,94 Q 204,109 215,109 L 225,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,124L284,124A15 15 0 0 0 299 109A15 15 0 0 0 284 94L246,94A15 15 0 0 0 231 109A15 15 0 0 0 246 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RIGHT</text>
<polygon points="341,71 329,76 329,67" style="fill:rgb(0,0,0)"/>
<path d="M299,109 L 307,109 Q 314,109 314,94 L 314,86 Q 314,71 324,71 L 335,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,147 219,151 219,142" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,132 Q 204,147 215,147 L 225,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,162L274,162A15 15 0 0 0 289 147A15 15 0 0 0 274 132L246,132A15 15 0 0 0 231 147A15 15 0 0 0 246 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FULL</text>
<path d="M289,147 L 302,147 Q 314,147 314,132 L 314,109 L 314,94"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,192 219,196 219,188" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,177 Q 204,192 215,192 L 225,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,207L287,207A15 15 0 0 0 302 192A15 15 0 0 0 287 177L246,177A15 15 0 0 0 231 192A15 15 0 0 0 246 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="192" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INNER</text>
<polygon points="475,192 463,196 463,188" style="fill:rgb(0,0,0)"/>
<path d="M302,192L469,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,192 L 482,192 Q 490,192 490,185 L 490,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,238 219,242 219,233" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,223 Q 24,238 39,238 L 210,238 L 225,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,253L287,253A15 15 0 0 0 303 238A15 15 0 0 0 287 222L246,222A15 15 0 0 0 231 238A15 15 0 0 0 246 253Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="238" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CROSS</text>
<polygon points="475,238 463,242 463,233" style="fill:rgb(0,0,0)"/>
<path d="M303,238L469,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,238 L 482,238 Q 490,238 490,223 L 490,71 L 490,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='xf0b595d4' onclick='hideorshow("xf0b595d4","x9335f4fe")'>show</button></p>
 <div id='x9335f4fe' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/result-column.html">result-column:</a></b>
<button id='xc25ec9a4' onclick='hideorshow("xc25ec9a4","x054cd254")'>show</button></p>
 <div id='x054cd254' style='display:none;' class='imgcontainer'>
 <div style="max-width:398px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 398.054 163.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L94,32L94,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="136,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M94,17 L 102,17 Q 109,17 109,32 L 109,40 Q 109,55 119,55 L 130,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M151,70L155,70A15 15 0 0 0 170 55L170,55A15 15 0 0 0 155 39L151,39A15 15 0 0 0 136 55L136,55A15 15 0 0 0 151 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="206,55 194,59 194,50" style="fill:rgb(0,0,0)"/>
<path d="M170,55L200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,70L309,70A15 15 0 0 0 324 55L324,55A15 15 0 0 0 309 39L221,39A15 15 0 0 0 206 55L206,55A15 15 0 0 0 221 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="347,55 335,59 335,50" style="fill:rgb(0,0,0)"/>
<path d="M324,55L341,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,17 377,21 377,12" style="fill:rgb(0,0,0)"/>
<path d="M347,55 L 354,55 Q 362,55 362,40 L 362,32 Q 362,17 372,17 L 382,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="392" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,85 141,89 141,81" style="fill:rgb(0,0,0)"/>
<path d="M109,39 L 109,70 Q 109,85 124,85 L 132,85 L 147,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,85 L 170,85 Q 185,85 185,70 L 185,70 Q 185,55 192,55 L 200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="241,17 230,21 230,12" style="fill:rgb(0,0,0)"/>
<path d="M94,17L235,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M241,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,108 39,112 39,103" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,93 Q 24,108 34,108 L 45,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,123A15 15 0 0 0 81 108A15 15 0 0 0 66 92A15 15 0 0 0 50 108A15 15 0 0 0 66 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="108" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,108 335,112 335,103" style="fill:rgb(0,0,0)"/>
<path d="M81,108L341,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,108 L 354,108 Q 362,108 362,93 L 362,54 L 362,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,145 39,150 39,141" style="fill:rgb(0,0,0)"/>
<path d="M24,92 L 24,130 Q 24,145 34,145 L 45,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,160L141,160A15 15 0 0 0 156 145A15 15 0 0 0 141 130L66,130A15 15 0 0 0 50 145A15 15 0 0 0 66 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="145" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="179,145 167,150 167,141" style="fill:rgb(0,0,0)"/>
<path d="M156,145L173,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M194,160A15 15 0 0 0 209 145A15 15 0 0 0 194 130A15 15 0 0 0 179 145A15 15 0 0 0 194 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="232,145 221,150 221,141" style="fill:rgb(0,0,0)"/>
<path d="M209,145L226,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,160A15 15 0 0 0 262 145A15 15 0 0 0 247 130A15 15 0 0 0 232 145A15 15 0 0 0 247 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,145 335,150 335,141" style="fill:rgb(0,0,0)"/>
<path d="M262,145L341,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,145 L 354,145 Q 362,145 362,130 L 362,107 L 362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/table-or-subquery.html">table-or-subquery:</a></b>
<button id='x5d19c60c' onclick='hideorshow("x5d19c60c","x3972d93a")'>show</button></p>
 <div id='x3972d93a' style='display:none;' class='imgcontainer'>
 <div style="max-width:720px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 720.778 457.704">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,74 39,78 39,70" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,59 Q 24,74 34,74 L 45,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,89L162,89A15 15 0 0 0 177 74L177,74A15 15 0 0 0 162 59L66,59A15 15 0 0 0 50 74L50,74A15 15 0 0 0 66 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="194,74 183,78 183,70" style="fill:rgb(0,0,0)"/>
<path d="M177,74L189,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,89A15 15 0 0 0 225 74L225,74A15 15 0 0 0 209 59A15 15 0 0 0 194 74L194,74A15 15 0 0 0 209 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="266,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M225,74 L 232,74 Q 240,74 240,59 L 240,51 Q 240,36 250,36 L 260,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,51L356,51A15 15 0 0 0 371 36A15 15 0 0 0 356 21L281,21A15 15 0 0 0 266 36A15 15 0 0 0 281 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="407,36 396,41 396,32" style="fill:rgb(0,0,0)"/>
<path d="M371,36L402,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,51L427,51A15 15 0 0 0 442 36A15 15 0 0 0 427 21L423,21A15 15 0 0 0 407 36A15 15 0 0 0 423 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="478,36 466,41 466,32" style="fill:rgb(0,0,0)"/>
<path d="M442,36L472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,51L561,51A15 15 0 0 0 577 36A15 15 0 0 0 561 21L493,21A15 15 0 0 0 478 36A15 15 0 0 0 493 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="527" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<path d="M9,36L255,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="422,6 411,10 411,2" style="fill:rgb(0,0,0)"/>
<path d="M371,36 L 379,36 Q 386,36 386,21 L 386,21 Q 386,6 401,6 L 402,6 L 417,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 442,6 Q 457,6 457,21 L 457,21 Q 457,36 464,36 L 472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 577,6 Q 592,6 592,21 L 592,21 Q 592,36 599,36 L 607,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,127L388,127A15 15 0 0 0 403 112A15 15 0 0 0 388 97L323,97A15 15 0 0 0 308 112A15 15 0 0 0 323 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="426,112 415,116 415,108" style="fill:rgb(0,0,0)"/>
<path d="M403,112L420,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,127L445,127A15 15 0 0 0 460 112A15 15 0 0 0 445 97L441,97A15 15 0 0 0 426 112A15 15 0 0 0 441 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="443" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="483,112 472,116 472,108" style="fill:rgb(0,0,0)"/>
<path d="M460,112L478,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,127L577,127A15 15 0 0 0 592 112A15 15 0 0 0 577 97L499,97A15 15 0 0 0 483 112A15 15 0 0 0 499 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="538" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M323,165L343,165A15 15 0 0 0 359 150A15 15 0 0 0 343 135L323,135A15 15 0 0 0 308 150A15 15 0 0 0 323 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="382,150 370,154 370,145" style="fill:rgb(0,0,0)"/>
<path d="M359,150L376,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,165L461,165A15 15 0 0 0 476 150A15 15 0 0 0 461 135L397,135A15 15 0 0 0 382 150A15 15 0 0 0 397 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="527,74 539,70 539,78" style="fill:rgb(0,0,0)"/>
<path d="M577,36 L 607,36 Q 622,36 622,51 L 622,59 Q 622,74 607,74 L 548,74 L 533,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,150 297,154 297,145" style="fill:rgb(0,0,0)"/>
<path d="M527,74 L 297,74 Q 282,74 282,89 L 282,135 Q 282,150 292,150 L 302,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,112 297,116 297,108" style="fill:rgb(0,0,0)"/>
<path d="M282,97 L 282,104 Q 282,112 292,112 L 302,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="266,213 255,217 255,209" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,198 Q 24,213 39,213 L 245,213 L 260,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,228L431,228A15 15 0 0 0 446 213A15 15 0 0 0 431 198L281,198A15 15 0 0 0 266 213A15 15 0 0 0 281 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function-name</text>
<polygon points="463,213 452,217 452,209" style="fill:rgb(0,0,0)"/>
<path d="M446,213L457,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,228A15 15 0 0 0 493 213A15 15 0 0 0 478 198A15 15 0 0 0 463 213A15 15 0 0 0 478 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="529,213 518,217 518,209" style="fill:rgb(0,0,0)"/>
<path d="M493,213L524,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M529,228L579,228L579,198L529,198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="615,213 603,217 603,209" style="fill:rgb(0,0,0)"/>
<path d="M579,213L609,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M630,228A15 15 0 0 0 645 213A15 15 0 0 0 630 198A15 15 0 0 0 615 213A15 15 0 0 0 630 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="630" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="675,187 679,198 671,198" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 660,213 Q 675,213 675,203 L 675,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M554,190A15 15 0 0 0 569 175A15 15 0 0 0 554 160A15 15 0 0 0 539 175A15 15 0 0 0 554 190Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="175" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="569,175 581,171 581,180" style="fill:rgb(0,0,0)"/>
<path d="M579,213 L 586,213 Q 594,213 594,198 L 594,190 Q 594,175 584,175 L 575,175"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,175 L 518,175 Q 503,175 503,190 L 503,198 Q 503,213 510,213 L 518,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,74 L 232,74 Q 240,74 240,89 L 240,198 Q 240,213 247,213 L 255,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,112 648,116 648,108" style="fill:rgb(0,0,0)"/>
<path d="M592,112L654,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,112 L 667,112 Q 675,112 675,104 L 675,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,150 648,154 648,145" style="fill:rgb(0,0,0)"/>
<path d="M476,150L654,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,150 L 667,150 Q 675,150 675,142 L 675,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M577,36L690,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,304L411,304A15 15 0 0 0 426 289A15 15 0 0 0 411 274L407,274A15 15 0 0 0 392 289A15 15 0 0 0 407 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="498,289 487,293 487,284" style="fill:rgb(0,0,0)"/>
<path d="M426,289L492,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M513,304L582,304A15 15 0 0 0 597 289A15 15 0 0 0 582 274L513,274A15 15 0 0 0 498 289A15 15 0 0 0 513 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="548" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<polygon points="660,289 648,293 648,284" style="fill:rgb(0,0,0)"/>
<path d="M597,289L654,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,289 L 667,289 Q 675,289 675,281 L 675,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="548,251 559,247 559,255" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 652,213 Q 660,213 660,228 L 660,236 Q 660,251 645,251 L 568,251 L 553,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M548,251 L 370,251 Q 355,251 355,266 L 355,274 Q 355,289 370,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,251 L 464,251 Q 457,251 457,266 L 457,274 Q 457,289 464,289 L 472,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,327 39,331 39,322" style="fill:rgb(0,0,0)"/>
<path d="M24,198 L 24,312 Q 24,327 34,327 L 45,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,342A15 15 0 0 0 81 327A15 15 0 0 0 66 311A15 15 0 0 0 50 327A15 15 0 0 0 66 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,327 92,331 92,322" style="fill:rgb(0,0,0)"/>
<path d="M81,327L98,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,342L208,342L208,311L104,311Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="327" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="231,327 219,331 219,322" style="fill:rgb(0,0,0)"/>
<path d="M208,327L225,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,342A15 15 0 0 0 261 327A15 15 0 0 0 246 311A15 15 0 0 0 231 327A15 15 0 0 0 246 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M261,327 L 269,327 Q 276,327 276,312 L 276,304 Q 276,289 291,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,327 648,331 648,322" style="fill:rgb(0,0,0)"/>
<path d="M261,327L654,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,327 L 667,327 Q 675,327 675,319 L 675,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,327 L 432,327 Q 439,327 439,312 L 439,304 Q 439,289 447,289 L 454,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,364 39,369 39,360" style="fill:rgb(0,0,0)"/>
<path d="M24,311 L 24,349 Q 24,364 34,364 L 45,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,379A15 15 0 0 0 81 364A15 15 0 0 0 65 349A15 15 0 0 0 50 364A15 15 0 0 0 65 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="135,364 123,369 123,360" style="fill:rgb(0,0,0)"/>
<path d="M81,364L129,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,379L296,379L296,349L135,349Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="364" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="350,364 338,369 338,360" style="fill:rgb(0,0,0)"/>
<path d="M296,364L344,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,379A15 15 0 0 0 380 364A15 15 0 0 0 365 349A15 15 0 0 0 350 364A15 15 0 0 0 365 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="660,364 648,369 648,360" style="fill:rgb(0,0,0)"/>
<path d="M380,364L654,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="711,36 699,41 699,32" style="fill:rgb(0,0,0)"/>
<path d="M660,364 L 667,364 Q 675,364 675,349 L 675,51 Q 675,36 690,36 L 690,36 L 705,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="715" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,417A15 15 0 0 0 230 402A15 15 0 0 0 215 387A15 15 0 0 0 200 402A15 15 0 0 0 215 417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="402" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="230,402 242,398 242,406" style="fill:rgb(0,0,0)"/>
<path d="M296,364 L 303,364 Q 311,364 311,379 L 311,387 Q 311,402 296,402 L 251,402 L 236,402"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,402 L 123,402 Q 108,402 108,387 L 108,379 Q 108,364 116,364 L 123,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="122,440 111,444 111,436" style="fill:rgb(0,0,0)"/>
<path d="M81,364 L 88,364 Q 96,364 96,379 L 96,425 Q 96,440 106,440 L 116,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M122,455L224,455L224,425L122,425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M224,440 L 308,440 Q 323,440 323,425 L 323,379 Q 323,364 331,364 L 338,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/window-defn.html">window-defn:</a></b>
<button id='x85c65251' onclick='hideorshow("x85c65251","xb4c49913")'>show</button></p>
 <div id='xb4c49913' style='display:none;' class='imgcontainer'>
 <div style="max-width:479px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 479.765 380.592">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,44 92,48 92,40" style="fill:rgb(0,0,0)"/>
<path d="M62,17 L 70,17 Q 77,17 77,30 Q 77,44 88,44 L 98,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,59L260,59A15 15 0 0 0 275 44L275,44A15 15 0 0 0 260 29L119,29A15 15 0 0 0 104 44L104,44A15 15 0 0 0 119 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M119,135L198,135A15 15 0 0 0 214 120A15 15 0 0 0 198 104L119,104A15 15 0 0 0 104 120A15 15 0 0 0 119 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="237,120 225,124 225,115" style="fill:rgb(0,0,0)"/>
<path d="M214,120L231,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M252,135L256,135A15 15 0 0 0 271 120A15 15 0 0 0 256 104L252,104A15 15 0 0 0 237 120A15 15 0 0 0 252 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="307,120 295,124 295,115" style="fill:rgb(0,0,0)"/>
<path d="M271,120L301,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,135L356,135L356,104L307,104Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M332,173A15 15 0 0 0 347 157A15 15 0 0 0 332 142A15 15 0 0 0 316 157A15 15 0 0 0 332 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="157" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="347,157 358,153 358,162" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,142 Q 371,157 362,157 L 352,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,157 L 295,157 Q 280,157 280,142 L 280,135 Q 280,120 288,120 L 295,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,17 178,21 178,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L184,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,82 201,77 201,86" style="fill:rgb(0,0,0)"/>
<path d="M190,17 L 298,17 Q 313,17 313,32 L 313,67 Q 313,82 298,82 L 210,82 L 195,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,120 92,124 92,115" style="fill:rgb(0,0,0)"/>
<path d="M190,82 L 77,82 Q 62,82 62,97 L 62,105 Q 62,120 77,120 L 83,120 L 98,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,44 287,48 287,40" style="fill:rgb(0,0,0)"/>
<path d="M275,44L293,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,44 L 306,44 Q 313,44 313,51 L 313,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,248L163,248A15 15 0 0 0 178 233A15 15 0 0 0 163 218L119,218A15 15 0 0 0 104 233A15 15 0 0 0 119 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="201,233 190,237 190,229" style="fill:rgb(0,0,0)"/>
<path d="M178,233L196,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,248L221,248A15 15 0 0 0 236 233A15 15 0 0 0 221 218L217,218A15 15 0 0 0 201 233A15 15 0 0 0 217 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="272,233 260,237 260,229" style="fill:rgb(0,0,0)"/>
<path d="M236,233L266,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,248L402,248L402,218L272,218Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M337,286A15 15 0 0 0 352 271A15 15 0 0 0 337 256A15 15 0 0 0 322 271A15 15 0 0 0 337 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="352,271 363,266 363,275" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,256 Q 417,271 402,271 L 373,271 L 358,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M322,271 L 260,271 Q 245,271 245,256 L 245,248 Q 245,233 253,233 L 260,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,195 201,191 201,200" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,180 Q 371,195 356,195 L 210,195 L 195,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,233 92,237 92,229" style="fill:rgb(0,0,0)"/>
<path d="M190,195 L 77,195 Q 62,195 62,210 L 62,218 Q 62,233 77,233 L 83,233 L 98,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,157 58,146 66,146" style="fill:rgb(0,0,0)"/>
<path d="M62,104L62,152"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,157L62,218"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,362L208,362L208,331L104,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="417,346 405,351 405,342" style="fill:rgb(0,0,0)"/>
<path d="M208,346L411,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,362A15 15 0 0 0 447 346A15 15 0 0 0 432 331A15 15 0 0 0 417 346A15 15 0 0 0 432 362Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="470,346 458,351 458,342" style="fill:rgb(0,0,0)"/>
<path d="M447,346L464,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="474" cy="346" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,309 201,304 201,313" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,294 Q 417,309 402,309 L 210,309 L 195,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,346 92,351 92,342" style="fill:rgb(0,0,0)"/>
<path d="M190,309 L 77,309 Q 62,309 62,324 L 62,331 Q 62,346 77,346 L 83,346 L 98,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,271 58,259 66,259" style="fill:rgb(0,0,0)"/>
<path d="M62,218L62,265"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,271L62,331"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,374 144,378 144,369" style="fill:rgb(0,0,0)"/>
<path d="M62,331 L 62,359 Q 62,374 77,374 L 135,374 L 150,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,346 266,351 266,342" style="fill:rgb(0,0,0)"/>
<path d="M156,374 L 233,374 Q 248,374 248,360 Q 248,346 260,346 L 272,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='xb72f9b8c' onclick='hideorshow("xb72f9b8c","x23062e3c")'>show</button></p>
 <div id='x23062e3c' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/table-constraint.html">table-constraint:</a></b>
<button id='xefa12a59' onclick='hideorshow("xefa12a59","xdbb967ef")'>show</button></p>
 <div id='xdbb967ef' style='display:none;' class='imgcontainer'>
 <div style="max-width:751px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 751.325 261.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L160,32A15 15 0 0 0 175 17A15 15 0 0 0 160 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="110" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONSTRAINT</text>
<polygon points="198,17 187,21 187,12" style="fill:rgb(0,0,0)"/>
<path d="M175,17L192,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M213,32L240,32A15 15 0 0 0 256 17A15 15 0 0 0 240 2L213,2A15 15 0 0 0 198 17A15 15 0 0 0 213 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="227" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<path d="M60,108L123,108A15 15 0 0 0 138 92A15 15 0 0 0 123 77L60,77A15 15 0 0 0 45 92A15 15 0 0 0 60 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="91" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRIMARY</text>
<polygon points="161,92 149,97 149,88" style="fill:rgb(0,0,0)"/>
<path d="M138,92L155,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M176,108L192,108A15 15 0 0 0 208 92A15 15 0 0 0 192 77L176,77A15 15 0 0 0 161 92A15 15 0 0 0 176 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">KEY</text>
<polygon points="244,92 232,97 232,88" style="fill:rgb(0,0,0)"/>
<path d="M208,92L238,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,108A15 15 0 0 0 274 92A15 15 0 0 0 259 77A15 15 0 0 0 244 92A15 15 0 0 0 259 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="310,92 298,97 298,88" style="fill:rgb(0,0,0)"/>
<path d="M274,92L304,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,108L454,108L454,77L310,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">indexed-column</text>
<polygon points="490,92 479,97 479,88" style="fill:rgb(0,0,0)"/>
<path d="M454,92L485,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,108A15 15 0 0 0 521 92A15 15 0 0 0 505 77A15 15 0 0 0 490 92A15 15 0 0 0 505 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="505" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="544,92 532,97 532,88" style="fill:rgb(0,0,0)"/>
<path d="M521,92L538,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M544,108L677,108L677,77L544,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="610" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">conflict-clause</text>
<polygon points="700,92 688,97 688,88" style="fill:rgb(0,0,0)"/>
<path d="M677,92L694,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="741,92 730,97 730,88" style="fill:rgb(0,0,0)"/>
<path d="M700,92L736,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="745" cy="92" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,92 33,97 33,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 31,92 L 39,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="110,55 122,50 122,59" style="fill:rgb(0,0,0)"/>
<path d="M256,17 L 263,17 Q 271,17 271,32 L 271,40 Q 271,55 256,55 L 131,55 L 116,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M110,55 L 39,55 Q 24,55 24,62 L 24,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,145A15 15 0 0 0 397 130A15 15 0 0 0 382 115A15 15 0 0 0 367 130A15 15 0 0 0 382 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="130" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="397,130 409,126 409,135" style="fill:rgb(0,0,0)"/>
<path d="M454,92 L 462,92 Q 469,92 469,107 L 469,115 Q 469,130 454,130 L 418,130 L 403,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M367,130 L 298,130 Q 283,130 283,115 L 283,107 Q 283,92 291,92 L 298,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,145L115,145A15 15 0 0 0 130 130A15 15 0 0 0 115 115L60,115A15 15 0 0 0 45 130A15 15 0 0 0 60 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNIQUE</text>
<path d="M130,130 L 208,130 Q 223,130 223,115 L 223,107 Q 223,92 230,92 L 238,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,130 33,135 33,126" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,115 Q 24,130 31,130 L 39,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,183L105,183A15 15 0 0 0 121 168A15 15 0 0 0 105 153L60,153A15 15 0 0 0 45 168A15 15 0 0 0 60 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CHECK</text>
<polygon points="144,168 132,172 132,164" style="fill:rgb(0,0,0)"/>
<path d="M121,168L138,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M159,183A15 15 0 0 0 174 168A15 15 0 0 0 159 153A15 15 0 0 0 144 168A15 15 0 0 0 159 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="168" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="197,168 185,172 185,164" style="fill:rgb(0,0,0)"/>
<path d="M174,168L191,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,183L246,183L246,153L197,153Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="221" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="269,168 258,172 258,164" style="fill:rgb(0,0,0)"/>
<path d="M246,168L263,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,183L284,183A15 15 0 0 0 299 168A15 15 0 0 0 284 153L284,153A15 15 0 0 0 269 168A15 15 0 0 0 284 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="284" y="168" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="700,168 688,172 688,164" style="fill:rgb(0,0,0)"/>
<path d="M299,168L694,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M700,168 L 707,168 Q 715,168 715,153 L 715,107 Q 715,92 722,92 L 730,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,168 33,172 33,164" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,153 Q 24,168 31,168 L 39,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,221L123,221A15 15 0 0 0 139 206A15 15 0 0 0 123 191L60,191A15 15 0 0 0 45 206A15 15 0 0 0 60 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOREIGN</text>
<polygon points="162,206 150,210 150,201" style="fill:rgb(0,0,0)"/>
<path d="M139,206L156,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M177,221L193,221A15 15 0 0 0 208 206A15 15 0 0 0 193 191L177,191A15 15 0 0 0 162 206A15 15 0 0 0 177 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">KEY</text>
<polygon points="231,206 220,210 220,201" style="fill:rgb(0,0,0)"/>
<path d="M208,206L225,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,221A15 15 0 0 0 261 206A15 15 0 0 0 246 191A15 15 0 0 0 231 206A15 15 0 0 0 246 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="206" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="297,206 286,210 286,201" style="fill:rgb(0,0,0)"/>
<path d="M261,206L292,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,221L407,221A15 15 0 0 0 422 206A15 15 0 0 0 407 191L313,191A15 15 0 0 0 297 206A15 15 0 0 0 313 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="458,206 446,210 446,201" style="fill:rgb(0,0,0)"/>
<path d="M422,206L452,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M473,221A15 15 0 0 0 488 206A15 15 0 0 0 473 191A15 15 0 0 0 458 206A15 15 0 0 0 473 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="206" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,206 500,210 500,201" style="fill:rgb(0,0,0)"/>
<path d="M488,206L505,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M511,221L677,221L677,191L511,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="594" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">foreign-key-clause</text>
<polygon points="700,206 688,210 688,201" style="fill:rgb(0,0,0)"/>
<path d="M677,206L694,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M700,206 L 707,206 Q 715,206 715,191 L 715,168 L 715,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,206 33,210 33,201" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,191 Q 24,206 31,206 L 39,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,259A15 15 0 0 0 375 244A15 15 0 0 0 360 228A15 15 0 0 0 345 244A15 15 0 0 0 360 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="244" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="375,244 386,239 386,248" style="fill:rgb(0,0,0)"/>
<path d="M422,206 L 429,206 Q 437,206 437,221 L 437,229 Q 437,244 422,244 L 396,244 L 381,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,244 L 286,244 Q 271,244 271,229 L 271,221 Q 271,206 278,206 L 286,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/conflict-clause.html">conflict-clause:</a></b>
<button id='x3eb7fc34' onclick='hideorshow("x3eb7fc34","xd419404f")'>show</button></p>
 <div id='xd419404f' style='display:none;' class='imgcontainer'>
 <div style="max-width:451px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 451.517 205.2">
<circle cx="5" cy="6" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,6 20,10 20,2" style="fill:rgb(0,0,0)"/>
<path d="M9,6L26,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,36 58,41 58,32" style="fill:rgb(0,0,0)"/>
<path d="M32,6 L 39,6 Q 47,6 47,21 L 47,21 Q 47,36 56,36 L 64,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,51L94,51A15 15 0 0 0 109 36L109,36A15 15 0 0 0 94 21L85,21A15 15 0 0 0 70 36L70,36A15 15 0 0 0 85 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="90" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="132,36 121,41 121,32" style="fill:rgb(0,0,0)"/>
<path d="M109,36L126,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M147,51L222,51A15 15 0 0 0 237 36L237,36A15 15 0 0 0 222 21L147,21A15 15 0 0 0 132 36L132,36A15 15 0 0 0 147 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONFLICT</text>
<polygon points="273,36 261,41 261,32" style="fill:rgb(0,0,0)"/>
<path d="M237,36L267,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,51L365,51A15 15 0 0 0 381 36L381,36A15 15 0 0 0 365 21L288,21A15 15 0 0 0 273 36L273,36A15 15 0 0 0 288 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="327" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<path d="M288,89L330,89A15 15 0 0 0 345 74L345,74A15 15 0 0 0 330 59L288,59A15 15 0 0 0 273 74L273,74A15 15 0 0 0 288 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="309" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<path d="M288,127L310,127A15 15 0 0 0 325 112A15 15 0 0 0 310 97L288,97A15 15 0 0 0 273 112A15 15 0 0 0 288 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<path d="M288,165L340,165A15 15 0 0 0 355 150A15 15 0 0 0 340 135L288,135A15 15 0 0 0 273 150A15 15 0 0 0 288 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="314" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<path d="M288,203L352,203A15 15 0 0 0 367 187A15 15 0 0 0 352 172L288,172A15 15 0 0 0 273 187A15 15 0 0 0 288 203Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="320" y="187" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<polygon points="404,36 392,41 392,32" style="fill:rgb(0,0,0)"/>
<path d="M381,36L398,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="442,6 430,10 430,2" style="fill:rgb(0,0,0)"/>
<path d="M404,36 L 411,36 Q 419,36 419,21 L 419,21 Q 419,6 427,6 L 436,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="445" cy="6" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="225,6 214,10 214,2" style="fill:rgb(0,0,0)"/>
<path d="M9,6L219,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,6L434,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,187 261,192 261,183" style="fill:rgb(0,0,0)"/>
<path d="M237,36 L 244,36 Q 252,36 252,51 L 252,172 Q 252,187 259,187 L 267,187"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,187 392,192 392,183" style="fill:rgb(0,0,0)"/>
<path d="M367,187L398,187"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,187 L 411,187 Q 419,187 419,172 L 419,36 L 419,21"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,74 261,78 261,70" style="fill:rgb(0,0,0)"/>
<path d="M252,59 L 252,66 Q 252,74 259,74 L 267,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,74 392,78 392,70" style="fill:rgb(0,0,0)"/>
<path d="M345,74L398,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,74 L 411,74 Q 419,74 419,67 L 419,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,112 261,116 261,108" style="fill:rgb(0,0,0)"/>
<path d="M252,97 L 252,104 Q 252,112 259,112 L 267,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,112 392,116 392,108" style="fill:rgb(0,0,0)"/>
<path d="M325,112L398,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,112 L 411,112 Q 419,112 419,104 L 419,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,150 261,154 261,145" style="fill:rgb(0,0,0)"/>
<path d="M252,135 L 252,142 Q 252,150 259,150 L 267,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,150 392,154 392,145" style="fill:rgb(0,0,0)"/>
<path d="M355,150L398,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,150 L 411,150 Q 419,150 419,142 L 419,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/expr.html">expr:</a></b>
<button id='xe468b947' onclick='hideorshow("xe468b947","x386f0952")'>show</button></p>
 <div id='x386f0952' style='display:none;' class='imgcontainer'>
 <div style="max-width:963px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 963.96 1068.77">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L158,32L158,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="101" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="954,17 943,21 943,12" style="fill:rgb(0,0,0)"/>
<path d="M158,17L948,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="958" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L172,70A15 15 0 0 0 187 55L187,55A15 15 0 0 0 172 39L60,39A15 15 0 0 0 45 55L45,55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">bind-parameter</text>
<polygon points="916,55 905,59 905,50" style="fill:rgb(0,0,0)"/>
<path d="M187,55L910,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,55 L 924,55 Q 931,55 931,47 L 931,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 31,55 L 39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,130L156,130A15 15 0 0 0 171 115A15 15 0 0 0 156 100L60,100A15 15 0 0 0 45 115A15 15 0 0 0 60 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,115 183,119 183,111" style="fill:rgb(0,0,0)"/>
<path d="M171,115L189,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,130A15 15 0 0 0 225 115A15 15 0 0 0 210 100A15 15 0 0 0 195 115A15 15 0 0 0 210 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M225,115L255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130L351,130A15 15 0 0 0 366 115A15 15 0 0 0 351 100L276,100A15 15 0 0 0 261 115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="389,115 378,119 378,111" style="fill:rgb(0,0,0)"/>
<path d="M366,115L383,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,130A15 15 0 0 0 419 115A15 15 0 0 0 404 100A15 15 0 0 0 389 115A15 15 0 0 0 404 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="404" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="455,115 444,119 444,111" style="fill:rgb(0,0,0)"/>
<path d="M419,115L450,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,130L565,130A15 15 0 0 0 580 115A15 15 0 0 0 565 100L471,100A15 15 0 0 0 455 115A15 15 0 0 0 471 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="916,115 905,119 905,111" style="fill:rgb(0,0,0)"/>
<path d="M580,115L910,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,115 L 924,115 Q 931,115 931,108 L 931,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,115 33,119 33,111" style="fill:rgb(0,0,0)"/>
<path d="M24,100 L 24,108 Q 24,115 31,115 L 39,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,89 97,93 97,84" style="fill:rgb(0,0,0)"/>
<path d="M24,74 L 24,81 Q 24,89 39,89 L 87,89 L 102,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 302,93 302,84" style="fill:rgb(0,0,0)"/>
<path d="M108,89 L 129,89 Q 144,89 159,89 L 293,89 L 308,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,89 L 414,89 Q 429,89 429,102 Q 429,115 436,115 L 444,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M223,89 L 230,89 Q 238,89 238,102 Q 238,115 245,115 L 253,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,168L168,168A15 15 0 0 0 183 153A15 15 0 0 0 168 138L60,138A15 15 0 0 0 45 153A15 15 0 0 0 60 168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">unary-operator</text>
<polygon points="206,153 194,157 194,149" style="fill:rgb(0,0,0)"/>
<path d="M183,153L200,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,168L255,168L255,138L206,138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,153 905,157 905,149" style="fill:rgb(0,0,0)"/>
<path d="M255,153L910,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,153 L 924,153 Q 931,153 931,145 L 931,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,153 33,157 33,149" style="fill:rgb(0,0,0)"/>
<path d="M24,138 L 24,145 Q 24,153 31,153 L 39,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,206L94,206L94,176L45,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,191 106,195 106,186" style="fill:rgb(0,0,0)"/>
<path d="M94,191L111,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,206L245,206A15 15 0 0 0 261 191A15 15 0 0 0 245 176L132,176A15 15 0 0 0 117 191A15 15 0 0 0 132 206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">binary-operator</text>
<polygon points="284,191 272,195 272,186" style="fill:rgb(0,0,0)"/>
<path d="M261,191L278,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,206L333,206L333,176L284,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="308" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,191 905,195 905,186" style="fill:rgb(0,0,0)"/>
<path d="M333,191L910,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,191 L 924,191 Q 931,191 931,183 L 931,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,191 33,195 33,186" style="fill:rgb(0,0,0)"/>
<path d="M24,176 L 24,183 Q 24,191 31,191 L 39,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,245L162,245A15 15 0 0 0 177 230A15 15 0 0 0 162 215L60,215A15 15 0 0 0 45 230A15 15 0 0 0 60 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="111" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-name</text>
<polygon points="194,230 183,234 183,226" style="fill:rgb(0,0,0)"/>
<path d="M177,230L188,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,245A15 15 0 0 0 224 230A15 15 0 0 0 209 215A15 15 0 0 0 194 230A15 15 0 0 0 209 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="260,230 249,234 249,226" style="fill:rgb(0,0,0)"/>
<path d="M224,230L255,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,245L437,245L437,215L260,215Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-arguments</text>
<polygon points="473,230 461,234 461,226" style="fill:rgb(0,0,0)"/>
<path d="M437,230L467,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,245A15 15 0 0 0 503 230A15 15 0 0 0 488 215A15 15 0 0 0 473 230A15 15 0 0 0 488 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="541,260 529,265 529,256" style="fill:rgb(0,0,0)"/>
<path d="M503,230 L 510,230 Q 518,230 518,245 L 518,245 Q 518,260 527,260 L 535,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,275L653,275L653,245L541,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="691,230 680,234 680,226" style="fill:rgb(0,0,0)"/>
<path d="M653,260 L 661,260 Q 668,260 668,245 L 668,245 Q 668,230 677,230 L 685,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="729,260 718,265 718,256" style="fill:rgb(0,0,0)"/>
<path d="M691,230 L 699,230 Q 706,230 706,245 L 706,245 Q 706,260 715,260 L 723,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,275L837,275L837,245L729,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="783" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">over-clause</text>
<polygon points="916,260 905,265 905,256" style="fill:rgb(0,0,0)"/>
<path d="M837,260L910,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,260 L 924,260 Q 931,260 931,253 L 931,245"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,230 33,234 33,226" style="fill:rgb(0,0,0)"/>
<path d="M24,215 L 24,222 Q 24,230 31,230 L 39,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,230 585,234 585,226" style="fill:rgb(0,0,0)"/>
<path d="M503,230L591,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,230L680,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,230 905,234 905,226" style="fill:rgb(0,0,0)"/>
<path d="M691,230L910,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,230 L 924,230 Q 931,230 931,222 L 931,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,321A15 15 0 0 0 75 306A15 15 0 0 0 60 290A15 15 0 0 0 45 306A15 15 0 0 0 60 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,306 100,310 100,301" style="fill:rgb(0,0,0)"/>
<path d="M75,306L105,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M111,321L160,321L160,290L111,290Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="306" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="196,306 185,310 185,301" style="fill:rgb(0,0,0)"/>
<path d="M160,306L191,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,321A15 15 0 0 0 227 306A15 15 0 0 0 211 290A15 15 0 0 0 196 306A15 15 0 0 0 211 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,306 905,310 905,301" style="fill:rgb(0,0,0)"/>
<path d="M227,306L910,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,306 L 924,306 Q 931,306 931,298 L 931,291"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,306 33,310 33,301" style="fill:rgb(0,0,0)"/>
<path d="M24,290 L 24,298 Q 24,306 31,306 L 39,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,284A15 15 0 0 0 151 269A15 15 0 0 0 136 254A15 15 0 0 0 121 269A15 15 0 0 0 136 284Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="269" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="151,269 162,265 162,274" style="fill:rgb(0,0,0)"/>
<path d="M160,306 L 168,306 Q 175,306 175,291 L 175,284 Q 175,269 166,269 L 157,269"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,269 L 103,269 Q 88,269 88,284 L 88,291 Q 88,306 96,306 L 103,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,358L88,358A15 15 0 0 0 103 343A15 15 0 0 0 88 328L60,328A15 15 0 0 0 45 343A15 15 0 0 0 60 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CAST</text>
<polygon points="126,343 114,348 114,339" style="fill:rgb(0,0,0)"/>
<path d="M103,343L120,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M141,358A15 15 0 0 0 156 343A15 15 0 0 0 141 328A15 15 0 0 0 126 343A15 15 0 0 0 141 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="179,343 168,348 168,339" style="fill:rgb(0,0,0)"/>
<path d="M156,343L173,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,358L228,358L228,328L179,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="251,343 240,348 240,339" style="fill:rgb(0,0,0)"/>
<path d="M228,343L246,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,358L271,358A15 15 0 0 0 286 343A15 15 0 0 0 271 328L267,328A15 15 0 0 0 251 343A15 15 0 0 0 267 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="269" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="309,343 297,348 297,339" style="fill:rgb(0,0,0)"/>
<path d="M286,343L303,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,358L408,358L408,328L309,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="358" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="431,343 419,348 419,339" style="fill:rgb(0,0,0)"/>
<path d="M408,343L425,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M446,358A15 15 0 0 0 461 343A15 15 0 0 0 446 328A15 15 0 0 0 431 343A15 15 0 0 0 446 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,343 905,348 905,339" style="fill:rgb(0,0,0)"/>
<path d="M461,343L910,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,343 L 924,343 Q 931,343 931,336 L 931,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,343 33,348 33,339" style="fill:rgb(0,0,0)"/>
<path d="M24,328 L 24,336 Q 24,343 31,343 L 39,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,396L94,396L94,366L45,366Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,381 106,385 106,377" style="fill:rgb(0,0,0)"/>
<path d="M94,381L111,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,396L196,396A15 15 0 0 0 211 381A15 15 0 0 0 196 366L132,366A15 15 0 0 0 117 381A15 15 0 0 0 132 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="234,381 223,385 223,377" style="fill:rgb(0,0,0)"/>
<path d="M211,381L229,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,396L355,396A15 15 0 0 0 370 381A15 15 0 0 0 355 366L250,366A15 15 0 0 0 234 381A15 15 0 0 0 250 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="916,381 905,385 905,377" style="fill:rgb(0,0,0)"/>
<path d="M370,381L910,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,381 L 924,381 Q 931,381 931,374 L 931,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,381 33,385 33,377" style="fill:rgb(0,0,0)"/>
<path d="M24,366 L 24,374 Q 24,381 31,381 L 39,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,434L94,434L94,404L45,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,419 119,423 119,415" style="fill:rgb(0,0,0)"/>
<path d="M94,419L124,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,434L165,434A15 15 0 0 0 180 419A15 15 0 0 0 165 404L145,404A15 15 0 0 0 130 419A15 15 0 0 0 145 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="234,419 223,423 223,415" style="fill:rgb(0,0,0)"/>
<path d="M180,419L229,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,434L273,434A15 15 0 0 0 288 419A15 15 0 0 0 273 404L250,404A15 15 0 0 0 234 419A15 15 0 0 0 250 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIKE</text>
<path d="M250,472L279,472A15 15 0 0 0 294 457A15 15 0 0 0 279 442L250,442A15 15 0 0 0 234 457A15 15 0 0 0 250 472Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="457" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GLOB</text>
<path d="M250,510L302,510A15 15 0 0 0 317 495A15 15 0 0 0 302 479L250,479A15 15 0 0 0 234 495A15 15 0 0 0 250 510Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REGEXP</text>
<path d="M250,547L297,547A15 15 0 0 0 313 532A15 15 0 0 0 297 517L250,517A15 15 0 0 0 234 532A15 15 0 0 0 250 547Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="274" y="532" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<path d="M378,510L427,510L427,479L378,479Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M378,434L427,434L427,404L378,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="465,449 454,454 454,445" style="fill:rgb(0,0,0)"/>
<path d="M427,419 L 435,419 Q 442,419 442,434 L 442,434 Q 442,449 451,449 L 460,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,464L532,464A15 15 0 0 0 547 449A15 15 0 0 0 532 434L480,434A15 15 0 0 0 465 449A15 15 0 0 0 480 464Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="506" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ESCAPE</text>
<polygon points="570,449 559,454 559,445" style="fill:rgb(0,0,0)"/>
<path d="M547,449L565,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M570,464L620,464L620,434L570,434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="595" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="671,419 659,423 659,415" style="fill:rgb(0,0,0)"/>
<path d="M620,449 L 627,449 Q 635,449 635,434 L 635,434 Q 635,419 650,419 L 650,419 L 665,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,419 905,423 905,415" style="fill:rgb(0,0,0)"/>
<path d="M671,419L910,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,419 L 924,419 Q 931,419 931,411 L 931,404"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,419 33,423 33,415" style="fill:rgb(0,0,0)"/>
<path d="M24,404 L 24,411 Q 24,419 31,419 L 39,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M100,419 L 108,419 Q 115,419 115,434 L 115,434 Q 115,449 130,449 L 177,449 Q 192,449 192,434 L 192,434 Q 192,419 199,419 L 207,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,532 223,537 223,528" style="fill:rgb(0,0,0)"/>
<path d="M196,419 L 204,419 Q 211,419 211,434 L 211,517 Q 211,532 220,532 L 229,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,457 223,461 223,452" style="fill:rgb(0,0,0)"/>
<path d="M211,442 L 211,449 Q 211,457 220,457 L 229,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,495 223,499 223,490" style="fill:rgb(0,0,0)"/>
<path d="M211,479 L 211,487 Q 211,495 220,495 L 229,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,419 367,423 367,415" style="fill:rgb(0,0,0)"/>
<path d="M288,419L372,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,532 329,537 329,528" style="fill:rgb(0,0,0)"/>
<path d="M313,532L334,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,495 367,499 367,490" style="fill:rgb(0,0,0)"/>
<path d="M340,532 L 348,532 Q 355,532 355,517 L 355,510 Q 355,495 364,495 L 372,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,495 329,499 329,490" style="fill:rgb(0,0,0)"/>
<path d="M317,495L334,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,495L378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,457 329,461 329,452" style="fill:rgb(0,0,0)"/>
<path d="M294,457L334,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,457 L 348,457 Q 355,457 355,472 L 355,480 Q 355,495 367,495 L 378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="506,419 495,423 495,415" style="fill:rgb(0,0,0)"/>
<path d="M427,419L501,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M506,419L659,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="547,495 536,499 536,490" style="fill:rgb(0,0,0)"/>
<path d="M427,495L542,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,495 L 656,495 Q 671,495 671,480 L 671,434 Q 671,419 686,419 L 692,419 L 707,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,585L94,585L94,555L45,555Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,570 119,574 119,566" style="fill:rgb(0,0,0)"/>
<path d="M94,570L124,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,585L194,585A15 15 0 0 0 209 570A15 15 0 0 0 194 555L145,555A15 15 0 0 0 130 570A15 15 0 0 0 145 585Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="170" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ISNULL</text>
<polygon points="916,570 905,574 905,566" style="fill:rgb(0,0,0)"/>
<path d="M209,570L910,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,570 L 924,570 Q 931,570 931,563 L 931,555"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,570 33,574 33,566" style="fill:rgb(0,0,0)"/>
<path d="M24,555 L 24,563 Q 24,570 31,570 L 39,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,623L215,623A15 15 0 0 0 230 608A15 15 0 0 0 215 593L145,593A15 15 0 0 0 130 608A15 15 0 0 0 145 623Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="608" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTNULL</text>
<path d="M145,661L165,661A15 15 0 0 0 180 646A15 15 0 0 0 165 631L145,631A15 15 0 0 0 130 646A15 15 0 0 0 145 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="203,646 192,650 192,641" style="fill:rgb(0,0,0)"/>
<path d="M180,646L198,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,661L250,661A15 15 0 0 0 265 646A15 15 0 0 0 250 631L219,631A15 15 0 0 0 203 646A15 15 0 0 0 219 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="288,646 276,650 276,641" style="fill:rgb(0,0,0)"/>
<path d="M265,646L282,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="339,570 327,574 327,566" style="fill:rgb(0,0,0)"/>
<path d="M288,646 L 295,646 Q 303,646 303,631 L 303,585 Q 303,570 318,570 L 318,570 L 333,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="288,608 276,612 276,604" style="fill:rgb(0,0,0)"/>
<path d="M230,608L282,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,608 L 295,608 Q 303,608 303,600 L 303,593"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,646 119,650 119,641" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,631 Q 109,646 117,646 L 124,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,608 119,612 119,604" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,593 Q 109,608 117,608 L 124,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,699L94,699L94,668L45,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,684 106,688 106,679" style="fill:rgb(0,0,0)"/>
<path d="M94,684L111,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,699A15 15 0 0 0 147 684A15 15 0 0 0 132 668A15 15 0 0 0 117 684A15 15 0 0 0 132 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IS</text>
<polygon points="183,684 172,688 172,679" style="fill:rgb(0,0,0)"/>
<path d="M147,684L178,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M198,699L219,699A15 15 0 0 0 234 684A15 15 0 0 0 219 668L198,668A15 15 0 0 0 183 684A15 15 0 0 0 198 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="270,684 258,688 258,679" style="fill:rgb(0,0,0)"/>
<path d="M234,684L264,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="306,684 294,688 294,679" style="fill:rgb(0,0,0)"/>
<path d="M270,684L300,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,699L389,699A15 15 0 0 0 404 684A15 15 0 0 0 389 668L321,668A15 15 0 0 0 306 684A15 15 0 0 0 321 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="440,684 429,688 429,679" style="fill:rgb(0,0,0)"/>
<path d="M404,684L434,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,699L490,699A15 15 0 0 0 505 684A15 15 0 0 0 490 668L455,668A15 15 0 0 0 440 684A15 15 0 0 0 455 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="541,684 530,688 530,679" style="fill:rgb(0,0,0)"/>
<path d="M505,684L535,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,699L590,699L590,668L541,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,684 905,688 905,679" style="fill:rgb(0,0,0)"/>
<path d="M590,684L910,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,684 L 924,684 Q 931,684 931,676 L 931,669"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,684 33,688 33,679" style="fill:rgb(0,0,0)"/>
<path d="M24,668 L 24,676 Q 24,684 31,684 L 39,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,684 L 156,684 Q 164,684 164,696 Q 164,708 179,708 L 230,708 Q 245,708 245,696 Q 245,684 253,684 L 260,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,684 L 279,684 Q 286,684 286,696 Q 286,708 301,708 L 502,708 Q 517,708 517,696 Q 517,684 524,684 L 532,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,744L94,744L94,714L45,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,729 119,733 119,725" style="fill:rgb(0,0,0)"/>
<path d="M94,729L124,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,744L165,744A15 15 0 0 0 180 729A15 15 0 0 0 165 714L145,714A15 15 0 0 0 130 729A15 15 0 0 0 145 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,729 205,733 205,725" style="fill:rgb(0,0,0)"/>
<path d="M180,729L211,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,744L304,744A15 15 0 0 0 319 729A15 15 0 0 0 304 714L232,714A15 15 0 0 0 216 729A15 15 0 0 0 232 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="342,729 331,733 331,725" style="fill:rgb(0,0,0)"/>
<path d="M319,729L336,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M342,744L391,744L391,714L342,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="367" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="414,729 403,733 403,725" style="fill:rgb(0,0,0)"/>
<path d="M391,729L409,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M430,744L450,744A15 15 0 0 0 465 729A15 15 0 0 0 450 714L430,714A15 15 0 0 0 414 729A15 15 0 0 0 430 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="488,729 477,733 477,725" style="fill:rgb(0,0,0)"/>
<path d="M465,729L483,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,744L538,744L538,714L488,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="513" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,729 905,733 905,725" style="fill:rgb(0,0,0)"/>
<path d="M538,729L910,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,729 L 924,729 Q 931,729 931,721 L 931,714"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,729 33,733 33,725" style="fill:rgb(0,0,0)"/>
<path d="M24,714 L 24,721 Q 24,729 31,729 L 39,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,729 L 103,729 Q 110,729 110,741 Q 110,753 125,753 L 177,753 Q 192,753 192,741 Q 192,729 199,729 L 207,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,797L94,797L94,767L45,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,782 119,786 119,778" style="fill:rgb(0,0,0)"/>
<path d="M94,782L124,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,797L165,797A15 15 0 0 0 180 782A15 15 0 0 0 165 767L145,767A15 15 0 0 0 130 782A15 15 0 0 0 145 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,782 205,786 205,778" style="fill:rgb(0,0,0)"/>
<path d="M180,782L211,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,797L234,797A15 15 0 0 0 249 782A15 15 0 0 0 234 767L232,767A15 15 0 0 0 216 782A15 15 0 0 0 232 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IN</text>
<polygon points="285,782 273,786 273,778" style="fill:rgb(0,0,0)"/>
<path d="M249,782L279,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,797A15 15 0 0 0 315 782A15 15 0 0 0 300 767A15 15 0 0 0 285 782A15 15 0 0 0 300 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,782 340,786 340,778" style="fill:rgb(0,0,0)"/>
<path d="M315,782L345,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,797L455,797L455,767L351,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="491,782 480,786 480,778" style="fill:rgb(0,0,0)"/>
<path d="M455,782L486,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M507,797A15 15 0 0 0 522 782A15 15 0 0 0 507 767A15 15 0 0 0 491 782A15 15 0 0 0 507 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="507" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,782 905,786 905,778" style="fill:rgb(0,0,0)"/>
<path d="M522,782L910,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,782 L 924,782 Q 931,782 931,774 L 931,767"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,782 33,786 33,778" style="fill:rgb(0,0,0)"/>
<path d="M24,767 L 24,774 Q 24,782 31,782 L 39,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,782 L 103,782 Q 110,782 110,794 Q 110,806 125,806 L 177,806 Q 192,806 192,794 Q 192,782 199,782 L 207,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,782 L 324,782 Q 332,782 332,770 Q 332,758 347,758 L 452,758 Q 467,758 467,770 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M379,835L428,835L428,805L379,805Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="820" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="379,820 367,824 367,815" style="fill:rgb(0,0,0)"/>
<path d="M317,782 L 324,782 Q 332,782 332,797 L 332,805 Q 332,820 347,820 L 358,820 L 373,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M428,820 L 452,820 Q 467,820 467,805 L 467,797 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,873A15 15 0 0 0 418 857A15 15 0 0 0 403 842A15 15 0 0 0 388 857A15 15 0 0 0 403 873Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="857" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,857 430,853 430,862" style="fill:rgb(0,0,0)"/>
<path d="M428,820 L 435,820 Q 443,820 443,835 L 443,842 Q 443,857 434,857 L 424,857"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,857 L 371,857 Q 356,857 356,842 L 356,835 Q 356,820 363,820 L 371,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,925L396,925A15 15 0 0 0 412 910A15 15 0 0 0 396 895L300,895A15 15 0 0 0 285 910A15 15 0 0 0 300 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="429,910 417,915 417,906" style="fill:rgb(0,0,0)"/>
<path d="M412,910L423,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,925A15 15 0 0 0 459 910A15 15 0 0 0 444 895A15 15 0 0 0 429 910A15 15 0 0 0 444 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="513,910 502,915 502,906" style="fill:rgb(0,0,0)"/>
<path d="M459,910L507,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,925L627,925A15 15 0 0 0 642 910A15 15 0 0 0 627 895L528,895A15 15 0 0 0 513 910A15 15 0 0 0 528 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="577" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function</text>
<polygon points="659,910 647,915 647,906" style="fill:rgb(0,0,0)"/>
<path d="M642,910L653,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,925A15 15 0 0 0 689 910A15 15 0 0 0 674 895A15 15 0 0 0 659 910A15 15 0 0 0 674 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="734,910 723,915 723,906" style="fill:rgb(0,0,0)"/>
<path d="M689,910L728,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,925L783,925L783,895L734,895Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="828,910 817,915 817,906" style="fill:rgb(0,0,0)"/>
<path d="M783,910L823,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M844,925A15 15 0 0 0 859 910A15 15 0 0 0 844 895A15 15 0 0 0 828 910A15 15 0 0 0 844 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="844" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,910 905,915 905,906" style="fill:rgb(0,0,0)"/>
<path d="M859,910L910,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,910 L 924,910 Q 931,910 931,903 L 931,895"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,865L603,865A15 15 0 0 0 619 850A15 15 0 0 0 603 835L528,835A15 15 0 0 0 513 850A15 15 0 0 0 528 865Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="850" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="916,850 905,854 905,846" style="fill:rgb(0,0,0)"/>
<path d="M619,850L910,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,850 L 924,850 Q 931,850 931,842 L 931,835"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="513,850 502,854 502,846" style="fill:rgb(0,0,0)"/>
<path d="M475,910 L 483,910 Q 490,910 490,895 L 490,865 Q 490,850 499,850 L 507,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,892A15 15 0 0 0 774 877A15 15 0 0 0 759 862A15 15 0 0 0 744 877A15 15 0 0 0 759 892Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="877" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="774,877 785,873 785,881" style="fill:rgb(0,0,0)"/>
<path d="M783,910 L 791,910 Q 798,910 798,895 L 798,892 Q 798,877 789,877 L 780,877"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M744,877 L 726,877 Q 711,877 711,892 L 711,895 Q 711,910 719,910 L 726,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M689,910 L 697,910 Q 704,910 704,921 Q 704,932 719,932 L 790,932 Q 805,932 805,921 Q 805,910 813,910 L 820,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="285,910 273,915 273,906" style="fill:rgb(0,0,0)"/>
<path d="M249,782 L 256,782 Q 264,782 264,797 L 264,895 Q 264,910 272,910 L 279,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,882 412,886 412,877" style="fill:rgb(0,0,0)"/>
<path d="M264,867 L 264,874 Q 264,882 279,882 L 402,882 L 417,882"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,882 L 456,882 Q 471,882 471,896 Q 471,910 478,910 L 486,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,971L80,971A15 15 0 0 0 95 956A15 15 0 0 0 80 941L60,941A15 15 0 0 0 45 956A15 15 0 0 0 60 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="131,956 120,960 120,951" style="fill:rgb(0,0,0)"/>
<path d="M95,956L125,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,971L191,971A15 15 0 0 0 206 956A15 15 0 0 0 191 941L146,941A15 15 0 0 0 131 956A15 15 0 0 0 146 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="242,956 231,960 231,951" style="fill:rgb(0,0,0)"/>
<path d="M206,956L236,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,971A15 15 0 0 0 272 956A15 15 0 0 0 257 941A15 15 0 0 0 242 956A15 15 0 0 0 257 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="295,956 284,960 284,951" style="fill:rgb(0,0,0)"/>
<path d="M272,956L290,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,971L400,971L400,941L295,941Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="423,956 411,960 411,951" style="fill:rgb(0,0,0)"/>
<path d="M400,956L417,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,971A15 15 0 0 0 453 956A15 15 0 0 0 438 941A15 15 0 0 0 423 956A15 15 0 0 0 438 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,956 905,960 905,951" style="fill:rgb(0,0,0)"/>
<path d="M453,956L910,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,956 L 924,956 Q 931,956 931,948 L 931,941"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,956 33,960 33,951" style="fill:rgb(0,0,0)"/>
<path d="M24,941 L 24,948 Q 24,956 31,956 L 39,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,929 59,934 59,925" style="fill:rgb(0,0,0)"/>
<path d="M24,914 L 24,922 Q 24,929 39,929 L 49,929 L 64,929"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,929 L 201,929 Q 216,929 216,943 Q 216,956 223,956 L 231,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,929 L 101,929 Q 108,929 108,943 Q 108,956 116,956 L 123,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,1009L89,1009A15 15 0 0 0 104 994A15 15 0 0 0 89 978L60,978A15 15 0 0 0 45 994A15 15 0 0 0 60 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASE</text>
<polygon points="140,994 128,998 128,989" style="fill:rgb(0,0,0)"/>
<path d="M104,994L134,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M140,1009L189,1009L189,978L140,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="243,994 232,998 232,989" style="fill:rgb(0,0,0)"/>
<path d="M189,994L237,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,1009L298,1009A15 15 0 0 0 313 994A15 15 0 0 0 298 978L258,978A15 15 0 0 0 243 994A15 15 0 0 0 258 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="336,994 324,998 324,989" style="fill:rgb(0,0,0)"/>
<path d="M313,994L330,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,1009L385,1009L385,978L336,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="408,994 396,998 396,989" style="fill:rgb(0,0,0)"/>
<path d="M385,994L402,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,1009L456,1009A15 15 0 0 0 472 994A15 15 0 0 0 456 978L423,978A15 15 0 0 0 408 994A15 15 0 0 0 423 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">THEN</text>
<polygon points="495,994 483,998 483,989" style="fill:rgb(0,0,0)"/>
<path d="M472,994L489,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M495,1009L544,1009L544,978L495,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="616,994 604,998 604,989" style="fill:rgb(0,0,0)"/>
<path d="M544,994L610,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M631,1009L658,1009A15 15 0 0 0 673 994A15 15 0 0 0 658 978L631,978A15 15 0 0 0 616 994A15 15 0 0 0 631 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="645" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ELSE</text>
<polygon points="696,994 685,998 685,989" style="fill:rgb(0,0,0)"/>
<path d="M673,994L691,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M696,1009L746,1009L746,978L696,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="721" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="782,994 770,998 770,989" style="fill:rgb(0,0,0)"/>
<path d="M746,994L776,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M797,1009L818,1009A15 15 0 0 0 833 994A15 15 0 0 0 818 978L797,978A15 15 0 0 0 782 994A15 15 0 0 0 797 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="807" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="916,994 905,998 905,989" style="fill:rgb(0,0,0)"/>
<path d="M833,994L910,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,994 L 924,994 Q 931,994 931,986 L 931,979"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,994 33,998 33,989" style="fill:rgb(0,0,0)"/>
<path d="M24,978 L 24,986 Q 24,994 31,994 L 39,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,994 L 111,994 Q 119,994 119,1007 Q 119,1021 134,1021 L 186,1021 Q 201,1021 201,1007 Q 201,994 208,994 L 216,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="360,1021 372,1016 372,1025" style="fill:rgb(0,0,0)"/>
<path d="M544,994 L 551,994 Q 559,994 559,1007 Q 559,1021 544,1021 L 381,1021 L 366,1021"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,1021 L 235,1021 Q 220,1021 220,1007 Q 220,994 227,994 L 235,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,994 L 585,994 Q 593,994 593,1007 Q 593,1021 608,1021 L 742,1021 Q 757,1021 757,1007 Q 757,994 765,994 L 772,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,1066L173,1066L173,1036L45,1036Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="1051" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">raise-function</text>
<polygon points="916,1051 905,1055 905,1047" style="fill:rgb(0,0,0)"/>
<path d="M173,1051L910,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,1051 L 924,1051 Q 931,1051 931,1036 L 931,32 Q 931,17 939,17 L 946,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,1051 33,1055 33,1047" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,1036 Q 24,1051 31,1051 L 39,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/filter-clause.html">filter-clause:</a></b>
<button id='x62b5e8ca' onclick='hideorshow("x62b5e8ca","x305b4e40")'>show</button></p>
 <div id='x305b4e40' style='display:none;' class='imgcontainer'>
 <div style="max-width:422px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 422.381 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L93,32A15 15 0 0 0 108 17A15 15 0 0 0 93 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FILTER</text>
<polygon points="131,17 119,21 119,12" style="fill:rgb(0,0,0)"/>
<path d="M108,17L125,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,32L146,32A15 15 0 0 0 161 17A15 15 0 0 0 146 2L146,2A15 15 0 0 0 131 17A15 15 0 0 0 146 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="184,17 173,21 173,12" style="fill:rgb(0,0,0)"/>
<path d="M161,17L178,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M199,32L249,32A15 15 0 0 0 264 17A15 15 0 0 0 249 2L199,2A15 15 0 0 0 184 17A15 15 0 0 0 199 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="224" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="287,17 275,21 275,12" style="fill:rgb(0,0,0)"/>
<path d="M264,17L281,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,32L336,32L336,2L287,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M336,17L353,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,32A15 15 0 0 0 389 17A15 15 0 0 0 374 2A15 15 0 0 0 359 17A15 15 0 0 0 374 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="374" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="413,17 401,21 401,12" style="fill:rgb(0,0,0)"/>
<path d="M389,17L407,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="416" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/function-arguments.html">function-arguments:</a></b>
<button id='xc97e887a' onclick='hideorshow("xc97e887a","x2c6e9f06")'>show</button></p>
 <div id='x2c6e9f06' style='display:none;' class='imgcontainer'>
 <div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.566 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,26 55,30 55,22" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,41 L 43,41 Q 43,26 52,26 L 61,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M82,41L150,41A15 15 0 0 0 165 26L165,26A15 15 0 0 0 150 11L82,11A15 15 0 0 0 66 26L66,26A15 15 0 0 0 82 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="183,26 171,30 171,22" style="fill:rgb(0,0,0)"/>
<path d="M165,26L177,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M183,26 L 189,26 Q 194,26 194,41 L 194,41 Q 194,56 203,56 L 212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M218,56L248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,71L303,71L303,41L254,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="447,56 435,60 435,52" style="fill:rgb(0,0,0)"/>
<path d="M303,56L441,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="116,56 104,60 104,52" style="fill:rgb(0,0,0)"/>
<path d="M32,56L110,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M116,56L212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,32A15 15 0 0 0 293 17A15 15 0 0 0 278 2A15 15 0 0 0 263 17A15 15 0 0 0 278 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="293,17 305,12 305,21" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 314,56 Q 326,56 326,41 L 326,32 Q 326,17 312,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M263,17 L 245,17 Q 230,17 230,32 L 230,41 Q 230,56 239,56 L 248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,207A15 15 0 0 0 243 192L243,192A15 15 0 0 0 228 177A15 15 0 0 0 213 192L213,192A15 15 0 0 0 228 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="213,192 201,196 201,188" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,71 L 43,177 Q 43,192 58,192 L 192,192 L 207,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,192 267,196 267,188" style="fill:rgb(0,0,0)"/>
<path d="M243,192L272,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,192 L 360,192 Q 375,192 390,192 L 394,192 Q 409,192 409,177 L 409,71 Q 409,56 415,56 L 421,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="228,216 216,221 216,212" style="fill:rgb(0,0,0)"/>
<path d="M116,192 L 181,192 Q 196,192 196,204 Q 196,216 209,216 L 222,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,216 L 242,216 Q 257,216 257,204 Q 257,192 262,192 L 268,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="90,117 78,121 78,112" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 313,56 Q 323,56 323,71 L 323,71 Q 323,86 308,86 L 81,86 Q 66,86 66,101 L 66,102 Q 66,117 75,117 L 84,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,132L149,132A15 15 0 0 0 164 117L164,117A15 15 0 0 0 149 101L105,101A15 15 0 0 0 90 117L90,117A15 15 0 0 0 105 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="182,117 170,121 170,112" style="fill:rgb(0,0,0)"/>
<path d="M164,117L176,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,132L201,132A15 15 0 0 0 216 117L216,117A15 15 0 0 0 201 101L197,101A15 15 0 0 0 182 117L182,117A15 15 0 0 0 197 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M216,117L239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,132L375,132L375,101L245,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,169A15 15 0 0 0 325 154A15 15 0 0 0 310 139A15 15 0 0 0 294 154A15 15 0 0 0 310 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,154 336,150 336,159" style="fill:rgb(0,0,0)"/>
<path d="M375,117 L 380,117 Q 386,117 386,132 L 386,139 Q 386,154 371,154 L 345,154 L 330,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M294,154 L 260,154 Q 245,154 236,154 Q 227,154 227,139 L 227,132 Q 227,117 233,117 L 239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M375,117 L 383,117 Q 392,117 392,102 L 392,71 Q 392,56 407,56 L 413,56 L 428,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x5acf9229' onclick='hideorshow("x5acf9229","x97324439")'>show</button></p>
 <div id='x97324439' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/literal-value.html">literal-value:</a></b>
<button id='xed12d8b6' onclick='hideorshow("xed12d8b6","x34c4345f")'>show</button></p>
 <div id='x34c4345f' style='display:none;' class='imgcontainer'>
 <div style="max-width:341px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 341.376 336.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,319 39,324 39,315" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,304 Q 24,319 34,319 L 45,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,334L252,334A15 15 0 0 0 267 319A15 15 0 0 0 252 304L65,304A15 15 0 0 0 50 319A15 15 0 0 0 65 334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIMESTAMP</text>
<polygon points="290,319 278,324 278,315" style="fill:rgb(0,0,0)"/>
<path d="M267,319L284,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,17 320,21 320,12" style="fill:rgb(0,0,0)"/>
<path d="M290,319 L 297,319 Q 305,319 305,304 L 305,32 Q 305,17 315,17 L 326,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="335" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L172,32A15 15 0 0 0 187 17A15 15 0 0 0 172 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="119" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,17L320,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L153,70A15 15 0 0 0 168 55L168,55A15 15 0 0 0 153 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">string-literal</text>
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,47 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,55 278,59 278,50" style="fill:rgb(0,0,0)"/>
<path d="M168,55L284,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,55 L 297,55 Q 305,55 305,47 L 305,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L140,108A15 15 0 0 0 155 92A15 15 0 0 0 140 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">blob-literal</text>
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,85 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,92 278,97 278,88" style="fill:rgb(0,0,0)"/>
<path d="M155,92L284,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,92 L 297,92 Q 305,92 305,85 L 305,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,145L97,145A15 15 0 0 0 112 130A15 15 0 0 0 97 115L66,115A15 15 0 0 0 50 130A15 15 0 0 0 66 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="50,130 39,135 39,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 34,130 L 45,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,130 278,135 278,126" style="fill:rgb(0,0,0)"/>
<path d="M112,130L284,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,130 L 297,130 Q 305,130 305,123 L 305,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,183L96,183A15 15 0 0 0 111 168A15 15 0 0 0 96 153L66,153A15 15 0 0 0 50 168A15 15 0 0 0 66 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRUE</text>
<polygon points="50,168 39,172 39,164" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,160 Q 24,168 34,168 L 45,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,168 278,172 278,164" style="fill:rgb(0,0,0)"/>
<path d="M111,168L284,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,168 L 297,168 Q 305,168 305,160 L 305,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,221L104,221A15 15 0 0 0 119 206A15 15 0 0 0 104 191L66,191A15 15 0 0 0 50 206A15 15 0 0 0 66 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FALSE</text>
<polygon points="50,206 39,210 39,201" style="fill:rgb(0,0,0)"/>
<path d="M24,191 L 24,198 Q 24,206 34,206 L 45,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,206 278,210 278,201" style="fill:rgb(0,0,0)"/>
<path d="M119,206L284,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,206 L 297,206 Q 305,206 305,198 L 305,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,259L190,259A15 15 0 0 0 205 244A15 15 0 0 0 190 228L66,228A15 15 0 0 0 50 244A15 15 0 0 0 66 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="128" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIME</text>
<polygon points="50,244 39,248 39,239" style="fill:rgb(0,0,0)"/>
<path d="M24,228 L 24,236 Q 24,244 34,244 L 45,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,244 278,248 278,239" style="fill:rgb(0,0,0)"/>
<path d="M205,244L284,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,244 L 297,244 Q 305,244 305,236 L 305,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,297L192,297A15 15 0 0 0 207 281A15 15 0 0 0 192 266L66,266A15 15 0 0 0 50 281A15 15 0 0 0 66 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_DATE</text>
<polygon points="50,281 39,286 39,277" style="fill:rgb(0,0,0)"/>
<path d="M24,266 L 24,274 Q 24,281 34,281 L 45,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,281 278,286 278,277" style="fill:rgb(0,0,0)"/>
<path d="M207,281L284,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,281 L 297,281 Q 305,281 305,274 L 305,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/over-clause.html">over-clause:</a></b>
<button id='x949f7918' onclick='hideorshow("x949f7918","xf87b881f")'>show</button></p>
 <div id='xf87b881f' style='display:none;' class='imgcontainer'>
 <div style="max-width:600px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 600.706 418.392">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="129,17 117,21 117,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L123,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M144,32L241,32A15 15 0 0 0 256 17A15 15 0 0 0 241 2L144,2A15 15 0 0 0 129 17A15 15 0 0 0 144 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,17 L 100,17 Q 108,17 108,32 L 108,40 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,70A15 15 0 0 0 165 55L165,55A15 15 0 0 0 149 39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 149 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="149" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="206,82 195,86 195,77" style="fill:rgb(0,0,0)"/>
<path d="M165,55 L 172,55 Q 180,55 180,68 Q 180,82 190,82 L 200,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,97L363,97A15 15 0 0 0 378 82A15 15 0 0 0 363 67L221,67A15 15 0 0 0 206 82A15 15 0 0 0 221 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="292" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M221,173L301,173A15 15 0 0 0 316 157A15 15 0 0 0 301 142L221,142A15 15 0 0 0 206 157A15 15 0 0 0 221 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="339,157 328,162 328,153" style="fill:rgb(0,0,0)"/>
<path d="M316,157L333,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,173L358,173A15 15 0 0 0 373 157A15 15 0 0 0 358 142L354,142A15 15 0 0 0 339 157A15 15 0 0 0 354 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="409,157 398,162 398,153" style="fill:rgb(0,0,0)"/>
<path d="M373,157L404,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,173L459,173L459,142L409,142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M434,210A15 15 0 0 0 449 195A15 15 0 0 0 434 180A15 15 0 0 0 419 195A15 15 0 0 0 434 210Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="195" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="449,195 461,191 461,200" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,180 Q 474,195 464,195 L 455,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,195 L 398,195 Q 383,195 383,180 L 383,172 Q 383,157 390,157 L 398,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,55 280,59 280,50" style="fill:rgb(0,0,0)"/>
<path d="M165,55L286,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,120 304,115 304,124" style="fill:rgb(0,0,0)"/>
<path d="M292,55 L 401,55 Q 416,55 416,70 L 416,105 Q 416,120 401,120 L 313,120 L 298,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,157 195,162 195,153" style="fill:rgb(0,0,0)"/>
<path d="M292,120 L 180,120 Q 165,120 165,135 L 165,142 Q 165,157 180,157 L 185,157 L 200,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="401,82 389,86 389,77" style="fill:rgb(0,0,0)"/>
<path d="M378,82L395,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,82 L 408,82 Q 416,82 416,89 L 416,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,286L266,286A15 15 0 0 0 281 271A15 15 0 0 0 266 256L221,256A15 15 0 0 0 206 271A15 15 0 0 0 221 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="244" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="304,271 292,275 292,266" style="fill:rgb(0,0,0)"/>
<path d="M281,271L298,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M319,286L323,286A15 15 0 0 0 338 271A15 15 0 0 0 323 256L319,256A15 15 0 0 0 304 271A15 15 0 0 0 319 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="321" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="374,271 363,275 363,266" style="fill:rgb(0,0,0)"/>
<path d="M338,271L368,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,286L504,286L504,256L374,256Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M439,324A15 15 0 0 0 454 309A15 15 0 0 0 439 293A15 15 0 0 0 424 309A15 15 0 0 0 439 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="454,309 466,304 466,313" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,294 Q 519,309 504,309 L 475,309 L 460,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,309 L 363,309 Q 348,309 348,294 L 348,286 Q 348,271 355,271 L 363,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,233 304,229 304,237" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,218 Q 474,233 459,233 L 313,233 L 298,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,271 195,275 195,266" style="fill:rgb(0,0,0)"/>
<path d="M292,233 L 180,233 Q 165,233 165,248 L 165,256 Q 165,271 180,271 L 185,271 L 200,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,195 160,184 169,184" style="fill:rgb(0,0,0)"/>
<path d="M165,142L165,189"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,195L165,256"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,399L311,399L311,369L206,369Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="384" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="519,384 508,389 508,380" style="fill:rgb(0,0,0)"/>
<path d="M311,384L513,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M534,399A15 15 0 0 0 549 384A15 15 0 0 0 534 369A15 15 0 0 0 519 384A15 15 0 0 0 534 399Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="384" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="591,17 579,21 579,12" style="fill:rgb(0,0,0)"/>
<path d="M549,384 L 557,384 Q 564,384 564,369 L 564,32 Q 564,17 575,17 L 585,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="594" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,17 508,21 508,12" style="fill:rgb(0,0,0)"/>
<path d="M256,17L513,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,17L579,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,346 304,342 304,351" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,331 Q 519,346 504,346 L 313,346 L 298,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,384 195,389 195,380" style="fill:rgb(0,0,0)"/>
<path d="M292,346 L 180,346 Q 165,346 165,361 L 165,369 Q 165,384 180,384 L 185,384 L 200,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,309 160,297 169,297" style="fill:rgb(0,0,0)"/>
<path d="M165,256L165,303"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,309L165,369"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="258,411 247,416 247,407" style="fill:rgb(0,0,0)"/>
<path d="M165,369 L 165,396 Q 165,411 180,411 L 238,411 L 253,411"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,384 369,389 369,380" style="fill:rgb(0,0,0)"/>
<path d="M258,411 L 335,411 Q 350,411 350,398 Q 350,384 362,384 L 375,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='xba616e56' onclick='hideorshow("xba616e56","x3089ee9a")'>show</button></p>
 <div id='x3089ee9a' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x9a78b28f' onclick='hideorshow("x9a78b28f","x71f1aaa4")'>show</button></p>
 <div id='x71f1aaa4' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/raise-function.html">raise-function:</a></b>
<button id='xfcc97da7' onclick='hideorshow("xfcc97da7","x3290febe")'>show</button></p>
 <div id='x3290febe' style='display:none;' class='imgcontainer'>
 <div style="max-width:627px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 627.302 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L82,32A15 15 0 0 0 97 17A15 15 0 0 0 82 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RAISE</text>
<polygon points="120,17 109,21 109,12" style="fill:rgb(0,0,0)"/>
<path d="M97,17L114,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,32L135,32A15 15 0 0 0 150 17A15 15 0 0 0 135 2L135,2A15 15 0 0 0 120 17A15 15 0 0 0 135 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="135" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="192,55 180,59 180,50" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 158,17 Q 165,17 165,32 L 165,40 Q 165,55 176,55 L 186,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,70L285,70A15 15 0 0 0 300 55L300,55A15 15 0 0 0 285 39L207,39A15 15 0 0 0 192 55L192,55A15 15 0 0 0 207 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="336,55 324,59 324,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70A15 15 0 0 0 366 55L366,55A15 15 0 0 0 351 39A15 15 0 0 0 336 55L336,55A15 15 0 0 0 351 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="389,55 378,59 378,50" style="fill:rgb(0,0,0)"/>
<path d="M366,55L383,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,70L508,70A15 15 0 0 0 523 55L523,55A15 15 0 0 0 508 39L404,39A15 15 0 0 0 389 55L389,55A15 15 0 0 0 404 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="456" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">error-message</text>
<polygon points="564,17 553,21 553,12" style="fill:rgb(0,0,0)"/>
<path d="M523,55 L 530,55 Q 538,55 538,40 L 538,32 Q 538,17 548,17 L 558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M579,32A15 15 0 0 0 594 17A15 15 0 0 0 579 2A15 15 0 0 0 564 17A15 15 0 0 0 579 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="617,17 606,21 606,12" style="fill:rgb(0,0,0)"/>
<path d="M594,17L612,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="621" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L259,32A15 15 0 0 0 274 17A15 15 0 0 0 259 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="456,17 444,21 444,12" style="fill:rgb(0,0,0)"/>
<path d="M274,17L450,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,17L553,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,108L249,108A15 15 0 0 0 264 92A15 15 0 0 0 249 77L207,77A15 15 0 0 0 192 92A15 15 0 0 0 207 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="300,92 288,97 288,88" style="fill:rgb(0,0,0)"/>
<path d="M264,92L294,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,92 L 307,92 Q 315,92 315,77 L 315,70 Q 315,55 322,55 L 330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,145L229,145A15 15 0 0 0 244 130A15 15 0 0 0 229 115L207,115A15 15 0 0 0 192 130A15 15 0 0 0 207 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="300,130 288,135 288,126" style="fill:rgb(0,0,0)"/>
<path d="M244,130L294,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,130 L 307,130 Q 315,130 315,115 L 315,92 L 315,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,130 180,135 180,126" style="fill:rgb(0,0,0)"/>
<path d="M165,39 L 165,115 Q 165,130 176,130 L 186,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,92 180,97 180,88" style="fill:rgb(0,0,0)"/>
<path d="M165,77 L 165,85 Q 165,92 176,92 L 186,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/type-name.html">type-name:</a></b>
<button id='xff989053' onclick='hideorshow("xff989053","x6025604c")'>show</button></p>
 <div id='x6025604c' style='display:none;' class='imgcontainer'>
 <div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.008 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L87,32A15 15 0 0 0 102 17A15 15 0 0 0 87 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="165,92 153,97 153,88" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,77 Q 138,92 149,92 L 159,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,108A15 15 0 0 0 195 92A15 15 0 0 0 180 77A15 15 0 0 0 165 92A15 15 0 0 0 180 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,92 201,97 201,88" style="fill:rgb(0,0,0)"/>
<path d="M195,92L207,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,108L350,108L350,77L212,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,92 356,97 356,88" style="fill:rgb(0,0,0)"/>
<path d="M350,92L362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,108A15 15 0 0 0 398 92A15 15 0 0 0 382 77A15 15 0 0 0 367 92A15 15 0 0 0 382 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="415,92 403,97 403,88" style="fill:rgb(0,0,0)"/>
<path d="M398,92L409,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,108L553,108L553,77L415,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="570,92 558,97 558,88" style="fill:rgb(0,0,0)"/>
<path d="M553,92L564,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,108A15 15 0 0 0 600 92A15 15 0 0 0 585 77A15 15 0 0 0 570 92A15 15 0 0 0 585 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="585" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="651,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M600,92 L 608,92 Q 615,92 615,77 L 615,32 Q 615,17 630,17 L 630,17 L 645,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,40 Q 138,55 149,55 L 159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70A15 15 0 0 0 195 55L195,55A15 15 0 0 0 180 39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,55 201,59 201,50" style="fill:rgb(0,0,0)"/>
<path d="M195,55L207,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,70L350,70L350,39L212,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,55 356,59 356,50" style="fill:rgb(0,0,0)"/>
<path d="M350,55L362,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,70A15 15 0 0 0 398 55L398,55A15 15 0 0 0 382 39A15 15 0 0 0 367 55L367,55A15 15 0 0 0 382 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="600,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M398,55L594,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M600,55 L 608,55 Q 615,55 615,47 L 615,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="74,47 85,43 85,51" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 110,17 Q 117,17 117,32 L 117,32 Q 117,47 102,47 L 94,47 L 79,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47 L 33,47 Q 18,47 18,32 L 18,32 Q 18,17 26,17 L 33,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="382,17 371,21 371,12" style="fill:rgb(0,0,0)"/>
<path d="M102,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,17L630,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='xf3e7cb5c' onclick='hideorshow("xf3e7cb5c","x36b53f04")'>show</button></p>
 <div id='x36b53f04' style='display:none;' class='imgcontainer'>
 <div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/foreign-key-clause.html">foreign-key-clause:</a></b>
<button id='xc4d8971f' onclick='hideorshow("xc4d8971f","x934d7f67")'>show</button></p>
 <div id='x934d7f67' style='display:none;' class='imgcontainer'>
 <div style="max-width:648px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 648.158 492.48">
<circle cx="5" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,55L39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L164,70A15 15 0 0 0 179 55A15 15 0 0 0 164 39L60,39A15 15 0 0 0 45 55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REFERENCES</text>
<polygon points="202,55 190,59 190,50" style="fill:rgb(0,0,0)"/>
<path d="M179,55L196,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,70L306,70A15 15 0 0 0 322 55A15 15 0 0 0 306 39L217,39A15 15 0 0 0 202 55A15 15 0 0 0 217 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="262" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">foreign-table</text>
<polygon points="358,55 346,59 346,50" style="fill:rgb(0,0,0)"/>
<path d="M322,55L352,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M373,70A15 15 0 0 0 388 55A15 15 0 0 0 373 39A15 15 0 0 0 358 55A15 15 0 0 0 373 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="373" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="424,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M388,55L418,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M439,70L533,70A15 15 0 0 0 548 55A15 15 0 0 0 533 39L439,39A15 15 0 0 0 424 55A15 15 0 0 0 439 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="486" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="584,55 573,59 573,50" style="fill:rgb(0,0,0)"/>
<path d="M548,55L578,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M599,70A15 15 0 0 0 614 55A15 15 0 0 0 599 39A15 15 0 0 0 584 55A15 15 0 0 0 599 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="599" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<path d="M486,32A15 15 0 0 0 501 17L501,17A15 15 0 0 0 486 2A15 15 0 0 0 471 17L471,17A15 15 0 0 0 486 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="486" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="501,17 513,12 513,21" style="fill:rgb(0,0,0)"/>
<path d="M548,55 L 556,55 Q 563,55 563,40 L 563,32 Q 563,17 548,17 L 522,17 L 507,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,17 L 416,17 Q 401,17 401,32 L 401,40 Q 401,55 412,55 L 424,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,176L69,176A15 15 0 0 0 84 160A15 15 0 0 0 69 145L60,145A15 15 0 0 0 45 160A15 15 0 0 0 60 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="64" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="120,160 109,165 109,156" style="fill:rgb(0,0,0)"/>
<path d="M84,160L114,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,176L188,176A15 15 0 0 0 203 160A15 15 0 0 0 188 145L135,145A15 15 0 0 0 120 160A15 15 0 0 0 135 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="162" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DELETE</text>
<polygon points="275,160 264,165 264,156" style="fill:rgb(0,0,0)"/>
<path d="M203,160L269,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,176L306,176A15 15 0 0 0 321 160A15 15 0 0 0 306 145L290,145A15 15 0 0 0 275 160A15 15 0 0 0 290 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="298" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="344,160 332,165 332,156" style="fill:rgb(0,0,0)"/>
<path d="M321,160L338,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M359,176L390,176A15 15 0 0 0 405 160A15 15 0 0 0 390 145L359,145A15 15 0 0 0 344 160A15 15 0 0 0 359 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<path d="M135,213L189,213A15 15 0 0 0 204 198A15 15 0 0 0 189 183L135,183A15 15 0 0 0 120 198A15 15 0 0 0 135 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="162" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="120,198 109,203 109,194" style="fill:rgb(0,0,0)"/>
<path d="M84,160 L 92,160 Q 99,160 99,175 L 99,183 Q 99,198 107,198 L 114,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M204,198 L 212,198 Q 219,198 219,183 L 219,175 Q 219,160 227,160 L 234,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,213L306,213A15 15 0 0 0 321 198A15 15 0 0 0 306 183L290,183A15 15 0 0 0 275 198A15 15 0 0 0 290 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="298" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="344,198 332,203 332,194" style="fill:rgb(0,0,0)"/>
<path d="M321,198L338,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M359,213L424,213A15 15 0 0 0 440 198A15 15 0 0 0 424 183L359,183A15 15 0 0 0 344 198A15 15 0 0 0 359 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="392" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFAULT</text>
<polygon points="463,198 451,203 451,194" style="fill:rgb(0,0,0)"/>
<path d="M440,198L457,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,198 L 470,198 Q 478,198 478,191 L 478,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,251L357,251A15 15 0 0 0 372 236A15 15 0 0 0 357 221L290,221A15 15 0 0 0 275 236A15 15 0 0 0 290 251Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="324" y="236" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASCADE</text>
<polygon points="463,236 451,240 451,232" style="fill:rgb(0,0,0)"/>
<path d="M372,236L457,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,236 L 470,236 Q 478,236 478,229 L 478,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,289L361,289A15 15 0 0 0 376 274A15 15 0 0 0 361 259L290,259A15 15 0 0 0 275 274A15 15 0 0 0 290 289Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="326" y="274" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RESTRICT</text>
<polygon points="463,274 451,278 451,270" style="fill:rgb(0,0,0)"/>
<path d="M376,274L457,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,274 L 470,274 Q 478,274 478,266 L 478,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,327L299,327A15 15 0 0 0 314 312A15 15 0 0 0 299 297L290,297A15 15 0 0 0 275 312A15 15 0 0 0 290 327Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="295" y="312" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="337,312 326,316 326,307" style="fill:rgb(0,0,0)"/>
<path d="M314,312L332,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M353,327L404,327A15 15 0 0 0 419 312A15 15 0 0 0 404 297L353,297A15 15 0 0 0 337 312A15 15 0 0 0 353 327Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="378" y="312" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ACTION</text>
<polygon points="463,312 451,316 451,307" style="fill:rgb(0,0,0)"/>
<path d="M419,312L457,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,312 L 470,312 Q 478,312 478,304 L 478,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,357L108,357A15 15 0 0 0 123 342L123,342A15 15 0 0 0 108 327L60,327A15 15 0 0 0 45 342L45,342A15 15 0 0 0 60 357Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="84" y="342" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<polygon points="146,342 135,346 135,338" style="fill:rgb(0,0,0)"/>
<path d="M123,342L140,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M161,357L188,357A15 15 0 0 0 203 342L203,342A15 15 0 0 0 188 327L161,327A15 15 0 0 0 146 342L146,342A15 15 0 0 0 161 357Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="175" y="342" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="463,342 451,346 451,338" style="fill:rgb(0,0,0)"/>
<path d="M203,342L457,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="442,115 453,111 453,119" style="fill:rgb(0,0,0)"/>
<path d="M463,342 L 470,342 Q 478,342 478,327 L 478,130 Q 478,115 463,115 L 462,115 L 447,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="463,160 451,165 451,156" style="fill:rgb(0,0,0)"/>
<path d="M405,160L457,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,160 L 470,160 Q 478,160 478,153 L 478,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,312 264,316 264,307" style="fill:rgb(0,0,0)"/>
<path d="M237,160 L 245,160 Q 252,160 252,175 L 252,297 Q 252,312 261,312 L 269,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,274 264,278 264,270" style="fill:rgb(0,0,0)"/>
<path d="M252,259 L 252,266 Q 252,274 261,274 L 269,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,236 264,240 264,232" style="fill:rgb(0,0,0)"/>
<path d="M252,221 L 252,228 Q 252,236 261,236 L 269,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,198 264,203 264,194" style="fill:rgb(0,0,0)"/>
<path d="M252,183 L 252,191 Q 252,198 261,198 L 269,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,160 33,165 33,156" style="fill:rgb(0,0,0)"/>
<path d="M614,55 L 623,55 Q 632,55 632,70 L 632,100 Q 632,115 617,115 L 20,115 Q 5,115 5,130 L 5,145 Q 5,160 20,160 L 24,160 L 39,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,342 33,346 33,338" style="fill:rgb(0,0,0)"/>
<path d="M5,145 L 5,327 Q 5,342 20,342 L 24,342 L 39,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="337,91 332,79 341,79" style="fill:rgb(0,0,0)"/>
<path d="M322,55 L 329,55 Q 337,55 337,70 L 337,70 L 337,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M337,91 L 337,103 Q 337,115 329,115 L 322,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,433L80,433A15 15 0 0 0 95 417A15 15 0 0 0 80 402L60,402A15 15 0 0 0 45 417A15 15 0 0 0 60 433Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="417" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="133,387 122,392 122,383" style="fill:rgb(0,0,0)"/>
<path d="M95,417 L 103,417 Q 110,417 110,402 L 110,402 Q 110,387 119,387 L 127,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M148,402L250,402A15 15 0 0 0 265 387A15 15 0 0 0 250 372L148,372A15 15 0 0 0 133 387A15 15 0 0 0 148 402Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="387" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFERRABLE</text>
<polygon points="303,417 292,422 292,413" style="fill:rgb(0,0,0)"/>
<path d="M265,387 L 273,387 Q 280,387 280,402 L 280,402 Q 280,417 289,417 L 297,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M318,433L389,433A15 15 0 0 0 405 417A15 15 0 0 0 389 402L318,402A15 15 0 0 0 303 417A15 15 0 0 0 318 433Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="354" y="417" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INITIALLY</text>
<polygon points="428,417 416,422 416,413" style="fill:rgb(0,0,0)"/>
<path d="M405,417L422,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M443,433L523,433A15 15 0 0 0 538 417A15 15 0 0 0 523 402L443,402A15 15 0 0 0 428 417A15 15 0 0 0 443 433Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="417" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFERRED</text>
<path d="M318,470L389,470A15 15 0 0 0 405 455A15 15 0 0 0 389 440L318,440A15 15 0 0 0 303 455A15 15 0 0 0 318 470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="354" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INITIALLY</text>
<polygon points="428,455 416,460 416,451" style="fill:rgb(0,0,0)"/>
<path d="M405,455L422,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M443,470L531,470A15 15 0 0 0 546 455A15 15 0 0 0 531 440L443,440A15 15 0 0 0 428 455A15 15 0 0 0 443 470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="487" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IMMEDIATE</text>
<polygon points="569,455 558,460 558,451" style="fill:rgb(0,0,0)"/>
<path d="M546,455L564,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="569,417 558,422 558,413" style="fill:rgb(0,0,0)"/>
<path d="M538,417L564,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="569,387 558,392 558,383" style="fill:rgb(0,0,0)"/>
<path d="M265,387L564,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="303,455 292,460 292,451" style="fill:rgb(0,0,0)"/>
<path d="M265,387 L 273,387 Q 280,387 280,402 L 280,440 Q 280,455 289,455 L 297,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="638,486 627,490 627,481" style="fill:rgb(0,0,0)"/>
<path d="M569,387 L 577,387 Q 584,387 584,402 L 584,471 Q 584,486 599,486 L 618,486 L 633,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="642" cy="486" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M569,455 L 577,455 Q 584,455 584,463 L 584,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M569,417 L 577,417 Q 584,417 584,425 L 584,432"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M5,327 L 5,471 Q 5,486 20,486 L 612,486 L 627,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M5,372 L 5,380 Q 5,387 20,387 L 118,387 L 133,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,417 33,422 33,413" style="fill:rgb(0,0,0)"/>
<path d="M5,402 L 5,410 Q 5,417 20,417 L 24,417 L 39,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/indexed-column.html">indexed-column:</a></b>
<button id='x2bd038da' onclick='hideorshow("x2bd038da","x6d19ff8b")'>show</button></p>
 <div id='x6d19ff8b' style='display:none;' class='imgcontainer'>
 <div style="max-width:696px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 696.36 102.6">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L160,32A15 15 0 0 0 175 17A15 15 0 0 0 160 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="113" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="246,47 235,51 235,43" style="fill:rgb(0,0,0)"/>
<path d="M175,17 L 205,17 Q 220,17 220,32 L 220,32 Q 220,47 230,47 L 240,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M261,62L325,62A15 15 0 0 0 341 47L341,47A15 15 0 0 0 325 32L261,32A15 15 0 0 0 246 47L246,47A15 15 0 0 0 261 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="293" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="358,47 346,51 346,43" style="fill:rgb(0,0,0)"/>
<path d="M341,47L352,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M373,62L478,62A15 15 0 0 0 493 47L493,47A15 15 0 0 0 478 32L373,32A15 15 0 0 0 358 47L358,47A15 15 0 0 0 373 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="511,47 499,51 499,43" style="fill:rgb(0,0,0)"/>
<path d="M493,47L505,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="567,85 556,89 556,81" style="fill:rgb(0,0,0)"/>
<path d="M511,47 L 518,47 Q 526,47 526,32 L 526,32 Q 526,17 533,17 Q 541,17 541,32 L 541,70 Q 541,85 551,85 L 561,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,100L613,100A15 15 0 0 0 628 85L628,85A15 15 0 0 0 613 70L582,70A15 15 0 0 0 567 85L567,85A15 15 0 0 0 582 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="645,85 633,89 633,81" style="fill:rgb(0,0,0)"/>
<path d="M628,85L639,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="687,17 675,21 675,12" style="fill:rgb(0,0,0)"/>
<path d="M645,85 L 652,85 Q 660,85 660,70 L 660,32 Q 660,17 670,17 L 681,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="690" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M50,70L100,70L100,39L50,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="175,55 163,59 163,50" style="fill:rgb(0,0,0)"/>
<path d="M100,55L169,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M175,55 L 182,55 Q 190,55 190,40 L 190,32 Q 190,17 197,17 L 205,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M175,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,17 586,21 586,12" style="fill:rgb(0,0,0)"/>
<path d="M358,17L592,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,17L675,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,62L599,62A15 15 0 0 0 614 47A15 15 0 0 0 599 32L582,32A15 15 0 0 0 567 47A15 15 0 0 0 582 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="645,47 633,51 633,43" style="fill:rgb(0,0,0)"/>
<path d="M614,47L639,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M645,47 L 652,47 Q 660,47 660,40 L 660,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="567,47 556,51 556,43" style="fill:rgb(0,0,0)"/>
<path d="M541,32 L 541,39 Q 541,47 551,47 L 561,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/table-options.html">table-options:</a></b>
<button id='xfc1ab7d8' onclick='hideorshow("xfc1ab7d8","xb4a663be")'>show</button></p>
 <div id='xb4a663be' style='display:none;' class='imgcontainer'>
 <div style="max-width:324px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 324.036 98.31">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="77,17 66,21 66,12" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 40,36 Q 55,36 55,26 Q 55,17 63,17 L 72,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,32L161,32A15 15 0 0 0 177 17A15 15 0 0 0 161 2L93,2A15 15 0 0 0 77 17A15 15 0 0 0 93 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITHOUT</text>
<polygon points="194,17 182,21 182,12" style="fill:rgb(0,0,0)"/>
<path d="M177,17L188,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,32L253,32A15 15 0 0 0 268 17A15 15 0 0 0 253 2L209,2A15 15 0 0 0 194 17A15 15 0 0 0 209 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWID</text>
<path d="M268,17 L 274,17 Q 280,17 280,26 Q 280,36 295,36 L 299,36 L 314,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="318" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="77,54 66,59 66,50" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 40,36 Q 55,36 55,45 Q 55,54 63,54 L 72,54"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,69L139,69A15 15 0 0 0 154 54A15 15 0 0 0 139 39L93,39A15 15 0 0 0 77 54A15 15 0 0 0 93 69Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="54" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">STRICT</text>
<polygon points="314,36 303,40 303,31" style="fill:rgb(0,0,0)"/>
<path d="M154,54 L 253,54 Q 268,54 274,54 Q 280,54 280,45 Q 280,36 294,36 L 308,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="194,81 205,76 205,85" style="fill:rgb(0,0,0)"/>
<path d="M285,36 L 293,36 Q 300,36 300,51 L 300,66 Q 300,81 285,81 L 215,81 L 200,81"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,96A15 15 0 0 0 194 81A15 15 0 0 0 179 65A15 15 0 0 0 164 81A15 15 0 0 0 179 96Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="179" y="81" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="77,81 89,76 89,85" style="fill:rgb(0,0,0)"/>
<path d="M164,81L83,81"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M77,81 L 31,81 Q 16,81 16,66 L 16,51 Q 16,36 28,36 L 39,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>


<h1 id="the_create_table_command"><span>2. </span>The CREATE TABLE command</h1>

<p>The "CREATE TABLE" command is used to create a new table in an SQLite 
database. A CREATE TABLE command specifies the following attributes of the
new table:

</p><ul>
  <li><p>The name of the new table.

  </p></li><li><p> The database in which the new table is created. Tables may be 
      created in the main database, the temp database, or in any attached
      database.

  </p></li><li><p> The name of each column in the table.

  </p></li><li><p> The declared type of each column in the table.

  </p></li><li><p> A default value or expression for each column in the table.

  </p></li><li><p> A default collation sequence to use with each column.

  </p></li><li><p> Optionally, a PRIMARY KEY for the table. Both single column and
       composite (multiple column) primary keys are supported.

  </p></li><li><p> A set of SQL constraints for each table. SQLite supports UNIQUE, NOT
       NULL, CHECK and FOREIGN KEY constraints.

  </p></li><li><p> Optionally, a <a href="gencol.html">generated column</a> constraint.

  </p></li><li><p> Whether the table is a <a href="withoutrowid.html">WITHOUT ROWID</a> table.

  </p></li><li><p> Whether the table is subject to <a href="stricttables.html">strict type checking</a>.
</p></li></ul>

<p>Every CREATE TABLE statement must specify a name for the new table.
  Table names that begin with "sqlite_" are reserved for internal use. It
  is an error to attempt to create a table with a name that starts with
  "sqlite_".

</p><p> If a <span class='yyterm'>schema-name</span> is specified, it must be either "main", 
  "temp", or the name of an <a href="lang_attach.html">attached database</a>. In this case
  the new table is created in the named database. If the "TEMP" or "TEMPORARY"
  keyword occurs between the "CREATE" and "TABLE" then the new table is
  created in the temp database. It is an error to specify both a 
  <span class='yyterm'>schema-name</span> and the TEMP or TEMPORARY keyword, unless the
  <span class='yyterm'>schema-name</span> is "temp". 
  If no schema name is specified and the
  TEMP keyword is not present then the table is created in the main
  database.

</p><p>
  It is usually an error to attempt to create a new table in a database that
  already contains a table, index or view of the same name. However, if the
  "IF NOT EXISTS" clause is specified as part of the CREATE TABLE statement and
  a table or view of the same name already exists, the CREATE TABLE command
  simply has no effect (and no error message is returned). An error is still
  returned if the table cannot be created because of an existing index, even 
  if the "IF NOT EXISTS" clause is specified.

</p><p>It is not an error to create a table that has the same name as an 
  existing <a href="lang_createtrigger.html">trigger</a>.

</p><p>Tables are removed using the <a href="lang_droptable.html">DROP TABLE</a> statement.  </p>

<a name="createtabas"></a>

<h2 id="create_table_as_select_statements"><span>2.1. </span>CREATE TABLE ... AS SELECT Statements</h2>

<p>A "CREATE TABLE ... AS SELECT" statement creates and populates a database
table based on the results of a SELECT statement. The table has the same
number of columns as the SELECT statement returns. The name of
each column is the same as the name of the corresponding column in the result
set of the SELECT statement. The declared type of each column is determined
by the <a href="datatype3.html#expraff">expression affinity</a> of the corresponding expression in the result set
of the SELECT statement, as follows:
</p>

<center><table border="1">
  <tr><th>Expression Affinity   </th><th>Column Declared Type
  </th></tr><tr><td>TEXT                  </td><td>"TEXT"
  </td></tr><tr><td>NUMERIC               </td><td>"NUM"
  </td></tr><tr><td>INTEGER               </td><td>"INT"
  </td></tr><tr><td>REAL                  </td><td>"REAL"
  </td></tr><tr><td>BLOB (a.k.a "NONE")   </td><td>"" (empty string)
</td></tr></table></center>

<p>A table created using CREATE TABLE AS has no PRIMARY KEY and no
constraints of any kind. The default value of each column is NULL. The default
collation sequence for each column of the new table is BINARY.

</p><p>Tables created using CREATE TABLE AS are initially populated with the
rows of data returned by the SELECT statement. Rows are assigned contiguously
ascending <a href="lang_createtable.html#rowid">rowid</a> values, starting with 1, in the <a href="lang_select.html#orderby">order</a> that they
are returned by the SELECT statement.

<a name="tablecoldef"></a>

</p><h1 id="column_definitions"><span>3. </span>Column Definitions</h1>

<p>Unless it is a CREATE TABLE ... AS SELECT statement, a CREATE TABLE includes
one or more <a href="syntax/column-def.html">column definitions</a>, optionally followed by a list of
<a href="syntax/table-constraint.html">table constraints</a>.  Each column definition consists of the
name of the column, optionally followed by the declared type of the column,
then one or more optional <a href="syntax/column-constraint.html">column constraints</a>. Included in
the definition of "column constraints" for the purposes of the previous
statement are the COLLATE and DEFAULT clauses, even though these are not really
constraints in the sense that they do not restrict the data that the table may
contain. The other constraints - NOT NULL, CHECK, UNIQUE, PRIMARY KEY and
FOREIGN KEY constraints - impose restrictions on the table data.

</p><p>The number of columns in a table is limited by the <a href="limits.html#max_column">SQLITE_MAX_COLUMN</a>
compile-time parameter. A single row of a table cannot store more than
<a href="limits.html#max_length">SQLITE_MAX_LENGTH</a> bytes of data. Both of these limits can be lowered at
runtime using the <a href="c3ref/limit.html">sqlite3_limit()</a> C/C++ interface.</p>

<h2 id="column_data_types"><span>3.1. </span>Column Data Types</h2>

<p>Unlike most SQL databases, SQLite does not restrict the type of data that
may be inserted into a column based on the columns declared type. Instead,
SQLite uses <a href="datatype3.html">dynamic typing</a>. The declared type of a column is used to
determine the <a href="datatype3.html#affinity">affinity</a> of the column only.

<a name="dfltval"></a>

</p><h2 id="the_default_clause"><span>3.2. </span>The DEFAULT clause</h2>
<p>The DEFAULT clause specifies a default value to use for the column if no
value is explicitly provided by the user when doing an <a href="lang_insert.html">INSERT</a>. If there
is no explicit DEFAULT clause attached to a column definition, then the 
default value of the column is NULL. An explicit DEFAULT clause may specify
that the default value is NULL, a string constant, a blob constant, a
signed-number, or any constant expression enclosed in parentheses. A
default value may also be one of the special case-independent keywords
CURRENT_TIME, CURRENT_DATE or CURRENT_TIMESTAMP. For the purposes of the
DEFAULT clause, an expression is considered constant if it
contains no sub-queries, column or table references, <a href="lang_expr.html#varparam">bound parameters</a>,
or string literals enclosed in double-quotes instead of single-quotes.

</p><p>Each time a row is inserted into the table by an INSERT statement that 
does not provide explicit values for all table columns the values stored in
the new row are determined by their default values, as follows:

</p><ul>
  <li><p>If the default value of the column is a constant NULL, text, blob or
    signed-number value, then that value is used directly in the new row.

  </p></li><li><p>If the default value of a column is an expression in parentheses, then
    the expression is evaluated once for each row inserted and the results
    used in the new row.

  </p></li><li><p>If the default value of a column is CURRENT_TIME, CURRENT_DATE or
    CURRENT_TIMESTAMP, then the value used in the new row is a text
    representation of the current UTC date and/or time. For CURRENT_TIME, the
    format of the value is "HH:MM:SS". For CURRENT_DATE, "YYYY-MM-DD". The
    format for CURRENT_TIMESTAMP is "YYYY-MM-DD HH:MM:SS".
</p></li></ul>

<a name="collateclause"></a>

<h2 id="the_collate_clause"><span>3.3. </span>The COLLATE clause</h2>
<p>The COLLATE clause specifies the name of a <a href="datatype3.html#collation">collating sequence</a> to use as
the default collation sequence for the column. If no COLLATE clause is
specified, the default collation sequence is <a href="datatype3.html#collation">BINARY</a>.

</p><h2 id="the_generated_always_as_clause"><span>3.4. </span>The GENERATED ALWAYS AS clause</h2>
<p>A column that includes a GENERATED ALWAYS AS clause is a <a href="gencol.html">generated column</a>.
Generated columns are supported beginning with SQLite version 3.31.0 (2020-01-22).
See the <a href="gencol.html">separate documentation</a> for details on the capabilities and
limitations of generated columns.

<a name="primkeyconst"></a>

</p><h2 id="the_primary_key"><span>3.5. </span>The PRIMARY KEY</h2>
<p>Each table in SQLite may have at most one PRIMARY KEY. If the
  keywords PRIMARY KEY are added to a column definition, then the primary key
  for the table consists of that single column. Or, if a PRIMARY KEY clause 
  is specified as a <a href="syntax/table-constraint.html">table-constraint</a>, then the primary key of the table
  consists of the list of columns specified as part of the PRIMARY KEY clause.
  The PRIMARY KEY clause must contain only column names &mdash; the use of 
  expressions in an <a href="syntax/indexed-column.html">indexed-column</a> of a PRIMARY KEY is not supported.
  An error is raised if more than one PRIMARY KEY clause appears in a
  CREATE TABLE statement.  The PRIMARY KEY is optional for ordinary tables
  but is required for <a href="withoutrowid.html">WITHOUT ROWID</a> tables.

</p><p>If a table has a single column primary key and the declared type of that
  column is "INTEGER" and the table is not a <a href="withoutrowid.html">WITHOUT ROWID</a> table,
  then the column is known as an <a href="lang_createtable.html#rowid">INTEGER PRIMARY KEY</a>.
  See <a href="lang_createtable.html#rowid">below</a> for a description of the special properties and behaviors
  associated with an <a href="lang_createtable.html#rowid">INTEGER PRIMARY KEY</a>.

</p><p>Each row in a table with a primary key must have a unique combination
  of values in its primary key columns. For the purposes of determining
  the uniqueness of primary key values, NULL values are considered distinct from
  all other values, including other NULLs. If an <a href="lang_insert.html">INSERT</a> or <a href="lang_update.html">UPDATE</a>
  statement attempts to modify the table content so that two or more rows
  have identical primary key values, that is a constraint violation.

</p><p> According to the SQL standard, PRIMARY KEY should always imply NOT NULL.
  Unfortunately, due to a bug in some early versions, this is not the
  case in SQLite. Unless the column is an <a href="lang_createtable.html#rowid">INTEGER PRIMARY KEY</a> or
  the table is a <a href="withoutrowid.html">WITHOUT ROWID</a> table or a <a href="stricttables.html">STRICT</a> table 
  or the column is declared NOT NULL,
  SQLite allows NULL values in a PRIMARY KEY column.  SQLite could be fixed to
  conform to the standard, but doing so might break legacy applications.
  Hence, it has been decided to merely document the fact that SQLite
  allows NULLs in most PRIMARY KEY columns.

<a name="uniqueconst"></a>

</p><h2 id="unique_constraints"><span>3.6. </span>UNIQUE constraints</h2>
<p>A UNIQUE constraint is similar to a PRIMARY KEY constraint, except
  that a single table may have any number of UNIQUE constraints. For each
  UNIQUE constraint on the table, each row must contain a unique combination
  of values in the columns identified by the UNIQUE constraint. 
  For the purposes of UNIQUE constraints, NULL values
  are considered distinct from all other values, including other NULLs.
  As with PRIMARY KEYs, a UNIQUE <a href="syntax/table-constraint.html">table-constraint</a> clause must contain
  only column names &mdash; the use of 
  expressions in an <a href="syntax/indexed-column.html">indexed-column</a> of a UNIQUE <a href="syntax/table-constraint.html">table-constraint</a>
  is not supported.
  

</p><p>In most cases, UNIQUE and PRIMARY KEY
  constraints are implemented by creating a unique index in the database.
  (The exceptions are <a href="lang_createtable.html#rowid">INTEGER PRIMARY KEY</a> and PRIMARY KEYs on 
  <a href="withoutrowid.html">WITHOUT ROWID</a> tables.)
  Hence, the following schemas are logically equivalent:

  </p><ol>
  <li><p>CREATE TABLE t1(a, b UNIQUE);
  </p></li><li><p>CREATE TABLE t1(a, b PRIMARY KEY);
  </p></li><li><p>CREATE TABLE t1(a, b);<br>
         CREATE UNIQUE INDEX t1b ON t1(b);
  </p></li></ol>

<a name="ckconst"></a>

<h2 id="check_constraints"><span>3.7. </span>CHECK constraints</h2>
<p>A CHECK constraint may be attached to a column definition or
  specified as a table constraint. In practice it makes no difference. Each
  time a new row is inserted into the table or an existing row is updated,
  the expression associated with each CHECK constraint is evaluated and
  cast to a NUMERIC value in the same way as a <a href="lang_expr.html#castexpr">CAST expression</a>. If the 
  result is zero (integer value 0 or real value 0.0), then a constraint
  violation has occurred. If the CHECK expression evaluates to NULL, or
  any other non-zero value, it is not a constraint violation.
  The expression of a CHECK constraint may not contain a subquery.

</p><p>CHECK constraints are only verified when the table is written, not when
   it is read.  Furthermore, verification of CHECK constraints can be
   temporarily disabled using the "<a href="pragma.html#pragma_ignore_check_constraints">PRAGMA ignore_check_constraints=ON;</a>"
   statement.  Hence, it is possible that a query might produce results that
   violate the CHECK constraints.

<a name="notnullconst"></a>

</p><h2 id="not_null_constraints"><span>3.8. </span>NOT NULL constraints</h2>
<p>A NOT NULL constraint may only be attached to a column definition,
  not specified as a table constraint.  Not surprisingly, a NOT NULL
  constraint dictates that the associated column may not contain a NULL value.
  Attempting to set the column value to NULL when inserting a new row or
  updating an existing one causes a constraint violation.  NOT NULL
  constraints are not verified during queries, so a query of a column might
  produce a NULL value even though the column is marked as NOT NULL, if the
  database file is corrupt.


</p><h1 id="constraint_enforcement"><span>4. </span>Constraint enforcement</h1>

<p>Constraints are checked during <a href="lang_insert.html">INSERT</a> and <a href="lang_update.html">UPDATE</a> and by
<a href="pragma.html#pragma_integrity_check">PRAGMA integrity_check</a> and <a href="pragma.html#pragma_quick_check">PRAGMA quick_check</a> and sometimes
by <a href="lang_altertable.html">ALTER TABLE</a>.  Queries and <a href="lang_delete.html">DELETE</a>
statements do not normally verify constraints.
Hence, if a database file has been corrupted (perhaps by an external
program making direct changes to the database file without going through 
the SQLite library) a query might return data that violates a constraint.
For example:

</p><div class="codeblock"><pre>CREATE TABLE t1(x INT CHECK( x>3 ));
/* Insert a row with X less than 3 by directly writing into the
** database file using an external program */
PRAGMA integrity_check;  -- Reports row with x less than 3 as corrupt
INSERT INTO t1(x) VALUES(2);  -- Fails with SQLITE_CORRUPT
SELECT x FROM t1;  -- Returns an integer less than 3 in spite of the CHECK constraint
</pre></div>

<p>Enforcement of CHECK constraints can be temporarily disabled using
the <a href="pragma.html#pragma_ignore_check_constraints">PRAGMA ignore_check_constraints=ON;</a> statement.

</p><h2 id="response_to_constraint_violations"><span>4.1. </span>Response to constraint violations</h2>

<p>The response to a constraint violation is determined by the
  <a href="lang_conflict.html">constraint conflict resolution algorithm</a>. Each 
  PRIMARY KEY, UNIQUE, NOT NULL and CHECK constraint has a default conflict
  resolution algorithm. PRIMARY KEY, UNIQUE and NOT NULL constraints may be
  explicitly assigned another default conflict resolution algorithm by
  including a <a href="syntax/conflict-clause.html">conflict-clause</a> in their definitions.
  Or, if a constraint definition does not include a <a href="syntax/conflict-clause.html">conflict-clause</a>,
  the default conflict resolution algorithm is ABORT.
  The conflict resolution algorithm for CHECK constraints is always ABORT.
  (For historical compatibility only, table CHECK constraints are allowed
  to have a conflict resolution clause, but that has no effect.)
  Different constraints within the
  same table may have different default conflict resolution algorithms. See
  the section titled <a href="lang_conflict.html">ON CONFLICT</a> for additional information.

<a name="rowid"></a>

</p><h1 id="rowids_and_the_integer_primary_key"><span>5. </span>ROWIDs and the INTEGER PRIMARY KEY</h1>

<p>Except for <a href="withoutrowid.html">WITHOUT ROWID</a> tables, all rows within SQLite tables
have a 64-bit signed integer key that uniquely identifies the row within its table.
This integer is usually
called the "rowid". The rowid value can be accessed using one of the special
case-independent names "rowid", "oid", or "_rowid_" in place of a column name.
If a table contains a user defined column named "rowid", "oid" or "_rowid_",
then that name always refers the explicitly declared column and cannot be used
to retrieve the integer rowid value.

</p><p>The rowid (and "oid" and "_rowid_") is omitted in <a href="withoutrowid.html">WITHOUT ROWID</a> tables.
WITHOUT ROWID tables are only available in SQLite <a href="releaselog/3_8_2.html">version 3.8.2</a>
(2013-12-06) and later.
A table that lacks the WITHOUT ROWID clause is called a "rowid table".

</p><p>The data for rowid tables is stored as a B-Tree structure containing
one entry for each table row, using the rowid value as the key. This means that
retrieving or sorting records by rowid is fast. Searching for a record with a
specific rowid, or for all records with rowids within a specified range is
around twice as fast as a similar search made by specifying any other PRIMARY
KEY or indexed value.

</p><p> With one exception noted below, if a rowid table has a primary key that consists
of a single column and the declared type of that column is "INTEGER" in any mixture of
upper and lower case, then the column becomes an alias for the rowid. Such a
column is usually referred to as an "integer primary key". A PRIMARY KEY column
only becomes an integer primary key if the declared type name is exactly
"INTEGER".  Other integer type names like "INT" or "BIGINT" or "SHORT INTEGER"
or "UNSIGNED INTEGER" causes the primary key column to behave as an ordinary
table column with integer <a href="datatype3.html#affinity">affinity</a> and a unique index, not as an alias for
the rowid.

</p><p> The exception mentioned above is that if the declaration of a column with
declared type "INTEGER" includes an "PRIMARY KEY DESC" clause, it does not
become an alias for the rowid and is not classified as an integer primary key.
This quirk is not by design. It is due to a bug in early versions of SQLite.
But fixing the bug could result in backwards incompatibilities.
Hence, the original behavior has been retained (and documented) because odd
behavior in a corner case is far better than a compatibility break.  This means
that the following three table declarations all cause the column "x" to be an
alias for the rowid (an integer primary key):

</p><ul>
<li><tt>CREATE TABLE t(x INTEGER PRIMARY KEY ASC, y, z);</tt>
</li><li><tt>CREATE TABLE t(x INTEGER, y, z, PRIMARY KEY(x ASC));</tt>
</li><li><tt>CREATE TABLE t(x INTEGER, y, z, PRIMARY KEY(x DESC));</tt>
</li></ul>

<p>But the following declaration does not result in "x" being an alias for
the rowid:
</p><ul>
<li><tt>CREATE TABLE t(x INTEGER PRIMARY KEY DESC, y, z);</tt>
</li></ul>

<p>Rowid values may be modified using an UPDATE statement in the same
way as any other column value can, either using one of the built-in aliases
("rowid", "oid" or "_rowid_") or by using an alias created by an integer
primary key. Similarly, an INSERT statement may provide a value to use as the
rowid for each row inserted. Unlike normal SQLite columns, an integer primary
key or rowid column must contain integer values. Integer primary key or rowid
columns are not able to hold floating point values, strings, BLOBs, or NULLs.

</p><p>If an UPDATE statement attempts to set an integer primary key or rowid column
to a NULL or blob value, or to a string or real value that cannot be losslessly
converted to an integer, a "datatype mismatch" error occurs and the statement
is aborted. If an INSERT statement attempts to insert a blob value, or a string
or real value that cannot be losslessly converted to an integer into an
integer primary key or rowid column, a "datatype mismatch" error occurs and the
statement is aborted.

</p><p>If an INSERT statement attempts to insert a NULL value into a rowid or
integer primary key column, the system chooses an integer value to use as the
rowid automatically. A detailed description of how this is done is provided
<a href="autoinc.html">separately</a>.</p>

<p>The <a href="foreignkeys.html#parentchild">parent key</a> of a <a href="foreignkeys.html">foreign key constraint</a> is not allowed to
use the rowid.  The parent key must used named columns only.</p>
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_createtable.in?m=8cff538651">2024-03-13 17:43:35</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_createtrigger.html.















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>CREATE TRIGGER</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
CREATE TRIGGER
</div>
<div class="fancy_toc">
<a onclick="toggle_toc()">
<span class="fancy_toc_mark" id="toc_mk">&#x25ba;</span>
Table Of Contents
</a>
<div id="toc_sub"><div class="fancy-toc1"><a href="#syntax">1. Syntax</a></div>
<div class="fancy-toc1"><a href="#description">2. Description</a></div>
<div class="fancy-toc2"><a href="#syntax_restrictions_on_update_delete_and_insert_statements_within_triggers">2.1. Syntax Restrictions On UPDATE, DELETE, and INSERT Statements Within
Triggers</a></div>
<div class="fancy-toc1"><a href="#instead_of_triggers">3. INSTEAD OF triggers</a></div>
<div class="fancy-toc1"><a href="#some_example_triggers">4. Some Example Triggers</a></div>
<div class="fancy-toc1"><a href="#cautions_on_the_use_of_before_triggers">5. Cautions On The Use Of BEFORE triggers</a></div>
<div class="fancy-toc1"><a href="#the_raise_function">6. The RAISE() function</a></div>
<div class="fancy-toc1"><a href="#temp_triggers_on_non_temp_tables">7. TEMP Triggers on Non-TEMP Tables</a></div>
</div>
</div>
<script>
function toggle_toc(){
var sub = document.getElementById("toc_sub")
var mk = document.getElementById("toc_mk")
if( sub.style.display!="block" ){
sub.style.display = "block";
mk.innerHTML = "&#x25bc;";
} else {
sub.style.display = "none";
mk.innerHTML = "&#x25ba;";
}
}
</script>
</div>




<h1 id="syntax"><span>1. </span>Syntax</h1>

<p><b><a href="syntax/create-trigger-stmt.html">create-trigger-stmt:</a></b>
<button id='xba191060' onclick='hideorshow("xba191060","x88e4a33f")'>hide</button></p>
 <div id='x88e4a33f' class='imgcontainer'>
 <div style="max-width:678px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 678.058 746.712">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L100,32A15 15 0 0 0 116 17A15 15 0 0 0 100 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CREATE</text>
<path d="M167,56L199,56A15 15 0 0 0 214 41A15 15 0 0 0 199 26L167,26A15 15 0 0 0 152 41A15 15 0 0 0 167 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMP</text>
<path d="M167,94L259,94A15 15 0 0 0 274 79A15 15 0 0 0 259 64L167,64A15 15 0 0 0 152 79A15 15 0 0 0 167 94Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="213" y="79" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMPORARY</text>
<path d="M325,32L386,32A15 15 0 0 0 401 17A15 15 0 0 0 386 2L325,2A15 15 0 0 0 310 17A15 15 0 0 0 325 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRIGGER</text>
<polygon points="213,17 201,21 201,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L207,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="310,17 299,21 299,12" style="fill:rgb(0,0,0)"/>
<path d="M213,17L305,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,41 140,45 140,37" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,29 Q 131,41 138,41 L 146,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,79 140,83 140,74" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,32 L 131,64 Q 131,79 138,79 L 146,79"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M274,79 L 282,79 Q 289,79 289,64 L 289,32 Q 289,17 294,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M214,41 L 274,41 Q 289,41 289,33 L 289,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="437,17 425,21 425,12" style="fill:rgb(0,0,0)"/>
<path d="M401,17L431,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M452,32A15 15 0 0 0 467 17A15 15 0 0 0 452 2A15 15 0 0 0 437 17A15 15 0 0 0 452 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="452" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="490,17 478,21 478,12" style="fill:rgb(0,0,0)"/>
<path d="M467,17L484,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,32L525,32A15 15 0 0 0 540 17A15 15 0 0 0 525 2L505,2A15 15 0 0 0 490 17A15 15 0 0 0 505 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="515" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="563,17 552,21 552,12" style="fill:rgb(0,0,0)"/>
<path d="M540,17L558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,32L623,32A15 15 0 0 0 638 17A15 15 0 0 0 623 2L578,2A15 15 0 0 0 563 17A15 15 0 0 0 578 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="601" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="213,109 224,105 224,113" style="fill:rgb(0,0,0)"/>
<path d="M401,17 L 408,17 Q 416,17 416,32 L 416,94 Q 416,109 401,109 L 234,109 L 219,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="563,109 575,105 575,113" style="fill:rgb(0,0,0)"/>
<path d="M638,17 L 646,17 Q 653,17 653,32 L 653,94 Q 653,109 638,109 L 584,109 L 569,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M563,109L310,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,147 17,151 17,142" style="fill:rgb(0,0,0)"/>
<path d="M310,109 L 20,109 Q 5,109 5,124 L 5,132 Q 5,147 14,147 L 23,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,162L140,162A15 15 0 0 0 155 147A15 15 0 0 0 140 132L43,132A15 15 0 0 0 28 147A15 15 0 0 0 43 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="178,147 166,151 166,142" style="fill:rgb(0,0,0)"/>
<path d="M155,147L172,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M193,162A15 15 0 0 0 208 147A15 15 0 0 0 193 132A15 15 0 0 0 178 147A15 15 0 0 0 193 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="147" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="244,147 233,151 233,142" style="fill:rgb(0,0,0)"/>
<path d="M208,147L238,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,162L351,162A15 15 0 0 0 366 147A15 15 0 0 0 351 132L259,132A15 15 0 0 0 244 147A15 15 0 0 0 259 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="305" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">trigger-name</text>
<polygon points="402,147 391,151 391,142" style="fill:rgb(0,0,0)"/>
<path d="M366,147L396,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,162L472,162A15 15 0 0 0 487 147A15 15 0 0 0 472 132L417,132A15 15 0 0 0 402 147A15 15 0 0 0 417 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BEFORE</text>
<path d="M417,200L457,200A15 15 0 0 0 472 185A15 15 0 0 0 457 169L417,169A15 15 0 0 0 402 185A15 15 0 0 0 417 200Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="437" y="185" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AFTER</text>
<path d="M417,238L479,238A15 15 0 0 0 494 222A15 15 0 0 0 479 207L417,207A15 15 0 0 0 402 222A15 15 0 0 0 417 238Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="448" y="222" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INSTEAD</text>
<polygon points="517,222 505,227 505,218" style="fill:rgb(0,0,0)"/>
<path d="M494,222L511,222"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,238L538,238A15 15 0 0 0 553 222A15 15 0 0 0 538 207L532,207A15 15 0 0 0 517 222A15 15 0 0 0 532 238Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="535" y="222" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OF</text>
<polygon points="402,185 391,189 391,180" style="fill:rgb(0,0,0)"/>
<path d="M366,147 L 374,147 Q 381,147 381,162 L 381,170 Q 381,185 389,185 L 396,185"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="402,222 391,227 391,218" style="fill:rgb(0,0,0)"/>
<path d="M366,147 L 374,147 Q 381,147 381,162 L 381,207 Q 381,222 389,222 L 396,222"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="92,177 80,181 80,173" style="fill:rgb(0,0,0)"/>
<path d="M5,132 L 5,162 Q 5,177 20,177 L 71,177 L 86,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M92,177 L 205,177 Q 220,177 220,162 L 220,162 Q 220,147 227,147 L 235,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="193,260 205,256 205,265" style="fill:rgb(0,0,0)"/>
<path d="M381,207 L 381,245 Q 381,260 366,260 L 214,260 L 199,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="576,222 564,227 564,218" style="fill:rgb(0,0,0)"/>
<path d="M553,222L570,222"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="448,260 459,256 459,265" style="fill:rgb(0,0,0)"/>
<path d="M576,222 L 584,222 Q 591,222 591,237 L 591,245 Q 591,260 576,260 L 469,260 L 454,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,260L366,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="576,147 564,151 564,142" style="fill:rgb(0,0,0)"/>
<path d="M487,147L570,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M576,147 L 584,147 Q 591,147 591,162 L 591,223 L 591,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="576,185 564,189 564,180" style="fill:rgb(0,0,0)"/>
<path d="M472,185L570,185"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M576,185 L 584,185 Q 591,185 591,192 L 591,200"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,306L96,306A15 15 0 0 0 111 290L111,290A15 15 0 0 0 96 275L43,275A15 15 0 0 0 28 290L28,290A15 15 0 0 0 43 306Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="290" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DELETE</text>
<path d="M43,343L92,343A15 15 0 0 0 107 328A15 15 0 0 0 92 313L43,313A15 15 0 0 0 28 328A15 15 0 0 0 43 343Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="68" y="328" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INSERT</text>
<path d="M43,381L98,381A15 15 0 0 0 113 366A15 15 0 0 0 98 351L43,351A15 15 0 0 0 28 366A15 15 0 0 0 43 381Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="366" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="28,366 17,370 17,362" style="fill:rgb(0,0,0)"/>
<path d="M193,260 L 20,260 Q 5,260 5,275 L 5,351 Q 5,366 14,366 L 23,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,290 17,295 17,286" style="fill:rgb(0,0,0)"/>
<path d="M5,275 L 5,283 Q 5,290 14,290 L 23,290"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,328 17,333 17,324" style="fill:rgb(0,0,0)"/>
<path d="M5,313 L 5,321 Q 5,328 14,328 L 23,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M164,411L170,411A15 15 0 0 0 185 396A15 15 0 0 0 170 381L164,381A15 15 0 0 0 149 396A15 15 0 0 0 164 411Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="396" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OF</text>
<polygon points="221,396 209,401 209,392" style="fill:rgb(0,0,0)"/>
<path d="M185,396L215,396"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,411L330,411A15 15 0 0 0 345 396A15 15 0 0 0 330 381L236,381A15 15 0 0 0 221 396A15 15 0 0 0 236 411Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="283" y="396" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<path d="M283,449L283,449A15 15 0 0 0 298 434A15 15 0 0 0 283 419L283,419A15 15 0 0 0 268 434A15 15 0 0 0 283 449Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="283" y="434" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="381,396 369,401 369,392" style="fill:rgb(0,0,0)"/>
<path d="M345,396L375,396"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="419,290 408,295 408,286" style="fill:rgb(0,0,0)"/>
<path d="M381,396 L 388,396 Q 396,396 396,381 L 396,305 Q 396,290 405,290 L 413,290"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M434,306L443,306A15 15 0 0 0 458 290L458,290A15 15 0 0 0 443 275L434,275A15 15 0 0 0 419 290L419,290A15 15 0 0 0 434 306Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="290" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="481,290 470,295 470,286" style="fill:rgb(0,0,0)"/>
<path d="M458,290L475,290"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M496,306L572,306A15 15 0 0 0 587 290L587,290A15 15 0 0 0 572 275L496,275A15 15 0 0 0 481 290L481,290A15 15 0 0 0 496 306Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="290" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<path d="M111,290L408,290"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="381,328 369,333 369,324" style="fill:rgb(0,0,0)"/>
<path d="M107,328L375,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M381,328 L 388,328 Q 396,328 396,321 L 396,313"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="381,366 369,370 369,362" style="fill:rgb(0,0,0)"/>
<path d="M113,366L375,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M381,366 L 388,366 Q 396,366 396,359 L 396,351"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="149,396 137,401 137,392" style="fill:rgb(0,0,0)"/>
<path d="M113,366 L 120,366 Q 128,366 128,381 L 128,381 Q 128,396 135,396 L 143,396"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,434 309,430 309,438" style="fill:rgb(0,0,0)"/>
<path d="M345,396 L 352,396 Q 360,396 360,411 L 360,419 Q 360,434 345,434 L 319,434 L 304,434"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M268,434 L 213,434 Q 198,434 198,419 L 198,411 Q 198,396 205,396 L 213,396"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,525L62,525A15 15 0 0 0 77 510A15 15 0 0 0 62 495L43,495A15 15 0 0 0 28 510A15 15 0 0 0 43 525Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="52" y="510" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOR</text>
<polygon points="100,510 88,514 88,505" style="fill:rgb(0,0,0)"/>
<path d="M77,510L94,510"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M115,525L147,525A15 15 0 0 0 162 510A15 15 0 0 0 147 495L115,495A15 15 0 0 0 100 510A15 15 0 0 0 115 525Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="131" y="510" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EACH</text>
<polygon points="185,510 174,514 174,505" style="fill:rgb(0,0,0)"/>
<path d="M162,510L179,510"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,525L224,525A15 15 0 0 0 240 510A15 15 0 0 0 224 495L200,495A15 15 0 0 0 185 510A15 15 0 0 0 200 525Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="212" y="510" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="312,510 300,514 300,505" style="fill:rgb(0,0,0)"/>
<path d="M240,510L306,510"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M327,525L366,525A15 15 0 0 0 381 510A15 15 0 0 0 366 495L327,495A15 15 0 0 0 312 510A15 15 0 0 0 327 525Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="510" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="404,510 393,514 393,505" style="fill:rgb(0,0,0)"/>
<path d="M381,510L399,510"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,525L454,525L454,495L404,495Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="510" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M43,631L82,631A15 15 0 0 0 97 616A15 15 0 0 0 82 600L43,600A15 15 0 0 0 28 616A15 15 0 0 0 43 631Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="63" y="616" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BEGIN</text>
<polygon points="169,616 158,620 158,611" style="fill:rgb(0,0,0)"/>
<path d="M97,616L163,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M169,631L282,631L282,600L169,600Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="226" y="616" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">update-stmt</text>
<polygon points="336,616 324,620 324,611" style="fill:rgb(0,0,0)"/>
<path d="M282,616L330,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,631A15 15 0 0 0 366 616A15 15 0 0 0 351 600A15 15 0 0 0 336 616A15 15 0 0 0 351 631Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="616" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">;</text>
<polygon points="402,616 391,620 391,611" style="fill:rgb(0,0,0)"/>
<path d="M366,616L396,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,631L438,631A15 15 0 0 0 453 616A15 15 0 0 0 438 600L417,600A15 15 0 0 0 402 616A15 15 0 0 0 417 631Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="428" y="616" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="668,616 657,620 657,611" style="fill:rgb(0,0,0)"/>
<path d="M453,616L662,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="672" cy="616" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M169,668L273,668L273,638L169,638Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="221" y="653" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">insert-stmt</text>
<path d="M169,706L276,706L276,676L169,676Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="223" y="691" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">delete-stmt</text>
<path d="M169,744L273,744L273,714L169,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="221" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="169,729 158,733 158,725" style="fill:rgb(0,0,0)"/>
<path d="M131,616 L 139,616 Q 146,616 146,631 L 146,714 Q 146,729 155,729 L 163,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="169,653 158,658 158,649" style="fill:rgb(0,0,0)"/>
<path d="M146,638 L 146,646 Q 146,653 155,653 L 163,653"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="169,691 158,695 158,687" style="fill:rgb(0,0,0)"/>
<path d="M146,676 L 146,684 Q 146,691 155,691 L 163,691"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,729 286,733 286,725" style="fill:rgb(0,0,0)"/>
<path d="M273,729L292,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,729 L 305,729 Q 313,729 313,714 L 313,631 Q 313,616 319,616 L 324,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,653 286,658 286,649" style="fill:rgb(0,0,0)"/>
<path d="M273,653L292,653"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,653 L 305,653 Q 313,653 313,646 L 313,638"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,691 286,695 286,687" style="fill:rgb(0,0,0)"/>
<path d="M276,691L292,691"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,691 L 305,691 Q 313,691 313,684 L 313,676"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="226,585 237,581 237,590" style="fill:rgb(0,0,0)"/>
<path d="M366,616 L 374,616 Q 381,616 381,601 L 381,600 Q 381,585 366,585 L 246,585 L 231,585"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="132,616 120,620 120,611" style="fill:rgb(0,0,0)"/>
<path d="M226,585 L 124,585 Q 109,585 109,600 L 109,601 Q 109,616 117,616 L 126,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="602,434 597,423 606,423" style="fill:rgb(0,0,0)"/>
<path d="M587,290 L 594,290 Q 602,290 602,305 L 602,414 L 602,429"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="226,472 237,468 237,476" style="fill:rgb(0,0,0)"/>
<path d="M602,434 L 602,457 Q 602,472 587,472 L 246,472 L 231,472"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,616 17,620 17,611" style="fill:rgb(0,0,0)"/>
<path d="M226,472 L 20,472 Q 5,472 5,487 L 5,601 Q 5,616 14,616 L 23,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,510 17,514 17,505" style="fill:rgb(0,0,0)"/>
<path d="M5,495 L 5,502 Q 5,510 14,510 L 23,510"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="226,547 237,543 237,552" style="fill:rgb(0,0,0)"/>
<path d="M454,510 L 461,510 Q 469,510 469,525 L 469,532 Q 469,547 454,547 L 246,547 L 231,547"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M226,547 L 20,547 Q 5,547 5,555 L 5,562"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,510 L 247,510 Q 255,510 255,525 L 255,532 Q 255,547 247,547 L 240,547"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M312,510 L 297,510 Q 282,510 282,495 L 282,487 Q 282,472 297,472 L 312,472"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/delete-stmt.html">delete-stmt:</a></b>
<button id='x812692df' onclick='hideorshow("x812692df","x6320d9e0")'>show</button></p>
 <div id='x6320d9e0' style='display:none;' class='imgcontainer'>
 <div style="max-width:648px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 648.706 220.32">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L114,32A15 15 0 0 0 129 17A15 15 0 0 0 114 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="98" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M189,62L275,62A15 15 0 0 0 290 47A15 15 0 0 0 275 32L189,32A15 15 0 0 0 174 47A15 15 0 0 0 189 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="232" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="232,17 220,21 220,12" style="fill:rgb(0,0,0)"/>
<path d="M129,17L226,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,17 368,21 368,12" style="fill:rgb(0,0,0)"/>
<path d="M232,17L374,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,32L606,32L606,2L380,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="174,47 162,51 162,43" style="fill:rgb(0,0,0)"/>
<path d="M129,17 L 136,17 Q 144,17 144,32 L 144,32 Q 144,47 156,47 L 168,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,47 301,51 301,43" style="fill:rgb(0,0,0)"/>
<path d="M290,47L307,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,47 L 321,47 Q 328,47 328,32 L 328,32 Q 328,17 343,17 L 353,17 L 368,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,70A15 15 0 0 0 508 55L508,55A15 15 0 0 0 493 39A15 15 0 0 0 478 55L478,55A15 15 0 0 0 493 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="508,55 520,50 520,59" style="fill:rgb(0,0,0)"/>
<path d="M606,17 L 614,17 Q 621,17 621,32 L 621,40 Q 621,55 606,55 L 529,55 L 514,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,55 L 372,55 Q 357,55 357,40 L 357,32 Q 357,17 363,17 L 368,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,138L136,138A15 15 0 0 0 151 123A15 15 0 0 0 136 108L83,108A15 15 0 0 0 68 123A15 15 0 0 0 83 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DELETE</text>
<polygon points="174,123 163,127 163,118" style="fill:rgb(0,0,0)"/>
<path d="M151,123L168,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,138L224,138A15 15 0 0 0 239 123A15 15 0 0 0 224 108L189,108A15 15 0 0 0 174 123A15 15 0 0 0 189 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="207" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="262,123 251,127 251,118" style="fill:rgb(0,0,0)"/>
<path d="M239,123L256,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M262,138L447,138L447,108L262,108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">qualified-table-name</text>
<circle cx="642" cy="213" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M639,213 L 618,213 Q 603,213 603,198 L 603,198 Q 603,183 595,183 L 588,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M437,198L588,198L588,168L437,168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="512" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">returning-clause</text>
<polygon points="437,183 425,187 425,179" style="fill:rgb(0,0,0)"/>
<path d="M431,183 L 421,183 Q 410,183 410,198 L 410,198 Q 410,213 403,213 L 395,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,213 384,218 384,209" style="fill:rgb(0,0,0)"/>
<path d="M390,213 L 379,213 Q 369,213 369,198 L 369,198 Q 369,183 361,183 L 354,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M305,198L354,198L354,168L305,168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="329" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="305,183 293,187 293,179" style="fill:rgb(0,0,0)"/>
<path d="M299,183L282,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,198L267,198A15 15 0 0 0 282 183A15 15 0 0 0 267 168L217,168A15 15 0 0 0 202 183A15 15 0 0 0 217 198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="242" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="355,153 366,149 366,157" style="fill:rgb(0,0,0)"/>
<path d="M447,123 L 455,123 Q 462,123 462,138 L 462,138 Q 462,153 447,153 L 375,153 L 360,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="202,183 190,187 190,179" style="fill:rgb(0,0,0)"/>
<path d="M355,153 L 195,153 Q 180,153 180,168 L 180,168 Q 180,183 188,183 L 196,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="639,213 627,218 627,209" style="fill:rgb(0,0,0)"/>
<path d="M180,172 L 180,198 Q 180,213 195,213 L 618,213 L 633,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="355,85 366,81 366,89" style="fill:rgb(0,0,0)"/>
<path d="M606,17 L 614,17 Q 621,17 621,32 L 621,70 Q 621,85 606,85 L 375,85 L 360,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,123 56,127 56,118" style="fill:rgb(0,0,0)"/>
<path d="M355,85 L 62,85 Q 47,85 47,100 L 47,108 Q 47,123 55,123 L 62,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,47 43,36 51,36" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,29 L 47,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,47L47,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/common-table-expression.html">common-table-expression:</a></b>
<button id='xb0205196' onclick='hideorshow("xb0205196","x1c4f35b7")'>show</button></p>
 <div id='x1c4f35b7' style='display:none;' class='imgcontainer'>
 <div style="max-width:638px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 638.525 167.4">
<circle cx="5" cy="29" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,29 20,33 20,24" style="fill:rgb(0,0,0)"/>
<path d="M9,29L26,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,44L122,44A15 15 0 0 0 137 29A15 15 0 0 0 122 14L47,14A15 15 0 0 0 32 29A15 15 0 0 0 47 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="160,29 149,33 149,24" style="fill:rgb(0,0,0)"/>
<path d="M137,29L155,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="196,29 185,33 185,24" style="fill:rgb(0,0,0)"/>
<path d="M160,29L191,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,44A15 15 0 0 0 227 29A15 15 0 0 0 211 14A15 15 0 0 0 196 29A15 15 0 0 0 211 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="250,29 238,33 238,24" style="fill:rgb(0,0,0)"/>
<path d="M227,29L244,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="286,29 274,33 274,24" style="fill:rgb(0,0,0)"/>
<path d="M250,29L280,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,44L395,44A15 15 0 0 0 410 29A15 15 0 0 0 395 14L301,14A15 15 0 0 0 286 29A15 15 0 0 0 301 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="446,29 434,33 434,24" style="fill:rgb(0,0,0)"/>
<path d="M410,29L440,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,44A15 15 0 0 0 476 29A15 15 0 0 0 461 14A15 15 0 0 0 446 29A15 15 0 0 0 461 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,29 499,33 499,24" style="fill:rgb(0,0,0)"/>
<path d="M476,29L505,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,165L51,165A15 15 0 0 0 66 150A15 15 0 0 0 51 135L47,135A15 15 0 0 0 32 150A15 15 0 0 0 47 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="49" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<path d="M127,135L147,135A15 15 0 0 0 162 119A15 15 0 0 0 147 104L127,104A15 15 0 0 0 112 119A15 15 0 0 0 127 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<path d="M219,135L337,135A15 15 0 0 0 352 119A15 15 0 0 0 337 104L219,104A15 15 0 0 0 204 119A15 15 0 0 0 219 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<path d="M162,119L204,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,165A15 15 0 0 0 425 150A15 15 0 0 0 410 135A15 15 0 0 0 395 150A15 15 0 0 0 410 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="410" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="448,150 437,154 437,145" style="fill:rgb(0,0,0)"/>
<path d="M425,150L442,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,165L552,165L552,135L448,135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="500" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="575,150 564,154 564,145" style="fill:rgb(0,0,0)"/>
<path d="M552,150L570,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M591,165A15 15 0 0 0 606 150A15 15 0 0 0 591 135A15 15 0 0 0 575 150A15 15 0 0 0 591 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="629,150 617,154 617,145" style="fill:rgb(0,0,0)"/>
<path d="M606,150L623,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="632" cy="150" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,82A15 15 0 0 0 363 66A15 15 0 0 0 348 51A15 15 0 0 0 333 66A15 15 0 0 0 348 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="363,66 374,62 374,71" style="fill:rgb(0,0,0)"/>
<path d="M410,29 L 417,29 Q 425,29 425,44 L 425,51 Q 425,66 410,66 L 384,66 L 369,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M333,66 L 278,66 Q 263,66 263,51 L 263,44 Q 263,29 270,29 L 278,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,93 78,89 78,97" style="fill:rgb(0,0,0)"/>
<path d="M511,29 L 516,29 Q 522,29 522,44 L 522,78 Q 522,93 507,93 L 87,93 L 72,93"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,150 20,154 20,145" style="fill:rgb(0,0,0)"/>
<path d="M66,93 L 30,93 Q 15,93 15,108 L 15,135 Q 15,150 20,150 L 26,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="85,150 73,154 73,145" style="fill:rgb(0,0,0)"/>
<path d="M66,150L79,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="112,119 101,124 101,115" style="fill:rgb(0,0,0)"/>
<path d="M85,150 L 89,150 Q 92,150 92,135 L 92,134 Q 92,119 99,119 L 106,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="204,119 192,124 192,115" style="fill:rgb(0,0,0)"/>
<path d="M66,150 L 147,150 Q 162,150 170,150 Q 177,150 177,135 L 177,134 Q 177,119 188,119 L 198,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,150 383,154 383,145" style="fill:rgb(0,0,0)"/>
<path d="M352,119 L 360,119 Q 367,119 367,134 L 367,135 Q 367,150 378,150 L 389,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150L395,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,6 336,10 336,2" style="fill:rgb(0,0,0)"/>
<path d="M160,29 L 168,29 Q 175,29 175,17 Q 175,6 190,6 L 327,6 L 342,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,6 L 473,6 Q 488,6 488,17 Q 488,29 495,29 L 503,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/qualified-table-name.html">qualified-table-name:</a></b>
<button id='x160ac4cf' onclick='hideorshow("x160ac4cf","xbbb41514")'>show</button></p>
 <div id='xbbb41514' style='display:none;' class='imgcontainer'>
 <div style="max-width:599px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 599.746 182.736">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L156,32A15 15 0 0 0 171 17A15 15 0 0 0 156 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,17 183,21 183,12" style="fill:rgb(0,0,0)"/>
<path d="M171,17L189,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,32A15 15 0 0 0 225 17A15 15 0 0 0 210 2A15 15 0 0 0 195 17A15 15 0 0 0 210 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,17 249,21 249,12" style="fill:rgb(0,0,0)"/>
<path d="M225,17L255,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,32L351,32A15 15 0 0 0 366 17A15 15 0 0 0 351 2L276,2A15 15 0 0 0 261 17A15 15 0 0 0 276 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="408,44 396,48 396,40" style="fill:rgb(0,0,0)"/>
<path d="M366,17 L 374,17 Q 381,17 381,30 Q 381,44 392,44 L 402,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,59L427,59A15 15 0 0 0 442 44L442,44A15 15 0 0 0 427 29L423,29A15 15 0 0 0 408 44L408,44A15 15 0 0 0 423 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="465,44 453,48 453,40" style="fill:rgb(0,0,0)"/>
<path d="M442,44L459,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,59L501,59A15 15 0 0 0 516 44L516,44A15 15 0 0 0 501 29L480,29A15 15 0 0 0 465 44L465,44A15 15 0 0 0 480 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="490" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">alias</text>
<polygon points="539,44 527,48 527,40" style="fill:rgb(0,0,0)"/>
<path d="M516,44L533,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,44 L 546,44 Q 554,44 554,51 L 554,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="453,17 442,21 442,12" style="fill:rgb(0,0,0)"/>
<path d="M366,17L448,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,44 97,48 97,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 39,44 L 87,44 L 102,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M108,44 L 225,44 Q 240,44 240,30 Q 240,17 247,17 L 255,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,142L301,142A15 15 0 0 0 316 127A15 15 0 0 0 301 112L236,112A15 15 0 0 0 221 127A15 15 0 0 0 236 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="339,127 327,131 327,123" style="fill:rgb(0,0,0)"/>
<path d="M316,127L333,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,142L358,142A15 15 0 0 0 373 127A15 15 0 0 0 358 112L354,112A15 15 0 0 0 339 127A15 15 0 0 0 354 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="396,127 385,131 385,123" style="fill:rgb(0,0,0)"/>
<path d="M373,127L390,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M411,142L490,142A15 15 0 0 0 505 127A15 15 0 0 0 490 112L411,112A15 15 0 0 0 396 127A15 15 0 0 0 411 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="451" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M236,180L256,180A15 15 0 0 0 271 165A15 15 0 0 0 256 150L236,150A15 15 0 0 0 221 165A15 15 0 0 0 236 180Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="165" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="294,165 283,169 283,161" style="fill:rgb(0,0,0)"/>
<path d="M271,165L289,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,180L374,180A15 15 0 0 0 389 165A15 15 0 0 0 374 150L310,150A15 15 0 0 0 294 165A15 15 0 0 0 310 180Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="342" y="165" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="554,74 550,62 558,62" style="fill:rgb(0,0,0)"/>
<path d="M453,17 L 539,17 Q 554,17 554,32 L 554,53 L 554,68"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 325,85 325,94" style="fill:rgb(0,0,0)"/>
<path d="M554,74 L 554,82 Q 554,89 539,89 L 334,89 L 319,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="221,127 210,131 210,123" style="fill:rgb(0,0,0)"/>
<path d="M313,89 L 210,89 Q 195,89 195,104 L 195,112 Q 195,127 205,127 L 215,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="221,165 210,169 210,161" style="fill:rgb(0,0,0)"/>
<path d="M195,112 L 195,150 Q 195,165 205,165 L 215,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="554,114 550,102 558,102" style="fill:rgb(0,0,0)"/>
<path d="M554,74L554,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="590,165 578,169 578,161" style="fill:rgb(0,0,0)"/>
<path d="M554,114 L 554,150 Q 554,165 569,165 L 569,165 L 584,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="593" cy="165" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="539,127 527,131 527,123" style="fill:rgb(0,0,0)"/>
<path d="M505,127L533,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,127 L 546,127 Q 554,127 554,135 L 554,142"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M389,165L578,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/returning-clause.html">returning-clause:</a></b>
<button id='x4f3c424a' onclick='hideorshow("x4f3c424a","x7d4650de")'>show</button></p>
 <div id='x7d4650de' style='display:none;' class='imgcontainer'>
 <div style="max-width:628px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 628.709 140.4">
<circle cx="5" cy="47" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="27,47 15,51 15,43" style="fill:rgb(0,0,0)"/>
<path d="M9,47L21,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M42,62L132,62A15 15 0 0 0 147 47A15 15 0 0 0 132 32L42,32A15 15 0 0 0 27 47A15 15 0 0 0 42 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RETURNING</text>
<polygon points="237,47 226,51 226,43" style="fill:rgb(0,0,0)"/>
<path d="M147,47L232,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M237,62L287,62L287,32L237,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="262" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="328,77 317,82 317,73" style="fill:rgb(0,0,0)"/>
<path d="M287,47 L 294,47 Q 302,47 302,62 L 302,62 Q 302,77 312,77 L 322,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M343,92L347,92A15 15 0 0 0 362 77L362,77A15 15 0 0 0 347 62L343,62A15 15 0 0 0 328 77L328,77A15 15 0 0 0 343 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="398,77 387,82 387,73" style="fill:rgb(0,0,0)"/>
<path d="M362,77L393,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M414,92L501,92A15 15 0 0 0 516 77L516,77A15 15 0 0 0 501 62L414,62A15 15 0 0 0 398 77L398,77A15 15 0 0 0 414 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="457" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="539,77 528,82 528,73" style="fill:rgb(0,0,0)"/>
<path d="M516,77L534,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="581,47 569,51 569,43" style="fill:rgb(0,0,0)"/>
<path d="M539,77 L 547,77 Q 554,77 554,62 L 554,62 Q 554,47 565,47 L 575,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="619,47 607,51 607,43" style="fill:rgb(0,0,0)"/>
<path d="M581,47L613,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="622" cy="47" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="345,101 334,106 334,97" style="fill:rgb(0,0,0)"/>
<path d="M302,62 L 302,86 Q 302,101 317,101 L 325,101 L 340,101"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,101 L 362,101 Q 377,101 377,89 Q 377,77 385,77 L 392,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="453,47 441,51 441,43" style="fill:rgb(0,0,0)"/>
<path d="M287,47L447,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,47L607,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,138A15 15 0 0 0 406 123A15 15 0 0 0 391 108A15 15 0 0 0 376 123A15 15 0 0 0 391 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="391" y="123" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="376,123 365,127 365,118" style="fill:rgb(0,0,0)"/>
<path d="M147,47 L 196,47 Q 211,47 211,62 L 211,108 Q 211,123 226,123 L 355,123 L 370,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="539,123 528,127 528,118" style="fill:rgb(0,0,0)"/>
<path d="M406,123L534,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,123 L 547,123 Q 554,123 554,108 L 554,77 L 554,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,32A15 15 0 0 0 406 17A15 15 0 0 0 391 2A15 15 0 0 0 376 17A15 15 0 0 0 391 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="391" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="406,17 418,12 418,21" style="fill:rgb(0,0,0)"/>
<path d="M581,47 L 588,47 Q 596,47 596,32 L 596,32 Q 596,17 581,17 L 427,17 L 412,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="186,47 174,51 174,43" style="fill:rgb(0,0,0)"/>
<path d="M376,17 L 174,17 Q 159,17 159,32 L 159,32 Q 159,47 169,47 L 180,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/expr.html">expr:</a></b>
<button id='xfb3481e7' onclick='hideorshow("xfb3481e7","xc95abd2d")'>show</button></p>
 <div id='xc95abd2d' style='display:none;' class='imgcontainer'>
 <div style="max-width:963px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 963.96 1068.77">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L158,32L158,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="101" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="954,17 943,21 943,12" style="fill:rgb(0,0,0)"/>
<path d="M158,17L948,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="958" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L172,70A15 15 0 0 0 187 55L187,55A15 15 0 0 0 172 39L60,39A15 15 0 0 0 45 55L45,55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">bind-parameter</text>
<polygon points="916,55 905,59 905,50" style="fill:rgb(0,0,0)"/>
<path d="M187,55L910,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,55 L 924,55 Q 931,55 931,47 L 931,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 31,55 L 39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,130L156,130A15 15 0 0 0 171 115A15 15 0 0 0 156 100L60,100A15 15 0 0 0 45 115A15 15 0 0 0 60 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,115 183,119 183,111" style="fill:rgb(0,0,0)"/>
<path d="M171,115L189,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,130A15 15 0 0 0 225 115A15 15 0 0 0 210 100A15 15 0 0 0 195 115A15 15 0 0 0 210 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M225,115L255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130L351,130A15 15 0 0 0 366 115A15 15 0 0 0 351 100L276,100A15 15 0 0 0 261 115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="389,115 378,119 378,111" style="fill:rgb(0,0,0)"/>
<path d="M366,115L383,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,130A15 15 0 0 0 419 115A15 15 0 0 0 404 100A15 15 0 0 0 389 115A15 15 0 0 0 404 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="404" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="455,115 444,119 444,111" style="fill:rgb(0,0,0)"/>
<path d="M419,115L450,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,130L565,130A15 15 0 0 0 580 115A15 15 0 0 0 565 100L471,100A15 15 0 0 0 455 115A15 15 0 0 0 471 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="916,115 905,119 905,111" style="fill:rgb(0,0,0)"/>
<path d="M580,115L910,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,115 L 924,115 Q 931,115 931,108 L 931,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,115 33,119 33,111" style="fill:rgb(0,0,0)"/>
<path d="M24,100 L 24,108 Q 24,115 31,115 L 39,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,89 97,93 97,84" style="fill:rgb(0,0,0)"/>
<path d="M24,74 L 24,81 Q 24,89 39,89 L 87,89 L 102,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 302,93 302,84" style="fill:rgb(0,0,0)"/>
<path d="M108,89 L 129,89 Q 144,89 159,89 L 293,89 L 308,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,89 L 414,89 Q 429,89 429,102 Q 429,115 436,115 L 444,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M223,89 L 230,89 Q 238,89 238,102 Q 238,115 245,115 L 253,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,168L168,168A15 15 0 0 0 183 153A15 15 0 0 0 168 138L60,138A15 15 0 0 0 45 153A15 15 0 0 0 60 168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">unary-operator</text>
<polygon points="206,153 194,157 194,149" style="fill:rgb(0,0,0)"/>
<path d="M183,153L200,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,168L255,168L255,138L206,138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,153 905,157 905,149" style="fill:rgb(0,0,0)"/>
<path d="M255,153L910,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,153 L 924,153 Q 931,153 931,145 L 931,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,153 33,157 33,149" style="fill:rgb(0,0,0)"/>
<path d="M24,138 L 24,145 Q 24,153 31,153 L 39,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,206L94,206L94,176L45,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,191 106,195 106,186" style="fill:rgb(0,0,0)"/>
<path d="M94,191L111,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,206L245,206A15 15 0 0 0 261 191A15 15 0 0 0 245 176L132,176A15 15 0 0 0 117 191A15 15 0 0 0 132 206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">binary-operator</text>
<polygon points="284,191 272,195 272,186" style="fill:rgb(0,0,0)"/>
<path d="M261,191L278,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,206L333,206L333,176L284,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="308" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,191 905,195 905,186" style="fill:rgb(0,0,0)"/>
<path d="M333,191L910,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,191 L 924,191 Q 931,191 931,183 L 931,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,191 33,195 33,186" style="fill:rgb(0,0,0)"/>
<path d="M24,176 L 24,183 Q 24,191 31,191 L 39,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,245L162,245A15 15 0 0 0 177 230A15 15 0 0 0 162 215L60,215A15 15 0 0 0 45 230A15 15 0 0 0 60 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="111" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-name</text>
<polygon points="194,230 183,234 183,226" style="fill:rgb(0,0,0)"/>
<path d="M177,230L188,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,245A15 15 0 0 0 224 230A15 15 0 0 0 209 215A15 15 0 0 0 194 230A15 15 0 0 0 209 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="260,230 249,234 249,226" style="fill:rgb(0,0,0)"/>
<path d="M224,230L255,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,245L437,245L437,215L260,215Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-arguments</text>
<polygon points="473,230 461,234 461,226" style="fill:rgb(0,0,0)"/>
<path d="M437,230L467,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,245A15 15 0 0 0 503 230A15 15 0 0 0 488 215A15 15 0 0 0 473 230A15 15 0 0 0 488 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="541,260 529,265 529,256" style="fill:rgb(0,0,0)"/>
<path d="M503,230 L 510,230 Q 518,230 518,245 L 518,245 Q 518,260 527,260 L 535,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,275L653,275L653,245L541,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="691,230 680,234 680,226" style="fill:rgb(0,0,0)"/>
<path d="M653,260 L 661,260 Q 668,260 668,245 L 668,245 Q 668,230 677,230 L 685,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="729,260 718,265 718,256" style="fill:rgb(0,0,0)"/>
<path d="M691,230 L 699,230 Q 706,230 706,245 L 706,245 Q 706,260 715,260 L 723,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,275L837,275L837,245L729,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="783" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">over-clause</text>
<polygon points="916,260 905,265 905,256" style="fill:rgb(0,0,0)"/>
<path d="M837,260L910,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,260 L 924,260 Q 931,260 931,253 L 931,245"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,230 33,234 33,226" style="fill:rgb(0,0,0)"/>
<path d="M24,215 L 24,222 Q 24,230 31,230 L 39,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,230 585,234 585,226" style="fill:rgb(0,0,0)"/>
<path d="M503,230L591,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,230L680,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,230 905,234 905,226" style="fill:rgb(0,0,0)"/>
<path d="M691,230L910,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,230 L 924,230 Q 931,230 931,222 L 931,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,321A15 15 0 0 0 75 306A15 15 0 0 0 60 290A15 15 0 0 0 45 306A15 15 0 0 0 60 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,306 100,310 100,301" style="fill:rgb(0,0,0)"/>
<path d="M75,306L105,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M111,321L160,321L160,290L111,290Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="306" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="196,306 185,310 185,301" style="fill:rgb(0,0,0)"/>
<path d="M160,306L191,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,321A15 15 0 0 0 227 306A15 15 0 0 0 211 290A15 15 0 0 0 196 306A15 15 0 0 0 211 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,306 905,310 905,301" style="fill:rgb(0,0,0)"/>
<path d="M227,306L910,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,306 L 924,306 Q 931,306 931,298 L 931,291"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,306 33,310 33,301" style="fill:rgb(0,0,0)"/>
<path d="M24,290 L 24,298 Q 24,306 31,306 L 39,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,284A15 15 0 0 0 151 269A15 15 0 0 0 136 254A15 15 0 0 0 121 269A15 15 0 0 0 136 284Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="269" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="151,269 162,265 162,274" style="fill:rgb(0,0,0)"/>
<path d="M160,306 L 168,306 Q 175,306 175,291 L 175,284 Q 175,269 166,269 L 157,269"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,269 L 103,269 Q 88,269 88,284 L 88,291 Q 88,306 96,306 L 103,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,358L88,358A15 15 0 0 0 103 343A15 15 0 0 0 88 328L60,328A15 15 0 0 0 45 343A15 15 0 0 0 60 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CAST</text>
<polygon points="126,343 114,348 114,339" style="fill:rgb(0,0,0)"/>
<path d="M103,343L120,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M141,358A15 15 0 0 0 156 343A15 15 0 0 0 141 328A15 15 0 0 0 126 343A15 15 0 0 0 141 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="179,343 168,348 168,339" style="fill:rgb(0,0,0)"/>
<path d="M156,343L173,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,358L228,358L228,328L179,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="251,343 240,348 240,339" style="fill:rgb(0,0,0)"/>
<path d="M228,343L246,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,358L271,358A15 15 0 0 0 286 343A15 15 0 0 0 271 328L267,328A15 15 0 0 0 251 343A15 15 0 0 0 267 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="269" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="309,343 297,348 297,339" style="fill:rgb(0,0,0)"/>
<path d="M286,343L303,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,358L408,358L408,328L309,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="358" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="431,343 419,348 419,339" style="fill:rgb(0,0,0)"/>
<path d="M408,343L425,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M446,358A15 15 0 0 0 461 343A15 15 0 0 0 446 328A15 15 0 0 0 431 343A15 15 0 0 0 446 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,343 905,348 905,339" style="fill:rgb(0,0,0)"/>
<path d="M461,343L910,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,343 L 924,343 Q 931,343 931,336 L 931,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,343 33,348 33,339" style="fill:rgb(0,0,0)"/>
<path d="M24,328 L 24,336 Q 24,343 31,343 L 39,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,396L94,396L94,366L45,366Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,381 106,385 106,377" style="fill:rgb(0,0,0)"/>
<path d="M94,381L111,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,396L196,396A15 15 0 0 0 211 381A15 15 0 0 0 196 366L132,366A15 15 0 0 0 117 381A15 15 0 0 0 132 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="234,381 223,385 223,377" style="fill:rgb(0,0,0)"/>
<path d="M211,381L229,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,396L355,396A15 15 0 0 0 370 381A15 15 0 0 0 355 366L250,366A15 15 0 0 0 234 381A15 15 0 0 0 250 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="916,381 905,385 905,377" style="fill:rgb(0,0,0)"/>
<path d="M370,381L910,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,381 L 924,381 Q 931,381 931,374 L 931,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,381 33,385 33,377" style="fill:rgb(0,0,0)"/>
<path d="M24,366 L 24,374 Q 24,381 31,381 L 39,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,434L94,434L94,404L45,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,419 119,423 119,415" style="fill:rgb(0,0,0)"/>
<path d="M94,419L124,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,434L165,434A15 15 0 0 0 180 419A15 15 0 0 0 165 404L145,404A15 15 0 0 0 130 419A15 15 0 0 0 145 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="234,419 223,423 223,415" style="fill:rgb(0,0,0)"/>
<path d="M180,419L229,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,434L273,434A15 15 0 0 0 288 419A15 15 0 0 0 273 404L250,404A15 15 0 0 0 234 419A15 15 0 0 0 250 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIKE</text>
<path d="M250,472L279,472A15 15 0 0 0 294 457A15 15 0 0 0 279 442L250,442A15 15 0 0 0 234 457A15 15 0 0 0 250 472Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="457" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GLOB</text>
<path d="M250,510L302,510A15 15 0 0 0 317 495A15 15 0 0 0 302 479L250,479A15 15 0 0 0 234 495A15 15 0 0 0 250 510Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REGEXP</text>
<path d="M250,547L297,547A15 15 0 0 0 313 532A15 15 0 0 0 297 517L250,517A15 15 0 0 0 234 532A15 15 0 0 0 250 547Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="274" y="532" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<path d="M378,510L427,510L427,479L378,479Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M378,434L427,434L427,404L378,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="465,449 454,454 454,445" style="fill:rgb(0,0,0)"/>
<path d="M427,419 L 435,419 Q 442,419 442,434 L 442,434 Q 442,449 451,449 L 460,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,464L532,464A15 15 0 0 0 547 449A15 15 0 0 0 532 434L480,434A15 15 0 0 0 465 449A15 15 0 0 0 480 464Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="506" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ESCAPE</text>
<polygon points="570,449 559,454 559,445" style="fill:rgb(0,0,0)"/>
<path d="M547,449L565,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M570,464L620,464L620,434L570,434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="595" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="671,419 659,423 659,415" style="fill:rgb(0,0,0)"/>
<path d="M620,449 L 627,449 Q 635,449 635,434 L 635,434 Q 635,419 650,419 L 650,419 L 665,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,419 905,423 905,415" style="fill:rgb(0,0,0)"/>
<path d="M671,419L910,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,419 L 924,419 Q 931,419 931,411 L 931,404"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,419 33,423 33,415" style="fill:rgb(0,0,0)"/>
<path d="M24,404 L 24,411 Q 24,419 31,419 L 39,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M100,419 L 108,419 Q 115,419 115,434 L 115,434 Q 115,449 130,449 L 177,449 Q 192,449 192,434 L 192,434 Q 192,419 199,419 L 207,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,532 223,537 223,528" style="fill:rgb(0,0,0)"/>
<path d="M196,419 L 204,419 Q 211,419 211,434 L 211,517 Q 211,532 220,532 L 229,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,457 223,461 223,452" style="fill:rgb(0,0,0)"/>
<path d="M211,442 L 211,449 Q 211,457 220,457 L 229,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,495 223,499 223,490" style="fill:rgb(0,0,0)"/>
<path d="M211,479 L 211,487 Q 211,495 220,495 L 229,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,419 367,423 367,415" style="fill:rgb(0,0,0)"/>
<path d="M288,419L372,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,532 329,537 329,528" style="fill:rgb(0,0,0)"/>
<path d="M313,532L334,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,495 367,499 367,490" style="fill:rgb(0,0,0)"/>
<path d="M340,532 L 348,532 Q 355,532 355,517 L 355,510 Q 355,495 364,495 L 372,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,495 329,499 329,490" style="fill:rgb(0,0,0)"/>
<path d="M317,495L334,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,495L378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,457 329,461 329,452" style="fill:rgb(0,0,0)"/>
<path d="M294,457L334,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,457 L 348,457 Q 355,457 355,472 L 355,480 Q 355,495 367,495 L 378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="506,419 495,423 495,415" style="fill:rgb(0,0,0)"/>
<path d="M427,419L501,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M506,419L659,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="547,495 536,499 536,490" style="fill:rgb(0,0,0)"/>
<path d="M427,495L542,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,495 L 656,495 Q 671,495 671,480 L 671,434 Q 671,419 686,419 L 692,419 L 707,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,585L94,585L94,555L45,555Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,570 119,574 119,566" style="fill:rgb(0,0,0)"/>
<path d="M94,570L124,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,585L194,585A15 15 0 0 0 209 570A15 15 0 0 0 194 555L145,555A15 15 0 0 0 130 570A15 15 0 0 0 145 585Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="170" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ISNULL</text>
<polygon points="916,570 905,574 905,566" style="fill:rgb(0,0,0)"/>
<path d="M209,570L910,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,570 L 924,570 Q 931,570 931,563 L 931,555"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,570 33,574 33,566" style="fill:rgb(0,0,0)"/>
<path d="M24,555 L 24,563 Q 24,570 31,570 L 39,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,623L215,623A15 15 0 0 0 230 608A15 15 0 0 0 215 593L145,593A15 15 0 0 0 130 608A15 15 0 0 0 145 623Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="608" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTNULL</text>
<path d="M145,661L165,661A15 15 0 0 0 180 646A15 15 0 0 0 165 631L145,631A15 15 0 0 0 130 646A15 15 0 0 0 145 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="203,646 192,650 192,641" style="fill:rgb(0,0,0)"/>
<path d="M180,646L198,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,661L250,661A15 15 0 0 0 265 646A15 15 0 0 0 250 631L219,631A15 15 0 0 0 203 646A15 15 0 0 0 219 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="288,646 276,650 276,641" style="fill:rgb(0,0,0)"/>
<path d="M265,646L282,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="339,570 327,574 327,566" style="fill:rgb(0,0,0)"/>
<path d="M288,646 L 295,646 Q 303,646 303,631 L 303,585 Q 303,570 318,570 L 318,570 L 333,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="288,608 276,612 276,604" style="fill:rgb(0,0,0)"/>
<path d="M230,608L282,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,608 L 295,608 Q 303,608 303,600 L 303,593"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,646 119,650 119,641" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,631 Q 109,646 117,646 L 124,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,608 119,612 119,604" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,593 Q 109,608 117,608 L 124,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,699L94,699L94,668L45,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,684 106,688 106,679" style="fill:rgb(0,0,0)"/>
<path d="M94,684L111,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,699A15 15 0 0 0 147 684A15 15 0 0 0 132 668A15 15 0 0 0 117 684A15 15 0 0 0 132 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IS</text>
<polygon points="183,684 172,688 172,679" style="fill:rgb(0,0,0)"/>
<path d="M147,684L178,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M198,699L219,699A15 15 0 0 0 234 684A15 15 0 0 0 219 668L198,668A15 15 0 0 0 183 684A15 15 0 0 0 198 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="270,684 258,688 258,679" style="fill:rgb(0,0,0)"/>
<path d="M234,684L264,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="306,684 294,688 294,679" style="fill:rgb(0,0,0)"/>
<path d="M270,684L300,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,699L389,699A15 15 0 0 0 404 684A15 15 0 0 0 389 668L321,668A15 15 0 0 0 306 684A15 15 0 0 0 321 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="440,684 429,688 429,679" style="fill:rgb(0,0,0)"/>
<path d="M404,684L434,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,699L490,699A15 15 0 0 0 505 684A15 15 0 0 0 490 668L455,668A15 15 0 0 0 440 684A15 15 0 0 0 455 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="541,684 530,688 530,679" style="fill:rgb(0,0,0)"/>
<path d="M505,684L535,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,699L590,699L590,668L541,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,684 905,688 905,679" style="fill:rgb(0,0,0)"/>
<path d="M590,684L910,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,684 L 924,684 Q 931,684 931,676 L 931,669"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,684 33,688 33,679" style="fill:rgb(0,0,0)"/>
<path d="M24,668 L 24,676 Q 24,684 31,684 L 39,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,684 L 156,684 Q 164,684 164,696 Q 164,708 179,708 L 230,708 Q 245,708 245,696 Q 245,684 253,684 L 260,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,684 L 279,684 Q 286,684 286,696 Q 286,708 301,708 L 502,708 Q 517,708 517,696 Q 517,684 524,684 L 532,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,744L94,744L94,714L45,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,729 119,733 119,725" style="fill:rgb(0,0,0)"/>
<path d="M94,729L124,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,744L165,744A15 15 0 0 0 180 729A15 15 0 0 0 165 714L145,714A15 15 0 0 0 130 729A15 15 0 0 0 145 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,729 205,733 205,725" style="fill:rgb(0,0,0)"/>
<path d="M180,729L211,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,744L304,744A15 15 0 0 0 319 729A15 15 0 0 0 304 714L232,714A15 15 0 0 0 216 729A15 15 0 0 0 232 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="342,729 331,733 331,725" style="fill:rgb(0,0,0)"/>
<path d="M319,729L336,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M342,744L391,744L391,714L342,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="367" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="414,729 403,733 403,725" style="fill:rgb(0,0,0)"/>
<path d="M391,729L409,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M430,744L450,744A15 15 0 0 0 465 729A15 15 0 0 0 450 714L430,714A15 15 0 0 0 414 729A15 15 0 0 0 430 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="488,729 477,733 477,725" style="fill:rgb(0,0,0)"/>
<path d="M465,729L483,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,744L538,744L538,714L488,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="513" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,729 905,733 905,725" style="fill:rgb(0,0,0)"/>
<path d="M538,729L910,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,729 L 924,729 Q 931,729 931,721 L 931,714"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,729 33,733 33,725" style="fill:rgb(0,0,0)"/>
<path d="M24,714 L 24,721 Q 24,729 31,729 L 39,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,729 L 103,729 Q 110,729 110,741 Q 110,753 125,753 L 177,753 Q 192,753 192,741 Q 192,729 199,729 L 207,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,797L94,797L94,767L45,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,782 119,786 119,778" style="fill:rgb(0,0,0)"/>
<path d="M94,782L124,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,797L165,797A15 15 0 0 0 180 782A15 15 0 0 0 165 767L145,767A15 15 0 0 0 130 782A15 15 0 0 0 145 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,782 205,786 205,778" style="fill:rgb(0,0,0)"/>
<path d="M180,782L211,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,797L234,797A15 15 0 0 0 249 782A15 15 0 0 0 234 767L232,767A15 15 0 0 0 216 782A15 15 0 0 0 232 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IN</text>
<polygon points="285,782 273,786 273,778" style="fill:rgb(0,0,0)"/>
<path d="M249,782L279,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,797A15 15 0 0 0 315 782A15 15 0 0 0 300 767A15 15 0 0 0 285 782A15 15 0 0 0 300 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,782 340,786 340,778" style="fill:rgb(0,0,0)"/>
<path d="M315,782L345,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,797L455,797L455,767L351,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="491,782 480,786 480,778" style="fill:rgb(0,0,0)"/>
<path d="M455,782L486,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M507,797A15 15 0 0 0 522 782A15 15 0 0 0 507 767A15 15 0 0 0 491 782A15 15 0 0 0 507 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="507" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,782 905,786 905,778" style="fill:rgb(0,0,0)"/>
<path d="M522,782L910,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,782 L 924,782 Q 931,782 931,774 L 931,767"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,782 33,786 33,778" style="fill:rgb(0,0,0)"/>
<path d="M24,767 L 24,774 Q 24,782 31,782 L 39,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,782 L 103,782 Q 110,782 110,794 Q 110,806 125,806 L 177,806 Q 192,806 192,794 Q 192,782 199,782 L 207,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,782 L 324,782 Q 332,782 332,770 Q 332,758 347,758 L 452,758 Q 467,758 467,770 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M379,835L428,835L428,805L379,805Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="820" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="379,820 367,824 367,815" style="fill:rgb(0,0,0)"/>
<path d="M317,782 L 324,782 Q 332,782 332,797 L 332,805 Q 332,820 347,820 L 358,820 L 373,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M428,820 L 452,820 Q 467,820 467,805 L 467,797 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,873A15 15 0 0 0 418 857A15 15 0 0 0 403 842A15 15 0 0 0 388 857A15 15 0 0 0 403 873Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="857" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,857 430,853 430,862" style="fill:rgb(0,0,0)"/>
<path d="M428,820 L 435,820 Q 443,820 443,835 L 443,842 Q 443,857 434,857 L 424,857"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,857 L 371,857 Q 356,857 356,842 L 356,835 Q 356,820 363,820 L 371,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,925L396,925A15 15 0 0 0 412 910A15 15 0 0 0 396 895L300,895A15 15 0 0 0 285 910A15 15 0 0 0 300 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="429,910 417,915 417,906" style="fill:rgb(0,0,0)"/>
<path d="M412,910L423,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,925A15 15 0 0 0 459 910A15 15 0 0 0 444 895A15 15 0 0 0 429 910A15 15 0 0 0 444 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="513,910 502,915 502,906" style="fill:rgb(0,0,0)"/>
<path d="M459,910L507,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,925L627,925A15 15 0 0 0 642 910A15 15 0 0 0 627 895L528,895A15 15 0 0 0 513 910A15 15 0 0 0 528 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="577" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function</text>
<polygon points="659,910 647,915 647,906" style="fill:rgb(0,0,0)"/>
<path d="M642,910L653,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,925A15 15 0 0 0 689 910A15 15 0 0 0 674 895A15 15 0 0 0 659 910A15 15 0 0 0 674 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="734,910 723,915 723,906" style="fill:rgb(0,0,0)"/>
<path d="M689,910L728,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,925L783,925L783,895L734,895Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="828,910 817,915 817,906" style="fill:rgb(0,0,0)"/>
<path d="M783,910L823,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M844,925A15 15 0 0 0 859 910A15 15 0 0 0 844 895A15 15 0 0 0 828 910A15 15 0 0 0 844 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="844" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,910 905,915 905,906" style="fill:rgb(0,0,0)"/>
<path d="M859,910L910,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,910 L 924,910 Q 931,910 931,903 L 931,895"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,865L603,865A15 15 0 0 0 619 850A15 15 0 0 0 603 835L528,835A15 15 0 0 0 513 850A15 15 0 0 0 528 865Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="850" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="916,850 905,854 905,846" style="fill:rgb(0,0,0)"/>
<path d="M619,850L910,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,850 L 924,850 Q 931,850 931,842 L 931,835"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="513,850 502,854 502,846" style="fill:rgb(0,0,0)"/>
<path d="M475,910 L 483,910 Q 490,910 490,895 L 490,865 Q 490,850 499,850 L 507,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,892A15 15 0 0 0 774 877A15 15 0 0 0 759 862A15 15 0 0 0 744 877A15 15 0 0 0 759 892Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="877" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="774,877 785,873 785,881" style="fill:rgb(0,0,0)"/>
<path d="M783,910 L 791,910 Q 798,910 798,895 L 798,892 Q 798,877 789,877 L 780,877"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M744,877 L 726,877 Q 711,877 711,892 L 711,895 Q 711,910 719,910 L 726,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M689,910 L 697,910 Q 704,910 704,921 Q 704,932 719,932 L 790,932 Q 805,932 805,921 Q 805,910 813,910 L 820,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="285,910 273,915 273,906" style="fill:rgb(0,0,0)"/>
<path d="M249,782 L 256,782 Q 264,782 264,797 L 264,895 Q 264,910 272,910 L 279,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,882 412,886 412,877" style="fill:rgb(0,0,0)"/>
<path d="M264,867 L 264,874 Q 264,882 279,882 L 402,882 L 417,882"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,882 L 456,882 Q 471,882 471,896 Q 471,910 478,910 L 486,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,971L80,971A15 15 0 0 0 95 956A15 15 0 0 0 80 941L60,941A15 15 0 0 0 45 956A15 15 0 0 0 60 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="131,956 120,960 120,951" style="fill:rgb(0,0,0)"/>
<path d="M95,956L125,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,971L191,971A15 15 0 0 0 206 956A15 15 0 0 0 191 941L146,941A15 15 0 0 0 131 956A15 15 0 0 0 146 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="242,956 231,960 231,951" style="fill:rgb(0,0,0)"/>
<path d="M206,956L236,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,971A15 15 0 0 0 272 956A15 15 0 0 0 257 941A15 15 0 0 0 242 956A15 15 0 0 0 257 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="295,956 284,960 284,951" style="fill:rgb(0,0,0)"/>
<path d="M272,956L290,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,971L400,971L400,941L295,941Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="423,956 411,960 411,951" style="fill:rgb(0,0,0)"/>
<path d="M400,956L417,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,971A15 15 0 0 0 453 956A15 15 0 0 0 438 941A15 15 0 0 0 423 956A15 15 0 0 0 438 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,956 905,960 905,951" style="fill:rgb(0,0,0)"/>
<path d="M453,956L910,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,956 L 924,956 Q 931,956 931,948 L 931,941"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,956 33,960 33,951" style="fill:rgb(0,0,0)"/>
<path d="M24,941 L 24,948 Q 24,956 31,956 L 39,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,929 59,934 59,925" style="fill:rgb(0,0,0)"/>
<path d="M24,914 L 24,922 Q 24,929 39,929 L 49,929 L 64,929"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,929 L 201,929 Q 216,929 216,943 Q 216,956 223,956 L 231,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,929 L 101,929 Q 108,929 108,943 Q 108,956 116,956 L 123,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,1009L89,1009A15 15 0 0 0 104 994A15 15 0 0 0 89 978L60,978A15 15 0 0 0 45 994A15 15 0 0 0 60 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASE</text>
<polygon points="140,994 128,998 128,989" style="fill:rgb(0,0,0)"/>
<path d="M104,994L134,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M140,1009L189,1009L189,978L140,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="243,994 232,998 232,989" style="fill:rgb(0,0,0)"/>
<path d="M189,994L237,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,1009L298,1009A15 15 0 0 0 313 994A15 15 0 0 0 298 978L258,978A15 15 0 0 0 243 994A15 15 0 0 0 258 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="336,994 324,998 324,989" style="fill:rgb(0,0,0)"/>
<path d="M313,994L330,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,1009L385,1009L385,978L336,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="408,994 396,998 396,989" style="fill:rgb(0,0,0)"/>
<path d="M385,994L402,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,1009L456,1009A15 15 0 0 0 472 994A15 15 0 0 0 456 978L423,978A15 15 0 0 0 408 994A15 15 0 0 0 423 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">THEN</text>
<polygon points="495,994 483,998 483,989" style="fill:rgb(0,0,0)"/>
<path d="M472,994L489,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M495,1009L544,1009L544,978L495,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="616,994 604,998 604,989" style="fill:rgb(0,0,0)"/>
<path d="M544,994L610,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M631,1009L658,1009A15 15 0 0 0 673 994A15 15 0 0 0 658 978L631,978A15 15 0 0 0 616 994A15 15 0 0 0 631 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="645" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ELSE</text>
<polygon points="696,994 685,998 685,989" style="fill:rgb(0,0,0)"/>
<path d="M673,994L691,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M696,1009L746,1009L746,978L696,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="721" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="782,994 770,998 770,989" style="fill:rgb(0,0,0)"/>
<path d="M746,994L776,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M797,1009L818,1009A15 15 0 0 0 833 994A15 15 0 0 0 818 978L797,978A15 15 0 0 0 782 994A15 15 0 0 0 797 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="807" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="916,994 905,998 905,989" style="fill:rgb(0,0,0)"/>
<path d="M833,994L910,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,994 L 924,994 Q 931,994 931,986 L 931,979"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,994 33,998 33,989" style="fill:rgb(0,0,0)"/>
<path d="M24,978 L 24,986 Q 24,994 31,994 L 39,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,994 L 111,994 Q 119,994 119,1007 Q 119,1021 134,1021 L 186,1021 Q 201,1021 201,1007 Q 201,994 208,994 L 216,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="360,1021 372,1016 372,1025" style="fill:rgb(0,0,0)"/>
<path d="M544,994 L 551,994 Q 559,994 559,1007 Q 559,1021 544,1021 L 381,1021 L 366,1021"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,1021 L 235,1021 Q 220,1021 220,1007 Q 220,994 227,994 L 235,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,994 L 585,994 Q 593,994 593,1007 Q 593,1021 608,1021 L 742,1021 Q 757,1021 757,1007 Q 757,994 765,994 L 772,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,1066L173,1066L173,1036L45,1036Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="1051" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">raise-function</text>
<polygon points="916,1051 905,1055 905,1047" style="fill:rgb(0,0,0)"/>
<path d="M173,1051L910,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,1051 L 924,1051 Q 931,1051 931,1036 L 931,32 Q 931,17 939,17 L 946,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,1051 33,1055 33,1047" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,1036 Q 24,1051 31,1051 L 39,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/filter-clause.html">filter-clause:</a></b>
<button id='x09e0d16b' onclick='hideorshow("x09e0d16b","x3475471b")'>show</button></p>
 <div id='x3475471b' style='display:none;' class='imgcontainer'>
 <div style="max-width:422px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 422.381 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L93,32A15 15 0 0 0 108 17A15 15 0 0 0 93 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FILTER</text>
<polygon points="131,17 119,21 119,12" style="fill:rgb(0,0,0)"/>
<path d="M108,17L125,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,32L146,32A15 15 0 0 0 161 17A15 15 0 0 0 146 2L146,2A15 15 0 0 0 131 17A15 15 0 0 0 146 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="184,17 173,21 173,12" style="fill:rgb(0,0,0)"/>
<path d="M161,17L178,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M199,32L249,32A15 15 0 0 0 264 17A15 15 0 0 0 249 2L199,2A15 15 0 0 0 184 17A15 15 0 0 0 199 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="224" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="287,17 275,21 275,12" style="fill:rgb(0,0,0)"/>
<path d="M264,17L281,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,32L336,32L336,2L287,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M336,17L353,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,32A15 15 0 0 0 389 17A15 15 0 0 0 374 2A15 15 0 0 0 359 17A15 15 0 0 0 374 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="374" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="413,17 401,21 401,12" style="fill:rgb(0,0,0)"/>
<path d="M389,17L407,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="416" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/function-arguments.html">function-arguments:</a></b>
<button id='x1d03f39b' onclick='hideorshow("x1d03f39b","x6d535ce1")'>show</button></p>
 <div id='x6d535ce1' style='display:none;' class='imgcontainer'>
 <div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.566 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,26 55,30 55,22" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,41 L 43,41 Q 43,26 52,26 L 61,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M82,41L150,41A15 15 0 0 0 165 26L165,26A15 15 0 0 0 150 11L82,11A15 15 0 0 0 66 26L66,26A15 15 0 0 0 82 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="183,26 171,30 171,22" style="fill:rgb(0,0,0)"/>
<path d="M165,26L177,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M183,26 L 189,26 Q 194,26 194,41 L 194,41 Q 194,56 203,56 L 212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M218,56L248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,71L303,71L303,41L254,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="447,56 435,60 435,52" style="fill:rgb(0,0,0)"/>
<path d="M303,56L441,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="116,56 104,60 104,52" style="fill:rgb(0,0,0)"/>
<path d="M32,56L110,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M116,56L212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,32A15 15 0 0 0 293 17A15 15 0 0 0 278 2A15 15 0 0 0 263 17A15 15 0 0 0 278 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="293,17 305,12 305,21" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 314,56 Q 326,56 326,41 L 326,32 Q 326,17 312,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M263,17 L 245,17 Q 230,17 230,32 L 230,41 Q 230,56 239,56 L 248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,207A15 15 0 0 0 243 192L243,192A15 15 0 0 0 228 177A15 15 0 0 0 213 192L213,192A15 15 0 0 0 228 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="213,192 201,196 201,188" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,71 L 43,177 Q 43,192 58,192 L 192,192 L 207,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,192 267,196 267,188" style="fill:rgb(0,0,0)"/>
<path d="M243,192L272,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,192 L 360,192 Q 375,192 390,192 L 394,192 Q 409,192 409,177 L 409,71 Q 409,56 415,56 L 421,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="228,216 216,221 216,212" style="fill:rgb(0,0,0)"/>
<path d="M116,192 L 181,192 Q 196,192 196,204 Q 196,216 209,216 L 222,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,216 L 242,216 Q 257,216 257,204 Q 257,192 262,192 L 268,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="90,117 78,121 78,112" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 313,56 Q 323,56 323,71 L 323,71 Q 323,86 308,86 L 81,86 Q 66,86 66,101 L 66,102 Q 66,117 75,117 L 84,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,132L149,132A15 15 0 0 0 164 117L164,117A15 15 0 0 0 149 101L105,101A15 15 0 0 0 90 117L90,117A15 15 0 0 0 105 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="182,117 170,121 170,112" style="fill:rgb(0,0,0)"/>
<path d="M164,117L176,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,132L201,132A15 15 0 0 0 216 117L216,117A15 15 0 0 0 201 101L197,101A15 15 0 0 0 182 117L182,117A15 15 0 0 0 197 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M216,117L239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,132L375,132L375,101L245,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,169A15 15 0 0 0 325 154A15 15 0 0 0 310 139A15 15 0 0 0 294 154A15 15 0 0 0 310 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,154 336,150 336,159" style="fill:rgb(0,0,0)"/>
<path d="M375,117 L 380,117 Q 386,117 386,132 L 386,139 Q 386,154 371,154 L 345,154 L 330,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M294,154 L 260,154 Q 245,154 236,154 Q 227,154 227,139 L 227,132 Q 227,117 233,117 L 239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M375,117 L 383,117 Q 392,117 392,102 L 392,71 Q 392,56 407,56 L 413,56 L 428,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x77c9d945' onclick='hideorshow("x77c9d945","x4d928f2e")'>show</button></p>
 <div id='x4d928f2e' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/literal-value.html">literal-value:</a></b>
<button id='x557283b2' onclick='hideorshow("x557283b2","xecfd6785")'>show</button></p>
 <div id='xecfd6785' style='display:none;' class='imgcontainer'>
 <div style="max-width:341px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 341.376 336.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,319 39,324 39,315" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,304 Q 24,319 34,319 L 45,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,334L252,334A15 15 0 0 0 267 319A15 15 0 0 0 252 304L65,304A15 15 0 0 0 50 319A15 15 0 0 0 65 334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIMESTAMP</text>
<polygon points="290,319 278,324 278,315" style="fill:rgb(0,0,0)"/>
<path d="M267,319L284,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,17 320,21 320,12" style="fill:rgb(0,0,0)"/>
<path d="M290,319 L 297,319 Q 305,319 305,304 L 305,32 Q 305,17 315,17 L 326,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="335" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L172,32A15 15 0 0 0 187 17A15 15 0 0 0 172 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="119" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,17L320,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L153,70A15 15 0 0 0 168 55L168,55A15 15 0 0 0 153 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">string-literal</text>
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,47 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,55 278,59 278,50" style="fill:rgb(0,0,0)"/>
<path d="M168,55L284,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,55 L 297,55 Q 305,55 305,47 L 305,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L140,108A15 15 0 0 0 155 92A15 15 0 0 0 140 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">blob-literal</text>
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,85 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,92 278,97 278,88" style="fill:rgb(0,0,0)"/>
<path d="M155,92L284,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,92 L 297,92 Q 305,92 305,85 L 305,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,145L97,145A15 15 0 0 0 112 130A15 15 0 0 0 97 115L66,115A15 15 0 0 0 50 130A15 15 0 0 0 66 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="50,130 39,135 39,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 34,130 L 45,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,130 278,135 278,126" style="fill:rgb(0,0,0)"/>
<path d="M112,130L284,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,130 L 297,130 Q 305,130 305,123 L 305,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,183L96,183A15 15 0 0 0 111 168A15 15 0 0 0 96 153L66,153A15 15 0 0 0 50 168A15 15 0 0 0 66 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRUE</text>
<polygon points="50,168 39,172 39,164" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,160 Q 24,168 34,168 L 45,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,168 278,172 278,164" style="fill:rgb(0,0,0)"/>
<path d="M111,168L284,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,168 L 297,168 Q 305,168 305,160 L 305,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,221L104,221A15 15 0 0 0 119 206A15 15 0 0 0 104 191L66,191A15 15 0 0 0 50 206A15 15 0 0 0 66 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FALSE</text>
<polygon points="50,206 39,210 39,201" style="fill:rgb(0,0,0)"/>
<path d="M24,191 L 24,198 Q 24,206 34,206 L 45,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,206 278,210 278,201" style="fill:rgb(0,0,0)"/>
<path d="M119,206L284,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,206 L 297,206 Q 305,206 305,198 L 305,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,259L190,259A15 15 0 0 0 205 244A15 15 0 0 0 190 228L66,228A15 15 0 0 0 50 244A15 15 0 0 0 66 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="128" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIME</text>
<polygon points="50,244 39,248 39,239" style="fill:rgb(0,0,0)"/>
<path d="M24,228 L 24,236 Q 24,244 34,244 L 45,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,244 278,248 278,239" style="fill:rgb(0,0,0)"/>
<path d="M205,244L284,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,244 L 297,244 Q 305,244 305,236 L 305,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,297L192,297A15 15 0 0 0 207 281A15 15 0 0 0 192 266L66,266A15 15 0 0 0 50 281A15 15 0 0 0 66 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_DATE</text>
<polygon points="50,281 39,286 39,277" style="fill:rgb(0,0,0)"/>
<path d="M24,266 L 24,274 Q 24,281 34,281 L 45,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,281 278,286 278,277" style="fill:rgb(0,0,0)"/>
<path d="M207,281L284,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,281 L 297,281 Q 305,281 305,274 L 305,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/over-clause.html">over-clause:</a></b>
<button id='x1fe78f9a' onclick='hideorshow("x1fe78f9a","xa1eb3529")'>show</button></p>
 <div id='xa1eb3529' style='display:none;' class='imgcontainer'>
 <div style="max-width:600px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 600.706 418.392">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="129,17 117,21 117,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L123,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M144,32L241,32A15 15 0 0 0 256 17A15 15 0 0 0 241 2L144,2A15 15 0 0 0 129 17A15 15 0 0 0 144 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,17 L 100,17 Q 108,17 108,32 L 108,40 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,70A15 15 0 0 0 165 55L165,55A15 15 0 0 0 149 39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 149 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="149" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="206,82 195,86 195,77" style="fill:rgb(0,0,0)"/>
<path d="M165,55 L 172,55 Q 180,55 180,68 Q 180,82 190,82 L 200,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,97L363,97A15 15 0 0 0 378 82A15 15 0 0 0 363 67L221,67A15 15 0 0 0 206 82A15 15 0 0 0 221 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="292" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M221,173L301,173A15 15 0 0 0 316 157A15 15 0 0 0 301 142L221,142A15 15 0 0 0 206 157A15 15 0 0 0 221 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="339,157 328,162 328,153" style="fill:rgb(0,0,0)"/>
<path d="M316,157L333,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,173L358,173A15 15 0 0 0 373 157A15 15 0 0 0 358 142L354,142A15 15 0 0 0 339 157A15 15 0 0 0 354 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="409,157 398,162 398,153" style="fill:rgb(0,0,0)"/>
<path d="M373,157L404,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,173L459,173L459,142L409,142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M434,210A15 15 0 0 0 449 195A15 15 0 0 0 434 180A15 15 0 0 0 419 195A15 15 0 0 0 434 210Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="195" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="449,195 461,191 461,200" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,180 Q 474,195 464,195 L 455,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,195 L 398,195 Q 383,195 383,180 L 383,172 Q 383,157 390,157 L 398,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,55 280,59 280,50" style="fill:rgb(0,0,0)"/>
<path d="M165,55L286,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,120 304,115 304,124" style="fill:rgb(0,0,0)"/>
<path d="M292,55 L 401,55 Q 416,55 416,70 L 416,105 Q 416,120 401,120 L 313,120 L 298,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,157 195,162 195,153" style="fill:rgb(0,0,0)"/>
<path d="M292,120 L 180,120 Q 165,120 165,135 L 165,142 Q 165,157 180,157 L 185,157 L 200,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="401,82 389,86 389,77" style="fill:rgb(0,0,0)"/>
<path d="M378,82L395,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,82 L 408,82 Q 416,82 416,89 L 416,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,286L266,286A15 15 0 0 0 281 271A15 15 0 0 0 266 256L221,256A15 15 0 0 0 206 271A15 15 0 0 0 221 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="244" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="304,271 292,275 292,266" style="fill:rgb(0,0,0)"/>
<path d="M281,271L298,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M319,286L323,286A15 15 0 0 0 338 271A15 15 0 0 0 323 256L319,256A15 15 0 0 0 304 271A15 15 0 0 0 319 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="321" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="374,271 363,275 363,266" style="fill:rgb(0,0,0)"/>
<path d="M338,271L368,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,286L504,286L504,256L374,256Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M439,324A15 15 0 0 0 454 309A15 15 0 0 0 439 293A15 15 0 0 0 424 309A15 15 0 0 0 439 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="454,309 466,304 466,313" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,294 Q 519,309 504,309 L 475,309 L 460,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,309 L 363,309 Q 348,309 348,294 L 348,286 Q 348,271 355,271 L 363,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,233 304,229 304,237" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,218 Q 474,233 459,233 L 313,233 L 298,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,271 195,275 195,266" style="fill:rgb(0,0,0)"/>
<path d="M292,233 L 180,233 Q 165,233 165,248 L 165,256 Q 165,271 180,271 L 185,271 L 200,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,195 160,184 169,184" style="fill:rgb(0,0,0)"/>
<path d="M165,142L165,189"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,195L165,256"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,399L311,399L311,369L206,369Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="384" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="519,384 508,389 508,380" style="fill:rgb(0,0,0)"/>
<path d="M311,384L513,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M534,399A15 15 0 0 0 549 384A15 15 0 0 0 534 369A15 15 0 0 0 519 384A15 15 0 0 0 534 399Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="384" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="591,17 579,21 579,12" style="fill:rgb(0,0,0)"/>
<path d="M549,384 L 557,384 Q 564,384 564,369 L 564,32 Q 564,17 575,17 L 585,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="594" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,17 508,21 508,12" style="fill:rgb(0,0,0)"/>
<path d="M256,17L513,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,17L579,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,346 304,342 304,351" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,331 Q 519,346 504,346 L 313,346 L 298,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,384 195,389 195,380" style="fill:rgb(0,0,0)"/>
<path d="M292,346 L 180,346 Q 165,346 165,361 L 165,369 Q 165,384 180,384 L 185,384 L 200,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,309 160,297 169,297" style="fill:rgb(0,0,0)"/>
<path d="M165,256L165,303"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,309L165,369"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="258,411 247,416 247,407" style="fill:rgb(0,0,0)"/>
<path d="M165,369 L 165,396 Q 165,411 180,411 L 238,411 L 253,411"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,384 369,389 369,380" style="fill:rgb(0,0,0)"/>
<path d="M258,411 L 335,411 Q 350,411 350,398 Q 350,384 362,384 L 375,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='xe3883e15' onclick='hideorshow("xe3883e15","x2c770c12")'>show</button></p>
 <div id='x2c770c12' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x27af6f9d' onclick='hideorshow("x27af6f9d","xe690f748")'>show</button></p>
 <div id='xe690f748' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/raise-function.html">raise-function:</a></b>
<button id='xebabca7c' onclick='hideorshow("xebabca7c","x7e4c286f")'>show</button></p>
 <div id='x7e4c286f' style='display:none;' class='imgcontainer'>
 <div style="max-width:627px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 627.302 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L82,32A15 15 0 0 0 97 17A15 15 0 0 0 82 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RAISE</text>
<polygon points="120,17 109,21 109,12" style="fill:rgb(0,0,0)"/>
<path d="M97,17L114,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,32L135,32A15 15 0 0 0 150 17A15 15 0 0 0 135 2L135,2A15 15 0 0 0 120 17A15 15 0 0 0 135 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="135" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="192,55 180,59 180,50" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 158,17 Q 165,17 165,32 L 165,40 Q 165,55 176,55 L 186,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,70L285,70A15 15 0 0 0 300 55L300,55A15 15 0 0 0 285 39L207,39A15 15 0 0 0 192 55L192,55A15 15 0 0 0 207 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="336,55 324,59 324,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70A15 15 0 0 0 366 55L366,55A15 15 0 0 0 351 39A15 15 0 0 0 336 55L336,55A15 15 0 0 0 351 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="389,55 378,59 378,50" style="fill:rgb(0,0,0)"/>
<path d="M366,55L383,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,70L508,70A15 15 0 0 0 523 55L523,55A15 15 0 0 0 508 39L404,39A15 15 0 0 0 389 55L389,55A15 15 0 0 0 404 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="456" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">error-message</text>
<polygon points="564,17 553,21 553,12" style="fill:rgb(0,0,0)"/>
<path d="M523,55 L 530,55 Q 538,55 538,40 L 538,32 Q 538,17 548,17 L 558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M579,32A15 15 0 0 0 594 17A15 15 0 0 0 579 2A15 15 0 0 0 564 17A15 15 0 0 0 579 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="617,17 606,21 606,12" style="fill:rgb(0,0,0)"/>
<path d="M594,17L612,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="621" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L259,32A15 15 0 0 0 274 17A15 15 0 0 0 259 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="456,17 444,21 444,12" style="fill:rgb(0,0,0)"/>
<path d="M274,17L450,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,17L553,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,108L249,108A15 15 0 0 0 264 92A15 15 0 0 0 249 77L207,77A15 15 0 0 0 192 92A15 15 0 0 0 207 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="300,92 288,97 288,88" style="fill:rgb(0,0,0)"/>
<path d="M264,92L294,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,92 L 307,92 Q 315,92 315,77 L 315,70 Q 315,55 322,55 L 330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,145L229,145A15 15 0 0 0 244 130A15 15 0 0 0 229 115L207,115A15 15 0 0 0 192 130A15 15 0 0 0 207 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="300,130 288,135 288,126" style="fill:rgb(0,0,0)"/>
<path d="M244,130L294,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,130 L 307,130 Q 315,130 315,115 L 315,92 L 315,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,130 180,135 180,126" style="fill:rgb(0,0,0)"/>
<path d="M165,39 L 165,115 Q 165,130 176,130 L 186,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,92 180,97 180,88" style="fill:rgb(0,0,0)"/>
<path d="M165,77 L 165,85 Q 165,92 176,92 L 186,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/type-name.html">type-name:</a></b>
<button id='xbd38791d' onclick='hideorshow("xbd38791d","xdc908868")'>show</button></p>
 <div id='xdc908868' style='display:none;' class='imgcontainer'>
 <div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.008 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L87,32A15 15 0 0 0 102 17A15 15 0 0 0 87 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="165,92 153,97 153,88" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,77 Q 138,92 149,92 L 159,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,108A15 15 0 0 0 195 92A15 15 0 0 0 180 77A15 15 0 0 0 165 92A15 15 0 0 0 180 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,92 201,97 201,88" style="fill:rgb(0,0,0)"/>
<path d="M195,92L207,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,108L350,108L350,77L212,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,92 356,97 356,88" style="fill:rgb(0,0,0)"/>
<path d="M350,92L362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,108A15 15 0 0 0 398 92A15 15 0 0 0 382 77A15 15 0 0 0 367 92A15 15 0 0 0 382 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="415,92 403,97 403,88" style="fill:rgb(0,0,0)"/>
<path d="M398,92L409,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,108L553,108L553,77L415,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="570,92 558,97 558,88" style="fill:rgb(0,0,0)"/>
<path d="M553,92L564,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,108A15 15 0 0 0 600 92A15 15 0 0 0 585 77A15 15 0 0 0 570 92A15 15 0 0 0 585 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="585" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="651,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M600,92 L 608,92 Q 615,92 615,77 L 615,32 Q 615,17 630,17 L 630,17 L 645,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,40 Q 138,55 149,55 L 159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70A15 15 0 0 0 195 55L195,55A15 15 0 0 0 180 39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,55 201,59 201,50" style="fill:rgb(0,0,0)"/>
<path d="M195,55L207,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,70L350,70L350,39L212,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,55 356,59 356,50" style="fill:rgb(0,0,0)"/>
<path d="M350,55L362,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,70A15 15 0 0 0 398 55L398,55A15 15 0 0 0 382 39A15 15 0 0 0 367 55L367,55A15 15 0 0 0 382 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="600,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M398,55L594,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M600,55 L 608,55 Q 615,55 615,47 L 615,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="74,47 85,43 85,51" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 110,17 Q 117,17 117,32 L 117,32 Q 117,47 102,47 L 94,47 L 79,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47 L 33,47 Q 18,47 18,32 L 18,32 Q 18,17 26,17 L 33,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="382,17 371,21 371,12" style="fill:rgb(0,0,0)"/>
<path d="M102,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,17L630,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='xfb530e83' onclick='hideorshow("xfb530e83","x362a1902")'>show</button></p>
 <div id='x362a1902' style='display:none;' class='imgcontainer'>
 <div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/insert-stmt.html">insert-stmt:</a></b>
<button id='xcbeb1f14' onclick='hideorshow("xcbeb1f14","x2345d6dd")'>show</button></p>
 <div id='x2345d6dd' style='display:none;' class='imgcontainer'>
 <div style="max-width:601px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 601.066 922.104">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L91,32A15 15 0 0 0 106 17A15 15 0 0 0 91 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M166,62L252,62A15 15 0 0 0 267 47L267,47A15 15 0 0 0 252 32L166,32A15 15 0 0 0 151 47L151,47A15 15 0 0 0 166 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="209,17 197,21 197,12" style="fill:rgb(0,0,0)"/>
<path d="M106,17L203,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M209,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M357,32L583,32L583,2L357,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="151,47 139,51 139,43" style="fill:rgb(0,0,0)"/>
<path d="M106,17 L 113,17 Q 121,17 121,32 L 121,32 Q 121,47 133,47 L 145,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,47 278,51 278,43" style="fill:rgb(0,0,0)"/>
<path d="M267,47L284,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,47 L 297,47 Q 305,47 305,32 L 305,32 Q 305,17 320,17 L 330,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,70A15 15 0 0 0 485 55L485,55A15 15 0 0 0 470 39A15 15 0 0 0 455 55L455,55A15 15 0 0 0 470 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="485,55 497,50 497,59" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,40 Q 598,55 583,55 L 506,55 L 491,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,55 L 349,55 Q 334,55 334,40 L 334,32 Q 334,17 340,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="294,83 306,79 306,88" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,68 Q 598,83 583,83 L 315,83 L 300,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="24,53 20,41 28,41" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,32 L 24,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,145L124,145A15 15 0 0 0 139 130A15 15 0 0 0 124 115L60,115A15 15 0 0 0 45 130A15 15 0 0 0 60 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<path d="M60,183L109,183A15 15 0 0 0 124 168A15 15 0 0 0 109 153L60,153A15 15 0 0 0 45 168A15 15 0 0 0 60 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="84" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INSERT</text>
<polygon points="166,198 154,203 154,194" style="fill:rgb(0,0,0)"/>
<path d="M124,168 L 132,168 Q 139,168 139,183 L 139,183 Q 139,198 149,198 L 160,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M181,213L187,213A15 15 0 0 0 203 198A15 15 0 0 0 187 183L181,183A15 15 0 0 0 166 198A15 15 0 0 0 181 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="244,349 233,354 233,345" style="fill:rgb(0,0,0)"/>
<path d="M203,198 L 210,198 Q 218,198 218,213 L 218,334 Q 218,349 228,349 L 238,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,365L337,365A15 15 0 0 0 352 349A15 15 0 0 0 337 334L259,334A15 15 0 0 0 244 349A15 15 0 0 0 259 365Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="298" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="369,349 358,354 358,345" style="fill:rgb(0,0,0)"/>
<path d="M352,349L363,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,130 399,135 399,126" style="fill:rgb(0,0,0)"/>
<path d="M369,349 L 377,349 Q 384,349 384,334 L 384,145 Q 384,130 395,130 L 405,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M426,145L453,145A15 15 0 0 0 468 130A15 15 0 0 0 453 115L426,115A15 15 0 0 0 411 130A15 15 0 0 0 426 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTO</text>
<polygon points="45,168 33,172 33,164" style="fill:rgb(0,0,0)"/>
<path d="M24,53 L 24,153 Q 24,168 31,168 L 39,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,130 33,135 33,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 31,130 L 39,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,83 L 39,83 Q 24,83 24,91 L 24,98"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M139,130L399,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,168 358,172 358,164" style="fill:rgb(0,0,0)"/>
<path d="M124,168L363,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,168 L 377,168 Q 384,168 384,160 L 384,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,213L301,213A15 15 0 0 0 316 198A15 15 0 0 0 301 183L259,183A15 15 0 0 0 244 198A15 15 0 0 0 259 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="244,198 233,203 233,194" style="fill:rgb(0,0,0)"/>
<path d="M203,198L238,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,198 358,203 358,194" style="fill:rgb(0,0,0)"/>
<path d="M316,198L363,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,198 L 377,198 Q 384,198 384,191 L 384,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,251L281,251A15 15 0 0 0 296 236A15 15 0 0 0 281 221L259,221A15 15 0 0 0 244 236A15 15 0 0 0 259 251Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="270" y="236" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="244,236 233,240 233,232" style="fill:rgb(0,0,0)"/>
<path d="M218,221 L 218,228 Q 218,236 228,236 L 238,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,236 358,240 358,232" style="fill:rgb(0,0,0)"/>
<path d="M296,236L363,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,236 L 377,236 Q 384,236 384,229 L 384,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,289L311,289A15 15 0 0 0 327 274A15 15 0 0 0 311 259L259,259A15 15 0 0 0 244 274A15 15 0 0 0 259 289Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="285" y="274" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="244,274 233,278 233,270" style="fill:rgb(0,0,0)"/>
<path d="M218,259 L 218,266 Q 218,274 228,274 L 238,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,274 358,278 358,270" style="fill:rgb(0,0,0)"/>
<path d="M327,274L363,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,274 L 377,274 Q 384,274 384,266 L 384,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,327L323,327A15 15 0 0 0 338 312A15 15 0 0 0 323 297L259,297A15 15 0 0 0 244 312A15 15 0 0 0 259 327Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="291" y="312" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<polygon points="244,312 233,316 233,307" style="fill:rgb(0,0,0)"/>
<path d="M218,297 L 218,304 Q 218,312 228,312 L 238,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,312 358,316 358,307" style="fill:rgb(0,0,0)"/>
<path d="M338,312L363,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,312 L 377,312 Q 384,312 384,304 L 384,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,455L156,455A15 15 0 0 0 171 440A15 15 0 0 0 156 425L60,425A15 15 0 0 0 45 440A15 15 0 0 0 60 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,440 183,444 183,436" style="fill:rgb(0,0,0)"/>
<path d="M171,440L189,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,455A15 15 0 0 0 225 440A15 15 0 0 0 210 425A15 15 0 0 0 195 440A15 15 0 0 0 210 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="440" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,440 249,444 249,436" style="fill:rgb(0,0,0)"/>
<path d="M225,440L255,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,455L351,455A15 15 0 0 0 366 440A15 15 0 0 0 351 425L276,425A15 15 0 0 0 261 440A15 15 0 0 0 276 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="402,440 391,444 391,436" style="fill:rgb(0,0,0)"/>
<path d="M366,440L396,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,455L421,455A15 15 0 0 0 436 440A15 15 0 0 0 421 425L417,425A15 15 0 0 0 402 440A15 15 0 0 0 417 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="419" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="459,440 448,444 448,436" style="fill:rgb(0,0,0)"/>
<path d="M436,440L454,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,455L495,455A15 15 0 0 0 510 440A15 15 0 0 0 495 425L475,425A15 15 0 0 0 459 440A15 15 0 0 0 475 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="485" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">alias</text>
<polygon points="483,238 478,227 487,227" style="fill:rgb(0,0,0)"/>
<path d="M468,130 L 475,130 Q 483,130 483,145 L 483,217 L 483,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,395 183,390 183,399" style="fill:rgb(0,0,0)"/>
<path d="M483,238 L 483,380 Q 483,395 468,395 L 192,395 L 177,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,440 33,444 33,436" style="fill:rgb(0,0,0)"/>
<path d="M171,395 L 35,395 Q 20,395 20,410 L 20,425 Q 20,440 30,440 L 39,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,423 230,412 239,412" style="fill:rgb(0,0,0)"/>
<path d="M261,395 L 247,395 Q 234,395 234,406 L 234,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M234,423 L 234,432 Q 234,440 242,440 L 249,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,546A15 15 0 0 0 75 531A15 15 0 0 0 60 516A15 15 0 0 0 45 531A15 15 0 0 0 60 546Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="531" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,531 100,535 100,527" style="fill:rgb(0,0,0)"/>
<path d="M75,531L105,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,546L220,546A15 15 0 0 0 235 531A15 15 0 0 0 220 516L126,516A15 15 0 0 0 111 531A15 15 0 0 0 126 546Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="531" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="271,531 260,535 260,527" style="fill:rgb(0,0,0)"/>
<path d="M235,531L266,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,546A15 15 0 0 0 302 531A15 15 0 0 0 287 516A15 15 0 0 0 271 531A15 15 0 0 0 287 546Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="287" y="531" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<path d="M173,580A15 15 0 0 0 188 565A15 15 0 0 0 173 550A15 15 0 0 0 158 565A15 15 0 0 0 173 580Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="565" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="188,565 200,561 200,569" style="fill:rgb(0,0,0)"/>
<path d="M235,531 L 243,531 Q 250,531 250,546 L 250,550 Q 250,565 235,565 L 209,565 L 194,565"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,565 L 100,565 Q 85,565 85,550 L 85,546 Q 85,531 92,531 L 100,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="173,595 185,591 185,599" style="fill:rgb(0,0,0)"/>
<path d="M302,531 L 309,531 Q 317,531 317,546 L 317,580 Q 317,595 302,595 L 194,595 L 179,595"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M173,595 L 39,595 Q 24,595 24,603 L 24,610"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="436,486 448,481 448,490" style="fill:rgb(0,0,0)"/>
<path d="M510,440 L 518,440 Q 525,440 525,455 L 525,471 Q 525,486 510,486 L 457,486 L 442,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,531 33,535 33,527" style="fill:rgb(0,0,0)"/>
<path d="M436,486 L 39,486 Q 24,486 24,501 L 24,516 Q 24,531 31,531 L 39,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="381,469 377,457 385,457" style="fill:rgb(0,0,0)"/>
<path d="M366,440 L 374,440 Q 381,440 381,451 L 381,463"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M381,469 L 381,477 Q 381,486 374,486 L 366,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,671L112,671A15 15 0 0 0 127 656A15 15 0 0 0 112 640L60,640A15 15 0 0 0 45 656A15 15 0 0 0 60 671Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="86" y="656" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="163,656 152,660 152,651" style="fill:rgb(0,0,0)"/>
<path d="M127,656L158,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,671A15 15 0 0 0 194 656A15 15 0 0 0 179 640A15 15 0 0 0 163 656A15 15 0 0 0 179 671Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="179" y="656" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="230,656 218,660 218,651" style="fill:rgb(0,0,0)"/>
<path d="M194,656L224,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M230,671L279,671L279,640L230,640Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="656" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="315,656 303,660 303,651" style="fill:rgb(0,0,0)"/>
<path d="M279,656L309,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,671A15 15 0 0 0 345 656A15 15 0 0 0 330 640A15 15 0 0 0 315 656A15 15 0 0 0 330 671Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="330" y="656" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="45,656 33,660 33,651" style="fill:rgb(0,0,0)"/>
<path d="M24,516 L 24,641 Q 24,656 31,656 L 39,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,705A15 15 0 0 0 269 690A15 15 0 0 0 254 675A15 15 0 0 0 239 690A15 15 0 0 0 254 705Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="690" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="269,690 281,685 281,694" style="fill:rgb(0,0,0)"/>
<path d="M279,656 L 286,656 Q 294,656 294,671 L 294,675 Q 294,690 285,690 L 275,690"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M239,690 L 218,690 Q 203,690 203,675 L 203,671 Q 203,656 211,656 L 218,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,743A15 15 0 0 0 269 727A15 15 0 0 0 254 712A15 15 0 0 0 239 727A15 15 0 0 0 254 743Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="727" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="269,727 281,723 281,732" style="fill:rgb(0,0,0)"/>
<path d="M345,656 L 353,656 Q 360,656 360,671 L 360,712 Q 360,727 345,727 L 290,727 L 275,727"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M239,727 L 152,727 Q 137,727 137,712 L 137,671 Q 137,656 144,656 L 152,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="387,693 375,698 375,689" style="fill:rgb(0,0,0)"/>
<path d="M345,656 L 353,656 Q 360,656 360,671 L 360,678 Q 360,693 371,693 L 381,693"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M387,709L512,709L512,678L387,678Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="449" y="693" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">upsert-clause</text>
<polygon points="535,693 523,698 523,689" style="fill:rgb(0,0,0)"/>
<path d="M512,693L529,693"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,693 L 542,693 Q 550,693 550,701 L 550,708"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="535,656 523,660 523,651" style="fill:rgb(0,0,0)"/>
<path d="M345,656L529,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,788L149,788L149,758L45,758Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="97" y="773" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="535,773 523,777 523,768" style="fill:rgb(0,0,0)"/>
<path d="M149,773L529,773"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,773 L 542,773 Q 550,773 550,780 L 550,788"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,773 33,777 33,768" style="fill:rgb(0,0,0)"/>
<path d="M24,640 L 24,758 Q 24,773 31,773 L 39,773"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M387,818L512,818L512,788L387,788Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="449" y="803" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">upsert-clause</text>
<polygon points="535,803 523,807 523,799" style="fill:rgb(0,0,0)"/>
<path d="M512,803L529,803"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,803 L 542,803 Q 550,803 550,811 L 550,818"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="387,803 375,807 375,799" style="fill:rgb(0,0,0)"/>
<path d="M345,773 L 353,773 Q 360,773 360,788 L 360,788 Q 360,803 371,803 L 381,803"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,856L125,856A15 15 0 0 0 140 841A15 15 0 0 0 125 826L60,826A15 15 0 0 0 45 841A15 15 0 0 0 60 856Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="841" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFAULT</text>
<polygon points="164,841 152,845 152,837" style="fill:rgb(0,0,0)"/>
<path d="M140,841L158,841"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,856L231,856A15 15 0 0 0 246 841A15 15 0 0 0 231 826L179,826A15 15 0 0 0 164 841A15 15 0 0 0 179 856Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="205" y="841" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="535,841 523,845 523,837" style="fill:rgb(0,0,0)"/>
<path d="M246,841L529,841"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,841 33,845 33,837" style="fill:rgb(0,0,0)"/>
<path d="M24,758 L 24,826 Q 24,841 31,841 L 39,841"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M361,919L512,919L512,889L361,889Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="436" y="904" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">returning-clause</text>
<polygon points="591,904 580,909 580,900" style="fill:rgb(0,0,0)"/>
<path d="M512,904L585,904"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="595" cy="904" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,656 L 542,656 Q 550,656 550,671 L 550,889 Q 550,904 557,904 L 565,904"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="436,871 448,867 448,875" style="fill:rgb(0,0,0)"/>
<path d="M535,841 L 542,841 Q 550,841 550,856 L 550,856 Q 550,871 535,871 L 457,871 L 442,871"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="361,904 349,909 349,900" style="fill:rgb(0,0,0)"/>
<path d="M436,871 L 349,871 Q 334,871 334,886 L 334,889 Q 334,904 345,904 L 355,904"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/common-table-expression.html">common-table-expression:</a></b>
<button id='xf694b2ce' onclick='hideorshow("xf694b2ce","x1ab9a929")'>show</button></p>
 <div id='x1ab9a929' style='display:none;' class='imgcontainer'>
 <div style="max-width:638px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 638.525 167.4">
<circle cx="5" cy="29" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,29 20,33 20,24" style="fill:rgb(0,0,0)"/>
<path d="M9,29L26,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,44L122,44A15 15 0 0 0 137 29A15 15 0 0 0 122 14L47,14A15 15 0 0 0 32 29A15 15 0 0 0 47 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="160,29 149,33 149,24" style="fill:rgb(0,0,0)"/>
<path d="M137,29L155,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="196,29 185,33 185,24" style="fill:rgb(0,0,0)"/>
<path d="M160,29L191,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,44A15 15 0 0 0 227 29A15 15 0 0 0 211 14A15 15 0 0 0 196 29A15 15 0 0 0 211 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="250,29 238,33 238,24" style="fill:rgb(0,0,0)"/>
<path d="M227,29L244,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="286,29 274,33 274,24" style="fill:rgb(0,0,0)"/>
<path d="M250,29L280,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,44L395,44A15 15 0 0 0 410 29A15 15 0 0 0 395 14L301,14A15 15 0 0 0 286 29A15 15 0 0 0 301 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="446,29 434,33 434,24" style="fill:rgb(0,0,0)"/>
<path d="M410,29L440,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,44A15 15 0 0 0 476 29A15 15 0 0 0 461 14A15 15 0 0 0 446 29A15 15 0 0 0 461 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,29 499,33 499,24" style="fill:rgb(0,0,0)"/>
<path d="M476,29L505,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,165L51,165A15 15 0 0 0 66 150A15 15 0 0 0 51 135L47,135A15 15 0 0 0 32 150A15 15 0 0 0 47 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="49" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<path d="M127,135L147,135A15 15 0 0 0 162 119A15 15 0 0 0 147 104L127,104A15 15 0 0 0 112 119A15 15 0 0 0 127 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<path d="M219,135L337,135A15 15 0 0 0 352 119A15 15 0 0 0 337 104L219,104A15 15 0 0 0 204 119A15 15 0 0 0 219 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<path d="M162,119L204,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,165A15 15 0 0 0 425 150A15 15 0 0 0 410 135A15 15 0 0 0 395 150A15 15 0 0 0 410 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="410" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="448,150 437,154 437,145" style="fill:rgb(0,0,0)"/>
<path d="M425,150L442,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,165L552,165L552,135L448,135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="500" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="575,150 564,154 564,145" style="fill:rgb(0,0,0)"/>
<path d="M552,150L570,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M591,165A15 15 0 0 0 606 150A15 15 0 0 0 591 135A15 15 0 0 0 575 150A15 15 0 0 0 591 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="629,150 617,154 617,145" style="fill:rgb(0,0,0)"/>
<path d="M606,150L623,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="632" cy="150" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,82A15 15 0 0 0 363 66A15 15 0 0 0 348 51A15 15 0 0 0 333 66A15 15 0 0 0 348 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="363,66 374,62 374,71" style="fill:rgb(0,0,0)"/>
<path d="M410,29 L 417,29 Q 425,29 425,44 L 425,51 Q 425,66 410,66 L 384,66 L 369,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M333,66 L 278,66 Q 263,66 263,51 L 263,44 Q 263,29 270,29 L 278,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,93 78,89 78,97" style="fill:rgb(0,0,0)"/>
<path d="M511,29 L 516,29 Q 522,29 522,44 L 522,78 Q 522,93 507,93 L 87,93 L 72,93"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,150 20,154 20,145" style="fill:rgb(0,0,0)"/>
<path d="M66,93 L 30,93 Q 15,93 15,108 L 15,135 Q 15,150 20,150 L 26,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="85,150 73,154 73,145" style="fill:rgb(0,0,0)"/>
<path d="M66,150L79,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="112,119 101,124 101,115" style="fill:rgb(0,0,0)"/>
<path d="M85,150 L 89,150 Q 92,150 92,135 L 92,134 Q 92,119 99,119 L 106,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="204,119 192,124 192,115" style="fill:rgb(0,0,0)"/>
<path d="M66,150 L 147,150 Q 162,150 170,150 Q 177,150 177,135 L 177,134 Q 177,119 188,119 L 198,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,150 383,154 383,145" style="fill:rgb(0,0,0)"/>
<path d="M352,119 L 360,119 Q 367,119 367,134 L 367,135 Q 367,150 378,150 L 389,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150L395,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,6 336,10 336,2" style="fill:rgb(0,0,0)"/>
<path d="M160,29 L 168,29 Q 175,29 175,17 Q 175,6 190,6 L 327,6 L 342,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,6 L 473,6 Q 488,6 488,17 Q 488,29 495,29 L 503,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/returning-clause.html">returning-clause:</a></b>
<button id='xd961d430' onclick='hideorshow("xd961d430","xa7e9d13c")'>show</button></p>
 <div id='xa7e9d13c' style='display:none;' class='imgcontainer'>
 <div style="max-width:628px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 628.709 140.4">
<circle cx="5" cy="47" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="27,47 15,51 15,43" style="fill:rgb(0,0,0)"/>
<path d="M9,47L21,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M42,62L132,62A15 15 0 0 0 147 47A15 15 0 0 0 132 32L42,32A15 15 0 0 0 27 47A15 15 0 0 0 42 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RETURNING</text>
<polygon points="237,47 226,51 226,43" style="fill:rgb(0,0,0)"/>
<path d="M147,47L232,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M237,62L287,62L287,32L237,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="262" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="328,77 317,82 317,73" style="fill:rgb(0,0,0)"/>
<path d="M287,47 L 294,47 Q 302,47 302,62 L 302,62 Q 302,77 312,77 L 322,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M343,92L347,92A15 15 0 0 0 362 77L362,77A15 15 0 0 0 347 62L343,62A15 15 0 0 0 328 77L328,77A15 15 0 0 0 343 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="398,77 387,82 387,73" style="fill:rgb(0,0,0)"/>
<path d="M362,77L393,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M414,92L501,92A15 15 0 0 0 516 77L516,77A15 15 0 0 0 501 62L414,62A15 15 0 0 0 398 77L398,77A15 15 0 0 0 414 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="457" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="539,77 528,82 528,73" style="fill:rgb(0,0,0)"/>
<path d="M516,77L534,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="581,47 569,51 569,43" style="fill:rgb(0,0,0)"/>
<path d="M539,77 L 547,77 Q 554,77 554,62 L 554,62 Q 554,47 565,47 L 575,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="619,47 607,51 607,43" style="fill:rgb(0,0,0)"/>
<path d="M581,47L613,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="622" cy="47" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="345,101 334,106 334,97" style="fill:rgb(0,0,0)"/>
<path d="M302,62 L 302,86 Q 302,101 317,101 L 325,101 L 340,101"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,101 L 362,101 Q 377,101 377,89 Q 377,77 385,77 L 392,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="453,47 441,51 441,43" style="fill:rgb(0,0,0)"/>
<path d="M287,47L447,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,47L607,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,138A15 15 0 0 0 406 123A15 15 0 0 0 391 108A15 15 0 0 0 376 123A15 15 0 0 0 391 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="391" y="123" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="376,123 365,127 365,118" style="fill:rgb(0,0,0)"/>
<path d="M147,47 L 196,47 Q 211,47 211,62 L 211,108 Q 211,123 226,123 L 355,123 L 370,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="539,123 528,127 528,118" style="fill:rgb(0,0,0)"/>
<path d="M406,123L534,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,123 L 547,123 Q 554,123 554,108 L 554,77 L 554,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,32A15 15 0 0 0 406 17A15 15 0 0 0 391 2A15 15 0 0 0 376 17A15 15 0 0 0 391 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="391" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="406,17 418,12 418,21" style="fill:rgb(0,0,0)"/>
<path d="M581,47 L 588,47 Q 596,47 596,32 L 596,32 Q 596,17 581,17 L 427,17 L 412,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="186,47 174,51 174,43" style="fill:rgb(0,0,0)"/>
<path d="M376,17 L 174,17 Q 159,17 159,32 L 159,32 Q 159,47 169,47 L 180,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/upsert-clause.html">upsert-clause:</a></b>
<button id='x8e9a77ec' onclick='hideorshow("x8e9a77ec","x057d0c47")'>show</button></p>
 <div id='x057d0c47' style='display:none;' class='imgcontainer'>
 <div style="max-width:901px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 901.142 363.96">
<path d="M223,165L759,165L759,51L223,51Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="5" cy="66" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,66 35,71 35,62" style="fill:rgb(0,0,0)"/>
<path d="M9,66L41,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,82L71,82A15 15 0 0 0 86 66A15 15 0 0 0 71 51L62,51A15 15 0 0 0 47 66A15 15 0 0 0 62 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="66" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="103,66 92,71 92,62" style="fill:rgb(0,0,0)"/>
<path d="M86,66L98,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M118,82L193,82A15 15 0 0 0 208 66A15 15 0 0 0 193 51L118,51A15 15 0 0 0 103 66A15 15 0 0 0 118 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="66" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONFLICT</text>
<polygon points="264,97 253,101 253,92" style="fill:rgb(0,0,0)"/>
<path d="M208,66 L 223,66 Q 238,66 238,81 L 238,82 Q 238,97 248,97 L 259,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M280,112A15 15 0 0 0 295 97L295,97A15 15 0 0 0 280 82A15 15 0 0 0 264 97L264,97A15 15 0 0 0 280 112Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="97" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="331,97 319,101 319,92" style="fill:rgb(0,0,0)"/>
<path d="M295,97L325,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M331,112L475,112L475,82L331,82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="97" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">indexed-column</text>
<polygon points="511,97 500,101 500,92" style="fill:rgb(0,0,0)"/>
<path d="M475,97L506,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M526,112A15 15 0 0 0 542 97L542,97A15 15 0 0 0 526 82A15 15 0 0 0 511 97L511,97A15 15 0 0 0 526 112Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="526" y="97" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="583,135 572,139 572,130" style="fill:rgb(0,0,0)"/>
<path d="M542,97 L 549,97 Q 557,97 557,112 L 557,119 Q 557,135 567,135 L 577,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M598,150L648,150A15 15 0 0 0 663 135A15 15 0 0 0 648 119L598,119A15 15 0 0 0 583 135A15 15 0 0 0 598 150Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="623" y="135" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="680,135 669,139 669,130" style="fill:rgb(0,0,0)"/>
<path d="M663,135L674,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M680,150L729,150L729,119L680,119Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="705" y="135" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="744,108 749,119 740,119" style="fill:rgb(0,0,0)"/>
<path d="M729,135 L 737,135 Q 744,135 744,124 L 744,114"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="786,66 774,71 774,62" style="fill:rgb(0,0,0)"/>
<path d="M744,108 L 744,81 Q 744,66 759,66 L 765,66 L 780,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M801,82L809,82A15 15 0 0 0 824 66A15 15 0 0 0 809 51L801,51A15 15 0 0 0 786 66A15 15 0 0 0 801 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="805" y="66" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DO</text>
<polygon points="729,97 718,101 718,92" style="fill:rgb(0,0,0)"/>
<path d="M542,97L723,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,97 L 737,97 Q 744,97 744,89 L 744,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M208,66L774,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,150A15 15 0 0 0 418 135A15 15 0 0 0 403 119A15 15 0 0 0 388 135A15 15 0 0 0 403 150Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="135" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,135 430,130 430,139" style="fill:rgb(0,0,0)"/>
<path d="M475,97 L 483,97 Q 490,97 490,112 L 490,119 Q 490,135 475,135 L 439,135 L 424,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,135 L 319,135 Q 304,135 304,119 L 304,112 Q 304,97 312,97 L 319,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="288" y="36" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" dominant-baseline="central">conflict target</text>
<polygon points="436,195 447,191 447,199" style="fill:rgb(0,0,0)"/>
<path d="M824,66 L 831,66 Q 839,66 839,81 L 839,180 Q 839,195 824,195 L 456,195 L 441,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,271 35,275 35,266" style="fill:rgb(0,0,0)"/>
<path d="M436,195 L 35,195 Q 20,195 20,210 L 20,256 Q 20,271 31,271 L 41,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,286L116,286A15 15 0 0 0 131 271A15 15 0 0 0 116 255L62,255A15 15 0 0 0 47 271A15 15 0 0 0 62 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="89" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="148,271 137,275 137,266" style="fill:rgb(0,0,0)"/>
<path d="M131,271L143,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M164,286L179,286A15 15 0 0 0 194 271A15 15 0 0 0 179 255L164,255A15 15 0 0 0 148 271A15 15 0 0 0 164 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="171" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="257,308 245,313 245,304" style="fill:rgb(0,0,0)"/>
<path d="M194,271 L 215,271 Q 230,271 230,286 L 230,293 Q 230,308 241,308 L 251,308"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,324L413,324L413,293L257,293Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="335" y="308" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name-list</text>
<polygon points="475,271 464,275 464,266" style="fill:rgb(0,0,0)"/>
<path d="M413,308 L 434,308 Q 449,308 449,293 L 449,286 Q 449,271 459,271 L 469,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,286A15 15 0 0 0 505 271A15 15 0 0 0 490 255A15 15 0 0 0 475 271A15 15 0 0 0 490 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="490" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">=</text>
<polygon points="523,271 511,275 511,266" style="fill:rgb(0,0,0)"/>
<path d="M505,271L517,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M523,286L572,286L572,255L523,255Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="547" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="619,271 608,275 608,266" style="fill:rgb(0,0,0)"/>
<path d="M572,271L613,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M634,286L684,286A15 15 0 0 0 699 271A15 15 0 0 0 684 255L634,255A15 15 0 0 0 619 271A15 15 0 0 0 634 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="659" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="716,271 705,275 705,266" style="fill:rgb(0,0,0)"/>
<path d="M699,271L710,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M716,286L765,286L765,255L716,255Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="741" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="891,233 880,237 880,228" style="fill:rgb(0,0,0)"/>
<path d="M765,271 L 773,271 Q 780,271 780,256 L 780,248 Q 780,233 795,233 L 871,233 L 886,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="895" cy="233" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,248L130,248A15 15 0 0 0 145 233A15 15 0 0 0 130 218L62,218A15 15 0 0 0 47 233A15 15 0 0 0 62 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="96" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTHING</text>
<polygon points="47,233 35,237 35,228" style="fill:rgb(0,0,0)"/>
<path d="M20,218 L 20,225 Q 20,233 31,233 L 41,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,233L880,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="638,233 626,237 626,228" style="fill:rgb(0,0,0)"/>
<path d="M587,271 L 594,271 Q 602,271 602,256 L 602,248 Q 602,233 617,233 L 617,233 L 632,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M383,361A15 15 0 0 0 398 346A15 15 0 0 0 383 331A15 15 0 0 0 368 346A15 15 0 0 0 383 361Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="383" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="398,346 410,342 410,351" style="fill:rgb(0,0,0)"/>
<path d="M572,271 L 579,271 Q 587,271 587,286 L 587,331 Q 587,346 572,346 L 419,346 L 404,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,308 210,320 201,320" style="fill:rgb(0,0,0)"/>
<path d="M368,346 L 221,346 Q 206,346 206,331 L 206,329 L 206,314"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,308 L 206,286 Q 206,271 221,271 L 227,271 L 242,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="257,271 245,275 245,266" style="fill:rgb(0,0,0)"/>
<path d="M194,271L251,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,286L366,286A15 15 0 0 0 381 271A15 15 0 0 0 366 255L272,255A15 15 0 0 0 257 271A15 15 0 0 0 272 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<path d="M381,271L464,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="865,97 869,108 860,108" style="fill:rgb(0,0,0)"/>
<path d="M850,233 L 857,233 Q 865,233 865,218 L 865,117 L 865,102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="403,6 415,2 415,10" style="fill:rgb(0,0,0)"/>
<path d="M865,97 L 865,21 Q 865,6 850,6 L 424,6 L 409,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,6 L 40,6 Q 25,6 25,21 L 25,51 Q 25,66 32,66 L 40,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/column-name-list.html">column-name-list:</a></b>
<button id='x24b86e72' onclick='hideorshow("x24b86e72","x95d39925")'>show</button></p>
 <div id='x95d39925' style='display:none;' class='imgcontainer'>
 <div style="max-width:353px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 353.621 72.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="85,17 74,21 74,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L79,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,17 110,21 110,12" style="fill:rgb(0,0,0)"/>
<path d="M85,17L115,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,32L230,32A15 15 0 0 0 245 17A15 15 0 0 0 230 2L136,2A15 15 0 0 0 121 17A15 15 0 0 0 136 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="290,17 279,21 279,12" style="fill:rgb(0,0,0)"/>
<path d="M245,17L285,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M306,32A15 15 0 0 0 321 17A15 15 0 0 0 306 2A15 15 0 0 0 290 17A15 15 0 0 0 306 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="306" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="344,17 332,21 332,12" style="fill:rgb(0,0,0)"/>
<path d="M321,17L338,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="347" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M183,70A15 15 0 0 0 198 55L198,55A15 15 0 0 0 183 39A15 15 0 0 0 168 55L168,55A15 15 0 0 0 183 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="198,55 210,50 210,59" style="fill:rgb(0,0,0)"/>
<path d="M245,17 L 257,17 Q 269,17 269,32 L 269,40 Q 269,55 254,55 L 219,55 L 204,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,17 110,21 110,12" style="fill:rgb(0,0,0)"/>
<path d="M168,55 L 102,55 Q 87,55 87,40 L 87,32 Q 87,17 101,17 L 115,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/indexed-column.html">indexed-column:</a></b>
<button id='x65b7b5be' onclick='hideorshow("x65b7b5be","x1ee45b47")'>show</button></p>
 <div id='x1ee45b47' style='display:none;' class='imgcontainer'>
 <div style="max-width:696px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 696.36 102.6">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L160,32A15 15 0 0 0 175 17A15 15 0 0 0 160 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="113" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="246,47 235,51 235,43" style="fill:rgb(0,0,0)"/>
<path d="M175,17 L 205,17 Q 220,17 220,32 L 220,32 Q 220,47 230,47 L 240,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M261,62L325,62A15 15 0 0 0 341 47L341,47A15 15 0 0 0 325 32L261,32A15 15 0 0 0 246 47L246,47A15 15 0 0 0 261 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="293" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="358,47 346,51 346,43" style="fill:rgb(0,0,0)"/>
<path d="M341,47L352,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M373,62L478,62A15 15 0 0 0 493 47L493,47A15 15 0 0 0 478 32L373,32A15 15 0 0 0 358 47L358,47A15 15 0 0 0 373 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="511,47 499,51 499,43" style="fill:rgb(0,0,0)"/>
<path d="M493,47L505,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="567,85 556,89 556,81" style="fill:rgb(0,0,0)"/>
<path d="M511,47 L 518,47 Q 526,47 526,32 L 526,32 Q 526,17 533,17 Q 541,17 541,32 L 541,70 Q 541,85 551,85 L 561,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,100L613,100A15 15 0 0 0 628 85L628,85A15 15 0 0 0 613 70L582,70A15 15 0 0 0 567 85L567,85A15 15 0 0 0 582 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="645,85 633,89 633,81" style="fill:rgb(0,0,0)"/>
<path d="M628,85L639,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="687,17 675,21 675,12" style="fill:rgb(0,0,0)"/>
<path d="M645,85 L 652,85 Q 660,85 660,70 L 660,32 Q 660,17 670,17 L 681,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="690" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M50,70L100,70L100,39L50,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="175,55 163,59 163,50" style="fill:rgb(0,0,0)"/>
<path d="M100,55L169,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M175,55 L 182,55 Q 190,55 190,40 L 190,32 Q 190,17 197,17 L 205,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M175,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,17 586,21 586,12" style="fill:rgb(0,0,0)"/>
<path d="M358,17L592,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,17L675,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,62L599,62A15 15 0 0 0 614 47A15 15 0 0 0 599 32L582,32A15 15 0 0 0 567 47A15 15 0 0 0 582 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="645,47 633,51 633,43" style="fill:rgb(0,0,0)"/>
<path d="M614,47L639,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M645,47 L 652,47 Q 660,47 660,40 L 660,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="567,47 556,51 556,43" style="fill:rgb(0,0,0)"/>
<path d="M541,32 L 541,39 Q 541,47 551,47 L 561,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/select-stmt.html">select-stmt:</a></b>
<button id='x493f815e' onclick='hideorshow("x493f815e","x9d8e58d9")'>show</button></p>
 <div id='x9d8e58d9' style='display:none;' class='imgcontainer'>
 <div style="max-width:669px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 669.677 1162.3">
<path d="M55,845L667,845L667,99L55,99Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="6" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="46,17 34,21 34,12" style="fill:rgb(0,0,0)"/>
<path d="M10,17L40,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M61,32L92,32A15 15 0 0 0 107 17A15 15 0 0 0 92 2L61,2A15 15 0 0 0 46 17A15 15 0 0 0 61 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="76" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M167,62L253,62A15 15 0 0 0 268 47L268,47A15 15 0 0 0 253 32L167,32A15 15 0 0 0 152 47L152,47A15 15 0 0 0 167 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="210,17 198,21 198,12" style="fill:rgb(0,0,0)"/>
<path d="M107,17L204,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M210,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M358,32L584,32L584,2L358,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="152,47 140,51 140,43" style="fill:rgb(0,0,0)"/>
<path d="M107,17 L 114,17 Q 122,17 122,32 L 122,32 Q 122,47 134,47 L 146,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="291,47 279,51 279,43" style="fill:rgb(0,0,0)"/>
<path d="M268,47L285,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,47 L 298,47 Q 306,47 306,32 L 306,32 Q 306,17 321,17 L 331,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,70A15 15 0 0 0 486 55L486,55A15 15 0 0 0 471 39A15 15 0 0 0 456 55L456,55A15 15 0 0 0 471 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="486,55 498,50 498,59" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,40 Q 599,55 584,55 L 507,55 L 492,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,55 L 350,55 Q 335,55 335,40 L 335,32 Q 335,17 340,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,83 307,79 307,88" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,68 Q 599,83 584,83 L 316,83 L 301,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,83 L 40,83 Q 25,83 25,98 L 25,113"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="25,47 20,36 29,36" style="fill:rgb(0,0,0)"/>
<path d="M10,17 L 17,17 Q 25,17 25,29 L 25,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="55,129 43,133 43,124" style="fill:rgb(0,0,0)"/>
<path d="M25,47 L 25,114 Q 25,129 37,129 L 49,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,129 115,133 115,124" style="fill:rgb(0,0,0)"/>
<path d="M55,129L121,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,144L193,144A15 15 0 0 0 208 129A15 15 0 0 0 193 114L142,114A15 15 0 0 0 127 129A15 15 0 0 0 142 144Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="250,159 238,163 238,155" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,144 Q 223,159 233,159 L 244,159"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,174L333,174A15 15 0 0 0 348 159A15 15 0 0 0 333 144L265,144A15 15 0 0 0 250 159A15 15 0 0 0 265 174Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="159" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="417,129 406,133 406,124" style="fill:rgb(0,0,0)"/>
<path d="M348,159 L 356,159 Q 363,159 363,144 L 363,144 Q 363,129 378,129 L 396,129 L 411,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,144L545,144L545,114L417,114Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M481,182A15 15 0 0 0 496 166A15 15 0 0 0 481 151A15 15 0 0 0 466 166A15 15 0 0 0 481 182Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="166" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="496,166 508,162 508,171" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,151 Q 560,166 545,166 L 517,166 L 502,166"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M466,166 L 406,166 Q 391,166 391,151 L 391,144 Q 391,129 398,129 L 406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,129 287,133 287,124" style="fill:rgb(0,0,0)"/>
<path d="M208,129L293,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M299,129L406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,212L280,212A15 15 0 0 0 295 197A15 15 0 0 0 280 182L265,182A15 15 0 0 0 250 197A15 15 0 0 0 265 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="197" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="348,197 337,201 337,192" style="fill:rgb(0,0,0)"/>
<path d="M295,197L342,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,197 L 356,197 Q 363,197 363,182 L 363,159 L 363,144"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="250,197 238,201 238,192" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,182 Q 223,197 233,197 L 244,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,287L203,287A15 15 0 0 0 218 272A15 15 0 0 0 203 257L168,257A15 15 0 0 0 153 272A15 15 0 0 0 168 287Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="186" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="290,272 279,277 279,268" style="fill:rgb(0,0,0)"/>
<path d="M218,272L284,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,287L451,287L451,257L290,257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M320,362L422,362L422,331L320,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M371,324A15 15 0 0 0 386 309A15 15 0 0 0 371 293A15 15 0 0 0 356 309A15 15 0 0 0 371 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="386,309 397,304 397,313" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 459,272 Q 466,272 466,287 L 466,294 Q 466,309 451,309 L 407,309 L 392,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M356,309 L 279,309 Q 264,309 264,294 L 264,287 Q 264,272 271,272 L 279,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="320,346 308,351 308,342" style="fill:rgb(0,0,0)"/>
<path d="M218,272 L 226,272 Q 233,272 233,287 L 233,331 Q 233,346 248,346 L 299,346 L 314,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="484,313 488,325 480,325" style="fill:rgb(0,0,0)"/>
<path d="M422,346 L 436,346 Q 451,346 466,346 L 469,346 Q 484,346 484,333 L 484,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,272 494,277 494,268" style="fill:rgb(0,0,0)"/>
<path d="M484,313 L 484,287 Q 484,272 492,272 L 499,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,272 L 496,272 Q 487,272 487,272 Q 487,272 495,272 L 502,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,197 555,185 564,185" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,176 L 560,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,235 360,230 360,239" style="fill:rgb(0,0,0)"/>
<path d="M560,197 L 560,220 Q 560,235 545,235 L 369,235 L 354,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,272 142,277 142,268" style="fill:rgb(0,0,0)"/>
<path d="M348,235 L 142,235 Q 127,235 127,250 L 127,257 Q 127,272 137,272 L 147,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,437L218,437A15 15 0 0 0 233 422A15 15 0 0 0 218 407L168,407A15 15 0 0 0 153 422A15 15 0 0 0 168 437Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="256,422 244,426 244,418" style="fill:rgb(0,0,0)"/>
<path d="M233,422L250,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,437L305,437L305,407L256,407Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="517,324 513,312 521,312" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 502,272 Q 517,272 517,287 L 517,303 L 517,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,384 382,380 382,389" style="fill:rgb(0,0,0)"/>
<path d="M517,324 L 517,369 Q 517,384 502,384 L 391,384 L 376,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,422 142,426 142,418" style="fill:rgb(0,0,0)"/>
<path d="M371,384 L 142,384 Q 127,384 127,399 L 127,407 Q 127,422 137,422 L 147,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,324 122,312 131,312" style="fill:rgb(0,0,0)"/>
<path d="M127,257L127,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,324L127,407"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,535L212,535A15 15 0 0 0 227 520A15 15 0 0 0 212 505L168,505A15 15 0 0 0 153 520A15 15 0 0 0 168 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="250,520 238,525 238,516" style="fill:rgb(0,0,0)"/>
<path d="M227,520L244,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,535L269,535A15 15 0 0 0 284 520A15 15 0 0 0 269 505L265,505A15 15 0 0 0 250 520A15 15 0 0 0 265 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="320,520 309,525 309,516" style="fill:rgb(0,0,0)"/>
<path d="M284,520L314,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,535L369,535L369,505L320,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="452,520 441,525 441,516" style="fill:rgb(0,0,0)"/>
<path d="M369,520L446,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,535L520,535A15 15 0 0 0 535 520A15 15 0 0 0 520 505L467,505A15 15 0 0 0 452 520A15 15 0 0 0 467 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="558,520 546,525 546,516" style="fill:rgb(0,0,0)"/>
<path d="M535,520L552,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,535L607,535L607,505L558,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M345,573A15 15 0 0 0 360 558A15 15 0 0 0 345 543A15 15 0 0 0 330 558A15 15 0 0 0 345 573Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="558" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="360,558 371,554 371,562" style="fill:rgb(0,0,0)"/>
<path d="M369,520 L 377,520 Q 384,520 384,535 L 384,543 Q 384,558 375,558 L 366,558"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,558 L 309,558 Q 294,558 294,543 L 294,535 Q 294,520 301,520 L 309,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="514,551 503,555 503,546" style="fill:rgb(0,0,0)"/>
<path d="M411,520 L 418,520 Q 426,520 426,535 L 426,536 Q 426,551 441,551 L 493,551 L 508,551"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M514,551 L 607,551 Q 622,551 622,536 L 622,535 Q 622,520 630,520 L 637,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,490 256,494 256,486" style="fill:rgb(0,0,0)"/>
<path d="M127,460 L 127,475 Q 127,490 142,490 L 246,490 L 261,490"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,520 399,525 399,516" style="fill:rgb(0,0,0)"/>
<path d="M267,490 L 369,490 Q 384,490 384,505 L 384,505 Q 384,520 395,520 L 405,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,460 244,455 244,464" style="fill:rgb(0,0,0)"/>
<path d="M305,422 L 313,422 Q 320,422 320,437 L 320,445 Q 320,460 305,460 L 254,460 L 239,460"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,520 142,525 142,516" style="fill:rgb(0,0,0)"/>
<path d="M233,460 L 142,460 Q 127,460 127,475 L 127,505 Q 127,520 137,520 L 147,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,447 122,435 131,435" style="fill:rgb(0,0,0)"/>
<path d="M127,407L127,441"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,447L127,505"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,649L232,649A15 15 0 0 0 247 634A15 15 0 0 0 232 619L168,619A15 15 0 0 0 153 634A15 15 0 0 0 168 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="200" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="283,634 271,638 271,629" style="fill:rgb(0,0,0)"/>
<path d="M247,634L277,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,649L395,649A15 15 0 0 0 410 634A15 15 0 0 0 395 619L298,619A15 15 0 0 0 283 634A15 15 0 0 0 298 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="433,634 422,638 422,629" style="fill:rgb(0,0,0)"/>
<path d="M410,634L427,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,649L452,649A15 15 0 0 0 467 634A15 15 0 0 0 452 619L448,619A15 15 0 0 0 433 634A15 15 0 0 0 448 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="450" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="490,634 479,638 479,629" style="fill:rgb(0,0,0)"/>
<path d="M467,634L485,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,649L609,649L609,619L490,619Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="550" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M446,687A15 15 0 0 0 461 671A15 15 0 0 0 446 656A15 15 0 0 0 431 671A15 15 0 0 0 446 687Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="671" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="461,671 472,667 472,676" style="fill:rgb(0,0,0)"/>
<path d="M609,634 L 616,634 Q 624,634 624,649 L 624,656 Q 624,671 609,671 L 482,671 L 467,671"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,671 L 271,671 Q 256,671 256,656 L 256,649 Q 256,634 264,634 L 271,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="624,692 619,680 628,680" style="fill:rgb(0,0,0)"/>
<path d="M624,656L624,686"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,558 648,547 656,547" style="fill:rgb(0,0,0)"/>
<path d="M607,520 L 637,520 Q 652,520 652,535 L 652,537 L 652,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,596 382,592 382,600" style="fill:rgb(0,0,0)"/>
<path d="M652,558 L 652,581 Q 652,596 637,596 L 391,596 L 376,596"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,634 142,638 142,629" style="fill:rgb(0,0,0)"/>
<path d="M371,596 L 142,596 Q 127,596 127,611 L 127,619 Q 127,634 137,634 L 147,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,558 122,547 131,547" style="fill:rgb(0,0,0)"/>
<path d="M127,505L127,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,709 359,714 359,705" style="fill:rgb(0,0,0)"/>
<path d="M127,558 L 127,694 Q 127,709 142,709 L 350,709 L 365,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,709 597,714 597,705" style="fill:rgb(0,0,0)"/>
<path d="M371,709L603,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,709 L 616,709 Q 624,709 624,717 L 624,724"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,800L194,800A15 15 0 0 0 209 785A15 15 0 0 0 194 770L142,770A15 15 0 0 0 127 785A15 15 0 0 0 142 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="245,785 234,789 234,781" style="fill:rgb(0,0,0)"/>
<path d="M209,785L239,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,800A15 15 0 0 0 275 785A15 15 0 0 0 260 770A15 15 0 0 0 245 785A15 15 0 0 0 260 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="311,785 300,789 300,781" style="fill:rgb(0,0,0)"/>
<path d="M275,785L306,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,800L361,800L361,770L311,770Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="397,785 385,789 385,781" style="fill:rgb(0,0,0)"/>
<path d="M361,785L391,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,800A15 15 0 0 0 427 785A15 15 0 0 0 412 770A15 15 0 0 0 397 785A15 15 0 0 0 412 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="412" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="609,785 597,789 597,781" style="fill:rgb(0,0,0)"/>
<path d="M427,785L603,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,785 L 616,785 Q 624,785 624,792 L 624,800"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,762A15 15 0 0 0 351 747A15 15 0 0 0 336 732A15 15 0 0 0 321 747A15 15 0 0 0 336 762Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="747" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M336,838A15 15 0 0 0 351 823A15 15 0 0 0 336 808A15 15 0 0 0 321 823A15 15 0 0 0 336 838Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="823" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="351,747 363,743 363,751" style="fill:rgb(0,0,0)"/>
<path d="M361,785 L 368,785 Q 376,785 376,770 L 376,762 Q 376,747 366,747 L 357,747"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,747 L 300,747 Q 285,747 285,762 L 285,770 Q 285,785 292,785 L 300,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,823 363,818 363,827" style="fill:rgb(0,0,0)"/>
<path d="M427,785 L 434,785 Q 442,785 442,800 L 442,808 Q 442,823 427,823 L 372,823 L 357,823"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,823 L 234,823 Q 219,823 219,808 L 219,800 Q 219,785 226,785 L 234,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,785 115,789 115,781" style="fill:rgb(0,0,0)"/>
<path d="M55,129 L 62,129 Q 70,129 70,144 L 70,770 Q 70,785 85,785 L 106,785 L 121,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,891L424,891L424,860L248,860Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="876" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="424,876 436,871 436,880" style="fill:rgb(0,0,0)"/>
<path d="M624,692 L 624,861 Q 624,876 609,876 L 445,876 L 430,876"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="6,197 10,208 2,208" style="fill:rgb(0,0,0)"/>
<path d="M248,876 L 21,876 Q 6,876 6,861 L 6,217 L 6,202"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M6,197 L 6,144 Q 6,129 21,129 L 40,129 L 55,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="667" y="275" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" transform="rotate(-90 667,285)" dominant-baseline="central">select-core</text>
<path d="M168,966L213,966A15 15 0 0 0 228 951A15 15 0 0 0 213 936L168,936A15 15 0 0 0 153 951A15 15 0 0 0 168 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="251,951 239,956 239,947" style="fill:rgb(0,0,0)"/>
<path d="M228,951L245,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,966L270,966A15 15 0 0 0 285 951A15 15 0 0 0 270 936L266,936A15 15 0 0 0 251 951A15 15 0 0 0 266 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M168,1072L202,1072A15 15 0 0 0 217 1057A15 15 0 0 0 202 1042L168,1042A15 15 0 0 0 153 1057A15 15 0 0 0 168 1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="240,1057 228,1061 228,1053" style="fill:rgb(0,0,0)"/>
<path d="M217,1057L234,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,1072L289,1072L289,1042L240,1042Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="330,951 319,956 319,947" style="fill:rgb(0,0,0)"/>
<path d="M285,951L324,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,966L460,966L460,936L330,936Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M395,1004A15 15 0 0 0 410 989A15 15 0 0 0 395 974A15 15 0 0 0 380 989A15 15 0 0 0 395 1004Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="989" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="410,989 422,985 422,993" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 468,951 Q 475,951 475,966 L 475,974 Q 475,989 460,989 L 431,989 L 416,989"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,989 L 322,989 Q 307,989 307,974 L 307,966 Q 307,951 313,951 L 319,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,913 348,909 348,918" style="fill:rgb(0,0,0)"/>
<path d="M624,860 L 624,898 Q 624,913 609,913 L 357,913 L 342,913"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,951 142,956 142,947" style="fill:rgb(0,0,0)"/>
<path d="M336,913 L 142,913 Q 127,913 127,928 L 127,936 Q 127,951 137,951 L 147,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,981 492,970 500,970" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 481,951 Q 496,951 496,963 L 496,976"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,1023 318,1019 318,1027" style="fill:rgb(0,0,0)"/>
<path d="M496,981 L 496,1008 Q 496,1023 481,1023 L 327,1023 L 312,1023"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,1057 142,1061 142,1053" style="fill:rgb(0,0,0)"/>
<path d="M307,1023 L 142,1023 Q 127,1023 127,1038 L 127,1042 Q 127,1057 137,1057 L 147,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,989 122,978 131,978" style="fill:rgb(0,0,0)"/>
<path d="M127,936L127,983"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,989L127,1042"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1102L415,1102A15 15 0 0 0 430 1087A15 15 0 0 0 415 1072L363,1072A15 15 0 0 0 348 1087A15 15 0 0 0 363 1102Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="389" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="453,1087 441,1092 441,1083" style="fill:rgb(0,0,0)"/>
<path d="M430,1087L447,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,1102L502,1102L502,1072L453,1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="525,1087 513,1092 513,1083" style="fill:rgb(0,0,0)"/>
<path d="M502,1087L519,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1140A15 15 0 0 0 378 1125A15 15 0 0 0 363 1110A15 15 0 0 0 348 1125A15 15 0 0 0 363 1140Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="1125" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="401,1125 390,1129 390,1121" style="fill:rgb(0,0,0)"/>
<path d="M378,1125L396,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,1140L451,1140L451,1110L401,1110Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="1125" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="312,1057 301,1061 301,1053" style="fill:rgb(0,0,0)"/>
<path d="M289,1057L306,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1125 337,1129 337,1121" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1110 Q 327,1125 335,1125 L 342,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1087 337,1092 337,1083" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1072 Q 327,1087 335,1087 L 342,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1057 513,1061 513,1053" style="fill:rgb(0,0,0)"/>
<path d="M312,1057L519,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="620,1155 609,1160 609,1151" style="fill:rgb(0,0,0)"/>
<path d="M525,1057 L 546,1057 Q 561,1057 561,1072 L 561,1140 Q 561,1155 576,1155 L 599,1155 L 614,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="624" cy="1155" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1087 L 546,1087 Q 561,1087 561,1095 L 561,1102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1125 513,1129 513,1121" style="fill:rgb(0,0,0)"/>
<path d="M451,1125L519,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1125 L 546,1125 Q 561,1125 561,1133 L 561,1140"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1155 513,1160 513,1151" style="fill:rgb(0,0,0)"/>
<path d="M127,1042 L 127,1140 Q 127,1155 142,1155 L 504,1155 L 519,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1155L597,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/common-table-expression.html">common-table-expression:</a></b>
<button id='x80a5adc9' onclick='hideorshow("x80a5adc9","xaaf92061")'>show</button></p>
 <div id='xaaf92061' style='display:none;' class='imgcontainer'>
 <div style="max-width:638px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 638.525 167.4">
<circle cx="5" cy="29" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,29 20,33 20,24" style="fill:rgb(0,0,0)"/>
<path d="M9,29L26,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,44L122,44A15 15 0 0 0 137 29A15 15 0 0 0 122 14L47,14A15 15 0 0 0 32 29A15 15 0 0 0 47 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="160,29 149,33 149,24" style="fill:rgb(0,0,0)"/>
<path d="M137,29L155,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="196,29 185,33 185,24" style="fill:rgb(0,0,0)"/>
<path d="M160,29L191,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,44A15 15 0 0 0 227 29A15 15 0 0 0 211 14A15 15 0 0 0 196 29A15 15 0 0 0 211 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="250,29 238,33 238,24" style="fill:rgb(0,0,0)"/>
<path d="M227,29L244,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="286,29 274,33 274,24" style="fill:rgb(0,0,0)"/>
<path d="M250,29L280,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,44L395,44A15 15 0 0 0 410 29A15 15 0 0 0 395 14L301,14A15 15 0 0 0 286 29A15 15 0 0 0 301 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="446,29 434,33 434,24" style="fill:rgb(0,0,0)"/>
<path d="M410,29L440,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,44A15 15 0 0 0 476 29A15 15 0 0 0 461 14A15 15 0 0 0 446 29A15 15 0 0 0 461 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,29 499,33 499,24" style="fill:rgb(0,0,0)"/>
<path d="M476,29L505,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,165L51,165A15 15 0 0 0 66 150A15 15 0 0 0 51 135L47,135A15 15 0 0 0 32 150A15 15 0 0 0 47 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="49" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<path d="M127,135L147,135A15 15 0 0 0 162 119A15 15 0 0 0 147 104L127,104A15 15 0 0 0 112 119A15 15 0 0 0 127 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<path d="M219,135L337,135A15 15 0 0 0 352 119A15 15 0 0 0 337 104L219,104A15 15 0 0 0 204 119A15 15 0 0 0 219 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<path d="M162,119L204,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,165A15 15 0 0 0 425 150A15 15 0 0 0 410 135A15 15 0 0 0 395 150A15 15 0 0 0 410 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="410" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="448,150 437,154 437,145" style="fill:rgb(0,0,0)"/>
<path d="M425,150L442,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,165L552,165L552,135L448,135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="500" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="575,150 564,154 564,145" style="fill:rgb(0,0,0)"/>
<path d="M552,150L570,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M591,165A15 15 0 0 0 606 150A15 15 0 0 0 591 135A15 15 0 0 0 575 150A15 15 0 0 0 591 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="629,150 617,154 617,145" style="fill:rgb(0,0,0)"/>
<path d="M606,150L623,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="632" cy="150" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,82A15 15 0 0 0 363 66A15 15 0 0 0 348 51A15 15 0 0 0 333 66A15 15 0 0 0 348 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="363,66 374,62 374,71" style="fill:rgb(0,0,0)"/>
<path d="M410,29 L 417,29 Q 425,29 425,44 L 425,51 Q 425,66 410,66 L 384,66 L 369,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M333,66 L 278,66 Q 263,66 263,51 L 263,44 Q 263,29 270,29 L 278,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,93 78,89 78,97" style="fill:rgb(0,0,0)"/>
<path d="M511,29 L 516,29 Q 522,29 522,44 L 522,78 Q 522,93 507,93 L 87,93 L 72,93"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,150 20,154 20,145" style="fill:rgb(0,0,0)"/>
<path d="M66,93 L 30,93 Q 15,93 15,108 L 15,135 Q 15,150 20,150 L 26,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="85,150 73,154 73,145" style="fill:rgb(0,0,0)"/>
<path d="M66,150L79,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="112,119 101,124 101,115" style="fill:rgb(0,0,0)"/>
<path d="M85,150 L 89,150 Q 92,150 92,135 L 92,134 Q 92,119 99,119 L 106,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="204,119 192,124 192,115" style="fill:rgb(0,0,0)"/>
<path d="M66,150 L 147,150 Q 162,150 170,150 Q 177,150 177,135 L 177,134 Q 177,119 188,119 L 198,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,150 383,154 383,145" style="fill:rgb(0,0,0)"/>
<path d="M352,119 L 360,119 Q 367,119 367,134 L 367,135 Q 367,150 378,150 L 389,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150L395,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,6 336,10 336,2" style="fill:rgb(0,0,0)"/>
<path d="M160,29 L 168,29 Q 175,29 175,17 Q 175,6 190,6 L 327,6 L 342,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,6 L 473,6 Q 488,6 488,17 Q 488,29 495,29 L 503,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/compound-operator.html">compound-operator:</a></b>
<button id='x5badc419' onclick='hideorshow("x5badc419","x73654b85")'>show</button></p>
 <div id='x73654b85' style='display:none;' class='imgcontainer'>
 <div style="max-width:293px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 293.842 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L127,32A15 15 0 0 0 142 17A15 15 0 0 0 127 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,70L127,70A15 15 0 0 0 142 55L142,55A15 15 0 0 0 127 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,108L168,108A15 15 0 0 0 183 92A15 15 0 0 0 168 77L83,77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M83,145L135,145A15 15 0 0 0 150 130A15 15 0 0 0 135 115L83,115A15 15 0 0 0 68 130A15 15 0 0 0 83 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M142,55L159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70L195,70A15 15 0 0 0 210 55L210,55A15 15 0 0 0 195 39L180,39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="233,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M210,55L227,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,17 272,21 272,12" style="fill:rgb(0,0,0)"/>
<path d="M233,55 L 240,55 Q 248,55 248,40 L 248,32 Q 248,17 263,17 L 263,17 L 278,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="288" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M47,39 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,92 221,97 221,88" style="fill:rgb(0,0,0)"/>
<path d="M183,92L227,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,92 L 240,92 Q 248,92 248,77 L 248,54 L 248,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,130 56,135 56,126" style="fill:rgb(0,0,0)"/>
<path d="M47,77 L 47,115 Q 47,130 55,130 L 62,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,130 221,135 221,126" style="fill:rgb(0,0,0)"/>
<path d="M150,130L227,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,130 L 240,130 Q 248,130 248,115 L 248,92 L 248,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-clause.html">join-clause:</a></b>
<button id='x62ed156d' onclick='hideorshow("x62ed156d","xbb92e110")'>show</button></p>
 <div id='xbb92e110' style='display:none;' class='imgcontainer'>
 <div style="max-width:793px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 793.282 84.24">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L193,32L193,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="259,47 247,51 247,43" style="fill:rgb(0,0,0)"/>
<path d="M193,17 L 200,17 Q 208,17 208,32 L 208,32 Q 208,47 223,47 L 238,47 L 253,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,62L380,62L380,32L259,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-operator</text>
<polygon points="403,47 391,51 391,43" style="fill:rgb(0,0,0)"/>
<path d="M380,47L397,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,62L564,62L564,32L403,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="587,47 575,51 575,43" style="fill:rgb(0,0,0)"/>
<path d="M564,47L581,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M587,62L721,62L721,32L587,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="654" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-constraint</text>
<polygon points="783,17 772,21 772,12" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 742,47 Q 757,47 757,32 L 757,32 Q 757,17 767,17 L 778,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="787" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M193,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,17L776,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,77 495,73 495,82" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 728,47 Q 736,47 736,62 L 736,62 Q 736,77 721,77 L 504,77 L 489,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,77 L 247,77 Q 232,77 232,62 L 232,62 Q 232,47 246,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/join-constraint.html">join-constraint:</a></b>
<button id='x612fe06b' onclick='hideorshow("x612fe06b","xa18db209")'>show</button></p>
 <div id='xa18db209' style='display:none;' class='imgcontainer'>
 <div style="max-width:483px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 483.336 126.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L104,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 104 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="143,55 131,59 131,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L137,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,70A15 15 0 0 0 173 55L173,55A15 15 0 0 0 158 39A15 15 0 0 0 143 55L143,55A15 15 0 0 0 158 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="209,55 197,59 197,50" style="fill:rgb(0,0,0)"/>
<path d="M173,55L203,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M224,70L318,70A15 15 0 0 0 333 55L333,55A15 15 0 0 0 318 39L224,39A15 15 0 0 0 209 55L209,55A15 15 0 0 0 224 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="369,55 358,59 358,50" style="fill:rgb(0,0,0)"/>
<path d="M333,55L363,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,70A15 15 0 0 0 399 55L399,55A15 15 0 0 0 384 39A15 15 0 0 0 369 55L369,55A15 15 0 0 0 384 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="422,55 411,59 411,50" style="fill:rgb(0,0,0)"/>
<path d="M399,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="473,17 462,21 462,12" style="fill:rgb(0,0,0)"/>
<path d="M422,55 L 430,55 Q 437,55 437,40 L 437,32 Q 437,17 452,17 L 453,17 L 468,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="477" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,108A15 15 0 0 0 286 92A15 15 0 0 0 271 77A15 15 0 0 0 256 92A15 15 0 0 0 271 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="286,92 298,88 298,97" style="fill:rgb(0,0,0)"/>
<path d="M333,55 L 341,55 Q 348,55 348,70 L 348,77 Q 348,92 333,92 L 307,92 L 292,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,92 L 197,92 Q 182,92 182,77 L 182,70 Q 182,55 190,55 L 197,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L74,32A15 15 0 0 0 90 17A15 15 0 0 0 74 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="113,17 101,21 101,12" style="fill:rgb(0,0,0)"/>
<path d="M90,17L107,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M113,32L162,32L162,2L113,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="422,17 411,21 411,12" style="fill:rgb(0,0,0)"/>
<path d="M162,17L417,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,17L462,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="209,120 197,124 197,115" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,105 Q 24,120 39,120 L 188,120 L 203,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,120 L 422,120 Q 437,120 437,105 L 437,54 L 437,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-operator.html">join-operator:</a></b>
<button id='x16f046d7' onclick='hideorshow("x16f046d7","x69cda082")'>show</button></p>
 <div id='x69cda082' style='display:none;' class='imgcontainer'>
 <div style="max-width:620px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 620.333 255.312">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,71 39,76 39,67" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,56 Q 24,71 34,71 L 45,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,86L133,86A15 15 0 0 0 148 71A15 15 0 0 0 133 56L66,56A15 15 0 0 0 50 71A15 15 0 0 0 66 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="99" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NATURAL</text>
<polygon points="189,41 178,45 178,37" style="fill:rgb(0,0,0)"/>
<path d="M148,71 L 155,71 Q 163,71 163,56 L 163,56 Q 163,41 173,41 L 184,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,71 219,76 219,67" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,56 Q 204,71 215,71 L 225,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,86L273,86A15 15 0 0 0 288 71A15 15 0 0 0 273 56L246,56A15 15 0 0 0 231 71A15 15 0 0 0 246 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LEFT</text>
<polygon points="378,71 366,76 366,67" style="fill:rgb(0,0,0)"/>
<path d="M288,71L372,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,86L437,86A15 15 0 0 0 452 71A15 15 0 0 0 437 56L393,56A15 15 0 0 0 378 71A15 15 0 0 0 393 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OUTER</text>
<polygon points="475,71 463,76 463,67" style="fill:rgb(0,0,0)"/>
<path d="M452,71L469,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="516,41 505,45 505,37" style="fill:rgb(0,0,0)"/>
<path d="M475,71 L 482,71 Q 490,71 490,56 L 490,56 Q 490,41 500,41 L 511,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,56L554,56A15 15 0 0 0 569 41A15 15 0 0 0 554 26L532,26A15 15 0 0 0 516 41A15 15 0 0 0 532 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="543" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">JOIN</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M569,41 L 576,41 Q 584,41 584,29 Q 584,17 594,17 L 605,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="614" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,32A15 15 0 0 0 325 17A15 15 0 0 0 310 2A15 15 0 0 0 295 17A15 15 0 0 0 310 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="295,17 283,21 283,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L289,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M325,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="99,41 88,45 88,37" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,29 Q 24,41 39,41 L 78,41 L 93,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M99,41L178,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,41L505,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,41 366,45 366,37" style="fill:rgb(0,0,0)"/>
<path d="M336,71 L 344,71 Q 351,71 351,56 L 351,56 Q 351,41 362,41 L 372,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,109 219,113 219,105" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,94 Q 204,109 215,109 L 225,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,124L284,124A15 15 0 0 0 299 109A15 15 0 0 0 284 94L246,94A15 15 0 0 0 231 109A15 15 0 0 0 246 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RIGHT</text>
<polygon points="341,71 329,76 329,67" style="fill:rgb(0,0,0)"/>
<path d="M299,109 L 307,109 Q 314,109 314,94 L 314,86 Q 314,71 324,71 L 335,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,147 219,151 219,142" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,132 Q 204,147 215,147 L 225,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,162L274,162A15 15 0 0 0 289 147A15 15 0 0 0 274 132L246,132A15 15 0 0 0 231 147A15 15 0 0 0 246 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FULL</text>
<path d="M289,147 L 302,147 Q 314,147 314,132 L 314,109 L 314,94"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,192 219,196 219,188" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,177 Q 204,192 215,192 L 225,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,207L287,207A15 15 0 0 0 302 192A15 15 0 0 0 287 177L246,177A15 15 0 0 0 231 192A15 15 0 0 0 246 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="192" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INNER</text>
<polygon points="475,192 463,196 463,188" style="fill:rgb(0,0,0)"/>
<path d="M302,192L469,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,192 L 482,192 Q 490,192 490,185 L 490,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,238 219,242 219,233" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,223 Q 24,238 39,238 L 210,238 L 225,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,253L287,253A15 15 0 0 0 303 238A15 15 0 0 0 287 222L246,222A15 15 0 0 0 231 238A15 15 0 0 0 246 253Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="238" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CROSS</text>
<polygon points="475,238 463,242 463,233" style="fill:rgb(0,0,0)"/>
<path d="M303,238L469,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,238 L 482,238 Q 490,238 490,223 L 490,71 L 490,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='xfd9e665b' onclick='hideorshow("xfd9e665b","xec6a7759")'>show</button></p>
 <div id='xec6a7759' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/result-column.html">result-column:</a></b>
<button id='x09f6168a' onclick='hideorshow("x09f6168a","x0bf0b990")'>show</button></p>
 <div id='x0bf0b990' style='display:none;' class='imgcontainer'>
 <div style="max-width:398px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 398.054 163.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L94,32L94,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="136,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M94,17 L 102,17 Q 109,17 109,32 L 109,40 Q 109,55 119,55 L 130,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M151,70L155,70A15 15 0 0 0 170 55L170,55A15 15 0 0 0 155 39L151,39A15 15 0 0 0 136 55L136,55A15 15 0 0 0 151 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="206,55 194,59 194,50" style="fill:rgb(0,0,0)"/>
<path d="M170,55L200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,70L309,70A15 15 0 0 0 324 55L324,55A15 15 0 0 0 309 39L221,39A15 15 0 0 0 206 55L206,55A15 15 0 0 0 221 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="347,55 335,59 335,50" style="fill:rgb(0,0,0)"/>
<path d="M324,55L341,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,17 377,21 377,12" style="fill:rgb(0,0,0)"/>
<path d="M347,55 L 354,55 Q 362,55 362,40 L 362,32 Q 362,17 372,17 L 382,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="392" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,85 141,89 141,81" style="fill:rgb(0,0,0)"/>
<path d="M109,39 L 109,70 Q 109,85 124,85 L 132,85 L 147,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,85 L 170,85 Q 185,85 185,70 L 185,70 Q 185,55 192,55 L 200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="241,17 230,21 230,12" style="fill:rgb(0,0,0)"/>
<path d="M94,17L235,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M241,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,108 39,112 39,103" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,93 Q 24,108 34,108 L 45,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,123A15 15 0 0 0 81 108A15 15 0 0 0 66 92A15 15 0 0 0 50 108A15 15 0 0 0 66 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="108" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,108 335,112 335,103" style="fill:rgb(0,0,0)"/>
<path d="M81,108L341,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,108 L 354,108 Q 362,108 362,93 L 362,54 L 362,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,145 39,150 39,141" style="fill:rgb(0,0,0)"/>
<path d="M24,92 L 24,130 Q 24,145 34,145 L 45,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,160L141,160A15 15 0 0 0 156 145A15 15 0 0 0 141 130L66,130A15 15 0 0 0 50 145A15 15 0 0 0 66 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="145" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="179,145 167,150 167,141" style="fill:rgb(0,0,0)"/>
<path d="M156,145L173,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M194,160A15 15 0 0 0 209 145A15 15 0 0 0 194 130A15 15 0 0 0 179 145A15 15 0 0 0 194 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="232,145 221,150 221,141" style="fill:rgb(0,0,0)"/>
<path d="M209,145L226,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,160A15 15 0 0 0 262 145A15 15 0 0 0 247 130A15 15 0 0 0 232 145A15 15 0 0 0 247 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,145 335,150 335,141" style="fill:rgb(0,0,0)"/>
<path d="M262,145L341,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,145 L 354,145 Q 362,145 362,130 L 362,107 L 362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/table-or-subquery.html">table-or-subquery:</a></b>
<button id='x2740da05' onclick='hideorshow("x2740da05","x91f88d19")'>show</button></p>
 <div id='x91f88d19' style='display:none;' class='imgcontainer'>
 <div style="max-width:720px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 720.778 457.704">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,74 39,78 39,70" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,59 Q 24,74 34,74 L 45,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,89L162,89A15 15 0 0 0 177 74L177,74A15 15 0 0 0 162 59L66,59A15 15 0 0 0 50 74L50,74A15 15 0 0 0 66 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="194,74 183,78 183,70" style="fill:rgb(0,0,0)"/>
<path d="M177,74L189,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,89A15 15 0 0 0 225 74L225,74A15 15 0 0 0 209 59A15 15 0 0 0 194 74L194,74A15 15 0 0 0 209 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="266,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M225,74 L 232,74 Q 240,74 240,59 L 240,51 Q 240,36 250,36 L 260,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,51L356,51A15 15 0 0 0 371 36A15 15 0 0 0 356 21L281,21A15 15 0 0 0 266 36A15 15 0 0 0 281 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="407,36 396,41 396,32" style="fill:rgb(0,0,0)"/>
<path d="M371,36L402,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,51L427,51A15 15 0 0 0 442 36A15 15 0 0 0 427 21L423,21A15 15 0 0 0 407 36A15 15 0 0 0 423 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="478,36 466,41 466,32" style="fill:rgb(0,0,0)"/>
<path d="M442,36L472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,51L561,51A15 15 0 0 0 577 36A15 15 0 0 0 561 21L493,21A15 15 0 0 0 478 36A15 15 0 0 0 493 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="527" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<path d="M9,36L255,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="422,6 411,10 411,2" style="fill:rgb(0,0,0)"/>
<path d="M371,36 L 379,36 Q 386,36 386,21 L 386,21 Q 386,6 401,6 L 402,6 L 417,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 442,6 Q 457,6 457,21 L 457,21 Q 457,36 464,36 L 472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 577,6 Q 592,6 592,21 L 592,21 Q 592,36 599,36 L 607,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,127L388,127A15 15 0 0 0 403 112A15 15 0 0 0 388 97L323,97A15 15 0 0 0 308 112A15 15 0 0 0 323 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="426,112 415,116 415,108" style="fill:rgb(0,0,0)"/>
<path d="M403,112L420,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,127L445,127A15 15 0 0 0 460 112A15 15 0 0 0 445 97L441,97A15 15 0 0 0 426 112A15 15 0 0 0 441 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="443" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="483,112 472,116 472,108" style="fill:rgb(0,0,0)"/>
<path d="M460,112L478,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,127L577,127A15 15 0 0 0 592 112A15 15 0 0 0 577 97L499,97A15 15 0 0 0 483 112A15 15 0 0 0 499 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="538" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M323,165L343,165A15 15 0 0 0 359 150A15 15 0 0 0 343 135L323,135A15 15 0 0 0 308 150A15 15 0 0 0 323 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="382,150 370,154 370,145" style="fill:rgb(0,0,0)"/>
<path d="M359,150L376,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,165L461,165A15 15 0 0 0 476 150A15 15 0 0 0 461 135L397,135A15 15 0 0 0 382 150A15 15 0 0 0 397 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="527,74 539,70 539,78" style="fill:rgb(0,0,0)"/>
<path d="M577,36 L 607,36 Q 622,36 622,51 L 622,59 Q 622,74 607,74 L 548,74 L 533,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,150 297,154 297,145" style="fill:rgb(0,0,0)"/>
<path d="M527,74 L 297,74 Q 282,74 282,89 L 282,135 Q 282,150 292,150 L 302,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,112 297,116 297,108" style="fill:rgb(0,0,0)"/>
<path d="M282,97 L 282,104 Q 282,112 292,112 L 302,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="266,213 255,217 255,209" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,198 Q 24,213 39,213 L 245,213 L 260,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,228L431,228A15 15 0 0 0 446 213A15 15 0 0 0 431 198L281,198A15 15 0 0 0 266 213A15 15 0 0 0 281 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function-name</text>
<polygon points="463,213 452,217 452,209" style="fill:rgb(0,0,0)"/>
<path d="M446,213L457,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,228A15 15 0 0 0 493 213A15 15 0 0 0 478 198A15 15 0 0 0 463 213A15 15 0 0 0 478 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="529,213 518,217 518,209" style="fill:rgb(0,0,0)"/>
<path d="M493,213L524,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M529,228L579,228L579,198L529,198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="615,213 603,217 603,209" style="fill:rgb(0,0,0)"/>
<path d="M579,213L609,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M630,228A15 15 0 0 0 645 213A15 15 0 0 0 630 198A15 15 0 0 0 615 213A15 15 0 0 0 630 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="630" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="675,187 679,198 671,198" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 660,213 Q 675,213 675,203 L 675,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M554,190A15 15 0 0 0 569 175A15 15 0 0 0 554 160A15 15 0 0 0 539 175A15 15 0 0 0 554 190Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="175" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="569,175 581,171 581,180" style="fill:rgb(0,0,0)"/>
<path d="M579,213 L 586,213 Q 594,213 594,198 L 594,190 Q 594,175 584,175 L 575,175"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,175 L 518,175 Q 503,175 503,190 L 503,198 Q 503,213 510,213 L 518,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,74 L 232,74 Q 240,74 240,89 L 240,198 Q 240,213 247,213 L 255,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,112 648,116 648,108" style="fill:rgb(0,0,0)"/>
<path d="M592,112L654,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,112 L 667,112 Q 675,112 675,104 L 675,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,150 648,154 648,145" style="fill:rgb(0,0,0)"/>
<path d="M476,150L654,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,150 L 667,150 Q 675,150 675,142 L 675,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M577,36L690,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,304L411,304A15 15 0 0 0 426 289A15 15 0 0 0 411 274L407,274A15 15 0 0 0 392 289A15 15 0 0 0 407 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="498,289 487,293 487,284" style="fill:rgb(0,0,0)"/>
<path d="M426,289L492,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M513,304L582,304A15 15 0 0 0 597 289A15 15 0 0 0 582 274L513,274A15 15 0 0 0 498 289A15 15 0 0 0 513 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="548" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<polygon points="660,289 648,293 648,284" style="fill:rgb(0,0,0)"/>
<path d="M597,289L654,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,289 L 667,289 Q 675,289 675,281 L 675,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="548,251 559,247 559,255" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 652,213 Q 660,213 660,228 L 660,236 Q 660,251 645,251 L 568,251 L 553,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M548,251 L 370,251 Q 355,251 355,266 L 355,274 Q 355,289 370,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,251 L 464,251 Q 457,251 457,266 L 457,274 Q 457,289 464,289 L 472,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,327 39,331 39,322" style="fill:rgb(0,0,0)"/>
<path d="M24,198 L 24,312 Q 24,327 34,327 L 45,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,342A15 15 0 0 0 81 327A15 15 0 0 0 66 311A15 15 0 0 0 50 327A15 15 0 0 0 66 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,327 92,331 92,322" style="fill:rgb(0,0,0)"/>
<path d="M81,327L98,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,342L208,342L208,311L104,311Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="327" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="231,327 219,331 219,322" style="fill:rgb(0,0,0)"/>
<path d="M208,327L225,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,342A15 15 0 0 0 261 327A15 15 0 0 0 246 311A15 15 0 0 0 231 327A15 15 0 0 0 246 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M261,327 L 269,327 Q 276,327 276,312 L 276,304 Q 276,289 291,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,327 648,331 648,322" style="fill:rgb(0,0,0)"/>
<path d="M261,327L654,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,327 L 667,327 Q 675,327 675,319 L 675,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,327 L 432,327 Q 439,327 439,312 L 439,304 Q 439,289 447,289 L 454,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,364 39,369 39,360" style="fill:rgb(0,0,0)"/>
<path d="M24,311 L 24,349 Q 24,364 34,364 L 45,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,379A15 15 0 0 0 81 364A15 15 0 0 0 65 349A15 15 0 0 0 50 364A15 15 0 0 0 65 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="135,364 123,369 123,360" style="fill:rgb(0,0,0)"/>
<path d="M81,364L129,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,379L296,379L296,349L135,349Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="364" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="350,364 338,369 338,360" style="fill:rgb(0,0,0)"/>
<path d="M296,364L344,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,379A15 15 0 0 0 380 364A15 15 0 0 0 365 349A15 15 0 0 0 350 364A15 15 0 0 0 365 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="660,364 648,369 648,360" style="fill:rgb(0,0,0)"/>
<path d="M380,364L654,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="711,36 699,41 699,32" style="fill:rgb(0,0,0)"/>
<path d="M660,364 L 667,364 Q 675,364 675,349 L 675,51 Q 675,36 690,36 L 690,36 L 705,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="715" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,417A15 15 0 0 0 230 402A15 15 0 0 0 215 387A15 15 0 0 0 200 402A15 15 0 0 0 215 417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="402" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="230,402 242,398 242,406" style="fill:rgb(0,0,0)"/>
<path d="M296,364 L 303,364 Q 311,364 311,379 L 311,387 Q 311,402 296,402 L 251,402 L 236,402"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,402 L 123,402 Q 108,402 108,387 L 108,379 Q 108,364 116,364 L 123,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="122,440 111,444 111,436" style="fill:rgb(0,0,0)"/>
<path d="M81,364 L 88,364 Q 96,364 96,379 L 96,425 Q 96,440 106,440 L 116,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M122,455L224,455L224,425L122,425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M224,440 L 308,440 Q 323,440 323,425 L 323,379 Q 323,364 331,364 L 338,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/window-defn.html">window-defn:</a></b>
<button id='xff26d74e' onclick='hideorshow("xff26d74e","xd364d5ac")'>show</button></p>
 <div id='xd364d5ac' style='display:none;' class='imgcontainer'>
 <div style="max-width:479px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 479.765 380.592">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,44 92,48 92,40" style="fill:rgb(0,0,0)"/>
<path d="M62,17 L 70,17 Q 77,17 77,30 Q 77,44 88,44 L 98,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,59L260,59A15 15 0 0 0 275 44L275,44A15 15 0 0 0 260 29L119,29A15 15 0 0 0 104 44L104,44A15 15 0 0 0 119 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M119,135L198,135A15 15 0 0 0 214 120A15 15 0 0 0 198 104L119,104A15 15 0 0 0 104 120A15 15 0 0 0 119 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="237,120 225,124 225,115" style="fill:rgb(0,0,0)"/>
<path d="M214,120L231,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M252,135L256,135A15 15 0 0 0 271 120A15 15 0 0 0 256 104L252,104A15 15 0 0 0 237 120A15 15 0 0 0 252 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="307,120 295,124 295,115" style="fill:rgb(0,0,0)"/>
<path d="M271,120L301,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,135L356,135L356,104L307,104Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M332,173A15 15 0 0 0 347 157A15 15 0 0 0 332 142A15 15 0 0 0 316 157A15 15 0 0 0 332 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="157" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="347,157 358,153 358,162" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,142 Q 371,157 362,157 L 352,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,157 L 295,157 Q 280,157 280,142 L 280,135 Q 280,120 288,120 L 295,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,17 178,21 178,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L184,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,82 201,77 201,86" style="fill:rgb(0,0,0)"/>
<path d="M190,17 L 298,17 Q 313,17 313,32 L 313,67 Q 313,82 298,82 L 210,82 L 195,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,120 92,124 92,115" style="fill:rgb(0,0,0)"/>
<path d="M190,82 L 77,82 Q 62,82 62,97 L 62,105 Q 62,120 77,120 L 83,120 L 98,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,44 287,48 287,40" style="fill:rgb(0,0,0)"/>
<path d="M275,44L293,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,44 L 306,44 Q 313,44 313,51 L 313,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,248L163,248A15 15 0 0 0 178 233A15 15 0 0 0 163 218L119,218A15 15 0 0 0 104 233A15 15 0 0 0 119 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="201,233 190,237 190,229" style="fill:rgb(0,0,0)"/>
<path d="M178,233L196,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,248L221,248A15 15 0 0 0 236 233A15 15 0 0 0 221 218L217,218A15 15 0 0 0 201 233A15 15 0 0 0 217 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="272,233 260,237 260,229" style="fill:rgb(0,0,0)"/>
<path d="M236,233L266,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,248L402,248L402,218L272,218Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M337,286A15 15 0 0 0 352 271A15 15 0 0 0 337 256A15 15 0 0 0 322 271A15 15 0 0 0 337 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="352,271 363,266 363,275" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,256 Q 417,271 402,271 L 373,271 L 358,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M322,271 L 260,271 Q 245,271 245,256 L 245,248 Q 245,233 253,233 L 260,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,195 201,191 201,200" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,180 Q 371,195 356,195 L 210,195 L 195,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,233 92,237 92,229" style="fill:rgb(0,0,0)"/>
<path d="M190,195 L 77,195 Q 62,195 62,210 L 62,218 Q 62,233 77,233 L 83,233 L 98,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,157 58,146 66,146" style="fill:rgb(0,0,0)"/>
<path d="M62,104L62,152"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,157L62,218"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,362L208,362L208,331L104,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="417,346 405,351 405,342" style="fill:rgb(0,0,0)"/>
<path d="M208,346L411,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,362A15 15 0 0 0 447 346A15 15 0 0 0 432 331A15 15 0 0 0 417 346A15 15 0 0 0 432 362Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="470,346 458,351 458,342" style="fill:rgb(0,0,0)"/>
<path d="M447,346L464,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="474" cy="346" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,309 201,304 201,313" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,294 Q 417,309 402,309 L 210,309 L 195,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,346 92,351 92,342" style="fill:rgb(0,0,0)"/>
<path d="M190,309 L 77,309 Q 62,309 62,324 L 62,331 Q 62,346 77,346 L 83,346 L 98,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,271 58,259 66,259" style="fill:rgb(0,0,0)"/>
<path d="M62,218L62,265"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,271L62,331"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,374 144,378 144,369" style="fill:rgb(0,0,0)"/>
<path d="M62,331 L 62,359 Q 62,374 77,374 L 135,374 L 150,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,346 266,351 266,342" style="fill:rgb(0,0,0)"/>
<path d="M156,374 L 233,374 Q 248,374 248,360 Q 248,346 260,346 L 272,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x212c491e' onclick='hideorshow("x212c491e","x57b5c8f6")'>show</button></p>
 <div id='x57b5c8f6' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/update-stmt.html">update-stmt:</a></b>
<button id='x7b066b17' onclick='hideorshow("x7b066b17","xf45e8d2e")'>show</button></p>
 <div id='xf45e8d2e' style='display:none;' class='imgcontainer'>
 <div style="max-width:623px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 623.266 721.926">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L91,32A15 15 0 0 0 106 17A15 15 0 0 0 91 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M166,62L252,62A15 15 0 0 0 267 47L267,47A15 15 0 0 0 252 32L166,32A15 15 0 0 0 151 47L151,47A15 15 0 0 0 166 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="209,17 197,21 197,12" style="fill:rgb(0,0,0)"/>
<path d="M106,17L203,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M209,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M357,32L583,32L583,2L357,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="151,47 139,51 139,43" style="fill:rgb(0,0,0)"/>
<path d="M106,17 L 113,17 Q 121,17 121,32 L 121,32 Q 121,47 133,47 L 145,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,47 278,51 278,43" style="fill:rgb(0,0,0)"/>
<path d="M267,47L284,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,47 L 297,47 Q 305,47 305,32 L 305,32 Q 305,17 320,17 L 330,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,70A15 15 0 0 0 485 55L485,55A15 15 0 0 0 470 39A15 15 0 0 0 455 55L455,55A15 15 0 0 0 470 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="485,55 497,50 497,59" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,40 Q 598,55 583,55 L 506,55 L 491,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,55 L 349,55 Q 334,55 334,40 L 334,32 Q 334,17 340,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="294,83 306,79 306,88" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,68 Q 598,83 583,83 L 315,83 L 300,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="24,53 20,41 28,41" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,32 L 24,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,136L114,136A15 15 0 0 0 129 121A15 15 0 0 0 114 106L60,106A15 15 0 0 0 45 121A15 15 0 0 0 60 136Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="121" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="45,121 33,125 33,116" style="fill:rgb(0,0,0)"/>
<path d="M24,53 L 24,106 Q 24,121 31,121 L 39,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,83 L 39,83 Q 24,83 24,91 L 24,98"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,299 159,303 159,295" style="fill:rgb(0,0,0)"/>
<path d="M129,121 L 137,121 Q 144,121 144,136 L 144,284 Q 144,299 155,299 L 165,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,314L193,314A15 15 0 0 0 208 299A15 15 0 0 0 193 284L186,284A15 15 0 0 0 171 299A15 15 0 0 0 186 314Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="299" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,299 214,303 214,295" style="fill:rgb(0,0,0)"/>
<path d="M208,299L219,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,314L318,314A15 15 0 0 0 333 299A15 15 0 0 0 318 284L240,284A15 15 0 0 0 225 299A15 15 0 0 0 240 314Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="279" y="299" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="350,299 339,303 339,295" style="fill:rgb(0,0,0)"/>
<path d="M333,299L344,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,121 380,125 380,116" style="fill:rgb(0,0,0)"/>
<path d="M350,299 L 358,299 Q 365,299 365,284 L 365,136 Q 365,121 376,121 L 386,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M392,136L576,136L576,106L392,106Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="121" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">qualified-table-name</text>
<path d="M186,276L193,276A15 15 0 0 0 208 261A15 15 0 0 0 193 246L186,246A15 15 0 0 0 171 261A15 15 0 0 0 186 276Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="261" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,261 214,266 214,257" style="fill:rgb(0,0,0)"/>
<path d="M208,261L219,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,276L304,276A15 15 0 0 0 319 261A15 15 0 0 0 304 246L240,246A15 15 0 0 0 225 261A15 15 0 0 0 240 276Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="261" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<polygon points="350,261 339,266 339,257" style="fill:rgb(0,0,0)"/>
<path d="M319,261L344,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,261 L 358,261 Q 365,261 365,254 L 365,246"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,261 159,266 159,257" style="fill:rgb(0,0,0)"/>
<path d="M144,246 L 144,254 Q 144,261 155,261 L 165,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,239L193,239A15 15 0 0 0 208 224A15 15 0 0 0 193 208L186,208A15 15 0 0 0 171 224A15 15 0 0 0 186 239Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="224" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,224 214,228 214,219" style="fill:rgb(0,0,0)"/>
<path d="M208,224L219,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,239L292,239A15 15 0 0 0 307 224A15 15 0 0 0 292 208L240,208A15 15 0 0 0 225 224A15 15 0 0 0 240 239Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="266" y="224" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="350,224 339,228 339,219" style="fill:rgb(0,0,0)"/>
<path d="M307,224L344,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,224 L 358,224 Q 365,224 365,216 L 365,209"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,224 159,228 159,219" style="fill:rgb(0,0,0)"/>
<path d="M144,208 L 144,216 Q 144,224 155,224 L 165,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,201L193,201A15 15 0 0 0 208 186A15 15 0 0 0 193 171L186,171A15 15 0 0 0 171 186A15 15 0 0 0 186 201Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="186" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,186 214,190 214,181" style="fill:rgb(0,0,0)"/>
<path d="M208,186L219,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,201L262,201A15 15 0 0 0 277 186A15 15 0 0 0 262 171L240,171A15 15 0 0 0 225 186A15 15 0 0 0 240 201Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="186" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="350,186 339,190 339,181" style="fill:rgb(0,0,0)"/>
<path d="M277,186L344,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,186 L 358,186 Q 365,186 365,178 L 365,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,186 159,190 159,181" style="fill:rgb(0,0,0)"/>
<path d="M144,171 L 144,178 Q 144,186 155,186 L 165,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,163L193,163A15 15 0 0 0 208 148A15 15 0 0 0 193 133L186,133A15 15 0 0 0 171 148A15 15 0 0 0 186 163Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="148" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,148 214,152 214,144" style="fill:rgb(0,0,0)"/>
<path d="M208,148L219,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,163L282,163A15 15 0 0 0 297 148A15 15 0 0 0 282 133L240,133A15 15 0 0 0 225 148A15 15 0 0 0 240 163Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="148" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="350,148 339,152 339,144" style="fill:rgb(0,0,0)"/>
<path d="M297,148L344,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,148 L 358,148 Q 365,148 365,140 L 365,133"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,148 159,152 159,144" style="fill:rgb(0,0,0)"/>
<path d="M144,133 L 144,140 Q 144,148 155,148 L 165,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="350,121 339,125 339,116" style="fill:rgb(0,0,0)"/>
<path d="M129,121L344,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,121L380,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,375 39,379 39,370" style="fill:rgb(0,0,0)"/>
<path d="M576,121 L 584,121 Q 591,121 591,136 L 591,322 Q 591,337 576,337 L 39,337 Q 24,337 24,352 L 24,360 Q 24,375 34,375 L 45,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,390L81,390A15 15 0 0 0 96 375A15 15 0 0 0 81 360L65,360A15 15 0 0 0 50 375A15 15 0 0 0 65 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="73" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="153,413 141,417 141,408" style="fill:rgb(0,0,0)"/>
<path d="M96,375 L 111,375 Q 126,375 126,390 L 126,398 Q 126,413 136,413 L 147,413"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,428L309,428L309,397L153,397Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="413" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name-list</text>
<polygon points="350,375 339,379 339,370" style="fill:rgb(0,0,0)"/>
<path d="M309,413 L 316,413 Q 324,413 324,398 L 324,390 Q 324,375 334,375 L 344,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,390A15 15 0 0 0 380 375A15 15 0 0 0 365 360A15 15 0 0 0 350 375A15 15 0 0 0 365 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="375" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">=</text>
<polygon points="404,375 392,379 392,370" style="fill:rgb(0,0,0)"/>
<path d="M380,375L398,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,390L453,390L453,360L404,360Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="428" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="153,375 141,379 141,370" style="fill:rgb(0,0,0)"/>
<path d="M96,375L147,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,390L262,390A15 15 0 0 0 277 375A15 15 0 0 0 262 360L168,360A15 15 0 0 0 153 375A15 15 0 0 0 168 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<path d="M277,375L339,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M251,465A15 15 0 0 0 266 450A15 15 0 0 0 251 435A15 15 0 0 0 236 450A15 15 0 0 0 251 465Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="450" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="266,450 277,446 277,455" style="fill:rgb(0,0,0)"/>
<path d="M453,375 L 460,375 Q 468,375 468,390 L 468,435 Q 468,450 453,450 L 287,450 L 272,450"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,450 L 117,450 Q 102,450 102,435 L 102,390 Q 102,375 117,375 L 117,375 L 132,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="251,488 262,484 262,492" style="fill:rgb(0,0,0)"/>
<path d="M453,375 L 460,375 Q 468,375 468,390 L 468,473 Q 468,488 453,488 L 271,488 L 256,488"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M251,488 L 39,488 Q 24,488 24,503 L 24,511 Q 24,526 37,526 L 50,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,541L100,541A15 15 0 0 0 115 526A15 15 0 0 0 100 511L65,511A15 15 0 0 0 50 526A15 15 0 0 0 65 541Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="526" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="187,526 176,530 176,522" style="fill:rgb(0,0,0)"/>
<path d="M115,526L182,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,541L348,541L348,511L187,511Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="526" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M268,579A15 15 0 0 0 283 564A15 15 0 0 0 268 549A15 15 0 0 0 253 564A15 15 0 0 0 268 579Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="564" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="283,564 295,559 295,568" style="fill:rgb(0,0,0)"/>
<path d="M348,526 L 356,526 Q 363,526 363,541 L 363,549 Q 363,564 348,564 L 304,564 L 289,564"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M253,564 L 176,564 Q 161,564 161,549 L 161,541 Q 161,526 168,526 L 176,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="187,602 176,606 176,597" style="fill:rgb(0,0,0)"/>
<path d="M115,526 L 123,526 Q 130,526 130,541 L 130,587 Q 130,602 145,602 L 167,602 L 182,602"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,617L290,617L290,586L187,586Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="239" y="602" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<polygon points="405,526 393,530 393,522" style="fill:rgb(0,0,0)"/>
<path d="M290,602 L 363,602 Q 378,602 378,587 L 378,541 Q 378,526 389,526 L 399,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="244,639 255,635 255,644" style="fill:rgb(0,0,0)"/>
<path d="M405,526 L 412,526 Q 420,526 420,541 L 420,624 Q 420,639 405,639 L 265,639 L 250,639"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,526L393,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,677 39,681 39,673" style="fill:rgb(0,0,0)"/>
<path d="M244,639 L 39,639 Q 24,639 24,654 L 24,662 Q 24,677 34,677 L 45,677"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,692L115,692A15 15 0 0 0 130 677A15 15 0 0 0 115 662L66,662A15 15 0 0 0 50 677A15 15 0 0 0 66 692Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="90" y="677" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="153,677 142,681 142,673" style="fill:rgb(0,0,0)"/>
<path d="M130,677L147,677"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,692L202,692L202,662L153,662Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="178" y="677" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="24,586 20,575 28,575" style="fill:rgb(0,0,0)"/>
<path d="M24,511L24,581"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M24,586L24,662"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="613,715 602,719 602,711" style="fill:rgb(0,0,0)"/>
<path d="M24,662 L 24,700 Q 24,715 39,715 L 593,715 L 608,715"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="617" cy="715" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="253,715 242,719 242,711" style="fill:rgb(0,0,0)"/>
<path d="M202,677 L 210,677 Q 217,677 217,692 L 217,700 Q 217,715 232,715 L 233,715 L 248,715"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,677 283,681 283,673" style="fill:rgb(0,0,0)"/>
<path d="M253,715 L 261,715 Q 268,715 268,700 L 268,692 Q 268,677 279,677 L 289,677"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,692L446,692L446,662L295,662Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="370" y="677" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">returning-clause</text>
<polygon points="497,715 485,719 485,711" style="fill:rgb(0,0,0)"/>
<path d="M446,677 L 453,677 Q 461,677 461,692 L 461,700 Q 461,715 476,715 L 476,715 L 491,715"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/column-name-list.html">column-name-list:</a></b>
<button id='xb748bc57' onclick='hideorshow("xb748bc57","x830cc8b6")'>show</button></p>
 <div id='x830cc8b6' style='display:none;' class='imgcontainer'>
 <div style="max-width:353px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 353.621 72.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="85,17 74,21 74,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L79,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,17 110,21 110,12" style="fill:rgb(0,0,0)"/>
<path d="M85,17L115,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,32L230,32A15 15 0 0 0 245 17A15 15 0 0 0 230 2L136,2A15 15 0 0 0 121 17A15 15 0 0 0 136 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="290,17 279,21 279,12" style="fill:rgb(0,0,0)"/>
<path d="M245,17L285,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M306,32A15 15 0 0 0 321 17A15 15 0 0 0 306 2A15 15 0 0 0 290 17A15 15 0 0 0 306 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="306" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="344,17 332,21 332,12" style="fill:rgb(0,0,0)"/>
<path d="M321,17L338,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="347" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M183,70A15 15 0 0 0 198 55L198,55A15 15 0 0 0 183 39A15 15 0 0 0 168 55L168,55A15 15 0 0 0 183 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="198,55 210,50 210,59" style="fill:rgb(0,0,0)"/>
<path d="M245,17 L 257,17 Q 269,17 269,32 L 269,40 Q 269,55 254,55 L 219,55 L 204,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,17 110,21 110,12" style="fill:rgb(0,0,0)"/>
<path d="M168,55 L 102,55 Q 87,55 87,40 L 87,32 Q 87,17 101,17 L 115,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/common-table-expression.html">common-table-expression:</a></b>
<button id='xd2882eba' onclick='hideorshow("xd2882eba","x55cc6de8")'>show</button></p>
 <div id='x55cc6de8' style='display:none;' class='imgcontainer'>
 <div style="max-width:638px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 638.525 167.4">
<circle cx="5" cy="29" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,29 20,33 20,24" style="fill:rgb(0,0,0)"/>
<path d="M9,29L26,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,44L122,44A15 15 0 0 0 137 29A15 15 0 0 0 122 14L47,14A15 15 0 0 0 32 29A15 15 0 0 0 47 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="160,29 149,33 149,24" style="fill:rgb(0,0,0)"/>
<path d="M137,29L155,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="196,29 185,33 185,24" style="fill:rgb(0,0,0)"/>
<path d="M160,29L191,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,44A15 15 0 0 0 227 29A15 15 0 0 0 211 14A15 15 0 0 0 196 29A15 15 0 0 0 211 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="250,29 238,33 238,24" style="fill:rgb(0,0,0)"/>
<path d="M227,29L244,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="286,29 274,33 274,24" style="fill:rgb(0,0,0)"/>
<path d="M250,29L280,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,44L395,44A15 15 0 0 0 410 29A15 15 0 0 0 395 14L301,14A15 15 0 0 0 286 29A15 15 0 0 0 301 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="446,29 434,33 434,24" style="fill:rgb(0,0,0)"/>
<path d="M410,29L440,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,44A15 15 0 0 0 476 29A15 15 0 0 0 461 14A15 15 0 0 0 446 29A15 15 0 0 0 461 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,29 499,33 499,24" style="fill:rgb(0,0,0)"/>
<path d="M476,29L505,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,165L51,165A15 15 0 0 0 66 150A15 15 0 0 0 51 135L47,135A15 15 0 0 0 32 150A15 15 0 0 0 47 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="49" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<path d="M127,135L147,135A15 15 0 0 0 162 119A15 15 0 0 0 147 104L127,104A15 15 0 0 0 112 119A15 15 0 0 0 127 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<path d="M219,135L337,135A15 15 0 0 0 352 119A15 15 0 0 0 337 104L219,104A15 15 0 0 0 204 119A15 15 0 0 0 219 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<path d="M162,119L204,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,165A15 15 0 0 0 425 150A15 15 0 0 0 410 135A15 15 0 0 0 395 150A15 15 0 0 0 410 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="410" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="448,150 437,154 437,145" style="fill:rgb(0,0,0)"/>
<path d="M425,150L442,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,165L552,165L552,135L448,135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="500" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="575,150 564,154 564,145" style="fill:rgb(0,0,0)"/>
<path d="M552,150L570,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M591,165A15 15 0 0 0 606 150A15 15 0 0 0 591 135A15 15 0 0 0 575 150A15 15 0 0 0 591 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="629,150 617,154 617,145" style="fill:rgb(0,0,0)"/>
<path d="M606,150L623,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="632" cy="150" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,82A15 15 0 0 0 363 66A15 15 0 0 0 348 51A15 15 0 0 0 333 66A15 15 0 0 0 348 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="363,66 374,62 374,71" style="fill:rgb(0,0,0)"/>
<path d="M410,29 L 417,29 Q 425,29 425,44 L 425,51 Q 425,66 410,66 L 384,66 L 369,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M333,66 L 278,66 Q 263,66 263,51 L 263,44 Q 263,29 270,29 L 278,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,93 78,89 78,97" style="fill:rgb(0,0,0)"/>
<path d="M511,29 L 516,29 Q 522,29 522,44 L 522,78 Q 522,93 507,93 L 87,93 L 72,93"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,150 20,154 20,145" style="fill:rgb(0,0,0)"/>
<path d="M66,93 L 30,93 Q 15,93 15,108 L 15,135 Q 15,150 20,150 L 26,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="85,150 73,154 73,145" style="fill:rgb(0,0,0)"/>
<path d="M66,150L79,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="112,119 101,124 101,115" style="fill:rgb(0,0,0)"/>
<path d="M85,150 L 89,150 Q 92,150 92,135 L 92,134 Q 92,119 99,119 L 106,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="204,119 192,124 192,115" style="fill:rgb(0,0,0)"/>
<path d="M66,150 L 147,150 Q 162,150 170,150 Q 177,150 177,135 L 177,134 Q 177,119 188,119 L 198,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,150 383,154 383,145" style="fill:rgb(0,0,0)"/>
<path d="M352,119 L 360,119 Q 367,119 367,134 L 367,135 Q 367,150 378,150 L 389,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150L395,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,6 336,10 336,2" style="fill:rgb(0,0,0)"/>
<path d="M160,29 L 168,29 Q 175,29 175,17 Q 175,6 190,6 L 327,6 L 342,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,6 L 473,6 Q 488,6 488,17 Q 488,29 495,29 L 503,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-clause.html">join-clause:</a></b>
<button id='x612889dc' onclick='hideorshow("x612889dc","xe3599c62")'>show</button></p>
 <div id='xe3599c62' style='display:none;' class='imgcontainer'>
 <div style="max-width:793px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 793.282 84.24">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L193,32L193,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="259,47 247,51 247,43" style="fill:rgb(0,0,0)"/>
<path d="M193,17 L 200,17 Q 208,17 208,32 L 208,32 Q 208,47 223,47 L 238,47 L 253,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,62L380,62L380,32L259,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-operator</text>
<polygon points="403,47 391,51 391,43" style="fill:rgb(0,0,0)"/>
<path d="M380,47L397,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,62L564,62L564,32L403,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="587,47 575,51 575,43" style="fill:rgb(0,0,0)"/>
<path d="M564,47L581,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M587,62L721,62L721,32L587,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="654" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-constraint</text>
<polygon points="783,17 772,21 772,12" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 742,47 Q 757,47 757,32 L 757,32 Q 757,17 767,17 L 778,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="787" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M193,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,17L776,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,77 495,73 495,82" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 728,47 Q 736,47 736,62 L 736,62 Q 736,77 721,77 L 504,77 L 489,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,77 L 247,77 Q 232,77 232,62 L 232,62 Q 232,47 246,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/join-constraint.html">join-constraint:</a></b>
<button id='x724d36c9' onclick='hideorshow("x724d36c9","x88b01523")'>show</button></p>
 <div id='x88b01523' style='display:none;' class='imgcontainer'>
 <div style="max-width:483px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 483.336 126.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L104,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 104 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="143,55 131,59 131,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L137,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,70A15 15 0 0 0 173 55L173,55A15 15 0 0 0 158 39A15 15 0 0 0 143 55L143,55A15 15 0 0 0 158 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="209,55 197,59 197,50" style="fill:rgb(0,0,0)"/>
<path d="M173,55L203,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M224,70L318,70A15 15 0 0 0 333 55L333,55A15 15 0 0 0 318 39L224,39A15 15 0 0 0 209 55L209,55A15 15 0 0 0 224 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="369,55 358,59 358,50" style="fill:rgb(0,0,0)"/>
<path d="M333,55L363,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,70A15 15 0 0 0 399 55L399,55A15 15 0 0 0 384 39A15 15 0 0 0 369 55L369,55A15 15 0 0 0 384 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="422,55 411,59 411,50" style="fill:rgb(0,0,0)"/>
<path d="M399,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="473,17 462,21 462,12" style="fill:rgb(0,0,0)"/>
<path d="M422,55 L 430,55 Q 437,55 437,40 L 437,32 Q 437,17 452,17 L 453,17 L 468,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="477" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,108A15 15 0 0 0 286 92A15 15 0 0 0 271 77A15 15 0 0 0 256 92A15 15 0 0 0 271 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="286,92 298,88 298,97" style="fill:rgb(0,0,0)"/>
<path d="M333,55 L 341,55 Q 348,55 348,70 L 348,77 Q 348,92 333,92 L 307,92 L 292,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,92 L 197,92 Q 182,92 182,77 L 182,70 Q 182,55 190,55 L 197,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L74,32A15 15 0 0 0 90 17A15 15 0 0 0 74 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="113,17 101,21 101,12" style="fill:rgb(0,0,0)"/>
<path d="M90,17L107,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M113,32L162,32L162,2L113,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="422,17 411,21 411,12" style="fill:rgb(0,0,0)"/>
<path d="M162,17L417,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,17L462,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="209,120 197,124 197,115" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,105 Q 24,120 39,120 L 188,120 L 203,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,120 L 422,120 Q 437,120 437,105 L 437,54 L 437,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-operator.html">join-operator:</a></b>
<button id='x7418cb6f' onclick='hideorshow("x7418cb6f","xa33fee55")'>show</button></p>
 <div id='xa33fee55' style='display:none;' class='imgcontainer'>
 <div style="max-width:620px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 620.333 255.312">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,71 39,76 39,67" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,56 Q 24,71 34,71 L 45,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,86L133,86A15 15 0 0 0 148 71A15 15 0 0 0 133 56L66,56A15 15 0 0 0 50 71A15 15 0 0 0 66 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="99" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NATURAL</text>
<polygon points="189,41 178,45 178,37" style="fill:rgb(0,0,0)"/>
<path d="M148,71 L 155,71 Q 163,71 163,56 L 163,56 Q 163,41 173,41 L 184,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,71 219,76 219,67" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,56 Q 204,71 215,71 L 225,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,86L273,86A15 15 0 0 0 288 71A15 15 0 0 0 273 56L246,56A15 15 0 0 0 231 71A15 15 0 0 0 246 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LEFT</text>
<polygon points="378,71 366,76 366,67" style="fill:rgb(0,0,0)"/>
<path d="M288,71L372,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,86L437,86A15 15 0 0 0 452 71A15 15 0 0 0 437 56L393,56A15 15 0 0 0 378 71A15 15 0 0 0 393 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OUTER</text>
<polygon points="475,71 463,76 463,67" style="fill:rgb(0,0,0)"/>
<path d="M452,71L469,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="516,41 505,45 505,37" style="fill:rgb(0,0,0)"/>
<path d="M475,71 L 482,71 Q 490,71 490,56 L 490,56 Q 490,41 500,41 L 511,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,56L554,56A15 15 0 0 0 569 41A15 15 0 0 0 554 26L532,26A15 15 0 0 0 516 41A15 15 0 0 0 532 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="543" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">JOIN</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M569,41 L 576,41 Q 584,41 584,29 Q 584,17 594,17 L 605,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="614" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,32A15 15 0 0 0 325 17A15 15 0 0 0 310 2A15 15 0 0 0 295 17A15 15 0 0 0 310 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="295,17 283,21 283,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L289,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M325,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="99,41 88,45 88,37" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,29 Q 24,41 39,41 L 78,41 L 93,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M99,41L178,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,41L505,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,41 366,45 366,37" style="fill:rgb(0,0,0)"/>
<path d="M336,71 L 344,71 Q 351,71 351,56 L 351,56 Q 351,41 362,41 L 372,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,109 219,113 219,105" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,94 Q 204,109 215,109 L 225,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,124L284,124A15 15 0 0 0 299 109A15 15 0 0 0 284 94L246,94A15 15 0 0 0 231 109A15 15 0 0 0 246 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RIGHT</text>
<polygon points="341,71 329,76 329,67" style="fill:rgb(0,0,0)"/>
<path d="M299,109 L 307,109 Q 314,109 314,94 L 314,86 Q 314,71 324,71 L 335,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,147 219,151 219,142" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,132 Q 204,147 215,147 L 225,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,162L274,162A15 15 0 0 0 289 147A15 15 0 0 0 274 132L246,132A15 15 0 0 0 231 147A15 15 0 0 0 246 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FULL</text>
<path d="M289,147 L 302,147 Q 314,147 314,132 L 314,109 L 314,94"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,192 219,196 219,188" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,177 Q 204,192 215,192 L 225,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,207L287,207A15 15 0 0 0 302 192A15 15 0 0 0 287 177L246,177A15 15 0 0 0 231 192A15 15 0 0 0 246 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="192" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INNER</text>
<polygon points="475,192 463,196 463,188" style="fill:rgb(0,0,0)"/>
<path d="M302,192L469,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,192 L 482,192 Q 490,192 490,185 L 490,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,238 219,242 219,233" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,223 Q 24,238 39,238 L 210,238 L 225,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,253L287,253A15 15 0 0 0 303 238A15 15 0 0 0 287 222L246,222A15 15 0 0 0 231 238A15 15 0 0 0 246 253Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="238" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CROSS</text>
<polygon points="475,238 463,242 463,233" style="fill:rgb(0,0,0)"/>
<path d="M303,238L469,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,238 L 482,238 Q 490,238 490,223 L 490,71 L 490,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/qualified-table-name.html">qualified-table-name:</a></b>
<button id='x96153f7f' onclick='hideorshow("x96153f7f","xce01d406")'>show</button></p>
 <div id='xce01d406' style='display:none;' class='imgcontainer'>
 <div style="max-width:599px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 599.746 182.736">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L156,32A15 15 0 0 0 171 17A15 15 0 0 0 156 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,17 183,21 183,12" style="fill:rgb(0,0,0)"/>
<path d="M171,17L189,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,32A15 15 0 0 0 225 17A15 15 0 0 0 210 2A15 15 0 0 0 195 17A15 15 0 0 0 210 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,17 249,21 249,12" style="fill:rgb(0,0,0)"/>
<path d="M225,17L255,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,32L351,32A15 15 0 0 0 366 17A15 15 0 0 0 351 2L276,2A15 15 0 0 0 261 17A15 15 0 0 0 276 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="408,44 396,48 396,40" style="fill:rgb(0,0,0)"/>
<path d="M366,17 L 374,17 Q 381,17 381,30 Q 381,44 392,44 L 402,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,59L427,59A15 15 0 0 0 442 44L442,44A15 15 0 0 0 427 29L423,29A15 15 0 0 0 408 44L408,44A15 15 0 0 0 423 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="465,44 453,48 453,40" style="fill:rgb(0,0,0)"/>
<path d="M442,44L459,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,59L501,59A15 15 0 0 0 516 44L516,44A15 15 0 0 0 501 29L480,29A15 15 0 0 0 465 44L465,44A15 15 0 0 0 480 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="490" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">alias</text>
<polygon points="539,44 527,48 527,40" style="fill:rgb(0,0,0)"/>
<path d="M516,44L533,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,44 L 546,44 Q 554,44 554,51 L 554,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="453,17 442,21 442,12" style="fill:rgb(0,0,0)"/>
<path d="M366,17L448,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,44 97,48 97,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 39,44 L 87,44 L 102,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M108,44 L 225,44 Q 240,44 240,30 Q 240,17 247,17 L 255,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,142L301,142A15 15 0 0 0 316 127A15 15 0 0 0 301 112L236,112A15 15 0 0 0 221 127A15 15 0 0 0 236 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="339,127 327,131 327,123" style="fill:rgb(0,0,0)"/>
<path d="M316,127L333,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,142L358,142A15 15 0 0 0 373 127A15 15 0 0 0 358 112L354,112A15 15 0 0 0 339 127A15 15 0 0 0 354 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="396,127 385,131 385,123" style="fill:rgb(0,0,0)"/>
<path d="M373,127L390,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M411,142L490,142A15 15 0 0 0 505 127A15 15 0 0 0 490 112L411,112A15 15 0 0 0 396 127A15 15 0 0 0 411 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="451" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M236,180L256,180A15 15 0 0 0 271 165A15 15 0 0 0 256 150L236,150A15 15 0 0 0 221 165A15 15 0 0 0 236 180Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="165" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="294,165 283,169 283,161" style="fill:rgb(0,0,0)"/>
<path d="M271,165L289,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,180L374,180A15 15 0 0 0 389 165A15 15 0 0 0 374 150L310,150A15 15 0 0 0 294 165A15 15 0 0 0 310 180Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="342" y="165" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="554,74 550,62 558,62" style="fill:rgb(0,0,0)"/>
<path d="M453,17 L 539,17 Q 554,17 554,32 L 554,53 L 554,68"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 325,85 325,94" style="fill:rgb(0,0,0)"/>
<path d="M554,74 L 554,82 Q 554,89 539,89 L 334,89 L 319,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="221,127 210,131 210,123" style="fill:rgb(0,0,0)"/>
<path d="M313,89 L 210,89 Q 195,89 195,104 L 195,112 Q 195,127 205,127 L 215,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="221,165 210,169 210,161" style="fill:rgb(0,0,0)"/>
<path d="M195,112 L 195,150 Q 195,165 205,165 L 215,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="554,114 550,102 558,102" style="fill:rgb(0,0,0)"/>
<path d="M554,74L554,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="590,165 578,169 578,161" style="fill:rgb(0,0,0)"/>
<path d="M554,114 L 554,150 Q 554,165 569,165 L 569,165 L 584,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="593" cy="165" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="539,127 527,131 527,123" style="fill:rgb(0,0,0)"/>
<path d="M505,127L533,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,127 L 546,127 Q 554,127 554,135 L 554,142"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M389,165L578,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/returning-clause.html">returning-clause:</a></b>
<button id='x14ada6c5' onclick='hideorshow("x14ada6c5","xd02b7129")'>show</button></p>
 <div id='xd02b7129' style='display:none;' class='imgcontainer'>
 <div style="max-width:628px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 628.709 140.4">
<circle cx="5" cy="47" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="27,47 15,51 15,43" style="fill:rgb(0,0,0)"/>
<path d="M9,47L21,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M42,62L132,62A15 15 0 0 0 147 47A15 15 0 0 0 132 32L42,32A15 15 0 0 0 27 47A15 15 0 0 0 42 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RETURNING</text>
<polygon points="237,47 226,51 226,43" style="fill:rgb(0,0,0)"/>
<path d="M147,47L232,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M237,62L287,62L287,32L237,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="262" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="328,77 317,82 317,73" style="fill:rgb(0,0,0)"/>
<path d="M287,47 L 294,47 Q 302,47 302,62 L 302,62 Q 302,77 312,77 L 322,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M343,92L347,92A15 15 0 0 0 362 77L362,77A15 15 0 0 0 347 62L343,62A15 15 0 0 0 328 77L328,77A15 15 0 0 0 343 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="398,77 387,82 387,73" style="fill:rgb(0,0,0)"/>
<path d="M362,77L393,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M414,92L501,92A15 15 0 0 0 516 77L516,77A15 15 0 0 0 501 62L414,62A15 15 0 0 0 398 77L398,77A15 15 0 0 0 414 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="457" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="539,77 528,82 528,73" style="fill:rgb(0,0,0)"/>
<path d="M516,77L534,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="581,47 569,51 569,43" style="fill:rgb(0,0,0)"/>
<path d="M539,77 L 547,77 Q 554,77 554,62 L 554,62 Q 554,47 565,47 L 575,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="619,47 607,51 607,43" style="fill:rgb(0,0,0)"/>
<path d="M581,47L613,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="622" cy="47" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="345,101 334,106 334,97" style="fill:rgb(0,0,0)"/>
<path d="M302,62 L 302,86 Q 302,101 317,101 L 325,101 L 340,101"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,101 L 362,101 Q 377,101 377,89 Q 377,77 385,77 L 392,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="453,47 441,51 441,43" style="fill:rgb(0,0,0)"/>
<path d="M287,47L447,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,47L607,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,138A15 15 0 0 0 406 123A15 15 0 0 0 391 108A15 15 0 0 0 376 123A15 15 0 0 0 391 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="391" y="123" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="376,123 365,127 365,118" style="fill:rgb(0,0,0)"/>
<path d="M147,47 L 196,47 Q 211,47 211,62 L 211,108 Q 211,123 226,123 L 355,123 L 370,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="539,123 528,127 528,118" style="fill:rgb(0,0,0)"/>
<path d="M406,123L534,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,123 L 547,123 Q 554,123 554,108 L 554,77 L 554,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,32A15 15 0 0 0 406 17A15 15 0 0 0 391 2A15 15 0 0 0 376 17A15 15 0 0 0 391 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="391" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="406,17 418,12 418,21" style="fill:rgb(0,0,0)"/>
<path d="M581,47 L 588,47 Q 596,47 596,32 L 596,32 Q 596,17 581,17 L 427,17 L 412,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="186,47 174,51 174,43" style="fill:rgb(0,0,0)"/>
<path d="M376,17 L 174,17 Q 159,17 159,32 L 159,32 Q 159,47 169,47 L 180,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/table-or-subquery.html">table-or-subquery:</a></b>
<button id='xaae61d7a' onclick='hideorshow("xaae61d7a","x5dba123d")'>show</button></p>
 <div id='x5dba123d' style='display:none;' class='imgcontainer'>
 <div style="max-width:720px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 720.778 457.704">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,74 39,78 39,70" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,59 Q 24,74 34,74 L 45,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,89L162,89A15 15 0 0 0 177 74L177,74A15 15 0 0 0 162 59L66,59A15 15 0 0 0 50 74L50,74A15 15 0 0 0 66 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="194,74 183,78 183,70" style="fill:rgb(0,0,0)"/>
<path d="M177,74L189,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,89A15 15 0 0 0 225 74L225,74A15 15 0 0 0 209 59A15 15 0 0 0 194 74L194,74A15 15 0 0 0 209 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="266,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M225,74 L 232,74 Q 240,74 240,59 L 240,51 Q 240,36 250,36 L 260,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,51L356,51A15 15 0 0 0 371 36A15 15 0 0 0 356 21L281,21A15 15 0 0 0 266 36A15 15 0 0 0 281 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="407,36 396,41 396,32" style="fill:rgb(0,0,0)"/>
<path d="M371,36L402,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,51L427,51A15 15 0 0 0 442 36A15 15 0 0 0 427 21L423,21A15 15 0 0 0 407 36A15 15 0 0 0 423 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="478,36 466,41 466,32" style="fill:rgb(0,0,0)"/>
<path d="M442,36L472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,51L561,51A15 15 0 0 0 577 36A15 15 0 0 0 561 21L493,21A15 15 0 0 0 478 36A15 15 0 0 0 493 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="527" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<path d="M9,36L255,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="422,6 411,10 411,2" style="fill:rgb(0,0,0)"/>
<path d="M371,36 L 379,36 Q 386,36 386,21 L 386,21 Q 386,6 401,6 L 402,6 L 417,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 442,6 Q 457,6 457,21 L 457,21 Q 457,36 464,36 L 472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 577,6 Q 592,6 592,21 L 592,21 Q 592,36 599,36 L 607,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,127L388,127A15 15 0 0 0 403 112A15 15 0 0 0 388 97L323,97A15 15 0 0 0 308 112A15 15 0 0 0 323 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="426,112 415,116 415,108" style="fill:rgb(0,0,0)"/>
<path d="M403,112L420,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,127L445,127A15 15 0 0 0 460 112A15 15 0 0 0 445 97L441,97A15 15 0 0 0 426 112A15 15 0 0 0 441 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="443" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="483,112 472,116 472,108" style="fill:rgb(0,0,0)"/>
<path d="M460,112L478,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,127L577,127A15 15 0 0 0 592 112A15 15 0 0 0 577 97L499,97A15 15 0 0 0 483 112A15 15 0 0 0 499 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="538" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M323,165L343,165A15 15 0 0 0 359 150A15 15 0 0 0 343 135L323,135A15 15 0 0 0 308 150A15 15 0 0 0 323 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="382,150 370,154 370,145" style="fill:rgb(0,0,0)"/>
<path d="M359,150L376,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,165L461,165A15 15 0 0 0 476 150A15 15 0 0 0 461 135L397,135A15 15 0 0 0 382 150A15 15 0 0 0 397 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="527,74 539,70 539,78" style="fill:rgb(0,0,0)"/>
<path d="M577,36 L 607,36 Q 622,36 622,51 L 622,59 Q 622,74 607,74 L 548,74 L 533,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,150 297,154 297,145" style="fill:rgb(0,0,0)"/>
<path d="M527,74 L 297,74 Q 282,74 282,89 L 282,135 Q 282,150 292,150 L 302,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,112 297,116 297,108" style="fill:rgb(0,0,0)"/>
<path d="M282,97 L 282,104 Q 282,112 292,112 L 302,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="266,213 255,217 255,209" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,198 Q 24,213 39,213 L 245,213 L 260,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,228L431,228A15 15 0 0 0 446 213A15 15 0 0 0 431 198L281,198A15 15 0 0 0 266 213A15 15 0 0 0 281 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function-name</text>
<polygon points="463,213 452,217 452,209" style="fill:rgb(0,0,0)"/>
<path d="M446,213L457,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,228A15 15 0 0 0 493 213A15 15 0 0 0 478 198A15 15 0 0 0 463 213A15 15 0 0 0 478 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="529,213 518,217 518,209" style="fill:rgb(0,0,0)"/>
<path d="M493,213L524,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M529,228L579,228L579,198L529,198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="615,213 603,217 603,209" style="fill:rgb(0,0,0)"/>
<path d="M579,213L609,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M630,228A15 15 0 0 0 645 213A15 15 0 0 0 630 198A15 15 0 0 0 615 213A15 15 0 0 0 630 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="630" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="675,187 679,198 671,198" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 660,213 Q 675,213 675,203 L 675,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M554,190A15 15 0 0 0 569 175A15 15 0 0 0 554 160A15 15 0 0 0 539 175A15 15 0 0 0 554 190Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="175" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="569,175 581,171 581,180" style="fill:rgb(0,0,0)"/>
<path d="M579,213 L 586,213 Q 594,213 594,198 L 594,190 Q 594,175 584,175 L 575,175"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,175 L 518,175 Q 503,175 503,190 L 503,198 Q 503,213 510,213 L 518,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,74 L 232,74 Q 240,74 240,89 L 240,198 Q 240,213 247,213 L 255,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,112 648,116 648,108" style="fill:rgb(0,0,0)"/>
<path d="M592,112L654,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,112 L 667,112 Q 675,112 675,104 L 675,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,150 648,154 648,145" style="fill:rgb(0,0,0)"/>
<path d="M476,150L654,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,150 L 667,150 Q 675,150 675,142 L 675,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M577,36L690,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,304L411,304A15 15 0 0 0 426 289A15 15 0 0 0 411 274L407,274A15 15 0 0 0 392 289A15 15 0 0 0 407 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="498,289 487,293 487,284" style="fill:rgb(0,0,0)"/>
<path d="M426,289L492,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M513,304L582,304A15 15 0 0 0 597 289A15 15 0 0 0 582 274L513,274A15 15 0 0 0 498 289A15 15 0 0 0 513 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="548" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<polygon points="660,289 648,293 648,284" style="fill:rgb(0,0,0)"/>
<path d="M597,289L654,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,289 L 667,289 Q 675,289 675,281 L 675,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="548,251 559,247 559,255" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 652,213 Q 660,213 660,228 L 660,236 Q 660,251 645,251 L 568,251 L 553,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M548,251 L 370,251 Q 355,251 355,266 L 355,274 Q 355,289 370,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,251 L 464,251 Q 457,251 457,266 L 457,274 Q 457,289 464,289 L 472,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,327 39,331 39,322" style="fill:rgb(0,0,0)"/>
<path d="M24,198 L 24,312 Q 24,327 34,327 L 45,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,342A15 15 0 0 0 81 327A15 15 0 0 0 66 311A15 15 0 0 0 50 327A15 15 0 0 0 66 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,327 92,331 92,322" style="fill:rgb(0,0,0)"/>
<path d="M81,327L98,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,342L208,342L208,311L104,311Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="327" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="231,327 219,331 219,322" style="fill:rgb(0,0,0)"/>
<path d="M208,327L225,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,342A15 15 0 0 0 261 327A15 15 0 0 0 246 311A15 15 0 0 0 231 327A15 15 0 0 0 246 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M261,327 L 269,327 Q 276,327 276,312 L 276,304 Q 276,289 291,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,327 648,331 648,322" style="fill:rgb(0,0,0)"/>
<path d="M261,327L654,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,327 L 667,327 Q 675,327 675,319 L 675,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,327 L 432,327 Q 439,327 439,312 L 439,304 Q 439,289 447,289 L 454,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,364 39,369 39,360" style="fill:rgb(0,0,0)"/>
<path d="M24,311 L 24,349 Q 24,364 34,364 L 45,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,379A15 15 0 0 0 81 364A15 15 0 0 0 65 349A15 15 0 0 0 50 364A15 15 0 0 0 65 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="135,364 123,369 123,360" style="fill:rgb(0,0,0)"/>
<path d="M81,364L129,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,379L296,379L296,349L135,349Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="364" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="350,364 338,369 338,360" style="fill:rgb(0,0,0)"/>
<path d="M296,364L344,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,379A15 15 0 0 0 380 364A15 15 0 0 0 365 349A15 15 0 0 0 350 364A15 15 0 0 0 365 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="660,364 648,369 648,360" style="fill:rgb(0,0,0)"/>
<path d="M380,364L654,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="711,36 699,41 699,32" style="fill:rgb(0,0,0)"/>
<path d="M660,364 L 667,364 Q 675,364 675,349 L 675,51 Q 675,36 690,36 L 690,36 L 705,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="715" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,417A15 15 0 0 0 230 402A15 15 0 0 0 215 387A15 15 0 0 0 200 402A15 15 0 0 0 215 417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="402" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="230,402 242,398 242,406" style="fill:rgb(0,0,0)"/>
<path d="M296,364 L 303,364 Q 311,364 311,379 L 311,387 Q 311,402 296,402 L 251,402 L 236,402"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,402 L 123,402 Q 108,402 108,387 L 108,379 Q 108,364 116,364 L 123,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="122,440 111,444 111,436" style="fill:rgb(0,0,0)"/>
<path d="M81,364 L 88,364 Q 96,364 96,379 L 96,425 Q 96,440 106,440 L 116,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M122,455L224,455L224,425L122,425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M224,440 L 308,440 Q 323,440 323,425 L 323,379 Q 323,364 331,364 L 338,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>



<h1 id="description"><span>2. </span>Description</h1>
<p>The CREATE TRIGGER statement is used to add triggers to the 
database schema. Triggers are database operations 
that are automatically performed when a specified database event
occurs.  </p>

<p>Each trigger must specify that it will fire for one of
the following operations: <a href="lang_delete.html">DELETE</a>, <a href="lang_insert.html">INSERT</a>, <a href="lang_update.html">UPDATE</a>.
The trigger fires once for each row that is deleted, inserted,
or updated.  If the "UPDATE OF <span class='yyterm'>column-name</span>"
syntax is used, then the trigger will only fire if
<span class='yyterm'>column-name</span> appears on the left-hand side of
one of the terms in the SET clause of the <a href="lang_update.html">UPDATE</a> statement.</p>

<p>Due to an historical oversight, columns named in the "UPDATE OF"
clause do not actually have to exist in the table being updated.
Unrecognized column names are silently ignored.
It would be more helpful if SQLite would fail the CREATE TRIGGER
statement if any of the names in the "UPDATE OF" clause are not
columns in the table.  However, as this problem was discovered
many years after SQLite was widely deployed, we have resisted
fixing the problem for fear of breaking legacy applications.</p>

<p>At this time SQLite supports only FOR EACH ROW triggers, not FOR EACH
STATEMENT triggers. Hence explicitly specifying FOR EACH ROW is optional.
FOR EACH ROW implies that the SQL statements specified in the trigger
may be executed (depending on the WHEN clause) for each database row being
inserted, updated or deleted by the statement causing the trigger to fire.</p>

<p>Both the WHEN clause and the trigger actions may access elements of 
the row being inserted, deleted or updated using references of the form 
"NEW.<i>column-name</i>" and "OLD.<i>column-name</i>", where
<i>column-name</i> is the name of a column from the table that the trigger
is associated with. OLD and NEW references may only be used in triggers on
events for which they are relevant, as follows:</p>

<table border="0" cellpadding="10">
<tr>
<td valign="top" align="right" width="120"><i>INSERT</i></td>
<td valign="top">NEW references are valid</td>
</tr>
<tr>
<td valign="top" align="right" width="120"><i>UPDATE</i></td>
<td valign="top">NEW and OLD references are valid</td>
</tr>
<tr>
<td valign="top" align="right" width="120"><i>DELETE</i></td>
<td valign="top">OLD references are valid</td>
</tr>
</table>


<p>If a WHEN clause is supplied, the SQL statements specified
are only executed if the WHEN clause is true.
If no WHEN clause is supplied, the SQL statements
are executed every time the trigger fires.</p>

<p>The BEFORE or AFTER keyword determines when the trigger actions
will be executed relative to the insertion, modification or removal of the
associated row.  BEFORE is the default when neither keyword is present.</p>

<p>An <a href="lang_conflict.html">ON CONFLICT</a> clause may be specified as part of an <a href="lang_update.html">UPDATE</a> or <a href="lang_insert.html">INSERT</a>
action within the body of the trigger.
However if an <a href="lang_conflict.html">ON CONFLICT</a> clause is specified as part of 
the statement causing the trigger to fire, then conflict handling
policy of the outer statement is used instead.</p>

<p>Triggers are automatically <a href="lang_droptrigger.html">dropped</a>
when the table that they are 
associated with (the <i>table-name</i> table) is 
<a href="lang_droptable.html">dropped</a>.  However if the trigger actions reference
other tables, the trigger is not dropped or modified if those other
tables are <a href="lang_droptable.html">dropped</a> or <a href="lang_altertable.html">modified</a>.</p>

<p>Triggers are removed using the <a href="lang_droptrigger.html">DROP TRIGGER</a> statement.</p>

<h2 id="syntax_restrictions_on_update_delete_and_insert_statements_within_triggers"><span>2.1. </span>Syntax Restrictions On UPDATE, DELETE, and INSERT Statements Within
    Triggers</h2>

<p>The <a href="lang_update.html">UPDATE</a>, <a href="lang_delete.html">DELETE</a>, and <a href="lang_insert.html">INSERT</a>
statements within triggers do not support
the full syntax for <a href="lang_update.html">UPDATE</a>, <a href="lang_delete.html">DELETE</a>, and <a href="lang_insert.html">INSERT</a> statements.  The following
restrictions apply:</p>

<ul>
<li><p>
  The name of the table to be modified in an <a href="lang_update.html">UPDATE</a>, <a href="lang_delete.html">DELETE</a>, or <a href="lang_insert.html">INSERT</a>
  statement must be an unqualified table name.  In other words, one must
  use just "<i>tablename</i>" not "<i>database</i><b>.</b><i>tablename</i>"
  when specifying the table. </p></li>

<li><p>
 For non-TEMP triggers,
  the table to be modified or queried must exist in the
  same database as the table or view to which the trigger is attached.
  TEMP triggers are not subject to the same-database rule.  A TEMP
  trigger is allowed to query or modify any table in any <a href="lang_attach.html">ATTACH</a>-ed database.
  </p></li>

<li><p>
  The "INSERT INTO <i>table</i> DEFAULT VALUES" form of the <a href="lang_insert.html">INSERT</a> statement
  is not supported.
  </p></li>

<li><p>
  The INDEXED BY and NOT INDEXED clauses are not supported for <a href="lang_update.html">UPDATE</a> and
  <a href="lang_delete.html">DELETE</a> statements.
  </p></li>

<li><p>
  The ORDER BY and LIMIT clauses on <a href="lang_update.html">UPDATE</a> and <a href="lang_delete.html">DELETE</a> statements are not
  supported.  ORDER BY and LIMIT are not normally supported for <a href="lang_update.html">UPDATE</a> or
  <a href="lang_delete.html">DELETE</a> in any context but can be enabled for top-level statements
  using the <a href="compile.html#enable_update_delete_limit">SQLITE_ENABLE_UPDATE_DELETE_LIMIT</a> compile-time option.  However,
  that compile-time option only applies to top-level <a href="lang_update.html">UPDATE</a> and <a href="lang_delete.html">DELETE</a>
  statements, not <a href="lang_update.html">UPDATE</a> and <a href="lang_delete.html">DELETE</a> statements within triggers.
  </p></li>

<li><p>
  <a href="syntax/common-table-expression.html">Common table expression</a> are not supported for
  statements inside of triggers.
  </p></li>
</ul>

<a name="instead_of_trigger"></a>

<h1 id="instead_of_triggers"><span>3. </span>INSTEAD OF triggers</h1>

<p>BEFORE and AFTER triggers work only on ordinary tables.
INSTEAD OF triggers work only on views.

</p><p>If an INSTEAD OF INSERT trigger exists on a view, then it is
possible to execute an INSERT statement against that view.  No actual
insert occurs.  Instead, the statements contained within the trigger
are run.  INSTEAD OF DELETE and
INSTEAD OF UPDATE triggers work the same way for DELETE and UPDATE statements
against views.</p>

<p>Note that the <a href="c3ref/changes.html">sqlite3_changes()</a> and <a href="c3ref/total_changes.html">sqlite3_total_changes()</a> interfaces
do not count INSTEAD OF trigger firings, but the
<a href="pragma.html#pragma_count_changes">count_changes pragma</a> does count INSTEAD OF trigger firing.</p>

<h1 id="some_example_triggers"><span>4. </span>Some Example Triggers</h1>

<p>Assuming that customer records are stored in the "customers" table, and
that order records are stored in the "orders" table, the following
UPDATE trigger
ensures that all associated orders are redirected when a customer changes
his or her address:</p>

<blockquote><pre>
CREATE TRIGGER update_customer_address UPDATE OF address ON customers 
  BEGIN
    UPDATE orders SET address = new.address WHERE customer_name = old.name;
  END;
</pre></blockquote>

<p>With this trigger installed, executing the statement:</p>

<blockquote><pre>
UPDATE customers SET address = '1 Main St.' WHERE name = 'Jack Jones';
</pre></blockquote>

<p>causes the following to be automatically executed:</p>

<blockquote><pre>
UPDATE orders SET address = '1 Main St.' WHERE customer_name = 'Jack Jones';
</pre></blockquote>

<p>For an example of an INSTEAD OF trigger, consider the following schema:

<blockquote><pre>
CREATE TABLE customer(
  cust_id INTEGER PRIMARY KEY,
  cust_name TEXT,
  cust_addr TEXT
);
CREATE VIEW customer_address AS
   SELECT cust_id, cust_addr FROM customer;
CREATE TRIGGER cust_addr_chng
INSTEAD OF UPDATE OF cust_addr ON customer_address
BEGIN
  UPDATE customer SET cust_addr=NEW.cust_addr
   WHERE cust_id=NEW.cust_id;
END;
</pre></blockquote>

</p><p>With the schema above, a statement of the form:</p>

<blockquote><pre>
UPDATE customer_address SET cust_addr=$new_address WHERE cust_id=$cust_id;
</pre></blockquote>

<p>Causes the customer.cust_addr field to be updated for a specific
customer entry that has customer.cust_id equal to the $cust_id parameter.
Note how the values assigned to the view are made available as field
in the special "NEW" table within the trigger body.</p>

<a name="undef_before"></a>

<h1 id="cautions_on_the_use_of_before_triggers"><span>5. </span>Cautions On The Use Of BEFORE triggers</h1>

<p>If a BEFORE UPDATE or BEFORE DELETE trigger modifies or deletes a row
that was to have been updated or deleted, then the result of the subsequent
update or delete operation is undefined.  Furthermore, if a BEFORE trigger
modifies or deletes a row, then it is undefined whether or not AFTER triggers
that would have otherwise run on those rows will in fact run.
</p>

<p>The value of NEW.rowid is undefined in a BEFORE INSERT trigger in which
the rowid is not explicitly set to an integer.</p>

<p>Because of the behaviors described above, programmers are encouraged to
prefer AFTER triggers over BEFORE triggers.</p>

<a name="raise"></a>

<h1 id="the_raise_function"><span>6. </span>The RAISE() function</h1>

<p>A special SQL function RAISE() may be used within a trigger-program,
with the following syntax</p> 

<p><b><a href="syntax/raise-function.html">raise-function:</a></b></p><div class='imgcontainer'>
 <div style="max-width:627px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 627.302 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L82,32A15 15 0 0 0 97 17A15 15 0 0 0 82 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RAISE</text>
<polygon points="120,17 109,21 109,12" style="fill:rgb(0,0,0)"/>
<path d="M97,17L114,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,32L135,32A15 15 0 0 0 150 17A15 15 0 0 0 135 2L135,2A15 15 0 0 0 120 17A15 15 0 0 0 135 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="135" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="192,55 180,59 180,50" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 158,17 Q 165,17 165,32 L 165,40 Q 165,55 176,55 L 186,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,70L285,70A15 15 0 0 0 300 55L300,55A15 15 0 0 0 285 39L207,39A15 15 0 0 0 192 55L192,55A15 15 0 0 0 207 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="336,55 324,59 324,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70A15 15 0 0 0 366 55L366,55A15 15 0 0 0 351 39A15 15 0 0 0 336 55L336,55A15 15 0 0 0 351 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="389,55 378,59 378,50" style="fill:rgb(0,0,0)"/>
<path d="M366,55L383,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,70L508,70A15 15 0 0 0 523 55L523,55A15 15 0 0 0 508 39L404,39A15 15 0 0 0 389 55L389,55A15 15 0 0 0 404 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="456" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">error-message</text>
<polygon points="564,17 553,21 553,12" style="fill:rgb(0,0,0)"/>
<path d="M523,55 L 530,55 Q 538,55 538,40 L 538,32 Q 538,17 548,17 L 558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M579,32A15 15 0 0 0 594 17A15 15 0 0 0 579 2A15 15 0 0 0 564 17A15 15 0 0 0 579 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="617,17 606,21 606,12" style="fill:rgb(0,0,0)"/>
<path d="M594,17L612,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="621" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L259,32A15 15 0 0 0 274 17A15 15 0 0 0 259 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="456,17 444,21 444,12" style="fill:rgb(0,0,0)"/>
<path d="M274,17L450,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,17L553,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,108L249,108A15 15 0 0 0 264 92A15 15 0 0 0 249 77L207,77A15 15 0 0 0 192 92A15 15 0 0 0 207 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="300,92 288,97 288,88" style="fill:rgb(0,0,0)"/>
<path d="M264,92L294,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,92 L 307,92 Q 315,92 315,77 L 315,70 Q 315,55 322,55 L 330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,145L229,145A15 15 0 0 0 244 130A15 15 0 0 0 229 115L207,115A15 15 0 0 0 192 130A15 15 0 0 0 207 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="300,130 288,135 288,126" style="fill:rgb(0,0,0)"/>
<path d="M244,130L294,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,130 L 307,130 Q 315,130 315,115 L 315,92 L 315,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,130 180,135 180,126" style="fill:rgb(0,0,0)"/>
<path d="M165,39 L 165,115 Q 165,130 176,130 L 186,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,92 180,97 180,88" style="fill:rgb(0,0,0)"/>
<path d="M165,77 L 165,85 Q 165,92 176,92 L 186,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
 </div>


<p>When one of RAISE(ROLLBACK,...), RAISE(ABORT,...) or RAISE(FAIL,...)
is called during trigger-program
execution, the specified <a href="lang_conflict.html">ON CONFLICT</a> processing is performed and
the current query terminates.
An error code of <a href="rescode.html#constraint">SQLITE_CONSTRAINT</a> is returned to the application,
along with the specified error message.</p>

<p>When RAISE(IGNORE) is called, the remainder of the current trigger program,
the statement that caused the trigger program to execute and any subsequent
trigger programs that would have been executed are abandoned. No database
changes are rolled back.  If the statement that caused the trigger program
to execute is itself part of a trigger program, then that trigger program
resumes execution at the beginning of the next step.
</p>

<a name="temptrig"></a>

<h1 id="temp_triggers_on_non_temp_tables"><span>7. </span>TEMP Triggers on Non-TEMP Tables</h1>

<p>A trigger normally exists in the same database as the table named
after the "ON" keyword in the CREATE TRIGGER statement.  Except, it is
possible to create a TEMP TRIGGER on a table in another database.  
Such a trigger will only fire when changes
are made to the target table by the application that defined the trigger.
Other applications that modify the database will not be able to see the
TEMP trigger and hence cannot run the trigger.</p>

<p>When defining a TEMP trigger on a non-TEMP table, it is important to
specify the database holding the non-TEMP table.  For example,
in the following statement, it is important to say "main.tab1" instead
of just "tab1":</p>

<blockquote><pre>
CREATE TEMP TRIGGER ex1 AFTER INSERT ON <b>main.</b>tab1 BEGIN ...
</pre></blockquote>

<p>Failure to specify the schema name on the target table could result
in the TEMP trigger being reattached to a table with the same name in
another database whenever any schema change occurs.</p>


Added Doc/Extra/Core/lang_createview.html.









































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>CREATE VIEW</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
CREATE VIEW
</div>
</div>




<h1 id="syntax"><span>1. </span>Syntax</h1>

<p><b><a href="syntax/create-view-stmt.html">create-view-stmt:</a></b>
<button id='x91a2919e' onclick='hideorshow("x91a2919e","xaa8b38f5")'>hide</button></p>
 <div id='xaa8b38f5' class='imgcontainer'>
 <div style="max-width:885px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 885.677 232.632">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L100,32A15 15 0 0 0 116 17A15 15 0 0 0 100 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CREATE</text>
<path d="M167,56L199,56A15 15 0 0 0 214 41A15 15 0 0 0 199 26L167,26A15 15 0 0 0 152 41A15 15 0 0 0 167 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMP</text>
<path d="M167,94L259,94A15 15 0 0 0 274 79A15 15 0 0 0 259 64L167,64A15 15 0 0 0 152 79A15 15 0 0 0 167 94Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="213" y="79" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMPORARY</text>
<path d="M325,32L355,32A15 15 0 0 0 370 17A15 15 0 0 0 355 2L325,2A15 15 0 0 0 310 17A15 15 0 0 0 325 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="340" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VIEW</text>
<polygon points="213,17 201,21 201,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L207,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="310,17 299,21 299,12" style="fill:rgb(0,0,0)"/>
<path d="M213,17L305,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,41 140,45 140,37" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,29 Q 131,41 138,41 L 146,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,79 140,83 140,74" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,32 L 131,64 Q 131,79 138,79 L 146,79"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M274,79 L 282,79 Q 289,79 289,64 L 289,32 Q 289,17 294,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M214,41 L 274,41 Q 289,41 289,33 L 289,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M370,17L400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M421,32A15 15 0 0 0 436 17A15 15 0 0 0 421 2A15 15 0 0 0 406 17A15 15 0 0 0 421 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="421" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="459,17 447,21 447,12" style="fill:rgb(0,0,0)"/>
<path d="M436,17L453,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M474,32L494,32A15 15 0 0 0 509 17A15 15 0 0 0 494 2L474,2A15 15 0 0 0 459 17A15 15 0 0 0 474 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="532,17 521,21 521,12" style="fill:rgb(0,0,0)"/>
<path d="M509,17L527,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,32L592,32A15 15 0 0 0 607 17A15 15 0 0 0 592 2L547,2A15 15 0 0 0 532 17A15 15 0 0 0 547 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="570" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="213,109 224,105 224,113" style="fill:rgb(0,0,0)"/>
<path d="M370,17 L 377,17 Q 385,17 385,32 L 385,94 Q 385,109 370,109 L 234,109 L 219,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="532,109 544,105 544,113" style="fill:rgb(0,0,0)"/>
<path d="M607,17 L 615,17 Q 622,17 622,32 L 622,94 Q 622,109 607,109 L 553,109 L 538,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,109L310,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,147 17,151 17,142" style="fill:rgb(0,0,0)"/>
<path d="M310,109 L 20,109 Q 5,109 5,124 L 5,132 Q 5,147 14,147 L 23,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,162L140,162A15 15 0 0 0 155 147A15 15 0 0 0 140 132L43,132A15 15 0 0 0 28 147A15 15 0 0 0 43 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="178,147 166,151 166,142" style="fill:rgb(0,0,0)"/>
<path d="M155,147L172,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M193,162A15 15 0 0 0 208 147A15 15 0 0 0 193 132A15 15 0 0 0 178 147A15 15 0 0 0 193 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="147" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="244,147 233,151 233,142" style="fill:rgb(0,0,0)"/>
<path d="M208,147L238,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,162L330,162A15 15 0 0 0 345 147A15 15 0 0 0 330 132L259,132A15 15 0 0 0 244 147A15 15 0 0 0 259 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="295" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">view-name</text>
<polygon points="383,177 372,181 372,173" style="fill:rgb(0,0,0)"/>
<path d="M345,147 L 353,147 Q 360,147 360,162 L 360,162 Q 360,177 369,177 L 378,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M399,192A15 15 0 0 0 414 177A15 15 0 0 0 399 162A15 15 0 0 0 383 177A15 15 0 0 0 399 192Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="399" y="177" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="450,177 438,181 438,173" style="fill:rgb(0,0,0)"/>
<path d="M414,177L444,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M465,192L559,192A15 15 0 0 0 574 177A15 15 0 0 0 559 162L465,162A15 15 0 0 0 450 177A15 15 0 0 0 465 192Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="512" y="177" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="610,177 599,181 599,173" style="fill:rgb(0,0,0)"/>
<path d="M574,177L604,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M625,192A15 15 0 0 0 640 177A15 15 0 0 0 625 162A15 15 0 0 0 610 177A15 15 0 0 0 625 192Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="625" y="177" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="678,147 667,151 667,142" style="fill:rgb(0,0,0)"/>
<path d="M640,177 L 648,177 Q 655,177 655,162 L 655,162 Q 655,147 664,147 L 673,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M693,162L697,162A15 15 0 0 0 713 147A15 15 0 0 0 697 132L693,132A15 15 0 0 0 678 147A15 15 0 0 0 693 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="695" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="736,147 724,151 724,142" style="fill:rgb(0,0,0)"/>
<path d="M713,147L730,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M736,162L840,162L840,132L736,132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="788" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="876,147 864,151 864,142" style="fill:rgb(0,0,0)"/>
<path d="M840,147L870,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="879" cy="147" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="92,177 80,181 80,173" style="fill:rgb(0,0,0)"/>
<path d="M5,132 L 5,162 Q 5,177 20,177 L 71,177 L 86,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M92,177 L 206,177 Q 221,177 221,162 L 221,162 Q 221,147 227,147 L 233,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="512,147 500,151 500,142" style="fill:rgb(0,0,0)"/>
<path d="M345,147L506,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M512,147L667,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M512,230A15 15 0 0 0 527 215A15 15 0 0 0 512 200A15 15 0 0 0 497 215A15 15 0 0 0 512 230Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="512" y="215" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="527,215 539,211 539,219" style="fill:rgb(0,0,0)"/>
<path d="M574,177 L 582,177 Q 589,177 589,192 L 589,200 Q 589,215 574,215 L 548,215 L 533,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M497,215 L 442,215 Q 427,215 427,200 L 427,192 Q 427,177 434,177 L 442,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/select-stmt.html">select-stmt:</a></b>
<button id='x552bae2f' onclick='hideorshow("x552bae2f","xe3097d9d")'>show</button></p>
 <div id='xe3097d9d' style='display:none;' class='imgcontainer'>
 <div style="max-width:669px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 669.677 1162.3">
<path d="M55,845L667,845L667,99L55,99Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="6" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="46,17 34,21 34,12" style="fill:rgb(0,0,0)"/>
<path d="M10,17L40,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M61,32L92,32A15 15 0 0 0 107 17A15 15 0 0 0 92 2L61,2A15 15 0 0 0 46 17A15 15 0 0 0 61 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="76" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M167,62L253,62A15 15 0 0 0 268 47L268,47A15 15 0 0 0 253 32L167,32A15 15 0 0 0 152 47L152,47A15 15 0 0 0 167 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="210,17 198,21 198,12" style="fill:rgb(0,0,0)"/>
<path d="M107,17L204,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M210,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M358,32L584,32L584,2L358,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="152,47 140,51 140,43" style="fill:rgb(0,0,0)"/>
<path d="M107,17 L 114,17 Q 122,17 122,32 L 122,32 Q 122,47 134,47 L 146,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="291,47 279,51 279,43" style="fill:rgb(0,0,0)"/>
<path d="M268,47L285,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,47 L 298,47 Q 306,47 306,32 L 306,32 Q 306,17 321,17 L 331,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,70A15 15 0 0 0 486 55L486,55A15 15 0 0 0 471 39A15 15 0 0 0 456 55L456,55A15 15 0 0 0 471 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="486,55 498,50 498,59" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,40 Q 599,55 584,55 L 507,55 L 492,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,55 L 350,55 Q 335,55 335,40 L 335,32 Q 335,17 340,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,83 307,79 307,88" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,68 Q 599,83 584,83 L 316,83 L 301,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,83 L 40,83 Q 25,83 25,98 L 25,113"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="25,47 20,36 29,36" style="fill:rgb(0,0,0)"/>
<path d="M10,17 L 17,17 Q 25,17 25,29 L 25,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="55,129 43,133 43,124" style="fill:rgb(0,0,0)"/>
<path d="M25,47 L 25,114 Q 25,129 37,129 L 49,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,129 115,133 115,124" style="fill:rgb(0,0,0)"/>
<path d="M55,129L121,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,144L193,144A15 15 0 0 0 208 129A15 15 0 0 0 193 114L142,114A15 15 0 0 0 127 129A15 15 0 0 0 142 144Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="250,159 238,163 238,155" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,144 Q 223,159 233,159 L 244,159"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,174L333,174A15 15 0 0 0 348 159A15 15 0 0 0 333 144L265,144A15 15 0 0 0 250 159A15 15 0 0 0 265 174Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="159" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="417,129 406,133 406,124" style="fill:rgb(0,0,0)"/>
<path d="M348,159 L 356,159 Q 363,159 363,144 L 363,144 Q 363,129 378,129 L 396,129 L 411,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,144L545,144L545,114L417,114Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M481,182A15 15 0 0 0 496 166A15 15 0 0 0 481 151A15 15 0 0 0 466 166A15 15 0 0 0 481 182Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="166" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="496,166 508,162 508,171" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,151 Q 560,166 545,166 L 517,166 L 502,166"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M466,166 L 406,166 Q 391,166 391,151 L 391,144 Q 391,129 398,129 L 406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,129 287,133 287,124" style="fill:rgb(0,0,0)"/>
<path d="M208,129L293,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M299,129L406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,212L280,212A15 15 0 0 0 295 197A15 15 0 0 0 280 182L265,182A15 15 0 0 0 250 197A15 15 0 0 0 265 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="197" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="348,197 337,201 337,192" style="fill:rgb(0,0,0)"/>
<path d="M295,197L342,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,197 L 356,197 Q 363,197 363,182 L 363,159 L 363,144"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="250,197 238,201 238,192" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,182 Q 223,197 233,197 L 244,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,287L203,287A15 15 0 0 0 218 272A15 15 0 0 0 203 257L168,257A15 15 0 0 0 153 272A15 15 0 0 0 168 287Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="186" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="290,272 279,277 279,268" style="fill:rgb(0,0,0)"/>
<path d="M218,272L284,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,287L451,287L451,257L290,257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M320,362L422,362L422,331L320,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M371,324A15 15 0 0 0 386 309A15 15 0 0 0 371 293A15 15 0 0 0 356 309A15 15 0 0 0 371 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="386,309 397,304 397,313" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 459,272 Q 466,272 466,287 L 466,294 Q 466,309 451,309 L 407,309 L 392,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M356,309 L 279,309 Q 264,309 264,294 L 264,287 Q 264,272 271,272 L 279,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="320,346 308,351 308,342" style="fill:rgb(0,0,0)"/>
<path d="M218,272 L 226,272 Q 233,272 233,287 L 233,331 Q 233,346 248,346 L 299,346 L 314,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="484,313 488,325 480,325" style="fill:rgb(0,0,0)"/>
<path d="M422,346 L 436,346 Q 451,346 466,346 L 469,346 Q 484,346 484,333 L 484,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,272 494,277 494,268" style="fill:rgb(0,0,0)"/>
<path d="M484,313 L 484,287 Q 484,272 492,272 L 499,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,272 L 496,272 Q 487,272 487,272 Q 487,272 495,272 L 502,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,197 555,185 564,185" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,176 L 560,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,235 360,230 360,239" style="fill:rgb(0,0,0)"/>
<path d="M560,197 L 560,220 Q 560,235 545,235 L 369,235 L 354,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,272 142,277 142,268" style="fill:rgb(0,0,0)"/>
<path d="M348,235 L 142,235 Q 127,235 127,250 L 127,257 Q 127,272 137,272 L 147,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,437L218,437A15 15 0 0 0 233 422A15 15 0 0 0 218 407L168,407A15 15 0 0 0 153 422A15 15 0 0 0 168 437Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="256,422 244,426 244,418" style="fill:rgb(0,0,0)"/>
<path d="M233,422L250,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,437L305,437L305,407L256,407Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="517,324 513,312 521,312" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 502,272 Q 517,272 517,287 L 517,303 L 517,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,384 382,380 382,389" style="fill:rgb(0,0,0)"/>
<path d="M517,324 L 517,369 Q 517,384 502,384 L 391,384 L 376,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,422 142,426 142,418" style="fill:rgb(0,0,0)"/>
<path d="M371,384 L 142,384 Q 127,384 127,399 L 127,407 Q 127,422 137,422 L 147,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,324 122,312 131,312" style="fill:rgb(0,0,0)"/>
<path d="M127,257L127,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,324L127,407"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,535L212,535A15 15 0 0 0 227 520A15 15 0 0 0 212 505L168,505A15 15 0 0 0 153 520A15 15 0 0 0 168 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="250,520 238,525 238,516" style="fill:rgb(0,0,0)"/>
<path d="M227,520L244,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,535L269,535A15 15 0 0 0 284 520A15 15 0 0 0 269 505L265,505A15 15 0 0 0 250 520A15 15 0 0 0 265 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="320,520 309,525 309,516" style="fill:rgb(0,0,0)"/>
<path d="M284,520L314,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,535L369,535L369,505L320,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="452,520 441,525 441,516" style="fill:rgb(0,0,0)"/>
<path d="M369,520L446,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,535L520,535A15 15 0 0 0 535 520A15 15 0 0 0 520 505L467,505A15 15 0 0 0 452 520A15 15 0 0 0 467 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="558,520 546,525 546,516" style="fill:rgb(0,0,0)"/>
<path d="M535,520L552,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,535L607,535L607,505L558,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M345,573A15 15 0 0 0 360 558A15 15 0 0 0 345 543A15 15 0 0 0 330 558A15 15 0 0 0 345 573Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="558" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="360,558 371,554 371,562" style="fill:rgb(0,0,0)"/>
<path d="M369,520 L 377,520 Q 384,520 384,535 L 384,543 Q 384,558 375,558 L 366,558"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,558 L 309,558 Q 294,558 294,543 L 294,535 Q 294,520 301,520 L 309,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="514,551 503,555 503,546" style="fill:rgb(0,0,0)"/>
<path d="M411,520 L 418,520 Q 426,520 426,535 L 426,536 Q 426,551 441,551 L 493,551 L 508,551"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M514,551 L 607,551 Q 622,551 622,536 L 622,535 Q 622,520 630,520 L 637,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,490 256,494 256,486" style="fill:rgb(0,0,0)"/>
<path d="M127,460 L 127,475 Q 127,490 142,490 L 246,490 L 261,490"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,520 399,525 399,516" style="fill:rgb(0,0,0)"/>
<path d="M267,490 L 369,490 Q 384,490 384,505 L 384,505 Q 384,520 395,520 L 405,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,460 244,455 244,464" style="fill:rgb(0,0,0)"/>
<path d="M305,422 L 313,422 Q 320,422 320,437 L 320,445 Q 320,460 305,460 L 254,460 L 239,460"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,520 142,525 142,516" style="fill:rgb(0,0,0)"/>
<path d="M233,460 L 142,460 Q 127,460 127,475 L 127,505 Q 127,520 137,520 L 147,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,447 122,435 131,435" style="fill:rgb(0,0,0)"/>
<path d="M127,407L127,441"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,447L127,505"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,649L232,649A15 15 0 0 0 247 634A15 15 0 0 0 232 619L168,619A15 15 0 0 0 153 634A15 15 0 0 0 168 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="200" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="283,634 271,638 271,629" style="fill:rgb(0,0,0)"/>
<path d="M247,634L277,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,649L395,649A15 15 0 0 0 410 634A15 15 0 0 0 395 619L298,619A15 15 0 0 0 283 634A15 15 0 0 0 298 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="433,634 422,638 422,629" style="fill:rgb(0,0,0)"/>
<path d="M410,634L427,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,649L452,649A15 15 0 0 0 467 634A15 15 0 0 0 452 619L448,619A15 15 0 0 0 433 634A15 15 0 0 0 448 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="450" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="490,634 479,638 479,629" style="fill:rgb(0,0,0)"/>
<path d="M467,634L485,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,649L609,649L609,619L490,619Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="550" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M446,687A15 15 0 0 0 461 671A15 15 0 0 0 446 656A15 15 0 0 0 431 671A15 15 0 0 0 446 687Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="671" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="461,671 472,667 472,676" style="fill:rgb(0,0,0)"/>
<path d="M609,634 L 616,634 Q 624,634 624,649 L 624,656 Q 624,671 609,671 L 482,671 L 467,671"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,671 L 271,671 Q 256,671 256,656 L 256,649 Q 256,634 264,634 L 271,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="624,692 619,680 628,680" style="fill:rgb(0,0,0)"/>
<path d="M624,656L624,686"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,558 648,547 656,547" style="fill:rgb(0,0,0)"/>
<path d="M607,520 L 637,520 Q 652,520 652,535 L 652,537 L 652,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,596 382,592 382,600" style="fill:rgb(0,0,0)"/>
<path d="M652,558 L 652,581 Q 652,596 637,596 L 391,596 L 376,596"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,634 142,638 142,629" style="fill:rgb(0,0,0)"/>
<path d="M371,596 L 142,596 Q 127,596 127,611 L 127,619 Q 127,634 137,634 L 147,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,558 122,547 131,547" style="fill:rgb(0,0,0)"/>
<path d="M127,505L127,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,709 359,714 359,705" style="fill:rgb(0,0,0)"/>
<path d="M127,558 L 127,694 Q 127,709 142,709 L 350,709 L 365,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,709 597,714 597,705" style="fill:rgb(0,0,0)"/>
<path d="M371,709L603,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,709 L 616,709 Q 624,709 624,717 L 624,724"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,800L194,800A15 15 0 0 0 209 785A15 15 0 0 0 194 770L142,770A15 15 0 0 0 127 785A15 15 0 0 0 142 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="245,785 234,789 234,781" style="fill:rgb(0,0,0)"/>
<path d="M209,785L239,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,800A15 15 0 0 0 275 785A15 15 0 0 0 260 770A15 15 0 0 0 245 785A15 15 0 0 0 260 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="311,785 300,789 300,781" style="fill:rgb(0,0,0)"/>
<path d="M275,785L306,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,800L361,800L361,770L311,770Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="397,785 385,789 385,781" style="fill:rgb(0,0,0)"/>
<path d="M361,785L391,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,800A15 15 0 0 0 427 785A15 15 0 0 0 412 770A15 15 0 0 0 397 785A15 15 0 0 0 412 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="412" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="609,785 597,789 597,781" style="fill:rgb(0,0,0)"/>
<path d="M427,785L603,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,785 L 616,785 Q 624,785 624,792 L 624,800"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,762A15 15 0 0 0 351 747A15 15 0 0 0 336 732A15 15 0 0 0 321 747A15 15 0 0 0 336 762Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="747" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M336,838A15 15 0 0 0 351 823A15 15 0 0 0 336 808A15 15 0 0 0 321 823A15 15 0 0 0 336 838Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="823" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="351,747 363,743 363,751" style="fill:rgb(0,0,0)"/>
<path d="M361,785 L 368,785 Q 376,785 376,770 L 376,762 Q 376,747 366,747 L 357,747"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,747 L 300,747 Q 285,747 285,762 L 285,770 Q 285,785 292,785 L 300,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,823 363,818 363,827" style="fill:rgb(0,0,0)"/>
<path d="M427,785 L 434,785 Q 442,785 442,800 L 442,808 Q 442,823 427,823 L 372,823 L 357,823"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,823 L 234,823 Q 219,823 219,808 L 219,800 Q 219,785 226,785 L 234,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,785 115,789 115,781" style="fill:rgb(0,0,0)"/>
<path d="M55,129 L 62,129 Q 70,129 70,144 L 70,770 Q 70,785 85,785 L 106,785 L 121,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,891L424,891L424,860L248,860Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="876" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="424,876 436,871 436,880" style="fill:rgb(0,0,0)"/>
<path d="M624,692 L 624,861 Q 624,876 609,876 L 445,876 L 430,876"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="6,197 10,208 2,208" style="fill:rgb(0,0,0)"/>
<path d="M248,876 L 21,876 Q 6,876 6,861 L 6,217 L 6,202"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M6,197 L 6,144 Q 6,129 21,129 L 40,129 L 55,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="667" y="275" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" transform="rotate(-90 667,285)" dominant-baseline="central">select-core</text>
<path d="M168,966L213,966A15 15 0 0 0 228 951A15 15 0 0 0 213 936L168,936A15 15 0 0 0 153 951A15 15 0 0 0 168 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="251,951 239,956 239,947" style="fill:rgb(0,0,0)"/>
<path d="M228,951L245,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,966L270,966A15 15 0 0 0 285 951A15 15 0 0 0 270 936L266,936A15 15 0 0 0 251 951A15 15 0 0 0 266 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M168,1072L202,1072A15 15 0 0 0 217 1057A15 15 0 0 0 202 1042L168,1042A15 15 0 0 0 153 1057A15 15 0 0 0 168 1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="240,1057 228,1061 228,1053" style="fill:rgb(0,0,0)"/>
<path d="M217,1057L234,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,1072L289,1072L289,1042L240,1042Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="330,951 319,956 319,947" style="fill:rgb(0,0,0)"/>
<path d="M285,951L324,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,966L460,966L460,936L330,936Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M395,1004A15 15 0 0 0 410 989A15 15 0 0 0 395 974A15 15 0 0 0 380 989A15 15 0 0 0 395 1004Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="989" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="410,989 422,985 422,993" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 468,951 Q 475,951 475,966 L 475,974 Q 475,989 460,989 L 431,989 L 416,989"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,989 L 322,989 Q 307,989 307,974 L 307,966 Q 307,951 313,951 L 319,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,913 348,909 348,918" style="fill:rgb(0,0,0)"/>
<path d="M624,860 L 624,898 Q 624,913 609,913 L 357,913 L 342,913"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,951 142,956 142,947" style="fill:rgb(0,0,0)"/>
<path d="M336,913 L 142,913 Q 127,913 127,928 L 127,936 Q 127,951 137,951 L 147,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,981 492,970 500,970" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 481,951 Q 496,951 496,963 L 496,976"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,1023 318,1019 318,1027" style="fill:rgb(0,0,0)"/>
<path d="M496,981 L 496,1008 Q 496,1023 481,1023 L 327,1023 L 312,1023"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,1057 142,1061 142,1053" style="fill:rgb(0,0,0)"/>
<path d="M307,1023 L 142,1023 Q 127,1023 127,1038 L 127,1042 Q 127,1057 137,1057 L 147,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,989 122,978 131,978" style="fill:rgb(0,0,0)"/>
<path d="M127,936L127,983"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,989L127,1042"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1102L415,1102A15 15 0 0 0 430 1087A15 15 0 0 0 415 1072L363,1072A15 15 0 0 0 348 1087A15 15 0 0 0 363 1102Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="389" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="453,1087 441,1092 441,1083" style="fill:rgb(0,0,0)"/>
<path d="M430,1087L447,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,1102L502,1102L502,1072L453,1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="525,1087 513,1092 513,1083" style="fill:rgb(0,0,0)"/>
<path d="M502,1087L519,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1140A15 15 0 0 0 378 1125A15 15 0 0 0 363 1110A15 15 0 0 0 348 1125A15 15 0 0 0 363 1140Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="1125" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="401,1125 390,1129 390,1121" style="fill:rgb(0,0,0)"/>
<path d="M378,1125L396,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,1140L451,1140L451,1110L401,1110Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="1125" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="312,1057 301,1061 301,1053" style="fill:rgb(0,0,0)"/>
<path d="M289,1057L306,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1125 337,1129 337,1121" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1110 Q 327,1125 335,1125 L 342,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1087 337,1092 337,1083" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1072 Q 327,1087 335,1087 L 342,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1057 513,1061 513,1053" style="fill:rgb(0,0,0)"/>
<path d="M312,1057L519,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="620,1155 609,1160 609,1151" style="fill:rgb(0,0,0)"/>
<path d="M525,1057 L 546,1057 Q 561,1057 561,1072 L 561,1140 Q 561,1155 576,1155 L 599,1155 L 614,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="624" cy="1155" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1087 L 546,1087 Q 561,1087 561,1095 L 561,1102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1125 513,1129 513,1121" style="fill:rgb(0,0,0)"/>
<path d="M451,1125L519,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1125 L 546,1125 Q 561,1125 561,1133 L 561,1140"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1155 513,1160 513,1151" style="fill:rgb(0,0,0)"/>
<path d="M127,1042 L 127,1140 Q 127,1155 142,1155 L 504,1155 L 519,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1155L597,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/common-table-expression.html">common-table-expression:</a></b>
<button id='xccb9aac8' onclick='hideorshow("xccb9aac8","x278408a4")'>show</button></p>
 <div id='x278408a4' style='display:none;' class='imgcontainer'>
 <div style="max-width:638px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 638.525 167.4">
<circle cx="5" cy="29" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,29 20,33 20,24" style="fill:rgb(0,0,0)"/>
<path d="M9,29L26,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,44L122,44A15 15 0 0 0 137 29A15 15 0 0 0 122 14L47,14A15 15 0 0 0 32 29A15 15 0 0 0 47 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="160,29 149,33 149,24" style="fill:rgb(0,0,0)"/>
<path d="M137,29L155,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="196,29 185,33 185,24" style="fill:rgb(0,0,0)"/>
<path d="M160,29L191,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,44A15 15 0 0 0 227 29A15 15 0 0 0 211 14A15 15 0 0 0 196 29A15 15 0 0 0 211 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="250,29 238,33 238,24" style="fill:rgb(0,0,0)"/>
<path d="M227,29L244,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="286,29 274,33 274,24" style="fill:rgb(0,0,0)"/>
<path d="M250,29L280,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,44L395,44A15 15 0 0 0 410 29A15 15 0 0 0 395 14L301,14A15 15 0 0 0 286 29A15 15 0 0 0 301 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="446,29 434,33 434,24" style="fill:rgb(0,0,0)"/>
<path d="M410,29L440,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,44A15 15 0 0 0 476 29A15 15 0 0 0 461 14A15 15 0 0 0 446 29A15 15 0 0 0 461 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,29 499,33 499,24" style="fill:rgb(0,0,0)"/>
<path d="M476,29L505,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,165L51,165A15 15 0 0 0 66 150A15 15 0 0 0 51 135L47,135A15 15 0 0 0 32 150A15 15 0 0 0 47 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="49" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<path d="M127,135L147,135A15 15 0 0 0 162 119A15 15 0 0 0 147 104L127,104A15 15 0 0 0 112 119A15 15 0 0 0 127 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<path d="M219,135L337,135A15 15 0 0 0 352 119A15 15 0 0 0 337 104L219,104A15 15 0 0 0 204 119A15 15 0 0 0 219 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<path d="M162,119L204,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,165A15 15 0 0 0 425 150A15 15 0 0 0 410 135A15 15 0 0 0 395 150A15 15 0 0 0 410 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="410" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="448,150 437,154 437,145" style="fill:rgb(0,0,0)"/>
<path d="M425,150L442,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,165L552,165L552,135L448,135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="500" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="575,150 564,154 564,145" style="fill:rgb(0,0,0)"/>
<path d="M552,150L570,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M591,165A15 15 0 0 0 606 150A15 15 0 0 0 591 135A15 15 0 0 0 575 150A15 15 0 0 0 591 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="629,150 617,154 617,145" style="fill:rgb(0,0,0)"/>
<path d="M606,150L623,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="632" cy="150" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,82A15 15 0 0 0 363 66A15 15 0 0 0 348 51A15 15 0 0 0 333 66A15 15 0 0 0 348 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="363,66 374,62 374,71" style="fill:rgb(0,0,0)"/>
<path d="M410,29 L 417,29 Q 425,29 425,44 L 425,51 Q 425,66 410,66 L 384,66 L 369,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M333,66 L 278,66 Q 263,66 263,51 L 263,44 Q 263,29 270,29 L 278,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,93 78,89 78,97" style="fill:rgb(0,0,0)"/>
<path d="M511,29 L 516,29 Q 522,29 522,44 L 522,78 Q 522,93 507,93 L 87,93 L 72,93"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,150 20,154 20,145" style="fill:rgb(0,0,0)"/>
<path d="M66,93 L 30,93 Q 15,93 15,108 L 15,135 Q 15,150 20,150 L 26,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="85,150 73,154 73,145" style="fill:rgb(0,0,0)"/>
<path d="M66,150L79,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="112,119 101,124 101,115" style="fill:rgb(0,0,0)"/>
<path d="M85,150 L 89,150 Q 92,150 92,135 L 92,134 Q 92,119 99,119 L 106,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="204,119 192,124 192,115" style="fill:rgb(0,0,0)"/>
<path d="M66,150 L 147,150 Q 162,150 170,150 Q 177,150 177,135 L 177,134 Q 177,119 188,119 L 198,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,150 383,154 383,145" style="fill:rgb(0,0,0)"/>
<path d="M352,119 L 360,119 Q 367,119 367,134 L 367,135 Q 367,150 378,150 L 389,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150L395,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,6 336,10 336,2" style="fill:rgb(0,0,0)"/>
<path d="M160,29 L 168,29 Q 175,29 175,17 Q 175,6 190,6 L 327,6 L 342,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,6 L 473,6 Q 488,6 488,17 Q 488,29 495,29 L 503,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/compound-operator.html">compound-operator:</a></b>
<button id='x4b99b93d' onclick='hideorshow("x4b99b93d","xa63c5103")'>show</button></p>
 <div id='xa63c5103' style='display:none;' class='imgcontainer'>
 <div style="max-width:293px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 293.842 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L127,32A15 15 0 0 0 142 17A15 15 0 0 0 127 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,70L127,70A15 15 0 0 0 142 55L142,55A15 15 0 0 0 127 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,108L168,108A15 15 0 0 0 183 92A15 15 0 0 0 168 77L83,77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M83,145L135,145A15 15 0 0 0 150 130A15 15 0 0 0 135 115L83,115A15 15 0 0 0 68 130A15 15 0 0 0 83 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M142,55L159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70L195,70A15 15 0 0 0 210 55L210,55A15 15 0 0 0 195 39L180,39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="233,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M210,55L227,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,17 272,21 272,12" style="fill:rgb(0,0,0)"/>
<path d="M233,55 L 240,55 Q 248,55 248,40 L 248,32 Q 248,17 263,17 L 263,17 L 278,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="288" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M47,39 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,92 221,97 221,88" style="fill:rgb(0,0,0)"/>
<path d="M183,92L227,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,92 L 240,92 Q 248,92 248,77 L 248,54 L 248,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,130 56,135 56,126" style="fill:rgb(0,0,0)"/>
<path d="M47,77 L 47,115 Q 47,130 55,130 L 62,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,130 221,135 221,126" style="fill:rgb(0,0,0)"/>
<path d="M150,130L227,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,130 L 240,130 Q 248,130 248,115 L 248,92 L 248,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/expr.html">expr:</a></b>
<button id='x93338b68' onclick='hideorshow("x93338b68","x35fb31a8")'>show</button></p>
 <div id='x35fb31a8' style='display:none;' class='imgcontainer'>
 <div style="max-width:963px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 963.96 1068.77">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L158,32L158,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="101" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="954,17 943,21 943,12" style="fill:rgb(0,0,0)"/>
<path d="M158,17L948,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="958" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L172,70A15 15 0 0 0 187 55L187,55A15 15 0 0 0 172 39L60,39A15 15 0 0 0 45 55L45,55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">bind-parameter</text>
<polygon points="916,55 905,59 905,50" style="fill:rgb(0,0,0)"/>
<path d="M187,55L910,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,55 L 924,55 Q 931,55 931,47 L 931,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 31,55 L 39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,130L156,130A15 15 0 0 0 171 115A15 15 0 0 0 156 100L60,100A15 15 0 0 0 45 115A15 15 0 0 0 60 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,115 183,119 183,111" style="fill:rgb(0,0,0)"/>
<path d="M171,115L189,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,130A15 15 0 0 0 225 115A15 15 0 0 0 210 100A15 15 0 0 0 195 115A15 15 0 0 0 210 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M225,115L255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130L351,130A15 15 0 0 0 366 115A15 15 0 0 0 351 100L276,100A15 15 0 0 0 261 115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="389,115 378,119 378,111" style="fill:rgb(0,0,0)"/>
<path d="M366,115L383,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,130A15 15 0 0 0 419 115A15 15 0 0 0 404 100A15 15 0 0 0 389 115A15 15 0 0 0 404 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="404" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="455,115 444,119 444,111" style="fill:rgb(0,0,0)"/>
<path d="M419,115L450,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,130L565,130A15 15 0 0 0 580 115A15 15 0 0 0 565 100L471,100A15 15 0 0 0 455 115A15 15 0 0 0 471 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="916,115 905,119 905,111" style="fill:rgb(0,0,0)"/>
<path d="M580,115L910,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,115 L 924,115 Q 931,115 931,108 L 931,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,115 33,119 33,111" style="fill:rgb(0,0,0)"/>
<path d="M24,100 L 24,108 Q 24,115 31,115 L 39,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,89 97,93 97,84" style="fill:rgb(0,0,0)"/>
<path d="M24,74 L 24,81 Q 24,89 39,89 L 87,89 L 102,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 302,93 302,84" style="fill:rgb(0,0,0)"/>
<path d="M108,89 L 129,89 Q 144,89 159,89 L 293,89 L 308,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,89 L 414,89 Q 429,89 429,102 Q 429,115 436,115 L 444,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M223,89 L 230,89 Q 238,89 238,102 Q 238,115 245,115 L 253,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,168L168,168A15 15 0 0 0 183 153A15 15 0 0 0 168 138L60,138A15 15 0 0 0 45 153A15 15 0 0 0 60 168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">unary-operator</text>
<polygon points="206,153 194,157 194,149" style="fill:rgb(0,0,0)"/>
<path d="M183,153L200,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,168L255,168L255,138L206,138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,153 905,157 905,149" style="fill:rgb(0,0,0)"/>
<path d="M255,153L910,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,153 L 924,153 Q 931,153 931,145 L 931,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,153 33,157 33,149" style="fill:rgb(0,0,0)"/>
<path d="M24,138 L 24,145 Q 24,153 31,153 L 39,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,206L94,206L94,176L45,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,191 106,195 106,186" style="fill:rgb(0,0,0)"/>
<path d="M94,191L111,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,206L245,206A15 15 0 0 0 261 191A15 15 0 0 0 245 176L132,176A15 15 0 0 0 117 191A15 15 0 0 0 132 206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">binary-operator</text>
<polygon points="284,191 272,195 272,186" style="fill:rgb(0,0,0)"/>
<path d="M261,191L278,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,206L333,206L333,176L284,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="308" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,191 905,195 905,186" style="fill:rgb(0,0,0)"/>
<path d="M333,191L910,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,191 L 924,191 Q 931,191 931,183 L 931,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,191 33,195 33,186" style="fill:rgb(0,0,0)"/>
<path d="M24,176 L 24,183 Q 24,191 31,191 L 39,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,245L162,245A15 15 0 0 0 177 230A15 15 0 0 0 162 215L60,215A15 15 0 0 0 45 230A15 15 0 0 0 60 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="111" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-name</text>
<polygon points="194,230 183,234 183,226" style="fill:rgb(0,0,0)"/>
<path d="M177,230L188,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,245A15 15 0 0 0 224 230A15 15 0 0 0 209 215A15 15 0 0 0 194 230A15 15 0 0 0 209 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="260,230 249,234 249,226" style="fill:rgb(0,0,0)"/>
<path d="M224,230L255,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,245L437,245L437,215L260,215Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-arguments</text>
<polygon points="473,230 461,234 461,226" style="fill:rgb(0,0,0)"/>
<path d="M437,230L467,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,245A15 15 0 0 0 503 230A15 15 0 0 0 488 215A15 15 0 0 0 473 230A15 15 0 0 0 488 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="541,260 529,265 529,256" style="fill:rgb(0,0,0)"/>
<path d="M503,230 L 510,230 Q 518,230 518,245 L 518,245 Q 518,260 527,260 L 535,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,275L653,275L653,245L541,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="691,230 680,234 680,226" style="fill:rgb(0,0,0)"/>
<path d="M653,260 L 661,260 Q 668,260 668,245 L 668,245 Q 668,230 677,230 L 685,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="729,260 718,265 718,256" style="fill:rgb(0,0,0)"/>
<path d="M691,230 L 699,230 Q 706,230 706,245 L 706,245 Q 706,260 715,260 L 723,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,275L837,275L837,245L729,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="783" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">over-clause</text>
<polygon points="916,260 905,265 905,256" style="fill:rgb(0,0,0)"/>
<path d="M837,260L910,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,260 L 924,260 Q 931,260 931,253 L 931,245"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,230 33,234 33,226" style="fill:rgb(0,0,0)"/>
<path d="M24,215 L 24,222 Q 24,230 31,230 L 39,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,230 585,234 585,226" style="fill:rgb(0,0,0)"/>
<path d="M503,230L591,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,230L680,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,230 905,234 905,226" style="fill:rgb(0,0,0)"/>
<path d="M691,230L910,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,230 L 924,230 Q 931,230 931,222 L 931,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,321A15 15 0 0 0 75 306A15 15 0 0 0 60 290A15 15 0 0 0 45 306A15 15 0 0 0 60 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,306 100,310 100,301" style="fill:rgb(0,0,0)"/>
<path d="M75,306L105,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M111,321L160,321L160,290L111,290Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="306" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="196,306 185,310 185,301" style="fill:rgb(0,0,0)"/>
<path d="M160,306L191,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,321A15 15 0 0 0 227 306A15 15 0 0 0 211 290A15 15 0 0 0 196 306A15 15 0 0 0 211 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,306 905,310 905,301" style="fill:rgb(0,0,0)"/>
<path d="M227,306L910,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,306 L 924,306 Q 931,306 931,298 L 931,291"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,306 33,310 33,301" style="fill:rgb(0,0,0)"/>
<path d="M24,290 L 24,298 Q 24,306 31,306 L 39,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,284A15 15 0 0 0 151 269A15 15 0 0 0 136 254A15 15 0 0 0 121 269A15 15 0 0 0 136 284Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="269" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="151,269 162,265 162,274" style="fill:rgb(0,0,0)"/>
<path d="M160,306 L 168,306 Q 175,306 175,291 L 175,284 Q 175,269 166,269 L 157,269"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,269 L 103,269 Q 88,269 88,284 L 88,291 Q 88,306 96,306 L 103,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,358L88,358A15 15 0 0 0 103 343A15 15 0 0 0 88 328L60,328A15 15 0 0 0 45 343A15 15 0 0 0 60 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CAST</text>
<polygon points="126,343 114,348 114,339" style="fill:rgb(0,0,0)"/>
<path d="M103,343L120,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M141,358A15 15 0 0 0 156 343A15 15 0 0 0 141 328A15 15 0 0 0 126 343A15 15 0 0 0 141 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="179,343 168,348 168,339" style="fill:rgb(0,0,0)"/>
<path d="M156,343L173,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,358L228,358L228,328L179,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="251,343 240,348 240,339" style="fill:rgb(0,0,0)"/>
<path d="M228,343L246,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,358L271,358A15 15 0 0 0 286 343A15 15 0 0 0 271 328L267,328A15 15 0 0 0 251 343A15 15 0 0 0 267 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="269" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="309,343 297,348 297,339" style="fill:rgb(0,0,0)"/>
<path d="M286,343L303,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,358L408,358L408,328L309,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="358" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="431,343 419,348 419,339" style="fill:rgb(0,0,0)"/>
<path d="M408,343L425,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M446,358A15 15 0 0 0 461 343A15 15 0 0 0 446 328A15 15 0 0 0 431 343A15 15 0 0 0 446 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,343 905,348 905,339" style="fill:rgb(0,0,0)"/>
<path d="M461,343L910,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,343 L 924,343 Q 931,343 931,336 L 931,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,343 33,348 33,339" style="fill:rgb(0,0,0)"/>
<path d="M24,328 L 24,336 Q 24,343 31,343 L 39,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,396L94,396L94,366L45,366Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,381 106,385 106,377" style="fill:rgb(0,0,0)"/>
<path d="M94,381L111,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,396L196,396A15 15 0 0 0 211 381A15 15 0 0 0 196 366L132,366A15 15 0 0 0 117 381A15 15 0 0 0 132 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="234,381 223,385 223,377" style="fill:rgb(0,0,0)"/>
<path d="M211,381L229,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,396L355,396A15 15 0 0 0 370 381A15 15 0 0 0 355 366L250,366A15 15 0 0 0 234 381A15 15 0 0 0 250 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="916,381 905,385 905,377" style="fill:rgb(0,0,0)"/>
<path d="M370,381L910,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,381 L 924,381 Q 931,381 931,374 L 931,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,381 33,385 33,377" style="fill:rgb(0,0,0)"/>
<path d="M24,366 L 24,374 Q 24,381 31,381 L 39,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,434L94,434L94,404L45,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,419 119,423 119,415" style="fill:rgb(0,0,0)"/>
<path d="M94,419L124,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,434L165,434A15 15 0 0 0 180 419A15 15 0 0 0 165 404L145,404A15 15 0 0 0 130 419A15 15 0 0 0 145 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="234,419 223,423 223,415" style="fill:rgb(0,0,0)"/>
<path d="M180,419L229,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,434L273,434A15 15 0 0 0 288 419A15 15 0 0 0 273 404L250,404A15 15 0 0 0 234 419A15 15 0 0 0 250 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIKE</text>
<path d="M250,472L279,472A15 15 0 0 0 294 457A15 15 0 0 0 279 442L250,442A15 15 0 0 0 234 457A15 15 0 0 0 250 472Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="457" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GLOB</text>
<path d="M250,510L302,510A15 15 0 0 0 317 495A15 15 0 0 0 302 479L250,479A15 15 0 0 0 234 495A15 15 0 0 0 250 510Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REGEXP</text>
<path d="M250,547L297,547A15 15 0 0 0 313 532A15 15 0 0 0 297 517L250,517A15 15 0 0 0 234 532A15 15 0 0 0 250 547Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="274" y="532" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<path d="M378,510L427,510L427,479L378,479Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M378,434L427,434L427,404L378,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="465,449 454,454 454,445" style="fill:rgb(0,0,0)"/>
<path d="M427,419 L 435,419 Q 442,419 442,434 L 442,434 Q 442,449 451,449 L 460,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,464L532,464A15 15 0 0 0 547 449A15 15 0 0 0 532 434L480,434A15 15 0 0 0 465 449A15 15 0 0 0 480 464Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="506" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ESCAPE</text>
<polygon points="570,449 559,454 559,445" style="fill:rgb(0,0,0)"/>
<path d="M547,449L565,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M570,464L620,464L620,434L570,434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="595" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="671,419 659,423 659,415" style="fill:rgb(0,0,0)"/>
<path d="M620,449 L 627,449 Q 635,449 635,434 L 635,434 Q 635,419 650,419 L 650,419 L 665,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,419 905,423 905,415" style="fill:rgb(0,0,0)"/>
<path d="M671,419L910,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,419 L 924,419 Q 931,419 931,411 L 931,404"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,419 33,423 33,415" style="fill:rgb(0,0,0)"/>
<path d="M24,404 L 24,411 Q 24,419 31,419 L 39,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M100,419 L 108,419 Q 115,419 115,434 L 115,434 Q 115,449 130,449 L 177,449 Q 192,449 192,434 L 192,434 Q 192,419 199,419 L 207,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,532 223,537 223,528" style="fill:rgb(0,0,0)"/>
<path d="M196,419 L 204,419 Q 211,419 211,434 L 211,517 Q 211,532 220,532 L 229,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,457 223,461 223,452" style="fill:rgb(0,0,0)"/>
<path d="M211,442 L 211,449 Q 211,457 220,457 L 229,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,495 223,499 223,490" style="fill:rgb(0,0,0)"/>
<path d="M211,479 L 211,487 Q 211,495 220,495 L 229,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,419 367,423 367,415" style="fill:rgb(0,0,0)"/>
<path d="M288,419L372,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,532 329,537 329,528" style="fill:rgb(0,0,0)"/>
<path d="M313,532L334,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,495 367,499 367,490" style="fill:rgb(0,0,0)"/>
<path d="M340,532 L 348,532 Q 355,532 355,517 L 355,510 Q 355,495 364,495 L 372,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,495 329,499 329,490" style="fill:rgb(0,0,0)"/>
<path d="M317,495L334,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,495L378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,457 329,461 329,452" style="fill:rgb(0,0,0)"/>
<path d="M294,457L334,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,457 L 348,457 Q 355,457 355,472 L 355,480 Q 355,495 367,495 L 378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="506,419 495,423 495,415" style="fill:rgb(0,0,0)"/>
<path d="M427,419L501,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M506,419L659,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="547,495 536,499 536,490" style="fill:rgb(0,0,0)"/>
<path d="M427,495L542,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,495 L 656,495 Q 671,495 671,480 L 671,434 Q 671,419 686,419 L 692,419 L 707,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,585L94,585L94,555L45,555Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,570 119,574 119,566" style="fill:rgb(0,0,0)"/>
<path d="M94,570L124,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,585L194,585A15 15 0 0 0 209 570A15 15 0 0 0 194 555L145,555A15 15 0 0 0 130 570A15 15 0 0 0 145 585Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="170" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ISNULL</text>
<polygon points="916,570 905,574 905,566" style="fill:rgb(0,0,0)"/>
<path d="M209,570L910,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,570 L 924,570 Q 931,570 931,563 L 931,555"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,570 33,574 33,566" style="fill:rgb(0,0,0)"/>
<path d="M24,555 L 24,563 Q 24,570 31,570 L 39,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,623L215,623A15 15 0 0 0 230 608A15 15 0 0 0 215 593L145,593A15 15 0 0 0 130 608A15 15 0 0 0 145 623Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="608" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTNULL</text>
<path d="M145,661L165,661A15 15 0 0 0 180 646A15 15 0 0 0 165 631L145,631A15 15 0 0 0 130 646A15 15 0 0 0 145 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="203,646 192,650 192,641" style="fill:rgb(0,0,0)"/>
<path d="M180,646L198,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,661L250,661A15 15 0 0 0 265 646A15 15 0 0 0 250 631L219,631A15 15 0 0 0 203 646A15 15 0 0 0 219 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="288,646 276,650 276,641" style="fill:rgb(0,0,0)"/>
<path d="M265,646L282,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="339,570 327,574 327,566" style="fill:rgb(0,0,0)"/>
<path d="M288,646 L 295,646 Q 303,646 303,631 L 303,585 Q 303,570 318,570 L 318,570 L 333,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="288,608 276,612 276,604" style="fill:rgb(0,0,0)"/>
<path d="M230,608L282,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,608 L 295,608 Q 303,608 303,600 L 303,593"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,646 119,650 119,641" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,631 Q 109,646 117,646 L 124,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,608 119,612 119,604" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,593 Q 109,608 117,608 L 124,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,699L94,699L94,668L45,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,684 106,688 106,679" style="fill:rgb(0,0,0)"/>
<path d="M94,684L111,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,699A15 15 0 0 0 147 684A15 15 0 0 0 132 668A15 15 0 0 0 117 684A15 15 0 0 0 132 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IS</text>
<polygon points="183,684 172,688 172,679" style="fill:rgb(0,0,0)"/>
<path d="M147,684L178,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M198,699L219,699A15 15 0 0 0 234 684A15 15 0 0 0 219 668L198,668A15 15 0 0 0 183 684A15 15 0 0 0 198 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="270,684 258,688 258,679" style="fill:rgb(0,0,0)"/>
<path d="M234,684L264,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="306,684 294,688 294,679" style="fill:rgb(0,0,0)"/>
<path d="M270,684L300,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,699L389,699A15 15 0 0 0 404 684A15 15 0 0 0 389 668L321,668A15 15 0 0 0 306 684A15 15 0 0 0 321 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="440,684 429,688 429,679" style="fill:rgb(0,0,0)"/>
<path d="M404,684L434,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,699L490,699A15 15 0 0 0 505 684A15 15 0 0 0 490 668L455,668A15 15 0 0 0 440 684A15 15 0 0 0 455 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="541,684 530,688 530,679" style="fill:rgb(0,0,0)"/>
<path d="M505,684L535,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,699L590,699L590,668L541,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,684 905,688 905,679" style="fill:rgb(0,0,0)"/>
<path d="M590,684L910,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,684 L 924,684 Q 931,684 931,676 L 931,669"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,684 33,688 33,679" style="fill:rgb(0,0,0)"/>
<path d="M24,668 L 24,676 Q 24,684 31,684 L 39,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,684 L 156,684 Q 164,684 164,696 Q 164,708 179,708 L 230,708 Q 245,708 245,696 Q 245,684 253,684 L 260,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,684 L 279,684 Q 286,684 286,696 Q 286,708 301,708 L 502,708 Q 517,708 517,696 Q 517,684 524,684 L 532,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,744L94,744L94,714L45,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,729 119,733 119,725" style="fill:rgb(0,0,0)"/>
<path d="M94,729L124,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,744L165,744A15 15 0 0 0 180 729A15 15 0 0 0 165 714L145,714A15 15 0 0 0 130 729A15 15 0 0 0 145 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,729 205,733 205,725" style="fill:rgb(0,0,0)"/>
<path d="M180,729L211,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,744L304,744A15 15 0 0 0 319 729A15 15 0 0 0 304 714L232,714A15 15 0 0 0 216 729A15 15 0 0 0 232 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="342,729 331,733 331,725" style="fill:rgb(0,0,0)"/>
<path d="M319,729L336,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M342,744L391,744L391,714L342,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="367" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="414,729 403,733 403,725" style="fill:rgb(0,0,0)"/>
<path d="M391,729L409,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M430,744L450,744A15 15 0 0 0 465 729A15 15 0 0 0 450 714L430,714A15 15 0 0 0 414 729A15 15 0 0 0 430 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="488,729 477,733 477,725" style="fill:rgb(0,0,0)"/>
<path d="M465,729L483,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,744L538,744L538,714L488,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="513" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,729 905,733 905,725" style="fill:rgb(0,0,0)"/>
<path d="M538,729L910,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,729 L 924,729 Q 931,729 931,721 L 931,714"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,729 33,733 33,725" style="fill:rgb(0,0,0)"/>
<path d="M24,714 L 24,721 Q 24,729 31,729 L 39,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,729 L 103,729 Q 110,729 110,741 Q 110,753 125,753 L 177,753 Q 192,753 192,741 Q 192,729 199,729 L 207,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,797L94,797L94,767L45,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,782 119,786 119,778" style="fill:rgb(0,0,0)"/>
<path d="M94,782L124,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,797L165,797A15 15 0 0 0 180 782A15 15 0 0 0 165 767L145,767A15 15 0 0 0 130 782A15 15 0 0 0 145 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,782 205,786 205,778" style="fill:rgb(0,0,0)"/>
<path d="M180,782L211,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,797L234,797A15 15 0 0 0 249 782A15 15 0 0 0 234 767L232,767A15 15 0 0 0 216 782A15 15 0 0 0 232 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IN</text>
<polygon points="285,782 273,786 273,778" style="fill:rgb(0,0,0)"/>
<path d="M249,782L279,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,797A15 15 0 0 0 315 782A15 15 0 0 0 300 767A15 15 0 0 0 285 782A15 15 0 0 0 300 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,782 340,786 340,778" style="fill:rgb(0,0,0)"/>
<path d="M315,782L345,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,797L455,797L455,767L351,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="491,782 480,786 480,778" style="fill:rgb(0,0,0)"/>
<path d="M455,782L486,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M507,797A15 15 0 0 0 522 782A15 15 0 0 0 507 767A15 15 0 0 0 491 782A15 15 0 0 0 507 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="507" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,782 905,786 905,778" style="fill:rgb(0,0,0)"/>
<path d="M522,782L910,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,782 L 924,782 Q 931,782 931,774 L 931,767"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,782 33,786 33,778" style="fill:rgb(0,0,0)"/>
<path d="M24,767 L 24,774 Q 24,782 31,782 L 39,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,782 L 103,782 Q 110,782 110,794 Q 110,806 125,806 L 177,806 Q 192,806 192,794 Q 192,782 199,782 L 207,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,782 L 324,782 Q 332,782 332,770 Q 332,758 347,758 L 452,758 Q 467,758 467,770 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M379,835L428,835L428,805L379,805Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="820" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="379,820 367,824 367,815" style="fill:rgb(0,0,0)"/>
<path d="M317,782 L 324,782 Q 332,782 332,797 L 332,805 Q 332,820 347,820 L 358,820 L 373,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M428,820 L 452,820 Q 467,820 467,805 L 467,797 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,873A15 15 0 0 0 418 857A15 15 0 0 0 403 842A15 15 0 0 0 388 857A15 15 0 0 0 403 873Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="857" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,857 430,853 430,862" style="fill:rgb(0,0,0)"/>
<path d="M428,820 L 435,820 Q 443,820 443,835 L 443,842 Q 443,857 434,857 L 424,857"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,857 L 371,857 Q 356,857 356,842 L 356,835 Q 356,820 363,820 L 371,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,925L396,925A15 15 0 0 0 412 910A15 15 0 0 0 396 895L300,895A15 15 0 0 0 285 910A15 15 0 0 0 300 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="429,910 417,915 417,906" style="fill:rgb(0,0,0)"/>
<path d="M412,910L423,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,925A15 15 0 0 0 459 910A15 15 0 0 0 444 895A15 15 0 0 0 429 910A15 15 0 0 0 444 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="513,910 502,915 502,906" style="fill:rgb(0,0,0)"/>
<path d="M459,910L507,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,925L627,925A15 15 0 0 0 642 910A15 15 0 0 0 627 895L528,895A15 15 0 0 0 513 910A15 15 0 0 0 528 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="577" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function</text>
<polygon points="659,910 647,915 647,906" style="fill:rgb(0,0,0)"/>
<path d="M642,910L653,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,925A15 15 0 0 0 689 910A15 15 0 0 0 674 895A15 15 0 0 0 659 910A15 15 0 0 0 674 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="734,910 723,915 723,906" style="fill:rgb(0,0,0)"/>
<path d="M689,910L728,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,925L783,925L783,895L734,895Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="828,910 817,915 817,906" style="fill:rgb(0,0,0)"/>
<path d="M783,910L823,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M844,925A15 15 0 0 0 859 910A15 15 0 0 0 844 895A15 15 0 0 0 828 910A15 15 0 0 0 844 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="844" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,910 905,915 905,906" style="fill:rgb(0,0,0)"/>
<path d="M859,910L910,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,910 L 924,910 Q 931,910 931,903 L 931,895"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,865L603,865A15 15 0 0 0 619 850A15 15 0 0 0 603 835L528,835A15 15 0 0 0 513 850A15 15 0 0 0 528 865Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="850" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="916,850 905,854 905,846" style="fill:rgb(0,0,0)"/>
<path d="M619,850L910,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,850 L 924,850 Q 931,850 931,842 L 931,835"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="513,850 502,854 502,846" style="fill:rgb(0,0,0)"/>
<path d="M475,910 L 483,910 Q 490,910 490,895 L 490,865 Q 490,850 499,850 L 507,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,892A15 15 0 0 0 774 877A15 15 0 0 0 759 862A15 15 0 0 0 744 877A15 15 0 0 0 759 892Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="877" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="774,877 785,873 785,881" style="fill:rgb(0,0,0)"/>
<path d="M783,910 L 791,910 Q 798,910 798,895 L 798,892 Q 798,877 789,877 L 780,877"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M744,877 L 726,877 Q 711,877 711,892 L 711,895 Q 711,910 719,910 L 726,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M689,910 L 697,910 Q 704,910 704,921 Q 704,932 719,932 L 790,932 Q 805,932 805,921 Q 805,910 813,910 L 820,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="285,910 273,915 273,906" style="fill:rgb(0,0,0)"/>
<path d="M249,782 L 256,782 Q 264,782 264,797 L 264,895 Q 264,910 272,910 L 279,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,882 412,886 412,877" style="fill:rgb(0,0,0)"/>
<path d="M264,867 L 264,874 Q 264,882 279,882 L 402,882 L 417,882"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,882 L 456,882 Q 471,882 471,896 Q 471,910 478,910 L 486,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,971L80,971A15 15 0 0 0 95 956A15 15 0 0 0 80 941L60,941A15 15 0 0 0 45 956A15 15 0 0 0 60 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="131,956 120,960 120,951" style="fill:rgb(0,0,0)"/>
<path d="M95,956L125,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,971L191,971A15 15 0 0 0 206 956A15 15 0 0 0 191 941L146,941A15 15 0 0 0 131 956A15 15 0 0 0 146 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="242,956 231,960 231,951" style="fill:rgb(0,0,0)"/>
<path d="M206,956L236,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,971A15 15 0 0 0 272 956A15 15 0 0 0 257 941A15 15 0 0 0 242 956A15 15 0 0 0 257 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="295,956 284,960 284,951" style="fill:rgb(0,0,0)"/>
<path d="M272,956L290,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,971L400,971L400,941L295,941Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="423,956 411,960 411,951" style="fill:rgb(0,0,0)"/>
<path d="M400,956L417,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,971A15 15 0 0 0 453 956A15 15 0 0 0 438 941A15 15 0 0 0 423 956A15 15 0 0 0 438 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,956 905,960 905,951" style="fill:rgb(0,0,0)"/>
<path d="M453,956L910,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,956 L 924,956 Q 931,956 931,948 L 931,941"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,956 33,960 33,951" style="fill:rgb(0,0,0)"/>
<path d="M24,941 L 24,948 Q 24,956 31,956 L 39,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,929 59,934 59,925" style="fill:rgb(0,0,0)"/>
<path d="M24,914 L 24,922 Q 24,929 39,929 L 49,929 L 64,929"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,929 L 201,929 Q 216,929 216,943 Q 216,956 223,956 L 231,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,929 L 101,929 Q 108,929 108,943 Q 108,956 116,956 L 123,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,1009L89,1009A15 15 0 0 0 104 994A15 15 0 0 0 89 978L60,978A15 15 0 0 0 45 994A15 15 0 0 0 60 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASE</text>
<polygon points="140,994 128,998 128,989" style="fill:rgb(0,0,0)"/>
<path d="M104,994L134,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M140,1009L189,1009L189,978L140,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="243,994 232,998 232,989" style="fill:rgb(0,0,0)"/>
<path d="M189,994L237,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,1009L298,1009A15 15 0 0 0 313 994A15 15 0 0 0 298 978L258,978A15 15 0 0 0 243 994A15 15 0 0 0 258 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="336,994 324,998 324,989" style="fill:rgb(0,0,0)"/>
<path d="M313,994L330,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,1009L385,1009L385,978L336,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="408,994 396,998 396,989" style="fill:rgb(0,0,0)"/>
<path d="M385,994L402,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,1009L456,1009A15 15 0 0 0 472 994A15 15 0 0 0 456 978L423,978A15 15 0 0 0 408 994A15 15 0 0 0 423 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">THEN</text>
<polygon points="495,994 483,998 483,989" style="fill:rgb(0,0,0)"/>
<path d="M472,994L489,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M495,1009L544,1009L544,978L495,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="616,994 604,998 604,989" style="fill:rgb(0,0,0)"/>
<path d="M544,994L610,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M631,1009L658,1009A15 15 0 0 0 673 994A15 15 0 0 0 658 978L631,978A15 15 0 0 0 616 994A15 15 0 0 0 631 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="645" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ELSE</text>
<polygon points="696,994 685,998 685,989" style="fill:rgb(0,0,0)"/>
<path d="M673,994L691,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M696,1009L746,1009L746,978L696,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="721" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="782,994 770,998 770,989" style="fill:rgb(0,0,0)"/>
<path d="M746,994L776,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M797,1009L818,1009A15 15 0 0 0 833 994A15 15 0 0 0 818 978L797,978A15 15 0 0 0 782 994A15 15 0 0 0 797 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="807" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="916,994 905,998 905,989" style="fill:rgb(0,0,0)"/>
<path d="M833,994L910,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,994 L 924,994 Q 931,994 931,986 L 931,979"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,994 33,998 33,989" style="fill:rgb(0,0,0)"/>
<path d="M24,978 L 24,986 Q 24,994 31,994 L 39,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,994 L 111,994 Q 119,994 119,1007 Q 119,1021 134,1021 L 186,1021 Q 201,1021 201,1007 Q 201,994 208,994 L 216,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="360,1021 372,1016 372,1025" style="fill:rgb(0,0,0)"/>
<path d="M544,994 L 551,994 Q 559,994 559,1007 Q 559,1021 544,1021 L 381,1021 L 366,1021"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,1021 L 235,1021 Q 220,1021 220,1007 Q 220,994 227,994 L 235,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,994 L 585,994 Q 593,994 593,1007 Q 593,1021 608,1021 L 742,1021 Q 757,1021 757,1007 Q 757,994 765,994 L 772,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,1066L173,1066L173,1036L45,1036Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="1051" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">raise-function</text>
<polygon points="916,1051 905,1055 905,1047" style="fill:rgb(0,0,0)"/>
<path d="M173,1051L910,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,1051 L 924,1051 Q 931,1051 931,1036 L 931,32 Q 931,17 939,17 L 946,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,1051 33,1055 33,1047" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,1036 Q 24,1051 31,1051 L 39,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/filter-clause.html">filter-clause:</a></b>
<button id='x602d13d8' onclick='hideorshow("x602d13d8","xe834c618")'>show</button></p>
 <div id='xe834c618' style='display:none;' class='imgcontainer'>
 <div style="max-width:422px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 422.381 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L93,32A15 15 0 0 0 108 17A15 15 0 0 0 93 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FILTER</text>
<polygon points="131,17 119,21 119,12" style="fill:rgb(0,0,0)"/>
<path d="M108,17L125,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,32L146,32A15 15 0 0 0 161 17A15 15 0 0 0 146 2L146,2A15 15 0 0 0 131 17A15 15 0 0 0 146 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="184,17 173,21 173,12" style="fill:rgb(0,0,0)"/>
<path d="M161,17L178,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M199,32L249,32A15 15 0 0 0 264 17A15 15 0 0 0 249 2L199,2A15 15 0 0 0 184 17A15 15 0 0 0 199 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="224" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="287,17 275,21 275,12" style="fill:rgb(0,0,0)"/>
<path d="M264,17L281,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,32L336,32L336,2L287,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M336,17L353,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,32A15 15 0 0 0 389 17A15 15 0 0 0 374 2A15 15 0 0 0 359 17A15 15 0 0 0 374 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="374" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="413,17 401,21 401,12" style="fill:rgb(0,0,0)"/>
<path d="M389,17L407,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="416" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/function-arguments.html">function-arguments:</a></b>
<button id='x770c1f78' onclick='hideorshow("x770c1f78","x32720c35")'>show</button></p>
 <div id='x32720c35' style='display:none;' class='imgcontainer'>
 <div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.566 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,26 55,30 55,22" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,41 L 43,41 Q 43,26 52,26 L 61,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M82,41L150,41A15 15 0 0 0 165 26L165,26A15 15 0 0 0 150 11L82,11A15 15 0 0 0 66 26L66,26A15 15 0 0 0 82 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="183,26 171,30 171,22" style="fill:rgb(0,0,0)"/>
<path d="M165,26L177,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M183,26 L 189,26 Q 194,26 194,41 L 194,41 Q 194,56 203,56 L 212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M218,56L248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,71L303,71L303,41L254,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="447,56 435,60 435,52" style="fill:rgb(0,0,0)"/>
<path d="M303,56L441,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="116,56 104,60 104,52" style="fill:rgb(0,0,0)"/>
<path d="M32,56L110,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M116,56L212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,32A15 15 0 0 0 293 17A15 15 0 0 0 278 2A15 15 0 0 0 263 17A15 15 0 0 0 278 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="293,17 305,12 305,21" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 314,56 Q 326,56 326,41 L 326,32 Q 326,17 312,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M263,17 L 245,17 Q 230,17 230,32 L 230,41 Q 230,56 239,56 L 248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,207A15 15 0 0 0 243 192L243,192A15 15 0 0 0 228 177A15 15 0 0 0 213 192L213,192A15 15 0 0 0 228 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="213,192 201,196 201,188" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,71 L 43,177 Q 43,192 58,192 L 192,192 L 207,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,192 267,196 267,188" style="fill:rgb(0,0,0)"/>
<path d="M243,192L272,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,192 L 360,192 Q 375,192 390,192 L 394,192 Q 409,192 409,177 L 409,71 Q 409,56 415,56 L 421,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="228,216 216,221 216,212" style="fill:rgb(0,0,0)"/>
<path d="M116,192 L 181,192 Q 196,192 196,204 Q 196,216 209,216 L 222,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,216 L 242,216 Q 257,216 257,204 Q 257,192 262,192 L 268,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="90,117 78,121 78,112" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 313,56 Q 323,56 323,71 L 323,71 Q 323,86 308,86 L 81,86 Q 66,86 66,101 L 66,102 Q 66,117 75,117 L 84,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,132L149,132A15 15 0 0 0 164 117L164,117A15 15 0 0 0 149 101L105,101A15 15 0 0 0 90 117L90,117A15 15 0 0 0 105 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="182,117 170,121 170,112" style="fill:rgb(0,0,0)"/>
<path d="M164,117L176,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,132L201,132A15 15 0 0 0 216 117L216,117A15 15 0 0 0 201 101L197,101A15 15 0 0 0 182 117L182,117A15 15 0 0 0 197 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M216,117L239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,132L375,132L375,101L245,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,169A15 15 0 0 0 325 154A15 15 0 0 0 310 139A15 15 0 0 0 294 154A15 15 0 0 0 310 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,154 336,150 336,159" style="fill:rgb(0,0,0)"/>
<path d="M375,117 L 380,117 Q 386,117 386,132 L 386,139 Q 386,154 371,154 L 345,154 L 330,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M294,154 L 260,154 Q 245,154 236,154 Q 227,154 227,139 L 227,132 Q 227,117 233,117 L 239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M375,117 L 383,117 Q 392,117 392,102 L 392,71 Q 392,56 407,56 L 413,56 L 428,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/literal-value.html">literal-value:</a></b>
<button id='x70a693a3' onclick='hideorshow("x70a693a3","xd0c92bb3")'>show</button></p>
 <div id='xd0c92bb3' style='display:none;' class='imgcontainer'>
 <div style="max-width:341px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 341.376 336.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,319 39,324 39,315" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,304 Q 24,319 34,319 L 45,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,334L252,334A15 15 0 0 0 267 319A15 15 0 0 0 252 304L65,304A15 15 0 0 0 50 319A15 15 0 0 0 65 334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIMESTAMP</text>
<polygon points="290,319 278,324 278,315" style="fill:rgb(0,0,0)"/>
<path d="M267,319L284,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,17 320,21 320,12" style="fill:rgb(0,0,0)"/>
<path d="M290,319 L 297,319 Q 305,319 305,304 L 305,32 Q 305,17 315,17 L 326,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="335" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L172,32A15 15 0 0 0 187 17A15 15 0 0 0 172 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="119" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,17L320,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L153,70A15 15 0 0 0 168 55L168,55A15 15 0 0 0 153 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">string-literal</text>
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,47 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,55 278,59 278,50" style="fill:rgb(0,0,0)"/>
<path d="M168,55L284,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,55 L 297,55 Q 305,55 305,47 L 305,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L140,108A15 15 0 0 0 155 92A15 15 0 0 0 140 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">blob-literal</text>
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,85 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,92 278,97 278,88" style="fill:rgb(0,0,0)"/>
<path d="M155,92L284,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,92 L 297,92 Q 305,92 305,85 L 305,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,145L97,145A15 15 0 0 0 112 130A15 15 0 0 0 97 115L66,115A15 15 0 0 0 50 130A15 15 0 0 0 66 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="50,130 39,135 39,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 34,130 L 45,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,130 278,135 278,126" style="fill:rgb(0,0,0)"/>
<path d="M112,130L284,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,130 L 297,130 Q 305,130 305,123 L 305,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,183L96,183A15 15 0 0 0 111 168A15 15 0 0 0 96 153L66,153A15 15 0 0 0 50 168A15 15 0 0 0 66 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRUE</text>
<polygon points="50,168 39,172 39,164" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,160 Q 24,168 34,168 L 45,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,168 278,172 278,164" style="fill:rgb(0,0,0)"/>
<path d="M111,168L284,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,168 L 297,168 Q 305,168 305,160 L 305,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,221L104,221A15 15 0 0 0 119 206A15 15 0 0 0 104 191L66,191A15 15 0 0 0 50 206A15 15 0 0 0 66 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FALSE</text>
<polygon points="50,206 39,210 39,201" style="fill:rgb(0,0,0)"/>
<path d="M24,191 L 24,198 Q 24,206 34,206 L 45,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,206 278,210 278,201" style="fill:rgb(0,0,0)"/>
<path d="M119,206L284,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,206 L 297,206 Q 305,206 305,198 L 305,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,259L190,259A15 15 0 0 0 205 244A15 15 0 0 0 190 228L66,228A15 15 0 0 0 50 244A15 15 0 0 0 66 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="128" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIME</text>
<polygon points="50,244 39,248 39,239" style="fill:rgb(0,0,0)"/>
<path d="M24,228 L 24,236 Q 24,244 34,244 L 45,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,244 278,248 278,239" style="fill:rgb(0,0,0)"/>
<path d="M205,244L284,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,244 L 297,244 Q 305,244 305,236 L 305,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,297L192,297A15 15 0 0 0 207 281A15 15 0 0 0 192 266L66,266A15 15 0 0 0 50 281A15 15 0 0 0 66 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_DATE</text>
<polygon points="50,281 39,286 39,277" style="fill:rgb(0,0,0)"/>
<path d="M24,266 L 24,274 Q 24,281 34,281 L 45,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,281 278,286 278,277" style="fill:rgb(0,0,0)"/>
<path d="M207,281L284,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,281 L 297,281 Q 305,281 305,274 L 305,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/over-clause.html">over-clause:</a></b>
<button id='x030f27a0' onclick='hideorshow("x030f27a0","x47bd97ad")'>show</button></p>
 <div id='x47bd97ad' style='display:none;' class='imgcontainer'>
 <div style="max-width:600px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 600.706 418.392">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="129,17 117,21 117,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L123,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M144,32L241,32A15 15 0 0 0 256 17A15 15 0 0 0 241 2L144,2A15 15 0 0 0 129 17A15 15 0 0 0 144 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,17 L 100,17 Q 108,17 108,32 L 108,40 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,70A15 15 0 0 0 165 55L165,55A15 15 0 0 0 149 39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 149 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="149" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="206,82 195,86 195,77" style="fill:rgb(0,0,0)"/>
<path d="M165,55 L 172,55 Q 180,55 180,68 Q 180,82 190,82 L 200,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,97L363,97A15 15 0 0 0 378 82A15 15 0 0 0 363 67L221,67A15 15 0 0 0 206 82A15 15 0 0 0 221 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="292" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M221,173L301,173A15 15 0 0 0 316 157A15 15 0 0 0 301 142L221,142A15 15 0 0 0 206 157A15 15 0 0 0 221 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="339,157 328,162 328,153" style="fill:rgb(0,0,0)"/>
<path d="M316,157L333,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,173L358,173A15 15 0 0 0 373 157A15 15 0 0 0 358 142L354,142A15 15 0 0 0 339 157A15 15 0 0 0 354 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="409,157 398,162 398,153" style="fill:rgb(0,0,0)"/>
<path d="M373,157L404,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,173L459,173L459,142L409,142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M434,210A15 15 0 0 0 449 195A15 15 0 0 0 434 180A15 15 0 0 0 419 195A15 15 0 0 0 434 210Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="195" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="449,195 461,191 461,200" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,180 Q 474,195 464,195 L 455,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,195 L 398,195 Q 383,195 383,180 L 383,172 Q 383,157 390,157 L 398,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,55 280,59 280,50" style="fill:rgb(0,0,0)"/>
<path d="M165,55L286,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,120 304,115 304,124" style="fill:rgb(0,0,0)"/>
<path d="M292,55 L 401,55 Q 416,55 416,70 L 416,105 Q 416,120 401,120 L 313,120 L 298,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,157 195,162 195,153" style="fill:rgb(0,0,0)"/>
<path d="M292,120 L 180,120 Q 165,120 165,135 L 165,142 Q 165,157 180,157 L 185,157 L 200,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="401,82 389,86 389,77" style="fill:rgb(0,0,0)"/>
<path d="M378,82L395,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,82 L 408,82 Q 416,82 416,89 L 416,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,286L266,286A15 15 0 0 0 281 271A15 15 0 0 0 266 256L221,256A15 15 0 0 0 206 271A15 15 0 0 0 221 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="244" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="304,271 292,275 292,266" style="fill:rgb(0,0,0)"/>
<path d="M281,271L298,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M319,286L323,286A15 15 0 0 0 338 271A15 15 0 0 0 323 256L319,256A15 15 0 0 0 304 271A15 15 0 0 0 319 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="321" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="374,271 363,275 363,266" style="fill:rgb(0,0,0)"/>
<path d="M338,271L368,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,286L504,286L504,256L374,256Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M439,324A15 15 0 0 0 454 309A15 15 0 0 0 439 293A15 15 0 0 0 424 309A15 15 0 0 0 439 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="454,309 466,304 466,313" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,294 Q 519,309 504,309 L 475,309 L 460,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,309 L 363,309 Q 348,309 348,294 L 348,286 Q 348,271 355,271 L 363,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,233 304,229 304,237" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,218 Q 474,233 459,233 L 313,233 L 298,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,271 195,275 195,266" style="fill:rgb(0,0,0)"/>
<path d="M292,233 L 180,233 Q 165,233 165,248 L 165,256 Q 165,271 180,271 L 185,271 L 200,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,195 160,184 169,184" style="fill:rgb(0,0,0)"/>
<path d="M165,142L165,189"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,195L165,256"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,399L311,399L311,369L206,369Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="384" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="519,384 508,389 508,380" style="fill:rgb(0,0,0)"/>
<path d="M311,384L513,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M534,399A15 15 0 0 0 549 384A15 15 0 0 0 534 369A15 15 0 0 0 519 384A15 15 0 0 0 534 399Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="384" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="591,17 579,21 579,12" style="fill:rgb(0,0,0)"/>
<path d="M549,384 L 557,384 Q 564,384 564,369 L 564,32 Q 564,17 575,17 L 585,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="594" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,17 508,21 508,12" style="fill:rgb(0,0,0)"/>
<path d="M256,17L513,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,17L579,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,346 304,342 304,351" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,331 Q 519,346 504,346 L 313,346 L 298,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,384 195,389 195,380" style="fill:rgb(0,0,0)"/>
<path d="M292,346 L 180,346 Q 165,346 165,361 L 165,369 Q 165,384 180,384 L 185,384 L 200,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,309 160,297 169,297" style="fill:rgb(0,0,0)"/>
<path d="M165,256L165,303"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,309L165,369"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="258,411 247,416 247,407" style="fill:rgb(0,0,0)"/>
<path d="M165,369 L 165,396 Q 165,411 180,411 L 238,411 L 253,411"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,384 369,389 369,380" style="fill:rgb(0,0,0)"/>
<path d="M258,411 L 335,411 Q 350,411 350,398 Q 350,384 362,384 L 375,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='xf39497d8' onclick='hideorshow("xf39497d8","xe4020276")'>show</button></p>
 <div id='xe4020276' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/raise-function.html">raise-function:</a></b>
<button id='x26a734da' onclick='hideorshow("x26a734da","x68c58a39")'>show</button></p>
 <div id='x68c58a39' style='display:none;' class='imgcontainer'>
 <div style="max-width:627px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 627.302 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L82,32A15 15 0 0 0 97 17A15 15 0 0 0 82 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RAISE</text>
<polygon points="120,17 109,21 109,12" style="fill:rgb(0,0,0)"/>
<path d="M97,17L114,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,32L135,32A15 15 0 0 0 150 17A15 15 0 0 0 135 2L135,2A15 15 0 0 0 120 17A15 15 0 0 0 135 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="135" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="192,55 180,59 180,50" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 158,17 Q 165,17 165,32 L 165,40 Q 165,55 176,55 L 186,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,70L285,70A15 15 0 0 0 300 55L300,55A15 15 0 0 0 285 39L207,39A15 15 0 0 0 192 55L192,55A15 15 0 0 0 207 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="336,55 324,59 324,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70A15 15 0 0 0 366 55L366,55A15 15 0 0 0 351 39A15 15 0 0 0 336 55L336,55A15 15 0 0 0 351 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="389,55 378,59 378,50" style="fill:rgb(0,0,0)"/>
<path d="M366,55L383,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,70L508,70A15 15 0 0 0 523 55L523,55A15 15 0 0 0 508 39L404,39A15 15 0 0 0 389 55L389,55A15 15 0 0 0 404 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="456" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">error-message</text>
<polygon points="564,17 553,21 553,12" style="fill:rgb(0,0,0)"/>
<path d="M523,55 L 530,55 Q 538,55 538,40 L 538,32 Q 538,17 548,17 L 558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M579,32A15 15 0 0 0 594 17A15 15 0 0 0 579 2A15 15 0 0 0 564 17A15 15 0 0 0 579 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="617,17 606,21 606,12" style="fill:rgb(0,0,0)"/>
<path d="M594,17L612,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="621" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L259,32A15 15 0 0 0 274 17A15 15 0 0 0 259 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="456,17 444,21 444,12" style="fill:rgb(0,0,0)"/>
<path d="M274,17L450,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,17L553,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,108L249,108A15 15 0 0 0 264 92A15 15 0 0 0 249 77L207,77A15 15 0 0 0 192 92A15 15 0 0 0 207 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="300,92 288,97 288,88" style="fill:rgb(0,0,0)"/>
<path d="M264,92L294,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,92 L 307,92 Q 315,92 315,77 L 315,70 Q 315,55 322,55 L 330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,145L229,145A15 15 0 0 0 244 130A15 15 0 0 0 229 115L207,115A15 15 0 0 0 192 130A15 15 0 0 0 207 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="300,130 288,135 288,126" style="fill:rgb(0,0,0)"/>
<path d="M244,130L294,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,130 L 307,130 Q 315,130 315,115 L 315,92 L 315,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,130 180,135 180,126" style="fill:rgb(0,0,0)"/>
<path d="M165,39 L 165,115 Q 165,130 176,130 L 186,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,92 180,97 180,88" style="fill:rgb(0,0,0)"/>
<path d="M165,77 L 165,85 Q 165,92 176,92 L 186,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/type-name.html">type-name:</a></b>
<button id='x8c34b136' onclick='hideorshow("x8c34b136","xc3bbd814")'>show</button></p>
 <div id='xc3bbd814' style='display:none;' class='imgcontainer'>
 <div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.008 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L87,32A15 15 0 0 0 102 17A15 15 0 0 0 87 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="165,92 153,97 153,88" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,77 Q 138,92 149,92 L 159,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,108A15 15 0 0 0 195 92A15 15 0 0 0 180 77A15 15 0 0 0 165 92A15 15 0 0 0 180 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,92 201,97 201,88" style="fill:rgb(0,0,0)"/>
<path d="M195,92L207,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,108L350,108L350,77L212,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,92 356,97 356,88" style="fill:rgb(0,0,0)"/>
<path d="M350,92L362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,108A15 15 0 0 0 398 92A15 15 0 0 0 382 77A15 15 0 0 0 367 92A15 15 0 0 0 382 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="415,92 403,97 403,88" style="fill:rgb(0,0,0)"/>
<path d="M398,92L409,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,108L553,108L553,77L415,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="570,92 558,97 558,88" style="fill:rgb(0,0,0)"/>
<path d="M553,92L564,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,108A15 15 0 0 0 600 92A15 15 0 0 0 585 77A15 15 0 0 0 570 92A15 15 0 0 0 585 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="585" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="651,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M600,92 L 608,92 Q 615,92 615,77 L 615,32 Q 615,17 630,17 L 630,17 L 645,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,40 Q 138,55 149,55 L 159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70A15 15 0 0 0 195 55L195,55A15 15 0 0 0 180 39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,55 201,59 201,50" style="fill:rgb(0,0,0)"/>
<path d="M195,55L207,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,70L350,70L350,39L212,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,55 356,59 356,50" style="fill:rgb(0,0,0)"/>
<path d="M350,55L362,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,70A15 15 0 0 0 398 55L398,55A15 15 0 0 0 382 39A15 15 0 0 0 367 55L367,55A15 15 0 0 0 382 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="600,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M398,55L594,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M600,55 L 608,55 Q 615,55 615,47 L 615,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="74,47 85,43 85,51" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 110,17 Q 117,17 117,32 L 117,32 Q 117,47 102,47 L 94,47 L 79,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47 L 33,47 Q 18,47 18,32 L 18,32 Q 18,17 26,17 L 33,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="382,17 371,21 371,12" style="fill:rgb(0,0,0)"/>
<path d="M102,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,17L630,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='x1609a87f' onclick='hideorshow("x1609a87f","x65ac8197")'>show</button></p>
 <div id='x65ac8197' style='display:none;' class='imgcontainer'>
 <div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/join-clause.html">join-clause:</a></b>
<button id='xf5c00d6b' onclick='hideorshow("xf5c00d6b","x582424d1")'>show</button></p>
 <div id='x582424d1' style='display:none;' class='imgcontainer'>
 <div style="max-width:793px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 793.282 84.24">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L193,32L193,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="259,47 247,51 247,43" style="fill:rgb(0,0,0)"/>
<path d="M193,17 L 200,17 Q 208,17 208,32 L 208,32 Q 208,47 223,47 L 238,47 L 253,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,62L380,62L380,32L259,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-operator</text>
<polygon points="403,47 391,51 391,43" style="fill:rgb(0,0,0)"/>
<path d="M380,47L397,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,62L564,62L564,32L403,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="587,47 575,51 575,43" style="fill:rgb(0,0,0)"/>
<path d="M564,47L581,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M587,62L721,62L721,32L587,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="654" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-constraint</text>
<polygon points="783,17 772,21 772,12" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 742,47 Q 757,47 757,32 L 757,32 Q 757,17 767,17 L 778,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="787" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M193,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,17L776,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,77 495,73 495,82" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 728,47 Q 736,47 736,62 L 736,62 Q 736,77 721,77 L 504,77 L 489,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,77 L 247,77 Q 232,77 232,62 L 232,62 Q 232,47 246,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/join-constraint.html">join-constraint:</a></b>
<button id='x860aa348' onclick='hideorshow("x860aa348","xb552ec34")'>show</button></p>
 <div id='xb552ec34' style='display:none;' class='imgcontainer'>
 <div style="max-width:483px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 483.336 126.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L104,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 104 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="143,55 131,59 131,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L137,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,70A15 15 0 0 0 173 55L173,55A15 15 0 0 0 158 39A15 15 0 0 0 143 55L143,55A15 15 0 0 0 158 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="209,55 197,59 197,50" style="fill:rgb(0,0,0)"/>
<path d="M173,55L203,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M224,70L318,70A15 15 0 0 0 333 55L333,55A15 15 0 0 0 318 39L224,39A15 15 0 0 0 209 55L209,55A15 15 0 0 0 224 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="369,55 358,59 358,50" style="fill:rgb(0,0,0)"/>
<path d="M333,55L363,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,70A15 15 0 0 0 399 55L399,55A15 15 0 0 0 384 39A15 15 0 0 0 369 55L369,55A15 15 0 0 0 384 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="422,55 411,59 411,50" style="fill:rgb(0,0,0)"/>
<path d="M399,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="473,17 462,21 462,12" style="fill:rgb(0,0,0)"/>
<path d="M422,55 L 430,55 Q 437,55 437,40 L 437,32 Q 437,17 452,17 L 453,17 L 468,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="477" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,108A15 15 0 0 0 286 92A15 15 0 0 0 271 77A15 15 0 0 0 256 92A15 15 0 0 0 271 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="286,92 298,88 298,97" style="fill:rgb(0,0,0)"/>
<path d="M333,55 L 341,55 Q 348,55 348,70 L 348,77 Q 348,92 333,92 L 307,92 L 292,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,92 L 197,92 Q 182,92 182,77 L 182,70 Q 182,55 190,55 L 197,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L74,32A15 15 0 0 0 90 17A15 15 0 0 0 74 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="113,17 101,21 101,12" style="fill:rgb(0,0,0)"/>
<path d="M90,17L107,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M113,32L162,32L162,2L113,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="422,17 411,21 411,12" style="fill:rgb(0,0,0)"/>
<path d="M162,17L417,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,17L462,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="209,120 197,124 197,115" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,105 Q 24,120 39,120 L 188,120 L 203,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,120 L 422,120 Q 437,120 437,105 L 437,54 L 437,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-operator.html">join-operator:</a></b>
<button id='x5d08be87' onclick='hideorshow("x5d08be87","xeaa9fca0")'>show</button></p>
 <div id='xeaa9fca0' style='display:none;' class='imgcontainer'>
 <div style="max-width:620px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 620.333 255.312">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,71 39,76 39,67" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,56 Q 24,71 34,71 L 45,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,86L133,86A15 15 0 0 0 148 71A15 15 0 0 0 133 56L66,56A15 15 0 0 0 50 71A15 15 0 0 0 66 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="99" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NATURAL</text>
<polygon points="189,41 178,45 178,37" style="fill:rgb(0,0,0)"/>
<path d="M148,71 L 155,71 Q 163,71 163,56 L 163,56 Q 163,41 173,41 L 184,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,71 219,76 219,67" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,56 Q 204,71 215,71 L 225,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,86L273,86A15 15 0 0 0 288 71A15 15 0 0 0 273 56L246,56A15 15 0 0 0 231 71A15 15 0 0 0 246 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LEFT</text>
<polygon points="378,71 366,76 366,67" style="fill:rgb(0,0,0)"/>
<path d="M288,71L372,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,86L437,86A15 15 0 0 0 452 71A15 15 0 0 0 437 56L393,56A15 15 0 0 0 378 71A15 15 0 0 0 393 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OUTER</text>
<polygon points="475,71 463,76 463,67" style="fill:rgb(0,0,0)"/>
<path d="M452,71L469,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="516,41 505,45 505,37" style="fill:rgb(0,0,0)"/>
<path d="M475,71 L 482,71 Q 490,71 490,56 L 490,56 Q 490,41 500,41 L 511,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,56L554,56A15 15 0 0 0 569 41A15 15 0 0 0 554 26L532,26A15 15 0 0 0 516 41A15 15 0 0 0 532 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="543" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">JOIN</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M569,41 L 576,41 Q 584,41 584,29 Q 584,17 594,17 L 605,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="614" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,32A15 15 0 0 0 325 17A15 15 0 0 0 310 2A15 15 0 0 0 295 17A15 15 0 0 0 310 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="295,17 283,21 283,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L289,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M325,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="99,41 88,45 88,37" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,29 Q 24,41 39,41 L 78,41 L 93,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M99,41L178,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,41L505,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,41 366,45 366,37" style="fill:rgb(0,0,0)"/>
<path d="M336,71 L 344,71 Q 351,71 351,56 L 351,56 Q 351,41 362,41 L 372,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,109 219,113 219,105" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,94 Q 204,109 215,109 L 225,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,124L284,124A15 15 0 0 0 299 109A15 15 0 0 0 284 94L246,94A15 15 0 0 0 231 109A15 15 0 0 0 246 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RIGHT</text>
<polygon points="341,71 329,76 329,67" style="fill:rgb(0,0,0)"/>
<path d="M299,109 L 307,109 Q 314,109 314,94 L 314,86 Q 314,71 324,71 L 335,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,147 219,151 219,142" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,132 Q 204,147 215,147 L 225,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,162L274,162A15 15 0 0 0 289 147A15 15 0 0 0 274 132L246,132A15 15 0 0 0 231 147A15 15 0 0 0 246 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FULL</text>
<path d="M289,147 L 302,147 Q 314,147 314,132 L 314,109 L 314,94"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,192 219,196 219,188" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,177 Q 204,192 215,192 L 225,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,207L287,207A15 15 0 0 0 302 192A15 15 0 0 0 287 177L246,177A15 15 0 0 0 231 192A15 15 0 0 0 246 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="192" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INNER</text>
<polygon points="475,192 463,196 463,188" style="fill:rgb(0,0,0)"/>
<path d="M302,192L469,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,192 L 482,192 Q 490,192 490,185 L 490,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,238 219,242 219,233" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,223 Q 24,238 39,238 L 210,238 L 225,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,253L287,253A15 15 0 0 0 303 238A15 15 0 0 0 287 222L246,222A15 15 0 0 0 231 238A15 15 0 0 0 246 253Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="238" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CROSS</text>
<polygon points="475,238 463,242 463,233" style="fill:rgb(0,0,0)"/>
<path d="M303,238L469,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,238 L 482,238 Q 490,238 490,223 L 490,71 L 490,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x06e5f232' onclick='hideorshow("x06e5f232","x4c24f5b3")'>show</button></p>
 <div id='x4c24f5b3' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/result-column.html">result-column:</a></b>
<button id='xb11109fd' onclick='hideorshow("xb11109fd","xb0b592ae")'>show</button></p>
 <div id='xb0b592ae' style='display:none;' class='imgcontainer'>
 <div style="max-width:398px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 398.054 163.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L94,32L94,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="136,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M94,17 L 102,17 Q 109,17 109,32 L 109,40 Q 109,55 119,55 L 130,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M151,70L155,70A15 15 0 0 0 170 55L170,55A15 15 0 0 0 155 39L151,39A15 15 0 0 0 136 55L136,55A15 15 0 0 0 151 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="206,55 194,59 194,50" style="fill:rgb(0,0,0)"/>
<path d="M170,55L200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,70L309,70A15 15 0 0 0 324 55L324,55A15 15 0 0 0 309 39L221,39A15 15 0 0 0 206 55L206,55A15 15 0 0 0 221 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="347,55 335,59 335,50" style="fill:rgb(0,0,0)"/>
<path d="M324,55L341,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,17 377,21 377,12" style="fill:rgb(0,0,0)"/>
<path d="M347,55 L 354,55 Q 362,55 362,40 L 362,32 Q 362,17 372,17 L 382,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="392" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,85 141,89 141,81" style="fill:rgb(0,0,0)"/>
<path d="M109,39 L 109,70 Q 109,85 124,85 L 132,85 L 147,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,85 L 170,85 Q 185,85 185,70 L 185,70 Q 185,55 192,55 L 200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="241,17 230,21 230,12" style="fill:rgb(0,0,0)"/>
<path d="M94,17L235,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M241,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,108 39,112 39,103" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,93 Q 24,108 34,108 L 45,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,123A15 15 0 0 0 81 108A15 15 0 0 0 66 92A15 15 0 0 0 50 108A15 15 0 0 0 66 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="108" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,108 335,112 335,103" style="fill:rgb(0,0,0)"/>
<path d="M81,108L341,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,108 L 354,108 Q 362,108 362,93 L 362,54 L 362,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,145 39,150 39,141" style="fill:rgb(0,0,0)"/>
<path d="M24,92 L 24,130 Q 24,145 34,145 L 45,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,160L141,160A15 15 0 0 0 156 145A15 15 0 0 0 141 130L66,130A15 15 0 0 0 50 145A15 15 0 0 0 66 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="145" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="179,145 167,150 167,141" style="fill:rgb(0,0,0)"/>
<path d="M156,145L173,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M194,160A15 15 0 0 0 209 145A15 15 0 0 0 194 130A15 15 0 0 0 179 145A15 15 0 0 0 194 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="232,145 221,150 221,141" style="fill:rgb(0,0,0)"/>
<path d="M209,145L226,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,160A15 15 0 0 0 262 145A15 15 0 0 0 247 130A15 15 0 0 0 232 145A15 15 0 0 0 247 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,145 335,150 335,141" style="fill:rgb(0,0,0)"/>
<path d="M262,145L341,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,145 L 354,145 Q 362,145 362,130 L 362,107 L 362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/table-or-subquery.html">table-or-subquery:</a></b>
<button id='x1c2f6135' onclick='hideorshow("x1c2f6135","x330fd8ed")'>show</button></p>
 <div id='x330fd8ed' style='display:none;' class='imgcontainer'>
 <div style="max-width:720px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 720.778 457.704">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,74 39,78 39,70" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,59 Q 24,74 34,74 L 45,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,89L162,89A15 15 0 0 0 177 74L177,74A15 15 0 0 0 162 59L66,59A15 15 0 0 0 50 74L50,74A15 15 0 0 0 66 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="194,74 183,78 183,70" style="fill:rgb(0,0,0)"/>
<path d="M177,74L189,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,89A15 15 0 0 0 225 74L225,74A15 15 0 0 0 209 59A15 15 0 0 0 194 74L194,74A15 15 0 0 0 209 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="266,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M225,74 L 232,74 Q 240,74 240,59 L 240,51 Q 240,36 250,36 L 260,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,51L356,51A15 15 0 0 0 371 36A15 15 0 0 0 356 21L281,21A15 15 0 0 0 266 36A15 15 0 0 0 281 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="407,36 396,41 396,32" style="fill:rgb(0,0,0)"/>
<path d="M371,36L402,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,51L427,51A15 15 0 0 0 442 36A15 15 0 0 0 427 21L423,21A15 15 0 0 0 407 36A15 15 0 0 0 423 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="478,36 466,41 466,32" style="fill:rgb(0,0,0)"/>
<path d="M442,36L472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,51L561,51A15 15 0 0 0 577 36A15 15 0 0 0 561 21L493,21A15 15 0 0 0 478 36A15 15 0 0 0 493 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="527" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<path d="M9,36L255,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="422,6 411,10 411,2" style="fill:rgb(0,0,0)"/>
<path d="M371,36 L 379,36 Q 386,36 386,21 L 386,21 Q 386,6 401,6 L 402,6 L 417,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 442,6 Q 457,6 457,21 L 457,21 Q 457,36 464,36 L 472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 577,6 Q 592,6 592,21 L 592,21 Q 592,36 599,36 L 607,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,127L388,127A15 15 0 0 0 403 112A15 15 0 0 0 388 97L323,97A15 15 0 0 0 308 112A15 15 0 0 0 323 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="426,112 415,116 415,108" style="fill:rgb(0,0,0)"/>
<path d="M403,112L420,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,127L445,127A15 15 0 0 0 460 112A15 15 0 0 0 445 97L441,97A15 15 0 0 0 426 112A15 15 0 0 0 441 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="443" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="483,112 472,116 472,108" style="fill:rgb(0,0,0)"/>
<path d="M460,112L478,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,127L577,127A15 15 0 0 0 592 112A15 15 0 0 0 577 97L499,97A15 15 0 0 0 483 112A15 15 0 0 0 499 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="538" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M323,165L343,165A15 15 0 0 0 359 150A15 15 0 0 0 343 135L323,135A15 15 0 0 0 308 150A15 15 0 0 0 323 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="382,150 370,154 370,145" style="fill:rgb(0,0,0)"/>
<path d="M359,150L376,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,165L461,165A15 15 0 0 0 476 150A15 15 0 0 0 461 135L397,135A15 15 0 0 0 382 150A15 15 0 0 0 397 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="527,74 539,70 539,78" style="fill:rgb(0,0,0)"/>
<path d="M577,36 L 607,36 Q 622,36 622,51 L 622,59 Q 622,74 607,74 L 548,74 L 533,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,150 297,154 297,145" style="fill:rgb(0,0,0)"/>
<path d="M527,74 L 297,74 Q 282,74 282,89 L 282,135 Q 282,150 292,150 L 302,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,112 297,116 297,108" style="fill:rgb(0,0,0)"/>
<path d="M282,97 L 282,104 Q 282,112 292,112 L 302,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="266,213 255,217 255,209" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,198 Q 24,213 39,213 L 245,213 L 260,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,228L431,228A15 15 0 0 0 446 213A15 15 0 0 0 431 198L281,198A15 15 0 0 0 266 213A15 15 0 0 0 281 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function-name</text>
<polygon points="463,213 452,217 452,209" style="fill:rgb(0,0,0)"/>
<path d="M446,213L457,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,228A15 15 0 0 0 493 213A15 15 0 0 0 478 198A15 15 0 0 0 463 213A15 15 0 0 0 478 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="529,213 518,217 518,209" style="fill:rgb(0,0,0)"/>
<path d="M493,213L524,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M529,228L579,228L579,198L529,198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="615,213 603,217 603,209" style="fill:rgb(0,0,0)"/>
<path d="M579,213L609,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M630,228A15 15 0 0 0 645 213A15 15 0 0 0 630 198A15 15 0 0 0 615 213A15 15 0 0 0 630 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="630" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="675,187 679,198 671,198" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 660,213 Q 675,213 675,203 L 675,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M554,190A15 15 0 0 0 569 175A15 15 0 0 0 554 160A15 15 0 0 0 539 175A15 15 0 0 0 554 190Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="175" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="569,175 581,171 581,180" style="fill:rgb(0,0,0)"/>
<path d="M579,213 L 586,213 Q 594,213 594,198 L 594,190 Q 594,175 584,175 L 575,175"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,175 L 518,175 Q 503,175 503,190 L 503,198 Q 503,213 510,213 L 518,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,74 L 232,74 Q 240,74 240,89 L 240,198 Q 240,213 247,213 L 255,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,112 648,116 648,108" style="fill:rgb(0,0,0)"/>
<path d="M592,112L654,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,112 L 667,112 Q 675,112 675,104 L 675,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,150 648,154 648,145" style="fill:rgb(0,0,0)"/>
<path d="M476,150L654,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,150 L 667,150 Q 675,150 675,142 L 675,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M577,36L690,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,304L411,304A15 15 0 0 0 426 289A15 15 0 0 0 411 274L407,274A15 15 0 0 0 392 289A15 15 0 0 0 407 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="498,289 487,293 487,284" style="fill:rgb(0,0,0)"/>
<path d="M426,289L492,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M513,304L582,304A15 15 0 0 0 597 289A15 15 0 0 0 582 274L513,274A15 15 0 0 0 498 289A15 15 0 0 0 513 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="548" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<polygon points="660,289 648,293 648,284" style="fill:rgb(0,0,0)"/>
<path d="M597,289L654,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,289 L 667,289 Q 675,289 675,281 L 675,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="548,251 559,247 559,255" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 652,213 Q 660,213 660,228 L 660,236 Q 660,251 645,251 L 568,251 L 553,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M548,251 L 370,251 Q 355,251 355,266 L 355,274 Q 355,289 370,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,251 L 464,251 Q 457,251 457,266 L 457,274 Q 457,289 464,289 L 472,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,327 39,331 39,322" style="fill:rgb(0,0,0)"/>
<path d="M24,198 L 24,312 Q 24,327 34,327 L 45,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,342A15 15 0 0 0 81 327A15 15 0 0 0 66 311A15 15 0 0 0 50 327A15 15 0 0 0 66 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,327 92,331 92,322" style="fill:rgb(0,0,0)"/>
<path d="M81,327L98,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,342L208,342L208,311L104,311Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="327" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="231,327 219,331 219,322" style="fill:rgb(0,0,0)"/>
<path d="M208,327L225,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,342A15 15 0 0 0 261 327A15 15 0 0 0 246 311A15 15 0 0 0 231 327A15 15 0 0 0 246 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M261,327 L 269,327 Q 276,327 276,312 L 276,304 Q 276,289 291,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,327 648,331 648,322" style="fill:rgb(0,0,0)"/>
<path d="M261,327L654,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,327 L 667,327 Q 675,327 675,319 L 675,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,327 L 432,327 Q 439,327 439,312 L 439,304 Q 439,289 447,289 L 454,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,364 39,369 39,360" style="fill:rgb(0,0,0)"/>
<path d="M24,311 L 24,349 Q 24,364 34,364 L 45,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,379A15 15 0 0 0 81 364A15 15 0 0 0 65 349A15 15 0 0 0 50 364A15 15 0 0 0 65 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="135,364 123,369 123,360" style="fill:rgb(0,0,0)"/>
<path d="M81,364L129,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,379L296,379L296,349L135,349Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="364" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="350,364 338,369 338,360" style="fill:rgb(0,0,0)"/>
<path d="M296,364L344,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,379A15 15 0 0 0 380 364A15 15 0 0 0 365 349A15 15 0 0 0 350 364A15 15 0 0 0 365 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="660,364 648,369 648,360" style="fill:rgb(0,0,0)"/>
<path d="M380,364L654,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="711,36 699,41 699,32" style="fill:rgb(0,0,0)"/>
<path d="M660,364 L 667,364 Q 675,364 675,349 L 675,51 Q 675,36 690,36 L 690,36 L 705,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="715" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,417A15 15 0 0 0 230 402A15 15 0 0 0 215 387A15 15 0 0 0 200 402A15 15 0 0 0 215 417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="402" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="230,402 242,398 242,406" style="fill:rgb(0,0,0)"/>
<path d="M296,364 L 303,364 Q 311,364 311,379 L 311,387 Q 311,402 296,402 L 251,402 L 236,402"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,402 L 123,402 Q 108,402 108,387 L 108,379 Q 108,364 116,364 L 123,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="122,440 111,444 111,436" style="fill:rgb(0,0,0)"/>
<path d="M81,364 L 88,364 Q 96,364 96,379 L 96,425 Q 96,440 106,440 L 116,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M122,455L224,455L224,425L122,425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M224,440 L 308,440 Q 323,440 323,425 L 323,379 Q 323,364 331,364 L 338,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/window-defn.html">window-defn:</a></b>
<button id='x4be5e445' onclick='hideorshow("x4be5e445","x3d108126")'>show</button></p>
 <div id='x3d108126' style='display:none;' class='imgcontainer'>
 <div style="max-width:479px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 479.765 380.592">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,44 92,48 92,40" style="fill:rgb(0,0,0)"/>
<path d="M62,17 L 70,17 Q 77,17 77,30 Q 77,44 88,44 L 98,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,59L260,59A15 15 0 0 0 275 44L275,44A15 15 0 0 0 260 29L119,29A15 15 0 0 0 104 44L104,44A15 15 0 0 0 119 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M119,135L198,135A15 15 0 0 0 214 120A15 15 0 0 0 198 104L119,104A15 15 0 0 0 104 120A15 15 0 0 0 119 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="237,120 225,124 225,115" style="fill:rgb(0,0,0)"/>
<path d="M214,120L231,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M252,135L256,135A15 15 0 0 0 271 120A15 15 0 0 0 256 104L252,104A15 15 0 0 0 237 120A15 15 0 0 0 252 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="307,120 295,124 295,115" style="fill:rgb(0,0,0)"/>
<path d="M271,120L301,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,135L356,135L356,104L307,104Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M332,173A15 15 0 0 0 347 157A15 15 0 0 0 332 142A15 15 0 0 0 316 157A15 15 0 0 0 332 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="157" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="347,157 358,153 358,162" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,142 Q 371,157 362,157 L 352,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,157 L 295,157 Q 280,157 280,142 L 280,135 Q 280,120 288,120 L 295,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,17 178,21 178,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L184,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,82 201,77 201,86" style="fill:rgb(0,0,0)"/>
<path d="M190,17 L 298,17 Q 313,17 313,32 L 313,67 Q 313,82 298,82 L 210,82 L 195,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,120 92,124 92,115" style="fill:rgb(0,0,0)"/>
<path d="M190,82 L 77,82 Q 62,82 62,97 L 62,105 Q 62,120 77,120 L 83,120 L 98,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,44 287,48 287,40" style="fill:rgb(0,0,0)"/>
<path d="M275,44L293,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,44 L 306,44 Q 313,44 313,51 L 313,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,248L163,248A15 15 0 0 0 178 233A15 15 0 0 0 163 218L119,218A15 15 0 0 0 104 233A15 15 0 0 0 119 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="201,233 190,237 190,229" style="fill:rgb(0,0,0)"/>
<path d="M178,233L196,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,248L221,248A15 15 0 0 0 236 233A15 15 0 0 0 221 218L217,218A15 15 0 0 0 201 233A15 15 0 0 0 217 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="272,233 260,237 260,229" style="fill:rgb(0,0,0)"/>
<path d="M236,233L266,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,248L402,248L402,218L272,218Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M337,286A15 15 0 0 0 352 271A15 15 0 0 0 337 256A15 15 0 0 0 322 271A15 15 0 0 0 337 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="352,271 363,266 363,275" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,256 Q 417,271 402,271 L 373,271 L 358,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M322,271 L 260,271 Q 245,271 245,256 L 245,248 Q 245,233 253,233 L 260,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,195 201,191 201,200" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,180 Q 371,195 356,195 L 210,195 L 195,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,233 92,237 92,229" style="fill:rgb(0,0,0)"/>
<path d="M190,195 L 77,195 Q 62,195 62,210 L 62,218 Q 62,233 77,233 L 83,233 L 98,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,157 58,146 66,146" style="fill:rgb(0,0,0)"/>
<path d="M62,104L62,152"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,157L62,218"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,362L208,362L208,331L104,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="417,346 405,351 405,342" style="fill:rgb(0,0,0)"/>
<path d="M208,346L411,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,362A15 15 0 0 0 447 346A15 15 0 0 0 432 331A15 15 0 0 0 417 346A15 15 0 0 0 432 362Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="470,346 458,351 458,342" style="fill:rgb(0,0,0)"/>
<path d="M447,346L464,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="474" cy="346" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,309 201,304 201,313" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,294 Q 417,309 402,309 L 210,309 L 195,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,346 92,351 92,342" style="fill:rgb(0,0,0)"/>
<path d="M190,309 L 77,309 Q 62,309 62,324 L 62,331 Q 62,346 77,346 L 83,346 L 98,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,271 58,259 66,259" style="fill:rgb(0,0,0)"/>
<path d="M62,218L62,265"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,271L62,331"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,374 144,378 144,369" style="fill:rgb(0,0,0)"/>
<path d="M62,331 L 62,359 Q 62,374 77,374 L 135,374 L 150,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,346 266,351 266,342" style="fill:rgb(0,0,0)"/>
<path d="M156,374 L 233,374 Q 248,374 248,360 Q 248,346 260,346 L 272,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='xdf970994' onclick='hideorshow("xdf970994","xfb058079")'>show</button></p>
 <div id='xfb058079' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
</div>


<h1 id="description"><span>2. </span>Description</h1>

<p>The CREATE VIEW command assigns a name to a pre-packaged 
<a href="lang_select.html">SELECT</a> statement. 
Once the view is created, it can be used in the FROM clause
of another <a href="lang_select.html">SELECT</a> in place of a table name.
</p>

<p>If the "TEMP" or "TEMPORARY" keyword occurs in between "CREATE"
and "VIEW" then the view that is created is only visible to the
<a href="c3ref/sqlite3.html">database connection</a> that created it and is automatically deleted when
the database connection is closed.</p>

<p> If a <span class='yyterm'>schema-name</span> is specified, then the view 
is created in the specified database.
It is an error to specify both a <span class='yyterm'>schema-name</span>
and the TEMP keyword on a VIEW, unless the <span class='yyterm'>schema-name</span> 
is "temp".
If no schema name is specified, and the TEMP keyword is not present,
the VIEW is created in the main database.</p>

<p>You cannot <a href="lang_delete.html">DELETE</a>, <a href="lang_insert.html">INSERT</a>, or <a href="lang_update.html">UPDATE</a> a view.  Views are read-only 
in SQLite.  However, in many cases you can use an
<a href="lang_createtrigger.html#instead_of_trigger">INSTEAD OF trigger</a> on the view to accomplish 
the same thing.  Views are removed 
with the <a href="lang_dropview.html">DROP VIEW</a> command.</p>

<p>If a <span class='yyterm'>column-name</span> list follows 
the <span class='yyterm'>view-name</span>, then that list determines
the names of the columns for the view.  If the <span class='yyterm'>column-name</span>
list is omitted, then the names of the columns in the view are derived
from the names of the result-set columns in the <a href="syntax/select-stmt.html">select-stmt</a>.
The use of <span class='yyterm'>column-name</span> list is recommended.  Or, if
<span class='yyterm'>column-name</span> list is omitted, then the result
columns in the <a href="lang_select.html">SELECT</a> statement that defines the view should have
well-defined names using the 
"<a href="syntax/result-column.html">AS column-alias</a>" syntax.
SQLite allows you to create views that depend on automatically 
generated column names, but you should avoid using them since the 
rules used to generate column names are not a defined part of the
interface and might change in future releases of SQLite.

</p><p>The <span class='yyterm'>column-name</span> list syntax was added in
SQLite versions 3.9.0 (2015-10-14).

</p><p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_createview.in?m=8fb825fdb8">2022-01-08 05:02:57</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_createvtab.html.









































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>CREATE VIRTUAL TABLE</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
CREATE VIRTUAL TABLE
</div>
</div>





<p><b><a href="syntax/create-virtual-table-stmt.html">create-virtual-table-stmt:</a></b>
<button id='xcb22bf27' onclick='hideorshow("xcb22bf27","xaec3630e")'>hide</button></p>
 <div id='xaec3630e' class='imgcontainer'>
 <div style="max-width:624px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 624.096 259.848">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L100,32A15 15 0 0 0 116 17A15 15 0 0 0 100 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CREATE</text>
<polygon points="139,17 127,21 127,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L133,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M154,32L213,32A15 15 0 0 0 228 17A15 15 0 0 0 213 2L154,2A15 15 0 0 0 139 17A15 15 0 0 0 154 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VIRTUAL</text>
<polygon points="251,17 240,21 240,12" style="fill:rgb(0,0,0)"/>
<path d="M228,17L246,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,32L306,32A15 15 0 0 0 321 17A15 15 0 0 0 306 2L266,2A15 15 0 0 0 251 17A15 15 0 0 0 266 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="286" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TABLE</text>
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M321,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M372,32A15 15 0 0 0 387 17A15 15 0 0 0 372 2A15 15 0 0 0 357 17A15 15 0 0 0 372 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="372" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="410,17 399,21 399,12" style="fill:rgb(0,0,0)"/>
<path d="M387,17L404,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M425,32L445,32A15 15 0 0 0 461 17A15 15 0 0 0 445 2L425,2A15 15 0 0 0 410 17A15 15 0 0 0 425 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="435" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="484,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M461,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,32L543,32A15 15 0 0 0 558 17A15 15 0 0 0 543 2L499,2A15 15 0 0 0 484 17A15 15 0 0 0 499 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="521" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<path d="M47,108L143,108A15 15 0 0 0 159 92A15 15 0 0 0 143 77L47,77A15 15 0 0 0 32 92A15 15 0 0 0 47 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="95" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="182,92 170,97 170,88" style="fill:rgb(0,0,0)"/>
<path d="M159,92L176,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,108A15 15 0 0 0 212 92A15 15 0 0 0 197 77A15 15 0 0 0 182 92A15 15 0 0 0 197 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="197" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="248,92 236,97 236,88" style="fill:rgb(0,0,0)"/>
<path d="M212,92L242,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M263,108L338,108A15 15 0 0 0 353 92A15 15 0 0 0 338 77L263,77A15 15 0 0 0 248 92A15 15 0 0 0 263 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<path d="M47,219L86,219A15 15 0 0 0 101 204A15 15 0 0 0 86 189L47,189A15 15 0 0 0 32 204A15 15 0 0 0 47 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="67" y="204" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="124,204 113,209 113,200" style="fill:rgb(0,0,0)"/>
<path d="M101,204L118,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M139,219L234,219A15 15 0 0 0 249 204A15 15 0 0 0 234 189L139,189A15 15 0 0 0 124 204A15 15 0 0 0 139 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="204" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">module-name</text>
<polygon points="285,204 274,209 274,200" style="fill:rgb(0,0,0)"/>
<path d="M249,204L279,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,219A15 15 0 0 0 315 204A15 15 0 0 0 300 189A15 15 0 0 0 285 204A15 15 0 0 0 300 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="204" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,204 340,209 340,200" style="fill:rgb(0,0,0)"/>
<path d="M315,204L346,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,219L497,219A15 15 0 0 0 512 204A15 15 0 0 0 497 189L366,189A15 15 0 0 0 351 204A15 15 0 0 0 366 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="204" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">module-argument</text>
<polygon points="548,204 536,209 536,200" style="fill:rgb(0,0,0)"/>
<path d="M512,204L542,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M563,219A15 15 0 0 0 578 204A15 15 0 0 0 563 189A15 15 0 0 0 548 204A15 15 0 0 0 563 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="563" y="204" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="614,204 603,209 603,200" style="fill:rgb(0,0,0)"/>
<path d="M578,204L608,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="618" cy="204" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,257A15 15 0 0 0 447 242A15 15 0 0 0 432 227A15 15 0 0 0 417 242A15 15 0 0 0 432 257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="242" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="447,242 458,238 458,246" style="fill:rgb(0,0,0)"/>
<path d="M512,204 L 519,204 Q 527,204 527,219 L 527,227 Q 527,242 512,242 L 468,242 L 453,242"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,242 L 343,242 Q 328,242 328,227 L 328,219 Q 328,204 336,204 L 343,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="432,180 420,184 420,176" style="fill:rgb(0,0,0)"/>
<path d="M249,204 L 257,204 Q 264,204 264,192 Q 264,180 279,180 L 411,180 L 426,180"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,180 L 576,180 Q 591,180 591,192 Q 591,204 599,204 L 606,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="187,153 198,149 198,157" style="fill:rgb(0,0,0)"/>
<path d="M353,92 L 361,92 Q 368,92 368,107 L 368,138 Q 368,153 353,153 L 207,153 L 192,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,204 20,209 20,200" style="fill:rgb(0,0,0)"/>
<path d="M187,153 L 20,153 Q 5,153 5,168 L 5,189 Q 5,204 16,204 L 26,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="429,62 441,58 441,66" style="fill:rgb(0,0,0)"/>
<path d="M558,17 L 566,17 Q 573,17 573,32 L 573,47 Q 573,62 558,62 L 450,62 L 435,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,92 20,97 20,88" style="fill:rgb(0,0,0)"/>
<path d="M429,62 L 20,62 Q 5,62 5,77 L 5,77 Q 5,92 16,92 L 26,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,47 332,35 340,35" style="fill:rgb(0,0,0)"/>
<path d="M321,17 L 328,17 Q 336,17 336,29 L 336,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,47 L 336,54 Q 336,62 328,62 L 321,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="95,123 84,127 84,118" style="fill:rgb(0,0,0)"/>
<path d="M5,77 L 5,108 Q 5,123 20,123 L 74,123 L 89,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,123 L 210,123 Q 225,123 225,108 L 225,107 Q 225,92 231,92 L 236,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>


<p>A <a href="vtab.html">virtual table</a> is an interface to an external storage or computation
engine that appears to be a table but does not actually store information
in the database file.</p>

<p>In general, you can do anything with a <a href="vtab.html">virtual table</a> that can be done
with an ordinary table, except that you cannot create indices or triggers on a
virtual table.  Some virtual table implementations might impose additional
restrictions.  For example, many virtual tables are read-only.</p>

<p>The <span class='yyterm'>module-name</span> is the name of an object that implements
the virtual table.  The <span class='yyterm'>module-name</span> must be registered with
the SQLite database connection using
<a href="c3ref/create_module.html">sqlite3_create_module()</a> or <a href="c3ref/create_module.html">sqlite3_create_module_v2()</a>
prior to issuing the CREATE VIRTUAL TABLE statement.
The module takes zero or more comma-separated arguments.
The arguments can be just about any text as long as it has balanced
parentheses.  The argument syntax is sufficiently general that the
arguments can be made to appear as <a href="lang_createtable.html#tablecoldef">column definitions</a> in a traditional
<a href="lang_createtable.html">CREATE TABLE</a> statement.  
SQLite passes the module arguments directly
to the <a href="vtab.html#xcreate">xCreate</a> and <a href="vtab.html#xconnect">xConnect</a> methods of the module implementation
without any interpretation.  It is the responsibility
of the module implementation to parse and interpret its own arguments.</p>

<p>A virtual table is destroyed using the ordinary
<a href="lang_droptable.html">DROP TABLE</a> statement.  There is no
DROP VIRTUAL TABLE statement.</p>
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_createvtab.in?m=73c535b61b">2022-01-08 05:02:57</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_datefunc.html.













































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>Date And Time Functions</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
Date And Time Functions
</div>
<div class="fancy_toc">
<a onclick="toggle_toc()">
<span class="fancy_toc_mark" id="toc_mk">&#x25ba;</span>
Table Of Contents
</a>
<div id="toc_sub"><div class="fancy-toc1"><a href="#overview">1. Overview</a></div>
<div class="fancy-toc2"><a href="#timediff_">1.1. Timediff()</a></div>
<div class="fancy-toc1"><a href="#time_values">2. Time Values</a></div>
<div class="fancy-toc1"><a href="#modifiers">3. Modifiers</a></div>
<div class="fancy-toc1"><a href="#examples">4. Examples</a></div>
<div class="fancy-toc1"><a href="#caveats_and_bugs">5. Caveats And Bugs</a></div>
</div>
</div>
<script>
function toggle_toc(){
var sub = document.getElementById("toc_sub")
var mk = document.getElementById("toc_mk")
if( sub.style.display!="block" ){
sub.style.display = "block";
mk.innerHTML = "&#x25bc;";
} else {
sub.style.display = "none";
mk.innerHTML = "&#x25ba;";
}
}
</script>
</div>




<h1 id="overview"><span>1. </span>Overview</h1>

<p>
SQLite supports seven <a href="lang_corefunc.html">scalar</a> date and time functions as follows:
</p>

<p>
</p><ol>
<li> <b>date(</b><i>time-value, modifier, modifier, ...</i><b>)</b> </li>
<li> <b>time(</b><i>time-value, modifier, modifier, ...</i><b>)</b> </li>
<li> <b>datetime(</b><i>time-value, modifier, modifier, ...</i><b>)</b> </li>
<li> <b>julianday(</b><i>time-value, modifier, modifier, ...</i><b>)</b> </li>
<li> <b>unixepoch(</b><i>time-value, modifier, modifier, ...</i><b>)</b> </li>
<li> <b>strftime(</b><i>format, time-value, modifier, modifier, ...</i><b>)</b> </li>
<li> <b>timediff(</b><i>time-value, time-value</i><b>)</b> </li>
</ol>

<p>
The first six date and time functions take an optional time value as an argument, followed
by zero or more modifiers.
The strftime() function also takes a format string as its first argument.
The timediff() function takes exactly two arguments which are both time values.
</p>

<p>
Date and time values can be stored as
</p><ul>
<li> text in a subset of the <a href="http://en.wikipedia.org/wiki/ISO_8601">ISO-8601</a> format,
</li><li> numbers representing the <a href="http://en.wikipedia.org/wiki/Julian_day">Julian day</a>, or
</li><li> numbers representing the number of seconds since (or before) 1970-01-01 00:00:00 UTC
     (the unix timestamp).
</li></ul>

<p>
All of the date time functions access time-values as either ISO-8601 strings or
Julian day numbers.  They also access unix timestamps with optional arguments
(the 'auto' and 'unixepoch' modifiers described below).  Since the timediff()
function does not accept any optional argument, it can only use ISO-8601 and
Julian day number time values.

<a name="dttm"></a>

</p><p>
The date() function returns the date as text in this format: YYYY-MM-DD.

<a name="dttm"></a>

</p><p>
The time() function returns the time as text in this format: HH:MM:SS.

<a name="dttm"></a>

</p><p>
The datetime() function returns the date and time as text in this formats: YYYY-MM-DD HH:MM:SS.

<a name="jlndy"></a>

</p><p>
The julianday() function returns the 
<a href="http://en.wikipedia.org/wiki/Julian_day">Julian day</a> - the
fractional number of days since noon in Greenwich on November 24, 4714 B.C. 
(<a href="http://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar">Proleptic Gregorian calendar</a>).

<a name="uepch"></a>

</p><p>
The unixepoch() function returns a unix timestamp - the number of seconds
since 1970-01-01 00:00:00 UTC.  The unixepoch() function normally returns
an integer number of seconds, but with the optional <a href="lang_datefunc.html#subsec">subsec modifier</a> it
will return a floating point number which is the fractional number of seconds.

<a name="strftm"></a>

</p><p>
The strftime() routine returns the date formatted according to 
the format string specified as the first argument.
The format string supports the most common substitutions found in the 
<a href="http://opengroup.org/onlinepubs/007908799/xsh/strftime.html">strftime() function</a>
from the standard C library plus two new substitutions, %f and %J.
The following is a complete list of valid strftime() substitutions:
</p>

<blockquote>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td><td width="10"></td><td></td></tr>

<tr><td> %d </td><td></td><td> day of month: 00-31
</td></tr><tr><td> %e </td><td></td><td> day of month without leading zero: 0-31
</td></tr><tr><td> %f </td><td></td><td> fractional seconds: SS.SSS
</td></tr><tr><td> %F </td><td></td><td> ISO 8601 date: YYYY-MM-DD
</td></tr><tr><td> %H </td><td></td><td> hour: 00-24
</td></tr><tr><td> %I </td><td></td><td> hour for 12-hour clock: 01-12
</td></tr><tr><td> %j </td><td></td><td> day of year: 001-366
</td></tr><tr><td> %J </td><td></td><td> Julian day number (fractional)
</td></tr><tr><td> %k </td><td></td><td> hour without leading zero: 0-24
</td></tr><tr><td> %l </td><td></td><td> %I without leading zero: 1-12
</td></tr><tr><td> %m </td><td></td><td> month: 01-12
</td></tr><tr><td> %M </td><td></td><td> minute: 00-59
</td></tr><tr><td> %p </td><td></td><td> "AM" or "PM" depending on the hour
</td></tr><tr><td> %P </td><td></td><td> "am" or "pm" depending on the hour
</td></tr><tr><td> %R </td><td></td><td> ISO 8601 time: HH:MM
</td></tr><tr><td> %s </td><td></td><td> seconds since 1970-01-01
</td></tr><tr><td> %S </td><td></td><td> seconds: 00-59
</td></tr><tr><td> %T </td><td></td><td> ISO 8601 time: HH:MM:SS
</td></tr><tr><td> %u </td><td></td><td> day of week 1-7 with Monday==1
</td></tr><tr><td> %w </td><td></td><td> day of week 0-6 with Sunday==0
</td></tr><tr><td> %W </td><td></td><td> week of year: 00-53
</td></tr><tr><td> %Y </td><td></td><td> year: 0000-9999
</td></tr><tr><td> %% </td><td></td><td> %
</td></tr></table>
</blockquote>

<p>
Other date and time functions can be expressed
in terms of strftime():
</p>

<blockquote>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td><b>Function</b></td><td width="30"></td><td><b>Equivalent (or nearly) strftime()</b>
</td></tr><tr><td>   date(...)      </td><td></td><td>  strftime('%F', ...)
</td></tr><tr><td>   time(...)      </td><td></td><td>  strftime('%T', ...)
</td></tr><tr><td>   datetime(...)  </td><td></td><td>  strftime('%F %T', ...)
</td></tr><tr><td>   julianday(...) </td><td></td><td>  <nobr>strftime('%J', ...) -- (numeric return)</nobr>
</td></tr><tr><td>   unixepoch(...) </td><td></td><td>  <nobr>strftime('%s', ...) -- (numeric return)</nobr>
</td></tr></table>
</blockquote>

<p>
The date(), time(), and datetime() functions all return text, and so their
strftime() equivalents are exact.  However, the julianday()
and unixepoch() functions return numeric values.  Their strftime() equivalents
return a string that is the text representation of the corresponding number.
</p>

<p>
The main reasons for providing functions other than strftime() are
for convenience and for efficiency. The julianday() and unixepoch()
functions return real and integer values respectively, and do not
incur the format conversion costs or inexactitude resulting from use
of the '%J' or '%s' format specifiers with the strftime() function.
</p>

<a name="tmdif"></a>

<h2 id="timediff_"><span>1.1. </span>Timediff()</h2>

<p>
The timediff(A,B) routine returns a string that describes the amount
of time that must be added to B in order to reach time A.  The format of
the timediff() result is designed to be human-readable.  The format is:
</p><blockquote>
(+|-)YYYY-MM-DD HH:MM:SS.SSS
</blockquote>
<p>
This time difference string is also an allowed modifier for the other
date/time functions.  The following invariant holds for time values A
and B:
</p><blockquote>
datetime(A) = datetime(B, timediff(A,B))
</blockquote>

<p>
The length of months and years vary.  February is shorter than March.
Leap years are longer than non-leap years.  The output from timediff()
takes this all into account.  The timediff() function is intended to provide
a human-friendly description of the time span.  If you want to know the
number of days or seconds between two dates, A and B, then you can always do
one of these:
</p><blockquote>
SELECT julianday(B) - julianday(A);<br>
SELECT unixepoch(B) - unixepoch(A);
</blockquote>

<p>
The timediff(A,B) might return the same result even for values A and B
that span a different number of days - depending on the starting date.
For example, both of the following two timediff() calls return the
same result ("-0000-01-00 00:00:00.000") even though the first timespan
is 28 days and the seconds is 31 days:
</p><blockquote>
SELECT timediff('2023-02-15','2023-03-15');<br>
SELECT timediff('2023-03-15','2023-04-15');
</blockquote>
<p>
Summary:  If you want a human-friendly time span, use timediff().  If you
what a precise time difference (in days or seconds) use the difference
between two julianday() or unixepoch() calls.
</p>


<h1 id="time_values"><span>2. </span>Time Values</h1>

<p>A time value can be in any of the following formats shown below.
The value is usually a string, though it can be an integer or floating
point number in the case of format 12.

</p><ol>
<li> <i>YYYY-MM-DD</i>
</li><li> <i>YYYY-MM-DD HH:MM</i>
</li><li> <i>YYYY-MM-DD HH:MM:SS</i>
</li><li> <i>YYYY-MM-DD HH:MM:SS.SSS</i>
</li><li> <i>YYYY-MM-DD</i><b>T</b><i>HH:MM</i>
</li><li> <i>YYYY-MM-DD</i><b>T</b><i>HH:MM:SS</i>
</li><li> <i>YYYY-MM-DD</i><b>T</b><i>HH:MM:SS.SSS</i>
</li><li> <i>HH:MM</i>
</li><li> <i>HH:MM:SS</i>
</li><li> <i>HH:MM:SS.SSS</i>
</li><li> <b>now</b>
</li><li> <i>DDDDDDDDDD</i>
</li></ol>

<p>
In formats 5 through 7, the "T" is a literal character separating 
the date and the time, as required by 
<a href="http://www.w3c.org/TR/NOTE-datetime">ISO-8601</a>. 
Formats 8 through 10 that specify only a time assume a date of 
2000-01-01. Format 11, the string 'now', is converted into the 
current date and time as obtained from the xCurrentTime method
of the <a href="c3ref/vfs.html">sqlite3_vfs</a> object in use.
The 'now' argument to date and time functions always returns exactly the
same value for multiple invocations within the same <a href="c3ref/step.html">sqlite3_step()</a> call.
<a href="http://en.wikipedia.org/wiki/Coordinated_Universal_Time">Universal Coordinated Time (UTC)</a> is used. 
Format 12 is the 
<a href="http://en.wikipedia.org/wiki/Julian_day">Julian day number</a>
expressed as an integer or floating point value.
Format 12 might also be interpreted as a unix timestamp if it is immediately followed
either the 'auto' or 'unixepoch' modifier.
</p>

<p>
Formats 2 through 10 may be optionally followed by a timezone indicator of the form
"<i>&#91;+-&#93;HH:MM</i>" or just "<i>Z</i>".  The date and time functions use UTC or "zulu"
time internally, and so the "Z" suffix is a no-op.  Any non-zero "HH:MM" suffix is
subtracted from the indicated date and time in order to compute zulu time.
For example, all of the following time values are equivalent:
</p>

<blockquote>
2013-10-07 08:23:19.120<br>
2013-10-07T08:23:19.120Z<br>
2013-10-07 04:23:19.120-04:00<br>
2456572.84952685
</blockquote>

<p>
In formats 4, 7, and 10, the fractional seconds value SS.SSS can have
one or more digits following the decimal point.  Exactly three digits are
shown in the examples because only the first three digits are significant
to the result, but the input string can have fewer or more than three digits
and the date/time functions will still operate correctly.
Similarly, format 12 is shown with 10 significant digits, but the date/time
functions will really accept as many or as few digits as are necessary to
represent the Julian day number.
</p>

<p>
In all functions other than timediff(),
the time-value (and all modifiers) may be omitted, in which case a time
value of 'now' is assumed.

<a name="dtmods"></a>

</p><h1 id="modifiers"><span>3. </span>Modifiers</h1>

<p>For all date/time functions other than timediff(),
the time value argument can be followed by zero or more modifiers that 
alter date and/or time. Each modifier
is a transformation that is applied to the time value to its left.
Modifiers are applied from left to right; order is important.
The available modifiers are as follows.</p>

<ol>
<li value="1"> NNN days
</li><li value="2"> NNN hours
</li><li value="3"> NNN minutes
</li><li value="4"> NNN seconds
</li><li value="5"> NNN months
</li><li value="6"> NNN years
</li><li value="7"> &plusmn;HH:MM
</li><li value="8"> &plusmn;HH:MM:SS
</li><li value="9"> &plusmn;HH:MM:SS.SSS
</li><li value="10"> &plusmn;YYYY-MM-DD
</li><li value="11"> &plusmn;YYYY-MM-DD HH:MM
</li><li value="12"> &plusmn;YYYY-MM-DD HH:MM:SS
</li><li value="13"> &plusmn;YYYY-MM-DD HH:MM:SS.SSS
</li><li value="14"> start of month
</li><li value="15"> start of year
</li><li value="16"> start of day
</li><li value="17"> weekday N
</li><li value="18"> unixepoch
</li><li value="19"> julianday
</li><li value="20"> auto
</li><li value="21"> localtime
</li><li value="22"> utc
</li><li value="23"> subsec
</li><li value="24"> subsecond
</li></ol>

<p>The first thirteen modifiers (1 through 13) 
add the specified amount of time to the date and time 
specified by the arguments to its left.
The 's' character at the end of the modifier names in 1 through 6 is optional.
The NNN value can be any floating point number, with an optional '+' or '-' prefix.
Note that "&plusmn;NNN months" works by rendering the original date into
the YYYY-MM-DD format, adding the &plusmn;NNN to the MM month value, then
normalizing the result.  Thus, for example, the date 2001-03-31 modified
by '+1 month' initially yields 2001-04-31, but April only has 30 days
so the date is normalized to 2001-05-01.  A similar effect occurs when
the original date is February 29 of a leapyear and the modifier is
&plusmn;N years where N is not a multiple of four.</p>

<a name="tmshf"></a>

<p>The time shift modifiers (7 through 13) move the time value by the
number of years, months, days, hours, minutes, and/or seconds specified.
An initial "+" or "-" is required for formats 10 through 13 but is optional
for formats 7, 8, and 9.  The changes are applies from left to right.
First the year is shifted by YYYY, then the month by MM, and then day
by DD, and so forth.  The normalization and rounding due to differing month
lengths and leap years is applied after each step.  The
timediff(A,B) function returns a time shift in format 13 that shifts
the time value B into A.</p>

<p>The "start of" modifiers (14 through 16) shift the date backwards 
to the beginning of the subject month, year or day.</p>

<p>The "weekday" modifier advances the date forward, if necessary,
to the next date where the weekday number is N. Sunday is 0, Monday is 1,
and so forth.
If the date is already on the desired weekday, the "weekday" modifier
leaves the date unchanged.  </p>

<p>The "unixepoch" modifier (18) only works if it immediately follows 
a time value in the DDDDDDDDDD format. 
This modifier causes the DDDDDDDDDD to be interpreted not 
as a Julian day number as it normally would be, but as
<a href="http://en.wikipedia.org/wiki/Unix_time">Unix Time</a> - the 
number of seconds since 1970.  If the "unixepoch" modifier does not
follow a time value of the form DDDDDDDDDD which expresses the number
of seconds since 1970 or if other modifiers
separate the "unixepoch" modifier from prior DDDDDDDDDD then the
behavior is undefined.
For SQLite versions before 3.16.0 (2017-01-02), 
the "unixepoch" modifier only works for
dates between 0000-01-01 00:00:00 and 5352-11-01 10:52:47 (unix times
of -62167219200 through 106751991167).</p>

<a name="jdmod"></a>

<p>The "julianday" modifier must immediately follow the initial
time-value which must be of the form DDDDDDDDD.  Any other use of
the 'julianday' modifier is an error and causes the function to return NULL.
The 'julianday' modifier forces the time-value number to be interpreted
as a julian-day number.  As this is the default behavior, the 'julianday'
modifier is scarcely more than a no-op.  The only difference is that
adding 'julianday' forces the DDDDDDDDD time-value format, and causes
a NULL to be returned if any other time-value format is used.

<a name="automod"></a>

</p><p>The "auto" modifier must immediately follow the initial time-value.
If the time-value is numeric (the DDDDDDDDDD format) then the 'auto'
modifier causes the time-value to interpreted as either a julian day
number or a unix timestamp, depending on its magnitude.  If the value
is between 0.0 and 5373484.499999, then it is interpreted as a julian
day number (corresponding to dates between
-4713-11-24 12:00:00 and 9999-12-31 23:59:59, inclusive).  For numeric
values outside of the range of valid julian day numbers, but within 
the range of -210866760000 to 253402300799, the 'auto' modifier causes
the value to be interpreted as a unix timestamp.  Other numeric values
are out of range and cause a NULL return.  The 'auto' modifier is a no-op 
for text time-values.

</p><p>The 'auto' modifier can be used to work with date/time values even in
cases where it is not known if the julian day number or unix timestamp
formats are in use.  The 'auto' modifier will automatically select the
appropriate format.  However, there is a region of ambiguity.  Unix
timestamps for the first 63 days of 1970 will be interpreted as julian
day numbers.  The 'auto' modifier is very useful when the dataset is
guaranteed to not contain any dates within that region, but should be
avoided for applications that might make use of dates in the opening
months of 1970.

<a name="localtime"></a>

</p><p>The "localtime" modifier (21) assumes the time value to its left is in
Universal Coordinated Time (UTC) and adjusts that time
value so that it is in localtime.  If "localtime"
follows a time that is not UTC, then the behavior is undefined.
The "utc" modifier is the opposite of "localtime".  
"utc" assumes that the time value
to its left is in the local timezone and adjusts that time value to be in UTC.
If the time to the left is not in localtime, then the result of "utc" is
undefined.</p>

<a name="subsec"></a>

<p>
The "subsecond" modifier (which may be abbreviated as just
"subsec") increases the resolution of the output for
<a href="lang_datefunc.html#dttm">datetime()</a>, <a href="lang_datefunc.html#dttm">time()</a>, and <a href="lang_datefunc.html#uepch">unixepoch()</a>, and for the "%s"
format string in <a href="lang_datefunc.html#strftm">strftime()</a>.  The "subsecond"
modifier has no effect on other date/time functions.
The current implemention increases the resolution from seconds
to milliseconds, but this might increase to a higher resolution
in future releases of SQLite.  When "subsec" is used with
<a href="lang_datefunc.html#dttm">datetime()</a> or <a href="lang_datefunc.html#dttm">time()</a>, the seconds field at the end is
followed by a decimal point and one or more digits to show
fractional seconds.  When "subsec" is used with <a href="lang_datefunc.html#uepch">unixepoch()</a>,
the result is a floating point value which is the number of
seconds and fractional seconds since 1970-01-01.

</p><p>
The "subsecond" and "subsec" modifiers have the special property
that they can occur as the first argument to date/time functions
(or as the first argument after the format string for strftime()).
When this happens, the time value that is normally in the first
argument is understood to be "now".  For example, a short cut to
get the current time in seconds since 1970 with millisecond
precision is to say:

</p><blockquote>
  SELECT unixepoch('subsec');
</blockquote>

<h1 id="examples"><span>4. </span>Examples</h1>

<p>Compute the current date.</p><p>

</p><blockquote>SELECT date();</blockquote>

<p>Compute the last day of the current month.</p>

<blockquote>SELECT date('now','start of month','+1 month','-1 day');
</blockquote>

<p>Compute the date and time given a unix timestamp 1092941466.</p>

<blockquote>
    SELECT datetime(1092941466, 'unixepoch');<br>
    SELECT datetime(1092941466, 'auto'); -- Does not work for early 1970!
</blockquote>

<p>Compute the date and time given a unix timestamp 1092941466, and 
compensate for your local timezone.</p>

<blockquote>
  SELECT datetime(1092941466, 'unixepoch', 'localtime');
</blockquote>

<p>Compute the current unix timestamp.</p>

<blockquote>
  SELECT unixepoch();<br>
  SELECT strftime('%s');
</blockquote>

<p>Compute the number of days since the signing of the US Declaration
of Independence.</p>

<blockquote>
  SELECT julianday('now') - julianday('1776-07-04');
</blockquote>

<p>Compute the number of seconds since a particular moment in 2004:</p>

<blockquote>
  SELECT unixepoch() - unixepoch('2004-01-01 02:34:56');
</blockquote>

<p>
Compute the date of the first Tuesday in October
for the current year.
</p>

<blockquote>
  SELECT date('now','start of year','+9 months','weekday 2');
</blockquote>

<p>Compute the time since the unix epoch in seconds with
millisecond precision:</p>

<blockquote>
  SELECT (julianday('now') - 2440587.5)*86400.0;<br>
  SELECT unixepoch('now','subsec');
</blockquote>

<p>Compute how old Abraham Lincoln would be if he were still alive today:</p>

<blockquote>
  SELECT timediff('now','1809-02-12');
</blockquote>

<h1 id="caveats_and_bugs"><span>5. </span>Caveats And Bugs</h1>

<p>The computation of local time depends heavily on the whim 
of politicians and is thus difficult to get correct for 
all locales. In this implementation, the standard C library 
function localtime_r() is used to assist in the calculation of 
local time.  The 
localtime_r() C function normally only works for years
between 1970 and 2037. For dates outside this range, SQLite 
attempts to map the year into an equivalent year within 
this range, do the calculation, then map the year back.</p>

<p>These functions only work for dates between 0000-01-01 00:00:00
and 9999-12-31 23:59:59 (julian day numbers 1721059.5 through 5373484.5).
For dates outside that range, the results of these
functions are undefined.</p>

<p>Non-Vista Windows platforms only support one set of DST rules. 
Vista only supports two. Therefore, on these platforms, 
historical DST calculations will be incorrect. 
For example, in the US, in 2007 the DST rules changed. 
Non-Vista Windows platforms apply the new 2007 DST rules 
to all previous years as well. Vista does somewhat better
getting results correct back to 1986, when the rules were also changed.</p>

<p>All internal computations assume the 
<a href="http://en.wikipedia.org/wiki/Gregorian_calendar">Gregorian calendar</a>
system.  They also assume that every
day is exactly 86400 seconds in duration; no leap seconds are incorporated.</p>
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_datefunc.in?m=2f05e2885e">2024-03-29 20:49:34</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_delete.html.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>DELETE</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
DELETE
</div>
<div class="fancy_toc">
<a onclick="toggle_toc()">
<span class="fancy_toc_mark" id="toc_mk">&#x25ba;</span>
Table Of Contents
</a>
<div id="toc_sub"><div class="fancy-toc1"><a href="#overview">1. Overview</a></div>
<div class="fancy-toc1"><a href="#restrictions_on_delete_statements_within_create_trigger">2. Restrictions on DELETE Statements Within CREATE TRIGGER</a></div>
<div class="fancy-toc1"><a href="#optional_limit_and_order_by_clauses">3. Optional LIMIT and ORDER BY clauses</a></div>
<div class="fancy-toc1"><a href="#the_truncate_optimization">4. The Truncate Optimization</a></div>
</div>
</div>
<script>
function toggle_toc(){
var sub = document.getElementById("toc_sub")
var mk = document.getElementById("toc_mk")
if( sub.style.display!="block" ){
sub.style.display = "block";
mk.innerHTML = "&#x25bc;";
} else {
sub.style.display = "none";
mk.innerHTML = "&#x25ba;";
}
}
</script>
</div>




<h1 id="overview"><span>1. </span>Overview</h1>

<p><b><a href="syntax/delete-stmt.html">delete-stmt:</a></b>
<button id='x2aa8e682' onclick='hideorshow("x2aa8e682","x68795f56")'>hide</button></p>
 <div id='x68795f56' class='imgcontainer'>
 <div style="max-width:648px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 648.706 220.32">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L114,32A15 15 0 0 0 129 17A15 15 0 0 0 114 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="98" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M189,62L275,62A15 15 0 0 0 290 47A15 15 0 0 0 275 32L189,32A15 15 0 0 0 174 47A15 15 0 0 0 189 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="232" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="232,17 220,21 220,12" style="fill:rgb(0,0,0)"/>
<path d="M129,17L226,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,17 368,21 368,12" style="fill:rgb(0,0,0)"/>
<path d="M232,17L374,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,32L606,32L606,2L380,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="174,47 162,51 162,43" style="fill:rgb(0,0,0)"/>
<path d="M129,17 L 136,17 Q 144,17 144,32 L 144,32 Q 144,47 156,47 L 168,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,47 301,51 301,43" style="fill:rgb(0,0,0)"/>
<path d="M290,47L307,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,47 L 321,47 Q 328,47 328,32 L 328,32 Q 328,17 343,17 L 353,17 L 368,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,70A15 15 0 0 0 508 55L508,55A15 15 0 0 0 493 39A15 15 0 0 0 478 55L478,55A15 15 0 0 0 493 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="508,55 520,50 520,59" style="fill:rgb(0,0,0)"/>
<path d="M606,17 L 614,17 Q 621,17 621,32 L 621,40 Q 621,55 606,55 L 529,55 L 514,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,55 L 372,55 Q 357,55 357,40 L 357,32 Q 357,17 363,17 L 368,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,138L136,138A15 15 0 0 0 151 123A15 15 0 0 0 136 108L83,108A15 15 0 0 0 68 123A15 15 0 0 0 83 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DELETE</text>
<polygon points="174,123 163,127 163,118" style="fill:rgb(0,0,0)"/>
<path d="M151,123L168,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,138L224,138A15 15 0 0 0 239 123A15 15 0 0 0 224 108L189,108A15 15 0 0 0 174 123A15 15 0 0 0 189 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="207" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="262,123 251,127 251,118" style="fill:rgb(0,0,0)"/>
<path d="M239,123L256,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M262,138L447,138L447,108L262,108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">qualified-table-name</text>
<circle cx="642" cy="213" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M639,213 L 618,213 Q 603,213 603,198 L 603,198 Q 603,183 595,183 L 588,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M437,198L588,198L588,168L437,168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="512" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">returning-clause</text>
<polygon points="437,183 425,187 425,179" style="fill:rgb(0,0,0)"/>
<path d="M431,183 L 421,183 Q 410,183 410,198 L 410,198 Q 410,213 403,213 L 395,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,213 384,218 384,209" style="fill:rgb(0,0,0)"/>
<path d="M390,213 L 379,213 Q 369,213 369,198 L 369,198 Q 369,183 361,183 L 354,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M305,198L354,198L354,168L305,168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="329" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="305,183 293,187 293,179" style="fill:rgb(0,0,0)"/>
<path d="M299,183L282,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,198L267,198A15 15 0 0 0 282 183A15 15 0 0 0 267 168L217,168A15 15 0 0 0 202 183A15 15 0 0 0 217 198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="242" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="355,153 366,149 366,157" style="fill:rgb(0,0,0)"/>
<path d="M447,123 L 455,123 Q 462,123 462,138 L 462,138 Q 462,153 447,153 L 375,153 L 360,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="202,183 190,187 190,179" style="fill:rgb(0,0,0)"/>
<path d="M355,153 L 195,153 Q 180,153 180,168 L 180,168 Q 180,183 188,183 L 196,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="639,213 627,218 627,209" style="fill:rgb(0,0,0)"/>
<path d="M180,172 L 180,198 Q 180,213 195,213 L 618,213 L 633,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="355,85 366,81 366,89" style="fill:rgb(0,0,0)"/>
<path d="M606,17 L 614,17 Q 621,17 621,32 L 621,70 Q 621,85 606,85 L 375,85 L 360,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,123 56,127 56,118" style="fill:rgb(0,0,0)"/>
<path d="M355,85 L 62,85 Q 47,85 47,100 L 47,108 Q 47,123 55,123 L 62,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,47 43,36 51,36" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,29 L 47,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,47L47,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/common-table-expression.html">common-table-expression:</a></b>
<button id='x5189ae7f' onclick='hideorshow("x5189ae7f","xbc35353d")'>show</button></p>
 <div id='xbc35353d' style='display:none;' class='imgcontainer'>
 <div style="max-width:638px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 638.525 167.4">
<circle cx="5" cy="29" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,29 20,33 20,24" style="fill:rgb(0,0,0)"/>
<path d="M9,29L26,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,44L122,44A15 15 0 0 0 137 29A15 15 0 0 0 122 14L47,14A15 15 0 0 0 32 29A15 15 0 0 0 47 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="160,29 149,33 149,24" style="fill:rgb(0,0,0)"/>
<path d="M137,29L155,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="196,29 185,33 185,24" style="fill:rgb(0,0,0)"/>
<path d="M160,29L191,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,44A15 15 0 0 0 227 29A15 15 0 0 0 211 14A15 15 0 0 0 196 29A15 15 0 0 0 211 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="250,29 238,33 238,24" style="fill:rgb(0,0,0)"/>
<path d="M227,29L244,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="286,29 274,33 274,24" style="fill:rgb(0,0,0)"/>
<path d="M250,29L280,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,44L395,44A15 15 0 0 0 410 29A15 15 0 0 0 395 14L301,14A15 15 0 0 0 286 29A15 15 0 0 0 301 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="446,29 434,33 434,24" style="fill:rgb(0,0,0)"/>
<path d="M410,29L440,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,44A15 15 0 0 0 476 29A15 15 0 0 0 461 14A15 15 0 0 0 446 29A15 15 0 0 0 461 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,29 499,33 499,24" style="fill:rgb(0,0,0)"/>
<path d="M476,29L505,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,165L51,165A15 15 0 0 0 66 150A15 15 0 0 0 51 135L47,135A15 15 0 0 0 32 150A15 15 0 0 0 47 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="49" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<path d="M127,135L147,135A15 15 0 0 0 162 119A15 15 0 0 0 147 104L127,104A15 15 0 0 0 112 119A15 15 0 0 0 127 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<path d="M219,135L337,135A15 15 0 0 0 352 119A15 15 0 0 0 337 104L219,104A15 15 0 0 0 204 119A15 15 0 0 0 219 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<path d="M162,119L204,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,165A15 15 0 0 0 425 150A15 15 0 0 0 410 135A15 15 0 0 0 395 150A15 15 0 0 0 410 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="410" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="448,150 437,154 437,145" style="fill:rgb(0,0,0)"/>
<path d="M425,150L442,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,165L552,165L552,135L448,135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="500" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="575,150 564,154 564,145" style="fill:rgb(0,0,0)"/>
<path d="M552,150L570,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M591,165A15 15 0 0 0 606 150A15 15 0 0 0 591 135A15 15 0 0 0 575 150A15 15 0 0 0 591 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="629,150 617,154 617,145" style="fill:rgb(0,0,0)"/>
<path d="M606,150L623,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="632" cy="150" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,82A15 15 0 0 0 363 66A15 15 0 0 0 348 51A15 15 0 0 0 333 66A15 15 0 0 0 348 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="363,66 374,62 374,71" style="fill:rgb(0,0,0)"/>
<path d="M410,29 L 417,29 Q 425,29 425,44 L 425,51 Q 425,66 410,66 L 384,66 L 369,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M333,66 L 278,66 Q 263,66 263,51 L 263,44 Q 263,29 270,29 L 278,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,93 78,89 78,97" style="fill:rgb(0,0,0)"/>
<path d="M511,29 L 516,29 Q 522,29 522,44 L 522,78 Q 522,93 507,93 L 87,93 L 72,93"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,150 20,154 20,145" style="fill:rgb(0,0,0)"/>
<path d="M66,93 L 30,93 Q 15,93 15,108 L 15,135 Q 15,150 20,150 L 26,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="85,150 73,154 73,145" style="fill:rgb(0,0,0)"/>
<path d="M66,150L79,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="112,119 101,124 101,115" style="fill:rgb(0,0,0)"/>
<path d="M85,150 L 89,150 Q 92,150 92,135 L 92,134 Q 92,119 99,119 L 106,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="204,119 192,124 192,115" style="fill:rgb(0,0,0)"/>
<path d="M66,150 L 147,150 Q 162,150 170,150 Q 177,150 177,135 L 177,134 Q 177,119 188,119 L 198,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,150 383,154 383,145" style="fill:rgb(0,0,0)"/>
<path d="M352,119 L 360,119 Q 367,119 367,134 L 367,135 Q 367,150 378,150 L 389,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150L395,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,6 336,10 336,2" style="fill:rgb(0,0,0)"/>
<path d="M160,29 L 168,29 Q 175,29 175,17 Q 175,6 190,6 L 327,6 L 342,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,6 L 473,6 Q 488,6 488,17 Q 488,29 495,29 L 503,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/select-stmt.html">select-stmt:</a></b>
<button id='xd24202ce' onclick='hideorshow("xd24202ce","xff77d109")'>show</button></p>
 <div id='xff77d109' style='display:none;' class='imgcontainer'>
 <div style="max-width:669px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 669.677 1162.3">
<path d="M55,845L667,845L667,99L55,99Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="6" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="46,17 34,21 34,12" style="fill:rgb(0,0,0)"/>
<path d="M10,17L40,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M61,32L92,32A15 15 0 0 0 107 17A15 15 0 0 0 92 2L61,2A15 15 0 0 0 46 17A15 15 0 0 0 61 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="76" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M167,62L253,62A15 15 0 0 0 268 47L268,47A15 15 0 0 0 253 32L167,32A15 15 0 0 0 152 47L152,47A15 15 0 0 0 167 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="210,17 198,21 198,12" style="fill:rgb(0,0,0)"/>
<path d="M107,17L204,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M210,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M358,32L584,32L584,2L358,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="152,47 140,51 140,43" style="fill:rgb(0,0,0)"/>
<path d="M107,17 L 114,17 Q 122,17 122,32 L 122,32 Q 122,47 134,47 L 146,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="291,47 279,51 279,43" style="fill:rgb(0,0,0)"/>
<path d="M268,47L285,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,47 L 298,47 Q 306,47 306,32 L 306,32 Q 306,17 321,17 L 331,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,70A15 15 0 0 0 486 55L486,55A15 15 0 0 0 471 39A15 15 0 0 0 456 55L456,55A15 15 0 0 0 471 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="486,55 498,50 498,59" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,40 Q 599,55 584,55 L 507,55 L 492,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,55 L 350,55 Q 335,55 335,40 L 335,32 Q 335,17 340,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,83 307,79 307,88" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,68 Q 599,83 584,83 L 316,83 L 301,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,83 L 40,83 Q 25,83 25,98 L 25,113"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="25,47 20,36 29,36" style="fill:rgb(0,0,0)"/>
<path d="M10,17 L 17,17 Q 25,17 25,29 L 25,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="55,129 43,133 43,124" style="fill:rgb(0,0,0)"/>
<path d="M25,47 L 25,114 Q 25,129 37,129 L 49,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,129 115,133 115,124" style="fill:rgb(0,0,0)"/>
<path d="M55,129L121,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,144L193,144A15 15 0 0 0 208 129A15 15 0 0 0 193 114L142,114A15 15 0 0 0 127 129A15 15 0 0 0 142 144Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="250,159 238,163 238,155" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,144 Q 223,159 233,159 L 244,159"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,174L333,174A15 15 0 0 0 348 159A15 15 0 0 0 333 144L265,144A15 15 0 0 0 250 159A15 15 0 0 0 265 174Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="159" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="417,129 406,133 406,124" style="fill:rgb(0,0,0)"/>
<path d="M348,159 L 356,159 Q 363,159 363,144 L 363,144 Q 363,129 378,129 L 396,129 L 411,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,144L545,144L545,114L417,114Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M481,182A15 15 0 0 0 496 166A15 15 0 0 0 481 151A15 15 0 0 0 466 166A15 15 0 0 0 481 182Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="166" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="496,166 508,162 508,171" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,151 Q 560,166 545,166 L 517,166 L 502,166"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M466,166 L 406,166 Q 391,166 391,151 L 391,144 Q 391,129 398,129 L 406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,129 287,133 287,124" style="fill:rgb(0,0,0)"/>
<path d="M208,129L293,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M299,129L406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,212L280,212A15 15 0 0 0 295 197A15 15 0 0 0 280 182L265,182A15 15 0 0 0 250 197A15 15 0 0 0 265 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="197" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="348,197 337,201 337,192" style="fill:rgb(0,0,0)"/>
<path d="M295,197L342,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,197 L 356,197 Q 363,197 363,182 L 363,159 L 363,144"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="250,197 238,201 238,192" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,182 Q 223,197 233,197 L 244,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,287L203,287A15 15 0 0 0 218 272A15 15 0 0 0 203 257L168,257A15 15 0 0 0 153 272A15 15 0 0 0 168 287Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="186" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="290,272 279,277 279,268" style="fill:rgb(0,0,0)"/>
<path d="M218,272L284,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,287L451,287L451,257L290,257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M320,362L422,362L422,331L320,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M371,324A15 15 0 0 0 386 309A15 15 0 0 0 371 293A15 15 0 0 0 356 309A15 15 0 0 0 371 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="386,309 397,304 397,313" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 459,272 Q 466,272 466,287 L 466,294 Q 466,309 451,309 L 407,309 L 392,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M356,309 L 279,309 Q 264,309 264,294 L 264,287 Q 264,272 271,272 L 279,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="320,346 308,351 308,342" style="fill:rgb(0,0,0)"/>
<path d="M218,272 L 226,272 Q 233,272 233,287 L 233,331 Q 233,346 248,346 L 299,346 L 314,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="484,313 488,325 480,325" style="fill:rgb(0,0,0)"/>
<path d="M422,346 L 436,346 Q 451,346 466,346 L 469,346 Q 484,346 484,333 L 484,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,272 494,277 494,268" style="fill:rgb(0,0,0)"/>
<path d="M484,313 L 484,287 Q 484,272 492,272 L 499,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,272 L 496,272 Q 487,272 487,272 Q 487,272 495,272 L 502,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,197 555,185 564,185" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,176 L 560,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,235 360,230 360,239" style="fill:rgb(0,0,0)"/>
<path d="M560,197 L 560,220 Q 560,235 545,235 L 369,235 L 354,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,272 142,277 142,268" style="fill:rgb(0,0,0)"/>
<path d="M348,235 L 142,235 Q 127,235 127,250 L 127,257 Q 127,272 137,272 L 147,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,437L218,437A15 15 0 0 0 233 422A15 15 0 0 0 218 407L168,407A15 15 0 0 0 153 422A15 15 0 0 0 168 437Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="256,422 244,426 244,418" style="fill:rgb(0,0,0)"/>
<path d="M233,422L250,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,437L305,437L305,407L256,407Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="517,324 513,312 521,312" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 502,272 Q 517,272 517,287 L 517,303 L 517,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,384 382,380 382,389" style="fill:rgb(0,0,0)"/>
<path d="M517,324 L 517,369 Q 517,384 502,384 L 391,384 L 376,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,422 142,426 142,418" style="fill:rgb(0,0,0)"/>
<path d="M371,384 L 142,384 Q 127,384 127,399 L 127,407 Q 127,422 137,422 L 147,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,324 122,312 131,312" style="fill:rgb(0,0,0)"/>
<path d="M127,257L127,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,324L127,407"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,535L212,535A15 15 0 0 0 227 520A15 15 0 0 0 212 505L168,505A15 15 0 0 0 153 520A15 15 0 0 0 168 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="250,520 238,525 238,516" style="fill:rgb(0,0,0)"/>
<path d="M227,520L244,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,535L269,535A15 15 0 0 0 284 520A15 15 0 0 0 269 505L265,505A15 15 0 0 0 250 520A15 15 0 0 0 265 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="320,520 309,525 309,516" style="fill:rgb(0,0,0)"/>
<path d="M284,520L314,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,535L369,535L369,505L320,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="452,520 441,525 441,516" style="fill:rgb(0,0,0)"/>
<path d="M369,520L446,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,535L520,535A15 15 0 0 0 535 520A15 15 0 0 0 520 505L467,505A15 15 0 0 0 452 520A15 15 0 0 0 467 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="558,520 546,525 546,516" style="fill:rgb(0,0,0)"/>
<path d="M535,520L552,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,535L607,535L607,505L558,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M345,573A15 15 0 0 0 360 558A15 15 0 0 0 345 543A15 15 0 0 0 330 558A15 15 0 0 0 345 573Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="558" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="360,558 371,554 371,562" style="fill:rgb(0,0,0)"/>
<path d="M369,520 L 377,520 Q 384,520 384,535 L 384,543 Q 384,558 375,558 L 366,558"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,558 L 309,558 Q 294,558 294,543 L 294,535 Q 294,520 301,520 L 309,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="514,551 503,555 503,546" style="fill:rgb(0,0,0)"/>
<path d="M411,520 L 418,520 Q 426,520 426,535 L 426,536 Q 426,551 441,551 L 493,551 L 508,551"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M514,551 L 607,551 Q 622,551 622,536 L 622,535 Q 622,520 630,520 L 637,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,490 256,494 256,486" style="fill:rgb(0,0,0)"/>
<path d="M127,460 L 127,475 Q 127,490 142,490 L 246,490 L 261,490"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,520 399,525 399,516" style="fill:rgb(0,0,0)"/>
<path d="M267,490 L 369,490 Q 384,490 384,505 L 384,505 Q 384,520 395,520 L 405,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,460 244,455 244,464" style="fill:rgb(0,0,0)"/>
<path d="M305,422 L 313,422 Q 320,422 320,437 L 320,445 Q 320,460 305,460 L 254,460 L 239,460"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,520 142,525 142,516" style="fill:rgb(0,0,0)"/>
<path d="M233,460 L 142,460 Q 127,460 127,475 L 127,505 Q 127,520 137,520 L 147,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,447 122,435 131,435" style="fill:rgb(0,0,0)"/>
<path d="M127,407L127,441"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,447L127,505"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,649L232,649A15 15 0 0 0 247 634A15 15 0 0 0 232 619L168,619A15 15 0 0 0 153 634A15 15 0 0 0 168 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="200" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="283,634 271,638 271,629" style="fill:rgb(0,0,0)"/>
<path d="M247,634L277,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,649L395,649A15 15 0 0 0 410 634A15 15 0 0 0 395 619L298,619A15 15 0 0 0 283 634A15 15 0 0 0 298 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="433,634 422,638 422,629" style="fill:rgb(0,0,0)"/>
<path d="M410,634L427,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,649L452,649A15 15 0 0 0 467 634A15 15 0 0 0 452 619L448,619A15 15 0 0 0 433 634A15 15 0 0 0 448 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="450" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="490,634 479,638 479,629" style="fill:rgb(0,0,0)"/>
<path d="M467,634L485,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,649L609,649L609,619L490,619Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="550" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M446,687A15 15 0 0 0 461 671A15 15 0 0 0 446 656A15 15 0 0 0 431 671A15 15 0 0 0 446 687Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="671" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="461,671 472,667 472,676" style="fill:rgb(0,0,0)"/>
<path d="M609,634 L 616,634 Q 624,634 624,649 L 624,656 Q 624,671 609,671 L 482,671 L 467,671"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,671 L 271,671 Q 256,671 256,656 L 256,649 Q 256,634 264,634 L 271,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="624,692 619,680 628,680" style="fill:rgb(0,0,0)"/>
<path d="M624,656L624,686"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,558 648,547 656,547" style="fill:rgb(0,0,0)"/>
<path d="M607,520 L 637,520 Q 652,520 652,535 L 652,537 L 652,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,596 382,592 382,600" style="fill:rgb(0,0,0)"/>
<path d="M652,558 L 652,581 Q 652,596 637,596 L 391,596 L 376,596"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,634 142,638 142,629" style="fill:rgb(0,0,0)"/>
<path d="M371,596 L 142,596 Q 127,596 127,611 L 127,619 Q 127,634 137,634 L 147,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,558 122,547 131,547" style="fill:rgb(0,0,0)"/>
<path d="M127,505L127,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,709 359,714 359,705" style="fill:rgb(0,0,0)"/>
<path d="M127,558 L 127,694 Q 127,709 142,709 L 350,709 L 365,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,709 597,714 597,705" style="fill:rgb(0,0,0)"/>
<path d="M371,709L603,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,709 L 616,709 Q 624,709 624,717 L 624,724"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,800L194,800A15 15 0 0 0 209 785A15 15 0 0 0 194 770L142,770A15 15 0 0 0 127 785A15 15 0 0 0 142 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="245,785 234,789 234,781" style="fill:rgb(0,0,0)"/>
<path d="M209,785L239,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,800A15 15 0 0 0 275 785A15 15 0 0 0 260 770A15 15 0 0 0 245 785A15 15 0 0 0 260 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="311,785 300,789 300,781" style="fill:rgb(0,0,0)"/>
<path d="M275,785L306,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,800L361,800L361,770L311,770Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="397,785 385,789 385,781" style="fill:rgb(0,0,0)"/>
<path d="M361,785L391,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,800A15 15 0 0 0 427 785A15 15 0 0 0 412 770A15 15 0 0 0 397 785A15 15 0 0 0 412 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="412" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="609,785 597,789 597,781" style="fill:rgb(0,0,0)"/>
<path d="M427,785L603,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,785 L 616,785 Q 624,785 624,792 L 624,800"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,762A15 15 0 0 0 351 747A15 15 0 0 0 336 732A15 15 0 0 0 321 747A15 15 0 0 0 336 762Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="747" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M336,838A15 15 0 0 0 351 823A15 15 0 0 0 336 808A15 15 0 0 0 321 823A15 15 0 0 0 336 838Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="823" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="351,747 363,743 363,751" style="fill:rgb(0,0,0)"/>
<path d="M361,785 L 368,785 Q 376,785 376,770 L 376,762 Q 376,747 366,747 L 357,747"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,747 L 300,747 Q 285,747 285,762 L 285,770 Q 285,785 292,785 L 300,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,823 363,818 363,827" style="fill:rgb(0,0,0)"/>
<path d="M427,785 L 434,785 Q 442,785 442,800 L 442,808 Q 442,823 427,823 L 372,823 L 357,823"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,823 L 234,823 Q 219,823 219,808 L 219,800 Q 219,785 226,785 L 234,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,785 115,789 115,781" style="fill:rgb(0,0,0)"/>
<path d="M55,129 L 62,129 Q 70,129 70,144 L 70,770 Q 70,785 85,785 L 106,785 L 121,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,891L424,891L424,860L248,860Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="876" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="424,876 436,871 436,880" style="fill:rgb(0,0,0)"/>
<path d="M624,692 L 624,861 Q 624,876 609,876 L 445,876 L 430,876"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="6,197 10,208 2,208" style="fill:rgb(0,0,0)"/>
<path d="M248,876 L 21,876 Q 6,876 6,861 L 6,217 L 6,202"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M6,197 L 6,144 Q 6,129 21,129 L 40,129 L 55,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="667" y="275" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" transform="rotate(-90 667,285)" dominant-baseline="central">select-core</text>
<path d="M168,966L213,966A15 15 0 0 0 228 951A15 15 0 0 0 213 936L168,936A15 15 0 0 0 153 951A15 15 0 0 0 168 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="251,951 239,956 239,947" style="fill:rgb(0,0,0)"/>
<path d="M228,951L245,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,966L270,966A15 15 0 0 0 285 951A15 15 0 0 0 270 936L266,936A15 15 0 0 0 251 951A15 15 0 0 0 266 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M168,1072L202,1072A15 15 0 0 0 217 1057A15 15 0 0 0 202 1042L168,1042A15 15 0 0 0 153 1057A15 15 0 0 0 168 1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="240,1057 228,1061 228,1053" style="fill:rgb(0,0,0)"/>
<path d="M217,1057L234,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,1072L289,1072L289,1042L240,1042Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="330,951 319,956 319,947" style="fill:rgb(0,0,0)"/>
<path d="M285,951L324,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,966L460,966L460,936L330,936Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M395,1004A15 15 0 0 0 410 989A15 15 0 0 0 395 974A15 15 0 0 0 380 989A15 15 0 0 0 395 1004Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="989" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="410,989 422,985 422,993" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 468,951 Q 475,951 475,966 L 475,974 Q 475,989 460,989 L 431,989 L 416,989"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,989 L 322,989 Q 307,989 307,974 L 307,966 Q 307,951 313,951 L 319,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,913 348,909 348,918" style="fill:rgb(0,0,0)"/>
<path d="M624,860 L 624,898 Q 624,913 609,913 L 357,913 L 342,913"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,951 142,956 142,947" style="fill:rgb(0,0,0)"/>
<path d="M336,913 L 142,913 Q 127,913 127,928 L 127,936 Q 127,951 137,951 L 147,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,981 492,970 500,970" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 481,951 Q 496,951 496,963 L 496,976"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,1023 318,1019 318,1027" style="fill:rgb(0,0,0)"/>
<path d="M496,981 L 496,1008 Q 496,1023 481,1023 L 327,1023 L 312,1023"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,1057 142,1061 142,1053" style="fill:rgb(0,0,0)"/>
<path d="M307,1023 L 142,1023 Q 127,1023 127,1038 L 127,1042 Q 127,1057 137,1057 L 147,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,989 122,978 131,978" style="fill:rgb(0,0,0)"/>
<path d="M127,936L127,983"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,989L127,1042"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1102L415,1102A15 15 0 0 0 430 1087A15 15 0 0 0 415 1072L363,1072A15 15 0 0 0 348 1087A15 15 0 0 0 363 1102Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="389" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="453,1087 441,1092 441,1083" style="fill:rgb(0,0,0)"/>
<path d="M430,1087L447,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,1102L502,1102L502,1072L453,1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="525,1087 513,1092 513,1083" style="fill:rgb(0,0,0)"/>
<path d="M502,1087L519,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1140A15 15 0 0 0 378 1125A15 15 0 0 0 363 1110A15 15 0 0 0 348 1125A15 15 0 0 0 363 1140Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="1125" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="401,1125 390,1129 390,1121" style="fill:rgb(0,0,0)"/>
<path d="M378,1125L396,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,1140L451,1140L451,1110L401,1110Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="1125" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="312,1057 301,1061 301,1053" style="fill:rgb(0,0,0)"/>
<path d="M289,1057L306,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1125 337,1129 337,1121" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1110 Q 327,1125 335,1125 L 342,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1087 337,1092 337,1083" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1072 Q 327,1087 335,1087 L 342,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1057 513,1061 513,1053" style="fill:rgb(0,0,0)"/>
<path d="M312,1057L519,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="620,1155 609,1160 609,1151" style="fill:rgb(0,0,0)"/>
<path d="M525,1057 L 546,1057 Q 561,1057 561,1072 L 561,1140 Q 561,1155 576,1155 L 599,1155 L 614,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="624" cy="1155" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1087 L 546,1087 Q 561,1087 561,1095 L 561,1102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1125 513,1129 513,1121" style="fill:rgb(0,0,0)"/>
<path d="M451,1125L519,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1125 L 546,1125 Q 561,1125 561,1133 L 561,1140"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1155 513,1160 513,1151" style="fill:rgb(0,0,0)"/>
<path d="M127,1042 L 127,1140 Q 127,1155 142,1155 L 504,1155 L 519,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1155L597,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/compound-operator.html">compound-operator:</a></b>
<button id='xdb23d9f5' onclick='hideorshow("xdb23d9f5","x959e88ab")'>show</button></p>
 <div id='x959e88ab' style='display:none;' class='imgcontainer'>
 <div style="max-width:293px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 293.842 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L127,32A15 15 0 0 0 142 17A15 15 0 0 0 127 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,70L127,70A15 15 0 0 0 142 55L142,55A15 15 0 0 0 127 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,108L168,108A15 15 0 0 0 183 92A15 15 0 0 0 168 77L83,77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M83,145L135,145A15 15 0 0 0 150 130A15 15 0 0 0 135 115L83,115A15 15 0 0 0 68 130A15 15 0 0 0 83 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M142,55L159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70L195,70A15 15 0 0 0 210 55L210,55A15 15 0 0 0 195 39L180,39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="233,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M210,55L227,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,17 272,21 272,12" style="fill:rgb(0,0,0)"/>
<path d="M233,55 L 240,55 Q 248,55 248,40 L 248,32 Q 248,17 263,17 L 263,17 L 278,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="288" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M47,39 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,92 221,97 221,88" style="fill:rgb(0,0,0)"/>
<path d="M183,92L227,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,92 L 240,92 Q 248,92 248,77 L 248,54 L 248,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,130 56,135 56,126" style="fill:rgb(0,0,0)"/>
<path d="M47,77 L 47,115 Q 47,130 55,130 L 62,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,130 221,135 221,126" style="fill:rgb(0,0,0)"/>
<path d="M150,130L227,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,130 L 240,130 Q 248,130 248,115 L 248,92 L 248,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-clause.html">join-clause:</a></b>
<button id='x02cd30c0' onclick='hideorshow("x02cd30c0","xb0f09223")'>show</button></p>
 <div id='xb0f09223' style='display:none;' class='imgcontainer'>
 <div style="max-width:793px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 793.282 84.24">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L193,32L193,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="259,47 247,51 247,43" style="fill:rgb(0,0,0)"/>
<path d="M193,17 L 200,17 Q 208,17 208,32 L 208,32 Q 208,47 223,47 L 238,47 L 253,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,62L380,62L380,32L259,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-operator</text>
<polygon points="403,47 391,51 391,43" style="fill:rgb(0,0,0)"/>
<path d="M380,47L397,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,62L564,62L564,32L403,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="587,47 575,51 575,43" style="fill:rgb(0,0,0)"/>
<path d="M564,47L581,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M587,62L721,62L721,32L587,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="654" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-constraint</text>
<polygon points="783,17 772,21 772,12" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 742,47 Q 757,47 757,32 L 757,32 Q 757,17 767,17 L 778,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="787" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M193,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,17L776,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,77 495,73 495,82" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 728,47 Q 736,47 736,62 L 736,62 Q 736,77 721,77 L 504,77 L 489,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,77 L 247,77 Q 232,77 232,62 L 232,62 Q 232,47 246,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/join-constraint.html">join-constraint:</a></b>
<button id='x6acfa057' onclick='hideorshow("x6acfa057","xba100309")'>show</button></p>
 <div id='xba100309' style='display:none;' class='imgcontainer'>
 <div style="max-width:483px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 483.336 126.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L104,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 104 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="143,55 131,59 131,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L137,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,70A15 15 0 0 0 173 55L173,55A15 15 0 0 0 158 39A15 15 0 0 0 143 55L143,55A15 15 0 0 0 158 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="209,55 197,59 197,50" style="fill:rgb(0,0,0)"/>
<path d="M173,55L203,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M224,70L318,70A15 15 0 0 0 333 55L333,55A15 15 0 0 0 318 39L224,39A15 15 0 0 0 209 55L209,55A15 15 0 0 0 224 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="369,55 358,59 358,50" style="fill:rgb(0,0,0)"/>
<path d="M333,55L363,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,70A15 15 0 0 0 399 55L399,55A15 15 0 0 0 384 39A15 15 0 0 0 369 55L369,55A15 15 0 0 0 384 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="422,55 411,59 411,50" style="fill:rgb(0,0,0)"/>
<path d="M399,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="473,17 462,21 462,12" style="fill:rgb(0,0,0)"/>
<path d="M422,55 L 430,55 Q 437,55 437,40 L 437,32 Q 437,17 452,17 L 453,17 L 468,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="477" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,108A15 15 0 0 0 286 92A15 15 0 0 0 271 77A15 15 0 0 0 256 92A15 15 0 0 0 271 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="286,92 298,88 298,97" style="fill:rgb(0,0,0)"/>
<path d="M333,55 L 341,55 Q 348,55 348,70 L 348,77 Q 348,92 333,92 L 307,92 L 292,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,92 L 197,92 Q 182,92 182,77 L 182,70 Q 182,55 190,55 L 197,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L74,32A15 15 0 0 0 90 17A15 15 0 0 0 74 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="113,17 101,21 101,12" style="fill:rgb(0,0,0)"/>
<path d="M90,17L107,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M113,32L162,32L162,2L113,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="422,17 411,21 411,12" style="fill:rgb(0,0,0)"/>
<path d="M162,17L417,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,17L462,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="209,120 197,124 197,115" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,105 Q 24,120 39,120 L 188,120 L 203,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,120 L 422,120 Q 437,120 437,105 L 437,54 L 437,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-operator.html">join-operator:</a></b>
<button id='x28657cde' onclick='hideorshow("x28657cde","x2f51e837")'>show</button></p>
 <div id='x2f51e837' style='display:none;' class='imgcontainer'>
 <div style="max-width:620px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 620.333 255.312">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,71 39,76 39,67" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,56 Q 24,71 34,71 L 45,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,86L133,86A15 15 0 0 0 148 71A15 15 0 0 0 133 56L66,56A15 15 0 0 0 50 71A15 15 0 0 0 66 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="99" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NATURAL</text>
<polygon points="189,41 178,45 178,37" style="fill:rgb(0,0,0)"/>
<path d="M148,71 L 155,71 Q 163,71 163,56 L 163,56 Q 163,41 173,41 L 184,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,71 219,76 219,67" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,56 Q 204,71 215,71 L 225,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,86L273,86A15 15 0 0 0 288 71A15 15 0 0 0 273 56L246,56A15 15 0 0 0 231 71A15 15 0 0 0 246 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LEFT</text>
<polygon points="378,71 366,76 366,67" style="fill:rgb(0,0,0)"/>
<path d="M288,71L372,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,86L437,86A15 15 0 0 0 452 71A15 15 0 0 0 437 56L393,56A15 15 0 0 0 378 71A15 15 0 0 0 393 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OUTER</text>
<polygon points="475,71 463,76 463,67" style="fill:rgb(0,0,0)"/>
<path d="M452,71L469,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="516,41 505,45 505,37" style="fill:rgb(0,0,0)"/>
<path d="M475,71 L 482,71 Q 490,71 490,56 L 490,56 Q 490,41 500,41 L 511,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,56L554,56A15 15 0 0 0 569 41A15 15 0 0 0 554 26L532,26A15 15 0 0 0 516 41A15 15 0 0 0 532 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="543" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">JOIN</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M569,41 L 576,41 Q 584,41 584,29 Q 584,17 594,17 L 605,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="614" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,32A15 15 0 0 0 325 17A15 15 0 0 0 310 2A15 15 0 0 0 295 17A15 15 0 0 0 310 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="295,17 283,21 283,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L289,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M325,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="99,41 88,45 88,37" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,29 Q 24,41 39,41 L 78,41 L 93,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M99,41L178,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,41L505,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,41 366,45 366,37" style="fill:rgb(0,0,0)"/>
<path d="M336,71 L 344,71 Q 351,71 351,56 L 351,56 Q 351,41 362,41 L 372,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,109 219,113 219,105" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,94 Q 204,109 215,109 L 225,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,124L284,124A15 15 0 0 0 299 109A15 15 0 0 0 284 94L246,94A15 15 0 0 0 231 109A15 15 0 0 0 246 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RIGHT</text>
<polygon points="341,71 329,76 329,67" style="fill:rgb(0,0,0)"/>
<path d="M299,109 L 307,109 Q 314,109 314,94 L 314,86 Q 314,71 324,71 L 335,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,147 219,151 219,142" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,132 Q 204,147 215,147 L 225,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,162L274,162A15 15 0 0 0 289 147A15 15 0 0 0 274 132L246,132A15 15 0 0 0 231 147A15 15 0 0 0 246 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FULL</text>
<path d="M289,147 L 302,147 Q 314,147 314,132 L 314,109 L 314,94"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,192 219,196 219,188" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,177 Q 204,192 215,192 L 225,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,207L287,207A15 15 0 0 0 302 192A15 15 0 0 0 287 177L246,177A15 15 0 0 0 231 192A15 15 0 0 0 246 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="192" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INNER</text>
<polygon points="475,192 463,196 463,188" style="fill:rgb(0,0,0)"/>
<path d="M302,192L469,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,192 L 482,192 Q 490,192 490,185 L 490,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,238 219,242 219,233" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,223 Q 24,238 39,238 L 210,238 L 225,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,253L287,253A15 15 0 0 0 303 238A15 15 0 0 0 287 222L246,222A15 15 0 0 0 231 238A15 15 0 0 0 246 253Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="238" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CROSS</text>
<polygon points="475,238 463,242 463,233" style="fill:rgb(0,0,0)"/>
<path d="M303,238L469,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,238 L 482,238 Q 490,238 490,223 L 490,71 L 490,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='xc876e6f4' onclick='hideorshow("xc876e6f4","x1a264139")'>show</button></p>
 <div id='x1a264139' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/result-column.html">result-column:</a></b>
<button id='x5b886c24' onclick='hideorshow("x5b886c24","x7249cb57")'>show</button></p>
 <div id='x7249cb57' style='display:none;' class='imgcontainer'>
 <div style="max-width:398px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 398.054 163.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L94,32L94,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="136,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M94,17 L 102,17 Q 109,17 109,32 L 109,40 Q 109,55 119,55 L 130,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M151,70L155,70A15 15 0 0 0 170 55L170,55A15 15 0 0 0 155 39L151,39A15 15 0 0 0 136 55L136,55A15 15 0 0 0 151 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="206,55 194,59 194,50" style="fill:rgb(0,0,0)"/>
<path d="M170,55L200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,70L309,70A15 15 0 0 0 324 55L324,55A15 15 0 0 0 309 39L221,39A15 15 0 0 0 206 55L206,55A15 15 0 0 0 221 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="347,55 335,59 335,50" style="fill:rgb(0,0,0)"/>
<path d="M324,55L341,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,17 377,21 377,12" style="fill:rgb(0,0,0)"/>
<path d="M347,55 L 354,55 Q 362,55 362,40 L 362,32 Q 362,17 372,17 L 382,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="392" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,85 141,89 141,81" style="fill:rgb(0,0,0)"/>
<path d="M109,39 L 109,70 Q 109,85 124,85 L 132,85 L 147,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,85 L 170,85 Q 185,85 185,70 L 185,70 Q 185,55 192,55 L 200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="241,17 230,21 230,12" style="fill:rgb(0,0,0)"/>
<path d="M94,17L235,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M241,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,108 39,112 39,103" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,93 Q 24,108 34,108 L 45,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,123A15 15 0 0 0 81 108A15 15 0 0 0 66 92A15 15 0 0 0 50 108A15 15 0 0 0 66 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="108" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,108 335,112 335,103" style="fill:rgb(0,0,0)"/>
<path d="M81,108L341,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,108 L 354,108 Q 362,108 362,93 L 362,54 L 362,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,145 39,150 39,141" style="fill:rgb(0,0,0)"/>
<path d="M24,92 L 24,130 Q 24,145 34,145 L 45,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,160L141,160A15 15 0 0 0 156 145A15 15 0 0 0 141 130L66,130A15 15 0 0 0 50 145A15 15 0 0 0 66 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="145" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="179,145 167,150 167,141" style="fill:rgb(0,0,0)"/>
<path d="M156,145L173,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M194,160A15 15 0 0 0 209 145A15 15 0 0 0 194 130A15 15 0 0 0 179 145A15 15 0 0 0 194 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="232,145 221,150 221,141" style="fill:rgb(0,0,0)"/>
<path d="M209,145L226,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,160A15 15 0 0 0 262 145A15 15 0 0 0 247 130A15 15 0 0 0 232 145A15 15 0 0 0 247 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,145 335,150 335,141" style="fill:rgb(0,0,0)"/>
<path d="M262,145L341,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,145 L 354,145 Q 362,145 362,130 L 362,107 L 362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/table-or-subquery.html">table-or-subquery:</a></b>
<button id='x3d520a7c' onclick='hideorshow("x3d520a7c","xef48a6a9")'>show</button></p>
 <div id='xef48a6a9' style='display:none;' class='imgcontainer'>
 <div style="max-width:720px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 720.778 457.704">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,74 39,78 39,70" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,59 Q 24,74 34,74 L 45,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,89L162,89A15 15 0 0 0 177 74L177,74A15 15 0 0 0 162 59L66,59A15 15 0 0 0 50 74L50,74A15 15 0 0 0 66 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="194,74 183,78 183,70" style="fill:rgb(0,0,0)"/>
<path d="M177,74L189,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,89A15 15 0 0 0 225 74L225,74A15 15 0 0 0 209 59A15 15 0 0 0 194 74L194,74A15 15 0 0 0 209 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="266,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M225,74 L 232,74 Q 240,74 240,59 L 240,51 Q 240,36 250,36 L 260,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,51L356,51A15 15 0 0 0 371 36A15 15 0 0 0 356 21L281,21A15 15 0 0 0 266 36A15 15 0 0 0 281 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="407,36 396,41 396,32" style="fill:rgb(0,0,0)"/>
<path d="M371,36L402,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,51L427,51A15 15 0 0 0 442 36A15 15 0 0 0 427 21L423,21A15 15 0 0 0 407 36A15 15 0 0 0 423 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="478,36 466,41 466,32" style="fill:rgb(0,0,0)"/>
<path d="M442,36L472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,51L561,51A15 15 0 0 0 577 36A15 15 0 0 0 561 21L493,21A15 15 0 0 0 478 36A15 15 0 0 0 493 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="527" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<path d="M9,36L255,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="422,6 411,10 411,2" style="fill:rgb(0,0,0)"/>
<path d="M371,36 L 379,36 Q 386,36 386,21 L 386,21 Q 386,6 401,6 L 402,6 L 417,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 442,6 Q 457,6 457,21 L 457,21 Q 457,36 464,36 L 472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 577,6 Q 592,6 592,21 L 592,21 Q 592,36 599,36 L 607,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,127L388,127A15 15 0 0 0 403 112A15 15 0 0 0 388 97L323,97A15 15 0 0 0 308 112A15 15 0 0 0 323 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="426,112 415,116 415,108" style="fill:rgb(0,0,0)"/>
<path d="M403,112L420,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,127L445,127A15 15 0 0 0 460 112A15 15 0 0 0 445 97L441,97A15 15 0 0 0 426 112A15 15 0 0 0 441 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="443" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="483,112 472,116 472,108" style="fill:rgb(0,0,0)"/>
<path d="M460,112L478,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,127L577,127A15 15 0 0 0 592 112A15 15 0 0 0 577 97L499,97A15 15 0 0 0 483 112A15 15 0 0 0 499 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="538" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M323,165L343,165A15 15 0 0 0 359 150A15 15 0 0 0 343 135L323,135A15 15 0 0 0 308 150A15 15 0 0 0 323 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="382,150 370,154 370,145" style="fill:rgb(0,0,0)"/>
<path d="M359,150L376,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,165L461,165A15 15 0 0 0 476 150A15 15 0 0 0 461 135L397,135A15 15 0 0 0 382 150A15 15 0 0 0 397 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="527,74 539,70 539,78" style="fill:rgb(0,0,0)"/>
<path d="M577,36 L 607,36 Q 622,36 622,51 L 622,59 Q 622,74 607,74 L 548,74 L 533,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,150 297,154 297,145" style="fill:rgb(0,0,0)"/>
<path d="M527,74 L 297,74 Q 282,74 282,89 L 282,135 Q 282,150 292,150 L 302,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,112 297,116 297,108" style="fill:rgb(0,0,0)"/>
<path d="M282,97 L 282,104 Q 282,112 292,112 L 302,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="266,213 255,217 255,209" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,198 Q 24,213 39,213 L 245,213 L 260,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,228L431,228A15 15 0 0 0 446 213A15 15 0 0 0 431 198L281,198A15 15 0 0 0 266 213A15 15 0 0 0 281 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function-name</text>
<polygon points="463,213 452,217 452,209" style="fill:rgb(0,0,0)"/>
<path d="M446,213L457,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,228A15 15 0 0 0 493 213A15 15 0 0 0 478 198A15 15 0 0 0 463 213A15 15 0 0 0 478 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="529,213 518,217 518,209" style="fill:rgb(0,0,0)"/>
<path d="M493,213L524,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M529,228L579,228L579,198L529,198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="615,213 603,217 603,209" style="fill:rgb(0,0,0)"/>
<path d="M579,213L609,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M630,228A15 15 0 0 0 645 213A15 15 0 0 0 630 198A15 15 0 0 0 615 213A15 15 0 0 0 630 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="630" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="675,187 679,198 671,198" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 660,213 Q 675,213 675,203 L 675,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M554,190A15 15 0 0 0 569 175A15 15 0 0 0 554 160A15 15 0 0 0 539 175A15 15 0 0 0 554 190Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="175" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="569,175 581,171 581,180" style="fill:rgb(0,0,0)"/>
<path d="M579,213 L 586,213 Q 594,213 594,198 L 594,190 Q 594,175 584,175 L 575,175"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,175 L 518,175 Q 503,175 503,190 L 503,198 Q 503,213 510,213 L 518,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,74 L 232,74 Q 240,74 240,89 L 240,198 Q 240,213 247,213 L 255,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,112 648,116 648,108" style="fill:rgb(0,0,0)"/>
<path d="M592,112L654,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,112 L 667,112 Q 675,112 675,104 L 675,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,150 648,154 648,145" style="fill:rgb(0,0,0)"/>
<path d="M476,150L654,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,150 L 667,150 Q 675,150 675,142 L 675,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M577,36L690,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,304L411,304A15 15 0 0 0 426 289A15 15 0 0 0 411 274L407,274A15 15 0 0 0 392 289A15 15 0 0 0 407 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="498,289 487,293 487,284" style="fill:rgb(0,0,0)"/>
<path d="M426,289L492,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M513,304L582,304A15 15 0 0 0 597 289A15 15 0 0 0 582 274L513,274A15 15 0 0 0 498 289A15 15 0 0 0 513 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="548" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<polygon points="660,289 648,293 648,284" style="fill:rgb(0,0,0)"/>
<path d="M597,289L654,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,289 L 667,289 Q 675,289 675,281 L 675,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="548,251 559,247 559,255" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 652,213 Q 660,213 660,228 L 660,236 Q 660,251 645,251 L 568,251 L 553,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M548,251 L 370,251 Q 355,251 355,266 L 355,274 Q 355,289 370,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,251 L 464,251 Q 457,251 457,266 L 457,274 Q 457,289 464,289 L 472,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,327 39,331 39,322" style="fill:rgb(0,0,0)"/>
<path d="M24,198 L 24,312 Q 24,327 34,327 L 45,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,342A15 15 0 0 0 81 327A15 15 0 0 0 66 311A15 15 0 0 0 50 327A15 15 0 0 0 66 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,327 92,331 92,322" style="fill:rgb(0,0,0)"/>
<path d="M81,327L98,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,342L208,342L208,311L104,311Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="327" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="231,327 219,331 219,322" style="fill:rgb(0,0,0)"/>
<path d="M208,327L225,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,342A15 15 0 0 0 261 327A15 15 0 0 0 246 311A15 15 0 0 0 231 327A15 15 0 0 0 246 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M261,327 L 269,327 Q 276,327 276,312 L 276,304 Q 276,289 291,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,327 648,331 648,322" style="fill:rgb(0,0,0)"/>
<path d="M261,327L654,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,327 L 667,327 Q 675,327 675,319 L 675,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,327 L 432,327 Q 439,327 439,312 L 439,304 Q 439,289 447,289 L 454,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,364 39,369 39,360" style="fill:rgb(0,0,0)"/>
<path d="M24,311 L 24,349 Q 24,364 34,364 L 45,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,379A15 15 0 0 0 81 364A15 15 0 0 0 65 349A15 15 0 0 0 50 364A15 15 0 0 0 65 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="135,364 123,369 123,360" style="fill:rgb(0,0,0)"/>
<path d="M81,364L129,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,379L296,379L296,349L135,349Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="364" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="350,364 338,369 338,360" style="fill:rgb(0,0,0)"/>
<path d="M296,364L344,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,379A15 15 0 0 0 380 364A15 15 0 0 0 365 349A15 15 0 0 0 350 364A15 15 0 0 0 365 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="660,364 648,369 648,360" style="fill:rgb(0,0,0)"/>
<path d="M380,364L654,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="711,36 699,41 699,32" style="fill:rgb(0,0,0)"/>
<path d="M660,364 L 667,364 Q 675,364 675,349 L 675,51 Q 675,36 690,36 L 690,36 L 705,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="715" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,417A15 15 0 0 0 230 402A15 15 0 0 0 215 387A15 15 0 0 0 200 402A15 15 0 0 0 215 417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="402" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="230,402 242,398 242,406" style="fill:rgb(0,0,0)"/>
<path d="M296,364 L 303,364 Q 311,364 311,379 L 311,387 Q 311,402 296,402 L 251,402 L 236,402"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,402 L 123,402 Q 108,402 108,387 L 108,379 Q 108,364 116,364 L 123,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="122,440 111,444 111,436" style="fill:rgb(0,0,0)"/>
<path d="M81,364 L 88,364 Q 96,364 96,379 L 96,425 Q 96,440 106,440 L 116,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M122,455L224,455L224,425L122,425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M224,440 L 308,440 Q 323,440 323,425 L 323,379 Q 323,364 331,364 L 338,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/window-defn.html">window-defn:</a></b>
<button id='xb257c2fb' onclick='hideorshow("xb257c2fb","x5b7f394b")'>show</button></p>
 <div id='x5b7f394b' style='display:none;' class='imgcontainer'>
 <div style="max-width:479px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 479.765 380.592">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,44 92,48 92,40" style="fill:rgb(0,0,0)"/>
<path d="M62,17 L 70,17 Q 77,17 77,30 Q 77,44 88,44 L 98,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,59L260,59A15 15 0 0 0 275 44L275,44A15 15 0 0 0 260 29L119,29A15 15 0 0 0 104 44L104,44A15 15 0 0 0 119 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M119,135L198,135A15 15 0 0 0 214 120A15 15 0 0 0 198 104L119,104A15 15 0 0 0 104 120A15 15 0 0 0 119 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="237,120 225,124 225,115" style="fill:rgb(0,0,0)"/>
<path d="M214,120L231,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M252,135L256,135A15 15 0 0 0 271 120A15 15 0 0 0 256 104L252,104A15 15 0 0 0 237 120A15 15 0 0 0 252 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="307,120 295,124 295,115" style="fill:rgb(0,0,0)"/>
<path d="M271,120L301,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,135L356,135L356,104L307,104Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M332,173A15 15 0 0 0 347 157A15 15 0 0 0 332 142A15 15 0 0 0 316 157A15 15 0 0 0 332 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="157" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="347,157 358,153 358,162" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,142 Q 371,157 362,157 L 352,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,157 L 295,157 Q 280,157 280,142 L 280,135 Q 280,120 288,120 L 295,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,17 178,21 178,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L184,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,82 201,77 201,86" style="fill:rgb(0,0,0)"/>
<path d="M190,17 L 298,17 Q 313,17 313,32 L 313,67 Q 313,82 298,82 L 210,82 L 195,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,120 92,124 92,115" style="fill:rgb(0,0,0)"/>
<path d="M190,82 L 77,82 Q 62,82 62,97 L 62,105 Q 62,120 77,120 L 83,120 L 98,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,44 287,48 287,40" style="fill:rgb(0,0,0)"/>
<path d="M275,44L293,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,44 L 306,44 Q 313,44 313,51 L 313,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,248L163,248A15 15 0 0 0 178 233A15 15 0 0 0 163 218L119,218A15 15 0 0 0 104 233A15 15 0 0 0 119 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="201,233 190,237 190,229" style="fill:rgb(0,0,0)"/>
<path d="M178,233L196,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,248L221,248A15 15 0 0 0 236 233A15 15 0 0 0 221 218L217,218A15 15 0 0 0 201 233A15 15 0 0 0 217 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="272,233 260,237 260,229" style="fill:rgb(0,0,0)"/>
<path d="M236,233L266,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,248L402,248L402,218L272,218Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M337,286A15 15 0 0 0 352 271A15 15 0 0 0 337 256A15 15 0 0 0 322 271A15 15 0 0 0 337 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="352,271 363,266 363,275" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,256 Q 417,271 402,271 L 373,271 L 358,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M322,271 L 260,271 Q 245,271 245,256 L 245,248 Q 245,233 253,233 L 260,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,195 201,191 201,200" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,180 Q 371,195 356,195 L 210,195 L 195,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,233 92,237 92,229" style="fill:rgb(0,0,0)"/>
<path d="M190,195 L 77,195 Q 62,195 62,210 L 62,218 Q 62,233 77,233 L 83,233 L 98,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,157 58,146 66,146" style="fill:rgb(0,0,0)"/>
<path d="M62,104L62,152"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,157L62,218"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,362L208,362L208,331L104,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="417,346 405,351 405,342" style="fill:rgb(0,0,0)"/>
<path d="M208,346L411,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,362A15 15 0 0 0 447 346A15 15 0 0 0 432 331A15 15 0 0 0 417 346A15 15 0 0 0 432 362Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="470,346 458,351 458,342" style="fill:rgb(0,0,0)"/>
<path d="M447,346L464,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="474" cy="346" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,309 201,304 201,313" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,294 Q 417,309 402,309 L 210,309 L 195,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,346 92,351 92,342" style="fill:rgb(0,0,0)"/>
<path d="M190,309 L 77,309 Q 62,309 62,324 L 62,331 Q 62,346 77,346 L 83,346 L 98,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,271 58,259 66,259" style="fill:rgb(0,0,0)"/>
<path d="M62,218L62,265"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,271L62,331"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,374 144,378 144,369" style="fill:rgb(0,0,0)"/>
<path d="M62,331 L 62,359 Q 62,374 77,374 L 135,374 L 150,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,346 266,351 266,342" style="fill:rgb(0,0,0)"/>
<path d="M156,374 L 233,374 Q 248,374 248,360 Q 248,346 260,346 L 272,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x11b36008' onclick='hideorshow("x11b36008","x1894fab8")'>show</button></p>
 <div id='x1894fab8' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/expr.html">expr:</a></b>
<button id='xf456f50d' onclick='hideorshow("xf456f50d","x2a7346e7")'>show</button></p>
 <div id='x2a7346e7' style='display:none;' class='imgcontainer'>
 <div style="max-width:963px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 963.96 1068.77">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L158,32L158,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="101" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="954,17 943,21 943,12" style="fill:rgb(0,0,0)"/>
<path d="M158,17L948,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="958" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L172,70A15 15 0 0 0 187 55L187,55A15 15 0 0 0 172 39L60,39A15 15 0 0 0 45 55L45,55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">bind-parameter</text>
<polygon points="916,55 905,59 905,50" style="fill:rgb(0,0,0)"/>
<path d="M187,55L910,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,55 L 924,55 Q 931,55 931,47 L 931,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 31,55 L 39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,130L156,130A15 15 0 0 0 171 115A15 15 0 0 0 156 100L60,100A15 15 0 0 0 45 115A15 15 0 0 0 60 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,115 183,119 183,111" style="fill:rgb(0,0,0)"/>
<path d="M171,115L189,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,130A15 15 0 0 0 225 115A15 15 0 0 0 210 100A15 15 0 0 0 195 115A15 15 0 0 0 210 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M225,115L255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130L351,130A15 15 0 0 0 366 115A15 15 0 0 0 351 100L276,100A15 15 0 0 0 261 115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="389,115 378,119 378,111" style="fill:rgb(0,0,0)"/>
<path d="M366,115L383,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,130A15 15 0 0 0 419 115A15 15 0 0 0 404 100A15 15 0 0 0 389 115A15 15 0 0 0 404 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="404" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="455,115 444,119 444,111" style="fill:rgb(0,0,0)"/>
<path d="M419,115L450,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,130L565,130A15 15 0 0 0 580 115A15 15 0 0 0 565 100L471,100A15 15 0 0 0 455 115A15 15 0 0 0 471 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="916,115 905,119 905,111" style="fill:rgb(0,0,0)"/>
<path d="M580,115L910,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,115 L 924,115 Q 931,115 931,108 L 931,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,115 33,119 33,111" style="fill:rgb(0,0,0)"/>
<path d="M24,100 L 24,108 Q 24,115 31,115 L 39,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,89 97,93 97,84" style="fill:rgb(0,0,0)"/>
<path d="M24,74 L 24,81 Q 24,89 39,89 L 87,89 L 102,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 302,93 302,84" style="fill:rgb(0,0,0)"/>
<path d="M108,89 L 129,89 Q 144,89 159,89 L 293,89 L 308,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,89 L 414,89 Q 429,89 429,102 Q 429,115 436,115 L 444,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M223,89 L 230,89 Q 238,89 238,102 Q 238,115 245,115 L 253,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,168L168,168A15 15 0 0 0 183 153A15 15 0 0 0 168 138L60,138A15 15 0 0 0 45 153A15 15 0 0 0 60 168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">unary-operator</text>
<polygon points="206,153 194,157 194,149" style="fill:rgb(0,0,0)"/>
<path d="M183,153L200,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,168L255,168L255,138L206,138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,153 905,157 905,149" style="fill:rgb(0,0,0)"/>
<path d="M255,153L910,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,153 L 924,153 Q 931,153 931,145 L 931,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,153 33,157 33,149" style="fill:rgb(0,0,0)"/>
<path d="M24,138 L 24,145 Q 24,153 31,153 L 39,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,206L94,206L94,176L45,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,191 106,195 106,186" style="fill:rgb(0,0,0)"/>
<path d="M94,191L111,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,206L245,206A15 15 0 0 0 261 191A15 15 0 0 0 245 176L132,176A15 15 0 0 0 117 191A15 15 0 0 0 132 206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">binary-operator</text>
<polygon points="284,191 272,195 272,186" style="fill:rgb(0,0,0)"/>
<path d="M261,191L278,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,206L333,206L333,176L284,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="308" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,191 905,195 905,186" style="fill:rgb(0,0,0)"/>
<path d="M333,191L910,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,191 L 924,191 Q 931,191 931,183 L 931,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,191 33,195 33,186" style="fill:rgb(0,0,0)"/>
<path d="M24,176 L 24,183 Q 24,191 31,191 L 39,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,245L162,245A15 15 0 0 0 177 230A15 15 0 0 0 162 215L60,215A15 15 0 0 0 45 230A15 15 0 0 0 60 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="111" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-name</text>
<polygon points="194,230 183,234 183,226" style="fill:rgb(0,0,0)"/>
<path d="M177,230L188,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,245A15 15 0 0 0 224 230A15 15 0 0 0 209 215A15 15 0 0 0 194 230A15 15 0 0 0 209 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="260,230 249,234 249,226" style="fill:rgb(0,0,0)"/>
<path d="M224,230L255,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,245L437,245L437,215L260,215Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-arguments</text>
<polygon points="473,230 461,234 461,226" style="fill:rgb(0,0,0)"/>
<path d="M437,230L467,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,245A15 15 0 0 0 503 230A15 15 0 0 0 488 215A15 15 0 0 0 473 230A15 15 0 0 0 488 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="541,260 529,265 529,256" style="fill:rgb(0,0,0)"/>
<path d="M503,230 L 510,230 Q 518,230 518,245 L 518,245 Q 518,260 527,260 L 535,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,275L653,275L653,245L541,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="691,230 680,234 680,226" style="fill:rgb(0,0,0)"/>
<path d="M653,260 L 661,260 Q 668,260 668,245 L 668,245 Q 668,230 677,230 L 685,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="729,260 718,265 718,256" style="fill:rgb(0,0,0)"/>
<path d="M691,230 L 699,230 Q 706,230 706,245 L 706,245 Q 706,260 715,260 L 723,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,275L837,275L837,245L729,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="783" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">over-clause</text>
<polygon points="916,260 905,265 905,256" style="fill:rgb(0,0,0)"/>
<path d="M837,260L910,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,260 L 924,260 Q 931,260 931,253 L 931,245"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,230 33,234 33,226" style="fill:rgb(0,0,0)"/>
<path d="M24,215 L 24,222 Q 24,230 31,230 L 39,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,230 585,234 585,226" style="fill:rgb(0,0,0)"/>
<path d="M503,230L591,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,230L680,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,230 905,234 905,226" style="fill:rgb(0,0,0)"/>
<path d="M691,230L910,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,230 L 924,230 Q 931,230 931,222 L 931,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,321A15 15 0 0 0 75 306A15 15 0 0 0 60 290A15 15 0 0 0 45 306A15 15 0 0 0 60 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,306 100,310 100,301" style="fill:rgb(0,0,0)"/>
<path d="M75,306L105,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M111,321L160,321L160,290L111,290Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="306" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="196,306 185,310 185,301" style="fill:rgb(0,0,0)"/>
<path d="M160,306L191,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,321A15 15 0 0 0 227 306A15 15 0 0 0 211 290A15 15 0 0 0 196 306A15 15 0 0 0 211 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,306 905,310 905,301" style="fill:rgb(0,0,0)"/>
<path d="M227,306L910,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,306 L 924,306 Q 931,306 931,298 L 931,291"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,306 33,310 33,301" style="fill:rgb(0,0,0)"/>
<path d="M24,290 L 24,298 Q 24,306 31,306 L 39,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,284A15 15 0 0 0 151 269A15 15 0 0 0 136 254A15 15 0 0 0 121 269A15 15 0 0 0 136 284Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="269" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="151,269 162,265 162,274" style="fill:rgb(0,0,0)"/>
<path d="M160,306 L 168,306 Q 175,306 175,291 L 175,284 Q 175,269 166,269 L 157,269"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,269 L 103,269 Q 88,269 88,284 L 88,291 Q 88,306 96,306 L 103,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,358L88,358A15 15 0 0 0 103 343A15 15 0 0 0 88 328L60,328A15 15 0 0 0 45 343A15 15 0 0 0 60 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CAST</text>
<polygon points="126,343 114,348 114,339" style="fill:rgb(0,0,0)"/>
<path d="M103,343L120,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M141,358A15 15 0 0 0 156 343A15 15 0 0 0 141 328A15 15 0 0 0 126 343A15 15 0 0 0 141 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="179,343 168,348 168,339" style="fill:rgb(0,0,0)"/>
<path d="M156,343L173,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,358L228,358L228,328L179,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="251,343 240,348 240,339" style="fill:rgb(0,0,0)"/>
<path d="M228,343L246,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,358L271,358A15 15 0 0 0 286 343A15 15 0 0 0 271 328L267,328A15 15 0 0 0 251 343A15 15 0 0 0 267 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="269" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="309,343 297,348 297,339" style="fill:rgb(0,0,0)"/>
<path d="M286,343L303,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,358L408,358L408,328L309,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="358" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="431,343 419,348 419,339" style="fill:rgb(0,0,0)"/>
<path d="M408,343L425,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M446,358A15 15 0 0 0 461 343A15 15 0 0 0 446 328A15 15 0 0 0 431 343A15 15 0 0 0 446 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,343 905,348 905,339" style="fill:rgb(0,0,0)"/>
<path d="M461,343L910,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,343 L 924,343 Q 931,343 931,336 L 931,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,343 33,348 33,339" style="fill:rgb(0,0,0)"/>
<path d="M24,328 L 24,336 Q 24,343 31,343 L 39,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,396L94,396L94,366L45,366Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,381 106,385 106,377" style="fill:rgb(0,0,0)"/>
<path d="M94,381L111,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,396L196,396A15 15 0 0 0 211 381A15 15 0 0 0 196 366L132,366A15 15 0 0 0 117 381A15 15 0 0 0 132 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="234,381 223,385 223,377" style="fill:rgb(0,0,0)"/>
<path d="M211,381L229,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,396L355,396A15 15 0 0 0 370 381A15 15 0 0 0 355 366L250,366A15 15 0 0 0 234 381A15 15 0 0 0 250 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="916,381 905,385 905,377" style="fill:rgb(0,0,0)"/>
<path d="M370,381L910,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,381 L 924,381 Q 931,381 931,374 L 931,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,381 33,385 33,377" style="fill:rgb(0,0,0)"/>
<path d="M24,366 L 24,374 Q 24,381 31,381 L 39,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,434L94,434L94,404L45,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,419 119,423 119,415" style="fill:rgb(0,0,0)"/>
<path d="M94,419L124,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,434L165,434A15 15 0 0 0 180 419A15 15 0 0 0 165 404L145,404A15 15 0 0 0 130 419A15 15 0 0 0 145 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="234,419 223,423 223,415" style="fill:rgb(0,0,0)"/>
<path d="M180,419L229,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,434L273,434A15 15 0 0 0 288 419A15 15 0 0 0 273 404L250,404A15 15 0 0 0 234 419A15 15 0 0 0 250 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIKE</text>
<path d="M250,472L279,472A15 15 0 0 0 294 457A15 15 0 0 0 279 442L250,442A15 15 0 0 0 234 457A15 15 0 0 0 250 472Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="457" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GLOB</text>
<path d="M250,510L302,510A15 15 0 0 0 317 495A15 15 0 0 0 302 479L250,479A15 15 0 0 0 234 495A15 15 0 0 0 250 510Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REGEXP</text>
<path d="M250,547L297,547A15 15 0 0 0 313 532A15 15 0 0 0 297 517L250,517A15 15 0 0 0 234 532A15 15 0 0 0 250 547Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="274" y="532" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<path d="M378,510L427,510L427,479L378,479Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M378,434L427,434L427,404L378,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="465,449 454,454 454,445" style="fill:rgb(0,0,0)"/>
<path d="M427,419 L 435,419 Q 442,419 442,434 L 442,434 Q 442,449 451,449 L 460,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,464L532,464A15 15 0 0 0 547 449A15 15 0 0 0 532 434L480,434A15 15 0 0 0 465 449A15 15 0 0 0 480 464Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="506" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ESCAPE</text>
<polygon points="570,449 559,454 559,445" style="fill:rgb(0,0,0)"/>
<path d="M547,449L565,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M570,464L620,464L620,434L570,434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="595" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="671,419 659,423 659,415" style="fill:rgb(0,0,0)"/>
<path d="M620,449 L 627,449 Q 635,449 635,434 L 635,434 Q 635,419 650,419 L 650,419 L 665,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,419 905,423 905,415" style="fill:rgb(0,0,0)"/>
<path d="M671,419L910,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,419 L 924,419 Q 931,419 931,411 L 931,404"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,419 33,423 33,415" style="fill:rgb(0,0,0)"/>
<path d="M24,404 L 24,411 Q 24,419 31,419 L 39,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M100,419 L 108,419 Q 115,419 115,434 L 115,434 Q 115,449 130,449 L 177,449 Q 192,449 192,434 L 192,434 Q 192,419 199,419 L 207,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,532 223,537 223,528" style="fill:rgb(0,0,0)"/>
<path d="M196,419 L 204,419 Q 211,419 211,434 L 211,517 Q 211,532 220,532 L 229,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,457 223,461 223,452" style="fill:rgb(0,0,0)"/>
<path d="M211,442 L 211,449 Q 211,457 220,457 L 229,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,495 223,499 223,490" style="fill:rgb(0,0,0)"/>
<path d="M211,479 L 211,487 Q 211,495 220,495 L 229,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,419 367,423 367,415" style="fill:rgb(0,0,0)"/>
<path d="M288,419L372,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,532 329,537 329,528" style="fill:rgb(0,0,0)"/>
<path d="M313,532L334,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,495 367,499 367,490" style="fill:rgb(0,0,0)"/>
<path d="M340,532 L 348,532 Q 355,532 355,517 L 355,510 Q 355,495 364,495 L 372,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,495 329,499 329,490" style="fill:rgb(0,0,0)"/>
<path d="M317,495L334,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,495L378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,457 329,461 329,452" style="fill:rgb(0,0,0)"/>
<path d="M294,457L334,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,457 L 348,457 Q 355,457 355,472 L 355,480 Q 355,495 367,495 L 378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="506,419 495,423 495,415" style="fill:rgb(0,0,0)"/>
<path d="M427,419L501,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M506,419L659,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="547,495 536,499 536,490" style="fill:rgb(0,0,0)"/>
<path d="M427,495L542,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,495 L 656,495 Q 671,495 671,480 L 671,434 Q 671,419 686,419 L 692,419 L 707,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,585L94,585L94,555L45,555Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,570 119,574 119,566" style="fill:rgb(0,0,0)"/>
<path d="M94,570L124,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,585L194,585A15 15 0 0 0 209 570A15 15 0 0 0 194 555L145,555A15 15 0 0 0 130 570A15 15 0 0 0 145 585Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="170" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ISNULL</text>
<polygon points="916,570 905,574 905,566" style="fill:rgb(0,0,0)"/>
<path d="M209,570L910,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,570 L 924,570 Q 931,570 931,563 L 931,555"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,570 33,574 33,566" style="fill:rgb(0,0,0)"/>
<path d="M24,555 L 24,563 Q 24,570 31,570 L 39,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,623L215,623A15 15 0 0 0 230 608A15 15 0 0 0 215 593L145,593A15 15 0 0 0 130 608A15 15 0 0 0 145 623Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="608" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTNULL</text>
<path d="M145,661L165,661A15 15 0 0 0 180 646A15 15 0 0 0 165 631L145,631A15 15 0 0 0 130 646A15 15 0 0 0 145 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="203,646 192,650 192,641" style="fill:rgb(0,0,0)"/>
<path d="M180,646L198,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,661L250,661A15 15 0 0 0 265 646A15 15 0 0 0 250 631L219,631A15 15 0 0 0 203 646A15 15 0 0 0 219 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="288,646 276,650 276,641" style="fill:rgb(0,0,0)"/>
<path d="M265,646L282,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="339,570 327,574 327,566" style="fill:rgb(0,0,0)"/>
<path d="M288,646 L 295,646 Q 303,646 303,631 L 303,585 Q 303,570 318,570 L 318,570 L 333,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="288,608 276,612 276,604" style="fill:rgb(0,0,0)"/>
<path d="M230,608L282,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,608 L 295,608 Q 303,608 303,600 L 303,593"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,646 119,650 119,641" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,631 Q 109,646 117,646 L 124,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,608 119,612 119,604" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,593 Q 109,608 117,608 L 124,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,699L94,699L94,668L45,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,684 106,688 106,679" style="fill:rgb(0,0,0)"/>
<path d="M94,684L111,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,699A15 15 0 0 0 147 684A15 15 0 0 0 132 668A15 15 0 0 0 117 684A15 15 0 0 0 132 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IS</text>
<polygon points="183,684 172,688 172,679" style="fill:rgb(0,0,0)"/>
<path d="M147,684L178,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M198,699L219,699A15 15 0 0 0 234 684A15 15 0 0 0 219 668L198,668A15 15 0 0 0 183 684A15 15 0 0 0 198 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="270,684 258,688 258,679" style="fill:rgb(0,0,0)"/>
<path d="M234,684L264,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="306,684 294,688 294,679" style="fill:rgb(0,0,0)"/>
<path d="M270,684L300,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,699L389,699A15 15 0 0 0 404 684A15 15 0 0 0 389 668L321,668A15 15 0 0 0 306 684A15 15 0 0 0 321 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="440,684 429,688 429,679" style="fill:rgb(0,0,0)"/>
<path d="M404,684L434,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,699L490,699A15 15 0 0 0 505 684A15 15 0 0 0 490 668L455,668A15 15 0 0 0 440 684A15 15 0 0 0 455 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="541,684 530,688 530,679" style="fill:rgb(0,0,0)"/>
<path d="M505,684L535,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,699L590,699L590,668L541,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,684 905,688 905,679" style="fill:rgb(0,0,0)"/>
<path d="M590,684L910,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,684 L 924,684 Q 931,684 931,676 L 931,669"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,684 33,688 33,679" style="fill:rgb(0,0,0)"/>
<path d="M24,668 L 24,676 Q 24,684 31,684 L 39,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,684 L 156,684 Q 164,684 164,696 Q 164,708 179,708 L 230,708 Q 245,708 245,696 Q 245,684 253,684 L 260,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,684 L 279,684 Q 286,684 286,696 Q 286,708 301,708 L 502,708 Q 517,708 517,696 Q 517,684 524,684 L 532,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,744L94,744L94,714L45,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,729 119,733 119,725" style="fill:rgb(0,0,0)"/>
<path d="M94,729L124,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,744L165,744A15 15 0 0 0 180 729A15 15 0 0 0 165 714L145,714A15 15 0 0 0 130 729A15 15 0 0 0 145 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,729 205,733 205,725" style="fill:rgb(0,0,0)"/>
<path d="M180,729L211,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,744L304,744A15 15 0 0 0 319 729A15 15 0 0 0 304 714L232,714A15 15 0 0 0 216 729A15 15 0 0 0 232 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="342,729 331,733 331,725" style="fill:rgb(0,0,0)"/>
<path d="M319,729L336,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M342,744L391,744L391,714L342,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="367" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="414,729 403,733 403,725" style="fill:rgb(0,0,0)"/>
<path d="M391,729L409,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M430,744L450,744A15 15 0 0 0 465 729A15 15 0 0 0 450 714L430,714A15 15 0 0 0 414 729A15 15 0 0 0 430 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="488,729 477,733 477,725" style="fill:rgb(0,0,0)"/>
<path d="M465,729L483,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,744L538,744L538,714L488,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="513" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,729 905,733 905,725" style="fill:rgb(0,0,0)"/>
<path d="M538,729L910,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,729 L 924,729 Q 931,729 931,721 L 931,714"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,729 33,733 33,725" style="fill:rgb(0,0,0)"/>
<path d="M24,714 L 24,721 Q 24,729 31,729 L 39,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,729 L 103,729 Q 110,729 110,741 Q 110,753 125,753 L 177,753 Q 192,753 192,741 Q 192,729 199,729 L 207,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,797L94,797L94,767L45,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,782 119,786 119,778" style="fill:rgb(0,0,0)"/>
<path d="M94,782L124,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,797L165,797A15 15 0 0 0 180 782A15 15 0 0 0 165 767L145,767A15 15 0 0 0 130 782A15 15 0 0 0 145 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,782 205,786 205,778" style="fill:rgb(0,0,0)"/>
<path d="M180,782L211,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,797L234,797A15 15 0 0 0 249 782A15 15 0 0 0 234 767L232,767A15 15 0 0 0 216 782A15 15 0 0 0 232 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IN</text>
<polygon points="285,782 273,786 273,778" style="fill:rgb(0,0,0)"/>
<path d="M249,782L279,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,797A15 15 0 0 0 315 782A15 15 0 0 0 300 767A15 15 0 0 0 285 782A15 15 0 0 0 300 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,782 340,786 340,778" style="fill:rgb(0,0,0)"/>
<path d="M315,782L345,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,797L455,797L455,767L351,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="491,782 480,786 480,778" style="fill:rgb(0,0,0)"/>
<path d="M455,782L486,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M507,797A15 15 0 0 0 522 782A15 15 0 0 0 507 767A15 15 0 0 0 491 782A15 15 0 0 0 507 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="507" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,782 905,786 905,778" style="fill:rgb(0,0,0)"/>
<path d="M522,782L910,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,782 L 924,782 Q 931,782 931,774 L 931,767"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,782 33,786 33,778" style="fill:rgb(0,0,0)"/>
<path d="M24,767 L 24,774 Q 24,782 31,782 L 39,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,782 L 103,782 Q 110,782 110,794 Q 110,806 125,806 L 177,806 Q 192,806 192,794 Q 192,782 199,782 L 207,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,782 L 324,782 Q 332,782 332,770 Q 332,758 347,758 L 452,758 Q 467,758 467,770 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M379,835L428,835L428,805L379,805Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="820" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="379,820 367,824 367,815" style="fill:rgb(0,0,0)"/>
<path d="M317,782 L 324,782 Q 332,782 332,797 L 332,805 Q 332,820 347,820 L 358,820 L 373,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M428,820 L 452,820 Q 467,820 467,805 L 467,797 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,873A15 15 0 0 0 418 857A15 15 0 0 0 403 842A15 15 0 0 0 388 857A15 15 0 0 0 403 873Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="857" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,857 430,853 430,862" style="fill:rgb(0,0,0)"/>
<path d="M428,820 L 435,820 Q 443,820 443,835 L 443,842 Q 443,857 434,857 L 424,857"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,857 L 371,857 Q 356,857 356,842 L 356,835 Q 356,820 363,820 L 371,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,925L396,925A15 15 0 0 0 412 910A15 15 0 0 0 396 895L300,895A15 15 0 0 0 285 910A15 15 0 0 0 300 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="429,910 417,915 417,906" style="fill:rgb(0,0,0)"/>
<path d="M412,910L423,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,925A15 15 0 0 0 459 910A15 15 0 0 0 444 895A15 15 0 0 0 429 910A15 15 0 0 0 444 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="513,910 502,915 502,906" style="fill:rgb(0,0,0)"/>
<path d="M459,910L507,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,925L627,925A15 15 0 0 0 642 910A15 15 0 0 0 627 895L528,895A15 15 0 0 0 513 910A15 15 0 0 0 528 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="577" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function</text>
<polygon points="659,910 647,915 647,906" style="fill:rgb(0,0,0)"/>
<path d="M642,910L653,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,925A15 15 0 0 0 689 910A15 15 0 0 0 674 895A15 15 0 0 0 659 910A15 15 0 0 0 674 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="734,910 723,915 723,906" style="fill:rgb(0,0,0)"/>
<path d="M689,910L728,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,925L783,925L783,895L734,895Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="828,910 817,915 817,906" style="fill:rgb(0,0,0)"/>
<path d="M783,910L823,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M844,925A15 15 0 0 0 859 910A15 15 0 0 0 844 895A15 15 0 0 0 828 910A15 15 0 0 0 844 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="844" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,910 905,915 905,906" style="fill:rgb(0,0,0)"/>
<path d="M859,910L910,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,910 L 924,910 Q 931,910 931,903 L 931,895"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,865L603,865A15 15 0 0 0 619 850A15 15 0 0 0 603 835L528,835A15 15 0 0 0 513 850A15 15 0 0 0 528 865Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="850" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="916,850 905,854 905,846" style="fill:rgb(0,0,0)"/>
<path d="M619,850L910,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,850 L 924,850 Q 931,850 931,842 L 931,835"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="513,850 502,854 502,846" style="fill:rgb(0,0,0)"/>
<path d="M475,910 L 483,910 Q 490,910 490,895 L 490,865 Q 490,850 499,850 L 507,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,892A15 15 0 0 0 774 877A15 15 0 0 0 759 862A15 15 0 0 0 744 877A15 15 0 0 0 759 892Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="877" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="774,877 785,873 785,881" style="fill:rgb(0,0,0)"/>
<path d="M783,910 L 791,910 Q 798,910 798,895 L 798,892 Q 798,877 789,877 L 780,877"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M744,877 L 726,877 Q 711,877 711,892 L 711,895 Q 711,910 719,910 L 726,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M689,910 L 697,910 Q 704,910 704,921 Q 704,932 719,932 L 790,932 Q 805,932 805,921 Q 805,910 813,910 L 820,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="285,910 273,915 273,906" style="fill:rgb(0,0,0)"/>
<path d="M249,782 L 256,782 Q 264,782 264,797 L 264,895 Q 264,910 272,910 L 279,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,882 412,886 412,877" style="fill:rgb(0,0,0)"/>
<path d="M264,867 L 264,874 Q 264,882 279,882 L 402,882 L 417,882"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,882 L 456,882 Q 471,882 471,896 Q 471,910 478,910 L 486,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,971L80,971A15 15 0 0 0 95 956A15 15 0 0 0 80 941L60,941A15 15 0 0 0 45 956A15 15 0 0 0 60 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="131,956 120,960 120,951" style="fill:rgb(0,0,0)"/>
<path d="M95,956L125,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,971L191,971A15 15 0 0 0 206 956A15 15 0 0 0 191 941L146,941A15 15 0 0 0 131 956A15 15 0 0 0 146 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="242,956 231,960 231,951" style="fill:rgb(0,0,0)"/>
<path d="M206,956L236,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,971A15 15 0 0 0 272 956A15 15 0 0 0 257 941A15 15 0 0 0 242 956A15 15 0 0 0 257 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="295,956 284,960 284,951" style="fill:rgb(0,0,0)"/>
<path d="M272,956L290,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,971L400,971L400,941L295,941Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="423,956 411,960 411,951" style="fill:rgb(0,0,0)"/>
<path d="M400,956L417,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,971A15 15 0 0 0 453 956A15 15 0 0 0 438 941A15 15 0 0 0 423 956A15 15 0 0 0 438 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,956 905,960 905,951" style="fill:rgb(0,0,0)"/>
<path d="M453,956L910,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,956 L 924,956 Q 931,956 931,948 L 931,941"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,956 33,960 33,951" style="fill:rgb(0,0,0)"/>
<path d="M24,941 L 24,948 Q 24,956 31,956 L 39,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,929 59,934 59,925" style="fill:rgb(0,0,0)"/>
<path d="M24,914 L 24,922 Q 24,929 39,929 L 49,929 L 64,929"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,929 L 201,929 Q 216,929 216,943 Q 216,956 223,956 L 231,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,929 L 101,929 Q 108,929 108,943 Q 108,956 116,956 L 123,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,1009L89,1009A15 15 0 0 0 104 994A15 15 0 0 0 89 978L60,978A15 15 0 0 0 45 994A15 15 0 0 0 60 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASE</text>
<polygon points="140,994 128,998 128,989" style="fill:rgb(0,0,0)"/>
<path d="M104,994L134,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M140,1009L189,1009L189,978L140,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="243,994 232,998 232,989" style="fill:rgb(0,0,0)"/>
<path d="M189,994L237,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,1009L298,1009A15 15 0 0 0 313 994A15 15 0 0 0 298 978L258,978A15 15 0 0 0 243 994A15 15 0 0 0 258 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="336,994 324,998 324,989" style="fill:rgb(0,0,0)"/>
<path d="M313,994L330,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,1009L385,1009L385,978L336,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="408,994 396,998 396,989" style="fill:rgb(0,0,0)"/>
<path d="M385,994L402,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,1009L456,1009A15 15 0 0 0 472 994A15 15 0 0 0 456 978L423,978A15 15 0 0 0 408 994A15 15 0 0 0 423 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">THEN</text>
<polygon points="495,994 483,998 483,989" style="fill:rgb(0,0,0)"/>
<path d="M472,994L489,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M495,1009L544,1009L544,978L495,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="616,994 604,998 604,989" style="fill:rgb(0,0,0)"/>
<path d="M544,994L610,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M631,1009L658,1009A15 15 0 0 0 673 994A15 15 0 0 0 658 978L631,978A15 15 0 0 0 616 994A15 15 0 0 0 631 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="645" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ELSE</text>
<polygon points="696,994 685,998 685,989" style="fill:rgb(0,0,0)"/>
<path d="M673,994L691,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M696,1009L746,1009L746,978L696,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="721" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="782,994 770,998 770,989" style="fill:rgb(0,0,0)"/>
<path d="M746,994L776,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M797,1009L818,1009A15 15 0 0 0 833 994A15 15 0 0 0 818 978L797,978A15 15 0 0 0 782 994A15 15 0 0 0 797 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="807" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="916,994 905,998 905,989" style="fill:rgb(0,0,0)"/>
<path d="M833,994L910,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,994 L 924,994 Q 931,994 931,986 L 931,979"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,994 33,998 33,989" style="fill:rgb(0,0,0)"/>
<path d="M24,978 L 24,986 Q 24,994 31,994 L 39,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,994 L 111,994 Q 119,994 119,1007 Q 119,1021 134,1021 L 186,1021 Q 201,1021 201,1007 Q 201,994 208,994 L 216,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="360,1021 372,1016 372,1025" style="fill:rgb(0,0,0)"/>
<path d="M544,994 L 551,994 Q 559,994 559,1007 Q 559,1021 544,1021 L 381,1021 L 366,1021"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,1021 L 235,1021 Q 220,1021 220,1007 Q 220,994 227,994 L 235,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,994 L 585,994 Q 593,994 593,1007 Q 593,1021 608,1021 L 742,1021 Q 757,1021 757,1007 Q 757,994 765,994 L 772,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,1066L173,1066L173,1036L45,1036Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="1051" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">raise-function</text>
<polygon points="916,1051 905,1055 905,1047" style="fill:rgb(0,0,0)"/>
<path d="M173,1051L910,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,1051 L 924,1051 Q 931,1051 931,1036 L 931,32 Q 931,17 939,17 L 946,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,1051 33,1055 33,1047" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,1036 Q 24,1051 31,1051 L 39,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/filter-clause.html">filter-clause:</a></b>
<button id='xa8008ff6' onclick='hideorshow("xa8008ff6","xdc85b5a6")'>show</button></p>
 <div id='xdc85b5a6' style='display:none;' class='imgcontainer'>
 <div style="max-width:422px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 422.381 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L93,32A15 15 0 0 0 108 17A15 15 0 0 0 93 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FILTER</text>
<polygon points="131,17 119,21 119,12" style="fill:rgb(0,0,0)"/>
<path d="M108,17L125,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,32L146,32A15 15 0 0 0 161 17A15 15 0 0 0 146 2L146,2A15 15 0 0 0 131 17A15 15 0 0 0 146 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="184,17 173,21 173,12" style="fill:rgb(0,0,0)"/>
<path d="M161,17L178,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M199,32L249,32A15 15 0 0 0 264 17A15 15 0 0 0 249 2L199,2A15 15 0 0 0 184 17A15 15 0 0 0 199 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="224" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="287,17 275,21 275,12" style="fill:rgb(0,0,0)"/>
<path d="M264,17L281,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,32L336,32L336,2L287,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M336,17L353,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,32A15 15 0 0 0 389 17A15 15 0 0 0 374 2A15 15 0 0 0 359 17A15 15 0 0 0 374 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="374" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="413,17 401,21 401,12" style="fill:rgb(0,0,0)"/>
<path d="M389,17L407,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="416" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/function-arguments.html">function-arguments:</a></b>
<button id='xad9b3ab4' onclick='hideorshow("xad9b3ab4","xd65eed2e")'>show</button></p>
 <div id='xd65eed2e' style='display:none;' class='imgcontainer'>
 <div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.566 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,26 55,30 55,22" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,41 L 43,41 Q 43,26 52,26 L 61,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M82,41L150,41A15 15 0 0 0 165 26L165,26A15 15 0 0 0 150 11L82,11A15 15 0 0 0 66 26L66,26A15 15 0 0 0 82 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="183,26 171,30 171,22" style="fill:rgb(0,0,0)"/>
<path d="M165,26L177,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M183,26 L 189,26 Q 194,26 194,41 L 194,41 Q 194,56 203,56 L 212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M218,56L248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,71L303,71L303,41L254,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="447,56 435,60 435,52" style="fill:rgb(0,0,0)"/>
<path d="M303,56L441,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="116,56 104,60 104,52" style="fill:rgb(0,0,0)"/>
<path d="M32,56L110,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M116,56L212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,32A15 15 0 0 0 293 17A15 15 0 0 0 278 2A15 15 0 0 0 263 17A15 15 0 0 0 278 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="293,17 305,12 305,21" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 314,56 Q 326,56 326,41 L 326,32 Q 326,17 312,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M263,17 L 245,17 Q 230,17 230,32 L 230,41 Q 230,56 239,56 L 248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,207A15 15 0 0 0 243 192L243,192A15 15 0 0 0 228 177A15 15 0 0 0 213 192L213,192A15 15 0 0 0 228 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="213,192 201,196 201,188" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,71 L 43,177 Q 43,192 58,192 L 192,192 L 207,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,192 267,196 267,188" style="fill:rgb(0,0,0)"/>
<path d="M243,192L272,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,192 L 360,192 Q 375,192 390,192 L 394,192 Q 409,192 409,177 L 409,71 Q 409,56 415,56 L 421,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="228,216 216,221 216,212" style="fill:rgb(0,0,0)"/>
<path d="M116,192 L 181,192 Q 196,192 196,204 Q 196,216 209,216 L 222,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,216 L 242,216 Q 257,216 257,204 Q 257,192 262,192 L 268,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="90,117 78,121 78,112" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 313,56 Q 323,56 323,71 L 323,71 Q 323,86 308,86 L 81,86 Q 66,86 66,101 L 66,102 Q 66,117 75,117 L 84,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,132L149,132A15 15 0 0 0 164 117L164,117A15 15 0 0 0 149 101L105,101A15 15 0 0 0 90 117L90,117A15 15 0 0 0 105 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="182,117 170,121 170,112" style="fill:rgb(0,0,0)"/>
<path d="M164,117L176,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,132L201,132A15 15 0 0 0 216 117L216,117A15 15 0 0 0 201 101L197,101A15 15 0 0 0 182 117L182,117A15 15 0 0 0 197 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M216,117L239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,132L375,132L375,101L245,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,169A15 15 0 0 0 325 154A15 15 0 0 0 310 139A15 15 0 0 0 294 154A15 15 0 0 0 310 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,154 336,150 336,159" style="fill:rgb(0,0,0)"/>
<path d="M375,117 L 380,117 Q 386,117 386,132 L 386,139 Q 386,154 371,154 L 345,154 L 330,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M294,154 L 260,154 Q 245,154 236,154 Q 227,154 227,139 L 227,132 Q 227,117 233,117 L 239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M375,117 L 383,117 Q 392,117 392,102 L 392,71 Q 392,56 407,56 L 413,56 L 428,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='xa1e65490' onclick='hideorshow("xa1e65490","x4171eb5d")'>show</button></p>
 <div id='x4171eb5d' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/literal-value.html">literal-value:</a></b>
<button id='x6c84e564' onclick='hideorshow("x6c84e564","x96b56e89")'>show</button></p>
 <div id='x96b56e89' style='display:none;' class='imgcontainer'>
 <div style="max-width:341px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 341.376 336.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,319 39,324 39,315" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,304 Q 24,319 34,319 L 45,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,334L252,334A15 15 0 0 0 267 319A15 15 0 0 0 252 304L65,304A15 15 0 0 0 50 319A15 15 0 0 0 65 334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIMESTAMP</text>
<polygon points="290,319 278,324 278,315" style="fill:rgb(0,0,0)"/>
<path d="M267,319L284,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,17 320,21 320,12" style="fill:rgb(0,0,0)"/>
<path d="M290,319 L 297,319 Q 305,319 305,304 L 305,32 Q 305,17 315,17 L 326,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="335" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L172,32A15 15 0 0 0 187 17A15 15 0 0 0 172 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="119" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,17L320,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L153,70A15 15 0 0 0 168 55L168,55A15 15 0 0 0 153 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">string-literal</text>
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,47 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,55 278,59 278,50" style="fill:rgb(0,0,0)"/>
<path d="M168,55L284,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,55 L 297,55 Q 305,55 305,47 L 305,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L140,108A15 15 0 0 0 155 92A15 15 0 0 0 140 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">blob-literal</text>
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,85 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,92 278,97 278,88" style="fill:rgb(0,0,0)"/>
<path d="M155,92L284,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,92 L 297,92 Q 305,92 305,85 L 305,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,145L97,145A15 15 0 0 0 112 130A15 15 0 0 0 97 115L66,115A15 15 0 0 0 50 130A15 15 0 0 0 66 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="50,130 39,135 39,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 34,130 L 45,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,130 278,135 278,126" style="fill:rgb(0,0,0)"/>
<path d="M112,130L284,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,130 L 297,130 Q 305,130 305,123 L 305,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,183L96,183A15 15 0 0 0 111 168A15 15 0 0 0 96 153L66,153A15 15 0 0 0 50 168A15 15 0 0 0 66 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRUE</text>
<polygon points="50,168 39,172 39,164" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,160 Q 24,168 34,168 L 45,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,168 278,172 278,164" style="fill:rgb(0,0,0)"/>
<path d="M111,168L284,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,168 L 297,168 Q 305,168 305,160 L 305,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,221L104,221A15 15 0 0 0 119 206A15 15 0 0 0 104 191L66,191A15 15 0 0 0 50 206A15 15 0 0 0 66 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FALSE</text>
<polygon points="50,206 39,210 39,201" style="fill:rgb(0,0,0)"/>
<path d="M24,191 L 24,198 Q 24,206 34,206 L 45,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,206 278,210 278,201" style="fill:rgb(0,0,0)"/>
<path d="M119,206L284,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,206 L 297,206 Q 305,206 305,198 L 305,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,259L190,259A15 15 0 0 0 205 244A15 15 0 0 0 190 228L66,228A15 15 0 0 0 50 244A15 15 0 0 0 66 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="128" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIME</text>
<polygon points="50,244 39,248 39,239" style="fill:rgb(0,0,0)"/>
<path d="M24,228 L 24,236 Q 24,244 34,244 L 45,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,244 278,248 278,239" style="fill:rgb(0,0,0)"/>
<path d="M205,244L284,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,244 L 297,244 Q 305,244 305,236 L 305,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,297L192,297A15 15 0 0 0 207 281A15 15 0 0 0 192 266L66,266A15 15 0 0 0 50 281A15 15 0 0 0 66 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_DATE</text>
<polygon points="50,281 39,286 39,277" style="fill:rgb(0,0,0)"/>
<path d="M24,266 L 24,274 Q 24,281 34,281 L 45,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,281 278,286 278,277" style="fill:rgb(0,0,0)"/>
<path d="M207,281L284,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,281 L 297,281 Q 305,281 305,274 L 305,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/over-clause.html">over-clause:</a></b>
<button id='xd5852a9f' onclick='hideorshow("xd5852a9f","x47f3bb5d")'>show</button></p>
 <div id='x47f3bb5d' style='display:none;' class='imgcontainer'>
 <div style="max-width:600px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 600.706 418.392">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="129,17 117,21 117,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L123,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M144,32L241,32A15 15 0 0 0 256 17A15 15 0 0 0 241 2L144,2A15 15 0 0 0 129 17A15 15 0 0 0 144 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,17 L 100,17 Q 108,17 108,32 L 108,40 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,70A15 15 0 0 0 165 55L165,55A15 15 0 0 0 149 39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 149 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="149" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="206,82 195,86 195,77" style="fill:rgb(0,0,0)"/>
<path d="M165,55 L 172,55 Q 180,55 180,68 Q 180,82 190,82 L 200,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,97L363,97A15 15 0 0 0 378 82A15 15 0 0 0 363 67L221,67A15 15 0 0 0 206 82A15 15 0 0 0 221 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="292" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M221,173L301,173A15 15 0 0 0 316 157A15 15 0 0 0 301 142L221,142A15 15 0 0 0 206 157A15 15 0 0 0 221 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="339,157 328,162 328,153" style="fill:rgb(0,0,0)"/>
<path d="M316,157L333,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,173L358,173A15 15 0 0 0 373 157A15 15 0 0 0 358 142L354,142A15 15 0 0 0 339 157A15 15 0 0 0 354 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="409,157 398,162 398,153" style="fill:rgb(0,0,0)"/>
<path d="M373,157L404,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,173L459,173L459,142L409,142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M434,210A15 15 0 0 0 449 195A15 15 0 0 0 434 180A15 15 0 0 0 419 195A15 15 0 0 0 434 210Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="195" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="449,195 461,191 461,200" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,180 Q 474,195 464,195 L 455,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,195 L 398,195 Q 383,195 383,180 L 383,172 Q 383,157 390,157 L 398,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,55 280,59 280,50" style="fill:rgb(0,0,0)"/>
<path d="M165,55L286,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,120 304,115 304,124" style="fill:rgb(0,0,0)"/>
<path d="M292,55 L 401,55 Q 416,55 416,70 L 416,105 Q 416,120 401,120 L 313,120 L 298,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,157 195,162 195,153" style="fill:rgb(0,0,0)"/>
<path d="M292,120 L 180,120 Q 165,120 165,135 L 165,142 Q 165,157 180,157 L 185,157 L 200,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="401,82 389,86 389,77" style="fill:rgb(0,0,0)"/>
<path d="M378,82L395,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,82 L 408,82 Q 416,82 416,89 L 416,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,286L266,286A15 15 0 0 0 281 271A15 15 0 0 0 266 256L221,256A15 15 0 0 0 206 271A15 15 0 0 0 221 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="244" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="304,271 292,275 292,266" style="fill:rgb(0,0,0)"/>
<path d="M281,271L298,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M319,286L323,286A15 15 0 0 0 338 271A15 15 0 0 0 323 256L319,256A15 15 0 0 0 304 271A15 15 0 0 0 319 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="321" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="374,271 363,275 363,266" style="fill:rgb(0,0,0)"/>
<path d="M338,271L368,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,286L504,286L504,256L374,256Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M439,324A15 15 0 0 0 454 309A15 15 0 0 0 439 293A15 15 0 0 0 424 309A15 15 0 0 0 439 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="454,309 466,304 466,313" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,294 Q 519,309 504,309 L 475,309 L 460,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,309 L 363,309 Q 348,309 348,294 L 348,286 Q 348,271 355,271 L 363,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,233 304,229 304,237" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,218 Q 474,233 459,233 L 313,233 L 298,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,271 195,275 195,266" style="fill:rgb(0,0,0)"/>
<path d="M292,233 L 180,233 Q 165,233 165,248 L 165,256 Q 165,271 180,271 L 185,271 L 200,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,195 160,184 169,184" style="fill:rgb(0,0,0)"/>
<path d="M165,142L165,189"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,195L165,256"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,399L311,399L311,369L206,369Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="384" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="519,384 508,389 508,380" style="fill:rgb(0,0,0)"/>
<path d="M311,384L513,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M534,399A15 15 0 0 0 549 384A15 15 0 0 0 534 369A15 15 0 0 0 519 384A15 15 0 0 0 534 399Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="384" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="591,17 579,21 579,12" style="fill:rgb(0,0,0)"/>
<path d="M549,384 L 557,384 Q 564,384 564,369 L 564,32 Q 564,17 575,17 L 585,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="594" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,17 508,21 508,12" style="fill:rgb(0,0,0)"/>
<path d="M256,17L513,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,17L579,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,346 304,342 304,351" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,331 Q 519,346 504,346 L 313,346 L 298,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,384 195,389 195,380" style="fill:rgb(0,0,0)"/>
<path d="M292,346 L 180,346 Q 165,346 165,361 L 165,369 Q 165,384 180,384 L 185,384 L 200,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,309 160,297 169,297" style="fill:rgb(0,0,0)"/>
<path d="M165,256L165,303"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,309L165,369"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="258,411 247,416 247,407" style="fill:rgb(0,0,0)"/>
<path d="M165,369 L 165,396 Q 165,411 180,411 L 238,411 L 253,411"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,384 369,389 369,380" style="fill:rgb(0,0,0)"/>
<path d="M258,411 L 335,411 Q 350,411 350,398 Q 350,384 362,384 L 375,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='xe98a366b' onclick='hideorshow("xe98a366b","x249350e1")'>show</button></p>
 <div id='x249350e1' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='xdf00a6dc' onclick='hideorshow("xdf00a6dc","xdd17f952")'>show</button></p>
 <div id='xdd17f952' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/raise-function.html">raise-function:</a></b>
<button id='xc574249d' onclick='hideorshow("xc574249d","x5edc7d85")'>show</button></p>
 <div id='x5edc7d85' style='display:none;' class='imgcontainer'>
 <div style="max-width:627px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 627.302 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L82,32A15 15 0 0 0 97 17A15 15 0 0 0 82 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RAISE</text>
<polygon points="120,17 109,21 109,12" style="fill:rgb(0,0,0)"/>
<path d="M97,17L114,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,32L135,32A15 15 0 0 0 150 17A15 15 0 0 0 135 2L135,2A15 15 0 0 0 120 17A15 15 0 0 0 135 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="135" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="192,55 180,59 180,50" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 158,17 Q 165,17 165,32 L 165,40 Q 165,55 176,55 L 186,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,70L285,70A15 15 0 0 0 300 55L300,55A15 15 0 0 0 285 39L207,39A15 15 0 0 0 192 55L192,55A15 15 0 0 0 207 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="336,55 324,59 324,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70A15 15 0 0 0 366 55L366,55A15 15 0 0 0 351 39A15 15 0 0 0 336 55L336,55A15 15 0 0 0 351 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="389,55 378,59 378,50" style="fill:rgb(0,0,0)"/>
<path d="M366,55L383,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,70L508,70A15 15 0 0 0 523 55L523,55A15 15 0 0 0 508 39L404,39A15 15 0 0 0 389 55L389,55A15 15 0 0 0 404 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="456" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">error-message</text>
<polygon points="564,17 553,21 553,12" style="fill:rgb(0,0,0)"/>
<path d="M523,55 L 530,55 Q 538,55 538,40 L 538,32 Q 538,17 548,17 L 558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M579,32A15 15 0 0 0 594 17A15 15 0 0 0 579 2A15 15 0 0 0 564 17A15 15 0 0 0 579 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="617,17 606,21 606,12" style="fill:rgb(0,0,0)"/>
<path d="M594,17L612,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="621" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L259,32A15 15 0 0 0 274 17A15 15 0 0 0 259 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="456,17 444,21 444,12" style="fill:rgb(0,0,0)"/>
<path d="M274,17L450,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,17L553,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,108L249,108A15 15 0 0 0 264 92A15 15 0 0 0 249 77L207,77A15 15 0 0 0 192 92A15 15 0 0 0 207 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="300,92 288,97 288,88" style="fill:rgb(0,0,0)"/>
<path d="M264,92L294,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,92 L 307,92 Q 315,92 315,77 L 315,70 Q 315,55 322,55 L 330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,145L229,145A15 15 0 0 0 244 130A15 15 0 0 0 229 115L207,115A15 15 0 0 0 192 130A15 15 0 0 0 207 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="300,130 288,135 288,126" style="fill:rgb(0,0,0)"/>
<path d="M244,130L294,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,130 L 307,130 Q 315,130 315,115 L 315,92 L 315,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,130 180,135 180,126" style="fill:rgb(0,0,0)"/>
<path d="M165,39 L 165,115 Q 165,130 176,130 L 186,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,92 180,97 180,88" style="fill:rgb(0,0,0)"/>
<path d="M165,77 L 165,85 Q 165,92 176,92 L 186,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/select-stmt.html">select-stmt:</a></b>
<button id='x07863926' onclick='hideorshow("x07863926","x5c3be5e4")'>show</button></p>
 <div id='x5c3be5e4' style='display:none;' class='imgcontainer'>
 <div style="max-width:669px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 669.677 1162.3">
<path d="M55,845L667,845L667,99L55,99Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="6" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="46,17 34,21 34,12" style="fill:rgb(0,0,0)"/>
<path d="M10,17L40,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M61,32L92,32A15 15 0 0 0 107 17A15 15 0 0 0 92 2L61,2A15 15 0 0 0 46 17A15 15 0 0 0 61 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="76" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M167,62L253,62A15 15 0 0 0 268 47L268,47A15 15 0 0 0 253 32L167,32A15 15 0 0 0 152 47L152,47A15 15 0 0 0 167 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="210,17 198,21 198,12" style="fill:rgb(0,0,0)"/>
<path d="M107,17L204,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M210,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M358,32L584,32L584,2L358,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="152,47 140,51 140,43" style="fill:rgb(0,0,0)"/>
<path d="M107,17 L 114,17 Q 122,17 122,32 L 122,32 Q 122,47 134,47 L 146,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="291,47 279,51 279,43" style="fill:rgb(0,0,0)"/>
<path d="M268,47L285,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,47 L 298,47 Q 306,47 306,32 L 306,32 Q 306,17 321,17 L 331,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,70A15 15 0 0 0 486 55L486,55A15 15 0 0 0 471 39A15 15 0 0 0 456 55L456,55A15 15 0 0 0 471 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="486,55 498,50 498,59" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,40 Q 599,55 584,55 L 507,55 L 492,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,55 L 350,55 Q 335,55 335,40 L 335,32 Q 335,17 340,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,83 307,79 307,88" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,68 Q 599,83 584,83 L 316,83 L 301,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,83 L 40,83 Q 25,83 25,98 L 25,113"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="25,47 20,36 29,36" style="fill:rgb(0,0,0)"/>
<path d="M10,17 L 17,17 Q 25,17 25,29 L 25,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="55,129 43,133 43,124" style="fill:rgb(0,0,0)"/>
<path d="M25,47 L 25,114 Q 25,129 37,129 L 49,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,129 115,133 115,124" style="fill:rgb(0,0,0)"/>
<path d="M55,129L121,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,144L193,144A15 15 0 0 0 208 129A15 15 0 0 0 193 114L142,114A15 15 0 0 0 127 129A15 15 0 0 0 142 144Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="250,159 238,163 238,155" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,144 Q 223,159 233,159 L 244,159"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,174L333,174A15 15 0 0 0 348 159A15 15 0 0 0 333 144L265,144A15 15 0 0 0 250 159A15 15 0 0 0 265 174Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="159" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="417,129 406,133 406,124" style="fill:rgb(0,0,0)"/>
<path d="M348,159 L 356,159 Q 363,159 363,144 L 363,144 Q 363,129 378,129 L 396,129 L 411,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,144L545,144L545,114L417,114Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M481,182A15 15 0 0 0 496 166A15 15 0 0 0 481 151A15 15 0 0 0 466 166A15 15 0 0 0 481 182Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="166" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="496,166 508,162 508,171" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,151 Q 560,166 545,166 L 517,166 L 502,166"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M466,166 L 406,166 Q 391,166 391,151 L 391,144 Q 391,129 398,129 L 406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,129 287,133 287,124" style="fill:rgb(0,0,0)"/>
<path d="M208,129L293,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M299,129L406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,212L280,212A15 15 0 0 0 295 197A15 15 0 0 0 280 182L265,182A15 15 0 0 0 250 197A15 15 0 0 0 265 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="197" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="348,197 337,201 337,192" style="fill:rgb(0,0,0)"/>
<path d="M295,197L342,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,197 L 356,197 Q 363,197 363,182 L 363,159 L 363,144"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="250,197 238,201 238,192" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,182 Q 223,197 233,197 L 244,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,287L203,287A15 15 0 0 0 218 272A15 15 0 0 0 203 257L168,257A15 15 0 0 0 153 272A15 15 0 0 0 168 287Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="186" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="290,272 279,277 279,268" style="fill:rgb(0,0,0)"/>
<path d="M218,272L284,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,287L451,287L451,257L290,257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M320,362L422,362L422,331L320,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M371,324A15 15 0 0 0 386 309A15 15 0 0 0 371 293A15 15 0 0 0 356 309A15 15 0 0 0 371 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="386,309 397,304 397,313" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 459,272 Q 466,272 466,287 L 466,294 Q 466,309 451,309 L 407,309 L 392,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M356,309 L 279,309 Q 264,309 264,294 L 264,287 Q 264,272 271,272 L 279,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="320,346 308,351 308,342" style="fill:rgb(0,0,0)"/>
<path d="M218,272 L 226,272 Q 233,272 233,287 L 233,331 Q 233,346 248,346 L 299,346 L 314,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="484,313 488,325 480,325" style="fill:rgb(0,0,0)"/>
<path d="M422,346 L 436,346 Q 451,346 466,346 L 469,346 Q 484,346 484,333 L 484,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,272 494,277 494,268" style="fill:rgb(0,0,0)"/>
<path d="M484,313 L 484,287 Q 484,272 492,272 L 499,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,272 L 496,272 Q 487,272 487,272 Q 487,272 495,272 L 502,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,197 555,185 564,185" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,176 L 560,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,235 360,230 360,239" style="fill:rgb(0,0,0)"/>
<path d="M560,197 L 560,220 Q 560,235 545,235 L 369,235 L 354,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,272 142,277 142,268" style="fill:rgb(0,0,0)"/>
<path d="M348,235 L 142,235 Q 127,235 127,250 L 127,257 Q 127,272 137,272 L 147,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,437L218,437A15 15 0 0 0 233 422A15 15 0 0 0 218 407L168,407A15 15 0 0 0 153 422A15 15 0 0 0 168 437Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="256,422 244,426 244,418" style="fill:rgb(0,0,0)"/>
<path d="M233,422L250,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,437L305,437L305,407L256,407Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="517,324 513,312 521,312" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 502,272 Q 517,272 517,287 L 517,303 L 517,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,384 382,380 382,389" style="fill:rgb(0,0,0)"/>
<path d="M517,324 L 517,369 Q 517,384 502,384 L 391,384 L 376,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,422 142,426 142,418" style="fill:rgb(0,0,0)"/>
<path d="M371,384 L 142,384 Q 127,384 127,399 L 127,407 Q 127,422 137,422 L 147,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,324 122,312 131,312" style="fill:rgb(0,0,0)"/>
<path d="M127,257L127,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,324L127,407"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,535L212,535A15 15 0 0 0 227 520A15 15 0 0 0 212 505L168,505A15 15 0 0 0 153 520A15 15 0 0 0 168 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="250,520 238,525 238,516" style="fill:rgb(0,0,0)"/>
<path d="M227,520L244,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,535L269,535A15 15 0 0 0 284 520A15 15 0 0 0 269 505L265,505A15 15 0 0 0 250 520A15 15 0 0 0 265 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="320,520 309,525 309,516" style="fill:rgb(0,0,0)"/>
<path d="M284,520L314,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,535L369,535L369,505L320,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="452,520 441,525 441,516" style="fill:rgb(0,0,0)"/>
<path d="M369,520L446,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,535L520,535A15 15 0 0 0 535 520A15 15 0 0 0 520 505L467,505A15 15 0 0 0 452 520A15 15 0 0 0 467 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="558,520 546,525 546,516" style="fill:rgb(0,0,0)"/>
<path d="M535,520L552,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,535L607,535L607,505L558,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M345,573A15 15 0 0 0 360 558A15 15 0 0 0 345 543A15 15 0 0 0 330 558A15 15 0 0 0 345 573Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="558" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="360,558 371,554 371,562" style="fill:rgb(0,0,0)"/>
<path d="M369,520 L 377,520 Q 384,520 384,535 L 384,543 Q 384,558 375,558 L 366,558"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,558 L 309,558 Q 294,558 294,543 L 294,535 Q 294,520 301,520 L 309,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="514,551 503,555 503,546" style="fill:rgb(0,0,0)"/>
<path d="M411,520 L 418,520 Q 426,520 426,535 L 426,536 Q 426,551 441,551 L 493,551 L 508,551"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M514,551 L 607,551 Q 622,551 622,536 L 622,535 Q 622,520 630,520 L 637,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,490 256,494 256,486" style="fill:rgb(0,0,0)"/>
<path d="M127,460 L 127,475 Q 127,490 142,490 L 246,490 L 261,490"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,520 399,525 399,516" style="fill:rgb(0,0,0)"/>
<path d="M267,490 L 369,490 Q 384,490 384,505 L 384,505 Q 384,520 395,520 L 405,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,460 244,455 244,464" style="fill:rgb(0,0,0)"/>
<path d="M305,422 L 313,422 Q 320,422 320,437 L 320,445 Q 320,460 305,460 L 254,460 L 239,460"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,520 142,525 142,516" style="fill:rgb(0,0,0)"/>
<path d="M233,460 L 142,460 Q 127,460 127,475 L 127,505 Q 127,520 137,520 L 147,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,447 122,435 131,435" style="fill:rgb(0,0,0)"/>
<path d="M127,407L127,441"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,447L127,505"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,649L232,649A15 15 0 0 0 247 634A15 15 0 0 0 232 619L168,619A15 15 0 0 0 153 634A15 15 0 0 0 168 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="200" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="283,634 271,638 271,629" style="fill:rgb(0,0,0)"/>
<path d="M247,634L277,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,649L395,649A15 15 0 0 0 410 634A15 15 0 0 0 395 619L298,619A15 15 0 0 0 283 634A15 15 0 0 0 298 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="433,634 422,638 422,629" style="fill:rgb(0,0,0)"/>
<path d="M410,634L427,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,649L452,649A15 15 0 0 0 467 634A15 15 0 0 0 452 619L448,619A15 15 0 0 0 433 634A15 15 0 0 0 448 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="450" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="490,634 479,638 479,629" style="fill:rgb(0,0,0)"/>
<path d="M467,634L485,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,649L609,649L609,619L490,619Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="550" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M446,687A15 15 0 0 0 461 671A15 15 0 0 0 446 656A15 15 0 0 0 431 671A15 15 0 0 0 446 687Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="671" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="461,671 472,667 472,676" style="fill:rgb(0,0,0)"/>
<path d="M609,634 L 616,634 Q 624,634 624,649 L 624,656 Q 624,671 609,671 L 482,671 L 467,671"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,671 L 271,671 Q 256,671 256,656 L 256,649 Q 256,634 264,634 L 271,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="624,692 619,680 628,680" style="fill:rgb(0,0,0)"/>
<path d="M624,656L624,686"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,558 648,547 656,547" style="fill:rgb(0,0,0)"/>
<path d="M607,520 L 637,520 Q 652,520 652,535 L 652,537 L 652,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,596 382,592 382,600" style="fill:rgb(0,0,0)"/>
<path d="M652,558 L 652,581 Q 652,596 637,596 L 391,596 L 376,596"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,634 142,638 142,629" style="fill:rgb(0,0,0)"/>
<path d="M371,596 L 142,596 Q 127,596 127,611 L 127,619 Q 127,634 137,634 L 147,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,558 122,547 131,547" style="fill:rgb(0,0,0)"/>
<path d="M127,505L127,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,709 359,714 359,705" style="fill:rgb(0,0,0)"/>
<path d="M127,558 L 127,694 Q 127,709 142,709 L 350,709 L 365,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,709 597,714 597,705" style="fill:rgb(0,0,0)"/>
<path d="M371,709L603,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,709 L 616,709 Q 624,709 624,717 L 624,724"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,800L194,800A15 15 0 0 0 209 785A15 15 0 0 0 194 770L142,770A15 15 0 0 0 127 785A15 15 0 0 0 142 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="245,785 234,789 234,781" style="fill:rgb(0,0,0)"/>
<path d="M209,785L239,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,800A15 15 0 0 0 275 785A15 15 0 0 0 260 770A15 15 0 0 0 245 785A15 15 0 0 0 260 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="311,785 300,789 300,781" style="fill:rgb(0,0,0)"/>
<path d="M275,785L306,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,800L361,800L361,770L311,770Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="397,785 385,789 385,781" style="fill:rgb(0,0,0)"/>
<path d="M361,785L391,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,800A15 15 0 0 0 427 785A15 15 0 0 0 412 770A15 15 0 0 0 397 785A15 15 0 0 0 412 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="412" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="609,785 597,789 597,781" style="fill:rgb(0,0,0)"/>
<path d="M427,785L603,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,785 L 616,785 Q 624,785 624,792 L 624,800"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,762A15 15 0 0 0 351 747A15 15 0 0 0 336 732A15 15 0 0 0 321 747A15 15 0 0 0 336 762Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="747" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M336,838A15 15 0 0 0 351 823A15 15 0 0 0 336 808A15 15 0 0 0 321 823A15 15 0 0 0 336 838Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="823" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="351,747 363,743 363,751" style="fill:rgb(0,0,0)"/>
<path d="M361,785 L 368,785 Q 376,785 376,770 L 376,762 Q 376,747 366,747 L 357,747"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,747 L 300,747 Q 285,747 285,762 L 285,770 Q 285,785 292,785 L 300,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,823 363,818 363,827" style="fill:rgb(0,0,0)"/>
<path d="M427,785 L 434,785 Q 442,785 442,800 L 442,808 Q 442,823 427,823 L 372,823 L 357,823"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,823 L 234,823 Q 219,823 219,808 L 219,800 Q 219,785 226,785 L 234,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,785 115,789 115,781" style="fill:rgb(0,0,0)"/>
<path d="M55,129 L 62,129 Q 70,129 70,144 L 70,770 Q 70,785 85,785 L 106,785 L 121,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,891L424,891L424,860L248,860Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="876" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="424,876 436,871 436,880" style="fill:rgb(0,0,0)"/>
<path d="M624,692 L 624,861 Q 624,876 609,876 L 445,876 L 430,876"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="6,197 10,208 2,208" style="fill:rgb(0,0,0)"/>
<path d="M248,876 L 21,876 Q 6,876 6,861 L 6,217 L 6,202"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M6,197 L 6,144 Q 6,129 21,129 L 40,129 L 55,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="667" y="275" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" transform="rotate(-90 667,285)" dominant-baseline="central">select-core</text>
<path d="M168,966L213,966A15 15 0 0 0 228 951A15 15 0 0 0 213 936L168,936A15 15 0 0 0 153 951A15 15 0 0 0 168 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="251,951 239,956 239,947" style="fill:rgb(0,0,0)"/>
<path d="M228,951L245,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,966L270,966A15 15 0 0 0 285 951A15 15 0 0 0 270 936L266,936A15 15 0 0 0 251 951A15 15 0 0 0 266 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M168,1072L202,1072A15 15 0 0 0 217 1057A15 15 0 0 0 202 1042L168,1042A15 15 0 0 0 153 1057A15 15 0 0 0 168 1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="240,1057 228,1061 228,1053" style="fill:rgb(0,0,0)"/>
<path d="M217,1057L234,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,1072L289,1072L289,1042L240,1042Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="330,951 319,956 319,947" style="fill:rgb(0,0,0)"/>
<path d="M285,951L324,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,966L460,966L460,936L330,936Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M395,1004A15 15 0 0 0 410 989A15 15 0 0 0 395 974A15 15 0 0 0 380 989A15 15 0 0 0 395 1004Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="989" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="410,989 422,985 422,993" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 468,951 Q 475,951 475,966 L 475,974 Q 475,989 460,989 L 431,989 L 416,989"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,989 L 322,989 Q 307,989 307,974 L 307,966 Q 307,951 313,951 L 319,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,913 348,909 348,918" style="fill:rgb(0,0,0)"/>
<path d="M624,860 L 624,898 Q 624,913 609,913 L 357,913 L 342,913"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,951 142,956 142,947" style="fill:rgb(0,0,0)"/>
<path d="M336,913 L 142,913 Q 127,913 127,928 L 127,936 Q 127,951 137,951 L 147,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,981 492,970 500,970" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 481,951 Q 496,951 496,963 L 496,976"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,1023 318,1019 318,1027" style="fill:rgb(0,0,0)"/>
<path d="M496,981 L 496,1008 Q 496,1023 481,1023 L 327,1023 L 312,1023"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,1057 142,1061 142,1053" style="fill:rgb(0,0,0)"/>
<path d="M307,1023 L 142,1023 Q 127,1023 127,1038 L 127,1042 Q 127,1057 137,1057 L 147,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,989 122,978 131,978" style="fill:rgb(0,0,0)"/>
<path d="M127,936L127,983"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,989L127,1042"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1102L415,1102A15 15 0 0 0 430 1087A15 15 0 0 0 415 1072L363,1072A15 15 0 0 0 348 1087A15 15 0 0 0 363 1102Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="389" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="453,1087 441,1092 441,1083" style="fill:rgb(0,0,0)"/>
<path d="M430,1087L447,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,1102L502,1102L502,1072L453,1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="525,1087 513,1092 513,1083" style="fill:rgb(0,0,0)"/>
<path d="M502,1087L519,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1140A15 15 0 0 0 378 1125A15 15 0 0 0 363 1110A15 15 0 0 0 348 1125A15 15 0 0 0 363 1140Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="1125" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="401,1125 390,1129 390,1121" style="fill:rgb(0,0,0)"/>
<path d="M378,1125L396,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,1140L451,1140L451,1110L401,1110Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="1125" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="312,1057 301,1061 301,1053" style="fill:rgb(0,0,0)"/>
<path d="M289,1057L306,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1125 337,1129 337,1121" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1110 Q 327,1125 335,1125 L 342,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1087 337,1092 337,1083" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1072 Q 327,1087 335,1087 L 342,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1057 513,1061 513,1053" style="fill:rgb(0,0,0)"/>
<path d="M312,1057L519,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="620,1155 609,1160 609,1151" style="fill:rgb(0,0,0)"/>
<path d="M525,1057 L 546,1057 Q 561,1057 561,1072 L 561,1140 Q 561,1155 576,1155 L 599,1155 L 614,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="624" cy="1155" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1087 L 546,1087 Q 561,1087 561,1095 L 561,1102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1125 513,1129 513,1121" style="fill:rgb(0,0,0)"/>
<path d="M451,1125L519,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1125 L 546,1125 Q 561,1125 561,1133 L 561,1140"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1155 513,1160 513,1151" style="fill:rgb(0,0,0)"/>
<path d="M127,1042 L 127,1140 Q 127,1155 142,1155 L 504,1155 L 519,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1155L597,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/compound-operator.html">compound-operator:</a></b>
<button id='x23768cce' onclick='hideorshow("x23768cce","xbc649fb0")'>show</button></p>
 <div id='xbc649fb0' style='display:none;' class='imgcontainer'>
 <div style="max-width:293px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 293.842 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L127,32A15 15 0 0 0 142 17A15 15 0 0 0 127 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,70L127,70A15 15 0 0 0 142 55L142,55A15 15 0 0 0 127 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,108L168,108A15 15 0 0 0 183 92A15 15 0 0 0 168 77L83,77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M83,145L135,145A15 15 0 0 0 150 130A15 15 0 0 0 135 115L83,115A15 15 0 0 0 68 130A15 15 0 0 0 83 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M142,55L159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70L195,70A15 15 0 0 0 210 55L210,55A15 15 0 0 0 195 39L180,39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="233,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M210,55L227,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,17 272,21 272,12" style="fill:rgb(0,0,0)"/>
<path d="M233,55 L 240,55 Q 248,55 248,40 L 248,32 Q 248,17 263,17 L 263,17 L 278,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="288" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M47,39 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,92 221,97 221,88" style="fill:rgb(0,0,0)"/>
<path d="M183,92L227,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,92 L 240,92 Q 248,92 248,77 L 248,54 L 248,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,130 56,135 56,126" style="fill:rgb(0,0,0)"/>
<path d="M47,77 L 47,115 Q 47,130 55,130 L 62,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,130 221,135 221,126" style="fill:rgb(0,0,0)"/>
<path d="M150,130L227,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,130 L 240,130 Q 248,130 248,115 L 248,92 L 248,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-clause.html">join-clause:</a></b>
<button id='x76ef0c32' onclick='hideorshow("x76ef0c32","x307c6b21")'>show</button></p>
 <div id='x307c6b21' style='display:none;' class='imgcontainer'>
 <div style="max-width:793px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 793.282 84.24">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L193,32L193,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="259,47 247,51 247,43" style="fill:rgb(0,0,0)"/>
<path d="M193,17 L 200,17 Q 208,17 208,32 L 208,32 Q 208,47 223,47 L 238,47 L 253,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,62L380,62L380,32L259,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-operator</text>
<polygon points="403,47 391,51 391,43" style="fill:rgb(0,0,0)"/>
<path d="M380,47L397,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,62L564,62L564,32L403,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="587,47 575,51 575,43" style="fill:rgb(0,0,0)"/>
<path d="M564,47L581,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M587,62L721,62L721,32L587,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="654" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-constraint</text>
<polygon points="783,17 772,21 772,12" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 742,47 Q 757,47 757,32 L 757,32 Q 757,17 767,17 L 778,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="787" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M193,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,17L776,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,77 495,73 495,82" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 728,47 Q 736,47 736,62 L 736,62 Q 736,77 721,77 L 504,77 L 489,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,77 L 247,77 Q 232,77 232,62 L 232,62 Q 232,47 246,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/join-constraint.html">join-constraint:</a></b>
<button id='xf0d9ad6b' onclick='hideorshow("xf0d9ad6b","xa99f0bf3")'>show</button></p>
 <div id='xa99f0bf3' style='display:none;' class='imgcontainer'>
 <div style="max-width:483px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 483.336 126.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L104,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 104 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="143,55 131,59 131,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L137,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,70A15 15 0 0 0 173 55L173,55A15 15 0 0 0 158 39A15 15 0 0 0 143 55L143,55A15 15 0 0 0 158 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="209,55 197,59 197,50" style="fill:rgb(0,0,0)"/>
<path d="M173,55L203,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M224,70L318,70A15 15 0 0 0 333 55L333,55A15 15 0 0 0 318 39L224,39A15 15 0 0 0 209 55L209,55A15 15 0 0 0 224 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="369,55 358,59 358,50" style="fill:rgb(0,0,0)"/>
<path d="M333,55L363,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,70A15 15 0 0 0 399 55L399,55A15 15 0 0 0 384 39A15 15 0 0 0 369 55L369,55A15 15 0 0 0 384 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="422,55 411,59 411,50" style="fill:rgb(0,0,0)"/>
<path d="M399,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="473,17 462,21 462,12" style="fill:rgb(0,0,0)"/>
<path d="M422,55 L 430,55 Q 437,55 437,40 L 437,32 Q 437,17 452,17 L 453,17 L 468,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="477" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,108A15 15 0 0 0 286 92A15 15 0 0 0 271 77A15 15 0 0 0 256 92A15 15 0 0 0 271 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="286,92 298,88 298,97" style="fill:rgb(0,0,0)"/>
<path d="M333,55 L 341,55 Q 348,55 348,70 L 348,77 Q 348,92 333,92 L 307,92 L 292,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,92 L 197,92 Q 182,92 182,77 L 182,70 Q 182,55 190,55 L 197,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L74,32A15 15 0 0 0 90 17A15 15 0 0 0 74 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="113,17 101,21 101,12" style="fill:rgb(0,0,0)"/>
<path d="M90,17L107,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M113,32L162,32L162,2L113,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="422,17 411,21 411,12" style="fill:rgb(0,0,0)"/>
<path d="M162,17L417,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,17L462,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="209,120 197,124 197,115" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,105 Q 24,120 39,120 L 188,120 L 203,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,120 L 422,120 Q 437,120 437,105 L 437,54 L 437,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-operator.html">join-operator:</a></b>
<button id='x0a8a692b' onclick='hideorshow("x0a8a692b","x6b8693de")'>show</button></p>
 <div id='x6b8693de' style='display:none;' class='imgcontainer'>
 <div style="max-width:620px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 620.333 255.312">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,71 39,76 39,67" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,56 Q 24,71 34,71 L 45,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,86L133,86A15 15 0 0 0 148 71A15 15 0 0 0 133 56L66,56A15 15 0 0 0 50 71A15 15 0 0 0 66 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="99" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NATURAL</text>
<polygon points="189,41 178,45 178,37" style="fill:rgb(0,0,0)"/>
<path d="M148,71 L 155,71 Q 163,71 163,56 L 163,56 Q 163,41 173,41 L 184,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,71 219,76 219,67" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,56 Q 204,71 215,71 L 225,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,86L273,86A15 15 0 0 0 288 71A15 15 0 0 0 273 56L246,56A15 15 0 0 0 231 71A15 15 0 0 0 246 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LEFT</text>
<polygon points="378,71 366,76 366,67" style="fill:rgb(0,0,0)"/>
<path d="M288,71L372,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,86L437,86A15 15 0 0 0 452 71A15 15 0 0 0 437 56L393,56A15 15 0 0 0 378 71A15 15 0 0 0 393 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OUTER</text>
<polygon points="475,71 463,76 463,67" style="fill:rgb(0,0,0)"/>
<path d="M452,71L469,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="516,41 505,45 505,37" style="fill:rgb(0,0,0)"/>
<path d="M475,71 L 482,71 Q 490,71 490,56 L 490,56 Q 490,41 500,41 L 511,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,56L554,56A15 15 0 0 0 569 41A15 15 0 0 0 554 26L532,26A15 15 0 0 0 516 41A15 15 0 0 0 532 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="543" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">JOIN</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M569,41 L 576,41 Q 584,41 584,29 Q 584,17 594,17 L 605,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="614" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,32A15 15 0 0 0 325 17A15 15 0 0 0 310 2A15 15 0 0 0 295 17A15 15 0 0 0 310 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="295,17 283,21 283,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L289,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M325,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="99,41 88,45 88,37" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,29 Q 24,41 39,41 L 78,41 L 93,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M99,41L178,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,41L505,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,41 366,45 366,37" style="fill:rgb(0,0,0)"/>
<path d="M336,71 L 344,71 Q 351,71 351,56 L 351,56 Q 351,41 362,41 L 372,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,109 219,113 219,105" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,94 Q 204,109 215,109 L 225,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,124L284,124A15 15 0 0 0 299 109A15 15 0 0 0 284 94L246,94A15 15 0 0 0 231 109A15 15 0 0 0 246 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RIGHT</text>
<polygon points="341,71 329,76 329,67" style="fill:rgb(0,0,0)"/>
<path d="M299,109 L 307,109 Q 314,109 314,94 L 314,86 Q 314,71 324,71 L 335,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,147 219,151 219,142" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,132 Q 204,147 215,147 L 225,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,162L274,162A15 15 0 0 0 289 147A15 15 0 0 0 274 132L246,132A15 15 0 0 0 231 147A15 15 0 0 0 246 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FULL</text>
<path d="M289,147 L 302,147 Q 314,147 314,132 L 314,109 L 314,94"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,192 219,196 219,188" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,177 Q 204,192 215,192 L 225,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,207L287,207A15 15 0 0 0 302 192A15 15 0 0 0 287 177L246,177A15 15 0 0 0 231 192A15 15 0 0 0 246 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="192" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INNER</text>
<polygon points="475,192 463,196 463,188" style="fill:rgb(0,0,0)"/>
<path d="M302,192L469,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,192 L 482,192 Q 490,192 490,185 L 490,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,238 219,242 219,233" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,223 Q 24,238 39,238 L 210,238 L 225,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,253L287,253A15 15 0 0 0 303 238A15 15 0 0 0 287 222L246,222A15 15 0 0 0 231 238A15 15 0 0 0 246 253Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="238" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CROSS</text>
<polygon points="475,238 463,242 463,233" style="fill:rgb(0,0,0)"/>
<path d="M303,238L469,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,238 L 482,238 Q 490,238 490,223 L 490,71 L 490,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x5c0c3a8d' onclick='hideorshow("x5c0c3a8d","x21a91d42")'>show</button></p>
 <div id='x21a91d42' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/result-column.html">result-column:</a></b>
<button id='x0ccaea34' onclick='hideorshow("x0ccaea34","xf610dba4")'>show</button></p>
 <div id='xf610dba4' style='display:none;' class='imgcontainer'>
 <div style="max-width:398px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 398.054 163.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L94,32L94,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="136,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M94,17 L 102,17 Q 109,17 109,32 L 109,40 Q 109,55 119,55 L 130,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M151,70L155,70A15 15 0 0 0 170 55L170,55A15 15 0 0 0 155 39L151,39A15 15 0 0 0 136 55L136,55A15 15 0 0 0 151 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="206,55 194,59 194,50" style="fill:rgb(0,0,0)"/>
<path d="M170,55L200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,70L309,70A15 15 0 0 0 324 55L324,55A15 15 0 0 0 309 39L221,39A15 15 0 0 0 206 55L206,55A15 15 0 0 0 221 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="347,55 335,59 335,50" style="fill:rgb(0,0,0)"/>
<path d="M324,55L341,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,17 377,21 377,12" style="fill:rgb(0,0,0)"/>
<path d="M347,55 L 354,55 Q 362,55 362,40 L 362,32 Q 362,17 372,17 L 382,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="392" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,85 141,89 141,81" style="fill:rgb(0,0,0)"/>
<path d="M109,39 L 109,70 Q 109,85 124,85 L 132,85 L 147,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,85 L 170,85 Q 185,85 185,70 L 185,70 Q 185,55 192,55 L 200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="241,17 230,21 230,12" style="fill:rgb(0,0,0)"/>
<path d="M94,17L235,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M241,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,108 39,112 39,103" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,93 Q 24,108 34,108 L 45,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,123A15 15 0 0 0 81 108A15 15 0 0 0 66 92A15 15 0 0 0 50 108A15 15 0 0 0 66 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="108" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,108 335,112 335,103" style="fill:rgb(0,0,0)"/>
<path d="M81,108L341,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,108 L 354,108 Q 362,108 362,93 L 362,54 L 362,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,145 39,150 39,141" style="fill:rgb(0,0,0)"/>
<path d="M24,92 L 24,130 Q 24,145 34,145 L 45,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,160L141,160A15 15 0 0 0 156 145A15 15 0 0 0 141 130L66,130A15 15 0 0 0 50 145A15 15 0 0 0 66 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="145" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="179,145 167,150 167,141" style="fill:rgb(0,0,0)"/>
<path d="M156,145L173,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M194,160A15 15 0 0 0 209 145A15 15 0 0 0 194 130A15 15 0 0 0 179 145A15 15 0 0 0 194 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="232,145 221,150 221,141" style="fill:rgb(0,0,0)"/>
<path d="M209,145L226,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,160A15 15 0 0 0 262 145A15 15 0 0 0 247 130A15 15 0 0 0 232 145A15 15 0 0 0 247 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,145 335,150 335,141" style="fill:rgb(0,0,0)"/>
<path d="M262,145L341,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,145 L 354,145 Q 362,145 362,130 L 362,107 L 362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/table-or-subquery.html">table-or-subquery:</a></b>
<button id='xad0efe5d' onclick='hideorshow("xad0efe5d","xde9af81d")'>show</button></p>
 <div id='xde9af81d' style='display:none;' class='imgcontainer'>
 <div style="max-width:720px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 720.778 457.704">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,74 39,78 39,70" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,59 Q 24,74 34,74 L 45,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,89L162,89A15 15 0 0 0 177 74L177,74A15 15 0 0 0 162 59L66,59A15 15 0 0 0 50 74L50,74A15 15 0 0 0 66 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="194,74 183,78 183,70" style="fill:rgb(0,0,0)"/>
<path d="M177,74L189,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,89A15 15 0 0 0 225 74L225,74A15 15 0 0 0 209 59A15 15 0 0 0 194 74L194,74A15 15 0 0 0 209 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="266,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M225,74 L 232,74 Q 240,74 240,59 L 240,51 Q 240,36 250,36 L 260,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,51L356,51A15 15 0 0 0 371 36A15 15 0 0 0 356 21L281,21A15 15 0 0 0 266 36A15 15 0 0 0 281 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="407,36 396,41 396,32" style="fill:rgb(0,0,0)"/>
<path d="M371,36L402,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,51L427,51A15 15 0 0 0 442 36A15 15 0 0 0 427 21L423,21A15 15 0 0 0 407 36A15 15 0 0 0 423 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="478,36 466,41 466,32" style="fill:rgb(0,0,0)"/>
<path d="M442,36L472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,51L561,51A15 15 0 0 0 577 36A15 15 0 0 0 561 21L493,21A15 15 0 0 0 478 36A15 15 0 0 0 493 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="527" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<path d="M9,36L255,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="422,6 411,10 411,2" style="fill:rgb(0,0,0)"/>
<path d="M371,36 L 379,36 Q 386,36 386,21 L 386,21 Q 386,6 401,6 L 402,6 L 417,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 442,6 Q 457,6 457,21 L 457,21 Q 457,36 464,36 L 472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 577,6 Q 592,6 592,21 L 592,21 Q 592,36 599,36 L 607,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,127L388,127A15 15 0 0 0 403 112A15 15 0 0 0 388 97L323,97A15 15 0 0 0 308 112A15 15 0 0 0 323 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="426,112 415,116 415,108" style="fill:rgb(0,0,0)"/>
<path d="M403,112L420,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,127L445,127A15 15 0 0 0 460 112A15 15 0 0 0 445 97L441,97A15 15 0 0 0 426 112A15 15 0 0 0 441 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="443" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="483,112 472,116 472,108" style="fill:rgb(0,0,0)"/>
<path d="M460,112L478,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,127L577,127A15 15 0 0 0 592 112A15 15 0 0 0 577 97L499,97A15 15 0 0 0 483 112A15 15 0 0 0 499 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="538" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M323,165L343,165A15 15 0 0 0 359 150A15 15 0 0 0 343 135L323,135A15 15 0 0 0 308 150A15 15 0 0 0 323 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="382,150 370,154 370,145" style="fill:rgb(0,0,0)"/>
<path d="M359,150L376,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,165L461,165A15 15 0 0 0 476 150A15 15 0 0 0 461 135L397,135A15 15 0 0 0 382 150A15 15 0 0 0 397 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="527,74 539,70 539,78" style="fill:rgb(0,0,0)"/>
<path d="M577,36 L 607,36 Q 622,36 622,51 L 622,59 Q 622,74 607,74 L 548,74 L 533,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,150 297,154 297,145" style="fill:rgb(0,0,0)"/>
<path d="M527,74 L 297,74 Q 282,74 282,89 L 282,135 Q 282,150 292,150 L 302,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,112 297,116 297,108" style="fill:rgb(0,0,0)"/>
<path d="M282,97 L 282,104 Q 282,112 292,112 L 302,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="266,213 255,217 255,209" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,198 Q 24,213 39,213 L 245,213 L 260,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,228L431,228A15 15 0 0 0 446 213A15 15 0 0 0 431 198L281,198A15 15 0 0 0 266 213A15 15 0 0 0 281 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function-name</text>
<polygon points="463,213 452,217 452,209" style="fill:rgb(0,0,0)"/>
<path d="M446,213L457,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,228A15 15 0 0 0 493 213A15 15 0 0 0 478 198A15 15 0 0 0 463 213A15 15 0 0 0 478 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="529,213 518,217 518,209" style="fill:rgb(0,0,0)"/>
<path d="M493,213L524,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M529,228L579,228L579,198L529,198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="615,213 603,217 603,209" style="fill:rgb(0,0,0)"/>
<path d="M579,213L609,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M630,228A15 15 0 0 0 645 213A15 15 0 0 0 630 198A15 15 0 0 0 615 213A15 15 0 0 0 630 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="630" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="675,187 679,198 671,198" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 660,213 Q 675,213 675,203 L 675,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M554,190A15 15 0 0 0 569 175A15 15 0 0 0 554 160A15 15 0 0 0 539 175A15 15 0 0 0 554 190Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="175" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="569,175 581,171 581,180" style="fill:rgb(0,0,0)"/>
<path d="M579,213 L 586,213 Q 594,213 594,198 L 594,190 Q 594,175 584,175 L 575,175"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,175 L 518,175 Q 503,175 503,190 L 503,198 Q 503,213 510,213 L 518,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,74 L 232,74 Q 240,74 240,89 L 240,198 Q 240,213 247,213 L 255,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,112 648,116 648,108" style="fill:rgb(0,0,0)"/>
<path d="M592,112L654,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,112 L 667,112 Q 675,112 675,104 L 675,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,150 648,154 648,145" style="fill:rgb(0,0,0)"/>
<path d="M476,150L654,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,150 L 667,150 Q 675,150 675,142 L 675,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M577,36L690,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,304L411,304A15 15 0 0 0 426 289A15 15 0 0 0 411 274L407,274A15 15 0 0 0 392 289A15 15 0 0 0 407 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="498,289 487,293 487,284" style="fill:rgb(0,0,0)"/>
<path d="M426,289L492,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M513,304L582,304A15 15 0 0 0 597 289A15 15 0 0 0 582 274L513,274A15 15 0 0 0 498 289A15 15 0 0 0 513 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="548" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<polygon points="660,289 648,293 648,284" style="fill:rgb(0,0,0)"/>
<path d="M597,289L654,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,289 L 667,289 Q 675,289 675,281 L 675,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="548,251 559,247 559,255" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 652,213 Q 660,213 660,228 L 660,236 Q 660,251 645,251 L 568,251 L 553,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M548,251 L 370,251 Q 355,251 355,266 L 355,274 Q 355,289 370,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,251 L 464,251 Q 457,251 457,266 L 457,274 Q 457,289 464,289 L 472,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,327 39,331 39,322" style="fill:rgb(0,0,0)"/>
<path d="M24,198 L 24,312 Q 24,327 34,327 L 45,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,342A15 15 0 0 0 81 327A15 15 0 0 0 66 311A15 15 0 0 0 50 327A15 15 0 0 0 66 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,327 92,331 92,322" style="fill:rgb(0,0,0)"/>
<path d="M81,327L98,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,342L208,342L208,311L104,311Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="327" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="231,327 219,331 219,322" style="fill:rgb(0,0,0)"/>
<path d="M208,327L225,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,342A15 15 0 0 0 261 327A15 15 0 0 0 246 311A15 15 0 0 0 231 327A15 15 0 0 0 246 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M261,327 L 269,327 Q 276,327 276,312 L 276,304 Q 276,289 291,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,327 648,331 648,322" style="fill:rgb(0,0,0)"/>
<path d="M261,327L654,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,327 L 667,327 Q 675,327 675,319 L 675,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,327 L 432,327 Q 439,327 439,312 L 439,304 Q 439,289 447,289 L 454,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,364 39,369 39,360" style="fill:rgb(0,0,0)"/>
<path d="M24,311 L 24,349 Q 24,364 34,364 L 45,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,379A15 15 0 0 0 81 364A15 15 0 0 0 65 349A15 15 0 0 0 50 364A15 15 0 0 0 65 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="135,364 123,369 123,360" style="fill:rgb(0,0,0)"/>
<path d="M81,364L129,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,379L296,379L296,349L135,349Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="364" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="350,364 338,369 338,360" style="fill:rgb(0,0,0)"/>
<path d="M296,364L344,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,379A15 15 0 0 0 380 364A15 15 0 0 0 365 349A15 15 0 0 0 350 364A15 15 0 0 0 365 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="660,364 648,369 648,360" style="fill:rgb(0,0,0)"/>
<path d="M380,364L654,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="711,36 699,41 699,32" style="fill:rgb(0,0,0)"/>
<path d="M660,364 L 667,364 Q 675,364 675,349 L 675,51 Q 675,36 690,36 L 690,36 L 705,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="715" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,417A15 15 0 0 0 230 402A15 15 0 0 0 215 387A15 15 0 0 0 200 402A15 15 0 0 0 215 417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="402" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="230,402 242,398 242,406" style="fill:rgb(0,0,0)"/>
<path d="M296,364 L 303,364 Q 311,364 311,379 L 311,387 Q 311,402 296,402 L 251,402 L 236,402"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,402 L 123,402 Q 108,402 108,387 L 108,379 Q 108,364 116,364 L 123,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="122,440 111,444 111,436" style="fill:rgb(0,0,0)"/>
<path d="M81,364 L 88,364 Q 96,364 96,379 L 96,425 Q 96,440 106,440 L 116,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M122,455L224,455L224,425L122,425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M224,440 L 308,440 Q 323,440 323,425 L 323,379 Q 323,364 331,364 L 338,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/window-defn.html">window-defn:</a></b>
<button id='x1b03626e' onclick='hideorshow("x1b03626e","x88475019")'>show</button></p>
 <div id='x88475019' style='display:none;' class='imgcontainer'>
 <div style="max-width:479px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 479.765 380.592">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,44 92,48 92,40" style="fill:rgb(0,0,0)"/>
<path d="M62,17 L 70,17 Q 77,17 77,30 Q 77,44 88,44 L 98,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,59L260,59A15 15 0 0 0 275 44L275,44A15 15 0 0 0 260 29L119,29A15 15 0 0 0 104 44L104,44A15 15 0 0 0 119 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M119,135L198,135A15 15 0 0 0 214 120A15 15 0 0 0 198 104L119,104A15 15 0 0 0 104 120A15 15 0 0 0 119 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="237,120 225,124 225,115" style="fill:rgb(0,0,0)"/>
<path d="M214,120L231,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M252,135L256,135A15 15 0 0 0 271 120A15 15 0 0 0 256 104L252,104A15 15 0 0 0 237 120A15 15 0 0 0 252 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="307,120 295,124 295,115" style="fill:rgb(0,0,0)"/>
<path d="M271,120L301,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,135L356,135L356,104L307,104Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M332,173A15 15 0 0 0 347 157A15 15 0 0 0 332 142A15 15 0 0 0 316 157A15 15 0 0 0 332 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="157" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="347,157 358,153 358,162" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,142 Q 371,157 362,157 L 352,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,157 L 295,157 Q 280,157 280,142 L 280,135 Q 280,120 288,120 L 295,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,17 178,21 178,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L184,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,82 201,77 201,86" style="fill:rgb(0,0,0)"/>
<path d="M190,17 L 298,17 Q 313,17 313,32 L 313,67 Q 313,82 298,82 L 210,82 L 195,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,120 92,124 92,115" style="fill:rgb(0,0,0)"/>
<path d="M190,82 L 77,82 Q 62,82 62,97 L 62,105 Q 62,120 77,120 L 83,120 L 98,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,44 287,48 287,40" style="fill:rgb(0,0,0)"/>
<path d="M275,44L293,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,44 L 306,44 Q 313,44 313,51 L 313,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,248L163,248A15 15 0 0 0 178 233A15 15 0 0 0 163 218L119,218A15 15 0 0 0 104 233A15 15 0 0 0 119 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="201,233 190,237 190,229" style="fill:rgb(0,0,0)"/>
<path d="M178,233L196,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,248L221,248A15 15 0 0 0 236 233A15 15 0 0 0 221 218L217,218A15 15 0 0 0 201 233A15 15 0 0 0 217 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="272,233 260,237 260,229" style="fill:rgb(0,0,0)"/>
<path d="M236,233L266,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,248L402,248L402,218L272,218Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M337,286A15 15 0 0 0 352 271A15 15 0 0 0 337 256A15 15 0 0 0 322 271A15 15 0 0 0 337 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="352,271 363,266 363,275" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,256 Q 417,271 402,271 L 373,271 L 358,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M322,271 L 260,271 Q 245,271 245,256 L 245,248 Q 245,233 253,233 L 260,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,195 201,191 201,200" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,180 Q 371,195 356,195 L 210,195 L 195,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,233 92,237 92,229" style="fill:rgb(0,0,0)"/>
<path d="M190,195 L 77,195 Q 62,195 62,210 L 62,218 Q 62,233 77,233 L 83,233 L 98,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,157 58,146 66,146" style="fill:rgb(0,0,0)"/>
<path d="M62,104L62,152"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,157L62,218"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,362L208,362L208,331L104,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="417,346 405,351 405,342" style="fill:rgb(0,0,0)"/>
<path d="M208,346L411,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,362A15 15 0 0 0 447 346A15 15 0 0 0 432 331A15 15 0 0 0 417 346A15 15 0 0 0 432 362Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="470,346 458,351 458,342" style="fill:rgb(0,0,0)"/>
<path d="M447,346L464,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="474" cy="346" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,309 201,304 201,313" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,294 Q 417,309 402,309 L 210,309 L 195,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,346 92,351 92,342" style="fill:rgb(0,0,0)"/>
<path d="M190,309 L 77,309 Q 62,309 62,324 L 62,331 Q 62,346 77,346 L 83,346 L 98,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,271 58,259 66,259" style="fill:rgb(0,0,0)"/>
<path d="M62,218L62,265"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,271L62,331"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,374 144,378 144,369" style="fill:rgb(0,0,0)"/>
<path d="M62,331 L 62,359 Q 62,374 77,374 L 135,374 L 150,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,346 266,351 266,342" style="fill:rgb(0,0,0)"/>
<path d="M156,374 L 233,374 Q 248,374 248,360 Q 248,346 260,346 L 272,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x4b6bacc9' onclick='hideorshow("x4b6bacc9","xdf0e0eda")'>show</button></p>
 <div id='xdf0e0eda' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/type-name.html">type-name:</a></b>
<button id='x92089634' onclick='hideorshow("x92089634","x6f27405f")'>show</button></p>
 <div id='x6f27405f' style='display:none;' class='imgcontainer'>
 <div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.008 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L87,32A15 15 0 0 0 102 17A15 15 0 0 0 87 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="165,92 153,97 153,88" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,77 Q 138,92 149,92 L 159,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,108A15 15 0 0 0 195 92A15 15 0 0 0 180 77A15 15 0 0 0 165 92A15 15 0 0 0 180 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,92 201,97 201,88" style="fill:rgb(0,0,0)"/>
<path d="M195,92L207,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,108L350,108L350,77L212,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,92 356,97 356,88" style="fill:rgb(0,0,0)"/>
<path d="M350,92L362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,108A15 15 0 0 0 398 92A15 15 0 0 0 382 77A15 15 0 0 0 367 92A15 15 0 0 0 382 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="415,92 403,97 403,88" style="fill:rgb(0,0,0)"/>
<path d="M398,92L409,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,108L553,108L553,77L415,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="570,92 558,97 558,88" style="fill:rgb(0,0,0)"/>
<path d="M553,92L564,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,108A15 15 0 0 0 600 92A15 15 0 0 0 585 77A15 15 0 0 0 570 92A15 15 0 0 0 585 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="585" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="651,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M600,92 L 608,92 Q 615,92 615,77 L 615,32 Q 615,17 630,17 L 630,17 L 645,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,40 Q 138,55 149,55 L 159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70A15 15 0 0 0 195 55L195,55A15 15 0 0 0 180 39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,55 201,59 201,50" style="fill:rgb(0,0,0)"/>
<path d="M195,55L207,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,70L350,70L350,39L212,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,55 356,59 356,50" style="fill:rgb(0,0,0)"/>
<path d="M350,55L362,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,70A15 15 0 0 0 398 55L398,55A15 15 0 0 0 382 39A15 15 0 0 0 367 55L367,55A15 15 0 0 0 382 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="600,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M398,55L594,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M600,55 L 608,55 Q 615,55 615,47 L 615,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="74,47 85,43 85,51" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 110,17 Q 117,17 117,32 L 117,32 Q 117,47 102,47 L 94,47 L 79,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47 L 33,47 Q 18,47 18,32 L 18,32 Q 18,17 26,17 L 33,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="382,17 371,21 371,12" style="fill:rgb(0,0,0)"/>
<path d="M102,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,17L630,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='x1f58e2f2' onclick='hideorshow("x1f58e2f2","xce957859")'>show</button></p>
 <div id='xce957859' style='display:none;' class='imgcontainer'>
 <div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/qualified-table-name.html">qualified-table-name:</a></b>
<button id='x8bd747bc' onclick='hideorshow("x8bd747bc","x535aca54")'>show</button></p>
 <div id='x535aca54' style='display:none;' class='imgcontainer'>
 <div style="max-width:599px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 599.746 182.736">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L156,32A15 15 0 0 0 171 17A15 15 0 0 0 156 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,17 183,21 183,12" style="fill:rgb(0,0,0)"/>
<path d="M171,17L189,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,32A15 15 0 0 0 225 17A15 15 0 0 0 210 2A15 15 0 0 0 195 17A15 15 0 0 0 210 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,17 249,21 249,12" style="fill:rgb(0,0,0)"/>
<path d="M225,17L255,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,32L351,32A15 15 0 0 0 366 17A15 15 0 0 0 351 2L276,2A15 15 0 0 0 261 17A15 15 0 0 0 276 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="408,44 396,48 396,40" style="fill:rgb(0,0,0)"/>
<path d="M366,17 L 374,17 Q 381,17 381,30 Q 381,44 392,44 L 402,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,59L427,59A15 15 0 0 0 442 44L442,44A15 15 0 0 0 427 29L423,29A15 15 0 0 0 408 44L408,44A15 15 0 0 0 423 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="465,44 453,48 453,40" style="fill:rgb(0,0,0)"/>
<path d="M442,44L459,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,59L501,59A15 15 0 0 0 516 44L516,44A15 15 0 0 0 501 29L480,29A15 15 0 0 0 465 44L465,44A15 15 0 0 0 480 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="490" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">alias</text>
<polygon points="539,44 527,48 527,40" style="fill:rgb(0,0,0)"/>
<path d="M516,44L533,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,44 L 546,44 Q 554,44 554,51 L 554,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="453,17 442,21 442,12" style="fill:rgb(0,0,0)"/>
<path d="M366,17L448,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,44 97,48 97,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 39,44 L 87,44 L 102,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M108,44 L 225,44 Q 240,44 240,30 Q 240,17 247,17 L 255,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,142L301,142A15 15 0 0 0 316 127A15 15 0 0 0 301 112L236,112A15 15 0 0 0 221 127A15 15 0 0 0 236 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="339,127 327,131 327,123" style="fill:rgb(0,0,0)"/>
<path d="M316,127L333,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,142L358,142A15 15 0 0 0 373 127A15 15 0 0 0 358 112L354,112A15 15 0 0 0 339 127A15 15 0 0 0 354 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="396,127 385,131 385,123" style="fill:rgb(0,0,0)"/>
<path d="M373,127L390,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M411,142L490,142A15 15 0 0 0 505 127A15 15 0 0 0 490 112L411,112A15 15 0 0 0 396 127A15 15 0 0 0 411 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="451" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M236,180L256,180A15 15 0 0 0 271 165A15 15 0 0 0 256 150L236,150A15 15 0 0 0 221 165A15 15 0 0 0 236 180Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="165" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="294,165 283,169 283,161" style="fill:rgb(0,0,0)"/>
<path d="M271,165L289,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,180L374,180A15 15 0 0 0 389 165A15 15 0 0 0 374 150L310,150A15 15 0 0 0 294 165A15 15 0 0 0 310 180Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="342" y="165" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="554,74 550,62 558,62" style="fill:rgb(0,0,0)"/>
<path d="M453,17 L 539,17 Q 554,17 554,32 L 554,53 L 554,68"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 325,85 325,94" style="fill:rgb(0,0,0)"/>
<path d="M554,74 L 554,82 Q 554,89 539,89 L 334,89 L 319,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="221,127 210,131 210,123" style="fill:rgb(0,0,0)"/>
<path d="M313,89 L 210,89 Q 195,89 195,104 L 195,112 Q 195,127 205,127 L 215,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="221,165 210,169 210,161" style="fill:rgb(0,0,0)"/>
<path d="M195,112 L 195,150 Q 195,165 205,165 L 215,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="554,114 550,102 558,102" style="fill:rgb(0,0,0)"/>
<path d="M554,74L554,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="590,165 578,169 578,161" style="fill:rgb(0,0,0)"/>
<path d="M554,114 L 554,150 Q 554,165 569,165 L 569,165 L 584,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="593" cy="165" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="539,127 527,131 527,123" style="fill:rgb(0,0,0)"/>
<path d="M505,127L533,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,127 L 546,127 Q 554,127 554,135 L 554,142"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M389,165L578,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/returning-clause.html">returning-clause:</a></b>
<button id='x2100722e' onclick='hideorshow("x2100722e","x6fd04d24")'>show</button></p>
 <div id='x6fd04d24' style='display:none;' class='imgcontainer'>
 <div style="max-width:628px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 628.709 140.4">
<circle cx="5" cy="47" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="27,47 15,51 15,43" style="fill:rgb(0,0,0)"/>
<path d="M9,47L21,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M42,62L132,62A15 15 0 0 0 147 47A15 15 0 0 0 132 32L42,32A15 15 0 0 0 27 47A15 15 0 0 0 42 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RETURNING</text>
<polygon points="237,47 226,51 226,43" style="fill:rgb(0,0,0)"/>
<path d="M147,47L232,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M237,62L287,62L287,32L237,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="262" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="328,77 317,82 317,73" style="fill:rgb(0,0,0)"/>
<path d="M287,47 L 294,47 Q 302,47 302,62 L 302,62 Q 302,77 312,77 L 322,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M343,92L347,92A15 15 0 0 0 362 77L362,77A15 15 0 0 0 347 62L343,62A15 15 0 0 0 328 77L328,77A15 15 0 0 0 343 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="398,77 387,82 387,73" style="fill:rgb(0,0,0)"/>
<path d="M362,77L393,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M414,92L501,92A15 15 0 0 0 516 77L516,77A15 15 0 0 0 501 62L414,62A15 15 0 0 0 398 77L398,77A15 15 0 0 0 414 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="457" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="539,77 528,82 528,73" style="fill:rgb(0,0,0)"/>
<path d="M516,77L534,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="581,47 569,51 569,43" style="fill:rgb(0,0,0)"/>
<path d="M539,77 L 547,77 Q 554,77 554,62 L 554,62 Q 554,47 565,47 L 575,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="619,47 607,51 607,43" style="fill:rgb(0,0,0)"/>
<path d="M581,47L613,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="622" cy="47" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="345,101 334,106 334,97" style="fill:rgb(0,0,0)"/>
<path d="M302,62 L 302,86 Q 302,101 317,101 L 325,101 L 340,101"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,101 L 362,101 Q 377,101 377,89 Q 377,77 385,77 L 392,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="453,47 441,51 441,43" style="fill:rgb(0,0,0)"/>
<path d="M287,47L447,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,47L607,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,138A15 15 0 0 0 406 123A15 15 0 0 0 391 108A15 15 0 0 0 376 123A15 15 0 0 0 391 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="391" y="123" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="376,123 365,127 365,118" style="fill:rgb(0,0,0)"/>
<path d="M147,47 L 196,47 Q 211,47 211,62 L 211,108 Q 211,123 226,123 L 355,123 L 370,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="539,123 528,127 528,118" style="fill:rgb(0,0,0)"/>
<path d="M406,123L534,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,123 L 547,123 Q 554,123 554,108 L 554,77 L 554,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,32A15 15 0 0 0 406 17A15 15 0 0 0 391 2A15 15 0 0 0 376 17A15 15 0 0 0 391 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="391" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="406,17 418,12 418,21" style="fill:rgb(0,0,0)"/>
<path d="M581,47 L 588,47 Q 596,47 596,32 L 596,32 Q 596,17 581,17 L 427,17 L 412,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="186,47 174,51 174,43" style="fill:rgb(0,0,0)"/>
<path d="M376,17 L 174,17 Q 159,17 159,32 L 159,32 Q 159,47 169,47 L 180,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>


<p>The DELETE command removes records from the table identified by the
   <a href="syntax/qualified-table-name.html">qualified-table-name</a>.

</p><p>If the WHERE clause is not present, all records in the table are deleted.
   If a WHERE clause is supplied, then only those rows for which the
   WHERE clause <a href="lang_expr.html#booleanexpr">boolean expression</a> is true are deleted.
   Rows for which the expression is false or NULL are retained.

</p><p>

</p><h1 id="restrictions_on_delete_statements_within_create_trigger"><span>2. </span>Restrictions on DELETE Statements Within CREATE TRIGGER</h1>

<p>The following restrictions apply to DELETE statements that occur within the
   body of a <a href="lang_createtrigger.html">CREATE TRIGGER</a> statement:

</p><ul>
  <li><p>The <span class='yyterm'>table-name</span> specified as part of a 
    DELETE statement within
    a trigger body must be unqualified.  In other words, the
    <i>schema-name</i><b>.</b> prefix on the table name is not allowed 
    within triggers. If the table to which the trigger is attached is
    not in the temp database, then DELETE statements within the trigger
    body must operate on tables within the same database as it. If the table
    to which the trigger is attached is in the TEMP database, then the
    unqualified name of the table being deleted is resolved in the same way as
    it is for a top-level statement (by searching first the TEMP database, then
    the main database, then any other databases in the order they were
    attached).
    
  </p></li><li><p>The INDEXED BY and NOT INDEXED clauses are not allowed on DELETE
    statements within triggers.</p>

  </li><li><p>The LIMIT and ORDER BY clauses (described below) are unsupported for
    DELETE statements within triggers.</p>

  </li><li><p>The RETURNING clause is not supported for triggers.
</p></li></ul>

<h1 id="optional_limit_and_order_by_clauses"><span>3. </span>Optional LIMIT and ORDER BY clauses</h1>

<p>If SQLite is compiled with the <a href="compile.html#enable_update_delete_limit">SQLITE_ENABLE_UPDATE_DELETE_LIMIT</a>
compile-time option, then the syntax of the DELETE statement is
extended by the addition of optional ORDER BY and LIMIT clauses:</p>

<p><b><a href="syntax/delete-stmt-limited.html">delete-stmt-limited:</a></b></p><div class='imgcontainer'>
 <div style="max-width:623px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 623.266 541.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L91,32A15 15 0 0 0 106 17A15 15 0 0 0 91 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M166,62L252,62A15 15 0 0 0 267 47A15 15 0 0 0 252 32L166,32A15 15 0 0 0 151 47A15 15 0 0 0 166 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="209,17 197,21 197,12" style="fill:rgb(0,0,0)"/>
<path d="M106,17L203,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M209,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M357,32L583,32L583,2L357,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="151,47 139,51 139,43" style="fill:rgb(0,0,0)"/>
<path d="M106,17 L 113,17 Q 121,17 121,32 L 121,32 Q 121,47 133,47 L 145,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,47 278,51 278,43" style="fill:rgb(0,0,0)"/>
<path d="M267,47L284,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,47 L 297,47 Q 305,47 305,32 L 305,32 Q 305,17 320,17 L 330,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,70A15 15 0 0 0 485 55L485,55A15 15 0 0 0 470 39A15 15 0 0 0 455 55L455,55A15 15 0 0 0 470 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="485,55 497,50 497,59" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,40 Q 598,55 583,55 L 506,55 L 491,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,55 L 349,55 Q 334,55 334,40 L 334,32 Q 334,17 340,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,138L113,138A15 15 0 0 0 128 123A15 15 0 0 0 113 108L60,108A15 15 0 0 0 45 123A15 15 0 0 0 60 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="86" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DELETE</text>
<polygon points="151,123 140,127 140,118" style="fill:rgb(0,0,0)"/>
<path d="M128,123L145,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M166,138L201,138A15 15 0 0 0 216 123A15 15 0 0 0 201 108L166,108A15 15 0 0 0 151 123A15 15 0 0 0 166 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="239,123 228,127 228,118" style="fill:rgb(0,0,0)"/>
<path d="M216,123L233,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M239,138L424,138L424,108L239,108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">qualified-table-name</text>
<polygon points="45,123 33,127 33,118" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,108 Q 24,123 31,123 L 39,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,85 343,81 343,89" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,70 Q 598,85 583,85 L 352,85 L 337,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M332,85 L 39,85 Q 24,85 24,92 L 24,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,213L109,213A15 15 0 0 0 125 198A15 15 0 0 0 109 183L60,183A15 15 0 0 0 45 198A15 15 0 0 0 60 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="148,198 136,203 136,194" style="fill:rgb(0,0,0)"/>
<path d="M125,198L142,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M148,213L197,213L197,183L148,183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="172" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M45,289L196,289L196,259L45,259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="120" y="274" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">returning-clause</text>
<path d="M60,365L105,365A15 15 0 0 0 120 349A15 15 0 0 0 105 334L60,334A15 15 0 0 0 45 349A15 15 0 0 0 60 365Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="82" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="143,349 131,354 131,345" style="fill:rgb(0,0,0)"/>
<path d="M120,349L137,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,365L162,365A15 15 0 0 0 177 349A15 15 0 0 0 162 334L158,334A15 15 0 0 0 143 349A15 15 0 0 0 158 365Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="160" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="213,349 201,354 201,345" style="fill:rgb(0,0,0)"/>
<path d="M177,349L207,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M213,365L343,365L343,334L213,334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M278,402A15 15 0 0 0 293 387A15 15 0 0 0 278 372A15 15 0 0 0 263 387A15 15 0 0 0 278 402Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="387" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M60,470L93,470A15 15 0 0 0 109 455A15 15 0 0 0 93 440L60,440A15 15 0 0 0 45 455A15 15 0 0 0 60 470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="77" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="132,455 120,460 120,451" style="fill:rgb(0,0,0)"/>
<path d="M109,455L126,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,470L181,470L181,440L132,440Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="219,486 207,490 207,481" style="fill:rgb(0,0,0)"/>
<path d="M181,455 L 188,455 Q 196,455 196,470 L 196,471 Q 196,486 204,486 L 213,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M234,501L285,501A15 15 0 0 0 300 486A15 15 0 0 0 285 470L234,470A15 15 0 0 0 219 486A15 15 0 0 0 234 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="323,486 312,490 312,481" style="fill:rgb(0,0,0)"/>
<path d="M300,486L318,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,501L373,501L373,470L323,470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M234,538A15 15 0 0 0 249 523A15 15 0 0 0 234 508A15 15 0 0 0 219 523A15 15 0 0 0 234 538Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="523" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="272,523 261,528 261,519" style="fill:rgb(0,0,0)"/>
<path d="M249,523L266,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,538L321,538L321,508L272,508Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="297" y="523" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="219,523 207,528 207,519" style="fill:rgb(0,0,0)"/>
<path d="M181,455 L 188,455 Q 196,455 196,470 L 196,508 Q 196,523 204,523 L 213,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="613,455 602,460 602,451" style="fill:rgb(0,0,0)"/>
<path d="M181,455L608,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="617" cy="455" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="575,123 564,127 564,118" style="fill:rgb(0,0,0)"/>
<path d="M424,123L570,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M575,123 L 583,123 Q 590,123 590,138 L 590,440 Q 590,455 598,455 L 605,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="239,160 251,156 251,165" style="fill:rgb(0,0,0)"/>
<path d="M424,123 L 431,123 Q 439,123 439,138 L 439,145 Q 439,160 424,160 L 260,160 L 245,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,198 33,203 33,194" style="fill:rgb(0,0,0)"/>
<path d="M239,160 L 39,160 Q 24,160 24,175 L 24,183 Q 24,198 31,198 L 39,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="575,198 564,203 564,194" style="fill:rgb(0,0,0)"/>
<path d="M197,198L570,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M575,198 L 583,198 Q 590,198 590,206 L 590,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,274 33,278 33,270" style="fill:rgb(0,0,0)"/>
<path d="M24,259 L 24,266 Q 24,274 31,274 L 39,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="120,312 132,307 132,316" style="fill:rgb(0,0,0)"/>
<path d="M196,274 L 203,274 Q 211,274 211,289 L 211,297 Q 211,312 196,312 L 141,312 L 126,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M120,312 L 39,312 Q 24,312 24,319 L 24,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="575,274 564,278 564,270" style="fill:rgb(0,0,0)"/>
<path d="M196,274L570,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M575,274 L 583,274 Q 590,274 590,281 L 590,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,349 33,354 33,345" style="fill:rgb(0,0,0)"/>
<path d="M24,183 L 24,334 Q 24,349 31,349 L 39,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="120,236 131,232 131,240" style="fill:rgb(0,0,0)"/>
<path d="M197,198 L 204,198 Q 212,198 212,213 L 212,221 Q 212,236 197,236 L 140,236 L 125,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M120,236 L 39,236 Q 24,236 24,244 L 24,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="293,387 305,383 305,392" style="fill:rgb(0,0,0)"/>
<path d="M343,349 L 350,349 Q 358,349 358,364 L 358,372 Q 358,387 343,387 L 314,387 L 299,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M263,387 L 205,387 Q 190,387 190,372 L 190,364 Q 190,349 197,349 L 205,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,455 33,460 33,451" style="fill:rgb(0,0,0)"/>
<path d="M24,334 L 24,440 Q 24,455 31,455 L 39,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="160,417 171,413 171,422" style="fill:rgb(0,0,0)"/>
<path d="M343,349 L 350,349 Q 358,349 358,364 L 358,402 Q 358,417 343,417 L 181,417 L 166,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M160,417 L 39,417 Q 24,417 24,425 L 24,432"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,455 435,460 435,451" style="fill:rgb(0,0,0)"/>
<path d="M321,523 L 396,523 Q 411,523 411,508 L 411,470 Q 411,455 426,455 L 426,455 L 441,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="396,486 384,490 384,481" style="fill:rgb(0,0,0)"/>
<path d="M373,486L390,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M396,486 L 403,486 Q 411,486 411,478 L 411,471"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
 </div>


<p>If a DELETE statement has a LIMIT clause, the maximum number of rows that
will be deleted is found by evaluating the accompanying expression and casting
it to an integer value. If the result of the evaluating the LIMIT clause
cannot be losslessly converted to an integer value, it is an error. A 
negative LIMIT value is interpreted as "no limit". If the DELETE statement 
also has an OFFSET clause, then it is similarly evaluated and cast to an
integer value. Again, it is an error if the value cannot be losslessly
converted to an integer. If there is no OFFSET clause, or the calculated
integer value is negative, the effective OFFSET value is zero.

</p><p>If the DELETE statement has an ORDER BY clause, then all rows that would 
be deleted in the absence of the LIMIT clause are sorted according to the 
ORDER BY. The first <i>M</i> rows, where <i>M</i> is the value found by
evaluating the OFFSET clause expression, are skipped, and the following 
<i>N</i>, where <i>N</i> is the value of the LIMIT expression, are deleted.
If there are less than <i>N</i> rows remaining after taking the OFFSET clause
into account, or if the LIMIT clause evaluated to a negative value, then all
remaining rows are deleted.

</p><p>If the DELETE statement has no ORDER BY clause, then all rows that
would be deleted in the absence of the LIMIT clause are assembled in an
arbitrary order before applying the LIMIT and OFFSET clauses to determine 
the subset that are actually deleted.

</p><p>The ORDER BY clause on a DELETE statement is used only to determine which
rows fall within the LIMIT. The order in which rows are deleted is arbitrary
and is not influenced by the ORDER BY clause.
This means that if there is a <a href="lang_returning.html">RETURNING clause</a>, the rows returned by
the statement probably will not be in the order specified by the
ORDER BY clause.

<a name="truncateopt"></a>

</p><h1 id="the_truncate_optimization"><span>4. </span>The Truncate Optimization</h1>

<p>When the WHERE clause and RETURNING clause are both  omitted
from a DELETE statement and the table being deleted has no triggers,
SQLite uses an optimization to erase the entire table content
without having to visit each row of the table individually.
This "truncate" optimization makes the delete run much faster.
Prior to SQLite <a href="releaselog/3_6_5.html">version 3.6.5</a> (2008-11-12), the truncate optimization
also meant that the <a href="c3ref/changes.html">sqlite3_changes()</a> and
<a href="c3ref/total_changes.html">sqlite3_total_changes()</a> interfaces
and the <a href="pragma.html#pragma_count_changes">count_changes pragma</a>
will not actually return the number of deleted rows.  
That problem has been fixed as of <a href="releaselog/3_6_5.html">version 3.6.5</a> (2008-11-12).

</p><p>The truncate optimization can be permanently disabled for all queries
by recompiling
SQLite with the <a href="compile.html#omit_truncate_optimization">SQLITE_OMIT_TRUNCATE_OPTIMIZATION</a> compile-time switch.</p>

<p>The truncate optimization can also be disabled at runtime using
the <a href="c3ref/set_authorizer.html">sqlite3_set_authorizer()</a> interface.  If an authorizer callback
returns <a href="c3ref/c_deny.html">SQLITE_IGNORE</a> for an <a href="c3ref/c_alter_table.html">SQLITE_DELETE</a> action code, then
the DELETE operation will proceed but the truncate optimization will
be bypassed and rows will be deleted one by one.</p>
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_delete.in?m=9710a614b3">2022-01-08 05:02:57</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_detach.html.















































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>DETACH</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
DETACH
</div>
</div>




<p><b><a href="syntax/detach-stmt.html">detach-stmt:</a></b>
<button id='x814076d2' onclick='hideorshow("x814076d2","xd4692196")'>hide</button></p>
 <div id='xd4692196' class='imgcontainer'>
 <div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.595 47.952">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L104,32A15 15 0 0 0 119 17A15 15 0 0 0 104 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DETACH</text>
<polygon points="155,17 143,21 143,12" style="fill:rgb(0,0,0)"/>
<path d="M119,17L149,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M170,32L246,32A15 15 0 0 0 261 17A15 15 0 0 0 246 2L170,2A15 15 0 0 0 155 17A15 15 0 0 0 170 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="208" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DATABASE</text>
<polygon points="297,17 286,21 286,12" style="fill:rgb(0,0,0)"/>
<path d="M261,17L291,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M312,32L409,32A15 15 0 0 0 424 17A15 15 0 0 0 409 2L312,2A15 15 0 0 0 297 17A15 15 0 0 0 312 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="447,17 435,21 435,12" style="fill:rgb(0,0,0)"/>
<path d="M424,17L441,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="208,41 196,45 196,37" style="fill:rgb(0,0,0)"/>
<path d="M119,17 L 126,17 Q 134,17 134,29 Q 134,41 149,41 L 187,41 L 202,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M208,41 L 255,41 Q 270,41 270,29 Q 270,17 278,17 L 285,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>


<p>This statement detaches an additional database connection previously 
attached using the <a href="lang_attach.html">ATTACH</a> statement.  
When not in <a href="sharedcache.html">shared cache mode</a>, 
it is possible to have the same database file attached multiple times using 
different names, and detaching one connection to a file will leave the 
others intact.</p>

<p>
In <a href="sharedcache.html">shared cache mode</a>, attempting to attach the same database file more
than once results in an error.
</p><p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_detach.in?m=0a2131785f">2022-01-08 05:02:57</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_dropindex.html.











































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>DROP INDEX</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
DROP INDEX
</div>
</div>




<p><b><a href="syntax/drop-index-stmt.html">drop-index-stmt:</a></b>
<button id='x4a75330c' onclick='hideorshow("x4a75330c","x74f5c19d")'>hide</button></p>
 <div id='x74f5c19d' class='imgcontainer'>
 <div style="max-width:761px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 761.27 54">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="63" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DROP</text>
<polygon points="116,17 105,21 105,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L110,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M131,32L171,32A15 15 0 0 0 186 17A15 15 0 0 0 171 2L131,2A15 15 0 0 0 116 17A15 15 0 0 0 131 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="151" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEX</text>
<polygon points="222,17 210,21 210,12" style="fill:rgb(0,0,0)"/>
<path d="M186,17L216,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M237,32A15 15 0 0 0 252 17A15 15 0 0 0 237 2A15 15 0 0 0 222 17A15 15 0 0 0 237 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="237" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="275,17 263,21 263,12" style="fill:rgb(0,0,0)"/>
<path d="M252,17L269,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,32L335,32A15 15 0 0 0 350 17A15 15 0 0 0 335 2L290,2A15 15 0 0 0 275 17A15 15 0 0 0 290 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="404,17 392,21 392,12" style="fill:rgb(0,0,0)"/>
<path d="M350,17L398,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,32L515,32A15 15 0 0 0 530 17A15 15 0 0 0 515 2L419,2A15 15 0 0 0 404 17A15 15 0 0 0 419 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="467" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="553,17 542,21 542,12" style="fill:rgb(0,0,0)"/>
<path d="M530,17L548,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M569,32A15 15 0 0 0 584 17A15 15 0 0 0 569 2A15 15 0 0 0 553 17A15 15 0 0 0 569 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="569" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="620,17 608,21 608,12" style="fill:rgb(0,0,0)"/>
<path d="M584,17L614,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M635,32L713,32A15 15 0 0 0 728 17A15 15 0 0 0 713 2L635,2A15 15 0 0 0 620 17A15 15 0 0 0 635 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<polygon points="751,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M728,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="755" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,47 263,51 263,43" style="fill:rgb(0,0,0)"/>
<path d="M186,17 L 193,17 Q 201,17 201,32 L 201,32 Q 201,47 216,47 L 254,47 L 269,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M275,47 L 350,47 Q 365,47 365,32 L 365,32 Q 365,17 372,17 L 380,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="467,47 456,51 456,43" style="fill:rgb(0,0,0)"/>
<path d="M372,17 L 379,17 Q 387,17 387,32 L 387,32 Q 387,47 402,47 L 446,47 L 461,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,47 L 584,47 Q 599,47 599,32 L 599,32 Q 599,17 606,17 L 614,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>


<p>The DROP INDEX statement removes an index added
with the <a href="lang_createindex.html">CREATE INDEX</a> statement.  The index is completely removed from
the disk.  The only way to recover the index is to reenter the
appropriate <a href="lang_createindex.html">CREATE INDEX</a> command.</p>

<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_dropindex.in?m=fbaca78c23">2022-01-08 05:02:57</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_droptable.html.

















































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>DROP TABLE</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
DROP TABLE
</div>
</div>




<p><b><a href="syntax/drop-table-stmt.html">drop-table-stmt:</a></b>
<button id='xa474c09d' onclick='hideorshow("xa474c09d","xbbb7e16d")'>hide</button></p>
 <div id='xbbb7e16d' class='imgcontainer'>
 <div style="max-width:758px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 758.16 54">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="63" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DROP</text>
<polygon points="116,17 105,21 105,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L110,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M131,32L171,32A15 15 0 0 0 186 17A15 15 0 0 0 171 2L131,2A15 15 0 0 0 116 17A15 15 0 0 0 131 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="151" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TABLE</text>
<polygon points="222,17 210,21 210,12" style="fill:rgb(0,0,0)"/>
<path d="M186,17L216,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M237,32A15 15 0 0 0 252 17A15 15 0 0 0 237 2A15 15 0 0 0 222 17A15 15 0 0 0 237 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="237" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="275,17 264,21 264,12" style="fill:rgb(0,0,0)"/>
<path d="M252,17L269,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,32L335,32A15 15 0 0 0 350 17A15 15 0 0 0 335 2L290,2A15 15 0 0 0 275 17A15 15 0 0 0 290 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="404,17 392,21 392,12" style="fill:rgb(0,0,0)"/>
<path d="M350,17L398,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,32L515,32A15 15 0 0 0 531 17A15 15 0 0 0 515 2L419,2A15 15 0 0 0 404 17A15 15 0 0 0 419 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="467" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="554,17 542,21 542,12" style="fill:rgb(0,0,0)"/>
<path d="M531,17L548,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M569,32A15 15 0 0 0 584 17A15 15 0 0 0 569 2A15 15 0 0 0 554 17A15 15 0 0 0 569 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="569" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="620,17 608,21 608,12" style="fill:rgb(0,0,0)"/>
<path d="M584,17L614,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M635,32L710,32A15 15 0 0 0 725 17A15 15 0 0 0 710 2L635,2A15 15 0 0 0 620 17A15 15 0 0 0 635 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="673" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="748,17 737,21 737,12" style="fill:rgb(0,0,0)"/>
<path d="M725,17L743,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="752" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,47 264,51 264,43" style="fill:rgb(0,0,0)"/>
<path d="M186,17 L 193,17 Q 201,17 201,32 L 201,32 Q 201,47 216,47 L 254,47 L 269,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M275,47 L 350,47 Q 365,47 365,32 L 365,32 Q 365,17 372,17 L 380,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="467,47 456,51 456,43" style="fill:rgb(0,0,0)"/>
<path d="M372,17 L 379,17 Q 387,17 387,32 L 387,32 Q 387,47 402,47 L 447,47 L 462,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,47 L 584,47 Q 599,47 599,32 L 599,32 Q 599,17 606,17 L 614,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>


<p>The DROP TABLE statement removes a table added with the
<a href="lang_createtable.html">CREATE TABLE</a> statement.  The name specified is the
table name.  The dropped table is completely removed from the database 
schema and the disk file.  The table can not be recovered.  
All indices and triggers
associated with the table are also deleted.</p>

<p>The optional IF EXISTS clause suppresses the error that would normally
result if the table does not exist.</p>

<p>If <a href="foreignkeys.html">foreign key constraints</a> are enabled, a DROP TABLE command performs an
implicit <a href="lang_delete.html">DELETE FROM</a> command before removing the
table from the database schema. Any triggers attached to the table are
dropped from the database schema before the implicit DELETE FROM
is executed, so this cannot cause any triggers to fire. By contrast, an
implicit DELETE FROM does cause any configured
<a href="foreignkeys.html#fk_actions">foreign key actions</a> to take place. 
If the implicit DELETE FROM executed
as part of a DROP TABLE command violates any immediate foreign key constraints,
an error is returned and the table is not dropped. If 
the implicit DELETE FROM causes any 
deferred foreign key constraints to be violated, and the violations still
exist when the transaction is committed, an error is returned at the time
of commit.
</p><p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_droptable.in?m=0350dfc779">2022-01-08 05:02:57</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_droptrigger.html.

































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>DROP TRIGGER</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>



<p><b><a href="syntax/drop-trigger-stmt.html">drop-trigger-stmt:</a></b>
<button id='x6447f782' onclick='hideorshow("x6447f782","x6658d618")'>hide</button></p>
 <div id='x6658d618' class='imgcontainer'>
 <div style="max-width:795px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 795.37 54">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="63" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DROP</text>
<polygon points="116,17 105,21 105,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L110,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M131,32L191,32A15 15 0 0 0 207 17A15 15 0 0 0 191 2L131,2A15 15 0 0 0 116 17A15 15 0 0 0 131 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="161" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRIGGER</text>
<polygon points="243,17 231,21 231,12" style="fill:rgb(0,0,0)"/>
<path d="M207,17L237,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,32A15 15 0 0 0 273 17A15 15 0 0 0 258 2A15 15 0 0 0 243 17A15 15 0 0 0 258 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="296,17 284,21 284,12" style="fill:rgb(0,0,0)"/>
<path d="M273,17L290,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,32L356,32A15 15 0 0 0 371 17A15 15 0 0 0 356 2L311,2A15 15 0 0 0 296 17A15 15 0 0 0 311 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="425,17 413,21 413,12" style="fill:rgb(0,0,0)"/>
<path d="M371,17L419,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M440,32L536,32A15 15 0 0 0 551 17A15 15 0 0 0 536 2L440,2A15 15 0 0 0 425 17A15 15 0 0 0 440 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="574,17 563,21 563,12" style="fill:rgb(0,0,0)"/>
<path d="M551,17L569,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M589,32A15 15 0 0 0 605 17A15 15 0 0 0 589 2A15 15 0 0 0 574 17A15 15 0 0 0 589 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="589" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="641,17 629,21 629,12" style="fill:rgb(0,0,0)"/>
<path d="M605,17L635,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M656,32L747,32A15 15 0 0 0 762 17A15 15 0 0 0 747 2L656,2A15 15 0 0 0 641 17A15 15 0 0 0 656 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="702" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">trigger-name</text>
<polygon points="786,17 774,21 774,12" style="fill:rgb(0,0,0)"/>
<path d="M762,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="789" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="296,47 284,51 284,43" style="fill:rgb(0,0,0)"/>
<path d="M207,17 L 214,17 Q 222,17 222,32 L 222,32 Q 222,47 237,47 L 275,47 L 290,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M296,47 L 371,47 Q 386,47 386,32 L 386,32 Q 386,17 393,17 L 401,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="488,47 476,51 476,43" style="fill:rgb(0,0,0)"/>
<path d="M392,17 L 400,17 Q 407,17 407,32 L 407,32 Q 407,47 422,47 L 467,47 L 482,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,47 L 605,47 Q 620,47 620,32 L 620,32 Q 620,17 627,17 L 635,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>


<p>The DROP TRIGGER statement removes a trigger created by the 
<a href="lang_createtrigger.html">CREATE TRIGGER</a> statement. Once removed, the trigger definition is no
longer present in the <a href="schematab.html">sqlite_schema</a> (or sqlite_temp_schema) table and is
not fired by any subsequent INSERT, UPDATE or DELETE statements.

<p>Note that triggers are automatically dropped when the associated table is
dropped.
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_droptrigger.in?m=975cc05797">2022-01-08 05:02:57</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_dropview.html.































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>DROP VIEW</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
DROP VIEW
</div>
</div>




<p><b><a href="syntax/drop-view-stmt.html">drop-view-stmt:</a></b>
<button id='xd0afa372' onclick='hideorshow("xd0afa372","x5a4cabde")'>hide</button></p>
 <div id='x5a4cabde' class='imgcontainer'>
 <div style="max-width:743px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 743.76 54">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="63" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DROP</text>
<polygon points="116,17 105,21 105,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L110,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M131,32L160,32A15 15 0 0 0 176 17A15 15 0 0 0 160 2L131,2A15 15 0 0 0 116 17A15 15 0 0 0 131 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VIEW</text>
<polygon points="212,17 200,21 200,12" style="fill:rgb(0,0,0)"/>
<path d="M176,17L206,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M227,32A15 15 0 0 0 242 17A15 15 0 0 0 227 2A15 15 0 0 0 212 17A15 15 0 0 0 227 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="227" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="265,17 253,21 253,12" style="fill:rgb(0,0,0)"/>
<path d="M242,17L259,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M280,32L325,32A15 15 0 0 0 340 17A15 15 0 0 0 325 2L280,2A15 15 0 0 0 265 17A15 15 0 0 0 280 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="394,17 382,21 382,12" style="fill:rgb(0,0,0)"/>
<path d="M340,17L388,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,32L505,32A15 15 0 0 0 520 17A15 15 0 0 0 505 2L409,2A15 15 0 0 0 394 17A15 15 0 0 0 409 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="457" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="543,17 532,21 532,12" style="fill:rgb(0,0,0)"/>
<path d="M520,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,32A15 15 0 0 0 574 17A15 15 0 0 0 558 2A15 15 0 0 0 543 17A15 15 0 0 0 558 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="558" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="610,17 598,21 598,12" style="fill:rgb(0,0,0)"/>
<path d="M574,17L604,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M625,32L696,32A15 15 0 0 0 711 17A15 15 0 0 0 696 2L625,2A15 15 0 0 0 610 17A15 15 0 0 0 625 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="660" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">view-name</text>
<polygon points="734,17 722,21 722,12" style="fill:rgb(0,0,0)"/>
<path d="M711,17L728,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="738" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="265,47 253,51 253,43" style="fill:rgb(0,0,0)"/>
<path d="M176,17 L 183,17 Q 191,17 191,32 L 191,32 Q 191,47 206,47 L 244,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,47 L 340,47 Q 355,47 355,32 L 355,32 Q 355,17 362,17 L 370,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="457,47 445,51 445,43" style="fill:rgb(0,0,0)"/>
<path d="M361,17 L 369,17 Q 376,17 376,32 L 376,32 Q 376,47 391,47 L 436,47 L 451,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M457,47 L 574,47 Q 589,47 589,32 L 589,32 Q 589,17 596,17 L 604,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>


<p>The DROP VIEW statement removes a view created by the <a href="lang_createview.html">CREATE VIEW</a> 
  statement. The view definition is removed from the database schema, but 
  no actual data in the underlying base tables is modified.

</p><p>The view to drop is identified by the view-name and optional 
  schema-name specified as part of the DROP VIEW statement. This 
  reference is resolved using the standard procedure for <a href="lang_naming.html">object resolution</a>.

</p><p>
  If the specified view cannot be found and the IF EXISTS clause is not 
  present, it is an error. If the specified view cannot be found and an IF
  EXISTS clause is present in the DROP VIEW statement, then the statement
  is a no-op.


</p><p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_dropview.in?m=2b6e06f992">2022-01-08 05:02:57</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_explain.html.





























































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>EXPLAIN</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
EXPLAIN
</div>
</div>




<h1 id="syntax"><span>1. </span>Syntax</h1>
<p><b><a href="syntax/sql-stmt.html">sql-stmt:</a></b></p><div class='imgcontainer'>
 <div style="max-width:716px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 716.88 1017.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L125,70A15 15 0 0 0 140 55L140,55A15 15 0 0 0 125 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="95" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXPLAIN</text>
<polygon points="176,55 165,59 165,50" style="fill:rgb(0,0,0)"/>
<path d="M140,55L170,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M191,70L235,70A15 15 0 0 0 250 55L250,55A15 15 0 0 0 235 39L191,39A15 15 0 0 0 176 55L176,55A15 15 0 0 0 191 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="213" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">QUERY</text>
<polygon points="267,55 255,59 255,50" style="fill:rgb(0,0,0)"/>
<path d="M250,55L261,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M282,70L311,70A15 15 0 0 0 327 55L327,55A15 15 0 0 0 311 39L282,39A15 15 0 0 0 267 55L267,55A15 15 0 0 0 282 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="297" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PLAN</text>
<polygon points="368,17 357,21 357,12" style="fill:rgb(0,0,0)"/>
<path d="M327,55 L 334,55 Q 342,55 342,40 L 342,32 Q 342,17 352,17 L 362,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="182,17 170,21 170,12" style="fill:rgb(0,0,0)"/>
<path d="M140,55 L 148,55 Q 155,55 155,40 L 155,32 Q 155,17 166,17 L 176,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M182,17L357,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M9,17L170,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="410,17 398,21 398,12" style="fill:rgb(0,0,0)"/>
<path d="M368,17L404,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,32L552,32L552,2L410,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">alter-table-stmt</text>
<polygon points="666,17 654,21 654,12" style="fill:rgb(0,0,0)"/>
<path d="M552,17L660,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="707,17 696,21 696,12" style="fill:rgb(0,0,0)"/>
<path d="M666,17L701,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="711" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,70L528,70L528,39L410,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">analyze-stmt</text>
<polygon points="410,55 398,59 398,50" style="fill:rgb(0,0,0)"/>
<path d="M383,39 L 383,47 Q 383,55 393,55 L 404,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,55 654,59 654,50" style="fill:rgb(0,0,0)"/>
<path d="M528,55L660,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,55 L 673,55 Q 681,55 681,47 L 681,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,108L517,108L517,77L410,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="463" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">attach-stmt</text>
<polygon points="410,92 398,97 398,88" style="fill:rgb(0,0,0)"/>
<path d="M383,77 L 383,85 Q 383,92 393,92 L 404,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,92 654,97 654,88" style="fill:rgb(0,0,0)"/>
<path d="M517,92L660,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,92 L 673,92 Q 681,92 681,85 L 681,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,145L511,145L511,115L410,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="460" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">begin-stmt</text>
<polygon points="410,130 398,135 398,126" style="fill:rgb(0,0,0)"/>
<path d="M383,115 L 383,123 Q 383,130 393,130 L 404,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,130 654,135 654,126" style="fill:rgb(0,0,0)"/>
<path d="M511,130L660,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,130 L 673,130 Q 681,130 681,123 L 681,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,183L527,183L527,153L410,153Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="468" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">commit-stmt</text>
<polygon points="410,168 398,172 398,164" style="fill:rgb(0,0,0)"/>
<path d="M383,153 L 383,160 Q 383,168 393,168 L 404,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,168 654,172 654,164" style="fill:rgb(0,0,0)"/>
<path d="M527,168L660,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,168 L 673,168 Q 681,168 681,160 L 681,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,221L569,221L569,191L410,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="489" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-index-stmt</text>
<polygon points="410,206 398,210 398,201" style="fill:rgb(0,0,0)"/>
<path d="M383,191 L 383,198 Q 383,206 393,206 L 404,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,206 654,210 654,201" style="fill:rgb(0,0,0)"/>
<path d="M569,206L660,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,206 L 673,206 Q 681,206 681,198 L 681,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,259L566,259L566,228L410,228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-table-stmt</text>
<polygon points="410,244 398,248 398,239" style="fill:rgb(0,0,0)"/>
<path d="M383,228 L 383,236 Q 383,244 393,244 L 404,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,244 654,248 654,239" style="fill:rgb(0,0,0)"/>
<path d="M566,244L660,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,244 L 673,244 Q 681,244 681,236 L 681,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,297L582,297L582,266L410,266Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="496" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-trigger-stmt</text>
<polygon points="410,281 398,286 398,277" style="fill:rgb(0,0,0)"/>
<path d="M383,266 L 383,274 Q 383,281 393,281 L 404,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,281 654,286 654,277" style="fill:rgb(0,0,0)"/>
<path d="M582,281L660,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,281 L 673,281 Q 681,281 681,274 L 681,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,334L561,334L561,304L410,304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="486" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-view-stmt</text>
<polygon points="410,319 398,324 398,315" style="fill:rgb(0,0,0)"/>
<path d="M383,304 L 383,312 Q 383,319 393,319 L 404,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,319 654,324 654,315" style="fill:rgb(0,0,0)"/>
<path d="M561,319L660,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,319 L 673,319 Q 681,319 681,312 L 681,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,372L626,372L626,342L410,342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-virtual-table-stmt</text>
<polygon points="410,357 398,361 398,353" style="fill:rgb(0,0,0)"/>
<path d="M383,342 L 383,349 Q 383,357 393,357 L 404,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,357 654,361 654,353" style="fill:rgb(0,0,0)"/>
<path d="M626,357L660,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,357 L 673,357 Q 681,357 681,349 L 681,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,410L516,410L516,380L410,380Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="463" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">delete-stmt</text>
<polygon points="410,395 398,399 398,390" style="fill:rgb(0,0,0)"/>
<path d="M383,380 L 383,387 Q 383,395 393,395 L 404,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,395 654,399 654,390" style="fill:rgb(0,0,0)"/>
<path d="M516,395L660,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,395 L 673,395 Q 681,395 681,387 L 681,380"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,448L581,448L581,417L410,417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">delete-stmt-limited</text>
<polygon points="410,433 398,437 398,428" style="fill:rgb(0,0,0)"/>
<path d="M383,417 L 383,425 Q 383,433 393,433 L 404,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,433 654,437 654,428" style="fill:rgb(0,0,0)"/>
<path d="M581,433L660,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,433 L 673,433 Q 681,433 681,425 L 681,418"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,486L521,486L521,455L410,455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="465" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">detach-stmt</text>
<polygon points="410,470 398,475 398,466" style="fill:rgb(0,0,0)"/>
<path d="M383,455 L 383,463 Q 383,470 393,470 L 404,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,470 654,475 654,466" style="fill:rgb(0,0,0)"/>
<path d="M521,470L660,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,470 L 673,470 Q 681,470 681,463 L 681,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,523L555,523L555,493L410,493Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="508" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-index-stmt</text>
<polygon points="410,508 398,513 398,504" style="fill:rgb(0,0,0)"/>
<path d="M383,493 L 383,501 Q 383,508 393,508 L 404,508"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,508 654,513 654,504" style="fill:rgb(0,0,0)"/>
<path d="M555,508L660,508"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,508 L 673,508 Q 681,508 681,501 L 681,493"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,561L551,561L551,531L410,531Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="480" y="546" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-table-stmt</text>
<polygon points="410,546 398,550 398,542" style="fill:rgb(0,0,0)"/>
<path d="M383,531 L 383,538 Q 383,546 393,546 L 404,546"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,546 654,550 654,542" style="fill:rgb(0,0,0)"/>
<path d="M551,546L660,546"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,546 L 673,546 Q 681,546 681,538 L 681,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,599L568,599L568,569L410,569Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="489" y="584" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-trigger-stmt</text>
<polygon points="410,584 398,588 398,579" style="fill:rgb(0,0,0)"/>
<path d="M383,569 L 383,576 Q 383,584 393,584 L 404,584"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,584 654,588 654,579" style="fill:rgb(0,0,0)"/>
<path d="M568,584L660,584"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,584 L 673,584 Q 681,584 681,576 L 681,569"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,637L547,637L547,606L410,606Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="622" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-view-stmt</text>
<polygon points="410,622 398,626 398,617" style="fill:rgb(0,0,0)"/>
<path d="M383,606 L 383,614 Q 383,622 393,622 L 404,622"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,622 654,626 654,617" style="fill:rgb(0,0,0)"/>
<path d="M547,622L660,622"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,622 L 673,622 Q 681,622 681,614 L 681,607"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,675L513,675L513,644L410,644Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="659" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">insert-stmt</text>
<polygon points="410,659 398,664 398,655" style="fill:rgb(0,0,0)"/>
<path d="M383,644 L 383,652 Q 383,659 393,659 L 404,659"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,659 654,664 654,655" style="fill:rgb(0,0,0)"/>
<path d="M513,659L660,659"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,659 L 673,659 Q 681,659 681,652 L 681,644"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,712L529,712L529,682L410,682Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="697" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">pragma-stmt</text>
<polygon points="410,697 398,702 398,693" style="fill:rgb(0,0,0)"/>
<path d="M383,682 L 383,690 Q 383,697 393,697 L 404,697"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,697 654,702 654,693" style="fill:rgb(0,0,0)"/>
<path d="M529,697L660,697"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,697 L 673,697 Q 681,697 681,690 L 681,682"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,750L528,750L528,720L410,720Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="735" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">reindex-stmt</text>
<polygon points="410,735 398,739 398,731" style="fill:rgb(0,0,0)"/>
<path d="M383,720 L 383,727 Q 383,735 393,735 L 404,735"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,735 654,739 654,731" style="fill:rgb(0,0,0)"/>
<path d="M528,735L660,735"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,735 L 673,735 Q 681,735 681,727 L 681,720"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,788L526,788L526,758L410,758Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="468" y="773" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">release-stmt</text>
<polygon points="410,773 398,777 398,768" style="fill:rgb(0,0,0)"/>
<path d="M383,758 L 383,765 Q 383,773 393,773 L 404,773"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,773 654,777 654,768" style="fill:rgb(0,0,0)"/>
<path d="M526,773L660,773"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,773 L 673,773 Q 681,773 681,765 L 681,758"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,826L533,826L533,795L410,795Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="811" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">rollback-stmt</text>
<polygon points="410,811 398,815 398,806" style="fill:rgb(0,0,0)"/>
<path d="M383,795 L 383,803 Q 383,811 393,811 L 404,811"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,811 654,815 654,806" style="fill:rgb(0,0,0)"/>
<path d="M533,811L660,811"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,811 L 673,811 Q 681,811 681,803 L 681,796"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,864L545,864L545,833L410,833Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="848" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">savepoint-stmt</text>
<polygon points="410,848 398,853 398,844" style="fill:rgb(0,0,0)"/>
<path d="M383,833 L 383,841 Q 383,848 393,848 L 404,848"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,848 654,853 654,844" style="fill:rgb(0,0,0)"/>
<path d="M545,848L660,848"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,848 L 673,848 Q 681,848 681,841 L 681,833"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,901L514,901L514,871L410,871Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="462" y="886" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="410,886 398,891 398,882" style="fill:rgb(0,0,0)"/>
<path d="M383,871 L 383,879 Q 383,886 393,886 L 404,886"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,886 654,891 654,882" style="fill:rgb(0,0,0)"/>
<path d="M514,886L660,886"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,886 L 673,886 Q 681,886 681,879 L 681,871"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,939L522,939L522,909L410,909Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="466" y="924" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">update-stmt</text>
<polygon points="410,924 398,928 398,920" style="fill:rgb(0,0,0)"/>
<path d="M383,909 L 383,916 Q 383,924 393,924 L 404,924"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,924 654,928 654,920" style="fill:rgb(0,0,0)"/>
<path d="M522,924L660,924"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,924 L 673,924 Q 681,924 681,916 L 681,909"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,977L587,977L587,947L410,947Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="498" y="962" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">update-stmt-limited</text>
<polygon points="410,962 398,966 398,957" style="fill:rgb(0,0,0)"/>
<path d="M383,947 L 383,954 Q 383,962 393,962 L 404,962"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,962 654,966 654,957" style="fill:rgb(0,0,0)"/>
<path d="M587,962L660,962"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,962 L 673,962 Q 681,962 681,954 L 681,947"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,1015L529,1015L529,984L410,984Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="1000" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">vacuum-stmt</text>
<polygon points="410,1000 398,1004 398,995" style="fill:rgb(0,0,0)"/>
<path d="M368,17 L 376,17 Q 383,17 383,32 L 383,985 Q 383,1000 393,1000 L 404,1000"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,1000 654,1004 654,995" style="fill:rgb(0,0,0)"/>
<path d="M529,1000L660,1000"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,1000 L 673,1000 Q 681,1000 681,985 L 681,32 Q 681,17 688,17 L 696,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
 </div>


<h1 id="description"><span>2. </span>Description</h1>

<p>An SQL statement can be preceded by the keyword "EXPLAIN" or
by the phrase "EXPLAIN QUERY PLAN".  Either modification causes the
SQL statement to behave as a query and to return information about
how the SQL statement would have operated if the EXPLAIN keyword or
phrase had been omitted.</p>

<p>The output from EXPLAIN and EXPLAIN QUERY PLAN is intended for
interactive analysis and troubleshooting only.  The details of the 
output format are subject to change from one release of SQLite to the next.
Applications should not use EXPLAIN or EXPLAIN QUERY PLAN since
their exact behavior is variable and only partially documented.</p>

<p>When the EXPLAIN keyword appears by itself it causes the statement
to behave as a query that returns the sequence of 
<a href="opcode.html">virtual machine instructions</a> it would have used to execute the command had
the EXPLAIN keyword not been present. When the EXPLAIN QUERY PLAN phrase
appears, the statement returns high-level information regarding the query
plan that would have been used.

</p><p>The EXPLAIN QUERY PLAN command is described in 
<a href="eqp.html">more detail here</a>.

</p><h2 id="explain_operates_at_run_time_not_at_prepare_time"><span>2.1. </span>EXPLAIN operates at run-time, not at prepare-time</h2>

<p>The EXPLAIN and EXPLAIN QUERY PLAN prefixes affect the behavior of
running a <a href="c3ref/stmt.html">prepared statement</a> using <a href="c3ref/step.html">sqlite3_step()</a>.  The process of
generating a new prepared statement using <a href="c3ref/prepare.html">sqlite3_prepare()</a> or similar
is (mostly) unaffected by EXPLAIN.  (The exception to the previous sentence
is that some special opcodes used by EXPLAIN QUERY PLAN are omitted when
building an EXPLAIN QUERY PLAN prepared statement, as a performance
optimization.)

</p><p>This means that actions that occur during sqlite3_prepare() are
unaffected by EXPLAIN.

</p><ul>
<li><p>
Some <a href="pragma.html#syntax">PRAGMA</a> statements do their work during sqlite3_prepare() rather
than during sqlite3_step().  Those PRAGMA statements are unaffected
by EXPLAIN.  They operate the same with or without the EXPLAIN prefix.
The set of PRAGMA statements that are unaffected by EXPLAIN can vary
from one release to the next.  Some PRAGMA statements operate during
sqlite3_prepare() depending on their arguments.  For consistent
results, avoid using EXPLAIN on PRAGMA statements.

</p></li><li><p>
The <a href="c3ref/set_authorizer.html">authorizer callback</a> is invoked regardless of the presence of
EXPLAIN or EXPLAIN QUERY PLAN.
</p></li></ul>
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_explain.in?m=7122ecf5f6">2022-01-08 05:02:57</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_expr.html.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>SQL Language Expressions</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
SQL Language Expressions
</div>
<div class="fancy_toc">
<a onclick="toggle_toc()">
<span class="fancy_toc_mark" id="toc_mk">&#x25ba;</span>
Table Of Contents
</a>
<div id="toc_sub"><div class="fancy-toc1"><a href="#syntax">1. Syntax</a></div>
<div class="fancy-toc1"><a href="#operators_and_parse_affecting_attributes">2. Operators, and Parse-Affecting Attributes</a></div>
<div class="fancy-toc1"><a href="#literal_values_constants_">3. Literal Values (Constants)</a></div>
<div class="fancy-toc1"><a href="#parameters">4. Parameters</a></div>
<div class="fancy-toc1"><a href="#the_like_glob_regexp_match_and_extract_operators">5. The LIKE, GLOB, REGEXP, MATCH, and extract operators</a></div>
<div class="fancy-toc1"><a href="#the_between_operator">6. The BETWEEN operator</a></div>
<div class="fancy-toc1"><a href="#the_case_expression">7. The CASE expression</a></div>
<div class="fancy-toc1"><a href="#the_in_and_not_in_operators">8. The IN and NOT IN operators</a></div>
<div class="fancy-toc1"><a href="#table_column_names">9. Table Column Names</a></div>
<div class="fancy-toc1"><a href="#the_exists_operator">10. The EXISTS operator</a></div>
<div class="fancy-toc1"><a href="#subquery_expressions">11. Subquery Expressions</a></div>
<div class="fancy-toc1"><a href="#correlated_subqueries">12. Correlated Subqueries</a></div>
<div class="fancy-toc1"><a href="#cast_expressions">13. CAST expressions</a></div>
<div class="fancy-toc1"><a href="#boolean_expressions">14. Boolean Expressions</a></div>
<div class="fancy-toc1"><a href="#functions">15. Functions</a></div>
</div>
</div>
<script>
function toggle_toc(){
var sub = document.getElementById("toc_sub")
var mk = document.getElementById("toc_mk")
if( sub.style.display!="block" ){
sub.style.display = "block";
mk.innerHTML = "&#x25bc;";
} else {
sub.style.display = "none";
mk.innerHTML = "&#x25ba;";
}
}
</script>
</div>




<h1 id="syntax"><span>1. </span>Syntax</h1>

<p><b><a href="syntax/expr.html">expr:</a></b>
<button id='x0840e91f' onclick='hideorshow("x0840e91f","x93e29188")'>hide</button></p>
 <div id='x93e29188' class='imgcontainer'>
 <div style="max-width:963px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 963.96 1068.77">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L158,32L158,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="101" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="954,17 943,21 943,12" style="fill:rgb(0,0,0)"/>
<path d="M158,17L948,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="958" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L172,70A15 15 0 0 0 187 55L187,55A15 15 0 0 0 172 39L60,39A15 15 0 0 0 45 55L45,55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">bind-parameter</text>
<polygon points="916,55 905,59 905,50" style="fill:rgb(0,0,0)"/>
<path d="M187,55L910,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,55 L 924,55 Q 931,55 931,47 L 931,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 31,55 L 39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,130L156,130A15 15 0 0 0 171 115A15 15 0 0 0 156 100L60,100A15 15 0 0 0 45 115A15 15 0 0 0 60 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,115 183,119 183,111" style="fill:rgb(0,0,0)"/>
<path d="M171,115L189,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,130A15 15 0 0 0 225 115A15 15 0 0 0 210 100A15 15 0 0 0 195 115A15 15 0 0 0 210 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M225,115L255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130L351,130A15 15 0 0 0 366 115A15 15 0 0 0 351 100L276,100A15 15 0 0 0 261 115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="389,115 378,119 378,111" style="fill:rgb(0,0,0)"/>
<path d="M366,115L383,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,130A15 15 0 0 0 419 115A15 15 0 0 0 404 100A15 15 0 0 0 389 115A15 15 0 0 0 404 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="404" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="455,115 444,119 444,111" style="fill:rgb(0,0,0)"/>
<path d="M419,115L450,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,130L565,130A15 15 0 0 0 580 115A15 15 0 0 0 565 100L471,100A15 15 0 0 0 455 115A15 15 0 0 0 471 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="916,115 905,119 905,111" style="fill:rgb(0,0,0)"/>
<path d="M580,115L910,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,115 L 924,115 Q 931,115 931,108 L 931,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,115 33,119 33,111" style="fill:rgb(0,0,0)"/>
<path d="M24,100 L 24,108 Q 24,115 31,115 L 39,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,89 97,93 97,84" style="fill:rgb(0,0,0)"/>
<path d="M24,74 L 24,81 Q 24,89 39,89 L 87,89 L 102,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 302,93 302,84" style="fill:rgb(0,0,0)"/>
<path d="M108,89 L 129,89 Q 144,89 159,89 L 293,89 L 308,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,89 L 414,89 Q 429,89 429,102 Q 429,115 436,115 L 444,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M223,89 L 230,89 Q 238,89 238,102 Q 238,115 245,115 L 253,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,168L168,168A15 15 0 0 0 183 153A15 15 0 0 0 168 138L60,138A15 15 0 0 0 45 153A15 15 0 0 0 60 168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">unary-operator</text>
<polygon points="206,153 194,157 194,149" style="fill:rgb(0,0,0)"/>
<path d="M183,153L200,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,168L255,168L255,138L206,138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,153 905,157 905,149" style="fill:rgb(0,0,0)"/>
<path d="M255,153L910,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,153 L 924,153 Q 931,153 931,145 L 931,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,153 33,157 33,149" style="fill:rgb(0,0,0)"/>
<path d="M24,138 L 24,145 Q 24,153 31,153 L 39,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,206L94,206L94,176L45,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,191 106,195 106,186" style="fill:rgb(0,0,0)"/>
<path d="M94,191L111,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,206L245,206A15 15 0 0 0 261 191A15 15 0 0 0 245 176L132,176A15 15 0 0 0 117 191A15 15 0 0 0 132 206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">binary-operator</text>
<polygon points="284,191 272,195 272,186" style="fill:rgb(0,0,0)"/>
<path d="M261,191L278,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,206L333,206L333,176L284,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="308" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,191 905,195 905,186" style="fill:rgb(0,0,0)"/>
<path d="M333,191L910,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,191 L 924,191 Q 931,191 931,183 L 931,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,191 33,195 33,186" style="fill:rgb(0,0,0)"/>
<path d="M24,176 L 24,183 Q 24,191 31,191 L 39,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,245L162,245A15 15 0 0 0 177 230A15 15 0 0 0 162 215L60,215A15 15 0 0 0 45 230A15 15 0 0 0 60 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="111" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-name</text>
<polygon points="194,230 183,234 183,226" style="fill:rgb(0,0,0)"/>
<path d="M177,230L188,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,245A15 15 0 0 0 224 230A15 15 0 0 0 209 215A15 15 0 0 0 194 230A15 15 0 0 0 209 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="260,230 249,234 249,226" style="fill:rgb(0,0,0)"/>
<path d="M224,230L255,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,245L437,245L437,215L260,215Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-arguments</text>
<polygon points="473,230 461,234 461,226" style="fill:rgb(0,0,0)"/>
<path d="M437,230L467,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,245A15 15 0 0 0 503 230A15 15 0 0 0 488 215A15 15 0 0 0 473 230A15 15 0 0 0 488 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="541,260 529,265 529,256" style="fill:rgb(0,0,0)"/>
<path d="M503,230 L 510,230 Q 518,230 518,245 L 518,245 Q 518,260 527,260 L 535,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,275L653,275L653,245L541,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="691,230 680,234 680,226" style="fill:rgb(0,0,0)"/>
<path d="M653,260 L 661,260 Q 668,260 668,245 L 668,245 Q 668,230 677,230 L 685,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="729,260 718,265 718,256" style="fill:rgb(0,0,0)"/>
<path d="M691,230 L 699,230 Q 706,230 706,245 L 706,245 Q 706,260 715,260 L 723,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,275L837,275L837,245L729,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="783" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">over-clause</text>
<polygon points="916,260 905,265 905,256" style="fill:rgb(0,0,0)"/>
<path d="M837,260L910,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,260 L 924,260 Q 931,260 931,253 L 931,245"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,230 33,234 33,226" style="fill:rgb(0,0,0)"/>
<path d="M24,215 L 24,222 Q 24,230 31,230 L 39,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,230 585,234 585,226" style="fill:rgb(0,0,0)"/>
<path d="M503,230L591,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,230L680,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,230 905,234 905,226" style="fill:rgb(0,0,0)"/>
<path d="M691,230L910,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,230 L 924,230 Q 931,230 931,222 L 931,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,321A15 15 0 0 0 75 306A15 15 0 0 0 60 290A15 15 0 0 0 45 306A15 15 0 0 0 60 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,306 100,310 100,301" style="fill:rgb(0,0,0)"/>
<path d="M75,306L105,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M111,321L160,321L160,290L111,290Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="306" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="196,306 185,310 185,301" style="fill:rgb(0,0,0)"/>
<path d="M160,306L191,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,321A15 15 0 0 0 227 306A15 15 0 0 0 211 290A15 15 0 0 0 196 306A15 15 0 0 0 211 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,306 905,310 905,301" style="fill:rgb(0,0,0)"/>
<path d="M227,306L910,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,306 L 924,306 Q 931,306 931,298 L 931,291"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,306 33,310 33,301" style="fill:rgb(0,0,0)"/>
<path d="M24,290 L 24,298 Q 24,306 31,306 L 39,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,284A15 15 0 0 0 151 269A15 15 0 0 0 136 254A15 15 0 0 0 121 269A15 15 0 0 0 136 284Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="269" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="151,269 162,265 162,274" style="fill:rgb(0,0,0)"/>
<path d="M160,306 L 168,306 Q 175,306 175,291 L 175,284 Q 175,269 166,269 L 157,269"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,269 L 103,269 Q 88,269 88,284 L 88,291 Q 88,306 96,306 L 103,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,358L88,358A15 15 0 0 0 103 343A15 15 0 0 0 88 328L60,328A15 15 0 0 0 45 343A15 15 0 0 0 60 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CAST</text>
<polygon points="126,343 114,348 114,339" style="fill:rgb(0,0,0)"/>
<path d="M103,343L120,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M141,358A15 15 0 0 0 156 343A15 15 0 0 0 141 328A15 15 0 0 0 126 343A15 15 0 0 0 141 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="179,343 168,348 168,339" style="fill:rgb(0,0,0)"/>
<path d="M156,343L173,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,358L228,358L228,328L179,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="251,343 240,348 240,339" style="fill:rgb(0,0,0)"/>
<path d="M228,343L246,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,358L271,358A15 15 0 0 0 286 343A15 15 0 0 0 271 328L267,328A15 15 0 0 0 251 343A15 15 0 0 0 267 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="269" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="309,343 297,348 297,339" style="fill:rgb(0,0,0)"/>
<path d="M286,343L303,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,358L408,358L408,328L309,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="358" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="431,343 419,348 419,339" style="fill:rgb(0,0,0)"/>
<path d="M408,343L425,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M446,358A15 15 0 0 0 461 343A15 15 0 0 0 446 328A15 15 0 0 0 431 343A15 15 0 0 0 446 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,343 905,348 905,339" style="fill:rgb(0,0,0)"/>
<path d="M461,343L910,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,343 L 924,343 Q 931,343 931,336 L 931,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,343 33,348 33,339" style="fill:rgb(0,0,0)"/>
<path d="M24,328 L 24,336 Q 24,343 31,343 L 39,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,396L94,396L94,366L45,366Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,381 106,385 106,377" style="fill:rgb(0,0,0)"/>
<path d="M94,381L111,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,396L196,396A15 15 0 0 0 211 381A15 15 0 0 0 196 366L132,366A15 15 0 0 0 117 381A15 15 0 0 0 132 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="234,381 223,385 223,377" style="fill:rgb(0,0,0)"/>
<path d="M211,381L229,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,396L355,396A15 15 0 0 0 370 381A15 15 0 0 0 355 366L250,366A15 15 0 0 0 234 381A15 15 0 0 0 250 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="916,381 905,385 905,377" style="fill:rgb(0,0,0)"/>
<path d="M370,381L910,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,381 L 924,381 Q 931,381 931,374 L 931,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,381 33,385 33,377" style="fill:rgb(0,0,0)"/>
<path d="M24,366 L 24,374 Q 24,381 31,381 L 39,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,434L94,434L94,404L45,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,419 119,423 119,415" style="fill:rgb(0,0,0)"/>
<path d="M94,419L124,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,434L165,434A15 15 0 0 0 180 419A15 15 0 0 0 165 404L145,404A15 15 0 0 0 130 419A15 15 0 0 0 145 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="234,419 223,423 223,415" style="fill:rgb(0,0,0)"/>
<path d="M180,419L229,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,434L273,434A15 15 0 0 0 288 419A15 15 0 0 0 273 404L250,404A15 15 0 0 0 234 419A15 15 0 0 0 250 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIKE</text>
<path d="M250,472L279,472A15 15 0 0 0 294 457A15 15 0 0 0 279 442L250,442A15 15 0 0 0 234 457A15 15 0 0 0 250 472Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="457" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GLOB</text>
<path d="M250,510L302,510A15 15 0 0 0 317 495A15 15 0 0 0 302 479L250,479A15 15 0 0 0 234 495A15 15 0 0 0 250 510Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REGEXP</text>
<path d="M250,547L297,547A15 15 0 0 0 313 532A15 15 0 0 0 297 517L250,517A15 15 0 0 0 234 532A15 15 0 0 0 250 547Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="274" y="532" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<path d="M378,510L427,510L427,479L378,479Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M378,434L427,434L427,404L378,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="465,449 454,454 454,445" style="fill:rgb(0,0,0)"/>
<path d="M427,419 L 435,419 Q 442,419 442,434 L 442,434 Q 442,449 451,449 L 460,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,464L532,464A15 15 0 0 0 547 449A15 15 0 0 0 532 434L480,434A15 15 0 0 0 465 449A15 15 0 0 0 480 464Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="506" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ESCAPE</text>
<polygon points="570,449 559,454 559,445" style="fill:rgb(0,0,0)"/>
<path d="M547,449L565,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M570,464L620,464L620,434L570,434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="595" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="671,419 659,423 659,415" style="fill:rgb(0,0,0)"/>
<path d="M620,449 L 627,449 Q 635,449 635,434 L 635,434 Q 635,419 650,419 L 650,419 L 665,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,419 905,423 905,415" style="fill:rgb(0,0,0)"/>
<path d="M671,419L910,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,419 L 924,419 Q 931,419 931,411 L 931,404"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,419 33,423 33,415" style="fill:rgb(0,0,0)"/>
<path d="M24,404 L 24,411 Q 24,419 31,419 L 39,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M100,419 L 108,419 Q 115,419 115,434 L 115,434 Q 115,449 130,449 L 177,449 Q 192,449 192,434 L 192,434 Q 192,419 199,419 L 207,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,532 223,537 223,528" style="fill:rgb(0,0,0)"/>
<path d="M196,419 L 204,419 Q 211,419 211,434 L 211,517 Q 211,532 220,532 L 229,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,457 223,461 223,452" style="fill:rgb(0,0,0)"/>
<path d="M211,442 L 211,449 Q 211,457 220,457 L 229,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,495 223,499 223,490" style="fill:rgb(0,0,0)"/>
<path d="M211,479 L 211,487 Q 211,495 220,495 L 229,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,419 367,423 367,415" style="fill:rgb(0,0,0)"/>
<path d="M288,419L372,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,532 329,537 329,528" style="fill:rgb(0,0,0)"/>
<path d="M313,532L334,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,495 367,499 367,490" style="fill:rgb(0,0,0)"/>
<path d="M340,532 L 348,532 Q 355,532 355,517 L 355,510 Q 355,495 364,495 L 372,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,495 329,499 329,490" style="fill:rgb(0,0,0)"/>
<path d="M317,495L334,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,495L378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,457 329,461 329,452" style="fill:rgb(0,0,0)"/>
<path d="M294,457L334,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,457 L 348,457 Q 355,457 355,472 L 355,480 Q 355,495 367,495 L 378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="506,419 495,423 495,415" style="fill:rgb(0,0,0)"/>
<path d="M427,419L501,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M506,419L659,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="547,495 536,499 536,490" style="fill:rgb(0,0,0)"/>
<path d="M427,495L542,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,495 L 656,495 Q 671,495 671,480 L 671,434 Q 671,419 686,419 L 692,419 L 707,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,585L94,585L94,555L45,555Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,570 119,574 119,566" style="fill:rgb(0,0,0)"/>
<path d="M94,570L124,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,585L194,585A15 15 0 0 0 209 570A15 15 0 0 0 194 555L145,555A15 15 0 0 0 130 570A15 15 0 0 0 145 585Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="170" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ISNULL</text>
<polygon points="916,570 905,574 905,566" style="fill:rgb(0,0,0)"/>
<path d="M209,570L910,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,570 L 924,570 Q 931,570 931,563 L 931,555"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,570 33,574 33,566" style="fill:rgb(0,0,0)"/>
<path d="M24,555 L 24,563 Q 24,570 31,570 L 39,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,623L215,623A15 15 0 0 0 230 608A15 15 0 0 0 215 593L145,593A15 15 0 0 0 130 608A15 15 0 0 0 145 623Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="608" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTNULL</text>
<path d="M145,661L165,661A15 15 0 0 0 180 646A15 15 0 0 0 165 631L145,631A15 15 0 0 0 130 646A15 15 0 0 0 145 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="203,646 192,650 192,641" style="fill:rgb(0,0,0)"/>
<path d="M180,646L198,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,661L250,661A15 15 0 0 0 265 646A15 15 0 0 0 250 631L219,631A15 15 0 0 0 203 646A15 15 0 0 0 219 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="288,646 276,650 276,641" style="fill:rgb(0,0,0)"/>
<path d="M265,646L282,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="339,570 327,574 327,566" style="fill:rgb(0,0,0)"/>
<path d="M288,646 L 295,646 Q 303,646 303,631 L 303,585 Q 303,570 318,570 L 318,570 L 333,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="288,608 276,612 276,604" style="fill:rgb(0,0,0)"/>
<path d="M230,608L282,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,608 L 295,608 Q 303,608 303,600 L 303,593"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,646 119,650 119,641" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,631 Q 109,646 117,646 L 124,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,608 119,612 119,604" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,593 Q 109,608 117,608 L 124,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,699L94,699L94,668L45,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,684 106,688 106,679" style="fill:rgb(0,0,0)"/>
<path d="M94,684L111,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,699A15 15 0 0 0 147 684A15 15 0 0 0 132 668A15 15 0 0 0 117 684A15 15 0 0 0 132 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IS</text>
<polygon points="183,684 172,688 172,679" style="fill:rgb(0,0,0)"/>
<path d="M147,684L178,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M198,699L219,699A15 15 0 0 0 234 684A15 15 0 0 0 219 668L198,668A15 15 0 0 0 183 684A15 15 0 0 0 198 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="270,684 258,688 258,679" style="fill:rgb(0,0,0)"/>
<path d="M234,684L264,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="306,684 294,688 294,679" style="fill:rgb(0,0,0)"/>
<path d="M270,684L300,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,699L389,699A15 15 0 0 0 404 684A15 15 0 0 0 389 668L321,668A15 15 0 0 0 306 684A15 15 0 0 0 321 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="440,684 429,688 429,679" style="fill:rgb(0,0,0)"/>
<path d="M404,684L434,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,699L490,699A15 15 0 0 0 505 684A15 15 0 0 0 490 668L455,668A15 15 0 0 0 440 684A15 15 0 0 0 455 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="541,684 530,688 530,679" style="fill:rgb(0,0,0)"/>
<path d="M505,684L535,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,699L590,699L590,668L541,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,684 905,688 905,679" style="fill:rgb(0,0,0)"/>
<path d="M590,684L910,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,684 L 924,684 Q 931,684 931,676 L 931,669"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,684 33,688 33,679" style="fill:rgb(0,0,0)"/>
<path d="M24,668 L 24,676 Q 24,684 31,684 L 39,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,684 L 156,684 Q 164,684 164,696 Q 164,708 179,708 L 230,708 Q 245,708 245,696 Q 245,684 253,684 L 260,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,684 L 279,684 Q 286,684 286,696 Q 286,708 301,708 L 502,708 Q 517,708 517,696 Q 517,684 524,684 L 532,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,744L94,744L94,714L45,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,729 119,733 119,725" style="fill:rgb(0,0,0)"/>
<path d="M94,729L124,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,744L165,744A15 15 0 0 0 180 729A15 15 0 0 0 165 714L145,714A15 15 0 0 0 130 729A15 15 0 0 0 145 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,729 205,733 205,725" style="fill:rgb(0,0,0)"/>
<path d="M180,729L211,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,744L304,744A15 15 0 0 0 319 729A15 15 0 0 0 304 714L232,714A15 15 0 0 0 216 729A15 15 0 0 0 232 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="342,729 331,733 331,725" style="fill:rgb(0,0,0)"/>
<path d="M319,729L336,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M342,744L391,744L391,714L342,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="367" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="414,729 403,733 403,725" style="fill:rgb(0,0,0)"/>
<path d="M391,729L409,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M430,744L450,744A15 15 0 0 0 465 729A15 15 0 0 0 450 714L430,714A15 15 0 0 0 414 729A15 15 0 0 0 430 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="488,729 477,733 477,725" style="fill:rgb(0,0,0)"/>
<path d="M465,729L483,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,744L538,744L538,714L488,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="513" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,729 905,733 905,725" style="fill:rgb(0,0,0)"/>
<path d="M538,729L910,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,729 L 924,729 Q 931,729 931,721 L 931,714"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,729 33,733 33,725" style="fill:rgb(0,0,0)"/>
<path d="M24,714 L 24,721 Q 24,729 31,729 L 39,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,729 L 103,729 Q 110,729 110,741 Q 110,753 125,753 L 177,753 Q 192,753 192,741 Q 192,729 199,729 L 207,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,797L94,797L94,767L45,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,782 119,786 119,778" style="fill:rgb(0,0,0)"/>
<path d="M94,782L124,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,797L165,797A15 15 0 0 0 180 782A15 15 0 0 0 165 767L145,767A15 15 0 0 0 130 782A15 15 0 0 0 145 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,782 205,786 205,778" style="fill:rgb(0,0,0)"/>
<path d="M180,782L211,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,797L234,797A15 15 0 0 0 249 782A15 15 0 0 0 234 767L232,767A15 15 0 0 0 216 782A15 15 0 0 0 232 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IN</text>
<polygon points="285,782 273,786 273,778" style="fill:rgb(0,0,0)"/>
<path d="M249,782L279,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,797A15 15 0 0 0 315 782A15 15 0 0 0 300 767A15 15 0 0 0 285 782A15 15 0 0 0 300 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,782 340,786 340,778" style="fill:rgb(0,0,0)"/>
<path d="M315,782L345,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,797L455,797L455,767L351,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="491,782 480,786 480,778" style="fill:rgb(0,0,0)"/>
<path d="M455,782L486,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M507,797A15 15 0 0 0 522 782A15 15 0 0 0 507 767A15 15 0 0 0 491 782A15 15 0 0 0 507 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="507" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,782 905,786 905,778" style="fill:rgb(0,0,0)"/>
<path d="M522,782L910,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,782 L 924,782 Q 931,782 931,774 L 931,767"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,782 33,786 33,778" style="fill:rgb(0,0,0)"/>
<path d="M24,767 L 24,774 Q 24,782 31,782 L 39,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,782 L 103,782 Q 110,782 110,794 Q 110,806 125,806 L 177,806 Q 192,806 192,794 Q 192,782 199,782 L 207,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,782 L 324,782 Q 332,782 332,770 Q 332,758 347,758 L 452,758 Q 467,758 467,770 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M379,835L428,835L428,805L379,805Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="820" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="379,820 367,824 367,815" style="fill:rgb(0,0,0)"/>
<path d="M317,782 L 324,782 Q 332,782 332,797 L 332,805 Q 332,820 347,820 L 358,820 L 373,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M428,820 L 452,820 Q 467,820 467,805 L 467,797 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,873A15 15 0 0 0 418 857A15 15 0 0 0 403 842A15 15 0 0 0 388 857A15 15 0 0 0 403 873Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="857" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,857 430,853 430,862" style="fill:rgb(0,0,0)"/>
<path d="M428,820 L 435,820 Q 443,820 443,835 L 443,842 Q 443,857 434,857 L 424,857"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,857 L 371,857 Q 356,857 356,842 L 356,835 Q 356,820 363,820 L 371,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,925L396,925A15 15 0 0 0 412 910A15 15 0 0 0 396 895L300,895A15 15 0 0 0 285 910A15 15 0 0 0 300 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="429,910 417,915 417,906" style="fill:rgb(0,0,0)"/>
<path d="M412,910L423,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,925A15 15 0 0 0 459 910A15 15 0 0 0 444 895A15 15 0 0 0 429 910A15 15 0 0 0 444 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="513,910 502,915 502,906" style="fill:rgb(0,0,0)"/>
<path d="M459,910L507,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,925L627,925A15 15 0 0 0 642 910A15 15 0 0 0 627 895L528,895A15 15 0 0 0 513 910A15 15 0 0 0 528 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="577" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function</text>
<polygon points="659,910 647,915 647,906" style="fill:rgb(0,0,0)"/>
<path d="M642,910L653,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,925A15 15 0 0 0 689 910A15 15 0 0 0 674 895A15 15 0 0 0 659 910A15 15 0 0 0 674 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="734,910 723,915 723,906" style="fill:rgb(0,0,0)"/>
<path d="M689,910L728,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,925L783,925L783,895L734,895Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="828,910 817,915 817,906" style="fill:rgb(0,0,0)"/>
<path d="M783,910L823,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M844,925A15 15 0 0 0 859 910A15 15 0 0 0 844 895A15 15 0 0 0 828 910A15 15 0 0 0 844 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="844" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,910 905,915 905,906" style="fill:rgb(0,0,0)"/>
<path d="M859,910L910,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,910 L 924,910 Q 931,910 931,903 L 931,895"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,865L603,865A15 15 0 0 0 619 850A15 15 0 0 0 603 835L528,835A15 15 0 0 0 513 850A15 15 0 0 0 528 865Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="850" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="916,850 905,854 905,846" style="fill:rgb(0,0,0)"/>
<path d="M619,850L910,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,850 L 924,850 Q 931,850 931,842 L 931,835"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="513,850 502,854 502,846" style="fill:rgb(0,0,0)"/>
<path d="M475,910 L 483,910 Q 490,910 490,895 L 490,865 Q 490,850 499,850 L 507,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,892A15 15 0 0 0 774 877A15 15 0 0 0 759 862A15 15 0 0 0 744 877A15 15 0 0 0 759 892Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="877" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="774,877 785,873 785,881" style="fill:rgb(0,0,0)"/>
<path d="M783,910 L 791,910 Q 798,910 798,895 L 798,892 Q 798,877 789,877 L 780,877"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M744,877 L 726,877 Q 711,877 711,892 L 711,895 Q 711,910 719,910 L 726,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M689,910 L 697,910 Q 704,910 704,921 Q 704,932 719,932 L 790,932 Q 805,932 805,921 Q 805,910 813,910 L 820,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="285,910 273,915 273,906" style="fill:rgb(0,0,0)"/>
<path d="M249,782 L 256,782 Q 264,782 264,797 L 264,895 Q 264,910 272,910 L 279,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,882 412,886 412,877" style="fill:rgb(0,0,0)"/>
<path d="M264,867 L 264,874 Q 264,882 279,882 L 402,882 L 417,882"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,882 L 456,882 Q 471,882 471,896 Q 471,910 478,910 L 486,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,971L80,971A15 15 0 0 0 95 956A15 15 0 0 0 80 941L60,941A15 15 0 0 0 45 956A15 15 0 0 0 60 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="131,956 120,960 120,951" style="fill:rgb(0,0,0)"/>
<path d="M95,956L125,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,971L191,971A15 15 0 0 0 206 956A15 15 0 0 0 191 941L146,941A15 15 0 0 0 131 956A15 15 0 0 0 146 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="242,956 231,960 231,951" style="fill:rgb(0,0,0)"/>
<path d="M206,956L236,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,971A15 15 0 0 0 272 956A15 15 0 0 0 257 941A15 15 0 0 0 242 956A15 15 0 0 0 257 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="295,956 284,960 284,951" style="fill:rgb(0,0,0)"/>
<path d="M272,956L290,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,971L400,971L400,941L295,941Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="423,956 411,960 411,951" style="fill:rgb(0,0,0)"/>
<path d="M400,956L417,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,971A15 15 0 0 0 453 956A15 15 0 0 0 438 941A15 15 0 0 0 423 956A15 15 0 0 0 438 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,956 905,960 905,951" style="fill:rgb(0,0,0)"/>
<path d="M453,956L910,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,956 L 924,956 Q 931,956 931,948 L 931,941"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,956 33,960 33,951" style="fill:rgb(0,0,0)"/>
<path d="M24,941 L 24,948 Q 24,956 31,956 L 39,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,929 59,934 59,925" style="fill:rgb(0,0,0)"/>
<path d="M24,914 L 24,922 Q 24,929 39,929 L 49,929 L 64,929"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,929 L 201,929 Q 216,929 216,943 Q 216,956 223,956 L 231,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,929 L 101,929 Q 108,929 108,943 Q 108,956 116,956 L 123,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,1009L89,1009A15 15 0 0 0 104 994A15 15 0 0 0 89 978L60,978A15 15 0 0 0 45 994A15 15 0 0 0 60 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASE</text>
<polygon points="140,994 128,998 128,989" style="fill:rgb(0,0,0)"/>
<path d="M104,994L134,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M140,1009L189,1009L189,978L140,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="243,994 232,998 232,989" style="fill:rgb(0,0,0)"/>
<path d="M189,994L237,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,1009L298,1009A15 15 0 0 0 313 994A15 15 0 0 0 298 978L258,978A15 15 0 0 0 243 994A15 15 0 0 0 258 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="336,994 324,998 324,989" style="fill:rgb(0,0,0)"/>
<path d="M313,994L330,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,1009L385,1009L385,978L336,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="408,994 396,998 396,989" style="fill:rgb(0,0,0)"/>
<path d="M385,994L402,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,1009L456,1009A15 15 0 0 0 472 994A15 15 0 0 0 456 978L423,978A15 15 0 0 0 408 994A15 15 0 0 0 423 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">THEN</text>
<polygon points="495,994 483,998 483,989" style="fill:rgb(0,0,0)"/>
<path d="M472,994L489,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M495,1009L544,1009L544,978L495,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="616,994 604,998 604,989" style="fill:rgb(0,0,0)"/>
<path d="M544,994L610,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M631,1009L658,1009A15 15 0 0 0 673 994A15 15 0 0 0 658 978L631,978A15 15 0 0 0 616 994A15 15 0 0 0 631 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="645" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ELSE</text>
<polygon points="696,994 685,998 685,989" style="fill:rgb(0,0,0)"/>
<path d="M673,994L691,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M696,1009L746,1009L746,978L696,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="721" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="782,994 770,998 770,989" style="fill:rgb(0,0,0)"/>
<path d="M746,994L776,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M797,1009L818,1009A15 15 0 0 0 833 994A15 15 0 0 0 818 978L797,978A15 15 0 0 0 782 994A15 15 0 0 0 797 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="807" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="916,994 905,998 905,989" style="fill:rgb(0,0,0)"/>
<path d="M833,994L910,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,994 L 924,994 Q 931,994 931,986 L 931,979"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,994 33,998 33,989" style="fill:rgb(0,0,0)"/>
<path d="M24,978 L 24,986 Q 24,994 31,994 L 39,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,994 L 111,994 Q 119,994 119,1007 Q 119,1021 134,1021 L 186,1021 Q 201,1021 201,1007 Q 201,994 208,994 L 216,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="360,1021 372,1016 372,1025" style="fill:rgb(0,0,0)"/>
<path d="M544,994 L 551,994 Q 559,994 559,1007 Q 559,1021 544,1021 L 381,1021 L 366,1021"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,1021 L 235,1021 Q 220,1021 220,1007 Q 220,994 227,994 L 235,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,994 L 585,994 Q 593,994 593,1007 Q 593,1021 608,1021 L 742,1021 Q 757,1021 757,1007 Q 757,994 765,994 L 772,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,1066L173,1066L173,1036L45,1036Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="1051" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">raise-function</text>
<polygon points="916,1051 905,1055 905,1047" style="fill:rgb(0,0,0)"/>
<path d="M173,1051L910,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,1051 L 924,1051 Q 931,1051 931,1036 L 931,32 Q 931,17 939,17 L 946,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,1051 33,1055 33,1047" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,1036 Q 24,1051 31,1051 L 39,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/filter-clause.html">filter-clause:</a></b>
<button id='xe791f458' onclick='hideorshow("xe791f458","x8260bcb6")'>show</button></p>
 <div id='x8260bcb6' style='display:none;' class='imgcontainer'>
 <div style="max-width:422px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 422.381 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L93,32A15 15 0 0 0 108 17A15 15 0 0 0 93 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FILTER</text>
<polygon points="131,17 119,21 119,12" style="fill:rgb(0,0,0)"/>
<path d="M108,17L125,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,32L146,32A15 15 0 0 0 161 17A15 15 0 0 0 146 2L146,2A15 15 0 0 0 131 17A15 15 0 0 0 146 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="184,17 173,21 173,12" style="fill:rgb(0,0,0)"/>
<path d="M161,17L178,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M199,32L249,32A15 15 0 0 0 264 17A15 15 0 0 0 249 2L199,2A15 15 0 0 0 184 17A15 15 0 0 0 199 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="224" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="287,17 275,21 275,12" style="fill:rgb(0,0,0)"/>
<path d="M264,17L281,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,32L336,32L336,2L287,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M336,17L353,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,32A15 15 0 0 0 389 17A15 15 0 0 0 374 2A15 15 0 0 0 359 17A15 15 0 0 0 374 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="374" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="413,17 401,21 401,12" style="fill:rgb(0,0,0)"/>
<path d="M389,17L407,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="416" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/function-arguments.html">function-arguments:</a></b>
<button id='x294715b9' onclick='hideorshow("x294715b9","x41a15dbf")'>show</button></p>
 <div id='x41a15dbf' style='display:none;' class='imgcontainer'>
 <div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.566 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,26 55,30 55,22" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,41 L 43,41 Q 43,26 52,26 L 61,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M82,41L150,41A15 15 0 0 0 165 26L165,26A15 15 0 0 0 150 11L82,11A15 15 0 0 0 66 26L66,26A15 15 0 0 0 82 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="183,26 171,30 171,22" style="fill:rgb(0,0,0)"/>
<path d="M165,26L177,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M183,26 L 189,26 Q 194,26 194,41 L 194,41 Q 194,56 203,56 L 212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M218,56L248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,71L303,71L303,41L254,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="447,56 435,60 435,52" style="fill:rgb(0,0,0)"/>
<path d="M303,56L441,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="116,56 104,60 104,52" style="fill:rgb(0,0,0)"/>
<path d="M32,56L110,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M116,56L212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,32A15 15 0 0 0 293 17A15 15 0 0 0 278 2A15 15 0 0 0 263 17A15 15 0 0 0 278 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="293,17 305,12 305,21" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 314,56 Q 326,56 326,41 L 326,32 Q 326,17 312,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M263,17 L 245,17 Q 230,17 230,32 L 230,41 Q 230,56 239,56 L 248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,207A15 15 0 0 0 243 192L243,192A15 15 0 0 0 228 177A15 15 0 0 0 213 192L213,192A15 15 0 0 0 228 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="213,192 201,196 201,188" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,71 L 43,177 Q 43,192 58,192 L 192,192 L 207,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,192 267,196 267,188" style="fill:rgb(0,0,0)"/>
<path d="M243,192L272,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,192 L 360,192 Q 375,192 390,192 L 394,192 Q 409,192 409,177 L 409,71 Q 409,56 415,56 L 421,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="228,216 216,221 216,212" style="fill:rgb(0,0,0)"/>
<path d="M116,192 L 181,192 Q 196,192 196,204 Q 196,216 209,216 L 222,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,216 L 242,216 Q 257,216 257,204 Q 257,192 262,192 L 268,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="90,117 78,121 78,112" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 313,56 Q 323,56 323,71 L 323,71 Q 323,86 308,86 L 81,86 Q 66,86 66,101 L 66,102 Q 66,117 75,117 L 84,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,132L149,132A15 15 0 0 0 164 117L164,117A15 15 0 0 0 149 101L105,101A15 15 0 0 0 90 117L90,117A15 15 0 0 0 105 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="182,117 170,121 170,112" style="fill:rgb(0,0,0)"/>
<path d="M164,117L176,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,132L201,132A15 15 0 0 0 216 117L216,117A15 15 0 0 0 201 101L197,101A15 15 0 0 0 182 117L182,117A15 15 0 0 0 197 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M216,117L239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,132L375,132L375,101L245,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,169A15 15 0 0 0 325 154A15 15 0 0 0 310 139A15 15 0 0 0 294 154A15 15 0 0 0 310 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,154 336,150 336,159" style="fill:rgb(0,0,0)"/>
<path d="M375,117 L 380,117 Q 386,117 386,132 L 386,139 Q 386,154 371,154 L 345,154 L 330,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M294,154 L 260,154 Q 245,154 236,154 Q 227,154 227,139 L 227,132 Q 227,117 233,117 L 239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M375,117 L 383,117 Q 392,117 392,102 L 392,71 Q 392,56 407,56 L 413,56 L 428,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x4e8b2cb5' onclick='hideorshow("x4e8b2cb5","x8a17e5e9")'>show</button></p>
 <div id='x8a17e5e9' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/literal-value.html">literal-value:</a></b>
<button id='xb2b97a34' onclick='hideorshow("xb2b97a34","x64694c99")'>show</button></p>
 <div id='x64694c99' style='display:none;' class='imgcontainer'>
 <div style="max-width:341px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 341.376 336.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,319 39,324 39,315" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,304 Q 24,319 34,319 L 45,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,334L252,334A15 15 0 0 0 267 319A15 15 0 0 0 252 304L65,304A15 15 0 0 0 50 319A15 15 0 0 0 65 334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIMESTAMP</text>
<polygon points="290,319 278,324 278,315" style="fill:rgb(0,0,0)"/>
<path d="M267,319L284,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,17 320,21 320,12" style="fill:rgb(0,0,0)"/>
<path d="M290,319 L 297,319 Q 305,319 305,304 L 305,32 Q 305,17 315,17 L 326,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="335" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L172,32A15 15 0 0 0 187 17A15 15 0 0 0 172 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="119" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,17L320,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L153,70A15 15 0 0 0 168 55L168,55A15 15 0 0 0 153 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">string-literal</text>
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,47 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,55 278,59 278,50" style="fill:rgb(0,0,0)"/>
<path d="M168,55L284,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,55 L 297,55 Q 305,55 305,47 L 305,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L140,108A15 15 0 0 0 155 92A15 15 0 0 0 140 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">blob-literal</text>
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,85 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,92 278,97 278,88" style="fill:rgb(0,0,0)"/>
<path d="M155,92L284,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,92 L 297,92 Q 305,92 305,85 L 305,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,145L97,145A15 15 0 0 0 112 130A15 15 0 0 0 97 115L66,115A15 15 0 0 0 50 130A15 15 0 0 0 66 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="50,130 39,135 39,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 34,130 L 45,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,130 278,135 278,126" style="fill:rgb(0,0,0)"/>
<path d="M112,130L284,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,130 L 297,130 Q 305,130 305,123 L 305,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,183L96,183A15 15 0 0 0 111 168A15 15 0 0 0 96 153L66,153A15 15 0 0 0 50 168A15 15 0 0 0 66 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRUE</text>
<polygon points="50,168 39,172 39,164" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,160 Q 24,168 34,168 L 45,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,168 278,172 278,164" style="fill:rgb(0,0,0)"/>
<path d="M111,168L284,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,168 L 297,168 Q 305,168 305,160 L 305,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,221L104,221A15 15 0 0 0 119 206A15 15 0 0 0 104 191L66,191A15 15 0 0 0 50 206A15 15 0 0 0 66 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FALSE</text>
<polygon points="50,206 39,210 39,201" style="fill:rgb(0,0,0)"/>
<path d="M24,191 L 24,198 Q 24,206 34,206 L 45,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,206 278,210 278,201" style="fill:rgb(0,0,0)"/>
<path d="M119,206L284,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,206 L 297,206 Q 305,206 305,198 L 305,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,259L190,259A15 15 0 0 0 205 244A15 15 0 0 0 190 228L66,228A15 15 0 0 0 50 244A15 15 0 0 0 66 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="128" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIME</text>
<polygon points="50,244 39,248 39,239" style="fill:rgb(0,0,0)"/>
<path d="M24,228 L 24,236 Q 24,244 34,244 L 45,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,244 278,248 278,239" style="fill:rgb(0,0,0)"/>
<path d="M205,244L284,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,244 L 297,244 Q 305,244 305,236 L 305,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,297L192,297A15 15 0 0 0 207 281A15 15 0 0 0 192 266L66,266A15 15 0 0 0 50 281A15 15 0 0 0 66 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_DATE</text>
<polygon points="50,281 39,286 39,277" style="fill:rgb(0,0,0)"/>
<path d="M24,266 L 24,274 Q 24,281 34,281 L 45,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,281 278,286 278,277" style="fill:rgb(0,0,0)"/>
<path d="M207,281L284,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,281 L 297,281 Q 305,281 305,274 L 305,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/over-clause.html">over-clause:</a></b>
<button id='xe862b068' onclick='hideorshow("xe862b068","xfa21af70")'>show</button></p>
 <div id='xfa21af70' style='display:none;' class='imgcontainer'>
 <div style="max-width:600px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 600.706 418.392">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="129,17 117,21 117,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L123,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M144,32L241,32A15 15 0 0 0 256 17A15 15 0 0 0 241 2L144,2A15 15 0 0 0 129 17A15 15 0 0 0 144 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,17 L 100,17 Q 108,17 108,32 L 108,40 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,70A15 15 0 0 0 165 55L165,55A15 15 0 0 0 149 39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 149 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="149" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="206,82 195,86 195,77" style="fill:rgb(0,0,0)"/>
<path d="M165,55 L 172,55 Q 180,55 180,68 Q 180,82 190,82 L 200,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,97L363,97A15 15 0 0 0 378 82A15 15 0 0 0 363 67L221,67A15 15 0 0 0 206 82A15 15 0 0 0 221 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="292" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M221,173L301,173A15 15 0 0 0 316 157A15 15 0 0 0 301 142L221,142A15 15 0 0 0 206 157A15 15 0 0 0 221 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="339,157 328,162 328,153" style="fill:rgb(0,0,0)"/>
<path d="M316,157L333,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,173L358,173A15 15 0 0 0 373 157A15 15 0 0 0 358 142L354,142A15 15 0 0 0 339 157A15 15 0 0 0 354 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="409,157 398,162 398,153" style="fill:rgb(0,0,0)"/>
<path d="M373,157L404,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,173L459,173L459,142L409,142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M434,210A15 15 0 0 0 449 195A15 15 0 0 0 434 180A15 15 0 0 0 419 195A15 15 0 0 0 434 210Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="195" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="449,195 461,191 461,200" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,180 Q 474,195 464,195 L 455,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,195 L 398,195 Q 383,195 383,180 L 383,172 Q 383,157 390,157 L 398,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,55 280,59 280,50" style="fill:rgb(0,0,0)"/>
<path d="M165,55L286,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,120 304,115 304,124" style="fill:rgb(0,0,0)"/>
<path d="M292,55 L 401,55 Q 416,55 416,70 L 416,105 Q 416,120 401,120 L 313,120 L 298,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,157 195,162 195,153" style="fill:rgb(0,0,0)"/>
<path d="M292,120 L 180,120 Q 165,120 165,135 L 165,142 Q 165,157 180,157 L 185,157 L 200,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="401,82 389,86 389,77" style="fill:rgb(0,0,0)"/>
<path d="M378,82L395,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,82 L 408,82 Q 416,82 416,89 L 416,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,286L266,286A15 15 0 0 0 281 271A15 15 0 0 0 266 256L221,256A15 15 0 0 0 206 271A15 15 0 0 0 221 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="244" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="304,271 292,275 292,266" style="fill:rgb(0,0,0)"/>
<path d="M281,271L298,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M319,286L323,286A15 15 0 0 0 338 271A15 15 0 0 0 323 256L319,256A15 15 0 0 0 304 271A15 15 0 0 0 319 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="321" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="374,271 363,275 363,266" style="fill:rgb(0,0,0)"/>
<path d="M338,271L368,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,286L504,286L504,256L374,256Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M439,324A15 15 0 0 0 454 309A15 15 0 0 0 439 293A15 15 0 0 0 424 309A15 15 0 0 0 439 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="454,309 466,304 466,313" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,294 Q 519,309 504,309 L 475,309 L 460,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,309 L 363,309 Q 348,309 348,294 L 348,286 Q 348,271 355,271 L 363,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,233 304,229 304,237" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,218 Q 474,233 459,233 L 313,233 L 298,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,271 195,275 195,266" style="fill:rgb(0,0,0)"/>
<path d="M292,233 L 180,233 Q 165,233 165,248 L 165,256 Q 165,271 180,271 L 185,271 L 200,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,195 160,184 169,184" style="fill:rgb(0,0,0)"/>
<path d="M165,142L165,189"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,195L165,256"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,399L311,399L311,369L206,369Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="384" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="519,384 508,389 508,380" style="fill:rgb(0,0,0)"/>
<path d="M311,384L513,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M534,399A15 15 0 0 0 549 384A15 15 0 0 0 534 369A15 15 0 0 0 519 384A15 15 0 0 0 534 399Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="384" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="591,17 579,21 579,12" style="fill:rgb(0,0,0)"/>
<path d="M549,384 L 557,384 Q 564,384 564,369 L 564,32 Q 564,17 575,17 L 585,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="594" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,17 508,21 508,12" style="fill:rgb(0,0,0)"/>
<path d="M256,17L513,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,17L579,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,346 304,342 304,351" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,331 Q 519,346 504,346 L 313,346 L 298,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,384 195,389 195,380" style="fill:rgb(0,0,0)"/>
<path d="M292,346 L 180,346 Q 165,346 165,361 L 165,369 Q 165,384 180,384 L 185,384 L 200,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,309 160,297 169,297" style="fill:rgb(0,0,0)"/>
<path d="M165,256L165,303"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,309L165,369"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="258,411 247,416 247,407" style="fill:rgb(0,0,0)"/>
<path d="M165,369 L 165,396 Q 165,411 180,411 L 238,411 L 253,411"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,384 369,389 369,380" style="fill:rgb(0,0,0)"/>
<path d="M258,411 L 335,411 Q 350,411 350,398 Q 350,384 362,384 L 375,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x7bf2638c' onclick='hideorshow("x7bf2638c","x34ebd14e")'>show</button></p>
 <div id='x34ebd14e' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='xd304f4d2' onclick='hideorshow("xd304f4d2","x0ceb4e50")'>show</button></p>
 <div id='x0ceb4e50' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/raise-function.html">raise-function:</a></b>
<button id='xcf481b97' onclick='hideorshow("xcf481b97","x2f37d3c8")'>show</button></p>
 <div id='x2f37d3c8' style='display:none;' class='imgcontainer'>
 <div style="max-width:627px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 627.302 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L82,32A15 15 0 0 0 97 17A15 15 0 0 0 82 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RAISE</text>
<polygon points="120,17 109,21 109,12" style="fill:rgb(0,0,0)"/>
<path d="M97,17L114,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,32L135,32A15 15 0 0 0 150 17A15 15 0 0 0 135 2L135,2A15 15 0 0 0 120 17A15 15 0 0 0 135 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="135" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="192,55 180,59 180,50" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 158,17 Q 165,17 165,32 L 165,40 Q 165,55 176,55 L 186,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,70L285,70A15 15 0 0 0 300 55L300,55A15 15 0 0 0 285 39L207,39A15 15 0 0 0 192 55L192,55A15 15 0 0 0 207 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="336,55 324,59 324,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70A15 15 0 0 0 366 55L366,55A15 15 0 0 0 351 39A15 15 0 0 0 336 55L336,55A15 15 0 0 0 351 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="389,55 378,59 378,50" style="fill:rgb(0,0,0)"/>
<path d="M366,55L383,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,70L508,70A15 15 0 0 0 523 55L523,55A15 15 0 0 0 508 39L404,39A15 15 0 0 0 389 55L389,55A15 15 0 0 0 404 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="456" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">error-message</text>
<polygon points="564,17 553,21 553,12" style="fill:rgb(0,0,0)"/>
<path d="M523,55 L 530,55 Q 538,55 538,40 L 538,32 Q 538,17 548,17 L 558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M579,32A15 15 0 0 0 594 17A15 15 0 0 0 579 2A15 15 0 0 0 564 17A15 15 0 0 0 579 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="617,17 606,21 606,12" style="fill:rgb(0,0,0)"/>
<path d="M594,17L612,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="621" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L259,32A15 15 0 0 0 274 17A15 15 0 0 0 259 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="456,17 444,21 444,12" style="fill:rgb(0,0,0)"/>
<path d="M274,17L450,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,17L553,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,108L249,108A15 15 0 0 0 264 92A15 15 0 0 0 249 77L207,77A15 15 0 0 0 192 92A15 15 0 0 0 207 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="300,92 288,97 288,88" style="fill:rgb(0,0,0)"/>
<path d="M264,92L294,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,92 L 307,92 Q 315,92 315,77 L 315,70 Q 315,55 322,55 L 330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,145L229,145A15 15 0 0 0 244 130A15 15 0 0 0 229 115L207,115A15 15 0 0 0 192 130A15 15 0 0 0 207 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="300,130 288,135 288,126" style="fill:rgb(0,0,0)"/>
<path d="M244,130L294,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,130 L 307,130 Q 315,130 315,115 L 315,92 L 315,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,130 180,135 180,126" style="fill:rgb(0,0,0)"/>
<path d="M165,39 L 165,115 Q 165,130 176,130 L 186,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,92 180,97 180,88" style="fill:rgb(0,0,0)"/>
<path d="M165,77 L 165,85 Q 165,92 176,92 L 186,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/select-stmt.html">select-stmt:</a></b>
<button id='x08301f51' onclick='hideorshow("x08301f51","xadcf1140")'>show</button></p>
 <div id='xadcf1140' style='display:none;' class='imgcontainer'>
 <div style="max-width:669px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 669.677 1162.3">
<path d="M55,845L667,845L667,99L55,99Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="6" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="46,17 34,21 34,12" style="fill:rgb(0,0,0)"/>
<path d="M10,17L40,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M61,32L92,32A15 15 0 0 0 107 17A15 15 0 0 0 92 2L61,2A15 15 0 0 0 46 17A15 15 0 0 0 61 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="76" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M167,62L253,62A15 15 0 0 0 268 47L268,47A15 15 0 0 0 253 32L167,32A15 15 0 0 0 152 47L152,47A15 15 0 0 0 167 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="210,17 198,21 198,12" style="fill:rgb(0,0,0)"/>
<path d="M107,17L204,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M210,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M358,32L584,32L584,2L358,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="152,47 140,51 140,43" style="fill:rgb(0,0,0)"/>
<path d="M107,17 L 114,17 Q 122,17 122,32 L 122,32 Q 122,47 134,47 L 146,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="291,47 279,51 279,43" style="fill:rgb(0,0,0)"/>
<path d="M268,47L285,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,47 L 298,47 Q 306,47 306,32 L 306,32 Q 306,17 321,17 L 331,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,70A15 15 0 0 0 486 55L486,55A15 15 0 0 0 471 39A15 15 0 0 0 456 55L456,55A15 15 0 0 0 471 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="486,55 498,50 498,59" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,40 Q 599,55 584,55 L 507,55 L 492,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,55 L 350,55 Q 335,55 335,40 L 335,32 Q 335,17 340,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,83 307,79 307,88" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,68 Q 599,83 584,83 L 316,83 L 301,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,83 L 40,83 Q 25,83 25,98 L 25,113"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="25,47 20,36 29,36" style="fill:rgb(0,0,0)"/>
<path d="M10,17 L 17,17 Q 25,17 25,29 L 25,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="55,129 43,133 43,124" style="fill:rgb(0,0,0)"/>
<path d="M25,47 L 25,114 Q 25,129 37,129 L 49,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,129 115,133 115,124" style="fill:rgb(0,0,0)"/>
<path d="M55,129L121,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,144L193,144A15 15 0 0 0 208 129A15 15 0 0 0 193 114L142,114A15 15 0 0 0 127 129A15 15 0 0 0 142 144Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="250,159 238,163 238,155" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,144 Q 223,159 233,159 L 244,159"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,174L333,174A15 15 0 0 0 348 159A15 15 0 0 0 333 144L265,144A15 15 0 0 0 250 159A15 15 0 0 0 265 174Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="159" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="417,129 406,133 406,124" style="fill:rgb(0,0,0)"/>
<path d="M348,159 L 356,159 Q 363,159 363,144 L 363,144 Q 363,129 378,129 L 396,129 L 411,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,144L545,144L545,114L417,114Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M481,182A15 15 0 0 0 496 166A15 15 0 0 0 481 151A15 15 0 0 0 466 166A15 15 0 0 0 481 182Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="166" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="496,166 508,162 508,171" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,151 Q 560,166 545,166 L 517,166 L 502,166"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M466,166 L 406,166 Q 391,166 391,151 L 391,144 Q 391,129 398,129 L 406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,129 287,133 287,124" style="fill:rgb(0,0,0)"/>
<path d="M208,129L293,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M299,129L406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,212L280,212A15 15 0 0 0 295 197A15 15 0 0 0 280 182L265,182A15 15 0 0 0 250 197A15 15 0 0 0 265 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="197" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="348,197 337,201 337,192" style="fill:rgb(0,0,0)"/>
<path d="M295,197L342,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,197 L 356,197 Q 363,197 363,182 L 363,159 L 363,144"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="250,197 238,201 238,192" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,182 Q 223,197 233,197 L 244,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,287L203,287A15 15 0 0 0 218 272A15 15 0 0 0 203 257L168,257A15 15 0 0 0 153 272A15 15 0 0 0 168 287Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="186" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="290,272 279,277 279,268" style="fill:rgb(0,0,0)"/>
<path d="M218,272L284,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,287L451,287L451,257L290,257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M320,362L422,362L422,331L320,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M371,324A15 15 0 0 0 386 309A15 15 0 0 0 371 293A15 15 0 0 0 356 309A15 15 0 0 0 371 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="386,309 397,304 397,313" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 459,272 Q 466,272 466,287 L 466,294 Q 466,309 451,309 L 407,309 L 392,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M356,309 L 279,309 Q 264,309 264,294 L 264,287 Q 264,272 271,272 L 279,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="320,346 308,351 308,342" style="fill:rgb(0,0,0)"/>
<path d="M218,272 L 226,272 Q 233,272 233,287 L 233,331 Q 233,346 248,346 L 299,346 L 314,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="484,313 488,325 480,325" style="fill:rgb(0,0,0)"/>
<path d="M422,346 L 436,346 Q 451,346 466,346 L 469,346 Q 484,346 484,333 L 484,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,272 494,277 494,268" style="fill:rgb(0,0,0)"/>
<path d="M484,313 L 484,287 Q 484,272 492,272 L 499,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,272 L 496,272 Q 487,272 487,272 Q 487,272 495,272 L 502,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,197 555,185 564,185" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,176 L 560,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,235 360,230 360,239" style="fill:rgb(0,0,0)"/>
<path d="M560,197 L 560,220 Q 560,235 545,235 L 369,235 L 354,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,272 142,277 142,268" style="fill:rgb(0,0,0)"/>
<path d="M348,235 L 142,235 Q 127,235 127,250 L 127,257 Q 127,272 137,272 L 147,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,437L218,437A15 15 0 0 0 233 422A15 15 0 0 0 218 407L168,407A15 15 0 0 0 153 422A15 15 0 0 0 168 437Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="256,422 244,426 244,418" style="fill:rgb(0,0,0)"/>
<path d="M233,422L250,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,437L305,437L305,407L256,407Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="517,324 513,312 521,312" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 502,272 Q 517,272 517,287 L 517,303 L 517,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,384 382,380 382,389" style="fill:rgb(0,0,0)"/>
<path d="M517,324 L 517,369 Q 517,384 502,384 L 391,384 L 376,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,422 142,426 142,418" style="fill:rgb(0,0,0)"/>
<path d="M371,384 L 142,384 Q 127,384 127,399 L 127,407 Q 127,422 137,422 L 147,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,324 122,312 131,312" style="fill:rgb(0,0,0)"/>
<path d="M127,257L127,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,324L127,407"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,535L212,535A15 15 0 0 0 227 520A15 15 0 0 0 212 505L168,505A15 15 0 0 0 153 520A15 15 0 0 0 168 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="250,520 238,525 238,516" style="fill:rgb(0,0,0)"/>
<path d="M227,520L244,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,535L269,535A15 15 0 0 0 284 520A15 15 0 0 0 269 505L265,505A15 15 0 0 0 250 520A15 15 0 0 0 265 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="320,520 309,525 309,516" style="fill:rgb(0,0,0)"/>
<path d="M284,520L314,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,535L369,535L369,505L320,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="452,520 441,525 441,516" style="fill:rgb(0,0,0)"/>
<path d="M369,520L446,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,535L520,535A15 15 0 0 0 535 520A15 15 0 0 0 520 505L467,505A15 15 0 0 0 452 520A15 15 0 0 0 467 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="558,520 546,525 546,516" style="fill:rgb(0,0,0)"/>
<path d="M535,520L552,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,535L607,535L607,505L558,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M345,573A15 15 0 0 0 360 558A15 15 0 0 0 345 543A15 15 0 0 0 330 558A15 15 0 0 0 345 573Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="558" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="360,558 371,554 371,562" style="fill:rgb(0,0,0)"/>
<path d="M369,520 L 377,520 Q 384,520 384,535 L 384,543 Q 384,558 375,558 L 366,558"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,558 L 309,558 Q 294,558 294,543 L 294,535 Q 294,520 301,520 L 309,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="514,551 503,555 503,546" style="fill:rgb(0,0,0)"/>
<path d="M411,520 L 418,520 Q 426,520 426,535 L 426,536 Q 426,551 441,551 L 493,551 L 508,551"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M514,551 L 607,551 Q 622,551 622,536 L 622,535 Q 622,520 630,520 L 637,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,490 256,494 256,486" style="fill:rgb(0,0,0)"/>
<path d="M127,460 L 127,475 Q 127,490 142,490 L 246,490 L 261,490"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,520 399,525 399,516" style="fill:rgb(0,0,0)"/>
<path d="M267,490 L 369,490 Q 384,490 384,505 L 384,505 Q 384,520 395,520 L 405,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,460 244,455 244,464" style="fill:rgb(0,0,0)"/>
<path d="M305,422 L 313,422 Q 320,422 320,437 L 320,445 Q 320,460 305,460 L 254,460 L 239,460"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,520 142,525 142,516" style="fill:rgb(0,0,0)"/>
<path d="M233,460 L 142,460 Q 127,460 127,475 L 127,505 Q 127,520 137,520 L 147,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,447 122,435 131,435" style="fill:rgb(0,0,0)"/>
<path d="M127,407L127,441"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,447L127,505"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,649L232,649A15 15 0 0 0 247 634A15 15 0 0 0 232 619L168,619A15 15 0 0 0 153 634A15 15 0 0 0 168 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="200" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="283,634 271,638 271,629" style="fill:rgb(0,0,0)"/>
<path d="M247,634L277,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,649L395,649A15 15 0 0 0 410 634A15 15 0 0 0 395 619L298,619A15 15 0 0 0 283 634A15 15 0 0 0 298 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="433,634 422,638 422,629" style="fill:rgb(0,0,0)"/>
<path d="M410,634L427,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,649L452,649A15 15 0 0 0 467 634A15 15 0 0 0 452 619L448,619A15 15 0 0 0 433 634A15 15 0 0 0 448 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="450" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="490,634 479,638 479,629" style="fill:rgb(0,0,0)"/>
<path d="M467,634L485,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,649L609,649L609,619L490,619Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="550" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M446,687A15 15 0 0 0 461 671A15 15 0 0 0 446 656A15 15 0 0 0 431 671A15 15 0 0 0 446 687Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="671" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="461,671 472,667 472,676" style="fill:rgb(0,0,0)"/>
<path d="M609,634 L 616,634 Q 624,634 624,649 L 624,656 Q 624,671 609,671 L 482,671 L 467,671"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,671 L 271,671 Q 256,671 256,656 L 256,649 Q 256,634 264,634 L 271,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="624,692 619,680 628,680" style="fill:rgb(0,0,0)"/>
<path d="M624,656L624,686"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,558 648,547 656,547" style="fill:rgb(0,0,0)"/>
<path d="M607,520 L 637,520 Q 652,520 652,535 L 652,537 L 652,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,596 382,592 382,600" style="fill:rgb(0,0,0)"/>
<path d="M652,558 L 652,581 Q 652,596 637,596 L 391,596 L 376,596"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,634 142,638 142,629" style="fill:rgb(0,0,0)"/>
<path d="M371,596 L 142,596 Q 127,596 127,611 L 127,619 Q 127,634 137,634 L 147,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,558 122,547 131,547" style="fill:rgb(0,0,0)"/>
<path d="M127,505L127,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,709 359,714 359,705" style="fill:rgb(0,0,0)"/>
<path d="M127,558 L 127,694 Q 127,709 142,709 L 350,709 L 365,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,709 597,714 597,705" style="fill:rgb(0,0,0)"/>
<path d="M371,709L603,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,709 L 616,709 Q 624,709 624,717 L 624,724"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,800L194,800A15 15 0 0 0 209 785A15 15 0 0 0 194 770L142,770A15 15 0 0 0 127 785A15 15 0 0 0 142 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="245,785 234,789 234,781" style="fill:rgb(0,0,0)"/>
<path d="M209,785L239,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,800A15 15 0 0 0 275 785A15 15 0 0 0 260 770A15 15 0 0 0 245 785A15 15 0 0 0 260 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="311,785 300,789 300,781" style="fill:rgb(0,0,0)"/>
<path d="M275,785L306,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,800L361,800L361,770L311,770Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="397,785 385,789 385,781" style="fill:rgb(0,0,0)"/>
<path d="M361,785L391,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,800A15 15 0 0 0 427 785A15 15 0 0 0 412 770A15 15 0 0 0 397 785A15 15 0 0 0 412 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="412" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="609,785 597,789 597,781" style="fill:rgb(0,0,0)"/>
<path d="M427,785L603,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,785 L 616,785 Q 624,785 624,792 L 624,800"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,762A15 15 0 0 0 351 747A15 15 0 0 0 336 732A15 15 0 0 0 321 747A15 15 0 0 0 336 762Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="747" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M336,838A15 15 0 0 0 351 823A15 15 0 0 0 336 808A15 15 0 0 0 321 823A15 15 0 0 0 336 838Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="823" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="351,747 363,743 363,751" style="fill:rgb(0,0,0)"/>
<path d="M361,785 L 368,785 Q 376,785 376,770 L 376,762 Q 376,747 366,747 L 357,747"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,747 L 300,747 Q 285,747 285,762 L 285,770 Q 285,785 292,785 L 300,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,823 363,818 363,827" style="fill:rgb(0,0,0)"/>
<path d="M427,785 L 434,785 Q 442,785 442,800 L 442,808 Q 442,823 427,823 L 372,823 L 357,823"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,823 L 234,823 Q 219,823 219,808 L 219,800 Q 219,785 226,785 L 234,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,785 115,789 115,781" style="fill:rgb(0,0,0)"/>
<path d="M55,129 L 62,129 Q 70,129 70,144 L 70,770 Q 70,785 85,785 L 106,785 L 121,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,891L424,891L424,860L248,860Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="876" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="424,876 436,871 436,880" style="fill:rgb(0,0,0)"/>
<path d="M624,692 L 624,861 Q 624,876 609,876 L 445,876 L 430,876"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="6,197 10,208 2,208" style="fill:rgb(0,0,0)"/>
<path d="M248,876 L 21,876 Q 6,876 6,861 L 6,217 L 6,202"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M6,197 L 6,144 Q 6,129 21,129 L 40,129 L 55,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="667" y="275" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" transform="rotate(-90 667,285)" dominant-baseline="central">select-core</text>
<path d="M168,966L213,966A15 15 0 0 0 228 951A15 15 0 0 0 213 936L168,936A15 15 0 0 0 153 951A15 15 0 0 0 168 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="251,951 239,956 239,947" style="fill:rgb(0,0,0)"/>
<path d="M228,951L245,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,966L270,966A15 15 0 0 0 285 951A15 15 0 0 0 270 936L266,936A15 15 0 0 0 251 951A15 15 0 0 0 266 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M168,1072L202,1072A15 15 0 0 0 217 1057A15 15 0 0 0 202 1042L168,1042A15 15 0 0 0 153 1057A15 15 0 0 0 168 1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="240,1057 228,1061 228,1053" style="fill:rgb(0,0,0)"/>
<path d="M217,1057L234,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,1072L289,1072L289,1042L240,1042Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="330,951 319,956 319,947" style="fill:rgb(0,0,0)"/>
<path d="M285,951L324,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,966L460,966L460,936L330,936Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M395,1004A15 15 0 0 0 410 989A15 15 0 0 0 395 974A15 15 0 0 0 380 989A15 15 0 0 0 395 1004Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="989" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="410,989 422,985 422,993" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 468,951 Q 475,951 475,966 L 475,974 Q 475,989 460,989 L 431,989 L 416,989"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,989 L 322,989 Q 307,989 307,974 L 307,966 Q 307,951 313,951 L 319,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,913 348,909 348,918" style="fill:rgb(0,0,0)"/>
<path d="M624,860 L 624,898 Q 624,913 609,913 L 357,913 L 342,913"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,951 142,956 142,947" style="fill:rgb(0,0,0)"/>
<path d="M336,913 L 142,913 Q 127,913 127,928 L 127,936 Q 127,951 137,951 L 147,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,981 492,970 500,970" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 481,951 Q 496,951 496,963 L 496,976"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,1023 318,1019 318,1027" style="fill:rgb(0,0,0)"/>
<path d="M496,981 L 496,1008 Q 496,1023 481,1023 L 327,1023 L 312,1023"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,1057 142,1061 142,1053" style="fill:rgb(0,0,0)"/>
<path d="M307,1023 L 142,1023 Q 127,1023 127,1038 L 127,1042 Q 127,1057 137,1057 L 147,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,989 122,978 131,978" style="fill:rgb(0,0,0)"/>
<path d="M127,936L127,983"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,989L127,1042"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1102L415,1102A15 15 0 0 0 430 1087A15 15 0 0 0 415 1072L363,1072A15 15 0 0 0 348 1087A15 15 0 0 0 363 1102Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="389" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="453,1087 441,1092 441,1083" style="fill:rgb(0,0,0)"/>
<path d="M430,1087L447,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,1102L502,1102L502,1072L453,1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="525,1087 513,1092 513,1083" style="fill:rgb(0,0,0)"/>
<path d="M502,1087L519,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1140A15 15 0 0 0 378 1125A15 15 0 0 0 363 1110A15 15 0 0 0 348 1125A15 15 0 0 0 363 1140Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="1125" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="401,1125 390,1129 390,1121" style="fill:rgb(0,0,0)"/>
<path d="M378,1125L396,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,1140L451,1140L451,1110L401,1110Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="1125" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="312,1057 301,1061 301,1053" style="fill:rgb(0,0,0)"/>
<path d="M289,1057L306,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1125 337,1129 337,1121" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1110 Q 327,1125 335,1125 L 342,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1087 337,1092 337,1083" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1072 Q 327,1087 335,1087 L 342,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1057 513,1061 513,1053" style="fill:rgb(0,0,0)"/>
<path d="M312,1057L519,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="620,1155 609,1160 609,1151" style="fill:rgb(0,0,0)"/>
<path d="M525,1057 L 546,1057 Q 561,1057 561,1072 L 561,1140 Q 561,1155 576,1155 L 599,1155 L 614,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="624" cy="1155" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1087 L 546,1087 Q 561,1087 561,1095 L 561,1102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1125 513,1129 513,1121" style="fill:rgb(0,0,0)"/>
<path d="M451,1125L519,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1125 L 546,1125 Q 561,1125 561,1133 L 561,1140"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1155 513,1160 513,1151" style="fill:rgb(0,0,0)"/>
<path d="M127,1042 L 127,1140 Q 127,1155 142,1155 L 504,1155 L 519,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1155L597,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/common-table-expression.html">common-table-expression:</a></b>
<button id='x9a6ebc20' onclick='hideorshow("x9a6ebc20","x0f946aad")'>show</button></p>
 <div id='x0f946aad' style='display:none;' class='imgcontainer'>
 <div style="max-width:638px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 638.525 167.4">
<circle cx="5" cy="29" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,29 20,33 20,24" style="fill:rgb(0,0,0)"/>
<path d="M9,29L26,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,44L122,44A15 15 0 0 0 137 29A15 15 0 0 0 122 14L47,14A15 15 0 0 0 32 29A15 15 0 0 0 47 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="160,29 149,33 149,24" style="fill:rgb(0,0,0)"/>
<path d="M137,29L155,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="196,29 185,33 185,24" style="fill:rgb(0,0,0)"/>
<path d="M160,29L191,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,44A15 15 0 0 0 227 29A15 15 0 0 0 211 14A15 15 0 0 0 196 29A15 15 0 0 0 211 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="250,29 238,33 238,24" style="fill:rgb(0,0,0)"/>
<path d="M227,29L244,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="286,29 274,33 274,24" style="fill:rgb(0,0,0)"/>
<path d="M250,29L280,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,44L395,44A15 15 0 0 0 410 29A15 15 0 0 0 395 14L301,14A15 15 0 0 0 286 29A15 15 0 0 0 301 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="446,29 434,33 434,24" style="fill:rgb(0,0,0)"/>
<path d="M410,29L440,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,44A15 15 0 0 0 476 29A15 15 0 0 0 461 14A15 15 0 0 0 446 29A15 15 0 0 0 461 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,29 499,33 499,24" style="fill:rgb(0,0,0)"/>
<path d="M476,29L505,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,165L51,165A15 15 0 0 0 66 150A15 15 0 0 0 51 135L47,135A15 15 0 0 0 32 150A15 15 0 0 0 47 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="49" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<path d="M127,135L147,135A15 15 0 0 0 162 119A15 15 0 0 0 147 104L127,104A15 15 0 0 0 112 119A15 15 0 0 0 127 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<path d="M219,135L337,135A15 15 0 0 0 352 119A15 15 0 0 0 337 104L219,104A15 15 0 0 0 204 119A15 15 0 0 0 219 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<path d="M162,119L204,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,165A15 15 0 0 0 425 150A15 15 0 0 0 410 135A15 15 0 0 0 395 150A15 15 0 0 0 410 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="410" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="448,150 437,154 437,145" style="fill:rgb(0,0,0)"/>
<path d="M425,150L442,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,165L552,165L552,135L448,135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="500" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="575,150 564,154 564,145" style="fill:rgb(0,0,0)"/>
<path d="M552,150L570,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M591,165A15 15 0 0 0 606 150A15 15 0 0 0 591 135A15 15 0 0 0 575 150A15 15 0 0 0 591 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="629,150 617,154 617,145" style="fill:rgb(0,0,0)"/>
<path d="M606,150L623,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="632" cy="150" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,82A15 15 0 0 0 363 66A15 15 0 0 0 348 51A15 15 0 0 0 333 66A15 15 0 0 0 348 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="363,66 374,62 374,71" style="fill:rgb(0,0,0)"/>
<path d="M410,29 L 417,29 Q 425,29 425,44 L 425,51 Q 425,66 410,66 L 384,66 L 369,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M333,66 L 278,66 Q 263,66 263,51 L 263,44 Q 263,29 270,29 L 278,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,93 78,89 78,97" style="fill:rgb(0,0,0)"/>
<path d="M511,29 L 516,29 Q 522,29 522,44 L 522,78 Q 522,93 507,93 L 87,93 L 72,93"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,150 20,154 20,145" style="fill:rgb(0,0,0)"/>
<path d="M66,93 L 30,93 Q 15,93 15,108 L 15,135 Q 15,150 20,150 L 26,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="85,150 73,154 73,145" style="fill:rgb(0,0,0)"/>
<path d="M66,150L79,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="112,119 101,124 101,115" style="fill:rgb(0,0,0)"/>
<path d="M85,150 L 89,150 Q 92,150 92,135 L 92,134 Q 92,119 99,119 L 106,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="204,119 192,124 192,115" style="fill:rgb(0,0,0)"/>
<path d="M66,150 L 147,150 Q 162,150 170,150 Q 177,150 177,135 L 177,134 Q 177,119 188,119 L 198,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,150 383,154 383,145" style="fill:rgb(0,0,0)"/>
<path d="M352,119 L 360,119 Q 367,119 367,134 L 367,135 Q 367,150 378,150 L 389,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150L395,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,6 336,10 336,2" style="fill:rgb(0,0,0)"/>
<path d="M160,29 L 168,29 Q 175,29 175,17 Q 175,6 190,6 L 327,6 L 342,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,6 L 473,6 Q 488,6 488,17 Q 488,29 495,29 L 503,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/compound-operator.html">compound-operator:</a></b>
<button id='x150a3913' onclick='hideorshow("x150a3913","x280ccd79")'>show</button></p>
 <div id='x280ccd79' style='display:none;' class='imgcontainer'>
 <div style="max-width:293px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 293.842 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L127,32A15 15 0 0 0 142 17A15 15 0 0 0 127 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,70L127,70A15 15 0 0 0 142 55L142,55A15 15 0 0 0 127 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,108L168,108A15 15 0 0 0 183 92A15 15 0 0 0 168 77L83,77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M83,145L135,145A15 15 0 0 0 150 130A15 15 0 0 0 135 115L83,115A15 15 0 0 0 68 130A15 15 0 0 0 83 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M142,55L159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70L195,70A15 15 0 0 0 210 55L210,55A15 15 0 0 0 195 39L180,39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="233,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M210,55L227,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,17 272,21 272,12" style="fill:rgb(0,0,0)"/>
<path d="M233,55 L 240,55 Q 248,55 248,40 L 248,32 Q 248,17 263,17 L 263,17 L 278,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="288" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M47,39 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,92 221,97 221,88" style="fill:rgb(0,0,0)"/>
<path d="M183,92L227,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,92 L 240,92 Q 248,92 248,77 L 248,54 L 248,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,130 56,135 56,126" style="fill:rgb(0,0,0)"/>
<path d="M47,77 L 47,115 Q 47,130 55,130 L 62,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,130 221,135 221,126" style="fill:rgb(0,0,0)"/>
<path d="M150,130L227,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,130 L 240,130 Q 248,130 248,115 L 248,92 L 248,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-clause.html">join-clause:</a></b>
<button id='xedbe2067' onclick='hideorshow("xedbe2067","xefa52faa")'>show</button></p>
 <div id='xefa52faa' style='display:none;' class='imgcontainer'>
 <div style="max-width:793px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 793.282 84.24">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L193,32L193,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="259,47 247,51 247,43" style="fill:rgb(0,0,0)"/>
<path d="M193,17 L 200,17 Q 208,17 208,32 L 208,32 Q 208,47 223,47 L 238,47 L 253,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,62L380,62L380,32L259,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-operator</text>
<polygon points="403,47 391,51 391,43" style="fill:rgb(0,0,0)"/>
<path d="M380,47L397,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,62L564,62L564,32L403,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="587,47 575,51 575,43" style="fill:rgb(0,0,0)"/>
<path d="M564,47L581,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M587,62L721,62L721,32L587,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="654" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-constraint</text>
<polygon points="783,17 772,21 772,12" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 742,47 Q 757,47 757,32 L 757,32 Q 757,17 767,17 L 778,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="787" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M193,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,17L776,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,77 495,73 495,82" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 728,47 Q 736,47 736,62 L 736,62 Q 736,77 721,77 L 504,77 L 489,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,77 L 247,77 Q 232,77 232,62 L 232,62 Q 232,47 246,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/join-constraint.html">join-constraint:</a></b>
<button id='x27566e63' onclick='hideorshow("x27566e63","x8f795682")'>show</button></p>
 <div id='x8f795682' style='display:none;' class='imgcontainer'>
 <div style="max-width:483px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 483.336 126.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L104,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 104 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="143,55 131,59 131,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L137,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,70A15 15 0 0 0 173 55L173,55A15 15 0 0 0 158 39A15 15 0 0 0 143 55L143,55A15 15 0 0 0 158 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="209,55 197,59 197,50" style="fill:rgb(0,0,0)"/>
<path d="M173,55L203,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M224,70L318,70A15 15 0 0 0 333 55L333,55A15 15 0 0 0 318 39L224,39A15 15 0 0 0 209 55L209,55A15 15 0 0 0 224 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="369,55 358,59 358,50" style="fill:rgb(0,0,0)"/>
<path d="M333,55L363,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,70A15 15 0 0 0 399 55L399,55A15 15 0 0 0 384 39A15 15 0 0 0 369 55L369,55A15 15 0 0 0 384 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="422,55 411,59 411,50" style="fill:rgb(0,0,0)"/>
<path d="M399,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="473,17 462,21 462,12" style="fill:rgb(0,0,0)"/>
<path d="M422,55 L 430,55 Q 437,55 437,40 L 437,32 Q 437,17 452,17 L 453,17 L 468,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="477" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,108A15 15 0 0 0 286 92A15 15 0 0 0 271 77A15 15 0 0 0 256 92A15 15 0 0 0 271 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="286,92 298,88 298,97" style="fill:rgb(0,0,0)"/>
<path d="M333,55 L 341,55 Q 348,55 348,70 L 348,77 Q 348,92 333,92 L 307,92 L 292,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,92 L 197,92 Q 182,92 182,77 L 182,70 Q 182,55 190,55 L 197,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L74,32A15 15 0 0 0 90 17A15 15 0 0 0 74 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="113,17 101,21 101,12" style="fill:rgb(0,0,0)"/>
<path d="M90,17L107,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M113,32L162,32L162,2L113,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="422,17 411,21 411,12" style="fill:rgb(0,0,0)"/>
<path d="M162,17L417,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,17L462,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="209,120 197,124 197,115" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,105 Q 24,120 39,120 L 188,120 L 203,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,120 L 422,120 Q 437,120 437,105 L 437,54 L 437,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-operator.html">join-operator:</a></b>
<button id='xe7fb3d85' onclick='hideorshow("xe7fb3d85","xd9a3a253")'>show</button></p>
 <div id='xd9a3a253' style='display:none;' class='imgcontainer'>
 <div style="max-width:620px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 620.333 255.312">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,71 39,76 39,67" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,56 Q 24,71 34,71 L 45,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,86L133,86A15 15 0 0 0 148 71A15 15 0 0 0 133 56L66,56A15 15 0 0 0 50 71A15 15 0 0 0 66 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="99" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NATURAL</text>
<polygon points="189,41 178,45 178,37" style="fill:rgb(0,0,0)"/>
<path d="M148,71 L 155,71 Q 163,71 163,56 L 163,56 Q 163,41 173,41 L 184,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,71 219,76 219,67" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,56 Q 204,71 215,71 L 225,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,86L273,86A15 15 0 0 0 288 71A15 15 0 0 0 273 56L246,56A15 15 0 0 0 231 71A15 15 0 0 0 246 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LEFT</text>
<polygon points="378,71 366,76 366,67" style="fill:rgb(0,0,0)"/>
<path d="M288,71L372,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,86L437,86A15 15 0 0 0 452 71A15 15 0 0 0 437 56L393,56A15 15 0 0 0 378 71A15 15 0 0 0 393 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OUTER</text>
<polygon points="475,71 463,76 463,67" style="fill:rgb(0,0,0)"/>
<path d="M452,71L469,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="516,41 505,45 505,37" style="fill:rgb(0,0,0)"/>
<path d="M475,71 L 482,71 Q 490,71 490,56 L 490,56 Q 490,41 500,41 L 511,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,56L554,56A15 15 0 0 0 569 41A15 15 0 0 0 554 26L532,26A15 15 0 0 0 516 41A15 15 0 0 0 532 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="543" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">JOIN</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M569,41 L 576,41 Q 584,41 584,29 Q 584,17 594,17 L 605,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="614" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,32A15 15 0 0 0 325 17A15 15 0 0 0 310 2A15 15 0 0 0 295 17A15 15 0 0 0 310 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="295,17 283,21 283,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L289,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M325,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="99,41 88,45 88,37" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,29 Q 24,41 39,41 L 78,41 L 93,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M99,41L178,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,41L505,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,41 366,45 366,37" style="fill:rgb(0,0,0)"/>
<path d="M336,71 L 344,71 Q 351,71 351,56 L 351,56 Q 351,41 362,41 L 372,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,109 219,113 219,105" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,94 Q 204,109 215,109 L 225,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,124L284,124A15 15 0 0 0 299 109A15 15 0 0 0 284 94L246,94A15 15 0 0 0 231 109A15 15 0 0 0 246 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RIGHT</text>
<polygon points="341,71 329,76 329,67" style="fill:rgb(0,0,0)"/>
<path d="M299,109 L 307,109 Q 314,109 314,94 L 314,86 Q 314,71 324,71 L 335,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,147 219,151 219,142" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,132 Q 204,147 215,147 L 225,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,162L274,162A15 15 0 0 0 289 147A15 15 0 0 0 274 132L246,132A15 15 0 0 0 231 147A15 15 0 0 0 246 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FULL</text>
<path d="M289,147 L 302,147 Q 314,147 314,132 L 314,109 L 314,94"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,192 219,196 219,188" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,177 Q 204,192 215,192 L 225,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,207L287,207A15 15 0 0 0 302 192A15 15 0 0 0 287 177L246,177A15 15 0 0 0 231 192A15 15 0 0 0 246 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="192" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INNER</text>
<polygon points="475,192 463,196 463,188" style="fill:rgb(0,0,0)"/>
<path d="M302,192L469,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,192 L 482,192 Q 490,192 490,185 L 490,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,238 219,242 219,233" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,223 Q 24,238 39,238 L 210,238 L 225,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,253L287,253A15 15 0 0 0 303 238A15 15 0 0 0 287 222L246,222A15 15 0 0 0 231 238A15 15 0 0 0 246 253Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="238" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CROSS</text>
<polygon points="475,238 463,242 463,233" style="fill:rgb(0,0,0)"/>
<path d="M303,238L469,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,238 L 482,238 Q 490,238 490,223 L 490,71 L 490,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x4419767f' onclick='hideorshow("x4419767f","xffd60f9a")'>show</button></p>
 <div id='xffd60f9a' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/result-column.html">result-column:</a></b>
<button id='x10ebd996' onclick='hideorshow("x10ebd996","x2ea645e9")'>show</button></p>
 <div id='x2ea645e9' style='display:none;' class='imgcontainer'>
 <div style="max-width:398px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 398.054 163.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L94,32L94,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="136,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M94,17 L 102,17 Q 109,17 109,32 L 109,40 Q 109,55 119,55 L 130,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M151,70L155,70A15 15 0 0 0 170 55L170,55A15 15 0 0 0 155 39L151,39A15 15 0 0 0 136 55L136,55A15 15 0 0 0 151 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="206,55 194,59 194,50" style="fill:rgb(0,0,0)"/>
<path d="M170,55L200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,70L309,70A15 15 0 0 0 324 55L324,55A15 15 0 0 0 309 39L221,39A15 15 0 0 0 206 55L206,55A15 15 0 0 0 221 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="347,55 335,59 335,50" style="fill:rgb(0,0,0)"/>
<path d="M324,55L341,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,17 377,21 377,12" style="fill:rgb(0,0,0)"/>
<path d="M347,55 L 354,55 Q 362,55 362,40 L 362,32 Q 362,17 372,17 L 382,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="392" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,85 141,89 141,81" style="fill:rgb(0,0,0)"/>
<path d="M109,39 L 109,70 Q 109,85 124,85 L 132,85 L 147,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,85 L 170,85 Q 185,85 185,70 L 185,70 Q 185,55 192,55 L 200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="241,17 230,21 230,12" style="fill:rgb(0,0,0)"/>
<path d="M94,17L235,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M241,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,108 39,112 39,103" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,93 Q 24,108 34,108 L 45,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,123A15 15 0 0 0 81 108A15 15 0 0 0 66 92A15 15 0 0 0 50 108A15 15 0 0 0 66 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="108" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,108 335,112 335,103" style="fill:rgb(0,0,0)"/>
<path d="M81,108L341,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,108 L 354,108 Q 362,108 362,93 L 362,54 L 362,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,145 39,150 39,141" style="fill:rgb(0,0,0)"/>
<path d="M24,92 L 24,130 Q 24,145 34,145 L 45,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,160L141,160A15 15 0 0 0 156 145A15 15 0 0 0 141 130L66,130A15 15 0 0 0 50 145A15 15 0 0 0 66 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="145" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="179,145 167,150 167,141" style="fill:rgb(0,0,0)"/>
<path d="M156,145L173,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M194,160A15 15 0 0 0 209 145A15 15 0 0 0 194 130A15 15 0 0 0 179 145A15 15 0 0 0 194 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="232,145 221,150 221,141" style="fill:rgb(0,0,0)"/>
<path d="M209,145L226,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,160A15 15 0 0 0 262 145A15 15 0 0 0 247 130A15 15 0 0 0 232 145A15 15 0 0 0 247 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,145 335,150 335,141" style="fill:rgb(0,0,0)"/>
<path d="M262,145L341,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,145 L 354,145 Q 362,145 362,130 L 362,107 L 362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/table-or-subquery.html">table-or-subquery:</a></b>
<button id='x805f7b26' onclick='hideorshow("x805f7b26","xc413f0bc")'>show</button></p>
 <div id='xc413f0bc' style='display:none;' class='imgcontainer'>
 <div style="max-width:720px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 720.778 457.704">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,74 39,78 39,70" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,59 Q 24,74 34,74 L 45,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,89L162,89A15 15 0 0 0 177 74L177,74A15 15 0 0 0 162 59L66,59A15 15 0 0 0 50 74L50,74A15 15 0 0 0 66 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="194,74 183,78 183,70" style="fill:rgb(0,0,0)"/>
<path d="M177,74L189,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,89A15 15 0 0 0 225 74L225,74A15 15 0 0 0 209 59A15 15 0 0 0 194 74L194,74A15 15 0 0 0 209 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="266,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M225,74 L 232,74 Q 240,74 240,59 L 240,51 Q 240,36 250,36 L 260,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,51L356,51A15 15 0 0 0 371 36A15 15 0 0 0 356 21L281,21A15 15 0 0 0 266 36A15 15 0 0 0 281 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="407,36 396,41 396,32" style="fill:rgb(0,0,0)"/>
<path d="M371,36L402,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,51L427,51A15 15 0 0 0 442 36A15 15 0 0 0 427 21L423,21A15 15 0 0 0 407 36A15 15 0 0 0 423 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="478,36 466,41 466,32" style="fill:rgb(0,0,0)"/>
<path d="M442,36L472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,51L561,51A15 15 0 0 0 577 36A15 15 0 0 0 561 21L493,21A15 15 0 0 0 478 36A15 15 0 0 0 493 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="527" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<path d="M9,36L255,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="422,6 411,10 411,2" style="fill:rgb(0,0,0)"/>
<path d="M371,36 L 379,36 Q 386,36 386,21 L 386,21 Q 386,6 401,6 L 402,6 L 417,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 442,6 Q 457,6 457,21 L 457,21 Q 457,36 464,36 L 472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 577,6 Q 592,6 592,21 L 592,21 Q 592,36 599,36 L 607,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,127L388,127A15 15 0 0 0 403 112A15 15 0 0 0 388 97L323,97A15 15 0 0 0 308 112A15 15 0 0 0 323 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="426,112 415,116 415,108" style="fill:rgb(0,0,0)"/>
<path d="M403,112L420,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,127L445,127A15 15 0 0 0 460 112A15 15 0 0 0 445 97L441,97A15 15 0 0 0 426 112A15 15 0 0 0 441 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="443" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="483,112 472,116 472,108" style="fill:rgb(0,0,0)"/>
<path d="M460,112L478,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,127L577,127A15 15 0 0 0 592 112A15 15 0 0 0 577 97L499,97A15 15 0 0 0 483 112A15 15 0 0 0 499 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="538" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M323,165L343,165A15 15 0 0 0 359 150A15 15 0 0 0 343 135L323,135A15 15 0 0 0 308 150A15 15 0 0 0 323 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="382,150 370,154 370,145" style="fill:rgb(0,0,0)"/>
<path d="M359,150L376,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,165L461,165A15 15 0 0 0 476 150A15 15 0 0 0 461 135L397,135A15 15 0 0 0 382 150A15 15 0 0 0 397 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="527,74 539,70 539,78" style="fill:rgb(0,0,0)"/>
<path d="M577,36 L 607,36 Q 622,36 622,51 L 622,59 Q 622,74 607,74 L 548,74 L 533,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,150 297,154 297,145" style="fill:rgb(0,0,0)"/>
<path d="M527,74 L 297,74 Q 282,74 282,89 L 282,135 Q 282,150 292,150 L 302,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,112 297,116 297,108" style="fill:rgb(0,0,0)"/>
<path d="M282,97 L 282,104 Q 282,112 292,112 L 302,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="266,213 255,217 255,209" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,198 Q 24,213 39,213 L 245,213 L 260,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,228L431,228A15 15 0 0 0 446 213A15 15 0 0 0 431 198L281,198A15 15 0 0 0 266 213A15 15 0 0 0 281 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function-name</text>
<polygon points="463,213 452,217 452,209" style="fill:rgb(0,0,0)"/>
<path d="M446,213L457,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,228A15 15 0 0 0 493 213A15 15 0 0 0 478 198A15 15 0 0 0 463 213A15 15 0 0 0 478 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="529,213 518,217 518,209" style="fill:rgb(0,0,0)"/>
<path d="M493,213L524,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M529,228L579,228L579,198L529,198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="615,213 603,217 603,209" style="fill:rgb(0,0,0)"/>
<path d="M579,213L609,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M630,228A15 15 0 0 0 645 213A15 15 0 0 0 630 198A15 15 0 0 0 615 213A15 15 0 0 0 630 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="630" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="675,187 679,198 671,198" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 660,213 Q 675,213 675,203 L 675,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M554,190A15 15 0 0 0 569 175A15 15 0 0 0 554 160A15 15 0 0 0 539 175A15 15 0 0 0 554 190Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="175" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="569,175 581,171 581,180" style="fill:rgb(0,0,0)"/>
<path d="M579,213 L 586,213 Q 594,213 594,198 L 594,190 Q 594,175 584,175 L 575,175"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,175 L 518,175 Q 503,175 503,190 L 503,198 Q 503,213 510,213 L 518,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,74 L 232,74 Q 240,74 240,89 L 240,198 Q 240,213 247,213 L 255,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,112 648,116 648,108" style="fill:rgb(0,0,0)"/>
<path d="M592,112L654,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,112 L 667,112 Q 675,112 675,104 L 675,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,150 648,154 648,145" style="fill:rgb(0,0,0)"/>
<path d="M476,150L654,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,150 L 667,150 Q 675,150 675,142 L 675,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M577,36L690,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,304L411,304A15 15 0 0 0 426 289A15 15 0 0 0 411 274L407,274A15 15 0 0 0 392 289A15 15 0 0 0 407 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="498,289 487,293 487,284" style="fill:rgb(0,0,0)"/>
<path d="M426,289L492,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M513,304L582,304A15 15 0 0 0 597 289A15 15 0 0 0 582 274L513,274A15 15 0 0 0 498 289A15 15 0 0 0 513 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="548" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<polygon points="660,289 648,293 648,284" style="fill:rgb(0,0,0)"/>
<path d="M597,289L654,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,289 L 667,289 Q 675,289 675,281 L 675,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="548,251 559,247 559,255" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 652,213 Q 660,213 660,228 L 660,236 Q 660,251 645,251 L 568,251 L 553,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M548,251 L 370,251 Q 355,251 355,266 L 355,274 Q 355,289 370,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,251 L 464,251 Q 457,251 457,266 L 457,274 Q 457,289 464,289 L 472,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,327 39,331 39,322" style="fill:rgb(0,0,0)"/>
<path d="M24,198 L 24,312 Q 24,327 34,327 L 45,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,342A15 15 0 0 0 81 327A15 15 0 0 0 66 311A15 15 0 0 0 50 327A15 15 0 0 0 66 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,327 92,331 92,322" style="fill:rgb(0,0,0)"/>
<path d="M81,327L98,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,342L208,342L208,311L104,311Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="327" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="231,327 219,331 219,322" style="fill:rgb(0,0,0)"/>
<path d="M208,327L225,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,342A15 15 0 0 0 261 327A15 15 0 0 0 246 311A15 15 0 0 0 231 327A15 15 0 0 0 246 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M261,327 L 269,327 Q 276,327 276,312 L 276,304 Q 276,289 291,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,327 648,331 648,322" style="fill:rgb(0,0,0)"/>
<path d="M261,327L654,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,327 L 667,327 Q 675,327 675,319 L 675,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,327 L 432,327 Q 439,327 439,312 L 439,304 Q 439,289 447,289 L 454,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,364 39,369 39,360" style="fill:rgb(0,0,0)"/>
<path d="M24,311 L 24,349 Q 24,364 34,364 L 45,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,379A15 15 0 0 0 81 364A15 15 0 0 0 65 349A15 15 0 0 0 50 364A15 15 0 0 0 65 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="135,364 123,369 123,360" style="fill:rgb(0,0,0)"/>
<path d="M81,364L129,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,379L296,379L296,349L135,349Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="364" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="350,364 338,369 338,360" style="fill:rgb(0,0,0)"/>
<path d="M296,364L344,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,379A15 15 0 0 0 380 364A15 15 0 0 0 365 349A15 15 0 0 0 350 364A15 15 0 0 0 365 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="660,364 648,369 648,360" style="fill:rgb(0,0,0)"/>
<path d="M380,364L654,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="711,36 699,41 699,32" style="fill:rgb(0,0,0)"/>
<path d="M660,364 L 667,364 Q 675,364 675,349 L 675,51 Q 675,36 690,36 L 690,36 L 705,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="715" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,417A15 15 0 0 0 230 402A15 15 0 0 0 215 387A15 15 0 0 0 200 402A15 15 0 0 0 215 417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="402" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="230,402 242,398 242,406" style="fill:rgb(0,0,0)"/>
<path d="M296,364 L 303,364 Q 311,364 311,379 L 311,387 Q 311,402 296,402 L 251,402 L 236,402"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,402 L 123,402 Q 108,402 108,387 L 108,379 Q 108,364 116,364 L 123,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="122,440 111,444 111,436" style="fill:rgb(0,0,0)"/>
<path d="M81,364 L 88,364 Q 96,364 96,379 L 96,425 Q 96,440 106,440 L 116,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M122,455L224,455L224,425L122,425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M224,440 L 308,440 Q 323,440 323,425 L 323,379 Q 323,364 331,364 L 338,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/window-defn.html">window-defn:</a></b>
<button id='x0af18b9b' onclick='hideorshow("x0af18b9b","x20fa97de")'>show</button></p>
 <div id='x20fa97de' style='display:none;' class='imgcontainer'>
 <div style="max-width:479px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 479.765 380.592">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,44 92,48 92,40" style="fill:rgb(0,0,0)"/>
<path d="M62,17 L 70,17 Q 77,17 77,30 Q 77,44 88,44 L 98,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,59L260,59A15 15 0 0 0 275 44L275,44A15 15 0 0 0 260 29L119,29A15 15 0 0 0 104 44L104,44A15 15 0 0 0 119 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M119,135L198,135A15 15 0 0 0 214 120A15 15 0 0 0 198 104L119,104A15 15 0 0 0 104 120A15 15 0 0 0 119 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="237,120 225,124 225,115" style="fill:rgb(0,0,0)"/>
<path d="M214,120L231,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M252,135L256,135A15 15 0 0 0 271 120A15 15 0 0 0 256 104L252,104A15 15 0 0 0 237 120A15 15 0 0 0 252 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="307,120 295,124 295,115" style="fill:rgb(0,0,0)"/>
<path d="M271,120L301,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,135L356,135L356,104L307,104Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M332,173A15 15 0 0 0 347 157A15 15 0 0 0 332 142A15 15 0 0 0 316 157A15 15 0 0 0 332 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="157" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="347,157 358,153 358,162" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,142 Q 371,157 362,157 L 352,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,157 L 295,157 Q 280,157 280,142 L 280,135 Q 280,120 288,120 L 295,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,17 178,21 178,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L184,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,82 201,77 201,86" style="fill:rgb(0,0,0)"/>
<path d="M190,17 L 298,17 Q 313,17 313,32 L 313,67 Q 313,82 298,82 L 210,82 L 195,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,120 92,124 92,115" style="fill:rgb(0,0,0)"/>
<path d="M190,82 L 77,82 Q 62,82 62,97 L 62,105 Q 62,120 77,120 L 83,120 L 98,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,44 287,48 287,40" style="fill:rgb(0,0,0)"/>
<path d="M275,44L293,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,44 L 306,44 Q 313,44 313,51 L 313,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,248L163,248A15 15 0 0 0 178 233A15 15 0 0 0 163 218L119,218A15 15 0 0 0 104 233A15 15 0 0 0 119 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="201,233 190,237 190,229" style="fill:rgb(0,0,0)"/>
<path d="M178,233L196,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,248L221,248A15 15 0 0 0 236 233A15 15 0 0 0 221 218L217,218A15 15 0 0 0 201 233A15 15 0 0 0 217 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="272,233 260,237 260,229" style="fill:rgb(0,0,0)"/>
<path d="M236,233L266,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,248L402,248L402,218L272,218Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M337,286A15 15 0 0 0 352 271A15 15 0 0 0 337 256A15 15 0 0 0 322 271A15 15 0 0 0 337 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="352,271 363,266 363,275" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,256 Q 417,271 402,271 L 373,271 L 358,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M322,271 L 260,271 Q 245,271 245,256 L 245,248 Q 245,233 253,233 L 260,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,195 201,191 201,200" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,180 Q 371,195 356,195 L 210,195 L 195,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,233 92,237 92,229" style="fill:rgb(0,0,0)"/>
<path d="M190,195 L 77,195 Q 62,195 62,210 L 62,218 Q 62,233 77,233 L 83,233 L 98,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,157 58,146 66,146" style="fill:rgb(0,0,0)"/>
<path d="M62,104L62,152"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,157L62,218"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,362L208,362L208,331L104,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="417,346 405,351 405,342" style="fill:rgb(0,0,0)"/>
<path d="M208,346L411,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,362A15 15 0 0 0 447 346A15 15 0 0 0 432 331A15 15 0 0 0 417 346A15 15 0 0 0 432 362Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="470,346 458,351 458,342" style="fill:rgb(0,0,0)"/>
<path d="M447,346L464,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="474" cy="346" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,309 201,304 201,313" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,294 Q 417,309 402,309 L 210,309 L 195,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,346 92,351 92,342" style="fill:rgb(0,0,0)"/>
<path d="M190,309 L 77,309 Q 62,309 62,324 L 62,331 Q 62,346 77,346 L 83,346 L 98,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,271 58,259 66,259" style="fill:rgb(0,0,0)"/>
<path d="M62,218L62,265"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,271L62,331"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,374 144,378 144,369" style="fill:rgb(0,0,0)"/>
<path d="M62,331 L 62,359 Q 62,374 77,374 L 135,374 L 150,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,346 266,351 266,342" style="fill:rgb(0,0,0)"/>
<path d="M156,374 L 233,374 Q 248,374 248,360 Q 248,346 260,346 L 272,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='xeb2788a9' onclick='hideorshow("xeb2788a9","x4ccb70a8")'>show</button></p>
 <div id='x4ccb70a8' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/type-name.html">type-name:</a></b>
<button id='x10f4f7ca' onclick='hideorshow("x10f4f7ca","xe5193b97")'>show</button></p>
 <div id='xe5193b97' style='display:none;' class='imgcontainer'>
 <div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.008 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L87,32A15 15 0 0 0 102 17A15 15 0 0 0 87 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="165,92 153,97 153,88" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,77 Q 138,92 149,92 L 159,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,108A15 15 0 0 0 195 92A15 15 0 0 0 180 77A15 15 0 0 0 165 92A15 15 0 0 0 180 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,92 201,97 201,88" style="fill:rgb(0,0,0)"/>
<path d="M195,92L207,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,108L350,108L350,77L212,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,92 356,97 356,88" style="fill:rgb(0,0,0)"/>
<path d="M350,92L362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,108A15 15 0 0 0 398 92A15 15 0 0 0 382 77A15 15 0 0 0 367 92A15 15 0 0 0 382 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="415,92 403,97 403,88" style="fill:rgb(0,0,0)"/>
<path d="M398,92L409,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,108L553,108L553,77L415,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="570,92 558,97 558,88" style="fill:rgb(0,0,0)"/>
<path d="M553,92L564,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,108A15 15 0 0 0 600 92A15 15 0 0 0 585 77A15 15 0 0 0 570 92A15 15 0 0 0 585 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="585" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="651,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M600,92 L 608,92 Q 615,92 615,77 L 615,32 Q 615,17 630,17 L 630,17 L 645,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,40 Q 138,55 149,55 L 159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70A15 15 0 0 0 195 55L195,55A15 15 0 0 0 180 39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,55 201,59 201,50" style="fill:rgb(0,0,0)"/>
<path d="M195,55L207,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,70L350,70L350,39L212,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,55 356,59 356,50" style="fill:rgb(0,0,0)"/>
<path d="M350,55L362,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,70A15 15 0 0 0 398 55L398,55A15 15 0 0 0 382 39A15 15 0 0 0 367 55L367,55A15 15 0 0 0 382 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="600,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M398,55L594,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M600,55 L 608,55 Q 615,55 615,47 L 615,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="74,47 85,43 85,51" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 110,17 Q 117,17 117,32 L 117,32 Q 117,47 102,47 L 94,47 L 79,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47 L 33,47 Q 18,47 18,32 L 18,32 Q 18,17 26,17 L 33,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="382,17 371,21 371,12" style="fill:rgb(0,0,0)"/>
<path d="M102,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,17L630,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='x23dd9566' onclick='hideorshow("x23dd9566","xa9b8af8f")'>show</button></p>
 <div id='xa9b8af8f' style='display:none;' class='imgcontainer'>
 <div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>


<a name="binaryops"></a>

<h1 id="operators_and_parse_affecting_attributes"><span>2. </span>Operators, and Parse-Affecting Attributes</h1>
<p>SQLite understands these operators, listed in precedence<sup>1</sup> order<br>
(top to bottom / highest to lowest):
</p><p></p>

  <style>
   td.optab { color: #2c2cf0; border: 2px solid black; padding: 4px; }
   th.optab { text-align: center; border: 2px solid black; padding: 4px; }
   table.optab { border-collapse: collapse; margin-left: 50px }
   small.optab { color: #101010;  }
  </style>


<table class="optab" width="50%" border="1" border-collapse="collapse" line-height="1.2">
  <tr align="center">
    <th class="optab" text-align="center"><b>Operators&nbsp;<sup>2</sup></b></th>
  </tr>
  <tr align="center">
    <td class="optab">~&nbsp;<small class="optab">&lsqb;expr&rsqb;</small>&nbsp;&nbsp;&nbsp;&nbsp;+&nbsp;<small class="optab">&lsqb;expr&rsqb;</small>&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;<small class="optab">&lsqb;expr&rsqb;</small></td>
  </tr>
  <tr align="center">
    <td class="optab"><small class="optab">&lsqb;expr&rsqb;</small>&nbsp;COLLATE&nbsp;&lpar;collation-name&rpar;&nbsp;<sup>3</sup></td>
  </tr>
  <tr align="center">
    <td class="optab">||&nbsp;&nbsp;&nbsp;-&gt;&nbsp;&nbsp;&nbsp;-&gt;&gt;</td>
  </tr>
  <tr align="center">
    <td class="optab">*&nbsp;&nbsp;&nbsp;/&nbsp;&nbsp;&nbsp;%</td>
  </tr>
  <tr align="center">
    <td class="optab">+&nbsp;&nbsp;&nbsp;-</td>
  </tr>
  <tr align="center">
    <td class="optab">&amp;&ensp;&nbsp;|&nbsp;&nbsp;&nbsp;&lt;&lt;&ensp;&nbsp;&gt;&gt;</td>
  </tr>
  <tr align="center">
    <td class="optab"><small class="optab">&lsqb;expr&rsqb;</small>&nbsp;ESCAPE&nbsp;&lsqb;escape-character-expr&rsqb;&nbsp;<sup>4</sup></td>
  </tr>
  <tr align="center">
    <td class="optab">&lt;&nbsp;&nbsp;&gt;&nbsp;&nbsp;&lt;=&nbsp;&nbsp;&gt;=</td>
  </tr>
  <tr align="center">
    <td class="optab">=&nbsp;&nbsp;==&nbsp;&nbsp;&lt;&gt;&nbsp;&nbsp;!=&nbsp;&nbsp;IS&nbsp;&nbsp;&nbsp;IS&nbsp;NOT<br>
      IS&nbsp;DISTINCT&nbsp;FROM&nbsp;&nbsp;&nbsp;IS&nbsp;NOT&nbsp;DISTINCT&nbsp;FROM<br>
      <small class="optab">&lsqb;expr&rsqb;</small>&nbsp;BETWEEN<sup>5</sup>&nbsp;<small class="optab">&lsqb;expr&rsqb;</small>&nbsp;AND&nbsp;<small class="optab">&lsqb;expr&rsqb;</small><sup>&ensp;</sup><br>
      IN<sup>5</sup>&nbsp;&nbsp;MATCH<sup>5</sup>&nbsp;&nbsp;LIKE<sup>5</sup>&nbsp;&nbsp;REGEXP<sup>5</sup>&nbsp;&nbsp;GLOB<sup>5</sup><br>
      <small class="optab">&lsqb;expr&rsqb;</small>&nbsp;ISNULL&nbsp;&nbsp;<small class="optab">&lsqb;expr&rsqb;</small>&nbsp;NOTNULL&nbsp;&nbsp;&nbsp;<small class="optab">&lsqb;expr&rsqb;</small>&nbsp;NOT&nbsp;NULL
    </td>
  </tr>
  <tr align="center">
    <td class="optab">NOT&nbsp;<small class="optab">&lsqb;expr&rsqb;</small></td>
  </tr>
  <tr align="center">
    <td class="optab">AND</td>
  </tr>
  <tr align="center">
    <td class="optab">OR</td>
  </tr>
</table>
<p>
</p><ol>
<li> Operators shown within the same table cell share precedence.<br>
</li><li> "<small>&lsqb;expr&rsqb;</small>" denotes operand locations for non-binary operators.<br>
 &nbsp;&nbsp;Operators with no "&lsqb;expr&rsqb;" adjunct are binary and left-associative. <br>
</li><li> The COLLATE clause (with its collation-name) acts as a single postfix operator.<br>
</li><li> The ESCAPE clause (with its escape character) acts as a single postfix operator.<br>
 &nbsp;&nbsp;It can only bind to a preceding &lsqb;expr&rsqb; LIKE &lsqb;expr&rsqb; expression.<br>
</li><li> Each keyword in (BETWEEN IN GLOB LIKE MATCH REGEXP) may be prefixed<br>
 &nbsp;&nbsp;by NOT, retaining the bare operator's precedence and associativity.
</li></ol>


<a name="collateop"></a>

<p>The COLLATE operator is a unary postfix
operator that assigns a <a href="datatype3.html#collation">collating sequence</a> to an expression.
The collating sequence set by the COLLATE operator overrides the
collating sequence determined by the COLLATE clause in a table
<a href="lang_createtable.html#tablecoldef">column definition</a>.
See the <a href="datatype3.html#collation">detailed discussion on collating sequences</a>
in the <a href="datatype3.html">Datatype In SQLite3</a> document for additional information.
</p>



<p>The unary operator <font color="#2c2cf0"><big>+</big></font> is a no-op.  It can be applied
to strings, numbers, blobs or NULL and it always returns a result
with the same value as the operand.</p>

<p>Note that there are two variations of the equals and not equals
operators.  Equals can be either

<font color="#2c2cf0"><big>=</big></font> or <font color="#2c2cf0"><big>==</big></font>.
The not-equal operator can be either
<font color="#2c2cf0"><big>!=</big></font> or <font color="#2c2cf0"><big>&lt;&gt;</big></font>.
The <font color="#2c2cf0"><big>||</big></font> operator is "concatenate" - it joins together
the two strings of its operands.
The <font color="#2c2cf0"><big>-&gt;</big></font> and <font color="#2c2cf0"><big>-&gt;&gt;</big></font> operators are "extract";
they extract the RHS component from the LHS.
For an example, see
<a href="json1.html#jptr">JSON subcomponent extraction</a>.</p>

<p>

The <font color="#2c2cf0"><big>%</big></font> operator <a href="lang_expr.html#castexpr">casts</a> both of its operands to type
INTEGER and then computes the remainder after dividing the left integer
by the right integer. The other arithmetic operators perform integer
arithmetic if both operands are integers and no overflow would result,
or floating point arithmetic, per IEEE Standard 754, if either operand
is a real value or integer arithmetic would produce an overflow.
Integer divide yields an integer result, truncated toward zero.
</p>

<p>The result of any binary operator is either a numeric value or
NULL, except for the <font color="#2c2cf0"><big>||</big></font> concatenation operator,
and the <font color="#2c2cf0"><big>-&gt;</big></font> and <font color="#2c2cf0"><big>-&gt;&gt;</big></font> extract operators
which evaluate to either NULL or a text value.</p>

<p>All operators generally evaluate to NULL when any operand is NULL,
with specific exceptions as stated below. This is in accordance with
the SQL92 standard.</p>

<p> When paired with NULL:<br>
&nbsp;&nbsp;<font color="#2c2cf0"><big>AND</big></font> evaluates to 0 (false) when
the other operand is false; and<br>
&nbsp;&nbsp;<font color="#2c2cf0"><big>OR</big></font> evaluates to 1 (true)
when the other operand is true.
</p>


<a name="isisnot"></a>


<p>The <font color="#2c2cf0"><big>IS</big></font> and <font color="#2c2cf0"><big>IS NOT</big></font> operators work
like <font color="#2c2cf0"><big>=</big></font> and <font color="#2c2cf0"><big>!=</big></font> except when one or both of the
operands are NULL. In this case, if both operands are NULL, then the
IS operator evaluates to 1 (true) and the IS NOT operator evaluates
to 0 (false). If one operand is NULL and the other is not, then the
IS operator evaluates to 0 (false) and the IS NOT operator is 1 (true).
It is not possible for an IS or IS NOT expression to evaluate to NULL.

<a name="isdf"></a>


<p>
The <font color="#2c2cf0"><big>IS NOT DISTINCT FROM</big></font> operator is an alternative spelling
for the <font color="#2c2cf0"><big>IS</big></font> operator.
Likewise, the <font color="#2c2cf0"><big>IS DISTINCT FROM</big></font> operator means the same thing
as <font color="#2c2cf0"><big>IS NOT</big></font>.  Standard SQL does not support the compact IS and IS NOT
notation.  Those compact forms are an SQLite extension.  You have to use
the prolix and much less readable IS NOT DISTINCT FROM and
IS DISTINCT FROM operators on other SQL database engines.

<a name="litvalue"></a>

</p><h1 id="literal_values_constants_"><span>3. </span>Literal Values (Constants)</h1>
<p>
A literal value represents a constant.
Literal values may be integers, floating point numbers, strings,
BLOBs, or NULLs.
</p><p>
The syntax for integer and floating point literals (collectively
"numeric literals") is shown by the following diagram:</p>

<p><b><a href="syntax/numeric-literal.html">numeric-literal:</a></b></p><div class='imgcontainer'>
 <div style="max-width:765px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 765.562 214.056">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="63,36 51,41 51,32" style="fill:rgb(0,0,0)"/>
<path d="M9,36L57,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M78,51L98,51A15 15 0 0 0 113 36A15 15 0 0 0 98 21L78,21A15 15 0 0 0 63 36A15 15 0 0 0 78 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="88" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">digit</text>
<polygon points="88,6 99,2 99,10" style="fill:rgb(0,0,0)"/>
<path d="M113,36 L 121,36 Q 128,36 128,21 L 128,21 Q 128,6 113,6 L 109,6 L 94,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M88,6 L 51,6 Q 36,6 36,21 L 36,21 Q 36,36 44,36 L 51,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="176,66 164,71 164,62" style="fill:rgb(0,0,0)"/>
<path d="M113,36 L 134,36 Q 149,36 149,51 L 149,51 Q 149,66 159,66 L 170,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M191,82A15 15 0 0 0 206 66L206,66A15 15 0 0 0 191 51A15 15 0 0 0 176 66L176,66A15 15 0 0 0 191 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="267,66 255,71 255,62" style="fill:rgb(0,0,0)"/>
<path d="M206,66L261,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,66 328,71 328,62" style="fill:rgb(0,0,0)"/>
<path d="M267,66L334,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="381,36 370,41 370,32" style="fill:rgb(0,0,0)"/>
<path d="M340,66 L 347,66 Q 355,66 355,51 L 355,51 Q 355,36 365,36 L 375,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,74 411,78 411,70" style="fill:rgb(0,0,0)"/>
<path d="M381,36 L 389,36 Q 396,36 396,51 L 396,59 Q 396,74 406,74 L 417,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,89A15 15 0 0 0 453 74L453,74A15 15 0 0 0 438 59A15 15 0 0 0 423 74L423,74A15 15 0 0 0 438 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">E</text>
<polygon points="494,74 483,78 483,70" style="fill:rgb(0,0,0)"/>
<path d="M453,74L489,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,112 411,116 411,108" style="fill:rgb(0,0,0)"/>
<path d="M381,36 L 389,36 Q 396,36 396,51 L 396,97 Q 396,112 406,112 L 417,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,127A15 15 0 0 0 453 112A15 15 0 0 0 438 97A15 15 0 0 0 423 112A15 15 0 0 0 438 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="112" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">e</text>
<path d="M453,112 L 460,112 Q 468,112 468,97 L 468,89 Q 468,74 475,74 L 483,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,112L277,112A15 15 0 0 0 292 97L292,97A15 15 0 0 0 277 82L257,82A15 15 0 0 0 242 97L242,97A15 15 0 0 0 257 112Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="97" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">digit</text>
<polygon points="292,97 304,92 304,101" style="fill:rgb(0,0,0)"/>
<path d="M267,66 L 304,66 Q 319,66 319,81 L 319,82 Q 319,97 308,97 L 298,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M242,97 L 234,97 Q 227,97 227,82 L 227,81 Q 227,66 234,66 L 242,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M113,36L261,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,36L370,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,135 39,139 39,130" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,120 Q 24,135 34,135 L 45,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150A15 15 0 0 0 81 135A15 15 0 0 0 66 119A15 15 0 0 0 50 135A15 15 0 0 0 66 150Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="135" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="117,135 105,139 105,130" style="fill:rgb(0,0,0)"/>
<path d="M81,135L111,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,150L152,150A15 15 0 0 0 167 135A15 15 0 0 0 152 119L132,119A15 15 0 0 0 117 135A15 15 0 0 0 132 150Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="142" y="135" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">digit</text>
<polygon points="340,135 328,139 328,130" style="fill:rgb(0,0,0)"/>
<path d="M167,135L334,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,135 L 347,135 Q 355,135 355,120 L 355,66 L 355,51"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="142,104 153,100 153,109" style="fill:rgb(0,0,0)"/>
<path d="M167,135 L 174,135 Q 182,135 182,120 L 182,119 Q 182,104 167,104 L 162,104 L 147,104"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,104 L 105,104 Q 90,104 90,119 L 90,120 Q 90,135 98,135 L 105,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="536,142 524,146 524,138" style="fill:rgb(0,0,0)"/>
<path d="M494,74 L 502,74 Q 509,74 509,89 L 509,127 Q 509,142 520,142 L 530,142"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M551,157A15 15 0 0 0 566 142A15 15 0 0 0 551 127A15 15 0 0 0 536 142A15 15 0 0 0 551 157Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="551" y="142" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<polygon points="628,74 616,78 616,70" style="fill:rgb(0,0,0)"/>
<path d="M566,142 L 574,142 Q 581,142 581,127 L 581,89 Q 581,74 596,74 L 607,74 L 622,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M643,89L663,89A15 15 0 0 0 678 74L678,74A15 15 0 0 0 663 59L643,59A15 15 0 0 0 628 74L628,74A15 15 0 0 0 643 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="653" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">digit</text>
<polygon points="714,74 703,78 703,70" style="fill:rgb(0,0,0)"/>
<path d="M678,74L708,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="756,36 744,41 744,32" style="fill:rgb(0,0,0)"/>
<path d="M714,74 L 722,74 Q 729,74 729,59 L 729,51 Q 729,36 740,36 L 750,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="759" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="536,104 524,109 524,100" style="fill:rgb(0,0,0)"/>
<path d="M494,74 L 502,74 Q 509,74 509,89 L 509,89 Q 509,104 520,104 L 530,104"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M551,119A15 15 0 0 0 566 104A15 15 0 0 0 551 89A15 15 0 0 0 536 104A15 15 0 0 0 551 119Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="551" y="104" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<path d="M566,104 L 574,104 Q 581,104 581,97 L 581,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="551,36 540,41 540,32" style="fill:rgb(0,0,0)"/>
<path d="M381,36L545,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M551,36L744,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="551,74 540,78 540,70" style="fill:rgb(0,0,0)"/>
<path d="M494,74L545,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M551,74L616,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="653,50 665,46 665,54" style="fill:rgb(0,0,0)"/>
<path d="M678,74 L 686,74 Q 693,74 693,62 Q 693,50 678,50 L 674,50 L 659,50"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M653,50 L 616,50 Q 601,50 601,62 Q 601,74 609,74 L 616,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,180 39,184 39,176" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,165 Q 24,180 34,180 L 45,180"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,195L69,195A15 15 0 0 0 84 180A15 15 0 0 0 69 165L66,165A15 15 0 0 0 50 180A15 15 0 0 0 66 195Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="67" y="180" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">0x</text>
<polygon points="120,180 108,184 108,176" style="fill:rgb(0,0,0)"/>
<path d="M84,180L114,180"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,195L185,195A15 15 0 0 0 200 180A15 15 0 0 0 185 165L135,165A15 15 0 0 0 120 180A15 15 0 0 0 135 195Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="160" y="180" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">hexdigit</text>
<polygon points="714,180 703,184 703,176" style="fill:rgb(0,0,0)"/>
<path d="M200,180L708,180"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M714,180 L 722,180 Q 729,180 729,165 L 729,74 L 729,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="160,207 171,203 171,211" style="fill:rgb(0,0,0)"/>
<path d="M200,180 L 207,180 Q 215,180 215,193 Q 215,207 200,207 L 180,207 L 165,207"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M160,207 L 108,207 Q 93,207 93,193 Q 93,180 101,180 L 108,180"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
 </div>


<p>
If a numeric literal has a decimal point or an exponentiation
clause or if it is less than -9223372036854775808 or
greater than 9223372036854775807, then it is a floating point literal.
Otherwise is it is an  integer literal.
The "E" character that begins the exponentiation
clause of a floating point literal can be either upper or lower case.
The "." character is always used
as the decimal point even if the locale setting specifies "," for
this role - the use of "," for the decimal point would result in
syntactic ambiguity.

<a name="hexint"></a>

</p><p>Hexadecimal integer literals follow the C-language notation of
"0x" or "0X" followed by hexadecimal digits.
For example, 0x1234 means the same as 4660
and 0x8000000000000000 means the same as -9223372036854775808.
 Hexadecimal integer literals are interpreted as 64-bit
two's-complement integers and are thus limited
to sixteen significant digits of precision.
Support for hexadecimal integers was added to SQLite
version 3.8.6 (2014-08-15).
For backwards compatibility, the "0x" hexadecimal integer
notation is only understood by the SQL language parser, not by the
type conversions routines.
String variables that
contain text formatted like hexadecimal integers are not
interpreted as hexadecimal integers when coercing the string value
into an integer due to a <a href="lang_expr.html#castexpr">CAST expression</a> or for a <a href="datatype3.html#affinity">column affinity</a>
transformation or prior to performing a numeric operation or for
any other run-time conversions.  When coercing a
string value in the format of a hexadecimal integer into an integer
value, the conversion process stops when the 'x' character is seen
so the resulting integer value is always zero.
SQLite only understands the hexadecimal integer notation when it
appears in the SQL statement text, not when it appears as
part of the content of the database.

</p><p> A string constant is formed by enclosing the
string in single quotes (').  A single quote within the string can
be encoded by putting two single quotes in a row - as in Pascal.
C-style escapes using the backslash character are not supported because
they are not standard SQL.

</p><p> BLOB literals are string literals containing hexadecimal data and
preceded by a single "x" or "X" character.  Example: X'53514C697465'

</p><p>
A literal value can also be the token "NULL".
</p>

<a name="varparam"></a>

<h1 id="parameters"><span>4. </span>Parameters</h1>
<p>
A "variable" or "parameter" token
specifies a placeholder in the expression for a
value that is filled in at runtime using the
<a href="c3ref/bind_blob.html">sqlite3_bind()</a> family of C/C++ interfaces.
Parameters can take several forms:
</p>

<blockquote>
<table>
<tr>
<td align="right" valign="top"><b>?</b><i>NNN</i></td><td width="20"></td>
<td>A question mark followed by a number <i>NNN</i> holds a spot for the
NNN-th parameter.  NNN must be between 1 and <a href="limits.html#max_variable_number">SQLITE_MAX_VARIABLE_NUMBER</a>.
</td>
</tr>
<tr>
<td align="right" valign="top"><b>?</b></td><td width="20"></td>
<td>A question mark that is not followed by a number creates a parameter
with a number one greater than the largest parameter number already assigned.
If this means the parameter number is greater than
<a href="limits.html#max_variable_number">SQLITE_MAX_VARIABLE_NUMBER</a>, it is an error.
This parameter format is provided for compatibility with other database
engines.  But because it is easy to miscount the question marks, the
use of this parameter format is discouraged.  Programmers are encouraged
to use one of the symbolic formats below or the ?NNN format above instead.
</td>
</tr>
<tr>
<td align="right" valign="top"><b>:</b><i>AAAA</i></td><td width="20"></td>
<td>A colon followed by an identifier name holds a spot for a
<a href="c3ref/bind_parameter_name.html">named parameter</a> with the name :AAAA.
Named parameters are also numbered. The number assigned is one greater than
the largest parameter number already assigned. If this means the parameter
would be assigned a number greater than <a href="limits.html#max_variable_number">SQLITE_MAX_VARIABLE_NUMBER</a>, it is
an error. To avoid confusion, it is best to avoid mixing named and numbered
parameters.</td>
</tr>
<tr>
<td align="right" valign="top"><b>@</b><i>AAAA</i></td><td width="20"></td>
<td>An "at" sign works exactly like a colon, except that the name of
the parameter created is @AAAA.</td>
</tr>
<tr>
<td align="right" valign="top"><b>$</b><i>AAAA</i></td><td width="20"></td>
<td>A dollar-sign followed by an identifier name also holds a spot for a named
parameter with the name $AAAA.  The identifier name in this case can include
one or more occurrences of "::" and a suffix enclosed in "(...)" containing
any text at all.  This syntax is the form of a variable name in the
<a href="http://www.tcl-lang.org/">Tcl programming language</a>.  The presence
of this syntax results from the fact that SQLite is really a
<a href="tclsqlite.html">Tcl extension</a> that has escaped into the wild.</td>
</tr>
</table>
</blockquote>

<p>Parameters that are not assigned values using
<a href="c3ref/bind_blob.html">sqlite3_bind()</a> are treated
as NULL.  The <a href="c3ref/bind_parameter_index.html">sqlite3_bind_parameter_index()</a> interface can be used
to translate a symbolic parameter name into its equivalent numeric index.</p>

<p>The maximum parameter number is set at compile-time by
the <a href="limits.html#max_variable_number">SQLITE_MAX_VARIABLE_NUMBER</a> macro.  An individual <a href="c3ref/sqlite3.html">database connection</a>
D can reduce its maximum parameter number below the compile-time maximum
using the <a href="c3ref/limit.html">sqlite3_limit</a>(D, <a href="c3ref/c_limit_attached.html#sqlitelimitvariablenumber">SQLITE_LIMIT_VARIABLE_NUMBER</a>,...) interface.
</p>

<a name="like"></a>

<h1 id="the_like_glob_regexp_match_and_extract_operators"><span>5. </span>The LIKE, GLOB, REGEXP, MATCH, and extract operators</h1>
<p>The LIKE operator does a pattern matching comparison. The operand
to the right of the LIKE operator contains the pattern and the left hand
operand contains the string to match against the pattern.

A percent symbol ("%") in the LIKE pattern matches any
sequence of zero or more characters in the string.  An underscore
("_") in the LIKE pattern matches any single character in the
string.  Any other character matches itself or its lower/upper case
equivalent (i.e. case-insensitive matching).

<u>Important Note:</u> SQLite only
understands upper/lower case for ASCII characters by default.  The
LIKE operator is case sensitive by default for unicode characters that are
beyond the ASCII range.  For example,
the expression <b>'a'&nbsp;LIKE&nbsp;'A'</b>
is TRUE but <b>'&aelig;'&nbsp;LIKE&nbsp;'&AElig;'</b> is FALSE.
The ICU extension to SQLite includes an enhanced version of the
LIKE operator that does case folding across all unicode characters.</p>

<p>If the optional ESCAPE clause is present, then the expression
following the ESCAPE keyword must evaluate to a string consisting of
a single character. This character may be used in the LIKE pattern
to include literal percent or underscore characters. The escape
character followed by a percent symbol (%), underscore (_), or a second
instance of the escape character itself matches a
literal percent symbol, underscore, or a single escape character,
respectively.

</p><p>The infix LIKE operator is implemented by calling the
application-defined SQL functions <a href="lang_corefunc.html#like">like(<i>Y</i>,<i>X</i>)</a> or
<a href="lang_corefunc.html#like">like(<i>Y</i>,<i>X</i>,<i>Z</i>)</a>.</p>

<p>The LIKE operator can be made case sensitive using the
<a href="pragma.html#pragma_case_sensitive_like">case_sensitive_like pragma</a>.</p>

<a name="glob"></a>

<p>The GLOB operator is similar to LIKE but uses the Unix
file globbing syntax for its wildcards.  Also, GLOB is case
sensitive, unlike LIKE.  Both GLOB and LIKE may be preceded by
the NOT keyword to invert the sense of the test.  The infix GLOB
operator is implemented by calling the function
<a href="lang_corefunc.html#glob">glob(<i>Y</i>,<i>X</i>)</a> and can be modified by overriding
that function.</p>

<a name="regexp"></a>

<p>The REGEXP operator is a special syntax for the regexp()
user function.  No regexp() user function is defined by default
and so use of the REGEXP operator will normally result in an
error message.  If an <a href="appfunc.html">application-defined SQL function</a> named "regexp"
is added at run-time, then the "<i>X</i> REGEXP <i>Y</i>" operator will
be implemented as a call to "regexp(<i>Y</i>,<i>X</i>)".</p>

<a name="match"></a>

<p>The MATCH operator is a special syntax for the match()
application-defined function.  The default match() function implementation
raises an exception and is not really useful for anything.
But extensions can override the match() function with more
helpful logic.</p>

<a name="extract"></a>

<p>The extract operators act as a special syntax for functions
"-&gt;"() and "-&gt;&gt;"(). Default implementations for these functions
perform <a href="json1.html#jptr">JSON subcomponent extraction</a>,
but extensions can override them for other purposes.</p>

<a name="between"></a>

<h1 id="the_between_operator"><span>6. </span>The BETWEEN operator</h1>
<p>The BETWEEN operator is logically equivalent to a pair of comparisons.
"<i>x</i> <b>BETWEEN</b> <i>y</i> <b>AND</b> <i>z</i>" is
equivalent to
"<i>x</i><b>&gt;=</b><i>y</i> <b>AND</b> <i>x</i><b>&lt;=</b><i>z</i>" except
that with BETWEEN, the <i>x</i> expression is only evaluated once.

<a name="case"></a>

</p><h1 id="the_case_expression"><span>7. </span>The CASE expression</h1>
<p>A CASE expression serves a role similar to IF-THEN-ELSE in other
programming languages.

</p><p>The optional expression that occurs in between the CASE keyword and the
first WHEN keyword is called the "base" expression. There are two
fundamental forms
of the CASE expression: those with a base expression and those without.

</p><p>In a CASE without a base expression, each WHEN expression is evaluated
and the result treated as a boolean, starting with the leftmost and continuing
to the right. The result of the CASE expression is the evaluation of the THEN
expression that corresponds to the first WHEN expression that evaluates to
true. Or, if none of the WHEN expressions evaluate to true, the result of
evaluating the ELSE expression, if any. If there is no ELSE expression and
none of the WHEN expressions are true, then the overall result is NULL.

</p><p>A NULL result is considered untrue when evaluating WHEN terms.

</p><p>In a CASE with a base expression, the base expression is evaluated just
once and the result is compared against the evaluation of each WHEN
expression from left to right. The result of the CASE expression is the
evaluation of the THEN expression that corresponds to the first WHEN
expression for which the comparison is true. Or, if none of the WHEN
expressions evaluate to a value equal to the base expression, the result
of evaluating the ELSE expression, if any. If there is no ELSE expression and
none of the WHEN expressions produce a result equal to the base expression,
the overall result is NULL.

</p><p>When comparing a base expression against a WHEN expression, the same
collating sequence, affinity, and NULL-handling rules apply as if the
base expression and WHEN expression are respectively the left- and
right-hand operands of an <big><b>=</b></big> operator.</p>

<p>If the base
expression is NULL then the result of the CASE is always the result
of evaluating the ELSE expression if it exists, or NULL if it does not.

</p><p>Both forms of the CASE expression use lazy, or short-circuit,
evaluation.

</p><p>The only difference between the following two CASE expressions is that
the <i>x</i> expression is evaluated exactly once in the first example but
might be evaluated multiple times in the second:

</p><ul><pre>
<li>CASE x WHEN w1 THEN r1 WHEN w2 THEN r2 ELSE r3 END
</li><li>CASE WHEN x=w1 THEN r1 WHEN x=w2 THEN r2 ELSE r3 END
</li></pre></ul>

<p>The built-in <a href="lang_corefunc.html#iif">iif(x,y,z) SQL function</a> is logically
equivalent to "CASE WHEN x THEN y ELSE z END".  The iif() function
is found in SQL Server and is included in SQLite for compatibility.
Some developers prefer the iif() function because it is more
concise.


<a name="in_op"></a>

</p><h1 id="the_in_and_not_in_operators"><span>8. </span>The IN and NOT IN operators</h1>
<p>The IN and NOT IN operators take an expression on the
left and a list of values or a subquery on the right.
When the right operand of an IN or NOT IN operator is a subquery, the
subquery must have the same number of columns as there are columns in
the <a href="rowvalue.html">row value</a> of the left operand.  The subquery on the
right of an IN or NOT IN operator must be a scalar subquery if the left
expression is not a <a href="rowvalue.html">row value</a> expression.
If the right operand of an IN or NOT IN operator is a list of values,
each of those values must be scalars and the left expression must also
be a scalar.
The right-hand side of an IN or NOT IN operator can be a
table <i>name</i> or <a href="vtab.html#tabfunc2">table-valued function</a> <i>name</i> in which
case the right-hand side is understood to be subquery of
the form "(SELECT * FROM <i>name</i>)".
When the right operand is an empty set, the result of IN is false and the
result of NOT IN is true, regardless of the left operand and even if the
left operand is NULL.
</p><p>The result of an IN or NOT IN operator is determined by the following
matrix:

</p><blockquote>
<table border="1">
<tr>
<th>Left operand <br>is NULL
</th><th>Right operand <br>contains NULL
</th><th>Right operand <br>is an empty set
</th><th>Left operand found <br>within right operand
</th><th>Result of <br>IN operator
</th><th>Result of <br>NOT IN operator
</th></tr><tr>
<td align="center">no
</td><td align="center">no
</td><td align="center">no
</td><td align="center">no
</td><td align="center">false
</td><td align="center">true
</td></tr><tr>
<td align="center">does not matter
</td><td align="center">no
</td><td align="center">yes
</td><td align="center">no
</td><td align="center">false
</td><td align="center">true
</td></tr><tr>
<td align="center">no
</td><td align="center">does not matter
</td><td align="center">no
</td><td align="center">yes
</td><td align="center">true
</td><td align="center">false
</td></tr><tr>
<td align="center">no
</td><td align="center">yes
</td><td align="center">no
</td><td align="center">no
</td><td align="center">NULL
</td><td align="center">NULL
</td></tr><tr>
<td align="center">yes
</td><td align="center">does not matter
</td><td align="center">no
</td><td align="center">does not matter
</td><td align="center">NULL
</td><td align="center">NULL
</td></tr></table>
</blockquote>

<p>Note that SQLite allows the parenthesized list of scalar values on
the right-hand side of an IN or NOT IN operator to be an empty list but
most other SQL database engines and the SQL92 standard require
the list to contain at least one element.</p>

<h1 id="table_column_names"><span>9. </span>Table Column Names</h1>

<p>A column name can be any of the names defined in the <a href="lang_createtable.html">CREATE TABLE</a>
statement or one of the following special identifiers: "<b>ROWID</b>",
"<b>OID</b>", or "<b>_ROWID_</b>".
The three special identifiers describe the
unique integer key (the <a href="lang_createtable.html#rowid">rowid</a>) associated with every
row of every table and so are not available on <a href="withoutrowid.html">WITHOUT ROWID</a> tables.
The special identifiers only refer to the row key if the <a href="lang_createtable.html">CREATE TABLE</a>
statement does not define a real column with the same name.
The rowid can be used anywhere a regular
column can be used.</p>

<a name="exists_op"></a>

<h1 id="the_exists_operator"><span>10. </span>The EXISTS operator</h1>

<p>The EXISTS operator always evaluates to one of the integer values 0
and 1. If executing the SELECT statement specified as the right-hand
operand of the EXISTS operator would return one or more rows, then the
EXISTS operator evaluates to 1. If executing the SELECT would return
no rows at all, then the EXISTS operator evaluates to 0.

</p><p>The number of columns in each row returned by the SELECT statement
(if any) and the specific values returned have no effect on the results
of the EXISTS operator. In particular, rows containing NULL values are
not handled any differently from rows without NULL values.

<a name="subq"></a>

</p><h1 id="subquery_expressions"><span>11. </span>Subquery Expressions</h1>

<p>A <a href="lang_select.html">SELECT</a> statement enclosed in parentheses is a subquery.
All types of SELECT statement, including
aggregate and compound SELECT queries (queries with keywords like
UNION or EXCEPT) are allowed as scalar subqueries.
The value of a subquery expression is the first row of the result
from the enclosed <a href="lang_select.html">SELECT</a> statement.
The value of a subquery expression is NULL if the enclosed
<a href="lang_select.html">SELECT</a> statement returns no rows.

</p><p>A subquery that returns a single column is a scalar subquery and can
be used most anywhere.
A subquery that returns two or more columns is a <a href="rowvalue.html">row value</a>
subquery and can only be used as an operand of a comparison operator or as
the value in an UPDATE SET clause whose column name list has the same size.

<a name="cosub"></a>

</p><h1 id="correlated_subqueries"><span>12. </span>Correlated Subqueries</h1>

<p>A <a href="lang_select.html">SELECT</a> statement used as either a scalar subquery or as the
right-hand operand of an IN, NOT IN or EXISTS expression may contain
references to columns in the outer query. Such a subquery is known as
a correlated subquery. A correlated subquery is reevaluated each time
its result is required. An uncorrelated subquery is evaluated only once
and the result reused as necessary.

<a name="castexpr"></a>

</p><h1 id="cast_expressions"><span>13. </span>CAST expressions</h1>

<p>A CAST expression of the form "CAST(<i>expr</i> AS <i>type-name</i>)"
is used to convert the value of <i>expr</i> to
a different <a href="datatype3.html#storageclasses">storage class</a> specified by <span class='yyterm'>type-name</span>.
A CAST conversion is similar to the conversion that takes
place when a <a href="datatype3.html#affinity">column affinity</a> is applied to a value except that with
the CAST operator the conversion always takes place even if the conversion
lossy and irreversible, whereas column affinity only changes the data type
of a value if the change is lossless and reversible.

</p><p>If the value of <i>expr</i> is NULL, then the result of the CAST
expression is also NULL. Otherwise, the storage class of the result
is determined by applying the <a href="datatype3.html#affname">rules for determining column affinity</a> to
the <span class='yyterm'>type-name</span>.

</p><blockquote>
<table border="1">
<tr>
  <th> Affinity of <span class='yyterm'><nobr>type-name</nobr></span>
  </th><th> Conversion Processing
</th></tr><tr>
  <td> NONE
  </td><td> Casting a value to a <span class='yyterm'>type-name</span> with no affinity
  causes the value to
  be converted into a BLOB.  Casting to a BLOB consists of first casting
  the value to TEXT in the <a href="pragma.html#pragma_encoding">encoding</a> of the database connection, then
  interpreting the resulting byte sequence as a BLOB instead of as TEXT.

</td></tr><tr>
  <td> TEXT
  </td><td> To cast a BLOB value to TEXT, the sequence of bytes that make up the
  BLOB is interpreted as text encoded using the database encoding.
  <p>
   Casting an INTEGER or REAL value into TEXT renders the value as if via
    <a href="c3ref/mprintf.html">sqlite3_snprintf()</a> except that the resulting TEXT uses the <a href="pragma.html#pragma_encoding">encoding</a> of
    the database connection.

</p></td></tr><tr>
  <td> REAL
  </td><td> When casting a BLOB value to a REAL, the value is first converted to
        TEXT.
       <p>When casting a TEXT value to REAL, the longest possible prefix of
        the value that can be interpreted as a real number is extracted from
        the TEXT value and the remainder ignored. Any leading spaces in the
        TEXT value are ignored when converging from TEXT to REAL. If there is
        no prefix that can be interpreted as a real number, the result of the
        conversion is 0.0.

</p></td></tr><tr>
  <td> INTEGER
  </td><td> When casting a BLOB value to INTEGER, the value is first converted to
        TEXT.
       <p>When casting a TEXT value to INTEGER, the longest possible prefix of
        the value that can be interpreted as an integer number is extracted from
        the TEXT value and the remainder ignored. Any leading spaces in the
        TEXT value when converting from TEXT to INTEGER are ignored. If there
        is no prefix that can be interpreted as an integer number, the result
        of the conversion is 0.  If the prefix integer is greater than
        +9223372036854775807 then the result of the cast is exactly
        +9223372036854775807.  Similarly, if the prefix integer is
        less than -9223372036854775808 then the result of the cast is
        exactly -9223372036854775808.

        </p><p>When casting to INTEGER, if the text looks like a floating point
        value with an exponent, the exponent will be ignored because it is
        no part of the integer prefix.  For example,
        "CAST('123e+5' AS INTEGER)" results in 123, not in 12300000.

        </p><p> The CAST operator understands decimal
        integers only &mdash; conversion of <a href="lang_expr.html#hexint">hexadecimal integers</a> stops
        at the "x" in the "0x" prefix of the hexadecimal integer string
        and thus result of the CAST is always zero.

      </p><p>A cast of a REAL value into an INTEGER results in the integer
      between the REAL value and zero that is closest to the REAL value.
      If a REAL is greater than the greatest possible signed
      integer (+9223372036854775807) then the result is the greatest possible
      signed integer and if the REAL is less than the least possible signed
      integer (-9223372036854775808) then the result is the least possible
      signed integer.

      </p><p>Prior to SQLite version 3.8.2 (2013-12-06),
      casting a REAL value greater than
      +9223372036854775807.0 into an integer resulted in the most negative
      integer, -9223372036854775808.  This behavior was meant to emulate the
      behavior of x86/x64 hardware when doing the equivalent cast.

</p></td></tr><tr>
  <td> NUMERIC
  </td><td> Casting a TEXT or BLOB value into NUMERIC yields either an INTEGER or
   a REAL result.
   If the input text looks like an integer (there is no decimal point nor
   exponent) and the value is small enough to fit in a 64-bit signed integer,
   then the result will be INTEGER.
   Input text that looks like floating point (there is a decimal point and/or
   an exponent) and the text describes a value that
   can be losslessly converted back and forth between IEEE 754 64-bit float and a
   51-bit signed integer, then the result is INTEGER.
   (In the previous sentence, a 51-bit integer is specified since that is one
   bit less than the length of the mantissa of an IEEE 754 64-bit float and
   thus provides a 1-bit of margin for the text-to-float conversion operation.)
   Any text input that describes a value outside the range of a 64-bit
   signed integer yields a REAL result.
   <p> Casting a REAL or INTEGER value to NUMERIC is a no-op, even if a real
   value could be losslessly converted to an integer.
</p></td></tr>
</table>
</blockquote>

<p>Note that the result from casting any non-BLOB value into a
BLOB and the result from casting any BLOB value into a non-BLOB value
may be different depending on whether the database <a href="pragma.html#pragma_encoding">encoding</a> is UTF-8,
UTF-16be, or UTF-16le.


<a name="booleanexpr"></a>

</p><h1 id="boolean_expressions"><span>14. </span>Boolean Expressions</h1>

<p>The SQL language features several contexts where an expression is
evaluated and the result converted to a boolean (true or false) value. These
contexts are:

  </p><ul>
    <li> the WHERE clause of a SELECT, UPDATE or DELETE statement,
    </li><li> the ON or USING clause of a join in a SELECT statement,
    </li><li> the HAVING clause of a SELECT statement,
    </li><li> the WHEN clause of an SQL trigger, and
    </li><li> the WHEN clause or clauses of some CASE expressions.
  </li></ul>

<p>To convert the results of an SQL expression to a boolean value, SQLite
first casts the result to a NUMERIC value in the same way as a
<a href="lang_expr.html#castexpr">CAST expression</a>. A numeric zero value (integer value 0 or real
value 0.0) is considered to be false.  A NULL value is still NULL.
All other values are considered true.

</p><p>For example, the values NULL, 0.0, 0, 'english' and '0' are all considered
to be false. Values 1, 1.0, 0.1, -0.1 and '1english' are considered to
be true.

</p><p>Beginning with SQLite 3.23.0 (2018-04-02), SQLite recognizes the
identifiers "TRUE" and "FALSE" as boolean literals, if and only if those
identifiers are not already used for some other meaning.  If there already
exists columns or tables or other objects named TRUE or FALSE, then for
the sake of backwards compatibility, the TRUE and FALSE identifiers refer
to those other objects, not to the boolean values.

</p><p>The boolean identifiers TRUE and FALSE are usually just aliases for
the integer values 1 and 0, respectively.  However, if TRUE or FALSE
occur on the right-hand side of an IS operator, then the IS operator
evaluates the left-hand operand as a boolean value and returns an appropriate
answer.

<a name="*funcinexpr"></a>

</p><h1 id="functions"><span>15. </span>Functions</h1>
<p>SQLite supports many <a href="lang_corefunc.html">simple</a>, <a href="lang_aggfunc.html">aggregate</a>,
and <a href="windowfunctions.html">window</a>
SQL functions.  For presentation purposes, simple functions are further
subdivided into <a href="lang_corefunc.html">core functions</a>, <a href="lang_datefunc.html">date-time functions</a>,
<a href="lang_mathfunc.html">math functions</a>, and <a href="json1.html">JSON functions</a>.
Applications can add new functions, written in C/C++, using the
<a href="c3ref/create_function.html">sqlite3_create_function()</a> interface.
</p>

<p>
The main expression bubble diagram above shows a single syntax for
all function invocations.  But this is merely to simplify the expression
bubble diagram.  In reality, each type of function has a slightly different
syntax, shown below.  The function invocation syntax shown in the main
expression bubble diagram is the union of the three syntaxes shown here:

<p><b><a href="syntax/simple-function-invocation.html">simple-function-invocation:</a></b></p><div class='imgcontainer'>
 <div style="max-width:414px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 414.49 126.792">
<circle cx="5" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,55 20,59 20,50" style="fill:rgb(0,0,0)"/>
<path d="M9,55L26,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,70L126,70A15 15 0 0 0 141 55A15 15 0 0 0 126 39L47,39A15 15 0 0 0 32 55A15 15 0 0 0 47 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="86" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">simple-func</text>
<polygon points="164,55 152,59 152,50" style="fill:rgb(0,0,0)"/>
<path d="M141,55L158,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,70A15 15 0 0 0 194 55A15 15 0 0 0 179 39A15 15 0 0 0 164 55A15 15 0 0 0 179 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="179" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="248,55 237,59 237,50" style="fill:rgb(0,0,0)"/>
<path d="M194,55L242,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,70L297,70L297,39L248,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="273" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="351,55 340,59 340,50" style="fill:rgb(0,0,0)"/>
<path d="M297,55L346,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,70A15 15 0 0 0 382 55A15 15 0 0 0 366 39A15 15 0 0 0 351 55A15 15 0 0 0 366 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="366" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="405,55 393,59 393,50" style="fill:rgb(0,0,0)"/>
<path d="M382,55L399,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="408" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M273,32A15 15 0 0 0 288 17L288,17A15 15 0 0 0 273 2A15 15 0 0 0 258 17L258,17A15 15 0 0 0 273 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="273" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="288,17 299,12 299,21" style="fill:rgb(0,0,0)"/>
<path d="M297,55 L 305,55 Q 312,55 312,40 L 312,32 Q 312,17 303,17 L 294,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,17 L 237,17 Q 222,17 222,32 L 222,40 Q 222,55 229,55 L 237,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,82 261,86 261,77" style="fill:rgb(0,0,0)"/>
<path d="M194,55 L 202,55 Q 209,55 209,68 Q 209,82 224,82 L 252,82 L 267,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M273,82 L 310,82 Q 325,82 325,68 Q 325,55 332,55 L 340,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M273,124A15 15 0 0 0 288 109A15 15 0 0 0 273 94A15 15 0 0 0 258 109A15 15 0 0 0 273 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="273" y="109" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="258,109 246,113 246,105" style="fill:rgb(0,0,0)"/>
<path d="M194,55 L 202,55 Q 209,55 209,70 L 209,94 Q 209,109 224,109 L 237,109 L 252,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,109 L 310,109 Q 325,109 325,94 L 325,85 L 325,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
 </div>
<p><b><a href="syntax/aggregate-function-invocation.html">aggregate-function-invocation:</a></b></p><div class='imgcontainer'>
 <div style="max-width:909px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 909.533 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,71L156,71A15 15 0 0 0 171 56A15 15 0 0 0 156 41L47,41A15 15 0 0 0 32 56A15 15 0 0 0 47 71Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="102" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">aggregate-func</text>
<polygon points="189,56 178,60 178,52" style="fill:rgb(0,0,0)"/>
<path d="M171,56L183,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M204,71A15 15 0 0 0 219 56A15 15 0 0 0 204 41A15 15 0 0 0 189 56A15 15 0 0 0 204 71Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="56" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="242,56 231,60 231,52" style="fill:rgb(0,0,0)"/>
<path d="M219,56L237,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="277,26 265,30 265,22" style="fill:rgb(0,0,0)"/>
<path d="M242,56 L 248,56 Q 254,56 254,41 L 254,41 Q 254,26 263,26 L 271,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M292,41L360,41A15 15 0 0 0 376 26L376,26A15 15 0 0 0 360 11L292,11A15 15 0 0 0 277 26L277,26A15 15 0 0 0 292 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="326" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="394,26 382,30 382,22" style="fill:rgb(0,0,0)"/>
<path d="M376,26L388,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="428,56 417,60 417,52" style="fill:rgb(0,0,0)"/>
<path d="M394,26 L 399,26 Q 405,26 405,41 L 405,41 Q 405,56 414,56 L 422,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="464,56 453,60 453,52" style="fill:rgb(0,0,0)"/>
<path d="M428,56L458,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M464,71L513,71L513,41L464,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="489" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="657,56 646,60 646,52" style="fill:rgb(0,0,0)"/>
<path d="M513,56L652,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M672,71A15 15 0 0 0 688 56A15 15 0 0 0 672 41A15 15 0 0 0 657 56A15 15 0 0 0 672 71Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="56" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="734,86 722,91 722,82" style="fill:rgb(0,0,0)"/>
<path d="M688,56 L 699,56 Q 711,56 711,71 L 711,71 Q 711,86 719,86 L 728,86"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,101L846,101L846,71L734,71Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="790" y="86" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="900,56 888,60 888,52" style="fill:rgb(0,0,0)"/>
<path d="M846,86 L 855,86 Q 864,86 864,71 L 864,71 Q 864,56 879,56 L 879,56 L 894,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="903" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="790,56 778,60 778,52" style="fill:rgb(0,0,0)"/>
<path d="M688,56L784,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="900,56 888,60 888,52" style="fill:rgb(0,0,0)"/>
<path d="M790,56L894,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="326,56 315,60 315,52" style="fill:rgb(0,0,0)"/>
<path d="M242,56L321,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="428,56 417,60 417,52" style="fill:rgb(0,0,0)"/>
<path d="M326,56L422,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,32A15 15 0 0 0 504 17A15 15 0 0 0 489 2A15 15 0 0 0 474 17A15 15 0 0 0 489 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="489" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="504,17 515,12 515,21" style="fill:rgb(0,0,0)"/>
<path d="M513,56 L 525,56 Q 536,56 536,41 L 536,32 Q 536,17 523,17 L 510,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="464,56 453,60 453,52" style="fill:rgb(0,0,0)"/>
<path d="M474,17 L 456,17 Q 441,17 441,32 L 441,41 Q 441,56 450,56 L 458,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,207A15 15 0 0 0 453 192A15 15 0 0 0 438 177A15 15 0 0 0 423 192A15 15 0 0 0 438 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="423,192 412,196 412,188" style="fill:rgb(0,0,0)"/>
<path d="M242,56 L 248,56 Q 254,56 254,71 L 254,177 Q 254,192 269,192 L 402,192 L 417,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="489,192 477,196 477,188" style="fill:rgb(0,0,0)"/>
<path d="M453,192L483,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,192 L 570,192 Q 585,192 600,192 L 605,192 Q 620,192 620,177 L 620,71 Q 620,56 626,56 L 631,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="438,216 427,221 427,212" style="fill:rgb(0,0,0)"/>
<path d="M326,192 L 392,192 Q 407,192 407,204 Q 407,216 420,216 L 433,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,216 L 453,216 Q 467,216 467,204 Q 467,192 473,192 L 479,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="300,117 289,121 289,112" style="fill:rgb(0,0,0)"/>
<path d="M513,56 L 523,56 Q 533,56 533,71 L 533,71 Q 533,86 518,86 L 292,86 Q 277,86 277,101 L 277,102 Q 277,117 286,117 L 294,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M315,132L360,132A15 15 0 0 0 375 117A15 15 0 0 0 360 101L315,101A15 15 0 0 0 300 117A15 15 0 0 0 315 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="392,117 381,121 381,112" style="fill:rgb(0,0,0)"/>
<path d="M375,117L386,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,132L411,132A15 15 0 0 0 426 117A15 15 0 0 0 411 101L407,101A15 15 0 0 0 392 117A15 15 0 0 0 407 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="455,117 444,121 444,112" style="fill:rgb(0,0,0)"/>
<path d="M426,117L449,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,132L585,132L585,101L455,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="520" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M520,169A15 15 0 0 0 535 154A15 15 0 0 0 520 139A15 15 0 0 0 505 154A15 15 0 0 0 520 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="520" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="535,154 547,150 547,159" style="fill:rgb(0,0,0)"/>
<path d="M585,117 L 591,117 Q 597,117 597,132 L 597,139 Q 597,154 582,154 L 556,154 L 541,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="455,117 444,121 444,112" style="fill:rgb(0,0,0)"/>
<path d="M505,154 L 470,154 Q 455,154 447,154 Q 438,154 438,139 L 438,132 Q 438,117 444,117 L 449,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,117 L 594,117 Q 602,117 602,102 L 602,71 Q 602,56 617,56 L 623,56 L 638,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
 </div>
<p><b><a href="syntax/window-function-invocation.html">window-function-invocation:</a></b></p><div class='imgcontainer'>
 <div style="max-width:870px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 870.446 132.84">
<circle cx="5" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,55 20,59 20,50" style="fill:rgb(0,0,0)"/>
<path d="M9,55L26,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,70L135,70A15 15 0 0 0 150 55A15 15 0 0 0 135 39L47,39A15 15 0 0 0 32 55A15 15 0 0 0 47 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="91" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-func</text>
<polygon points="167,55 156,59 156,50" style="fill:rgb(0,0,0)"/>
<path d="M150,55L161,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M182,70A15 15 0 0 0 197 55A15 15 0 0 0 182 39A15 15 0 0 0 167 55A15 15 0 0 0 182 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="182" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="251,55 240,59 240,50" style="fill:rgb(0,0,0)"/>
<path d="M197,55L246,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M251,70L300,70L300,39L251,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="354,55 343,59 343,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L349,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M370,70A15 15 0 0 0 385 55A15 15 0 0 0 370 39A15 15 0 0 0 354 55A15 15 0 0 0 370 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="370" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="426,85 415,89 415,81" style="fill:rgb(0,0,0)"/>
<path d="M385,55 L 392,55 Q 400,55 400,70 L 400,70 Q 400,85 410,85 L 420,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M426,100L538,100L538,70L426,70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="580,55 568,59 568,50" style="fill:rgb(0,0,0)"/>
<path d="M538,85 L 546,85 Q 553,85 553,70 L 553,70 Q 553,55 564,55 L 574,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M595,70L626,70A15 15 0 0 0 641 55A15 15 0 0 0 626 39L595,39A15 15 0 0 0 580 55A15 15 0 0 0 595 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="610" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="682,92 671,97 671,88" style="fill:rgb(0,0,0)"/>
<path d="M641,55 L 648,55 Q 656,55 656,70 L 656,77 Q 656,92 666,92 L 677,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M697,108L794,108A15 15 0 0 0 810 92L810,92A15 15 0 0 0 794 77L697,77A15 15 0 0 0 682 92L682,92A15 15 0 0 0 697 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="746" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="861,55 849,59 849,50" style="fill:rgb(0,0,0)"/>
<path d="M810,92 L 817,92 Q 825,92 825,77 L 825,70 Q 825,55 840,55 L 840,55 L 855,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="864" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M385,55L568,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="682,55 671,59 671,50" style="fill:rgb(0,0,0)"/>
<path d="M641,55L677,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M682,70L801,70L801,39L682,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="742" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M801,55L849,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,32A15 15 0 0 0 291 17L291,17A15 15 0 0 0 276 2A15 15 0 0 0 261 17L261,17A15 15 0 0 0 276 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="291,17 303,12 303,21" style="fill:rgb(0,0,0)"/>
<path d="M300,55 L 308,55 Q 315,55 315,40 L 315,32 Q 315,17 306,17 L 297,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M261,17 L 240,17 Q 225,17 225,32 L 225,40 Q 225,55 232,55 L 240,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="276,85 264,89 264,81" style="fill:rgb(0,0,0)"/>
<path d="M197,55 L 205,55 Q 212,55 212,70 L 212,70 Q 212,85 227,85 L 255,85 L 270,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,85 L 313,85 Q 328,85 328,70 L 328,70 Q 328,55 335,55 L 343,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130A15 15 0 0 0 291 115L291,115A15 15 0 0 0 276 100A15 15 0 0 0 261 115L261,115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M197,55 L 205,55 Q 212,55 212,70 L 212,100 Q 212,115 227,115 L 240,115 L 255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,115 L 313,115 Q 328,115 328,100 L 328,70 Q 328,55 335,55 L 343,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
 </div>


</p><p>
The OVER clause is required for <a href="windowfunctions.html">window functions</a> and is prohibited
otherwise.  The DISTINCT keyword and the ORDER BY clause is only allowed
in <a href="lang_aggfunc.html">aggregate functions</a>.
The FILTER clause may not appear on a <a href="lang_corefunc.html">simple function</a>.

</p><p>It is possible to have an aggregate function with the same name as a
simple function, as long as the number of arguments for the two forms of the
function are different.  For example, the <a href="lang_aggfunc.html#max_agg">max()</a> function with a
single argument is an aggregate and the <a href="lang_corefunc.html#max_scalar">max()</a> function with two or more
arguments is a simple function.  Aggregate functions can usually also
be used as window functions.
</p><p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_expr.in?m=7ed1af83ff">2024-02-27 20:24:47</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_indexedby.html.









































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>The INDEXED BY Clause</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
The INDEXED BY Clause
</div>
</div>




<h1 id="how_indexed_by_works"><span>1. </span>How INDEXED BY Works</h1>

<p>The INDEXED BY phrase forces the <a href="optoverview.html">SQLite query planner</a> to use a
particular named index on a <a href="lang_delete.html">DELETE</a>, <a href="lang_select.html">SELECT</a>, or <a href="lang_update.html">UPDATE</a> statement.
The INDEXED BY phrase is an SQLite extension and
is not portable to other SQL database engines.</p>

<p><b><a href="syntax/qualified-table-name.html">qualified-table-name:</a></b>
<button id='x5aa9a11d' onclick='hideorshow("x5aa9a11d","x7055a075")'>hide</button></p>
 <div id='x7055a075' class='imgcontainer'>
 <div style="max-width:599px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 599.746 182.736">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L156,32A15 15 0 0 0 171 17A15 15 0 0 0 156 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,17 183,21 183,12" style="fill:rgb(0,0,0)"/>
<path d="M171,17L189,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,32A15 15 0 0 0 225 17A15 15 0 0 0 210 2A15 15 0 0 0 195 17A15 15 0 0 0 210 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,17 249,21 249,12" style="fill:rgb(0,0,0)"/>
<path d="M225,17L255,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,32L351,32A15 15 0 0 0 366 17A15 15 0 0 0 351 2L276,2A15 15 0 0 0 261 17A15 15 0 0 0 276 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="408,44 396,48 396,40" style="fill:rgb(0,0,0)"/>
<path d="M366,17 L 374,17 Q 381,17 381,30 Q 381,44 392,44 L 402,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,59L427,59A15 15 0 0 0 442 44L442,44A15 15 0 0 0 427 29L423,29A15 15 0 0 0 408 44L408,44A15 15 0 0 0 423 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="465,44 453,48 453,40" style="fill:rgb(0,0,0)"/>
<path d="M442,44L459,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,59L501,59A15 15 0 0 0 516 44L516,44A15 15 0 0 0 501 29L480,29A15 15 0 0 0 465 44L465,44A15 15 0 0 0 480 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="490" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">alias</text>
<polygon points="539,44 527,48 527,40" style="fill:rgb(0,0,0)"/>
<path d="M516,44L533,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,44 L 546,44 Q 554,44 554,51 L 554,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="453,17 442,21 442,12" style="fill:rgb(0,0,0)"/>
<path d="M366,17L448,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,44 97,48 97,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 39,44 L 87,44 L 102,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M108,44 L 225,44 Q 240,44 240,30 Q 240,17 247,17 L 255,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,142L301,142A15 15 0 0 0 316 127A15 15 0 0 0 301 112L236,112A15 15 0 0 0 221 127A15 15 0 0 0 236 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="339,127 327,131 327,123" style="fill:rgb(0,0,0)"/>
<path d="M316,127L333,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,142L358,142A15 15 0 0 0 373 127A15 15 0 0 0 358 112L354,112A15 15 0 0 0 339 127A15 15 0 0 0 354 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="396,127 385,131 385,123" style="fill:rgb(0,0,0)"/>
<path d="M373,127L390,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M411,142L490,142A15 15 0 0 0 505 127A15 15 0 0 0 490 112L411,112A15 15 0 0 0 396 127A15 15 0 0 0 411 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="451" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M236,180L256,180A15 15 0 0 0 271 165A15 15 0 0 0 256 150L236,150A15 15 0 0 0 221 165A15 15 0 0 0 236 180Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="165" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="294,165 283,169 283,161" style="fill:rgb(0,0,0)"/>
<path d="M271,165L289,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,180L374,180A15 15 0 0 0 389 165A15 15 0 0 0 374 150L310,150A15 15 0 0 0 294 165A15 15 0 0 0 310 180Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="342" y="165" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="554,74 550,62 558,62" style="fill:rgb(0,0,0)"/>
<path d="M453,17 L 539,17 Q 554,17 554,32 L 554,53 L 554,68"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 325,85 325,94" style="fill:rgb(0,0,0)"/>
<path d="M554,74 L 554,82 Q 554,89 539,89 L 334,89 L 319,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="221,127 210,131 210,123" style="fill:rgb(0,0,0)"/>
<path d="M313,89 L 210,89 Q 195,89 195,104 L 195,112 Q 195,127 205,127 L 215,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="221,165 210,169 210,161" style="fill:rgb(0,0,0)"/>
<path d="M195,112 L 195,150 Q 195,165 205,165 L 215,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="554,114 550,102 558,102" style="fill:rgb(0,0,0)"/>
<path d="M554,74L554,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="590,165 578,169 578,161" style="fill:rgb(0,0,0)"/>
<path d="M554,114 L 554,150 Q 554,165 569,165 L 569,165 L 584,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="593" cy="165" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="539,127 527,131 527,123" style="fill:rgb(0,0,0)"/>
<path d="M505,127L533,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,127 L 546,127 Q 554,127 554,135 L 554,142"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M389,165L578,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>


<p>The "INDEXED BY <span class='yyterm'>index-name</span>" phrase specifies 
that the named index
must be used in order to look up values on the preceding table.
If <span class='yyterm'>index-name</span> does not exist or cannot be used 
for the query, then the preparation of the SQL statement fails.
The "NOT INDEXED" clause specifies that no index shall be used when
accessing the preceding table, including implied indices create by
UNIQUE and PRIMARY KEY constraints.  However, the <a href="lang_createtable.html#rowid">rowid</a>
can still be used to look up entries even when "NOT INDEXED" is specified.</p>

<p>Some SQL database engines provide non-standard "hint" mechanisms which
can be used to give the query optimizer clues about what indices it should
use for a particular statement.  The INDEXED BY clause of SQLite is 
<em>not</em> a hinting mechanism and it should not be used as such.
The INDEXED BY clause does not give the optimizer hints about which index
to use; it gives the optimizer a requirement of which index to use.
If the query optimizer is unable to use the index specified by the
INDEXED BY clause, then the query will fail with an error.</p>

<p>The INDEXED BY clause is <em>not</em> intended for use in tuning
the performance of a query.  The intent of the INDEXED BY clause is
to raise a run-time error if a schema change, such as dropping or
creating an index, causes the query plan for a time-sensitive query
to change.  The INDEXED BY clause is designed to help detect
undesirable query plan changes during regression testing.
Application 
developers are admonished to omit all use of INDEXED BY during
application design, implementation, testing, and tuning.  If
INDEXED BY is to be used at all, it should be inserted at the very
end of the development process when "locking down" a design.</p>

<h1 id="see_also"><span>2. </span>See Also</h1>

<ol>
<li><p>The <a href="queryplanner-ng.html#howtofix">query planner checklist</a> describes steps that application
developers should following to help resolve query planner problems.
Notice the that the use of INDEXED BY is a last resort, to be used only
when all other measures fail.</p>

</li><li><p><a href="optoverview.html#uplus">The unary "+" operator</a>
can be used to disqualify terms in the WHERE clause from use by indices.
Careful use of unary + can sometimes help prevent the query planner from
choosing a poor index without restricting it to using one specific index.
Careful placement of unary + operators is a better method for controlling 
which indices are used by a query.</p>

</li><li><p>The <a href="c3ref/stmt_status.html">sqlite3_stmt_status()</a> C/C++ interface together with the
<a href="c3ref/c_stmtstatus_counter.html#sqlitestmtstatusfullscanstep">SQLITE_STMTSTATUS_FULLSCAN_STEP</a> and <a href="c3ref/c_stmtstatus_counter.html#sqlitestmtstatussort">SQLITE_STMTSTATUS_SORT</a> verbs
can be used to detect at run-time when an SQL statement is not
making effective use of indices.  Many applications may prefer to
use the <a href="c3ref/stmt_status.html">sqlite3_stmt_status()</a> interface to detect index misuse
rather than the INDEXED BY phrase described here.</p>
</li></ol>
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_indexedby.in?m=f9785fa831">2022-01-08 05:02:57</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_insert.html.









































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>INSERT</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
INSERT
</div>
</div>




<h1 id="overview"><span>1. </span>Overview</h1>

<p><b><a href="syntax/insert-stmt.html">insert-stmt:</a></b>
<button id='xcca1c3d7' onclick='hideorshow("xcca1c3d7","x5383aee8")'>hide</button></p>
 <div id='x5383aee8' class='imgcontainer'>
 <div style="max-width:601px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 601.066 922.104">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L91,32A15 15 0 0 0 106 17A15 15 0 0 0 91 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M166,62L252,62A15 15 0 0 0 267 47L267,47A15 15 0 0 0 252 32L166,32A15 15 0 0 0 151 47L151,47A15 15 0 0 0 166 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="209,17 197,21 197,12" style="fill:rgb(0,0,0)"/>
<path d="M106,17L203,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M209,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M357,32L583,32L583,2L357,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="151,47 139,51 139,43" style="fill:rgb(0,0,0)"/>
<path d="M106,17 L 113,17 Q 121,17 121,32 L 121,32 Q 121,47 133,47 L 145,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,47 278,51 278,43" style="fill:rgb(0,0,0)"/>
<path d="M267,47L284,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,47 L 297,47 Q 305,47 305,32 L 305,32 Q 305,17 320,17 L 330,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,70A15 15 0 0 0 485 55L485,55A15 15 0 0 0 470 39A15 15 0 0 0 455 55L455,55A15 15 0 0 0 470 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="485,55 497,50 497,59" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,40 Q 598,55 583,55 L 506,55 L 491,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,55 L 349,55 Q 334,55 334,40 L 334,32 Q 334,17 340,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="294,83 306,79 306,88" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,68 Q 598,83 583,83 L 315,83 L 300,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="24,53 20,41 28,41" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,32 L 24,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,145L124,145A15 15 0 0 0 139 130A15 15 0 0 0 124 115L60,115A15 15 0 0 0 45 130A15 15 0 0 0 60 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<path d="M60,183L109,183A15 15 0 0 0 124 168A15 15 0 0 0 109 153L60,153A15 15 0 0 0 45 168A15 15 0 0 0 60 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="84" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INSERT</text>
<polygon points="166,198 154,203 154,194" style="fill:rgb(0,0,0)"/>
<path d="M124,168 L 132,168 Q 139,168 139,183 L 139,183 Q 139,198 149,198 L 160,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M181,213L187,213A15 15 0 0 0 203 198A15 15 0 0 0 187 183L181,183A15 15 0 0 0 166 198A15 15 0 0 0 181 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="244,349 233,354 233,345" style="fill:rgb(0,0,0)"/>
<path d="M203,198 L 210,198 Q 218,198 218,213 L 218,334 Q 218,349 228,349 L 238,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,365L337,365A15 15 0 0 0 352 349A15 15 0 0 0 337 334L259,334A15 15 0 0 0 244 349A15 15 0 0 0 259 365Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="298" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="369,349 358,354 358,345" style="fill:rgb(0,0,0)"/>
<path d="M352,349L363,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,130 399,135 399,126" style="fill:rgb(0,0,0)"/>
<path d="M369,349 L 377,349 Q 384,349 384,334 L 384,145 Q 384,130 395,130 L 405,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M426,145L453,145A15 15 0 0 0 468 130A15 15 0 0 0 453 115L426,115A15 15 0 0 0 411 130A15 15 0 0 0 426 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTO</text>
<polygon points="45,168 33,172 33,164" style="fill:rgb(0,0,0)"/>
<path d="M24,53 L 24,153 Q 24,168 31,168 L 39,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,130 33,135 33,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 31,130 L 39,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,83 L 39,83 Q 24,83 24,91 L 24,98"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M139,130L399,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,168 358,172 358,164" style="fill:rgb(0,0,0)"/>
<path d="M124,168L363,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,168 L 377,168 Q 384,168 384,160 L 384,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,213L301,213A15 15 0 0 0 316 198A15 15 0 0 0 301 183L259,183A15 15 0 0 0 244 198A15 15 0 0 0 259 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="244,198 233,203 233,194" style="fill:rgb(0,0,0)"/>
<path d="M203,198L238,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,198 358,203 358,194" style="fill:rgb(0,0,0)"/>
<path d="M316,198L363,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,198 L 377,198 Q 384,198 384,191 L 384,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,251L281,251A15 15 0 0 0 296 236A15 15 0 0 0 281 221L259,221A15 15 0 0 0 244 236A15 15 0 0 0 259 251Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="270" y="236" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="244,236 233,240 233,232" style="fill:rgb(0,0,0)"/>
<path d="M218,221 L 218,228 Q 218,236 228,236 L 238,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,236 358,240 358,232" style="fill:rgb(0,0,0)"/>
<path d="M296,236L363,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,236 L 377,236 Q 384,236 384,229 L 384,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,289L311,289A15 15 0 0 0 327 274A15 15 0 0 0 311 259L259,259A15 15 0 0 0 244 274A15 15 0 0 0 259 289Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="285" y="274" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="244,274 233,278 233,270" style="fill:rgb(0,0,0)"/>
<path d="M218,259 L 218,266 Q 218,274 228,274 L 238,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,274 358,278 358,270" style="fill:rgb(0,0,0)"/>
<path d="M327,274L363,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,274 L 377,274 Q 384,274 384,266 L 384,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,327L323,327A15 15 0 0 0 338 312A15 15 0 0 0 323 297L259,297A15 15 0 0 0 244 312A15 15 0 0 0 259 327Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="291" y="312" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<polygon points="244,312 233,316 233,307" style="fill:rgb(0,0,0)"/>
<path d="M218,297 L 218,304 Q 218,312 228,312 L 238,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,312 358,316 358,307" style="fill:rgb(0,0,0)"/>
<path d="M338,312L363,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,312 L 377,312 Q 384,312 384,304 L 384,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,455L156,455A15 15 0 0 0 171 440A15 15 0 0 0 156 425L60,425A15 15 0 0 0 45 440A15 15 0 0 0 60 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,440 183,444 183,436" style="fill:rgb(0,0,0)"/>
<path d="M171,440L189,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,455A15 15 0 0 0 225 440A15 15 0 0 0 210 425A15 15 0 0 0 195 440A15 15 0 0 0 210 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="440" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,440 249,444 249,436" style="fill:rgb(0,0,0)"/>
<path d="M225,440L255,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,455L351,455A15 15 0 0 0 366 440A15 15 0 0 0 351 425L276,425A15 15 0 0 0 261 440A15 15 0 0 0 276 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="402,440 391,444 391,436" style="fill:rgb(0,0,0)"/>
<path d="M366,440L396,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,455L421,455A15 15 0 0 0 436 440A15 15 0 0 0 421 425L417,425A15 15 0 0 0 402 440A15 15 0 0 0 417 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="419" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="459,440 448,444 448,436" style="fill:rgb(0,0,0)"/>
<path d="M436,440L454,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,455L495,455A15 15 0 0 0 510 440A15 15 0 0 0 495 425L475,425A15 15 0 0 0 459 440A15 15 0 0 0 475 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="485" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">alias</text>
<polygon points="483,238 478,227 487,227" style="fill:rgb(0,0,0)"/>
<path d="M468,130 L 475,130 Q 483,130 483,145 L 483,217 L 483,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,395 183,390 183,399" style="fill:rgb(0,0,0)"/>
<path d="M483,238 L 483,380 Q 483,395 468,395 L 192,395 L 177,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,440 33,444 33,436" style="fill:rgb(0,0,0)"/>
<path d="M171,395 L 35,395 Q 20,395 20,410 L 20,425 Q 20,440 30,440 L 39,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,423 230,412 239,412" style="fill:rgb(0,0,0)"/>
<path d="M261,395 L 247,395 Q 234,395 234,406 L 234,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M234,423 L 234,432 Q 234,440 242,440 L 249,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,546A15 15 0 0 0 75 531A15 15 0 0 0 60 516A15 15 0 0 0 45 531A15 15 0 0 0 60 546Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="531" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,531 100,535 100,527" style="fill:rgb(0,0,0)"/>
<path d="M75,531L105,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,546L220,546A15 15 0 0 0 235 531A15 15 0 0 0 220 516L126,516A15 15 0 0 0 111 531A15 15 0 0 0 126 546Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="531" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="271,531 260,535 260,527" style="fill:rgb(0,0,0)"/>
<path d="M235,531L266,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,546A15 15 0 0 0 302 531A15 15 0 0 0 287 516A15 15 0 0 0 271 531A15 15 0 0 0 287 546Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="287" y="531" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<path d="M173,580A15 15 0 0 0 188 565A15 15 0 0 0 173 550A15 15 0 0 0 158 565A15 15 0 0 0 173 580Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="565" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="188,565 200,561 200,569" style="fill:rgb(0,0,0)"/>
<path d="M235,531 L 243,531 Q 250,531 250,546 L 250,550 Q 250,565 235,565 L 209,565 L 194,565"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,565 L 100,565 Q 85,565 85,550 L 85,546 Q 85,531 92,531 L 100,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="173,595 185,591 185,599" style="fill:rgb(0,0,0)"/>
<path d="M302,531 L 309,531 Q 317,531 317,546 L 317,580 Q 317,595 302,595 L 194,595 L 179,595"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M173,595 L 39,595 Q 24,595 24,603 L 24,610"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="436,486 448,481 448,490" style="fill:rgb(0,0,0)"/>
<path d="M510,440 L 518,440 Q 525,440 525,455 L 525,471 Q 525,486 510,486 L 457,486 L 442,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,531 33,535 33,527" style="fill:rgb(0,0,0)"/>
<path d="M436,486 L 39,486 Q 24,486 24,501 L 24,516 Q 24,531 31,531 L 39,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="381,469 377,457 385,457" style="fill:rgb(0,0,0)"/>
<path d="M366,440 L 374,440 Q 381,440 381,451 L 381,463"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M381,469 L 381,477 Q 381,486 374,486 L 366,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,671L112,671A15 15 0 0 0 127 656A15 15 0 0 0 112 640L60,640A15 15 0 0 0 45 656A15 15 0 0 0 60 671Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="86" y="656" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="163,656 152,660 152,651" style="fill:rgb(0,0,0)"/>
<path d="M127,656L158,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,671A15 15 0 0 0 194 656A15 15 0 0 0 179 640A15 15 0 0 0 163 656A15 15 0 0 0 179 671Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="179" y="656" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="230,656 218,660 218,651" style="fill:rgb(0,0,0)"/>
<path d="M194,656L224,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M230,671L279,671L279,640L230,640Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="656" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="315,656 303,660 303,651" style="fill:rgb(0,0,0)"/>
<path d="M279,656L309,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,671A15 15 0 0 0 345 656A15 15 0 0 0 330 640A15 15 0 0 0 315 656A15 15 0 0 0 330 671Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="330" y="656" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="45,656 33,660 33,651" style="fill:rgb(0,0,0)"/>
<path d="M24,516 L 24,641 Q 24,656 31,656 L 39,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,705A15 15 0 0 0 269 690A15 15 0 0 0 254 675A15 15 0 0 0 239 690A15 15 0 0 0 254 705Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="690" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="269,690 281,685 281,694" style="fill:rgb(0,0,0)"/>
<path d="M279,656 L 286,656 Q 294,656 294,671 L 294,675 Q 294,690 285,690 L 275,690"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M239,690 L 218,690 Q 203,690 203,675 L 203,671 Q 203,656 211,656 L 218,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,743A15 15 0 0 0 269 727A15 15 0 0 0 254 712A15 15 0 0 0 239 727A15 15 0 0 0 254 743Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="727" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="269,727 281,723 281,732" style="fill:rgb(0,0,0)"/>
<path d="M345,656 L 353,656 Q 360,656 360,671 L 360,712 Q 360,727 345,727 L 290,727 L 275,727"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M239,727 L 152,727 Q 137,727 137,712 L 137,671 Q 137,656 144,656 L 152,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="387,693 375,698 375,689" style="fill:rgb(0,0,0)"/>
<path d="M345,656 L 353,656 Q 360,656 360,671 L 360,678 Q 360,693 371,693 L 381,693"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M387,709L512,709L512,678L387,678Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="449" y="693" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">upsert-clause</text>
<polygon points="535,693 523,698 523,689" style="fill:rgb(0,0,0)"/>
<path d="M512,693L529,693"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,693 L 542,693 Q 550,693 550,701 L 550,708"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="535,656 523,660 523,651" style="fill:rgb(0,0,0)"/>
<path d="M345,656L529,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,788L149,788L149,758L45,758Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="97" y="773" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="535,773 523,777 523,768" style="fill:rgb(0,0,0)"/>
<path d="M149,773L529,773"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,773 L 542,773 Q 550,773 550,780 L 550,788"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,773 33,777 33,768" style="fill:rgb(0,0,0)"/>
<path d="M24,640 L 24,758 Q 24,773 31,773 L 39,773"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M387,818L512,818L512,788L387,788Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="449" y="803" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">upsert-clause</text>
<polygon points="535,803 523,807 523,799" style="fill:rgb(0,0,0)"/>
<path d="M512,803L529,803"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,803 L 542,803 Q 550,803 550,811 L 550,818"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="387,803 375,807 375,799" style="fill:rgb(0,0,0)"/>
<path d="M345,773 L 353,773 Q 360,773 360,788 L 360,788 Q 360,803 371,803 L 381,803"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,856L125,856A15 15 0 0 0 140 841A15 15 0 0 0 125 826L60,826A15 15 0 0 0 45 841A15 15 0 0 0 60 856Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="841" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFAULT</text>
<polygon points="164,841 152,845 152,837" style="fill:rgb(0,0,0)"/>
<path d="M140,841L158,841"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,856L231,856A15 15 0 0 0 246 841A15 15 0 0 0 231 826L179,826A15 15 0 0 0 164 841A15 15 0 0 0 179 856Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="205" y="841" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="535,841 523,845 523,837" style="fill:rgb(0,0,0)"/>
<path d="M246,841L529,841"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,841 33,845 33,837" style="fill:rgb(0,0,0)"/>
<path d="M24,758 L 24,826 Q 24,841 31,841 L 39,841"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M361,919L512,919L512,889L361,889Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="436" y="904" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">returning-clause</text>
<polygon points="591,904 580,909 580,900" style="fill:rgb(0,0,0)"/>
<path d="M512,904L585,904"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="595" cy="904" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,656 L 542,656 Q 550,656 550,671 L 550,889 Q 550,904 557,904 L 565,904"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="436,871 448,867 448,875" style="fill:rgb(0,0,0)"/>
<path d="M535,841 L 542,841 Q 550,841 550,856 L 550,856 Q 550,871 535,871 L 457,871 L 442,871"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="361,904 349,909 349,900" style="fill:rgb(0,0,0)"/>
<path d="M436,871 L 349,871 Q 334,871 334,886 L 334,889 Q 334,904 345,904 L 355,904"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/common-table-expression.html">common-table-expression:</a></b>
<button id='xf0d3aaa6' onclick='hideorshow("xf0d3aaa6","x49e39602")'>show</button></p>
 <div id='x49e39602' style='display:none;' class='imgcontainer'>
 <div style="max-width:638px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 638.525 167.4">
<circle cx="5" cy="29" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,29 20,33 20,24" style="fill:rgb(0,0,0)"/>
<path d="M9,29L26,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,44L122,44A15 15 0 0 0 137 29A15 15 0 0 0 122 14L47,14A15 15 0 0 0 32 29A15 15 0 0 0 47 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="160,29 149,33 149,24" style="fill:rgb(0,0,0)"/>
<path d="M137,29L155,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="196,29 185,33 185,24" style="fill:rgb(0,0,0)"/>
<path d="M160,29L191,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,44A15 15 0 0 0 227 29A15 15 0 0 0 211 14A15 15 0 0 0 196 29A15 15 0 0 0 211 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="250,29 238,33 238,24" style="fill:rgb(0,0,0)"/>
<path d="M227,29L244,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="286,29 274,33 274,24" style="fill:rgb(0,0,0)"/>
<path d="M250,29L280,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,44L395,44A15 15 0 0 0 410 29A15 15 0 0 0 395 14L301,14A15 15 0 0 0 286 29A15 15 0 0 0 301 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="446,29 434,33 434,24" style="fill:rgb(0,0,0)"/>
<path d="M410,29L440,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,44A15 15 0 0 0 476 29A15 15 0 0 0 461 14A15 15 0 0 0 446 29A15 15 0 0 0 461 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,29 499,33 499,24" style="fill:rgb(0,0,0)"/>
<path d="M476,29L505,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,165L51,165A15 15 0 0 0 66 150A15 15 0 0 0 51 135L47,135A15 15 0 0 0 32 150A15 15 0 0 0 47 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="49" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<path d="M127,135L147,135A15 15 0 0 0 162 119A15 15 0 0 0 147 104L127,104A15 15 0 0 0 112 119A15 15 0 0 0 127 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<path d="M219,135L337,135A15 15 0 0 0 352 119A15 15 0 0 0 337 104L219,104A15 15 0 0 0 204 119A15 15 0 0 0 219 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<path d="M162,119L204,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,165A15 15 0 0 0 425 150A15 15 0 0 0 410 135A15 15 0 0 0 395 150A15 15 0 0 0 410 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="410" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="448,150 437,154 437,145" style="fill:rgb(0,0,0)"/>
<path d="M425,150L442,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,165L552,165L552,135L448,135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="500" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="575,150 564,154 564,145" style="fill:rgb(0,0,0)"/>
<path d="M552,150L570,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M591,165A15 15 0 0 0 606 150A15 15 0 0 0 591 135A15 15 0 0 0 575 150A15 15 0 0 0 591 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="629,150 617,154 617,145" style="fill:rgb(0,0,0)"/>
<path d="M606,150L623,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="632" cy="150" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,82A15 15 0 0 0 363 66A15 15 0 0 0 348 51A15 15 0 0 0 333 66A15 15 0 0 0 348 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="363,66 374,62 374,71" style="fill:rgb(0,0,0)"/>
<path d="M410,29 L 417,29 Q 425,29 425,44 L 425,51 Q 425,66 410,66 L 384,66 L 369,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M333,66 L 278,66 Q 263,66 263,51 L 263,44 Q 263,29 270,29 L 278,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,93 78,89 78,97" style="fill:rgb(0,0,0)"/>
<path d="M511,29 L 516,29 Q 522,29 522,44 L 522,78 Q 522,93 507,93 L 87,93 L 72,93"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,150 20,154 20,145" style="fill:rgb(0,0,0)"/>
<path d="M66,93 L 30,93 Q 15,93 15,108 L 15,135 Q 15,150 20,150 L 26,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="85,150 73,154 73,145" style="fill:rgb(0,0,0)"/>
<path d="M66,150L79,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="112,119 101,124 101,115" style="fill:rgb(0,0,0)"/>
<path d="M85,150 L 89,150 Q 92,150 92,135 L 92,134 Q 92,119 99,119 L 106,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="204,119 192,124 192,115" style="fill:rgb(0,0,0)"/>
<path d="M66,150 L 147,150 Q 162,150 170,150 Q 177,150 177,135 L 177,134 Q 177,119 188,119 L 198,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,150 383,154 383,145" style="fill:rgb(0,0,0)"/>
<path d="M352,119 L 360,119 Q 367,119 367,134 L 367,135 Q 367,150 378,150 L 389,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150L395,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,6 336,10 336,2" style="fill:rgb(0,0,0)"/>
<path d="M160,29 L 168,29 Q 175,29 175,17 Q 175,6 190,6 L 327,6 L 342,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,6 L 473,6 Q 488,6 488,17 Q 488,29 495,29 L 503,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/expr.html">expr:</a></b>
<button id='x12fb8095' onclick='hideorshow("x12fb8095","x13f268ad")'>show</button></p>
 <div id='x13f268ad' style='display:none;' class='imgcontainer'>
 <div style="max-width:963px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 963.96 1068.77">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L158,32L158,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="101" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="954,17 943,21 943,12" style="fill:rgb(0,0,0)"/>
<path d="M158,17L948,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="958" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L172,70A15 15 0 0 0 187 55L187,55A15 15 0 0 0 172 39L60,39A15 15 0 0 0 45 55L45,55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">bind-parameter</text>
<polygon points="916,55 905,59 905,50" style="fill:rgb(0,0,0)"/>
<path d="M187,55L910,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,55 L 924,55 Q 931,55 931,47 L 931,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 31,55 L 39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,130L156,130A15 15 0 0 0 171 115A15 15 0 0 0 156 100L60,100A15 15 0 0 0 45 115A15 15 0 0 0 60 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,115 183,119 183,111" style="fill:rgb(0,0,0)"/>
<path d="M171,115L189,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,130A15 15 0 0 0 225 115A15 15 0 0 0 210 100A15 15 0 0 0 195 115A15 15 0 0 0 210 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M225,115L255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130L351,130A15 15 0 0 0 366 115A15 15 0 0 0 351 100L276,100A15 15 0 0 0 261 115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="389,115 378,119 378,111" style="fill:rgb(0,0,0)"/>
<path d="M366,115L383,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,130A15 15 0 0 0 419 115A15 15 0 0 0 404 100A15 15 0 0 0 389 115A15 15 0 0 0 404 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="404" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="455,115 444,119 444,111" style="fill:rgb(0,0,0)"/>
<path d="M419,115L450,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,130L565,130A15 15 0 0 0 580 115A15 15 0 0 0 565 100L471,100A15 15 0 0 0 455 115A15 15 0 0 0 471 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="916,115 905,119 905,111" style="fill:rgb(0,0,0)"/>
<path d="M580,115L910,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,115 L 924,115 Q 931,115 931,108 L 931,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,115 33,119 33,111" style="fill:rgb(0,0,0)"/>
<path d="M24,100 L 24,108 Q 24,115 31,115 L 39,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,89 97,93 97,84" style="fill:rgb(0,0,0)"/>
<path d="M24,74 L 24,81 Q 24,89 39,89 L 87,89 L 102,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 302,93 302,84" style="fill:rgb(0,0,0)"/>
<path d="M108,89 L 129,89 Q 144,89 159,89 L 293,89 L 308,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,89 L 414,89 Q 429,89 429,102 Q 429,115 436,115 L 444,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M223,89 L 230,89 Q 238,89 238,102 Q 238,115 245,115 L 253,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,168L168,168A15 15 0 0 0 183 153A15 15 0 0 0 168 138L60,138A15 15 0 0 0 45 153A15 15 0 0 0 60 168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">unary-operator</text>
<polygon points="206,153 194,157 194,149" style="fill:rgb(0,0,0)"/>
<path d="M183,153L200,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,168L255,168L255,138L206,138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,153 905,157 905,149" style="fill:rgb(0,0,0)"/>
<path d="M255,153L910,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,153 L 924,153 Q 931,153 931,145 L 931,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,153 33,157 33,149" style="fill:rgb(0,0,0)"/>
<path d="M24,138 L 24,145 Q 24,153 31,153 L 39,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,206L94,206L94,176L45,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,191 106,195 106,186" style="fill:rgb(0,0,0)"/>
<path d="M94,191L111,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,206L245,206A15 15 0 0 0 261 191A15 15 0 0 0 245 176L132,176A15 15 0 0 0 117 191A15 15 0 0 0 132 206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">binary-operator</text>
<polygon points="284,191 272,195 272,186" style="fill:rgb(0,0,0)"/>
<path d="M261,191L278,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,206L333,206L333,176L284,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="308" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,191 905,195 905,186" style="fill:rgb(0,0,0)"/>
<path d="M333,191L910,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,191 L 924,191 Q 931,191 931,183 L 931,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,191 33,195 33,186" style="fill:rgb(0,0,0)"/>
<path d="M24,176 L 24,183 Q 24,191 31,191 L 39,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,245L162,245A15 15 0 0 0 177 230A15 15 0 0 0 162 215L60,215A15 15 0 0 0 45 230A15 15 0 0 0 60 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="111" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-name</text>
<polygon points="194,230 183,234 183,226" style="fill:rgb(0,0,0)"/>
<path d="M177,230L188,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,245A15 15 0 0 0 224 230A15 15 0 0 0 209 215A15 15 0 0 0 194 230A15 15 0 0 0 209 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="260,230 249,234 249,226" style="fill:rgb(0,0,0)"/>
<path d="M224,230L255,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,245L437,245L437,215L260,215Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-arguments</text>
<polygon points="473,230 461,234 461,226" style="fill:rgb(0,0,0)"/>
<path d="M437,230L467,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,245A15 15 0 0 0 503 230A15 15 0 0 0 488 215A15 15 0 0 0 473 230A15 15 0 0 0 488 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="541,260 529,265 529,256" style="fill:rgb(0,0,0)"/>
<path d="M503,230 L 510,230 Q 518,230 518,245 L 518,245 Q 518,260 527,260 L 535,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,275L653,275L653,245L541,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="691,230 680,234 680,226" style="fill:rgb(0,0,0)"/>
<path d="M653,260 L 661,260 Q 668,260 668,245 L 668,245 Q 668,230 677,230 L 685,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="729,260 718,265 718,256" style="fill:rgb(0,0,0)"/>
<path d="M691,230 L 699,230 Q 706,230 706,245 L 706,245 Q 706,260 715,260 L 723,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,275L837,275L837,245L729,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="783" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">over-clause</text>
<polygon points="916,260 905,265 905,256" style="fill:rgb(0,0,0)"/>
<path d="M837,260L910,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,260 L 924,260 Q 931,260 931,253 L 931,245"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,230 33,234 33,226" style="fill:rgb(0,0,0)"/>
<path d="M24,215 L 24,222 Q 24,230 31,230 L 39,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,230 585,234 585,226" style="fill:rgb(0,0,0)"/>
<path d="M503,230L591,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,230L680,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,230 905,234 905,226" style="fill:rgb(0,0,0)"/>
<path d="M691,230L910,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,230 L 924,230 Q 931,230 931,222 L 931,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,321A15 15 0 0 0 75 306A15 15 0 0 0 60 290A15 15 0 0 0 45 306A15 15 0 0 0 60 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,306 100,310 100,301" style="fill:rgb(0,0,0)"/>
<path d="M75,306L105,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M111,321L160,321L160,290L111,290Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="306" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="196,306 185,310 185,301" style="fill:rgb(0,0,0)"/>
<path d="M160,306L191,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,321A15 15 0 0 0 227 306A15 15 0 0 0 211 290A15 15 0 0 0 196 306A15 15 0 0 0 211 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,306 905,310 905,301" style="fill:rgb(0,0,0)"/>
<path d="M227,306L910,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,306 L 924,306 Q 931,306 931,298 L 931,291"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,306 33,310 33,301" style="fill:rgb(0,0,0)"/>
<path d="M24,290 L 24,298 Q 24,306 31,306 L 39,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,284A15 15 0 0 0 151 269A15 15 0 0 0 136 254A15 15 0 0 0 121 269A15 15 0 0 0 136 284Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="269" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="151,269 162,265 162,274" style="fill:rgb(0,0,0)"/>
<path d="M160,306 L 168,306 Q 175,306 175,291 L 175,284 Q 175,269 166,269 L 157,269"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,269 L 103,269 Q 88,269 88,284 L 88,291 Q 88,306 96,306 L 103,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,358L88,358A15 15 0 0 0 103 343A15 15 0 0 0 88 328L60,328A15 15 0 0 0 45 343A15 15 0 0 0 60 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CAST</text>
<polygon points="126,343 114,348 114,339" style="fill:rgb(0,0,0)"/>
<path d="M103,343L120,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M141,358A15 15 0 0 0 156 343A15 15 0 0 0 141 328A15 15 0 0 0 126 343A15 15 0 0 0 141 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="179,343 168,348 168,339" style="fill:rgb(0,0,0)"/>
<path d="M156,343L173,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,358L228,358L228,328L179,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="251,343 240,348 240,339" style="fill:rgb(0,0,0)"/>
<path d="M228,343L246,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,358L271,358A15 15 0 0 0 286 343A15 15 0 0 0 271 328L267,328A15 15 0 0 0 251 343A15 15 0 0 0 267 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="269" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="309,343 297,348 297,339" style="fill:rgb(0,0,0)"/>
<path d="M286,343L303,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,358L408,358L408,328L309,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="358" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="431,343 419,348 419,339" style="fill:rgb(0,0,0)"/>
<path d="M408,343L425,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M446,358A15 15 0 0 0 461 343A15 15 0 0 0 446 328A15 15 0 0 0 431 343A15 15 0 0 0 446 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,343 905,348 905,339" style="fill:rgb(0,0,0)"/>
<path d="M461,343L910,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,343 L 924,343 Q 931,343 931,336 L 931,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,343 33,348 33,339" style="fill:rgb(0,0,0)"/>
<path d="M24,328 L 24,336 Q 24,343 31,343 L 39,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,396L94,396L94,366L45,366Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,381 106,385 106,377" style="fill:rgb(0,0,0)"/>
<path d="M94,381L111,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,396L196,396A15 15 0 0 0 211 381A15 15 0 0 0 196 366L132,366A15 15 0 0 0 117 381A15 15 0 0 0 132 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="234,381 223,385 223,377" style="fill:rgb(0,0,0)"/>
<path d="M211,381L229,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,396L355,396A15 15 0 0 0 370 381A15 15 0 0 0 355 366L250,366A15 15 0 0 0 234 381A15 15 0 0 0 250 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="916,381 905,385 905,377" style="fill:rgb(0,0,0)"/>
<path d="M370,381L910,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,381 L 924,381 Q 931,381 931,374 L 931,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,381 33,385 33,377" style="fill:rgb(0,0,0)"/>
<path d="M24,366 L 24,374 Q 24,381 31,381 L 39,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,434L94,434L94,404L45,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,419 119,423 119,415" style="fill:rgb(0,0,0)"/>
<path d="M94,419L124,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,434L165,434A15 15 0 0 0 180 419A15 15 0 0 0 165 404L145,404A15 15 0 0 0 130 419A15 15 0 0 0 145 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="234,419 223,423 223,415" style="fill:rgb(0,0,0)"/>
<path d="M180,419L229,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,434L273,434A15 15 0 0 0 288 419A15 15 0 0 0 273 404L250,404A15 15 0 0 0 234 419A15 15 0 0 0 250 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIKE</text>
<path d="M250,472L279,472A15 15 0 0 0 294 457A15 15 0 0 0 279 442L250,442A15 15 0 0 0 234 457A15 15 0 0 0 250 472Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="457" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GLOB</text>
<path d="M250,510L302,510A15 15 0 0 0 317 495A15 15 0 0 0 302 479L250,479A15 15 0 0 0 234 495A15 15 0 0 0 250 510Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REGEXP</text>
<path d="M250,547L297,547A15 15 0 0 0 313 532A15 15 0 0 0 297 517L250,517A15 15 0 0 0 234 532A15 15 0 0 0 250 547Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="274" y="532" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<path d="M378,510L427,510L427,479L378,479Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M378,434L427,434L427,404L378,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="465,449 454,454 454,445" style="fill:rgb(0,0,0)"/>
<path d="M427,419 L 435,419 Q 442,419 442,434 L 442,434 Q 442,449 451,449 L 460,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,464L532,464A15 15 0 0 0 547 449A15 15 0 0 0 532 434L480,434A15 15 0 0 0 465 449A15 15 0 0 0 480 464Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="506" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ESCAPE</text>
<polygon points="570,449 559,454 559,445" style="fill:rgb(0,0,0)"/>
<path d="M547,449L565,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M570,464L620,464L620,434L570,434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="595" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="671,419 659,423 659,415" style="fill:rgb(0,0,0)"/>
<path d="M620,449 L 627,449 Q 635,449 635,434 L 635,434 Q 635,419 650,419 L 650,419 L 665,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,419 905,423 905,415" style="fill:rgb(0,0,0)"/>
<path d="M671,419L910,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,419 L 924,419 Q 931,419 931,411 L 931,404"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,419 33,423 33,415" style="fill:rgb(0,0,0)"/>
<path d="M24,404 L 24,411 Q 24,419 31,419 L 39,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M100,419 L 108,419 Q 115,419 115,434 L 115,434 Q 115,449 130,449 L 177,449 Q 192,449 192,434 L 192,434 Q 192,419 199,419 L 207,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,532 223,537 223,528" style="fill:rgb(0,0,0)"/>
<path d="M196,419 L 204,419 Q 211,419 211,434 L 211,517 Q 211,532 220,532 L 229,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,457 223,461 223,452" style="fill:rgb(0,0,0)"/>
<path d="M211,442 L 211,449 Q 211,457 220,457 L 229,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,495 223,499 223,490" style="fill:rgb(0,0,0)"/>
<path d="M211,479 L 211,487 Q 211,495 220,495 L 229,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,419 367,423 367,415" style="fill:rgb(0,0,0)"/>
<path d="M288,419L372,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,532 329,537 329,528" style="fill:rgb(0,0,0)"/>
<path d="M313,532L334,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,495 367,499 367,490" style="fill:rgb(0,0,0)"/>
<path d="M340,532 L 348,532 Q 355,532 355,517 L 355,510 Q 355,495 364,495 L 372,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,495 329,499 329,490" style="fill:rgb(0,0,0)"/>
<path d="M317,495L334,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,495L378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,457 329,461 329,452" style="fill:rgb(0,0,0)"/>
<path d="M294,457L334,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,457 L 348,457 Q 355,457 355,472 L 355,480 Q 355,495 367,495 L 378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="506,419 495,423 495,415" style="fill:rgb(0,0,0)"/>
<path d="M427,419L501,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M506,419L659,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="547,495 536,499 536,490" style="fill:rgb(0,0,0)"/>
<path d="M427,495L542,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,495 L 656,495 Q 671,495 671,480 L 671,434 Q 671,419 686,419 L 692,419 L 707,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,585L94,585L94,555L45,555Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,570 119,574 119,566" style="fill:rgb(0,0,0)"/>
<path d="M94,570L124,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,585L194,585A15 15 0 0 0 209 570A15 15 0 0 0 194 555L145,555A15 15 0 0 0 130 570A15 15 0 0 0 145 585Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="170" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ISNULL</text>
<polygon points="916,570 905,574 905,566" style="fill:rgb(0,0,0)"/>
<path d="M209,570L910,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,570 L 924,570 Q 931,570 931,563 L 931,555"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,570 33,574 33,566" style="fill:rgb(0,0,0)"/>
<path d="M24,555 L 24,563 Q 24,570 31,570 L 39,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,623L215,623A15 15 0 0 0 230 608A15 15 0 0 0 215 593L145,593A15 15 0 0 0 130 608A15 15 0 0 0 145 623Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="608" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTNULL</text>
<path d="M145,661L165,661A15 15 0 0 0 180 646A15 15 0 0 0 165 631L145,631A15 15 0 0 0 130 646A15 15 0 0 0 145 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="203,646 192,650 192,641" style="fill:rgb(0,0,0)"/>
<path d="M180,646L198,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,661L250,661A15 15 0 0 0 265 646A15 15 0 0 0 250 631L219,631A15 15 0 0 0 203 646A15 15 0 0 0 219 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="288,646 276,650 276,641" style="fill:rgb(0,0,0)"/>
<path d="M265,646L282,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="339,570 327,574 327,566" style="fill:rgb(0,0,0)"/>
<path d="M288,646 L 295,646 Q 303,646 303,631 L 303,585 Q 303,570 318,570 L 318,570 L 333,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="288,608 276,612 276,604" style="fill:rgb(0,0,0)"/>
<path d="M230,608L282,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,608 L 295,608 Q 303,608 303,600 L 303,593"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,646 119,650 119,641" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,631 Q 109,646 117,646 L 124,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,608 119,612 119,604" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,593 Q 109,608 117,608 L 124,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,699L94,699L94,668L45,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,684 106,688 106,679" style="fill:rgb(0,0,0)"/>
<path d="M94,684L111,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,699A15 15 0 0 0 147 684A15 15 0 0 0 132 668A15 15 0 0 0 117 684A15 15 0 0 0 132 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IS</text>
<polygon points="183,684 172,688 172,679" style="fill:rgb(0,0,0)"/>
<path d="M147,684L178,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M198,699L219,699A15 15 0 0 0 234 684A15 15 0 0 0 219 668L198,668A15 15 0 0 0 183 684A15 15 0 0 0 198 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="270,684 258,688 258,679" style="fill:rgb(0,0,0)"/>
<path d="M234,684L264,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="306,684 294,688 294,679" style="fill:rgb(0,0,0)"/>
<path d="M270,684L300,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,699L389,699A15 15 0 0 0 404 684A15 15 0 0 0 389 668L321,668A15 15 0 0 0 306 684A15 15 0 0 0 321 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="440,684 429,688 429,679" style="fill:rgb(0,0,0)"/>
<path d="M404,684L434,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,699L490,699A15 15 0 0 0 505 684A15 15 0 0 0 490 668L455,668A15 15 0 0 0 440 684A15 15 0 0 0 455 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="541,684 530,688 530,679" style="fill:rgb(0,0,0)"/>
<path d="M505,684L535,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,699L590,699L590,668L541,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,684 905,688 905,679" style="fill:rgb(0,0,0)"/>
<path d="M590,684L910,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,684 L 924,684 Q 931,684 931,676 L 931,669"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,684 33,688 33,679" style="fill:rgb(0,0,0)"/>
<path d="M24,668 L 24,676 Q 24,684 31,684 L 39,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,684 L 156,684 Q 164,684 164,696 Q 164,708 179,708 L 230,708 Q 245,708 245,696 Q 245,684 253,684 L 260,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,684 L 279,684 Q 286,684 286,696 Q 286,708 301,708 L 502,708 Q 517,708 517,696 Q 517,684 524,684 L 532,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,744L94,744L94,714L45,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,729 119,733 119,725" style="fill:rgb(0,0,0)"/>
<path d="M94,729L124,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,744L165,744A15 15 0 0 0 180 729A15 15 0 0 0 165 714L145,714A15 15 0 0 0 130 729A15 15 0 0 0 145 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,729 205,733 205,725" style="fill:rgb(0,0,0)"/>
<path d="M180,729L211,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,744L304,744A15 15 0 0 0 319 729A15 15 0 0 0 304 714L232,714A15 15 0 0 0 216 729A15 15 0 0 0 232 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="342,729 331,733 331,725" style="fill:rgb(0,0,0)"/>
<path d="M319,729L336,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M342,744L391,744L391,714L342,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="367" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="414,729 403,733 403,725" style="fill:rgb(0,0,0)"/>
<path d="M391,729L409,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M430,744L450,744A15 15 0 0 0 465 729A15 15 0 0 0 450 714L430,714A15 15 0 0 0 414 729A15 15 0 0 0 430 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="488,729 477,733 477,725" style="fill:rgb(0,0,0)"/>
<path d="M465,729L483,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,744L538,744L538,714L488,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="513" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,729 905,733 905,725" style="fill:rgb(0,0,0)"/>
<path d="M538,729L910,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,729 L 924,729 Q 931,729 931,721 L 931,714"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,729 33,733 33,725" style="fill:rgb(0,0,0)"/>
<path d="M24,714 L 24,721 Q 24,729 31,729 L 39,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,729 L 103,729 Q 110,729 110,741 Q 110,753 125,753 L 177,753 Q 192,753 192,741 Q 192,729 199,729 L 207,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,797L94,797L94,767L45,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,782 119,786 119,778" style="fill:rgb(0,0,0)"/>
<path d="M94,782L124,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,797L165,797A15 15 0 0 0 180 782A15 15 0 0 0 165 767L145,767A15 15 0 0 0 130 782A15 15 0 0 0 145 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,782 205,786 205,778" style="fill:rgb(0,0,0)"/>
<path d="M180,782L211,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,797L234,797A15 15 0 0 0 249 782A15 15 0 0 0 234 767L232,767A15 15 0 0 0 216 782A15 15 0 0 0 232 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IN</text>
<polygon points="285,782 273,786 273,778" style="fill:rgb(0,0,0)"/>
<path d="M249,782L279,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,797A15 15 0 0 0 315 782A15 15 0 0 0 300 767A15 15 0 0 0 285 782A15 15 0 0 0 300 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,782 340,786 340,778" style="fill:rgb(0,0,0)"/>
<path d="M315,782L345,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,797L455,797L455,767L351,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="491,782 480,786 480,778" style="fill:rgb(0,0,0)"/>
<path d="M455,782L486,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M507,797A15 15 0 0 0 522 782A15 15 0 0 0 507 767A15 15 0 0 0 491 782A15 15 0 0 0 507 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="507" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,782 905,786 905,778" style="fill:rgb(0,0,0)"/>
<path d="M522,782L910,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,782 L 924,782 Q 931,782 931,774 L 931,767"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,782 33,786 33,778" style="fill:rgb(0,0,0)"/>
<path d="M24,767 L 24,774 Q 24,782 31,782 L 39,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,782 L 103,782 Q 110,782 110,794 Q 110,806 125,806 L 177,806 Q 192,806 192,794 Q 192,782 199,782 L 207,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,782 L 324,782 Q 332,782 332,770 Q 332,758 347,758 L 452,758 Q 467,758 467,770 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M379,835L428,835L428,805L379,805Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="820" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="379,820 367,824 367,815" style="fill:rgb(0,0,0)"/>
<path d="M317,782 L 324,782 Q 332,782 332,797 L 332,805 Q 332,820 347,820 L 358,820 L 373,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M428,820 L 452,820 Q 467,820 467,805 L 467,797 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,873A15 15 0 0 0 418 857A15 15 0 0 0 403 842A15 15 0 0 0 388 857A15 15 0 0 0 403 873Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="857" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,857 430,853 430,862" style="fill:rgb(0,0,0)"/>
<path d="M428,820 L 435,820 Q 443,820 443,835 L 443,842 Q 443,857 434,857 L 424,857"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,857 L 371,857 Q 356,857 356,842 L 356,835 Q 356,820 363,820 L 371,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,925L396,925A15 15 0 0 0 412 910A15 15 0 0 0 396 895L300,895A15 15 0 0 0 285 910A15 15 0 0 0 300 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="429,910 417,915 417,906" style="fill:rgb(0,0,0)"/>
<path d="M412,910L423,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,925A15 15 0 0 0 459 910A15 15 0 0 0 444 895A15 15 0 0 0 429 910A15 15 0 0 0 444 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="513,910 502,915 502,906" style="fill:rgb(0,0,0)"/>
<path d="M459,910L507,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,925L627,925A15 15 0 0 0 642 910A15 15 0 0 0 627 895L528,895A15 15 0 0 0 513 910A15 15 0 0 0 528 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="577" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function</text>
<polygon points="659,910 647,915 647,906" style="fill:rgb(0,0,0)"/>
<path d="M642,910L653,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,925A15 15 0 0 0 689 910A15 15 0 0 0 674 895A15 15 0 0 0 659 910A15 15 0 0 0 674 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="734,910 723,915 723,906" style="fill:rgb(0,0,0)"/>
<path d="M689,910L728,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,925L783,925L783,895L734,895Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="828,910 817,915 817,906" style="fill:rgb(0,0,0)"/>
<path d="M783,910L823,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M844,925A15 15 0 0 0 859 910A15 15 0 0 0 844 895A15 15 0 0 0 828 910A15 15 0 0 0 844 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="844" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,910 905,915 905,906" style="fill:rgb(0,0,0)"/>
<path d="M859,910L910,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,910 L 924,910 Q 931,910 931,903 L 931,895"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,865L603,865A15 15 0 0 0 619 850A15 15 0 0 0 603 835L528,835A15 15 0 0 0 513 850A15 15 0 0 0 528 865Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="850" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="916,850 905,854 905,846" style="fill:rgb(0,0,0)"/>
<path d="M619,850L910,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,850 L 924,850 Q 931,850 931,842 L 931,835"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="513,850 502,854 502,846" style="fill:rgb(0,0,0)"/>
<path d="M475,910 L 483,910 Q 490,910 490,895 L 490,865 Q 490,850 499,850 L 507,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,892A15 15 0 0 0 774 877A15 15 0 0 0 759 862A15 15 0 0 0 744 877A15 15 0 0 0 759 892Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="877" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="774,877 785,873 785,881" style="fill:rgb(0,0,0)"/>
<path d="M783,910 L 791,910 Q 798,910 798,895 L 798,892 Q 798,877 789,877 L 780,877"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M744,877 L 726,877 Q 711,877 711,892 L 711,895 Q 711,910 719,910 L 726,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M689,910 L 697,910 Q 704,910 704,921 Q 704,932 719,932 L 790,932 Q 805,932 805,921 Q 805,910 813,910 L 820,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="285,910 273,915 273,906" style="fill:rgb(0,0,0)"/>
<path d="M249,782 L 256,782 Q 264,782 264,797 L 264,895 Q 264,910 272,910 L 279,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,882 412,886 412,877" style="fill:rgb(0,0,0)"/>
<path d="M264,867 L 264,874 Q 264,882 279,882 L 402,882 L 417,882"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,882 L 456,882 Q 471,882 471,896 Q 471,910 478,910 L 486,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,971L80,971A15 15 0 0 0 95 956A15 15 0 0 0 80 941L60,941A15 15 0 0 0 45 956A15 15 0 0 0 60 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="131,956 120,960 120,951" style="fill:rgb(0,0,0)"/>
<path d="M95,956L125,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,971L191,971A15 15 0 0 0 206 956A15 15 0 0 0 191 941L146,941A15 15 0 0 0 131 956A15 15 0 0 0 146 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="242,956 231,960 231,951" style="fill:rgb(0,0,0)"/>
<path d="M206,956L236,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,971A15 15 0 0 0 272 956A15 15 0 0 0 257 941A15 15 0 0 0 242 956A15 15 0 0 0 257 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="295,956 284,960 284,951" style="fill:rgb(0,0,0)"/>
<path d="M272,956L290,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,971L400,971L400,941L295,941Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="423,956 411,960 411,951" style="fill:rgb(0,0,0)"/>
<path d="M400,956L417,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,971A15 15 0 0 0 453 956A15 15 0 0 0 438 941A15 15 0 0 0 423 956A15 15 0 0 0 438 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,956 905,960 905,951" style="fill:rgb(0,0,0)"/>
<path d="M453,956L910,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,956 L 924,956 Q 931,956 931,948 L 931,941"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,956 33,960 33,951" style="fill:rgb(0,0,0)"/>
<path d="M24,941 L 24,948 Q 24,956 31,956 L 39,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,929 59,934 59,925" style="fill:rgb(0,0,0)"/>
<path d="M24,914 L 24,922 Q 24,929 39,929 L 49,929 L 64,929"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,929 L 201,929 Q 216,929 216,943 Q 216,956 223,956 L 231,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,929 L 101,929 Q 108,929 108,943 Q 108,956 116,956 L 123,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,1009L89,1009A15 15 0 0 0 104 994A15 15 0 0 0 89 978L60,978A15 15 0 0 0 45 994A15 15 0 0 0 60 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASE</text>
<polygon points="140,994 128,998 128,989" style="fill:rgb(0,0,0)"/>
<path d="M104,994L134,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M140,1009L189,1009L189,978L140,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="243,994 232,998 232,989" style="fill:rgb(0,0,0)"/>
<path d="M189,994L237,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,1009L298,1009A15 15 0 0 0 313 994A15 15 0 0 0 298 978L258,978A15 15 0 0 0 243 994A15 15 0 0 0 258 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="336,994 324,998 324,989" style="fill:rgb(0,0,0)"/>
<path d="M313,994L330,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,1009L385,1009L385,978L336,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="408,994 396,998 396,989" style="fill:rgb(0,0,0)"/>
<path d="M385,994L402,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,1009L456,1009A15 15 0 0 0 472 994A15 15 0 0 0 456 978L423,978A15 15 0 0 0 408 994A15 15 0 0 0 423 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">THEN</text>
<polygon points="495,994 483,998 483,989" style="fill:rgb(0,0,0)"/>
<path d="M472,994L489,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M495,1009L544,1009L544,978L495,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="616,994 604,998 604,989" style="fill:rgb(0,0,0)"/>
<path d="M544,994L610,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M631,1009L658,1009A15 15 0 0 0 673 994A15 15 0 0 0 658 978L631,978A15 15 0 0 0 616 994A15 15 0 0 0 631 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="645" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ELSE</text>
<polygon points="696,994 685,998 685,989" style="fill:rgb(0,0,0)"/>
<path d="M673,994L691,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M696,1009L746,1009L746,978L696,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="721" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="782,994 770,998 770,989" style="fill:rgb(0,0,0)"/>
<path d="M746,994L776,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M797,1009L818,1009A15 15 0 0 0 833 994A15 15 0 0 0 818 978L797,978A15 15 0 0 0 782 994A15 15 0 0 0 797 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="807" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="916,994 905,998 905,989" style="fill:rgb(0,0,0)"/>
<path d="M833,994L910,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,994 L 924,994 Q 931,994 931,986 L 931,979"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,994 33,998 33,989" style="fill:rgb(0,0,0)"/>
<path d="M24,978 L 24,986 Q 24,994 31,994 L 39,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,994 L 111,994 Q 119,994 119,1007 Q 119,1021 134,1021 L 186,1021 Q 201,1021 201,1007 Q 201,994 208,994 L 216,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="360,1021 372,1016 372,1025" style="fill:rgb(0,0,0)"/>
<path d="M544,994 L 551,994 Q 559,994 559,1007 Q 559,1021 544,1021 L 381,1021 L 366,1021"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,1021 L 235,1021 Q 220,1021 220,1007 Q 220,994 227,994 L 235,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,994 L 585,994 Q 593,994 593,1007 Q 593,1021 608,1021 L 742,1021 Q 757,1021 757,1007 Q 757,994 765,994 L 772,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,1066L173,1066L173,1036L45,1036Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="1051" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">raise-function</text>
<polygon points="916,1051 905,1055 905,1047" style="fill:rgb(0,0,0)"/>
<path d="M173,1051L910,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,1051 L 924,1051 Q 931,1051 931,1036 L 931,32 Q 931,17 939,17 L 946,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,1051 33,1055 33,1047" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,1036 Q 24,1051 31,1051 L 39,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/filter-clause.html">filter-clause:</a></b>
<button id='x69c6ba47' onclick='hideorshow("x69c6ba47","x4343fb45")'>show</button></p>
 <div id='x4343fb45' style='display:none;' class='imgcontainer'>
 <div style="max-width:422px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 422.381 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L93,32A15 15 0 0 0 108 17A15 15 0 0 0 93 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FILTER</text>
<polygon points="131,17 119,21 119,12" style="fill:rgb(0,0,0)"/>
<path d="M108,17L125,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,32L146,32A15 15 0 0 0 161 17A15 15 0 0 0 146 2L146,2A15 15 0 0 0 131 17A15 15 0 0 0 146 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="184,17 173,21 173,12" style="fill:rgb(0,0,0)"/>
<path d="M161,17L178,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M199,32L249,32A15 15 0 0 0 264 17A15 15 0 0 0 249 2L199,2A15 15 0 0 0 184 17A15 15 0 0 0 199 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="224" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="287,17 275,21 275,12" style="fill:rgb(0,0,0)"/>
<path d="M264,17L281,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,32L336,32L336,2L287,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M336,17L353,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,32A15 15 0 0 0 389 17A15 15 0 0 0 374 2A15 15 0 0 0 359 17A15 15 0 0 0 374 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="374" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="413,17 401,21 401,12" style="fill:rgb(0,0,0)"/>
<path d="M389,17L407,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="416" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/function-arguments.html">function-arguments:</a></b>
<button id='xa5c64c13' onclick='hideorshow("xa5c64c13","x26dbf92a")'>show</button></p>
 <div id='x26dbf92a' style='display:none;' class='imgcontainer'>
 <div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.566 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,26 55,30 55,22" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,41 L 43,41 Q 43,26 52,26 L 61,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M82,41L150,41A15 15 0 0 0 165 26L165,26A15 15 0 0 0 150 11L82,11A15 15 0 0 0 66 26L66,26A15 15 0 0 0 82 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="183,26 171,30 171,22" style="fill:rgb(0,0,0)"/>
<path d="M165,26L177,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M183,26 L 189,26 Q 194,26 194,41 L 194,41 Q 194,56 203,56 L 212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M218,56L248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,71L303,71L303,41L254,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="447,56 435,60 435,52" style="fill:rgb(0,0,0)"/>
<path d="M303,56L441,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="116,56 104,60 104,52" style="fill:rgb(0,0,0)"/>
<path d="M32,56L110,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M116,56L212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,32A15 15 0 0 0 293 17A15 15 0 0 0 278 2A15 15 0 0 0 263 17A15 15 0 0 0 278 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="293,17 305,12 305,21" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 314,56 Q 326,56 326,41 L 326,32 Q 326,17 312,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M263,17 L 245,17 Q 230,17 230,32 L 230,41 Q 230,56 239,56 L 248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,207A15 15 0 0 0 243 192L243,192A15 15 0 0 0 228 177A15 15 0 0 0 213 192L213,192A15 15 0 0 0 228 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="213,192 201,196 201,188" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,71 L 43,177 Q 43,192 58,192 L 192,192 L 207,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,192 267,196 267,188" style="fill:rgb(0,0,0)"/>
<path d="M243,192L272,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,192 L 360,192 Q 375,192 390,192 L 394,192 Q 409,192 409,177 L 409,71 Q 409,56 415,56 L 421,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="228,216 216,221 216,212" style="fill:rgb(0,0,0)"/>
<path d="M116,192 L 181,192 Q 196,192 196,204 Q 196,216 209,216 L 222,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,216 L 242,216 Q 257,216 257,204 Q 257,192 262,192 L 268,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="90,117 78,121 78,112" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 313,56 Q 323,56 323,71 L 323,71 Q 323,86 308,86 L 81,86 Q 66,86 66,101 L 66,102 Q 66,117 75,117 L 84,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,132L149,132A15 15 0 0 0 164 117L164,117A15 15 0 0 0 149 101L105,101A15 15 0 0 0 90 117L90,117A15 15 0 0 0 105 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="182,117 170,121 170,112" style="fill:rgb(0,0,0)"/>
<path d="M164,117L176,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,132L201,132A15 15 0 0 0 216 117L216,117A15 15 0 0 0 201 101L197,101A15 15 0 0 0 182 117L182,117A15 15 0 0 0 197 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M216,117L239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,132L375,132L375,101L245,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,169A15 15 0 0 0 325 154A15 15 0 0 0 310 139A15 15 0 0 0 294 154A15 15 0 0 0 310 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,154 336,150 336,159" style="fill:rgb(0,0,0)"/>
<path d="M375,117 L 380,117 Q 386,117 386,132 L 386,139 Q 386,154 371,154 L 345,154 L 330,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M294,154 L 260,154 Q 245,154 236,154 Q 227,154 227,139 L 227,132 Q 227,117 233,117 L 239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M375,117 L 383,117 Q 392,117 392,102 L 392,71 Q 392,56 407,56 L 413,56 L 428,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='xb5c6a0ba' onclick='hideorshow("xb5c6a0ba","xc497bbc7")'>show</button></p>
 <div id='xc497bbc7' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/literal-value.html">literal-value:</a></b>
<button id='x7ca5acb4' onclick='hideorshow("x7ca5acb4","x3c27e219")'>show</button></p>
 <div id='x3c27e219' style='display:none;' class='imgcontainer'>
 <div style="max-width:341px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 341.376 336.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,319 39,324 39,315" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,304 Q 24,319 34,319 L 45,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,334L252,334A15 15 0 0 0 267 319A15 15 0 0 0 252 304L65,304A15 15 0 0 0 50 319A15 15 0 0 0 65 334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIMESTAMP</text>
<polygon points="290,319 278,324 278,315" style="fill:rgb(0,0,0)"/>
<path d="M267,319L284,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,17 320,21 320,12" style="fill:rgb(0,0,0)"/>
<path d="M290,319 L 297,319 Q 305,319 305,304 L 305,32 Q 305,17 315,17 L 326,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="335" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L172,32A15 15 0 0 0 187 17A15 15 0 0 0 172 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="119" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,17L320,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L153,70A15 15 0 0 0 168 55L168,55A15 15 0 0 0 153 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">string-literal</text>
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,47 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,55 278,59 278,50" style="fill:rgb(0,0,0)"/>
<path d="M168,55L284,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,55 L 297,55 Q 305,55 305,47 L 305,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L140,108A15 15 0 0 0 155 92A15 15 0 0 0 140 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">blob-literal</text>
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,85 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,92 278,97 278,88" style="fill:rgb(0,0,0)"/>
<path d="M155,92L284,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,92 L 297,92 Q 305,92 305,85 L 305,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,145L97,145A15 15 0 0 0 112 130A15 15 0 0 0 97 115L66,115A15 15 0 0 0 50 130A15 15 0 0 0 66 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="50,130 39,135 39,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 34,130 L 45,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,130 278,135 278,126" style="fill:rgb(0,0,0)"/>
<path d="M112,130L284,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,130 L 297,130 Q 305,130 305,123 L 305,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,183L96,183A15 15 0 0 0 111 168A15 15 0 0 0 96 153L66,153A15 15 0 0 0 50 168A15 15 0 0 0 66 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRUE</text>
<polygon points="50,168 39,172 39,164" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,160 Q 24,168 34,168 L 45,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,168 278,172 278,164" style="fill:rgb(0,0,0)"/>
<path d="M111,168L284,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,168 L 297,168 Q 305,168 305,160 L 305,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,221L104,221A15 15 0 0 0 119 206A15 15 0 0 0 104 191L66,191A15 15 0 0 0 50 206A15 15 0 0 0 66 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FALSE</text>
<polygon points="50,206 39,210 39,201" style="fill:rgb(0,0,0)"/>
<path d="M24,191 L 24,198 Q 24,206 34,206 L 45,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,206 278,210 278,201" style="fill:rgb(0,0,0)"/>
<path d="M119,206L284,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,206 L 297,206 Q 305,206 305,198 L 305,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,259L190,259A15 15 0 0 0 205 244A15 15 0 0 0 190 228L66,228A15 15 0 0 0 50 244A15 15 0 0 0 66 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="128" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIME</text>
<polygon points="50,244 39,248 39,239" style="fill:rgb(0,0,0)"/>
<path d="M24,228 L 24,236 Q 24,244 34,244 L 45,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,244 278,248 278,239" style="fill:rgb(0,0,0)"/>
<path d="M205,244L284,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,244 L 297,244 Q 305,244 305,236 L 305,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,297L192,297A15 15 0 0 0 207 281A15 15 0 0 0 192 266L66,266A15 15 0 0 0 50 281A15 15 0 0 0 66 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_DATE</text>
<polygon points="50,281 39,286 39,277" style="fill:rgb(0,0,0)"/>
<path d="M24,266 L 24,274 Q 24,281 34,281 L 45,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,281 278,286 278,277" style="fill:rgb(0,0,0)"/>
<path d="M207,281L284,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,281 L 297,281 Q 305,281 305,274 L 305,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/over-clause.html">over-clause:</a></b>
<button id='x44ce23b4' onclick='hideorshow("x44ce23b4","xe9f396a1")'>show</button></p>
 <div id='xe9f396a1' style='display:none;' class='imgcontainer'>
 <div style="max-width:600px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 600.706 418.392">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="129,17 117,21 117,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L123,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M144,32L241,32A15 15 0 0 0 256 17A15 15 0 0 0 241 2L144,2A15 15 0 0 0 129 17A15 15 0 0 0 144 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,17 L 100,17 Q 108,17 108,32 L 108,40 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,70A15 15 0 0 0 165 55L165,55A15 15 0 0 0 149 39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 149 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="149" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="206,82 195,86 195,77" style="fill:rgb(0,0,0)"/>
<path d="M165,55 L 172,55 Q 180,55 180,68 Q 180,82 190,82 L 200,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,97L363,97A15 15 0 0 0 378 82A15 15 0 0 0 363 67L221,67A15 15 0 0 0 206 82A15 15 0 0 0 221 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="292" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M221,173L301,173A15 15 0 0 0 316 157A15 15 0 0 0 301 142L221,142A15 15 0 0 0 206 157A15 15 0 0 0 221 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="339,157 328,162 328,153" style="fill:rgb(0,0,0)"/>
<path d="M316,157L333,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,173L358,173A15 15 0 0 0 373 157A15 15 0 0 0 358 142L354,142A15 15 0 0 0 339 157A15 15 0 0 0 354 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="409,157 398,162 398,153" style="fill:rgb(0,0,0)"/>
<path d="M373,157L404,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,173L459,173L459,142L409,142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M434,210A15 15 0 0 0 449 195A15 15 0 0 0 434 180A15 15 0 0 0 419 195A15 15 0 0 0 434 210Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="195" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="449,195 461,191 461,200" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,180 Q 474,195 464,195 L 455,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,195 L 398,195 Q 383,195 383,180 L 383,172 Q 383,157 390,157 L 398,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,55 280,59 280,50" style="fill:rgb(0,0,0)"/>
<path d="M165,55L286,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,120 304,115 304,124" style="fill:rgb(0,0,0)"/>
<path d="M292,55 L 401,55 Q 416,55 416,70 L 416,105 Q 416,120 401,120 L 313,120 L 298,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,157 195,162 195,153" style="fill:rgb(0,0,0)"/>
<path d="M292,120 L 180,120 Q 165,120 165,135 L 165,142 Q 165,157 180,157 L 185,157 L 200,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="401,82 389,86 389,77" style="fill:rgb(0,0,0)"/>
<path d="M378,82L395,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,82 L 408,82 Q 416,82 416,89 L 416,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,286L266,286A15 15 0 0 0 281 271A15 15 0 0 0 266 256L221,256A15 15 0 0 0 206 271A15 15 0 0 0 221 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="244" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="304,271 292,275 292,266" style="fill:rgb(0,0,0)"/>
<path d="M281,271L298,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M319,286L323,286A15 15 0 0 0 338 271A15 15 0 0 0 323 256L319,256A15 15 0 0 0 304 271A15 15 0 0 0 319 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="321" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="374,271 363,275 363,266" style="fill:rgb(0,0,0)"/>
<path d="M338,271L368,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,286L504,286L504,256L374,256Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M439,324A15 15 0 0 0 454 309A15 15 0 0 0 439 293A15 15 0 0 0 424 309A15 15 0 0 0 439 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="454,309 466,304 466,313" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,294 Q 519,309 504,309 L 475,309 L 460,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,309 L 363,309 Q 348,309 348,294 L 348,286 Q 348,271 355,271 L 363,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,233 304,229 304,237" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,218 Q 474,233 459,233 L 313,233 L 298,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,271 195,275 195,266" style="fill:rgb(0,0,0)"/>
<path d="M292,233 L 180,233 Q 165,233 165,248 L 165,256 Q 165,271 180,271 L 185,271 L 200,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,195 160,184 169,184" style="fill:rgb(0,0,0)"/>
<path d="M165,142L165,189"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,195L165,256"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,399L311,399L311,369L206,369Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="384" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="519,384 508,389 508,380" style="fill:rgb(0,0,0)"/>
<path d="M311,384L513,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M534,399A15 15 0 0 0 549 384A15 15 0 0 0 534 369A15 15 0 0 0 519 384A15 15 0 0 0 534 399Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="384" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="591,17 579,21 579,12" style="fill:rgb(0,0,0)"/>
<path d="M549,384 L 557,384 Q 564,384 564,369 L 564,32 Q 564,17 575,17 L 585,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="594" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,17 508,21 508,12" style="fill:rgb(0,0,0)"/>
<path d="M256,17L513,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,17L579,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,346 304,342 304,351" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,331 Q 519,346 504,346 L 313,346 L 298,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,384 195,389 195,380" style="fill:rgb(0,0,0)"/>
<path d="M292,346 L 180,346 Q 165,346 165,361 L 165,369 Q 165,384 180,384 L 185,384 L 200,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,309 160,297 169,297" style="fill:rgb(0,0,0)"/>
<path d="M165,256L165,303"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,309L165,369"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="258,411 247,416 247,407" style="fill:rgb(0,0,0)"/>
<path d="M165,369 L 165,396 Q 165,411 180,411 L 238,411 L 253,411"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,384 369,389 369,380" style="fill:rgb(0,0,0)"/>
<path d="M258,411 L 335,411 Q 350,411 350,398 Q 350,384 362,384 L 375,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x684f2ea3' onclick='hideorshow("x684f2ea3","x87b74816")'>show</button></p>
 <div id='x87b74816' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x2b7ead58' onclick='hideorshow("x2b7ead58","xd8cb6765")'>show</button></p>
 <div id='xd8cb6765' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/raise-function.html">raise-function:</a></b>
<button id='xb49f59d4' onclick='hideorshow("xb49f59d4","x5b29b1f1")'>show</button></p>
 <div id='x5b29b1f1' style='display:none;' class='imgcontainer'>
 <div style="max-width:627px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 627.302 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L82,32A15 15 0 0 0 97 17A15 15 0 0 0 82 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RAISE</text>
<polygon points="120,17 109,21 109,12" style="fill:rgb(0,0,0)"/>
<path d="M97,17L114,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,32L135,32A15 15 0 0 0 150 17A15 15 0 0 0 135 2L135,2A15 15 0 0 0 120 17A15 15 0 0 0 135 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="135" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="192,55 180,59 180,50" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 158,17 Q 165,17 165,32 L 165,40 Q 165,55 176,55 L 186,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,70L285,70A15 15 0 0 0 300 55L300,55A15 15 0 0 0 285 39L207,39A15 15 0 0 0 192 55L192,55A15 15 0 0 0 207 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="336,55 324,59 324,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70A15 15 0 0 0 366 55L366,55A15 15 0 0 0 351 39A15 15 0 0 0 336 55L336,55A15 15 0 0 0 351 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="389,55 378,59 378,50" style="fill:rgb(0,0,0)"/>
<path d="M366,55L383,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,70L508,70A15 15 0 0 0 523 55L523,55A15 15 0 0 0 508 39L404,39A15 15 0 0 0 389 55L389,55A15 15 0 0 0 404 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="456" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">error-message</text>
<polygon points="564,17 553,21 553,12" style="fill:rgb(0,0,0)"/>
<path d="M523,55 L 530,55 Q 538,55 538,40 L 538,32 Q 538,17 548,17 L 558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M579,32A15 15 0 0 0 594 17A15 15 0 0 0 579 2A15 15 0 0 0 564 17A15 15 0 0 0 579 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="617,17 606,21 606,12" style="fill:rgb(0,0,0)"/>
<path d="M594,17L612,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="621" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L259,32A15 15 0 0 0 274 17A15 15 0 0 0 259 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="456,17 444,21 444,12" style="fill:rgb(0,0,0)"/>
<path d="M274,17L450,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,17L553,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,108L249,108A15 15 0 0 0 264 92A15 15 0 0 0 249 77L207,77A15 15 0 0 0 192 92A15 15 0 0 0 207 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="300,92 288,97 288,88" style="fill:rgb(0,0,0)"/>
<path d="M264,92L294,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,92 L 307,92 Q 315,92 315,77 L 315,70 Q 315,55 322,55 L 330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,145L229,145A15 15 0 0 0 244 130A15 15 0 0 0 229 115L207,115A15 15 0 0 0 192 130A15 15 0 0 0 207 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="300,130 288,135 288,126" style="fill:rgb(0,0,0)"/>
<path d="M244,130L294,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,130 L 307,130 Q 315,130 315,115 L 315,92 L 315,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,130 180,135 180,126" style="fill:rgb(0,0,0)"/>
<path d="M165,39 L 165,115 Q 165,130 176,130 L 186,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,92 180,97 180,88" style="fill:rgb(0,0,0)"/>
<path d="M165,77 L 165,85 Q 165,92 176,92 L 186,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/type-name.html">type-name:</a></b>
<button id='x5b985495' onclick='hideorshow("x5b985495","xd8b95e57")'>show</button></p>
 <div id='xd8b95e57' style='display:none;' class='imgcontainer'>
 <div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.008 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L87,32A15 15 0 0 0 102 17A15 15 0 0 0 87 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="165,92 153,97 153,88" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,77 Q 138,92 149,92 L 159,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,108A15 15 0 0 0 195 92A15 15 0 0 0 180 77A15 15 0 0 0 165 92A15 15 0 0 0 180 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,92 201,97 201,88" style="fill:rgb(0,0,0)"/>
<path d="M195,92L207,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,108L350,108L350,77L212,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,92 356,97 356,88" style="fill:rgb(0,0,0)"/>
<path d="M350,92L362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,108A15 15 0 0 0 398 92A15 15 0 0 0 382 77A15 15 0 0 0 367 92A15 15 0 0 0 382 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="415,92 403,97 403,88" style="fill:rgb(0,0,0)"/>
<path d="M398,92L409,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,108L553,108L553,77L415,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="570,92 558,97 558,88" style="fill:rgb(0,0,0)"/>
<path d="M553,92L564,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,108A15 15 0 0 0 600 92A15 15 0 0 0 585 77A15 15 0 0 0 570 92A15 15 0 0 0 585 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="585" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="651,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M600,92 L 608,92 Q 615,92 615,77 L 615,32 Q 615,17 630,17 L 630,17 L 645,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,40 Q 138,55 149,55 L 159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70A15 15 0 0 0 195 55L195,55A15 15 0 0 0 180 39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,55 201,59 201,50" style="fill:rgb(0,0,0)"/>
<path d="M195,55L207,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,70L350,70L350,39L212,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,55 356,59 356,50" style="fill:rgb(0,0,0)"/>
<path d="M350,55L362,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,70A15 15 0 0 0 398 55L398,55A15 15 0 0 0 382 39A15 15 0 0 0 367 55L367,55A15 15 0 0 0 382 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="600,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M398,55L594,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M600,55 L 608,55 Q 615,55 615,47 L 615,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="74,47 85,43 85,51" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 110,17 Q 117,17 117,32 L 117,32 Q 117,47 102,47 L 94,47 L 79,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47 L 33,47 Q 18,47 18,32 L 18,32 Q 18,17 26,17 L 33,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="382,17 371,21 371,12" style="fill:rgb(0,0,0)"/>
<path d="M102,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,17L630,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='xafaf068d' onclick='hideorshow("xafaf068d","x7a579250")'>show</button></p>
 <div id='x7a579250' style='display:none;' class='imgcontainer'>
 <div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/returning-clause.html">returning-clause:</a></b>
<button id='xf51d094b' onclick='hideorshow("xf51d094b","xb402ebf3")'>show</button></p>
 <div id='xb402ebf3' style='display:none;' class='imgcontainer'>
 <div style="max-width:628px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 628.709 140.4">
<circle cx="5" cy="47" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="27,47 15,51 15,43" style="fill:rgb(0,0,0)"/>
<path d="M9,47L21,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M42,62L132,62A15 15 0 0 0 147 47A15 15 0 0 0 132 32L42,32A15 15 0 0 0 27 47A15 15 0 0 0 42 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RETURNING</text>
<polygon points="237,47 226,51 226,43" style="fill:rgb(0,0,0)"/>
<path d="M147,47L232,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M237,62L287,62L287,32L237,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="262" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="328,77 317,82 317,73" style="fill:rgb(0,0,0)"/>
<path d="M287,47 L 294,47 Q 302,47 302,62 L 302,62 Q 302,77 312,77 L 322,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M343,92L347,92A15 15 0 0 0 362 77L362,77A15 15 0 0 0 347 62L343,62A15 15 0 0 0 328 77L328,77A15 15 0 0 0 343 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="398,77 387,82 387,73" style="fill:rgb(0,0,0)"/>
<path d="M362,77L393,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M414,92L501,92A15 15 0 0 0 516 77L516,77A15 15 0 0 0 501 62L414,62A15 15 0 0 0 398 77L398,77A15 15 0 0 0 414 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="457" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="539,77 528,82 528,73" style="fill:rgb(0,0,0)"/>
<path d="M516,77L534,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="581,47 569,51 569,43" style="fill:rgb(0,0,0)"/>
<path d="M539,77 L 547,77 Q 554,77 554,62 L 554,62 Q 554,47 565,47 L 575,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="619,47 607,51 607,43" style="fill:rgb(0,0,0)"/>
<path d="M581,47L613,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="622" cy="47" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="345,101 334,106 334,97" style="fill:rgb(0,0,0)"/>
<path d="M302,62 L 302,86 Q 302,101 317,101 L 325,101 L 340,101"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,101 L 362,101 Q 377,101 377,89 Q 377,77 385,77 L 392,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="453,47 441,51 441,43" style="fill:rgb(0,0,0)"/>
<path d="M287,47L447,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,47L607,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,138A15 15 0 0 0 406 123A15 15 0 0 0 391 108A15 15 0 0 0 376 123A15 15 0 0 0 391 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="391" y="123" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="376,123 365,127 365,118" style="fill:rgb(0,0,0)"/>
<path d="M147,47 L 196,47 Q 211,47 211,62 L 211,108 Q 211,123 226,123 L 355,123 L 370,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="539,123 528,127 528,118" style="fill:rgb(0,0,0)"/>
<path d="M406,123L534,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,123 L 547,123 Q 554,123 554,108 L 554,77 L 554,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,32A15 15 0 0 0 406 17A15 15 0 0 0 391 2A15 15 0 0 0 376 17A15 15 0 0 0 391 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="391" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="406,17 418,12 418,21" style="fill:rgb(0,0,0)"/>
<path d="M581,47 L 588,47 Q 596,47 596,32 L 596,32 Q 596,17 581,17 L 427,17 L 412,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="186,47 174,51 174,43" style="fill:rgb(0,0,0)"/>
<path d="M376,17 L 174,17 Q 159,17 159,32 L 159,32 Q 159,47 169,47 L 180,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/select-stmt.html">select-stmt:</a></b>
<button id='x988545d7' onclick='hideorshow("x988545d7","x10c939ad")'>show</button></p>
 <div id='x10c939ad' style='display:none;' class='imgcontainer'>
 <div style="max-width:669px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 669.677 1162.3">
<path d="M55,845L667,845L667,99L55,99Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="6" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="46,17 34,21 34,12" style="fill:rgb(0,0,0)"/>
<path d="M10,17L40,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M61,32L92,32A15 15 0 0 0 107 17A15 15 0 0 0 92 2L61,2A15 15 0 0 0 46 17A15 15 0 0 0 61 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="76" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M167,62L253,62A15 15 0 0 0 268 47L268,47A15 15 0 0 0 253 32L167,32A15 15 0 0 0 152 47L152,47A15 15 0 0 0 167 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="210,17 198,21 198,12" style="fill:rgb(0,0,0)"/>
<path d="M107,17L204,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M210,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M358,32L584,32L584,2L358,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="152,47 140,51 140,43" style="fill:rgb(0,0,0)"/>
<path d="M107,17 L 114,17 Q 122,17 122,32 L 122,32 Q 122,47 134,47 L 146,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="291,47 279,51 279,43" style="fill:rgb(0,0,0)"/>
<path d="M268,47L285,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,47 L 298,47 Q 306,47 306,32 L 306,32 Q 306,17 321,17 L 331,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,70A15 15 0 0 0 486 55L486,55A15 15 0 0 0 471 39A15 15 0 0 0 456 55L456,55A15 15 0 0 0 471 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="486,55 498,50 498,59" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,40 Q 599,55 584,55 L 507,55 L 492,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,55 L 350,55 Q 335,55 335,40 L 335,32 Q 335,17 340,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,83 307,79 307,88" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,68 Q 599,83 584,83 L 316,83 L 301,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,83 L 40,83 Q 25,83 25,98 L 25,113"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="25,47 20,36 29,36" style="fill:rgb(0,0,0)"/>
<path d="M10,17 L 17,17 Q 25,17 25,29 L 25,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="55,129 43,133 43,124" style="fill:rgb(0,0,0)"/>
<path d="M25,47 L 25,114 Q 25,129 37,129 L 49,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,129 115,133 115,124" style="fill:rgb(0,0,0)"/>
<path d="M55,129L121,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,144L193,144A15 15 0 0 0 208 129A15 15 0 0 0 193 114L142,114A15 15 0 0 0 127 129A15 15 0 0 0 142 144Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="250,159 238,163 238,155" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,144 Q 223,159 233,159 L 244,159"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,174L333,174A15 15 0 0 0 348 159A15 15 0 0 0 333 144L265,144A15 15 0 0 0 250 159A15 15 0 0 0 265 174Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="159" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="417,129 406,133 406,124" style="fill:rgb(0,0,0)"/>
<path d="M348,159 L 356,159 Q 363,159 363,144 L 363,144 Q 363,129 378,129 L 396,129 L 411,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,144L545,144L545,114L417,114Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M481,182A15 15 0 0 0 496 166A15 15 0 0 0 481 151A15 15 0 0 0 466 166A15 15 0 0 0 481 182Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="166" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="496,166 508,162 508,171" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,151 Q 560,166 545,166 L 517,166 L 502,166"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M466,166 L 406,166 Q 391,166 391,151 L 391,144 Q 391,129 398,129 L 406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,129 287,133 287,124" style="fill:rgb(0,0,0)"/>
<path d="M208,129L293,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M299,129L406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,212L280,212A15 15 0 0 0 295 197A15 15 0 0 0 280 182L265,182A15 15 0 0 0 250 197A15 15 0 0 0 265 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="197" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="348,197 337,201 337,192" style="fill:rgb(0,0,0)"/>
<path d="M295,197L342,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,197 L 356,197 Q 363,197 363,182 L 363,159 L 363,144"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="250,197 238,201 238,192" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,182 Q 223,197 233,197 L 244,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,287L203,287A15 15 0 0 0 218 272A15 15 0 0 0 203 257L168,257A15 15 0 0 0 153 272A15 15 0 0 0 168 287Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="186" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="290,272 279,277 279,268" style="fill:rgb(0,0,0)"/>
<path d="M218,272L284,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,287L451,287L451,257L290,257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M320,362L422,362L422,331L320,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M371,324A15 15 0 0 0 386 309A15 15 0 0 0 371 293A15 15 0 0 0 356 309A15 15 0 0 0 371 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="386,309 397,304 397,313" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 459,272 Q 466,272 466,287 L 466,294 Q 466,309 451,309 L 407,309 L 392,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M356,309 L 279,309 Q 264,309 264,294 L 264,287 Q 264,272 271,272 L 279,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="320,346 308,351 308,342" style="fill:rgb(0,0,0)"/>
<path d="M218,272 L 226,272 Q 233,272 233,287 L 233,331 Q 233,346 248,346 L 299,346 L 314,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="484,313 488,325 480,325" style="fill:rgb(0,0,0)"/>
<path d="M422,346 L 436,346 Q 451,346 466,346 L 469,346 Q 484,346 484,333 L 484,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,272 494,277 494,268" style="fill:rgb(0,0,0)"/>
<path d="M484,313 L 484,287 Q 484,272 492,272 L 499,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,272 L 496,272 Q 487,272 487,272 Q 487,272 495,272 L 502,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,197 555,185 564,185" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,176 L 560,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,235 360,230 360,239" style="fill:rgb(0,0,0)"/>
<path d="M560,197 L 560,220 Q 560,235 545,235 L 369,235 L 354,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,272 142,277 142,268" style="fill:rgb(0,0,0)"/>
<path d="M348,235 L 142,235 Q 127,235 127,250 L 127,257 Q 127,272 137,272 L 147,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,437L218,437A15 15 0 0 0 233 422A15 15 0 0 0 218 407L168,407A15 15 0 0 0 153 422A15 15 0 0 0 168 437Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="256,422 244,426 244,418" style="fill:rgb(0,0,0)"/>
<path d="M233,422L250,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,437L305,437L305,407L256,407Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="517,324 513,312 521,312" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 502,272 Q 517,272 517,287 L 517,303 L 517,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,384 382,380 382,389" style="fill:rgb(0,0,0)"/>
<path d="M517,324 L 517,369 Q 517,384 502,384 L 391,384 L 376,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,422 142,426 142,418" style="fill:rgb(0,0,0)"/>
<path d="M371,384 L 142,384 Q 127,384 127,399 L 127,407 Q 127,422 137,422 L 147,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,324 122,312 131,312" style="fill:rgb(0,0,0)"/>
<path d="M127,257L127,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,324L127,407"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,535L212,535A15 15 0 0 0 227 520A15 15 0 0 0 212 505L168,505A15 15 0 0 0 153 520A15 15 0 0 0 168 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="250,520 238,525 238,516" style="fill:rgb(0,0,0)"/>
<path d="M227,520L244,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,535L269,535A15 15 0 0 0 284 520A15 15 0 0 0 269 505L265,505A15 15 0 0 0 250 520A15 15 0 0 0 265 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="320,520 309,525 309,516" style="fill:rgb(0,0,0)"/>
<path d="M284,520L314,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,535L369,535L369,505L320,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="452,520 441,525 441,516" style="fill:rgb(0,0,0)"/>
<path d="M369,520L446,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,535L520,535A15 15 0 0 0 535 520A15 15 0 0 0 520 505L467,505A15 15 0 0 0 452 520A15 15 0 0 0 467 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="558,520 546,525 546,516" style="fill:rgb(0,0,0)"/>
<path d="M535,520L552,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,535L607,535L607,505L558,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M345,573A15 15 0 0 0 360 558A15 15 0 0 0 345 543A15 15 0 0 0 330 558A15 15 0 0 0 345 573Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="558" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="360,558 371,554 371,562" style="fill:rgb(0,0,0)"/>
<path d="M369,520 L 377,520 Q 384,520 384,535 L 384,543 Q 384,558 375,558 L 366,558"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,558 L 309,558 Q 294,558 294,543 L 294,535 Q 294,520 301,520 L 309,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="514,551 503,555 503,546" style="fill:rgb(0,0,0)"/>
<path d="M411,520 L 418,520 Q 426,520 426,535 L 426,536 Q 426,551 441,551 L 493,551 L 508,551"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M514,551 L 607,551 Q 622,551 622,536 L 622,535 Q 622,520 630,520 L 637,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,490 256,494 256,486" style="fill:rgb(0,0,0)"/>
<path d="M127,460 L 127,475 Q 127,490 142,490 L 246,490 L 261,490"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,520 399,525 399,516" style="fill:rgb(0,0,0)"/>
<path d="M267,490 L 369,490 Q 384,490 384,505 L 384,505 Q 384,520 395,520 L 405,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,460 244,455 244,464" style="fill:rgb(0,0,0)"/>
<path d="M305,422 L 313,422 Q 320,422 320,437 L 320,445 Q 320,460 305,460 L 254,460 L 239,460"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,520 142,525 142,516" style="fill:rgb(0,0,0)"/>
<path d="M233,460 L 142,460 Q 127,460 127,475 L 127,505 Q 127,520 137,520 L 147,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,447 122,435 131,435" style="fill:rgb(0,0,0)"/>
<path d="M127,407L127,441"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,447L127,505"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,649L232,649A15 15 0 0 0 247 634A15 15 0 0 0 232 619L168,619A15 15 0 0 0 153 634A15 15 0 0 0 168 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="200" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="283,634 271,638 271,629" style="fill:rgb(0,0,0)"/>
<path d="M247,634L277,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,649L395,649A15 15 0 0 0 410 634A15 15 0 0 0 395 619L298,619A15 15 0 0 0 283 634A15 15 0 0 0 298 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="433,634 422,638 422,629" style="fill:rgb(0,0,0)"/>
<path d="M410,634L427,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,649L452,649A15 15 0 0 0 467 634A15 15 0 0 0 452 619L448,619A15 15 0 0 0 433 634A15 15 0 0 0 448 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="450" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="490,634 479,638 479,629" style="fill:rgb(0,0,0)"/>
<path d="M467,634L485,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,649L609,649L609,619L490,619Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="550" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M446,687A15 15 0 0 0 461 671A15 15 0 0 0 446 656A15 15 0 0 0 431 671A15 15 0 0 0 446 687Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="671" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="461,671 472,667 472,676" style="fill:rgb(0,0,0)"/>
<path d="M609,634 L 616,634 Q 624,634 624,649 L 624,656 Q 624,671 609,671 L 482,671 L 467,671"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,671 L 271,671 Q 256,671 256,656 L 256,649 Q 256,634 264,634 L 271,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="624,692 619,680 628,680" style="fill:rgb(0,0,0)"/>
<path d="M624,656L624,686"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,558 648,547 656,547" style="fill:rgb(0,0,0)"/>
<path d="M607,520 L 637,520 Q 652,520 652,535 L 652,537 L 652,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,596 382,592 382,600" style="fill:rgb(0,0,0)"/>
<path d="M652,558 L 652,581 Q 652,596 637,596 L 391,596 L 376,596"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,634 142,638 142,629" style="fill:rgb(0,0,0)"/>
<path d="M371,596 L 142,596 Q 127,596 127,611 L 127,619 Q 127,634 137,634 L 147,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,558 122,547 131,547" style="fill:rgb(0,0,0)"/>
<path d="M127,505L127,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,709 359,714 359,705" style="fill:rgb(0,0,0)"/>
<path d="M127,558 L 127,694 Q 127,709 142,709 L 350,709 L 365,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,709 597,714 597,705" style="fill:rgb(0,0,0)"/>
<path d="M371,709L603,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,709 L 616,709 Q 624,709 624,717 L 624,724"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,800L194,800A15 15 0 0 0 209 785A15 15 0 0 0 194 770L142,770A15 15 0 0 0 127 785A15 15 0 0 0 142 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="245,785 234,789 234,781" style="fill:rgb(0,0,0)"/>
<path d="M209,785L239,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,800A15 15 0 0 0 275 785A15 15 0 0 0 260 770A15 15 0 0 0 245 785A15 15 0 0 0 260 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="311,785 300,789 300,781" style="fill:rgb(0,0,0)"/>
<path d="M275,785L306,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,800L361,800L361,770L311,770Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="397,785 385,789 385,781" style="fill:rgb(0,0,0)"/>
<path d="M361,785L391,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,800A15 15 0 0 0 427 785A15 15 0 0 0 412 770A15 15 0 0 0 397 785A15 15 0 0 0 412 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="412" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="609,785 597,789 597,781" style="fill:rgb(0,0,0)"/>
<path d="M427,785L603,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,785 L 616,785 Q 624,785 624,792 L 624,800"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,762A15 15 0 0 0 351 747A15 15 0 0 0 336 732A15 15 0 0 0 321 747A15 15 0 0 0 336 762Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="747" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M336,838A15 15 0 0 0 351 823A15 15 0 0 0 336 808A15 15 0 0 0 321 823A15 15 0 0 0 336 838Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="823" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="351,747 363,743 363,751" style="fill:rgb(0,0,0)"/>
<path d="M361,785 L 368,785 Q 376,785 376,770 L 376,762 Q 376,747 366,747 L 357,747"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,747 L 300,747 Q 285,747 285,762 L 285,770 Q 285,785 292,785 L 300,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,823 363,818 363,827" style="fill:rgb(0,0,0)"/>
<path d="M427,785 L 434,785 Q 442,785 442,800 L 442,808 Q 442,823 427,823 L 372,823 L 357,823"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,823 L 234,823 Q 219,823 219,808 L 219,800 Q 219,785 226,785 L 234,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,785 115,789 115,781" style="fill:rgb(0,0,0)"/>
<path d="M55,129 L 62,129 Q 70,129 70,144 L 70,770 Q 70,785 85,785 L 106,785 L 121,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,891L424,891L424,860L248,860Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="876" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="424,876 436,871 436,880" style="fill:rgb(0,0,0)"/>
<path d="M624,692 L 624,861 Q 624,876 609,876 L 445,876 L 430,876"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="6,197 10,208 2,208" style="fill:rgb(0,0,0)"/>
<path d="M248,876 L 21,876 Q 6,876 6,861 L 6,217 L 6,202"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M6,197 L 6,144 Q 6,129 21,129 L 40,129 L 55,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="667" y="275" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" transform="rotate(-90 667,285)" dominant-baseline="central">select-core</text>
<path d="M168,966L213,966A15 15 0 0 0 228 951A15 15 0 0 0 213 936L168,936A15 15 0 0 0 153 951A15 15 0 0 0 168 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="251,951 239,956 239,947" style="fill:rgb(0,0,0)"/>
<path d="M228,951L245,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,966L270,966A15 15 0 0 0 285 951A15 15 0 0 0 270 936L266,936A15 15 0 0 0 251 951A15 15 0 0 0 266 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M168,1072L202,1072A15 15 0 0 0 217 1057A15 15 0 0 0 202 1042L168,1042A15 15 0 0 0 153 1057A15 15 0 0 0 168 1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="240,1057 228,1061 228,1053" style="fill:rgb(0,0,0)"/>
<path d="M217,1057L234,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,1072L289,1072L289,1042L240,1042Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="330,951 319,956 319,947" style="fill:rgb(0,0,0)"/>
<path d="M285,951L324,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,966L460,966L460,936L330,936Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M395,1004A15 15 0 0 0 410 989A15 15 0 0 0 395 974A15 15 0 0 0 380 989A15 15 0 0 0 395 1004Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="989" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="410,989 422,985 422,993" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 468,951 Q 475,951 475,966 L 475,974 Q 475,989 460,989 L 431,989 L 416,989"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,989 L 322,989 Q 307,989 307,974 L 307,966 Q 307,951 313,951 L 319,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,913 348,909 348,918" style="fill:rgb(0,0,0)"/>
<path d="M624,860 L 624,898 Q 624,913 609,913 L 357,913 L 342,913"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,951 142,956 142,947" style="fill:rgb(0,0,0)"/>
<path d="M336,913 L 142,913 Q 127,913 127,928 L 127,936 Q 127,951 137,951 L 147,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,981 492,970 500,970" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 481,951 Q 496,951 496,963 L 496,976"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,1023 318,1019 318,1027" style="fill:rgb(0,0,0)"/>
<path d="M496,981 L 496,1008 Q 496,1023 481,1023 L 327,1023 L 312,1023"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,1057 142,1061 142,1053" style="fill:rgb(0,0,0)"/>
<path d="M307,1023 L 142,1023 Q 127,1023 127,1038 L 127,1042 Q 127,1057 137,1057 L 147,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,989 122,978 131,978" style="fill:rgb(0,0,0)"/>
<path d="M127,936L127,983"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,989L127,1042"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1102L415,1102A15 15 0 0 0 430 1087A15 15 0 0 0 415 1072L363,1072A15 15 0 0 0 348 1087A15 15 0 0 0 363 1102Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="389" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="453,1087 441,1092 441,1083" style="fill:rgb(0,0,0)"/>
<path d="M430,1087L447,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,1102L502,1102L502,1072L453,1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="525,1087 513,1092 513,1083" style="fill:rgb(0,0,0)"/>
<path d="M502,1087L519,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1140A15 15 0 0 0 378 1125A15 15 0 0 0 363 1110A15 15 0 0 0 348 1125A15 15 0 0 0 363 1140Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="1125" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="401,1125 390,1129 390,1121" style="fill:rgb(0,0,0)"/>
<path d="M378,1125L396,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,1140L451,1140L451,1110L401,1110Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="1125" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="312,1057 301,1061 301,1053" style="fill:rgb(0,0,0)"/>
<path d="M289,1057L306,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1125 337,1129 337,1121" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1110 Q 327,1125 335,1125 L 342,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1087 337,1092 337,1083" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1072 Q 327,1087 335,1087 L 342,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1057 513,1061 513,1053" style="fill:rgb(0,0,0)"/>
<path d="M312,1057L519,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="620,1155 609,1160 609,1151" style="fill:rgb(0,0,0)"/>
<path d="M525,1057 L 546,1057 Q 561,1057 561,1072 L 561,1140 Q 561,1155 576,1155 L 599,1155 L 614,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="624" cy="1155" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1087 L 546,1087 Q 561,1087 561,1095 L 561,1102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1125 513,1129 513,1121" style="fill:rgb(0,0,0)"/>
<path d="M451,1125L519,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1125 L 546,1125 Q 561,1125 561,1133 L 561,1140"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1155 513,1160 513,1151" style="fill:rgb(0,0,0)"/>
<path d="M127,1042 L 127,1140 Q 127,1155 142,1155 L 504,1155 L 519,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1155L597,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/compound-operator.html">compound-operator:</a></b>
<button id='xf77ef87b' onclick='hideorshow("xf77ef87b","x1e9c082e")'>show</button></p>
 <div id='x1e9c082e' style='display:none;' class='imgcontainer'>
 <div style="max-width:293px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 293.842 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L127,32A15 15 0 0 0 142 17A15 15 0 0 0 127 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,70L127,70A15 15 0 0 0 142 55L142,55A15 15 0 0 0 127 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,108L168,108A15 15 0 0 0 183 92A15 15 0 0 0 168 77L83,77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M83,145L135,145A15 15 0 0 0 150 130A15 15 0 0 0 135 115L83,115A15 15 0 0 0 68 130A15 15 0 0 0 83 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M142,55L159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70L195,70A15 15 0 0 0 210 55L210,55A15 15 0 0 0 195 39L180,39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="233,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M210,55L227,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,17 272,21 272,12" style="fill:rgb(0,0,0)"/>
<path d="M233,55 L 240,55 Q 248,55 248,40 L 248,32 Q 248,17 263,17 L 263,17 L 278,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="288" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M47,39 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,92 221,97 221,88" style="fill:rgb(0,0,0)"/>
<path d="M183,92L227,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,92 L 240,92 Q 248,92 248,77 L 248,54 L 248,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,130 56,135 56,126" style="fill:rgb(0,0,0)"/>
<path d="M47,77 L 47,115 Q 47,130 55,130 L 62,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,130 221,135 221,126" style="fill:rgb(0,0,0)"/>
<path d="M150,130L227,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,130 L 240,130 Q 248,130 248,115 L 248,92 L 248,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-clause.html">join-clause:</a></b>
<button id='x07e63c27' onclick='hideorshow("x07e63c27","x3830f030")'>show</button></p>
 <div id='x3830f030' style='display:none;' class='imgcontainer'>
 <div style="max-width:793px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 793.282 84.24">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L193,32L193,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="259,47 247,51 247,43" style="fill:rgb(0,0,0)"/>
<path d="M193,17 L 200,17 Q 208,17 208,32 L 208,32 Q 208,47 223,47 L 238,47 L 253,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,62L380,62L380,32L259,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-operator</text>
<polygon points="403,47 391,51 391,43" style="fill:rgb(0,0,0)"/>
<path d="M380,47L397,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,62L564,62L564,32L403,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="587,47 575,51 575,43" style="fill:rgb(0,0,0)"/>
<path d="M564,47L581,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M587,62L721,62L721,32L587,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="654" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-constraint</text>
<polygon points="783,17 772,21 772,12" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 742,47 Q 757,47 757,32 L 757,32 Q 757,17 767,17 L 778,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="787" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M193,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,17L776,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,77 495,73 495,82" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 728,47 Q 736,47 736,62 L 736,62 Q 736,77 721,77 L 504,77 L 489,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,77 L 247,77 Q 232,77 232,62 L 232,62 Q 232,47 246,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/join-constraint.html">join-constraint:</a></b>
<button id='x9903d4f7' onclick='hideorshow("x9903d4f7","xa127f579")'>show</button></p>
 <div id='xa127f579' style='display:none;' class='imgcontainer'>
 <div style="max-width:483px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 483.336 126.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L104,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 104 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="143,55 131,59 131,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L137,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,70A15 15 0 0 0 173 55L173,55A15 15 0 0 0 158 39A15 15 0 0 0 143 55L143,55A15 15 0 0 0 158 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="209,55 197,59 197,50" style="fill:rgb(0,0,0)"/>
<path d="M173,55L203,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M224,70L318,70A15 15 0 0 0 333 55L333,55A15 15 0 0 0 318 39L224,39A15 15 0 0 0 209 55L209,55A15 15 0 0 0 224 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="369,55 358,59 358,50" style="fill:rgb(0,0,0)"/>
<path d="M333,55L363,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,70A15 15 0 0 0 399 55L399,55A15 15 0 0 0 384 39A15 15 0 0 0 369 55L369,55A15 15 0 0 0 384 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="422,55 411,59 411,50" style="fill:rgb(0,0,0)"/>
<path d="M399,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="473,17 462,21 462,12" style="fill:rgb(0,0,0)"/>
<path d="M422,55 L 430,55 Q 437,55 437,40 L 437,32 Q 437,17 452,17 L 453,17 L 468,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="477" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,108A15 15 0 0 0 286 92A15 15 0 0 0 271 77A15 15 0 0 0 256 92A15 15 0 0 0 271 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="286,92 298,88 298,97" style="fill:rgb(0,0,0)"/>
<path d="M333,55 L 341,55 Q 348,55 348,70 L 348,77 Q 348,92 333,92 L 307,92 L 292,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,92 L 197,92 Q 182,92 182,77 L 182,70 Q 182,55 190,55 L 197,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L74,32A15 15 0 0 0 90 17A15 15 0 0 0 74 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="113,17 101,21 101,12" style="fill:rgb(0,0,0)"/>
<path d="M90,17L107,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M113,32L162,32L162,2L113,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="422,17 411,21 411,12" style="fill:rgb(0,0,0)"/>
<path d="M162,17L417,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,17L462,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="209,120 197,124 197,115" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,105 Q 24,120 39,120 L 188,120 L 203,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,120 L 422,120 Q 437,120 437,105 L 437,54 L 437,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-operator.html">join-operator:</a></b>
<button id='x5e304368' onclick='hideorshow("x5e304368","xbcd5de75")'>show</button></p>
 <div id='xbcd5de75' style='display:none;' class='imgcontainer'>
 <div style="max-width:620px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 620.333 255.312">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,71 39,76 39,67" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,56 Q 24,71 34,71 L 45,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,86L133,86A15 15 0 0 0 148 71A15 15 0 0 0 133 56L66,56A15 15 0 0 0 50 71A15 15 0 0 0 66 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="99" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NATURAL</text>
<polygon points="189,41 178,45 178,37" style="fill:rgb(0,0,0)"/>
<path d="M148,71 L 155,71 Q 163,71 163,56 L 163,56 Q 163,41 173,41 L 184,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,71 219,76 219,67" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,56 Q 204,71 215,71 L 225,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,86L273,86A15 15 0 0 0 288 71A15 15 0 0 0 273 56L246,56A15 15 0 0 0 231 71A15 15 0 0 0 246 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LEFT</text>
<polygon points="378,71 366,76 366,67" style="fill:rgb(0,0,0)"/>
<path d="M288,71L372,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,86L437,86A15 15 0 0 0 452 71A15 15 0 0 0 437 56L393,56A15 15 0 0 0 378 71A15 15 0 0 0 393 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OUTER</text>
<polygon points="475,71 463,76 463,67" style="fill:rgb(0,0,0)"/>
<path d="M452,71L469,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="516,41 505,45 505,37" style="fill:rgb(0,0,0)"/>
<path d="M475,71 L 482,71 Q 490,71 490,56 L 490,56 Q 490,41 500,41 L 511,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,56L554,56A15 15 0 0 0 569 41A15 15 0 0 0 554 26L532,26A15 15 0 0 0 516 41A15 15 0 0 0 532 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="543" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">JOIN</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M569,41 L 576,41 Q 584,41 584,29 Q 584,17 594,17 L 605,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="614" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,32A15 15 0 0 0 325 17A15 15 0 0 0 310 2A15 15 0 0 0 295 17A15 15 0 0 0 310 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="295,17 283,21 283,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L289,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M325,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="99,41 88,45 88,37" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,29 Q 24,41 39,41 L 78,41 L 93,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M99,41L178,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,41L505,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,41 366,45 366,37" style="fill:rgb(0,0,0)"/>
<path d="M336,71 L 344,71 Q 351,71 351,56 L 351,56 Q 351,41 362,41 L 372,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,109 219,113 219,105" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,94 Q 204,109 215,109 L 225,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,124L284,124A15 15 0 0 0 299 109A15 15 0 0 0 284 94L246,94A15 15 0 0 0 231 109A15 15 0 0 0 246 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RIGHT</text>
<polygon points="341,71 329,76 329,67" style="fill:rgb(0,0,0)"/>
<path d="M299,109 L 307,109 Q 314,109 314,94 L 314,86 Q 314,71 324,71 L 335,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,147 219,151 219,142" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,132 Q 204,147 215,147 L 225,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,162L274,162A15 15 0 0 0 289 147A15 15 0 0 0 274 132L246,132A15 15 0 0 0 231 147A15 15 0 0 0 246 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FULL</text>
<path d="M289,147 L 302,147 Q 314,147 314,132 L 314,109 L 314,94"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,192 219,196 219,188" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,177 Q 204,192 215,192 L 225,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,207L287,207A15 15 0 0 0 302 192A15 15 0 0 0 287 177L246,177A15 15 0 0 0 231 192A15 15 0 0 0 246 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="192" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INNER</text>
<polygon points="475,192 463,196 463,188" style="fill:rgb(0,0,0)"/>
<path d="M302,192L469,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,192 L 482,192 Q 490,192 490,185 L 490,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,238 219,242 219,233" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,223 Q 24,238 39,238 L 210,238 L 225,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,253L287,253A15 15 0 0 0 303 238A15 15 0 0 0 287 222L246,222A15 15 0 0 0 231 238A15 15 0 0 0 246 253Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="238" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CROSS</text>
<polygon points="475,238 463,242 463,233" style="fill:rgb(0,0,0)"/>
<path d="M303,238L469,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,238 L 482,238 Q 490,238 490,223 L 490,71 L 490,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x15893a0b' onclick='hideorshow("x15893a0b","x96f457ce")'>show</button></p>
 <div id='x96f457ce' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/result-column.html">result-column:</a></b>
<button id='x9aaacb54' onclick='hideorshow("x9aaacb54","xfb70a2a4")'>show</button></p>
 <div id='xfb70a2a4' style='display:none;' class='imgcontainer'>
 <div style="max-width:398px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 398.054 163.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L94,32L94,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="136,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M94,17 L 102,17 Q 109,17 109,32 L 109,40 Q 109,55 119,55 L 130,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M151,70L155,70A15 15 0 0 0 170 55L170,55A15 15 0 0 0 155 39L151,39A15 15 0 0 0 136 55L136,55A15 15 0 0 0 151 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="206,55 194,59 194,50" style="fill:rgb(0,0,0)"/>
<path d="M170,55L200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,70L309,70A15 15 0 0 0 324 55L324,55A15 15 0 0 0 309 39L221,39A15 15 0 0 0 206 55L206,55A15 15 0 0 0 221 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="347,55 335,59 335,50" style="fill:rgb(0,0,0)"/>
<path d="M324,55L341,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,17 377,21 377,12" style="fill:rgb(0,0,0)"/>
<path d="M347,55 L 354,55 Q 362,55 362,40 L 362,32 Q 362,17 372,17 L 382,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="392" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,85 141,89 141,81" style="fill:rgb(0,0,0)"/>
<path d="M109,39 L 109,70 Q 109,85 124,85 L 132,85 L 147,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,85 L 170,85 Q 185,85 185,70 L 185,70 Q 185,55 192,55 L 200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="241,17 230,21 230,12" style="fill:rgb(0,0,0)"/>
<path d="M94,17L235,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M241,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,108 39,112 39,103" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,93 Q 24,108 34,108 L 45,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,123A15 15 0 0 0 81 108A15 15 0 0 0 66 92A15 15 0 0 0 50 108A15 15 0 0 0 66 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="108" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,108 335,112 335,103" style="fill:rgb(0,0,0)"/>
<path d="M81,108L341,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,108 L 354,108 Q 362,108 362,93 L 362,54 L 362,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,145 39,150 39,141" style="fill:rgb(0,0,0)"/>
<path d="M24,92 L 24,130 Q 24,145 34,145 L 45,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,160L141,160A15 15 0 0 0 156 145A15 15 0 0 0 141 130L66,130A15 15 0 0 0 50 145A15 15 0 0 0 66 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="145" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="179,145 167,150 167,141" style="fill:rgb(0,0,0)"/>
<path d="M156,145L173,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M194,160A15 15 0 0 0 209 145A15 15 0 0 0 194 130A15 15 0 0 0 179 145A15 15 0 0 0 194 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="232,145 221,150 221,141" style="fill:rgb(0,0,0)"/>
<path d="M209,145L226,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,160A15 15 0 0 0 262 145A15 15 0 0 0 247 130A15 15 0 0 0 232 145A15 15 0 0 0 247 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,145 335,150 335,141" style="fill:rgb(0,0,0)"/>
<path d="M262,145L341,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,145 L 354,145 Q 362,145 362,130 L 362,107 L 362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/table-or-subquery.html">table-or-subquery:</a></b>
<button id='xad8576e8' onclick='hideorshow("xad8576e8","xe38b70d7")'>show</button></p>
 <div id='xe38b70d7' style='display:none;' class='imgcontainer'>
 <div style="max-width:720px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 720.778 457.704">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,74 39,78 39,70" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,59 Q 24,74 34,74 L 45,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,89L162,89A15 15 0 0 0 177 74L177,74A15 15 0 0 0 162 59L66,59A15 15 0 0 0 50 74L50,74A15 15 0 0 0 66 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="194,74 183,78 183,70" style="fill:rgb(0,0,0)"/>
<path d="M177,74L189,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,89A15 15 0 0 0 225 74L225,74A15 15 0 0 0 209 59A15 15 0 0 0 194 74L194,74A15 15 0 0 0 209 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="266,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M225,74 L 232,74 Q 240,74 240,59 L 240,51 Q 240,36 250,36 L 260,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,51L356,51A15 15 0 0 0 371 36A15 15 0 0 0 356 21L281,21A15 15 0 0 0 266 36A15 15 0 0 0 281 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="407,36 396,41 396,32" style="fill:rgb(0,0,0)"/>
<path d="M371,36L402,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,51L427,51A15 15 0 0 0 442 36A15 15 0 0 0 427 21L423,21A15 15 0 0 0 407 36A15 15 0 0 0 423 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="478,36 466,41 466,32" style="fill:rgb(0,0,0)"/>
<path d="M442,36L472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,51L561,51A15 15 0 0 0 577 36A15 15 0 0 0 561 21L493,21A15 15 0 0 0 478 36A15 15 0 0 0 493 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="527" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<path d="M9,36L255,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="422,6 411,10 411,2" style="fill:rgb(0,0,0)"/>
<path d="M371,36 L 379,36 Q 386,36 386,21 L 386,21 Q 386,6 401,6 L 402,6 L 417,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 442,6 Q 457,6 457,21 L 457,21 Q 457,36 464,36 L 472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 577,6 Q 592,6 592,21 L 592,21 Q 592,36 599,36 L 607,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,127L388,127A15 15 0 0 0 403 112A15 15 0 0 0 388 97L323,97A15 15 0 0 0 308 112A15 15 0 0 0 323 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="426,112 415,116 415,108" style="fill:rgb(0,0,0)"/>
<path d="M403,112L420,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,127L445,127A15 15 0 0 0 460 112A15 15 0 0 0 445 97L441,97A15 15 0 0 0 426 112A15 15 0 0 0 441 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="443" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="483,112 472,116 472,108" style="fill:rgb(0,0,0)"/>
<path d="M460,112L478,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,127L577,127A15 15 0 0 0 592 112A15 15 0 0 0 577 97L499,97A15 15 0 0 0 483 112A15 15 0 0 0 499 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="538" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M323,165L343,165A15 15 0 0 0 359 150A15 15 0 0 0 343 135L323,135A15 15 0 0 0 308 150A15 15 0 0 0 323 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="382,150 370,154 370,145" style="fill:rgb(0,0,0)"/>
<path d="M359,150L376,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,165L461,165A15 15 0 0 0 476 150A15 15 0 0 0 461 135L397,135A15 15 0 0 0 382 150A15 15 0 0 0 397 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="527,74 539,70 539,78" style="fill:rgb(0,0,0)"/>
<path d="M577,36 L 607,36 Q 622,36 622,51 L 622,59 Q 622,74 607,74 L 548,74 L 533,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,150 297,154 297,145" style="fill:rgb(0,0,0)"/>
<path d="M527,74 L 297,74 Q 282,74 282,89 L 282,135 Q 282,150 292,150 L 302,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,112 297,116 297,108" style="fill:rgb(0,0,0)"/>
<path d="M282,97 L 282,104 Q 282,112 292,112 L 302,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="266,213 255,217 255,209" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,198 Q 24,213 39,213 L 245,213 L 260,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,228L431,228A15 15 0 0 0 446 213A15 15 0 0 0 431 198L281,198A15 15 0 0 0 266 213A15 15 0 0 0 281 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function-name</text>
<polygon points="463,213 452,217 452,209" style="fill:rgb(0,0,0)"/>
<path d="M446,213L457,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,228A15 15 0 0 0 493 213A15 15 0 0 0 478 198A15 15 0 0 0 463 213A15 15 0 0 0 478 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="529,213 518,217 518,209" style="fill:rgb(0,0,0)"/>
<path d="M493,213L524,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M529,228L579,228L579,198L529,198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="615,213 603,217 603,209" style="fill:rgb(0,0,0)"/>
<path d="M579,213L609,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M630,228A15 15 0 0 0 645 213A15 15 0 0 0 630 198A15 15 0 0 0 615 213A15 15 0 0 0 630 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="630" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="675,187 679,198 671,198" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 660,213 Q 675,213 675,203 L 675,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M554,190A15 15 0 0 0 569 175A15 15 0 0 0 554 160A15 15 0 0 0 539 175A15 15 0 0 0 554 190Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="175" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="569,175 581,171 581,180" style="fill:rgb(0,0,0)"/>
<path d="M579,213 L 586,213 Q 594,213 594,198 L 594,190 Q 594,175 584,175 L 575,175"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,175 L 518,175 Q 503,175 503,190 L 503,198 Q 503,213 510,213 L 518,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,74 L 232,74 Q 240,74 240,89 L 240,198 Q 240,213 247,213 L 255,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,112 648,116 648,108" style="fill:rgb(0,0,0)"/>
<path d="M592,112L654,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,112 L 667,112 Q 675,112 675,104 L 675,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,150 648,154 648,145" style="fill:rgb(0,0,0)"/>
<path d="M476,150L654,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,150 L 667,150 Q 675,150 675,142 L 675,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M577,36L690,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,304L411,304A15 15 0 0 0 426 289A15 15 0 0 0 411 274L407,274A15 15 0 0 0 392 289A15 15 0 0 0 407 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="498,289 487,293 487,284" style="fill:rgb(0,0,0)"/>
<path d="M426,289L492,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M513,304L582,304A15 15 0 0 0 597 289A15 15 0 0 0 582 274L513,274A15 15 0 0 0 498 289A15 15 0 0 0 513 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="548" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<polygon points="660,289 648,293 648,284" style="fill:rgb(0,0,0)"/>
<path d="M597,289L654,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,289 L 667,289 Q 675,289 675,281 L 675,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="548,251 559,247 559,255" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 652,213 Q 660,213 660,228 L 660,236 Q 660,251 645,251 L 568,251 L 553,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M548,251 L 370,251 Q 355,251 355,266 L 355,274 Q 355,289 370,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,251 L 464,251 Q 457,251 457,266 L 457,274 Q 457,289 464,289 L 472,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,327 39,331 39,322" style="fill:rgb(0,0,0)"/>
<path d="M24,198 L 24,312 Q 24,327 34,327 L 45,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,342A15 15 0 0 0 81 327A15 15 0 0 0 66 311A15 15 0 0 0 50 327A15 15 0 0 0 66 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,327 92,331 92,322" style="fill:rgb(0,0,0)"/>
<path d="M81,327L98,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,342L208,342L208,311L104,311Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="327" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="231,327 219,331 219,322" style="fill:rgb(0,0,0)"/>
<path d="M208,327L225,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,342A15 15 0 0 0 261 327A15 15 0 0 0 246 311A15 15 0 0 0 231 327A15 15 0 0 0 246 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M261,327 L 269,327 Q 276,327 276,312 L 276,304 Q 276,289 291,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,327 648,331 648,322" style="fill:rgb(0,0,0)"/>
<path d="M261,327L654,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,327 L 667,327 Q 675,327 675,319 L 675,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,327 L 432,327 Q 439,327 439,312 L 439,304 Q 439,289 447,289 L 454,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,364 39,369 39,360" style="fill:rgb(0,0,0)"/>
<path d="M24,311 L 24,349 Q 24,364 34,364 L 45,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,379A15 15 0 0 0 81 364A15 15 0 0 0 65 349A15 15 0 0 0 50 364A15 15 0 0 0 65 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="135,364 123,369 123,360" style="fill:rgb(0,0,0)"/>
<path d="M81,364L129,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,379L296,379L296,349L135,349Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="364" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="350,364 338,369 338,360" style="fill:rgb(0,0,0)"/>
<path d="M296,364L344,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,379A15 15 0 0 0 380 364A15 15 0 0 0 365 349A15 15 0 0 0 350 364A15 15 0 0 0 365 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="660,364 648,369 648,360" style="fill:rgb(0,0,0)"/>
<path d="M380,364L654,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="711,36 699,41 699,32" style="fill:rgb(0,0,0)"/>
<path d="M660,364 L 667,364 Q 675,364 675,349 L 675,51 Q 675,36 690,36 L 690,36 L 705,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="715" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,417A15 15 0 0 0 230 402A15 15 0 0 0 215 387A15 15 0 0 0 200 402A15 15 0 0 0 215 417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="402" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="230,402 242,398 242,406" style="fill:rgb(0,0,0)"/>
<path d="M296,364 L 303,364 Q 311,364 311,379 L 311,387 Q 311,402 296,402 L 251,402 L 236,402"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,402 L 123,402 Q 108,402 108,387 L 108,379 Q 108,364 116,364 L 123,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="122,440 111,444 111,436" style="fill:rgb(0,0,0)"/>
<path d="M81,364 L 88,364 Q 96,364 96,379 L 96,425 Q 96,440 106,440 L 116,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M122,455L224,455L224,425L122,425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M224,440 L 308,440 Q 323,440 323,425 L 323,379 Q 323,364 331,364 L 338,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/window-defn.html">window-defn:</a></b>
<button id='xb182b57b' onclick='hideorshow("xb182b57b","x4f9b75d5")'>show</button></p>
 <div id='x4f9b75d5' style='display:none;' class='imgcontainer'>
 <div style="max-width:479px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 479.765 380.592">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,44 92,48 92,40" style="fill:rgb(0,0,0)"/>
<path d="M62,17 L 70,17 Q 77,17 77,30 Q 77,44 88,44 L 98,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,59L260,59A15 15 0 0 0 275 44L275,44A15 15 0 0 0 260 29L119,29A15 15 0 0 0 104 44L104,44A15 15 0 0 0 119 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M119,135L198,135A15 15 0 0 0 214 120A15 15 0 0 0 198 104L119,104A15 15 0 0 0 104 120A15 15 0 0 0 119 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="237,120 225,124 225,115" style="fill:rgb(0,0,0)"/>
<path d="M214,120L231,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M252,135L256,135A15 15 0 0 0 271 120A15 15 0 0 0 256 104L252,104A15 15 0 0 0 237 120A15 15 0 0 0 252 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="307,120 295,124 295,115" style="fill:rgb(0,0,0)"/>
<path d="M271,120L301,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,135L356,135L356,104L307,104Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M332,173A15 15 0 0 0 347 157A15 15 0 0 0 332 142A15 15 0 0 0 316 157A15 15 0 0 0 332 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="157" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="347,157 358,153 358,162" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,142 Q 371,157 362,157 L 352,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,157 L 295,157 Q 280,157 280,142 L 280,135 Q 280,120 288,120 L 295,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,17 178,21 178,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L184,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,82 201,77 201,86" style="fill:rgb(0,0,0)"/>
<path d="M190,17 L 298,17 Q 313,17 313,32 L 313,67 Q 313,82 298,82 L 210,82 L 195,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,120 92,124 92,115" style="fill:rgb(0,0,0)"/>
<path d="M190,82 L 77,82 Q 62,82 62,97 L 62,105 Q 62,120 77,120 L 83,120 L 98,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,44 287,48 287,40" style="fill:rgb(0,0,0)"/>
<path d="M275,44L293,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,44 L 306,44 Q 313,44 313,51 L 313,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,248L163,248A15 15 0 0 0 178 233A15 15 0 0 0 163 218L119,218A15 15 0 0 0 104 233A15 15 0 0 0 119 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="201,233 190,237 190,229" style="fill:rgb(0,0,0)"/>
<path d="M178,233L196,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,248L221,248A15 15 0 0 0 236 233A15 15 0 0 0 221 218L217,218A15 15 0 0 0 201 233A15 15 0 0 0 217 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="272,233 260,237 260,229" style="fill:rgb(0,0,0)"/>
<path d="M236,233L266,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,248L402,248L402,218L272,218Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M337,286A15 15 0 0 0 352 271A15 15 0 0 0 337 256A15 15 0 0 0 322 271A15 15 0 0 0 337 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="352,271 363,266 363,275" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,256 Q 417,271 402,271 L 373,271 L 358,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M322,271 L 260,271 Q 245,271 245,256 L 245,248 Q 245,233 253,233 L 260,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,195 201,191 201,200" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,180 Q 371,195 356,195 L 210,195 L 195,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,233 92,237 92,229" style="fill:rgb(0,0,0)"/>
<path d="M190,195 L 77,195 Q 62,195 62,210 L 62,218 Q 62,233 77,233 L 83,233 L 98,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,157 58,146 66,146" style="fill:rgb(0,0,0)"/>
<path d="M62,104L62,152"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,157L62,218"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,362L208,362L208,331L104,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="417,346 405,351 405,342" style="fill:rgb(0,0,0)"/>
<path d="M208,346L411,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,362A15 15 0 0 0 447 346A15 15 0 0 0 432 331A15 15 0 0 0 417 346A15 15 0 0 0 432 362Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="470,346 458,351 458,342" style="fill:rgb(0,0,0)"/>
<path d="M447,346L464,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="474" cy="346" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,309 201,304 201,313" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,294 Q 417,309 402,309 L 210,309 L 195,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,346 92,351 92,342" style="fill:rgb(0,0,0)"/>
<path d="M190,309 L 77,309 Q 62,309 62,324 L 62,331 Q 62,346 77,346 L 83,346 L 98,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,271 58,259 66,259" style="fill:rgb(0,0,0)"/>
<path d="M62,218L62,265"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,271L62,331"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,374 144,378 144,369" style="fill:rgb(0,0,0)"/>
<path d="M62,331 L 62,359 Q 62,374 77,374 L 135,374 L 150,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,346 266,351 266,342" style="fill:rgb(0,0,0)"/>
<path d="M156,374 L 233,374 Q 248,374 248,360 Q 248,346 260,346 L 272,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x85926aa7' onclick='hideorshow("x85926aa7","xee8b3edb")'>show</button></p>
 <div id='xee8b3edb' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/upsert-clause.html">upsert-clause:</a></b>
<button id='x2289d3a9' onclick='hideorshow("x2289d3a9","xae65d837")'>show</button></p>
 <div id='xae65d837' style='display:none;' class='imgcontainer'>
 <div style="max-width:901px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 901.142 363.96">
<path d="M223,165L759,165L759,51L223,51Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="5" cy="66" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,66 35,71 35,62" style="fill:rgb(0,0,0)"/>
<path d="M9,66L41,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,82L71,82A15 15 0 0 0 86 66A15 15 0 0 0 71 51L62,51A15 15 0 0 0 47 66A15 15 0 0 0 62 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="66" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="103,66 92,71 92,62" style="fill:rgb(0,0,0)"/>
<path d="M86,66L98,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M118,82L193,82A15 15 0 0 0 208 66A15 15 0 0 0 193 51L118,51A15 15 0 0 0 103 66A15 15 0 0 0 118 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="66" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONFLICT</text>
<polygon points="264,97 253,101 253,92" style="fill:rgb(0,0,0)"/>
<path d="M208,66 L 223,66 Q 238,66 238,81 L 238,82 Q 238,97 248,97 L 259,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M280,112A15 15 0 0 0 295 97L295,97A15 15 0 0 0 280 82A15 15 0 0 0 264 97L264,97A15 15 0 0 0 280 112Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="97" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="331,97 319,101 319,92" style="fill:rgb(0,0,0)"/>
<path d="M295,97L325,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M331,112L475,112L475,82L331,82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="97" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">indexed-column</text>
<polygon points="511,97 500,101 500,92" style="fill:rgb(0,0,0)"/>
<path d="M475,97L506,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M526,112A15 15 0 0 0 542 97L542,97A15 15 0 0 0 526 82A15 15 0 0 0 511 97L511,97A15 15 0 0 0 526 112Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="526" y="97" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="583,135 572,139 572,130" style="fill:rgb(0,0,0)"/>
<path d="M542,97 L 549,97 Q 557,97 557,112 L 557,119 Q 557,135 567,135 L 577,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M598,150L648,150A15 15 0 0 0 663 135A15 15 0 0 0 648 119L598,119A15 15 0 0 0 583 135A15 15 0 0 0 598 150Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="623" y="135" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="680,135 669,139 669,130" style="fill:rgb(0,0,0)"/>
<path d="M663,135L674,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M680,150L729,150L729,119L680,119Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="705" y="135" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="744,108 749,119 740,119" style="fill:rgb(0,0,0)"/>
<path d="M729,135 L 737,135 Q 744,135 744,124 L 744,114"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="786,66 774,71 774,62" style="fill:rgb(0,0,0)"/>
<path d="M744,108 L 744,81 Q 744,66 759,66 L 765,66 L 780,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M801,82L809,82A15 15 0 0 0 824 66A15 15 0 0 0 809 51L801,51A15 15 0 0 0 786 66A15 15 0 0 0 801 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="805" y="66" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DO</text>
<polygon points="729,97 718,101 718,92" style="fill:rgb(0,0,0)"/>
<path d="M542,97L723,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,97 L 737,97 Q 744,97 744,89 L 744,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M208,66L774,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,150A15 15 0 0 0 418 135A15 15 0 0 0 403 119A15 15 0 0 0 388 135A15 15 0 0 0 403 150Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="135" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,135 430,130 430,139" style="fill:rgb(0,0,0)"/>
<path d="M475,97 L 483,97 Q 490,97 490,112 L 490,119 Q 490,135 475,135 L 439,135 L 424,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,135 L 319,135 Q 304,135 304,119 L 304,112 Q 304,97 312,97 L 319,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="288" y="36" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" dominant-baseline="central">conflict target</text>
<polygon points="436,195 447,191 447,199" style="fill:rgb(0,0,0)"/>
<path d="M824,66 L 831,66 Q 839,66 839,81 L 839,180 Q 839,195 824,195 L 456,195 L 441,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,271 35,275 35,266" style="fill:rgb(0,0,0)"/>
<path d="M436,195 L 35,195 Q 20,195 20,210 L 20,256 Q 20,271 31,271 L 41,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,286L116,286A15 15 0 0 0 131 271A15 15 0 0 0 116 255L62,255A15 15 0 0 0 47 271A15 15 0 0 0 62 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="89" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="148,271 137,275 137,266" style="fill:rgb(0,0,0)"/>
<path d="M131,271L143,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M164,286L179,286A15 15 0 0 0 194 271A15 15 0 0 0 179 255L164,255A15 15 0 0 0 148 271A15 15 0 0 0 164 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="171" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="257,308 245,313 245,304" style="fill:rgb(0,0,0)"/>
<path d="M194,271 L 215,271 Q 230,271 230,286 L 230,293 Q 230,308 241,308 L 251,308"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,324L413,324L413,293L257,293Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="335" y="308" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name-list</text>
<polygon points="475,271 464,275 464,266" style="fill:rgb(0,0,0)"/>
<path d="M413,308 L 434,308 Q 449,308 449,293 L 449,286 Q 449,271 459,271 L 469,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,286A15 15 0 0 0 505 271A15 15 0 0 0 490 255A15 15 0 0 0 475 271A15 15 0 0 0 490 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="490" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">=</text>
<polygon points="523,271 511,275 511,266" style="fill:rgb(0,0,0)"/>
<path d="M505,271L517,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M523,286L572,286L572,255L523,255Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="547" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="619,271 608,275 608,266" style="fill:rgb(0,0,0)"/>
<path d="M572,271L613,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M634,286L684,286A15 15 0 0 0 699 271A15 15 0 0 0 684 255L634,255A15 15 0 0 0 619 271A15 15 0 0 0 634 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="659" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="716,271 705,275 705,266" style="fill:rgb(0,0,0)"/>
<path d="M699,271L710,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M716,286L765,286L765,255L716,255Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="741" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="891,233 880,237 880,228" style="fill:rgb(0,0,0)"/>
<path d="M765,271 L 773,271 Q 780,271 780,256 L 780,248 Q 780,233 795,233 L 871,233 L 886,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="895" cy="233" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,248L130,248A15 15 0 0 0 145 233A15 15 0 0 0 130 218L62,218A15 15 0 0 0 47 233A15 15 0 0 0 62 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="96" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTHING</text>
<polygon points="47,233 35,237 35,228" style="fill:rgb(0,0,0)"/>
<path d="M20,218 L 20,225 Q 20,233 31,233 L 41,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,233L880,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="638,233 626,237 626,228" style="fill:rgb(0,0,0)"/>
<path d="M587,271 L 594,271 Q 602,271 602,256 L 602,248 Q 602,233 617,233 L 617,233 L 632,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M383,361A15 15 0 0 0 398 346A15 15 0 0 0 383 331A15 15 0 0 0 368 346A15 15 0 0 0 383 361Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="383" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="398,346 410,342 410,351" style="fill:rgb(0,0,0)"/>
<path d="M572,271 L 579,271 Q 587,271 587,286 L 587,331 Q 587,346 572,346 L 419,346 L 404,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,308 210,320 201,320" style="fill:rgb(0,0,0)"/>
<path d="M368,346 L 221,346 Q 206,346 206,331 L 206,329 L 206,314"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,308 L 206,286 Q 206,271 221,271 L 227,271 L 242,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="257,271 245,275 245,266" style="fill:rgb(0,0,0)"/>
<path d="M194,271L251,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,286L366,286A15 15 0 0 0 381 271A15 15 0 0 0 366 255L272,255A15 15 0 0 0 257 271A15 15 0 0 0 272 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<path d="M381,271L464,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="865,97 869,108 860,108" style="fill:rgb(0,0,0)"/>
<path d="M850,233 L 857,233 Q 865,233 865,218 L 865,117 L 865,102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="403,6 415,2 415,10" style="fill:rgb(0,0,0)"/>
<path d="M865,97 L 865,21 Q 865,6 850,6 L 424,6 L 409,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,6 L 40,6 Q 25,6 25,21 L 25,51 Q 25,66 32,66 L 40,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/column-name-list.html">column-name-list:</a></b>
<button id='x3df6443e' onclick='hideorshow("x3df6443e","xdf8a1599")'>show</button></p>
 <div id='xdf8a1599' style='display:none;' class='imgcontainer'>
 <div style="max-width:353px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 353.621 72.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="85,17 74,21 74,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L79,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,17 110,21 110,12" style="fill:rgb(0,0,0)"/>
<path d="M85,17L115,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,32L230,32A15 15 0 0 0 245 17A15 15 0 0 0 230 2L136,2A15 15 0 0 0 121 17A15 15 0 0 0 136 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="290,17 279,21 279,12" style="fill:rgb(0,0,0)"/>
<path d="M245,17L285,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M306,32A15 15 0 0 0 321 17A15 15 0 0 0 306 2A15 15 0 0 0 290 17A15 15 0 0 0 306 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="306" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="344,17 332,21 332,12" style="fill:rgb(0,0,0)"/>
<path d="M321,17L338,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="347" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M183,70A15 15 0 0 0 198 55L198,55A15 15 0 0 0 183 39A15 15 0 0 0 168 55L168,55A15 15 0 0 0 183 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="198,55 210,50 210,59" style="fill:rgb(0,0,0)"/>
<path d="M245,17 L 257,17 Q 269,17 269,32 L 269,40 Q 269,55 254,55 L 219,55 L 204,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,17 110,21 110,12" style="fill:rgb(0,0,0)"/>
<path d="M168,55 L 102,55 Q 87,55 87,40 L 87,32 Q 87,17 101,17 L 115,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/indexed-column.html">indexed-column:</a></b>
<button id='x6c44c1fb' onclick='hideorshow("x6c44c1fb","x133b74c2")'>show</button></p>
 <div id='x133b74c2' style='display:none;' class='imgcontainer'>
 <div style="max-width:696px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 696.36 102.6">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L160,32A15 15 0 0 0 175 17A15 15 0 0 0 160 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="113" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="246,47 235,51 235,43" style="fill:rgb(0,0,0)"/>
<path d="M175,17 L 205,17 Q 220,17 220,32 L 220,32 Q 220,47 230,47 L 240,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M261,62L325,62A15 15 0 0 0 341 47L341,47A15 15 0 0 0 325 32L261,32A15 15 0 0 0 246 47L246,47A15 15 0 0 0 261 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="293" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="358,47 346,51 346,43" style="fill:rgb(0,0,0)"/>
<path d="M341,47L352,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M373,62L478,62A15 15 0 0 0 493 47L493,47A15 15 0 0 0 478 32L373,32A15 15 0 0 0 358 47L358,47A15 15 0 0 0 373 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="511,47 499,51 499,43" style="fill:rgb(0,0,0)"/>
<path d="M493,47L505,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="567,85 556,89 556,81" style="fill:rgb(0,0,0)"/>
<path d="M511,47 L 518,47 Q 526,47 526,32 L 526,32 Q 526,17 533,17 Q 541,17 541,32 L 541,70 Q 541,85 551,85 L 561,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,100L613,100A15 15 0 0 0 628 85L628,85A15 15 0 0 0 613 70L582,70A15 15 0 0 0 567 85L567,85A15 15 0 0 0 582 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="645,85 633,89 633,81" style="fill:rgb(0,0,0)"/>
<path d="M628,85L639,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="687,17 675,21 675,12" style="fill:rgb(0,0,0)"/>
<path d="M645,85 L 652,85 Q 660,85 660,70 L 660,32 Q 660,17 670,17 L 681,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="690" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M50,70L100,70L100,39L50,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="175,55 163,59 163,50" style="fill:rgb(0,0,0)"/>
<path d="M100,55L169,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M175,55 L 182,55 Q 190,55 190,40 L 190,32 Q 190,17 197,17 L 205,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M175,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,17 586,21 586,12" style="fill:rgb(0,0,0)"/>
<path d="M358,17L592,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,17L675,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,62L599,62A15 15 0 0 0 614 47A15 15 0 0 0 599 32L582,32A15 15 0 0 0 567 47A15 15 0 0 0 582 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="645,47 633,51 633,43" style="fill:rgb(0,0,0)"/>
<path d="M614,47L639,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M645,47 L 652,47 Q 660,47 660,40 L 660,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="567,47 556,51 556,43" style="fill:rgb(0,0,0)"/>
<path d="M541,32 L 541,39 Q 541,47 551,47 L 561,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>


<p>The INSERT statement comes in three basic forms.  
</p><ol>
<li><p><b>INSERT INTO </b><i>table</i><b> VALUES(...);</b>
</p><p>The first form (with the "VALUES" keyword) creates one or more
new rows in
an existing table. If the <span class='yyterm'>column-name</span> list after
<span class='yyterm'>table-name</span> is omitted then the number
of values inserted into each row
must be the same as the number of columns in the table. In this case
the result of evaluating the left-most expression from each term of
the VALUES list is inserted into the left-most column of each new row,
and so forth for each subsequent expression. If a <span class='yyterm'>column-name</span>
list is specified, then the number of values in each term of the
VALUE list must match the number of
specified columns. Each of the named columns of the new row is populated
with the results of evaluating the corresponding VALUES expression. Table
columns that do not appear in the column list are populated with the 
<a href="lang_createtable.html#dfltval">default column value</a> (specified as part of the <a href="lang_createtable.html">CREATE TABLE</a> statement), or
with NULL if no <a href="lang_createtable.html#dfltval">default value</a> is specified.

</p></li><li><p><b>INSERT INTO </b><i>table</i><b> SELECT ...;</b>
</p><p>The second form of the INSERT statement contains a <a href="lang_select.html">SELECT</a> statement
instead of a VALUES clause. A new entry is inserted into the table for each
row of data returned by executing the SELECT statement. If a column-list is
specified, the number of columns in the result of the SELECT must be the same
as the number of items in the column-list. Otherwise, if no column-list is
specified, the number of columns in the result of the SELECT must be the same
as the number of columns in the table. Any SELECT statement, including
<a href="lang_select.html#compound">compound SELECTs</a> and SELECT statements with <a href="lang_select.html#orderby">ORDER BY</a> and/or <a href="lang_select.html#limitoffset">LIMIT</a> clauses, 
may be used in an INSERT statement of this form.

</p><p>To avoid a parsing ambiguity, the SELECT statement should always
contain a WHERE clause, even if that clause is simply "WHERE true",
if the <a href="syntax/upsert-clause.html">upsert-clause</a> is present.  Without the WHERE clause, the
parser does not know if the token "ON" is part of a join constraint
on the SELECT, or the beginning of the <a href="syntax/upsert-clause.html">upsert-clause</a>.

</p></li><li><p><b>INSERT INTO </b><i>table</i><b> DEFAULT VALUES;</b>
</p><p>The third form of an INSERT statement is with DEFAULT VALUES.
The INSERT ... DEFAULT VALUES statement inserts a single new row into the
named table. Each column of the new row is populated with its 
<a href="lang_createtable.html#dfltval">default value</a>, or with a NULL if no default value is specified 
as part of the column definition in the <a href="lang_createtable.html">CREATE TABLE</a> statement.
The <a href="syntax/upsert-clause.html">upsert-clause</a> is not supported after DEFAULT VALUES.

</p></li></ol>

<p>
The initial "INSERT" keyword can be replaced by
"REPLACE" or "INSERT OR <i>action</i>" to specify an alternative
constraint <a href="lang_conflict.html">conflict resolution algorithm</a> to use during 
that one INSERT command.
For compatibility with MySQL, the parser allows the use of the
single keyword <a href="lang_replace.html">REPLACE</a> as an 
alias for "INSERT OR REPLACE".

</p><p>The optional "<i>schema-name</i><b>.</b>" prefix on the 
<span class='yyterm'>table-name</span>
is supported for top-level INSERT statements only.  The table name must be
unqualified for INSERT statements that occur within <a href="lang_createtrigger.html">CREATE TRIGGER</a> statements.
Similarly, the "DEFAULT VALUES" form of the INSERT statement is supported for
top-level INSERT statements only and not for INSERT statements within
triggers.
</p><p>

</p><p>The optional "AS <span class='yyterm'>alias</span>" phrase provides an alternative
name for the table into which content is being inserted.  The alias name
can be used within WHERE and SET clauses of the <a href="lang_upsert.html">UPSERT</a>.  If there is no
<a href="syntax/upsert-clause.html">upsert-clause</a>, then the <span class='yyterm'>alias</span> is pointless, but also
harmless.

</p><p>See the separate <a href="lang_upsert.html">UPSERT</a> documentation for the additional trailing
syntax that can cause an INSERT to behave as an UPDATE if the INSERT would
otherwise violate a uniqueness constraint.  The <a href="lang_upsert.html">upsert clause</a> is not
allowed on an "INSERT ... DEFAULT VALUES".
</p><p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_insert.in?m=7f221e4bf5">2022-01-08 05:02:57</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_keywords.html.



















































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>SQLite Keywords</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
SQLite Keywords
</div>
</div>





<p>The SQL standard specifies a large number of keywords which may not
be used as the names of tables, indices, columns, databases, user-defined
functions, collations, virtual table modules, or any other named object.
The list of keywords is so long that few people can remember them all.
For most SQL code, your safest bet is to never use any English language
word as the name of a user-defined object.</p>

<p>If you want to use a keyword as a name, you need to quote it.  There
are four ways of quoting keywords in SQLite:</p>

<p>
</p><blockquote>
<table>
<tr>	<td valign="top"><b>'keyword'</b></td><td width="20"></td>
	<td>A keyword in single quotes is a string literal.</td></tr>

<tr>	<td valign="top"><b>"keyword"</b></td><td></td>
	<td>A keyword in double-quotes is an identifier.</td></tr>

<tr>	<td valign="top"><b>&#91;keyword&#93;</b></td><td></td>
	<td>A keyword enclosed in square brackets is 
        an identifier.  This is not standard SQL.  This quoting mechanism
        is used by MS Access and SQL Server and is included in SQLite for
        compatibility.</td></tr>

<tr>	<td valign="top"><b>&#96;keyword&#96;</b></td><td></td>
	<td>A keyword enclosed in grave accents (ASCII code 96) is 
        an identifier.  This is not standard SQL.  This quoting mechanism
        is used by MySQL and is included in SQLite for
        compatibility.</td></tr>
</table>
</blockquote>


<p>For resilience when confronted with historical SQL statements, SQLite
will sometimes bend the quoting rules above:</p>

<ul>
<li><p>If a keyword in single
quotes (ex: <b>'key'</b> or <b>'glob'</b>) is used in a context where
an identifier is allowed but where a string literal is not allowed, then
the token is understood to be an identifier instead of a string literal.
</p></li>

<li><p>If a keyword in double
quotes (ex: <b>"key"</b> or <b>"glob"</b>) is used in a context where
it cannot be resolved to an identifier but where a string literal
is allowed, then the token is understood to be a string literal instead
of an identifier.</p></li>
</ul>

<p>Programmers are cautioned not to use the two exceptions described in
the previous bullets.  We emphasize that they exist only so that old
and ill-formed SQL statements will run correctly.  Future versions of
SQLite might raise errors instead of accepting the malformed
statements covered by the exceptions above.</p>

<p>
SQLite adds new keywords from time to time when it takes on new features.
So to prevent your code from being broken by future enhancements, you should
normally quote any identifier that is an English language word, even if
you do not have to.
</p>

<p>
The list below shows all possible keywords used by any build of
SQLite regardless of <a href="compile.html">compile-time options</a>.  
Most reasonable configurations use most or all of these keywords,
but some keywords may be omitted when SQL language features are
disabled.
Applications can use the
<a href="c3ref/keyword_check.html">sqlite3_keyword_count()</a>, <a href="c3ref/keyword_check.html">sqlite3_keyword_name()</a>, and
<a href="c3ref/keyword_check.html">sqlite3_keyword_check()</a> interfaces to determine the keywords
recognized by SQLite at run-time.
Regardless of the compile-time configuration, any identifier that is not on
the following 147-element

list is not a keyword to the SQL parser in SQLite:
</p>

<div class="columns" style="columns:11em auto;">
<ul style="padding-top:0;">
<li>ABORT</li>
<li>ACTION</li>
<li>ADD</li>
<li>AFTER</li>
<li>ALL</li>
<li>ALTER</li>
<li>ALWAYS</li>
<li>ANALYZE</li>
<li>AND</li>
<li>AS</li>
<li>ASC</li>
<li>ATTACH</li>
<li>AUTOINCREMENT</li>
<li>BEFORE</li>
<li>BEGIN</li>
<li>BETWEEN</li>
<li>BY</li>
<li>CASCADE</li>
<li>CASE</li>
<li>CAST</li>
<li>CHECK</li>
<li>COLLATE</li>
<li>COLUMN</li>
<li>COMMIT</li>
<li>CONFLICT</li>
<li>CONSTRAINT</li>
<li>CREATE</li>
<li>CROSS</li>
<li>CURRENT</li>
<li>CURRENT_DATE</li>
<li>CURRENT_TIME</li>
<li>CURRENT_TIMESTAMP</li>
<li>DATABASE</li>
<li>DEFAULT</li>
<li>DEFERRABLE</li>
<li>DEFERRED</li>
<li>DELETE</li>
<li>DESC</li>
<li>DETACH</li>
<li>DISTINCT</li>
<li>DO</li>
<li>DROP</li>
<li>EACH</li>
<li>ELSE</li>
<li>END</li>
<li>ESCAPE</li>
<li>EXCEPT</li>
<li>EXCLUDE</li>
<li>EXCLUSIVE</li>
<li>EXISTS</li>
<li>EXPLAIN</li>
<li>FAIL</li>
<li>FILTER</li>
<li>FIRST</li>
<li>FOLLOWING</li>
<li>FOR</li>
<li>FOREIGN</li>
<li>FROM</li>
<li>FULL</li>
<li>GENERATED</li>
<li>GLOB</li>
<li>GROUP</li>
<li>GROUPS</li>
<li>HAVING</li>
<li>IF</li>
<li>IGNORE</li>
<li>IMMEDIATE</li>
<li>IN</li>
<li>INDEX</li>
<li>INDEXED</li>
<li>INITIALLY</li>
<li>INNER</li>
<li>INSERT</li>
<li>INSTEAD</li>
<li>INTERSECT</li>
<li>INTO</li>
<li>IS</li>
<li>ISNULL</li>
<li>JOIN</li>
<li>KEY</li>
<li>LAST</li>
<li>LEFT</li>
<li>LIKE</li>
<li>LIMIT</li>
<li>MATCH</li>
<li>MATERIALIZED</li>
<li>NATURAL</li>
<li>NO</li>
<li>NOT</li>
<li>NOTHING</li>
<li>NOTNULL</li>
<li>NULL</li>
<li>NULLS</li>
<li>OF</li>
<li>OFFSET</li>
<li>ON</li>
<li>OR</li>
<li>ORDER</li>
<li>OTHERS</li>
<li>OUTER</li>
<li>OVER</li>
<li>PARTITION</li>
<li>PLAN</li>
<li>PRAGMA</li>
<li>PRECEDING</li>
<li>PRIMARY</li>
<li>QUERY</li>
<li>RAISE</li>
<li>RANGE</li>
<li>RECURSIVE</li>
<li>REFERENCES</li>
<li>REGEXP</li>
<li>REINDEX</li>
<li>RELEASE</li>
<li>RENAME</li>
<li>REPLACE</li>
<li>RESTRICT</li>
<li>RETURNING</li>
<li>RIGHT</li>
<li>ROLLBACK</li>
<li>ROW</li>
<li>ROWS</li>
<li>SAVEPOINT</li>
<li>SELECT</li>
<li>SET</li>
<li>TABLE</li>
<li>TEMP</li>
<li>TEMPORARY</li>
<li>THEN</li>
<li>TIES</li>
<li>TO</li>
<li>TRANSACTION</li>
<li>TRIGGER</li>
<li>UNBOUNDED</li>
<li>UNION</li>
<li>UNIQUE</li>
<li>UPDATE</li>
<li>USING</li>
<li>VACUUM</li>
<li>VALUES</li>
<li>VIEW</li>
<li>VIRTUAL</li>
<li>WHEN</li>
<li>WHERE</li>
<li>WINDOW</li>
<li>WITH</li>
<li>WITHOUT</li>
</ul></div>

</ul></div><p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_keywords.in?m=0e6afea91e">2022-11-26 14:56:19</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_mathfunc.html.































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>Built-In Mathematical SQL Functions</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
Built-In Mathematical SQL Functions
</div>
</div>





<h1 id="overview"><span>1. </span>Overview</h1>

<p>The math functions shown below are a subgroup of
<a href="lang_corefunc.html">scalar functions</a> that are built into the
<a href="amalgamation.html">SQLite amalgamation source file</a> but are only active
if the amalgamation is compiled using the
<a href="compile.html#enable_math_functions">-DSQLITE_ENABLE_MATH_FUNCTIONS</a> compile-time option.

</p><p>The arguments to math functions can be integers, floating-point numbers,
or strings or blobs that look like integers or real numbers.  If any argument
is NULL or is a string or blob that is not readily converted into a number,
then the function will return NULL.
These functions also return NULL for domain errors, such as trying to
take the square root of a negative number, or compute the arccosine of a
value greater than 1.0 or less than -1.0.

</p><p>The values returned by these functions are often approximations.
For example, the <a href="lang_mathfunc.html#pi">pi()</a> function returns 
3.141592653589793115997963468544185161590576171875 which 
is about 1.22465e-16 too small, but it is the closest approximation available
for IEEE754 doubles.

<p>
<div class='columns' style='columns: 15em auto;'>
<ul style='padding-top:0;'>
<li><a href='lang_mathfunc.html#acos'>acos(X)</a></li>
<li><a href='lang_mathfunc.html#acosh'>acosh(X)</a></li>
<li><a href='lang_mathfunc.html#asin'>asin(X)</a></li>
<li><a href='lang_mathfunc.html#asinh'>asinh(X)</a></li>
<li><a href='lang_mathfunc.html#atan'>atan(X)</a></li>
<li><a href='lang_mathfunc.html#atan2'>atan2(Y,X)</a></li>
<li><a href='lang_mathfunc.html#atanh'>atanh(X)</a></li>
<li><a href='lang_mathfunc.html#ceil'>ceil(X)</a></li>
<li><a href='lang_mathfunc.html#ceil'>ceiling(X)</a></li>
<li><a href='lang_mathfunc.html#cos'>cos(X)</a></li>
<li><a href='lang_mathfunc.html#cosh'>cosh(X)</a></li>
<li><a href='lang_mathfunc.html#degrees'>degrees(X)</a></li>
<li><a href='lang_mathfunc.html#exp'>exp(X)</a></li>
<li><a href='lang_mathfunc.html#floor'>floor(X)</a></li>
<li><a href='lang_mathfunc.html#ln'>ln(X)</a></li>
<li><a href='lang_mathfunc.html#log'>log(B,X)</a></li>
<li><a href='lang_mathfunc.html#log'>log(X)</a></li>
<li><a href='lang_mathfunc.html#log'>log10(X)</a></li>
<li><a href='lang_mathfunc.html#log2'>log2(X)</a></li>
<li><a href='lang_mathfunc.html#mod'>mod(X,Y)</a></li>
<li><a href='lang_mathfunc.html#pi'>pi()</a></li>
<li><a href='lang_mathfunc.html#pow'>pow(X,Y)</a></li>
<li><a href='lang_mathfunc.html#pow'>power(X,Y)</a></li>
<li><a href='lang_mathfunc.html#radians'>radians(X)</a></li>
<li><a href='lang_mathfunc.html#sin'>sin(X)</a></li>
<li><a href='lang_mathfunc.html#sinh'>sinh(X)</a></li>
<li><a href='lang_mathfunc.html#sqrt'>sqrt(X)</a></li>
<li><a href='lang_mathfunc.html#tan'>tan(X)</a></li>
<li><a href='lang_mathfunc.html#tanh'>tanh(X)</a></li>
<li><a href='lang_mathfunc.html#trunc'>trunc(X)</a></li>
</ul>
</div>


</p><h1 id="descriptions_of_built_in_scalar_sql_math_functions"><span>2. </span>Descriptions of built-in scalar SQL math functions</h1>
<dl>

<a name="acos"></a>
<dt><p><b>acos(<i>X</i>)</b></dt><dd><p>
  Return the arccosine of X.  The result is in radians.
</dd>
<a name="acosh"></a>
<dt><p><b>acosh(<i>X</i>)</b></dt><dd><p>
  Return the hyperbolic arccosine of X.
</dd>
<a name="asin"></a>
<dt><p><b>asin(<i>X</i>)</b></dt><dd><p>
  Return the arcsine of X.  The result is in radians.
</dd>
<a name="asinh"></a>
<dt><p><b>asinh(<i>X</i>)</b></dt><dd><p>
  Return the hyperbolic arcsine of X.
</dd>
<a name="atan"></a>
<dt><p><b>atan(<i>X</i>)</b></dt><dd><p>
  Return the arctangent of X.  The result is in radians.
</dd>
<a name="atan2"></a>
<dt><p><b>atan2(<i>Y</i>,<i>X</i>)</b></dt><dd><p>
  Return the arctangent of Y/X.  The result is in radians.  The
  result is placed into correct quadrant depending on the signs
  of X and Y.
</dd>
<a name="atanh"></a>
<dt><p><b>atanh(<i>X</i>)</b></dt><dd><p>
  Return the hyperbolic arctangent of X.
</dd>
<a name="ceil"></a>
<dt><p><b>ceil(<i>X</i>)<br />ceiling(<i>X</i>)</b></dt><dd><p>
  Return the first representable integer value greater than or equal to X.
  For positive values of X, this routine rounds away from zero.
  For negative values of X, this routine rounds toward zero.
</dd>
<a name="cos"></a>
<dt><p><b>cos(<i>X</i>)</b></dt><dd><p>
  Return the cosine of X.  X is in radians.
</dd>
<a name="cosh"></a>
<dt><p><b>cosh(<i>X</i>)</b></dt><dd><p>
  Return the hyperbolic cosine of X.
</dd>
<a name="degrees"></a>
<dt><p><b>degrees(<i>X</i>)</b></dt><dd><p>
  Convert value X from radians into degrees.
</dd>
<a name="exp"></a>
<dt><p><b>exp(<i>X</i>)</b></dt><dd><p>
  Compute <i>e</i> (Euler's number, approximately 2.71828182845905) raised
  to the power X.
</dd>
<a name="floor"></a>
<dt><p><b>floor(<i>X</i>)</b></dt><dd><p>
  Return the first representable integer value less than or equal to X.
  For positive numbers, this function rounds toward zero.
  For negative numbers, this function rounds away from zero.
</dd>
<a name="ln"></a>
<dt><p><b>ln(<i>X</i>)</b></dt><dd><p>
  Return the natural logarithm of X.
</dd>
<a name="log"></a>
<dt><p><b>log(<i>X</i>)<br />log10(<i>X</i>)<br />log(<i>B</i>,<i>X</i>)</b></dt><dd><p>
  Return the base-10 logarithm for X.  Or, for the two-argument version,
  return the base-B logarithm of X.
  <p>
  Compatibility note:  SQLite works like PostgreSQL in that the log() function
  computes a base-10 logarithm.  Most other SQL database engines compute a
  natural logarithm for log().  In the two-argument version of log(B,X), the
  first argument is the base and the second argument is the operand.  This is
  the same as in PostgreSQL and MySQL, but is reversed from SQL Server which
  uses the second argument as the base and the first argument as the operand.
</dd>
<a name="log2"></a>
<dt><p><b>log2(<i>X</i>)</b></dt><dd><p>
  Return the logarithm base-2 for the number X.
</dd>
<a name="mod"></a>
<dt><p><b>mod(<i>X</i>,<i>Y</i>)</b></dt><dd><p>
  Return the remainder after dividing X by Y.  This is similar to the '%'
  operator, except that it works for non-integer arguments.
</dd>
<a name="pi"></a>
<dt><p><b>pi()</b></dt><dd><p>
  Return an approximation for &pi;.
</dd>
<a name="pow"></a>
<dt><p><b>pow(<i>X</i>,<i>Y</i>)<br />power(<i>X</i>,<i>Y</i>)</b></dt><dd><p>
  Compute X raised to the power Y.
</dd>
<a name="radians"></a>
<dt><p><b>radians(<i>X</i>)</b></dt><dd><p>
  Convert X from degrees into radians.
</dd>
<a name="sin"></a>
<dt><p><b>sin(<i>X</i>)</b></dt><dd><p>
  Return the sine of X.  X is in radians.
</dd>
<a name="sinh"></a>
<dt><p><b>sinh(<i>X</i>)</b></dt><dd><p>
  Return the hyperbolic sine of X.
</dd>
<a name="sqrt"></a>
<dt><p><b>sqrt(<i>X</i>)</b></dt><dd><p>
  Return the square root of X.  NULL is returned if X is negative.
</dd>
<a name="tan"></a>
<dt><p><b>tan(<i>X</i>)</b></dt><dd><p>
  Return the tangent of X.  X is in radians.
</dd>
<a name="tanh"></a>
<dt><p><b>tanh(<i>X</i>)</b></dt><dd><p>
  Return the hyperbolic tangent of X.
</dd>
<a name="trunc"></a>
<dt><p><b>trunc(<i>X</i>)</b></dt><dd><p>
  Return the representable integer in between X and 0 (inclusive)
  that is furthest away from zero.  Or, in other words, return the
  integer part of X, rounding toward zero.
  The trunc() function is similar to <a href="lang_mathfunc.html#ceil">ceiling(X)</a> and <a href="lang_mathfunc.html#floor">floor(X)</a> except
  that it always rounds toward zero whereas ceiling(X) and floor(X) round
  up and down, respectively.
</dd>

</dl>
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_mathfunc.in?m=5307cdcb91">2023-12-05 14:43:20</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_naming.html.













































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>Database Object Name Resolution</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>



<p>
  In SQLite, a database object (a table, index, trigger or view) is identified
  by the name of the object and the name of the database that it resides in. 
  Database objects may reside in the main database, the temp database, or in
  an <a href="lang_attach.html">attached database</a>.

<p>
  The syntax of the <a href="lang_droptable.html">DROP TABLE</a>, <a href="lang_dropindex.html">DROP INDEX</a>, <a href="lang_dropview.html">DROP VIEW</a>, <a href="lang_droptrigger.html">DROP TRIGGER</a>,
  <a href="lang_reindex.html">REINDEX</a>, <a href="lang_altertable.html">ALTER TABLE</a> and many other commands all permit the user to
  specify a database object either by its name alone, or by a combination of
  its name and the name of its database. If no database is specified as part
  of the object reference, then SQLite searches the main, temp and all attached
  databases for an object with a matching name. The temp database is searched
  first, followed by the main database, followed all attached databases in the
  order that they were attached. The reference resolves to the first match
  found. For example:

<pre>
      /* Add a table named 't1' to the temp, main and an attached database */
      ATTACH 'file.db' AS aux;
      CREATE TABLE t1(x, y);
      CREATE TEMP TABLE t1(x, y);
      CREATE TABLE aux.t1(x, y);

      DROP TABLE t1;         /* Drop table in temp database */
      DROP TABLE t1;         /* Drop table in main database */
      DROP TABLE t1;         /* Drop table in aux database */
</pre>

<p>
  If a schema name is specified as part of an object reference, it must be
  either "main", or "temp" or the schema-name of an attached database.
  Like other SQL identifiers, schema names are case-insensitive.
  If a schema name is specified, then only that one schema is searched for
  the named object.

<p>
  Most object references may only resolve to a specific type of object (for
  example a reference that is part of a DROP TABLE statement may only resolve
  to a table object, not an index, trigger or view). However in some contexts 
  (e.g. <a href="lang_reindex.html">REINDEX</a>) an object reference may be resolve to more than one type
  of object. When searching database schemas for a named object, objects of
  types that cannot be used in the context of the reference are always 
  ignored.
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_naming.in?m=eec821ac86">2022-01-08 05:02:57</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_reindex.html.

























































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>REINDEX</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
REINDEX
</div>
</div>




<p><b><a href="syntax/reindex-stmt.html">reindex-stmt:</a></b>
<button id='x2cf9baca' onclick='hideorshow("x2cf9baca","xb94d42e4")'>hide</button></p>
 <div id='xb94d42e4' class='imgcontainer'>
 <div style="max-width:619px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 619.286 137.376">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L111,32A15 15 0 0 0 126 17A15 15 0 0 0 111 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="79" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REINDEX</text>
<polygon points="167,82 156,86 156,77" style="fill:rgb(0,0,0)"/>
<path d="M126,17 L 133,17 Q 141,17 141,32 L 141,67 Q 141,82 151,82 L 162,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M182,97L279,97A15 15 0 0 0 294 82A15 15 0 0 0 279 67L182,67A15 15 0 0 0 167 82A15 15 0 0 0 182 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="317,82 305,86 305,77" style="fill:rgb(0,0,0)"/>
<path d="M294,82L311,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M332,97A15 15 0 0 0 347 82A15 15 0 0 0 332 67A15 15 0 0 0 317 82A15 15 0 0 0 332 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="383,82 372,86 372,77" style="fill:rgb(0,0,0)"/>
<path d="M347,82L377,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="425,120 413,124 413,115" style="fill:rgb(0,0,0)"/>
<path d="M383,82 L 391,82 Q 398,82 398,97 L 398,105 Q 398,120 409,120 L 419,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M440,135L518,135A15 15 0 0 0 533 120A15 15 0 0 0 518 104L440,104A15 15 0 0 0 425 120A15 15 0 0 0 440 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="479" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<polygon points="568,120 556,124 556,115" style="fill:rgb(0,0,0)"/>
<path d="M533,120L562,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,17 598,21 598,12" style="fill:rgb(0,0,0)"/>
<path d="M568,120 L 575,120 Q 583,120 583,105 L 583,32 Q 583,17 593,17 L 604,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="613" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="425,82 413,86 413,77" style="fill:rgb(0,0,0)"/>
<path d="M383,82L419,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M440,97L515,97A15 15 0 0 0 530 82A15 15 0 0 0 515 67L440,67A15 15 0 0 0 425 82A15 15 0 0 0 440 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="568,82 556,86 556,77" style="fill:rgb(0,0,0)"/>
<path d="M530,82L562,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M568,82 L 575,82 Q 583,82 583,74 L 583,67"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="383,17 372,21 372,12" style="fill:rgb(0,0,0)"/>
<path d="M126,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M383,17L598,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="167,44 156,48 156,40" style="fill:rgb(0,0,0)"/>
<path d="M126,17 L 133,17 Q 141,17 141,30 Q 141,44 151,44 L 162,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M182,59L288,59A15 15 0 0 0 303 44L303,44A15 15 0 0 0 288 29L182,29A15 15 0 0 0 167 44L167,44A15 15 0 0 0 182 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="235" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="568,44 556,48 556,40" style="fill:rgb(0,0,0)"/>
<path d="M303,44L562,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M568,44 L 575,44 Q 583,44 583,36 L 583,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,120 219,124 219,115" style="fill:rgb(0,0,0)"/>
<path d="M141,67 L 141,105 Q 141,120 156,120 L 210,120 L 225,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M231,120 L 347,120 Q 362,120 362,105 L 362,97 Q 362,82 370,82 L 377,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>


<p>The REINDEX command is used to delete and recreate indices from scratch.
This is useful when the definition of a collation sequence has changed, or
when there are <a href="expridx.html">indexes on expressions</a> involving a function whose definition
has changed.
</p>

<p>If the REINDEX keyword is not followed by a collation-sequence or database 
object identifier, then all indices in all attached databases are rebuilt.

</p><p>If the REINDEX keyword is followed by a collation-sequence name, then
all indices in all attached databases that use the named collation sequences
are recreated. 

</p><p>Or, if the argument attached to the REINDEX identifies a specific 
database table, then all indices attached to the database table are rebuilt. 
If it identifies a specific database index, then just that index is recreated.

</p><p>For a command of the form "REINDEX <i>name</i>", a match
against <span class='yyterm'>collation-name</span> takes precedence over a match
against <span class='yyterm'>index-name</span> or <span class='yyterm'>table-name</span>.
This ambiguity in the syntax may be avoided by always specifying a
<span class='yyterm'>schema-name</span> when reindexing a specific table or index.
</p><p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_reindex.in?m=a26831b152">2022-01-08 05:02:57</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_replace.html.











































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>REPLACE</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
REPLACE
</div>
</div>




<p>The REPLACE command is an alias for the "<a href="lang_conflict.html">INSERT OR REPLACE</a>"
variant of the <a href="lang_insert.html">INSERT</a> command.  
This alias is provided for compatibility other SQL database engines.  See the 
<a href="lang_insert.html">INSERT</a> command documentation for additional information.</p>
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_replace.in?m=e432c86fb7">2022-01-08 05:02:57</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_returning.html.

















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>RETURNING</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
RETURNING
</div>
<div class="fancy_toc">
<a onclick="toggle_toc()">
<span class="fancy_toc_mark" id="toc_mk">&#x25ba;</span>
Table Of Contents
</a>
<div id="toc_sub"><div class="fancy-toc1"><a href="#overview">1. Overview</a></div>
<div class="fancy-toc2"><a href="#typical_use">1.1. Typical Use</a></div>
<div class="fancy-toc1"><a href="#details">2. Details</a></div>
<div class="fancy-toc2"><a href="#processing_order">2.1. Processing Order</a></div>
<div class="fancy-toc2"><a href="#acid_changes">2.2. ACID Changes</a></div>
<div class="fancy-toc1"><a href="#limitations_and_caveats">3. Limitations And Caveats</a></div>
</div>
</div>
<script>
function toggle_toc(){
var sub = document.getElementById("toc_sub")
var mk = document.getElementById("toc_mk")
if( sub.style.display!="block" ){
sub.style.display = "block";
mk.innerHTML = "&#x25bc;";
} else {
sub.style.display = "none";
mk.innerHTML = "&#x25ba;";
}
}
</script>
</div>




<h1 id="overview"><span>1. </span>Overview</h1>

<p><b><a href="syntax/returning-clause.html">returning-clause:</a></b>
<button id='x7976e0a4' onclick='hideorshow("x7976e0a4","xa416104f")'>hide</button></p>
 <div id='xa416104f' class='imgcontainer'>
 <div style="max-width:628px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 628.709 140.4">
<circle cx="5" cy="47" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="27,47 15,51 15,43" style="fill:rgb(0,0,0)"/>
<path d="M9,47L21,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M42,62L132,62A15 15 0 0 0 147 47A15 15 0 0 0 132 32L42,32A15 15 0 0 0 27 47A15 15 0 0 0 42 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RETURNING</text>
<polygon points="237,47 226,51 226,43" style="fill:rgb(0,0,0)"/>
<path d="M147,47L232,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M237,62L287,62L287,32L237,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="262" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="328,77 317,82 317,73" style="fill:rgb(0,0,0)"/>
<path d="M287,47 L 294,47 Q 302,47 302,62 L 302,62 Q 302,77 312,77 L 322,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M343,92L347,92A15 15 0 0 0 362 77L362,77A15 15 0 0 0 347 62L343,62A15 15 0 0 0 328 77L328,77A15 15 0 0 0 343 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="398,77 387,82 387,73" style="fill:rgb(0,0,0)"/>
<path d="M362,77L393,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M414,92L501,92A15 15 0 0 0 516 77L516,77A15 15 0 0 0 501 62L414,62A15 15 0 0 0 398 77L398,77A15 15 0 0 0 414 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="457" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="539,77 528,82 528,73" style="fill:rgb(0,0,0)"/>
<path d="M516,77L534,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="581,47 569,51 569,43" style="fill:rgb(0,0,0)"/>
<path d="M539,77 L 547,77 Q 554,77 554,62 L 554,62 Q 554,47 565,47 L 575,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="619,47 607,51 607,43" style="fill:rgb(0,0,0)"/>
<path d="M581,47L613,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="622" cy="47" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="345,101 334,106 334,97" style="fill:rgb(0,0,0)"/>
<path d="M302,62 L 302,86 Q 302,101 317,101 L 325,101 L 340,101"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,101 L 362,101 Q 377,101 377,89 Q 377,77 385,77 L 392,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="453,47 441,51 441,43" style="fill:rgb(0,0,0)"/>
<path d="M287,47L447,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,47L607,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,138A15 15 0 0 0 406 123A15 15 0 0 0 391 108A15 15 0 0 0 376 123A15 15 0 0 0 391 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="391" y="123" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="376,123 365,127 365,118" style="fill:rgb(0,0,0)"/>
<path d="M147,47 L 196,47 Q 211,47 211,62 L 211,108 Q 211,123 226,123 L 355,123 L 370,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="539,123 528,127 528,118" style="fill:rgb(0,0,0)"/>
<path d="M406,123L534,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,123 L 547,123 Q 554,123 554,108 L 554,77 L 554,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,32A15 15 0 0 0 406 17A15 15 0 0 0 391 2A15 15 0 0 0 376 17A15 15 0 0 0 391 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="391" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="406,17 418,12 418,21" style="fill:rgb(0,0,0)"/>
<path d="M581,47 L 588,47 Q 596,47 596,32 L 596,32 Q 596,17 581,17 L 427,17 L 412,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="186,47 174,51 174,43" style="fill:rgb(0,0,0)"/>
<path d="M376,17 L 174,17 Q 159,17 159,32 L 159,32 Q 159,47 169,47 L 180,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/expr.html">expr:</a></b>
<button id='xe691e618' onclick='hideorshow("xe691e618","x63f05421")'>show</button></p>
 <div id='x63f05421' style='display:none;' class='imgcontainer'>
 <div style="max-width:963px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 963.96 1068.77">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L158,32L158,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="101" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="954,17 943,21 943,12" style="fill:rgb(0,0,0)"/>
<path d="M158,17L948,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="958" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L172,70A15 15 0 0 0 187 55L187,55A15 15 0 0 0 172 39L60,39A15 15 0 0 0 45 55L45,55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">bind-parameter</text>
<polygon points="916,55 905,59 905,50" style="fill:rgb(0,0,0)"/>
<path d="M187,55L910,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,55 L 924,55 Q 931,55 931,47 L 931,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 31,55 L 39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,130L156,130A15 15 0 0 0 171 115A15 15 0 0 0 156 100L60,100A15 15 0 0 0 45 115A15 15 0 0 0 60 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,115 183,119 183,111" style="fill:rgb(0,0,0)"/>
<path d="M171,115L189,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,130A15 15 0 0 0 225 115A15 15 0 0 0 210 100A15 15 0 0 0 195 115A15 15 0 0 0 210 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M225,115L255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130L351,130A15 15 0 0 0 366 115A15 15 0 0 0 351 100L276,100A15 15 0 0 0 261 115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="389,115 378,119 378,111" style="fill:rgb(0,0,0)"/>
<path d="M366,115L383,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,130A15 15 0 0 0 419 115A15 15 0 0 0 404 100A15 15 0 0 0 389 115A15 15 0 0 0 404 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="404" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="455,115 444,119 444,111" style="fill:rgb(0,0,0)"/>
<path d="M419,115L450,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,130L565,130A15 15 0 0 0 580 115A15 15 0 0 0 565 100L471,100A15 15 0 0 0 455 115A15 15 0 0 0 471 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="916,115 905,119 905,111" style="fill:rgb(0,0,0)"/>
<path d="M580,115L910,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,115 L 924,115 Q 931,115 931,108 L 931,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,115 33,119 33,111" style="fill:rgb(0,0,0)"/>
<path d="M24,100 L 24,108 Q 24,115 31,115 L 39,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,89 97,93 97,84" style="fill:rgb(0,0,0)"/>
<path d="M24,74 L 24,81 Q 24,89 39,89 L 87,89 L 102,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 302,93 302,84" style="fill:rgb(0,0,0)"/>
<path d="M108,89 L 129,89 Q 144,89 159,89 L 293,89 L 308,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,89 L 414,89 Q 429,89 429,102 Q 429,115 436,115 L 444,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M223,89 L 230,89 Q 238,89 238,102 Q 238,115 245,115 L 253,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,168L168,168A15 15 0 0 0 183 153A15 15 0 0 0 168 138L60,138A15 15 0 0 0 45 153A15 15 0 0 0 60 168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">unary-operator</text>
<polygon points="206,153 194,157 194,149" style="fill:rgb(0,0,0)"/>
<path d="M183,153L200,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,168L255,168L255,138L206,138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,153 905,157 905,149" style="fill:rgb(0,0,0)"/>
<path d="M255,153L910,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,153 L 924,153 Q 931,153 931,145 L 931,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,153 33,157 33,149" style="fill:rgb(0,0,0)"/>
<path d="M24,138 L 24,145 Q 24,153 31,153 L 39,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,206L94,206L94,176L45,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,191 106,195 106,186" style="fill:rgb(0,0,0)"/>
<path d="M94,191L111,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,206L245,206A15 15 0 0 0 261 191A15 15 0 0 0 245 176L132,176A15 15 0 0 0 117 191A15 15 0 0 0 132 206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">binary-operator</text>
<polygon points="284,191 272,195 272,186" style="fill:rgb(0,0,0)"/>
<path d="M261,191L278,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,206L333,206L333,176L284,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="308" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,191 905,195 905,186" style="fill:rgb(0,0,0)"/>
<path d="M333,191L910,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,191 L 924,191 Q 931,191 931,183 L 931,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,191 33,195 33,186" style="fill:rgb(0,0,0)"/>
<path d="M24,176 L 24,183 Q 24,191 31,191 L 39,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,245L162,245A15 15 0 0 0 177 230A15 15 0 0 0 162 215L60,215A15 15 0 0 0 45 230A15 15 0 0 0 60 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="111" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-name</text>
<polygon points="194,230 183,234 183,226" style="fill:rgb(0,0,0)"/>
<path d="M177,230L188,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,245A15 15 0 0 0 224 230A15 15 0 0 0 209 215A15 15 0 0 0 194 230A15 15 0 0 0 209 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="260,230 249,234 249,226" style="fill:rgb(0,0,0)"/>
<path d="M224,230L255,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,245L437,245L437,215L260,215Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-arguments</text>
<polygon points="473,230 461,234 461,226" style="fill:rgb(0,0,0)"/>
<path d="M437,230L467,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,245A15 15 0 0 0 503 230A15 15 0 0 0 488 215A15 15 0 0 0 473 230A15 15 0 0 0 488 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="541,260 529,265 529,256" style="fill:rgb(0,0,0)"/>
<path d="M503,230 L 510,230 Q 518,230 518,245 L 518,245 Q 518,260 527,260 L 535,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,275L653,275L653,245L541,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="691,230 680,234 680,226" style="fill:rgb(0,0,0)"/>
<path d="M653,260 L 661,260 Q 668,260 668,245 L 668,245 Q 668,230 677,230 L 685,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="729,260 718,265 718,256" style="fill:rgb(0,0,0)"/>
<path d="M691,230 L 699,230 Q 706,230 706,245 L 706,245 Q 706,260 715,260 L 723,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,275L837,275L837,245L729,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="783" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">over-clause</text>
<polygon points="916,260 905,265 905,256" style="fill:rgb(0,0,0)"/>
<path d="M837,260L910,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,260 L 924,260 Q 931,260 931,253 L 931,245"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,230 33,234 33,226" style="fill:rgb(0,0,0)"/>
<path d="M24,215 L 24,222 Q 24,230 31,230 L 39,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,230 585,234 585,226" style="fill:rgb(0,0,0)"/>
<path d="M503,230L591,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,230L680,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,230 905,234 905,226" style="fill:rgb(0,0,0)"/>
<path d="M691,230L910,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,230 L 924,230 Q 931,230 931,222 L 931,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,321A15 15 0 0 0 75 306A15 15 0 0 0 60 290A15 15 0 0 0 45 306A15 15 0 0 0 60 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,306 100,310 100,301" style="fill:rgb(0,0,0)"/>
<path d="M75,306L105,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M111,321L160,321L160,290L111,290Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="306" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="196,306 185,310 185,301" style="fill:rgb(0,0,0)"/>
<path d="M160,306L191,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,321A15 15 0 0 0 227 306A15 15 0 0 0 211 290A15 15 0 0 0 196 306A15 15 0 0 0 211 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,306 905,310 905,301" style="fill:rgb(0,0,0)"/>
<path d="M227,306L910,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,306 L 924,306 Q 931,306 931,298 L 931,291"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,306 33,310 33,301" style="fill:rgb(0,0,0)"/>
<path d="M24,290 L 24,298 Q 24,306 31,306 L 39,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,284A15 15 0 0 0 151 269A15 15 0 0 0 136 254A15 15 0 0 0 121 269A15 15 0 0 0 136 284Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="269" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="151,269 162,265 162,274" style="fill:rgb(0,0,0)"/>
<path d="M160,306 L 168,306 Q 175,306 175,291 L 175,284 Q 175,269 166,269 L 157,269"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,269 L 103,269 Q 88,269 88,284 L 88,291 Q 88,306 96,306 L 103,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,358L88,358A15 15 0 0 0 103 343A15 15 0 0 0 88 328L60,328A15 15 0 0 0 45 343A15 15 0 0 0 60 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CAST</text>
<polygon points="126,343 114,348 114,339" style="fill:rgb(0,0,0)"/>
<path d="M103,343L120,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M141,358A15 15 0 0 0 156 343A15 15 0 0 0 141 328A15 15 0 0 0 126 343A15 15 0 0 0 141 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="179,343 168,348 168,339" style="fill:rgb(0,0,0)"/>
<path d="M156,343L173,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,358L228,358L228,328L179,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="251,343 240,348 240,339" style="fill:rgb(0,0,0)"/>
<path d="M228,343L246,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,358L271,358A15 15 0 0 0 286 343A15 15 0 0 0 271 328L267,328A15 15 0 0 0 251 343A15 15 0 0 0 267 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="269" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="309,343 297,348 297,339" style="fill:rgb(0,0,0)"/>
<path d="M286,343L303,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,358L408,358L408,328L309,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="358" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="431,343 419,348 419,339" style="fill:rgb(0,0,0)"/>
<path d="M408,343L425,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M446,358A15 15 0 0 0 461 343A15 15 0 0 0 446 328A15 15 0 0 0 431 343A15 15 0 0 0 446 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,343 905,348 905,339" style="fill:rgb(0,0,0)"/>
<path d="M461,343L910,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,343 L 924,343 Q 931,343 931,336 L 931,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,343 33,348 33,339" style="fill:rgb(0,0,0)"/>
<path d="M24,328 L 24,336 Q 24,343 31,343 L 39,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,396L94,396L94,366L45,366Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,381 106,385 106,377" style="fill:rgb(0,0,0)"/>
<path d="M94,381L111,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,396L196,396A15 15 0 0 0 211 381A15 15 0 0 0 196 366L132,366A15 15 0 0 0 117 381A15 15 0 0 0 132 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="234,381 223,385 223,377" style="fill:rgb(0,0,0)"/>
<path d="M211,381L229,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,396L355,396A15 15 0 0 0 370 381A15 15 0 0 0 355 366L250,366A15 15 0 0 0 234 381A15 15 0 0 0 250 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="916,381 905,385 905,377" style="fill:rgb(0,0,0)"/>
<path d="M370,381L910,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,381 L 924,381 Q 931,381 931,374 L 931,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,381 33,385 33,377" style="fill:rgb(0,0,0)"/>
<path d="M24,366 L 24,374 Q 24,381 31,381 L 39,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,434L94,434L94,404L45,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,419 119,423 119,415" style="fill:rgb(0,0,0)"/>
<path d="M94,419L124,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,434L165,434A15 15 0 0 0 180 419A15 15 0 0 0 165 404L145,404A15 15 0 0 0 130 419A15 15 0 0 0 145 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="234,419 223,423 223,415" style="fill:rgb(0,0,0)"/>
<path d="M180,419L229,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,434L273,434A15 15 0 0 0 288 419A15 15 0 0 0 273 404L250,404A15 15 0 0 0 234 419A15 15 0 0 0 250 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIKE</text>
<path d="M250,472L279,472A15 15 0 0 0 294 457A15 15 0 0 0 279 442L250,442A15 15 0 0 0 234 457A15 15 0 0 0 250 472Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="457" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GLOB</text>
<path d="M250,510L302,510A15 15 0 0 0 317 495A15 15 0 0 0 302 479L250,479A15 15 0 0 0 234 495A15 15 0 0 0 250 510Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REGEXP</text>
<path d="M250,547L297,547A15 15 0 0 0 313 532A15 15 0 0 0 297 517L250,517A15 15 0 0 0 234 532A15 15 0 0 0 250 547Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="274" y="532" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<path d="M378,510L427,510L427,479L378,479Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M378,434L427,434L427,404L378,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="465,449 454,454 454,445" style="fill:rgb(0,0,0)"/>
<path d="M427,419 L 435,419 Q 442,419 442,434 L 442,434 Q 442,449 451,449 L 460,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,464L532,464A15 15 0 0 0 547 449A15 15 0 0 0 532 434L480,434A15 15 0 0 0 465 449A15 15 0 0 0 480 464Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="506" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ESCAPE</text>
<polygon points="570,449 559,454 559,445" style="fill:rgb(0,0,0)"/>
<path d="M547,449L565,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M570,464L620,464L620,434L570,434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="595" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="671,419 659,423 659,415" style="fill:rgb(0,0,0)"/>
<path d="M620,449 L 627,449 Q 635,449 635,434 L 635,434 Q 635,419 650,419 L 650,419 L 665,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,419 905,423 905,415" style="fill:rgb(0,0,0)"/>
<path d="M671,419L910,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,419 L 924,419 Q 931,419 931,411 L 931,404"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,419 33,423 33,415" style="fill:rgb(0,0,0)"/>
<path d="M24,404 L 24,411 Q 24,419 31,419 L 39,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M100,419 L 108,419 Q 115,419 115,434 L 115,434 Q 115,449 130,449 L 177,449 Q 192,449 192,434 L 192,434 Q 192,419 199,419 L 207,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,532 223,537 223,528" style="fill:rgb(0,0,0)"/>
<path d="M196,419 L 204,419 Q 211,419 211,434 L 211,517 Q 211,532 220,532 L 229,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,457 223,461 223,452" style="fill:rgb(0,0,0)"/>
<path d="M211,442 L 211,449 Q 211,457 220,457 L 229,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,495 223,499 223,490" style="fill:rgb(0,0,0)"/>
<path d="M211,479 L 211,487 Q 211,495 220,495 L 229,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,419 367,423 367,415" style="fill:rgb(0,0,0)"/>
<path d="M288,419L372,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,532 329,537 329,528" style="fill:rgb(0,0,0)"/>
<path d="M313,532L334,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,495 367,499 367,490" style="fill:rgb(0,0,0)"/>
<path d="M340,532 L 348,532 Q 355,532 355,517 L 355,510 Q 355,495 364,495 L 372,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,495 329,499 329,490" style="fill:rgb(0,0,0)"/>
<path d="M317,495L334,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,495L378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,457 329,461 329,452" style="fill:rgb(0,0,0)"/>
<path d="M294,457L334,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,457 L 348,457 Q 355,457 355,472 L 355,480 Q 355,495 367,495 L 378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="506,419 495,423 495,415" style="fill:rgb(0,0,0)"/>
<path d="M427,419L501,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M506,419L659,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="547,495 536,499 536,490" style="fill:rgb(0,0,0)"/>
<path d="M427,495L542,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,495 L 656,495 Q 671,495 671,480 L 671,434 Q 671,419 686,419 L 692,419 L 707,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,585L94,585L94,555L45,555Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,570 119,574 119,566" style="fill:rgb(0,0,0)"/>
<path d="M94,570L124,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,585L194,585A15 15 0 0 0 209 570A15 15 0 0 0 194 555L145,555A15 15 0 0 0 130 570A15 15 0 0 0 145 585Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="170" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ISNULL</text>
<polygon points="916,570 905,574 905,566" style="fill:rgb(0,0,0)"/>
<path d="M209,570L910,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,570 L 924,570 Q 931,570 931,563 L 931,555"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,570 33,574 33,566" style="fill:rgb(0,0,0)"/>
<path d="M24,555 L 24,563 Q 24,570 31,570 L 39,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,623L215,623A15 15 0 0 0 230 608A15 15 0 0 0 215 593L145,593A15 15 0 0 0 130 608A15 15 0 0 0 145 623Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="608" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTNULL</text>
<path d="M145,661L165,661A15 15 0 0 0 180 646A15 15 0 0 0 165 631L145,631A15 15 0 0 0 130 646A15 15 0 0 0 145 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="203,646 192,650 192,641" style="fill:rgb(0,0,0)"/>
<path d="M180,646L198,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,661L250,661A15 15 0 0 0 265 646A15 15 0 0 0 250 631L219,631A15 15 0 0 0 203 646A15 15 0 0 0 219 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="288,646 276,650 276,641" style="fill:rgb(0,0,0)"/>
<path d="M265,646L282,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="339,570 327,574 327,566" style="fill:rgb(0,0,0)"/>
<path d="M288,646 L 295,646 Q 303,646 303,631 L 303,585 Q 303,570 318,570 L 318,570 L 333,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="288,608 276,612 276,604" style="fill:rgb(0,0,0)"/>
<path d="M230,608L282,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,608 L 295,608 Q 303,608 303,600 L 303,593"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,646 119,650 119,641" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,631 Q 109,646 117,646 L 124,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,608 119,612 119,604" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,593 Q 109,608 117,608 L 124,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,699L94,699L94,668L45,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,684 106,688 106,679" style="fill:rgb(0,0,0)"/>
<path d="M94,684L111,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,699A15 15 0 0 0 147 684A15 15 0 0 0 132 668A15 15 0 0 0 117 684A15 15 0 0 0 132 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IS</text>
<polygon points="183,684 172,688 172,679" style="fill:rgb(0,0,0)"/>
<path d="M147,684L178,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M198,699L219,699A15 15 0 0 0 234 684A15 15 0 0 0 219 668L198,668A15 15 0 0 0 183 684A15 15 0 0 0 198 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="270,684 258,688 258,679" style="fill:rgb(0,0,0)"/>
<path d="M234,684L264,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="306,684 294,688 294,679" style="fill:rgb(0,0,0)"/>
<path d="M270,684L300,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,699L389,699A15 15 0 0 0 404 684A15 15 0 0 0 389 668L321,668A15 15 0 0 0 306 684A15 15 0 0 0 321 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="440,684 429,688 429,679" style="fill:rgb(0,0,0)"/>
<path d="M404,684L434,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,699L490,699A15 15 0 0 0 505 684A15 15 0 0 0 490 668L455,668A15 15 0 0 0 440 684A15 15 0 0 0 455 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="541,684 530,688 530,679" style="fill:rgb(0,0,0)"/>
<path d="M505,684L535,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,699L590,699L590,668L541,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,684 905,688 905,679" style="fill:rgb(0,0,0)"/>
<path d="M590,684L910,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,684 L 924,684 Q 931,684 931,676 L 931,669"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,684 33,688 33,679" style="fill:rgb(0,0,0)"/>
<path d="M24,668 L 24,676 Q 24,684 31,684 L 39,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,684 L 156,684 Q 164,684 164,696 Q 164,708 179,708 L 230,708 Q 245,708 245,696 Q 245,684 253,684 L 260,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,684 L 279,684 Q 286,684 286,696 Q 286,708 301,708 L 502,708 Q 517,708 517,696 Q 517,684 524,684 L 532,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,744L94,744L94,714L45,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,729 119,733 119,725" style="fill:rgb(0,0,0)"/>
<path d="M94,729L124,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,744L165,744A15 15 0 0 0 180 729A15 15 0 0 0 165 714L145,714A15 15 0 0 0 130 729A15 15 0 0 0 145 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,729 205,733 205,725" style="fill:rgb(0,0,0)"/>
<path d="M180,729L211,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,744L304,744A15 15 0 0 0 319 729A15 15 0 0 0 304 714L232,714A15 15 0 0 0 216 729A15 15 0 0 0 232 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="342,729 331,733 331,725" style="fill:rgb(0,0,0)"/>
<path d="M319,729L336,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M342,744L391,744L391,714L342,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="367" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="414,729 403,733 403,725" style="fill:rgb(0,0,0)"/>
<path d="M391,729L409,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M430,744L450,744A15 15 0 0 0 465 729A15 15 0 0 0 450 714L430,714A15 15 0 0 0 414 729A15 15 0 0 0 430 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="488,729 477,733 477,725" style="fill:rgb(0,0,0)"/>
<path d="M465,729L483,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,744L538,744L538,714L488,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="513" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,729 905,733 905,725" style="fill:rgb(0,0,0)"/>
<path d="M538,729L910,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,729 L 924,729 Q 931,729 931,721 L 931,714"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,729 33,733 33,725" style="fill:rgb(0,0,0)"/>
<path d="M24,714 L 24,721 Q 24,729 31,729 L 39,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,729 L 103,729 Q 110,729 110,741 Q 110,753 125,753 L 177,753 Q 192,753 192,741 Q 192,729 199,729 L 207,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,797L94,797L94,767L45,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,782 119,786 119,778" style="fill:rgb(0,0,0)"/>
<path d="M94,782L124,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,797L165,797A15 15 0 0 0 180 782A15 15 0 0 0 165 767L145,767A15 15 0 0 0 130 782A15 15 0 0 0 145 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,782 205,786 205,778" style="fill:rgb(0,0,0)"/>
<path d="M180,782L211,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,797L234,797A15 15 0 0 0 249 782A15 15 0 0 0 234 767L232,767A15 15 0 0 0 216 782A15 15 0 0 0 232 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IN</text>
<polygon points="285,782 273,786 273,778" style="fill:rgb(0,0,0)"/>
<path d="M249,782L279,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,797A15 15 0 0 0 315 782A15 15 0 0 0 300 767A15 15 0 0 0 285 782A15 15 0 0 0 300 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,782 340,786 340,778" style="fill:rgb(0,0,0)"/>
<path d="M315,782L345,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,797L455,797L455,767L351,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="491,782 480,786 480,778" style="fill:rgb(0,0,0)"/>
<path d="M455,782L486,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M507,797A15 15 0 0 0 522 782A15 15 0 0 0 507 767A15 15 0 0 0 491 782A15 15 0 0 0 507 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="507" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,782 905,786 905,778" style="fill:rgb(0,0,0)"/>
<path d="M522,782L910,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,782 L 924,782 Q 931,782 931,774 L 931,767"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,782 33,786 33,778" style="fill:rgb(0,0,0)"/>
<path d="M24,767 L 24,774 Q 24,782 31,782 L 39,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,782 L 103,782 Q 110,782 110,794 Q 110,806 125,806 L 177,806 Q 192,806 192,794 Q 192,782 199,782 L 207,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,782 L 324,782 Q 332,782 332,770 Q 332,758 347,758 L 452,758 Q 467,758 467,770 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M379,835L428,835L428,805L379,805Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="820" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="379,820 367,824 367,815" style="fill:rgb(0,0,0)"/>
<path d="M317,782 L 324,782 Q 332,782 332,797 L 332,805 Q 332,820 347,820 L 358,820 L 373,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M428,820 L 452,820 Q 467,820 467,805 L 467,797 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,873A15 15 0 0 0 418 857A15 15 0 0 0 403 842A15 15 0 0 0 388 857A15 15 0 0 0 403 873Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="857" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,857 430,853 430,862" style="fill:rgb(0,0,0)"/>
<path d="M428,820 L 435,820 Q 443,820 443,835 L 443,842 Q 443,857 434,857 L 424,857"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,857 L 371,857 Q 356,857 356,842 L 356,835 Q 356,820 363,820 L 371,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,925L396,925A15 15 0 0 0 412 910A15 15 0 0 0 396 895L300,895A15 15 0 0 0 285 910A15 15 0 0 0 300 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="429,910 417,915 417,906" style="fill:rgb(0,0,0)"/>
<path d="M412,910L423,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,925A15 15 0 0 0 459 910A15 15 0 0 0 444 895A15 15 0 0 0 429 910A15 15 0 0 0 444 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="513,910 502,915 502,906" style="fill:rgb(0,0,0)"/>
<path d="M459,910L507,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,925L627,925A15 15 0 0 0 642 910A15 15 0 0 0 627 895L528,895A15 15 0 0 0 513 910A15 15 0 0 0 528 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="577" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function</text>
<polygon points="659,910 647,915 647,906" style="fill:rgb(0,0,0)"/>
<path d="M642,910L653,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,925A15 15 0 0 0 689 910A15 15 0 0 0 674 895A15 15 0 0 0 659 910A15 15 0 0 0 674 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="734,910 723,915 723,906" style="fill:rgb(0,0,0)"/>
<path d="M689,910L728,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,925L783,925L783,895L734,895Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="828,910 817,915 817,906" style="fill:rgb(0,0,0)"/>
<path d="M783,910L823,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M844,925A15 15 0 0 0 859 910A15 15 0 0 0 844 895A15 15 0 0 0 828 910A15 15 0 0 0 844 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="844" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,910 905,915 905,906" style="fill:rgb(0,0,0)"/>
<path d="M859,910L910,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,910 L 924,910 Q 931,910 931,903 L 931,895"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,865L603,865A15 15 0 0 0 619 850A15 15 0 0 0 603 835L528,835A15 15 0 0 0 513 850A15 15 0 0 0 528 865Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="850" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="916,850 905,854 905,846" style="fill:rgb(0,0,0)"/>
<path d="M619,850L910,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,850 L 924,850 Q 931,850 931,842 L 931,835"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="513,850 502,854 502,846" style="fill:rgb(0,0,0)"/>
<path d="M475,910 L 483,910 Q 490,910 490,895 L 490,865 Q 490,850 499,850 L 507,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,892A15 15 0 0 0 774 877A15 15 0 0 0 759 862A15 15 0 0 0 744 877A15 15 0 0 0 759 892Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="877" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="774,877 785,873 785,881" style="fill:rgb(0,0,0)"/>
<path d="M783,910 L 791,910 Q 798,910 798,895 L 798,892 Q 798,877 789,877 L 780,877"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M744,877 L 726,877 Q 711,877 711,892 L 711,895 Q 711,910 719,910 L 726,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M689,910 L 697,910 Q 704,910 704,921 Q 704,932 719,932 L 790,932 Q 805,932 805,921 Q 805,910 813,910 L 820,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="285,910 273,915 273,906" style="fill:rgb(0,0,0)"/>
<path d="M249,782 L 256,782 Q 264,782 264,797 L 264,895 Q 264,910 272,910 L 279,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,882 412,886 412,877" style="fill:rgb(0,0,0)"/>
<path d="M264,867 L 264,874 Q 264,882 279,882 L 402,882 L 417,882"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,882 L 456,882 Q 471,882 471,896 Q 471,910 478,910 L 486,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,971L80,971A15 15 0 0 0 95 956A15 15 0 0 0 80 941L60,941A15 15 0 0 0 45 956A15 15 0 0 0 60 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="131,956 120,960 120,951" style="fill:rgb(0,0,0)"/>
<path d="M95,956L125,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,971L191,971A15 15 0 0 0 206 956A15 15 0 0 0 191 941L146,941A15 15 0 0 0 131 956A15 15 0 0 0 146 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="242,956 231,960 231,951" style="fill:rgb(0,0,0)"/>
<path d="M206,956L236,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,971A15 15 0 0 0 272 956A15 15 0 0 0 257 941A15 15 0 0 0 242 956A15 15 0 0 0 257 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="295,956 284,960 284,951" style="fill:rgb(0,0,0)"/>
<path d="M272,956L290,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,971L400,971L400,941L295,941Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="423,956 411,960 411,951" style="fill:rgb(0,0,0)"/>
<path d="M400,956L417,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,971A15 15 0 0 0 453 956A15 15 0 0 0 438 941A15 15 0 0 0 423 956A15 15 0 0 0 438 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,956 905,960 905,951" style="fill:rgb(0,0,0)"/>
<path d="M453,956L910,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,956 L 924,956 Q 931,956 931,948 L 931,941"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,956 33,960 33,951" style="fill:rgb(0,0,0)"/>
<path d="M24,941 L 24,948 Q 24,956 31,956 L 39,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,929 59,934 59,925" style="fill:rgb(0,0,0)"/>
<path d="M24,914 L 24,922 Q 24,929 39,929 L 49,929 L 64,929"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,929 L 201,929 Q 216,929 216,943 Q 216,956 223,956 L 231,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,929 L 101,929 Q 108,929 108,943 Q 108,956 116,956 L 123,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,1009L89,1009A15 15 0 0 0 104 994A15 15 0 0 0 89 978L60,978A15 15 0 0 0 45 994A15 15 0 0 0 60 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASE</text>
<polygon points="140,994 128,998 128,989" style="fill:rgb(0,0,0)"/>
<path d="M104,994L134,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M140,1009L189,1009L189,978L140,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="243,994 232,998 232,989" style="fill:rgb(0,0,0)"/>
<path d="M189,994L237,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,1009L298,1009A15 15 0 0 0 313 994A15 15 0 0 0 298 978L258,978A15 15 0 0 0 243 994A15 15 0 0 0 258 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="336,994 324,998 324,989" style="fill:rgb(0,0,0)"/>
<path d="M313,994L330,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,1009L385,1009L385,978L336,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="408,994 396,998 396,989" style="fill:rgb(0,0,0)"/>
<path d="M385,994L402,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,1009L456,1009A15 15 0 0 0 472 994A15 15 0 0 0 456 978L423,978A15 15 0 0 0 408 994A15 15 0 0 0 423 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">THEN</text>
<polygon points="495,994 483,998 483,989" style="fill:rgb(0,0,0)"/>
<path d="M472,994L489,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M495,1009L544,1009L544,978L495,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="616,994 604,998 604,989" style="fill:rgb(0,0,0)"/>
<path d="M544,994L610,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M631,1009L658,1009A15 15 0 0 0 673 994A15 15 0 0 0 658 978L631,978A15 15 0 0 0 616 994A15 15 0 0 0 631 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="645" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ELSE</text>
<polygon points="696,994 685,998 685,989" style="fill:rgb(0,0,0)"/>
<path d="M673,994L691,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M696,1009L746,1009L746,978L696,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="721" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="782,994 770,998 770,989" style="fill:rgb(0,0,0)"/>
<path d="M746,994L776,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M797,1009L818,1009A15 15 0 0 0 833 994A15 15 0 0 0 818 978L797,978A15 15 0 0 0 782 994A15 15 0 0 0 797 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="807" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="916,994 905,998 905,989" style="fill:rgb(0,0,0)"/>
<path d="M833,994L910,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,994 L 924,994 Q 931,994 931,986 L 931,979"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,994 33,998 33,989" style="fill:rgb(0,0,0)"/>
<path d="M24,978 L 24,986 Q 24,994 31,994 L 39,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,994 L 111,994 Q 119,994 119,1007 Q 119,1021 134,1021 L 186,1021 Q 201,1021 201,1007 Q 201,994 208,994 L 216,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="360,1021 372,1016 372,1025" style="fill:rgb(0,0,0)"/>
<path d="M544,994 L 551,994 Q 559,994 559,1007 Q 559,1021 544,1021 L 381,1021 L 366,1021"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,1021 L 235,1021 Q 220,1021 220,1007 Q 220,994 227,994 L 235,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,994 L 585,994 Q 593,994 593,1007 Q 593,1021 608,1021 L 742,1021 Q 757,1021 757,1007 Q 757,994 765,994 L 772,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,1066L173,1066L173,1036L45,1036Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="1051" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">raise-function</text>
<polygon points="916,1051 905,1055 905,1047" style="fill:rgb(0,0,0)"/>
<path d="M173,1051L910,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,1051 L 924,1051 Q 931,1051 931,1036 L 931,32 Q 931,17 939,17 L 946,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,1051 33,1055 33,1047" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,1036 Q 24,1051 31,1051 L 39,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/filter-clause.html">filter-clause:</a></b>
<button id='x64cf7539' onclick='hideorshow("x64cf7539","x21f41ee7")'>show</button></p>
 <div id='x21f41ee7' style='display:none;' class='imgcontainer'>
 <div style="max-width:422px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 422.381 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L93,32A15 15 0 0 0 108 17A15 15 0 0 0 93 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FILTER</text>
<polygon points="131,17 119,21 119,12" style="fill:rgb(0,0,0)"/>
<path d="M108,17L125,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,32L146,32A15 15 0 0 0 161 17A15 15 0 0 0 146 2L146,2A15 15 0 0 0 131 17A15 15 0 0 0 146 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="184,17 173,21 173,12" style="fill:rgb(0,0,0)"/>
<path d="M161,17L178,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M199,32L249,32A15 15 0 0 0 264 17A15 15 0 0 0 249 2L199,2A15 15 0 0 0 184 17A15 15 0 0 0 199 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="224" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="287,17 275,21 275,12" style="fill:rgb(0,0,0)"/>
<path d="M264,17L281,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,32L336,32L336,2L287,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M336,17L353,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,32A15 15 0 0 0 389 17A15 15 0 0 0 374 2A15 15 0 0 0 359 17A15 15 0 0 0 374 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="374" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="413,17 401,21 401,12" style="fill:rgb(0,0,0)"/>
<path d="M389,17L407,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="416" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/function-arguments.html">function-arguments:</a></b>
<button id='x20108551' onclick='hideorshow("x20108551","x95c8132a")'>show</button></p>
 <div id='x95c8132a' style='display:none;' class='imgcontainer'>
 <div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.566 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,26 55,30 55,22" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,41 L 43,41 Q 43,26 52,26 L 61,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M82,41L150,41A15 15 0 0 0 165 26L165,26A15 15 0 0 0 150 11L82,11A15 15 0 0 0 66 26L66,26A15 15 0 0 0 82 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="183,26 171,30 171,22" style="fill:rgb(0,0,0)"/>
<path d="M165,26L177,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M183,26 L 189,26 Q 194,26 194,41 L 194,41 Q 194,56 203,56 L 212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M218,56L248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,71L303,71L303,41L254,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="447,56 435,60 435,52" style="fill:rgb(0,0,0)"/>
<path d="M303,56L441,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="116,56 104,60 104,52" style="fill:rgb(0,0,0)"/>
<path d="M32,56L110,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M116,56L212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,32A15 15 0 0 0 293 17A15 15 0 0 0 278 2A15 15 0 0 0 263 17A15 15 0 0 0 278 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="293,17 305,12 305,21" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 314,56 Q 326,56 326,41 L 326,32 Q 326,17 312,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M263,17 L 245,17 Q 230,17 230,32 L 230,41 Q 230,56 239,56 L 248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,207A15 15 0 0 0 243 192L243,192A15 15 0 0 0 228 177A15 15 0 0 0 213 192L213,192A15 15 0 0 0 228 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="213,192 201,196 201,188" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,71 L 43,177 Q 43,192 58,192 L 192,192 L 207,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,192 267,196 267,188" style="fill:rgb(0,0,0)"/>
<path d="M243,192L272,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,192 L 360,192 Q 375,192 390,192 L 394,192 Q 409,192 409,177 L 409,71 Q 409,56 415,56 L 421,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="228,216 216,221 216,212" style="fill:rgb(0,0,0)"/>
<path d="M116,192 L 181,192 Q 196,192 196,204 Q 196,216 209,216 L 222,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,216 L 242,216 Q 257,216 257,204 Q 257,192 262,192 L 268,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="90,117 78,121 78,112" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 313,56 Q 323,56 323,71 L 323,71 Q 323,86 308,86 L 81,86 Q 66,86 66,101 L 66,102 Q 66,117 75,117 L 84,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,132L149,132A15 15 0 0 0 164 117L164,117A15 15 0 0 0 149 101L105,101A15 15 0 0 0 90 117L90,117A15 15 0 0 0 105 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="182,117 170,121 170,112" style="fill:rgb(0,0,0)"/>
<path d="M164,117L176,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,132L201,132A15 15 0 0 0 216 117L216,117A15 15 0 0 0 201 101L197,101A15 15 0 0 0 182 117L182,117A15 15 0 0 0 197 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M216,117L239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,132L375,132L375,101L245,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,169A15 15 0 0 0 325 154A15 15 0 0 0 310 139A15 15 0 0 0 294 154A15 15 0 0 0 310 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,154 336,150 336,159" style="fill:rgb(0,0,0)"/>
<path d="M375,117 L 380,117 Q 386,117 386,132 L 386,139 Q 386,154 371,154 L 345,154 L 330,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M294,154 L 260,154 Q 245,154 236,154 Q 227,154 227,139 L 227,132 Q 227,117 233,117 L 239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M375,117 L 383,117 Q 392,117 392,102 L 392,71 Q 392,56 407,56 L 413,56 L 428,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x00909268' onclick='hideorshow("x00909268","xde9d39bf")'>show</button></p>
 <div id='xde9d39bf' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/literal-value.html">literal-value:</a></b>
<button id='xe38631bf' onclick='hideorshow("xe38631bf","x194ef612")'>show</button></p>
 <div id='x194ef612' style='display:none;' class='imgcontainer'>
 <div style="max-width:341px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 341.376 336.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,319 39,324 39,315" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,304 Q 24,319 34,319 L 45,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,334L252,334A15 15 0 0 0 267 319A15 15 0 0 0 252 304L65,304A15 15 0 0 0 50 319A15 15 0 0 0 65 334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIMESTAMP</text>
<polygon points="290,319 278,324 278,315" style="fill:rgb(0,0,0)"/>
<path d="M267,319L284,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,17 320,21 320,12" style="fill:rgb(0,0,0)"/>
<path d="M290,319 L 297,319 Q 305,319 305,304 L 305,32 Q 305,17 315,17 L 326,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="335" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L172,32A15 15 0 0 0 187 17A15 15 0 0 0 172 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="119" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,17L320,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L153,70A15 15 0 0 0 168 55L168,55A15 15 0 0 0 153 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">string-literal</text>
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,47 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,55 278,59 278,50" style="fill:rgb(0,0,0)"/>
<path d="M168,55L284,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,55 L 297,55 Q 305,55 305,47 L 305,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L140,108A15 15 0 0 0 155 92A15 15 0 0 0 140 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">blob-literal</text>
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,85 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,92 278,97 278,88" style="fill:rgb(0,0,0)"/>
<path d="M155,92L284,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,92 L 297,92 Q 305,92 305,85 L 305,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,145L97,145A15 15 0 0 0 112 130A15 15 0 0 0 97 115L66,115A15 15 0 0 0 50 130A15 15 0 0 0 66 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="50,130 39,135 39,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 34,130 L 45,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,130 278,135 278,126" style="fill:rgb(0,0,0)"/>
<path d="M112,130L284,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,130 L 297,130 Q 305,130 305,123 L 305,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,183L96,183A15 15 0 0 0 111 168A15 15 0 0 0 96 153L66,153A15 15 0 0 0 50 168A15 15 0 0 0 66 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRUE</text>
<polygon points="50,168 39,172 39,164" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,160 Q 24,168 34,168 L 45,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,168 278,172 278,164" style="fill:rgb(0,0,0)"/>
<path d="M111,168L284,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,168 L 297,168 Q 305,168 305,160 L 305,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,221L104,221A15 15 0 0 0 119 206A15 15 0 0 0 104 191L66,191A15 15 0 0 0 50 206A15 15 0 0 0 66 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FALSE</text>
<polygon points="50,206 39,210 39,201" style="fill:rgb(0,0,0)"/>
<path d="M24,191 L 24,198 Q 24,206 34,206 L 45,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,206 278,210 278,201" style="fill:rgb(0,0,0)"/>
<path d="M119,206L284,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,206 L 297,206 Q 305,206 305,198 L 305,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,259L190,259A15 15 0 0 0 205 244A15 15 0 0 0 190 228L66,228A15 15 0 0 0 50 244A15 15 0 0 0 66 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="128" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIME</text>
<polygon points="50,244 39,248 39,239" style="fill:rgb(0,0,0)"/>
<path d="M24,228 L 24,236 Q 24,244 34,244 L 45,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,244 278,248 278,239" style="fill:rgb(0,0,0)"/>
<path d="M205,244L284,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,244 L 297,244 Q 305,244 305,236 L 305,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,297L192,297A15 15 0 0 0 207 281A15 15 0 0 0 192 266L66,266A15 15 0 0 0 50 281A15 15 0 0 0 66 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_DATE</text>
<polygon points="50,281 39,286 39,277" style="fill:rgb(0,0,0)"/>
<path d="M24,266 L 24,274 Q 24,281 34,281 L 45,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,281 278,286 278,277" style="fill:rgb(0,0,0)"/>
<path d="M207,281L284,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,281 L 297,281 Q 305,281 305,274 L 305,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/over-clause.html">over-clause:</a></b>
<button id='xca839aaa' onclick='hideorshow("xca839aaa","xe81dfa86")'>show</button></p>
 <div id='xe81dfa86' style='display:none;' class='imgcontainer'>
 <div style="max-width:600px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 600.706 418.392">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="129,17 117,21 117,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L123,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M144,32L241,32A15 15 0 0 0 256 17A15 15 0 0 0 241 2L144,2A15 15 0 0 0 129 17A15 15 0 0 0 144 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,17 L 100,17 Q 108,17 108,32 L 108,40 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,70A15 15 0 0 0 165 55L165,55A15 15 0 0 0 149 39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 149 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="149" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="206,82 195,86 195,77" style="fill:rgb(0,0,0)"/>
<path d="M165,55 L 172,55 Q 180,55 180,68 Q 180,82 190,82 L 200,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,97L363,97A15 15 0 0 0 378 82A15 15 0 0 0 363 67L221,67A15 15 0 0 0 206 82A15 15 0 0 0 221 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="292" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M221,173L301,173A15 15 0 0 0 316 157A15 15 0 0 0 301 142L221,142A15 15 0 0 0 206 157A15 15 0 0 0 221 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="339,157 328,162 328,153" style="fill:rgb(0,0,0)"/>
<path d="M316,157L333,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,173L358,173A15 15 0 0 0 373 157A15 15 0 0 0 358 142L354,142A15 15 0 0 0 339 157A15 15 0 0 0 354 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="409,157 398,162 398,153" style="fill:rgb(0,0,0)"/>
<path d="M373,157L404,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,173L459,173L459,142L409,142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M434,210A15 15 0 0 0 449 195A15 15 0 0 0 434 180A15 15 0 0 0 419 195A15 15 0 0 0 434 210Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="195" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="449,195 461,191 461,200" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,180 Q 474,195 464,195 L 455,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,195 L 398,195 Q 383,195 383,180 L 383,172 Q 383,157 390,157 L 398,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,55 280,59 280,50" style="fill:rgb(0,0,0)"/>
<path d="M165,55L286,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,120 304,115 304,124" style="fill:rgb(0,0,0)"/>
<path d="M292,55 L 401,55 Q 416,55 416,70 L 416,105 Q 416,120 401,120 L 313,120 L 298,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,157 195,162 195,153" style="fill:rgb(0,0,0)"/>
<path d="M292,120 L 180,120 Q 165,120 165,135 L 165,142 Q 165,157 180,157 L 185,157 L 200,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="401,82 389,86 389,77" style="fill:rgb(0,0,0)"/>
<path d="M378,82L395,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,82 L 408,82 Q 416,82 416,89 L 416,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,286L266,286A15 15 0 0 0 281 271A15 15 0 0 0 266 256L221,256A15 15 0 0 0 206 271A15 15 0 0 0 221 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="244" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="304,271 292,275 292,266" style="fill:rgb(0,0,0)"/>
<path d="M281,271L298,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M319,286L323,286A15 15 0 0 0 338 271A15 15 0 0 0 323 256L319,256A15 15 0 0 0 304 271A15 15 0 0 0 319 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="321" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="374,271 363,275 363,266" style="fill:rgb(0,0,0)"/>
<path d="M338,271L368,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,286L504,286L504,256L374,256Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M439,324A15 15 0 0 0 454 309A15 15 0 0 0 439 293A15 15 0 0 0 424 309A15 15 0 0 0 439 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="454,309 466,304 466,313" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,294 Q 519,309 504,309 L 475,309 L 460,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,309 L 363,309 Q 348,309 348,294 L 348,286 Q 348,271 355,271 L 363,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,233 304,229 304,237" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,218 Q 474,233 459,233 L 313,233 L 298,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,271 195,275 195,266" style="fill:rgb(0,0,0)"/>
<path d="M292,233 L 180,233 Q 165,233 165,248 L 165,256 Q 165,271 180,271 L 185,271 L 200,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,195 160,184 169,184" style="fill:rgb(0,0,0)"/>
<path d="M165,142L165,189"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,195L165,256"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,399L311,399L311,369L206,369Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="384" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="519,384 508,389 508,380" style="fill:rgb(0,0,0)"/>
<path d="M311,384L513,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M534,399A15 15 0 0 0 549 384A15 15 0 0 0 534 369A15 15 0 0 0 519 384A15 15 0 0 0 534 399Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="384" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="591,17 579,21 579,12" style="fill:rgb(0,0,0)"/>
<path d="M549,384 L 557,384 Q 564,384 564,369 L 564,32 Q 564,17 575,17 L 585,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="594" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,17 508,21 508,12" style="fill:rgb(0,0,0)"/>
<path d="M256,17L513,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,17L579,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,346 304,342 304,351" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,331 Q 519,346 504,346 L 313,346 L 298,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,384 195,389 195,380" style="fill:rgb(0,0,0)"/>
<path d="M292,346 L 180,346 Q 165,346 165,361 L 165,369 Q 165,384 180,384 L 185,384 L 200,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,309 160,297 169,297" style="fill:rgb(0,0,0)"/>
<path d="M165,256L165,303"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,309L165,369"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="258,411 247,416 247,407" style="fill:rgb(0,0,0)"/>
<path d="M165,369 L 165,396 Q 165,411 180,411 L 238,411 L 253,411"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,384 369,389 369,380" style="fill:rgb(0,0,0)"/>
<path d="M258,411 L 335,411 Q 350,411 350,398 Q 350,384 362,384 L 375,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x2d613030' onclick='hideorshow("x2d613030","x8b66b0bc")'>show</button></p>
 <div id='x8b66b0bc' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x31d8bd94' onclick='hideorshow("x31d8bd94","xe59c0121")'>show</button></p>
 <div id='xe59c0121' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/raise-function.html">raise-function:</a></b>
<button id='x17a24715' onclick='hideorshow("x17a24715","x07629c0f")'>show</button></p>
 <div id='x07629c0f' style='display:none;' class='imgcontainer'>
 <div style="max-width:627px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 627.302 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L82,32A15 15 0 0 0 97 17A15 15 0 0 0 82 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RAISE</text>
<polygon points="120,17 109,21 109,12" style="fill:rgb(0,0,0)"/>
<path d="M97,17L114,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,32L135,32A15 15 0 0 0 150 17A15 15 0 0 0 135 2L135,2A15 15 0 0 0 120 17A15 15 0 0 0 135 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="135" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="192,55 180,59 180,50" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 158,17 Q 165,17 165,32 L 165,40 Q 165,55 176,55 L 186,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,70L285,70A15 15 0 0 0 300 55L300,55A15 15 0 0 0 285 39L207,39A15 15 0 0 0 192 55L192,55A15 15 0 0 0 207 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="336,55 324,59 324,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70A15 15 0 0 0 366 55L366,55A15 15 0 0 0 351 39A15 15 0 0 0 336 55L336,55A15 15 0 0 0 351 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="389,55 378,59 378,50" style="fill:rgb(0,0,0)"/>
<path d="M366,55L383,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,70L508,70A15 15 0 0 0 523 55L523,55A15 15 0 0 0 508 39L404,39A15 15 0 0 0 389 55L389,55A15 15 0 0 0 404 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="456" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">error-message</text>
<polygon points="564,17 553,21 553,12" style="fill:rgb(0,0,0)"/>
<path d="M523,55 L 530,55 Q 538,55 538,40 L 538,32 Q 538,17 548,17 L 558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M579,32A15 15 0 0 0 594 17A15 15 0 0 0 579 2A15 15 0 0 0 564 17A15 15 0 0 0 579 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="617,17 606,21 606,12" style="fill:rgb(0,0,0)"/>
<path d="M594,17L612,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="621" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L259,32A15 15 0 0 0 274 17A15 15 0 0 0 259 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="456,17 444,21 444,12" style="fill:rgb(0,0,0)"/>
<path d="M274,17L450,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,17L553,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,108L249,108A15 15 0 0 0 264 92A15 15 0 0 0 249 77L207,77A15 15 0 0 0 192 92A15 15 0 0 0 207 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="300,92 288,97 288,88" style="fill:rgb(0,0,0)"/>
<path d="M264,92L294,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,92 L 307,92 Q 315,92 315,77 L 315,70 Q 315,55 322,55 L 330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,145L229,145A15 15 0 0 0 244 130A15 15 0 0 0 229 115L207,115A15 15 0 0 0 192 130A15 15 0 0 0 207 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="300,130 288,135 288,126" style="fill:rgb(0,0,0)"/>
<path d="M244,130L294,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,130 L 307,130 Q 315,130 315,115 L 315,92 L 315,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,130 180,135 180,126" style="fill:rgb(0,0,0)"/>
<path d="M165,39 L 165,115 Q 165,130 176,130 L 186,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,92 180,97 180,88" style="fill:rgb(0,0,0)"/>
<path d="M165,77 L 165,85 Q 165,92 176,92 L 186,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/select-stmt.html">select-stmt:</a></b>
<button id='x84e2b710' onclick='hideorshow("x84e2b710","xc76e97e1")'>show</button></p>
 <div id='xc76e97e1' style='display:none;' class='imgcontainer'>
 <div style="max-width:669px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 669.677 1162.3">
<path d="M55,845L667,845L667,99L55,99Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="6" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="46,17 34,21 34,12" style="fill:rgb(0,0,0)"/>
<path d="M10,17L40,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M61,32L92,32A15 15 0 0 0 107 17A15 15 0 0 0 92 2L61,2A15 15 0 0 0 46 17A15 15 0 0 0 61 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="76" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M167,62L253,62A15 15 0 0 0 268 47L268,47A15 15 0 0 0 253 32L167,32A15 15 0 0 0 152 47L152,47A15 15 0 0 0 167 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="210,17 198,21 198,12" style="fill:rgb(0,0,0)"/>
<path d="M107,17L204,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M210,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M358,32L584,32L584,2L358,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="152,47 140,51 140,43" style="fill:rgb(0,0,0)"/>
<path d="M107,17 L 114,17 Q 122,17 122,32 L 122,32 Q 122,47 134,47 L 146,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="291,47 279,51 279,43" style="fill:rgb(0,0,0)"/>
<path d="M268,47L285,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,47 L 298,47 Q 306,47 306,32 L 306,32 Q 306,17 321,17 L 331,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,70A15 15 0 0 0 486 55L486,55A15 15 0 0 0 471 39A15 15 0 0 0 456 55L456,55A15 15 0 0 0 471 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="486,55 498,50 498,59" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,40 Q 599,55 584,55 L 507,55 L 492,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,55 L 350,55 Q 335,55 335,40 L 335,32 Q 335,17 340,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,83 307,79 307,88" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,68 Q 599,83 584,83 L 316,83 L 301,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,83 L 40,83 Q 25,83 25,98 L 25,113"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="25,47 20,36 29,36" style="fill:rgb(0,0,0)"/>
<path d="M10,17 L 17,17 Q 25,17 25,29 L 25,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="55,129 43,133 43,124" style="fill:rgb(0,0,0)"/>
<path d="M25,47 L 25,114 Q 25,129 37,129 L 49,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,129 115,133 115,124" style="fill:rgb(0,0,0)"/>
<path d="M55,129L121,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,144L193,144A15 15 0 0 0 208 129A15 15 0 0 0 193 114L142,114A15 15 0 0 0 127 129A15 15 0 0 0 142 144Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="250,159 238,163 238,155" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,144 Q 223,159 233,159 L 244,159"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,174L333,174A15 15 0 0 0 348 159A15 15 0 0 0 333 144L265,144A15 15 0 0 0 250 159A15 15 0 0 0 265 174Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="159" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="417,129 406,133 406,124" style="fill:rgb(0,0,0)"/>
<path d="M348,159 L 356,159 Q 363,159 363,144 L 363,144 Q 363,129 378,129 L 396,129 L 411,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,144L545,144L545,114L417,114Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M481,182A15 15 0 0 0 496 166A15 15 0 0 0 481 151A15 15 0 0 0 466 166A15 15 0 0 0 481 182Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="166" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="496,166 508,162 508,171" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,151 Q 560,166 545,166 L 517,166 L 502,166"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M466,166 L 406,166 Q 391,166 391,151 L 391,144 Q 391,129 398,129 L 406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,129 287,133 287,124" style="fill:rgb(0,0,0)"/>
<path d="M208,129L293,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M299,129L406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,212L280,212A15 15 0 0 0 295 197A15 15 0 0 0 280 182L265,182A15 15 0 0 0 250 197A15 15 0 0 0 265 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="197" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="348,197 337,201 337,192" style="fill:rgb(0,0,0)"/>
<path d="M295,197L342,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,197 L 356,197 Q 363,197 363,182 L 363,159 L 363,144"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="250,197 238,201 238,192" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,182 Q 223,197 233,197 L 244,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,287L203,287A15 15 0 0 0 218 272A15 15 0 0 0 203 257L168,257A15 15 0 0 0 153 272A15 15 0 0 0 168 287Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="186" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="290,272 279,277 279,268" style="fill:rgb(0,0,0)"/>
<path d="M218,272L284,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,287L451,287L451,257L290,257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M320,362L422,362L422,331L320,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M371,324A15 15 0 0 0 386 309A15 15 0 0 0 371 293A15 15 0 0 0 356 309A15 15 0 0 0 371 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="386,309 397,304 397,313" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 459,272 Q 466,272 466,287 L 466,294 Q 466,309 451,309 L 407,309 L 392,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M356,309 L 279,309 Q 264,309 264,294 L 264,287 Q 264,272 271,272 L 279,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="320,346 308,351 308,342" style="fill:rgb(0,0,0)"/>
<path d="M218,272 L 226,272 Q 233,272 233,287 L 233,331 Q 233,346 248,346 L 299,346 L 314,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="484,313 488,325 480,325" style="fill:rgb(0,0,0)"/>
<path d="M422,346 L 436,346 Q 451,346 466,346 L 469,346 Q 484,346 484,333 L 484,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,272 494,277 494,268" style="fill:rgb(0,0,0)"/>
<path d="M484,313 L 484,287 Q 484,272 492,272 L 499,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,272 L 496,272 Q 487,272 487,272 Q 487,272 495,272 L 502,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,197 555,185 564,185" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,176 L 560,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,235 360,230 360,239" style="fill:rgb(0,0,0)"/>
<path d="M560,197 L 560,220 Q 560,235 545,235 L 369,235 L 354,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,272 142,277 142,268" style="fill:rgb(0,0,0)"/>
<path d="M348,235 L 142,235 Q 127,235 127,250 L 127,257 Q 127,272 137,272 L 147,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,437L218,437A15 15 0 0 0 233 422A15 15 0 0 0 218 407L168,407A15 15 0 0 0 153 422A15 15 0 0 0 168 437Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="256,422 244,426 244,418" style="fill:rgb(0,0,0)"/>
<path d="M233,422L250,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,437L305,437L305,407L256,407Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="517,324 513,312 521,312" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 502,272 Q 517,272 517,287 L 517,303 L 517,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,384 382,380 382,389" style="fill:rgb(0,0,0)"/>
<path d="M517,324 L 517,369 Q 517,384 502,384 L 391,384 L 376,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,422 142,426 142,418" style="fill:rgb(0,0,0)"/>
<path d="M371,384 L 142,384 Q 127,384 127,399 L 127,407 Q 127,422 137,422 L 147,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,324 122,312 131,312" style="fill:rgb(0,0,0)"/>
<path d="M127,257L127,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,324L127,407"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,535L212,535A15 15 0 0 0 227 520A15 15 0 0 0 212 505L168,505A15 15 0 0 0 153 520A15 15 0 0 0 168 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="250,520 238,525 238,516" style="fill:rgb(0,0,0)"/>
<path d="M227,520L244,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,535L269,535A15 15 0 0 0 284 520A15 15 0 0 0 269 505L265,505A15 15 0 0 0 250 520A15 15 0 0 0 265 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="320,520 309,525 309,516" style="fill:rgb(0,0,0)"/>
<path d="M284,520L314,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,535L369,535L369,505L320,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="452,520 441,525 441,516" style="fill:rgb(0,0,0)"/>
<path d="M369,520L446,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,535L520,535A15 15 0 0 0 535 520A15 15 0 0 0 520 505L467,505A15 15 0 0 0 452 520A15 15 0 0 0 467 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="558,520 546,525 546,516" style="fill:rgb(0,0,0)"/>
<path d="M535,520L552,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,535L607,535L607,505L558,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M345,573A15 15 0 0 0 360 558A15 15 0 0 0 345 543A15 15 0 0 0 330 558A15 15 0 0 0 345 573Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="558" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="360,558 371,554 371,562" style="fill:rgb(0,0,0)"/>
<path d="M369,520 L 377,520 Q 384,520 384,535 L 384,543 Q 384,558 375,558 L 366,558"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,558 L 309,558 Q 294,558 294,543 L 294,535 Q 294,520 301,520 L 309,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="514,551 503,555 503,546" style="fill:rgb(0,0,0)"/>
<path d="M411,520 L 418,520 Q 426,520 426,535 L 426,536 Q 426,551 441,551 L 493,551 L 508,551"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M514,551 L 607,551 Q 622,551 622,536 L 622,535 Q 622,520 630,520 L 637,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,490 256,494 256,486" style="fill:rgb(0,0,0)"/>
<path d="M127,460 L 127,475 Q 127,490 142,490 L 246,490 L 261,490"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,520 399,525 399,516" style="fill:rgb(0,0,0)"/>
<path d="M267,490 L 369,490 Q 384,490 384,505 L 384,505 Q 384,520 395,520 L 405,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,460 244,455 244,464" style="fill:rgb(0,0,0)"/>
<path d="M305,422 L 313,422 Q 320,422 320,437 L 320,445 Q 320,460 305,460 L 254,460 L 239,460"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,520 142,525 142,516" style="fill:rgb(0,0,0)"/>
<path d="M233,460 L 142,460 Q 127,460 127,475 L 127,505 Q 127,520 137,520 L 147,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,447 122,435 131,435" style="fill:rgb(0,0,0)"/>
<path d="M127,407L127,441"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,447L127,505"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,649L232,649A15 15 0 0 0 247 634A15 15 0 0 0 232 619L168,619A15 15 0 0 0 153 634A15 15 0 0 0 168 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="200" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="283,634 271,638 271,629" style="fill:rgb(0,0,0)"/>
<path d="M247,634L277,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,649L395,649A15 15 0 0 0 410 634A15 15 0 0 0 395 619L298,619A15 15 0 0 0 283 634A15 15 0 0 0 298 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="433,634 422,638 422,629" style="fill:rgb(0,0,0)"/>
<path d="M410,634L427,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,649L452,649A15 15 0 0 0 467 634A15 15 0 0 0 452 619L448,619A15 15 0 0 0 433 634A15 15 0 0 0 448 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="450" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="490,634 479,638 479,629" style="fill:rgb(0,0,0)"/>
<path d="M467,634L485,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,649L609,649L609,619L490,619Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="550" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M446,687A15 15 0 0 0 461 671A15 15 0 0 0 446 656A15 15 0 0 0 431 671A15 15 0 0 0 446 687Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="671" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="461,671 472,667 472,676" style="fill:rgb(0,0,0)"/>
<path d="M609,634 L 616,634 Q 624,634 624,649 L 624,656 Q 624,671 609,671 L 482,671 L 467,671"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,671 L 271,671 Q 256,671 256,656 L 256,649 Q 256,634 264,634 L 271,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="624,692 619,680 628,680" style="fill:rgb(0,0,0)"/>
<path d="M624,656L624,686"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,558 648,547 656,547" style="fill:rgb(0,0,0)"/>
<path d="M607,520 L 637,520 Q 652,520 652,535 L 652,537 L 652,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,596 382,592 382,600" style="fill:rgb(0,0,0)"/>
<path d="M652,558 L 652,581 Q 652,596 637,596 L 391,596 L 376,596"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,634 142,638 142,629" style="fill:rgb(0,0,0)"/>
<path d="M371,596 L 142,596 Q 127,596 127,611 L 127,619 Q 127,634 137,634 L 147,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,558 122,547 131,547" style="fill:rgb(0,0,0)"/>
<path d="M127,505L127,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,709 359,714 359,705" style="fill:rgb(0,0,0)"/>
<path d="M127,558 L 127,694 Q 127,709 142,709 L 350,709 L 365,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,709 597,714 597,705" style="fill:rgb(0,0,0)"/>
<path d="M371,709L603,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,709 L 616,709 Q 624,709 624,717 L 624,724"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,800L194,800A15 15 0 0 0 209 785A15 15 0 0 0 194 770L142,770A15 15 0 0 0 127 785A15 15 0 0 0 142 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="245,785 234,789 234,781" style="fill:rgb(0,0,0)"/>
<path d="M209,785L239,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,800A15 15 0 0 0 275 785A15 15 0 0 0 260 770A15 15 0 0 0 245 785A15 15 0 0 0 260 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="311,785 300,789 300,781" style="fill:rgb(0,0,0)"/>
<path d="M275,785L306,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,800L361,800L361,770L311,770Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="397,785 385,789 385,781" style="fill:rgb(0,0,0)"/>
<path d="M361,785L391,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,800A15 15 0 0 0 427 785A15 15 0 0 0 412 770A15 15 0 0 0 397 785A15 15 0 0 0 412 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="412" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="609,785 597,789 597,781" style="fill:rgb(0,0,0)"/>
<path d="M427,785L603,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,785 L 616,785 Q 624,785 624,792 L 624,800"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,762A15 15 0 0 0 351 747A15 15 0 0 0 336 732A15 15 0 0 0 321 747A15 15 0 0 0 336 762Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="747" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M336,838A15 15 0 0 0 351 823A15 15 0 0 0 336 808A15 15 0 0 0 321 823A15 15 0 0 0 336 838Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="823" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="351,747 363,743 363,751" style="fill:rgb(0,0,0)"/>
<path d="M361,785 L 368,785 Q 376,785 376,770 L 376,762 Q 376,747 366,747 L 357,747"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,747 L 300,747 Q 285,747 285,762 L 285,770 Q 285,785 292,785 L 300,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,823 363,818 363,827" style="fill:rgb(0,0,0)"/>
<path d="M427,785 L 434,785 Q 442,785 442,800 L 442,808 Q 442,823 427,823 L 372,823 L 357,823"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,823 L 234,823 Q 219,823 219,808 L 219,800 Q 219,785 226,785 L 234,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,785 115,789 115,781" style="fill:rgb(0,0,0)"/>
<path d="M55,129 L 62,129 Q 70,129 70,144 L 70,770 Q 70,785 85,785 L 106,785 L 121,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,891L424,891L424,860L248,860Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="876" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="424,876 436,871 436,880" style="fill:rgb(0,0,0)"/>
<path d="M624,692 L 624,861 Q 624,876 609,876 L 445,876 L 430,876"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="6,197 10,208 2,208" style="fill:rgb(0,0,0)"/>
<path d="M248,876 L 21,876 Q 6,876 6,861 L 6,217 L 6,202"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M6,197 L 6,144 Q 6,129 21,129 L 40,129 L 55,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="667" y="275" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" transform="rotate(-90 667,285)" dominant-baseline="central">select-core</text>
<path d="M168,966L213,966A15 15 0 0 0 228 951A15 15 0 0 0 213 936L168,936A15 15 0 0 0 153 951A15 15 0 0 0 168 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="251,951 239,956 239,947" style="fill:rgb(0,0,0)"/>
<path d="M228,951L245,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,966L270,966A15 15 0 0 0 285 951A15 15 0 0 0 270 936L266,936A15 15 0 0 0 251 951A15 15 0 0 0 266 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M168,1072L202,1072A15 15 0 0 0 217 1057A15 15 0 0 0 202 1042L168,1042A15 15 0 0 0 153 1057A15 15 0 0 0 168 1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="240,1057 228,1061 228,1053" style="fill:rgb(0,0,0)"/>
<path d="M217,1057L234,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,1072L289,1072L289,1042L240,1042Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="330,951 319,956 319,947" style="fill:rgb(0,0,0)"/>
<path d="M285,951L324,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,966L460,966L460,936L330,936Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M395,1004A15 15 0 0 0 410 989A15 15 0 0 0 395 974A15 15 0 0 0 380 989A15 15 0 0 0 395 1004Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="989" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="410,989 422,985 422,993" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 468,951 Q 475,951 475,966 L 475,974 Q 475,989 460,989 L 431,989 L 416,989"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,989 L 322,989 Q 307,989 307,974 L 307,966 Q 307,951 313,951 L 319,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,913 348,909 348,918" style="fill:rgb(0,0,0)"/>
<path d="M624,860 L 624,898 Q 624,913 609,913 L 357,913 L 342,913"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,951 142,956 142,947" style="fill:rgb(0,0,0)"/>
<path d="M336,913 L 142,913 Q 127,913 127,928 L 127,936 Q 127,951 137,951 L 147,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,981 492,970 500,970" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 481,951 Q 496,951 496,963 L 496,976"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,1023 318,1019 318,1027" style="fill:rgb(0,0,0)"/>
<path d="M496,981 L 496,1008 Q 496,1023 481,1023 L 327,1023 L 312,1023"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,1057 142,1061 142,1053" style="fill:rgb(0,0,0)"/>
<path d="M307,1023 L 142,1023 Q 127,1023 127,1038 L 127,1042 Q 127,1057 137,1057 L 147,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,989 122,978 131,978" style="fill:rgb(0,0,0)"/>
<path d="M127,936L127,983"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,989L127,1042"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1102L415,1102A15 15 0 0 0 430 1087A15 15 0 0 0 415 1072L363,1072A15 15 0 0 0 348 1087A15 15 0 0 0 363 1102Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="389" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="453,1087 441,1092 441,1083" style="fill:rgb(0,0,0)"/>
<path d="M430,1087L447,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,1102L502,1102L502,1072L453,1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="525,1087 513,1092 513,1083" style="fill:rgb(0,0,0)"/>
<path d="M502,1087L519,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1140A15 15 0 0 0 378 1125A15 15 0 0 0 363 1110A15 15 0 0 0 348 1125A15 15 0 0 0 363 1140Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="1125" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="401,1125 390,1129 390,1121" style="fill:rgb(0,0,0)"/>
<path d="M378,1125L396,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,1140L451,1140L451,1110L401,1110Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="1125" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="312,1057 301,1061 301,1053" style="fill:rgb(0,0,0)"/>
<path d="M289,1057L306,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1125 337,1129 337,1121" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1110 Q 327,1125 335,1125 L 342,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1087 337,1092 337,1083" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1072 Q 327,1087 335,1087 L 342,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1057 513,1061 513,1053" style="fill:rgb(0,0,0)"/>
<path d="M312,1057L519,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="620,1155 609,1160 609,1151" style="fill:rgb(0,0,0)"/>
<path d="M525,1057 L 546,1057 Q 561,1057 561,1072 L 561,1140 Q 561,1155 576,1155 L 599,1155 L 614,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="624" cy="1155" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1087 L 546,1087 Q 561,1087 561,1095 L 561,1102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1125 513,1129 513,1121" style="fill:rgb(0,0,0)"/>
<path d="M451,1125L519,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1125 L 546,1125 Q 561,1125 561,1133 L 561,1140"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1155 513,1160 513,1151" style="fill:rgb(0,0,0)"/>
<path d="M127,1042 L 127,1140 Q 127,1155 142,1155 L 504,1155 L 519,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1155L597,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/common-table-expression.html">common-table-expression:</a></b>
<button id='xcf47c96e' onclick='hideorshow("xcf47c96e","x8e228da1")'>show</button></p>
 <div id='x8e228da1' style='display:none;' class='imgcontainer'>
 <div style="max-width:638px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 638.525 167.4">
<circle cx="5" cy="29" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,29 20,33 20,24" style="fill:rgb(0,0,0)"/>
<path d="M9,29L26,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,44L122,44A15 15 0 0 0 137 29A15 15 0 0 0 122 14L47,14A15 15 0 0 0 32 29A15 15 0 0 0 47 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="160,29 149,33 149,24" style="fill:rgb(0,0,0)"/>
<path d="M137,29L155,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="196,29 185,33 185,24" style="fill:rgb(0,0,0)"/>
<path d="M160,29L191,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,44A15 15 0 0 0 227 29A15 15 0 0 0 211 14A15 15 0 0 0 196 29A15 15 0 0 0 211 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="250,29 238,33 238,24" style="fill:rgb(0,0,0)"/>
<path d="M227,29L244,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="286,29 274,33 274,24" style="fill:rgb(0,0,0)"/>
<path d="M250,29L280,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,44L395,44A15 15 0 0 0 410 29A15 15 0 0 0 395 14L301,14A15 15 0 0 0 286 29A15 15 0 0 0 301 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="446,29 434,33 434,24" style="fill:rgb(0,0,0)"/>
<path d="M410,29L440,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,44A15 15 0 0 0 476 29A15 15 0 0 0 461 14A15 15 0 0 0 446 29A15 15 0 0 0 461 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,29 499,33 499,24" style="fill:rgb(0,0,0)"/>
<path d="M476,29L505,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,165L51,165A15 15 0 0 0 66 150A15 15 0 0 0 51 135L47,135A15 15 0 0 0 32 150A15 15 0 0 0 47 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="49" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<path d="M127,135L147,135A15 15 0 0 0 162 119A15 15 0 0 0 147 104L127,104A15 15 0 0 0 112 119A15 15 0 0 0 127 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<path d="M219,135L337,135A15 15 0 0 0 352 119A15 15 0 0 0 337 104L219,104A15 15 0 0 0 204 119A15 15 0 0 0 219 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<path d="M162,119L204,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,165A15 15 0 0 0 425 150A15 15 0 0 0 410 135A15 15 0 0 0 395 150A15 15 0 0 0 410 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="410" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="448,150 437,154 437,145" style="fill:rgb(0,0,0)"/>
<path d="M425,150L442,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,165L552,165L552,135L448,135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="500" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="575,150 564,154 564,145" style="fill:rgb(0,0,0)"/>
<path d="M552,150L570,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M591,165A15 15 0 0 0 606 150A15 15 0 0 0 591 135A15 15 0 0 0 575 150A15 15 0 0 0 591 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="629,150 617,154 617,145" style="fill:rgb(0,0,0)"/>
<path d="M606,150L623,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="632" cy="150" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,82A15 15 0 0 0 363 66A15 15 0 0 0 348 51A15 15 0 0 0 333 66A15 15 0 0 0 348 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="363,66 374,62 374,71" style="fill:rgb(0,0,0)"/>
<path d="M410,29 L 417,29 Q 425,29 425,44 L 425,51 Q 425,66 410,66 L 384,66 L 369,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M333,66 L 278,66 Q 263,66 263,51 L 263,44 Q 263,29 270,29 L 278,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,93 78,89 78,97" style="fill:rgb(0,0,0)"/>
<path d="M511,29 L 516,29 Q 522,29 522,44 L 522,78 Q 522,93 507,93 L 87,93 L 72,93"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,150 20,154 20,145" style="fill:rgb(0,0,0)"/>
<path d="M66,93 L 30,93 Q 15,93 15,108 L 15,135 Q 15,150 20,150 L 26,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="85,150 73,154 73,145" style="fill:rgb(0,0,0)"/>
<path d="M66,150L79,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="112,119 101,124 101,115" style="fill:rgb(0,0,0)"/>
<path d="M85,150 L 89,150 Q 92,150 92,135 L 92,134 Q 92,119 99,119 L 106,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="204,119 192,124 192,115" style="fill:rgb(0,0,0)"/>
<path d="M66,150 L 147,150 Q 162,150 170,150 Q 177,150 177,135 L 177,134 Q 177,119 188,119 L 198,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,150 383,154 383,145" style="fill:rgb(0,0,0)"/>
<path d="M352,119 L 360,119 Q 367,119 367,134 L 367,135 Q 367,150 378,150 L 389,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150L395,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,6 336,10 336,2" style="fill:rgb(0,0,0)"/>
<path d="M160,29 L 168,29 Q 175,29 175,17 Q 175,6 190,6 L 327,6 L 342,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,6 L 473,6 Q 488,6 488,17 Q 488,29 495,29 L 503,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/compound-operator.html">compound-operator:</a></b>
<button id='xb1b511d4' onclick='hideorshow("xb1b511d4","xe1b0ee5d")'>show</button></p>
 <div id='xe1b0ee5d' style='display:none;' class='imgcontainer'>
 <div style="max-width:293px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 293.842 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L127,32A15 15 0 0 0 142 17A15 15 0 0 0 127 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,70L127,70A15 15 0 0 0 142 55L142,55A15 15 0 0 0 127 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,108L168,108A15 15 0 0 0 183 92A15 15 0 0 0 168 77L83,77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M83,145L135,145A15 15 0 0 0 150 130A15 15 0 0 0 135 115L83,115A15 15 0 0 0 68 130A15 15 0 0 0 83 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M142,55L159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70L195,70A15 15 0 0 0 210 55L210,55A15 15 0 0 0 195 39L180,39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="233,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M210,55L227,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,17 272,21 272,12" style="fill:rgb(0,0,0)"/>
<path d="M233,55 L 240,55 Q 248,55 248,40 L 248,32 Q 248,17 263,17 L 263,17 L 278,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="288" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M47,39 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,92 221,97 221,88" style="fill:rgb(0,0,0)"/>
<path d="M183,92L227,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,92 L 240,92 Q 248,92 248,77 L 248,54 L 248,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,130 56,135 56,126" style="fill:rgb(0,0,0)"/>
<path d="M47,77 L 47,115 Q 47,130 55,130 L 62,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,130 221,135 221,126" style="fill:rgb(0,0,0)"/>
<path d="M150,130L227,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,130 L 240,130 Q 248,130 248,115 L 248,92 L 248,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-clause.html">join-clause:</a></b>
<button id='x2f616ac6' onclick='hideorshow("x2f616ac6","x135d1415")'>show</button></p>
 <div id='x135d1415' style='display:none;' class='imgcontainer'>
 <div style="max-width:793px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 793.282 84.24">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L193,32L193,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="259,47 247,51 247,43" style="fill:rgb(0,0,0)"/>
<path d="M193,17 L 200,17 Q 208,17 208,32 L 208,32 Q 208,47 223,47 L 238,47 L 253,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,62L380,62L380,32L259,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-operator</text>
<polygon points="403,47 391,51 391,43" style="fill:rgb(0,0,0)"/>
<path d="M380,47L397,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,62L564,62L564,32L403,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="587,47 575,51 575,43" style="fill:rgb(0,0,0)"/>
<path d="M564,47L581,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M587,62L721,62L721,32L587,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="654" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-constraint</text>
<polygon points="783,17 772,21 772,12" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 742,47 Q 757,47 757,32 L 757,32 Q 757,17 767,17 L 778,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="787" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M193,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,17L776,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,77 495,73 495,82" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 728,47 Q 736,47 736,62 L 736,62 Q 736,77 721,77 L 504,77 L 489,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,77 L 247,77 Q 232,77 232,62 L 232,62 Q 232,47 246,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/join-constraint.html">join-constraint:</a></b>
<button id='x68c6329e' onclick='hideorshow("x68c6329e","x6d4eb628")'>show</button></p>
 <div id='x6d4eb628' style='display:none;' class='imgcontainer'>
 <div style="max-width:483px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 483.336 126.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L104,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 104 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="143,55 131,59 131,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L137,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,70A15 15 0 0 0 173 55L173,55A15 15 0 0 0 158 39A15 15 0 0 0 143 55L143,55A15 15 0 0 0 158 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="209,55 197,59 197,50" style="fill:rgb(0,0,0)"/>
<path d="M173,55L203,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M224,70L318,70A15 15 0 0 0 333 55L333,55A15 15 0 0 0 318 39L224,39A15 15 0 0 0 209 55L209,55A15 15 0 0 0 224 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="369,55 358,59 358,50" style="fill:rgb(0,0,0)"/>
<path d="M333,55L363,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,70A15 15 0 0 0 399 55L399,55A15 15 0 0 0 384 39A15 15 0 0 0 369 55L369,55A15 15 0 0 0 384 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="422,55 411,59 411,50" style="fill:rgb(0,0,0)"/>
<path d="M399,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="473,17 462,21 462,12" style="fill:rgb(0,0,0)"/>
<path d="M422,55 L 430,55 Q 437,55 437,40 L 437,32 Q 437,17 452,17 L 453,17 L 468,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="477" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,108A15 15 0 0 0 286 92A15 15 0 0 0 271 77A15 15 0 0 0 256 92A15 15 0 0 0 271 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="286,92 298,88 298,97" style="fill:rgb(0,0,0)"/>
<path d="M333,55 L 341,55 Q 348,55 348,70 L 348,77 Q 348,92 333,92 L 307,92 L 292,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,92 L 197,92 Q 182,92 182,77 L 182,70 Q 182,55 190,55 L 197,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L74,32A15 15 0 0 0 90 17A15 15 0 0 0 74 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="113,17 101,21 101,12" style="fill:rgb(0,0,0)"/>
<path d="M90,17L107,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M113,32L162,32L162,2L113,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="422,17 411,21 411,12" style="fill:rgb(0,0,0)"/>
<path d="M162,17L417,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,17L462,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="209,120 197,124 197,115" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,105 Q 24,120 39,120 L 188,120 L 203,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,120 L 422,120 Q 437,120 437,105 L 437,54 L 437,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-operator.html">join-operator:</a></b>
<button id='xc95d839d' onclick='hideorshow("xc95d839d","xd2fbd4ed")'>show</button></p>
 <div id='xd2fbd4ed' style='display:none;' class='imgcontainer'>
 <div style="max-width:620px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 620.333 255.312">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,71 39,76 39,67" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,56 Q 24,71 34,71 L 45,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,86L133,86A15 15 0 0 0 148 71A15 15 0 0 0 133 56L66,56A15 15 0 0 0 50 71A15 15 0 0 0 66 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="99" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NATURAL</text>
<polygon points="189,41 178,45 178,37" style="fill:rgb(0,0,0)"/>
<path d="M148,71 L 155,71 Q 163,71 163,56 L 163,56 Q 163,41 173,41 L 184,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,71 219,76 219,67" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,56 Q 204,71 215,71 L 225,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,86L273,86A15 15 0 0 0 288 71A15 15 0 0 0 273 56L246,56A15 15 0 0 0 231 71A15 15 0 0 0 246 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LEFT</text>
<polygon points="378,71 366,76 366,67" style="fill:rgb(0,0,0)"/>
<path d="M288,71L372,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,86L437,86A15 15 0 0 0 452 71A15 15 0 0 0 437 56L393,56A15 15 0 0 0 378 71A15 15 0 0 0 393 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OUTER</text>
<polygon points="475,71 463,76 463,67" style="fill:rgb(0,0,0)"/>
<path d="M452,71L469,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="516,41 505,45 505,37" style="fill:rgb(0,0,0)"/>
<path d="M475,71 L 482,71 Q 490,71 490,56 L 490,56 Q 490,41 500,41 L 511,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,56L554,56A15 15 0 0 0 569 41A15 15 0 0 0 554 26L532,26A15 15 0 0 0 516 41A15 15 0 0 0 532 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="543" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">JOIN</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M569,41 L 576,41 Q 584,41 584,29 Q 584,17 594,17 L 605,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="614" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,32A15 15 0 0 0 325 17A15 15 0 0 0 310 2A15 15 0 0 0 295 17A15 15 0 0 0 310 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="295,17 283,21 283,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L289,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M325,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="99,41 88,45 88,37" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,29 Q 24,41 39,41 L 78,41 L 93,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M99,41L178,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,41L505,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,41 366,45 366,37" style="fill:rgb(0,0,0)"/>
<path d="M336,71 L 344,71 Q 351,71 351,56 L 351,56 Q 351,41 362,41 L 372,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,109 219,113 219,105" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,94 Q 204,109 215,109 L 225,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,124L284,124A15 15 0 0 0 299 109A15 15 0 0 0 284 94L246,94A15 15 0 0 0 231 109A15 15 0 0 0 246 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RIGHT</text>
<polygon points="341,71 329,76 329,67" style="fill:rgb(0,0,0)"/>
<path d="M299,109 L 307,109 Q 314,109 314,94 L 314,86 Q 314,71 324,71 L 335,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,147 219,151 219,142" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,132 Q 204,147 215,147 L 225,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,162L274,162A15 15 0 0 0 289 147A15 15 0 0 0 274 132L246,132A15 15 0 0 0 231 147A15 15 0 0 0 246 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FULL</text>
<path d="M289,147 L 302,147 Q 314,147 314,132 L 314,109 L 314,94"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,192 219,196 219,188" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,177 Q 204,192 215,192 L 225,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,207L287,207A15 15 0 0 0 302 192A15 15 0 0 0 287 177L246,177A15 15 0 0 0 231 192A15 15 0 0 0 246 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="192" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INNER</text>
<polygon points="475,192 463,196 463,188" style="fill:rgb(0,0,0)"/>
<path d="M302,192L469,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,192 L 482,192 Q 490,192 490,185 L 490,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,238 219,242 219,233" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,223 Q 24,238 39,238 L 210,238 L 225,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,253L287,253A15 15 0 0 0 303 238A15 15 0 0 0 287 222L246,222A15 15 0 0 0 231 238A15 15 0 0 0 246 253Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="238" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CROSS</text>
<polygon points="475,238 463,242 463,233" style="fill:rgb(0,0,0)"/>
<path d="M303,238L469,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,238 L 482,238 Q 490,238 490,223 L 490,71 L 490,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='xd5c7a418' onclick='hideorshow("xd5c7a418","xf6f53452")'>show</button></p>
 <div id='xf6f53452' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/result-column.html">result-column:</a></b>
<button id='xcc1d9489' onclick='hideorshow("xcc1d9489","x61eb9236")'>show</button></p>
 <div id='x61eb9236' style='display:none;' class='imgcontainer'>
 <div style="max-width:398px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 398.054 163.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L94,32L94,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="136,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M94,17 L 102,17 Q 109,17 109,32 L 109,40 Q 109,55 119,55 L 130,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M151,70L155,70A15 15 0 0 0 170 55L170,55A15 15 0 0 0 155 39L151,39A15 15 0 0 0 136 55L136,55A15 15 0 0 0 151 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="206,55 194,59 194,50" style="fill:rgb(0,0,0)"/>
<path d="M170,55L200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,70L309,70A15 15 0 0 0 324 55L324,55A15 15 0 0 0 309 39L221,39A15 15 0 0 0 206 55L206,55A15 15 0 0 0 221 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="347,55 335,59 335,50" style="fill:rgb(0,0,0)"/>
<path d="M324,55L341,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,17 377,21 377,12" style="fill:rgb(0,0,0)"/>
<path d="M347,55 L 354,55 Q 362,55 362,40 L 362,32 Q 362,17 372,17 L 382,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="392" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,85 141,89 141,81" style="fill:rgb(0,0,0)"/>
<path d="M109,39 L 109,70 Q 109,85 124,85 L 132,85 L 147,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,85 L 170,85 Q 185,85 185,70 L 185,70 Q 185,55 192,55 L 200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="241,17 230,21 230,12" style="fill:rgb(0,0,0)"/>
<path d="M94,17L235,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M241,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,108 39,112 39,103" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,93 Q 24,108 34,108 L 45,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,123A15 15 0 0 0 81 108A15 15 0 0 0 66 92A15 15 0 0 0 50 108A15 15 0 0 0 66 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="108" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,108 335,112 335,103" style="fill:rgb(0,0,0)"/>
<path d="M81,108L341,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,108 L 354,108 Q 362,108 362,93 L 362,54 L 362,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,145 39,150 39,141" style="fill:rgb(0,0,0)"/>
<path d="M24,92 L 24,130 Q 24,145 34,145 L 45,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,160L141,160A15 15 0 0 0 156 145A15 15 0 0 0 141 130L66,130A15 15 0 0 0 50 145A15 15 0 0 0 66 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="145" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="179,145 167,150 167,141" style="fill:rgb(0,0,0)"/>
<path d="M156,145L173,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M194,160A15 15 0 0 0 209 145A15 15 0 0 0 194 130A15 15 0 0 0 179 145A15 15 0 0 0 194 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="232,145 221,150 221,141" style="fill:rgb(0,0,0)"/>
<path d="M209,145L226,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,160A15 15 0 0 0 262 145A15 15 0 0 0 247 130A15 15 0 0 0 232 145A15 15 0 0 0 247 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,145 335,150 335,141" style="fill:rgb(0,0,0)"/>
<path d="M262,145L341,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,145 L 354,145 Q 362,145 362,130 L 362,107 L 362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/table-or-subquery.html">table-or-subquery:</a></b>
<button id='x9111a751' onclick='hideorshow("x9111a751","x4a262dbb")'>show</button></p>
 <div id='x4a262dbb' style='display:none;' class='imgcontainer'>
 <div style="max-width:720px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 720.778 457.704">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,74 39,78 39,70" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,59 Q 24,74 34,74 L 45,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,89L162,89A15 15 0 0 0 177 74L177,74A15 15 0 0 0 162 59L66,59A15 15 0 0 0 50 74L50,74A15 15 0 0 0 66 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="194,74 183,78 183,70" style="fill:rgb(0,0,0)"/>
<path d="M177,74L189,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,89A15 15 0 0 0 225 74L225,74A15 15 0 0 0 209 59A15 15 0 0 0 194 74L194,74A15 15 0 0 0 209 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="266,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M225,74 L 232,74 Q 240,74 240,59 L 240,51 Q 240,36 250,36 L 260,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,51L356,51A15 15 0 0 0 371 36A15 15 0 0 0 356 21L281,21A15 15 0 0 0 266 36A15 15 0 0 0 281 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="407,36 396,41 396,32" style="fill:rgb(0,0,0)"/>
<path d="M371,36L402,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,51L427,51A15 15 0 0 0 442 36A15 15 0 0 0 427 21L423,21A15 15 0 0 0 407 36A15 15 0 0 0 423 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="478,36 466,41 466,32" style="fill:rgb(0,0,0)"/>
<path d="M442,36L472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,51L561,51A15 15 0 0 0 577 36A15 15 0 0 0 561 21L493,21A15 15 0 0 0 478 36A15 15 0 0 0 493 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="527" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<path d="M9,36L255,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="422,6 411,10 411,2" style="fill:rgb(0,0,0)"/>
<path d="M371,36 L 379,36 Q 386,36 386,21 L 386,21 Q 386,6 401,6 L 402,6 L 417,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 442,6 Q 457,6 457,21 L 457,21 Q 457,36 464,36 L 472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 577,6 Q 592,6 592,21 L 592,21 Q 592,36 599,36 L 607,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,127L388,127A15 15 0 0 0 403 112A15 15 0 0 0 388 97L323,97A15 15 0 0 0 308 112A15 15 0 0 0 323 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="426,112 415,116 415,108" style="fill:rgb(0,0,0)"/>
<path d="M403,112L420,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,127L445,127A15 15 0 0 0 460 112A15 15 0 0 0 445 97L441,97A15 15 0 0 0 426 112A15 15 0 0 0 441 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="443" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="483,112 472,116 472,108" style="fill:rgb(0,0,0)"/>
<path d="M460,112L478,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,127L577,127A15 15 0 0 0 592 112A15 15 0 0 0 577 97L499,97A15 15 0 0 0 483 112A15 15 0 0 0 499 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="538" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M323,165L343,165A15 15 0 0 0 359 150A15 15 0 0 0 343 135L323,135A15 15 0 0 0 308 150A15 15 0 0 0 323 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="382,150 370,154 370,145" style="fill:rgb(0,0,0)"/>
<path d="M359,150L376,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,165L461,165A15 15 0 0 0 476 150A15 15 0 0 0 461 135L397,135A15 15 0 0 0 382 150A15 15 0 0 0 397 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="527,74 539,70 539,78" style="fill:rgb(0,0,0)"/>
<path d="M577,36 L 607,36 Q 622,36 622,51 L 622,59 Q 622,74 607,74 L 548,74 L 533,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,150 297,154 297,145" style="fill:rgb(0,0,0)"/>
<path d="M527,74 L 297,74 Q 282,74 282,89 L 282,135 Q 282,150 292,150 L 302,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,112 297,116 297,108" style="fill:rgb(0,0,0)"/>
<path d="M282,97 L 282,104 Q 282,112 292,112 L 302,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="266,213 255,217 255,209" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,198 Q 24,213 39,213 L 245,213 L 260,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,228L431,228A15 15 0 0 0 446 213A15 15 0 0 0 431 198L281,198A15 15 0 0 0 266 213A15 15 0 0 0 281 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function-name</text>
<polygon points="463,213 452,217 452,209" style="fill:rgb(0,0,0)"/>
<path d="M446,213L457,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,228A15 15 0 0 0 493 213A15 15 0 0 0 478 198A15 15 0 0 0 463 213A15 15 0 0 0 478 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="529,213 518,217 518,209" style="fill:rgb(0,0,0)"/>
<path d="M493,213L524,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M529,228L579,228L579,198L529,198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="615,213 603,217 603,209" style="fill:rgb(0,0,0)"/>
<path d="M579,213L609,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M630,228A15 15 0 0 0 645 213A15 15 0 0 0 630 198A15 15 0 0 0 615 213A15 15 0 0 0 630 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="630" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="675,187 679,198 671,198" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 660,213 Q 675,213 675,203 L 675,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M554,190A15 15 0 0 0 569 175A15 15 0 0 0 554 160A15 15 0 0 0 539 175A15 15 0 0 0 554 190Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="175" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="569,175 581,171 581,180" style="fill:rgb(0,0,0)"/>
<path d="M579,213 L 586,213 Q 594,213 594,198 L 594,190 Q 594,175 584,175 L 575,175"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,175 L 518,175 Q 503,175 503,190 L 503,198 Q 503,213 510,213 L 518,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,74 L 232,74 Q 240,74 240,89 L 240,198 Q 240,213 247,213 L 255,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,112 648,116 648,108" style="fill:rgb(0,0,0)"/>
<path d="M592,112L654,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,112 L 667,112 Q 675,112 675,104 L 675,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,150 648,154 648,145" style="fill:rgb(0,0,0)"/>
<path d="M476,150L654,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,150 L 667,150 Q 675,150 675,142 L 675,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M577,36L690,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,304L411,304A15 15 0 0 0 426 289A15 15 0 0 0 411 274L407,274A15 15 0 0 0 392 289A15 15 0 0 0 407 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="498,289 487,293 487,284" style="fill:rgb(0,0,0)"/>
<path d="M426,289L492,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M513,304L582,304A15 15 0 0 0 597 289A15 15 0 0 0 582 274L513,274A15 15 0 0 0 498 289A15 15 0 0 0 513 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="548" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<polygon points="660,289 648,293 648,284" style="fill:rgb(0,0,0)"/>
<path d="M597,289L654,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,289 L 667,289 Q 675,289 675,281 L 675,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="548,251 559,247 559,255" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 652,213 Q 660,213 660,228 L 660,236 Q 660,251 645,251 L 568,251 L 553,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M548,251 L 370,251 Q 355,251 355,266 L 355,274 Q 355,289 370,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,251 L 464,251 Q 457,251 457,266 L 457,274 Q 457,289 464,289 L 472,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,327 39,331 39,322" style="fill:rgb(0,0,0)"/>
<path d="M24,198 L 24,312 Q 24,327 34,327 L 45,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,342A15 15 0 0 0 81 327A15 15 0 0 0 66 311A15 15 0 0 0 50 327A15 15 0 0 0 66 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,327 92,331 92,322" style="fill:rgb(0,0,0)"/>
<path d="M81,327L98,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,342L208,342L208,311L104,311Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="327" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="231,327 219,331 219,322" style="fill:rgb(0,0,0)"/>
<path d="M208,327L225,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,342A15 15 0 0 0 261 327A15 15 0 0 0 246 311A15 15 0 0 0 231 327A15 15 0 0 0 246 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M261,327 L 269,327 Q 276,327 276,312 L 276,304 Q 276,289 291,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,327 648,331 648,322" style="fill:rgb(0,0,0)"/>
<path d="M261,327L654,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,327 L 667,327 Q 675,327 675,319 L 675,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,327 L 432,327 Q 439,327 439,312 L 439,304 Q 439,289 447,289 L 454,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,364 39,369 39,360" style="fill:rgb(0,0,0)"/>
<path d="M24,311 L 24,349 Q 24,364 34,364 L 45,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,379A15 15 0 0 0 81 364A15 15 0 0 0 65 349A15 15 0 0 0 50 364A15 15 0 0 0 65 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="135,364 123,369 123,360" style="fill:rgb(0,0,0)"/>
<path d="M81,364L129,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,379L296,379L296,349L135,349Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="364" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="350,364 338,369 338,360" style="fill:rgb(0,0,0)"/>
<path d="M296,364L344,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,379A15 15 0 0 0 380 364A15 15 0 0 0 365 349A15 15 0 0 0 350 364A15 15 0 0 0 365 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="660,364 648,369 648,360" style="fill:rgb(0,0,0)"/>
<path d="M380,364L654,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="711,36 699,41 699,32" style="fill:rgb(0,0,0)"/>
<path d="M660,364 L 667,364 Q 675,364 675,349 L 675,51 Q 675,36 690,36 L 690,36 L 705,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="715" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,417A15 15 0 0 0 230 402A15 15 0 0 0 215 387A15 15 0 0 0 200 402A15 15 0 0 0 215 417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="402" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="230,402 242,398 242,406" style="fill:rgb(0,0,0)"/>
<path d="M296,364 L 303,364 Q 311,364 311,379 L 311,387 Q 311,402 296,402 L 251,402 L 236,402"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,402 L 123,402 Q 108,402 108,387 L 108,379 Q 108,364 116,364 L 123,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="122,440 111,444 111,436" style="fill:rgb(0,0,0)"/>
<path d="M81,364 L 88,364 Q 96,364 96,379 L 96,425 Q 96,440 106,440 L 116,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M122,455L224,455L224,425L122,425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M224,440 L 308,440 Q 323,440 323,425 L 323,379 Q 323,364 331,364 L 338,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/window-defn.html">window-defn:</a></b>
<button id='xb4b2d2d0' onclick='hideorshow("xb4b2d2d0","x1ad3055a")'>show</button></p>
 <div id='x1ad3055a' style='display:none;' class='imgcontainer'>
 <div style="max-width:479px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 479.765 380.592">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,44 92,48 92,40" style="fill:rgb(0,0,0)"/>
<path d="M62,17 L 70,17 Q 77,17 77,30 Q 77,44 88,44 L 98,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,59L260,59A15 15 0 0 0 275 44L275,44A15 15 0 0 0 260 29L119,29A15 15 0 0 0 104 44L104,44A15 15 0 0 0 119 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M119,135L198,135A15 15 0 0 0 214 120A15 15 0 0 0 198 104L119,104A15 15 0 0 0 104 120A15 15 0 0 0 119 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="237,120 225,124 225,115" style="fill:rgb(0,0,0)"/>
<path d="M214,120L231,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M252,135L256,135A15 15 0 0 0 271 120A15 15 0 0 0 256 104L252,104A15 15 0 0 0 237 120A15 15 0 0 0 252 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="307,120 295,124 295,115" style="fill:rgb(0,0,0)"/>
<path d="M271,120L301,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,135L356,135L356,104L307,104Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M332,173A15 15 0 0 0 347 157A15 15 0 0 0 332 142A15 15 0 0 0 316 157A15 15 0 0 0 332 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="157" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="347,157 358,153 358,162" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,142 Q 371,157 362,157 L 352,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,157 L 295,157 Q 280,157 280,142 L 280,135 Q 280,120 288,120 L 295,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,17 178,21 178,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L184,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,82 201,77 201,86" style="fill:rgb(0,0,0)"/>
<path d="M190,17 L 298,17 Q 313,17 313,32 L 313,67 Q 313,82 298,82 L 210,82 L 195,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,120 92,124 92,115" style="fill:rgb(0,0,0)"/>
<path d="M190,82 L 77,82 Q 62,82 62,97 L 62,105 Q 62,120 77,120 L 83,120 L 98,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,44 287,48 287,40" style="fill:rgb(0,0,0)"/>
<path d="M275,44L293,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,44 L 306,44 Q 313,44 313,51 L 313,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,248L163,248A15 15 0 0 0 178 233A15 15 0 0 0 163 218L119,218A15 15 0 0 0 104 233A15 15 0 0 0 119 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="201,233 190,237 190,229" style="fill:rgb(0,0,0)"/>
<path d="M178,233L196,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,248L221,248A15 15 0 0 0 236 233A15 15 0 0 0 221 218L217,218A15 15 0 0 0 201 233A15 15 0 0 0 217 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="272,233 260,237 260,229" style="fill:rgb(0,0,0)"/>
<path d="M236,233L266,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,248L402,248L402,218L272,218Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M337,286A15 15 0 0 0 352 271A15 15 0 0 0 337 256A15 15 0 0 0 322 271A15 15 0 0 0 337 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="352,271 363,266 363,275" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,256 Q 417,271 402,271 L 373,271 L 358,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M322,271 L 260,271 Q 245,271 245,256 L 245,248 Q 245,233 253,233 L 260,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,195 201,191 201,200" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,180 Q 371,195 356,195 L 210,195 L 195,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,233 92,237 92,229" style="fill:rgb(0,0,0)"/>
<path d="M190,195 L 77,195 Q 62,195 62,210 L 62,218 Q 62,233 77,233 L 83,233 L 98,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,157 58,146 66,146" style="fill:rgb(0,0,0)"/>
<path d="M62,104L62,152"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,157L62,218"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,362L208,362L208,331L104,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="417,346 405,351 405,342" style="fill:rgb(0,0,0)"/>
<path d="M208,346L411,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,362A15 15 0 0 0 447 346A15 15 0 0 0 432 331A15 15 0 0 0 417 346A15 15 0 0 0 432 362Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="470,346 458,351 458,342" style="fill:rgb(0,0,0)"/>
<path d="M447,346L464,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="474" cy="346" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,309 201,304 201,313" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,294 Q 417,309 402,309 L 210,309 L 195,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,346 92,351 92,342" style="fill:rgb(0,0,0)"/>
<path d="M190,309 L 77,309 Q 62,309 62,324 L 62,331 Q 62,346 77,346 L 83,346 L 98,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,271 58,259 66,259" style="fill:rgb(0,0,0)"/>
<path d="M62,218L62,265"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,271L62,331"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,374 144,378 144,369" style="fill:rgb(0,0,0)"/>
<path d="M62,331 L 62,359 Q 62,374 77,374 L 135,374 L 150,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,346 266,351 266,342" style="fill:rgb(0,0,0)"/>
<path d="M156,374 L 233,374 Q 248,374 248,360 Q 248,346 260,346 L 272,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x9d8291b1' onclick='hideorshow("x9d8291b1","x9073efc1")'>show</button></p>
 <div id='x9073efc1' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/type-name.html">type-name:</a></b>
<button id='x654e22ac' onclick='hideorshow("x654e22ac","x68387ca5")'>show</button></p>
 <div id='x68387ca5' style='display:none;' class='imgcontainer'>
 <div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.008 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L87,32A15 15 0 0 0 102 17A15 15 0 0 0 87 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="165,92 153,97 153,88" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,77 Q 138,92 149,92 L 159,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,108A15 15 0 0 0 195 92A15 15 0 0 0 180 77A15 15 0 0 0 165 92A15 15 0 0 0 180 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,92 201,97 201,88" style="fill:rgb(0,0,0)"/>
<path d="M195,92L207,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,108L350,108L350,77L212,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,92 356,97 356,88" style="fill:rgb(0,0,0)"/>
<path d="M350,92L362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,108A15 15 0 0 0 398 92A15 15 0 0 0 382 77A15 15 0 0 0 367 92A15 15 0 0 0 382 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="415,92 403,97 403,88" style="fill:rgb(0,0,0)"/>
<path d="M398,92L409,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,108L553,108L553,77L415,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="570,92 558,97 558,88" style="fill:rgb(0,0,0)"/>
<path d="M553,92L564,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,108A15 15 0 0 0 600 92A15 15 0 0 0 585 77A15 15 0 0 0 570 92A15 15 0 0 0 585 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="585" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="651,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M600,92 L 608,92 Q 615,92 615,77 L 615,32 Q 615,17 630,17 L 630,17 L 645,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,40 Q 138,55 149,55 L 159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70A15 15 0 0 0 195 55L195,55A15 15 0 0 0 180 39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,55 201,59 201,50" style="fill:rgb(0,0,0)"/>
<path d="M195,55L207,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,70L350,70L350,39L212,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,55 356,59 356,50" style="fill:rgb(0,0,0)"/>
<path d="M350,55L362,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,70A15 15 0 0 0 398 55L398,55A15 15 0 0 0 382 39A15 15 0 0 0 367 55L367,55A15 15 0 0 0 382 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="600,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M398,55L594,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M600,55 L 608,55 Q 615,55 615,47 L 615,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="74,47 85,43 85,51" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 110,17 Q 117,17 117,32 L 117,32 Q 117,47 102,47 L 94,47 L 79,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47 L 33,47 Q 18,47 18,32 L 18,32 Q 18,17 26,17 L 33,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="382,17 371,21 371,12" style="fill:rgb(0,0,0)"/>
<path d="M102,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,17L630,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='xc06afada' onclick='hideorshow("xc06afada","x2f685f92")'>show</button></p>
 <div id='x2f685f92' style='display:none;' class='imgcontainer'>
 <div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
</div>


<p>
The RETURNING clause is not a statement itself, but a clause that can
optionally appear near the end of top-level
<a href="lang_delete.html">DELETE</a>, <a href="lang_insert.html">INSERT</a>, and <a href="lang_update.html">UPDATE</a> statements.
The effect of the RETURNING clause is to cause the statement to return
one result row for each database row that is deleted, inserted, or updated.
 RETURNING is not standard SQL.  It is an extension.
SQLite's syntax for RETURNING is modelled after 
<a href="https://www.postgresql.org">PostgreSQL</a>.
  
</p><p>
The RETURNING syntax has been supported by SQLite since version 3.35.0
(2021-03-12).

</p><h2 id="typical_use"><span>1.1. </span>Typical Use</h2>

<p>
The RETURNING clause is designed to provide the application with the
values of columns that are filled in automatically by SQLite.  For
example:

</p><div class="codeblock"><pre>CREATE TABLE t0(
  a INTEGER PRIMARY KEY,
  b DATE DEFAULT CURRENT_TIMESTAMP,
  c INTEGER
);
INSERT INTO t0(c) VALUES(random()) RETURNING *;
</pre></div>

<p>
In the INSERT statement above, SQLite computes the values for all
three columns.  The RETURNING clause causes SQLite to report the chosen
values back to the application.  This saves the application from having
to issue a separate query to figure out exactly what values were inserted.

</p><h1 id="details"><span>2. </span>Details</h1>

<p>
The RETURNING clause is followed by a comma-separated list of
expressions.  These expressions are similar to the expressions following
the SELECT keyword in a <a href="lang_select.html">SELECT statement</a> in that they
define the values of the columns in the result set.  Each expression
defines the value for a single column.  Each expression may be
optionally followed by an AS clause that determines the name of
the result column.  The special "*" expression expands into a list
of all <a href="vtab.html#hiddencol">non-hidden</a> columns of the table being deleted,
inserted, or updated.

</p><p>
For INSERT and UPDATE statements, references to columns in the table
being modified refer to the value of that column <i>after</i> the change
has been applied.  For DELETE statements, references to columns mean
the value <i>before</i> the delete occurs.

</p><p>
The RETURNING clause only returns rows that are directly modified
by the DELETE, INSERT, or UPDATE statement.  The RETURNING clause
does not report any additional database changes
caused by <a href="foreignkeys.html">foreign key constraints</a> or <a href="lang_createtrigger.html">triggers</a>.

</p><p>
A RETURNING clause for an <a href="lang_upsert.html">UPSERT</a> reports both inserted and
updated rows.

</p><h2 id="processing_order"><span>2.1. </span>Processing Order</h2>

<p>
When a DELETE, INSERT, or UPDATE statement with a RETURNING clause
is run, all of the database changes occur during the first invocation
of <a href="c3ref/step.html">sqlite3_step()</a>.  The RETURNING clause output is accumulated in
memory.  The first sqlite3_step() call returns one row of RETURNING
output and subsequent rows of RETURNING output are returned by subsequent
calls to sqlite3_step().
To put this another way, all RETURNING clause output is embargoed
until after all database modification actions are completed.

</p><p>
This means that if a statement has a RETURNING clause that generates
a large amount of output, either many rows or large
string or BLOB values, then the statement might use a lot of 
temporary memory to hold those values while it is running.

</p><p>
The first prototype of the RETURNING clause returned
values as they were generated.  That approach used less memory, but
it had other problems:

</p><ol>
<li><p>
If the calls sqlite3_step() for two or more DML statements
where interleaved and if one of the
statements hit a constraint failure and aborted, reverting its
changes, then that could disrupt the operation of the other
DML statement.  This could not corrupt the database file, but
it could yield surprising and difficult-to-explain results in
the database.

</p></li><li><p>
If an application failed to call sqlite3_step() repeatedly until
it received SQLITE_DONE, then some of the database changes might
never occur.

</p></li><li><p>
The order of operations was different from client/server database
engines like PostgreSQL, which might cause portability issues
for some applications.
</p></li></ol>

<p>
For these reasons, the current implementation was modified so that
all database changes happen before any RETURNING output is emitted.

</p><p>
While SQLite does guarantee that all database changes will occur
before any RETURNING output is emitted, it does <i>not</i> guarantee
that the order of individual RETURNING rows will match the order in
which those rows were changed in the database.  The output order
for the RETURNING rows is arbitrary and is not necessarily related
to the order in which the rows were processed internally.

</p><h2 id="acid_changes"><span>2.2. </span>ACID Changes</h2>

<p>
When the previous "<i>Processing Order</i>" section says that
"database changes occur during the first invocation of sqlite3_step()",
that means that the changes are stored in the private page cache of
the database connection that is running the statement.  It does
<i>not</i> mean that the changes are actually committed.  The commit
does not occur until the statement finishes, and maybe not even then
if the statement is part of a larger transaction.  Changes to the
database are still atomic, consistent, isolated, and durable (ACID).
When the previous section says "changes occur",
this means that internal data structure are adjusted pending a transaction
commit.  Some of those changes may or may not spill into the
<a href="wal.html">write-ahead log</a>, depending on how much pressure there is on the
page cache.  If the page cache is not under memory pressure, then
probably nothing will be written to disk until after the transaction
completes, which is after sqlite3_step() returns SQLITE_DONE.

</p><p>
In other words, when the previous section says "database changes
occur", that means that the changes occur in the memory of the
specific database connection that is running the statement, <i>not</i> that
the changes are written to disk.

</p><h1 id="limitations_and_caveats"><span>3. </span>Limitations And Caveats</h1>

<ol>
<li><p>
The RETURNING clause is not available on DELETE and UPDATE statements
against <a href="vtab.html">virtual tables</a>.
This limitation might be removed in future versions of SQLite.

</p></li><li><p>
The RETURNING clause is only available in top-level DELETE, INSERT,
and UPDATE statements.  The RETURNING clause cannot be used by
statements within triggers.

</p></li><li><p>
Even though a DML statement with a RETURNING clause returns table content,
it cannot be used as a subquery.  The RETURNING clause can only return
data to the application.  It is not currently possible to divert the
RETURNING output into another table or query.  PostgreSQL has the ability
to use a DML statement with a RETURNING clause like a view in a 
<a href="lang_with.html">common table expressions</a>. SQLite does not currently have that
ability, though that is something that might be added in a future release.

</p></li><li><p>
The rows emitted by the RETURNING clause appear in an arbitrary order.
That order might change depending on the database schema, upon the specific
release of SQLite used, or even from one execution of the same statement
to the next.
There is no way to cause the output rows to appear in a particular order.
Even if SQLite is compiled with the <a href="compile.html#enable_update_delete_limit">SQLITE_ENABLE_UPDATE_DELETE_LIMIT</a>
option such that ORDER BY clauses are allowed on DELETE and UPDATE
statements, those ORDER BY clauses do not constrain the output order
of RETURNING.

</p></li><li><p>
The values emitted by the RETURNING clause are the values as seen
by the top-level DELETE, INSERT, or UPDATE statement
and do not reflect any subsequent value changes made by <a href="lang_createtrigger.html">triggers</a>.
Thus, if the database includes AFTER triggers that modifies some
of the values of each row inserted or updated, the RETURNING clause
emits the original values that are computed before those triggers run.

</p></li><li><p>
The RETURNING clause may not contain top-level <a href="lang_aggfunc.html">aggregate functions</a> or
<a href="windowfunctions.html">window functions</a>.  If there are subqueries in the RETURNING clause,
those subqueries may contain aggregates and window functions, but
aggregates cannot occur at the top level.

</p></li><li><p>
The RETURNING clause may only reference the table being modified.
In an <a href="lang_update.html#upfrom">UPDATE FROM</a> statement, the auxiliary tables named in the FROM
clause may not participate in the RETURNING clause.

</p></li></ol>
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_returning.in?m=e4fe2ab8c1">2023-02-14 21:05:59</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_savepoint.html.











































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>Savepoints</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
Savepoints
</div>
</div>




<h1 id="syntax"><span>1. </span>Syntax</h1>

<p><b><a href="syntax/savepoint-stmt.html">savepoint-stmt:</a></b>
<button id='xb9721ecc' onclick='hideorshow("xb9721ecc","x4076c644")'>hide</button></p>
 <div id='x4076c644' class='imgcontainer'>
 <div style="max-width:346px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 346.003 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L131,32A15 15 0 0 0 146 17A15 15 0 0 0 131 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="89" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SAVEPOINT</text>
<polygon points="169,17 158,21 158,12" style="fill:rgb(0,0,0)"/>
<path d="M146,17L164,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M185,32L298,32A15 15 0 0 0 313 17A15 15 0 0 0 298 2L185,2A15 15 0 0 0 169 17A15 15 0 0 0 185 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="241" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">savepoint-name</text>
<polygon points="336,17 325,21 325,12" style="fill:rgb(0,0,0)"/>
<path d="M313,17L330,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="340" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/release-stmt.html">release-stmt:</a></b>
<button id='xa254d5c5' onclick='hideorshow("xa254d5c5","x9bcd8b3e")'>hide</button></p>
 <div id='x9bcd8b3e' class='imgcontainer'>
 <div style="max-width:488px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 488.736 54">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L111,32A15 15 0 0 0 126 17A15 15 0 0 0 111 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="79" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RELEASE</text>
<polygon points="162,17 150,21 150,12" style="fill:rgb(0,0,0)"/>
<path d="M126,17L156,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M177,32L261,32A15 15 0 0 0 276 17A15 15 0 0 0 261 2L177,2A15 15 0 0 0 162 17A15 15 0 0 0 177 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SAVEPOINT</text>
<polygon points="312,17 301,21 301,12" style="fill:rgb(0,0,0)"/>
<path d="M276,17L306,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M327,32L441,32A15 15 0 0 0 456 17A15 15 0 0 0 441 2L327,2A15 15 0 0 0 312 17A15 15 0 0 0 327 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">savepoint-name</text>
<polygon points="479,17 467,21 467,12" style="fill:rgb(0,0,0)"/>
<path d="M456,17L473,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="482" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="219,47 207,51 207,43" style="fill:rgb(0,0,0)"/>
<path d="M126,17 L 133,17 Q 141,17 141,32 L 141,32 Q 141,47 156,47 L 198,47 L 213,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,47 L 276,47 Q 291,47 291,32 L 291,32 Q 291,17 299,17 L 306,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/rollback-stmt.html">rollback-stmt:</a></b>
<button id='xde6b8b6f' onclick='hideorshow("xde6b8b6f","x61de7464")'>hide</button></p>
 <div id='x61de7464' class='imgcontainer'>
 <div style="max-width:801px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 801.734 67.392">
<circle cx="5" cy="33" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,33 20,38 20,29" style="fill:rgb(0,0,0)"/>
<path d="M9,33L26,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,48L125,48A15 15 0 0 0 140 33A15 15 0 0 0 125 18L47,18A15 15 0 0 0 32 33A15 15 0 0 0 47 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="86" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="176,33 164,38 164,29" style="fill:rgb(0,0,0)"/>
<path d="M140,33L170,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M191,48L303,48A15 15 0 0 0 318 33A15 15 0 0 0 303 18L191,18A15 15 0 0 0 176 33A15 15 0 0 0 191 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRANSACTION</text>
<polygon points="390,33 378,38 378,29" style="fill:rgb(0,0,0)"/>
<path d="M318,33L384,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M405,48L411,48A15 15 0 0 0 426 33A15 15 0 0 0 411 18L405,18A15 15 0 0 0 390 33A15 15 0 0 0 405 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="408" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TO</text>
<polygon points="462,33 450,38 450,29" style="fill:rgb(0,0,0)"/>
<path d="M426,33L456,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,48L561,48A15 15 0 0 0 576 33A15 15 0 0 0 561 18L477,18A15 15 0 0 0 462 33A15 15 0 0 0 477 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SAVEPOINT</text>
<polygon points="612,33 601,38 601,29" style="fill:rgb(0,0,0)"/>
<path d="M576,33L606,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M627,48L741,48A15 15 0 0 0 756 33A15 15 0 0 0 741 18L627,18A15 15 0 0 0 612 33A15 15 0 0 0 627 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="684" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">savepoint-name</text>
<polygon points="792,33 780,38 780,29" style="fill:rgb(0,0,0)"/>
<path d="M756,33L786,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="795" cy="33" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,6 507,10 507,2" style="fill:rgb(0,0,0)"/>
<path d="M426,33 L 433,33 Q 441,33 441,20 Q 441,6 456,6 L 498,6 L 513,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,6 L 576,6 Q 591,6 591,20 Q 591,33 599,33 L 606,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,60 507,65 507,56" style="fill:rgb(0,0,0)"/>
<path d="M352,33 L 359,33 Q 367,33 367,47 Q 367,60 382,60 L 498,60 L 513,60"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,60 L 756,60 Q 771,60 771,47 Q 771,33 778,33 L 786,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="247,60 235,65 235,56" style="fill:rgb(0,0,0)"/>
<path d="M140,33 L 147,33 Q 155,33 155,47 Q 155,60 170,60 L 226,60 L 241,60"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,60 L 318,60 Q 333,60 333,47 Q 333,33 340,33 L 348,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>


<h1 id="savepoints"><span>2. </span>Savepoints</h1>

<p> SAVEPOINTs are a method of creating transactions, similar to
<a href="lang_transaction.html">BEGIN</a> and <a href="lang_transaction.html">COMMIT</a>, except that the SAVEPOINT and RELEASE commands
are named and may be nested.</p>

<p> The SAVEPOINT command starts a new transaction with a name.
The transaction names need not be unique.
A SAVEPOINT can be started either within or outside of
a <a href="lang_transaction.html">BEGIN</a>...<a href="lang_transaction.html">COMMIT</a>.  When a SAVEPOINT is the outer-most savepoint
and it is not within a <a href="lang_transaction.html">BEGIN</a>...<a href="lang_transaction.html">COMMIT</a> then the behavior is the
same as BEGIN DEFERRED TRANSACTION.</p>

<p>The ROLLBACK TO command reverts the state of the database back to what
it was just after the corresponding SAVEPOINT.  Note that unlike that
plain <a href="lang_transaction.html">ROLLBACK</a> command (without the TO keyword) the ROLLBACK TO command
does not cancel the transaction.  Instead of cancelling the transaction,
the ROLLBACK TO command restarts the transaction again at the beginning.
All intervening SAVEPOINTs are canceled, however.</p>

<p>The RELEASE command is like a <a href="lang_transaction.html">COMMIT</a> for a SAVEPOINT.
The RELEASE command causes all savepoints back to and including the 
most recent savepoint with a matching name to be removed from the 
transaction stack.  The RELEASE of an inner transaction
does not cause any changes to be written to the database file; it merely
removes savepoints from the transaction stack such that it is
no longer possible to ROLLBACK TO those savepoints.
If a RELEASE command releases the outermost savepoint, so
that the transaction stack becomes empty, then RELEASE is the same
as <a href="lang_transaction.html">COMMIT</a>.
The <a href="lang_transaction.html">COMMIT</a> command may be used to release all savepoints and
commit the transaction even if the transaction was originally started
by a SAVEPOINT command instead of a <a href="lang_transaction.html">BEGIN</a> command.</p>

<p>If the savepoint-name in a RELEASE command does not match any
savepoint currently in the transaction stack, then no savepoints are
released, the database is unchanged, and the RELEASE command returns
an error.</p>

<p>Note that an inner transaction might commit (using the RELEASE command)
but then later have its work undone by a ROLLBACK in an outer transaction.
A power failure or program crash or OS crash will cause the outer-most
transaction to rollback, undoing all changes that have occurred within
that outer transaction, even changes that have supposedly been "committed"
by the RELEASE command.  Content is not actually committed on the disk 
until the outermost transaction commits.</p>

<p>There are several ways of thinking about the RELEASE command:</p>

<ul>
<li><p>
Some people view RELEASE as the equivalent of COMMIT for a SAVEPOINT.
This is an acceptable point of view as long as one remembers that the
changes committed by an inner transaction might later be undone by a
rollback in an outer transaction.</p></li>

<li><p>
Another view of RELEASE is that it merges a named transaction into its
parent transaction, so that the named transaction and its parent become
the same transaction.  After RELEASE, the named transaction and its parent
will commit or rollback together, whatever their fate may be.
</p></li>

<li><p>
One can also think of savepoints as
"marks" in the transaction timeline.  In this view, the SAVEPOINT command
creates a new mark, the ROLLBACK TO command rewinds the timeline back
to a point just after the named mark, and the RELEASE command
erases marks from the timeline without actually making any
changes to the database.
</p></li>
</ul>



<h1 id="transaction_nesting_rules"><span>3. </span>Transaction Nesting Rules</h1>

<p>The last transaction started will be the first
transaction committed or rolled back.</p>

<p>The <a href="lang_transaction.html">BEGIN</a> command only works if the transaction stack is empty, or
in other words if there are no pending transactions.  If the transaction
stack is not empty when the <a href="lang_transaction.html">BEGIN</a> command is invoked, then the command
fails with an error.</p>

<p>The <a href="lang_transaction.html">COMMIT</a> command commits all outstanding transactions and leaves
the transaction stack empty.</p>

<p>The RELEASE command starts with the most recent addition to the
transaction stack and releases savepoints backwards 
in time until it releases a savepoint with a matching savepoint-name.
Prior savepoints, even savepoints with matching savepoint-names, are
unchanged.
If the RELEASE command causes the
transaction stack to become empty (if the RELEASE command releases the
outermost transaction from the stack) then the transaction commits.</p>

<p>The <a href="lang_transaction.html">ROLLBACK</a> command without a TO clause rolls backs all transactions
and leaves the transaction stack empty.</p>

<p>The ROLLBACK command with a TO clause rolls back transactions going
backwards in time back to the most recent SAVEPOINT with a matching name.
The SAVEPOINT with the matching name remains on the transaction stack,
but all database changes that occurred after that SAVEPOINT was created
are rolled back.  If the savepoint-name in a ROLLBACK TO command does not
match any SAVEPOINT on the stack, then the ROLLBACK command fails with an
error and leaves the state of the database unchanged.</p>
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_savepoint.in?m=60d80524de">2022-01-08 05:02:57</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_select.html.

more than 10,000 changes

Added Doc/Extra/Core/lang_transaction.html.



























































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>Transaction</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
Transaction
</div>
</div>




<h1 id="transaction_control_syntax"><span>1. </span>Transaction Control Syntax</h1>

<p><b><a href="syntax/begin-stmt.html">begin-stmt:</a></b>
<button id='xb1701bb4' onclick='hideorshow("xb1701bb4","x4999ba07")'>hide</button></p>
 <div id='x4999ba07' class='imgcontainer'>
 <div style="max-width:560px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 560.669 140.4">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L86,32A15 15 0 0 0 101 17A15 15 0 0 0 86 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BEGIN</text>
<polygon points="124,17 112,21 112,12" style="fill:rgb(0,0,0)"/>
<path d="M101,17L118,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="162,123 150,127 150,118" style="fill:rgb(0,0,0)"/>
<path d="M124,17 L 131,17 Q 139,17 139,32 L 139,108 Q 139,123 147,123 L 156,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M177,138L261,138A15 15 0 0 0 276 123A15 15 0 0 0 261 108L177,108A15 15 0 0 0 162 123A15 15 0 0 0 177 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUSIVE</text>
<polygon points="299,123 287,127 287,118" style="fill:rgb(0,0,0)"/>
<path d="M276,123L293,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="337,17 325,21 325,12" style="fill:rgb(0,0,0)"/>
<path d="M299,123 L 306,123 Q 314,123 314,108 L 314,32 Q 314,17 322,17 L 331,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="373,17 361,21 361,12" style="fill:rgb(0,0,0)"/>
<path d="M337,17L367,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,32L500,32A15 15 0 0 0 515 17A15 15 0 0 0 500 2L388,2A15 15 0 0 0 373 17A15 15 0 0 0 388 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRANSACTION</text>
<polygon points="551,17 539,21 539,12" style="fill:rgb(0,0,0)"/>
<path d="M515,17L545,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="554" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="444,47 432,51 432,43" style="fill:rgb(0,0,0)"/>
<path d="M337,17 L 344,17 Q 352,17 352,32 L 352,32 Q 352,47 367,47 L 423,47 L 438,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,47 L 511,47 Q 526,47 526,32 L 526,32 Q 526,17 533,17 L 541,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M124,17L325,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="162,47 150,51 150,43" style="fill:rgb(0,0,0)"/>
<path d="M139,32 L 139,39 Q 139,47 147,47 L 156,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M177,62L257,62A15 15 0 0 0 272 47L272,47A15 15 0 0 0 257 32L177,32A15 15 0 0 0 162 47L162,47A15 15 0 0 0 177 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="217" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFERRED</text>
<polygon points="295,47 284,51 284,43" style="fill:rgb(0,0,0)"/>
<path d="M272,47L289,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,47 L 304,47 Q 314,47 314,40 L 314,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="162,85 150,89 150,81" style="fill:rgb(0,0,0)"/>
<path d="M139,32 L 139,70 Q 139,85 147,85 L 156,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M177,100L265,100A15 15 0 0 0 281 85A15 15 0 0 0 265 70L177,70A15 15 0 0 0 162 85A15 15 0 0 0 177 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="221" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IMMEDIATE</text>
<polygon points="304,85 292,89 292,81" style="fill:rgb(0,0,0)"/>
<path d="M281,85L298,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M304,85 L 309,85 Q 314,85 314,77 L 314,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/commit-stmt.html">commit-stmt:</a></b>
<button id='x4ef3720b' onclick='hideorshow("x4ef3720b","x9d6c8324")'>hide</button></p>
 <div id='x9d6c8324' class='imgcontainer'>
 <div style="max-width:434px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 434.506 72.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L141,32A15 15 0 0 0 157 17A15 15 0 0 0 141 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COMMIT</text>
<polygon points="202,17 190,21 190,12" style="fill:rgb(0,0,0)"/>
<path d="M157,17L196,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M202,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M253,32L365,32A15 15 0 0 0 380 17A15 15 0 0 0 365 2L253,2A15 15 0 0 0 238 17A15 15 0 0 0 253 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="309" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRANSACTION</text>
<polygon points="425,17 413,21 413,12" style="fill:rgb(0,0,0)"/>
<path d="M380,17L419,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="428" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,70L104,70A15 15 0 0 0 119 55L119,55A15 15 0 0 0 104 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="94" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="157,55 145,59 145,50" style="fill:rgb(0,0,0)"/>
<path d="M119,55L151,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M157,55 L 164,55 Q 172,55 172,40 L 172,32 Q 172,17 179,17 L 187,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="309,47 297,51 297,43" style="fill:rgb(0,0,0)"/>
<path d="M202,17 L 209,17 Q 217,17 217,32 L 217,32 Q 217,47 232,47 L 288,47 L 303,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,47 L 380,47 Q 395,47 395,32 L 395,32 Q 395,17 402,17 L 410,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/rollback-stmt.html">rollback-stmt:</a></b>
<button id='x9ceee9d3' onclick='hideorshow("x9ceee9d3","xccc8a912")'>hide</button></p>
 <div id='xccc8a912' class='imgcontainer'>
 <div style="max-width:801px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 801.734 67.392">
<circle cx="5" cy="33" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,33 20,38 20,29" style="fill:rgb(0,0,0)"/>
<path d="M9,33L26,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,48L125,48A15 15 0 0 0 140 33A15 15 0 0 0 125 18L47,18A15 15 0 0 0 32 33A15 15 0 0 0 47 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="86" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="176,33 164,38 164,29" style="fill:rgb(0,0,0)"/>
<path d="M140,33L170,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M191,48L303,48A15 15 0 0 0 318 33A15 15 0 0 0 303 18L191,18A15 15 0 0 0 176 33A15 15 0 0 0 191 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRANSACTION</text>
<polygon points="390,33 378,38 378,29" style="fill:rgb(0,0,0)"/>
<path d="M318,33L384,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M405,48L411,48A15 15 0 0 0 426 33A15 15 0 0 0 411 18L405,18A15 15 0 0 0 390 33A15 15 0 0 0 405 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="408" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TO</text>
<polygon points="462,33 450,38 450,29" style="fill:rgb(0,0,0)"/>
<path d="M426,33L456,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,48L561,48A15 15 0 0 0 576 33A15 15 0 0 0 561 18L477,18A15 15 0 0 0 462 33A15 15 0 0 0 477 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SAVEPOINT</text>
<polygon points="612,33 601,38 601,29" style="fill:rgb(0,0,0)"/>
<path d="M576,33L606,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M627,48L741,48A15 15 0 0 0 756 33A15 15 0 0 0 741 18L627,18A15 15 0 0 0 612 33A15 15 0 0 0 627 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="684" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">savepoint-name</text>
<polygon points="792,33 780,38 780,29" style="fill:rgb(0,0,0)"/>
<path d="M756,33L786,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="795" cy="33" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,6 507,10 507,2" style="fill:rgb(0,0,0)"/>
<path d="M426,33 L 433,33 Q 441,33 441,20 Q 441,6 456,6 L 498,6 L 513,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,6 L 576,6 Q 591,6 591,20 Q 591,33 599,33 L 606,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,60 507,65 507,56" style="fill:rgb(0,0,0)"/>
<path d="M352,33 L 359,33 Q 367,33 367,47 Q 367,60 382,60 L 498,60 L 513,60"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,60 L 756,60 Q 771,60 771,47 Q 771,33 778,33 L 786,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="247,60 235,65 235,56" style="fill:rgb(0,0,0)"/>
<path d="M140,33 L 147,33 Q 155,33 155,47 Q 155,60 170,60 L 226,60 L 241,60"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,60 L 318,60 Q 333,60 333,47 Q 333,33 340,33 L 348,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>


<h1 id="transactions"><span>2. </span>Transactions</h1>

<p>
No reads or writes occur except within a transaction.
Any command that accesses the database (basically, any SQL command,
except a few <a href="pragma.html#syntax">PRAGMA</a> statements)
will automatically start a transaction if
one is not already in effect.  Automatically started transactions
are committed when the last SQL statement finishes.
</p>

<p>
Transactions can be started manually using the BEGIN
command.  Such transactions usually persist until the next
COMMIT or ROLLBACK command.  But a transaction will also
ROLLBACK if the database is closed or if an error occurs
and the ROLLBACK conflict resolution algorithm is specified.
See the documentation on the <a href="lang_conflict.html">ON CONFLICT</a>
clause for additional information about the ROLLBACK
conflict resolution algorithm.
</p>

<p>
END TRANSACTION is an alias for COMMIT.
</p>

<p> Transactions created using BEGIN...COMMIT do not nest.
For nested transactions, use the <a href="lang_savepoint.html">SAVEPOINT</a> and <a href="lang_savepoint.html">RELEASE</a> commands.
The "TO SAVEPOINT <span class='yyterm'>name</span>" clause of the ROLLBACK command shown
in the syntax diagram above is only applicable to <a href="lang_savepoint.html">SAVEPOINT</a>
transactions.  An attempt to invoke the BEGIN command within
a transaction will fail with an error, regardless of whether
the transaction was started by <a href="lang_savepoint.html">SAVEPOINT</a> or a prior BEGIN.
The COMMIT command and the ROLLBACK command without the TO clause
work the same on <a href="lang_savepoint.html">SAVEPOINT</a> transactions as they do with transactions
started by BEGIN.</p>

<h2 id="read_transactions_versus_write_transactions"><span>2.1. </span>Read transactions versus write transactions</h2>

<p>SQLite supports multiple simultaneous read transactions
coming from separate database connections, possibly in separate
threads or processes, but only one simultaneous write transaction.
</p><p>

</p><p>A read transaction is used for reading only.  A write transaction
allows both reading and writing.  A read transaction is started
by a SELECT statement, and a write transaction is started by
statements like CREATE, DELETE, DROP, INSERT, or UPDATE (collectively
"write statements").  If a write statement occurs while
a read transaction is active, then the read transaction is upgraded
to a write transaction if possible.  If some other database connection
has already modified the database or is already in the process of
modifying the database, then upgrading to a write transaction is
not possible and the write statement will fail with <a href="rescode.html#busy">SQLITE_BUSY</a>.
</p>

<p>
While a read transaction is active, any changes to the database that
are implemented by separate database connections will not be seen
by the database connection that started the read transaction.  If database
connection X is holding a read transaction, it is possible that some
other database connection Y might change the content of the database
while X's transaction is still open, however X will not be able to see
those changes until after the transaction ends.  While its read
transaction is active, X will continue to see an historic snapshot of
the database prior to the changes implemented by Y.
</p>


<a name="immediate"></a>

<h2 id="deferred_immediate_and_exclusive_transactions"><span>2.2. </span>DEFERRED, IMMEDIATE, and EXCLUSIVE transactions</h2>

<p>
Transactions can be DEFERRED, IMMEDIATE, or EXCLUSIVE.
The default transaction behavior is DEFERRED.
</p>

<p>
DEFERRED means that the transaction does not actually
start until the database is first accessed.  Internally,
the BEGIN DEFERRED statement merely sets a flag on the database
connection that turns off the automatic commit that would normally
occur when the last statement finishes.  This causes the transaction
that is automatically started to persist until an explicit
COMMIT or ROLLBACK or until a rollback is provoked by an error
or an ON CONFLICT ROLLBACK clause.  If the first statement after
BEGIN DEFERRED is a SELECT, then a read transaction is started.
Subsequent write statements will upgrade the transaction to a
write transaction if possible, or return SQLITE_BUSY.  If the
first statement after BEGIN DEFERRED is a write statement, then
a write transaction is started.
</p>

<p>
IMMEDIATE causes the database connection to start a new write
immediately, without waiting for a write statement.  The
BEGIN IMMEDIATE might fail with <a href="rescode.html#busy">SQLITE_BUSY</a> if another write
transaction is already active on another database connection.
</p>

<p>
EXCLUSIVE is similar to IMMEDIATE in that a write transaction
is started immediately.  EXCLUSIVE and IMMEDIATE are the same
in <a href="wal.html">WAL mode</a>, but in other journaling modes, EXCLUSIVE prevents
other database connections from reading the database while the
transaction is underway.
</p>

<h2 id="implicit_versus_explicit_transactions"><span>2.3. </span>Implicit versus explicit transactions</h2>

<p>
An implicit transaction (a transaction that is started automatically,
not a transaction started by BEGIN) is committed automatically when
the last active statement finishes.  A statement finishes when its
last cursor closes, which is guaranteed to happen when the
prepared statement is <a href="c3ref/reset.html">reset</a> or
<a href="c3ref/finalize.html">finalized</a>.  Some statements might "finish"
for the purpose of transaction control prior to being reset or finalized,
but there is no guarantee of this.  The only way to ensure that a
statement has "finished" is to invoke <a href="c3ref/reset.html">sqlite3_reset()</a> or
<a href="c3ref/finalize.html">sqlite3_finalize()</a> on that statement.  An open <a href="c3ref/blob.html">sqlite3_blob</a> used for
incremental BLOB I/O also counts as an unfinished statement.
The <a href="c3ref/blob.html">sqlite3_blob</a> finishes when it is <a href="c3ref/blob_close.html">closed</a>.
</p>

<p>
The explicit COMMIT command runs immediately, even if there are
pending <a href="lang_select.html">SELECT</a> statements.  However, if there are pending
write operations, the COMMIT command
will fail with an error code <a href="rescode.html#busy">SQLITE_BUSY</a>.
</p>

<p>
An attempt to execute COMMIT might also result in an <a href="rescode.html#busy">SQLITE_BUSY</a> return code
if an another thread or process has an open read connection.
When COMMIT fails in this
way, the transaction remains active and the COMMIT can be retried later
after the reader has had a chance to clear.
</p>

<p>
In very old versions of SQLite (before version 3.7.11 - 2012-03-20)
the ROLLBACK will fail with an error code
<a href="rescode.html#busy">SQLITE_BUSY</a> if there are any pending queries.  In more recent
versions of SQLite, the ROLLBACK will proceed and pending statements
will often be aborted, causing them to return an <a href="rescode.html#abort">SQLITE_ABORT</a> or
<a href="rescode.html#abort_rollback">SQLITE_ABORT_ROLLBACK</a> error.
In SQLite version 3.8.8 (2015-01-16) and later,
a pending read will continue functioning
after the ROLLBACK as long as the ROLLBACK does not modify the database
schema.
</p>

<p>
If <a href="pragma.html#pragma_journal_mode">PRAGMA journal_mode</a> is set to OFF (thus disabling the rollback journal
file) then the behavior of the ROLLBACK command is undefined.
</p>

<h1 id="response_to_errors_within_a_transaction"><span>3. </span>Response To Errors Within A Transaction</h1>

<p> If certain kinds of errors occur within a transaction, the
transaction may or may not be rolled back automatically.  The
errors that can cause an automatic rollback include:</p>

<ul>
<li> <a href="rescode.html#full">SQLITE_FULL</a>: database or disk full
</li><li> <a href="rescode.html#ioerr">SQLITE_IOERR</a>: disk I/O error
</li><li> <a href="rescode.html#busy">SQLITE_BUSY</a>: database in use by another process
</li><li> <a href="rescode.html#nomem">SQLITE_NOMEM</a>: out of memory
</li></ul>

<p>
For all of these errors, SQLite attempts to undo just the one statement
it was working on and leave changes from prior statements within the
same transaction intact and continue with the transaction.  However,
depending on the statement being evaluated and the point at which the
error occurs, it might be necessary for SQLite to rollback and
cancel the entire transaction.  An application can tell which
course of action SQLite took by using the
<a href="c3ref/get_autocommit.html">sqlite3_get_autocommit()</a> C-language interface.</p>

<p>It is recommended that applications respond to the errors
listed above by explicitly issuing a ROLLBACK command.  If the
transaction has already been rolled back automatically
by the error response, then the ROLLBACK command will fail with an
error, but no harm is caused by this.</p>

<p>Future versions of SQLite may extend the list of errors which
might cause automatic transaction rollback.  Future versions of
SQLite might change the error response.  In particular, we may
choose to simplify the interface in future versions of SQLite by
causing the errors above to force an unconditional rollback.</p>
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_transaction.in?m=9c5adbec23">2023-03-14 14:31:07</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_update.html.

























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>UPDATE</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
UPDATE
</div>
<div class="fancy_toc">
<a onclick="toggle_toc()">
<span class="fancy_toc_mark" id="toc_mk">&#x25ba;</span>
Table Of Contents
</a>
<div id="toc_sub"><div class="fancy-toc1"><a href="#overview">1. Overview</a></div>
<div class="fancy-toc1"><a href="#details">2. Details</a></div>
<div class="fancy-toc2"><a href="#restrictions_on_update_statements_within_create_trigger">2.1. Restrictions on UPDATE Statements Within CREATE TRIGGER</a></div>
<div class="fancy-toc2"><a href="#update_from">2.2. UPDATE FROM</a></div>
<div class="fancy-toc3"><a href="#update_from_in_other_sql_database_engines">2.2.1. UPDATE FROM in other SQL database engines</a></div>
<div class="fancy-toc2"><a href="#optional_limit_and_order_by_clauses">2.3. Optional LIMIT and ORDER BY Clauses</a></div>
</div>
</div>
<script>
function toggle_toc(){
var sub = document.getElementById("toc_sub")
var mk = document.getElementById("toc_mk")
if( sub.style.display!="block" ){
sub.style.display = "block";
mk.innerHTML = "&#x25bc;";
} else {
sub.style.display = "none";
mk.innerHTML = "&#x25ba;";
}
}
</script>
</div>




<h1 id="overview"><span>1. </span>Overview</h1>

<p><b><a href="syntax/update-stmt.html">update-stmt:</a></b>
<button id='xa4fdb076' onclick='hideorshow("xa4fdb076","x56a8d4eb")'>hide</button></p>
 <div id='x56a8d4eb' class='imgcontainer'>
 <div style="max-width:623px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 623.266 721.926">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L91,32A15 15 0 0 0 106 17A15 15 0 0 0 91 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M166,62L252,62A15 15 0 0 0 267 47L267,47A15 15 0 0 0 252 32L166,32A15 15 0 0 0 151 47L151,47A15 15 0 0 0 166 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="209,17 197,21 197,12" style="fill:rgb(0,0,0)"/>
<path d="M106,17L203,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M209,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M357,32L583,32L583,2L357,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="151,47 139,51 139,43" style="fill:rgb(0,0,0)"/>
<path d="M106,17 L 113,17 Q 121,17 121,32 L 121,32 Q 121,47 133,47 L 145,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,47 278,51 278,43" style="fill:rgb(0,0,0)"/>
<path d="M267,47L284,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,47 L 297,47 Q 305,47 305,32 L 305,32 Q 305,17 320,17 L 330,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,70A15 15 0 0 0 485 55L485,55A15 15 0 0 0 470 39A15 15 0 0 0 455 55L455,55A15 15 0 0 0 470 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="485,55 497,50 497,59" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,40 Q 598,55 583,55 L 506,55 L 491,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,55 L 349,55 Q 334,55 334,40 L 334,32 Q 334,17 340,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="294,83 306,79 306,88" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,68 Q 598,83 583,83 L 315,83 L 300,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="24,53 20,41 28,41" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,32 L 24,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,136L114,136A15 15 0 0 0 129 121A15 15 0 0 0 114 106L60,106A15 15 0 0 0 45 121A15 15 0 0 0 60 136Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="121" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="45,121 33,125 33,116" style="fill:rgb(0,0,0)"/>
<path d="M24,53 L 24,106 Q 24,121 31,121 L 39,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,83 L 39,83 Q 24,83 24,91 L 24,98"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,299 159,303 159,295" style="fill:rgb(0,0,0)"/>
<path d="M129,121 L 137,121 Q 144,121 144,136 L 144,284 Q 144,299 155,299 L 165,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,314L193,314A15 15 0 0 0 208 299A15 15 0 0 0 193 284L186,284A15 15 0 0 0 171 299A15 15 0 0 0 186 314Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="299" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,299 214,303 214,295" style="fill:rgb(0,0,0)"/>
<path d="M208,299L219,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,314L318,314A15 15 0 0 0 333 299A15 15 0 0 0 318 284L240,284A15 15 0 0 0 225 299A15 15 0 0 0 240 314Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="279" y="299" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="350,299 339,303 339,295" style="fill:rgb(0,0,0)"/>
<path d="M333,299L344,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,121 380,125 380,116" style="fill:rgb(0,0,0)"/>
<path d="M350,299 L 358,299 Q 365,299 365,284 L 365,136 Q 365,121 376,121 L 386,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M392,136L576,136L576,106L392,106Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="121" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">qualified-table-name</text>
<path d="M186,276L193,276A15 15 0 0 0 208 261A15 15 0 0 0 193 246L186,246A15 15 0 0 0 171 261A15 15 0 0 0 186 276Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="261" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,261 214,266 214,257" style="fill:rgb(0,0,0)"/>
<path d="M208,261L219,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,276L304,276A15 15 0 0 0 319 261A15 15 0 0 0 304 246L240,246A15 15 0 0 0 225 261A15 15 0 0 0 240 276Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="261" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<polygon points="350,261 339,266 339,257" style="fill:rgb(0,0,0)"/>
<path d="M319,261L344,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,261 L 358,261 Q 365,261 365,254 L 365,246"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,261 159,266 159,257" style="fill:rgb(0,0,0)"/>
<path d="M144,246 L 144,254 Q 144,261 155,261 L 165,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,239L193,239A15 15 0 0 0 208 224A15 15 0 0 0 193 208L186,208A15 15 0 0 0 171 224A15 15 0 0 0 186 239Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="224" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,224 214,228 214,219" style="fill:rgb(0,0,0)"/>
<path d="M208,224L219,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,239L292,239A15 15 0 0 0 307 224A15 15 0 0 0 292 208L240,208A15 15 0 0 0 225 224A15 15 0 0 0 240 239Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="266" y="224" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="350,224 339,228 339,219" style="fill:rgb(0,0,0)"/>
<path d="M307,224L344,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,224 L 358,224 Q 365,224 365,216 L 365,209"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,224 159,228 159,219" style="fill:rgb(0,0,0)"/>
<path d="M144,208 L 144,216 Q 144,224 155,224 L 165,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,201L193,201A15 15 0 0 0 208 186A15 15 0 0 0 193 171L186,171A15 15 0 0 0 171 186A15 15 0 0 0 186 201Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="186" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,186 214,190 214,181" style="fill:rgb(0,0,0)"/>
<path d="M208,186L219,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,201L262,201A15 15 0 0 0 277 186A15 15 0 0 0 262 171L240,171A15 15 0 0 0 225 186A15 15 0 0 0 240 201Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="186" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="350,186 339,190 339,181" style="fill:rgb(0,0,0)"/>
<path d="M277,186L344,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,186 L 358,186 Q 365,186 365,178 L 365,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,186 159,190 159,181" style="fill:rgb(0,0,0)"/>
<path d="M144,171 L 144,178 Q 144,186 155,186 L 165,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,163L193,163A15 15 0 0 0 208 148A15 15 0 0 0 193 133L186,133A15 15 0 0 0 171 148A15 15 0 0 0 186 163Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="148" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,148 214,152 214,144" style="fill:rgb(0,0,0)"/>
<path d="M208,148L219,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,163L282,163A15 15 0 0 0 297 148A15 15 0 0 0 282 133L240,133A15 15 0 0 0 225 148A15 15 0 0 0 240 163Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="148" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="350,148 339,152 339,144" style="fill:rgb(0,0,0)"/>
<path d="M297,148L344,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,148 L 358,148 Q 365,148 365,140 L 365,133"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,148 159,152 159,144" style="fill:rgb(0,0,0)"/>
<path d="M144,133 L 144,140 Q 144,148 155,148 L 165,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="350,121 339,125 339,116" style="fill:rgb(0,0,0)"/>
<path d="M129,121L344,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,121L380,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,375 39,379 39,370" style="fill:rgb(0,0,0)"/>
<path d="M576,121 L 584,121 Q 591,121 591,136 L 591,322 Q 591,337 576,337 L 39,337 Q 24,337 24,352 L 24,360 Q 24,375 34,375 L 45,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,390L81,390A15 15 0 0 0 96 375A15 15 0 0 0 81 360L65,360A15 15 0 0 0 50 375A15 15 0 0 0 65 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="73" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="153,413 141,417 141,408" style="fill:rgb(0,0,0)"/>
<path d="M96,375 L 111,375 Q 126,375 126,390 L 126,398 Q 126,413 136,413 L 147,413"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,428L309,428L309,397L153,397Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="413" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name-list</text>
<polygon points="350,375 339,379 339,370" style="fill:rgb(0,0,0)"/>
<path d="M309,413 L 316,413 Q 324,413 324,398 L 324,390 Q 324,375 334,375 L 344,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,390A15 15 0 0 0 380 375A15 15 0 0 0 365 360A15 15 0 0 0 350 375A15 15 0 0 0 365 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="375" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">=</text>
<polygon points="404,375 392,379 392,370" style="fill:rgb(0,0,0)"/>
<path d="M380,375L398,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,390L453,390L453,360L404,360Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="428" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="153,375 141,379 141,370" style="fill:rgb(0,0,0)"/>
<path d="M96,375L147,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,390L262,390A15 15 0 0 0 277 375A15 15 0 0 0 262 360L168,360A15 15 0 0 0 153 375A15 15 0 0 0 168 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<path d="M277,375L339,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M251,465A15 15 0 0 0 266 450A15 15 0 0 0 251 435A15 15 0 0 0 236 450A15 15 0 0 0 251 465Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="450" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="266,450 277,446 277,455" style="fill:rgb(0,0,0)"/>
<path d="M453,375 L 460,375 Q 468,375 468,390 L 468,435 Q 468,450 453,450 L 287,450 L 272,450"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,450 L 117,450 Q 102,450 102,435 L 102,390 Q 102,375 117,375 L 117,375 L 132,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="251,488 262,484 262,492" style="fill:rgb(0,0,0)"/>
<path d="M453,375 L 460,375 Q 468,375 468,390 L 468,473 Q 468,488 453,488 L 271,488 L 256,488"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M251,488 L 39,488 Q 24,488 24,503 L 24,511 Q 24,526 37,526 L 50,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,541L100,541A15 15 0 0 0 115 526A15 15 0 0 0 100 511L65,511A15 15 0 0 0 50 526A15 15 0 0 0 65 541Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="526" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="187,526 176,530 176,522" style="fill:rgb(0,0,0)"/>
<path d="M115,526L182,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,541L348,541L348,511L187,511Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="526" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M268,579A15 15 0 0 0 283 564A15 15 0 0 0 268 549A15 15 0 0 0 253 564A15 15 0 0 0 268 579Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="564" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="283,564 295,559 295,568" style="fill:rgb(0,0,0)"/>
<path d="M348,526 L 356,526 Q 363,526 363,541 L 363,549 Q 363,564 348,564 L 304,564 L 289,564"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M253,564 L 176,564 Q 161,564 161,549 L 161,541 Q 161,526 168,526 L 176,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="187,602 176,606 176,597" style="fill:rgb(0,0,0)"/>
<path d="M115,526 L 123,526 Q 130,526 130,541 L 130,587 Q 130,602 145,602 L 167,602 L 182,602"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,617L290,617L290,586L187,586Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="239" y="602" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<polygon points="405,526 393,530 393,522" style="fill:rgb(0,0,0)"/>
<path d="M290,602 L 363,602 Q 378,602 378,587 L 378,541 Q 378,526 389,526 L 399,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="244,639 255,635 255,644" style="fill:rgb(0,0,0)"/>
<path d="M405,526 L 412,526 Q 420,526 420,541 L 420,624 Q 420,639 405,639 L 265,639 L 250,639"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,526L393,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,677 39,681 39,673" style="fill:rgb(0,0,0)"/>
<path d="M244,639 L 39,639 Q 24,639 24,654 L 24,662 Q 24,677 34,677 L 45,677"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,692L115,692A15 15 0 0 0 130 677A15 15 0 0 0 115 662L66,662A15 15 0 0 0 50 677A15 15 0 0 0 66 692Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="90" y="677" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="153,677 142,681 142,673" style="fill:rgb(0,0,0)"/>
<path d="M130,677L147,677"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,692L202,692L202,662L153,662Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="178" y="677" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="24,586 20,575 28,575" style="fill:rgb(0,0,0)"/>
<path d="M24,511L24,581"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M24,586L24,662"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="613,715 602,719 602,711" style="fill:rgb(0,0,0)"/>
<path d="M24,662 L 24,700 Q 24,715 39,715 L 593,715 L 608,715"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="617" cy="715" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="253,715 242,719 242,711" style="fill:rgb(0,0,0)"/>
<path d="M202,677 L 210,677 Q 217,677 217,692 L 217,700 Q 217,715 232,715 L 233,715 L 248,715"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,677 283,681 283,673" style="fill:rgb(0,0,0)"/>
<path d="M253,715 L 261,715 Q 268,715 268,700 L 268,692 Q 268,677 279,677 L 289,677"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,692L446,692L446,662L295,662Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="370" y="677" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">returning-clause</text>
<polygon points="497,715 485,719 485,711" style="fill:rgb(0,0,0)"/>
<path d="M446,677 L 453,677 Q 461,677 461,692 L 461,700 Q 461,715 476,715 L 476,715 L 491,715"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/column-name-list.html">column-name-list:</a></b>
<button id='x91909bd0' onclick='hideorshow("x91909bd0","x519ae0f5")'>show</button></p>
 <div id='x519ae0f5' style='display:none;' class='imgcontainer'>
 <div style="max-width:353px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 353.621 72.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="85,17 74,21 74,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L79,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,17 110,21 110,12" style="fill:rgb(0,0,0)"/>
<path d="M85,17L115,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,32L230,32A15 15 0 0 0 245 17A15 15 0 0 0 230 2L136,2A15 15 0 0 0 121 17A15 15 0 0 0 136 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="290,17 279,21 279,12" style="fill:rgb(0,0,0)"/>
<path d="M245,17L285,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M306,32A15 15 0 0 0 321 17A15 15 0 0 0 306 2A15 15 0 0 0 290 17A15 15 0 0 0 306 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="306" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="344,17 332,21 332,12" style="fill:rgb(0,0,0)"/>
<path d="M321,17L338,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="347" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M183,70A15 15 0 0 0 198 55L198,55A15 15 0 0 0 183 39A15 15 0 0 0 168 55L168,55A15 15 0 0 0 183 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="198,55 210,50 210,59" style="fill:rgb(0,0,0)"/>
<path d="M245,17 L 257,17 Q 269,17 269,32 L 269,40 Q 269,55 254,55 L 219,55 L 204,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,17 110,21 110,12" style="fill:rgb(0,0,0)"/>
<path d="M168,55 L 102,55 Q 87,55 87,40 L 87,32 Q 87,17 101,17 L 115,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/common-table-expression.html">common-table-expression:</a></b>
<button id='x5daf289c' onclick='hideorshow("x5daf289c","xd5e6082f")'>show</button></p>
 <div id='xd5e6082f' style='display:none;' class='imgcontainer'>
 <div style="max-width:638px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 638.525 167.4">
<circle cx="5" cy="29" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,29 20,33 20,24" style="fill:rgb(0,0,0)"/>
<path d="M9,29L26,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,44L122,44A15 15 0 0 0 137 29A15 15 0 0 0 122 14L47,14A15 15 0 0 0 32 29A15 15 0 0 0 47 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="160,29 149,33 149,24" style="fill:rgb(0,0,0)"/>
<path d="M137,29L155,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="196,29 185,33 185,24" style="fill:rgb(0,0,0)"/>
<path d="M160,29L191,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,44A15 15 0 0 0 227 29A15 15 0 0 0 211 14A15 15 0 0 0 196 29A15 15 0 0 0 211 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="250,29 238,33 238,24" style="fill:rgb(0,0,0)"/>
<path d="M227,29L244,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="286,29 274,33 274,24" style="fill:rgb(0,0,0)"/>
<path d="M250,29L280,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,44L395,44A15 15 0 0 0 410 29A15 15 0 0 0 395 14L301,14A15 15 0 0 0 286 29A15 15 0 0 0 301 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="446,29 434,33 434,24" style="fill:rgb(0,0,0)"/>
<path d="M410,29L440,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,44A15 15 0 0 0 476 29A15 15 0 0 0 461 14A15 15 0 0 0 446 29A15 15 0 0 0 461 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,29 499,33 499,24" style="fill:rgb(0,0,0)"/>
<path d="M476,29L505,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,165L51,165A15 15 0 0 0 66 150A15 15 0 0 0 51 135L47,135A15 15 0 0 0 32 150A15 15 0 0 0 47 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="49" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<path d="M127,135L147,135A15 15 0 0 0 162 119A15 15 0 0 0 147 104L127,104A15 15 0 0 0 112 119A15 15 0 0 0 127 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<path d="M219,135L337,135A15 15 0 0 0 352 119A15 15 0 0 0 337 104L219,104A15 15 0 0 0 204 119A15 15 0 0 0 219 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<path d="M162,119L204,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,165A15 15 0 0 0 425 150A15 15 0 0 0 410 135A15 15 0 0 0 395 150A15 15 0 0 0 410 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="410" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="448,150 437,154 437,145" style="fill:rgb(0,0,0)"/>
<path d="M425,150L442,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,165L552,165L552,135L448,135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="500" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="575,150 564,154 564,145" style="fill:rgb(0,0,0)"/>
<path d="M552,150L570,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M591,165A15 15 0 0 0 606 150A15 15 0 0 0 591 135A15 15 0 0 0 575 150A15 15 0 0 0 591 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="629,150 617,154 617,145" style="fill:rgb(0,0,0)"/>
<path d="M606,150L623,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="632" cy="150" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,82A15 15 0 0 0 363 66A15 15 0 0 0 348 51A15 15 0 0 0 333 66A15 15 0 0 0 348 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="363,66 374,62 374,71" style="fill:rgb(0,0,0)"/>
<path d="M410,29 L 417,29 Q 425,29 425,44 L 425,51 Q 425,66 410,66 L 384,66 L 369,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M333,66 L 278,66 Q 263,66 263,51 L 263,44 Q 263,29 270,29 L 278,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,93 78,89 78,97" style="fill:rgb(0,0,0)"/>
<path d="M511,29 L 516,29 Q 522,29 522,44 L 522,78 Q 522,93 507,93 L 87,93 L 72,93"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,150 20,154 20,145" style="fill:rgb(0,0,0)"/>
<path d="M66,93 L 30,93 Q 15,93 15,108 L 15,135 Q 15,150 20,150 L 26,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="85,150 73,154 73,145" style="fill:rgb(0,0,0)"/>
<path d="M66,150L79,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="112,119 101,124 101,115" style="fill:rgb(0,0,0)"/>
<path d="M85,150 L 89,150 Q 92,150 92,135 L 92,134 Q 92,119 99,119 L 106,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="204,119 192,124 192,115" style="fill:rgb(0,0,0)"/>
<path d="M66,150 L 147,150 Q 162,150 170,150 Q 177,150 177,135 L 177,134 Q 177,119 188,119 L 198,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,150 383,154 383,145" style="fill:rgb(0,0,0)"/>
<path d="M352,119 L 360,119 Q 367,119 367,134 L 367,135 Q 367,150 378,150 L 389,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150L395,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,6 336,10 336,2" style="fill:rgb(0,0,0)"/>
<path d="M160,29 L 168,29 Q 175,29 175,17 Q 175,6 190,6 L 327,6 L 342,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,6 L 473,6 Q 488,6 488,17 Q 488,29 495,29 L 503,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/select-stmt.html">select-stmt:</a></b>
<button id='xd0fad348' onclick='hideorshow("xd0fad348","x7108224e")'>show</button></p>
 <div id='x7108224e' style='display:none;' class='imgcontainer'>
 <div style="max-width:669px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 669.677 1162.3">
<path d="M55,845L667,845L667,99L55,99Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="6" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="46,17 34,21 34,12" style="fill:rgb(0,0,0)"/>
<path d="M10,17L40,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M61,32L92,32A15 15 0 0 0 107 17A15 15 0 0 0 92 2L61,2A15 15 0 0 0 46 17A15 15 0 0 0 61 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="76" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M167,62L253,62A15 15 0 0 0 268 47L268,47A15 15 0 0 0 253 32L167,32A15 15 0 0 0 152 47L152,47A15 15 0 0 0 167 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="210,17 198,21 198,12" style="fill:rgb(0,0,0)"/>
<path d="M107,17L204,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M210,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M358,32L584,32L584,2L358,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="152,47 140,51 140,43" style="fill:rgb(0,0,0)"/>
<path d="M107,17 L 114,17 Q 122,17 122,32 L 122,32 Q 122,47 134,47 L 146,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="291,47 279,51 279,43" style="fill:rgb(0,0,0)"/>
<path d="M268,47L285,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,47 L 298,47 Q 306,47 306,32 L 306,32 Q 306,17 321,17 L 331,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,70A15 15 0 0 0 486 55L486,55A15 15 0 0 0 471 39A15 15 0 0 0 456 55L456,55A15 15 0 0 0 471 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="486,55 498,50 498,59" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,40 Q 599,55 584,55 L 507,55 L 492,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,55 L 350,55 Q 335,55 335,40 L 335,32 Q 335,17 340,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,83 307,79 307,88" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,68 Q 599,83 584,83 L 316,83 L 301,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,83 L 40,83 Q 25,83 25,98 L 25,113"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="25,47 20,36 29,36" style="fill:rgb(0,0,0)"/>
<path d="M10,17 L 17,17 Q 25,17 25,29 L 25,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="55,129 43,133 43,124" style="fill:rgb(0,0,0)"/>
<path d="M25,47 L 25,114 Q 25,129 37,129 L 49,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,129 115,133 115,124" style="fill:rgb(0,0,0)"/>
<path d="M55,129L121,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,144L193,144A15 15 0 0 0 208 129A15 15 0 0 0 193 114L142,114A15 15 0 0 0 127 129A15 15 0 0 0 142 144Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="250,159 238,163 238,155" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,144 Q 223,159 233,159 L 244,159"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,174L333,174A15 15 0 0 0 348 159A15 15 0 0 0 333 144L265,144A15 15 0 0 0 250 159A15 15 0 0 0 265 174Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="159" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="417,129 406,133 406,124" style="fill:rgb(0,0,0)"/>
<path d="M348,159 L 356,159 Q 363,159 363,144 L 363,144 Q 363,129 378,129 L 396,129 L 411,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,144L545,144L545,114L417,114Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M481,182A15 15 0 0 0 496 166A15 15 0 0 0 481 151A15 15 0 0 0 466 166A15 15 0 0 0 481 182Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="166" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="496,166 508,162 508,171" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,151 Q 560,166 545,166 L 517,166 L 502,166"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M466,166 L 406,166 Q 391,166 391,151 L 391,144 Q 391,129 398,129 L 406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,129 287,133 287,124" style="fill:rgb(0,0,0)"/>
<path d="M208,129L293,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M299,129L406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,212L280,212A15 15 0 0 0 295 197A15 15 0 0 0 280 182L265,182A15 15 0 0 0 250 197A15 15 0 0 0 265 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="197" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="348,197 337,201 337,192" style="fill:rgb(0,0,0)"/>
<path d="M295,197L342,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,197 L 356,197 Q 363,197 363,182 L 363,159 L 363,144"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="250,197 238,201 238,192" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,182 Q 223,197 233,197 L 244,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,287L203,287A15 15 0 0 0 218 272A15 15 0 0 0 203 257L168,257A15 15 0 0 0 153 272A15 15 0 0 0 168 287Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="186" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="290,272 279,277 279,268" style="fill:rgb(0,0,0)"/>
<path d="M218,272L284,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,287L451,287L451,257L290,257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M320,362L422,362L422,331L320,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M371,324A15 15 0 0 0 386 309A15 15 0 0 0 371 293A15 15 0 0 0 356 309A15 15 0 0 0 371 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="386,309 397,304 397,313" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 459,272 Q 466,272 466,287 L 466,294 Q 466,309 451,309 L 407,309 L 392,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M356,309 L 279,309 Q 264,309 264,294 L 264,287 Q 264,272 271,272 L 279,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="320,346 308,351 308,342" style="fill:rgb(0,0,0)"/>
<path d="M218,272 L 226,272 Q 233,272 233,287 L 233,331 Q 233,346 248,346 L 299,346 L 314,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="484,313 488,325 480,325" style="fill:rgb(0,0,0)"/>
<path d="M422,346 L 436,346 Q 451,346 466,346 L 469,346 Q 484,346 484,333 L 484,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,272 494,277 494,268" style="fill:rgb(0,0,0)"/>
<path d="M484,313 L 484,287 Q 484,272 492,272 L 499,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,272 L 496,272 Q 487,272 487,272 Q 487,272 495,272 L 502,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,197 555,185 564,185" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,176 L 560,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,235 360,230 360,239" style="fill:rgb(0,0,0)"/>
<path d="M560,197 L 560,220 Q 560,235 545,235 L 369,235 L 354,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,272 142,277 142,268" style="fill:rgb(0,0,0)"/>
<path d="M348,235 L 142,235 Q 127,235 127,250 L 127,257 Q 127,272 137,272 L 147,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,437L218,437A15 15 0 0 0 233 422A15 15 0 0 0 218 407L168,407A15 15 0 0 0 153 422A15 15 0 0 0 168 437Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="256,422 244,426 244,418" style="fill:rgb(0,0,0)"/>
<path d="M233,422L250,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,437L305,437L305,407L256,407Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="517,324 513,312 521,312" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 502,272 Q 517,272 517,287 L 517,303 L 517,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,384 382,380 382,389" style="fill:rgb(0,0,0)"/>
<path d="M517,324 L 517,369 Q 517,384 502,384 L 391,384 L 376,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,422 142,426 142,418" style="fill:rgb(0,0,0)"/>
<path d="M371,384 L 142,384 Q 127,384 127,399 L 127,407 Q 127,422 137,422 L 147,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,324 122,312 131,312" style="fill:rgb(0,0,0)"/>
<path d="M127,257L127,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,324L127,407"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,535L212,535A15 15 0 0 0 227 520A15 15 0 0 0 212 505L168,505A15 15 0 0 0 153 520A15 15 0 0 0 168 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="250,520 238,525 238,516" style="fill:rgb(0,0,0)"/>
<path d="M227,520L244,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,535L269,535A15 15 0 0 0 284 520A15 15 0 0 0 269 505L265,505A15 15 0 0 0 250 520A15 15 0 0 0 265 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="320,520 309,525 309,516" style="fill:rgb(0,0,0)"/>
<path d="M284,520L314,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,535L369,535L369,505L320,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="452,520 441,525 441,516" style="fill:rgb(0,0,0)"/>
<path d="M369,520L446,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,535L520,535A15 15 0 0 0 535 520A15 15 0 0 0 520 505L467,505A15 15 0 0 0 452 520A15 15 0 0 0 467 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="558,520 546,525 546,516" style="fill:rgb(0,0,0)"/>
<path d="M535,520L552,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,535L607,535L607,505L558,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M345,573A15 15 0 0 0 360 558A15 15 0 0 0 345 543A15 15 0 0 0 330 558A15 15 0 0 0 345 573Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="558" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="360,558 371,554 371,562" style="fill:rgb(0,0,0)"/>
<path d="M369,520 L 377,520 Q 384,520 384,535 L 384,543 Q 384,558 375,558 L 366,558"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,558 L 309,558 Q 294,558 294,543 L 294,535 Q 294,520 301,520 L 309,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="514,551 503,555 503,546" style="fill:rgb(0,0,0)"/>
<path d="M411,520 L 418,520 Q 426,520 426,535 L 426,536 Q 426,551 441,551 L 493,551 L 508,551"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M514,551 L 607,551 Q 622,551 622,536 L 622,535 Q 622,520 630,520 L 637,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,490 256,494 256,486" style="fill:rgb(0,0,0)"/>
<path d="M127,460 L 127,475 Q 127,490 142,490 L 246,490 L 261,490"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,520 399,525 399,516" style="fill:rgb(0,0,0)"/>
<path d="M267,490 L 369,490 Q 384,490 384,505 L 384,505 Q 384,520 395,520 L 405,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,460 244,455 244,464" style="fill:rgb(0,0,0)"/>
<path d="M305,422 L 313,422 Q 320,422 320,437 L 320,445 Q 320,460 305,460 L 254,460 L 239,460"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,520 142,525 142,516" style="fill:rgb(0,0,0)"/>
<path d="M233,460 L 142,460 Q 127,460 127,475 L 127,505 Q 127,520 137,520 L 147,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,447 122,435 131,435" style="fill:rgb(0,0,0)"/>
<path d="M127,407L127,441"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,447L127,505"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,649L232,649A15 15 0 0 0 247 634A15 15 0 0 0 232 619L168,619A15 15 0 0 0 153 634A15 15 0 0 0 168 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="200" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="283,634 271,638 271,629" style="fill:rgb(0,0,0)"/>
<path d="M247,634L277,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,649L395,649A15 15 0 0 0 410 634A15 15 0 0 0 395 619L298,619A15 15 0 0 0 283 634A15 15 0 0 0 298 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="433,634 422,638 422,629" style="fill:rgb(0,0,0)"/>
<path d="M410,634L427,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,649L452,649A15 15 0 0 0 467 634A15 15 0 0 0 452 619L448,619A15 15 0 0 0 433 634A15 15 0 0 0 448 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="450" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="490,634 479,638 479,629" style="fill:rgb(0,0,0)"/>
<path d="M467,634L485,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,649L609,649L609,619L490,619Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="550" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M446,687A15 15 0 0 0 461 671A15 15 0 0 0 446 656A15 15 0 0 0 431 671A15 15 0 0 0 446 687Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="671" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="461,671 472,667 472,676" style="fill:rgb(0,0,0)"/>
<path d="M609,634 L 616,634 Q 624,634 624,649 L 624,656 Q 624,671 609,671 L 482,671 L 467,671"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,671 L 271,671 Q 256,671 256,656 L 256,649 Q 256,634 264,634 L 271,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="624,692 619,680 628,680" style="fill:rgb(0,0,0)"/>
<path d="M624,656L624,686"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,558 648,547 656,547" style="fill:rgb(0,0,0)"/>
<path d="M607,520 L 637,520 Q 652,520 652,535 L 652,537 L 652,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,596 382,592 382,600" style="fill:rgb(0,0,0)"/>
<path d="M652,558 L 652,581 Q 652,596 637,596 L 391,596 L 376,596"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,634 142,638 142,629" style="fill:rgb(0,0,0)"/>
<path d="M371,596 L 142,596 Q 127,596 127,611 L 127,619 Q 127,634 137,634 L 147,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,558 122,547 131,547" style="fill:rgb(0,0,0)"/>
<path d="M127,505L127,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,709 359,714 359,705" style="fill:rgb(0,0,0)"/>
<path d="M127,558 L 127,694 Q 127,709 142,709 L 350,709 L 365,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,709 597,714 597,705" style="fill:rgb(0,0,0)"/>
<path d="M371,709L603,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,709 L 616,709 Q 624,709 624,717 L 624,724"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,800L194,800A15 15 0 0 0 209 785A15 15 0 0 0 194 770L142,770A15 15 0 0 0 127 785A15 15 0 0 0 142 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="245,785 234,789 234,781" style="fill:rgb(0,0,0)"/>
<path d="M209,785L239,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,800A15 15 0 0 0 275 785A15 15 0 0 0 260 770A15 15 0 0 0 245 785A15 15 0 0 0 260 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="311,785 300,789 300,781" style="fill:rgb(0,0,0)"/>
<path d="M275,785L306,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,800L361,800L361,770L311,770Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="397,785 385,789 385,781" style="fill:rgb(0,0,0)"/>
<path d="M361,785L391,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,800A15 15 0 0 0 427 785A15 15 0 0 0 412 770A15 15 0 0 0 397 785A15 15 0 0 0 412 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="412" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="609,785 597,789 597,781" style="fill:rgb(0,0,0)"/>
<path d="M427,785L603,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,785 L 616,785 Q 624,785 624,792 L 624,800"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,762A15 15 0 0 0 351 747A15 15 0 0 0 336 732A15 15 0 0 0 321 747A15 15 0 0 0 336 762Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="747" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M336,838A15 15 0 0 0 351 823A15 15 0 0 0 336 808A15 15 0 0 0 321 823A15 15 0 0 0 336 838Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="823" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="351,747 363,743 363,751" style="fill:rgb(0,0,0)"/>
<path d="M361,785 L 368,785 Q 376,785 376,770 L 376,762 Q 376,747 366,747 L 357,747"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,747 L 300,747 Q 285,747 285,762 L 285,770 Q 285,785 292,785 L 300,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,823 363,818 363,827" style="fill:rgb(0,0,0)"/>
<path d="M427,785 L 434,785 Q 442,785 442,800 L 442,808 Q 442,823 427,823 L 372,823 L 357,823"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,823 L 234,823 Q 219,823 219,808 L 219,800 Q 219,785 226,785 L 234,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,785 115,789 115,781" style="fill:rgb(0,0,0)"/>
<path d="M55,129 L 62,129 Q 70,129 70,144 L 70,770 Q 70,785 85,785 L 106,785 L 121,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,891L424,891L424,860L248,860Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="876" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="424,876 436,871 436,880" style="fill:rgb(0,0,0)"/>
<path d="M624,692 L 624,861 Q 624,876 609,876 L 445,876 L 430,876"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="6,197 10,208 2,208" style="fill:rgb(0,0,0)"/>
<path d="M248,876 L 21,876 Q 6,876 6,861 L 6,217 L 6,202"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M6,197 L 6,144 Q 6,129 21,129 L 40,129 L 55,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="667" y="275" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" transform="rotate(-90 667,285)" dominant-baseline="central">select-core</text>
<path d="M168,966L213,966A15 15 0 0 0 228 951A15 15 0 0 0 213 936L168,936A15 15 0 0 0 153 951A15 15 0 0 0 168 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="251,951 239,956 239,947" style="fill:rgb(0,0,0)"/>
<path d="M228,951L245,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,966L270,966A15 15 0 0 0 285 951A15 15 0 0 0 270 936L266,936A15 15 0 0 0 251 951A15 15 0 0 0 266 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M168,1072L202,1072A15 15 0 0 0 217 1057A15 15 0 0 0 202 1042L168,1042A15 15 0 0 0 153 1057A15 15 0 0 0 168 1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="240,1057 228,1061 228,1053" style="fill:rgb(0,0,0)"/>
<path d="M217,1057L234,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,1072L289,1072L289,1042L240,1042Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="330,951 319,956 319,947" style="fill:rgb(0,0,0)"/>
<path d="M285,951L324,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,966L460,966L460,936L330,936Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M395,1004A15 15 0 0 0 410 989A15 15 0 0 0 395 974A15 15 0 0 0 380 989A15 15 0 0 0 395 1004Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="989" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="410,989 422,985 422,993" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 468,951 Q 475,951 475,966 L 475,974 Q 475,989 460,989 L 431,989 L 416,989"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,989 L 322,989 Q 307,989 307,974 L 307,966 Q 307,951 313,951 L 319,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,913 348,909 348,918" style="fill:rgb(0,0,0)"/>
<path d="M624,860 L 624,898 Q 624,913 609,913 L 357,913 L 342,913"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,951 142,956 142,947" style="fill:rgb(0,0,0)"/>
<path d="M336,913 L 142,913 Q 127,913 127,928 L 127,936 Q 127,951 137,951 L 147,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,981 492,970 500,970" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 481,951 Q 496,951 496,963 L 496,976"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,1023 318,1019 318,1027" style="fill:rgb(0,0,0)"/>
<path d="M496,981 L 496,1008 Q 496,1023 481,1023 L 327,1023 L 312,1023"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,1057 142,1061 142,1053" style="fill:rgb(0,0,0)"/>
<path d="M307,1023 L 142,1023 Q 127,1023 127,1038 L 127,1042 Q 127,1057 137,1057 L 147,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,989 122,978 131,978" style="fill:rgb(0,0,0)"/>
<path d="M127,936L127,983"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,989L127,1042"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1102L415,1102A15 15 0 0 0 430 1087A15 15 0 0 0 415 1072L363,1072A15 15 0 0 0 348 1087A15 15 0 0 0 363 1102Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="389" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="453,1087 441,1092 441,1083" style="fill:rgb(0,0,0)"/>
<path d="M430,1087L447,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,1102L502,1102L502,1072L453,1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="525,1087 513,1092 513,1083" style="fill:rgb(0,0,0)"/>
<path d="M502,1087L519,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1140A15 15 0 0 0 378 1125A15 15 0 0 0 363 1110A15 15 0 0 0 348 1125A15 15 0 0 0 363 1140Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="1125" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="401,1125 390,1129 390,1121" style="fill:rgb(0,0,0)"/>
<path d="M378,1125L396,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,1140L451,1140L451,1110L401,1110Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="1125" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="312,1057 301,1061 301,1053" style="fill:rgb(0,0,0)"/>
<path d="M289,1057L306,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1125 337,1129 337,1121" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1110 Q 327,1125 335,1125 L 342,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1087 337,1092 337,1083" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1072 Q 327,1087 335,1087 L 342,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1057 513,1061 513,1053" style="fill:rgb(0,0,0)"/>
<path d="M312,1057L519,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="620,1155 609,1160 609,1151" style="fill:rgb(0,0,0)"/>
<path d="M525,1057 L 546,1057 Q 561,1057 561,1072 L 561,1140 Q 561,1155 576,1155 L 599,1155 L 614,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="624" cy="1155" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1087 L 546,1087 Q 561,1087 561,1095 L 561,1102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1125 513,1129 513,1121" style="fill:rgb(0,0,0)"/>
<path d="M451,1125L519,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1125 L 546,1125 Q 561,1125 561,1133 L 561,1140"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1155 513,1160 513,1151" style="fill:rgb(0,0,0)"/>
<path d="M127,1042 L 127,1140 Q 127,1155 142,1155 L 504,1155 L 519,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1155L597,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/compound-operator.html">compound-operator:</a></b>
<button id='x585ddd44' onclick='hideorshow("x585ddd44","xdbd5cf51")'>show</button></p>
 <div id='xdbd5cf51' style='display:none;' class='imgcontainer'>
 <div style="max-width:293px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 293.842 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L127,32A15 15 0 0 0 142 17A15 15 0 0 0 127 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,70L127,70A15 15 0 0 0 142 55L142,55A15 15 0 0 0 127 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,108L168,108A15 15 0 0 0 183 92A15 15 0 0 0 168 77L83,77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M83,145L135,145A15 15 0 0 0 150 130A15 15 0 0 0 135 115L83,115A15 15 0 0 0 68 130A15 15 0 0 0 83 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M142,55L159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70L195,70A15 15 0 0 0 210 55L210,55A15 15 0 0 0 195 39L180,39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="233,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M210,55L227,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,17 272,21 272,12" style="fill:rgb(0,0,0)"/>
<path d="M233,55 L 240,55 Q 248,55 248,40 L 248,32 Q 248,17 263,17 L 263,17 L 278,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="288" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M47,39 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,92 221,97 221,88" style="fill:rgb(0,0,0)"/>
<path d="M183,92L227,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,92 L 240,92 Q 248,92 248,77 L 248,54 L 248,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,130 56,135 56,126" style="fill:rgb(0,0,0)"/>
<path d="M47,77 L 47,115 Q 47,130 55,130 L 62,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,130 221,135 221,126" style="fill:rgb(0,0,0)"/>
<path d="M150,130L227,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,130 L 240,130 Q 248,130 248,115 L 248,92 L 248,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='xa0dbe6fa' onclick='hideorshow("xa0dbe6fa","xae40d4d9")'>show</button></p>
 <div id='xae40d4d9' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/result-column.html">result-column:</a></b>
<button id='xe8e7677c' onclick='hideorshow("xe8e7677c","x826b8d31")'>show</button></p>
 <div id='x826b8d31' style='display:none;' class='imgcontainer'>
 <div style="max-width:398px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 398.054 163.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L94,32L94,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="136,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M94,17 L 102,17 Q 109,17 109,32 L 109,40 Q 109,55 119,55 L 130,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M151,70L155,70A15 15 0 0 0 170 55L170,55A15 15 0 0 0 155 39L151,39A15 15 0 0 0 136 55L136,55A15 15 0 0 0 151 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="206,55 194,59 194,50" style="fill:rgb(0,0,0)"/>
<path d="M170,55L200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,70L309,70A15 15 0 0 0 324 55L324,55A15 15 0 0 0 309 39L221,39A15 15 0 0 0 206 55L206,55A15 15 0 0 0 221 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="347,55 335,59 335,50" style="fill:rgb(0,0,0)"/>
<path d="M324,55L341,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,17 377,21 377,12" style="fill:rgb(0,0,0)"/>
<path d="M347,55 L 354,55 Q 362,55 362,40 L 362,32 Q 362,17 372,17 L 382,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="392" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,85 141,89 141,81" style="fill:rgb(0,0,0)"/>
<path d="M109,39 L 109,70 Q 109,85 124,85 L 132,85 L 147,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,85 L 170,85 Q 185,85 185,70 L 185,70 Q 185,55 192,55 L 200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="241,17 230,21 230,12" style="fill:rgb(0,0,0)"/>
<path d="M94,17L235,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M241,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,108 39,112 39,103" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,93 Q 24,108 34,108 L 45,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,123A15 15 0 0 0 81 108A15 15 0 0 0 66 92A15 15 0 0 0 50 108A15 15 0 0 0 66 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="108" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,108 335,112 335,103" style="fill:rgb(0,0,0)"/>
<path d="M81,108L341,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,108 L 354,108 Q 362,108 362,93 L 362,54 L 362,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,145 39,150 39,141" style="fill:rgb(0,0,0)"/>
<path d="M24,92 L 24,130 Q 24,145 34,145 L 45,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,160L141,160A15 15 0 0 0 156 145A15 15 0 0 0 141 130L66,130A15 15 0 0 0 50 145A15 15 0 0 0 66 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="145" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="179,145 167,150 167,141" style="fill:rgb(0,0,0)"/>
<path d="M156,145L173,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M194,160A15 15 0 0 0 209 145A15 15 0 0 0 194 130A15 15 0 0 0 179 145A15 15 0 0 0 194 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="232,145 221,150 221,141" style="fill:rgb(0,0,0)"/>
<path d="M209,145L226,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,160A15 15 0 0 0 262 145A15 15 0 0 0 247 130A15 15 0 0 0 232 145A15 15 0 0 0 247 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,145 335,150 335,141" style="fill:rgb(0,0,0)"/>
<path d="M262,145L341,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,145 L 354,145 Q 362,145 362,130 L 362,107 L 362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/window-defn.html">window-defn:</a></b>
<button id='x4bc2695a' onclick='hideorshow("x4bc2695a","x84a20746")'>show</button></p>
 <div id='x84a20746' style='display:none;' class='imgcontainer'>
 <div style="max-width:479px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 479.765 380.592">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,44 92,48 92,40" style="fill:rgb(0,0,0)"/>
<path d="M62,17 L 70,17 Q 77,17 77,30 Q 77,44 88,44 L 98,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,59L260,59A15 15 0 0 0 275 44L275,44A15 15 0 0 0 260 29L119,29A15 15 0 0 0 104 44L104,44A15 15 0 0 0 119 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M119,135L198,135A15 15 0 0 0 214 120A15 15 0 0 0 198 104L119,104A15 15 0 0 0 104 120A15 15 0 0 0 119 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="237,120 225,124 225,115" style="fill:rgb(0,0,0)"/>
<path d="M214,120L231,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M252,135L256,135A15 15 0 0 0 271 120A15 15 0 0 0 256 104L252,104A15 15 0 0 0 237 120A15 15 0 0 0 252 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="307,120 295,124 295,115" style="fill:rgb(0,0,0)"/>
<path d="M271,120L301,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,135L356,135L356,104L307,104Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M332,173A15 15 0 0 0 347 157A15 15 0 0 0 332 142A15 15 0 0 0 316 157A15 15 0 0 0 332 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="157" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="347,157 358,153 358,162" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,142 Q 371,157 362,157 L 352,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,157 L 295,157 Q 280,157 280,142 L 280,135 Q 280,120 288,120 L 295,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,17 178,21 178,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L184,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,82 201,77 201,86" style="fill:rgb(0,0,0)"/>
<path d="M190,17 L 298,17 Q 313,17 313,32 L 313,67 Q 313,82 298,82 L 210,82 L 195,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,120 92,124 92,115" style="fill:rgb(0,0,0)"/>
<path d="M190,82 L 77,82 Q 62,82 62,97 L 62,105 Q 62,120 77,120 L 83,120 L 98,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,44 287,48 287,40" style="fill:rgb(0,0,0)"/>
<path d="M275,44L293,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,44 L 306,44 Q 313,44 313,51 L 313,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,248L163,248A15 15 0 0 0 178 233A15 15 0 0 0 163 218L119,218A15 15 0 0 0 104 233A15 15 0 0 0 119 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="201,233 190,237 190,229" style="fill:rgb(0,0,0)"/>
<path d="M178,233L196,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,248L221,248A15 15 0 0 0 236 233A15 15 0 0 0 221 218L217,218A15 15 0 0 0 201 233A15 15 0 0 0 217 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="272,233 260,237 260,229" style="fill:rgb(0,0,0)"/>
<path d="M236,233L266,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,248L402,248L402,218L272,218Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M337,286A15 15 0 0 0 352 271A15 15 0 0 0 337 256A15 15 0 0 0 322 271A15 15 0 0 0 337 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="352,271 363,266 363,275" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,256 Q 417,271 402,271 L 373,271 L 358,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M322,271 L 260,271 Q 245,271 245,256 L 245,248 Q 245,233 253,233 L 260,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,195 201,191 201,200" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,180 Q 371,195 356,195 L 210,195 L 195,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,233 92,237 92,229" style="fill:rgb(0,0,0)"/>
<path d="M190,195 L 77,195 Q 62,195 62,210 L 62,218 Q 62,233 77,233 L 83,233 L 98,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,157 58,146 66,146" style="fill:rgb(0,0,0)"/>
<path d="M62,104L62,152"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,157L62,218"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,362L208,362L208,331L104,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="417,346 405,351 405,342" style="fill:rgb(0,0,0)"/>
<path d="M208,346L411,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,362A15 15 0 0 0 447 346A15 15 0 0 0 432 331A15 15 0 0 0 417 346A15 15 0 0 0 432 362Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="470,346 458,351 458,342" style="fill:rgb(0,0,0)"/>
<path d="M447,346L464,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="474" cy="346" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,309 201,304 201,313" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,294 Q 417,309 402,309 L 210,309 L 195,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,346 92,351 92,342" style="fill:rgb(0,0,0)"/>
<path d="M190,309 L 77,309 Q 62,309 62,324 L 62,331 Q 62,346 77,346 L 83,346 L 98,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,271 58,259 66,259" style="fill:rgb(0,0,0)"/>
<path d="M62,218L62,265"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,271L62,331"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,374 144,378 144,369" style="fill:rgb(0,0,0)"/>
<path d="M62,331 L 62,359 Q 62,374 77,374 L 135,374 L 150,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,346 266,351 266,342" style="fill:rgb(0,0,0)"/>
<path d="M156,374 L 233,374 Q 248,374 248,360 Q 248,346 260,346 L 272,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x1e96593c' onclick='hideorshow("x1e96593c","xf66e991d")'>show</button></p>
 <div id='xf66e991d' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/expr.html">expr:</a></b>
<button id='x8595b57d' onclick='hideorshow("x8595b57d","xf03bfa69")'>show</button></p>
 <div id='xf03bfa69' style='display:none;' class='imgcontainer'>
 <div style="max-width:963px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 963.96 1068.77">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L158,32L158,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="101" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="954,17 943,21 943,12" style="fill:rgb(0,0,0)"/>
<path d="M158,17L948,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="958" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L172,70A15 15 0 0 0 187 55L187,55A15 15 0 0 0 172 39L60,39A15 15 0 0 0 45 55L45,55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">bind-parameter</text>
<polygon points="916,55 905,59 905,50" style="fill:rgb(0,0,0)"/>
<path d="M187,55L910,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,55 L 924,55 Q 931,55 931,47 L 931,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 31,55 L 39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,130L156,130A15 15 0 0 0 171 115A15 15 0 0 0 156 100L60,100A15 15 0 0 0 45 115A15 15 0 0 0 60 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,115 183,119 183,111" style="fill:rgb(0,0,0)"/>
<path d="M171,115L189,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,130A15 15 0 0 0 225 115A15 15 0 0 0 210 100A15 15 0 0 0 195 115A15 15 0 0 0 210 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M225,115L255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130L351,130A15 15 0 0 0 366 115A15 15 0 0 0 351 100L276,100A15 15 0 0 0 261 115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="389,115 378,119 378,111" style="fill:rgb(0,0,0)"/>
<path d="M366,115L383,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,130A15 15 0 0 0 419 115A15 15 0 0 0 404 100A15 15 0 0 0 389 115A15 15 0 0 0 404 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="404" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="455,115 444,119 444,111" style="fill:rgb(0,0,0)"/>
<path d="M419,115L450,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,130L565,130A15 15 0 0 0 580 115A15 15 0 0 0 565 100L471,100A15 15 0 0 0 455 115A15 15 0 0 0 471 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="916,115 905,119 905,111" style="fill:rgb(0,0,0)"/>
<path d="M580,115L910,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,115 L 924,115 Q 931,115 931,108 L 931,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,115 33,119 33,111" style="fill:rgb(0,0,0)"/>
<path d="M24,100 L 24,108 Q 24,115 31,115 L 39,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,89 97,93 97,84" style="fill:rgb(0,0,0)"/>
<path d="M24,74 L 24,81 Q 24,89 39,89 L 87,89 L 102,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 302,93 302,84" style="fill:rgb(0,0,0)"/>
<path d="M108,89 L 129,89 Q 144,89 159,89 L 293,89 L 308,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,89 L 414,89 Q 429,89 429,102 Q 429,115 436,115 L 444,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M223,89 L 230,89 Q 238,89 238,102 Q 238,115 245,115 L 253,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,168L168,168A15 15 0 0 0 183 153A15 15 0 0 0 168 138L60,138A15 15 0 0 0 45 153A15 15 0 0 0 60 168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">unary-operator</text>
<polygon points="206,153 194,157 194,149" style="fill:rgb(0,0,0)"/>
<path d="M183,153L200,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,168L255,168L255,138L206,138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,153 905,157 905,149" style="fill:rgb(0,0,0)"/>
<path d="M255,153L910,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,153 L 924,153 Q 931,153 931,145 L 931,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,153 33,157 33,149" style="fill:rgb(0,0,0)"/>
<path d="M24,138 L 24,145 Q 24,153 31,153 L 39,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,206L94,206L94,176L45,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,191 106,195 106,186" style="fill:rgb(0,0,0)"/>
<path d="M94,191L111,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,206L245,206A15 15 0 0 0 261 191A15 15 0 0 0 245 176L132,176A15 15 0 0 0 117 191A15 15 0 0 0 132 206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">binary-operator</text>
<polygon points="284,191 272,195 272,186" style="fill:rgb(0,0,0)"/>
<path d="M261,191L278,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,206L333,206L333,176L284,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="308" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,191 905,195 905,186" style="fill:rgb(0,0,0)"/>
<path d="M333,191L910,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,191 L 924,191 Q 931,191 931,183 L 931,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,191 33,195 33,186" style="fill:rgb(0,0,0)"/>
<path d="M24,176 L 24,183 Q 24,191 31,191 L 39,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,245L162,245A15 15 0 0 0 177 230A15 15 0 0 0 162 215L60,215A15 15 0 0 0 45 230A15 15 0 0 0 60 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="111" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-name</text>
<polygon points="194,230 183,234 183,226" style="fill:rgb(0,0,0)"/>
<path d="M177,230L188,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,245A15 15 0 0 0 224 230A15 15 0 0 0 209 215A15 15 0 0 0 194 230A15 15 0 0 0 209 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="260,230 249,234 249,226" style="fill:rgb(0,0,0)"/>
<path d="M224,230L255,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,245L437,245L437,215L260,215Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-arguments</text>
<polygon points="473,230 461,234 461,226" style="fill:rgb(0,0,0)"/>
<path d="M437,230L467,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,245A15 15 0 0 0 503 230A15 15 0 0 0 488 215A15 15 0 0 0 473 230A15 15 0 0 0 488 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="541,260 529,265 529,256" style="fill:rgb(0,0,0)"/>
<path d="M503,230 L 510,230 Q 518,230 518,245 L 518,245 Q 518,260 527,260 L 535,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,275L653,275L653,245L541,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="691,230 680,234 680,226" style="fill:rgb(0,0,0)"/>
<path d="M653,260 L 661,260 Q 668,260 668,245 L 668,245 Q 668,230 677,230 L 685,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="729,260 718,265 718,256" style="fill:rgb(0,0,0)"/>
<path d="M691,230 L 699,230 Q 706,230 706,245 L 706,245 Q 706,260 715,260 L 723,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,275L837,275L837,245L729,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="783" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">over-clause</text>
<polygon points="916,260 905,265 905,256" style="fill:rgb(0,0,0)"/>
<path d="M837,260L910,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,260 L 924,260 Q 931,260 931,253 L 931,245"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,230 33,234 33,226" style="fill:rgb(0,0,0)"/>
<path d="M24,215 L 24,222 Q 24,230 31,230 L 39,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,230 585,234 585,226" style="fill:rgb(0,0,0)"/>
<path d="M503,230L591,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,230L680,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,230 905,234 905,226" style="fill:rgb(0,0,0)"/>
<path d="M691,230L910,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,230 L 924,230 Q 931,230 931,222 L 931,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,321A15 15 0 0 0 75 306A15 15 0 0 0 60 290A15 15 0 0 0 45 306A15 15 0 0 0 60 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,306 100,310 100,301" style="fill:rgb(0,0,0)"/>
<path d="M75,306L105,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M111,321L160,321L160,290L111,290Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="306" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="196,306 185,310 185,301" style="fill:rgb(0,0,0)"/>
<path d="M160,306L191,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,321A15 15 0 0 0 227 306A15 15 0 0 0 211 290A15 15 0 0 0 196 306A15 15 0 0 0 211 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,306 905,310 905,301" style="fill:rgb(0,0,0)"/>
<path d="M227,306L910,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,306 L 924,306 Q 931,306 931,298 L 931,291"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,306 33,310 33,301" style="fill:rgb(0,0,0)"/>
<path d="M24,290 L 24,298 Q 24,306 31,306 L 39,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,284A15 15 0 0 0 151 269A15 15 0 0 0 136 254A15 15 0 0 0 121 269A15 15 0 0 0 136 284Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="269" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="151,269 162,265 162,274" style="fill:rgb(0,0,0)"/>
<path d="M160,306 L 168,306 Q 175,306 175,291 L 175,284 Q 175,269 166,269 L 157,269"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,269 L 103,269 Q 88,269 88,284 L 88,291 Q 88,306 96,306 L 103,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,358L88,358A15 15 0 0 0 103 343A15 15 0 0 0 88 328L60,328A15 15 0 0 0 45 343A15 15 0 0 0 60 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CAST</text>
<polygon points="126,343 114,348 114,339" style="fill:rgb(0,0,0)"/>
<path d="M103,343L120,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M141,358A15 15 0 0 0 156 343A15 15 0 0 0 141 328A15 15 0 0 0 126 343A15 15 0 0 0 141 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="179,343 168,348 168,339" style="fill:rgb(0,0,0)"/>
<path d="M156,343L173,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,358L228,358L228,328L179,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="251,343 240,348 240,339" style="fill:rgb(0,0,0)"/>
<path d="M228,343L246,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,358L271,358A15 15 0 0 0 286 343A15 15 0 0 0 271 328L267,328A15 15 0 0 0 251 343A15 15 0 0 0 267 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="269" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="309,343 297,348 297,339" style="fill:rgb(0,0,0)"/>
<path d="M286,343L303,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,358L408,358L408,328L309,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="358" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="431,343 419,348 419,339" style="fill:rgb(0,0,0)"/>
<path d="M408,343L425,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M446,358A15 15 0 0 0 461 343A15 15 0 0 0 446 328A15 15 0 0 0 431 343A15 15 0 0 0 446 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,343 905,348 905,339" style="fill:rgb(0,0,0)"/>
<path d="M461,343L910,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,343 L 924,343 Q 931,343 931,336 L 931,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,343 33,348 33,339" style="fill:rgb(0,0,0)"/>
<path d="M24,328 L 24,336 Q 24,343 31,343 L 39,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,396L94,396L94,366L45,366Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,381 106,385 106,377" style="fill:rgb(0,0,0)"/>
<path d="M94,381L111,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,396L196,396A15 15 0 0 0 211 381A15 15 0 0 0 196 366L132,366A15 15 0 0 0 117 381A15 15 0 0 0 132 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="234,381 223,385 223,377" style="fill:rgb(0,0,0)"/>
<path d="M211,381L229,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,396L355,396A15 15 0 0 0 370 381A15 15 0 0 0 355 366L250,366A15 15 0 0 0 234 381A15 15 0 0 0 250 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="916,381 905,385 905,377" style="fill:rgb(0,0,0)"/>
<path d="M370,381L910,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,381 L 924,381 Q 931,381 931,374 L 931,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,381 33,385 33,377" style="fill:rgb(0,0,0)"/>
<path d="M24,366 L 24,374 Q 24,381 31,381 L 39,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,434L94,434L94,404L45,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,419 119,423 119,415" style="fill:rgb(0,0,0)"/>
<path d="M94,419L124,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,434L165,434A15 15 0 0 0 180 419A15 15 0 0 0 165 404L145,404A15 15 0 0 0 130 419A15 15 0 0 0 145 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="234,419 223,423 223,415" style="fill:rgb(0,0,0)"/>
<path d="M180,419L229,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,434L273,434A15 15 0 0 0 288 419A15 15 0 0 0 273 404L250,404A15 15 0 0 0 234 419A15 15 0 0 0 250 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIKE</text>
<path d="M250,472L279,472A15 15 0 0 0 294 457A15 15 0 0 0 279 442L250,442A15 15 0 0 0 234 457A15 15 0 0 0 250 472Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="457" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GLOB</text>
<path d="M250,510L302,510A15 15 0 0 0 317 495A15 15 0 0 0 302 479L250,479A15 15 0 0 0 234 495A15 15 0 0 0 250 510Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REGEXP</text>
<path d="M250,547L297,547A15 15 0 0 0 313 532A15 15 0 0 0 297 517L250,517A15 15 0 0 0 234 532A15 15 0 0 0 250 547Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="274" y="532" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<path d="M378,510L427,510L427,479L378,479Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M378,434L427,434L427,404L378,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="465,449 454,454 454,445" style="fill:rgb(0,0,0)"/>
<path d="M427,419 L 435,419 Q 442,419 442,434 L 442,434 Q 442,449 451,449 L 460,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,464L532,464A15 15 0 0 0 547 449A15 15 0 0 0 532 434L480,434A15 15 0 0 0 465 449A15 15 0 0 0 480 464Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="506" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ESCAPE</text>
<polygon points="570,449 559,454 559,445" style="fill:rgb(0,0,0)"/>
<path d="M547,449L565,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M570,464L620,464L620,434L570,434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="595" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="671,419 659,423 659,415" style="fill:rgb(0,0,0)"/>
<path d="M620,449 L 627,449 Q 635,449 635,434 L 635,434 Q 635,419 650,419 L 650,419 L 665,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,419 905,423 905,415" style="fill:rgb(0,0,0)"/>
<path d="M671,419L910,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,419 L 924,419 Q 931,419 931,411 L 931,404"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,419 33,423 33,415" style="fill:rgb(0,0,0)"/>
<path d="M24,404 L 24,411 Q 24,419 31,419 L 39,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M100,419 L 108,419 Q 115,419 115,434 L 115,434 Q 115,449 130,449 L 177,449 Q 192,449 192,434 L 192,434 Q 192,419 199,419 L 207,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,532 223,537 223,528" style="fill:rgb(0,0,0)"/>
<path d="M196,419 L 204,419 Q 211,419 211,434 L 211,517 Q 211,532 220,532 L 229,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,457 223,461 223,452" style="fill:rgb(0,0,0)"/>
<path d="M211,442 L 211,449 Q 211,457 220,457 L 229,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,495 223,499 223,490" style="fill:rgb(0,0,0)"/>
<path d="M211,479 L 211,487 Q 211,495 220,495 L 229,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,419 367,423 367,415" style="fill:rgb(0,0,0)"/>
<path d="M288,419L372,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,532 329,537 329,528" style="fill:rgb(0,0,0)"/>
<path d="M313,532L334,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,495 367,499 367,490" style="fill:rgb(0,0,0)"/>
<path d="M340,532 L 348,532 Q 355,532 355,517 L 355,510 Q 355,495 364,495 L 372,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,495 329,499 329,490" style="fill:rgb(0,0,0)"/>
<path d="M317,495L334,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,495L378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,457 329,461 329,452" style="fill:rgb(0,0,0)"/>
<path d="M294,457L334,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,457 L 348,457 Q 355,457 355,472 L 355,480 Q 355,495 367,495 L 378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="506,419 495,423 495,415" style="fill:rgb(0,0,0)"/>
<path d="M427,419L501,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M506,419L659,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="547,495 536,499 536,490" style="fill:rgb(0,0,0)"/>
<path d="M427,495L542,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,495 L 656,495 Q 671,495 671,480 L 671,434 Q 671,419 686,419 L 692,419 L 707,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,585L94,585L94,555L45,555Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,570 119,574 119,566" style="fill:rgb(0,0,0)"/>
<path d="M94,570L124,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,585L194,585A15 15 0 0 0 209 570A15 15 0 0 0 194 555L145,555A15 15 0 0 0 130 570A15 15 0 0 0 145 585Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="170" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ISNULL</text>
<polygon points="916,570 905,574 905,566" style="fill:rgb(0,0,0)"/>
<path d="M209,570L910,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,570 L 924,570 Q 931,570 931,563 L 931,555"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,570 33,574 33,566" style="fill:rgb(0,0,0)"/>
<path d="M24,555 L 24,563 Q 24,570 31,570 L 39,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,623L215,623A15 15 0 0 0 230 608A15 15 0 0 0 215 593L145,593A15 15 0 0 0 130 608A15 15 0 0 0 145 623Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="608" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTNULL</text>
<path d="M145,661L165,661A15 15 0 0 0 180 646A15 15 0 0 0 165 631L145,631A15 15 0 0 0 130 646A15 15 0 0 0 145 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="203,646 192,650 192,641" style="fill:rgb(0,0,0)"/>
<path d="M180,646L198,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,661L250,661A15 15 0 0 0 265 646A15 15 0 0 0 250 631L219,631A15 15 0 0 0 203 646A15 15 0 0 0 219 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="288,646 276,650 276,641" style="fill:rgb(0,0,0)"/>
<path d="M265,646L282,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="339,570 327,574 327,566" style="fill:rgb(0,0,0)"/>
<path d="M288,646 L 295,646 Q 303,646 303,631 L 303,585 Q 303,570 318,570 L 318,570 L 333,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="288,608 276,612 276,604" style="fill:rgb(0,0,0)"/>
<path d="M230,608L282,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,608 L 295,608 Q 303,608 303,600 L 303,593"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,646 119,650 119,641" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,631 Q 109,646 117,646 L 124,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,608 119,612 119,604" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,593 Q 109,608 117,608 L 124,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,699L94,699L94,668L45,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,684 106,688 106,679" style="fill:rgb(0,0,0)"/>
<path d="M94,684L111,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,699A15 15 0 0 0 147 684A15 15 0 0 0 132 668A15 15 0 0 0 117 684A15 15 0 0 0 132 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IS</text>
<polygon points="183,684 172,688 172,679" style="fill:rgb(0,0,0)"/>
<path d="M147,684L178,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M198,699L219,699A15 15 0 0 0 234 684A15 15 0 0 0 219 668L198,668A15 15 0 0 0 183 684A15 15 0 0 0 198 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="270,684 258,688 258,679" style="fill:rgb(0,0,0)"/>
<path d="M234,684L264,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="306,684 294,688 294,679" style="fill:rgb(0,0,0)"/>
<path d="M270,684L300,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,699L389,699A15 15 0 0 0 404 684A15 15 0 0 0 389 668L321,668A15 15 0 0 0 306 684A15 15 0 0 0 321 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="440,684 429,688 429,679" style="fill:rgb(0,0,0)"/>
<path d="M404,684L434,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,699L490,699A15 15 0 0 0 505 684A15 15 0 0 0 490 668L455,668A15 15 0 0 0 440 684A15 15 0 0 0 455 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="541,684 530,688 530,679" style="fill:rgb(0,0,0)"/>
<path d="M505,684L535,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,699L590,699L590,668L541,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,684 905,688 905,679" style="fill:rgb(0,0,0)"/>
<path d="M590,684L910,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,684 L 924,684 Q 931,684 931,676 L 931,669"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,684 33,688 33,679" style="fill:rgb(0,0,0)"/>
<path d="M24,668 L 24,676 Q 24,684 31,684 L 39,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,684 L 156,684 Q 164,684 164,696 Q 164,708 179,708 L 230,708 Q 245,708 245,696 Q 245,684 253,684 L 260,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,684 L 279,684 Q 286,684 286,696 Q 286,708 301,708 L 502,708 Q 517,708 517,696 Q 517,684 524,684 L 532,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,744L94,744L94,714L45,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,729 119,733 119,725" style="fill:rgb(0,0,0)"/>
<path d="M94,729L124,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,744L165,744A15 15 0 0 0 180 729A15 15 0 0 0 165 714L145,714A15 15 0 0 0 130 729A15 15 0 0 0 145 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,729 205,733 205,725" style="fill:rgb(0,0,0)"/>
<path d="M180,729L211,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,744L304,744A15 15 0 0 0 319 729A15 15 0 0 0 304 714L232,714A15 15 0 0 0 216 729A15 15 0 0 0 232 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="342,729 331,733 331,725" style="fill:rgb(0,0,0)"/>
<path d="M319,729L336,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M342,744L391,744L391,714L342,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="367" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="414,729 403,733 403,725" style="fill:rgb(0,0,0)"/>
<path d="M391,729L409,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M430,744L450,744A15 15 0 0 0 465 729A15 15 0 0 0 450 714L430,714A15 15 0 0 0 414 729A15 15 0 0 0 430 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="488,729 477,733 477,725" style="fill:rgb(0,0,0)"/>
<path d="M465,729L483,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,744L538,744L538,714L488,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="513" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,729 905,733 905,725" style="fill:rgb(0,0,0)"/>
<path d="M538,729L910,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,729 L 924,729 Q 931,729 931,721 L 931,714"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,729 33,733 33,725" style="fill:rgb(0,0,0)"/>
<path d="M24,714 L 24,721 Q 24,729 31,729 L 39,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,729 L 103,729 Q 110,729 110,741 Q 110,753 125,753 L 177,753 Q 192,753 192,741 Q 192,729 199,729 L 207,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,797L94,797L94,767L45,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,782 119,786 119,778" style="fill:rgb(0,0,0)"/>
<path d="M94,782L124,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,797L165,797A15 15 0 0 0 180 782A15 15 0 0 0 165 767L145,767A15 15 0 0 0 130 782A15 15 0 0 0 145 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,782 205,786 205,778" style="fill:rgb(0,0,0)"/>
<path d="M180,782L211,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,797L234,797A15 15 0 0 0 249 782A15 15 0 0 0 234 767L232,767A15 15 0 0 0 216 782A15 15 0 0 0 232 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IN</text>
<polygon points="285,782 273,786 273,778" style="fill:rgb(0,0,0)"/>
<path d="M249,782L279,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,797A15 15 0 0 0 315 782A15 15 0 0 0 300 767A15 15 0 0 0 285 782A15 15 0 0 0 300 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,782 340,786 340,778" style="fill:rgb(0,0,0)"/>
<path d="M315,782L345,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,797L455,797L455,767L351,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="491,782 480,786 480,778" style="fill:rgb(0,0,0)"/>
<path d="M455,782L486,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M507,797A15 15 0 0 0 522 782A15 15 0 0 0 507 767A15 15 0 0 0 491 782A15 15 0 0 0 507 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="507" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,782 905,786 905,778" style="fill:rgb(0,0,0)"/>
<path d="M522,782L910,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,782 L 924,782 Q 931,782 931,774 L 931,767"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,782 33,786 33,778" style="fill:rgb(0,0,0)"/>
<path d="M24,767 L 24,774 Q 24,782 31,782 L 39,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,782 L 103,782 Q 110,782 110,794 Q 110,806 125,806 L 177,806 Q 192,806 192,794 Q 192,782 199,782 L 207,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,782 L 324,782 Q 332,782 332,770 Q 332,758 347,758 L 452,758 Q 467,758 467,770 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M379,835L428,835L428,805L379,805Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="820" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="379,820 367,824 367,815" style="fill:rgb(0,0,0)"/>
<path d="M317,782 L 324,782 Q 332,782 332,797 L 332,805 Q 332,820 347,820 L 358,820 L 373,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M428,820 L 452,820 Q 467,820 467,805 L 467,797 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,873A15 15 0 0 0 418 857A15 15 0 0 0 403 842A15 15 0 0 0 388 857A15 15 0 0 0 403 873Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="857" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,857 430,853 430,862" style="fill:rgb(0,0,0)"/>
<path d="M428,820 L 435,820 Q 443,820 443,835 L 443,842 Q 443,857 434,857 L 424,857"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,857 L 371,857 Q 356,857 356,842 L 356,835 Q 356,820 363,820 L 371,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,925L396,925A15 15 0 0 0 412 910A15 15 0 0 0 396 895L300,895A15 15 0 0 0 285 910A15 15 0 0 0 300 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="429,910 417,915 417,906" style="fill:rgb(0,0,0)"/>
<path d="M412,910L423,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,925A15 15 0 0 0 459 910A15 15 0 0 0 444 895A15 15 0 0 0 429 910A15 15 0 0 0 444 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="513,910 502,915 502,906" style="fill:rgb(0,0,0)"/>
<path d="M459,910L507,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,925L627,925A15 15 0 0 0 642 910A15 15 0 0 0 627 895L528,895A15 15 0 0 0 513 910A15 15 0 0 0 528 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="577" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function</text>
<polygon points="659,910 647,915 647,906" style="fill:rgb(0,0,0)"/>
<path d="M642,910L653,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,925A15 15 0 0 0 689 910A15 15 0 0 0 674 895A15 15 0 0 0 659 910A15 15 0 0 0 674 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="734,910 723,915 723,906" style="fill:rgb(0,0,0)"/>
<path d="M689,910L728,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,925L783,925L783,895L734,895Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="828,910 817,915 817,906" style="fill:rgb(0,0,0)"/>
<path d="M783,910L823,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M844,925A15 15 0 0 0 859 910A15 15 0 0 0 844 895A15 15 0 0 0 828 910A15 15 0 0 0 844 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="844" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,910 905,915 905,906" style="fill:rgb(0,0,0)"/>
<path d="M859,910L910,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,910 L 924,910 Q 931,910 931,903 L 931,895"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,865L603,865A15 15 0 0 0 619 850A15 15 0 0 0 603 835L528,835A15 15 0 0 0 513 850A15 15 0 0 0 528 865Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="850" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="916,850 905,854 905,846" style="fill:rgb(0,0,0)"/>
<path d="M619,850L910,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,850 L 924,850 Q 931,850 931,842 L 931,835"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="513,850 502,854 502,846" style="fill:rgb(0,0,0)"/>
<path d="M475,910 L 483,910 Q 490,910 490,895 L 490,865 Q 490,850 499,850 L 507,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,892A15 15 0 0 0 774 877A15 15 0 0 0 759 862A15 15 0 0 0 744 877A15 15 0 0 0 759 892Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="877" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="774,877 785,873 785,881" style="fill:rgb(0,0,0)"/>
<path d="M783,910 L 791,910 Q 798,910 798,895 L 798,892 Q 798,877 789,877 L 780,877"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M744,877 L 726,877 Q 711,877 711,892 L 711,895 Q 711,910 719,910 L 726,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M689,910 L 697,910 Q 704,910 704,921 Q 704,932 719,932 L 790,932 Q 805,932 805,921 Q 805,910 813,910 L 820,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="285,910 273,915 273,906" style="fill:rgb(0,0,0)"/>
<path d="M249,782 L 256,782 Q 264,782 264,797 L 264,895 Q 264,910 272,910 L 279,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,882 412,886 412,877" style="fill:rgb(0,0,0)"/>
<path d="M264,867 L 264,874 Q 264,882 279,882 L 402,882 L 417,882"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,882 L 456,882 Q 471,882 471,896 Q 471,910 478,910 L 486,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,971L80,971A15 15 0 0 0 95 956A15 15 0 0 0 80 941L60,941A15 15 0 0 0 45 956A15 15 0 0 0 60 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="131,956 120,960 120,951" style="fill:rgb(0,0,0)"/>
<path d="M95,956L125,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,971L191,971A15 15 0 0 0 206 956A15 15 0 0 0 191 941L146,941A15 15 0 0 0 131 956A15 15 0 0 0 146 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="242,956 231,960 231,951" style="fill:rgb(0,0,0)"/>
<path d="M206,956L236,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,971A15 15 0 0 0 272 956A15 15 0 0 0 257 941A15 15 0 0 0 242 956A15 15 0 0 0 257 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="295,956 284,960 284,951" style="fill:rgb(0,0,0)"/>
<path d="M272,956L290,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,971L400,971L400,941L295,941Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="423,956 411,960 411,951" style="fill:rgb(0,0,0)"/>
<path d="M400,956L417,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,971A15 15 0 0 0 453 956A15 15 0 0 0 438 941A15 15 0 0 0 423 956A15 15 0 0 0 438 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,956 905,960 905,951" style="fill:rgb(0,0,0)"/>
<path d="M453,956L910,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,956 L 924,956 Q 931,956 931,948 L 931,941"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,956 33,960 33,951" style="fill:rgb(0,0,0)"/>
<path d="M24,941 L 24,948 Q 24,956 31,956 L 39,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,929 59,934 59,925" style="fill:rgb(0,0,0)"/>
<path d="M24,914 L 24,922 Q 24,929 39,929 L 49,929 L 64,929"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,929 L 201,929 Q 216,929 216,943 Q 216,956 223,956 L 231,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,929 L 101,929 Q 108,929 108,943 Q 108,956 116,956 L 123,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,1009L89,1009A15 15 0 0 0 104 994A15 15 0 0 0 89 978L60,978A15 15 0 0 0 45 994A15 15 0 0 0 60 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASE</text>
<polygon points="140,994 128,998 128,989" style="fill:rgb(0,0,0)"/>
<path d="M104,994L134,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M140,1009L189,1009L189,978L140,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="243,994 232,998 232,989" style="fill:rgb(0,0,0)"/>
<path d="M189,994L237,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,1009L298,1009A15 15 0 0 0 313 994A15 15 0 0 0 298 978L258,978A15 15 0 0 0 243 994A15 15 0 0 0 258 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="336,994 324,998 324,989" style="fill:rgb(0,0,0)"/>
<path d="M313,994L330,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,1009L385,1009L385,978L336,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="408,994 396,998 396,989" style="fill:rgb(0,0,0)"/>
<path d="M385,994L402,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,1009L456,1009A15 15 0 0 0 472 994A15 15 0 0 0 456 978L423,978A15 15 0 0 0 408 994A15 15 0 0 0 423 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">THEN</text>
<polygon points="495,994 483,998 483,989" style="fill:rgb(0,0,0)"/>
<path d="M472,994L489,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M495,1009L544,1009L544,978L495,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="616,994 604,998 604,989" style="fill:rgb(0,0,0)"/>
<path d="M544,994L610,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M631,1009L658,1009A15 15 0 0 0 673 994A15 15 0 0 0 658 978L631,978A15 15 0 0 0 616 994A15 15 0 0 0 631 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="645" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ELSE</text>
<polygon points="696,994 685,998 685,989" style="fill:rgb(0,0,0)"/>
<path d="M673,994L691,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M696,1009L746,1009L746,978L696,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="721" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="782,994 770,998 770,989" style="fill:rgb(0,0,0)"/>
<path d="M746,994L776,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M797,1009L818,1009A15 15 0 0 0 833 994A15 15 0 0 0 818 978L797,978A15 15 0 0 0 782 994A15 15 0 0 0 797 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="807" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="916,994 905,998 905,989" style="fill:rgb(0,0,0)"/>
<path d="M833,994L910,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,994 L 924,994 Q 931,994 931,986 L 931,979"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,994 33,998 33,989" style="fill:rgb(0,0,0)"/>
<path d="M24,978 L 24,986 Q 24,994 31,994 L 39,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,994 L 111,994 Q 119,994 119,1007 Q 119,1021 134,1021 L 186,1021 Q 201,1021 201,1007 Q 201,994 208,994 L 216,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="360,1021 372,1016 372,1025" style="fill:rgb(0,0,0)"/>
<path d="M544,994 L 551,994 Q 559,994 559,1007 Q 559,1021 544,1021 L 381,1021 L 366,1021"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,1021 L 235,1021 Q 220,1021 220,1007 Q 220,994 227,994 L 235,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,994 L 585,994 Q 593,994 593,1007 Q 593,1021 608,1021 L 742,1021 Q 757,1021 757,1007 Q 757,994 765,994 L 772,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,1066L173,1066L173,1036L45,1036Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="1051" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">raise-function</text>
<polygon points="916,1051 905,1055 905,1047" style="fill:rgb(0,0,0)"/>
<path d="M173,1051L910,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,1051 L 924,1051 Q 931,1051 931,1036 L 931,32 Q 931,17 939,17 L 946,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,1051 33,1055 33,1047" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,1036 Q 24,1051 31,1051 L 39,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/filter-clause.html">filter-clause:</a></b>
<button id='x73080821' onclick='hideorshow("x73080821","x24a28282")'>show</button></p>
 <div id='x24a28282' style='display:none;' class='imgcontainer'>
 <div style="max-width:422px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 422.381 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L93,32A15 15 0 0 0 108 17A15 15 0 0 0 93 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FILTER</text>
<polygon points="131,17 119,21 119,12" style="fill:rgb(0,0,0)"/>
<path d="M108,17L125,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,32L146,32A15 15 0 0 0 161 17A15 15 0 0 0 146 2L146,2A15 15 0 0 0 131 17A15 15 0 0 0 146 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="184,17 173,21 173,12" style="fill:rgb(0,0,0)"/>
<path d="M161,17L178,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M199,32L249,32A15 15 0 0 0 264 17A15 15 0 0 0 249 2L199,2A15 15 0 0 0 184 17A15 15 0 0 0 199 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="224" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="287,17 275,21 275,12" style="fill:rgb(0,0,0)"/>
<path d="M264,17L281,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,32L336,32L336,2L287,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M336,17L353,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,32A15 15 0 0 0 389 17A15 15 0 0 0 374 2A15 15 0 0 0 359 17A15 15 0 0 0 374 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="374" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="413,17 401,21 401,12" style="fill:rgb(0,0,0)"/>
<path d="M389,17L407,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="416" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/function-arguments.html">function-arguments:</a></b>
<button id='xa8f6be58' onclick='hideorshow("xa8f6be58","xdd4c8670")'>show</button></p>
 <div id='xdd4c8670' style='display:none;' class='imgcontainer'>
 <div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.566 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,26 55,30 55,22" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,41 L 43,41 Q 43,26 52,26 L 61,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M82,41L150,41A15 15 0 0 0 165 26L165,26A15 15 0 0 0 150 11L82,11A15 15 0 0 0 66 26L66,26A15 15 0 0 0 82 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="183,26 171,30 171,22" style="fill:rgb(0,0,0)"/>
<path d="M165,26L177,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M183,26 L 189,26 Q 194,26 194,41 L 194,41 Q 194,56 203,56 L 212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M218,56L248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,71L303,71L303,41L254,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="447,56 435,60 435,52" style="fill:rgb(0,0,0)"/>
<path d="M303,56L441,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="116,56 104,60 104,52" style="fill:rgb(0,0,0)"/>
<path d="M32,56L110,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M116,56L212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,32A15 15 0 0 0 293 17A15 15 0 0 0 278 2A15 15 0 0 0 263 17A15 15 0 0 0 278 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="293,17 305,12 305,21" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 314,56 Q 326,56 326,41 L 326,32 Q 326,17 312,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M263,17 L 245,17 Q 230,17 230,32 L 230,41 Q 230,56 239,56 L 248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,207A15 15 0 0 0 243 192L243,192A15 15 0 0 0 228 177A15 15 0 0 0 213 192L213,192A15 15 0 0 0 228 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="213,192 201,196 201,188" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,71 L 43,177 Q 43,192 58,192 L 192,192 L 207,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,192 267,196 267,188" style="fill:rgb(0,0,0)"/>
<path d="M243,192L272,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,192 L 360,192 Q 375,192 390,192 L 394,192 Q 409,192 409,177 L 409,71 Q 409,56 415,56 L 421,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="228,216 216,221 216,212" style="fill:rgb(0,0,0)"/>
<path d="M116,192 L 181,192 Q 196,192 196,204 Q 196,216 209,216 L 222,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,216 L 242,216 Q 257,216 257,204 Q 257,192 262,192 L 268,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="90,117 78,121 78,112" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 313,56 Q 323,56 323,71 L 323,71 Q 323,86 308,86 L 81,86 Q 66,86 66,101 L 66,102 Q 66,117 75,117 L 84,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,132L149,132A15 15 0 0 0 164 117L164,117A15 15 0 0 0 149 101L105,101A15 15 0 0 0 90 117L90,117A15 15 0 0 0 105 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="182,117 170,121 170,112" style="fill:rgb(0,0,0)"/>
<path d="M164,117L176,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,132L201,132A15 15 0 0 0 216 117L216,117A15 15 0 0 0 201 101L197,101A15 15 0 0 0 182 117L182,117A15 15 0 0 0 197 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M216,117L239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,132L375,132L375,101L245,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,169A15 15 0 0 0 325 154A15 15 0 0 0 310 139A15 15 0 0 0 294 154A15 15 0 0 0 310 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,154 336,150 336,159" style="fill:rgb(0,0,0)"/>
<path d="M375,117 L 380,117 Q 386,117 386,132 L 386,139 Q 386,154 371,154 L 345,154 L 330,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M294,154 L 260,154 Q 245,154 236,154 Q 227,154 227,139 L 227,132 Q 227,117 233,117 L 239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M375,117 L 383,117 Q 392,117 392,102 L 392,71 Q 392,56 407,56 L 413,56 L 428,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='xc23e6d25' onclick='hideorshow("xc23e6d25","x09737670")'>show</button></p>
 <div id='x09737670' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/literal-value.html">literal-value:</a></b>
<button id='x849c6c4f' onclick='hideorshow("x849c6c4f","x11d6a31b")'>show</button></p>
 <div id='x11d6a31b' style='display:none;' class='imgcontainer'>
 <div style="max-width:341px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 341.376 336.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,319 39,324 39,315" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,304 Q 24,319 34,319 L 45,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,334L252,334A15 15 0 0 0 267 319A15 15 0 0 0 252 304L65,304A15 15 0 0 0 50 319A15 15 0 0 0 65 334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIMESTAMP</text>
<polygon points="290,319 278,324 278,315" style="fill:rgb(0,0,0)"/>
<path d="M267,319L284,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,17 320,21 320,12" style="fill:rgb(0,0,0)"/>
<path d="M290,319 L 297,319 Q 305,319 305,304 L 305,32 Q 305,17 315,17 L 326,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="335" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L172,32A15 15 0 0 0 187 17A15 15 0 0 0 172 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="119" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,17L320,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L153,70A15 15 0 0 0 168 55L168,55A15 15 0 0 0 153 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">string-literal</text>
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,47 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,55 278,59 278,50" style="fill:rgb(0,0,0)"/>
<path d="M168,55L284,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,55 L 297,55 Q 305,55 305,47 L 305,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L140,108A15 15 0 0 0 155 92A15 15 0 0 0 140 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">blob-literal</text>
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,85 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,92 278,97 278,88" style="fill:rgb(0,0,0)"/>
<path d="M155,92L284,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,92 L 297,92 Q 305,92 305,85 L 305,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,145L97,145A15 15 0 0 0 112 130A15 15 0 0 0 97 115L66,115A15 15 0 0 0 50 130A15 15 0 0 0 66 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="50,130 39,135 39,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 34,130 L 45,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,130 278,135 278,126" style="fill:rgb(0,0,0)"/>
<path d="M112,130L284,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,130 L 297,130 Q 305,130 305,123 L 305,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,183L96,183A15 15 0 0 0 111 168A15 15 0 0 0 96 153L66,153A15 15 0 0 0 50 168A15 15 0 0 0 66 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRUE</text>
<polygon points="50,168 39,172 39,164" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,160 Q 24,168 34,168 L 45,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,168 278,172 278,164" style="fill:rgb(0,0,0)"/>
<path d="M111,168L284,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,168 L 297,168 Q 305,168 305,160 L 305,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,221L104,221A15 15 0 0 0 119 206A15 15 0 0 0 104 191L66,191A15 15 0 0 0 50 206A15 15 0 0 0 66 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FALSE</text>
<polygon points="50,206 39,210 39,201" style="fill:rgb(0,0,0)"/>
<path d="M24,191 L 24,198 Q 24,206 34,206 L 45,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,206 278,210 278,201" style="fill:rgb(0,0,0)"/>
<path d="M119,206L284,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,206 L 297,206 Q 305,206 305,198 L 305,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,259L190,259A15 15 0 0 0 205 244A15 15 0 0 0 190 228L66,228A15 15 0 0 0 50 244A15 15 0 0 0 66 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="128" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIME</text>
<polygon points="50,244 39,248 39,239" style="fill:rgb(0,0,0)"/>
<path d="M24,228 L 24,236 Q 24,244 34,244 L 45,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,244 278,248 278,239" style="fill:rgb(0,0,0)"/>
<path d="M205,244L284,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,244 L 297,244 Q 305,244 305,236 L 305,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,297L192,297A15 15 0 0 0 207 281A15 15 0 0 0 192 266L66,266A15 15 0 0 0 50 281A15 15 0 0 0 66 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_DATE</text>
<polygon points="50,281 39,286 39,277" style="fill:rgb(0,0,0)"/>
<path d="M24,266 L 24,274 Q 24,281 34,281 L 45,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,281 278,286 278,277" style="fill:rgb(0,0,0)"/>
<path d="M207,281L284,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,281 L 297,281 Q 305,281 305,274 L 305,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/over-clause.html">over-clause:</a></b>
<button id='xc00e0a0c' onclick='hideorshow("xc00e0a0c","x302ba600")'>show</button></p>
 <div id='x302ba600' style='display:none;' class='imgcontainer'>
 <div style="max-width:600px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 600.706 418.392">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="129,17 117,21 117,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L123,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M144,32L241,32A15 15 0 0 0 256 17A15 15 0 0 0 241 2L144,2A15 15 0 0 0 129 17A15 15 0 0 0 144 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,17 L 100,17 Q 108,17 108,32 L 108,40 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,70A15 15 0 0 0 165 55L165,55A15 15 0 0 0 149 39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 149 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="149" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="206,82 195,86 195,77" style="fill:rgb(0,0,0)"/>
<path d="M165,55 L 172,55 Q 180,55 180,68 Q 180,82 190,82 L 200,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,97L363,97A15 15 0 0 0 378 82A15 15 0 0 0 363 67L221,67A15 15 0 0 0 206 82A15 15 0 0 0 221 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="292" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M221,173L301,173A15 15 0 0 0 316 157A15 15 0 0 0 301 142L221,142A15 15 0 0 0 206 157A15 15 0 0 0 221 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="339,157 328,162 328,153" style="fill:rgb(0,0,0)"/>
<path d="M316,157L333,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,173L358,173A15 15 0 0 0 373 157A15 15 0 0 0 358 142L354,142A15 15 0 0 0 339 157A15 15 0 0 0 354 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="409,157 398,162 398,153" style="fill:rgb(0,0,0)"/>
<path d="M373,157L404,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,173L459,173L459,142L409,142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M434,210A15 15 0 0 0 449 195A15 15 0 0 0 434 180A15 15 0 0 0 419 195A15 15 0 0 0 434 210Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="195" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="449,195 461,191 461,200" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,180 Q 474,195 464,195 L 455,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,195 L 398,195 Q 383,195 383,180 L 383,172 Q 383,157 390,157 L 398,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,55 280,59 280,50" style="fill:rgb(0,0,0)"/>
<path d="M165,55L286,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,120 304,115 304,124" style="fill:rgb(0,0,0)"/>
<path d="M292,55 L 401,55 Q 416,55 416,70 L 416,105 Q 416,120 401,120 L 313,120 L 298,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,157 195,162 195,153" style="fill:rgb(0,0,0)"/>
<path d="M292,120 L 180,120 Q 165,120 165,135 L 165,142 Q 165,157 180,157 L 185,157 L 200,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="401,82 389,86 389,77" style="fill:rgb(0,0,0)"/>
<path d="M378,82L395,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,82 L 408,82 Q 416,82 416,89 L 416,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,286L266,286A15 15 0 0 0 281 271A15 15 0 0 0 266 256L221,256A15 15 0 0 0 206 271A15 15 0 0 0 221 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="244" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="304,271 292,275 292,266" style="fill:rgb(0,0,0)"/>
<path d="M281,271L298,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M319,286L323,286A15 15 0 0 0 338 271A15 15 0 0 0 323 256L319,256A15 15 0 0 0 304 271A15 15 0 0 0 319 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="321" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="374,271 363,275 363,266" style="fill:rgb(0,0,0)"/>
<path d="M338,271L368,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,286L504,286L504,256L374,256Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M439,324A15 15 0 0 0 454 309A15 15 0 0 0 439 293A15 15 0 0 0 424 309A15 15 0 0 0 439 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="454,309 466,304 466,313" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,294 Q 519,309 504,309 L 475,309 L 460,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,309 L 363,309 Q 348,309 348,294 L 348,286 Q 348,271 355,271 L 363,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,233 304,229 304,237" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,218 Q 474,233 459,233 L 313,233 L 298,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,271 195,275 195,266" style="fill:rgb(0,0,0)"/>
<path d="M292,233 L 180,233 Q 165,233 165,248 L 165,256 Q 165,271 180,271 L 185,271 L 200,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,195 160,184 169,184" style="fill:rgb(0,0,0)"/>
<path d="M165,142L165,189"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,195L165,256"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,399L311,399L311,369L206,369Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="384" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="519,384 508,389 508,380" style="fill:rgb(0,0,0)"/>
<path d="M311,384L513,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M534,399A15 15 0 0 0 549 384A15 15 0 0 0 534 369A15 15 0 0 0 519 384A15 15 0 0 0 534 399Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="384" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="591,17 579,21 579,12" style="fill:rgb(0,0,0)"/>
<path d="M549,384 L 557,384 Q 564,384 564,369 L 564,32 Q 564,17 575,17 L 585,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="594" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,17 508,21 508,12" style="fill:rgb(0,0,0)"/>
<path d="M256,17L513,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,17L579,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,346 304,342 304,351" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,331 Q 519,346 504,346 L 313,346 L 298,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,384 195,389 195,380" style="fill:rgb(0,0,0)"/>
<path d="M292,346 L 180,346 Q 165,346 165,361 L 165,369 Q 165,384 180,384 L 185,384 L 200,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,309 160,297 169,297" style="fill:rgb(0,0,0)"/>
<path d="M165,256L165,303"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,309L165,369"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="258,411 247,416 247,407" style="fill:rgb(0,0,0)"/>
<path d="M165,369 L 165,396 Q 165,411 180,411 L 238,411 L 253,411"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,384 369,389 369,380" style="fill:rgb(0,0,0)"/>
<path d="M258,411 L 335,411 Q 350,411 350,398 Q 350,384 362,384 L 375,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='xcd0f62ec' onclick='hideorshow("xcd0f62ec","x6ddfaa95")'>show</button></p>
 <div id='x6ddfaa95' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x0f537cee' onclick='hideorshow("x0f537cee","x3b12433b")'>show</button></p>
 <div id='x3b12433b' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/raise-function.html">raise-function:</a></b>
<button id='x298268be' onclick='hideorshow("x298268be","xd3d36384")'>show</button></p>
 <div id='xd3d36384' style='display:none;' class='imgcontainer'>
 <div style="max-width:627px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 627.302 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L82,32A15 15 0 0 0 97 17A15 15 0 0 0 82 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RAISE</text>
<polygon points="120,17 109,21 109,12" style="fill:rgb(0,0,0)"/>
<path d="M97,17L114,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,32L135,32A15 15 0 0 0 150 17A15 15 0 0 0 135 2L135,2A15 15 0 0 0 120 17A15 15 0 0 0 135 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="135" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="192,55 180,59 180,50" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 158,17 Q 165,17 165,32 L 165,40 Q 165,55 176,55 L 186,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,70L285,70A15 15 0 0 0 300 55L300,55A15 15 0 0 0 285 39L207,39A15 15 0 0 0 192 55L192,55A15 15 0 0 0 207 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="336,55 324,59 324,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70A15 15 0 0 0 366 55L366,55A15 15 0 0 0 351 39A15 15 0 0 0 336 55L336,55A15 15 0 0 0 351 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="389,55 378,59 378,50" style="fill:rgb(0,0,0)"/>
<path d="M366,55L383,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,70L508,70A15 15 0 0 0 523 55L523,55A15 15 0 0 0 508 39L404,39A15 15 0 0 0 389 55L389,55A15 15 0 0 0 404 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="456" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">error-message</text>
<polygon points="564,17 553,21 553,12" style="fill:rgb(0,0,0)"/>
<path d="M523,55 L 530,55 Q 538,55 538,40 L 538,32 Q 538,17 548,17 L 558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M579,32A15 15 0 0 0 594 17A15 15 0 0 0 579 2A15 15 0 0 0 564 17A15 15 0 0 0 579 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="617,17 606,21 606,12" style="fill:rgb(0,0,0)"/>
<path d="M594,17L612,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="621" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L259,32A15 15 0 0 0 274 17A15 15 0 0 0 259 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="456,17 444,21 444,12" style="fill:rgb(0,0,0)"/>
<path d="M274,17L450,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,17L553,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,108L249,108A15 15 0 0 0 264 92A15 15 0 0 0 249 77L207,77A15 15 0 0 0 192 92A15 15 0 0 0 207 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="300,92 288,97 288,88" style="fill:rgb(0,0,0)"/>
<path d="M264,92L294,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,92 L 307,92 Q 315,92 315,77 L 315,70 Q 315,55 322,55 L 330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,145L229,145A15 15 0 0 0 244 130A15 15 0 0 0 229 115L207,115A15 15 0 0 0 192 130A15 15 0 0 0 207 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="300,130 288,135 288,126" style="fill:rgb(0,0,0)"/>
<path d="M244,130L294,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,130 L 307,130 Q 315,130 315,115 L 315,92 L 315,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,130 180,135 180,126" style="fill:rgb(0,0,0)"/>
<path d="M165,39 L 165,115 Q 165,130 176,130 L 186,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,92 180,97 180,88" style="fill:rgb(0,0,0)"/>
<path d="M165,77 L 165,85 Q 165,92 176,92 L 186,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/select-stmt.html">select-stmt:</a></b>
<button id='x243aef42' onclick='hideorshow("x243aef42","x655efbe7")'>show</button></p>
 <div id='x655efbe7' style='display:none;' class='imgcontainer'>
 <div style="max-width:669px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 669.677 1162.3">
<path d="M55,845L667,845L667,99L55,99Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="6" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="46,17 34,21 34,12" style="fill:rgb(0,0,0)"/>
<path d="M10,17L40,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M61,32L92,32A15 15 0 0 0 107 17A15 15 0 0 0 92 2L61,2A15 15 0 0 0 46 17A15 15 0 0 0 61 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="76" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M167,62L253,62A15 15 0 0 0 268 47L268,47A15 15 0 0 0 253 32L167,32A15 15 0 0 0 152 47L152,47A15 15 0 0 0 167 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="210,17 198,21 198,12" style="fill:rgb(0,0,0)"/>
<path d="M107,17L204,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M210,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M358,32L584,32L584,2L358,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="152,47 140,51 140,43" style="fill:rgb(0,0,0)"/>
<path d="M107,17 L 114,17 Q 122,17 122,32 L 122,32 Q 122,47 134,47 L 146,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="291,47 279,51 279,43" style="fill:rgb(0,0,0)"/>
<path d="M268,47L285,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,47 L 298,47 Q 306,47 306,32 L 306,32 Q 306,17 321,17 L 331,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,70A15 15 0 0 0 486 55L486,55A15 15 0 0 0 471 39A15 15 0 0 0 456 55L456,55A15 15 0 0 0 471 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="486,55 498,50 498,59" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,40 Q 599,55 584,55 L 507,55 L 492,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,55 L 350,55 Q 335,55 335,40 L 335,32 Q 335,17 340,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,83 307,79 307,88" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,68 Q 599,83 584,83 L 316,83 L 301,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,83 L 40,83 Q 25,83 25,98 L 25,113"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="25,47 20,36 29,36" style="fill:rgb(0,0,0)"/>
<path d="M10,17 L 17,17 Q 25,17 25,29 L 25,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="55,129 43,133 43,124" style="fill:rgb(0,0,0)"/>
<path d="M25,47 L 25,114 Q 25,129 37,129 L 49,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,129 115,133 115,124" style="fill:rgb(0,0,0)"/>
<path d="M55,129L121,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,144L193,144A15 15 0 0 0 208 129A15 15 0 0 0 193 114L142,114A15 15 0 0 0 127 129A15 15 0 0 0 142 144Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="250,159 238,163 238,155" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,144 Q 223,159 233,159 L 244,159"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,174L333,174A15 15 0 0 0 348 159A15 15 0 0 0 333 144L265,144A15 15 0 0 0 250 159A15 15 0 0 0 265 174Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="159" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="417,129 406,133 406,124" style="fill:rgb(0,0,0)"/>
<path d="M348,159 L 356,159 Q 363,159 363,144 L 363,144 Q 363,129 378,129 L 396,129 L 411,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,144L545,144L545,114L417,114Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M481,182A15 15 0 0 0 496 166A15 15 0 0 0 481 151A15 15 0 0 0 466 166A15 15 0 0 0 481 182Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="166" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="496,166 508,162 508,171" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,151 Q 560,166 545,166 L 517,166 L 502,166"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M466,166 L 406,166 Q 391,166 391,151 L 391,144 Q 391,129 398,129 L 406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,129 287,133 287,124" style="fill:rgb(0,0,0)"/>
<path d="M208,129L293,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M299,129L406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,212L280,212A15 15 0 0 0 295 197A15 15 0 0 0 280 182L265,182A15 15 0 0 0 250 197A15 15 0 0 0 265 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="197" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="348,197 337,201 337,192" style="fill:rgb(0,0,0)"/>
<path d="M295,197L342,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,197 L 356,197 Q 363,197 363,182 L 363,159 L 363,144"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="250,197 238,201 238,192" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,182 Q 223,197 233,197 L 244,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,287L203,287A15 15 0 0 0 218 272A15 15 0 0 0 203 257L168,257A15 15 0 0 0 153 272A15 15 0 0 0 168 287Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="186" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="290,272 279,277 279,268" style="fill:rgb(0,0,0)"/>
<path d="M218,272L284,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,287L451,287L451,257L290,257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M320,362L422,362L422,331L320,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M371,324A15 15 0 0 0 386 309A15 15 0 0 0 371 293A15 15 0 0 0 356 309A15 15 0 0 0 371 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="386,309 397,304 397,313" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 459,272 Q 466,272 466,287 L 466,294 Q 466,309 451,309 L 407,309 L 392,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M356,309 L 279,309 Q 264,309 264,294 L 264,287 Q 264,272 271,272 L 279,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="320,346 308,351 308,342" style="fill:rgb(0,0,0)"/>
<path d="M218,272 L 226,272 Q 233,272 233,287 L 233,331 Q 233,346 248,346 L 299,346 L 314,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="484,313 488,325 480,325" style="fill:rgb(0,0,0)"/>
<path d="M422,346 L 436,346 Q 451,346 466,346 L 469,346 Q 484,346 484,333 L 484,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,272 494,277 494,268" style="fill:rgb(0,0,0)"/>
<path d="M484,313 L 484,287 Q 484,272 492,272 L 499,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,272 L 496,272 Q 487,272 487,272 Q 487,272 495,272 L 502,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,197 555,185 564,185" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,176 L 560,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,235 360,230 360,239" style="fill:rgb(0,0,0)"/>
<path d="M560,197 L 560,220 Q 560,235 545,235 L 369,235 L 354,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,272 142,277 142,268" style="fill:rgb(0,0,0)"/>
<path d="M348,235 L 142,235 Q 127,235 127,250 L 127,257 Q 127,272 137,272 L 147,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,437L218,437A15 15 0 0 0 233 422A15 15 0 0 0 218 407L168,407A15 15 0 0 0 153 422A15 15 0 0 0 168 437Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="256,422 244,426 244,418" style="fill:rgb(0,0,0)"/>
<path d="M233,422L250,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,437L305,437L305,407L256,407Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="517,324 513,312 521,312" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 502,272 Q 517,272 517,287 L 517,303 L 517,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,384 382,380 382,389" style="fill:rgb(0,0,0)"/>
<path d="M517,324 L 517,369 Q 517,384 502,384 L 391,384 L 376,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,422 142,426 142,418" style="fill:rgb(0,0,0)"/>
<path d="M371,384 L 142,384 Q 127,384 127,399 L 127,407 Q 127,422 137,422 L 147,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,324 122,312 131,312" style="fill:rgb(0,0,0)"/>
<path d="M127,257L127,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,324L127,407"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,535L212,535A15 15 0 0 0 227 520A15 15 0 0 0 212 505L168,505A15 15 0 0 0 153 520A15 15 0 0 0 168 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="250,520 238,525 238,516" style="fill:rgb(0,0,0)"/>
<path d="M227,520L244,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,535L269,535A15 15 0 0 0 284 520A15 15 0 0 0 269 505L265,505A15 15 0 0 0 250 520A15 15 0 0 0 265 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="320,520 309,525 309,516" style="fill:rgb(0,0,0)"/>
<path d="M284,520L314,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,535L369,535L369,505L320,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="452,520 441,525 441,516" style="fill:rgb(0,0,0)"/>
<path d="M369,520L446,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,535L520,535A15 15 0 0 0 535 520A15 15 0 0 0 520 505L467,505A15 15 0 0 0 452 520A15 15 0 0 0 467 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="558,520 546,525 546,516" style="fill:rgb(0,0,0)"/>
<path d="M535,520L552,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,535L607,535L607,505L558,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M345,573A15 15 0 0 0 360 558A15 15 0 0 0 345 543A15 15 0 0 0 330 558A15 15 0 0 0 345 573Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="558" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="360,558 371,554 371,562" style="fill:rgb(0,0,0)"/>
<path d="M369,520 L 377,520 Q 384,520 384,535 L 384,543 Q 384,558 375,558 L 366,558"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,558 L 309,558 Q 294,558 294,543 L 294,535 Q 294,520 301,520 L 309,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="514,551 503,555 503,546" style="fill:rgb(0,0,0)"/>
<path d="M411,520 L 418,520 Q 426,520 426,535 L 426,536 Q 426,551 441,551 L 493,551 L 508,551"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M514,551 L 607,551 Q 622,551 622,536 L 622,535 Q 622,520 630,520 L 637,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,490 256,494 256,486" style="fill:rgb(0,0,0)"/>
<path d="M127,460 L 127,475 Q 127,490 142,490 L 246,490 L 261,490"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,520 399,525 399,516" style="fill:rgb(0,0,0)"/>
<path d="M267,490 L 369,490 Q 384,490 384,505 L 384,505 Q 384,520 395,520 L 405,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,460 244,455 244,464" style="fill:rgb(0,0,0)"/>
<path d="M305,422 L 313,422 Q 320,422 320,437 L 320,445 Q 320,460 305,460 L 254,460 L 239,460"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,520 142,525 142,516" style="fill:rgb(0,0,0)"/>
<path d="M233,460 L 142,460 Q 127,460 127,475 L 127,505 Q 127,520 137,520 L 147,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,447 122,435 131,435" style="fill:rgb(0,0,0)"/>
<path d="M127,407L127,441"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,447L127,505"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,649L232,649A15 15 0 0 0 247 634A15 15 0 0 0 232 619L168,619A15 15 0 0 0 153 634A15 15 0 0 0 168 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="200" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="283,634 271,638 271,629" style="fill:rgb(0,0,0)"/>
<path d="M247,634L277,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,649L395,649A15 15 0 0 0 410 634A15 15 0 0 0 395 619L298,619A15 15 0 0 0 283 634A15 15 0 0 0 298 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="433,634 422,638 422,629" style="fill:rgb(0,0,0)"/>
<path d="M410,634L427,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,649L452,649A15 15 0 0 0 467 634A15 15 0 0 0 452 619L448,619A15 15 0 0 0 433 634A15 15 0 0 0 448 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="450" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="490,634 479,638 479,629" style="fill:rgb(0,0,0)"/>
<path d="M467,634L485,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,649L609,649L609,619L490,619Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="550" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M446,687A15 15 0 0 0 461 671A15 15 0 0 0 446 656A15 15 0 0 0 431 671A15 15 0 0 0 446 687Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="671" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="461,671 472,667 472,676" style="fill:rgb(0,0,0)"/>
<path d="M609,634 L 616,634 Q 624,634 624,649 L 624,656 Q 624,671 609,671 L 482,671 L 467,671"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,671 L 271,671 Q 256,671 256,656 L 256,649 Q 256,634 264,634 L 271,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="624,692 619,680 628,680" style="fill:rgb(0,0,0)"/>
<path d="M624,656L624,686"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,558 648,547 656,547" style="fill:rgb(0,0,0)"/>
<path d="M607,520 L 637,520 Q 652,520 652,535 L 652,537 L 652,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,596 382,592 382,600" style="fill:rgb(0,0,0)"/>
<path d="M652,558 L 652,581 Q 652,596 637,596 L 391,596 L 376,596"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,634 142,638 142,629" style="fill:rgb(0,0,0)"/>
<path d="M371,596 L 142,596 Q 127,596 127,611 L 127,619 Q 127,634 137,634 L 147,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,558 122,547 131,547" style="fill:rgb(0,0,0)"/>
<path d="M127,505L127,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,709 359,714 359,705" style="fill:rgb(0,0,0)"/>
<path d="M127,558 L 127,694 Q 127,709 142,709 L 350,709 L 365,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,709 597,714 597,705" style="fill:rgb(0,0,0)"/>
<path d="M371,709L603,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,709 L 616,709 Q 624,709 624,717 L 624,724"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,800L194,800A15 15 0 0 0 209 785A15 15 0 0 0 194 770L142,770A15 15 0 0 0 127 785A15 15 0 0 0 142 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="245,785 234,789 234,781" style="fill:rgb(0,0,0)"/>
<path d="M209,785L239,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,800A15 15 0 0 0 275 785A15 15 0 0 0 260 770A15 15 0 0 0 245 785A15 15 0 0 0 260 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="311,785 300,789 300,781" style="fill:rgb(0,0,0)"/>
<path d="M275,785L306,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,800L361,800L361,770L311,770Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="397,785 385,789 385,781" style="fill:rgb(0,0,0)"/>
<path d="M361,785L391,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,800A15 15 0 0 0 427 785A15 15 0 0 0 412 770A15 15 0 0 0 397 785A15 15 0 0 0 412 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="412" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="609,785 597,789 597,781" style="fill:rgb(0,0,0)"/>
<path d="M427,785L603,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,785 L 616,785 Q 624,785 624,792 L 624,800"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,762A15 15 0 0 0 351 747A15 15 0 0 0 336 732A15 15 0 0 0 321 747A15 15 0 0 0 336 762Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="747" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M336,838A15 15 0 0 0 351 823A15 15 0 0 0 336 808A15 15 0 0 0 321 823A15 15 0 0 0 336 838Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="823" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="351,747 363,743 363,751" style="fill:rgb(0,0,0)"/>
<path d="M361,785 L 368,785 Q 376,785 376,770 L 376,762 Q 376,747 366,747 L 357,747"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,747 L 300,747 Q 285,747 285,762 L 285,770 Q 285,785 292,785 L 300,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,823 363,818 363,827" style="fill:rgb(0,0,0)"/>
<path d="M427,785 L 434,785 Q 442,785 442,800 L 442,808 Q 442,823 427,823 L 372,823 L 357,823"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,823 L 234,823 Q 219,823 219,808 L 219,800 Q 219,785 226,785 L 234,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,785 115,789 115,781" style="fill:rgb(0,0,0)"/>
<path d="M55,129 L 62,129 Q 70,129 70,144 L 70,770 Q 70,785 85,785 L 106,785 L 121,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,891L424,891L424,860L248,860Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="876" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="424,876 436,871 436,880" style="fill:rgb(0,0,0)"/>
<path d="M624,692 L 624,861 Q 624,876 609,876 L 445,876 L 430,876"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="6,197 10,208 2,208" style="fill:rgb(0,0,0)"/>
<path d="M248,876 L 21,876 Q 6,876 6,861 L 6,217 L 6,202"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M6,197 L 6,144 Q 6,129 21,129 L 40,129 L 55,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="667" y="275" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" transform="rotate(-90 667,285)" dominant-baseline="central">select-core</text>
<path d="M168,966L213,966A15 15 0 0 0 228 951A15 15 0 0 0 213 936L168,936A15 15 0 0 0 153 951A15 15 0 0 0 168 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="251,951 239,956 239,947" style="fill:rgb(0,0,0)"/>
<path d="M228,951L245,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,966L270,966A15 15 0 0 0 285 951A15 15 0 0 0 270 936L266,936A15 15 0 0 0 251 951A15 15 0 0 0 266 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M168,1072L202,1072A15 15 0 0 0 217 1057A15 15 0 0 0 202 1042L168,1042A15 15 0 0 0 153 1057A15 15 0 0 0 168 1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="240,1057 228,1061 228,1053" style="fill:rgb(0,0,0)"/>
<path d="M217,1057L234,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,1072L289,1072L289,1042L240,1042Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="330,951 319,956 319,947" style="fill:rgb(0,0,0)"/>
<path d="M285,951L324,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,966L460,966L460,936L330,936Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M395,1004A15 15 0 0 0 410 989A15 15 0 0 0 395 974A15 15 0 0 0 380 989A15 15 0 0 0 395 1004Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="989" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="410,989 422,985 422,993" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 468,951 Q 475,951 475,966 L 475,974 Q 475,989 460,989 L 431,989 L 416,989"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,989 L 322,989 Q 307,989 307,974 L 307,966 Q 307,951 313,951 L 319,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,913 348,909 348,918" style="fill:rgb(0,0,0)"/>
<path d="M624,860 L 624,898 Q 624,913 609,913 L 357,913 L 342,913"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,951 142,956 142,947" style="fill:rgb(0,0,0)"/>
<path d="M336,913 L 142,913 Q 127,913 127,928 L 127,936 Q 127,951 137,951 L 147,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,981 492,970 500,970" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 481,951 Q 496,951 496,963 L 496,976"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,1023 318,1019 318,1027" style="fill:rgb(0,0,0)"/>
<path d="M496,981 L 496,1008 Q 496,1023 481,1023 L 327,1023 L 312,1023"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,1057 142,1061 142,1053" style="fill:rgb(0,0,0)"/>
<path d="M307,1023 L 142,1023 Q 127,1023 127,1038 L 127,1042 Q 127,1057 137,1057 L 147,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,989 122,978 131,978" style="fill:rgb(0,0,0)"/>
<path d="M127,936L127,983"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,989L127,1042"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1102L415,1102A15 15 0 0 0 430 1087A15 15 0 0 0 415 1072L363,1072A15 15 0 0 0 348 1087A15 15 0 0 0 363 1102Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="389" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="453,1087 441,1092 441,1083" style="fill:rgb(0,0,0)"/>
<path d="M430,1087L447,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,1102L502,1102L502,1072L453,1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="525,1087 513,1092 513,1083" style="fill:rgb(0,0,0)"/>
<path d="M502,1087L519,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1140A15 15 0 0 0 378 1125A15 15 0 0 0 363 1110A15 15 0 0 0 348 1125A15 15 0 0 0 363 1140Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="1125" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="401,1125 390,1129 390,1121" style="fill:rgb(0,0,0)"/>
<path d="M378,1125L396,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,1140L451,1140L451,1110L401,1110Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="1125" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="312,1057 301,1061 301,1053" style="fill:rgb(0,0,0)"/>
<path d="M289,1057L306,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1125 337,1129 337,1121" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1110 Q 327,1125 335,1125 L 342,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1087 337,1092 337,1083" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1072 Q 327,1087 335,1087 L 342,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1057 513,1061 513,1053" style="fill:rgb(0,0,0)"/>
<path d="M312,1057L519,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="620,1155 609,1160 609,1151" style="fill:rgb(0,0,0)"/>
<path d="M525,1057 L 546,1057 Q 561,1057 561,1072 L 561,1140 Q 561,1155 576,1155 L 599,1155 L 614,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="624" cy="1155" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1087 L 546,1087 Q 561,1087 561,1095 L 561,1102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1125 513,1129 513,1121" style="fill:rgb(0,0,0)"/>
<path d="M451,1125L519,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1125 L 546,1125 Q 561,1125 561,1133 L 561,1140"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1155 513,1160 513,1151" style="fill:rgb(0,0,0)"/>
<path d="M127,1042 L 127,1140 Q 127,1155 142,1155 L 504,1155 L 519,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1155L597,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/compound-operator.html">compound-operator:</a></b>
<button id='x93536833' onclick='hideorshow("x93536833","x035b8ae9")'>show</button></p>
 <div id='x035b8ae9' style='display:none;' class='imgcontainer'>
 <div style="max-width:293px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 293.842 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L127,32A15 15 0 0 0 142 17A15 15 0 0 0 127 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,70L127,70A15 15 0 0 0 142 55L142,55A15 15 0 0 0 127 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,108L168,108A15 15 0 0 0 183 92A15 15 0 0 0 168 77L83,77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M83,145L135,145A15 15 0 0 0 150 130A15 15 0 0 0 135 115L83,115A15 15 0 0 0 68 130A15 15 0 0 0 83 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M142,55L159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70L195,70A15 15 0 0 0 210 55L210,55A15 15 0 0 0 195 39L180,39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="233,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M210,55L227,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,17 272,21 272,12" style="fill:rgb(0,0,0)"/>
<path d="M233,55 L 240,55 Q 248,55 248,40 L 248,32 Q 248,17 263,17 L 263,17 L 278,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="288" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M47,39 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,92 221,97 221,88" style="fill:rgb(0,0,0)"/>
<path d="M183,92L227,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,92 L 240,92 Q 248,92 248,77 L 248,54 L 248,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,130 56,135 56,126" style="fill:rgb(0,0,0)"/>
<path d="M47,77 L 47,115 Q 47,130 55,130 L 62,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,130 221,135 221,126" style="fill:rgb(0,0,0)"/>
<path d="M150,130L227,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,130 L 240,130 Q 248,130 248,115 L 248,92 L 248,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='xcf0d9242' onclick='hideorshow("xcf0d9242","x1f9b5ae6")'>show</button></p>
 <div id='x1f9b5ae6' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/result-column.html">result-column:</a></b>
<button id='x635c3cb3' onclick='hideorshow("x635c3cb3","xdf43542d")'>show</button></p>
 <div id='xdf43542d' style='display:none;' class='imgcontainer'>
 <div style="max-width:398px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 398.054 163.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L94,32L94,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="136,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M94,17 L 102,17 Q 109,17 109,32 L 109,40 Q 109,55 119,55 L 130,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M151,70L155,70A15 15 0 0 0 170 55L170,55A15 15 0 0 0 155 39L151,39A15 15 0 0 0 136 55L136,55A15 15 0 0 0 151 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="206,55 194,59 194,50" style="fill:rgb(0,0,0)"/>
<path d="M170,55L200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,70L309,70A15 15 0 0 0 324 55L324,55A15 15 0 0 0 309 39L221,39A15 15 0 0 0 206 55L206,55A15 15 0 0 0 221 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="347,55 335,59 335,50" style="fill:rgb(0,0,0)"/>
<path d="M324,55L341,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,17 377,21 377,12" style="fill:rgb(0,0,0)"/>
<path d="M347,55 L 354,55 Q 362,55 362,40 L 362,32 Q 362,17 372,17 L 382,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="392" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,85 141,89 141,81" style="fill:rgb(0,0,0)"/>
<path d="M109,39 L 109,70 Q 109,85 124,85 L 132,85 L 147,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,85 L 170,85 Q 185,85 185,70 L 185,70 Q 185,55 192,55 L 200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="241,17 230,21 230,12" style="fill:rgb(0,0,0)"/>
<path d="M94,17L235,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M241,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,108 39,112 39,103" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,93 Q 24,108 34,108 L 45,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,123A15 15 0 0 0 81 108A15 15 0 0 0 66 92A15 15 0 0 0 50 108A15 15 0 0 0 66 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="108" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,108 335,112 335,103" style="fill:rgb(0,0,0)"/>
<path d="M81,108L341,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,108 L 354,108 Q 362,108 362,93 L 362,54 L 362,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,145 39,150 39,141" style="fill:rgb(0,0,0)"/>
<path d="M24,92 L 24,130 Q 24,145 34,145 L 45,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,160L141,160A15 15 0 0 0 156 145A15 15 0 0 0 141 130L66,130A15 15 0 0 0 50 145A15 15 0 0 0 66 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="145" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="179,145 167,150 167,141" style="fill:rgb(0,0,0)"/>
<path d="M156,145L173,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M194,160A15 15 0 0 0 209 145A15 15 0 0 0 194 130A15 15 0 0 0 179 145A15 15 0 0 0 194 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="232,145 221,150 221,141" style="fill:rgb(0,0,0)"/>
<path d="M209,145L226,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,160A15 15 0 0 0 262 145A15 15 0 0 0 247 130A15 15 0 0 0 232 145A15 15 0 0 0 247 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,145 335,150 335,141" style="fill:rgb(0,0,0)"/>
<path d="M262,145L341,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,145 L 354,145 Q 362,145 362,130 L 362,107 L 362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/window-defn.html">window-defn:</a></b>
<button id='x35e9e463' onclick='hideorshow("x35e9e463","x17dc258b")'>show</button></p>
 <div id='x17dc258b' style='display:none;' class='imgcontainer'>
 <div style="max-width:479px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 479.765 380.592">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,44 92,48 92,40" style="fill:rgb(0,0,0)"/>
<path d="M62,17 L 70,17 Q 77,17 77,30 Q 77,44 88,44 L 98,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,59L260,59A15 15 0 0 0 275 44L275,44A15 15 0 0 0 260 29L119,29A15 15 0 0 0 104 44L104,44A15 15 0 0 0 119 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M119,135L198,135A15 15 0 0 0 214 120A15 15 0 0 0 198 104L119,104A15 15 0 0 0 104 120A15 15 0 0 0 119 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="237,120 225,124 225,115" style="fill:rgb(0,0,0)"/>
<path d="M214,120L231,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M252,135L256,135A15 15 0 0 0 271 120A15 15 0 0 0 256 104L252,104A15 15 0 0 0 237 120A15 15 0 0 0 252 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="307,120 295,124 295,115" style="fill:rgb(0,0,0)"/>
<path d="M271,120L301,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,135L356,135L356,104L307,104Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M332,173A15 15 0 0 0 347 157A15 15 0 0 0 332 142A15 15 0 0 0 316 157A15 15 0 0 0 332 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="157" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="347,157 358,153 358,162" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,142 Q 371,157 362,157 L 352,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,157 L 295,157 Q 280,157 280,142 L 280,135 Q 280,120 288,120 L 295,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,17 178,21 178,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L184,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,82 201,77 201,86" style="fill:rgb(0,0,0)"/>
<path d="M190,17 L 298,17 Q 313,17 313,32 L 313,67 Q 313,82 298,82 L 210,82 L 195,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,120 92,124 92,115" style="fill:rgb(0,0,0)"/>
<path d="M190,82 L 77,82 Q 62,82 62,97 L 62,105 Q 62,120 77,120 L 83,120 L 98,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,44 287,48 287,40" style="fill:rgb(0,0,0)"/>
<path d="M275,44L293,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,44 L 306,44 Q 313,44 313,51 L 313,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,248L163,248A15 15 0 0 0 178 233A15 15 0 0 0 163 218L119,218A15 15 0 0 0 104 233A15 15 0 0 0 119 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="201,233 190,237 190,229" style="fill:rgb(0,0,0)"/>
<path d="M178,233L196,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,248L221,248A15 15 0 0 0 236 233A15 15 0 0 0 221 218L217,218A15 15 0 0 0 201 233A15 15 0 0 0 217 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="272,233 260,237 260,229" style="fill:rgb(0,0,0)"/>
<path d="M236,233L266,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,248L402,248L402,218L272,218Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M337,286A15 15 0 0 0 352 271A15 15 0 0 0 337 256A15 15 0 0 0 322 271A15 15 0 0 0 337 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="352,271 363,266 363,275" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,256 Q 417,271 402,271 L 373,271 L 358,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M322,271 L 260,271 Q 245,271 245,256 L 245,248 Q 245,233 253,233 L 260,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,195 201,191 201,200" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,180 Q 371,195 356,195 L 210,195 L 195,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,233 92,237 92,229" style="fill:rgb(0,0,0)"/>
<path d="M190,195 L 77,195 Q 62,195 62,210 L 62,218 Q 62,233 77,233 L 83,233 L 98,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,157 58,146 66,146" style="fill:rgb(0,0,0)"/>
<path d="M62,104L62,152"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,157L62,218"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,362L208,362L208,331L104,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="417,346 405,351 405,342" style="fill:rgb(0,0,0)"/>
<path d="M208,346L411,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,362A15 15 0 0 0 447 346A15 15 0 0 0 432 331A15 15 0 0 0 417 346A15 15 0 0 0 432 362Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="470,346 458,351 458,342" style="fill:rgb(0,0,0)"/>
<path d="M447,346L464,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="474" cy="346" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,309 201,304 201,313" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,294 Q 417,309 402,309 L 210,309 L 195,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,346 92,351 92,342" style="fill:rgb(0,0,0)"/>
<path d="M190,309 L 77,309 Q 62,309 62,324 L 62,331 Q 62,346 77,346 L 83,346 L 98,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,271 58,259 66,259" style="fill:rgb(0,0,0)"/>
<path d="M62,218L62,265"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,271L62,331"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,374 144,378 144,369" style="fill:rgb(0,0,0)"/>
<path d="M62,331 L 62,359 Q 62,374 77,374 L 135,374 L 150,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,346 266,351 266,342" style="fill:rgb(0,0,0)"/>
<path d="M156,374 L 233,374 Q 248,374 248,360 Q 248,346 260,346 L 272,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x6fed526a' onclick='hideorshow("x6fed526a","x2f4e09f2")'>show</button></p>
 <div id='x2f4e09f2' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/type-name.html">type-name:</a></b>
<button id='x6b17cca0' onclick='hideorshow("x6b17cca0","x1186b1db")'>show</button></p>
 <div id='x1186b1db' style='display:none;' class='imgcontainer'>
 <div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.008 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L87,32A15 15 0 0 0 102 17A15 15 0 0 0 87 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="165,92 153,97 153,88" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,77 Q 138,92 149,92 L 159,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,108A15 15 0 0 0 195 92A15 15 0 0 0 180 77A15 15 0 0 0 165 92A15 15 0 0 0 180 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,92 201,97 201,88" style="fill:rgb(0,0,0)"/>
<path d="M195,92L207,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,108L350,108L350,77L212,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,92 356,97 356,88" style="fill:rgb(0,0,0)"/>
<path d="M350,92L362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,108A15 15 0 0 0 398 92A15 15 0 0 0 382 77A15 15 0 0 0 367 92A15 15 0 0 0 382 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="415,92 403,97 403,88" style="fill:rgb(0,0,0)"/>
<path d="M398,92L409,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,108L553,108L553,77L415,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="570,92 558,97 558,88" style="fill:rgb(0,0,0)"/>
<path d="M553,92L564,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,108A15 15 0 0 0 600 92A15 15 0 0 0 585 77A15 15 0 0 0 570 92A15 15 0 0 0 585 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="585" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="651,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M600,92 L 608,92 Q 615,92 615,77 L 615,32 Q 615,17 630,17 L 630,17 L 645,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,40 Q 138,55 149,55 L 159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70A15 15 0 0 0 195 55L195,55A15 15 0 0 0 180 39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,55 201,59 201,50" style="fill:rgb(0,0,0)"/>
<path d="M195,55L207,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,70L350,70L350,39L212,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,55 356,59 356,50" style="fill:rgb(0,0,0)"/>
<path d="M350,55L362,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,70A15 15 0 0 0 398 55L398,55A15 15 0 0 0 382 39A15 15 0 0 0 367 55L367,55A15 15 0 0 0 382 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="600,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M398,55L594,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M600,55 L 608,55 Q 615,55 615,47 L 615,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="74,47 85,43 85,51" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 110,17 Q 117,17 117,32 L 117,32 Q 117,47 102,47 L 94,47 L 79,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47 L 33,47 Q 18,47 18,32 L 18,32 Q 18,17 26,17 L 33,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="382,17 371,21 371,12" style="fill:rgb(0,0,0)"/>
<path d="M102,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,17L630,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='x33eeb476' onclick='hideorshow("x33eeb476","xb2542c70")'>show</button></p>
 <div id='xb2542c70' style='display:none;' class='imgcontainer'>
 <div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/join-clause.html">join-clause:</a></b>
<button id='x844cd734' onclick='hideorshow("x844cd734","x741940b2")'>show</button></p>
 <div id='x741940b2' style='display:none;' class='imgcontainer'>
 <div style="max-width:793px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 793.282 84.24">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L193,32L193,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="259,47 247,51 247,43" style="fill:rgb(0,0,0)"/>
<path d="M193,17 L 200,17 Q 208,17 208,32 L 208,32 Q 208,47 223,47 L 238,47 L 253,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,62L380,62L380,32L259,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-operator</text>
<polygon points="403,47 391,51 391,43" style="fill:rgb(0,0,0)"/>
<path d="M380,47L397,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,62L564,62L564,32L403,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="587,47 575,51 575,43" style="fill:rgb(0,0,0)"/>
<path d="M564,47L581,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M587,62L721,62L721,32L587,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="654" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-constraint</text>
<polygon points="783,17 772,21 772,12" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 742,47 Q 757,47 757,32 L 757,32 Q 757,17 767,17 L 778,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="787" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M193,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,17L776,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,77 495,73 495,82" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 728,47 Q 736,47 736,62 L 736,62 Q 736,77 721,77 L 504,77 L 489,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,77 L 247,77 Q 232,77 232,62 L 232,62 Q 232,47 246,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/join-constraint.html">join-constraint:</a></b>
<button id='x5981a6a3' onclick='hideorshow("x5981a6a3","xf1fdfb94")'>show</button></p>
 <div id='xf1fdfb94' style='display:none;' class='imgcontainer'>
 <div style="max-width:483px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 483.336 126.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L104,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 104 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="143,55 131,59 131,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L137,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,70A15 15 0 0 0 173 55L173,55A15 15 0 0 0 158 39A15 15 0 0 0 143 55L143,55A15 15 0 0 0 158 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="209,55 197,59 197,50" style="fill:rgb(0,0,0)"/>
<path d="M173,55L203,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M224,70L318,70A15 15 0 0 0 333 55L333,55A15 15 0 0 0 318 39L224,39A15 15 0 0 0 209 55L209,55A15 15 0 0 0 224 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="369,55 358,59 358,50" style="fill:rgb(0,0,0)"/>
<path d="M333,55L363,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,70A15 15 0 0 0 399 55L399,55A15 15 0 0 0 384 39A15 15 0 0 0 369 55L369,55A15 15 0 0 0 384 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="422,55 411,59 411,50" style="fill:rgb(0,0,0)"/>
<path d="M399,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="473,17 462,21 462,12" style="fill:rgb(0,0,0)"/>
<path d="M422,55 L 430,55 Q 437,55 437,40 L 437,32 Q 437,17 452,17 L 453,17 L 468,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="477" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,108A15 15 0 0 0 286 92A15 15 0 0 0 271 77A15 15 0 0 0 256 92A15 15 0 0 0 271 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="286,92 298,88 298,97" style="fill:rgb(0,0,0)"/>
<path d="M333,55 L 341,55 Q 348,55 348,70 L 348,77 Q 348,92 333,92 L 307,92 L 292,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,92 L 197,92 Q 182,92 182,77 L 182,70 Q 182,55 190,55 L 197,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L74,32A15 15 0 0 0 90 17A15 15 0 0 0 74 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="113,17 101,21 101,12" style="fill:rgb(0,0,0)"/>
<path d="M90,17L107,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M113,32L162,32L162,2L113,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="422,17 411,21 411,12" style="fill:rgb(0,0,0)"/>
<path d="M162,17L417,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,17L462,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="209,120 197,124 197,115" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,105 Q 24,120 39,120 L 188,120 L 203,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,120 L 422,120 Q 437,120 437,105 L 437,54 L 437,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-operator.html">join-operator:</a></b>
<button id='x3e238d6b' onclick='hideorshow("x3e238d6b","x8d66e867")'>show</button></p>
 <div id='x8d66e867' style='display:none;' class='imgcontainer'>
 <div style="max-width:620px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 620.333 255.312">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,71 39,76 39,67" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,56 Q 24,71 34,71 L 45,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,86L133,86A15 15 0 0 0 148 71A15 15 0 0 0 133 56L66,56A15 15 0 0 0 50 71A15 15 0 0 0 66 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="99" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NATURAL</text>
<polygon points="189,41 178,45 178,37" style="fill:rgb(0,0,0)"/>
<path d="M148,71 L 155,71 Q 163,71 163,56 L 163,56 Q 163,41 173,41 L 184,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,71 219,76 219,67" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,56 Q 204,71 215,71 L 225,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,86L273,86A15 15 0 0 0 288 71A15 15 0 0 0 273 56L246,56A15 15 0 0 0 231 71A15 15 0 0 0 246 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LEFT</text>
<polygon points="378,71 366,76 366,67" style="fill:rgb(0,0,0)"/>
<path d="M288,71L372,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,86L437,86A15 15 0 0 0 452 71A15 15 0 0 0 437 56L393,56A15 15 0 0 0 378 71A15 15 0 0 0 393 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OUTER</text>
<polygon points="475,71 463,76 463,67" style="fill:rgb(0,0,0)"/>
<path d="M452,71L469,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="516,41 505,45 505,37" style="fill:rgb(0,0,0)"/>
<path d="M475,71 L 482,71 Q 490,71 490,56 L 490,56 Q 490,41 500,41 L 511,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,56L554,56A15 15 0 0 0 569 41A15 15 0 0 0 554 26L532,26A15 15 0 0 0 516 41A15 15 0 0 0 532 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="543" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">JOIN</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M569,41 L 576,41 Q 584,41 584,29 Q 584,17 594,17 L 605,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="614" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,32A15 15 0 0 0 325 17A15 15 0 0 0 310 2A15 15 0 0 0 295 17A15 15 0 0 0 310 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="295,17 283,21 283,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L289,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M325,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="99,41 88,45 88,37" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,29 Q 24,41 39,41 L 78,41 L 93,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M99,41L178,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,41L505,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,41 366,45 366,37" style="fill:rgb(0,0,0)"/>
<path d="M336,71 L 344,71 Q 351,71 351,56 L 351,56 Q 351,41 362,41 L 372,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,109 219,113 219,105" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,94 Q 204,109 215,109 L 225,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,124L284,124A15 15 0 0 0 299 109A15 15 0 0 0 284 94L246,94A15 15 0 0 0 231 109A15 15 0 0 0 246 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RIGHT</text>
<polygon points="341,71 329,76 329,67" style="fill:rgb(0,0,0)"/>
<path d="M299,109 L 307,109 Q 314,109 314,94 L 314,86 Q 314,71 324,71 L 335,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,147 219,151 219,142" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,132 Q 204,147 215,147 L 225,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,162L274,162A15 15 0 0 0 289 147A15 15 0 0 0 274 132L246,132A15 15 0 0 0 231 147A15 15 0 0 0 246 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FULL</text>
<path d="M289,147 L 302,147 Q 314,147 314,132 L 314,109 L 314,94"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,192 219,196 219,188" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,177 Q 204,192 215,192 L 225,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,207L287,207A15 15 0 0 0 302 192A15 15 0 0 0 287 177L246,177A15 15 0 0 0 231 192A15 15 0 0 0 246 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="192" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INNER</text>
<polygon points="475,192 463,196 463,188" style="fill:rgb(0,0,0)"/>
<path d="M302,192L469,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,192 L 482,192 Q 490,192 490,185 L 490,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,238 219,242 219,233" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,223 Q 24,238 39,238 L 210,238 L 225,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,253L287,253A15 15 0 0 0 303 238A15 15 0 0 0 287 222L246,222A15 15 0 0 0 231 238A15 15 0 0 0 246 253Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="238" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CROSS</text>
<polygon points="475,238 463,242 463,233" style="fill:rgb(0,0,0)"/>
<path d="M303,238L469,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,238 L 482,238 Q 490,238 490,223 L 490,71 L 490,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/qualified-table-name.html">qualified-table-name:</a></b>
<button id='x1c06a3cc' onclick='hideorshow("x1c06a3cc","x1f921ba2")'>show</button></p>
 <div id='x1f921ba2' style='display:none;' class='imgcontainer'>
 <div style="max-width:599px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 599.746 182.736">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L156,32A15 15 0 0 0 171 17A15 15 0 0 0 156 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,17 183,21 183,12" style="fill:rgb(0,0,0)"/>
<path d="M171,17L189,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,32A15 15 0 0 0 225 17A15 15 0 0 0 210 2A15 15 0 0 0 195 17A15 15 0 0 0 210 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,17 249,21 249,12" style="fill:rgb(0,0,0)"/>
<path d="M225,17L255,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,32L351,32A15 15 0 0 0 366 17A15 15 0 0 0 351 2L276,2A15 15 0 0 0 261 17A15 15 0 0 0 276 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="408,44 396,48 396,40" style="fill:rgb(0,0,0)"/>
<path d="M366,17 L 374,17 Q 381,17 381,30 Q 381,44 392,44 L 402,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,59L427,59A15 15 0 0 0 442 44L442,44A15 15 0 0 0 427 29L423,29A15 15 0 0 0 408 44L408,44A15 15 0 0 0 423 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="465,44 453,48 453,40" style="fill:rgb(0,0,0)"/>
<path d="M442,44L459,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,59L501,59A15 15 0 0 0 516 44L516,44A15 15 0 0 0 501 29L480,29A15 15 0 0 0 465 44L465,44A15 15 0 0 0 480 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="490" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">alias</text>
<polygon points="539,44 527,48 527,40" style="fill:rgb(0,0,0)"/>
<path d="M516,44L533,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,44 L 546,44 Q 554,44 554,51 L 554,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="453,17 442,21 442,12" style="fill:rgb(0,0,0)"/>
<path d="M366,17L448,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,44 97,48 97,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 39,44 L 87,44 L 102,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M108,44 L 225,44 Q 240,44 240,30 Q 240,17 247,17 L 255,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,142L301,142A15 15 0 0 0 316 127A15 15 0 0 0 301 112L236,112A15 15 0 0 0 221 127A15 15 0 0 0 236 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="339,127 327,131 327,123" style="fill:rgb(0,0,0)"/>
<path d="M316,127L333,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,142L358,142A15 15 0 0 0 373 127A15 15 0 0 0 358 112L354,112A15 15 0 0 0 339 127A15 15 0 0 0 354 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="396,127 385,131 385,123" style="fill:rgb(0,0,0)"/>
<path d="M373,127L390,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M411,142L490,142A15 15 0 0 0 505 127A15 15 0 0 0 490 112L411,112A15 15 0 0 0 396 127A15 15 0 0 0 411 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="451" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M236,180L256,180A15 15 0 0 0 271 165A15 15 0 0 0 256 150L236,150A15 15 0 0 0 221 165A15 15 0 0 0 236 180Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="165" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="294,165 283,169 283,161" style="fill:rgb(0,0,0)"/>
<path d="M271,165L289,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,180L374,180A15 15 0 0 0 389 165A15 15 0 0 0 374 150L310,150A15 15 0 0 0 294 165A15 15 0 0 0 310 180Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="342" y="165" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="554,74 550,62 558,62" style="fill:rgb(0,0,0)"/>
<path d="M453,17 L 539,17 Q 554,17 554,32 L 554,53 L 554,68"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 325,85 325,94" style="fill:rgb(0,0,0)"/>
<path d="M554,74 L 554,82 Q 554,89 539,89 L 334,89 L 319,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="221,127 210,131 210,123" style="fill:rgb(0,0,0)"/>
<path d="M313,89 L 210,89 Q 195,89 195,104 L 195,112 Q 195,127 205,127 L 215,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="221,165 210,169 210,161" style="fill:rgb(0,0,0)"/>
<path d="M195,112 L 195,150 Q 195,165 205,165 L 215,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="554,114 550,102 558,102" style="fill:rgb(0,0,0)"/>
<path d="M554,74L554,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="590,165 578,169 578,161" style="fill:rgb(0,0,0)"/>
<path d="M554,114 L 554,150 Q 554,165 569,165 L 569,165 L 584,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="593" cy="165" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="539,127 527,131 527,123" style="fill:rgb(0,0,0)"/>
<path d="M505,127L533,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,127 L 546,127 Q 554,127 554,135 L 554,142"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M389,165L578,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/returning-clause.html">returning-clause:</a></b>
<button id='x58198df6' onclick='hideorshow("x58198df6","x7eea1edc")'>show</button></p>
 <div id='x7eea1edc' style='display:none;' class='imgcontainer'>
 <div style="max-width:628px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 628.709 140.4">
<circle cx="5" cy="47" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="27,47 15,51 15,43" style="fill:rgb(0,0,0)"/>
<path d="M9,47L21,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M42,62L132,62A15 15 0 0 0 147 47A15 15 0 0 0 132 32L42,32A15 15 0 0 0 27 47A15 15 0 0 0 42 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RETURNING</text>
<polygon points="237,47 226,51 226,43" style="fill:rgb(0,0,0)"/>
<path d="M147,47L232,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M237,62L287,62L287,32L237,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="262" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="328,77 317,82 317,73" style="fill:rgb(0,0,0)"/>
<path d="M287,47 L 294,47 Q 302,47 302,62 L 302,62 Q 302,77 312,77 L 322,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M343,92L347,92A15 15 0 0 0 362 77L362,77A15 15 0 0 0 347 62L343,62A15 15 0 0 0 328 77L328,77A15 15 0 0 0 343 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="398,77 387,82 387,73" style="fill:rgb(0,0,0)"/>
<path d="M362,77L393,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M414,92L501,92A15 15 0 0 0 516 77L516,77A15 15 0 0 0 501 62L414,62A15 15 0 0 0 398 77L398,77A15 15 0 0 0 414 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="457" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="539,77 528,82 528,73" style="fill:rgb(0,0,0)"/>
<path d="M516,77L534,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="581,47 569,51 569,43" style="fill:rgb(0,0,0)"/>
<path d="M539,77 L 547,77 Q 554,77 554,62 L 554,62 Q 554,47 565,47 L 575,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="619,47 607,51 607,43" style="fill:rgb(0,0,0)"/>
<path d="M581,47L613,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="622" cy="47" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="345,101 334,106 334,97" style="fill:rgb(0,0,0)"/>
<path d="M302,62 L 302,86 Q 302,101 317,101 L 325,101 L 340,101"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,101 L 362,101 Q 377,101 377,89 Q 377,77 385,77 L 392,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="453,47 441,51 441,43" style="fill:rgb(0,0,0)"/>
<path d="M287,47L447,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,47L607,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,138A15 15 0 0 0 406 123A15 15 0 0 0 391 108A15 15 0 0 0 376 123A15 15 0 0 0 391 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="391" y="123" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="376,123 365,127 365,118" style="fill:rgb(0,0,0)"/>
<path d="M147,47 L 196,47 Q 211,47 211,62 L 211,108 Q 211,123 226,123 L 355,123 L 370,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="539,123 528,127 528,118" style="fill:rgb(0,0,0)"/>
<path d="M406,123L534,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,123 L 547,123 Q 554,123 554,108 L 554,77 L 554,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,32A15 15 0 0 0 406 17A15 15 0 0 0 391 2A15 15 0 0 0 376 17A15 15 0 0 0 391 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="391" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="406,17 418,12 418,21" style="fill:rgb(0,0,0)"/>
<path d="M581,47 L 588,47 Q 596,47 596,32 L 596,32 Q 596,17 581,17 L 427,17 L 412,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="186,47 174,51 174,43" style="fill:rgb(0,0,0)"/>
<path d="M376,17 L 174,17 Q 159,17 159,32 L 159,32 Q 159,47 169,47 L 180,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/table-or-subquery.html">table-or-subquery:</a></b>
<button id='xcaf056ba' onclick='hideorshow("xcaf056ba","xeb311e9c")'>show</button></p>
 <div id='xeb311e9c' style='display:none;' class='imgcontainer'>
 <div style="max-width:720px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 720.778 457.704">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,74 39,78 39,70" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,59 Q 24,74 34,74 L 45,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,89L162,89A15 15 0 0 0 177 74L177,74A15 15 0 0 0 162 59L66,59A15 15 0 0 0 50 74L50,74A15 15 0 0 0 66 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="194,74 183,78 183,70" style="fill:rgb(0,0,0)"/>
<path d="M177,74L189,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,89A15 15 0 0 0 225 74L225,74A15 15 0 0 0 209 59A15 15 0 0 0 194 74L194,74A15 15 0 0 0 209 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="266,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M225,74 L 232,74 Q 240,74 240,59 L 240,51 Q 240,36 250,36 L 260,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,51L356,51A15 15 0 0 0 371 36A15 15 0 0 0 356 21L281,21A15 15 0 0 0 266 36A15 15 0 0 0 281 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="407,36 396,41 396,32" style="fill:rgb(0,0,0)"/>
<path d="M371,36L402,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,51L427,51A15 15 0 0 0 442 36A15 15 0 0 0 427 21L423,21A15 15 0 0 0 407 36A15 15 0 0 0 423 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="478,36 466,41 466,32" style="fill:rgb(0,0,0)"/>
<path d="M442,36L472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,51L561,51A15 15 0 0 0 577 36A15 15 0 0 0 561 21L493,21A15 15 0 0 0 478 36A15 15 0 0 0 493 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="527" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<path d="M9,36L255,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="422,6 411,10 411,2" style="fill:rgb(0,0,0)"/>
<path d="M371,36 L 379,36 Q 386,36 386,21 L 386,21 Q 386,6 401,6 L 402,6 L 417,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 442,6 Q 457,6 457,21 L 457,21 Q 457,36 464,36 L 472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 577,6 Q 592,6 592,21 L 592,21 Q 592,36 599,36 L 607,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,127L388,127A15 15 0 0 0 403 112A15 15 0 0 0 388 97L323,97A15 15 0 0 0 308 112A15 15 0 0 0 323 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="426,112 415,116 415,108" style="fill:rgb(0,0,0)"/>
<path d="M403,112L420,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,127L445,127A15 15 0 0 0 460 112A15 15 0 0 0 445 97L441,97A15 15 0 0 0 426 112A15 15 0 0 0 441 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="443" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="483,112 472,116 472,108" style="fill:rgb(0,0,0)"/>
<path d="M460,112L478,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,127L577,127A15 15 0 0 0 592 112A15 15 0 0 0 577 97L499,97A15 15 0 0 0 483 112A15 15 0 0 0 499 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="538" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M323,165L343,165A15 15 0 0 0 359 150A15 15 0 0 0 343 135L323,135A15 15 0 0 0 308 150A15 15 0 0 0 323 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="382,150 370,154 370,145" style="fill:rgb(0,0,0)"/>
<path d="M359,150L376,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,165L461,165A15 15 0 0 0 476 150A15 15 0 0 0 461 135L397,135A15 15 0 0 0 382 150A15 15 0 0 0 397 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="527,74 539,70 539,78" style="fill:rgb(0,0,0)"/>
<path d="M577,36 L 607,36 Q 622,36 622,51 L 622,59 Q 622,74 607,74 L 548,74 L 533,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,150 297,154 297,145" style="fill:rgb(0,0,0)"/>
<path d="M527,74 L 297,74 Q 282,74 282,89 L 282,135 Q 282,150 292,150 L 302,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,112 297,116 297,108" style="fill:rgb(0,0,0)"/>
<path d="M282,97 L 282,104 Q 282,112 292,112 L 302,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="266,213 255,217 255,209" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,198 Q 24,213 39,213 L 245,213 L 260,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,228L431,228A15 15 0 0 0 446 213A15 15 0 0 0 431 198L281,198A15 15 0 0 0 266 213A15 15 0 0 0 281 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function-name</text>
<polygon points="463,213 452,217 452,209" style="fill:rgb(0,0,0)"/>
<path d="M446,213L457,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,228A15 15 0 0 0 493 213A15 15 0 0 0 478 198A15 15 0 0 0 463 213A15 15 0 0 0 478 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="529,213 518,217 518,209" style="fill:rgb(0,0,0)"/>
<path d="M493,213L524,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M529,228L579,228L579,198L529,198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="615,213 603,217 603,209" style="fill:rgb(0,0,0)"/>
<path d="M579,213L609,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M630,228A15 15 0 0 0 645 213A15 15 0 0 0 630 198A15 15 0 0 0 615 213A15 15 0 0 0 630 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="630" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="675,187 679,198 671,198" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 660,213 Q 675,213 675,203 L 675,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M554,190A15 15 0 0 0 569 175A15 15 0 0 0 554 160A15 15 0 0 0 539 175A15 15 0 0 0 554 190Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="175" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="569,175 581,171 581,180" style="fill:rgb(0,0,0)"/>
<path d="M579,213 L 586,213 Q 594,213 594,198 L 594,190 Q 594,175 584,175 L 575,175"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,175 L 518,175 Q 503,175 503,190 L 503,198 Q 503,213 510,213 L 518,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,74 L 232,74 Q 240,74 240,89 L 240,198 Q 240,213 247,213 L 255,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,112 648,116 648,108" style="fill:rgb(0,0,0)"/>
<path d="M592,112L654,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,112 L 667,112 Q 675,112 675,104 L 675,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,150 648,154 648,145" style="fill:rgb(0,0,0)"/>
<path d="M476,150L654,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,150 L 667,150 Q 675,150 675,142 L 675,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M577,36L690,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,304L411,304A15 15 0 0 0 426 289A15 15 0 0 0 411 274L407,274A15 15 0 0 0 392 289A15 15 0 0 0 407 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="498,289 487,293 487,284" style="fill:rgb(0,0,0)"/>
<path d="M426,289L492,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M513,304L582,304A15 15 0 0 0 597 289A15 15 0 0 0 582 274L513,274A15 15 0 0 0 498 289A15 15 0 0 0 513 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="548" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<polygon points="660,289 648,293 648,284" style="fill:rgb(0,0,0)"/>
<path d="M597,289L654,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,289 L 667,289 Q 675,289 675,281 L 675,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="548,251 559,247 559,255" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 652,213 Q 660,213 660,228 L 660,236 Q 660,251 645,251 L 568,251 L 553,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M548,251 L 370,251 Q 355,251 355,266 L 355,274 Q 355,289 370,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,251 L 464,251 Q 457,251 457,266 L 457,274 Q 457,289 464,289 L 472,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,327 39,331 39,322" style="fill:rgb(0,0,0)"/>
<path d="M24,198 L 24,312 Q 24,327 34,327 L 45,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,342A15 15 0 0 0 81 327A15 15 0 0 0 66 311A15 15 0 0 0 50 327A15 15 0 0 0 66 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,327 92,331 92,322" style="fill:rgb(0,0,0)"/>
<path d="M81,327L98,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,342L208,342L208,311L104,311Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="327" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="231,327 219,331 219,322" style="fill:rgb(0,0,0)"/>
<path d="M208,327L225,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,342A15 15 0 0 0 261 327A15 15 0 0 0 246 311A15 15 0 0 0 231 327A15 15 0 0 0 246 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M261,327 L 269,327 Q 276,327 276,312 L 276,304 Q 276,289 291,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,327 648,331 648,322" style="fill:rgb(0,0,0)"/>
<path d="M261,327L654,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,327 L 667,327 Q 675,327 675,319 L 675,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,327 L 432,327 Q 439,327 439,312 L 439,304 Q 439,289 447,289 L 454,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,364 39,369 39,360" style="fill:rgb(0,0,0)"/>
<path d="M24,311 L 24,349 Q 24,364 34,364 L 45,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,379A15 15 0 0 0 81 364A15 15 0 0 0 65 349A15 15 0 0 0 50 364A15 15 0 0 0 65 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="135,364 123,369 123,360" style="fill:rgb(0,0,0)"/>
<path d="M81,364L129,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,379L296,379L296,349L135,349Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="364" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="350,364 338,369 338,360" style="fill:rgb(0,0,0)"/>
<path d="M296,364L344,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,379A15 15 0 0 0 380 364A15 15 0 0 0 365 349A15 15 0 0 0 350 364A15 15 0 0 0 365 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="660,364 648,369 648,360" style="fill:rgb(0,0,0)"/>
<path d="M380,364L654,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="711,36 699,41 699,32" style="fill:rgb(0,0,0)"/>
<path d="M660,364 L 667,364 Q 675,364 675,349 L 675,51 Q 675,36 690,36 L 690,36 L 705,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="715" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,417A15 15 0 0 0 230 402A15 15 0 0 0 215 387A15 15 0 0 0 200 402A15 15 0 0 0 215 417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="402" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="230,402 242,398 242,406" style="fill:rgb(0,0,0)"/>
<path d="M296,364 L 303,364 Q 311,364 311,379 L 311,387 Q 311,402 296,402 L 251,402 L 236,402"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,402 L 123,402 Q 108,402 108,387 L 108,379 Q 108,364 116,364 L 123,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="122,440 111,444 111,436" style="fill:rgb(0,0,0)"/>
<path d="M81,364 L 88,364 Q 96,364 96,379 L 96,425 Q 96,440 106,440 L 116,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M122,455L224,455L224,425L122,425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M224,440 L 308,440 Q 323,440 323,425 L 323,379 Q 323,364 331,364 L 338,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/select-stmt.html">select-stmt:</a></b>
<button id='xd2a8dfb9' onclick='hideorshow("xd2a8dfb9","x1657bd9a")'>show</button></p>
 <div id='x1657bd9a' style='display:none;' class='imgcontainer'>
 <div style="max-width:669px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 669.677 1162.3">
<path d="M55,845L667,845L667,99L55,99Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="6" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="46,17 34,21 34,12" style="fill:rgb(0,0,0)"/>
<path d="M10,17L40,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M61,32L92,32A15 15 0 0 0 107 17A15 15 0 0 0 92 2L61,2A15 15 0 0 0 46 17A15 15 0 0 0 61 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="76" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M167,62L253,62A15 15 0 0 0 268 47L268,47A15 15 0 0 0 253 32L167,32A15 15 0 0 0 152 47L152,47A15 15 0 0 0 167 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="210,17 198,21 198,12" style="fill:rgb(0,0,0)"/>
<path d="M107,17L204,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M210,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M358,32L584,32L584,2L358,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="152,47 140,51 140,43" style="fill:rgb(0,0,0)"/>
<path d="M107,17 L 114,17 Q 122,17 122,32 L 122,32 Q 122,47 134,47 L 146,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="291,47 279,51 279,43" style="fill:rgb(0,0,0)"/>
<path d="M268,47L285,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,47 L 298,47 Q 306,47 306,32 L 306,32 Q 306,17 321,17 L 331,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,70A15 15 0 0 0 486 55L486,55A15 15 0 0 0 471 39A15 15 0 0 0 456 55L456,55A15 15 0 0 0 471 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="486,55 498,50 498,59" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,40 Q 599,55 584,55 L 507,55 L 492,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,55 L 350,55 Q 335,55 335,40 L 335,32 Q 335,17 340,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,83 307,79 307,88" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,68 Q 599,83 584,83 L 316,83 L 301,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,83 L 40,83 Q 25,83 25,98 L 25,113"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="25,47 20,36 29,36" style="fill:rgb(0,0,0)"/>
<path d="M10,17 L 17,17 Q 25,17 25,29 L 25,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="55,129 43,133 43,124" style="fill:rgb(0,0,0)"/>
<path d="M25,47 L 25,114 Q 25,129 37,129 L 49,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,129 115,133 115,124" style="fill:rgb(0,0,0)"/>
<path d="M55,129L121,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,144L193,144A15 15 0 0 0 208 129A15 15 0 0 0 193 114L142,114A15 15 0 0 0 127 129A15 15 0 0 0 142 144Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="250,159 238,163 238,155" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,144 Q 223,159 233,159 L 244,159"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,174L333,174A15 15 0 0 0 348 159A15 15 0 0 0 333 144L265,144A15 15 0 0 0 250 159A15 15 0 0 0 265 174Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="159" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="417,129 406,133 406,124" style="fill:rgb(0,0,0)"/>
<path d="M348,159 L 356,159 Q 363,159 363,144 L 363,144 Q 363,129 378,129 L 396,129 L 411,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,144L545,144L545,114L417,114Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M481,182A15 15 0 0 0 496 166A15 15 0 0 0 481 151A15 15 0 0 0 466 166A15 15 0 0 0 481 182Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="166" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="496,166 508,162 508,171" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,151 Q 560,166 545,166 L 517,166 L 502,166"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M466,166 L 406,166 Q 391,166 391,151 L 391,144 Q 391,129 398,129 L 406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,129 287,133 287,124" style="fill:rgb(0,0,0)"/>
<path d="M208,129L293,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M299,129L406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,212L280,212A15 15 0 0 0 295 197A15 15 0 0 0 280 182L265,182A15 15 0 0 0 250 197A15 15 0 0 0 265 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="197" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="348,197 337,201 337,192" style="fill:rgb(0,0,0)"/>
<path d="M295,197L342,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,197 L 356,197 Q 363,197 363,182 L 363,159 L 363,144"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="250,197 238,201 238,192" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,182 Q 223,197 233,197 L 244,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,287L203,287A15 15 0 0 0 218 272A15 15 0 0 0 203 257L168,257A15 15 0 0 0 153 272A15 15 0 0 0 168 287Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="186" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="290,272 279,277 279,268" style="fill:rgb(0,0,0)"/>
<path d="M218,272L284,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,287L451,287L451,257L290,257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M320,362L422,362L422,331L320,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M371,324A15 15 0 0 0 386 309A15 15 0 0 0 371 293A15 15 0 0 0 356 309A15 15 0 0 0 371 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="386,309 397,304 397,313" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 459,272 Q 466,272 466,287 L 466,294 Q 466,309 451,309 L 407,309 L 392,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M356,309 L 279,309 Q 264,309 264,294 L 264,287 Q 264,272 271,272 L 279,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="320,346 308,351 308,342" style="fill:rgb(0,0,0)"/>
<path d="M218,272 L 226,272 Q 233,272 233,287 L 233,331 Q 233,346 248,346 L 299,346 L 314,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="484,313 488,325 480,325" style="fill:rgb(0,0,0)"/>
<path d="M422,346 L 436,346 Q 451,346 466,346 L 469,346 Q 484,346 484,333 L 484,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,272 494,277 494,268" style="fill:rgb(0,0,0)"/>
<path d="M484,313 L 484,287 Q 484,272 492,272 L 499,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,272 L 496,272 Q 487,272 487,272 Q 487,272 495,272 L 502,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,197 555,185 564,185" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,176 L 560,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,235 360,230 360,239" style="fill:rgb(0,0,0)"/>
<path d="M560,197 L 560,220 Q 560,235 545,235 L 369,235 L 354,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,272 142,277 142,268" style="fill:rgb(0,0,0)"/>
<path d="M348,235 L 142,235 Q 127,235 127,250 L 127,257 Q 127,272 137,272 L 147,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,437L218,437A15 15 0 0 0 233 422A15 15 0 0 0 218 407L168,407A15 15 0 0 0 153 422A15 15 0 0 0 168 437Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="256,422 244,426 244,418" style="fill:rgb(0,0,0)"/>
<path d="M233,422L250,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,437L305,437L305,407L256,407Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="517,324 513,312 521,312" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 502,272 Q 517,272 517,287 L 517,303 L 517,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,384 382,380 382,389" style="fill:rgb(0,0,0)"/>
<path d="M517,324 L 517,369 Q 517,384 502,384 L 391,384 L 376,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,422 142,426 142,418" style="fill:rgb(0,0,0)"/>
<path d="M371,384 L 142,384 Q 127,384 127,399 L 127,407 Q 127,422 137,422 L 147,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,324 122,312 131,312" style="fill:rgb(0,0,0)"/>
<path d="M127,257L127,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,324L127,407"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,535L212,535A15 15 0 0 0 227 520A15 15 0 0 0 212 505L168,505A15 15 0 0 0 153 520A15 15 0 0 0 168 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="250,520 238,525 238,516" style="fill:rgb(0,0,0)"/>
<path d="M227,520L244,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,535L269,535A15 15 0 0 0 284 520A15 15 0 0 0 269 505L265,505A15 15 0 0 0 250 520A15 15 0 0 0 265 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="320,520 309,525 309,516" style="fill:rgb(0,0,0)"/>
<path d="M284,520L314,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,535L369,535L369,505L320,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="452,520 441,525 441,516" style="fill:rgb(0,0,0)"/>
<path d="M369,520L446,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,535L520,535A15 15 0 0 0 535 520A15 15 0 0 0 520 505L467,505A15 15 0 0 0 452 520A15 15 0 0 0 467 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="558,520 546,525 546,516" style="fill:rgb(0,0,0)"/>
<path d="M535,520L552,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,535L607,535L607,505L558,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M345,573A15 15 0 0 0 360 558A15 15 0 0 0 345 543A15 15 0 0 0 330 558A15 15 0 0 0 345 573Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="558" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="360,558 371,554 371,562" style="fill:rgb(0,0,0)"/>
<path d="M369,520 L 377,520 Q 384,520 384,535 L 384,543 Q 384,558 375,558 L 366,558"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,558 L 309,558 Q 294,558 294,543 L 294,535 Q 294,520 301,520 L 309,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="514,551 503,555 503,546" style="fill:rgb(0,0,0)"/>
<path d="M411,520 L 418,520 Q 426,520 426,535 L 426,536 Q 426,551 441,551 L 493,551 L 508,551"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M514,551 L 607,551 Q 622,551 622,536 L 622,535 Q 622,520 630,520 L 637,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,490 256,494 256,486" style="fill:rgb(0,0,0)"/>
<path d="M127,460 L 127,475 Q 127,490 142,490 L 246,490 L 261,490"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,520 399,525 399,516" style="fill:rgb(0,0,0)"/>
<path d="M267,490 L 369,490 Q 384,490 384,505 L 384,505 Q 384,520 395,520 L 405,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,460 244,455 244,464" style="fill:rgb(0,0,0)"/>
<path d="M305,422 L 313,422 Q 320,422 320,437 L 320,445 Q 320,460 305,460 L 254,460 L 239,460"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,520 142,525 142,516" style="fill:rgb(0,0,0)"/>
<path d="M233,460 L 142,460 Q 127,460 127,475 L 127,505 Q 127,520 137,520 L 147,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,447 122,435 131,435" style="fill:rgb(0,0,0)"/>
<path d="M127,407L127,441"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,447L127,505"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,649L232,649A15 15 0 0 0 247 634A15 15 0 0 0 232 619L168,619A15 15 0 0 0 153 634A15 15 0 0 0 168 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="200" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="283,634 271,638 271,629" style="fill:rgb(0,0,0)"/>
<path d="M247,634L277,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,649L395,649A15 15 0 0 0 410 634A15 15 0 0 0 395 619L298,619A15 15 0 0 0 283 634A15 15 0 0 0 298 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="433,634 422,638 422,629" style="fill:rgb(0,0,0)"/>
<path d="M410,634L427,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,649L452,649A15 15 0 0 0 467 634A15 15 0 0 0 452 619L448,619A15 15 0 0 0 433 634A15 15 0 0 0 448 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="450" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="490,634 479,638 479,629" style="fill:rgb(0,0,0)"/>
<path d="M467,634L485,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,649L609,649L609,619L490,619Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="550" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M446,687A15 15 0 0 0 461 671A15 15 0 0 0 446 656A15 15 0 0 0 431 671A15 15 0 0 0 446 687Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="671" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="461,671 472,667 472,676" style="fill:rgb(0,0,0)"/>
<path d="M609,634 L 616,634 Q 624,634 624,649 L 624,656 Q 624,671 609,671 L 482,671 L 467,671"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,671 L 271,671 Q 256,671 256,656 L 256,649 Q 256,634 264,634 L 271,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="624,692 619,680 628,680" style="fill:rgb(0,0,0)"/>
<path d="M624,656L624,686"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,558 648,547 656,547" style="fill:rgb(0,0,0)"/>
<path d="M607,520 L 637,520 Q 652,520 652,535 L 652,537 L 652,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,596 382,592 382,600" style="fill:rgb(0,0,0)"/>
<path d="M652,558 L 652,581 Q 652,596 637,596 L 391,596 L 376,596"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,634 142,638 142,629" style="fill:rgb(0,0,0)"/>
<path d="M371,596 L 142,596 Q 127,596 127,611 L 127,619 Q 127,634 137,634 L 147,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,558 122,547 131,547" style="fill:rgb(0,0,0)"/>
<path d="M127,505L127,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,709 359,714 359,705" style="fill:rgb(0,0,0)"/>
<path d="M127,558 L 127,694 Q 127,709 142,709 L 350,709 L 365,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,709 597,714 597,705" style="fill:rgb(0,0,0)"/>
<path d="M371,709L603,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,709 L 616,709 Q 624,709 624,717 L 624,724"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,800L194,800A15 15 0 0 0 209 785A15 15 0 0 0 194 770L142,770A15 15 0 0 0 127 785A15 15 0 0 0 142 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="245,785 234,789 234,781" style="fill:rgb(0,0,0)"/>
<path d="M209,785L239,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,800A15 15 0 0 0 275 785A15 15 0 0 0 260 770A15 15 0 0 0 245 785A15 15 0 0 0 260 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="311,785 300,789 300,781" style="fill:rgb(0,0,0)"/>
<path d="M275,785L306,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,800L361,800L361,770L311,770Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="397,785 385,789 385,781" style="fill:rgb(0,0,0)"/>
<path d="M361,785L391,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,800A15 15 0 0 0 427 785A15 15 0 0 0 412 770A15 15 0 0 0 397 785A15 15 0 0 0 412 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="412" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="609,785 597,789 597,781" style="fill:rgb(0,0,0)"/>
<path d="M427,785L603,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,785 L 616,785 Q 624,785 624,792 L 624,800"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,762A15 15 0 0 0 351 747A15 15 0 0 0 336 732A15 15 0 0 0 321 747A15 15 0 0 0 336 762Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="747" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M336,838A15 15 0 0 0 351 823A15 15 0 0 0 336 808A15 15 0 0 0 321 823A15 15 0 0 0 336 838Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="823" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="351,747 363,743 363,751" style="fill:rgb(0,0,0)"/>
<path d="M361,785 L 368,785 Q 376,785 376,770 L 376,762 Q 376,747 366,747 L 357,747"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,747 L 300,747 Q 285,747 285,762 L 285,770 Q 285,785 292,785 L 300,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,823 363,818 363,827" style="fill:rgb(0,0,0)"/>
<path d="M427,785 L 434,785 Q 442,785 442,800 L 442,808 Q 442,823 427,823 L 372,823 L 357,823"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,823 L 234,823 Q 219,823 219,808 L 219,800 Q 219,785 226,785 L 234,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,785 115,789 115,781" style="fill:rgb(0,0,0)"/>
<path d="M55,129 L 62,129 Q 70,129 70,144 L 70,770 Q 70,785 85,785 L 106,785 L 121,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,891L424,891L424,860L248,860Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="876" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="424,876 436,871 436,880" style="fill:rgb(0,0,0)"/>
<path d="M624,692 L 624,861 Q 624,876 609,876 L 445,876 L 430,876"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="6,197 10,208 2,208" style="fill:rgb(0,0,0)"/>
<path d="M248,876 L 21,876 Q 6,876 6,861 L 6,217 L 6,202"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M6,197 L 6,144 Q 6,129 21,129 L 40,129 L 55,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="667" y="275" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" transform="rotate(-90 667,285)" dominant-baseline="central">select-core</text>
<path d="M168,966L213,966A15 15 0 0 0 228 951A15 15 0 0 0 213 936L168,936A15 15 0 0 0 153 951A15 15 0 0 0 168 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="251,951 239,956 239,947" style="fill:rgb(0,0,0)"/>
<path d="M228,951L245,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,966L270,966A15 15 0 0 0 285 951A15 15 0 0 0 270 936L266,936A15 15 0 0 0 251 951A15 15 0 0 0 266 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M168,1072L202,1072A15 15 0 0 0 217 1057A15 15 0 0 0 202 1042L168,1042A15 15 0 0 0 153 1057A15 15 0 0 0 168 1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="240,1057 228,1061 228,1053" style="fill:rgb(0,0,0)"/>
<path d="M217,1057L234,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,1072L289,1072L289,1042L240,1042Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="330,951 319,956 319,947" style="fill:rgb(0,0,0)"/>
<path d="M285,951L324,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,966L460,966L460,936L330,936Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M395,1004A15 15 0 0 0 410 989A15 15 0 0 0 395 974A15 15 0 0 0 380 989A15 15 0 0 0 395 1004Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="989" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="410,989 422,985 422,993" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 468,951 Q 475,951 475,966 L 475,974 Q 475,989 460,989 L 431,989 L 416,989"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,989 L 322,989 Q 307,989 307,974 L 307,966 Q 307,951 313,951 L 319,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,913 348,909 348,918" style="fill:rgb(0,0,0)"/>
<path d="M624,860 L 624,898 Q 624,913 609,913 L 357,913 L 342,913"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,951 142,956 142,947" style="fill:rgb(0,0,0)"/>
<path d="M336,913 L 142,913 Q 127,913 127,928 L 127,936 Q 127,951 137,951 L 147,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,981 492,970 500,970" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 481,951 Q 496,951 496,963 L 496,976"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,1023 318,1019 318,1027" style="fill:rgb(0,0,0)"/>
<path d="M496,981 L 496,1008 Q 496,1023 481,1023 L 327,1023 L 312,1023"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,1057 142,1061 142,1053" style="fill:rgb(0,0,0)"/>
<path d="M307,1023 L 142,1023 Q 127,1023 127,1038 L 127,1042 Q 127,1057 137,1057 L 147,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,989 122,978 131,978" style="fill:rgb(0,0,0)"/>
<path d="M127,936L127,983"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,989L127,1042"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1102L415,1102A15 15 0 0 0 430 1087A15 15 0 0 0 415 1072L363,1072A15 15 0 0 0 348 1087A15 15 0 0 0 363 1102Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="389" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="453,1087 441,1092 441,1083" style="fill:rgb(0,0,0)"/>
<path d="M430,1087L447,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,1102L502,1102L502,1072L453,1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="525,1087 513,1092 513,1083" style="fill:rgb(0,0,0)"/>
<path d="M502,1087L519,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1140A15 15 0 0 0 378 1125A15 15 0 0 0 363 1110A15 15 0 0 0 348 1125A15 15 0 0 0 363 1140Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="1125" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="401,1125 390,1129 390,1121" style="fill:rgb(0,0,0)"/>
<path d="M378,1125L396,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,1140L451,1140L451,1110L401,1110Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="1125" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="312,1057 301,1061 301,1053" style="fill:rgb(0,0,0)"/>
<path d="M289,1057L306,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1125 337,1129 337,1121" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1110 Q 327,1125 335,1125 L 342,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1087 337,1092 337,1083" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1072 Q 327,1087 335,1087 L 342,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1057 513,1061 513,1053" style="fill:rgb(0,0,0)"/>
<path d="M312,1057L519,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="620,1155 609,1160 609,1151" style="fill:rgb(0,0,0)"/>
<path d="M525,1057 L 546,1057 Q 561,1057 561,1072 L 561,1140 Q 561,1155 576,1155 L 599,1155 L 614,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="624" cy="1155" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1087 L 546,1087 Q 561,1087 561,1095 L 561,1102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1125 513,1129 513,1121" style="fill:rgb(0,0,0)"/>
<path d="M451,1125L519,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1125 L 546,1125 Q 561,1125 561,1133 L 561,1140"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1155 513,1160 513,1151" style="fill:rgb(0,0,0)"/>
<path d="M127,1042 L 127,1140 Q 127,1155 142,1155 L 504,1155 L 519,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1155L597,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/compound-operator.html">compound-operator:</a></b>
<button id='xea8c3f6d' onclick='hideorshow("xea8c3f6d","xd74a299f")'>show</button></p>
 <div id='xd74a299f' style='display:none;' class='imgcontainer'>
 <div style="max-width:293px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 293.842 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L127,32A15 15 0 0 0 142 17A15 15 0 0 0 127 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,70L127,70A15 15 0 0 0 142 55L142,55A15 15 0 0 0 127 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,108L168,108A15 15 0 0 0 183 92A15 15 0 0 0 168 77L83,77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M83,145L135,145A15 15 0 0 0 150 130A15 15 0 0 0 135 115L83,115A15 15 0 0 0 68 130A15 15 0 0 0 83 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M142,55L159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70L195,70A15 15 0 0 0 210 55L210,55A15 15 0 0 0 195 39L180,39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="233,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M210,55L227,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,17 272,21 272,12" style="fill:rgb(0,0,0)"/>
<path d="M233,55 L 240,55 Q 248,55 248,40 L 248,32 Q 248,17 263,17 L 263,17 L 278,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="288" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M47,39 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,92 221,97 221,88" style="fill:rgb(0,0,0)"/>
<path d="M183,92L227,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,92 L 240,92 Q 248,92 248,77 L 248,54 L 248,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,130 56,135 56,126" style="fill:rgb(0,0,0)"/>
<path d="M47,77 L 47,115 Q 47,130 55,130 L 62,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,130 221,135 221,126" style="fill:rgb(0,0,0)"/>
<path d="M150,130L227,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,130 L 240,130 Q 248,130 248,115 L 248,92 L 248,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='xa722454f' onclick='hideorshow("xa722454f","x81ca72fe")'>show</button></p>
 <div id='x81ca72fe' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/result-column.html">result-column:</a></b>
<button id='xbd189c2f' onclick='hideorshow("xbd189c2f","x51de2d40")'>show</button></p>
 <div id='x51de2d40' style='display:none;' class='imgcontainer'>
 <div style="max-width:398px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 398.054 163.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L94,32L94,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="136,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M94,17 L 102,17 Q 109,17 109,32 L 109,40 Q 109,55 119,55 L 130,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M151,70L155,70A15 15 0 0 0 170 55L170,55A15 15 0 0 0 155 39L151,39A15 15 0 0 0 136 55L136,55A15 15 0 0 0 151 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="206,55 194,59 194,50" style="fill:rgb(0,0,0)"/>
<path d="M170,55L200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,70L309,70A15 15 0 0 0 324 55L324,55A15 15 0 0 0 309 39L221,39A15 15 0 0 0 206 55L206,55A15 15 0 0 0 221 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="347,55 335,59 335,50" style="fill:rgb(0,0,0)"/>
<path d="M324,55L341,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,17 377,21 377,12" style="fill:rgb(0,0,0)"/>
<path d="M347,55 L 354,55 Q 362,55 362,40 L 362,32 Q 362,17 372,17 L 382,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="392" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,85 141,89 141,81" style="fill:rgb(0,0,0)"/>
<path d="M109,39 L 109,70 Q 109,85 124,85 L 132,85 L 147,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,85 L 170,85 Q 185,85 185,70 L 185,70 Q 185,55 192,55 L 200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="241,17 230,21 230,12" style="fill:rgb(0,0,0)"/>
<path d="M94,17L235,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M241,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,108 39,112 39,103" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,93 Q 24,108 34,108 L 45,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,123A15 15 0 0 0 81 108A15 15 0 0 0 66 92A15 15 0 0 0 50 108A15 15 0 0 0 66 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="108" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,108 335,112 335,103" style="fill:rgb(0,0,0)"/>
<path d="M81,108L341,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,108 L 354,108 Q 362,108 362,93 L 362,54 L 362,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,145 39,150 39,141" style="fill:rgb(0,0,0)"/>
<path d="M24,92 L 24,130 Q 24,145 34,145 L 45,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,160L141,160A15 15 0 0 0 156 145A15 15 0 0 0 141 130L66,130A15 15 0 0 0 50 145A15 15 0 0 0 66 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="145" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="179,145 167,150 167,141" style="fill:rgb(0,0,0)"/>
<path d="M156,145L173,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M194,160A15 15 0 0 0 209 145A15 15 0 0 0 194 130A15 15 0 0 0 179 145A15 15 0 0 0 194 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="232,145 221,150 221,141" style="fill:rgb(0,0,0)"/>
<path d="M209,145L226,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,160A15 15 0 0 0 262 145A15 15 0 0 0 247 130A15 15 0 0 0 232 145A15 15 0 0 0 247 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,145 335,150 335,141" style="fill:rgb(0,0,0)"/>
<path d="M262,145L341,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,145 L 354,145 Q 362,145 362,130 L 362,107 L 362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/window-defn.html">window-defn:</a></b>
<button id='x05858b97' onclick='hideorshow("x05858b97","x106db164")'>show</button></p>
 <div id='x106db164' style='display:none;' class='imgcontainer'>
 <div style="max-width:479px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 479.765 380.592">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,44 92,48 92,40" style="fill:rgb(0,0,0)"/>
<path d="M62,17 L 70,17 Q 77,17 77,30 Q 77,44 88,44 L 98,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,59L260,59A15 15 0 0 0 275 44L275,44A15 15 0 0 0 260 29L119,29A15 15 0 0 0 104 44L104,44A15 15 0 0 0 119 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M119,135L198,135A15 15 0 0 0 214 120A15 15 0 0 0 198 104L119,104A15 15 0 0 0 104 120A15 15 0 0 0 119 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="237,120 225,124 225,115" style="fill:rgb(0,0,0)"/>
<path d="M214,120L231,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M252,135L256,135A15 15 0 0 0 271 120A15 15 0 0 0 256 104L252,104A15 15 0 0 0 237 120A15 15 0 0 0 252 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="307,120 295,124 295,115" style="fill:rgb(0,0,0)"/>
<path d="M271,120L301,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,135L356,135L356,104L307,104Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M332,173A15 15 0 0 0 347 157A15 15 0 0 0 332 142A15 15 0 0 0 316 157A15 15 0 0 0 332 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="157" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="347,157 358,153 358,162" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,142 Q 371,157 362,157 L 352,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,157 L 295,157 Q 280,157 280,142 L 280,135 Q 280,120 288,120 L 295,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,17 178,21 178,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L184,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,82 201,77 201,86" style="fill:rgb(0,0,0)"/>
<path d="M190,17 L 298,17 Q 313,17 313,32 L 313,67 Q 313,82 298,82 L 210,82 L 195,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,120 92,124 92,115" style="fill:rgb(0,0,0)"/>
<path d="M190,82 L 77,82 Q 62,82 62,97 L 62,105 Q 62,120 77,120 L 83,120 L 98,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,44 287,48 287,40" style="fill:rgb(0,0,0)"/>
<path d="M275,44L293,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,44 L 306,44 Q 313,44 313,51 L 313,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,248L163,248A15 15 0 0 0 178 233A15 15 0 0 0 163 218L119,218A15 15 0 0 0 104 233A15 15 0 0 0 119 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="201,233 190,237 190,229" style="fill:rgb(0,0,0)"/>
<path d="M178,233L196,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,248L221,248A15 15 0 0 0 236 233A15 15 0 0 0 221 218L217,218A15 15 0 0 0 201 233A15 15 0 0 0 217 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="272,233 260,237 260,229" style="fill:rgb(0,0,0)"/>
<path d="M236,233L266,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,248L402,248L402,218L272,218Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M337,286A15 15 0 0 0 352 271A15 15 0 0 0 337 256A15 15 0 0 0 322 271A15 15 0 0 0 337 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="352,271 363,266 363,275" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,256 Q 417,271 402,271 L 373,271 L 358,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M322,271 L 260,271 Q 245,271 245,256 L 245,248 Q 245,233 253,233 L 260,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,195 201,191 201,200" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,180 Q 371,195 356,195 L 210,195 L 195,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,233 92,237 92,229" style="fill:rgb(0,0,0)"/>
<path d="M190,195 L 77,195 Q 62,195 62,210 L 62,218 Q 62,233 77,233 L 83,233 L 98,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,157 58,146 66,146" style="fill:rgb(0,0,0)"/>
<path d="M62,104L62,152"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,157L62,218"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,362L208,362L208,331L104,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="417,346 405,351 405,342" style="fill:rgb(0,0,0)"/>
<path d="M208,346L411,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,362A15 15 0 0 0 447 346A15 15 0 0 0 432 331A15 15 0 0 0 417 346A15 15 0 0 0 432 362Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="470,346 458,351 458,342" style="fill:rgb(0,0,0)"/>
<path d="M447,346L464,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="474" cy="346" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,309 201,304 201,313" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,294 Q 417,309 402,309 L 210,309 L 195,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,346 92,351 92,342" style="fill:rgb(0,0,0)"/>
<path d="M190,309 L 77,309 Q 62,309 62,324 L 62,331 Q 62,346 77,346 L 83,346 L 98,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,271 58,259 66,259" style="fill:rgb(0,0,0)"/>
<path d="M62,218L62,265"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,271L62,331"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,374 144,378 144,369" style="fill:rgb(0,0,0)"/>
<path d="M62,331 L 62,359 Q 62,374 77,374 L 135,374 L 150,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,346 266,351 266,342" style="fill:rgb(0,0,0)"/>
<path d="M156,374 L 233,374 Q 248,374 248,360 Q 248,346 260,346 L 272,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x17052127' onclick='hideorshow("x17052127","x15ba4536")'>show</button></p>
 <div id='x15ba4536' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
</div>
</div>


<p>An UPDATE statement is used to modify a subset of the values stored in 
zero or more rows of the database table identified by the 
<a href="syntax/qualified-table-name.html">qualified-table-name</a> specified as part of the UPDATE statement.

</p><h1 id="details"><span>2. </span>Details</h1>

<p>If the UPDATE statement does not have a WHERE clause, all rows in the
table are modified by the UPDATE. Otherwise, the UPDATE affects only those
rows for which the WHERE clause
<a href="lang_expr.html#booleanexpr">boolean expression is true</a>. It is not an error if the
WHERE clause does not evaluate to true for any row in the table - this just
means that the UPDATE statement affects zero rows.

</p><p>The modifications made to each row affected by an UPDATE statement are
determined by the list of assignments following the SET keyword. Each
assignment specifies a <span class='yyterm'>column-name</span> to the left of the 
equals sign and a scalar expression to the right. 
For each affected row, the named columns
are set to the values found by evaluating the corresponding scalar 
expressions. If a single column-name appears more than once in the list of
assignment expressions, all but the rightmost occurrence is ignored. Columns
that do not appear in the list of assignments are left unmodified. The scalar
expressions may refer to columns of the row being updated. In this case all
scalar expressions are evaluated before any assignments are made.

</p><p>Beginning in SQLite <a href="releaselog/3_15_0.html">version 3.15.0</a> (2016-10-14), an assignment in
the SET clause can be a 
<a href="syntax/column-name-list.html">parenthesized list of column names</a> on the left and a
<a href="rowvalue.html">row value</a> of the same size on the right.


</p><p>The optional "OR <i>action</i>" conflict clause that follows the
UPDATE keyword allows the user to nominate a specific
constraint conflict resolution algorithm to use during this one UPDATE command.
Refer to the section entitled <a href="lang_conflict.html">ON CONFLICT</a> for additional information.

</p><h2 id="restrictions_on_update_statements_within_create_trigger"><span>2.1. </span>Restrictions on UPDATE Statements Within CREATE TRIGGER</h2>

<p>The following additional syntax restrictions apply to UPDATE statements that
occur within the body of a <a href="lang_createtrigger.html">CREATE TRIGGER</a> statement.  

</p><ul>
  <li><p>The <span class='yyterm'>table-name</span> specified as part of an UPDATE 
      statement within
      a trigger body must be unqualified. In other words, the
      <i>schema-name</i><b>.</b> prefix on the table name of the UPDATE is
      not allowed within triggers. Unless the table to which the trigger
      is attached is in the TEMP database, the table being updated by the
      trigger program must reside in the same database as it. If the table
      to which the trigger is attached is in the TEMP database, then the
      unqualified name of the table being updated is resolved in the same way
      as it is for a top-level statement (by searching first the TEMP database,
      then the main database, then any other databases in the order they were
      attached).

  </p></li><li><p>The INDEXED BY and NOT INDEXED clauses are not allowed on UPDATE
      statements within triggers.</p>

  </li><li><p>The LIMIT and ORDER BY clauses for UPDATE are unsupported within
      triggers, regardless of the compilation options used to build SQLite.
</p></li></ul>

<a name="upfrom"></a>

<h2 id="update_from"><span>2.2. </span>UPDATE FROM</h2>

<p>The UPDATE-FROM idea is an extension to SQL that allows an UPDATE
statement to be driven by other tables in the database. 
The "target" table is the specific table that is being
updated.  With UPDATE-FROM you can join the target table
against other tables in the database in order to help compute which
rows need updating and what the new values should be on those rows.
UPDATE-FROM is supported beginning in SQLite version 3.33.0
(2020-08-14).

</p><p>Other relation database engines also implement UPDATE-FROM, but
because the construct is not part of the SQL standards, each product
implements UPDATE-FROM differently.  The SQLite implementation strives
to be compatible with PostgreSQL.  The SQL Server and MySQL implementations
of the same idea work a little differently.

</p><p>As an example of how UPDATE-FROM can be useful, 
suppose you have a point-of-sale application that accumulates
purchases in the SALES table.  At the end of the day, you want to adjust
the INVENTORY table according to the daily sales.  To do this, you can
run an UPDATE against the INVENTORY table that adjusts the quantity by
the aggregated sales for the day.  The statement would look like this:

</p><div class="codeblock"><pre>UPDATE inventory
   SET quantity = quantity - daily.amt
  FROM (SELECT sum(quantity) AS amt, itemId FROM sales GROUP BY 2) AS daily
 WHERE inventory.itemId = daily.itemId;
</pre></div>

<p>
The subquery in the FROM clause computes the amount by which the
inventory should be reduced for each itemId.  That subquery is joined
against the inventory table and the quantity of each affected inventory
row is reduced by the appropriate amount.

</p><p>
The target table is not included in the FROM clause, unless the intent
is to do a self-join against the target table.  In the event of a self-join,
the table in the FROM clause must be aliased to a different name
than the target table.

</p><p>
If the join between the target table and the FROM clause results in
multiple output rows for the same target table row, then only one of
those output rows is used for updating the target table.  The output
row selected is arbitrary and might change from one release of SQLite
to the next, or from one run to the next.

</p><h3 id="update_from_in_other_sql_database_engines"><span>2.2.1. </span>UPDATE FROM in other SQL database engines</h3>

<p>SQL Server also supports UPDATE FROM, but in SQL Server the target
table must be included in the FROM clause.  In other words, the
target table is named twice in the statement.  With SQL Server,
the inventory adjustment statement demonstrated above would be written
like this:

</p><div class="codeblock"><pre>UPDATE inventory
   SET quantity = quantity - daily.amt
  FROM inventory, 
       (SELECT sum(quantity) AS amt, itemId FROM sales GROUP BY 2) AS daily
 WHERE inventory.itemId = daily.itemId;
</pre></div>

<p>MySQL supports the UPDATE FROM idea, but it does so without using
a FROM clause.  Instead, the complete join specification is given in between
the UPDATE and SET keywords.  The equivalent MySQL statement would be
like this:

</p><div class="codeblock"><pre>UPDATE inventory JOIN
       (SELECT sum(quantity) AS amt, itemId FROM sales GROUP BY 2) AS daily
       USING( itemId )
   SET inventory.quantity = inventory.quantity - daily.amt;
</pre></div>

<p>The MySQL UPDATE statement does not have just one target table like
other systems.  Any of the tables that participate in the join can
be modified in the SET clause.  The MySQL UPDATE syntax allows you to
update multiple tables at once!

</p><h2 id="optional_limit_and_order_by_clauses"><span>2.3. </span>Optional LIMIT and ORDER BY Clauses</h2>

<p>If SQLite is built with the <a href="compile.html#enable_update_delete_limit">SQLITE_ENABLE_UPDATE_DELETE_LIMIT</a>
compile-time option then the syntax of the UPDATE statement is extended
with optional ORDER BY and LIMIT clauses as follows:</p>

<p><b><a href="syntax/update-stmt-limited.html">update-stmt-limited:</a></b></p><div class='imgcontainer'>
 <div style="max-width:623px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 623.266 1047.01">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L91,32A15 15 0 0 0 106 17A15 15 0 0 0 91 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M166,62L252,62A15 15 0 0 0 267 47L267,47A15 15 0 0 0 252 32L166,32A15 15 0 0 0 151 47L151,47A15 15 0 0 0 166 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="209,17 197,21 197,12" style="fill:rgb(0,0,0)"/>
<path d="M106,17L203,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M209,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M357,32L583,32L583,2L357,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="151,47 139,51 139,43" style="fill:rgb(0,0,0)"/>
<path d="M106,17 L 113,17 Q 121,17 121,32 L 121,32 Q 121,47 133,47 L 145,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,47 278,51 278,43" style="fill:rgb(0,0,0)"/>
<path d="M267,47L284,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,47 L 297,47 Q 305,47 305,32 L 305,32 Q 305,17 320,17 L 330,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,70A15 15 0 0 0 485 55L485,55A15 15 0 0 0 470 39A15 15 0 0 0 455 55L455,55A15 15 0 0 0 470 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="485,55 497,50 497,59" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,40 Q 598,55 583,55 L 506,55 L 491,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,55 L 349,55 Q 334,55 334,40 L 334,32 Q 334,17 340,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="294,83 306,79 306,88" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,68 Q 598,83 583,83 L 315,83 L 300,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="24,53 20,41 28,41" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,32 L 24,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,136L114,136A15 15 0 0 0 129 121A15 15 0 0 0 114 106L60,106A15 15 0 0 0 45 121A15 15 0 0 0 60 136Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="121" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="45,121 33,125 33,116" style="fill:rgb(0,0,0)"/>
<path d="M24,53 L 24,106 Q 24,121 31,121 L 39,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,83 L 39,83 Q 24,83 24,91 L 24,98"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,299 159,303 159,295" style="fill:rgb(0,0,0)"/>
<path d="M129,121 L 137,121 Q 144,121 144,136 L 144,284 Q 144,299 155,299 L 165,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,314L193,314A15 15 0 0 0 208 299A15 15 0 0 0 193 284L186,284A15 15 0 0 0 171 299A15 15 0 0 0 186 314Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="299" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,299 214,303 214,295" style="fill:rgb(0,0,0)"/>
<path d="M208,299L219,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,314L318,314A15 15 0 0 0 333 299A15 15 0 0 0 318 284L240,284A15 15 0 0 0 225 299A15 15 0 0 0 240 314Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="279" y="299" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="350,299 339,303 339,295" style="fill:rgb(0,0,0)"/>
<path d="M333,299L344,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,121 380,125 380,116" style="fill:rgb(0,0,0)"/>
<path d="M350,299 L 358,299 Q 365,299 365,284 L 365,136 Q 365,121 376,121 L 386,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M392,136L576,136L576,106L392,106Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="121" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">qualified-table-name</text>
<path d="M186,276L193,276A15 15 0 0 0 208 261A15 15 0 0 0 193 246L186,246A15 15 0 0 0 171 261A15 15 0 0 0 186 276Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="261" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,261 214,266 214,257" style="fill:rgb(0,0,0)"/>
<path d="M208,261L219,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,276L304,276A15 15 0 0 0 319 261A15 15 0 0 0 304 246L240,246A15 15 0 0 0 225 261A15 15 0 0 0 240 276Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="261" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<polygon points="350,261 339,266 339,257" style="fill:rgb(0,0,0)"/>
<path d="M319,261L344,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,261 L 358,261 Q 365,261 365,254 L 365,246"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,261 159,266 159,257" style="fill:rgb(0,0,0)"/>
<path d="M144,246 L 144,254 Q 144,261 155,261 L 165,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,239L193,239A15 15 0 0 0 208 224A15 15 0 0 0 193 208L186,208A15 15 0 0 0 171 224A15 15 0 0 0 186 239Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="224" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,224 214,228 214,219" style="fill:rgb(0,0,0)"/>
<path d="M208,224L219,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,239L292,239A15 15 0 0 0 307 224A15 15 0 0 0 292 208L240,208A15 15 0 0 0 225 224A15 15 0 0 0 240 239Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="266" y="224" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="350,224 339,228 339,219" style="fill:rgb(0,0,0)"/>
<path d="M307,224L344,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,224 L 358,224 Q 365,224 365,216 L 365,209"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,224 159,228 159,219" style="fill:rgb(0,0,0)"/>
<path d="M144,208 L 144,216 Q 144,224 155,224 L 165,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,201L193,201A15 15 0 0 0 208 186A15 15 0 0 0 193 171L186,171A15 15 0 0 0 171 186A15 15 0 0 0 186 201Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="186" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,186 214,190 214,181" style="fill:rgb(0,0,0)"/>
<path d="M208,186L219,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,201L262,201A15 15 0 0 0 277 186A15 15 0 0 0 262 171L240,171A15 15 0 0 0 225 186A15 15 0 0 0 240 201Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="186" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="350,186 339,190 339,181" style="fill:rgb(0,0,0)"/>
<path d="M277,186L344,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,186 L 358,186 Q 365,186 365,178 L 365,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,186 159,190 159,181" style="fill:rgb(0,0,0)"/>
<path d="M144,171 L 144,178 Q 144,186 155,186 L 165,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,163L193,163A15 15 0 0 0 208 148A15 15 0 0 0 193 133L186,133A15 15 0 0 0 171 148A15 15 0 0 0 186 163Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="148" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,148 214,152 214,144" style="fill:rgb(0,0,0)"/>
<path d="M208,148L219,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,163L282,163A15 15 0 0 0 297 148A15 15 0 0 0 282 133L240,133A15 15 0 0 0 225 148A15 15 0 0 0 240 163Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="148" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="350,148 339,152 339,144" style="fill:rgb(0,0,0)"/>
<path d="M297,148L344,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,148 L 358,148 Q 365,148 365,140 L 365,133"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,148 159,152 159,144" style="fill:rgb(0,0,0)"/>
<path d="M144,133 L 144,140 Q 144,148 155,148 L 165,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="350,121 339,125 339,116" style="fill:rgb(0,0,0)"/>
<path d="M129,121L344,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,121L380,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,375 39,379 39,370" style="fill:rgb(0,0,0)"/>
<path d="M576,121 L 584,121 Q 591,121 591,136 L 591,322 Q 591,337 576,337 L 39,337 Q 24,337 24,352 L 24,360 Q 24,375 34,375 L 45,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,390L81,390A15 15 0 0 0 96 375A15 15 0 0 0 81 360L65,360A15 15 0 0 0 50 375A15 15 0 0 0 65 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="73" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="153,413 141,417 141,408" style="fill:rgb(0,0,0)"/>
<path d="M96,375 L 111,375 Q 126,375 126,390 L 126,398 Q 126,413 136,413 L 147,413"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,428L309,428L309,397L153,397Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="413" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name-list</text>
<polygon points="350,375 339,379 339,370" style="fill:rgb(0,0,0)"/>
<path d="M309,413 L 316,413 Q 324,413 324,398 L 324,390 Q 324,375 334,375 L 344,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,390A15 15 0 0 0 380 375A15 15 0 0 0 365 360A15 15 0 0 0 350 375A15 15 0 0 0 365 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="375" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">=</text>
<polygon points="404,375 392,379 392,370" style="fill:rgb(0,0,0)"/>
<path d="M380,375L398,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,390L453,390L453,360L404,360Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="428" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="153,375 141,379 141,370" style="fill:rgb(0,0,0)"/>
<path d="M96,375L147,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,390L262,390A15 15 0 0 0 277 375A15 15 0 0 0 262 360L168,360A15 15 0 0 0 153 375A15 15 0 0 0 168 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<path d="M277,375L339,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M251,465A15 15 0 0 0 266 450A15 15 0 0 0 251 435A15 15 0 0 0 236 450A15 15 0 0 0 251 465Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="450" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="266,450 277,446 277,455" style="fill:rgb(0,0,0)"/>
<path d="M453,375 L 460,375 Q 468,375 468,390 L 468,435 Q 468,450 453,450 L 287,450 L 272,450"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,450 L 117,450 Q 102,450 102,435 L 102,390 Q 102,375 117,375 L 117,375 L 132,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="251,488 262,484 262,492" style="fill:rgb(0,0,0)"/>
<path d="M453,375 L 460,375 Q 468,375 468,390 L 468,473 Q 468,488 453,488 L 271,488 L 256,488"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M251,488 L 39,488 Q 24,488 24,503 L 24,511 Q 24,526 37,526 L 50,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,541L100,541A15 15 0 0 0 115 526A15 15 0 0 0 100 511L65,511A15 15 0 0 0 50 526A15 15 0 0 0 65 541Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="526" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="187,526 176,530 176,522" style="fill:rgb(0,0,0)"/>
<path d="M115,526L182,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,541L348,541L348,511L187,511Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="526" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M268,579A15 15 0 0 0 283 564A15 15 0 0 0 268 549A15 15 0 0 0 253 564A15 15 0 0 0 268 579Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="564" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="283,564 295,559 295,568" style="fill:rgb(0,0,0)"/>
<path d="M348,526 L 356,526 Q 363,526 363,541 L 363,549 Q 363,564 348,564 L 304,564 L 289,564"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M253,564 L 176,564 Q 161,564 161,549 L 161,541 Q 161,526 168,526 L 176,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="187,602 176,606 176,597" style="fill:rgb(0,0,0)"/>
<path d="M115,526 L 123,526 Q 130,526 130,541 L 130,587 Q 130,602 145,602 L 167,602 L 182,602"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,617L290,617L290,586L187,586Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="239" y="602" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<polygon points="405,526 393,530 393,522" style="fill:rgb(0,0,0)"/>
<path d="M290,602 L 363,602 Q 378,602 378,587 L 378,541 Q 378,526 389,526 L 399,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="244,639 255,635 255,644" style="fill:rgb(0,0,0)"/>
<path d="M405,526 L 412,526 Q 420,526 420,541 L 420,624 Q 420,639 405,639 L 265,639 L 250,639"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,526L393,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,677 39,681 39,673" style="fill:rgb(0,0,0)"/>
<path d="M244,639 L 39,639 Q 24,639 24,654 L 24,662 Q 24,677 34,677 L 45,677"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,692L115,692A15 15 0 0 0 130 677A15 15 0 0 0 115 662L66,662A15 15 0 0 0 50 677A15 15 0 0 0 66 692Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="90" y="677" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="153,677 142,681 142,673" style="fill:rgb(0,0,0)"/>
<path d="M130,677L147,677"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,692L202,692L202,662L153,662Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="178" y="677" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="126,715 138,711 138,719" style="fill:rgb(0,0,0)"/>
<path d="M202,677 L 212,677 Q 221,677 221,692 L 221,700 Q 221,715 206,715 L 147,715 L 132,715"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,715 L 39,715 Q 24,715 24,726 L 24,738"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,753 39,757 39,748" style="fill:rgb(0,0,0)"/>
<path d="M24,738 L 24,745 Q 24,753 34,753 L 45,753"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M50,768L201,768L201,738L50,738Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="126" y="753" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">returning-clause</text>
<polygon points="126,791 137,786 137,795" style="fill:rgb(0,0,0)"/>
<path d="M201,753 L 211,753 Q 220,753 220,768 L 220,776 Q 220,791 205,791 L 147,791 L 132,791"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,828 39,833 39,824" style="fill:rgb(0,0,0)"/>
<path d="M126,791 L 39,791 Q 24,791 24,806 L 24,813 Q 24,828 34,828 L 45,828"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,843L110,843A15 15 0 0 0 125 828A15 15 0 0 0 110 813L66,813A15 15 0 0 0 50 828A15 15 0 0 0 66 843Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="88" y="828" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="148,828 137,833 137,824" style="fill:rgb(0,0,0)"/>
<path d="M125,828L142,828"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M163,843L167,843A15 15 0 0 0 183 828A15 15 0 0 0 167 813L163,813A15 15 0 0 0 148 828A15 15 0 0 0 163 843Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="165" y="828" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="219,828 207,833 207,824" style="fill:rgb(0,0,0)"/>
<path d="M183,828L213,828"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,843L348,843L348,813L219,813Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="283" y="828" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M283,881L283,881A15 15 0 0 0 299 866A15 15 0 0 0 283 851L283,851A15 15 0 0 0 268 866A15 15 0 0 0 283 881Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="283" y="866" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M60,949L93,949A15 15 0 0 0 109 934A15 15 0 0 0 93 919L60,919A15 15 0 0 0 45 934A15 15 0 0 0 60 949Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="77" y="934" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="132,934 120,939 120,930" style="fill:rgb(0,0,0)"/>
<path d="M109,934L126,934"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,949L181,949L181,919L132,919Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="934" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="219,964 207,969 207,960" style="fill:rgb(0,0,0)"/>
<path d="M181,934 L 188,934 Q 196,934 196,949 L 196,949 Q 196,964 204,964 L 213,964"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M234,980L285,980A15 15 0 0 0 300 964A15 15 0 0 0 285 949L234,949A15 15 0 0 0 219 964A15 15 0 0 0 234 980Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="964" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="323,964 312,969 312,960" style="fill:rgb(0,0,0)"/>
<path d="M300,964L318,964"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,980L373,980L373,949L323,949Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="964" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M234,1017A15 15 0 0 0 249 1002A15 15 0 0 0 234 987A15 15 0 0 0 219 1002A15 15 0 0 0 234 1017Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="1002" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="272,1002 261,1007 261,998" style="fill:rgb(0,0,0)"/>
<path d="M249,1002L266,1002"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,1017L321,1017L321,987L272,987Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="297" y="1002" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="219,1002 207,1007 207,998" style="fill:rgb(0,0,0)"/>
<path d="M181,934 L 188,934 Q 196,934 196,949 L 196,987 Q 196,1002 204,1002 L 213,1002"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,866 310,862 310,870" style="fill:rgb(0,0,0)"/>
<path d="M348,828 L 356,828 Q 363,828 363,843 L 363,851 Q 363,866 348,866 L 319,866 L 304,866"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M268,866 L 210,866 Q 195,866 195,851 L 195,843 Q 195,828 203,828 L 210,828"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,934 33,939 33,930" style="fill:rgb(0,0,0)"/>
<path d="M24,511 L 24,919 Q 24,934 31,934 L 39,934"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,896 177,892 177,901" style="fill:rgb(0,0,0)"/>
<path d="M348,828 L 356,828 Q 363,828 363,843 L 363,881 Q 363,896 348,896 L 186,896 L 171,896"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,896 L 39,896 Q 24,896 24,904 L 24,911"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="178,1040 166,1044 166,1036" style="fill:rgb(0,0,0)"/>
<path d="M24,919 L 24,1025 Q 24,1040 39,1040 L 157,1040 L 172,1040"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="613,1040 602,1044 602,1036" style="fill:rgb(0,0,0)"/>
<path d="M178,1040L608,1040"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="617" cy="1040" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="396,964 384,969 384,960" style="fill:rgb(0,0,0)"/>
<path d="M373,964L390,964"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,1040 435,1044 435,1036" style="fill:rgb(0,0,0)"/>
<path d="M396,964 L 403,964 Q 411,964 411,979 L 411,1025 Q 411,1040 426,1040 L 426,1040 L 441,1040"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="396,1002 384,1007 384,998" style="fill:rgb(0,0,0)"/>
<path d="M321,1002L390,1002"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M396,1002 L 403,1002 Q 411,1002 411,1010 L 411,1017"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="396,934 384,939 384,930" style="fill:rgb(0,0,0)"/>
<path d="M181,934L390,934"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M396,934 L 403,934 Q 411,934 411,949 L 411,965 L 411,980"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
 </div>


<p>If an UPDATE statement has a LIMIT clause, the maximum number of rows that
will be updated is found by evaluating the accompanying expression and casting
it to an integer value. A negative value is interpreted as "no limit".

</p><p>If the LIMIT expression evaluates to non-negative value <i>N</i> and the
UPDATE statement has an ORDER BY clause, then all rows that would be updated in
the absence of the LIMIT clause are sorted according to the ORDER BY and the
first <i>N</i> updated. If the UPDATE statement also has an OFFSET clause,
then it is similarly evaluated and cast to an integer value. If the OFFSET
expression evaluates to a non-negative value <i>M</i>, then the first <i>M</i>
rows are skipped and the following <i>N</i> rows updated instead.

</p><p>If the UPDATE statement has no ORDER BY clause, then all rows that
would be updated in the absence of the LIMIT clause are assembled in an
arbitrary order before applying the LIMIT and OFFSET clauses to determine 
which are actually updated.

</p><p>The ORDER BY clause on an UPDATE statement is used only to determine which
rows fall within the LIMIT. The order in which rows are modified is arbitrary
and is not influenced by the ORDER BY clause.
</p><p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_update.in?m=9cde642bd8">2022-01-08 05:02:57</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_upsert.html.

























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>UPSERT</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
UPSERT
</div>
</div>




<h1 id="syntax"><span>1. </span>Syntax</h1>
<p><b><a href="syntax/upsert-clause.html">upsert-clause:</a></b>
<button id='xe9450c39' onclick='hideorshow("xe9450c39","xfa378d66")'>hide</button></p>
 <div id='xfa378d66' class='imgcontainer'>
 <div style="max-width:901px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 901.142 363.96">
<path d="M223,165L759,165L759,51L223,51Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="5" cy="66" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,66 35,71 35,62" style="fill:rgb(0,0,0)"/>
<path d="M9,66L41,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,82L71,82A15 15 0 0 0 86 66A15 15 0 0 0 71 51L62,51A15 15 0 0 0 47 66A15 15 0 0 0 62 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="66" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="103,66 92,71 92,62" style="fill:rgb(0,0,0)"/>
<path d="M86,66L98,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M118,82L193,82A15 15 0 0 0 208 66A15 15 0 0 0 193 51L118,51A15 15 0 0 0 103 66A15 15 0 0 0 118 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="66" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONFLICT</text>
<polygon points="264,97 253,101 253,92" style="fill:rgb(0,0,0)"/>
<path d="M208,66 L 223,66 Q 238,66 238,81 L 238,82 Q 238,97 248,97 L 259,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M280,112A15 15 0 0 0 295 97L295,97A15 15 0 0 0 280 82A15 15 0 0 0 264 97L264,97A15 15 0 0 0 280 112Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="97" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="331,97 319,101 319,92" style="fill:rgb(0,0,0)"/>
<path d="M295,97L325,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M331,112L475,112L475,82L331,82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="97" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">indexed-column</text>
<polygon points="511,97 500,101 500,92" style="fill:rgb(0,0,0)"/>
<path d="M475,97L506,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M526,112A15 15 0 0 0 542 97L542,97A15 15 0 0 0 526 82A15 15 0 0 0 511 97L511,97A15 15 0 0 0 526 112Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="526" y="97" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="583,135 572,139 572,130" style="fill:rgb(0,0,0)"/>
<path d="M542,97 L 549,97 Q 557,97 557,112 L 557,119 Q 557,135 567,135 L 577,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M598,150L648,150A15 15 0 0 0 663 135A15 15 0 0 0 648 119L598,119A15 15 0 0 0 583 135A15 15 0 0 0 598 150Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="623" y="135" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="680,135 669,139 669,130" style="fill:rgb(0,0,0)"/>
<path d="M663,135L674,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M680,150L729,150L729,119L680,119Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="705" y="135" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="744,108 749,119 740,119" style="fill:rgb(0,0,0)"/>
<path d="M729,135 L 737,135 Q 744,135 744,124 L 744,114"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="786,66 774,71 774,62" style="fill:rgb(0,0,0)"/>
<path d="M744,108 L 744,81 Q 744,66 759,66 L 765,66 L 780,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M801,82L809,82A15 15 0 0 0 824 66A15 15 0 0 0 809 51L801,51A15 15 0 0 0 786 66A15 15 0 0 0 801 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="805" y="66" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DO</text>
<polygon points="729,97 718,101 718,92" style="fill:rgb(0,0,0)"/>
<path d="M542,97L723,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,97 L 737,97 Q 744,97 744,89 L 744,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M208,66L774,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,150A15 15 0 0 0 418 135A15 15 0 0 0 403 119A15 15 0 0 0 388 135A15 15 0 0 0 403 150Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="135" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,135 430,130 430,139" style="fill:rgb(0,0,0)"/>
<path d="M475,97 L 483,97 Q 490,97 490,112 L 490,119 Q 490,135 475,135 L 439,135 L 424,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,135 L 319,135 Q 304,135 304,119 L 304,112 Q 304,97 312,97 L 319,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="288" y="36" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" dominant-baseline="central">conflict target</text>
<polygon points="436,195 447,191 447,199" style="fill:rgb(0,0,0)"/>
<path d="M824,66 L 831,66 Q 839,66 839,81 L 839,180 Q 839,195 824,195 L 456,195 L 441,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,271 35,275 35,266" style="fill:rgb(0,0,0)"/>
<path d="M436,195 L 35,195 Q 20,195 20,210 L 20,256 Q 20,271 31,271 L 41,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,286L116,286A15 15 0 0 0 131 271A15 15 0 0 0 116 255L62,255A15 15 0 0 0 47 271A15 15 0 0 0 62 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="89" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="148,271 137,275 137,266" style="fill:rgb(0,0,0)"/>
<path d="M131,271L143,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M164,286L179,286A15 15 0 0 0 194 271A15 15 0 0 0 179 255L164,255A15 15 0 0 0 148 271A15 15 0 0 0 164 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="171" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="257,308 245,313 245,304" style="fill:rgb(0,0,0)"/>
<path d="M194,271 L 215,271 Q 230,271 230,286 L 230,293 Q 230,308 241,308 L 251,308"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,324L413,324L413,293L257,293Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="335" y="308" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name-list</text>
<polygon points="475,271 464,275 464,266" style="fill:rgb(0,0,0)"/>
<path d="M413,308 L 434,308 Q 449,308 449,293 L 449,286 Q 449,271 459,271 L 469,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,286A15 15 0 0 0 505 271A15 15 0 0 0 490 255A15 15 0 0 0 475 271A15 15 0 0 0 490 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="490" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">=</text>
<polygon points="523,271 511,275 511,266" style="fill:rgb(0,0,0)"/>
<path d="M505,271L517,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M523,286L572,286L572,255L523,255Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="547" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="619,271 608,275 608,266" style="fill:rgb(0,0,0)"/>
<path d="M572,271L613,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M634,286L684,286A15 15 0 0 0 699 271A15 15 0 0 0 684 255L634,255A15 15 0 0 0 619 271A15 15 0 0 0 634 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="659" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="716,271 705,275 705,266" style="fill:rgb(0,0,0)"/>
<path d="M699,271L710,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M716,286L765,286L765,255L716,255Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="741" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="891,233 880,237 880,228" style="fill:rgb(0,0,0)"/>
<path d="M765,271 L 773,271 Q 780,271 780,256 L 780,248 Q 780,233 795,233 L 871,233 L 886,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="895" cy="233" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,248L130,248A15 15 0 0 0 145 233A15 15 0 0 0 130 218L62,218A15 15 0 0 0 47 233A15 15 0 0 0 62 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="96" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTHING</text>
<polygon points="47,233 35,237 35,228" style="fill:rgb(0,0,0)"/>
<path d="M20,218 L 20,225 Q 20,233 31,233 L 41,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,233L880,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="638,233 626,237 626,228" style="fill:rgb(0,0,0)"/>
<path d="M587,271 L 594,271 Q 602,271 602,256 L 602,248 Q 602,233 617,233 L 617,233 L 632,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M383,361A15 15 0 0 0 398 346A15 15 0 0 0 383 331A15 15 0 0 0 368 346A15 15 0 0 0 383 361Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="383" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="398,346 410,342 410,351" style="fill:rgb(0,0,0)"/>
<path d="M572,271 L 579,271 Q 587,271 587,286 L 587,331 Q 587,346 572,346 L 419,346 L 404,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,308 210,320 201,320" style="fill:rgb(0,0,0)"/>
<path d="M368,346 L 221,346 Q 206,346 206,331 L 206,329 L 206,314"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,308 L 206,286 Q 206,271 221,271 L 227,271 L 242,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="257,271 245,275 245,266" style="fill:rgb(0,0,0)"/>
<path d="M194,271L251,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,286L366,286A15 15 0 0 0 381 271A15 15 0 0 0 366 255L272,255A15 15 0 0 0 257 271A15 15 0 0 0 272 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<path d="M381,271L464,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="865,97 869,108 860,108" style="fill:rgb(0,0,0)"/>
<path d="M850,233 L 857,233 Q 865,233 865,218 L 865,117 L 865,102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="403,6 415,2 415,10" style="fill:rgb(0,0,0)"/>
<path d="M865,97 L 865,21 Q 865,6 850,6 L 424,6 L 409,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,6 L 40,6 Q 25,6 25,21 L 25,51 Q 25,66 32,66 L 40,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/column-name-list.html">column-name-list:</a></b>
<button id='x7e1c0400' onclick='hideorshow("x7e1c0400","x17e6472a")'>show</button></p>
 <div id='x17e6472a' style='display:none;' class='imgcontainer'>
 <div style="max-width:353px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 353.621 72.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="85,17 74,21 74,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L79,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,17 110,21 110,12" style="fill:rgb(0,0,0)"/>
<path d="M85,17L115,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,32L230,32A15 15 0 0 0 245 17A15 15 0 0 0 230 2L136,2A15 15 0 0 0 121 17A15 15 0 0 0 136 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="290,17 279,21 279,12" style="fill:rgb(0,0,0)"/>
<path d="M245,17L285,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M306,32A15 15 0 0 0 321 17A15 15 0 0 0 306 2A15 15 0 0 0 290 17A15 15 0 0 0 306 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="306" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="344,17 332,21 332,12" style="fill:rgb(0,0,0)"/>
<path d="M321,17L338,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="347" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M183,70A15 15 0 0 0 198 55L198,55A15 15 0 0 0 183 39A15 15 0 0 0 168 55L168,55A15 15 0 0 0 183 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="198,55 210,50 210,59" style="fill:rgb(0,0,0)"/>
<path d="M245,17 L 257,17 Q 269,17 269,32 L 269,40 Q 269,55 254,55 L 219,55 L 204,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,17 110,21 110,12" style="fill:rgb(0,0,0)"/>
<path d="M168,55 L 102,55 Q 87,55 87,40 L 87,32 Q 87,17 101,17 L 115,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/expr.html">expr:</a></b>
<button id='x42ba95f7' onclick='hideorshow("x42ba95f7","xeee6d54d")'>show</button></p>
 <div id='xeee6d54d' style='display:none;' class='imgcontainer'>
 <div style="max-width:963px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 963.96 1068.77">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L158,32L158,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="101" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="954,17 943,21 943,12" style="fill:rgb(0,0,0)"/>
<path d="M158,17L948,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="958" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L172,70A15 15 0 0 0 187 55L187,55A15 15 0 0 0 172 39L60,39A15 15 0 0 0 45 55L45,55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">bind-parameter</text>
<polygon points="916,55 905,59 905,50" style="fill:rgb(0,0,0)"/>
<path d="M187,55L910,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,55 L 924,55 Q 931,55 931,47 L 931,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 31,55 L 39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,130L156,130A15 15 0 0 0 171 115A15 15 0 0 0 156 100L60,100A15 15 0 0 0 45 115A15 15 0 0 0 60 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,115 183,119 183,111" style="fill:rgb(0,0,0)"/>
<path d="M171,115L189,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,130A15 15 0 0 0 225 115A15 15 0 0 0 210 100A15 15 0 0 0 195 115A15 15 0 0 0 210 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M225,115L255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130L351,130A15 15 0 0 0 366 115A15 15 0 0 0 351 100L276,100A15 15 0 0 0 261 115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="389,115 378,119 378,111" style="fill:rgb(0,0,0)"/>
<path d="M366,115L383,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,130A15 15 0 0 0 419 115A15 15 0 0 0 404 100A15 15 0 0 0 389 115A15 15 0 0 0 404 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="404" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="455,115 444,119 444,111" style="fill:rgb(0,0,0)"/>
<path d="M419,115L450,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,130L565,130A15 15 0 0 0 580 115A15 15 0 0 0 565 100L471,100A15 15 0 0 0 455 115A15 15 0 0 0 471 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="916,115 905,119 905,111" style="fill:rgb(0,0,0)"/>
<path d="M580,115L910,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,115 L 924,115 Q 931,115 931,108 L 931,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,115 33,119 33,111" style="fill:rgb(0,0,0)"/>
<path d="M24,100 L 24,108 Q 24,115 31,115 L 39,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,89 97,93 97,84" style="fill:rgb(0,0,0)"/>
<path d="M24,74 L 24,81 Q 24,89 39,89 L 87,89 L 102,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 302,93 302,84" style="fill:rgb(0,0,0)"/>
<path d="M108,89 L 129,89 Q 144,89 159,89 L 293,89 L 308,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,89 L 414,89 Q 429,89 429,102 Q 429,115 436,115 L 444,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M223,89 L 230,89 Q 238,89 238,102 Q 238,115 245,115 L 253,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,168L168,168A15 15 0 0 0 183 153A15 15 0 0 0 168 138L60,138A15 15 0 0 0 45 153A15 15 0 0 0 60 168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">unary-operator</text>
<polygon points="206,153 194,157 194,149" style="fill:rgb(0,0,0)"/>
<path d="M183,153L200,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,168L255,168L255,138L206,138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,153 905,157 905,149" style="fill:rgb(0,0,0)"/>
<path d="M255,153L910,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,153 L 924,153 Q 931,153 931,145 L 931,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,153 33,157 33,149" style="fill:rgb(0,0,0)"/>
<path d="M24,138 L 24,145 Q 24,153 31,153 L 39,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,206L94,206L94,176L45,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,191 106,195 106,186" style="fill:rgb(0,0,0)"/>
<path d="M94,191L111,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,206L245,206A15 15 0 0 0 261 191A15 15 0 0 0 245 176L132,176A15 15 0 0 0 117 191A15 15 0 0 0 132 206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">binary-operator</text>
<polygon points="284,191 272,195 272,186" style="fill:rgb(0,0,0)"/>
<path d="M261,191L278,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,206L333,206L333,176L284,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="308" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,191 905,195 905,186" style="fill:rgb(0,0,0)"/>
<path d="M333,191L910,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,191 L 924,191 Q 931,191 931,183 L 931,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,191 33,195 33,186" style="fill:rgb(0,0,0)"/>
<path d="M24,176 L 24,183 Q 24,191 31,191 L 39,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,245L162,245A15 15 0 0 0 177 230A15 15 0 0 0 162 215L60,215A15 15 0 0 0 45 230A15 15 0 0 0 60 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="111" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-name</text>
<polygon points="194,230 183,234 183,226" style="fill:rgb(0,0,0)"/>
<path d="M177,230L188,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,245A15 15 0 0 0 224 230A15 15 0 0 0 209 215A15 15 0 0 0 194 230A15 15 0 0 0 209 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="260,230 249,234 249,226" style="fill:rgb(0,0,0)"/>
<path d="M224,230L255,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,245L437,245L437,215L260,215Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-arguments</text>
<polygon points="473,230 461,234 461,226" style="fill:rgb(0,0,0)"/>
<path d="M437,230L467,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,245A15 15 0 0 0 503 230A15 15 0 0 0 488 215A15 15 0 0 0 473 230A15 15 0 0 0 488 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="541,260 529,265 529,256" style="fill:rgb(0,0,0)"/>
<path d="M503,230 L 510,230 Q 518,230 518,245 L 518,245 Q 518,260 527,260 L 535,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,275L653,275L653,245L541,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="691,230 680,234 680,226" style="fill:rgb(0,0,0)"/>
<path d="M653,260 L 661,260 Q 668,260 668,245 L 668,245 Q 668,230 677,230 L 685,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="729,260 718,265 718,256" style="fill:rgb(0,0,0)"/>
<path d="M691,230 L 699,230 Q 706,230 706,245 L 706,245 Q 706,260 715,260 L 723,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,275L837,275L837,245L729,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="783" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">over-clause</text>
<polygon points="916,260 905,265 905,256" style="fill:rgb(0,0,0)"/>
<path d="M837,260L910,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,260 L 924,260 Q 931,260 931,253 L 931,245"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,230 33,234 33,226" style="fill:rgb(0,0,0)"/>
<path d="M24,215 L 24,222 Q 24,230 31,230 L 39,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,230 585,234 585,226" style="fill:rgb(0,0,0)"/>
<path d="M503,230L591,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,230L680,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,230 905,234 905,226" style="fill:rgb(0,0,0)"/>
<path d="M691,230L910,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,230 L 924,230 Q 931,230 931,222 L 931,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,321A15 15 0 0 0 75 306A15 15 0 0 0 60 290A15 15 0 0 0 45 306A15 15 0 0 0 60 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,306 100,310 100,301" style="fill:rgb(0,0,0)"/>
<path d="M75,306L105,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M111,321L160,321L160,290L111,290Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="306" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="196,306 185,310 185,301" style="fill:rgb(0,0,0)"/>
<path d="M160,306L191,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,321A15 15 0 0 0 227 306A15 15 0 0 0 211 290A15 15 0 0 0 196 306A15 15 0 0 0 211 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,306 905,310 905,301" style="fill:rgb(0,0,0)"/>
<path d="M227,306L910,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,306 L 924,306 Q 931,306 931,298 L 931,291"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,306 33,310 33,301" style="fill:rgb(0,0,0)"/>
<path d="M24,290 L 24,298 Q 24,306 31,306 L 39,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,284A15 15 0 0 0 151 269A15 15 0 0 0 136 254A15 15 0 0 0 121 269A15 15 0 0 0 136 284Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="269" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="151,269 162,265 162,274" style="fill:rgb(0,0,0)"/>
<path d="M160,306 L 168,306 Q 175,306 175,291 L 175,284 Q 175,269 166,269 L 157,269"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,269 L 103,269 Q 88,269 88,284 L 88,291 Q 88,306 96,306 L 103,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,358L88,358A15 15 0 0 0 103 343A15 15 0 0 0 88 328L60,328A15 15 0 0 0 45 343A15 15 0 0 0 60 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CAST</text>
<polygon points="126,343 114,348 114,339" style="fill:rgb(0,0,0)"/>
<path d="M103,343L120,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M141,358A15 15 0 0 0 156 343A15 15 0 0 0 141 328A15 15 0 0 0 126 343A15 15 0 0 0 141 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="179,343 168,348 168,339" style="fill:rgb(0,0,0)"/>
<path d="M156,343L173,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,358L228,358L228,328L179,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="251,343 240,348 240,339" style="fill:rgb(0,0,0)"/>
<path d="M228,343L246,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,358L271,358A15 15 0 0 0 286 343A15 15 0 0 0 271 328L267,328A15 15 0 0 0 251 343A15 15 0 0 0 267 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="269" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="309,343 297,348 297,339" style="fill:rgb(0,0,0)"/>
<path d="M286,343L303,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,358L408,358L408,328L309,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="358" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="431,343 419,348 419,339" style="fill:rgb(0,0,0)"/>
<path d="M408,343L425,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M446,358A15 15 0 0 0 461 343A15 15 0 0 0 446 328A15 15 0 0 0 431 343A15 15 0 0 0 446 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,343 905,348 905,339" style="fill:rgb(0,0,0)"/>
<path d="M461,343L910,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,343 L 924,343 Q 931,343 931,336 L 931,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,343 33,348 33,339" style="fill:rgb(0,0,0)"/>
<path d="M24,328 L 24,336 Q 24,343 31,343 L 39,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,396L94,396L94,366L45,366Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,381 106,385 106,377" style="fill:rgb(0,0,0)"/>
<path d="M94,381L111,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,396L196,396A15 15 0 0 0 211 381A15 15 0 0 0 196 366L132,366A15 15 0 0 0 117 381A15 15 0 0 0 132 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="234,381 223,385 223,377" style="fill:rgb(0,0,0)"/>
<path d="M211,381L229,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,396L355,396A15 15 0 0 0 370 381A15 15 0 0 0 355 366L250,366A15 15 0 0 0 234 381A15 15 0 0 0 250 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="916,381 905,385 905,377" style="fill:rgb(0,0,0)"/>
<path d="M370,381L910,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,381 L 924,381 Q 931,381 931,374 L 931,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,381 33,385 33,377" style="fill:rgb(0,0,0)"/>
<path d="M24,366 L 24,374 Q 24,381 31,381 L 39,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,434L94,434L94,404L45,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,419 119,423 119,415" style="fill:rgb(0,0,0)"/>
<path d="M94,419L124,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,434L165,434A15 15 0 0 0 180 419A15 15 0 0 0 165 404L145,404A15 15 0 0 0 130 419A15 15 0 0 0 145 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="234,419 223,423 223,415" style="fill:rgb(0,0,0)"/>
<path d="M180,419L229,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,434L273,434A15 15 0 0 0 288 419A15 15 0 0 0 273 404L250,404A15 15 0 0 0 234 419A15 15 0 0 0 250 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIKE</text>
<path d="M250,472L279,472A15 15 0 0 0 294 457A15 15 0 0 0 279 442L250,442A15 15 0 0 0 234 457A15 15 0 0 0 250 472Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="457" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GLOB</text>
<path d="M250,510L302,510A15 15 0 0 0 317 495A15 15 0 0 0 302 479L250,479A15 15 0 0 0 234 495A15 15 0 0 0 250 510Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REGEXP</text>
<path d="M250,547L297,547A15 15 0 0 0 313 532A15 15 0 0 0 297 517L250,517A15 15 0 0 0 234 532A15 15 0 0 0 250 547Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="274" y="532" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<path d="M378,510L427,510L427,479L378,479Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M378,434L427,434L427,404L378,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="465,449 454,454 454,445" style="fill:rgb(0,0,0)"/>
<path d="M427,419 L 435,419 Q 442,419 442,434 L 442,434 Q 442,449 451,449 L 460,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,464L532,464A15 15 0 0 0 547 449A15 15 0 0 0 532 434L480,434A15 15 0 0 0 465 449A15 15 0 0 0 480 464Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="506" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ESCAPE</text>
<polygon points="570,449 559,454 559,445" style="fill:rgb(0,0,0)"/>
<path d="M547,449L565,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M570,464L620,464L620,434L570,434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="595" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="671,419 659,423 659,415" style="fill:rgb(0,0,0)"/>
<path d="M620,449 L 627,449 Q 635,449 635,434 L 635,434 Q 635,419 650,419 L 650,419 L 665,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,419 905,423 905,415" style="fill:rgb(0,0,0)"/>
<path d="M671,419L910,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,419 L 924,419 Q 931,419 931,411 L 931,404"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,419 33,423 33,415" style="fill:rgb(0,0,0)"/>
<path d="M24,404 L 24,411 Q 24,419 31,419 L 39,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M100,419 L 108,419 Q 115,419 115,434 L 115,434 Q 115,449 130,449 L 177,449 Q 192,449 192,434 L 192,434 Q 192,419 199,419 L 207,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,532 223,537 223,528" style="fill:rgb(0,0,0)"/>
<path d="M196,419 L 204,419 Q 211,419 211,434 L 211,517 Q 211,532 220,532 L 229,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,457 223,461 223,452" style="fill:rgb(0,0,0)"/>
<path d="M211,442 L 211,449 Q 211,457 220,457 L 229,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,495 223,499 223,490" style="fill:rgb(0,0,0)"/>
<path d="M211,479 L 211,487 Q 211,495 220,495 L 229,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,419 367,423 367,415" style="fill:rgb(0,0,0)"/>
<path d="M288,419L372,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,532 329,537 329,528" style="fill:rgb(0,0,0)"/>
<path d="M313,532L334,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,495 367,499 367,490" style="fill:rgb(0,0,0)"/>
<path d="M340,532 L 348,532 Q 355,532 355,517 L 355,510 Q 355,495 364,495 L 372,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,495 329,499 329,490" style="fill:rgb(0,0,0)"/>
<path d="M317,495L334,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,495L378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,457 329,461 329,452" style="fill:rgb(0,0,0)"/>
<path d="M294,457L334,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,457 L 348,457 Q 355,457 355,472 L 355,480 Q 355,495 367,495 L 378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="506,419 495,423 495,415" style="fill:rgb(0,0,0)"/>
<path d="M427,419L501,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M506,419L659,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="547,495 536,499 536,490" style="fill:rgb(0,0,0)"/>
<path d="M427,495L542,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,495 L 656,495 Q 671,495 671,480 L 671,434 Q 671,419 686,419 L 692,419 L 707,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,585L94,585L94,555L45,555Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,570 119,574 119,566" style="fill:rgb(0,0,0)"/>
<path d="M94,570L124,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,585L194,585A15 15 0 0 0 209 570A15 15 0 0 0 194 555L145,555A15 15 0 0 0 130 570A15 15 0 0 0 145 585Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="170" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ISNULL</text>
<polygon points="916,570 905,574 905,566" style="fill:rgb(0,0,0)"/>
<path d="M209,570L910,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,570 L 924,570 Q 931,570 931,563 L 931,555"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,570 33,574 33,566" style="fill:rgb(0,0,0)"/>
<path d="M24,555 L 24,563 Q 24,570 31,570 L 39,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,623L215,623A15 15 0 0 0 230 608A15 15 0 0 0 215 593L145,593A15 15 0 0 0 130 608A15 15 0 0 0 145 623Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="608" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTNULL</text>
<path d="M145,661L165,661A15 15 0 0 0 180 646A15 15 0 0 0 165 631L145,631A15 15 0 0 0 130 646A15 15 0 0 0 145 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="203,646 192,650 192,641" style="fill:rgb(0,0,0)"/>
<path d="M180,646L198,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,661L250,661A15 15 0 0 0 265 646A15 15 0 0 0 250 631L219,631A15 15 0 0 0 203 646A15 15 0 0 0 219 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="288,646 276,650 276,641" style="fill:rgb(0,0,0)"/>
<path d="M265,646L282,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="339,570 327,574 327,566" style="fill:rgb(0,0,0)"/>
<path d="M288,646 L 295,646 Q 303,646 303,631 L 303,585 Q 303,570 318,570 L 318,570 L 333,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="288,608 276,612 276,604" style="fill:rgb(0,0,0)"/>
<path d="M230,608L282,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,608 L 295,608 Q 303,608 303,600 L 303,593"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,646 119,650 119,641" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,631 Q 109,646 117,646 L 124,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,608 119,612 119,604" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,593 Q 109,608 117,608 L 124,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,699L94,699L94,668L45,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,684 106,688 106,679" style="fill:rgb(0,0,0)"/>
<path d="M94,684L111,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,699A15 15 0 0 0 147 684A15 15 0 0 0 132 668A15 15 0 0 0 117 684A15 15 0 0 0 132 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IS</text>
<polygon points="183,684 172,688 172,679" style="fill:rgb(0,0,0)"/>
<path d="M147,684L178,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M198,699L219,699A15 15 0 0 0 234 684A15 15 0 0 0 219 668L198,668A15 15 0 0 0 183 684A15 15 0 0 0 198 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="270,684 258,688 258,679" style="fill:rgb(0,0,0)"/>
<path d="M234,684L264,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="306,684 294,688 294,679" style="fill:rgb(0,0,0)"/>
<path d="M270,684L300,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,699L389,699A15 15 0 0 0 404 684A15 15 0 0 0 389 668L321,668A15 15 0 0 0 306 684A15 15 0 0 0 321 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="440,684 429,688 429,679" style="fill:rgb(0,0,0)"/>
<path d="M404,684L434,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,699L490,699A15 15 0 0 0 505 684A15 15 0 0 0 490 668L455,668A15 15 0 0 0 440 684A15 15 0 0 0 455 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="541,684 530,688 530,679" style="fill:rgb(0,0,0)"/>
<path d="M505,684L535,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,699L590,699L590,668L541,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,684 905,688 905,679" style="fill:rgb(0,0,0)"/>
<path d="M590,684L910,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,684 L 924,684 Q 931,684 931,676 L 931,669"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,684 33,688 33,679" style="fill:rgb(0,0,0)"/>
<path d="M24,668 L 24,676 Q 24,684 31,684 L 39,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,684 L 156,684 Q 164,684 164,696 Q 164,708 179,708 L 230,708 Q 245,708 245,696 Q 245,684 253,684 L 260,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,684 L 279,684 Q 286,684 286,696 Q 286,708 301,708 L 502,708 Q 517,708 517,696 Q 517,684 524,684 L 532,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,744L94,744L94,714L45,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,729 119,733 119,725" style="fill:rgb(0,0,0)"/>
<path d="M94,729L124,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,744L165,744A15 15 0 0 0 180 729A15 15 0 0 0 165 714L145,714A15 15 0 0 0 130 729A15 15 0 0 0 145 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,729 205,733 205,725" style="fill:rgb(0,0,0)"/>
<path d="M180,729L211,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,744L304,744A15 15 0 0 0 319 729A15 15 0 0 0 304 714L232,714A15 15 0 0 0 216 729A15 15 0 0 0 232 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="342,729 331,733 331,725" style="fill:rgb(0,0,0)"/>
<path d="M319,729L336,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M342,744L391,744L391,714L342,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="367" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="414,729 403,733 403,725" style="fill:rgb(0,0,0)"/>
<path d="M391,729L409,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M430,744L450,744A15 15 0 0 0 465 729A15 15 0 0 0 450 714L430,714A15 15 0 0 0 414 729A15 15 0 0 0 430 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="488,729 477,733 477,725" style="fill:rgb(0,0,0)"/>
<path d="M465,729L483,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,744L538,744L538,714L488,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="513" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,729 905,733 905,725" style="fill:rgb(0,0,0)"/>
<path d="M538,729L910,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,729 L 924,729 Q 931,729 931,721 L 931,714"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,729 33,733 33,725" style="fill:rgb(0,0,0)"/>
<path d="M24,714 L 24,721 Q 24,729 31,729 L 39,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,729 L 103,729 Q 110,729 110,741 Q 110,753 125,753 L 177,753 Q 192,753 192,741 Q 192,729 199,729 L 207,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,797L94,797L94,767L45,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,782 119,786 119,778" style="fill:rgb(0,0,0)"/>
<path d="M94,782L124,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,797L165,797A15 15 0 0 0 180 782A15 15 0 0 0 165 767L145,767A15 15 0 0 0 130 782A15 15 0 0 0 145 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,782 205,786 205,778" style="fill:rgb(0,0,0)"/>
<path d="M180,782L211,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,797L234,797A15 15 0 0 0 249 782A15 15 0 0 0 234 767L232,767A15 15 0 0 0 216 782A15 15 0 0 0 232 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IN</text>
<polygon points="285,782 273,786 273,778" style="fill:rgb(0,0,0)"/>
<path d="M249,782L279,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,797A15 15 0 0 0 315 782A15 15 0 0 0 300 767A15 15 0 0 0 285 782A15 15 0 0 0 300 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,782 340,786 340,778" style="fill:rgb(0,0,0)"/>
<path d="M315,782L345,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,797L455,797L455,767L351,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="491,782 480,786 480,778" style="fill:rgb(0,0,0)"/>
<path d="M455,782L486,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M507,797A15 15 0 0 0 522 782A15 15 0 0 0 507 767A15 15 0 0 0 491 782A15 15 0 0 0 507 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="507" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,782 905,786 905,778" style="fill:rgb(0,0,0)"/>
<path d="M522,782L910,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,782 L 924,782 Q 931,782 931,774 L 931,767"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,782 33,786 33,778" style="fill:rgb(0,0,0)"/>
<path d="M24,767 L 24,774 Q 24,782 31,782 L 39,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,782 L 103,782 Q 110,782 110,794 Q 110,806 125,806 L 177,806 Q 192,806 192,794 Q 192,782 199,782 L 207,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,782 L 324,782 Q 332,782 332,770 Q 332,758 347,758 L 452,758 Q 467,758 467,770 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M379,835L428,835L428,805L379,805Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="820" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="379,820 367,824 367,815" style="fill:rgb(0,0,0)"/>
<path d="M317,782 L 324,782 Q 332,782 332,797 L 332,805 Q 332,820 347,820 L 358,820 L 373,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M428,820 L 452,820 Q 467,820 467,805 L 467,797 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,873A15 15 0 0 0 418 857A15 15 0 0 0 403 842A15 15 0 0 0 388 857A15 15 0 0 0 403 873Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="857" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,857 430,853 430,862" style="fill:rgb(0,0,0)"/>
<path d="M428,820 L 435,820 Q 443,820 443,835 L 443,842 Q 443,857 434,857 L 424,857"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,857 L 371,857 Q 356,857 356,842 L 356,835 Q 356,820 363,820 L 371,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,925L396,925A15 15 0 0 0 412 910A15 15 0 0 0 396 895L300,895A15 15 0 0 0 285 910A15 15 0 0 0 300 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="429,910 417,915 417,906" style="fill:rgb(0,0,0)"/>
<path d="M412,910L423,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,925A15 15 0 0 0 459 910A15 15 0 0 0 444 895A15 15 0 0 0 429 910A15 15 0 0 0 444 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="513,910 502,915 502,906" style="fill:rgb(0,0,0)"/>
<path d="M459,910L507,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,925L627,925A15 15 0 0 0 642 910A15 15 0 0 0 627 895L528,895A15 15 0 0 0 513 910A15 15 0 0 0 528 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="577" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function</text>
<polygon points="659,910 647,915 647,906" style="fill:rgb(0,0,0)"/>
<path d="M642,910L653,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,925A15 15 0 0 0 689 910A15 15 0 0 0 674 895A15 15 0 0 0 659 910A15 15 0 0 0 674 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="734,910 723,915 723,906" style="fill:rgb(0,0,0)"/>
<path d="M689,910L728,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,925L783,925L783,895L734,895Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="828,910 817,915 817,906" style="fill:rgb(0,0,0)"/>
<path d="M783,910L823,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M844,925A15 15 0 0 0 859 910A15 15 0 0 0 844 895A15 15 0 0 0 828 910A15 15 0 0 0 844 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="844" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,910 905,915 905,906" style="fill:rgb(0,0,0)"/>
<path d="M859,910L910,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,910 L 924,910 Q 931,910 931,903 L 931,895"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,865L603,865A15 15 0 0 0 619 850A15 15 0 0 0 603 835L528,835A15 15 0 0 0 513 850A15 15 0 0 0 528 865Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="850" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="916,850 905,854 905,846" style="fill:rgb(0,0,0)"/>
<path d="M619,850L910,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,850 L 924,850 Q 931,850 931,842 L 931,835"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="513,850 502,854 502,846" style="fill:rgb(0,0,0)"/>
<path d="M475,910 L 483,910 Q 490,910 490,895 L 490,865 Q 490,850 499,850 L 507,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,892A15 15 0 0 0 774 877A15 15 0 0 0 759 862A15 15 0 0 0 744 877A15 15 0 0 0 759 892Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="877" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="774,877 785,873 785,881" style="fill:rgb(0,0,0)"/>
<path d="M783,910 L 791,910 Q 798,910 798,895 L 798,892 Q 798,877 789,877 L 780,877"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M744,877 L 726,877 Q 711,877 711,892 L 711,895 Q 711,910 719,910 L 726,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M689,910 L 697,910 Q 704,910 704,921 Q 704,932 719,932 L 790,932 Q 805,932 805,921 Q 805,910 813,910 L 820,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="285,910 273,915 273,906" style="fill:rgb(0,0,0)"/>
<path d="M249,782 L 256,782 Q 264,782 264,797 L 264,895 Q 264,910 272,910 L 279,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,882 412,886 412,877" style="fill:rgb(0,0,0)"/>
<path d="M264,867 L 264,874 Q 264,882 279,882 L 402,882 L 417,882"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,882 L 456,882 Q 471,882 471,896 Q 471,910 478,910 L 486,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,971L80,971A15 15 0 0 0 95 956A15 15 0 0 0 80 941L60,941A15 15 0 0 0 45 956A15 15 0 0 0 60 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="131,956 120,960 120,951" style="fill:rgb(0,0,0)"/>
<path d="M95,956L125,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,971L191,971A15 15 0 0 0 206 956A15 15 0 0 0 191 941L146,941A15 15 0 0 0 131 956A15 15 0 0 0 146 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="242,956 231,960 231,951" style="fill:rgb(0,0,0)"/>
<path d="M206,956L236,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,971A15 15 0 0 0 272 956A15 15 0 0 0 257 941A15 15 0 0 0 242 956A15 15 0 0 0 257 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="295,956 284,960 284,951" style="fill:rgb(0,0,0)"/>
<path d="M272,956L290,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,971L400,971L400,941L295,941Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="423,956 411,960 411,951" style="fill:rgb(0,0,0)"/>
<path d="M400,956L417,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,971A15 15 0 0 0 453 956A15 15 0 0 0 438 941A15 15 0 0 0 423 956A15 15 0 0 0 438 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,956 905,960 905,951" style="fill:rgb(0,0,0)"/>
<path d="M453,956L910,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,956 L 924,956 Q 931,956 931,948 L 931,941"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,956 33,960 33,951" style="fill:rgb(0,0,0)"/>
<path d="M24,941 L 24,948 Q 24,956 31,956 L 39,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,929 59,934 59,925" style="fill:rgb(0,0,0)"/>
<path d="M24,914 L 24,922 Q 24,929 39,929 L 49,929 L 64,929"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,929 L 201,929 Q 216,929 216,943 Q 216,956 223,956 L 231,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,929 L 101,929 Q 108,929 108,943 Q 108,956 116,956 L 123,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,1009L89,1009A15 15 0 0 0 104 994A15 15 0 0 0 89 978L60,978A15 15 0 0 0 45 994A15 15 0 0 0 60 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASE</text>
<polygon points="140,994 128,998 128,989" style="fill:rgb(0,0,0)"/>
<path d="M104,994L134,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M140,1009L189,1009L189,978L140,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="243,994 232,998 232,989" style="fill:rgb(0,0,0)"/>
<path d="M189,994L237,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,1009L298,1009A15 15 0 0 0 313 994A15 15 0 0 0 298 978L258,978A15 15 0 0 0 243 994A15 15 0 0 0 258 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="336,994 324,998 324,989" style="fill:rgb(0,0,0)"/>
<path d="M313,994L330,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,1009L385,1009L385,978L336,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="408,994 396,998 396,989" style="fill:rgb(0,0,0)"/>
<path d="M385,994L402,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,1009L456,1009A15 15 0 0 0 472 994A15 15 0 0 0 456 978L423,978A15 15 0 0 0 408 994A15 15 0 0 0 423 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">THEN</text>
<polygon points="495,994 483,998 483,989" style="fill:rgb(0,0,0)"/>
<path d="M472,994L489,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M495,1009L544,1009L544,978L495,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="616,994 604,998 604,989" style="fill:rgb(0,0,0)"/>
<path d="M544,994L610,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M631,1009L658,1009A15 15 0 0 0 673 994A15 15 0 0 0 658 978L631,978A15 15 0 0 0 616 994A15 15 0 0 0 631 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="645" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ELSE</text>
<polygon points="696,994 685,998 685,989" style="fill:rgb(0,0,0)"/>
<path d="M673,994L691,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M696,1009L746,1009L746,978L696,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="721" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="782,994 770,998 770,989" style="fill:rgb(0,0,0)"/>
<path d="M746,994L776,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M797,1009L818,1009A15 15 0 0 0 833 994A15 15 0 0 0 818 978L797,978A15 15 0 0 0 782 994A15 15 0 0 0 797 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="807" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="916,994 905,998 905,989" style="fill:rgb(0,0,0)"/>
<path d="M833,994L910,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,994 L 924,994 Q 931,994 931,986 L 931,979"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,994 33,998 33,989" style="fill:rgb(0,0,0)"/>
<path d="M24,978 L 24,986 Q 24,994 31,994 L 39,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,994 L 111,994 Q 119,994 119,1007 Q 119,1021 134,1021 L 186,1021 Q 201,1021 201,1007 Q 201,994 208,994 L 216,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="360,1021 372,1016 372,1025" style="fill:rgb(0,0,0)"/>
<path d="M544,994 L 551,994 Q 559,994 559,1007 Q 559,1021 544,1021 L 381,1021 L 366,1021"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,1021 L 235,1021 Q 220,1021 220,1007 Q 220,994 227,994 L 235,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,994 L 585,994 Q 593,994 593,1007 Q 593,1021 608,1021 L 742,1021 Q 757,1021 757,1007 Q 757,994 765,994 L 772,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,1066L173,1066L173,1036L45,1036Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="1051" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">raise-function</text>
<polygon points="916,1051 905,1055 905,1047" style="fill:rgb(0,0,0)"/>
<path d="M173,1051L910,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,1051 L 924,1051 Q 931,1051 931,1036 L 931,32 Q 931,17 939,17 L 946,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,1051 33,1055 33,1047" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,1036 Q 24,1051 31,1051 L 39,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/filter-clause.html">filter-clause:</a></b>
<button id='x59f12bc3' onclick='hideorshow("x59f12bc3","x7b9c42f8")'>show</button></p>
 <div id='x7b9c42f8' style='display:none;' class='imgcontainer'>
 <div style="max-width:422px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 422.381 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L93,32A15 15 0 0 0 108 17A15 15 0 0 0 93 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FILTER</text>
<polygon points="131,17 119,21 119,12" style="fill:rgb(0,0,0)"/>
<path d="M108,17L125,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,32L146,32A15 15 0 0 0 161 17A15 15 0 0 0 146 2L146,2A15 15 0 0 0 131 17A15 15 0 0 0 146 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="184,17 173,21 173,12" style="fill:rgb(0,0,0)"/>
<path d="M161,17L178,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M199,32L249,32A15 15 0 0 0 264 17A15 15 0 0 0 249 2L199,2A15 15 0 0 0 184 17A15 15 0 0 0 199 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="224" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="287,17 275,21 275,12" style="fill:rgb(0,0,0)"/>
<path d="M264,17L281,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,32L336,32L336,2L287,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M336,17L353,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,32A15 15 0 0 0 389 17A15 15 0 0 0 374 2A15 15 0 0 0 359 17A15 15 0 0 0 374 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="374" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="413,17 401,21 401,12" style="fill:rgb(0,0,0)"/>
<path d="M389,17L407,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="416" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/function-arguments.html">function-arguments:</a></b>
<button id='xfff012fa' onclick='hideorshow("xfff012fa","x1d3b25f5")'>show</button></p>
 <div id='x1d3b25f5' style='display:none;' class='imgcontainer'>
 <div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.566 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,26 55,30 55,22" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,41 L 43,41 Q 43,26 52,26 L 61,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M82,41L150,41A15 15 0 0 0 165 26L165,26A15 15 0 0 0 150 11L82,11A15 15 0 0 0 66 26L66,26A15 15 0 0 0 82 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="183,26 171,30 171,22" style="fill:rgb(0,0,0)"/>
<path d="M165,26L177,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M183,26 L 189,26 Q 194,26 194,41 L 194,41 Q 194,56 203,56 L 212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M218,56L248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,71L303,71L303,41L254,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="447,56 435,60 435,52" style="fill:rgb(0,0,0)"/>
<path d="M303,56L441,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="116,56 104,60 104,52" style="fill:rgb(0,0,0)"/>
<path d="M32,56L110,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M116,56L212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,32A15 15 0 0 0 293 17A15 15 0 0 0 278 2A15 15 0 0 0 263 17A15 15 0 0 0 278 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="293,17 305,12 305,21" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 314,56 Q 326,56 326,41 L 326,32 Q 326,17 312,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M263,17 L 245,17 Q 230,17 230,32 L 230,41 Q 230,56 239,56 L 248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,207A15 15 0 0 0 243 192L243,192A15 15 0 0 0 228 177A15 15 0 0 0 213 192L213,192A15 15 0 0 0 228 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="213,192 201,196 201,188" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,71 L 43,177 Q 43,192 58,192 L 192,192 L 207,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,192 267,196 267,188" style="fill:rgb(0,0,0)"/>
<path d="M243,192L272,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,192 L 360,192 Q 375,192 390,192 L 394,192 Q 409,192 409,177 L 409,71 Q 409,56 415,56 L 421,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="228,216 216,221 216,212" style="fill:rgb(0,0,0)"/>
<path d="M116,192 L 181,192 Q 196,192 196,204 Q 196,216 209,216 L 222,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,216 L 242,216 Q 257,216 257,204 Q 257,192 262,192 L 268,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="90,117 78,121 78,112" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 313,56 Q 323,56 323,71 L 323,71 Q 323,86 308,86 L 81,86 Q 66,86 66,101 L 66,102 Q 66,117 75,117 L 84,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,132L149,132A15 15 0 0 0 164 117L164,117A15 15 0 0 0 149 101L105,101A15 15 0 0 0 90 117L90,117A15 15 0 0 0 105 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="182,117 170,121 170,112" style="fill:rgb(0,0,0)"/>
<path d="M164,117L176,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,132L201,132A15 15 0 0 0 216 117L216,117A15 15 0 0 0 201 101L197,101A15 15 0 0 0 182 117L182,117A15 15 0 0 0 197 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M216,117L239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,132L375,132L375,101L245,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,169A15 15 0 0 0 325 154A15 15 0 0 0 310 139A15 15 0 0 0 294 154A15 15 0 0 0 310 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,154 336,150 336,159" style="fill:rgb(0,0,0)"/>
<path d="M375,117 L 380,117 Q 386,117 386,132 L 386,139 Q 386,154 371,154 L 345,154 L 330,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M294,154 L 260,154 Q 245,154 236,154 Q 227,154 227,139 L 227,132 Q 227,117 233,117 L 239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M375,117 L 383,117 Q 392,117 392,102 L 392,71 Q 392,56 407,56 L 413,56 L 428,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x85796c0f' onclick='hideorshow("x85796c0f","xc9daed17")'>show</button></p>
 <div id='xc9daed17' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/literal-value.html">literal-value:</a></b>
<button id='xaed02f7d' onclick='hideorshow("xaed02f7d","x44e94452")'>show</button></p>
 <div id='x44e94452' style='display:none;' class='imgcontainer'>
 <div style="max-width:341px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 341.376 336.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,319 39,324 39,315" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,304 Q 24,319 34,319 L 45,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,334L252,334A15 15 0 0 0 267 319A15 15 0 0 0 252 304L65,304A15 15 0 0 0 50 319A15 15 0 0 0 65 334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIMESTAMP</text>
<polygon points="290,319 278,324 278,315" style="fill:rgb(0,0,0)"/>
<path d="M267,319L284,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,17 320,21 320,12" style="fill:rgb(0,0,0)"/>
<path d="M290,319 L 297,319 Q 305,319 305,304 L 305,32 Q 305,17 315,17 L 326,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="335" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L172,32A15 15 0 0 0 187 17A15 15 0 0 0 172 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="119" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,17L320,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L153,70A15 15 0 0 0 168 55L168,55A15 15 0 0 0 153 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">string-literal</text>
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,47 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,55 278,59 278,50" style="fill:rgb(0,0,0)"/>
<path d="M168,55L284,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,55 L 297,55 Q 305,55 305,47 L 305,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L140,108A15 15 0 0 0 155 92A15 15 0 0 0 140 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">blob-literal</text>
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,85 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,92 278,97 278,88" style="fill:rgb(0,0,0)"/>
<path d="M155,92L284,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,92 L 297,92 Q 305,92 305,85 L 305,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,145L97,145A15 15 0 0 0 112 130A15 15 0 0 0 97 115L66,115A15 15 0 0 0 50 130A15 15 0 0 0 66 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="50,130 39,135 39,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 34,130 L 45,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,130 278,135 278,126" style="fill:rgb(0,0,0)"/>
<path d="M112,130L284,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,130 L 297,130 Q 305,130 305,123 L 305,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,183L96,183A15 15 0 0 0 111 168A15 15 0 0 0 96 153L66,153A15 15 0 0 0 50 168A15 15 0 0 0 66 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRUE</text>
<polygon points="50,168 39,172 39,164" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,160 Q 24,168 34,168 L 45,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,168 278,172 278,164" style="fill:rgb(0,0,0)"/>
<path d="M111,168L284,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,168 L 297,168 Q 305,168 305,160 L 305,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,221L104,221A15 15 0 0 0 119 206A15 15 0 0 0 104 191L66,191A15 15 0 0 0 50 206A15 15 0 0 0 66 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FALSE</text>
<polygon points="50,206 39,210 39,201" style="fill:rgb(0,0,0)"/>
<path d="M24,191 L 24,198 Q 24,206 34,206 L 45,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,206 278,210 278,201" style="fill:rgb(0,0,0)"/>
<path d="M119,206L284,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,206 L 297,206 Q 305,206 305,198 L 305,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,259L190,259A15 15 0 0 0 205 244A15 15 0 0 0 190 228L66,228A15 15 0 0 0 50 244A15 15 0 0 0 66 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="128" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIME</text>
<polygon points="50,244 39,248 39,239" style="fill:rgb(0,0,0)"/>
<path d="M24,228 L 24,236 Q 24,244 34,244 L 45,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,244 278,248 278,239" style="fill:rgb(0,0,0)"/>
<path d="M205,244L284,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,244 L 297,244 Q 305,244 305,236 L 305,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,297L192,297A15 15 0 0 0 207 281A15 15 0 0 0 192 266L66,266A15 15 0 0 0 50 281A15 15 0 0 0 66 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_DATE</text>
<polygon points="50,281 39,286 39,277" style="fill:rgb(0,0,0)"/>
<path d="M24,266 L 24,274 Q 24,281 34,281 L 45,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,281 278,286 278,277" style="fill:rgb(0,0,0)"/>
<path d="M207,281L284,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,281 L 297,281 Q 305,281 305,274 L 305,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/over-clause.html">over-clause:</a></b>
<button id='x3618eceb' onclick='hideorshow("x3618eceb","xf6af6811")'>show</button></p>
 <div id='xf6af6811' style='display:none;' class='imgcontainer'>
 <div style="max-width:600px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 600.706 418.392">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="129,17 117,21 117,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L123,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M144,32L241,32A15 15 0 0 0 256 17A15 15 0 0 0 241 2L144,2A15 15 0 0 0 129 17A15 15 0 0 0 144 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,17 L 100,17 Q 108,17 108,32 L 108,40 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,70A15 15 0 0 0 165 55L165,55A15 15 0 0 0 149 39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 149 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="149" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="206,82 195,86 195,77" style="fill:rgb(0,0,0)"/>
<path d="M165,55 L 172,55 Q 180,55 180,68 Q 180,82 190,82 L 200,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,97L363,97A15 15 0 0 0 378 82A15 15 0 0 0 363 67L221,67A15 15 0 0 0 206 82A15 15 0 0 0 221 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="292" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M221,173L301,173A15 15 0 0 0 316 157A15 15 0 0 0 301 142L221,142A15 15 0 0 0 206 157A15 15 0 0 0 221 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="339,157 328,162 328,153" style="fill:rgb(0,0,0)"/>
<path d="M316,157L333,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,173L358,173A15 15 0 0 0 373 157A15 15 0 0 0 358 142L354,142A15 15 0 0 0 339 157A15 15 0 0 0 354 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="409,157 398,162 398,153" style="fill:rgb(0,0,0)"/>
<path d="M373,157L404,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,173L459,173L459,142L409,142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M434,210A15 15 0 0 0 449 195A15 15 0 0 0 434 180A15 15 0 0 0 419 195A15 15 0 0 0 434 210Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="195" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="449,195 461,191 461,200" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,180 Q 474,195 464,195 L 455,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,195 L 398,195 Q 383,195 383,180 L 383,172 Q 383,157 390,157 L 398,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,55 280,59 280,50" style="fill:rgb(0,0,0)"/>
<path d="M165,55L286,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,120 304,115 304,124" style="fill:rgb(0,0,0)"/>
<path d="M292,55 L 401,55 Q 416,55 416,70 L 416,105 Q 416,120 401,120 L 313,120 L 298,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,157 195,162 195,153" style="fill:rgb(0,0,0)"/>
<path d="M292,120 L 180,120 Q 165,120 165,135 L 165,142 Q 165,157 180,157 L 185,157 L 200,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="401,82 389,86 389,77" style="fill:rgb(0,0,0)"/>
<path d="M378,82L395,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,82 L 408,82 Q 416,82 416,89 L 416,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,286L266,286A15 15 0 0 0 281 271A15 15 0 0 0 266 256L221,256A15 15 0 0 0 206 271A15 15 0 0 0 221 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="244" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="304,271 292,275 292,266" style="fill:rgb(0,0,0)"/>
<path d="M281,271L298,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M319,286L323,286A15 15 0 0 0 338 271A15 15 0 0 0 323 256L319,256A15 15 0 0 0 304 271A15 15 0 0 0 319 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="321" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="374,271 363,275 363,266" style="fill:rgb(0,0,0)"/>
<path d="M338,271L368,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,286L504,286L504,256L374,256Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M439,324A15 15 0 0 0 454 309A15 15 0 0 0 439 293A15 15 0 0 0 424 309A15 15 0 0 0 439 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="454,309 466,304 466,313" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,294 Q 519,309 504,309 L 475,309 L 460,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,309 L 363,309 Q 348,309 348,294 L 348,286 Q 348,271 355,271 L 363,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,233 304,229 304,237" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,218 Q 474,233 459,233 L 313,233 L 298,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,271 195,275 195,266" style="fill:rgb(0,0,0)"/>
<path d="M292,233 L 180,233 Q 165,233 165,248 L 165,256 Q 165,271 180,271 L 185,271 L 200,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,195 160,184 169,184" style="fill:rgb(0,0,0)"/>
<path d="M165,142L165,189"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,195L165,256"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,399L311,399L311,369L206,369Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="384" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="519,384 508,389 508,380" style="fill:rgb(0,0,0)"/>
<path d="M311,384L513,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M534,399A15 15 0 0 0 549 384A15 15 0 0 0 534 369A15 15 0 0 0 519 384A15 15 0 0 0 534 399Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="384" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="591,17 579,21 579,12" style="fill:rgb(0,0,0)"/>
<path d="M549,384 L 557,384 Q 564,384 564,369 L 564,32 Q 564,17 575,17 L 585,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="594" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,17 508,21 508,12" style="fill:rgb(0,0,0)"/>
<path d="M256,17L513,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,17L579,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,346 304,342 304,351" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,331 Q 519,346 504,346 L 313,346 L 298,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,384 195,389 195,380" style="fill:rgb(0,0,0)"/>
<path d="M292,346 L 180,346 Q 165,346 165,361 L 165,369 Q 165,384 180,384 L 185,384 L 200,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,309 160,297 169,297" style="fill:rgb(0,0,0)"/>
<path d="M165,256L165,303"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,309L165,369"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="258,411 247,416 247,407" style="fill:rgb(0,0,0)"/>
<path d="M165,369 L 165,396 Q 165,411 180,411 L 238,411 L 253,411"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,384 369,389 369,380" style="fill:rgb(0,0,0)"/>
<path d="M258,411 L 335,411 Q 350,411 350,398 Q 350,384 362,384 L 375,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='xa9534ea1' onclick='hideorshow("xa9534ea1","x96d5581d")'>show</button></p>
 <div id='x96d5581d' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x011b0759' onclick='hideorshow("x011b0759","x9af0f3c5")'>show</button></p>
 <div id='x9af0f3c5' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/raise-function.html">raise-function:</a></b>
<button id='xf7845a7e' onclick='hideorshow("xf7845a7e","x92f5b767")'>show</button></p>
 <div id='x92f5b767' style='display:none;' class='imgcontainer'>
 <div style="max-width:627px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 627.302 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L82,32A15 15 0 0 0 97 17A15 15 0 0 0 82 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RAISE</text>
<polygon points="120,17 109,21 109,12" style="fill:rgb(0,0,0)"/>
<path d="M97,17L114,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,32L135,32A15 15 0 0 0 150 17A15 15 0 0 0 135 2L135,2A15 15 0 0 0 120 17A15 15 0 0 0 135 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="135" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="192,55 180,59 180,50" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 158,17 Q 165,17 165,32 L 165,40 Q 165,55 176,55 L 186,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,70L285,70A15 15 0 0 0 300 55L300,55A15 15 0 0 0 285 39L207,39A15 15 0 0 0 192 55L192,55A15 15 0 0 0 207 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="336,55 324,59 324,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70A15 15 0 0 0 366 55L366,55A15 15 0 0 0 351 39A15 15 0 0 0 336 55L336,55A15 15 0 0 0 351 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="389,55 378,59 378,50" style="fill:rgb(0,0,0)"/>
<path d="M366,55L383,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,70L508,70A15 15 0 0 0 523 55L523,55A15 15 0 0 0 508 39L404,39A15 15 0 0 0 389 55L389,55A15 15 0 0 0 404 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="456" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">error-message</text>
<polygon points="564,17 553,21 553,12" style="fill:rgb(0,0,0)"/>
<path d="M523,55 L 530,55 Q 538,55 538,40 L 538,32 Q 538,17 548,17 L 558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M579,32A15 15 0 0 0 594 17A15 15 0 0 0 579 2A15 15 0 0 0 564 17A15 15 0 0 0 579 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="617,17 606,21 606,12" style="fill:rgb(0,0,0)"/>
<path d="M594,17L612,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="621" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L259,32A15 15 0 0 0 274 17A15 15 0 0 0 259 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="456,17 444,21 444,12" style="fill:rgb(0,0,0)"/>
<path d="M274,17L450,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,17L553,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,108L249,108A15 15 0 0 0 264 92A15 15 0 0 0 249 77L207,77A15 15 0 0 0 192 92A15 15 0 0 0 207 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="300,92 288,97 288,88" style="fill:rgb(0,0,0)"/>
<path d="M264,92L294,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,92 L 307,92 Q 315,92 315,77 L 315,70 Q 315,55 322,55 L 330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,145L229,145A15 15 0 0 0 244 130A15 15 0 0 0 229 115L207,115A15 15 0 0 0 192 130A15 15 0 0 0 207 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="300,130 288,135 288,126" style="fill:rgb(0,0,0)"/>
<path d="M244,130L294,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,130 L 307,130 Q 315,130 315,115 L 315,92 L 315,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,130 180,135 180,126" style="fill:rgb(0,0,0)"/>
<path d="M165,39 L 165,115 Q 165,130 176,130 L 186,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,92 180,97 180,88" style="fill:rgb(0,0,0)"/>
<path d="M165,77 L 165,85 Q 165,92 176,92 L 186,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/select-stmt.html">select-stmt:</a></b>
<button id='xce31dfdf' onclick='hideorshow("xce31dfdf","x7e547e21")'>show</button></p>
 <div id='x7e547e21' style='display:none;' class='imgcontainer'>
 <div style="max-width:669px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 669.677 1162.3">
<path d="M55,845L667,845L667,99L55,99Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="6" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="46,17 34,21 34,12" style="fill:rgb(0,0,0)"/>
<path d="M10,17L40,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M61,32L92,32A15 15 0 0 0 107 17A15 15 0 0 0 92 2L61,2A15 15 0 0 0 46 17A15 15 0 0 0 61 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="76" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M167,62L253,62A15 15 0 0 0 268 47L268,47A15 15 0 0 0 253 32L167,32A15 15 0 0 0 152 47L152,47A15 15 0 0 0 167 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="210,17 198,21 198,12" style="fill:rgb(0,0,0)"/>
<path d="M107,17L204,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M210,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M358,32L584,32L584,2L358,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="152,47 140,51 140,43" style="fill:rgb(0,0,0)"/>
<path d="M107,17 L 114,17 Q 122,17 122,32 L 122,32 Q 122,47 134,47 L 146,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="291,47 279,51 279,43" style="fill:rgb(0,0,0)"/>
<path d="M268,47L285,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,47 L 298,47 Q 306,47 306,32 L 306,32 Q 306,17 321,17 L 331,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,70A15 15 0 0 0 486 55L486,55A15 15 0 0 0 471 39A15 15 0 0 0 456 55L456,55A15 15 0 0 0 471 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="486,55 498,50 498,59" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,40 Q 599,55 584,55 L 507,55 L 492,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,55 L 350,55 Q 335,55 335,40 L 335,32 Q 335,17 340,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,83 307,79 307,88" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,68 Q 599,83 584,83 L 316,83 L 301,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,83 L 40,83 Q 25,83 25,98 L 25,113"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="25,47 20,36 29,36" style="fill:rgb(0,0,0)"/>
<path d="M10,17 L 17,17 Q 25,17 25,29 L 25,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="55,129 43,133 43,124" style="fill:rgb(0,0,0)"/>
<path d="M25,47 L 25,114 Q 25,129 37,129 L 49,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,129 115,133 115,124" style="fill:rgb(0,0,0)"/>
<path d="M55,129L121,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,144L193,144A15 15 0 0 0 208 129A15 15 0 0 0 193 114L142,114A15 15 0 0 0 127 129A15 15 0 0 0 142 144Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="250,159 238,163 238,155" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,144 Q 223,159 233,159 L 244,159"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,174L333,174A15 15 0 0 0 348 159A15 15 0 0 0 333 144L265,144A15 15 0 0 0 250 159A15 15 0 0 0 265 174Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="159" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="417,129 406,133 406,124" style="fill:rgb(0,0,0)"/>
<path d="M348,159 L 356,159 Q 363,159 363,144 L 363,144 Q 363,129 378,129 L 396,129 L 411,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,144L545,144L545,114L417,114Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M481,182A15 15 0 0 0 496 166A15 15 0 0 0 481 151A15 15 0 0 0 466 166A15 15 0 0 0 481 182Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="166" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="496,166 508,162 508,171" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,151 Q 560,166 545,166 L 517,166 L 502,166"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M466,166 L 406,166 Q 391,166 391,151 L 391,144 Q 391,129 398,129 L 406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,129 287,133 287,124" style="fill:rgb(0,0,0)"/>
<path d="M208,129L293,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M299,129L406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,212L280,212A15 15 0 0 0 295 197A15 15 0 0 0 280 182L265,182A15 15 0 0 0 250 197A15 15 0 0 0 265 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="197" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="348,197 337,201 337,192" style="fill:rgb(0,0,0)"/>
<path d="M295,197L342,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,197 L 356,197 Q 363,197 363,182 L 363,159 L 363,144"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="250,197 238,201 238,192" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,182 Q 223,197 233,197 L 244,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,287L203,287A15 15 0 0 0 218 272A15 15 0 0 0 203 257L168,257A15 15 0 0 0 153 272A15 15 0 0 0 168 287Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="186" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="290,272 279,277 279,268" style="fill:rgb(0,0,0)"/>
<path d="M218,272L284,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,287L451,287L451,257L290,257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M320,362L422,362L422,331L320,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M371,324A15 15 0 0 0 386 309A15 15 0 0 0 371 293A15 15 0 0 0 356 309A15 15 0 0 0 371 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="386,309 397,304 397,313" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 459,272 Q 466,272 466,287 L 466,294 Q 466,309 451,309 L 407,309 L 392,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M356,309 L 279,309 Q 264,309 264,294 L 264,287 Q 264,272 271,272 L 279,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="320,346 308,351 308,342" style="fill:rgb(0,0,0)"/>
<path d="M218,272 L 226,272 Q 233,272 233,287 L 233,331 Q 233,346 248,346 L 299,346 L 314,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="484,313 488,325 480,325" style="fill:rgb(0,0,0)"/>
<path d="M422,346 L 436,346 Q 451,346 466,346 L 469,346 Q 484,346 484,333 L 484,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,272 494,277 494,268" style="fill:rgb(0,0,0)"/>
<path d="M484,313 L 484,287 Q 484,272 492,272 L 499,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,272 L 496,272 Q 487,272 487,272 Q 487,272 495,272 L 502,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,197 555,185 564,185" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,176 L 560,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,235 360,230 360,239" style="fill:rgb(0,0,0)"/>
<path d="M560,197 L 560,220 Q 560,235 545,235 L 369,235 L 354,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,272 142,277 142,268" style="fill:rgb(0,0,0)"/>
<path d="M348,235 L 142,235 Q 127,235 127,250 L 127,257 Q 127,272 137,272 L 147,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,437L218,437A15 15 0 0 0 233 422A15 15 0 0 0 218 407L168,407A15 15 0 0 0 153 422A15 15 0 0 0 168 437Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="256,422 244,426 244,418" style="fill:rgb(0,0,0)"/>
<path d="M233,422L250,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,437L305,437L305,407L256,407Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="517,324 513,312 521,312" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 502,272 Q 517,272 517,287 L 517,303 L 517,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,384 382,380 382,389" style="fill:rgb(0,0,0)"/>
<path d="M517,324 L 517,369 Q 517,384 502,384 L 391,384 L 376,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,422 142,426 142,418" style="fill:rgb(0,0,0)"/>
<path d="M371,384 L 142,384 Q 127,384 127,399 L 127,407 Q 127,422 137,422 L 147,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,324 122,312 131,312" style="fill:rgb(0,0,0)"/>
<path d="M127,257L127,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,324L127,407"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,535L212,535A15 15 0 0 0 227 520A15 15 0 0 0 212 505L168,505A15 15 0 0 0 153 520A15 15 0 0 0 168 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="250,520 238,525 238,516" style="fill:rgb(0,0,0)"/>
<path d="M227,520L244,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,535L269,535A15 15 0 0 0 284 520A15 15 0 0 0 269 505L265,505A15 15 0 0 0 250 520A15 15 0 0 0 265 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="320,520 309,525 309,516" style="fill:rgb(0,0,0)"/>
<path d="M284,520L314,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,535L369,535L369,505L320,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="452,520 441,525 441,516" style="fill:rgb(0,0,0)"/>
<path d="M369,520L446,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,535L520,535A15 15 0 0 0 535 520A15 15 0 0 0 520 505L467,505A15 15 0 0 0 452 520A15 15 0 0 0 467 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="558,520 546,525 546,516" style="fill:rgb(0,0,0)"/>
<path d="M535,520L552,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,535L607,535L607,505L558,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M345,573A15 15 0 0 0 360 558A15 15 0 0 0 345 543A15 15 0 0 0 330 558A15 15 0 0 0 345 573Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="558" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="360,558 371,554 371,562" style="fill:rgb(0,0,0)"/>
<path d="M369,520 L 377,520 Q 384,520 384,535 L 384,543 Q 384,558 375,558 L 366,558"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,558 L 309,558 Q 294,558 294,543 L 294,535 Q 294,520 301,520 L 309,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="514,551 503,555 503,546" style="fill:rgb(0,0,0)"/>
<path d="M411,520 L 418,520 Q 426,520 426,535 L 426,536 Q 426,551 441,551 L 493,551 L 508,551"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M514,551 L 607,551 Q 622,551 622,536 L 622,535 Q 622,520 630,520 L 637,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,490 256,494 256,486" style="fill:rgb(0,0,0)"/>
<path d="M127,460 L 127,475 Q 127,490 142,490 L 246,490 L 261,490"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,520 399,525 399,516" style="fill:rgb(0,0,0)"/>
<path d="M267,490 L 369,490 Q 384,490 384,505 L 384,505 Q 384,520 395,520 L 405,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,460 244,455 244,464" style="fill:rgb(0,0,0)"/>
<path d="M305,422 L 313,422 Q 320,422 320,437 L 320,445 Q 320,460 305,460 L 254,460 L 239,460"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,520 142,525 142,516" style="fill:rgb(0,0,0)"/>
<path d="M233,460 L 142,460 Q 127,460 127,475 L 127,505 Q 127,520 137,520 L 147,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,447 122,435 131,435" style="fill:rgb(0,0,0)"/>
<path d="M127,407L127,441"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,447L127,505"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,649L232,649A15 15 0 0 0 247 634A15 15 0 0 0 232 619L168,619A15 15 0 0 0 153 634A15 15 0 0 0 168 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="200" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="283,634 271,638 271,629" style="fill:rgb(0,0,0)"/>
<path d="M247,634L277,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,649L395,649A15 15 0 0 0 410 634A15 15 0 0 0 395 619L298,619A15 15 0 0 0 283 634A15 15 0 0 0 298 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="433,634 422,638 422,629" style="fill:rgb(0,0,0)"/>
<path d="M410,634L427,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,649L452,649A15 15 0 0 0 467 634A15 15 0 0 0 452 619L448,619A15 15 0 0 0 433 634A15 15 0 0 0 448 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="450" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="490,634 479,638 479,629" style="fill:rgb(0,0,0)"/>
<path d="M467,634L485,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,649L609,649L609,619L490,619Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="550" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M446,687A15 15 0 0 0 461 671A15 15 0 0 0 446 656A15 15 0 0 0 431 671A15 15 0 0 0 446 687Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="671" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="461,671 472,667 472,676" style="fill:rgb(0,0,0)"/>
<path d="M609,634 L 616,634 Q 624,634 624,649 L 624,656 Q 624,671 609,671 L 482,671 L 467,671"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,671 L 271,671 Q 256,671 256,656 L 256,649 Q 256,634 264,634 L 271,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="624,692 619,680 628,680" style="fill:rgb(0,0,0)"/>
<path d="M624,656L624,686"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,558 648,547 656,547" style="fill:rgb(0,0,0)"/>
<path d="M607,520 L 637,520 Q 652,520 652,535 L 652,537 L 652,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,596 382,592 382,600" style="fill:rgb(0,0,0)"/>
<path d="M652,558 L 652,581 Q 652,596 637,596 L 391,596 L 376,596"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,634 142,638 142,629" style="fill:rgb(0,0,0)"/>
<path d="M371,596 L 142,596 Q 127,596 127,611 L 127,619 Q 127,634 137,634 L 147,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,558 122,547 131,547" style="fill:rgb(0,0,0)"/>
<path d="M127,505L127,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,709 359,714 359,705" style="fill:rgb(0,0,0)"/>
<path d="M127,558 L 127,694 Q 127,709 142,709 L 350,709 L 365,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,709 597,714 597,705" style="fill:rgb(0,0,0)"/>
<path d="M371,709L603,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,709 L 616,709 Q 624,709 624,717 L 624,724"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,800L194,800A15 15 0 0 0 209 785A15 15 0 0 0 194 770L142,770A15 15 0 0 0 127 785A15 15 0 0 0 142 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="245,785 234,789 234,781" style="fill:rgb(0,0,0)"/>
<path d="M209,785L239,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,800A15 15 0 0 0 275 785A15 15 0 0 0 260 770A15 15 0 0 0 245 785A15 15 0 0 0 260 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="311,785 300,789 300,781" style="fill:rgb(0,0,0)"/>
<path d="M275,785L306,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,800L361,800L361,770L311,770Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="397,785 385,789 385,781" style="fill:rgb(0,0,0)"/>
<path d="M361,785L391,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,800A15 15 0 0 0 427 785A15 15 0 0 0 412 770A15 15 0 0 0 397 785A15 15 0 0 0 412 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="412" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="609,785 597,789 597,781" style="fill:rgb(0,0,0)"/>
<path d="M427,785L603,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,785 L 616,785 Q 624,785 624,792 L 624,800"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,762A15 15 0 0 0 351 747A15 15 0 0 0 336 732A15 15 0 0 0 321 747A15 15 0 0 0 336 762Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="747" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M336,838A15 15 0 0 0 351 823A15 15 0 0 0 336 808A15 15 0 0 0 321 823A15 15 0 0 0 336 838Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="823" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="351,747 363,743 363,751" style="fill:rgb(0,0,0)"/>
<path d="M361,785 L 368,785 Q 376,785 376,770 L 376,762 Q 376,747 366,747 L 357,747"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,747 L 300,747 Q 285,747 285,762 L 285,770 Q 285,785 292,785 L 300,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,823 363,818 363,827" style="fill:rgb(0,0,0)"/>
<path d="M427,785 L 434,785 Q 442,785 442,800 L 442,808 Q 442,823 427,823 L 372,823 L 357,823"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,823 L 234,823 Q 219,823 219,808 L 219,800 Q 219,785 226,785 L 234,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,785 115,789 115,781" style="fill:rgb(0,0,0)"/>
<path d="M55,129 L 62,129 Q 70,129 70,144 L 70,770 Q 70,785 85,785 L 106,785 L 121,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,891L424,891L424,860L248,860Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="876" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="424,876 436,871 436,880" style="fill:rgb(0,0,0)"/>
<path d="M624,692 L 624,861 Q 624,876 609,876 L 445,876 L 430,876"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="6,197 10,208 2,208" style="fill:rgb(0,0,0)"/>
<path d="M248,876 L 21,876 Q 6,876 6,861 L 6,217 L 6,202"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M6,197 L 6,144 Q 6,129 21,129 L 40,129 L 55,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="667" y="275" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" transform="rotate(-90 667,285)" dominant-baseline="central">select-core</text>
<path d="M168,966L213,966A15 15 0 0 0 228 951A15 15 0 0 0 213 936L168,936A15 15 0 0 0 153 951A15 15 0 0 0 168 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="251,951 239,956 239,947" style="fill:rgb(0,0,0)"/>
<path d="M228,951L245,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,966L270,966A15 15 0 0 0 285 951A15 15 0 0 0 270 936L266,936A15 15 0 0 0 251 951A15 15 0 0 0 266 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M168,1072L202,1072A15 15 0 0 0 217 1057A15 15 0 0 0 202 1042L168,1042A15 15 0 0 0 153 1057A15 15 0 0 0 168 1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="240,1057 228,1061 228,1053" style="fill:rgb(0,0,0)"/>
<path d="M217,1057L234,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,1072L289,1072L289,1042L240,1042Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="330,951 319,956 319,947" style="fill:rgb(0,0,0)"/>
<path d="M285,951L324,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,966L460,966L460,936L330,936Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M395,1004A15 15 0 0 0 410 989A15 15 0 0 0 395 974A15 15 0 0 0 380 989A15 15 0 0 0 395 1004Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="989" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="410,989 422,985 422,993" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 468,951 Q 475,951 475,966 L 475,974 Q 475,989 460,989 L 431,989 L 416,989"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,989 L 322,989 Q 307,989 307,974 L 307,966 Q 307,951 313,951 L 319,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,913 348,909 348,918" style="fill:rgb(0,0,0)"/>
<path d="M624,860 L 624,898 Q 624,913 609,913 L 357,913 L 342,913"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,951 142,956 142,947" style="fill:rgb(0,0,0)"/>
<path d="M336,913 L 142,913 Q 127,913 127,928 L 127,936 Q 127,951 137,951 L 147,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,981 492,970 500,970" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 481,951 Q 496,951 496,963 L 496,976"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,1023 318,1019 318,1027" style="fill:rgb(0,0,0)"/>
<path d="M496,981 L 496,1008 Q 496,1023 481,1023 L 327,1023 L 312,1023"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,1057 142,1061 142,1053" style="fill:rgb(0,0,0)"/>
<path d="M307,1023 L 142,1023 Q 127,1023 127,1038 L 127,1042 Q 127,1057 137,1057 L 147,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,989 122,978 131,978" style="fill:rgb(0,0,0)"/>
<path d="M127,936L127,983"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,989L127,1042"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1102L415,1102A15 15 0 0 0 430 1087A15 15 0 0 0 415 1072L363,1072A15 15 0 0 0 348 1087A15 15 0 0 0 363 1102Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="389" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="453,1087 441,1092 441,1083" style="fill:rgb(0,0,0)"/>
<path d="M430,1087L447,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,1102L502,1102L502,1072L453,1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="525,1087 513,1092 513,1083" style="fill:rgb(0,0,0)"/>
<path d="M502,1087L519,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1140A15 15 0 0 0 378 1125A15 15 0 0 0 363 1110A15 15 0 0 0 348 1125A15 15 0 0 0 363 1140Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="1125" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="401,1125 390,1129 390,1121" style="fill:rgb(0,0,0)"/>
<path d="M378,1125L396,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,1140L451,1140L451,1110L401,1110Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="1125" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="312,1057 301,1061 301,1053" style="fill:rgb(0,0,0)"/>
<path d="M289,1057L306,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1125 337,1129 337,1121" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1110 Q 327,1125 335,1125 L 342,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1087 337,1092 337,1083" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1072 Q 327,1087 335,1087 L 342,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1057 513,1061 513,1053" style="fill:rgb(0,0,0)"/>
<path d="M312,1057L519,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="620,1155 609,1160 609,1151" style="fill:rgb(0,0,0)"/>
<path d="M525,1057 L 546,1057 Q 561,1057 561,1072 L 561,1140 Q 561,1155 576,1155 L 599,1155 L 614,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="624" cy="1155" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1087 L 546,1087 Q 561,1087 561,1095 L 561,1102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1125 513,1129 513,1121" style="fill:rgb(0,0,0)"/>
<path d="M451,1125L519,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1125 L 546,1125 Q 561,1125 561,1133 L 561,1140"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1155 513,1160 513,1151" style="fill:rgb(0,0,0)"/>
<path d="M127,1042 L 127,1140 Q 127,1155 142,1155 L 504,1155 L 519,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1155L597,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/common-table-expression.html">common-table-expression:</a></b>
<button id='xb65dd281' onclick='hideorshow("xb65dd281","xd201cf7d")'>show</button></p>
 <div id='xd201cf7d' style='display:none;' class='imgcontainer'>
 <div style="max-width:638px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 638.525 167.4">
<circle cx="5" cy="29" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,29 20,33 20,24" style="fill:rgb(0,0,0)"/>
<path d="M9,29L26,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,44L122,44A15 15 0 0 0 137 29A15 15 0 0 0 122 14L47,14A15 15 0 0 0 32 29A15 15 0 0 0 47 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="160,29 149,33 149,24" style="fill:rgb(0,0,0)"/>
<path d="M137,29L155,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="196,29 185,33 185,24" style="fill:rgb(0,0,0)"/>
<path d="M160,29L191,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,44A15 15 0 0 0 227 29A15 15 0 0 0 211 14A15 15 0 0 0 196 29A15 15 0 0 0 211 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="250,29 238,33 238,24" style="fill:rgb(0,0,0)"/>
<path d="M227,29L244,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="286,29 274,33 274,24" style="fill:rgb(0,0,0)"/>
<path d="M250,29L280,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,44L395,44A15 15 0 0 0 410 29A15 15 0 0 0 395 14L301,14A15 15 0 0 0 286 29A15 15 0 0 0 301 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="446,29 434,33 434,24" style="fill:rgb(0,0,0)"/>
<path d="M410,29L440,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,44A15 15 0 0 0 476 29A15 15 0 0 0 461 14A15 15 0 0 0 446 29A15 15 0 0 0 461 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,29 499,33 499,24" style="fill:rgb(0,0,0)"/>
<path d="M476,29L505,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,165L51,165A15 15 0 0 0 66 150A15 15 0 0 0 51 135L47,135A15 15 0 0 0 32 150A15 15 0 0 0 47 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="49" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<path d="M127,135L147,135A15 15 0 0 0 162 119A15 15 0 0 0 147 104L127,104A15 15 0 0 0 112 119A15 15 0 0 0 127 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<path d="M219,135L337,135A15 15 0 0 0 352 119A15 15 0 0 0 337 104L219,104A15 15 0 0 0 204 119A15 15 0 0 0 219 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<path d="M162,119L204,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,165A15 15 0 0 0 425 150A15 15 0 0 0 410 135A15 15 0 0 0 395 150A15 15 0 0 0 410 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="410" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="448,150 437,154 437,145" style="fill:rgb(0,0,0)"/>
<path d="M425,150L442,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,165L552,165L552,135L448,135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="500" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="575,150 564,154 564,145" style="fill:rgb(0,0,0)"/>
<path d="M552,150L570,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M591,165A15 15 0 0 0 606 150A15 15 0 0 0 591 135A15 15 0 0 0 575 150A15 15 0 0 0 591 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="629,150 617,154 617,145" style="fill:rgb(0,0,0)"/>
<path d="M606,150L623,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="632" cy="150" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,82A15 15 0 0 0 363 66A15 15 0 0 0 348 51A15 15 0 0 0 333 66A15 15 0 0 0 348 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="363,66 374,62 374,71" style="fill:rgb(0,0,0)"/>
<path d="M410,29 L 417,29 Q 425,29 425,44 L 425,51 Q 425,66 410,66 L 384,66 L 369,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M333,66 L 278,66 Q 263,66 263,51 L 263,44 Q 263,29 270,29 L 278,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,93 78,89 78,97" style="fill:rgb(0,0,0)"/>
<path d="M511,29 L 516,29 Q 522,29 522,44 L 522,78 Q 522,93 507,93 L 87,93 L 72,93"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,150 20,154 20,145" style="fill:rgb(0,0,0)"/>
<path d="M66,93 L 30,93 Q 15,93 15,108 L 15,135 Q 15,150 20,150 L 26,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="85,150 73,154 73,145" style="fill:rgb(0,0,0)"/>
<path d="M66,150L79,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="112,119 101,124 101,115" style="fill:rgb(0,0,0)"/>
<path d="M85,150 L 89,150 Q 92,150 92,135 L 92,134 Q 92,119 99,119 L 106,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="204,119 192,124 192,115" style="fill:rgb(0,0,0)"/>
<path d="M66,150 L 147,150 Q 162,150 170,150 Q 177,150 177,135 L 177,134 Q 177,119 188,119 L 198,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,150 383,154 383,145" style="fill:rgb(0,0,0)"/>
<path d="M352,119 L 360,119 Q 367,119 367,134 L 367,135 Q 367,150 378,150 L 389,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150L395,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,6 336,10 336,2" style="fill:rgb(0,0,0)"/>
<path d="M160,29 L 168,29 Q 175,29 175,17 Q 175,6 190,6 L 327,6 L 342,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,6 L 473,6 Q 488,6 488,17 Q 488,29 495,29 L 503,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/compound-operator.html">compound-operator:</a></b>
<button id='x37d1bef9' onclick='hideorshow("x37d1bef9","x68306aa4")'>show</button></p>
 <div id='x68306aa4' style='display:none;' class='imgcontainer'>
 <div style="max-width:293px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 293.842 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L127,32A15 15 0 0 0 142 17A15 15 0 0 0 127 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,70L127,70A15 15 0 0 0 142 55L142,55A15 15 0 0 0 127 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,108L168,108A15 15 0 0 0 183 92A15 15 0 0 0 168 77L83,77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M83,145L135,145A15 15 0 0 0 150 130A15 15 0 0 0 135 115L83,115A15 15 0 0 0 68 130A15 15 0 0 0 83 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M142,55L159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70L195,70A15 15 0 0 0 210 55L210,55A15 15 0 0 0 195 39L180,39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="233,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M210,55L227,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,17 272,21 272,12" style="fill:rgb(0,0,0)"/>
<path d="M233,55 L 240,55 Q 248,55 248,40 L 248,32 Q 248,17 263,17 L 263,17 L 278,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="288" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M47,39 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,92 221,97 221,88" style="fill:rgb(0,0,0)"/>
<path d="M183,92L227,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,92 L 240,92 Q 248,92 248,77 L 248,54 L 248,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,130 56,135 56,126" style="fill:rgb(0,0,0)"/>
<path d="M47,77 L 47,115 Q 47,130 55,130 L 62,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,130 221,135 221,126" style="fill:rgb(0,0,0)"/>
<path d="M150,130L227,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,130 L 240,130 Q 248,130 248,115 L 248,92 L 248,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-clause.html">join-clause:</a></b>
<button id='x4bf3107d' onclick='hideorshow("x4bf3107d","x10163e52")'>show</button></p>
 <div id='x10163e52' style='display:none;' class='imgcontainer'>
 <div style="max-width:793px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 793.282 84.24">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L193,32L193,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="259,47 247,51 247,43" style="fill:rgb(0,0,0)"/>
<path d="M193,17 L 200,17 Q 208,17 208,32 L 208,32 Q 208,47 223,47 L 238,47 L 253,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,62L380,62L380,32L259,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-operator</text>
<polygon points="403,47 391,51 391,43" style="fill:rgb(0,0,0)"/>
<path d="M380,47L397,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,62L564,62L564,32L403,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="587,47 575,51 575,43" style="fill:rgb(0,0,0)"/>
<path d="M564,47L581,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M587,62L721,62L721,32L587,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="654" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-constraint</text>
<polygon points="783,17 772,21 772,12" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 742,47 Q 757,47 757,32 L 757,32 Q 757,17 767,17 L 778,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="787" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M193,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,17L776,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,77 495,73 495,82" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 728,47 Q 736,47 736,62 L 736,62 Q 736,77 721,77 L 504,77 L 489,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,77 L 247,77 Q 232,77 232,62 L 232,62 Q 232,47 246,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/join-constraint.html">join-constraint:</a></b>
<button id='x6eeb7bed' onclick='hideorshow("x6eeb7bed","x972c4ddf")'>show</button></p>
 <div id='x972c4ddf' style='display:none;' class='imgcontainer'>
 <div style="max-width:483px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 483.336 126.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L104,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 104 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="143,55 131,59 131,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L137,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,70A15 15 0 0 0 173 55L173,55A15 15 0 0 0 158 39A15 15 0 0 0 143 55L143,55A15 15 0 0 0 158 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="209,55 197,59 197,50" style="fill:rgb(0,0,0)"/>
<path d="M173,55L203,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M224,70L318,70A15 15 0 0 0 333 55L333,55A15 15 0 0 0 318 39L224,39A15 15 0 0 0 209 55L209,55A15 15 0 0 0 224 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="369,55 358,59 358,50" style="fill:rgb(0,0,0)"/>
<path d="M333,55L363,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,70A15 15 0 0 0 399 55L399,55A15 15 0 0 0 384 39A15 15 0 0 0 369 55L369,55A15 15 0 0 0 384 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="422,55 411,59 411,50" style="fill:rgb(0,0,0)"/>
<path d="M399,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="473,17 462,21 462,12" style="fill:rgb(0,0,0)"/>
<path d="M422,55 L 430,55 Q 437,55 437,40 L 437,32 Q 437,17 452,17 L 453,17 L 468,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="477" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,108A15 15 0 0 0 286 92A15 15 0 0 0 271 77A15 15 0 0 0 256 92A15 15 0 0 0 271 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="286,92 298,88 298,97" style="fill:rgb(0,0,0)"/>
<path d="M333,55 L 341,55 Q 348,55 348,70 L 348,77 Q 348,92 333,92 L 307,92 L 292,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,92 L 197,92 Q 182,92 182,77 L 182,70 Q 182,55 190,55 L 197,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L74,32A15 15 0 0 0 90 17A15 15 0 0 0 74 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="113,17 101,21 101,12" style="fill:rgb(0,0,0)"/>
<path d="M90,17L107,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M113,32L162,32L162,2L113,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="422,17 411,21 411,12" style="fill:rgb(0,0,0)"/>
<path d="M162,17L417,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,17L462,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="209,120 197,124 197,115" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,105 Q 24,120 39,120 L 188,120 L 203,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,120 L 422,120 Q 437,120 437,105 L 437,54 L 437,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-operator.html">join-operator:</a></b>
<button id='xd11c4507' onclick='hideorshow("xd11c4507","x1754f1ff")'>show</button></p>
 <div id='x1754f1ff' style='display:none;' class='imgcontainer'>
 <div style="max-width:620px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 620.333 255.312">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,71 39,76 39,67" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,56 Q 24,71 34,71 L 45,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,86L133,86A15 15 0 0 0 148 71A15 15 0 0 0 133 56L66,56A15 15 0 0 0 50 71A15 15 0 0 0 66 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="99" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NATURAL</text>
<polygon points="189,41 178,45 178,37" style="fill:rgb(0,0,0)"/>
<path d="M148,71 L 155,71 Q 163,71 163,56 L 163,56 Q 163,41 173,41 L 184,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,71 219,76 219,67" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,56 Q 204,71 215,71 L 225,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,86L273,86A15 15 0 0 0 288 71A15 15 0 0 0 273 56L246,56A15 15 0 0 0 231 71A15 15 0 0 0 246 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LEFT</text>
<polygon points="378,71 366,76 366,67" style="fill:rgb(0,0,0)"/>
<path d="M288,71L372,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,86L437,86A15 15 0 0 0 452 71A15 15 0 0 0 437 56L393,56A15 15 0 0 0 378 71A15 15 0 0 0 393 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OUTER</text>
<polygon points="475,71 463,76 463,67" style="fill:rgb(0,0,0)"/>
<path d="M452,71L469,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="516,41 505,45 505,37" style="fill:rgb(0,0,0)"/>
<path d="M475,71 L 482,71 Q 490,71 490,56 L 490,56 Q 490,41 500,41 L 511,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,56L554,56A15 15 0 0 0 569 41A15 15 0 0 0 554 26L532,26A15 15 0 0 0 516 41A15 15 0 0 0 532 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="543" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">JOIN</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M569,41 L 576,41 Q 584,41 584,29 Q 584,17 594,17 L 605,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="614" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,32A15 15 0 0 0 325 17A15 15 0 0 0 310 2A15 15 0 0 0 295 17A15 15 0 0 0 310 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="295,17 283,21 283,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L289,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M325,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="99,41 88,45 88,37" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,29 Q 24,41 39,41 L 78,41 L 93,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M99,41L178,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,41L505,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,41 366,45 366,37" style="fill:rgb(0,0,0)"/>
<path d="M336,71 L 344,71 Q 351,71 351,56 L 351,56 Q 351,41 362,41 L 372,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,109 219,113 219,105" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,94 Q 204,109 215,109 L 225,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,124L284,124A15 15 0 0 0 299 109A15 15 0 0 0 284 94L246,94A15 15 0 0 0 231 109A15 15 0 0 0 246 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RIGHT</text>
<polygon points="341,71 329,76 329,67" style="fill:rgb(0,0,0)"/>
<path d="M299,109 L 307,109 Q 314,109 314,94 L 314,86 Q 314,71 324,71 L 335,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,147 219,151 219,142" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,132 Q 204,147 215,147 L 225,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,162L274,162A15 15 0 0 0 289 147A15 15 0 0 0 274 132L246,132A15 15 0 0 0 231 147A15 15 0 0 0 246 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FULL</text>
<path d="M289,147 L 302,147 Q 314,147 314,132 L 314,109 L 314,94"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,192 219,196 219,188" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,177 Q 204,192 215,192 L 225,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,207L287,207A15 15 0 0 0 302 192A15 15 0 0 0 287 177L246,177A15 15 0 0 0 231 192A15 15 0 0 0 246 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="192" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INNER</text>
<polygon points="475,192 463,196 463,188" style="fill:rgb(0,0,0)"/>
<path d="M302,192L469,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,192 L 482,192 Q 490,192 490,185 L 490,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,238 219,242 219,233" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,223 Q 24,238 39,238 L 210,238 L 225,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,253L287,253A15 15 0 0 0 303 238A15 15 0 0 0 287 222L246,222A15 15 0 0 0 231 238A15 15 0 0 0 246 253Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="238" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CROSS</text>
<polygon points="475,238 463,242 463,233" style="fill:rgb(0,0,0)"/>
<path d="M303,238L469,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,238 L 482,238 Q 490,238 490,223 L 490,71 L 490,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='xfde589dd' onclick='hideorshow("xfde589dd","xc0b39bbb")'>show</button></p>
 <div id='xc0b39bbb' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/result-column.html">result-column:</a></b>
<button id='x4508307e' onclick='hideorshow("x4508307e","xa1283de6")'>show</button></p>
 <div id='xa1283de6' style='display:none;' class='imgcontainer'>
 <div style="max-width:398px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 398.054 163.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L94,32L94,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="136,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M94,17 L 102,17 Q 109,17 109,32 L 109,40 Q 109,55 119,55 L 130,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M151,70L155,70A15 15 0 0 0 170 55L170,55A15 15 0 0 0 155 39L151,39A15 15 0 0 0 136 55L136,55A15 15 0 0 0 151 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="206,55 194,59 194,50" style="fill:rgb(0,0,0)"/>
<path d="M170,55L200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,70L309,70A15 15 0 0 0 324 55L324,55A15 15 0 0 0 309 39L221,39A15 15 0 0 0 206 55L206,55A15 15 0 0 0 221 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="347,55 335,59 335,50" style="fill:rgb(0,0,0)"/>
<path d="M324,55L341,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,17 377,21 377,12" style="fill:rgb(0,0,0)"/>
<path d="M347,55 L 354,55 Q 362,55 362,40 L 362,32 Q 362,17 372,17 L 382,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="392" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,85 141,89 141,81" style="fill:rgb(0,0,0)"/>
<path d="M109,39 L 109,70 Q 109,85 124,85 L 132,85 L 147,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,85 L 170,85 Q 185,85 185,70 L 185,70 Q 185,55 192,55 L 200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="241,17 230,21 230,12" style="fill:rgb(0,0,0)"/>
<path d="M94,17L235,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M241,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,108 39,112 39,103" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,93 Q 24,108 34,108 L 45,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,123A15 15 0 0 0 81 108A15 15 0 0 0 66 92A15 15 0 0 0 50 108A15 15 0 0 0 66 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="108" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,108 335,112 335,103" style="fill:rgb(0,0,0)"/>
<path d="M81,108L341,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,108 L 354,108 Q 362,108 362,93 L 362,54 L 362,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,145 39,150 39,141" style="fill:rgb(0,0,0)"/>
<path d="M24,92 L 24,130 Q 24,145 34,145 L 45,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,160L141,160A15 15 0 0 0 156 145A15 15 0 0 0 141 130L66,130A15 15 0 0 0 50 145A15 15 0 0 0 66 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="145" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="179,145 167,150 167,141" style="fill:rgb(0,0,0)"/>
<path d="M156,145L173,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M194,160A15 15 0 0 0 209 145A15 15 0 0 0 194 130A15 15 0 0 0 179 145A15 15 0 0 0 194 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="232,145 221,150 221,141" style="fill:rgb(0,0,0)"/>
<path d="M209,145L226,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,160A15 15 0 0 0 262 145A15 15 0 0 0 247 130A15 15 0 0 0 232 145A15 15 0 0 0 247 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,145 335,150 335,141" style="fill:rgb(0,0,0)"/>
<path d="M262,145L341,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,145 L 354,145 Q 362,145 362,130 L 362,107 L 362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/table-or-subquery.html">table-or-subquery:</a></b>
<button id='x404bac03' onclick='hideorshow("x404bac03","xd9d63c1e")'>show</button></p>
 <div id='xd9d63c1e' style='display:none;' class='imgcontainer'>
 <div style="max-width:720px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 720.778 457.704">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,74 39,78 39,70" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,59 Q 24,74 34,74 L 45,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,89L162,89A15 15 0 0 0 177 74L177,74A15 15 0 0 0 162 59L66,59A15 15 0 0 0 50 74L50,74A15 15 0 0 0 66 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="194,74 183,78 183,70" style="fill:rgb(0,0,0)"/>
<path d="M177,74L189,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,89A15 15 0 0 0 225 74L225,74A15 15 0 0 0 209 59A15 15 0 0 0 194 74L194,74A15 15 0 0 0 209 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="266,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M225,74 L 232,74 Q 240,74 240,59 L 240,51 Q 240,36 250,36 L 260,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,51L356,51A15 15 0 0 0 371 36A15 15 0 0 0 356 21L281,21A15 15 0 0 0 266 36A15 15 0 0 0 281 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="407,36 396,41 396,32" style="fill:rgb(0,0,0)"/>
<path d="M371,36L402,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,51L427,51A15 15 0 0 0 442 36A15 15 0 0 0 427 21L423,21A15 15 0 0 0 407 36A15 15 0 0 0 423 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="478,36 466,41 466,32" style="fill:rgb(0,0,0)"/>
<path d="M442,36L472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,51L561,51A15 15 0 0 0 577 36A15 15 0 0 0 561 21L493,21A15 15 0 0 0 478 36A15 15 0 0 0 493 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="527" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<path d="M9,36L255,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="422,6 411,10 411,2" style="fill:rgb(0,0,0)"/>
<path d="M371,36 L 379,36 Q 386,36 386,21 L 386,21 Q 386,6 401,6 L 402,6 L 417,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 442,6 Q 457,6 457,21 L 457,21 Q 457,36 464,36 L 472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 577,6 Q 592,6 592,21 L 592,21 Q 592,36 599,36 L 607,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,127L388,127A15 15 0 0 0 403 112A15 15 0 0 0 388 97L323,97A15 15 0 0 0 308 112A15 15 0 0 0 323 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="426,112 415,116 415,108" style="fill:rgb(0,0,0)"/>
<path d="M403,112L420,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,127L445,127A15 15 0 0 0 460 112A15 15 0 0 0 445 97L441,97A15 15 0 0 0 426 112A15 15 0 0 0 441 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="443" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="483,112 472,116 472,108" style="fill:rgb(0,0,0)"/>
<path d="M460,112L478,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,127L577,127A15 15 0 0 0 592 112A15 15 0 0 0 577 97L499,97A15 15 0 0 0 483 112A15 15 0 0 0 499 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="538" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M323,165L343,165A15 15 0 0 0 359 150A15 15 0 0 0 343 135L323,135A15 15 0 0 0 308 150A15 15 0 0 0 323 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="382,150 370,154 370,145" style="fill:rgb(0,0,0)"/>
<path d="M359,150L376,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,165L461,165A15 15 0 0 0 476 150A15 15 0 0 0 461 135L397,135A15 15 0 0 0 382 150A15 15 0 0 0 397 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="527,74 539,70 539,78" style="fill:rgb(0,0,0)"/>
<path d="M577,36 L 607,36 Q 622,36 622,51 L 622,59 Q 622,74 607,74 L 548,74 L 533,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,150 297,154 297,145" style="fill:rgb(0,0,0)"/>
<path d="M527,74 L 297,74 Q 282,74 282,89 L 282,135 Q 282,150 292,150 L 302,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,112 297,116 297,108" style="fill:rgb(0,0,0)"/>
<path d="M282,97 L 282,104 Q 282,112 292,112 L 302,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="266,213 255,217 255,209" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,198 Q 24,213 39,213 L 245,213 L 260,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,228L431,228A15 15 0 0 0 446 213A15 15 0 0 0 431 198L281,198A15 15 0 0 0 266 213A15 15 0 0 0 281 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function-name</text>
<polygon points="463,213 452,217 452,209" style="fill:rgb(0,0,0)"/>
<path d="M446,213L457,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,228A15 15 0 0 0 493 213A15 15 0 0 0 478 198A15 15 0 0 0 463 213A15 15 0 0 0 478 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="529,213 518,217 518,209" style="fill:rgb(0,0,0)"/>
<path d="M493,213L524,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M529,228L579,228L579,198L529,198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="615,213 603,217 603,209" style="fill:rgb(0,0,0)"/>
<path d="M579,213L609,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M630,228A15 15 0 0 0 645 213A15 15 0 0 0 630 198A15 15 0 0 0 615 213A15 15 0 0 0 630 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="630" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="675,187 679,198 671,198" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 660,213 Q 675,213 675,203 L 675,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M554,190A15 15 0 0 0 569 175A15 15 0 0 0 554 160A15 15 0 0 0 539 175A15 15 0 0 0 554 190Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="175" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="569,175 581,171 581,180" style="fill:rgb(0,0,0)"/>
<path d="M579,213 L 586,213 Q 594,213 594,198 L 594,190 Q 594,175 584,175 L 575,175"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,175 L 518,175 Q 503,175 503,190 L 503,198 Q 503,213 510,213 L 518,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,74 L 232,74 Q 240,74 240,89 L 240,198 Q 240,213 247,213 L 255,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,112 648,116 648,108" style="fill:rgb(0,0,0)"/>
<path d="M592,112L654,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,112 L 667,112 Q 675,112 675,104 L 675,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,150 648,154 648,145" style="fill:rgb(0,0,0)"/>
<path d="M476,150L654,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,150 L 667,150 Q 675,150 675,142 L 675,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M577,36L690,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,304L411,304A15 15 0 0 0 426 289A15 15 0 0 0 411 274L407,274A15 15 0 0 0 392 289A15 15 0 0 0 407 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="498,289 487,293 487,284" style="fill:rgb(0,0,0)"/>
<path d="M426,289L492,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M513,304L582,304A15 15 0 0 0 597 289A15 15 0 0 0 582 274L513,274A15 15 0 0 0 498 289A15 15 0 0 0 513 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="548" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<polygon points="660,289 648,293 648,284" style="fill:rgb(0,0,0)"/>
<path d="M597,289L654,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,289 L 667,289 Q 675,289 675,281 L 675,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="548,251 559,247 559,255" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 652,213 Q 660,213 660,228 L 660,236 Q 660,251 645,251 L 568,251 L 553,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M548,251 L 370,251 Q 355,251 355,266 L 355,274 Q 355,289 370,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,251 L 464,251 Q 457,251 457,266 L 457,274 Q 457,289 464,289 L 472,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,327 39,331 39,322" style="fill:rgb(0,0,0)"/>
<path d="M24,198 L 24,312 Q 24,327 34,327 L 45,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,342A15 15 0 0 0 81 327A15 15 0 0 0 66 311A15 15 0 0 0 50 327A15 15 0 0 0 66 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,327 92,331 92,322" style="fill:rgb(0,0,0)"/>
<path d="M81,327L98,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,342L208,342L208,311L104,311Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="327" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="231,327 219,331 219,322" style="fill:rgb(0,0,0)"/>
<path d="M208,327L225,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,342A15 15 0 0 0 261 327A15 15 0 0 0 246 311A15 15 0 0 0 231 327A15 15 0 0 0 246 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M261,327 L 269,327 Q 276,327 276,312 L 276,304 Q 276,289 291,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,327 648,331 648,322" style="fill:rgb(0,0,0)"/>
<path d="M261,327L654,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,327 L 667,327 Q 675,327 675,319 L 675,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,327 L 432,327 Q 439,327 439,312 L 439,304 Q 439,289 447,289 L 454,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,364 39,369 39,360" style="fill:rgb(0,0,0)"/>
<path d="M24,311 L 24,349 Q 24,364 34,364 L 45,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,379A15 15 0 0 0 81 364A15 15 0 0 0 65 349A15 15 0 0 0 50 364A15 15 0 0 0 65 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="135,364 123,369 123,360" style="fill:rgb(0,0,0)"/>
<path d="M81,364L129,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,379L296,379L296,349L135,349Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="364" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="350,364 338,369 338,360" style="fill:rgb(0,0,0)"/>
<path d="M296,364L344,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,379A15 15 0 0 0 380 364A15 15 0 0 0 365 349A15 15 0 0 0 350 364A15 15 0 0 0 365 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="660,364 648,369 648,360" style="fill:rgb(0,0,0)"/>
<path d="M380,364L654,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="711,36 699,41 699,32" style="fill:rgb(0,0,0)"/>
<path d="M660,364 L 667,364 Q 675,364 675,349 L 675,51 Q 675,36 690,36 L 690,36 L 705,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="715" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,417A15 15 0 0 0 230 402A15 15 0 0 0 215 387A15 15 0 0 0 200 402A15 15 0 0 0 215 417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="402" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="230,402 242,398 242,406" style="fill:rgb(0,0,0)"/>
<path d="M296,364 L 303,364 Q 311,364 311,379 L 311,387 Q 311,402 296,402 L 251,402 L 236,402"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,402 L 123,402 Q 108,402 108,387 L 108,379 Q 108,364 116,364 L 123,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="122,440 111,444 111,436" style="fill:rgb(0,0,0)"/>
<path d="M81,364 L 88,364 Q 96,364 96,379 L 96,425 Q 96,440 106,440 L 116,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M122,455L224,455L224,425L122,425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M224,440 L 308,440 Q 323,440 323,425 L 323,379 Q 323,364 331,364 L 338,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/window-defn.html">window-defn:</a></b>
<button id='x3dc82c2d' onclick='hideorshow("x3dc82c2d","xf296c2c4")'>show</button></p>
 <div id='xf296c2c4' style='display:none;' class='imgcontainer'>
 <div style="max-width:479px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 479.765 380.592">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,44 92,48 92,40" style="fill:rgb(0,0,0)"/>
<path d="M62,17 L 70,17 Q 77,17 77,30 Q 77,44 88,44 L 98,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,59L260,59A15 15 0 0 0 275 44L275,44A15 15 0 0 0 260 29L119,29A15 15 0 0 0 104 44L104,44A15 15 0 0 0 119 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M119,135L198,135A15 15 0 0 0 214 120A15 15 0 0 0 198 104L119,104A15 15 0 0 0 104 120A15 15 0 0 0 119 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="237,120 225,124 225,115" style="fill:rgb(0,0,0)"/>
<path d="M214,120L231,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M252,135L256,135A15 15 0 0 0 271 120A15 15 0 0 0 256 104L252,104A15 15 0 0 0 237 120A15 15 0 0 0 252 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="307,120 295,124 295,115" style="fill:rgb(0,0,0)"/>
<path d="M271,120L301,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,135L356,135L356,104L307,104Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M332,173A15 15 0 0 0 347 157A15 15 0 0 0 332 142A15 15 0 0 0 316 157A15 15 0 0 0 332 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="157" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="347,157 358,153 358,162" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,142 Q 371,157 362,157 L 352,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,157 L 295,157 Q 280,157 280,142 L 280,135 Q 280,120 288,120 L 295,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,17 178,21 178,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L184,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,82 201,77 201,86" style="fill:rgb(0,0,0)"/>
<path d="M190,17 L 298,17 Q 313,17 313,32 L 313,67 Q 313,82 298,82 L 210,82 L 195,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,120 92,124 92,115" style="fill:rgb(0,0,0)"/>
<path d="M190,82 L 77,82 Q 62,82 62,97 L 62,105 Q 62,120 77,120 L 83,120 L 98,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,44 287,48 287,40" style="fill:rgb(0,0,0)"/>
<path d="M275,44L293,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,44 L 306,44 Q 313,44 313,51 L 313,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,248L163,248A15 15 0 0 0 178 233A15 15 0 0 0 163 218L119,218A15 15 0 0 0 104 233A15 15 0 0 0 119 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="201,233 190,237 190,229" style="fill:rgb(0,0,0)"/>
<path d="M178,233L196,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,248L221,248A15 15 0 0 0 236 233A15 15 0 0 0 221 218L217,218A15 15 0 0 0 201 233A15 15 0 0 0 217 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="272,233 260,237 260,229" style="fill:rgb(0,0,0)"/>
<path d="M236,233L266,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,248L402,248L402,218L272,218Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M337,286A15 15 0 0 0 352 271A15 15 0 0 0 337 256A15 15 0 0 0 322 271A15 15 0 0 0 337 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="352,271 363,266 363,275" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,256 Q 417,271 402,271 L 373,271 L 358,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M322,271 L 260,271 Q 245,271 245,256 L 245,248 Q 245,233 253,233 L 260,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,195 201,191 201,200" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,180 Q 371,195 356,195 L 210,195 L 195,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,233 92,237 92,229" style="fill:rgb(0,0,0)"/>
<path d="M190,195 L 77,195 Q 62,195 62,210 L 62,218 Q 62,233 77,233 L 83,233 L 98,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,157 58,146 66,146" style="fill:rgb(0,0,0)"/>
<path d="M62,104L62,152"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,157L62,218"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,362L208,362L208,331L104,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="417,346 405,351 405,342" style="fill:rgb(0,0,0)"/>
<path d="M208,346L411,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,362A15 15 0 0 0 447 346A15 15 0 0 0 432 331A15 15 0 0 0 417 346A15 15 0 0 0 432 362Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="470,346 458,351 458,342" style="fill:rgb(0,0,0)"/>
<path d="M447,346L464,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="474" cy="346" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,309 201,304 201,313" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,294 Q 417,309 402,309 L 210,309 L 195,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,346 92,351 92,342" style="fill:rgb(0,0,0)"/>
<path d="M190,309 L 77,309 Q 62,309 62,324 L 62,331 Q 62,346 77,346 L 83,346 L 98,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,271 58,259 66,259" style="fill:rgb(0,0,0)"/>
<path d="M62,218L62,265"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,271L62,331"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,374 144,378 144,369" style="fill:rgb(0,0,0)"/>
<path d="M62,331 L 62,359 Q 62,374 77,374 L 135,374 L 150,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,346 266,351 266,342" style="fill:rgb(0,0,0)"/>
<path d="M156,374 L 233,374 Q 248,374 248,360 Q 248,346 260,346 L 272,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='xc37e05ff' onclick='hideorshow("xc37e05ff","xc63ec004")'>show</button></p>
 <div id='xc63ec004' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/type-name.html">type-name:</a></b>
<button id='xdeb77737' onclick='hideorshow("xdeb77737","x87e3367d")'>show</button></p>
 <div id='x87e3367d' style='display:none;' class='imgcontainer'>
 <div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.008 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L87,32A15 15 0 0 0 102 17A15 15 0 0 0 87 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="165,92 153,97 153,88" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,77 Q 138,92 149,92 L 159,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,108A15 15 0 0 0 195 92A15 15 0 0 0 180 77A15 15 0 0 0 165 92A15 15 0 0 0 180 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,92 201,97 201,88" style="fill:rgb(0,0,0)"/>
<path d="M195,92L207,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,108L350,108L350,77L212,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,92 356,97 356,88" style="fill:rgb(0,0,0)"/>
<path d="M350,92L362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,108A15 15 0 0 0 398 92A15 15 0 0 0 382 77A15 15 0 0 0 367 92A15 15 0 0 0 382 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="415,92 403,97 403,88" style="fill:rgb(0,0,0)"/>
<path d="M398,92L409,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,108L553,108L553,77L415,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="570,92 558,97 558,88" style="fill:rgb(0,0,0)"/>
<path d="M553,92L564,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,108A15 15 0 0 0 600 92A15 15 0 0 0 585 77A15 15 0 0 0 570 92A15 15 0 0 0 585 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="585" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="651,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M600,92 L 608,92 Q 615,92 615,77 L 615,32 Q 615,17 630,17 L 630,17 L 645,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,40 Q 138,55 149,55 L 159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70A15 15 0 0 0 195 55L195,55A15 15 0 0 0 180 39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,55 201,59 201,50" style="fill:rgb(0,0,0)"/>
<path d="M195,55L207,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,70L350,70L350,39L212,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,55 356,59 356,50" style="fill:rgb(0,0,0)"/>
<path d="M350,55L362,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,70A15 15 0 0 0 398 55L398,55A15 15 0 0 0 382 39A15 15 0 0 0 367 55L367,55A15 15 0 0 0 382 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="600,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M398,55L594,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M600,55 L 608,55 Q 615,55 615,47 L 615,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="74,47 85,43 85,51" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 110,17 Q 117,17 117,32 L 117,32 Q 117,47 102,47 L 94,47 L 79,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47 L 33,47 Q 18,47 18,32 L 18,32 Q 18,17 26,17 L 33,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="382,17 371,21 371,12" style="fill:rgb(0,0,0)"/>
<path d="M102,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,17L630,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='xa5583949' onclick='hideorshow("xa5583949","x14d39a68")'>show</button></p>
 <div id='x14d39a68' style='display:none;' class='imgcontainer'>
 <div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/indexed-column.html">indexed-column:</a></b>
<button id='xd2cba63f' onclick='hideorshow("xd2cba63f","x40e5b7aa")'>show</button></p>
 <div id='x40e5b7aa' style='display:none;' class='imgcontainer'>
 <div style="max-width:696px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 696.36 102.6">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L160,32A15 15 0 0 0 175 17A15 15 0 0 0 160 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="113" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="246,47 235,51 235,43" style="fill:rgb(0,0,0)"/>
<path d="M175,17 L 205,17 Q 220,17 220,32 L 220,32 Q 220,47 230,47 L 240,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M261,62L325,62A15 15 0 0 0 341 47L341,47A15 15 0 0 0 325 32L261,32A15 15 0 0 0 246 47L246,47A15 15 0 0 0 261 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="293" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="358,47 346,51 346,43" style="fill:rgb(0,0,0)"/>
<path d="M341,47L352,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M373,62L478,62A15 15 0 0 0 493 47L493,47A15 15 0 0 0 478 32L373,32A15 15 0 0 0 358 47L358,47A15 15 0 0 0 373 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="511,47 499,51 499,43" style="fill:rgb(0,0,0)"/>
<path d="M493,47L505,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="567,85 556,89 556,81" style="fill:rgb(0,0,0)"/>
<path d="M511,47 L 518,47 Q 526,47 526,32 L 526,32 Q 526,17 533,17 Q 541,17 541,32 L 541,70 Q 541,85 551,85 L 561,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,100L613,100A15 15 0 0 0 628 85L628,85A15 15 0 0 0 613 70L582,70A15 15 0 0 0 567 85L567,85A15 15 0 0 0 582 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="645,85 633,89 633,81" style="fill:rgb(0,0,0)"/>
<path d="M628,85L639,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="687,17 675,21 675,12" style="fill:rgb(0,0,0)"/>
<path d="M645,85 L 652,85 Q 660,85 660,70 L 660,32 Q 660,17 670,17 L 681,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="690" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M50,70L100,70L100,39L50,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="175,55 163,59 163,50" style="fill:rgb(0,0,0)"/>
<path d="M100,55L169,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M175,55 L 182,55 Q 190,55 190,40 L 190,32 Q 190,17 197,17 L 205,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M175,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,17 586,21 586,12" style="fill:rgb(0,0,0)"/>
<path d="M358,17L592,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,17L675,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,62L599,62A15 15 0 0 0 614 47A15 15 0 0 0 599 32L582,32A15 15 0 0 0 567 47A15 15 0 0 0 582 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="645,47 633,51 633,43" style="fill:rgb(0,0,0)"/>
<path d="M614,47L639,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M645,47 L 652,47 Q 660,47 660,40 L 660,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="567,47 556,51 556,43" style="fill:rgb(0,0,0)"/>
<path d="M541,32 L 541,39 Q 541,47 551,47 L 561,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>


<h1 id="description"><span>2. </span>Description</h1>

<p>UPSERT is a clause added to <a href="lang_insert.html">INSERT</a> that causes the
INSERT to behave as an <a href="lang_update.html">UPDATE</a> or a no-op if the INSERT would violate
a uniqueness constraint.
UPSERT is not standard SQL.  UPSERT in SQLite follows the
syntax established by PostgreSQL, with generalizations.

</p><p>An UPSERT is an ordinary <a href="lang_insert.html">INSERT</a> statement that is followed by
one or more ON CONFLICT clauses, as shown in the syntax diagram above.

</p><p>The syntax in between the "ON CONFLICT" and "DO" keywords
is called the "conflict target".  The conflict target specifies a
uniqueness constraint that will trigger the upsert.  The conflict target
may be omitted on the last ON CONFLICT clause in the INSERT statement, but
is required for all other ON CONFLICT clauses.

</p><p>If the insert operation would cause the conflict target uniqueness
constraint to fail, then the insert is omitted and
the corresponding DO NOTHING or DO UPDATE operation is performed instead.
The ON CONFLICT clauses are checked in the order specified.  If the last
ON CONFLICT clause omits the conflict target, then it will fire if any
uniqueness constraint fails which is not captured by prior ON CONFLICT clauses.

</p><p>Only a single ON CONFLICT clause, specifically the first ON CONFLICT
clause with a matching conflict target, may run for each row of the INSERT.
When an ON CONFLICT clause fires, all subsequent ON CONFLICT clauses are
bypassed for that one row.

</p><p>
In the case of a multi-row insert, the upsert decision is made separately
for each row of the insert.

</p><p>The UPSERT processing happens only for uniqueness constraints.
A "uniqueness constraint"
is an explicit UNIQUE or PRIMARY KEY constraint within
the CREATE TABLE statement, or a <a href="lang_createindex.html#uniqueidx">unique index</a>.
UPSERT does not intervene for failed NOT NULL, CHECK,
or foreign key constraints
or for constraints that are implemented using triggers.

</p><p>Column names in the expressions of a DO UPDATE refer to the original
unchanged value of the column, before the attempted INSERT.  To use the
value that would have been inserted had the constraint not failed,
add the special "excluded." table qualifier to the column name.

</p><h2 id="examples"><span>2.1. </span>Examples</h2>

<p>Some examples will help illustrate how UPSERT works:

</p><blockquote><pre>
CREATE TABLE vocabulary(word TEXT PRIMARY KEY, count INT DEFAULT 1);
INSERT INTO vocabulary(word) VALUES('jovial')
  ON CONFLICT(word) DO UPDATE SET count=count+1;
</pre></blockquote>

<p>The upsert above inserts the new vocabulary word "jovial" if that
word is not already in the dictionary, or if it is already in the
dictionary, it increments the counter.  The "count+1" expression
could also be written as "vocabulary.count".  PostgreSQL requires the
second form, but SQLite accepts either.

</p><blockquote><pre>
CREATE TABLE phonebook(name TEXT PRIMARY KEY, phonenumber TEXT);
INSERT INTO phonebook(name,phonenumber) VALUES('Alice','704-555-1212')
  ON CONFLICT(name) DO UPDATE SET phonenumber=excluded.phonenumber;
</pre></blockquote>

<p>In the second example, the expression in the DO UPDATE clause is
of the form "excluded.phonenumber".  The "excluded." prefix causes the
"phonenumber" to refer to the value for phonenumber that would have been
inserted had there been no conflict.  Hence, the effect of the upsert
is to insert a phonenumber of Alice if none exists, or to overwrite
any prior phonenumber for Alice with the new one.

</p><p>Note that the DO UPDATE clause acts only on the single row
that experienced the constraint error during INSERT.  It is not
necessary to include a WHERE clause that restricts the action
to that one row.  The only use for the WHERE clause at
the end of the DO UPDATE is to optionally change the DO UPDATE
into a no-op depending on the original and/or new values.
For example:

</p><blockquote><pre>
CREATE TABLE phonebook2(
  name TEXT PRIMARY KEY,
  phonenumber TEXT,
  validDate DATE
);
INSERT INTO phonebook2(name,phonenumber,validDate)
  VALUES('Alice','704-555-1212','2018-05-08')
  ON CONFLICT(name) DO UPDATE SET
    phonenumber=excluded.phonenumber,
    validDate=excluded.validDate
  WHERE excluded.validDate>phonebook2.validDate;
</pre></blockquote>

<p>In this last example, the phonebook2 entry is only
updated if the validDate for the newly inserted value is
newer than the entry already in the table.  If the table already
contains an entry with the same name and a current validDate,
then the WHERE clause causes the DO UPDATE to become a no-op.

<a name="parseambig"></a>


</p><h2 id="parsing_ambiguity"><span>2.2. </span>Parsing Ambiguity</h2>

<p>When the <a href="lang_insert.html">INSERT</a> statement to which the UPSERT is attached
takes its values from a <a href="lang_select.html">SELECT</a> statement, there is a potential
parsing ambiguity.  The parser might not be able to tell if the
"ON" keyword is introducing the UPSERT or if it is the ON clause
of a join.  To work around this, the SELECT statement should always
include a WHERE clause, even if that WHERE clause is just
"WHERE true".

</p><p>Ambiguous use of ON:

</p><blockquote><pre>
INSERT INTO t1 SELECT * FROM t2
ON CONFLICT(x) DO UPDATE SET y=excluded.y;
</pre></blockquote>

<p>Ambiguity resolved using a WHERE clause:

</p><blockquote><pre>
INSERT INTO t1 SELECT * FROM t2 <font color="blue">WHERE true</font>
ON CONFLICT(x) DO UPDATE SET y=excluded.y;
</pre></blockquote>

<h1 id="limitations"><span>3. </span>Limitations</h1>

<p>UPSERT does not currently work for <a href="vtab.html">virtual tables</a>.

</p><p>The <a href="lang_conflict.html">conflict resolution algorithm</a> for the update operation
of the DO UPDATE clause is always ABORT.  In other words, the behavior
is as if the DO UPDATE clause were actually written as
"DO UPDATE OR ABORT".  If the DO UPDATE clause encounters any
constraint violation, the entire INSERT statement rolls back and
halts.  This is true even if the DO UPDATE clause is
contained within an INSERT statement or a trigger that specifies some
other conflict resolution algorithm.

</p><h1 id="history"><span>4. </span>History</h1>

<p>UPSERT syntax was added to SQLite with version 3.24.0 (2018-06-04).
The original implementation closely followed the PostgreSQL syntax in that
it only permitted a single ON CONFLICT clause and it required a
conflict target for on DO UPDATE.
The syntax was generalized to permit multiple ON CONFLICT clauses and
to allow DO UPDATE resolution without a conflict target in
SQLite version 3.35.0 (2021-03-12).
</p><p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_upsert.in?m=182e081fd2">2024-04-11 23:26:09</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_vacuum.html.























































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>VACUUM</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
VACUUM
</div>
</div>




<h1 id="syntax"><span>1. </span>Syntax</h1>
<p><b><a href="syntax/vacuum-stmt.html">vacuum-stmt:</a></b>
<button id='x0fc49388' onclick='hideorshow("x0fc49388","x74e14988")'>hide</button></p>
 <div id='x74e14988' class='imgcontainer'>
 <div style="max-width:599px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 599.669 64.8">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L108,32A15 15 0 0 0 123 17A15 15 0 0 0 108 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="78" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VACUUM</text>
<polygon points="165,47 153,51 153,43" style="fill:rgb(0,0,0)"/>
<path d="M123,17 L 131,17 Q 138,17 138,32 L 138,32 Q 138,47 149,47 L 159,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,62L276,62A15 15 0 0 0 292 47L292,47A15 15 0 0 0 276 32L180,32A15 15 0 0 0 165 47L165,47A15 15 0 0 0 180 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="333,17 322,21 322,12" style="fill:rgb(0,0,0)"/>
<path d="M292,47 L 299,47 Q 307,47 307,32 L 307,32 Q 307,17 317,17 L 327,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="375,47 363,51 363,43" style="fill:rgb(0,0,0)"/>
<path d="M333,17 L 341,17 Q 348,17 348,32 L 348,32 Q 348,47 359,47 L 369,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M390,62L417,62A15 15 0 0 0 432 47L432,47A15 15 0 0 0 417 32L390,32A15 15 0 0 0 375 47L375,47A15 15 0 0 0 390 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTO</text>
<polygon points="455,47 443,51 443,43" style="fill:rgb(0,0,0)"/>
<path d="M432,47L449,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,62L524,62A15 15 0 0 0 539 47L539,47A15 15 0 0 0 524 32L470,32A15 15 0 0 0 455 47L455,47A15 15 0 0 0 470 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="497" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filename</text>
<polygon points="590,17 578,21 578,12" style="fill:rgb(0,0,0)"/>
<path d="M539,47 L 546,47 Q 554,47 554,32 L 554,32 Q 554,17 569,17 L 569,17 L 584,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="593" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M123,17L578,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>


<h1 id="description"><span>2. </span>Description</h1>
<p>
  The VACUUM command rebuilds the database file, repacking it into a minimal
  amount of disk space. There are several
  reasons an application might do this:

</p><ul>
  <li> <p> Unless SQLite is running in "auto_vacuum=FULL" mode, when a large
     amount of data is deleted from the database file it leaves behind empty
     space, or "free" database pages. This means the database file might
     be larger than strictly necessary. Running VACUUM to rebuild the
     database reclaims this space and reduces the size of the database file.

  </p></li><li> <p> Frequent inserts, updates, and deletes can cause the database file
     to become fragmented - where data for a single table or index is scattered
     around the database file. Running VACUUM ensures that each table and
     index is largely stored contiguously within the database file. In some
     cases, VACUUM may also reduce the number of partially filled pages in
     the database, reducing the size of the database file further.

  </p></li><li> <p> When content is deleted from an SQLite database, the content is not
     usually erased but rather the space used to hold the content is marked as
     being available for reuse.  This can allow deleted content to be recovered
     by a hacker or by forensic analysis.  Running VACUUM will clean the database
     of all traces of deleted content, thus preventing an adversary from recovering
     deleted content.  Using VACUUM in this way is an alternative to setting
     <a href="pragma.html#pragma_secure_delete">PRAGMA secure_delete=ON</a>.

  </p></li><li> <p> Normally, the database <a href="pragma.html#pragma_page_size">page_size</a> and whether or not the database
     supports <a href="pragma.html#pragma_auto_vacuum">auto_vacuum</a> must be configured before the database file is
     actually created. However, when not in <a href="wal.html">write-ahead log</a> mode, the
     <a href="pragma.html#pragma_page_size">page_size</a> and/or <a href="pragma.html#pragma_auto_vacuum">auto_vacuum</a> properties of an existing database may be
     changed by using the <a href="pragma.html#pragma_page_size">page_size</a>  and/or
     <a href="pragma.html#pragma_auto_vacuum">pragma auto_vacuum</a> pragmas and then immediately VACUUMing
     the database. When in <a href="wal.html">write-ahead log</a> mode, only the <a href="pragma.html#pragma_auto_vacuum">auto_vacuum</a>
     support property can be changed using VACUUM.
</p></li></ul>

<p>By default, VACUUM operates on the main database.
<a href="lang_attach.html">Attached databases</a> can be vacuumed by appending the appropriate
<span class='yyterm'>schema-name</span> to the VACUUM statement.

</p><p><b>Compatibility Warning:</b> The ability to vacuum attached databases was
added in <a href="releaselog/3_15_0.html">version 3.15.0</a> (2016-10-14).  Prior to that, a
<span class='yyterm'>schema-name</span> added to the
VACUUM statement would be silently ignored and the "main" schema would be
vacuumed.</p>

<a name="vacuuminto"></a>

<h2 id="vacuum_with_an_into_clause"><span>2.1. </span>VACUUM with an INTO clause</h2>

<p>If the INTO clause is included, then the original database file is
unchanged and a new database is created in a file named by the
argument to the INTO clause.
The argument is a scalar <a href="lang_expr.html">expression</a>, such as a text literal.
The new database will contain the same
logical content as the original database, fully vacuumed.

</p><p>
The VACUUM command with an INTO clause is an alternative to the
<a href="backup.html">backup API</a> for generating backup copies of a live database.
The advantage of using VACUUM INTO is that the resulting backup
database is minimal in size and hence the amount of filesystem
I/O may be reduced.  Also, all deleted content is purged from the
backup, leaving behind no forensic traces.  On the other hand,
the <a href="backup.html">backup API</a> uses fewer CPU cycles and can be executed
incrementally.

</p><p>
The filename in the INTO clause can be an arbitrary SQL expression
that evaluates to a string.
The file named by the INTO clause must not previously exist, or
else it must be an empty file, or the VACUUM INTO command will
fail with an error.

</p><p>
The argument to INTO can be a <a href="uri.html">URI filename</a> if URI filenames
are enabled.
URL filenames are enabled if any of the following are true:
</p><ul>
<li> The SQLite library was compiled with <a href="compile.html#use_uri">-DSQLITE_USE_URI=1</a>.
</li><li> The <a href="c3ref/config.html">sqlite3_config</a>(<a href="c3ref/c_config_covering_index_scan.html#sqliteconfiguri">SQLITE_CONFIG_URI</a>,1) interfaces was
     invoked at start-time.
</li><li> The <a href="c3ref/sqlite3.html">database connection</a> that is running the VACUUM INTO
     statement was originally opened using the
     <a href="c3ref/c_open_autoproxy.html">SQLITE_OPEN_URI</a> flag.
</li></ul>

<p>
The VACUUM INTO command is transactional in the sense that
the generated output database is a consistent snapshot of the
original database.  However, if the VACUUM INTO command is
interrupted by an unplanned shutdown or power loss, then
the generated output database might be incomplete and corrupt.
Also, SQLite does not invoke fsync() or FlushFileBuffers()
on the generated database to ensure that it has reached
non-volatile storage before completing.


<a name="howvacuumworks"></a>

</p><h1 id="how_vacuum_works"><span>3. </span>How VACUUM works</h1>

<p>The VACUUM command works by copying the contents of the database into
a temporary database file and then overwriting the original with the
contents of the temporary file. When overwriting the original, a rollback
journal or <a href="wal.html">write-ahead log</a> WAL file is used just as it would be for any
other database transaction. This means that when VACUUMing a database,
as much as twice the size of the original database file is required in free
disk space.

</p><p>The VACUUM INTO command works the same way except that it uses the file
named on the INTO clause in place of the temporary database and omits the
step of copying the vacuumed database back over top of the original database.

</p><p>The VACUUM command may change the <a href="lang_createtable.html#rowid">ROWIDs</a> of entries in any
tables that do not have an explicit <a href="lang_createtable.html#rowid">INTEGER PRIMARY KEY</a>.
</p>

<p>A VACUUM will fail if there is an open transaction on the database
connection that is attempting to run the VACUUM.  Unfinalized SQL
statements typically hold a read transaction open, so the VACUUM
might fail if there are unfinalized SQL statements on the same connection.
VACUUM (but not VACUUM INTO) is a write operation and so if another
database connection is holding a lock that prevents writes, then
the VACUUM will fail.

</p><p>An alternative to using the VACUUM command to
reclaim space after data has been deleted is auto-vacuum mode, enabled using
the <a href="pragma.html#pragma_auto_vacuum">auto_vacuum</a> pragma. When <a href="pragma.html#pragma_auto_vacuum">auto_vacuum</a> is enabled for a database
free pages may be reclaimed after deleting data, causing the file to shrink,
without rebuilding the entire database using VACUUM.  However, using
<a href="pragma.html#pragma_auto_vacuum">auto_vacuum</a> can lead to extra database file fragmentation.  And <a href="pragma.html#pragma_auto_vacuum">auto_vacuum</a>
does not compact partially filled pages of the database as VACUUM does.

</p>
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_vacuum.in?m=d66fef5b60">2023-12-05 14:43:20</a> UTC </small></i></p>

Added Doc/Extra/Core/lang_with.html.





















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>The WITH Clause</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
The WITH Clause
</div>
<div class="fancy_toc">
<a onclick="toggle_toc()">
<span class="fancy_toc_mark" id="toc_mk">&#x25ba;</span>
Table Of Contents
</a>
<div id="toc_sub"><div class="fancy-toc1"><a href="#overview">1. Overview</a></div>
<div class="fancy-toc1"><a href="#ordinary_common_table_expressions">2. Ordinary Common Table Expressions</a></div>
<div class="fancy-toc1"><a href="#recursive_common_table_expressions">3. Recursive Common Table Expressions</a></div>
<div class="fancy-toc2"><a href="#recursive_query_examples">3.1. Recursive Query Examples</a></div>
<div class="fancy-toc2"><a href="#hierarchical_query_examples">3.2. Hierarchical Query Examples</a></div>
<div class="fancy-toc2"><a href="#queries_against_a_graph">3.3. Queries Against A Graph</a></div>
<div class="fancy-toc2"><a href="#controlling_depth_first_versus_breadth_first_search_of_a_tree_using_order_by">3.4. Controlling Depth-First Versus Breadth-First Search Of a Tree
Using ORDER BY</a></div>
<div class="fancy-toc2"><a href="#outlandish_recursive_query_examples">3.5. Outlandish Recursive Query Examples</a></div>
<div class="fancy-toc1"><a href="#materialization_hints">4. Materialization Hints</a></div>
<div class="fancy-toc1"><a href="#limitations_and_caveats">5. Limitations And Caveats</a></div>
</div>
</div>
<script>
function toggle_toc(){
var sub = document.getElementById("toc_sub")
var mk = document.getElementById("toc_mk")
if( sub.style.display!="block" ){
sub.style.display = "block";
mk.innerHTML = "&#x25bc;";
} else {
sub.style.display = "none";
mk.innerHTML = "&#x25ba;";
}
}
</script>
</div>




<h1 id="overview"><span>1. </span>Overview</h1>
<p><b><a href="syntax/with-clause.html">with-clause:</a></b>
<button id='xb0146d13' onclick='hideorshow("xb0146d13","x19290fa5")'>hide</button></p>
 <div id='x19290fa5' class='imgcontainer'>
 <div style="max-width:1056px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1056.72 140.4">
<circle cx="5" cy="85" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,85 20,89 20,81" style="fill:rgb(0,0,0)"/>
<path d="M9,85L26,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,100L78,100A15 15 0 0 0 93 85A15 15 0 0 0 78 70L47,70A15 15 0 0 0 32 85A15 15 0 0 0 47 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,85 L 100,85 Q 108,85 108,70 L 108,70 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M150,70L235,70A15 15 0 0 0 250 55L250,55A15 15 0 0 0 235 39L150,39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 150 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<path d="M250,55 L 258,55 Q 265,55 265,70 L 265,70 Q 265,85 273,85 L 280,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,85 295,89 295,81" style="fill:rgb(0,0,0)"/>
<path d="M280,85L301,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,100L444,100L444,70L307,70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">cte-table-name</text>
<polygon points="467,85 455,89 455,81" style="fill:rgb(0,0,0)"/>
<path d="M444,85L461,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M482,100L486,100A15 15 0 0 0 501 85A15 15 0 0 0 486 70L482,70A15 15 0 0 0 467 85A15 15 0 0 0 482 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="542,17 531,21 531,12" style="fill:rgb(0,0,0)"/>
<path d="M501,85 L 508,85 Q 516,85 516,70 L 516,32 Q 516,17 526,17 L 537,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,32L578,32A15 15 0 0 0 593 17L593,17A15 15 0 0 0 578 2L558,2A15 15 0 0 0 542 17L542,17A15 15 0 0 0 558 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="568" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M593,17L604,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M625,32L743,32A15 15 0 0 0 759 17L759,17A15 15 0 0 0 743 2L625,2A15 15 0 0 0 610 17L610,17A15 15 0 0 0 625 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="684" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<polygon points="800,85 789,89 789,81" style="fill:rgb(0,0,0)"/>
<path d="M759,17 L 766,17 Q 774,17 774,32 L 774,70 Q 774,85 784,85 L 794,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M815,100A15 15 0 0 0 830 85A15 15 0 0 0 815 70A15 15 0 0 0 800 85A15 15 0 0 0 815 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="815" y="85" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="853,85 842,89 842,81" style="fill:rgb(0,0,0)"/>
<path d="M830,85L848,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M853,100L958,100L958,70L853,70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="905" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="981,85 969,89 969,81" style="fill:rgb(0,0,0)"/>
<path d="M958,85L975,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M996,100A15 15 0 0 0 1011 85A15 15 0 0 0 996 70A15 15 0 0 0 981 85A15 15 0 0 0 996 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="996" y="85" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="1047,85 1035,89 1035,81" style="fill:rgb(0,0,0)"/>
<path d="M1011,85L1041,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="1050" cy="85" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="542,56 531,60 531,52" style="fill:rgb(0,0,0)"/>
<path d="M501,85 L 508,85 Q 516,85 516,70 Q 516,56 526,56 L 537,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,71L676,71A15 15 0 0 0 691 56A15 15 0 0 0 676 41L558,41A15 15 0 0 0 542 56A15 15 0 0 0 558 71Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<polygon points="759,56 747,60 747,52" style="fill:rgb(0,0,0)"/>
<path d="M691,56L753,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,56 L 766,56 Q 774,56 774,64 L 774,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="617,85 605,89 605,81" style="fill:rgb(0,0,0)"/>
<path d="M501,85L611,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M617,85L800,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M659,138A15 15 0 0 0 674 123L674,123A15 15 0 0 0 659 108A15 15 0 0 0 644 123L644,123A15 15 0 0 0 659 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="659" y="123" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="674,123 686,118 686,127" style="fill:rgb(0,0,0)"/>
<path d="M1011,85 L 1018,85 Q 1026,85 1026,100 L 1026,108 Q 1026,123 1011,123 L 695,123 L 680,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,123 L 295,123 Q 280,123 280,108 L 280,100 Q 280,85 288,85 L 295,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,85L295,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/cte-table-name.html">cte-table-name:</a></b>
<button id='xf8d0fe71' onclick='hideorshow("xf8d0fe71","x81284945")'>show</button></p>
 <div id='x81284945' style='display:none;' class='imgcontainer'>
 <div style="max-width:475px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 475.949 91.8">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,36 20,41 20,32" style="fill:rgb(0,0,0)"/>
<path d="M9,36L26,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,51L122,51A15 15 0 0 0 137 36A15 15 0 0 0 122 21L47,21A15 15 0 0 0 32 36A15 15 0 0 0 47 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="173,36 162,41 162,32" style="fill:rgb(0,0,0)"/>
<path d="M137,36L168,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M188,51A15 15 0 0 0 204 36A15 15 0 0 0 188 21A15 15 0 0 0 173 36A15 15 0 0 0 188 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="188" y="36" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="240,36 228,41 228,32" style="fill:rgb(0,0,0)"/>
<path d="M204,36L234,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M255,51L349,51A15 15 0 0 0 364 36A15 15 0 0 0 349 21L255,21A15 15 0 0 0 240 36A15 15 0 0 0 255 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="400,36 388,41 388,32" style="fill:rgb(0,0,0)"/>
<path d="M364,36L394,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,51A15 15 0 0 0 430 36A15 15 0 0 0 415 21A15 15 0 0 0 400 36A15 15 0 0 0 415 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="36" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="466,36 455,41 455,32" style="fill:rgb(0,0,0)"/>
<path d="M430,36L460,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="470" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M302,89A15 15 0 0 0 317 74L317,74A15 15 0 0 0 302 59A15 15 0 0 0 287 74L287,74A15 15 0 0 0 302 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="317,74 328,70 328,78" style="fill:rgb(0,0,0)"/>
<path d="M364,36 L 371,36 Q 379,36 379,51 L 379,59 Q 379,74 364,74 L 338,74 L 323,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,74 L 232,74 Q 217,74 217,59 L 217,51 Q 217,36 224,36 L 232,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="302,6 290,10 290,2" style="fill:rgb(0,0,0)"/>
<path d="M137,36 L 145,36 Q 152,36 152,21 L 152,21 Q 152,6 167,6 L 281,6 L 296,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M302,6 L 422,6 Q 437,6 437,21 L 437,21 Q 437,36 445,36 L 452,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/select-stmt.html">select-stmt:</a></b>
<button id='x14b0be28' onclick='hideorshow("x14b0be28","xf7c61b15")'>show</button></p>
 <div id='xf7c61b15' style='display:none;' class='imgcontainer'>
 <div style="max-width:669px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 669.677 1162.3">
<path d="M55,845L667,845L667,99L55,99Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="6" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="46,17 34,21 34,12" style="fill:rgb(0,0,0)"/>
<path d="M10,17L40,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M61,32L92,32A15 15 0 0 0 107 17A15 15 0 0 0 92 2L61,2A15 15 0 0 0 46 17A15 15 0 0 0 61 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="76" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M167,62L253,62A15 15 0 0 0 268 47L268,47A15 15 0 0 0 253 32L167,32A15 15 0 0 0 152 47L152,47A15 15 0 0 0 167 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="210,17 198,21 198,12" style="fill:rgb(0,0,0)"/>
<path d="M107,17L204,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M210,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M358,32L584,32L584,2L358,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="152,47 140,51 140,43" style="fill:rgb(0,0,0)"/>
<path d="M107,17 L 114,17 Q 122,17 122,32 L 122,32 Q 122,47 134,47 L 146,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="291,47 279,51 279,43" style="fill:rgb(0,0,0)"/>
<path d="M268,47L285,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,47 L 298,47 Q 306,47 306,32 L 306,32 Q 306,17 321,17 L 331,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,70A15 15 0 0 0 486 55L486,55A15 15 0 0 0 471 39A15 15 0 0 0 456 55L456,55A15 15 0 0 0 471 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="486,55 498,50 498,59" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,40 Q 599,55 584,55 L 507,55 L 492,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,55 L 350,55 Q 335,55 335,40 L 335,32 Q 335,17 340,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,83 307,79 307,88" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,68 Q 599,83 584,83 L 316,83 L 301,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,83 L 40,83 Q 25,83 25,98 L 25,113"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="25,47 20,36 29,36" style="fill:rgb(0,0,0)"/>
<path d="M10,17 L 17,17 Q 25,17 25,29 L 25,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="55,129 43,133 43,124" style="fill:rgb(0,0,0)"/>
<path d="M25,47 L 25,114 Q 25,129 37,129 L 49,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,129 115,133 115,124" style="fill:rgb(0,0,0)"/>
<path d="M55,129L121,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,144L193,144A15 15 0 0 0 208 129A15 15 0 0 0 193 114L142,114A15 15 0 0 0 127 129A15 15 0 0 0 142 144Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="250,159 238,163 238,155" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,144 Q 223,159 233,159 L 244,159"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,174L333,174A15 15 0 0 0 348 159A15 15 0 0 0 333 144L265,144A15 15 0 0 0 250 159A15 15 0 0 0 265 174Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="159" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="417,129 406,133 406,124" style="fill:rgb(0,0,0)"/>
<path d="M348,159 L 356,159 Q 363,159 363,144 L 363,144 Q 363,129 378,129 L 396,129 L 411,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,144L545,144L545,114L417,114Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M481,182A15 15 0 0 0 496 166A15 15 0 0 0 481 151A15 15 0 0 0 466 166A15 15 0 0 0 481 182Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="166" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="496,166 508,162 508,171" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,151 Q 560,166 545,166 L 517,166 L 502,166"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M466,166 L 406,166 Q 391,166 391,151 L 391,144 Q 391,129 398,129 L 406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,129 287,133 287,124" style="fill:rgb(0,0,0)"/>
<path d="M208,129L293,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M299,129L406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,212L280,212A15 15 0 0 0 295 197A15 15 0 0 0 280 182L265,182A15 15 0 0 0 250 197A15 15 0 0 0 265 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="197" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="348,197 337,201 337,192" style="fill:rgb(0,0,0)"/>
<path d="M295,197L342,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,197 L 356,197 Q 363,197 363,182 L 363,159 L 363,144"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="250,197 238,201 238,192" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,182 Q 223,197 233,197 L 244,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,287L203,287A15 15 0 0 0 218 272A15 15 0 0 0 203 257L168,257A15 15 0 0 0 153 272A15 15 0 0 0 168 287Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="186" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="290,272 279,277 279,268" style="fill:rgb(0,0,0)"/>
<path d="M218,272L284,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,287L451,287L451,257L290,257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M320,362L422,362L422,331L320,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M371,324A15 15 0 0 0 386 309A15 15 0 0 0 371 293A15 15 0 0 0 356 309A15 15 0 0 0 371 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="386,309 397,304 397,313" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 459,272 Q 466,272 466,287 L 466,294 Q 466,309 451,309 L 407,309 L 392,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M356,309 L 279,309 Q 264,309 264,294 L 264,287 Q 264,272 271,272 L 279,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="320,346 308,351 308,342" style="fill:rgb(0,0,0)"/>
<path d="M218,272 L 226,272 Q 233,272 233,287 L 233,331 Q 233,346 248,346 L 299,346 L 314,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="484,313 488,325 480,325" style="fill:rgb(0,0,0)"/>
<path d="M422,346 L 436,346 Q 451,346 466,346 L 469,346 Q 484,346 484,333 L 484,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,272 494,277 494,268" style="fill:rgb(0,0,0)"/>
<path d="M484,313 L 484,287 Q 484,272 492,272 L 499,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,272 L 496,272 Q 487,272 487,272 Q 487,272 495,272 L 502,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,197 555,185 564,185" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,176 L 560,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,235 360,230 360,239" style="fill:rgb(0,0,0)"/>
<path d="M560,197 L 560,220 Q 560,235 545,235 L 369,235 L 354,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,272 142,277 142,268" style="fill:rgb(0,0,0)"/>
<path d="M348,235 L 142,235 Q 127,235 127,250 L 127,257 Q 127,272 137,272 L 147,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,437L218,437A15 15 0 0 0 233 422A15 15 0 0 0 218 407L168,407A15 15 0 0 0 153 422A15 15 0 0 0 168 437Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="256,422 244,426 244,418" style="fill:rgb(0,0,0)"/>
<path d="M233,422L250,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,437L305,437L305,407L256,407Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="517,324 513,312 521,312" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 502,272 Q 517,272 517,287 L 517,303 L 517,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,384 382,380 382,389" style="fill:rgb(0,0,0)"/>
<path d="M517,324 L 517,369 Q 517,384 502,384 L 391,384 L 376,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,422 142,426 142,418" style="fill:rgb(0,0,0)"/>
<path d="M371,384 L 142,384 Q 127,384 127,399 L 127,407 Q 127,422 137,422 L 147,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,324 122,312 131,312" style="fill:rgb(0,0,0)"/>
<path d="M127,257L127,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,324L127,407"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,535L212,535A15 15 0 0 0 227 520A15 15 0 0 0 212 505L168,505A15 15 0 0 0 153 520A15 15 0 0 0 168 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="250,520 238,525 238,516" style="fill:rgb(0,0,0)"/>
<path d="M227,520L244,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,535L269,535A15 15 0 0 0 284 520A15 15 0 0 0 269 505L265,505A15 15 0 0 0 250 520A15 15 0 0 0 265 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="320,520 309,525 309,516" style="fill:rgb(0,0,0)"/>
<path d="M284,520L314,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,535L369,535L369,505L320,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="452,520 441,525 441,516" style="fill:rgb(0,0,0)"/>
<path d="M369,520L446,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,535L520,535A15 15 0 0 0 535 520A15 15 0 0 0 520 505L467,505A15 15 0 0 0 452 520A15 15 0 0 0 467 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="558,520 546,525 546,516" style="fill:rgb(0,0,0)"/>
<path d="M535,520L552,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,535L607,535L607,505L558,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M345,573A15 15 0 0 0 360 558A15 15 0 0 0 345 543A15 15 0 0 0 330 558A15 15 0 0 0 345 573Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="558" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="360,558 371,554 371,562" style="fill:rgb(0,0,0)"/>
<path d="M369,520 L 377,520 Q 384,520 384,535 L 384,543 Q 384,558 375,558 L 366,558"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,558 L 309,558 Q 294,558 294,543 L 294,535 Q 294,520 301,520 L 309,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="514,551 503,555 503,546" style="fill:rgb(0,0,0)"/>
<path d="M411,520 L 418,520 Q 426,520 426,535 L 426,536 Q 426,551 441,551 L 493,551 L 508,551"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M514,551 L 607,551 Q 622,551 622,536 L 622,535 Q 622,520 630,520 L 637,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,490 256,494 256,486" style="fill:rgb(0,0,0)"/>
<path d="M127,460 L 127,475 Q 127,490 142,490 L 246,490 L 261,490"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,520 399,525 399,516" style="fill:rgb(0,0,0)"/>
<path d="M267,490 L 369,490 Q 384,490 384,505 L 384,505 Q 384,520 395,520 L 405,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,460 244,455 244,464" style="fill:rgb(0,0,0)"/>
<path d="M305,422 L 313,422 Q 320,422 320,437 L 320,445 Q 320,460 305,460 L 254,460 L 239,460"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,520 142,525 142,516" style="fill:rgb(0,0,0)"/>
<path d="M233,460 L 142,460 Q 127,460 127,475 L 127,505 Q 127,520 137,520 L 147,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,447 122,435 131,435" style="fill:rgb(0,0,0)"/>
<path d="M127,407L127,441"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,447L127,505"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,649L232,649A15 15 0 0 0 247 634A15 15 0 0 0 232 619L168,619A15 15 0 0 0 153 634A15 15 0 0 0 168 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="200" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="283,634 271,638 271,629" style="fill:rgb(0,0,0)"/>
<path d="M247,634L277,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,649L395,649A15 15 0 0 0 410 634A15 15 0 0 0 395 619L298,619A15 15 0 0 0 283 634A15 15 0 0 0 298 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="433,634 422,638 422,629" style="fill:rgb(0,0,0)"/>
<path d="M410,634L427,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,649L452,649A15 15 0 0 0 467 634A15 15 0 0 0 452 619L448,619A15 15 0 0 0 433 634A15 15 0 0 0 448 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="450" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="490,634 479,638 479,629" style="fill:rgb(0,0,0)"/>
<path d="M467,634L485,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,649L609,649L609,619L490,619Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="550" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M446,687A15 15 0 0 0 461 671A15 15 0 0 0 446 656A15 15 0 0 0 431 671A15 15 0 0 0 446 687Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="671" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="461,671 472,667 472,676" style="fill:rgb(0,0,0)"/>
<path d="M609,634 L 616,634 Q 624,634 624,649 L 624,656 Q 624,671 609,671 L 482,671 L 467,671"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,671 L 271,671 Q 256,671 256,656 L 256,649 Q 256,634 264,634 L 271,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="624,692 619,680 628,680" style="fill:rgb(0,0,0)"/>
<path d="M624,656L624,686"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,558 648,547 656,547" style="fill:rgb(0,0,0)"/>
<path d="M607,520 L 637,520 Q 652,520 652,535 L 652,537 L 652,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,596 382,592 382,600" style="fill:rgb(0,0,0)"/>
<path d="M652,558 L 652,581 Q 652,596 637,596 L 391,596 L 376,596"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,634 142,638 142,629" style="fill:rgb(0,0,0)"/>
<path d="M371,596 L 142,596 Q 127,596 127,611 L 127,619 Q 127,634 137,634 L 147,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,558 122,547 131,547" style="fill:rgb(0,0,0)"/>
<path d="M127,505L127,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,709 359,714 359,705" style="fill:rgb(0,0,0)"/>
<path d="M127,558 L 127,694 Q 127,709 142,709 L 350,709 L 365,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,709 597,714 597,705" style="fill:rgb(0,0,0)"/>
<path d="M371,709L603,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,709 L 616,709 Q 624,709 624,717 L 624,724"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,800L194,800A15 15 0 0 0 209 785A15 15 0 0 0 194 770L142,770A15 15 0 0 0 127 785A15 15 0 0 0 142 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="245,785 234,789 234,781" style="fill:rgb(0,0,0)"/>
<path d="M209,785L239,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,800A15 15 0 0 0 275 785A15 15 0 0 0 260 770A15 15 0 0 0 245 785A15 15 0 0 0 260 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="311,785 300,789 300,781" style="fill:rgb(0,0,0)"/>
<path d="M275,785L306,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,800L361,800L361,770L311,770Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="397,785 385,789 385,781" style="fill:rgb(0,0,0)"/>
<path d="M361,785L391,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,800A15 15 0 0 0 427 785A15 15 0 0 0 412 770A15 15 0 0 0 397 785A15 15 0 0 0 412 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="412" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="609,785 597,789 597,781" style="fill:rgb(0,0,0)"/>
<path d="M427,785L603,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,785 L 616,785 Q 624,785 624,792 L 624,800"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,762A15 15 0 0 0 351 747A15 15 0 0 0 336 732A15 15 0 0 0 321 747A15 15 0 0 0 336 762Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="747" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M336,838A15 15 0 0 0 351 823A15 15 0 0 0 336 808A15 15 0 0 0 321 823A15 15 0 0 0 336 838Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="823" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="351,747 363,743 363,751" style="fill:rgb(0,0,0)"/>
<path d="M361,785 L 368,785 Q 376,785 376,770 L 376,762 Q 376,747 366,747 L 357,747"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,747 L 300,747 Q 285,747 285,762 L 285,770 Q 285,785 292,785 L 300,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,823 363,818 363,827" style="fill:rgb(0,0,0)"/>
<path d="M427,785 L 434,785 Q 442,785 442,800 L 442,808 Q 442,823 427,823 L 372,823 L 357,823"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,823 L 234,823 Q 219,823 219,808 L 219,800 Q 219,785 226,785 L 234,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,785 115,789 115,781" style="fill:rgb(0,0,0)"/>
<path d="M55,129 L 62,129 Q 70,129 70,144 L 70,770 Q 70,785 85,785 L 106,785 L 121,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,891L424,891L424,860L248,860Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="876" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="424,876 436,871 436,880" style="fill:rgb(0,0,0)"/>
<path d="M624,692 L 624,861 Q 624,876 609,876 L 445,876 L 430,876"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="6,197 10,208 2,208" style="fill:rgb(0,0,0)"/>
<path d="M248,876 L 21,876 Q 6,876 6,861 L 6,217 L 6,202"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M6,197 L 6,144 Q 6,129 21,129 L 40,129 L 55,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="667" y="275" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" transform="rotate(-90 667,285)" dominant-baseline="central">select-core</text>
<path d="M168,966L213,966A15 15 0 0 0 228 951A15 15 0 0 0 213 936L168,936A15 15 0 0 0 153 951A15 15 0 0 0 168 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="251,951 239,956 239,947" style="fill:rgb(0,0,0)"/>
<path d="M228,951L245,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,966L270,966A15 15 0 0 0 285 951A15 15 0 0 0 270 936L266,936A15 15 0 0 0 251 951A15 15 0 0 0 266 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M168,1072L202,1072A15 15 0 0 0 217 1057A15 15 0 0 0 202 1042L168,1042A15 15 0 0 0 153 1057A15 15 0 0 0 168 1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="240,1057 228,1061 228,1053" style="fill:rgb(0,0,0)"/>
<path d="M217,1057L234,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,1072L289,1072L289,1042L240,1042Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="330,951 319,956 319,947" style="fill:rgb(0,0,0)"/>
<path d="M285,951L324,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,966L460,966L460,936L330,936Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M395,1004A15 15 0 0 0 410 989A15 15 0 0 0 395 974A15 15 0 0 0 380 989A15 15 0 0 0 395 1004Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="989" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="410,989 422,985 422,993" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 468,951 Q 475,951 475,966 L 475,974 Q 475,989 460,989 L 431,989 L 416,989"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,989 L 322,989 Q 307,989 307,974 L 307,966 Q 307,951 313,951 L 319,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,913 348,909 348,918" style="fill:rgb(0,0,0)"/>
<path d="M624,860 L 624,898 Q 624,913 609,913 L 357,913 L 342,913"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,951 142,956 142,947" style="fill:rgb(0,0,0)"/>
<path d="M336,913 L 142,913 Q 127,913 127,928 L 127,936 Q 127,951 137,951 L 147,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,981 492,970 500,970" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 481,951 Q 496,951 496,963 L 496,976"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,1023 318,1019 318,1027" style="fill:rgb(0,0,0)"/>
<path d="M496,981 L 496,1008 Q 496,1023 481,1023 L 327,1023 L 312,1023"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,1057 142,1061 142,1053" style="fill:rgb(0,0,0)"/>
<path d="M307,1023 L 142,1023 Q 127,1023 127,1038 L 127,1042 Q 127,1057 137,1057 L 147,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,989 122,978 131,978" style="fill:rgb(0,0,0)"/>
<path d="M127,936L127,983"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,989L127,1042"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1102L415,1102A15 15 0 0 0 430 1087A15 15 0 0 0 415 1072L363,1072A15 15 0 0 0 348 1087A15 15 0 0 0 363 1102Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="389" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="453,1087 441,1092 441,1083" style="fill:rgb(0,0,0)"/>
<path d="M430,1087L447,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,1102L502,1102L502,1072L453,1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="525,1087 513,1092 513,1083" style="fill:rgb(0,0,0)"/>
<path d="M502,1087L519,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1140A15 15 0 0 0 378 1125A15 15 0 0 0 363 1110A15 15 0 0 0 348 1125A15 15 0 0 0 363 1140Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="1125" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="401,1125 390,1129 390,1121" style="fill:rgb(0,0,0)"/>
<path d="M378,1125L396,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,1140L451,1140L451,1110L401,1110Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="1125" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="312,1057 301,1061 301,1053" style="fill:rgb(0,0,0)"/>
<path d="M289,1057L306,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1125 337,1129 337,1121" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1110 Q 327,1125 335,1125 L 342,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1087 337,1092 337,1083" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1072 Q 327,1087 335,1087 L 342,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1057 513,1061 513,1053" style="fill:rgb(0,0,0)"/>
<path d="M312,1057L519,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="620,1155 609,1160 609,1151" style="fill:rgb(0,0,0)"/>
<path d="M525,1057 L 546,1057 Q 561,1057 561,1072 L 561,1140 Q 561,1155 576,1155 L 599,1155 L 614,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="624" cy="1155" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1087 L 546,1087 Q 561,1087 561,1095 L 561,1102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1125 513,1129 513,1121" style="fill:rgb(0,0,0)"/>
<path d="M451,1125L519,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1125 L 546,1125 Q 561,1125 561,1133 L 561,1140"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1155 513,1160 513,1151" style="fill:rgb(0,0,0)"/>
<path d="M127,1042 L 127,1140 Q 127,1155 142,1155 L 504,1155 L 519,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1155L597,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/common-table-expression.html">common-table-expression:</a></b>
<button id='x345e59cf' onclick='hideorshow("x345e59cf","xd27fca44")'>show</button></p>
 <div id='xd27fca44' style='display:none;' class='imgcontainer'>
 <div style="max-width:638px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 638.525 167.4">
<circle cx="5" cy="29" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,29 20,33 20,24" style="fill:rgb(0,0,0)"/>
<path d="M9,29L26,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,44L122,44A15 15 0 0 0 137 29A15 15 0 0 0 122 14L47,14A15 15 0 0 0 32 29A15 15 0 0 0 47 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="160,29 149,33 149,24" style="fill:rgb(0,0,0)"/>
<path d="M137,29L155,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="196,29 185,33 185,24" style="fill:rgb(0,0,0)"/>
<path d="M160,29L191,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,44A15 15 0 0 0 227 29A15 15 0 0 0 211 14A15 15 0 0 0 196 29A15 15 0 0 0 211 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="250,29 238,33 238,24" style="fill:rgb(0,0,0)"/>
<path d="M227,29L244,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="286,29 274,33 274,24" style="fill:rgb(0,0,0)"/>
<path d="M250,29L280,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,44L395,44A15 15 0 0 0 410 29A15 15 0 0 0 395 14L301,14A15 15 0 0 0 286 29A15 15 0 0 0 301 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="446,29 434,33 434,24" style="fill:rgb(0,0,0)"/>
<path d="M410,29L440,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,44A15 15 0 0 0 476 29A15 15 0 0 0 461 14A15 15 0 0 0 446 29A15 15 0 0 0 461 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,29 499,33 499,24" style="fill:rgb(0,0,0)"/>
<path d="M476,29L505,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,165L51,165A15 15 0 0 0 66 150A15 15 0 0 0 51 135L47,135A15 15 0 0 0 32 150A15 15 0 0 0 47 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="49" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<path d="M127,135L147,135A15 15 0 0 0 162 119A15 15 0 0 0 147 104L127,104A15 15 0 0 0 112 119A15 15 0 0 0 127 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<path d="M219,135L337,135A15 15 0 0 0 352 119A15 15 0 0 0 337 104L219,104A15 15 0 0 0 204 119A15 15 0 0 0 219 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<path d="M162,119L204,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,165A15 15 0 0 0 425 150A15 15 0 0 0 410 135A15 15 0 0 0 395 150A15 15 0 0 0 410 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="410" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="448,150 437,154 437,145" style="fill:rgb(0,0,0)"/>
<path d="M425,150L442,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,165L552,165L552,135L448,135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="500" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="575,150 564,154 564,145" style="fill:rgb(0,0,0)"/>
<path d="M552,150L570,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M591,165A15 15 0 0 0 606 150A15 15 0 0 0 591 135A15 15 0 0 0 575 150A15 15 0 0 0 591 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="629,150 617,154 617,145" style="fill:rgb(0,0,0)"/>
<path d="M606,150L623,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="632" cy="150" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,82A15 15 0 0 0 363 66A15 15 0 0 0 348 51A15 15 0 0 0 333 66A15 15 0 0 0 348 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="363,66 374,62 374,71" style="fill:rgb(0,0,0)"/>
<path d="M410,29 L 417,29 Q 425,29 425,44 L 425,51 Q 425,66 410,66 L 384,66 L 369,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M333,66 L 278,66 Q 263,66 263,51 L 263,44 Q 263,29 270,29 L 278,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,93 78,89 78,97" style="fill:rgb(0,0,0)"/>
<path d="M511,29 L 516,29 Q 522,29 522,44 L 522,78 Q 522,93 507,93 L 87,93 L 72,93"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,150 20,154 20,145" style="fill:rgb(0,0,0)"/>
<path d="M66,93 L 30,93 Q 15,93 15,108 L 15,135 Q 15,150 20,150 L 26,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="85,150 73,154 73,145" style="fill:rgb(0,0,0)"/>
<path d="M66,150L79,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="112,119 101,124 101,115" style="fill:rgb(0,0,0)"/>
<path d="M85,150 L 89,150 Q 92,150 92,135 L 92,134 Q 92,119 99,119 L 106,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="204,119 192,124 192,115" style="fill:rgb(0,0,0)"/>
<path d="M66,150 L 147,150 Q 162,150 170,150 Q 177,150 177,135 L 177,134 Q 177,119 188,119 L 198,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,150 383,154 383,145" style="fill:rgb(0,0,0)"/>
<path d="M352,119 L 360,119 Q 367,119 367,134 L 367,135 Q 367,150 378,150 L 389,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150L395,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,6 336,10 336,2" style="fill:rgb(0,0,0)"/>
<path d="M160,29 L 168,29 Q 175,29 175,17 Q 175,6 190,6 L 327,6 L 342,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,6 L 473,6 Q 488,6 488,17 Q 488,29 495,29 L 503,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/compound-operator.html">compound-operator:</a></b>
<button id='x17fd0ec5' onclick='hideorshow("x17fd0ec5","x5b85bf9e")'>show</button></p>
 <div id='x5b85bf9e' style='display:none;' class='imgcontainer'>
 <div style="max-width:293px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 293.842 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L127,32A15 15 0 0 0 142 17A15 15 0 0 0 127 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,70L127,70A15 15 0 0 0 142 55L142,55A15 15 0 0 0 127 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,108L168,108A15 15 0 0 0 183 92A15 15 0 0 0 168 77L83,77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M83,145L135,145A15 15 0 0 0 150 130A15 15 0 0 0 135 115L83,115A15 15 0 0 0 68 130A15 15 0 0 0 83 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M142,55L159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70L195,70A15 15 0 0 0 210 55L210,55A15 15 0 0 0 195 39L180,39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="233,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M210,55L227,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,17 272,21 272,12" style="fill:rgb(0,0,0)"/>
<path d="M233,55 L 240,55 Q 248,55 248,40 L 248,32 Q 248,17 263,17 L 263,17 L 278,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="288" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M47,39 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,92 221,97 221,88" style="fill:rgb(0,0,0)"/>
<path d="M183,92L227,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,92 L 240,92 Q 248,92 248,77 L 248,54 L 248,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,130 56,135 56,126" style="fill:rgb(0,0,0)"/>
<path d="M47,77 L 47,115 Q 47,130 55,130 L 62,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,130 221,135 221,126" style="fill:rgb(0,0,0)"/>
<path d="M150,130L227,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,130 L 240,130 Q 248,130 248,115 L 248,92 L 248,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/expr.html">expr:</a></b>
<button id='x01bf7635' onclick='hideorshow("x01bf7635","xb040f6d1")'>show</button></p>
 <div id='xb040f6d1' style='display:none;' class='imgcontainer'>
 <div style="max-width:963px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 963.96 1068.77">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L158,32L158,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="101" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="954,17 943,21 943,12" style="fill:rgb(0,0,0)"/>
<path d="M158,17L948,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="958" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L172,70A15 15 0 0 0 187 55L187,55A15 15 0 0 0 172 39L60,39A15 15 0 0 0 45 55L45,55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">bind-parameter</text>
<polygon points="916,55 905,59 905,50" style="fill:rgb(0,0,0)"/>
<path d="M187,55L910,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,55 L 924,55 Q 931,55 931,47 L 931,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 31,55 L 39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,130L156,130A15 15 0 0 0 171 115A15 15 0 0 0 156 100L60,100A15 15 0 0 0 45 115A15 15 0 0 0 60 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,115 183,119 183,111" style="fill:rgb(0,0,0)"/>
<path d="M171,115L189,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,130A15 15 0 0 0 225 115A15 15 0 0 0 210 100A15 15 0 0 0 195 115A15 15 0 0 0 210 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M225,115L255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130L351,130A15 15 0 0 0 366 115A15 15 0 0 0 351 100L276,100A15 15 0 0 0 261 115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="389,115 378,119 378,111" style="fill:rgb(0,0,0)"/>
<path d="M366,115L383,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,130A15 15 0 0 0 419 115A15 15 0 0 0 404 100A15 15 0 0 0 389 115A15 15 0 0 0 404 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="404" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="455,115 444,119 444,111" style="fill:rgb(0,0,0)"/>
<path d="M419,115L450,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,130L565,130A15 15 0 0 0 580 115A15 15 0 0 0 565 100L471,100A15 15 0 0 0 455 115A15 15 0 0 0 471 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="916,115 905,119 905,111" style="fill:rgb(0,0,0)"/>
<path d="M580,115L910,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,115 L 924,115 Q 931,115 931,108 L 931,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,115 33,119 33,111" style="fill:rgb(0,0,0)"/>
<path d="M24,100 L 24,108 Q 24,115 31,115 L 39,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,89 97,93 97,84" style="fill:rgb(0,0,0)"/>
<path d="M24,74 L 24,81 Q 24,89 39,89 L 87,89 L 102,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 302,93 302,84" style="fill:rgb(0,0,0)"/>
<path d="M108,89 L 129,89 Q 144,89 159,89 L 293,89 L 308,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,89 L 414,89 Q 429,89 429,102 Q 429,115 436,115 L 444,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M223,89 L 230,89 Q 238,89 238,102 Q 238,115 245,115 L 253,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,168L168,168A15 15 0 0 0 183 153A15 15 0 0 0 168 138L60,138A15 15 0 0 0 45 153A15 15 0 0 0 60 168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">unary-operator</text>
<polygon points="206,153 194,157 194,149" style="fill:rgb(0,0,0)"/>
<path d="M183,153L200,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,168L255,168L255,138L206,138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,153 905,157 905,149" style="fill:rgb(0,0,0)"/>
<path d="M255,153L910,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,153 L 924,153 Q 931,153 931,145 L 931,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,153 33,157 33,149" style="fill:rgb(0,0,0)"/>
<path d="M24,138 L 24,145 Q 24,153 31,153 L 39,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,206L94,206L94,176L45,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,191 106,195 106,186" style="fill:rgb(0,0,0)"/>
<path d="M94,191L111,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,206L245,206A15 15 0 0 0 261 191A15 15 0 0 0 245 176L132,176A15 15 0 0 0 117 191A15 15 0 0 0 132 206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">binary-operator</text>
<polygon points="284,191 272,195 272,186" style="fill:rgb(0,0,0)"/>
<path d="M261,191L278,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,206L333,206L333,176L284,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="308" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,191 905,195 905,186" style="fill:rgb(0,0,0)"/>
<path d="M333,191L910,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,191 L 924,191 Q 931,191 931,183 L 931,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,191 33,195 33,186" style="fill:rgb(0,0,0)"/>
<path d="M24,176 L 24,183 Q 24,191 31,191 L 39,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,245L162,245A15 15 0 0 0 177 230A15 15 0 0 0 162 215L60,215A15 15 0 0 0 45 230A15 15 0 0 0 60 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="111" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-name</text>
<polygon points="194,230 183,234 183,226" style="fill:rgb(0,0,0)"/>
<path d="M177,230L188,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,245A15 15 0 0 0 224 230A15 15 0 0 0 209 215A15 15 0 0 0 194 230A15 15 0 0 0 209 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="260,230 249,234 249,226" style="fill:rgb(0,0,0)"/>
<path d="M224,230L255,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,245L437,245L437,215L260,215Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-arguments</text>
<polygon points="473,230 461,234 461,226" style="fill:rgb(0,0,0)"/>
<path d="M437,230L467,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,245A15 15 0 0 0 503 230A15 15 0 0 0 488 215A15 15 0 0 0 473 230A15 15 0 0 0 488 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="541,260 529,265 529,256" style="fill:rgb(0,0,0)"/>
<path d="M503,230 L 510,230 Q 518,230 518,245 L 518,245 Q 518,260 527,260 L 535,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,275L653,275L653,245L541,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="691,230 680,234 680,226" style="fill:rgb(0,0,0)"/>
<path d="M653,260 L 661,260 Q 668,260 668,245 L 668,245 Q 668,230 677,230 L 685,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="729,260 718,265 718,256" style="fill:rgb(0,0,0)"/>
<path d="M691,230 L 699,230 Q 706,230 706,245 L 706,245 Q 706,260 715,260 L 723,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,275L837,275L837,245L729,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="783" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">over-clause</text>
<polygon points="916,260 905,265 905,256" style="fill:rgb(0,0,0)"/>
<path d="M837,260L910,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,260 L 924,260 Q 931,260 931,253 L 931,245"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,230 33,234 33,226" style="fill:rgb(0,0,0)"/>
<path d="M24,215 L 24,222 Q 24,230 31,230 L 39,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,230 585,234 585,226" style="fill:rgb(0,0,0)"/>
<path d="M503,230L591,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,230L680,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,230 905,234 905,226" style="fill:rgb(0,0,0)"/>
<path d="M691,230L910,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,230 L 924,230 Q 931,230 931,222 L 931,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,321A15 15 0 0 0 75 306A15 15 0 0 0 60 290A15 15 0 0 0 45 306A15 15 0 0 0 60 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,306 100,310 100,301" style="fill:rgb(0,0,0)"/>
<path d="M75,306L105,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M111,321L160,321L160,290L111,290Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="306" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="196,306 185,310 185,301" style="fill:rgb(0,0,0)"/>
<path d="M160,306L191,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,321A15 15 0 0 0 227 306A15 15 0 0 0 211 290A15 15 0 0 0 196 306A15 15 0 0 0 211 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,306 905,310 905,301" style="fill:rgb(0,0,0)"/>
<path d="M227,306L910,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,306 L 924,306 Q 931,306 931,298 L 931,291"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,306 33,310 33,301" style="fill:rgb(0,0,0)"/>
<path d="M24,290 L 24,298 Q 24,306 31,306 L 39,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,284A15 15 0 0 0 151 269A15 15 0 0 0 136 254A15 15 0 0 0 121 269A15 15 0 0 0 136 284Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="269" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="151,269 162,265 162,274" style="fill:rgb(0,0,0)"/>
<path d="M160,306 L 168,306 Q 175,306 175,291 L 175,284 Q 175,269 166,269 L 157,269"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,269 L 103,269 Q 88,269 88,284 L 88,291 Q 88,306 96,306 L 103,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,358L88,358A15 15 0 0 0 103 343A15 15 0 0 0 88 328L60,328A15 15 0 0 0 45 343A15 15 0 0 0 60 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CAST</text>
<polygon points="126,343 114,348 114,339" style="fill:rgb(0,0,0)"/>
<path d="M103,343L120,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M141,358A15 15 0 0 0 156 343A15 15 0 0 0 141 328A15 15 0 0 0 126 343A15 15 0 0 0 141 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="179,343 168,348 168,339" style="fill:rgb(0,0,0)"/>
<path d="M156,343L173,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,358L228,358L228,328L179,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="251,343 240,348 240,339" style="fill:rgb(0,0,0)"/>
<path d="M228,343L246,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,358L271,358A15 15 0 0 0 286 343A15 15 0 0 0 271 328L267,328A15 15 0 0 0 251 343A15 15 0 0 0 267 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="269" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="309,343 297,348 297,339" style="fill:rgb(0,0,0)"/>
<path d="M286,343L303,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,358L408,358L408,328L309,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="358" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="431,343 419,348 419,339" style="fill:rgb(0,0,0)"/>
<path d="M408,343L425,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M446,358A15 15 0 0 0 461 343A15 15 0 0 0 446 328A15 15 0 0 0 431 343A15 15 0 0 0 446 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,343 905,348 905,339" style="fill:rgb(0,0,0)"/>
<path d="M461,343L910,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,343 L 924,343 Q 931,343 931,336 L 931,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,343 33,348 33,339" style="fill:rgb(0,0,0)"/>
<path d="M24,328 L 24,336 Q 24,343 31,343 L 39,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,396L94,396L94,366L45,366Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,381 106,385 106,377" style="fill:rgb(0,0,0)"/>
<path d="M94,381L111,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,396L196,396A15 15 0 0 0 211 381A15 15 0 0 0 196 366L132,366A15 15 0 0 0 117 381A15 15 0 0 0 132 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="234,381 223,385 223,377" style="fill:rgb(0,0,0)"/>
<path d="M211,381L229,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,396L355,396A15 15 0 0 0 370 381A15 15 0 0 0 355 366L250,366A15 15 0 0 0 234 381A15 15 0 0 0 250 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="916,381 905,385 905,377" style="fill:rgb(0,0,0)"/>
<path d="M370,381L910,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,381 L 924,381 Q 931,381 931,374 L 931,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,381 33,385 33,377" style="fill:rgb(0,0,0)"/>
<path d="M24,366 L 24,374 Q 24,381 31,381 L 39,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,434L94,434L94,404L45,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,419 119,423 119,415" style="fill:rgb(0,0,0)"/>
<path d="M94,419L124,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,434L165,434A15 15 0 0 0 180 419A15 15 0 0 0 165 404L145,404A15 15 0 0 0 130 419A15 15 0 0 0 145 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="234,419 223,423 223,415" style="fill:rgb(0,0,0)"/>
<path d="M180,419L229,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,434L273,434A15 15 0 0 0 288 419A15 15 0 0 0 273 404L250,404A15 15 0 0 0 234 419A15 15 0 0 0 250 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIKE</text>
<path d="M250,472L279,472A15 15 0 0 0 294 457A15 15 0 0 0 279 442L250,442A15 15 0 0 0 234 457A15 15 0 0 0 250 472Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="457" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GLOB</text>
<path d="M250,510L302,510A15 15 0 0 0 317 495A15 15 0 0 0 302 479L250,479A15 15 0 0 0 234 495A15 15 0 0 0 250 510Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REGEXP</text>
<path d="M250,547L297,547A15 15 0 0 0 313 532A15 15 0 0 0 297 517L250,517A15 15 0 0 0 234 532A15 15 0 0 0 250 547Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="274" y="532" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<path d="M378,510L427,510L427,479L378,479Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M378,434L427,434L427,404L378,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="465,449 454,454 454,445" style="fill:rgb(0,0,0)"/>
<path d="M427,419 L 435,419 Q 442,419 442,434 L 442,434 Q 442,449 451,449 L 460,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,464L532,464A15 15 0 0 0 547 449A15 15 0 0 0 532 434L480,434A15 15 0 0 0 465 449A15 15 0 0 0 480 464Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="506" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ESCAPE</text>
<polygon points="570,449 559,454 559,445" style="fill:rgb(0,0,0)"/>
<path d="M547,449L565,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M570,464L620,464L620,434L570,434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="595" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="671,419 659,423 659,415" style="fill:rgb(0,0,0)"/>
<path d="M620,449 L 627,449 Q 635,449 635,434 L 635,434 Q 635,419 650,419 L 650,419 L 665,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,419 905,423 905,415" style="fill:rgb(0,0,0)"/>
<path d="M671,419L910,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,419 L 924,419 Q 931,419 931,411 L 931,404"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,419 33,423 33,415" style="fill:rgb(0,0,0)"/>
<path d="M24,404 L 24,411 Q 24,419 31,419 L 39,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M100,419 L 108,419 Q 115,419 115,434 L 115,434 Q 115,449 130,449 L 177,449 Q 192,449 192,434 L 192,434 Q 192,419 199,419 L 207,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,532 223,537 223,528" style="fill:rgb(0,0,0)"/>
<path d="M196,419 L 204,419 Q 211,419 211,434 L 211,517 Q 211,532 220,532 L 229,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,457 223,461 223,452" style="fill:rgb(0,0,0)"/>
<path d="M211,442 L 211,449 Q 211,457 220,457 L 229,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,495 223,499 223,490" style="fill:rgb(0,0,0)"/>
<path d="M211,479 L 211,487 Q 211,495 220,495 L 229,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,419 367,423 367,415" style="fill:rgb(0,0,0)"/>
<path d="M288,419L372,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,532 329,537 329,528" style="fill:rgb(0,0,0)"/>
<path d="M313,532L334,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,495 367,499 367,490" style="fill:rgb(0,0,0)"/>
<path d="M340,532 L 348,532 Q 355,532 355,517 L 355,510 Q 355,495 364,495 L 372,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,495 329,499 329,490" style="fill:rgb(0,0,0)"/>
<path d="M317,495L334,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,495L378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,457 329,461 329,452" style="fill:rgb(0,0,0)"/>
<path d="M294,457L334,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,457 L 348,457 Q 355,457 355,472 L 355,480 Q 355,495 367,495 L 378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="506,419 495,423 495,415" style="fill:rgb(0,0,0)"/>
<path d="M427,419L501,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M506,419L659,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="547,495 536,499 536,490" style="fill:rgb(0,0,0)"/>
<path d="M427,495L542,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,495 L 656,495 Q 671,495 671,480 L 671,434 Q 671,419 686,419 L 692,419 L 707,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,585L94,585L94,555L45,555Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,570 119,574 119,566" style="fill:rgb(0,0,0)"/>
<path d="M94,570L124,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,585L194,585A15 15 0 0 0 209 570A15 15 0 0 0 194 555L145,555A15 15 0 0 0 130 570A15 15 0 0 0 145 585Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="170" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ISNULL</text>
<polygon points="916,570 905,574 905,566" style="fill:rgb(0,0,0)"/>
<path d="M209,570L910,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,570 L 924,570 Q 931,570 931,563 L 931,555"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,570 33,574 33,566" style="fill:rgb(0,0,0)"/>
<path d="M24,555 L 24,563 Q 24,570 31,570 L 39,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,623L215,623A15 15 0 0 0 230 608A15 15 0 0 0 215 593L145,593A15 15 0 0 0 130 608A15 15 0 0 0 145 623Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="608" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTNULL</text>
<path d="M145,661L165,661A15 15 0 0 0 180 646A15 15 0 0 0 165 631L145,631A15 15 0 0 0 130 646A15 15 0 0 0 145 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="203,646 192,650 192,641" style="fill:rgb(0,0,0)"/>
<path d="M180,646L198,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,661L250,661A15 15 0 0 0 265 646A15 15 0 0 0 250 631L219,631A15 15 0 0 0 203 646A15 15 0 0 0 219 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="288,646 276,650 276,641" style="fill:rgb(0,0,0)"/>
<path d="M265,646L282,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="339,570 327,574 327,566" style="fill:rgb(0,0,0)"/>
<path d="M288,646 L 295,646 Q 303,646 303,631 L 303,585 Q 303,570 318,570 L 318,570 L 333,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="288,608 276,612 276,604" style="fill:rgb(0,0,0)"/>
<path d="M230,608L282,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,608 L 295,608 Q 303,608 303,600 L 303,593"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,646 119,650 119,641" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,631 Q 109,646 117,646 L 124,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,608 119,612 119,604" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,593 Q 109,608 117,608 L 124,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,699L94,699L94,668L45,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,684 106,688 106,679" style="fill:rgb(0,0,0)"/>
<path d="M94,684L111,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,699A15 15 0 0 0 147 684A15 15 0 0 0 132 668A15 15 0 0 0 117 684A15 15 0 0 0 132 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IS</text>
<polygon points="183,684 172,688 172,679" style="fill:rgb(0,0,0)"/>
<path d="M147,684L178,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M198,699L219,699A15 15 0 0 0 234 684A15 15 0 0 0 219 668L198,668A15 15 0 0 0 183 684A15 15 0 0 0 198 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="270,684 258,688 258,679" style="fill:rgb(0,0,0)"/>
<path d="M234,684L264,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="306,684 294,688 294,679" style="fill:rgb(0,0,0)"/>
<path d="M270,684L300,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,699L389,699A15 15 0 0 0 404 684A15 15 0 0 0 389 668L321,668A15 15 0 0 0 306 684A15 15 0 0 0 321 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="440,684 429,688 429,679" style="fill:rgb(0,0,0)"/>
<path d="M404,684L434,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,699L490,699A15 15 0 0 0 505 684A15 15 0 0 0 490 668L455,668A15 15 0 0 0 440 684A15 15 0 0 0 455 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="541,684 530,688 530,679" style="fill:rgb(0,0,0)"/>
<path d="M505,684L535,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,699L590,699L590,668L541,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,684 905,688 905,679" style="fill:rgb(0,0,0)"/>
<path d="M590,684L910,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,684 L 924,684 Q 931,684 931,676 L 931,669"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,684 33,688 33,679" style="fill:rgb(0,0,0)"/>
<path d="M24,668 L 24,676 Q 24,684 31,684 L 39,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,684 L 156,684 Q 164,684 164,696 Q 164,708 179,708 L 230,708 Q 245,708 245,696 Q 245,684 253,684 L 260,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,684 L 279,684 Q 286,684 286,696 Q 286,708 301,708 L 502,708 Q 517,708 517,696 Q 517,684 524,684 L 532,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,744L94,744L94,714L45,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,729 119,733 119,725" style="fill:rgb(0,0,0)"/>
<path d="M94,729L124,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,744L165,744A15 15 0 0 0 180 729A15 15 0 0 0 165 714L145,714A15 15 0 0 0 130 729A15 15 0 0 0 145 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,729 205,733 205,725" style="fill:rgb(0,0,0)"/>
<path d="M180,729L211,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,744L304,744A15 15 0 0 0 319 729A15 15 0 0 0 304 714L232,714A15 15 0 0 0 216 729A15 15 0 0 0 232 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="342,729 331,733 331,725" style="fill:rgb(0,0,0)"/>
<path d="M319,729L336,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M342,744L391,744L391,714L342,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="367" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="414,729 403,733 403,725" style="fill:rgb(0,0,0)"/>
<path d="M391,729L409,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M430,744L450,744A15 15 0 0 0 465 729A15 15 0 0 0 450 714L430,714A15 15 0 0 0 414 729A15 15 0 0 0 430 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="488,729 477,733 477,725" style="fill:rgb(0,0,0)"/>
<path d="M465,729L483,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,744L538,744L538,714L488,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="513" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,729 905,733 905,725" style="fill:rgb(0,0,0)"/>
<path d="M538,729L910,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,729 L 924,729 Q 931,729 931,721 L 931,714"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,729 33,733 33,725" style="fill:rgb(0,0,0)"/>
<path d="M24,714 L 24,721 Q 24,729 31,729 L 39,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,729 L 103,729 Q 110,729 110,741 Q 110,753 125,753 L 177,753 Q 192,753 192,741 Q 192,729 199,729 L 207,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,797L94,797L94,767L45,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,782 119,786 119,778" style="fill:rgb(0,0,0)"/>
<path d="M94,782L124,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,797L165,797A15 15 0 0 0 180 782A15 15 0 0 0 165 767L145,767A15 15 0 0 0 130 782A15 15 0 0 0 145 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,782 205,786 205,778" style="fill:rgb(0,0,0)"/>
<path d="M180,782L211,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,797L234,797A15 15 0 0 0 249 782A15 15 0 0 0 234 767L232,767A15 15 0 0 0 216 782A15 15 0 0 0 232 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IN</text>
<polygon points="285,782 273,786 273,778" style="fill:rgb(0,0,0)"/>
<path d="M249,782L279,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,797A15 15 0 0 0 315 782A15 15 0 0 0 300 767A15 15 0 0 0 285 782A15 15 0 0 0 300 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,782 340,786 340,778" style="fill:rgb(0,0,0)"/>
<path d="M315,782L345,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,797L455,797L455,767L351,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="491,782 480,786 480,778" style="fill:rgb(0,0,0)"/>
<path d="M455,782L486,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M507,797A15 15 0 0 0 522 782A15 15 0 0 0 507 767A15 15 0 0 0 491 782A15 15 0 0 0 507 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="507" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,782 905,786 905,778" style="fill:rgb(0,0,0)"/>
<path d="M522,782L910,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,782 L 924,782 Q 931,782 931,774 L 931,767"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,782 33,786 33,778" style="fill:rgb(0,0,0)"/>
<path d="M24,767 L 24,774 Q 24,782 31,782 L 39,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,782 L 103,782 Q 110,782 110,794 Q 110,806 125,806 L 177,806 Q 192,806 192,794 Q 192,782 199,782 L 207,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,782 L 324,782 Q 332,782 332,770 Q 332,758 347,758 L 452,758 Q 467,758 467,770 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M379,835L428,835L428,805L379,805Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="820" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="379,820 367,824 367,815" style="fill:rgb(0,0,0)"/>
<path d="M317,782 L 324,782 Q 332,782 332,797 L 332,805 Q 332,820 347,820 L 358,820 L 373,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M428,820 L 452,820 Q 467,820 467,805 L 467,797 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,873A15 15 0 0 0 418 857A15 15 0 0 0 403 842A15 15 0 0 0 388 857A15 15 0 0 0 403 873Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="857" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,857 430,853 430,862" style="fill:rgb(0,0,0)"/>
<path d="M428,820 L 435,820 Q 443,820 443,835 L 443,842 Q 443,857 434,857 L 424,857"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,857 L 371,857 Q 356,857 356,842 L 356,835 Q 356,820 363,820 L 371,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,925L396,925A15 15 0 0 0 412 910A15 15 0 0 0 396 895L300,895A15 15 0 0 0 285 910A15 15 0 0 0 300 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="429,910 417,915 417,906" style="fill:rgb(0,0,0)"/>
<path d="M412,910L423,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,925A15 15 0 0 0 459 910A15 15 0 0 0 444 895A15 15 0 0 0 429 910A15 15 0 0 0 444 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="513,910 502,915 502,906" style="fill:rgb(0,0,0)"/>
<path d="M459,910L507,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,925L627,925A15 15 0 0 0 642 910A15 15 0 0 0 627 895L528,895A15 15 0 0 0 513 910A15 15 0 0 0 528 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="577" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function</text>
<polygon points="659,910 647,915 647,906" style="fill:rgb(0,0,0)"/>
<path d="M642,910L653,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,925A15 15 0 0 0 689 910A15 15 0 0 0 674 895A15 15 0 0 0 659 910A15 15 0 0 0 674 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="734,910 723,915 723,906" style="fill:rgb(0,0,0)"/>
<path d="M689,910L728,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,925L783,925L783,895L734,895Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="828,910 817,915 817,906" style="fill:rgb(0,0,0)"/>
<path d="M783,910L823,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M844,925A15 15 0 0 0 859 910A15 15 0 0 0 844 895A15 15 0 0 0 828 910A15 15 0 0 0 844 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="844" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,910 905,915 905,906" style="fill:rgb(0,0,0)"/>
<path d="M859,910L910,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,910 L 924,910 Q 931,910 931,903 L 931,895"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,865L603,865A15 15 0 0 0 619 850A15 15 0 0 0 603 835L528,835A15 15 0 0 0 513 850A15 15 0 0 0 528 865Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="850" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="916,850 905,854 905,846" style="fill:rgb(0,0,0)"/>
<path d="M619,850L910,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,850 L 924,850 Q 931,850 931,842 L 931,835"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="513,850 502,854 502,846" style="fill:rgb(0,0,0)"/>
<path d="M475,910 L 483,910 Q 490,910 490,895 L 490,865 Q 490,850 499,850 L 507,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,892A15 15 0 0 0 774 877A15 15 0 0 0 759 862A15 15 0 0 0 744 877A15 15 0 0 0 759 892Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="877" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="774,877 785,873 785,881" style="fill:rgb(0,0,0)"/>
<path d="M783,910 L 791,910 Q 798,910 798,895 L 798,892 Q 798,877 789,877 L 780,877"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M744,877 L 726,877 Q 711,877 711,892 L 711,895 Q 711,910 719,910 L 726,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M689,910 L 697,910 Q 704,910 704,921 Q 704,932 719,932 L 790,932 Q 805,932 805,921 Q 805,910 813,910 L 820,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="285,910 273,915 273,906" style="fill:rgb(0,0,0)"/>
<path d="M249,782 L 256,782 Q 264,782 264,797 L 264,895 Q 264,910 272,910 L 279,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,882 412,886 412,877" style="fill:rgb(0,0,0)"/>
<path d="M264,867 L 264,874 Q 264,882 279,882 L 402,882 L 417,882"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,882 L 456,882 Q 471,882 471,896 Q 471,910 478,910 L 486,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,971L80,971A15 15 0 0 0 95 956A15 15 0 0 0 80 941L60,941A15 15 0 0 0 45 956A15 15 0 0 0 60 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="131,956 120,960 120,951" style="fill:rgb(0,0,0)"/>
<path d="M95,956L125,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,971L191,971A15 15 0 0 0 206 956A15 15 0 0 0 191 941L146,941A15 15 0 0 0 131 956A15 15 0 0 0 146 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="242,956 231,960 231,951" style="fill:rgb(0,0,0)"/>
<path d="M206,956L236,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,971A15 15 0 0 0 272 956A15 15 0 0 0 257 941A15 15 0 0 0 242 956A15 15 0 0 0 257 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="295,956 284,960 284,951" style="fill:rgb(0,0,0)"/>
<path d="M272,956L290,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,971L400,971L400,941L295,941Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="423,956 411,960 411,951" style="fill:rgb(0,0,0)"/>
<path d="M400,956L417,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,971A15 15 0 0 0 453 956A15 15 0 0 0 438 941A15 15 0 0 0 423 956A15 15 0 0 0 438 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,956 905,960 905,951" style="fill:rgb(0,0,0)"/>
<path d="M453,956L910,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,956 L 924,956 Q 931,956 931,948 L 931,941"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,956 33,960 33,951" style="fill:rgb(0,0,0)"/>
<path d="M24,941 L 24,948 Q 24,956 31,956 L 39,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,929 59,934 59,925" style="fill:rgb(0,0,0)"/>
<path d="M24,914 L 24,922 Q 24,929 39,929 L 49,929 L 64,929"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,929 L 201,929 Q 216,929 216,943 Q 216,956 223,956 L 231,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,929 L 101,929 Q 108,929 108,943 Q 108,956 116,956 L 123,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,1009L89,1009A15 15 0 0 0 104 994A15 15 0 0 0 89 978L60,978A15 15 0 0 0 45 994A15 15 0 0 0 60 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASE</text>
<polygon points="140,994 128,998 128,989" style="fill:rgb(0,0,0)"/>
<path d="M104,994L134,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M140,1009L189,1009L189,978L140,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="243,994 232,998 232,989" style="fill:rgb(0,0,0)"/>
<path d="M189,994L237,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,1009L298,1009A15 15 0 0 0 313 994A15 15 0 0 0 298 978L258,978A15 15 0 0 0 243 994A15 15 0 0 0 258 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="336,994 324,998 324,989" style="fill:rgb(0,0,0)"/>
<path d="M313,994L330,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,1009L385,1009L385,978L336,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="408,994 396,998 396,989" style="fill:rgb(0,0,0)"/>
<path d="M385,994L402,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,1009L456,1009A15 15 0 0 0 472 994A15 15 0 0 0 456 978L423,978A15 15 0 0 0 408 994A15 15 0 0 0 423 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">THEN</text>
<polygon points="495,994 483,998 483,989" style="fill:rgb(0,0,0)"/>
<path d="M472,994L489,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M495,1009L544,1009L544,978L495,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="616,994 604,998 604,989" style="fill:rgb(0,0,0)"/>
<path d="M544,994L610,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M631,1009L658,1009A15 15 0 0 0 673 994A15 15 0 0 0 658 978L631,978A15 15 0 0 0 616 994A15 15 0 0 0 631 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="645" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ELSE</text>
<polygon points="696,994 685,998 685,989" style="fill:rgb(0,0,0)"/>
<path d="M673,994L691,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M696,1009L746,1009L746,978L696,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="721" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="782,994 770,998 770,989" style="fill:rgb(0,0,0)"/>
<path d="M746,994L776,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M797,1009L818,1009A15 15 0 0 0 833 994A15 15 0 0 0 818 978L797,978A15 15 0 0 0 782 994A15 15 0 0 0 797 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="807" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="916,994 905,998 905,989" style="fill:rgb(0,0,0)"/>
<path d="M833,994L910,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,994 L 924,994 Q 931,994 931,986 L 931,979"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,994 33,998 33,989" style="fill:rgb(0,0,0)"/>
<path d="M24,978 L 24,986 Q 24,994 31,994 L 39,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,994 L 111,994 Q 119,994 119,1007 Q 119,1021 134,1021 L 186,1021 Q 201,1021 201,1007 Q 201,994 208,994 L 216,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="360,1021 372,1016 372,1025" style="fill:rgb(0,0,0)"/>
<path d="M544,994 L 551,994 Q 559,994 559,1007 Q 559,1021 544,1021 L 381,1021 L 366,1021"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,1021 L 235,1021 Q 220,1021 220,1007 Q 220,994 227,994 L 235,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,994 L 585,994 Q 593,994 593,1007 Q 593,1021 608,1021 L 742,1021 Q 757,1021 757,1007 Q 757,994 765,994 L 772,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,1066L173,1066L173,1036L45,1036Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="1051" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">raise-function</text>
<polygon points="916,1051 905,1055 905,1047" style="fill:rgb(0,0,0)"/>
<path d="M173,1051L910,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,1051 L 924,1051 Q 931,1051 931,1036 L 931,32 Q 931,17 939,17 L 946,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,1051 33,1055 33,1047" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,1036 Q 24,1051 31,1051 L 39,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/filter-clause.html">filter-clause:</a></b>
<button id='xec00f208' onclick='hideorshow("xec00f208","x9c36b5a0")'>show</button></p>
 <div id='x9c36b5a0' style='display:none;' class='imgcontainer'>
 <div style="max-width:422px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 422.381 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L93,32A15 15 0 0 0 108 17A15 15 0 0 0 93 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FILTER</text>
<polygon points="131,17 119,21 119,12" style="fill:rgb(0,0,0)"/>
<path d="M108,17L125,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,32L146,32A15 15 0 0 0 161 17A15 15 0 0 0 146 2L146,2A15 15 0 0 0 131 17A15 15 0 0 0 146 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="184,17 173,21 173,12" style="fill:rgb(0,0,0)"/>
<path d="M161,17L178,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M199,32L249,32A15 15 0 0 0 264 17A15 15 0 0 0 249 2L199,2A15 15 0 0 0 184 17A15 15 0 0 0 199 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="224" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="287,17 275,21 275,12" style="fill:rgb(0,0,0)"/>
<path d="M264,17L281,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,32L336,32L336,2L287,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M336,17L353,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,32A15 15 0 0 0 389 17A15 15 0 0 0 374 2A15 15 0 0 0 359 17A15 15 0 0 0 374 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="374" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="413,17 401,21 401,12" style="fill:rgb(0,0,0)"/>
<path d="M389,17L407,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="416" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/function-arguments.html">function-arguments:</a></b>
<button id='xbe366e33' onclick='hideorshow("xbe366e33","xe78c6bbc")'>show</button></p>
 <div id='xe78c6bbc' style='display:none;' class='imgcontainer'>
 <div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.566 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,26 55,30 55,22" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,41 L 43,41 Q 43,26 52,26 L 61,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M82,41L150,41A15 15 0 0 0 165 26L165,26A15 15 0 0 0 150 11L82,11A15 15 0 0 0 66 26L66,26A15 15 0 0 0 82 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="183,26 171,30 171,22" style="fill:rgb(0,0,0)"/>
<path d="M165,26L177,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M183,26 L 189,26 Q 194,26 194,41 L 194,41 Q 194,56 203,56 L 212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M218,56L248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,71L303,71L303,41L254,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="447,56 435,60 435,52" style="fill:rgb(0,0,0)"/>
<path d="M303,56L441,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="116,56 104,60 104,52" style="fill:rgb(0,0,0)"/>
<path d="M32,56L110,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M116,56L212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,32A15 15 0 0 0 293 17A15 15 0 0 0 278 2A15 15 0 0 0 263 17A15 15 0 0 0 278 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="293,17 305,12 305,21" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 314,56 Q 326,56 326,41 L 326,32 Q 326,17 312,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M263,17 L 245,17 Q 230,17 230,32 L 230,41 Q 230,56 239,56 L 248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,207A15 15 0 0 0 243 192L243,192A15 15 0 0 0 228 177A15 15 0 0 0 213 192L213,192A15 15 0 0 0 228 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="213,192 201,196 201,188" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,71 L 43,177 Q 43,192 58,192 L 192,192 L 207,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,192 267,196 267,188" style="fill:rgb(0,0,0)"/>
<path d="M243,192L272,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,192 L 360,192 Q 375,192 390,192 L 394,192 Q 409,192 409,177 L 409,71 Q 409,56 415,56 L 421,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="228,216 216,221 216,212" style="fill:rgb(0,0,0)"/>
<path d="M116,192 L 181,192 Q 196,192 196,204 Q 196,216 209,216 L 222,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,216 L 242,216 Q 257,216 257,204 Q 257,192 262,192 L 268,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="90,117 78,121 78,112" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 313,56 Q 323,56 323,71 L 323,71 Q 323,86 308,86 L 81,86 Q 66,86 66,101 L 66,102 Q 66,117 75,117 L 84,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,132L149,132A15 15 0 0 0 164 117L164,117A15 15 0 0 0 149 101L105,101A15 15 0 0 0 90 117L90,117A15 15 0 0 0 105 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="182,117 170,121 170,112" style="fill:rgb(0,0,0)"/>
<path d="M164,117L176,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,132L201,132A15 15 0 0 0 216 117L216,117A15 15 0 0 0 201 101L197,101A15 15 0 0 0 182 117L182,117A15 15 0 0 0 197 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M216,117L239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,132L375,132L375,101L245,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,169A15 15 0 0 0 325 154A15 15 0 0 0 310 139A15 15 0 0 0 294 154A15 15 0 0 0 310 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,154 336,150 336,159" style="fill:rgb(0,0,0)"/>
<path d="M375,117 L 380,117 Q 386,117 386,132 L 386,139 Q 386,154 371,154 L 345,154 L 330,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M294,154 L 260,154 Q 245,154 236,154 Q 227,154 227,139 L 227,132 Q 227,117 233,117 L 239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M375,117 L 383,117 Q 392,117 392,102 L 392,71 Q 392,56 407,56 L 413,56 L 428,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/literal-value.html">literal-value:</a></b>
<button id='x6326831a' onclick='hideorshow("x6326831a","xc879f1dc")'>show</button></p>
 <div id='xc879f1dc' style='display:none;' class='imgcontainer'>
 <div style="max-width:341px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 341.376 336.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,319 39,324 39,315" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,304 Q 24,319 34,319 L 45,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,334L252,334A15 15 0 0 0 267 319A15 15 0 0 0 252 304L65,304A15 15 0 0 0 50 319A15 15 0 0 0 65 334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIMESTAMP</text>
<polygon points="290,319 278,324 278,315" style="fill:rgb(0,0,0)"/>
<path d="M267,319L284,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,17 320,21 320,12" style="fill:rgb(0,0,0)"/>
<path d="M290,319 L 297,319 Q 305,319 305,304 L 305,32 Q 305,17 315,17 L 326,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="335" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L172,32A15 15 0 0 0 187 17A15 15 0 0 0 172 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="119" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,17L320,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L153,70A15 15 0 0 0 168 55L168,55A15 15 0 0 0 153 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">string-literal</text>
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,47 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,55 278,59 278,50" style="fill:rgb(0,0,0)"/>
<path d="M168,55L284,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,55 L 297,55 Q 305,55 305,47 L 305,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L140,108A15 15 0 0 0 155 92A15 15 0 0 0 140 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">blob-literal</text>
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,85 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,92 278,97 278,88" style="fill:rgb(0,0,0)"/>
<path d="M155,92L284,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,92 L 297,92 Q 305,92 305,85 L 305,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,145L97,145A15 15 0 0 0 112 130A15 15 0 0 0 97 115L66,115A15 15 0 0 0 50 130A15 15 0 0 0 66 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="50,130 39,135 39,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 34,130 L 45,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,130 278,135 278,126" style="fill:rgb(0,0,0)"/>
<path d="M112,130L284,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,130 L 297,130 Q 305,130 305,123 L 305,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,183L96,183A15 15 0 0 0 111 168A15 15 0 0 0 96 153L66,153A15 15 0 0 0 50 168A15 15 0 0 0 66 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRUE</text>
<polygon points="50,168 39,172 39,164" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,160 Q 24,168 34,168 L 45,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,168 278,172 278,164" style="fill:rgb(0,0,0)"/>
<path d="M111,168L284,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,168 L 297,168 Q 305,168 305,160 L 305,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,221L104,221A15 15 0 0 0 119 206A15 15 0 0 0 104 191L66,191A15 15 0 0 0 50 206A15 15 0 0 0 66 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FALSE</text>
<polygon points="50,206 39,210 39,201" style="fill:rgb(0,0,0)"/>
<path d="M24,191 L 24,198 Q 24,206 34,206 L 45,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,206 278,210 278,201" style="fill:rgb(0,0,0)"/>
<path d="M119,206L284,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,206 L 297,206 Q 305,206 305,198 L 305,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,259L190,259A15 15 0 0 0 205 244A15 15 0 0 0 190 228L66,228A15 15 0 0 0 50 244A15 15 0 0 0 66 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="128" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIME</text>
<polygon points="50,244 39,248 39,239" style="fill:rgb(0,0,0)"/>
<path d="M24,228 L 24,236 Q 24,244 34,244 L 45,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,244 278,248 278,239" style="fill:rgb(0,0,0)"/>
<path d="M205,244L284,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,244 L 297,244 Q 305,244 305,236 L 305,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,297L192,297A15 15 0 0 0 207 281A15 15 0 0 0 192 266L66,266A15 15 0 0 0 50 281A15 15 0 0 0 66 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_DATE</text>
<polygon points="50,281 39,286 39,277" style="fill:rgb(0,0,0)"/>
<path d="M24,266 L 24,274 Q 24,281 34,281 L 45,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,281 278,286 278,277" style="fill:rgb(0,0,0)"/>
<path d="M207,281L284,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,281 L 297,281 Q 305,281 305,274 L 305,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/over-clause.html">over-clause:</a></b>
<button id='xa55dda29' onclick='hideorshow("xa55dda29","x63140d1f")'>show</button></p>
 <div id='x63140d1f' style='display:none;' class='imgcontainer'>
 <div style="max-width:600px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 600.706 418.392">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="129,17 117,21 117,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L123,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M144,32L241,32A15 15 0 0 0 256 17A15 15 0 0 0 241 2L144,2A15 15 0 0 0 129 17A15 15 0 0 0 144 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,17 L 100,17 Q 108,17 108,32 L 108,40 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,70A15 15 0 0 0 165 55L165,55A15 15 0 0 0 149 39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 149 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="149" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="206,82 195,86 195,77" style="fill:rgb(0,0,0)"/>
<path d="M165,55 L 172,55 Q 180,55 180,68 Q 180,82 190,82 L 200,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,97L363,97A15 15 0 0 0 378 82A15 15 0 0 0 363 67L221,67A15 15 0 0 0 206 82A15 15 0 0 0 221 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="292" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M221,173L301,173A15 15 0 0 0 316 157A15 15 0 0 0 301 142L221,142A15 15 0 0 0 206 157A15 15 0 0 0 221 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="339,157 328,162 328,153" style="fill:rgb(0,0,0)"/>
<path d="M316,157L333,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,173L358,173A15 15 0 0 0 373 157A15 15 0 0 0 358 142L354,142A15 15 0 0 0 339 157A15 15 0 0 0 354 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="409,157 398,162 398,153" style="fill:rgb(0,0,0)"/>
<path d="M373,157L404,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,173L459,173L459,142L409,142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M434,210A15 15 0 0 0 449 195A15 15 0 0 0 434 180A15 15 0 0 0 419 195A15 15 0 0 0 434 210Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="195" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="449,195 461,191 461,200" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,180 Q 474,195 464,195 L 455,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,195 L 398,195 Q 383,195 383,180 L 383,172 Q 383,157 390,157 L 398,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,55 280,59 280,50" style="fill:rgb(0,0,0)"/>
<path d="M165,55L286,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,120 304,115 304,124" style="fill:rgb(0,0,0)"/>
<path d="M292,55 L 401,55 Q 416,55 416,70 L 416,105 Q 416,120 401,120 L 313,120 L 298,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,157 195,162 195,153" style="fill:rgb(0,0,0)"/>
<path d="M292,120 L 180,120 Q 165,120 165,135 L 165,142 Q 165,157 180,157 L 185,157 L 200,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="401,82 389,86 389,77" style="fill:rgb(0,0,0)"/>
<path d="M378,82L395,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,82 L 408,82 Q 416,82 416,89 L 416,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,286L266,286A15 15 0 0 0 281 271A15 15 0 0 0 266 256L221,256A15 15 0 0 0 206 271A15 15 0 0 0 221 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="244" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="304,271 292,275 292,266" style="fill:rgb(0,0,0)"/>
<path d="M281,271L298,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M319,286L323,286A15 15 0 0 0 338 271A15 15 0 0 0 323 256L319,256A15 15 0 0 0 304 271A15 15 0 0 0 319 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="321" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="374,271 363,275 363,266" style="fill:rgb(0,0,0)"/>
<path d="M338,271L368,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,286L504,286L504,256L374,256Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M439,324A15 15 0 0 0 454 309A15 15 0 0 0 439 293A15 15 0 0 0 424 309A15 15 0 0 0 439 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="454,309 466,304 466,313" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,294 Q 519,309 504,309 L 475,309 L 460,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,309 L 363,309 Q 348,309 348,294 L 348,286 Q 348,271 355,271 L 363,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,233 304,229 304,237" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,218 Q 474,233 459,233 L 313,233 L 298,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,271 195,275 195,266" style="fill:rgb(0,0,0)"/>
<path d="M292,233 L 180,233 Q 165,233 165,248 L 165,256 Q 165,271 180,271 L 185,271 L 200,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,195 160,184 169,184" style="fill:rgb(0,0,0)"/>
<path d="M165,142L165,189"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,195L165,256"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,399L311,399L311,369L206,369Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="384" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="519,384 508,389 508,380" style="fill:rgb(0,0,0)"/>
<path d="M311,384L513,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M534,399A15 15 0 0 0 549 384A15 15 0 0 0 534 369A15 15 0 0 0 519 384A15 15 0 0 0 534 399Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="384" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="591,17 579,21 579,12" style="fill:rgb(0,0,0)"/>
<path d="M549,384 L 557,384 Q 564,384 564,369 L 564,32 Q 564,17 575,17 L 585,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="594" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,17 508,21 508,12" style="fill:rgb(0,0,0)"/>
<path d="M256,17L513,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,17L579,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,346 304,342 304,351" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,331 Q 519,346 504,346 L 313,346 L 298,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,384 195,389 195,380" style="fill:rgb(0,0,0)"/>
<path d="M292,346 L 180,346 Q 165,346 165,361 L 165,369 Q 165,384 180,384 L 185,384 L 200,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,309 160,297 169,297" style="fill:rgb(0,0,0)"/>
<path d="M165,256L165,303"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,309L165,369"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="258,411 247,416 247,407" style="fill:rgb(0,0,0)"/>
<path d="M165,369 L 165,396 Q 165,411 180,411 L 238,411 L 253,411"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,384 369,389 369,380" style="fill:rgb(0,0,0)"/>
<path d="M258,411 L 335,411 Q 350,411 350,398 Q 350,384 362,384 L 375,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x10632681' onclick='hideorshow("x10632681","x0a5b48ab")'>show</button></p>
 <div id='x0a5b48ab' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/raise-function.html">raise-function:</a></b>
<button id='xa2f6faa2' onclick='hideorshow("xa2f6faa2","x5d3179e8")'>show</button></p>
 <div id='x5d3179e8' style='display:none;' class='imgcontainer'>
 <div style="max-width:627px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 627.302 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L82,32A15 15 0 0 0 97 17A15 15 0 0 0 82 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RAISE</text>
<polygon points="120,17 109,21 109,12" style="fill:rgb(0,0,0)"/>
<path d="M97,17L114,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,32L135,32A15 15 0 0 0 150 17A15 15 0 0 0 135 2L135,2A15 15 0 0 0 120 17A15 15 0 0 0 135 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="135" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="192,55 180,59 180,50" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 158,17 Q 165,17 165,32 L 165,40 Q 165,55 176,55 L 186,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,70L285,70A15 15 0 0 0 300 55L300,55A15 15 0 0 0 285 39L207,39A15 15 0 0 0 192 55L192,55A15 15 0 0 0 207 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="336,55 324,59 324,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70A15 15 0 0 0 366 55L366,55A15 15 0 0 0 351 39A15 15 0 0 0 336 55L336,55A15 15 0 0 0 351 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="389,55 378,59 378,50" style="fill:rgb(0,0,0)"/>
<path d="M366,55L383,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,70L508,70A15 15 0 0 0 523 55L523,55A15 15 0 0 0 508 39L404,39A15 15 0 0 0 389 55L389,55A15 15 0 0 0 404 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="456" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">error-message</text>
<polygon points="564,17 553,21 553,12" style="fill:rgb(0,0,0)"/>
<path d="M523,55 L 530,55 Q 538,55 538,40 L 538,32 Q 538,17 548,17 L 558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M579,32A15 15 0 0 0 594 17A15 15 0 0 0 579 2A15 15 0 0 0 564 17A15 15 0 0 0 579 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="617,17 606,21 606,12" style="fill:rgb(0,0,0)"/>
<path d="M594,17L612,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="621" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L259,32A15 15 0 0 0 274 17A15 15 0 0 0 259 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="456,17 444,21 444,12" style="fill:rgb(0,0,0)"/>
<path d="M274,17L450,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,17L553,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,108L249,108A15 15 0 0 0 264 92A15 15 0 0 0 249 77L207,77A15 15 0 0 0 192 92A15 15 0 0 0 207 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="300,92 288,97 288,88" style="fill:rgb(0,0,0)"/>
<path d="M264,92L294,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,92 L 307,92 Q 315,92 315,77 L 315,70 Q 315,55 322,55 L 330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,145L229,145A15 15 0 0 0 244 130A15 15 0 0 0 229 115L207,115A15 15 0 0 0 192 130A15 15 0 0 0 207 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="300,130 288,135 288,126" style="fill:rgb(0,0,0)"/>
<path d="M244,130L294,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,130 L 307,130 Q 315,130 315,115 L 315,92 L 315,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,130 180,135 180,126" style="fill:rgb(0,0,0)"/>
<path d="M165,39 L 165,115 Q 165,130 176,130 L 186,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,92 180,97 180,88" style="fill:rgb(0,0,0)"/>
<path d="M165,77 L 165,85 Q 165,92 176,92 L 186,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/type-name.html">type-name:</a></b>
<button id='x797a8505' onclick='hideorshow("x797a8505","xc7b0f38e")'>show</button></p>
 <div id='xc7b0f38e' style='display:none;' class='imgcontainer'>
 <div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.008 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L87,32A15 15 0 0 0 102 17A15 15 0 0 0 87 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="165,92 153,97 153,88" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,77 Q 138,92 149,92 L 159,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,108A15 15 0 0 0 195 92A15 15 0 0 0 180 77A15 15 0 0 0 165 92A15 15 0 0 0 180 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,92 201,97 201,88" style="fill:rgb(0,0,0)"/>
<path d="M195,92L207,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,108L350,108L350,77L212,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,92 356,97 356,88" style="fill:rgb(0,0,0)"/>
<path d="M350,92L362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,108A15 15 0 0 0 398 92A15 15 0 0 0 382 77A15 15 0 0 0 367 92A15 15 0 0 0 382 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="415,92 403,97 403,88" style="fill:rgb(0,0,0)"/>
<path d="M398,92L409,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,108L553,108L553,77L415,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="570,92 558,97 558,88" style="fill:rgb(0,0,0)"/>
<path d="M553,92L564,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,108A15 15 0 0 0 600 92A15 15 0 0 0 585 77A15 15 0 0 0 570 92A15 15 0 0 0 585 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="585" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="651,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M600,92 L 608,92 Q 615,92 615,77 L 615,32 Q 615,17 630,17 L 630,17 L 645,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,40 Q 138,55 149,55 L 159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70A15 15 0 0 0 195 55L195,55A15 15 0 0 0 180 39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,55 201,59 201,50" style="fill:rgb(0,0,0)"/>
<path d="M195,55L207,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,70L350,70L350,39L212,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,55 356,59 356,50" style="fill:rgb(0,0,0)"/>
<path d="M350,55L362,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,70A15 15 0 0 0 398 55L398,55A15 15 0 0 0 382 39A15 15 0 0 0 367 55L367,55A15 15 0 0 0 382 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="600,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M398,55L594,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M600,55 L 608,55 Q 615,55 615,47 L 615,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="74,47 85,43 85,51" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 110,17 Q 117,17 117,32 L 117,32 Q 117,47 102,47 L 94,47 L 79,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47 L 33,47 Q 18,47 18,32 L 18,32 Q 18,17 26,17 L 33,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="382,17 371,21 371,12" style="fill:rgb(0,0,0)"/>
<path d="M102,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,17L630,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='xf04096c0' onclick='hideorshow("xf04096c0","x5f98e9f4")'>show</button></p>
 <div id='x5f98e9f4' style='display:none;' class='imgcontainer'>
 <div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
<p><b><a href="syntax/join-clause.html">join-clause:</a></b>
<button id='xcb0dea2c' onclick='hideorshow("xcb0dea2c","x8e24fd41")'>show</button></p>
 <div id='x8e24fd41' style='display:none;' class='imgcontainer'>
 <div style="max-width:793px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 793.282 84.24">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L193,32L193,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="259,47 247,51 247,43" style="fill:rgb(0,0,0)"/>
<path d="M193,17 L 200,17 Q 208,17 208,32 L 208,32 Q 208,47 223,47 L 238,47 L 253,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,62L380,62L380,32L259,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-operator</text>
<polygon points="403,47 391,51 391,43" style="fill:rgb(0,0,0)"/>
<path d="M380,47L397,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,62L564,62L564,32L403,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="587,47 575,51 575,43" style="fill:rgb(0,0,0)"/>
<path d="M564,47L581,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M587,62L721,62L721,32L587,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="654" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-constraint</text>
<polygon points="783,17 772,21 772,12" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 742,47 Q 757,47 757,32 L 757,32 Q 757,17 767,17 L 778,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="787" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M193,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,17L776,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,77 495,73 495,82" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 728,47 Q 736,47 736,62 L 736,62 Q 736,77 721,77 L 504,77 L 489,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,77 L 247,77 Q 232,77 232,62 L 232,62 Q 232,47 246,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/join-constraint.html">join-constraint:</a></b>
<button id='xf465d600' onclick='hideorshow("xf465d600","xd038cce3")'>show</button></p>
 <div id='xd038cce3' style='display:none;' class='imgcontainer'>
 <div style="max-width:483px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 483.336 126.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L104,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 104 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="143,55 131,59 131,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L137,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,70A15 15 0 0 0 173 55L173,55A15 15 0 0 0 158 39A15 15 0 0 0 143 55L143,55A15 15 0 0 0 158 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="209,55 197,59 197,50" style="fill:rgb(0,0,0)"/>
<path d="M173,55L203,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M224,70L318,70A15 15 0 0 0 333 55L333,55A15 15 0 0 0 318 39L224,39A15 15 0 0 0 209 55L209,55A15 15 0 0 0 224 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="369,55 358,59 358,50" style="fill:rgb(0,0,0)"/>
<path d="M333,55L363,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,70A15 15 0 0 0 399 55L399,55A15 15 0 0 0 384 39A15 15 0 0 0 369 55L369,55A15 15 0 0 0 384 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="422,55 411,59 411,50" style="fill:rgb(0,0,0)"/>
<path d="M399,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="473,17 462,21 462,12" style="fill:rgb(0,0,0)"/>
<path d="M422,55 L 430,55 Q 437,55 437,40 L 437,32 Q 437,17 452,17 L 453,17 L 468,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="477" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,108A15 15 0 0 0 286 92A15 15 0 0 0 271 77A15 15 0 0 0 256 92A15 15 0 0 0 271 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="286,92 298,88 298,97" style="fill:rgb(0,0,0)"/>
<path d="M333,55 L 341,55 Q 348,55 348,70 L 348,77 Q 348,92 333,92 L 307,92 L 292,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,92 L 197,92 Q 182,92 182,77 L 182,70 Q 182,55 190,55 L 197,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L74,32A15 15 0 0 0 90 17A15 15 0 0 0 74 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="113,17 101,21 101,12" style="fill:rgb(0,0,0)"/>
<path d="M90,17L107,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M113,32L162,32L162,2L113,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="422,17 411,21 411,12" style="fill:rgb(0,0,0)"/>
<path d="M162,17L417,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,17L462,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="209,120 197,124 197,115" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,105 Q 24,120 39,120 L 188,120 L 203,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,120 L 422,120 Q 437,120 437,105 L 437,54 L 437,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/join-operator.html">join-operator:</a></b>
<button id='x364a7c21' onclick='hideorshow("x364a7c21","xf529ad43")'>show</button></p>
 <div id='xf529ad43' style='display:none;' class='imgcontainer'>
 <div style="max-width:620px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 620.333 255.312">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,71 39,76 39,67" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,56 Q 24,71 34,71 L 45,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,86L133,86A15 15 0 0 0 148 71A15 15 0 0 0 133 56L66,56A15 15 0 0 0 50 71A15 15 0 0 0 66 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="99" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NATURAL</text>
<polygon points="189,41 178,45 178,37" style="fill:rgb(0,0,0)"/>
<path d="M148,71 L 155,71 Q 163,71 163,56 L 163,56 Q 163,41 173,41 L 184,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,71 219,76 219,67" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,56 Q 204,71 215,71 L 225,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,86L273,86A15 15 0 0 0 288 71A15 15 0 0 0 273 56L246,56A15 15 0 0 0 231 71A15 15 0 0 0 246 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LEFT</text>
<polygon points="378,71 366,76 366,67" style="fill:rgb(0,0,0)"/>
<path d="M288,71L372,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,86L437,86A15 15 0 0 0 452 71A15 15 0 0 0 437 56L393,56A15 15 0 0 0 378 71A15 15 0 0 0 393 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OUTER</text>
<polygon points="475,71 463,76 463,67" style="fill:rgb(0,0,0)"/>
<path d="M452,71L469,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="516,41 505,45 505,37" style="fill:rgb(0,0,0)"/>
<path d="M475,71 L 482,71 Q 490,71 490,56 L 490,56 Q 490,41 500,41 L 511,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,56L554,56A15 15 0 0 0 569 41A15 15 0 0 0 554 26L532,26A15 15 0 0 0 516 41A15 15 0 0 0 532 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="543" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">JOIN</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M569,41 L 576,41 Q 584,41 584,29 Q 584,17 594,17 L 605,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="614" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,32A15 15 0 0 0 325 17A15 15 0 0 0 310 2A15 15 0 0 0 295 17A15 15 0 0 0 310 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="295,17 283,21 283,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L289,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M325,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="99,41 88,45 88,37" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,29 Q 24,41 39,41 L 78,41 L 93,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M99,41L178,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,41L505,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,41 366,45 366,37" style="fill:rgb(0,0,0)"/>
<path d="M336,71 L 344,71 Q 351,71 351,56 L 351,56 Q 351,41 362,41 L 372,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,109 219,113 219,105" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,94 Q 204,109 215,109 L 225,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,124L284,124A15 15 0 0 0 299 109A15 15 0 0 0 284 94L246,94A15 15 0 0 0 231 109A15 15 0 0 0 246 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RIGHT</text>
<polygon points="341,71 329,76 329,67" style="fill:rgb(0,0,0)"/>
<path d="M299,109 L 307,109 Q 314,109 314,94 L 314,86 Q 314,71 324,71 L 335,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,147 219,151 219,142" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,132 Q 204,147 215,147 L 225,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,162L274,162A15 15 0 0 0 289 147A15 15 0 0 0 274 132L246,132A15 15 0 0 0 231 147A15 15 0 0 0 246 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FULL</text>
<path d="M289,147 L 302,147 Q 314,147 314,132 L 314,109 L 314,94"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,192 219,196 219,188" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,177 Q 204,192 215,192 L 225,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,207L287,207A15 15 0 0 0 302 192A15 15 0 0 0 287 177L246,177A15 15 0 0 0 231 192A15 15 0 0 0 246 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="192" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INNER</text>
<polygon points="475,192 463,196 463,188" style="fill:rgb(0,0,0)"/>
<path d="M302,192L469,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,192 L 482,192 Q 490,192 490,185 L 490,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,238 219,242 219,233" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,223 Q 24,238 39,238 L 210,238 L 225,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,253L287,253A15 15 0 0 0 303 238A15 15 0 0 0 287 222L246,222A15 15 0 0 0 231 238A15 15 0 0 0 246 253Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="238" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CROSS</text>
<polygon points="475,238 463,242 463,233" style="fill:rgb(0,0,0)"/>
<path d="M303,238L469,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,238 L 482,238 Q 490,238 490,223 L 490,71 L 490,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
<p><b><a href="syntax/ordering-term.html">ordering-term:</a></b>
<button id='x0d8f437c' onclick='hideorshow("x0d8f437c","x5ad103ef")'>show</button></p>
 <div id='x5ad103ef' style='display:none;' class='imgcontainer'>
 <div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/result-column.html">result-column:</a></b>
<button id='x00cac19f' onclick='hideorshow("x00cac19f","x8da960a7")'>show</button></p>
 <div id='x8da960a7' style='display:none;' class='imgcontainer'>
 <div style="max-width:398px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 398.054 163.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L94,32L94,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="136,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M94,17 L 102,17 Q 109,17 109,32 L 109,40 Q 109,55 119,55 L 130,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M151,70L155,70A15 15 0 0 0 170 55L170,55A15 15 0 0 0 155 39L151,39A15 15 0 0 0 136 55L136,55A15 15 0 0 0 151 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="206,55 194,59 194,50" style="fill:rgb(0,0,0)"/>
<path d="M170,55L200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,70L309,70A15 15 0 0 0 324 55L324,55A15 15 0 0 0 309 39L221,39A15 15 0 0 0 206 55L206,55A15 15 0 0 0 221 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="347,55 335,59 335,50" style="fill:rgb(0,0,0)"/>
<path d="M324,55L341,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,17 377,21 377,12" style="fill:rgb(0,0,0)"/>
<path d="M347,55 L 354,55 Q 362,55 362,40 L 362,32 Q 362,17 372,17 L 382,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="392" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,85 141,89 141,81" style="fill:rgb(0,0,0)"/>
<path d="M109,39 L 109,70 Q 109,85 124,85 L 132,85 L 147,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,85 L 170,85 Q 185,85 185,70 L 185,70 Q 185,55 192,55 L 200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="241,17 230,21 230,12" style="fill:rgb(0,0,0)"/>
<path d="M94,17L235,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M241,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,108 39,112 39,103" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,93 Q 24,108 34,108 L 45,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,123A15 15 0 0 0 81 108A15 15 0 0 0 66 92A15 15 0 0 0 50 108A15 15 0 0 0 66 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="108" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,108 335,112 335,103" style="fill:rgb(0,0,0)"/>
<path d="M81,108L341,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,108 L 354,108 Q 362,108 362,93 L 362,54 L 362,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,145 39,150 39,141" style="fill:rgb(0,0,0)"/>
<path d="M24,92 L 24,130 Q 24,145 34,145 L 45,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,160L141,160A15 15 0 0 0 156 145A15 15 0 0 0 141 130L66,130A15 15 0 0 0 50 145A15 15 0 0 0 66 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="145" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="179,145 167,150 167,141" style="fill:rgb(0,0,0)"/>
<path d="M156,145L173,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M194,160A15 15 0 0 0 209 145A15 15 0 0 0 194 130A15 15 0 0 0 179 145A15 15 0 0 0 194 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="232,145 221,150 221,141" style="fill:rgb(0,0,0)"/>
<path d="M209,145L226,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,160A15 15 0 0 0 262 145A15 15 0 0 0 247 130A15 15 0 0 0 232 145A15 15 0 0 0 247 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,145 335,150 335,141" style="fill:rgb(0,0,0)"/>
<path d="M262,145L341,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,145 L 354,145 Q 362,145 362,130 L 362,107 L 362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/table-or-subquery.html">table-or-subquery:</a></b>
<button id='xf041a974' onclick='hideorshow("xf041a974","xe80648f5")'>show</button></p>
 <div id='xe80648f5' style='display:none;' class='imgcontainer'>
 <div style="max-width:720px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 720.778 457.704">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,74 39,78 39,70" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,59 Q 24,74 34,74 L 45,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,89L162,89A15 15 0 0 0 177 74L177,74A15 15 0 0 0 162 59L66,59A15 15 0 0 0 50 74L50,74A15 15 0 0 0 66 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="194,74 183,78 183,70" style="fill:rgb(0,0,0)"/>
<path d="M177,74L189,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,89A15 15 0 0 0 225 74L225,74A15 15 0 0 0 209 59A15 15 0 0 0 194 74L194,74A15 15 0 0 0 209 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="266,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M225,74 L 232,74 Q 240,74 240,59 L 240,51 Q 240,36 250,36 L 260,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,51L356,51A15 15 0 0 0 371 36A15 15 0 0 0 356 21L281,21A15 15 0 0 0 266 36A15 15 0 0 0 281 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="407,36 396,41 396,32" style="fill:rgb(0,0,0)"/>
<path d="M371,36L402,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,51L427,51A15 15 0 0 0 442 36A15 15 0 0 0 427 21L423,21A15 15 0 0 0 407 36A15 15 0 0 0 423 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="478,36 466,41 466,32" style="fill:rgb(0,0,0)"/>
<path d="M442,36L472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,51L561,51A15 15 0 0 0 577 36A15 15 0 0 0 561 21L493,21A15 15 0 0 0 478 36A15 15 0 0 0 493 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="527" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<path d="M9,36L255,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="422,6 411,10 411,2" style="fill:rgb(0,0,0)"/>
<path d="M371,36 L 379,36 Q 386,36 386,21 L 386,21 Q 386,6 401,6 L 402,6 L 417,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 442,6 Q 457,6 457,21 L 457,21 Q 457,36 464,36 L 472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 577,6 Q 592,6 592,21 L 592,21 Q 592,36 599,36 L 607,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,127L388,127A15 15 0 0 0 403 112A15 15 0 0 0 388 97L323,97A15 15 0 0 0 308 112A15 15 0 0 0 323 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="426,112 415,116 415,108" style="fill:rgb(0,0,0)"/>
<path d="M403,112L420,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,127L445,127A15 15 0 0 0 460 112A15 15 0 0 0 445 97L441,97A15 15 0 0 0 426 112A15 15 0 0 0 441 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="443" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="483,112 472,116 472,108" style="fill:rgb(0,0,0)"/>
<path d="M460,112L478,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,127L577,127A15 15 0 0 0 592 112A15 15 0 0 0 577 97L499,97A15 15 0 0 0 483 112A15 15 0 0 0 499 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="538" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M323,165L343,165A15 15 0 0 0 359 150A15 15 0 0 0 343 135L323,135A15 15 0 0 0 308 150A15 15 0 0 0 323 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="382,150 370,154 370,145" style="fill:rgb(0,0,0)"/>
<path d="M359,150L376,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,165L461,165A15 15 0 0 0 476 150A15 15 0 0 0 461 135L397,135A15 15 0 0 0 382 150A15 15 0 0 0 397 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="527,74 539,70 539,78" style="fill:rgb(0,0,0)"/>
<path d="M577,36 L 607,36 Q 622,36 622,51 L 622,59 Q 622,74 607,74 L 548,74 L 533,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,150 297,154 297,145" style="fill:rgb(0,0,0)"/>
<path d="M527,74 L 297,74 Q 282,74 282,89 L 282,135 Q 282,150 292,150 L 302,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,112 297,116 297,108" style="fill:rgb(0,0,0)"/>
<path d="M282,97 L 282,104 Q 282,112 292,112 L 302,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="266,213 255,217 255,209" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,198 Q 24,213 39,213 L 245,213 L 260,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,228L431,228A15 15 0 0 0 446 213A15 15 0 0 0 431 198L281,198A15 15 0 0 0 266 213A15 15 0 0 0 281 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function-name</text>
<polygon points="463,213 452,217 452,209" style="fill:rgb(0,0,0)"/>
<path d="M446,213L457,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,228A15 15 0 0 0 493 213A15 15 0 0 0 478 198A15 15 0 0 0 463 213A15 15 0 0 0 478 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="529,213 518,217 518,209" style="fill:rgb(0,0,0)"/>
<path d="M493,213L524,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M529,228L579,228L579,198L529,198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="615,213 603,217 603,209" style="fill:rgb(0,0,0)"/>
<path d="M579,213L609,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M630,228A15 15 0 0 0 645 213A15 15 0 0 0 630 198A15 15 0 0 0 615 213A15 15 0 0 0 630 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="630" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="675,187 679,198 671,198" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 660,213 Q 675,213 675,203 L 675,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M554,190A15 15 0 0 0 569 175A15 15 0 0 0 554 160A15 15 0 0 0 539 175A15 15 0 0 0 554 190Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="175" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="569,175 581,171 581,180" style="fill:rgb(0,0,0)"/>
<path d="M579,213 L 586,213 Q 594,213 594,198 L 594,190 Q 594,175 584,175 L 575,175"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,175 L 518,175 Q 503,175 503,190 L 503,198 Q 503,213 510,213 L 518,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,74 L 232,74 Q 240,74 240,89 L 240,198 Q 240,213 247,213 L 255,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,112 648,116 648,108" style="fill:rgb(0,0,0)"/>
<path d="M592,112L654,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,112 L 667,112 Q 675,112 675,104 L 675,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,150 648,154 648,145" style="fill:rgb(0,0,0)"/>
<path d="M476,150L654,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,150 L 667,150 Q 675,150 675,142 L 675,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M577,36L690,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,304L411,304A15 15 0 0 0 426 289A15 15 0 0 0 411 274L407,274A15 15 0 0 0 392 289A15 15 0 0 0 407 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="498,289 487,293 487,284" style="fill:rgb(0,0,0)"/>
<path d="M426,289L492,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M513,304L582,304A15 15 0 0 0 597 289A15 15 0 0 0 582 274L513,274A15 15 0 0 0 498 289A15 15 0 0 0 513 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="548" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<polygon points="660,289 648,293 648,284" style="fill:rgb(0,0,0)"/>
<path d="M597,289L654,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,289 L 667,289 Q 675,289 675,281 L 675,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="548,251 559,247 559,255" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 652,213 Q 660,213 660,228 L 660,236 Q 660,251 645,251 L 568,251 L 553,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M548,251 L 370,251 Q 355,251 355,266 L 355,274 Q 355,289 370,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,251 L 464,251 Q 457,251 457,266 L 457,274 Q 457,289 464,289 L 472,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,327 39,331 39,322" style="fill:rgb(0,0,0)"/>
<path d="M24,198 L 24,312 Q 24,327 34,327 L 45,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,342A15 15 0 0 0 81 327A15 15 0 0 0 66 311A15 15 0 0 0 50 327A15 15 0 0 0 66 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,327 92,331 92,322" style="fill:rgb(0,0,0)"/>
<path d="M81,327L98,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,342L208,342L208,311L104,311Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="327" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="231,327 219,331 219,322" style="fill:rgb(0,0,0)"/>
<path d="M208,327L225,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,342A15 15 0 0 0 261 327A15 15 0 0 0 246 311A15 15 0 0 0 231 327A15 15 0 0 0 246 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M261,327 L 269,327 Q 276,327 276,312 L 276,304 Q 276,289 291,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,327 648,331 648,322" style="fill:rgb(0,0,0)"/>
<path d="M261,327L654,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,327 L 667,327 Q 675,327 675,319 L 675,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,327 L 432,327 Q 439,327 439,312 L 439,304 Q 439,289 447,289 L 454,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,364 39,369 39,360" style="fill:rgb(0,0,0)"/>
<path d="M24,311 L 24,349 Q 24,364 34,364 L 45,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,379A15 15 0 0 0 81 364A15 15 0 0 0 65 349A15 15 0 0 0 50 364A15 15 0 0 0 65 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="135,364 123,369 123,360" style="fill:rgb(0,0,0)"/>
<path d="M81,364L129,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,379L296,379L296,349L135,349Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="364" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="350,364 338,369 338,360" style="fill:rgb(0,0,0)"/>
<path d="M296,364L344,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,379A15 15 0 0 0 380 364A15 15 0 0 0 365 349A15 15 0 0 0 350 364A15 15 0 0 0 365 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="660,364 648,369 648,360" style="fill:rgb(0,0,0)"/>
<path d="M380,364L654,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="711,36 699,41 699,32" style="fill:rgb(0,0,0)"/>
<path d="M660,364 L 667,364 Q 675,364 675,349 L 675,51 Q 675,36 690,36 L 690,36 L 705,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="715" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,417A15 15 0 0 0 230 402A15 15 0 0 0 215 387A15 15 0 0 0 200 402A15 15 0 0 0 215 417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="402" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="230,402 242,398 242,406" style="fill:rgb(0,0,0)"/>
<path d="M296,364 L 303,364 Q 311,364 311,379 L 311,387 Q 311,402 296,402 L 251,402 L 236,402"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,402 L 123,402 Q 108,402 108,387 L 108,379 Q 108,364 116,364 L 123,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="122,440 111,444 111,436" style="fill:rgb(0,0,0)"/>
<path d="M81,364 L 88,364 Q 96,364 96,379 L 96,425 Q 96,440 106,440 L 116,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M122,455L224,455L224,425L122,425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M224,440 L 308,440 Q 323,440 323,425 L 323,379 Q 323,364 331,364 L 338,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
<p><b><a href="syntax/window-defn.html">window-defn:</a></b>
<button id='x08a01637' onclick='hideorshow("x08a01637","xc2ef81fc")'>show</button></p>
 <div id='xc2ef81fc' style='display:none;' class='imgcontainer'>
 <div style="max-width:479px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 479.765 380.592">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,44 92,48 92,40" style="fill:rgb(0,0,0)"/>
<path d="M62,17 L 70,17 Q 77,17 77,30 Q 77,44 88,44 L 98,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,59L260,59A15 15 0 0 0 275 44L275,44A15 15 0 0 0 260 29L119,29A15 15 0 0 0 104 44L104,44A15 15 0 0 0 119 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M119,135L198,135A15 15 0 0 0 214 120A15 15 0 0 0 198 104L119,104A15 15 0 0 0 104 120A15 15 0 0 0 119 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="237,120 225,124 225,115" style="fill:rgb(0,0,0)"/>
<path d="M214,120L231,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M252,135L256,135A15 15 0 0 0 271 120A15 15 0 0 0 256 104L252,104A15 15 0 0 0 237 120A15 15 0 0 0 252 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="307,120 295,124 295,115" style="fill:rgb(0,0,0)"/>
<path d="M271,120L301,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,135L356,135L356,104L307,104Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M332,173A15 15 0 0 0 347 157A15 15 0 0 0 332 142A15 15 0 0 0 316 157A15 15 0 0 0 332 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="157" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="347,157 358,153 358,162" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,142 Q 371,157 362,157 L 352,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,157 L 295,157 Q 280,157 280,142 L 280,135 Q 280,120 288,120 L 295,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,17 178,21 178,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L184,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,82 201,77 201,86" style="fill:rgb(0,0,0)"/>
<path d="M190,17 L 298,17 Q 313,17 313,32 L 313,67 Q 313,82 298,82 L 210,82 L 195,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,120 92,124 92,115" style="fill:rgb(0,0,0)"/>
<path d="M190,82 L 77,82 Q 62,82 62,97 L 62,105 Q 62,120 77,120 L 83,120 L 98,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,44 287,48 287,40" style="fill:rgb(0,0,0)"/>
<path d="M275,44L293,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,44 L 306,44 Q 313,44 313,51 L 313,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,248L163,248A15 15 0 0 0 178 233A15 15 0 0 0 163 218L119,218A15 15 0 0 0 104 233A15 15 0 0 0 119 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="201,233 190,237 190,229" style="fill:rgb(0,0,0)"/>
<path d="M178,233L196,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,248L221,248A15 15 0 0 0 236 233A15 15 0 0 0 221 218L217,218A15 15 0 0 0 201 233A15 15 0 0 0 217 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="272,233 260,237 260,229" style="fill:rgb(0,0,0)"/>
<path d="M236,233L266,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,248L402,248L402,218L272,218Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M337,286A15 15 0 0 0 352 271A15 15 0 0 0 337 256A15 15 0 0 0 322 271A15 15 0 0 0 337 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="352,271 363,266 363,275" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,256 Q 417,271 402,271 L 373,271 L 358,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M322,271 L 260,271 Q 245,271 245,256 L 245,248 Q 245,233 253,233 L 260,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,195 201,191 201,200" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,180 Q 371,195 356,195 L 210,195 L 195,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,233 92,237 92,229" style="fill:rgb(0,0,0)"/>
<path d="M190,195 L 77,195 Q 62,195 62,210 L 62,218 Q 62,233 77,233 L 83,233 L 98,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,157 58,146 66,146" style="fill:rgb(0,0,0)"/>
<path d="M62,104L62,152"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,157L62,218"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,362L208,362L208,331L104,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="417,346 405,351 405,342" style="fill:rgb(0,0,0)"/>
<path d="M208,346L411,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,362A15 15 0 0 0 447 346A15 15 0 0 0 432 331A15 15 0 0 0 417 346A15 15 0 0 0 432 362Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="470,346 458,351 458,342" style="fill:rgb(0,0,0)"/>
<path d="M447,346L464,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="474" cy="346" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,309 201,304 201,313" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,294 Q 417,309 402,309 L 210,309 L 195,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,346 92,351 92,342" style="fill:rgb(0,0,0)"/>
<path d="M190,309 L 77,309 Q 62,309 62,324 L 62,331 Q 62,346 77,346 L 83,346 L 98,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,271 58,259 66,259" style="fill:rgb(0,0,0)"/>
<path d="M62,218L62,265"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,271L62,331"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,374 144,378 144,369" style="fill:rgb(0,0,0)"/>
<path d="M62,331 L 62,359 Q 62,374 77,374 L 135,374 L 150,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,346 266,351 266,342" style="fill:rgb(0,0,0)"/>
<path d="M156,374 L 233,374 Q 248,374 248,360 Q 248,346 260,346 L 272,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/frame-spec.html">frame-spec:</a></b>
<button id='x2919355f' onclick='hideorshow("x2919355f","x38eb6d3f")'>show</button></p>
 <div id='x38eb6d3f' style='display:none;' class='imgcontainer'>
 <div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>
</div>


<p>Common Table Expressions or CTEs act like temporary <a href="lang_createview.html">views</a> that exist
only for the duration of a single SQL statement.  There are two kinds of
common table expressions: "ordinary" and "recursive". Ordinary 
common table expressions are helpful for making
queries easier to understand by factoring
subqueries out of the main SQL statement.
Recursive common table expressions
provide the ability to do hierarchical or
recursive queries of trees and graphs, a capability
that is not otherwise available in the SQL language.

</p><p>All common table expressions (ordinary and recursive) are 
created by prepending a WITH clause in front of a <a href="lang_select.html">SELECT</a>, <a href="lang_insert.html">INSERT</a>, <a href="lang_delete.html">DELETE</a>,
or <a href="lang_update.html">UPDATE</a> statement.  A single WITH clause can specify one or more
common table expressions, some of which are ordinary and some of which
are recursive.

<a name="ordinarycte"></a>

</p><h1 id="ordinary_common_table_expressions"><span>2. </span>Ordinary Common Table Expressions</h1>

<p>An ordinary common table expression works as if it were a <a href="lang_createview.html">view</a> that
exists for the duration of a single statement.  Ordinary common table
expressions are useful for factoring out subqueries and making the overall
SQL statement easier to read and understand.

</p><p>A WITH clause can contain ordinary common table expressions even if
it includes the RECURSIVE keyword.  The use of RECURSIVE does not force
common table expressions to be recursive.

<a name="recursivecte"></a>

</p><h1 id="recursive_common_table_expressions"><span>3. </span>Recursive Common Table Expressions</h1>

<p>A recursive common table expression can be used to write a query that
walks a tree or graph.  A recursive common table expression has the same
basic syntax as an ordinary common table expression, but with the following
additional attributes:

</p><ol>
<li> The "<a href="syntax/select-stmt.html">select-stmt</a>" must be a <a href="lang_select.html#compound">compound select</a>.  That is to say,
     the CTE body must be two or more individual SELECT statements
     separated by compound operators like UNION, UNION ALL, INTERSECT,
     or EXCEPT.
</li><li> One or more of the individual SELECT statements that make up
     the compound must be
     "recursive".  A SELECT statement is recursive if
     its FROM clause contains exactly one reference to
     the CTE table (the table named on the left-hand side of the
     AS clause).
</li><li> One or more of the SELECT statements in the compound must be
     non-recursive.
</li><li> All non-recursive SELECT statements must occur before any
     recursive SELECT statements.
</li><li> The recursive SELECT statements must be separated from the
     non-recursive SELECT statements
     and from each other by the UNION or UNION ALL operators.
     If there are two or more recursive SELECT statements, they all must
     be separated from each other using the same operator that separates
     the first recursive SELECT from the last non-recursive SELECT statement.
</li><li> Recursive SELECT statements may not use
     <a href="lang_aggfunc.html">aggregate functions</a> or <a href="windowfunctions.html">window functions</a>.     
</li></ol>

<p>To put it another way, a recursive common table expression must
look something like the following:

<p><b><a href="syntax/recursive-cte.html">recursive-cte:</a></b>
<button id='x449827b6' onclick='hideorshow("x449827b6","x91789db1")'>hide</button></p>
 <div id='x91789db1' class='imgcontainer'>
 <div style="max-width:874px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 874.291 72.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L169,32L169,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="100" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">cte-table-name</text>
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M169,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L211,32A15 15 0 0 0 226 17A15 15 0 0 0 211 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="249,17 237,21 237,12" style="fill:rgb(0,0,0)"/>
<path d="M226,17L243,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M264,32A15 15 0 0 0 279 17A15 15 0 0 0 264 2A15 15 0 0 0 249 17A15 15 0 0 0 264 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="302,17 291,21 291,12" style="fill:rgb(0,0,0)"/>
<path d="M279,17L296,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,32L403,32A15 15 0 0 0 418 17A15 15 0 0 0 403 2L317,2A15 15 0 0 0 302 17A15 15 0 0 0 317 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">initial-select</text>
<polygon points="459,55 448,59 448,50" style="fill:rgb(0,0,0)"/>
<path d="M418,17 L 425,17 Q 433,17 433,32 L 433,40 Q 433,55 443,55 L 454,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M474,70L518,70A15 15 0 0 0 533 55L533,55A15 15 0 0 0 518 39L474,39A15 15 0 0 0 459 55L459,55A15 15 0 0 0 474 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="496" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<polygon points="556,55 545,59 545,50" style="fill:rgb(0,0,0)"/>
<path d="M533,55L550,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M571,70L586,70A15 15 0 0 0 601 55L601,55A15 15 0 0 0 586 39L571,39A15 15 0 0 0 556 55L556,55A15 15 0 0 0 571 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="643,17 631,21 631,12" style="fill:rgb(0,0,0)"/>
<path d="M601,55 L 609,55 Q 616,55 616,40 L 616,32 Q 616,17 627,17 L 637,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M658,32L773,32A15 15 0 0 0 788 17A15 15 0 0 0 773 2L658,2A15 15 0 0 0 643 17A15 15 0 0 0 658 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="715" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">recursive-select</text>
<polygon points="811,17 800,21 800,12" style="fill:rgb(0,0,0)"/>
<path d="M788,17L805,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M826,32A15 15 0 0 0 841 17A15 15 0 0 0 826 2A15 15 0 0 0 811 17A15 15 0 0 0 826 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="826" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="864,17 853,21 853,12" style="fill:rgb(0,0,0)"/>
<path d="M841,17L859,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="868" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="459,17 448,21 448,12" style="fill:rgb(0,0,0)"/>
<path d="M418,17L454,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M474,32L518,32A15 15 0 0 0 533 17A15 15 0 0 0 518 2L474,2A15 15 0 0 0 459 17A15 15 0 0 0 474 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="496" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M533,17L631,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/cte-table-name.html">cte-table-name:</a></b>
<button id='x8ee4d7b5' onclick='hideorshow("x8ee4d7b5","x9ccb4fa6")'>show</button></p>
 <div id='x9ccb4fa6' style='display:none;' class='imgcontainer'>
 <div style="max-width:475px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 475.949 91.8">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,36 20,41 20,32" style="fill:rgb(0,0,0)"/>
<path d="M9,36L26,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,51L122,51A15 15 0 0 0 137 36A15 15 0 0 0 122 21L47,21A15 15 0 0 0 32 36A15 15 0 0 0 47 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="173,36 162,41 162,32" style="fill:rgb(0,0,0)"/>
<path d="M137,36L168,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M188,51A15 15 0 0 0 204 36A15 15 0 0 0 188 21A15 15 0 0 0 173 36A15 15 0 0 0 188 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="188" y="36" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="240,36 228,41 228,32" style="fill:rgb(0,0,0)"/>
<path d="M204,36L234,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M255,51L349,51A15 15 0 0 0 364 36A15 15 0 0 0 349 21L255,21A15 15 0 0 0 240 36A15 15 0 0 0 255 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="400,36 388,41 388,32" style="fill:rgb(0,0,0)"/>
<path d="M364,36L394,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,51A15 15 0 0 0 430 36A15 15 0 0 0 415 21A15 15 0 0 0 400 36A15 15 0 0 0 415 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="36" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="466,36 455,41 455,32" style="fill:rgb(0,0,0)"/>
<path d="M430,36L460,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="470" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M302,89A15 15 0 0 0 317 74L317,74A15 15 0 0 0 302 59A15 15 0 0 0 287 74L287,74A15 15 0 0 0 302 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="317,74 328,70 328,78" style="fill:rgb(0,0,0)"/>
<path d="M364,36 L 371,36 Q 379,36 379,51 L 379,59 Q 379,74 364,74 L 338,74 L 323,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,74 L 232,74 Q 217,74 217,59 L 217,51 Q 217,36 224,36 L 232,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="302,6 290,10 290,2" style="fill:rgb(0,0,0)"/>
<path d="M137,36 L 145,36 Q 152,36 152,21 L 152,21 Q 152,6 167,6 L 281,6 L 296,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M302,6 L 422,6 Q 437,6 437,21 L 437,21 Q 437,36 445,36 L 452,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>


</p><p>In the diagram above, <span class='yyterm'>initial-select</span> means one or more
non-recursive SELECT statements and <span class='yyterm'>recursive-select</span> means
one or more recursive SELECT statements.  The most common case is for there
to be exactly one <span class='yyterm'>initial-select</span> and exactly one
<span class='yyterm'>recursive-select</span> but more than one of each is allowed.</p>

<p>Call the table named by the <a href="syntax/cte-table-name.html">cte-table-name</a> in a recursive
common table expression the "recursive table".
In the <a href="syntax/recursive-cte.html">recursive-cte</a> bubble diagram above, the recursive
table must appear exactly once in the FROM clause of each
top-level SELECT statement in the <span class='yyterm'>recursive-select</span>
and must not appear anywhere else in either the
<span class='yyterm'>initial-select</span> or the
<span class='yyterm'>recursive-select</span>, including subqueries.
The <span class='yyterm'>initial-select</span> may be
a <a href="lang_select.html#compound">compound select</a>, but it may not include an ORDER BY, LIMIT, or OFFSET.
The <span class='yyterm'>recursive-select</span> may also be a <a href="lang_select.html#compound">compound select</a> with
the restriction that all elements of that compound must be separated by
the same UNION or UNION ALL operator that separates
<span class='yyterm'>initial-select</span> from <span class='yyterm'>recursive-select</span>.
The <span class='yyterm'>recursive-select</span> is allowed to include an
ORDER BY, LIMIT, and/or OFFSET but may not use
<a href="lang_aggfunc.html">aggregate functions</a> or <a href="windowfunctions.html">window functions</a>.

</p><p>The ability for the <span class='yyterm'>recursive-select</span> to be a compound
was added in <a href="releaselog/3_34_0.html">version 3.34.0</a> (2020-12-01).  In earlier versions of
SQLite, the <span class='yyterm'>recursive-select</span> could only be a single
simple SELECT statement.</p>

<p>The basic algorithm for computing the content of the recursive table
is as follows:

</p><ol>
<li> Run the <span class='yyterm'>initial-select</span> and add the results to a queue.
</li><li> While the queue is not empty:
<ol type="a">
<li> Extract a single row from the queue.
</li><li> Insert that single row into the recursive table
</li><li> Pretend that the single row just extracted is the only
     row in the recursive table and run the recursive-select,
     adding all results to the queue.
</li></ol>
</li></ol>

<p>The basic procedure above may modified by the following additional rules:

</p><ul>
<li><p>
  If a UNION operator connects the <span class='yyterm'>initial-select</span> with the
  <span class='yyterm'>recursive-select</span>, then only add rows to the queue if 
  no identical row has
  been previously added to the queue.  Repeated rows are discarded before being
  added to the queue even if the repeated rows have already been extracted
  from the queue by the recursion step.  If the operator is UNION ALL,
  then all rows generated by both the <span class='yyterm'>initial-select</span> and the
  <span class='yyterm'>recursive-select</span> are always added to the queue even if
  they are repeats.
  When determining if a row is repeated, NULL values compare
  equal to one another and not equal to any other value.
</p></li><li><p>
  The LIMIT clause, if present, determines the maximum number of rows that
  will ever be added to the recursive table in step 2b.
  Once the limit is reached, the recursion stops.
  A limit of zero means that no rows are ever added to the
  recursive table, and a negative limit means an unlimited number of rows
  may be added to the recursive table.
</p></li><li><p>
  The OFFSET clause, if it is present and has a positive value N, prevents the
  first N rows from being added to the recursive table.
  The first N rows are still processed
  by the <span class='yyterm'>recursive-select</span> &mdash; they
  just are not added to the recursive table.  Rows are not counted toward
  fulfilling the LIMIT until all OFFSET rows have been skipped.
</p></li><li><p>
  If an ORDER BY clause is present, it determines the order in which rows
  are extracted from the queue in step 2a.  If there is no ORDER BY clause,
  then the order in which rows are extracted is undefined.  (In the current
  implementation, the queue becomes a FIFO if the ORDER BY clause is omitted,
  but applications should not depend on that fact since it might change.)
</p></li></ul>

<a name="rcex1"></a>

<h2 id="recursive_query_examples"><span>3.1. </span>Recursive Query Examples</h2>

<p>The following query returns all integers between 1 and 1000000:

</p><blockquote><pre>
WITH RECURSIVE
  cnt(x) AS (VALUES(1) UNION ALL SELECT x+1 FROM cnt WHERE x&lt;1000000)
SELECT x FROM cnt;
</pre></blockquote>

<p>Consider how this query works.  The initial-select
runs first and returns a single row
with a single column "1".  This one row is added to the queue.  In
step 2a, that one row is extracted from the queue and added to "cnt".
Then the recursive-select is run in accordance with step 2c generating
a single new row with value "2" to add to the queue.  The queue still
has one row, so step 2 repeats.  The "2" row is extracted and added to the
recursive table by steps 2a and 2b.  Then the row containing 2 is used 
as if it were the complete content of the recursive table and the 
recursive-select is run again, resulting in a row with value "3" being added
to the queue.  This repeats 999999 times until finally at step 2a the
only value on the queue is a row containing 1000000.  That row is
extracted and added to the recursive table.  But this time, the
WHERE clause causes the recursive-select to return no rows, so the
queue remains empty and the recursion stops.

</p><p><b>Optimization note:</b>
In the discussion above, statements like "insert the row into
the recursive table" should be understood conceptually, not literally.
It sounds as if SQLite is accumulating a huge table
containing one million rows, then going back and scanning that table
from top to bottom to generate the result.  What really happens
is that the query optimizer sees that values in the
"cnt" recursive table are only used once.  So as each row is added to
the recursive table, that row is immediately returned as a result of the main
SELECT statement and then discarded.  SQLite does <em>not</em> accumulate
a temporary table containing a million rows.  Very little memory is
needed to run the above example.  However, if the example had used
UNION instead of UNION ALL, then SQLite would have had to keep around
all previously generated content in order to check for duplicates.
For this reason, programmers should strive to use UNION ALL instead
of UNION when feasible.

</p><p>Here is a variation on the previous example:

</p><blockquote><pre>
WITH RECURSIVE
  cnt(x) AS (
     SELECT 1
     UNION ALL
     SELECT x+1 FROM cnt
      LIMIT 1000000
  )
SELECT x FROM cnt;
</pre></blockquote>

<p>There are two differences in this variation.  The initial-select is
"SELECT 1" instead of "VALUES(1)".  But those are just different
syntaxes for saying exactly the same thing.  The other change is that the
recursion is stopped by a LIMIT rather than a WHERE clause.  The use of
LIMIT means that when the one-millionth row is added to the "cnt" table
(and returned by the main SELECT, thanks to the query optimizer)
then the recursion stops immediately regardless of how many rows might be
left in the queue.  On more complex queries, it can sometimes be
difficult to ensure that the WHERE clause will eventually cause the
queue to drain and the recursion to terminate.  But the LIMIT clause will
always stop the recursion.  So it is good practice to always include a
LIMIT clause as a safety if an upper bound on the size of the recursion 
is known.

<a name="rcex2"></a>

</p><h2 id="hierarchical_query_examples"><span>3.2. </span>Hierarchical Query Examples</h2>

<p>Consider a table that describes the members of an organization as
well as the chain-of-command within that organization:

</p><blockquote><pre>
CREATE TABLE org(
  name TEXT PRIMARY KEY,
  boss TEXT REFERENCES org,
  height INT,
  -- other content omitted
);
</pre></blockquote>

<p>Every member in the organization has a name, and most members have
a single boss.  (The head of the whole organization has a NULL
"boss" field.) The rows of the "org" table form a tree.

</p><p>Here is a query that computes the average height over everyone
in Alice's organization, including Alice:

</p><blockquote><pre>
WITH RECURSIVE
  works_for_alice(n) AS (
    VALUES('Alice')
    UNION
    SELECT name FROM org, works_for_alice
     WHERE org.boss=works_for_alice.n
  )
SELECT avg(height) FROM org
 WHERE org.name IN works_for_alice;
</pre></blockquote>

<p>The next example uses two 
common table expressions in a single WITH clause.  
The following table records a family tree:

</p><blockquote><pre>
CREATE TABLE family(
  name TEXT PRIMARY KEY,
  mom TEXT REFERENCES family,
  dad TEXT REFERENCES family,
  born DATETIME,
  died DATETIME -- NULL if still alive
  -- other content
);
</pre></blockquote>

<p>The "family" table is similar to the earlier "org" table except that 
now there are two parents to each member.
We want to know all living ancestors of Alice, from oldest to youngest.
An ordinary common table expression, "parent_of", is defined first.  That
ordinary CTE is a view that can be used to find all parents of any
individual.  That ordinary CTE is then used in the "ancestor_of_alice"
recursive CTE.  The recursive CTE is then used in the final query:

</p><blockquote><pre>
WITH RECURSIVE
  parent_of(name, parent) AS
    (SELECT name, mom FROM family UNION SELECT name, dad FROM family),
  ancestor_of_alice(name) AS
    (SELECT parent FROM parent_of WHERE name='Alice'
     UNION ALL
     SELECT parent FROM parent_of JOIN ancestor_of_alice USING(name))
SELECT family.name FROM ancestor_of_alice, family
 WHERE ancestor_of_alice.name=family.name
   AND died IS NULL
 ORDER BY born;
</pre></blockquote>

<a name="rcex3"></a>

<h2 id="queries_against_a_graph"><span>3.3. </span>Queries Against A Graph</h2>

<p>Suppose you have an undirected graph where each node is
identified by an integer and edges are defined by a table like
this:

</p><blockquote><pre>
CREATE TABLE edge(aa INT, bb INT);
CREATE INDEX edge_aa ON edge(aa);
CREATE INDEX edge_bb ON edge(bb);
</pre></blockquote>

<p>The indexes are not required, but they do help performance
for large graphs.
To find all nodes of the graph that are connected to
node 59, use a query similar to the following:

</p><blockquote><pre>
WITH RECURSIVE nodes(x) AS (
   SELECT 59
   UNION
   SELECT aa FROM edge JOIN nodes ON bb=x
   UNION
   SELECT bb FROM edge JOIN nodes ON aa=x
)
SELECT x FROM nodes;
</pre></blockquote>

<p>
The <span class='yyterm'>initial-select</span> in this case is the simple query
"SELECT 59".  This establishes the base case.  The
<span class='yyterm'>recursive-select</span> consists of the other two
SELECT statements.  The first recursive SELECT follows edges
in the bb-to-aa direction and the second recursive SELECT follows
edges in the aa-to-bb direction.  UNION is used instead of
UNION ALL to prevent the recursion from entering an infinite
loop if the graph contains cycles.
</p>

<p>Here is a real-world example of using a graph query against a
directed graph:
A version control system (VCS) will typically store the evolving
versions of a project as a directed acyclic graph (DAG).  Call each
version of the project a "checkin".  A single
checkin can have zero or more parents.  Most checkins (except the
first) have a single parent, but in the case of a merge, a checkin
might have two or three or more parents.  A schema to keep track of
checkins and the order in which they occur might look something like
this:

</p><blockquote><pre>
CREATE TABLE checkin(
  id INTEGER PRIMARY KEY,
  mtime INTEGER -- timestamp when this checkin occurred
);
CREATE TABLE derivedfrom(
  xfrom INTEGER NOT NULL REFERENCES checkin, -- parent checkin
  xto INTEGER NOT NULL REFERENCES checkin,   -- derived checkin
  PRIMARY KEY(xfrom,xto)
);
CREATE INDEX derivedfrom_back ON derivedfrom(xto,xfrom);
</pre></blockquote>

<p>This graph is acyclic.  And we assume that the mtime of every
child checkin is no less than the mtime of all its parents.  But
unlike the earlier examples, this graph might have multiple paths of
differing lengths between any two checkins.

</p><p>We want to know the twenty most recent ancestors in time (out of
the thousands and thousands of ancestors in the whole DAG) for
checkin "@BASELINE".  (A query similar to this is used
by the <a href="http://www.fossil-scm.org/">Fossil</a> VCS to
show the N most recent ancestors of a checkin.  For example:
<a href="https://www.sqlite.org/src/timeline?p=trunk&n=30">https://www.sqlite.org/src/timeline?p=trunk&n=30</a>.)

</p><blockquote><pre>
WITH RECURSIVE
  ancestor(id,mtime) AS (
    SELECT id, mtime FROM checkin WHERE id=@BASELINE
    UNION
    SELECT derivedfrom.xfrom, checkin.mtime
      FROM ancestor, derivedfrom, checkin
     WHERE ancestor.id=derivedfrom.xto
       AND checkin.id=derivedfrom.xfrom
     ORDER BY checkin.mtime DESC
     LIMIT 20
  )
SELECT * FROM checkin JOIN ancestor USING(id);
</pre></blockquote>

<p>
The "ORDER BY checkin.mtime DESC" term in the recursive-select makes
the query run much faster by preventing it from following
branches that merge checkins
from long ago.  The ORDER BY forces the recursive-select to focus
on the most recent checkins, the ones we want.  Without the ORDER BY
on the recursive-select, one would be forced to compute the complete set of
thousands of ancestors, sort them all by mtime, then take the top twenty.
The ORDER BY essentially sets up a priority queue that
forces the recursive query to look at the most recent ancestors first,
allowing the use of a LIMIT clause to restrict the scope of the
query to just the checkins of interest.

<a name="withorderby"></a>

</p><h2 id="controlling_depth_first_versus_breadth_first_search_of_a_tree_using_order_by"><span>3.4. </span>Controlling Depth-First Versus Breadth-First Search Of a Tree
Using ORDER BY</h2>

<p>An ORDER BY clause on the recursive-select can be used to control
whether the search of a tree is depth-first or breadth-first.  To
illustrate, we will use a variation on the "org" table from an example
above, without the "height" column, and with some real data inserted:

</p><blockquote><pre>
CREATE TABLE org(
  name TEXT PRIMARY KEY,
  boss TEXT REFERENCES org
) WITHOUT ROWID;
INSERT INTO org VALUES('Alice',NULL);
INSERT INTO org VALUES('Bob','Alice');
INSERT INTO org VALUES('Cindy','Alice');
INSERT INTO org VALUES('Dave','Bob');
INSERT INTO org VALUES('Emma','Bob');
INSERT INTO org VALUES('Fred','Cindy');
INSERT INTO org VALUES('Gail','Cindy');
</pre></blockquote>

<p>Here is a query to show the tree structure in a breadth-first pattern:

</p><blockquote><pre>
WITH RECURSIVE
  under_alice(name,level) AS (
    VALUES('Alice',0)
    UNION ALL
    SELECT org.name, under_alice.level+1
      FROM org JOIN under_alice ON org.boss=under_alice.name
     ORDER BY 2
  )
SELECT substr('..........',1,level*3) || name FROM under_alice;
</pre></blockquote>

<p>The "ORDER BY 2" (which means the same as "ORDER BY under_alice.level+1")
causes higher levels in the organization chart (with smaller "level" values)
to be processed first, resulting in a breadth-first search.  The output is:

</p><blockquote><pre>
Alice
...Bob
...Cindy
......Dave
......Emma
......Fred
......Gail
</pre></blockquote>

<p>But if we change the ORDER BY clause to add the "DESC" modifier, that will
cause lower levels in the organization (with larger "level" values) to be
processed first by the recursive-select, resulting in a depth-first search:

</p><blockquote><pre>
WITH RECURSIVE
  under_alice(name,level) AS (
    VALUES('Alice',0)
    UNION ALL
    SELECT org.name, under_alice.level+1
      FROM org JOIN under_alice ON org.boss=under_alice.name
     ORDER BY 2 <b>DESC</b>
  )
SELECT substr('..........',1,level*3) || name FROM under_alice;
</pre></blockquote>

<p>The output of this revised query is:

</p><blockquote><pre>
Alice
...Bob
......Dave
......Emma
...Cindy
......Fred
......Gail
</pre></blockquote>

<p>When the ORDER BY clause is omitted from the recursive-select, the
queue behaves as a FIFO, which results in a breadth-first search.


<a name="mandelbrot"></a>

</p><h2 id="outlandish_recursive_query_examples"><span>3.5. </span>Outlandish Recursive Query Examples</h2>

<p>The following query computes an approximation of the Mandelbrot Set
and outputs the result as ASCII-art:

</p><blockquote><pre>
WITH RECURSIVE
  xaxis(x) AS (VALUES(-2.0) UNION ALL SELECT x+0.05 FROM xaxis WHERE x&lt;1.2),
  yaxis(y) AS (VALUES(-1.0) UNION ALL SELECT y+0.1 FROM yaxis WHERE y&lt;1.0),
  m(iter, cx, cy, x, y) AS (
    SELECT 0, x, y, 0.0, 0.0 FROM xaxis, yaxis
    UNION ALL
    SELECT iter+1, cx, cy, x*x-y*y + cx, 2.0*x*y + cy FROM m 
     WHERE (x*x + y*y) &lt; 4.0 AND iter&lt;28
  ),
  m2(iter, cx, cy) AS (
    SELECT max(iter), cx, cy FROM m GROUP BY cx, cy
  ),
  a(t) AS (
    SELECT group_concat( substr(' .+*#', 1+min(iter/7,4), 1), '') 
    FROM m2 GROUP BY cy
  )
SELECT group_concat(rtrim(t),x'0a') FROM a;
</pre></blockquote>

<p>In this query, the "xaxis" and "yaxis" CTEs define the grid of points for
which the Mandelbrot Set will be approximated.  Each row in the
"m(iter,cx,cy,x,y)" CTE means that after "iter" iterations, the Mandelbrot
iteration starting at cx,cy has reached point x,y.  The number of iterations
in this example is limited to 28 (which severely limits the resolution of
the computation, but is sufficient for low-resolution ASCII-art output).
The "m2(iter,cx,cy)" CTE holds the maximum number of iterations reached when
starting at point cx,cy.
Finally, each row in the "a(t)" CTE holds a string 
which is a single line of the output ASCII-art.
The SELECT statement at the end just queries the "a" CTE to
retrieve all lines of ASCII-art, one by one.

</p><p>Running the query above in an SQLite <a href="cli.html">command-line shell</a> results
in the following output:

</p><blockquote><pre>
                                    ....#
                                   ..#*..
                                 ..+####+.
                            .......+####....   +
                           ..##+*##########+.++++
                          .+.##################+.
              .............+###################+.+
              ..++..#.....*#####################+.
             ...+#######++#######################.
          ....+*################################.
 #############################################...
          ....+*################################.
             ...+#######++#######################.
              ..++..#.....*#####################+.
              .............+###################+.+
                          .+.##################+.
                           ..##+*##########+.++++
                            .......+####....   +
                                 ..+####+.
                                   ..#*..
                                    ....#
                                    +.
</pre></blockquote>

<a name="sudoku"></a>

<p>This next query solves a Sudoku puzzle.  The state of the puzzle is
defined by an 81-character string formed by reading entries from the
puzzle box row by row from left to right and then from top to bottom.
Blank squares in the puzzle are denoted by a "." character.  
Thus the input string:

</p><blockquote>
53..7....6..195....98....6.8...6...34..8.3..17...2...6.6....28....419..5....8..79
</blockquote>

<p>Corresponds to a puzzle like this:

</p><blockquote>
<table border="1" cellpadding="5">
<tr><td>5</td><td>3</td><td> </td><td> </td><td>7</td><td> </td><td> </td><td> </td><td>
</td></tr><tr><td>6</td><td> </td><td> </td><td>1</td><td>9</td><td>5</td><td> </td><td> </td><td>
</td></tr><tr><td> </td><td>9</td><td>8</td><td> </td><td> </td><td> </td><td> </td><td>6</td><td>
</td></tr><tr><td>8</td><td> </td><td> </td><td> </td><td>6</td><td> </td><td> </td><td> </td><td>3
</td></tr><tr><td>4</td><td> </td><td> </td><td>8</td><td> </td><td>3</td><td> </td><td> </td><td>1
</td></tr><tr><td>7</td><td> </td><td> </td><td> </td><td>2</td><td> </td><td> </td><td> </td><td>6
</td></tr><tr><td> </td><td>6</td><td> </td><td> </td><td> </td><td> </td><td>2</td><td>8</td><td>
</td></tr><tr><td> </td><td> </td><td> </td><td>4</td><td>1</td><td>9</td><td> </td><td> </td><td>5
</td></tr><tr><td> </td><td> </td><td> </td><td> </td><td>8</td><td> </td><td> </td><td>7</td><td>9
</td></tr></table>
</blockquote>

<p>This is the query that solves the puzzle:

</p><blockquote><pre>
WITH RECURSIVE
  input(sud) AS (
    VALUES('53..7....6..195....98....6.8...6...34..8.3..17...2...6.6....28....419..5....8..79')
  ),
  digits(z, lp) AS (
    VALUES('1', 1)
    UNION ALL SELECT
    CAST(lp+1 AS TEXT), lp+1 FROM digits WHERE lp&lt;9
  ),
  x(s, ind) AS (
    SELECT sud, instr(sud, '.') FROM input
    UNION ALL
    SELECT
      substr(s, 1, ind-1) || z || substr(s, ind+1),
      instr( substr(s, 1, ind-1) || z || substr(s, ind+1), '.' )
     FROM x, digits AS z
    WHERE ind>0
      AND NOT EXISTS (
            SELECT 1
              FROM digits AS lp
             WHERE z.z = substr(s, ((ind-1)/9)*9 + lp, 1)
                OR z.z = substr(s, ((ind-1)%9) + (lp-1)*9 + 1, 1)
                OR z.z = substr(s, (((ind-1)/3) % 3) * 3
                        + ((ind-1)/27) * 27 + lp
                        + ((lp-1) / 3) * 6, 1)
         )
  )
SELECT s FROM x WHERE ind=0;
</pre></blockquote>

<p>The "input" CTE defines the input puzzle.
The "digits" CTE defines a table that holds all digits between 1 and 9.
The work of solving the puzzle is undertaken by the "x" CTE.
An entry in x(s,ind) means that the 81-character string "s" is a valid
sudoku puzzle (it has no conflicts) and that the first unknown character
is at position "ind", or ind==0 if all character positions are filled in.
The goal, then, is to compute entries for "x" with an "ind" of 0.

</p><p>The solver works by adding new entries to the "x" recursive table.
Given prior entries, the recursive-select tries to fill in a single new
position with all values between 1 and 9 that actually work in that
position.  The complicated "NOT EXISTS" subquery is the magic that
figures out whether or not each candidate "s" string is a valid
sudoku puzzle or not.

</p><p>The final answer is found by looking for a string with ind==0.
If the original sudoku problem did not have a unique solution, then
the query will return all possible solutions.  If the original problem
was unsolvable, then no rows will be returned.  In this case, the unique
answer is:

</p><blockquote>
534678912672195348198342567859761423426853791713924856961537284287419635345286179
</blockquote>

<p>The solution was computed in less than 300 milliseconds on a modern
workstation.

<a name="mathint"></a>

</p><h1 id="materialization_hints"><span>4. </span>Materialization Hints</h1>

<p>
The "AS MATERIALIZED" and "AS NOT MATERIALIZED" forms of a common table expression
are non-standard SQL syntax copied from PostgreSQL.  Using MATERIALIZED or
NOT MATERIALIZED after the AS keyword provides non-binding hints to the query
planner about how the CTE should be implemented.

</p><p>
If the MATERIALIZED phrase is used, then <span class='yynonterm'>select-stmt</span> will
be materialized into an ephemeral table that is held in memory or in a
temporary disk file.  That ephemeral table will then be used in place of the
CTE table name whenever the CTE table name appears in the subsequent SQL.
Because the <span class='yynonterm'>select-stmt</span> is evaluated immediately,
the opportunity to apply optimizations such as
<a href="optoverview.html#flattening">query flattening</a> or the <a href="optoverview.html#pushdown">push-down optimization</a>, is lost.
This loss of optimization is a feature, not a bug.  Developers are able
to use the MATERIALIZED keyword as an "optimization fence" to more tightly
control the behavior of the SQLite query planner.  SQLite copied the idea of
using MATERIALIZED as an optimization fence from PostgreSQL.

</p><p>
If the NOT MATERIALIZED phrase is used, then <span class='yynonterm'>select-stmt</span>
is substituted as a subquery in place of every occurrence of the CTE
table name.  Optimizations such as <a href="optoverview.html#flattening">flattening</a> and
<a href="optoverview.html#pushdown">push-down</a> are then applied to the subquery as if
the subquery had by used in directly.  In spite of its name, the NOT MATERIALIZED
phrase does not prohibit the use of materialization.  The query planner
is still free to implement the subquery using materialization if
it feels that is the best solution.  The true meaning of NOT MATERIALIZED
is closer to "TREAT LIKE ANY ORDINARY VIEW OR SUBQUERY".  

</p><p>
If neither hint is present, then SQLite is free to choose whatever
implementation strategy it thinks will work best.  This is the recommended
approach.  <i>Do not use the MATERIALIZED or NOT MATERIALIZED keywords on
a common table expression unless you have a compelling reason to do so.</i>

</p><p>
The MATERIALIZED and NOT MATERIALIZED hints are only available in
SQLite version 3.35.0 (2021-03-12) and later.

</p><h1 id="limitations_and_caveats"><span>5. </span>Limitations And Caveats</h1>

<ul>
<li><p>
The WITH clause cannot be used within a <a href="lang_createtrigger.html">CREATE TRIGGER</a>.
</p></li><li><p>
The WITH clause must appear at the beginning of a top-level <a href="lang_select.html">SELECT</a> statement
or at the beginning of a subquery.  The WITH clause cannot be prepended to
the second or subsequent SELECT statement of a <a href="lang_select.html#compound">compound select</a>.
</p></li><li><p>
The SQL:1999 spec requires that the RECURSIVE keyword follow WITH in any
WITH clause that includes a recursive common table expression.  However, for
compatibility with SqlServer and Oracle, SQLite does not enforce this rule.
</p></li></ul>
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/lang_with.in?m=5365d4ff94">2024-01-29 11:00:27</a> UTC </small></i></p>

Added Doc/Extra/Core/pragma.html.





















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>Pragma statements supported by SQLite</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>

<h1 align="center">PRAGMA Statements</h1>



<p>The PRAGMA statement is an SQL extension specific to SQLite and used to 
modify the operation of the SQLite library or to query the SQLite library for 
internal (non-table) data. The PRAGMA statement is issued using the same
interface as other SQLite commands (e.g. <a href="lang_select.html">SELECT</a>, <a href="lang_insert.html">INSERT</a>) but is
different in the following important respects:
</p>
<ul>
<li>The pragma command is specific to SQLite and is
    not compatible with any other SQL database engine.
<li>Specific pragma statements may be removed and others added in future
    releases of SQLite. There is no guarantee of backwards compatibility.
<li>No error messages are generated if an unknown pragma is issued.
    Unknown pragmas are simply ignored. This means if there is a typo in 
    a pragma statement the library does not inform the user of the fact.
<li>Some pragmas take effect during the SQL compilation stage, not the
    execution stage. This means if using the C-language <a href="c3ref/prepare.html">sqlite3_prepare()</a>, 
    <a href="c3ref/step.html">sqlite3_step()</a>, <a href="c3ref/finalize.html">sqlite3_finalize()</a> API (or similar in a wrapper 
    interface), the pragma may run during the <a href="c3ref/prepare.html">sqlite3_prepare()</a> call,
    not during the <a href="c3ref/step.html">sqlite3_step()</a> call as normal SQL statements do.
    Or the pragma might run during sqlite3_step() just like normal
    SQL statements.  Whether or not the pragma runs during sqlite3_prepare()
    or sqlite3_step() depends on the pragma and on the specific release
    of SQLite.
<li>The <a href="lang_explain.html">EXPLAIN</a> and <a href="eqp.html">EXPLAIN QUERY PLAN</a> prefixes to SQL statements
    only affect the behavior of the statement during <a href="c3ref/step.html">sqlite3_step()</a>.
    That means that PRAGMA statements that take effect during
    <a href="c3ref/prepare.html">sqlite3_prepare()</a> will behave the same way regardless of whether or
    not they are prefaced by "EXPLAIN".
</ul>

<p>The C-language API for SQLite provides the <a href="c3ref/c_fcntl_begin_atomic_write.html#sqlitefcntlpragma">SQLITE_FCNTL_PRAGMA</a>
<a href="c3ref/file_control.html">file control</a> which gives <a href="vfs.html">VFS</a> implementations the
opportunity to add new PRAGMA statements or to override the meaning of
built-in PRAGMA statements.</p>


<hr /><a name="syntax"></a>
<h2>PRAGMA command syntax</h2>
<p><b><a href="syntax/pragma-stmt.html">pragma-stmt:</a></b>
<button id='xd117fae3' onclick='hideorshow("xd117fae3","xa21fab4a")'>hide</button></p>
 <div id='xa21fab4a' class='imgcontainer'>
 <div style="max-width:824px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 824.352 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L104,32A15 15 0 0 0 119 17A15 15 0 0 0 104 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRAGMA</text>
<polygon points="155,17 143,21 143,12" style="fill:rgb(0,0,0)"/>
<path d="M119,17L149,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M170,32L266,32A15 15 0 0 0 282 17A15 15 0 0 0 266 2L170,2A15 15 0 0 0 155 17A15 15 0 0 0 170 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="305,17 293,21 293,12" style="fill:rgb(0,0,0)"/>
<path d="M282,17L299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,32A15 15 0 0 0 335 17A15 15 0 0 0 320 2A15 15 0 0 0 305 17A15 15 0 0 0 320 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="320" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="371,17 359,21 359,12" style="fill:rgb(0,0,0)"/>
<path d="M335,17L365,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M386,32L483,32A15 15 0 0 0 498 17A15 15 0 0 0 483 2L386,2A15 15 0 0 0 371 17A15 15 0 0 0 386 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="435" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">pragma-name</text>
<polygon points="540,82 528,86 528,77" style="fill:rgb(0,0,0)"/>
<path d="M498,17 L 506,17 Q 513,17 513,32 L 513,67 Q 513,82 524,82 L 534,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M555,97A15 15 0 0 0 570 82A15 15 0 0 0 555 67A15 15 0 0 0 540 82A15 15 0 0 0 555 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="555" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="593,82 582,86 582,77" style="fill:rgb(0,0,0)"/>
<path d="M570,82L587,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M593,97L720,97L720,67L593,67Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="656" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">pragma-value</text>
<polygon points="743,82 731,86 731,77" style="fill:rgb(0,0,0)"/>
<path d="M720,82L737,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M758,97A15 15 0 0 0 773 82A15 15 0 0 0 758 67A15 15 0 0 0 743 82A15 15 0 0 0 758 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="758" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="814,17 803,21 803,12" style="fill:rgb(0,0,0)"/>
<path d="M773,82 L 780,82 Q 788,82 788,67 L 788,32 Q 788,17 798,17 L 809,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="818" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="540,44 528,48 528,40" style="fill:rgb(0,0,0)"/>
<path d="M498,17 L 506,17 Q 513,17 513,30 Q 513,44 524,44 L 534,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M555,59A15 15 0 0 0 570 44L570,44A15 15 0 0 0 555 29A15 15 0 0 0 540 44L540,44A15 15 0 0 0 555 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="555" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">=</text>
<polygon points="593,44 582,48 582,40" style="fill:rgb(0,0,0)"/>
<path d="M570,44L587,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M593,59L720,59L720,29L593,29Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="656" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">pragma-value</text>
<polygon points="773,44 761,48 761,40" style="fill:rgb(0,0,0)"/>
<path d="M720,44L767,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M773,44 L 780,44 Q 788,44 788,36 L 788,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="656,17 645,21 645,12" style="fill:rgb(0,0,0)"/>
<path d="M498,17L651,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M656,17L803,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,44 207,48 207,40" style="fill:rgb(0,0,0)"/>
<path d="M119,17 L 126,17 Q 134,17 134,30 Q 134,44 149,44 L 198,44 L 213,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M218,44 L 335,44 Q 350,44 350,30 Q 350,17 357,17 L 365,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/pragma-value.html">pragma-value:</a></b>
<button id='xc2c54c29' onclick='hideorshow("xc2c54c29","xdbeedbf8")'>hide</button></p>
 <div id='xdbeedbf8' class='imgcontainer'>
 <div style="max-width:264px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 264.499 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="63,17 51,21 51,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L57,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M63,32L201,32L201,2L63,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="255,17 243,21 243,12" style="fill:rgb(0,0,0)"/>
<path d="M201,17L249,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="258" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M78,70L105,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 105 39L78,39A15 15 0 0 0 63 55L63,55A15 15 0 0 0 78 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<path d="M78,108L171,108A15 15 0 0 0 186 92A15 15 0 0 0 171 77L78,77A15 15 0 0 0 63 92A15 15 0 0 0 78 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-literal</text>
<polygon points="63,92 51,97 51,88" style="fill:rgb(0,0,0)"/>
<path d="M21,17 L 29,17 Q 36,17 36,32 L 36,77 Q 36,92 47,92 L 57,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="201,92 189,97 189,88" style="fill:rgb(0,0,0)"/>
<path d="M186,92L195,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M201,92 L 208,92 Q 216,92 216,77 L 216,32 Q 216,17 223,17 L 231,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="201,55 189,59 189,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L195,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M201,55 L 208,55 Q 216,55 216,47 L 216,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="63,55 51,59 51,50" style="fill:rgb(0,0,0)"/>
<path d="M36,39 L 36,47 Q 36,55 47,55 L 57,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<p><b><a href="syntax/signed-number.html">signed-number:</a></b>
<button id='x5c095d4c' onclick='hideorshow("x5c095d4c","x03043874")'>show</button></p>
 <div id='x03043874' style='display:none;' class='imgcontainer'>
 <div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>
</div>
</div>


<p>
A pragma can take either zero or one argument.  The argument is may be either
in parentheses or it may be separated from the pragma name by an equal sign.
The two syntaxes yield identical results.
In many pragmas, the argument is a boolean.  The boolean can be one of:
</p>

<center>
<b>1 yes true on<br>0 no false off</b>
</center>

<p>Keyword arguments can optionally appear in quotes.  
(Example:  <tt>'yes' &#91;FALSE&#93;</tt>.) Some pragmas
takes a string literal as their argument.  When pragma takes a keyword
argument, it will usually also take a numeric equivalent as well.
For example, "0" and "no" mean the same thing, as does "1" and "yes".
When querying the value of a setting, many pragmas return the number
rather than the keyword.</p>

<p>A pragma may have an optional <span class='yyterm'>schema-name</span>
before the pragma name.
The <span class='yyterm'>schema-name</span> is the name of an <a href="lang_attach.html">ATTACH</a>-ed database 
or "main" or "temp" for the main and the TEMP databases.  If the optional
schema name is omitted, "main" is assumed.  In some pragmas, the schema
name is meaningless and is simply ignored.  In the documentation below,
pragmas for which the schema name is meaningful are shown with a
"<i>schema.</i>" prefix.</p>


<hr /><a name="pragfunc"></a>
<h2>PRAGMA functions</h2>


<p>
PRAGMAs that return results and that have no side-effects can be 
accessed from ordinary <a href="lang_select.html">SELECT</a> statements as <a href="vtab.html#tabfunc2">table-valued functions</a>.
For each participating PRAGMA, the corresponding table-valued function
has the same name as the PRAGMA with a 7-character "pragma_" prefix.
The PRAGMA argument and schema, if any, are passed as arguments to the
table-valued function, with the schema as an optional, last argument.

<p>For example, information about the columns in an index can be
read using the <a href="pragma.html#pragma_index_info">index_info pragma</a> as follows:

<blockquote><pre>
PRAGMA index_info('idx52');
</pre></blockquote>

<p>Or, the same content can be read using:

<blockquote><pre>
SELECT * FROM pragma_index_info('idx52');
</pre></blockquote>

<p>The advantage of the table-valued function format is that the query
can return just a subset of the PRAGMA columns, can include a WHERE clause,
can use aggregate functions, and the table-valued function can be just
one of several data sources in a join.
For example, to get a list of all indexed columns in a schema, one
could query:

<blockquote><pre>
SELECT DISTINCT m.name || '.' || ii.name AS 'indexed-columns'
  FROM sqlite_schema AS m,
       pragma_index_list(m.name) AS il,
       pragma_index_info(il.name) AS ii
 WHERE m.type='table'
 ORDER BY 1;
</pre></blockquote>

<p>
Additional notes:
<ul>
<li><p>
Table-valued functions exist only for built-in PRAGMAs, not for PRAGMAs
defined using the <a href="c3ref/c_fcntl_begin_atomic_write.html#sqlitefcntlpragma">SQLITE_FCNTL_PRAGMA</a> file control.
<li><p>
Table-valued functions exist only for PRAGMAs that return results and
that have no side-effects.
<li><p>
This feature could be used to implement
<a href="https://en.wikipedia.org/wiki/Information_schema">information schema</a>
by first creating a separate schema using
<blockquote><pre>
<a href="lang_attach.html">ATTACH</a> ':memory:' AS 'information_schema';
</pre></blockquote>
Then creating
<a href="lang_createview.html">VIEWs</a> in that schema that implement the official information schema
tables using table-valued PRAGMA functions.
<li><p>
The table-valued functions for PRAGMA feature was added
in SQLite version 3.16.0 (2017-01-02).  Prior versions of SQLite
cannot use this feature.
</ul>

<hr /><a name="toc"></a>
<h2>List Of PRAGMAs</h2>
<div class='columns' style='columns: 12em auto;'>
<ul style='padding-top:0;'>
<li><a href='pragma.html#pragma_analysis_limit'>analysis_limit</a></li>
<li><a href='pragma.html#pragma_application_id'>application_id</a></li>
<li><a href='pragma.html#pragma_auto_vacuum'>auto_vacuum</a></li>
<li><a href='pragma.html#pragma_automatic_index'>automatic_index</a></li>
<li><a href='pragma.html#pragma_busy_timeout'>busy_timeout</a></li>
<li><a href='pragma.html#pragma_cache_size'>cache_size</a></li>
<li><a href='pragma.html#pragma_cache_spill'>cache_spill</a></li>
<li><a href='pragma.html#pragma_case_sensitive_like'><s>case_sensitive_like&sup1;</s></a></li>
<li><a href='pragma.html#pragma_cell_size_check'>cell_size_check</a></li>
<li><a href='pragma.html#pragma_checkpoint_fullfsync'>checkpoint_fullfsync</a></li>
<li><a href='pragma.html#pragma_collation_list'>collation_list</a></li>
<li><a href='pragma.html#pragma_compile_options'>compile_options</a></li>
<li><a href='pragma.html#pragma_count_changes'><s>count_changes&sup1;</s></a></li>
<li><a href='pragma.html#pragma_data_store_directory'><s>data_store_directory&sup1;</s></a></li>
<li><a href='pragma.html#pragma_data_version'>data_version</a></li>
<li><a href='pragma.html#pragma_database_list'>database_list</a></li>
<li><a href='pragma.html#pragma_default_cache_size'><s>default_cache_size&sup1;</s></a></li>
<li><a href='pragma.html#pragma_defer_foreign_keys'>defer_foreign_keys</a></li>
<li><a href='pragma.html#pragma_empty_result_callbacks'><s>empty_result_callbacks&sup1;</s></a></li>
<li><a href='pragma.html#pragma_encoding'>encoding</a></li>
<li><a href='pragma.html#pragma_foreign_key_check'>foreign_key_check</a></li>
<li><a href='pragma.html#pragma_foreign_key_list'>foreign_key_list</a></li>
<li><a href='pragma.html#pragma_foreign_keys'>foreign_keys</a></li>
<li><a href='pragma.html#pragma_freelist_count'>freelist_count</a></li>
<li><a href='pragma.html#pragma_full_column_names'><s>full_column_names&sup1;</s></a></li>
<li><a href='pragma.html#pragma_fullfsync'>fullfsync</a></li>
<li><a href='pragma.html#pragma_function_list'>function_list</a></li>
<li><a href='pragma.html#pragma_hard_heap_limit'>hard_heap_limit</a></li>
<li><a href='pragma.html#pragma_ignore_check_constraints'>ignore_check_constraints</a></li>
<li><a href='pragma.html#pragma_incremental_vacuum'>incremental_vacuum</a></li>
<li><a href='pragma.html#pragma_index_info'>index_info</a></li>
<li><a href='pragma.html#pragma_index_list'>index_list</a></li>
<li><a href='pragma.html#pragma_index_xinfo'>index_xinfo</a></li>
<li><a href='pragma.html#pragma_integrity_check'>integrity_check</a></li>
<li><a href='pragma.html#pragma_journal_mode'>journal_mode</a></li>
<li><a href='pragma.html#pragma_journal_size_limit'>journal_size_limit</a></li>
<li><a href='pragma.html#pragma_legacy_alter_table'>legacy_alter_table</a></li>
<li><a href='pragma.html#pragma_legacy_file_format'>legacy_file_format</a></li>
<li><a href='pragma.html#pragma_locking_mode'>locking_mode</a></li>
<li><a href='pragma.html#pragma_max_page_count'>max_page_count</a></li>
<li><a href='pragma.html#pragma_mmap_size'>mmap_size</a></li>
<li><a href='pragma.html#pragma_module_list'>module_list</a></li>
<li><a href='pragma.html#pragma_optimize'>optimize</a></li>
<li><a href='pragma.html#pragma_page_count'>page_count</a></li>
<li><a href='pragma.html#pragma_page_size'>page_size</a></li>
<li><a href='pragma.html#pragma_parser_trace'>parser_trace&sup2;</a></li>
<li><a href='pragma.html#pragma_pragma_list'>pragma_list</a></li>
<li><a href='pragma.html#pragma_query_only'>query_only</a></li>
<li><a href='pragma.html#pragma_quick_check'>quick_check</a></li>
<li><a href='pragma.html#pragma_read_uncommitted'>read_uncommitted</a></li>
<li><a href='pragma.html#pragma_recursive_triggers'>recursive_triggers</a></li>
<li><a href='pragma.html#pragma_reverse_unordered_selects'>reverse_unordered_selects</a></li>
<li><a href='pragma.html#pragma_schema_version'>schema_version&sup3;</a></li>
<li><a href='pragma.html#pragma_secure_delete'>secure_delete</a></li>
<li><a href='pragma.html#pragma_short_column_names'><s>short_column_names&sup1;</s></a></li>
<li><a href='pragma.html#pragma_shrink_memory'>shrink_memory</a></li>
<li><a href='pragma.html#pragma_soft_heap_limit'>soft_heap_limit</a></li>
<li><a href='pragma.html#pragma_stats'>stats&sup3;</a></li>
<li><a href='pragma.html#pragma_synchronous'>synchronous</a></li>
<li><a href='pragma.html#pragma_table_info'>table_info</a></li>
<li><a href='pragma.html#pragma_table_list'>table_list</a></li>
<li><a href='pragma.html#pragma_table_xinfo'>table_xinfo</a></li>
<li><a href='pragma.html#pragma_temp_store'>temp_store</a></li>
<li><a href='pragma.html#pragma_temp_store_directory'><s>temp_store_directory&sup1;</s></a></li>
<li><a href='pragma.html#pragma_threads'>threads</a></li>
<li><a href='pragma.html#pragma_trusted_schema'>trusted_schema</a></li>
<li><a href='pragma.html#pragma_user_version'>user_version</a></li>
<li><a href='pragma.html#pragma_vdbe_addoptrace'>vdbe_addoptrace&sup2;</a></li>
<li><a href='pragma.html#pragma_vdbe_debug'>vdbe_debug&sup2;</a></li>
<li><a href='pragma.html#pragma_vdbe_listing'>vdbe_listing&sup2;</a></li>
<li><a href='pragma.html#pragma_vdbe_trace'>vdbe_trace&sup2;</a></li>
<li><a href='pragma.html#pragma_wal_autocheckpoint'>wal_autocheckpoint</a></li>
<li><a href='pragma.html#pragma_wal_checkpoint'>wal_checkpoint</a></li>
<li><a href='pragma.html#pragma_writable_schema'>writable_schema&sup3;</a></li>
</ul>
</div>

<p>Notes:
<ol>
<li>Pragmas whose names are <s>struck through</s>
are deprecated. Do not use them. They exist
for historical compatibility.
<li>These pragmas are only available in builds using non-standard
compile-time options.
<li>These pragmas are used for testing SQLite and are not recommended
for use in application programs.</ol></p>
<a name="pragma_analysis_limit"></a>
<h _id=pragma_analysis_limit style="display:none"> PRAGMA analysis_limit</h><hr>
   <p><b>PRAGMA analysis_limit;
        <br>PRAGMA analysis_limit = </b><i>N</i><b>;</b></p>
   <p>Query or change a limit on the <a href="lang_analyze.html#approx">approximate ANALYZE</a> setting.
      This is the approximate number of
      rows examined in each index by the <a href="lang_analyze.html">ANALYZE</a> command.
      If the argument <i>N</i> is omitted, then the analysis limit
      is unchanged.
      If the limit is zero, then the analysis limit is disabled and
      the ANALYZE command will examine all rows of each index.
      If N is greater than zero, then the analysis limit is set to N
      and subsequent ANALYZE commands will stop analyzing
      each index after it has examined approximately N rows.
      If N is a negative number or something other than an integer value,
      then the pragma behaves as if the N argument was omitted.
      In all cases, the value returned is the new analysis limit used
      for subsequent ANALYZE commands.
   <p>This pragma can be used to help the ANALYZE command run faster
      on large databases.  The results of analysis are not as good
      when only part of each index is examined, but the results are
      usually good enough.  Setting N to 100 or 1000 allows the
      ANALYZE command to run very quickly, even on multi-gigabyte
      database files.  This pragma is particularly useful in combination
      with <a href="pragma.html#pragma_optimize">PRAGMA optimize</a>.
   <p>This pragma was added in SQLite version 3.32.0 (2020-05-22).
      The current implementation only uses the lower 31 bits of the
      N value - higher order bits are silently ignored.  Future versions
      of SQLite might begin using higher order bits.
<a name="pragma_application_id"></a>
<h _id=pragma_application_id style="display:none"> PRAGMA application_id</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>application_id;
     <br>PRAGMA </b><i>schema.</i><b>application_id = </b><i>integer </i><b>;</b>
  
    <p>The application_id PRAGMA is used to query or set the 32-bit
       signed big-endian "Application ID" integer located at offset
       68 into the <a href="fileformat2.html#database_header">database header</a>.  Applications that use SQLite as their
       <a href="appfileformat.html">application file-format</a> should set the Application ID integer to
       a unique integer so that utilities such as 
       <a href="http://www.darwinsys.com/file/">file(1)</a> can determine the specific
       file type rather than just reporting "SQLite3 Database".  A list of
       assigned application IDs can be seen by consulting the
       <a href="https://www.sqlite.org/src/artifact?ci=trunk&filename=magic.txt">magic.txt</a> file in the SQLite source repository.

<p>   See also the <a href="pragma.html#pragma_user_version">user_version pragma</a>.
<a name="pragma_auto_vacuum"></a>
<h _id=pragma_auto_vacuum style="display:none"> PRAGMA auto_vacuum</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>auto_vacuum;<br>
          PRAGMA </b><i>schema.</i><b>auto_vacuum = </b>
           <i>0 | NONE | 1 | FULL | 2 | INCREMENTAL</i><b>;</b></p>

    <p>Query or set the auto-vacuum status in the database.</p>

    <p>The default setting for auto-vacuum is 0 or "none",
    unless the <a href="compile.html#default_autovacuum">SQLITE_DEFAULT_AUTOVACUUM</a> compile-time option is used.
    The "none" setting means that auto-vacuum is disabled.
    When auto-vacuum is disabled and data is deleted data from a database,
    the database file remains the same size.  Unused database file 
    pages are added to a "<a href="fileformat2.html#freelist">freelist</a>" and reused for subsequent inserts.  So
    no database file space is lost.  However, the database file does not
    shrink.  In this mode the <a href="lang_vacuum.html">VACUUM</a>
    command can be used to rebuild the entire database file and
    thus reclaim unused disk space.</p>

    <p>When the auto-vacuum mode is 1  or "full", the freelist pages are
    moved to the end of the database file and the database file is truncated
    to remove the freelist pages at every transaction commit.
    Note, however, that auto-vacuum only truncates the freelist pages
    from the file.  Auto-vacuum does not defragment the database nor
    repack individual database pages the way that the
    <a href="lang_vacuum.html">VACUUM</a> command does.  In fact, because
    it moves pages around within the file, auto-vacuum can actually
    make fragmentation worse.</p>

    <p>Auto-vacuuming is only possible if the database stores some
    additional information that allows each database page to be
    traced backwards to its referrer.  Therefore, auto-vacuuming must
    be turned on before any tables are created.  It is not possible
    to enable or disable auto-vacuum after a table has been created.</p>

    <p>When the value of auto-vacuum is 2 or "incremental" then the additional
    information needed to do auto-vacuuming is stored in the database file
    but auto-vacuuming does not occur automatically at each commit as it
    does with auto_vacuum=full.  In incremental mode, the separate
    <a href="pragma.html#pragma_incremental_vacuum">incremental_vacuum</a> pragma must
    be invoked to cause the auto-vacuum to occur.</p>

    <p>The database connection can be changed between full and incremental
    autovacuum mode at any time.  However, changing from
    "none" to "full" or "incremental" can only occur when the database 
    is new (no tables
    have yet been created) or by running the <a href="lang_vacuum.html">VACUUM</a> command.  To
    change auto-vacuum modes, first use the auto_vacuum pragma to set
    the new desired mode, then invoke the <a href="lang_vacuum.html">VACUUM</a> command to 
    reorganize the entire database file.  To change from "full" or
    "incremental" back to "none" always requires running <a href="lang_vacuum.html">VACUUM</a> even
    on an empty database.
    </p>

    <p>When the auto_vacuum pragma is invoked with no arguments, it
    returns the current auto_vacuum mode.</p>
<a name="pragma_automatic_index"></a>
<h _id=pragma_automatic_index style="display:none"> PRAGMA automatic_index</h><hr>
    <p><b>PRAGMA automatic_index;
     <br>PRAGMA automatic_index = </b><i>boolean</i><b>;</b></p>

    <p>Query, set, or clear the <a href="optoverview.html#autoindex">automatic indexing</a> capability.
    <p><a href="optoverview.html#autoindex">Automatic indexing</a> is enabled by default as of 
    <a href="releaselog/3_7_17.html">version 3.7.17</a> (2013-05-20),
    but this might change in future releases of SQLite.
<a name="pragma_busy_timeout"></a>
<h _id=pragma_busy_timeout style="display:none"> PRAGMA busy_timeout</h><hr>
    <p><b>PRAGMA busy_timeout;
         <br>PRAGMA busy_timeout = </b><i>milliseconds</i><b>;</b></p>
    <p>Query or change the setting of the
    <a href="c3ref/busy_timeout.html">busy timeout</a>.
    This pragma is an alternative to the <a href="c3ref/busy_timeout.html">sqlite3_busy_timeout()</a> C-language
    interface which is made available as a pragma for use with language
    bindings that do not provide direct access to <a href="c3ref/busy_timeout.html">sqlite3_busy_timeout()</a>.

    <p>Each database connection can only have a single
    <a href="c3ref/busy_handler.html">busy handler</a>.  This PRAGMA sets the busy handler
    for the process, possibly overwriting any previously set busy handler.
<a name="pragma_cache_size"></a>
<h _id=pragma_cache_size style="display:none"> PRAGMA cache_size</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>cache_size;
       <br>PRAGMA </b><i>schema.</i><b>cache_size = </b><i>pages</i><b>;
       <br>PRAGMA </b><i>schema.</i><b>cache_size = -</b><i>kibibytes</i><b>;</b></p>
    <p>Query or change the suggested maximum number of database disk pages
    that SQLite will hold in memory at once per open database file.  Whether
    or not this suggestion is honored is at the discretion of the
    <a href="c3ref/pcache_methods2.html">Application Defined Page Cache</a>.
    The default page cache that is built into SQLite honors the request,
    however alternative application-defined page cache implementations
    may choose to interpret the suggested cache size in different ways
    or to ignore it all together.
    The default suggested cache size is -2000, which means the cache size
    is limited to 2048000 bytes of memory.
    The default suggested cache size can be altered using the
    <a href="compile.html#default_cache_size">SQLITE_DEFAULT_CACHE_SIZE</a> compile-time options.
    The TEMP database has a default suggested cache size of 0 pages.</p>

    <p>If the argument N is positive then the suggested cache size is set 
    to N. If the argument N is negative, then the
    number of cache pages is adjusted to be a number of pages that would
    use approximately abs(N*1024) bytes of memory based on the current
    page size.  SQLite remembers the number of pages in the page cache,
    not the amount of memory used.  So if you set the cache size using
    a negative number and subsequently change the page size (using the
    <a href="pragma.html#pragma_page_size">PRAGMA page_size</a> command) then the maximum amount of cache
    memory will go up or down in proportion to the change in page size.

    <p><i>Backwards compatibility note:</i>
    The behavior of cache_size with a negative N
    was different prior to <a href="releaselog/3_7_10.html">version 3.7.10</a> (2012-01-16).  In
    earlier versions, the number of pages in the cache was set
    to the absolute value of N.</p>

    <p>When you change the cache size using the cache_size pragma, the
    change only endures for the current session.  The cache size reverts
    to the default value when the database is closed and reopened.</p>

    <p>The default page cache implemention does not allocate
    the full amount of cache memory all at once.  Cache memory
    is allocated in smaller chunks on an as-needed basis.  The page_cache
    setting is a (suggested) upper bound on the amount of memory that the
    cache can use, not the amount of memory it will use all of the time.
    This is the behavior of the default page cache implementation, but an
    <a href="c3ref/pcache_methods2.html">application defined page cache</a> is free
    to behave differently if it wants.
<a name="pragma_cache_spill"></a>
<h _id=pragma_cache_spill style="display:none"> PRAGMA cache_spill</h><hr>
    <p><b>PRAGMA cache_spill;
         <br>PRAGMA cache_spill=</b><i>boolean</i><b>;
         <br>PRAGMA </b><i>schema.</i><b>cache_spill=<i>N</i>;</b></p>

    <p>The cache_spill pragma enables or disables the ability of the pager
    to spill dirty cache pages to the database file in the middle of a 
    transaction.  Cache_spill is enabled by default and most applications
    should leave it that way as cache spilling is usually advantageous.
    However, a cache spill has the side-effect of acquiring an
    <a href="lockingv3.html#excl_lock">EXCLUSIVE lock</a> on the database file.  Hence, some applications that
    have large long-running transactions may want to disable cache spilling
    in order to prevent the application from acquiring an exclusive lock
    on the database until the moment that the transaction <a href="lang_transaction.html">COMMIT</a>s.
    <p>The "PRAGMA cache_spill=<i>N</i>" form of this pragma sets a minimum
    cache size threshold required for spilling to occur. The number of pages
    in cache must exceed both the cache_spill threshold and the maximum cache
    size set by the <a href="pragma.html#pragma_cache_size">PRAGMA cache_size</a> statement in order for spilling to
    occur.
    <p>The "PRAGMA cache_spill=<i>boolean</i>" form of this pragma applies
    across all databases attached to the database connection.  But the
    "PRAGMA cache_spill=<i>N</i>" form of this statement only applies to
    the "main" schema or whatever other schema is specified as part of the
    statement.
<a name="pragma_case_sensitive_like"></a>
<h _id=pragma_case_sensitive_like style="display:none"> PRAGMA case_sensitive_like</h><hr>
    <p><b>PRAGMA case_sensitive_like = </b><i>boolean</i><b>;</b></p>
    <p>The default behavior of the <a href="lang_expr.html#like">LIKE</a> operator is to ignore case
    for ASCII characters. Hence, by default <b>'a' LIKE 'A'</b> is
    true.  The case_sensitive_like pragma installs a new application-defined
    LIKE function that is either case sensitive or insensitive depending
    on the value of the case_sensitive_like pragma.
    When case_sensitive_like is disabled, the default LIKE behavior is
    expressed.  When case_sensitive_like is enabled, case becomes
    significant.  So, for example,
    <b>'a' LIKE 'A'</b> is false but <b>'a' LIKE 'a'</b> is still true.</p>

    <p>This pragma uses <a href="c3ref/create_function.html">sqlite3_create_function()</a> to overload the
    LIKE and GLOB functions, which may override previous implementations
    of LIKE and GLOB registered by the application.  This pragma
    only changes the behavior of the SQL <a href="lang_expr.html#like">LIKE</a> operator.  It does not
    change the behavior of the <a href="c3ref/strlike.html">sqlite3_strlike()</a> C-language interface,
    which is always case insensitive.</p>

    <p><b>WARNING:</b> If a database uses the LIKE operator anywhere in
    the schema, such as in a <a href="lang_createtable.html#ckconst">CHECK constraint</a> or in an
    <a href="expridx.html">expression index</a> or in the WHERE clause of a <a href="partialindex.html">partial index</a>, then
    changing the definition of the LIKE operator using this PRAGMA can
    cause the database to appear to be corrupt.  <a href="pragma.html#pragma_integrity_check">PRAGMA integrity_check</a>
    will report errors.  The database is not really corrupt in that
    changing the behavior of LIKE back to the way
    it was when the schema was defined and the database was populated
    will clear the problem.   If the use of LIKE occurs only in indexes,
    then the problem can be cleared by running <a href="lang_reindex.html">REINDEX</a>.  Nevertheless, 
    the use of the case_sensitive_like pragma is discouraged.</p>

    
    <p style='background-color: #ffd0d0;'>
    <b>This pragma is deprecated</b> and exists
    for backwards compatibility only.  New applications
    should avoid using this pragma.  Older applications should discontinue
    use of this pragma at the earliest opportunity.  This pragma may be omitted
    from the build when SQLite is compiled using <a href="compile.html#omit_deprecated">SQLITE_OMIT_DEPRECATED</a>.
    </p>
  
<a name="pragma_cell_size_check"></a>
<h _id=pragma_cell_size_check style="display:none"> PRAGMA cell_size_check</h><hr>
    <p><b>PRAGMA cell_size_check
       <br>PRAGMA cell_size_check = </b><i>boolean</i><b>;</b></p>
    <p>The cell_size_check pragma enables or disables additional sanity
    checking on database b-tree pages as they are initially read from disk.
    With cell size checking enabled, database corruption is detected earlier
    and is less likely to "spread".  However, there is a small performance
    hit for doing the extra checks and so cell size checking is turned off
    by default.
<a name="pragma_checkpoint_fullfsync"></a>
<h _id=pragma_checkpoint_fullfsync style="display:none"> PRAGMA checkpoint_fullfsync</h><hr>
    <p><b>PRAGMA checkpoint_fullfsync
       <br>PRAGMA checkpoint_fullfsync = </b><i>boolean</i><b>;</b></p>
    <p>Query or change the fullfsync flag for <a href="wal.html#ckpt">checkpoint</a> operations.
    If this flag is set, then the F_FULLFSYNC syncing method is used
    during checkpoint operations on systems that support F_FULLFSYNC. 
    The default value of the checkpoint_fullfsync flag
    is off.  Only Mac OS-X supports F_FULLFSYNC.</p>

    <p>If the <a href="pragma.html#pragma_fullfsync">fullfsync</a> flag is set, then the F_FULLFSYNC syncing
    method is used for all sync operations and the checkpoint_fullfsync
    setting is irrelevant.</p>
<a name="pragma_collation_list"></a>
<h _id=pragma_collation_list style="display:none"> PRAGMA collation_list</h><hr>
    <p><b>PRAGMA collation_list;</b></p>
    <p>Return a list of the collating sequences defined for the current
    database connection.</p>
<a name="pragma_compile_options"></a>
<h _id=pragma_compile_options style="display:none"> PRAGMA compile_options</h><hr>
    <p><b>PRAGMA compile_options;</b></p>
    <p>This pragma returns the names of <a href="compile.html">compile-time options</a> used when
    building SQLite, one option per row.  The "SQLITE_" prefix is omitted
    from the returned option names.  See also the
    <a href="c3ref/compileoption_get.html">sqlite3_compileoption_get()</a> C/C++ interface and the
    <a href="lang_corefunc.html#sqlite_compileoption_get">sqlite_compileoption_get()</a> SQL functions.</p>
<a name="pragma_count_changes"></a>
<h _id=pragma_count_changes style="display:none"> PRAGMA count_changes</h><hr>
    <p><b>PRAGMA count_changes;
       <br>PRAGMA count_changes = </b>boolean</i><b>;</b></p>

    <p>Query or change the count-changes flag. Normally, when the
    count-changes flag is not set, <a href="lang_insert.html">INSERT</a>, <a href="lang_update.html">UPDATE</a> and <a href="lang_delete.html">DELETE</a> statements
    return no data. When count-changes is set, each of these commands 
    returns a single row of data consisting of one integer value - the
    number of rows inserted, modified or deleted by the command. The 
    returned change count does not include any insertions, modifications
    or deletions performed by triggers, any changes made automatically
    by <a href="foreignkeys.html#fk_actions">foreign key actions</a>, or updates caused by an <a href="lang_upsert.html">upsert</a>.</p>

    <p>Another way to get the row change counts is to use the
    <a href="c3ref/changes.html">sqlite3_changes()</a> or <a href="c3ref/total_changes.html">sqlite3_total_changes()</a> interfaces.
    There is a subtle different, though.  When an INSERT, UPDATE, or
    DELETE is run against a view using an <a href="lang_createtrigger.html#instead_of_trigger">INSTEAD OF trigger</a>,
    the count_changes pragma reports the number of rows in the view
    that fired the trigger, whereas <a href="c3ref/changes.html">sqlite3_changes()</a> and
    <a href="c3ref/total_changes.html">sqlite3_total_changes()</a> do not.

    
    <p style='background-color: #ffd0d0;'>
    <b>This pragma is deprecated</b> and exists
    for backwards compatibility only.  New applications
    should avoid using this pragma.  Older applications should discontinue
    use of this pragma at the earliest opportunity.  This pragma may be omitted
    from the build when SQLite is compiled using <a href="compile.html#omit_deprecated">SQLITE_OMIT_DEPRECATED</a>.
    </p>
  
<a name="pragma_data_store_directory"></a>
<h _id=pragma_data_store_directory style="display:none"> PRAGMA data_store_directory</h><hr>
    <p><b>PRAGMA data_store_directory;
      <br>PRAGMA data_store_directory = '</b><i>directory-name</i><b>';</b></p>
    <p>Query or change the value of the <a href="c3ref/data_directory.html">sqlite3_data_directory</a> global
    variable, which windows operating-system interface backends use to
    determine where to store database files specified using a relative
    pathname.</p>

    <p>Changing the data_store_directory setting is <u>not</u> threadsafe.
    Never change the data_store_directory setting if another thread
    within the application is running any SQLite interface at the same time.
    Doing so results in undefined behavior.  Changing the data_store_directory
    setting writes to the <a href="c3ref/data_directory.html">sqlite3_data_directory</a> global
    variable and that global variable is not protected by a mutex.</p>

    <p>This facility is provided for WinRT which does not have an OS
    mechanism for reading or changing the current working directory.
    The use of this pragma in any other context is discouraged and may
    be disallowed in future releases.</p>

    
    <p style='background-color: #ffd0d0;'>
    <b>This pragma is deprecated</b> and exists
    for backwards compatibility only.  New applications
    should avoid using this pragma.  Older applications should discontinue
    use of this pragma at the earliest opportunity.  This pragma may be omitted
    from the build when SQLite is compiled using <a href="compile.html#omit_deprecated">SQLITE_OMIT_DEPRECATED</a>.
    </p>
  
<a name="pragma_data_version"></a>
<h _id=pragma_data_version style="display:none"> PRAGMA data_version</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>data_version;</b></p>
    <p>The "PRAGMA data_version" command provides an indication that the
    database file has been modified.
    Interactive programs that hold database content in memory or that
    display database content on-screen can use the PRAGMA data_version
    command to determine if they need to flush and reload their memory
    or update the screen display.</p>

    <p>The integer values returned by two
    invocations of "PRAGMA data_version" from the same connection
    will be different if changes were committed to the database 
    by any other connection in the interim.
    The "PRAGMA data_version" value is unchanged for commits made
    on the same database connection.
    The behavior of "PRAGMA data_version" is the same for all database
    connections, including database connections in separate processes
    and <a href="sharedcache.html">shared cache</a> database connections.

    <p>The "PRAGMA data_version" value is a local property of each
    database connection and so values returned by two concurrent invocations
    of "PRAGMA data_version" on separate database connections are 
    often different even though the underlying database is identical.
    It is only meaningful to compare the "PRAGMA data_version" values
    returned by the same database connection at two different points in
    time.
<a name="pragma_database_list"></a>
<h _id=pragma_database_list style="display:none"> PRAGMA database_list</h><hr>
    <p><b>PRAGMA database_list;</b></p>
    <p>This pragma works like a query to return one row for each database
    attached to the current database connection.
    The second column is "main" for the main database file, "temp"
    for the database file used to store TEMP objects, or the name of the
    ATTACHed database for other database files.
    The third column is the name of the database file itself, or an empty
    string if the database is not associated with a file.</p>
<a name="pragma_default_cache_size"></a>
<h _id=pragma_default_cache_size style="display:none"> PRAGMA default_cache_size</h><hr>
    <b>PRAGMA </b><i>schema.</i><b>default_cache_size;
       <br>PRAGMA </b><i>schema.</i><b>default_cache_size
            = </b><i>Number-of-pages</i><b>;</b></p>

    <p>This pragma queries or sets the suggested maximum number of pages
    of disk cache that will be allocated per open database file.
    The difference between this pragma and <a href="pragma.html#pragma_cache_size">cache_size</a> is that the
    value set here persists across database connections.
    The value of the default cache size is stored in the 4-byte
    big-endian integer located at offset 48 in the header of the
    database file.
    </p>

    
    <p style='background-color: #ffd0d0;'>
    <b>This pragma is deprecated</b> and exists
    for backwards compatibility only.  New applications
    should avoid using this pragma.  Older applications should discontinue
    use of this pragma at the earliest opportunity.  This pragma may be omitted
    from the build when SQLite is compiled using <a href="compile.html#omit_deprecated">SQLITE_OMIT_DEPRECATED</a>.
    </p>
  
<a name="pragma_defer_foreign_keys"></a>
<h _id=pragma_defer_foreign_keys style="display:none"> PRAGMA defer_foreign_keys</h><hr>
    <p><b>PRAGMA defer_foreign_keys
       <br>PRAGMA defer_foreign_keys = </b><i>boolean</i><b>;</b></p>
    <p>When the defer_foreign_keys <a href="pragma.html#syntax">PRAGMA</a> is on,
    enforcement of all <a href="foreignkeys.html">foreign key constraints</a> is delayed until the
    outermost transaction is committed.  The defer_foreign_keys pragma
    defaults to OFF so that foreign key constraints are only deferred if
    they are created as "DEFERRABLE INITIALLY DEFERRED".  The 
    defer_foreign_keys pragma is automatically switched off at each
    COMMIT or ROLLBACK.  Hence, the defer_foreign_keys pragma must be
    separately enabled for each transaction.  This pragma is
    only meaningful if foreign key constraints are enabled, of course.</p>

    <p>The <a href="c3ref/db_status.html">sqlite3_db_status</a>(db,<a href="c3ref/c_dbstatus_options.html#sqlitedbstatusdeferredfks">SQLITE_DBSTATUS_DEFERRED_FKS</a>,...)
    C-language interface can be used during a transaction to determine 
    if there are deferred and unresolved foreign key constraints.</p>
<a name="pragma_empty_result_callbacks"></a>
<h _id=pragma_empty_result_callbacks style="display:none"> PRAGMA empty_result_callbacks</h><hr>
    <p><b>PRAGMA empty_result_callbacks;
       <br>PRAGMA empty_result_callbacks = </b><i>boolean</i><b>;</b></p>

    <p>Query or change the empty-result-callbacks flag.</p>

    <p>The empty-result-callbacks flag affects the <a href="c3ref/exec.html">sqlite3_exec()</a> API only.
    Normally, when the empty-result-callbacks flag is cleared, the
    callback function supplied to the <a href="c3ref/exec.html">sqlite3_exec()</a> is not invoked
    for commands that return zero rows of data.  When empty-result-callbacks
    is set in this situation, the callback function is invoked exactly once,
    with the third parameter set to 0 (NULL). This is to enable programs  
    that use the <a href="c3ref/exec.html">sqlite3_exec()</a> API to retrieve column-names even when
    a query returns no data.</p>

    
    <p style='background-color: #ffd0d0;'>
    <b>This pragma is deprecated</b> and exists
    for backwards compatibility only.  New applications
    should avoid using this pragma.  Older applications should discontinue
    use of this pragma at the earliest opportunity.  This pragma may be omitted
    from the build when SQLite is compiled using <a href="compile.html#omit_deprecated">SQLITE_OMIT_DEPRECATED</a>.
    </p>
  
<a name="pragma_encoding"></a>
<h _id=pragma_encoding style="display:none"> PRAGMA encoding</h><hr>
   <p><b>PRAGMA encoding;
       <br>PRAGMA encoding = 'UTF-8';
       <br>PRAGMA encoding = 'UTF-16';
       <br>PRAGMA encoding = 'UTF-16le';
       <br>PRAGMA encoding = 'UTF-16be';</b></p>
    <p>In first form, if the main database has already been
    created, then this pragma returns the text encoding used by the
    main database, one of 'UTF-8', 'UTF-16le' (little-endian UTF-16
    encoding) or 'UTF-16be' (big-endian UTF-16 encoding).  If the main
    database has not already been created, then the value returned is the
    text encoding that will be used to create the main database, if 
    it is created by this session.</p>

    <p>The second through fifth forms of this pragma
    set the encoding that the main database will be created with if
    it is created by this session. The string 'UTF-16' is interpreted
    as "UTF-16 encoding using native machine byte-ordering".  It is not
    possible to change the text encoding of a database after it has been
    created and any attempt to do so will be silently ignored.</p>

    <p>If no encoding is first set with this pragma,
    then the encoding with which the main database will be created
    defaults to one determined by the
    <a href="c3ref/open.html">API used to open the connection</a>.</p>

    <p>Once an encoding has been set for a database, it cannot be changed.</p>

    <p>Databases created by the <a href="lang_attach.html">ATTACH</a> command always use the same encoding
    as the main database.  An attempt to <a href="lang_attach.html">ATTACH</a> a database with a different
    text encoding from the "main" database will fail.</p>
<a name="pragma_foreign_key_check"></a>
<h _id=pragma_foreign_key_check style="display:none"> PRAGMA foreign_key_check</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>foreign_key_check;
        <br>PRAGMA </b><i>schema.</i><b>foreign_key_check(</b><i>table-name</i><b>);</b></b></p>

    <p>The foreign_key_check pragma checks the database, or the table
    called "<i>table-name</i>", for 
    <a href="foreignkeys.html">foreign key constraints</a> that are violated.  The foreign_key_check
    pragma returns one row output for each foreign key violation.
    There are four columns in each result row.
    The first column is the name of the table that contains the REFERENCES
    clause.  The second column is the <a href="lang_createtable.html#rowid">rowid</a> of the row that
    contains the invalid REFERENCES clause, or NULL if the child table is a
    <a href="withoutrowid.html">WITHOUT ROWID</a> table.  The third column is the name
    of the table that is referred to. The fourth column is the index of
    the specific foreign key constraint that failed.  The fourth column
    in the output of the foreign_key_check pragma is the same integer as
    the first column in the output of the <a href="pragma.html#pragma_foreign_key_list">foreign_key_list pragma</a>.
    When a "<i>table-name</i>" is specified, the only foreign key constraints
    checked are those created by REFERENCES clauses in the
    CREATE TABLE statement for <i>table-name</i>.</p>
<a name="pragma_foreign_key_list"></a>
<h _id=pragma_foreign_key_list style="display:none"> PRAGMA foreign_key_list</h><hr>
    <p><b>PRAGMA foreign_key_list(</b><i>table-name</i><b>);</b></p>

    <p>This pragma returns one row for each <a href="foreignkeys.html">foreign key constraint</a>
    created by a REFERENCES clause in the CREATE TABLE statement of
    table "<i>table-name</i>".
<a name="pragma_foreign_keys"></a>
<h _id=pragma_foreign_keys style="display:none"> PRAGMA foreign_keys</h><hr>
     <p><b>PRAGMA foreign_keys;
       <br>PRAGMA foreign_keys = </b><i>boolean</i><b>;</b></p>
    <p>Query, set, or clear the enforcement of <a href="foreignkeys.html">foreign key constraints</a>.

    <p>This pragma is a no-op within a transaction; foreign key constraint
       enforcement may only be enabled or disabled when there is no pending
       <a href="lang_transaction.html">BEGIN</a> or <a href="lang_savepoint.html">SAVEPOINT</a>.

    <p>Changing the foreign_keys setting affects the execution of
       all statements prepared
       using the database connection, including those prepared before the
       setting was changed. Any existing statements prepared using the legacy 
       <a href="c3ref/prepare.html">sqlite3_prepare()</a> interface may fail with an <a href="rescode.html#schema">SQLITE_SCHEMA</a> error
       after the foreign_keys setting is changed.

    <p>As of SQLite <a href="releaselog/3_6_19.html">version 3.6.19</a>, the default setting for foreign
       key enforcement is OFF.  However, that might change in a future
       release of SQLite.  The default setting for foreign key enforcement
       can be specified at compile-time using the <a href="compile.html#default_foreign_keys">SQLITE_DEFAULT_FOREIGN_KEYS</a>
       preprocessor macro.  To minimize future problems, applications should
       set the foreign key enforcement flag as required by the application
       and not depend on the default setting.
<a name="pragma_freelist_count"></a>
<h _id=pragma_freelist_count style="display:none"> PRAGMA freelist_count</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>freelist_count;</b></p>
    <p>Return the number of unused pages in the database file.</p>
<a name="pragma_full_column_names"></a>
<h _id=pragma_full_column_names style="display:none"> PRAGMA full_column_names</h><hr>
    <p><b>PRAGMA full_column_names;
       <br>PRAGMA full_column_names = </b><i>boolean</i><b>;</b></p>

    <p>Query or change the full_column_names flag. This flag together 
    with the <a href="pragma.html#pragma_short_column_names">short_column_names</a> flag determine
    the way SQLite assigns names to result columns of <a href="lang_select.html">SELECT</a> statements.
    Result columns are named by applying the following rules in order:
    <ol>
    <li><p>If there is an AS clause on the result, then the name of
        the column is the right-hand side of the AS clause.</p></li>
    <li><p>If the result is a general expression, not a just the name of
        a source table column,
        then the name of the result is a copy of the expression text.</p></li>
    <li><p>If the <a href="pragma.html#pragma_short_column_names">short_column_names</a> pragma is ON, then the name of the
        result is the name of the source table column without the 
        source table name prefix:  COLUMN.</p></li>
    <li><p>If both pragmas <a href="pragma.html#pragma_short_column_names">short_column_names</a> and <a href="pragma.html#pragma_full_column_names">full_column_names</a>
        are OFF then case (2) applies.
        </p></li>
    <li><p>The name of the result column is a combination of the source table
        and source column name:  TABLE.COLUMN</p></li>
    </ol>

    
    <p style='background-color: #ffd0d0;'>
    <b>This pragma is deprecated</b> and exists
    for backwards compatibility only.  New applications
    should avoid using this pragma.  Older applications should discontinue
    use of this pragma at the earliest opportunity.  This pragma may be omitted
    from the build when SQLite is compiled using <a href="compile.html#omit_deprecated">SQLITE_OMIT_DEPRECATED</a>.
    </p>
  
<a name="pragma_fullfsync"></a>
<h _id=pragma_fullfsync style="display:none"> PRAGMA fullfsync</h><hr>
    <p><b>PRAGMA fullfsync
       <br>PRAGMA fullfsync = </b><i>boolean</i><b>;</b></p>
    <p>Query or change the fullfsync flag. This flag
    determines whether or not the F_FULLFSYNC syncing method is used
    on systems that support it.  The default value of the fullfsync flag
    is off.  Only Mac OS X supports F_FULLFSYNC.</p>

    <p>See also <a href="pragma.html#pragma_checkpoint_fullfsync">checkpoint_fullfsync</a>.</p>
<a name="pragma_function_list"></a>
<h _id=pragma_function_list style="display:none"> PRAGMA function_list</h><hr>
    <p><b>PRAGMA function_list;</b>
    <p>This pragma returns a list of SQL functions
    known to the database connection.  Each row of the result
    describes a single calling signature for a single SQL function.
    Some SQL functions will have multiple rows in the result set
    if they can (for example) be invoked with a varying number of
    arguments or can accept text in various encodings.
<a name="pragma_hard_heap_limit"></a>
<h _id=pragma_hard_heap_limit style="display:none"> PRAGMA hard_heap_limit</h><hr>
    <p><b>PRAGMA hard_heap_limit<br>
          PRAGMA hard_heap_limit=</b><i>N</i></p>

    <p>This pragma invokes the <a href="c3ref/hard_heap_limit64.html">sqlite3_hard_heap_limit64()</a> interface with
    the argument N, if N is specified and N is a positive integer that
    is less than the current hard heap limit.
    The hard_heap_limit pragma always returns the same integer
    that would be returned by the <a href="c3ref/hard_heap_limit64.html">sqlite3_hard_heap_limit64</a>(-1) C-language
    function.  That is to say, it always returns the value of the hard
    heap limit that is set after any changes imposed by this PRAGMA.
    </p>

    <p>This pragma can only lower the heap limit, never raise it.
    The C-language interface <a href="c3ref/hard_heap_limit64.html">sqlite3_hard_heap_limit64()</a> must be used
    to raise the heap limit.</p>

    <p>See also the <a href="pragma.html#pragma_soft_heap_limit">soft_heap_limit pragma</a>.
<a name="pragma_ignore_check_constraints"></a>
<h _id=pragma_ignore_check_constraints style="display:none"> PRAGMA ignore_check_constraints</h><hr>
    <p><b>PRAGMA ignore_check_constraints  = </b><i>boolean</i><b>;</b></p>

    <p>This pragma enables or disables the enforcement of CHECK constraints.
    The default setting is off, meaning that CHECK constraints are
    enforced by default.</p>
<a name="pragma_incremental_vacuum"></a>
<h _id=pragma_incremental_vacuum style="display:none"> PRAGMA incremental_vacuum</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>incremental_vacuum</b><i>(N)</i><b>;<br>
      PRAGMA </b><i>schema.</i><b>incremental_vacuum;</b></p>
    <p>The incremental_vacuum pragma causes up to <i>N</i> pages to
    be removed from the <a href="fileformat2.html#freelist">freelist</a>.  The database file is truncated by
    the same amount.  The incremental_vacuum pragma has no effect if
    the database is not in
    <a href="#pragma_auto_vacuum">auto_vacuum=incremental</a> mode
    or if there are no pages on the freelist.  If there are fewer than
    <i>N</i> pages on the freelist, or if <i>N</i> is less than 1, or
    if the "(<i>N</i>)" argument is omitted, then the entire
    freelist is cleared.</p>
<a name="pragma_index_info"></a>
<h _id=pragma_index_info style="display:none"> PRAGMA index_info</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>index_info(</b><i>index-name</i><b>);</b></p>
    <p>This pragma returns one row for each key column in the named index.
    A key column is a column that is actually named in the <a href="lang_createindex.html">CREATE INDEX</a>
    index statement or <a href="lang_createtable.html#uniqueconst">UNIQUE constraint</a> or <a href="lang_createtable.html#primkeyconst">PRIMARY KEY constraint</a> that
    created the index.  Index entries also usually contain auxiliary
    columns that point back to the table row being indexed.  The auxiliary
    index-columns are not shown by the index_info pragma, but they are
    listed by the <a href="pragma.html#pragma_index_xinfo">index_xinfo pragma</a>.</p>

    <p>Output columns from the index_info pragma are as follows:
    <ol>
    <li>The rank of the column within the index.  (0 means left-most.)
    <li>The rank of the column within the table being indexed.
        A value of -1 means <a href="lang_createtable.html#rowid">rowid</a> and a value of -2 means that an
        <a href="expridx.html">expression</a> is being used.
    <li>The name of the column being indexed.  This columns is NULL
        if the column is the <a href="lang_createtable.html#rowid">rowid</a> or an <a href="expridx.html">expression</a>.
    </ol>

    <p>If there is no index named <i>index-name</i> but there is a
    <a href="withoutrowid.html">WITHOUT ROWID</a> table with that name, then (as of
    SQLite <a href="releaselog/3_30_0.html">version 3.30.0</a> on 2019-10-04) this pragma returns the
    PRIMARY KEY columns of the WITHOUT ROWID table as they are used
    in the records of the underlying b-tree, which is to say with
    duplicate columns removed.
<a name="pragma_index_list"></a>
<h _id=pragma_index_list style="display:none"> PRAGMA index_list</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>index_list(</b><i>table-name</i><b>);</b></p>
    <p>This pragma returns one row for each index associated with the
    given table.
    <p>Output columns from the index_list pragma are as follows:
    <ol>
    <li>A sequence number assigned to each index for internal tracking
          purposes.
    <li>The name of the index.
    <li>"1" if the index is UNIQUE and "0" if not.
    <li>"c" if the index was created by a <a href="lang_createindex.html">CREATE INDEX</a> statement,
          "u" if the index was created by a <a href="lang_createtable.html#uniqueconst">UNIQUE constraint</a>, or
          "pk" if the index was created by a <a href="lang_createtable.html#primkeyconst">PRIMARY KEY constraint</a>.
    <li>"1" if the index is a <a href="partialindex.html">partial index</a> and "0" if not.
    </ol>
    </p>
<a name="pragma_index_xinfo"></a>
<h _id=pragma_index_xinfo style="display:none"> PRAGMA index_xinfo</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>index_xinfo(</b><i>index-name</i><b>);</b></p>
    <p>This pragma returns information about every column in an index.
    Unlike this <a href="pragma.html#pragma_index_info">index_info pragma</a>, this pragma returns information about
    every column in the index, not just the key columns.
    (A key column is a column that is actually named in the <a href="lang_createindex.html">CREATE INDEX</a>
    index statement or <a href="lang_createtable.html#uniqueconst">UNIQUE constraint</a> or <a href="lang_createtable.html#primkeyconst">PRIMARY KEY constraint</a> that
    created the index.  Auxiliary columns are additional columns needed to
    locate the table entry that corresponds to each index entry.)

    <p>Output columns from the index_xinfo pragma are as follows:
    <ol>
    <li>The rank of the column within the index. (0 means left-most.
         Key columns come before auxiliary columns.)
    <li>The rank of the column within the table being indexed, or -1 if
         the index-column is the <a href="lang_createtable.html#rowid">rowid</a> of the table being indexed and -2
         if the <a href="expridx.html">index is on an expression</a>.
    <li>The name of the column being indexed, or NULL if the index-column
         is the <a href="lang_createtable.html#rowid">rowid</a> of the table being indexed or an
         <a href="expridx.html">expression</a>.
    <li>1 if the index-column is sorted in reverse (DESC) order by the
         index and 0 otherwise.
    <li>The name for the <a href="datatype3.html#collation">collating sequence</a>
         used to compare values in the index-column.
    <li>1 if the index-column is a key column and 0 if the index-column
         is an auxiliary column.
    </ol>

    <p>If there is no index named <i>index-name</i> but there is a
    <a href="withoutrowid.html">WITHOUT ROWID</a> table with that name, then (as of
    SQLite <a href="releaselog/3_30_0.html">version 3.30.0</a> on 2019-10-04) this pragma returns the
    columns of the WITHOUT ROWID table as they are used
    in the records of the underlying b-tree, which is to say with
    de-duplicated PRIMARY KEY columns first followed by data columns.
<a name="pragma_integrity_check"></a>
<h _id=pragma_integrity_check style="display:none"> PRAGMA integrity_check</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>integrity_check;
      <br>PRAGMA </b><i>schema.</i><b>integrity_check(</b><i>N</i><b>)
      <br>PRAGMA </b><i>schema.</i><b>integrity_check(</b><i>TABLENAME</i><b>)</b></p>
    <p>This pragma does a low-level formatting and consistency check
    of the database.  The integrity_check pragma look for:
    <ul>
    <li> Table or index entries that are out of sequence
    <li> Misformatted records
    <li> Missing pages
    <li> Missing or surplus index entries
    <li> UNIQUE, CHECK, and NOT NULL constraint errors
    <li> Integrity of the freelist
    <li> Sections of the database that are used more than once, or not at all
    </ul>
    <p>If the integrity_check pragma finds problems, strings are returned
    (as multiple rows with a single column per row) which describe
    the problems.  Pragma integrity_check will return at most <i>N</i>
    errors before the analysis quits, with N defaulting
    to 100.  If pragma integrity_check finds no errors, a
    single row with the value 'ok' is returned.</p>

    <p>The usual case is that the entire database file is checked.  However,
    if the argument is <i>TABLENAME</i>, then checking is only performed for the
    the table named and its associated indexes.
    This is called a "partial integrity check".  Because only a subset of the
    database is checked, errors such as unused sections of the file or duplication
    use of the same section of the file by two or more tables cannot be detected.
    The freelist is only verified on a
    partial integrity check if <i>TABLENAME</i> is <a href="schematab.html">sqlite_schema</a> or one of its
    aliases.  Support for partial integrity checks was added with
    version 3.33.0 (2020-08-14).

    <p>PRAGMA integrity_check does not find
    <a href="foreignkeys.html">FOREIGN KEY</a> errors.  
    Use the <a href="pragma.html#pragma_foreign_key_check">PRAGMA foreign_key_check</a> command to find errors in
    FOREIGN KEY constraints.</p>

    <p>See also the <a href="pragma.html#pragma_quick_check">PRAGMA quick_check</a> command which does most of the
    checking of PRAGMA integrity_check but runs much faster.</p>
<a name="pragma_journal_mode"></a>
<h _id=pragma_journal_mode style="display:none"> PRAGMA journal_mode</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>journal_mode;
        <br>PRAGMA </b><i>schema.</i><b>journal_mode
              = <i>DELETE | TRUNCATE | PERSIST | MEMORY | WAL | OFF</i></b></p>

    <p>This pragma queries or sets the journal mode for databases
    associated with the current <a href="c3ref/sqlite3.html">database connection</a>.</p>

    <p>The first form of this pragma queries the current journaling
    mode for <i>database</i>.  When <i>database</i> is omitted, the
    "main" database is queried.</p>

    <p>The second form changes the journaling mode for "<i>database</i>"
    or for all attached databases if "<i>database</i>" is omitted.
    The new journal mode is returned.  If the journal mode
    could not be changed, the original journal mode is returned.</p>

    <p>The DELETE journaling mode is the normal behavior.  In the DELETE
    mode, the rollback journal is deleted at the conclusion of each
    transaction.  Indeed, the delete operation is the action that causes
    the transaction to commit.
    (See the document titled <a href="atomiccommit.html">
    Atomic Commit In SQLite</a> for additional detail.)</p>

    <p>The TRUNCATE journaling mode commits transactions by truncating
    the rollback journal to zero-length instead of deleting it.  On many
    systems, truncating a file is much faster than deleting the file since
    the containing directory does not need to be changed.</p>

    <p>The PERSIST journaling mode prevents the rollback journal from
    being deleted at the end of each transaction.  Instead, the header
    of the journal is overwritten with zeros.  This will prevent other
    database connections from rolling the journal back.  The PERSIST
    journaling mode is useful as an optimization on platforms where
    deleting or truncating a file is much more expensive than overwriting
    the first block of a file with zeros.  See also:
    <a href="pragma.html#pragma_journal_size_limit">PRAGMA journal_size_limit</a> and <a href="compile.html#default_journal_size_limit">SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT</a>.</p>

    <p>The MEMORY journaling mode stores the rollback journal in 
    volatile RAM.  This saves disk I/O but at the expense of database
    safety and integrity.  If the application using SQLite crashes in
    the middle of a transaction when the MEMORY journaling mode is set,
    then the database file will very likely 
    <a href="howtocorrupt.html#cfgerr">go corrupt</a>.</p>

    <p>The WAL journaling mode uses a <a href="wal.html">write-ahead log</a> instead of a
    rollback journal to implement transactions.  The WAL journaling mode
    is persistent; after being set it stays in effect
    across multiple database connections and after closing and
    reopening the database.  A database in WAL journaling mode
    can only be accessed by SQLite <a href="releaselog/3_7_0.html">version 3.7.0</a> (2010-07-21)
    or later.</p>

    <p>The OFF journaling mode disables the rollback journal completely.
    No rollback journal is ever created and hence there is never a rollback
    journal to delete.  The OFF journaling mode disables the atomic
    commit and rollback capabilities of SQLite. The <a href="lang_transaction.html">ROLLBACK</a> command
    no longer works; it behaves in an undefined way.  Applications must
    avoid using the <a href="lang_transaction.html">ROLLBACK</a> command when the journal mode is OFF.
    If the application crashes
    in the middle of a transaction when the OFF journaling mode is
    set, then the database file will very likely
    <a href="howtocorrupt.html#cfgerr">go corrupt</a>. Without a journal, there is no way for
    a statement to unwind partially completed operations following
    a constraint error.  This might also leave the database in a corrupted
    state.  For example, if a duplicate entry causes a 
    <a href="lang_createindex.html">CREATE UNIQUE INDEX</a> statement to fail half-way through,
    it will leave behind a partially created, and hence corrupt, index.
    Because OFF journaling
    mode allows the database file to be corrupted using ordinary SQL,
    it is disabled when <a href="c3ref/c_dbconfig_defensive.html#sqlitedbconfigdefensive">SQLITE_DBCONFIG_DEFENSIVE</a> is enabled.</p>

    <p>Note that the journal_mode for an <a href="inmemorydb.html">in-memory database</a>
    is either MEMORY or OFF and can not be changed to a different value.
    An attempt to change the journal_mode of an <a href="inmemorydb.html">in-memory database</a> to
    any setting other than MEMORY or OFF is ignored.  Note also that
    the journal_mode cannot be changed while a transaction is active.</p>
<a name="pragma_journal_size_limit"></a>
<h _id=pragma_journal_size_limit style="display:none"> PRAGMA journal_size_limit</h><hr>
    <p><b>
    PRAGMA </b><i>schema.</i><b>journal_size_limit<br>
    PRAGMA </b><i>schema.</i><b>journal_size_limit = </b><i>N</i> <b>;</b>

  <p>If a database connection is operating in
  <a href="pragma.html#pragma_locking_mode">exclusive locking mode</a> or in
  <a href="pragma.html#pragma_journal_mode">persistent journal mode</a> 
  (PRAGMA journal_mode=persist) then
  after committing a transaction the <a href="lockingv3.html#rollback">rollback journal</a> file may remain in
  the file-system. This increases performance for subsequent transactions
  since overwriting an existing file is faster than append to a file,
  but it also consumes
  file-system space. After a large transaction (e.g. a <a href="lang_vacuum.html">VACUUM</a>),
  the rollback journal file may consume a very large amount of space.

  <p>Similarly, in <a href="wal.html">WAL mode</a>, the write-ahead log file is not truncated
  following a <a href="wal.html#ckpt">checkpoint</a>.  Instead, SQLite reuses the existing file
  for subsequent WAL entries since overwriting is faster than appending.

  <p>The journal_size_limit pragma may be used to limit the size of 
  rollback-journal and WAL files left
  in the file-system after transactions or checkpoints.
  Each time a transaction is committed or a WAL file resets, SQLite 
  compares the size of the rollback journal file or WAL file left in 
  the file-system to the size limit
  set by this pragma and if the journal or WAL file is larger 
  it is truncated to the limit.

  <p>The second form of the pragma listed above is used to set a new limit
  in bytes for the specified database.  A negative number implies no limit.
  To always truncate rollback journals and WAL files to their minimum size, 
  set the journal_size_limit to zero.
  Both the first and second forms of the pragma listed above return a single
  result row containing a single integer column - the value of the journal
  size limit in bytes. The default journal size limit is -1 (no limit).  The
  <a href="compile.html#default_journal_size_limit">SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT</a> preprocessor macro can be used to change
  the default journal size limit at compile-time.</p>

  <p>This pragma only operates on the single database specified prior
  to the pragma name (or on the "main" database if no database is specified.)
  There is no way to change the journal size limit on all attached databases
  using a single PRAGMA statement.  The size limit must be set separately for
  each attached database.
<a name="pragma_legacy_alter_table"></a>
<h _id=pragma_legacy_alter_table style="display:none"> PRAGMA legacy_alter_table</h><hr>
   <p><b>PRAGMA legacy_alter_table;
       <br>PRAGMA legacy_alter_table = <i>boolean</i></b></p>
    <p>This pragma sets or queries the value of the legacy_alter_table
    flag.  When this flag is on, the <a href="lang_altertable.html#altertabrename">ALTER TABLE RENAME</a>
    command (for changing the name of a table) works as it did
    in SQLite 3.24.0 (2018-06-04) and earlier.  More specifically,
    when this flag is on
    the <a href="lang_altertable.html#altertabrename">ALTER TABLE RENAME</a> command only rewrites the initial occurrence
    of the table name in its <a href="lang_createtable.html">CREATE TABLE</a> statement and in any associated
    <a href="lang_createindex.html">CREATE INDEX</a> and <a href="lang_createtrigger.html">CREATE TRIGGER</a> statements.  Other references to the
    table are unmodified, including:
    <ul>
    <li> References to the table within the bodies of triggers and views.
    <li> References to the table within CHECK constraints in the original
         CREATE TABLE statement.
    <li> References to the table within the WHERE clauses of <a href="partialindex.html">partial indexes</a>.
    </ul>
    The default setting for this pragma is OFF, which means that all
    references to the table anywhere in the schema are converted to the new name.
    <p>This pragma is provided as a work-around for older programs that
    contain code that expect the incomplete behavior
    of <a href="lang_altertable.html#altertabrename">ALTER TABLE RENAME</a> found in older versions of SQLite.
    New applications should leave this flag turned off.
    <p>For compatibility with older <a href="vtab.html">virtual table</a> implementations,
    this flag is turned on temporarily while the <a href="vtab.html#xrename">sqlite3_module.xRename</a>
    method is being run.  The value of this flag is restored after the 
    <a href="vtab.html#xrename">sqlite3_module.xRename</a> method finishes.
    <p>The legacy alter table behavior can also be toggled on and off
    using the <a href="c3ref/c_dbconfig_defensive.html#sqlitedbconfiglegacyaltertable">SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</a> option to the
    <a href="c3ref/db_config.html">sqlite3_db_config()</a> interface.
    <p>The legacy alter table behavior is a per-connection setting.  Turning
    this features on or off affects all attached database files within the
    <a href="c3ref/sqlite3.html">database connection</a>.
    The setting does not persist.  Changing this setting in one connection
    does not affect any other connections.
<a name="pragma_legacy_file_format"></a>
<h _id=pragma_legacy_file_format style="display:none"> PRAGMA legacy_file_format</h><hr>
   <p><b>PRAGMA legacy_file_format;</b>
    <p>This pragma no longer functions.  It has become a no-op.
    The capabilities formerly provided by PRAGMA legacy_file_format
    are now available using the <a href="c3ref/c_dbconfig_defensive.html#sqlitedbconfiglegacyfileformat">SQLITE_DBCONFIG_LEGACY_FILE_FORMAT</a>
    option to the <a href="c3ref/db_config.html">sqlite3_db_config()</a> C-language interface.
    <p>
<a name="pragma_locking_mode"></a>
<h _id=pragma_locking_mode style="display:none"> PRAGMA locking_mode</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>locking_mode;
    <br>PRAGMA </b><i>schema.</i><b>locking_mode
                = <i>NORMAL | EXCLUSIVE</i></b></p>
    <p>This pragma sets or queries the database connection locking-mode. 
    The locking-mode is either NORMAL or EXCLUSIVE.

    <p>In NORMAL locking-mode (the default unless overridden at compile-time
    using <a href="compile.html#default_locking_mode">SQLITE_DEFAULT_LOCKING_MODE</a>), a database connection
    unlocks the database file at the conclusion of each read or
    write transaction. When the locking-mode is set to EXCLUSIVE, the
    database connection never releases file-locks. The first time the
    database is read in EXCLUSIVE mode, a shared lock is obtained and 
    held. The first time the database is written, an exclusive lock is
    obtained and held.</p>

    <p>Database locks obtained by a connection in EXCLUSIVE mode may be
    released either by closing the database connection, or by setting the
    locking-mode back to NORMAL using this pragma and then accessing the
    database file (for read or write). Simply setting the locking-mode to
    NORMAL is not enough - locks are not released until the next time
    the database file is accessed.</p>

    <p>There are three reasons to set the locking-mode to EXCLUSIVE.
    <ol>
    <li>The application wants to prevent other processes from
        accessing the database file.
    <li>The number of system calls for filesystem operations is reduced,
        possibly resulting in a small performance increase.
    <li><a href="wal.html">WAL</a> databases can be accessed in EXCLUSIVE mode without the
        use of shared memory. 
        (<a href="wal.html#noshm">Additional information</a>)
    </ol>
    </p>

    <p>When the locking_mode pragma specifies a particular database,
    for example:</p>

    <blockquote>
PRAGMA <b>main.</b>locking_mode=EXCLUSIVE;
    </blockquote>

    <p>then the locking mode applies only to the named database.  If no
    database name qualifier precedes the "locking_mode" keyword then
    the locking mode is applied to all databases, including any new
    databases added by subsequent <a href="lang_attach.html">ATTACH</a> commands.</p>

   <p>The "temp" database (in which TEMP tables and indices are stored)
   and <a href="inmemorydb.html">in-memory databases</a>
   always uses exclusive locking mode.  The locking mode of temp and
   <a href="inmemorydb.html">in-memory databases</a> cannot
   be changed.  All other databases use the normal locking mode by default
   and are affected by this pragma.</p>

   <p>If the locking mode is EXCLUSIVE when first entering
   <a href="wal.html">WAL journal mode</a>, then the locking mode cannot be changed to
   NORMAL until after exiting WAL journal mode. 
   If the locking mode is NORMAL when first entering WAL
   journal mode, then the locking mode can be changed between NORMAL and
   EXCLUSIVE and back again at any time and without needing to exit
   WAL journal mode.</p>
<a name="pragma_max_page_count"></a>
<h _id=pragma_max_page_count style="display:none"> PRAGMA max_page_count</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>max_page_count;
        <br>PRAGMA </b><i>schema.</i><b>max_page_count = </b><i>N</i><b>;</b></p>
    <p>Query or set the maximum number of pages in the database file.
    Both forms of the pragma return the maximum page count.  The second
    form attempts to modify the maximum page count.  The maximum page
    count cannot be reduced below the current database size.
    </p>
<a name="pragma_mmap_size"></a>
<h _id=pragma_mmap_size style="display:none"> PRAGMA mmap_size</h><hr>
    <p><br><b>PRAGMA </b><i>schema.</i><b>mmap_size;
         <br>PRAGMA </b><i>schema.</i><b>mmap_size=</b><i>N</i></p>

    <p>Query or change the maximum number of bytes that are set
       aside for memory-mapped I/O on a single database.  The first form
       (without an argument) queries the current limit.  The second
       form (with a numeric argument) sets the limit for the specified
       database, or for all databases if the optional database name is
       omitted.  In the second form, if the database name is omitted, the
       limit that is set becomes the default limit for all databases that
       are added to the <a href="c3ref/sqlite3.html">database connection</a> by subsequent <a href="lang_attach.html">ATTACH</a>
       statements.</p>

    <p>The argument N is the maximum number of bytes of the database file
       that will be accessed using memory-mapped I/O.  If N is zero then
       memory mapped I/O is disabled.  If N is negative, then the limit
       reverts to the default value determined by the most recent
       <a href="c3ref/config.html">sqlite3_config</a>(<a href="c3ref/c_config_covering_index_scan.html#sqliteconfigmmapsize">SQLITE_CONFIG_MMAP_SIZE</a>), or to the compile
       time default determined by <a href="compile.html#default_mmap_size">SQLITE_DEFAULT_MMAP_SIZE</a> if not
       start-time limit has been set.</p>

    <p>The <a href="pragma.html#pragma_mmap_size">PRAGMA mmap_size</a> statement will never increase the amount
       of address space used for memory-mapped I/O above the
       hard limit set by the <a href="compile.html#max_mmap_size">SQLITE_MAX_MMAP_SIZE</a> compile-time option,
       nor the hard limit set at startup-time by the second argument to
       sqlite3_config(<a href="c3ref/c_config_covering_index_scan.html#sqliteconfigmmapsize">SQLITE_CONFIG_MMAP_SIZE</a>)</p>

    <p>The size of the memory-mapped I/O region cannot be changed while
       the memory-mapped I/O region is in active use, to avoid unmapping
       memory out from under running SQL statements.  For this reason,
       the mmap_size pragma may be a no-op if the prior mmap_size is non-zero
       and there are other SQL statements running concurrently on the same
       <a href="c3ref/sqlite3.html">database connection</a>.</p>
<a name="pragma_module_list"></a>
<h _id=pragma_module_list style="display:none"> PRAGMA module_list</h><hr>
    <p><b>PRAGMA module_list;</b>
    <p>This pragma returns a list of 
    <a href="vtab.html">virtual table</a> modules registered with the database connection.
<a name="pragma_optimize"></a>
<h _id=pragma_optimize style="display:none"> PRAGMA optimize</h><hr>
  <p><b>PRAGMA optimize;
       <br>PRAGMA optimize(</b><i>MASK</i><b>);
       <br>PRAGMA </b><i>schema</i><b>.optimize;
       <br>PRAGMA </b><i>schema</i><b>.optimize(</b><i>MASK</i><b>);</b></p>
  <p>Attempt to optimize the database.  All schemas are optimized in the 
  first two forms, and only the specified schema is optimized in the latter
  two.</p>
  <p>To achieve the best long-term query performance without the need to
  do a detailed engineering analysis of the application schema and SQL,
  it is recommended that applications run "PRAGMA optimize" (with no arguments)
  just before closing each <a href="c3ref/sqlite3.html">database connection</a>.  Long-running applications
  might also benefit from setting a timer to run "PRAGMA optimize" every
  few hours.
  </p>
  <p>This pragma is usually a no-op or nearly so and is very fast.
  However if SQLite feels
  that performing database optimizations (such as running <a href="lang_analyze.html">ANALYZE</a>
  or creating new indexes) will improve the performance of future queries, then
  some database I/O may be done.  Applications that want to limit the amount
  of work performed can set a timer that will invoke
  <a href="c3ref/interrupt.html">sqlite3_interrupt()</a> if the pragma goes on for too long.
  Or, since SQLite 3.32.0, the application can use 
  <a href="pragma.html#pragma_analysis_limit">PRAGMA analysis_limit=<i>N</i></a> for some small
  value of <i>N</i> (a few hundred or a few thousand) to limit the depth
  of analyze.
  </p>
  <p>The details of optimizations performed by this pragma are expected
  to change and improve over time.  Applications should anticipate that
  this pragma will perform new optimizations in future releases.</p>

  <p>The optional MASK argument is a bitmask of optimizations to perform:
  <ol>
  <li value='1'><p>
         Debugging mode.  Do not actually perform any optimizations
         but instead return one line of text for each optimization
         that would have been done.  Off by default.
  <li value='2'><p>
         Run <a href="lang_analyze.html">ANALYZE</a> on tables that might benefit.  On by default.
         See below for additional information.
  <li value='4'><p>
         <em>(Not yet implemented)</em>
         Record usage and performance 
         information from the current session in the
         database file so that it will be available to "optimize"
         pragmas run by future database connections.
  <li value='8'><p>
         <em>(Not yet implemented)</em>
         Create indexes that might have been helpful to recent queries.
  </ol>
  <p>The default MASK is and always shall be 0xfffe.  The 0xfffe mask means
  perform all of the optimizations listed above except Debug Mode.  If new
  optimizations are added in the future that should be off by default, those
  new optimizations will be given a mask of 0x10000 or larger.</p>

  <p>To see all optimizations that would have been done without actually
  doing them, run "PRAGMA optimize(-1)".  To use only the ANALYZE
  optimization, run "PRAGMA optimize(0x02)".</p>
  
  <p><b>Determination Of When To Run Analyze</b></p>
  <p> In the current implementation, a table is analyzed if and only if 
      all of the following are true:
  <ul>
  <li><p>
    MASK bit 0x02 is set.
  <li><p>
    The query planner used <a href="fileformat2.html#stat1tab">sqlite_stat1</a>-style statistics for one or
    more indexes of the table at some point during the lifetime of
    the current connection.
  <li><p>
    One or more indexes of the table are currently unanalyzed <em>or</em>
    the number of rows in the table has increased by 25 times or more
    since the last time ANALYZE was run.
  </ul>
  <p> The rules for when tables are analyzed are likely to change in
      future releases.
<a name="pragma_page_count"></a>
<h _id=pragma_page_count style="display:none"> PRAGMA page_count</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>page_count;</b></p>
    <p>Return the total number of pages in the database file.</p>
<a name="pragma_page_size"></a>
<h _id=pragma_page_size style="display:none"> PRAGMA page_size</h><hr>
   <p><b>PRAGMA </b><i>schema.</i><b>page_size;
       <br>PRAGMA </b><i>schema.</i><b>page_size = </b><i>bytes</i><b>;</b></p>
    <p>Query or set the page size of the database. The page
    size must be a power of two between 512 and 65536 inclusive.
    </p>

    <p>When a new database is created, SQLite assigns a page size to
    the database based on platform and filesystem.  For many years,
    the default page size was almost always 1024 bytes, but beginning
    with SQLite <a href="releaselog/3_12_0.html">version 3.12.0</a> (2016-03-29), 
    the default page size increased to 4096.
    The default page size is recommended for most applications.

    <p>Specifying a new page size does not change the page size
    immediately.  Instead, the new page size is remembered and is used
    to set the page size when the database is first created, if it does
    not already exist when the page_size pragma is issued, or at the
    next <a href="lang_vacuum.html">VACUUM</a> command that is run on the same database connection
    while not in <a href="wal.html">WAL mode</a>.</p>

    <p>The <a href="compile.html#default_page_size">SQLITE_DEFAULT_PAGE_SIZE</a> compile-time option can be used
    to change the default page size assigned to new databases.
<a name="pragma_parser_trace"></a>
<h _id=pragma_parser_trace style="display:none"> PRAGMA parser_trace</h><hr>
    <p><b>PRAGMA parser_trace = </b><i>boolean</i><b>; </b></p>

    <p>If SQLite has been compiled with the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time
    option, then the parser_trace pragma can be used to turn on tracing
    for the SQL parser used internally by SQLite.
    This feature is used for debugging SQLite itself.</p>

    
    <p style='background-color: #f0e0ff;'>
    This pragma is intended for use when debugging SQLite itself.  It
    is only available when the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time option
    is used.</p>
  
<a name="pragma_pragma_list"></a>
<h _id=pragma_pragma_list style="display:none"> PRAGMA pragma_list</h><hr>
    <p><b>PRAGMA pragma_list;</b>
    <p>This pragma returns a list of PRAGMA commands
    known to the database connection.
<a name="pragma_query_only"></a>
<h _id=pragma_query_only style="display:none"> PRAGMA query_only</h><hr>
    <p><b>PRAGMA query_only;
      <br>PRAGMA query_only = </b><i>boolean</i><b>;</b></p>

    <p>The query_only pragma prevents data changes on database files when
    enabled.  When this pragma is enabled, any attempt to CREATE, DELETE,
    DROP, INSERT, or UPDATE will result in an <a href="rescode.html#readonly">SQLITE_READONLY</a> error.
    However, the database is not truly read-only.  You can still run
    a <a href="wal.html#ckpt">checkpoint</a> or a <a href="lang_transaction.html">COMMIT</a> and the return value of the
    <a href="c3ref/db_readonly.html">sqlite3_db_readonly()</a> routine is not affected.
     </p>
<a name="pragma_quick_check"></a>
<h _id=pragma_quick_check style="display:none"> PRAGMA quick_check</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>quick_check;
      <br>PRAGMA </b><i>schema.</i><b>quick_check(</b><i>N</i><b>)</b>
      <br>PRAGMA </b><i>schema.</i><b>quick_check(</b><i>TABLENAME</i><b>)</b></p>
    <p>The pragma is like <a href="pragma.html#pragma_integrity_check">integrity_check</a> except that it does not verify
    UNIQUE constraints and does not verify
    that index content matches table content.  By skipping UNIQUE
    and index consistency checks, quick_check is able to run faster.
    PRAGMA quick_check runs in O(N) time whereas <a href="pragma.html#pragma_integrity_check">PRAGMA integrity_check</a>
    requires O(NlogN) time where N is the total number of rows in the 
    database. Otherwise the two pragmas are the same.
    </p>
<a name="pragma_read_uncommitted"></a>
<h _id=pragma_read_uncommitted style="display:none"> PRAGMA read_uncommitted</h><hr>
    <p><b>PRAGMA read_uncommitted;
       <br>PRAGMA read_uncommitted = </b><i>boolean</i><b>;</b></p>
    <p>Query, set, or clear READ UNCOMMITTED isolation. The default isolation
    level for SQLite is SERIALIZABLE.  Any process or thread can select
    READ UNCOMMITTED isolation, but SERIALIZABLE will still be used except
    between connections that share a common page and schema cache.
    Cache sharing is enabled using the <a href="c3ref/enable_shared_cache.html">sqlite3_enable_shared_cache()</a> API.
    Cache sharing is disabled by default.
    </p>

    <p>See <a href="sharedcache.html">SQLite Shared-Cache Mode</a> for additional information.</p>
<a name="pragma_recursive_triggers"></a>
<h _id=pragma_recursive_triggers style="display:none"> PRAGMA recursive_triggers</h><hr>
    <p><b>PRAGMA recursive_triggers;
       <br>PRAGMA recursive_triggers = </b><i>boolean</i><b>;</b></p>
    <p>Query, set, or clear the recursive trigger capability.

    <p>Changing the recursive_triggers setting affects the execution of
       all statements prepared
       using the database connection, including those prepared before the
       setting was changed. Any existing statements prepared using the legacy 
       <a href="c3ref/prepare.html">sqlite3_prepare()</a> interface may fail with an <a href="rescode.html#schema">SQLITE_SCHEMA</a> error
       after the recursive_triggers setting is changed.

    <p>Prior to SQLite <a href="releaselog/3_6_18.html">version 3.6.18</a> (2009-09-11), 
    recursive triggers were not supported.
    The behavior of SQLite was always as if this pragma was
    set to OFF.  Support for recursive triggers was added in version 3.6.18
    but was initially turned OFF by default, for compatibility.  Recursive
    triggers may be turned on by default in future versions of SQLite.
    </p>

    <p>The depth of recursion for triggers has a hard upper limit set by
    the <a href="limits.html#max_trigger_depth">SQLITE_MAX_TRIGGER_DEPTH</a> compile-time option and a run-time
    limit set by <a href="c3ref/limit.html">sqlite3_limit</a>(db,<a href="c3ref/c_limit_attached.html#sqlitelimittriggerdepth">SQLITE_LIMIT_TRIGGER_DEPTH</a>,...).</p>
<a name="pragma_reverse_unordered_selects"></a>
<h _id=pragma_reverse_unordered_selects style="display:none"> PRAGMA reverse_unordered_selects</h><hr>
    <p><b>PRAGMA reverse_unordered_selects;
       <br>PRAGMA reverse_unordered_selects = </b><i>boolean</i><b>;</b></p>
    <p>When enabled, this PRAGMA causes many <a href="lang_select.html">SELECT</a> statements without
    an ORDER BY clause to emit their results in the reverse order from what
    they normally would.  This can help debug applications that are
    making invalid assumptions about the result order.  
    The reverse_unordered_selects pragma works for most SELECT statements,
    however the query planner may sometimes choose an algorithm that is
    not easily reversed, in which case the output will appear in the same
    order regardless of the reverse_unordered_selects setting.
    <p>SQLite makes no
    guarantees about the order of results if a SELECT omits the ORDER BY
    clause.  Even so, the order of results does not change from one
    run to the next, and so many applications mistakenly come to depend
    on the arbitrary output order whatever that order happens to be.  However, 
    sometimes new versions of SQLite will contain optimizer enhancements
    that will cause the output order of queries without ORDER BY clauses
    to shift.  When that happens, applications that depend on a certain
    output order might malfunction.  By running the application multiple
    times with this pragma both disabled and enabled, cases where the
    application makes faulty assumptions about output order can be
    identified and fixed early, reducing problems
    that might be caused by linking against a different version of SQLite.
    </p>
<a name="pragma_schema_version"></a>
<h _id=pragma_schema_version style="display:none"> PRAGMA schema_version</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>schema_version; 
      <br>PRAGMA </b><i>schema.</i><b>schema_version = </b><i>integer </i>;

<p>   The schema_version pragma will get or set
       the value of the schema-version integer at offset 40 in the
       <a href="fileformat2.html#database_header">database header</a>. 

<p>    SQLite automatically increments the schema-version whenever the
       schema changes. As each SQL statement runs, the schema version is
       checked to ensure that the schema has not changed since the SQL
       statement was <a href="c3ref/prepare.html">prepared</a>.
       Subverting this mechanism by using "PRAGMA schema_version=N"
       to change the value of the schema_version
       may cause SQL statement to run using an obsolete schema,
       which can lead to incorrect answers and/or
       <a href="howtocorrupt.html#cfgerr">database corruption</a>.
       It is always safe to read the schema_version, but changing the
       schema_version can cause problems.  For this reason, attempts
       to change the value of schema_version are a silent no-op when
       <a href="c3ref/c_dbconfig_defensive.html#sqlitedbconfigdefensive">defensive mode</a> is enabled for a
       database connection.

       
    <p><span style='background-color: #ffff60;'>
    <b>Warning:</b>
    Misuse of this pragma can result in <a href="howtocorrupt.html#cfgerr">database corruption</a>.
    </span></p>
  

<p>    For the purposes of this pragma, the <a href="lang_vacuum.html">VACUUM</a> command is considered
       a schema change, since <a href="lang_vacuum.html">VACUUM</a> will usually alter the "rootpage"
       values for entries in the <a href="schematab.html">sqlite_schema table</a>.


<p>    See also the <a href="pragma.html#pragma_application_id">application_id pragma</a> and <a href="pragma.html#pragma_user_version">user_version pragma</a>.
<a name="pragma_secure_delete"></a>
<h _id=pragma_secure_delete style="display:none"> PRAGMA secure_delete</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>secure_delete;
     <br>PRAGMA </b><i>schema.</i><b>secure_delete = </b><i>boolean</i>|<b>FAST</b></p>
    <p>Query or change the secure-delete setting. When secure_delete is
    on, SQLite overwrites deleted content with zeros.  The default
    setting for secure_delete is determined by the <a href="compile.html#secure_delete">SQLITE_SECURE_DELETE</a>
    compile-time option and is normally off.  The off setting for
    secure_delete improves performance by reducing the number of CPU cycles
    and the amount of disk I/O.  Applications that wish to avoid leaving
    forensic traces after content is deleted or updated should enable the
    secure_delete pragma prior to performing the delete or update, or else
    run <a href="lang_vacuum.html">VACUUM</a> after the delete or update.

    <p>The "fast" setting for secure_delete (added circa 2017-08-01)
    is an intermediate setting in between "on" and "off".
    When secure_delete is set to "fast",
    SQLite will overwrite deleted content with zeros only if doing so
    does not increase the amount of I/O.  In other words, the "fast"
    setting uses more CPU cycles but does not use more I/O.
    This has the effect of purging all old content from <a href="fileformat2.html#btree">b-tree pages</a>,
    but leaving forensic traces on <a href="fileformat2.html#freelist">freelist pages</a>.

    <p>
    When there are <a href="lang_attach.html">attached databases</a> and no database
    is specified in the pragma, all databases have their secure-delete
    setting altered.
    The secure-delete setting for newly attached databases is the setting
    of the main database at the time the ATTACH command is evaluated.

    <p>
    When multiple database connections share the same cache, changing
    the secure-delete flag on one database connection changes it for them
    all.
    </p>

    <p><b>Limitation:</b>
    The secure_delete pragma only causes deleted content to be scrubbed
    from ordinary tables.  If <a href="vtab.html">virtual tables</a> store content in
    <a href="vtab.html#xshadowname">shadow tables</a>, then deleting content from the virtual table does
    not necessarily remove forensic traces from the shadow tables.
    In particular, the <a href="fts3.html">FTS3</a> and <a href="fts5.html">FTS5</a> virtual tables that come
    bundled with SQLite might leave forensic traces in their shadow tables
    even if the secure_delete pragma is enabled.
    </p>
<a name="pragma_short_column_names"></a>
<h _id=pragma_short_column_names style="display:none"> PRAGMA short_column_names</h><hr>
    <p><b>PRAGMA short_column_names;
       <br>PRAGMA short_column_names = </b><i>boolean</i><b>;</b></p>

    <p>Query or change the short-column-names flag. This flag affects
    the way SQLite names columns of data returned by <a href="lang_select.html">SELECT</a> statements.
    See the <a href="pragma.html#pragma_full_column_names">full_column_names</a> pragma for full details.
    </p>

    
    <p style='background-color: #ffd0d0;'>
    <b>This pragma is deprecated</b> and exists
    for backwards compatibility only.  New applications
    should avoid using this pragma.  Older applications should discontinue
    use of this pragma at the earliest opportunity.  This pragma may be omitted
    from the build when SQLite is compiled using <a href="compile.html#omit_deprecated">SQLITE_OMIT_DEPRECATED</a>.
    </p>
  
<a name="pragma_shrink_memory"></a>
<h _id=pragma_shrink_memory style="display:none"> PRAGMA shrink_memory</h><hr>
    <p><b>PRAGMA shrink_memory</b></p>

    <p>This pragma causes the database connection on which it is invoked
    to free up as much memory as it can, by calling
    <a href="c3ref/db_release_memory.html">sqlite3_db_release_memory()</a>.
    </p>
<a name="pragma_soft_heap_limit"></a>
<h _id=pragma_soft_heap_limit style="display:none"> PRAGMA soft_heap_limit</h><hr>
    <p><b>PRAGMA soft_heap_limit<br>
          PRAGMA soft_heap_limit=</b><i>N</i></p>

    <p>This pragma invokes the <a href="c3ref/hard_heap_limit64.html">sqlite3_soft_heap_limit64()</a> interface with
    the argument N, if N is specified and is a non-negative integer.
    The soft_heap_limit pragma always returns the same integer
    that would be returned by the <a href="c3ref/hard_heap_limit64.html">sqlite3_soft_heap_limit64</a>(-1) C-language
    function.
    </p>
    <p>See also the <a href="pragma.html#pragma_hard_heap_limit">hard_heap_limit pragma</a>.
<a name="pragma_stats"></a>
<h _id=pragma_stats style="display:none"> PRAGMA stats</h><hr>
    <p><b>PRAGMA stats;</b> </p>
    <p>This pragma returns auxiliary information about tables and
    indices.  The returned information is used during testing to help
    verify that the query planner is operating correctly.  The format
    and meaning of this pragma will likely change from one release
    to the next. Because of its volatility, the behavior and output
    format of this pragma are deliberately undocumented.</p>

    
    <p style='background-color: #f0e0ff;'>
    The intended use of this pragma is only for testing and validation of
    SQLite.  This pragma is subject to change without notice and is not
    recommended for use by application programs.</p>
  
<a name="pragma_synchronous"></a>
<h _id=pragma_synchronous style="display:none"> PRAGMA synchronous</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>synchronous;
        <br>PRAGMA </b><i>schema.</i><b>synchronous = </b>
          <i>0 | OFF | 1 | NORMAL | 2 | FULL | 3 | EXTRA</i><b>;</b></p>

    <p>Query or change the setting of the "synchronous" flag.
    The first (query) form will return the synchronous setting as an 
    integer.  The second form changes the synchronous setting.
    The meanings of the various synchronous settings are as follows:</p>
    <dl>
    <dt><b>EXTRA</b> (3)</dt>
    <dd>
    EXTRA synchronous is like FULL with the addition that the directory
    containing a <a href="lockingv3.html#rollback">rollback journal</a> is synced after that journal is unlinked
    to commit a transaction in DELETE mode.  EXTRA provides additional
    durability if the commit is followed closely by a power loss.</dd>
    <dt><b>FULL</b> (2)</dt>
    <dd>
    When synchronous is FULL (2), the SQLite database engine will
    use the xSync method of the <a href="vfs.html">VFS</a> to ensure that all content is safely
    written to the disk surface prior to continuing.
    This ensures that an operating system crash or power failure will
    not corrupt the database.
    FULL synchronous is very safe, but it is also slower.  FULL is the
    most commonly used synchronous setting when not in <a href="wal.html">WAL mode</a>.</dd>
    <dt><b>NORMAL</b> (1)</dt>
    <dd>
    When synchronous is NORMAL (1), the SQLite database
    engine will still sync at the most critical moments, but less often
    than in FULL mode.  There is a very small (though non-zero) chance that
    a power failure at just the wrong time could corrupt the database in
    <a href="pragma.html#pragma_journal_mode">journal_mode</a>=DELETE on an older filesystem.
    <a href="wal.html">WAL mode</a> is safe from corruption with synchronous=NORMAL, and probably
    DELETE mode is safe too on modern filesystems.  WAL mode is always consistent
    with synchronous=NORMAL, but WAL mode does lose durability.  A transaction
    committed in WAL mode with synchronous=NORMAL might roll back following
    a power loss or system crash.  Transactions are durable across application
    crashes regardless of the synchronous setting or journal mode.
    The synchronous=NORMAL setting is a good choice for most applications
    running in <a href="wal.html">WAL mode</a>.</dd>
    <dt><b>OFF</b> (0)</dt>
    <dd>
    With synchronous OFF (0), SQLite continues without syncing
    as soon as it has handed data off to the operating system.
    If the application running SQLite crashes, the data will be safe, but
    the database <a href="howtocorrupt.html#cfgerr">might become corrupted</a> if the operating system
    crashes or the computer loses power before that data has been written
    to the disk surface.  On the other hand, commits can be orders of
    magnitude faster with synchronous OFF.
    </dd></dl>
    </p>
 
    <p>In <a href="wal.html">WAL</a> mode when synchronous is NORMAL (1), the WAL file is
    synchronized before each <a href="wal.html#ckpt">checkpoint</a> and the database file is
    synchronized after each completed <a href="wal.html#ckpt">checkpoint</a> and the WAL file
    header is synchronized when a WAL file begins to be reused after
    a checkpoint, but no sync operations occur during most transactions.
    With synchronous=FULL in WAL mode, an additional
    sync operation of the WAL file happens after each transaction commit.
    The extra WAL sync following each transaction helps ensure that 
    transactions are durable across a power loss.  Transactions are
    consistent with or without the extra syncs provided by
    synchronous=FULL.
    If durability is not a concern, then synchronous=NORMAL is normally
    all one needs in WAL mode.</p>

    <p>The TEMP schema always has synchronous=OFF since the content of
    of TEMP is ephemeral and is not expected to survive a power outage.
    Attempts to change the synchronous setting for TEMP are
    silently ignored.

    <p>See also the <a href="pragma.html#pragma_fullfsync">fullfsync</a> and <a href="pragma.html#pragma_checkpoint_fullfsync">checkpoint_fullfsync</a> pragmas.</p>
<a name="pragma_table_info"></a>
<h _id=pragma_table_info style="display:none"> PRAGMA table_info</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>table_info(</b><i>table-name</i><b>);</b></p>
    <p>This pragma returns one row for each normal column
    in the named table.
    Columns in the result set include: "name" (its name); "type"
    (data type if given, else ''); "notnull" (whether or not the column
    can be NULL); "dflt_value" (the default value for the column);
    and "pk" (either zero for columns that are not part of the primary key,
    or the 1-based index of the column within the primary key).</p>
    <p>The "cid" column should not be taken to mean more than
    "rank within the current result set".</p>
    <p>The table named in the table_info pragma can also be a view.</p>
    <p>This pragma does not show information about <a href="gencol.html">generated columns</a> or
    <a href="vtab.html#hiddencol">hidden columns</a>.  Use <a href="pragma.html#pragma_table_xinfo">PRAGMA table_xinfo</a> to get a more complete list
    of columns that includes generated and hidden columns.
<a name="pragma_table_list"></a>
<h _id=pragma_table_list style="display:none"> PRAGMA table_list</h><hr>
    <p> <b>PRAGMA table_list;
         <br>PRAGMA </b><i>schema.</i><b>table_list;
         <br>PRAGMA table_list(</b><i>table-name</i><b>);</b></p>
    <p>This pragma returns information about the tables and views in the schema,
    one table per row of output.  The table_list pragma first appeared
    in SQLite version 3.37.0 (2021-11-27).  As of its initial release
    the columns returned by the table_list pragma include those listed below.
    Future versions of SQLite will probably add additional columns of
    output.
    <p>
    <ol>
    <li> <b>schema</b>: the schema in which the table or view appears
    (for example "main" or "temp").
    <li> <b>name</b>: the name of the table or view.
    <li> <b>type</b>: the type of object - one of "table", "view",
           "shadow" (for <a href="vtab.html#xshadowname">shadow tables</a>), or "virtual" for
           <a href="vtab.html">virtual tables</a>.
    <li> <b>ncol</b>: the number of columns in the table, including
         <a href="gencol.html">generated columns</a> and <a href="vtab.html#hiddencol">hidden columns</a>.
    <li> <b>wr</b>: 1 if the table is a <a href="withoutrowid.html">WITHOUT ROWID</a> table or 0 if is not.
    <li> <b>strict</b>: 1 if the table is a <a href="stricttables.html">STRICT table</a> or 0 if it is not.
    <li> <i>Additional columns will likely be added in future releases.</i>
    </ol>
    <p>
    The default behavior is to show all tables in all schemas.  If the
    <i>schema.</i> name appears before the pragma, then only tables in that
    one schema are shown.  If a <i>table-name</i> argument is supplied, then
    only information about that one table is returned.
<a name="pragma_table_xinfo"></a>
<h _id=pragma_table_xinfo style="display:none"> PRAGMA table_xinfo</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>table_xinfo(</b><i>table-name</i><b>);</b></p>
    <p>This pragma returns one row for each column in the named table,
    including <a href="gencol.html">generated columns</a> and <a href="vtab.html#hiddencol">hidden columns</a>.
    The output has the same columns as for <a href="pragma.html#pragma_table_info">PRAGMA table_info</a> plus
    a column, "hidden", whose value signifies a normal column (0),
    a dynamic or stored generated column (2 or 3),
    or a hidden column in a virtual table (1). The rows for which
    this field is non-zero are those omitted for <a href="pragma.html#pragma_table_info">PRAGMA table_info</a>.
<a name="pragma_temp_store"></a>
<h _id=pragma_temp_store style="display:none"> PRAGMA temp_store</h><hr>
    <p><b>PRAGMA temp_store;
        <br>PRAGMA temp_store = </b>
            <i>0 | DEFAULT | 1 | FILE | 2 | MEMORY</i><b>;</b></p>

    <p>Query or change the setting of the "<b>temp_store</b>" parameter.
    When temp_store is DEFAULT (0), the compile-time C preprocessor macro
    <a href="compile.html#temp_store">SQLITE_TEMP_STORE</a> is used to determine where temporary tables and indices
    are stored.  When
    temp_store is MEMORY (2) <a href="inmemorydb.html#temp_db">temporary tables</a> and indices are kept
    as if they were in pure <a href="inmemorydb.html">in-memory databases</a>.
    When temp_store is FILE (1) <a href="inmemorydb.html#temp_db">temporary tables</a> and indices are stored
    in a file.  The <a href="pragma.html#pragma_temp_store_directory">temp_store_directory</a> pragma can be used to specify
    the directory containing temporary files when
    <b>FILE</b> is specified.  When the temp_store setting is changed,
    all existing temporary tables, indices, triggers, and views are
    immediately deleted.</p>

    <p>It is possible for the library compile-time C preprocessor symbol
    <a href="compile.html#temp_store">SQLITE_TEMP_STORE</a> to override this pragma setting.
    The following table summarizes
    the interaction of the <a href="compile.html#temp_store">SQLITE_TEMP_STORE</a> preprocessor macro and the
    temp_store pragma:</p>

    <blockquote>
    <table cellpadding="2" border="1">
    <tr><th valign="bottom"><a href="compile.html#temp_store">SQLITE_TEMP_STORE</a></th>
        <th valign="bottom">PRAGMA<br>temp_store</th>
        <th>Storage used for<br>TEMP tables and indices</th></tr>
    <tr><td align="center">0</td>
        <td align="center"><em>any</em></td>
        <td align="center">file</td></tr>
    <tr><td align="center">1</td>
        <td align="center">0</td>
        <td align="center">file</td></tr>
    <tr><td align="center">1</td>
        <td align="center">1</td>
        <td align="center">file</td></tr>
    <tr><td align="center">1</td>
        <td align="center">2</td>
        <td align="center">memory</td></tr>
    <tr><td align="center">2</td>
        <td align="center">0</td>
        <td align="center">memory</td></tr>
    <tr><td align="center">2</td>
        <td align="center">1</td>
        <td align="center">file</td></tr>
    <tr><td align="center">2</td>
        <td align="center">2</td>
        <td align="center">memory</td></tr>
    <tr><td align="center">3</td>
        <td align="center"><em>any</em></td>
        <td align="center">memory</td></tr>
    </table>
    </blockquote>
<a name="pragma_temp_store_directory"></a>
<h _id=pragma_temp_store_directory style="display:none"> PRAGMA temp_store_directory</h><hr>
    <p><b>PRAGMA temp_store_directory;
      <br>PRAGMA temp_store_directory = '</b><i>directory-name</i><b>';</b></p>
    <p>Query or change the value of the <a href="c3ref/temp_directory.html">sqlite3_temp_directory</a> global
    variable, which many operating-system interface backends use to
    determine where to store <a href="inmemorydb.html#temp_db">temporary tables</a> and indices.</p>

    <p>When the temp_store_directory setting is changed, all existing temporary
    tables, indices, triggers, and viewers in the database connection that
    issued the pragma are immediately deleted.  In
    practice, temp_store_directory should be set immediately after the first
    database connection for a process is opened.  If the temp_store_directory
    is changed for one database connection while other database connections
    are open in the same process, then the behavior is undefined and
    probably undesirable.</p>

    <p>Changing the temp_store_directory setting is <u>not</u> threadsafe.
    Never change the temp_store_directory setting if another thread
    within the application is running any SQLite interface at the same time.
    Doing so results in undefined behavior.  Changing the temp_store_directory
    setting writes to the <a href="c3ref/temp_directory.html">sqlite3_temp_directory</a> global
    variable and that global variable is not protected by a mutex.</p>

    <p>The value <i>directory-name</i> should be enclosed in single quotes.
    To revert the directory to the default, set the <i>directory-name</i> to
    an empty string, e.g., <i>PRAGMA temp_store_directory = ''</i>.  An
    error is raised if <i>directory-name</i> is not found or is not
    writable. </p>

    <p>The default directory for temporary files depends on the OS.  Some
    OS interfaces may choose to ignore this variable and place temporary
    files in some other directory different from the directory specified
    here.  In that sense, this pragma is only advisory.</p>

    
    <p style='background-color: #ffd0d0;'>
    <b>This pragma is deprecated</b> and exists
    for backwards compatibility only.  New applications
    should avoid using this pragma.  Older applications should discontinue
    use of this pragma at the earliest opportunity.  This pragma may be omitted
    from the build when SQLite is compiled using <a href="compile.html#omit_deprecated">SQLITE_OMIT_DEPRECATED</a>.
    </p>
  
<a name="pragma_threads"></a>
<h _id=pragma_threads style="display:none"> PRAGMA threads</h><hr>
    <p><b>PRAGMA threads;
      <br>PRAGMA threads = </b><i>N</i><b>;</b></p>
    <p>Query or change the value of the 
    <a href="c3ref/limit.html">sqlite3_limit</a>(db,<a href="c3ref/c_limit_attached.html#sqlitelimitworkerthreads">SQLITE_LIMIT_WORKER_THREADS</a>,...) limit for
    the current database connection.  This limit sets an upper bound
    on the number of auxiliary threads that a <a href="c3ref/stmt.html">prepared statement</a> is
    allowed to launch to assist with a query.  The default limit is 0
    unless it is changed using the <a href="compile.html#default_worker_threads">SQLITE_DEFAULT_WORKER_THREADS</a>
    compile-time option.  When the limit is zero, that means no
    auxiliary threads will be launched.</p>

    <p>This pragma is a thin wrapper around the
    <a href="c3ref/limit.html">sqlite3_limit</a>(db,<a href="c3ref/c_limit_attached.html#sqlitelimitworkerthreads">SQLITE_LIMIT_WORKER_THREADS</a>,...) interface.
    </p>
<a name="pragma_trusted_schema"></a>
<h _id=pragma_trusted_schema style="display:none"> PRAGMA trusted_schema</h><hr>
    <p><b>PRAGMA trusted_schema;
      <br>PRAGMA trusted_schema = </b><i>boolean</i><b>;</b></p>
    <p>The trusted_schema setting is a per-connection boolean that
    determines whether or not SQL functions and virtual tables that
    have not been security audited are allowed to be run by views,
    triggers, or in expressions of the schema such as <a href="lang_createtable.html#ckconst">CHECK constraints</a>,
    <a href="lang_createtable.html#dfltval">DEFAULT clauses</a>, <a href="gencol.html">generated columns</a>, <a href="expridx.html">expression indexes</a>, and/or
    <a href="partialindex.html">partial indexes</a>.  This setting can also be controlled using
    the <a href="c3ref/db_config.html">sqlite3_db_config</a>(db,<a href="c3ref/c_dbconfig_defensive.html#sqlitedbconfigtrustedschema">SQLITE_DBCONFIG_TRUSTED_SCHEMA</a>,...)
    C-language interface.
    <p>In order to maintain backwards compatibility, this setting is
    ON by default.  There are advantages to turning it off, and most
    applications will be unaffected if it is turned off.  For that reason,
    all applications are encouraged to switch this setting off on every
    database connection as soon as that connection is opened.
    <p>The <a href="compile.html#trusted_schema">-DSQLITE_TRUSTED_SCHEMA=0</a> compile-time option will cause
    this setting to default to OFF.
<a name="pragma_user_version"></a>
<h _id=pragma_user_version style="display:none"> PRAGMA user_version</h><hr>
      <p><b>PRAGMA </b><i>schema.</i><b>user_version;
      <br>PRAGMA </b><i>schema.</i><b>user_version = </b><i>integer </i><b>;</b>

  
<p>    The user_version pragma will get or set
       the value of the user-version integer at offset 60 in the
       <a href="fileformat2.html#database_header">database header</a>.  The user-version is an integer that is
       available to applications to use however they want.  SQLite
       makes no use of the user-version itself.

<p>    See also the <a href="pragma.html#pragma_application_id">application_id pragma</a> and <a href="pragma.html#pragma_schema_version">schema_version pragma</a>.
<a name="pragma_vdbe_addoptrace"></a>
<h _id=pragma_vdbe_addoptrace style="display:none"> PRAGMA vdbe_addoptrace</h><hr>
    <p><b>PRAGMA vdbe_addoptrace = </b><i>boolean</i><b>;</b></p>

    <p>If SQLite has been compiled with the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time
    option, then the vdbe_addoptrace pragma can be used to cause a complete
    VDBE opcodes to be displayed as they are created during code generation.
    This feature is used for debugging SQLite itself.  See the 
    <a href="vdbe.html#trace">VDBE documentation</a> for more 
    information.</p>

    
    <p style='background-color: #f0e0ff;'>
    This pragma is intended for use when debugging SQLite itself.  It
    is only available when the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time option
    is used.</p>
  
<a name="pragma_vdbe_debug"></a>
<h _id=pragma_vdbe_debug style="display:none"> PRAGMA vdbe_debug</h><hr>
    <p><b>PRAGMA vdbe_debug = </b><i>boolean</i><b>;</b></p>

    <p>If SQLite has been compiled with the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time
    option, then the vdbe_debug pragma is a shorthand for three other
    debug-only pragmas: vdbe_addoptrace, vdbe_listing, and vdbe_trace.
    This feature is used for debugging SQLite itself.  See the 
    <a href="vdbe.html#trace">VDBE documentation</a> for more 
    information.</p>

    
    <p style='background-color: #f0e0ff;'>
    This pragma is intended for use when debugging SQLite itself.  It
    is only available when the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time option
    is used.</p>
  
<a name="pragma_vdbe_listing"></a>
<h _id=pragma_vdbe_listing style="display:none"> PRAGMA vdbe_listing</h><hr>
    <p><b>PRAGMA vdbe_listing = </b><i>boolean</i><b>;</b></p>

    <p>If SQLite has been compiled with the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time
    option, then the vdbe_listing pragma can be used to cause a complete
    listing of the virtual machine opcodes to appear on standard output
    as each statement is evaluated.
    With listing is on, the entire content of a program is printed
    just prior to beginning execution.  The statement
    executes normally after the listing is printed.
    This feature is used for debugging SQLite itself.  See the 
    <a href="vdbe.html#trace">VDBE documentation</a> for more 
    information.</p>

    
    <p style='background-color: #f0e0ff;'>
    This pragma is intended for use when debugging SQLite itself.  It
    is only available when the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time option
    is used.</p>
  
<a name="pragma_vdbe_trace"></a>
<h _id=pragma_vdbe_trace style="display:none"> PRAGMA vdbe_trace</h><hr>
    <p><b>PRAGMA vdbe_trace = </b><i>boolean</i><b>;</b></p>

    <p>If SQLite has been compiled with the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time
    option, then the vdbe_trace pragma can be used to cause virtual machine
    opcodes to be printed on standard output as they are evaluated.
    This feature is used for debugging SQLite.  See the 
    <a href="vdbe.html#trace">VDBE documentation</a> for more 
    information.</p>

    
    <p style='background-color: #f0e0ff;'>
    This pragma is intended for use when debugging SQLite itself.  It
    is only available when the <a href="compile.html#debug">SQLITE_DEBUG</a> compile-time option
    is used.</p>
  
<a name="pragma_wal_autocheckpoint"></a>
<h _id=pragma_wal_autocheckpoint style="display:none"> PRAGMA wal_autocheckpoint</h><hr>
    <p><b>PRAGMA wal_autocheckpoint;<br>
          PRAGMA wal_autocheckpoint=</b><i>N</i><b>;</b></p>

    <p>This pragma queries or sets the <a href="wal.html">write-ahead log</a> 
    <a href="wal.html#ckpt">auto-checkpoint</a> interval.
    When the <a href="wal.html">write-ahead log</a> is enabled (via the
    <a href="pragma.html#pragma_journal_mode">journal_mode pragma</a>) a checkpoint will be run automatically whenever
    the write-ahead log equals or exceeds <i>N</i> pages in length.
    Setting the auto-checkpoint size to zero or a negative value
    turns auto-checkpointing off.</p>
    
    <p>This pragma is a wrapper around the
    <a href="c3ref/wal_autocheckpoint.html">sqlite3_wal_autocheckpoint()</a> C interface.
    All automatic checkpoints are <a href="c3ref/wal_checkpoint_v2.html">PASSIVE</a>.</p>

    <p>Autocheckpointing is enabled by default with an interval
    of 1000 or <a href="compile.html#default_wal_autocheckpoint">SQLITE_DEFAULT_WAL_AUTOCHECKPOINT</a>.</p>

<a name="pragma_wal_checkpoint"></a>
<h _id=pragma_wal_checkpoint style="display:none"> PRAGMA wal_checkpoint</h><hr>
    <p><b>PRAGMA </b><i>schema.</i><b>wal_checkpoint;</b><br>
       <b>PRAGMA </b><i>schema.</i><b>wal_checkpoint(PASSIVE);</b><br>
       <b>PRAGMA </b><i>schema.</i><b>wal_checkpoint(FULL);</b><br>
       <b>PRAGMA </b><i>schema.</i><b>wal_checkpoint(RESTART);</b><br>
       <b>PRAGMA </b><i>schema.</i><b>wal_checkpoint(TRUNCATE);</b>
   </p>

    <p>If the <a href="wal.html">write-ahead log</a> is enabled (via the <a href="pragma.html#pragma_journal_mode">journal_mode pragma</a>),
    this pragma causes a <a href="wal.html#ckpt">checkpoint</a> operation to run on database
    <i>database</i>, or on all attached databases if <i>database</i>
    is omitted.  If <a href="wal.html">write-ahead log</a> mode is disabled, this pragma is a
    harmless no-op.</p>

    <p>Invoking this
    pragma without an argument is equivalent to calling the
    <a href="c3ref/wal_checkpoint.html">sqlite3_wal_checkpoint()</a> C interface.</p>
    Invoking this pragma with an argument is equivalent to calling the
    <a href="c3ref/wal_checkpoint_v2.html">sqlite3_wal_checkpoint_v2()</a> C interface with a 
    <a href="c3ref/c_checkpoint_full.html">3rd parameter</a>
    corresponding to the argument:

    <dl>
    <dt>PASSIVE<dd>
      Checkpoint as many frames as possible without waiting for any database 
      readers or writers to finish. Sync the db file if all frames in the log
      are checkpointed. This mode is the same as calling the
      <a href="c3ref/wal_checkpoint.html">sqlite3_wal_checkpoint()</a> C interface. The
      <a href="c3ref/busy_handler.html">busy-handler callback</a> is never invoked in
      this mode.
   
    <dt>FULL<dd>
      This mode blocks 
      (invokes the <a href="c3ref/busy_handler.html">busy-handler callback</a>)
      until there is no
      database writer and all readers are reading from the most recent database
      snapshot. It then checkpoints all frames in the log file and syncs the
      database file. FULL blocks concurrent writers while it is
      running, but readers can proceed.
   
    <dt>RESTART<dd>
      This mode works the same way as FULL with the addition that after 
      checkpointing the log file it blocks (calls the 
      <a href="c3ref/busy_handler.html">busy-handler callback</a>)
      until all readers are finished with the log file. This ensures 
      that the next client to write to the database file restarts the log file 
      from the beginning. RESTART blocks concurrent writers while it is
      running, but allowed readers to proceed.
   
    <dt>TRUNCATE<dd>
      This mode works the same way as RESTART with the 
      addition that the WAL file is truncated to zero bytes upon successful
      completion.
    </dl>


    <p>The wal_checkpoint pragma returns a single row with three
    integer columns.  The first column is usually 0 but will be
    1 if a RESTART or FULL or TRUNCATE checkpoint was blocked from completing,
    for example because another thread or process was actively
    using the database.  In other words, the first column is 0 if the
    equivalent call to <a href="c3ref/wal_checkpoint_v2.html">sqlite3_wal_checkpoint_v2()</a> would have returned
    <a href="rescode.html#ok">SQLITE_OK</a> or 1 if the equivalent call would have returned <a href="rescode.html#busy">SQLITE_BUSY</a>.
    The second column is the number of modified pages that have been
    written to the write-ahead log file.
    The third column is the number of pages in the write-ahead log file
    that have been successfully moved back into the database file at
    the conclusion of the checkpoint.
   The second and third column are -1 if there is no
    write-ahead log, for example if this pragma is invoked on a database
    connection that is not in <a href="wal.html">WAL mode</a>.</p>
<a name="pragma_writable_schema"></a>
<h _id=pragma_writable_schema style="display:none"> PRAGMA writable_schema</h><hr>
    <p><b>PRAGMA writable_schema  = </b><i>boolean</i><b>;</b><br>
         <b>PRAGMA writable_schema = RESET</b></p>

    <p>When this pragma is on, and the <a href="c3ref/c_dbconfig_defensive.html#sqlitedbconfigdefensive">SQLITE_DBCONFIG_DEFENSIVE</a> flag
    is off, then the <a href="schematab.html">sqlite_schema</a> table
    can be changed using ordinary <a href="lang_update.html">UPDATE</a>, <a href="lang_insert.html">INSERT</a>, and <a href="lang_delete.html">DELETE</a>
    statements.  If the argument is "RESET" then schema writing is
    disabled (as with "PRAGMA writable_schema=OFF") and, in addition, the
    schema is reloaded.  <span style='background-color: #ffff60;'><b>Warning:</b>
    misuse of this pragma can easily result in
    a <a href="howtocorrupt.html#cfgerr">corrupt database file</a>.</span>

<hr>
<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/pragma.in?m=9c64838456">2024-03-29 20:57:54</a> UTC </small></i></p>

Added Doc/Extra/Core/sqlite.css.















































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
/* Style sheet for the SQLite Website and Documentation */
* {box-sizing:border-box;}
@media screen and (max-width: 800px){
  body {margin: 2px;}
}
body {
  margin-top: 0;
  font-family: Verdana, sans-serif;
}

/* Horizonal rules */
.xhr {
  color: #044a64;
  height: 2px;
}

/* Hyperlinks that look like buttons */
.button {
  background-color: #ddd;
  border: 2px solid #aaa;
  text-decoration: none;
  border-radius: 4px;
  padding: 0 1ex 0 1ex;
  white-space: nowrap;
  font-size: 90%;
  line-height: 150%;
  color: black;
}
.button:visited {
  color: black;
}

/* Sidebars on the right-hand side of the screen */
.rightsidebar {
  padding-right: 1ex;
  margin: 1ex;
  float: right;
}

/* Border box */
.border2px {
  border: 2px solid #044a64;
}

.hdrfont {
  font-weight:bold;
  font-size:115%;
}
.nounderline a { text-decoration: none }

a { color: #044a64 }
a:visited { color: #734559 }

.logo { float: left; margin:1px; }
.tagline {
  float:right;
  text-align:right;
  font-style:italic;
  width:300px;
  margin:12px;
  margin-top:58px;
}

/* Style common to both the main and submenu */
.menu::before {
  content: "";
  clear: both;     /* Clear the Logo and TagLine */
  display: block;
}
.menu ul {
  margin: 0;
  list-style-type: none;
  padding: 0;
  overflow: hidden;
}
.menu ul li {
  color: white;
}
.menu ul li a {
  display: block;
  color: white;
  text-align: center;
  padding: 0.7ex 1.4ex;
  text-decoration: none;
}

/* Styling specific to the main menu */
.mainmenu ul {
  background-color: #044a64;
  border-radius: 8px;
}
.mainmenu ul li {
  float: left;
}
.mainmenu ul li.search {
  float: right;
}

/* Styling specific to the submenu */
.submenu {
  display: none;
}
.submenu ul {
  color: white;
}
.submenu ul li {
  float: none;
  border-radius: 8px;
  background-color: #0482c4;
  border-top: 2px solid white;
}

/* Styling for the search menu */
.searchmenu {
  width: 100%;
  text-align: right;
  display: none;
  float: none;
  padding: 1ex;
  background-color: #0482c4;
  border-radius: 8px;
}

/* Add the "mobileonly" class to any elements that should be visible
** on narrow-screen mobile devices only */
@media screen and (min-width: 600px){
  /* Settings for wide desktop screens */
  .mobileonly {display: none;}
}
/* Add the "desktoponly" class to any elements that should be visible
** on desktops with at least 600 pixels of horizontal space. */
@media screen and (max-width: 600px){
  /* Settings for narrow mobile screens */
  .desktoponly {display: none;}
}
/* Add the "wideonly" class to any elements that should be visible
** on wide-screen desktops with  */
@media screen and (max-width: 800px){
  /* Settings for screens that are less than 800px wide */
  .wideonly {display: none;}
}

.content    { margin: 5%; }
.content dt { font-weight:bold; }
.content dd { margin-bottom: 25px; margin-left:20%; }
.content ul { padding:0px; padding-left: 15px; margin:0px; }

/* Things for "fancyformat" documents start here. */
.fancy img+p {font-style:italic}
.fancy .codeblock {
  display: table;
  border: 1px solid #80a796;
  padding: 1ex;
  background-color: #eee;
}
.fancy .codeblock pre {
  display: table-cell;
  font-size: 1em;
}
.fancy .codeblock i { color: darkblue; }
.fancy h1,.fancy h2,.fancy h3,.fancy h4 {font-weight:normal;color:#044a64}
.fancy th {text-align:left;border-bottom:solid 1px #444}
.fancy th, .fancy td {padding: 0.2em 1ex; vertical-align:top}
.toct { color: #044a64 ! important; }
#toc_sub a        { color: #044a64; text-decoration: none }
#toc_sub { display: none; margin-top: 1em; }
.fancy .todo         { color: #AA3333 ; font-style : italic }
.fancy .todo:before  { content: 'TODO:' }
.fancy p.todo        { border: solid #AA3333 1px; padding: 1ex }
.fancy img { display:block; }
.fancy :link:hover, .fancy :visited:hover { background: wheat }
.fancy_title {
  font-size: 2em;
  text-align: center;
  color: #044a64;
}
.fancy_toc {
  margin-top: 1em;
}
.fancy_toc > a {
  margin: 1em;
  margin-left: 0;
  font-size: 1.5em;
  color: #044a64;
  text-decoration: none;
  cursor: pointer;
}
@media screen and (min-width: 600px){
  /* Indentation amounts for non-mobile screens, 600 pixels or wider */
  .fancy p,.fancy ul,.fancy ol,.fancy dl { margin: 1em 5ex }
  .fancy li p { margin: 1em 0 }
  .fancy blockquote { margin-left : 10ex }
  .toct {margin-left:4ex;}
  .fancy-toc1 {margin-left:6ex;}
  .fancy-toc2 {margin-left:12ex;}
  .fancy-toc3 {margin-left:18ex;}
  .fancy-toc4 {margin-left:24ex;}
  .fancy-toc5 {margin-left:30ex;}
  .fancy-toc6 {margin-left:36ex;}
  .fancy .codeblock {margin:0 10ex;}
  .fancy ol .codeblock {margin:0 5ex;}
  .fancy .imgcontainer {margin: 1em 5ex}
}
@media screen and (max-width: 600px){
  /* Indentation amounts for narrow mobile screens */
  .toct {margin-left:0;}
  .fancy-toc1 {padding-left:4ex;text-indent:-2ex;}
  .fancy-toc2 {padding-left:8ex;text-indent:-4ex;}
  .fancy-toc3 {padding-left:12ex;text-indent:-6ex;}
  .fancy-toc4 {padding-left:16ex;text-indent:-8ex;}
  .fancy-toc5 {padding-left:20ex;text-indent:-10ex;}
  .fancy-toc6 {padding-left:24ex;text-indent:-12ex;}
  .lessindent {padding-left: 1em; margin-left: 0;}
  .fancy .codeblock {margin:0 1ex;}
}
/* End of "fancyformat" specific rules. */

/* <ul> elements used for multi-column lists */
.multicol_list {padding-left:1em;margin-left:0;}

.yyterm {
  background: #fff;
  border: 1px solid #000;
  border-radius: 11px;
  padding-left: 4px;
  padding-right: 4px;
  line-height: 125%;
}
.yynonterm {
  background: #fff;
  border: 1px solid #000;
  padding-left: 2px;
  padding-right: 2px;
  line-height: 125%;
}

/* Container for an image */
.imgcontainer img {
  max-height: 100%;
  max-width: 100%;
}

/* Default fill and stroke for SVG paths */
polygon { fill: black; stroke:#111111; stroke-width:1 }
path { fill: none; stroke:#111111; stroke-width:1 }

.doccat a {
  color: #044a64 ;
  text-decoration: none;
}
.doccat h {
  font-weight: bold;
}
.doccat h a {
  font-size: smaller;
  color: black;
}
.doccat {
  padding-left: 2ex;
  padding-right: 2ex;
  white-space:nowrap;
}
.doccat li {
  list-style-type: none;
  font-size: smaller;
  line-height: 150%; 
}
.doccat ul {
  margin-top: 0.5em;
}

.footer {
  padding-top: 2px;
  padding-bottom: 1px;
  border-top: 2px solid #044a64;
}

th.sort:after {
  margin-left: .4em;
  cursor: pointer;
  text-shadow: 0 0 0 #000; /* Makes arrow darker */
}
th.sort.none:after {
  content: '\2666';
}
th.sort.asc:after {
  content: '\2193';
}
th.sort.desc:after {
  content: '\2191'
}

div.columns {
  padding: 0 2em 0 2em;
  max-width: 2000px;
}
div.columns > ul {
  margin: 0;
  padding: 0 0 0 1em;
  list-style-type: none;
  padding: 10px;
  margin: 0px;
  white-space: nowrap;
}
div.columns > ul li:first-child {
  margin-top:0px;
}
.columns li {
  break-inside: avoid;
  page-break-inside: avoid;
}

Added Doc/Extra/Core/syntax.html.















































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>List of SQLite Syntax Diagrams</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>


<h1 align="center">List of SQLite Syntax Diagrams</h1>

<div class='columns' style='columns: 15em auto;'>
<ul style='padding-top:0;'>
<li><a href='syntax/aggregate-function-invocation.html'>aggregate-function-invocation</a></li>
<li><a href='syntax/alter-table-stmt.html'>alter-table-stmt</a></li>
<li><a href='syntax/analyze-stmt.html'>analyze-stmt</a></li>
<li><a href='syntax/attach-stmt.html'>attach-stmt</a></li>
<li><a href='syntax/begin-stmt.html'>begin-stmt</a></li>
<li><a href='syntax/column-constraint.html'>column-constraint</a></li>
<li><a href='syntax/column-def.html'>column-def</a></li>
<li><a href='syntax/column-name-list.html'>column-name-list</a></li>
<li><a href='syntax/comment-syntax.html'>comment-syntax</a></li>
<li><a href='syntax/commit-stmt.html'>commit-stmt</a></li>
<li><a href='syntax/common-table-expression.html'>common-table-expression</a></li>
<li><a href='syntax/compound-operator.html'>compound-operator</a></li>
<li><a href='syntax/compound-select-stmt.html'>compound-select-stmt</a></li>
<li><a href='syntax/conflict-clause.html'>conflict-clause</a></li>
<li><a href='syntax/create-index-stmt.html'>create-index-stmt</a></li>
<li><a href='syntax/create-table-stmt.html'>create-table-stmt</a></li>
<li><a href='syntax/create-trigger-stmt.html'>create-trigger-stmt</a></li>
<li><a href='syntax/create-view-stmt.html'>create-view-stmt</a></li>
<li><a href='syntax/create-virtual-table-stmt.html'>create-virtual-table-stmt</a></li>
<li><a href='syntax/cte-table-name.html'>cte-table-name</a></li>
<li><a href='syntax/delete-stmt.html'>delete-stmt</a></li>
<li><a href='syntax/delete-stmt-limited.html'>delete-stmt-limited</a></li>
<li><a href='syntax/detach-stmt.html'>detach-stmt</a></li>
<li><a href='syntax/drop-index-stmt.html'>drop-index-stmt</a></li>
<li><a href='syntax/drop-table-stmt.html'>drop-table-stmt</a></li>
<li><a href='syntax/drop-trigger-stmt.html'>drop-trigger-stmt</a></li>
<li><a href='syntax/drop-view-stmt.html'>drop-view-stmt</a></li>
<li><a href='syntax/expr.html'>expr</a></li>
<li><a href='syntax/factored-select-stmt.html'>factored-select-stmt</a></li>
<li><a href='syntax/filter-clause.html'>filter-clause</a></li>
<li><a href='syntax/foreign-key-clause.html'>foreign-key-clause</a></li>
<li><a href='syntax/frame-spec.html'>frame-spec</a></li>
<li><a href='syntax/function-arguments.html'>function-arguments</a></li>
<li><a href='syntax/indexed-column.html'>indexed-column</a></li>
<li><a href='syntax/insert-stmt.html'>insert-stmt</a></li>
<li><a href='syntax/join-clause.html'>join-clause</a></li>
<li><a href='syntax/join-constraint.html'>join-constraint</a></li>
<li><a href='syntax/join-operator.html'>join-operator</a></li>
<li><a href='syntax/literal-value.html'>literal-value</a></li>
<li><a href='syntax/numeric-literal.html'>numeric-literal</a></li>
<li><a href='syntax/ordering-term.html'>ordering-term</a></li>
<li><a href='syntax/over-clause.html'>over-clause</a></li>
<li><a href='syntax/pragma-stmt.html'>pragma-stmt</a></li>
<li><a href='syntax/pragma-value.html'>pragma-value</a></li>
<li><a href='syntax/qualified-table-name.html'>qualified-table-name</a></li>
<li><a href='syntax/raise-function.html'>raise-function</a></li>
<li><a href='syntax/recursive-cte.html'>recursive-cte</a></li>
<li><a href='syntax/reindex-stmt.html'>reindex-stmt</a></li>
<li><a href='syntax/release-stmt.html'>release-stmt</a></li>
<li><a href='syntax/result-column.html'>result-column</a></li>
<li><a href='syntax/returning-clause.html'>returning-clause</a></li>
<li><a href='syntax/rollback-stmt.html'>rollback-stmt</a></li>
<li><a href='syntax/savepoint-stmt.html'>savepoint-stmt</a></li>
<li><a href='syntax/select-core.html'>select-core</a></li>
<li><a href='syntax/select-stmt.html'>select-stmt</a></li>
<li><a href='syntax/signed-number.html'>signed-number</a></li>
<li><a href='syntax/simple-function-invocation.html'>simple-function-invocation</a></li>
<li><a href='syntax/simple-select-stmt.html'>simple-select-stmt</a></li>
<li><a href='syntax/sql-stmt.html'>sql-stmt</a></li>
<li><a href='syntax/sql-stmt-list.html'>sql-stmt-list</a></li>
<li><a href='syntax/table-constraint.html'>table-constraint</a></li>
<li><a href='syntax/table-options.html'>table-options</a></li>
<li><a href='syntax/table-or-subquery.html'>table-or-subquery</a></li>
<li><a href='syntax/type-name.html'>type-name</a></li>
<li><a href='syntax/update-stmt.html'>update-stmt</a></li>
<li><a href='syntax/update-stmt-limited.html'>update-stmt-limited</a></li>
<li><a href='syntax/upsert-clause.html'>upsert-clause</a></li>
<li><a href='syntax/vacuum-stmt.html'>vacuum-stmt</a></li>
<li><a href='syntax/window-defn.html'>window-defn</a></li>
<li><a href='syntax/window-function-invocation.html'>window-function-invocation</a></li>
<li><a href='syntax/with-clause.html'>with-clause</a></li>
</ul>
</div>



Added Doc/Extra/Core/syntax/aggregate-function-invocation.html.





























































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: aggregate-function-invocation</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>aggregate-function-invocation</h1>
<div class='imgcontainer'>
<div style="max-width:909px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 909.533 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,71L156,71A15 15 0 0 0 171 56A15 15 0 0 0 156 41L47,41A15 15 0 0 0 32 56A15 15 0 0 0 47 71Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="102" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">aggregate-func</text>
<polygon points="189,56 178,60 178,52" style="fill:rgb(0,0,0)"/>
<path d="M171,56L183,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M204,71A15 15 0 0 0 219 56A15 15 0 0 0 204 41A15 15 0 0 0 189 56A15 15 0 0 0 204 71Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="56" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="242,56 231,60 231,52" style="fill:rgb(0,0,0)"/>
<path d="M219,56L237,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="277,26 265,30 265,22" style="fill:rgb(0,0,0)"/>
<path d="M242,56 L 248,56 Q 254,56 254,41 L 254,41 Q 254,26 263,26 L 271,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M292,41L360,41A15 15 0 0 0 376 26L376,26A15 15 0 0 0 360 11L292,11A15 15 0 0 0 277 26L277,26A15 15 0 0 0 292 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="326" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="394,26 382,30 382,22" style="fill:rgb(0,0,0)"/>
<path d="M376,26L388,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="428,56 417,60 417,52" style="fill:rgb(0,0,0)"/>
<path d="M394,26 L 399,26 Q 405,26 405,41 L 405,41 Q 405,56 414,56 L 422,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="464,56 453,60 453,52" style="fill:rgb(0,0,0)"/>
<path d="M428,56L458,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M464,71L513,71L513,41L464,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="489" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="657,56 646,60 646,52" style="fill:rgb(0,0,0)"/>
<path d="M513,56L652,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M672,71A15 15 0 0 0 688 56A15 15 0 0 0 672 41A15 15 0 0 0 657 56A15 15 0 0 0 672 71Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="56" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="734,86 722,91 722,82" style="fill:rgb(0,0,0)"/>
<path d="M688,56 L 699,56 Q 711,56 711,71 L 711,71 Q 711,86 719,86 L 728,86"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,101L846,101L846,71L734,71Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="790" y="86" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="900,56 888,60 888,52" style="fill:rgb(0,0,0)"/>
<path d="M846,86 L 855,86 Q 864,86 864,71 L 864,71 Q 864,56 879,56 L 879,56 L 894,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="903" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="790,56 778,60 778,52" style="fill:rgb(0,0,0)"/>
<path d="M688,56L784,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="900,56 888,60 888,52" style="fill:rgb(0,0,0)"/>
<path d="M790,56L894,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="326,56 315,60 315,52" style="fill:rgb(0,0,0)"/>
<path d="M242,56L321,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="428,56 417,60 417,52" style="fill:rgb(0,0,0)"/>
<path d="M326,56L422,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,32A15 15 0 0 0 504 17A15 15 0 0 0 489 2A15 15 0 0 0 474 17A15 15 0 0 0 489 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="489" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="504,17 515,12 515,21" style="fill:rgb(0,0,0)"/>
<path d="M513,56 L 525,56 Q 536,56 536,41 L 536,32 Q 536,17 523,17 L 510,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="464,56 453,60 453,52" style="fill:rgb(0,0,0)"/>
<path d="M474,17 L 456,17 Q 441,17 441,32 L 441,41 Q 441,56 450,56 L 458,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,207A15 15 0 0 0 453 192A15 15 0 0 0 438 177A15 15 0 0 0 423 192A15 15 0 0 0 438 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="423,192 412,196 412,188" style="fill:rgb(0,0,0)"/>
<path d="M242,56 L 248,56 Q 254,56 254,71 L 254,177 Q 254,192 269,192 L 402,192 L 417,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="489,192 477,196 477,188" style="fill:rgb(0,0,0)"/>
<path d="M453,192L483,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,192 L 570,192 Q 585,192 600,192 L 605,192 Q 620,192 620,177 L 620,71 Q 620,56 626,56 L 631,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="438,216 427,221 427,212" style="fill:rgb(0,0,0)"/>
<path d="M326,192 L 392,192 Q 407,192 407,204 Q 407,216 420,216 L 433,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,216 L 453,216 Q 467,216 467,204 Q 467,192 473,192 L 479,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="300,117 289,121 289,112" style="fill:rgb(0,0,0)"/>
<path d="M513,56 L 523,56 Q 533,56 533,71 L 533,71 Q 533,86 518,86 L 292,86 Q 277,86 277,101 L 277,102 Q 277,117 286,117 L 294,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M315,132L360,132A15 15 0 0 0 375 117A15 15 0 0 0 360 101L315,101A15 15 0 0 0 300 117A15 15 0 0 0 315 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="392,117 381,121 381,112" style="fill:rgb(0,0,0)"/>
<path d="M375,117L386,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,132L411,132A15 15 0 0 0 426 117A15 15 0 0 0 411 101L407,101A15 15 0 0 0 392 117A15 15 0 0 0 407 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="455,117 444,121 444,112" style="fill:rgb(0,0,0)"/>
<path d="M426,117L449,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,132L585,132L585,101L455,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="520" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M520,169A15 15 0 0 0 535 154A15 15 0 0 0 520 139A15 15 0 0 0 505 154A15 15 0 0 0 520 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="520" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="535,154 547,150 547,159" style="fill:rgb(0,0,0)"/>
<path d="M585,117 L 591,117 Q 597,117 597,132 L 597,139 Q 597,154 582,154 L 556,154 L 541,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="455,117 444,121 444,112" style="fill:rgb(0,0,0)"/>
<path d="M505,154 L 470,154 Q 455,154 447,154 Q 438,154 438,139 L 438,132 Q 438,117 444,117 L 449,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,117 L 594,117 Q 602,117 602,102 L 602,71 Q 602,56 617,56 L 623,56 L 638,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>
<br></br>
References:&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./filter-clause.html'>filter-clause</a>&nbsp;&nbsp; <a href='./ordering-term.html'>ordering-term</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_aggfunc.html'>lang_aggfunc.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>
</div>



Added Doc/Extra/Core/syntax/alter-table-stmt.html.



















































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: alter-table-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>alter-table-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:754px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 754.521 320.904">
<circle cx="5" cy="32" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="37,32 26,37 26,28" style="fill:rgb(0,0,0)"/>
<path d="M9,32L31,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M37,32L59,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47L113,47A15 15 0 0 0 129 32A15 15 0 0 0 113 17L74,17A15 15 0 0 0 59 32A15 15 0 0 0 74 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="94" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALTER</text>
<polygon points="165,32 153,37 153,28" style="fill:rgb(0,0,0)"/>
<path d="M129,32L159,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,47L219,47A15 15 0 0 0 234 32A15 15 0 0 0 219 17L180,17A15 15 0 0 0 165 32A15 15 0 0 0 180 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TABLE</text>
<polygon points="251,32 240,37 240,28" style="fill:rgb(0,0,0)"/>
<path d="M234,32L245,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="287,32 276,37 276,28" style="fill:rgb(0,0,0)"/>
<path d="M251,32L281,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M302,47L399,47A15 15 0 0 0 414 32A15 15 0 0 0 399 17L302,17A15 15 0 0 0 287 32A15 15 0 0 0 302 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="436,32 425,37 425,28" style="fill:rgb(0,0,0)"/>
<path d="M414,32L431,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M452,47A15 15 0 0 0 467 32A15 15 0 0 0 452 17A15 15 0 0 0 436 32A15 15 0 0 0 452 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="452" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="503,32 491,37 491,28" style="fill:rgb(0,0,0)"/>
<path d="M467,32L497,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M518,47L593,47A15 15 0 0 0 608 32A15 15 0 0 0 593 17L518,17A15 15 0 0 0 503 32A15 15 0 0 0 518 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="555" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="376,6 364,10 364,2" style="fill:rgb(0,0,0)"/>
<path d="M251,32 L 260,32 Q 268,32 268,19 Q 268,6 283,6 L 355,6 L 370,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,6 L 461,6 Q 476,6 476,19 Q 476,32 489,32 L 503,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="626,56 622,45 630,45" style="fill:rgb(0,0,0)"/>
<path d="M608,32 L 617,32 Q 626,32 626,41 L 626,51"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,81 362,76 362,85" style="fill:rgb(0,0,0)"/>
<path d="M626,56 L 626,68 Q 626,81 611,81 L 371,81 L 356,81"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,81 L 20,81 Q 5,81 5,88 L 5,96"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="41,126 30,130 30,122" style="fill:rgb(0,0,0)"/>
<path d="M5,96 L 5,111 Q 5,126 20,126 L 20,126 L 36,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M56,141L117,141A15 15 0 0 0 132 126A15 15 0 0 0 117 111L56,111A15 15 0 0 0 41 126A15 15 0 0 0 56 141Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="126" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RENAME</text>
<polygon points="150,126 139,130 139,122" style="fill:rgb(0,0,0)"/>
<path d="M132,126L144,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,141L171,141A15 15 0 0 0 186 126A15 15 0 0 0 171 111L165,111A15 15 0 0 0 150 126A15 15 0 0 0 165 141Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="126" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TO</text>
<polygon points="204,126 193,130 193,122" style="fill:rgb(0,0,0)"/>
<path d="M186,126L198,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,141L334,141A15 15 0 0 0 349 126A15 15 0 0 0 334 111L219,111A15 15 0 0 0 204 126A15 15 0 0 0 219 141Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="277" y="126" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">new-table-name</text>
<polygon points="41,171 30,176 30,167" style="fill:rgb(0,0,0)"/>
<path d="M5,96 L 5,156 Q 5,171 20,171 L 21,171 L 36,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M56,186L117,186A15 15 0 0 0 132 171A15 15 0 0 0 117 156L56,156A15 15 0 0 0 41 171A15 15 0 0 0 56 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RENAME</text>
<polygon points="149,171 138,176 138,167" style="fill:rgb(0,0,0)"/>
<path d="M132,171L143,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="185,171 174,176 174,167" style="fill:rgb(0,0,0)"/>
<path d="M149,171L179,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,186L263,186A15 15 0 0 0 278 171A15 15 0 0 0 263 156L200,156A15 15 0 0 0 185 171A15 15 0 0 0 200 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="232" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLUMN</text>
<polygon points="314,171 303,176 303,167" style="fill:rgb(0,0,0)"/>
<path d="M278,171L308,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M329,186L423,186A15 15 0 0 0 439 171A15 15 0 0 0 423 156L329,156A15 15 0 0 0 314 171A15 15 0 0 0 329 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="376" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="457,171 445,176 445,167" style="fill:rgb(0,0,0)"/>
<path d="M439,171L451,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,186L477,186A15 15 0 0 0 492 171A15 15 0 0 0 477 156L472,156A15 15 0 0 0 457 171A15 15 0 0 0 472 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="475" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TO</text>
<polygon points="510,171 499,176 499,167" style="fill:rgb(0,0,0)"/>
<path d="M492,171L505,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M526,186L660,186A15 15 0 0 0 675 171A15 15 0 0 0 660 156L526,156A15 15 0 0 0 510 171A15 15 0 0 0 526 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">new-column-name</text>
<polygon points="692,171 680,176 680,167" style="fill:rgb(0,0,0)"/>
<path d="M675,171L686,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="745,126 733,130 733,122" style="fill:rgb(0,0,0)"/>
<path d="M692,171 L 700,171 Q 709,171 709,156 L 709,141 Q 709,126 724,126 L 724,126 L 739,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="748" cy="126" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="745,126 733,130 733,122" style="fill:rgb(0,0,0)"/>
<path d="M349,126L739,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="232,198 220,202 220,193" style="fill:rgb(0,0,0)"/>
<path d="M149,171 L 158,171 Q 166,171 166,184 Q 166,198 181,198 L 211,198 L 226,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="314,171 303,176 303,167" style="fill:rgb(0,0,0)"/>
<path d="M232,198 L 272,198 Q 287,198 287,184 Q 287,171 298,171 L 308,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="41,232 30,236 30,227" style="fill:rgb(0,0,0)"/>
<path d="M5,96 L 5,217 Q 5,232 20,232 L 21,232 L 36,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M56,247L76,247A15 15 0 0 0 91 232A15 15 0 0 0 76 217L56,217A15 15 0 0 0 41 232A15 15 0 0 0 56 247Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="232" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ADD</text>
<polygon points="108,232 97,236 97,227" style="fill:rgb(0,0,0)"/>
<path d="M91,232L102,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="144,232 133,236 133,227" style="fill:rgb(0,0,0)"/>
<path d="M108,232L138,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M159,247L222,247A15 15 0 0 0 237 232A15 15 0 0 0 222 217L159,217A15 15 0 0 0 144 232A15 15 0 0 0 159 247Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="232" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLUMN</text>
<polygon points="273,232 262,236 262,227" style="fill:rgb(0,0,0)"/>
<path d="M237,232L267,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M273,247L378,247L378,217L273,217Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="326" y="232" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-def</text>
<polygon points="692,232 680,236 680,227" style="fill:rgb(0,0,0)"/>
<path d="M378,232L686,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="191,258 179,262 179,254" style="fill:rgb(0,0,0)"/>
<path d="M108,232 L 117,232 Q 125,232 125,245 Q 125,258 140,258 L 170,258 L 185,258"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,232 262,236 262,227" style="fill:rgb(0,0,0)"/>
<path d="M191,258 L 231,258 Q 246,258 246,245 Q 246,232 257,232 L 267,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="745,126 733,130 733,122" style="fill:rgb(0,0,0)"/>
<path d="M692,232 L 700,232 Q 709,232 709,217 L 709,141 Q 709,126 724,126 L 724,126 L 739,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="41,288 30,292 30,283" style="fill:rgb(0,0,0)"/>
<path d="M5,217 L 5,273 Q 5,288 20,288 L 21,288 L 36,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M56,303L87,303A15 15 0 0 0 103 288A15 15 0 0 0 87 273L56,273A15 15 0 0 0 41 288A15 15 0 0 0 56 303Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="72" y="288" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DROP</text>
<polygon points="120,288 108,292 108,283" style="fill:rgb(0,0,0)"/>
<path d="M103,288L114,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,288 144,292 144,283" style="fill:rgb(0,0,0)"/>
<path d="M120,288L150,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M171,303L234,303A15 15 0 0 0 249 288A15 15 0 0 0 234 273L171,273A15 15 0 0 0 156 288A15 15 0 0 0 171 303Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="202" y="288" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLUMN</text>
<polygon points="285,288 273,292 273,283" style="fill:rgb(0,0,0)"/>
<path d="M249,288L279,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,303L394,303A15 15 0 0 0 409 288A15 15 0 0 0 394 273L300,273A15 15 0 0 0 285 288A15 15 0 0 0 300 303Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="288" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="692,288 680,292 680,283" style="fill:rgb(0,0,0)"/>
<path d="M409,288L686,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M692,288 L 700,288 Q 709,288 709,273 L 709,232 L 709,217"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="202,314 191,318 191,310" style="fill:rgb(0,0,0)"/>
<path d="M120,288 L 127,288 Q 135,288 135,301 Q 135,314 150,314 L 181,314 L 196,314"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M202,314 L 245,314 Q 260,314 260,301 Q 260,288 268,288 L 275,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./column-def.html'>column-def</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>
</div>



Added Doc/Extra/Core/syntax/analyze-stmt.html.





















































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: analyze-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>analyze-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:654px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 654.557 140.4">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L111,32A15 15 0 0 0 127 17A15 15 0 0 0 111 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="79" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ANALYZE</text>
<polygon points="150,17 138,21 138,12" style="fill:rgb(0,0,0)"/>
<path d="M127,17L144,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="188,123 176,127 176,118" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 157,17 Q 165,17 165,32 L 165,108 Q 165,123 173,123 L 182,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M203,138L299,138A15 15 0 0 0 314 123A15 15 0 0 0 299 108L203,108A15 15 0 0 0 188 123A15 15 0 0 0 203 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="337,123 326,127 326,118" style="fill:rgb(0,0,0)"/>
<path d="M314,123L332,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M352,138A15 15 0 0 0 368 123A15 15 0 0 0 352 108A15 15 0 0 0 337 123A15 15 0 0 0 352 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="352" y="123" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="391,123 379,127 379,118" style="fill:rgb(0,0,0)"/>
<path d="M368,123L385,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M406,138L556,138A15 15 0 0 0 571 123A15 15 0 0 0 556 108L406,108A15 15 0 0 0 391 123A15 15 0 0 0 406 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-index-name</text>
<polygon points="594,123 582,127 582,118" style="fill:rgb(0,0,0)"/>
<path d="M571,123L588,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="645,17 633,21 633,12" style="fill:rgb(0,0,0)"/>
<path d="M594,123 L 601,123 Q 609,123 609,108 L 609,32 Q 609,17 624,17 L 624,17 L 639,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="648" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="397,17 386,21 386,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L391,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,17L633,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="188,47 176,51 176,43" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 157,17 Q 165,17 165,32 L 165,32 Q 165,47 173,47 L 182,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M203,62L299,62A15 15 0 0 0 314 47L314,47A15 15 0 0 0 299 32L203,32A15 15 0 0 0 188 47L188,47A15 15 0 0 0 203 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="594,47 582,51 582,43" style="fill:rgb(0,0,0)"/>
<path d="M314,47L588,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M594,47 L 601,47 Q 609,47 609,40 L 609,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="188,85 176,89 176,81" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 157,17 Q 165,17 165,32 L 165,70 Q 165,85 173,85 L 182,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M203,100L353,100A15 15 0 0 0 368 85A15 15 0 0 0 353 70L203,70A15 15 0 0 0 188 85A15 15 0 0 0 203 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-or-table-name</text>
<polygon points="594,85 582,89 582,81" style="fill:rgb(0,0,0)"/>
<path d="M368,85L588,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M594,85 L 601,85 Q 609,85 609,77 L 609,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_analyze.html'>lang_analyze.html</a>
</div>



Added Doc/Extra/Core/syntax/attach-stmt.html.































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: attach-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>attach-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:606px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 606.701 47.952">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L101,32A15 15 0 0 0 116 17A15 15 0 0 0 101 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ATTACH</text>
<polygon points="139,17 128,21 128,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L134,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="175,17 164,21 164,12" style="fill:rgb(0,0,0)"/>
<path d="M139,17L170,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M191,32L267,32A15 15 0 0 0 282 17A15 15 0 0 0 267 2L191,2A15 15 0 0 0 175 17A15 15 0 0 0 191 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="229" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DATABASE</text>
<polygon points="318,17 306,21 306,12" style="fill:rgb(0,0,0)"/>
<path d="M282,17L312,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M318,32L367,32L367,2L318,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="342" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="390,17 378,21 378,12" style="fill:rgb(0,0,0)"/>
<path d="M367,17L384,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M405,32L409,32A15 15 0 0 0 424 17A15 15 0 0 0 409 2L405,2A15 15 0 0 0 390 17A15 15 0 0 0 405 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="407" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="447,17 436,21 436,12" style="fill:rgb(0,0,0)"/>
<path d="M424,17L441,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,32L559,32A15 15 0 0 0 574 17A15 15 0 0 0 559 2L462,2A15 15 0 0 0 447 17A15 15 0 0 0 462 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="510" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="597,17 585,21 585,12" style="fill:rgb(0,0,0)"/>
<path d="M574,17L591,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="600" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="229,41 217,45 217,37" style="fill:rgb(0,0,0)"/>
<path d="M139,17 L 147,17 Q 154,17 154,29 Q 154,41 169,41 L 208,41 L 223,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M229,41 L 276,41 Q 291,41 291,29 Q 291,17 298,17 L 306,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./expr.html'>expr</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_attach.html'>lang_attach.html</a>
</div>



Added Doc/Extra/Core/syntax/begin-stmt.html.



















































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: begin-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>begin-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:560px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 560.669 140.4">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L86,32A15 15 0 0 0 101 17A15 15 0 0 0 86 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BEGIN</text>
<polygon points="124,17 112,21 112,12" style="fill:rgb(0,0,0)"/>
<path d="M101,17L118,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="162,123 150,127 150,118" style="fill:rgb(0,0,0)"/>
<path d="M124,17 L 131,17 Q 139,17 139,32 L 139,108 Q 139,123 147,123 L 156,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M177,138L261,138A15 15 0 0 0 276 123A15 15 0 0 0 261 108L177,108A15 15 0 0 0 162 123A15 15 0 0 0 177 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUSIVE</text>
<polygon points="299,123 287,127 287,118" style="fill:rgb(0,0,0)"/>
<path d="M276,123L293,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="337,17 325,21 325,12" style="fill:rgb(0,0,0)"/>
<path d="M299,123 L 306,123 Q 314,123 314,108 L 314,32 Q 314,17 322,17 L 331,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="373,17 361,21 361,12" style="fill:rgb(0,0,0)"/>
<path d="M337,17L367,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,32L500,32A15 15 0 0 0 515 17A15 15 0 0 0 500 2L388,2A15 15 0 0 0 373 17A15 15 0 0 0 388 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRANSACTION</text>
<polygon points="551,17 539,21 539,12" style="fill:rgb(0,0,0)"/>
<path d="M515,17L545,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="554" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="444,47 432,51 432,43" style="fill:rgb(0,0,0)"/>
<path d="M337,17 L 344,17 Q 352,17 352,32 L 352,32 Q 352,47 367,47 L 423,47 L 438,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,47 L 511,47 Q 526,47 526,32 L 526,32 Q 526,17 533,17 L 541,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M124,17L325,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="162,47 150,51 150,43" style="fill:rgb(0,0,0)"/>
<path d="M139,32 L 139,39 Q 139,47 147,47 L 156,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M177,62L257,62A15 15 0 0 0 272 47L272,47A15 15 0 0 0 257 32L177,32A15 15 0 0 0 162 47L162,47A15 15 0 0 0 177 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="217" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFERRED</text>
<polygon points="295,47 284,51 284,43" style="fill:rgb(0,0,0)"/>
<path d="M272,47L289,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,47 L 304,47 Q 314,47 314,40 L 314,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="162,85 150,89 150,81" style="fill:rgb(0,0,0)"/>
<path d="M139,32 L 139,70 Q 139,85 147,85 L 156,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M177,100L265,100A15 15 0 0 0 281 85A15 15 0 0 0 265 70L177,70A15 15 0 0 0 162 85A15 15 0 0 0 177 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="221" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IMMEDIATE</text>
<polygon points="304,85 292,89 292,81" style="fill:rgb(0,0,0)"/>
<path d="M281,85L298,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M304,85 L 309,85 Q 314,85 314,77 L 314,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_transaction.html'>lang_transaction.html</a>
</div>



Added Doc/Extra/Core/syntax/column-constraint.html.





















































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: column-constraint</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>column-constraint</h1>
<div class='imgcontainer'>
<div style="max-width:844px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 844.306 578.88">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,40 43,28 51,28" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,25 L 47,34"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L183,32A15 15 0 0 0 198 17A15 15 0 0 0 183 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="133" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONSTRAINT</text>
<polygon points="221,17 210,21 210,12" style="fill:rgb(0,0,0)"/>
<path d="M198,17L215,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,32L263,32A15 15 0 0 0 279 17A15 15 0 0 0 263 2L236,2A15 15 0 0 0 221 17A15 15 0 0 0 236 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="250" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="173,47 185,43 185,51" style="fill:rgb(0,0,0)"/>
<path d="M279,17 L 300,17 Q 315,17 315,32 L 315,32 Q 315,47 300,47 L 194,47 L 179,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M173,47 L 62,47 Q 47,47 47,55 L 47,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,77 58,82 58,73" style="fill:rgb(0,0,0)"/>
<path d="M47,40 L 47,62 Q 47,77 56,77 L 64,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,92L148,92A15 15 0 0 0 163 77A15 15 0 0 0 148 62L85,62A15 15 0 0 0 70 77A15 15 0 0 0 85 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRIMARY</text>
<polygon points="186,77 174,82 174,73" style="fill:rgb(0,0,0)"/>
<path d="M163,77L180,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M201,92L217,92A15 15 0 0 0 233 77A15 15 0 0 0 217 62L201,62A15 15 0 0 0 186 77A15 15 0 0 0 201 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">KEY</text>
<polygon points="271,138 259,142 259,133" style="fill:rgb(0,0,0)"/>
<path d="M233,77 L 240,77 Q 248,77 248,92 L 248,123 Q 248,138 256,138 L 265,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M286,153L316,153A15 15 0 0 0 331 138A15 15 0 0 0 316 123L286,123A15 15 0 0 0 271 138A15 15 0 0 0 286 153Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="301" y="138" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="354,138 343,142 343,133" style="fill:rgb(0,0,0)"/>
<path d="M331,138L348,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,77 381,82 381,73" style="fill:rgb(0,0,0)"/>
<path d="M354,138 L 362,138 Q 369,138 369,123 L 369,92 Q 369,77 378,77 L 386,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M392,92L525,92L525,62L392,62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="459" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">conflict-clause</text>
<polygon points="549,77 537,82 537,73" style="fill:rgb(0,0,0)"/>
<path d="M525,77L543,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="587,108 575,112 575,103" style="fill:rgb(0,0,0)"/>
<path d="M549,77 L 556,77 Q 564,77 564,92 L 564,93 Q 564,108 572,108 L 581,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M602,123L745,123A15 15 0 0 0 760 108A15 15 0 0 0 745 92L602,92A15 15 0 0 0 587 108A15 15 0 0 0 602 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="673" y="108" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AUTOINCREMENT</text>
<polygon points="783,108 772,112 772,103" style="fill:rgb(0,0,0)"/>
<path d="M760,108L778,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="834,77 823,82 823,73" style="fill:rgb(0,0,0)"/>
<path d="M783,108 L 791,108 Q 798,108 798,93 L 798,92 Q 798,77 813,77 L 814,77 L 829,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="838" cy="77" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="673,77 662,82 662,73" style="fill:rgb(0,0,0)"/>
<path d="M549,77L668,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M673,77L827,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="301,77 289,82 289,73" style="fill:rgb(0,0,0)"/>
<path d="M233,77L295,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,77L381,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="271,100 259,104 259,96" style="fill:rgb(0,0,0)"/>
<path d="M233,77 L 240,77 Q 248,77 248,89 Q 248,100 256,100 L 265,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M286,115L302,115A15 15 0 0 0 318 100A15 15 0 0 0 302 85L286,85A15 15 0 0 0 271 100A15 15 0 0 0 286 115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="294" y="100" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="354,100 343,104 343,96" style="fill:rgb(0,0,0)"/>
<path d="M318,100L348,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,100 L 362,100 Q 369,100 369,92 L 369,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,183 58,187 58,179" style="fill:rgb(0,0,0)"/>
<path d="M47,62 L 47,168 Q 47,183 56,183 L 64,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,198L105,198A15 15 0 0 0 120 183A15 15 0 0 0 105 168L85,168A15 15 0 0 0 70 183A15 15 0 0 0 85 198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="95" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="143,183 132,187 132,179" style="fill:rgb(0,0,0)"/>
<path d="M120,183L138,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,198L190,198A15 15 0 0 0 205 183A15 15 0 0 0 190 168L158,168A15 15 0 0 0 143 183A15 15 0 0 0 158 198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="174" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="228,183 216,187 216,179" style="fill:rgb(0,0,0)"/>
<path d="M205,183L222,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,198L361,198L361,168L228,168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="294" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">conflict-clause</text>
<polygon points="783,183 772,187 772,179" style="fill:rgb(0,0,0)"/>
<path d="M361,183L778,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,183 L 791,183 Q 798,183 798,168 L 798,107 L 798,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,221 58,225 58,217" style="fill:rgb(0,0,0)"/>
<path d="M47,168 L 47,206 Q 47,221 56,221 L 64,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,236L140,236A15 15 0 0 0 155 221A15 15 0 0 0 140 206L85,206A15 15 0 0 0 70 221A15 15 0 0 0 85 236Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="113" y="221" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNIQUE</text>
<polygon points="178,221 167,225 167,217" style="fill:rgb(0,0,0)"/>
<path d="M155,221L172,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M178,236L311,236L311,206L178,206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="245" y="221" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">conflict-clause</text>
<polygon points="783,221 772,225 772,217" style="fill:rgb(0,0,0)"/>
<path d="M311,221L778,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,221 L 791,221 Q 798,221 798,206 L 798,183 L 798,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,259 58,263 58,254" style="fill:rgb(0,0,0)"/>
<path d="M47,206 L 47,244 Q 47,259 56,259 L 64,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,274L131,274A15 15 0 0 0 146 259A15 15 0 0 0 131 244L85,244A15 15 0 0 0 70 259A15 15 0 0 0 85 274Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="259" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CHECK</text>
<polygon points="169,259 157,263 157,254" style="fill:rgb(0,0,0)"/>
<path d="M146,259L163,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M184,274A15 15 0 0 0 199 259A15 15 0 0 0 184 244A15 15 0 0 0 169 259A15 15 0 0 0 184 274Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="259" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="222,259 210,263 210,254" style="fill:rgb(0,0,0)"/>
<path d="M199,259L216,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,274L271,274L271,244L222,244Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="259" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="294,259 283,263 283,254" style="fill:rgb(0,0,0)"/>
<path d="M271,259L288,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,274A15 15 0 0 0 324 259A15 15 0 0 0 309 244A15 15 0 0 0 294 259A15 15 0 0 0 309 274Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="309" y="259" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="783,259 772,263 772,254" style="fill:rgb(0,0,0)"/>
<path d="M324,259L778,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,259 L 791,259 Q 798,259 798,244 L 798,221 L 798,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,297 58,301 58,292" style="fill:rgb(0,0,0)"/>
<path d="M47,244 L 47,282 Q 47,297 56,297 L 64,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,312L150,312A15 15 0 0 0 166 297A15 15 0 0 0 150 281L85,281A15 15 0 0 0 70 297A15 15 0 0 0 85 312Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="118" y="297" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFAULT</text>
<polygon points="189,297 177,301 177,292" style="fill:rgb(0,0,0)"/>
<path d="M166,297L183,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="225,297 213,301 213,292" style="fill:rgb(0,0,0)"/>
<path d="M189,297L219,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,312A15 15 0 0 0 255 297A15 15 0 0 0 240 281A15 15 0 0 0 225 297A15 15 0 0 0 240 312Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="240" y="297" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="278,297 266,301 266,292" style="fill:rgb(0,0,0)"/>
<path d="M255,297L272,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,312L327,312L327,281L278,281Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="297" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="350,297 339,301 339,292" style="fill:rgb(0,0,0)"/>
<path d="M327,297L344,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,312A15 15 0 0 0 380 297A15 15 0 0 0 365 281A15 15 0 0 0 350 297A15 15 0 0 0 365 312Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="297" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="783,297 772,301 772,292" style="fill:rgb(0,0,0)"/>
<path d="M380,297L778,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,297 L 791,297 Q 798,297 798,282 L 798,259 L 798,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="227,334 215,339 215,330" style="fill:rgb(0,0,0)"/>
<path d="M189,297 L 196,297 Q 204,297 204,312 L 204,319 Q 204,334 212,334 L 221,334"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M227,349L340,349L340,319L227,319Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="283" y="334" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="363,334 351,339 351,330" style="fill:rgb(0,0,0)"/>
<path d="M340,334L357,334"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,334 L 395,334 Q 410,334 410,319 L 410,312 Q 410,297 425,297 L 431,297 L 446,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="227,372 215,376 215,368" style="fill:rgb(0,0,0)"/>
<path d="M189,297 L 196,297 Q 204,297 204,312 L 204,357 Q 204,372 212,372 L 221,372"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M227,387L364,387L364,357L227,357Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="372" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="387,372 376,376 376,368" style="fill:rgb(0,0,0)"/>
<path d="M364,372L382,372"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M387,372 L 399,372 Q 410,372 410,357 L 410,312 Q 410,297 425,297 L 431,297 L 446,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,410 58,414 58,406" style="fill:rgb(0,0,0)"/>
<path d="M47,281 L 47,395 Q 47,410 56,410 L 64,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,425L149,425A15 15 0 0 0 164 410A15 15 0 0 0 149 395L85,395A15 15 0 0 0 70 410A15 15 0 0 0 85 425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="117" y="410" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="187,410 176,414 176,406" style="fill:rgb(0,0,0)"/>
<path d="M164,410L182,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M202,425L308,425A15 15 0 0 0 323 410A15 15 0 0 0 308 395L202,395A15 15 0 0 0 187 410A15 15 0 0 0 202 425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="255" y="410" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="783,410 772,414 772,406" style="fill:rgb(0,0,0)"/>
<path d="M323,410L778,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,410 L 791,410 Q 798,410 798,395 L 798,296 L 798,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,448 58,452 58,443" style="fill:rgb(0,0,0)"/>
<path d="M47,395 L 47,433 Q 47,448 56,448 L 64,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,463L236,463L236,433L70,433Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="448" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">foreign-key-clause</text>
<polygon points="783,448 772,452 772,443" style="fill:rgb(0,0,0)"/>
<path d="M236,448L778,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,448 L 791,448 Q 798,448 798,433 L 798,410 L 798,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,486 58,490 58,481" style="fill:rgb(0,0,0)"/>
<path d="M47,433 L 47,471 Q 47,486 56,486 L 64,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,501L178,501A15 15 0 0 0 193 486A15 15 0 0 0 178 470L85,470A15 15 0 0 0 70 486A15 15 0 0 0 85 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="131" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GENERATED</text>
<polygon points="216,486 204,490 204,481" style="fill:rgb(0,0,0)"/>
<path d="M193,486L210,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M231,501L286,501A15 15 0 0 0 301 486A15 15 0 0 0 286 470L231,470A15 15 0 0 0 216 486A15 15 0 0 0 231 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALWAYS</text>
<polygon points="337,486 325,490 325,481" style="fill:rgb(0,0,0)"/>
<path d="M301,486L331,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M352,501L356,501A15 15 0 0 0 371 486A15 15 0 0 0 356 470L352,470A15 15 0 0 0 337 486A15 15 0 0 0 352 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="354" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="394,486 382,490 382,481" style="fill:rgb(0,0,0)"/>
<path d="M371,486L388,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,501A15 15 0 0 0 424 486A15 15 0 0 0 409 470A15 15 0 0 0 394 486A15 15 0 0 0 409 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="486" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="447,486 436,490 436,481" style="fill:rgb(0,0,0)"/>
<path d="M424,486L441,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M447,501L496,501L496,470L447,470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="472" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="519,486 508,490 508,481" style="fill:rgb(0,0,0)"/>
<path d="M496,486L514,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,501A15 15 0 0 0 550 486A15 15 0 0 0 535 470A15 15 0 0 0 519 486A15 15 0 0 0 535 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="535" y="486" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="783,486 772,490 772,481" style="fill:rgb(0,0,0)"/>
<path d="M550,486L778,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,486 L 791,486 Q 798,486 798,471 L 798,448 L 798,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="185,516 174,520 174,511" style="fill:rgb(0,0,0)"/>
<path d="M47,470 L 47,501 Q 47,516 62,516 L 165,516 L 180,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M185,516 L 297,516 Q 312,516 312,501 L 312,501 Q 312,486 320,486 L 327,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="596,561 584,565 584,557" style="fill:rgb(0,0,0)"/>
<path d="M550,486 L 561,486 Q 573,486 573,501 L 573,546 Q 573,561 581,561 L 590,561"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M611,576L670,576A15 15 0 0 0 686 561A15 15 0 0 0 670 546L611,546A15 15 0 0 0 596 561A15 15 0 0 0 611 576Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="641" y="561" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VIRTUAL</text>
<polygon points="783,561 772,565 772,557" style="fill:rgb(0,0,0)"/>
<path d="M686,561L778,561"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,561 L 791,561 Q 798,561 798,546 L 798,485 L 798,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="596,523 584,528 584,519" style="fill:rgb(0,0,0)"/>
<path d="M550,486 L 561,486 Q 573,486 573,501 L 573,508 Q 573,523 581,523 L 590,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M611,538L665,538A15 15 0 0 0 680 523A15 15 0 0 0 665 508L611,508A15 15 0 0 0 596 523A15 15 0 0 0 611 538Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="638" y="523" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">STORED</text>
<polygon points="783,523 772,528 772,519" style="fill:rgb(0,0,0)"/>
<path d="M680,523L778,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,523 L 791,523 Q 798,523 798,516 L 798,508"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./column-def.html'>column-def</a><br></br>
References:&nbsp;&nbsp; <a href='./conflict-clause.html'>conflict-clause</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./foreign-key-clause.html'>foreign-key-clause</a>&nbsp;&nbsp; <a href='./literal-value.html'>literal-value</a>&nbsp;&nbsp; <a href='./signed-number.html'>signed-number</a><br></br>
See also:&nbsp;&nbsp; <a href='../gencol.html'>gencol.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>
</div>



Added Doc/Extra/Core/syntax/column-def.html.



























































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: column-def</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>column-def</h1>
<div class='imgcontainer'>
<div style="max-width:614px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 614.333 64.8">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L141,32A15 15 0 0 0 156 17A15 15 0 0 0 141 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="94" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="179,17 168,21 168,12" style="fill:rgb(0,0,0)"/>
<path d="M156,17L173,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="215,17 204,21 204,12" style="fill:rgb(0,0,0)"/>
<path d="M179,17L209,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,32L314,32L314,2L215,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M314,17L354,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M386,62L550,62L550,32L386,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="468" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-constraint</text>
<polygon points="550,17 539,21 539,12" style="fill:rgb(0,0,0)"/>
<path d="M359,17L545,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="604,17 593,21 593,12" style="fill:rgb(0,0,0)"/>
<path d="M550,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="608" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="265,42 253,47 253,38" style="fill:rgb(0,0,0)"/>
<path d="M179,17 L 187,17 Q 194,17 194,30 Q 194,42 209,42 L 244,42 L 259,42"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,42 L 314,42 Q 329,42 329,30 Q 329,17 337,17 L 344,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="550,47 562,43 562,51" style="fill:rgb(0,0,0)"/>
<path d="M550,17 L 562,17 Q 574,17 574,32 L 574,32 Q 574,47 565,47 L 556,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="399,17 388,21 388,12" style="fill:rgb(0,0,0)"/>
<path d="M386,47 L 375,47 Q 363,47 363,32 L 363,32 Q 363,17 378,17 L 379,17 L 394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./alter-table-stmt.html'>alter-table-stmt</a>&nbsp;&nbsp; <a href='./create-table-stmt.html'>create-table-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./column-constraint.html'>column-constraint</a>&nbsp;&nbsp; <a href='./type-name.html'>type-name</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>
</div>



Added Doc/Extra/Core/syntax/column-name-list.html.



















































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: column-name-list</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>column-name-list</h1>
<div class='imgcontainer'>
<div style="max-width:353px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 353.621 72.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="85,17 74,21 74,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L79,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,17 110,21 110,12" style="fill:rgb(0,0,0)"/>
<path d="M85,17L115,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,32L230,32A15 15 0 0 0 245 17A15 15 0 0 0 230 2L136,2A15 15 0 0 0 121 17A15 15 0 0 0 136 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="290,17 279,21 279,12" style="fill:rgb(0,0,0)"/>
<path d="M245,17L285,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M306,32A15 15 0 0 0 321 17A15 15 0 0 0 306 2A15 15 0 0 0 290 17A15 15 0 0 0 306 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="306" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="344,17 332,21 332,12" style="fill:rgb(0,0,0)"/>
<path d="M321,17L338,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="347" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M183,70A15 15 0 0 0 198 55L198,55A15 15 0 0 0 183 39A15 15 0 0 0 168 55L168,55A15 15 0 0 0 183 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="198,55 210,50 210,59" style="fill:rgb(0,0,0)"/>
<path d="M245,17 L 257,17 Q 269,17 269,32 L 269,40 Q 269,55 254,55 L 219,55 L 204,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,17 110,21 110,12" style="fill:rgb(0,0,0)"/>
<path d="M168,55 L 102,55 Q 87,55 87,40 L 87,32 Q 87,17 101,17 L 115,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./update-stmt.html'>update-stmt</a>&nbsp;&nbsp; <a href='./update-stmt-limited.html'>update-stmt-limited</a>&nbsp;&nbsp; <a href='./upsert-clause.html'>upsert-clause</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>
</div>



Added Doc/Extra/Core/syntax/comment-syntax.html.





































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: comment-syntax</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>comment-syntax</h1>
<div class='imgcontainer'>
<div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.704 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32A15 15 0 0 0 98 17A15 15 0 0 0 83 2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">--</text>
<polygon points="121,17 110,21 110,12" style="fill:rgb(0,0,0)"/>
<path d="M98,17L115,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M172,70L359,70A15 15 0 0 0 374 55L374,55A15 15 0 0 0 359 39L172,39A15 15 0 0 0 157 55L157,55A15 15 0 0 0 172 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="266" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">anything-except-newline</text>
<polygon points="347,17 336,21 336,12" style="fill:rgb(0,0,0)"/>
<path d="M121,17L342,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="374,55 386,50 386,59" style="fill:rgb(0,0,0)"/>
<path d="M347,17 L 382,17 Q 397,17 397,32 L 397,40 Q 397,55 389,55 L 380,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="194,17 183,21 183,12" style="fill:rgb(0,0,0)"/>
<path d="M157,55 L 146,55 Q 134,55 134,40 L 134,32 Q 134,17 149,17 L 173,17 L 188,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="464,17 453,21 453,12" style="fill:rgb(0,0,0)"/>
<path d="M374,17L459,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,32L527,32A15 15 0 0 0 542 17A15 15 0 0 0 527 2L480,2A15 15 0 0 0 464 17A15 15 0 0 0 480 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="503" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">newline</text>
<path d="M480,70L563,70A15 15 0 0 0 578 55L578,55A15 15 0 0 0 563 39L480,39A15 15 0 0 0 464 55L464,55A15 15 0 0 0 480 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="521" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">end-of-input</text>
<polygon points="601,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M578,55L595,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M601,55 L 608,55 Q 616,55 616,40 L 616,32 Q 616,17 631,17 L 631,17 L 646,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M542,17L632,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="464,55 453,59 453,50" style="fill:rgb(0,0,0)"/>
<path d="M374,17 L 412,17 Q 427,17 427,32 L 427,40 Q 427,55 442,55 L 444,55 L 459,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,108A15 15 0 0 0 98 92A15 15 0 0 0 83 77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">/*</text>
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,92 110,97 110,88" style="fill:rgb(0,0,0)"/>
<path d="M98,92L115,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,92L193,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M172,145L308,145A15 15 0 0 0 323 130A15 15 0 0 0 308 115L172,115A15 15 0 0 0 157 130A15 15 0 0 0 172 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="240" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">anything-except-*/</text>
<path d="M480,108A15 15 0 0 0 495 92A15 15 0 0 0 480 77A15 15 0 0 0 464 92A15 15 0 0 0 480 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="480" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*/</text>
<polygon points="323,130 334,126 334,135" style="fill:rgb(0,0,0)"/>
<path d="M323,92 L 334,92 Q 346,92 346,107 L 346,115 Q 346,130 337,130 L 328,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="464,92 453,97 453,88" style="fill:rgb(0,0,0)"/>
<path d="M157,130 L 146,130 Q 134,130 134,115 L 134,107 Q 134,92 149,92 L 444,92 L 459,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="601,92 589,97 589,88" style="fill:rgb(0,0,0)"/>
<path d="M495,92L595,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M601,92 L 608,92 Q 616,92 616,77 L 616,54 L 616,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,92 L 419,92 Q 427,92 427,77 L 427,70 Q 427,55 440,55 L 453,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>
<br></br>
See also:&nbsp;&nbsp; <a href='../lang_comment.html'>lang_comment.html</a>
</div>



Added Doc/Extra/Core/syntax/commit-stmt.html.





















































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: commit-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>commit-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:434px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 434.506 72.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L141,32A15 15 0 0 0 157 17A15 15 0 0 0 141 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COMMIT</text>
<polygon points="202,17 190,21 190,12" style="fill:rgb(0,0,0)"/>
<path d="M157,17L196,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M202,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M253,32L365,32A15 15 0 0 0 380 17A15 15 0 0 0 365 2L253,2A15 15 0 0 0 238 17A15 15 0 0 0 253 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="309" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRANSACTION</text>
<polygon points="425,17 413,21 413,12" style="fill:rgb(0,0,0)"/>
<path d="M380,17L419,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="428" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,70L104,70A15 15 0 0 0 119 55L119,55A15 15 0 0 0 104 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="94" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="157,55 145,59 145,50" style="fill:rgb(0,0,0)"/>
<path d="M119,55L151,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M157,55 L 164,55 Q 172,55 172,40 L 172,32 Q 172,17 179,17 L 187,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="309,47 297,51 297,43" style="fill:rgb(0,0,0)"/>
<path d="M202,17 L 209,17 Q 217,17 217,32 L 217,32 Q 217,47 232,47 L 288,47 L 303,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,47 L 380,47 Q 395,47 395,32 L 395,32 Q 395,17 402,17 L 410,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_transaction.html'>lang_transaction.html</a>
</div>



Added Doc/Extra/Core/syntax/common-table-expression.html.





































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: common-table-expression</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>common-table-expression</h1>
<div class='imgcontainer'>
<div style="max-width:638px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 638.525 167.4">
<circle cx="5" cy="29" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,29 20,33 20,24" style="fill:rgb(0,0,0)"/>
<path d="M9,29L26,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,44L122,44A15 15 0 0 0 137 29A15 15 0 0 0 122 14L47,14A15 15 0 0 0 32 29A15 15 0 0 0 47 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="160,29 149,33 149,24" style="fill:rgb(0,0,0)"/>
<path d="M137,29L155,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="196,29 185,33 185,24" style="fill:rgb(0,0,0)"/>
<path d="M160,29L191,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,44A15 15 0 0 0 227 29A15 15 0 0 0 211 14A15 15 0 0 0 196 29A15 15 0 0 0 211 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="250,29 238,33 238,24" style="fill:rgb(0,0,0)"/>
<path d="M227,29L244,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="286,29 274,33 274,24" style="fill:rgb(0,0,0)"/>
<path d="M250,29L280,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,44L395,44A15 15 0 0 0 410 29A15 15 0 0 0 395 14L301,14A15 15 0 0 0 286 29A15 15 0 0 0 301 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="446,29 434,33 434,24" style="fill:rgb(0,0,0)"/>
<path d="M410,29L440,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,44A15 15 0 0 0 476 29A15 15 0 0 0 461 14A15 15 0 0 0 446 29A15 15 0 0 0 461 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,29 499,33 499,24" style="fill:rgb(0,0,0)"/>
<path d="M476,29L505,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,165L51,165A15 15 0 0 0 66 150A15 15 0 0 0 51 135L47,135A15 15 0 0 0 32 150A15 15 0 0 0 47 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="49" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<path d="M127,135L147,135A15 15 0 0 0 162 119A15 15 0 0 0 147 104L127,104A15 15 0 0 0 112 119A15 15 0 0 0 127 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<path d="M219,135L337,135A15 15 0 0 0 352 119A15 15 0 0 0 337 104L219,104A15 15 0 0 0 204 119A15 15 0 0 0 219 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<path d="M162,119L204,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,165A15 15 0 0 0 425 150A15 15 0 0 0 410 135A15 15 0 0 0 395 150A15 15 0 0 0 410 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="410" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="448,150 437,154 437,145" style="fill:rgb(0,0,0)"/>
<path d="M425,150L442,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,165L552,165L552,135L448,135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="500" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="575,150 564,154 564,145" style="fill:rgb(0,0,0)"/>
<path d="M552,150L570,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M591,165A15 15 0 0 0 606 150A15 15 0 0 0 591 135A15 15 0 0 0 575 150A15 15 0 0 0 591 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="629,150 617,154 617,145" style="fill:rgb(0,0,0)"/>
<path d="M606,150L623,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="632" cy="150" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,82A15 15 0 0 0 363 66A15 15 0 0 0 348 51A15 15 0 0 0 333 66A15 15 0 0 0 348 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="363,66 374,62 374,71" style="fill:rgb(0,0,0)"/>
<path d="M410,29 L 417,29 Q 425,29 425,44 L 425,51 Q 425,66 410,66 L 384,66 L 369,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M333,66 L 278,66 Q 263,66 263,51 L 263,44 Q 263,29 270,29 L 278,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,93 78,89 78,97" style="fill:rgb(0,0,0)"/>
<path d="M511,29 L 516,29 Q 522,29 522,44 L 522,78 Q 522,93 507,93 L 87,93 L 72,93"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,150 20,154 20,145" style="fill:rgb(0,0,0)"/>
<path d="M66,93 L 30,93 Q 15,93 15,108 L 15,135 Q 15,150 20,150 L 26,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="85,150 73,154 73,145" style="fill:rgb(0,0,0)"/>
<path d="M66,150L79,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="112,119 101,124 101,115" style="fill:rgb(0,0,0)"/>
<path d="M85,150 L 89,150 Q 92,150 92,135 L 92,134 Q 92,119 99,119 L 106,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="204,119 192,124 192,115" style="fill:rgb(0,0,0)"/>
<path d="M66,150 L 147,150 Q 162,150 170,150 Q 177,150 177,135 L 177,134 Q 177,119 188,119 L 198,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,150 383,154 383,145" style="fill:rgb(0,0,0)"/>
<path d="M352,119 L 360,119 Q 367,119 367,134 L 367,135 Q 367,150 378,150 L 389,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150L395,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,6 336,10 336,2" style="fill:rgb(0,0,0)"/>
<path d="M160,29 L 168,29 Q 175,29 175,17 Q 175,6 190,6 L 327,6 L 342,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,6 L 473,6 Q 488,6 488,17 Q 488,29 495,29 L 503,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./compound-select-stmt.html'>compound-select-stmt</a>&nbsp;&nbsp; <a href='./delete-stmt.html'>delete-stmt</a>&nbsp;&nbsp; <a href='./delete-stmt-limited.html'>delete-stmt-limited</a>&nbsp;&nbsp; <a href='./factored-select-stmt.html'>factored-select-stmt</a>&nbsp;&nbsp; <a href='./insert-stmt.html'>insert-stmt</a>&nbsp;&nbsp; <a href='./select-stmt.html'>select-stmt</a>&nbsp;&nbsp; <a href='./simple-select-stmt.html'>simple-select-stmt</a>&nbsp;&nbsp; <a href='./update-stmt.html'>update-stmt</a>&nbsp;&nbsp; <a href='./update-stmt-limited.html'>update-stmt-limited</a><br></br>
References:&nbsp;&nbsp; <a href='./select-stmt.html'>select-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_aggfunc.html'>lang_aggfunc.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_attach.html'>lang_attach.html</a>&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_createview.html'>lang_createview.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_returning.html'>lang_returning.html</a>&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>
</div>



Added Doc/Extra/Core/syntax/compound-operator.html.









































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: compound-operator</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>compound-operator</h1>
<div class='imgcontainer'>
<div style="max-width:293px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 293.842 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L127,32A15 15 0 0 0 142 17A15 15 0 0 0 127 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,70L127,70A15 15 0 0 0 142 55L142,55A15 15 0 0 0 127 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,108L168,108A15 15 0 0 0 183 92A15 15 0 0 0 168 77L83,77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M83,145L135,145A15 15 0 0 0 150 130A15 15 0 0 0 135 115L83,115A15 15 0 0 0 68 130A15 15 0 0 0 83 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M142,55L159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70L195,70A15 15 0 0 0 210 55L210,55A15 15 0 0 0 195 39L180,39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="233,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M210,55L227,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,17 272,21 272,12" style="fill:rgb(0,0,0)"/>
<path d="M233,55 L 240,55 Q 248,55 248,40 L 248,32 Q 248,17 263,17 L 263,17 L 278,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="288" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M47,39 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,92 221,97 221,88" style="fill:rgb(0,0,0)"/>
<path d="M183,92L227,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,92 L 240,92 Q 248,92 248,77 L 248,54 L 248,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,130 56,135 56,126" style="fill:rgb(0,0,0)"/>
<path d="M47,77 L 47,115 Q 47,130 55,130 L 62,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,130 221,135 221,126" style="fill:rgb(0,0,0)"/>
<path d="M150,130L227,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,130 L 240,130 Q 248,130 248,115 L 248,92 L 248,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./factored-select-stmt.html'>factored-select-stmt</a>&nbsp;&nbsp; <a href='./select-stmt.html'>select-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_aggfunc.html'>lang_aggfunc.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_attach.html'>lang_attach.html</a>&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_createview.html'>lang_createview.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_returning.html'>lang_returning.html</a>&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>
</div>



Added Doc/Extra/Core/syntax/compound-select-stmt.html.















































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: compound-select-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>compound-select-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:652px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 652.306 560.52">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L114,32A15 15 0 0 0 129 17A15 15 0 0 0 114 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="98" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M189,62L275,62A15 15 0 0 0 290 47L290,47A15 15 0 0 0 275 32L189,32A15 15 0 0 0 174 47L174,47A15 15 0 0 0 189 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="232" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="232,17 220,21 220,12" style="fill:rgb(0,0,0)"/>
<path d="M129,17L226,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,17 368,21 368,12" style="fill:rgb(0,0,0)"/>
<path d="M232,17L374,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,32L606,32L606,2L380,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="174,47 162,51 162,43" style="fill:rgb(0,0,0)"/>
<path d="M129,17 L 136,17 Q 144,17 144,32 L 144,32 Q 144,47 156,47 L 168,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,47 301,51 301,43" style="fill:rgb(0,0,0)"/>
<path d="M290,47L307,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,47 L 321,47 Q 328,47 328,32 L 328,32 Q 328,17 343,17 L 353,17 L 368,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,70A15 15 0 0 0 508 55L508,55A15 15 0 0 0 493 39A15 15 0 0 0 478 55L478,55A15 15 0 0 0 493 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="508,55 520,50 520,59" style="fill:rgb(0,0,0)"/>
<path d="M606,17 L 614,17 Q 621,17 621,32 L 621,40 Q 621,55 606,55 L 529,55 L 514,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,55 L 372,55 Q 357,55 357,40 L 357,32 Q 357,17 363,17 L 368,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M68,183L171,183L171,153L68,153Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="120" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-core</text>
<path d="M83,365L128,365A15 15 0 0 0 143 349A15 15 0 0 0 128 334L83,334A15 15 0 0 0 68 349A15 15 0 0 0 83 365Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="166,349 154,354 154,345" style="fill:rgb(0,0,0)"/>
<path d="M143,349L160,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M181,365L185,365A15 15 0 0 0 200 349A15 15 0 0 0 185 334L181,334A15 15 0 0 0 166 349A15 15 0 0 0 181 365Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M83,470L116,470A15 15 0 0 0 132 455A15 15 0 0 0 116 440L83,440A15 15 0 0 0 68 455A15 15 0 0 0 83 470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="100" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="155,455 143,460 143,451" style="fill:rgb(0,0,0)"/>
<path d="M132,455L149,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M155,470L204,470L204,440L155,440Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="179" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="68,168 56,172 56,164" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,153 Q 47,168 55,168 L 62,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="335,92 346,88 346,97" style="fill:rgb(0,0,0)"/>
<path d="M606,17 L 627,17 Q 642,17 642,32 L 642,77 Q 642,92 627,92 L 356,92 L 341,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M335,92 L 62,92 Q 47,92 47,100 L 47,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,168 232,172 232,164" style="fill:rgb(0,0,0)"/>
<path d="M171,168L238,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,183L302,183A15 15 0 0 0 317 168A15 15 0 0 0 302 153L259,153A15 15 0 0 0 243 168A15 15 0 0 0 259 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M259,221L302,221A15 15 0 0 0 317 206A15 15 0 0 0 302 191L259,191A15 15 0 0 0 243 206A15 15 0 0 0 259 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<polygon points="340,206 329,210 329,201" style="fill:rgb(0,0,0)"/>
<path d="M317,206L335,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M355,221L370,221A15 15 0 0 0 386 206A15 15 0 0 0 370 191L355,191A15 15 0 0 0 340 206A15 15 0 0 0 355 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="409,206 397,210 397,201" style="fill:rgb(0,0,0)"/>
<path d="M386,206L403,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,168 435,172 435,164" style="fill:rgb(0,0,0)"/>
<path d="M409,206 L 416,206 Q 424,206 424,191 L 424,183 Q 424,168 432,168 L 441,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M447,183L550,183L550,153L447,153Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="498" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-core</text>
<path d="M259,259L343,259A15 15 0 0 0 359 244A15 15 0 0 0 343 228L259,228A15 15 0 0 0 243 244A15 15 0 0 0 259 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="301" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M259,297L310,297A15 15 0 0 0 325 281A15 15 0 0 0 310 266L259,266A15 15 0 0 0 243 281A15 15 0 0 0 259 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="284" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="243,281 232,286 232,277" style="fill:rgb(0,0,0)"/>
<path d="M205,168 L 213,168 Q 220,168 220,183 L 220,266 Q 220,281 229,281 L 238,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,244 232,248 232,239" style="fill:rgb(0,0,0)"/>
<path d="M220,228 L 220,236 Q 220,244 229,244 L 238,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,206 232,210 232,201" style="fill:rgb(0,0,0)"/>
<path d="M220,191 L 220,198 Q 220,206 229,206 L 238,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="409,244 397,248 397,239" style="fill:rgb(0,0,0)"/>
<path d="M359,244L403,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,244 L 416,244 Q 424,244 424,229 L 424,206 L 424,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="409,281 397,286 397,277" style="fill:rgb(0,0,0)"/>
<path d="M325,281L403,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,281 L 416,281 Q 424,281 424,266 L 424,243 L 424,228"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,168L435,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,138 389,133 389,142" style="fill:rgb(0,0,0)"/>
<path d="M550,168 L 558,168 Q 565,168 565,153 L 565,153 Q 565,138 550,138 L 399,138 L 384,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M378,138 L 205,138 Q 190,138 190,153 L 190,153 Q 190,168 198,168 L 205,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="319,315 331,311 331,320" style="fill:rgb(0,0,0)"/>
<path d="M550,168 L 571,168 Q 586,168 586,183 L 586,300 Q 586,315 571,315 L 340,315 L 325,315"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,349 56,354 56,345" style="fill:rgb(0,0,0)"/>
<path d="M319,315 L 62,315 Q 47,315 47,330 L 47,334 Q 47,349 55,349 L 62,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,349 234,354 234,345" style="fill:rgb(0,0,0)"/>
<path d="M200,349L239,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,365L375,365L375,334L245,334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,402A15 15 0 0 0 325 387A15 15 0 0 0 310 372A15 15 0 0 0 295 387A15 15 0 0 0 310 402Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="387" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,387 337,383 337,392" style="fill:rgb(0,0,0)"/>
<path d="M375,349 L 382,349 Q 390,349 390,364 L 390,372 Q 390,387 375,387 L 346,387 L 331,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,387 L 237,387 Q 222,387 222,372 L 222,364 Q 222,349 228,349 L 234,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,380 407,368 415,368" style="fill:rgb(0,0,0)"/>
<path d="M375,349 L 396,349 Q 411,349 411,362 L 411,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="221,421 233,417 233,426" style="fill:rgb(0,0,0)"/>
<path d="M411,380 L 411,406 Q 411,421 396,421 L 242,421 L 227,421"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,455 56,460 56,451" style="fill:rgb(0,0,0)"/>
<path d="M221,421 L 62,421 Q 47,421 47,436 L 47,440 Q 47,455 55,455 L 62,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,387 43,376 51,376" style="fill:rgb(0,0,0)"/>
<path d="M47,334L47,382"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,387L47,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,501L329,501A15 15 0 0 0 344 486A15 15 0 0 0 329 470L278,470A15 15 0 0 0 263 486A15 15 0 0 0 278 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="304" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="367,486 356,490 356,481" style="fill:rgb(0,0,0)"/>
<path d="M344,486L362,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M367,501L417,501L417,470L367,470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="392" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="440,486 428,490 428,481" style="fill:rgb(0,0,0)"/>
<path d="M417,486L434,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,538A15 15 0 0 0 293 523A15 15 0 0 0 278 508A15 15 0 0 0 263 523A15 15 0 0 0 278 538Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="523" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="316,523 305,528 305,519" style="fill:rgb(0,0,0)"/>
<path d="M293,523L310,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,538L365,538L365,508L316,508Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="341" y="523" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="227,455 215,460 215,451" style="fill:rgb(0,0,0)"/>
<path d="M204,455L221,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="263,523 251,528 251,519" style="fill:rgb(0,0,0)"/>
<path d="M227,455 L 234,455 Q 242,455 242,470 L 242,508 Q 242,523 249,523 L 257,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="263,486 251,490 251,481" style="fill:rgb(0,0,0)"/>
<path d="M227,455 L 234,455 Q 242,455 242,470 L 242,471 Q 242,486 249,486 L 257,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="440,455 428,460 428,451" style="fill:rgb(0,0,0)"/>
<path d="M227,455L434,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="642,554 631,558 631,549" style="fill:rgb(0,0,0)"/>
<path d="M440,455 L 461,455 Q 476,455 476,470 L 476,539 Q 476,554 491,554 L 622,554 L 637,554"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="646" cy="554" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M440,486 L 461,486 Q 476,486 476,493 L 476,501"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="440,523 428,528 428,519" style="fill:rgb(0,0,0)"/>
<path d="M365,523L434,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M440,523 L 461,523 Q 476,523 476,531 L 476,538"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="440,554 428,558 428,549" style="fill:rgb(0,0,0)"/>
<path d="M47,440 L 47,539 Q 47,554 62,554 L 419,554 L 434,554"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M440,554L512,554"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>
<br></br>
References:&nbsp;&nbsp; <a href='./common-table-expression.html'>common-table-expression</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./ordering-term.html'>ordering-term</a>&nbsp;&nbsp; <a href='./select-core.html'>select-core</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>
</div>



Added Doc/Extra/Core/syntax/conflict-clause.html.









































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: conflict-clause</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>conflict-clause</h1>
<div class='imgcontainer'>
<div style="max-width:451px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 451.517 205.2">
<circle cx="5" cy="6" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,6 20,10 20,2" style="fill:rgb(0,0,0)"/>
<path d="M9,6L26,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,36 58,41 58,32" style="fill:rgb(0,0,0)"/>
<path d="M32,6 L 39,6 Q 47,6 47,21 L 47,21 Q 47,36 56,36 L 64,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,51L94,51A15 15 0 0 0 109 36L109,36A15 15 0 0 0 94 21L85,21A15 15 0 0 0 70 36L70,36A15 15 0 0 0 85 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="90" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="132,36 121,41 121,32" style="fill:rgb(0,0,0)"/>
<path d="M109,36L126,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M147,51L222,51A15 15 0 0 0 237 36L237,36A15 15 0 0 0 222 21L147,21A15 15 0 0 0 132 36L132,36A15 15 0 0 0 147 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONFLICT</text>
<polygon points="273,36 261,41 261,32" style="fill:rgb(0,0,0)"/>
<path d="M237,36L267,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,51L365,51A15 15 0 0 0 381 36L381,36A15 15 0 0 0 365 21L288,21A15 15 0 0 0 273 36L273,36A15 15 0 0 0 288 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="327" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<path d="M288,89L330,89A15 15 0 0 0 345 74L345,74A15 15 0 0 0 330 59L288,59A15 15 0 0 0 273 74L273,74A15 15 0 0 0 288 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="309" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<path d="M288,127L310,127A15 15 0 0 0 325 112A15 15 0 0 0 310 97L288,97A15 15 0 0 0 273 112A15 15 0 0 0 288 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<path d="M288,165L340,165A15 15 0 0 0 355 150A15 15 0 0 0 340 135L288,135A15 15 0 0 0 273 150A15 15 0 0 0 288 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="314" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<path d="M288,203L352,203A15 15 0 0 0 367 187A15 15 0 0 0 352 172L288,172A15 15 0 0 0 273 187A15 15 0 0 0 288 203Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="320" y="187" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<polygon points="404,36 392,41 392,32" style="fill:rgb(0,0,0)"/>
<path d="M381,36L398,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="442,6 430,10 430,2" style="fill:rgb(0,0,0)"/>
<path d="M404,36 L 411,36 Q 419,36 419,21 L 419,21 Q 419,6 427,6 L 436,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="445" cy="6" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="225,6 214,10 214,2" style="fill:rgb(0,0,0)"/>
<path d="M9,6L219,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,6L434,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,187 261,192 261,183" style="fill:rgb(0,0,0)"/>
<path d="M237,36 L 244,36 Q 252,36 252,51 L 252,172 Q 252,187 259,187 L 267,187"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,187 392,192 392,183" style="fill:rgb(0,0,0)"/>
<path d="M367,187L398,187"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,187 L 411,187 Q 419,187 419,172 L 419,36 L 419,21"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,74 261,78 261,70" style="fill:rgb(0,0,0)"/>
<path d="M252,59 L 252,66 Q 252,74 259,74 L 267,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,74 392,78 392,70" style="fill:rgb(0,0,0)"/>
<path d="M345,74L398,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,74 L 411,74 Q 419,74 419,67 L 419,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,112 261,116 261,108" style="fill:rgb(0,0,0)"/>
<path d="M252,97 L 252,104 Q 252,112 259,112 L 267,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,112 392,116 392,108" style="fill:rgb(0,0,0)"/>
<path d="M325,112L398,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,112 L 411,112 Q 419,112 419,104 L 419,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,150 261,154 261,145" style="fill:rgb(0,0,0)"/>
<path d="M252,135 L 252,142 Q 252,150 259,150 L 267,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,150 392,154 392,145" style="fill:rgb(0,0,0)"/>
<path d="M355,150L398,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,150 L 411,150 Q 419,150 419,142 L 419,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./column-constraint.html'>column-constraint</a>&nbsp;&nbsp; <a href='./table-constraint.html'>table-constraint</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_conflict.html'>lang_conflict.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>
</div>



Added Doc/Extra/Core/syntax/create-index-stmt.html.























































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: create-index-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>create-index-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:907px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 907.43 232.632">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L100,32A15 15 0 0 0 116 17A15 15 0 0 0 100 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CREATE</text>
<path d="M167,56L222,56A15 15 0 0 0 237 41A15 15 0 0 0 222 26L167,26A15 15 0 0 0 152 41A15 15 0 0 0 167 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNIQUE</text>
<path d="M288,32L327,32A15 15 0 0 0 342 17A15 15 0 0 0 327 2L288,2A15 15 0 0 0 273 17A15 15 0 0 0 288 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="307" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEX</text>
<polygon points="194,17 183,21 183,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L188,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,17 261,21 261,12" style="fill:rgb(0,0,0)"/>
<path d="M194,17L267,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,41 140,45 140,37" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,29 Q 131,41 138,41 L 146,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M237,41 L 244,41 Q 252,41 252,29 Q 252,17 256,17 L 261,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,17 367,21 367,12" style="fill:rgb(0,0,0)"/>
<path d="M342,17L372,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,32A15 15 0 0 0 408 17A15 15 0 0 0 393 2A15 15 0 0 0 378 17A15 15 0 0 0 393 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="393" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="431,17 420,21 420,12" style="fill:rgb(0,0,0)"/>
<path d="M408,17L426,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M447,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L447,2A15 15 0 0 0 431 17A15 15 0 0 0 447 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="457" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="505,17 493,21 493,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L499,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M520,32L565,32A15 15 0 0 0 580 17A15 15 0 0 0 565 2L520,2A15 15 0 0 0 505 17A15 15 0 0 0 520 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="542" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="194,71 206,67 206,76" style="fill:rgb(0,0,0)"/>
<path d="M342,17 L 350,17 Q 357,17 357,32 L 357,56 Q 357,71 342,71 L 215,71 L 200,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,71 516,67 516,76" style="fill:rgb(0,0,0)"/>
<path d="M580,17 L 601,17 Q 616,17 616,32 L 616,56 Q 616,71 601,71 L 526,71 L 511,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,71L273,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,109 17,113 17,105" style="fill:rgb(0,0,0)"/>
<path d="M273,71 L 20,71 Q 5,71 5,86 L 5,94 Q 5,109 14,109 L 23,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,124L140,124A15 15 0 0 0 155 109A15 15 0 0 0 140 94L43,94A15 15 0 0 0 28 109A15 15 0 0 0 43 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="178,109 166,113 166,105" style="fill:rgb(0,0,0)"/>
<path d="M155,109L172,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M193,124A15 15 0 0 0 208 109A15 15 0 0 0 193 94A15 15 0 0 0 178 109A15 15 0 0 0 193 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="109" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="244,109 233,113 233,105" style="fill:rgb(0,0,0)"/>
<path d="M208,109L238,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,124L338,124A15 15 0 0 0 353 109A15 15 0 0 0 338 94L259,94A15 15 0 0 0 244 109A15 15 0 0 0 259 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<polygon points="376,109 364,113 364,105" style="fill:rgb(0,0,0)"/>
<path d="M353,109L370,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,124L400,124A15 15 0 0 0 415 109A15 15 0 0 0 400 94L391,94A15 15 0 0 0 376 109A15 15 0 0 0 391 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="438,109 427,113 427,105" style="fill:rgb(0,0,0)"/>
<path d="M415,109L432,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,124L528,124A15 15 0 0 0 543 109A15 15 0 0 0 528 94L453,94A15 15 0 0 0 438 109A15 15 0 0 0 453 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="491" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="567,109 555,113 555,105" style="fill:rgb(0,0,0)"/>
<path d="M543,109L561,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,124A15 15 0 0 0 597 109A15 15 0 0 0 582 94A15 15 0 0 0 567 109A15 15 0 0 0 582 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="109" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="633,109 621,113 621,105" style="fill:rgb(0,0,0)"/>
<path d="M597,109L627,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M633,124L777,124L777,94L633,94Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="705" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">indexed-column</text>
<polygon points="813,109 802,113 802,105" style="fill:rgb(0,0,0)"/>
<path d="M777,109L808,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M828,124A15 15 0 0 0 844 109A15 15 0 0 0 828 94A15 15 0 0 0 813 109A15 15 0 0 0 828 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="828" y="109" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<path d="M705,162A15 15 0 0 0 720 147A15 15 0 0 0 705 132A15 15 0 0 0 690 147A15 15 0 0 0 705 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="705" y="147" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="720,147 732,142 732,151" style="fill:rgb(0,0,0)"/>
<path d="M777,109 L 785,109 Q 792,109 792,124 L 792,132 Q 792,147 777,147 L 741,147 L 726,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M690,147 L 625,147 Q 610,147 610,132 L 610,124 Q 610,109 617,109 L 625,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="92,139 80,144 80,135" style="fill:rgb(0,0,0)"/>
<path d="M5,94 L 5,124 Q 5,139 20,139 L 71,139 L 86,139"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M92,139 L 205,139 Q 220,139 220,124 L 220,124 Q 220,109 227,109 L 235,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M684,230L733,230A15 15 0 0 0 748 215A15 15 0 0 0 733 200L684,200A15 15 0 0 0 669 215A15 15 0 0 0 684 230Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="709" y="215" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="772,215 760,219 760,211" style="fill:rgb(0,0,0)"/>
<path d="M748,215L766,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M772,230L821,230L821,200L772,200Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="796" y="215" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="898,215 886,219 886,211" style="fill:rgb(0,0,0)"/>
<path d="M821,215L892,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="901" cy="215" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="859,147 854,135 863,135" style="fill:rgb(0,0,0)"/>
<path d="M844,109 L 851,109 Q 859,109 859,124 L 859,126 L 859,141"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M859,147 L 859,200 Q 859,215 872,215 L 886,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="705,177 717,173 717,181" style="fill:rgb(0,0,0)"/>
<path d="M859,147 L 859,162 Q 859,177 844,177 L 726,177 L 711,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="669,215 657,219 657,211" style="fill:rgb(0,0,0)"/>
<path d="M705,177 L 661,177 Q 646,177 646,192 L 646,200 Q 646,215 654,215 L 663,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./indexed-column.html'>indexed-column</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>
</div>



Added Doc/Extra/Core/syntax/create-table-stmt.html.























































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: create-table-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>create-table-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:718px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 718.33 315.792">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L100,32A15 15 0 0 0 116 17A15 15 0 0 0 100 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CREATE</text>
<path d="M167,56L199,56A15 15 0 0 0 214 41A15 15 0 0 0 199 26L167,26A15 15 0 0 0 152 41A15 15 0 0 0 167 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMP</text>
<path d="M167,94L259,94A15 15 0 0 0 274 79A15 15 0 0 0 259 64L167,64A15 15 0 0 0 152 79A15 15 0 0 0 167 94Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="213" y="79" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMPORARY</text>
<path d="M325,32L365,32A15 15 0 0 0 380 17A15 15 0 0 0 365 2L325,2A15 15 0 0 0 310 17A15 15 0 0 0 325 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TABLE</text>
<polygon points="213,17 201,21 201,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L207,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="310,17 299,21 299,12" style="fill:rgb(0,0,0)"/>
<path d="M213,17L305,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,41 140,45 140,37" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,29 Q 131,41 138,41 L 146,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,79 140,83 140,74" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,32 L 131,64 Q 131,79 138,79 L 146,79"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M274,79 L 282,79 Q 289,79 289,64 L 289,32 Q 289,17 294,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M214,41 L 274,41 Q 289,41 289,33 L 289,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="416,17 404,21 404,12" style="fill:rgb(0,0,0)"/>
<path d="M380,17L410,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,32A15 15 0 0 0 446 17A15 15 0 0 0 431 2A15 15 0 0 0 416 17A15 15 0 0 0 431 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="431" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="469,17 458,21 458,12" style="fill:rgb(0,0,0)"/>
<path d="M446,17L463,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M484,32L504,32A15 15 0 0 0 520 17A15 15 0 0 0 504 2L484,2A15 15 0 0 0 469 17A15 15 0 0 0 484 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="494" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="543,17 531,21 531,12" style="fill:rgb(0,0,0)"/>
<path d="M520,17L537,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,32L602,32A15 15 0 0 0 617 17A15 15 0 0 0 602 2L558,2A15 15 0 0 0 543 17A15 15 0 0 0 558 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="580" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="213,109 224,105 224,113" style="fill:rgb(0,0,0)"/>
<path d="M380,17 L 387,17 Q 395,17 395,32 L 395,94 Q 395,109 380,109 L 234,109 L 219,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="543,109 554,105 554,113" style="fill:rgb(0,0,0)"/>
<path d="M617,17 L 625,17 Q 632,17 632,32 L 632,94 Q 632,109 617,109 L 563,109 L 548,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M543,109L310,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,147 17,151 17,142" style="fill:rgb(0,0,0)"/>
<path d="M310,109 L 20,109 Q 5,109 5,124 L 5,132 Q 5,147 14,147 L 23,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,162L140,162A15 15 0 0 0 155 147A15 15 0 0 0 140 132L43,132A15 15 0 0 0 28 147A15 15 0 0 0 43 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="178,147 166,151 166,142" style="fill:rgb(0,0,0)"/>
<path d="M155,147L172,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M193,162A15 15 0 0 0 208 147A15 15 0 0 0 193 132A15 15 0 0 0 178 147A15 15 0 0 0 193 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="147" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="244,147 233,151 233,142" style="fill:rgb(0,0,0)"/>
<path d="M208,147L238,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,162L334,162A15 15 0 0 0 350 147A15 15 0 0 0 334 132L259,132A15 15 0 0 0 244 147A15 15 0 0 0 259 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="297" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="92,177 80,181 80,173" style="fill:rgb(0,0,0)"/>
<path d="M5,132 L 5,162 Q 5,177 20,177 L 71,177 L 86,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M92,177 L 205,177 Q 220,177 220,162 L 220,162 Q 220,147 227,147 L 235,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="193,222 205,218 205,227" style="fill:rgb(0,0,0)"/>
<path d="M350,147 L 357,147 Q 365,147 365,162 L 365,207 Q 365,222 350,222 L 214,222 L 199,222"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,260 17,265 17,256" style="fill:rgb(0,0,0)"/>
<path d="M193,222 L 20,222 Q 5,222 5,237 L 5,245 Q 5,260 14,260 L 23,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,275A15 15 0 0 0 59 260A15 15 0 0 0 43 245A15 15 0 0 0 28 260A15 15 0 0 0 43 275Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="43" y="260" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="95,260 83,265 83,256" style="fill:rgb(0,0,0)"/>
<path d="M59,260L89,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,275L199,275L199,245L95,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="147" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-def</text>
<path d="M253,313L399,313L399,283L253,283Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="326" y="298" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-constraint</text>
<polygon points="399,298 410,294 410,302" style="fill:rgb(0,0,0)"/>
<path d="M404,298L416,298"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,313A15 15 0 0 0 446 298A15 15 0 0 0 431 283A15 15 0 0 0 416 298A15 15 0 0 0 431 313Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="431" y="298" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M503,275A15 15 0 0 0 518 260A15 15 0 0 0 503 245A15 15 0 0 0 488 260A15 15 0 0 0 503 275Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="503" y="260" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="553,260 541,265 541,256" style="fill:rgb(0,0,0)"/>
<path d="M518,260L547,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M553,275L674,275L674,245L553,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="613" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-options</text>
<path d="M147,313A15 15 0 0 0 162 298A15 15 0 0 0 147 283A15 15 0 0 0 132 298A15 15 0 0 0 147 313Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="147" y="298" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="162,298 174,294 174,302" style="fill:rgb(0,0,0)"/>
<path d="M199,260 L 207,260 Q 214,260 214,275 L 214,283 Q 214,298 199,298 L 183,298 L 168,298"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,298 L 87,298 Q 72,298 72,283 L 72,275 Q 72,260 77,260 L 83,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="235,260 224,265 224,256" style="fill:rgb(0,0,0)"/>
<path d="M199,260L230,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="488,260 476,265 476,256" style="fill:rgb(0,0,0)"/>
<path d="M235,260L482,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,298 458,294 458,302" style="fill:rgb(0,0,0)"/>
<path d="M446,260 L 458,260 Q 469,260 469,275 L 469,283 Q 469,298 460,298 L 452,298"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M253,298 L 246,298 Q 238,298 238,283 L 238,275 Q 238,260 250,260 L 261,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="613,215 602,219 602,211" style="fill:rgb(0,0,0)"/>
<path d="M518,260 L 526,260 Q 533,260 533,245 L 533,230 Q 533,215 548,215 L 592,215 L 607,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="708,215 697,219 697,211" style="fill:rgb(0,0,0)"/>
<path d="M613,215 L 659,215 Q 674,215 688,215 L 703,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="712" cy="215" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="708,215 697,219 697,211" style="fill:rgb(0,0,0)"/>
<path d="M674,260 L 681,260 Q 689,260 689,245 L 689,230 Q 689,215 696,215 L 703,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="440,147 428,151 428,142" style="fill:rgb(0,0,0)"/>
<path d="M350,147L434,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,162L459,162A15 15 0 0 0 474 147A15 15 0 0 0 459 132L455,132A15 15 0 0 0 440 147A15 15 0 0 0 455 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="457" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="497,147 485,151 485,142" style="fill:rgb(0,0,0)"/>
<path d="M474,147L491,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M497,162L601,162L601,132L497,132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="549" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="637,147 626,151 626,142" style="fill:rgb(0,0,0)"/>
<path d="M601,147L631,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M637,147 L 674,147 Q 689,147 689,162 L 689,200 Q 689,215 696,215 L 704,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./column-def.html'>column-def</a>&nbsp;&nbsp; <a href='./select-stmt.html'>select-stmt</a>&nbsp;&nbsp; <a href='./table-constraint.html'>table-constraint</a>&nbsp;&nbsp; <a href='./table-options.html'>table-options</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>
</div>



Added Doc/Extra/Core/syntax/create-trigger-stmt.html.















































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: create-trigger-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>create-trigger-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:678px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 678.058 746.712">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L100,32A15 15 0 0 0 116 17A15 15 0 0 0 100 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CREATE</text>
<path d="M167,56L199,56A15 15 0 0 0 214 41A15 15 0 0 0 199 26L167,26A15 15 0 0 0 152 41A15 15 0 0 0 167 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMP</text>
<path d="M167,94L259,94A15 15 0 0 0 274 79A15 15 0 0 0 259 64L167,64A15 15 0 0 0 152 79A15 15 0 0 0 167 94Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="213" y="79" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMPORARY</text>
<path d="M325,32L386,32A15 15 0 0 0 401 17A15 15 0 0 0 386 2L325,2A15 15 0 0 0 310 17A15 15 0 0 0 325 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRIGGER</text>
<polygon points="213,17 201,21 201,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L207,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="310,17 299,21 299,12" style="fill:rgb(0,0,0)"/>
<path d="M213,17L305,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,41 140,45 140,37" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,29 Q 131,41 138,41 L 146,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,79 140,83 140,74" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,32 L 131,64 Q 131,79 138,79 L 146,79"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M274,79 L 282,79 Q 289,79 289,64 L 289,32 Q 289,17 294,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M214,41 L 274,41 Q 289,41 289,33 L 289,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="437,17 425,21 425,12" style="fill:rgb(0,0,0)"/>
<path d="M401,17L431,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M452,32A15 15 0 0 0 467 17A15 15 0 0 0 452 2A15 15 0 0 0 437 17A15 15 0 0 0 452 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="452" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="490,17 478,21 478,12" style="fill:rgb(0,0,0)"/>
<path d="M467,17L484,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,32L525,32A15 15 0 0 0 540 17A15 15 0 0 0 525 2L505,2A15 15 0 0 0 490 17A15 15 0 0 0 505 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="515" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="563,17 552,21 552,12" style="fill:rgb(0,0,0)"/>
<path d="M540,17L558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,32L623,32A15 15 0 0 0 638 17A15 15 0 0 0 623 2L578,2A15 15 0 0 0 563 17A15 15 0 0 0 578 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="601" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="213,109 224,105 224,113" style="fill:rgb(0,0,0)"/>
<path d="M401,17 L 408,17 Q 416,17 416,32 L 416,94 Q 416,109 401,109 L 234,109 L 219,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="563,109 575,105 575,113" style="fill:rgb(0,0,0)"/>
<path d="M638,17 L 646,17 Q 653,17 653,32 L 653,94 Q 653,109 638,109 L 584,109 L 569,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M563,109L310,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,147 17,151 17,142" style="fill:rgb(0,0,0)"/>
<path d="M310,109 L 20,109 Q 5,109 5,124 L 5,132 Q 5,147 14,147 L 23,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,162L140,162A15 15 0 0 0 155 147A15 15 0 0 0 140 132L43,132A15 15 0 0 0 28 147A15 15 0 0 0 43 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="178,147 166,151 166,142" style="fill:rgb(0,0,0)"/>
<path d="M155,147L172,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M193,162A15 15 0 0 0 208 147A15 15 0 0 0 193 132A15 15 0 0 0 178 147A15 15 0 0 0 193 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="147" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="244,147 233,151 233,142" style="fill:rgb(0,0,0)"/>
<path d="M208,147L238,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,162L351,162A15 15 0 0 0 366 147A15 15 0 0 0 351 132L259,132A15 15 0 0 0 244 147A15 15 0 0 0 259 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="305" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">trigger-name</text>
<polygon points="402,147 391,151 391,142" style="fill:rgb(0,0,0)"/>
<path d="M366,147L396,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,162L472,162A15 15 0 0 0 487 147A15 15 0 0 0 472 132L417,132A15 15 0 0 0 402 147A15 15 0 0 0 417 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BEFORE</text>
<path d="M417,200L457,200A15 15 0 0 0 472 185A15 15 0 0 0 457 169L417,169A15 15 0 0 0 402 185A15 15 0 0 0 417 200Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="437" y="185" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AFTER</text>
<path d="M417,238L479,238A15 15 0 0 0 494 222A15 15 0 0 0 479 207L417,207A15 15 0 0 0 402 222A15 15 0 0 0 417 238Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="448" y="222" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INSTEAD</text>
<polygon points="517,222 505,227 505,218" style="fill:rgb(0,0,0)"/>
<path d="M494,222L511,222"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,238L538,238A15 15 0 0 0 553 222A15 15 0 0 0 538 207L532,207A15 15 0 0 0 517 222A15 15 0 0 0 532 238Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="535" y="222" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OF</text>
<polygon points="402,185 391,189 391,180" style="fill:rgb(0,0,0)"/>
<path d="M366,147 L 374,147 Q 381,147 381,162 L 381,170 Q 381,185 389,185 L 396,185"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="402,222 391,227 391,218" style="fill:rgb(0,0,0)"/>
<path d="M366,147 L 374,147 Q 381,147 381,162 L 381,207 Q 381,222 389,222 L 396,222"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="92,177 80,181 80,173" style="fill:rgb(0,0,0)"/>
<path d="M5,132 L 5,162 Q 5,177 20,177 L 71,177 L 86,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M92,177 L 205,177 Q 220,177 220,162 L 220,162 Q 220,147 227,147 L 235,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="193,260 205,256 205,265" style="fill:rgb(0,0,0)"/>
<path d="M381,207 L 381,245 Q 381,260 366,260 L 214,260 L 199,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="576,222 564,227 564,218" style="fill:rgb(0,0,0)"/>
<path d="M553,222L570,222"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="448,260 459,256 459,265" style="fill:rgb(0,0,0)"/>
<path d="M576,222 L 584,222 Q 591,222 591,237 L 591,245 Q 591,260 576,260 L 469,260 L 454,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,260L366,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="576,147 564,151 564,142" style="fill:rgb(0,0,0)"/>
<path d="M487,147L570,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M576,147 L 584,147 Q 591,147 591,162 L 591,223 L 591,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="576,185 564,189 564,180" style="fill:rgb(0,0,0)"/>
<path d="M472,185L570,185"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M576,185 L 584,185 Q 591,185 591,192 L 591,200"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,306L96,306A15 15 0 0 0 111 290L111,290A15 15 0 0 0 96 275L43,275A15 15 0 0 0 28 290L28,290A15 15 0 0 0 43 306Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="290" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DELETE</text>
<path d="M43,343L92,343A15 15 0 0 0 107 328A15 15 0 0 0 92 313L43,313A15 15 0 0 0 28 328A15 15 0 0 0 43 343Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="68" y="328" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INSERT</text>
<path d="M43,381L98,381A15 15 0 0 0 113 366A15 15 0 0 0 98 351L43,351A15 15 0 0 0 28 366A15 15 0 0 0 43 381Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="366" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="28,366 17,370 17,362" style="fill:rgb(0,0,0)"/>
<path d="M193,260 L 20,260 Q 5,260 5,275 L 5,351 Q 5,366 14,366 L 23,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,290 17,295 17,286" style="fill:rgb(0,0,0)"/>
<path d="M5,275 L 5,283 Q 5,290 14,290 L 23,290"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,328 17,333 17,324" style="fill:rgb(0,0,0)"/>
<path d="M5,313 L 5,321 Q 5,328 14,328 L 23,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M164,411L170,411A15 15 0 0 0 185 396A15 15 0 0 0 170 381L164,381A15 15 0 0 0 149 396A15 15 0 0 0 164 411Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="396" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OF</text>
<polygon points="221,396 209,401 209,392" style="fill:rgb(0,0,0)"/>
<path d="M185,396L215,396"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,411L330,411A15 15 0 0 0 345 396A15 15 0 0 0 330 381L236,381A15 15 0 0 0 221 396A15 15 0 0 0 236 411Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="283" y="396" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<path d="M283,449L283,449A15 15 0 0 0 298 434A15 15 0 0 0 283 419L283,419A15 15 0 0 0 268 434A15 15 0 0 0 283 449Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="283" y="434" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="381,396 369,401 369,392" style="fill:rgb(0,0,0)"/>
<path d="M345,396L375,396"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="419,290 408,295 408,286" style="fill:rgb(0,0,0)"/>
<path d="M381,396 L 388,396 Q 396,396 396,381 L 396,305 Q 396,290 405,290 L 413,290"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M434,306L443,306A15 15 0 0 0 458 290L458,290A15 15 0 0 0 443 275L434,275A15 15 0 0 0 419 290L419,290A15 15 0 0 0 434 306Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="290" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="481,290 470,295 470,286" style="fill:rgb(0,0,0)"/>
<path d="M458,290L475,290"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M496,306L572,306A15 15 0 0 0 587 290L587,290A15 15 0 0 0 572 275L496,275A15 15 0 0 0 481 290L481,290A15 15 0 0 0 496 306Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="290" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<path d="M111,290L408,290"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="381,328 369,333 369,324" style="fill:rgb(0,0,0)"/>
<path d="M107,328L375,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M381,328 L 388,328 Q 396,328 396,321 L 396,313"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="381,366 369,370 369,362" style="fill:rgb(0,0,0)"/>
<path d="M113,366L375,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M381,366 L 388,366 Q 396,366 396,359 L 396,351"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="149,396 137,401 137,392" style="fill:rgb(0,0,0)"/>
<path d="M113,366 L 120,366 Q 128,366 128,381 L 128,381 Q 128,396 135,396 L 143,396"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,434 309,430 309,438" style="fill:rgb(0,0,0)"/>
<path d="M345,396 L 352,396 Q 360,396 360,411 L 360,419 Q 360,434 345,434 L 319,434 L 304,434"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M268,434 L 213,434 Q 198,434 198,419 L 198,411 Q 198,396 205,396 L 213,396"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,525L62,525A15 15 0 0 0 77 510A15 15 0 0 0 62 495L43,495A15 15 0 0 0 28 510A15 15 0 0 0 43 525Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="52" y="510" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOR</text>
<polygon points="100,510 88,514 88,505" style="fill:rgb(0,0,0)"/>
<path d="M77,510L94,510"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M115,525L147,525A15 15 0 0 0 162 510A15 15 0 0 0 147 495L115,495A15 15 0 0 0 100 510A15 15 0 0 0 115 525Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="131" y="510" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EACH</text>
<polygon points="185,510 174,514 174,505" style="fill:rgb(0,0,0)"/>
<path d="M162,510L179,510"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,525L224,525A15 15 0 0 0 240 510A15 15 0 0 0 224 495L200,495A15 15 0 0 0 185 510A15 15 0 0 0 200 525Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="212" y="510" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="312,510 300,514 300,505" style="fill:rgb(0,0,0)"/>
<path d="M240,510L306,510"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M327,525L366,525A15 15 0 0 0 381 510A15 15 0 0 0 366 495L327,495A15 15 0 0 0 312 510A15 15 0 0 0 327 525Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="510" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="404,510 393,514 393,505" style="fill:rgb(0,0,0)"/>
<path d="M381,510L399,510"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,525L454,525L454,495L404,495Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="510" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M43,631L82,631A15 15 0 0 0 97 616A15 15 0 0 0 82 600L43,600A15 15 0 0 0 28 616A15 15 0 0 0 43 631Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="63" y="616" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BEGIN</text>
<polygon points="169,616 158,620 158,611" style="fill:rgb(0,0,0)"/>
<path d="M97,616L163,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M169,631L282,631L282,600L169,600Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="226" y="616" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">update-stmt</text>
<polygon points="336,616 324,620 324,611" style="fill:rgb(0,0,0)"/>
<path d="M282,616L330,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,631A15 15 0 0 0 366 616A15 15 0 0 0 351 600A15 15 0 0 0 336 616A15 15 0 0 0 351 631Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="616" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">;</text>
<polygon points="402,616 391,620 391,611" style="fill:rgb(0,0,0)"/>
<path d="M366,616L396,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,631L438,631A15 15 0 0 0 453 616A15 15 0 0 0 438 600L417,600A15 15 0 0 0 402 616A15 15 0 0 0 417 631Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="428" y="616" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="668,616 657,620 657,611" style="fill:rgb(0,0,0)"/>
<path d="M453,616L662,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="672" cy="616" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M169,668L273,668L273,638L169,638Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="221" y="653" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">insert-stmt</text>
<path d="M169,706L276,706L276,676L169,676Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="223" y="691" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">delete-stmt</text>
<path d="M169,744L273,744L273,714L169,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="221" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="169,729 158,733 158,725" style="fill:rgb(0,0,0)"/>
<path d="M131,616 L 139,616 Q 146,616 146,631 L 146,714 Q 146,729 155,729 L 163,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="169,653 158,658 158,649" style="fill:rgb(0,0,0)"/>
<path d="M146,638 L 146,646 Q 146,653 155,653 L 163,653"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="169,691 158,695 158,687" style="fill:rgb(0,0,0)"/>
<path d="M146,676 L 146,684 Q 146,691 155,691 L 163,691"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,729 286,733 286,725" style="fill:rgb(0,0,0)"/>
<path d="M273,729L292,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,729 L 305,729 Q 313,729 313,714 L 313,631 Q 313,616 319,616 L 324,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,653 286,658 286,649" style="fill:rgb(0,0,0)"/>
<path d="M273,653L292,653"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,653 L 305,653 Q 313,653 313,646 L 313,638"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,691 286,695 286,687" style="fill:rgb(0,0,0)"/>
<path d="M276,691L292,691"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,691 L 305,691 Q 313,691 313,684 L 313,676"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="226,585 237,581 237,590" style="fill:rgb(0,0,0)"/>
<path d="M366,616 L 374,616 Q 381,616 381,601 L 381,600 Q 381,585 366,585 L 246,585 L 231,585"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="132,616 120,620 120,611" style="fill:rgb(0,0,0)"/>
<path d="M226,585 L 124,585 Q 109,585 109,600 L 109,601 Q 109,616 117,616 L 126,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="602,434 597,423 606,423" style="fill:rgb(0,0,0)"/>
<path d="M587,290 L 594,290 Q 602,290 602,305 L 602,414 L 602,429"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="226,472 237,468 237,476" style="fill:rgb(0,0,0)"/>
<path d="M602,434 L 602,457 Q 602,472 587,472 L 246,472 L 231,472"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,616 17,620 17,611" style="fill:rgb(0,0,0)"/>
<path d="M226,472 L 20,472 Q 5,472 5,487 L 5,601 Q 5,616 14,616 L 23,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,510 17,514 17,505" style="fill:rgb(0,0,0)"/>
<path d="M5,495 L 5,502 Q 5,510 14,510 L 23,510"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="226,547 237,543 237,552" style="fill:rgb(0,0,0)"/>
<path d="M454,510 L 461,510 Q 469,510 469,525 L 469,532 Q 469,547 454,547 L 246,547 L 231,547"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M226,547 L 20,547 Q 5,547 5,555 L 5,562"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,510 L 247,510 Q 255,510 255,525 L 255,532 Q 255,547 247,547 L 240,547"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M312,510 L 297,510 Q 282,510 282,495 L 282,487 Q 282,472 297,472 L 312,472"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./delete-stmt.html'>delete-stmt</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./insert-stmt.html'>insert-stmt</a>&nbsp;&nbsp; <a href='./select-stmt.html'>select-stmt</a>&nbsp;&nbsp; <a href='./update-stmt.html'>update-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>
</div>



Added Doc/Extra/Core/syntax/create-view-stmt.html.













































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: create-view-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>create-view-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:885px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 885.677 232.632">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L100,32A15 15 0 0 0 116 17A15 15 0 0 0 100 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CREATE</text>
<path d="M167,56L199,56A15 15 0 0 0 214 41A15 15 0 0 0 199 26L167,26A15 15 0 0 0 152 41A15 15 0 0 0 167 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMP</text>
<path d="M167,94L259,94A15 15 0 0 0 274 79A15 15 0 0 0 259 64L167,64A15 15 0 0 0 152 79A15 15 0 0 0 167 94Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="213" y="79" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMPORARY</text>
<path d="M325,32L355,32A15 15 0 0 0 370 17A15 15 0 0 0 355 2L325,2A15 15 0 0 0 310 17A15 15 0 0 0 325 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="340" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VIEW</text>
<polygon points="213,17 201,21 201,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L207,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="310,17 299,21 299,12" style="fill:rgb(0,0,0)"/>
<path d="M213,17L305,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,41 140,45 140,37" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,29 Q 131,41 138,41 L 146,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,79 140,83 140,74" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,32 L 131,64 Q 131,79 138,79 L 146,79"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M274,79 L 282,79 Q 289,79 289,64 L 289,32 Q 289,17 294,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M214,41 L 274,41 Q 289,41 289,33 L 289,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M370,17L400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M421,32A15 15 0 0 0 436 17A15 15 0 0 0 421 2A15 15 0 0 0 406 17A15 15 0 0 0 421 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="421" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="459,17 447,21 447,12" style="fill:rgb(0,0,0)"/>
<path d="M436,17L453,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M474,32L494,32A15 15 0 0 0 509 17A15 15 0 0 0 494 2L474,2A15 15 0 0 0 459 17A15 15 0 0 0 474 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="532,17 521,21 521,12" style="fill:rgb(0,0,0)"/>
<path d="M509,17L527,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,32L592,32A15 15 0 0 0 607 17A15 15 0 0 0 592 2L547,2A15 15 0 0 0 532 17A15 15 0 0 0 547 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="570" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="213,109 224,105 224,113" style="fill:rgb(0,0,0)"/>
<path d="M370,17 L 377,17 Q 385,17 385,32 L 385,94 Q 385,109 370,109 L 234,109 L 219,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="532,109 544,105 544,113" style="fill:rgb(0,0,0)"/>
<path d="M607,17 L 615,17 Q 622,17 622,32 L 622,94 Q 622,109 607,109 L 553,109 L 538,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,109L310,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,147 17,151 17,142" style="fill:rgb(0,0,0)"/>
<path d="M310,109 L 20,109 Q 5,109 5,124 L 5,132 Q 5,147 14,147 L 23,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,162L140,162A15 15 0 0 0 155 147A15 15 0 0 0 140 132L43,132A15 15 0 0 0 28 147A15 15 0 0 0 43 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="178,147 166,151 166,142" style="fill:rgb(0,0,0)"/>
<path d="M155,147L172,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M193,162A15 15 0 0 0 208 147A15 15 0 0 0 193 132A15 15 0 0 0 178 147A15 15 0 0 0 193 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="147" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="244,147 233,151 233,142" style="fill:rgb(0,0,0)"/>
<path d="M208,147L238,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,162L330,162A15 15 0 0 0 345 147A15 15 0 0 0 330 132L259,132A15 15 0 0 0 244 147A15 15 0 0 0 259 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="295" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">view-name</text>
<polygon points="383,177 372,181 372,173" style="fill:rgb(0,0,0)"/>
<path d="M345,147 L 353,147 Q 360,147 360,162 L 360,162 Q 360,177 369,177 L 378,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M399,192A15 15 0 0 0 414 177A15 15 0 0 0 399 162A15 15 0 0 0 383 177A15 15 0 0 0 399 192Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="399" y="177" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="450,177 438,181 438,173" style="fill:rgb(0,0,0)"/>
<path d="M414,177L444,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M465,192L559,192A15 15 0 0 0 574 177A15 15 0 0 0 559 162L465,162A15 15 0 0 0 450 177A15 15 0 0 0 465 192Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="512" y="177" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="610,177 599,181 599,173" style="fill:rgb(0,0,0)"/>
<path d="M574,177L604,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M625,192A15 15 0 0 0 640 177A15 15 0 0 0 625 162A15 15 0 0 0 610 177A15 15 0 0 0 625 192Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="625" y="177" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="678,147 667,151 667,142" style="fill:rgb(0,0,0)"/>
<path d="M640,177 L 648,177 Q 655,177 655,162 L 655,162 Q 655,147 664,147 L 673,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M693,162L697,162A15 15 0 0 0 713 147A15 15 0 0 0 697 132L693,132A15 15 0 0 0 678 147A15 15 0 0 0 693 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="695" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="736,147 724,151 724,142" style="fill:rgb(0,0,0)"/>
<path d="M713,147L730,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M736,162L840,162L840,132L736,132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="788" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="876,147 864,151 864,142" style="fill:rgb(0,0,0)"/>
<path d="M840,147L870,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="879" cy="147" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="92,177 80,181 80,173" style="fill:rgb(0,0,0)"/>
<path d="M5,132 L 5,162 Q 5,177 20,177 L 71,177 L 86,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M92,177 L 206,177 Q 221,177 221,162 L 221,162 Q 221,147 227,147 L 233,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="512,147 500,151 500,142" style="fill:rgb(0,0,0)"/>
<path d="M345,147L506,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M512,147L667,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M512,230A15 15 0 0 0 527 215A15 15 0 0 0 512 200A15 15 0 0 0 497 215A15 15 0 0 0 512 230Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="512" y="215" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="527,215 539,211 539,219" style="fill:rgb(0,0,0)"/>
<path d="M574,177 L 582,177 Q 589,177 589,192 L 589,200 Q 589,215 574,215 L 548,215 L 533,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M497,215 L 442,215 Q 427,215 427,200 L 427,192 Q 427,177 434,177 L 442,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./select-stmt.html'>select-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_createview.html'>lang_createview.html</a>
</div>



Added Doc/Extra/Core/syntax/create-virtual-table-stmt.html.































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: create-virtual-table-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>create-virtual-table-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:624px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 624.096 259.848">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L100,32A15 15 0 0 0 116 17A15 15 0 0 0 100 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CREATE</text>
<polygon points="139,17 127,21 127,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L133,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M154,32L213,32A15 15 0 0 0 228 17A15 15 0 0 0 213 2L154,2A15 15 0 0 0 139 17A15 15 0 0 0 154 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VIRTUAL</text>
<polygon points="251,17 240,21 240,12" style="fill:rgb(0,0,0)"/>
<path d="M228,17L246,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,32L306,32A15 15 0 0 0 321 17A15 15 0 0 0 306 2L266,2A15 15 0 0 0 251 17A15 15 0 0 0 266 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="286" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TABLE</text>
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M321,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M372,32A15 15 0 0 0 387 17A15 15 0 0 0 372 2A15 15 0 0 0 357 17A15 15 0 0 0 372 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="372" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="410,17 399,21 399,12" style="fill:rgb(0,0,0)"/>
<path d="M387,17L404,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M425,32L445,32A15 15 0 0 0 461 17A15 15 0 0 0 445 2L425,2A15 15 0 0 0 410 17A15 15 0 0 0 425 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="435" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="484,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M461,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,32L543,32A15 15 0 0 0 558 17A15 15 0 0 0 543 2L499,2A15 15 0 0 0 484 17A15 15 0 0 0 499 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="521" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<path d="M47,108L143,108A15 15 0 0 0 159 92A15 15 0 0 0 143 77L47,77A15 15 0 0 0 32 92A15 15 0 0 0 47 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="95" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="182,92 170,97 170,88" style="fill:rgb(0,0,0)"/>
<path d="M159,92L176,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,108A15 15 0 0 0 212 92A15 15 0 0 0 197 77A15 15 0 0 0 182 92A15 15 0 0 0 197 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="197" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="248,92 236,97 236,88" style="fill:rgb(0,0,0)"/>
<path d="M212,92L242,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M263,108L338,108A15 15 0 0 0 353 92A15 15 0 0 0 338 77L263,77A15 15 0 0 0 248 92A15 15 0 0 0 263 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<path d="M47,219L86,219A15 15 0 0 0 101 204A15 15 0 0 0 86 189L47,189A15 15 0 0 0 32 204A15 15 0 0 0 47 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="67" y="204" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="124,204 113,209 113,200" style="fill:rgb(0,0,0)"/>
<path d="M101,204L118,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M139,219L234,219A15 15 0 0 0 249 204A15 15 0 0 0 234 189L139,189A15 15 0 0 0 124 204A15 15 0 0 0 139 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="204" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">module-name</text>
<polygon points="285,204 274,209 274,200" style="fill:rgb(0,0,0)"/>
<path d="M249,204L279,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,219A15 15 0 0 0 315 204A15 15 0 0 0 300 189A15 15 0 0 0 285 204A15 15 0 0 0 300 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="204" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,204 340,209 340,200" style="fill:rgb(0,0,0)"/>
<path d="M315,204L346,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,219L497,219A15 15 0 0 0 512 204A15 15 0 0 0 497 189L366,189A15 15 0 0 0 351 204A15 15 0 0 0 366 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="204" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">module-argument</text>
<polygon points="548,204 536,209 536,200" style="fill:rgb(0,0,0)"/>
<path d="M512,204L542,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M563,219A15 15 0 0 0 578 204A15 15 0 0 0 563 189A15 15 0 0 0 548 204A15 15 0 0 0 563 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="563" y="204" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="614,204 603,209 603,200" style="fill:rgb(0,0,0)"/>
<path d="M578,204L608,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="618" cy="204" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,257A15 15 0 0 0 447 242A15 15 0 0 0 432 227A15 15 0 0 0 417 242A15 15 0 0 0 432 257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="242" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="447,242 458,238 458,246" style="fill:rgb(0,0,0)"/>
<path d="M512,204 L 519,204 Q 527,204 527,219 L 527,227 Q 527,242 512,242 L 468,242 L 453,242"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,242 L 343,242 Q 328,242 328,227 L 328,219 Q 328,204 336,204 L 343,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="432,180 420,184 420,176" style="fill:rgb(0,0,0)"/>
<path d="M249,204 L 257,204 Q 264,204 264,192 Q 264,180 279,180 L 411,180 L 426,180"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,180 L 576,180 Q 591,180 591,192 Q 591,204 599,204 L 606,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="187,153 198,149 198,157" style="fill:rgb(0,0,0)"/>
<path d="M353,92 L 361,92 Q 368,92 368,107 L 368,138 Q 368,153 353,153 L 207,153 L 192,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,204 20,209 20,200" style="fill:rgb(0,0,0)"/>
<path d="M187,153 L 20,153 Q 5,153 5,168 L 5,189 Q 5,204 16,204 L 26,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="429,62 441,58 441,66" style="fill:rgb(0,0,0)"/>
<path d="M558,17 L 566,17 Q 573,17 573,32 L 573,47 Q 573,62 558,62 L 450,62 L 435,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,92 20,97 20,88" style="fill:rgb(0,0,0)"/>
<path d="M429,62 L 20,62 Q 5,62 5,77 L 5,77 Q 5,92 16,92 L 26,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,47 332,35 340,35" style="fill:rgb(0,0,0)"/>
<path d="M321,17 L 328,17 Q 336,17 336,29 L 336,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,47 L 336,54 Q 336,62 328,62 L 321,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="95,123 84,127 84,118" style="fill:rgb(0,0,0)"/>
<path d="M5,77 L 5,108 Q 5,123 20,123 L 74,123 L 89,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,123 L 210,123 Q 225,123 225,108 L 225,107 Q 225,92 231,92 L 236,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_createvtab.html'>lang_createvtab.html</a>
</div>



Added Doc/Extra/Core/syntax/cte-table-name.html.



























































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: cte-table-name</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>cte-table-name</h1>
<div class='imgcontainer'>
<div style="max-width:475px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 475.949 91.8">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,36 20,41 20,32" style="fill:rgb(0,0,0)"/>
<path d="M9,36L26,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,51L122,51A15 15 0 0 0 137 36A15 15 0 0 0 122 21L47,21A15 15 0 0 0 32 36A15 15 0 0 0 47 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="173,36 162,41 162,32" style="fill:rgb(0,0,0)"/>
<path d="M137,36L168,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M188,51A15 15 0 0 0 204 36A15 15 0 0 0 188 21A15 15 0 0 0 173 36A15 15 0 0 0 188 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="188" y="36" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="240,36 228,41 228,32" style="fill:rgb(0,0,0)"/>
<path d="M204,36L234,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M255,51L349,51A15 15 0 0 0 364 36A15 15 0 0 0 349 21L255,21A15 15 0 0 0 240 36A15 15 0 0 0 255 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="400,36 388,41 388,32" style="fill:rgb(0,0,0)"/>
<path d="M364,36L394,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,51A15 15 0 0 0 430 36A15 15 0 0 0 415 21A15 15 0 0 0 400 36A15 15 0 0 0 415 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="36" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="466,36 455,41 455,32" style="fill:rgb(0,0,0)"/>
<path d="M430,36L460,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="470" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M302,89A15 15 0 0 0 317 74L317,74A15 15 0 0 0 302 59A15 15 0 0 0 287 74L287,74A15 15 0 0 0 302 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="317,74 328,70 328,78" style="fill:rgb(0,0,0)"/>
<path d="M364,36 L 371,36 Q 379,36 379,51 L 379,59 Q 379,74 364,74 L 338,74 L 323,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,74 L 232,74 Q 217,74 217,59 L 217,51 Q 217,36 224,36 L 232,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="302,6 290,10 290,2" style="fill:rgb(0,0,0)"/>
<path d="M137,36 L 145,36 Q 152,36 152,21 L 152,21 Q 152,6 167,6 L 281,6 L 296,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M302,6 L 422,6 Q 437,6 437,21 L 437,21 Q 437,36 445,36 L 452,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./recursive-cte.html'>recursive-cte</a>&nbsp;&nbsp; <a href='./with-clause.html'>with-clause</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>
</div>



Added Doc/Extra/Core/syntax/delete-stmt-limited.html.



















































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: delete-stmt-limited</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>delete-stmt-limited</h1>
<div class='imgcontainer'>
<div style="max-width:623px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 623.266 541.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L91,32A15 15 0 0 0 106 17A15 15 0 0 0 91 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M166,62L252,62A15 15 0 0 0 267 47A15 15 0 0 0 252 32L166,32A15 15 0 0 0 151 47A15 15 0 0 0 166 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="209,17 197,21 197,12" style="fill:rgb(0,0,0)"/>
<path d="M106,17L203,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M209,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M357,32L583,32L583,2L357,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="151,47 139,51 139,43" style="fill:rgb(0,0,0)"/>
<path d="M106,17 L 113,17 Q 121,17 121,32 L 121,32 Q 121,47 133,47 L 145,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,47 278,51 278,43" style="fill:rgb(0,0,0)"/>
<path d="M267,47L284,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,47 L 297,47 Q 305,47 305,32 L 305,32 Q 305,17 320,17 L 330,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,70A15 15 0 0 0 485 55L485,55A15 15 0 0 0 470 39A15 15 0 0 0 455 55L455,55A15 15 0 0 0 470 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="485,55 497,50 497,59" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,40 Q 598,55 583,55 L 506,55 L 491,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,55 L 349,55 Q 334,55 334,40 L 334,32 Q 334,17 340,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,138L113,138A15 15 0 0 0 128 123A15 15 0 0 0 113 108L60,108A15 15 0 0 0 45 123A15 15 0 0 0 60 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="86" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DELETE</text>
<polygon points="151,123 140,127 140,118" style="fill:rgb(0,0,0)"/>
<path d="M128,123L145,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M166,138L201,138A15 15 0 0 0 216 123A15 15 0 0 0 201 108L166,108A15 15 0 0 0 151 123A15 15 0 0 0 166 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="239,123 228,127 228,118" style="fill:rgb(0,0,0)"/>
<path d="M216,123L233,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M239,138L424,138L424,108L239,108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">qualified-table-name</text>
<polygon points="45,123 33,127 33,118" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,108 Q 24,123 31,123 L 39,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,85 343,81 343,89" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,70 Q 598,85 583,85 L 352,85 L 337,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M332,85 L 39,85 Q 24,85 24,92 L 24,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,213L109,213A15 15 0 0 0 125 198A15 15 0 0 0 109 183L60,183A15 15 0 0 0 45 198A15 15 0 0 0 60 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="148,198 136,203 136,194" style="fill:rgb(0,0,0)"/>
<path d="M125,198L142,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M148,213L197,213L197,183L148,183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="172" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M45,289L196,289L196,259L45,259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="120" y="274" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">returning-clause</text>
<path d="M60,365L105,365A15 15 0 0 0 120 349A15 15 0 0 0 105 334L60,334A15 15 0 0 0 45 349A15 15 0 0 0 60 365Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="82" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="143,349 131,354 131,345" style="fill:rgb(0,0,0)"/>
<path d="M120,349L137,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,365L162,365A15 15 0 0 0 177 349A15 15 0 0 0 162 334L158,334A15 15 0 0 0 143 349A15 15 0 0 0 158 365Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="160" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="213,349 201,354 201,345" style="fill:rgb(0,0,0)"/>
<path d="M177,349L207,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M213,365L343,365L343,334L213,334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M278,402A15 15 0 0 0 293 387A15 15 0 0 0 278 372A15 15 0 0 0 263 387A15 15 0 0 0 278 402Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="387" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M60,470L93,470A15 15 0 0 0 109 455A15 15 0 0 0 93 440L60,440A15 15 0 0 0 45 455A15 15 0 0 0 60 470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="77" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="132,455 120,460 120,451" style="fill:rgb(0,0,0)"/>
<path d="M109,455L126,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,470L181,470L181,440L132,440Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="219,486 207,490 207,481" style="fill:rgb(0,0,0)"/>
<path d="M181,455 L 188,455 Q 196,455 196,470 L 196,471 Q 196,486 204,486 L 213,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M234,501L285,501A15 15 0 0 0 300 486A15 15 0 0 0 285 470L234,470A15 15 0 0 0 219 486A15 15 0 0 0 234 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="323,486 312,490 312,481" style="fill:rgb(0,0,0)"/>
<path d="M300,486L318,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,501L373,501L373,470L323,470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M234,538A15 15 0 0 0 249 523A15 15 0 0 0 234 508A15 15 0 0 0 219 523A15 15 0 0 0 234 538Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="523" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="272,523 261,528 261,519" style="fill:rgb(0,0,0)"/>
<path d="M249,523L266,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,538L321,538L321,508L272,508Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="297" y="523" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="219,523 207,528 207,519" style="fill:rgb(0,0,0)"/>
<path d="M181,455 L 188,455 Q 196,455 196,470 L 196,508 Q 196,523 204,523 L 213,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="613,455 602,460 602,451" style="fill:rgb(0,0,0)"/>
<path d="M181,455L608,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="617" cy="455" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="575,123 564,127 564,118" style="fill:rgb(0,0,0)"/>
<path d="M424,123L570,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M575,123 L 583,123 Q 590,123 590,138 L 590,440 Q 590,455 598,455 L 605,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="239,160 251,156 251,165" style="fill:rgb(0,0,0)"/>
<path d="M424,123 L 431,123 Q 439,123 439,138 L 439,145 Q 439,160 424,160 L 260,160 L 245,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,198 33,203 33,194" style="fill:rgb(0,0,0)"/>
<path d="M239,160 L 39,160 Q 24,160 24,175 L 24,183 Q 24,198 31,198 L 39,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="575,198 564,203 564,194" style="fill:rgb(0,0,0)"/>
<path d="M197,198L570,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M575,198 L 583,198 Q 590,198 590,206 L 590,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,274 33,278 33,270" style="fill:rgb(0,0,0)"/>
<path d="M24,259 L 24,266 Q 24,274 31,274 L 39,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="120,312 132,307 132,316" style="fill:rgb(0,0,0)"/>
<path d="M196,274 L 203,274 Q 211,274 211,289 L 211,297 Q 211,312 196,312 L 141,312 L 126,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M120,312 L 39,312 Q 24,312 24,319 L 24,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="575,274 564,278 564,270" style="fill:rgb(0,0,0)"/>
<path d="M196,274L570,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M575,274 L 583,274 Q 590,274 590,281 L 590,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,349 33,354 33,345" style="fill:rgb(0,0,0)"/>
<path d="M24,183 L 24,334 Q 24,349 31,349 L 39,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="120,236 131,232 131,240" style="fill:rgb(0,0,0)"/>
<path d="M197,198 L 204,198 Q 212,198 212,213 L 212,221 Q 212,236 197,236 L 140,236 L 125,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M120,236 L 39,236 Q 24,236 24,244 L 24,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="293,387 305,383 305,392" style="fill:rgb(0,0,0)"/>
<path d="M343,349 L 350,349 Q 358,349 358,364 L 358,372 Q 358,387 343,387 L 314,387 L 299,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M263,387 L 205,387 Q 190,387 190,372 L 190,364 Q 190,349 197,349 L 205,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,455 33,460 33,451" style="fill:rgb(0,0,0)"/>
<path d="M24,334 L 24,440 Q 24,455 31,455 L 39,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="160,417 171,413 171,422" style="fill:rgb(0,0,0)"/>
<path d="M343,349 L 350,349 Q 358,349 358,364 L 358,402 Q 358,417 343,417 L 181,417 L 166,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M160,417 L 39,417 Q 24,417 24,425 L 24,432"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,455 435,460 435,451" style="fill:rgb(0,0,0)"/>
<path d="M321,523 L 396,523 Q 411,523 411,508 L 411,470 Q 411,455 426,455 L 426,455 L 441,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="396,486 384,490 384,481" style="fill:rgb(0,0,0)"/>
<path d="M373,486L390,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M396,486 L 403,486 Q 411,486 411,478 L 411,471"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./common-table-expression.html'>common-table-expression</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./ordering-term.html'>ordering-term</a>&nbsp;&nbsp; <a href='./qualified-table-name.html'>qualified-table-name</a>&nbsp;&nbsp; <a href='./returning-clause.html'>returning-clause</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>
</div>



Added Doc/Extra/Core/syntax/delete-stmt.html.

































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: delete-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>delete-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:648px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 648.706 220.32">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L114,32A15 15 0 0 0 129 17A15 15 0 0 0 114 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="98" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M189,62L275,62A15 15 0 0 0 290 47A15 15 0 0 0 275 32L189,32A15 15 0 0 0 174 47A15 15 0 0 0 189 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="232" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="232,17 220,21 220,12" style="fill:rgb(0,0,0)"/>
<path d="M129,17L226,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,17 368,21 368,12" style="fill:rgb(0,0,0)"/>
<path d="M232,17L374,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,32L606,32L606,2L380,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="174,47 162,51 162,43" style="fill:rgb(0,0,0)"/>
<path d="M129,17 L 136,17 Q 144,17 144,32 L 144,32 Q 144,47 156,47 L 168,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,47 301,51 301,43" style="fill:rgb(0,0,0)"/>
<path d="M290,47L307,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,47 L 321,47 Q 328,47 328,32 L 328,32 Q 328,17 343,17 L 353,17 L 368,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,70A15 15 0 0 0 508 55L508,55A15 15 0 0 0 493 39A15 15 0 0 0 478 55L478,55A15 15 0 0 0 493 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="508,55 520,50 520,59" style="fill:rgb(0,0,0)"/>
<path d="M606,17 L 614,17 Q 621,17 621,32 L 621,40 Q 621,55 606,55 L 529,55 L 514,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,55 L 372,55 Q 357,55 357,40 L 357,32 Q 357,17 363,17 L 368,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,138L136,138A15 15 0 0 0 151 123A15 15 0 0 0 136 108L83,108A15 15 0 0 0 68 123A15 15 0 0 0 83 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DELETE</text>
<polygon points="174,123 163,127 163,118" style="fill:rgb(0,0,0)"/>
<path d="M151,123L168,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,138L224,138A15 15 0 0 0 239 123A15 15 0 0 0 224 108L189,108A15 15 0 0 0 174 123A15 15 0 0 0 189 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="207" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="262,123 251,127 251,118" style="fill:rgb(0,0,0)"/>
<path d="M239,123L256,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M262,138L447,138L447,108L262,108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">qualified-table-name</text>
<circle cx="642" cy="213" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M639,213 L 618,213 Q 603,213 603,198 L 603,198 Q 603,183 595,183 L 588,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M437,198L588,198L588,168L437,168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="512" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">returning-clause</text>
<polygon points="437,183 425,187 425,179" style="fill:rgb(0,0,0)"/>
<path d="M431,183 L 421,183 Q 410,183 410,198 L 410,198 Q 410,213 403,213 L 395,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,213 384,218 384,209" style="fill:rgb(0,0,0)"/>
<path d="M390,213 L 379,213 Q 369,213 369,198 L 369,198 Q 369,183 361,183 L 354,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M305,198L354,198L354,168L305,168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="329" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="305,183 293,187 293,179" style="fill:rgb(0,0,0)"/>
<path d="M299,183L282,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,198L267,198A15 15 0 0 0 282 183A15 15 0 0 0 267 168L217,168A15 15 0 0 0 202 183A15 15 0 0 0 217 198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="242" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="355,153 366,149 366,157" style="fill:rgb(0,0,0)"/>
<path d="M447,123 L 455,123 Q 462,123 462,138 L 462,138 Q 462,153 447,153 L 375,153 L 360,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="202,183 190,187 190,179" style="fill:rgb(0,0,0)"/>
<path d="M355,153 L 195,153 Q 180,153 180,168 L 180,168 Q 180,183 188,183 L 196,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="639,213 627,218 627,209" style="fill:rgb(0,0,0)"/>
<path d="M180,172 L 180,198 Q 180,213 195,213 L 618,213 L 633,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="355,85 366,81 366,89" style="fill:rgb(0,0,0)"/>
<path d="M606,17 L 614,17 Q 621,17 621,32 L 621,70 Q 621,85 606,85 L 375,85 L 360,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,123 56,127 56,118" style="fill:rgb(0,0,0)"/>
<path d="M355,85 L 62,85 Q 47,85 47,100 L 47,108 Q 47,123 55,123 L 62,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,47 43,36 51,36" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,29 L 47,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,47L47,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./create-trigger-stmt.html'>create-trigger-stmt</a>&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./common-table-expression.html'>common-table-expression</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./qualified-table-name.html'>qualified-table-name</a>&nbsp;&nbsp; <a href='./returning-clause.html'>returning-clause</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>
</div>



Added Doc/Extra/Core/syntax/detach-stmt.html.









































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: detach-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>detach-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.595 47.952">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L104,32A15 15 0 0 0 119 17A15 15 0 0 0 104 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DETACH</text>
<polygon points="155,17 143,21 143,12" style="fill:rgb(0,0,0)"/>
<path d="M119,17L149,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M170,32L246,32A15 15 0 0 0 261 17A15 15 0 0 0 246 2L170,2A15 15 0 0 0 155 17A15 15 0 0 0 170 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="208" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DATABASE</text>
<polygon points="297,17 286,21 286,12" style="fill:rgb(0,0,0)"/>
<path d="M261,17L291,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M312,32L409,32A15 15 0 0 0 424 17A15 15 0 0 0 409 2L312,2A15 15 0 0 0 297 17A15 15 0 0 0 312 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="447,17 435,21 435,12" style="fill:rgb(0,0,0)"/>
<path d="M424,17L441,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="208,41 196,45 196,37" style="fill:rgb(0,0,0)"/>
<path d="M119,17 L 126,17 Q 134,17 134,29 Q 134,41 149,41 L 187,41 L 202,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M208,41 L 255,41 Q 270,41 270,29 Q 270,17 278,17 L 285,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_detach.html'>lang_detach.html</a>
</div>



Added Doc/Extra/Core/syntax/drop-index-stmt.html.















































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: drop-index-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>drop-index-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:761px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 761.27 54">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="63" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DROP</text>
<polygon points="116,17 105,21 105,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L110,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M131,32L171,32A15 15 0 0 0 186 17A15 15 0 0 0 171 2L131,2A15 15 0 0 0 116 17A15 15 0 0 0 131 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="151" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEX</text>
<polygon points="222,17 210,21 210,12" style="fill:rgb(0,0,0)"/>
<path d="M186,17L216,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M237,32A15 15 0 0 0 252 17A15 15 0 0 0 237 2A15 15 0 0 0 222 17A15 15 0 0 0 237 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="237" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="275,17 263,21 263,12" style="fill:rgb(0,0,0)"/>
<path d="M252,17L269,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,32L335,32A15 15 0 0 0 350 17A15 15 0 0 0 335 2L290,2A15 15 0 0 0 275 17A15 15 0 0 0 290 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="404,17 392,21 392,12" style="fill:rgb(0,0,0)"/>
<path d="M350,17L398,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,32L515,32A15 15 0 0 0 530 17A15 15 0 0 0 515 2L419,2A15 15 0 0 0 404 17A15 15 0 0 0 419 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="467" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="553,17 542,21 542,12" style="fill:rgb(0,0,0)"/>
<path d="M530,17L548,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M569,32A15 15 0 0 0 584 17A15 15 0 0 0 569 2A15 15 0 0 0 553 17A15 15 0 0 0 569 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="569" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="620,17 608,21 608,12" style="fill:rgb(0,0,0)"/>
<path d="M584,17L614,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M635,32L713,32A15 15 0 0 0 728 17A15 15 0 0 0 713 2L635,2A15 15 0 0 0 620 17A15 15 0 0 0 635 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<polygon points="751,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M728,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="755" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,47 263,51 263,43" style="fill:rgb(0,0,0)"/>
<path d="M186,17 L 193,17 Q 201,17 201,32 L 201,32 Q 201,47 216,47 L 254,47 L 269,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M275,47 L 350,47 Q 365,47 365,32 L 365,32 Q 365,17 372,17 L 380,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="467,47 456,51 456,43" style="fill:rgb(0,0,0)"/>
<path d="M372,17 L 379,17 Q 387,17 387,32 L 387,32 Q 387,47 402,47 L 446,47 L 461,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,47 L 584,47 Q 599,47 599,32 L 599,32 Q 599,17 606,17 L 614,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_dropindex.html'>lang_dropindex.html</a>
</div>



Added Doc/Extra/Core/syntax/drop-table-stmt.html.















































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: drop-table-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>drop-table-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:758px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 758.16 54">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="63" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DROP</text>
<polygon points="116,17 105,21 105,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L110,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M131,32L171,32A15 15 0 0 0 186 17A15 15 0 0 0 171 2L131,2A15 15 0 0 0 116 17A15 15 0 0 0 131 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="151" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TABLE</text>
<polygon points="222,17 210,21 210,12" style="fill:rgb(0,0,0)"/>
<path d="M186,17L216,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M237,32A15 15 0 0 0 252 17A15 15 0 0 0 237 2A15 15 0 0 0 222 17A15 15 0 0 0 237 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="237" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="275,17 264,21 264,12" style="fill:rgb(0,0,0)"/>
<path d="M252,17L269,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,32L335,32A15 15 0 0 0 350 17A15 15 0 0 0 335 2L290,2A15 15 0 0 0 275 17A15 15 0 0 0 290 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="404,17 392,21 392,12" style="fill:rgb(0,0,0)"/>
<path d="M350,17L398,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,32L515,32A15 15 0 0 0 531 17A15 15 0 0 0 515 2L419,2A15 15 0 0 0 404 17A15 15 0 0 0 419 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="467" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="554,17 542,21 542,12" style="fill:rgb(0,0,0)"/>
<path d="M531,17L548,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M569,32A15 15 0 0 0 584 17A15 15 0 0 0 569 2A15 15 0 0 0 554 17A15 15 0 0 0 569 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="569" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="620,17 608,21 608,12" style="fill:rgb(0,0,0)"/>
<path d="M584,17L614,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M635,32L710,32A15 15 0 0 0 725 17A15 15 0 0 0 710 2L635,2A15 15 0 0 0 620 17A15 15 0 0 0 635 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="673" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="748,17 737,21 737,12" style="fill:rgb(0,0,0)"/>
<path d="M725,17L743,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="752" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,47 264,51 264,43" style="fill:rgb(0,0,0)"/>
<path d="M186,17 L 193,17 Q 201,17 201,32 L 201,32 Q 201,47 216,47 L 254,47 L 269,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M275,47 L 350,47 Q 365,47 365,32 L 365,32 Q 365,17 372,17 L 380,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="467,47 456,51 456,43" style="fill:rgb(0,0,0)"/>
<path d="M372,17 L 379,17 Q 387,17 387,32 L 387,32 Q 387,47 402,47 L 447,47 L 462,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,47 L 584,47 Q 599,47 599,32 L 599,32 Q 599,17 606,17 L 614,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_droptable.html'>lang_droptable.html</a>
</div>



Added Doc/Extra/Core/syntax/drop-trigger-stmt.html.















































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: drop-trigger-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>drop-trigger-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:795px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 795.37 54">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="63" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DROP</text>
<polygon points="116,17 105,21 105,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L110,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M131,32L191,32A15 15 0 0 0 207 17A15 15 0 0 0 191 2L131,2A15 15 0 0 0 116 17A15 15 0 0 0 131 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="161" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRIGGER</text>
<polygon points="243,17 231,21 231,12" style="fill:rgb(0,0,0)"/>
<path d="M207,17L237,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,32A15 15 0 0 0 273 17A15 15 0 0 0 258 2A15 15 0 0 0 243 17A15 15 0 0 0 258 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="296,17 284,21 284,12" style="fill:rgb(0,0,0)"/>
<path d="M273,17L290,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,32L356,32A15 15 0 0 0 371 17A15 15 0 0 0 356 2L311,2A15 15 0 0 0 296 17A15 15 0 0 0 311 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="425,17 413,21 413,12" style="fill:rgb(0,0,0)"/>
<path d="M371,17L419,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M440,32L536,32A15 15 0 0 0 551 17A15 15 0 0 0 536 2L440,2A15 15 0 0 0 425 17A15 15 0 0 0 440 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="574,17 563,21 563,12" style="fill:rgb(0,0,0)"/>
<path d="M551,17L569,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M589,32A15 15 0 0 0 605 17A15 15 0 0 0 589 2A15 15 0 0 0 574 17A15 15 0 0 0 589 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="589" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="641,17 629,21 629,12" style="fill:rgb(0,0,0)"/>
<path d="M605,17L635,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M656,32L747,32A15 15 0 0 0 762 17A15 15 0 0 0 747 2L656,2A15 15 0 0 0 641 17A15 15 0 0 0 656 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="702" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">trigger-name</text>
<polygon points="786,17 774,21 774,12" style="fill:rgb(0,0,0)"/>
<path d="M762,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="789" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="296,47 284,51 284,43" style="fill:rgb(0,0,0)"/>
<path d="M207,17 L 214,17 Q 222,17 222,32 L 222,32 Q 222,47 237,47 L 275,47 L 290,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M296,47 L 371,47 Q 386,47 386,32 L 386,32 Q 386,17 393,17 L 401,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="488,47 476,51 476,43" style="fill:rgb(0,0,0)"/>
<path d="M392,17 L 400,17 Q 407,17 407,32 L 407,32 Q 407,47 422,47 L 467,47 L 482,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,47 L 605,47 Q 620,47 620,32 L 620,32 Q 620,17 627,17 L 635,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_droptrigger.html'>lang_droptrigger.html</a>
</div>



Added Doc/Extra/Core/syntax/drop-view-stmt.html.















































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: drop-view-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>drop-view-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:743px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 743.76 54">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="63" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DROP</text>
<polygon points="116,17 105,21 105,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L110,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M131,32L160,32A15 15 0 0 0 176 17A15 15 0 0 0 160 2L131,2A15 15 0 0 0 116 17A15 15 0 0 0 131 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VIEW</text>
<polygon points="212,17 200,21 200,12" style="fill:rgb(0,0,0)"/>
<path d="M176,17L206,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M227,32A15 15 0 0 0 242 17A15 15 0 0 0 227 2A15 15 0 0 0 212 17A15 15 0 0 0 227 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="227" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="265,17 253,21 253,12" style="fill:rgb(0,0,0)"/>
<path d="M242,17L259,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M280,32L325,32A15 15 0 0 0 340 17A15 15 0 0 0 325 2L280,2A15 15 0 0 0 265 17A15 15 0 0 0 280 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="394,17 382,21 382,12" style="fill:rgb(0,0,0)"/>
<path d="M340,17L388,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,32L505,32A15 15 0 0 0 520 17A15 15 0 0 0 505 2L409,2A15 15 0 0 0 394 17A15 15 0 0 0 409 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="457" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="543,17 532,21 532,12" style="fill:rgb(0,0,0)"/>
<path d="M520,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,32A15 15 0 0 0 574 17A15 15 0 0 0 558 2A15 15 0 0 0 543 17A15 15 0 0 0 558 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="558" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="610,17 598,21 598,12" style="fill:rgb(0,0,0)"/>
<path d="M574,17L604,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M625,32L696,32A15 15 0 0 0 711 17A15 15 0 0 0 696 2L625,2A15 15 0 0 0 610 17A15 15 0 0 0 625 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="660" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">view-name</text>
<polygon points="734,17 722,21 722,12" style="fill:rgb(0,0,0)"/>
<path d="M711,17L728,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="738" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="265,47 253,51 253,43" style="fill:rgb(0,0,0)"/>
<path d="M176,17 L 183,17 Q 191,17 191,32 L 191,32 Q 191,47 206,47 L 244,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,47 L 340,47 Q 355,47 355,32 L 355,32 Q 355,17 362,17 L 370,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="457,47 445,51 445,43" style="fill:rgb(0,0,0)"/>
<path d="M361,17 L 369,17 Q 376,17 376,32 L 376,32 Q 376,47 391,47 L 436,47 L 451,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M457,47 L 574,47 Q 589,47 589,32 L 589,32 Q 589,17 596,17 L 604,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_dropview.html'>lang_dropview.html</a>
</div>



Added Doc/Extra/Core/syntax/expr.html.





























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: expr</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>expr</h1>
<div class='imgcontainer'>
<div style="max-width:963px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 963.96 1068.77">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L158,32L158,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="101" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="954,17 943,21 943,12" style="fill:rgb(0,0,0)"/>
<path d="M158,17L948,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="958" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L172,70A15 15 0 0 0 187 55L187,55A15 15 0 0 0 172 39L60,39A15 15 0 0 0 45 55L45,55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">bind-parameter</text>
<polygon points="916,55 905,59 905,50" style="fill:rgb(0,0,0)"/>
<path d="M187,55L910,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,55 L 924,55 Q 931,55 931,47 L 931,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 31,55 L 39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,130L156,130A15 15 0 0 0 171 115A15 15 0 0 0 156 100L60,100A15 15 0 0 0 45 115A15 15 0 0 0 60 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,115 183,119 183,111" style="fill:rgb(0,0,0)"/>
<path d="M171,115L189,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,130A15 15 0 0 0 225 115A15 15 0 0 0 210 100A15 15 0 0 0 195 115A15 15 0 0 0 210 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M225,115L255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130L351,130A15 15 0 0 0 366 115A15 15 0 0 0 351 100L276,100A15 15 0 0 0 261 115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="389,115 378,119 378,111" style="fill:rgb(0,0,0)"/>
<path d="M366,115L383,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,130A15 15 0 0 0 419 115A15 15 0 0 0 404 100A15 15 0 0 0 389 115A15 15 0 0 0 404 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="404" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="455,115 444,119 444,111" style="fill:rgb(0,0,0)"/>
<path d="M419,115L450,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,130L565,130A15 15 0 0 0 580 115A15 15 0 0 0 565 100L471,100A15 15 0 0 0 455 115A15 15 0 0 0 471 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="916,115 905,119 905,111" style="fill:rgb(0,0,0)"/>
<path d="M580,115L910,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,115 L 924,115 Q 931,115 931,108 L 931,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,115 33,119 33,111" style="fill:rgb(0,0,0)"/>
<path d="M24,100 L 24,108 Q 24,115 31,115 L 39,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,89 97,93 97,84" style="fill:rgb(0,0,0)"/>
<path d="M24,74 L 24,81 Q 24,89 39,89 L 87,89 L 102,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 302,93 302,84" style="fill:rgb(0,0,0)"/>
<path d="M108,89 L 129,89 Q 144,89 159,89 L 293,89 L 308,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,89 L 414,89 Q 429,89 429,102 Q 429,115 436,115 L 444,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M223,89 L 230,89 Q 238,89 238,102 Q 238,115 245,115 L 253,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,168L168,168A15 15 0 0 0 183 153A15 15 0 0 0 168 138L60,138A15 15 0 0 0 45 153A15 15 0 0 0 60 168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">unary-operator</text>
<polygon points="206,153 194,157 194,149" style="fill:rgb(0,0,0)"/>
<path d="M183,153L200,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,168L255,168L255,138L206,138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,153 905,157 905,149" style="fill:rgb(0,0,0)"/>
<path d="M255,153L910,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,153 L 924,153 Q 931,153 931,145 L 931,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,153 33,157 33,149" style="fill:rgb(0,0,0)"/>
<path d="M24,138 L 24,145 Q 24,153 31,153 L 39,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,206L94,206L94,176L45,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,191 106,195 106,186" style="fill:rgb(0,0,0)"/>
<path d="M94,191L111,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,206L245,206A15 15 0 0 0 261 191A15 15 0 0 0 245 176L132,176A15 15 0 0 0 117 191A15 15 0 0 0 132 206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">binary-operator</text>
<polygon points="284,191 272,195 272,186" style="fill:rgb(0,0,0)"/>
<path d="M261,191L278,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,206L333,206L333,176L284,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="308" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,191 905,195 905,186" style="fill:rgb(0,0,0)"/>
<path d="M333,191L910,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,191 L 924,191 Q 931,191 931,183 L 931,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,191 33,195 33,186" style="fill:rgb(0,0,0)"/>
<path d="M24,176 L 24,183 Q 24,191 31,191 L 39,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,245L162,245A15 15 0 0 0 177 230A15 15 0 0 0 162 215L60,215A15 15 0 0 0 45 230A15 15 0 0 0 60 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="111" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-name</text>
<polygon points="194,230 183,234 183,226" style="fill:rgb(0,0,0)"/>
<path d="M177,230L188,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,245A15 15 0 0 0 224 230A15 15 0 0 0 209 215A15 15 0 0 0 194 230A15 15 0 0 0 209 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="260,230 249,234 249,226" style="fill:rgb(0,0,0)"/>
<path d="M224,230L255,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,245L437,245L437,215L260,215Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-arguments</text>
<polygon points="473,230 461,234 461,226" style="fill:rgb(0,0,0)"/>
<path d="M437,230L467,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,245A15 15 0 0 0 503 230A15 15 0 0 0 488 215A15 15 0 0 0 473 230A15 15 0 0 0 488 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="541,260 529,265 529,256" style="fill:rgb(0,0,0)"/>
<path d="M503,230 L 510,230 Q 518,230 518,245 L 518,245 Q 518,260 527,260 L 535,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,275L653,275L653,245L541,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="691,230 680,234 680,226" style="fill:rgb(0,0,0)"/>
<path d="M653,260 L 661,260 Q 668,260 668,245 L 668,245 Q 668,230 677,230 L 685,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="729,260 718,265 718,256" style="fill:rgb(0,0,0)"/>
<path d="M691,230 L 699,230 Q 706,230 706,245 L 706,245 Q 706,260 715,260 L 723,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,275L837,275L837,245L729,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="783" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">over-clause</text>
<polygon points="916,260 905,265 905,256" style="fill:rgb(0,0,0)"/>
<path d="M837,260L910,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,260 L 924,260 Q 931,260 931,253 L 931,245"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,230 33,234 33,226" style="fill:rgb(0,0,0)"/>
<path d="M24,215 L 24,222 Q 24,230 31,230 L 39,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,230 585,234 585,226" style="fill:rgb(0,0,0)"/>
<path d="M503,230L591,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,230L680,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,230 905,234 905,226" style="fill:rgb(0,0,0)"/>
<path d="M691,230L910,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,230 L 924,230 Q 931,230 931,222 L 931,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,321A15 15 0 0 0 75 306A15 15 0 0 0 60 290A15 15 0 0 0 45 306A15 15 0 0 0 60 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,306 100,310 100,301" style="fill:rgb(0,0,0)"/>
<path d="M75,306L105,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M111,321L160,321L160,290L111,290Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="306" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="196,306 185,310 185,301" style="fill:rgb(0,0,0)"/>
<path d="M160,306L191,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,321A15 15 0 0 0 227 306A15 15 0 0 0 211 290A15 15 0 0 0 196 306A15 15 0 0 0 211 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,306 905,310 905,301" style="fill:rgb(0,0,0)"/>
<path d="M227,306L910,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,306 L 924,306 Q 931,306 931,298 L 931,291"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,306 33,310 33,301" style="fill:rgb(0,0,0)"/>
<path d="M24,290 L 24,298 Q 24,306 31,306 L 39,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,284A15 15 0 0 0 151 269A15 15 0 0 0 136 254A15 15 0 0 0 121 269A15 15 0 0 0 136 284Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="269" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="151,269 162,265 162,274" style="fill:rgb(0,0,0)"/>
<path d="M160,306 L 168,306 Q 175,306 175,291 L 175,284 Q 175,269 166,269 L 157,269"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,269 L 103,269 Q 88,269 88,284 L 88,291 Q 88,306 96,306 L 103,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,358L88,358A15 15 0 0 0 103 343A15 15 0 0 0 88 328L60,328A15 15 0 0 0 45 343A15 15 0 0 0 60 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CAST</text>
<polygon points="126,343 114,348 114,339" style="fill:rgb(0,0,0)"/>
<path d="M103,343L120,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M141,358A15 15 0 0 0 156 343A15 15 0 0 0 141 328A15 15 0 0 0 126 343A15 15 0 0 0 141 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="179,343 168,348 168,339" style="fill:rgb(0,0,0)"/>
<path d="M156,343L173,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,358L228,358L228,328L179,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="251,343 240,348 240,339" style="fill:rgb(0,0,0)"/>
<path d="M228,343L246,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,358L271,358A15 15 0 0 0 286 343A15 15 0 0 0 271 328L267,328A15 15 0 0 0 251 343A15 15 0 0 0 267 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="269" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="309,343 297,348 297,339" style="fill:rgb(0,0,0)"/>
<path d="M286,343L303,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,358L408,358L408,328L309,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="358" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="431,343 419,348 419,339" style="fill:rgb(0,0,0)"/>
<path d="M408,343L425,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M446,358A15 15 0 0 0 461 343A15 15 0 0 0 446 328A15 15 0 0 0 431 343A15 15 0 0 0 446 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,343 905,348 905,339" style="fill:rgb(0,0,0)"/>
<path d="M461,343L910,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,343 L 924,343 Q 931,343 931,336 L 931,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,343 33,348 33,339" style="fill:rgb(0,0,0)"/>
<path d="M24,328 L 24,336 Q 24,343 31,343 L 39,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,396L94,396L94,366L45,366Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,381 106,385 106,377" style="fill:rgb(0,0,0)"/>
<path d="M94,381L111,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,396L196,396A15 15 0 0 0 211 381A15 15 0 0 0 196 366L132,366A15 15 0 0 0 117 381A15 15 0 0 0 132 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="234,381 223,385 223,377" style="fill:rgb(0,0,0)"/>
<path d="M211,381L229,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,396L355,396A15 15 0 0 0 370 381A15 15 0 0 0 355 366L250,366A15 15 0 0 0 234 381A15 15 0 0 0 250 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="916,381 905,385 905,377" style="fill:rgb(0,0,0)"/>
<path d="M370,381L910,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,381 L 924,381 Q 931,381 931,374 L 931,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,381 33,385 33,377" style="fill:rgb(0,0,0)"/>
<path d="M24,366 L 24,374 Q 24,381 31,381 L 39,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,434L94,434L94,404L45,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,419 119,423 119,415" style="fill:rgb(0,0,0)"/>
<path d="M94,419L124,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,434L165,434A15 15 0 0 0 180 419A15 15 0 0 0 165 404L145,404A15 15 0 0 0 130 419A15 15 0 0 0 145 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="234,419 223,423 223,415" style="fill:rgb(0,0,0)"/>
<path d="M180,419L229,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,434L273,434A15 15 0 0 0 288 419A15 15 0 0 0 273 404L250,404A15 15 0 0 0 234 419A15 15 0 0 0 250 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIKE</text>
<path d="M250,472L279,472A15 15 0 0 0 294 457A15 15 0 0 0 279 442L250,442A15 15 0 0 0 234 457A15 15 0 0 0 250 472Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="457" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GLOB</text>
<path d="M250,510L302,510A15 15 0 0 0 317 495A15 15 0 0 0 302 479L250,479A15 15 0 0 0 234 495A15 15 0 0 0 250 510Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REGEXP</text>
<path d="M250,547L297,547A15 15 0 0 0 313 532A15 15 0 0 0 297 517L250,517A15 15 0 0 0 234 532A15 15 0 0 0 250 547Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="274" y="532" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<path d="M378,510L427,510L427,479L378,479Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M378,434L427,434L427,404L378,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="465,449 454,454 454,445" style="fill:rgb(0,0,0)"/>
<path d="M427,419 L 435,419 Q 442,419 442,434 L 442,434 Q 442,449 451,449 L 460,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,464L532,464A15 15 0 0 0 547 449A15 15 0 0 0 532 434L480,434A15 15 0 0 0 465 449A15 15 0 0 0 480 464Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="506" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ESCAPE</text>
<polygon points="570,449 559,454 559,445" style="fill:rgb(0,0,0)"/>
<path d="M547,449L565,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M570,464L620,464L620,434L570,434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="595" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="671,419 659,423 659,415" style="fill:rgb(0,0,0)"/>
<path d="M620,449 L 627,449 Q 635,449 635,434 L 635,434 Q 635,419 650,419 L 650,419 L 665,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,419 905,423 905,415" style="fill:rgb(0,0,0)"/>
<path d="M671,419L910,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,419 L 924,419 Q 931,419 931,411 L 931,404"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,419 33,423 33,415" style="fill:rgb(0,0,0)"/>
<path d="M24,404 L 24,411 Q 24,419 31,419 L 39,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M100,419 L 108,419 Q 115,419 115,434 L 115,434 Q 115,449 130,449 L 177,449 Q 192,449 192,434 L 192,434 Q 192,419 199,419 L 207,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,532 223,537 223,528" style="fill:rgb(0,0,0)"/>
<path d="M196,419 L 204,419 Q 211,419 211,434 L 211,517 Q 211,532 220,532 L 229,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,457 223,461 223,452" style="fill:rgb(0,0,0)"/>
<path d="M211,442 L 211,449 Q 211,457 220,457 L 229,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,495 223,499 223,490" style="fill:rgb(0,0,0)"/>
<path d="M211,479 L 211,487 Q 211,495 220,495 L 229,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,419 367,423 367,415" style="fill:rgb(0,0,0)"/>
<path d="M288,419L372,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,532 329,537 329,528" style="fill:rgb(0,0,0)"/>
<path d="M313,532L334,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,495 367,499 367,490" style="fill:rgb(0,0,0)"/>
<path d="M340,532 L 348,532 Q 355,532 355,517 L 355,510 Q 355,495 364,495 L 372,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,495 329,499 329,490" style="fill:rgb(0,0,0)"/>
<path d="M317,495L334,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,495L378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,457 329,461 329,452" style="fill:rgb(0,0,0)"/>
<path d="M294,457L334,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,457 L 348,457 Q 355,457 355,472 L 355,480 Q 355,495 367,495 L 378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="506,419 495,423 495,415" style="fill:rgb(0,0,0)"/>
<path d="M427,419L501,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M506,419L659,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="547,495 536,499 536,490" style="fill:rgb(0,0,0)"/>
<path d="M427,495L542,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,495 L 656,495 Q 671,495 671,480 L 671,434 Q 671,419 686,419 L 692,419 L 707,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,585L94,585L94,555L45,555Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,570 119,574 119,566" style="fill:rgb(0,0,0)"/>
<path d="M94,570L124,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,585L194,585A15 15 0 0 0 209 570A15 15 0 0 0 194 555L145,555A15 15 0 0 0 130 570A15 15 0 0 0 145 585Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="170" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ISNULL</text>
<polygon points="916,570 905,574 905,566" style="fill:rgb(0,0,0)"/>
<path d="M209,570L910,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,570 L 924,570 Q 931,570 931,563 L 931,555"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,570 33,574 33,566" style="fill:rgb(0,0,0)"/>
<path d="M24,555 L 24,563 Q 24,570 31,570 L 39,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,623L215,623A15 15 0 0 0 230 608A15 15 0 0 0 215 593L145,593A15 15 0 0 0 130 608A15 15 0 0 0 145 623Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="608" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTNULL</text>
<path d="M145,661L165,661A15 15 0 0 0 180 646A15 15 0 0 0 165 631L145,631A15 15 0 0 0 130 646A15 15 0 0 0 145 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="203,646 192,650 192,641" style="fill:rgb(0,0,0)"/>
<path d="M180,646L198,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,661L250,661A15 15 0 0 0 265 646A15 15 0 0 0 250 631L219,631A15 15 0 0 0 203 646A15 15 0 0 0 219 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="288,646 276,650 276,641" style="fill:rgb(0,0,0)"/>
<path d="M265,646L282,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="339,570 327,574 327,566" style="fill:rgb(0,0,0)"/>
<path d="M288,646 L 295,646 Q 303,646 303,631 L 303,585 Q 303,570 318,570 L 318,570 L 333,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="288,608 276,612 276,604" style="fill:rgb(0,0,0)"/>
<path d="M230,608L282,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,608 L 295,608 Q 303,608 303,600 L 303,593"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,646 119,650 119,641" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,631 Q 109,646 117,646 L 124,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,608 119,612 119,604" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,593 Q 109,608 117,608 L 124,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,699L94,699L94,668L45,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,684 106,688 106,679" style="fill:rgb(0,0,0)"/>
<path d="M94,684L111,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,699A15 15 0 0 0 147 684A15 15 0 0 0 132 668A15 15 0 0 0 117 684A15 15 0 0 0 132 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IS</text>
<polygon points="183,684 172,688 172,679" style="fill:rgb(0,0,0)"/>
<path d="M147,684L178,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M198,699L219,699A15 15 0 0 0 234 684A15 15 0 0 0 219 668L198,668A15 15 0 0 0 183 684A15 15 0 0 0 198 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="270,684 258,688 258,679" style="fill:rgb(0,0,0)"/>
<path d="M234,684L264,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="306,684 294,688 294,679" style="fill:rgb(0,0,0)"/>
<path d="M270,684L300,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,699L389,699A15 15 0 0 0 404 684A15 15 0 0 0 389 668L321,668A15 15 0 0 0 306 684A15 15 0 0 0 321 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="440,684 429,688 429,679" style="fill:rgb(0,0,0)"/>
<path d="M404,684L434,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,699L490,699A15 15 0 0 0 505 684A15 15 0 0 0 490 668L455,668A15 15 0 0 0 440 684A15 15 0 0 0 455 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="541,684 530,688 530,679" style="fill:rgb(0,0,0)"/>
<path d="M505,684L535,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,699L590,699L590,668L541,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,684 905,688 905,679" style="fill:rgb(0,0,0)"/>
<path d="M590,684L910,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,684 L 924,684 Q 931,684 931,676 L 931,669"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,684 33,688 33,679" style="fill:rgb(0,0,0)"/>
<path d="M24,668 L 24,676 Q 24,684 31,684 L 39,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,684 L 156,684 Q 164,684 164,696 Q 164,708 179,708 L 230,708 Q 245,708 245,696 Q 245,684 253,684 L 260,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,684 L 279,684 Q 286,684 286,696 Q 286,708 301,708 L 502,708 Q 517,708 517,696 Q 517,684 524,684 L 532,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,744L94,744L94,714L45,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,729 119,733 119,725" style="fill:rgb(0,0,0)"/>
<path d="M94,729L124,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,744L165,744A15 15 0 0 0 180 729A15 15 0 0 0 165 714L145,714A15 15 0 0 0 130 729A15 15 0 0 0 145 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,729 205,733 205,725" style="fill:rgb(0,0,0)"/>
<path d="M180,729L211,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,744L304,744A15 15 0 0 0 319 729A15 15 0 0 0 304 714L232,714A15 15 0 0 0 216 729A15 15 0 0 0 232 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="342,729 331,733 331,725" style="fill:rgb(0,0,0)"/>
<path d="M319,729L336,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M342,744L391,744L391,714L342,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="367" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="414,729 403,733 403,725" style="fill:rgb(0,0,0)"/>
<path d="M391,729L409,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M430,744L450,744A15 15 0 0 0 465 729A15 15 0 0 0 450 714L430,714A15 15 0 0 0 414 729A15 15 0 0 0 430 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="488,729 477,733 477,725" style="fill:rgb(0,0,0)"/>
<path d="M465,729L483,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,744L538,744L538,714L488,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="513" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,729 905,733 905,725" style="fill:rgb(0,0,0)"/>
<path d="M538,729L910,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,729 L 924,729 Q 931,729 931,721 L 931,714"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,729 33,733 33,725" style="fill:rgb(0,0,0)"/>
<path d="M24,714 L 24,721 Q 24,729 31,729 L 39,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,729 L 103,729 Q 110,729 110,741 Q 110,753 125,753 L 177,753 Q 192,753 192,741 Q 192,729 199,729 L 207,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,797L94,797L94,767L45,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,782 119,786 119,778" style="fill:rgb(0,0,0)"/>
<path d="M94,782L124,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,797L165,797A15 15 0 0 0 180 782A15 15 0 0 0 165 767L145,767A15 15 0 0 0 130 782A15 15 0 0 0 145 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,782 205,786 205,778" style="fill:rgb(0,0,0)"/>
<path d="M180,782L211,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,797L234,797A15 15 0 0 0 249 782A15 15 0 0 0 234 767L232,767A15 15 0 0 0 216 782A15 15 0 0 0 232 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IN</text>
<polygon points="285,782 273,786 273,778" style="fill:rgb(0,0,0)"/>
<path d="M249,782L279,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,797A15 15 0 0 0 315 782A15 15 0 0 0 300 767A15 15 0 0 0 285 782A15 15 0 0 0 300 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,782 340,786 340,778" style="fill:rgb(0,0,0)"/>
<path d="M315,782L345,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,797L455,797L455,767L351,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="491,782 480,786 480,778" style="fill:rgb(0,0,0)"/>
<path d="M455,782L486,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M507,797A15 15 0 0 0 522 782A15 15 0 0 0 507 767A15 15 0 0 0 491 782A15 15 0 0 0 507 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="507" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,782 905,786 905,778" style="fill:rgb(0,0,0)"/>
<path d="M522,782L910,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,782 L 924,782 Q 931,782 931,774 L 931,767"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,782 33,786 33,778" style="fill:rgb(0,0,0)"/>
<path d="M24,767 L 24,774 Q 24,782 31,782 L 39,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,782 L 103,782 Q 110,782 110,794 Q 110,806 125,806 L 177,806 Q 192,806 192,794 Q 192,782 199,782 L 207,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,782 L 324,782 Q 332,782 332,770 Q 332,758 347,758 L 452,758 Q 467,758 467,770 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M379,835L428,835L428,805L379,805Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="820" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="379,820 367,824 367,815" style="fill:rgb(0,0,0)"/>
<path d="M317,782 L 324,782 Q 332,782 332,797 L 332,805 Q 332,820 347,820 L 358,820 L 373,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M428,820 L 452,820 Q 467,820 467,805 L 467,797 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,873A15 15 0 0 0 418 857A15 15 0 0 0 403 842A15 15 0 0 0 388 857A15 15 0 0 0 403 873Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="857" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,857 430,853 430,862" style="fill:rgb(0,0,0)"/>
<path d="M428,820 L 435,820 Q 443,820 443,835 L 443,842 Q 443,857 434,857 L 424,857"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,857 L 371,857 Q 356,857 356,842 L 356,835 Q 356,820 363,820 L 371,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,925L396,925A15 15 0 0 0 412 910A15 15 0 0 0 396 895L300,895A15 15 0 0 0 285 910A15 15 0 0 0 300 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="429,910 417,915 417,906" style="fill:rgb(0,0,0)"/>
<path d="M412,910L423,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,925A15 15 0 0 0 459 910A15 15 0 0 0 444 895A15 15 0 0 0 429 910A15 15 0 0 0 444 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="513,910 502,915 502,906" style="fill:rgb(0,0,0)"/>
<path d="M459,910L507,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,925L627,925A15 15 0 0 0 642 910A15 15 0 0 0 627 895L528,895A15 15 0 0 0 513 910A15 15 0 0 0 528 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="577" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function</text>
<polygon points="659,910 647,915 647,906" style="fill:rgb(0,0,0)"/>
<path d="M642,910L653,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,925A15 15 0 0 0 689 910A15 15 0 0 0 674 895A15 15 0 0 0 659 910A15 15 0 0 0 674 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="734,910 723,915 723,906" style="fill:rgb(0,0,0)"/>
<path d="M689,910L728,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,925L783,925L783,895L734,895Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="828,910 817,915 817,906" style="fill:rgb(0,0,0)"/>
<path d="M783,910L823,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M844,925A15 15 0 0 0 859 910A15 15 0 0 0 844 895A15 15 0 0 0 828 910A15 15 0 0 0 844 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="844" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,910 905,915 905,906" style="fill:rgb(0,0,0)"/>
<path d="M859,910L910,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,910 L 924,910 Q 931,910 931,903 L 931,895"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,865L603,865A15 15 0 0 0 619 850A15 15 0 0 0 603 835L528,835A15 15 0 0 0 513 850A15 15 0 0 0 528 865Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="850" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="916,850 905,854 905,846" style="fill:rgb(0,0,0)"/>
<path d="M619,850L910,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,850 L 924,850 Q 931,850 931,842 L 931,835"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="513,850 502,854 502,846" style="fill:rgb(0,0,0)"/>
<path d="M475,910 L 483,910 Q 490,910 490,895 L 490,865 Q 490,850 499,850 L 507,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,892A15 15 0 0 0 774 877A15 15 0 0 0 759 862A15 15 0 0 0 744 877A15 15 0 0 0 759 892Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="877" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="774,877 785,873 785,881" style="fill:rgb(0,0,0)"/>
<path d="M783,910 L 791,910 Q 798,910 798,895 L 798,892 Q 798,877 789,877 L 780,877"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M744,877 L 726,877 Q 711,877 711,892 L 711,895 Q 711,910 719,910 L 726,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M689,910 L 697,910 Q 704,910 704,921 Q 704,932 719,932 L 790,932 Q 805,932 805,921 Q 805,910 813,910 L 820,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="285,910 273,915 273,906" style="fill:rgb(0,0,0)"/>
<path d="M249,782 L 256,782 Q 264,782 264,797 L 264,895 Q 264,910 272,910 L 279,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,882 412,886 412,877" style="fill:rgb(0,0,0)"/>
<path d="M264,867 L 264,874 Q 264,882 279,882 L 402,882 L 417,882"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,882 L 456,882 Q 471,882 471,896 Q 471,910 478,910 L 486,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,971L80,971A15 15 0 0 0 95 956A15 15 0 0 0 80 941L60,941A15 15 0 0 0 45 956A15 15 0 0 0 60 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="131,956 120,960 120,951" style="fill:rgb(0,0,0)"/>
<path d="M95,956L125,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,971L191,971A15 15 0 0 0 206 956A15 15 0 0 0 191 941L146,941A15 15 0 0 0 131 956A15 15 0 0 0 146 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="242,956 231,960 231,951" style="fill:rgb(0,0,0)"/>
<path d="M206,956L236,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,971A15 15 0 0 0 272 956A15 15 0 0 0 257 941A15 15 0 0 0 242 956A15 15 0 0 0 257 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="295,956 284,960 284,951" style="fill:rgb(0,0,0)"/>
<path d="M272,956L290,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,971L400,971L400,941L295,941Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="423,956 411,960 411,951" style="fill:rgb(0,0,0)"/>
<path d="M400,956L417,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,971A15 15 0 0 0 453 956A15 15 0 0 0 438 941A15 15 0 0 0 423 956A15 15 0 0 0 438 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,956 905,960 905,951" style="fill:rgb(0,0,0)"/>
<path d="M453,956L910,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,956 L 924,956 Q 931,956 931,948 L 931,941"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,956 33,960 33,951" style="fill:rgb(0,0,0)"/>
<path d="M24,941 L 24,948 Q 24,956 31,956 L 39,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,929 59,934 59,925" style="fill:rgb(0,0,0)"/>
<path d="M24,914 L 24,922 Q 24,929 39,929 L 49,929 L 64,929"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,929 L 201,929 Q 216,929 216,943 Q 216,956 223,956 L 231,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,929 L 101,929 Q 108,929 108,943 Q 108,956 116,956 L 123,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,1009L89,1009A15 15 0 0 0 104 994A15 15 0 0 0 89 978L60,978A15 15 0 0 0 45 994A15 15 0 0 0 60 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASE</text>
<polygon points="140,994 128,998 128,989" style="fill:rgb(0,0,0)"/>
<path d="M104,994L134,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M140,1009L189,1009L189,978L140,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="243,994 232,998 232,989" style="fill:rgb(0,0,0)"/>
<path d="M189,994L237,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,1009L298,1009A15 15 0 0 0 313 994A15 15 0 0 0 298 978L258,978A15 15 0 0 0 243 994A15 15 0 0 0 258 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="336,994 324,998 324,989" style="fill:rgb(0,0,0)"/>
<path d="M313,994L330,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,1009L385,1009L385,978L336,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="408,994 396,998 396,989" style="fill:rgb(0,0,0)"/>
<path d="M385,994L402,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,1009L456,1009A15 15 0 0 0 472 994A15 15 0 0 0 456 978L423,978A15 15 0 0 0 408 994A15 15 0 0 0 423 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">THEN</text>
<polygon points="495,994 483,998 483,989" style="fill:rgb(0,0,0)"/>
<path d="M472,994L489,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M495,1009L544,1009L544,978L495,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="616,994 604,998 604,989" style="fill:rgb(0,0,0)"/>
<path d="M544,994L610,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M631,1009L658,1009A15 15 0 0 0 673 994A15 15 0 0 0 658 978L631,978A15 15 0 0 0 616 994A15 15 0 0 0 631 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="645" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ELSE</text>
<polygon points="696,994 685,998 685,989" style="fill:rgb(0,0,0)"/>
<path d="M673,994L691,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M696,1009L746,1009L746,978L696,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="721" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="782,994 770,998 770,989" style="fill:rgb(0,0,0)"/>
<path d="M746,994L776,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M797,1009L818,1009A15 15 0 0 0 833 994A15 15 0 0 0 818 978L797,978A15 15 0 0 0 782 994A15 15 0 0 0 797 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="807" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="916,994 905,998 905,989" style="fill:rgb(0,0,0)"/>
<path d="M833,994L910,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,994 L 924,994 Q 931,994 931,986 L 931,979"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,994 33,998 33,989" style="fill:rgb(0,0,0)"/>
<path d="M24,978 L 24,986 Q 24,994 31,994 L 39,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,994 L 111,994 Q 119,994 119,1007 Q 119,1021 134,1021 L 186,1021 Q 201,1021 201,1007 Q 201,994 208,994 L 216,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="360,1021 372,1016 372,1025" style="fill:rgb(0,0,0)"/>
<path d="M544,994 L 551,994 Q 559,994 559,1007 Q 559,1021 544,1021 L 381,1021 L 366,1021"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,1021 L 235,1021 Q 220,1021 220,1007 Q 220,994 227,994 L 235,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,994 L 585,994 Q 593,994 593,1007 Q 593,1021 608,1021 L 742,1021 Q 757,1021 757,1007 Q 757,994 765,994 L 772,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,1066L173,1066L173,1036L45,1036Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="1051" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">raise-function</text>
<polygon points="916,1051 905,1055 905,1047" style="fill:rgb(0,0,0)"/>
<path d="M173,1051L910,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,1051 L 924,1051 Q 931,1051 931,1036 L 931,32 Q 931,17 939,17 L 946,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,1051 33,1055 33,1047" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,1036 Q 24,1051 31,1051 L 39,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./aggregate-function-invocation.html'>aggregate-function-invocation</a>&nbsp;&nbsp; <a href='./attach-stmt.html'>attach-stmt</a>&nbsp;&nbsp; <a href='./column-constraint.html'>column-constraint</a>&nbsp;&nbsp; <a href='./compound-select-stmt.html'>compound-select-stmt</a>&nbsp;&nbsp; <a href='./create-index-stmt.html'>create-index-stmt</a>&nbsp;&nbsp; <a href='./create-trigger-stmt.html'>create-trigger-stmt</a>&nbsp;&nbsp; <a href='./delete-stmt.html'>delete-stmt</a>&nbsp;&nbsp; <a href='./delete-stmt-limited.html'>delete-stmt-limited</a>&nbsp;&nbsp; <a href='./factored-select-stmt.html'>factored-select-stmt</a>&nbsp;&nbsp; <a href='./filter-clause.html'>filter-clause</a>&nbsp;&nbsp; <a href='./frame-spec.html'>frame-spec</a>&nbsp;&nbsp; <a href='./function-arguments.html'>function-arguments</a>&nbsp;&nbsp; <a href='./indexed-column.html'>indexed-column</a>&nbsp;&nbsp; <a href='./insert-stmt.html'>insert-stmt</a>&nbsp;&nbsp; <a href='./join-constraint.html'>join-constraint</a>&nbsp;&nbsp; <a href='./ordering-term.html'>ordering-term</a>&nbsp;&nbsp; <a href='./over-clause.html'>over-clause</a>&nbsp;&nbsp; <a href='./result-column.html'>result-column</a>&nbsp;&nbsp; <a href='./returning-clause.html'>returning-clause</a>&nbsp;&nbsp; <a href='./select-core.html'>select-core</a>&nbsp;&nbsp; <a href='./select-stmt.html'>select-stmt</a>&nbsp;&nbsp; <a href='./simple-function-invocation.html'>simple-function-invocation</a>&nbsp;&nbsp; <a href='./simple-select-stmt.html'>simple-select-stmt</a>&nbsp;&nbsp; <a href='./table-constraint.html'>table-constraint</a>&nbsp;&nbsp; <a href='./table-or-subquery.html'>table-or-subquery</a>&nbsp;&nbsp; <a href='./update-stmt.html'>update-stmt</a>&nbsp;&nbsp; <a href='./update-stmt-limited.html'>update-stmt-limited</a>&nbsp;&nbsp; <a href='./upsert-clause.html'>upsert-clause</a>&nbsp;&nbsp; <a href='./window-defn.html'>window-defn</a>&nbsp;&nbsp; <a href='./window-function-invocation.html'>window-function-invocation</a><br></br>
References:&nbsp;&nbsp; <a href='./filter-clause.html'>filter-clause</a>&nbsp;&nbsp; <a href='./function-arguments.html'>function-arguments</a>&nbsp;&nbsp; <a href='./literal-value.html'>literal-value</a>&nbsp;&nbsp; <a href='./over-clause.html'>over-clause</a>&nbsp;&nbsp; <a href='./raise-function.html'>raise-function</a>&nbsp;&nbsp; <a href='./select-stmt.html'>select-stmt</a>&nbsp;&nbsp; <a href='./type-name.html'>type-name</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_aggfunc.html'>lang_aggfunc.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_attach.html'>lang_attach.html</a>&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_createview.html'>lang_createview.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_returning.html'>lang_returning.html</a>&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>
</div>



Added Doc/Extra/Core/syntax/factored-select-stmt.html.













































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: factored-select-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>factored-select-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:629px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 629.266 500.04">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L91,32A15 15 0 0 0 106 17A15 15 0 0 0 91 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M166,62L252,62A15 15 0 0 0 267 47A15 15 0 0 0 252 32L166,32A15 15 0 0 0 151 47A15 15 0 0 0 166 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="209,17 197,21 197,12" style="fill:rgb(0,0,0)"/>
<path d="M106,17L203,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M209,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M357,32L583,32L583,2L357,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="151,47 139,51 139,43" style="fill:rgb(0,0,0)"/>
<path d="M106,17 L 113,17 Q 121,17 121,32 L 121,32 Q 121,47 133,47 L 145,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,47 278,51 278,43" style="fill:rgb(0,0,0)"/>
<path d="M267,47L284,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,47 L 297,47 Q 305,47 305,32 L 305,32 Q 305,17 320,17 L 330,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,70A15 15 0 0 0 485 55L485,55A15 15 0 0 0 470 39A15 15 0 0 0 455 55L455,55A15 15 0 0 0 470 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="485,55 497,50 497,59" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,40 Q 598,55 583,55 L 506,55 L 491,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,55 L 349,55 Q 334,55 334,40 L 334,32 Q 334,17 340,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M117,153L220,153L220,123L117,123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="138" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-core</text>
<path d="M60,304L105,304A15 15 0 0 0 120 289A15 15 0 0 0 105 274L60,274A15 15 0 0 0 45 289A15 15 0 0 0 60 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="82" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="143,289 131,293 131,285" style="fill:rgb(0,0,0)"/>
<path d="M120,289L137,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,304L162,304A15 15 0 0 0 177 289A15 15 0 0 0 162 274L158,274A15 15 0 0 0 143 289A15 15 0 0 0 158 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="160" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M60,410L93,410A15 15 0 0 0 109 395A15 15 0 0 0 93 380L60,380A15 15 0 0 0 45 395A15 15 0 0 0 60 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="77" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="132,395 120,399 120,390" style="fill:rgb(0,0,0)"/>
<path d="M109,395L126,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,410L181,410L181,380L132,380Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,138 105,142 105,133" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,123 Q 24,138 39,138 L 96,138 L 111,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="312,92 323,88 323,97" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 604,17 Q 619,17 619,32 L 619,77 Q 619,92 604,92 L 333,92 L 318,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M312,92 L 39,92 Q 24,92 24,100 L 24,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M80,198L257,198L257,168L80,168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="257,183 269,179 269,187" style="fill:rgb(0,0,0)"/>
<path d="M272,138 L 280,138 Q 287,138 287,153 L 287,168 Q 287,183 275,183 L 263,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M80,183 L 65,183 Q 50,183 50,168 L 50,153 Q 50,138 58,138 L 65,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="296,236 308,232 308,240" style="fill:rgb(0,0,0)"/>
<path d="M220,138 L 342,138 Q 357,138 357,153 L 357,221 Q 357,236 342,236 L 317,236 L 302,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,289 33,293 33,285" style="fill:rgb(0,0,0)"/>
<path d="M296,236 L 39,236 Q 24,236 24,251 L 24,274 Q 24,289 31,289 L 39,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="222,289 210,293 210,285" style="fill:rgb(0,0,0)"/>
<path d="M177,289L216,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,304L352,304L352,274L222,274Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="287" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M287,342A15 15 0 0 0 302 327A15 15 0 0 0 287 312A15 15 0 0 0 272 327A15 15 0 0 0 287 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="287" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="302,327 314,322 314,331" style="fill:rgb(0,0,0)"/>
<path d="M352,289 L 359,289 Q 367,289 367,304 L 367,312 Q 367,327 352,327 L 323,327 L 308,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,327 L 214,327 Q 199,327 199,312 L 199,304 Q 199,289 205,289 L 210,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,319 384,308 392,308" style="fill:rgb(0,0,0)"/>
<path d="M352,289 L 373,289 Q 388,289 388,301 L 388,313"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="198,361 210,356 210,365" style="fill:rgb(0,0,0)"/>
<path d="M388,319 L 388,346 Q 388,361 373,361 L 219,361 L 204,361"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,395 33,399 33,390" style="fill:rgb(0,0,0)"/>
<path d="M198,361 L 39,361 Q 24,361 24,376 L 24,380 Q 24,395 31,395 L 39,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="24,327 20,315 28,315" style="fill:rgb(0,0,0)"/>
<path d="M24,274L24,321"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M24,327L24,380"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M255,440L306,440A15 15 0 0 0 321 425A15 15 0 0 0 306 410L255,410A15 15 0 0 0 240 425A15 15 0 0 0 255 440Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="425" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="344,425 333,429 333,421" style="fill:rgb(0,0,0)"/>
<path d="M321,425L339,425"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M344,440L394,440L394,410L344,410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="369" y="425" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="417,425 405,429 405,421" style="fill:rgb(0,0,0)"/>
<path d="M394,425L411,425"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M255,478A15 15 0 0 0 270 463A15 15 0 0 0 255 448A15 15 0 0 0 240 463A15 15 0 0 0 255 478Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="255" y="463" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="293,463 282,467 282,458" style="fill:rgb(0,0,0)"/>
<path d="M270,463L287,463"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M293,478L342,478L342,448L293,448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="318" y="463" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="204,395 192,399 192,390" style="fill:rgb(0,0,0)"/>
<path d="M181,395L198,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="240,463 228,467 228,458" style="fill:rgb(0,0,0)"/>
<path d="M204,395 L 211,395 Q 219,395 219,410 L 219,448 Q 219,463 226,463 L 234,463"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="240,425 228,429 228,421" style="fill:rgb(0,0,0)"/>
<path d="M204,395 L 211,395 Q 219,395 219,410 L 219,410 Q 219,425 226,425 L 234,425"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="417,395 405,399 405,390" style="fill:rgb(0,0,0)"/>
<path d="M204,395L411,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="619,493 608,497 608,489" style="fill:rgb(0,0,0)"/>
<path d="M417,395 L 438,395 Q 453,395 453,410 L 453,478 Q 453,493 468,493 L 599,493 L 614,493"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="623" cy="493" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,425 L 438,425 Q 453,425 453,433 L 453,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="417,463 405,467 405,458" style="fill:rgb(0,0,0)"/>
<path d="M342,463L411,463"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,463 L 438,463 Q 453,463 453,470 L 453,478"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="417,493 405,497 405,489" style="fill:rgb(0,0,0)"/>
<path d="M24,380 L 24,478 Q 24,493 39,493 L 396,493 L 411,493"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,493L489,493"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>
<br></br>
References:&nbsp;&nbsp; <a href='./common-table-expression.html'>common-table-expression</a>&nbsp;&nbsp; <a href='./compound-operator.html'>compound-operator</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./ordering-term.html'>ordering-term</a>&nbsp;&nbsp; <a href='./select-core.html'>select-core</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>
</div>



Added Doc/Extra/Core/syntax/filter-clause.html.





















































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: filter-clause</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>filter-clause</h1>
<div class='imgcontainer'>
<div style="max-width:422px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 422.381 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L93,32A15 15 0 0 0 108 17A15 15 0 0 0 93 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FILTER</text>
<polygon points="131,17 119,21 119,12" style="fill:rgb(0,0,0)"/>
<path d="M108,17L125,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,32L146,32A15 15 0 0 0 161 17A15 15 0 0 0 146 2L146,2A15 15 0 0 0 131 17A15 15 0 0 0 146 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="184,17 173,21 173,12" style="fill:rgb(0,0,0)"/>
<path d="M161,17L178,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M199,32L249,32A15 15 0 0 0 264 17A15 15 0 0 0 249 2L199,2A15 15 0 0 0 184 17A15 15 0 0 0 199 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="224" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="287,17 275,21 275,12" style="fill:rgb(0,0,0)"/>
<path d="M264,17L281,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,32L336,32L336,2L287,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M336,17L353,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,32A15 15 0 0 0 389 17A15 15 0 0 0 374 2A15 15 0 0 0 359 17A15 15 0 0 0 374 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="374" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="413,17 401,21 401,12" style="fill:rgb(0,0,0)"/>
<path d="M389,17L407,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="416" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./aggregate-function-invocation.html'>aggregate-function-invocation</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./window-function-invocation.html'>window-function-invocation</a><br></br>
References:&nbsp;&nbsp; <a href='./expr.html'>expr</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_aggfunc.html'>lang_aggfunc.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_attach.html'>lang_attach.html</a>&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_createview.html'>lang_createview.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_returning.html'>lang_returning.html</a>&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>
</div>



Added Doc/Extra/Core/syntax/foreign-key-clause.html.























































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: foreign-key-clause</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>foreign-key-clause</h1>
<div class='imgcontainer'>
<div style="max-width:648px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 648.158 492.48">
<circle cx="5" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,55L39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L164,70A15 15 0 0 0 179 55A15 15 0 0 0 164 39L60,39A15 15 0 0 0 45 55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REFERENCES</text>
<polygon points="202,55 190,59 190,50" style="fill:rgb(0,0,0)"/>
<path d="M179,55L196,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,70L306,70A15 15 0 0 0 322 55A15 15 0 0 0 306 39L217,39A15 15 0 0 0 202 55A15 15 0 0 0 217 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="262" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">foreign-table</text>
<polygon points="358,55 346,59 346,50" style="fill:rgb(0,0,0)"/>
<path d="M322,55L352,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M373,70A15 15 0 0 0 388 55A15 15 0 0 0 373 39A15 15 0 0 0 358 55A15 15 0 0 0 373 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="373" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="424,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M388,55L418,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M439,70L533,70A15 15 0 0 0 548 55A15 15 0 0 0 533 39L439,39A15 15 0 0 0 424 55A15 15 0 0 0 439 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="486" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="584,55 573,59 573,50" style="fill:rgb(0,0,0)"/>
<path d="M548,55L578,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M599,70A15 15 0 0 0 614 55A15 15 0 0 0 599 39A15 15 0 0 0 584 55A15 15 0 0 0 599 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="599" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<path d="M486,32A15 15 0 0 0 501 17L501,17A15 15 0 0 0 486 2A15 15 0 0 0 471 17L471,17A15 15 0 0 0 486 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="486" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="501,17 513,12 513,21" style="fill:rgb(0,0,0)"/>
<path d="M548,55 L 556,55 Q 563,55 563,40 L 563,32 Q 563,17 548,17 L 522,17 L 507,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,17 L 416,17 Q 401,17 401,32 L 401,40 Q 401,55 412,55 L 424,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,176L69,176A15 15 0 0 0 84 160A15 15 0 0 0 69 145L60,145A15 15 0 0 0 45 160A15 15 0 0 0 60 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="64" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="120,160 109,165 109,156" style="fill:rgb(0,0,0)"/>
<path d="M84,160L114,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,176L188,176A15 15 0 0 0 203 160A15 15 0 0 0 188 145L135,145A15 15 0 0 0 120 160A15 15 0 0 0 135 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="162" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DELETE</text>
<polygon points="275,160 264,165 264,156" style="fill:rgb(0,0,0)"/>
<path d="M203,160L269,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,176L306,176A15 15 0 0 0 321 160A15 15 0 0 0 306 145L290,145A15 15 0 0 0 275 160A15 15 0 0 0 290 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="298" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="344,160 332,165 332,156" style="fill:rgb(0,0,0)"/>
<path d="M321,160L338,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M359,176L390,176A15 15 0 0 0 405 160A15 15 0 0 0 390 145L359,145A15 15 0 0 0 344 160A15 15 0 0 0 359 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<path d="M135,213L189,213A15 15 0 0 0 204 198A15 15 0 0 0 189 183L135,183A15 15 0 0 0 120 198A15 15 0 0 0 135 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="162" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="120,198 109,203 109,194" style="fill:rgb(0,0,0)"/>
<path d="M84,160 L 92,160 Q 99,160 99,175 L 99,183 Q 99,198 107,198 L 114,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M204,198 L 212,198 Q 219,198 219,183 L 219,175 Q 219,160 227,160 L 234,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,213L306,213A15 15 0 0 0 321 198A15 15 0 0 0 306 183L290,183A15 15 0 0 0 275 198A15 15 0 0 0 290 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="298" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="344,198 332,203 332,194" style="fill:rgb(0,0,0)"/>
<path d="M321,198L338,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M359,213L424,213A15 15 0 0 0 440 198A15 15 0 0 0 424 183L359,183A15 15 0 0 0 344 198A15 15 0 0 0 359 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="392" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFAULT</text>
<polygon points="463,198 451,203 451,194" style="fill:rgb(0,0,0)"/>
<path d="M440,198L457,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,198 L 470,198 Q 478,198 478,191 L 478,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,251L357,251A15 15 0 0 0 372 236A15 15 0 0 0 357 221L290,221A15 15 0 0 0 275 236A15 15 0 0 0 290 251Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="324" y="236" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASCADE</text>
<polygon points="463,236 451,240 451,232" style="fill:rgb(0,0,0)"/>
<path d="M372,236L457,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,236 L 470,236 Q 478,236 478,229 L 478,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,289L361,289A15 15 0 0 0 376 274A15 15 0 0 0 361 259L290,259A15 15 0 0 0 275 274A15 15 0 0 0 290 289Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="326" y="274" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RESTRICT</text>
<polygon points="463,274 451,278 451,270" style="fill:rgb(0,0,0)"/>
<path d="M376,274L457,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,274 L 470,274 Q 478,274 478,266 L 478,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,327L299,327A15 15 0 0 0 314 312A15 15 0 0 0 299 297L290,297A15 15 0 0 0 275 312A15 15 0 0 0 290 327Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="295" y="312" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="337,312 326,316 326,307" style="fill:rgb(0,0,0)"/>
<path d="M314,312L332,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M353,327L404,327A15 15 0 0 0 419 312A15 15 0 0 0 404 297L353,297A15 15 0 0 0 337 312A15 15 0 0 0 353 327Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="378" y="312" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ACTION</text>
<polygon points="463,312 451,316 451,307" style="fill:rgb(0,0,0)"/>
<path d="M419,312L457,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,312 L 470,312 Q 478,312 478,304 L 478,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,357L108,357A15 15 0 0 0 123 342L123,342A15 15 0 0 0 108 327L60,327A15 15 0 0 0 45 342L45,342A15 15 0 0 0 60 357Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="84" y="342" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<polygon points="146,342 135,346 135,338" style="fill:rgb(0,0,0)"/>
<path d="M123,342L140,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M161,357L188,357A15 15 0 0 0 203 342L203,342A15 15 0 0 0 188 327L161,327A15 15 0 0 0 146 342L146,342A15 15 0 0 0 161 357Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="175" y="342" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="463,342 451,346 451,338" style="fill:rgb(0,0,0)"/>
<path d="M203,342L457,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="442,115 453,111 453,119" style="fill:rgb(0,0,0)"/>
<path d="M463,342 L 470,342 Q 478,342 478,327 L 478,130 Q 478,115 463,115 L 462,115 L 447,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="463,160 451,165 451,156" style="fill:rgb(0,0,0)"/>
<path d="M405,160L457,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,160 L 470,160 Q 478,160 478,153 L 478,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,312 264,316 264,307" style="fill:rgb(0,0,0)"/>
<path d="M237,160 L 245,160 Q 252,160 252,175 L 252,297 Q 252,312 261,312 L 269,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,274 264,278 264,270" style="fill:rgb(0,0,0)"/>
<path d="M252,259 L 252,266 Q 252,274 261,274 L 269,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,236 264,240 264,232" style="fill:rgb(0,0,0)"/>
<path d="M252,221 L 252,228 Q 252,236 261,236 L 269,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,198 264,203 264,194" style="fill:rgb(0,0,0)"/>
<path d="M252,183 L 252,191 Q 252,198 261,198 L 269,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,160 33,165 33,156" style="fill:rgb(0,0,0)"/>
<path d="M614,55 L 623,55 Q 632,55 632,70 L 632,100 Q 632,115 617,115 L 20,115 Q 5,115 5,130 L 5,145 Q 5,160 20,160 L 24,160 L 39,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,342 33,346 33,338" style="fill:rgb(0,0,0)"/>
<path d="M5,145 L 5,327 Q 5,342 20,342 L 24,342 L 39,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="337,91 332,79 341,79" style="fill:rgb(0,0,0)"/>
<path d="M322,55 L 329,55 Q 337,55 337,70 L 337,70 L 337,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M337,91 L 337,103 Q 337,115 329,115 L 322,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,433L80,433A15 15 0 0 0 95 417A15 15 0 0 0 80 402L60,402A15 15 0 0 0 45 417A15 15 0 0 0 60 433Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="417" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="133,387 122,392 122,383" style="fill:rgb(0,0,0)"/>
<path d="M95,417 L 103,417 Q 110,417 110,402 L 110,402 Q 110,387 119,387 L 127,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M148,402L250,402A15 15 0 0 0 265 387A15 15 0 0 0 250 372L148,372A15 15 0 0 0 133 387A15 15 0 0 0 148 402Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="387" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFERRABLE</text>
<polygon points="303,417 292,422 292,413" style="fill:rgb(0,0,0)"/>
<path d="M265,387 L 273,387 Q 280,387 280,402 L 280,402 Q 280,417 289,417 L 297,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M318,433L389,433A15 15 0 0 0 405 417A15 15 0 0 0 389 402L318,402A15 15 0 0 0 303 417A15 15 0 0 0 318 433Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="354" y="417" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INITIALLY</text>
<polygon points="428,417 416,422 416,413" style="fill:rgb(0,0,0)"/>
<path d="M405,417L422,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M443,433L523,433A15 15 0 0 0 538 417A15 15 0 0 0 523 402L443,402A15 15 0 0 0 428 417A15 15 0 0 0 443 433Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="417" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFERRED</text>
<path d="M318,470L389,470A15 15 0 0 0 405 455A15 15 0 0 0 389 440L318,440A15 15 0 0 0 303 455A15 15 0 0 0 318 470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="354" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INITIALLY</text>
<polygon points="428,455 416,460 416,451" style="fill:rgb(0,0,0)"/>
<path d="M405,455L422,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M443,470L531,470A15 15 0 0 0 546 455A15 15 0 0 0 531 440L443,440A15 15 0 0 0 428 455A15 15 0 0 0 443 470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="487" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IMMEDIATE</text>
<polygon points="569,455 558,460 558,451" style="fill:rgb(0,0,0)"/>
<path d="M546,455L564,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="569,417 558,422 558,413" style="fill:rgb(0,0,0)"/>
<path d="M538,417L564,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="569,387 558,392 558,383" style="fill:rgb(0,0,0)"/>
<path d="M265,387L564,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="303,455 292,460 292,451" style="fill:rgb(0,0,0)"/>
<path d="M265,387 L 273,387 Q 280,387 280,402 L 280,440 Q 280,455 289,455 L 297,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="638,486 627,490 627,481" style="fill:rgb(0,0,0)"/>
<path d="M569,387 L 577,387 Q 584,387 584,402 L 584,471 Q 584,486 599,486 L 618,486 L 633,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="642" cy="486" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M569,455 L 577,455 Q 584,455 584,463 L 584,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M569,417 L 577,417 Q 584,417 584,425 L 584,432"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M5,327 L 5,471 Q 5,486 20,486 L 612,486 L 627,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M5,372 L 5,380 Q 5,387 20,387 L 118,387 L 133,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,417 33,422 33,413" style="fill:rgb(0,0,0)"/>
<path d="M5,402 L 5,410 Q 5,417 20,417 L 24,417 L 39,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./column-constraint.html'>column-constraint</a>&nbsp;&nbsp; <a href='./table-constraint.html'>table-constraint</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>
</div>



Added Doc/Extra/Core/syntax/frame-spec.html.



























































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: frame-spec</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>frame-spec</h1>
<div class='imgcontainer'>
<div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./over-clause.html'>over-clause</a>&nbsp;&nbsp; <a href='./window-defn.html'>window-defn</a><br></br>
References:&nbsp;&nbsp; <a href='./expr.html'>expr</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_aggfunc.html'>lang_aggfunc.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_attach.html'>lang_attach.html</a>&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_createview.html'>lang_createview.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_returning.html'>lang_returning.html</a>&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>
</div>



Added Doc/Extra/Core/syntax/indexed-column.html.



























































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: indexed-column</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>indexed-column</h1>
<div class='imgcontainer'>
<div style="max-width:696px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 696.36 102.6">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L160,32A15 15 0 0 0 175 17A15 15 0 0 0 160 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="113" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="246,47 235,51 235,43" style="fill:rgb(0,0,0)"/>
<path d="M175,17 L 205,17 Q 220,17 220,32 L 220,32 Q 220,47 230,47 L 240,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M261,62L325,62A15 15 0 0 0 341 47L341,47A15 15 0 0 0 325 32L261,32A15 15 0 0 0 246 47L246,47A15 15 0 0 0 261 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="293" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="358,47 346,51 346,43" style="fill:rgb(0,0,0)"/>
<path d="M341,47L352,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M373,62L478,62A15 15 0 0 0 493 47L493,47A15 15 0 0 0 478 32L373,32A15 15 0 0 0 358 47L358,47A15 15 0 0 0 373 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="511,47 499,51 499,43" style="fill:rgb(0,0,0)"/>
<path d="M493,47L505,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="567,85 556,89 556,81" style="fill:rgb(0,0,0)"/>
<path d="M511,47 L 518,47 Q 526,47 526,32 L 526,32 Q 526,17 533,17 Q 541,17 541,32 L 541,70 Q 541,85 551,85 L 561,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,100L613,100A15 15 0 0 0 628 85L628,85A15 15 0 0 0 613 70L582,70A15 15 0 0 0 567 85L567,85A15 15 0 0 0 582 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="645,85 633,89 633,81" style="fill:rgb(0,0,0)"/>
<path d="M628,85L639,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="687,17 675,21 675,12" style="fill:rgb(0,0,0)"/>
<path d="M645,85 L 652,85 Q 660,85 660,70 L 660,32 Q 660,17 670,17 L 681,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="690" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M50,70L100,70L100,39L50,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="175,55 163,59 163,50" style="fill:rgb(0,0,0)"/>
<path d="M100,55L169,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M175,55 L 182,55 Q 190,55 190,40 L 190,32 Q 190,17 197,17 L 205,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M175,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,17 586,21 586,12" style="fill:rgb(0,0,0)"/>
<path d="M358,17L592,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,17L675,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,62L599,62A15 15 0 0 0 614 47A15 15 0 0 0 599 32L582,32A15 15 0 0 0 567 47A15 15 0 0 0 582 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="645,47 633,51 633,43" style="fill:rgb(0,0,0)"/>
<path d="M614,47L639,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M645,47 L 652,47 Q 660,47 660,40 L 660,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="567,47 556,51 556,43" style="fill:rgb(0,0,0)"/>
<path d="M541,32 L 541,39 Q 541,47 551,47 L 561,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./create-index-stmt.html'>create-index-stmt</a>&nbsp;&nbsp; <a href='./table-constraint.html'>table-constraint</a>&nbsp;&nbsp; <a href='./upsert-clause.html'>upsert-clause</a><br></br>
References:&nbsp;&nbsp; <a href='./expr.html'>expr</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>
</div>



Added Doc/Extra/Core/syntax/insert-stmt.html.



























































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: insert-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>insert-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:601px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 601.066 922.104">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L91,32A15 15 0 0 0 106 17A15 15 0 0 0 91 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M166,62L252,62A15 15 0 0 0 267 47L267,47A15 15 0 0 0 252 32L166,32A15 15 0 0 0 151 47L151,47A15 15 0 0 0 166 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="209,17 197,21 197,12" style="fill:rgb(0,0,0)"/>
<path d="M106,17L203,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M209,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M357,32L583,32L583,2L357,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="151,47 139,51 139,43" style="fill:rgb(0,0,0)"/>
<path d="M106,17 L 113,17 Q 121,17 121,32 L 121,32 Q 121,47 133,47 L 145,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,47 278,51 278,43" style="fill:rgb(0,0,0)"/>
<path d="M267,47L284,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,47 L 297,47 Q 305,47 305,32 L 305,32 Q 305,17 320,17 L 330,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,70A15 15 0 0 0 485 55L485,55A15 15 0 0 0 470 39A15 15 0 0 0 455 55L455,55A15 15 0 0 0 470 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="485,55 497,50 497,59" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,40 Q 598,55 583,55 L 506,55 L 491,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,55 L 349,55 Q 334,55 334,40 L 334,32 Q 334,17 340,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="294,83 306,79 306,88" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,68 Q 598,83 583,83 L 315,83 L 300,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="24,53 20,41 28,41" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,32 L 24,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,145L124,145A15 15 0 0 0 139 130A15 15 0 0 0 124 115L60,115A15 15 0 0 0 45 130A15 15 0 0 0 60 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<path d="M60,183L109,183A15 15 0 0 0 124 168A15 15 0 0 0 109 153L60,153A15 15 0 0 0 45 168A15 15 0 0 0 60 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="84" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INSERT</text>
<polygon points="166,198 154,203 154,194" style="fill:rgb(0,0,0)"/>
<path d="M124,168 L 132,168 Q 139,168 139,183 L 139,183 Q 139,198 149,198 L 160,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M181,213L187,213A15 15 0 0 0 203 198A15 15 0 0 0 187 183L181,183A15 15 0 0 0 166 198A15 15 0 0 0 181 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="244,349 233,354 233,345" style="fill:rgb(0,0,0)"/>
<path d="M203,198 L 210,198 Q 218,198 218,213 L 218,334 Q 218,349 228,349 L 238,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,365L337,365A15 15 0 0 0 352 349A15 15 0 0 0 337 334L259,334A15 15 0 0 0 244 349A15 15 0 0 0 259 365Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="298" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="369,349 358,354 358,345" style="fill:rgb(0,0,0)"/>
<path d="M352,349L363,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,130 399,135 399,126" style="fill:rgb(0,0,0)"/>
<path d="M369,349 L 377,349 Q 384,349 384,334 L 384,145 Q 384,130 395,130 L 405,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M426,145L453,145A15 15 0 0 0 468 130A15 15 0 0 0 453 115L426,115A15 15 0 0 0 411 130A15 15 0 0 0 426 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTO</text>
<polygon points="45,168 33,172 33,164" style="fill:rgb(0,0,0)"/>
<path d="M24,53 L 24,153 Q 24,168 31,168 L 39,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,130 33,135 33,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 31,130 L 39,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,83 L 39,83 Q 24,83 24,91 L 24,98"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M139,130L399,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,168 358,172 358,164" style="fill:rgb(0,0,0)"/>
<path d="M124,168L363,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,168 L 377,168 Q 384,168 384,160 L 384,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,213L301,213A15 15 0 0 0 316 198A15 15 0 0 0 301 183L259,183A15 15 0 0 0 244 198A15 15 0 0 0 259 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="244,198 233,203 233,194" style="fill:rgb(0,0,0)"/>
<path d="M203,198L238,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,198 358,203 358,194" style="fill:rgb(0,0,0)"/>
<path d="M316,198L363,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,198 L 377,198 Q 384,198 384,191 L 384,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,251L281,251A15 15 0 0 0 296 236A15 15 0 0 0 281 221L259,221A15 15 0 0 0 244 236A15 15 0 0 0 259 251Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="270" y="236" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="244,236 233,240 233,232" style="fill:rgb(0,0,0)"/>
<path d="M218,221 L 218,228 Q 218,236 228,236 L 238,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,236 358,240 358,232" style="fill:rgb(0,0,0)"/>
<path d="M296,236L363,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,236 L 377,236 Q 384,236 384,229 L 384,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,289L311,289A15 15 0 0 0 327 274A15 15 0 0 0 311 259L259,259A15 15 0 0 0 244 274A15 15 0 0 0 259 289Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="285" y="274" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="244,274 233,278 233,270" style="fill:rgb(0,0,0)"/>
<path d="M218,259 L 218,266 Q 218,274 228,274 L 238,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,274 358,278 358,270" style="fill:rgb(0,0,0)"/>
<path d="M327,274L363,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,274 L 377,274 Q 384,274 384,266 L 384,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,327L323,327A15 15 0 0 0 338 312A15 15 0 0 0 323 297L259,297A15 15 0 0 0 244 312A15 15 0 0 0 259 327Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="291" y="312" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<polygon points="244,312 233,316 233,307" style="fill:rgb(0,0,0)"/>
<path d="M218,297 L 218,304 Q 218,312 228,312 L 238,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,312 358,316 358,307" style="fill:rgb(0,0,0)"/>
<path d="M338,312L363,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,312 L 377,312 Q 384,312 384,304 L 384,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,455L156,455A15 15 0 0 0 171 440A15 15 0 0 0 156 425L60,425A15 15 0 0 0 45 440A15 15 0 0 0 60 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,440 183,444 183,436" style="fill:rgb(0,0,0)"/>
<path d="M171,440L189,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,455A15 15 0 0 0 225 440A15 15 0 0 0 210 425A15 15 0 0 0 195 440A15 15 0 0 0 210 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="440" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,440 249,444 249,436" style="fill:rgb(0,0,0)"/>
<path d="M225,440L255,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,455L351,455A15 15 0 0 0 366 440A15 15 0 0 0 351 425L276,425A15 15 0 0 0 261 440A15 15 0 0 0 276 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="402,440 391,444 391,436" style="fill:rgb(0,0,0)"/>
<path d="M366,440L396,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,455L421,455A15 15 0 0 0 436 440A15 15 0 0 0 421 425L417,425A15 15 0 0 0 402 440A15 15 0 0 0 417 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="419" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="459,440 448,444 448,436" style="fill:rgb(0,0,0)"/>
<path d="M436,440L454,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,455L495,455A15 15 0 0 0 510 440A15 15 0 0 0 495 425L475,425A15 15 0 0 0 459 440A15 15 0 0 0 475 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="485" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">alias</text>
<polygon points="483,238 478,227 487,227" style="fill:rgb(0,0,0)"/>
<path d="M468,130 L 475,130 Q 483,130 483,145 L 483,217 L 483,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,395 183,390 183,399" style="fill:rgb(0,0,0)"/>
<path d="M483,238 L 483,380 Q 483,395 468,395 L 192,395 L 177,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,440 33,444 33,436" style="fill:rgb(0,0,0)"/>
<path d="M171,395 L 35,395 Q 20,395 20,410 L 20,425 Q 20,440 30,440 L 39,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,423 230,412 239,412" style="fill:rgb(0,0,0)"/>
<path d="M261,395 L 247,395 Q 234,395 234,406 L 234,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M234,423 L 234,432 Q 234,440 242,440 L 249,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,546A15 15 0 0 0 75 531A15 15 0 0 0 60 516A15 15 0 0 0 45 531A15 15 0 0 0 60 546Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="531" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,531 100,535 100,527" style="fill:rgb(0,0,0)"/>
<path d="M75,531L105,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,546L220,546A15 15 0 0 0 235 531A15 15 0 0 0 220 516L126,516A15 15 0 0 0 111 531A15 15 0 0 0 126 546Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="531" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="271,531 260,535 260,527" style="fill:rgb(0,0,0)"/>
<path d="M235,531L266,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,546A15 15 0 0 0 302 531A15 15 0 0 0 287 516A15 15 0 0 0 271 531A15 15 0 0 0 287 546Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="287" y="531" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<path d="M173,580A15 15 0 0 0 188 565A15 15 0 0 0 173 550A15 15 0 0 0 158 565A15 15 0 0 0 173 580Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="565" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="188,565 200,561 200,569" style="fill:rgb(0,0,0)"/>
<path d="M235,531 L 243,531 Q 250,531 250,546 L 250,550 Q 250,565 235,565 L 209,565 L 194,565"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,565 L 100,565 Q 85,565 85,550 L 85,546 Q 85,531 92,531 L 100,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="173,595 185,591 185,599" style="fill:rgb(0,0,0)"/>
<path d="M302,531 L 309,531 Q 317,531 317,546 L 317,580 Q 317,595 302,595 L 194,595 L 179,595"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M173,595 L 39,595 Q 24,595 24,603 L 24,610"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="436,486 448,481 448,490" style="fill:rgb(0,0,0)"/>
<path d="M510,440 L 518,440 Q 525,440 525,455 L 525,471 Q 525,486 510,486 L 457,486 L 442,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,531 33,535 33,527" style="fill:rgb(0,0,0)"/>
<path d="M436,486 L 39,486 Q 24,486 24,501 L 24,516 Q 24,531 31,531 L 39,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="381,469 377,457 385,457" style="fill:rgb(0,0,0)"/>
<path d="M366,440 L 374,440 Q 381,440 381,451 L 381,463"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M381,469 L 381,477 Q 381,486 374,486 L 366,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,671L112,671A15 15 0 0 0 127 656A15 15 0 0 0 112 640L60,640A15 15 0 0 0 45 656A15 15 0 0 0 60 671Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="86" y="656" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="163,656 152,660 152,651" style="fill:rgb(0,0,0)"/>
<path d="M127,656L158,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,671A15 15 0 0 0 194 656A15 15 0 0 0 179 640A15 15 0 0 0 163 656A15 15 0 0 0 179 671Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="179" y="656" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="230,656 218,660 218,651" style="fill:rgb(0,0,0)"/>
<path d="M194,656L224,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M230,671L279,671L279,640L230,640Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="656" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="315,656 303,660 303,651" style="fill:rgb(0,0,0)"/>
<path d="M279,656L309,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,671A15 15 0 0 0 345 656A15 15 0 0 0 330 640A15 15 0 0 0 315 656A15 15 0 0 0 330 671Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="330" y="656" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="45,656 33,660 33,651" style="fill:rgb(0,0,0)"/>
<path d="M24,516 L 24,641 Q 24,656 31,656 L 39,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,705A15 15 0 0 0 269 690A15 15 0 0 0 254 675A15 15 0 0 0 239 690A15 15 0 0 0 254 705Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="690" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="269,690 281,685 281,694" style="fill:rgb(0,0,0)"/>
<path d="M279,656 L 286,656 Q 294,656 294,671 L 294,675 Q 294,690 285,690 L 275,690"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M239,690 L 218,690 Q 203,690 203,675 L 203,671 Q 203,656 211,656 L 218,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,743A15 15 0 0 0 269 727A15 15 0 0 0 254 712A15 15 0 0 0 239 727A15 15 0 0 0 254 743Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="727" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="269,727 281,723 281,732" style="fill:rgb(0,0,0)"/>
<path d="M345,656 L 353,656 Q 360,656 360,671 L 360,712 Q 360,727 345,727 L 290,727 L 275,727"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M239,727 L 152,727 Q 137,727 137,712 L 137,671 Q 137,656 144,656 L 152,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="387,693 375,698 375,689" style="fill:rgb(0,0,0)"/>
<path d="M345,656 L 353,656 Q 360,656 360,671 L 360,678 Q 360,693 371,693 L 381,693"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M387,709L512,709L512,678L387,678Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="449" y="693" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">upsert-clause</text>
<polygon points="535,693 523,698 523,689" style="fill:rgb(0,0,0)"/>
<path d="M512,693L529,693"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,693 L 542,693 Q 550,693 550,701 L 550,708"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="535,656 523,660 523,651" style="fill:rgb(0,0,0)"/>
<path d="M345,656L529,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,788L149,788L149,758L45,758Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="97" y="773" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="535,773 523,777 523,768" style="fill:rgb(0,0,0)"/>
<path d="M149,773L529,773"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,773 L 542,773 Q 550,773 550,780 L 550,788"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,773 33,777 33,768" style="fill:rgb(0,0,0)"/>
<path d="M24,640 L 24,758 Q 24,773 31,773 L 39,773"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M387,818L512,818L512,788L387,788Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="449" y="803" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">upsert-clause</text>
<polygon points="535,803 523,807 523,799" style="fill:rgb(0,0,0)"/>
<path d="M512,803L529,803"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,803 L 542,803 Q 550,803 550,811 L 550,818"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="387,803 375,807 375,799" style="fill:rgb(0,0,0)"/>
<path d="M345,773 L 353,773 Q 360,773 360,788 L 360,788 Q 360,803 371,803 L 381,803"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,856L125,856A15 15 0 0 0 140 841A15 15 0 0 0 125 826L60,826A15 15 0 0 0 45 841A15 15 0 0 0 60 856Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="841" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFAULT</text>
<polygon points="164,841 152,845 152,837" style="fill:rgb(0,0,0)"/>
<path d="M140,841L158,841"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,856L231,856A15 15 0 0 0 246 841A15 15 0 0 0 231 826L179,826A15 15 0 0 0 164 841A15 15 0 0 0 179 856Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="205" y="841" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="535,841 523,845 523,837" style="fill:rgb(0,0,0)"/>
<path d="M246,841L529,841"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,841 33,845 33,837" style="fill:rgb(0,0,0)"/>
<path d="M24,758 L 24,826 Q 24,841 31,841 L 39,841"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M361,919L512,919L512,889L361,889Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="436" y="904" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">returning-clause</text>
<polygon points="591,904 580,909 580,900" style="fill:rgb(0,0,0)"/>
<path d="M512,904L585,904"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="595" cy="904" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,656 L 542,656 Q 550,656 550,671 L 550,889 Q 550,904 557,904 L 565,904"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="436,871 448,867 448,875" style="fill:rgb(0,0,0)"/>
<path d="M535,841 L 542,841 Q 550,841 550,856 L 550,856 Q 550,871 535,871 L 457,871 L 442,871"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="361,904 349,909 349,900" style="fill:rgb(0,0,0)"/>
<path d="M436,871 L 349,871 Q 334,871 334,886 L 334,889 Q 334,904 345,904 L 355,904"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./create-trigger-stmt.html'>create-trigger-stmt</a>&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./common-table-expression.html'>common-table-expression</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./returning-clause.html'>returning-clause</a>&nbsp;&nbsp; <a href='./select-stmt.html'>select-stmt</a>&nbsp;&nbsp; <a href='./upsert-clause.html'>upsert-clause</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>
</div>



Added Doc/Extra/Core/syntax/join-clause.html.

























































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: join-clause</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>join-clause</h1>
<div class='imgcontainer'>
<div style="max-width:793px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 793.282 84.24">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L193,32L193,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="259,47 247,51 247,43" style="fill:rgb(0,0,0)"/>
<path d="M193,17 L 200,17 Q 208,17 208,32 L 208,32 Q 208,47 223,47 L 238,47 L 253,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,62L380,62L380,32L259,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-operator</text>
<polygon points="403,47 391,51 391,43" style="fill:rgb(0,0,0)"/>
<path d="M380,47L397,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,62L564,62L564,32L403,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="587,47 575,51 575,43" style="fill:rgb(0,0,0)"/>
<path d="M564,47L581,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M587,62L721,62L721,32L587,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="654" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-constraint</text>
<polygon points="783,17 772,21 772,12" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 742,47 Q 757,47 757,32 L 757,32 Q 757,17 767,17 L 778,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="787" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M193,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,17L776,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,77 495,73 495,82" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 728,47 Q 736,47 736,62 L 736,62 Q 736,77 721,77 L 504,77 L 489,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,77 L 247,77 Q 232,77 232,62 L 232,62 Q 232,47 246,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./select-core.html'>select-core</a>&nbsp;&nbsp; <a href='./select-stmt.html'>select-stmt</a>&nbsp;&nbsp; <a href='./table-or-subquery.html'>table-or-subquery</a>&nbsp;&nbsp; <a href='./update-stmt.html'>update-stmt</a>&nbsp;&nbsp; <a href='./update-stmt-limited.html'>update-stmt-limited</a><br></br>
References:&nbsp;&nbsp; <a href='./join-constraint.html'>join-constraint</a>&nbsp;&nbsp; <a href='./join-operator.html'>join-operator</a>&nbsp;&nbsp; <a href='./table-or-subquery.html'>table-or-subquery</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_aggfunc.html'>lang_aggfunc.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_attach.html'>lang_attach.html</a>&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_createview.html'>lang_createview.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_returning.html'>lang_returning.html</a>&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>
</div>



Added Doc/Extra/Core/syntax/join-constraint.html.























































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: join-constraint</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>join-constraint</h1>
<div class='imgcontainer'>
<div style="max-width:483px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 483.336 126.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L104,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 104 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="143,55 131,59 131,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L137,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,70A15 15 0 0 0 173 55L173,55A15 15 0 0 0 158 39A15 15 0 0 0 143 55L143,55A15 15 0 0 0 158 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="209,55 197,59 197,50" style="fill:rgb(0,0,0)"/>
<path d="M173,55L203,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M224,70L318,70A15 15 0 0 0 333 55L333,55A15 15 0 0 0 318 39L224,39A15 15 0 0 0 209 55L209,55A15 15 0 0 0 224 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="369,55 358,59 358,50" style="fill:rgb(0,0,0)"/>
<path d="M333,55L363,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,70A15 15 0 0 0 399 55L399,55A15 15 0 0 0 384 39A15 15 0 0 0 369 55L369,55A15 15 0 0 0 384 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="422,55 411,59 411,50" style="fill:rgb(0,0,0)"/>
<path d="M399,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="473,17 462,21 462,12" style="fill:rgb(0,0,0)"/>
<path d="M422,55 L 430,55 Q 437,55 437,40 L 437,32 Q 437,17 452,17 L 453,17 L 468,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="477" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,108A15 15 0 0 0 286 92A15 15 0 0 0 271 77A15 15 0 0 0 256 92A15 15 0 0 0 271 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="286,92 298,88 298,97" style="fill:rgb(0,0,0)"/>
<path d="M333,55 L 341,55 Q 348,55 348,70 L 348,77 Q 348,92 333,92 L 307,92 L 292,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,92 L 197,92 Q 182,92 182,77 L 182,70 Q 182,55 190,55 L 197,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L74,32A15 15 0 0 0 90 17A15 15 0 0 0 74 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="113,17 101,21 101,12" style="fill:rgb(0,0,0)"/>
<path d="M90,17L107,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M113,32L162,32L162,2L113,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="422,17 411,21 411,12" style="fill:rgb(0,0,0)"/>
<path d="M162,17L417,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,17L462,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="209,120 197,124 197,115" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,105 Q 24,120 39,120 L 188,120 L 203,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,120 L 422,120 Q 437,120 437,105 L 437,54 L 437,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./join-clause.html'>join-clause</a><br></br>
References:&nbsp;&nbsp; <a href='./expr.html'>expr</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_aggfunc.html'>lang_aggfunc.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_attach.html'>lang_attach.html</a>&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_createview.html'>lang_createview.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_returning.html'>lang_returning.html</a>&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>
</div>



Added Doc/Extra/Core/syntax/join-operator.html.



























































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: join-operator</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>join-operator</h1>
<div class='imgcontainer'>
<div style="max-width:620px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 620.333 255.312">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,71 39,76 39,67" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,56 Q 24,71 34,71 L 45,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,86L133,86A15 15 0 0 0 148 71A15 15 0 0 0 133 56L66,56A15 15 0 0 0 50 71A15 15 0 0 0 66 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="99" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NATURAL</text>
<polygon points="189,41 178,45 178,37" style="fill:rgb(0,0,0)"/>
<path d="M148,71 L 155,71 Q 163,71 163,56 L 163,56 Q 163,41 173,41 L 184,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,71 219,76 219,67" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,56 Q 204,71 215,71 L 225,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,86L273,86A15 15 0 0 0 288 71A15 15 0 0 0 273 56L246,56A15 15 0 0 0 231 71A15 15 0 0 0 246 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LEFT</text>
<polygon points="378,71 366,76 366,67" style="fill:rgb(0,0,0)"/>
<path d="M288,71L372,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,86L437,86A15 15 0 0 0 452 71A15 15 0 0 0 437 56L393,56A15 15 0 0 0 378 71A15 15 0 0 0 393 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OUTER</text>
<polygon points="475,71 463,76 463,67" style="fill:rgb(0,0,0)"/>
<path d="M452,71L469,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="516,41 505,45 505,37" style="fill:rgb(0,0,0)"/>
<path d="M475,71 L 482,71 Q 490,71 490,56 L 490,56 Q 490,41 500,41 L 511,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,56L554,56A15 15 0 0 0 569 41A15 15 0 0 0 554 26L532,26A15 15 0 0 0 516 41A15 15 0 0 0 532 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="543" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">JOIN</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M569,41 L 576,41 Q 584,41 584,29 Q 584,17 594,17 L 605,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="614" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,32A15 15 0 0 0 325 17A15 15 0 0 0 310 2A15 15 0 0 0 295 17A15 15 0 0 0 310 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="295,17 283,21 283,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L289,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M325,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="99,41 88,45 88,37" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,29 Q 24,41 39,41 L 78,41 L 93,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M99,41L178,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,41L505,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,41 366,45 366,37" style="fill:rgb(0,0,0)"/>
<path d="M336,71 L 344,71 Q 351,71 351,56 L 351,56 Q 351,41 362,41 L 372,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,109 219,113 219,105" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,94 Q 204,109 215,109 L 225,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,124L284,124A15 15 0 0 0 299 109A15 15 0 0 0 284 94L246,94A15 15 0 0 0 231 109A15 15 0 0 0 246 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RIGHT</text>
<polygon points="341,71 329,76 329,67" style="fill:rgb(0,0,0)"/>
<path d="M299,109 L 307,109 Q 314,109 314,94 L 314,86 Q 314,71 324,71 L 335,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,147 219,151 219,142" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,132 Q 204,147 215,147 L 225,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,162L274,162A15 15 0 0 0 289 147A15 15 0 0 0 274 132L246,132A15 15 0 0 0 231 147A15 15 0 0 0 246 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FULL</text>
<path d="M289,147 L 302,147 Q 314,147 314,132 L 314,109 L 314,94"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,192 219,196 219,188" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,177 Q 204,192 215,192 L 225,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,207L287,207A15 15 0 0 0 302 192A15 15 0 0 0 287 177L246,177A15 15 0 0 0 231 192A15 15 0 0 0 246 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="192" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INNER</text>
<polygon points="475,192 463,196 463,188" style="fill:rgb(0,0,0)"/>
<path d="M302,192L469,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,192 L 482,192 Q 490,192 490,185 L 490,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,238 219,242 219,233" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,223 Q 24,238 39,238 L 210,238 L 225,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,253L287,253A15 15 0 0 0 303 238A15 15 0 0 0 287 222L246,222A15 15 0 0 0 231 238A15 15 0 0 0 246 253Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="238" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CROSS</text>
<polygon points="475,238 463,242 463,233" style="fill:rgb(0,0,0)"/>
<path d="M303,238L469,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,238 L 482,238 Q 490,238 490,223 L 490,71 L 490,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./join-clause.html'>join-clause</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_aggfunc.html'>lang_aggfunc.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_attach.html'>lang_attach.html</a>&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_createview.html'>lang_createview.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_returning.html'>lang_returning.html</a>&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>
</div>



Added Doc/Extra/Core/syntax/literal-value.html.



































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: literal-value</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>literal-value</h1>
<div class='imgcontainer'>
<div style="max-width:341px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 341.376 336.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,319 39,324 39,315" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,304 Q 24,319 34,319 L 45,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,334L252,334A15 15 0 0 0 267 319A15 15 0 0 0 252 304L65,304A15 15 0 0 0 50 319A15 15 0 0 0 65 334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIMESTAMP</text>
<polygon points="290,319 278,324 278,315" style="fill:rgb(0,0,0)"/>
<path d="M267,319L284,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,17 320,21 320,12" style="fill:rgb(0,0,0)"/>
<path d="M290,319 L 297,319 Q 305,319 305,304 L 305,32 Q 305,17 315,17 L 326,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="335" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L172,32A15 15 0 0 0 187 17A15 15 0 0 0 172 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="119" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,17L320,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L153,70A15 15 0 0 0 168 55L168,55A15 15 0 0 0 153 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">string-literal</text>
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,47 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,55 278,59 278,50" style="fill:rgb(0,0,0)"/>
<path d="M168,55L284,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,55 L 297,55 Q 305,55 305,47 L 305,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L140,108A15 15 0 0 0 155 92A15 15 0 0 0 140 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">blob-literal</text>
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,85 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,92 278,97 278,88" style="fill:rgb(0,0,0)"/>
<path d="M155,92L284,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,92 L 297,92 Q 305,92 305,85 L 305,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,145L97,145A15 15 0 0 0 112 130A15 15 0 0 0 97 115L66,115A15 15 0 0 0 50 130A15 15 0 0 0 66 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="50,130 39,135 39,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 34,130 L 45,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,130 278,135 278,126" style="fill:rgb(0,0,0)"/>
<path d="M112,130L284,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,130 L 297,130 Q 305,130 305,123 L 305,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,183L96,183A15 15 0 0 0 111 168A15 15 0 0 0 96 153L66,153A15 15 0 0 0 50 168A15 15 0 0 0 66 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRUE</text>
<polygon points="50,168 39,172 39,164" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,160 Q 24,168 34,168 L 45,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,168 278,172 278,164" style="fill:rgb(0,0,0)"/>
<path d="M111,168L284,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,168 L 297,168 Q 305,168 305,160 L 305,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,221L104,221A15 15 0 0 0 119 206A15 15 0 0 0 104 191L66,191A15 15 0 0 0 50 206A15 15 0 0 0 66 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FALSE</text>
<polygon points="50,206 39,210 39,201" style="fill:rgb(0,0,0)"/>
<path d="M24,191 L 24,198 Q 24,206 34,206 L 45,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,206 278,210 278,201" style="fill:rgb(0,0,0)"/>
<path d="M119,206L284,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,206 L 297,206 Q 305,206 305,198 L 305,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,259L190,259A15 15 0 0 0 205 244A15 15 0 0 0 190 228L66,228A15 15 0 0 0 50 244A15 15 0 0 0 66 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="128" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIME</text>
<polygon points="50,244 39,248 39,239" style="fill:rgb(0,0,0)"/>
<path d="M24,228 L 24,236 Q 24,244 34,244 L 45,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,244 278,248 278,239" style="fill:rgb(0,0,0)"/>
<path d="M205,244L284,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,244 L 297,244 Q 305,244 305,236 L 305,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,297L192,297A15 15 0 0 0 207 281A15 15 0 0 0 192 266L66,266A15 15 0 0 0 50 281A15 15 0 0 0 66 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_DATE</text>
<polygon points="50,281 39,286 39,277" style="fill:rgb(0,0,0)"/>
<path d="M24,266 L 24,274 Q 24,281 34,281 L 45,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,281 278,286 278,277" style="fill:rgb(0,0,0)"/>
<path d="M207,281L284,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,281 L 297,281 Q 305,281 305,274 L 305,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./column-constraint.html'>column-constraint</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_aggfunc.html'>lang_aggfunc.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_attach.html'>lang_attach.html</a>&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_createview.html'>lang_createview.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_returning.html'>lang_returning.html</a>&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>
</div>



Added Doc/Extra/Core/syntax/numeric-literal.html.

























































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: numeric-literal</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>numeric-literal</h1>
<div class='imgcontainer'>
<div style="max-width:765px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 765.562 214.056">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="63,36 51,41 51,32" style="fill:rgb(0,0,0)"/>
<path d="M9,36L57,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M78,51L98,51A15 15 0 0 0 113 36A15 15 0 0 0 98 21L78,21A15 15 0 0 0 63 36A15 15 0 0 0 78 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="88" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">digit</text>
<polygon points="88,6 99,2 99,10" style="fill:rgb(0,0,0)"/>
<path d="M113,36 L 121,36 Q 128,36 128,21 L 128,21 Q 128,6 113,6 L 109,6 L 94,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M88,6 L 51,6 Q 36,6 36,21 L 36,21 Q 36,36 44,36 L 51,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="176,66 164,71 164,62" style="fill:rgb(0,0,0)"/>
<path d="M113,36 L 134,36 Q 149,36 149,51 L 149,51 Q 149,66 159,66 L 170,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M191,82A15 15 0 0 0 206 66L206,66A15 15 0 0 0 191 51A15 15 0 0 0 176 66L176,66A15 15 0 0 0 191 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="267,66 255,71 255,62" style="fill:rgb(0,0,0)"/>
<path d="M206,66L261,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,66 328,71 328,62" style="fill:rgb(0,0,0)"/>
<path d="M267,66L334,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="381,36 370,41 370,32" style="fill:rgb(0,0,0)"/>
<path d="M340,66 L 347,66 Q 355,66 355,51 L 355,51 Q 355,36 365,36 L 375,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,74 411,78 411,70" style="fill:rgb(0,0,0)"/>
<path d="M381,36 L 389,36 Q 396,36 396,51 L 396,59 Q 396,74 406,74 L 417,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,89A15 15 0 0 0 453 74L453,74A15 15 0 0 0 438 59A15 15 0 0 0 423 74L423,74A15 15 0 0 0 438 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">E</text>
<polygon points="494,74 483,78 483,70" style="fill:rgb(0,0,0)"/>
<path d="M453,74L489,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,112 411,116 411,108" style="fill:rgb(0,0,0)"/>
<path d="M381,36 L 389,36 Q 396,36 396,51 L 396,97 Q 396,112 406,112 L 417,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,127A15 15 0 0 0 453 112A15 15 0 0 0 438 97A15 15 0 0 0 423 112A15 15 0 0 0 438 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="112" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">e</text>
<path d="M453,112 L 460,112 Q 468,112 468,97 L 468,89 Q 468,74 475,74 L 483,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,112L277,112A15 15 0 0 0 292 97L292,97A15 15 0 0 0 277 82L257,82A15 15 0 0 0 242 97L242,97A15 15 0 0 0 257 112Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="97" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">digit</text>
<polygon points="292,97 304,92 304,101" style="fill:rgb(0,0,0)"/>
<path d="M267,66 L 304,66 Q 319,66 319,81 L 319,82 Q 319,97 308,97 L 298,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M242,97 L 234,97 Q 227,97 227,82 L 227,81 Q 227,66 234,66 L 242,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M113,36L261,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,36L370,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,135 39,139 39,130" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,120 Q 24,135 34,135 L 45,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150A15 15 0 0 0 81 135A15 15 0 0 0 66 119A15 15 0 0 0 50 135A15 15 0 0 0 66 150Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="135" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="117,135 105,139 105,130" style="fill:rgb(0,0,0)"/>
<path d="M81,135L111,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,150L152,150A15 15 0 0 0 167 135A15 15 0 0 0 152 119L132,119A15 15 0 0 0 117 135A15 15 0 0 0 132 150Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="142" y="135" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">digit</text>
<polygon points="340,135 328,139 328,130" style="fill:rgb(0,0,0)"/>
<path d="M167,135L334,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,135 L 347,135 Q 355,135 355,120 L 355,66 L 355,51"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="142,104 153,100 153,109" style="fill:rgb(0,0,0)"/>
<path d="M167,135 L 174,135 Q 182,135 182,120 L 182,119 Q 182,104 167,104 L 162,104 L 147,104"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,104 L 105,104 Q 90,104 90,119 L 90,120 Q 90,135 98,135 L 105,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="536,142 524,146 524,138" style="fill:rgb(0,0,0)"/>
<path d="M494,74 L 502,74 Q 509,74 509,89 L 509,127 Q 509,142 520,142 L 530,142"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M551,157A15 15 0 0 0 566 142A15 15 0 0 0 551 127A15 15 0 0 0 536 142A15 15 0 0 0 551 157Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="551" y="142" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<polygon points="628,74 616,78 616,70" style="fill:rgb(0,0,0)"/>
<path d="M566,142 L 574,142 Q 581,142 581,127 L 581,89 Q 581,74 596,74 L 607,74 L 622,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M643,89L663,89A15 15 0 0 0 678 74L678,74A15 15 0 0 0 663 59L643,59A15 15 0 0 0 628 74L628,74A15 15 0 0 0 643 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="653" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">digit</text>
<polygon points="714,74 703,78 703,70" style="fill:rgb(0,0,0)"/>
<path d="M678,74L708,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="756,36 744,41 744,32" style="fill:rgb(0,0,0)"/>
<path d="M714,74 L 722,74 Q 729,74 729,59 L 729,51 Q 729,36 740,36 L 750,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="759" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="536,104 524,109 524,100" style="fill:rgb(0,0,0)"/>
<path d="M494,74 L 502,74 Q 509,74 509,89 L 509,89 Q 509,104 520,104 L 530,104"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M551,119A15 15 0 0 0 566 104A15 15 0 0 0 551 89A15 15 0 0 0 536 104A15 15 0 0 0 551 119Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="551" y="104" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<path d="M566,104 L 574,104 Q 581,104 581,97 L 581,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="551,36 540,41 540,32" style="fill:rgb(0,0,0)"/>
<path d="M381,36L545,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M551,36L744,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="551,74 540,78 540,70" style="fill:rgb(0,0,0)"/>
<path d="M494,74L545,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M551,74L616,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="653,50 665,46 665,54" style="fill:rgb(0,0,0)"/>
<path d="M678,74 L 686,74 Q 693,74 693,62 Q 693,50 678,50 L 674,50 L 659,50"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M653,50 L 616,50 Q 601,50 601,62 Q 601,74 609,74 L 616,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,180 39,184 39,176" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,165 Q 24,180 34,180 L 45,180"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,195L69,195A15 15 0 0 0 84 180A15 15 0 0 0 69 165L66,165A15 15 0 0 0 50 180A15 15 0 0 0 66 195Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="67" y="180" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">0x</text>
<polygon points="120,180 108,184 108,176" style="fill:rgb(0,0,0)"/>
<path d="M84,180L114,180"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,195L185,195A15 15 0 0 0 200 180A15 15 0 0 0 185 165L135,165A15 15 0 0 0 120 180A15 15 0 0 0 135 195Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="160" y="180" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">hexdigit</text>
<polygon points="714,180 703,184 703,176" style="fill:rgb(0,0,0)"/>
<path d="M200,180L708,180"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M714,180 L 722,180 Q 729,180 729,165 L 729,74 L 729,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="160,207 171,203 171,211" style="fill:rgb(0,0,0)"/>
<path d="M200,180 L 207,180 Q 215,180 215,193 Q 215,207 200,207 L 180,207 L 165,207"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M160,207 L 108,207 Q 93,207 93,193 Q 93,180 101,180 L 108,180"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>
<br></br>
See also:&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>
</div>



Added Doc/Extra/Core/syntax/ordering-term.html.

















































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: ordering-term</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>ordering-term</h1>
<div class='imgcontainer'>
<div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./aggregate-function-invocation.html'>aggregate-function-invocation</a>&nbsp;&nbsp; <a href='./compound-select-stmt.html'>compound-select-stmt</a>&nbsp;&nbsp; <a href='./delete-stmt-limited.html'>delete-stmt-limited</a>&nbsp;&nbsp; <a href='./factored-select-stmt.html'>factored-select-stmt</a>&nbsp;&nbsp; <a href='./function-arguments.html'>function-arguments</a>&nbsp;&nbsp; <a href='./over-clause.html'>over-clause</a>&nbsp;&nbsp; <a href='./select-stmt.html'>select-stmt</a>&nbsp;&nbsp; <a href='./simple-select-stmt.html'>simple-select-stmt</a>&nbsp;&nbsp; <a href='./update-stmt-limited.html'>update-stmt-limited</a>&nbsp;&nbsp; <a href='./window-defn.html'>window-defn</a><br></br>
References:&nbsp;&nbsp; <a href='./expr.html'>expr</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_aggfunc.html'>lang_aggfunc.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_attach.html'>lang_attach.html</a>&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_createview.html'>lang_createview.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_returning.html'>lang_returning.html</a>&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>
</div>



Added Doc/Extra/Core/syntax/over-clause.html.

















































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: over-clause</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>over-clause</h1>
<div class='imgcontainer'>
<div style="max-width:600px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 600.706 418.392">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="129,17 117,21 117,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L123,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M144,32L241,32A15 15 0 0 0 256 17A15 15 0 0 0 241 2L144,2A15 15 0 0 0 129 17A15 15 0 0 0 144 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,17 L 100,17 Q 108,17 108,32 L 108,40 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,70A15 15 0 0 0 165 55L165,55A15 15 0 0 0 149 39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 149 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="149" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="206,82 195,86 195,77" style="fill:rgb(0,0,0)"/>
<path d="M165,55 L 172,55 Q 180,55 180,68 Q 180,82 190,82 L 200,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,97L363,97A15 15 0 0 0 378 82A15 15 0 0 0 363 67L221,67A15 15 0 0 0 206 82A15 15 0 0 0 221 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="292" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M221,173L301,173A15 15 0 0 0 316 157A15 15 0 0 0 301 142L221,142A15 15 0 0 0 206 157A15 15 0 0 0 221 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="339,157 328,162 328,153" style="fill:rgb(0,0,0)"/>
<path d="M316,157L333,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,173L358,173A15 15 0 0 0 373 157A15 15 0 0 0 358 142L354,142A15 15 0 0 0 339 157A15 15 0 0 0 354 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="409,157 398,162 398,153" style="fill:rgb(0,0,0)"/>
<path d="M373,157L404,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,173L459,173L459,142L409,142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M434,210A15 15 0 0 0 449 195A15 15 0 0 0 434 180A15 15 0 0 0 419 195A15 15 0 0 0 434 210Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="195" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="449,195 461,191 461,200" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,180 Q 474,195 464,195 L 455,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,195 L 398,195 Q 383,195 383,180 L 383,172 Q 383,157 390,157 L 398,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,55 280,59 280,50" style="fill:rgb(0,0,0)"/>
<path d="M165,55L286,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,120 304,115 304,124" style="fill:rgb(0,0,0)"/>
<path d="M292,55 L 401,55 Q 416,55 416,70 L 416,105 Q 416,120 401,120 L 313,120 L 298,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,157 195,162 195,153" style="fill:rgb(0,0,0)"/>
<path d="M292,120 L 180,120 Q 165,120 165,135 L 165,142 Q 165,157 180,157 L 185,157 L 200,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="401,82 389,86 389,77" style="fill:rgb(0,0,0)"/>
<path d="M378,82L395,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,82 L 408,82 Q 416,82 416,89 L 416,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,286L266,286A15 15 0 0 0 281 271A15 15 0 0 0 266 256L221,256A15 15 0 0 0 206 271A15 15 0 0 0 221 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="244" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="304,271 292,275 292,266" style="fill:rgb(0,0,0)"/>
<path d="M281,271L298,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M319,286L323,286A15 15 0 0 0 338 271A15 15 0 0 0 323 256L319,256A15 15 0 0 0 304 271A15 15 0 0 0 319 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="321" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="374,271 363,275 363,266" style="fill:rgb(0,0,0)"/>
<path d="M338,271L368,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,286L504,286L504,256L374,256Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M439,324A15 15 0 0 0 454 309A15 15 0 0 0 439 293A15 15 0 0 0 424 309A15 15 0 0 0 439 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="454,309 466,304 466,313" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,294 Q 519,309 504,309 L 475,309 L 460,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,309 L 363,309 Q 348,309 348,294 L 348,286 Q 348,271 355,271 L 363,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,233 304,229 304,237" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,218 Q 474,233 459,233 L 313,233 L 298,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,271 195,275 195,266" style="fill:rgb(0,0,0)"/>
<path d="M292,233 L 180,233 Q 165,233 165,248 L 165,256 Q 165,271 180,271 L 185,271 L 200,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,195 160,184 169,184" style="fill:rgb(0,0,0)"/>
<path d="M165,142L165,189"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,195L165,256"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,399L311,399L311,369L206,369Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="384" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="519,384 508,389 508,380" style="fill:rgb(0,0,0)"/>
<path d="M311,384L513,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M534,399A15 15 0 0 0 549 384A15 15 0 0 0 534 369A15 15 0 0 0 519 384A15 15 0 0 0 534 399Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="384" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="591,17 579,21 579,12" style="fill:rgb(0,0,0)"/>
<path d="M549,384 L 557,384 Q 564,384 564,369 L 564,32 Q 564,17 575,17 L 585,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="594" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,17 508,21 508,12" style="fill:rgb(0,0,0)"/>
<path d="M256,17L513,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,17L579,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,346 304,342 304,351" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,331 Q 519,346 504,346 L 313,346 L 298,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,384 195,389 195,380" style="fill:rgb(0,0,0)"/>
<path d="M292,346 L 180,346 Q 165,346 165,361 L 165,369 Q 165,384 180,384 L 185,384 L 200,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,309 160,297 169,297" style="fill:rgb(0,0,0)"/>
<path d="M165,256L165,303"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,309L165,369"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="258,411 247,416 247,407" style="fill:rgb(0,0,0)"/>
<path d="M165,369 L 165,396 Q 165,411 180,411 L 238,411 L 253,411"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,384 369,389 369,380" style="fill:rgb(0,0,0)"/>
<path d="M258,411 L 335,411 Q 350,411 350,398 Q 350,384 362,384 L 375,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./expr.html'>expr</a><br></br>
References:&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./frame-spec.html'>frame-spec</a>&nbsp;&nbsp; <a href='./ordering-term.html'>ordering-term</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_aggfunc.html'>lang_aggfunc.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_attach.html'>lang_attach.html</a>&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_createview.html'>lang_createview.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_returning.html'>lang_returning.html</a>&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>
</div>



Added Doc/Extra/Core/syntax/pragma-stmt.html.







































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: pragma-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>pragma-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:824px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 824.352 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L104,32A15 15 0 0 0 119 17A15 15 0 0 0 104 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRAGMA</text>
<polygon points="155,17 143,21 143,12" style="fill:rgb(0,0,0)"/>
<path d="M119,17L149,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M170,32L266,32A15 15 0 0 0 282 17A15 15 0 0 0 266 2L170,2A15 15 0 0 0 155 17A15 15 0 0 0 170 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="305,17 293,21 293,12" style="fill:rgb(0,0,0)"/>
<path d="M282,17L299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,32A15 15 0 0 0 335 17A15 15 0 0 0 320 2A15 15 0 0 0 305 17A15 15 0 0 0 320 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="320" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="371,17 359,21 359,12" style="fill:rgb(0,0,0)"/>
<path d="M335,17L365,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M386,32L483,32A15 15 0 0 0 498 17A15 15 0 0 0 483 2L386,2A15 15 0 0 0 371 17A15 15 0 0 0 386 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="435" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">pragma-name</text>
<polygon points="540,82 528,86 528,77" style="fill:rgb(0,0,0)"/>
<path d="M498,17 L 506,17 Q 513,17 513,32 L 513,67 Q 513,82 524,82 L 534,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M555,97A15 15 0 0 0 570 82A15 15 0 0 0 555 67A15 15 0 0 0 540 82A15 15 0 0 0 555 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="555" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="593,82 582,86 582,77" style="fill:rgb(0,0,0)"/>
<path d="M570,82L587,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M593,97L720,97L720,67L593,67Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="656" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">pragma-value</text>
<polygon points="743,82 731,86 731,77" style="fill:rgb(0,0,0)"/>
<path d="M720,82L737,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M758,97A15 15 0 0 0 773 82A15 15 0 0 0 758 67A15 15 0 0 0 743 82A15 15 0 0 0 758 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="758" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="814,17 803,21 803,12" style="fill:rgb(0,0,0)"/>
<path d="M773,82 L 780,82 Q 788,82 788,67 L 788,32 Q 788,17 798,17 L 809,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="818" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="540,44 528,48 528,40" style="fill:rgb(0,0,0)"/>
<path d="M498,17 L 506,17 Q 513,17 513,30 Q 513,44 524,44 L 534,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M555,59A15 15 0 0 0 570 44L570,44A15 15 0 0 0 555 29A15 15 0 0 0 540 44L540,44A15 15 0 0 0 555 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="555" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">=</text>
<polygon points="593,44 582,48 582,40" style="fill:rgb(0,0,0)"/>
<path d="M570,44L587,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M593,59L720,59L720,29L593,29Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="656" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">pragma-value</text>
<polygon points="773,44 761,48 761,40" style="fill:rgb(0,0,0)"/>
<path d="M720,44L767,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M773,44 L 780,44 Q 788,44 788,36 L 788,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="656,17 645,21 645,12" style="fill:rgb(0,0,0)"/>
<path d="M498,17L651,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M656,17L803,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,44 207,48 207,40" style="fill:rgb(0,0,0)"/>
<path d="M119,17 L 126,17 Q 134,17 134,30 Q 134,44 149,44 L 198,44 L 213,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M218,44 L 335,44 Q 350,44 350,30 Q 350,17 357,17 L 365,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./pragma-value.html'>pragma-value</a><br></br>
See also:&nbsp;&nbsp; <a href='../pragma.html'>pragma.html</a>
</div>



Added Doc/Extra/Core/syntax/pragma-value.html.

















































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: pragma-value</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>pragma-value</h1>
<div class='imgcontainer'>
<div style="max-width:264px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 264.499 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="63,17 51,21 51,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L57,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M63,32L201,32L201,2L63,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="255,17 243,21 243,12" style="fill:rgb(0,0,0)"/>
<path d="M201,17L249,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="258" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M78,70L105,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 105 39L78,39A15 15 0 0 0 63 55L63,55A15 15 0 0 0 78 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<path d="M78,108L171,108A15 15 0 0 0 186 92A15 15 0 0 0 171 77L78,77A15 15 0 0 0 63 92A15 15 0 0 0 78 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-literal</text>
<polygon points="63,92 51,97 51,88" style="fill:rgb(0,0,0)"/>
<path d="M21,17 L 29,17 Q 36,17 36,32 L 36,77 Q 36,92 47,92 L 57,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="201,92 189,97 189,88" style="fill:rgb(0,0,0)"/>
<path d="M186,92L195,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M201,92 L 208,92 Q 216,92 216,77 L 216,32 Q 216,17 223,17 L 231,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="201,55 189,59 189,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L195,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M201,55 L 208,55 Q 216,55 216,47 L 216,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="63,55 51,59 51,50" style="fill:rgb(0,0,0)"/>
<path d="M36,39 L 36,47 Q 36,55 47,55 L 57,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./pragma-stmt.html'>pragma-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./signed-number.html'>signed-number</a><br></br>
See also:&nbsp;&nbsp; <a href='../pragma.html'>pragma.html</a>
</div>



Added Doc/Extra/Core/syntax/qualified-table-name.html.































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: qualified-table-name</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>qualified-table-name</h1>
<div class='imgcontainer'>
<div style="max-width:599px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 599.746 182.736">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L156,32A15 15 0 0 0 171 17A15 15 0 0 0 156 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,17 183,21 183,12" style="fill:rgb(0,0,0)"/>
<path d="M171,17L189,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,32A15 15 0 0 0 225 17A15 15 0 0 0 210 2A15 15 0 0 0 195 17A15 15 0 0 0 210 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,17 249,21 249,12" style="fill:rgb(0,0,0)"/>
<path d="M225,17L255,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,32L351,32A15 15 0 0 0 366 17A15 15 0 0 0 351 2L276,2A15 15 0 0 0 261 17A15 15 0 0 0 276 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="408,44 396,48 396,40" style="fill:rgb(0,0,0)"/>
<path d="M366,17 L 374,17 Q 381,17 381,30 Q 381,44 392,44 L 402,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,59L427,59A15 15 0 0 0 442 44L442,44A15 15 0 0 0 427 29L423,29A15 15 0 0 0 408 44L408,44A15 15 0 0 0 423 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="465,44 453,48 453,40" style="fill:rgb(0,0,0)"/>
<path d="M442,44L459,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,59L501,59A15 15 0 0 0 516 44L516,44A15 15 0 0 0 501 29L480,29A15 15 0 0 0 465 44L465,44A15 15 0 0 0 480 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="490" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">alias</text>
<polygon points="539,44 527,48 527,40" style="fill:rgb(0,0,0)"/>
<path d="M516,44L533,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,44 L 546,44 Q 554,44 554,51 L 554,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="453,17 442,21 442,12" style="fill:rgb(0,0,0)"/>
<path d="M366,17L448,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,44 97,48 97,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 39,44 L 87,44 L 102,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M108,44 L 225,44 Q 240,44 240,30 Q 240,17 247,17 L 255,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,142L301,142A15 15 0 0 0 316 127A15 15 0 0 0 301 112L236,112A15 15 0 0 0 221 127A15 15 0 0 0 236 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="339,127 327,131 327,123" style="fill:rgb(0,0,0)"/>
<path d="M316,127L333,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,142L358,142A15 15 0 0 0 373 127A15 15 0 0 0 358 112L354,112A15 15 0 0 0 339 127A15 15 0 0 0 354 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="396,127 385,131 385,123" style="fill:rgb(0,0,0)"/>
<path d="M373,127L390,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M411,142L490,142A15 15 0 0 0 505 127A15 15 0 0 0 490 112L411,112A15 15 0 0 0 396 127A15 15 0 0 0 411 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="451" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M236,180L256,180A15 15 0 0 0 271 165A15 15 0 0 0 256 150L236,150A15 15 0 0 0 221 165A15 15 0 0 0 236 180Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="165" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="294,165 283,169 283,161" style="fill:rgb(0,0,0)"/>
<path d="M271,165L289,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,180L374,180A15 15 0 0 0 389 165A15 15 0 0 0 374 150L310,150A15 15 0 0 0 294 165A15 15 0 0 0 310 180Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="342" y="165" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="554,74 550,62 558,62" style="fill:rgb(0,0,0)"/>
<path d="M453,17 L 539,17 Q 554,17 554,32 L 554,53 L 554,68"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 325,85 325,94" style="fill:rgb(0,0,0)"/>
<path d="M554,74 L 554,82 Q 554,89 539,89 L 334,89 L 319,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="221,127 210,131 210,123" style="fill:rgb(0,0,0)"/>
<path d="M313,89 L 210,89 Q 195,89 195,104 L 195,112 Q 195,127 205,127 L 215,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="221,165 210,169 210,161" style="fill:rgb(0,0,0)"/>
<path d="M195,112 L 195,150 Q 195,165 205,165 L 215,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="554,114 550,102 558,102" style="fill:rgb(0,0,0)"/>
<path d="M554,74L554,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="590,165 578,169 578,161" style="fill:rgb(0,0,0)"/>
<path d="M554,114 L 554,150 Q 554,165 569,165 L 569,165 L 584,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="593" cy="165" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="539,127 527,131 527,123" style="fill:rgb(0,0,0)"/>
<path d="M505,127L533,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,127 L 546,127 Q 554,127 554,135 L 554,142"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M389,165L578,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./delete-stmt.html'>delete-stmt</a>&nbsp;&nbsp; <a href='./delete-stmt-limited.html'>delete-stmt-limited</a>&nbsp;&nbsp; <a href='./update-stmt.html'>update-stmt</a>&nbsp;&nbsp; <a href='./update-stmt-limited.html'>update-stmt-limited</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_indexedby.html'>lang_indexedby.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>
</div>



Added Doc/Extra/Core/syntax/raise-function.html.





































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: raise-function</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>raise-function</h1>
<div class='imgcontainer'>
<div style="max-width:627px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 627.302 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L82,32A15 15 0 0 0 97 17A15 15 0 0 0 82 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RAISE</text>
<polygon points="120,17 109,21 109,12" style="fill:rgb(0,0,0)"/>
<path d="M97,17L114,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,32L135,32A15 15 0 0 0 150 17A15 15 0 0 0 135 2L135,2A15 15 0 0 0 120 17A15 15 0 0 0 135 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="135" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="192,55 180,59 180,50" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 158,17 Q 165,17 165,32 L 165,40 Q 165,55 176,55 L 186,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,70L285,70A15 15 0 0 0 300 55L300,55A15 15 0 0 0 285 39L207,39A15 15 0 0 0 192 55L192,55A15 15 0 0 0 207 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="336,55 324,59 324,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70A15 15 0 0 0 366 55L366,55A15 15 0 0 0 351 39A15 15 0 0 0 336 55L336,55A15 15 0 0 0 351 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="389,55 378,59 378,50" style="fill:rgb(0,0,0)"/>
<path d="M366,55L383,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,70L508,70A15 15 0 0 0 523 55L523,55A15 15 0 0 0 508 39L404,39A15 15 0 0 0 389 55L389,55A15 15 0 0 0 404 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="456" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">error-message</text>
<polygon points="564,17 553,21 553,12" style="fill:rgb(0,0,0)"/>
<path d="M523,55 L 530,55 Q 538,55 538,40 L 538,32 Q 538,17 548,17 L 558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M579,32A15 15 0 0 0 594 17A15 15 0 0 0 579 2A15 15 0 0 0 564 17A15 15 0 0 0 579 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="617,17 606,21 606,12" style="fill:rgb(0,0,0)"/>
<path d="M594,17L612,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="621" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L259,32A15 15 0 0 0 274 17A15 15 0 0 0 259 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="456,17 444,21 444,12" style="fill:rgb(0,0,0)"/>
<path d="M274,17L450,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,17L553,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,108L249,108A15 15 0 0 0 264 92A15 15 0 0 0 249 77L207,77A15 15 0 0 0 192 92A15 15 0 0 0 207 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="300,92 288,97 288,88" style="fill:rgb(0,0,0)"/>
<path d="M264,92L294,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,92 L 307,92 Q 315,92 315,77 L 315,70 Q 315,55 322,55 L 330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,145L229,145A15 15 0 0 0 244 130A15 15 0 0 0 229 115L207,115A15 15 0 0 0 192 130A15 15 0 0 0 207 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="300,130 288,135 288,126" style="fill:rgb(0,0,0)"/>
<path d="M244,130L294,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,130 L 307,130 Q 315,130 315,115 L 315,92 L 315,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,130 180,135 180,126" style="fill:rgb(0,0,0)"/>
<path d="M165,39 L 165,115 Q 165,130 176,130 L 186,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,92 180,97 180,88" style="fill:rgb(0,0,0)"/>
<path d="M165,77 L 165,85 Q 165,92 176,92 L 186,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./expr.html'>expr</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_aggfunc.html'>lang_aggfunc.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_attach.html'>lang_attach.html</a>&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_createview.html'>lang_createview.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_returning.html'>lang_returning.html</a>&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>
</div>



Added Doc/Extra/Core/syntax/recursive-cte.html.





















































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: recursive-cte</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>recursive-cte</h1>
<div class='imgcontainer'>
<div style="max-width:874px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 874.291 72.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L169,32L169,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="100" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">cte-table-name</text>
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M169,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L211,32A15 15 0 0 0 226 17A15 15 0 0 0 211 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="249,17 237,21 237,12" style="fill:rgb(0,0,0)"/>
<path d="M226,17L243,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M264,32A15 15 0 0 0 279 17A15 15 0 0 0 264 2A15 15 0 0 0 249 17A15 15 0 0 0 264 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="302,17 291,21 291,12" style="fill:rgb(0,0,0)"/>
<path d="M279,17L296,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,32L403,32A15 15 0 0 0 418 17A15 15 0 0 0 403 2L317,2A15 15 0 0 0 302 17A15 15 0 0 0 317 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">initial-select</text>
<polygon points="459,55 448,59 448,50" style="fill:rgb(0,0,0)"/>
<path d="M418,17 L 425,17 Q 433,17 433,32 L 433,40 Q 433,55 443,55 L 454,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M474,70L518,70A15 15 0 0 0 533 55L533,55A15 15 0 0 0 518 39L474,39A15 15 0 0 0 459 55L459,55A15 15 0 0 0 474 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="496" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<polygon points="556,55 545,59 545,50" style="fill:rgb(0,0,0)"/>
<path d="M533,55L550,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M571,70L586,70A15 15 0 0 0 601 55L601,55A15 15 0 0 0 586 39L571,39A15 15 0 0 0 556 55L556,55A15 15 0 0 0 571 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="643,17 631,21 631,12" style="fill:rgb(0,0,0)"/>
<path d="M601,55 L 609,55 Q 616,55 616,40 L 616,32 Q 616,17 627,17 L 637,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M658,32L773,32A15 15 0 0 0 788 17A15 15 0 0 0 773 2L658,2A15 15 0 0 0 643 17A15 15 0 0 0 658 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="715" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">recursive-select</text>
<polygon points="811,17 800,21 800,12" style="fill:rgb(0,0,0)"/>
<path d="M788,17L805,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M826,32A15 15 0 0 0 841 17A15 15 0 0 0 826 2A15 15 0 0 0 811 17A15 15 0 0 0 826 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="826" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="864,17 853,21 853,12" style="fill:rgb(0,0,0)"/>
<path d="M841,17L859,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="868" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="459,17 448,21 448,12" style="fill:rgb(0,0,0)"/>
<path d="M418,17L454,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M474,32L518,32A15 15 0 0 0 533 17A15 15 0 0 0 518 2L474,2A15 15 0 0 0 459 17A15 15 0 0 0 474 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="496" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M533,17L631,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>
<br></br>
References:&nbsp;&nbsp; <a href='./cte-table-name.html'>cte-table-name</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>
</div>



Added Doc/Extra/Core/syntax/reindex-stmt.html.



























































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: reindex-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>reindex-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:619px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 619.286 137.376">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L111,32A15 15 0 0 0 126 17A15 15 0 0 0 111 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="79" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REINDEX</text>
<polygon points="167,82 156,86 156,77" style="fill:rgb(0,0,0)"/>
<path d="M126,17 L 133,17 Q 141,17 141,32 L 141,67 Q 141,82 151,82 L 162,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M182,97L279,97A15 15 0 0 0 294 82A15 15 0 0 0 279 67L182,67A15 15 0 0 0 167 82A15 15 0 0 0 182 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="317,82 305,86 305,77" style="fill:rgb(0,0,0)"/>
<path d="M294,82L311,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M332,97A15 15 0 0 0 347 82A15 15 0 0 0 332 67A15 15 0 0 0 317 82A15 15 0 0 0 332 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="383,82 372,86 372,77" style="fill:rgb(0,0,0)"/>
<path d="M347,82L377,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="425,120 413,124 413,115" style="fill:rgb(0,0,0)"/>
<path d="M383,82 L 391,82 Q 398,82 398,97 L 398,105 Q 398,120 409,120 L 419,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M440,135L518,135A15 15 0 0 0 533 120A15 15 0 0 0 518 104L440,104A15 15 0 0 0 425 120A15 15 0 0 0 440 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="479" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<polygon points="568,120 556,124 556,115" style="fill:rgb(0,0,0)"/>
<path d="M533,120L562,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,17 598,21 598,12" style="fill:rgb(0,0,0)"/>
<path d="M568,120 L 575,120 Q 583,120 583,105 L 583,32 Q 583,17 593,17 L 604,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="613" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="425,82 413,86 413,77" style="fill:rgb(0,0,0)"/>
<path d="M383,82L419,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M440,97L515,97A15 15 0 0 0 530 82A15 15 0 0 0 515 67L440,67A15 15 0 0 0 425 82A15 15 0 0 0 440 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="568,82 556,86 556,77" style="fill:rgb(0,0,0)"/>
<path d="M530,82L562,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M568,82 L 575,82 Q 583,82 583,74 L 583,67"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="383,17 372,21 372,12" style="fill:rgb(0,0,0)"/>
<path d="M126,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M383,17L598,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="167,44 156,48 156,40" style="fill:rgb(0,0,0)"/>
<path d="M126,17 L 133,17 Q 141,17 141,30 Q 141,44 151,44 L 162,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M182,59L288,59A15 15 0 0 0 303 44L303,44A15 15 0 0 0 288 29L182,29A15 15 0 0 0 167 44L167,44A15 15 0 0 0 182 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="235" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="568,44 556,48 556,40" style="fill:rgb(0,0,0)"/>
<path d="M303,44L562,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M568,44 L 575,44 Q 583,44 583,36 L 583,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,120 219,124 219,115" style="fill:rgb(0,0,0)"/>
<path d="M141,67 L 141,105 Q 141,120 156,120 L 210,120 L 225,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M231,120 L 347,120 Q 362,120 362,105 L 362,97 Q 362,82 370,82 L 377,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_reindex.html'>lang_reindex.html</a>
</div>



Added Doc/Extra/Core/syntax/release-stmt.html.









































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: release-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>release-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:488px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 488.736 54">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L111,32A15 15 0 0 0 126 17A15 15 0 0 0 111 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="79" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RELEASE</text>
<polygon points="162,17 150,21 150,12" style="fill:rgb(0,0,0)"/>
<path d="M126,17L156,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M177,32L261,32A15 15 0 0 0 276 17A15 15 0 0 0 261 2L177,2A15 15 0 0 0 162 17A15 15 0 0 0 177 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SAVEPOINT</text>
<polygon points="312,17 301,21 301,12" style="fill:rgb(0,0,0)"/>
<path d="M276,17L306,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M327,32L441,32A15 15 0 0 0 456 17A15 15 0 0 0 441 2L327,2A15 15 0 0 0 312 17A15 15 0 0 0 327 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">savepoint-name</text>
<polygon points="479,17 467,21 467,12" style="fill:rgb(0,0,0)"/>
<path d="M456,17L473,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="482" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="219,47 207,51 207,43" style="fill:rgb(0,0,0)"/>
<path d="M126,17 L 133,17 Q 141,17 141,32 L 141,32 Q 141,47 156,47 L 198,47 L 213,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,47 L 276,47 Q 291,47 291,32 L 291,32 Q 291,17 299,17 L 306,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_savepoint.html'>lang_savepoint.html</a>
</div>



Added Doc/Extra/Core/syntax/result-column.html.

































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: result-column</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>result-column</h1>
<div class='imgcontainer'>
<div style="max-width:398px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 398.054 163.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L94,32L94,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="136,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M94,17 L 102,17 Q 109,17 109,32 L 109,40 Q 109,55 119,55 L 130,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M151,70L155,70A15 15 0 0 0 170 55L170,55A15 15 0 0 0 155 39L151,39A15 15 0 0 0 136 55L136,55A15 15 0 0 0 151 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="206,55 194,59 194,50" style="fill:rgb(0,0,0)"/>
<path d="M170,55L200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,70L309,70A15 15 0 0 0 324 55L324,55A15 15 0 0 0 309 39L221,39A15 15 0 0 0 206 55L206,55A15 15 0 0 0 221 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="347,55 335,59 335,50" style="fill:rgb(0,0,0)"/>
<path d="M324,55L341,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,17 377,21 377,12" style="fill:rgb(0,0,0)"/>
<path d="M347,55 L 354,55 Q 362,55 362,40 L 362,32 Q 362,17 372,17 L 382,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="392" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,85 141,89 141,81" style="fill:rgb(0,0,0)"/>
<path d="M109,39 L 109,70 Q 109,85 124,85 L 132,85 L 147,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,85 L 170,85 Q 185,85 185,70 L 185,70 Q 185,55 192,55 L 200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="241,17 230,21 230,12" style="fill:rgb(0,0,0)"/>
<path d="M94,17L235,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M241,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,108 39,112 39,103" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,93 Q 24,108 34,108 L 45,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,123A15 15 0 0 0 81 108A15 15 0 0 0 66 92A15 15 0 0 0 50 108A15 15 0 0 0 66 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="108" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,108 335,112 335,103" style="fill:rgb(0,0,0)"/>
<path d="M81,108L341,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,108 L 354,108 Q 362,108 362,93 L 362,54 L 362,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,145 39,150 39,141" style="fill:rgb(0,0,0)"/>
<path d="M24,92 L 24,130 Q 24,145 34,145 L 45,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,160L141,160A15 15 0 0 0 156 145A15 15 0 0 0 141 130L66,130A15 15 0 0 0 50 145A15 15 0 0 0 66 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="145" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="179,145 167,150 167,141" style="fill:rgb(0,0,0)"/>
<path d="M156,145L173,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M194,160A15 15 0 0 0 209 145A15 15 0 0 0 194 130A15 15 0 0 0 179 145A15 15 0 0 0 194 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="232,145 221,150 221,141" style="fill:rgb(0,0,0)"/>
<path d="M209,145L226,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,160A15 15 0 0 0 262 145A15 15 0 0 0 247 130A15 15 0 0 0 232 145A15 15 0 0 0 247 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,145 335,150 335,141" style="fill:rgb(0,0,0)"/>
<path d="M262,145L341,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,145 L 354,145 Q 362,145 362,130 L 362,107 L 362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./select-core.html'>select-core</a>&nbsp;&nbsp; <a href='./select-stmt.html'>select-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./expr.html'>expr</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_aggfunc.html'>lang_aggfunc.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_attach.html'>lang_attach.html</a>&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_createview.html'>lang_createview.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_returning.html'>lang_returning.html</a>&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>
</div>



Added Doc/Extra/Core/syntax/returning-clause.html.



























































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: returning-clause</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>returning-clause</h1>
<div class='imgcontainer'>
<div style="max-width:628px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 628.709 140.4">
<circle cx="5" cy="47" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="27,47 15,51 15,43" style="fill:rgb(0,0,0)"/>
<path d="M9,47L21,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M42,62L132,62A15 15 0 0 0 147 47A15 15 0 0 0 132 32L42,32A15 15 0 0 0 27 47A15 15 0 0 0 42 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RETURNING</text>
<polygon points="237,47 226,51 226,43" style="fill:rgb(0,0,0)"/>
<path d="M147,47L232,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M237,62L287,62L287,32L237,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="262" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="328,77 317,82 317,73" style="fill:rgb(0,0,0)"/>
<path d="M287,47 L 294,47 Q 302,47 302,62 L 302,62 Q 302,77 312,77 L 322,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M343,92L347,92A15 15 0 0 0 362 77L362,77A15 15 0 0 0 347 62L343,62A15 15 0 0 0 328 77L328,77A15 15 0 0 0 343 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="398,77 387,82 387,73" style="fill:rgb(0,0,0)"/>
<path d="M362,77L393,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M414,92L501,92A15 15 0 0 0 516 77L516,77A15 15 0 0 0 501 62L414,62A15 15 0 0 0 398 77L398,77A15 15 0 0 0 414 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="457" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="539,77 528,82 528,73" style="fill:rgb(0,0,0)"/>
<path d="M516,77L534,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="581,47 569,51 569,43" style="fill:rgb(0,0,0)"/>
<path d="M539,77 L 547,77 Q 554,77 554,62 L 554,62 Q 554,47 565,47 L 575,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="619,47 607,51 607,43" style="fill:rgb(0,0,0)"/>
<path d="M581,47L613,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="622" cy="47" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="345,101 334,106 334,97" style="fill:rgb(0,0,0)"/>
<path d="M302,62 L 302,86 Q 302,101 317,101 L 325,101 L 340,101"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,101 L 362,101 Q 377,101 377,89 Q 377,77 385,77 L 392,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="453,47 441,51 441,43" style="fill:rgb(0,0,0)"/>
<path d="M287,47L447,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,47L607,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,138A15 15 0 0 0 406 123A15 15 0 0 0 391 108A15 15 0 0 0 376 123A15 15 0 0 0 391 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="391" y="123" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="376,123 365,127 365,118" style="fill:rgb(0,0,0)"/>
<path d="M147,47 L 196,47 Q 211,47 211,62 L 211,108 Q 211,123 226,123 L 355,123 L 370,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="539,123 528,127 528,118" style="fill:rgb(0,0,0)"/>
<path d="M406,123L534,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,123 L 547,123 Q 554,123 554,108 L 554,77 L 554,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,32A15 15 0 0 0 406 17A15 15 0 0 0 391 2A15 15 0 0 0 376 17A15 15 0 0 0 391 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="391" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="406,17 418,12 418,21" style="fill:rgb(0,0,0)"/>
<path d="M581,47 L 588,47 Q 596,47 596,32 L 596,32 Q 596,17 581,17 L 427,17 L 412,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="186,47 174,51 174,43" style="fill:rgb(0,0,0)"/>
<path d="M376,17 L 174,17 Q 159,17 159,32 L 159,32 Q 159,47 169,47 L 180,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./delete-stmt.html'>delete-stmt</a>&nbsp;&nbsp; <a href='./delete-stmt-limited.html'>delete-stmt-limited</a>&nbsp;&nbsp; <a href='./insert-stmt.html'>insert-stmt</a>&nbsp;&nbsp; <a href='./update-stmt.html'>update-stmt</a>&nbsp;&nbsp; <a href='./update-stmt-limited.html'>update-stmt-limited</a><br></br>
References:&nbsp;&nbsp; <a href='./expr.html'>expr</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_returning.html'>lang_returning.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>
</div>



Added Doc/Extra/Core/syntax/rollback-stmt.html.





































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: rollback-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>rollback-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:801px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 801.734 67.392">
<circle cx="5" cy="33" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,33 20,38 20,29" style="fill:rgb(0,0,0)"/>
<path d="M9,33L26,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,48L125,48A15 15 0 0 0 140 33A15 15 0 0 0 125 18L47,18A15 15 0 0 0 32 33A15 15 0 0 0 47 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="86" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="176,33 164,38 164,29" style="fill:rgb(0,0,0)"/>
<path d="M140,33L170,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M191,48L303,48A15 15 0 0 0 318 33A15 15 0 0 0 303 18L191,18A15 15 0 0 0 176 33A15 15 0 0 0 191 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRANSACTION</text>
<polygon points="390,33 378,38 378,29" style="fill:rgb(0,0,0)"/>
<path d="M318,33L384,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M405,48L411,48A15 15 0 0 0 426 33A15 15 0 0 0 411 18L405,18A15 15 0 0 0 390 33A15 15 0 0 0 405 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="408" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TO</text>
<polygon points="462,33 450,38 450,29" style="fill:rgb(0,0,0)"/>
<path d="M426,33L456,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,48L561,48A15 15 0 0 0 576 33A15 15 0 0 0 561 18L477,18A15 15 0 0 0 462 33A15 15 0 0 0 477 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SAVEPOINT</text>
<polygon points="612,33 601,38 601,29" style="fill:rgb(0,0,0)"/>
<path d="M576,33L606,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M627,48L741,48A15 15 0 0 0 756 33A15 15 0 0 0 741 18L627,18A15 15 0 0 0 612 33A15 15 0 0 0 627 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="684" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">savepoint-name</text>
<polygon points="792,33 780,38 780,29" style="fill:rgb(0,0,0)"/>
<path d="M756,33L786,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="795" cy="33" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,6 507,10 507,2" style="fill:rgb(0,0,0)"/>
<path d="M426,33 L 433,33 Q 441,33 441,20 Q 441,6 456,6 L 498,6 L 513,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,6 L 576,6 Q 591,6 591,20 Q 591,33 599,33 L 606,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,60 507,65 507,56" style="fill:rgb(0,0,0)"/>
<path d="M352,33 L 359,33 Q 367,33 367,47 Q 367,60 382,60 L 498,60 L 513,60"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,60 L 756,60 Q 771,60 771,47 Q 771,33 778,33 L 786,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="247,60 235,65 235,56" style="fill:rgb(0,0,0)"/>
<path d="M140,33 L 147,33 Q 155,33 155,47 Q 155,60 170,60 L 226,60 L 241,60"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,60 L 318,60 Q 333,60 333,47 Q 333,33 340,33 L 348,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_savepoint.html'>lang_savepoint.html</a>&nbsp;&nbsp; <a href='../lang_transaction.html'>lang_transaction.html</a>
</div>



Added Doc/Extra/Core/syntax/savepoint-stmt.html.



























































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: savepoint-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>savepoint-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:346px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 346.003 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L131,32A15 15 0 0 0 146 17A15 15 0 0 0 131 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="89" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SAVEPOINT</text>
<polygon points="169,17 158,21 158,12" style="fill:rgb(0,0,0)"/>
<path d="M146,17L164,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M185,32L298,32A15 15 0 0 0 313 17A15 15 0 0 0 298 2L185,2A15 15 0 0 0 169 17A15 15 0 0 0 185 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="241" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">savepoint-name</text>
<polygon points="336,17 325,21 325,12" style="fill:rgb(0,0,0)"/>
<path d="M313,17L330,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="340" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_savepoint.html'>lang_savepoint.html</a>
</div>



Added Doc/Extra/Core/syntax/select-core.html.





























































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: select-core</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>select-core</h1>
<div class='imgcontainer'>
<div style="max-width:655px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 655.157 728.568">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="63,17 51,21 51,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L57,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M78,32L129,32A15 15 0 0 0 144 17A15 15 0 0 0 129 2L78,2A15 15 0 0 0 63 17A15 15 0 0 0 78 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="104" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="186,47 174,51 174,43" style="fill:rgb(0,0,0)"/>
<path d="M144,17 L 152,17 Q 159,17 159,32 L 159,32 Q 159,47 170,47 L 180,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M201,62L269,62A15 15 0 0 0 284 47L284,47A15 15 0 0 0 269 32L201,32A15 15 0 0 0 186 47L186,47A15 15 0 0 0 201 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="235" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="353,17 342,21 342,12" style="fill:rgb(0,0,0)"/>
<path d="M284,47 L 292,47 Q 299,47 299,32 L 299,32 Q 299,17 314,17 L 333,17 L 348,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M353,32L481,32L481,2L353,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M417,70A15 15 0 0 0 432 55L432,55A15 15 0 0 0 417 39A15 15 0 0 0 402 55L402,55A15 15 0 0 0 417 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="432,55 444,50 444,59" style="fill:rgb(0,0,0)"/>
<path d="M481,17 L 488,17 Q 496,17 496,32 L 496,40 Q 496,55 481,55 L 453,55 L 438,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M402,55 L 342,55 Q 327,55 327,40 L 327,32 Q 327,17 334,17 L 342,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="235,17 224,21 224,12" style="fill:rgb(0,0,0)"/>
<path d="M144,17L229,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M235,17L342,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M201,100L216,100A15 15 0 0 0 231 85A15 15 0 0 0 216 70L201,70A15 15 0 0 0 186 85A15 15 0 0 0 201 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="208" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="284,85 273,89 273,81" style="fill:rgb(0,0,0)"/>
<path d="M231,85L279,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,85 L 292,85 Q 299,85 299,70 L 299,47 L 299,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="186,85 174,89 174,81" style="fill:rgb(0,0,0)"/>
<path d="M144,17 L 152,17 Q 159,17 159,32 L 159,70 Q 159,85 170,85 L 180,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,176L139,176A15 15 0 0 0 154 160A15 15 0 0 0 139 145L105,145A15 15 0 0 0 89 160A15 15 0 0 0 105 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="122" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="226,160 215,165 215,156" style="fill:rgb(0,0,0)"/>
<path d="M154,160L221,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M226,176L387,176L387,145L226,145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="307" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M256,250L358,250L358,219L256,219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="307" y="235" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M307,212A15 15 0 0 0 322 197A15 15 0 0 0 307 182A15 15 0 0 0 292 197A15 15 0 0 0 307 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="307" y="197" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="322,197 334,192 334,201" style="fill:rgb(0,0,0)"/>
<path d="M387,160 L 395,160 Q 402,160 402,175 L 402,182 Q 402,197 387,197 L 343,197 L 328,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M292,197 L 215,197 Q 200,197 200,182 L 200,175 Q 200,160 207,160 L 215,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="256,235 244,239 244,230" style="fill:rgb(0,0,0)"/>
<path d="M154,160 L 162,160 Q 169,160 169,175 L 169,220 Q 169,235 184,235 L 235,235 L 250,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="420,201 425,213 416,213" style="fill:rgb(0,0,0)"/>
<path d="M358,235 L 373,235 Q 387,235 402,235 L 405,235 Q 420,235 420,221 L 420,207"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="441,160 430,165 430,156" style="fill:rgb(0,0,0)"/>
<path d="M420,201 L 420,175 Q 420,160 428,160 L 436,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,160 L 432,160 Q 423,160 423,160 Q 423,160 431,160 L 438,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,85 492,73 500,73" style="fill:rgb(0,0,0)"/>
<path d="M481,17 L 488,17 Q 496,17 496,32 L 496,64 L 496,79"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,123 296,118 296,127" style="fill:rgb(0,0,0)"/>
<path d="M496,85 L 496,108 Q 496,123 481,123 L 305,123 L 290,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="89,160 78,165 78,156" style="fill:rgb(0,0,0)"/>
<path d="M284,123 L 78,123 Q 63,123 63,138 L 63,145 Q 63,160 73,160 L 84,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,325L154,325A15 15 0 0 0 169 310A15 15 0 0 0 154 295L105,295A15 15 0 0 0 89 310A15 15 0 0 0 105 325Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="310" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="192,310 181,314 181,306" style="fill:rgb(0,0,0)"/>
<path d="M169,310L186,310"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M192,325L241,325L241,295L192,295Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="217" y="310" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="453,212 449,200 458,200" style="fill:rgb(0,0,0)"/>
<path d="M387,160 L 438,160 Q 453,160 453,175 L 453,191 L 453,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,272 318,268 318,277" style="fill:rgb(0,0,0)"/>
<path d="M453,212 L 453,257 Q 453,272 438,272 L 328,272 L 313,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="89,310 78,314 78,306" style="fill:rgb(0,0,0)"/>
<path d="M307,272 L 78,272 Q 63,272 63,287 L 63,295 Q 63,310 73,310 L 84,310"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="63,212 59,200 67,200" style="fill:rgb(0,0,0)"/>
<path d="M63,145L63,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M63,212L63,295"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,424L148,424A15 15 0 0 0 163 408A15 15 0 0 0 148 393L105,393A15 15 0 0 0 89 408A15 15 0 0 0 105 424Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="126" y="408" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="186,408 175,413 175,404" style="fill:rgb(0,0,0)"/>
<path d="M163,408L180,408"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M201,424L205,424A15 15 0 0 0 220 408A15 15 0 0 0 205 393L201,393A15 15 0 0 0 186 408A15 15 0 0 0 201 424Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="203" y="408" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="256,408 245,413 245,404" style="fill:rgb(0,0,0)"/>
<path d="M220,408L251,408"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,424L306,424L306,393L256,393Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="408" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="388,408 377,413 377,404" style="fill:rgb(0,0,0)"/>
<path d="M306,408L383,408"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,424L456,424A15 15 0 0 0 471 408A15 15 0 0 0 456 393L404,393A15 15 0 0 0 388 408A15 15 0 0 0 404 424Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="430" y="408" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="494,408 483,413 483,404" style="fill:rgb(0,0,0)"/>
<path d="M471,408L488,408"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,424L543,424L543,393L494,393Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="408" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M281,461A15 15 0 0 0 296 446A15 15 0 0 0 281 431A15 15 0 0 0 266 446A15 15 0 0 0 281 461Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="446" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="296,446 308,442 308,451" style="fill:rgb(0,0,0)"/>
<path d="M306,408 L 313,408 Q 321,408 321,423 L 321,431 Q 321,446 311,446 L 302,446"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,446 L 245,446 Q 230,446 230,431 L 230,423 Q 230,408 237,408 L 245,408"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="450,439 439,443 439,434" style="fill:rgb(0,0,0)"/>
<path d="M347,408 L 354,408 Q 362,408 362,423 L 362,424 Q 362,439 377,439 L 430,439 L 445,439"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M450,439 L 543,439 Q 558,439 558,424 L 558,423 Q 558,408 566,408 L 573,408"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="203,378 192,382 192,374" style="fill:rgb(0,0,0)"/>
<path d="M63,348 L 63,363 Q 63,378 78,378 L 183,378 L 198,378"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="347,408 336,413 336,404" style="fill:rgb(0,0,0)"/>
<path d="M203,378 L 306,378 Q 321,378 321,393 L 321,393 Q 321,408 331,408 L 341,408"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="169,348 181,344 181,352" style="fill:rgb(0,0,0)"/>
<path d="M241,310 L 249,310 Q 256,310 256,325 L 256,333 Q 256,348 241,348 L 190,348 L 175,348"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="89,408 78,413 78,404" style="fill:rgb(0,0,0)"/>
<path d="M169,348 L 78,348 Q 63,348 63,363 L 63,393 Q 63,408 73,408 L 84,408"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="63,335 59,323 67,323" style="fill:rgb(0,0,0)"/>
<path d="M63,295L63,329"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M63,335L63,393"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,537L168,537A15 15 0 0 0 183 522A15 15 0 0 0 168 507L105,507A15 15 0 0 0 89 522A15 15 0 0 0 105 537Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="522" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="219,522 208,526 208,517" style="fill:rgb(0,0,0)"/>
<path d="M183,522L213,522"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M234,537L331,537A15 15 0 0 0 346 522A15 15 0 0 0 331 507L234,507A15 15 0 0 0 219 522A15 15 0 0 0 234 537Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="283" y="522" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="369,522 358,526 358,517" style="fill:rgb(0,0,0)"/>
<path d="M346,522L364,522"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,537L388,537A15 15 0 0 0 404 522A15 15 0 0 0 388 507L384,507A15 15 0 0 0 369 522A15 15 0 0 0 384 537Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="386" y="522" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="427,522 415,526 415,517" style="fill:rgb(0,0,0)"/>
<path d="M404,522L421,522"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M427,537L545,537L545,507L427,507Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="486" y="522" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M382,575A15 15 0 0 0 397 560A15 15 0 0 0 382 544A15 15 0 0 0 367 560A15 15 0 0 0 382 575Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="560" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="397,560 409,555 409,564" style="fill:rgb(0,0,0)"/>
<path d="M545,522 L 553,522 Q 560,522 560,537 L 560,545 Q 560,560 545,560 L 418,560 L 403,560"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M367,560 L 208,560 Q 193,560 193,545 L 193,537 Q 193,522 200,522 L 208,522"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="588,446 584,435 593,435" style="fill:rgb(0,0,0)"/>
<path d="M543,408 L 573,408 Q 588,408 588,423 L 588,425 L 588,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,484 318,480 318,488" style="fill:rgb(0,0,0)"/>
<path d="M588,446 L 588,469 Q 588,484 573,484 L 328,484 L 313,484"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="89,522 78,526 78,517" style="fill:rgb(0,0,0)"/>
<path d="M307,484 L 78,484 Q 63,484 63,499 L 63,507 Q 63,522 73,522 L 84,522"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="63,446 59,435 67,435" style="fill:rgb(0,0,0)"/>
<path d="M63,393L63,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,597 295,602 295,593" style="fill:rgb(0,0,0)"/>
<path d="M63,446 L 63,582 Q 63,597 78,597 L 286,597 L 301,597"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="645,597 634,602 634,593" style="fill:rgb(0,0,0)"/>
<path d="M307,597L640,597"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="649" cy="597" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,586 556,574 564,574" style="fill:rgb(0,0,0)"/>
<path d="M560,544L560,580"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M560,586 L 560,592 Q 560,597 568,597 L 575,597"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M78,688L130,688A15 15 0 0 0 145 673A15 15 0 0 0 130 658L78,658A15 15 0 0 0 63 673A15 15 0 0 0 78 688Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="104" y="673" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="181,673 170,677 170,669" style="fill:rgb(0,0,0)"/>
<path d="M145,673L176,673"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,688A15 15 0 0 0 212 673A15 15 0 0 0 197 658A15 15 0 0 0 181 673A15 15 0 0 0 197 688Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="197" y="673" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="248,673 236,677 236,669" style="fill:rgb(0,0,0)"/>
<path d="M212,673L242,673"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,688L297,688L297,658L248,658Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="673" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="333,673 321,677 321,669" style="fill:rgb(0,0,0)"/>
<path d="M297,673L327,673"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,688A15 15 0 0 0 363 673A15 15 0 0 0 348 658A15 15 0 0 0 333 673A15 15 0 0 0 348 688Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="673" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="573,673 562,677 562,669" style="fill:rgb(0,0,0)"/>
<path d="M363,673L568,673"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="588,612 593,624 584,624" style="fill:rgb(0,0,0)"/>
<path d="M573,673 L 581,673 Q 588,673 588,658 L 588,633 L 588,618"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M588,612 L 588,605 Q 588,597 603,597 L 609,597 L 624,597"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,650A15 15 0 0 0 287 635A15 15 0 0 0 272 620A15 15 0 0 0 257 635A15 15 0 0 0 272 650Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="635" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M272,726A15 15 0 0 0 287 711A15 15 0 0 0 272 696A15 15 0 0 0 257 711A15 15 0 0 0 272 726Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="711" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="287,635 299,631 299,640" style="fill:rgb(0,0,0)"/>
<path d="M297,673 L 304,673 Q 312,673 312,658 L 312,650 Q 312,635 303,635 L 293,635"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,635 L 236,635 Q 221,635 221,650 L 221,658 Q 221,673 229,673 L 236,673"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="287,711 299,706 299,715" style="fill:rgb(0,0,0)"/>
<path d="M363,673 L 371,673 Q 378,673 378,688 L 378,696 Q 378,711 363,711 L 308,711 L 293,711"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,711 L 170,711 Q 155,711 155,696 L 155,688 Q 155,673 162,673 L 170,673"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="63,673 51,677 51,669" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,658 Q 24,673 39,673 L 42,673 L 57,673"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./compound-select-stmt.html'>compound-select-stmt</a>&nbsp;&nbsp; <a href='./factored-select-stmt.html'>factored-select-stmt</a>&nbsp;&nbsp; <a href='./simple-select-stmt.html'>simple-select-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./join-clause.html'>join-clause</a>&nbsp;&nbsp; <a href='./result-column.html'>result-column</a>&nbsp;&nbsp; <a href='./table-or-subquery.html'>table-or-subquery</a>&nbsp;&nbsp; <a href='./window-defn.html'>window-defn</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>
</div>



Added Doc/Extra/Core/syntax/select-stmt.html.







































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: select-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>select-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:669px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 669.677 1162.3">
<path d="M55,845L667,845L667,99L55,99Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="6" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="46,17 34,21 34,12" style="fill:rgb(0,0,0)"/>
<path d="M10,17L40,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M61,32L92,32A15 15 0 0 0 107 17A15 15 0 0 0 92 2L61,2A15 15 0 0 0 46 17A15 15 0 0 0 61 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="76" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M167,62L253,62A15 15 0 0 0 268 47L268,47A15 15 0 0 0 253 32L167,32A15 15 0 0 0 152 47L152,47A15 15 0 0 0 167 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="210,17 198,21 198,12" style="fill:rgb(0,0,0)"/>
<path d="M107,17L204,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M210,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M358,32L584,32L584,2L358,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="152,47 140,51 140,43" style="fill:rgb(0,0,0)"/>
<path d="M107,17 L 114,17 Q 122,17 122,32 L 122,32 Q 122,47 134,47 L 146,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="291,47 279,51 279,43" style="fill:rgb(0,0,0)"/>
<path d="M268,47L285,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,47 L 298,47 Q 306,47 306,32 L 306,32 Q 306,17 321,17 L 331,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,70A15 15 0 0 0 486 55L486,55A15 15 0 0 0 471 39A15 15 0 0 0 456 55L456,55A15 15 0 0 0 471 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="486,55 498,50 498,59" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,40 Q 599,55 584,55 L 507,55 L 492,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,55 L 350,55 Q 335,55 335,40 L 335,32 Q 335,17 340,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,83 307,79 307,88" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,68 Q 599,83 584,83 L 316,83 L 301,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,83 L 40,83 Q 25,83 25,98 L 25,113"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="25,47 20,36 29,36" style="fill:rgb(0,0,0)"/>
<path d="M10,17 L 17,17 Q 25,17 25,29 L 25,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="55,129 43,133 43,124" style="fill:rgb(0,0,0)"/>
<path d="M25,47 L 25,114 Q 25,129 37,129 L 49,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,129 115,133 115,124" style="fill:rgb(0,0,0)"/>
<path d="M55,129L121,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,144L193,144A15 15 0 0 0 208 129A15 15 0 0 0 193 114L142,114A15 15 0 0 0 127 129A15 15 0 0 0 142 144Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="250,159 238,163 238,155" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,144 Q 223,159 233,159 L 244,159"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,174L333,174A15 15 0 0 0 348 159A15 15 0 0 0 333 144L265,144A15 15 0 0 0 250 159A15 15 0 0 0 265 174Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="159" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="417,129 406,133 406,124" style="fill:rgb(0,0,0)"/>
<path d="M348,159 L 356,159 Q 363,159 363,144 L 363,144 Q 363,129 378,129 L 396,129 L 411,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,144L545,144L545,114L417,114Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M481,182A15 15 0 0 0 496 166A15 15 0 0 0 481 151A15 15 0 0 0 466 166A15 15 0 0 0 481 182Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="166" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="496,166 508,162 508,171" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,151 Q 560,166 545,166 L 517,166 L 502,166"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M466,166 L 406,166 Q 391,166 391,151 L 391,144 Q 391,129 398,129 L 406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,129 287,133 287,124" style="fill:rgb(0,0,0)"/>
<path d="M208,129L293,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M299,129L406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,212L280,212A15 15 0 0 0 295 197A15 15 0 0 0 280 182L265,182A15 15 0 0 0 250 197A15 15 0 0 0 265 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="197" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="348,197 337,201 337,192" style="fill:rgb(0,0,0)"/>
<path d="M295,197L342,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,197 L 356,197 Q 363,197 363,182 L 363,159 L 363,144"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="250,197 238,201 238,192" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,182 Q 223,197 233,197 L 244,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,287L203,287A15 15 0 0 0 218 272A15 15 0 0 0 203 257L168,257A15 15 0 0 0 153 272A15 15 0 0 0 168 287Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="186" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="290,272 279,277 279,268" style="fill:rgb(0,0,0)"/>
<path d="M218,272L284,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,287L451,287L451,257L290,257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M320,362L422,362L422,331L320,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M371,324A15 15 0 0 0 386 309A15 15 0 0 0 371 293A15 15 0 0 0 356 309A15 15 0 0 0 371 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="386,309 397,304 397,313" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 459,272 Q 466,272 466,287 L 466,294 Q 466,309 451,309 L 407,309 L 392,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M356,309 L 279,309 Q 264,309 264,294 L 264,287 Q 264,272 271,272 L 279,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="320,346 308,351 308,342" style="fill:rgb(0,0,0)"/>
<path d="M218,272 L 226,272 Q 233,272 233,287 L 233,331 Q 233,346 248,346 L 299,346 L 314,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="484,313 488,325 480,325" style="fill:rgb(0,0,0)"/>
<path d="M422,346 L 436,346 Q 451,346 466,346 L 469,346 Q 484,346 484,333 L 484,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,272 494,277 494,268" style="fill:rgb(0,0,0)"/>
<path d="M484,313 L 484,287 Q 484,272 492,272 L 499,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,272 L 496,272 Q 487,272 487,272 Q 487,272 495,272 L 502,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,197 555,185 564,185" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,176 L 560,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,235 360,230 360,239" style="fill:rgb(0,0,0)"/>
<path d="M560,197 L 560,220 Q 560,235 545,235 L 369,235 L 354,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,272 142,277 142,268" style="fill:rgb(0,0,0)"/>
<path d="M348,235 L 142,235 Q 127,235 127,250 L 127,257 Q 127,272 137,272 L 147,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,437L218,437A15 15 0 0 0 233 422A15 15 0 0 0 218 407L168,407A15 15 0 0 0 153 422A15 15 0 0 0 168 437Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="256,422 244,426 244,418" style="fill:rgb(0,0,0)"/>
<path d="M233,422L250,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,437L305,437L305,407L256,407Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="517,324 513,312 521,312" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 502,272 Q 517,272 517,287 L 517,303 L 517,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,384 382,380 382,389" style="fill:rgb(0,0,0)"/>
<path d="M517,324 L 517,369 Q 517,384 502,384 L 391,384 L 376,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,422 142,426 142,418" style="fill:rgb(0,0,0)"/>
<path d="M371,384 L 142,384 Q 127,384 127,399 L 127,407 Q 127,422 137,422 L 147,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,324 122,312 131,312" style="fill:rgb(0,0,0)"/>
<path d="M127,257L127,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,324L127,407"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,535L212,535A15 15 0 0 0 227 520A15 15 0 0 0 212 505L168,505A15 15 0 0 0 153 520A15 15 0 0 0 168 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="250,520 238,525 238,516" style="fill:rgb(0,0,0)"/>
<path d="M227,520L244,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,535L269,535A15 15 0 0 0 284 520A15 15 0 0 0 269 505L265,505A15 15 0 0 0 250 520A15 15 0 0 0 265 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="320,520 309,525 309,516" style="fill:rgb(0,0,0)"/>
<path d="M284,520L314,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,535L369,535L369,505L320,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="452,520 441,525 441,516" style="fill:rgb(0,0,0)"/>
<path d="M369,520L446,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,535L520,535A15 15 0 0 0 535 520A15 15 0 0 0 520 505L467,505A15 15 0 0 0 452 520A15 15 0 0 0 467 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="558,520 546,525 546,516" style="fill:rgb(0,0,0)"/>
<path d="M535,520L552,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,535L607,535L607,505L558,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M345,573A15 15 0 0 0 360 558A15 15 0 0 0 345 543A15 15 0 0 0 330 558A15 15 0 0 0 345 573Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="558" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="360,558 371,554 371,562" style="fill:rgb(0,0,0)"/>
<path d="M369,520 L 377,520 Q 384,520 384,535 L 384,543 Q 384,558 375,558 L 366,558"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,558 L 309,558 Q 294,558 294,543 L 294,535 Q 294,520 301,520 L 309,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="514,551 503,555 503,546" style="fill:rgb(0,0,0)"/>
<path d="M411,520 L 418,520 Q 426,520 426,535 L 426,536 Q 426,551 441,551 L 493,551 L 508,551"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M514,551 L 607,551 Q 622,551 622,536 L 622,535 Q 622,520 630,520 L 637,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,490 256,494 256,486" style="fill:rgb(0,0,0)"/>
<path d="M127,460 L 127,475 Q 127,490 142,490 L 246,490 L 261,490"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,520 399,525 399,516" style="fill:rgb(0,0,0)"/>
<path d="M267,490 L 369,490 Q 384,490 384,505 L 384,505 Q 384,520 395,520 L 405,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,460 244,455 244,464" style="fill:rgb(0,0,0)"/>
<path d="M305,422 L 313,422 Q 320,422 320,437 L 320,445 Q 320,460 305,460 L 254,460 L 239,460"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,520 142,525 142,516" style="fill:rgb(0,0,0)"/>
<path d="M233,460 L 142,460 Q 127,460 127,475 L 127,505 Q 127,520 137,520 L 147,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,447 122,435 131,435" style="fill:rgb(0,0,0)"/>
<path d="M127,407L127,441"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,447L127,505"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,649L232,649A15 15 0 0 0 247 634A15 15 0 0 0 232 619L168,619A15 15 0 0 0 153 634A15 15 0 0 0 168 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="200" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="283,634 271,638 271,629" style="fill:rgb(0,0,0)"/>
<path d="M247,634L277,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,649L395,649A15 15 0 0 0 410 634A15 15 0 0 0 395 619L298,619A15 15 0 0 0 283 634A15 15 0 0 0 298 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="433,634 422,638 422,629" style="fill:rgb(0,0,0)"/>
<path d="M410,634L427,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,649L452,649A15 15 0 0 0 467 634A15 15 0 0 0 452 619L448,619A15 15 0 0 0 433 634A15 15 0 0 0 448 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="450" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="490,634 479,638 479,629" style="fill:rgb(0,0,0)"/>
<path d="M467,634L485,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,649L609,649L609,619L490,619Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="550" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M446,687A15 15 0 0 0 461 671A15 15 0 0 0 446 656A15 15 0 0 0 431 671A15 15 0 0 0 446 687Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="671" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="461,671 472,667 472,676" style="fill:rgb(0,0,0)"/>
<path d="M609,634 L 616,634 Q 624,634 624,649 L 624,656 Q 624,671 609,671 L 482,671 L 467,671"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,671 L 271,671 Q 256,671 256,656 L 256,649 Q 256,634 264,634 L 271,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="624,692 619,680 628,680" style="fill:rgb(0,0,0)"/>
<path d="M624,656L624,686"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,558 648,547 656,547" style="fill:rgb(0,0,0)"/>
<path d="M607,520 L 637,520 Q 652,520 652,535 L 652,537 L 652,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,596 382,592 382,600" style="fill:rgb(0,0,0)"/>
<path d="M652,558 L 652,581 Q 652,596 637,596 L 391,596 L 376,596"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,634 142,638 142,629" style="fill:rgb(0,0,0)"/>
<path d="M371,596 L 142,596 Q 127,596 127,611 L 127,619 Q 127,634 137,634 L 147,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,558 122,547 131,547" style="fill:rgb(0,0,0)"/>
<path d="M127,505L127,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,709 359,714 359,705" style="fill:rgb(0,0,0)"/>
<path d="M127,558 L 127,694 Q 127,709 142,709 L 350,709 L 365,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,709 597,714 597,705" style="fill:rgb(0,0,0)"/>
<path d="M371,709L603,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,709 L 616,709 Q 624,709 624,717 L 624,724"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,800L194,800A15 15 0 0 0 209 785A15 15 0 0 0 194 770L142,770A15 15 0 0 0 127 785A15 15 0 0 0 142 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="245,785 234,789 234,781" style="fill:rgb(0,0,0)"/>
<path d="M209,785L239,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,800A15 15 0 0 0 275 785A15 15 0 0 0 260 770A15 15 0 0 0 245 785A15 15 0 0 0 260 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="311,785 300,789 300,781" style="fill:rgb(0,0,0)"/>
<path d="M275,785L306,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,800L361,800L361,770L311,770Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="397,785 385,789 385,781" style="fill:rgb(0,0,0)"/>
<path d="M361,785L391,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,800A15 15 0 0 0 427 785A15 15 0 0 0 412 770A15 15 0 0 0 397 785A15 15 0 0 0 412 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="412" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="609,785 597,789 597,781" style="fill:rgb(0,0,0)"/>
<path d="M427,785L603,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,785 L 616,785 Q 624,785 624,792 L 624,800"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,762A15 15 0 0 0 351 747A15 15 0 0 0 336 732A15 15 0 0 0 321 747A15 15 0 0 0 336 762Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="747" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M336,838A15 15 0 0 0 351 823A15 15 0 0 0 336 808A15 15 0 0 0 321 823A15 15 0 0 0 336 838Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="823" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="351,747 363,743 363,751" style="fill:rgb(0,0,0)"/>
<path d="M361,785 L 368,785 Q 376,785 376,770 L 376,762 Q 376,747 366,747 L 357,747"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,747 L 300,747 Q 285,747 285,762 L 285,770 Q 285,785 292,785 L 300,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,823 363,818 363,827" style="fill:rgb(0,0,0)"/>
<path d="M427,785 L 434,785 Q 442,785 442,800 L 442,808 Q 442,823 427,823 L 372,823 L 357,823"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,823 L 234,823 Q 219,823 219,808 L 219,800 Q 219,785 226,785 L 234,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,785 115,789 115,781" style="fill:rgb(0,0,0)"/>
<path d="M55,129 L 62,129 Q 70,129 70,144 L 70,770 Q 70,785 85,785 L 106,785 L 121,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,891L424,891L424,860L248,860Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="876" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="424,876 436,871 436,880" style="fill:rgb(0,0,0)"/>
<path d="M624,692 L 624,861 Q 624,876 609,876 L 445,876 L 430,876"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="6,197 10,208 2,208" style="fill:rgb(0,0,0)"/>
<path d="M248,876 L 21,876 Q 6,876 6,861 L 6,217 L 6,202"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M6,197 L 6,144 Q 6,129 21,129 L 40,129 L 55,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="667" y="275" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" transform="rotate(-90 667,285)" dominant-baseline="central">select-core</text>
<path d="M168,966L213,966A15 15 0 0 0 228 951A15 15 0 0 0 213 936L168,936A15 15 0 0 0 153 951A15 15 0 0 0 168 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="251,951 239,956 239,947" style="fill:rgb(0,0,0)"/>
<path d="M228,951L245,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,966L270,966A15 15 0 0 0 285 951A15 15 0 0 0 270 936L266,936A15 15 0 0 0 251 951A15 15 0 0 0 266 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M168,1072L202,1072A15 15 0 0 0 217 1057A15 15 0 0 0 202 1042L168,1042A15 15 0 0 0 153 1057A15 15 0 0 0 168 1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="240,1057 228,1061 228,1053" style="fill:rgb(0,0,0)"/>
<path d="M217,1057L234,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,1072L289,1072L289,1042L240,1042Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="330,951 319,956 319,947" style="fill:rgb(0,0,0)"/>
<path d="M285,951L324,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,966L460,966L460,936L330,936Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M395,1004A15 15 0 0 0 410 989A15 15 0 0 0 395 974A15 15 0 0 0 380 989A15 15 0 0 0 395 1004Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="989" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="410,989 422,985 422,993" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 468,951 Q 475,951 475,966 L 475,974 Q 475,989 460,989 L 431,989 L 416,989"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,989 L 322,989 Q 307,989 307,974 L 307,966 Q 307,951 313,951 L 319,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,913 348,909 348,918" style="fill:rgb(0,0,0)"/>
<path d="M624,860 L 624,898 Q 624,913 609,913 L 357,913 L 342,913"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,951 142,956 142,947" style="fill:rgb(0,0,0)"/>
<path d="M336,913 L 142,913 Q 127,913 127,928 L 127,936 Q 127,951 137,951 L 147,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,981 492,970 500,970" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 481,951 Q 496,951 496,963 L 496,976"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,1023 318,1019 318,1027" style="fill:rgb(0,0,0)"/>
<path d="M496,981 L 496,1008 Q 496,1023 481,1023 L 327,1023 L 312,1023"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,1057 142,1061 142,1053" style="fill:rgb(0,0,0)"/>
<path d="M307,1023 L 142,1023 Q 127,1023 127,1038 L 127,1042 Q 127,1057 137,1057 L 147,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,989 122,978 131,978" style="fill:rgb(0,0,0)"/>
<path d="M127,936L127,983"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,989L127,1042"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1102L415,1102A15 15 0 0 0 430 1087A15 15 0 0 0 415 1072L363,1072A15 15 0 0 0 348 1087A15 15 0 0 0 363 1102Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="389" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="453,1087 441,1092 441,1083" style="fill:rgb(0,0,0)"/>
<path d="M430,1087L447,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,1102L502,1102L502,1072L453,1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="525,1087 513,1092 513,1083" style="fill:rgb(0,0,0)"/>
<path d="M502,1087L519,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1140A15 15 0 0 0 378 1125A15 15 0 0 0 363 1110A15 15 0 0 0 348 1125A15 15 0 0 0 363 1140Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="1125" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="401,1125 390,1129 390,1121" style="fill:rgb(0,0,0)"/>
<path d="M378,1125L396,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,1140L451,1140L451,1110L401,1110Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="1125" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="312,1057 301,1061 301,1053" style="fill:rgb(0,0,0)"/>
<path d="M289,1057L306,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1125 337,1129 337,1121" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1110 Q 327,1125 335,1125 L 342,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1087 337,1092 337,1083" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1072 Q 327,1087 335,1087 L 342,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1057 513,1061 513,1053" style="fill:rgb(0,0,0)"/>
<path d="M312,1057L519,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="620,1155 609,1160 609,1151" style="fill:rgb(0,0,0)"/>
<path d="M525,1057 L 546,1057 Q 561,1057 561,1072 L 561,1140 Q 561,1155 576,1155 L 599,1155 L 614,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="624" cy="1155" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1087 L 546,1087 Q 561,1087 561,1095 L 561,1102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1125 513,1129 513,1121" style="fill:rgb(0,0,0)"/>
<path d="M451,1125L519,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1125 L 546,1125 Q 561,1125 561,1133 L 561,1140"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1155 513,1160 513,1151" style="fill:rgb(0,0,0)"/>
<path d="M127,1042 L 127,1140 Q 127,1155 142,1155 L 504,1155 L 519,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1155L597,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./common-table-expression.html'>common-table-expression</a>&nbsp;&nbsp; <a href='./create-table-stmt.html'>create-table-stmt</a>&nbsp;&nbsp; <a href='./create-trigger-stmt.html'>create-trigger-stmt</a>&nbsp;&nbsp; <a href='./create-view-stmt.html'>create-view-stmt</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./insert-stmt.html'>insert-stmt</a>&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a>&nbsp;&nbsp; <a href='./table-or-subquery.html'>table-or-subquery</a>&nbsp;&nbsp; <a href='./with-clause.html'>with-clause</a><br></br>
References:&nbsp;&nbsp; <a href='./common-table-expression.html'>common-table-expression</a>&nbsp;&nbsp; <a href='./compound-operator.html'>compound-operator</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./join-clause.html'>join-clause</a>&nbsp;&nbsp; <a href='./ordering-term.html'>ordering-term</a>&nbsp;&nbsp; <a href='./result-column.html'>result-column</a>&nbsp;&nbsp; <a href='./table-or-subquery.html'>table-or-subquery</a>&nbsp;&nbsp; <a href='./window-defn.html'>window-defn</a><br></br>
See also:&nbsp;&nbsp; <a href='../changes.html'>changes.html</a>&nbsp;&nbsp; <a href='../lang_aggfunc.html'>lang_aggfunc.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_attach.html'>lang_attach.html</a>&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_createview.html'>lang_createview.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_returning.html'>lang_returning.html</a>&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>&nbsp;&nbsp; <a href='../releaselog/3_35_3.html'>releaselog/3_35_3.html</a>&nbsp;&nbsp; <a href='../releaselog/3_35_4.html'>releaselog/3_35_4.html</a>&nbsp;&nbsp; <a href='../releaselog/3_35_5.html'>releaselog/3_35_5.html</a>
</div>



Added Doc/Extra/Core/syntax/signed-number.html.











































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: signed-number</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>signed-number</h1>
<div class='imgcontainer'>
<div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./column-constraint.html'>column-constraint</a>&nbsp;&nbsp; <a href='./pragma-value.html'>pragma-value</a>&nbsp;&nbsp; <a href='./type-name.html'>type-name</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_aggfunc.html'>lang_aggfunc.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_attach.html'>lang_attach.html</a>&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_createview.html'>lang_createview.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_returning.html'>lang_returning.html</a>&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>&nbsp;&nbsp; <a href='../pragma.html'>pragma.html</a>
</div>



Added Doc/Extra/Core/syntax/simple-function-invocation.html.





































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: simple-function-invocation</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>simple-function-invocation</h1>
<div class='imgcontainer'>
<div style="max-width:414px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 414.49 126.792">
<circle cx="5" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,55 20,59 20,50" style="fill:rgb(0,0,0)"/>
<path d="M9,55L26,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,70L126,70A15 15 0 0 0 141 55A15 15 0 0 0 126 39L47,39A15 15 0 0 0 32 55A15 15 0 0 0 47 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="86" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">simple-func</text>
<polygon points="164,55 152,59 152,50" style="fill:rgb(0,0,0)"/>
<path d="M141,55L158,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,70A15 15 0 0 0 194 55A15 15 0 0 0 179 39A15 15 0 0 0 164 55A15 15 0 0 0 179 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="179" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="248,55 237,59 237,50" style="fill:rgb(0,0,0)"/>
<path d="M194,55L242,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,70L297,70L297,39L248,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="273" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="351,55 340,59 340,50" style="fill:rgb(0,0,0)"/>
<path d="M297,55L346,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,70A15 15 0 0 0 382 55A15 15 0 0 0 366 39A15 15 0 0 0 351 55A15 15 0 0 0 366 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="366" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="405,55 393,59 393,50" style="fill:rgb(0,0,0)"/>
<path d="M382,55L399,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="408" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M273,32A15 15 0 0 0 288 17L288,17A15 15 0 0 0 273 2A15 15 0 0 0 258 17L258,17A15 15 0 0 0 273 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="273" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="288,17 299,12 299,21" style="fill:rgb(0,0,0)"/>
<path d="M297,55 L 305,55 Q 312,55 312,40 L 312,32 Q 312,17 303,17 L 294,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,17 L 237,17 Q 222,17 222,32 L 222,40 Q 222,55 229,55 L 237,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,82 261,86 261,77" style="fill:rgb(0,0,0)"/>
<path d="M194,55 L 202,55 Q 209,55 209,68 Q 209,82 224,82 L 252,82 L 267,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M273,82 L 310,82 Q 325,82 325,68 Q 325,55 332,55 L 340,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M273,124A15 15 0 0 0 288 109A15 15 0 0 0 273 94A15 15 0 0 0 258 109A15 15 0 0 0 273 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="273" y="109" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="258,109 246,113 246,105" style="fill:rgb(0,0,0)"/>
<path d="M194,55 L 202,55 Q 209,55 209,70 L 209,94 Q 209,109 224,109 L 237,109 L 252,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,109 L 310,109 Q 325,109 325,94 L 325,85 L 325,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>
<br></br>
References:&nbsp;&nbsp; <a href='./expr.html'>expr</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_corefunc.html'>lang_corefunc.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>
</div>



Added Doc/Extra/Core/syntax/simple-select-stmt.html.































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: simple-select-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>simple-select-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:629px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 629.266 348.84">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L91,32A15 15 0 0 0 106 17A15 15 0 0 0 91 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M166,62L252,62A15 15 0 0 0 267 47A15 15 0 0 0 252 32L166,32A15 15 0 0 0 151 47A15 15 0 0 0 166 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="209,17 197,21 197,12" style="fill:rgb(0,0,0)"/>
<path d="M106,17L203,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M209,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M357,32L583,32L583,2L357,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="151,47 139,51 139,43" style="fill:rgb(0,0,0)"/>
<path d="M106,17 L 113,17 Q 121,17 121,32 L 121,32 Q 121,47 133,47 L 145,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,47 278,51 278,43" style="fill:rgb(0,0,0)"/>
<path d="M267,47L284,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,47 L 297,47 Q 305,47 305,32 L 305,32 Q 305,17 320,17 L 330,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,70A15 15 0 0 0 485 55L485,55A15 15 0 0 0 470 39A15 15 0 0 0 455 55L455,55A15 15 0 0 0 470 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="485,55 497,50 497,59" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,40 Q 598,55 583,55 L 506,55 L 491,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,55 L 349,55 Q 334,55 334,40 L 334,32 Q 334,17 340,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,153L148,153L148,123L45,123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="97" y="138" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-core</text>
<path d="M205,153L250,153A15 15 0 0 0 265 138A15 15 0 0 0 250 123L205,123A15 15 0 0 0 190 138A15 15 0 0 0 205 153Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="227" y="138" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="288,138 276,142 276,133" style="fill:rgb(0,0,0)"/>
<path d="M265,138L282,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M303,153L307,153A15 15 0 0 0 322 138A15 15 0 0 0 307 123L303,123A15 15 0 0 0 288 138A15 15 0 0 0 303 153Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="305" y="138" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M205,259L239,259A15 15 0 0 0 254 244A15 15 0 0 0 239 228L205,228A15 15 0 0 0 190 244A15 15 0 0 0 205 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="222" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="277,244 265,248 265,239" style="fill:rgb(0,0,0)"/>
<path d="M254,244L271,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M277,259L326,259L326,228L277,228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="301" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="45,138 33,142 33,133" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,123 Q 24,138 31,138 L 39,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="312,92 323,88 323,97" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 604,17 Q 619,17 619,32 L 619,77 Q 619,92 604,92 L 333,92 L 318,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M312,92 L 39,92 Q 24,92 24,100 L 24,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="367,138 356,142 356,133" style="fill:rgb(0,0,0)"/>
<path d="M322,138L361,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M367,153L497,153L497,123L367,123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="138" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M432,191A15 15 0 0 0 447 176A15 15 0 0 0 432 160A15 15 0 0 0 417 176A15 15 0 0 0 432 191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="176" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="447,176 459,171 459,180" style="fill:rgb(0,0,0)"/>
<path d="M497,138 L 504,138 Q 512,138 512,153 L 512,161 Q 512,176 497,176 L 468,176 L 453,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,176 L 359,176 Q 344,176 344,161 L 344,153 Q 344,138 350,138 L 356,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="533,168 529,156 537,156" style="fill:rgb(0,0,0)"/>
<path d="M497,138 L 518,138 Q 533,138 533,150 L 533,162"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="343,210 355,205 355,214" style="fill:rgb(0,0,0)"/>
<path d="M533,168 L 533,195 Q 533,210 518,210 L 364,210 L 349,210"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,244 178,248 178,239" style="fill:rgb(0,0,0)"/>
<path d="M343,210 L 178,210 Q 163,210 163,225 L 163,229 Q 163,244 174,244 L 184,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,138 178,142 178,133" style="fill:rgb(0,0,0)"/>
<path d="M148,138L184,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="163,191 159,179 168,179" style="fill:rgb(0,0,0)"/>
<path d="M148,138 L 156,138 Q 163,138 163,153 L 163,170 L 163,185"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M163,191L163,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M400,289L451,289A15 15 0 0 0 466 274A15 15 0 0 0 451 259L400,259A15 15 0 0 0 385 274A15 15 0 0 0 400 289Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="274" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="490,274 478,278 478,270" style="fill:rgb(0,0,0)"/>
<path d="M466,274L484,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,289L539,289L539,259L490,259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="514" y="274" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="562,274 550,278 550,270" style="fill:rgb(0,0,0)"/>
<path d="M539,274L556,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M400,327A15 15 0 0 0 415 312A15 15 0 0 0 400 297A15 15 0 0 0 385 312A15 15 0 0 0 400 327Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="400" y="312" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="438,312 427,316 427,307" style="fill:rgb(0,0,0)"/>
<path d="M415,312L432,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,327L487,327L487,297L438,297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="463" y="312" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="349,244 337,248 337,239" style="fill:rgb(0,0,0)"/>
<path d="M326,244L343,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="385,312 373,316 373,307" style="fill:rgb(0,0,0)"/>
<path d="M349,244 L 356,244 Q 364,244 364,259 L 364,297 Q 364,312 372,312 L 379,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="385,274 373,278 373,270" style="fill:rgb(0,0,0)"/>
<path d="M349,244 L 356,244 Q 364,244 364,259 L 364,259 Q 364,274 372,274 L 379,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="562,244 550,248 550,239" style="fill:rgb(0,0,0)"/>
<path d="M349,244L556,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="619,342 608,346 608,338" style="fill:rgb(0,0,0)"/>
<path d="M562,244 L 583,244 Q 598,244 598,259 L 598,327 Q 598,342 606,342 L 614,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="623" cy="342" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M562,274 L 583,274 Q 598,274 598,281 L 598,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="562,312 550,316 550,307" style="fill:rgb(0,0,0)"/>
<path d="M487,312L556,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M562,312 L 583,312 Q 598,312 598,319 L 598,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="562,342 550,346 550,338" style="fill:rgb(0,0,0)"/>
<path d="M163,228 L 163,327 Q 163,342 178,342 L 541,342 L 556,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M562,342L608,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>
<br></br>
References:&nbsp;&nbsp; <a href='./common-table-expression.html'>common-table-expression</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./ordering-term.html'>ordering-term</a>&nbsp;&nbsp; <a href='./select-core.html'>select-core</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>
</div>



Added Doc/Extra/Core/syntax/sql-stmt-list.html.







































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: sql-stmt-list</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>sql-stmt-list</h1>
<div class='imgcontainer'>
<div style="max-width:242px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 242.093 88.776">
<circle cx="5" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M9,55L45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="81,55 69,59 69,50" style="fill:rgb(0,0,0)"/>
<path d="M45,55L75,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M81,70L160,70L160,39L81,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="121" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">sql-stmt</text>
<path d="M160,55L196,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="232,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M196,55L226,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="236" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,82 109,86 109,77" style="fill:rgb(0,0,0)"/>
<path d="M45,55 L 52,55 Q 60,55 60,68 Q 60,82 75,82 L 100,82 L 115,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,82 L 155,82 Q 170,82 170,68 Q 170,55 177,55 L 185,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,32A15 15 0 0 0 136 17L136,17A15 15 0 0 0 121 2A15 15 0 0 0 105 17L105,17A15 15 0 0 0 121 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="121" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">;</text>
<polygon points="136,17 147,12 147,21" style="fill:rgb(0,0,0)"/>
<path d="M196,55 L 204,55 Q 211,55 211,40 L 211,32 Q 211,17 196,17 L 156,17 L 141,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,17 L 33,17 Q 18,17 18,32 L 18,40 Q 18,55 26,55 L 33,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>
<br></br>
References:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang.html'>lang.html</a>
</div>



Added Doc/Extra/Core/syntax/sql-stmt.html.









































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: sql-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>sql-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:716px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 716.88 1017.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L125,70A15 15 0 0 0 140 55L140,55A15 15 0 0 0 125 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="95" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXPLAIN</text>
<polygon points="176,55 165,59 165,50" style="fill:rgb(0,0,0)"/>
<path d="M140,55L170,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M191,70L235,70A15 15 0 0 0 250 55L250,55A15 15 0 0 0 235 39L191,39A15 15 0 0 0 176 55L176,55A15 15 0 0 0 191 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="213" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">QUERY</text>
<polygon points="267,55 255,59 255,50" style="fill:rgb(0,0,0)"/>
<path d="M250,55L261,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M282,70L311,70A15 15 0 0 0 327 55L327,55A15 15 0 0 0 311 39L282,39A15 15 0 0 0 267 55L267,55A15 15 0 0 0 282 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="297" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PLAN</text>
<polygon points="368,17 357,21 357,12" style="fill:rgb(0,0,0)"/>
<path d="M327,55 L 334,55 Q 342,55 342,40 L 342,32 Q 342,17 352,17 L 362,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="182,17 170,21 170,12" style="fill:rgb(0,0,0)"/>
<path d="M140,55 L 148,55 Q 155,55 155,40 L 155,32 Q 155,17 166,17 L 176,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M182,17L357,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M9,17L170,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="410,17 398,21 398,12" style="fill:rgb(0,0,0)"/>
<path d="M368,17L404,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,32L552,32L552,2L410,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">alter-table-stmt</text>
<polygon points="666,17 654,21 654,12" style="fill:rgb(0,0,0)"/>
<path d="M552,17L660,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="707,17 696,21 696,12" style="fill:rgb(0,0,0)"/>
<path d="M666,17L701,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="711" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,70L528,70L528,39L410,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">analyze-stmt</text>
<polygon points="410,55 398,59 398,50" style="fill:rgb(0,0,0)"/>
<path d="M383,39 L 383,47 Q 383,55 393,55 L 404,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,55 654,59 654,50" style="fill:rgb(0,0,0)"/>
<path d="M528,55L660,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,55 L 673,55 Q 681,55 681,47 L 681,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,108L517,108L517,77L410,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="463" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">attach-stmt</text>
<polygon points="410,92 398,97 398,88" style="fill:rgb(0,0,0)"/>
<path d="M383,77 L 383,85 Q 383,92 393,92 L 404,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,92 654,97 654,88" style="fill:rgb(0,0,0)"/>
<path d="M517,92L660,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,92 L 673,92 Q 681,92 681,85 L 681,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,145L511,145L511,115L410,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="460" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">begin-stmt</text>
<polygon points="410,130 398,135 398,126" style="fill:rgb(0,0,0)"/>
<path d="M383,115 L 383,123 Q 383,130 393,130 L 404,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,130 654,135 654,126" style="fill:rgb(0,0,0)"/>
<path d="M511,130L660,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,130 L 673,130 Q 681,130 681,123 L 681,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,183L527,183L527,153L410,153Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="468" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">commit-stmt</text>
<polygon points="410,168 398,172 398,164" style="fill:rgb(0,0,0)"/>
<path d="M383,153 L 383,160 Q 383,168 393,168 L 404,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,168 654,172 654,164" style="fill:rgb(0,0,0)"/>
<path d="M527,168L660,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,168 L 673,168 Q 681,168 681,160 L 681,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,221L569,221L569,191L410,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="489" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-index-stmt</text>
<polygon points="410,206 398,210 398,201" style="fill:rgb(0,0,0)"/>
<path d="M383,191 L 383,198 Q 383,206 393,206 L 404,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,206 654,210 654,201" style="fill:rgb(0,0,0)"/>
<path d="M569,206L660,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,206 L 673,206 Q 681,206 681,198 L 681,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,259L566,259L566,228L410,228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-table-stmt</text>
<polygon points="410,244 398,248 398,239" style="fill:rgb(0,0,0)"/>
<path d="M383,228 L 383,236 Q 383,244 393,244 L 404,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,244 654,248 654,239" style="fill:rgb(0,0,0)"/>
<path d="M566,244L660,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,244 L 673,244 Q 681,244 681,236 L 681,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,297L582,297L582,266L410,266Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="496" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-trigger-stmt</text>
<polygon points="410,281 398,286 398,277" style="fill:rgb(0,0,0)"/>
<path d="M383,266 L 383,274 Q 383,281 393,281 L 404,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,281 654,286 654,277" style="fill:rgb(0,0,0)"/>
<path d="M582,281L660,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,281 L 673,281 Q 681,281 681,274 L 681,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,334L561,334L561,304L410,304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="486" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-view-stmt</text>
<polygon points="410,319 398,324 398,315" style="fill:rgb(0,0,0)"/>
<path d="M383,304 L 383,312 Q 383,319 393,319 L 404,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,319 654,324 654,315" style="fill:rgb(0,0,0)"/>
<path d="M561,319L660,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,319 L 673,319 Q 681,319 681,312 L 681,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,372L626,372L626,342L410,342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-virtual-table-stmt</text>
<polygon points="410,357 398,361 398,353" style="fill:rgb(0,0,0)"/>
<path d="M383,342 L 383,349 Q 383,357 393,357 L 404,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,357 654,361 654,353" style="fill:rgb(0,0,0)"/>
<path d="M626,357L660,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,357 L 673,357 Q 681,357 681,349 L 681,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,410L516,410L516,380L410,380Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="463" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">delete-stmt</text>
<polygon points="410,395 398,399 398,390" style="fill:rgb(0,0,0)"/>
<path d="M383,380 L 383,387 Q 383,395 393,395 L 404,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,395 654,399 654,390" style="fill:rgb(0,0,0)"/>
<path d="M516,395L660,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,395 L 673,395 Q 681,395 681,387 L 681,380"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,448L581,448L581,417L410,417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">delete-stmt-limited</text>
<polygon points="410,433 398,437 398,428" style="fill:rgb(0,0,0)"/>
<path d="M383,417 L 383,425 Q 383,433 393,433 L 404,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,433 654,437 654,428" style="fill:rgb(0,0,0)"/>
<path d="M581,433L660,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,433 L 673,433 Q 681,433 681,425 L 681,418"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,486L521,486L521,455L410,455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="465" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">detach-stmt</text>
<polygon points="410,470 398,475 398,466" style="fill:rgb(0,0,0)"/>
<path d="M383,455 L 383,463 Q 383,470 393,470 L 404,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,470 654,475 654,466" style="fill:rgb(0,0,0)"/>
<path d="M521,470L660,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,470 L 673,470 Q 681,470 681,463 L 681,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,523L555,523L555,493L410,493Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="508" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-index-stmt</text>
<polygon points="410,508 398,513 398,504" style="fill:rgb(0,0,0)"/>
<path d="M383,493 L 383,501 Q 383,508 393,508 L 404,508"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,508 654,513 654,504" style="fill:rgb(0,0,0)"/>
<path d="M555,508L660,508"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,508 L 673,508 Q 681,508 681,501 L 681,493"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,561L551,561L551,531L410,531Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="480" y="546" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-table-stmt</text>
<polygon points="410,546 398,550 398,542" style="fill:rgb(0,0,0)"/>
<path d="M383,531 L 383,538 Q 383,546 393,546 L 404,546"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,546 654,550 654,542" style="fill:rgb(0,0,0)"/>
<path d="M551,546L660,546"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,546 L 673,546 Q 681,546 681,538 L 681,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,599L568,599L568,569L410,569Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="489" y="584" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-trigger-stmt</text>
<polygon points="410,584 398,588 398,579" style="fill:rgb(0,0,0)"/>
<path d="M383,569 L 383,576 Q 383,584 393,584 L 404,584"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,584 654,588 654,579" style="fill:rgb(0,0,0)"/>
<path d="M568,584L660,584"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,584 L 673,584 Q 681,584 681,576 L 681,569"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,637L547,637L547,606L410,606Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="622" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-view-stmt</text>
<polygon points="410,622 398,626 398,617" style="fill:rgb(0,0,0)"/>
<path d="M383,606 L 383,614 Q 383,622 393,622 L 404,622"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,622 654,626 654,617" style="fill:rgb(0,0,0)"/>
<path d="M547,622L660,622"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,622 L 673,622 Q 681,622 681,614 L 681,607"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,675L513,675L513,644L410,644Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="659" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">insert-stmt</text>
<polygon points="410,659 398,664 398,655" style="fill:rgb(0,0,0)"/>
<path d="M383,644 L 383,652 Q 383,659 393,659 L 404,659"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,659 654,664 654,655" style="fill:rgb(0,0,0)"/>
<path d="M513,659L660,659"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,659 L 673,659 Q 681,659 681,652 L 681,644"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,712L529,712L529,682L410,682Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="697" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">pragma-stmt</text>
<polygon points="410,697 398,702 398,693" style="fill:rgb(0,0,0)"/>
<path d="M383,682 L 383,690 Q 383,697 393,697 L 404,697"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,697 654,702 654,693" style="fill:rgb(0,0,0)"/>
<path d="M529,697L660,697"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,697 L 673,697 Q 681,697 681,690 L 681,682"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,750L528,750L528,720L410,720Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="735" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">reindex-stmt</text>
<polygon points="410,735 398,739 398,731" style="fill:rgb(0,0,0)"/>
<path d="M383,720 L 383,727 Q 383,735 393,735 L 404,735"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,735 654,739 654,731" style="fill:rgb(0,0,0)"/>
<path d="M528,735L660,735"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,735 L 673,735 Q 681,735 681,727 L 681,720"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,788L526,788L526,758L410,758Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="468" y="773" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">release-stmt</text>
<polygon points="410,773 398,777 398,768" style="fill:rgb(0,0,0)"/>
<path d="M383,758 L 383,765 Q 383,773 393,773 L 404,773"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,773 654,777 654,768" style="fill:rgb(0,0,0)"/>
<path d="M526,773L660,773"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,773 L 673,773 Q 681,773 681,765 L 681,758"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,826L533,826L533,795L410,795Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="811" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">rollback-stmt</text>
<polygon points="410,811 398,815 398,806" style="fill:rgb(0,0,0)"/>
<path d="M383,795 L 383,803 Q 383,811 393,811 L 404,811"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,811 654,815 654,806" style="fill:rgb(0,0,0)"/>
<path d="M533,811L660,811"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,811 L 673,811 Q 681,811 681,803 L 681,796"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,864L545,864L545,833L410,833Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="848" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">savepoint-stmt</text>
<polygon points="410,848 398,853 398,844" style="fill:rgb(0,0,0)"/>
<path d="M383,833 L 383,841 Q 383,848 393,848 L 404,848"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,848 654,853 654,844" style="fill:rgb(0,0,0)"/>
<path d="M545,848L660,848"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,848 L 673,848 Q 681,848 681,841 L 681,833"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,901L514,901L514,871L410,871Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="462" y="886" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="410,886 398,891 398,882" style="fill:rgb(0,0,0)"/>
<path d="M383,871 L 383,879 Q 383,886 393,886 L 404,886"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,886 654,891 654,882" style="fill:rgb(0,0,0)"/>
<path d="M514,886L660,886"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,886 L 673,886 Q 681,886 681,879 L 681,871"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,939L522,939L522,909L410,909Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="466" y="924" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">update-stmt</text>
<polygon points="410,924 398,928 398,920" style="fill:rgb(0,0,0)"/>
<path d="M383,909 L 383,916 Q 383,924 393,924 L 404,924"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,924 654,928 654,920" style="fill:rgb(0,0,0)"/>
<path d="M522,924L660,924"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,924 L 673,924 Q 681,924 681,916 L 681,909"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,977L587,977L587,947L410,947Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="498" y="962" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">update-stmt-limited</text>
<polygon points="410,962 398,966 398,957" style="fill:rgb(0,0,0)"/>
<path d="M383,947 L 383,954 Q 383,962 393,962 L 404,962"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,962 654,966 654,957" style="fill:rgb(0,0,0)"/>
<path d="M587,962L660,962"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,962 L 673,962 Q 681,962 681,954 L 681,947"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,1015L529,1015L529,984L410,984Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="1000" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">vacuum-stmt</text>
<polygon points="410,1000 398,1004 398,995" style="fill:rgb(0,0,0)"/>
<path d="M368,17 L 376,17 Q 383,17 383,32 L 383,985 Q 383,1000 393,1000 L 404,1000"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,1000 654,1004 654,995" style="fill:rgb(0,0,0)"/>
<path d="M529,1000L660,1000"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,1000 L 673,1000 Q 681,1000 681,985 L 681,32 Q 681,17 688,17 L 696,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt-list.html'>sql-stmt-list</a><br></br>
References:&nbsp;&nbsp; <a href='./alter-table-stmt.html'>alter-table-stmt</a>&nbsp;&nbsp; <a href='./analyze-stmt.html'>analyze-stmt</a>&nbsp;&nbsp; <a href='./attach-stmt.html'>attach-stmt</a>&nbsp;&nbsp; <a href='./begin-stmt.html'>begin-stmt</a>&nbsp;&nbsp; <a href='./commit-stmt.html'>commit-stmt</a>&nbsp;&nbsp; <a href='./create-index-stmt.html'>create-index-stmt</a>&nbsp;&nbsp; <a href='./create-table-stmt.html'>create-table-stmt</a>&nbsp;&nbsp; <a href='./create-trigger-stmt.html'>create-trigger-stmt</a>&nbsp;&nbsp; <a href='./create-view-stmt.html'>create-view-stmt</a>&nbsp;&nbsp; <a href='./create-virtual-table-stmt.html'>create-virtual-table-stmt</a>&nbsp;&nbsp; <a href='./delete-stmt.html'>delete-stmt</a>&nbsp;&nbsp; <a href='./delete-stmt-limited.html'>delete-stmt-limited</a>&nbsp;&nbsp; <a href='./detach-stmt.html'>detach-stmt</a>&nbsp;&nbsp; <a href='./drop-index-stmt.html'>drop-index-stmt</a>&nbsp;&nbsp; <a href='./drop-table-stmt.html'>drop-table-stmt</a>&nbsp;&nbsp; <a href='./drop-trigger-stmt.html'>drop-trigger-stmt</a>&nbsp;&nbsp; <a href='./drop-view-stmt.html'>drop-view-stmt</a>&nbsp;&nbsp; <a href='./insert-stmt.html'>insert-stmt</a>&nbsp;&nbsp; <a href='./pragma-stmt.html'>pragma-stmt</a>&nbsp;&nbsp; <a href='./reindex-stmt.html'>reindex-stmt</a>&nbsp;&nbsp; <a href='./release-stmt.html'>release-stmt</a>&nbsp;&nbsp; <a href='./rollback-stmt.html'>rollback-stmt</a>&nbsp;&nbsp; <a href='./savepoint-stmt.html'>savepoint-stmt</a>&nbsp;&nbsp; <a href='./select-stmt.html'>select-stmt</a>&nbsp;&nbsp; <a href='./update-stmt.html'>update-stmt</a>&nbsp;&nbsp; <a href='./update-stmt-limited.html'>update-stmt-limited</a>&nbsp;&nbsp; <a href='./vacuum-stmt.html'>vacuum-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang.html'>lang.html</a>&nbsp;&nbsp; <a href='../lang_explain.html'>lang_explain.html</a>
</div>



Added Doc/Extra/Core/syntax/table-constraint.html.

















































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: table-constraint</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>table-constraint</h1>
<div class='imgcontainer'>
<div style="max-width:751px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 751.325 261.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L160,32A15 15 0 0 0 175 17A15 15 0 0 0 160 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="110" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONSTRAINT</text>
<polygon points="198,17 187,21 187,12" style="fill:rgb(0,0,0)"/>
<path d="M175,17L192,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M213,32L240,32A15 15 0 0 0 256 17A15 15 0 0 0 240 2L213,2A15 15 0 0 0 198 17A15 15 0 0 0 213 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="227" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<path d="M60,108L123,108A15 15 0 0 0 138 92A15 15 0 0 0 123 77L60,77A15 15 0 0 0 45 92A15 15 0 0 0 60 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="91" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRIMARY</text>
<polygon points="161,92 149,97 149,88" style="fill:rgb(0,0,0)"/>
<path d="M138,92L155,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M176,108L192,108A15 15 0 0 0 208 92A15 15 0 0 0 192 77L176,77A15 15 0 0 0 161 92A15 15 0 0 0 176 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">KEY</text>
<polygon points="244,92 232,97 232,88" style="fill:rgb(0,0,0)"/>
<path d="M208,92L238,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,108A15 15 0 0 0 274 92A15 15 0 0 0 259 77A15 15 0 0 0 244 92A15 15 0 0 0 259 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="310,92 298,97 298,88" style="fill:rgb(0,0,0)"/>
<path d="M274,92L304,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,108L454,108L454,77L310,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">indexed-column</text>
<polygon points="490,92 479,97 479,88" style="fill:rgb(0,0,0)"/>
<path d="M454,92L485,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,108A15 15 0 0 0 521 92A15 15 0 0 0 505 77A15 15 0 0 0 490 92A15 15 0 0 0 505 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="505" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="544,92 532,97 532,88" style="fill:rgb(0,0,0)"/>
<path d="M521,92L538,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M544,108L677,108L677,77L544,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="610" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">conflict-clause</text>
<polygon points="700,92 688,97 688,88" style="fill:rgb(0,0,0)"/>
<path d="M677,92L694,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="741,92 730,97 730,88" style="fill:rgb(0,0,0)"/>
<path d="M700,92L736,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="745" cy="92" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,92 33,97 33,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 31,92 L 39,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="110,55 122,50 122,59" style="fill:rgb(0,0,0)"/>
<path d="M256,17 L 263,17 Q 271,17 271,32 L 271,40 Q 271,55 256,55 L 131,55 L 116,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M110,55 L 39,55 Q 24,55 24,62 L 24,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,145A15 15 0 0 0 397 130A15 15 0 0 0 382 115A15 15 0 0 0 367 130A15 15 0 0 0 382 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="130" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="397,130 409,126 409,135" style="fill:rgb(0,0,0)"/>
<path d="M454,92 L 462,92 Q 469,92 469,107 L 469,115 Q 469,130 454,130 L 418,130 L 403,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M367,130 L 298,130 Q 283,130 283,115 L 283,107 Q 283,92 291,92 L 298,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,145L115,145A15 15 0 0 0 130 130A15 15 0 0 0 115 115L60,115A15 15 0 0 0 45 130A15 15 0 0 0 60 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNIQUE</text>
<path d="M130,130 L 208,130 Q 223,130 223,115 L 223,107 Q 223,92 230,92 L 238,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,130 33,135 33,126" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,115 Q 24,130 31,130 L 39,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,183L105,183A15 15 0 0 0 121 168A15 15 0 0 0 105 153L60,153A15 15 0 0 0 45 168A15 15 0 0 0 60 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CHECK</text>
<polygon points="144,168 132,172 132,164" style="fill:rgb(0,0,0)"/>
<path d="M121,168L138,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M159,183A15 15 0 0 0 174 168A15 15 0 0 0 159 153A15 15 0 0 0 144 168A15 15 0 0 0 159 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="168" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="197,168 185,172 185,164" style="fill:rgb(0,0,0)"/>
<path d="M174,168L191,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,183L246,183L246,153L197,153Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="221" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="269,168 258,172 258,164" style="fill:rgb(0,0,0)"/>
<path d="M246,168L263,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,183L284,183A15 15 0 0 0 299 168A15 15 0 0 0 284 153L284,153A15 15 0 0 0 269 168A15 15 0 0 0 284 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="284" y="168" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="700,168 688,172 688,164" style="fill:rgb(0,0,0)"/>
<path d="M299,168L694,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M700,168 L 707,168 Q 715,168 715,153 L 715,107 Q 715,92 722,92 L 730,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,168 33,172 33,164" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,153 Q 24,168 31,168 L 39,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,221L123,221A15 15 0 0 0 139 206A15 15 0 0 0 123 191L60,191A15 15 0 0 0 45 206A15 15 0 0 0 60 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOREIGN</text>
<polygon points="162,206 150,210 150,201" style="fill:rgb(0,0,0)"/>
<path d="M139,206L156,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M177,221L193,221A15 15 0 0 0 208 206A15 15 0 0 0 193 191L177,191A15 15 0 0 0 162 206A15 15 0 0 0 177 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">KEY</text>
<polygon points="231,206 220,210 220,201" style="fill:rgb(0,0,0)"/>
<path d="M208,206L225,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,221A15 15 0 0 0 261 206A15 15 0 0 0 246 191A15 15 0 0 0 231 206A15 15 0 0 0 246 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="206" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="297,206 286,210 286,201" style="fill:rgb(0,0,0)"/>
<path d="M261,206L292,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,221L407,221A15 15 0 0 0 422 206A15 15 0 0 0 407 191L313,191A15 15 0 0 0 297 206A15 15 0 0 0 313 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="458,206 446,210 446,201" style="fill:rgb(0,0,0)"/>
<path d="M422,206L452,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M473,221A15 15 0 0 0 488 206A15 15 0 0 0 473 191A15 15 0 0 0 458 206A15 15 0 0 0 473 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="206" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,206 500,210 500,201" style="fill:rgb(0,0,0)"/>
<path d="M488,206L505,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M511,221L677,221L677,191L511,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="594" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">foreign-key-clause</text>
<polygon points="700,206 688,210 688,201" style="fill:rgb(0,0,0)"/>
<path d="M677,206L694,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M700,206 L 707,206 Q 715,206 715,191 L 715,168 L 715,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,206 33,210 33,201" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,191 Q 24,206 31,206 L 39,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,259A15 15 0 0 0 375 244A15 15 0 0 0 360 228A15 15 0 0 0 345 244A15 15 0 0 0 360 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="244" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="375,244 386,239 386,248" style="fill:rgb(0,0,0)"/>
<path d="M422,206 L 429,206 Q 437,206 437,221 L 437,229 Q 437,244 422,244 L 396,244 L 381,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,244 L 286,244 Q 271,244 271,229 L 271,221 Q 271,206 278,206 L 286,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./create-table-stmt.html'>create-table-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./conflict-clause.html'>conflict-clause</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./foreign-key-clause.html'>foreign-key-clause</a>&nbsp;&nbsp; <a href='./indexed-column.html'>indexed-column</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>
</div>



Added Doc/Extra/Core/syntax/table-options.html.



















































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: table-options</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>table-options</h1>
<div class='imgcontainer'>
<div style="max-width:324px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 324.036 98.31">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="77,17 66,21 66,12" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 40,36 Q 55,36 55,26 Q 55,17 63,17 L 72,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,32L161,32A15 15 0 0 0 177 17A15 15 0 0 0 161 2L93,2A15 15 0 0 0 77 17A15 15 0 0 0 93 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITHOUT</text>
<polygon points="194,17 182,21 182,12" style="fill:rgb(0,0,0)"/>
<path d="M177,17L188,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,32L253,32A15 15 0 0 0 268 17A15 15 0 0 0 253 2L209,2A15 15 0 0 0 194 17A15 15 0 0 0 209 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWID</text>
<path d="M268,17 L 274,17 Q 280,17 280,26 Q 280,36 295,36 L 299,36 L 314,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="318" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="77,54 66,59 66,50" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 40,36 Q 55,36 55,45 Q 55,54 63,54 L 72,54"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,69L139,69A15 15 0 0 0 154 54A15 15 0 0 0 139 39L93,39A15 15 0 0 0 77 54A15 15 0 0 0 93 69Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="54" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">STRICT</text>
<polygon points="314,36 303,40 303,31" style="fill:rgb(0,0,0)"/>
<path d="M154,54 L 253,54 Q 268,54 274,54 Q 280,54 280,45 Q 280,36 294,36 L 308,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="194,81 205,76 205,85" style="fill:rgb(0,0,0)"/>
<path d="M285,36 L 293,36 Q 300,36 300,51 L 300,66 Q 300,81 285,81 L 215,81 L 200,81"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,96A15 15 0 0 0 194 81A15 15 0 0 0 179 65A15 15 0 0 0 164 81A15 15 0 0 0 179 96Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="179" y="81" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="77,81 89,76 89,85" style="fill:rgb(0,0,0)"/>
<path d="M164,81L83,81"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M77,81 L 31,81 Q 16,81 16,66 L 16,51 Q 16,36 28,36 L 39,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./create-table-stmt.html'>create-table-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>
</div>



Added Doc/Extra/Core/syntax/table-or-subquery.html.

























































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: table-or-subquery</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>table-or-subquery</h1>
<div class='imgcontainer'>
<div style="max-width:720px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 720.778 457.704">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,74 39,78 39,70" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,59 Q 24,74 34,74 L 45,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,89L162,89A15 15 0 0 0 177 74L177,74A15 15 0 0 0 162 59L66,59A15 15 0 0 0 50 74L50,74A15 15 0 0 0 66 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="194,74 183,78 183,70" style="fill:rgb(0,0,0)"/>
<path d="M177,74L189,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,89A15 15 0 0 0 225 74L225,74A15 15 0 0 0 209 59A15 15 0 0 0 194 74L194,74A15 15 0 0 0 209 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="266,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M225,74 L 232,74 Q 240,74 240,59 L 240,51 Q 240,36 250,36 L 260,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,51L356,51A15 15 0 0 0 371 36A15 15 0 0 0 356 21L281,21A15 15 0 0 0 266 36A15 15 0 0 0 281 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="407,36 396,41 396,32" style="fill:rgb(0,0,0)"/>
<path d="M371,36L402,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,51L427,51A15 15 0 0 0 442 36A15 15 0 0 0 427 21L423,21A15 15 0 0 0 407 36A15 15 0 0 0 423 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="478,36 466,41 466,32" style="fill:rgb(0,0,0)"/>
<path d="M442,36L472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,51L561,51A15 15 0 0 0 577 36A15 15 0 0 0 561 21L493,21A15 15 0 0 0 478 36A15 15 0 0 0 493 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="527" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<path d="M9,36L255,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="422,6 411,10 411,2" style="fill:rgb(0,0,0)"/>
<path d="M371,36 L 379,36 Q 386,36 386,21 L 386,21 Q 386,6 401,6 L 402,6 L 417,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 442,6 Q 457,6 457,21 L 457,21 Q 457,36 464,36 L 472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 577,6 Q 592,6 592,21 L 592,21 Q 592,36 599,36 L 607,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,127L388,127A15 15 0 0 0 403 112A15 15 0 0 0 388 97L323,97A15 15 0 0 0 308 112A15 15 0 0 0 323 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="426,112 415,116 415,108" style="fill:rgb(0,0,0)"/>
<path d="M403,112L420,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,127L445,127A15 15 0 0 0 460 112A15 15 0 0 0 445 97L441,97A15 15 0 0 0 426 112A15 15 0 0 0 441 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="443" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="483,112 472,116 472,108" style="fill:rgb(0,0,0)"/>
<path d="M460,112L478,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,127L577,127A15 15 0 0 0 592 112A15 15 0 0 0 577 97L499,97A15 15 0 0 0 483 112A15 15 0 0 0 499 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="538" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M323,165L343,165A15 15 0 0 0 359 150A15 15 0 0 0 343 135L323,135A15 15 0 0 0 308 150A15 15 0 0 0 323 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="382,150 370,154 370,145" style="fill:rgb(0,0,0)"/>
<path d="M359,150L376,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,165L461,165A15 15 0 0 0 476 150A15 15 0 0 0 461 135L397,135A15 15 0 0 0 382 150A15 15 0 0 0 397 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="527,74 539,70 539,78" style="fill:rgb(0,0,0)"/>
<path d="M577,36 L 607,36 Q 622,36 622,51 L 622,59 Q 622,74 607,74 L 548,74 L 533,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,150 297,154 297,145" style="fill:rgb(0,0,0)"/>
<path d="M527,74 L 297,74 Q 282,74 282,89 L 282,135 Q 282,150 292,150 L 302,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,112 297,116 297,108" style="fill:rgb(0,0,0)"/>
<path d="M282,97 L 282,104 Q 282,112 292,112 L 302,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="266,213 255,217 255,209" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,198 Q 24,213 39,213 L 245,213 L 260,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,228L431,228A15 15 0 0 0 446 213A15 15 0 0 0 431 198L281,198A15 15 0 0 0 266 213A15 15 0 0 0 281 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function-name</text>
<polygon points="463,213 452,217 452,209" style="fill:rgb(0,0,0)"/>
<path d="M446,213L457,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,228A15 15 0 0 0 493 213A15 15 0 0 0 478 198A15 15 0 0 0 463 213A15 15 0 0 0 478 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="529,213 518,217 518,209" style="fill:rgb(0,0,0)"/>
<path d="M493,213L524,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M529,228L579,228L579,198L529,198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="615,213 603,217 603,209" style="fill:rgb(0,0,0)"/>
<path d="M579,213L609,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M630,228A15 15 0 0 0 645 213A15 15 0 0 0 630 198A15 15 0 0 0 615 213A15 15 0 0 0 630 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="630" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="675,187 679,198 671,198" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 660,213 Q 675,213 675,203 L 675,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M554,190A15 15 0 0 0 569 175A15 15 0 0 0 554 160A15 15 0 0 0 539 175A15 15 0 0 0 554 190Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="175" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="569,175 581,171 581,180" style="fill:rgb(0,0,0)"/>
<path d="M579,213 L 586,213 Q 594,213 594,198 L 594,190 Q 594,175 584,175 L 575,175"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,175 L 518,175 Q 503,175 503,190 L 503,198 Q 503,213 510,213 L 518,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,74 L 232,74 Q 240,74 240,89 L 240,198 Q 240,213 247,213 L 255,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,112 648,116 648,108" style="fill:rgb(0,0,0)"/>
<path d="M592,112L654,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,112 L 667,112 Q 675,112 675,104 L 675,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,150 648,154 648,145" style="fill:rgb(0,0,0)"/>
<path d="M476,150L654,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,150 L 667,150 Q 675,150 675,142 L 675,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M577,36L690,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,304L411,304A15 15 0 0 0 426 289A15 15 0 0 0 411 274L407,274A15 15 0 0 0 392 289A15 15 0 0 0 407 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="498,289 487,293 487,284" style="fill:rgb(0,0,0)"/>
<path d="M426,289L492,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M513,304L582,304A15 15 0 0 0 597 289A15 15 0 0 0 582 274L513,274A15 15 0 0 0 498 289A15 15 0 0 0 513 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="548" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<polygon points="660,289 648,293 648,284" style="fill:rgb(0,0,0)"/>
<path d="M597,289L654,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,289 L 667,289 Q 675,289 675,281 L 675,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="548,251 559,247 559,255" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 652,213 Q 660,213 660,228 L 660,236 Q 660,251 645,251 L 568,251 L 553,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M548,251 L 370,251 Q 355,251 355,266 L 355,274 Q 355,289 370,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,251 L 464,251 Q 457,251 457,266 L 457,274 Q 457,289 464,289 L 472,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,327 39,331 39,322" style="fill:rgb(0,0,0)"/>
<path d="M24,198 L 24,312 Q 24,327 34,327 L 45,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,342A15 15 0 0 0 81 327A15 15 0 0 0 66 311A15 15 0 0 0 50 327A15 15 0 0 0 66 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,327 92,331 92,322" style="fill:rgb(0,0,0)"/>
<path d="M81,327L98,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,342L208,342L208,311L104,311Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="327" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="231,327 219,331 219,322" style="fill:rgb(0,0,0)"/>
<path d="M208,327L225,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,342A15 15 0 0 0 261 327A15 15 0 0 0 246 311A15 15 0 0 0 231 327A15 15 0 0 0 246 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M261,327 L 269,327 Q 276,327 276,312 L 276,304 Q 276,289 291,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,327 648,331 648,322" style="fill:rgb(0,0,0)"/>
<path d="M261,327L654,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,327 L 667,327 Q 675,327 675,319 L 675,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,327 L 432,327 Q 439,327 439,312 L 439,304 Q 439,289 447,289 L 454,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,364 39,369 39,360" style="fill:rgb(0,0,0)"/>
<path d="M24,311 L 24,349 Q 24,364 34,364 L 45,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,379A15 15 0 0 0 81 364A15 15 0 0 0 65 349A15 15 0 0 0 50 364A15 15 0 0 0 65 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="135,364 123,369 123,360" style="fill:rgb(0,0,0)"/>
<path d="M81,364L129,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,379L296,379L296,349L135,349Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="364" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="350,364 338,369 338,360" style="fill:rgb(0,0,0)"/>
<path d="M296,364L344,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,379A15 15 0 0 0 380 364A15 15 0 0 0 365 349A15 15 0 0 0 350 364A15 15 0 0 0 365 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="660,364 648,369 648,360" style="fill:rgb(0,0,0)"/>
<path d="M380,364L654,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="711,36 699,41 699,32" style="fill:rgb(0,0,0)"/>
<path d="M660,364 L 667,364 Q 675,364 675,349 L 675,51 Q 675,36 690,36 L 690,36 L 705,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="715" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,417A15 15 0 0 0 230 402A15 15 0 0 0 215 387A15 15 0 0 0 200 402A15 15 0 0 0 215 417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="402" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="230,402 242,398 242,406" style="fill:rgb(0,0,0)"/>
<path d="M296,364 L 303,364 Q 311,364 311,379 L 311,387 Q 311,402 296,402 L 251,402 L 236,402"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,402 L 123,402 Q 108,402 108,387 L 108,379 Q 108,364 116,364 L 123,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="122,440 111,444 111,436" style="fill:rgb(0,0,0)"/>
<path d="M81,364 L 88,364 Q 96,364 96,379 L 96,425 Q 96,440 106,440 L 116,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M122,455L224,455L224,425L122,425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M224,440 L 308,440 Q 323,440 323,425 L 323,379 Q 323,364 331,364 L 338,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./join-clause.html'>join-clause</a>&nbsp;&nbsp; <a href='./select-core.html'>select-core</a>&nbsp;&nbsp; <a href='./select-stmt.html'>select-stmt</a>&nbsp;&nbsp; <a href='./update-stmt.html'>update-stmt</a>&nbsp;&nbsp; <a href='./update-stmt-limited.html'>update-stmt-limited</a><br></br>
References:&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./join-clause.html'>join-clause</a>&nbsp;&nbsp; <a href='./select-stmt.html'>select-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_aggfunc.html'>lang_aggfunc.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_attach.html'>lang_attach.html</a>&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_createview.html'>lang_createview.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_returning.html'>lang_returning.html</a>&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>
</div>



Added Doc/Extra/Core/syntax/type-name.html.







































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: type-name</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>type-name</h1>
<div class='imgcontainer'>
<div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.008 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L87,32A15 15 0 0 0 102 17A15 15 0 0 0 87 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="165,92 153,97 153,88" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,77 Q 138,92 149,92 L 159,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,108A15 15 0 0 0 195 92A15 15 0 0 0 180 77A15 15 0 0 0 165 92A15 15 0 0 0 180 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,92 201,97 201,88" style="fill:rgb(0,0,0)"/>
<path d="M195,92L207,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,108L350,108L350,77L212,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,92 356,97 356,88" style="fill:rgb(0,0,0)"/>
<path d="M350,92L362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,108A15 15 0 0 0 398 92A15 15 0 0 0 382 77A15 15 0 0 0 367 92A15 15 0 0 0 382 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="415,92 403,97 403,88" style="fill:rgb(0,0,0)"/>
<path d="M398,92L409,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,108L553,108L553,77L415,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="570,92 558,97 558,88" style="fill:rgb(0,0,0)"/>
<path d="M553,92L564,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,108A15 15 0 0 0 600 92A15 15 0 0 0 585 77A15 15 0 0 0 570 92A15 15 0 0 0 585 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="585" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="651,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M600,92 L 608,92 Q 615,92 615,77 L 615,32 Q 615,17 630,17 L 630,17 L 645,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,40 Q 138,55 149,55 L 159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70A15 15 0 0 0 195 55L195,55A15 15 0 0 0 180 39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,55 201,59 201,50" style="fill:rgb(0,0,0)"/>
<path d="M195,55L207,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,70L350,70L350,39L212,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,55 356,59 356,50" style="fill:rgb(0,0,0)"/>
<path d="M350,55L362,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,70A15 15 0 0 0 398 55L398,55A15 15 0 0 0 382 39A15 15 0 0 0 367 55L367,55A15 15 0 0 0 382 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="600,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M398,55L594,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M600,55 L 608,55 Q 615,55 615,47 L 615,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="74,47 85,43 85,51" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 110,17 Q 117,17 117,32 L 117,32 Q 117,47 102,47 L 94,47 L 79,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47 L 33,47 Q 18,47 18,32 L 18,32 Q 18,17 26,17 L 33,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="382,17 371,21 371,12" style="fill:rgb(0,0,0)"/>
<path d="M102,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,17L630,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./column-def.html'>column-def</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a><br></br>
References:&nbsp;&nbsp; <a href='./signed-number.html'>signed-number</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_aggfunc.html'>lang_aggfunc.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_attach.html'>lang_attach.html</a>&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_createview.html'>lang_createview.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_returning.html'>lang_returning.html</a>&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>
</div>



Added Doc/Extra/Core/syntax/update-stmt-limited.html.

























































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: update-stmt-limited</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>update-stmt-limited</h1>
<div class='imgcontainer'>
<div style="max-width:623px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 623.266 1047.01">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L91,32A15 15 0 0 0 106 17A15 15 0 0 0 91 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M166,62L252,62A15 15 0 0 0 267 47L267,47A15 15 0 0 0 252 32L166,32A15 15 0 0 0 151 47L151,47A15 15 0 0 0 166 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="209,17 197,21 197,12" style="fill:rgb(0,0,0)"/>
<path d="M106,17L203,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M209,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M357,32L583,32L583,2L357,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="151,47 139,51 139,43" style="fill:rgb(0,0,0)"/>
<path d="M106,17 L 113,17 Q 121,17 121,32 L 121,32 Q 121,47 133,47 L 145,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,47 278,51 278,43" style="fill:rgb(0,0,0)"/>
<path d="M267,47L284,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,47 L 297,47 Q 305,47 305,32 L 305,32 Q 305,17 320,17 L 330,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,70A15 15 0 0 0 485 55L485,55A15 15 0 0 0 470 39A15 15 0 0 0 455 55L455,55A15 15 0 0 0 470 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="485,55 497,50 497,59" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,40 Q 598,55 583,55 L 506,55 L 491,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,55 L 349,55 Q 334,55 334,40 L 334,32 Q 334,17 340,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="294,83 306,79 306,88" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,68 Q 598,83 583,83 L 315,83 L 300,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="24,53 20,41 28,41" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,32 L 24,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,136L114,136A15 15 0 0 0 129 121A15 15 0 0 0 114 106L60,106A15 15 0 0 0 45 121A15 15 0 0 0 60 136Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="121" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="45,121 33,125 33,116" style="fill:rgb(0,0,0)"/>
<path d="M24,53 L 24,106 Q 24,121 31,121 L 39,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,83 L 39,83 Q 24,83 24,91 L 24,98"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,299 159,303 159,295" style="fill:rgb(0,0,0)"/>
<path d="M129,121 L 137,121 Q 144,121 144,136 L 144,284 Q 144,299 155,299 L 165,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,314L193,314A15 15 0 0 0 208 299A15 15 0 0 0 193 284L186,284A15 15 0 0 0 171 299A15 15 0 0 0 186 314Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="299" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,299 214,303 214,295" style="fill:rgb(0,0,0)"/>
<path d="M208,299L219,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,314L318,314A15 15 0 0 0 333 299A15 15 0 0 0 318 284L240,284A15 15 0 0 0 225 299A15 15 0 0 0 240 314Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="279" y="299" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="350,299 339,303 339,295" style="fill:rgb(0,0,0)"/>
<path d="M333,299L344,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,121 380,125 380,116" style="fill:rgb(0,0,0)"/>
<path d="M350,299 L 358,299 Q 365,299 365,284 L 365,136 Q 365,121 376,121 L 386,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M392,136L576,136L576,106L392,106Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="121" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">qualified-table-name</text>
<path d="M186,276L193,276A15 15 0 0 0 208 261A15 15 0 0 0 193 246L186,246A15 15 0 0 0 171 261A15 15 0 0 0 186 276Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="261" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,261 214,266 214,257" style="fill:rgb(0,0,0)"/>
<path d="M208,261L219,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,276L304,276A15 15 0 0 0 319 261A15 15 0 0 0 304 246L240,246A15 15 0 0 0 225 261A15 15 0 0 0 240 276Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="261" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<polygon points="350,261 339,266 339,257" style="fill:rgb(0,0,0)"/>
<path d="M319,261L344,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,261 L 358,261 Q 365,261 365,254 L 365,246"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,261 159,266 159,257" style="fill:rgb(0,0,0)"/>
<path d="M144,246 L 144,254 Q 144,261 155,261 L 165,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,239L193,239A15 15 0 0 0 208 224A15 15 0 0 0 193 208L186,208A15 15 0 0 0 171 224A15 15 0 0 0 186 239Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="224" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,224 214,228 214,219" style="fill:rgb(0,0,0)"/>
<path d="M208,224L219,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,239L292,239A15 15 0 0 0 307 224A15 15 0 0 0 292 208L240,208A15 15 0 0 0 225 224A15 15 0 0 0 240 239Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="266" y="224" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="350,224 339,228 339,219" style="fill:rgb(0,0,0)"/>
<path d="M307,224L344,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,224 L 358,224 Q 365,224 365,216 L 365,209"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,224 159,228 159,219" style="fill:rgb(0,0,0)"/>
<path d="M144,208 L 144,216 Q 144,224 155,224 L 165,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,201L193,201A15 15 0 0 0 208 186A15 15 0 0 0 193 171L186,171A15 15 0 0 0 171 186A15 15 0 0 0 186 201Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="186" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,186 214,190 214,181" style="fill:rgb(0,0,0)"/>
<path d="M208,186L219,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,201L262,201A15 15 0 0 0 277 186A15 15 0 0 0 262 171L240,171A15 15 0 0 0 225 186A15 15 0 0 0 240 201Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="186" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="350,186 339,190 339,181" style="fill:rgb(0,0,0)"/>
<path d="M277,186L344,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,186 L 358,186 Q 365,186 365,178 L 365,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,186 159,190 159,181" style="fill:rgb(0,0,0)"/>
<path d="M144,171 L 144,178 Q 144,186 155,186 L 165,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,163L193,163A15 15 0 0 0 208 148A15 15 0 0 0 193 133L186,133A15 15 0 0 0 171 148A15 15 0 0 0 186 163Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="148" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,148 214,152 214,144" style="fill:rgb(0,0,0)"/>
<path d="M208,148L219,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,163L282,163A15 15 0 0 0 297 148A15 15 0 0 0 282 133L240,133A15 15 0 0 0 225 148A15 15 0 0 0 240 163Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="148" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="350,148 339,152 339,144" style="fill:rgb(0,0,0)"/>
<path d="M297,148L344,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,148 L 358,148 Q 365,148 365,140 L 365,133"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,148 159,152 159,144" style="fill:rgb(0,0,0)"/>
<path d="M144,133 L 144,140 Q 144,148 155,148 L 165,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="350,121 339,125 339,116" style="fill:rgb(0,0,0)"/>
<path d="M129,121L344,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,121L380,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,375 39,379 39,370" style="fill:rgb(0,0,0)"/>
<path d="M576,121 L 584,121 Q 591,121 591,136 L 591,322 Q 591,337 576,337 L 39,337 Q 24,337 24,352 L 24,360 Q 24,375 34,375 L 45,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,390L81,390A15 15 0 0 0 96 375A15 15 0 0 0 81 360L65,360A15 15 0 0 0 50 375A15 15 0 0 0 65 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="73" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="153,413 141,417 141,408" style="fill:rgb(0,0,0)"/>
<path d="M96,375 L 111,375 Q 126,375 126,390 L 126,398 Q 126,413 136,413 L 147,413"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,428L309,428L309,397L153,397Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="413" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name-list</text>
<polygon points="350,375 339,379 339,370" style="fill:rgb(0,0,0)"/>
<path d="M309,413 L 316,413 Q 324,413 324,398 L 324,390 Q 324,375 334,375 L 344,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,390A15 15 0 0 0 380 375A15 15 0 0 0 365 360A15 15 0 0 0 350 375A15 15 0 0 0 365 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="375" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">=</text>
<polygon points="404,375 392,379 392,370" style="fill:rgb(0,0,0)"/>
<path d="M380,375L398,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,390L453,390L453,360L404,360Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="428" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="153,375 141,379 141,370" style="fill:rgb(0,0,0)"/>
<path d="M96,375L147,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,390L262,390A15 15 0 0 0 277 375A15 15 0 0 0 262 360L168,360A15 15 0 0 0 153 375A15 15 0 0 0 168 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<path d="M277,375L339,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M251,465A15 15 0 0 0 266 450A15 15 0 0 0 251 435A15 15 0 0 0 236 450A15 15 0 0 0 251 465Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="450" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="266,450 277,446 277,455" style="fill:rgb(0,0,0)"/>
<path d="M453,375 L 460,375 Q 468,375 468,390 L 468,435 Q 468,450 453,450 L 287,450 L 272,450"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,450 L 117,450 Q 102,450 102,435 L 102,390 Q 102,375 117,375 L 117,375 L 132,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="251,488 262,484 262,492" style="fill:rgb(0,0,0)"/>
<path d="M453,375 L 460,375 Q 468,375 468,390 L 468,473 Q 468,488 453,488 L 271,488 L 256,488"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M251,488 L 39,488 Q 24,488 24,503 L 24,511 Q 24,526 37,526 L 50,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,541L100,541A15 15 0 0 0 115 526A15 15 0 0 0 100 511L65,511A15 15 0 0 0 50 526A15 15 0 0 0 65 541Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="526" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="187,526 176,530 176,522" style="fill:rgb(0,0,0)"/>
<path d="M115,526L182,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,541L348,541L348,511L187,511Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="526" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M268,579A15 15 0 0 0 283 564A15 15 0 0 0 268 549A15 15 0 0 0 253 564A15 15 0 0 0 268 579Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="564" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="283,564 295,559 295,568" style="fill:rgb(0,0,0)"/>
<path d="M348,526 L 356,526 Q 363,526 363,541 L 363,549 Q 363,564 348,564 L 304,564 L 289,564"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M253,564 L 176,564 Q 161,564 161,549 L 161,541 Q 161,526 168,526 L 176,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="187,602 176,606 176,597" style="fill:rgb(0,0,0)"/>
<path d="M115,526 L 123,526 Q 130,526 130,541 L 130,587 Q 130,602 145,602 L 167,602 L 182,602"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,617L290,617L290,586L187,586Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="239" y="602" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<polygon points="405,526 393,530 393,522" style="fill:rgb(0,0,0)"/>
<path d="M290,602 L 363,602 Q 378,602 378,587 L 378,541 Q 378,526 389,526 L 399,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="244,639 255,635 255,644" style="fill:rgb(0,0,0)"/>
<path d="M405,526 L 412,526 Q 420,526 420,541 L 420,624 Q 420,639 405,639 L 265,639 L 250,639"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,526L393,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,677 39,681 39,673" style="fill:rgb(0,0,0)"/>
<path d="M244,639 L 39,639 Q 24,639 24,654 L 24,662 Q 24,677 34,677 L 45,677"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,692L115,692A15 15 0 0 0 130 677A15 15 0 0 0 115 662L66,662A15 15 0 0 0 50 677A15 15 0 0 0 66 692Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="90" y="677" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="153,677 142,681 142,673" style="fill:rgb(0,0,0)"/>
<path d="M130,677L147,677"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,692L202,692L202,662L153,662Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="178" y="677" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="126,715 138,711 138,719" style="fill:rgb(0,0,0)"/>
<path d="M202,677 L 212,677 Q 221,677 221,692 L 221,700 Q 221,715 206,715 L 147,715 L 132,715"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,715 L 39,715 Q 24,715 24,726 L 24,738"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,753 39,757 39,748" style="fill:rgb(0,0,0)"/>
<path d="M24,738 L 24,745 Q 24,753 34,753 L 45,753"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M50,768L201,768L201,738L50,738Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="126" y="753" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">returning-clause</text>
<polygon points="126,791 137,786 137,795" style="fill:rgb(0,0,0)"/>
<path d="M201,753 L 211,753 Q 220,753 220,768 L 220,776 Q 220,791 205,791 L 147,791 L 132,791"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,828 39,833 39,824" style="fill:rgb(0,0,0)"/>
<path d="M126,791 L 39,791 Q 24,791 24,806 L 24,813 Q 24,828 34,828 L 45,828"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,843L110,843A15 15 0 0 0 125 828A15 15 0 0 0 110 813L66,813A15 15 0 0 0 50 828A15 15 0 0 0 66 843Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="88" y="828" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="148,828 137,833 137,824" style="fill:rgb(0,0,0)"/>
<path d="M125,828L142,828"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M163,843L167,843A15 15 0 0 0 183 828A15 15 0 0 0 167 813L163,813A15 15 0 0 0 148 828A15 15 0 0 0 163 843Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="165" y="828" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="219,828 207,833 207,824" style="fill:rgb(0,0,0)"/>
<path d="M183,828L213,828"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,843L348,843L348,813L219,813Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="283" y="828" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M283,881L283,881A15 15 0 0 0 299 866A15 15 0 0 0 283 851L283,851A15 15 0 0 0 268 866A15 15 0 0 0 283 881Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="283" y="866" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M60,949L93,949A15 15 0 0 0 109 934A15 15 0 0 0 93 919L60,919A15 15 0 0 0 45 934A15 15 0 0 0 60 949Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="77" y="934" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="132,934 120,939 120,930" style="fill:rgb(0,0,0)"/>
<path d="M109,934L126,934"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,949L181,949L181,919L132,919Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="934" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="219,964 207,969 207,960" style="fill:rgb(0,0,0)"/>
<path d="M181,934 L 188,934 Q 196,934 196,949 L 196,949 Q 196,964 204,964 L 213,964"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M234,980L285,980A15 15 0 0 0 300 964A15 15 0 0 0 285 949L234,949A15 15 0 0 0 219 964A15 15 0 0 0 234 980Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="964" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="323,964 312,969 312,960" style="fill:rgb(0,0,0)"/>
<path d="M300,964L318,964"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,980L373,980L373,949L323,949Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="964" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M234,1017A15 15 0 0 0 249 1002A15 15 0 0 0 234 987A15 15 0 0 0 219 1002A15 15 0 0 0 234 1017Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="1002" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="272,1002 261,1007 261,998" style="fill:rgb(0,0,0)"/>
<path d="M249,1002L266,1002"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,1017L321,1017L321,987L272,987Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="297" y="1002" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="219,1002 207,1007 207,998" style="fill:rgb(0,0,0)"/>
<path d="M181,934 L 188,934 Q 196,934 196,949 L 196,987 Q 196,1002 204,1002 L 213,1002"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,866 310,862 310,870" style="fill:rgb(0,0,0)"/>
<path d="M348,828 L 356,828 Q 363,828 363,843 L 363,851 Q 363,866 348,866 L 319,866 L 304,866"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M268,866 L 210,866 Q 195,866 195,851 L 195,843 Q 195,828 203,828 L 210,828"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,934 33,939 33,930" style="fill:rgb(0,0,0)"/>
<path d="M24,511 L 24,919 Q 24,934 31,934 L 39,934"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,896 177,892 177,901" style="fill:rgb(0,0,0)"/>
<path d="M348,828 L 356,828 Q 363,828 363,843 L 363,881 Q 363,896 348,896 L 186,896 L 171,896"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,896 L 39,896 Q 24,896 24,904 L 24,911"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="178,1040 166,1044 166,1036" style="fill:rgb(0,0,0)"/>
<path d="M24,919 L 24,1025 Q 24,1040 39,1040 L 157,1040 L 172,1040"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="613,1040 602,1044 602,1036" style="fill:rgb(0,0,0)"/>
<path d="M178,1040L608,1040"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="617" cy="1040" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="396,964 384,969 384,960" style="fill:rgb(0,0,0)"/>
<path d="M373,964L390,964"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,1040 435,1044 435,1036" style="fill:rgb(0,0,0)"/>
<path d="M396,964 L 403,964 Q 411,964 411,979 L 411,1025 Q 411,1040 426,1040 L 426,1040 L 441,1040"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="396,1002 384,1007 384,998" style="fill:rgb(0,0,0)"/>
<path d="M321,1002L390,1002"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M396,1002 L 403,1002 Q 411,1002 411,1010 L 411,1017"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="396,934 384,939 384,930" style="fill:rgb(0,0,0)"/>
<path d="M181,934L390,934"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M396,934 L 403,934 Q 411,934 411,949 L 411,965 L 411,980"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./column-name-list.html'>column-name-list</a>&nbsp;&nbsp; <a href='./common-table-expression.html'>common-table-expression</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./join-clause.html'>join-clause</a>&nbsp;&nbsp; <a href='./ordering-term.html'>ordering-term</a>&nbsp;&nbsp; <a href='./qualified-table-name.html'>qualified-table-name</a>&nbsp;&nbsp; <a href='./returning-clause.html'>returning-clause</a>&nbsp;&nbsp; <a href='./table-or-subquery.html'>table-or-subquery</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>
</div>



Added Doc/Extra/Core/syntax/update-stmt.html.













































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: update-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>update-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:623px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 623.266 721.926">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L91,32A15 15 0 0 0 106 17A15 15 0 0 0 91 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M166,62L252,62A15 15 0 0 0 267 47L267,47A15 15 0 0 0 252 32L166,32A15 15 0 0 0 151 47L151,47A15 15 0 0 0 166 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="209,17 197,21 197,12" style="fill:rgb(0,0,0)"/>
<path d="M106,17L203,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M209,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M357,32L583,32L583,2L357,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="151,47 139,51 139,43" style="fill:rgb(0,0,0)"/>
<path d="M106,17 L 113,17 Q 121,17 121,32 L 121,32 Q 121,47 133,47 L 145,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,47 278,51 278,43" style="fill:rgb(0,0,0)"/>
<path d="M267,47L284,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,47 L 297,47 Q 305,47 305,32 L 305,32 Q 305,17 320,17 L 330,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,70A15 15 0 0 0 485 55L485,55A15 15 0 0 0 470 39A15 15 0 0 0 455 55L455,55A15 15 0 0 0 470 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="485,55 497,50 497,59" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,40 Q 598,55 583,55 L 506,55 L 491,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,55 L 349,55 Q 334,55 334,40 L 334,32 Q 334,17 340,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="294,83 306,79 306,88" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,68 Q 598,83 583,83 L 315,83 L 300,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="24,53 20,41 28,41" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,32 L 24,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,136L114,136A15 15 0 0 0 129 121A15 15 0 0 0 114 106L60,106A15 15 0 0 0 45 121A15 15 0 0 0 60 136Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="121" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="45,121 33,125 33,116" style="fill:rgb(0,0,0)"/>
<path d="M24,53 L 24,106 Q 24,121 31,121 L 39,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,83 L 39,83 Q 24,83 24,91 L 24,98"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,299 159,303 159,295" style="fill:rgb(0,0,0)"/>
<path d="M129,121 L 137,121 Q 144,121 144,136 L 144,284 Q 144,299 155,299 L 165,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,314L193,314A15 15 0 0 0 208 299A15 15 0 0 0 193 284L186,284A15 15 0 0 0 171 299A15 15 0 0 0 186 314Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="299" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,299 214,303 214,295" style="fill:rgb(0,0,0)"/>
<path d="M208,299L219,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,314L318,314A15 15 0 0 0 333 299A15 15 0 0 0 318 284L240,284A15 15 0 0 0 225 299A15 15 0 0 0 240 314Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="279" y="299" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="350,299 339,303 339,295" style="fill:rgb(0,0,0)"/>
<path d="M333,299L344,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,121 380,125 380,116" style="fill:rgb(0,0,0)"/>
<path d="M350,299 L 358,299 Q 365,299 365,284 L 365,136 Q 365,121 376,121 L 386,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M392,136L576,136L576,106L392,106Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="121" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">qualified-table-name</text>
<path d="M186,276L193,276A15 15 0 0 0 208 261A15 15 0 0 0 193 246L186,246A15 15 0 0 0 171 261A15 15 0 0 0 186 276Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="261" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,261 214,266 214,257" style="fill:rgb(0,0,0)"/>
<path d="M208,261L219,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,276L304,276A15 15 0 0 0 319 261A15 15 0 0 0 304 246L240,246A15 15 0 0 0 225 261A15 15 0 0 0 240 276Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="261" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<polygon points="350,261 339,266 339,257" style="fill:rgb(0,0,0)"/>
<path d="M319,261L344,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,261 L 358,261 Q 365,261 365,254 L 365,246"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,261 159,266 159,257" style="fill:rgb(0,0,0)"/>
<path d="M144,246 L 144,254 Q 144,261 155,261 L 165,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,239L193,239A15 15 0 0 0 208 224A15 15 0 0 0 193 208L186,208A15 15 0 0 0 171 224A15 15 0 0 0 186 239Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="224" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,224 214,228 214,219" style="fill:rgb(0,0,0)"/>
<path d="M208,224L219,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,239L292,239A15 15 0 0 0 307 224A15 15 0 0 0 292 208L240,208A15 15 0 0 0 225 224A15 15 0 0 0 240 239Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="266" y="224" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="350,224 339,228 339,219" style="fill:rgb(0,0,0)"/>
<path d="M307,224L344,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,224 L 358,224 Q 365,224 365,216 L 365,209"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,224 159,228 159,219" style="fill:rgb(0,0,0)"/>
<path d="M144,208 L 144,216 Q 144,224 155,224 L 165,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,201L193,201A15 15 0 0 0 208 186A15 15 0 0 0 193 171L186,171A15 15 0 0 0 171 186A15 15 0 0 0 186 201Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="186" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,186 214,190 214,181" style="fill:rgb(0,0,0)"/>
<path d="M208,186L219,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,201L262,201A15 15 0 0 0 277 186A15 15 0 0 0 262 171L240,171A15 15 0 0 0 225 186A15 15 0 0 0 240 201Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="186" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="350,186 339,190 339,181" style="fill:rgb(0,0,0)"/>
<path d="M277,186L344,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,186 L 358,186 Q 365,186 365,178 L 365,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,186 159,190 159,181" style="fill:rgb(0,0,0)"/>
<path d="M144,171 L 144,178 Q 144,186 155,186 L 165,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,163L193,163A15 15 0 0 0 208 148A15 15 0 0 0 193 133L186,133A15 15 0 0 0 171 148A15 15 0 0 0 186 163Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="148" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,148 214,152 214,144" style="fill:rgb(0,0,0)"/>
<path d="M208,148L219,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,163L282,163A15 15 0 0 0 297 148A15 15 0 0 0 282 133L240,133A15 15 0 0 0 225 148A15 15 0 0 0 240 163Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="148" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="350,148 339,152 339,144" style="fill:rgb(0,0,0)"/>
<path d="M297,148L344,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,148 L 358,148 Q 365,148 365,140 L 365,133"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,148 159,152 159,144" style="fill:rgb(0,0,0)"/>
<path d="M144,133 L 144,140 Q 144,148 155,148 L 165,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="350,121 339,125 339,116" style="fill:rgb(0,0,0)"/>
<path d="M129,121L344,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,121L380,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,375 39,379 39,370" style="fill:rgb(0,0,0)"/>
<path d="M576,121 L 584,121 Q 591,121 591,136 L 591,322 Q 591,337 576,337 L 39,337 Q 24,337 24,352 L 24,360 Q 24,375 34,375 L 45,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,390L81,390A15 15 0 0 0 96 375A15 15 0 0 0 81 360L65,360A15 15 0 0 0 50 375A15 15 0 0 0 65 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="73" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="153,413 141,417 141,408" style="fill:rgb(0,0,0)"/>
<path d="M96,375 L 111,375 Q 126,375 126,390 L 126,398 Q 126,413 136,413 L 147,413"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,428L309,428L309,397L153,397Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="413" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name-list</text>
<polygon points="350,375 339,379 339,370" style="fill:rgb(0,0,0)"/>
<path d="M309,413 L 316,413 Q 324,413 324,398 L 324,390 Q 324,375 334,375 L 344,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,390A15 15 0 0 0 380 375A15 15 0 0 0 365 360A15 15 0 0 0 350 375A15 15 0 0 0 365 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="375" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">=</text>
<polygon points="404,375 392,379 392,370" style="fill:rgb(0,0,0)"/>
<path d="M380,375L398,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,390L453,390L453,360L404,360Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="428" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="153,375 141,379 141,370" style="fill:rgb(0,0,0)"/>
<path d="M96,375L147,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,390L262,390A15 15 0 0 0 277 375A15 15 0 0 0 262 360L168,360A15 15 0 0 0 153 375A15 15 0 0 0 168 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<path d="M277,375L339,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M251,465A15 15 0 0 0 266 450A15 15 0 0 0 251 435A15 15 0 0 0 236 450A15 15 0 0 0 251 465Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="450" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="266,450 277,446 277,455" style="fill:rgb(0,0,0)"/>
<path d="M453,375 L 460,375 Q 468,375 468,390 L 468,435 Q 468,450 453,450 L 287,450 L 272,450"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,450 L 117,450 Q 102,450 102,435 L 102,390 Q 102,375 117,375 L 117,375 L 132,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="251,488 262,484 262,492" style="fill:rgb(0,0,0)"/>
<path d="M453,375 L 460,375 Q 468,375 468,390 L 468,473 Q 468,488 453,488 L 271,488 L 256,488"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M251,488 L 39,488 Q 24,488 24,503 L 24,511 Q 24,526 37,526 L 50,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,541L100,541A15 15 0 0 0 115 526A15 15 0 0 0 100 511L65,511A15 15 0 0 0 50 526A15 15 0 0 0 65 541Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="526" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="187,526 176,530 176,522" style="fill:rgb(0,0,0)"/>
<path d="M115,526L182,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,541L348,541L348,511L187,511Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="526" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M268,579A15 15 0 0 0 283 564A15 15 0 0 0 268 549A15 15 0 0 0 253 564A15 15 0 0 0 268 579Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="564" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="283,564 295,559 295,568" style="fill:rgb(0,0,0)"/>
<path d="M348,526 L 356,526 Q 363,526 363,541 L 363,549 Q 363,564 348,564 L 304,564 L 289,564"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M253,564 L 176,564 Q 161,564 161,549 L 161,541 Q 161,526 168,526 L 176,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="187,602 176,606 176,597" style="fill:rgb(0,0,0)"/>
<path d="M115,526 L 123,526 Q 130,526 130,541 L 130,587 Q 130,602 145,602 L 167,602 L 182,602"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,617L290,617L290,586L187,586Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="239" y="602" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<polygon points="405,526 393,530 393,522" style="fill:rgb(0,0,0)"/>
<path d="M290,602 L 363,602 Q 378,602 378,587 L 378,541 Q 378,526 389,526 L 399,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="244,639 255,635 255,644" style="fill:rgb(0,0,0)"/>
<path d="M405,526 L 412,526 Q 420,526 420,541 L 420,624 Q 420,639 405,639 L 265,639 L 250,639"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,526L393,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,677 39,681 39,673" style="fill:rgb(0,0,0)"/>
<path d="M244,639 L 39,639 Q 24,639 24,654 L 24,662 Q 24,677 34,677 L 45,677"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,692L115,692A15 15 0 0 0 130 677A15 15 0 0 0 115 662L66,662A15 15 0 0 0 50 677A15 15 0 0 0 66 692Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="90" y="677" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="153,677 142,681 142,673" style="fill:rgb(0,0,0)"/>
<path d="M130,677L147,677"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,692L202,692L202,662L153,662Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="178" y="677" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="24,586 20,575 28,575" style="fill:rgb(0,0,0)"/>
<path d="M24,511L24,581"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M24,586L24,662"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="613,715 602,719 602,711" style="fill:rgb(0,0,0)"/>
<path d="M24,662 L 24,700 Q 24,715 39,715 L 593,715 L 608,715"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="617" cy="715" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="253,715 242,719 242,711" style="fill:rgb(0,0,0)"/>
<path d="M202,677 L 210,677 Q 217,677 217,692 L 217,700 Q 217,715 232,715 L 233,715 L 248,715"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,677 283,681 283,673" style="fill:rgb(0,0,0)"/>
<path d="M253,715 L 261,715 Q 268,715 268,700 L 268,692 Q 268,677 279,677 L 289,677"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,692L446,692L446,662L295,662Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="370" y="677" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">returning-clause</text>
<polygon points="497,715 485,719 485,711" style="fill:rgb(0,0,0)"/>
<path d="M446,677 L 453,677 Q 461,677 461,692 L 461,700 Q 461,715 476,715 L 476,715 L 491,715"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./create-trigger-stmt.html'>create-trigger-stmt</a>&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./column-name-list.html'>column-name-list</a>&nbsp;&nbsp; <a href='./common-table-expression.html'>common-table-expression</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./join-clause.html'>join-clause</a>&nbsp;&nbsp; <a href='./qualified-table-name.html'>qualified-table-name</a>&nbsp;&nbsp; <a href='./returning-clause.html'>returning-clause</a>&nbsp;&nbsp; <a href='./table-or-subquery.html'>table-or-subquery</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>
</div>



Added Doc/Extra/Core/syntax/upsert-clause.html.



















































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: upsert-clause</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>upsert-clause</h1>
<div class='imgcontainer'>
<div style="max-width:901px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 901.142 363.96">
<path d="M223,165L759,165L759,51L223,51Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="5" cy="66" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,66 35,71 35,62" style="fill:rgb(0,0,0)"/>
<path d="M9,66L41,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,82L71,82A15 15 0 0 0 86 66A15 15 0 0 0 71 51L62,51A15 15 0 0 0 47 66A15 15 0 0 0 62 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="66" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="103,66 92,71 92,62" style="fill:rgb(0,0,0)"/>
<path d="M86,66L98,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M118,82L193,82A15 15 0 0 0 208 66A15 15 0 0 0 193 51L118,51A15 15 0 0 0 103 66A15 15 0 0 0 118 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="66" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONFLICT</text>
<polygon points="264,97 253,101 253,92" style="fill:rgb(0,0,0)"/>
<path d="M208,66 L 223,66 Q 238,66 238,81 L 238,82 Q 238,97 248,97 L 259,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M280,112A15 15 0 0 0 295 97L295,97A15 15 0 0 0 280 82A15 15 0 0 0 264 97L264,97A15 15 0 0 0 280 112Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="97" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="331,97 319,101 319,92" style="fill:rgb(0,0,0)"/>
<path d="M295,97L325,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M331,112L475,112L475,82L331,82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="97" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">indexed-column</text>
<polygon points="511,97 500,101 500,92" style="fill:rgb(0,0,0)"/>
<path d="M475,97L506,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M526,112A15 15 0 0 0 542 97L542,97A15 15 0 0 0 526 82A15 15 0 0 0 511 97L511,97A15 15 0 0 0 526 112Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="526" y="97" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="583,135 572,139 572,130" style="fill:rgb(0,0,0)"/>
<path d="M542,97 L 549,97 Q 557,97 557,112 L 557,119 Q 557,135 567,135 L 577,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M598,150L648,150A15 15 0 0 0 663 135A15 15 0 0 0 648 119L598,119A15 15 0 0 0 583 135A15 15 0 0 0 598 150Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="623" y="135" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="680,135 669,139 669,130" style="fill:rgb(0,0,0)"/>
<path d="M663,135L674,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M680,150L729,150L729,119L680,119Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="705" y="135" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="744,108 749,119 740,119" style="fill:rgb(0,0,0)"/>
<path d="M729,135 L 737,135 Q 744,135 744,124 L 744,114"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="786,66 774,71 774,62" style="fill:rgb(0,0,0)"/>
<path d="M744,108 L 744,81 Q 744,66 759,66 L 765,66 L 780,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M801,82L809,82A15 15 0 0 0 824 66A15 15 0 0 0 809 51L801,51A15 15 0 0 0 786 66A15 15 0 0 0 801 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="805" y="66" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DO</text>
<polygon points="729,97 718,101 718,92" style="fill:rgb(0,0,0)"/>
<path d="M542,97L723,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,97 L 737,97 Q 744,97 744,89 L 744,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M208,66L774,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,150A15 15 0 0 0 418 135A15 15 0 0 0 403 119A15 15 0 0 0 388 135A15 15 0 0 0 403 150Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="135" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,135 430,130 430,139" style="fill:rgb(0,0,0)"/>
<path d="M475,97 L 483,97 Q 490,97 490,112 L 490,119 Q 490,135 475,135 L 439,135 L 424,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,135 L 319,135 Q 304,135 304,119 L 304,112 Q 304,97 312,97 L 319,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="288" y="36" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" dominant-baseline="central">conflict target</text>
<polygon points="436,195 447,191 447,199" style="fill:rgb(0,0,0)"/>
<path d="M824,66 L 831,66 Q 839,66 839,81 L 839,180 Q 839,195 824,195 L 456,195 L 441,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,271 35,275 35,266" style="fill:rgb(0,0,0)"/>
<path d="M436,195 L 35,195 Q 20,195 20,210 L 20,256 Q 20,271 31,271 L 41,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,286L116,286A15 15 0 0 0 131 271A15 15 0 0 0 116 255L62,255A15 15 0 0 0 47 271A15 15 0 0 0 62 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="89" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="148,271 137,275 137,266" style="fill:rgb(0,0,0)"/>
<path d="M131,271L143,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M164,286L179,286A15 15 0 0 0 194 271A15 15 0 0 0 179 255L164,255A15 15 0 0 0 148 271A15 15 0 0 0 164 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="171" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="257,308 245,313 245,304" style="fill:rgb(0,0,0)"/>
<path d="M194,271 L 215,271 Q 230,271 230,286 L 230,293 Q 230,308 241,308 L 251,308"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,324L413,324L413,293L257,293Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="335" y="308" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name-list</text>
<polygon points="475,271 464,275 464,266" style="fill:rgb(0,0,0)"/>
<path d="M413,308 L 434,308 Q 449,308 449,293 L 449,286 Q 449,271 459,271 L 469,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,286A15 15 0 0 0 505 271A15 15 0 0 0 490 255A15 15 0 0 0 475 271A15 15 0 0 0 490 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="490" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">=</text>
<polygon points="523,271 511,275 511,266" style="fill:rgb(0,0,0)"/>
<path d="M505,271L517,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M523,286L572,286L572,255L523,255Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="547" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="619,271 608,275 608,266" style="fill:rgb(0,0,0)"/>
<path d="M572,271L613,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M634,286L684,286A15 15 0 0 0 699 271A15 15 0 0 0 684 255L634,255A15 15 0 0 0 619 271A15 15 0 0 0 634 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="659" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="716,271 705,275 705,266" style="fill:rgb(0,0,0)"/>
<path d="M699,271L710,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M716,286L765,286L765,255L716,255Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="741" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="891,233 880,237 880,228" style="fill:rgb(0,0,0)"/>
<path d="M765,271 L 773,271 Q 780,271 780,256 L 780,248 Q 780,233 795,233 L 871,233 L 886,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="895" cy="233" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,248L130,248A15 15 0 0 0 145 233A15 15 0 0 0 130 218L62,218A15 15 0 0 0 47 233A15 15 0 0 0 62 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="96" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTHING</text>
<polygon points="47,233 35,237 35,228" style="fill:rgb(0,0,0)"/>
<path d="M20,218 L 20,225 Q 20,233 31,233 L 41,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,233L880,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="638,233 626,237 626,228" style="fill:rgb(0,0,0)"/>
<path d="M587,271 L 594,271 Q 602,271 602,256 L 602,248 Q 602,233 617,233 L 617,233 L 632,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M383,361A15 15 0 0 0 398 346A15 15 0 0 0 383 331A15 15 0 0 0 368 346A15 15 0 0 0 383 361Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="383" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="398,346 410,342 410,351" style="fill:rgb(0,0,0)"/>
<path d="M572,271 L 579,271 Q 587,271 587,286 L 587,331 Q 587,346 572,346 L 419,346 L 404,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,308 210,320 201,320" style="fill:rgb(0,0,0)"/>
<path d="M368,346 L 221,346 Q 206,346 206,331 L 206,329 L 206,314"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,308 L 206,286 Q 206,271 221,271 L 227,271 L 242,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="257,271 245,275 245,266" style="fill:rgb(0,0,0)"/>
<path d="M194,271L251,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,286L366,286A15 15 0 0 0 381 271A15 15 0 0 0 366 255L272,255A15 15 0 0 0 257 271A15 15 0 0 0 272 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<path d="M381,271L464,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="865,97 869,108 860,108" style="fill:rgb(0,0,0)"/>
<path d="M850,233 L 857,233 Q 865,233 865,218 L 865,117 L 865,102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="403,6 415,2 415,10" style="fill:rgb(0,0,0)"/>
<path d="M865,97 L 865,21 Q 865,6 850,6 L 424,6 L 409,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,6 L 40,6 Q 25,6 25,21 L 25,51 Q 25,66 32,66 L 40,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./insert-stmt.html'>insert-stmt</a><br></br>
References:&nbsp;&nbsp; <a href='./column-name-list.html'>column-name-list</a>&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./indexed-column.html'>indexed-column</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>
</div>



Added Doc/Extra/Core/syntax/vacuum-stmt.html.

















































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: vacuum-stmt</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>vacuum-stmt</h1>
<div class='imgcontainer'>
<div style="max-width:599px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 599.669 64.8">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L108,32A15 15 0 0 0 123 17A15 15 0 0 0 108 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="78" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VACUUM</text>
<polygon points="165,47 153,51 153,43" style="fill:rgb(0,0,0)"/>
<path d="M123,17 L 131,17 Q 138,17 138,32 L 138,32 Q 138,47 149,47 L 159,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,62L276,62A15 15 0 0 0 292 47L292,47A15 15 0 0 0 276 32L180,32A15 15 0 0 0 165 47L165,47A15 15 0 0 0 180 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="333,17 322,21 322,12" style="fill:rgb(0,0,0)"/>
<path d="M292,47 L 299,47 Q 307,47 307,32 L 307,32 Q 307,17 317,17 L 327,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="375,47 363,51 363,43" style="fill:rgb(0,0,0)"/>
<path d="M333,17 L 341,17 Q 348,17 348,32 L 348,32 Q 348,47 359,47 L 369,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M390,62L417,62A15 15 0 0 0 432 47L432,47A15 15 0 0 0 417 32L390,32A15 15 0 0 0 375 47L375,47A15 15 0 0 0 390 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTO</text>
<polygon points="455,47 443,51 443,43" style="fill:rgb(0,0,0)"/>
<path d="M432,47L449,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,62L524,62A15 15 0 0 0 539 47L539,47A15 15 0 0 0 524 32L470,32A15 15 0 0 0 455 47L455,47A15 15 0 0 0 470 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="497" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filename</text>
<polygon points="590,17 578,21 578,12" style="fill:rgb(0,0,0)"/>
<path d="M539,47 L 546,47 Q 554,47 554,32 L 554,32 Q 554,17 569,17 L 569,17 L 584,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="593" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M123,17L578,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./sql-stmt.html'>sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_vacuum.html'>lang_vacuum.html</a>
</div>



Added Doc/Extra/Core/syntax/window-defn.html.



























































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: window-defn</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>window-defn</h1>
<div class='imgcontainer'>
<div style="max-width:479px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 479.765 380.592">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,44 92,48 92,40" style="fill:rgb(0,0,0)"/>
<path d="M62,17 L 70,17 Q 77,17 77,30 Q 77,44 88,44 L 98,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,59L260,59A15 15 0 0 0 275 44L275,44A15 15 0 0 0 260 29L119,29A15 15 0 0 0 104 44L104,44A15 15 0 0 0 119 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M119,135L198,135A15 15 0 0 0 214 120A15 15 0 0 0 198 104L119,104A15 15 0 0 0 104 120A15 15 0 0 0 119 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="237,120 225,124 225,115" style="fill:rgb(0,0,0)"/>
<path d="M214,120L231,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M252,135L256,135A15 15 0 0 0 271 120A15 15 0 0 0 256 104L252,104A15 15 0 0 0 237 120A15 15 0 0 0 252 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="307,120 295,124 295,115" style="fill:rgb(0,0,0)"/>
<path d="M271,120L301,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,135L356,135L356,104L307,104Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M332,173A15 15 0 0 0 347 157A15 15 0 0 0 332 142A15 15 0 0 0 316 157A15 15 0 0 0 332 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="157" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="347,157 358,153 358,162" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,142 Q 371,157 362,157 L 352,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,157 L 295,157 Q 280,157 280,142 L 280,135 Q 280,120 288,120 L 295,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,17 178,21 178,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L184,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,82 201,77 201,86" style="fill:rgb(0,0,0)"/>
<path d="M190,17 L 298,17 Q 313,17 313,32 L 313,67 Q 313,82 298,82 L 210,82 L 195,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,120 92,124 92,115" style="fill:rgb(0,0,0)"/>
<path d="M190,82 L 77,82 Q 62,82 62,97 L 62,105 Q 62,120 77,120 L 83,120 L 98,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,44 287,48 287,40" style="fill:rgb(0,0,0)"/>
<path d="M275,44L293,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,44 L 306,44 Q 313,44 313,51 L 313,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,248L163,248A15 15 0 0 0 178 233A15 15 0 0 0 163 218L119,218A15 15 0 0 0 104 233A15 15 0 0 0 119 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="201,233 190,237 190,229" style="fill:rgb(0,0,0)"/>
<path d="M178,233L196,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,248L221,248A15 15 0 0 0 236 233A15 15 0 0 0 221 218L217,218A15 15 0 0 0 201 233A15 15 0 0 0 217 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="272,233 260,237 260,229" style="fill:rgb(0,0,0)"/>
<path d="M236,233L266,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,248L402,248L402,218L272,218Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M337,286A15 15 0 0 0 352 271A15 15 0 0 0 337 256A15 15 0 0 0 322 271A15 15 0 0 0 337 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="352,271 363,266 363,275" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,256 Q 417,271 402,271 L 373,271 L 358,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M322,271 L 260,271 Q 245,271 245,256 L 245,248 Q 245,233 253,233 L 260,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,195 201,191 201,200" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,180 Q 371,195 356,195 L 210,195 L 195,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,233 92,237 92,229" style="fill:rgb(0,0,0)"/>
<path d="M190,195 L 77,195 Q 62,195 62,210 L 62,218 Q 62,233 77,233 L 83,233 L 98,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,157 58,146 66,146" style="fill:rgb(0,0,0)"/>
<path d="M62,104L62,152"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,157L62,218"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,362L208,362L208,331L104,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="417,346 405,351 405,342" style="fill:rgb(0,0,0)"/>
<path d="M208,346L411,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,362A15 15 0 0 0 447 346A15 15 0 0 0 432 331A15 15 0 0 0 417 346A15 15 0 0 0 432 362Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="470,346 458,351 458,342" style="fill:rgb(0,0,0)"/>
<path d="M447,346L464,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="474" cy="346" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,309 201,304 201,313" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,294 Q 417,309 402,309 L 210,309 L 195,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,346 92,351 92,342" style="fill:rgb(0,0,0)"/>
<path d="M190,309 L 77,309 Q 62,309 62,324 L 62,331 Q 62,346 77,346 L 83,346 L 98,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,271 58,259 66,259" style="fill:rgb(0,0,0)"/>
<path d="M62,218L62,265"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,271L62,331"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,374 144,378 144,369" style="fill:rgb(0,0,0)"/>
<path d="M62,331 L 62,359 Q 62,374 77,374 L 135,374 L 150,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,346 266,351 266,342" style="fill:rgb(0,0,0)"/>
<path d="M156,374 L 233,374 Q 248,374 248,360 Q 248,346 260,346 L 272,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>

Used by:&nbsp;&nbsp; <a href='./select-core.html'>select-core</a>&nbsp;&nbsp; <a href='./select-stmt.html'>select-stmt</a>&nbsp;&nbsp; <a href='./window-function-invocation.html'>window-function-invocation</a><br></br>
References:&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./frame-spec.html'>frame-spec</a>&nbsp;&nbsp; <a href='./ordering-term.html'>ordering-term</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_aggfunc.html'>lang_aggfunc.html</a>&nbsp;&nbsp; <a href='../lang_altertable.html'>lang_altertable.html</a>&nbsp;&nbsp; <a href='../lang_attach.html'>lang_attach.html</a>&nbsp;&nbsp; <a href='../lang_createindex.html'>lang_createindex.html</a>&nbsp;&nbsp; <a href='../lang_createtable.html'>lang_createtable.html</a>&nbsp;&nbsp; <a href='../lang_createtrigger.html'>lang_createtrigger.html</a>&nbsp;&nbsp; <a href='../lang_createview.html'>lang_createview.html</a>&nbsp;&nbsp; <a href='../lang_delete.html'>lang_delete.html</a>&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>&nbsp;&nbsp; <a href='../lang_insert.html'>lang_insert.html</a>&nbsp;&nbsp; <a href='../lang_returning.html'>lang_returning.html</a>&nbsp;&nbsp; <a href='../lang_select.html'>lang_select.html</a>&nbsp;&nbsp; <a href='../lang_update.html'>lang_update.html</a>&nbsp;&nbsp; <a href='../lang_upsert.html'>lang_upsert.html</a>&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>&nbsp;&nbsp; <a href='../partialindex.html'>partialindex.html</a>
</div>



Added Doc/Extra/Core/syntax/window-function-invocation.html.









































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: window-function-invocation</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>window-function-invocation</h1>
<div class='imgcontainer'>
<div style="max-width:870px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 870.446 132.84">
<circle cx="5" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,55 20,59 20,50" style="fill:rgb(0,0,0)"/>
<path d="M9,55L26,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,70L135,70A15 15 0 0 0 150 55A15 15 0 0 0 135 39L47,39A15 15 0 0 0 32 55A15 15 0 0 0 47 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="91" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-func</text>
<polygon points="167,55 156,59 156,50" style="fill:rgb(0,0,0)"/>
<path d="M150,55L161,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M182,70A15 15 0 0 0 197 55A15 15 0 0 0 182 39A15 15 0 0 0 167 55A15 15 0 0 0 182 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="182" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="251,55 240,59 240,50" style="fill:rgb(0,0,0)"/>
<path d="M197,55L246,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M251,70L300,70L300,39L251,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="354,55 343,59 343,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L349,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M370,70A15 15 0 0 0 385 55A15 15 0 0 0 370 39A15 15 0 0 0 354 55A15 15 0 0 0 370 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="370" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="426,85 415,89 415,81" style="fill:rgb(0,0,0)"/>
<path d="M385,55 L 392,55 Q 400,55 400,70 L 400,70 Q 400,85 410,85 L 420,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M426,100L538,100L538,70L426,70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="580,55 568,59 568,50" style="fill:rgb(0,0,0)"/>
<path d="M538,85 L 546,85 Q 553,85 553,70 L 553,70 Q 553,55 564,55 L 574,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M595,70L626,70A15 15 0 0 0 641 55A15 15 0 0 0 626 39L595,39A15 15 0 0 0 580 55A15 15 0 0 0 595 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="610" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="682,92 671,97 671,88" style="fill:rgb(0,0,0)"/>
<path d="M641,55 L 648,55 Q 656,55 656,70 L 656,77 Q 656,92 666,92 L 677,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M697,108L794,108A15 15 0 0 0 810 92L810,92A15 15 0 0 0 794 77L697,77A15 15 0 0 0 682 92L682,92A15 15 0 0 0 697 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="746" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="861,55 849,59 849,50" style="fill:rgb(0,0,0)"/>
<path d="M810,92 L 817,92 Q 825,92 825,77 L 825,70 Q 825,55 840,55 L 840,55 L 855,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="864" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M385,55L568,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="682,55 671,59 671,50" style="fill:rgb(0,0,0)"/>
<path d="M641,55L677,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M682,70L801,70L801,39L682,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="742" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M801,55L849,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,32A15 15 0 0 0 291 17L291,17A15 15 0 0 0 276 2A15 15 0 0 0 261 17L261,17A15 15 0 0 0 276 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="291,17 303,12 303,21" style="fill:rgb(0,0,0)"/>
<path d="M300,55 L 308,55 Q 315,55 315,40 L 315,32 Q 315,17 306,17 L 297,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M261,17 L 240,17 Q 225,17 225,32 L 225,40 Q 225,55 232,55 L 240,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="276,85 264,89 264,81" style="fill:rgb(0,0,0)"/>
<path d="M197,55 L 205,55 Q 212,55 212,70 L 212,70 Q 212,85 227,85 L 255,85 L 270,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,85 L 313,85 Q 328,85 328,70 L 328,70 Q 328,55 335,55 L 343,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130A15 15 0 0 0 291 115L291,115A15 15 0 0 0 276 100A15 15 0 0 0 261 115L261,115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M197,55 L 205,55 Q 212,55 212,70 L 212,100 Q 212,115 227,115 L 240,115 L 255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,115 L 313,115 Q 328,115 328,100 L 328,70 Q 328,55 335,55 L 343,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>
<br></br>
References:&nbsp;&nbsp; <a href='./expr.html'>expr</a>&nbsp;&nbsp; <a href='./filter-clause.html'>filter-clause</a>&nbsp;&nbsp; <a href='./window-defn.html'>window-defn</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_expr.html'>lang_expr.html</a>
</div>



Added Doc/Extra/Core/syntax/with-clause.html.





















































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="../sqlite.css" rel="stylesheet">
<title>SQLite Syntax: with-clause</title>
<!-- path=../ -->
</head>
<body>
<div class=nosearch>
<a href="../index.html">
<img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="../index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='../about.html'>About</a>
<li class='desktoponly'><a href="../docs.html">Documentation</a>
<li class='desktoponly'><a href="../download.html">Download</a>
<li class='wideonly'><a href='../copyright.html'>License</a>
<li class='desktoponly'><a href="../support.html">Support</a>
<li class='desktoponly'><a href="../prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='../about.html'>About</a>
<li><a href='../docs.html'>Documentation</a>
<li><a href='../download.html'>Download</a>
<li><a href='../support.html'>Support</a>
<li><a href='../prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="../search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<h1 align='center'>with-clause</h1>
<div class='imgcontainer'>
<div style="max-width:1056px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1056.72 140.4">
<circle cx="5" cy="85" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,85 20,89 20,81" style="fill:rgb(0,0,0)"/>
<path d="M9,85L26,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,100L78,100A15 15 0 0 0 93 85A15 15 0 0 0 78 70L47,70A15 15 0 0 0 32 85A15 15 0 0 0 47 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,85 L 100,85 Q 108,85 108,70 L 108,70 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M150,70L235,70A15 15 0 0 0 250 55L250,55A15 15 0 0 0 235 39L150,39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 150 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<path d="M250,55 L 258,55 Q 265,55 265,70 L 265,70 Q 265,85 273,85 L 280,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,85 295,89 295,81" style="fill:rgb(0,0,0)"/>
<path d="M280,85L301,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,100L444,100L444,70L307,70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">cte-table-name</text>
<polygon points="467,85 455,89 455,81" style="fill:rgb(0,0,0)"/>
<path d="M444,85L461,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M482,100L486,100A15 15 0 0 0 501 85A15 15 0 0 0 486 70L482,70A15 15 0 0 0 467 85A15 15 0 0 0 482 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="542,17 531,21 531,12" style="fill:rgb(0,0,0)"/>
<path d="M501,85 L 508,85 Q 516,85 516,70 L 516,32 Q 516,17 526,17 L 537,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,32L578,32A15 15 0 0 0 593 17L593,17A15 15 0 0 0 578 2L558,2A15 15 0 0 0 542 17L542,17A15 15 0 0 0 558 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="568" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M593,17L604,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M625,32L743,32A15 15 0 0 0 759 17L759,17A15 15 0 0 0 743 2L625,2A15 15 0 0 0 610 17L610,17A15 15 0 0 0 625 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="684" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<polygon points="800,85 789,89 789,81" style="fill:rgb(0,0,0)"/>
<path d="M759,17 L 766,17 Q 774,17 774,32 L 774,70 Q 774,85 784,85 L 794,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M815,100A15 15 0 0 0 830 85A15 15 0 0 0 815 70A15 15 0 0 0 800 85A15 15 0 0 0 815 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="815" y="85" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="853,85 842,89 842,81" style="fill:rgb(0,0,0)"/>
<path d="M830,85L848,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M853,100L958,100L958,70L853,70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="905" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="981,85 969,89 969,81" style="fill:rgb(0,0,0)"/>
<path d="M958,85L975,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M996,100A15 15 0 0 0 1011 85A15 15 0 0 0 996 70A15 15 0 0 0 981 85A15 15 0 0 0 996 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="996" y="85" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="1047,85 1035,89 1035,81" style="fill:rgb(0,0,0)"/>
<path d="M1011,85L1041,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="1050" cy="85" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="542,56 531,60 531,52" style="fill:rgb(0,0,0)"/>
<path d="M501,85 L 508,85 Q 516,85 516,70 Q 516,56 526,56 L 537,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,71L676,71A15 15 0 0 0 691 56A15 15 0 0 0 676 41L558,41A15 15 0 0 0 542 56A15 15 0 0 0 558 71Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<polygon points="759,56 747,60 747,52" style="fill:rgb(0,0,0)"/>
<path d="M691,56L753,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,56 L 766,56 Q 774,56 774,64 L 774,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="617,85 605,89 605,81" style="fill:rgb(0,0,0)"/>
<path d="M501,85L611,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M617,85L800,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M659,138A15 15 0 0 0 674 123L674,123A15 15 0 0 0 659 108A15 15 0 0 0 644 123L644,123A15 15 0 0 0 659 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="659" y="123" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="674,123 686,118 686,127" style="fill:rgb(0,0,0)"/>
<path d="M1011,85 L 1018,85 Q 1026,85 1026,100 L 1026,108 Q 1026,123 1011,123 L 695,123 L 680,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,123 L 295,123 Q 280,123 280,108 L 280,100 Q 280,85 288,85 L 295,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,85L295,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div><br>
<br></br>
References:&nbsp;&nbsp; <a href='./cte-table-name.html'>cte-table-name</a>&nbsp;&nbsp; <a href='./select-stmt.html'>select-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href='../lang_with.html'>lang_with.html</a>
</div>



Added Doc/Extra/Core/syntaxdiagrams.html.



























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>Syntax Diagrams For SQLite</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>



<h1 align=center>Syntax Diagrams For SQLite</h1>

<a name="aggregate-function-invocation"></a><h4>aggregate-function-invocation:</h4><div class='imgcontainer'>
<div style="max-width:909px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 909.533 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,71L156,71A15 15 0 0 0 171 56A15 15 0 0 0 156 41L47,41A15 15 0 0 0 32 56A15 15 0 0 0 47 71Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="102" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">aggregate-func</text>
<polygon points="189,56 178,60 178,52" style="fill:rgb(0,0,0)"/>
<path d="M171,56L183,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M204,71A15 15 0 0 0 219 56A15 15 0 0 0 204 41A15 15 0 0 0 189 56A15 15 0 0 0 204 71Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="56" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="242,56 231,60 231,52" style="fill:rgb(0,0,0)"/>
<path d="M219,56L237,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="277,26 265,30 265,22" style="fill:rgb(0,0,0)"/>
<path d="M242,56 L 248,56 Q 254,56 254,41 L 254,41 Q 254,26 263,26 L 271,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M292,41L360,41A15 15 0 0 0 376 26L376,26A15 15 0 0 0 360 11L292,11A15 15 0 0 0 277 26L277,26A15 15 0 0 0 292 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="326" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="394,26 382,30 382,22" style="fill:rgb(0,0,0)"/>
<path d="M376,26L388,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="428,56 417,60 417,52" style="fill:rgb(0,0,0)"/>
<path d="M394,26 L 399,26 Q 405,26 405,41 L 405,41 Q 405,56 414,56 L 422,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="464,56 453,60 453,52" style="fill:rgb(0,0,0)"/>
<path d="M428,56L458,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M464,71L513,71L513,41L464,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="489" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="657,56 646,60 646,52" style="fill:rgb(0,0,0)"/>
<path d="M513,56L652,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M672,71A15 15 0 0 0 688 56A15 15 0 0 0 672 41A15 15 0 0 0 657 56A15 15 0 0 0 672 71Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="56" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="734,86 722,91 722,82" style="fill:rgb(0,0,0)"/>
<path d="M688,56 L 699,56 Q 711,56 711,71 L 711,71 Q 711,86 719,86 L 728,86"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,101L846,101L846,71L734,71Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="790" y="86" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="900,56 888,60 888,52" style="fill:rgb(0,0,0)"/>
<path d="M846,86 L 855,86 Q 864,86 864,71 L 864,71 Q 864,56 879,56 L 879,56 L 894,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="903" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="790,56 778,60 778,52" style="fill:rgb(0,0,0)"/>
<path d="M688,56L784,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="900,56 888,60 888,52" style="fill:rgb(0,0,0)"/>
<path d="M790,56L894,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="326,56 315,60 315,52" style="fill:rgb(0,0,0)"/>
<path d="M242,56L321,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="428,56 417,60 417,52" style="fill:rgb(0,0,0)"/>
<path d="M326,56L422,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,32A15 15 0 0 0 504 17A15 15 0 0 0 489 2A15 15 0 0 0 474 17A15 15 0 0 0 489 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="489" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="504,17 515,12 515,21" style="fill:rgb(0,0,0)"/>
<path d="M513,56 L 525,56 Q 536,56 536,41 L 536,32 Q 536,17 523,17 L 510,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="464,56 453,60 453,52" style="fill:rgb(0,0,0)"/>
<path d="M474,17 L 456,17 Q 441,17 441,32 L 441,41 Q 441,56 450,56 L 458,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,207A15 15 0 0 0 453 192A15 15 0 0 0 438 177A15 15 0 0 0 423 192A15 15 0 0 0 438 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="423,192 412,196 412,188" style="fill:rgb(0,0,0)"/>
<path d="M242,56 L 248,56 Q 254,56 254,71 L 254,177 Q 254,192 269,192 L 402,192 L 417,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="489,192 477,196 477,188" style="fill:rgb(0,0,0)"/>
<path d="M453,192L483,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,192 L 570,192 Q 585,192 600,192 L 605,192 Q 620,192 620,177 L 620,71 Q 620,56 626,56 L 631,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="438,216 427,221 427,212" style="fill:rgb(0,0,0)"/>
<path d="M326,192 L 392,192 Q 407,192 407,204 Q 407,216 420,216 L 433,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,216 L 453,216 Q 467,216 467,204 Q 467,192 473,192 L 479,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="300,117 289,121 289,112" style="fill:rgb(0,0,0)"/>
<path d="M513,56 L 523,56 Q 533,56 533,71 L 533,71 Q 533,86 518,86 L 292,86 Q 277,86 277,101 L 277,102 Q 277,117 286,117 L 294,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M315,132L360,132A15 15 0 0 0 375 117A15 15 0 0 0 360 101L315,101A15 15 0 0 0 300 117A15 15 0 0 0 315 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="392,117 381,121 381,112" style="fill:rgb(0,0,0)"/>
<path d="M375,117L386,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,132L411,132A15 15 0 0 0 426 117A15 15 0 0 0 411 101L407,101A15 15 0 0 0 392 117A15 15 0 0 0 407 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="455,117 444,121 444,112" style="fill:rgb(0,0,0)"/>
<path d="M426,117L449,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,132L585,132L585,101L455,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="520" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M520,169A15 15 0 0 0 535 154A15 15 0 0 0 520 139A15 15 0 0 0 505 154A15 15 0 0 0 520 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="520" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="535,154 547,150 547,159" style="fill:rgb(0,0,0)"/>
<path d="M585,117 L 591,117 Q 597,117 597,132 L 597,139 Q 597,154 582,154 L 556,154 L 541,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="455,117 444,121 444,112" style="fill:rgb(0,0,0)"/>
<path d="M505,154 L 470,154 Q 455,154 447,154 Q 438,154 438,139 L 438,132 Q 438,117 444,117 L 449,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,117 L 594,117 Q 602,117 602,102 L 602,71 Q 602,56 617,56 L 623,56 L 638,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<br></br>
References:&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#filter-clause">filter-clause</a>&nbsp;&nbsp; <a href="#ordering-term">ordering-term</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_expr.html#*funcinexpr">lang_expr.html#*funcinexpr</a>
</div>

<a name="alter-table-stmt"></a><h4>alter-table-stmt:</h4><div class='imgcontainer'>
<div style="max-width:754px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 754.521 320.904">
<circle cx="5" cy="32" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="37,32 26,37 26,28" style="fill:rgb(0,0,0)"/>
<path d="M9,32L31,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M37,32L59,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47L113,47A15 15 0 0 0 129 32A15 15 0 0 0 113 17L74,17A15 15 0 0 0 59 32A15 15 0 0 0 74 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="94" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALTER</text>
<polygon points="165,32 153,37 153,28" style="fill:rgb(0,0,0)"/>
<path d="M129,32L159,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,47L219,47A15 15 0 0 0 234 32A15 15 0 0 0 219 17L180,17A15 15 0 0 0 165 32A15 15 0 0 0 180 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TABLE</text>
<polygon points="251,32 240,37 240,28" style="fill:rgb(0,0,0)"/>
<path d="M234,32L245,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="287,32 276,37 276,28" style="fill:rgb(0,0,0)"/>
<path d="M251,32L281,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M302,47L399,47A15 15 0 0 0 414 32A15 15 0 0 0 399 17L302,17A15 15 0 0 0 287 32A15 15 0 0 0 302 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="436,32 425,37 425,28" style="fill:rgb(0,0,0)"/>
<path d="M414,32L431,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M452,47A15 15 0 0 0 467 32A15 15 0 0 0 452 17A15 15 0 0 0 436 32A15 15 0 0 0 452 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="452" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="503,32 491,37 491,28" style="fill:rgb(0,0,0)"/>
<path d="M467,32L497,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M518,47L593,47A15 15 0 0 0 608 32A15 15 0 0 0 593 17L518,17A15 15 0 0 0 503 32A15 15 0 0 0 518 47Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="555" y="32" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="376,6 364,10 364,2" style="fill:rgb(0,0,0)"/>
<path d="M251,32 L 260,32 Q 268,32 268,19 Q 268,6 283,6 L 355,6 L 370,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,6 L 461,6 Q 476,6 476,19 Q 476,32 489,32 L 503,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="626,56 622,45 630,45" style="fill:rgb(0,0,0)"/>
<path d="M608,32 L 617,32 Q 626,32 626,41 L 626,51"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,81 362,76 362,85" style="fill:rgb(0,0,0)"/>
<path d="M626,56 L 626,68 Q 626,81 611,81 L 371,81 L 356,81"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,81 L 20,81 Q 5,81 5,88 L 5,96"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="41,126 30,130 30,122" style="fill:rgb(0,0,0)"/>
<path d="M5,96 L 5,111 Q 5,126 20,126 L 20,126 L 36,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M56,141L117,141A15 15 0 0 0 132 126A15 15 0 0 0 117 111L56,111A15 15 0 0 0 41 126A15 15 0 0 0 56 141Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="126" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RENAME</text>
<polygon points="150,126 139,130 139,122" style="fill:rgb(0,0,0)"/>
<path d="M132,126L144,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,141L171,141A15 15 0 0 0 186 126A15 15 0 0 0 171 111L165,111A15 15 0 0 0 150 126A15 15 0 0 0 165 141Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="126" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TO</text>
<polygon points="204,126 193,130 193,122" style="fill:rgb(0,0,0)"/>
<path d="M186,126L198,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,141L334,141A15 15 0 0 0 349 126A15 15 0 0 0 334 111L219,111A15 15 0 0 0 204 126A15 15 0 0 0 219 141Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="277" y="126" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">new-table-name</text>
<polygon points="41,171 30,176 30,167" style="fill:rgb(0,0,0)"/>
<path d="M5,96 L 5,156 Q 5,171 20,171 L 21,171 L 36,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M56,186L117,186A15 15 0 0 0 132 171A15 15 0 0 0 117 156L56,156A15 15 0 0 0 41 171A15 15 0 0 0 56 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RENAME</text>
<polygon points="149,171 138,176 138,167" style="fill:rgb(0,0,0)"/>
<path d="M132,171L143,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="185,171 174,176 174,167" style="fill:rgb(0,0,0)"/>
<path d="M149,171L179,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,186L263,186A15 15 0 0 0 278 171A15 15 0 0 0 263 156L200,156A15 15 0 0 0 185 171A15 15 0 0 0 200 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="232" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLUMN</text>
<polygon points="314,171 303,176 303,167" style="fill:rgb(0,0,0)"/>
<path d="M278,171L308,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M329,186L423,186A15 15 0 0 0 439 171A15 15 0 0 0 423 156L329,156A15 15 0 0 0 314 171A15 15 0 0 0 329 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="376" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="457,171 445,176 445,167" style="fill:rgb(0,0,0)"/>
<path d="M439,171L451,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,186L477,186A15 15 0 0 0 492 171A15 15 0 0 0 477 156L472,156A15 15 0 0 0 457 171A15 15 0 0 0 472 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="475" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TO</text>
<polygon points="510,171 499,176 499,167" style="fill:rgb(0,0,0)"/>
<path d="M492,171L505,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M526,186L660,186A15 15 0 0 0 675 171A15 15 0 0 0 660 156L526,156A15 15 0 0 0 510 171A15 15 0 0 0 526 186Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="171" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">new-column-name</text>
<polygon points="692,171 680,176 680,167" style="fill:rgb(0,0,0)"/>
<path d="M675,171L686,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="745,126 733,130 733,122" style="fill:rgb(0,0,0)"/>
<path d="M692,171 L 700,171 Q 709,171 709,156 L 709,141 Q 709,126 724,126 L 724,126 L 739,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="748" cy="126" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="745,126 733,130 733,122" style="fill:rgb(0,0,0)"/>
<path d="M349,126L739,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="232,198 220,202 220,193" style="fill:rgb(0,0,0)"/>
<path d="M149,171 L 158,171 Q 166,171 166,184 Q 166,198 181,198 L 211,198 L 226,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="314,171 303,176 303,167" style="fill:rgb(0,0,0)"/>
<path d="M232,198 L 272,198 Q 287,198 287,184 Q 287,171 298,171 L 308,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="41,232 30,236 30,227" style="fill:rgb(0,0,0)"/>
<path d="M5,96 L 5,217 Q 5,232 20,232 L 21,232 L 36,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M56,247L76,247A15 15 0 0 0 91 232A15 15 0 0 0 76 217L56,217A15 15 0 0 0 41 232A15 15 0 0 0 56 247Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="232" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ADD</text>
<polygon points="108,232 97,236 97,227" style="fill:rgb(0,0,0)"/>
<path d="M91,232L102,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="144,232 133,236 133,227" style="fill:rgb(0,0,0)"/>
<path d="M108,232L138,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M159,247L222,247A15 15 0 0 0 237 232A15 15 0 0 0 222 217L159,217A15 15 0 0 0 144 232A15 15 0 0 0 159 247Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="232" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLUMN</text>
<polygon points="273,232 262,236 262,227" style="fill:rgb(0,0,0)"/>
<path d="M237,232L267,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M273,247L378,247L378,217L273,217Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="326" y="232" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-def</text>
<polygon points="692,232 680,236 680,227" style="fill:rgb(0,0,0)"/>
<path d="M378,232L686,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="191,258 179,262 179,254" style="fill:rgb(0,0,0)"/>
<path d="M108,232 L 117,232 Q 125,232 125,245 Q 125,258 140,258 L 170,258 L 185,258"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,232 262,236 262,227" style="fill:rgb(0,0,0)"/>
<path d="M191,258 L 231,258 Q 246,258 246,245 Q 246,232 257,232 L 267,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="745,126 733,130 733,122" style="fill:rgb(0,0,0)"/>
<path d="M692,232 L 700,232 Q 709,232 709,217 L 709,141 Q 709,126 724,126 L 724,126 L 739,126"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="41,288 30,292 30,283" style="fill:rgb(0,0,0)"/>
<path d="M5,217 L 5,273 Q 5,288 20,288 L 21,288 L 36,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M56,303L87,303A15 15 0 0 0 103 288A15 15 0 0 0 87 273L56,273A15 15 0 0 0 41 288A15 15 0 0 0 56 303Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="72" y="288" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DROP</text>
<polygon points="120,288 108,292 108,283" style="fill:rgb(0,0,0)"/>
<path d="M103,288L114,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,288 144,292 144,283" style="fill:rgb(0,0,0)"/>
<path d="M120,288L150,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M171,303L234,303A15 15 0 0 0 249 288A15 15 0 0 0 234 273L171,273A15 15 0 0 0 156 288A15 15 0 0 0 171 303Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="202" y="288" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLUMN</text>
<polygon points="285,288 273,292 273,283" style="fill:rgb(0,0,0)"/>
<path d="M249,288L279,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,303L394,303A15 15 0 0 0 409 288A15 15 0 0 0 394 273L300,273A15 15 0 0 0 285 288A15 15 0 0 0 300 303Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="288" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="692,288 680,292 680,283" style="fill:rgb(0,0,0)"/>
<path d="M409,288L686,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M692,288 L 700,288 Q 709,288 709,273 L 709,232 L 709,217"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="202,314 191,318 191,310" style="fill:rgb(0,0,0)"/>
<path d="M120,288 L 127,288 Q 135,288 135,301 Q 135,314 150,314 L 181,314 L 196,314"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M202,314 L 245,314 Q 260,314 260,301 Q 260,288 268,288 L 275,288"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href="#column-def">column-def</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>
</div>

<a name="analyze-stmt"></a><h4>analyze-stmt:</h4><div class='imgcontainer'>
<div style="max-width:654px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 654.557 140.4">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L111,32A15 15 0 0 0 127 17A15 15 0 0 0 111 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="79" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ANALYZE</text>
<polygon points="150,17 138,21 138,12" style="fill:rgb(0,0,0)"/>
<path d="M127,17L144,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="188,123 176,127 176,118" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 157,17 Q 165,17 165,32 L 165,108 Q 165,123 173,123 L 182,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M203,138L299,138A15 15 0 0 0 314 123A15 15 0 0 0 299 108L203,108A15 15 0 0 0 188 123A15 15 0 0 0 203 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="337,123 326,127 326,118" style="fill:rgb(0,0,0)"/>
<path d="M314,123L332,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M352,138A15 15 0 0 0 368 123A15 15 0 0 0 352 108A15 15 0 0 0 337 123A15 15 0 0 0 352 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="352" y="123" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="391,123 379,127 379,118" style="fill:rgb(0,0,0)"/>
<path d="M368,123L385,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M406,138L556,138A15 15 0 0 0 571 123A15 15 0 0 0 556 108L406,108A15 15 0 0 0 391 123A15 15 0 0 0 406 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-index-name</text>
<polygon points="594,123 582,127 582,118" style="fill:rgb(0,0,0)"/>
<path d="M571,123L588,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="645,17 633,21 633,12" style="fill:rgb(0,0,0)"/>
<path d="M594,123 L 601,123 Q 609,123 609,108 L 609,32 Q 609,17 624,17 L 624,17 L 639,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="648" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="397,17 386,21 386,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L391,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,17L633,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="188,47 176,51 176,43" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 157,17 Q 165,17 165,32 L 165,32 Q 165,47 173,47 L 182,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M203,62L299,62A15 15 0 0 0 314 47L314,47A15 15 0 0 0 299 32L203,32A15 15 0 0 0 188 47L188,47A15 15 0 0 0 203 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="594,47 582,51 582,43" style="fill:rgb(0,0,0)"/>
<path d="M314,47L588,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M594,47 L 601,47 Q 609,47 609,40 L 609,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="188,85 176,89 176,81" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 157,17 Q 165,17 165,32 L 165,70 Q 165,85 173,85 L 182,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M203,100L353,100A15 15 0 0 0 368 85A15 15 0 0 0 353 70L203,70A15 15 0 0 0 188 85A15 15 0 0 0 203 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-or-table-name</text>
<polygon points="594,85 582,89 582,81" style="fill:rgb(0,0,0)"/>
<path d="M368,85L588,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M594,85 L 601,85 Q 609,85 609,77 L 609,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_analyze.html">lang_analyze.html</a>
</div>

<a name="attach-stmt"></a><h4>attach-stmt:</h4><div class='imgcontainer'>
<div style="max-width:606px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 606.701 47.952">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L101,32A15 15 0 0 0 116 17A15 15 0 0 0 101 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ATTACH</text>
<polygon points="139,17 128,21 128,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L134,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="175,17 164,21 164,12" style="fill:rgb(0,0,0)"/>
<path d="M139,17L170,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M191,32L267,32A15 15 0 0 0 282 17A15 15 0 0 0 267 2L191,2A15 15 0 0 0 175 17A15 15 0 0 0 191 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="229" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DATABASE</text>
<polygon points="318,17 306,21 306,12" style="fill:rgb(0,0,0)"/>
<path d="M282,17L312,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M318,32L367,32L367,2L318,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="342" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="390,17 378,21 378,12" style="fill:rgb(0,0,0)"/>
<path d="M367,17L384,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M405,32L409,32A15 15 0 0 0 424 17A15 15 0 0 0 409 2L405,2A15 15 0 0 0 390 17A15 15 0 0 0 405 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="407" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="447,17 436,21 436,12" style="fill:rgb(0,0,0)"/>
<path d="M424,17L441,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,32L559,32A15 15 0 0 0 574 17A15 15 0 0 0 559 2L462,2A15 15 0 0 0 447 17A15 15 0 0 0 462 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="510" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="597,17 585,21 585,12" style="fill:rgb(0,0,0)"/>
<path d="M574,17L591,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="600" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="229,41 217,45 217,37" style="fill:rgb(0,0,0)"/>
<path d="M139,17 L 147,17 Q 154,17 154,29 Q 154,41 169,41 L 208,41 L 223,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M229,41 L 276,41 Q 291,41 291,29 Q 291,17 298,17 L 306,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href="#expr">expr</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>
</div>

<a name="begin-stmt"></a><h4>begin-stmt:</h4><div class='imgcontainer'>
<div style="max-width:560px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 560.669 140.4">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L86,32A15 15 0 0 0 101 17A15 15 0 0 0 86 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BEGIN</text>
<polygon points="124,17 112,21 112,12" style="fill:rgb(0,0,0)"/>
<path d="M101,17L118,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="162,123 150,127 150,118" style="fill:rgb(0,0,0)"/>
<path d="M124,17 L 131,17 Q 139,17 139,32 L 139,108 Q 139,123 147,123 L 156,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M177,138L261,138A15 15 0 0 0 276 123A15 15 0 0 0 261 108L177,108A15 15 0 0 0 162 123A15 15 0 0 0 177 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUSIVE</text>
<polygon points="299,123 287,127 287,118" style="fill:rgb(0,0,0)"/>
<path d="M276,123L293,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="337,17 325,21 325,12" style="fill:rgb(0,0,0)"/>
<path d="M299,123 L 306,123 Q 314,123 314,108 L 314,32 Q 314,17 322,17 L 331,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="373,17 361,21 361,12" style="fill:rgb(0,0,0)"/>
<path d="M337,17L367,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,32L500,32A15 15 0 0 0 515 17A15 15 0 0 0 500 2L388,2A15 15 0 0 0 373 17A15 15 0 0 0 388 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRANSACTION</text>
<polygon points="551,17 539,21 539,12" style="fill:rgb(0,0,0)"/>
<path d="M515,17L545,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="554" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="444,47 432,51 432,43" style="fill:rgb(0,0,0)"/>
<path d="M337,17 L 344,17 Q 352,17 352,32 L 352,32 Q 352,47 367,47 L 423,47 L 438,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,47 L 511,47 Q 526,47 526,32 L 526,32 Q 526,17 533,17 L 541,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M124,17L325,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="162,47 150,51 150,43" style="fill:rgb(0,0,0)"/>
<path d="M139,32 L 139,39 Q 139,47 147,47 L 156,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M177,62L257,62A15 15 0 0 0 272 47L272,47A15 15 0 0 0 257 32L177,32A15 15 0 0 0 162 47L162,47A15 15 0 0 0 177 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="217" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFERRED</text>
<polygon points="295,47 284,51 284,43" style="fill:rgb(0,0,0)"/>
<path d="M272,47L289,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,47 L 304,47 Q 314,47 314,40 L 314,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="162,85 150,89 150,81" style="fill:rgb(0,0,0)"/>
<path d="M139,32 L 139,70 Q 139,85 147,85 L 156,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M177,100L265,100A15 15 0 0 0 281 85A15 15 0 0 0 265 70L177,70A15 15 0 0 0 162 85A15 15 0 0 0 177 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="221" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IMMEDIATE</text>
<polygon points="304,85 292,89 292,81" style="fill:rgb(0,0,0)"/>
<path d="M281,85L298,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M304,85 L 309,85 Q 314,85 314,77 L 314,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_transaction.html">lang_transaction.html</a>
</div>

<a name="column-constraint"></a><h4>column-constraint:</h4><div class='imgcontainer'>
<div style="max-width:844px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 844.306 578.88">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,40 43,28 51,28" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,25 L 47,34"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L183,32A15 15 0 0 0 198 17A15 15 0 0 0 183 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="133" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONSTRAINT</text>
<polygon points="221,17 210,21 210,12" style="fill:rgb(0,0,0)"/>
<path d="M198,17L215,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,32L263,32A15 15 0 0 0 279 17A15 15 0 0 0 263 2L236,2A15 15 0 0 0 221 17A15 15 0 0 0 236 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="250" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="173,47 185,43 185,51" style="fill:rgb(0,0,0)"/>
<path d="M279,17 L 300,17 Q 315,17 315,32 L 315,32 Q 315,47 300,47 L 194,47 L 179,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M173,47 L 62,47 Q 47,47 47,55 L 47,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,77 58,82 58,73" style="fill:rgb(0,0,0)"/>
<path d="M47,40 L 47,62 Q 47,77 56,77 L 64,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,92L148,92A15 15 0 0 0 163 77A15 15 0 0 0 148 62L85,62A15 15 0 0 0 70 77A15 15 0 0 0 85 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRIMARY</text>
<polygon points="186,77 174,82 174,73" style="fill:rgb(0,0,0)"/>
<path d="M163,77L180,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M201,92L217,92A15 15 0 0 0 233 77A15 15 0 0 0 217 62L201,62A15 15 0 0 0 186 77A15 15 0 0 0 201 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">KEY</text>
<polygon points="271,138 259,142 259,133" style="fill:rgb(0,0,0)"/>
<path d="M233,77 L 240,77 Q 248,77 248,92 L 248,123 Q 248,138 256,138 L 265,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M286,153L316,153A15 15 0 0 0 331 138A15 15 0 0 0 316 123L286,123A15 15 0 0 0 271 138A15 15 0 0 0 286 153Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="301" y="138" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="354,138 343,142 343,133" style="fill:rgb(0,0,0)"/>
<path d="M331,138L348,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,77 381,82 381,73" style="fill:rgb(0,0,0)"/>
<path d="M354,138 L 362,138 Q 369,138 369,123 L 369,92 Q 369,77 378,77 L 386,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M392,92L525,92L525,62L392,62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="459" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">conflict-clause</text>
<polygon points="549,77 537,82 537,73" style="fill:rgb(0,0,0)"/>
<path d="M525,77L543,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="587,108 575,112 575,103" style="fill:rgb(0,0,0)"/>
<path d="M549,77 L 556,77 Q 564,77 564,92 L 564,93 Q 564,108 572,108 L 581,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M602,123L745,123A15 15 0 0 0 760 108A15 15 0 0 0 745 92L602,92A15 15 0 0 0 587 108A15 15 0 0 0 602 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="673" y="108" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AUTOINCREMENT</text>
<polygon points="783,108 772,112 772,103" style="fill:rgb(0,0,0)"/>
<path d="M760,108L778,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="834,77 823,82 823,73" style="fill:rgb(0,0,0)"/>
<path d="M783,108 L 791,108 Q 798,108 798,93 L 798,92 Q 798,77 813,77 L 814,77 L 829,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="838" cy="77" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="673,77 662,82 662,73" style="fill:rgb(0,0,0)"/>
<path d="M549,77L668,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M673,77L827,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="301,77 289,82 289,73" style="fill:rgb(0,0,0)"/>
<path d="M233,77L295,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,77L381,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="271,100 259,104 259,96" style="fill:rgb(0,0,0)"/>
<path d="M233,77 L 240,77 Q 248,77 248,89 Q 248,100 256,100 L 265,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M286,115L302,115A15 15 0 0 0 318 100A15 15 0 0 0 302 85L286,85A15 15 0 0 0 271 100A15 15 0 0 0 286 115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="294" y="100" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="354,100 343,104 343,96" style="fill:rgb(0,0,0)"/>
<path d="M318,100L348,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,100 L 362,100 Q 369,100 369,92 L 369,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,183 58,187 58,179" style="fill:rgb(0,0,0)"/>
<path d="M47,62 L 47,168 Q 47,183 56,183 L 64,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,198L105,198A15 15 0 0 0 120 183A15 15 0 0 0 105 168L85,168A15 15 0 0 0 70 183A15 15 0 0 0 85 198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="95" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="143,183 132,187 132,179" style="fill:rgb(0,0,0)"/>
<path d="M120,183L138,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,198L190,198A15 15 0 0 0 205 183A15 15 0 0 0 190 168L158,168A15 15 0 0 0 143 183A15 15 0 0 0 158 198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="174" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="228,183 216,187 216,179" style="fill:rgb(0,0,0)"/>
<path d="M205,183L222,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,198L361,198L361,168L228,168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="294" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">conflict-clause</text>
<polygon points="783,183 772,187 772,179" style="fill:rgb(0,0,0)"/>
<path d="M361,183L778,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,183 L 791,183 Q 798,183 798,168 L 798,107 L 798,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,221 58,225 58,217" style="fill:rgb(0,0,0)"/>
<path d="M47,168 L 47,206 Q 47,221 56,221 L 64,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,236L140,236A15 15 0 0 0 155 221A15 15 0 0 0 140 206L85,206A15 15 0 0 0 70 221A15 15 0 0 0 85 236Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="113" y="221" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNIQUE</text>
<polygon points="178,221 167,225 167,217" style="fill:rgb(0,0,0)"/>
<path d="M155,221L172,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M178,236L311,236L311,206L178,206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="245" y="221" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">conflict-clause</text>
<polygon points="783,221 772,225 772,217" style="fill:rgb(0,0,0)"/>
<path d="M311,221L778,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,221 L 791,221 Q 798,221 798,206 L 798,183 L 798,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,259 58,263 58,254" style="fill:rgb(0,0,0)"/>
<path d="M47,206 L 47,244 Q 47,259 56,259 L 64,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,274L131,274A15 15 0 0 0 146 259A15 15 0 0 0 131 244L85,244A15 15 0 0 0 70 259A15 15 0 0 0 85 274Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="259" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CHECK</text>
<polygon points="169,259 157,263 157,254" style="fill:rgb(0,0,0)"/>
<path d="M146,259L163,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M184,274A15 15 0 0 0 199 259A15 15 0 0 0 184 244A15 15 0 0 0 169 259A15 15 0 0 0 184 274Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="259" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="222,259 210,263 210,254" style="fill:rgb(0,0,0)"/>
<path d="M199,259L216,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,274L271,274L271,244L222,244Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="259" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="294,259 283,263 283,254" style="fill:rgb(0,0,0)"/>
<path d="M271,259L288,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,274A15 15 0 0 0 324 259A15 15 0 0 0 309 244A15 15 0 0 0 294 259A15 15 0 0 0 309 274Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="309" y="259" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="783,259 772,263 772,254" style="fill:rgb(0,0,0)"/>
<path d="M324,259L778,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,259 L 791,259 Q 798,259 798,244 L 798,221 L 798,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,297 58,301 58,292" style="fill:rgb(0,0,0)"/>
<path d="M47,244 L 47,282 Q 47,297 56,297 L 64,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,312L150,312A15 15 0 0 0 166 297A15 15 0 0 0 150 281L85,281A15 15 0 0 0 70 297A15 15 0 0 0 85 312Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="118" y="297" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFAULT</text>
<polygon points="189,297 177,301 177,292" style="fill:rgb(0,0,0)"/>
<path d="M166,297L183,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="225,297 213,301 213,292" style="fill:rgb(0,0,0)"/>
<path d="M189,297L219,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,312A15 15 0 0 0 255 297A15 15 0 0 0 240 281A15 15 0 0 0 225 297A15 15 0 0 0 240 312Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="240" y="297" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="278,297 266,301 266,292" style="fill:rgb(0,0,0)"/>
<path d="M255,297L272,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,312L327,312L327,281L278,281Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="297" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="350,297 339,301 339,292" style="fill:rgb(0,0,0)"/>
<path d="M327,297L344,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,312A15 15 0 0 0 380 297A15 15 0 0 0 365 281A15 15 0 0 0 350 297A15 15 0 0 0 365 312Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="297" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="783,297 772,301 772,292" style="fill:rgb(0,0,0)"/>
<path d="M380,297L778,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,297 L 791,297 Q 798,297 798,282 L 798,259 L 798,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="227,334 215,339 215,330" style="fill:rgb(0,0,0)"/>
<path d="M189,297 L 196,297 Q 204,297 204,312 L 204,319 Q 204,334 212,334 L 221,334"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M227,349L340,349L340,319L227,319Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="283" y="334" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="363,334 351,339 351,330" style="fill:rgb(0,0,0)"/>
<path d="M340,334L357,334"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,334 L 395,334 Q 410,334 410,319 L 410,312 Q 410,297 425,297 L 431,297 L 446,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="227,372 215,376 215,368" style="fill:rgb(0,0,0)"/>
<path d="M189,297 L 196,297 Q 204,297 204,312 L 204,357 Q 204,372 212,372 L 221,372"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M227,387L364,387L364,357L227,357Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="372" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="387,372 376,376 376,368" style="fill:rgb(0,0,0)"/>
<path d="M364,372L382,372"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M387,372 L 399,372 Q 410,372 410,357 L 410,312 Q 410,297 425,297 L 431,297 L 446,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,410 58,414 58,406" style="fill:rgb(0,0,0)"/>
<path d="M47,281 L 47,395 Q 47,410 56,410 L 64,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,425L149,425A15 15 0 0 0 164 410A15 15 0 0 0 149 395L85,395A15 15 0 0 0 70 410A15 15 0 0 0 85 425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="117" y="410" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="187,410 176,414 176,406" style="fill:rgb(0,0,0)"/>
<path d="M164,410L182,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M202,425L308,425A15 15 0 0 0 323 410A15 15 0 0 0 308 395L202,395A15 15 0 0 0 187 410A15 15 0 0 0 202 425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="255" y="410" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="783,410 772,414 772,406" style="fill:rgb(0,0,0)"/>
<path d="M323,410L778,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,410 L 791,410 Q 798,410 798,395 L 798,296 L 798,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,448 58,452 58,443" style="fill:rgb(0,0,0)"/>
<path d="M47,395 L 47,433 Q 47,448 56,448 L 64,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,463L236,463L236,433L70,433Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="448" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">foreign-key-clause</text>
<polygon points="783,448 772,452 772,443" style="fill:rgb(0,0,0)"/>
<path d="M236,448L778,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,448 L 791,448 Q 798,448 798,433 L 798,410 L 798,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,486 58,490 58,481" style="fill:rgb(0,0,0)"/>
<path d="M47,433 L 47,471 Q 47,486 56,486 L 64,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,501L178,501A15 15 0 0 0 193 486A15 15 0 0 0 178 470L85,470A15 15 0 0 0 70 486A15 15 0 0 0 85 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="131" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GENERATED</text>
<polygon points="216,486 204,490 204,481" style="fill:rgb(0,0,0)"/>
<path d="M193,486L210,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M231,501L286,501A15 15 0 0 0 301 486A15 15 0 0 0 286 470L231,470A15 15 0 0 0 216 486A15 15 0 0 0 231 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALWAYS</text>
<polygon points="337,486 325,490 325,481" style="fill:rgb(0,0,0)"/>
<path d="M301,486L331,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M352,501L356,501A15 15 0 0 0 371 486A15 15 0 0 0 356 470L352,470A15 15 0 0 0 337 486A15 15 0 0 0 352 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="354" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="394,486 382,490 382,481" style="fill:rgb(0,0,0)"/>
<path d="M371,486L388,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,501A15 15 0 0 0 424 486A15 15 0 0 0 409 470A15 15 0 0 0 394 486A15 15 0 0 0 409 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="486" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="447,486 436,490 436,481" style="fill:rgb(0,0,0)"/>
<path d="M424,486L441,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M447,501L496,501L496,470L447,470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="472" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="519,486 508,490 508,481" style="fill:rgb(0,0,0)"/>
<path d="M496,486L514,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,501A15 15 0 0 0 550 486A15 15 0 0 0 535 470A15 15 0 0 0 519 486A15 15 0 0 0 535 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="535" y="486" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="783,486 772,490 772,481" style="fill:rgb(0,0,0)"/>
<path d="M550,486L778,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,486 L 791,486 Q 798,486 798,471 L 798,448 L 798,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="185,516 174,520 174,511" style="fill:rgb(0,0,0)"/>
<path d="M47,470 L 47,501 Q 47,516 62,516 L 165,516 L 180,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M185,516 L 297,516 Q 312,516 312,501 L 312,501 Q 312,486 320,486 L 327,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="596,561 584,565 584,557" style="fill:rgb(0,0,0)"/>
<path d="M550,486 L 561,486 Q 573,486 573,501 L 573,546 Q 573,561 581,561 L 590,561"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M611,576L670,576A15 15 0 0 0 686 561A15 15 0 0 0 670 546L611,546A15 15 0 0 0 596 561A15 15 0 0 0 611 576Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="641" y="561" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VIRTUAL</text>
<polygon points="783,561 772,565 772,557" style="fill:rgb(0,0,0)"/>
<path d="M686,561L778,561"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,561 L 791,561 Q 798,561 798,546 L 798,485 L 798,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="596,523 584,528 584,519" style="fill:rgb(0,0,0)"/>
<path d="M550,486 L 561,486 Q 573,486 573,501 L 573,508 Q 573,523 581,523 L 590,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M611,538L665,538A15 15 0 0 0 680 523A15 15 0 0 0 665 508L611,508A15 15 0 0 0 596 523A15 15 0 0 0 611 538Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="638" y="523" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">STORED</text>
<polygon points="783,523 772,528 772,519" style="fill:rgb(0,0,0)"/>
<path d="M680,523L778,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M783,523 L 791,523 Q 798,523 798,516 L 798,508"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#column-def">column-def</a><br></br>
References:&nbsp;&nbsp; <a href="#conflict-clause">conflict-clause</a>&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#foreign-key-clause">foreign-key-clause</a>&nbsp;&nbsp; <a href="#literal-value">literal-value</a>&nbsp;&nbsp; <a href="#signed-number">signed-number</a><br></br>
See also:&nbsp;&nbsp; <a href="gencol.html">gencol.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtable.html#tablecoldef">lang_createtable.html#tablecoldef</a>
</div>

<a name="column-def"></a><h4>column-def:</h4><div class='imgcontainer'>
<div style="max-width:614px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 614.333 64.8">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L141,32A15 15 0 0 0 156 17A15 15 0 0 0 141 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="94" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="179,17 168,21 168,12" style="fill:rgb(0,0,0)"/>
<path d="M156,17L173,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="215,17 204,21 204,12" style="fill:rgb(0,0,0)"/>
<path d="M179,17L209,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,32L314,32L314,2L215,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M314,17L354,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M386,62L550,62L550,32L386,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="468" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-constraint</text>
<polygon points="550,17 539,21 539,12" style="fill:rgb(0,0,0)"/>
<path d="M359,17L545,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="604,17 593,21 593,12" style="fill:rgb(0,0,0)"/>
<path d="M550,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="608" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="265,42 253,47 253,38" style="fill:rgb(0,0,0)"/>
<path d="M179,17 L 187,17 Q 194,17 194,30 Q 194,42 209,42 L 244,42 L 259,42"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,42 L 314,42 Q 329,42 329,30 Q 329,17 337,17 L 344,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="550,47 562,43 562,51" style="fill:rgb(0,0,0)"/>
<path d="M550,17 L 562,17 Q 574,17 574,32 L 574,32 Q 574,47 565,47 L 556,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="399,17 388,21 388,12" style="fill:rgb(0,0,0)"/>
<path d="M386,47 L 375,47 Q 363,47 363,32 L 363,32 Q 363,17 378,17 L 379,17 L 394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#alter-table-stmt">alter-table-stmt</a>&nbsp;&nbsp; <a href="#create-table-stmt">create-table-stmt</a><br></br>
References:&nbsp;&nbsp; <a href="#column-constraint">column-constraint</a>&nbsp;&nbsp; <a href="#type-name">type-name</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_altertable.html#altertabaddcol">lang_altertable.html#altertabaddcol</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtable.html#tablecoldef">lang_createtable.html#tablecoldef</a>
</div>

<a name="column-name-list"></a><h4>column-name-list:</h4><div class='imgcontainer'>
<div style="max-width:353px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 353.621 72.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="85,17 74,21 74,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L79,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,17 110,21 110,12" style="fill:rgb(0,0,0)"/>
<path d="M85,17L115,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,32L230,32A15 15 0 0 0 245 17A15 15 0 0 0 230 2L136,2A15 15 0 0 0 121 17A15 15 0 0 0 136 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="290,17 279,21 279,12" style="fill:rgb(0,0,0)"/>
<path d="M245,17L285,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M306,32A15 15 0 0 0 321 17A15 15 0 0 0 306 2A15 15 0 0 0 290 17A15 15 0 0 0 306 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="306" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="344,17 332,21 332,12" style="fill:rgb(0,0,0)"/>
<path d="M321,17L338,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="347" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M183,70A15 15 0 0 0 198 55L198,55A15 15 0 0 0 183 39A15 15 0 0 0 168 55L168,55A15 15 0 0 0 183 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="198,55 210,50 210,59" style="fill:rgb(0,0,0)"/>
<path d="M245,17 L 257,17 Q 269,17 269,32 L 269,40 Q 269,55 254,55 L 219,55 L 204,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,17 110,21 110,12" style="fill:rgb(0,0,0)"/>
<path d="M168,55 L 102,55 Q 87,55 87,40 L 87,32 Q 87,17 101,17 L 115,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#update-stmt">update-stmt</a>&nbsp;&nbsp; <a href="#update-stmt-limited">update-stmt-limited</a>&nbsp;&nbsp; <a href="#upsert-clause">upsert-clause</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>
</div>

<a name="comment-syntax"></a><h4>comment-syntax:</h4><div class='imgcontainer'>
<div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.704 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32A15 15 0 0 0 98 17A15 15 0 0 0 83 2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">--</text>
<polygon points="121,17 110,21 110,12" style="fill:rgb(0,0,0)"/>
<path d="M98,17L115,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M172,70L359,70A15 15 0 0 0 374 55L374,55A15 15 0 0 0 359 39L172,39A15 15 0 0 0 157 55L157,55A15 15 0 0 0 172 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="266" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">anything-except-newline</text>
<polygon points="347,17 336,21 336,12" style="fill:rgb(0,0,0)"/>
<path d="M121,17L342,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="374,55 386,50 386,59" style="fill:rgb(0,0,0)"/>
<path d="M347,17 L 382,17 Q 397,17 397,32 L 397,40 Q 397,55 389,55 L 380,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="194,17 183,21 183,12" style="fill:rgb(0,0,0)"/>
<path d="M157,55 L 146,55 Q 134,55 134,40 L 134,32 Q 134,17 149,17 L 173,17 L 188,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="464,17 453,21 453,12" style="fill:rgb(0,0,0)"/>
<path d="M374,17L459,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,32L527,32A15 15 0 0 0 542 17A15 15 0 0 0 527 2L480,2A15 15 0 0 0 464 17A15 15 0 0 0 480 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="503" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">newline</text>
<path d="M480,70L563,70A15 15 0 0 0 578 55L578,55A15 15 0 0 0 563 39L480,39A15 15 0 0 0 464 55L464,55A15 15 0 0 0 480 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="521" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">end-of-input</text>
<polygon points="601,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M578,55L595,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M601,55 L 608,55 Q 616,55 616,40 L 616,32 Q 616,17 631,17 L 631,17 L 646,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M542,17L632,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="464,55 453,59 453,50" style="fill:rgb(0,0,0)"/>
<path d="M374,17 L 412,17 Q 427,17 427,32 L 427,40 Q 427,55 442,55 L 444,55 L 459,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,108A15 15 0 0 0 98 92A15 15 0 0 0 83 77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">/*</text>
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,92 110,97 110,88" style="fill:rgb(0,0,0)"/>
<path d="M98,92L115,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,92L193,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M172,145L308,145A15 15 0 0 0 323 130A15 15 0 0 0 308 115L172,115A15 15 0 0 0 157 130A15 15 0 0 0 172 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="240" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">anything-except-*/</text>
<path d="M480,108A15 15 0 0 0 495 92A15 15 0 0 0 480 77A15 15 0 0 0 464 92A15 15 0 0 0 480 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="480" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*/</text>
<polygon points="323,130 334,126 334,135" style="fill:rgb(0,0,0)"/>
<path d="M323,92 L 334,92 Q 346,92 346,107 L 346,115 Q 346,130 337,130 L 328,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="464,92 453,97 453,88" style="fill:rgb(0,0,0)"/>
<path d="M157,130 L 146,130 Q 134,130 134,115 L 134,107 Q 134,92 149,92 L 444,92 L 459,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="601,92 589,97 589,88" style="fill:rgb(0,0,0)"/>
<path d="M495,92L595,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M601,92 L 608,92 Q 616,92 616,77 L 616,54 L 616,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,92 L 419,92 Q 427,92 427,77 L 427,70 Q 427,55 440,55 L 453,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<br></br>
See also:&nbsp;&nbsp; <a href="lang_comment.html">lang_comment.html</a>
</div>

<a name="commit-stmt"></a><h4>commit-stmt:</h4><div class='imgcontainer'>
<div style="max-width:434px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 434.506 72.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L141,32A15 15 0 0 0 157 17A15 15 0 0 0 141 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COMMIT</text>
<polygon points="202,17 190,21 190,12" style="fill:rgb(0,0,0)"/>
<path d="M157,17L196,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M202,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M253,32L365,32A15 15 0 0 0 380 17A15 15 0 0 0 365 2L253,2A15 15 0 0 0 238 17A15 15 0 0 0 253 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="309" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRANSACTION</text>
<polygon points="425,17 413,21 413,12" style="fill:rgb(0,0,0)"/>
<path d="M380,17L419,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="428" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,70L104,70A15 15 0 0 0 119 55L119,55A15 15 0 0 0 104 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="94" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="157,55 145,59 145,50" style="fill:rgb(0,0,0)"/>
<path d="M119,55L151,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M157,55 L 164,55 Q 172,55 172,40 L 172,32 Q 172,17 179,17 L 187,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="309,47 297,51 297,43" style="fill:rgb(0,0,0)"/>
<path d="M202,17 L 209,17 Q 217,17 217,32 L 217,32 Q 217,47 232,47 L 288,47 L 303,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,47 L 380,47 Q 395,47 395,32 L 395,32 Q 395,17 402,17 L 410,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_transaction.html">lang_transaction.html</a>
</div>

<a name="common-table-expression"></a><h4>common-table-expression:</h4><div class='imgcontainer'>
<div style="max-width:638px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 638.525 167.4">
<circle cx="5" cy="29" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,29 20,33 20,24" style="fill:rgb(0,0,0)"/>
<path d="M9,29L26,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,44L122,44A15 15 0 0 0 137 29A15 15 0 0 0 122 14L47,14A15 15 0 0 0 32 29A15 15 0 0 0 47 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="160,29 149,33 149,24" style="fill:rgb(0,0,0)"/>
<path d="M137,29L155,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="196,29 185,33 185,24" style="fill:rgb(0,0,0)"/>
<path d="M160,29L191,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,44A15 15 0 0 0 227 29A15 15 0 0 0 211 14A15 15 0 0 0 196 29A15 15 0 0 0 211 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="250,29 238,33 238,24" style="fill:rgb(0,0,0)"/>
<path d="M227,29L244,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="286,29 274,33 274,24" style="fill:rgb(0,0,0)"/>
<path d="M250,29L280,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M301,44L395,44A15 15 0 0 0 410 29A15 15 0 0 0 395 14L301,14A15 15 0 0 0 286 29A15 15 0 0 0 301 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="29" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="446,29 434,33 434,24" style="fill:rgb(0,0,0)"/>
<path d="M410,29L440,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,44A15 15 0 0 0 476 29A15 15 0 0 0 461 14A15 15 0 0 0 446 29A15 15 0 0 0 461 44Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="29" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,29 499,33 499,24" style="fill:rgb(0,0,0)"/>
<path d="M476,29L505,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,165L51,165A15 15 0 0 0 66 150A15 15 0 0 0 51 135L47,135A15 15 0 0 0 32 150A15 15 0 0 0 47 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="49" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<path d="M127,135L147,135A15 15 0 0 0 162 119A15 15 0 0 0 147 104L127,104A15 15 0 0 0 112 119A15 15 0 0 0 127 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<path d="M219,135L337,135A15 15 0 0 0 352 119A15 15 0 0 0 337 104L219,104A15 15 0 0 0 204 119A15 15 0 0 0 219 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="119" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<path d="M162,119L204,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,165A15 15 0 0 0 425 150A15 15 0 0 0 410 135A15 15 0 0 0 395 150A15 15 0 0 0 410 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="410" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="448,150 437,154 437,145" style="fill:rgb(0,0,0)"/>
<path d="M425,150L442,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,165L552,165L552,135L448,135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="500" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="575,150 564,154 564,145" style="fill:rgb(0,0,0)"/>
<path d="M552,150L570,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M591,165A15 15 0 0 0 606 150A15 15 0 0 0 591 135A15 15 0 0 0 575 150A15 15 0 0 0 591 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="150" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="629,150 617,154 617,145" style="fill:rgb(0,0,0)"/>
<path d="M606,150L623,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="632" cy="150" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,82A15 15 0 0 0 363 66A15 15 0 0 0 348 51A15 15 0 0 0 333 66A15 15 0 0 0 348 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="363,66 374,62 374,71" style="fill:rgb(0,0,0)"/>
<path d="M410,29 L 417,29 Q 425,29 425,44 L 425,51 Q 425,66 410,66 L 384,66 L 369,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M333,66 L 278,66 Q 263,66 263,51 L 263,44 Q 263,29 270,29 L 278,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,93 78,89 78,97" style="fill:rgb(0,0,0)"/>
<path d="M511,29 L 516,29 Q 522,29 522,44 L 522,78 Q 522,93 507,93 L 87,93 L 72,93"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,150 20,154 20,145" style="fill:rgb(0,0,0)"/>
<path d="M66,93 L 30,93 Q 15,93 15,108 L 15,135 Q 15,150 20,150 L 26,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="85,150 73,154 73,145" style="fill:rgb(0,0,0)"/>
<path d="M66,150L79,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="112,119 101,124 101,115" style="fill:rgb(0,0,0)"/>
<path d="M85,150 L 89,150 Q 92,150 92,135 L 92,134 Q 92,119 99,119 L 106,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="204,119 192,124 192,115" style="fill:rgb(0,0,0)"/>
<path d="M66,150 L 147,150 Q 162,150 170,150 Q 177,150 177,135 L 177,134 Q 177,119 188,119 L 198,119"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,150 383,154 383,145" style="fill:rgb(0,0,0)"/>
<path d="M352,119 L 360,119 Q 367,119 367,134 L 367,135 Q 367,150 378,150 L 389,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150L395,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,6 336,10 336,2" style="fill:rgb(0,0,0)"/>
<path d="M160,29 L 168,29 Q 175,29 175,17 Q 175,6 190,6 L 327,6 L 342,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,6 L 473,6 Q 488,6 488,17 Q 488,29 495,29 L 503,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#compound-select-stmt">compound-select-stmt</a>&nbsp;&nbsp; <a href="#delete-stmt">delete-stmt</a>&nbsp;&nbsp; <a href="#delete-stmt-limited">delete-stmt-limited</a>&nbsp;&nbsp; <a href="#factored-select-stmt">factored-select-stmt</a>&nbsp;&nbsp; <a href="#insert-stmt">insert-stmt</a>&nbsp;&nbsp; <a href="#select-stmt">select-stmt</a>&nbsp;&nbsp; <a href="#simple-select-stmt">simple-select-stmt</a>&nbsp;&nbsp; <a href="#update-stmt">update-stmt</a>&nbsp;&nbsp; <a href="#update-stmt-limited">update-stmt-limited</a><br></br>
References:&nbsp;&nbsp; <a href="#select-stmt">select-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="compound-operator"></a><h4>compound-operator:</h4><div class='imgcontainer'>
<div style="max-width:293px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 293.842 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L127,32A15 15 0 0 0 142 17A15 15 0 0 0 127 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,70L127,70A15 15 0 0 0 142 55L142,55A15 15 0 0 0 127 39L83,39A15 15 0 0 0 68 55L68,55A15 15 0 0 0 83 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M83,108L168,108A15 15 0 0 0 183 92A15 15 0 0 0 168 77L83,77A15 15 0 0 0 68 92A15 15 0 0 0 83 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M83,145L135,145A15 15 0 0 0 150 130A15 15 0 0 0 135 115L83,115A15 15 0 0 0 68 130A15 15 0 0 0 83 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M142,55L159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70L195,70A15 15 0 0 0 210 55L210,55A15 15 0 0 0 195 39L180,39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="233,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M210,55L227,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,17 272,21 272,12" style="fill:rgb(0,0,0)"/>
<path d="M233,55 L 240,55 Q 248,55 248,40 L 248,32 Q 248,17 263,17 L 263,17 L 278,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="288" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,55 56,59 56,50" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,40 Q 47,55 55,55 L 62,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,92 56,97 56,88" style="fill:rgb(0,0,0)"/>
<path d="M47,39 L 47,77 Q 47,92 55,92 L 62,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,92 221,97 221,88" style="fill:rgb(0,0,0)"/>
<path d="M183,92L227,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,92 L 240,92 Q 248,92 248,77 L 248,54 L 248,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,130 56,135 56,126" style="fill:rgb(0,0,0)"/>
<path d="M47,77 L 47,115 Q 47,130 55,130 L 62,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,130 221,135 221,126" style="fill:rgb(0,0,0)"/>
<path d="M150,130L227,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M233,130 L 240,130 Q 248,130 248,115 L 248,92 L 248,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#factored-select-stmt">factored-select-stmt</a>&nbsp;&nbsp; <a href="#select-stmt">select-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="compound-select-stmt"></a><h4>compound-select-stmt:</h4><div class='imgcontainer'>
<div style="max-width:652px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 652.306 560.52">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L114,32A15 15 0 0 0 129 17A15 15 0 0 0 114 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="98" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M189,62L275,62A15 15 0 0 0 290 47L290,47A15 15 0 0 0 275 32L189,32A15 15 0 0 0 174 47L174,47A15 15 0 0 0 189 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="232" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="232,17 220,21 220,12" style="fill:rgb(0,0,0)"/>
<path d="M129,17L226,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,17 368,21 368,12" style="fill:rgb(0,0,0)"/>
<path d="M232,17L374,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,32L606,32L606,2L380,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="174,47 162,51 162,43" style="fill:rgb(0,0,0)"/>
<path d="M129,17 L 136,17 Q 144,17 144,32 L 144,32 Q 144,47 156,47 L 168,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,47 301,51 301,43" style="fill:rgb(0,0,0)"/>
<path d="M290,47L307,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,47 L 321,47 Q 328,47 328,32 L 328,32 Q 328,17 343,17 L 353,17 L 368,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,70A15 15 0 0 0 508 55L508,55A15 15 0 0 0 493 39A15 15 0 0 0 478 55L478,55A15 15 0 0 0 493 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="508,55 520,50 520,59" style="fill:rgb(0,0,0)"/>
<path d="M606,17 L 614,17 Q 621,17 621,32 L 621,40 Q 621,55 606,55 L 529,55 L 514,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,55 L 372,55 Q 357,55 357,40 L 357,32 Q 357,17 363,17 L 368,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M68,183L171,183L171,153L68,153Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="120" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-core</text>
<path d="M83,365L128,365A15 15 0 0 0 143 349A15 15 0 0 0 128 334L83,334A15 15 0 0 0 68 349A15 15 0 0 0 83 365Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="105" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="166,349 154,354 154,345" style="fill:rgb(0,0,0)"/>
<path d="M143,349L160,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M181,365L185,365A15 15 0 0 0 200 349A15 15 0 0 0 185 334L181,334A15 15 0 0 0 166 349A15 15 0 0 0 181 365Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M83,470L116,470A15 15 0 0 0 132 455A15 15 0 0 0 116 440L83,440A15 15 0 0 0 68 455A15 15 0 0 0 83 470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="100" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="155,455 143,460 143,451" style="fill:rgb(0,0,0)"/>
<path d="M132,455L149,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M155,470L204,470L204,440L155,440Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="179" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="68,168 56,172 56,164" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,32 L 47,153 Q 47,168 55,168 L 62,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="335,92 346,88 346,97" style="fill:rgb(0,0,0)"/>
<path d="M606,17 L 627,17 Q 642,17 642,32 L 642,77 Q 642,92 627,92 L 356,92 L 341,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M335,92 L 62,92 Q 47,92 47,100 L 47,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,168 232,172 232,164" style="fill:rgb(0,0,0)"/>
<path d="M171,168L238,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,183L302,183A15 15 0 0 0 317 168A15 15 0 0 0 302 153L259,153A15 15 0 0 0 243 168A15 15 0 0 0 259 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M259,221L302,221A15 15 0 0 0 317 206A15 15 0 0 0 302 191L259,191A15 15 0 0 0 243 206A15 15 0 0 0 259 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<polygon points="340,206 329,210 329,201" style="fill:rgb(0,0,0)"/>
<path d="M317,206L335,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M355,221L370,221A15 15 0 0 0 386 206A15 15 0 0 0 370 191L355,191A15 15 0 0 0 340 206A15 15 0 0 0 355 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="409,206 397,210 397,201" style="fill:rgb(0,0,0)"/>
<path d="M386,206L403,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,168 435,172 435,164" style="fill:rgb(0,0,0)"/>
<path d="M409,206 L 416,206 Q 424,206 424,191 L 424,183 Q 424,168 432,168 L 441,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M447,183L550,183L550,153L447,153Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="498" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-core</text>
<path d="M259,259L343,259A15 15 0 0 0 359 244A15 15 0 0 0 343 228L259,228A15 15 0 0 0 243 244A15 15 0 0 0 259 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="301" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTERSECT</text>
<path d="M259,297L310,297A15 15 0 0 0 325 281A15 15 0 0 0 310 266L259,266A15 15 0 0 0 243 281A15 15 0 0 0 259 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="284" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCEPT</text>
<polygon points="243,281 232,286 232,277" style="fill:rgb(0,0,0)"/>
<path d="M205,168 L 213,168 Q 220,168 220,183 L 220,266 Q 220,281 229,281 L 238,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,244 232,248 232,239" style="fill:rgb(0,0,0)"/>
<path d="M220,228 L 220,236 Q 220,244 229,244 L 238,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,206 232,210 232,201" style="fill:rgb(0,0,0)"/>
<path d="M220,191 L 220,198 Q 220,206 229,206 L 238,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="409,244 397,248 397,239" style="fill:rgb(0,0,0)"/>
<path d="M359,244L403,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,244 L 416,244 Q 424,244 424,229 L 424,206 L 424,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="409,281 397,286 397,277" style="fill:rgb(0,0,0)"/>
<path d="M325,281L403,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,281 L 416,281 Q 424,281 424,266 L 424,243 L 424,228"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,168L435,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,138 389,133 389,142" style="fill:rgb(0,0,0)"/>
<path d="M550,168 L 558,168 Q 565,168 565,153 L 565,153 Q 565,138 550,138 L 399,138 L 384,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M378,138 L 205,138 Q 190,138 190,153 L 190,153 Q 190,168 198,168 L 205,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="319,315 331,311 331,320" style="fill:rgb(0,0,0)"/>
<path d="M550,168 L 571,168 Q 586,168 586,183 L 586,300 Q 586,315 571,315 L 340,315 L 325,315"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,349 56,354 56,345" style="fill:rgb(0,0,0)"/>
<path d="M319,315 L 62,315 Q 47,315 47,330 L 47,334 Q 47,349 55,349 L 62,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,349 234,354 234,345" style="fill:rgb(0,0,0)"/>
<path d="M200,349L239,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,365L375,365L375,334L245,334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,402A15 15 0 0 0 325 387A15 15 0 0 0 310 372A15 15 0 0 0 295 387A15 15 0 0 0 310 402Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="387" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,387 337,383 337,392" style="fill:rgb(0,0,0)"/>
<path d="M375,349 L 382,349 Q 390,349 390,364 L 390,372 Q 390,387 375,387 L 346,387 L 331,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,387 L 237,387 Q 222,387 222,372 L 222,364 Q 222,349 228,349 L 234,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,380 407,368 415,368" style="fill:rgb(0,0,0)"/>
<path d="M375,349 L 396,349 Q 411,349 411,362 L 411,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="221,421 233,417 233,426" style="fill:rgb(0,0,0)"/>
<path d="M411,380 L 411,406 Q 411,421 396,421 L 242,421 L 227,421"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,455 56,460 56,451" style="fill:rgb(0,0,0)"/>
<path d="M221,421 L 62,421 Q 47,421 47,436 L 47,440 Q 47,455 55,455 L 62,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,387 43,376 51,376" style="fill:rgb(0,0,0)"/>
<path d="M47,334L47,382"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,387L47,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,501L329,501A15 15 0 0 0 344 486A15 15 0 0 0 329 470L278,470A15 15 0 0 0 263 486A15 15 0 0 0 278 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="304" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="367,486 356,490 356,481" style="fill:rgb(0,0,0)"/>
<path d="M344,486L362,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M367,501L417,501L417,470L367,470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="392" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="440,486 428,490 428,481" style="fill:rgb(0,0,0)"/>
<path d="M417,486L434,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,538A15 15 0 0 0 293 523A15 15 0 0 0 278 508A15 15 0 0 0 263 523A15 15 0 0 0 278 538Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="523" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="316,523 305,528 305,519" style="fill:rgb(0,0,0)"/>
<path d="M293,523L310,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,538L365,538L365,508L316,508Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="341" y="523" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="227,455 215,460 215,451" style="fill:rgb(0,0,0)"/>
<path d="M204,455L221,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="263,523 251,528 251,519" style="fill:rgb(0,0,0)"/>
<path d="M227,455 L 234,455 Q 242,455 242,470 L 242,508 Q 242,523 249,523 L 257,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="263,486 251,490 251,481" style="fill:rgb(0,0,0)"/>
<path d="M227,455 L 234,455 Q 242,455 242,470 L 242,471 Q 242,486 249,486 L 257,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="440,455 428,460 428,451" style="fill:rgb(0,0,0)"/>
<path d="M227,455L434,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="642,554 631,558 631,549" style="fill:rgb(0,0,0)"/>
<path d="M440,455 L 461,455 Q 476,455 476,470 L 476,539 Q 476,554 491,554 L 622,554 L 637,554"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="646" cy="554" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M440,486 L 461,486 Q 476,486 476,493 L 476,501"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="440,523 428,528 428,519" style="fill:rgb(0,0,0)"/>
<path d="M365,523L434,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M440,523 L 461,523 Q 476,523 476,531 L 476,538"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="440,554 428,558 428,549" style="fill:rgb(0,0,0)"/>
<path d="M47,440 L 47,539 Q 47,554 62,554 L 419,554 L 434,554"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M440,554L512,554"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<br></br>
References:&nbsp;&nbsp; <a href="#common-table-expression">common-table-expression</a>&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#ordering-term">ordering-term</a>&nbsp;&nbsp; <a href="#select-core">select-core</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>
</div>

<a name="conflict-clause"></a><h4>conflict-clause:</h4><div class='imgcontainer'>
<div style="max-width:451px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 451.517 205.2">
<circle cx="5" cy="6" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,6 20,10 20,2" style="fill:rgb(0,0,0)"/>
<path d="M9,6L26,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,36 58,41 58,32" style="fill:rgb(0,0,0)"/>
<path d="M32,6 L 39,6 Q 47,6 47,21 L 47,21 Q 47,36 56,36 L 64,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M85,51L94,51A15 15 0 0 0 109 36L109,36A15 15 0 0 0 94 21L85,21A15 15 0 0 0 70 36L70,36A15 15 0 0 0 85 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="90" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="132,36 121,41 121,32" style="fill:rgb(0,0,0)"/>
<path d="M109,36L126,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M147,51L222,51A15 15 0 0 0 237 36L237,36A15 15 0 0 0 222 21L147,21A15 15 0 0 0 132 36L132,36A15 15 0 0 0 147 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONFLICT</text>
<polygon points="273,36 261,41 261,32" style="fill:rgb(0,0,0)"/>
<path d="M237,36L267,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,51L365,51A15 15 0 0 0 381 36L381,36A15 15 0 0 0 365 21L288,21A15 15 0 0 0 273 36L273,36A15 15 0 0 0 288 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="327" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<path d="M288,89L330,89A15 15 0 0 0 345 74L345,74A15 15 0 0 0 330 59L288,59A15 15 0 0 0 273 74L273,74A15 15 0 0 0 288 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="309" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<path d="M288,127L310,127A15 15 0 0 0 325 112A15 15 0 0 0 310 97L288,97A15 15 0 0 0 273 112A15 15 0 0 0 288 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<path d="M288,165L340,165A15 15 0 0 0 355 150A15 15 0 0 0 340 135L288,135A15 15 0 0 0 273 150A15 15 0 0 0 288 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="314" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<path d="M288,203L352,203A15 15 0 0 0 367 187A15 15 0 0 0 352 172L288,172A15 15 0 0 0 273 187A15 15 0 0 0 288 203Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="320" y="187" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<polygon points="404,36 392,41 392,32" style="fill:rgb(0,0,0)"/>
<path d="M381,36L398,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="442,6 430,10 430,2" style="fill:rgb(0,0,0)"/>
<path d="M404,36 L 411,36 Q 419,36 419,21 L 419,21 Q 419,6 427,6 L 436,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="445" cy="6" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="225,6 214,10 214,2" style="fill:rgb(0,0,0)"/>
<path d="M9,6L219,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,6L434,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,187 261,192 261,183" style="fill:rgb(0,0,0)"/>
<path d="M237,36 L 244,36 Q 252,36 252,51 L 252,172 Q 252,187 259,187 L 267,187"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,187 392,192 392,183" style="fill:rgb(0,0,0)"/>
<path d="M367,187L398,187"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,187 L 411,187 Q 419,187 419,172 L 419,36 L 419,21"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,74 261,78 261,70" style="fill:rgb(0,0,0)"/>
<path d="M252,59 L 252,66 Q 252,74 259,74 L 267,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,74 392,78 392,70" style="fill:rgb(0,0,0)"/>
<path d="M345,74L398,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,74 L 411,74 Q 419,74 419,67 L 419,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,112 261,116 261,108" style="fill:rgb(0,0,0)"/>
<path d="M252,97 L 252,104 Q 252,112 259,112 L 267,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,112 392,116 392,108" style="fill:rgb(0,0,0)"/>
<path d="M325,112L398,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,112 L 411,112 Q 419,112 419,104 L 419,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,150 261,154 261,145" style="fill:rgb(0,0,0)"/>
<path d="M252,135 L 252,142 Q 252,150 259,150 L 267,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="404,150 392,154 392,145" style="fill:rgb(0,0,0)"/>
<path d="M355,150L398,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,150 L 411,150 Q 419,150 419,142 L 419,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#column-constraint">column-constraint</a>&nbsp;&nbsp; <a href="#table-constraint">table-constraint</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_conflict.html">lang_conflict.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtable.html#notnullconst">lang_createtable.html#notnullconst</a>
</div>

<a name="create-index-stmt"></a><h4>create-index-stmt:</h4><div class='imgcontainer'>
<div style="max-width:907px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 907.43 232.632">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L100,32A15 15 0 0 0 116 17A15 15 0 0 0 100 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CREATE</text>
<path d="M167,56L222,56A15 15 0 0 0 237 41A15 15 0 0 0 222 26L167,26A15 15 0 0 0 152 41A15 15 0 0 0 167 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNIQUE</text>
<path d="M288,32L327,32A15 15 0 0 0 342 17A15 15 0 0 0 327 2L288,2A15 15 0 0 0 273 17A15 15 0 0 0 288 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="307" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEX</text>
<polygon points="194,17 183,21 183,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L188,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,17 261,21 261,12" style="fill:rgb(0,0,0)"/>
<path d="M194,17L267,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,41 140,45 140,37" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,29 Q 131,41 138,41 L 146,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M237,41 L 244,41 Q 252,41 252,29 Q 252,17 256,17 L 261,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,17 367,21 367,12" style="fill:rgb(0,0,0)"/>
<path d="M342,17L372,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,32A15 15 0 0 0 408 17A15 15 0 0 0 393 2A15 15 0 0 0 378 17A15 15 0 0 0 393 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="393" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="431,17 420,21 420,12" style="fill:rgb(0,0,0)"/>
<path d="M408,17L426,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M447,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L447,2A15 15 0 0 0 431 17A15 15 0 0 0 447 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="457" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="505,17 493,21 493,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L499,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M520,32L565,32A15 15 0 0 0 580 17A15 15 0 0 0 565 2L520,2A15 15 0 0 0 505 17A15 15 0 0 0 520 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="542" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="194,71 206,67 206,76" style="fill:rgb(0,0,0)"/>
<path d="M342,17 L 350,17 Q 357,17 357,32 L 357,56 Q 357,71 342,71 L 215,71 L 200,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,71 516,67 516,76" style="fill:rgb(0,0,0)"/>
<path d="M580,17 L 601,17 Q 616,17 616,32 L 616,56 Q 616,71 601,71 L 526,71 L 511,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,71L273,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,109 17,113 17,105" style="fill:rgb(0,0,0)"/>
<path d="M273,71 L 20,71 Q 5,71 5,86 L 5,94 Q 5,109 14,109 L 23,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,124L140,124A15 15 0 0 0 155 109A15 15 0 0 0 140 94L43,94A15 15 0 0 0 28 109A15 15 0 0 0 43 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="178,109 166,113 166,105" style="fill:rgb(0,0,0)"/>
<path d="M155,109L172,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M193,124A15 15 0 0 0 208 109A15 15 0 0 0 193 94A15 15 0 0 0 178 109A15 15 0 0 0 193 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="109" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="244,109 233,113 233,105" style="fill:rgb(0,0,0)"/>
<path d="M208,109L238,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,124L338,124A15 15 0 0 0 353 109A15 15 0 0 0 338 94L259,94A15 15 0 0 0 244 109A15 15 0 0 0 259 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<polygon points="376,109 364,113 364,105" style="fill:rgb(0,0,0)"/>
<path d="M353,109L370,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,124L400,124A15 15 0 0 0 415 109A15 15 0 0 0 400 94L391,94A15 15 0 0 0 376 109A15 15 0 0 0 391 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="438,109 427,113 427,105" style="fill:rgb(0,0,0)"/>
<path d="M415,109L432,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,124L528,124A15 15 0 0 0 543 109A15 15 0 0 0 528 94L453,94A15 15 0 0 0 438 109A15 15 0 0 0 453 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="491" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="567,109 555,113 555,105" style="fill:rgb(0,0,0)"/>
<path d="M543,109L561,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,124A15 15 0 0 0 597 109A15 15 0 0 0 582 94A15 15 0 0 0 567 109A15 15 0 0 0 582 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="109" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="633,109 621,113 621,105" style="fill:rgb(0,0,0)"/>
<path d="M597,109L627,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M633,124L777,124L777,94L633,94Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="705" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">indexed-column</text>
<polygon points="813,109 802,113 802,105" style="fill:rgb(0,0,0)"/>
<path d="M777,109L808,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M828,124A15 15 0 0 0 844 109A15 15 0 0 0 828 94A15 15 0 0 0 813 109A15 15 0 0 0 828 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="828" y="109" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<path d="M705,162A15 15 0 0 0 720 147A15 15 0 0 0 705 132A15 15 0 0 0 690 147A15 15 0 0 0 705 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="705" y="147" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="720,147 732,142 732,151" style="fill:rgb(0,0,0)"/>
<path d="M777,109 L 785,109 Q 792,109 792,124 L 792,132 Q 792,147 777,147 L 741,147 L 726,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M690,147 L 625,147 Q 610,147 610,132 L 610,124 Q 610,109 617,109 L 625,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="92,139 80,144 80,135" style="fill:rgb(0,0,0)"/>
<path d="M5,94 L 5,124 Q 5,139 20,139 L 71,139 L 86,139"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M92,139 L 205,139 Q 220,139 220,124 L 220,124 Q 220,109 227,109 L 235,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M684,230L733,230A15 15 0 0 0 748 215A15 15 0 0 0 733 200L684,200A15 15 0 0 0 669 215A15 15 0 0 0 684 230Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="709" y="215" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="772,215 760,219 760,211" style="fill:rgb(0,0,0)"/>
<path d="M748,215L766,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M772,230L821,230L821,200L772,200Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="796" y="215" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="898,215 886,219 886,211" style="fill:rgb(0,0,0)"/>
<path d="M821,215L892,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="901" cy="215" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="859,147 854,135 863,135" style="fill:rgb(0,0,0)"/>
<path d="M844,109 L 851,109 Q 859,109 859,124 L 859,126 L 859,141"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M859,147 L 859,200 Q 859,215 872,215 L 886,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="705,177 717,173 717,181" style="fill:rgb(0,0,0)"/>
<path d="M859,147 L 859,162 Q 859,177 844,177 L 726,177 L 711,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="669,215 657,219 657,211" style="fill:rgb(0,0,0)"/>
<path d="M705,177 L 661,177 Q 646,177 646,192 L 646,200 Q 646,215 654,215 L 663,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#indexed-column">indexed-column</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="create-table-stmt"></a><h4>create-table-stmt:</h4><div class='imgcontainer'>
<div style="max-width:718px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 718.33 315.792">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L100,32A15 15 0 0 0 116 17A15 15 0 0 0 100 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CREATE</text>
<path d="M167,56L199,56A15 15 0 0 0 214 41A15 15 0 0 0 199 26L167,26A15 15 0 0 0 152 41A15 15 0 0 0 167 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMP</text>
<path d="M167,94L259,94A15 15 0 0 0 274 79A15 15 0 0 0 259 64L167,64A15 15 0 0 0 152 79A15 15 0 0 0 167 94Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="213" y="79" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMPORARY</text>
<path d="M325,32L365,32A15 15 0 0 0 380 17A15 15 0 0 0 365 2L325,2A15 15 0 0 0 310 17A15 15 0 0 0 325 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TABLE</text>
<polygon points="213,17 201,21 201,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L207,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="310,17 299,21 299,12" style="fill:rgb(0,0,0)"/>
<path d="M213,17L305,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,41 140,45 140,37" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,29 Q 131,41 138,41 L 146,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,79 140,83 140,74" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,32 L 131,64 Q 131,79 138,79 L 146,79"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M274,79 L 282,79 Q 289,79 289,64 L 289,32 Q 289,17 294,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M214,41 L 274,41 Q 289,41 289,33 L 289,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="416,17 404,21 404,12" style="fill:rgb(0,0,0)"/>
<path d="M380,17L410,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,32A15 15 0 0 0 446 17A15 15 0 0 0 431 2A15 15 0 0 0 416 17A15 15 0 0 0 431 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="431" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="469,17 458,21 458,12" style="fill:rgb(0,0,0)"/>
<path d="M446,17L463,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M484,32L504,32A15 15 0 0 0 520 17A15 15 0 0 0 504 2L484,2A15 15 0 0 0 469 17A15 15 0 0 0 484 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="494" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="543,17 531,21 531,12" style="fill:rgb(0,0,0)"/>
<path d="M520,17L537,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,32L602,32A15 15 0 0 0 617 17A15 15 0 0 0 602 2L558,2A15 15 0 0 0 543 17A15 15 0 0 0 558 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="580" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="213,109 224,105 224,113" style="fill:rgb(0,0,0)"/>
<path d="M380,17 L 387,17 Q 395,17 395,32 L 395,94 Q 395,109 380,109 L 234,109 L 219,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="543,109 554,105 554,113" style="fill:rgb(0,0,0)"/>
<path d="M617,17 L 625,17 Q 632,17 632,32 L 632,94 Q 632,109 617,109 L 563,109 L 548,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M543,109L310,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,147 17,151 17,142" style="fill:rgb(0,0,0)"/>
<path d="M310,109 L 20,109 Q 5,109 5,124 L 5,132 Q 5,147 14,147 L 23,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,162L140,162A15 15 0 0 0 155 147A15 15 0 0 0 140 132L43,132A15 15 0 0 0 28 147A15 15 0 0 0 43 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="178,147 166,151 166,142" style="fill:rgb(0,0,0)"/>
<path d="M155,147L172,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M193,162A15 15 0 0 0 208 147A15 15 0 0 0 193 132A15 15 0 0 0 178 147A15 15 0 0 0 193 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="147" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="244,147 233,151 233,142" style="fill:rgb(0,0,0)"/>
<path d="M208,147L238,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,162L334,162A15 15 0 0 0 350 147A15 15 0 0 0 334 132L259,132A15 15 0 0 0 244 147A15 15 0 0 0 259 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="297" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="92,177 80,181 80,173" style="fill:rgb(0,0,0)"/>
<path d="M5,132 L 5,162 Q 5,177 20,177 L 71,177 L 86,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M92,177 L 205,177 Q 220,177 220,162 L 220,162 Q 220,147 227,147 L 235,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="193,222 205,218 205,227" style="fill:rgb(0,0,0)"/>
<path d="M350,147 L 357,147 Q 365,147 365,162 L 365,207 Q 365,222 350,222 L 214,222 L 199,222"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,260 17,265 17,256" style="fill:rgb(0,0,0)"/>
<path d="M193,222 L 20,222 Q 5,222 5,237 L 5,245 Q 5,260 14,260 L 23,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,275A15 15 0 0 0 59 260A15 15 0 0 0 43 245A15 15 0 0 0 28 260A15 15 0 0 0 43 275Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="43" y="260" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="95,260 83,265 83,256" style="fill:rgb(0,0,0)"/>
<path d="M59,260L89,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,275L199,275L199,245L95,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="147" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-def</text>
<path d="M253,313L399,313L399,283L253,283Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="326" y="298" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-constraint</text>
<polygon points="399,298 410,294 410,302" style="fill:rgb(0,0,0)"/>
<path d="M404,298L416,298"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,313A15 15 0 0 0 446 298A15 15 0 0 0 431 283A15 15 0 0 0 416 298A15 15 0 0 0 431 313Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="431" y="298" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M503,275A15 15 0 0 0 518 260A15 15 0 0 0 503 245A15 15 0 0 0 488 260A15 15 0 0 0 503 275Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="503" y="260" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="553,260 541,265 541,256" style="fill:rgb(0,0,0)"/>
<path d="M518,260L547,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M553,275L674,275L674,245L553,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="613" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-options</text>
<path d="M147,313A15 15 0 0 0 162 298A15 15 0 0 0 147 283A15 15 0 0 0 132 298A15 15 0 0 0 147 313Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="147" y="298" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="162,298 174,294 174,302" style="fill:rgb(0,0,0)"/>
<path d="M199,260 L 207,260 Q 214,260 214,275 L 214,283 Q 214,298 199,298 L 183,298 L 168,298"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,298 L 87,298 Q 72,298 72,283 L 72,275 Q 72,260 77,260 L 83,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="235,260 224,265 224,256" style="fill:rgb(0,0,0)"/>
<path d="M199,260L230,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="488,260 476,265 476,256" style="fill:rgb(0,0,0)"/>
<path d="M235,260L482,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,298 458,294 458,302" style="fill:rgb(0,0,0)"/>
<path d="M446,260 L 458,260 Q 469,260 469,275 L 469,283 Q 469,298 460,298 L 452,298"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M253,298 L 246,298 Q 238,298 238,283 L 238,275 Q 238,260 250,260 L 261,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="613,215 602,219 602,211" style="fill:rgb(0,0,0)"/>
<path d="M518,260 L 526,260 Q 533,260 533,245 L 533,230 Q 533,215 548,215 L 592,215 L 607,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="708,215 697,219 697,211" style="fill:rgb(0,0,0)"/>
<path d="M613,215 L 659,215 Q 674,215 688,215 L 703,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="712" cy="215" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="708,215 697,219 697,211" style="fill:rgb(0,0,0)"/>
<path d="M674,260 L 681,260 Q 689,260 689,245 L 689,230 Q 689,215 696,215 L 703,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="440,147 428,151 428,142" style="fill:rgb(0,0,0)"/>
<path d="M350,147L434,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,162L459,162A15 15 0 0 0 474 147A15 15 0 0 0 459 132L455,132A15 15 0 0 0 440 147A15 15 0 0 0 455 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="457" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="497,147 485,151 485,142" style="fill:rgb(0,0,0)"/>
<path d="M474,147L491,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M497,162L601,162L601,132L497,132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="549" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="637,147 626,151 626,142" style="fill:rgb(0,0,0)"/>
<path d="M601,147L631,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M637,147 L 674,147 Q 689,147 689,162 L 689,200 Q 689,215 696,215 L 704,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href="#column-def">column-def</a>&nbsp;&nbsp; <a href="#select-stmt">select-stmt</a>&nbsp;&nbsp; <a href="#table-constraint">table-constraint</a>&nbsp;&nbsp; <a href="#table-options">table-options</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>
</div>

<a name="create-trigger-stmt"></a><h4>create-trigger-stmt:</h4><div class='imgcontainer'>
<div style="max-width:678px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 678.058 746.712">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L100,32A15 15 0 0 0 116 17A15 15 0 0 0 100 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CREATE</text>
<path d="M167,56L199,56A15 15 0 0 0 214 41A15 15 0 0 0 199 26L167,26A15 15 0 0 0 152 41A15 15 0 0 0 167 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMP</text>
<path d="M167,94L259,94A15 15 0 0 0 274 79A15 15 0 0 0 259 64L167,64A15 15 0 0 0 152 79A15 15 0 0 0 167 94Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="213" y="79" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMPORARY</text>
<path d="M325,32L386,32A15 15 0 0 0 401 17A15 15 0 0 0 386 2L325,2A15 15 0 0 0 310 17A15 15 0 0 0 325 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRIGGER</text>
<polygon points="213,17 201,21 201,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L207,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="310,17 299,21 299,12" style="fill:rgb(0,0,0)"/>
<path d="M213,17L305,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,41 140,45 140,37" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,29 Q 131,41 138,41 L 146,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,79 140,83 140,74" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,32 L 131,64 Q 131,79 138,79 L 146,79"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M274,79 L 282,79 Q 289,79 289,64 L 289,32 Q 289,17 294,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M214,41 L 274,41 Q 289,41 289,33 L 289,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="437,17 425,21 425,12" style="fill:rgb(0,0,0)"/>
<path d="M401,17L431,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M452,32A15 15 0 0 0 467 17A15 15 0 0 0 452 2A15 15 0 0 0 437 17A15 15 0 0 0 452 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="452" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="490,17 478,21 478,12" style="fill:rgb(0,0,0)"/>
<path d="M467,17L484,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,32L525,32A15 15 0 0 0 540 17A15 15 0 0 0 525 2L505,2A15 15 0 0 0 490 17A15 15 0 0 0 505 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="515" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="563,17 552,21 552,12" style="fill:rgb(0,0,0)"/>
<path d="M540,17L558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,32L623,32A15 15 0 0 0 638 17A15 15 0 0 0 623 2L578,2A15 15 0 0 0 563 17A15 15 0 0 0 578 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="601" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="213,109 224,105 224,113" style="fill:rgb(0,0,0)"/>
<path d="M401,17 L 408,17 Q 416,17 416,32 L 416,94 Q 416,109 401,109 L 234,109 L 219,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="563,109 575,105 575,113" style="fill:rgb(0,0,0)"/>
<path d="M638,17 L 646,17 Q 653,17 653,32 L 653,94 Q 653,109 638,109 L 584,109 L 569,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M563,109L310,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,147 17,151 17,142" style="fill:rgb(0,0,0)"/>
<path d="M310,109 L 20,109 Q 5,109 5,124 L 5,132 Q 5,147 14,147 L 23,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,162L140,162A15 15 0 0 0 155 147A15 15 0 0 0 140 132L43,132A15 15 0 0 0 28 147A15 15 0 0 0 43 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="178,147 166,151 166,142" style="fill:rgb(0,0,0)"/>
<path d="M155,147L172,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M193,162A15 15 0 0 0 208 147A15 15 0 0 0 193 132A15 15 0 0 0 178 147A15 15 0 0 0 193 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="147" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="244,147 233,151 233,142" style="fill:rgb(0,0,0)"/>
<path d="M208,147L238,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,162L351,162A15 15 0 0 0 366 147A15 15 0 0 0 351 132L259,132A15 15 0 0 0 244 147A15 15 0 0 0 259 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="305" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">trigger-name</text>
<polygon points="402,147 391,151 391,142" style="fill:rgb(0,0,0)"/>
<path d="M366,147L396,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,162L472,162A15 15 0 0 0 487 147A15 15 0 0 0 472 132L417,132A15 15 0 0 0 402 147A15 15 0 0 0 417 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BEFORE</text>
<path d="M417,200L457,200A15 15 0 0 0 472 185A15 15 0 0 0 457 169L417,169A15 15 0 0 0 402 185A15 15 0 0 0 417 200Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="437" y="185" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AFTER</text>
<path d="M417,238L479,238A15 15 0 0 0 494 222A15 15 0 0 0 479 207L417,207A15 15 0 0 0 402 222A15 15 0 0 0 417 238Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="448" y="222" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INSTEAD</text>
<polygon points="517,222 505,227 505,218" style="fill:rgb(0,0,0)"/>
<path d="M494,222L511,222"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,238L538,238A15 15 0 0 0 553 222A15 15 0 0 0 538 207L532,207A15 15 0 0 0 517 222A15 15 0 0 0 532 238Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="535" y="222" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OF</text>
<polygon points="402,185 391,189 391,180" style="fill:rgb(0,0,0)"/>
<path d="M366,147 L 374,147 Q 381,147 381,162 L 381,170 Q 381,185 389,185 L 396,185"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="402,222 391,227 391,218" style="fill:rgb(0,0,0)"/>
<path d="M366,147 L 374,147 Q 381,147 381,162 L 381,207 Q 381,222 389,222 L 396,222"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="92,177 80,181 80,173" style="fill:rgb(0,0,0)"/>
<path d="M5,132 L 5,162 Q 5,177 20,177 L 71,177 L 86,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M92,177 L 205,177 Q 220,177 220,162 L 220,162 Q 220,147 227,147 L 235,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="193,260 205,256 205,265" style="fill:rgb(0,0,0)"/>
<path d="M381,207 L 381,245 Q 381,260 366,260 L 214,260 L 199,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="576,222 564,227 564,218" style="fill:rgb(0,0,0)"/>
<path d="M553,222L570,222"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="448,260 459,256 459,265" style="fill:rgb(0,0,0)"/>
<path d="M576,222 L 584,222 Q 591,222 591,237 L 591,245 Q 591,260 576,260 L 469,260 L 454,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,260L366,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="576,147 564,151 564,142" style="fill:rgb(0,0,0)"/>
<path d="M487,147L570,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M576,147 L 584,147 Q 591,147 591,162 L 591,223 L 591,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="576,185 564,189 564,180" style="fill:rgb(0,0,0)"/>
<path d="M472,185L570,185"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M576,185 L 584,185 Q 591,185 591,192 L 591,200"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,306L96,306A15 15 0 0 0 111 290L111,290A15 15 0 0 0 96 275L43,275A15 15 0 0 0 28 290L28,290A15 15 0 0 0 43 306Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="290" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DELETE</text>
<path d="M43,343L92,343A15 15 0 0 0 107 328A15 15 0 0 0 92 313L43,313A15 15 0 0 0 28 328A15 15 0 0 0 43 343Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="68" y="328" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INSERT</text>
<path d="M43,381L98,381A15 15 0 0 0 113 366A15 15 0 0 0 98 351L43,351A15 15 0 0 0 28 366A15 15 0 0 0 43 381Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="366" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="28,366 17,370 17,362" style="fill:rgb(0,0,0)"/>
<path d="M193,260 L 20,260 Q 5,260 5,275 L 5,351 Q 5,366 14,366 L 23,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,290 17,295 17,286" style="fill:rgb(0,0,0)"/>
<path d="M5,275 L 5,283 Q 5,290 14,290 L 23,290"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,328 17,333 17,324" style="fill:rgb(0,0,0)"/>
<path d="M5,313 L 5,321 Q 5,328 14,328 L 23,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M164,411L170,411A15 15 0 0 0 185 396A15 15 0 0 0 170 381L164,381A15 15 0 0 0 149 396A15 15 0 0 0 164 411Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="396" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OF</text>
<polygon points="221,396 209,401 209,392" style="fill:rgb(0,0,0)"/>
<path d="M185,396L215,396"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,411L330,411A15 15 0 0 0 345 396A15 15 0 0 0 330 381L236,381A15 15 0 0 0 221 396A15 15 0 0 0 236 411Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="283" y="396" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<path d="M283,449L283,449A15 15 0 0 0 298 434A15 15 0 0 0 283 419L283,419A15 15 0 0 0 268 434A15 15 0 0 0 283 449Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="283" y="434" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="381,396 369,401 369,392" style="fill:rgb(0,0,0)"/>
<path d="M345,396L375,396"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="419,290 408,295 408,286" style="fill:rgb(0,0,0)"/>
<path d="M381,396 L 388,396 Q 396,396 396,381 L 396,305 Q 396,290 405,290 L 413,290"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M434,306L443,306A15 15 0 0 0 458 290L458,290A15 15 0 0 0 443 275L434,275A15 15 0 0 0 419 290L419,290A15 15 0 0 0 434 306Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="290" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="481,290 470,295 470,286" style="fill:rgb(0,0,0)"/>
<path d="M458,290L475,290"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M496,306L572,306A15 15 0 0 0 587 290L587,290A15 15 0 0 0 572 275L496,275A15 15 0 0 0 481 290L481,290A15 15 0 0 0 496 306Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="290" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<path d="M111,290L408,290"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="381,328 369,333 369,324" style="fill:rgb(0,0,0)"/>
<path d="M107,328L375,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M381,328 L 388,328 Q 396,328 396,321 L 396,313"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="381,366 369,370 369,362" style="fill:rgb(0,0,0)"/>
<path d="M113,366L375,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M381,366 L 388,366 Q 396,366 396,359 L 396,351"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="149,396 137,401 137,392" style="fill:rgb(0,0,0)"/>
<path d="M113,366 L 120,366 Q 128,366 128,381 L 128,381 Q 128,396 135,396 L 143,396"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,434 309,430 309,438" style="fill:rgb(0,0,0)"/>
<path d="M345,396 L 352,396 Q 360,396 360,411 L 360,419 Q 360,434 345,434 L 319,434 L 304,434"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M268,434 L 213,434 Q 198,434 198,419 L 198,411 Q 198,396 205,396 L 213,396"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,525L62,525A15 15 0 0 0 77 510A15 15 0 0 0 62 495L43,495A15 15 0 0 0 28 510A15 15 0 0 0 43 525Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="52" y="510" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOR</text>
<polygon points="100,510 88,514 88,505" style="fill:rgb(0,0,0)"/>
<path d="M77,510L94,510"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M115,525L147,525A15 15 0 0 0 162 510A15 15 0 0 0 147 495L115,495A15 15 0 0 0 100 510A15 15 0 0 0 115 525Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="131" y="510" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EACH</text>
<polygon points="185,510 174,514 174,505" style="fill:rgb(0,0,0)"/>
<path d="M162,510L179,510"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,525L224,525A15 15 0 0 0 240 510A15 15 0 0 0 224 495L200,495A15 15 0 0 0 185 510A15 15 0 0 0 200 525Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="212" y="510" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="312,510 300,514 300,505" style="fill:rgb(0,0,0)"/>
<path d="M240,510L306,510"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M327,525L366,525A15 15 0 0 0 381 510A15 15 0 0 0 366 495L327,495A15 15 0 0 0 312 510A15 15 0 0 0 327 525Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="510" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="404,510 393,514 393,505" style="fill:rgb(0,0,0)"/>
<path d="M381,510L399,510"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,525L454,525L454,495L404,495Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="510" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M43,631L82,631A15 15 0 0 0 97 616A15 15 0 0 0 82 600L43,600A15 15 0 0 0 28 616A15 15 0 0 0 43 631Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="63" y="616" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BEGIN</text>
<polygon points="169,616 158,620 158,611" style="fill:rgb(0,0,0)"/>
<path d="M97,616L163,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M169,631L282,631L282,600L169,600Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="226" y="616" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">update-stmt</text>
<polygon points="336,616 324,620 324,611" style="fill:rgb(0,0,0)"/>
<path d="M282,616L330,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,631A15 15 0 0 0 366 616A15 15 0 0 0 351 600A15 15 0 0 0 336 616A15 15 0 0 0 351 631Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="616" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">;</text>
<polygon points="402,616 391,620 391,611" style="fill:rgb(0,0,0)"/>
<path d="M366,616L396,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,631L438,631A15 15 0 0 0 453 616A15 15 0 0 0 438 600L417,600A15 15 0 0 0 402 616A15 15 0 0 0 417 631Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="428" y="616" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="668,616 657,620 657,611" style="fill:rgb(0,0,0)"/>
<path d="M453,616L662,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="672" cy="616" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M169,668L273,668L273,638L169,638Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="221" y="653" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">insert-stmt</text>
<path d="M169,706L276,706L276,676L169,676Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="223" y="691" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">delete-stmt</text>
<path d="M169,744L273,744L273,714L169,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="221" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="169,729 158,733 158,725" style="fill:rgb(0,0,0)"/>
<path d="M131,616 L 139,616 Q 146,616 146,631 L 146,714 Q 146,729 155,729 L 163,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="169,653 158,658 158,649" style="fill:rgb(0,0,0)"/>
<path d="M146,638 L 146,646 Q 146,653 155,653 L 163,653"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="169,691 158,695 158,687" style="fill:rgb(0,0,0)"/>
<path d="M146,676 L 146,684 Q 146,691 155,691 L 163,691"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,729 286,733 286,725" style="fill:rgb(0,0,0)"/>
<path d="M273,729L292,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,729 L 305,729 Q 313,729 313,714 L 313,631 Q 313,616 319,616 L 324,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,653 286,658 286,649" style="fill:rgb(0,0,0)"/>
<path d="M273,653L292,653"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,653 L 305,653 Q 313,653 313,646 L 313,638"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,691 286,695 286,687" style="fill:rgb(0,0,0)"/>
<path d="M276,691L292,691"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,691 L 305,691 Q 313,691 313,684 L 313,676"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="226,585 237,581 237,590" style="fill:rgb(0,0,0)"/>
<path d="M366,616 L 374,616 Q 381,616 381,601 L 381,600 Q 381,585 366,585 L 246,585 L 231,585"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="132,616 120,620 120,611" style="fill:rgb(0,0,0)"/>
<path d="M226,585 L 124,585 Q 109,585 109,600 L 109,601 Q 109,616 117,616 L 126,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="602,434 597,423 606,423" style="fill:rgb(0,0,0)"/>
<path d="M587,290 L 594,290 Q 602,290 602,305 L 602,414 L 602,429"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="226,472 237,468 237,476" style="fill:rgb(0,0,0)"/>
<path d="M602,434 L 602,457 Q 602,472 587,472 L 246,472 L 231,472"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,616 17,620 17,611" style="fill:rgb(0,0,0)"/>
<path d="M226,472 L 20,472 Q 5,472 5,487 L 5,601 Q 5,616 14,616 L 23,616"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,510 17,514 17,505" style="fill:rgb(0,0,0)"/>
<path d="M5,495 L 5,502 Q 5,510 14,510 L 23,510"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="226,547 237,543 237,552" style="fill:rgb(0,0,0)"/>
<path d="M454,510 L 461,510 Q 469,510 469,525 L 469,532 Q 469,547 454,547 L 246,547 L 231,547"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M226,547 L 20,547 Q 5,547 5,555 L 5,562"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,510 L 247,510 Q 255,510 255,525 L 255,532 Q 255,547 247,547 L 240,547"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M312,510 L 297,510 Q 282,510 282,495 L 282,487 Q 282,472 297,472 L 312,472"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href="#delete-stmt">delete-stmt</a>&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#insert-stmt">insert-stmt</a>&nbsp;&nbsp; <a href="#select-stmt">select-stmt</a>&nbsp;&nbsp; <a href="#update-stmt">update-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>
</div>

<a name="create-view-stmt"></a><h4>create-view-stmt:</h4><div class='imgcontainer'>
<div style="max-width:885px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 885.677 232.632">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L100,32A15 15 0 0 0 116 17A15 15 0 0 0 100 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CREATE</text>
<path d="M167,56L199,56A15 15 0 0 0 214 41A15 15 0 0 0 199 26L167,26A15 15 0 0 0 152 41A15 15 0 0 0 167 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMP</text>
<path d="M167,94L259,94A15 15 0 0 0 274 79A15 15 0 0 0 259 64L167,64A15 15 0 0 0 152 79A15 15 0 0 0 167 94Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="213" y="79" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TEMPORARY</text>
<path d="M325,32L355,32A15 15 0 0 0 370 17A15 15 0 0 0 355 2L325,2A15 15 0 0 0 310 17A15 15 0 0 0 325 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="340" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VIEW</text>
<polygon points="213,17 201,21 201,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L207,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="310,17 299,21 299,12" style="fill:rgb(0,0,0)"/>
<path d="M213,17L305,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,41 140,45 140,37" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,29 Q 131,41 138,41 L 146,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="152,79 140,83 140,74" style="fill:rgb(0,0,0)"/>
<path d="M116,17 L 123,17 Q 131,17 131,32 L 131,64 Q 131,79 138,79 L 146,79"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M274,79 L 282,79 Q 289,79 289,64 L 289,32 Q 289,17 294,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M214,41 L 274,41 Q 289,41 289,33 L 289,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M370,17L400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M421,32A15 15 0 0 0 436 17A15 15 0 0 0 421 2A15 15 0 0 0 406 17A15 15 0 0 0 421 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="421" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="459,17 447,21 447,12" style="fill:rgb(0,0,0)"/>
<path d="M436,17L453,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M474,32L494,32A15 15 0 0 0 509 17A15 15 0 0 0 494 2L474,2A15 15 0 0 0 459 17A15 15 0 0 0 474 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="532,17 521,21 521,12" style="fill:rgb(0,0,0)"/>
<path d="M509,17L527,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,32L592,32A15 15 0 0 0 607 17A15 15 0 0 0 592 2L547,2A15 15 0 0 0 532 17A15 15 0 0 0 547 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="570" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="213,109 224,105 224,113" style="fill:rgb(0,0,0)"/>
<path d="M370,17 L 377,17 Q 385,17 385,32 L 385,94 Q 385,109 370,109 L 234,109 L 219,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="532,109 544,105 544,113" style="fill:rgb(0,0,0)"/>
<path d="M607,17 L 615,17 Q 622,17 622,32 L 622,94 Q 622,109 607,109 L 553,109 L 538,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,109L310,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="28,147 17,151 17,142" style="fill:rgb(0,0,0)"/>
<path d="M310,109 L 20,109 Q 5,109 5,124 L 5,132 Q 5,147 14,147 L 23,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M43,162L140,162A15 15 0 0 0 155 147A15 15 0 0 0 140 132L43,132A15 15 0 0 0 28 147A15 15 0 0 0 43 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="178,147 166,151 166,142" style="fill:rgb(0,0,0)"/>
<path d="M155,147L172,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M193,162A15 15 0 0 0 208 147A15 15 0 0 0 193 132A15 15 0 0 0 178 147A15 15 0 0 0 193 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="147" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="244,147 233,151 233,142" style="fill:rgb(0,0,0)"/>
<path d="M208,147L238,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,162L330,162A15 15 0 0 0 345 147A15 15 0 0 0 330 132L259,132A15 15 0 0 0 244 147A15 15 0 0 0 259 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="295" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">view-name</text>
<polygon points="383,177 372,181 372,173" style="fill:rgb(0,0,0)"/>
<path d="M345,147 L 353,147 Q 360,147 360,162 L 360,162 Q 360,177 369,177 L 378,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M399,192A15 15 0 0 0 414 177A15 15 0 0 0 399 162A15 15 0 0 0 383 177A15 15 0 0 0 399 192Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="399" y="177" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="450,177 438,181 438,173" style="fill:rgb(0,0,0)"/>
<path d="M414,177L444,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M465,192L559,192A15 15 0 0 0 574 177A15 15 0 0 0 559 162L465,162A15 15 0 0 0 450 177A15 15 0 0 0 465 192Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="512" y="177" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="610,177 599,181 599,173" style="fill:rgb(0,0,0)"/>
<path d="M574,177L604,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M625,192A15 15 0 0 0 640 177A15 15 0 0 0 625 162A15 15 0 0 0 610 177A15 15 0 0 0 625 192Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="625" y="177" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="678,147 667,151 667,142" style="fill:rgb(0,0,0)"/>
<path d="M640,177 L 648,177 Q 655,177 655,162 L 655,162 Q 655,147 664,147 L 673,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M693,162L697,162A15 15 0 0 0 713 147A15 15 0 0 0 697 132L693,132A15 15 0 0 0 678 147A15 15 0 0 0 693 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="695" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="736,147 724,151 724,142" style="fill:rgb(0,0,0)"/>
<path d="M713,147L730,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M736,162L840,162L840,132L736,132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="788" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="876,147 864,151 864,142" style="fill:rgb(0,0,0)"/>
<path d="M840,147L870,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="879" cy="147" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="92,177 80,181 80,173" style="fill:rgb(0,0,0)"/>
<path d="M5,132 L 5,162 Q 5,177 20,177 L 71,177 L 86,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M92,177 L 206,177 Q 221,177 221,162 L 221,162 Q 221,147 227,147 L 233,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="512,147 500,151 500,142" style="fill:rgb(0,0,0)"/>
<path d="M345,147L506,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M512,147L667,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M512,230A15 15 0 0 0 527 215A15 15 0 0 0 512 200A15 15 0 0 0 497 215A15 15 0 0 0 512 230Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="512" y="215" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="527,215 539,211 539,219" style="fill:rgb(0,0,0)"/>
<path d="M574,177 L 582,177 Q 589,177 589,192 L 589,200 Q 589,215 574,215 L 548,215 L 533,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M497,215 L 442,215 Q 427,215 427,200 L 427,192 Q 427,177 434,177 L 442,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href="#select-stmt">select-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>
</div>

<a name="create-virtual-table-stmt"></a><h4>create-virtual-table-stmt:</h4><div class='imgcontainer'>
<div style="max-width:624px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 624.096 259.848">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L100,32A15 15 0 0 0 116 17A15 15 0 0 0 100 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CREATE</text>
<polygon points="139,17 127,21 127,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L133,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M154,32L213,32A15 15 0 0 0 228 17A15 15 0 0 0 213 2L154,2A15 15 0 0 0 139 17A15 15 0 0 0 154 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VIRTUAL</text>
<polygon points="251,17 240,21 240,12" style="fill:rgb(0,0,0)"/>
<path d="M228,17L246,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,32L306,32A15 15 0 0 0 321 17A15 15 0 0 0 306 2L266,2A15 15 0 0 0 251 17A15 15 0 0 0 266 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="286" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TABLE</text>
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M321,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M372,32A15 15 0 0 0 387 17A15 15 0 0 0 372 2A15 15 0 0 0 357 17A15 15 0 0 0 372 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="372" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="410,17 399,21 399,12" style="fill:rgb(0,0,0)"/>
<path d="M387,17L404,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M425,32L445,32A15 15 0 0 0 461 17A15 15 0 0 0 445 2L425,2A15 15 0 0 0 410 17A15 15 0 0 0 425 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="435" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="484,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M461,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,32L543,32A15 15 0 0 0 558 17A15 15 0 0 0 543 2L499,2A15 15 0 0 0 484 17A15 15 0 0 0 499 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="521" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<path d="M47,108L143,108A15 15 0 0 0 159 92A15 15 0 0 0 143 77L47,77A15 15 0 0 0 32 92A15 15 0 0 0 47 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="95" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="182,92 170,97 170,88" style="fill:rgb(0,0,0)"/>
<path d="M159,92L176,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,108A15 15 0 0 0 212 92A15 15 0 0 0 197 77A15 15 0 0 0 182 92A15 15 0 0 0 197 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="197" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="248,92 236,97 236,88" style="fill:rgb(0,0,0)"/>
<path d="M212,92L242,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M263,108L338,108A15 15 0 0 0 353 92A15 15 0 0 0 338 77L263,77A15 15 0 0 0 248 92A15 15 0 0 0 263 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<path d="M47,219L86,219A15 15 0 0 0 101 204A15 15 0 0 0 86 189L47,189A15 15 0 0 0 32 204A15 15 0 0 0 47 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="67" y="204" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="124,204 113,209 113,200" style="fill:rgb(0,0,0)"/>
<path d="M101,204L118,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M139,219L234,219A15 15 0 0 0 249 204A15 15 0 0 0 234 189L139,189A15 15 0 0 0 124 204A15 15 0 0 0 139 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="204" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">module-name</text>
<polygon points="285,204 274,209 274,200" style="fill:rgb(0,0,0)"/>
<path d="M249,204L279,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,219A15 15 0 0 0 315 204A15 15 0 0 0 300 189A15 15 0 0 0 285 204A15 15 0 0 0 300 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="204" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,204 340,209 340,200" style="fill:rgb(0,0,0)"/>
<path d="M315,204L346,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,219L497,219A15 15 0 0 0 512 204A15 15 0 0 0 497 189L366,189A15 15 0 0 0 351 204A15 15 0 0 0 366 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="204" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">module-argument</text>
<polygon points="548,204 536,209 536,200" style="fill:rgb(0,0,0)"/>
<path d="M512,204L542,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M563,219A15 15 0 0 0 578 204A15 15 0 0 0 563 189A15 15 0 0 0 548 204A15 15 0 0 0 563 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="563" y="204" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="614,204 603,209 603,200" style="fill:rgb(0,0,0)"/>
<path d="M578,204L608,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="618" cy="204" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,257A15 15 0 0 0 447 242A15 15 0 0 0 432 227A15 15 0 0 0 417 242A15 15 0 0 0 432 257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="242" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="447,242 458,238 458,246" style="fill:rgb(0,0,0)"/>
<path d="M512,204 L 519,204 Q 527,204 527,219 L 527,227 Q 527,242 512,242 L 468,242 L 453,242"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,242 L 343,242 Q 328,242 328,227 L 328,219 Q 328,204 336,204 L 343,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="432,180 420,184 420,176" style="fill:rgb(0,0,0)"/>
<path d="M249,204 L 257,204 Q 264,204 264,192 Q 264,180 279,180 L 411,180 L 426,180"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,180 L 576,180 Q 591,180 591,192 Q 591,204 599,204 L 606,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="187,153 198,149 198,157" style="fill:rgb(0,0,0)"/>
<path d="M353,92 L 361,92 Q 368,92 368,107 L 368,138 Q 368,153 353,153 L 207,153 L 192,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,204 20,209 20,200" style="fill:rgb(0,0,0)"/>
<path d="M187,153 L 20,153 Q 5,153 5,168 L 5,189 Q 5,204 16,204 L 26,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="429,62 441,58 441,66" style="fill:rgb(0,0,0)"/>
<path d="M558,17 L 566,17 Q 573,17 573,32 L 573,47 Q 573,62 558,62 L 450,62 L 435,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,92 20,97 20,88" style="fill:rgb(0,0,0)"/>
<path d="M429,62 L 20,62 Q 5,62 5,77 L 5,77 Q 5,92 16,92 L 26,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,47 332,35 340,35" style="fill:rgb(0,0,0)"/>
<path d="M321,17 L 328,17 Q 336,17 336,29 L 336,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,47 L 336,54 Q 336,62 328,62 L 321,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="95,123 84,127 84,118" style="fill:rgb(0,0,0)"/>
<path d="M5,77 L 5,108 Q 5,123 20,123 L 74,123 L 89,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,123 L 210,123 Q 225,123 225,108 L 225,107 Q 225,92 231,92 L 236,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_createvtab.html">lang_createvtab.html</a>
</div>

<a name="cte-table-name"></a><h4>cte-table-name:</h4><div class='imgcontainer'>
<div style="max-width:475px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 475.949 91.8">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,36 20,41 20,32" style="fill:rgb(0,0,0)"/>
<path d="M9,36L26,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,51L122,51A15 15 0 0 0 137 36A15 15 0 0 0 122 21L47,21A15 15 0 0 0 32 36A15 15 0 0 0 47 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="173,36 162,41 162,32" style="fill:rgb(0,0,0)"/>
<path d="M137,36L168,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M188,51A15 15 0 0 0 204 36A15 15 0 0 0 188 21A15 15 0 0 0 173 36A15 15 0 0 0 188 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="188" y="36" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="240,36 228,41 228,32" style="fill:rgb(0,0,0)"/>
<path d="M204,36L234,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M255,51L349,51A15 15 0 0 0 364 36A15 15 0 0 0 349 21L255,21A15 15 0 0 0 240 36A15 15 0 0 0 255 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="400,36 388,41 388,32" style="fill:rgb(0,0,0)"/>
<path d="M364,36L394,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,51A15 15 0 0 0 430 36A15 15 0 0 0 415 21A15 15 0 0 0 400 36A15 15 0 0 0 415 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="36" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="466,36 455,41 455,32" style="fill:rgb(0,0,0)"/>
<path d="M430,36L460,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="470" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M302,89A15 15 0 0 0 317 74L317,74A15 15 0 0 0 302 59A15 15 0 0 0 287 74L287,74A15 15 0 0 0 302 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="317,74 328,70 328,78" style="fill:rgb(0,0,0)"/>
<path d="M364,36 L 371,36 Q 379,36 379,51 L 379,59 Q 379,74 364,74 L 338,74 L 323,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,74 L 232,74 Q 217,74 217,59 L 217,51 Q 217,36 224,36 L 232,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="302,6 290,10 290,2" style="fill:rgb(0,0,0)"/>
<path d="M137,36 L 145,36 Q 152,36 152,21 L 152,21 Q 152,6 167,6 L 281,6 L 296,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M302,6 L 422,6 Q 437,6 437,21 L 437,21 Q 437,36 445,36 L 452,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#recursive-cte">recursive-cte</a>&nbsp;&nbsp; <a href="#with-clause">with-clause</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="lang_with.html#recursivecte">lang_with.html#recursivecte</a>
</div>

<a name="delete-stmt"></a><h4>delete-stmt:</h4><div class='imgcontainer'>
<div style="max-width:648px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 648.706 220.32">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,17 56,21 56,12" style="fill:rgb(0,0,0)"/>
<path d="M32,17L62,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,32L114,32A15 15 0 0 0 129 17A15 15 0 0 0 114 2L83,2A15 15 0 0 0 68 17A15 15 0 0 0 83 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="98" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M189,62L275,62A15 15 0 0 0 290 47A15 15 0 0 0 275 32L189,32A15 15 0 0 0 174 47A15 15 0 0 0 189 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="232" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="232,17 220,21 220,12" style="fill:rgb(0,0,0)"/>
<path d="M129,17L226,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,17 368,21 368,12" style="fill:rgb(0,0,0)"/>
<path d="M232,17L374,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,32L606,32L606,2L380,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="174,47 162,51 162,43" style="fill:rgb(0,0,0)"/>
<path d="M129,17 L 136,17 Q 144,17 144,32 L 144,32 Q 144,47 156,47 L 168,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,47 301,51 301,43" style="fill:rgb(0,0,0)"/>
<path d="M290,47L307,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,47 L 321,47 Q 328,47 328,32 L 328,32 Q 328,17 343,17 L 353,17 L 368,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,70A15 15 0 0 0 508 55L508,55A15 15 0 0 0 493 39A15 15 0 0 0 478 55L478,55A15 15 0 0 0 493 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="508,55 520,50 520,59" style="fill:rgb(0,0,0)"/>
<path d="M606,17 L 614,17 Q 621,17 621,32 L 621,40 Q 621,55 606,55 L 529,55 L 514,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,55 L 372,55 Q 357,55 357,40 L 357,32 Q 357,17 363,17 L 368,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M83,138L136,138A15 15 0 0 0 151 123A15 15 0 0 0 136 108L83,108A15 15 0 0 0 68 123A15 15 0 0 0 83 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DELETE</text>
<polygon points="174,123 163,127 163,118" style="fill:rgb(0,0,0)"/>
<path d="M151,123L168,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,138L224,138A15 15 0 0 0 239 123A15 15 0 0 0 224 108L189,108A15 15 0 0 0 174 123A15 15 0 0 0 189 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="207" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="262,123 251,127 251,118" style="fill:rgb(0,0,0)"/>
<path d="M239,123L256,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M262,138L447,138L447,108L262,108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">qualified-table-name</text>
<circle cx="642" cy="213" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M639,213 L 618,213 Q 603,213 603,198 L 603,198 Q 603,183 595,183 L 588,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M437,198L588,198L588,168L437,168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="512" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">returning-clause</text>
<polygon points="437,183 425,187 425,179" style="fill:rgb(0,0,0)"/>
<path d="M431,183 L 421,183 Q 410,183 410,198 L 410,198 Q 410,213 403,213 L 395,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="395,213 384,218 384,209" style="fill:rgb(0,0,0)"/>
<path d="M390,213 L 379,213 Q 369,213 369,198 L 369,198 Q 369,183 361,183 L 354,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M305,198L354,198L354,168L305,168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="329" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="305,183 293,187 293,179" style="fill:rgb(0,0,0)"/>
<path d="M299,183L282,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,198L267,198A15 15 0 0 0 282 183A15 15 0 0 0 267 168L217,168A15 15 0 0 0 202 183A15 15 0 0 0 217 198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="242" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="355,153 366,149 366,157" style="fill:rgb(0,0,0)"/>
<path d="M447,123 L 455,123 Q 462,123 462,138 L 462,138 Q 462,153 447,153 L 375,153 L 360,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="202,183 190,187 190,179" style="fill:rgb(0,0,0)"/>
<path d="M355,153 L 195,153 Q 180,153 180,168 L 180,168 Q 180,183 188,183 L 196,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="639,213 627,218 627,209" style="fill:rgb(0,0,0)"/>
<path d="M180,172 L 180,198 Q 180,213 195,213 L 618,213 L 633,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="355,85 366,81 366,89" style="fill:rgb(0,0,0)"/>
<path d="M606,17 L 614,17 Q 621,17 621,32 L 621,70 Q 621,85 606,85 L 375,85 L 360,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="68,123 56,127 56,118" style="fill:rgb(0,0,0)"/>
<path d="M355,85 L 62,85 Q 47,85 47,100 L 47,108 Q 47,123 55,123 L 62,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,47 43,36 51,36" style="fill:rgb(0,0,0)"/>
<path d="M32,17 L 39,17 Q 47,17 47,29 L 47,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,47L47,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#create-trigger-stmt">create-trigger-stmt</a>&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href="#common-table-expression">common-table-expression</a>&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#qualified-table-name">qualified-table-name</a>&nbsp;&nbsp; <a href="#returning-clause">returning-clause</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>
</div>

<a name="delete-stmt-limited"></a><h4>delete-stmt-limited:</h4><div class='imgcontainer'>
<div style="max-width:623px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 623.266 541.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L91,32A15 15 0 0 0 106 17A15 15 0 0 0 91 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M166,62L252,62A15 15 0 0 0 267 47A15 15 0 0 0 252 32L166,32A15 15 0 0 0 151 47A15 15 0 0 0 166 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="209,17 197,21 197,12" style="fill:rgb(0,0,0)"/>
<path d="M106,17L203,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M209,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M357,32L583,32L583,2L357,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="151,47 139,51 139,43" style="fill:rgb(0,0,0)"/>
<path d="M106,17 L 113,17 Q 121,17 121,32 L 121,32 Q 121,47 133,47 L 145,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,47 278,51 278,43" style="fill:rgb(0,0,0)"/>
<path d="M267,47L284,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,47 L 297,47 Q 305,47 305,32 L 305,32 Q 305,17 320,17 L 330,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,70A15 15 0 0 0 485 55L485,55A15 15 0 0 0 470 39A15 15 0 0 0 455 55L455,55A15 15 0 0 0 470 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="485,55 497,50 497,59" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,40 Q 598,55 583,55 L 506,55 L 491,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,55 L 349,55 Q 334,55 334,40 L 334,32 Q 334,17 340,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,138L113,138A15 15 0 0 0 128 123A15 15 0 0 0 113 108L60,108A15 15 0 0 0 45 123A15 15 0 0 0 60 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="86" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DELETE</text>
<polygon points="151,123 140,127 140,118" style="fill:rgb(0,0,0)"/>
<path d="M128,123L145,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M166,138L201,138A15 15 0 0 0 216 123A15 15 0 0 0 201 108L166,108A15 15 0 0 0 151 123A15 15 0 0 0 166 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="239,123 228,127 228,118" style="fill:rgb(0,0,0)"/>
<path d="M216,123L233,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M239,138L424,138L424,108L239,108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="123" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">qualified-table-name</text>
<polygon points="45,123 33,127 33,118" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,108 Q 24,123 31,123 L 39,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,85 343,81 343,89" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,70 Q 598,85 583,85 L 352,85 L 337,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M332,85 L 39,85 Q 24,85 24,92 L 24,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,213L109,213A15 15 0 0 0 125 198A15 15 0 0 0 109 183L60,183A15 15 0 0 0 45 198A15 15 0 0 0 60 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="148,198 136,203 136,194" style="fill:rgb(0,0,0)"/>
<path d="M125,198L142,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M148,213L197,213L197,183L148,183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="172" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M45,289L196,289L196,259L45,259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="120" y="274" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">returning-clause</text>
<path d="M60,365L105,365A15 15 0 0 0 120 349A15 15 0 0 0 105 334L60,334A15 15 0 0 0 45 349A15 15 0 0 0 60 365Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="82" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="143,349 131,354 131,345" style="fill:rgb(0,0,0)"/>
<path d="M120,349L137,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,365L162,365A15 15 0 0 0 177 349A15 15 0 0 0 162 334L158,334A15 15 0 0 0 143 349A15 15 0 0 0 158 365Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="160" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="213,349 201,354 201,345" style="fill:rgb(0,0,0)"/>
<path d="M177,349L207,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M213,365L343,365L343,334L213,334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M278,402A15 15 0 0 0 293 387A15 15 0 0 0 278 372A15 15 0 0 0 263 387A15 15 0 0 0 278 402Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="387" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M60,470L93,470A15 15 0 0 0 109 455A15 15 0 0 0 93 440L60,440A15 15 0 0 0 45 455A15 15 0 0 0 60 470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="77" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="132,455 120,460 120,451" style="fill:rgb(0,0,0)"/>
<path d="M109,455L126,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,470L181,470L181,440L132,440Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="219,486 207,490 207,481" style="fill:rgb(0,0,0)"/>
<path d="M181,455 L 188,455 Q 196,455 196,470 L 196,471 Q 196,486 204,486 L 213,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M234,501L285,501A15 15 0 0 0 300 486A15 15 0 0 0 285 470L234,470A15 15 0 0 0 219 486A15 15 0 0 0 234 501Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="323,486 312,490 312,481" style="fill:rgb(0,0,0)"/>
<path d="M300,486L318,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,501L373,501L373,470L323,470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="486" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M234,538A15 15 0 0 0 249 523A15 15 0 0 0 234 508A15 15 0 0 0 219 523A15 15 0 0 0 234 538Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="523" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="272,523 261,528 261,519" style="fill:rgb(0,0,0)"/>
<path d="M249,523L266,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,538L321,538L321,508L272,508Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="297" y="523" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="219,523 207,528 207,519" style="fill:rgb(0,0,0)"/>
<path d="M181,455 L 188,455 Q 196,455 196,470 L 196,508 Q 196,523 204,523 L 213,523"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="613,455 602,460 602,451" style="fill:rgb(0,0,0)"/>
<path d="M181,455L608,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="617" cy="455" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="575,123 564,127 564,118" style="fill:rgb(0,0,0)"/>
<path d="M424,123L570,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M575,123 L 583,123 Q 590,123 590,138 L 590,440 Q 590,455 598,455 L 605,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="239,160 251,156 251,165" style="fill:rgb(0,0,0)"/>
<path d="M424,123 L 431,123 Q 439,123 439,138 L 439,145 Q 439,160 424,160 L 260,160 L 245,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,198 33,203 33,194" style="fill:rgb(0,0,0)"/>
<path d="M239,160 L 39,160 Q 24,160 24,175 L 24,183 Q 24,198 31,198 L 39,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="575,198 564,203 564,194" style="fill:rgb(0,0,0)"/>
<path d="M197,198L570,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M575,198 L 583,198 Q 590,198 590,206 L 590,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,274 33,278 33,270" style="fill:rgb(0,0,0)"/>
<path d="M24,259 L 24,266 Q 24,274 31,274 L 39,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="120,312 132,307 132,316" style="fill:rgb(0,0,0)"/>
<path d="M196,274 L 203,274 Q 211,274 211,289 L 211,297 Q 211,312 196,312 L 141,312 L 126,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M120,312 L 39,312 Q 24,312 24,319 L 24,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="575,274 564,278 564,270" style="fill:rgb(0,0,0)"/>
<path d="M196,274L570,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M575,274 L 583,274 Q 590,274 590,281 L 590,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,349 33,354 33,345" style="fill:rgb(0,0,0)"/>
<path d="M24,183 L 24,334 Q 24,349 31,349 L 39,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="120,236 131,232 131,240" style="fill:rgb(0,0,0)"/>
<path d="M197,198 L 204,198 Q 212,198 212,213 L 212,221 Q 212,236 197,236 L 140,236 L 125,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M120,236 L 39,236 Q 24,236 24,244 L 24,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="293,387 305,383 305,392" style="fill:rgb(0,0,0)"/>
<path d="M343,349 L 350,349 Q 358,349 358,364 L 358,372 Q 358,387 343,387 L 314,387 L 299,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M263,387 L 205,387 Q 190,387 190,372 L 190,364 Q 190,349 197,349 L 205,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,455 33,460 33,451" style="fill:rgb(0,0,0)"/>
<path d="M24,334 L 24,440 Q 24,455 31,455 L 39,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="160,417 171,413 171,422" style="fill:rgb(0,0,0)"/>
<path d="M343,349 L 350,349 Q 358,349 358,364 L 358,402 Q 358,417 343,417 L 181,417 L 166,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M160,417 L 39,417 Q 24,417 24,425 L 24,432"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,455 435,460 435,451" style="fill:rgb(0,0,0)"/>
<path d="M321,523 L 396,523 Q 411,523 411,508 L 411,470 Q 411,455 426,455 L 426,455 L 441,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="396,486 384,490 384,481" style="fill:rgb(0,0,0)"/>
<path d="M373,486L390,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M396,486 L 403,486 Q 411,486 411,478 L 411,471"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href="#common-table-expression">common-table-expression</a>&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#ordering-term">ordering-term</a>&nbsp;&nbsp; <a href="#qualified-table-name">qualified-table-name</a>&nbsp;&nbsp; <a href="#returning-clause">returning-clause</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>
</div>

<a name="detach-stmt"></a><h4>detach-stmt:</h4><div class='imgcontainer'>
<div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.595 47.952">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L104,32A15 15 0 0 0 119 17A15 15 0 0 0 104 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DETACH</text>
<polygon points="155,17 143,21 143,12" style="fill:rgb(0,0,0)"/>
<path d="M119,17L149,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M170,32L246,32A15 15 0 0 0 261 17A15 15 0 0 0 246 2L170,2A15 15 0 0 0 155 17A15 15 0 0 0 170 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="208" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DATABASE</text>
<polygon points="297,17 286,21 286,12" style="fill:rgb(0,0,0)"/>
<path d="M261,17L291,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M312,32L409,32A15 15 0 0 0 424 17A15 15 0 0 0 409 2L312,2A15 15 0 0 0 297 17A15 15 0 0 0 312 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="447,17 435,21 435,12" style="fill:rgb(0,0,0)"/>
<path d="M424,17L441,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="208,41 196,45 196,37" style="fill:rgb(0,0,0)"/>
<path d="M119,17 L 126,17 Q 134,17 134,29 Q 134,41 149,41 L 187,41 L 202,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M208,41 L 255,41 Q 270,41 270,29 Q 270,17 278,17 L 285,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_detach.html">lang_detach.html</a>
</div>

<a name="drop-index-stmt"></a><h4>drop-index-stmt:</h4><div class='imgcontainer'>
<div style="max-width:761px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 761.27 54">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="63" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DROP</text>
<polygon points="116,17 105,21 105,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L110,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M131,32L171,32A15 15 0 0 0 186 17A15 15 0 0 0 171 2L131,2A15 15 0 0 0 116 17A15 15 0 0 0 131 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="151" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEX</text>
<polygon points="222,17 210,21 210,12" style="fill:rgb(0,0,0)"/>
<path d="M186,17L216,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M237,32A15 15 0 0 0 252 17A15 15 0 0 0 237 2A15 15 0 0 0 222 17A15 15 0 0 0 237 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="237" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="275,17 263,21 263,12" style="fill:rgb(0,0,0)"/>
<path d="M252,17L269,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,32L335,32A15 15 0 0 0 350 17A15 15 0 0 0 335 2L290,2A15 15 0 0 0 275 17A15 15 0 0 0 290 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="404,17 392,21 392,12" style="fill:rgb(0,0,0)"/>
<path d="M350,17L398,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,32L515,32A15 15 0 0 0 530 17A15 15 0 0 0 515 2L419,2A15 15 0 0 0 404 17A15 15 0 0 0 419 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="467" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="553,17 542,21 542,12" style="fill:rgb(0,0,0)"/>
<path d="M530,17L548,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M569,32A15 15 0 0 0 584 17A15 15 0 0 0 569 2A15 15 0 0 0 553 17A15 15 0 0 0 569 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="569" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="620,17 608,21 608,12" style="fill:rgb(0,0,0)"/>
<path d="M584,17L614,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M635,32L713,32A15 15 0 0 0 728 17A15 15 0 0 0 713 2L635,2A15 15 0 0 0 620 17A15 15 0 0 0 635 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<polygon points="751,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M728,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="755" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,47 263,51 263,43" style="fill:rgb(0,0,0)"/>
<path d="M186,17 L 193,17 Q 201,17 201,32 L 201,32 Q 201,47 216,47 L 254,47 L 269,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M275,47 L 350,47 Q 365,47 365,32 L 365,32 Q 365,17 372,17 L 380,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="467,47 456,51 456,43" style="fill:rgb(0,0,0)"/>
<path d="M372,17 L 379,17 Q 387,17 387,32 L 387,32 Q 387,47 402,47 L 446,47 L 461,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,47 L 584,47 Q 599,47 599,32 L 599,32 Q 599,17 606,17 L 614,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_dropindex.html">lang_dropindex.html</a>
</div>

<a name="drop-table-stmt"></a><h4>drop-table-stmt:</h4><div class='imgcontainer'>
<div style="max-width:758px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 758.16 54">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="63" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DROP</text>
<polygon points="116,17 105,21 105,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L110,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M131,32L171,32A15 15 0 0 0 186 17A15 15 0 0 0 171 2L131,2A15 15 0 0 0 116 17A15 15 0 0 0 131 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="151" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TABLE</text>
<polygon points="222,17 210,21 210,12" style="fill:rgb(0,0,0)"/>
<path d="M186,17L216,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M237,32A15 15 0 0 0 252 17A15 15 0 0 0 237 2A15 15 0 0 0 222 17A15 15 0 0 0 237 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="237" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="275,17 264,21 264,12" style="fill:rgb(0,0,0)"/>
<path d="M252,17L269,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,32L335,32A15 15 0 0 0 350 17A15 15 0 0 0 335 2L290,2A15 15 0 0 0 275 17A15 15 0 0 0 290 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="404,17 392,21 392,12" style="fill:rgb(0,0,0)"/>
<path d="M350,17L398,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,32L515,32A15 15 0 0 0 531 17A15 15 0 0 0 515 2L419,2A15 15 0 0 0 404 17A15 15 0 0 0 419 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="467" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="554,17 542,21 542,12" style="fill:rgb(0,0,0)"/>
<path d="M531,17L548,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M569,32A15 15 0 0 0 584 17A15 15 0 0 0 569 2A15 15 0 0 0 554 17A15 15 0 0 0 569 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="569" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="620,17 608,21 608,12" style="fill:rgb(0,0,0)"/>
<path d="M584,17L614,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M635,32L710,32A15 15 0 0 0 725 17A15 15 0 0 0 710 2L635,2A15 15 0 0 0 620 17A15 15 0 0 0 635 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="673" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="748,17 737,21 737,12" style="fill:rgb(0,0,0)"/>
<path d="M725,17L743,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="752" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,47 264,51 264,43" style="fill:rgb(0,0,0)"/>
<path d="M186,17 L 193,17 Q 201,17 201,32 L 201,32 Q 201,47 216,47 L 254,47 L 269,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M275,47 L 350,47 Q 365,47 365,32 L 365,32 Q 365,17 372,17 L 380,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="467,47 456,51 456,43" style="fill:rgb(0,0,0)"/>
<path d="M372,17 L 379,17 Q 387,17 387,32 L 387,32 Q 387,47 402,47 L 447,47 L 462,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,47 L 584,47 Q 599,47 599,32 L 599,32 Q 599,17 606,17 L 614,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_droptable.html">lang_droptable.html</a>
</div>

<a name="drop-trigger-stmt"></a><h4>drop-trigger-stmt:</h4><div class='imgcontainer'>
<div style="max-width:795px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 795.37 54">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="63" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DROP</text>
<polygon points="116,17 105,21 105,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L110,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M131,32L191,32A15 15 0 0 0 207 17A15 15 0 0 0 191 2L131,2A15 15 0 0 0 116 17A15 15 0 0 0 131 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="161" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRIGGER</text>
<polygon points="243,17 231,21 231,12" style="fill:rgb(0,0,0)"/>
<path d="M207,17L237,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,32A15 15 0 0 0 273 17A15 15 0 0 0 258 2A15 15 0 0 0 243 17A15 15 0 0 0 258 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="296,17 284,21 284,12" style="fill:rgb(0,0,0)"/>
<path d="M273,17L290,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,32L356,32A15 15 0 0 0 371 17A15 15 0 0 0 356 2L311,2A15 15 0 0 0 296 17A15 15 0 0 0 311 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="425,17 413,21 413,12" style="fill:rgb(0,0,0)"/>
<path d="M371,17L419,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M440,32L536,32A15 15 0 0 0 551 17A15 15 0 0 0 536 2L440,2A15 15 0 0 0 425 17A15 15 0 0 0 440 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="574,17 563,21 563,12" style="fill:rgb(0,0,0)"/>
<path d="M551,17L569,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M589,32A15 15 0 0 0 605 17A15 15 0 0 0 589 2A15 15 0 0 0 574 17A15 15 0 0 0 589 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="589" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="641,17 629,21 629,12" style="fill:rgb(0,0,0)"/>
<path d="M605,17L635,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M656,32L747,32A15 15 0 0 0 762 17A15 15 0 0 0 747 2L656,2A15 15 0 0 0 641 17A15 15 0 0 0 656 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="702" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">trigger-name</text>
<polygon points="786,17 774,21 774,12" style="fill:rgb(0,0,0)"/>
<path d="M762,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="789" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="296,47 284,51 284,43" style="fill:rgb(0,0,0)"/>
<path d="M207,17 L 214,17 Q 222,17 222,32 L 222,32 Q 222,47 237,47 L 275,47 L 290,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M296,47 L 371,47 Q 386,47 386,32 L 386,32 Q 386,17 393,17 L 401,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="488,47 476,51 476,43" style="fill:rgb(0,0,0)"/>
<path d="M392,17 L 400,17 Q 407,17 407,32 L 407,32 Q 407,47 422,47 L 467,47 L 482,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,47 L 605,47 Q 620,47 620,32 L 620,32 Q 620,17 627,17 L 635,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_droptrigger.html">lang_droptrigger.html</a>
</div>

<a name="drop-view-stmt"></a><h4>drop-view-stmt:</h4><div class='imgcontainer'>
<div style="max-width:743px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 743.76 54">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="63" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DROP</text>
<polygon points="116,17 105,21 105,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L110,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M131,32L160,32A15 15 0 0 0 176 17A15 15 0 0 0 160 2L131,2A15 15 0 0 0 116 17A15 15 0 0 0 131 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VIEW</text>
<polygon points="212,17 200,21 200,12" style="fill:rgb(0,0,0)"/>
<path d="M176,17L206,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M227,32A15 15 0 0 0 242 17A15 15 0 0 0 227 2A15 15 0 0 0 212 17A15 15 0 0 0 227 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="227" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="265,17 253,21 253,12" style="fill:rgb(0,0,0)"/>
<path d="M242,17L259,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M280,32L325,32A15 15 0 0 0 340 17A15 15 0 0 0 325 2L280,2A15 15 0 0 0 265 17A15 15 0 0 0 280 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="394,17 382,21 382,12" style="fill:rgb(0,0,0)"/>
<path d="M340,17L388,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,32L505,32A15 15 0 0 0 520 17A15 15 0 0 0 505 2L409,2A15 15 0 0 0 394 17A15 15 0 0 0 409 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="457" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="543,17 532,21 532,12" style="fill:rgb(0,0,0)"/>
<path d="M520,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,32A15 15 0 0 0 574 17A15 15 0 0 0 558 2A15 15 0 0 0 543 17A15 15 0 0 0 558 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="558" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="610,17 598,21 598,12" style="fill:rgb(0,0,0)"/>
<path d="M574,17L604,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M625,32L696,32A15 15 0 0 0 711 17A15 15 0 0 0 696 2L625,2A15 15 0 0 0 610 17A15 15 0 0 0 625 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="660" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">view-name</text>
<polygon points="734,17 722,21 722,12" style="fill:rgb(0,0,0)"/>
<path d="M711,17L728,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="738" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="265,47 253,51 253,43" style="fill:rgb(0,0,0)"/>
<path d="M176,17 L 183,17 Q 191,17 191,32 L 191,32 Q 191,47 206,47 L 244,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,47 L 340,47 Q 355,47 355,32 L 355,32 Q 355,17 362,17 L 370,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="457,47 445,51 445,43" style="fill:rgb(0,0,0)"/>
<path d="M361,17 L 369,17 Q 376,17 376,32 L 376,32 Q 376,47 391,47 L 436,47 L 451,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M457,47 L 574,47 Q 589,47 589,32 L 589,32 Q 589,17 596,17 L 604,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_dropview.html">lang_dropview.html</a>
</div>

<a name="expr"></a><h4>expr:</h4><div class='imgcontainer'>
<div style="max-width:963px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 963.96 1068.77">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L158,32L158,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="101" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">literal-value</text>
<polygon points="954,17 943,21 943,12" style="fill:rgb(0,0,0)"/>
<path d="M158,17L948,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="958" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L172,70A15 15 0 0 0 187 55L187,55A15 15 0 0 0 172 39L60,39A15 15 0 0 0 45 55L45,55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">bind-parameter</text>
<polygon points="916,55 905,59 905,50" style="fill:rgb(0,0,0)"/>
<path d="M187,55L910,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,55 L 924,55 Q 931,55 931,47 L 931,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 31,55 L 39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,130L156,130A15 15 0 0 0 171 115A15 15 0 0 0 156 100L60,100A15 15 0 0 0 45 115A15 15 0 0 0 60 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,115 183,119 183,111" style="fill:rgb(0,0,0)"/>
<path d="M171,115L189,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,130A15 15 0 0 0 225 115A15 15 0 0 0 210 100A15 15 0 0 0 195 115A15 15 0 0 0 210 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M225,115L255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130L351,130A15 15 0 0 0 366 115A15 15 0 0 0 351 100L276,100A15 15 0 0 0 261 115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="389,115 378,119 378,111" style="fill:rgb(0,0,0)"/>
<path d="M366,115L383,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,130A15 15 0 0 0 419 115A15 15 0 0 0 404 100A15 15 0 0 0 389 115A15 15 0 0 0 404 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="404" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="455,115 444,119 444,111" style="fill:rgb(0,0,0)"/>
<path d="M419,115L450,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,130L565,130A15 15 0 0 0 580 115A15 15 0 0 0 565 100L471,100A15 15 0 0 0 455 115A15 15 0 0 0 471 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="115" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="916,115 905,119 905,111" style="fill:rgb(0,0,0)"/>
<path d="M580,115L910,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,115 L 924,115 Q 931,115 931,108 L 931,100"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,115 33,119 33,111" style="fill:rgb(0,0,0)"/>
<path d="M24,100 L 24,108 Q 24,115 31,115 L 39,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,89 97,93 97,84" style="fill:rgb(0,0,0)"/>
<path d="M24,74 L 24,81 Q 24,89 39,89 L 87,89 L 102,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 302,93 302,84" style="fill:rgb(0,0,0)"/>
<path d="M108,89 L 129,89 Q 144,89 159,89 L 293,89 L 308,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,89 L 414,89 Q 429,89 429,102 Q 429,115 436,115 L 444,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M223,89 L 230,89 Q 238,89 238,102 Q 238,115 245,115 L 253,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,168L168,168A15 15 0 0 0 183 153A15 15 0 0 0 168 138L60,138A15 15 0 0 0 45 153A15 15 0 0 0 60 168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">unary-operator</text>
<polygon points="206,153 194,157 194,149" style="fill:rgb(0,0,0)"/>
<path d="M183,153L200,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,168L255,168L255,138L206,138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="153" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,153 905,157 905,149" style="fill:rgb(0,0,0)"/>
<path d="M255,153L910,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,153 L 924,153 Q 931,153 931,145 L 931,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,153 33,157 33,149" style="fill:rgb(0,0,0)"/>
<path d="M24,138 L 24,145 Q 24,153 31,153 L 39,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,206L94,206L94,176L45,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,191 106,195 106,186" style="fill:rgb(0,0,0)"/>
<path d="M94,191L111,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,206L245,206A15 15 0 0 0 261 191A15 15 0 0 0 245 176L132,176A15 15 0 0 0 117 191A15 15 0 0 0 132 206Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">binary-operator</text>
<polygon points="284,191 272,195 272,186" style="fill:rgb(0,0,0)"/>
<path d="M261,191L278,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,206L333,206L333,176L284,176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="308" y="191" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,191 905,195 905,186" style="fill:rgb(0,0,0)"/>
<path d="M333,191L910,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,191 L 924,191 Q 931,191 931,183 L 931,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,191 33,195 33,186" style="fill:rgb(0,0,0)"/>
<path d="M24,176 L 24,183 Q 24,191 31,191 L 39,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,245L162,245A15 15 0 0 0 177 230A15 15 0 0 0 162 215L60,215A15 15 0 0 0 45 230A15 15 0 0 0 60 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="111" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-name</text>
<polygon points="194,230 183,234 183,226" style="fill:rgb(0,0,0)"/>
<path d="M177,230L188,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,245A15 15 0 0 0 224 230A15 15 0 0 0 209 215A15 15 0 0 0 194 230A15 15 0 0 0 209 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="260,230 249,234 249,226" style="fill:rgb(0,0,0)"/>
<path d="M224,230L255,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,245L437,245L437,215L260,215Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="230" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">function-arguments</text>
<polygon points="473,230 461,234 461,226" style="fill:rgb(0,0,0)"/>
<path d="M437,230L467,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,245A15 15 0 0 0 503 230A15 15 0 0 0 488 215A15 15 0 0 0 473 230A15 15 0 0 0 488 245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="230" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="541,260 529,265 529,256" style="fill:rgb(0,0,0)"/>
<path d="M503,230 L 510,230 Q 518,230 518,245 L 518,245 Q 518,260 527,260 L 535,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,275L653,275L653,245L541,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="691,230 680,234 680,226" style="fill:rgb(0,0,0)"/>
<path d="M653,260 L 661,260 Q 668,260 668,245 L 668,245 Q 668,230 677,230 L 685,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="729,260 718,265 718,256" style="fill:rgb(0,0,0)"/>
<path d="M691,230 L 699,230 Q 706,230 706,245 L 706,245 Q 706,260 715,260 L 723,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,275L837,275L837,245L729,245Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="783" y="260" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">over-clause</text>
<polygon points="916,260 905,265 905,256" style="fill:rgb(0,0,0)"/>
<path d="M837,260L910,260"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,260 L 924,260 Q 931,260 931,253 L 931,245"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,230 33,234 33,226" style="fill:rgb(0,0,0)"/>
<path d="M24,215 L 24,222 Q 24,230 31,230 L 39,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,230 585,234 585,226" style="fill:rgb(0,0,0)"/>
<path d="M503,230L591,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,230L680,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,230 905,234 905,226" style="fill:rgb(0,0,0)"/>
<path d="M691,230L910,230"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,230 L 924,230 Q 931,230 931,222 L 931,215"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,321A15 15 0 0 0 75 306A15 15 0 0 0 60 290A15 15 0 0 0 45 306A15 15 0 0 0 60 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,306 100,310 100,301" style="fill:rgb(0,0,0)"/>
<path d="M75,306L105,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M111,321L160,321L160,290L111,290Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="306" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="196,306 185,310 185,301" style="fill:rgb(0,0,0)"/>
<path d="M160,306L191,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M211,321A15 15 0 0 0 227 306A15 15 0 0 0 211 290A15 15 0 0 0 196 306A15 15 0 0 0 211 321Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="211" y="306" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,306 905,310 905,301" style="fill:rgb(0,0,0)"/>
<path d="M227,306L910,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,306 L 924,306 Q 931,306 931,298 L 931,291"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,306 33,310 33,301" style="fill:rgb(0,0,0)"/>
<path d="M24,290 L 24,298 Q 24,306 31,306 L 39,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M136,284A15 15 0 0 0 151 269A15 15 0 0 0 136 254A15 15 0 0 0 121 269A15 15 0 0 0 136 284Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="269" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="151,269 162,265 162,274" style="fill:rgb(0,0,0)"/>
<path d="M160,306 L 168,306 Q 175,306 175,291 L 175,284 Q 175,269 166,269 L 157,269"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,269 L 103,269 Q 88,269 88,284 L 88,291 Q 88,306 96,306 L 103,306"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,358L88,358A15 15 0 0 0 103 343A15 15 0 0 0 88 328L60,328A15 15 0 0 0 45 343A15 15 0 0 0 60 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CAST</text>
<polygon points="126,343 114,348 114,339" style="fill:rgb(0,0,0)"/>
<path d="M103,343L120,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M141,358A15 15 0 0 0 156 343A15 15 0 0 0 141 328A15 15 0 0 0 126 343A15 15 0 0 0 141 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="179,343 168,348 168,339" style="fill:rgb(0,0,0)"/>
<path d="M156,343L173,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,358L228,358L228,328L179,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="204" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="251,343 240,348 240,339" style="fill:rgb(0,0,0)"/>
<path d="M228,343L246,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,358L271,358A15 15 0 0 0 286 343A15 15 0 0 0 271 328L267,328A15 15 0 0 0 251 343A15 15 0 0 0 267 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="269" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="309,343 297,348 297,339" style="fill:rgb(0,0,0)"/>
<path d="M286,343L303,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M309,358L408,358L408,328L309,328Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="358" y="343" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">type-name</text>
<polygon points="431,343 419,348 419,339" style="fill:rgb(0,0,0)"/>
<path d="M408,343L425,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M446,358A15 15 0 0 0 461 343A15 15 0 0 0 446 328A15 15 0 0 0 431 343A15 15 0 0 0 446 358Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="343" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,343 905,348 905,339" style="fill:rgb(0,0,0)"/>
<path d="M461,343L910,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,343 L 924,343 Q 931,343 931,336 L 931,328"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,343 33,348 33,339" style="fill:rgb(0,0,0)"/>
<path d="M24,328 L 24,336 Q 24,343 31,343 L 39,343"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,396L94,396L94,366L45,366Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,381 106,385 106,377" style="fill:rgb(0,0,0)"/>
<path d="M94,381L111,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,396L196,396A15 15 0 0 0 211 381A15 15 0 0 0 196 366L132,366A15 15 0 0 0 117 381A15 15 0 0 0 132 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="234,381 223,385 223,377" style="fill:rgb(0,0,0)"/>
<path d="M211,381L229,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,396L355,396A15 15 0 0 0 370 381A15 15 0 0 0 355 366L250,366A15 15 0 0 0 234 381A15 15 0 0 0 250 396Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="302" y="381" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="916,381 905,385 905,377" style="fill:rgb(0,0,0)"/>
<path d="M370,381L910,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,381 L 924,381 Q 931,381 931,374 L 931,366"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,381 33,385 33,377" style="fill:rgb(0,0,0)"/>
<path d="M24,366 L 24,374 Q 24,381 31,381 L 39,381"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,434L94,434L94,404L45,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,419 119,423 119,415" style="fill:rgb(0,0,0)"/>
<path d="M94,419L124,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,434L165,434A15 15 0 0 0 180 419A15 15 0 0 0 165 404L145,404A15 15 0 0 0 130 419A15 15 0 0 0 145 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="234,419 223,423 223,415" style="fill:rgb(0,0,0)"/>
<path d="M180,419L229,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M250,434L273,434A15 15 0 0 0 288 419A15 15 0 0 0 273 404L250,404A15 15 0 0 0 234 419A15 15 0 0 0 250 434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIKE</text>
<path d="M250,472L279,472A15 15 0 0 0 294 457A15 15 0 0 0 279 442L250,442A15 15 0 0 0 234 457A15 15 0 0 0 250 472Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="457" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GLOB</text>
<path d="M250,510L302,510A15 15 0 0 0 317 495A15 15 0 0 0 302 479L250,479A15 15 0 0 0 234 495A15 15 0 0 0 250 510Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REGEXP</text>
<path d="M250,547L297,547A15 15 0 0 0 313 532A15 15 0 0 0 297 517L250,517A15 15 0 0 0 234 532A15 15 0 0 0 250 547Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="274" y="532" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<path d="M378,510L427,510L427,479L378,479Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="495" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M378,434L427,434L427,404L378,404Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="419" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="465,449 454,454 454,445" style="fill:rgb(0,0,0)"/>
<path d="M427,419 L 435,419 Q 442,419 442,434 L 442,434 Q 442,449 451,449 L 460,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,464L532,464A15 15 0 0 0 547 449A15 15 0 0 0 532 434L480,434A15 15 0 0 0 465 449A15 15 0 0 0 480 464Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="506" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ESCAPE</text>
<polygon points="570,449 559,454 559,445" style="fill:rgb(0,0,0)"/>
<path d="M547,449L565,449"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M570,464L620,464L620,434L570,434Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="595" y="449" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="671,419 659,423 659,415" style="fill:rgb(0,0,0)"/>
<path d="M620,449 L 627,449 Q 635,449 635,434 L 635,434 Q 635,419 650,419 L 650,419 L 665,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="916,419 905,423 905,415" style="fill:rgb(0,0,0)"/>
<path d="M671,419L910,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,419 L 924,419 Q 931,419 931,411 L 931,404"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,419 33,423 33,415" style="fill:rgb(0,0,0)"/>
<path d="M24,404 L 24,411 Q 24,419 31,419 L 39,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M100,419 L 108,419 Q 115,419 115,434 L 115,434 Q 115,449 130,449 L 177,449 Q 192,449 192,434 L 192,434 Q 192,419 199,419 L 207,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,532 223,537 223,528" style="fill:rgb(0,0,0)"/>
<path d="M196,419 L 204,419 Q 211,419 211,434 L 211,517 Q 211,532 220,532 L 229,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,457 223,461 223,452" style="fill:rgb(0,0,0)"/>
<path d="M211,442 L 211,449 Q 211,457 220,457 L 229,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,495 223,499 223,490" style="fill:rgb(0,0,0)"/>
<path d="M211,479 L 211,487 Q 211,495 220,495 L 229,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,419 367,423 367,415" style="fill:rgb(0,0,0)"/>
<path d="M288,419L372,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,532 329,537 329,528" style="fill:rgb(0,0,0)"/>
<path d="M313,532L334,532"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,495 367,499 367,490" style="fill:rgb(0,0,0)"/>
<path d="M340,532 L 348,532 Q 355,532 355,517 L 355,510 Q 355,495 364,495 L 372,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,495 329,499 329,490" style="fill:rgb(0,0,0)"/>
<path d="M317,495L334,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,495L378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,457 329,461 329,452" style="fill:rgb(0,0,0)"/>
<path d="M294,457L334,457"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,457 L 348,457 Q 355,457 355,472 L 355,480 Q 355,495 367,495 L 378,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="506,419 495,423 495,415" style="fill:rgb(0,0,0)"/>
<path d="M427,419L501,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M506,419L659,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="547,495 536,499 536,490" style="fill:rgb(0,0,0)"/>
<path d="M427,495L542,495"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M547,495 L 656,495 Q 671,495 671,480 L 671,434 Q 671,419 686,419 L 692,419 L 707,419"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,585L94,585L94,555L45,555Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,570 119,574 119,566" style="fill:rgb(0,0,0)"/>
<path d="M94,570L124,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,585L194,585A15 15 0 0 0 209 570A15 15 0 0 0 194 555L145,555A15 15 0 0 0 130 570A15 15 0 0 0 145 585Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="170" y="570" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ISNULL</text>
<polygon points="916,570 905,574 905,566" style="fill:rgb(0,0,0)"/>
<path d="M209,570L910,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,570 L 924,570 Q 931,570 931,563 L 931,555"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,570 33,574 33,566" style="fill:rgb(0,0,0)"/>
<path d="M24,555 L 24,563 Q 24,570 31,570 L 39,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,623L215,623A15 15 0 0 0 230 608A15 15 0 0 0 215 593L145,593A15 15 0 0 0 130 608A15 15 0 0 0 145 623Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="608" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTNULL</text>
<path d="M145,661L165,661A15 15 0 0 0 180 646A15 15 0 0 0 165 631L145,631A15 15 0 0 0 130 646A15 15 0 0 0 145 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="203,646 192,650 192,641" style="fill:rgb(0,0,0)"/>
<path d="M180,646L198,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,661L250,661A15 15 0 0 0 265 646A15 15 0 0 0 250 631L219,631A15 15 0 0 0 203 646A15 15 0 0 0 219 661Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="646" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="288,646 276,650 276,641" style="fill:rgb(0,0,0)"/>
<path d="M265,646L282,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="339,570 327,574 327,566" style="fill:rgb(0,0,0)"/>
<path d="M288,646 L 295,646 Q 303,646 303,631 L 303,585 Q 303,570 318,570 L 318,570 L 333,570"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="288,608 276,612 276,604" style="fill:rgb(0,0,0)"/>
<path d="M230,608L282,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,608 L 295,608 Q 303,608 303,600 L 303,593"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,646 119,650 119,641" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,631 Q 109,646 117,646 L 124,646"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="130,608 119,612 119,604" style="fill:rgb(0,0,0)"/>
<path d="M94,570 L 102,570 Q 109,570 109,585 L 109,593 Q 109,608 117,608 L 124,608"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,699L94,699L94,668L45,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,684 106,688 106,679" style="fill:rgb(0,0,0)"/>
<path d="M94,684L111,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,699A15 15 0 0 0 147 684A15 15 0 0 0 132 668A15 15 0 0 0 117 684A15 15 0 0 0 132 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IS</text>
<polygon points="183,684 172,688 172,679" style="fill:rgb(0,0,0)"/>
<path d="M147,684L178,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M198,699L219,699A15 15 0 0 0 234 684A15 15 0 0 0 219 668L198,668A15 15 0 0 0 183 684A15 15 0 0 0 198 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="270,684 258,688 258,679" style="fill:rgb(0,0,0)"/>
<path d="M234,684L264,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="306,684 294,688 294,679" style="fill:rgb(0,0,0)"/>
<path d="M270,684L300,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,699L389,699A15 15 0 0 0 404 684A15 15 0 0 0 389 668L321,668A15 15 0 0 0 306 684A15 15 0 0 0 321 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="355" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="440,684 429,688 429,679" style="fill:rgb(0,0,0)"/>
<path d="M404,684L434,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,699L490,699A15 15 0 0 0 505 684A15 15 0 0 0 490 668L455,668A15 15 0 0 0 440 684A15 15 0 0 0 455 699Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="541,684 530,688 530,679" style="fill:rgb(0,0,0)"/>
<path d="M505,684L535,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M541,699L590,699L590,668L541,668Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="684" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,684 905,688 905,679" style="fill:rgb(0,0,0)"/>
<path d="M590,684L910,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,684 L 924,684 Q 931,684 931,676 L 931,669"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,684 33,688 33,679" style="fill:rgb(0,0,0)"/>
<path d="M24,668 L 24,676 Q 24,684 31,684 L 39,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,684 L 156,684 Q 164,684 164,696 Q 164,708 179,708 L 230,708 Q 245,708 245,696 Q 245,684 253,684 L 260,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,684 L 279,684 Q 286,684 286,696 Q 286,708 301,708 L 502,708 Q 517,708 517,696 Q 517,684 524,684 L 532,684"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,744L94,744L94,714L45,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,729 119,733 119,725" style="fill:rgb(0,0,0)"/>
<path d="M94,729L124,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,744L165,744A15 15 0 0 0 180 729A15 15 0 0 0 165 714L145,714A15 15 0 0 0 130 729A15 15 0 0 0 145 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,729 205,733 205,725" style="fill:rgb(0,0,0)"/>
<path d="M180,729L211,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,744L304,744A15 15 0 0 0 319 729A15 15 0 0 0 304 714L232,714A15 15 0 0 0 216 729A15 15 0 0 0 232 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="342,729 331,733 331,725" style="fill:rgb(0,0,0)"/>
<path d="M319,729L336,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M342,744L391,744L391,714L342,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="367" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="414,729 403,733 403,725" style="fill:rgb(0,0,0)"/>
<path d="M391,729L409,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M430,744L450,744A15 15 0 0 0 465 729A15 15 0 0 0 450 714L430,714A15 15 0 0 0 414 729A15 15 0 0 0 430 744Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="488,729 477,733 477,725" style="fill:rgb(0,0,0)"/>
<path d="M465,729L483,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M488,744L538,744L538,714L488,714Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="513" y="729" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="916,729 905,733 905,725" style="fill:rgb(0,0,0)"/>
<path d="M538,729L910,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,729 L 924,729 Q 931,729 931,721 L 931,714"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,729 33,733 33,725" style="fill:rgb(0,0,0)"/>
<path d="M24,714 L 24,721 Q 24,729 31,729 L 39,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,729 L 103,729 Q 110,729 110,741 Q 110,753 125,753 L 177,753 Q 192,753 192,741 Q 192,729 199,729 L 207,729"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,797L94,797L94,767L45,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="130,782 119,786 119,778" style="fill:rgb(0,0,0)"/>
<path d="M94,782L124,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,797L165,797A15 15 0 0 0 180 782A15 15 0 0 0 165 767L145,767A15 15 0 0 0 130 782A15 15 0 0 0 145 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="155" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="216,782 205,786 205,778" style="fill:rgb(0,0,0)"/>
<path d="M180,782L211,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M232,797L234,797A15 15 0 0 0 249 782A15 15 0 0 0 234 767L232,767A15 15 0 0 0 216 782A15 15 0 0 0 232 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IN</text>
<polygon points="285,782 273,786 273,778" style="fill:rgb(0,0,0)"/>
<path d="M249,782L279,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,797A15 15 0 0 0 315 782A15 15 0 0 0 300 767A15 15 0 0 0 285 782A15 15 0 0 0 300 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,782 340,786 340,778" style="fill:rgb(0,0,0)"/>
<path d="M315,782L345,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,797L455,797L455,767L351,767Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="782" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="491,782 480,786 480,778" style="fill:rgb(0,0,0)"/>
<path d="M455,782L486,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M507,797A15 15 0 0 0 522 782A15 15 0 0 0 507 767A15 15 0 0 0 491 782A15 15 0 0 0 507 797Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="507" y="782" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,782 905,786 905,778" style="fill:rgb(0,0,0)"/>
<path d="M522,782L910,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,782 L 924,782 Q 931,782 931,774 L 931,767"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,782 33,786 33,778" style="fill:rgb(0,0,0)"/>
<path d="M24,767 L 24,774 Q 24,782 31,782 L 39,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,782 L 103,782 Q 110,782 110,794 Q 110,806 125,806 L 177,806 Q 192,806 192,794 Q 192,782 199,782 L 207,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,782 L 324,782 Q 332,782 332,770 Q 332,758 347,758 L 452,758 Q 467,758 467,770 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M379,835L428,835L428,805L379,805Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="820" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="379,820 367,824 367,815" style="fill:rgb(0,0,0)"/>
<path d="M317,782 L 324,782 Q 332,782 332,797 L 332,805 Q 332,820 347,820 L 358,820 L 373,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M428,820 L 452,820 Q 467,820 467,805 L 467,797 Q 467,782 475,782 L 482,782"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,873A15 15 0 0 0 418 857A15 15 0 0 0 403 842A15 15 0 0 0 388 857A15 15 0 0 0 403 873Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="857" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,857 430,853 430,862" style="fill:rgb(0,0,0)"/>
<path d="M428,820 L 435,820 Q 443,820 443,835 L 443,842 Q 443,857 434,857 L 424,857"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,857 L 371,857 Q 356,857 356,842 L 356,835 Q 356,820 363,820 L 371,820"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,925L396,925A15 15 0 0 0 412 910A15 15 0 0 0 396 895L300,895A15 15 0 0 0 285 910A15 15 0 0 0 300 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="429,910 417,915 417,906" style="fill:rgb(0,0,0)"/>
<path d="M412,910L423,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M444,925A15 15 0 0 0 459 910A15 15 0 0 0 444 895A15 15 0 0 0 429 910A15 15 0 0 0 444 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="444" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="513,910 502,915 502,906" style="fill:rgb(0,0,0)"/>
<path d="M459,910L507,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,925L627,925A15 15 0 0 0 642 910A15 15 0 0 0 627 895L528,895A15 15 0 0 0 513 910A15 15 0 0 0 528 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="577" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function</text>
<polygon points="659,910 647,915 647,906" style="fill:rgb(0,0,0)"/>
<path d="M642,910L653,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,925A15 15 0 0 0 689 910A15 15 0 0 0 674 895A15 15 0 0 0 659 910A15 15 0 0 0 674 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="674" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="734,910 723,915 723,906" style="fill:rgb(0,0,0)"/>
<path d="M689,910L728,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M734,925L783,925L783,895L734,895Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="910" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="828,910 817,915 817,906" style="fill:rgb(0,0,0)"/>
<path d="M783,910L823,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M844,925A15 15 0 0 0 859 910A15 15 0 0 0 844 895A15 15 0 0 0 828 910A15 15 0 0 0 844 925Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="844" y="910" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,910 905,915 905,906" style="fill:rgb(0,0,0)"/>
<path d="M859,910L910,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,910 L 924,910 Q 931,910 931,903 L 931,895"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M528,865L603,865A15 15 0 0 0 619 850A15 15 0 0 0 603 835L528,835A15 15 0 0 0 513 850A15 15 0 0 0 528 865Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="566" y="850" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="916,850 905,854 905,846" style="fill:rgb(0,0,0)"/>
<path d="M619,850L910,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,850 L 924,850 Q 931,850 931,842 L 931,835"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="513,850 502,854 502,846" style="fill:rgb(0,0,0)"/>
<path d="M475,910 L 483,910 Q 490,910 490,895 L 490,865 Q 490,850 499,850 L 507,850"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,892A15 15 0 0 0 774 877A15 15 0 0 0 759 862A15 15 0 0 0 744 877A15 15 0 0 0 759 892Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="759" y="877" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="774,877 785,873 785,881" style="fill:rgb(0,0,0)"/>
<path d="M783,910 L 791,910 Q 798,910 798,895 L 798,892 Q 798,877 789,877 L 780,877"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M744,877 L 726,877 Q 711,877 711,892 L 711,895 Q 711,910 719,910 L 726,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M689,910 L 697,910 Q 704,910 704,921 Q 704,932 719,932 L 790,932 Q 805,932 805,921 Q 805,910 813,910 L 820,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="285,910 273,915 273,906" style="fill:rgb(0,0,0)"/>
<path d="M249,782 L 256,782 Q 264,782 264,797 L 264,895 Q 264,910 272,910 L 279,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,882 412,886 412,877" style="fill:rgb(0,0,0)"/>
<path d="M264,867 L 264,874 Q 264,882 279,882 L 402,882 L 417,882"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,882 L 456,882 Q 471,882 471,896 Q 471,910 478,910 L 486,910"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,971L80,971A15 15 0 0 0 95 956A15 15 0 0 0 80 941L60,941A15 15 0 0 0 45 956A15 15 0 0 0 60 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="131,956 120,960 120,951" style="fill:rgb(0,0,0)"/>
<path d="M95,956L125,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,971L191,971A15 15 0 0 0 206 956A15 15 0 0 0 191 941L146,941A15 15 0 0 0 131 956A15 15 0 0 0 146 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<polygon points="242,956 231,960 231,951" style="fill:rgb(0,0,0)"/>
<path d="M206,956L236,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,971A15 15 0 0 0 272 956A15 15 0 0 0 257 941A15 15 0 0 0 242 956A15 15 0 0 0 257 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="295,956 284,960 284,951" style="fill:rgb(0,0,0)"/>
<path d="M272,956L290,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,971L400,971L400,941L295,941Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="347" y="956" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="423,956 411,960 411,951" style="fill:rgb(0,0,0)"/>
<path d="M400,956L417,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,971A15 15 0 0 0 453 956A15 15 0 0 0 438 941A15 15 0 0 0 423 956A15 15 0 0 0 438 971Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="956" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="916,956 905,960 905,951" style="fill:rgb(0,0,0)"/>
<path d="M453,956L910,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,956 L 924,956 Q 931,956 931,948 L 931,941"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,956 33,960 33,951" style="fill:rgb(0,0,0)"/>
<path d="M24,941 L 24,948 Q 24,956 31,956 L 39,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="70,929 59,934 59,925" style="fill:rgb(0,0,0)"/>
<path d="M24,914 L 24,922 Q 24,929 39,929 L 49,929 L 64,929"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M70,929 L 201,929 Q 216,929 216,943 Q 216,956 223,956 L 231,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,929 L 101,929 Q 108,929 108,943 Q 108,956 116,956 L 123,956"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,1009L89,1009A15 15 0 0 0 104 994A15 15 0 0 0 89 978L60,978A15 15 0 0 0 45 994A15 15 0 0 0 60 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASE</text>
<polygon points="140,994 128,998 128,989" style="fill:rgb(0,0,0)"/>
<path d="M104,994L134,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M140,1009L189,1009L189,978L140,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="164" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="243,994 232,998 232,989" style="fill:rgb(0,0,0)"/>
<path d="M189,994L237,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,1009L298,1009A15 15 0 0 0 313 994A15 15 0 0 0 298 978L258,978A15 15 0 0 0 243 994A15 15 0 0 0 258 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHEN</text>
<polygon points="336,994 324,998 324,989" style="fill:rgb(0,0,0)"/>
<path d="M313,994L330,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,1009L385,1009L385,978L336,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="408,994 396,998 396,989" style="fill:rgb(0,0,0)"/>
<path d="M385,994L402,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,1009L456,1009A15 15 0 0 0 472 994A15 15 0 0 0 456 978L423,978A15 15 0 0 0 408 994A15 15 0 0 0 423 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="440" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">THEN</text>
<polygon points="495,994 483,998 483,989" style="fill:rgb(0,0,0)"/>
<path d="M472,994L489,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M495,1009L544,1009L544,978L495,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="616,994 604,998 604,989" style="fill:rgb(0,0,0)"/>
<path d="M544,994L610,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M631,1009L658,1009A15 15 0 0 0 673 994A15 15 0 0 0 658 978L631,978A15 15 0 0 0 616 994A15 15 0 0 0 631 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="645" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ELSE</text>
<polygon points="696,994 685,998 685,989" style="fill:rgb(0,0,0)"/>
<path d="M673,994L691,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M696,1009L746,1009L746,978L696,978Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="721" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="782,994 770,998 770,989" style="fill:rgb(0,0,0)"/>
<path d="M746,994L776,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M797,1009L818,1009A15 15 0 0 0 833 994A15 15 0 0 0 818 978L797,978A15 15 0 0 0 782 994A15 15 0 0 0 797 1009Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="807" y="994" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">END</text>
<polygon points="916,994 905,998 905,989" style="fill:rgb(0,0,0)"/>
<path d="M833,994L910,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,994 L 924,994 Q 931,994 931,986 L 931,979"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,994 33,998 33,989" style="fill:rgb(0,0,0)"/>
<path d="M24,978 L 24,986 Q 24,994 31,994 L 39,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,994 L 111,994 Q 119,994 119,1007 Q 119,1021 134,1021 L 186,1021 Q 201,1021 201,1007 Q 201,994 208,994 L 216,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="360,1021 372,1016 372,1025" style="fill:rgb(0,0,0)"/>
<path d="M544,994 L 551,994 Q 559,994 559,1007 Q 559,1021 544,1021 L 381,1021 L 366,1021"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,1021 L 235,1021 Q 220,1021 220,1007 Q 220,994 227,994 L 235,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M578,994 L 585,994 Q 593,994 593,1007 Q 593,1021 608,1021 L 742,1021 Q 757,1021 757,1007 Q 757,994 765,994 L 772,994"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,1066L173,1066L173,1036L45,1036Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="1051" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">raise-function</text>
<polygon points="916,1051 905,1055 905,1047" style="fill:rgb(0,0,0)"/>
<path d="M173,1051L910,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M916,1051 L 924,1051 Q 931,1051 931,1036 L 931,32 Q 931,17 939,17 L 946,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,1051 33,1055 33,1047" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,1036 Q 24,1051 31,1051 L 39,1051"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#aggregate-function-invocation">aggregate-function-invocation</a>&nbsp;&nbsp; <a href="#attach-stmt">attach-stmt</a>&nbsp;&nbsp; <a href="#column-constraint">column-constraint</a>&nbsp;&nbsp; <a href="#compound-select-stmt">compound-select-stmt</a>&nbsp;&nbsp; <a href="#create-index-stmt">create-index-stmt</a>&nbsp;&nbsp; <a href="#create-trigger-stmt">create-trigger-stmt</a>&nbsp;&nbsp; <a href="#delete-stmt">delete-stmt</a>&nbsp;&nbsp; <a href="#delete-stmt-limited">delete-stmt-limited</a>&nbsp;&nbsp; <a href="#factored-select-stmt">factored-select-stmt</a>&nbsp;&nbsp; <a href="#filter-clause">filter-clause</a>&nbsp;&nbsp; <a href="#frame-spec">frame-spec</a>&nbsp;&nbsp; <a href="#function-arguments">function-arguments</a>&nbsp;&nbsp; <a href="#indexed-column">indexed-column</a>&nbsp;&nbsp; <a href="#insert-stmt">insert-stmt</a>&nbsp;&nbsp; <a href="#join-constraint">join-constraint</a>&nbsp;&nbsp; <a href="#ordering-term">ordering-term</a>&nbsp;&nbsp; <a href="#over-clause">over-clause</a>&nbsp;&nbsp; <a href="#result-column">result-column</a>&nbsp;&nbsp; <a href="#returning-clause">returning-clause</a>&nbsp;&nbsp; <a href="#select-core">select-core</a>&nbsp;&nbsp; <a href="#select-stmt">select-stmt</a>&nbsp;&nbsp; <a href="#simple-function-invocation">simple-function-invocation</a>&nbsp;&nbsp; <a href="#simple-select-stmt">simple-select-stmt</a>&nbsp;&nbsp; <a href="#table-constraint">table-constraint</a>&nbsp;&nbsp; <a href="#table-or-subquery">table-or-subquery</a>&nbsp;&nbsp; <a href="#update-stmt">update-stmt</a>&nbsp;&nbsp; <a href="#update-stmt-limited">update-stmt-limited</a>&nbsp;&nbsp; <a href="#upsert-clause">upsert-clause</a>&nbsp;&nbsp; <a href="#window-defn">window-defn</a>&nbsp;&nbsp; <a href="#window-function-invocation">window-function-invocation</a><br></br>
References:&nbsp;&nbsp; <a href="#filter-clause">filter-clause</a>&nbsp;&nbsp; <a href="#function-arguments">function-arguments</a>&nbsp;&nbsp; <a href="#literal-value">literal-value</a>&nbsp;&nbsp; <a href="#over-clause">over-clause</a>&nbsp;&nbsp; <a href="#raise-function">raise-function</a>&nbsp;&nbsp; <a href="#select-stmt">select-stmt</a>&nbsp;&nbsp; <a href="#type-name">type-name</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="factored-select-stmt"></a><h4>factored-select-stmt:</h4><div class='imgcontainer'>
<div style="max-width:629px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 629.266 500.04">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L91,32A15 15 0 0 0 106 17A15 15 0 0 0 91 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M166,62L252,62A15 15 0 0 0 267 47A15 15 0 0 0 252 32L166,32A15 15 0 0 0 151 47A15 15 0 0 0 166 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="209,17 197,21 197,12" style="fill:rgb(0,0,0)"/>
<path d="M106,17L203,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M209,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M357,32L583,32L583,2L357,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="151,47 139,51 139,43" style="fill:rgb(0,0,0)"/>
<path d="M106,17 L 113,17 Q 121,17 121,32 L 121,32 Q 121,47 133,47 L 145,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,47 278,51 278,43" style="fill:rgb(0,0,0)"/>
<path d="M267,47L284,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,47 L 297,47 Q 305,47 305,32 L 305,32 Q 305,17 320,17 L 330,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,70A15 15 0 0 0 485 55L485,55A15 15 0 0 0 470 39A15 15 0 0 0 455 55L455,55A15 15 0 0 0 470 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="485,55 497,50 497,59" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,40 Q 598,55 583,55 L 506,55 L 491,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,55 L 349,55 Q 334,55 334,40 L 334,32 Q 334,17 340,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M117,153L220,153L220,123L117,123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="138" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-core</text>
<path d="M60,304L105,304A15 15 0 0 0 120 289A15 15 0 0 0 105 274L60,274A15 15 0 0 0 45 289A15 15 0 0 0 60 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="82" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="143,289 131,293 131,285" style="fill:rgb(0,0,0)"/>
<path d="M120,289L137,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,304L162,304A15 15 0 0 0 177 289A15 15 0 0 0 162 274L158,274A15 15 0 0 0 143 289A15 15 0 0 0 158 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="160" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M60,410L93,410A15 15 0 0 0 109 395A15 15 0 0 0 93 380L60,380A15 15 0 0 0 45 395A15 15 0 0 0 60 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="77" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="132,395 120,399 120,390" style="fill:rgb(0,0,0)"/>
<path d="M109,395L126,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,410L181,410L181,380L132,380Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="117,138 105,142 105,133" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,123 Q 24,138 39,138 L 96,138 L 111,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="312,92 323,88 323,97" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 604,17 Q 619,17 619,32 L 619,77 Q 619,92 604,92 L 333,92 L 318,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M312,92 L 39,92 Q 24,92 24,100 L 24,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M80,198L257,198L257,168L80,168Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="169" y="183" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="257,183 269,179 269,187" style="fill:rgb(0,0,0)"/>
<path d="M272,138 L 280,138 Q 287,138 287,153 L 287,168 Q 287,183 275,183 L 263,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M80,183 L 65,183 Q 50,183 50,168 L 50,153 Q 50,138 58,138 L 65,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="296,236 308,232 308,240" style="fill:rgb(0,0,0)"/>
<path d="M220,138 L 342,138 Q 357,138 357,153 L 357,221 Q 357,236 342,236 L 317,236 L 302,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,289 33,293 33,285" style="fill:rgb(0,0,0)"/>
<path d="M296,236 L 39,236 Q 24,236 24,251 L 24,274 Q 24,289 31,289 L 39,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="222,289 210,293 210,285" style="fill:rgb(0,0,0)"/>
<path d="M177,289L216,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,304L352,304L352,274L222,274Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="287" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M287,342A15 15 0 0 0 302 327A15 15 0 0 0 287 312A15 15 0 0 0 272 327A15 15 0 0 0 287 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="287" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="302,327 314,322 314,331" style="fill:rgb(0,0,0)"/>
<path d="M352,289 L 359,289 Q 367,289 367,304 L 367,312 Q 367,327 352,327 L 323,327 L 308,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,327 L 214,327 Q 199,327 199,312 L 199,304 Q 199,289 205,289 L 210,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,319 384,308 392,308" style="fill:rgb(0,0,0)"/>
<path d="M352,289 L 373,289 Q 388,289 388,301 L 388,313"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="198,361 210,356 210,365" style="fill:rgb(0,0,0)"/>
<path d="M388,319 L 388,346 Q 388,361 373,361 L 219,361 L 204,361"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,395 33,399 33,390" style="fill:rgb(0,0,0)"/>
<path d="M198,361 L 39,361 Q 24,361 24,376 L 24,380 Q 24,395 31,395 L 39,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="24,327 20,315 28,315" style="fill:rgb(0,0,0)"/>
<path d="M24,274L24,321"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M24,327L24,380"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M255,440L306,440A15 15 0 0 0 321 425A15 15 0 0 0 306 410L255,410A15 15 0 0 0 240 425A15 15 0 0 0 255 440Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="425" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="344,425 333,429 333,421" style="fill:rgb(0,0,0)"/>
<path d="M321,425L339,425"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M344,440L394,440L394,410L344,410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="369" y="425" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="417,425 405,429 405,421" style="fill:rgb(0,0,0)"/>
<path d="M394,425L411,425"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M255,478A15 15 0 0 0 270 463A15 15 0 0 0 255 448A15 15 0 0 0 240 463A15 15 0 0 0 255 478Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="255" y="463" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="293,463 282,467 282,458" style="fill:rgb(0,0,0)"/>
<path d="M270,463L287,463"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M293,478L342,478L342,448L293,448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="318" y="463" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="204,395 192,399 192,390" style="fill:rgb(0,0,0)"/>
<path d="M181,395L198,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="240,463 228,467 228,458" style="fill:rgb(0,0,0)"/>
<path d="M204,395 L 211,395 Q 219,395 219,410 L 219,448 Q 219,463 226,463 L 234,463"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="240,425 228,429 228,421" style="fill:rgb(0,0,0)"/>
<path d="M204,395 L 211,395 Q 219,395 219,410 L 219,410 Q 219,425 226,425 L 234,425"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="417,395 405,399 405,390" style="fill:rgb(0,0,0)"/>
<path d="M204,395L411,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="619,493 608,497 608,489" style="fill:rgb(0,0,0)"/>
<path d="M417,395 L 438,395 Q 453,395 453,410 L 453,478 Q 453,493 468,493 L 599,493 L 614,493"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="623" cy="493" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,425 L 438,425 Q 453,425 453,433 L 453,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="417,463 405,467 405,458" style="fill:rgb(0,0,0)"/>
<path d="M342,463L411,463"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,463 L 438,463 Q 453,463 453,470 L 453,478"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="417,493 405,497 405,489" style="fill:rgb(0,0,0)"/>
<path d="M24,380 L 24,478 Q 24,493 39,493 L 396,493 L 411,493"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,493L489,493"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<br></br>
References:&nbsp;&nbsp; <a href="#common-table-expression">common-table-expression</a>&nbsp;&nbsp; <a href="#compound-operator">compound-operator</a>&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#ordering-term">ordering-term</a>&nbsp;&nbsp; <a href="#select-core">select-core</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>
</div>

<a name="filter-clause"></a><h4>filter-clause:</h4><div class='imgcontainer'>
<div style="max-width:422px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 422.381 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L93,32A15 15 0 0 0 108 17A15 15 0 0 0 93 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FILTER</text>
<polygon points="131,17 119,21 119,12" style="fill:rgb(0,0,0)"/>
<path d="M108,17L125,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M146,32L146,32A15 15 0 0 0 161 17A15 15 0 0 0 146 2L146,2A15 15 0 0 0 131 17A15 15 0 0 0 146 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="146" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="184,17 173,21 173,12" style="fill:rgb(0,0,0)"/>
<path d="M161,17L178,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M199,32L249,32A15 15 0 0 0 264 17A15 15 0 0 0 249 2L199,2A15 15 0 0 0 184 17A15 15 0 0 0 199 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="224" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="287,17 275,21 275,12" style="fill:rgb(0,0,0)"/>
<path d="M264,17L281,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,32L336,32L336,2L287,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="312" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="359,17 348,21 348,12" style="fill:rgb(0,0,0)"/>
<path d="M336,17L353,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,32A15 15 0 0 0 389 17A15 15 0 0 0 374 2A15 15 0 0 0 359 17A15 15 0 0 0 374 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="374" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="413,17 401,21 401,12" style="fill:rgb(0,0,0)"/>
<path d="M389,17L407,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="416" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#aggregate-function-invocation">aggregate-function-invocation</a>&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#window-function-invocation">window-function-invocation</a><br></br>
References:&nbsp;&nbsp; <a href="#expr">expr</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="foreign-key-clause"></a><h4>foreign-key-clause:</h4><div class='imgcontainer'>
<div style="max-width:648px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 648.158 492.48">
<circle cx="5" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,55 33,59 33,50" style="fill:rgb(0,0,0)"/>
<path d="M9,55L39,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,70L164,70A15 15 0 0 0 179 55A15 15 0 0 0 164 39L60,39A15 15 0 0 0 45 55A15 15 0 0 0 60 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REFERENCES</text>
<polygon points="202,55 190,59 190,50" style="fill:rgb(0,0,0)"/>
<path d="M179,55L196,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,70L306,70A15 15 0 0 0 322 55A15 15 0 0 0 306 39L217,39A15 15 0 0 0 202 55A15 15 0 0 0 217 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="262" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">foreign-table</text>
<polygon points="358,55 346,59 346,50" style="fill:rgb(0,0,0)"/>
<path d="M322,55L352,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M373,70A15 15 0 0 0 388 55A15 15 0 0 0 373 39A15 15 0 0 0 358 55A15 15 0 0 0 373 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="373" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="424,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M388,55L418,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M439,70L533,70A15 15 0 0 0 548 55A15 15 0 0 0 533 39L439,39A15 15 0 0 0 424 55A15 15 0 0 0 439 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="486" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="584,55 573,59 573,50" style="fill:rgb(0,0,0)"/>
<path d="M548,55L578,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M599,70A15 15 0 0 0 614 55A15 15 0 0 0 599 39A15 15 0 0 0 584 55A15 15 0 0 0 599 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="599" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<path d="M486,32A15 15 0 0 0 501 17L501,17A15 15 0 0 0 486 2A15 15 0 0 0 471 17L471,17A15 15 0 0 0 486 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="486" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="501,17 513,12 513,21" style="fill:rgb(0,0,0)"/>
<path d="M548,55 L 556,55 Q 563,55 563,40 L 563,32 Q 563,17 548,17 L 522,17 L 507,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,17 L 416,17 Q 401,17 401,32 L 401,40 Q 401,55 412,55 L 424,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,176L69,176A15 15 0 0 0 84 160A15 15 0 0 0 69 145L60,145A15 15 0 0 0 45 160A15 15 0 0 0 60 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="64" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="120,160 109,165 109,156" style="fill:rgb(0,0,0)"/>
<path d="M84,160L114,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,176L188,176A15 15 0 0 0 203 160A15 15 0 0 0 188 145L135,145A15 15 0 0 0 120 160A15 15 0 0 0 135 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="162" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DELETE</text>
<polygon points="275,160 264,165 264,156" style="fill:rgb(0,0,0)"/>
<path d="M203,160L269,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,176L306,176A15 15 0 0 0 321 160A15 15 0 0 0 306 145L290,145A15 15 0 0 0 275 160A15 15 0 0 0 290 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="298" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="344,160 332,165 332,156" style="fill:rgb(0,0,0)"/>
<path d="M321,160L338,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M359,176L390,176A15 15 0 0 0 405 160A15 15 0 0 0 390 145L359,145A15 15 0 0 0 344 160A15 15 0 0 0 359 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<path d="M135,213L189,213A15 15 0 0 0 204 198A15 15 0 0 0 189 183L135,183A15 15 0 0 0 120 198A15 15 0 0 0 135 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="162" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="120,198 109,203 109,194" style="fill:rgb(0,0,0)"/>
<path d="M84,160 L 92,160 Q 99,160 99,175 L 99,183 Q 99,198 107,198 L 114,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M204,198 L 212,198 Q 219,198 219,183 L 219,175 Q 219,160 227,160 L 234,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,213L306,213A15 15 0 0 0 321 198A15 15 0 0 0 306 183L290,183A15 15 0 0 0 275 198A15 15 0 0 0 290 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="298" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="344,198 332,203 332,194" style="fill:rgb(0,0,0)"/>
<path d="M321,198L338,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M359,213L424,213A15 15 0 0 0 440 198A15 15 0 0 0 424 183L359,183A15 15 0 0 0 344 198A15 15 0 0 0 359 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="392" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFAULT</text>
<polygon points="463,198 451,203 451,194" style="fill:rgb(0,0,0)"/>
<path d="M440,198L457,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,198 L 470,198 Q 478,198 478,191 L 478,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,251L357,251A15 15 0 0 0 372 236A15 15 0 0 0 357 221L290,221A15 15 0 0 0 275 236A15 15 0 0 0 290 251Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="324" y="236" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CASCADE</text>
<polygon points="463,236 451,240 451,232" style="fill:rgb(0,0,0)"/>
<path d="M372,236L457,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,236 L 470,236 Q 478,236 478,229 L 478,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,289L361,289A15 15 0 0 0 376 274A15 15 0 0 0 361 259L290,259A15 15 0 0 0 275 274A15 15 0 0 0 290 289Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="326" y="274" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RESTRICT</text>
<polygon points="463,274 451,278 451,270" style="fill:rgb(0,0,0)"/>
<path d="M376,274L457,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,274 L 470,274 Q 478,274 478,266 L 478,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,327L299,327A15 15 0 0 0 314 312A15 15 0 0 0 299 297L290,297A15 15 0 0 0 275 312A15 15 0 0 0 290 327Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="295" y="312" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="337,312 326,316 326,307" style="fill:rgb(0,0,0)"/>
<path d="M314,312L332,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M353,327L404,327A15 15 0 0 0 419 312A15 15 0 0 0 404 297L353,297A15 15 0 0 0 337 312A15 15 0 0 0 353 327Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="378" y="312" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ACTION</text>
<polygon points="463,312 451,316 451,307" style="fill:rgb(0,0,0)"/>
<path d="M419,312L457,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,312 L 470,312 Q 478,312 478,304 L 478,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,357L108,357A15 15 0 0 0 123 342L123,342A15 15 0 0 0 108 327L60,327A15 15 0 0 0 45 342L45,342A15 15 0 0 0 60 357Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="84" y="342" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATCH</text>
<polygon points="146,342 135,346 135,338" style="fill:rgb(0,0,0)"/>
<path d="M123,342L140,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M161,357L188,357A15 15 0 0 0 203 342L203,342A15 15 0 0 0 188 327L161,327A15 15 0 0 0 146 342L146,342A15 15 0 0 0 161 357Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="175" y="342" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="463,342 451,346 451,338" style="fill:rgb(0,0,0)"/>
<path d="M203,342L457,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="442,115 453,111 453,119" style="fill:rgb(0,0,0)"/>
<path d="M463,342 L 470,342 Q 478,342 478,327 L 478,130 Q 478,115 463,115 L 462,115 L 447,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="463,160 451,165 451,156" style="fill:rgb(0,0,0)"/>
<path d="M405,160L457,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M463,160 L 470,160 Q 478,160 478,153 L 478,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,312 264,316 264,307" style="fill:rgb(0,0,0)"/>
<path d="M237,160 L 245,160 Q 252,160 252,175 L 252,297 Q 252,312 261,312 L 269,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,274 264,278 264,270" style="fill:rgb(0,0,0)"/>
<path d="M252,259 L 252,266 Q 252,274 261,274 L 269,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,236 264,240 264,232" style="fill:rgb(0,0,0)"/>
<path d="M252,221 L 252,228 Q 252,236 261,236 L 269,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="275,198 264,203 264,194" style="fill:rgb(0,0,0)"/>
<path d="M252,183 L 252,191 Q 252,198 261,198 L 269,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,160 33,165 33,156" style="fill:rgb(0,0,0)"/>
<path d="M614,55 L 623,55 Q 632,55 632,70 L 632,100 Q 632,115 617,115 L 20,115 Q 5,115 5,130 L 5,145 Q 5,160 20,160 L 24,160 L 39,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,342 33,346 33,338" style="fill:rgb(0,0,0)"/>
<path d="M5,145 L 5,327 Q 5,342 20,342 L 24,342 L 39,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="337,91 332,79 341,79" style="fill:rgb(0,0,0)"/>
<path d="M322,55 L 329,55 Q 337,55 337,70 L 337,70 L 337,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M337,91 L 337,103 Q 337,115 329,115 L 322,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,433L80,433A15 15 0 0 0 95 417A15 15 0 0 0 80 402L60,402A15 15 0 0 0 45 417A15 15 0 0 0 60 433Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="417" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="133,387 122,392 122,383" style="fill:rgb(0,0,0)"/>
<path d="M95,417 L 103,417 Q 110,417 110,402 L 110,402 Q 110,387 119,387 L 127,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M148,402L250,402A15 15 0 0 0 265 387A15 15 0 0 0 250 372L148,372A15 15 0 0 0 133 387A15 15 0 0 0 148 402Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="387" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFERRABLE</text>
<polygon points="303,417 292,422 292,413" style="fill:rgb(0,0,0)"/>
<path d="M265,387 L 273,387 Q 280,387 280,402 L 280,402 Q 280,417 289,417 L 297,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M318,433L389,433A15 15 0 0 0 405 417A15 15 0 0 0 389 402L318,402A15 15 0 0 0 303 417A15 15 0 0 0 318 433Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="354" y="417" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INITIALLY</text>
<polygon points="428,417 416,422 416,413" style="fill:rgb(0,0,0)"/>
<path d="M405,417L422,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M443,433L523,433A15 15 0 0 0 538 417A15 15 0 0 0 523 402L443,402A15 15 0 0 0 428 417A15 15 0 0 0 443 433Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="417" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFERRED</text>
<path d="M318,470L389,470A15 15 0 0 0 405 455A15 15 0 0 0 389 440L318,440A15 15 0 0 0 303 455A15 15 0 0 0 318 470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="354" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INITIALLY</text>
<polygon points="428,455 416,460 416,451" style="fill:rgb(0,0,0)"/>
<path d="M405,455L422,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M443,470L531,470A15 15 0 0 0 546 455A15 15 0 0 0 531 440L443,440A15 15 0 0 0 428 455A15 15 0 0 0 443 470Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="487" y="455" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IMMEDIATE</text>
<polygon points="569,455 558,460 558,451" style="fill:rgb(0,0,0)"/>
<path d="M546,455L564,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="569,417 558,422 558,413" style="fill:rgb(0,0,0)"/>
<path d="M538,417L564,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="569,387 558,392 558,383" style="fill:rgb(0,0,0)"/>
<path d="M265,387L564,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="303,455 292,460 292,451" style="fill:rgb(0,0,0)"/>
<path d="M265,387 L 273,387 Q 280,387 280,402 L 280,440 Q 280,455 289,455 L 297,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="638,486 627,490 627,481" style="fill:rgb(0,0,0)"/>
<path d="M569,387 L 577,387 Q 584,387 584,402 L 584,471 Q 584,486 599,486 L 618,486 L 633,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="642" cy="486" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M569,455 L 577,455 Q 584,455 584,463 L 584,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M569,417 L 577,417 Q 584,417 584,425 L 584,432"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M5,327 L 5,471 Q 5,486 20,486 L 612,486 L 627,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M5,372 L 5,380 Q 5,387 20,387 L 118,387 L 133,387"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,417 33,422 33,413" style="fill:rgb(0,0,0)"/>
<path d="M5,402 L 5,410 Q 5,417 20,417 L 24,417 L 39,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#column-constraint">column-constraint</a>&nbsp;&nbsp; <a href="#table-constraint">table-constraint</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_altertable.html#altertabaddcol">lang_altertable.html#altertabaddcol</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>
</div>

<a name="frame-spec"></a><h4>frame-spec:</h4><div class='imgcontainer'>
<div style="max-width:1039px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1039.65 522.72">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L120,108A15 15 0 0 0 135 92A15 15 0 0 0 120 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUPS</text>
<path d="M135,92 L 143,92 Q 150,92 150,77 L 150,32 Q 150,17 158,17 L 165,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,17 195,21 195,12" style="fill:rgb(0,0,0)"/>
<path d="M165,17L201,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,32L294,32A15 15 0 0 0 309 17A15 15 0 0 0 294 2L222,2A15 15 0 0 0 207 17A15 15 0 0 0 222 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BETWEEN</text>
<polygon points="351,17 339,21 339,12" style="fill:rgb(0,0,0)"/>
<path d="M309,17L345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,32L467,32A15 15 0 0 0 482 17A15 15 0 0 0 467 2L366,2A15 15 0 0 0 351 17A15 15 0 0 0 366 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="500,17 488,21 488,12" style="fill:rgb(0,0,0)"/>
<path d="M482,17L494,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M515,32L603,32A15 15 0 0 0 618 17A15 15 0 0 0 603 2L515,2A15 15 0 0 0 500 17A15 15 0 0 0 515 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="559" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="659,17 648,21 648,12" style="fill:rgb(0,0,0)"/>
<path d="M618,17L653,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M674,32L695,32A15 15 0 0 0 710 17A15 15 0 0 0 695 2L674,2A15 15 0 0 0 659 17A15 15 0 0 0 674 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="685" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AND</text>
<polygon points="752,130 740,135 740,126" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,115 Q 725,130 735,130 L 746,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,145L868,145A15 15 0 0 0 883 130A15 15 0 0 0 868 115L767,115A15 15 0 0 0 752 130A15 15 0 0 0 767 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="817" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="900,130 889,135 889,126" style="fill:rgb(0,0,0)"/>
<path d="M883,130L895,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M915,145L1007,145A15 15 0 0 0 1022 130A15 15 0 0 0 1007 115L915,115A15 15 0 0 0 900 130A15 15 0 0 0 915 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="961" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<path d="M1022,130 L 1029,130 Q 1037,130 1037,138 L 1037,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L109,32A15 15 0 0 0 125 17A15 15 0 0 0 109 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RANGE</text>
<polygon points="142,17 130,21 130,12" style="fill:rgb(0,0,0)"/>
<path d="M125,17L136,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,17L157,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L101,70A15 15 0 0 0 116 55L116,55A15 15 0 0 0 101 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWS</text>
<polygon points="135,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M116,55L129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,55 L 143,55 Q 150,55 150,47 L 150,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,168 195,172 195,164" style="fill:rgb(0,0,0)"/>
<path d="M165,17 L 173,17 Q 180,17 180,32 L 180,153 Q 180,168 190,168 L 201,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,183L323,183A15 15 0 0 0 338 168A15 15 0 0 0 323 153L222,153A15 15 0 0 0 207 168A15 15 0 0 0 222 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNBOUNDED</text>
<polygon points="361,168 350,172 350,164" style="fill:rgb(0,0,0)"/>
<path d="M338,168L355,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M376,183L464,183A15 15 0 0 0 479 168A15 15 0 0 0 464 153L376,153A15 15 0 0 0 361 168A15 15 0 0 0 376 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="420" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,168 1010,172 1010,164" style="fill:rgb(0,0,0)"/>
<path d="M479,168L1016,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,168 L 1029,168 Q 1037,168 1037,175 L 1037,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,221L256,221L256,191L207,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="279,206 267,210 267,201" style="fill:rgb(0,0,0)"/>
<path d="M256,206L273,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,221L382,221A15 15 0 0 0 397 206A15 15 0 0 0 382 191L294,191A15 15 0 0 0 279 206A15 15 0 0 0 294 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="338" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,206 1010,210 1010,201" style="fill:rgb(0,0,0)"/>
<path d="M397,206L1016,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,206 L 1029,206 Q 1037,206 1037,213 L 1037,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,206 195,210 195,201" style="fill:rgb(0,0,0)"/>
<path d="M180,153 L 180,191 Q 180,206 190,206 L 201,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M222,259L292,259A15 15 0 0 0 307 244A15 15 0 0 0 292 228L222,228A15 15 0 0 0 207 244A15 15 0 0 0 222 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="257" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="330,244 318,248 318,239" style="fill:rgb(0,0,0)"/>
<path d="M307,244L324,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,259L369,259A15 15 0 0 0 384 244A15 15 0 0 0 369 228L345,228A15 15 0 0 0 330 244A15 15 0 0 0 345 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="357" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,244 1010,248 1010,239" style="fill:rgb(0,0,0)"/>
<path d="M384,244L1016,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,244 L 1029,244 Q 1037,244 1037,251 L 1037,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="207,244 195,248 195,239" style="fill:rgb(0,0,0)"/>
<path d="M180,191 L 180,229 Q 180,244 190,244 L 201,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70L400,70L400,39L351,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,55 412,59 412,50" style="fill:rgb(0,0,0)"/>
<path d="M400,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,70L526,70A15 15 0 0 0 541 55A15 15 0 0 0 526 39L438,39A15 15 0 0 0 423 55A15 15 0 0 0 438 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="618,55 606,59 606,50" style="fill:rgb(0,0,0)"/>
<path d="M541,55L612,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,55 L 625,55 Q 633,55 633,47 L 633,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,55 339,59 339,50" style="fill:rgb(0,0,0)"/>
<path d="M309,17 L 317,17 Q 324,17 324,32 L 324,40 Q 324,55 335,55 L 345,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,107L436,107A15 15 0 0 0 451 92A15 15 0 0 0 436 77L366,77A15 15 0 0 0 351 92A15 15 0 0 0 366 107Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="401" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="474,92 462,97 462,88" style="fill:rgb(0,0,0)"/>
<path d="M451,92L468,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M489,108L513,108A15 15 0 0 0 528 92A15 15 0 0 0 513 77L489,77A15 15 0 0 0 474 92A15 15 0 0 0 489 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="501" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="618,92 606,97 606,88" style="fill:rgb(0,0,0)"/>
<path d="M528,92L612,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,92 L 625,92 Q 633,92 633,85 L 633,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,92 339,97 339,88" style="fill:rgb(0,0,0)"/>
<path d="M324,39 L 324,77 Q 324,92 335,92 L 345,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,145L400,145L400,115L351,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="423,130 412,134 412,126" style="fill:rgb(0,0,0)"/>
<path d="M400,130L417,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,145L530,145A15 15 0 0 0 545 130A15 15 0 0 0 530 115L438,115A15 15 0 0 0 423 130A15 15 0 0 0 438 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="618,130 606,134 606,126" style="fill:rgb(0,0,0)"/>
<path d="M545,130L612,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M618,130 L 625,130 Q 633,130 633,115 L 633,32 Q 633,17 640,17 L 648,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,130 339,134 339,126" style="fill:rgb(0,0,0)"/>
<path d="M324,77 L 324,115 Q 324,130 335,130 L 345,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,17 740,21 740,12" style="fill:rgb(0,0,0)"/>
<path d="M710,17L746,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,32L801,32L801,2L752,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,17 812,21 812,12" style="fill:rgb(0,0,0)"/>
<path d="M801,17L818,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,32L927,32A15 15 0 0 0 942 17A15 15 0 0 0 927 2L839,2A15 15 0 0 0 824 17A15 15 0 0 0 839 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="883" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRECEDING</text>
<polygon points="1022,17 1010,21 1010,12" style="fill:rgb(0,0,0)"/>
<path d="M942,17L1016,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,17 L 1029,17 Q 1037,17 1037,32 L 1037,289 Q 1037,304 1022,304 L 1016,304 L 1001,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,70L837,70A15 15 0 0 0 852 55A15 15 0 0 0 837 39L767,39A15 15 0 0 0 752 55A15 15 0 0 0 767 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="802" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="875,55 863,59 863,50" style="fill:rgb(0,0,0)"/>
<path d="M852,55L869,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M890,70L914,70A15 15 0 0 0 929 55A15 15 0 0 0 914 39L890,39A15 15 0 0 0 875 55A15 15 0 0 0 890 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="902" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="1022,55 1010,59 1010,50" style="fill:rgb(0,0,0)"/>
<path d="M929,55L1016,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,55 L 1029,55 Q 1037,55 1037,62 L 1037,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,55 740,59 740,50" style="fill:rgb(0,0,0)"/>
<path d="M710,17 L 718,17 Q 725,17 725,32 L 725,40 Q 725,55 735,55 L 746,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M752,107L801,107L801,77L752,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="776" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="824,92 812,97 812,88" style="fill:rgb(0,0,0)"/>
<path d="M801,92L818,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M839,108L930,108A15 15 0 0 0 945 92A15 15 0 0 0 930 77L839,77A15 15 0 0 0 824 92A15 15 0 0 0 839 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="885" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOLLOWING</text>
<polygon points="1022,92 1010,97 1010,88" style="fill:rgb(0,0,0)"/>
<path d="M945,92L1016,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M1022,92 L 1029,92 Q 1037,92 1037,100 L 1037,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="752,92 740,97 740,88" style="fill:rgb(0,0,0)"/>
<path d="M725,39 L 725,77 Q 725,92 735,92 L 746,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,410L529,410A15 15 0 0 0 544 395A15 15 0 0 0 529 380L461,380A15 15 0 0 0 446 395A15 15 0 0 0 461 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,395 555,399 555,390" style="fill:rgb(0,0,0)"/>
<path d="M544,395L561,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,410L652,410A15 15 0 0 0 667 395A15 15 0 0 0 652 380L582,380A15 15 0 0 0 567 395A15 15 0 0 0 582 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT</text>
<polygon points="690,395 678,399 678,390" style="fill:rgb(0,0,0)"/>
<path d="M667,395L684,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M705,410L729,410A15 15 0 0 0 744 395A15 15 0 0 0 729 380L705,380A15 15 0 0 0 690 395A15 15 0 0 0 705 410Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="717" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROW</text>
<polygon points="767,395 756,399 756,390" style="fill:rgb(0,0,0)"/>
<path d="M744,395L762,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,395 L 775,395 Q 782,395 782,402 L 782,410"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,448L529,448A15 15 0 0 0 544 433A15 15 0 0 0 529 417L461,417A15 15 0 0 0 446 433A15 15 0 0 0 461 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,433 555,437 555,428" style="fill:rgb(0,0,0)"/>
<path d="M544,433L561,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,448L625,448A15 15 0 0 0 640 433A15 15 0 0 0 625 417L582,417A15 15 0 0 0 567 433A15 15 0 0 0 582 448Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="604" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="767,433 756,437 756,428" style="fill:rgb(0,0,0)"/>
<path d="M640,433L762,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,433 L 775,433 Q 782,433 782,440 L 782,448"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,486L529,486A15 15 0 0 0 544 470A15 15 0 0 0 529 455L461,455A15 15 0 0 0 446 470A15 15 0 0 0 461 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,470 555,475 555,466" style="fill:rgb(0,0,0)"/>
<path d="M544,470L561,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,486L604,486A15 15 0 0 0 619 470A15 15 0 0 0 604 455L582,455A15 15 0 0 0 567 470A15 15 0 0 0 582 486Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="593" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TIES</text>
<polygon points="767,470 756,475 756,466" style="fill:rgb(0,0,0)"/>
<path d="M619,470L762,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M767,470 L 775,470 Q 782,470 782,478 L 782,485"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M461,372L529,372A15 15 0 0 0 544 357A15 15 0 0 0 529 342L461,342A15 15 0 0 0 446 357A15 15 0 0 0 461 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXCLUDE</text>
<polygon points="567,357 555,361 555,353" style="fill:rgb(0,0,0)"/>
<path d="M544,357L561,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,372L591,372A15 15 0 0 0 606 357A15 15 0 0 0 591 342L582,342A15 15 0 0 0 567 357A15 15 0 0 0 582 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="586" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NO</text>
<polygon points="629,357 617,361 617,353" style="fill:rgb(0,0,0)"/>
<path d="M606,357L623,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,372L700,372A15 15 0 0 0 715 357A15 15 0 0 0 700 342L644,342A15 15 0 0 0 629 357A15 15 0 0 0 644 372Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="672" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OTHERS</text>
<polygon points="767,357 756,361 756,353" style="fill:rgb(0,0,0)"/>
<path d="M715,357L762,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="890,516 879,520 879,511" style="fill:rgb(0,0,0)"/>
<path d="M767,357 L 775,357 Q 782,357 782,372 L 782,501 Q 782,516 797,516 L 870,516 L 885,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="894" cy="516" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="710,304 722,300 722,308" style="fill:rgb(0,0,0)"/>
<path d="M1001,304L716,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="527,516 516,520 516,511" style="fill:rgb(0,0,0)"/>
<path d="M710,304 L 434,304 Q 419,304 419,319 L 419,501 Q 419,516 434,516 L 507,516 L 522,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M527,516L797,516"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,357 434,361 434,353" style="fill:rgb(0,0,0)"/>
<path d="M419,342 L 419,349 Q 419,357 430,357 L 440,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,395 434,399 434,390" style="fill:rgb(0,0,0)"/>
<path d="M419,380 L 419,387 Q 419,395 430,395 L 440,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,433 434,437 434,428" style="fill:rgb(0,0,0)"/>
<path d="M419,417 L 419,425 Q 419,433 430,433 L 440,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="446,470 434,475 434,466" style="fill:rgb(0,0,0)"/>
<path d="M419,455 L 419,463 Q 419,470 430,470 L 440,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#over-clause">over-clause</a>&nbsp;&nbsp; <a href="#window-defn">window-defn</a><br></br>
References:&nbsp;&nbsp; <a href="#expr">expr</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="function-arguments"></a><h4>function-arguments:</h4><div class='imgcontainer'>
<div style="max-width:456px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 456.566 223.344">
<circle cx="5" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,56 20,60 20,52" style="fill:rgb(0,0,0)"/>
<path d="M9,56L26,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,26 55,30 55,22" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,41 L 43,41 Q 43,26 52,26 L 61,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M82,41L150,41A15 15 0 0 0 165 26L165,26A15 15 0 0 0 150 11L82,11A15 15 0 0 0 66 26L66,26A15 15 0 0 0 82 41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="26" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="183,26 171,30 171,22" style="fill:rgb(0,0,0)"/>
<path d="M165,26L177,26"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M183,26 L 189,26 Q 194,26 194,41 L 194,41 Q 194,56 203,56 L 212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M218,56L248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,71L303,71L303,41L254,41Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="447,56 435,60 435,52" style="fill:rgb(0,0,0)"/>
<path d="M303,56L441,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="450" cy="56" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="116,56 104,60 104,52" style="fill:rgb(0,0,0)"/>
<path d="M32,56L110,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,56 206,60 206,52" style="fill:rgb(0,0,0)"/>
<path d="M116,56L212,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,32A15 15 0 0 0 293 17A15 15 0 0 0 278 2A15 15 0 0 0 263 17A15 15 0 0 0 278 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="278" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="293,17 305,12 305,21" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 314,56 Q 326,56 326,41 L 326,32 Q 326,17 312,17 L 299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="254,56 242,60 242,52" style="fill:rgb(0,0,0)"/>
<path d="M263,17 L 245,17 Q 230,17 230,32 L 230,41 Q 230,56 239,56 L 248,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,207A15 15 0 0 0 243 192L243,192A15 15 0 0 0 228 177A15 15 0 0 0 213 192L213,192A15 15 0 0 0 228 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="192" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="213,192 201,196 201,188" style="fill:rgb(0,0,0)"/>
<path d="M32,56 L 38,56 Q 43,56 43,71 L 43,177 Q 43,192 58,192 L 192,192 L 207,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,192 267,196 267,188" style="fill:rgb(0,0,0)"/>
<path d="M243,192L272,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M278,192 L 360,192 Q 375,192 390,192 L 394,192 Q 409,192 409,177 L 409,71 Q 409,56 415,56 L 421,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="228,216 216,221 216,212" style="fill:rgb(0,0,0)"/>
<path d="M116,192 L 181,192 Q 196,192 196,204 Q 196,216 209,216 L 222,216"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M228,216 L 242,216 Q 257,216 257,204 Q 257,192 262,192 L 268,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="90,117 78,121 78,112" style="fill:rgb(0,0,0)"/>
<path d="M303,56 L 313,56 Q 323,56 323,71 L 323,71 Q 323,86 308,86 L 81,86 Q 66,86 66,101 L 66,102 Q 66,117 75,117 L 84,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,132L149,132A15 15 0 0 0 164 117L164,117A15 15 0 0 0 149 101L105,101A15 15 0 0 0 90 117L90,117A15 15 0 0 0 105 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="182,117 170,121 170,112" style="fill:rgb(0,0,0)"/>
<path d="M164,117L176,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,132L201,132A15 15 0 0 0 216 117L216,117A15 15 0 0 0 201 101L197,101A15 15 0 0 0 182 117L182,117A15 15 0 0 0 197 132Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="199" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M216,117L239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M245,132L375,132L375,101L245,101Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="117" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M310,169A15 15 0 0 0 325 154A15 15 0 0 0 310 139A15 15 0 0 0 294 154A15 15 0 0 0 310 169Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="154" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="325,154 336,150 336,159" style="fill:rgb(0,0,0)"/>
<path d="M375,117 L 380,117 Q 386,117 386,132 L 386,139 Q 386,154 371,154 L 345,154 L 330,154"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="245,117 233,121 233,112" style="fill:rgb(0,0,0)"/>
<path d="M294,154 L 260,154 Q 245,154 236,154 Q 227,154 227,139 L 227,132 Q 227,117 233,117 L 239,117"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M375,117 L 383,117 Q 392,117 392,102 L 392,71 Q 392,56 407,56 L 413,56 L 428,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#expr">expr</a><br></br>
References:&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#ordering-term">ordering-term</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="indexed-column"></a><h4>indexed-column:</h4><div class='imgcontainer'>
<div style="max-width:696px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 696.36 102.6">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L160,32A15 15 0 0 0 175 17A15 15 0 0 0 160 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="113" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="246,47 235,51 235,43" style="fill:rgb(0,0,0)"/>
<path d="M175,17 L 205,17 Q 220,17 220,32 L 220,32 Q 220,47 230,47 L 240,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M261,62L325,62A15 15 0 0 0 341 47L341,47A15 15 0 0 0 325 32L261,32A15 15 0 0 0 246 47L246,47A15 15 0 0 0 261 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="293" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="358,47 346,51 346,43" style="fill:rgb(0,0,0)"/>
<path d="M341,47L352,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M373,62L478,62A15 15 0 0 0 493 47L493,47A15 15 0 0 0 478 32L373,32A15 15 0 0 0 358 47L358,47A15 15 0 0 0 373 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="511,47 499,51 499,43" style="fill:rgb(0,0,0)"/>
<path d="M493,47L505,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="567,85 556,89 556,81" style="fill:rgb(0,0,0)"/>
<path d="M511,47 L 518,47 Q 526,47 526,32 L 526,32 Q 526,17 533,17 Q 541,17 541,32 L 541,70 Q 541,85 551,85 L 561,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,100L613,100A15 15 0 0 0 628 85L628,85A15 15 0 0 0 613 70L582,70A15 15 0 0 0 567 85L567,85A15 15 0 0 0 582 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="597" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="645,85 633,89 633,81" style="fill:rgb(0,0,0)"/>
<path d="M628,85L639,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="687,17 675,21 675,12" style="fill:rgb(0,0,0)"/>
<path d="M645,85 L 652,85 Q 660,85 660,70 L 660,32 Q 660,17 670,17 L 681,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="690" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M50,70L100,70L100,39L50,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="175,55 163,59 163,50" style="fill:rgb(0,0,0)"/>
<path d="M100,55L169,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M175,55 L 182,55 Q 190,55 190,40 L 190,32 Q 190,17 197,17 L 205,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M175,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="597,17 586,21 586,12" style="fill:rgb(0,0,0)"/>
<path d="M358,17L592,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M597,17L675,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M582,62L599,62A15 15 0 0 0 614 47A15 15 0 0 0 599 32L582,32A15 15 0 0 0 567 47A15 15 0 0 0 582 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="591" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="645,47 633,51 633,43" style="fill:rgb(0,0,0)"/>
<path d="M614,47L639,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M645,47 L 652,47 Q 660,47 660,40 L 660,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="567,47 556,51 556,43" style="fill:rgb(0,0,0)"/>
<path d="M541,32 L 541,39 Q 541,47 551,47 L 561,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#create-index-stmt">create-index-stmt</a>&nbsp;&nbsp; <a href="#table-constraint">table-constraint</a>&nbsp;&nbsp; <a href="#upsert-clause">upsert-clause</a><br></br>
References:&nbsp;&nbsp; <a href="#expr">expr</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtable.html#primkeyconst">lang_createtable.html#primkeyconst</a>&nbsp;&nbsp; <a href="lang_createtable.html#uniqueconst">lang_createtable.html#uniqueconst</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="insert-stmt"></a><h4>insert-stmt:</h4><div class='imgcontainer'>
<div style="max-width:601px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 601.066 922.104">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L91,32A15 15 0 0 0 106 17A15 15 0 0 0 91 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M166,62L252,62A15 15 0 0 0 267 47L267,47A15 15 0 0 0 252 32L166,32A15 15 0 0 0 151 47L151,47A15 15 0 0 0 166 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="209,17 197,21 197,12" style="fill:rgb(0,0,0)"/>
<path d="M106,17L203,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M209,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M357,32L583,32L583,2L357,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="151,47 139,51 139,43" style="fill:rgb(0,0,0)"/>
<path d="M106,17 L 113,17 Q 121,17 121,32 L 121,32 Q 121,47 133,47 L 145,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,47 278,51 278,43" style="fill:rgb(0,0,0)"/>
<path d="M267,47L284,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,47 L 297,47 Q 305,47 305,32 L 305,32 Q 305,17 320,17 L 330,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,70A15 15 0 0 0 485 55L485,55A15 15 0 0 0 470 39A15 15 0 0 0 455 55L455,55A15 15 0 0 0 470 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="485,55 497,50 497,59" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,40 Q 598,55 583,55 L 506,55 L 491,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,55 L 349,55 Q 334,55 334,40 L 334,32 Q 334,17 340,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="294,83 306,79 306,88" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,68 Q 598,83 583,83 L 315,83 L 300,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="24,53 20,41 28,41" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,32 L 24,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,145L124,145A15 15 0 0 0 139 130A15 15 0 0 0 124 115L60,115A15 15 0 0 0 45 130A15 15 0 0 0 60 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<path d="M60,183L109,183A15 15 0 0 0 124 168A15 15 0 0 0 109 153L60,153A15 15 0 0 0 45 168A15 15 0 0 0 60 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="84" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INSERT</text>
<polygon points="166,198 154,203 154,194" style="fill:rgb(0,0,0)"/>
<path d="M124,168 L 132,168 Q 139,168 139,183 L 139,183 Q 139,198 149,198 L 160,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M181,213L187,213A15 15 0 0 0 203 198A15 15 0 0 0 187 183L181,183A15 15 0 0 0 166 198A15 15 0 0 0 181 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="244,349 233,354 233,345" style="fill:rgb(0,0,0)"/>
<path d="M203,198 L 210,198 Q 218,198 218,213 L 218,334 Q 218,349 228,349 L 238,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,365L337,365A15 15 0 0 0 352 349A15 15 0 0 0 337 334L259,334A15 15 0 0 0 244 349A15 15 0 0 0 259 365Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="298" y="349" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="369,349 358,354 358,345" style="fill:rgb(0,0,0)"/>
<path d="M352,349L363,349"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,130 399,135 399,126" style="fill:rgb(0,0,0)"/>
<path d="M369,349 L 377,349 Q 384,349 384,334 L 384,145 Q 384,130 395,130 L 405,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M426,145L453,145A15 15 0 0 0 468 130A15 15 0 0 0 453 115L426,115A15 15 0 0 0 411 130A15 15 0 0 0 426 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTO</text>
<polygon points="45,168 33,172 33,164" style="fill:rgb(0,0,0)"/>
<path d="M24,53 L 24,153 Q 24,168 31,168 L 39,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,130 33,135 33,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 31,130 L 39,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,83 L 39,83 Q 24,83 24,91 L 24,98"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M139,130L399,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,168 358,172 358,164" style="fill:rgb(0,0,0)"/>
<path d="M124,168L363,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,168 L 377,168 Q 384,168 384,160 L 384,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,213L301,213A15 15 0 0 0 316 198A15 15 0 0 0 301 183L259,183A15 15 0 0 0 244 198A15 15 0 0 0 259 213Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="198" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="244,198 233,203 233,194" style="fill:rgb(0,0,0)"/>
<path d="M203,198L238,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,198 358,203 358,194" style="fill:rgb(0,0,0)"/>
<path d="M316,198L363,198"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,198 L 377,198 Q 384,198 384,191 L 384,183"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,251L281,251A15 15 0 0 0 296 236A15 15 0 0 0 281 221L259,221A15 15 0 0 0 244 236A15 15 0 0 0 259 251Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="270" y="236" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="244,236 233,240 233,232" style="fill:rgb(0,0,0)"/>
<path d="M218,221 L 218,228 Q 218,236 228,236 L 238,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,236 358,240 358,232" style="fill:rgb(0,0,0)"/>
<path d="M296,236L363,236"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,236 L 377,236 Q 384,236 384,229 L 384,221"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,289L311,289A15 15 0 0 0 327 274A15 15 0 0 0 311 259L259,259A15 15 0 0 0 244 274A15 15 0 0 0 259 289Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="285" y="274" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="244,274 233,278 233,270" style="fill:rgb(0,0,0)"/>
<path d="M218,259 L 218,266 Q 218,274 228,274 L 238,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,274 358,278 358,270" style="fill:rgb(0,0,0)"/>
<path d="M327,274L363,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,274 L 377,274 Q 384,274 384,266 L 384,259"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,327L323,327A15 15 0 0 0 338 312A15 15 0 0 0 323 297L259,297A15 15 0 0 0 244 312A15 15 0 0 0 259 327Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="291" y="312" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<polygon points="244,312 233,316 233,307" style="fill:rgb(0,0,0)"/>
<path d="M218,297 L 218,304 Q 218,312 228,312 L 238,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="369,312 358,316 358,307" style="fill:rgb(0,0,0)"/>
<path d="M338,312L363,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M369,312 L 377,312 Q 384,312 384,304 L 384,297"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,455L156,455A15 15 0 0 0 171 440A15 15 0 0 0 156 425L60,425A15 15 0 0 0 45 440A15 15 0 0 0 60 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,440 183,444 183,436" style="fill:rgb(0,0,0)"/>
<path d="M171,440L189,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,455A15 15 0 0 0 225 440A15 15 0 0 0 210 425A15 15 0 0 0 195 440A15 15 0 0 0 210 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="440" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,440 249,444 249,436" style="fill:rgb(0,0,0)"/>
<path d="M225,440L255,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,455L351,455A15 15 0 0 0 366 440A15 15 0 0 0 351 425L276,425A15 15 0 0 0 261 440A15 15 0 0 0 276 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="402,440 391,444 391,436" style="fill:rgb(0,0,0)"/>
<path d="M366,440L396,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,455L421,455A15 15 0 0 0 436 440A15 15 0 0 0 421 425L417,425A15 15 0 0 0 402 440A15 15 0 0 0 417 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="419" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="459,440 448,444 448,436" style="fill:rgb(0,0,0)"/>
<path d="M436,440L454,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,455L495,455A15 15 0 0 0 510 440A15 15 0 0 0 495 425L475,425A15 15 0 0 0 459 440A15 15 0 0 0 475 455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="485" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">alias</text>
<polygon points="483,238 478,227 487,227" style="fill:rgb(0,0,0)"/>
<path d="M468,130 L 475,130 Q 483,130 483,145 L 483,217 L 483,232"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,395 183,390 183,399" style="fill:rgb(0,0,0)"/>
<path d="M483,238 L 483,380 Q 483,395 468,395 L 192,395 L 177,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,440 33,444 33,436" style="fill:rgb(0,0,0)"/>
<path d="M171,395 L 35,395 Q 20,395 20,410 L 20,425 Q 20,440 30,440 L 39,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="234,423 230,412 239,412" style="fill:rgb(0,0,0)"/>
<path d="M261,395 L 247,395 Q 234,395 234,406 L 234,417"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M234,423 L 234,432 Q 234,440 242,440 L 249,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,546A15 15 0 0 0 75 531A15 15 0 0 0 60 516A15 15 0 0 0 45 531A15 15 0 0 0 60 546Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="60" y="531" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="111,531 100,535 100,527" style="fill:rgb(0,0,0)"/>
<path d="M75,531L105,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,546L220,546A15 15 0 0 0 235 531A15 15 0 0 0 220 516L126,516A15 15 0 0 0 111 531A15 15 0 0 0 126 546Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="531" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="271,531 260,535 260,527" style="fill:rgb(0,0,0)"/>
<path d="M235,531L266,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M287,546A15 15 0 0 0 302 531A15 15 0 0 0 287 516A15 15 0 0 0 271 531A15 15 0 0 0 287 546Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="287" y="531" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<path d="M173,580A15 15 0 0 0 188 565A15 15 0 0 0 173 550A15 15 0 0 0 158 565A15 15 0 0 0 173 580Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="565" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="188,565 200,561 200,569" style="fill:rgb(0,0,0)"/>
<path d="M235,531 L 243,531 Q 250,531 250,546 L 250,550 Q 250,565 235,565 L 209,565 L 194,565"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,565 L 100,565 Q 85,565 85,550 L 85,546 Q 85,531 92,531 L 100,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="173,595 185,591 185,599" style="fill:rgb(0,0,0)"/>
<path d="M302,531 L 309,531 Q 317,531 317,546 L 317,580 Q 317,595 302,595 L 194,595 L 179,595"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M173,595 L 39,595 Q 24,595 24,603 L 24,610"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="436,486 448,481 448,490" style="fill:rgb(0,0,0)"/>
<path d="M510,440 L 518,440 Q 525,440 525,455 L 525,471 Q 525,486 510,486 L 457,486 L 442,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,531 33,535 33,527" style="fill:rgb(0,0,0)"/>
<path d="M436,486 L 39,486 Q 24,486 24,501 L 24,516 Q 24,531 31,531 L 39,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="381,469 377,457 385,457" style="fill:rgb(0,0,0)"/>
<path d="M366,440 L 374,440 Q 381,440 381,451 L 381,463"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M381,469 L 381,477 Q 381,486 374,486 L 366,486"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,671L112,671A15 15 0 0 0 127 656A15 15 0 0 0 112 640L60,640A15 15 0 0 0 45 656A15 15 0 0 0 60 671Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="86" y="656" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="163,656 152,660 152,651" style="fill:rgb(0,0,0)"/>
<path d="M127,656L158,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,671A15 15 0 0 0 194 656A15 15 0 0 0 179 640A15 15 0 0 0 163 656A15 15 0 0 0 179 671Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="179" y="656" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="230,656 218,660 218,651" style="fill:rgb(0,0,0)"/>
<path d="M194,656L224,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M230,671L279,671L279,640L230,640Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="656" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="315,656 303,660 303,651" style="fill:rgb(0,0,0)"/>
<path d="M279,656L309,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,671A15 15 0 0 0 345 656A15 15 0 0 0 330 640A15 15 0 0 0 315 656A15 15 0 0 0 330 671Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="330" y="656" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="45,656 33,660 33,651" style="fill:rgb(0,0,0)"/>
<path d="M24,516 L 24,641 Q 24,656 31,656 L 39,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,705A15 15 0 0 0 269 690A15 15 0 0 0 254 675A15 15 0 0 0 239 690A15 15 0 0 0 254 705Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="690" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="269,690 281,685 281,694" style="fill:rgb(0,0,0)"/>
<path d="M279,656 L 286,656 Q 294,656 294,671 L 294,675 Q 294,690 285,690 L 275,690"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M239,690 L 218,690 Q 203,690 203,675 L 203,671 Q 203,656 211,656 L 218,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M254,743A15 15 0 0 0 269 727A15 15 0 0 0 254 712A15 15 0 0 0 239 727A15 15 0 0 0 254 743Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="727" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="269,727 281,723 281,732" style="fill:rgb(0,0,0)"/>
<path d="M345,656 L 353,656 Q 360,656 360,671 L 360,712 Q 360,727 345,727 L 290,727 L 275,727"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M239,727 L 152,727 Q 137,727 137,712 L 137,671 Q 137,656 144,656 L 152,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="387,693 375,698 375,689" style="fill:rgb(0,0,0)"/>
<path d="M345,656 L 353,656 Q 360,656 360,671 L 360,678 Q 360,693 371,693 L 381,693"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M387,709L512,709L512,678L387,678Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="449" y="693" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">upsert-clause</text>
<polygon points="535,693 523,698 523,689" style="fill:rgb(0,0,0)"/>
<path d="M512,693L529,693"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,693 L 542,693 Q 550,693 550,701 L 550,708"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="535,656 523,660 523,651" style="fill:rgb(0,0,0)"/>
<path d="M345,656L529,656"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,788L149,788L149,758L45,758Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="97" y="773" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="535,773 523,777 523,768" style="fill:rgb(0,0,0)"/>
<path d="M149,773L529,773"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,773 L 542,773 Q 550,773 550,780 L 550,788"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,773 33,777 33,768" style="fill:rgb(0,0,0)"/>
<path d="M24,640 L 24,758 Q 24,773 31,773 L 39,773"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M387,818L512,818L512,788L387,788Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="449" y="803" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">upsert-clause</text>
<polygon points="535,803 523,807 523,799" style="fill:rgb(0,0,0)"/>
<path d="M512,803L529,803"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,803 L 542,803 Q 550,803 550,811 L 550,818"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="387,803 375,807 375,799" style="fill:rgb(0,0,0)"/>
<path d="M345,773 L 353,773 Q 360,773 360,788 L 360,788 Q 360,803 371,803 L 381,803"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,856L125,856A15 15 0 0 0 140 841A15 15 0 0 0 125 826L60,826A15 15 0 0 0 45 841A15 15 0 0 0 60 856Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="93" y="841" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DEFAULT</text>
<polygon points="164,841 152,845 152,837" style="fill:rgb(0,0,0)"/>
<path d="M140,841L158,841"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,856L231,856A15 15 0 0 0 246 841A15 15 0 0 0 231 826L179,826A15 15 0 0 0 164 841A15 15 0 0 0 179 856Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="205" y="841" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="535,841 523,845 523,837" style="fill:rgb(0,0,0)"/>
<path d="M246,841L529,841"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,841 33,845 33,837" style="fill:rgb(0,0,0)"/>
<path d="M24,758 L 24,826 Q 24,841 31,841 L 39,841"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M361,919L512,919L512,889L361,889Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="436" y="904" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">returning-clause</text>
<polygon points="591,904 580,909 580,900" style="fill:rgb(0,0,0)"/>
<path d="M512,904L585,904"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="595" cy="904" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M535,656 L 542,656 Q 550,656 550,671 L 550,889 Q 550,904 557,904 L 565,904"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="436,871 448,867 448,875" style="fill:rgb(0,0,0)"/>
<path d="M535,841 L 542,841 Q 550,841 550,856 L 550,856 Q 550,871 535,871 L 457,871 L 442,871"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="361,904 349,909 349,900" style="fill:rgb(0,0,0)"/>
<path d="M436,871 L 349,871 Q 334,871 334,886 L 334,889 Q 334,904 345,904 L 355,904"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#create-trigger-stmt">create-trigger-stmt</a>&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href="#common-table-expression">common-table-expression</a>&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#returning-clause">returning-clause</a>&nbsp;&nbsp; <a href="#select-stmt">select-stmt</a>&nbsp;&nbsp; <a href="#upsert-clause">upsert-clause</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>
</div>

<a name="join-clause"></a><h4>join-clause:</h4><div class='imgcontainer'>
<div style="max-width:793px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 793.282 84.24">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L193,32L193,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="112" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="259,47 247,51 247,43" style="fill:rgb(0,0,0)"/>
<path d="M193,17 L 200,17 Q 208,17 208,32 L 208,32 Q 208,47 223,47 L 238,47 L 253,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,62L380,62L380,32L259,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-operator</text>
<polygon points="403,47 391,51 391,43" style="fill:rgb(0,0,0)"/>
<path d="M380,47L397,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,62L564,62L564,32L403,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="483" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="587,47 575,51 575,43" style="fill:rgb(0,0,0)"/>
<path d="M564,47L581,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M587,62L721,62L721,32L587,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="654" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-constraint</text>
<polygon points="783,17 772,21 772,12" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 742,47 Q 757,47 757,32 L 757,32 Q 757,17 767,17 L 778,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="787" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M193,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,17L776,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="483,77 495,73 495,82" style="fill:rgb(0,0,0)"/>
<path d="M721,47 L 728,47 Q 736,47 736,62 L 736,62 Q 736,77 721,77 L 504,77 L 489,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M483,77 L 247,77 Q 232,77 232,62 L 232,62 Q 232,47 246,47 L 259,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#select-core">select-core</a>&nbsp;&nbsp; <a href="#select-stmt">select-stmt</a>&nbsp;&nbsp; <a href="#table-or-subquery">table-or-subquery</a>&nbsp;&nbsp; <a href="#update-stmt">update-stmt</a>&nbsp;&nbsp; <a href="#update-stmt-limited">update-stmt-limited</a><br></br>
References:&nbsp;&nbsp; <a href="#join-constraint">join-constraint</a>&nbsp;&nbsp; <a href="#join-operator">join-operator</a>&nbsp;&nbsp; <a href="#table-or-subquery">table-or-subquery</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="join-constraint"></a><h4>join-constraint:</h4><div class='imgcontainer'>
<div style="max-width:483px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 483.336 126.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L104,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 104 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="143,55 131,59 131,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L137,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M158,70A15 15 0 0 0 173 55L173,55A15 15 0 0 0 158 39A15 15 0 0 0 143 55L143,55A15 15 0 0 0 158 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="209,55 197,59 197,50" style="fill:rgb(0,0,0)"/>
<path d="M173,55L203,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M224,70L318,70A15 15 0 0 0 333 55L333,55A15 15 0 0 0 318 39L224,39A15 15 0 0 0 209 55L209,55A15 15 0 0 0 224 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="369,55 358,59 358,50" style="fill:rgb(0,0,0)"/>
<path d="M333,55L363,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,70A15 15 0 0 0 399 55L399,55A15 15 0 0 0 384 39A15 15 0 0 0 369 55L369,55A15 15 0 0 0 384 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="422,55 411,59 411,50" style="fill:rgb(0,0,0)"/>
<path d="M399,55L417,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="473,17 462,21 462,12" style="fill:rgb(0,0,0)"/>
<path d="M422,55 L 430,55 Q 437,55 437,40 L 437,32 Q 437,17 452,17 L 453,17 L 468,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="477" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M271,108A15 15 0 0 0 286 92A15 15 0 0 0 271 77A15 15 0 0 0 256 92A15 15 0 0 0 271 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="271" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="286,92 298,88 298,97" style="fill:rgb(0,0,0)"/>
<path d="M333,55 L 341,55 Q 348,55 348,70 L 348,77 Q 348,92 333,92 L 307,92 L 292,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,92 L 197,92 Q 182,92 182,77 L 182,70 Q 182,55 190,55 L 197,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L74,32A15 15 0 0 0 90 17A15 15 0 0 0 74 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="70" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="113,17 101,21 101,12" style="fill:rgb(0,0,0)"/>
<path d="M90,17L107,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M113,32L162,32L162,2L113,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="137" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="422,17 411,21 411,12" style="fill:rgb(0,0,0)"/>
<path d="M162,17L417,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,17L462,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="209,120 197,124 197,115" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,105 Q 24,120 39,120 L 188,120 L 203,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,120 L 422,120 Q 437,120 437,105 L 437,54 L 437,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#join-clause">join-clause</a><br></br>
References:&nbsp;&nbsp; <a href="#expr">expr</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#fromclause">lang_select.html#fromclause</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="join-operator"></a><h4>join-operator:</h4><div class='imgcontainer'>
<div style="max-width:620px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 620.333 255.312">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,71 39,76 39,67" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,56 Q 24,71 34,71 L 45,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,86L133,86A15 15 0 0 0 148 71A15 15 0 0 0 133 56L66,56A15 15 0 0 0 50 71A15 15 0 0 0 66 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="99" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NATURAL</text>
<polygon points="189,41 178,45 178,37" style="fill:rgb(0,0,0)"/>
<path d="M148,71 L 155,71 Q 163,71 163,56 L 163,56 Q 163,41 173,41 L 184,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,71 219,76 219,67" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,56 Q 204,71 215,71 L 225,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,86L273,86A15 15 0 0 0 288 71A15 15 0 0 0 273 56L246,56A15 15 0 0 0 231 71A15 15 0 0 0 246 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LEFT</text>
<polygon points="378,71 366,76 366,67" style="fill:rgb(0,0,0)"/>
<path d="M288,71L372,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M393,86L437,86A15 15 0 0 0 452 71A15 15 0 0 0 437 56L393,56A15 15 0 0 0 378 71A15 15 0 0 0 393 86Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="415" y="71" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OUTER</text>
<polygon points="475,71 463,76 463,67" style="fill:rgb(0,0,0)"/>
<path d="M452,71L469,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="516,41 505,45 505,37" style="fill:rgb(0,0,0)"/>
<path d="M475,71 L 482,71 Q 490,71 490,56 L 490,56 Q 490,41 500,41 L 511,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M532,56L554,56A15 15 0 0 0 569 41A15 15 0 0 0 554 26L532,26A15 15 0 0 0 516 41A15 15 0 0 0 532 56Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="543" y="41" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">JOIN</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M569,41 L 576,41 Q 584,41 584,29 Q 584,17 594,17 L 605,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="614" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,32A15 15 0 0 0 325 17A15 15 0 0 0 310 2A15 15 0 0 0 295 17A15 15 0 0 0 310 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="310" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="295,17 283,21 283,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L289,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M325,17L599,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="99,41 88,45 88,37" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,29 Q 24,41 39,41 L 78,41 L 93,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M99,41L178,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M189,41L505,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="378,41 366,45 366,37" style="fill:rgb(0,0,0)"/>
<path d="M336,71 L 344,71 Q 351,71 351,56 L 351,56 Q 351,41 362,41 L 372,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,109 219,113 219,105" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,94 Q 204,109 215,109 L 225,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,124L284,124A15 15 0 0 0 299 109A15 15 0 0 0 284 94L246,94A15 15 0 0 0 231 109A15 15 0 0 0 246 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="109" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RIGHT</text>
<polygon points="341,71 329,76 329,67" style="fill:rgb(0,0,0)"/>
<path d="M299,109 L 307,109 Q 314,109 314,94 L 314,86 Q 314,71 324,71 L 335,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,147 219,151 219,142" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,132 Q 204,147 215,147 L 225,147"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,162L274,162A15 15 0 0 0 289 147A15 15 0 0 0 274 132L246,132A15 15 0 0 0 231 147A15 15 0 0 0 246 162Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="147" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FULL</text>
<path d="M289,147 L 302,147 Q 314,147 314,132 L 314,109 L 314,94"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,192 219,196 219,188" style="fill:rgb(0,0,0)"/>
<path d="M189,41 L 197,41 Q 204,41 204,56 L 204,177 Q 204,192 215,192 L 225,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,207L287,207A15 15 0 0 0 302 192A15 15 0 0 0 287 177L246,177A15 15 0 0 0 231 192A15 15 0 0 0 246 207Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="192" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INNER</text>
<polygon points="475,192 463,196 463,188" style="fill:rgb(0,0,0)"/>
<path d="M302,192L469,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,192 L 482,192 Q 490,192 490,185 L 490,177"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,238 219,242 219,233" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,223 Q 24,238 39,238 L 210,238 L 225,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,253L287,253A15 15 0 0 0 303 238A15 15 0 0 0 287 222L246,222A15 15 0 0 0 231 238A15 15 0 0 0 246 253Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="238" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CROSS</text>
<polygon points="475,238 463,242 463,233" style="fill:rgb(0,0,0)"/>
<path d="M303,238L469,238"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M475,238 L 482,238 Q 490,238 490,223 L 490,71 L 490,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#join-clause">join-clause</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#fromclause">lang_select.html#fromclause</a>&nbsp;&nbsp; <a href="lang_select.html#nonstd">lang_select.html#nonstd</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="literal-value"></a><h4>literal-value:</h4><div class='imgcontainer'>
<div style="max-width:341px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 341.376 336.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,319 39,324 39,315" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,304 Q 24,319 34,319 L 45,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,334L252,334A15 15 0 0 0 267 319A15 15 0 0 0 252 304L65,304A15 15 0 0 0 50 319A15 15 0 0 0 65 334Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIMESTAMP</text>
<polygon points="290,319 278,324 278,315" style="fill:rgb(0,0,0)"/>
<path d="M267,319L284,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="332,17 320,21 320,12" style="fill:rgb(0,0,0)"/>
<path d="M290,319 L 297,319 Q 305,319 305,304 L 305,32 Q 305,17 315,17 L 326,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="335" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,32L172,32A15 15 0 0 0 187 17A15 15 0 0 0 172 2L66,2A15 15 0 0 0 50 17A15 15 0 0 0 66 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="119" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="50,17 39,21 39,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L45,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,17L320,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L153,70A15 15 0 0 0 168 55L168,55A15 15 0 0 0 153 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="109" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">string-literal</text>
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M24,39 L 24,47 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,55 278,59 278,50" style="fill:rgb(0,0,0)"/>
<path d="M168,55L284,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,55 L 297,55 Q 305,55 305,47 L 305,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,108L140,108A15 15 0 0 0 155 92A15 15 0 0 0 140 77L66,77A15 15 0 0 0 50 92A15 15 0 0 0 66 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">blob-literal</text>
<polygon points="50,92 39,97 39,88" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,85 Q 24,92 34,92 L 45,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,92 278,97 278,88" style="fill:rgb(0,0,0)"/>
<path d="M155,92L284,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,92 L 297,92 Q 305,92 305,85 L 305,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,145L97,145A15 15 0 0 0 112 130A15 15 0 0 0 97 115L66,115A15 15 0 0 0 50 130A15 15 0 0 0 66 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULL</text>
<polygon points="50,130 39,135 39,126" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,123 Q 24,130 34,130 L 45,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,130 278,135 278,126" style="fill:rgb(0,0,0)"/>
<path d="M112,130L284,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,130 L 297,130 Q 305,130 305,123 L 305,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,183L96,183A15 15 0 0 0 111 168A15 15 0 0 0 96 153L66,153A15 15 0 0 0 50 168A15 15 0 0 0 66 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="81" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRUE</text>
<polygon points="50,168 39,172 39,164" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,160 Q 24,168 34,168 L 45,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,168 278,172 278,164" style="fill:rgb(0,0,0)"/>
<path d="M111,168L284,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,168 L 297,168 Q 305,168 305,160 L 305,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,221L104,221A15 15 0 0 0 119 206A15 15 0 0 0 104 191L66,191A15 15 0 0 0 50 206A15 15 0 0 0 66 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="85" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FALSE</text>
<polygon points="50,206 39,210 39,201" style="fill:rgb(0,0,0)"/>
<path d="M24,191 L 24,198 Q 24,206 34,206 L 45,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,206 278,210 278,201" style="fill:rgb(0,0,0)"/>
<path d="M119,206L284,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,206 L 297,206 Q 305,206 305,198 L 305,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,259L190,259A15 15 0 0 0 205 244A15 15 0 0 0 190 228L66,228A15 15 0 0 0 50 244A15 15 0 0 0 66 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="128" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_TIME</text>
<polygon points="50,244 39,248 39,239" style="fill:rgb(0,0,0)"/>
<path d="M24,228 L 24,236 Q 24,244 34,244 L 45,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,244 278,248 278,239" style="fill:rgb(0,0,0)"/>
<path d="M205,244L284,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,244 L 297,244 Q 305,244 305,236 L 305,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,297L192,297A15 15 0 0 0 207 281A15 15 0 0 0 192 266L66,266A15 15 0 0 0 50 281A15 15 0 0 0 66 297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CURRENT_DATE</text>
<polygon points="50,281 39,286 39,277" style="fill:rgb(0,0,0)"/>
<path d="M24,266 L 24,274 Q 24,281 34,281 L 45,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,281 278,286 278,277" style="fill:rgb(0,0,0)"/>
<path d="M207,281L284,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,281 L 297,281 Q 305,281 305,274 L 305,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#column-constraint">column-constraint</a>&nbsp;&nbsp; <a href="#expr">expr</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="numeric-literal"></a><h4>numeric-literal:</h4><div class='imgcontainer'>
<div style="max-width:765px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 765.562 214.056">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="63,36 51,41 51,32" style="fill:rgb(0,0,0)"/>
<path d="M9,36L57,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M78,51L98,51A15 15 0 0 0 113 36A15 15 0 0 0 98 21L78,21A15 15 0 0 0 63 36A15 15 0 0 0 78 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="88" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">digit</text>
<polygon points="88,6 99,2 99,10" style="fill:rgb(0,0,0)"/>
<path d="M113,36 L 121,36 Q 128,36 128,21 L 128,21 Q 128,6 113,6 L 109,6 L 94,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M88,6 L 51,6 Q 36,6 36,21 L 36,21 Q 36,36 44,36 L 51,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="176,66 164,71 164,62" style="fill:rgb(0,0,0)"/>
<path d="M113,36 L 134,36 Q 149,36 149,51 L 149,51 Q 149,66 159,66 L 170,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M191,82A15 15 0 0 0 206 66L206,66A15 15 0 0 0 191 51A15 15 0 0 0 176 66L176,66A15 15 0 0 0 191 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="66" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="267,66 255,71 255,62" style="fill:rgb(0,0,0)"/>
<path d="M206,66L261,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="340,66 328,71 328,62" style="fill:rgb(0,0,0)"/>
<path d="M267,66L334,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="381,36 370,41 370,32" style="fill:rgb(0,0,0)"/>
<path d="M340,66 L 347,66 Q 355,66 355,51 L 355,51 Q 355,36 365,36 L 375,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,74 411,78 411,70" style="fill:rgb(0,0,0)"/>
<path d="M381,36 L 389,36 Q 396,36 396,51 L 396,59 Q 396,74 406,74 L 417,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,89A15 15 0 0 0 453 74L453,74A15 15 0 0 0 438 59A15 15 0 0 0 423 74L423,74A15 15 0 0 0 438 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">E</text>
<polygon points="494,74 483,78 483,70" style="fill:rgb(0,0,0)"/>
<path d="M453,74L489,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="423,112 411,116 411,108" style="fill:rgb(0,0,0)"/>
<path d="M381,36 L 389,36 Q 396,36 396,51 L 396,97 Q 396,112 406,112 L 417,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,127A15 15 0 0 0 453 112A15 15 0 0 0 438 97A15 15 0 0 0 423 112A15 15 0 0 0 438 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="438" y="112" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">e</text>
<path d="M453,112 L 460,112 Q 468,112 468,97 L 468,89 Q 468,74 475,74 L 483,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,112L277,112A15 15 0 0 0 292 97L292,97A15 15 0 0 0 277 82L257,82A15 15 0 0 0 242 97L242,97A15 15 0 0 0 257 112Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="97" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">digit</text>
<polygon points="292,97 304,92 304,101" style="fill:rgb(0,0,0)"/>
<path d="M267,66 L 304,66 Q 319,66 319,81 L 319,82 Q 319,97 308,97 L 298,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M242,97 L 234,97 Q 227,97 227,82 L 227,81 Q 227,66 234,66 L 242,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M113,36L261,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M267,36L370,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,135 39,139 39,130" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,120 Q 24,135 34,135 L 45,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,150A15 15 0 0 0 81 135A15 15 0 0 0 66 119A15 15 0 0 0 50 135A15 15 0 0 0 66 150Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="135" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="117,135 105,139 105,130" style="fill:rgb(0,0,0)"/>
<path d="M81,135L111,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,150L152,150A15 15 0 0 0 167 135A15 15 0 0 0 152 119L132,119A15 15 0 0 0 117 135A15 15 0 0 0 132 150Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="142" y="135" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">digit</text>
<polygon points="340,135 328,139 328,130" style="fill:rgb(0,0,0)"/>
<path d="M167,135L334,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M340,135 L 347,135 Q 355,135 355,120 L 355,66 L 355,51"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="142,104 153,100 153,109" style="fill:rgb(0,0,0)"/>
<path d="M167,135 L 174,135 Q 182,135 182,120 L 182,119 Q 182,104 167,104 L 162,104 L 147,104"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,104 L 105,104 Q 90,104 90,119 L 90,120 Q 90,135 98,135 L 105,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="536,142 524,146 524,138" style="fill:rgb(0,0,0)"/>
<path d="M494,74 L 502,74 Q 509,74 509,89 L 509,127 Q 509,142 520,142 L 530,142"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M551,157A15 15 0 0 0 566 142A15 15 0 0 0 551 127A15 15 0 0 0 536 142A15 15 0 0 0 551 157Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="551" y="142" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<polygon points="628,74 616,78 616,70" style="fill:rgb(0,0,0)"/>
<path d="M566,142 L 574,142 Q 581,142 581,127 L 581,89 Q 581,74 596,74 L 607,74 L 622,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M643,89L663,89A15 15 0 0 0 678 74L678,74A15 15 0 0 0 663 59L643,59A15 15 0 0 0 628 74L628,74A15 15 0 0 0 643 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="653" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">digit</text>
<polygon points="714,74 703,78 703,70" style="fill:rgb(0,0,0)"/>
<path d="M678,74L708,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="756,36 744,41 744,32" style="fill:rgb(0,0,0)"/>
<path d="M714,74 L 722,74 Q 729,74 729,59 L 729,51 Q 729,36 740,36 L 750,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="759" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="536,104 524,109 524,100" style="fill:rgb(0,0,0)"/>
<path d="M494,74 L 502,74 Q 509,74 509,89 L 509,89 Q 509,104 520,104 L 530,104"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M551,119A15 15 0 0 0 566 104A15 15 0 0 0 551 89A15 15 0 0 0 536 104A15 15 0 0 0 551 119Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="551" y="104" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<path d="M566,104 L 574,104 Q 581,104 581,97 L 581,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="551,36 540,41 540,32" style="fill:rgb(0,0,0)"/>
<path d="M381,36L545,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M551,36L744,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="551,74 540,78 540,70" style="fill:rgb(0,0,0)"/>
<path d="M494,74L545,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M551,74L616,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="653,50 665,46 665,54" style="fill:rgb(0,0,0)"/>
<path d="M678,74 L 686,74 Q 693,74 693,62 Q 693,50 678,50 L 674,50 L 659,50"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M653,50 L 616,50 Q 601,50 601,62 Q 601,74 609,74 L 616,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,180 39,184 39,176" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,165 Q 24,180 34,180 L 45,180"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,195L69,195A15 15 0 0 0 84 180A15 15 0 0 0 69 165L66,165A15 15 0 0 0 50 180A15 15 0 0 0 66 195Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="67" y="180" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">0x</text>
<polygon points="120,180 108,184 108,176" style="fill:rgb(0,0,0)"/>
<path d="M84,180L114,180"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,195L185,195A15 15 0 0 0 200 180A15 15 0 0 0 185 165L135,165A15 15 0 0 0 120 180A15 15 0 0 0 135 195Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="160" y="180" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">hexdigit</text>
<polygon points="714,180 703,184 703,176" style="fill:rgb(0,0,0)"/>
<path d="M200,180L708,180"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M714,180 L 722,180 Q 729,180 729,165 L 729,74 L 729,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="160,207 171,203 171,211" style="fill:rgb(0,0,0)"/>
<path d="M200,180 L 207,180 Q 215,180 215,193 Q 215,207 200,207 L 180,207 L 165,207"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M160,207 L 108,207 Q 93,207 93,193 Q 93,180 101,180 L 108,180"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<br></br>
See also:&nbsp;&nbsp; <a href="lang_expr.html#litvalue">lang_expr.html#litvalue</a>
</div>

<a name="ordering-term"></a><h4>ordering-term:</h4><div class='imgcontainer'>
<div style="max-width:798px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 798.451 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L81,32L81,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="56" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="111,44 100,48 100,40" style="fill:rgb(0,0,0)"/>
<path d="M81,17 L 89,17 Q 96,17 96,30 Q 96,44 101,44 L 105,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,59L190,59A15 15 0 0 0 205 44L205,44A15 15 0 0 0 190 29L126,29A15 15 0 0 0 111 44L111,44A15 15 0 0 0 126 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="158" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">COLLATE</text>
<polygon points="228,44 217,48 217,40" style="fill:rgb(0,0,0)"/>
<path d="M205,44L223,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M244,59L349,59A15 15 0 0 0 364 44L364,44A15 15 0 0 0 349 29L244,29A15 15 0 0 0 228 44L228,44A15 15 0 0 0 244 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="296" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="406,17 394,21 394,12" style="fill:rgb(0,0,0)"/>
<path d="M364,44 L 372,44 Q 379,44 379,30 Q 379,17 389,17 L 400,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="243,17 232,21 232,12" style="fill:rgb(0,0,0)"/>
<path d="M81,17L238,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M243,17L394,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,82 436,86 436,77" style="fill:rgb(0,0,0)"/>
<path d="M406,17 L 413,17 Q 421,17 421,32 L 421,67 Q 421,82 431,82 L 441,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,97L492,97A15 15 0 0 0 508 82A15 15 0 0 0 492 67L462,67A15 15 0 0 0 447 82A15 15 0 0 0 462 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DESC</text>
<polygon points="549,17 538,21 538,12" style="fill:rgb(0,0,0)"/>
<path d="M508,82 L 515,82 Q 523,82 523,67 L 523,32 Q 523,17 533,17 L 543,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M462,59L479,59A15 15 0 0 0 494 44L494,44A15 15 0 0 0 479 29L462,29A15 15 0 0 0 447 44L447,44A15 15 0 0 0 462 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ASC</text>
<polygon points="447,44 436,48 436,40" style="fill:rgb(0,0,0)"/>
<path d="M421,29 L 421,36 Q 421,44 431,44 L 441,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,44 L 508,44 Q 523,44 523,36 L 523,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="477,17 466,21 466,12" style="fill:rgb(0,0,0)"/>
<path d="M406,17L472,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,17L538,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="591,44 579,48 579,40" style="fill:rgb(0,0,0)"/>
<path d="M549,17 L 557,17 Q 564,17 564,30 Q 564,44 574,44 L 585,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,59L648,59A15 15 0 0 0 663 44L663,44A15 15 0 0 0 648 29L606,29A15 15 0 0 0 591 44L591,44A15 15 0 0 0 606 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,44 674,48 674,40" style="fill:rgb(0,0,0)"/>
<path d="M663,44L680,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,59L735,59A15 15 0 0 0 750 44L750,44A15 15 0 0 0 735 29L701,29A15 15 0 0 0 686 44L686,44A15 15 0 0 0 701 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="718" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FIRST</text>
<polygon points="791,17 780,21 780,12" style="fill:rgb(0,0,0)"/>
<path d="M750,44 L 757,44 Q 765,44 765,30 Q 765,17 775,17 L 786,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M606,97L648,97A15 15 0 0 0 663 82A15 15 0 0 0 648 67L606,67A15 15 0 0 0 591 82A15 15 0 0 0 606 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="627" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NULLS</text>
<polygon points="686,82 674,86 674,77" style="fill:rgb(0,0,0)"/>
<path d="M663,82L680,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M701,97L727,97A15 15 0 0 0 742 82A15 15 0 0 0 727 67L701,67A15 15 0 0 0 686 82A15 15 0 0 0 701 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="714" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LAST</text>
<polygon points="591,82 579,86 579,77" style="fill:rgb(0,0,0)"/>
<path d="M564,29 L 564,67 Q 564,82 574,82 L 585,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M742,82 L 754,82 Q 765,82 765,67 L 765,44 L 765,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="670,17 659,21 659,12" style="fill:rgb(0,0,0)"/>
<path d="M549,17L665,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M670,17L780,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#aggregate-function-invocation">aggregate-function-invocation</a>&nbsp;&nbsp; <a href="#compound-select-stmt">compound-select-stmt</a>&nbsp;&nbsp; <a href="#delete-stmt-limited">delete-stmt-limited</a>&nbsp;&nbsp; <a href="#factored-select-stmt">factored-select-stmt</a>&nbsp;&nbsp; <a href="#function-arguments">function-arguments</a>&nbsp;&nbsp; <a href="#over-clause">over-clause</a>&nbsp;&nbsp; <a href="#select-stmt">select-stmt</a>&nbsp;&nbsp; <a href="#simple-select-stmt">simple-select-stmt</a>&nbsp;&nbsp; <a href="#update-stmt-limited">update-stmt-limited</a>&nbsp;&nbsp; <a href="#window-defn">window-defn</a><br></br>
References:&nbsp;&nbsp; <a href="#expr">expr</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="over-clause"></a><h4>over-clause:</h4><div class='imgcontainer'>
<div style="max-width:600px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 600.706 418.392">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L78,32A15 15 0 0 0 93 17A15 15 0 0 0 78 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="129,17 117,21 117,12" style="fill:rgb(0,0,0)"/>
<path d="M93,17L123,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M144,32L241,32A15 15 0 0 0 256 17A15 15 0 0 0 241 2L144,2A15 15 0 0 0 129 17A15 15 0 0 0 144 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,17 L 100,17 Q 108,17 108,32 L 108,40 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M149,70A15 15 0 0 0 165 55L165,55A15 15 0 0 0 149 39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 149 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="149" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="206,82 195,86 195,77" style="fill:rgb(0,0,0)"/>
<path d="M165,55 L 172,55 Q 180,55 180,68 Q 180,82 190,82 L 200,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,97L363,97A15 15 0 0 0 378 82A15 15 0 0 0 363 67L221,67A15 15 0 0 0 206 82A15 15 0 0 0 221 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="292" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M221,173L301,173A15 15 0 0 0 316 157A15 15 0 0 0 301 142L221,142A15 15 0 0 0 206 157A15 15 0 0 0 221 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="339,157 328,162 328,153" style="fill:rgb(0,0,0)"/>
<path d="M316,157L333,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,173L358,173A15 15 0 0 0 373 157A15 15 0 0 0 358 142L354,142A15 15 0 0 0 339 157A15 15 0 0 0 354 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="409,157 398,162 398,153" style="fill:rgb(0,0,0)"/>
<path d="M373,157L404,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M409,173L459,173L459,142L409,142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="157" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M434,210A15 15 0 0 0 449 195A15 15 0 0 0 434 180A15 15 0 0 0 419 195A15 15 0 0 0 434 210Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="434" y="195" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="449,195 461,191 461,200" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,180 Q 474,195 464,195 L 455,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M419,195 L 398,195 Q 383,195 383,180 L 383,172 Q 383,157 390,157 L 398,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,55 280,59 280,50" style="fill:rgb(0,0,0)"/>
<path d="M165,55L286,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,120 304,115 304,124" style="fill:rgb(0,0,0)"/>
<path d="M292,55 L 401,55 Q 416,55 416,70 L 416,105 Q 416,120 401,120 L 313,120 L 298,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,157 195,162 195,153" style="fill:rgb(0,0,0)"/>
<path d="M292,120 L 180,120 Q 165,120 165,135 L 165,142 Q 165,157 180,157 L 185,157 L 200,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="401,82 389,86 389,77" style="fill:rgb(0,0,0)"/>
<path d="M378,82L395,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,82 L 408,82 Q 416,82 416,89 L 416,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,286L266,286A15 15 0 0 0 281 271A15 15 0 0 0 266 256L221,256A15 15 0 0 0 206 271A15 15 0 0 0 221 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="244" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="304,271 292,275 292,266" style="fill:rgb(0,0,0)"/>
<path d="M281,271L298,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M319,286L323,286A15 15 0 0 0 338 271A15 15 0 0 0 323 256L319,256A15 15 0 0 0 304 271A15 15 0 0 0 319 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="321" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="374,271 363,275 363,266" style="fill:rgb(0,0,0)"/>
<path d="M338,271L368,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M374,286L504,286L504,256L374,256Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M439,324A15 15 0 0 0 454 309A15 15 0 0 0 439 293A15 15 0 0 0 424 309A15 15 0 0 0 439 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="439" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="454,309 466,304 466,313" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,294 Q 519,309 504,309 L 475,309 L 460,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,309 L 363,309 Q 348,309 348,294 L 348,286 Q 348,271 355,271 L 363,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,233 304,229 304,237" style="fill:rgb(0,0,0)"/>
<path d="M459,157 L 466,157 Q 474,157 474,172 L 474,218 Q 474,233 459,233 L 313,233 L 298,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,271 195,275 195,266" style="fill:rgb(0,0,0)"/>
<path d="M292,233 L 180,233 Q 165,233 165,248 L 165,256 Q 165,271 180,271 L 185,271 L 200,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,195 160,184 169,184" style="fill:rgb(0,0,0)"/>
<path d="M165,142L165,189"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,195L165,256"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,399L311,399L311,369L206,369Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="258" y="384" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="519,384 508,389 508,380" style="fill:rgb(0,0,0)"/>
<path d="M311,384L513,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M534,399A15 15 0 0 0 549 384A15 15 0 0 0 534 369A15 15 0 0 0 519 384A15 15 0 0 0 534 399Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="534" y="384" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="591,17 579,21 579,12" style="fill:rgb(0,0,0)"/>
<path d="M549,384 L 557,384 Q 564,384 564,369 L 564,32 Q 564,17 575,17 L 585,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="594" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,17 508,21 508,12" style="fill:rgb(0,0,0)"/>
<path d="M256,17L513,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,17L579,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="292,346 304,342 304,351" style="fill:rgb(0,0,0)"/>
<path d="M504,271 L 512,271 Q 519,271 519,286 L 519,331 Q 519,346 504,346 L 313,346 L 298,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,384 195,389 195,380" style="fill:rgb(0,0,0)"/>
<path d="M292,346 L 180,346 Q 165,346 165,361 L 165,369 Q 165,384 180,384 L 185,384 L 200,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,309 160,297 169,297" style="fill:rgb(0,0,0)"/>
<path d="M165,256L165,303"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,309L165,369"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="258,411 247,416 247,407" style="fill:rgb(0,0,0)"/>
<path d="M165,369 L 165,396 Q 165,411 180,411 L 238,411 L 253,411"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="380,384 369,389 369,380" style="fill:rgb(0,0,0)"/>
<path d="M258,411 L 335,411 Q 350,411 350,398 Q 350,384 362,384 L 375,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#expr">expr</a><br></br>
References:&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#frame-spec">frame-spec</a>&nbsp;&nbsp; <a href="#ordering-term">ordering-term</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="pragma-stmt"></a><h4>pragma-stmt:</h4><div class='imgcontainer'>
<div style="max-width:824px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 824.352 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L104,32A15 15 0 0 0 119 17A15 15 0 0 0 104 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRAGMA</text>
<polygon points="155,17 143,21 143,12" style="fill:rgb(0,0,0)"/>
<path d="M119,17L149,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M170,32L266,32A15 15 0 0 0 282 17A15 15 0 0 0 266 2L170,2A15 15 0 0 0 155 17A15 15 0 0 0 170 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="305,17 293,21 293,12" style="fill:rgb(0,0,0)"/>
<path d="M282,17L299,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,32A15 15 0 0 0 335 17A15 15 0 0 0 320 2A15 15 0 0 0 305 17A15 15 0 0 0 320 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="320" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="371,17 359,21 359,12" style="fill:rgb(0,0,0)"/>
<path d="M335,17L365,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M386,32L483,32A15 15 0 0 0 498 17A15 15 0 0 0 483 2L386,2A15 15 0 0 0 371 17A15 15 0 0 0 386 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="435" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">pragma-name</text>
<polygon points="540,82 528,86 528,77" style="fill:rgb(0,0,0)"/>
<path d="M498,17 L 506,17 Q 513,17 513,32 L 513,67 Q 513,82 524,82 L 534,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M555,97A15 15 0 0 0 570 82A15 15 0 0 0 555 67A15 15 0 0 0 540 82A15 15 0 0 0 555 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="555" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="593,82 582,86 582,77" style="fill:rgb(0,0,0)"/>
<path d="M570,82L587,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M593,97L720,97L720,67L593,67Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="656" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">pragma-value</text>
<polygon points="743,82 731,86 731,77" style="fill:rgb(0,0,0)"/>
<path d="M720,82L737,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M758,97A15 15 0 0 0 773 82A15 15 0 0 0 758 67A15 15 0 0 0 743 82A15 15 0 0 0 758 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="758" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="814,17 803,21 803,12" style="fill:rgb(0,0,0)"/>
<path d="M773,82 L 780,82 Q 788,82 788,67 L 788,32 Q 788,17 798,17 L 809,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="818" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="540,44 528,48 528,40" style="fill:rgb(0,0,0)"/>
<path d="M498,17 L 506,17 Q 513,17 513,30 Q 513,44 524,44 L 534,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M555,59A15 15 0 0 0 570 44L570,44A15 15 0 0 0 555 29A15 15 0 0 0 540 44L540,44A15 15 0 0 0 555 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="555" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">=</text>
<polygon points="593,44 582,48 582,40" style="fill:rgb(0,0,0)"/>
<path d="M570,44L587,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M593,59L720,59L720,29L593,29Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="656" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">pragma-value</text>
<polygon points="773,44 761,48 761,40" style="fill:rgb(0,0,0)"/>
<path d="M720,44L767,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M773,44 L 780,44 Q 788,44 788,36 L 788,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="656,17 645,21 645,12" style="fill:rgb(0,0,0)"/>
<path d="M498,17L651,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M656,17L803,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="218,44 207,48 207,40" style="fill:rgb(0,0,0)"/>
<path d="M119,17 L 126,17 Q 134,17 134,30 Q 134,44 149,44 L 198,44 L 213,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M218,44 L 335,44 Q 350,44 350,30 Q 350,17 357,17 L 365,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href="#pragma-value">pragma-value</a><br></br>
See also:&nbsp;&nbsp; <a href="pragma.html#syntax">pragma.html#syntax</a>
</div>

<a name="pragma-value"></a><h4>pragma-value:</h4><div class='imgcontainer'>
<div style="max-width:264px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 264.499 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="63,17 51,21 51,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L57,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M63,32L201,32L201,2L63,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="132" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="255,17 243,21 243,12" style="fill:rgb(0,0,0)"/>
<path d="M201,17L249,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="258" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M78,70L105,70A15 15 0 0 0 120 55L120,55A15 15 0 0 0 105 39L78,39A15 15 0 0 0 63 55L63,55A15 15 0 0 0 78 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<path d="M78,108L171,108A15 15 0 0 0 186 92A15 15 0 0 0 171 77L78,77A15 15 0 0 0 63 92A15 15 0 0 0 78 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="125" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-literal</text>
<polygon points="63,92 51,97 51,88" style="fill:rgb(0,0,0)"/>
<path d="M21,17 L 29,17 Q 36,17 36,32 L 36,77 Q 36,92 47,92 L 57,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="201,92 189,97 189,88" style="fill:rgb(0,0,0)"/>
<path d="M186,92L195,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M201,92 L 208,92 Q 216,92 216,77 L 216,32 Q 216,17 223,17 L 231,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="201,55 189,59 189,50" style="fill:rgb(0,0,0)"/>
<path d="M120,55L195,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M201,55 L 208,55 Q 216,55 216,47 L 216,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="63,55 51,59 51,50" style="fill:rgb(0,0,0)"/>
<path d="M36,39 L 36,47 Q 36,55 47,55 L 57,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#pragma-stmt">pragma-stmt</a><br></br>
References:&nbsp;&nbsp; <a href="#signed-number">signed-number</a><br></br>
See also:&nbsp;&nbsp; <a href="pragma.html#syntax">pragma.html#syntax</a>
</div>

<a name="qualified-table-name"></a><h4>qualified-table-name:</h4><div class='imgcontainer'>
<div style="max-width:599px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 599.746 182.736">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L156,32A15 15 0 0 0 171 17A15 15 0 0 0 156 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="108" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="195,17 183,21 183,12" style="fill:rgb(0,0,0)"/>
<path d="M171,17L189,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M210,32A15 15 0 0 0 225 17A15 15 0 0 0 210 2A15 15 0 0 0 195 17A15 15 0 0 0 210 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="261,17 249,21 249,12" style="fill:rgb(0,0,0)"/>
<path d="M225,17L255,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,32L351,32A15 15 0 0 0 366 17A15 15 0 0 0 351 2L276,2A15 15 0 0 0 261 17A15 15 0 0 0 276 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="313" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="408,44 396,48 396,40" style="fill:rgb(0,0,0)"/>
<path d="M366,17 L 374,17 Q 381,17 381,30 Q 381,44 392,44 L 402,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,59L427,59A15 15 0 0 0 442 44L442,44A15 15 0 0 0 427 29L423,29A15 15 0 0 0 408 44L408,44A15 15 0 0 0 423 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="465,44 453,48 453,40" style="fill:rgb(0,0,0)"/>
<path d="M442,44L459,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M480,59L501,59A15 15 0 0 0 516 44L516,44A15 15 0 0 0 501 29L480,29A15 15 0 0 0 465 44L465,44A15 15 0 0 0 480 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="490" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">alias</text>
<polygon points="539,44 527,48 527,40" style="fill:rgb(0,0,0)"/>
<path d="M516,44L533,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,44 L 546,44 Q 554,44 554,51 L 554,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="453,17 442,21 442,12" style="fill:rgb(0,0,0)"/>
<path d="M366,17L448,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="108,44 97,48 97,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 39,44 L 87,44 L 102,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M108,44 L 225,44 Q 240,44 240,30 Q 240,17 247,17 L 255,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,142L301,142A15 15 0 0 0 316 127A15 15 0 0 0 301 112L236,112A15 15 0 0 0 221 127A15 15 0 0 0 236 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="339,127 327,131 327,123" style="fill:rgb(0,0,0)"/>
<path d="M316,127L333,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M354,142L358,142A15 15 0 0 0 373 127A15 15 0 0 0 358 112L354,112A15 15 0 0 0 339 127A15 15 0 0 0 354 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="396,127 385,131 385,123" style="fill:rgb(0,0,0)"/>
<path d="M373,127L390,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M411,142L490,142A15 15 0 0 0 505 127A15 15 0 0 0 490 112L411,112A15 15 0 0 0 396 127A15 15 0 0 0 411 142Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="451" y="127" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M236,180L256,180A15 15 0 0 0 271 165A15 15 0 0 0 256 150L236,150A15 15 0 0 0 221 165A15 15 0 0 0 236 180Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="165" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="294,165 283,169 283,161" style="fill:rgb(0,0,0)"/>
<path d="M271,165L289,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,180L374,180A15 15 0 0 0 389 165A15 15 0 0 0 374 150L310,150A15 15 0 0 0 294 165A15 15 0 0 0 310 180Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="342" y="165" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="554,74 550,62 558,62" style="fill:rgb(0,0,0)"/>
<path d="M453,17 L 539,17 Q 554,17 554,32 L 554,53 L 554,68"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="313,89 325,85 325,94" style="fill:rgb(0,0,0)"/>
<path d="M554,74 L 554,82 Q 554,89 539,89 L 334,89 L 319,89"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="221,127 210,131 210,123" style="fill:rgb(0,0,0)"/>
<path d="M313,89 L 210,89 Q 195,89 195,104 L 195,112 Q 195,127 205,127 L 215,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="221,165 210,169 210,161" style="fill:rgb(0,0,0)"/>
<path d="M195,112 L 195,150 Q 195,165 205,165 L 215,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="554,114 550,102 558,102" style="fill:rgb(0,0,0)"/>
<path d="M554,74L554,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="590,165 578,169 578,161" style="fill:rgb(0,0,0)"/>
<path d="M554,114 L 554,150 Q 554,165 569,165 L 569,165 L 584,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="593" cy="165" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="539,127 527,131 527,123" style="fill:rgb(0,0,0)"/>
<path d="M505,127L533,127"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,127 L 546,127 Q 554,127 554,135 L 554,142"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M389,165L578,165"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#delete-stmt">delete-stmt</a>&nbsp;&nbsp; <a href="#delete-stmt-limited">delete-stmt-limited</a>&nbsp;&nbsp; <a href="#update-stmt">update-stmt</a>&nbsp;&nbsp; <a href="#update-stmt-limited">update-stmt-limited</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_indexedby.html">lang_indexedby.html</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>
</div>

<a name="raise-function"></a><h4>raise-function:</h4><div class='imgcontainer'>
<div style="max-width:627px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 627.302 147.96">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L82,32A15 15 0 0 0 97 17A15 15 0 0 0 82 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RAISE</text>
<polygon points="120,17 109,21 109,12" style="fill:rgb(0,0,0)"/>
<path d="M97,17L114,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,32L135,32A15 15 0 0 0 150 17A15 15 0 0 0 135 2L135,2A15 15 0 0 0 120 17A15 15 0 0 0 135 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="135" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="192,55 180,59 180,50" style="fill:rgb(0,0,0)"/>
<path d="M150,17 L 158,17 Q 165,17 165,32 L 165,40 Q 165,55 176,55 L 186,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,70L285,70A15 15 0 0 0 300 55L300,55A15 15 0 0 0 285 39L207,39A15 15 0 0 0 192 55L192,55A15 15 0 0 0 207 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="336,55 324,59 324,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M351,70A15 15 0 0 0 366 55L366,55A15 15 0 0 0 351 39A15 15 0 0 0 336 55L336,55A15 15 0 0 0 351 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="351" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="389,55 378,59 378,50" style="fill:rgb(0,0,0)"/>
<path d="M366,55L383,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,70L508,70A15 15 0 0 0 523 55L523,55A15 15 0 0 0 508 39L404,39A15 15 0 0 0 389 55L389,55A15 15 0 0 0 404 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="456" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">error-message</text>
<polygon points="564,17 553,21 553,12" style="fill:rgb(0,0,0)"/>
<path d="M523,55 L 530,55 Q 538,55 538,40 L 538,32 Q 538,17 548,17 L 558,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M579,32A15 15 0 0 0 594 17A15 15 0 0 0 579 2A15 15 0 0 0 564 17A15 15 0 0 0 579 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="617,17 606,21 606,12" style="fill:rgb(0,0,0)"/>
<path d="M594,17L612,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="621" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M150,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L259,32A15 15 0 0 0 274 17A15 15 0 0 0 259 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="233" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="456,17 444,21 444,12" style="fill:rgb(0,0,0)"/>
<path d="M274,17L450,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,17L553,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,108L249,108A15 15 0 0 0 264 92A15 15 0 0 0 249 77L207,77A15 15 0 0 0 192 92A15 15 0 0 0 207 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="300,92 288,97 288,88" style="fill:rgb(0,0,0)"/>
<path d="M264,92L294,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,92 L 307,92 Q 315,92 315,77 L 315,70 Q 315,55 322,55 L 330,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,145L229,145A15 15 0 0 0 244 130A15 15 0 0 0 229 115L207,115A15 15 0 0 0 192 130A15 15 0 0 0 207 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="218" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="300,130 288,135 288,126" style="fill:rgb(0,0,0)"/>
<path d="M244,130L294,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,130 L 307,130 Q 315,130 315,115 L 315,92 L 315,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,130 180,135 180,126" style="fill:rgb(0,0,0)"/>
<path d="M165,39 L 165,115 Q 165,130 176,130 L 186,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="192,92 180,97 180,88" style="fill:rgb(0,0,0)"/>
<path d="M165,77 L 165,85 Q 165,92 176,92 L 186,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#expr">expr</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html#raise">lang_createtrigger.html#raise</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="recursive-cte"></a><h4>recursive-cte:</h4><div class='imgcontainer'>
<div style="max-width:874px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 874.291 72.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M32,32L169,32L169,2L32,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="100" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">cte-table-name</text>
<polygon points="192,17 180,21 180,12" style="fill:rgb(0,0,0)"/>
<path d="M169,17L186,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M207,32L211,32A15 15 0 0 0 226 17A15 15 0 0 0 211 2L207,2A15 15 0 0 0 192 17A15 15 0 0 0 207 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="249,17 237,21 237,12" style="fill:rgb(0,0,0)"/>
<path d="M226,17L243,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M264,32A15 15 0 0 0 279 17A15 15 0 0 0 264 2A15 15 0 0 0 249 17A15 15 0 0 0 264 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="302,17 291,21 291,12" style="fill:rgb(0,0,0)"/>
<path d="M279,17L296,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M317,32L403,32A15 15 0 0 0 418 17A15 15 0 0 0 403 2L317,2A15 15 0 0 0 302 17A15 15 0 0 0 317 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">initial-select</text>
<polygon points="459,55 448,59 448,50" style="fill:rgb(0,0,0)"/>
<path d="M418,17 L 425,17 Q 433,17 433,32 L 433,40 Q 433,55 443,55 L 454,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M474,70L518,70A15 15 0 0 0 533 55L533,55A15 15 0 0 0 518 39L474,39A15 15 0 0 0 459 55L459,55A15 15 0 0 0 474 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="496" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<polygon points="556,55 545,59 545,50" style="fill:rgb(0,0,0)"/>
<path d="M533,55L550,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M571,70L586,70A15 15 0 0 0 601 55L601,55A15 15 0 0 0 586 39L571,39A15 15 0 0 0 556 55L556,55A15 15 0 0 0 571 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="579" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="643,17 631,21 631,12" style="fill:rgb(0,0,0)"/>
<path d="M601,55 L 609,55 Q 616,55 616,40 L 616,32 Q 616,17 627,17 L 637,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M658,32L773,32A15 15 0 0 0 788 17A15 15 0 0 0 773 2L658,2A15 15 0 0 0 643 17A15 15 0 0 0 658 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="715" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">recursive-select</text>
<polygon points="811,17 800,21 800,12" style="fill:rgb(0,0,0)"/>
<path d="M788,17L805,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M826,32A15 15 0 0 0 841 17A15 15 0 0 0 826 2A15 15 0 0 0 811 17A15 15 0 0 0 826 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="826" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="864,17 853,21 853,12" style="fill:rgb(0,0,0)"/>
<path d="M841,17L859,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="868" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="459,17 448,21 448,12" style="fill:rgb(0,0,0)"/>
<path d="M418,17L454,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M474,32L518,32A15 15 0 0 0 533 17A15 15 0 0 0 518 2L474,2A15 15 0 0 0 459 17A15 15 0 0 0 474 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="496" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNION</text>
<path d="M533,17L631,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<br></br>
References:&nbsp;&nbsp; <a href="#cte-table-name">cte-table-name</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_with.html#recursivecte">lang_with.html#recursivecte</a>
</div>

<a name="reindex-stmt"></a><h4>reindex-stmt:</h4><div class='imgcontainer'>
<div style="max-width:619px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 619.286 137.376">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L111,32A15 15 0 0 0 126 17A15 15 0 0 0 111 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="79" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REINDEX</text>
<polygon points="167,82 156,86 156,77" style="fill:rgb(0,0,0)"/>
<path d="M126,17 L 133,17 Q 141,17 141,32 L 141,67 Q 141,82 151,82 L 162,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M182,97L279,97A15 15 0 0 0 294 82A15 15 0 0 0 279 67L182,67A15 15 0 0 0 167 82A15 15 0 0 0 182 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="317,82 305,86 305,77" style="fill:rgb(0,0,0)"/>
<path d="M294,82L311,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M332,97A15 15 0 0 0 347 82A15 15 0 0 0 332 67A15 15 0 0 0 317 82A15 15 0 0 0 332 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="383,82 372,86 372,77" style="fill:rgb(0,0,0)"/>
<path d="M347,82L377,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="425,120 413,124 413,115" style="fill:rgb(0,0,0)"/>
<path d="M383,82 L 391,82 Q 398,82 398,97 L 398,105 Q 398,120 409,120 L 419,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M440,135L518,135A15 15 0 0 0 533 120A15 15 0 0 0 518 104L440,104A15 15 0 0 0 425 120A15 15 0 0 0 440 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="479" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<polygon points="568,120 556,124 556,115" style="fill:rgb(0,0,0)"/>
<path d="M533,120L562,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,17 598,21 598,12" style="fill:rgb(0,0,0)"/>
<path d="M568,120 L 575,120 Q 583,120 583,105 L 583,32 Q 583,17 593,17 L 604,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="613" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="425,82 413,86 413,77" style="fill:rgb(0,0,0)"/>
<path d="M383,82L419,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M440,97L515,97A15 15 0 0 0 530 82A15 15 0 0 0 515 67L440,67A15 15 0 0 0 425 82A15 15 0 0 0 440 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="82" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="568,82 556,86 556,77" style="fill:rgb(0,0,0)"/>
<path d="M530,82L562,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M568,82 L 575,82 Q 583,82 583,74 L 583,67"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="383,17 372,21 372,12" style="fill:rgb(0,0,0)"/>
<path d="M126,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M383,17L598,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="167,44 156,48 156,40" style="fill:rgb(0,0,0)"/>
<path d="M126,17 L 133,17 Q 141,17 141,30 Q 141,44 151,44 L 162,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M182,59L288,59A15 15 0 0 0 303 44L303,44A15 15 0 0 0 288 29L182,29A15 15 0 0 0 167 44L167,44A15 15 0 0 0 182 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="235" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">collation-name</text>
<polygon points="568,44 556,48 556,40" style="fill:rgb(0,0,0)"/>
<path d="M303,44L562,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M568,44 L 575,44 Q 583,44 583,36 L 583,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="231,120 219,124 219,115" style="fill:rgb(0,0,0)"/>
<path d="M141,67 L 141,105 Q 141,120 156,120 L 210,120 L 225,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M231,120 L 347,120 Q 362,120 362,105 L 362,97 Q 362,82 370,82 L 377,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_reindex.html">lang_reindex.html</a>
</div>

<a name="release-stmt"></a><h4>release-stmt:</h4><div class='imgcontainer'>
<div style="max-width:488px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 488.736 54">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L111,32A15 15 0 0 0 126 17A15 15 0 0 0 111 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="79" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RELEASE</text>
<polygon points="162,17 150,21 150,12" style="fill:rgb(0,0,0)"/>
<path d="M126,17L156,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M177,32L261,32A15 15 0 0 0 276 17A15 15 0 0 0 261 2L177,2A15 15 0 0 0 162 17A15 15 0 0 0 177 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SAVEPOINT</text>
<polygon points="312,17 301,21 301,12" style="fill:rgb(0,0,0)"/>
<path d="M276,17L306,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M327,32L441,32A15 15 0 0 0 456 17A15 15 0 0 0 441 2L327,2A15 15 0 0 0 312 17A15 15 0 0 0 327 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="384" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">savepoint-name</text>
<polygon points="479,17 467,21 467,12" style="fill:rgb(0,0,0)"/>
<path d="M456,17L473,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="482" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="219,47 207,51 207,43" style="fill:rgb(0,0,0)"/>
<path d="M126,17 L 133,17 Q 141,17 141,32 L 141,32 Q 141,47 156,47 L 198,47 L 213,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,47 L 276,47 Q 291,47 291,32 L 291,32 Q 291,17 299,17 L 306,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_savepoint.html">lang_savepoint.html</a>
</div>

<a name="result-column"></a><h4>result-column:</h4><div class='imgcontainer'>
<div style="max-width:398px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 398.054 163.08">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,32L94,32L94,2L45,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="69" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="136,55 124,59 124,50" style="fill:rgb(0,0,0)"/>
<path d="M94,17 L 102,17 Q 109,17 109,32 L 109,40 Q 109,55 119,55 L 130,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M151,70L155,70A15 15 0 0 0 170 55L170,55A15 15 0 0 0 155 39L151,39A15 15 0 0 0 136 55L136,55A15 15 0 0 0 151 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="153" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="206,55 194,59 194,50" style="fill:rgb(0,0,0)"/>
<path d="M170,55L200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M221,70L309,70A15 15 0 0 0 324 55L324,55A15 15 0 0 0 309 39L221,39A15 15 0 0 0 206 55L206,55A15 15 0 0 0 221 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="265" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="347,55 335,59 335,50" style="fill:rgb(0,0,0)"/>
<path d="M324,55L341,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="388,17 377,21 377,12" style="fill:rgb(0,0,0)"/>
<path d="M347,55 L 354,55 Q 362,55 362,40 L 362,32 Q 362,17 372,17 L 382,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="392" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,85 141,89 141,81" style="fill:rgb(0,0,0)"/>
<path d="M109,39 L 109,70 Q 109,85 124,85 L 132,85 L 147,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,85 L 170,85 Q 185,85 185,70 L 185,70 Q 185,55 192,55 L 200,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="241,17 230,21 230,12" style="fill:rgb(0,0,0)"/>
<path d="M94,17L235,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M241,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,108 39,112 39,103" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,93 Q 24,108 34,108 L 45,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,123A15 15 0 0 0 81 108A15 15 0 0 0 66 92A15 15 0 0 0 50 108A15 15 0 0 0 66 123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="108" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,108 335,112 335,103" style="fill:rgb(0,0,0)"/>
<path d="M81,108L341,108"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,108 L 354,108 Q 362,108 362,93 L 362,54 L 362,39"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,145 39,150 39,141" style="fill:rgb(0,0,0)"/>
<path d="M24,92 L 24,130 Q 24,145 34,145 L 45,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,160L141,160A15 15 0 0 0 156 145A15 15 0 0 0 141 130L66,130A15 15 0 0 0 50 145A15 15 0 0 0 66 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="103" y="145" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="179,145 167,150 167,141" style="fill:rgb(0,0,0)"/>
<path d="M156,145L173,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M194,160A15 15 0 0 0 209 145A15 15 0 0 0 194 130A15 15 0 0 0 179 145A15 15 0 0 0 194 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="194" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="232,145 221,150 221,141" style="fill:rgb(0,0,0)"/>
<path d="M209,145L226,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,160A15 15 0 0 0 262 145A15 15 0 0 0 247 130A15 15 0 0 0 232 145A15 15 0 0 0 247 160Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="145" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="347,145 335,150 335,141" style="fill:rgb(0,0,0)"/>
<path d="M262,145L341,145"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M347,145 L 354,145 Q 362,145 362,130 L 362,107 L 362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#select-core">select-core</a>&nbsp;&nbsp; <a href="#select-stmt">select-stmt</a><br></br>
References:&nbsp;&nbsp; <a href="#expr">expr</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="returning-clause"></a><h4>returning-clause:</h4><div class='imgcontainer'>
<div style="max-width:628px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 628.709 140.4">
<circle cx="5" cy="47" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="27,47 15,51 15,43" style="fill:rgb(0,0,0)"/>
<path d="M9,47L21,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M42,62L132,62A15 15 0 0 0 147 47A15 15 0 0 0 132 32L42,32A15 15 0 0 0 27 47A15 15 0 0 0 42 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RETURNING</text>
<polygon points="237,47 226,51 226,43" style="fill:rgb(0,0,0)"/>
<path d="M147,47L232,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M237,62L287,62L287,32L237,32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="262" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="328,77 317,82 317,73" style="fill:rgb(0,0,0)"/>
<path d="M287,47 L 294,47 Q 302,47 302,62 L 302,62 Q 302,77 312,77 L 322,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M343,92L347,92A15 15 0 0 0 362 77L362,77A15 15 0 0 0 347 62L343,62A15 15 0 0 0 328 77L328,77A15 15 0 0 0 343 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="398,77 387,82 387,73" style="fill:rgb(0,0,0)"/>
<path d="M362,77L393,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M414,92L501,92A15 15 0 0 0 516 77L516,77A15 15 0 0 0 501 62L414,62A15 15 0 0 0 398 77L398,77A15 15 0 0 0 414 92Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="457" y="77" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-alias</text>
<polygon points="539,77 528,82 528,73" style="fill:rgb(0,0,0)"/>
<path d="M516,77L534,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="581,47 569,51 569,43" style="fill:rgb(0,0,0)"/>
<path d="M539,77 L 547,77 Q 554,77 554,62 L 554,62 Q 554,47 565,47 L 575,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="619,47 607,51 607,43" style="fill:rgb(0,0,0)"/>
<path d="M581,47L613,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="622" cy="47" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="345,101 334,106 334,97" style="fill:rgb(0,0,0)"/>
<path d="M302,62 L 302,86 Q 302,101 317,101 L 325,101 L 340,101"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,101 L 362,101 Q 377,101 377,89 Q 377,77 385,77 L 392,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="453,47 441,51 441,43" style="fill:rgb(0,0,0)"/>
<path d="M287,47L447,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,47L607,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,138A15 15 0 0 0 406 123A15 15 0 0 0 391 108A15 15 0 0 0 376 123A15 15 0 0 0 391 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="391" y="123" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="376,123 365,127 365,118" style="fill:rgb(0,0,0)"/>
<path d="M147,47 L 196,47 Q 211,47 211,62 L 211,108 Q 211,123 226,123 L 355,123 L 370,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="539,123 528,127 528,118" style="fill:rgb(0,0,0)"/>
<path d="M406,123L534,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,123 L 547,123 Q 554,123 554,108 L 554,77 L 554,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M391,32A15 15 0 0 0 406 17A15 15 0 0 0 391 2A15 15 0 0 0 376 17A15 15 0 0 0 391 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="391" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="406,17 418,12 418,21" style="fill:rgb(0,0,0)"/>
<path d="M581,47 L 588,47 Q 596,47 596,32 L 596,32 Q 596,17 581,17 L 427,17 L 412,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="186,47 174,51 174,43" style="fill:rgb(0,0,0)"/>
<path d="M376,17 L 174,17 Q 159,17 159,32 L 159,32 Q 159,47 169,47 L 180,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#delete-stmt">delete-stmt</a>&nbsp;&nbsp; <a href="#delete-stmt-limited">delete-stmt-limited</a>&nbsp;&nbsp; <a href="#insert-stmt">insert-stmt</a>&nbsp;&nbsp; <a href="#update-stmt">update-stmt</a>&nbsp;&nbsp; <a href="#update-stmt-limited">update-stmt-limited</a><br></br>
References:&nbsp;&nbsp; <a href="#expr">expr</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>
</div>

<a name="rollback-stmt"></a><h4>rollback-stmt:</h4><div class='imgcontainer'>
<div style="max-width:801px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 801.734 67.392">
<circle cx="5" cy="33" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,33 20,38 20,29" style="fill:rgb(0,0,0)"/>
<path d="M9,33L26,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,48L125,48A15 15 0 0 0 140 33A15 15 0 0 0 125 18L47,18A15 15 0 0 0 32 33A15 15 0 0 0 47 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="86" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="176,33 164,38 164,29" style="fill:rgb(0,0,0)"/>
<path d="M140,33L170,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M191,48L303,48A15 15 0 0 0 318 33A15 15 0 0 0 303 18L191,18A15 15 0 0 0 176 33A15 15 0 0 0 191 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="247" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TRANSACTION</text>
<polygon points="390,33 378,38 378,29" style="fill:rgb(0,0,0)"/>
<path d="M318,33L384,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M405,48L411,48A15 15 0 0 0 426 33A15 15 0 0 0 411 18L405,18A15 15 0 0 0 390 33A15 15 0 0 0 405 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="408" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TO</text>
<polygon points="462,33 450,38 450,29" style="fill:rgb(0,0,0)"/>
<path d="M426,33L456,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M477,48L561,48A15 15 0 0 0 576 33A15 15 0 0 0 561 18L477,18A15 15 0 0 0 462 33A15 15 0 0 0 477 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SAVEPOINT</text>
<polygon points="612,33 601,38 601,29" style="fill:rgb(0,0,0)"/>
<path d="M576,33L606,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M627,48L741,48A15 15 0 0 0 756 33A15 15 0 0 0 741 18L627,18A15 15 0 0 0 612 33A15 15 0 0 0 627 48Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="684" y="33" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">savepoint-name</text>
<polygon points="792,33 780,38 780,29" style="fill:rgb(0,0,0)"/>
<path d="M756,33L786,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="795" cy="33" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,6 507,10 507,2" style="fill:rgb(0,0,0)"/>
<path d="M426,33 L 433,33 Q 441,33 441,20 Q 441,6 456,6 L 498,6 L 513,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,6 L 576,6 Q 591,6 591,20 Q 591,33 599,33 L 606,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="519,60 507,65 507,56" style="fill:rgb(0,0,0)"/>
<path d="M352,33 L 359,33 Q 367,33 367,47 Q 367,60 382,60 L 498,60 L 513,60"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M519,60 L 756,60 Q 771,60 771,47 Q 771,33 778,33 L 786,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="247,60 235,65 235,56" style="fill:rgb(0,0,0)"/>
<path d="M140,33 L 147,33 Q 155,33 155,47 Q 155,60 170,60 L 226,60 L 241,60"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M247,60 L 318,60 Q 333,60 333,47 Q 333,33 340,33 L 348,33"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_savepoint.html">lang_savepoint.html</a>&nbsp;&nbsp; <a href="lang_transaction.html">lang_transaction.html</a>
</div>

<a name="savepoint-stmt"></a><h4>savepoint-stmt:</h4><div class='imgcontainer'>
<div style="max-width:346px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 346.003 34.56">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L131,32A15 15 0 0 0 146 17A15 15 0 0 0 131 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="89" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SAVEPOINT</text>
<polygon points="169,17 158,21 158,12" style="fill:rgb(0,0,0)"/>
<path d="M146,17L164,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M185,32L298,32A15 15 0 0 0 313 17A15 15 0 0 0 298 2L185,2A15 15 0 0 0 169 17A15 15 0 0 0 185 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="241" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">savepoint-name</text>
<polygon points="336,17 325,21 325,12" style="fill:rgb(0,0,0)"/>
<path d="M313,17L330,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="340" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_savepoint.html">lang_savepoint.html</a>
</div>

<a name="select-core"></a><h4>select-core:</h4><div class='imgcontainer'>
<div style="max-width:655px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 655.157 728.568">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="63,17 51,21 51,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L57,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M78,32L129,32A15 15 0 0 0 144 17A15 15 0 0 0 129 2L78,2A15 15 0 0 0 63 17A15 15 0 0 0 78 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="104" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="186,47 174,51 174,43" style="fill:rgb(0,0,0)"/>
<path d="M144,17 L 152,17 Q 159,17 159,32 L 159,32 Q 159,47 170,47 L 180,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M201,62L269,62A15 15 0 0 0 284 47L284,47A15 15 0 0 0 269 32L201,32A15 15 0 0 0 186 47L186,47A15 15 0 0 0 201 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="235" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="353,17 342,21 342,12" style="fill:rgb(0,0,0)"/>
<path d="M284,47 L 292,47 Q 299,47 299,32 L 299,32 Q 299,17 314,17 L 333,17 L 348,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M353,32L481,32L481,2L353,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M417,70A15 15 0 0 0 432 55L432,55A15 15 0 0 0 417 39A15 15 0 0 0 402 55L402,55A15 15 0 0 0 417 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="417" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="432,55 444,50 444,59" style="fill:rgb(0,0,0)"/>
<path d="M481,17 L 488,17 Q 496,17 496,32 L 496,40 Q 496,55 481,55 L 453,55 L 438,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M402,55 L 342,55 Q 327,55 327,40 L 327,32 Q 327,17 334,17 L 342,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="235,17 224,21 224,12" style="fill:rgb(0,0,0)"/>
<path d="M144,17L229,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M235,17L342,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M201,100L216,100A15 15 0 0 0 231 85A15 15 0 0 0 216 70L201,70A15 15 0 0 0 186 85A15 15 0 0 0 201 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="208" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="284,85 273,89 273,81" style="fill:rgb(0,0,0)"/>
<path d="M231,85L279,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,85 L 292,85 Q 299,85 299,70 L 299,47 L 299,32"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="186,85 174,89 174,81" style="fill:rgb(0,0,0)"/>
<path d="M144,17 L 152,17 Q 159,17 159,32 L 159,70 Q 159,85 170,85 L 180,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,176L139,176A15 15 0 0 0 154 160A15 15 0 0 0 139 145L105,145A15 15 0 0 0 89 160A15 15 0 0 0 105 176Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="122" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="226,160 215,165 215,156" style="fill:rgb(0,0,0)"/>
<path d="M154,160L221,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M226,176L387,176L387,145L226,145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="307" y="160" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M256,250L358,250L358,219L256,219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="307" y="235" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M307,212A15 15 0 0 0 322 197A15 15 0 0 0 307 182A15 15 0 0 0 292 197A15 15 0 0 0 307 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="307" y="197" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="322,197 334,192 334,201" style="fill:rgb(0,0,0)"/>
<path d="M387,160 L 395,160 Q 402,160 402,175 L 402,182 Q 402,197 387,197 L 343,197 L 328,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M292,197 L 215,197 Q 200,197 200,182 L 200,175 Q 200,160 207,160 L 215,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="256,235 244,239 244,230" style="fill:rgb(0,0,0)"/>
<path d="M154,160 L 162,160 Q 169,160 169,175 L 169,220 Q 169,235 184,235 L 235,235 L 250,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="420,201 425,213 416,213" style="fill:rgb(0,0,0)"/>
<path d="M358,235 L 373,235 Q 387,235 402,235 L 405,235 Q 420,235 420,221 L 420,207"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="441,160 430,165 430,156" style="fill:rgb(0,0,0)"/>
<path d="M420,201 L 420,175 Q 420,160 428,160 L 436,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,160 L 432,160 Q 423,160 423,160 Q 423,160 431,160 L 438,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,85 492,73 500,73" style="fill:rgb(0,0,0)"/>
<path d="M481,17 L 488,17 Q 496,17 496,32 L 496,64 L 496,79"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="284,123 296,118 296,127" style="fill:rgb(0,0,0)"/>
<path d="M496,85 L 496,108 Q 496,123 481,123 L 305,123 L 290,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="89,160 78,165 78,156" style="fill:rgb(0,0,0)"/>
<path d="M284,123 L 78,123 Q 63,123 63,138 L 63,145 Q 63,160 73,160 L 84,160"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,325L154,325A15 15 0 0 0 169 310A15 15 0 0 0 154 295L105,295A15 15 0 0 0 89 310A15 15 0 0 0 105 325Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="129" y="310" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="192,310 181,314 181,306" style="fill:rgb(0,0,0)"/>
<path d="M169,310L186,310"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M192,325L241,325L241,295L192,295Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="217" y="310" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="453,212 449,200 458,200" style="fill:rgb(0,0,0)"/>
<path d="M387,160 L 438,160 Q 453,160 453,175 L 453,191 L 453,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,272 318,268 318,277" style="fill:rgb(0,0,0)"/>
<path d="M453,212 L 453,257 Q 453,272 438,272 L 328,272 L 313,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="89,310 78,314 78,306" style="fill:rgb(0,0,0)"/>
<path d="M307,272 L 78,272 Q 63,272 63,287 L 63,295 Q 63,310 73,310 L 84,310"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="63,212 59,200 67,200" style="fill:rgb(0,0,0)"/>
<path d="M63,145L63,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M63,212L63,295"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,424L148,424A15 15 0 0 0 163 408A15 15 0 0 0 148 393L105,393A15 15 0 0 0 89 408A15 15 0 0 0 105 424Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="126" y="408" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="186,408 175,413 175,404" style="fill:rgb(0,0,0)"/>
<path d="M163,408L180,408"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M201,424L205,424A15 15 0 0 0 220 408A15 15 0 0 0 205 393L201,393A15 15 0 0 0 186 408A15 15 0 0 0 201 424Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="203" y="408" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="256,408 245,413 245,404" style="fill:rgb(0,0,0)"/>
<path d="M220,408L251,408"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,424L306,424L306,393L256,393Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="408" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="388,408 377,413 377,404" style="fill:rgb(0,0,0)"/>
<path d="M306,408L383,408"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,424L456,424A15 15 0 0 0 471 408A15 15 0 0 0 456 393L404,393A15 15 0 0 0 388 408A15 15 0 0 0 404 424Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="430" y="408" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="494,408 483,413 483,404" style="fill:rgb(0,0,0)"/>
<path d="M471,408L488,408"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M494,424L543,424L543,393L494,393Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="519" y="408" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M281,461A15 15 0 0 0 296 446A15 15 0 0 0 281 431A15 15 0 0 0 266 446A15 15 0 0 0 281 461Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="446" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="296,446 308,442 308,451" style="fill:rgb(0,0,0)"/>
<path d="M306,408 L 313,408 Q 321,408 321,423 L 321,431 Q 321,446 311,446 L 302,446"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,446 L 245,446 Q 230,446 230,431 L 230,423 Q 230,408 237,408 L 245,408"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="450,439 439,443 439,434" style="fill:rgb(0,0,0)"/>
<path d="M347,408 L 354,408 Q 362,408 362,423 L 362,424 Q 362,439 377,439 L 430,439 L 445,439"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M450,439 L 543,439 Q 558,439 558,424 L 558,423 Q 558,408 566,408 L 573,408"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="203,378 192,382 192,374" style="fill:rgb(0,0,0)"/>
<path d="M63,348 L 63,363 Q 63,378 78,378 L 183,378 L 198,378"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="347,408 336,413 336,404" style="fill:rgb(0,0,0)"/>
<path d="M203,378 L 306,378 Q 321,378 321,393 L 321,393 Q 321,408 331,408 L 341,408"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="169,348 181,344 181,352" style="fill:rgb(0,0,0)"/>
<path d="M241,310 L 249,310 Q 256,310 256,325 L 256,333 Q 256,348 241,348 L 190,348 L 175,348"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="89,408 78,413 78,404" style="fill:rgb(0,0,0)"/>
<path d="M169,348 L 78,348 Q 63,348 63,363 L 63,393 Q 63,408 73,408 L 84,408"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="63,335 59,323 67,323" style="fill:rgb(0,0,0)"/>
<path d="M63,295L63,329"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M63,335L63,393"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,537L168,537A15 15 0 0 0 183 522A15 15 0 0 0 168 507L105,507A15 15 0 0 0 89 522A15 15 0 0 0 105 537Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="136" y="522" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="219,522 208,526 208,517" style="fill:rgb(0,0,0)"/>
<path d="M183,522L213,522"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M234,537L331,537A15 15 0 0 0 346 522A15 15 0 0 0 331 507L234,507A15 15 0 0 0 219 522A15 15 0 0 0 234 537Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="283" y="522" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="369,522 358,526 358,517" style="fill:rgb(0,0,0)"/>
<path d="M346,522L364,522"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M384,537L388,537A15 15 0 0 0 404 522A15 15 0 0 0 388 507L384,507A15 15 0 0 0 369 522A15 15 0 0 0 384 537Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="386" y="522" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="427,522 415,526 415,517" style="fill:rgb(0,0,0)"/>
<path d="M404,522L421,522"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M427,537L545,537L545,507L427,507Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="486" y="522" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M382,575A15 15 0 0 0 397 560A15 15 0 0 0 382 544A15 15 0 0 0 367 560A15 15 0 0 0 382 575Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="560" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="397,560 409,555 409,564" style="fill:rgb(0,0,0)"/>
<path d="M545,522 L 553,522 Q 560,522 560,537 L 560,545 Q 560,560 545,560 L 418,560 L 403,560"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M367,560 L 208,560 Q 193,560 193,545 L 193,537 Q 193,522 200,522 L 208,522"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="588,446 584,435 593,435" style="fill:rgb(0,0,0)"/>
<path d="M543,408 L 573,408 Q 588,408 588,423 L 588,425 L 588,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,484 318,480 318,488" style="fill:rgb(0,0,0)"/>
<path d="M588,446 L 588,469 Q 588,484 573,484 L 328,484 L 313,484"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="89,522 78,526 78,517" style="fill:rgb(0,0,0)"/>
<path d="M307,484 L 78,484 Q 63,484 63,499 L 63,507 Q 63,522 73,522 L 84,522"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="63,446 59,435 67,435" style="fill:rgb(0,0,0)"/>
<path d="M63,393L63,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,597 295,602 295,593" style="fill:rgb(0,0,0)"/>
<path d="M63,446 L 63,582 Q 63,597 78,597 L 286,597 L 301,597"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="645,597 634,602 634,593" style="fill:rgb(0,0,0)"/>
<path d="M307,597L640,597"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="649" cy="597" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,586 556,574 564,574" style="fill:rgb(0,0,0)"/>
<path d="M560,544L560,580"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M560,586 L 560,592 Q 560,597 568,597 L 575,597"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M78,688L130,688A15 15 0 0 0 145 673A15 15 0 0 0 130 658L78,658A15 15 0 0 0 63 673A15 15 0 0 0 78 688Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="104" y="673" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="181,673 170,677 170,669" style="fill:rgb(0,0,0)"/>
<path d="M145,673L176,673"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,688A15 15 0 0 0 212 673A15 15 0 0 0 197 658A15 15 0 0 0 181 673A15 15 0 0 0 197 688Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="197" y="673" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="248,673 236,677 236,669" style="fill:rgb(0,0,0)"/>
<path d="M212,673L242,673"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,688L297,688L297,658L248,658Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="673" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="333,673 321,677 321,669" style="fill:rgb(0,0,0)"/>
<path d="M297,673L327,673"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,688A15 15 0 0 0 363 673A15 15 0 0 0 348 658A15 15 0 0 0 333 673A15 15 0 0 0 348 688Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="673" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="573,673 562,677 562,669" style="fill:rgb(0,0,0)"/>
<path d="M363,673L568,673"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="588,612 593,624 584,624" style="fill:rgb(0,0,0)"/>
<path d="M573,673 L 581,673 Q 588,673 588,658 L 588,633 L 588,618"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M588,612 L 588,605 Q 588,597 603,597 L 609,597 L 624,597"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,650A15 15 0 0 0 287 635A15 15 0 0 0 272 620A15 15 0 0 0 257 635A15 15 0 0 0 272 650Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="635" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M272,726A15 15 0 0 0 287 711A15 15 0 0 0 272 696A15 15 0 0 0 257 711A15 15 0 0 0 272 726Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="711" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="287,635 299,631 299,640" style="fill:rgb(0,0,0)"/>
<path d="M297,673 L 304,673 Q 312,673 312,658 L 312,650 Q 312,635 303,635 L 293,635"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,635 L 236,635 Q 221,635 221,650 L 221,658 Q 221,673 229,673 L 236,673"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="287,711 299,706 299,715" style="fill:rgb(0,0,0)"/>
<path d="M363,673 L 371,673 Q 378,673 378,688 L 378,696 Q 378,711 363,711 L 308,711 L 293,711"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,711 L 170,711 Q 155,711 155,696 L 155,688 Q 155,673 162,673 L 170,673"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="63,673 51,677 51,669" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,658 Q 24,673 39,673 L 42,673 L 57,673"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#compound-select-stmt">compound-select-stmt</a>&nbsp;&nbsp; <a href="#factored-select-stmt">factored-select-stmt</a>&nbsp;&nbsp; <a href="#simple-select-stmt">simple-select-stmt</a><br></br>
References:&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#join-clause">join-clause</a>&nbsp;&nbsp; <a href="#result-column">result-column</a>&nbsp;&nbsp; <a href="#table-or-subquery">table-or-subquery</a>&nbsp;&nbsp; <a href="#window-defn">window-defn</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>
</div>

<a name="select-stmt"></a><h4>select-stmt:</h4><div class='imgcontainer'>
<div style="max-width:669px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 669.677 1162.3">
<path d="M55,845L667,845L667,99L55,99Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="6" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="46,17 34,21 34,12" style="fill:rgb(0,0,0)"/>
<path d="M10,17L40,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M61,32L92,32A15 15 0 0 0 107 17A15 15 0 0 0 92 2L61,2A15 15 0 0 0 46 17A15 15 0 0 0 61 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="76" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M167,62L253,62A15 15 0 0 0 268 47L268,47A15 15 0 0 0 253 32L167,32A15 15 0 0 0 152 47L152,47A15 15 0 0 0 167 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="210" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="210,17 198,21 198,12" style="fill:rgb(0,0,0)"/>
<path d="M107,17L204,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="358,17 346,21 346,12" style="fill:rgb(0,0,0)"/>
<path d="M210,17L352,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M358,32L584,32L584,2L358,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="152,47 140,51 140,43" style="fill:rgb(0,0,0)"/>
<path d="M107,17 L 114,17 Q 122,17 122,32 L 122,32 Q 122,47 134,47 L 146,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="291,47 279,51 279,43" style="fill:rgb(0,0,0)"/>
<path d="M268,47L285,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,47 L 298,47 Q 306,47 306,32 L 306,32 Q 306,17 321,17 L 331,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M471,70A15 15 0 0 0 486 55L486,55A15 15 0 0 0 471 39A15 15 0 0 0 456 55L456,55A15 15 0 0 0 471 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="486,55 498,50 498,59" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,40 Q 599,55 584,55 L 507,55 L 492,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M456,55 L 350,55 Q 335,55 335,40 L 335,32 Q 335,17 340,17 L 346,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,83 307,79 307,88" style="fill:rgb(0,0,0)"/>
<path d="M584,17 L 592,17 Q 599,17 599,32 L 599,68 Q 599,83 584,83 L 316,83 L 301,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,83 L 40,83 Q 25,83 25,98 L 25,113"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="25,47 20,36 29,36" style="fill:rgb(0,0,0)"/>
<path d="M10,17 L 17,17 Q 25,17 25,29 L 25,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="55,129 43,133 43,124" style="fill:rgb(0,0,0)"/>
<path d="M25,47 L 25,114 Q 25,129 37,129 L 49,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,129 115,133 115,124" style="fill:rgb(0,0,0)"/>
<path d="M55,129L121,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,144L193,144A15 15 0 0 0 208 129A15 15 0 0 0 193 114L142,114A15 15 0 0 0 127 129A15 15 0 0 0 142 144Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="167" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SELECT</text>
<polygon points="250,159 238,163 238,155" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,144 Q 223,159 233,159 L 244,159"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,174L333,174A15 15 0 0 0 348 159A15 15 0 0 0 333 144L265,144A15 15 0 0 0 250 159A15 15 0 0 0 265 174Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="299" y="159" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DISTINCT</text>
<polygon points="417,129 406,133 406,124" style="fill:rgb(0,0,0)"/>
<path d="M348,159 L 356,159 Q 363,159 363,144 L 363,144 Q 363,129 378,129 L 396,129 L 411,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,144L545,144L545,114L417,114Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="129" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">result-column</text>
<path d="M481,182A15 15 0 0 0 496 166A15 15 0 0 0 481 151A15 15 0 0 0 466 166A15 15 0 0 0 481 182Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="166" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="496,166 508,162 508,171" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,151 Q 560,166 545,166 L 517,166 L 502,166"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M466,166 L 406,166 Q 391,166 391,151 L 391,144 Q 391,129 398,129 L 406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,129 287,133 287,124" style="fill:rgb(0,0,0)"/>
<path d="M208,129L293,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M299,129L406,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,212L280,212A15 15 0 0 0 295 197A15 15 0 0 0 280 182L265,182A15 15 0 0 0 250 197A15 15 0 0 0 265 212Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="197" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ALL</text>
<polygon points="348,197 337,201 337,192" style="fill:rgb(0,0,0)"/>
<path d="M295,197L342,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,197 L 356,197 Q 363,197 363,182 L 363,159 L 363,144"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="250,197 238,201 238,192" style="fill:rgb(0,0,0)"/>
<path d="M208,129 L 216,129 Q 223,129 223,144 L 223,182 Q 223,197 233,197 L 244,197"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,287L203,287A15 15 0 0 0 218 272A15 15 0 0 0 203 257L168,257A15 15 0 0 0 153 272A15 15 0 0 0 168 287Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="186" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="290,272 279,277 279,268" style="fill:rgb(0,0,0)"/>
<path d="M218,272L284,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,287L451,287L451,257L290,257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="272" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M320,362L422,362L422,331L320,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M371,324A15 15 0 0 0 386 309A15 15 0 0 0 371 293A15 15 0 0 0 356 309A15 15 0 0 0 371 324Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="371" y="309" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="386,309 397,304 397,313" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 459,272 Q 466,272 466,287 L 466,294 Q 466,309 451,309 L 407,309 L 392,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M356,309 L 279,309 Q 264,309 264,294 L 264,287 Q 264,272 271,272 L 279,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="320,346 308,351 308,342" style="fill:rgb(0,0,0)"/>
<path d="M218,272 L 226,272 Q 233,272 233,287 L 233,331 Q 233,346 248,346 L 299,346 L 314,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="484,313 488,325 480,325" style="fill:rgb(0,0,0)"/>
<path d="M422,346 L 436,346 Q 451,346 466,346 L 469,346 Q 484,346 484,333 L 484,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="505,272 494,277 494,268" style="fill:rgb(0,0,0)"/>
<path d="M484,313 L 484,287 Q 484,272 492,272 L 499,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,272 L 496,272 Q 487,272 487,272 Q 487,272 495,272 L 502,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="560,197 555,185 564,185" style="fill:rgb(0,0,0)"/>
<path d="M545,129 L 552,129 Q 560,129 560,144 L 560,176 L 560,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,235 360,230 360,239" style="fill:rgb(0,0,0)"/>
<path d="M560,197 L 560,220 Q 560,235 545,235 L 369,235 L 354,235"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,272 142,277 142,268" style="fill:rgb(0,0,0)"/>
<path d="M348,235 L 142,235 Q 127,235 127,250 L 127,257 Q 127,272 137,272 L 147,272"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,437L218,437A15 15 0 0 0 233 422A15 15 0 0 0 218 407L168,407A15 15 0 0 0 153 422A15 15 0 0 0 168 437Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="193" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="256,422 244,426 244,418" style="fill:rgb(0,0,0)"/>
<path d="M233,422L250,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M256,437L305,437L305,407L256,407Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="422" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="517,324 513,312 521,312" style="fill:rgb(0,0,0)"/>
<path d="M451,272 L 502,272 Q 517,272 517,287 L 517,303 L 517,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,384 382,380 382,389" style="fill:rgb(0,0,0)"/>
<path d="M517,324 L 517,369 Q 517,384 502,384 L 391,384 L 376,384"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,422 142,426 142,418" style="fill:rgb(0,0,0)"/>
<path d="M371,384 L 142,384 Q 127,384 127,399 L 127,407 Q 127,422 137,422 L 147,422"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,324 122,312 131,312" style="fill:rgb(0,0,0)"/>
<path d="M127,257L127,318"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,324L127,407"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,535L212,535A15 15 0 0 0 227 520A15 15 0 0 0 212 505L168,505A15 15 0 0 0 153 520A15 15 0 0 0 168 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">GROUP</text>
<polygon points="250,520 238,525 238,516" style="fill:rgb(0,0,0)"/>
<path d="M227,520L244,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M265,535L269,535A15 15 0 0 0 284 520A15 15 0 0 0 269 505L265,505A15 15 0 0 0 250 520A15 15 0 0 0 265 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="267" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="320,520 309,525 309,516" style="fill:rgb(0,0,0)"/>
<path d="M284,520L314,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M320,535L369,535L369,505L320,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="452,520 441,525 441,516" style="fill:rgb(0,0,0)"/>
<path d="M369,520L446,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M467,535L520,535A15 15 0 0 0 535 520A15 15 0 0 0 520 505L467,505A15 15 0 0 0 452 520A15 15 0 0 0 467 535Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="493" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">HAVING</text>
<polygon points="558,520 546,525 546,516" style="fill:rgb(0,0,0)"/>
<path d="M535,520L552,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,535L607,535L607,505L558,505Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="582" y="520" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M345,573A15 15 0 0 0 360 558A15 15 0 0 0 345 543A15 15 0 0 0 330 558A15 15 0 0 0 345 573Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="345" y="558" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="360,558 371,554 371,562" style="fill:rgb(0,0,0)"/>
<path d="M369,520 L 377,520 Q 384,520 384,535 L 384,543 Q 384,558 375,558 L 366,558"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,558 L 309,558 Q 294,558 294,543 L 294,535 Q 294,520 301,520 L 309,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="514,551 503,555 503,546" style="fill:rgb(0,0,0)"/>
<path d="M411,520 L 418,520 Q 426,520 426,535 L 426,536 Q 426,551 441,551 L 493,551 L 508,551"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M514,551 L 607,551 Q 622,551 622,536 L 622,535 Q 622,520 630,520 L 637,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="267,490 256,494 256,486" style="fill:rgb(0,0,0)"/>
<path d="M127,460 L 127,475 Q 127,490 142,490 L 246,490 L 261,490"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="411,520 399,525 399,516" style="fill:rgb(0,0,0)"/>
<path d="M267,490 L 369,490 Q 384,490 384,505 L 384,505 Q 384,520 395,520 L 405,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="233,460 244,455 244,464" style="fill:rgb(0,0,0)"/>
<path d="M305,422 L 313,422 Q 320,422 320,437 L 320,445 Q 320,460 305,460 L 254,460 L 239,460"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,520 142,525 142,516" style="fill:rgb(0,0,0)"/>
<path d="M233,460 L 142,460 Q 127,460 127,475 L 127,505 Q 127,520 137,520 L 147,520"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,447 122,435 131,435" style="fill:rgb(0,0,0)"/>
<path d="M127,407L127,441"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,447L127,505"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,649L232,649A15 15 0 0 0 247 634A15 15 0 0 0 232 619L168,619A15 15 0 0 0 153 634A15 15 0 0 0 168 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="200" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WINDOW</text>
<polygon points="283,634 271,638 271,629" style="fill:rgb(0,0,0)"/>
<path d="M247,634L277,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,649L395,649A15 15 0 0 0 410 634A15 15 0 0 0 395 619L298,619A15 15 0 0 0 283 634A15 15 0 0 0 298 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="346" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="433,634 422,638 422,629" style="fill:rgb(0,0,0)"/>
<path d="M410,634L427,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M448,649L452,649A15 15 0 0 0 467 634A15 15 0 0 0 452 619L448,619A15 15 0 0 0 433 634A15 15 0 0 0 448 649Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="450" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="490,634 479,638 479,629" style="fill:rgb(0,0,0)"/>
<path d="M467,634L485,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,649L609,649L609,619L490,619Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="550" y="634" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M446,687A15 15 0 0 0 461 671A15 15 0 0 0 446 656A15 15 0 0 0 431 671A15 15 0 0 0 446 687Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="446" y="671" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="461,671 472,667 472,676" style="fill:rgb(0,0,0)"/>
<path d="M609,634 L 616,634 Q 624,634 624,649 L 624,656 Q 624,671 609,671 L 482,671 L 467,671"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M431,671 L 271,671 Q 256,671 256,656 L 256,649 Q 256,634 264,634 L 271,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="624,692 619,680 628,680" style="fill:rgb(0,0,0)"/>
<path d="M624,656L624,686"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="652,558 648,547 656,547" style="fill:rgb(0,0,0)"/>
<path d="M607,520 L 637,520 Q 652,520 652,535 L 652,537 L 652,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,596 382,592 382,600" style="fill:rgb(0,0,0)"/>
<path d="M652,558 L 652,581 Q 652,596 637,596 L 391,596 L 376,596"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,634 142,638 142,629" style="fill:rgb(0,0,0)"/>
<path d="M371,596 L 142,596 Q 127,596 127,611 L 127,619 Q 127,634 137,634 L 147,634"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,558 122,547 131,547" style="fill:rgb(0,0,0)"/>
<path d="M127,505L127,552"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="371,709 359,714 359,705" style="fill:rgb(0,0,0)"/>
<path d="M127,558 L 127,694 Q 127,709 142,709 L 350,709 L 365,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="609,709 597,714 597,705" style="fill:rgb(0,0,0)"/>
<path d="M371,709L603,709"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,709 L 616,709 Q 624,709 624,717 L 624,724"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M142,800L194,800A15 15 0 0 0 209 785A15 15 0 0 0 194 770L142,770A15 15 0 0 0 127 785A15 15 0 0 0 142 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="168" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VALUES</text>
<polygon points="245,785 234,789 234,781" style="fill:rgb(0,0,0)"/>
<path d="M209,785L239,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M260,800A15 15 0 0 0 275 785A15 15 0 0 0 260 770A15 15 0 0 0 245 785A15 15 0 0 0 260 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="311,785 300,789 300,781" style="fill:rgb(0,0,0)"/>
<path d="M275,785L306,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M311,800L361,800L361,770L311,770Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="785" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="397,785 385,789 385,781" style="fill:rgb(0,0,0)"/>
<path d="M361,785L391,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M412,800A15 15 0 0 0 427 785A15 15 0 0 0 412 770A15 15 0 0 0 397 785A15 15 0 0 0 412 800Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="412" y="785" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="609,785 597,789 597,781" style="fill:rgb(0,0,0)"/>
<path d="M427,785L603,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M609,785 L 616,785 Q 624,785 624,792 L 624,800"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,762A15 15 0 0 0 351 747A15 15 0 0 0 336 732A15 15 0 0 0 321 747A15 15 0 0 0 336 762Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="747" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M336,838A15 15 0 0 0 351 823A15 15 0 0 0 336 808A15 15 0 0 0 321 823A15 15 0 0 0 336 838Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="823" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="351,747 363,743 363,751" style="fill:rgb(0,0,0)"/>
<path d="M361,785 L 368,785 Q 376,785 376,770 L 376,762 Q 376,747 366,747 L 357,747"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,747 L 300,747 Q 285,747 285,762 L 285,770 Q 285,785 292,785 L 300,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="351,823 363,818 363,827" style="fill:rgb(0,0,0)"/>
<path d="M427,785 L 434,785 Q 442,785 442,800 L 442,808 Q 442,823 427,823 L 372,823 L 357,823"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M321,823 L 234,823 Q 219,823 219,808 L 219,800 Q 219,785 226,785 L 234,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,785 115,789 115,781" style="fill:rgb(0,0,0)"/>
<path d="M55,129 L 62,129 Q 70,129 70,144 L 70,770 Q 70,785 85,785 L 106,785 L 121,785"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,891L424,891L424,860L248,860Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="336" y="876" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">compound-operator</text>
<polygon points="424,876 436,871 436,880" style="fill:rgb(0,0,0)"/>
<path d="M624,692 L 624,861 Q 624,876 609,876 L 445,876 L 430,876"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="6,197 10,208 2,208" style="fill:rgb(0,0,0)"/>
<path d="M248,876 L 21,876 Q 6,876 6,861 L 6,217 L 6,202"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M6,197 L 6,144 Q 6,129 21,129 L 40,129 L 55,129"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="667" y="275" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" transform="rotate(-90 667,285)" dominant-baseline="central">select-core</text>
<path d="M168,966L213,966A15 15 0 0 0 228 951A15 15 0 0 0 213 936L168,936A15 15 0 0 0 153 951A15 15 0 0 0 168 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="251,951 239,956 239,947" style="fill:rgb(0,0,0)"/>
<path d="M228,951L245,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,966L270,966A15 15 0 0 0 285 951A15 15 0 0 0 270 936L266,936A15 15 0 0 0 251 951A15 15 0 0 0 266 966Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M168,1072L202,1072A15 15 0 0 0 217 1057A15 15 0 0 0 202 1042L168,1042A15 15 0 0 0 153 1057A15 15 0 0 0 168 1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="240,1057 228,1061 228,1053" style="fill:rgb(0,0,0)"/>
<path d="M217,1057L234,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,1072L289,1072L289,1042L240,1042Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="264" y="1057" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="330,951 319,956 319,947" style="fill:rgb(0,0,0)"/>
<path d="M285,951L324,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M330,966L460,966L460,936L330,936Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="951" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M395,1004A15 15 0 0 0 410 989A15 15 0 0 0 395 974A15 15 0 0 0 380 989A15 15 0 0 0 395 1004Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="395" y="989" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="410,989 422,985 422,993" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 468,951 Q 475,951 475,966 L 475,974 Q 475,989 460,989 L 431,989 L 416,989"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M380,989 L 322,989 Q 307,989 307,974 L 307,966 Q 307,951 313,951 L 319,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,913 348,909 348,918" style="fill:rgb(0,0,0)"/>
<path d="M624,860 L 624,898 Q 624,913 609,913 L 357,913 L 342,913"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,951 142,956 142,947" style="fill:rgb(0,0,0)"/>
<path d="M336,913 L 142,913 Q 127,913 127,928 L 127,936 Q 127,951 137,951 L 147,951"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="496,981 492,970 500,970" style="fill:rgb(0,0,0)"/>
<path d="M460,951 L 481,951 Q 496,951 496,963 L 496,976"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,1023 318,1019 318,1027" style="fill:rgb(0,0,0)"/>
<path d="M496,981 L 496,1008 Q 496,1023 481,1023 L 327,1023 L 312,1023"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="153,1057 142,1061 142,1053" style="fill:rgb(0,0,0)"/>
<path d="M307,1023 L 142,1023 Q 127,1023 127,1038 L 127,1042 Q 127,1057 137,1057 L 147,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="127,989 122,978 131,978" style="fill:rgb(0,0,0)"/>
<path d="M127,936L127,983"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M127,989L127,1042"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1102L415,1102A15 15 0 0 0 430 1087A15 15 0 0 0 415 1072L363,1072A15 15 0 0 0 348 1087A15 15 0 0 0 363 1102Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="389" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="453,1087 441,1092 441,1083" style="fill:rgb(0,0,0)"/>
<path d="M430,1087L447,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M453,1102L502,1102L502,1072L453,1072Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="1087" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="525,1087 513,1092 513,1083" style="fill:rgb(0,0,0)"/>
<path d="M502,1087L519,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M363,1140A15 15 0 0 0 378 1125A15 15 0 0 0 363 1110A15 15 0 0 0 348 1125A15 15 0 0 0 363 1140Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="363" y="1125" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="401,1125 390,1129 390,1121" style="fill:rgb(0,0,0)"/>
<path d="M378,1125L396,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M401,1140L451,1140L451,1110L401,1110Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="1125" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="312,1057 301,1061 301,1053" style="fill:rgb(0,0,0)"/>
<path d="M289,1057L306,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1125 337,1129 337,1121" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1110 Q 327,1125 335,1125 L 342,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="348,1087 337,1092 337,1083" style="fill:rgb(0,0,0)"/>
<path d="M312,1057 L 320,1057 Q 327,1057 327,1072 L 327,1072 Q 327,1087 335,1087 L 342,1087"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1057 513,1061 513,1053" style="fill:rgb(0,0,0)"/>
<path d="M312,1057L519,1057"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="620,1155 609,1160 609,1151" style="fill:rgb(0,0,0)"/>
<path d="M525,1057 L 546,1057 Q 561,1057 561,1072 L 561,1140 Q 561,1155 576,1155 L 599,1155 L 614,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="624" cy="1155" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1087 L 546,1087 Q 561,1087 561,1095 L 561,1102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1125 513,1129 513,1121" style="fill:rgb(0,0,0)"/>
<path d="M451,1125L519,1125"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1125 L 546,1125 Q 561,1125 561,1133 L 561,1140"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="525,1155 513,1160 513,1151" style="fill:rgb(0,0,0)"/>
<path d="M127,1042 L 127,1140 Q 127,1155 142,1155 L 504,1155 L 519,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M525,1155L597,1155"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#common-table-expression">common-table-expression</a>&nbsp;&nbsp; <a href="#create-table-stmt">create-table-stmt</a>&nbsp;&nbsp; <a href="#create-trigger-stmt">create-trigger-stmt</a>&nbsp;&nbsp; <a href="#create-view-stmt">create-view-stmt</a>&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#insert-stmt">insert-stmt</a>&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a>&nbsp;&nbsp; <a href="#table-or-subquery">table-or-subquery</a>&nbsp;&nbsp; <a href="#with-clause">with-clause</a><br></br>
References:&nbsp;&nbsp; <a href="#common-table-expression">common-table-expression</a>&nbsp;&nbsp; <a href="#compound-operator">compound-operator</a>&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#join-clause">join-clause</a>&nbsp;&nbsp; <a href="#ordering-term">ordering-term</a>&nbsp;&nbsp; <a href="#result-column">result-column</a>&nbsp;&nbsp; <a href="#table-or-subquery">table-or-subquery</a>&nbsp;&nbsp; <a href="#window-defn">window-defn</a><br></br>
See also:&nbsp;&nbsp; <a href="changes.html#version_3_35_3">changes.html#version_3_35_3</a>&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="lang_with.html#recursivecte">lang_with.html#recursivecte</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>&nbsp;&nbsp; <a href="releaselog/3_35_3.html">releaselog/3_35_3.html</a>&nbsp;&nbsp; <a href="releaselog/3_35_4.html">releaselog/3_35_4.html</a>&nbsp;&nbsp; <a href="releaselog/3_35_5.html">releaselog/3_35_5.html</a>
</div>

<a name="signed-number"></a><h4>signed-number:</h4><div class='imgcontainer'>
<div style="max-width:292px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 292.013 99.576">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,44 39,48 39,40" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,30 Q 24,44 34,44 L 45,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,59A15 15 0 0 0 81 44L81,44A15 15 0 0 0 66 29A15 15 0 0 0 50 44L50,44A15 15 0 0 0 66 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="44" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">+</text>
<polygon points="122,17 111,21 111,12" style="fill:rgb(0,0,0)"/>
<path d="M81,44 L 88,44 Q 96,44 96,30 Q 96,17 106,17 L 116,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M137,32L244,32A15 15 0 0 0 259 17A15 15 0 0 0 244 2L137,2A15 15 0 0 0 122 17A15 15 0 0 0 137 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="191" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">numeric-literal</text>
<polygon points="282,17 271,21 271,12" style="fill:rgb(0,0,0)"/>
<path d="M259,17L276,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="286" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,82 39,86 39,77" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,67 Q 24,82 34,82 L 45,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,97A15 15 0 0 0 81 82L81,82A15 15 0 0 0 66 67A15 15 0 0 0 50 82L50,82A15 15 0 0 0 66 97Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="82" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">-</text>
<path d="M81,82 L 88,82 Q 96,82 96,67 L 96,44 L 96,29"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="66,17 54,21 54,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L60,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,17L111,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#column-constraint">column-constraint</a>&nbsp;&nbsp; <a href="#pragma-value">pragma-value</a>&nbsp;&nbsp; <a href="#type-name">type-name</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>&nbsp;&nbsp; <a href="pragma.html#syntax">pragma.html#syntax</a>
</div>

<a name="simple-function-invocation"></a><h4>simple-function-invocation:</h4><div class='imgcontainer'>
<div style="max-width:414px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 414.49 126.792">
<circle cx="5" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,55 20,59 20,50" style="fill:rgb(0,0,0)"/>
<path d="M9,55L26,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,70L126,70A15 15 0 0 0 141 55A15 15 0 0 0 126 39L47,39A15 15 0 0 0 32 55A15 15 0 0 0 47 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="86" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">simple-func</text>
<polygon points="164,55 152,59 152,50" style="fill:rgb(0,0,0)"/>
<path d="M141,55L158,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,70A15 15 0 0 0 194 55A15 15 0 0 0 179 39A15 15 0 0 0 164 55A15 15 0 0 0 179 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="179" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="248,55 237,59 237,50" style="fill:rgb(0,0,0)"/>
<path d="M194,55L242,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M248,70L297,70L297,39L248,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="273" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="351,55 340,59 340,50" style="fill:rgb(0,0,0)"/>
<path d="M297,55L346,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,70A15 15 0 0 0 382 55A15 15 0 0 0 366 39A15 15 0 0 0 351 55A15 15 0 0 0 366 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="366" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="405,55 393,59 393,50" style="fill:rgb(0,0,0)"/>
<path d="M382,55L399,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="408" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M273,32A15 15 0 0 0 288 17L288,17A15 15 0 0 0 273 2A15 15 0 0 0 258 17L258,17A15 15 0 0 0 273 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="273" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="288,17 299,12 299,21" style="fill:rgb(0,0,0)"/>
<path d="M297,55 L 305,55 Q 312,55 312,40 L 312,32 Q 312,17 303,17 L 294,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M258,17 L 237,17 Q 222,17 222,32 L 222,40 Q 222,55 229,55 L 237,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="273,82 261,86 261,77" style="fill:rgb(0,0,0)"/>
<path d="M194,55 L 202,55 Q 209,55 209,68 Q 209,82 224,82 L 252,82 L 267,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M273,82 L 310,82 Q 325,82 325,68 Q 325,55 332,55 L 340,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M273,124A15 15 0 0 0 288 109A15 15 0 0 0 273 94A15 15 0 0 0 258 109A15 15 0 0 0 273 124Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="273" y="109" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="258,109 246,113 246,105" style="fill:rgb(0,0,0)"/>
<path d="M194,55 L 202,55 Q 209,55 209,70 L 209,94 Q 209,109 224,109 L 237,109 L 252,109"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M288,109 L 310,109 Q 325,109 325,94 L 325,85 L 325,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<br></br>
References:&nbsp;&nbsp; <a href="#expr">expr</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_corefunc.html">lang_corefunc.html</a>&nbsp;&nbsp; <a href="lang_expr.html#*funcinexpr">lang_expr.html#*funcinexpr</a>
</div>

<a name="simple-select-stmt"></a><h4>simple-select-stmt:</h4><div class='imgcontainer'>
<div style="max-width:629px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 629.266 348.84">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L91,32A15 15 0 0 0 106 17A15 15 0 0 0 91 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M166,62L252,62A15 15 0 0 0 267 47A15 15 0 0 0 252 32L166,32A15 15 0 0 0 151 47A15 15 0 0 0 166 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="209,17 197,21 197,12" style="fill:rgb(0,0,0)"/>
<path d="M106,17L203,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M209,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M357,32L583,32L583,2L357,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="151,47 139,51 139,43" style="fill:rgb(0,0,0)"/>
<path d="M106,17 L 113,17 Q 121,17 121,32 L 121,32 Q 121,47 133,47 L 145,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,47 278,51 278,43" style="fill:rgb(0,0,0)"/>
<path d="M267,47L284,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,47 L 297,47 Q 305,47 305,32 L 305,32 Q 305,17 320,17 L 330,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,70A15 15 0 0 0 485 55L485,55A15 15 0 0 0 470 39A15 15 0 0 0 455 55L455,55A15 15 0 0 0 470 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="485,55 497,50 497,59" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,40 Q 598,55 583,55 L 506,55 L 491,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,55 L 349,55 Q 334,55 334,40 L 334,32 Q 334,17 340,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M45,153L148,153L148,123L45,123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="97" y="138" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-core</text>
<path d="M205,153L250,153A15 15 0 0 0 265 138A15 15 0 0 0 250 123L205,123A15 15 0 0 0 190 138A15 15 0 0 0 205 153Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="227" y="138" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="288,138 276,142 276,133" style="fill:rgb(0,0,0)"/>
<path d="M265,138L282,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M303,153L307,153A15 15 0 0 0 322 138A15 15 0 0 0 307 123L303,123A15 15 0 0 0 288 138A15 15 0 0 0 303 153Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="305" y="138" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<path d="M205,259L239,259A15 15 0 0 0 254 244A15 15 0 0 0 239 228L205,228A15 15 0 0 0 190 244A15 15 0 0 0 205 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="222" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="277,244 265,248 265,239" style="fill:rgb(0,0,0)"/>
<path d="M254,244L271,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M277,259L326,259L326,228L277,228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="301" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="45,138 33,142 33,133" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,123 Q 24,138 31,138 L 39,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="312,92 323,88 323,97" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 604,17 Q 619,17 619,32 L 619,77 Q 619,92 604,92 L 333,92 L 318,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M312,92 L 39,92 Q 24,92 24,100 L 24,107"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="367,138 356,142 356,133" style="fill:rgb(0,0,0)"/>
<path d="M322,138L361,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M367,153L497,153L497,123L367,123Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="138" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M432,191A15 15 0 0 0 447 176A15 15 0 0 0 432 160A15 15 0 0 0 417 176A15 15 0 0 0 432 191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="176" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="447,176 459,171 459,180" style="fill:rgb(0,0,0)"/>
<path d="M497,138 L 504,138 Q 512,138 512,153 L 512,161 Q 512,176 497,176 L 468,176 L 453,176"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,176 L 359,176 Q 344,176 344,161 L 344,153 Q 344,138 350,138 L 356,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="533,168 529,156 537,156" style="fill:rgb(0,0,0)"/>
<path d="M497,138 L 518,138 Q 533,138 533,150 L 533,162"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="343,210 355,205 355,214" style="fill:rgb(0,0,0)"/>
<path d="M533,168 L 533,195 Q 533,210 518,210 L 364,210 L 349,210"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,244 178,248 178,239" style="fill:rgb(0,0,0)"/>
<path d="M343,210 L 178,210 Q 163,210 163,225 L 163,229 Q 163,244 174,244 L 184,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,138 178,142 178,133" style="fill:rgb(0,0,0)"/>
<path d="M148,138L184,138"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="163,191 159,179 168,179" style="fill:rgb(0,0,0)"/>
<path d="M148,138 L 156,138 Q 163,138 163,153 L 163,170 L 163,185"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M163,191L163,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M400,289L451,289A15 15 0 0 0 466 274A15 15 0 0 0 451 259L400,259A15 15 0 0 0 385 274A15 15 0 0 0 400 289Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="426" y="274" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="490,274 478,278 478,270" style="fill:rgb(0,0,0)"/>
<path d="M466,274L484,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,289L539,289L539,259L490,259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="514" y="274" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="562,274 550,278 550,270" style="fill:rgb(0,0,0)"/>
<path d="M539,274L556,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M400,327A15 15 0 0 0 415 312A15 15 0 0 0 400 297A15 15 0 0 0 385 312A15 15 0 0 0 400 327Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="400" y="312" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="438,312 427,316 427,307" style="fill:rgb(0,0,0)"/>
<path d="M415,312L432,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M438,327L487,327L487,297L438,297Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="463" y="312" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="349,244 337,248 337,239" style="fill:rgb(0,0,0)"/>
<path d="M326,244L343,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="385,312 373,316 373,307" style="fill:rgb(0,0,0)"/>
<path d="M349,244 L 356,244 Q 364,244 364,259 L 364,297 Q 364,312 372,312 L 379,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="385,274 373,278 373,270" style="fill:rgb(0,0,0)"/>
<path d="M349,244 L 356,244 Q 364,244 364,259 L 364,259 Q 364,274 372,274 L 379,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="562,244 550,248 550,239" style="fill:rgb(0,0,0)"/>
<path d="M349,244L556,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="619,342 608,346 608,338" style="fill:rgb(0,0,0)"/>
<path d="M562,244 L 583,244 Q 598,244 598,259 L 598,327 Q 598,342 606,342 L 614,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="623" cy="342" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M562,274 L 583,274 Q 598,274 598,281 L 598,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="562,312 550,316 550,307" style="fill:rgb(0,0,0)"/>
<path d="M487,312L556,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M562,312 L 583,312 Q 598,312 598,319 L 598,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="562,342 550,346 550,338" style="fill:rgb(0,0,0)"/>
<path d="M163,228 L 163,327 Q 163,342 178,342 L 541,342 L 556,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M562,342L608,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<br></br>
References:&nbsp;&nbsp; <a href="#common-table-expression">common-table-expression</a>&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#ordering-term">ordering-term</a>&nbsp;&nbsp; <a href="#select-core">select-core</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>
</div>

<a name="sql-stmt"></a><h4>sql-stmt:</h4><div class='imgcontainer'>
<div style="max-width:716px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 716.88 1017.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,55 39,59 39,50" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,40 Q 24,55 34,55 L 45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,70L125,70A15 15 0 0 0 140 55L140,55A15 15 0 0 0 125 39L66,39A15 15 0 0 0 50 55L50,55A15 15 0 0 0 66 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="95" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXPLAIN</text>
<polygon points="176,55 165,59 165,50" style="fill:rgb(0,0,0)"/>
<path d="M140,55L170,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M191,70L235,70A15 15 0 0 0 250 55L250,55A15 15 0 0 0 235 39L191,39A15 15 0 0 0 176 55L176,55A15 15 0 0 0 191 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="213" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">QUERY</text>
<polygon points="267,55 255,59 255,50" style="fill:rgb(0,0,0)"/>
<path d="M250,55L261,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M282,70L311,70A15 15 0 0 0 327 55L327,55A15 15 0 0 0 311 39L282,39A15 15 0 0 0 267 55L267,55A15 15 0 0 0 282 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="297" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PLAN</text>
<polygon points="368,17 357,21 357,12" style="fill:rgb(0,0,0)"/>
<path d="M327,55 L 334,55 Q 342,55 342,40 L 342,32 Q 342,17 352,17 L 362,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="182,17 170,21 170,12" style="fill:rgb(0,0,0)"/>
<path d="M140,55 L 148,55 Q 155,55 155,40 L 155,32 Q 155,17 166,17 L 176,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M182,17L357,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M9,17L170,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="410,17 398,21 398,12" style="fill:rgb(0,0,0)"/>
<path d="M368,17L404,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,32L552,32L552,2L410,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="481" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">alter-table-stmt</text>
<polygon points="666,17 654,21 654,12" style="fill:rgb(0,0,0)"/>
<path d="M552,17L660,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="707,17 696,21 696,12" style="fill:rgb(0,0,0)"/>
<path d="M666,17L701,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="711" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,70L528,70L528,39L410,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">analyze-stmt</text>
<polygon points="410,55 398,59 398,50" style="fill:rgb(0,0,0)"/>
<path d="M383,39 L 383,47 Q 383,55 393,55 L 404,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,55 654,59 654,50" style="fill:rgb(0,0,0)"/>
<path d="M528,55L660,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,55 L 673,55 Q 681,55 681,47 L 681,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,108L517,108L517,77L410,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="463" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">attach-stmt</text>
<polygon points="410,92 398,97 398,88" style="fill:rgb(0,0,0)"/>
<path d="M383,77 L 383,85 Q 383,92 393,92 L 404,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,92 654,97 654,88" style="fill:rgb(0,0,0)"/>
<path d="M517,92L660,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,92 L 673,92 Q 681,92 681,85 L 681,77"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,145L511,145L511,115L410,115Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="460" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">begin-stmt</text>
<polygon points="410,130 398,135 398,126" style="fill:rgb(0,0,0)"/>
<path d="M383,115 L 383,123 Q 383,130 393,130 L 404,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,130 654,135 654,126" style="fill:rgb(0,0,0)"/>
<path d="M511,130L660,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,130 L 673,130 Q 681,130 681,123 L 681,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,183L527,183L527,153L410,153Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="468" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">commit-stmt</text>
<polygon points="410,168 398,172 398,164" style="fill:rgb(0,0,0)"/>
<path d="M383,153 L 383,160 Q 383,168 393,168 L 404,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,168 654,172 654,164" style="fill:rgb(0,0,0)"/>
<path d="M527,168L660,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,168 L 673,168 Q 681,168 681,160 L 681,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,221L569,221L569,191L410,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="489" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-index-stmt</text>
<polygon points="410,206 398,210 398,201" style="fill:rgb(0,0,0)"/>
<path d="M383,191 L 383,198 Q 383,206 393,206 L 404,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,206 654,210 654,201" style="fill:rgb(0,0,0)"/>
<path d="M569,206L660,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,206 L 673,206 Q 681,206 681,198 L 681,191"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,259L566,259L566,228L410,228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="488" y="244" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-table-stmt</text>
<polygon points="410,244 398,248 398,239" style="fill:rgb(0,0,0)"/>
<path d="M383,228 L 383,236 Q 383,244 393,244 L 404,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,244 654,248 654,239" style="fill:rgb(0,0,0)"/>
<path d="M566,244L660,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,244 L 673,244 Q 681,244 681,236 L 681,229"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,297L582,297L582,266L410,266Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="496" y="281" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-trigger-stmt</text>
<polygon points="410,281 398,286 398,277" style="fill:rgb(0,0,0)"/>
<path d="M383,266 L 383,274 Q 383,281 393,281 L 404,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,281 654,286 654,277" style="fill:rgb(0,0,0)"/>
<path d="M582,281L660,281"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,281 L 673,281 Q 681,281 681,274 L 681,266"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,334L561,334L561,304L410,304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="486" y="319" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-view-stmt</text>
<polygon points="410,319 398,324 398,315" style="fill:rgb(0,0,0)"/>
<path d="M383,304 L 383,312 Q 383,319 393,319 L 404,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,319 654,324 654,315" style="fill:rgb(0,0,0)"/>
<path d="M561,319L660,319"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,319 L 673,319 Q 681,319 681,312 L 681,304"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,372L626,372L626,342L410,342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="518" y="357" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">create-virtual-table-stmt</text>
<polygon points="410,357 398,361 398,353" style="fill:rgb(0,0,0)"/>
<path d="M383,342 L 383,349 Q 383,357 393,357 L 404,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,357 654,361 654,353" style="fill:rgb(0,0,0)"/>
<path d="M626,357L660,357"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,357 L 673,357 Q 681,357 681,349 L 681,342"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,410L516,410L516,380L410,380Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="463" y="395" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">delete-stmt</text>
<polygon points="410,395 398,399 398,390" style="fill:rgb(0,0,0)"/>
<path d="M383,380 L 383,387 Q 383,395 393,395 L 404,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,395 654,399 654,390" style="fill:rgb(0,0,0)"/>
<path d="M516,395L660,395"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,395 L 673,395 Q 681,395 681,387 L 681,380"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,448L581,448L581,417L410,417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="495" y="433" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">delete-stmt-limited</text>
<polygon points="410,433 398,437 398,428" style="fill:rgb(0,0,0)"/>
<path d="M383,417 L 383,425 Q 383,433 393,433 L 404,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,433 654,437 654,428" style="fill:rgb(0,0,0)"/>
<path d="M581,433L660,433"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,433 L 673,433 Q 681,433 681,425 L 681,418"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,486L521,486L521,455L410,455Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="465" y="470" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">detach-stmt</text>
<polygon points="410,470 398,475 398,466" style="fill:rgb(0,0,0)"/>
<path d="M383,455 L 383,463 Q 383,470 393,470 L 404,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,470 654,475 654,466" style="fill:rgb(0,0,0)"/>
<path d="M521,470L660,470"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,470 L 673,470 Q 681,470 681,463 L 681,455"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,523L555,523L555,493L410,493Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="508" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-index-stmt</text>
<polygon points="410,508 398,513 398,504" style="fill:rgb(0,0,0)"/>
<path d="M383,493 L 383,501 Q 383,508 393,508 L 404,508"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,508 654,513 654,504" style="fill:rgb(0,0,0)"/>
<path d="M555,508L660,508"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,508 L 673,508 Q 681,508 681,501 L 681,493"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,561L551,561L551,531L410,531Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="480" y="546" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-table-stmt</text>
<polygon points="410,546 398,550 398,542" style="fill:rgb(0,0,0)"/>
<path d="M383,531 L 383,538 Q 383,546 393,546 L 404,546"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,546 654,550 654,542" style="fill:rgb(0,0,0)"/>
<path d="M551,546L660,546"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,546 L 673,546 Q 681,546 681,538 L 681,531"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,599L568,599L568,569L410,569Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="489" y="584" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-trigger-stmt</text>
<polygon points="410,584 398,588 398,579" style="fill:rgb(0,0,0)"/>
<path d="M383,569 L 383,576 Q 383,584 393,584 L 404,584"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,584 654,588 654,579" style="fill:rgb(0,0,0)"/>
<path d="M568,584L660,584"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,584 L 673,584 Q 681,584 681,576 L 681,569"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,637L547,637L547,606L410,606Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="622" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">drop-view-stmt</text>
<polygon points="410,622 398,626 398,617" style="fill:rgb(0,0,0)"/>
<path d="M383,606 L 383,614 Q 383,622 393,622 L 404,622"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,622 654,626 654,617" style="fill:rgb(0,0,0)"/>
<path d="M547,622L660,622"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,622 L 673,622 Q 681,622 681,614 L 681,607"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,675L513,675L513,644L410,644Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="461" y="659" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">insert-stmt</text>
<polygon points="410,659 398,664 398,655" style="fill:rgb(0,0,0)"/>
<path d="M383,644 L 383,652 Q 383,659 393,659 L 404,659"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,659 654,664 654,655" style="fill:rgb(0,0,0)"/>
<path d="M513,659L660,659"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,659 L 673,659 Q 681,659 681,652 L 681,644"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,712L529,712L529,682L410,682Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="697" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">pragma-stmt</text>
<polygon points="410,697 398,702 398,693" style="fill:rgb(0,0,0)"/>
<path d="M383,682 L 383,690 Q 383,697 393,697 L 404,697"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,697 654,702 654,693" style="fill:rgb(0,0,0)"/>
<path d="M529,697L660,697"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,697 L 673,697 Q 681,697 681,690 L 681,682"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,750L528,750L528,720L410,720Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="735" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">reindex-stmt</text>
<polygon points="410,735 398,739 398,731" style="fill:rgb(0,0,0)"/>
<path d="M383,720 L 383,727 Q 383,735 393,735 L 404,735"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,735 654,739 654,731" style="fill:rgb(0,0,0)"/>
<path d="M528,735L660,735"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,735 L 673,735 Q 681,735 681,727 L 681,720"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,788L526,788L526,758L410,758Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="468" y="773" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">release-stmt</text>
<polygon points="410,773 398,777 398,768" style="fill:rgb(0,0,0)"/>
<path d="M383,758 L 383,765 Q 383,773 393,773 L 404,773"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,773 654,777 654,768" style="fill:rgb(0,0,0)"/>
<path d="M526,773L660,773"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,773 L 673,773 Q 681,773 681,765 L 681,758"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,826L533,826L533,795L410,795Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="471" y="811" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">rollback-stmt</text>
<polygon points="410,811 398,815 398,806" style="fill:rgb(0,0,0)"/>
<path d="M383,795 L 383,803 Q 383,811 393,811 L 404,811"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,811 654,815 654,806" style="fill:rgb(0,0,0)"/>
<path d="M533,811L660,811"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,811 L 673,811 Q 681,811 681,803 L 681,796"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,864L545,864L545,833L410,833Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="477" y="848" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">savepoint-stmt</text>
<polygon points="410,848 398,853 398,844" style="fill:rgb(0,0,0)"/>
<path d="M383,833 L 383,841 Q 383,848 393,848 L 404,848"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,848 654,853 654,844" style="fill:rgb(0,0,0)"/>
<path d="M545,848L660,848"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,848 L 673,848 Q 681,848 681,841 L 681,833"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,901L514,901L514,871L410,871Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="462" y="886" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="410,886 398,891 398,882" style="fill:rgb(0,0,0)"/>
<path d="M383,871 L 383,879 Q 383,886 393,886 L 404,886"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,886 654,891 654,882" style="fill:rgb(0,0,0)"/>
<path d="M514,886L660,886"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,886 L 673,886 Q 681,886 681,879 L 681,871"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,939L522,939L522,909L410,909Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="466" y="924" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">update-stmt</text>
<polygon points="410,924 398,928 398,920" style="fill:rgb(0,0,0)"/>
<path d="M383,909 L 383,916 Q 383,924 393,924 L 404,924"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,924 654,928 654,920" style="fill:rgb(0,0,0)"/>
<path d="M522,924L660,924"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,924 L 673,924 Q 681,924 681,916 L 681,909"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,977L587,977L587,947L410,947Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="498" y="962" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">update-stmt-limited</text>
<polygon points="410,962 398,966 398,957" style="fill:rgb(0,0,0)"/>
<path d="M383,947 L 383,954 Q 383,962 393,962 L 404,962"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,962 654,966 654,957" style="fill:rgb(0,0,0)"/>
<path d="M587,962L660,962"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,962 L 673,962 Q 681,962 681,954 L 681,947"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M410,1015L529,1015L529,984L410,984Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="469" y="1000" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">vacuum-stmt</text>
<polygon points="410,1000 398,1004 398,995" style="fill:rgb(0,0,0)"/>
<path d="M368,17 L 376,17 Q 383,17 383,32 L 383,985 Q 383,1000 393,1000 L 404,1000"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="666,1000 654,1004 654,995" style="fill:rgb(0,0,0)"/>
<path d="M529,1000L660,1000"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M666,1000 L 673,1000 Q 681,1000 681,985 L 681,32 Q 681,17 688,17 L 696,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt-list">sql-stmt-list</a><br></br>
References:&nbsp;&nbsp; <a href="#alter-table-stmt">alter-table-stmt</a>&nbsp;&nbsp; <a href="#analyze-stmt">analyze-stmt</a>&nbsp;&nbsp; <a href="#attach-stmt">attach-stmt</a>&nbsp;&nbsp; <a href="#begin-stmt">begin-stmt</a>&nbsp;&nbsp; <a href="#commit-stmt">commit-stmt</a>&nbsp;&nbsp; <a href="#create-index-stmt">create-index-stmt</a>&nbsp;&nbsp; <a href="#create-table-stmt">create-table-stmt</a>&nbsp;&nbsp; <a href="#create-trigger-stmt">create-trigger-stmt</a>&nbsp;&nbsp; <a href="#create-view-stmt">create-view-stmt</a>&nbsp;&nbsp; <a href="#create-virtual-table-stmt">create-virtual-table-stmt</a>&nbsp;&nbsp; <a href="#delete-stmt">delete-stmt</a>&nbsp;&nbsp; <a href="#delete-stmt-limited">delete-stmt-limited</a>&nbsp;&nbsp; <a href="#detach-stmt">detach-stmt</a>&nbsp;&nbsp; <a href="#drop-index-stmt">drop-index-stmt</a>&nbsp;&nbsp; <a href="#drop-table-stmt">drop-table-stmt</a>&nbsp;&nbsp; <a href="#drop-trigger-stmt">drop-trigger-stmt</a>&nbsp;&nbsp; <a href="#drop-view-stmt">drop-view-stmt</a>&nbsp;&nbsp; <a href="#insert-stmt">insert-stmt</a>&nbsp;&nbsp; <a href="#pragma-stmt">pragma-stmt</a>&nbsp;&nbsp; <a href="#reindex-stmt">reindex-stmt</a>&nbsp;&nbsp; <a href="#release-stmt">release-stmt</a>&nbsp;&nbsp; <a href="#rollback-stmt">rollback-stmt</a>&nbsp;&nbsp; <a href="#savepoint-stmt">savepoint-stmt</a>&nbsp;&nbsp; <a href="#select-stmt">select-stmt</a>&nbsp;&nbsp; <a href="#update-stmt">update-stmt</a>&nbsp;&nbsp; <a href="#update-stmt-limited">update-stmt-limited</a>&nbsp;&nbsp; <a href="#vacuum-stmt">vacuum-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang.html">lang.html</a>&nbsp;&nbsp; <a href="lang_explain.html">lang_explain.html</a>
</div>

<a name="sql-stmt-list"></a><h4>sql-stmt-list:</h4><div class='imgcontainer'>
<div style="max-width:242px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 242.093 88.776">
<circle cx="5" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M9,55L45,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="81,55 69,59 69,50" style="fill:rgb(0,0,0)"/>
<path d="M45,55L75,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M81,70L160,70L160,39L81,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="121" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">sql-stmt</text>
<path d="M160,55L196,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="232,55 221,59 221,50" style="fill:rgb(0,0,0)"/>
<path d="M196,55L226,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="236" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="121,82 109,86 109,77" style="fill:rgb(0,0,0)"/>
<path d="M45,55 L 52,55 Q 60,55 60,68 Q 60,82 75,82 L 100,82 L 115,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,82 L 155,82 Q 170,82 170,68 Q 170,55 177,55 L 185,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M121,32A15 15 0 0 0 136 17L136,17A15 15 0 0 0 121 2A15 15 0 0 0 105 17L105,17A15 15 0 0 0 121 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="121" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">;</text>
<polygon points="136,17 147,12 147,21" style="fill:rgb(0,0,0)"/>
<path d="M196,55 L 204,55 Q 211,55 211,40 L 211,32 Q 211,17 196,17 L 156,17 L 141,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M105,17 L 33,17 Q 18,17 18,32 L 18,40 Q 18,55 26,55 L 33,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<br></br>
References:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang.html">lang.html</a>
</div>

<a name="table-constraint"></a><h4>table-constraint:</h4><div class='imgcontainer'>
<div style="max-width:751px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 751.325 261.36">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L160,32A15 15 0 0 0 175 17A15 15 0 0 0 160 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="110" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONSTRAINT</text>
<polygon points="198,17 187,21 187,12" style="fill:rgb(0,0,0)"/>
<path d="M175,17L192,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M213,32L240,32A15 15 0 0 0 256 17A15 15 0 0 0 240 2L213,2A15 15 0 0 0 198 17A15 15 0 0 0 213 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="227" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<path d="M60,108L123,108A15 15 0 0 0 138 92A15 15 0 0 0 123 77L60,77A15 15 0 0 0 45 92A15 15 0 0 0 60 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="91" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PRIMARY</text>
<polygon points="161,92 149,97 149,88" style="fill:rgb(0,0,0)"/>
<path d="M138,92L155,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M176,108L192,108A15 15 0 0 0 208 92A15 15 0 0 0 192 77L176,77A15 15 0 0 0 161 92A15 15 0 0 0 176 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="184" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">KEY</text>
<polygon points="244,92 232,97 232,88" style="fill:rgb(0,0,0)"/>
<path d="M208,92L238,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M259,108A15 15 0 0 0 274 92A15 15 0 0 0 259 77A15 15 0 0 0 244 92A15 15 0 0 0 259 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="259" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="310,92 298,97 298,88" style="fill:rgb(0,0,0)"/>
<path d="M274,92L304,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M310,108L454,108L454,77L310,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">indexed-column</text>
<polygon points="490,92 479,97 479,88" style="fill:rgb(0,0,0)"/>
<path d="M454,92L485,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M505,108A15 15 0 0 0 521 92A15 15 0 0 0 505 77A15 15 0 0 0 490 92A15 15 0 0 0 505 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="505" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="544,92 532,97 532,88" style="fill:rgb(0,0,0)"/>
<path d="M521,92L538,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M544,108L677,108L677,77L544,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="610" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">conflict-clause</text>
<polygon points="700,92 688,97 688,88" style="fill:rgb(0,0,0)"/>
<path d="M677,92L694,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="741,92 730,97 730,88" style="fill:rgb(0,0,0)"/>
<path d="M700,92L736,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="745" cy="92" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,92 33,97 33,88" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,77 Q 24,92 31,92 L 39,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="110,55 122,50 122,59" style="fill:rgb(0,0,0)"/>
<path d="M256,17 L 263,17 Q 271,17 271,32 L 271,40 Q 271,55 256,55 L 131,55 L 116,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M110,55 L 39,55 Q 24,55 24,62 L 24,70"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,145A15 15 0 0 0 397 130A15 15 0 0 0 382 115A15 15 0 0 0 367 130A15 15 0 0 0 382 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="130" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="397,130 409,126 409,135" style="fill:rgb(0,0,0)"/>
<path d="M454,92 L 462,92 Q 469,92 469,107 L 469,115 Q 469,130 454,130 L 418,130 L 403,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M367,130 L 298,130 Q 283,130 283,115 L 283,107 Q 283,92 291,92 L 298,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,145L115,145A15 15 0 0 0 130 130A15 15 0 0 0 115 115L60,115A15 15 0 0 0 45 130A15 15 0 0 0 60 145Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="130" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UNIQUE</text>
<path d="M130,130 L 208,130 Q 223,130 223,115 L 223,107 Q 223,92 230,92 L 238,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,130 33,135 33,126" style="fill:rgb(0,0,0)"/>
<path d="M24,77 L 24,115 Q 24,130 31,130 L 39,130"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,183L105,183A15 15 0 0 0 121 168A15 15 0 0 0 105 153L60,153A15 15 0 0 0 45 168A15 15 0 0 0 60 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CHECK</text>
<polygon points="144,168 132,172 132,164" style="fill:rgb(0,0,0)"/>
<path d="M121,168L138,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M159,183A15 15 0 0 0 174 168A15 15 0 0 0 159 153A15 15 0 0 0 144 168A15 15 0 0 0 159 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="168" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="197,168 185,172 185,164" style="fill:rgb(0,0,0)"/>
<path d="M174,168L191,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,183L246,183L246,153L197,153Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="221" y="168" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="269,168 258,172 258,164" style="fill:rgb(0,0,0)"/>
<path d="M246,168L263,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M284,183L284,183A15 15 0 0 0 299 168A15 15 0 0 0 284 153L284,153A15 15 0 0 0 269 168A15 15 0 0 0 284 183Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="284" y="168" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="700,168 688,172 688,164" style="fill:rgb(0,0,0)"/>
<path d="M299,168L694,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M700,168 L 707,168 Q 715,168 715,153 L 715,107 Q 715,92 722,92 L 730,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,168 33,172 33,164" style="fill:rgb(0,0,0)"/>
<path d="M24,115 L 24,153 Q 24,168 31,168 L 39,168"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,221L123,221A15 15 0 0 0 139 206A15 15 0 0 0 123 191L60,191A15 15 0 0 0 45 206A15 15 0 0 0 60 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="92" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FOREIGN</text>
<polygon points="162,206 150,210 150,201" style="fill:rgb(0,0,0)"/>
<path d="M139,206L156,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M177,221L193,221A15 15 0 0 0 208 206A15 15 0 0 0 193 191L177,191A15 15 0 0 0 162 206A15 15 0 0 0 177 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="185" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">KEY</text>
<polygon points="231,206 220,210 220,201" style="fill:rgb(0,0,0)"/>
<path d="M208,206L225,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,221A15 15 0 0 0 261 206A15 15 0 0 0 246 191A15 15 0 0 0 231 206A15 15 0 0 0 246 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="206" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="297,206 286,210 286,201" style="fill:rgb(0,0,0)"/>
<path d="M261,206L292,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M313,221L407,221A15 15 0 0 0 422 206A15 15 0 0 0 407 191L313,191A15 15 0 0 0 297 206A15 15 0 0 0 313 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<polygon points="458,206 446,210 446,201" style="fill:rgb(0,0,0)"/>
<path d="M422,206L452,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M473,221A15 15 0 0 0 488 206A15 15 0 0 0 473 191A15 15 0 0 0 458 206A15 15 0 0 0 473 221Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="473" y="206" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="511,206 500,210 500,201" style="fill:rgb(0,0,0)"/>
<path d="M488,206L505,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M511,221L677,221L677,191L511,191Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="594" y="206" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">foreign-key-clause</text>
<polygon points="700,206 688,210 688,201" style="fill:rgb(0,0,0)"/>
<path d="M677,206L694,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M700,206 L 707,206 Q 715,206 715,191 L 715,168 L 715,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,206 33,210 33,201" style="fill:rgb(0,0,0)"/>
<path d="M24,153 L 24,191 Q 24,206 31,206 L 39,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M360,259A15 15 0 0 0 375 244A15 15 0 0 0 360 228A15 15 0 0 0 345 244A15 15 0 0 0 360 259Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="360" y="244" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="375,244 386,239 386,248" style="fill:rgb(0,0,0)"/>
<path d="M422,206 L 429,206 Q 437,206 437,221 L 437,229 Q 437,244 422,244 L 396,244 L 381,244"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M345,244 L 286,244 Q 271,244 271,229 L 271,221 Q 271,206 278,206 L 286,206"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#create-table-stmt">create-table-stmt</a><br></br>
References:&nbsp;&nbsp; <a href="#conflict-clause">conflict-clause</a>&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#foreign-key-clause">foreign-key-clause</a>&nbsp;&nbsp; <a href="#indexed-column">indexed-column</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtable.html#primkeyconst">lang_createtable.html#primkeyconst</a>&nbsp;&nbsp; <a href="lang_createtable.html#tablecoldef">lang_createtable.html#tablecoldef</a>&nbsp;&nbsp; <a href="lang_createtable.html#uniqueconst">lang_createtable.html#uniqueconst</a>
</div>

<a name="table-options"></a><h4>table-options:</h4><div class='imgcontainer'>
<div style="max-width:324px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 324.036 98.31">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="77,17 66,21 66,12" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 40,36 Q 55,36 55,26 Q 55,17 63,17 L 72,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,32L161,32A15 15 0 0 0 177 17A15 15 0 0 0 161 2L93,2A15 15 0 0 0 77 17A15 15 0 0 0 93 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="127" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITHOUT</text>
<polygon points="194,17 182,21 182,12" style="fill:rgb(0,0,0)"/>
<path d="M177,17L188,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,32L253,32A15 15 0 0 0 268 17A15 15 0 0 0 253 2L209,2A15 15 0 0 0 194 17A15 15 0 0 0 209 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROWID</text>
<path d="M268,17 L 274,17 Q 280,17 280,26 Q 280,36 295,36 L 299,36 L 314,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="318" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="77,54 66,59 66,50" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 40,36 Q 55,36 55,45 Q 55,54 63,54 L 72,54"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,69L139,69A15 15 0 0 0 154 54A15 15 0 0 0 139 39L93,39A15 15 0 0 0 77 54A15 15 0 0 0 93 69Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="116" y="54" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">STRICT</text>
<polygon points="314,36 303,40 303,31" style="fill:rgb(0,0,0)"/>
<path d="M154,54 L 253,54 Q 268,54 274,54 Q 280,54 280,45 Q 280,36 294,36 L 308,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="194,81 205,76 205,85" style="fill:rgb(0,0,0)"/>
<path d="M285,36 L 293,36 Q 300,36 300,51 L 300,66 Q 300,81 285,81 L 215,81 L 200,81"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M179,96A15 15 0 0 0 194 81A15 15 0 0 0 179 65A15 15 0 0 0 164 81A15 15 0 0 0 179 96Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="179" y="81" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="77,81 89,76 89,85" style="fill:rgb(0,0,0)"/>
<path d="M164,81L83,81"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M77,81 L 31,81 Q 16,81 16,66 L 16,51 Q 16,36 28,36 L 39,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#create-table-stmt">create-table-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>
</div>

<a name="table-or-subquery"></a><h4>table-or-subquery:</h4><div class='imgcontainer'>
<div style="max-width:720px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 720.778 457.704">
<circle cx="5" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,74 39,78 39,70" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,59 Q 24,74 34,74 L 45,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,89L162,89A15 15 0 0 0 177 74L177,74A15 15 0 0 0 162 59L66,59A15 15 0 0 0 50 74L50,74A15 15 0 0 0 66 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="114" y="74" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="194,74 183,78 183,70" style="fill:rgb(0,0,0)"/>
<path d="M177,74L189,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M209,89A15 15 0 0 0 225 74L225,74A15 15 0 0 0 209 59A15 15 0 0 0 194 74L194,74A15 15 0 0 0 209 89Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="74" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="266,36 255,41 255,32" style="fill:rgb(0,0,0)"/>
<path d="M225,74 L 232,74 Q 240,74 240,59 L 240,51 Q 240,36 250,36 L 260,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,51L356,51A15 15 0 0 0 371 36A15 15 0 0 0 356 21L281,21A15 15 0 0 0 266 36A15 15 0 0 0 281 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<polygon points="407,36 396,41 396,32" style="fill:rgb(0,0,0)"/>
<path d="M371,36L402,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M423,51L427,51A15 15 0 0 0 442 36A15 15 0 0 0 427 21L423,21A15 15 0 0 0 407 36A15 15 0 0 0 423 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="425" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="478,36 466,41 466,32" style="fill:rgb(0,0,0)"/>
<path d="M442,36L472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M493,51L561,51A15 15 0 0 0 577 36A15 15 0 0 0 561 21L493,21A15 15 0 0 0 478 36A15 15 0 0 0 493 51Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="527" y="36" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<path d="M9,36L255,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="422,6 411,10 411,2" style="fill:rgb(0,0,0)"/>
<path d="M371,36 L 379,36 Q 386,36 386,21 L 386,21 Q 386,6 401,6 L 402,6 L 417,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 442,6 Q 457,6 457,21 L 457,21 Q 457,36 464,36 L 472,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M422,6 L 577,6 Q 592,6 592,21 L 592,21 Q 592,36 599,36 L 607,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,127L388,127A15 15 0 0 0 403 112A15 15 0 0 0 388 97L323,97A15 15 0 0 0 308 112A15 15 0 0 0 323 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="426,112 415,116 415,108" style="fill:rgb(0,0,0)"/>
<path d="M403,112L420,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M441,127L445,127A15 15 0 0 0 460 112A15 15 0 0 0 445 97L441,97A15 15 0 0 0 426 112A15 15 0 0 0 441 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="443" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="483,112 472,116 472,108" style="fill:rgb(0,0,0)"/>
<path d="M460,112L478,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,127L577,127A15 15 0 0 0 592 112A15 15 0 0 0 577 97L499,97A15 15 0 0 0 483 112A15 15 0 0 0 499 127Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="538" y="112" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">index-name</text>
<path d="M323,165L343,165A15 15 0 0 0 359 150A15 15 0 0 0 343 135L323,135A15 15 0 0 0 308 150A15 15 0 0 0 323 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="333" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="382,150 370,154 370,145" style="fill:rgb(0,0,0)"/>
<path d="M359,150L376,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M397,165L461,165A15 15 0 0 0 476 150A15 15 0 0 0 461 135L397,135A15 15 0 0 0 382 150A15 15 0 0 0 397 165Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="429" y="150" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INDEXED</text>
<polygon points="527,74 539,70 539,78" style="fill:rgb(0,0,0)"/>
<path d="M577,36 L 607,36 Q 622,36 622,51 L 622,59 Q 622,74 607,74 L 548,74 L 533,74"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,150 297,154 297,145" style="fill:rgb(0,0,0)"/>
<path d="M527,74 L 297,74 Q 282,74 282,89 L 282,135 Q 282,150 292,150 L 302,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="308,112 297,116 297,108" style="fill:rgb(0,0,0)"/>
<path d="M282,97 L 282,104 Q 282,112 292,112 L 302,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="266,213 255,217 255,209" style="fill:rgb(0,0,0)"/>
<path d="M9,36 L 16,36 Q 24,36 24,51 L 24,198 Q 24,213 39,213 L 245,213 L 260,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M281,228L431,228A15 15 0 0 0 446 213A15 15 0 0 0 431 198L281,198A15 15 0 0 0 266 213A15 15 0 0 0 281 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="356" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-function-name</text>
<polygon points="463,213 452,217 452,209" style="fill:rgb(0,0,0)"/>
<path d="M446,213L457,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M478,228A15 15 0 0 0 493 213A15 15 0 0 0 478 198A15 15 0 0 0 463 213A15 15 0 0 0 478 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="478" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="529,213 518,217 518,209" style="fill:rgb(0,0,0)"/>
<path d="M493,213L524,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M529,228L579,228L579,198L529,198Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="213" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="615,213 603,217 603,209" style="fill:rgb(0,0,0)"/>
<path d="M579,213L609,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M630,228A15 15 0 0 0 645 213A15 15 0 0 0 630 198A15 15 0 0 0 615 213A15 15 0 0 0 630 228Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="630" y="213" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="675,187 679,198 671,198" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 660,213 Q 675,213 675,203 L 675,192"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M554,190A15 15 0 0 0 569 175A15 15 0 0 0 554 160A15 15 0 0 0 539 175A15 15 0 0 0 554 190Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="554" y="175" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="569,175 581,171 581,180" style="fill:rgb(0,0,0)"/>
<path d="M579,213 L 586,213 Q 594,213 594,198 L 594,190 Q 594,175 584,175 L 575,175"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M539,175 L 518,175 Q 503,175 503,190 L 503,198 Q 503,213 510,213 L 518,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M225,74 L 232,74 Q 240,74 240,89 L 240,198 Q 240,213 247,213 L 255,213"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,112 648,116 648,108" style="fill:rgb(0,0,0)"/>
<path d="M592,112L654,112"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,112 L 667,112 Q 675,112 675,104 L 675,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,150 648,154 648,145" style="fill:rgb(0,0,0)"/>
<path d="M476,150L654,150"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,150 L 667,150 Q 675,150 675,142 L 675,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M577,36L690,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M407,304L411,304A15 15 0 0 0 426 289A15 15 0 0 0 411 274L407,274A15 15 0 0 0 392 289A15 15 0 0 0 407 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="409" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="498,289 487,293 487,284" style="fill:rgb(0,0,0)"/>
<path d="M426,289L492,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M513,304L582,304A15 15 0 0 0 597 289A15 15 0 0 0 582 274L513,274A15 15 0 0 0 498 289A15 15 0 0 0 513 304Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="548" y="289" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-alias</text>
<polygon points="660,289 648,293 648,284" style="fill:rgb(0,0,0)"/>
<path d="M597,289L654,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,289 L 667,289 Q 675,289 675,281 L 675,274"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="548,251 559,247 559,255" style="fill:rgb(0,0,0)"/>
<path d="M645,213 L 652,213 Q 660,213 660,228 L 660,236 Q 660,251 645,251 L 568,251 L 553,251"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M548,251 L 370,251 Q 355,251 355,266 L 355,274 Q 355,289 370,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M472,251 L 464,251 Q 457,251 457,266 L 457,274 Q 457,289 464,289 L 472,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,327 39,331 39,322" style="fill:rgb(0,0,0)"/>
<path d="M24,198 L 24,312 Q 24,327 34,327 L 45,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,342A15 15 0 0 0 81 327A15 15 0 0 0 66 311A15 15 0 0 0 50 327A15 15 0 0 0 66 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,327 92,331 92,322" style="fill:rgb(0,0,0)"/>
<path d="M81,327L98,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,342L208,342L208,311L104,311Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="327" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="231,327 219,331 219,322" style="fill:rgb(0,0,0)"/>
<path d="M208,327L225,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M246,342A15 15 0 0 0 261 327A15 15 0 0 0 246 311A15 15 0 0 0 231 327A15 15 0 0 0 246 342Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="246" y="327" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="392,289 380,293 380,284" style="fill:rgb(0,0,0)"/>
<path d="M261,327 L 269,327 Q 276,327 276,312 L 276,304 Q 276,289 291,289 L 371,289 L 386,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="660,327 648,331 648,322" style="fill:rgb(0,0,0)"/>
<path d="M261,327L654,327"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M660,327 L 667,327 Q 675,327 675,319 L 675,312"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M424,327 L 432,327 Q 439,327 439,312 L 439,304 Q 439,289 447,289 L 454,289"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,364 39,369 39,360" style="fill:rgb(0,0,0)"/>
<path d="M24,311 L 24,349 Q 24,364 34,364 L 45,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,379A15 15 0 0 0 81 364A15 15 0 0 0 65 349A15 15 0 0 0 50 364A15 15 0 0 0 65 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="65" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="135,364 123,369 123,360" style="fill:rgb(0,0,0)"/>
<path d="M81,364L129,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M135,379L296,379L296,349L135,349Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="364" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<polygon points="350,364 338,369 338,360" style="fill:rgb(0,0,0)"/>
<path d="M296,364L344,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,379A15 15 0 0 0 380 364A15 15 0 0 0 365 349A15 15 0 0 0 350 364A15 15 0 0 0 365 379Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="364" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="660,364 648,369 648,360" style="fill:rgb(0,0,0)"/>
<path d="M380,364L654,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="711,36 699,41 699,32" style="fill:rgb(0,0,0)"/>
<path d="M660,364 L 667,364 Q 675,364 675,349 L 675,51 Q 675,36 690,36 L 690,36 L 705,36"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="715" cy="36" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M215,417A15 15 0 0 0 230 402A15 15 0 0 0 215 387A15 15 0 0 0 200 402A15 15 0 0 0 215 417Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="402" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="230,402 242,398 242,406" style="fill:rgb(0,0,0)"/>
<path d="M296,364 L 303,364 Q 311,364 311,379 L 311,387 Q 311,402 296,402 L 251,402 L 236,402"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M200,402 L 123,402 Q 108,402 108,387 L 108,379 Q 108,364 116,364 L 123,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="122,440 111,444 111,436" style="fill:rgb(0,0,0)"/>
<path d="M81,364 L 88,364 Q 96,364 96,379 L 96,425 Q 96,440 106,440 L 116,440"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M122,455L224,455L224,425L122,425Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="173" y="440" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<path d="M224,440 L 308,440 Q 323,440 323,425 L 323,379 Q 323,364 331,364 L 338,364"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#join-clause">join-clause</a>&nbsp;&nbsp; <a href="#select-core">select-core</a>&nbsp;&nbsp; <a href="#select-stmt">select-stmt</a>&nbsp;&nbsp; <a href="#update-stmt">update-stmt</a>&nbsp;&nbsp; <a href="#update-stmt-limited">update-stmt-limited</a><br></br>
References:&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#join-clause">join-clause</a>&nbsp;&nbsp; <a href="#select-stmt">select-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="type-name"></a><h4>type-name:</h4><div class='imgcontainer'>
<div style="max-width:661px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 661.008 110.16">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L87,32A15 15 0 0 0 102 17A15 15 0 0 0 87 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">name</text>
<polygon points="165,92 153,97 153,88" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,77 Q 138,92 149,92 L 159,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,108A15 15 0 0 0 195 92A15 15 0 0 0 180 77A15 15 0 0 0 165 92A15 15 0 0 0 180 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,92 201,97 201,88" style="fill:rgb(0,0,0)"/>
<path d="M195,92L207,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,108L350,108L350,77L212,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,92 356,97 356,88" style="fill:rgb(0,0,0)"/>
<path d="M350,92L362,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,108A15 15 0 0 0 398 92A15 15 0 0 0 382 77A15 15 0 0 0 367 92A15 15 0 0 0 382 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="415,92 403,97 403,88" style="fill:rgb(0,0,0)"/>
<path d="M398,92L409,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M415,108L553,108L553,77L415,77Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="570,92 558,97 558,88" style="fill:rgb(0,0,0)"/>
<path d="M553,92L564,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M585,108A15 15 0 0 0 600 92A15 15 0 0 0 585 77A15 15 0 0 0 570 92A15 15 0 0 0 585 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="585" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="651,17 640,21 640,12" style="fill:rgb(0,0,0)"/>
<path d="M600,92 L 608,92 Q 615,92 615,77 L 615,32 Q 615,17 630,17 L 630,17 L 645,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="655" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,55 153,59 153,50" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 123,17 Q 138,17 138,32 L 138,40 Q 138,55 149,55 L 159,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,70A15 15 0 0 0 195 55L195,55A15 15 0 0 0 180 39A15 15 0 0 0 165 55L165,55A15 15 0 0 0 180 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="180" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="212,55 201,59 201,50" style="fill:rgb(0,0,0)"/>
<path d="M195,55L207,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M212,70L350,70L350,39L212,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="281" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">signed-number</text>
<polygon points="367,55 356,59 356,50" style="fill:rgb(0,0,0)"/>
<path d="M350,55L362,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,70A15 15 0 0 0 398 55L398,55A15 15 0 0 0 382 39A15 15 0 0 0 367 55L367,55A15 15 0 0 0 382 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="382" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="600,55 589,59 589,50" style="fill:rgb(0,0,0)"/>
<path d="M398,55L594,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M600,55 L 608,55 Q 615,55 615,47 L 615,40"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="74,47 85,43 85,51" style="fill:rgb(0,0,0)"/>
<path d="M102,17 L 110,17 Q 117,17 117,32 L 117,32 Q 117,47 102,47 L 94,47 L 79,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M74,47 L 33,47 Q 18,47 18,32 L 18,32 Q 18,17 26,17 L 33,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="382,17 371,21 371,12" style="fill:rgb(0,0,0)"/>
<path d="M102,17L377,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M382,17L630,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#column-def">column-def</a>&nbsp;&nbsp; <a href="#expr">expr</a><br></br>
References:&nbsp;&nbsp; <a href="#signed-number">signed-number</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="update-stmt"></a><h4>update-stmt:</h4><div class='imgcontainer'>
<div style="max-width:623px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 623.266 721.926">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L91,32A15 15 0 0 0 106 17A15 15 0 0 0 91 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M166,62L252,62A15 15 0 0 0 267 47L267,47A15 15 0 0 0 252 32L166,32A15 15 0 0 0 151 47L151,47A15 15 0 0 0 166 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="209,17 197,21 197,12" style="fill:rgb(0,0,0)"/>
<path d="M106,17L203,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M209,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M357,32L583,32L583,2L357,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="151,47 139,51 139,43" style="fill:rgb(0,0,0)"/>
<path d="M106,17 L 113,17 Q 121,17 121,32 L 121,32 Q 121,47 133,47 L 145,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,47 278,51 278,43" style="fill:rgb(0,0,0)"/>
<path d="M267,47L284,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,47 L 297,47 Q 305,47 305,32 L 305,32 Q 305,17 320,17 L 330,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,70A15 15 0 0 0 485 55L485,55A15 15 0 0 0 470 39A15 15 0 0 0 455 55L455,55A15 15 0 0 0 470 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="485,55 497,50 497,59" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,40 Q 598,55 583,55 L 506,55 L 491,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,55 L 349,55 Q 334,55 334,40 L 334,32 Q 334,17 340,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="294,83 306,79 306,88" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,68 Q 598,83 583,83 L 315,83 L 300,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="24,53 20,41 28,41" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,32 L 24,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,136L114,136A15 15 0 0 0 129 121A15 15 0 0 0 114 106L60,106A15 15 0 0 0 45 121A15 15 0 0 0 60 136Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="121" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="45,121 33,125 33,116" style="fill:rgb(0,0,0)"/>
<path d="M24,53 L 24,106 Q 24,121 31,121 L 39,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,83 L 39,83 Q 24,83 24,91 L 24,98"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,299 159,303 159,295" style="fill:rgb(0,0,0)"/>
<path d="M129,121 L 137,121 Q 144,121 144,136 L 144,284 Q 144,299 155,299 L 165,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,314L193,314A15 15 0 0 0 208 299A15 15 0 0 0 193 284L186,284A15 15 0 0 0 171 299A15 15 0 0 0 186 314Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="299" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,299 214,303 214,295" style="fill:rgb(0,0,0)"/>
<path d="M208,299L219,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,314L318,314A15 15 0 0 0 333 299A15 15 0 0 0 318 284L240,284A15 15 0 0 0 225 299A15 15 0 0 0 240 314Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="279" y="299" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="350,299 339,303 339,295" style="fill:rgb(0,0,0)"/>
<path d="M333,299L344,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,121 380,125 380,116" style="fill:rgb(0,0,0)"/>
<path d="M350,299 L 358,299 Q 365,299 365,284 L 365,136 Q 365,121 376,121 L 386,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M392,136L576,136L576,106L392,106Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="121" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">qualified-table-name</text>
<path d="M186,276L193,276A15 15 0 0 0 208 261A15 15 0 0 0 193 246L186,246A15 15 0 0 0 171 261A15 15 0 0 0 186 276Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="261" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,261 214,266 214,257" style="fill:rgb(0,0,0)"/>
<path d="M208,261L219,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,276L304,276A15 15 0 0 0 319 261A15 15 0 0 0 304 246L240,246A15 15 0 0 0 225 261A15 15 0 0 0 240 276Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="261" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<polygon points="350,261 339,266 339,257" style="fill:rgb(0,0,0)"/>
<path d="M319,261L344,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,261 L 358,261 Q 365,261 365,254 L 365,246"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,261 159,266 159,257" style="fill:rgb(0,0,0)"/>
<path d="M144,246 L 144,254 Q 144,261 155,261 L 165,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,239L193,239A15 15 0 0 0 208 224A15 15 0 0 0 193 208L186,208A15 15 0 0 0 171 224A15 15 0 0 0 186 239Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="224" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,224 214,228 214,219" style="fill:rgb(0,0,0)"/>
<path d="M208,224L219,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,239L292,239A15 15 0 0 0 307 224A15 15 0 0 0 292 208L240,208A15 15 0 0 0 225 224A15 15 0 0 0 240 239Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="266" y="224" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="350,224 339,228 339,219" style="fill:rgb(0,0,0)"/>
<path d="M307,224L344,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,224 L 358,224 Q 365,224 365,216 L 365,209"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,224 159,228 159,219" style="fill:rgb(0,0,0)"/>
<path d="M144,208 L 144,216 Q 144,224 155,224 L 165,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,201L193,201A15 15 0 0 0 208 186A15 15 0 0 0 193 171L186,171A15 15 0 0 0 171 186A15 15 0 0 0 186 201Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="186" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,186 214,190 214,181" style="fill:rgb(0,0,0)"/>
<path d="M208,186L219,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,201L262,201A15 15 0 0 0 277 186A15 15 0 0 0 262 171L240,171A15 15 0 0 0 225 186A15 15 0 0 0 240 201Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="186" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="350,186 339,190 339,181" style="fill:rgb(0,0,0)"/>
<path d="M277,186L344,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,186 L 358,186 Q 365,186 365,178 L 365,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,186 159,190 159,181" style="fill:rgb(0,0,0)"/>
<path d="M144,171 L 144,178 Q 144,186 155,186 L 165,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,163L193,163A15 15 0 0 0 208 148A15 15 0 0 0 193 133L186,133A15 15 0 0 0 171 148A15 15 0 0 0 186 163Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="148" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,148 214,152 214,144" style="fill:rgb(0,0,0)"/>
<path d="M208,148L219,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,163L282,163A15 15 0 0 0 297 148A15 15 0 0 0 282 133L240,133A15 15 0 0 0 225 148A15 15 0 0 0 240 163Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="148" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="350,148 339,152 339,144" style="fill:rgb(0,0,0)"/>
<path d="M297,148L344,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,148 L 358,148 Q 365,148 365,140 L 365,133"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,148 159,152 159,144" style="fill:rgb(0,0,0)"/>
<path d="M144,133 L 144,140 Q 144,148 155,148 L 165,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="350,121 339,125 339,116" style="fill:rgb(0,0,0)"/>
<path d="M129,121L344,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,121L380,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,375 39,379 39,370" style="fill:rgb(0,0,0)"/>
<path d="M576,121 L 584,121 Q 591,121 591,136 L 591,322 Q 591,337 576,337 L 39,337 Q 24,337 24,352 L 24,360 Q 24,375 34,375 L 45,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,390L81,390A15 15 0 0 0 96 375A15 15 0 0 0 81 360L65,360A15 15 0 0 0 50 375A15 15 0 0 0 65 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="73" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="153,413 141,417 141,408" style="fill:rgb(0,0,0)"/>
<path d="M96,375 L 111,375 Q 126,375 126,390 L 126,398 Q 126,413 136,413 L 147,413"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,428L309,428L309,397L153,397Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="413" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name-list</text>
<polygon points="350,375 339,379 339,370" style="fill:rgb(0,0,0)"/>
<path d="M309,413 L 316,413 Q 324,413 324,398 L 324,390 Q 324,375 334,375 L 344,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,390A15 15 0 0 0 380 375A15 15 0 0 0 365 360A15 15 0 0 0 350 375A15 15 0 0 0 365 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="375" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">=</text>
<polygon points="404,375 392,379 392,370" style="fill:rgb(0,0,0)"/>
<path d="M380,375L398,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,390L453,390L453,360L404,360Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="428" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="153,375 141,379 141,370" style="fill:rgb(0,0,0)"/>
<path d="M96,375L147,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,390L262,390A15 15 0 0 0 277 375A15 15 0 0 0 262 360L168,360A15 15 0 0 0 153 375A15 15 0 0 0 168 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<path d="M277,375L339,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M251,465A15 15 0 0 0 266 450A15 15 0 0 0 251 435A15 15 0 0 0 236 450A15 15 0 0 0 251 465Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="450" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="266,450 277,446 277,455" style="fill:rgb(0,0,0)"/>
<path d="M453,375 L 460,375 Q 468,375 468,390 L 468,435 Q 468,450 453,450 L 287,450 L 272,450"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,450 L 117,450 Q 102,450 102,435 L 102,390 Q 102,375 117,375 L 117,375 L 132,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="251,488 262,484 262,492" style="fill:rgb(0,0,0)"/>
<path d="M453,375 L 460,375 Q 468,375 468,390 L 468,473 Q 468,488 453,488 L 271,488 L 256,488"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M251,488 L 39,488 Q 24,488 24,503 L 24,511 Q 24,526 37,526 L 50,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,541L100,541A15 15 0 0 0 115 526A15 15 0 0 0 100 511L65,511A15 15 0 0 0 50 526A15 15 0 0 0 65 541Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="526" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="187,526 176,530 176,522" style="fill:rgb(0,0,0)"/>
<path d="M115,526L182,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,541L348,541L348,511L187,511Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="526" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M268,579A15 15 0 0 0 283 564A15 15 0 0 0 268 549A15 15 0 0 0 253 564A15 15 0 0 0 268 579Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="564" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="283,564 295,559 295,568" style="fill:rgb(0,0,0)"/>
<path d="M348,526 L 356,526 Q 363,526 363,541 L 363,549 Q 363,564 348,564 L 304,564 L 289,564"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M253,564 L 176,564 Q 161,564 161,549 L 161,541 Q 161,526 168,526 L 176,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="187,602 176,606 176,597" style="fill:rgb(0,0,0)"/>
<path d="M115,526 L 123,526 Q 130,526 130,541 L 130,587 Q 130,602 145,602 L 167,602 L 182,602"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,617L290,617L290,586L187,586Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="239" y="602" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<polygon points="405,526 393,530 393,522" style="fill:rgb(0,0,0)"/>
<path d="M290,602 L 363,602 Q 378,602 378,587 L 378,541 Q 378,526 389,526 L 399,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="244,639 255,635 255,644" style="fill:rgb(0,0,0)"/>
<path d="M405,526 L 412,526 Q 420,526 420,541 L 420,624 Q 420,639 405,639 L 265,639 L 250,639"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,526L393,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,677 39,681 39,673" style="fill:rgb(0,0,0)"/>
<path d="M244,639 L 39,639 Q 24,639 24,654 L 24,662 Q 24,677 34,677 L 45,677"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,692L115,692A15 15 0 0 0 130 677A15 15 0 0 0 115 662L66,662A15 15 0 0 0 50 677A15 15 0 0 0 66 692Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="90" y="677" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="153,677 142,681 142,673" style="fill:rgb(0,0,0)"/>
<path d="M130,677L147,677"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,692L202,692L202,662L153,662Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="178" y="677" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="24,586 20,575 28,575" style="fill:rgb(0,0,0)"/>
<path d="M24,511L24,581"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M24,586L24,662"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="613,715 602,719 602,711" style="fill:rgb(0,0,0)"/>
<path d="M24,662 L 24,700 Q 24,715 39,715 L 593,715 L 608,715"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="617" cy="715" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="253,715 242,719 242,711" style="fill:rgb(0,0,0)"/>
<path d="M202,677 L 210,677 Q 217,677 217,692 L 217,700 Q 217,715 232,715 L 233,715 L 248,715"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="295,677 283,681 283,673" style="fill:rgb(0,0,0)"/>
<path d="M253,715 L 261,715 Q 268,715 268,700 L 268,692 Q 268,677 279,677 L 289,677"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M295,692L446,692L446,662L295,662Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="370" y="677" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">returning-clause</text>
<polygon points="497,715 485,719 485,711" style="fill:rgb(0,0,0)"/>
<path d="M446,677 L 453,677 Q 461,677 461,692 L 461,700 Q 461,715 476,715 L 476,715 L 491,715"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#create-trigger-stmt">create-trigger-stmt</a>&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href="#column-name-list">column-name-list</a>&nbsp;&nbsp; <a href="#common-table-expression">common-table-expression</a>&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#join-clause">join-clause</a>&nbsp;&nbsp; <a href="#qualified-table-name">qualified-table-name</a>&nbsp;&nbsp; <a href="#returning-clause">returning-clause</a>&nbsp;&nbsp; <a href="#table-or-subquery">table-or-subquery</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>
</div>

<a name="update-stmt-limited"></a><h4>update-stmt-limited:</h4><div class='imgcontainer'>
<div style="max-width:623px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 623.266 1047.01">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,17 33,21 33,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L39,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,32L91,32A15 15 0 0 0 106 17A15 15 0 0 0 91 2L60,2A15 15 0 0 0 45 17A15 15 0 0 0 60 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="75" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<path d="M166,62L252,62A15 15 0 0 0 267 47L267,47A15 15 0 0 0 252 32L166,32A15 15 0 0 0 151 47L151,47A15 15 0 0 0 166 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="209" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<polygon points="209,17 197,21 197,12" style="fill:rgb(0,0,0)"/>
<path d="M106,17L203,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M209,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M357,32L583,32L583,2L357,2Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">common-table-expression</text>
<polygon points="151,47 139,51 139,43" style="fill:rgb(0,0,0)"/>
<path d="M106,17 L 113,17 Q 121,17 121,32 L 121,32 Q 121,47 133,47 L 145,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="290,47 278,51 278,43" style="fill:rgb(0,0,0)"/>
<path d="M267,47L284,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M290,47 L 297,47 Q 305,47 305,32 L 305,32 Q 305,17 320,17 L 330,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,70A15 15 0 0 0 485 55L485,55A15 15 0 0 0 470 39A15 15 0 0 0 455 55L455,55A15 15 0 0 0 470 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="470" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="485,55 497,50 497,59" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,40 Q 598,55 583,55 L 506,55 L 491,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M455,55 L 349,55 Q 334,55 334,40 L 334,32 Q 334,17 340,17 L 345,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="294,83 306,79 306,88" style="fill:rgb(0,0,0)"/>
<path d="M583,17 L 591,17 Q 598,17 598,32 L 598,68 Q 598,83 583,83 L 315,83 L 300,83"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="24,53 20,41 28,41" style="fill:rgb(0,0,0)"/>
<path d="M9,17 L 16,17 Q 24,17 24,32 L 24,32 L 24,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M60,136L114,136A15 15 0 0 0 129 121A15 15 0 0 0 114 106L60,106A15 15 0 0 0 45 121A15 15 0 0 0 60 136Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="87" y="121" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="45,121 33,125 33,116" style="fill:rgb(0,0,0)"/>
<path d="M24,53 L 24,106 Q 24,121 31,121 L 39,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M294,83 L 39,83 Q 24,83 24,91 L 24,98"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,299 159,303 159,295" style="fill:rgb(0,0,0)"/>
<path d="M129,121 L 137,121 Q 144,121 144,136 L 144,284 Q 144,299 155,299 L 165,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,314L193,314A15 15 0 0 0 208 299A15 15 0 0 0 193 284L186,284A15 15 0 0 0 171 299A15 15 0 0 0 186 314Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="299" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,299 214,303 214,295" style="fill:rgb(0,0,0)"/>
<path d="M208,299L219,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,314L318,314A15 15 0 0 0 333 299A15 15 0 0 0 318 284L240,284A15 15 0 0 0 225 299A15 15 0 0 0 240 314Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="279" y="299" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ROLLBACK</text>
<polygon points="350,299 339,303 339,295" style="fill:rgb(0,0,0)"/>
<path d="M333,299L344,299"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="392,121 380,125 380,116" style="fill:rgb(0,0,0)"/>
<path d="M350,299 L 358,299 Q 365,299 365,284 L 365,136 Q 365,121 376,121 L 386,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M392,136L576,136L576,106L392,106Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="121" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">qualified-table-name</text>
<path d="M186,276L193,276A15 15 0 0 0 208 261A15 15 0 0 0 193 246L186,246A15 15 0 0 0 171 261A15 15 0 0 0 186 276Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="261" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,261 214,266 214,257" style="fill:rgb(0,0,0)"/>
<path d="M208,261L219,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,276L304,276A15 15 0 0 0 319 261A15 15 0 0 0 304 246L240,246A15 15 0 0 0 225 261A15 15 0 0 0 240 276Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="272" y="261" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">REPLACE</text>
<polygon points="350,261 339,266 339,257" style="fill:rgb(0,0,0)"/>
<path d="M319,261L344,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,261 L 358,261 Q 365,261 365,254 L 365,246"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,261 159,266 159,257" style="fill:rgb(0,0,0)"/>
<path d="M144,246 L 144,254 Q 144,261 155,261 L 165,261"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,239L193,239A15 15 0 0 0 208 224A15 15 0 0 0 193 208L186,208A15 15 0 0 0 171 224A15 15 0 0 0 186 239Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="224" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,224 214,228 214,219" style="fill:rgb(0,0,0)"/>
<path d="M208,224L219,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,239L292,239A15 15 0 0 0 307 224A15 15 0 0 0 292 208L240,208A15 15 0 0 0 225 224A15 15 0 0 0 240 239Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="266" y="224" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IGNORE</text>
<polygon points="350,224 339,228 339,219" style="fill:rgb(0,0,0)"/>
<path d="M307,224L344,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,224 L 358,224 Q 365,224 365,216 L 365,209"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,224 159,228 159,219" style="fill:rgb(0,0,0)"/>
<path d="M144,208 L 144,216 Q 144,224 155,224 L 165,224"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,201L193,201A15 15 0 0 0 208 186A15 15 0 0 0 193 171L186,171A15 15 0 0 0 171 186A15 15 0 0 0 186 201Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="186" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,186 214,190 214,181" style="fill:rgb(0,0,0)"/>
<path d="M208,186L219,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,201L262,201A15 15 0 0 0 277 186A15 15 0 0 0 262 171L240,171A15 15 0 0 0 225 186A15 15 0 0 0 240 201Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="186" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FAIL</text>
<polygon points="350,186 339,190 339,181" style="fill:rgb(0,0,0)"/>
<path d="M277,186L344,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,186 L 358,186 Q 365,186 365,178 L 365,171"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,186 159,190 159,181" style="fill:rgb(0,0,0)"/>
<path d="M144,171 L 144,178 Q 144,186 155,186 L 165,186"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M186,163L193,163A15 15 0 0 0 208 148A15 15 0 0 0 193 133L186,133A15 15 0 0 0 171 148A15 15 0 0 0 186 163Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="189" y="148" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OR</text>
<polygon points="225,148 214,152 214,144" style="fill:rgb(0,0,0)"/>
<path d="M208,148L219,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M240,163L282,163A15 15 0 0 0 297 148A15 15 0 0 0 282 133L240,133A15 15 0 0 0 225 148A15 15 0 0 0 240 163Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="261" y="148" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ABORT</text>
<polygon points="350,148 339,152 339,144" style="fill:rgb(0,0,0)"/>
<path d="M297,148L344,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,148 L 358,148 Q 365,148 365,140 L 365,133"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="171,148 159,152 159,144" style="fill:rgb(0,0,0)"/>
<path d="M144,133 L 144,140 Q 144,148 155,148 L 165,148"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="350,121 339,125 339,116" style="fill:rgb(0,0,0)"/>
<path d="M129,121L344,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M350,121L380,121"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,375 39,379 39,370" style="fill:rgb(0,0,0)"/>
<path d="M576,121 L 584,121 Q 591,121 591,136 L 591,322 Q 591,337 576,337 L 39,337 Q 24,337 24,352 L 24,360 Q 24,375 34,375 L 45,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,390L81,390A15 15 0 0 0 96 375A15 15 0 0 0 81 360L65,360A15 15 0 0 0 50 375A15 15 0 0 0 65 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="73" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="153,413 141,417 141,408" style="fill:rgb(0,0,0)"/>
<path d="M96,375 L 111,375 Q 126,375 126,390 L 126,398 Q 126,413 136,413 L 147,413"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,428L309,428L309,397L153,397Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="231" y="413" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name-list</text>
<polygon points="350,375 339,379 339,370" style="fill:rgb(0,0,0)"/>
<path d="M309,413 L 316,413 Q 324,413 324,398 L 324,390 Q 324,375 334,375 L 344,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M365,390A15 15 0 0 0 380 375A15 15 0 0 0 365 360A15 15 0 0 0 350 375A15 15 0 0 0 365 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="365" y="375" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">=</text>
<polygon points="404,375 392,379 392,370" style="fill:rgb(0,0,0)"/>
<path d="M380,375L398,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M404,390L453,390L453,360L404,360Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="428" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="153,375 141,379 141,370" style="fill:rgb(0,0,0)"/>
<path d="M96,375L147,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M168,390L262,390A15 15 0 0 0 277 375A15 15 0 0 0 262 360L168,360A15 15 0 0 0 153 375A15 15 0 0 0 168 390Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="215" y="375" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<path d="M277,375L339,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M251,465A15 15 0 0 0 266 450A15 15 0 0 0 251 435A15 15 0 0 0 236 450A15 15 0 0 0 251 465Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="251" y="450" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="266,450 277,446 277,455" style="fill:rgb(0,0,0)"/>
<path d="M453,375 L 460,375 Q 468,375 468,390 L 468,435 Q 468,450 453,450 L 287,450 L 272,450"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M236,450 L 117,450 Q 102,450 102,435 L 102,390 Q 102,375 117,375 L 117,375 L 132,375"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="251,488 262,484 262,492" style="fill:rgb(0,0,0)"/>
<path d="M453,375 L 460,375 Q 468,375 468,390 L 468,473 Q 468,488 453,488 L 271,488 L 256,488"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M251,488 L 39,488 Q 24,488 24,503 L 24,511 Q 24,526 37,526 L 50,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M65,541L100,541A15 15 0 0 0 115 526A15 15 0 0 0 100 511L65,511A15 15 0 0 0 50 526A15 15 0 0 0 65 541Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="83" y="526" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">FROM</text>
<polygon points="187,526 176,530 176,522" style="fill:rgb(0,0,0)"/>
<path d="M115,526L182,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,541L348,541L348,511L187,511Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="526" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-or-subquery</text>
<path d="M268,579A15 15 0 0 0 283 564A15 15 0 0 0 268 549A15 15 0 0 0 253 564A15 15 0 0 0 268 579Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="268" y="564" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="283,564 295,559 295,568" style="fill:rgb(0,0,0)"/>
<path d="M348,526 L 356,526 Q 363,526 363,541 L 363,549 Q 363,564 348,564 L 304,564 L 289,564"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M253,564 L 176,564 Q 161,564 161,549 L 161,541 Q 161,526 168,526 L 176,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="187,602 176,606 176,597" style="fill:rgb(0,0,0)"/>
<path d="M115,526 L 123,526 Q 130,526 130,541 L 130,587 Q 130,602 145,602 L 167,602 L 182,602"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M187,617L290,617L290,586L187,586Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="239" y="602" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">join-clause</text>
<polygon points="405,526 393,530 393,522" style="fill:rgb(0,0,0)"/>
<path d="M290,602 L 363,602 Q 378,602 378,587 L 378,541 Q 378,526 389,526 L 399,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="244,639 255,635 255,644" style="fill:rgb(0,0,0)"/>
<path d="M405,526 L 412,526 Q 420,526 420,541 L 420,624 Q 420,639 405,639 L 265,639 L 250,639"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M348,526L393,526"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,677 39,681 39,673" style="fill:rgb(0,0,0)"/>
<path d="M244,639 L 39,639 Q 24,639 24,654 L 24,662 Q 24,677 34,677 L 45,677"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,692L115,692A15 15 0 0 0 130 677A15 15 0 0 0 115 662L66,662A15 15 0 0 0 50 677A15 15 0 0 0 66 692Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="90" y="677" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="153,677 142,681 142,673" style="fill:rgb(0,0,0)"/>
<path d="M130,677L147,677"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M153,692L202,692L202,662L153,662Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="178" y="677" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="126,715 138,711 138,719" style="fill:rgb(0,0,0)"/>
<path d="M202,677 L 212,677 Q 221,677 221,692 L 221,700 Q 221,715 206,715 L 147,715 L 132,715"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M126,715 L 39,715 Q 24,715 24,726 L 24,738"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,753 39,757 39,748" style="fill:rgb(0,0,0)"/>
<path d="M24,738 L 24,745 Q 24,753 34,753 L 45,753"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M50,768L201,768L201,738L50,738Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="126" y="753" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">returning-clause</text>
<polygon points="126,791 137,786 137,795" style="fill:rgb(0,0,0)"/>
<path d="M201,753 L 211,753 Q 220,753 220,768 L 220,776 Q 220,791 205,791 L 147,791 L 132,791"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="50,828 39,833 39,824" style="fill:rgb(0,0,0)"/>
<path d="M126,791 L 39,791 Q 24,791 24,806 L 24,813 Q 24,828 34,828 L 45,828"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M66,843L110,843A15 15 0 0 0 125 828A15 15 0 0 0 110 813L66,813A15 15 0 0 0 50 828A15 15 0 0 0 66 843Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="88" y="828" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="148,828 137,833 137,824" style="fill:rgb(0,0,0)"/>
<path d="M125,828L142,828"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M163,843L167,843A15 15 0 0 0 183 828A15 15 0 0 0 167 813L163,813A15 15 0 0 0 148 828A15 15 0 0 0 163 843Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="165" y="828" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="219,828 207,833 207,824" style="fill:rgb(0,0,0)"/>
<path d="M183,828L213,828"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M219,843L348,843L348,813L219,813Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="283" y="828" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M283,881L283,881A15 15 0 0 0 299 866A15 15 0 0 0 283 851L283,851A15 15 0 0 0 268 866A15 15 0 0 0 283 881Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="283" y="866" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<path d="M60,949L93,949A15 15 0 0 0 109 934A15 15 0 0 0 93 919L60,919A15 15 0 0 0 45 934A15 15 0 0 0 60 949Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="77" y="934" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">LIMIT</text>
<polygon points="132,934 120,939 120,930" style="fill:rgb(0,0,0)"/>
<path d="M109,934L126,934"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M132,949L181,949L181,919L132,919Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="934" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="219,964 207,969 207,960" style="fill:rgb(0,0,0)"/>
<path d="M181,934 L 188,934 Q 196,934 196,949 L 196,949 Q 196,964 204,964 L 213,964"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M234,980L285,980A15 15 0 0 0 300 964A15 15 0 0 0 285 949L234,949A15 15 0 0 0 219 964A15 15 0 0 0 234 980Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="260" y="964" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OFFSET</text>
<polygon points="323,964 312,969 312,960" style="fill:rgb(0,0,0)"/>
<path d="M300,964L318,964"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M323,980L373,980L373,949L323,949Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="348" y="964" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M234,1017A15 15 0 0 0 249 1002A15 15 0 0 0 234 987A15 15 0 0 0 219 1002A15 15 0 0 0 234 1017Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="234" y="1002" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="272,1002 261,1007 261,998" style="fill:rgb(0,0,0)"/>
<path d="M249,1002L266,1002"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,1017L321,1017L321,987L272,987Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="297" y="1002" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="219,1002 207,1007 207,998" style="fill:rgb(0,0,0)"/>
<path d="M181,934 L 188,934 Q 196,934 196,949 L 196,987 Q 196,1002 204,1002 L 213,1002"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="299,866 310,862 310,870" style="fill:rgb(0,0,0)"/>
<path d="M348,828 L 356,828 Q 363,828 363,843 L 363,851 Q 363,866 348,866 L 319,866 L 304,866"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M268,866 L 210,866 Q 195,866 195,851 L 195,843 Q 195,828 203,828 L 210,828"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="45,934 33,939 33,930" style="fill:rgb(0,0,0)"/>
<path d="M24,511 L 24,919 Q 24,934 31,934 L 39,934"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="165,896 177,892 177,901" style="fill:rgb(0,0,0)"/>
<path d="M348,828 L 356,828 Q 363,828 363,843 L 363,881 Q 363,896 348,896 L 186,896 L 171,896"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M165,896 L 39,896 Q 24,896 24,904 L 24,911"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="178,1040 166,1044 166,1036" style="fill:rgb(0,0,0)"/>
<path d="M24,919 L 24,1025 Q 24,1040 39,1040 L 157,1040 L 172,1040"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="613,1040 602,1044 602,1036" style="fill:rgb(0,0,0)"/>
<path d="M178,1040L608,1040"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="617" cy="1040" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="396,964 384,969 384,960" style="fill:rgb(0,0,0)"/>
<path d="M373,964L390,964"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="447,1040 435,1044 435,1036" style="fill:rgb(0,0,0)"/>
<path d="M396,964 L 403,964 Q 411,964 411,979 L 411,1025 Q 411,1040 426,1040 L 426,1040 L 441,1040"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="396,1002 384,1007 384,998" style="fill:rgb(0,0,0)"/>
<path d="M321,1002L390,1002"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M396,1002 L 403,1002 Q 411,1002 411,1010 L 411,1017"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="396,934 384,939 384,930" style="fill:rgb(0,0,0)"/>
<path d="M181,934L390,934"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M396,934 L 403,934 Q 411,934 411,949 L 411,965 L 411,980"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
References:&nbsp;&nbsp; <a href="#column-name-list">column-name-list</a>&nbsp;&nbsp; <a href="#common-table-expression">common-table-expression</a>&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#join-clause">join-clause</a>&nbsp;&nbsp; <a href="#ordering-term">ordering-term</a>&nbsp;&nbsp; <a href="#qualified-table-name">qualified-table-name</a>&nbsp;&nbsp; <a href="#returning-clause">returning-clause</a>&nbsp;&nbsp; <a href="#table-or-subquery">table-or-subquery</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_update.html#upfrom">lang_update.html#upfrom</a>
</div>

<a name="upsert-clause"></a><h4>upsert-clause:</h4><div class='imgcontainer'>
<div style="max-width:901px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 901.142 363.96">
<path d="M223,165L759,165L759,51L223,51Z"  style="fill:none;stroke-width:3.24;stroke:rgb(211,211,211);" />
<circle cx="5" cy="66" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,66 35,71 35,62" style="fill:rgb(0,0,0)"/>
<path d="M9,66L41,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,82L71,82A15 15 0 0 0 86 66A15 15 0 0 0 71 51L62,51A15 15 0 0 0 47 66A15 15 0 0 0 62 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="66" y="66" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ON</text>
<polygon points="103,66 92,71 92,62" style="fill:rgb(0,0,0)"/>
<path d="M86,66L98,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M118,82L193,82A15 15 0 0 0 208 66A15 15 0 0 0 193 51L118,51A15 15 0 0 0 103 66A15 15 0 0 0 118 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="66" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CONFLICT</text>
<polygon points="264,97 253,101 253,92" style="fill:rgb(0,0,0)"/>
<path d="M208,66 L 223,66 Q 238,66 238,81 L 238,82 Q 238,97 248,97 L 259,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M280,112A15 15 0 0 0 295 97L295,97A15 15 0 0 0 280 82A15 15 0 0 0 264 97L264,97A15 15 0 0 0 280 112Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="280" y="97" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="331,97 319,101 319,92" style="fill:rgb(0,0,0)"/>
<path d="M295,97L325,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M331,112L475,112L475,82L331,82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="97" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">indexed-column</text>
<polygon points="511,97 500,101 500,92" style="fill:rgb(0,0,0)"/>
<path d="M475,97L506,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M526,112A15 15 0 0 0 542 97L542,97A15 15 0 0 0 526 82A15 15 0 0 0 511 97L511,97A15 15 0 0 0 526 112Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="526" y="97" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="583,135 572,139 572,130" style="fill:rgb(0,0,0)"/>
<path d="M542,97 L 549,97 Q 557,97 557,112 L 557,119 Q 557,135 567,135 L 577,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M598,150L648,150A15 15 0 0 0 663 135A15 15 0 0 0 648 119L598,119A15 15 0 0 0 583 135A15 15 0 0 0 598 150Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="623" y="135" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="680,135 669,139 669,130" style="fill:rgb(0,0,0)"/>
<path d="M663,135L674,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M680,150L729,150L729,119L680,119Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="705" y="135" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="744,108 749,119 740,119" style="fill:rgb(0,0,0)"/>
<path d="M729,135 L 737,135 Q 744,135 744,124 L 744,114"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="786,66 774,71 774,62" style="fill:rgb(0,0,0)"/>
<path d="M744,108 L 744,81 Q 744,66 759,66 L 765,66 L 780,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M801,82L809,82A15 15 0 0 0 824 66A15 15 0 0 0 809 51L801,51A15 15 0 0 0 786 66A15 15 0 0 0 801 82Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="805" y="66" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">DO</text>
<polygon points="729,97 718,101 718,92" style="fill:rgb(0,0,0)"/>
<path d="M542,97L723,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M729,97 L 737,97 Q 744,97 744,89 L 744,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M208,66L774,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,150A15 15 0 0 0 418 135A15 15 0 0 0 403 119A15 15 0 0 0 388 135A15 15 0 0 0 403 150Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="135" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="418,135 430,130 430,139" style="fill:rgb(0,0,0)"/>
<path d="M475,97 L 483,97 Q 490,97 490,112 L 490,119 Q 490,135 475,135 L 439,135 L 424,135"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M388,135 L 319,135 Q 304,135 304,119 L 304,112 Q 304,97 312,97 L 319,97"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="288" y="36" text-anchor="middle" font-style="italic" fill="rgb(128,128,128)" dominant-baseline="central">conflict target</text>
<polygon points="436,195 447,191 447,199" style="fill:rgb(0,0,0)"/>
<path d="M824,66 L 831,66 Q 839,66 839,81 L 839,180 Q 839,195 824,195 L 456,195 L 441,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="47,271 35,275 35,266" style="fill:rgb(0,0,0)"/>
<path d="M436,195 L 35,195 Q 20,195 20,210 L 20,256 Q 20,271 31,271 L 41,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,286L116,286A15 15 0 0 0 131 271A15 15 0 0 0 116 255L62,255A15 15 0 0 0 47 271A15 15 0 0 0 62 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="89" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">UPDATE</text>
<polygon points="148,271 137,275 137,266" style="fill:rgb(0,0,0)"/>
<path d="M131,271L143,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M164,286L179,286A15 15 0 0 0 194 271A15 15 0 0 0 179 255L164,255A15 15 0 0 0 148 271A15 15 0 0 0 164 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="171" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">SET</text>
<polygon points="257,308 245,313 245,304" style="fill:rgb(0,0,0)"/>
<path d="M194,271 L 215,271 Q 230,271 230,286 L 230,293 Q 230,308 241,308 L 251,308"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M257,324L413,324L413,293L257,293Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="335" y="308" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name-list</text>
<polygon points="475,271 464,275 464,266" style="fill:rgb(0,0,0)"/>
<path d="M413,308 L 434,308 Q 449,308 449,293 L 449,286 Q 449,271 459,271 L 469,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M490,286A15 15 0 0 0 505 271A15 15 0 0 0 490 255A15 15 0 0 0 475 271A15 15 0 0 0 490 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="490" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">=</text>
<polygon points="523,271 511,275 511,266" style="fill:rgb(0,0,0)"/>
<path d="M505,271L517,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M523,286L572,286L572,255L523,255Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="547" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="619,271 608,275 608,266" style="fill:rgb(0,0,0)"/>
<path d="M572,271L613,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M634,286L684,286A15 15 0 0 0 699 271A15 15 0 0 0 684 255L634,255A15 15 0 0 0 619 271A15 15 0 0 0 634 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="659" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WHERE</text>
<polygon points="716,271 705,275 705,266" style="fill:rgb(0,0,0)"/>
<path d="M699,271L710,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M716,286L765,286L765,255L716,255Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="741" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="891,233 880,237 880,228" style="fill:rgb(0,0,0)"/>
<path d="M765,271 L 773,271 Q 780,271 780,256 L 780,248 Q 780,233 795,233 L 871,233 L 886,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="895" cy="233" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,248L130,248A15 15 0 0 0 145 233A15 15 0 0 0 130 218L62,218A15 15 0 0 0 47 233A15 15 0 0 0 62 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="96" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOTHING</text>
<polygon points="47,233 35,237 35,228" style="fill:rgb(0,0,0)"/>
<path d="M20,218 L 20,225 Q 20,233 31,233 L 41,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M145,233L880,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="638,233 626,237 626,228" style="fill:rgb(0,0,0)"/>
<path d="M587,271 L 594,271 Q 602,271 602,256 L 602,248 Q 602,233 617,233 L 617,233 L 632,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M383,361A15 15 0 0 0 398 346A15 15 0 0 0 383 331A15 15 0 0 0 368 346A15 15 0 0 0 383 361Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="383" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="398,346 410,342 410,351" style="fill:rgb(0,0,0)"/>
<path d="M572,271 L 579,271 Q 587,271 587,286 L 587,331 Q 587,346 572,346 L 419,346 L 404,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="206,308 210,320 201,320" style="fill:rgb(0,0,0)"/>
<path d="M368,346 L 221,346 Q 206,346 206,331 L 206,329 L 206,314"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M206,308 L 206,286 Q 206,271 221,271 L 227,271 L 242,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="257,271 245,275 245,266" style="fill:rgb(0,0,0)"/>
<path d="M194,271L251,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,286L366,286A15 15 0 0 0 381 271A15 15 0 0 0 366 255L272,255A15 15 0 0 0 257 271A15 15 0 0 0 272 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="319" y="271" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">column-name</text>
<path d="M381,271L464,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="865,97 869,108 860,108" style="fill:rgb(0,0,0)"/>
<path d="M850,233 L 857,233 Q 865,233 865,218 L 865,117 L 865,102"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="403,6 415,2 415,10" style="fill:rgb(0,0,0)"/>
<path d="M865,97 L 865,21 Q 865,6 850,6 L 424,6 L 409,6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M403,6 L 40,6 Q 25,6 25,21 L 25,51 Q 25,66 32,66 L 40,66"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#insert-stmt">insert-stmt</a><br></br>
References:&nbsp;&nbsp; <a href="#column-name-list">column-name-list</a>&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#indexed-column">indexed-column</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>
</div>

<a name="vacuum-stmt"></a><h4>vacuum-stmt:</h4><div class='imgcontainer'>
<div style="max-width:599px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 599.669 64.8">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L108,32A15 15 0 0 0 123 17A15 15 0 0 0 108 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="78" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VACUUM</text>
<polygon points="165,47 153,51 153,43" style="fill:rgb(0,0,0)"/>
<path d="M123,17 L 131,17 Q 138,17 138,32 L 138,32 Q 138,47 149,47 L 159,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M180,62L276,62A15 15 0 0 0 292 47L292,47A15 15 0 0 0 276 32L180,32A15 15 0 0 0 165 47L165,47A15 15 0 0 0 180 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="228" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="333,17 322,21 322,12" style="fill:rgb(0,0,0)"/>
<path d="M292,47 L 299,47 Q 307,47 307,32 L 307,32 Q 307,17 317,17 L 327,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="375,47 363,51 363,43" style="fill:rgb(0,0,0)"/>
<path d="M333,17 L 341,17 Q 348,17 348,32 L 348,32 Q 348,47 359,47 L 369,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M390,62L417,62A15 15 0 0 0 432 47L432,47A15 15 0 0 0 417 32L390,32A15 15 0 0 0 375 47L375,47A15 15 0 0 0 390 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="403" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">INTO</text>
<polygon points="455,47 443,51 443,43" style="fill:rgb(0,0,0)"/>
<path d="M432,47L449,47"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M470,62L524,62A15 15 0 0 0 539 47L539,47A15 15 0 0 0 524 32L470,32A15 15 0 0 0 455 47L455,47A15 15 0 0 0 470 62Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="497" y="47" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filename</text>
<polygon points="590,17 578,21 578,12" style="fill:rgb(0,0,0)"/>
<path d="M539,47 L 546,47 Q 554,47 554,32 L 554,32 Q 554,17 569,17 L 569,17 L 584,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="593" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M123,17L578,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#sql-stmt">sql-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_vacuum.html">lang_vacuum.html</a>
</div>

<a name="window-defn"></a><h4>window-defn:</h4><div class='imgcontainer'>
<div style="max-width:479px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 479.765 380.592">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32A15 15 0 0 0 62 17A15 15 0 0 0 47 2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="47" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="104,44 92,48 92,40" style="fill:rgb(0,0,0)"/>
<path d="M62,17 L 70,17 Q 77,17 77,30 Q 77,44 88,44 L 98,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,59L260,59A15 15 0 0 0 275 44L275,44A15 15 0 0 0 260 29L119,29A15 15 0 0 0 104 44L104,44A15 15 0 0 0 119 59Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="190" y="44" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">base-window-name</text>
<path d="M119,135L198,135A15 15 0 0 0 214 120A15 15 0 0 0 198 104L119,104A15 15 0 0 0 104 120A15 15 0 0 0 119 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="159" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">PARTITION</text>
<polygon points="237,120 225,124 225,115" style="fill:rgb(0,0,0)"/>
<path d="M214,120L231,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M252,135L256,135A15 15 0 0 0 271 120A15 15 0 0 0 256 104L252,104A15 15 0 0 0 237 120A15 15 0 0 0 252 135Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="254" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="307,120 295,124 295,115" style="fill:rgb(0,0,0)"/>
<path d="M271,120L301,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,135L356,135L356,104L307,104Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="120" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<path d="M332,173A15 15 0 0 0 347 157A15 15 0 0 0 332 142A15 15 0 0 0 316 157A15 15 0 0 0 332 173Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="332" y="157" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="347,157 358,153 358,162" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,142 Q 371,157 362,157 L 352,157"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M316,157 L 295,157 Q 280,157 280,142 L 280,135 Q 280,120 288,120 L 295,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,17 178,21 178,12" style="fill:rgb(0,0,0)"/>
<path d="M62,17L184,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,82 201,77 201,86" style="fill:rgb(0,0,0)"/>
<path d="M190,17 L 298,17 Q 313,17 313,32 L 313,67 Q 313,82 298,82 L 210,82 L 195,82"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,120 92,124 92,115" style="fill:rgb(0,0,0)"/>
<path d="M190,82 L 77,82 Q 62,82 62,97 L 62,105 Q 62,120 77,120 L 83,120 L 98,120"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="298,44 287,48 287,40" style="fill:rgb(0,0,0)"/>
<path d="M275,44L293,44"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M298,44 L 306,44 Q 313,44 313,51 L 313,59"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M119,248L163,248A15 15 0 0 0 178 233A15 15 0 0 0 163 218L119,218A15 15 0 0 0 104 233A15 15 0 0 0 119 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="141" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ORDER</text>
<polygon points="201,233 190,237 190,229" style="fill:rgb(0,0,0)"/>
<path d="M178,233L196,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M217,248L221,248A15 15 0 0 0 236 233A15 15 0 0 0 221 218L217,218A15 15 0 0 0 201 233A15 15 0 0 0 217 248Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="219" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">BY</text>
<polygon points="272,233 260,237 260,229" style="fill:rgb(0,0,0)"/>
<path d="M236,233L266,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M272,248L402,248L402,218L272,218Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="233" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">ordering-term</text>
<path d="M337,286A15 15 0 0 0 352 271A15 15 0 0 0 337 256A15 15 0 0 0 322 271A15 15 0 0 0 337 286Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="337" y="271" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="352,271 363,266 363,275" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,256 Q 417,271 402,271 L 373,271 L 358,271"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M322,271 L 260,271 Q 245,271 245,256 L 245,248 Q 245,233 253,233 L 260,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,195 201,191 201,200" style="fill:rgb(0,0,0)"/>
<path d="M356,120 L 364,120 Q 371,120 371,135 L 371,180 Q 371,195 356,195 L 210,195 L 195,195"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,233 92,237 92,229" style="fill:rgb(0,0,0)"/>
<path d="M190,195 L 77,195 Q 62,195 62,210 L 62,218 Q 62,233 77,233 L 83,233 L 98,233"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,157 58,146 66,146" style="fill:rgb(0,0,0)"/>
<path d="M62,104L62,152"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,157L62,218"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M104,362L208,362L208,331L104,331Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="156" y="346" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">frame-spec</text>
<polygon points="417,346 405,351 405,342" style="fill:rgb(0,0,0)"/>
<path d="M208,346L411,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,362A15 15 0 0 0 447 346A15 15 0 0 0 432 331A15 15 0 0 0 417 346A15 15 0 0 0 432 362Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="346" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="470,346 458,351 458,342" style="fill:rgb(0,0,0)"/>
<path d="M447,346L464,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="474" cy="346" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="190,309 201,304 201,313" style="fill:rgb(0,0,0)"/>
<path d="M402,233 L 409,233 Q 417,233 417,248 L 417,294 Q 417,309 402,309 L 210,309 L 195,309"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="104,346 92,351 92,342" style="fill:rgb(0,0,0)"/>
<path d="M190,309 L 77,309 Q 62,309 62,324 L 62,331 Q 62,346 77,346 L 83,346 L 98,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="62,271 58,259 66,259" style="fill:rgb(0,0,0)"/>
<path d="M62,218L62,265"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M62,271L62,331"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="156,374 144,378 144,369" style="fill:rgb(0,0,0)"/>
<path d="M62,331 L 62,359 Q 62,374 77,374 L 135,374 L 150,374"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="278,346 266,351 266,342" style="fill:rgb(0,0,0)"/>
<path d="M156,374 L 233,374 Q 248,374 248,360 Q 248,346 260,346 L 272,346"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>

Used by:&nbsp;&nbsp; <a href="#select-core">select-core</a>&nbsp;&nbsp; <a href="#select-stmt">select-stmt</a>&nbsp;&nbsp; <a href="#window-function-invocation">window-function-invocation</a><br></br>
References:&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#frame-spec">frame-spec</a>&nbsp;&nbsp; <a href="#ordering-term">ordering-term</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_aggfunc.html">lang_aggfunc.html</a>&nbsp;&nbsp; <a href="lang_altertable.html">lang_altertable.html</a>&nbsp;&nbsp; <a href="lang_attach.html">lang_attach.html</a>&nbsp;&nbsp; <a href="lang_createindex.html">lang_createindex.html</a>&nbsp;&nbsp; <a href="lang_createtable.html">lang_createtable.html</a>&nbsp;&nbsp; <a href="lang_createtrigger.html">lang_createtrigger.html</a>&nbsp;&nbsp; <a href="lang_createview.html">lang_createview.html</a>&nbsp;&nbsp; <a href="lang_delete.html">lang_delete.html</a>&nbsp;&nbsp; <a href="lang_expr.html">lang_expr.html</a>&nbsp;&nbsp; <a href="lang_insert.html">lang_insert.html</a>&nbsp;&nbsp; <a href="lang_returning.html">lang_returning.html</a>&nbsp;&nbsp; <a href="lang_select.html">lang_select.html</a>&nbsp;&nbsp; <a href="lang_select.html#compound">lang_select.html#compound</a>&nbsp;&nbsp; <a href="lang_select.html#simpleselect">lang_select.html#simpleselect</a>&nbsp;&nbsp; <a href="lang_update.html">lang_update.html</a>&nbsp;&nbsp; <a href="lang_upsert.html">lang_upsert.html</a>&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>&nbsp;&nbsp; <a href="partialindex.html">partialindex.html</a>
</div>

<a name="window-function-invocation"></a><h4>window-function-invocation:</h4><div class='imgcontainer'>
<div style="max-width:870px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 870.446 132.84">
<circle cx="5" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,55 20,59 20,50" style="fill:rgb(0,0,0)"/>
<path d="M9,55L26,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,70L135,70A15 15 0 0 0 150 55A15 15 0 0 0 135 39L47,39A15 15 0 0 0 32 55A15 15 0 0 0 47 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="91" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-func</text>
<polygon points="167,55 156,59 156,50" style="fill:rgb(0,0,0)"/>
<path d="M150,55L161,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M182,70A15 15 0 0 0 197 55A15 15 0 0 0 182 39A15 15 0 0 0 167 55A15 15 0 0 0 182 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="182" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="251,55 240,59 240,50" style="fill:rgb(0,0,0)"/>
<path d="M197,55L246,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M251,70L300,70L300,39L251,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">expr</text>
<polygon points="354,55 343,59 343,50" style="fill:rgb(0,0,0)"/>
<path d="M300,55L349,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M370,70A15 15 0 0 0 385 55A15 15 0 0 0 370 39A15 15 0 0 0 354 55A15 15 0 0 0 370 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="370" y="55" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="426,85 415,89 415,81" style="fill:rgb(0,0,0)"/>
<path d="M385,55 L 392,55 Q 400,55 400,70 L 400,70 Q 400,85 410,85 L 420,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M426,100L538,100L538,70L426,70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="482" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">filter-clause</text>
<polygon points="580,55 568,59 568,50" style="fill:rgb(0,0,0)"/>
<path d="M538,85 L 546,85 Q 553,85 553,70 L 553,70 Q 553,55 564,55 L 574,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M595,70L626,70A15 15 0 0 0 641 55A15 15 0 0 0 626 39L595,39A15 15 0 0 0 580 55A15 15 0 0 0 595 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="610" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">OVER</text>
<polygon points="682,92 671,97 671,88" style="fill:rgb(0,0,0)"/>
<path d="M641,55 L 648,55 Q 656,55 656,70 L 656,77 Q 656,92 666,92 L 677,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M697,108L794,108A15 15 0 0 0 810 92L810,92A15 15 0 0 0 794 77L697,77A15 15 0 0 0 682 92L682,92A15 15 0 0 0 697 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="746" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-name</text>
<polygon points="861,55 849,59 849,50" style="fill:rgb(0,0,0)"/>
<path d="M810,92 L 817,92 Q 825,92 825,77 L 825,70 Q 825,55 840,55 L 840,55 L 855,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="864" cy="55" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M385,55L568,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="682,55 671,59 671,50" style="fill:rgb(0,0,0)"/>
<path d="M641,55L677,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M682,70L801,70L801,39L682,39Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="742" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">window-defn</text>
<path d="M801,55L849,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,32A15 15 0 0 0 291 17L291,17A15 15 0 0 0 276 2A15 15 0 0 0 261 17L261,17A15 15 0 0 0 276 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="17" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="291,17 303,12 303,21" style="fill:rgb(0,0,0)"/>
<path d="M300,55 L 308,55 Q 315,55 315,40 L 315,32 Q 315,17 306,17 L 297,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M261,17 L 240,17 Q 225,17 225,32 L 225,40 Q 225,55 232,55 L 240,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="276,85 264,89 264,81" style="fill:rgb(0,0,0)"/>
<path d="M197,55 L 205,55 Q 212,55 212,70 L 212,70 Q 212,85 227,85 L 255,85 L 270,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,85 L 313,85 Q 328,85 328,70 L 328,70 Q 328,55 335,55 L 343,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M276,130A15 15 0 0 0 291 115L291,115A15 15 0 0 0 276 100A15 15 0 0 0 261 115L261,115A15 15 0 0 0 276 130Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="276" y="115" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">*</text>
<polygon points="261,115 249,119 249,111" style="fill:rgb(0,0,0)"/>
<path d="M197,55 L 205,55 Q 212,55 212,70 L 212,100 Q 212,115 227,115 L 240,115 L 255,115"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M291,115 L 313,115 Q 328,115 328,100 L 328,70 Q 328,55 335,55 L 343,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<br></br>
References:&nbsp;&nbsp; <a href="#expr">expr</a>&nbsp;&nbsp; <a href="#filter-clause">filter-clause</a>&nbsp;&nbsp; <a href="#window-defn">window-defn</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_expr.html#*funcinexpr">lang_expr.html#*funcinexpr</a>
</div>

<a name="with-clause"></a><h4>with-clause:</h4><div class='imgcontainer'>
<div style="max-width:1056px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 1056.72 140.4">
<circle cx="5" cy="85" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,85 20,89 20,81" style="fill:rgb(0,0,0)"/>
<path d="M9,85L26,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,100L78,100A15 15 0 0 0 93 85A15 15 0 0 0 78 70L47,70A15 15 0 0 0 32 85A15 15 0 0 0 47 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="62" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">WITH</text>
<polygon points="134,55 123,59 123,50" style="fill:rgb(0,0,0)"/>
<path d="M93,85 L 100,85 Q 108,85 108,70 L 108,70 Q 108,55 118,55 L 129,55"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M150,70L235,70A15 15 0 0 0 250 55L250,55A15 15 0 0 0 235 39L150,39A15 15 0 0 0 134 55L134,55A15 15 0 0 0 150 70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="192" y="55" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">RECURSIVE</text>
<path d="M250,55 L 258,55 Q 265,55 265,70 L 265,70 Q 265,85 273,85 L 280,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="307,85 295,89 295,81" style="fill:rgb(0,0,0)"/>
<path d="M280,85L301,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M307,100L444,100L444,70L307,70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="375" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">cte-table-name</text>
<polygon points="467,85 455,89 455,81" style="fill:rgb(0,0,0)"/>
<path d="M444,85L461,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M482,100L486,100A15 15 0 0 0 501 85A15 15 0 0 0 486 70L482,70A15 15 0 0 0 467 85A15 15 0 0 0 482 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="484" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">AS</text>
<polygon points="542,17 531,21 531,12" style="fill:rgb(0,0,0)"/>
<path d="M501,85 L 508,85 Q 516,85 516,70 L 516,32 Q 516,17 526,17 L 537,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,32L578,32A15 15 0 0 0 593 17L593,17A15 15 0 0 0 578 2L558,2A15 15 0 0 0 542 17L542,17A15 15 0 0 0 558 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="568" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="610,17 599,21 599,12" style="fill:rgb(0,0,0)"/>
<path d="M593,17L604,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M625,32L743,32A15 15 0 0 0 759 17L759,17A15 15 0 0 0 743 2L625,2A15 15 0 0 0 610 17L610,17A15 15 0 0 0 625 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="684" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<polygon points="800,85 789,89 789,81" style="fill:rgb(0,0,0)"/>
<path d="M759,17 L 766,17 Q 774,17 774,32 L 774,70 Q 774,85 784,85 L 794,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M815,100A15 15 0 0 0 830 85A15 15 0 0 0 815 70A15 15 0 0 0 800 85A15 15 0 0 0 815 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="815" y="85" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="853,85 842,89 842,81" style="fill:rgb(0,0,0)"/>
<path d="M830,85L848,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M853,100L958,100L958,70L853,70Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="905" y="85" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">select-stmt</text>
<polygon points="981,85 969,89 969,81" style="fill:rgb(0,0,0)"/>
<path d="M958,85L975,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M996,100A15 15 0 0 0 1011 85A15 15 0 0 0 996 70A15 15 0 0 0 981 85A15 15 0 0 0 996 100Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="996" y="85" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="1047,85 1035,89 1035,81" style="fill:rgb(0,0,0)"/>
<path d="M1011,85L1041,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="1050" cy="85" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="542,56 531,60 531,52" style="fill:rgb(0,0,0)"/>
<path d="M501,85 L 508,85 Q 516,85 516,70 Q 516,56 526,56 L 537,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M558,71L676,71A15 15 0 0 0 691 56A15 15 0 0 0 676 41L558,41A15 15 0 0 0 542 56A15 15 0 0 0 558 71Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="617" y="56" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">MATERIALIZED</text>
<polygon points="759,56 747,60 747,52" style="fill:rgb(0,0,0)"/>
<path d="M691,56L753,56"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M759,56 L 766,56 Q 774,56 774,64 L 774,71"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="617,85 605,89 605,81" style="fill:rgb(0,0,0)"/>
<path d="M501,85L611,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M617,85L800,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M659,138A15 15 0 0 0 674 123L674,123A15 15 0 0 0 659 108A15 15 0 0 0 644 123L644,123A15 15 0 0 0 659 138Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="659" y="123" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="674,123 686,118 686,127" style="fill:rgb(0,0,0)"/>
<path d="M1011,85 L 1018,85 Q 1026,85 1026,100 L 1026,108 Q 1026,123 1011,123 L 695,123 L 680,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M644,123 L 295,123 Q 280,123 280,108 L 280,100 Q 280,85 288,85 L 295,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M93,85L295,85"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
<br></br>
References:&nbsp;&nbsp; <a href="#cte-table-name">cte-table-name</a>&nbsp;&nbsp; <a href="#select-stmt">select-stmt</a><br></br>
See also:&nbsp;&nbsp; <a href="lang_with.html">lang_with.html</a>
</div>

<p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/syntaxdiagrams.in?m=4eaf2fca2d">2022-01-08 05:02:57</a> UTC </small></i></p>

Added Doc/Extra/Include/ndoc.css.

























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
.userDataStyle
{
	behavior:	url(#default#userData);
}

@media all
{
	tool\:tip{behavior: url(tooltip.htc)}
}

body
{
	background: #FFFFFF;
	color: #000000;
	font-family: Verdana;
	font-size: medium;
	font-style: normal;
	font-weight: normal;
	margin: 0px;
	width: 100%;
}

a
{
	color: #0000FF;
}

a:visited
{
	color: #0000FF;
}

a:hover
{
	color: #3366FF;
}

div#mainSection
{
	font-size: 70%;
	width: 100%;
}

div#mainBody
{
	font-size: 90%;
	margin-left: 15px;
	margin-top: 10px;
	padding-bottom: 20px;
}
div#mainBody p, div#mainBody ol, div#mainBody ul, div#mainBody dl
{
	padding-right: 5;
}

div#header
{
	background-color: #D4DFFF;
	padding: 0px;
	width: 100%;
}

div#header table
{
	border-bottom: solid 1px #C8CDDE;
	width: 100%;
}

span#runningHeaderText
{
	color: #003399;
	font-size: 90%;
	padding-left: 13px;
}


span#nsrTitle
{
	color: #003399;
	font-size: 120%;
	font-weight: bold;
	padding-left: 13px;
}

div#header table td
{
	color: #0000FF;
	font-size: 70%;
	margin-top: 0px;
	margin-bottom: 0px;
	padding-right: 20px;
}

div#header table tr#headerTableRow3 td
{
	padding-bottom: 2px;
	padding-top: 5px;
	padding-left: 15px;
}

div#header table#bottomTable
{
	border-top: solid 1px #FFFFFF;
	text-align: left;
	padding-left: 15px;
}

div#footer
{
	font-size: 90%;
	margin: 0px;
	padding: 2px;
	width: 100%;
}

hr#footerHR
{
	border-bottom: solid 1px #EEEEFF;
	border-top: solid 1px #C8CDDE;
	height: 3px;
	color: #D4DFFF;
}
/*
div.saveHistory
{
	behavior:url(#default#saveHistory);
}
*/
div.section
{
	padding-top: 2px;
	padding-bottom: 2px;
	padding-left: 16px;
	padding-right: 15px;
	width: 100%;
}

.heading
{
	font-weight: bold;
	margin-top: 18px;
	margin-bottom: 8px;
}

h1.heading
{
	color: #003399;
	font-size: 130%;
}

.subHeading
{
	font-weight: bold;
	margin-bottom: 4px;
}

h3.subHeading
{
	color: #000000;
	font-size: 120%;
	font-weight: normal;
}

h4.subHeading
{
	color: #000000;
	font-size: 100%;
}

img.toggle
{
	border: none;
	margin-right: 5px;
}

img.copyCodeImage
{
	border: none;
	margin: 1px;
	margin-right: 3px;
}

img.downloadCodeImage
{
	border: none;
	margin-right: 3px;
}

img.viewCodeImage
{
	border: none;
	margin-right: 3px;
}

img.note
{
	border: none;
	margin-right: 3px;
}

img#languageFilterImage
{
	border: none;
	margin-left: 10px;
	vertical-align: middle;
}

img#membersOptionsFilterImage
{
	border: none;
	margin-left: 10px;
	vertical-align: middle;
}

img#toggleAllImage
{
	margin-left: 4px;
	vertical-align: middle;
}

div#mainSection table
{
	border: none;
	font-size: 100%;
	width: 100%;
	margin-top: 5px;
	margin-bottom: 5px;
}

div#mainSection table tr
{
	vertical-align: top;
}

div#mainSection table th
{
	background-color: #EFEFF7;
	border-bottom: solid 1px #C8CDDE;
	color: #000066;
	padding-left: 5px;
	padding-right: 5px;
	text-align: left;
}

div#mainSection table td
{
	background-color: #F7F7FF;
	border-bottom: solid 1px #D5D5D3;
	/*border-left: solid 1px #D5D5D3;*/
	padding-left: 5px;
	padding-right: 5px;
	margin: 1px;
}

div#mainSection table td.imageCell
{
	white-space: nowrap;
	/*width: 1%;*/
}

div#mainSection table td.nameCell
{
	white-space: nowrap;
}

div.code table
{
	border: none;
	font-size: 95%;
	margin-bottom: 5px;
	margin-top:-.4em;
	width: 100%;
}

div.code table th
{
	background: #EFEFF7;
	border-bottom: solid 1px #C8CDDE;
	color: #000066;
	font-weight: bold;
	padding-left: 5px;
	padding-right: 5px;
}

div.code table td
{
	background: #F7F7FF;
	border-top: solid 1px #FFFFFF;
	padding-left: 5px;
	padding-right: 5px;
	padding-top: 5px;
	padding-bottom: 15px;
}

div.code table td.syntax
{
	font-family:	Monospace, Courier New, Courier;
	font-size: 105%;
	color:	#000066;
	white-space: nowrap;
}

div.code table td.message
{
}

div.alert table
{
	border: none;
	font-size: 100%;
	width: 100%;
}

div.alert table th
{
	background: #EFEFF7;
	border-bottom-width: 0px;
	color: #000066;
	padding-left: 5px;
	padding-right: 5px;
}

div.alert table td
{
	background: #F7F7FF;
	border-top: solid 1px #FFFFFF;
	padding-left: 5px;
	padding-right: 5px;
}

span.copyCode
{
	color: #0000ff;
	font-size: 90%;
	font-weight: normal;
	cursor: hand;
	float: right;
	display: inline;
	text-align: right;
}

.downloadCode
{
	color: #0000ff;
	font-size: 90%;
	font-weight: normal;
	cursor: hand;
}

.viewCode
{
	color: #0000ff;
	font-size: 90%;
	font-weight: normal;
	cursor: hand;
}

code
{
	font-family: Monospace, Courier New, Courier;
	font-size: 105%;
	color: #000066;
}

dl
{
	margin-top: 0px;
	padding-left: 1px;
}

dt
{
	font-style: italic;
}

dd
{
	margin-bottom: 0px;
	margin-left: 0px;
}

ul
{
	margin-top:0px;
	margin-bottom:0px;
	margin-left: 17px;
	list-style-type: disc;
}

ul ul
{
	margin-bottom: 4px;
	margin-left: 17px;
	margin-top: 3px;
	list-style-type: disc;
}

ol
{
	margin-top:0px;
	margin-bottom:0px;
	margin-left: 28px;
	list-style-type: decimal;
}

ol ol
{
	margin-bottom: 4px;
	margin-left: 24px;
	margin-top: 3px;
	list-style-type: lower-alpha;
}

li
{
	margin-top:-2px;
	margin-bottom: 3px;
}

p
{
	margin-top: 10px;
	margin-bottom: 5px;
}

.tip
{
	color: #0000FF;
	font-style: italic;
	cursor: hand;
	text-decoration: underline;
}

.languageFilter
{
	color: #0000FF;
	cursor: hand;
	text-decoration: underline;
	padding-bottom: 4px;
}

.math
{
	font-family: Times New Roman;
	font-size: 125%;
}

.sourceCodeList
{
	font-family: Verdana;
	font-size: 90%;
}

pre.viewCode
{
	width: 100%;
	overflow: auto;
}

MSHelp\:link
{
	text-decoration: underline;
	color: #0000ff; 
	hoverColor: #3366ff;
	filterString: ;
}


/*----------------------------------------------*/
/*
.attribute a:link
{
	color: #000088;
	text-decoration: none;
}
.attribute a:visited
{
	color: #000088;
	text-decoration: none;
}
.attribute a:hover
{
	color: #3366ff;
}

.attribute MSHelp\:link
	{
	text-decoration: underline; 
	color: #0000ff; 
	hoverColor: #3366ff;
	filterString: ;
	}
*/
.missing
{
	color: Red;
	font-weight: bold;
}
div.hier
{
	margin-top: 0.5em;
	margin-right: 0.0em;
	margin-bottom: 0.5em;
	margin-left: 1.0em;
}
div#mainSection table.hier
{
	border: none;
	font-size: 100%;
	padding: 0px;
	margin: 0px;
	border-collapse: collapse;
	width: auto;
}
div#mainSection table.hier tr
{
	padding: 0px;
	margin: 0px;
}
div#mainSection table.hier td
{
	border: none;
	vertical-align: top;
	padding: 0px;
	margin: 50px;
	background-color: transparent;
}

div.code table td span.attribute
{
	padding: 0px;
	margin: 0px;
}

p.inheritDoc
{
	padding: 2px;
	margin: 0px;
	background-color: #FFFFE0;
	border-top: solid 1px #E0E0C0;
}
p.inheritSource
{
	padding: 0px 2px;
	margin: 0px;
	font-size: 85%;
	background-color: #F0F0D0;
	color: #606050;
}
span.autoText
{
	padding: 2px;
	margin: 0px;
	background-color: #E0FFE0;
	color: #206020;
}

p.missing
{
	padding: 2px;
	margin: 0px;
	font-size: 85%;
	background-color: #FFE0E0;
	color: #800000;
	font-weight: bold;
}

.topicstatus /* Topic Status Boilerplate class */
	{
	display: block;
	color: red;
	}

Added Doc/Extra/Provider/dbfactorysupport.html.











































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>DbProviderFactory Support</title>
    <link rel="stylesheet" type="text/css" href="../Include/ndoc.css" />
  </head>
  <body>
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">DbProviderFactory Support</span>
          </td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite.NET Class Library Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">DbProviderFactories and You</h1>
      <p>One of the great new features of ADO.NET 2.0 is the use of reflection as a
        means of instantiating database providers programmatically. The information
        .NET uses to enumerate the available data providers in the system is relatively
        simple. It merely looks in the machine.config and in your own app.config file for some XML data to tell it what providers are
        installed and what assemblies those providers are in.
      </p>
      <h4>
        Scenario 1:&nbsp; Version Independent (does not use the Global Assembly Cache)</h4>
      <p>
        This method allows you to drop any new version of the System.Data.SQLite.DLL into
        your application's folder and use it without any code modifications or recompiling.&nbsp;
        Add the following code to your app.config file:</p>
      <div class="syntax">
        <PRE>&lt;configuration&gt;
  &lt;system.data&gt;
    &lt;DbProviderFactories&gt;
      &lt;remove invariant="System.Data.SQLite"/&gt;
      &lt;add name="SQLite Data Provider" invariant="System.Data.SQLite"
           description=".NET Framework Data Provider for SQLite"<br />           type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /&gt;
    &lt;/DbProviderFactories&gt;
  &lt;/system.data&gt;
&lt;/configuration&gt;
</PRE>
      </div>
      <h4>
        Scenario 2:&nbsp; Version Dependent, using either the DLL located in the same folder
        as the application or the Global Assembly Cache</h4>
      <p>
        This method expands on the above XML to provide the version number and key token
        of the SQLite DLL so it can be found either in the same folder as the application
        or looked up in the GAC.&nbsp; The downside to this method is that DbProviderFactories
        will use this version information to only load the version specified.&nbsp; This
        means if you update the DLL, you must also update this XML.</p>
      <div class="syntax">
        <PRE>
&lt;configuration&gt;
  &lt;system.data&gt;
    &lt;DbProviderFactories&gt;
      &lt;remove invariant="System.Data.SQLite"/&gt;
      &lt;add name="SQLite Data Provider" invariant="System.Data.SQLite"
           description=".NET Framework Data Provider for SQLite"
           type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite,
                 Version=1.0.119.0, Culture=neutral,
                 PublicKeyToken=db937bc2d44ff139"/&gt;
    &lt;/DbProviderFactories&gt;
  &lt;/system.data&gt;
&lt;/configuration&gt;
</pre>
      </div>
      <p>
        The following C# code demonstrates
        instantiating SQLite through DbProviderFactories:</p>
      <div class="syntax"><pre>      DbProviderFactory fact = DbProviderFactories.GetFactory("System.Data.SQLite");
      using (DbConnection cnn = fact.CreateConnection())
      {
        cnn.ConnectionString = "Data Source=test.db3";
        cnn.Open();
      }</pre>
      </div>
      <hr>
      <div id="footer">
        <p>
          <a href="mailto:sqlite-users@mailinglists.sqlite.org?subject=SQLite.NET%20Class%20Library%20Documentation%20Feedback:%20Factory%20Support">
            Send comments on this topic.</a>
        </p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>

Added Doc/Extra/Provider/designer.html.



























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>Design-Time Support</title>
    <link rel="stylesheet" type="text/css" href="../Include/ndoc.css" />
  </head>
  <body>
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">Design-Time Support</span>
          </td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite.NET Class Library Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">

      <h1 class="heading">Installing SQLite Visual Studio Design-Time Support</h1>
      <p>Supporting the Visual Studio query designer and allowing you to manipulate
        SQLite databases from within Visual Studio is a great time-saver.&nbsp; Though
        the support is not yet fully-implemented, there's certainly enough there to
        keep you busy.&nbsp; You can create databases, design and execute queries,
        create typed datasets and lots more all from Visual Studio.</p>
      <h3> Installation Instructions</h3>
      <p>Download and run one of the setup packages and then select the &quot;<b>Install
        the designer components for Visual Studio 20XX.</b>&quot; option when prompted.</p>
      <h3> Express Edition Limitations</h3>
      <p>Visual Studio design-time Support, works with all versions of Visual Studio
        2005/2008/2010/2012/2013/2015.  You can add a SQLite database to the Servers list, design
        queries with the Query Designer, drag-and-drop tables onto a Typed DataSet, etc.
        <br />
        <font color="red">
          Due to Visual Studio licensing restrictions, the Express Editions can no
          longer be supported.
        </font>
      </p>
      <hr/>
      <div id="footer">
        <p>
          <a href="mailto:sqlite-users@mailinglists.sqlite.org?subject=SQLite.NET%20Class%20Library%20Documentation%20Feedback:%20Designer%20Support">
            Send comments on this topic.</a>
        </p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>

Added Doc/Extra/Provider/environment.html.































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>Environment Variables</title>
    <link rel="stylesheet" type="text/css" href="../Include/ndoc.css" />
  </head>
  <body>
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">Environment Variables</span>
          </td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite.NET Class Library Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <p>
        The following <b>special replacement tokens</b> may be recognized and
        replaced with their associated runtime value, depending on context,
        when setting values are being read by the native library pre-loading
        subsystem.  Unless otherwise stated explicitly, all of these tokens
        are <b>case-sensitive</b> and the percent characters <b>must be
        included</b> in order for them to be recognized.
      </p>
      <p>
        All references to <b>special replacement tokens</b> will be expanded to
        their corresponding values within the returned settings values unless
        either the &quot;No_Tokens&quot; or &quot;No_Tokens_&lt;name&gt;&quot;
        environment variable is set [to anything].
      </p>
      <table width="80%" cellpadding="0" cellspacing="0">
        <tr valign="top">
          <th>Name</th>
          <th>Description</th>
        </tr>
        <tr valign="top">
          <td>%PreLoadSQLite_AssemblyDirectory%</td>
          <td>If this token (which is <b>case-sensitive</b> and <b>must include
          the percent characters</b>) is present within a setting value being
          returned, it will be replaced with the qualified name of the
          directory containing the System.Data.SQLite assembly.  If the name of
          the directory is not available, the token will not be replaced.</td>
        </tr>
        <tr valign="top">
          <td>%PreLoadSQLite_TargetFramework%</td>
          <td>If this token (which is <b>case-sensitive</b> and <b>must include
          the percent characters</b>) is present within a setting value being
          returned, it will be replaced with an abbreviation of the target
          framework attribute value for the System.Data.SQLite assembly.  If
          the target framework attribute value is not available, the token will
          not be replaced.</td>
        </tr>
        <tr valign="top">
          <td>%PreLoadSQLite_XmlConfigDirectory%</td>
          <td>If this token (which is <b>case-sensitive</b> and <b>must include
          the percent characters</b>) is present within a setting value
          being returned, it will be replaced with the qualified name of the
          directory containing the XML configuration file.  If the name of the
          directory is not available, the token will not be replaced.
          Generally, this token may only be used within the XML configuration
          file itself.</td>
        </tr>
      </table>
      <p>
        These environment variables are used to control several features of
        the System.Data.SQLite library.  All of these environment variables
        are optional.  If a particular environment variable is not present,
        the XML configuration file &quot;System.Data.SQLite.dll.config&quot;
        in the directory containing the currently executing assembly (i.e.
        the one containing all the managed components for System.Data.SQLite)
        will also be consulted.  If present, the XML configuration file should
        be structured as follows:
        <pre>
        &lt;?xml version=&quot;1.0&quot;?&gt;
        &lt;configuration&gt;
          &lt;appSettings&gt;
            &lt;add key=&quot;A_Setting&quot; value=&quot;String Value&quot; /&gt;
            &lt;add key=&quot;Another_Setting&quot; value=&quot;%ENV_VALUE%&quot; /&gt;
          &lt;/appSettings&gt;
        &lt;/configuration&gt;
        </pre>
      </p>
      <p>
        All references to existing environment variables will be expanded to
        their corresponding values within the returned settings values unless
        either the &quot;No_Expand&quot; or &quot;No_Expand_&lt;name&gt;&quot;
        environment variable is set [to anything].
      </p>
      <p>
        <font color="red">
          None of these environment variables are supported by the Compact
          Framework builds of System.Data.SQLite, due to limitations imposed
          by the platform itself; however, the XML configuration file mentioned
          above may be used instead.
        </font>
      </p>
      <table width="80%" cellpadding="0" cellspacing="0">
        <tr valign="top">
          <th>Name</th>
          <th>Description</th>
        </tr>
        <tr valign="top">
          <td>AppendManifestToken_SQLiteProviderManifest</td>
          <td>If this environment variable is set [to anything], it will be
          used by the System.Data.SQLite.Linq.SQLiteProviderManifest class
          (and the System.Data.SQLite.EF6.SQLiteProviderManifest class) to
          modify future provider manifest tokens by appending the value of
          the environment variable to the existing provider manifest token,
          if any.  Typically, in order for the constructed provider manifest
          token to be syntactically correct, the environment variable value
          [to be appended] must begin with a semicolon.</td>
        </tr>
        <tr valign="top">
          <td>DefaultFlags_SQLiteConnection</td>
          <td>If this environment variable is set [to anything], it will be
          used by the System.Data.SQLite.SQLiteConnection class as the default
          flags for all opened connections (i.e. when they are not present in
          the connection string).</td>
        </tr>
        <tr valign="top">
          <td>Disable_SQLiteLog</td>
          <td>If this configuration variable is set [to anything], the SQLite
          logging subsystem will be initially disabled when initialized.</td>
        </tr>
        <tr valign="top">
          <td>Force_SQLiteLog</td>
          <td>If this environment variable is set [to anything], the SQLite
          logging subsystem may be initialized in a non-default application
          domain.  By default, this is not allowed due to the potential for
          application domain unloading issues.</td>
        </tr>
        <tr valign="top">
          <td>Initialize_SQLiteLog</td>
          <td>If this environment variable is set [to anything], the SQLite
          logging subsystem will attempt to perform initialization even when
          an attempt was previously made.</td>
        </tr>
        <tr valign="top">
          <td>No_PreLoadSQLite</td>
          <td>If this environment variable is set [to anything], the native
          library pre-loading code will be disabled.  By default, the native
          library pre-loading code will attempt to load the native SQLite
          library from architecture-specific (e.g. &quot;x86&quot;,
          &quot;amd64&quot;, &quot;x64&quot;) or platform-specific (e.g.
          &quot;Win32&quot;) directories that reside underneath the application
          base directory.</td>
        </tr>
        <tr valign="top">
          <td>No_SQLiteConnectionNewParser</td>
          <td>If this environment variable is set [to anything], the new
          connection string parsing algorithm will not be used.  This
          environment variable is intended for use with legacy code only.</td>
        </tr>
        <tr valign="top">
          <td>No_SQLiteFunctions</td>
          <td>If this environment variable is set [to anything], the initial
          search for types in all loaded assemblies that are tagged with the
          SQLiteFunction attribute will be skipped.  Normally, this search is
          conducted only once per application domain by the static constructor
          of the SQLiteFunction class; however, these implementation details
          are subject to change.</td>
        </tr>
        <tr valign="top">
          <td>No_SQLiteGetSettingValue</td>
          <td>If this environment variable is set [to anything], all calls to
          the GetSettingValue method will return the default value.  This will
          effectively prevent all other setting values from having any effect,
          including those specified via other supported environment variables
          or in the associated XML configuration file.</td>
        </tr>
        <tr valign="top">
          <td>No_SQLiteLog</td>
          <td>If this environment variable is set [to anything], the SQLite
          logging subsystem will not be initialized by the SQLiteLog class;
          however, it may still be initialized by external components (i.e.
          something other than System.Data.SQLite).</td>
        </tr>
        <tr valign="top">
          <td>No_SQLiteXmlConfigFile</td>
          <td>If this environment variable is set [to anything], calls to the
          GetSettingValue method will never result in the XML configuration
          file being read; instead, the default value will be returned.  This
          will effectively prevent any setting values specified via the XML
          configuration file from having any effect.</td>
        </tr>
        <tr valign="top">
          <td>PreLoadSQLite_AllowBaseDirectoryOnly</td>
          <td>If this environment variable is set [to anything], the base
          directory itself is considered valid for pre-loading the native
          SQLite library.</td>
        </tr>
        <tr valign="top">
          <td>PreLoadSQLite_BaseDirectory</td>
          <td>If this environment variable is set [to anything], it will be
          used instead of the application base directory by the native
          library pre-loader.  This environment variable can be especially
          useful in ASP.NET and other hosted environments where direct control
          of the location of the managed assemblies is not under the control
          of the application.</td>
        </tr>
        <tr valign="top">
          <td>PreLoadSQLite_BreakIntoDebugger</td>
          <td>If this environment variable is set [to anything], the native
          library pre-loader subsystem will attempt to give the interactive
          user an opportunity to attach a debugger to the current process.</td>
        </tr>
        <tr valign="top">
          <td>PreLoadSQLite_LibraryFileNameOnly</td>
          <td>If this environment variable is set [to anything], it will be
          used as the base file name (without directory information) for the
          native SQLite library to be pre-loaded (e.g. "sqlite3.dll" or
          "libsqlite3.so.0").</td>
        </tr>
        <tr valign="top">
          <td>PreLoadSQLite_NoSearchForDirectory</td>
          <td>If this environment variable is set [to anything], the native
          library pre-loading code will skip conducting a search for the native
          library to pre-load.  By default, the search starts in the location
          of the currently executing assembly (i.e. the assembly containing all
          the managed components for System.Data.SQLite) and then falls back to
          the application domain base directory.</td>
        </tr>
        <tr valign="top">
          <td>PreLoadSQLite_ProcessorArchitecture</td>
          <td>If this environment variable is set [to anything], it will be
          used instead of the processor architecture value contained in the
          PROCESSOR_ARCHITECTURE environment variable to help build the path
          of the native library to pre-load.</td>
        </tr>
        <tr valign="top">
          <td>PreLoadSQLite_UseAssemblyDirectory</td>
          <td>If this environment variable is set [to anything], the location
          of the currently executing assembly (i.e. the one containing all the
          managed components for System.Data.SQLite) will be used as the basis
          for locating the the native library to pre-load (i.e. instead of
          using the application domain base directory).</td>
        </tr>
        <tr valign="top">
          <td>PROCESSOR_ARCHITECTURE</td>
          <td>This environment variable is normally set by the operating
          system itself and should reflect the native processor architecture
          of the current process (e.g. a 32-bit x86 application running on a
          64-bit x64 operating system should have the value &quot;x86&quot;).
          </td>
        </tr>
        <tr valign="top">
          <td>SQLite_ForceLogLifecycle</td>
          <td>If this environment variable is set [to anything], calls into
          key members pertaining to the lifecycle of connections and their
          associated classes (e.g. LINQ, EF6, etc) will be logged.</td>
        </tr>
        <tr valign="top">
          <td>SQLite_ForceLogPrepare</td>
          <td>If this environment variable is set [to anything], all calls to
          prepare a SQL query will be logged, regardless of the flags for the
          associated connection.</td>
        </tr>
        <tr valign="top">
          <td>SQLite_ForceLogRetry</td>
          <td>If this environment variable is set [to anything], all internal
          retries during statment preparation and stepping will be logged,
          regardless of the flags for the associated connection.</td>
        </tr>
        <tr valign="top">
          <td>SQLite_GlobalCommandBehaviors</td>
          <td>If this environment variable is set [to anything], it will be
          processed as a list of CommandBehavior flags, if possible.  It will
          be ignored if it cannot be processed correctly.  For more details
          please refer to the CombineBehaviors method.</td>
        </tr>
        <tr valign="top">
          <td>SQLite_LegacyEncryptPage1</td>
          <td>If this environment variable is set [to anything], page #1 of
          database files encrypted using the (unsupported) legacy
          CryptoAPI-based (RC4) codec will be encrypted.  This was the default
          behavior prior to release 1.0.112.3; however, it is now disabled (by
          default) as it can cause corruption and/or other malfunctions in some
          circumstances.  Please do not use this environment variable unless it
          is absolutely necessary for your specific use case.</td>
        </tr>
        <tr valign="top">
          <td>SQLite_StrongConnectionPool</td>
          <td>If this environment variable is set [to anything], the default
          connection pool will use normal objects instead of weak references.
          This should prevent any pooled connection objects from ever being
          automatically cleaned up by the garbage collector.
          </td>
        </tr>
        <tr valign="top">
          <td>TypeName_SQLiteProviderServices</td>
          <td>If this environment variable is set [to anything], it will be
          used by the System.Data.SQLite.SQLiteFactory class as the type name
          containing the System.Data.Common.DbProviderServices implementation
          that should be used.</td>
        </tr>
        <tr valign="top">
          <td>Use_SQLiteConvert_DefaultDbType</td>
          <td>If this environment variable is set [to anything], it will be
          used by the System.Data.SQLite.SQLiteConvert class as the default
          DbType value that should be used when a per-connection value is not
          available.</td>
        </tr>
        <tr valign="top">
          <td>Use_SQLiteConvert_DefaultTypeName</td>
          <td>If this environment variable is set [to anything], it will be
          used by the System.Data.SQLite.SQLiteConvert class as the default
          type name that should be used when a per-connection value is not
          available.</td>
        </tr>
      </table>
      <hr/>
      <div id="footer">
        <p>
          <a href="mailto:sqlite-users@mailinglists.sqlite.org?subject=SQLite.NET%20Class%20Library%20Documentation%20Feedback:%20Environment%20Variables">
            Send comments on this topic.</a>
        </p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>

Added Doc/Extra/Provider/lang_types.html.















































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>TYPES</title>
    <link rel="stylesheet" type="text/css" href="../Include/ndoc.css" />
  </head>
  <body>
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">TYPES</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite (sortof)</h1>
      <h4>
        TYPES</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">TYPES </font></b>[<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">datatype name</font></i><b><font color="#2c2cf0"></font></b>][,<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">datatype name</font></i><b><font color="#2c2cf0"></font></b>][,<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">datatype
                      name</font></i><b><font color="#2c2cf0"></font></b>][,<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">...</font></i>] ; <em><span style="color: #ff3434">select-stmt</span></em></td>            
          </tr>
          <tr>
          <td align="right" width="1%" nowrap>
          <i><font color="#ff3434">select-stmt</font></i> ::=</td>
          <td>
            see <a href="lang_select.html">SELECT</a></td>
          </tr>
        </table>
      </p>
      <p>
        Use the TYPES keyword before a SELECT statement to provide the SQLite ADO.NET provider
        a list of return datatypes to expect from the subsequent SELECT statement.&nbsp;
      </p>
      <p>
        This is a language extension (aka <strong>hack</strong>) to SQLite specifically for the ADO.NET data
        provider.&nbsp; It is a pseudo-statement, meaning only the ADO.NET provider understands
        it.</p>
      <h3>
        Background</h3>
      <p>
        Due to SQLite's typeless nature, there are certain kinds of queries for which the
        ADO.NET provider cannot determine the proper return data type.&nbsp; Scalar and
        aggregate functions pose a particular problem because
        there is no requirement for a given scalar or aggregate function to return any particular
        datatype.&nbsp; As a matter of fact, scalar functions could theoretically return
        a different datatype for every row or column in a query and this is perfectly legal
        from SQLite's point of view.</p>
      <p>
        Since ADO.NET is designed around a typed system and we're shoe-horning SQLite into
        it, this keyword helps the provider out in cases where the return type cannot be easily determined.</p>
      <p>
        This command must be used in conjunction with a SELECT statement.&nbsp; It only
        works when both the TYPES keyword and its value(s) are passed along with a SELECT
        statement as a single semi-colon separated unit.</p>
      <h3>
        Examples</h3>
      <p>
        <strong><span style="color: #2c2cf0">TYPES</span> [bigint], [int], [mediumint], [smallint], [tinyint];<br />
          <span style="color: #2c2cf0">SELECT</span> 1, 2, 3, 4;</strong></p>
      <p>
        The above query would return the columns as types System.Int64, System.Int32, System.Int32, System.Int16
        and System.Byte respectively.</p>
      <p>
        <strong><span style="color: #2c2cf0">TYPES</span> [bigint], [int], , [tinyint];<br />
          <span style="color: #2c2cf0">SELECT</span> 1, 2, 3, 4;</strong></p>
      <p>
        In this sample, only columns 1, 2 and 4 would have explicit typing.&nbsp; Column
        3's datatype would pass though the system and be discovered normally.</p>
      <p>
        <strong><span style="color: #2c2cf0">TYPES</span> real;<br />
          <span style="color: #2c2cf0">SELECT</span> SUM(Cost) FROM [Products];</strong></p>
      <p>
        The above query explicitly tells the provider that the SUM aggregate function returns
        a System.Double.</p>
      <h3>
        Usage Notes</h3>
      <ul>
        <li>You cannot use parameters in the TYPES statement.</li>
        <li>The TYPES statement must be immediately followed by a SELECT statement.</li>
        <li>It is legal to pass multiple TYPES and SELECT statements in a multi-statement
          command.</li>
        <li>You may enclose datatypes in quotes <strong>""</strong> or brackets <strong>[]</strong>
          or those <strong>``</strong> thingies if you want.<br />
        </li>
      </ul>
      <hr>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>

Added Doc/Extra/Provider/limitations.html.





























































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>Provider Limitations</title>
    <link rel="stylesheet" type="text/css" href="../Include/ndoc.css" />
  </head>
  <body>
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">Provider Limitations</span>
          </td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite.NET Class Library Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">Limitations of this ADO.NET SQLite Data Provider</h1>
      <p>As providers go, this one doesn't have many restrictions. SQLite has no
        support for row-level or table-level locks. When a connection locks the database for writing, no other connection or process may read or write to the database until the write operation is complete.  The SQLite.NET provider attempts to retry
        internally if a database is locked, up to the CommandTimeout property of the
        command in question.</p>
      <p>SQLite is inherently type-less, and only understands a few basic datatypes
        natively. They are (in .NET-speak) Int64, Double, String and Blob. The
        SQLite.NET provider will use the database schema information it can glean to
        enforce type-ness, but it is an inexact science.</p>
      <p>
        Hierarchical DataReaders are not supported. In the
        case of transactions, any SQLiteCommand created on a connection will (when
        executed) automatically join a transaction in progress, regardless of whether
        that transaction was created before or after the command.</p>
      <p>A SQLiteCommand object <b>can</b> be re-assigned a new SQLiteConnection object
        as long as no DataReaders are active on the command.</p>
      <p>Opening a transaction is considered a write operation, so only use them when
        you want to write to the database! If you hold open an &quot;immediate&quot;
        transaction, all readers on other connections will be blocked until the
        transaction is closed!</p>
      <p></p>
      <h4 class="subHeading">Thread Safety</h4>
      <p>Multi-threading in SQLite must be done carefully. Here are the restrictions:</p>
      <ul>
        <li>
          <b>You May</b>
        Clone() a SQLiteConnection object in one thread and pass the cloned object to
        another thread. Once passed, the other thread becomes the new owner of the
        cloned connection, and the original thread must not keep a reference to the
        clone or call any methods on the clone.
        <LI>
          <STRONG>You May</STRONG>
        create multiple threads, and those threads can create their own
        SQLiteConnection and subsequent objects for accessing a database.&nbsp;
        Multiple connections on multiple threads to the same database file are
        perfectly&nbsp;acceptable&nbsp;and will behave predictably.&nbsp;
        <li>
          <b>You May NOT</b>
        call methods or properties or otherwise reference any SQLite provider classes
        that belong to another thread.
        <li>
          <b>You May NOT</b> pass a SQLiteCommand, SQLiteDataReader, SQLiteDataAdapter or
          any other SQLite provider class except a cloned SQLiteConnection to another
          thread.</li>
      </ul>
      <p>Understand again that SQLite has no fine-grained locking mechanisms. It is
        therefore your own responsibility in a multi-threaded environment to handle
        potential timeouts that may occur if a long-running query in one thread
        prevents a query in another thread from executing. These timeouts will only
        occur if one thread is attempting to read while another thread is attempting to
        write. Whichever thread got its lock first will be the one to execute, and the
        other thread will block until the CommandTimeout value elapses or the other
        thread finishes.</p>
      <hr/>
      <div id="footer">
        <p>
          <a href="mailto:sqlite-users@mailinglists.sqlite.org?subject=SQLite.NET%20Class%20Library%20Documentation%20Feedback:%20Limitations">
            Send comments on this topic.</a>
        </p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>

Added Doc/Extra/Provider/optimizing.html.













































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>Optimizing Your Queries</title>
    <link rel="stylesheet" type="text/css" href="../Include/ndoc.css" />
  </head>
  <body>
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">Optimizing for SQLite</span>
          </td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite.NET Class Library Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">Tips on Optimizing Your Queries</h1>
      <p>The next few paragraphs will attempt to give you a few rudimentary rules for 
        speeding up your queries in general, and especially how SQLite is adversely 
        affected by the kinds of SQL behaviors you may have taken for granted in other 
        providers. It is by no means a complete optimization guide. For even more 
        details on optimizing your queries, visit <a href="https://www.sqlite.org">sqlite.org</a>.</p>
      <h4 class="subHeading">The Importance of Transactions</h4>
      <p>If you are inserting data in SQLite without first starting a transaction: <b>DO 
          NOT PASS GO! Call BeginTransaction() right now, and finish with Commit()!</b> 
        If you think I'm kidding, think again. SQLite's A.C.I.D. design means that 
        every single time you insert any data outside a transaction, an implicit 
        transaction is constructed, the insert made, and the transaction destructed. <b>EVERY 
          TIME.</b> If you're wondering why in the world your inserts are taking 100x 
        longer than you think they should, look no further.</p>
      <h4 class="subHeading">Prepared Statements</h4>
      <p>Lets have a quick look at the following code and evaluate its performance:</p>
      <div class="syntax">
        <pre>
      using (SQLiteCommand mycommand = new SQLiteCommand(myconnection))
      {
        int n;
        
        for (n = 0; n < 100000; n ++)
        {
          mycommand.CommandText = String.Format("INSERT INTO [MyTable] ([MyId]) VALUES({0})", n + 1);
          mycommand.ExecuteNonQuery();
        }
      }</pre>
      </div>
      <p>This code seems pretty tight, but if you think it performs well, you're dead 
        wrong. Here's what's wrong with it:</p>
      <ul>
        <li>
          I didn't start a transaction first! This insert is dog slow!</li>
        <li>
          The CLR is calling "new" implicitly 100,000 times because I am formatting a 
          string in the loop for every insert</li>
        <li>
          Since SQLite precompiles SQL statements, the engine is constructing and 
          deconstructing 100,000 SQL statements and allocating/deallocating their memory</li>
        <li>
          All this construction and destruction is involving about 300,000 more native to 
          managed interop calls than an optimized insert</li>
      </ul>
      <p>So lets rewrite that code slightly:</p>
      <div class="syntax">
        <pre>
      using (SQLiteTransaction mytransaction = myconnection.BeginTransaction())
      {
        using (SQLiteCommand mycommand = new SQLiteCommand(myconnection))
        {
          SQLiteParameter myparam = new SQLiteParameter();
          int n;
        
          mycommand.CommandText = "INSERT INTO [MyTable] ([MyId]) VALUES(?)";
          mycommand.Parameters.Add(myparam);
          
          for (n = 0; n < 100000; n ++)
          {
            myparam.Value = n + 1;
            mycommand.ExecuteNonQuery();
          }
        }
        mytransaction.Commit();
      } </pre>
      </div>
      <p>Now this is a blazing fast insert for <b><i>any</i></b> database engine, not 
        just SQLite. The SQL statement is prepared one time -- on the first call to 
        ExecuteNonQuery(). Once prepared, it never needs re-evaluating. Furthermore, 
        we're allocating no memory in the loop and doing a very minimal number of 
        interop transitions. Surround the entire thing with a transaction, and the 
        performance of this insert is so far and away faster than the original that it 
        merits a hands-on-the-hips pirate-like laugh.</p>
      <p>Every database engine worth its salt utilizes prepared statements. If you're 
        not coding for this, you're not writing optimized SQL, and that's the bottom 
        line.
      </p>
      <hr />
      <div id="footer">
        <p>
          <a href="mailto:sqlite-users@mailinglists.sqlite.org?subject=SQLite.NET%20Class%20Library%20Documentation%20Feedback:%20Optimizing">
            Send comments on this topic.</a>
        </p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>

Added Doc/Extra/Provider/syntax.html.

















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>SQLite Query Syntax</title>
    <link rel="stylesheet" type="text/css" href="../Include/ndoc.css" />
  </head>
  <body>
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">SQLite Query Syntax</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By System.Data.SQLite</h1>
      <p>
        The SQLite library understands most of the standard SQL language. But it does omit
        some features while at the same time adding a few features of its own. This document
        attempts to describe precisely what parts of the SQL language SQLite does and does
        not support. A list of keywords is also provided. In all of the syntax diagrams
        that follow, literal text is shown in bold blue. Non-terminal symbols are shown
        in italic red. Operators that are part of the syntactic markup itself are shown
        in black roman. This document is just an overview of the SQL syntax implemented
        by SQLite.
      </p>
      <h4>
        The SQLite core library implements the follow syntax:</h4>
      <p>
        <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse">
          <tr>
            <td>
              <a href="../Core/lang.html">
              SQL As Understood By SQLite</a></td>
          </tr>
        </table>
      </p>
      <h4>
        The System.Data.SQLite provider implements the follow additional syntax:</h4>
      <p>
        <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse">
          <tr>
            <td>
              <a href="lang_types.html">
              TYPES</a></td>
          </tr>
        </table>
      </p>
      <hr>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>

Added Doc/Extra/Provider/version.html.









































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>Version History</title>
    <link rel="stylesheet" type="text/css" href="../Include/ndoc.css" />
  </head>
  <body>
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">Version History</span>
          </td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite.NET Class Library Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
    <h1 class="heading">Version History</h1>
    <p><b>1.0.119.0 - May XX, 2024 <font color="red">(release scheduled)</font></b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_45_3.html">SQLite 3.45.3</a>.</li>
      <li>Update internal resource list of reserved SQL words.</li>
      <li>Avoid NullReferenceException from Path.Combine method when the PublishSingleFile property is enabled for a project. Pursuant to forum post <a href="https://www.sqlite.org/forum/forumpost/66a0d2716a">[66a0d2716a]</a>.</li>
      <li>Add the VfsName connection string property.</li>
      <li>Fix rarely seen NullReferenceException in the StaticWeakConnectionPool.Add method.</li>
      <li>Revise the calculation used to bind DateTime values. Fix for <a href="https://system.data.sqlite.org/index.html/info/bbddfeb773">[bbddfeb773]</a>.</li>
    </ul>
    <p><b>1.0.118.0 - June 10, 2023</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_42_0.html">SQLite 3.42.0</a>.</li>
      <li>Add the ConnectionStringPreview, SqlStringPreview, and Canceled connection events.</li>
      <li>Add support for the sqlite3_is_interrupted core library API. Pursuant to forum post <a href="https://www.sqlite.org/forum/forumpost/b6a707bffb">[b6a707bffb]</a>.</li>
      <li>Add support for the sqlite_trace_v2 core library API. Pursuant to forum post <a href="https://www.sqlite.org/forum/forumpost/1c418d7edc">[1c418d7edc]</a>.</li>
      <li>Add TextHexPassword connection string property for use with <a href="https://www.sqlite.org/see">SEE</a>.</li>
      <li>Add SQLite_ForceLogRetry environment variable to force logging of all internal retries during statment preparation and stepping.</li>
      <li>Add StepRetries connection string property to allow the maximum number of retries when stepping a query to be overridden.</li>
      <li>Fix ExecuteScalar and ExecuteNonQuery handling of write transactions that require more than one call to step. Pursuant to forum post <a href="https://www.sqlite.org/forum/forumpost/f4e718891d">[f4e718891d]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Parameter names should be case-sensitive. Fix for <a href="https://system.data.sqlite.org/index.html/info/e22d357a21">[e22d357a21]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    </ul>
    <p><b>1.0.117.0 - November 28, 2022</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_40_0.html">SQLite 3.40.0</a>.</li>
      <li>Add support for creating custom window functions. Pursuant to forum post <a href="https://www.sqlite.org/forum/forumpost/21de219031">[21de219031]</a>.</li>
      <li>Suppress finalizer calls for SQLite3 objects that are closed. Fix for <a href="https://system.data.sqlite.org/index.html/info/ce4d70ea6f">[ce4d70ea6f]</a>.</li>
      <li>Improvements to object disposal diagnostics. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/ce4d70ea6f">[ce4d70ea6f]</a>.</li>
      <li>Add MaximumSleepTime property to the SQLiteCommand class and DefaultMaximumSleepTime connection string property.</li>
      <li>Add experimental support for running the test suite using .NET 5 and .NET 6.</li>
      <li>Add experimental support for native sha3 extension.</li>
    </ul>
    <p><b>1.0.116.0 - June 1, 2022</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_38_5.html">SQLite 3.38.5</a>.</li>
      <li>More flexible connection pooling via the new ISQLiteConnectionPool2 interface.</li>
      <li>Add SQLite_StrongConnectionPool environment variable to prevent pooled connections from being garbage collected.</li>
      <li>Improvements to object disposal handling for database connections.</li>
    </ul>
    <p><b>1.0.115.5 - November 2, 2021</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/src/info/ca2703c339f76101">SQLite trunk</a>.</li>
      <li>Add Busy event to the SQLiteConnection class. Pursuant to forum post <a href="https://www.sqlite.org/forum/forumpost/08a52f61fc">[08a52f61fc]</a>.</li>
      <li>Fix metadata UTF-16 string length calculations on Linux. Fix for forum post <a href="https://www.sqlite.org/forum/forumpost/eeaefb84ec">[eeaefb84ec]</a>.</li>
    </ul>
    <p><b>1.0.115.0 - August 25, 2021</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_36_0.html">SQLite 3.36.0</a>.</li>
    </ul>
    <p><b>1.0.114.0 - May 22, 2021</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_35_5.html">SQLite 3.35.5</a>.</li>
      <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.4.4">Entity Framework 6.4.4</a>.</li>
      <li>Add preliminary support for the .NET Framework 4.8.</li>
      <li>Add support for math functions now provided by the SQLite core library.</li>
      <li>Add support for <a href="https://www.sqlite.org/compile.html#enable_update_delete_limit">ORDER BY and LIMIT for UPDATE and DELETE</a>.</li>
      <li>Add TextPassword connection string property for use with <a href="https://www.sqlite.org/see">SEE</a>.</li>
    </ul>
    <p><b>1.0.113.0 - June 1, 2020</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_32_1.html">SQLite 3.32.1</a>.</li>
      <li>Add SQLite_ForceLogLifecycle environment variable to force logging of calls into key members pertaining to the lifecycle of connections and their associated classes (e.g. LINQ, EF6, etc).</li>
      <li>Support automatic value conversions for columns with a declared type of MEDIUMINT or MEDIUMUINT. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/515cb60b10">[515cb60b10]</a>.</li>
    </ul>
    <p><b>1.0.112.3 - Xxxx XX, 2020</b></p>
    <ul>
      <li>When using the (unsupported) legacy CryptoAPI-based (RC4) codec, skip encrypting page #1 because that can lead to database corruption and other malfunctions.</li>
      <li>Add SQLite_ForceLogLifecycle environment variable to force logging of calls into key members pertaining to the lifecycle of connections and their associated classes (e.g. LINQ, EF6, etc).</li>
      <li>Support automatic value conversions for columns with a declared type of MEDIUMINT or MEDIUMUINT. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/515cb60b10">[515cb60b10]</a>.</li>
    </ul>
    <p><b>1.0.112.2 - April 27, 2020</b></p>
    <ul>
      <li>Fix NuGet packaging for .NET Standard 2.1. Fix for <a href="https://system.data.sqlite.org/index.html/info/7c73262e6f">[7c73262e6f]</a>.</li>
    </ul>
    <p><b>1.0.112.1 - April 6, 2020</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_31_1.html">SQLite 3.31.1</a>.</li>
      <li>Include the &quot;LINQ&quot; partial classes in the primary managed assembly for .NET Standard 2.1. Fix for <a href="https://system.data.sqlite.org/index.html/info/ad28d8e026">[ad28d8e026]</a>.</li>
    </ul>
    <p><b>1.0.112.0 - October 28, 2019</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_30_1.html">SQLite 3.30.1</a>.</li>
      <li>Add preliminary support for .NET Core 3.0 and the .NET Standard 2.1. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/ce75d320d0">[ce75d320d0]</a>.</li>
      <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.3.0">Entity Framework 6.3.0</a>.</li>
      <li>Add support for new DBCONFIG options from the SQLite core library. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/03b6b0edd7">[03b6b0edd7]</a>.</li>
      <li>Add SetLimitOption method to the SQLiteConnection class.</li>
    </ul>
    <p><b>1.0.111.0 - June 10, 2019</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_28_0.html">SQLite 3.28.0</a>.</li>
      <li>Add No_SQLiteLog environment variable.</li>
    </ul>
    <p><b>1.0.110.0 - March 4, 2019</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_27_2.html">SQLite 3.27.2</a>.</li>
      <li>Add HidePassword connection flag to remove the password from the connection string once the database is opened. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/23d8d6171e">[23d8d6171e]</a>.</li>
      <li>Add experimental StrictConformance connection flag to force strict compliance to the ADO.NET standard. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/e36e05e299">[e36e05e299]</a>.</li>
      <li>Add support for the <a href="https://www.sqlite.org/session/c_changesetstart_invert.html">sqlite3changeset_start_v2()</a> and <a href="https://www.sqlite.org/session/c_changesetstart_invert.html">sqlite3changeset_start_v2_strm()</a> interfaces.</li>
    </ul>
    <p><b>1.0.109.0 - August 15, 2018</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_24_0.html">SQLite 3.24.0</a>.</li>
      <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.2.0">Entity Framework 6.2.0</a>.</li>
      <li>Do not attempt to initialize the logging subsystem more than once.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Prevent GetSchemaTable from throwing InvalidCastException. Fix for <a href="https://system.data.sqlite.org/index.html/info/baf42ee135">[baf42ee135]</a>.</li>
      <li>Add preliminary support for the .NET Framework 4.7.2.</li>
      <li>Add preliminary support for .NET Core 2.0 and the .NET Standard 2.0. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/5c89cecd1b">[5c89cecd1b]</a>.</li>
      <li>Add simpler overload for the SQLiteBlob.Create method. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/dfc8133ba2">[dfc8133ba2]</a>.</li>
      <li>Add GetFieldAffinity method to the SQLiteDataReader class.</li>
    </ul>
    <p><b>1.0.108.0 - March 2, 2018</b></p>
    <ul>
      <li>Support extended result codes when messages are looked up without the SQLite core library.</li>
      <li>Override System.Object members for the SQLiteException class to improve its ToString return value. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/53962f9eff">[53962f9eff]</a>.</li>
      <li>More database connection configuration options for the <a href="https://www.sqlite.org/c3ref/db_config.html">sqlite3_db_config()</a> interface.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Set HResult property of SQLiteException based on the SQLite core library error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Modify experimental WaitForEnlistmentReset method to require a nullable boolean parameter for the value to return when the connection is disposed.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    </ul>
    <p><b>1.0.107.0 - January 30, 2018</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_22_0.html">SQLite 3.22.0</a>.</li>
      <li>Improve performance of type name lookups by removing superfluous locking and string creation.</li>
      <li>Support asynchronous completion of distributed transactions. Fix for <a href="https://system.data.sqlite.org/index.html/info/5cee5409f8">[5cee5409f8]</a>.</li>
      <li>Add experimental WaitForEnlistmentReset method to the SQLiteConnection class. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/7e1dd697dc">[7e1dd697dc]</a>.</li>
      <li>Fix some internal memory accounting present only in the debug build.</li>
      <li>Make sure inbound native delegates are unhooked before adding a connection to the pool. Fix for <a href="https://system.data.sqlite.org/index.html/info/0e48e80333">[0e48e80333]</a>.</li>
      <li>Add preliminary support for the .NET Framework 4.7.1.</li>
      <li>Updates to internal DbType mapping related lookup tables. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/a799e3978f">[a799e3978f]</a>.</li>
    </ul>
    <p><b>1.0.106.0 - November 2, 2017</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_21_0.html">SQLite 3.21.0</a>.</li>
      <li>Add full support for the native <a href="https://www.sqlite.org/sessionintro.html">session</a> extension.</li>
      <li>Add BindDecimalAsText and GetDecimalAsText connection flags to force binding and returning of decimal values as text. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/b167206ad3">[b167206ad3]</a>.</li>
      <li>Add BindInvariantDecimal and GetInvariantDecimal connection flags, enabled by default, to force binding and returning of decimal values using the invariant culture. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/b167206ad3">[b167206ad3]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Add preliminary support for Visual Studio 2017 and the .NET Framework 4.7. This does <b>not</b> include support for the design-time components for Visual Studio, see <a href="https://system.data.sqlite.org/index.html/info/8292431f51">[8292431f51]</a>.</li>
    </ul>
    <p><b>1.0.105.2 - June 12, 2017</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_19_3.html">SQLite 3.19.3</a>.</li>
      <li>Fix issues that prevented SQLiteBlob creation from succeeding for tables that did not have an integer primary key.</li>
    </ul>
    <p><b>1.0.105.1 - May 15, 2017</b></p>
    <ul>
      <li>Prevent culture settings from negatively impacting integer connection string defaults.</li>
      <li>Make sure the &quot;No_SQLiteConnectionNewParser&quot; and &quot;DefaultFlags_SQLiteConnection&quot; setting values end up being cached.</li>
      <li>Cache the XML file name and assembly directory used by the configuration subsystem.</li>
    </ul>
    <p><b>1.0.105.0 - April 9, 2017</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_18_0.html">SQLite 3.18.0</a>.</li>
      <li>Add experimental support for native sha1 extension.</li>
    </ul>
    <p><b>1.0.104.0 - December 16, 2016</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_15_2.html">SQLite 3.15.2</a>.</li>
      <li>Add the &quot;%PreLoadSQLite_AssemblyDirectory%&quot;, &quot;%PreLoadSQLite_TargetFramework%&quot;, and &quot;%PreLoadSQLite_XmlConfigDirectory%&quot; <a href="https://system.data.sqlite.org/index.html/artifact?ci=trunk&filename=Doc/Extra/Provider/environment.html">replacement tokens</a> for use in configuration setting values. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/d4728aecb7">[d4728aecb7]</a>.</li>
      <li>Prevent the GetByte, GetChar, and GetInt16 methods of the SQLiteDataReader class from throwing exceptions for large integer values. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/5535448538">[5535448538]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Use <a href="https://www.sqlite.org/lang_savepoint.html">SAVEPOINTs</a> to properly implement nested transactions when the new AllowNestedTransactions connection flag is used. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/1f7bfff467">[1f7bfff467]</a>.</li>
      <li>When converting a Julian Day value to an integer, round to the nearest millisecond first. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/69cf6e5dc8">[69cf6e5dc8]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    </ul>
    <p><b>1.0.103.0 - September 15, 2016</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_14_2.html">SQLite 3.14.2</a>.</li>
      <li>Add preliminary support for the .NET Framework 4.6.2.</li>
      <li>Change the SQLiteReadValueCallback delegate &quot;eventArgs&quot; parameter to be of type SQLiteReadEventArgs.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Make SQLiteReadValueEventArgs and SQLiteReadArrayEventArgs derive from SQLiteReadEventArgs.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Rename SQLiteReadValueEventArgs.ArrayEventArgs property to ExtraEventArgs.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Add No_SQLiteGetSettingValue and No_SQLiteXmlConfigFile environment variables.</li>
      <li>Reduce the number of calls to GetSettingValue from SQLiteConnection. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/25d53b48f6">[25d53b48f6]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Add NoVerifyTypeAffinity connection flag to disable all type affinity checking.</li>
      <li>Add support for <a href="https://www.sqlite.org/c3ref/blob_open.html">incremental blob I/O</a>.</li>
      <li>Improve support for the <a href="https://www.sqlite.org/c3ref/db_config.html">sqlite3_db_config()</a> interface. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/f64f4aee95">[f64f4aee95]</a>.</li>
    </ul>
    <p><b>1.0.102.0 - June 23, 2016</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_13_0.html">SQLite 3.13.0</a>.</li>
      <li>Update the SQLiteConnection.EnableExtensions method to make use of the new SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION option, when available.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Prevent the SQLiteCommand.ExecuteScalar method from throwing an exception when there are no result columns.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Support per-connection customization for binding parameters and reading values, based on the database type name.</li>
      <li>Add TypeName property to the SQLiteParameter class.</li>
      <li>Add VerifyOnly method to the SQLiteCommand class.</li>
      <li>Add IsReadOnly method to the SQLiteConnection class.</li>
    </ul>
    <p><b>1.0.101.0 - April 19, 2016</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_12_2.html">SQLite 3.12.2</a>.</li>
      <li>Add binary package release for Mono on POSIX.</li>
    </ul>
    <p><b>1.0.100.0 - April 15, 2016</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_12_1.html">SQLite 3.12.1</a>.</li>
      <li>Support compiling and using the interop assembly on Linux and Mac OS X.</li>
      <li>Support running the test suite under Mono on Linux and Mac OS X.</li>
      <li>Properly handle NULL values in the &quot;name&quot; column of the results returned by PRAGMA index_info(). Fix for <a href="https://system.data.sqlite.org/index.html/info/5251bd0878">[5251bd0878]</a>.</li>
      <li>For column types that resolve to boolean, recognize case-insensitive prefixes of &quot;True&quot; and &quot;False&quot;. Fix for <a href="https://system.data.sqlite.org/index.html/info/dbd65441a5">[dbd65441a5]</a>.</li>
      <li>Add NoVerifyTextAffinity connection flag to skip type affinity checking when fetching a column value as a string. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/dbd65441a5">[dbd65441a5]</a>.</li>
      <li>The UnixEpoch DateTime format should use Int64 internally, not Int32.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Avoid using Path.Combine with null values in the native library pre-loader. Fix for <a href="https://system.data.sqlite.org/index.html/info/da685c0bac">[da685c0bac]</a>.</li>
      <li>Fix the (unsupported) legacy CryptoAPI-based (RC4) codec so that it no longer prevents page size changes.</li>
    </ul>
    <p><b>1.0.99.1 - March 31, 2016</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_9_3.html">SQLite 3.9.3</a>.</li>
    </ul>
    <p><b>1.0.99.0 - December 9, 2015</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_9_2.html">SQLite 3.9.2</a>.</li>
      <li>Add preliminary support for the .NET Framework 4.6.1.</li>
      <li>Fix handling of sqlite3_index_info members not available with older versions of the SQLite core library.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Update and improve documentation comments for the native virtual table methods.</li>
      <li>Permit an existing registered function to be replaced. Fix for <a href="https://system.data.sqlite.org/index.html/info/2556655d1b">[2556655d1b]</a>.</li>
      <li>Make GetValue work for boolean columns with textual &quot;True&quot; and &quot;False&quot; values. Fix for <a href="https://system.data.sqlite.org/index.html/info/7714b60d61">[7714b60d61]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Add Reset method to the SQLiteCommand class.</li>
      <li>Add FileName property to the SQLiteConnection class.</li>
      <li>Add experimental support for the native json1 and fts5 extensions.</li>
      <li>Add GetDatabaseName, GetTableName, and GetOriginalName methods to the SQLiteDataReader class.</li>
    </ul>
    <p><b>1.0.98.0 - August 19, 2015</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_11_1.html">SQLite 3.8.11.1</a>.</li>
      <li>Add full support for Visual Studio 2015 and the .NET Framework 4.6.</li>
      <li>Add support for creating custom SQL functions using delegates.</li>
      <li>Implement the Substring method for LINQ using the &quot;substr&quot; core SQL function.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Prevent encrypted connections from being used with the connection pool. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/89d3a159f1">[89d3a159f1]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Honor the second argument to Math.Round when using LINQ.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Honor the pre-existing flags for connections during the Open method. Fix for <a href="https://system.data.sqlite.org/index.html/info/964063da16">[964063da16]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Remove errant semi-colons from the SQL used by LINQ to INSERT and then SELECT rows with composite primary keys. Fix for <a href="https://system.data.sqlite.org/index.html/info/9d353b0bd8">[9d353b0bd8]</a>.</li>
      <li>Refactor INSERT/UPDATE handling (in the LINQ assembly) so it can handle composite and non-integer primary keys. Fix for <a href="https://system.data.sqlite.org/index.html/info/41aea496e0">[41aea496e0]</a>.</li>
      <li>Change the base type for the SQLiteConnectionFlags enumeration to long integer.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Add extended return codes to the SQLiteErrorCode enumeration. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/71bedaca19">[71bedaca19]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Improve exception handling in all native callbacks implemented in the SQLiteConnection class.</li>
      <li>Add Progress event and ProgressOps connection string property to enable raising progress events during long-running queries.</li>
      <li>Add &quot;Recursive Triggers&quot; connection string property to enable or disable the recursive trigger capability. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/3a82ee635b">[3a82ee635b]</a>.</li>
      <li>Add NoDefaultFlags connection string property to prevent the default connection flags from being used. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/964063da16">[964063da16]</a>.</li>
      <li>Add VfsName connection string property to allow a non-default VFS to be used by the SQLite core library.</li>
      <li>Add BusyTimeout connection string property to set the busy timeout to be used by the SQLite core library.</li>
      <li>Add UnbindFunction and UnbindAllFunctions methods to the SQLiteConnection class.</li>
      <li>Enable integration with the <a href="https://www.hwaci.com/sw/sqlite/zipvfs.html">ZipVFS</a> extension.</li>
    </ul>
    <p><b>1.0.97.0 - May 26, 2015</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_10_2.html">SQLite 3.8.10.2</a>.</li>
      <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.1.3">Entity Framework 6.1.3</a>.</li>
      <li>Improve ADO.NET conformance of the SQLiteDataReader.RecordsAffected property. Fix for <a href="https://system.data.sqlite.org/index.html/info/74542e702e">[74542e702e]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Prevent the IDataReader.GetDataTypeName method from throwing &quot;No current row&quot; exceptions. Fix for <a href="https://system.data.sqlite.org/index.html/info/94252b9059">[94252b9059]</a>.</li>
      <li>When BinaryGUID handling is off, transform the LINQ parameter types as well. Fix for <a href="https://system.data.sqlite.org/index.html/info/a4d9c7ee94">[a4d9c7ee94]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>The IDataReader.GetDataTypeName method should always return the declared type name.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Add DefaultFlags_SQLiteConnection environment variable to enable customization of the default connection flags.</li>
      <li>Prevent calls to sqlite3_step() and sqlite3_interrupt() from being interrupted via ThreadAbortException.</li>
      <li>Make sure enabling UseUTF16Encoding sets the schema encoding to UTF-16. Fix for <a href="https://system.data.sqlite.org/index.html/info/7c151a2f0e">[7c151a2f0e]</a>.</li>
    </ul>
    <p><b>1.0.96.0 - March 5, 2015</b></p>
    <ul>
      <li>Prevent the IDataReader.GetOrdinal method from throwing &quot;No current row&quot; exceptions. Fix for <a href="https://system.data.sqlite.org/index.html/info/2be4298631">[2be4298631]</a>, <a href="https://system.data.sqlite.org/index.html/info/abad7c577d">[abad7c577d]</a>, and <a href="https://system.data.sqlite.org/index.html/info/c28d7fe915">[c28d7fe915]</a>.</li>
      <li>When counting the number of tables in the GetSchemaTable method, do not include those that have a null or empty name. Fix for <a href="https://system.data.sqlite.org/index.html/info/92dbf1229a">[92dbf1229a]</a>.</li>
    </ul>
    <p><b>1.0.95.0 - March 2, 2015</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_8_3.html">SQLite 3.8.8.3</a>.</li>
      <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.1.2">Entity Framework 6.1.2</a>.</li>
      <li>Modify configuration file transforms performed by the NuGet packages to allow Entity Framework 6 design-time integration to work automatically. Fix for <a href="https://system.data.sqlite.org/index.html/info/2be4298631">[2be4298631]</a>, <a href="https://system.data.sqlite.org/index.html/info/abad7c577d">[abad7c577d]</a>, and <a href="https://system.data.sqlite.org/index.html/info/417d669435">[417d669435]</a>.</li>
      <li>The &quot;System.Data.SQLite.EF6*&quot; and &quot;System.Data.SQLite.Linq*&quot; NuGet packages no longer depend on the &quot;System.Data.SQLite.Core*&quot; packages.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>The &quot;System.Data.SQLite.MSIL*&quot; NuGet packages no longer directly include any files; they are now meta-packages.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>The &quot;System.Data.SQLite.x86*&quot; and &quot;System.Data.SQLite.x64*&quot; NuGet packages now depend on the &quot;System.Data.SQLite.Linq&quot; and &quot;System.Data.SQLite.EF6&quot; NuGet packages.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Make sure SQL statements generated for DbUpdateCommandTree objects are properly delimited.</li>
      <li>Make sure SQLiteIndexOutputs.ConstraintUsages instances are created prior to calling ISQLiteManagedModule.BestIndex. Fix for <a href="https://system.data.sqlite.org/index.html/info/56f511d268">[56f511d268]</a>.</li>
      <li>Correct marshalling of strings and blobs in the SQLiteValue class. Fix for <a href="https://system.data.sqlite.org/index.html/info/85b824b736">[85b824b736]</a>.</li>
      <li>Various minor performance enhancements to the SQLiteDataReader class. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/e122d26e70">[e122d26e70]</a>.</li>
      <li>Defer disposing of connections created by the static SQLiteCommand.Execute method when a data reader is returned. Fix for <a href="https://system.data.sqlite.org/index.html/info/daeaf3150a">[daeaf3150a]</a>.</li>
      <li>Wrap SELECT statements in parenthesis if they have an ORDER BY, LIMIT, or OFFSET clause and a compound operator is involved. Fix for <a href="https://system.data.sqlite.org/index.html/info/0a32885109">[0a32885109]</a>.</li>
      <li>In the SQLiteDataReader.VerifyType method, remove duplicate &quot;if&quot; statement for the DbType.SByte value and move the remaining &quot;if&quot; to the Int64 affinity. Fix for <a href="https://system.data.sqlite.org/index.html/info/c5cc2fb334">[c5cc2fb334]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Handle Julian Day values that fall outside of the supported range for OLE Automation dates. Fix for <a href="https://system.data.sqlite.org/index.html/info/3e783eecbe">[3e783eecbe]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Make sure the interop files are copied when publishing a project that refers to a NuGet package containing them. Fix for <a href="https://system.data.sqlite.org/index.html/info/e796ac82c1">[e796ac82c1]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Make sure the interop files are copied before the PostBuildEvent. Fix for <a href="https://system.data.sqlite.org/index.html/info/f16c93a932">[f16c93a932]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Modify GetSchemaTable method to avoid setting SchemaTableColumn.IsKey column to true when more than one table is referenced. Fix for <a href="https://system.data.sqlite.org/index.html/info/47c6fa04d3">[47c6fa04d3]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Add AppendManifestToken_SQLiteProviderManifest environment variable to enable better integration between LINQ and the underlying store connection.</li>
      <li>Add SQLite_ForceLogPrepare environment variable to force logging of all prepared SQL regardless of the flags for the associated connection.</li>
      <li>Honor the DateTimeFormat, DateTimeKind, DateTimeFormatString, BinaryGUID connection string and/or provider manifest token properties from within the LINQ assembly. Fix for <a href="https://system.data.sqlite.org/index.html/info/8d928c3e88">[8d928c3e88]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Add PrepareRetries connection string property to allow the maximum number of retries when preparing a query to be overridden. Fix for <a href="https://system.data.sqlite.org/index.html/info/647d282d11">[647d282d11]</a>.</li>
      <li>Add BindDateTimeWithKind connection flag to force DateTime parameter values to match the DateTimeKind associated with the connection, if applicable. Fix for <a href="https://system.data.sqlite.org/index.html/info/a7d04fb111">[a7d04fb111]</a>.</li>
    </ul>
    <p><b>1.0.94.0 - September 9, 2014</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_6.html">SQLite 3.8.6</a>.</li>
      <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.1.1">Entity Framework 6.1.1</a>.</li>
      <li>Refactor and simplify NuGet packages in order to support per-solution SQLite interop assembly files.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Add RefreshFlags method to the SQLiteDataReader class to forcibly refresh its connection flags.</li>
      <li>Improve automatic detection and handling of the Entity Framework 6 assembly by the design-time components installer. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/e634e330a6">[e634e330a6]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Improve SQLiteDataReader performance slightly by caching the connection flags.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Add ClearCachedSettings method to the SQLiteConnection class.</li>
      <li>Add NoConvertSettings connection flag to disable querying of runtime configuration settings from within the SQLiteConvert class. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/58ed318f2f">[58ed318f2f]</a>.</li>
      <li>Minimize usage of the &quot;Use_SQLiteConvert_DefaultDbType&quot; and &quot;Use_SQLiteConvert_DefaultTypeName&quot; settings. Fix for <a href="https://system.data.sqlite.org/index.html/info/58ed318f2f">[58ed318f2f]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    </ul>
    <p><b>1.0.93.0 - June 23, 2014</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_5.html">SQLite 3.8.5</a>.</li>
      <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.1">Entity Framework 6.1</a>.</li>
      <li>Add support for mapping transaction isolation levels to their legacy default values. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/56b42d99c1">[56b42d99c1]</a>.</li>
      <li>Add support for setting the default DbType and type name used for mappings on a per-connection basis. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/3c00ec5b52">[3c00ec5b52]</a>.</li>
      <li>Add DetectTextAffinity and DetectStringType connection flags to enable automatic detection of column types, when necessary. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/3c00ec5b52">[3c00ec5b52]</a>.</li>
      <li>Add SetChunkSize method to the SQLiteConnection class. Pursuant to [d1c008fa0a].</li>
      <li>Add SharedFlags static property to the SQLiteConnection class.</li>
      <li>Make the ISQLiteSchemaExtensions interface public.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Have the SQLiteProviderFactory class (in the System.Data.SQLite.Linq assembly) implement the IServiceProvider interface.</li>
      <li>Fix bug in documentation generator automation that prevented some internal documentation links from working.</li>
      <li>Fix DateTime constant handling in the LINQ assembly. Fix for <a href="https://system.data.sqlite.org/index.html/info/da9f18d039">[da9f18d039]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    </ul>
    <p><b>1.0.92.0 - March 19, 2014</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_4_1.html">SQLite 3.8.4.1</a>.</li>
      <li>Update the list of keywords returned by SQLiteConnection.GetSchema(&quot;ReservedWords&quot;).&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Raise the static SQLiteConnection.Changed event when any SQLiteCommand or SQLiteDataReader object is closed or disposed.</li>
      <li>Add the SQLiteDataReader.StepCount property to return the number of rows seen so far.</li>
      <li>Add StickyHasRows connection flag to cause the SQLiteDataReader.HasRows property to return non-zero if there were ever any rows in the associated result sets.</li>
      <li>When the TraceWarning connection flag is set, issue warnings about possibly malformed UNC paths. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/283344397b">[283344397b]</a>.</li>
      <li>Convert the primary NuGet package, &quot;System.Data.SQLite&quot;, into a meta-package.</li>
      <li>Enhancements to the NuGet packages, including the new &quot;modular&quot; packages.</li>
    </ul>
    <p><b>1.0.91.0 - February 12, 2014</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_3_1.html">SQLite 3.8.3.1</a>.</li>
      <li>Refresh all included SQLite core library documentation (e.g. SQL syntax).</li>
      <li>Add support for <a href="https://entityframework.codeplex.com/">Entity Framework 6</a>.</li>
      <li>Add support for per-connection mappings between type names and DbType values. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/e87af1d06a">[e87af1d06a]</a>.</li>
      <li>Modify the namespace used for all internal classes in the System.Data.SQLite.Linq assembly.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Add SQLiteCompileOptions and InteropCompileOptions properties to the SQLiteConnection class to return the compile-time options for the SQLite core library and interop assembly, respectively.</li>
      <li>Add BindInvariantText and ConvertInvariantText connection flags to force the invariant culture to be used when converting parameter values to/from strings.</li>
      <li>Add NoConnectionPool and UseConnectionPool connection flags to disable or enable connection pooling by default.</li>
      <li>Modify handling of the design-time components installer to run Visual Studio <b>devenv.exe /setup</b> after installing the package. This appears to be necessary in some circumstances for Visual Studio 2013. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/a47eff2c71">[a47eff2c71]</a>.</li>
      <li>Modify the native library pre-loader to support reading settings from an XML configuration file and to be capable of checking more than one directory. Persuant to <a href="https://system.data.sqlite.org/index.html/info/f0246d1817">[f0246d1817]</a>.</li>
      <li>Support detecting when the native library pre-loader should use the CodeBase property instead of the Location property as the basis for locating the interop assembly.</li>
      <li>Change the default behavior for the native library pre-loader so it first searches the executing (i.e. System.Data.SQLite) assembly directory and then the application domain directory. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/f0246d1817">[f0246d1817]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Include DbType.AnsiString in the list of types that need special ColumnSize handling. Fix for <a href="https://system.data.sqlite.org/index.html/info/0550f0326e">[0550f0326e]</a>.</li>
    </ul>
    <p><b>1.0.90.0 - December 23, 2013</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_2.html">SQLite 3.8.2</a>.</li>
      <li>Add Visual Studio 2013 support to all the applicable solution/project files, their associated supporting files, and the test suite.</li>
      <li>Add Visual Studio 2013 support to the redesigned designer support installer.</li>
      <li>Add support for Windows Embedded Compact 2013.</li>
      <li>Add experimental support for the native regexp extension.</li>
      <li>Never create a new connection wrapper in the SQLiteConnection.Shutdown method.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Add experimental GetMemoryStatistics, ReleaseMemory, and Shutdown methods to the SQLiteConnection class.</li>
      <li>Add memory leak detection to the test project for the .NET Compact Framework.</li>
      <li>Add SQLITE_ENABLE_MEMORY_MANAGEMENT compile-time option to the interop assembly.</li>
      <li>Use current isolation level when enlisting into an existing transaction. Fix for <a href="https://system.data.sqlite.org/index.html/info/56b42d99c1">[56b42d99c1]</a>.</li>
      <li>Better handling of non-error log messages from the SQLite core library. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/44df10ea90">[44df10ea90]</a>.</li>
      <li>Add TraceWarning connection flag to enable tracing of type mapping failures and disable tracing of them by default. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/6d45c782e4">[6d45c782e4]</a>.</li>
      <li>Use 32-bit values to keep track of numeric precision and scale when building the schema table for a query. Fix for <a href="https://system.data.sqlite.org/index.html/info/ef2216192d">[ef2216192d]</a>.</li>
    </ul>
    <p><b>1.0.89.0 - October 28, 2013</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_1.html">SQLite 3.8.1</a>.</li>
      <li>Add AutoCommit property to the SQLiteConnection class. Fix for <a href="https://system.data.sqlite.org/index.html/info/9ba9346f75">[9ba9346f75]</a>.</li>
      <li>Use declared column sizes for the AnsiStringFixedLength and StringFixedLength mapped database types. Fix for <a href="https://system.data.sqlite.org/index.html/info/3113734605">[3113734605]</a>.</li>
      <li>Check the result of sqlite3_column_name function against NULL.</li>
      <li>Return false for the SQLiteParameterCollection.IsSynchronized property because it is not thread-safe.</li>
      <li>Raise the static SQLiteConnection.Changed event when any SQLiteCommand, SQLiteDataReader, or CriticalHandle derived object instance is created. Fix for <a href="https://system.data.sqlite.org/index.html/info/aba4549801">[aba4549801]</a>.</li>
      <li>Add SQLiteCommand.Execute, SQLiteCommand.ExecuteNonQuery, and SQLiteCommand.ExecuteScalar method overloads that take a CommandBehavior parameter.</li>
      <li>Revise how the extra object data is passed to the static SQLiteConnection.Changed event.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Make sure the database cannot be changed by a query when the CommandBehavior.SchemaOnly flag is used. Fix for <a href="https://system.data.sqlite.org/index.html/info/f8dbab8baf">[f8dbab8baf]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Fix bug in <a href="https://sourceforge.net/projects/ndoc3/">NDoc3</a> that was preventing some of the MSDN documentation links from working.</li>
      <li>Include the XML documentation files in the NuGet packages. Fix for <a href="https://system.data.sqlite.org/index.html/info/5970d5b0a6">[5970d5b0a6]</a>.</li>
      <li>Add InteropVersion, InteropSourceId, ProviderVersion, and ProviderSourceId properties to the SQLiteConnection class.</li>
      <li>Add experimental support for interfacing with the authorizer callback in the SQLite core library.</li>
      <li>Add experimental support for the native totype extension.</li>
    </ul>
    <p><b>1.0.88.0 - August 7, 2013</b></p>
    <ul>
      <li>Various fixes to managed virtual table integration infrastructure.</li>
      <li>Implement workaround for an incorrect PROCESSOR_ARCHITECTURE being reported. Fix for <a href="https://system.data.sqlite.org/index.html/info/9ac9862611">[9ac9862611]</a>.</li>
      <li>Modify classes that implement the IDisposable pattern to set the disposed flag after their base classes have been disposed.</li>
      <li>When automatically registering custom functions, use the executing assembly (i.e. System.Data.SQLite) for reference detection. Fix for <a href="https://system.data.sqlite.org/index.html/info/4e49a58c4c">[4e49a58c4c]</a>.</li>
    </ul>
    <p><b>1.0.87.0 - July 8, 2013</b></p>
    <ul>
      <li>Add all the necessary infrastructure to allow virtual tables to be implemented in managed code. Fix for <a href="https://system.data.sqlite.org/index.html/info/9a544991be">[9a544991be]</a>.</li>
      <li>The DbType to type name translation needs to prioritize the Entity Framework type names. Fix for <a href="https://system.data.sqlite.org/index.html/info/47f4bac575">[47f4bac575]</a>.</li>
      <li>Add DateTimeFormatString connection string property to allow the DateTime format string used for all parsing and formatting to be overridden.</li>
      <li>Add NoFunctions connection flag to skip binding functions registered in the application domain.</li>
      <li>Add several data-types for compatibility purposes. Fix for <a href="https://system.data.sqlite.org/index.html/info/fe50b8c2e8">[fe50b8c2e8]</a>.</li>
      <li>Add SQLiteConnection.BindFunction method to facilitate adding custom functions on a per-connection basis.</li>
      <li>When reading a DateTime value, avoid unnecessary string conversions. Fix for <a href="https://system.data.sqlite.org/index.html/info/4d87fbc742">[4d87fbc742]</a>.</li>
      <li>Modify the index introspection code so that it does not treat PRAGMA table_info &quot;pk&quot; column values as boolean. Fix for <a href="https://system.data.sqlite.org/index.html/info/f2c47a01eb">[f2c47a01eb]</a>.</li>
      <li>Disable use of the new connection string parsing algorithm when the No_SQLiteConnectionNewParser environment variable is set. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/bbdda6eae2">[bbdda6eae2]</a>.</li>
      <li>Rename the ReturnCode property of the SQLiteException class to ResultCode.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    </ul>
    <p><b>1.0.86.0 - May 23, 2013</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_17.html">SQLite 3.7.17</a>.</li>
      <li>Disable use of the AllowPartiallyTrustedCallers attribute when compiled for the .NET Framework 4.0/4.5.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Allow semi-colons in the data source file name. Fix for <a href="https://system.data.sqlite.org/index.html/info/48a6b8e4ca">[e47b3d8346]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>NULL values should be reported as type &quot;object&quot;, not &quot;DBNull&quot;. Fix for <a href="https://system.data.sqlite.org/index.html/info/48a6b8e4ca">[48a6b8e4ca]</a>.</li>
    </ul>
    <p><b>1.0.85.0 - April 18, 2013</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_16_2.html">SQLite 3.7.16.2</a>.</li>
      <li>Properly handle embedded NUL characters in parameter and column values. Fix for <a href="https://system.data.sqlite.org/index.html/info/3567020edf">[3567020edf]</a>.</li>
      <li>Make use of the sqlite3_prepare_v2 function when applicable.</li>
      <li>Check for a valid row in the SQLiteDataReader.GetValue method.</li>
      <li>Implement processor architecture detection when running on the .NET Compact Framework (via P/Invoke).</li>
      <li>Support automated testing when running on the .NET Compact Framework 2.0.</li>
      <li>Skip checking loaded assemblies for types tagged with the SQLiteFunction attribute when the No_SQLiteFunctions environment variable is set. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/e4c8121f7b">[e4c8121f7b]</a>.</li>
      <li>Add HexPassword connection string property to work around the inability to include a literal semicolon in a connection string property value. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/1c456ae75f">[1c456ae75f]</a>.</li>
      <li>Add static Execute method to the SQLiteCommand class.</li>
      <li>Support custom connection pool implementations by adding the ISQLiteConnectionPool interface, the static SQLiteConnection.ConnectionPool property, and the static CreateHandle method in addition to modifying the SQLiteConnectionPool class. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/393d954be0">[393d954be0]</a>.</li>
      <li>Add public constructor to the SQLiteDataAdapter class that allows passing the parseViaFramework parameter to the SQLiteConnection constructor.</li>
      <li>When built with the CHECK_STATE compile-time option, skip throwing exceptions from the SQLiteDataReader class when the object is being disposed.</li>
      <li>Support automatic value conversions for columns with a declared type of BIGUINT, INTEGER8, INTEGER16, INTEGER32, INTEGER64, SMALLUINT, TINYSINT, UNSIGNEDINTEGER, UNSIGNEDINTEGER8, UNSIGNEDINTEGER16, UNSIGNEDINTEGER32, UNSIGNEDINTEGER64, INT8, INT16, INT32, INT64, UINT, UINT8, UINT16, UINT32, UINT64, or ULONG.</li>
      <li>Add BindUInt32AsInt64 connection flag to force binding of UInt32 values as Int64 instead. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/c010fa6584">[c010fa6584]</a>.</li>
      <li>Add BindAllAsText and GetAllAsText connection flags to force binding and returning of all values as text.</li>
      <li>Remove AUTOINCREMENT from the column type name map.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Avoid throwing overflow exceptions from the SQLite3.GetValue method for integral column types. Partial fix for <a href="https://system.data.sqlite.org/index.html/info/c010fa6584">[c010fa6584]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Use the legacy connection closing algorithm when built with the INTEROP_LEGACY_CLOSE compile-time option.</li>
      <li>Support using the directory containing the primary managed-only assembly as the basis for native library pre-loading.</li>
      <li>Still further enhancements to the build and test automation.</li>
    </ul>
    <p><b>1.0.84.0 - January 9, 2013</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_15_2.html">SQLite 3.7.15.2</a>.</li>
      <li>Explicitly dispose of all SQLiteCommand objects managed by the DbDataAdapter class. Fix for <a href="https://system.data.sqlite.org/index.html/info/6434e23a0f">[6434e23a0f]</a>.</li>
      <li>Add Cancel method to the SQLiteConnection class to interrupt a long running query.</li>
      <li>Improve thread safety of the SQLiteLog.LogMessage method.</li>
    </ul>
    <p><b>1.0.83.0 - December 29, 2012</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_15_1.html">SQLite 3.7.15.1</a>.</li>
      <li>Add Visual Studio 2012 support to all the applicable solution/project files, their associated supporting files, and the test suite.</li>
      <li>Add Visual Studio 2012 support to the redesigned designer support installer.</li>
      <li>Allow opened connections to skip adding the extension functions included in the interop assembly via the new NoExtensionFunctions connection flag.</li>
      <li>Support loading of SQLite extensions via the new EnableExtensions and LoadExtension methods of the SQLiteConnection class. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/17045010df">[17045010df]</a>.</li>
      <li>Remove one set of surrounding single or double quotes from property names and values parsed from the connection string. Fix for <a href="https://system.data.sqlite.org/index.html/info/b4cc611998">[b4cc611998]</a>.</li>
      <li>Modify parsing of connection strings to allow property names and values to be quoted.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Add ParseViaFramework property to the SQLiteConnection class to allow the built-in (i.e. framework provided) connection string parser to be used when opening a connection. Pursuant to <a href="https://system.data.sqlite.org/index.html/info/b4cc611998">[b4cc611998]</a>.</li>
      <li>Add notifications before and after any connection is opened and closed, as well as other related notifications, via the new static Changed event.</li>
      <li>Add an overload of the SQLiteLog.LogMessage method that takes a single string parameter.</li>
      <li>Add an overload of the SQLiteConnection.LogMessage method that takes a SQLiteErrorCode parameter.</li>
      <li>All applicable calls into the SQLite core library now return a SQLiteErrorCode instead of an integer error code.</li>
      <li>Make sure the error code of the SQLiteException class gets serialized.</li>
      <li>Make the test project for the .NET Compact Framework more flexible.</li>
      <li>When available, the new sqlite3_errstr function from the core library is used to get the error message for a specific return code.</li>
      <li>The SetMemoryStatus, Shutdown, ResultCode, ExtendedResultCode, and SetAvRetry methods of the SQLiteConnection class now return a SQLiteErrorCode instead of an integer error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>The public constructor for the SQLiteException now takes a SQLiteErrorCode instead of an integer error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>The ErrorCode property of the SQLiteException is now an Int32, to allow the property inherited from the base class to be properly overridden.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>The ErrorCode field of the LogEventArgs is now an object instead of an integer.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>The names and messages associated with the SQLiteErrorCode enumeration values have been normalized to match those in the SQLite core library.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Implement more robust locking semantics for the CriticalHandle derived classes when compiled for the .NET Compact Framework.</li>
      <li>Cache column indexes as they are looked up when using the SQLiteDataReader to improve performance.</li>
      <li>Prevent the SQLiteConnection.Close method from throwing non-fatal exceptions during its disposal.</li>
      <li>Rename the interop assembly functions sqlite3_cursor_rowid, sqlite3_context_collcompare, sqlite3_context_collseq, sqlite3_cursor_rowid, and sqlite3_table_cursor to include an &quot;_interop&quot; suffix.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Prevent the LastInsertRowId, MemoryUsed, and MemoryHighwater connection properties from throwing NotSupportedException when running on the .NET Compact Framework. Fix for <a href="https://system.data.sqlite.org/index.html/info/dd45aba387">[dd45aba387]</a>.</li>
      <li>Improve automatic detection of the sqlite3_close_v2 function when compiled to use the standard SQLite library.</li>
      <li>Add protection against ThreadAbortException asynchronously interrupting native resource initialization and finalization.</li>
      <li>Add native logging callback for use with the sqlite3_log function to the interop assembly, enabled via the INTEROP_LOG preprocessor definition.</li>
      <li>Add various diagnostic messages to the interop assembly, enabled via flags in the INTEROP_DEBUG preprocessor definition.</li>
      <li>Further enhancements to the build and test automation.</li>
      <li>Add test automation for the Windows CE binaries.</li>
    </ul>
    <p><b>1.0.82.0 - September 3, 2012</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_14.html">SQLite 3.7.14</a>.</li>
      <li>Properly handle quoted data source values in the connection string. Fix for <a href="https://system.data.sqlite.org/index.html/info/8c3bee31c8">[8c3bee31c8]</a>.</li>
      <li>The <a href="https://www.nuget.org/packages/System.Data.SQLite">primary NuGet package</a> now supports x86 / x64 and the .NET Framework 2.0 / 4.0 (i.e. in a single package).</li>
      <li>Change the default value for the Synchronous connection string property to Full to match the default used by the SQLite core library itself.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Add the ability to skip applying default connection settings to opened databases via the new SetDefaults connection string property.</li>
      <li>Add the ability to skip expanding data source file names to their fully qualified paths via the new ToFullPath connection string property.</li>
      <li>Fix the database cleanup ordering in the tests for ticket <a href="https://system.data.sqlite.org/index.html/info/343d392b51">[343d392b51]</a>.</li>
      <li>Add support for the sqlite3_close_v2 function from the SQLite core library.</li>
      <li>Add support for <a href="https://www.sqlite.org/uri.html">URI file names</a> via the new FullUri connection string property.</li>
      <li>Improve support for the standard SQLite core library in the LINQ assembly and the test suite.</li>
      <li>Add SetMemoryStatus static method to the SQLiteConnection class.</li>
      <li>Improve threaded handling of the delegate used by the SQLiteLog class.</li>
      <li>Add define constants to support enabling or disabling individual groups of trace statements.</li>
    </ul>
    <p><b>1.0.81.0 - May 27, 2012</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_12_1.html">SQLite 3.7.12.1</a>.</li>
      <li>Support compiling the interop assembly without support for the custom extension functions and the CryptoAPI-based (RC4) codec.</li>
      <li>Add DefineConstants property to the SQLiteConnection class to return the list of define constants used when compiling the core managed assembly.</li>
      <li>Add release archive verification tool to the release automation.</li>
      <li>Fix NullReferenceException when calling the SQLiteDataAdapter.FillSchema method on a query that returns multiple result sets. Fix for <a href="https://system.data.sqlite.org/index.html/info/3aa50d8413">[3aa50d8413]</a>.</li>
      <li>Fix subtle race condition between threads fetching connection handles from the connection pool and any garbage collection (GC) threads that may be running. Fix for <a href="https://system.data.sqlite.org/index.html/info/996d13cd87">[996d13cd87]</a>.</li>
      <li>Add missing call to SetTimeout in the SQLite3_UTF16.Open method.</li>
      <li>Add checks to prevent the SQLiteConnectionPool.Remove method from returning any connection handles that are closed or invalid.</li>
      <li>Modify static SQLiteBase helper methods to prevent them from passing IntPtr.Zero to the SQLite native library.</li>
      <li>Remove static locks from the static helper methods in the SQLiteBase class, replacing them with a lock on the connection handle instance being operated upon.</li>
      <li>Revise CriticalHandle derived classes to make them more thread-safe.</li>
      <li>Add connection pool related diagnostic messages when compiled with the DEBUG define constant.</li>
      <li>Add PoolCount property to the SQLiteConnection class to return the number of pool entries for the file name associated with the connection.</li>
      <li>Rename internal SQLiteLastError methods to GetLastError.</li>
      <li>Add assembly file test constraints to all tests that execute the &quot;test.exe&quot; or &quot;testlinq.exe&quot; files.</li>
    </ul>
    <p><b>1.0.80.0 - April 1, 2012</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_11.html">SQLite 3.7.11</a>.</li>
      <li>In the SQLiteFunction class, when calling user-provided methods from a delegate called by native code, avoid throwing exceptions, optionally tracing the caught exceptions. Fix for <a href="https://system.data.sqlite.org/index.html/info/8a426d12eb">[8a426d12eb]</a>.</li>
      <li>Add Visual Studio 2005 support to all the applicable solution/project files, their associated supporting files, and the test suite.</li>
      <li>Add Visual Studio 2005 support to the redesigned designer support installer.</li>
      <li>Add experimental support for &quot;pre-loading&quot; the native SQLite library based on the processor architecture of the current process. This feature is now enabled by default at compile-time.</li>
      <li>Add support for the native <a href="https://www.sqlite.org/backup.html">SQLite Online Backup API</a>. Fix for <a href="https://system.data.sqlite.org/index.html/info/c71846ed57">[c71846ed57]</a>.</li>
      <li>Acquire and hold a static data lock while checking if the native SQLite library has been initialized to prevent a subtle race condition that can result in superfluous error messages. Fix for <a href="https://system.data.sqlite.org/index.html/info/72905c9a77">[72905c9a77]</a>.</li>
      <li>Support tracing of all parameter binding activity and use the connection flags to control what is traced.</li>
      <li>When converting a DateTime instance of an &quot;Unspecified&quot; kind to a string, use the same kind as the connection, if available.</li>
      <li>Add overload of the SQLiteDataReader.GetValues method that returns a NameValueCollection.</li>
      <li>Add static ToUnixEpoch method to the SQLiteConvert class to convert a DateTime value to the number of whole seconds since the Unix epoch.</li>
      <li>In the implicit conversion operators (to IntPtr) for both the SQLiteConnectionHandle and SQLiteStatementHandle classes, return IntPtr.Zero if the instance being converted is null.</li>
      <li>Write warning message to the active trace listeners (for the Debug build configuration only) if a column type or type name cannot be mapped properly. See <a href="https://system.data.sqlite.org/index.html/info/4bbf851fa5">[4bbf851fa5]</a>.</li>
      <li>When tracing SQL statements to be prepared, bypass the internal length limit of the sqlite3_log function by using the SQLiteLog class directly instead. Also, detect null and/or empty strings and emit a special message in that case.</li>
      <li>For the setup, the Visual Studio task should only be initially checked if the GAC task is available and vice-versa.</li>
      <li>Improve compatibility with custom command processors by using __ECHO instead of _ECHO in batch tools.</li>
      <li>Add OpenAndReturn method to the SQLiteConnection class to open a connection and return it.</li>
      <li>Add missing CheckDisposed calls to the SQLiteConnection class.</li>
      <li>Add missing throw statement to the SQLiteConnection class.</li>
      <li>Make sure the interop project uses /fp:precise for Windows CE.</li>
      <li>Regenerate package load key to support loading the designer package into Visual Studio 2008 without having the matching SDK installed.</li>
      <li>Modify transaction object disposal so that it can never cause an exception to be thrown.</li>
    </ul>
    <p><b>1.0.79.0 - January 28, 2012</b></p>
    <ul>
      <li>Use the WoW64 registry keys when installing the VS designer components on 64-bit Windows. Fix for <a href="https://system.data.sqlite.org/index.html/info/d8491abd0b">[d8491abd0b]</a>.</li>
      <li>Correct resource name used by the LINQ assembly to locate several key string resources. Fix for <a href="https://system.data.sqlite.org/index.html/info/fbebb30da9">[fbebb30da9]</a>.</li>
    </ul>
    <p><b>1.0.78.0 - January 27, 2012</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_10.html">SQLite 3.7.10</a>.</li>
      <li>Redesign the VS designer support installer and integrate it into the setup packages.</li>
      <li>When emitting SQL for foreign keys in the VS designer, be sure to take all returned schema rows into account. Remainder of fix for <a href="https://system.data.sqlite.org/index.html/info/b226147b37">[b226147b37]</a>.</li>
      <li>Add Flags connection string property to control extra behavioral flags for the connection.</li>
      <li>Refactor all IDisposable implementations to conform to best practices, potentially eliminating leaks in certain circumstances.</li>
      <li>Even more enhancements to the build and test automation.</li>
      <li>Support parameter binding to more primitive types, including unsigned integer types.</li>
      <li>Recognize the TIMESTAMP column data type as the DateTime type. Fix for <a href="https://system.data.sqlite.org/index.html/info/bb4b04d457">[bb4b04d457]</a>.</li>
      <li>Prevent logging superfluous messages having to do with library initialization checking. Fix for <a href="https://system.data.sqlite.org/index.html/info/3fc172d1be">[3fc172d1be]</a>.</li>
      <li>Support the DateTimeKind and BaseSchemaName connection string properties in the SQLiteConnectionStringBuilder class. Fix for <a href="https://system.data.sqlite.org/index.html/info/f3ec1e0066">[f3ec1e0066]</a>.</li>
      <li>Overloads of the SQLiteConvert.ToDateTime and SQLiteConvert.ToJulianDay methods that do not require an instance should be static. Partial fix for <a href="https://system.data.sqlite.org/index.html/info/4bbf851fa5">[4bbf851fa5]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    </ul>
    <p><b>1.0.77.0 - November 28, 2011</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_9.html">SQLite 3.7.9</a>.</li>
      <li>More enhancements to the build and test automation.</li>
      <li>Plug native memory leak when closing a database connection containing a statement that cannot be finalized for some reason.</li>
      <li>The SQLite3 class should always attempt to dispose the contained SQLiteConnectionHandle, even when called via the finalizer.</li>
      <li>When compiled with DEBUG defined, emit diagnostic information related to resource cleanup to any TraceListener objects that may be registered.</li>
      <li>Stop characterizing all log messages as errors. From now on, if the errorCode is zero, the message will not be considered an error.</li>
      <li>Never attempt to configure the native logging interface if the SQLite core library has already been initialized for the process. Fix for <a href="https://system.data.sqlite.org/index.html/info/2ce0870fad">[2ce0870fad]</a>.</li>
      <li>Allow the SQLiteLog class to be used for logging messages without having an open connection.</li>
      <li>Support building the core System.Data.SQLite assemblies using the .NET Framework 4.0 Client Profile. Fix for <a href="https://system.data.sqlite.org/index.html/info/566f1ad1e4">[566f1ad1e4]</a>.</li>
      <li>When generating the schema based on the contents of a SQLiteDataReader, skip flagging columns as unique if the data reader is holding the result of some kind of multi-table construct (e.g. a cross join) because we must allow duplicate values in that case. Fix for <a href="https://system.data.sqlite.org/index.html/info/7e3fa93744">[7e3fa93744]</a>.</li>
      <li>When returning schema information that may be used by the .NET Framework to construct dynamic SQL, use a fake schema name (instead of null) so that the table names will be properly qualified with the catalog name (i.e. the attached database name). Partial fix for <a href="https://system.data.sqlite.org/index.html/info/343d392b51">[343d392b51]</a>.</li>
      <li>Add SQLiteSourceId property to the SQLiteConnection class to return the SQLite source identifier.</li>
      <li>Add MemoryUsed and MemoryHighwater properties to the SQLiteConnection class to help determine the memory usage of SQLite.</li>
      <li>Add DateTimeKind connection string property to control the DateTimeKind of parsed DateTime values. Partial fix for <a href="https://system.data.sqlite.org/index.html/info/343d392b51">[343d392b51]</a>.&nbsp;<b>** Potentially Incompatible Change **</b></li>
      <li>Improve the robustness of the SQLiteLog class when it will be initialized and unloaded multiple times.</li>
      <li>Fix the name of the interop assembly for Windows CE. Add unit tests to prevent this type of issue from happening again. Fix for <a href="https://system.data.sqlite.org/index.html/info/737ca4ff74">[737ca4ff74]</a>.</li>
      <li>Formally support the SQL type name BOOLEAN in addition to BOOL. Fix for <a href="https://system.data.sqlite.org/index.html/info/544dba0a2f">[544dba0a2f]</a>.</li>
      <li>Make sure the SQLiteConvert.TypeNameToDbType method is thread-safe. Fix for <a href="https://system.data.sqlite.org/index.html/info/84718e79fa">[84718e79fa]</a>.</li>
    </ul>
    <p><b>1.0.76.0 - October 4, 2011</b></p>
    <ul>
      <li>Prevent the domain unload event handler in SQLiteLog from being registered multiple times. Fix for <a href="https://system.data.sqlite.org/index.html/info/0d5b1ef362">[0d5b1ef362]</a>.</li>
      <li>Stop allowing non-default application domains to initialize the SQLiteLog class. Fix for <a href="https://system.data.sqlite.org/index.html/info/ac47dd230a">[ac47dd230a]</a>.</li>
    </ul>
    <p><b>1.0.75.0 - October 3, 2011</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_8.html">SQLite 3.7.8</a>.</li>
      <li>More enhancements to the build system.</li>
      <li>Add official <a href="https://www.nuget.org/">NuGet</a> packages for x86 and x64.</li>
      <li>Add Changes and LastInsertRowId properties to the connection class.</li>
      <li>Support more formats when converting data from/to the DateTime type.</li>
      <li>Make all the assembly versioning attributes consistent.</li>
      <li>Add unit testing infrastructure using <a href="https://eagle.to/">Eagle</a>.</li>
      <li>Integrate all legacy unit tests, including the &quot;testlinq&quot; project, into the new test suite.</li>
      <li>Add projects to build the interop assembly statically linked to the Visual C++ runtime. Fix for <a href="https://system.data.sqlite.org/index.html/info/53f0c5cbf6">[53f0c5cbf6]</a>.</li>
      <li>Add SQLITE_ENABLE_STAT2 compile-time option to the interop assembly. Fix for <a href="https://system.data.sqlite.org/index.html/info/74807fbf27">[74807fbf27]</a>.</li>
      <li>Fix mutex issues exposed when running the test suite with the debug version of SQLite.</li>
      <li>Fix transaction enlistment when repeated attempts are made to enlist in the same transaction. Fix for <a href="https://system.data.sqlite.org/index.html/info/ccfa69fc32">[ccfa69fc32]</a>.</li>
      <li>Support the SQLITE_FCNTL_WIN32_AV_RETRY file control to mitigate the impact of file sharing violations caused by external processes.</li>
      <li>Refactor the logging interface to be thread-safe and self-initializing.</li>
      <li>Shutdown the SQLite native interface when the AppDomain is being unloaded. Fix for <a href="https://system.data.sqlite.org/index.html/info/b4a7ddc83f">[b4a7ddc83f]</a>.</li>
      <li>Support Skip operation for LINQ using OFFSET. Fix for <a href="https://system.data.sqlite.org/index.html/info/8b7d179c3c">[8b7d179c3c]</a>.</li>
      <li>Support EndsWith operation for LINQ using SUBSTR. Fix for <a href="https://system.data.sqlite.org/index.html/info/59edc1018b">[59edc1018b]</a>.</li>
      <li>Support all SQLite journal modes. Fix for <a href="https://system.data.sqlite.org/index.html/info/448d663d11">[448d663d11]</a>.</li>
      <li>Do not throw exceptions when disposing SQLiteDataReader. Fix for <a href="https://system.data.sqlite.org/index.html/info/e1b2e0f769">[e1b2e0f769]</a>.</li>
      <li>The REAL type should be mapped to System.Double. Fix for <a href="https://system.data.sqlite.org/index.html/info/2c630bffa7">[2c630bffa7]</a> and <a href="https://system.data.sqlite.org/index.html/info/b0a5990f48">[b0a5990f48]</a>.</li>
      <li>Minor optimization to GetParamValueBytes(). Fix for <a href="https://system.data.sqlite.org/index.html/info/201128cc88">[201128cc88]</a>.</li>
      <li>Support the ON UPDATE, ON DELETE, and MATCH clause information when generating schema metadata for foreign keys. Partial fix for <a href="https://system.data.sqlite.org/index.html/info/b226147b37">[b226147b37]</a>. VS designer changes are not yet tested.</li>
      <li>Fix incorrect resource name for SR.resx in the mixed-mode assembly.</li>
      <li>Reduce the number of String.Compare() calls in the hot path for SQLiteCommand.ExecuteReader().</li>
    </ul>
    <p><b>1.0.74.0 - July 4, 2011</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_7_1.html">SQLite 3.7.7.1</a>.</li>
      <li>Fix incorrect hard-coded .NET Framework version information SQLiteFactory_Linq.cs that was causing IServiceProvider.GetService to fail when running against the .NET Framework 3.5.</li>
      <li>Fix all XML documentation warnings.</li>
      <li>Restore support for the mixed-mode assembly (i.e. the one that can be registered in the Global Assembly Cache).</li>
      <li>Restore support for the Compact Framework.</li>
      <li>Remove unused &quot;using&quot; statements from the System.Data.SQLite and System.Data.SQLite.Linq projects.</li>
      <li>Remove hard-coded System.Data.SQLite.Linq version from SQLiteFactory_Linq.cs</li>
      <li>Modify the setup to support bundled packages (i.e. with the mixed-mode assembly) and standard packages (i.e. with the managed assembly separate from the native interop library).</li>
      <li>Disable the ability to register with the Global Assembly Cache in the standard setup package (i.e. it is available in the bundled setup only).</li>
      <li>Remove PATH modification from the setup.</li>
      <li>Modify the naming scheme for the source, setup, and binary packages to allow for the necessary variants.</li>
      <li>In the build automation, attempt to automatically detect if Visual Studio 2008 and/or 2010 are installed and support building binaries for both at once, when available.</li>
      <li>Add release automation to build the source, setup, and binary packages in all supported build variants.</li>
      <li>Add the testlinq project to the new build system and make it work properly with Visual Studio 2008 and 2010.</li>
    </ul>
    <p><b>1.0.73.0 - June 2, 2011</b></p>
    <ul>
      <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_6_3.html">SQLite 3.7.6.3</a>.</li>
      <li>Minor optimization to GetBytes(). Fix for <a href="https://system.data.sqlite.org/index.html/info/8c1650482e">[8c1650482e]</a>.</li>
      <li>Update various assembly information settings.</li>
      <li>Correct System.Data.SQLite.Linq version and resource information. Fix for <a href="https://system.data.sqlite.org/index.html/info/6489c5a396">[6489c5a396]</a> and <a href="https://system.data.sqlite.org/index.html/info/133daf50d6">[133daf50d6]</a>.</li>
      <li>Moved log handler from SQLiteConnection object to SQLiteFactory object to prevent if from being prematurely GCed.</li>
      <li>We should block x64 installs on x86 and we should install native only if the setup package itself is native. Fix for <a href="https://system.data.sqlite.org/index.html/info/e058ce156e">[e058ce156e]</a>.</li>
    </ul>
    <p><b>1.0.72.0 - May 1, 2011</b></p>
    <ul>
      <li>Add the correct directory to the path. Fix for <a href="https://system.data.sqlite.org/index.html/info/50515a0c8e">[50515a0c8e]</a>.</li>
    </ul>
    <p><b>1.0.71.0 - April 27, 2011</b></p>
    <ul>
      <li>Updated to SQLite 3.7.6+ <a href="https://www.sqlite.org/src/info/1bd1484cd7">[1bd1484cd7]</a> to get additional Windows error logging.</li>
      <li>Updated setup to optionally add install directory to PATH if GAC option selected.</li>
    </ul>
    <p><b>1.0.70.0 - April 22, 2011</b></p>
    <ul>
      <li>Added support for sqlite3_extended_result_codes(), sqlite3_errcode(), and sqlite3_extended_errcode() via SetExtendedResultCodes(), ResultCode(), and ExtendedResultCode().</li>
      <li>Added support for SQLITE_CONFIG_LOG via SQLiteLogEventHandler().</li>
    </ul>
    <p><b>1.0.69.0 - April 12, 2011</b></p>
    <ul>
      <li>Code merge with <a href="https://www.sqlite.org/releaselog/3_7_6.html">SQLite 3.7.6</a>.</li>
      <li>New VS2008 and VS2010 solution files.</li>
      <li>Build and packaging automation.</li>
      <li>New Inno Setup files.</li>
      <li>Designer support currently not ready for release.</li>
    </ul>
    <p><b>1.0.68.0 - February 2011</b></p>
    <ul>
      <li>Code merge with <a href="https://www.sqlite.org/releaselog/3_7_5.html">SQLite 3.7.5</a>.</li>
      <li>Continuing work on supporting Visual Studio 2010.</li>
    </ul>
    <p><b>1.0.67.0 - January 3, 2011</b></p>
    <ul>
      <li>Code merge with <a href="https://www.sqlite.org/releaselog/3_7_4.html">SQLite 3.7.4</a>.</li>
      <li>Continuing work on supporting Visual Studio 2010.</li>
    </ul>
    <p><b>1.0.66.1 - August 1, 2010</b></p>
    <ul>
      <li>Code merge with SQLite 3.7.0.1</li>
      <li>Re-enabled VS2005 designer support, broken in previous versions during the 2008 transition</li>
      <li>Implemented new forms of Take/Skip in the EF framework courtesy jlsantiago</li>
      <li>Added "Foreign Keys" to the connection string parameters</li>
      <li>Added the Truncate option to the Journal Modes enumeration</li>
    </ul>
    <p><b>1.0.66.0 - April 18, 2010</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.23.1</li>
      <li>Fixed a bug in the installer that accidentally modified the machine.config on .NET versions prior to 2.0, invaliding the config file.</li>
      <li>Fixed INTERSECT and EXCEPT union query generation in EF</li>
      <li>Fixed an out of memory error in the trigger designer in cases where a WHEN clause is used in the trigger</li>
    </ul>
    <p><b>1.0.65.0 - July 26, 2009</b></p>
    <ul>
      <li>Fixed a bug in the encryption module to prevent a double free() when rekeying a database.</li>
      <li>Fixed a bug in the encryption module when ATTACHing an encrypted database.</li>
      <li>Incorporated the WinCE locking fix from ticket
        <a href="https://www.sqlite.org/cvstrac/tktview?tn=3991">#3991</a></li>
      <li>Added &quot;bigint&quot; to the dropdown in the table designer, plus other minor table
        designer bugfixes.</li>
    </ul>
    <p><b>1.0.64.0 - July 9, 2009</b></p>
    <ul>
      <li>Fixed the missing resources problem from the 63 release.</li>
      <li>Added preliminary support for the Visual Studio 2010 beta.</li>
      <li>Fixed a bug in SQLiteCommand that threw a null reference exception when
        setting the Transaction object to null.</li>
      <li>If SQLiteConnection.EnlistTransaction is called multiple times for the same
        transaction scope, just return without throwing an error.</li>
    </ul>
    <p><b>1.0.63.0 - June 29, 2009</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.16</li>
      <li>Check the autocommit mode of the connection to which a transaction is bound
        during the disposal of the transaction.&nbsp; If autocommit is enabled, then the
        database has already rolled back the transaction and we don&#39;t need to do it
        during dispose, and can quietly ignore the step without throwing an error.</li>
      <li>Eliminated the mergebin step altogether.&nbsp; It was developed primarily to
        merge the Compact Framework binaries together, but since we&#39;re not doing that
        anymore, its use is limited.&nbsp; Its non-standard method of merging a binary
        on the desktop framework is redundant as well.&nbsp; The desktop binary now
        hard-links to MSCOREE, but as of Windows XP, this was redundant as well since XP
        and beyond automatically attempt to load MSCOREE on startup when a DLL has a
        .NET header.</li>
      <li>More improvements to the test.exe program for running the tests against Sql
        Server for comparison purposes.</li>
    </ul>
    <p><b>1.0.62.0 - June 20, 2009</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.15</li>
      <li>Fixed the decimal reading bug in the SQLiteDataReader</li>
      <li>Changed Join()&#39;s to Sleep()&#39;s in the statement retry code to prevent message
        pumping</li>
      <li>Fixed a bad pointer conversion when retrieving blobs using GetBytes() in
        64-bit land</li>
      <li>Several changes to the Test program that comes with the provider.&nbsp; Tests
        can now be individually disabled, and the test program can run against several
        provider back-ends</li>
    </ul>
    <p><b>1.0.61.0 - April 28, 2009</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.13. The new backup features are as yet unimplemented in the provider, but will be forthcoming in a subsequent release</li>
      <li>Fixed the default-value lookups in SQLiteConnectionStringBuilder when accessing properties</li>
      <li>Lock the SQLiteTransaction object during dispose to avoid potential race condition during cleanup</li>
      <li>Fixed SQLiteDataReader.GetDecimal() processing and parsing of decimal values for cases when SQLite returns things like "1.0e-05" instead of "0.0001"</li>
    </ul>
    <p><b>1.0.60.0 - October 3, 2008</b></p>
    <ul>
      <li>Throw a NotSupported exception in the EF Sql Gen code instead of parsing
        illegal SQL during an update/insert/delete where no primary key is defined.</li>
      <li>Fixed the Compact Framework interop library.&nbsp; Since the linker flag
        /subsystem had no version specified, it was causing a problem for many CE-based
        platforms.</li>
      <li>Incorporated SQLite patch for ticket
        <a href="https://www.sqlite.org/cvstrac/tktview?tn=3387">#3387</a> and reverted
        out the vfs override code I added in build 59 to work around this problem.</li>
      <li>Fixed a designer issue when creating a new table from the Server Explorer.&nbsp;
        After initially saving it, if you then continued to edit it and tried to save it
        again, it would generate the change SQL using the old temporary table name
        rather than the new name.</li>
    </ul>
    <p><b>1.0.59.0 - September 22, 2008</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.3.&nbsp; Solves
        a couple different EF issues that were either giving inconsistent results or
        crashing the engine.</li>
      <li>Fixed the parsing of literal binaries in the EF SqlGen code.&nbsp; SQLite now
        passes nearly all the testcases in
        <a href="http://sqlite.phxsoftware.com/forums/p/1377/5921.aspx#5921">Microsoft's EF Query Samples</a> application --
        the exception being the <i>datetimeoffset </i>and<i> time</i> constants tests, and tests
        that use the <i>APPLY </i>keyword which are unsupported for now.</li>
      <li>Revamped the Compact Framework mixed-mode assembly.&nbsp; Tired of playing cat
        and mouse with the Compact Framework&#39;s support for mixed-mode assemblies.&nbsp;
        The CF build now requires that you distribute both the System.Data.SQLite
        library and the paired SQLite.Interop.XXX library.&nbsp;&nbsp; The XXX denotes
        the build number of the library.</li>
      <li>Implemented a workaround for Vista&#39;s overzealous caching by turning off
        FILE_FLAG_RANDOM_ACCESS for OS versions above XP.&nbsp; This is implemented
        as a custom (default override) VFS in the interop.c file, so no changes are made
        to the SQLite source code.</li>
      <li>Fixed some registry issues in the designer install.exe, which prevented some
        design-time stuff from working on the Compact Framework when .NET 3.5 was
        installed.</li>
    </ul>
    <p><b>1.0.58.0 - August 30, 2008</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.2.&nbsp; If only I&#39;d waited one more day to release
        57!&nbsp; Several LINQ issues have been resolved with this engine release
        relating to deeply-nested subqueries that the EF SqlGen creates.</li>
      <li>Fixed the Rollback SQLiteConnection event to not require a connection be
        opened first.</li>
    </ul>
    <p><b>1.0.57.0 - August 29, 2008</b></p>
    <ul>
      <li>Compiled against 3.6.1 with checkin
        <a href="https://www.sqlite.org/cvstrac/tktview?tn=3300">#3300</a> resolved,
        which fixes an Entity Framework bug I was seeing.&nbsp; I currently have 3 other
        tickets out on the engine, which are not yet resolved and relate to EF.</li>
      <li>Fixed decimal types to store and fetch using InvariantCulture.&nbsp; If you&#39;re
        using decimal datatypes in your database and were affected by the 56 release,
        please issue an UPDATE &lt;table&gt; SET &lt;column&gt; = REPLACE(&lt;column&gt;, &#39;,&#39;, &#39;.&#39;);&nbsp;
        to fix the decimal separators.&nbsp; Apologies for not testing that more
        thoroughly before releasing 56.</li>
      <li>Too many LINQ fixes to list.&nbsp; Fixed views so they generate,
        fixed the LIMIT clause, implemented additional functionality and removed unnecessary code.</li>
      <li>Fixed foreign key names in the designer so viewing the SQL script on a new
        unsaved table after renaming it in the properties toolwindow will reflect in the
        script properly.</li>
      <li>Fixed the Update and Commit events on SQLiteConnection so they don&#39;t require
        the connection to be opened first.</li>
      <li>Fixed userdef aggregate functions so they play nice with each other when
        appearing multiple times in the same statement.</li>
      <li>Fixed the editing and saving of default values in the table designer.</li>
      <li>Fixed ForeignKeys schema to support multi-column foreign keys.&nbsp; Also
        hacked support for them in the table designer, provided two foreign keys in the
        designer have the same name and reference the same foreign table and different
        columns.&nbsp; Will implement first-class support for this in the next release.</li>
    </ul>
    <p><b>1.0.56.0 - August 11, 2008</b></p>
    <ul>
      <li>Fixed a bug in the table designer when designing new tables, wherein you had to
        save the table first before being able to create indexes and foreign keys.</li>
      <li>Tweaks to decimal type handling.&nbsp; The &#39;decimal&#39; type can&#39;t be represented
        by Int64 or Double (without loss of precision) in SQLite, so we have to fudge it
        by treating it like a string and converting it back and forth in the provider.&nbsp;
        Unfortunately backing it to the db as a string causes sorting problems.&nbsp;
        See <a href="http://sqlite.phxsoftware.com/forums/p/1296/5595.aspx#5595">this
        post</a>
        for details on using a custom collation sequence to overcome the sorting issue arising from this patch.</li>
      <li>Minor tweaks and bugfixes to the test program and the provider.</li>
      <li>More adjustments to make the managed-only version of the provider run and pass
        all tests on Mono.</li>
      <li>LINQ to Entities bits heavily updated and compiled against VS2008 SP1 RTM.&nbsp; SQLite
        LINQ support is still considered beta.</li>
    </ul>
    <p><b>1.0.55.0 - August 6, 2008</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.1</li>
      <li>Added support for the user-contributed extension-functions at
        <a href="https://www.sqlite.org/contrib">https://www.sqlite.org/contrib</a>.&nbsp;
        Feel free to override any of them with your own implementation.&nbsp; The new
        functions are: <i>acos, asin, atan, atn2, atan2, acosh, asinh, atanh,
        difference, degrees, radians, cos, sin, tan, cot, cosh, sinh, tanh, coth, exp,
        log, log10, power, sign, sqrt, square, ceil, floor, pi, replicate, charindex,
        leftstr, rightstr, reverse, proper, padl, padr, padc, strfilter,</i> and
        aggregates <i>stdev, variance, mode, median, lower_quartile, upper_quartile.</i></li>
      <li>Moved the last_rows_affected() function to the C extension library.</li>
      <li>Added a new class, SQLiteFunctionEx which extends SQLiteFunction and adds the
        ability for a user-defined function to get the collating sequence during the
        Invoke/Step methods.&nbsp; User-defined functions can use the collating sequence
        as a helper to compare values.</li>
      <li>When registering user-defined collation sequences and functions, the provider
        will now register both a UTF8 and a UTF16 version instead of just UTF8.</li>
      <li>Revamped connection pooling and added static ClearPool() and ClearAllPools()
        functions to SQLiteConnection.&nbsp; Behavior of the pool and its clearing
        mechanics match SqlClient.</li>
      <li>Fixed connections going to the pool so that any unfinalized lingering commands
        from un-collected datareaders are automatically reset and any lurking
        transactions made on the connection are rolled back.</li>
      <li>Transaction isolation levels are now partially supported.&nbsp; Serializable
        is the default, which obtains read/write locks immediately -- this is compatible
        with previous releases of the provider.&nbsp; Unspecified will default to
        whatever the default isolation mode is set to, and ReadCommitted will cause a
        deferred lock to be obtained.&nbsp; No other values are legal.</li>
      <li>Revamped the test.exe program.&nbsp; It&#39;s now an interactive GUI application.&nbsp;
        Easier for me to add tests now.</li>
      <li>Tweaks to the VS designer package and installer.</li>
      <li>More adjustments to the internal SQLite3.Prepare() method to account for both
        kinds of lock errors when retrying.</li>
      <li>Stripped a lot of unnecessary interop() calls and replaced with base sqlite calls.&nbsp;
        Revamped most of UnsafeNativeMethods to make it easier to port the code.</li>
      <li>Rerigged internal callbacks for userdef functions and other native to managed
        callbacks.&nbsp; More portable this way.</li>
      <li>Source can now can be compiled with the SQLITE_STANDARD preprocessor symbol to
        force the wrapper to use the stock sqlite3 library.&nbsp; Some functionality is
        missing, but its minimal.&nbsp; None of the precompiled binaries are compiled
        using this setting, but its useful for testing portability.</li>
      <li>Added &quot;boolean&quot; and a couple other missing datatypes to the &quot;DataTypes&quot; schema
        xml file.&nbsp; Used by the VS designer when displaying tables and querying.</li>
      <li>Added a new connection string option &quot;Read Only&quot;.&nbsp; When set to True, the
        database will be opened in read-only mode.</li>
      <li>Added a new connection string option &quot;Max Pool Size&quot; to set the maximum size
        of the connection pool for a given db file connection.</li>
      <li>Added a new connection string option &quot;Default IsolationLevel&quot; to set the
        default isolation level of transactions.&nbsp; Possible values are Serializable and
        ReadCommitted.</li>
      <li>Added a new connection string option &quot;URI&quot; as an optional parameter for
        compatibility with other ports of the provider.</li>
    </ul>
    <p><b>1.0.54.0 - July 25, 2008</b></p>
    <ul>
      <li>Fixed the setup project, which somehow &quot;forgot&quot; to include all the binaries in
        the 53 release.</li>
      <li>Fixed a crash in the table designer when creating a new table and tabbing past
        the &quot;Allow Nulls&quot; cell in the grid while creating a new column.</li>
      <li>Fixed a mostly-benign bug in SQLiteDataReader&#39;s GetEnumerator, which failed to
        pass along a flag to the underyling DbEnumerator it creates.&nbsp; This one&#39;s
        been around since day 1 and nobody&#39;s noticed it in all these years.</li>
      <li>Added a new connection string parameter &quot;Journal Mode&quot; that allows you to set
        the SQLite journal mode to Delete, Persist or Off.</li>
    </ul>
    <p><b>1.0.53.0 - July 24, 2008</b></p>
    <ul>
      <li>Enabled sqlite_load_extension</li>
      <li>Added retry/timeout code to SQLite3.Prepare() when preparing statements for
        execution and a SQLITE_BUSY error occurs.</li>
      <li>Added a new schema to SQLiteConnection.GetSchema() called <i>Triggers</i>.&nbsp;
        Used to retrieve the trigger(s) associated with a database and/or table/view.</li>
      <li>Extensive updates to table/view editing capabilities inside Visual Studio&#39;s
        Server Explorer.&nbsp; The program now parses and lets you edit CHECK constraints and
        triggers on a table, as well as define triggers on views.&nbsp; Experimental
        still, so e-mail me if you have issues.</li>
      <li>Minor bugfix to the ViewColumns schema to return the proper base column name
        for a view that aliases a column.</li>
      <li>Fixed the insert/update/delete DML support in the Linq module.</li>
      <li>Changed the behavior of SQLiteCommand to allow a transaction to be set even if
        the command hasn&#39;t been associated with a connection yet.</li>
    </ul>
    <p><b>1.0.52.0 - July 16, 2008</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.0</li>
      <li>Added a lot of previously-missing exports to the DEF file for the
        native library.</li>
      <li>Fixed SQLiteDataReader to check for an invalid connection before operating on
        an open cursor.</li>
      <li>Implemented the Cancel() function of SQLiteCommand to cancel an active reader.</li>
      <li>Added beta table and view designers to the Visual Studio Server Explorer.&nbsp; You can now
        edit/create tables and views, manage indexes and foreign keys from Visual Studio.&nbsp;
        This feature is still undergoing testing so use at your own risk!</li>
      <li>Fixed the Server Explorer so VS2005 users can once again right-click tables
        and views and open the table data.</li>
      <li>Added some new interop code to assist in returning more metadata not normally
        available through the SQLite API.&nbsp; Specifically, index column sort modes
        and collating sequences.&nbsp; Also added code to detect (but not parse) CHECK
        constraints, so the table designer can pop up a warning when editing a table
        with these constraints.&nbsp; Since I can&#39;t currently parse them.</li>
      <li>Lots of LINQ SQL generation improvements and fixes.</li>
      <li>Made some progress cleaning up and fixing up the schema definitions and
        manifests for EdmGen.</li>
      <li>Added a built-in SQLiteFunction called last_rows_affected() which can be
        called from SQL to get the number of rows affected by the last update/insert
        operation on the connection.&nbsp; This is roughly equivalent to Sql Server&#39;s
        @@ROWCOUNT variable.</li>
    </ul>
    <p><b>1.0.51.0 - July 1, 2008</b></p>
    <ul>
      <li><b>VS2008 SP1 Beta1 LINQ Support</b></li>
      <li>Added experimental Entity Framework support in a new library,
        System.Data.SQLite.Linq.&nbsp; Some things work, some don&#39;t.&nbsp; I haven&#39;t
        finished rigging everything up yet.&nbsp; The core library remains stable.&nbsp;
        All LINQ-specific code is completely separate from the core.</li>
      <li>&nbsp;Added some columns to several existing schemas to support some of the
        EDM framework stuff.</li>
      <li>Minor tweaks to the factory to better support dynamic loading of the Linq
        extension library for SQLite.</li>
      <li>SQLite&#39;s busy handler was interfering with the provider&#39;s busy handling
        mechanism, so its been disabled.</li>
    </ul>
    <p><b>1.0.50.0 - June 27, 2008</b></p>
    <ul>
      <li>Fixed some lingering dispose issues and race conditions when some objects were finalized.</li>
      <li>Fixed the SQLiteConvert.Split() routine to be a little smarter when splitting
        strings, which solves the quoted data source filename problem.</li>
      <li>Enhanced the mergebin utility to work around the strong name validation bug on
        the Compact Framework.&nbsp; The old workaround kludged the DLL and caused WM6.1
        to fail to load it.&nbsp; This new solution is permanent and no longer kludges
        the DLL.</li>
    </ul>
    <p><b>1.0.49.0 - May 28, 2008</b></p>
    <ul>
      <li>Code merge with SQLite 3.5.9</li>
      <li>Fixed schema problems when querying the TEMP catalog.</li>
      <li>Changed BLOB datatype schema to return IsLong = False instead of True.&nbsp; This
        was preventing DbCommandBuilder from using GUID's and BLOB's as primary keys.</li>
      <li>Fix rollover issue with SQLite3.Reset() using TickCount.</li>
      <li>Fixed SQLiteDataReader to dispose of its command (if called for) before
        closing the connection (when flagged to do so) instead of the other way around.</li>
      <li>Fixed a DbNull error when retrieving items not backed by a table schema.</li>
      <li>Fixed foreign key constraint parsing bug.</li>
      <li>Added FailIfMissing property to the SQLiteConnectionStringBuilder.</li>
      <li>Converted the source projects to Visual Studio 2008.</li>
    </ul>
    <p><b>1.0.48.0 - December 28, 2007</b></p>
    <ul>
      <li>Code merge with SQLite 3.5.4</li>
      <li>Calling SQLiteDataReader.GetFieldType() on a column with no schema information
        and whos first row is initially NULL now returns type Object instead of type DbNull.</li>
      <li>Added support for a new DateTime type, JulianDay.&nbsp; SQLite uses Julian dates
        internally.</li>
      <li>Added a new connection string parameter "Default Timeout" and a corresponding
        method on the SQLiteConnection object to change the default command timeout.&nbsp;
        This is especially useful for changing the timeout on transactions, which use SQLiteCommand
        objects internally and have no ADO.NET-friendly way to adjust the command timeout
        on those commands.</li>
      <li>FTS1 and FTS2 modules were removed from the codebase.&nbsp; Please upgrade all
        full-text indexes to use the FTS3 module.&nbsp;</li>
    </ul>
    <p><b>1.0.47.2 - December 10, 2007</b></p>
    <ul>
      <li>Fixed yet one more bug when closing a database with unfinalized command objects</li>
      <li>Fixed the DataReader's GetFieldType function when dealing with untyped SQLite affinities</li>
    </ul>
    <p><b>1.0.47.1 - December 5, 2007</b></p>
    <ul>
      <li>Fixed a leftover bug from the codemerge with SQLite 3.5.3 that failed to close a database.</li>
      <li>Fixed the broken Compact Framework distribution binary.</li>
      <li>SQLite 3.5.x changed some internal infrastructure pieces in the encryption interface
        which I didn't catch initially.&nbsp; Fixed.&nbsp;</li>
    </ul>
    <p><b>1.0.47.0 - December 4, 2007</b></p>
    <ul>
      <li>Code merge with SQLite 3.5.3</li>
      <li>Added installer support for Visual Studio 2008.&nbsp; Code is still using the
        VS2005 SDK so one or two bells and whistles are missing, but nothing significant.</li>
      <li>This is the last version that the FTS1 and FTS2 extensions will appear.&nbsp;
        Everyone should rebuild their fulltext indexes using the new FTS3 module.&nbsp;
        FTS1 and FTS2 suffer from a design flaw that could cause database corruption with
        certain vacuum operations.</li>
      <li>Fixed pooled connections so they rollback any outstanding transactions before
        going to the pool.&nbsp; </li>
      <li>Fixed the unintended breaking of the TYPES keyword, and mis-typing of untyped
        or indeterminate column types. </li>
      <li>Assert a FileIOPermission() requirement in the static SQLiteFunction constructor.
      </li>
      <li>The CE-only SQLiteFunction.RegisterFunction() is now available on the desktop
        platform for dynamic registration of functions.&nbsp; You must still close and re-open
        a connection in order for the new function to be seen by a connection.</li>
      <li>Fixed the "database is locked" errors by implementing behavioral changes in the
        interop.c file for SQLite.&nbsp; Closing a database force-finalizes any prepared
        statements on the database to ensure the connection is fully closed.&nbsp; This
        was rather tricky because the GC thread could still be finalizing statements itself.
        &nbsp;</li>
      <li>Modifed the mergebin utility to help circumvent a long-standing strong name verification
        bug in the Compact Framework.</li>
    </ul>
    <p><b>1.0.46.0 - September 30, 2007</b></p>
    <ul>
    <li>Fixed faulty logic in type discovery code when using SQLiteDataReader.GetValue().</li>
      <li>Fixed Connection.Open() bug when dealing with :memory: databases.</li>
      <li>Fixed SQLiteCommand.ExecuteScalar() to return a properly-typed value.</li>
      <li>Added support for SQLiteParameter.ResetDbType().</li>
      <li>Added test cases for rigid and flexible type testing.</li>
    </ul>
    <p><b>1.0.45.0 - September 25, 2007</b></p>
    <ul>
    <li><strong>Breaking change in GetSchema("Indexes") </strong>-- MetaDataCollections
      restrictions and identifier parts counts were wrong for this schema and I was using
      the wrong final parameter as the final restriction.&nbsp; Meaning, if you use the
      Indexes schema and are querying for a specific index the array should now be {catalog,
      null, table, index } instead of {catalog, null, table, null, index}</li>
      <li>Fixed some errors in the encryption module, most notably when a non-default page
        size is specified in the connection string.</li>
      <li>Fixed SQLiteDataReader to better handle type-less usage scenarios, which also
        fixes problems with null values and datetimes.</li>
      <li>Fixed the leftover temp files problem on WinCE </li>
      <li>Added connection pooling.&nbsp; The default is disabled for now, but may change
      in the future.&nbsp; Set "Pooling=True" in the connection string to enable it. </li>
      <li>Sped up SQLiteConnection.Open() considerably.</li>
      <li>Added some more robust cleanup code regarding SQLiteFunctions.</li>
      <li>Minor additions to the code to allow for future LINQ integration into the main
        codebase.</li>
      <li>Fixed a long-standing bug in the Open() command of SQLiteConnection which failed
      to honor the documented default behavior of the SQLite.NET provider to open the
      database in "Synchronous=Normal" mode.&nbsp; The default was "Full". </li>
      <li>If Open() fails, it no longer sets the connection state to Broken.&nbsp; It instead
        reverts back to Closed, and cleans up after itself.</li>
      <li>Added several new parameters to the ConnectionString for setting max page count,
        legacy file format, and another called FailIfMissing to raise an error rather than
        create the database file automatically if it does not already exist.</li>
      <li>Fixed some designer toolbox references to the wrong version of the SQLite.Designer</li>
      <li>Fixed a bug in the mergebin utility with regards to COR20 metadata rowsize computations.&nbsp;
      </li>
      <li>Minor documentation corrections &nbsp;&nbsp;</li>
    </ul>
    <p><b>1.0.44.0 - July 21, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.4.1</li>
      <li>Fixed a bug in SQLiteConnection.Open() which threw the wrong kind of error in
        the wrong kind of way when a database file could not be opened or created.&nbsp;</li>
      <li>Small enhancements to the TYPES keyword, and added documentation for it in the
        help file.</li>
      <li>Hopefully fixed the occasional SQLITE_BUSY errors that cropped up when starting
        a transaction.&nbsp; Usually occurred in high-contention scenarios, and the underlying
        SQLite engine bypasses the busy handler in this scenario to return immediately.</li>
    </ul>
    <p><b>1.0.43.0 - June 21, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.4.0</li>
      <li>Fixed a reuse bug in the SQLiteDataAdapter in conjunction with the SQLiteCommandBuilder.&nbsp;
      It's been there unnoticed for more than a year, so it looks like most folks never
      encountered it. </li>
      <li>Fixed an event handler bug in SQLiteCommandBuilder in which it could fail to unlatch
        from the DataAdapter when reused.&nbsp; Relates to the previous bugfix.</li>
      <li>Fixed a double-dispose bug in SQLiteStatement that triggered a SQLiteException.&nbsp;</li>
    </ul>
    <p><b>1.0.42.0 - June 1, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.17</li>
      <li>Changed the SQLiteFunction static constructor so it only enumerates loaded modules
        that have referenced the SQLite assembly, which hopefully should cut down dramatically
        the time it takes for that function to execute.&nbsp;</li>
      <li>Added the FTS2 full-text search extension to the project.&nbsp; Look for FTS1
        to disappear within the next couple of revisions.&nbsp;</li>
      <li>Fixed a bug introduced with the finalizers that triggered an error when statements
        ended with a semi-colon or had other non-parsable comments at the end of a statement&nbsp;</li>
      <li>Fixed an intermittent multi-threaded race condition between the garbage collector
        thread and the main application thread which lead to an occasional SQLITE_MISUSE
        error.</li>
      <li>Fixed another issue relating to SQLite's inherent typelessness when dealing with
        aggregate functions which could return Int64 or Double or even String for a given
        row depending on what was aggregated.</li>
      <li>Remembered to recompile the DDEX portion of the engine this time, so Compact Framework
        users can once again use the design-time functionality</li>
    </ul>
    <p><b>1.0.41.0 - April 23, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.16</li>
      <li>Second go at implementing proper finalizers to cleanup after folks who've forgotten to Dispose() of the SQLite objects</li>
      <li>Enhanced GetSchema(IndexColumns) to provide numeric scale and precision values</li>
      <li>Fixed the column ordinals in GetSchema(IndexColumns) to report the ordinal of the column in the index, not the table</li>
      <li>Fixed a bug whereby parameters named with an empty string (such as String.Empty) were treated like a named parameter instead of an unnamed parameter</li>
    </ul>
    <p><b>1.0.40.0 - January 31, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.12</li>
      <li>Lots of new code to handle misuse of the library.&nbsp; Implemented finalizers
        where it made sense, fixed numerous garbage collector issues when objects are not
        disposed properly, &nbsp;fixed some object lifetime issues, etc.</li>
      <li>A failed Commit() on a transaction no longer leaves the transaction in an unusable
        state.</li>
    </ul>
    <p><b>1.0.39.1 - January 11, 2007</b></p>
    <ul>
    <li>Fixed a really dumb mistake that for some reason didn't trigger any errors in
      the testcases, whereby commands when associated with a connection were not adding
      or removing themselves from an internal list of commands for that connection --
      causing a "database is locked" error when trying to close the connection.</li>
    </ul>
    <p><b>1.0.39.0 - January 10, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.10</li>
      <li>Fixed a multi-threaded race condition bug in the garbage collector when commands
        and/or connections are not properly disposed by the user.</li>
      <li>Switched the encryption's internal deallocation code to use sqlite's built-in
        aux functions instead of modifying the pager.c source to free the crypt block.&nbsp;
        This eliminates the last of the code changes the provider makes to the original
        sqlite engine sources.&nbsp; Props to Ralf Junker for pointing that out.</li>
    </ul>
    <p><b>1.0.38.0 - November 22, 2006</b></p>
    <ul>
    <li>Fixed a bug when using CommandBehavior.KeyInfo whereby integer primary key columns may be duplicated in the results. </li>
      <li>Enhanced the CommandBuilder so that update/delete statements are optimized when the affected table contains unique constraints and
      a primary key is present.</li>
      <li>Fixed a bug in the DataReader when used in conjunction with CommandBehavior.CloseConnection.</li></ul>
    <p><b>1.0.37.0 - November 19, 2006</b></p>
    <ul>
    <li>Added support for CommandBehavior.KeyInfo.&nbsp;
      When specified in a query, additional column(s) will be returned describing the
      key(s) defined for the table(s) selected in the query.&nbsp; This is optimized when
      INTEGER PRIMARY KEY is set for the given tables, but does additional work for other
      kinds of primary keys.</li>
      <li>Removed the default values from SQLiteDataReader.GetTableSchema(), to better follow
        Sql Server's pattern and suppress schema errors when loading the records into a
        dataset/datatable.</li>
      <li>Allow integers to implicitly convert to double/decimal/single.</li></ul>
    <p><b>1.0.36.1 - October 25, 2006</b></p>
    <ul>
    <li>Added support for LONGVARCHAR, SMALLDATE and SMALLDATETIME. These were actually added in 1.0.36.0 but were undocumented.</li>
    <li>Fixed the embedded helpfile which was accidentally built from old sources. </li>
    <li>Fixed an unfortunate re-entry of a bug in the .36 codebase that caused the provider to "forget" about commands on a connection under certain circumstances.</li>
    </ul>
    <p><b>1.0.36.0 - October 23, 2006</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.8, including support for full-text search via the FTS1
      extension.&nbsp;</li><li>Fixed a bug retrieving data types when UseUtf16Encoding is true. Side-effect of further merging the common code between the two base classes.</li>
      <li>Fixed a bug with System.Transactions whereby a connection closed/disposed within
        a transaction scope is rolled back and cannot be committed.</li>
      <li>Added more error checking and reporting to transactions to help user's isolate
        the source of transaction failures.</li>
      <li>Implemented a workaround for a Compact Framework issue regarding strong-named
        assemblies containing a PE section with a raw size less than the virtual size.&nbsp;</li>
    </ul>
    <p><b>1.0.35.1 - September 12, 2006</b></p>
    <ul>
    <li>Fixed the TYPES keyword to work when UseUTF16Encoding is true.</li>
    <li>Fix another bug revealed in 1.0.35.0 regarding infinite loops when the 2nd or subsequent statements of a semi-colon separated command cannot be parsed.</li>
      <li>Updated the help documentation.&nbsp;</li>
    </ul>
    <p><b>1.0.35.0 - September 10, 2006</b></p>
    <ul>
    <li>Fixed an infinite loop bug in SQLiteCommand caused when multiple semi-colon separated
      statements in a single command are executed via datareader and one of the statements
      contains a syntax error preventing it from being prepared.&nbsp;</li><li>Added the TYPES preparser keyword to be placed before a SELECT statement to
    aid the wrapper in converting expressions in a subsequent select clause into more
    robust types.&nbsp; Documentation yet to be integrated, but available on the forums.</li>
      <li>Added a new connectionstring parameter "BinaryGUID=true/false" (default is "true").&nbsp;
        When true, guid types are stored in the database as binary blobs to save space.&nbsp;
        Binary has been the default format since 1.0.32.0 but this parameter eases backward
        compatibility.</li>
    </ul>
    <p><b>1.0.34.0 - September 4, 2006</b></p>
    <ul>
    <li>Fixed a bug in SQLiteParameterCollection.RemoveAt(namedparam)</li>
    <li>Fixed a bug in SQLiteDataReader introduced in 1.0.30 that broke DateTimes using the Ticks option in the connection string.</li>
      <li>Fixed a bug in the recent changes to guid behavior wherein using a datareader's
        indexer to fetch a guid from a column containing both binary and text guids would
        sometimes return a byte array instead of a guid.</li>
      <li>Enacted a workaround involving typed datasets in Compact Framework projects in
        which it took an excessive amount of time to open a form and generated a lot of
        temporary files in the user's Local Settings\Application Data\Microsoft\VisualStudio\8.0\Assembly
        References folder.</li>
    </ul>
     <p><b>1.0.33.0 - August 21, 2006</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.7</li>
      <li>Fixed a bug in SQLiteConnection that caused it to "forget" about commands bound
      to it and occasionally throw an error when a database is closed and opened repeatedly.&nbsp;
      </li>
    </ul>
<p><b>1.0.32.0 - August 6, 2006</b></p>
    <ul>
    <li>Added AllowPartiallyTrustedCallers attribute to the assembly</li><li>Added the missing "nchar" type</li>
      <li>Added support for binary Guid's.&nbsp; Guids are now stored as binary by default
        when using parameterized queries.&nbsp; Text guids are still fully supported.</li>
      <li>Fixed a TransactionScope() error that caused the transaction not to be completed.</li>
      <li>Enhanced parameter names so that if they are added to the Parameters collection
        without their prefix character (@ : or $) they are still properly mapped.&nbsp;</li>
    </ul>
        <p><b>1.0.31.0 - July 16, 2006</b></p>
    <ul>
    <li>Re-applied the view parsing bugfix in 1.0.29.0 that was accidentally reverted
      out of the 30 build.</li><li>Fixed SQLiteCommand.ExecuteScalar() to return null instead of DbNull.Value
    when no rows were returned.</li>
      <li>Design-time installer now installs the package-based designer on full Visual Studio
        versions.&nbsp; Express editions continue to use the packageless designer.</li>
      <li>In Visual Studio (not Express), you can now right-click a SQLite connection in
        the Server Explorer and vacuum the database and change the encryption password.</li>
    </ul>
    <p><b>1.0.30.1 - July 2, 2006</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.6</li>
      <li>Added support for the |DataDirectory| keyword in the Data Source filename string.&nbsp;
      </li>
      <li>Added hook notification support to SQLiteConnection.&nbsp; Specifically, there
      are three new events on the SQLiteConnection object which are raised when an update/insert/delete
      occurs and when transactions are committed and rolled back.</li><li>Changed SQLiteTransaction to default to BEGIN IMMEDIATE instead of just BEGIN,
    which solves a multithreaded race condition.&nbsp;</li>
      <li>Changed SQLiteDataReader to better support SQLite's typelessness.&nbsp; The data
        reader no longer caches column affinity, but re-evaluates it for each column/row.</li>
      <li>Fixed a bug in Prepare() which caused an intermittant fault due to the code accessing
        the memory of an unpinned variable.&nbsp;</li>
      <li>Fixed a multithreaded lock-retry bug in in SQLiteConnection.Open() and in
    SQLiteTransaction, which failed to use a command timeout before giving up.</li>
    </ul>

    <p><b>1.0.29.0 - May 16, 2006</b></p>
    <ul>
    <li>Fixed a bug in the Views schema information which caused multi-line view definition statements not to be parsed</li>
    <li>Fixed a parsing bug in SQLiteDataReader.GetSchemaTable() to account for numeric(x,y) datatypes with specified precision and scale</li>
    <li>Fixed a bug in SQLiteConnection.Open() which tried to automatically enlist in an ambient transaction but had not yet set the state of the database to Opened, thereby causing a transaction fault</li>
    <li>Changed SQLiteException to inherit from DbException on the full framework</li>
    </ul>
    <p><b>1.0.28.0 - April 14, 2006</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.5</li>
      <li>You can now specify a relative path in the Compact Framework's "Data Source" by
        prefixing the file with ".\".&nbsp; i.e. "Data Source=.\\mydb.db3"</li>
      <li>Several more changes and enhancements to schemas for better compatibility.</li>
      <li>Fixed several bugs with the 64-bit builds of the provider.&nbsp; The x64 binary
        is now optimized.</li>
      <li>Design-time installer now tries to install the 64-bit builds into the GAC along
        with the 32-bit build.</li>
      <li>Fixed a bug in the SQLiteDataReader.GetSchemaTable() function when used with tables
        containing apostrophes.</li>
      <li>Fixed an XSD-related bug whereby the XSD utility was unable to locate the provider
        and could not generate typed datasets.</li>
      <li>Added NTEXT and STRING datatypes to the list of recognized keywords (used for
        schema retrieval).</li>
      <li>Due to the XSD bug and other potential problems related to external build utilities,
        changes to the installation of the designer have had to be made.&nbsp; The installer
        used to write the DbProviderFactories XML into the devenv.exe.config file and its
        express cousins, but now has to write instead to the machine.config.</li>
      <li>Installer writes to both the 32-bit machine.config and the 64-bit machine.config
        if it exists.&nbsp;</li>
    </ul>
    <p><b>1.0.27.1 - February 28, 2006</b></p>
    <ul>
    <li>Fixed a bug when doing data binding in Compact Framework projects that prevented
      you from assigning a typed dataset to a bindingsource.&nbsp; It turns out, the CF
      version of the SQLite provider needs to be flagged as retargetable so it'll work
      in the design-time desktop environment.&nbsp; No changes were made to the desktop
      build, but the revision was bumped on all libraries anyway in order to keep them
      sync'd.&nbsp;</li></ul>
    <p><b>1.0.27.0 - February 27, 2006</b></p>
    <ul>
    <li>Many optimizations and a few more minor adjustments to schemas and schema retrieval
      performance.</li>
      <li>Lots of design-time attributes added to the code.&nbsp; The DbDataAdapter, DbCommand,
        and DbConnection objects now have greatly enhanced design-time capabilities when
        added to the toolbox and dropped on a form.</li>
      <li>Lots of Server Explorer enhancements.</li>
      <li>Binaries are now distributed in a setup program for easier administration and
        configuration of the provider.</li>
    </ul>
    <p><b>1.0.26.2 - February 15, 2006</b></p>
    <ul>
    <li>Yet another bugfix to index schemas, which was incorrectly marking most indexes
      as primary key indexes.</li><li>Fixed GetSchema() to accept a null string array.</li><li>Fixed a misspelled export in the core C library that prevented databases opened
    with UTF16Encoding from getting schema information and would likely cause an error
    if attempted.</li></ul>
    <p><b>1.0.26.1 - February 14, 2006</b></p>
    <ul>
    <li>Fixed even more minor schema bugs having to do with indexes.</li><li>Added two missing pieces in the SQLite designer which were preventing it from
    being used from within VS Express editions.&nbsp;</li><li>Several bugfixes to the design-time installer program, including supporting
    64-bit environments.</li></ul>
    <p><b>1.0.26.0 - February 11, 2006</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.4</li><li>Fixed an encryption bug when changing the password of databases over 1gb in
      size.&nbsp;</li><li>Fixed various designer issues related to construction of named parameters.&nbsp;</li><li>Retooled the GetSchema() method of SQLiteDataReader to use the new 3.3.4 API functions,
        and made several enhancements and fixes to schemas.&nbsp;</li>
      <li>Implemented the SourceColumnNullMapping property of SQLiteParameter to fix
    a DbCommandBuilder code generation bug.&nbsp;</li>
      <li>Removed the runtime dependency on MSVCR80.DLL.&nbsp; File size is somewhat
    larger for the varying desktop versions, but the Compact Framework version remains
    the same.</li><li>Created an install program to manage installation and uninstallation of the
    SQLite design-time support.</li>
      <li>Designer support now works for all Visual Studio editions, including all Express
        Editions.</li>
      <li>Design-time installer will now remove (if present) the machine.config SQLite entries
        in favor of installing the xml code into the devenv.exe.config file (or any of the
        variations for express editions).&nbsp; The officially-accepted behavior of using
        DbProviderFactories is to add the code to your app.config file, and the machine.config
        file should not be touched.</li>
    </ul>
    <p><b>1.0.25.0 - January 31, 2006</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.3</li><li>Added automatic distributed transaction enlistment and implemented the DbConnection.EnlistTransaction
    method for manual enlistment.</li>
      <li>Nested transactions are now supported.</li>
      <li>Rearranged the timing of SetPassword(), which now must be called before the database
        is opened instead of afterwards.&nbsp; Optionally, the password can be supplied
        in the ConnectionString.</li>
      <li>Fixed a bug in SQLiteFunction that caused a failure when an empty resultset was
        returned and a custom user aggregate function was used in the query.</li>
      <li>The designer has had another round of cleanup applied, in preparation for moving
        to a VS package.</li>
      <li>Added SQLiteMetaDataCollectionNames class.</li>
    </ul>
    <p><b>1.0.24.6 beta - January 23, 2006</b></p>
    <ul>
    <li>This beta is built from sqlite.org's 3.3.2 beta.</li><li>Eliminated the static linking of mscoree from all binaries.&nbsp; Native projects
      can now use the library without any dependencies on the .NET Framework, while managed
      projects continue to be able to use the library normally.</li></ul>
    <p><b>1.0.24.5 beta - January 20, 2006</b></p>
    <ul>
    <li>This beta is built from sqlite.org's 3.3.1 alpha and contains development-in-progress code.&nbsp; Therefore no guarantees
      can be made regarding its suitability for production use.</li>
    <li><strong>You no longer need to distribute 2 files on the CompactFramework.&nbsp;
      You can delete SQLite.Interop.DLL entirely.&nbsp; </strong>I wrote a custom tool
      called "mergebin" (available in the source zip file) which combines the two libraries
      and gets around a glaring defect in the VS2005 linker for ARM processors which doesn't
      allow you to link netmodules.</li>
      <li><strong>x64 and ia64 builds now use the same strong name as the x86 build.</strong>&nbsp;
        This means breaking backward compatibility, but it was necessary in order to allow
        you to drop any of those 3 builds onto a PC and have your .NET program run properly.&nbsp;
        Prior to this, you'd get an error if you built your program using the x86 build,
        and then installed the x64 version on a target machine and tried to run your program
        against it.</li>
      <li>The entire source project has been gone over top to bottom.&nbsp; A debug build
        no longer combines the binaries into a single module, which was preventing proper
        debugging.</li></ul>
    <p><b>1.0.24.4 beta - January 16, 2006</b></p>
    <ul>
    <li>This beta is built from sqlite.org's 3.3.1 alpha and contains development-in-progress code.&nbsp; Therefore no guarantees
      can be made regarding its suitability for production use.</li>
    <li>Fixed a bug in the UTF-16 handling code for preparing statements due to a behavioral
      change in SQLite 3.3.0.</li>
      <li>Added pager.c code necessary to cleanup after an encrypted file is closed.</li>
      <li>Fixed an encryption bug that caused a fault when an encrypted file was rolled
        back.</li>
      <li>Modified the testcase code to take advantage of optimizations regarding the use
        of a DbCommandBuilder.&nbsp; DataAdapter insert speed increased dramatically as
        a result.</li>
    </ul>
    <p><b>1.0.24.3 beta - January 10, 2006</b></p>
    <ul>
    <li>This beta is built from sqlite.org's CVS HEAD (as it appeared at of the date of
      this beta) and contains development-in-progress code.&nbsp; Therefore no guarantees
      can be made regarding its suitability for production use.</li><li>Added support for database encryption at the pager level.&nbsp; Databases
    are encrypted using a 128-bit RC4 stream algorithm.&nbsp; To open an existing encrypted
    database, you may now specify a "Password={password}" text in the ConnectionString,
    or you may call the SQLiteConnection.SetPassword() function to set the password
    on an open connection. &nbsp;To encrypt existing non-encrypted databases or to change
    the password on an encrypted database, you must use the SQLiteConnection.ChangePassword()
    function.&nbsp; If you use SetPassword() instead of specifying a password in the
    connection string, or call ChangePassword() you may use a binary byte array or a
    text string as the password.</li>
      <li>Rewrote the locking implementation for the Compact Framework.&nbsp; It is now
        more robust and incorporates into the SQLite codebase more efficiently than the
        previous CE adaptation.</li>
      <li>Moved some of the embedded schema XML data into a resource file to ease code readability.</li>
      <li>Automated the fixup of the original sqlite codebase's source prior to compiling,
        to ease merging with sqlite.org's source.&nbsp;</li>
    </ul>
    <p><b>1.0.24.2 - December 30, 2005</b></p>
    <ul>
    <li>Fixed the SQLiteDataReader.HasRows property to return the proper value.</li>
      <li>Implemented the inadvertently neglected RecordsAffected property on SQLiteDataReader.
      </li>
      <li>SQLiteFunction static constructor was changed to pre-filter classes with only the
        SQLiteFunctionAttribute.&nbsp; The code was throwing an exception when certain
        assemblies were referenced in a project. </li>
      <li>Fixed the SQLiteDataAdapter OnRowUpdated event, which was using the wrong variable
        to find the attached event handler and subsequently not raising the event.</li>
      <li>Small optimizations and fixes to SQLiteDataReader.NextResult().&nbsp;</li>
    </ul>
    <p><b>1.0.24.1 - December 19, 2005</b></p>
    <ul>
    <li>Update core SQLite engine to 3.2.8&nbsp;</li></ul>
    <p><b>1.0.24 - December 9, 2005</b></p>
    <ul>
    <li>Fixed the<em> Catalogs</em> schema bug that caused attached databases not to be re-attached to a cloned connection
    </li>
      <li>Enhanced transactions to allow for a deferred or immediate writelock. &nbsp;SQLiteConnection.BeginTransaction()
        now has an additional overload to support it </li>
      <li>Commands are now prepared as they are executed instead of beforehand.&nbsp; This
      fixes a bug whereby a multi-statement command that alters the database and subsequently
      references the altered data would fail during Prepare().</li><li>Tightened up the SQLiteDataReader to prevent reading columns before calling
    the first Read() and to prevent reading columns after the last Read().</li>
      <li>A more descriptive error is thrown if there aren't enough parameters in the command
        to satisfy the parameters required by the statement(s).&nbsp;</li>
    </ul>
    <p><b>1.0.23 - November 21, 2005</b></p>
    <ul>
    <li>Named parameters may now begin with <strong>@</strong> to ease portability of
      the provider. SQLite's named parameters are ordinarily prefixed with a <strong>: </strong>
      or<strong> $</strong>.&nbsp; The designer will still use the <strong>$</strong>
      prefix however, since its more compatible with the default SQLite engine.</li><li>Added several alternate ISO8601 date/time formats to SQLiteConvert.cs to increase
    compatibility.</li>
      <li>Relaxed coersion restrictions to work better with SQLite's inherent typelessenss.&nbsp;</li>
    </ul>
    <p><b>1.0.22 - November 11, 2005</b></p>
    <UL>
    <li>Fixed some globalization issues which resulted in incorrect case-insensitive comparisons</li>
      <li>Fixed a bug in the routine that finds all user-defined functions in a loaded assembly.&nbsp;
        It would throw an exception if any of the types in the assembly could not be loaded.&nbsp;
        The exception is now caught and handled appropriately.</li>
    </UL>
    <p><b>1.0.21 - November 4, 2005</b></p>
    <UL>
      <li>Fixed a designer bug when creating typed datasets with parameterized queries.
      </li><li>The above fix then exposed another bug in the datareader's ability to query
    schema information on parameterized commands, which was also fixed. </li>
      <li>Compiled against the RTM version of VS2005. </li>
      <li>Rewrote the design-time install script to use the XML DOM objects when writing
        to the machine.config and to automatically register the DLL in the GAC.</li>
      <LI>Made changes to the app.config descriptions and help file to improve version-independent
        factory support.&nbsp; </li>
    </UL>
      <P><STRONG>1.0.20 - October 19, 2005</STRONG></P>
      <UL>
        <LI>
        Fixed a shortcut in SQLiteBase.GetValue which was insufficient for international environments. The shortcut was removed and the "proper" procedure put in.
        </UL>
      <P><STRONG>1.0.19 - October 5, 2005</STRONG></P>
      <UL>
        <LI>
        Code merge with SQLite 3.2.7
        <LI>
        Fixed bugs in the CE port code (os_wince.c)&nbsp;which were brought to
        light&nbsp;by&nbsp;recent changes in the SQLite engine.
        <LI>
          Recompiled and modified to be compatible with the September VS2005 Release
          Candidate.<BR>
          Beta 2 users should continue to use 1.0.18.1</LI></UL>
      <P><STRONG>1.0.18.1 - September 19, 2005</STRONG></P>
      <UL>
        <LI>
          Code merge with SQLite 3.2.6</LI></UL>
      <P><STRONG>1.0.18 - September 1, 2005</STRONG></P>
      <UL>
        <li>
          Added type-specific method calls when using the various SQLite classes that
          would've normally returned a a generic Db base class, which aligns the code
          better with the Microsoft-supplied data providers.</li></UL>
      <p><b>1.0.17 - August 26, 2005</b></p>
      <ul>
        <li>
        Code merge with SQLite 3.2.5
        <li>
        Added Itanium and x64 build settings to the project (needs testing)
        <li>
        Bugfixes and enhancements to several schema types
        <li>
        Additional design-time support to include index and foreign key
        enumerations.&nbsp; Requires re-registering the designer using
        INSTALL.CMD.&nbsp; The new designer code now allows the VS query designer and
        typed datasets to automatically link up foreign keys, use indexes, and
        automatically generate relationships from the schema.<li>
          Additional static methods on SQLiteConnection to create a database file,
          encrypt a file using the Encrypted File System (EFS) on NTFS (requires NT 2K or
          above) and NTFS file compression</li>
      </ul>
      <p><b>1.0.16 - August 24, 2005</b></p>
      <ul>
        <li>
        Code merge with SQLite 3.2.4 with the large delete bugfix in CVS (which will
        become 3.2.5 soon)
        <li>
          Added new GetSchema() types: IndexColumns, ViewColumns, ForeignKeys</li>
      </ul>
      <p><b>1.0.15 - August 22, 2005</b><br>
      </p>
      <ul>
        <li>
        Code merge with SQLite 3.2.3
        <LI>
          Minor updates for better design-time experience. More design-time code to
          follow in subsequent releases.</LI>
      </ul>
      <p><b>1.0.14 - August 16, 2005</b><br>
      </p>
      <ul>
        <li>
        Fixed a bug in the SQLiteDataAdapter due to insufficient implementation of the
        class.&nbsp; The RowUpdating and RowUpdated events are now properly
        implemented, but unfortunately inserting and updating data in a DataTable or
        DataSet is now much slower.&nbsp; This is the proper design however, so the
        changes are here to stay.
        <LI>
        Lots of schema changes to support Visual Studio's Data Designer architecture.<li>Added
          Designer support for the provider.&nbsp; It's not 100%, but you can design
          queries, add typed datasets and perform quite a number of tasks all within
          Visual Studio now.</li></ul>
      <P><B>1.0.13 - August 8, 2005</B><BR>
      </P>
      <DIV>
        <UL>
          <LI>
          Fixed a named parameter bug in the base SQLite_UTF16 class, which of course
          only showed up when a database connection was opened using the
          UseUTF16Encoding=True parameter.
          <LI>
            Fixed a performance issue in SQLite_UTF16 involving string marshaling.</LI></UL>
      </DIV>
      <P><B>1.0.12 - August 5, 2005</B><BR>
      </P>
      <DIV>
        <UL>
          <LI>
            Full support for the Compact Framework.&nbsp; Each build (Debug/Release) now
            has a&nbsp;platform, either Win32 or Compact Framework.&nbsp; The correct
            projects are built accordingly.&nbsp; See the&nbsp;<A href="#redist">Distributing
              SQLite</A>
          section for information on what files need to be distributed for each
          platform.&nbsp;
          <LI>
          Modified SQLite3.Reset() and Step() functions to transparently handle timeouts
          while waiting on the database to become available (typically when a writer is
          waiting on a reader to finish, or a reader is waiting on a writer to finish).
          <LI>
          Lots of code cleanup&nbsp;as suggested&nbsp;by the Code Analyzer (FxCop).
          <LI>
          Lots of updates to the helpfile (as you can see).
          <LI>
            Statements&nbsp;were already prepared lazily&nbsp;in a SQLiteCommand, but now
            its even more lazy.&nbsp; Statements are now only prepared if the statements
            haven't been previously prepared and a Prepare() function is called (and the
            command is associated with a connection) or just prior to the command being
            executed.&nbsp;</LI></UL>
      </DIV>
      <P><B>1.0.11 - August 1, 2005</B><BR>
      </P>
      <UL>
        <LI>
          <STRONG>For everything except the Compact Framework, System.Data.SQLite.DLL is
            now the <EM>only</EM> DLL required to use this provider!</STRONG>&nbsp; The
        assembly is now a multi-module assembly, containing both the native SQLite3
        codebase and the C# classes built on top of it.&nbsp; The Compact Framework
        version (when completed) will not be able to support this feature, so backwards
        compatibility with the Compact Framework has been preserved for the future.
        <LI>
          Fixed a bug in SQLiteCommand.ExecuteScalar() that caused it to stop executing
          commands once it obtained the first column of the first row-returning
          resultset.&nbsp; Any remaining statements after the row-returning statement was
          ignored.
        </LI>
      </UL>
      <P><B>1.0.10 - June 10, 2005</B><BR>
      </P>
      <UL>
        <LI>
        Fixed a bug in the SQLite3.cs Prepare() function that created a statement even
        when the SQLite engine returned a NULL pointer. Typically this occurs when
        multiple statements are processed and there are trailing comments at the end of
        the statement.
        <LI>
          Fixed a bug in SQLiteStatement.cs that retrieved parameter names for a
          parameterized query.&nbsp; SQLite's parameters are 1-based, and the function
          was starting at 0.&nbsp; This was fine when all parameters were unnamed, but
          for named parameters it caused the parameters to be out of whack.
        </LI>
      </UL>
      <P><B>1.0.09a - May 25, 2005</B><BR>
      </P>
      <UL>
        <LI>
        Fixed a broken helpfile and corrected some obsolete help remarks in
        SQLiteFunction.cs
        <LI>
          Added a version resource to the SQLite.Interop.DLL.&nbsp;</LI></UL>
      <P><B>1.0.09 - May 24, 2005</B><BR>
      </P>
      <UL>
        <LI>
        Code merge with the latest 3.21 version of SQLite.
        <LI>
          Removed obsolete methods and properties for Whidbey Beta 2</LI></UL>
      <P><B>1.0.08 Refresh - Mar 24, 2005<BR>
        </B>
      </P>
      <UL>
        <LI>
        Code merge with the latest 3.20 version of SQLite.
        <LI>
          Recompiled the help file to fix a build error in it.
        </LI>
      </UL>
      <P><B>1.0.08 - Mar 11, 2005<BR>
        </B>
      </P>
      <UL>
        <LI>
        Added additional #if statements to support the old beta 1 edition of VS2005.
        <LI>
          Code merged the SQLite 3.14 source.
        </LI>
      </UL>
      <P><B>1.0.07 - Mar 5, 2005</B><BR>
      </P>
      <UL>
        <LI>
        Made more optimizations to frequently-called functions, resulting in
        significant performance gains in all tests.
        <LI>
          Recompiled the binaries using the latest VS2005 February CTP, resulting in yet
          more significant speed gains.&nbsp; The 100k insert test used to take 3.5
          seconds and the insertwithidentity took almost 8 seconds.&nbsp; With the above
          two changes, those tests are now executing in 1.9 and 4.9 seconds respectively.</LI></UL>
      <P><B>1.0.06 - Mar 1, 2005<BR>
        </B>
      </P>
      <UL>
        <LI>
        Speed-ups to SQLiteDataReader.&nbsp; It was interop'ing unnecessarily every
        time it tried to fetch a field due to a logic error.
        <LI>
        Changed/Added some code to SQLiteConvert's internal DbType, Type and
        TypeAffinity functions.
        <LI>
        Fixed the SQLiteDataReader to obey the flags set in the optional
        CommandBehavior flag from SQLiteCommand.ExecuteReader().
        <LI>
        Changed the default page size to 1024 to reflect the defaults of SQLite.&nbsp;
        Ignores the "Page Size" connection string option for memory databases, as tests
        revealed that changing it resulted in memory corruption errors.
        <LI>
          Performance enhancements to the SQLiteCommand and SQLiteStatement classes which
          reduced the 100,000 row insert execution time as well as the various Function
          execution times significantly.
        </LI>
      </UL>
      <P><B>1.0.05 - Feb 25, 2005</B>
      </P>
      <UL>
        <LI>
        Fixed the SQLite3 C# class step/reset functions to accomodate schema changes
        that invalidate a prepared statement.&nbsp; Statements are recompiled
        transparently.
        <LI>
        Moved all native DLL declarations to an UnsafeNativeMethods class.
        <LI>
        Split several classes into their own modules for readability.
        <LI>
        Renamed many internal variables, reviewed access to variables marked as
        internal and altered their protection levels accordingly.
        <LI>
        Due to the presence of the altered sqlite3 codebase and so many added interop
        functions, I decided to rename the sqlite3 C project and the DLL to
        SQLite.Interop.DLL.&nbsp; This is the same core sqlite3 codebase but designed
        specifically for this ADO.NET provider.&nbsp; This eliminates any possibility
        of someone dropping another build of sqlite3.dll into the system and rendering
        the provider inoperable.&nbsp; In the future if the folks at sqlite.org finally
        introduce a method of retrieving column usage for an arbitrary prepared
        statement, I'll retool this library to be a lightweight function call wrapper
        around the core binary distribution.
        <LI>
        Added [SuppressUnmanagedCodeSecurity] attribute to the UnsafeNativeMethods
        class which brings VS2005 November CTP execution speeds inline with the
        December CTP.
        <LI>
          Added a <B>bin</B>
        directory to the project root where pre-compiled binaries can be found.
        <LI>
          Added a <B>doc</B>
        directory where preliminary documentation on the class library can be found.
        <LI>
          Documented a lot more of the classes internally.
        </LI>
      </UL>
      <P><B>1.0.04 - Feb 24, 2005</B>
      </P>
      <UL>
        <LI>
        Removed the SQLiteContext class and revamped the way UserFunctions work to
        simplify the imlementation.
        <LI>
        Fixed a counting bug in the TestCases class, specifically in the function tests
        where I wasn't resetting the counter and it was consequently reporting
        intrinsic and raw select calls as being much much faster than they actually
        were.&nbsp; The numbers are now much closer to what I expected for performance,
        with .NET user-functions still being the slowest, but only by a small margin.
        <LI>
        Small performance tweaks to SQLiteDataReader.
        <LI>
        Added PageSize to the SQLiteConnectionStringBuilder and subsequently to the
        SQLiteConnection
        <LI>
          Added a PRAGMA encoding=XXX execution statement to the SQLiteConnection after
          opening a connection.
        </LI>
      </UL>
      <P><B>1.0.03 - Feb 23, 2005</B>
      </P>
      <UL>
        <LI>
        Fixed up SQLiteCommandBuilder to correct implementation errors, which resulted
        in an enormous performance boost in the InsertMany test.&nbsp;&nbsp; 10,000 row
        insert that executed in 1500ms now executes in 500ms.
        <LI>
        Fixed several errors in the SQLite3_UTF16 class.&nbsp; ToString() was working
        incorrectly and the Open() method failed to register user defined functions and
        collations.
        <LI>
        Fixed a bug in SQLiteCommand.ClearCommands() whereby only the first statement
        was being properly cleaned up.
        <LI>
        Fixed a bug in SQLiteDataReader whereby calling NextResult() would not properly
        reset the previously-executed command in the sequence.
        <LI>
          Added an InsertManyWithIdentityFetch test, which appends a select clause to
          populate the ID of the last inserted row into the InsertCommand, demonstrating
          ADO.NET's ability to auto-fetch identity columns on insert.
        </LI>
      </UL>
      <P><B>1.0.02 - Feb 21, 2005</B></P>
      <UL>
        <LI>
        Tweaks to the xxx_interop functions that return char *'s, so they also return
        the length.&nbsp; Saves an interop call to get the UTF-8 string length during
        conversion to a .NET string.
        <LI>
        Reworked the whole interop.c thing into interop.h and reduced the code required
        to merge the main sqlite3 codebase.
        <LI>
          Added support for user-defined collations.
        </LI>
      </UL>
      <hr />
      <div id="footer">
        <p>
          <a href="mailto:sqlite-users@mailinglists.sqlite.org?subject=SQLite.NET%20Class%20Library%20Documentation%20Feedback:%20Version%20History">
            Send comments on this topic.</a>
        </p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>

Added Doc/Extra/Provider/welcome.html.





























































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>Introduction</title>
    <link rel="stylesheet" type="text/css" href="../Include/ndoc.css" />
  </head>
  <body>
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">SQLite ADO.NET Provider</span>
          </td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite.NET Class Library Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">About SQLite.NET</h1>
      <p>This class library is an ADO.NET wrapper around the popular (and free!)
        SQLite database engine. For information on SQL syntax, features of SQLite and a
        good understanding of how it works and what it does, I highly recommend heading
        over to <a target="_blank" href="https://www.sqlite.org">sqlite.org</a> and
        reading the documentation there.</p>
      <P>The C# provider, the very minor C code modifications to SQLite, documentation and
        etc&nbsp;were written by <A href="mailto:robert@blackcastlesoft.com">Robert
          Simpson</A>, and the SourceForge project page can be found <A target="_blank" href="https://sourceforge.net/projects/sqlite-dotnet2">
          here</A>.</P>
      <p>The System.Data.SQLite project is currently maintained by the
         <A target="_blank" href="https://www.sqlite.org/">SQLite Development Team</a> and
         the latest source code and project information can be found
         <A target="_blank" href="https://system.data.sqlite.org/">here</A>.</p>
      <DIV>
        <br>
      </DIV>
      <h1 class="heading">What's New?</h1>
      <p><a href="version.html">Click here to see the version history of this SQLite.NET
          provider</a></p>
      <DIV>
        <br>
      </DIV>
      <h1 class="heading">Using this library</h1>
      <p>The following are links to information on various aspects of the library and
        how to use it in your application(s)
      </p>
      <p><a href="designer.html">How to install&nbsp;Visual Studio Design-Time Support</a></p>
      <P><A href="dbfactorysupport.html">How to configure and enumerate SQLite.NET
          through the DbProviderFactories object</A></P>
      <p><a href="optimizing.html">Getting the best performance out of SQLite</a></p>
      <p><a href="limitations.html">Limitations of the SQLite.NET provider and the SQLite
          engine (compared to other providers and engines)</a></p>
      <br>
      <h1 class="heading">SQLite.NET Provider Features</h1>
      <p>This SQLite provider implements every feature of the underlying SQLite
        database engine without omission. Here's a brief summary:</p>
      <UL>
        <LI>
        Written from scratch on Visual Studio 2008 specifically for ADO.NET, implenting all the
        base classes and features recently introduced in the framework, including automatic
        transaction enlistment.<li>Supports the Full and Compact .NET Framework, as well as
          native C/C++ development.&nbsp; 100% binary compatible with the original sqlite3.dll.</li>
        <li>Full support for Mono via a &quot;managed only&quot; provider that runs against the
          official SQLite 3.6.1 or higher library.</li>
        <li>Full Entity Framework support (ADO.NET 3.5 SP1)</li>
        <li>
        On the Compact Framework, it is faster than Sql Server Mobile.
          SQLite's installed size is a fraction of Sql Mobile's. It uses less memory at runtime,
          runs queries faster, and has a smaller database file size as well. </li>
        <li>Encrypted database support.&nbsp; Encrypted databases are fully encrypted and
          support both binary and cleartext password types. </li>
        <li>Visual Studio 2005/2008/2010/2012/2013/2015 Design-Time Support.&nbsp; You can add a SQLite
        database to the Servers list, design queries with the Query Designer,
        drag-and-drop tables onto a Typed DataSet, etc.</li>
            <li>Full SQLite schema editing inside Visual Studio.&nbsp; You can create/edit
              tables, views, triggers, indexes, check constraints and foreign keys. </li>
        <li>
        Available as a single file redistributable (except Compact Framework).&nbsp; The core sqlite3 codebase and the ADO.NET wrapper
        are combined into one multi-module assembly. </li>
        <li>Also available as separate native and managed assemblies and optionally with the Visual C++ Runtime statically linked. </li>
        <li>
          Binaries included for Itanium, x64, x86 and ARM processors.
          <br />
          <font color="red">
            Itanium processor support not currently included.
          </font>
        </li>
        <li>
        DbProviderFactory support. </li>
        <li>
          Full support for ATTACH'ed databases.&nbsp; Exposed as <i>Catalogs</i>
        in the schema.&nbsp; When cloning a connection, all attached databases are
        automatically re-attached to the new connection. </li>
        <li>
          DbConnection.GetSchema(...) support includes the <i>MetaDataCollections</i>, <i>
          DataSourceInformation</i>, <i>Columns</i>, <i>Tables</i>, <i>Views, ViewColumns, </i>
          <i>Catalogs, </i><i>Indexes,
            IndexColumns, ForeignKeys </i>and <em>Triggers</em>.
        </li>
        <li>
        Enhanced DbDataReader.GetSchemaTable() functionality returns catalog, namespace
        and detailed schema information even for complex queries. </li>
        <li>
        Named and unnamed parameters. </li>
        <li>
        Full UTF-8 and UTF-16 support, each with optimized pipelines into the native
        database core. </li>
        <li>
        Multiple simultaneous DataReaders (one DataReader per Command however). </li>
        <li>
        Full support for user-defined scalar and aggregate functions, encapsulated into
        an easy-to-use base class in which only a couple of overrides are necessary to
        implement new SQL functions. </li>
        <li>
        Full support for user-defined collating sequences, every bit as simple to
        implement as user-defined functions and uses the same base class. </li>
        <li>
          Full source for the entire engine and wrapper.&nbsp; No copyrights.&nbsp;
          Public Domain.&nbsp; 100% free for commercial and non-commercial use.&nbsp;</li>
      </UL>
      <br>
      <h1 class="heading">Distributing the Binaries (Desktop)</h1>
      <p>When using the mixed-mode assembly, the <b>System.Data.SQLite.DLL</b> file
        includes all the native and managed code. In that case, this is the only
        DLL required to be redistributed with your SQLite.NET application(s).&nbsp;
        When using separate native and managed assemblies, the
        <b>System.Data.SQLite.DLL</b> file contains all the managed code and the
        <b>SQLite.Interop.DLL</b> file contains all the native code.
        The native code comes in&nbsp;3 flavors: Win32, Itanium and x64 (AMD64).
        <br />
        <font color="red">
          Itanium processor support not currently included.
        </font>
      </p>
      <h1 class="heading">Distributing the Binaries (Compact Framework)</h1>
      <p>Both the <b>System.Data.SQLite.DLL </b>and <b>SQLite.Interop.XXX.DLL</b> files
        must be deployed on the Compact Framework.&nbsp; The XXX is the build number of
        the System.Data.SQLite library (e.g. &quot;119&quot;).&nbsp; The
        <b>SQLite.Interop.XXX.DLL</b> file is a fully native assembly compiled for
        the ARM processor, and System.Data.SQLite is the fully-managed Compact
        Framework assembly.</p>
      <hr />
      <div id="footer">
        <p>
          <a href="mailto:sqlite-users@mailinglists.sqlite.org?subject=SQLite.NET%20Class%20Library%20Documentation%20Feedback:%20Welcome">
          Send comments on this topic.<!--[if gte IE 5]><tool:tip element="seeAlsoToolTip" avoidmouse="false" /><tool:tip element="languageFilterToolTip" avoidmouse="false" /><![endif]-->    </div>
    </div>
  </body>
</html>

Deleted Doc/Extra/blank.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>[Title Goes Here]</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">[Running Header]</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">[Header Row]</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">[H1 Header]</h1>
      <p>
        [Document Text]
      </p>
      <h4>
        [Sub Section]</h4>
      <p>
      [Sub Section Text]
      </p>
      <hr>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































Deleted Doc/Extra/contents.hhc.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft&reg; HTML Help Workshop 4.1">
<!-- Sitemap 1.0 -->
</HEAD><BODY>
<UL>
	<LI> <OBJECT type="text/sitemap">
		<param name="Name" value="Introduction">
		<param name="Local" value="welcome.html">
		</OBJECT>
	<UL>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Installing Design-Time Support">
			<param name="Local" value="designer.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Using DbProviderFactories">
			<param name="Local" value="dbfactorysupport.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Optimizing SQL Queries">
			<param name="Local" value="optimizing.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Provider Limitations">
			<param name="Local" value="LImitations.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Version History">
			<param name="Local" value="version.html">
			</OBJECT>
	</UL>
	<LI> <OBJECT type="text/sitemap">
		<param name="Name" value="SQLite Language Reference">
		<param name="Local" value="syntax.html">
		</OBJECT>
	<UL>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="ALTER TABLE">
			<param name="Local" value="lang_altertable.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="ANALYZE">
			<param name="Local" value="lang_analyze.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="ATTACH DATABASE">
			<param name="Local" value="lang_attach.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="BEGIN TRANSACTION">
			<param name="Local" value="lang_transaction.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="comment">
			<param name="Local" value="lang_comment.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="COMMIT TRANSACTION">
			<param name="Local" value="lang_transaction.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="CREATE INDEX">
			<param name="Local" value="lang_createindex.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="CREATE TABLE">
			<param name="Local" value="lang_createtable.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="CREATE TRIGGER">
			<param name="Local" value="lang_createtrigger.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="CREATE VIEW">
			<param name="Local" value="lang_createview.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="CREATE VIRTUAL TABLE">
			<param name="Local" value="lang_createvtab.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="DELETE">
			<param name="Local" value="lang_delete.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="DETACH DATABASE">
			<param name="Local" value="lang_detach.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="DROP INDEX">
			<param name="Local" value="lang_dropindex.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="DROP TABLE">
			<param name="Local" value="lang_droptable.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="DROP TRIGGER">
			<param name="Local" value="lang_droptrigger.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="DROP VIEW">
			<param name="Local" value="lang_dropview.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="END TRANSACTION">
			<param name="Local" value="lang_transaction.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="EXPLAIN">
			<param name="Local" value="lang_explain.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="expression">
			<param name="Local" value="lang_expr.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="INSERT">
			<param name="Local" value="lang_insert.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="ON CONFLICT">
			<param name="Local" value="lang_conflict.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="PRAGMA">
			<param name="Local" value="pragma.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="REINDEX">
			<param name="Local" value="lang_reindex.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="REPLACE">
			<param name="Local" value="lang_replace.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="ROLLBACK TRANSACTION">
			<param name="Local" value="lang_transaction.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="SELECT">
			<param name="Local" value="lang_select.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="UPDATE">
			<param name="Local" value="lang_update.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="VACUUM">
			<param name="Local" value="lang_vacuum.html">
			</OBJECT>
	</UL>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































Deleted Doc/Extra/dbfactorysupport.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>DbProviderFactory Support</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">DbProviderFactory Support</span>
          </td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite.NET Class Library Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">DbProviderFactories and You</h1>
      <p>One of the great new features of ADO.NET 2.0 is the use of reflection as a 
        means of instantiating database providers programmatically. The information 
        .NET uses to enumerate the available data providers in the system is relatively 
        simple. It merely looks in the machine.config and in your own app.config file for some XML data to tell it what providers are 
        installed and what assemblies those providers are in.
      </p>
      <h4>
        Scenario 1:&nbsp; Version Independent (does not use the Global Assembly Cache)</h4>
      <p>
        This method allows you to drop any new version of the System.Data.SQLite.DLL into
        your application's folder and use it without any code modifications or recompiling.&nbsp;
        Add the following code to your app.config file:</p>
      <div class="syntax">
        <PRE>&lt;configuration&gt;
  &lt;system.data&gt;
    &lt;DbProviderFactories&gt;
      &lt;remove invariant="System.Data.SQLite"/&gt;
      &lt;add name="SQLite Data Provider" invariant="System.Data.SQLite"
           description=".Net Framework Data Provider for SQLite"<br />           type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /&gt;
    &lt;/DbProviderFactories&gt;
  &lt;/system.data&gt;
&lt;/configuration&gt;
</PRE>
      </div>
      <h4>
        Scenario 2:&nbsp; Version Dependent, using either the DLL located in the same folder
        as the application or the Global Assembly Cache</h4>
      <p>
        This method expands on the above XML to provide the version number and key token
        of the SQLite DLL so it can be found either in the same folder as the application
        or looked up in the GAC.&nbsp; The downside to this method is that DbProviderFactories
        will use this version information to only load the version specified.&nbsp; This
        means if you update the DLL, you must also update this XML.</p>
      <div class="syntax">
        <PRE>
&lt;configuration&gt;
  &lt;system.data&gt;
    &lt;DbProviderFactories&gt;
      &lt;remove invariant="System.Data.SQLite"/&gt;
      &lt;add name="SQLite Data Provider" invariant="System.Data.SQLite" 
           description=".Net Framework Data Provider for SQLite"
           type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite,
                 Version=1.0.66.0, Culture=neutral,
                 PublicKeyToken=db937bc2d44ff139"/&gt;
    &lt;/DbProviderFactories&gt;
  &lt;/system.data&gt;
&lt;/configuration&gt;
</pre>
      </div>
      <p>
        The following C# code demonstrates 
        instantiating SQLite through DbProviderFactories:</p>
      <div class="syntax"><pre>      DbProviderFactory fact = DbProviderFactories.GetFactory("System.Data.SQLite");
      using (DbConnection cnn = fact.CreateConnection())
      {
        cnn.ConnectionString = "Data Source=test.db3";
        cnn.Open();
      }</pre>
      </div>
      <hr>
      <div id="footer">
        <p>
          <a href="mailto:robert@blackcastlesoft.com?subject=SQLite.NET%20Class%20Library%20Documentation%20Feedback:%20Factory%20Support">
            Send comments on this topic.</a>
        </p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































Deleted Doc/Extra/designer.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>Design-Time Support</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">Design-Time Support</span>
          </td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite.NET Class Library Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">

      <h1 class="heading">Installing SQLite Visual Studio Design-Time Support</h1>
      <p>Supporting the Visual Studio query designer and allowing you to manipulate 
        SQLite databases from within Visual Studio is a great time-saver.&nbsp; Though 
        the support is not yet fully-implemented, there's certainly enough there to 
        keep you busy.&nbsp; You can create databases, design and execute queries, 
        create typed datasets and lots more all from Visual Studio.</p>
      <h3> Installation Instructions</h3>
      <p>
        In Windows Explorer, navigate to <STRONG>SQLite.Net\bin\Designer</STRONG>
        and execute the <STRONG>INSTALL.EXE</STRONG> program.&nbsp; It will automatically
        detect what eligible Visual Studio products are installed, and allow you to check
        and uncheck which environments to install the designer for.</p>
      <h3> Express Edition Limitations</h3>
      <p>All Express Editions (except Visual Web Developer) are hard-coded to only allow you to design for Jet and Sql Server Database Files.&nbsp; The only way for SQLite
        to install its designer is to temporarily replace one of the existing "approved"
        designers.&nbsp; Therefore, when you install the SQLite designer for one of these
        express editions, it will temporarily replace the Microsoft Access designer.&nbsp;
        You can revert back to the Access designer simply by re-running the install.exe
        program and un-checking the boxes.</p>
      <hr/>
      <div id="footer">
        <p>
          <a href="mailto:robert@blackcastlesoft.com?subject=SQLite.NET%20Class%20Library%20Documentation%20Feedback:%20Designer%20Support">
            Send comments on this topic.</a>
        </p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































Deleted Doc/Extra/lang_altertable.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>ALTER TABLE</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">ALTER TABLE</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        ALTER TABLE</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">ALTER TABLE </font></b>[<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font
                  color="#2c2cf0"> </font></b><i><font color="#ff3434">table-name</font></i><b><font
                    color="#2c2cf0"> </font></b><i><font color="#ff3434">alteration</font></i><b><font
                      color="#2c2cf0"></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">alteration</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">RENAME TO </font></b><i><font color="#ff3434">new-table-name</font></i><b><font
                color="#2c2cf0"></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">alteration</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">ADD </font></b>[<b><font color="#2c2cf0">COLUMN</font></b>]<b><font
                color="#2c2cf0"> </font></b><i><font color="#ff3434">column-def</font></i><b><font
                  color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        SQLite's version of the ALTER TABLE command allows the user to rename or add a new
        column to an existing table. It is not possible to remove a column from a table.
      </p>
      <p>
        The RENAME TO syntax is used to rename the table identified by <i>[database-name.]table-name</i>
        to <i>new-table-name</i>. This command cannot be used to move a table between attached
        databases, only to rename a table within the same database.</p>
      <p>
        If the table being renamed has triggers or indices, then these remain attached to
        the table after it has been renamed. However, if there are any view definitions,
        or statements executed by triggers that refer to the table being renamed, these
        are not automatically modified to use the new table name. If this is required, the
        triggers or view definitions must be dropped and recreated to use the new table
        name by hand.
      </p>
      <p>
        The ADD [COLUMN] syntax is used to add a new column to an existing table. The new
        column is always appended to the end of the list of existing columns. <i>Column-def</i>
        may take any of the forms permissable in a CREATE TABLE statement, with the following
        restrictions:
      </p>
      <ul>
        <li>The column may not have a PRIMARY KEY or UNIQUE constraint. </li>
        <li>The column may not have a default value of CURRENT_TIME, CURRENT_DATE or CURRENT_TIMESTAMP.
        </li>
        <li>If a NOT NULL constraint is specified, then the column must have a default value
          other than NULL. </li>
      </ul>
      <p>
        The execution time of the ALTER TABLE command is independent of the amount of data
        in the table. The ALTER TABLE command runs as quickly on a table with 10 million
        rows as it does on a table with 1 row.
      </p>
      <p>
        After ADD COLUMN has been run on a database, that database will not be readable
        by SQLite version 3.1.3 and earlier until the database is <a href="lang_vacuum.html">
          VACUUM</a>ed.</p>
      <p>
        &nbsp;</p>
      <hr>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































Deleted Doc/Extra/lang_analyze.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>ANALYZE</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">ANALYZE</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        ANALYZE</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">ANALYZE</font></b></td>
          </tr>
        </table>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">ANALYZE </font></b><i><font color="#ff3434">database-name</font></i><b><font
                color="#2c2cf0"></font></b></td>
          </tr>
        </table>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">ANALYZE </font></b>[<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font
                  color="#2c2cf0"> </font></b><i><font color="#ff3434">table-name</font></i><b><font
                    color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        The ANALYZE command gathers statistics about indices and stores them in a special
        tables in the database where the query optimizer can use them to help make better
        index choices. If no arguments are given, all indices in all attached databases
        are analyzed. If a database name is given as the argument, all indices in that one
        database are analyzed. If the argument is a table name, then only indices associated
        with that one table are analyzed.</p>
      <p>
        The initial implementation stores all statistics in a single table named <b>sqlite_stat1</b>.
        Future enhancements may create additional tables with the same name pattern except
        with the "1" changed to a different digit. The <b>sqlite_stat1</b> table cannot be <a href="lang_droptable.html">DROP</a>ped, but all the content can be <a href="lang_delete.html">
          DELETE</a>d which has the same effect.</p>
      <p>
        &nbsp;</p>
      <hr>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































Deleted Doc/Extra/lang_attach.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>ATTACH DATABASE</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">ATTACH DATABASE</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        ATTACH DATABASE</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">ATTACH </font></b>[<b><font color="#2c2cf0">DATABASE</font></b>]<b><font
                color="#2c2cf0"> </font></b><i><font color="#ff3434">database-filename</font></i><b><font
                  color="#2c2cf0"> AS </font></b><i><font color="#ff3434">database-name</font></i><b><font
                    color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        The ATTACH DATABASE statement adds another database file to the current database
        connection. If the filename contains punctuation characters it must be quoted. The
        names 'main' and 'temp' refer to the main database and the database used for temporary
        tables. These cannot be detached. Attached databases are removed using the <a href="lang_detach.html">
          DETACH DATABASE</a> statement.</p>
      <p>
        You can read from and write to an attached database and you can modify the schema
        of the attached database. This is a new feature of SQLite version 3.0. In SQLite
        2.8, schema changes to attached databases were not allowed.</p>
      <p>
        You cannot create a new table with the same name as a table in an attached database,
        but you can attach a database which contains tables whose names are duplicates of
        tables in the main database. It is also permissible to attach the same database
        file multiple times.</p>
      <p>
        Tables in an attached database can be referred to using the syntax <i>database-name.table-name</i>.
        If an attached table doesn't have a duplicate table name in the main database, it
        doesn't require a database name prefix. When a database is attached, all of its
        tables which don't have duplicate names become the default table of that name. Any
        tables of that name attached afterwards require the table prefix. If the default
        table of a given name is detached, then the last table of that name attached becomes
        the new default.</p>
      <p>
        Transactions involving multiple attached databases are atomic, assuming that the
        main database is not ":memory:". If the main database is ":memory:" then transactions
        continue to be atomic within each individual database file. But if the host computer
        crashes in the middle of a COMMIT where two or more database files are updated,
        some of those files might get the changes where others might not. Atomic commit
        of attached databases is a new feature of SQLite version 3.0. In SQLite version
        2.8, all commits to attached databases behaved as if the main database were ":memory:".
      </p>
      <p>
        There is a compile-time limit of 10 attached database files.</p>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































Deleted Doc/Extra/lang_comment.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>comment</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">comment</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        comment</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">comment</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">SQL-comment</font></i><b><font
                color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"> </font></b><i><font
                  color="#ff3434">C-comment</font></i><b><font color="#2c2cf0"></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">SQL-comment</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">-- </font></b><i><font color="#ff3434">single-line</font></i><b><font
                color="#2c2cf0"></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">C-comment</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">/<big>*</big> </font></b><i><font color="#ff3434">multiple-lines</font></i><b><font
                color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"><big>*</big>/</font></b>]<b><font
                  color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        Comments aren't SQL commands, but can occur in SQL queries. They are treated as
        whitespace by the parser. They can begin anywhere whitespace can be found, including
        inside expressions that span multiple lines.
      </p>
      <p>
        SQL comments only extend to the end of the current line.</p>
      <p>
        C comments can span any number of lines. If there is no terminating delimiter, they
        extend to the end of the input. This is not treated as an error. A new SQL statement
        can begin on a line after a multiline comment ends. C comments can be embedded anywhere
        whitespace can occur, including inside expressions, and in the middle of
          other SQL
        statements. C comments do not nest. SQL comments inside a C comment will be ignored.
      </p>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































Deleted Doc/Extra/lang_conflict.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>ON CONFLICT</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">ON CONFLICT clause</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        ON CONFLICT clause</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">conflict-clause</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">ON CONFLICT </font></b><i><font color="#ff3434">conflict-algorithm</font></i><b><font
                color="#2c2cf0"></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">conflict-algorithm</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">ROLLBACK </font></b><big>|</big><b><font color="#2c2cf0">
                ABORT </font></b><big>|</big><b><font color="#2c2cf0"> FAIL </font></b><big>|</big><b><font
                  color="#2c2cf0"> IGNORE </font></b><big>|</big><b><font color="#2c2cf0"> REPLACE</font></b></td>
          </tr>
        </table>
      </p>
      <p>
        The ON CONFLICT clause is not a separate SQL command. It is a non-standard clause
        that can appear in many
          other SQL commands. It is given its own section in this
        document because it is not part of standard SQL and therefore might not be familiar.</p>
      <p>
        The syntax for the ON CONFLICT clause is as shown above for the CREATE TABLE command.
        For the INSERT and UPDATE commands, the keywords "ON CONFLICT" are replaced by "OR",
        to make the syntax seem more natural. For example, instead of "INSERT ON CONFLICT
        IGNORE" we have "INSERT OR IGNORE". The keywords change but the meaning of the clause
        is the same either way.</p>
      <p>
        The ON CONFLICT clause specifies an algorithm used to resolve constraint conflicts.
        There are five choices: ROLLBACK, ABORT, FAIL, IGNORE, and REPLACE. The default
        algorithm is ABORT. This is what they mean:</p>
      <dl>
        <dt><b>ROLLBACK</b> </dt>
        <dd>
          <p>
            When a constraint violation occurs, an immediate ROLLBACK occurs, thus ending the
            current transaction, and the command aborts with a return code of SQLITE_CONSTRAINT.
            If no transaction is active (other than the implied transaction that is created
            on every command) then this algorithm works the same as ABORT.</p>
        </dd>
        <dt><b>ABORT</b> </dt>
        <dd>
          <p>
            When a constraint violation occurs, the command backs out any prior changes it might
            have made and aborts with a return code of SQLITE_CONSTRAINT. But no ROLLBACK is
            executed so changes from prior commands within the same transaction are preserved.
            This is the default behavior.</p>
        </dd>
        <dt><b>FAIL</b> </dt>
        <dd>
          <p>
            When a constraint violation occurs, the command aborts with a return code SQLITE_CONSTRAINT.
            But any changes to the database that the command made prior to encountering the
            constraint violation are preserved and are not backed out. For example, if an UPDATE
            statement encountered a constraint violation on the 100th row that it attempts to
            update, then the first 99 row changes are preserved but changes to rows 100 and
            beyond never occur.</p>
        </dd>
        <dt><b>IGNORE</b> </dt>
        <dd>
          <p>
            When a constraint violation occurs, the one row that contains the constraint violation
            is not inserted or changed. But the command continues executing normally. Other
            rows before and after the row that contained the constraint violation continue to
            be inserted or updated normally. No error is returned.</p>
        </dd>
        <dt><b>REPLACE</b> </dt>
        <dd>
          <p>
            When a UNIQUE constraint violation occurs, the pre-existing rows that are causing
            the constraint violation are removed prior to inserting or updating the current
            row. Thus the insert or update always occurs. The command continues executing normally.
            No error is returned. If a NOT NULL constraint violation occurs, the NULL value
            is replaced by the default value for that column. If the column has no default value,
            then the ABORT algorithm is used. If a CHECK constraint violation occurs then the
            IGNORE algorithm is used.</p>
          <p>
            When this conflict resolution strategy deletes rows in order to satisfy a constraint,
            it does not invoke delete triggers on those rows. This behavior might change in
            a future release.</p>
        </dd>
      </dl>
      <p>
        The algorithm specified in the OR clause of a INSERT or UPDATE overrides any algorithm
        specified in a CREATE TABLE. If no algorithm is specified anywhere, the ABORT algorithm
        is used.</p>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































Deleted Doc/Extra/lang_createindex.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>CREATE INDEX</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">CREATE INDEX</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        CREATE INDEX</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">CREATE </font></b>[<b><font color="#2c2cf0">UNIQUE</font></b>]<b><font
                color="#2c2cf0"> INDEX </font></b>[<b><font color="#2c2cf0">IF NOT EXISTS</font></b>]<b><font
                  color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font
                    color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b>
              <i><font color="#ff3434">index-name</font></i><b><font color="#2c2cf0">
                <br />
                ON </font></b><i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0">
                  <big>(</big> </font></b><i><font color="#ff3434">column-name</font></i><b><font color="#2c2cf0">
                  </font></b>[<b><font color="#2c2cf0"><big>,</big> </font></b><i><font color="#ff3434">
                    column-name</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b><big>*</big><b><font
                      color="#2c2cf0"> <big>)</big></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">column-name</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">name</font></i><b><font
                color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"> COLLATE </font></b><i><font
                  color="#ff3434">collation-name</font></i><b><font color="#2c2cf0"></font></b>]<b><font
                    color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"> ASC </font></b><big>|</big><b><font
                      color="#2c2cf0"> DESC </font></b>]<b><font color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        The CREATE INDEX command consists of the keywords "CREATE INDEX" followed by the
        name of the new index, the keyword "ON", the name of a previously created table
        that is to be indexed, and a parenthesized list of names of columns in the table
        that are used for the index key. Each column name can be followed by one of the
        "ASC" or "DESC" keywords to indicate sort order, but the sort order is ignored in
        the current implementation. Sorting is always done in ascending order.</p>
      <p>
        The COLLATE clause following each column name defines a collating sequence used
        for text entires in that column. The default collating sequence is the collating
        sequence defined for that column in the CREATE TABLE statement. Or if no collating
        sequence is otherwise defined, the built-in BINARY collating sequence is used.</p>
      <p>
        There are no arbitrary limits on the number of indices that can be attached to a
        single table, nor on the number of columns in an index.</p>
      <p>
        If the UNIQUE keyword appears between CREATE and INDEX then duplicate index entries
        are not allowed. Any attempt to insert a duplicate entry will result in an error.</p>
      <p>
        The exact text of each CREATE INDEX statement is stored in the <b>sqlite_master</b>
        or <b>sqlite_temp_master</b> table, depending on whether the table being indexed
        is temporary. Every time the database is opened, all CREATE INDEX statements are
        read from the <b>sqlite_master</b> table and used to regenerate
        SQLite's internal
        representation of the index layout.</p>
      <p>
        If the optional IF NOT EXISTS clause is present and another index with the same name aleady exists, then this command becomes a no-op.</p>
      <p>
        Indexes are removed with the <a href="lang_dropindex.html">DROP INDEX</a> command.</p>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































Deleted Doc/Extra/lang_createtable.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>CREATE TABLE</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">CREATE TABLE</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        CREATE TABLE</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-command</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">CREATE </font></b>[<b><font color="#2c2cf0">TEMP </font></b>
              <big>|</big><b><font color="#2c2cf0"> TEMPORARY</font></b>]<b><font color="#2c2cf0">
                TABLE </font></b>[<b><font color="#2c2cf0">IF NOT EXISTS</font></b>]<b><font color="#2c2cf0">
                </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font
                  color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b>
              <i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> <big>(</big><br />
                &nbsp; &nbsp; </font></b><i><font color="#ff3434">column-def</font></i><b><font color="#2c2cf0">
                </font></b>[<b><font color="#2c2cf0"><big>,</big> </font></b><i><font color="#ff3434">
                  column-def</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b><big>*</big><b><font
                    color="#2c2cf0"><br />
                    &nbsp; &nbsp; </font></b>[<b><font color="#2c2cf0"><big>,</big> </font></b>
              <i><font color="#ff3434">constraint</font></i><b><font color="#2c2cf0"></font></b>]<b><font
                color="#2c2cf0"></font></b><big>*</big><b><font color="#2c2cf0"><br />
                  <big>)</big></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-command</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">CREATE </font></b>[<b><font color="#2c2cf0">TEMP </font></b>
              <big>|</big><b><font color="#2c2cf0"> TEMPORARY</font></b>]<b><font color="#2c2cf0">
                TABLE </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font
                  color="#2c2cf0"><big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b>
              <i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> AS </font>
              </b><i><font color="#ff3434">select-statement</font></i><b><font color="#2c2cf0"></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">column-def</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">name</font></i><b><font
                color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">type</font></i><b><font
                  color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"></font></b>[<b><font
                    color="#2c2cf0">CONSTRAINT </font></b><i><font color="#ff3434">name</font></i><b><font
                      color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">
                        column-constraint</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b><big>*</big><b><font
                          color="#2c2cf0"></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">type</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">typename</font></i><b><font
                color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"><br />
                </font></b><i><font color="#ff3434">typename</font></i><b><font color="#2c2cf0"> <big>
                  (</big> </font></b><i><font color="#ff3434">number</font></i><b><font color="#2c2cf0">
                    <big>)</big> </font></b><big>|</big><b><font color="#2c2cf0"><br />
                    </font></b><i><font color="#ff3434">typename</font></i><b><font color="#2c2cf0"> <big>
                      (</big> </font></b><i><font color="#ff3434">number</font></i><b><font color="#2c2cf0">
                        <big>,</big> </font></b><i><font color="#ff3434">number</font></i><b><font color="#2c2cf0">
                          <big>)</big></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">column-constraint</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">NOT NULL </font></b>[<b><font color="#2c2cf0"> </font></b>
              <i><font color="#ff3434">conflict-clause</font></i><b><font color="#2c2cf0"> </font>
              </b>]<b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"><br />
                PRIMARY KEY </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">sort-order</font></i><b><font
                  color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0">
                  </font></b><i><font color="#ff3434">conflict-clause</font></i><b><font color="#2c2cf0">
                  </font></b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0">AUTOINCREMENT</font></b>]<b><font
                    color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"><br />
                      UNIQUE </font></b>[<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">conflict-clause</font></i><b><font
                        color="#2c2cf0"> </font></b>]<b><font color="#2c2cf0"> </font></b><big>|</big><b><font
                          color="#2c2cf0"><br />
                          CHECK <big>(</big> </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0">
                            <big>)</big> </font></b><big>|</big><b><font color="#2c2cf0"><br />
                              DEFAULT </font></b><i><font color="#ff3434">value</font></i><b><font color="#2c2cf0">
                              </font></b><big>|</big><b><font color="#2c2cf0"><br />
                                COLLATE </font></b><i><font color="#ff3434">collation-name</font></i><b><font color="#2c2cf0"></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">constraint</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">PRIMARY KEY <big>(</big> </font></b><i><font color="#ff3434">
                column-list</font></i><b><font color="#2c2cf0"> <big>)</big> </font></b>[<b><font
                  color="#2c2cf0"> </font></b><i><font color="#ff3434">conflict-clause</font></i><b><font
                    color="#2c2cf0"> </font></b>]<b><font color="#2c2cf0"> </font></b><big>|</big><b><font
                      color="#2c2cf0"><br />
                      UNIQUE <big>(</big> </font></b><i><font color="#ff3434">column-list</font></i><b><font
                        color="#2c2cf0"> <big>)</big> </font></b>[<b><font color="#2c2cf0"> </font></b>
              <i><font color="#ff3434">conflict-clause</font></i><b><font color="#2c2cf0"> </font>
              </b>]<b><font color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"><br />
                CHECK <big>(</big> </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0">
                  <big>)</big></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">conflict-clause</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">ON CONFLICT </font></b><i><font color="#ff3434">conflict-algorithm</font></i><b><font
                color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        A CREATE TABLE statement is basically the keywords "CREATE TABLE" followed by the
        name of a new table and a parenthesized list of column definitions and constraints.
        The table name can be either an identifier or a string. Tables names that begin
        with "<b>sqlite_</b>" are reserved for use by the engine.</p>
      <p>
        Each column definition is the name of the column followed by the datatype for that
        column, then one or more optional column constraints. The datatype for the column
        does not restrict what data may be put in that column. See <a href="http://www.sqlite.org/datatype3.html">
          Datatypes In SQLite Version 3</a> for additional information. The UNIQUE constraint
        causes an index to be created on the specified columns. This index must contain
        unique keys. The COLLATE clause specifies what text <a href="http://www.sqlite.org/datatype3.html#collation">
          collating function</a> to use when comparing text entries for the column. The
        built-in BINARY collating function is used by default.
      </p>
      <p>
        The DEFAULT constraint specifies a default value to use when doing an INSERT. The
        value may be NULL, a string constant or a number. Starting with version 3.1.0, the
        default value may also be one of the special case-independant keywords CURRENT_TIME, CURRENT_DATE or CURRENT_TIMESTAMP. If the value is NULL, a string constant or number,
        it is literally inserted into the column whenever an INSERT statement that does
        not specify a value for the column is executed. If the value is CURRENT_TIME, CURRENT_DATE
        or CURRENT_TIMESTAMP, then the current UTC date and/or time is inserted into the
        columns. For CURRENT_TIME, the format is HH:MM:SS. For CURRENT_DATE, YYYY-MM-DD.
        The format for CURRENT_TIMESTAMP is "YYYY-MM-DD HH:MM:SS".
      </p>
      <p>
        Specifying a PRIMARY KEY normally just creates a UNIQUE index on the corresponding
        columns. However, if primary key is on a single column that has datatype INTEGER,
        then that column is used internally as the actual key of the B-Tree for the table.
        This means that the column may only hold unique integer values. (Except for this
        one case, SQLite ignores the datatype specification of columns and allows any kind
        of data to be put in a column regardless of its declared datatype.) If a table does
        not have an INTEGER PRIMARY KEY column, then the B-Tree key will be a automatically
        generated integer. The B-Tree key for a row can always be accessed using one of
        the special names "<b>ROWID</b>", "<b>OID</b>", or "<b>_ROWID_</b>". This is true
        regardless of whether or not there is an INTEGER PRIMARY KEY. An INTEGER PRIMARY
        KEY column man also include the keyword AUTOINCREMENT. The AUTOINCREMENT keyword
        modified the way that B-Tree keys are automatically generated. Additional detail
        on automatic B-Tree key generation is available <a href="http://www.sqlite.org/autoinc.html">
          separately</a>.</p>
      <p>
        If the "TEMP" or "TEMPORARY" keyword occurs in between "CREATE" and "TABLE" then
        the table that is created is only visible within that same database connection and
        is automatically deleted when the database connection is closed. Any indices created
        on a temporary table are also temporary. Temporary tables and indices are stored
        in a separate file distinct from the main database file.</p>
      <p>
        If a &lt;database-name&gt; is specified, then the table is created in the named
        database. It is an error to specify both a &lt;database-name&gt; and the TEMP keyword,
        unless the &lt;database-name&gt; is "temp". If no database name is specified, and
        the TEMP keyword is not present, the table is created in the main database.</p>
      <p>
        The optional conflict-clause following each constraint allows the specification
        of an alternative default constraint conflict resolution algorithm for that constraint. The default is abort ABORT. Different constraints within the same table may have
        different default conflict resolution algorithms. If an COPY, INSERT, or UPDATE
        command specifies a different conflict resolution algorithm, then that algorithm
        is used in place of the default algorithm specified in the CREATE TABLE statement.
        See the section titled <a href="lang_conflict.html">ON CONFLICT</a> for additional
        information.</p>
      <p>
        CHECK constraints are supported as of version 3.3.0. Prior to version 3.3.0, CHECK
        constraints were parsed but not enforced.</p>
      <p>
        There are no arbitrary limits on the number of columns or on the number of constraints
        in a table. The total amount of data in a single row is limited to about 1 megabytes
        in version 2.8. In version 3.0 there is no arbitrary limit on the amount of data
        in a row.</p>
      <p>
        The CREATE TABLE AS form defines the table to be the result set of a query. The
        names of the table columns are the names of the columns in the result.</p>
      <p>
        The exact text of each CREATE TABLE statement is stored in the <b>sqlite_master</b>
        table. Every time the database is opened, all CREATE TABLE statements are read from
        the <b>sqlite_master</b> table and used to regenerate
        SQLite's internal representation
        of the table layout. If the original command was a CREATE TABLE AS then then an
        equivalent CREATE TABLE statement is synthesized and store in <b>sqlite_master</b>
        in place of the original command. The text of CREATE TEMPORARY TABLE statements
        are stored in the <b>sqlite_temp_master</b> table.
      </p>
      <p>
        If the optional IF NOT EXISTS clause is present and another table with the same
        name aleady exists, then this command becomes a no-op.</p>
      <p>
        Tables are removed using the <a href="lang_droptable.html">DROP TABLE</a> statement.
      </p>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































































































































































































































Deleted Doc/Extra/lang_createtrigger.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>CREATE TABLE</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">CREATE TRIGGER</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        CREATE TRIGGER</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">CREATE </font></b>[<b><font color="#2c2cf0">TEMP </font></b>
              <big>|</big><b><font color="#2c2cf0"> TEMPORARY</font></b>]<b><font color="#2c2cf0">
                TRIGGER </font></b><i><font color="#ff3434">trigger-name</font></i><b><font color="#2c2cf0">
                </font></b>[<b><font color="#2c2cf0"> BEFORE </font></b><big>|</big><b><font color="#2c2cf0">
                  AFTER </font></b>]<b><font color="#2c2cf0"><br />
                  </font></b><i><font color="#ff3434">database-event</font></i><b><font color="#2c2cf0">
                    ON </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font
                      color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b>
              <i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"><br />
              </font></b><i><font color="#ff3434">trigger-action</font></i><b><font color="#2c2cf0"></font></b></td>
          </tr>
        </table>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">CREATE </font></b>[<b><font color="#2c2cf0">TEMP </font></b>
              <big>|</big><b><font color="#2c2cf0"> TEMPORARY</font></b>]<b><font color="#2c2cf0">
                TRIGGER </font></b><i><font color="#ff3434">trigger-name</font></i><b><font color="#2c2cf0">
                  INSTEAD OF<br />
                </font></b><i><font color="#ff3434">database-event</font></i><b><font color="#2c2cf0">
                  ON </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font
                    color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b>
              <i><font color="#ff3434">view-name</font></i><b><font color="#2c2cf0"><br />
              </font></b><i><font color="#ff3434">trigger-action</font></i><b><font color="#2c2cf0"></font></b></td>
          </tr>
        </table>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">database-event</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">DELETE </font></b><big>|</big><b><font color="#2c2cf0">
                <br />
                INSERT </font></b><big>|</big><b><font color="#2c2cf0">
                  <br />
                  UPDATE </font></b><big>|</big><b><font color="#2c2cf0">
                    <br />
                    UPDATE OF </font></b><i><font color="#ff3434">column-list</font></i><b><font color="#2c2cf0"></font></b></td>
          </tr>
        </table>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">trigger-action</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0"></font></b>[<b><font color="#2c2cf0"> FOR EACH ROW </font>
              </b><big>|</big><b><font color="#2c2cf0"> FOR EACH STATEMENT </font></b>]<b><font
                color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"> WHEN </font></b><i><font color="#ff3434">
                  expression</font></i><b><font color="#2c2cf0"> </font></b>]<b><font color="#2c2cf0">
                    <br />
                    BEGIN
                    <br />
                    &nbsp; &nbsp; </font></b><i><font color="#ff3434">trigger-step</font></i><b><font
                      color="#2c2cf0"> ; </font></b>[<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">
                        trigger-step</font></i><b><font color="#2c2cf0"> ; </font></b>]<b><font color="#2c2cf0"></font></b><big>*</big><b><font
                          color="#2c2cf0"><br />
                          END</font></b></td>
          </tr>
        </table>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">trigger-step</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">update-statement</font></i><b><font
                color="#2c2cf0"> </font></b><big>|</big><b><font color="#2c2cf0"> </font></b><i><font
                  color="#ff3434">insert-statement</font></i><b><font color="#2c2cf0"> </font></b>
              <big>|</big><b><font color="#2c2cf0">
                <br />
              </font></b><i><font color="#ff3434">delete-statement</font></i><b><font color="#2c2cf0">
              </font></b><big>|</big><b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">
                select-statement</font></i><b><font color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        The CREATE TRIGGER statement is used to add triggers to the database schema. Triggers
        are database operations (the <i>trigger-action</i>) that are automatically performed
        when a specified database event (the <i>database-event</i>) occurs.
      </p>
      <p>
        A trigger may be specified to fire whenever a DELETE, INSERT or UPDATE of a particular
        database table occurs, or whenever an UPDATE of one or more specified columns of
        a table are updated.</p>
      <p>
        At this time SQLite supports only FOR EACH ROW triggers, not FOR EACH STATEMENT
        triggers. Hence explicitly specifying FOR EACH ROW is optional. FOR EACH ROW implies
        that the SQL statements specified as <i>trigger-steps</i> may be executed (depending
        on the WHEN clause) for each database row being inserted, updated or deleted by
        the statement causing the trigger to fire.</p>
      <p>
        Both the WHEN clause and the <i>trigger-steps</i> may access elements of the row
        being inserted, deleted or updated using references of the form "NEW.<i>column-name</i>"
        and "OLD.<i>column-name</i>", where <i>column-name</i> is the name of a column from the table that the trigger is associated with. OLD and NEW references may only be
        used in triggers on <i>trigger-event</i>s for which they are relevant, as follows:</p>
      <p>
        <table border="0" cellpadding="10">
          <tr>
            <td align="right" valign="top" width="120">
              <i>INSERT</i></td>
            <td valign="top">
              NEW references are valid</td>
          </tr>
          <tr>
            <td align="right" valign="top" width="120">
              <i>UPDATE</i></td>
            <td valign="top">
              NEW and OLD references are valid</td>
          </tr>
          <tr>
            <td align="right" valign="top" width="120">
              <i>DELETE</i></td>
            <td valign="top">
              OLD references are valid</td>
          </tr>
        </table>
      </p>
      <p>
      </p>
      <p>
        If a WHEN clause is supplied, the SQL statements specified as <i>trigger-steps</i>
        are only executed for
        rows for which the WHEN clause is true. If no WHEN clause
        is supplied, the SQL statements are executed for all rows.</p>
      <p>
        The specified <i>trigger-time</i> determines when the <i>trigger-steps</i> will
        be executed relative to the insertion, modification or removal of the associated
        row.</p>
      <p>
        An ON CONFLICT clause may be specified as part of an UPDATE or INSERT <i>trigger-step</i>.
        However if an ON CONFLICT clause is specified as part of the statement causing the
        trigger to fire, then this conflict handling policy is used instead.</p>
      <p>
        Triggers are automatically dropped when the table that they are associated with
        is dropped.</p>
      <p>
        Triggers may be created on views, as well as ordinary tables, by specifying INSTEAD
        OF in the CREATE TRIGGER statement. If one or more ON INSERT, ON DELETE or ON UPDATE
        triggers are defined on a view, then it is not an error to execute an INSERT, DELETE
        or UPDATE statement on the view, respectively. Thereafter, executing an INSERT,
        DELETE or UPDATE on the view causes the associated triggers to fire. The real tables
        underlying the view are not modified (except possibly explicitly, by a trigger program).</p>
      <p>
        <b>Example:</b></p>
      <p>
        Assuming that customer records are stored in the "customers" table, and that order
        records are stored in the "orders" table, the following trigger ensures that all
        associated orders are redirected when a customer changes his or her address:</p>
      <blockquote>
        <pre>
CREATE TRIGGER update_customer_address UPDATE OF address ON customers 
  BEGIN
    UPDATE orders SET address = new.address WHERE customer_name = old.name;
  END;
</pre>
      </blockquote>
      <p>
        With this trigger installed, executing the statement:</p>
      <blockquote>
        <pre>
UPDATE customers SET address = '1 Main St.' WHERE name = 'Jack Jones';
</pre>
      </blockquote>
      <p>
        causes the following to be automatically executed:</p>
      <blockquote>
        <pre>
UPDATE orders SET address = '1 Main St.' WHERE customer_name = 'Jack Jones';
</pre>
      </blockquote>
      <p>
        Note that currently, triggers may behave oddly when created on tables with INTEGER
        PRIMARY KEY fields. If a BEFORE trigger program modifies the INTEGER PRIMARY KEY
        field of a row that will be subsequently updated by the statement that causes the
        trigger to fire, then the update may not occur. The workaround is to declare the
        table with a PRIMARY KEY column instead of an INTEGER PRIMARY KEY column.</p>
      <p>
        A special SQL function RAISE() may be used within a trigger-program, with the following
        syntax</p>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">raise-function</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">RAISE <big>(</big> ABORT<big>,</big> </font></b><i><font
                color="#ff3434">error-message</font></i><b><font color="#2c2cf0"> <big>)</big> </font>
                </b><big>|</big><b><font color="#2c2cf0">
                  <br />
                  RAISE <big>(</big> FAIL<big>,</big> </font></b><i><font color="#ff3434">error-message</font></i><b><font
                    color="#2c2cf0"> <big>)</big> </font></b><big>|</big><b><font color="#2c2cf0">
                      <br />
                      RAISE <big>(</big> ROLLBACK<big>,</big> </font></b><i><font color="#ff3434">error-message</font></i><b><font
                        color="#2c2cf0"> <big>)</big> </font></b><big>|</big><b><font color="#2c2cf0">
                          <br />
                          RAISE <big>(</big> IGNORE <big>)</big></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        When one of the first three forms is called during trigger-program execution, the
        specified ON CONFLICT processing is performed (either ABORT, FAIL or ROLLBACK) and
        the current query terminates. An error code of SQLITE_CONSTRAINT is returned to
        the user, along with the specified error message.</p>
      <p>
        When RAISE(IGNORE) is called, the remainder of the current trigger program, the
        statement that caused the trigger program to execute and any subsequent trigger
        programs that would of been executed are abandoned. No database changes are rolled
        back. If the statement that caused the trigger program to execute is itself part
        of a trigger program, then that trigger program resumes execution at the beginning
        of the next step.
      </p>
      <p>
        Triggers are removed using the <a href="lang_droptrigger.html">DROP TRIGGER</a>
        statement.</p>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































































































































































































































































Deleted Doc/Extra/lang_createview.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>CREATE VIEW</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">CREATE VIEW</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        CREATE VIEW</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-command</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">CREATE </font></b>[<b><font color="#2c2cf0">TEMP </font></b>
              <big>|</big><b><font color="#2c2cf0"> TEMPORARY</font></b>]<b><font color="#2c2cf0">
                VIEW </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font
                  color="#2c2cf0"><big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b>
              <i><font color="#ff3434">view-name</font></i><b><font color="#2c2cf0"> AS </font></b>
              <i><font color="#ff3434">select-statement</font></i><b><font color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        The CREATE VIEW command assigns a name to a pre-packaged <a href="lang_select.html">
          SELECT</a> statement. Once the view is created, it can be used in the FROM clause
        of another SELECT in place of a table name. 
      </p>
      <p>
        If the "TEMP" or "TEMPORARY" keyword occurs in between "CREATE" and "VIEW" then
        the view that is created is only visible to the process that opened the database
        and is automatically deleted when the database is closed.</p>
      <p>
        If a &lt;database-name&gt; is specified, then the view is created in the named database.
        It is an error to specify both a &lt;database-name&gt; and the TEMP keyword, unless
        the &lt;database-name&gt; is "temp". If no database name is specified, and the TEMP
        keyword is not present, the table is created in the main database.</p>
      <p>
        You cannot COPY, DELETE, INSERT or UPDATE a view. Views are read-only in SQLite.
        However, in many cases you can use a <a href="lang_createtrigger.html">TRIGGER</a>
        on the view to accomplish the same thing. Views are removed with the <a href="lang_dropview.html">
          DROP VIEW</a> command.</p>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































Deleted Doc/Extra/lang_createvtab.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>CREATE VIRTUAL TABLE</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">CREATE VIRTUAL TABLE</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        CREATE VIRTUAL TABLE</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-command</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">CREATE VIRTUAL TABLE </font></b>[<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font
                  color="#2c2cf0"> </font></b><i><font color="#ff3434">table-name</font></i><b><font
                    color="#2c2cf0"> USING </font></b><i><font color="#ff3434">module-name</font></i><b><font
                      color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"><big>(</big> </font></b>
              <i><font color="#ff3434">arguments</font></i><b><font color="#2c2cf0"> <big>)</big></font></b>]<b><font
                color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        A virtual table is an interface to an external storage or computation engine that
        appears to be a table but does not actually store information in the database file.</p>
      <p>
        In general, you can do anything with a virtual table that can be done with an ordinary
        table, except that you cannot create triggers on a virtual table. Some virtual table
        implementations might impose additional restrictions. For example, many virtual
        tables are read-only.</p>
      <p>
        The &lt;module-name&gt; is the
        name of an object that implements the virtual table.
        The &lt;module-name&gt; must be registered with the SQLite database connection using
        <a href="capi3ref.html#sqlite3_create_module">sqlite3_create_module</a> prior to
        issuing the CREATE VIRTUAL TABLE statement. The module takes zero or more comma-separated
        arguments. The arguments can be just about any text as long as it has balanced parentheses.
        The argument syntax is sufficiently general that the arguments can be made to appear
        as column definitions in a traditional <a href="lang_createtable.html">CREATE TABLE</a>
        statement. SQLite passes the module arguments directly to the module without any
        interpretation. It is the responsibility of the module implementation to parse and
        interpret its own arguments.</p>
      <p>
        A virtual table is destroyed using the ordinary <a href="lang_droptable.html">DROP
          TABLE</a> statement. There is no DROP VIRTUAL TABLE statement.</p>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































Deleted Doc/Extra/lang_datetime.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>DateTime Functions</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">Date and Time Functions</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">Date and Time Functions</h1>
<p>Five date and time functions are available, as follows:

<p><ol>
<li>date( <i>timestring</i>, <i>modifier</i>, <i>modifier</i>, ...)
<li>time( <i>timestring</i>, <i>modifier</i>, <i>modifier</i>, ...)
<li>datetime( <i>timestring</i>, <i>modifier</i>, <i>modifier</i>, ...)
<li>julianday( <i>timestring</i>, <i>modifier</i>, <i>modifier</i>, ...)
<li>strftime( <i>format</i>, <i>timestring</i>, <i>modifier</i>, <i>modifier</i>, ...)
</ol>

<p>All five functions take a time string as an argument.  This
time string may be followed by zero or more modifiers.  The
<b>strftime()</b> function also takes a format string as its first
argument.

<p>The <b>date()</b> function returns the date in this format: YYYY-MM-DD.
The <b>time()</b> function returns the time as HH:MM:SS.  The <b>datetime()</b>
function returns &quot;YYYY-MM-DD HH:MM:SS&quot;.  The <b>julianday()</b> function
returns the number of days since noon in Greenwich on November 24, 4714 B.C.
The julian day number is the preferred internal representation of
dates.  The <b>strftime()</b> routine returns the date formatted according
to the format string specified as the first argument.  The format string
supports most, but not all, of the more common substitutions found in
the strftime() function from the standard C library:

<p><pre>
   %d  day of month
   %f  ** fractional seconds  SS.SSS
   %H  hour 00-24
   %j  day of year 001-366
   %J  ** Julian day number
   %m  month 01-12
   %M  minute 00-59
   %s  seconds since 1970-01-01
   %S  seconds 00-59
   %w  day of week 0-6  sunday==0
   %W  week of year 00-53
   %Y  year 0000-9999
   %%  %
</pre>

<p>The %f and %J conversions are new.  Notice that all of the other four
functions could be expressed in terms of <b>strftime()</b>.

<p><pre>
   date(...)      -&gt;  strftime(&quot;%Y-%m-%d&quot;, ...)
   time(...)      -&gt;  strftime(&quot;%H:%M:%S&quot;, ...)
   datetime(...)  -&gt;  strftime(&quot;%Y-%m-%d %H:%M:%S&quot;, ...)
   julianday(...) -&gt;  strftime(&quot;%J&quot;, ...)
</pre>

<p>The only reasons for providing functions other than <b>strftime()</b> is for
convenience and for efficiency.

<p><b>Time Strings</b>

<p>A time string can be in any of the following formats:

<p><ol>
<li>YYYY-MM-DD
<li>YYYY-MM-DD HH:MM
<li>YYYY-MM-DD HH:MM:SS
<li>YYYY-MM-DD HH:MM:SS.SSS
<li>YYYY-MM-DDTHH:MM
<li>YYYY-MM-DDTHH:MM:SS
<li>YYYY-MM-DDTHH:MM:SS.SSS
<li>HH:MM
<li>HH:MM:SS
<li>HH:MM:SS.SSS
<li>now
<li>DDDD.DDDD
</ol>

<p>In formats 5 through 7, the &quot;T&quot; is a literal character separating the date and the time, as required by the ISO-8601 standard. These formats are supported in SQLite 3.2.0 and later.
Formats 8 through 10 that specify only a time assume a date of 2000-01-01.
Format 11, the string 'now', is converted into the current date and time.
Universal Coordinated Time (UTC) is used.
Format 12 is the julian day number expressed as a floating point value.

<p><b>Modifiers</b>

<p>The time string can be followed by zero or more modifiers that alter the
date or alter the interpretation of the date.  The available modifiers
are as follows.

<p><ol>
<li>NNN days
<li>NNN hours
<li>NNN minutes
<li>NNN.NNNN seconds
<li>NNN months  (see <a href="tktview?tn=551">#551</a>
 and <a href="chngview?cn=1163">[1163]</a>
)
<li>NNN years  (see <a href="tktview?tn=551">#551</a>
 and <a href="chngview?cn=1163">[1163]</a>
)
<li>start of month
<li>start of year
<li>start of week  (withdrawn -- will not be implemented)
<li>start of day
<li>weekday N  (see <a href="tktview?tn=551">#551</a>
 and <a href="chngview?cn=1163">[1163]</a>
)
<li>unixepoch
<li>localtime
<li>utc
</ol>

<p>The first six modifiers (1 through 6) simply add the specified amount
of time to the date specified by the preceding timestring.

<p>The &quot;start of&quot; modifiers (7 through 10) shift the date backwards to
the beginning of the current month, year or day.

<p>The &quot;weekday&quot; modifier advances the date forward to the next date where
the weekday number is N.  Sunday is 0, Monday is 1, and so forth.

<p>The &quot;unixepoch&quot; modifier (12) only works if it immediately follows
a timestring in the DDDDDDDDDD format.  This modifier causes the DDDDDDDDDD
to be interpreted not as a julian day number as it normally would be, but
as the number of seconds since 1970.  This modifier allows unix-based times
to be converted to julian day numbers easily.

<p>The &quot;localtime&quot; modifier (13) adjusts the previous time string so that it
displays the correct local time.  &quot;utc&quot; undoes this.

<p><b>Examples</b>

<p>Compute the current date.

<p><pre>
  SELECT date('now');
</pre>

<p>Compute the last day of the current month.

<p><pre>
  SELECT date('now','start of month','+1 month','-1 day');
</pre>

<p>Compute the date and time given a unix timestamp 1092941466.

<p><pre>
  SELECT datetime(1092941466, 'unixepoch');
</pre>

<p>Compute the date and time given a unix timestamp 1092941466, and compensate for your local timezone.

<p><pre>
  SELECT datetime(1092941466, 'unixepoch', 'localtime');
</pre>

<p>Compute the current unix timestamp.

<p><pre>
  SELECT strftime('%s','now');
</pre>

<p>Compute the number of days since the battle of Hastings.

<p><pre>
  SELECT julianday('now') - julianday('1066-10-14','gregorian');
</pre>

<p>Compute the number of seconds between two dates:

<p><pre>
  SELECT julianday('now')*86400 - julianday('2004-01-01 02:34:56')*86400;
</pre>

<p>Compute the date of the first Tuesday in October (January + 9) for the current
year.

<p><pre>
  SELECT date('now','start of year','+9 months','weekday 2');
</pre>

<p><b>Caveats And Bugs</b>

<p>The computation of local time depends heavily on the whim of local
politicians and is thus difficult to get correct for all locales.  In
this implementation, the standard C library function localtime() is
used to assist in the calculation of local time.
Note that localtime() is not
threadsafe, so use of the &quot;localtime&quot; modifier is not threadsafe.
Also, the localtime() C function normally only works for years between
1970 and 2037.  For dates outside this range, SQLite attempts to
map the year into an equivalent year within this range, do the
calculation, then map the year back.

<p><i>Please surround uses of localtime() with sqliteOsEnterMutex() and sqliteOsLeaveMutex() so threads
using SQLite are protected, at least!
-- e</i>  It is so. --drh

<p><i>[Consider instead, using localtime_r which is reentrant and may be used
*without* expensive mutex locking. Although non-standard it's available
on most Unixes --hauk]</i> But it is not available on windows, as far as I
am aware. --drh On windows localtime() is thread-safe if the MT C runtime is used. The MT runtime uses thread-local storage for the static variables, the kind functions use.--gr <i>[What about using localtime_r, and on systems where it
is unavailable defining it as sqliteOsEnterMutext() ; locatime() ; sqliteOsLeaveMutex()
so that non-windows systems get the maximum advantage, with almost zero
code impact?]</i> The autoconfigury and patch for localtime_r is here: <font color="#a0a0a0">&curren;</font><a href="http://www.sqlite.org/cvstrac/tktview?tn=1906">http://www.sqlite.org/cvstrac/tktview?tn=1906</a> . I'm curious why this obvious fix is not applied. gmtime() also suffers from this same threadsafety problem.

<p>Date computations do not give correct results for dates before Julian
day number 0 (-4713-11-24 12:00:00).

<p>All internal computations assume the Gregorian calendar system.

<p><hr>
<i>An anonymous user adds:</i> <br>

For my use I added new functions and functionalities to the date functions that
come with the sqlite 3.3.0 (can be used in older versions as well with small effort).

<p>In main lines they are as follows:

<p><ol>
<li>NNN days
<li>NNN hours
<li>NNN minutes
<li>NNN.NNNN seconds
<li>NNN months  (see <a href="tktview?tn=551">#551</a>
 and <a href="chngview?cn=1163">[1163]</a>
)
<li>NNN years  (see <a href="tktview?tn=551">#551</a>
 and <a href="chngview?cn=1163">[1163]</a>
)
<li>start of month
<li>start of year
<li>start of week  (!!! implemented)
<li>start of day
<li>weekday N  (see <a href="tktview?tn=551">#551</a>
 and <a href="chngview?cn=1163">[1163]</a>
)
<li>unixepoch
<li>localtime
<li>utc
<li>julian  (not implemented as of 2004-01-05)
<li>gregorian  (not implemented as of 2004-01-05)
<li>start of minute
<li>start of hour
<li>end of minute
<li>end of hour
<li>end of day
<li>end of week
<li>end of month
<li>end of year
<li>group seconds by
<li>group minutes by
<li>group hours by
<li>group days by
<li>group weeks by
<li>group months by
<li>group years by
</ol>

<p>The &quot;start of&quot; modifiers (7 through 10 and 17 through 18) shift the date backwards to the beginning of the current minute, hour, week, month, year or day.

<p>The &quot;end of&quot; modifiers (19 through 24) shift the date forwards to
the end of the current minute, hour, week, month, year or day.

<p>The &quot;group * by&quot; modifiers (25 through 31) round the date to the closest backward multiple supplied, with some limitations, to the current seconds (1 through 30), minutes (1 through 30), hours (1 through 12), days (1 through 15), weeks (1 through 26), months (1 through 6), years (1 through 100), these limitations are due to dont complicate the calculations when a multiple can span beyound the unit modified.

<p>Ex:

<p>SELECT datetime('2006-02-04 20:09:23','group hours by 3'); =&gt; '2006-02-04 18:00:00'

<p>SELECT datetime('2006-02-05 20:09:23','group days by 3'); =&gt; '2006-02-04 00:00:00'

<p>New functions &quot;week_number(date)&quot; returns the week number of the year on the supplied date parameter, &quot;datetime2seconds(datetime)&quot; return the number of seconds from the supplied datetime parameter.
      <hr>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































































































































































































































































































































































































































































Deleted Doc/Extra/lang_delete.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>DELETE</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">DELETE</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        DELETE</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">DELETE FROM </font></b>[<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font
                  color="#2c2cf0"> </font></b><i><font color="#ff3434">table-name</font></i><b><font
                    color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0">WHERE </font></b><i><font color="#ff3434">
                      expr</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        The DELETE command is used to remove records from a table. The command consists
        of the "DELETE FROM" keywords followed by the
        name of the table from which records
        are to be removed.
      </p>
      <p>
        Without a WHERE clause, all rows of the table are removed. If a WHERE clause is
        supplied, then only those rows that match the expression are removed.</p>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































Deleted Doc/Extra/lang_detach.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>DETACH</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">DETACH</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        DETACH</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-command</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">DETACH </font></b>[<b><font color="#2c2cf0">DATABASE</font></b>]<b><font
                color="#2c2cf0"> </font></b><i><font color="#ff3434">database-name</font></i><b><font
                  color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        This statement detaches an additional database connection previously attached using
        the <a href="lang_attach.html">ATTACH DATABASE</a> statement. It is possible to have the same database file attached multiple times using different names, and detaching
        one connection to a file will leave the others intact.</p>
      <p>
        This statement will fail if SQLite is in the middle of a transaction.</p>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































Deleted Doc/Extra/lang_dropindex.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>DROP INDEX</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">DROP INDEX</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        DROP INDEX</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-command</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">DROP INDEX </font></b>[<b><font color="#2c2cf0">IF EXISTS</font></b>]<b><font
                color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font
                  color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b>
              <i><font color="#ff3434">index-name</font></i><b><font color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        The DROP INDEX statement removes an index added with the <a href="lang_createindex.html">
          CREATE INDEX</a> statement. The index named is completely removed from the disk.
        The only way to recover the index is to reenter the appropriate CREATE INDEX command.</p>
      <p>
        The DROP INDEX statement does not reduce the size of the database file in the default
        mode. Empty space in the database is retained for later INSERTs. To remove free
        space in the database, use the <a href="lang_vacuum.html">
          VACUUM</a> command. If
        AUTOVACUUM mode is enabled for a database then space will be freed automatically by DROP INDEX.</p>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































Deleted Doc/Extra/lang_droptable.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>DROP TABLE</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">DROP TABLE</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        DROP TABLE</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-command</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">DROP TABLE </font></b>[<b><font color="#2c2cf0">IF EXISTS</font></b>]<b><font
                color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font
                  color="#2c2cf0"><big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b>
              <i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        The DROP TABLE statement removes a table added with the <a href="#createtable">CREATE TABLE</a> statement. The
        name specified is the table name. It is completely removed
        from the database schema and the disk file. The table can not be recovered. All
        indices associated with the table are also deleted.</p>
      <p>
        The DROP TABLE statement does not reduce the size of the database file in the default
        mode. Empty space in the database is retained for later INSERTs. To remove free
        space in the database, use the <a href="lang_vacuum.html">
          VACUUM</a> command. If
        AUTOVACUUM mode is enabled for a database then space will be freed automatically by DROP TABLE.</p>
      <p>
        The optional IF EXISTS clause suppresses the error that would normally result if the table does not exist.</p>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































Deleted Doc/Extra/lang_droptrigger.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>DROP TRIGGER</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">DROP TRIGGER</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        DROP TRIGGER</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">DROP TRIGGER </font></b>[<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font
                  color="#2c2cf0"> </font></b><i><font color="#ff3434">trigger-name</font></i><b><font
                    color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        The DROP TRIGGER statement removes a trigger created by the <a href="lang_createtrigger.html">
          CREATE TRIGGER</a> statement. The trigger is deleted from the database schema.
        Note that triggers are automatically dropped when the associated table is dropped.</p>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































Deleted Doc/Extra/lang_dropview.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>DROP VIEW</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">DROP VIEW</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        DROP VIEW</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-command</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">DROP VIEW </font></b><i><font color="#ff3434">view-name</font></i><b><font
                color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        The DROP VIEW statement removes a view created by the <a href="#createview">CREATE VIEW</a> statement. The
        name specified is the view name. It is removed from the
        database schema, but no actual data
        in the underlying base tables is modified.</p>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































Deleted Doc/Extra/lang_explain.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>EXPLAIN</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">EXPLAIN</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        EXPLAIN</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">EXPLAIN </font></b><i><font color="#ff3434">sql-statement</font></i><b><font
                color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        The EXPLAIN command modifier is a non-standard extension. The idea comes from a similar command found in PostgreSQL, but the operation is completely different.</p>
      <p>
        If the EXPLAIN keyword appears before any
          other SQLite SQL command then instead
        of actually executing the command, the SQLite library will report back the sequence
        of virtual machine instructions it would have used to execute the command had the
        EXPLAIN keyword not been present. For additional information about virtual machine
        instructions see the <a href="http://www.sqlite.org/arch.html">architecture description</a>
        or the documentation on <a href="http://www.sqlite.org/opcode.html">available opcodes</a>
        for the virtual machine.</p>
      <p>
        &nbsp;</p>
      <hr>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































































Deleted Doc/Extra/lang_expr.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>expression</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
    <style type="text/css">
      .style1
      {
        height: 70px;
      }
    </style>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">expression</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        expression</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">expr</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">expr</font></i><b><font
                color="#2c2cf0"> </font></b><i><font color="#ff3434">binary-op</font></i><b><font
                  color="#2c2cf0"> </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0">
                  </font></b><big>|</big><b><font color="#2c2cf0"><br />
                  </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font>
                  </b>[<b><font color="#2c2cf0">NOT</font></b>]<b><font color="#2c2cf0"> </font></b>
              <i><font color="#ff3434">like-op</font></i><b><font color="#2c2cf0"> </font></b>
              <i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font></b>[<b><font
                color="#2c2cf0">ESCAPE </font></b><i><font color="#ff3434">expr</font></i><b><font
                  color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> </font></b><big>|</big><b><font
                    color="#2c2cf0"><br />
                  </font></b><i><font color="#ff3434">unary-op</font></i><b><font color="#2c2cf0"> </font>
                  </b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font></b>
              <big>|</big><b><font color="#2c2cf0"><br />
                <big>(</big> </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0">
                  <big>)</big> </font></b><big>|</big><b><font color="#2c2cf0"><br />
                  </font></b><i><font color="#ff3434">column-name</font></i><b><font color="#2c2cf0">
                  </font></b><big>|</big><b><font color="#2c2cf0"><br />
                  </font></b><i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0">
                    <big>.</big> </font></b><i><font color="#ff3434">column-name</font></i><b><font color="#2c2cf0">
                    </font></b><big>|</big><b><font color="#2c2cf0"><br />
                    </font></b><i><font color="#ff3434">database-name</font></i><b><font color="#2c2cf0">
                      <big>.</big> </font></b><i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0">
                        <big>.</big> </font></b><i><font color="#ff3434">column-name</font></i><b><font color="#2c2cf0">
                        </font></b><big>|</big><b><font color="#2c2cf0"><br />
                        </font></b><i><font color="#ff3434">literal-value</font></i><b><font color="#2c2cf0">
                        </font></b><big>|</big><b><font color="#2c2cf0"><br />
                        </font></b><i><font color="#ff3434">parameter</font></i><b><font color="#2c2cf0">
                        </font></b><big>|</big><b><font color="#2c2cf0"><br />
                        </font></b><i><font color="#ff3434">function-name</font></i><b><font color="#2c2cf0">
                          <big>(</big> </font></b><i><font color="#ff3434">expr-list</font></i><b><font color="#2c2cf0">
                          </font></b><big>|</big><b><font color="#2c2cf0"> <big>*</big> <big>)</big> </font>
                          </b><big>|</big><b><font color="#2c2cf0"><br />
                          </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> ISNULL
                          </font></b><big>|</big><b><font color="#2c2cf0"><br />
                          </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> NOTNULL
                          </font></b><big>|</big><b><font color="#2c2cf0"><br />
                          </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font>
                          </b>[<b><font color="#2c2cf0">NOT</font></b>]<b><font color="#2c2cf0"> BETWEEN </font>
                          </b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> AND </font></b>
              <i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font></b><big>
                |</big><b><font color="#2c2cf0"><br />
                </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font>
                </b>[<b><font color="#2c2cf0">NOT</font></b>]<b><font color="#2c2cf0"> IN <big>(</big>
                </font></b><i><font color="#ff3434">value-list</font></i><b><font color="#2c2cf0">
                  <big>)</big> </font></b><big>|</big><b><font color="#2c2cf0"><br />
                  </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font>
                  </b>[<b><font color="#2c2cf0">NOT</font></b>]<b><font color="#2c2cf0"> IN <big>(</big>
                  </font></b><i><font color="#ff3434">select-statement</font></i><b><font color="#2c2cf0">
                    <big>)</big> </font></b><big>|</big><b><font color="#2c2cf0"><br />
                    </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font>
                    </b>[<b><font color="#2c2cf0">NOT</font></b>]<b><font color="#2c2cf0"> IN </font></b>
              [<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font
                color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b>
              <i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> </font></b>
              <big>|</big><b><font color="#2c2cf0"><br />
              </font></b>[<b><font color="#2c2cf0">EXISTS</font></b>]<b><font color="#2c2cf0"> <big>
                (</big> </font></b><i><font color="#ff3434">select-statement</font></i><b><font color="#2c2cf0">
                  <big>)</big> </font></b><big>|</big><b><font color="#2c2cf0"><br />
                    CASE </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">expr</font></i><b><font
                      color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> </font></b>(<b><font color="#2c2cf0">
                        WHEN </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0">
                          THEN </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0">
                          </font></b>)+<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0">ELSE </font>
                          </b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"></font></b>]<b><font
                            color="#2c2cf0"> END </font></b><big>|</big><b><font color="#2c2cf0"><br />
                              CAST <big>(</big> </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0">
                                AS </font></b><i><font color="#ff3434">type</font></i><b><font color="#2c2cf0"> <big>
                                  )</big></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">like-op</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">LIKE </font></b><big>|</big><b><font color="#2c2cf0"> GLOB
              </font></b><big>|</big><b><font color="#2c2cf0"> REGEXP </font></b><big>|</big><b><font
                color="#2c2cf0"> MATCH</font></b></td>
          </tr>
        </table>
      </p>
      <p>
        This section is different from the others. Most other sections of this document
        talks about a particular SQL command. This section does not talk about a standalone
        command but about "expressions" which are subcomponents of most other commands.</p>
      <p>
        SQLite understands the following binary operators, in order from highest to lowest
        precedence:</p>
      <blockquote>
        <pre><font color="#2c2cf0"><big>|| * / % + - &lt;&lt; &gt;&gt; &amp; | &lt; &lt;= &gt;
  &gt;= = == != &lt;&gt; </big>IN AND OR</font>
</pre>
      </blockquote>
      <p>
        Supported unary operators are these:</p>
      <blockquote>
        <pre><font color="#2c2cf0"><big>- + ! ~ NOT</big></font>
</pre>
      </blockquote>
      <p>
        The unary operator [Operator +] is a no-op. It can be applied to strings, numbers,
        or blobs and it always gives as its result the value of the operand.</p>
      <p>
        Note that there are two variations of the equals and not equals operators. Equals
        can be either <font color="#2c2cf0"><big>=</big></font> or <font color="#2c2cf0"><big>
          ==</big></font>. The non-equals operator can be either <font color="#2c2cf0"><big>
            !=</big></font> or <font color="#2c2cf0"><big>&lt;&gt;</big></font>. The <font color="#2c2cf0">
              <big>||</big></font> operator is "concatenate" - it joins together the two
        strings of its operands. The operator <font color="#2c2cf0"><big>%</big></font>
        outputs the remainder of its left operand modulo its right operand.</p>
      <p>
        The result of any binary operator is a numeric value, except for the <font color="#2c2cf0">
          <big>||</big></font> concatenation operator which gives a string result.</p>
      <a name="literal_value"></a>
      <p>
        A literal value is an integer number or a floating point number. Scientific notation
        is supported. The "." character is always used as the decimal point even if the
        locale setting specifies "," for this role - the use of "," for the decimal point
        would result in syntactic ambiguity. A string constant is formed by enclosing the
        string in single quotes ('). A single quote within the string can be encoded by
        putting two single quotes in a row - as in Pascal. C-style escapes using the backslash
        character are not supported because they are not standard SQL. BLOB literals are
        string literals containing hexadecimal data and preceded by a single "x" or "X"
        character. For example:</p>
      <blockquote>
        <pre>X'53514697465'
</pre>
      </blockquote>
      <p>
        A literal value can also be the token "NULL".
      </p>
      <p>
        A parameter specifies a placeholder in the expression for a literal value that is
        filled in at runtime using the <a href="capi3ref.html#sqlite3_bind_int">sqlite3_bind</a>
        API. Parameters can take several forms:
      </p>
      <p>
        <table>
          <tr>
            <td align="right" width="1%" nowrap>
              <b>?</b><i>NNN</i></td>
            <td width="20">
            </td>
            <td>
              A question mark followed by a number <i>NNN</i> holds a spot for the NNN-th parameter.
              NNN must be between 1 and 999.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <b>?</b></td>
            <td width="20">
            </td>
            <td>
              A question mark that is not followed by a number holds a spot for the next unused
              parameter.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <b>:</b><i>AAAA</i></td>
            <td width="20">
            </td>
            <td>
              A colon followed by an identifier name holds a spot for a named parameter with the
              name AAAA. Named parameters are also numbered. The number assigned is the next unused
              number. To avoid confusion, it is best to avoid mixing named and numbered parameters.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <b>@</b><i>AAAA</i></td>
            <td width="20">
            </td>
            <td>
              An "at" sign works exactly like a colon.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <b>$</b><i>AAAA</i></td>
            <td width="20">
            </td>
            <td>
              A dollar-sign followed by an identifier name also holds a spot for a named parameter
              with the name AAAA. The identifier name in this case can include one or more occurances
              of "::" and a suffix enclosed in "(...)" containing any text at all. This syntax
              is the form of a variable name in the Tcl programming language.</td>
          </tr>
        </table>
      </p>
      <blockquote>
      </blockquote>
      <p>
        Parameters that are not assigned values using <a href="capi3ref.html#sqlite3_bind_int">
          sqlite3_bind</a> are treated as NULL.</p>
      <a name="like"></a>
      <p>
        The LIKE operator does a pattern matching comparison. The operand to the right contains
        the pattern, the left hand operand contains the string to match against the pattern.
        A percent symbol <font color="#2c2cf0"><big>%</big></font> in the pattern matches
        any sequence of zero or more characters in the string. An underscore <font color="#2c2cf0">
          <big>_</big></font> in the pattern matches any single character in the string.
        Any other character matches itself or it's lower/upper case equivalent (i.e. case-insensitive
        matching). (A bug: SQLite only understands upper/lower case for 7-bit Latin characters.
        Hence the LIKE operator is case sensitive for 8-bit iso8859 characters or UTF-8
        characters. For example, the expression <b>'a' LIKE 'A'</b> is TRUE but <b>'æ' LIKE
          'Æ'</b> is FALSE.).</p>
      <p>
        If the optional ESCAPE clause is present, then the expression following the ESCAPE
        keyword must evaluate to a string consisting of a single character. This character
        may be used in the LIKE pattern to include literal percent or underscore characters.
        The escape character followed by a percent symbol, underscore or itself matches
        a literal percent symbol, underscore or escape character in the string, respectively.
        The infix LIKE operator is implemented by calling the user function <a href="#likeFunc">
          like(<i>X</i>,<i>Y</i>)</a>.</p>
      <p>
        The LIKE operator is not case sensitive and will match upper case characters on
        one side against lower case characters on the other. (A bug: SQLite only understands
        upper/lower case for 7-bit Latin characters. Hence the LIKE operator is case sensitive
        for 8-bit iso8859 characters or UTF-8 characters. For example, the expression <b>'a'
          LIKE 'A'</b> is TRUE but <b>'æ' LIKE 'Æ'</b> is FALSE.).
      </p>
      <p>
      </p>
      <p>
        The infix LIKE operator is implemented by calling the user function <a href="#likeFunc">
          like(<i>X</i>,<i>Y</i>)</a>. If an ESCAPE clause is present, it adds a third parameter
        to the function call. If the functionality of LIKE can be overridden by defining
        an alternative implementation of the like() SQL function.</p>
      <p>
      </p>
      <a name="glob"></a>
      <p>
        The GLOB operator is similar to LIKE but uses the Unix file globbing syntax for
        its wildcards. Also, GLOB is case sensitive, unlike LIKE. Both GLOB and LIKE may
        be preceded by the NOT keyword to invert the sense of the test. The infix GLOB operator
        is implemented by calling the user function <a href="#globFunc">glob(<i>X</i>,<i>Y</i>)</a>
        and can be modified by overriding that function.</p>
      <a name="regexp"></a>
      <p>
        The REGEXP operator is a special syntax for the regexp() user function. No regexp()
        user function is defined by default and so use of the REGEXP operator will normally
        result in an error message. If a user-defined function named "regexp" is added at
        run-time, that function will be called in order to implement the REGEXP operator.</p>
      <a name="match"></a>
      <p>
        The MATCH operator is a special syntax for the match() user function. The default
        match() function implementation raises and exception and is not really useful for
        anything. But extensions can override the match() function with more helpful logic.</p>
      <p>
        A column name can be any of the names defined in the CREATE TABLE statement or one
        of the following special identifiers: "<b>ROWID</b>", "<b>OID</b>", or "<b>_ROWID_</b>".
        These special identifiers all describe the unique random integer key (the "row key")
        associated with every row of every table. The special identifiers only refer to
        the row key if the CREATE TABLE statement does not define a real column with the
        same name. Row keys act like read-only columns. A row key can be used anywhere a
        regular column can be used, except that you cannot change the value of a row key
        in an UPDATE or INSERT statement. "SELECT * ..." does not return the row key.</p>
      <p>
        SELECT statements can appear in expressions as either the right-hand operand of
        the IN operator, as a scalar quantity, or as the operand of an EXISTS operator.
        As a scalar quantity or the operand of an IN operator, the SELECT should have only
        a single column in its result. Compound SELECTs (connected with keywords like UNION
        or EXCEPT) are allowed. With the EXISTS operator, the columns in the result set
        of the SELECT are ignored and the expression returns TRUE if one or more rows exist
        and FALSE if the result set is empty. If no terms in the SELECT expression refer
        to value in the containing query, then the expression is evaluated once prior to
        any other processing and the result is reused as necessary. If the SELECT expression
        does contain variables from the outer query, then the SELECT is reevaluated every
        time it is needed.</p>
      <p>
        When a SELECT is the right operand of the IN operator, the IN operator returns TRUE
        if the result of the left operand is any of the values generated by the select.
        The IN operator may be preceded by the NOT keyword to invert the sense of the test.</p>
      <p>
        When a SELECT appears within an expression but is not the right operand of an IN
        operator, then the first row of the result of the SELECT becomes the value used
        in the expression. If the SELECT yields more than one result row, all rows after the first are ignored. If the SELECT yields no rows, then the value of the SELECT
        is NULL.</p>
      <p>
        A CAST expression changes the datatype of the
        <expr>
</expr>
        into the type specified by &lt;type&gt;. &lt;type&gt; can be any non-empty type
        name that is valid for the type in a column definition of a CREATE TABLE statement.</p>
      <p>
        Both simple and aggregate functions are supported. A simple function can be used
        in any expression. Simple functions return a result immediately based on their inputs.
        Aggregate functions may only be used in a SELECT statement. Aggregate functions
        compute their result across all rows of the result set.</p>
      <p>
        <a name="corefunctions"></a><b>Core Functions</b>
      </p>
      <p>
        The core functions shown below are available by default. Additional functions may
        be written in C and added to the database engine using the <a href="capi3ref.html#cfunc">
          sqlite3_create_function()</a> API.</p>
      <p>
        <table border="0" cellpadding="10">
          <tr>
            <td align="right" valign="top" width="1%" nowrap>
              abs(<i>X</i>)</td>
            <td valign="top">
              Return the absolute value of argument <i>X</i>.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              acos(<i>X</i>)</td>
            <td valign="top">
              A mathematical function that returns the angle, in radians, whose cosine is the 
              specified <b>double</b> expression</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              acosh(<i>X</i>)</td>
            <td valign="top">
              Inverse hyperbolic cosine</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              asin(<i>X</i>)</td>
            <td valign="top">
              Returns the angle, in radians, whose sine is the specified <b>double</b> 
              expression</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              asinh(<i>X</i>)</td>
            <td valign="top">
              Inverse hyperbolic sine</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              atan(<i>X</i>)</td>
            <td valign="top">
              Returns the angle in radians whose tangent is a specified <b>double</b> 
              expression</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              atanh(<i>X</i>)</td>
            <td valign="top">
              Inverse hyperbolic tangent</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap class="style1">
              atn2(<i>X</i>,<i>Y</i>)<br />
              atan2(<i>X</i>,<i>Y</i>)</td>
            <td valign="top" class="style1">
              Returns the angle, in radians, between the positive x-axis and the ray from the 
              origin to the point (y, x), where x and y are the values of the two specified 
              double expressions</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              ceil(<i>X</i>)<br />
              ceiling(<i>X</i>)</td>
            <td valign="top">
              Returns the smallest integer greater than, or equal to, the specified numeric 
              expression</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              charindex(<i>X</i>,<i>Y</i>[,<i>Z</i>])</td>
            <td valign="top">
              Returns the 1-based position of the string <i>X</i> inside the string <i>Y</i> 
              starting at position <i>Z</i>.&nbsp; Returns 0 if not <i>X</i> is not found 
              within <i>Y</i>.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              coalesce(<i>X</i>,<i>Y</i>,...)</td>
            <td valign="top">
              Return a copy of the first non-NULL argument. If all arguments are NULL then NULL
              is returned. There must be at least 2 arguments.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              cos(<i>X</i>)</td>
            <td valign="top">
              a mathematical function that returns the trigonometric cosine of the specified 
              angle, in radians, in the specified expression</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              cosh(<i>X</i>)</td>
            <td valign="top">
              Hyperbolic cosine</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              cot(<i>X</i>)</td>
            <td valign="top">
              A mathematical function that returns the trigonometric cotangent of the 
              specified angle, in radians, in the specified <b>double</b> expression</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              coth(<i>X</i>)</td>
            <td valign="top">
              <span class="h1purpose">Hyperbolic cotangent</span></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              difference(<i>X</i>,<i>Y</i>)</td>
            <td valign="top">
              Returns an integer value that indicates the difference between the SOUNDEX 
              values of two character expressions</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              degrees(<i>X</i>)</td>
            <td valign="top">
              Converts radians to degrees</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              exp(<i>X</i>)</td>
            <td valign="top">
              Returns the exponential value of the specified expression</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              floor(<i>X</i>)</td>
            <td valign="top">
              Returns the largest integer less than or equal to the specified numeric 
              expression</td>
          </tr>
          <tr>
            <a name="globFunc"></a>
            <td align="right" width="1%" nowrap>
              glob(<i>X</i>,<i>Y</i>)</td>
            <td valign="top">
              This function is used to implement the "<b>X GLOB Y</b>" syntax of SQLite. The <a
                href="capi3ref.html#sqlite3_create_function">sqlite3_create_function()</a> interface
              can be used to override this function and thereby change the operation of the <a
                href="#globFunc">GLOB</a> operator.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              ifnull(<i>X</i>,<i>Y</i>)</td>
            <td valign="top">
              Return a copy of the first non-NULL argument. If both arguments are NULL then NULL
              is returned. This behaves the same as <b>coalesce()</b> above.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              last_insert_rowid()</td>
            <td valign="top">
              Return the ROWID of the last row insert from this connection to the database. This
              is the same value that would be returned from the <b>sqlite_last_insert_rowid()</b>
              API function.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              last_rows_affected()</td>
            <td valign="top">
              Returns the number of rows affected by the last insert/update operation</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              leftstr(<i>X</i>,<i>Y</i>)</td>
            <td valign="top">
              Returns the leftmost <i>Y</i> characters in string <i>X</i>.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              length(<i>X</i>)</td>
            <td valign="top">
              Return the string length of <i>X</i> in characters. If SQLite is configured to support
              UTF-8, then the number of UTF-8 characters is returned, not the number of bytes.</td>
          </tr>
          <tr>
            <a name="likeFunc"></a>
            <td align="right" width="1%" nowrap>
              like(<i>X</i>,<i>Y</i> [,<i>Z</i>])</td>
            <td valign="top">
              This function is used to implement the "<b>X LIKE Y [ESCAPE Z]</b>" syntax of SQL.
              If the optional ESCAPE clause is present, then the user-function is invoked with
              three arguments. Otherwise, it is invoked with two arguments only. The <a href="capi3ref.html#sqlite3_create_function">
                sqlite_create_function()</a> interface can be used to override this function and
              thereby change the operation of the <a href="#like">LIKE</a> operator. When doing
              this, it may be important to override both the two and three argument versions of
              the like() function. Otherwise, different code may be called to implement the LIKE
              operator depending on whether or not an ESCAPE clause was specified.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              load_extension(<i>X</i>)<br />
              load_extension(<i>X</i>,<i>Y</i>)</td>
            <td valign="top">
              Load SQLite extensions out of the shared library file named <i>X</i> using the entry
              point <i>Y</i>. The result is a NULL. If <i>Y</i> is omitted then the default entry
              point of <b>sqlite3_extension_init</b> is used. This function raises an exception
              if the extension fails to load or initialize correctly.
            </td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              log(<i>X</i>)</td>
            <td valign="top">
              Returns the natural logarithm of the specified <b>double</b> expression</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              log10(<i>X</i>)</td>
            <td valign="top">
              Returns the base-10 logarithm of the specified <b>double</b> expression</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              lower(<i>X</i>)</td>
            <td valign="top">
              Return a copy of string <i>X</i> will all characters converted to lower case. The
              C library <b>tolower()</b> routine is used for the conversion, which means that
              this function might not work correctly on UTF-8 characters.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              max(<i>X</i>,<i>Y</i>,...)</td>
            <td valign="top">
              Return the argument with the maximum value. Arguments may be strings in addition
              to numbers. The maximum value is determined by the usual sort order. Note that <b>
                max()</b> is a simple function when it has 2 or more arguments but converts to
              an aggregate function if given only a single argument.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              min(<i>X</i>,<i>Y</i>,...)</td>
            <td valign="top">
              Return the argument with the minimum value. Arguments may be strings in addition
              to numbers. The minimum value is determined by the usual sort order. Note that <b>
                min()</b> is a simple function when it has 2 or more arguments but converts to
              an aggregate function if given only a single argument.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              nullif(<i>X</i>,<i>Y</i>)</td>
            <td valign="top">
              Return the first argument if the arguments are different, otherwise return NULL.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              padc(<i>X</i>,<i>Y</i>)</td>
            <td valign="top">
              Pads the given string <i>X</i> on the left and the right with spaces until it is 
              the specified length <i>Y</i></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              padl(<i>X</i>,<i>Y</i>)</td>
            <td valign="top">
              Pads the given string <i>X</i> on the left with spaces until it is the specified 
              length <i>Y</i></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              padr(<i>X</i>,<i>Y</i>)</td>
            <td valign="top">
              Pads the given string <i>X</i> on the right with spaces until it is the 
              specified length <i>Y</i></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              pi</td>
            <td valign="top">
              Returns the value of pi</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              power(<i>X</i>,<i>Y</i>)</td>
            <td valign="top">
              Returns the value of the specified expression <i>X</i> to the specified power <i>
              Y</i></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              proper(<i>X</i>)</td>
            <td valign="top">
              Proper-case the given string <i>X</i></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              quote(<i>X</i>)</td>
            <td valign="top">
              This routine returns a string which is the value of its argument suitable for inclusion
              into another SQL statement. Strings are surrounded by single-quotes with escapes
              on interior quotes as needed. BLOBs are encoded as hexadecimal literals. The current
              implementation of
          VACUUM uses this function. The function is also useful when writing
              triggers to implement undo/redo functionality.
            </td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              radians(<i>X</i>)</td>
            <td valign="top">
              Converts degrees to radians</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              random(*)</td>
            <td valign="top">
              Return a pseudo-random integer between -9223372036854775808 and +9223372036854775807.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              replace(<i>X</i>,<i>Y</i>,<i>Z</i>)</td>
            <td valign="top">
              Replace all occurances of <i>Y</i> inside string <i>X</i> with the replacement 
              text <i>Z</i>.&nbsp; Case-sensitive.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              replicate(<i>X</i>,<i>Y</i>)</td>
            <td valign="top">
              Return the concatenation of string <i>X</i> repeated <i>Y</i> times</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              reverse(<i>X</i>)</td>
            <td valign="top">
              Returns the string <i>X</i> reversed</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              rightstr(<i>X</i>,<i>Y</i>)</td>
            <td valign="top">
              Returns the right-most <i>Y</i> characters in string <i>X</i>.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              round(<i>X</i>)<br />
              round(<i>X</i>,<i>Y</i>)</td>
            <td valign="top">
              Round off the number <i>X</i> to <i>Y</i> digits to the right of the decimal point.
              If the <i>Y</i> argument is omitted, 0 is assumed.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              sign(<i>X</i>)</td>
            <td valign="top">
              Returns the positive (+1), zero (0), or negative (-1) sign of the specified 
              expression</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              sin(<i>X</i>)</td>
            <td valign="top">
              Returns the trigonometric sine of the specified angle, in radians, and in an 
              approximate numeric, <b>double</b>, expression</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              soundex(<i>X</i>)</td>
            <td valign="top">
              Compute the soundex encoding of the string <i>X</i>. The string &quot;?000&quot; is 
              returned if the argument is NULL.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              sqlite_version(*)</td>
            <td valign="top">
              Return the version string for the SQLite library that is running. Example: "3.6.0"</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              sqrt(<i>X</i>)</td>
            <td valign="top">
              Returns the square root of the specified value</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              square(X)</td>
            <td valign="top">
              Returns the square of the specified value</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              strfilter(<i>X</i>,<i>Y</i>)</td>
            <td valign="top">
              Given a source string <i>X</i> and the characters to filter <i>Y</i>, returns <i>
              X</i> with all characters not found in <i>Y</i> removed.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              substr(<i>X</i>,<i>Y</i>,<i>Z</i>)</td>
            <td valign="top">
              Return a substring of input string <i>X</i> that begins with the <i>Y</i>-th character
              and which is <i>Z</i> characters long. The left-most character of <i>X</i> is number
              1. If <i>Y</i> is negative the the first character of the substring is found by
              counting from the right rather than the left. If SQLite is configured to support
              UTF-8, then characters indices refer to actual UTF-8 characters, not bytes.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              tan(<i>X</i>)</td>
            <td valign="top">
              Returns the tangent of the input expression</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              tanh(<i>X</i>)</td>
            <td valign="top">
              Hyperbolic tangent</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              typeof(<i>X</i>)</td>
            <td valign="top">
              Return the type of the expression <i>X</i>. The only return values are "null", "integer",
              "real", "text", and "blob".
        SQLite's type handling is explained in <a href="http://www.sqlite.org/datatype3.html">
                Datatypes in SQLite Version 3</a>.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              upper(<i>X</i>)</td>
            <td valign="top">
              Return a copy of input string <i>X</i> converted to all upper-case letters. The
              implementation of this function uses the C library routine <b>toupper()</b> which
              means it may not work correctly on UTF-8 strings.</td>
          </tr>
        </table>
      </p>
      <p>
        <a name="aggregatefunctions"></a><b>Aggregate Functions</b>
      </p>
      <p>
        The aggregate functions shown below are available by default. Additional aggregate
        functions written in C may be added using the <a href="capi3ref.html#sqlite3_create_function">
          sqlite3_create_function()</a> API.</p>
      <p>
        In any aggregate function that takes a single argument, that argument can be preceeded
        by the keyword DISTINCT. In such cases, duplicate elements are filtered before being
        passed into the aggregate function. For example, the function "count(distinct X)"
        will return the number of distinct values of column X instead of the total number
        of non-null values in column X.
      </p>
      <p>
        <table border="0" cellpadding="10">
          <tr>
            <td align="right" valign="top" width="120">
              avg(<i>X</i>)</td>
            <td valign="top">
              Return the average value of all non-NULL <i>X</i> within a group. String and BLOB
              values that do not look like numbers are interpreted as 0. The result of avg() is
              always a floating point value even if all inputs are integers.
              <p>
              </p>
            </td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              count(<i>X</i>)<br />
              count(*)</td>
            <td valign="top">
              The first form return a count of the number of times that <i>X</i> is not NULL in
              a group. The second form (with no argument) returns the total number of rows in
              the group.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              lower_quartile(<i>X</i>)</td>
            <td valign="top">
              Returns the lower quartile of the given numbers in the set</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              max(<i>X</i>)</td>
            <td valign="top">
              Return the maximum value of all values in the group. The usual sort order is used
              to determine the maximum.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              median(<i>X</i>)</td>
            <td valign="top">
              Returns the middle value in a set of ordered numbers. (The medial value is 
              unlike the mean value, which is the sum of a set of numbers divided by the count 
              of numbers in the set). The median value is determined by choosing the smallest 
              value such that at least half of the values in the set are no greater than the 
              chosen value. If the number of values within the set is odd, the median value 
              corresponds to a single value. If the number of values within the set is even, 
              the median value corresponds to the sum of the two middle values divided by two.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              min(<i>X</i>)</td>
            <td valign="top">
              Return the minimum non-NULL value of all values in the group. The usual sort order
              is used to determine the minimum. NULL is only returned if all values in the group
              are NULL.</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              mode(<i>X</i>)</td>
            <td valign="top">
              Computes the most frequently occurring value in a sample set</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              stdev(<i>X</i>)</td>
            <td valign="top">
              Returns the statistical standard deviation of all values in the specified 
              expression</td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              sum(<i>X</i>)<br />
              total(<i>X</i>)</td>
            <td valign="top">
              Return the numeric sum of all non-NULL values in the group. If there are no non-NULL
              input rows then sum() returns NULL but total() returns 0.0. NULL is not normally
              a helpful result for the sum of no rows but the SQL standard requires it and most
              other SQL database engines implement sum() that way so SQLite does it in the same
              way in order to be compatible. The non-standard total() function is provided as
              a convenient way to work around this design problem in the SQL language.
              <p>
              </p>
              <p>
                The result of total() is always a floating point value. The result of sum() is an
                integer value if all non-NULL inputs are integers. If any input to sum() is neither
                an integer or a NULL then sum() returns a floating point value which might be an
                approximation to the true sum.</p>
              <p>
                Sum() will throw an "integer overflow" exception if all inputs are integers or NULL
                and an integer overflow occurs at any point during the computation. Total() never
                throws an exception.</p>
            </td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              upper_quartile(<i>X</i>)</td>
            <td valign="top">
              Returns the upper quartile of the numbers in the given set</td>
          </tr>
        </table>
      </p>
      <hr>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted Doc/Extra/lang_insert.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>INSERT</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">INSERT</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        INSERT</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">INSERT </font></b>[<b><font color="#2c2cf0">OR </font></b>
              <i><font color="#ff3434">conflict-algorithm</font></i><b><font color="#2c2cf0"></font></b>]<b><font
                color="#2c2cf0"> INTO </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font
                  color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b>
              <i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> </font></b>
              [<b><font color="#2c2cf0"><big>(</big></font></b><i><font color="#ff3434">column-list</font></i><b><font
                color="#2c2cf0"><big>)</big></font></b>]<b><font color="#2c2cf0"> VALUES<big>(</big></font></b><i><font
                  color="#ff3434">value-list</font></i><b><font color="#2c2cf0"><big>)</big> </font>
                  </b><big>|</big><b><font color="#2c2cf0"><br />
                    INSERT </font></b>[<b><font color="#2c2cf0">OR </font></b><i><font color="#ff3434">
                      conflict-algorithm</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0">
                        INTO </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font
                          color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b>
              <i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> </font></b>
              [<b><font color="#2c2cf0"><big>(</big></font></b><i><font color="#ff3434">column-list</font></i><b><font
                color="#2c2cf0"><big>)</big></font></b>]<b><font color="#2c2cf0"> </font></b><i><font
                  color="#ff3434">select-statement</font></i><b><font color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        The INSERT statement comes in two basic forms. The first form (with the "VALUES"
        keyword) creates a single new row in an existing table. If no column-list is specified
        then the number of values must be the same as the number of columns in the table.
        If a column-list is specified, then the number of values must match the number of
        specified columns. Columns of the table that do not appear in the column list are
        filled with the default value, or with NULL if not default value is specified.
      </p>
      <p>
        The second form of the INSERT statement takes it data
        from a SELECT statement. The
        number of columns in the result of the SELECT must exactly match the number of columns
        in the table if no column list is specified, or it must match the number of columns
        name in the column list. A new entry is made in the table for every row of the SELECT
        result. The SELECT may be simple or compound. If the SELECT statement has an ORDER
        BY clause, the ORDER BY is ignored.</p>
      <p>
        The optional conflict-clause allows the specification of an alternative constraint conflict resolution algorithm to use during this one command. See the section titled
        <a href="lang_conflict.html">ON CONFLICT</a> for additional information. For compatibility
        with MySQL, the parser allows the use of the single keyword <a href="lang_replace.html">
          REPLACE</a> as an alias for "INSERT OR REPLACE".
      </p>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































Deleted Doc/Extra/lang_reindex.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>REINDEX</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">REINDEX</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        REINDEX</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">REINDEX </font></b><i><font color="#ff3434">collation
        name</font></i><b><font
                color="#2c2cf0"></font></b></td>
          </tr>
        </table>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">REINDEX </font></b>[<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font
                  color="#2c2cf0"> </font></b><i><font color="#ff3434">table/index-name</font></i><b><font
                    color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        The REINDEX command is used to delete and recreate indices from scratch. This is
        useful when the definition of a collation sequence has changed.
      </p>
      <p>
        In the first form, all indices in all attached databases that use the named collation
        sequence are recreated. In the second form, if <i>[database-name.]table/index-name</i>
        identifies a table, then all indices associated with the table are rebuilt. If an
        index is identified, then only this specific index is deleted and recreated.
      </p>
      <p>
        If no <i>database-name</i> is specified and there exists both a table or index and
        a collation sequence of the specified name, then indices associated with the collation
        sequence only are reconstructed. This ambiguity may be dispelled by always specifying
        a <i>database-name</i> when reindexing a specific table or index.
      </p>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































Deleted Doc/Extra/lang_replace.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>REPLACE</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">REPLACE</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        REPLACE</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">REPLACE INTO </font></b>[<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font
                  color="#2c2cf0"> </font></b><i><font color="#ff3434">table-name</font></i><b><font
                    color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"><big>(</big> </font></b>
              <i><font color="#ff3434">column-list</font></i><b><font color="#2c2cf0"> <big>)</big></font></b>]<b><font
                color="#2c2cf0"> VALUES <big>(</big> </font></b><i><font color="#ff3434">value-list</font></i><b><font
                  color="#2c2cf0"> <big>)</big> </font></b><big>|</big><b><font color="#2c2cf0"><br />
                    REPLACE INTO </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">database-name</font></i><b><font
                      color="#2c2cf0"> <big>.</big></font></b>]<b><font color="#2c2cf0"> </font></b>
              <i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0"> </font></b>
              [<b><font color="#2c2cf0"><big>(</big> </font></b><i><font color="#ff3434">column-list</font></i><b><font
                color="#2c2cf0"> <big>)</big></font></b>]<b><font color="#2c2cf0"> </font></b>
              <i><font color="#ff3434">select-statement</font></i><b><font color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        The REPLACE command is an alias for the "INSERT OR REPLACE" variant of the <a href="lang_insert.html">
          INSERT</a> command. This alias is provided for compatibility with MySQL. See the
        <a href="lang_insert.html">INSERT</a> command documentation for additional information.</p>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































Deleted Doc/Extra/lang_select.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>SELECT</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">SELECT</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        SELECT</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">SELECT </font></b>[<b><font color="#2c2cf0">ALL </font></b>
              <big>|</big><b><font color="#2c2cf0"> DISTINCT</font></b>]<b><font color="#2c2cf0">
              </font></b><i><font color="#ff3434">result</font></i><b><font color="#2c2cf0"> </font>
              </b>[<b><font color="#2c2cf0">FROM </font></b><i><font color="#ff3434">table-list</font></i><b><font
                color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"><br />
                </font></b>[<b><font color="#2c2cf0">WHERE </font></b><i><font color="#ff3434">expr</font></i><b><font
                  color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"><br />
                  </font></b>[<b><font color="#2c2cf0">GROUP BY </font></b><i><font color="#ff3434">
                    expr-list</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"><br />
                    </font></b>[<b><font color="#2c2cf0">HAVING </font></b><i><font color="#ff3434">expr</font></i><b><font
                      color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"><br />
                      </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">compound-op</font></i><b><font
                        color="#2c2cf0"> </font></b><i><font color="#ff3434">select</font></i><b><font color="#2c2cf0"></font></b>]<b><font
                          color="#2c2cf0"></font></b><big>*</big><b><font color="#2c2cf0"><br />
                          </font></b>[<b><font color="#2c2cf0">ORDER BY </font></b><i><font color="#ff3434">
                            sort-expr-list</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"><br />
                            </font></b>[<b><font color="#2c2cf0">LIMIT </font></b><i><font color="#ff3434">integer</font></i><b><font
                              color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"></font></b>(<b><font color="#2c2cf0">
                                OFFSET </font></b><big>|</big><b><font color="#2c2cf0"> <big>,</big> </font></b>
              )<b><font color="#2c2cf0"> </font></b><i><font color="#ff3434">integer</font></i><b><font
                color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">result</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">result-column</font></i><b><font
                color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"><big>,</big> </font></b>
              <i><font color="#ff3434">result-column</font></i><b><font color="#2c2cf0"></font></b>]<b><font
                color="#2c2cf0"></font></b><big>*</big><b><font color="#2c2cf0"></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">result-column</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0"><big>*</big> </font></b><big>|</big><b><font color="#2c2cf0">
              </font></b><i><font color="#ff3434">table-name</font></i><b><font color="#2c2cf0">
                <big>.</big> <big>*</big> </font></b><big>|</big><b><font color="#2c2cf0"> </font>
                </b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font></b>
              [<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0">AS</font></b>]<b><font
                color="#2c2cf0"> </font></b><i><font color="#ff3434">string</font></i><b><font color="#2c2cf0">
                </font></b>]<b><font color="#2c2cf0"></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">table-list</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">table</font></i><b><font
                color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">join-op</font></i><b><font
                  color="#2c2cf0"> </font></b><i><font color="#ff3434">table</font></i><b><font color="#2c2cf0">
                  </font></b><i><font color="#ff3434">join-args</font></i><b><font color="#2c2cf0"></font></b>]<b><font
                    color="#2c2cf0"></font></b><big>*</big><b><font color="#2c2cf0"></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">table</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">table-name</font></i><b><font
                color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0">AS </font></b><i><font color="#ff3434">
                  alias</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> </font>
                  </b><big>|</big><b><font color="#2c2cf0"><br />
                    <big>(</big> </font></b><i><font color="#ff3434">select</font></i><b><font color="#2c2cf0">
                      <big>)</big> </font></b>[<b><font color="#2c2cf0">AS </font></b><i><font color="#ff3434">
                        alias</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">join-op</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0"><big>,</big> </font></b><big>|</big><b><font color="#2c2cf0">
              </font></b>[<b><font color="#2c2cf0">NATURAL</font></b>]<b><font color="#2c2cf0">
              </font></b>[<b><font color="#2c2cf0">LEFT </font></b><big>|</big><b><font color="#2c2cf0">
                RIGHT </font></b><big>|</big><b><font color="#2c2cf0"> FULL</font></b>]<b><font color="#2c2cf0">
                </font></b>[<b><font color="#2c2cf0">OUTER </font></b><big>|</big><b><font color="#2c2cf0">
                  INNER </font></b><big>|</big><b><font color="#2c2cf0"> CROSS</font></b>]<b><font
                    color="#2c2cf0"> JOIN</font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">join-args</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0"></font></b>[<b><font color="#2c2cf0">ON </font></b><i><font
                color="#ff3434">expr</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0">
                </font></b>[<b><font color="#2c2cf0">USING <big>(</big> </font></b><i><font color="#ff3434">
                  id-list</font></i><b><font color="#2c2cf0"> <big>)</big></font></b>]<b><font color="#2c2cf0"></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sort-expr-list</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">expr</font></i><b><font
                color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">sort-order</font></i><b><font
                  color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"><big>,</big>
                  </font></b><i><font color="#ff3434">expr</font></i><b><font color="#2c2cf0"> </font>
                  </b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">sort-order</font></i><b><font
                    color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b><big>*</big><b><font
                      color="#2c2cf0"></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sort-order</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0"></font></b>[<b><font color="#2c2cf0"> COLLATE </font></b>
              <i><font color="#ff3434">collation-name</font></i><b><font color="#2c2cf0"> </font>
              </b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"> ASC </font></b>
              <big>|</big><b><font color="#2c2cf0"> DESC </font></b>]<b><font color="#2c2cf0"></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">compound_op</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">UNION </font></b><big>|</big><b><font color="#2c2cf0"> UNION
                ALL </font></b><big>|</big><b><font color="#2c2cf0"> INTERSECT </font></b><big>|</big><b><font
                  color="#2c2cf0"> EXCEPT</font></b></td>
          </tr>
        </table>
      </p>
      <p>
        The SELECT statement is used to query the database. The result of a SELECT is zero
        or more rows of data where each row has a fixed number of columns. The number of
        columns in the result is specified by the expression list in between the SELECT
        and FROM keywords. Any arbitrary expression can be used as a result. If a result
        expression is <font color="#2c2cf0"><big>*</big></font> then all columns of all
        tables are substituted for that one expression. If the expression is the name of
        a table followed by <font color="#2c2cf0"><big>.*</big></font> then the result is
        all columns in that one table.</p>
      <p>
        The DISTINCT keyword causes a subset of result rows to be returned, in which each
        result row is different. NULL values are not treated as distinct from each other.
        The default behavior is that all result rows be returned, which can be made explicit
        with the keyword ALL.</p>
      <p>
        The query is executed against one or more tables specified after the FROM keyword.
        If multiple tables names are separated by commas, then the query is against the
        cross join of the various tables. The full SQL-92 join syntax can also be used to
        specify joins. A sub-query in parentheses may be substituted for any table name
        in the FROM clause. The entire FROM clause may be omitted, in which case the result
        is a single row consisting of the values of the expression list.
      </p>
      <p>
        The WHERE clause can be used to limit the number of rows over which the query operates.</p>
      <p>
        The GROUP BY clauses causes one or more rows of the result to be combined into a
        single row of output. This is especially useful when the result contains aggregate
        functions. The expressions in the GROUP BY clause do <em>not</em> have to be expressions
        that appear in the result. The HAVING clause is similar to WHERE except that HAVING
        applies after grouping has occurred. The HAVING expression may refer to values,
        even aggregate functions, that are not in the result.</p>
      <p>
        The ORDER BY clause causes the output rows to be sorted. The argument to ORDER BY
        is a list of expressions that are used as the key for the sort. The expressions
        do not have to be part of the result for a simple SELECT, but in a compound SELECT
        each sort expression must exactly match one of the result columns. Each sort expression
        may be optionally followed by a COLLATE keyword and the name of a collating function
        used for ordering text and/or keywords ASC or DESC to specify the sort order.</p>
      <p>
        The LIMIT clause places an upper bound on the number of rows returned in the result.
        A negative LIMIT indicates no upper bound. The optional OFFSET following LIMIT specifies
        how many rows to skip at the beginning of the result set. In a compound query, the
        LIMIT clause may only appear on the final SELECT statement. The limit is applied
        to the entire query not to the individual SELECT statement to which it is attached.
        Note that if the OFFSET keyword is used in the LIMIT clause, then the limit is the
        first number and the offset is the second number. If a comma is used instead of
        the OFFSET keyword, then the offset is the first number and the limit is the second
        number. This seeming contradition is intentional - it maximizes compatibility with
        legacy SQL database systems.
      </p>
      <p>
        A compound SELECT is formed from two or more simple SELECTs connected by one of
        the operators UNION, UNION ALL, INTERSECT, or EXCEPT. In a compound SELECT, all
        the constituent SELECTs must specify the same number of result columns. There may
        be only a single ORDER BY clause at the end of the compound SELECT. The UNION and
        UNION ALL operators combine the results of the SELECTs to the right and left into
        a single big table. The difference is that in UNION all result rows are distinct
        where in UNION ALL there may be duplicates. The INTERSECT operator takes the intersection
        of the results of the left and right SELECTs. EXCEPT takes the result of left SELECT
        after removing the results of the right SELECT. When three or more SELECTs are connected
        into a compound, they group from left to right.</p>
      <p>
        &nbsp;</p>
      <hr>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































































































































































































































































































Deleted Doc/Extra/lang_transaction.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>TRANSACTIONS</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">BEGIN TRANSACTION</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        BEGIN TRANSACTION</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">BEGIN </font></b>[<b><font color="#2c2cf0"> DEFERRED </font>
              </b><big>|</big><b><font color="#2c2cf0"> IMMEDIATE </font></b><big>|</big><b><font
                color="#2c2cf0"> EXCLUSIVE </font></b>]<b><font color="#2c2cf0"> </font></b>[<b><font
                  color="#2c2cf0">TRANSACTION </font></b>[<b><font color="#2c2cf0"></font></b><i><font
                    color="#ff3434">name</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b>]<b><font
                      color="#2c2cf0"></font></b></td>
          </tr>
        </table>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">END </font></b>[<b><font color="#2c2cf0">TRANSACTION </font>
              </b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">name</font></i><b><font
                color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b></td>
          </tr>
        </table>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">COMMIT </font></b>[<b><font color="#2c2cf0">TRANSACTION </font>
              </b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">name</font></i><b><font
                color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b></td>
          </tr>
        </table>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">ROLLBACK </font></b>[<b><font color="#2c2cf0">TRANSACTION
              </font></b>[<b><font color="#2c2cf0"></font></b><i><font color="#ff3434">name</font></i><b><font
                color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        Beginning in version 2.0, SQLite supports transactions with rollback and atomic
        commit.</p>
      <p>
        The optional transaction name is ignored. SQLite currently does not allow nested
        transactions.</p>
      <p>
        No changes can be made to the database except within a transaction. Any command
        that changes the database (basically, any SQL command
          other than SELECT) will automatically start a transaction if one is not already in effect. Automatically started transactions
        are committed at the conclusion of the command.
      </p>
      <p>
        Transactions can be started manually using the BEGIN command. Such transactions
        usually persist until the next COMMIT or ROLLBACK command. But a transaction will
        also ROLLBACK if the database is closed or if an error occurs and the ROLLBACK conflict
        resolution algorithm is specified. See the documentation on the <a href="lang_conflict.html">
          ON CONFLICT</a> clause for additional information about the ROLLBACK conflict
        resolution algorithm.
      </p>
      <p>
        In SQLite version 3.0.8 and later, transactions can be deferred, immediate, or exclusive.
        Deferred means that no locks are acquired on the database until the database is
        first accessed. Thus with a deferred transaction, the BEGIN statement itself does
        nothing. Locks are not acquired until the first read or write operation. The first
        read operation against a database creates a SHARED lock and the first write operation
        creates a RESERVED lock. Because the acquisition of locks is deferred until they
        are needed, it is possible that another thread or process could create a separate
        transaction and write to the database after the BEGIN on the current thread has
        executed. If the transaction is immediate, then RESERVED locks are acquired on all
        databases as soon as the BEGIN command is executed, without waiting for the database
        to be used. After a BEGIN IMMEDIATE, you are guaranteed that no other thread or
        process will be able to write to the database or do a BEGIN IMMEDIATE or BEGIN EXCLUSIVE.
        Other processes can continue to read from the database, however. An exclusive transaction
        causes EXCLUSIVE locks to be acquired on all databases. After a BEGIN EXCLUSIVE,
        you are guaranteed that no other thread or process will be able to read or write
        the database until the transaction is complete.
      </p>
      <p>
        A description of the meaning of SHARED, RESERVED, and EXCLUSIVE locks is available
        <a href="lockingv3.html">separately</a>.
      </p>
      <p>
        The default behavior for SQLite version 3.0.8 is a deferred transaction. For SQLite
        version 3.0.0 through 3.0.7, deferred is the only kind of transaction available.
        For SQLite version 2.8 and earlier, all transactions are exclusive.
      </p>
      <p>
        The COMMIT command does not actually perform a commit until all pending SQL commands
        finish. Thus if two or more SELECT statements are in the middle of processing and
        a COMMIT is executed, the commit will not actually occur until all SELECT statements
        finish.
      </p>
      <p>
        An attempt to execute COMMIT might result in an SQLITE_BUSY return code. This indicates
        that another thread or process had a read lock on the database that prevented the
        database from being updated. When COMMIT fails in this way, the transaction remains
        active and the COMMIT can be retried later after the reader has had a chance to
        clear.
      </p>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































































Deleted Doc/Extra/lang_types.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>TYPES</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">TYPES</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite (sortof)</h1>
      <h4>
        TYPES</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">TYPES </font></b>[<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">datatype name</font></i><b><font color="#2c2cf0"></font></b>][,<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">datatype name</font></i><b><font color="#2c2cf0"></font></b>][,<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">datatype
                      name</font></i><b><font color="#2c2cf0"></font></b>][,<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">...</font></i>] ; <em><span style="color: #ff3434">select-stmt</span></em></td>            
          </tr>
          <tr>
          <td align="right" width="1%" nowrap>
          <i><font color="#ff3434">select-stmt</font></i> ::=</td>
          <td>
            see <a href="lang_select.html">SELECT</a></td>
          </tr>
        </table>
      </p>
      <p>
        Use the TYPES keyword before a SELECT statement to provide the SQLite ADO.NET provider
        a list of return datatypes to expect from the subsequent SELECT statement.&nbsp;
      </p>
      <p>
        This is a language extension (aka <strong>hack</strong>) to SQLite specifically for the ADO.NET data
        provider.&nbsp; It is a pseudo-statement, meaning only the ADO.NET provider understands
        it.</p>
      <h3>
        Background</h3>
      <p>
        Due to SQLite's typeless nature, there are certain kinds of queries for which the
        ADO.NET provider cannot determine the proper return data type.&nbsp; Scalar and
        aggregate functions pose a particular problem because
        there is no requirement for a given scalar or aggregate function to return any particular
        datatype.&nbsp; As a matter of fact, scalar functions could theoretically return
        a different datatype for every row or column in a query and this is perfectly legal
        from SQLite's point of view.</p>
      <p>
        Since ADO.NET is designed around a typed system and we're shoe-horning SQLite into
        it, this keyword helps the provider out in cases where the return type cannot be easily determined.</p>
      <p>
        This command must be used in conjunction with a SELECT statement.&nbsp; It only
        works when both the TYPES keyword and its value(s) are passed along with a SELECT
        statement as a single semi-colon separated unit.</p>
      <h3>
        Examples</h3>
      <p>
        <strong><span style="color: #2c2cf0">TYPES</span> [bigint], [int], [smallint], [tinyint];<br />
          <span style="color: #2c2cf0">SELECT</span> 1, 2, 3, 4;</strong></p>
      <p>
        The above query would return the columns as types System.Int64, System.Int32, System.Int16
        and System.Byte respectively.</p>
      <p>
        <strong><span style="color: #2c2cf0">TYPES</span> [bigint], [int], , [tinyint];<br />
          <span style="color: #2c2cf0">SELECT</span> 1, 2, 3, 4;</strong></p>
      <p>
        In this sample, only columns 1, 2 and 4 would have explicit typing.&nbsp; Column
        3's datatype would pass though the system and be discovered normally.</p>
      <p>
        <strong><span style="color: #2c2cf0">TYPES</span> real;<br />
          <span style="color: #2c2cf0">SELECT</span> SUM(Cost) FROM [Products];</strong></p>
      <p>
        The above query explicitly tells the provider that the SUM aggregate function returns
        a System.Double.</p>
      <h3>
        Usage Notes</h3>
      <ul>
        <li>You cannot use parameters in the TYPES statement.</li>
        <li>The TYPES statement must be immediately followed by a SELECT statement.</li>
        <li>It is legal to pass multiple TYPES and SELECT statements in a multi-statement
          command.</li>
        <li>You may enclose datatypes in quotes <strong>""</strong> or brackets <strong>[]</strong>
          or those <strong>``</strong> thingies if you want.<br />
        </li>
      </ul>
      <hr>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































Deleted Doc/Extra/lang_update.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>UPDATE</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">UPDATE</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        UPDATE</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">UPDATE </font></b>[<b><font color="#2c2cf0"> OR </font></b>
              <i><font color="#ff3434">conflict-algorithm</font></i><b><font color="#2c2cf0"> </font>
              </b>]<b><font color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">database-name</font></i><b><font color="#2c2cf0"> <big>.</big></font></b>]<b><font
                  color="#2c2cf0"> </font></b><i><font color="#ff3434">table-name</font></i><b><font
                    color="#2c2cf0"><br />
                    SET </font></b><i><font color="#ff3434">assignment</font></i><b><font color="#2c2cf0">
                    </font></b>[<b><font color="#2c2cf0"><big>,</big> </font></b><i><font color="#ff3434">
                      assignment</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b><big>*</big><b><font
                        color="#2c2cf0"><br />
                      </font></b>[<b><font color="#2c2cf0">WHERE </font></b><i><font color="#ff3434">expr</font></i><b><font
                        color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"></font></b></td>
          </tr>
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">assignment</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0"></font></b><i><font color="#ff3434">column-name</font></i><b><font
                color="#2c2cf0"> <big>=</big> </font></b><i><font color="#ff3434">expr</font></i><b><font
                  color="#2c2cf0"></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        The UPDATE statement is used to change the value of columns in selected rows of
        a table. Each assignment in an UPDATE specifies a column
        name to the left of the
        equals sign and an arbitrary expression to the right. The expressions may use the
        values of
          other columns. All expressions are evaluated before any assignments are
        made. A WHERE clause can be used to restrict which rows are updated.</p>
      <p>
        The optional conflict-clause allows the specification of an alternative constraint conflict resolution algorithm to use during this one command. See the section titled
        <a href="lang_conflict.html">ON CONFLICT</a> for additional information.</p>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































Deleted Doc/Extra/lang_vacuum.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>TYPES</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">VACUUM</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        VACUUM</h4>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">VACUUM </font></b>[<b><font color="#2c2cf0"></font></b><i><font
                color="#ff3434">index-or-tablename</font></i>]</td>
          </tr>
        </table>
      </p>
      <p>
        The VACUUM command is an SQLite extension modeled after a similar command found
        in PostgreSQL. If VACUUM is invoked with the name of a table or index then it is
        suppose to clean up the named table or index. In version 1.0 of SQLite, the VACUUM
        command would invoke <b>gdbm_reorganize()</b> to clean up the backend database file.</p>
      <p>
        VACUUM became a no-op when the GDBM backend was removed from SQLITE in version 2.0.0.
        VACUUM was reimplemented in version 2.8.1. The index or table name argument is now
        ignored.
      </p>
      <p>
        When an object (table, index, or trigger) is dropped from the database, it leaves
        behind empty space. This makes the database file larger than it needs to be, but
        can speed up inserts. In time inserts and deletes can leave the database file structure
        fragmented, which slows down disk access to the database contents. The VACUUM command
        cleans the main database by copying its contents to a temporary database file and
        reloading the original database file from the copy. This eliminates free pages,
        aligns table data to be contiguous, and otherwise cleans up the database file structure.
        It is not possible to perform the same process on an attached database file.</p>
      <p>
        This command will fail if there is an active transaction. This command has no effect
        on an in-memory database.</p>
      <p>
        As of SQLite version 3.1, an alternative to using the VACUUM command is auto-vacuum
        mode, enabled using the <a href="pragma.html#pragma_auto_vacuum">auto_vacuum pragma</a>.</p>
      <p>
        &nbsp;</p>
      <hr>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































Deleted Doc/Extra/limitations.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>Provider Limitations</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">Provider Limitations</span>
          </td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite.NET Class Library Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">Limitations of this ADO.NET SQLite Data Provider</h1>
      <p>As providers go, this one doesn't have many restrictions. SQLite has no 
        support for row-level or table-level locks. When a connection locks the database for writing, no other connection or process may read or write to the database until the write operation is complete.  The SQLite.NET provider attempts to retry 
        internally if a database is locked, up to the CommandTimeout property of the 
        command in question.</p>
      <p>SQLite is inherently type-less, and only understands a few basic datatypes 
        natively. They are (in .NET-speak) Int64, Double, String and Blob. The 
        SQLite.NET provider will use the database schema information it can glean to 
        enforce type-ness, but it is an inexact science.</p>
      <p>
        Hierarchical DataReaders are not supported. In the 
        case of transactions, any SQLiteCommand created on a connection will (when 
        executed) automatically join a transaction in progress, regardless of whether 
        that transaction was created before or after the command.</p>
      <p>A SQLiteCommand object <b>can</b> be re-assigned a new SQLiteConnection object 
        as long as no DataReaders are active on the command.</p>
      <p>Opening a transaction is considered a write operation, so only use them when 
        you want to write to the database! If you hold open a transaction, all readers on other
        connections
        will be blocked until the transaction is closed!</p>
      <p></p>
      <h4 class="subHeading">Thread Safety</h4>
      <p>Multi-threading in SQLite must be done carefully. Here are the restrictions:</p>
      <ul>
        <li>
          <b>You May</b>
        Clone() a SQLiteConnection object in one thread and pass the cloned object to 
        another thread. Once passed, the other thread becomes the new owner of the 
        cloned connection, and the original thread must not keep a reference to the 
        clone or call any methods on the clone.
        <LI>
          <STRONG>You May</STRONG>
        create multiple threads, and those threads can create their own 
        SQLiteConnection and subsequent objects for accessing a database.&nbsp; 
        Multiple connections on multiple threads to the same database file are 
        perfectly&nbsp;acceptable&nbsp;and will behave predictably.&nbsp;
        <li>
          <b>You May NOT</b>
        call methods or properties or otherwise reference any SQLite provider classes 
        that belong to another thread.
        <li>
          <b>You May NOT</b> pass a SQLiteCommand, SQLiteDataReader, SQLiteDataAdapter or 
          any other SQLite provider class except a cloned SQLiteConnection to another 
          thread.</li>
      </ul>
      <p>Understand again that SQLite has no fine-grained locking mechanisms. It is 
        therefore your own responsibility in a multi-threaded environment to handle 
        potential timeouts that may occur if a long-running query in one thread 
        prevents a query in another thread from executing. These timeouts will only 
        occur if one thread is attempting to read while another thread is attempting to 
        write. Whichever thread got its lock first will be the one to execute, and the 
        other thread will block until the CommandTimeout value elapses or the other 
        thread finishes.</p>
      <hr/>
      <div id="footer">
        <p>
          <a href="mailto:robert@blackcastlesoft.com?subject=SQLite.NET%20Class%20Library%20Documentation%20Feedback:%20Limitations">
            Send comments on this topic.</a>
        </p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































Deleted Doc/Extra/optimizing.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>Optimizing Your Queries</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">Optimizing for SQLite</span>
          </td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite.NET Class Library Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">Tips on Optimizing Your Queries</h1>
      <p>The next few paragraphs will attempt to give you a few rudimentary rules for 
        speeding up your queries in general, and especially how SQLite is adversely 
        affected by the kinds of SQL behaviors you may have taken for granted in other 
        providers. It is by no means a complete optimization guide. For even more 
        details on optimizing your queries, visit <a href="http://www.sqlite.org">sqlite.org</a>.</p>
      <h4 class="subHeading">The Importance of Transactions</h4>
      <p>If you are inserting data in SQLite without first starting a transaction: <b>DO 
          NOT PASS GO! Call BeginTransaction() right now, and finish with Commit()!</b> 
        If you think I'm kidding, think again. SQLite's A.C.I.D. design means that 
        every single time you insert any data outside a transaction, an implicit 
        transaction is constructed, the insert made, and the transaction destructed. <b>EVERY 
          TIME.</b> If you're wondering why in the world your inserts are taking 100x 
        longer than you think they should, look no further.</p>
      <h4 class="subHeading">Prepared Statements</h4>
      <p>Lets have a quick look at the following code and evaluate its performance:</p>
      <div class="syntax">
        <pre>
      using (SQLiteCommand mycommand = new SQLiteCommand(myconnection))
      {
        int n;
        
        for (n = 0; n < 100000; n ++)
        {
          mycommand.CommandText = String.Format("INSERT INTO [MyTable] ([MyId]) VALUES({0})", n + 1);
          mycommand.ExecuteNonQuery();
        }
      }</pre>
      </div>
      <p>This code seems pretty tight, but if you think it performs well, you're dead 
        wrong. Here's what's wrong with it:</p>
      <ul>
        <li>
          I didn't start a transaction first! This insert is dog slow!</li>
        <li>
          The CLR is calling "new" implicitly 100,000 times because I am formatting a 
          string in the loop for every insert</li>
        <li>
          Since SQLite precompiles SQL statements, the engine is constructing and 
          deconstructing 100,000 SQL statements and allocating/deallocating their memory</li>
        <li>
          All this construction and destruction is involving about 300,000 more native to 
          managed interop calls than an optimized insert</li>
      </ul>
      <p>So lets rewrite that code slightly:</p>
      <div class="syntax">
        <pre>
      using (SQLiteTransaction mytransaction = myconnection.BeginTransaction())
      {
        using (SQLiteCommand mycommand = new SQLiteCommand(myconnection))
        {
          SQLiteParameter myparam = new SQLiteParameter();
          int n;
        
          mycommand.CommandText = "INSERT INTO [MyTable] ([MyId]) VALUES(?)";
          mycommand.Parameters.Add(myparam);
          
          for (n = 0; n < 100000; n ++)
          {
            myparam.Value = n + 1;
            mycommand.ExecuteNonQuery();
          }
        }
        mytransaction.Commit();
      } </pre>
      </div>
      <p>Now this is a blazing fast insert for <b><i>any</i></b> database engine, not 
        just SQLite. The SQL statement is prepared one time -- on the first call to 
        ExecuteNonQuery(). Once prepared, it never needs re-evaluating. Furthermore, 
        we're allocating no memory in the loop and doing a very minimal number of 
        interop transitions. Surround the entire thing with a transaction, and the 
        performance of this insert is so far and away faster than the original that it 
        merits a hands-on-the-hips pirate-like laugh.</p>
      <p>Every database engine worth its salt utilizes prepared statements. If you're 
        not coding for this, you're not writing optimized SQL, and that's the bottom 
        line.
      </p>
      <hr />
      <div id="footer">
        <p>
          <a href="mailto:robert@blackcastlesoft.com?subject=SQLite.NET%20Class%20Library%20Documentation%20Feedback:%20Optimizing">
            Send comments on this topic.</a>
        </p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































































Deleted Doc/Extra/pragma.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>PRAGMA</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">PRAGMA</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <h4>
        PRAGMA</h4>
      <p>
        The <a href="#syntax">PRAGMA command</a> is a special command used to modify the
        operation of the SQLite library or to query the library for internal (non-table)
        data. The PRAGMA command is issued using the same interface as other SQLite commands
        (e.g. SELECT, INSERT) but is different in the following important respects:
      </p>
      <ul>
        <li>Specific pragma statements may be removed and others added in future releases
          of SQLite. Use with caution! </li>
        <li>No error messages are generated if an unknown pragma is issued. Unknown pragmas
          are simply ignored. This means if there is a typo in a pragma statement the library
          does not inform the user of the fact. </li>
        <li>Some pragmas take effect during the SQL compilation stage, not the execution stage.
          This means if using the C-language sqlite3_compile(), sqlite3_step(), sqlite3_finalize()
          API (or similar in a wrapper interface), the pragma may be applied to the library
          during the sqlite3_compile() call. </li>
        <li>The pragma command is unlikely to be compatible with any other SQL engine. </li>
      </ul>
      <p>
        The available pragmas fall into four basic categories:</p>
      <ul>
        <li>Pragmas used to <a href="#schema">query the schema</a> of the current database.
        </li>
        <li>Pragmas used to <a href="#modify">modify the operation</a> of the SQLite library
          in some manner, or to query for the current mode of operation. </li>
        <li>Pragmas used to <a href="#version">query or modify the databases two version values</a>,
          the schema-version and the user-version. </li>
        <li>Pragmas used to <a href="#debug">debug the library</a> and verify that database
          files are not corrupted. </li>
      </ul>
      <hr />
      <a name="syntax"></a>
      <h1>
        PRAGMA command syntax</h1>
      <p>
        <table cellpadding="10">
          <tr>
            <td align="right" width="1%" nowrap>
              <i><font color="#ff3434">sql-statement</font></i> ::=</td>
            <td>
              <b><font color="#2c2cf0">PRAGMA </font></b><i><font color="#ff3434">name</font></i><b><font
                color="#2c2cf0"> </font></b>[<b><font color="#2c2cf0">= </font></b><i><font color="#ff3434">
                  value</font></i><b><font color="#2c2cf0"></font></b>]<b><font color="#2c2cf0"> </font>
                  </b><big>|</big><b><font color="#2c2cf0"><br />
                    PRAGMA </font></b><i><font color="#ff3434">function</font></i><b><font color="#2c2cf0"><big>(</big></font></b><i><font
                      color="#ff3434">arg</font></i><b><font color="#2c2cf0"><big>)</big></font></b></td>
          </tr>
        </table>
      </p>
      <p>
        The pragmas that take an integer <b><i>value</i></b> also accept symbolic names.
        The strings "<b>on</b>", "<b>true</b>", and "<b>yes</b>" are equivalent to <b>1</b>.
        The strings "<b>off</b>", "<b>false</b>", and "<b>no</b>" are equivalent to <b>0</b>.
        These strings are case- insensitive, and do not require quotes. An unrecognized
        string will be treated as <b>1</b>, and will not generate an error. When the <i>value</i>
        is returned it is as an integer.</p>
      <hr />
      <a name="modify"></a>
      <h1>
        Pragmas to modify library operation</h1>
      <ul>
        <a name="pragma_auto_vacuum"></a>
        <li>
          <p>
            <b>PRAGMA auto_vacuum;
              <br />
              PRAGMA auto_vacuum = </b><i>0 | 1</i><b>;</b></p>
          <p>
            Query or set the auto-vacuum flag in the database.</p>
          <p>
            Normally, when a transaction that deletes data from a database is committed, the
            database file remains the same size. Unused database file pages are marked as such
            and reused later on, when data is inserted into the database. In this mode the <a
              href="lang_vacuum.html">VACUUM</a> command is used to reclaim unused space.</p>
          <p>
            When the auto-vacuum flag is set, the database file shrinks when a transaction that
            deletes data is committed (The VACUUM command is not useful in a database with the
            auto-vacuum flag set). To support this functionality the database stores extra information
            internally, resulting in slightly larger database files than would otherwise be
            possible.</p>
          <p>
            It is only possible to modify the value of the auto-vacuum flag before any tables
            have been created in the database. No error message is returned if an attempt to
            modify the auto-vacuum flag is made after one or more tables have been created.
          </p>
          <a name="pragma_cache_size"></a></li>
        <li>
          <p>
            <b>PRAGMA cache_size;
              <br />
              PRAGMA cache_size = </b><i>Number-of-pages</i><b>;</b></p>
          <p>
            Query or change the maximum number of database disk pages that SQLite will hold
            in memory at once. Each page uses about 1.5K of memory. The default cache size is
            2000. If you are doing UPDATEs or DELETEs that change many rows of a database and
            you do not mind if SQLite uses more memory, you can increase the cache size for
            a possible speed improvement.</p>
          <p>
            When you change the cache size using the cache_size pragma, the change only endures
            for the current session. The cache size reverts to the default value when the database
            is closed and reopened. Use the <a href="#pragma_default_cache_size"><b>default_cache_size</b></a>
            pragma to check the cache size permanently.</p>
          <a name="pragma_case_sensitive_like"></a></li>
        <li>
          <p>
            <b>PRAGMA case_sensitive_like;
              <br />
              PRAGMA case_sensitive_like = </b><i>0 | 1</i><b>;</b></p>
          <p>
            The default behavior of the LIKE operator is to ignore case for latin1 characters.
            Hence, by default <b>'a' LIKE 'A'</b> is true. The case_sensitive_like pragma can
            be turned on to change this behavior. When case_sensitive_like is enabled, <b>'a'
              LIKE 'A'</b> is false but <b>'a' LIKE 'a'</b> is still true.</p>
          <a name="pragma_count_changes"></a></li>
        <li>
          <p>
            <b>PRAGMA count_changes;
              <br />
              PRAGMA count_changes = </b><i>0 | 1</i><b>;</b></p>
          <p>
            Query or change the count-changes flag. Normally, when the count-changes flag is
            not set, INSERT, UPDATE and DELETE statements return no data. When count-changes
            is set, each of these commands returns a single row of data consisting of one integer
            value - the number of rows inserted, modified or deleted by the command. The returned
            change count does not include any insertions, modifications or deletions performed
            by triggers.</p>
          <a name="pragma_default_cache_size"></a></li>
        <li>
          <p>
            <b>PRAGMA default_cache_size;
              <br />
              PRAGMA default_cache_size = </b><i>Number-of-pages</i><b>;</b></p>
          <p>
            Query or change the maximum number of database disk pages that SQLite will hold
            in memory at once. Each page uses 1K on disk and about 1.5K in memory. This pragma
            works like the <a href="#pragma_cache_size"><b>cache_size</b></a> pragma with the
            additional feature that it changes the cache size persistently. With this pragma,
            you can set the cache size once and that setting is retained and reused every time
            you reopen the database.</p>
          <a name="pragma_default_synchronous"></a></li>
        <li>
          <p>
            <b>PRAGMA default_synchronous;</b></p>
          <p>
            This pragma was available in version 2.8 but was removed in version 3.0. It is a
            dangerous pragma whose use is discouraged. To help dissuide users of version 2.8
            from employing this pragma, the documentation will not tell you what it does.</p>
          <a name="pragma_empty_result_callbacks"></a></li>
        <li>
          <p>
            <b>PRAGMA empty_result_callbacks;
              <br />
              PRAGMA empty_result_callbacks = </b><i>0 | 1</i><b>;</b></p>
          <p>
            Query or change the empty-result-callbacks flag.</p>
          <p>
            The empty-result-callbacks flag affects the sqlite3_exec API only. Normally, when
            the empty-result-callbacks flag is cleared, the callback function supplied to the
            sqlite3_exec() call is not invoked for commands that return zero rows of data. When
            empty-result-callbacks is set in this situation, the callback function is invoked
            exactly once, with the third parameter set to 0 (NULL). This is to enable programs
            that use the sqlite3_exec() API to retrieve column-names even when a query returns
            no data.
          </p>
          <a name="pragma_encoding"></a></li>
        <li>
          <p>
            <b>PRAGMA encoding;
              <br />
              PRAGMA encoding = "UTF-8";
              <br />
              PRAGMA encoding = "UTF-16";
              <br />
              PRAGMA encoding = "UTF-16le";
              <br />
              PRAGMA encoding = "UTF-16be";</b></p>
          <p>
            In first form, if the main database has already been created, then this pragma returns
            the text encoding used by the main database, one of "UTF-8", "UTF-16le" (little-endian
            UTF-16 encoding) or "UTF-16be" (big-endian UTF-16 encoding). If the main database
            has not already been created, then the value returned is the text encoding that
            will be used to create the main database, if it is created by this session.</p>
          <p>
            The second and subsequent forms of this pragma are only useful if the main database
            has not already been created. In this case the pragma sets the encoding that the
            main database will be created with if it is created by this session. The string
            "UTF-16" is interpreted as "UTF-16 encoding using native machine byte-ordering".
            If the second and subsequent forms are used after the database file has already
            been created, they have no effect and are silently ignored.</p>
          <p>
            Once an encoding has been set for a database, it cannot be changed.</p>
          <p>
            Databases created by the ATTACH command always use the same encoding as the main
            database.</p>
          <a name="pragma_full_column_names"></a></li>
        <li>
          <p>
            <b>PRAGMA full_column_names;
              <br />
              PRAGMA full_column_names = </b><i>0 | 1</i><b>;</b></p>
          <p>
            Query or change the full-column-names flag. This flag affects the way SQLite names
            columns of data returned by SELECT statements when the expression for the column
            is a table-column name or the wildcard "*". Normally, such result columns are named
            &lt;table-name/alias&gt;&lt;column-name&gt; if the SELECT statement joins two or
            more tables together, or simply &lt;column-name&gt; if the SELECT statement queries
            a single table. When the full-column-names flag is set, such columns are always
            named &lt;table-name/alias&gt; &lt;column-name&gt; regardless of whether or not
            a join is performed.
          </p>
          <p>
            If both the short-column-names and full-column-names are set, then the behaviour
            associated with the full-column-names flag is exhibited.
          </p>
          <a name="pragma_fullfsync"></a></li>
        <li>
          <p>
            <b>PRAGMA fullfsync
              <br />
              PRAGMA fullfsync = </b><i>0 | 1</i><b>;</b></p>
          <p>
            Query or change the fullfsync flag. This flag affects determines whether or not
            the F_FULLFSYNC syncing method is used on systems that support it. The default value
            is off. As of this writing (2006-02-10) only Mac OS X supports F_FULLFSYNC.
          </p>
          <a name="pragma_legacy_file_format"></a></li>
        <li>
          <p>
            <b>PRAGMA legacy_file_format;
              <br />
              PRAGMA legacy_file_format = <i>ON | OFF</i></b></p>
          <p>
            This pragma sets or queries the value of the legacy_file_format flag. When this
            flag is on, new SQLite databases are created in a file format that is readable and
            writable by all versions of SQLite going back to 3.0.0. When the flag is off, new
            databases are created using the latest file format which might to be readable or
            writable by older versions of SQLite.</p>
          <p>
            This flag only effects newly created databases. It has no effect on databases that
            already exists.</p>
          <a name="pragma_page_size"></a></li>
        <li>
          <p>
            <b>PRAGMA page_size;
              <br />
              PRAGMA page_size = </b><i>bytes</i><b>;</b></p>
          <p>
            Query or set the page-size of the database. The page-size may only be set if the
            database has not yet been created. The page size must be a power of two greater
            than or equal to 512 and less than or equal to 8192. The upper limit may be modified
            by setting the value of macro SQLITE_MAX_PAGE_SIZE during compilation. The maximum
            upper bound is 32768.
          </p>
          <a name="pragma_read_uncommitted"></a></li>
        <li>
          <p>
            <b>PRAGMA read_uncommitted;
              <br />
              PRAGMA read_uncommitted = </b><i>0 | 1</i><b>;</b></p>
          <p>
            Query, set, or clear READ UNCOMMITTED isolation. The default isolation level for
            SQLite is SERIALIZABLE. Any process or thread can select READ UNCOMMITTED isolation,
            but SERIALIZABLE will still be used except between connections that share a common
            page and schema cache. Cache sharing is enabled using the <a href="capi3ref.html#sqlite3_enable_shared_cache">
              sqlite3_enable_shared_cache()</a> API and is only available between connections
            running the same thread. Cache sharing is off by default.
          </p>
          <a name="pragma_short_column_names"></a></li>
        <li>
          <p>
            <b>PRAGMA short_column_names;
              <br />
              PRAGMA short_column_names = </b><i>0 | 1</i><b>;</b></p>
          <p>
            Query or change the short-column-names flag. This flag affects the way SQLite names
            columns of data returned by SELECT statements when the expression for the column
            is a table-column name or the wildcard "*". Normally, such result columns are named
            &lt;table-name/alias&gt;lt;column-name&gt; if the SELECT statement joins two or
            more tables together, or simply &lt;column-name&gt; if the SELECT statement queries
            a single table. When the short-column-names flag is set, such columns are always
            named &lt;column-name&gt; regardless of whether or not a join is performed.
          </p>
          <p>
            If both the short-column-names and full-column-names are set, then the behaviour
            associated with the full-column-names flag is exhibited.
          </p>
          <a name="pragma_synchronous"></a></li>
        <li>
          <p>
            <b>PRAGMA synchronous;
              <br />
              PRAGMA synchronous = FULL; </b>(2)<b>
                <br />
                PRAGMA synchronous = NORMAL; </b>(1)<b>
                  <br />
                  PRAGMA synchronous = OFF; </b>(0)</p>
          <p>
            Query or change the setting of the "synchronous" flag. The first (query) form will
            return the setting as an integer. When synchronous is FULL (2), the SQLite database
            engine will pause at critical moments to make sure that data has actually been written
            to the disk surface before continuing. This ensures that if the operating system
            crashes or if there is a power failure, the database will be uncorrupted after rebooting.
            FULL synchronous is very safe, but it is also slow. When synchronous is NORMAL,
            the SQLite database engine will still pause at the most critical moments, but less
            often than in FULL mode. There is a very small (though non-zero) chance that a power
            failure at just the wrong time could corrupt the database in NORMAL mode. But in
            practice, you are more likely to suffer a catastrophic disk failure or some other
            unrecoverable hardware fault. With synchronous OFF (0), SQLite continues without
            pausing as soon as it has handed data off to the operating system. If the application
            running SQLite crashes, the data will be safe, but the database might become corrupted
            if the operating system crashes or the computer loses power before that data has
            been written to the disk surface. On the other hand, some operations are as much
            as 50 or more times faster with synchronous OFF.
          </p>
          <p>
            In SQLite version 2, the default value is NORMAL. For version 3, the default was
            changed to FULL.
          </p>
          <a name="pragma_temp_store"></a></li>
        <li>
          <p>
            <b>PRAGMA temp_store;
              <br />
              PRAGMA temp_store = DEFAULT;</b> (0)<b>
                <br />
                PRAGMA temp_store = FILE;</b> (1)<b>
                  <br />
                  PRAGMA temp_store = MEMORY;</b> (2)</p>
          <p>
            Query or change the setting of the "<b>temp_store</b>" parameter. When temp_store
            is DEFAULT (0), the compile-time C preprocessor macro TEMP_STORE is used to determine
            where temporary tables and indices are stored. When temp_store is MEMORY (2) temporary
            tables and indices are kept in memory. When temp_store is FILE (1) temporary tables
            and indices are stored in a file. The <a href="#pragma_temp_store_directory">temp_store_directory</a>
            pragma can be used to specify the directory containing this file. <b>FILE</b> is
            specified. When the temp_store setting is changed, all existing temporary tables,
            indices, triggers, and views are immediately deleted.</p>
          <p>
            It is possible for the library compile-time C preprocessor symbol TEMP_STORE to
            override this pragma setting. The following table summarizes the interaction of
            the TEMP_STORE preprocessor macro and the temp_store pragma:</p>
          <blockquote>
            <table border="1" cellpadding="2">
              <tr>
                <th valign="bottom">
                  TEMP_STORE</th>
                <th valign="bottom">
                  PRAGMA<br />
                  temp_store</th>
                <th>
                  Storage used for<br />
                  TEMP tables and indices</th>
              </tr>
              <tr>
                <td align="middle">
                  0</td>
                <td align="middle">
                  <em>any</em></td>
                <td align="middle">
                  file</td>
              </tr>
              <tr>
                <td align="middle">
                  1</td>
                <td align="middle">
                  0</td>
                <td align="middle">
                  file</td>
              </tr>
              <tr>
                <td align="middle">
                  1</td>
                <td align="middle">
                  1</td>
                <td align="middle">
                  file</td>
              </tr>
              <tr>
                <td align="middle">
                  1</td>
                <td align="middle">
                  2</td>
                <td align="middle">
                  memory</td>
              </tr>
              <tr>
                <td align="middle">
                  2</td>
                <td align="middle">
                  0</td>
                <td align="middle">
                  memory</td>
              </tr>
              <tr>
                <td align="middle">
                  2</td>
                <td align="middle">
                  1</td>
                <td align="middle">
                  file</td>
              </tr>
              <tr>
                <td align="middle">
                  2</td>
                <td align="middle">
                  2</td>
                <td align="middle">
                  memory</td>
              </tr>
              <tr>
                <td align="middle">
                  3</td>
                <td align="middle">
                  <em>any</em></td>
                <td align="middle">
                  memory</td>
              </tr>
            </table>
          </blockquote>
          <br />
          <a name="pragma_temp_store_directory"></a></li>
        <li>
          <p>
            <b>PRAGMA temp_store_directory;
              <br />
              PRAGMA temp_store_directory = 'directory-name';</b></p>
          <p>
            Query or change the setting of the "temp_store_directory" - the directory where
            files used for storing temporary tables and indices are kept. This setting lasts
            for the duration of the current connection only and resets to its default value
            for each new connection opened.
          </p>
          <p>
            When the temp_store_directory setting is changed, all existing temporary tables,
            indices, triggers, and viewers are immediately deleted. In practice, temp_store_directory
            should be set immediately after the database is opened.
          </p>
          <p>
            The value <i>directory-name</i> should be enclosed in single quotes. To revert the
            directory to the default, set the <i>directory-name</i> to an empty string, e.g.,
            <i>PRAGMA temp_store_directory = ''</i>. An error is raised if <i>directory-name</i>
            is not found or is not writable.
          </p>
          <p>
            The default directory for temporary files depends on the OS. For Unix/Linux/OSX,
            the default is the is the first writable directory found in the list of: <b>/var/tmp,
              /usr/tmp, /tmp,</b> and <b><i>current-directory</i></b>. For Windows NT, the default
            directory is determined by Windows, generally <b>C:\Documents and Settings\<i>user-name</i>\Local
              Settings\Temp\</b>. Temporary files created by SQLite are unlinked immediately
            after opening, so that the operating system can automatically delete the files when
            the SQLite process exits. Thus, temporary files are not normally visible through
            <i>ls</i> or <i>dir</i> commands.</p>
        </li>
      </ul>
      <hr />
      <a name="schema"></a>
      <h1>
        Pragmas to query the database schema</h1>
      <ul>
        <a name="pragma_database_list"></a>
        <li>
          <p>
            <b>PRAGMA database_list;</b></p>
          <p>
            For each open database, invoke the callback function once with information about
            that database. Arguments include the index and the name the database was attached
            with. The first row will be for the main database. The second row will be for the
            database used to store temporary tables.</p>
          <a name="pragma_foreign_key_list"></a></li>
        <li>
          <p>
            <b>PRAGMA foreign_key_list(</b><i>table-name</i><b>);</b></p>
          <p>
            For each foreign key that references a column in the argument table, invoke the
            callback function with information about that foreign key. The callback function
            will be invoked once for each column in each foreign key.</p>
          <a name="pragma_index_info"></a></li>
        <li>
          <p>
            <b>PRAGMA index_info(</b><i>index-name</i><b>);</b></p>
          <p>
            For each column that the named index references, invoke the callback function once
            with information about that column, including the column name, and the column number.</p>
          <a name="pragma_index_list"></a></li>
        <li>
          <p>
            <b>PRAGMA index_list(</b><i>table-name</i><b>);</b></p>
          <p>
            For each index on the named table, invoke the callback function once with information
            about that index. Arguments include the index name and a flag to indicate whether
            or not the index must be unique.</p>
          <a name="pragma_table_info"></a></li>
        <li>
          <p>
            <b>PRAGMA table_info(</b><i>table-name</i><b>);</b></p>
          <p>
            For each column in the named table, invoke the callback function once with information
            about that column, including the column name, data type, whether or not the column
            can be NULL, and the default value for the column.</p>
        </li>
      </ul>
      <hr />
      <a name="version"></a>
      <h1>
        Pragmas to query/modify version values</h1>
      <ul>
        <a name="pragma_schema_version"></a><a name="pragma_user_version"></a>
        <li>
          <p>
            <b>PRAGMA [database.]schema_version;
              <br />
              PRAGMA [database.]schema_version = </b><i>integer </i><b>;
                <br />
                PRAGMA [database.]user_version;
                <br />
                PRAGMA [database.]user_version = </b><i>integer </i><b>;</b>
          </p>
          <p>
            The pragmas schema_version and user_version are used to set or get the value of
            the schema-version and user-version, respectively. Both the schema-version and the
            user-version are 32-bit signed integers stored in the database header.</p>
          <p>
            The schema-version is usually only manipulated internally by SQLite. It is incremented
            by SQLite whenever the database schema is modified (by creating or dropping a table
            or index). The schema version is used by SQLite each time a query is executed to
            ensure that the internal cache of the schema used when compiling the SQL query matches
            the schema of the database against which the compiled query is actually executed.
            Subverting this mechanism by using "PRAGMA schema_version" to modify the schema-version
            is potentially dangerous and may lead to program crashes or database corruption.
            Use with caution!</p>
          <p>
            The user-version is not used internally by SQLite. It may be used by applications
            for any purpose.</p>
        </li>
      </ul>
      <hr />
      <a name="debug"></a>
      <h1>
        Pragmas to debug the library</h1>
      <ul>
        <a name="pragma_integrity_check"></a>
        <li>
          <p>
            <b>PRAGMA integrity_check;</b></p>
          <p>
            The command does an integrity check of the entire database. It looks for out-of-order
            records, missing pages, malformed records, and corrupt indices. If any problems
            are found, then a single string is returned which is a description of all problems.
            If everything is in order, "ok" is returned.</p>
          <a name="pragma_parser_trace"></a></li>
        <li>
          <p>
            <b>PRAGMA parser_trace = ON; </b>(1)<b>
              <br />
              PRAGMA parser_trace = OFF;</b> (0)</p>
          <p>
            Turn tracing of the SQL parser inside of the SQLite library on and off. This is
            used for debugging. This only works if the library is compiled without the NDEBUG
            macro.
          </p>
          <a name="pragma_vdbe_trace"></a></li>
        <li>
          <p>
            <b>PRAGMA vdbe_trace = ON; </b>(1)<b>
              <br />
              PRAGMA vdbe_trace = OFF;</b> (0)</p>
          <p>
            Turn tracing of the virtual database engine inside of the SQLite library on and
            off. This is used for debugging. See the <a href="vdbe.html#trace">VDBE documentation</a>
            for more information.</p>
          <a name="pragma_vdbe_listing"></a></li>
        <li>
          <p>
            <b>PRAGMA vdbe_listing = ON; </b>(1)<b>
              <br />
              PRAGMA vdbe_listing = OFF;</b> (0)</p>
          <p>
            Turn listings of virtual machine programs on and off. With listing is on, the entire
            content of a program is printed just prior to beginning execution. This is like
            automatically executing an EXPLAIN prior to each statement. The statement executes
            normally after the listing is printed. This is used for debugging. See the <a href="vdbe.html#trace">
              VDBE documentation</a> for more information.</p>
        </li>
      </ul>
      <p>
      <hr>
        &nbsp;</p>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted Doc/Extra/syntax.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>SQLite Query Syntax</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">SQLite Query Syntax</span>&nbsp;</td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite Language Reference Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">
        SQL As Understood By SQLite</h1>
      <p>
        The SQLite library understands most of the standard SQL language. But it does omit
        some features while at the same time adding a few features of its own. This document
        attempts to describe precisely what parts of the SQL language SQLite does and does
        not support. A list of keywords is also provided. In all of the syntax diagrams
        that follow, literal text is shown in bold blue. Non-terminal symbols are shown
        in italic red. Operators that are part of the syntactic markup itself are shown
        in black roman. This document is just an overview of the SQL syntax implemented
        by SQLite.
      </p>
      <h4>
        SQLite implements the follow syntax:</h4>
      <p>
        <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse">
          <tr>
            <td>
              <a href="lang_altertable.html">
              ALTER TABLE</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_analyze.html">
              ANALYZE</a></td>
          </tr>
          <tr>
            <td style="height: 19px">
              <a href="lang_attach.html">
              ATTACH DATABASE</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_transaction.html">
              BEGIN TRANSACTION</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_comment.html">
              comment</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_transaction.html">
              COMMIT TRANSACTION</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_createindex.html">CREATE INDEX</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_createtable.html">CREATE TABLE</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_createtrigger.html">CREATE TRIGGER</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_createview.html">CREATE VIEW</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_createvtab.html">
              CREATE VIRTUAL TABLE</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_delete.html">
              DELETE</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_detach.html">
              DETACH DATABASE</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_dropindex.html">DROP INDEX</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_droptable.html">DROP TABLE</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_droptrigger.html">DROP TRIGGER</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_dropview.html">DROP VIEW</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_transaction.html">
              END TRANSACTION</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_explain.html">
              EXPLAIN</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_expr.html">
              expression</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_insert.html">
              INSERT</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_conflict.html">
              ON CONFLICT clause</a></td>
          </tr>
          <tr>
            <td style="height: 19px">
              <a href="pragma.html">
              PRAGMA</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_reindex.html">
              REINDEX</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_replace.html">
              REPLACE</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_transaction.html">
              ROLLBACK TRANSACTION</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_select.html">
              SELECT</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_types.html">
              TYPES</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_update.html">
              UPDATE</a></td>
          </tr>
          <tr>
            <td>
              <a href="lang_vacuum.html">
              VACUUM</a></td>
          </tr>
        </table>
      </p>
      <hr>
      <div id="footer">
        <p>
          &nbsp;</p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































































































































































































































Deleted Doc/Extra/version.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>Version History</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">Version History</span>
          </td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite.NET Class Library Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
    <h1 class="heading">Version History</h1>
    <p><b>1.0.66.0 - April 18, 2010</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.23.1</li>
      <li>Fixed a bug in the installer that accidentally modified the machine.config on .NET versions prior to 2.0, invaliding the config file.</li>
      <li>Fixed INTERSECT and EXCEPT union query generation in EF</li>
      <li>Fixed an out of memory error in the trigger designer in cases where a WHEN clause is used in the trigger</li>
    </ul>
    <p><b>1.0.65.0 - July 26, 2009</b></p>
    <ul>
      <li>Fixed a bug in the encryption module to prevent a double free() when rekeying a database.</li>
      <li>Fixed a bug in the encryption module when ATTACHing an encrypted database.</li>
      <li>Incorporated the WinCE locking fix from ticket
        <a href="http://www.sqlite.org/cvstrac/tktview?tn=3991">#3991</a></li>
      <li>Added &quot;bigint&quot; to the dropdown in the table designer, plus other minor table 
        designer bugfixes.</li>
    </ul>
    <p><b>1.0.64.0 - July 9, 2009</b></p>
    <ul>
      <li>Fixed the missing resources problem from the 63 release.</li>
      <li>Added preliminary support for the Visual Studio 2010 beta.</li>
      <li>Fixed a bug in SQLiteCommand that threw a null reference exception when 
        setting the Transaction object to null.</li>
      <li>If SQLiteConnection.EnlistTransaction is called multiple times for the same 
        transaction scope, just return without throwing an error.</li>
    </ul>
    <p><b>1.0.63.0 - June 29, 2009</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.16</li>
      <li>Check the autocommit mode of the connection to which a transaction is bound 
        during the disposal of the transaction.&nbsp; If autocommit is enabled, then the 
        database has already rolled back the transaction and we don&#39;t need to do it 
        during dispose, and can quietly ignore the step without throwing an error.</li>
      <li>Eliminated the mergebin step altogether.&nbsp; It was developed primarily to 
        merge the Compact Framework binaries together, but since we&#39;re not doing that 
        anymore, its use is limited.&nbsp; Its non-standard method of merging a binary 
        on the desktop framework is redundant as well.&nbsp; The desktop binary now 
        hard-links to MSCOREE, but as of Windows XP, this was redundant as well since XP 
        and beyond automatically attempt to load MSCOREE on startup when a DLL has a 
        .NET header.</li>
      <li>More improvements to the test.exe program for running the tests against Sql 
        Server for comparison purposes.</li>
    </ul>
    <p><b>1.0.62.0 - June 20, 2009</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.15</li>
      <li>Fixed the decimal reading bug in the SQLiteDataReader</li>
      <li>Changed Join()&#39;s to Sleep()&#39;s in the statement retry code to prevent message 
        pumping</li>
      <li>Fixed a bad pointer conversion when retrieving blobs using GetBytes() in 
        64-bit land</li>
      <li>Several changes to the Test program that comes with the provider.&nbsp; Tests 
        can now be individually disabled, and the test program can run against several 
        provider back-ends</li>
    </ul>
    <p><b>1.0.61.0 - April 28, 2009</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.13.  The new backup features are as yet unimplemented in the provider, but will be forthcoming in a subsequent release</li>
      <li>Fixed the default-value lookups in SQLiteConnectionStringBuilder when accessing properties</li>
      <li>Lock the SQLiteTransaction object during dispose to avoid potential race condition during cleanup</li>
      <li>Fixed SQLiteDataReader.GetDecimal() processing and parsing of decimal values for cases when SQLite returns things like "1.0e-05" instead of "0.0001"</li>
    </ul>
    <p><b>1.0.60.0 - October 3, 2008</b></p>
    <ul>
      <li>Throw a NotSupported exception in the EF Sql Gen code instead of parsing 
        illegal SQL during an update/insert/delete where no primary key is defined.</li>
      <li>Fixed the Compact Framework interop library.&nbsp; Since the linker flag 
        /subsystem had no version specified, it was causing a problem for many CE-based 
        platforms.</li>
      <li>Incorporated SQLite patch for ticket
        <a href="http://www.sqlite.org/cvstrac/tktview?tn=3387">#3387</a> and reverted 
        out the vfs override code I added in build 59 to work around this problem.</li>
      <li>Fixed a designer issue when creating a new table from the Server Explorer.&nbsp; 
        After initially saving it, if you then continued to edit it and tried to save it 
        again, it would generate the change SQL using the old temporary table name 
        rather than the new name.</li>
    </ul>
    <p><b>1.0.59.0 - September 22, 2008</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.3.&nbsp; Solves 
        a couple different EF issues that were either giving inconsistent results or 
        crashing the engine.</li>
      <li>Fixed the parsing of literal binaries in the EF SqlGen code.&nbsp; SQLite now 
        passes nearly all the testcases in 
        <a href="http://sqlite.phxsoftware.com/forums/p/1377/5921.aspx#5921">Microsoft's EF Query Samples</a> application -- 
        the exception being the <i>datetimeoffset </i>and<i> time</i> constants tests, and tests 
        that use the <i>APPLY </i>keyword which are unsupported for now.</li>
      <li>Revamped the Compact Framework mixed-mode assembly.&nbsp; Tired of playing cat 
        and mouse with the Compact Framework&#39;s support for mixed-mode assemblies.&nbsp; 
        The CF build now requires that you distribute both the System.Data.SQLite 
        library and the paired SQLite.Interop.XXX library.&nbsp;&nbsp; The XXX denotes 
        the build number of the library.</li>
      <li>Implemented a workaround for Vista&#39;s overzealous caching by turning off 
        FILE_FLAG_RANDOM_ACCESS for OS versions above XP.&nbsp; This is implemented 
        as a custom (default override) VFS in the interop.c file, so no changes are made 
        to the SQLite source code.</li>
      <li>Fixed some registry issues in the designer install.exe, which prevented some 
        design-time stuff from working on the Compact Framework when .NET 3.5 was 
        installed.</li>
    </ul>
    <p><b>1.0.58.0 - August 30, 2008</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.2.&nbsp; If only I&#39;d waited one more day to release 
        57!&nbsp; Several LINQ issues have been resolved with this engine release 
        relating to deeply-nested subqueries that the EF SqlGen creates.</li>
      <li>Fixed the Rollback SQLiteConnection event to not require a connection be 
        opened first.</li>
    </ul>
    <p><b>1.0.57.0 - August 29, 2008</b></p>
    <ul>
      <li>Compiled against 3.6.1 with checkin
        <a href="http://www.sqlite.org/cvstrac/tktview?tn=3300">#3300</a> resolved, 
        which fixes an Entity Framework bug I was seeing.&nbsp; I currently have 3 other 
        tickets out on the engine, which are not yet resolved and relate to EF.</li>
      <li>Fixed decimal types to store and fetch using InvariantCulture.&nbsp; If you&#39;re 
        using decimal datatypes in your database and were affected by the 56 release, 
        please issue an UPDATE &lt;table&gt; SET &lt;column&gt; = REPLACE(&lt;column&gt;, &#39;,&#39;, &#39;.&#39;);&nbsp; 
        to fix the decimal separators.&nbsp; Apologies for not testing that more 
        thoroughly before releasing 56.</li>
      <li>Too many LINQ fixes to list.&nbsp; Fixed views so they generate, 
        fixed the LIMIT clause, implemented additional functionality and removed unnecessary code.</li>
      <li>Fixed foreign key names in the designer so viewing the SQL script on a new 
        unsaved table after renaming it in the properties toolwindow will reflect in the 
        script properly.</li>
      <li>Fixed the Update and Commit events on SQLiteConnection so they don&#39;t require 
        the connection to be opened first.</li>
      <li>Fixed userdef aggregate functions so they play nice with each other when 
        appearing multiple times in the same statement.</li>
      <li>Fixed the editing and saving of default values in the table designer.</li>
      <li>Fixed ForeignKeys schema to support multi-column foreign keys.&nbsp; Also 
        hacked support for them in the table designer, provided two foreign keys in the 
        designer have the same name and reference the same foreign table and different 
        columns.&nbsp; Will implement first-class support for this in the next release.</li>
    </ul>
    <p><b>1.0.56.0 - August 11, 2008</b></p>
    <ul>
      <li>Fixed a bug in the table designer when designing new tables, wherein you had to 
        save the table first before being able to create indexes and foreign keys.</li>
      <li>Tweaks to decimal type handling.&nbsp; The &#39;decimal&#39; type can&#39;t be represented 
        by Int64 or Double (without loss of precision) in SQLite, so we have to fudge it 
        by treating it like a string and converting it back and forth in the provider.&nbsp; 
        Unfortunately backing it to the db as a string causes sorting problems.&nbsp; 
        See <a href="http://sqlite.phxsoftware.com/forums/p/1296/5595.aspx#5595">this 
        post</a> 
        for details on using a custom collation sequence to overcome the sorting issue arising from this patch.</li>
      <li>Minor tweaks and bugfixes to the test program and the provider.</li>
      <li>More adjustments to make the managed-only version of the provider run and pass 
        all tests on Mono.</li>
      <li>LINQ to Entities bits heavily updated and compiled against VS2008 SP1 RTM.&nbsp; SQLite 
        LINQ support is still considered beta.</li>
    </ul>
    <p><b>1.0.55.0 - August 6, 2008</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.1</li>
      <li>Added support for the user-contributed extension-functions at
        <a href="http://www.sqlite.org/contrib">http://www.sqlite.org/contrib</a>.&nbsp; 
        Feel free to override any of them with your own implementation.&nbsp; The new 
        functions are: <i>acos, asin, atan, atn2, atan2, acosh, asinh, atanh, 
        difference, degrees, radians, cos, sin, tan, cot, cosh, sinh, tanh, coth, exp, 
        log, log10, power, sign, sqrt, square, ceil, floor, pi, replicate, charindex, 
        leftstr, rightstr, reverse, proper, padl, padr, padc, strfilter,</i> and 
        aggregates <i>stdev, variance, mode, median, lower_quartile, upper_quartile.</i></li>
      <li>Moved the last_rows_affected() function to the C extension library.</li>
      <li>Added a new class, SQLiteFunctionEx which extends SQLiteFunction and adds the 
        ability for a user-defined function to get the collating sequence during the 
        Invoke/Step methods.&nbsp; User-defined functions can use the collating sequence 
        as a helper to compare values.</li>
      <li>When registering user-defined collation sequences and functions, the provider 
        will now register both a UTF8 and a UTF16 version instead of just UTF8.</li>
      <li>Revamped connection pooling and added static ClearPool() and ClearAllPools() 
        functions to SQLiteConnection.&nbsp; Behavior of the pool and its clearing 
        mechanics match SqlClient.</li>
      <li>Fixed connections going to the pool so that any unfinalized lingering commands 
        from un-collected datareaders are automatically reset and any lurking 
        transactions made on the connection are rolled back.</li>
      <li>Transaction isolation levels are now partially supported.&nbsp; Serializable 
        is the default, which obtains read/write locks immediately -- this is compatible 
        with previous releases of the provider.&nbsp; Unspecified will default to 
        whatever the default isolation mode is set to, and ReadCommitted will cause a 
        deferred lock to be obtained.&nbsp; No other values are legal.</li>
      <li>Revamped the test.exe program.&nbsp; It&#39;s now an interactive GUI application.&nbsp; 
        Easier for me to add tests now.</li>
      <li>Tweaks to the VS designer package and installer.</li>
      <li>More adjustments to the internal SQLite3.Prepare() method to account for both 
        kinds of lock errors when retrying.</li>
      <li>Stripped a lot of unnecessary interop() calls and replaced with base sqlite calls.&nbsp; 
        Revamped most of UnsafeNativeMethods to make it easier to port the code.</li>
      <li>Rerigged internal callbacks for userdef functions and other native to managed 
        callbacks.&nbsp; More portable this way.</li>
      <li>Source can now can be compiled with the SQLITE_STANDARD preprocessor symbol to 
        force the wrapper to use the stock sqlite3 library.&nbsp; Some functionality is 
        missing, but its minimal.&nbsp; None of the precompiled binaries are compiled 
        using this setting, but its useful for testing portability.</li>
      <li>Added &quot;boolean&quot; and a couple other missing datatypes to the &quot;DataTypes&quot; schema 
        xml file.&nbsp; Used by the VS designer when displaying tables and querying.</li>
      <li>Added a new connection string option &quot;Read Only&quot;.&nbsp; When set to True, the 
        database will be opened in read-only mode.</li>
      <li>Added a new connection string option &quot;Max Pool Size&quot; to set the maximum size 
        of the connection pool for a given db file connection.</li>
      <li>Added a new connection string option &quot;Default IsolationLevel&quot; to set the 
        default isolation level of transactions.&nbsp; Possible values are Serializable and 
        ReadCommitted.</li>
      <li>Added a new connection string option &quot;URI&quot; as an optional parameter for 
        compatibility with other ports of the provider.</li>
    </ul>
    <p><b>1.0.54.0 - July 25, 2008</b></p>
    <ul>
      <li>Fixed the setup project, which somehow &quot;forgot&quot; to include all the binaries in 
        the 53 release.</li>
      <li>Fixed a crash in the table designer when creating a new table and tabbing past 
        the &quot;Allow Nulls&quot; cell in the grid while creating a new column.</li>
      <li>Fixed a mostly-benign bug in SQLiteDataReader&#39;s GetEnumerator, which failed to 
        pass along a flag to the underyling DbEnumerator it creates.&nbsp; This one&#39;s 
        been around since day 1 and nobody&#39;s noticed it in all these years.</li>
      <li>Added a new connection string parameter &quot;Journal Mode&quot; that allows you to set 
        the SQLite journal mode to Delete, Persist or Off.</li>
    </ul>
    <p><b>1.0.53.0 - July 24, 2008</b></p>
    <ul>
      <li>Enabled sqlite_load_extension</li>
      <li>Added retry/timeout code to SQLite3.Prepare() when preparing statements for 
        execution and a SQLITE_BUSY error occurs.</li>
      <li>Added a new schema to SQLiteConnection.GetSchema() called <i>Triggers</i>.&nbsp; 
        Used to retrieve the trigger(s) associated with a database and/or table/view.</li>
      <li>Extensive updates to table/view editing capabilities inside Visual Studio&#39;s 
        Server Explorer.&nbsp; The program now parses and lets you edit CHECK constraints and 
        triggers on a table, as well as define triggers on views.&nbsp; Experimental 
        still, so e-mail me if you have issues.</li>
      <li>Minor bugfix to the ViewColumns schema to return the proper base column name 
        for a view that aliases a column.</li>
      <li>Fixed the insert/update/delete DML support in the Linq module.</li>
      <li>Changed the behavior of SQLiteCommand to allow a transaction to be set even if 
        the command hasn&#39;t been associated with a connection yet.</li>
    </ul>
    <p><b>1.0.52.0 - July 16, 2008</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.0</li>
      <li>Added a lot of previously-missing exports to the DEF file for the 
        native library.</li>
      <li>Fixed SQLiteDataReader to check for an invalid connection before operating on 
        an open cursor.</li>
      <li>Implemented the Cancel() function of SQLiteCommand to cancel an active reader.</li>
      <li>Added beta table and view designers to the Visual Studio Server Explorer.&nbsp; You can now 
        edit/create tables and views, manage indexes and foreign keys from Visual Studio.&nbsp; 
        This feature is still undergoing testing so use at your own risk!</li>
      <li>Fixed the Server Explorer so VS2005 users can once again right-click tables 
        and views and open the table data.</li>
      <li>Added some new interop code to assist in returning more metadata not normally 
        available through the SQLite API.&nbsp; Specifically, index column sort modes 
        and collating sequences.&nbsp; Also added code to detect (but not parse) CHECK 
        constraints, so the table designer can pop up a warning when editing a table 
        with these constraints.&nbsp; Since I can&#39;t currently parse them.</li>
      <li>Lots of LINQ SQL generation improvements and fixes.</li>
      <li>Made some progress cleaning up and fixing up the schema definitions and 
        manifests for EdmGen.</li>
      <li>Added a built-in SQLiteFunction called last_rows_affected() which can be 
        called from SQL to get the number of rows affected by the last update/insert 
        operation on the connection.&nbsp; This is roughly equivalent to Sql Server&#39;s 
        @@ROWCOUNT variable.</li>      
    </ul>
    <p><b>1.0.51.0 - July 1, 2008</b></p>
    <ul>
      <li><b>VS2008 SP1 Beta1 LINQ Support</b></li>
      <li>Added experimental Entity Framework support in a new library, 
        System.Data.SQLite.Linq.&nbsp; Some things work, some don&#39;t.&nbsp; I haven&#39;t 
        finished rigging everything up yet.&nbsp; The core library remains stable.&nbsp; 
        All LINQ-specific code is completely separate from the core.</li>
      <li>&nbsp;Added some columns to several existing schemas to support some of the 
        EDM framework stuff.</li>
      <li>Minor tweaks to the factory to better support dynamic loading of the Linq 
        extension library for SQLite.</li>
      <li>SQLite&#39;s busy handler was interfering with the provider&#39;s busy handling 
        mechanism, so its been disabled.</li>
    </ul>
    <p><b>1.0.50.0 - June 27, 2008</b></p>
    <ul>
      <li>Fixed some lingering dispose issues and race conditions when some objects were finalized.</li>
      <li>Fixed the SQLiteConvert.Split() routine to be a little smarter when splitting 
        strings, which solves the quoted data source filename problem.</li>
      <li>Enhanced the mergebin utility to work around the strong name validation bug on 
        the Compact Framework.&nbsp; The old workaround kludged the DLL and caused WM6.1 
        to fail to load it.&nbsp; This new solution is permanent and no longer kludges 
        the DLL.</li>
    </ul>
    <p><b>1.0.49.0 - May 28, 2008</b></p>
    <ul>
      <li>Code merge with SQLite 3.5.9</li>
      <li>Fixed schema problems when querying the TEMP catalog.</li>
      <li>Changed BLOB datatype schema to return IsLong = False instead of True.&nbsp; This
        was preventing DbCommandBuilder from using GUID's and BLOB's as primary keys.</li>
      <li>Fix rollover issue with SQLite3.Reset() using TickCount.</li>
      <li>Fixed SQLiteDataReader to dispose of its command (if called for) before 
        closing the connection (when flagged to do so) instead of the other way around.</li>
      <li>Fixed a DbNull error when retrieving items not backed by a table schema.</li>
      <li>Fixed foreign key constraint parsing bug.</li>
      <li>Added FailIfMissing property to the SQLiteConnectionStringBuilder.</li>
      <li>Converted the source projects to Visual Studio 2008.</li>
    </ul>
    <p><b>1.0.48.0 - December 28, 2007</b></p>
    <ul>
      <li>Code merge with SQLite 3.5.4</li>
      <li>Calling SQLiteDataReader.GetFieldType() on a column with no schema information
        and whos first row is initially NULL now returns type Object instead of type DbNull.</li>
      <li>Added support for a new DateTime type, JulianDay.&nbsp; SQLite uses Julian dates
        internally.</li>
      <li>Added a new connection string parameter "Default Timeout" and a corresponding
        method on the SQLiteConnection object to change the default command timeout.&nbsp;
        This is especially useful for changing the timeout on transactions, which use SQLiteCommand
        objects internally and have no ADO.NET-friendly way to adjust the command timeout
        on those commands.</li>
      <li>FTS1 and FTS2 modules were removed from the codebase.&nbsp; Please upgrade all
        full-text indexes to use the FTS3 module.&nbsp;</li>
    </ul>
    <p><b>1.0.47.2 - December 10, 2007</b></p>
    <ul>
      <li>Fixed yet one more bug when closing a database with unfinalized command objects</li>
      <li>Fixed the DataReader's GetFieldType function when dealing with untyped SQLite affinities</li>
    </ul>
    <p><b>1.0.47.1 - December 5, 2007</b></p>
    <ul>
      <li>Fixed a leftover bug from the codemerge with SQLite 3.5.3 that failed to close a database.</li>
      <li>Fixed the broken Compact Framework distribution binary.</li>
      <li>SQLite 3.5.x changed some internal infrastructure pieces in the encryption interface
        which I didn't catch initially.&nbsp; Fixed.&nbsp;</li>
    </ul>
    <p><b>1.0.47.0 - December 4, 2007</b></p>
    <ul>
      <li>Code merge with SQLite 3.5.3</li>
      <li>Added installer support for Visual Studio 2008.&nbsp; Code is still using the
        VS2005 SDK so one or two bells and whistles are missing, but nothing significant.</li>
      <li>This is the last version that the FTS1 and FTS2 extensions will appear.&nbsp;
        Everyone should rebuild their fulltext indexes using the new FTS3 module.&nbsp;
        FTS1 and FTS2 suffer from a design flaw that could cause database corruption with
        certain vacuum operations.</li>
      <li>Fixed pooled connections so they rollback any outstanding transactions before
        going to the pool.&nbsp; </li>
      <li>Fixed the unintended breaking of the TYPES keyword, and mis-typing of untyped
        or indeterminate column types. </li>
      <li>Assert a FileIOPermission() requirement in the static SQLiteFunction constructor.
      </li>
      <li>The CE-only SQLiteFunction.RegisterFunction() is now available on the desktop
        platform for dynamic registration of functions.&nbsp; You must still close and re-open
        a connection in order for the new function to be seen by a connection.</li>
      <li>Fixed the "database is locked" errors by implementing behavioral changes in the
        interop.c file for SQLite.&nbsp; Closing a database force-finalizes any prepared
        statements on the database to ensure the connection is fully closed.&nbsp; This
        was rather tricky because the GC thread could still be finalizing statements itself.
        &nbsp;</li>
      <li>Modifed the mergebin utility to help circumvent a long-standing strong name verification
        bug in the Compact Framework.</li>
    </ul>
    <p><b>1.0.46.0 - September 30, 2007</b></p>
    <ul>
    <li>Fixed faulty logic in type discovery code when using SQLiteDataReader.GetValue().</li>
      <li>Fixed Connection.Open() bug when dealing with :memory: databases.</li>
      <li>Fixed SQLiteCommand.ExecuteScalar() to return a properly-typed value.</li>
      <li>Added support for SQLiteParameter.ResetDbType().</li>
      <li>Added test cases for rigid and flexible type testing.</li>
    </ul>
    <p><b>1.0.45.0 - September 25, 2007</b></p>
    <ul>
    <li><strong>Breaking change in GetSchema("Indexes") </strong>-- MetaDataCollections
      restrictions and identifier parts counts were wrong for this schema and I was using
      the wrong final parameter as the final restriction.&nbsp; Meaning, if you use the
      Indexes schema and are querying for a specific index the array should now be {catalog,
      null, table, index } instead of {catalog, null, table, null, index}</li>
      <li>Fixed some errors in the encryption module, most notably when a non-default page
        size is specified in the connection string.</li>
      <li>Fixed SQLiteDataReader to better handle type-less usage scenarios, which also
        fixes problems with null values and datetimes.</li>
      <li>Fixed the leftover temp files problem on WinCE </li>
      <li>Added connection pooling.&nbsp; The default is disabled for now, but may change
      in the future.&nbsp; Set "Pooling=True" in the connection string to enable it. </li>
      <li>Sped up SQLiteConnection.Open() considerably.</li>
      <li>Added some more robust cleanup code regarding SQLiteFunctions.</li>
      <li>Minor additions to the code to allow for future LINQ integration into the main
        codebase.</li>
      <li>Fixed a long-standing bug in the Open() command of SQLiteConnection which failed
      to honor the documented default behavior of the SQLite.NET provider to open the
      database in "Synchronous=Normal" mode.&nbsp; The default was "Full". </li>
      <li>If Open() fails, it no longer sets the connection state to Broken.&nbsp; It instead
        reverts back to Closed, and cleans up after itself.</li>
      <li>Added several new parameters to the ConnectionString for setting max page count,
        legacy file format, and another called FailIfMissing to raise an error rather than
        create the database file automatically if it does not already exist.</li>
      <li>Fixed some designer toolbox references to the wrong version of the SQLite.Designer</li>
      <li>Fixed a bug in the mergebin utility with regards to COR20 metadata rowsize computations.&nbsp;
      </li>
      <li>Minor documentation corrections &nbsp;&nbsp;</li>
    </ul>
    <p><b>1.0.44.0 - July 21, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.4.1</li>
      <li>Fixed a bug in SQLiteConnection.Open() which threw the wrong kind of error in
        the wrong kind of way when a database file could not be opened or created.&nbsp;</li>
      <li>Small enhancements to the TYPES keyword, and added documentation for it in the
        help file.</li>
      <li>Hopefully fixed the occasional SQLITE_BUSY errors that cropped up when starting
        a transaction.&nbsp; Usually occurred in high-contention scenarios, and the underlying
        SQLite engine bypasses the busy handler in this scenario to return immediately.</li>
    </ul>
    <p><b>1.0.43.0 - June 21, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.4.0</li>
      <li>Fixed a reuse bug in the SQLiteDataAdapter in conjunction with the SQLiteCommandBuilder.&nbsp;
      It's been there unnoticed for more than a year, so it looks like most folks never
      encountered it. </li>
      <li>Fixed an event handler bug in SQLiteCommandBuilder in which it could fail to unlatch
        from the DataAdapter when reused.&nbsp; Relates to the previous bugfix.</li>
      <li>Fixed a double-dispose bug in SQLiteStatement that triggered a SQLiteException.&nbsp;</li>
    </ul>
    <p><b>1.0.42.0 - June 1, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.17</li>
      <li>Changed the SQLiteFunction static constructor so it only enumerates loaded modules
        that have referenced the SQLite assembly, which hopefully should cut down dramatically
        the time it takes for that function to execute.&nbsp;</li>
      <li>Added the FTS2 full-text search extension to the project.&nbsp; Look for FTS1
        to disappear within the next couple of revisions.&nbsp;</li>
      <li>Fixed a bug introduced with the finalizers that triggered an error when statements
        ended with a semi-colon or had other non-parsable comments at the end of a statement&nbsp;</li>
      <li>Fixed an intermittent multi-threaded race condition between the garbage collector
        thread and the main application thread which lead to an occasional SQLITE_MISUSE
        error.</li>
      <li>Fixed another issue relating to SQLite's inherent typelessness when dealing with
        aggregate functions which could return Int64 or Double or even String for a given
        row depending on what was aggregated.</li>
      <li>Remembered to recompile the DDEX portion of the engine this time, so Compact Framework
        users can once again use the design-time functionality</li>
    </ul>
    <p><b>1.0.41.0 - April 23, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.16</li>
      <li>Second go at implementing proper finalizers to cleanup after folks who've forgotten to Dispose() of the SQLite objects</li>
      <li>Enhanced GetSchema(IndexColumns) to provide numeric scale and precision values</li>
      <li>Fixed the column ordinals in GetSchema(IndexColumns) to report the ordinal of the column in the index, not the table</li>
      <li>Fixed a bug whereby parameters named with an empty string (such as String.Empty) were treated like a named parameter instead of an unnamed parameter</li>
    </ul>
    <p><b>1.0.40.0 - January 31, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.12</li>
      <li>Lots of new code to handle misuse of the library.&nbsp; Implemented finalizers
        where it made sense, fixed numerous garbage collector issues when objects are not
        disposed properly, &nbsp;fixed some object lifetime issues, etc.</li>
      <li>A failed Commit() on a transaction no longer leaves the transaction in an unusable
        state.</li>
    </ul>
    <p><b>1.0.39.1 - January 11, 2007</b></p>
    <ul>
    <li>Fixed a really dumb mistake that for some reason didn't trigger any errors in
      the testcases, whereby commands when associated with a connection were not adding
      or removing themselves from an internal list of commands for that connection --
      causing a "database is locked" error when trying to close the connection.</li>
    </ul>
    <p><b>1.0.39.0 - January 10, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.10</li>
      <li>Fixed a multi-threaded race condition bug in the garbage collector when commands
        and/or connections are not properly disposed by the user.</li>
      <li>Switched the encryption's internal deallocation code to use sqlite's built-in
        aux functions instead of modifying the pager.c source to free the crypt block.&nbsp;
        This eliminates the last of the code changes the provider makes to the original
        sqlite engine sources.&nbsp; Props to Ralf Junker for pointing that out.</li>
    </ul>
    <p><b>1.0.38.0 - November 22, 2006</b></p>
    <ul>
    <li>Fixed a bug when using CommandBehavior.KeyInfo whereby integer primary key columns may be duplicated in the results. </li>
      <li>Enhanced the CommandBuilder so that update/delete statements are optimized when the affected table contains unique constraints and
      a primary key is present.</li>
      <li>Fixed a bug in the DataReader when used in conjunction with CommandBehavior.CloseConnection.</li></ul>
    <p><b>1.0.37.0 - November 19, 2006</b></p>
    <ul>
    <li>Added support for CommandBehavior.KeyInfo.&nbsp; 
      When specified in a query, additional column(s) will be returned describing the
      key(s) defined for the table(s) selected in the query.&nbsp; This is optimized when
      INTEGER PRIMARY KEY is set for the given tables, but does additional work for other
      kinds of primary keys.</li>
      <li>Removed the default values from SQLiteDataReader.GetTableSchema(), to better follow
        Sql Server's pattern and suppress schema errors when loading the records into a
        dataset/datatable.</li>
      <li>Allow integers to implicitly convert to double/decimal/single.</li></ul>
    <p><b>1.0.36.1 - October 25, 2006</b></p>
    <ul>
    <li>Added support for LONGVARCHAR, SMALLDATE and SMALLDATETIME.  These were actually added in 1.0.36.0 but were undocumented.</li>
    <li>Fixed the embedded helpfile which was accidentally built from old sources. </li>
    <li>Fixed an unfortunate re-entry of a bug in the .36 codebase that caused the provider to "forget" about commands on a connection under certain circumstances.</li>
    </ul>
    <p><b>1.0.36.0 - October 23, 2006</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.8, including support for full-text search via the FTS1
      extension.&nbsp;</li><li>Fixed a bug retrieving data types when UseUtf16Encoding is true.  Side-effect of further merging the common code between the two base classes.</li>
      <li>Fixed a bug with System.Transactions whereby a connection closed/disposed within
        a transaction scope is rolled back and cannot be committed.</li>
      <li>Added more error checking and reporting to transactions to help user's isolate
        the source of transaction failures.</li>
      <li>Implemented a workaround for a Compact Framework issue regarding strong-named
        assemblies containing a PE section with a raw size less than the virtual size.&nbsp;</li>
    </ul>
    <p><b>1.0.35.1 - September 12, 2006</b></p>
    <ul>
    <li>Fixed the TYPES keyword to work when UseUTF16Encoding is true.</li>
    <li>Fix another bug revealed in 1.0.35.0 regarding infinite loops when the 2nd or subsequent statements of a semi-colon separated command cannot be parsed.</li>
      <li>Updated the help documentation.&nbsp;</li>
    </ul>
    <p><b>1.0.35.0 - September 10, 2006</b></p>
    <ul>
    <li>Fixed an infinite loop bug in SQLiteCommand caused when multiple semi-colon separated
      statements in a single command are executed via datareader and one of the statements
      contains a syntax error preventing it from being prepared.&nbsp;</li><li>Added the TYPES preparser keyword to be placed before a SELECT statement to
    aid the wrapper in converting expressions in a subsequent select clause into more
    robust types.&nbsp; Documentation yet to be integrated, but available on the forums.</li>
      <li>Added a new connectionstring parameter "BinaryGUID=true/false" (default is "true").&nbsp;
        When true, guid types are stored in the database as binary blobs to save space.&nbsp;
        Binary has been the default format since 1.0.32.0 but this parameter eases backward
        compatibility.</li>
    </ul>
    <p><b>1.0.34.0 - September 4, 2006</b></p>
    <ul>
    <li>Fixed a bug in SQLiteParameterCollection.RemoveAt(namedparam)</li>
    <li>Fixed a bug in SQLiteDataReader introduced in 1.0.30 that broke DateTimes using the Ticks option in the connection string.</li>
      <li>Fixed a bug in the recent changes to guid behavior wherein using a datareader's
        indexer to fetch a guid from a column containing both binary and text guids would
        sometimes return a byte array instead of a guid.</li>
      <li>Enacted a workaround involving typed datasets in Compact Framework projects in
        which it took an excessive amount of time to open a form and generated a lot of
        temporary files in the user's Local Settings\Application Data\Microsoft\VisualStudio\8.0\Assembly
        References folder.</li>
    </ul>
     <p><b>1.0.33.0 - August 21, 2006</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.7</li>
      <li>Fixed a bug in SQLiteConnection that caused it to "forget" about commands bound
      to it and occasionally throw an error when a database is closed and opened repeatedly.&nbsp;
      </li>
    </ul>
<p><b>1.0.32.0 - August 6, 2006</b></p>
    <ul>
    <li>Added AllowPartiallyTrustedCallers attribute to the assembly</li><li>Added the missing "nchar" type</li>
      <li>Added support for binary Guid's.&nbsp; Guids are now stored as binary by default
        when using parameterized queries.&nbsp; Text guids are still fully supported.</li>
      <li>Fixed a TransactionScope() error that caused the transaction not to be completed.</li>
      <li>Enhanced parameter names so that if they are added to the Parameters collection
        without their prefix character (@ : or $) they are still properly mapped.&nbsp;</li>
    </ul>
        <p><b>1.0.31.0 - July 16, 2006</b></p>
    <ul>
    <li>Re-applied the view parsing bugfix in 1.0.29.0 that was accidentally reverted
      out of the 30 build.</li><li>Fixed SQLiteCommand.ExecuteScalar() to return null instead of DbNull.Value
    when no rows were returned.</li>
      <li>Design-time installer now installs the package-based designer on full Visual Studio
        versions.&nbsp; Express editions continue to use the packageless designer.</li>
      <li>In Visual Studio (not Express), you can now right-click a SQLite connection in
        the Server Explorer and vacuum the database and change the encryption password.</li>
    </ul>
    <p><b>1.0.30.1 - July 2, 2006</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.6</li>
      <li>Added support for the |DataDirectory| keyword in the Data Source filename string.&nbsp;
      </li>
      <li>Added hook notification support to SQLiteConnection.&nbsp; Specifically, there
      are three new events on the SQLiteConnection object which are raised when an update/insert/delete
      occurs and when transactions are committed and rolled back.</li><li>Changed SQLiteTransaction to default to BEGIN IMMEDIATE instead of just BEGIN,
    which solves a multithreaded race condition.&nbsp;</li>
      <li>Changed SQLiteDataReader to better support SQLite's typelessness.&nbsp; The data
        reader no longer caches column affinity, but re-evaluates it for each column/row.</li>
      <li>Fixed a bug in Prepare() which caused an intermittant fault due to the code accessing
        the memory of an unpinned variable.&nbsp;</li>
      <li>Fixed a multithreaded lock-retry bug in in SQLiteConnection.Open() and in
    SQLiteTransaction, which failed to use a command timeout before giving up.</li>
    </ul>

    <p><b>1.0.29.0 - May 16, 2006</b></p>
    <ul>
    <li>Fixed a bug in the Views schema information which caused multi-line view definition statements not to be parsed</li>
    <li>Fixed a parsing bug in SQLiteDataReader.GetSchemaTable() to account for numeric(x,y) datatypes with specified precision and scale</li>
    <li>Fixed a bug in SQLiteConnection.Open() which tried to automatically enlist in an ambient transaction but had not yet set the state of the database to Opened, thereby causing a transaction fault</li>
    <li>Changed SQLiteException to inherit from DbException on the full framework</li>
    </ul>
    <p><b>1.0.28.0 - April 14, 2006</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.5</li>
      <li>You can now specify a relative path in the Compact Framework's "Data Source" by
        prefixing the file with ".\".&nbsp; i.e. "Data Source=.\\mydb.db3"</li>
      <li>Several more changes and enhancements to schemas for better compatibility.</li>
      <li>Fixed several bugs with the 64-bit builds of the provider.&nbsp; The x64 binary
        is now optimized.</li>
      <li>Design-time installer now tries to install the 64-bit builds into the GAC along
        with the 32-bit build.</li>
      <li>Fixed a bug in the SQLiteDataReader.GetSchemaTable() function when used with tables
        containing apostrophes.</li>
      <li>Fixed an XSD-related bug whereby the XSD utility was unable to locate the provider
        and could not generate typed datasets.</li>
      <li>Added NTEXT and STRING datatypes to the list of recognized keywords (used for
        schema retrieval).</li>
      <li>Due to the XSD bug and other potential problems related to external build utilities,
        changes to the installation of the designer have had to be made.&nbsp; The installer
        used to write the DbProviderFactories XML into the devenv.exe.config file and its
        express cousins, but now has to write instead to the machine.config.</li>
      <li>Installer writes to both the 32-bit machine.config and the 64-bit machine.config
        if it exists.&nbsp;</li>
    </ul>
    <p><b>1.0.27.1 - February 28, 2006</b></p>
    <ul>
    <li>Fixed a bug when doing data binding in Compact Framework projects that prevented
      you from assigning a typed dataset to a bindingsource.&nbsp; It turns out, the CF
      version of the SQLite provider needs to be flagged as retargetable so it'll work
      in the design-time desktop environment.&nbsp; No changes were made to the desktop
      build, but the revision was bumped on all libraries anyway in order to keep them
      sync'd.&nbsp;</li></ul>
    <p><b>1.0.27.0 - February 27, 2006</b></p>
    <ul>
    <li>Many optimizations and a few more minor adjustments to schemas and schema retrieval
      performance.</li>
      <li>Lots of design-time attributes added to the code.&nbsp; The DbDataAdapter, DbCommand,
        and DbConnection objects now have greatly enhanced design-time capabilities when
        added to the toolbox and dropped on a form.</li>
      <li>Lots of Server Explorer enhancements.</li>
      <li>Binaries are now distributed in a setup program for easier administration and
        configuration of the provider.</li>
    </ul>
    <p><b>1.0.26.2 - February 15, 2006</b></p>
    <ul>
    <li>Yet another bugfix to index schemas, which was incorrectly marking most indexes
      as primary key indexes.</li><li>Fixed GetSchema() to accept a null string array.</li><li>Fixed a misspelled export in the core C library that prevented databases opened
    with UTF16Encoding from getting schema information and would likely cause an error
    if attempted.</li></ul>
    <p><b>1.0.26.1 - February 14, 2006</b></p>
    <ul>
    <li>Fixed even more minor schema bugs having to do with indexes.</li><li>Added two missing pieces in the SQLite designer which were preventing it from
    being used from within VS Express editions.&nbsp;</li><li>Several bugfixes to the design-time installer program, including supporting
    64-bit environments.</li></ul>
    <p><b>1.0.26.0 - February 11, 2006</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.4</li><li>Fixed an encryption bug when changing the password of databases over 1gb in
      size.&nbsp;</li><li>Fixed various designer issues related to construction of named parameters.&nbsp;</li><li>Retooled the GetSchema() method of SQLiteDataReader to use the new 3.3.4 API functions,
        and made several enhancements and fixes to schemas.&nbsp;</li>
      <li>Implemented the SourceColumnNullMapping property of SQLiteParameter to fix
    a DbCommandBuilder code generation bug.&nbsp;</li>
      <li>Removed the runtime dependency on MSVCR80.DLL.&nbsp; File size is somewhat
    larger for the varying desktop versions, but the Compact Framework version remains
    the same.</li><li>Created an install program to manage installation and uninstallation of the
    SQLite design-time support.</li>
      <li>Designer support now works for all Visual Studio editions, including all Express
        Editions.</li>
      <li>Design-time installer will now remove (if present) the machine.config SQLite entries
        in favor of installing the xml code into the devenv.exe.config file (or any of the
        variations for express editions).&nbsp; The officially-accepted behavior of using
        DbProviderFactories is to add the code to your app.config file, and the machine.config
        file should not be touched.</li>
    </ul>
    <p><b>1.0.25.0 - January 31, 2006</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.3</li><li>Added automatic distributed transaction enlistment and implemented the DbConnection.EnlistTransaction
    method for manual enlistment.</li>
      <li>Nested transactions are now supported.</li>
      <li>Rearranged the timing of SetPassword(), which now must be called before the database
        is opened instead of afterwards.&nbsp; Optionally, the password can be supplied
        in the ConnectionString.</li>
      <li>Fixed a bug in SQLiteFunction that caused a failure when an empty resultset was
        returned and a custom user aggregate function was used in the query.</li>
      <li>The designer has had another round of cleanup applied, in preparation for moving
        to a VS package.</li>
      <li>Added SQLiteMetaDataCollectionNames class.</li>
    </ul>
    <p><b>1.0.24.6 beta - January 23, 2006</b></p>
    <ul>
    <li>This beta is built from sqlite.org's 3.3.2 beta.</li><li>Eliminated the static linking of mscoree from all binaries.&nbsp; Native projects
      can now use the library without any dependencies on the .NET framework, while managed
      projects continue to be able to use the library normally.</li></ul>
    <p><b>1.0.24.5 beta - January 20, 2006</b></p>
    <ul>
    <li>This beta is built from sqlite.org's 3.3.1 alpha and contains development-in-progress code.&nbsp; Therefore no guarantees
      can be made regarding its suitability for production use.</li>
    <li><strong>You no longer need to distribute 2 files on the CompactFramework.&nbsp;
      You can delete SQLite.Interop.DLL entirely.&nbsp; </strong>I wrote a custom tool
      called "mergebin" (available in the source zip file) which combines the two libraries
      and gets around a glaring defect in the VS2005 linker for ARM processors which doesn't
      allow you to link netmodules.</li>
      <li><strong>x64 and ia64 builds now use the same strong name as the x86 build.</strong>&nbsp;
        This means breaking backward compatibility, but it was necessary in order to allow
        you to drop any of those 3 builds onto a PC and have your .NET program run properly.&nbsp;
        Prior to this, you'd get an error if you built your program using the x86 build,
        and then installed the x64 version on a target machine and tried to run your program
        against it.</li>
      <li>The entire source project has been gone over top to bottom.&nbsp; A debug build
        no longer combines the binaries into a single module, which was preventing proper
        debugging.</li></ul>
    <p><b>1.0.24.4 beta - January 16, 2006</b></p>
    <ul>
    <li>This beta is built from sqlite.org's 3.3.1 alpha and contains development-in-progress code.&nbsp; Therefore no guarantees
      can be made regarding its suitability for production use.</li>
    <li>Fixed a bug in the UTF-16 handling code for preparing statements due to a behavioral
      change in SQLite 3.3.0.</li>
      <li>Added pager.c code necessary to cleanup after an encrypted file is closed.</li>
      <li>Fixed an encryption bug that caused a fault when an encrypted file was rolled
        back.</li>
      <li>Modified the testcase code to take advantage of optimizations regarding the use
        of a DbCommandBuilder.&nbsp; DataAdapter insert speed increased dramatically as
        a result.</li>
    </ul>
    <p><b>1.0.24.3 beta - January 10, 2006</b></p>
    <ul>
    <li>This beta is built from sqlite.org's CVS HEAD (as it appeared at of the date of
      this beta) and contains development-in-progress code.&nbsp; Therefore no guarantees
      can be made regarding its suitability for production use.</li><li>Added support for database encryption at the pager level.&nbsp; Databases
    are encrypted using a 128-bit RC4 stream algorithm.&nbsp; To open an existing encrypted
    database, you may now specify a "Password={password}" text in the ConnectionString,
    or you may call the SQLiteConnection.SetPassword() function to set the password
    on an open connection. &nbsp;To encrypt existing non-encrypted databases or to change
    the password on an encrypted database, you must use the SQLiteConnection.ChangePassword()
    function.&nbsp; If you use SetPassword() instead of specifying a password in the
    connection string, or call ChangePassword() you may use a binary byte array or a
    text string as the password.</li>
      <li>Rewrote the locking implementation for the Compact Framework.&nbsp; It is now
        more robust and incorporates into the SQLite codebase more efficiently than the
        previous CE adaptation.</li>
      <li>Moved some of the embedded schema XML data into a resource file to ease code readability.</li>
      <li>Automated the fixup of the original sqlite codebase's source prior to compiling,
        to ease merging with sqlite.org's source.&nbsp;</li>
    </ul>
    <p><b>1.0.24.2 - December 30, 2005</b></p>
    <ul>
    <li>Fixed the SQLiteDataReader.HasRows property to return the proper value.</li>
      <li>Implemented the inadvertently neglected RecordsAffected property on SQLiteDataReader.
      </li>
      <li>SQLiteFunction static constructor was changed to pre-filter classes with only the
        SQLiteFunctionAttribute.&nbsp; The code was throwing an exception when certain
        assemblies were referenced in a project. </li>
      <li>Fixed the SQLiteDataAdapter OnRowUpdated event, which was using the wrong variable
        to find the attached event handler and subsequently not raising the event.</li>
      <li>Small optimizations and fixes to SQLiteDataReader.NextResult().&nbsp;</li>
    </ul>
    <p><b>1.0.24.1 - December 19, 2005</b></p>
    <ul>
    <li>Update core SQLite engine to 3.2.8&nbsp;</li></ul>
    <p><b>1.0.24 - December 9, 2005</b></p>
    <ul>
    <li>Fixed the<em> Catalogs</em> schema bug that caused attached databases not to be re-attached to a cloned connection
    </li>
      <li>Enhanced transactions to allow for a deferred or immediate writelock. &nbsp;SQLiteConnection.BeginTransaction()
        now has an additional overload to support it </li>
      <li>Commands are now prepared as they are executed instead of beforehand.&nbsp; This
      fixes a bug whereby a multi-statement command that alters the database and subsequently
      references the altered data would fail during Prepare().</li><li>Tightened up the SQLiteDataReader to prevent reading columns before calling
    the first Read() and to prevent reading columns after the last Read().</li>
      <li>A more descriptive error is thrown if there aren't enough parameters in the command
        to satisfy the parameters required by the statement(s).&nbsp;</li>
    </ul>
    <p><b>1.0.23 - November 21, 2005</b></p>
    <ul>
    <li>Named parameters may now begin with <strong>@</strong> to ease portability of
      the provider. SQLite's named parameters are ordinarily prefixed with a <strong>: </strong>
      or<strong> $</strong>.&nbsp; The designer will still use the <strong>$</strong>
      prefix however, since its more compatible with the default SQLite engine.</li><li>Added several alternate ISO8601 date/time formats to SQLiteConvert.cs to increase
    compatibility.</li>
      <li>Relaxed coersion restrictions to work better with SQLite's inherent typelessenss.&nbsp;</li>
    </ul>
    <p><b>1.0.22 - November 11, 2005</b></p>
    <UL>
    <li>Fixed some globalization issues which resulted in incorrect case-insensitive comparisons</li>
      <li>Fixed a bug in the routine that finds all user-defined functions in a loaded assembly.&nbsp;
        It would throw an exception if any of the types in the assembly could not be loaded.&nbsp;
        The exception is now caught and handled appropriately.</li>
    </UL>
    <p><b>1.0.21 - November 4, 2005</b></p>
    <UL>
      <li>Fixed a designer bug when creating typed datasets with parameterized queries.
      </li><li>The above fix then exposed another bug in the datareader's ability to query
    schema information on parameterized commands, which was also fixed. </li>
      <li>Compiled against the RTM version of VS2005. </li>
      <li>Rewrote the design-time install script to use the XML DOM objects when writing
        to the machine.config and to automatically register the DLL in the GAC.</li>
      <LI>Made changes to the app.config descriptions and help file to improve version-independent
        factory support.&nbsp; </li>
    </UL>
      <P><STRONG>1.0.20 - October 19, 2005</STRONG></P>
      <UL>
        <LI>
        Fixed a shortcut in SQLiteBase.GetValue which was insufficient for international environments.  The shortcut was removed and the "proper" procedure put in.
        </UL>
      <P><STRONG>1.0.19 - October 5, 2005</STRONG></P>
      <UL>
        <LI>
        Code merge with SQLite 3.2.7
        <LI>
        Fixed bugs in the CE port code (os_wince.c)&nbsp;which were brought to 
        light&nbsp;by&nbsp;recent changes in the SQLite engine.
        <LI>
          Recompiled and modified to be compatible with the September VS2005 Release 
          Candidate.<BR>
          Beta 2 users should continue to use 1.0.18.1</LI></UL>
      <P><STRONG>1.0.18.1 - September 19, 2005</STRONG></P>
      <UL>
        <LI>
          Code merge with SQLite 3.2.6</LI></UL>
      <P><STRONG>1.0.18 - September 1, 2005</STRONG></P>
      <UL>
        <li>
          Added type-specific method calls when using the various SQLite classes that 
          would've normally returned a a generic Db base class, which aligns the code 
          better with the Microsoft-supplied data providers.</li></UL>
      <p><b>1.0.17 - August 26, 2005</b></p>
      <ul>
        <li>
        Code merge with SQLite 3.2.5
        <li>
        Added Itanium and x64 build settings to the project (needs testing)
        <li>
        Bugfixes and enhancements to several schema types
        <li>
        Additional design-time support to include index and foreign key 
        enumerations.&nbsp; Requires re-registering the designer using 
        INSTALL.CMD.&nbsp; The new designer code now allows the VS query designer and 
        typed datasets to automatically link up foreign keys, use indexes, and 
        automatically generate relationships from the schema.<li>
          Additional static methods on SQLiteConnection to create a database file, 
          encrypt a file using the Encrypted File System (EFS) on NTFS (requires NT 2K or 
          above) and NTFS file compression</li>
      </ul>
      <p><b>1.0.16 - August 24, 2005</b></p>
      <ul>
        <li>
        Code merge with SQLite 3.2.4 with the large delete bugfix in CVS (which will 
        become 3.2.5 soon)
        <li>
          Added new GetSchema() types: IndexColumns, ViewColumns, ForeignKeys</li>
      </ul>
      <p><b>1.0.15 - August 22, 2005</b><br>
      </p>
      <ul>
        <li>
        Code merge with SQLite 3.2.3
        <LI>
          Minor updates for better design-time experience. More design-time code to 
          follow in subsequent releases.</LI>
      </ul>
      <p><b>1.0.14 - August 16, 2005</b><br>
      </p>
      <ul>
        <li>
        Fixed a bug in the SQLiteDataAdapter due to insufficient implementation of the 
        class.&nbsp; The RowUpdating and RowUpdated events are now properly 
        implemented, but unfortunately inserting and updating data in a DataTable or 
        DataSet is now much slower.&nbsp; This is the proper design however, so the 
        changes are here to stay.
        <LI>
        Lots of schema changes to support Visual Studio's Data Designer architecture.<li>Added 
          Designer support for the provider.&nbsp; It's not 100%, but you can design 
          queries, add typed datasets and perform quite a number of tasks all within 
          Visual Studio now.</li></ul>
      <P><B>1.0.13 - August 8, 2005</B><BR>
      </P>
      <DIV>
        <UL>
          <LI>
          Fixed a named parameter bug in the base SQLite_UTF16 class, which of course 
          only showed up when a database connection was opened using the 
          UseUTF16Encoding=True parameter.
          <LI>
            Fixed a performance issue in SQLite_UTF16 involving string marshaling.</LI></UL>
      </DIV>
      <P><B>1.0.12 - August 5, 2005</B><BR>
      </P>
      <DIV>
        <UL>
          <LI>
            Full support for the Compact Framework.&nbsp; Each build (Debug/Release) now 
            has a&nbsp;platform, either Win32 or Compact Framework.&nbsp; The correct 
            projects are built accordingly.&nbsp; See the&nbsp;<A href="#redist">Distributing 
              SQLite</A>
          section for information on what files need to be distributed for each 
          platform.&nbsp;
          <LI>
          Modified SQLite3.Reset() and Step() functions to transparently handle timeouts 
          while waiting on the database to become available (typically when a writer is 
          waiting on a reader to finish, or a reader is waiting on a writer to finish).
          <LI>
          Lots of code cleanup&nbsp;as suggested&nbsp;by the Code Analyzer (FxCop).
          <LI>
          Lots of updates to the helpfile (as you can see).
          <LI>
            Statements&nbsp;were already prepared lazily&nbsp;in a SQLiteCommand, but now 
            its even more lazy.&nbsp; Statements are now only prepared if the statements 
            haven't been previously prepared and a Prepare() function is called (and the 
            command is associated with a connection) or just prior to the command being 
            executed.&nbsp;</LI></UL>
      </DIV>
      <P><B>1.0.11 - August 1, 2005</B><BR>
      </P>
      <UL>
        <LI>
          <STRONG>For everything except the Compact Framework, System.Data.SQLite.DLL is 
            now the <EM>only</EM> DLL required to use this provider!</STRONG>&nbsp; The 
        assembly is now a multi-module assembly, containing both the native SQLite3 
        codebase and the C# classes built on top of it.&nbsp; The Compact Framework 
        version (when completed) will not be able to support this feature, so backwards 
        compatibility with the Compact Framework has been preserved for the future.
        <LI>
          Fixed a bug in SQLiteCommand.ExecuteScalar() that caused it to stop executing 
          commands once it obtained the first column of the first row-returning 
          resultset.&nbsp; Any remaining statements after the row-returning statement was 
          ignored.
        </LI>
      </UL>
      <P><B>1.0.10 - June 10, 2005</B><BR>
      </P>
      <UL>
        <LI>
        Fixed a bug in the SQLite3.cs Prepare() function that created a statement even 
        when the SQLite engine returned a NULL pointer. Typically this occurs when 
        multiple statements are processed and there are trailing comments at the end of 
        the statement.
        <LI>
          Fixed a bug in SQLiteStatement.cs that retrieved parameter names for a 
          parameterized query.&nbsp; SQLite's parameters are 1-based, and the function 
          was starting at 0.&nbsp; This was fine when all parameters were unnamed, but 
          for named parameters it caused the parameters to be out of whack.
        </LI>
      </UL>
      <P><B>1.0.09a - May 25, 2005</B><BR>
      </P>
      <UL>
        <LI>
        Fixed a broken helpfile and corrected some obsolete help remarks in 
        SQLiteFunction.cs
        <LI>
          Added a version resource to the SQLite.Interop.DLL.&nbsp;</LI></UL>
      <P><B>1.0.09 - May 24, 2005</B><BR>
      </P>
      <UL>
        <LI>
        Code merge with the latest 3.21 version of SQLite.
        <LI>
          Removed obsolete methods and properties for Whidbey Beta 2</LI></UL>
      <P><B>1.0.08 Refresh - Mar 24, 2005<BR>
        </B>
      </P>
      <UL>
        <LI>
        Code merge with the latest 3.20 version of SQLite.
        <LI>
          Recompiled the help file to fix a build error in it.
        </LI>
      </UL>
      <P><B>1.0.08 - Mar 11, 2005<BR>
        </B>
      </P>
      <UL>
        <LI>
        Added additional #if statements to support the old beta 1 edition of VS2005.
        <LI>
          Code merged the SQLite 3.14 source.
        </LI>
      </UL>
      <P><B>1.0.07 - Mar 5, 2005</B><BR>
      </P>
      <UL>
        <LI>
        Made more optimizations to frequently-called functions, resulting in 
        significant performance gains in all tests.
        <LI>
          Recompiled the binaries using the latest VS2005 February CTP, resulting in yet 
          more significant speed gains.&nbsp; The 100k insert test used to take 3.5 
          seconds and the insertwithidentity took almost 8 seconds.&nbsp; With the above 
          two changes, those tests are now executing in 1.9 and 4.9 seconds respectively.</LI></UL>
      <P><B>1.0.06 - Mar 1, 2005<BR>
        </B>
      </P>
      <UL>
        <LI>
        Speed-ups to SQLiteDataReader.&nbsp; It was interop'ing unnecessarily every 
        time it tried to fetch a field due to a logic error.
        <LI>
        Changed/Added some code to SQLiteConvert's internal DbType, Type and 
        TypeAffinity functions.
        <LI>
        Fixed the SQLiteDataReader to obey the flags set in the optional 
        CommandBehavior flag from SQLiteCommand.ExecuteReader().
        <LI>
        Changed the default page size to 1024 to reflect the defaults of SQLite.&nbsp; 
        Ignores the "Page Size" connection string option for memory databases, as tests 
        revealed that changing it resulted in memory corruption errors.
        <LI>
          Performance enhancements to the SQLiteCommand and SQLiteStatement classes which 
          reduced the 100,000 row insert execution time as well as the various Function 
          execution times significantly.
        </LI>
      </UL>
      <P><B>1.0.05 - Feb 25, 2005</B>
      </P>
      <UL>
        <LI>
        Fixed the SQLite3 C# class step/reset functions to accomodate schema changes 
        that invalidate a prepared statement.&nbsp; Statements are recompiled 
        transparently.
        <LI>
        Moved all native DLL declarations to an UnsafeNativeMethods class.
        <LI>
        Split several classes into their own modules for readability.
        <LI>
        Renamed many internal variables, reviewed access to variables marked as 
        internal and altered their protection levels accordingly.
        <LI>
        Due to the presence of the altered sqlite3 codebase and so many added interop 
        functions, I decided to rename the sqlite3 C project and the DLL to 
        SQLite.Interop.DLL.&nbsp; This is the same core sqlite3 codebase but designed 
        specifically for this ADO.NET provider.&nbsp; This eliminates any possibility 
        of someone dropping another build of sqlite3.dll into the system and rendering 
        the provider inoperable.&nbsp; In the future if the folks at sqlite.org finally 
        introduce a method of retrieving column usage for an arbitrary prepared 
        statement, I'll retool this library to be a lightweight function call wrapper 
        around the core binary distribution.
        <LI>
        Added [SuppressUnmanagedCodeSecurity] attribute to the UnsafeNativeMethods 
        class which brings VS2005 November CTP execution speeds inline with the 
        December CTP.
        <LI>
          Added a <B>bin</B>
        directory to the project root where pre-compiled binaries can be found.
        <LI>
          Added a <B>doc</B>
        directory where preliminary documentation on the class library can be found.
        <LI>
          Documented a lot more of the classes internally.
        </LI>
      </UL>
      <P><B>1.0.04 - Feb 24, 2005</B>
      </P>
      <UL>
        <LI>
        Removed the SQLiteContext class and revamped the way UserFunctions work to 
        simplify the imlementation.
        <LI>
        Fixed a counting bug in the TestCases class, specifically in the function tests 
        where I wasn't resetting the counter and it was consequently reporting 
        intrinsic and raw select calls as being much much faster than they actually 
        were.&nbsp; The numbers are now much closer to what I expected for performance, 
        with .NET user-functions still being the slowest, but only by a small margin.
        <LI>
        Small performance tweaks to SQLiteDataReader.
        <LI>
        Added PageSize to the SQLiteConnectionStringBuilder and subsequently to the 
        SQLiteConnection
        <LI>
          Added a PRAGMA encoding=XXX execution statement to the SQLiteConnection after 
          opening a connection.
        </LI>
      </UL>
      <P><B>1.0.03 - Feb 23, 2005</B>
      </P>
      <UL>
        <LI>
        Fixed up SQLiteCommandBuilder to correct implementation errors, which resulted 
        in an enormous performance boost in the InsertMany test.&nbsp;&nbsp; 10,000 row 
        insert that executed in 1500ms now executes in 500ms.
        <LI>
        Fixed several errors in the SQLite3_UTF16 class.&nbsp; ToString() was working 
        incorrectly and the Open() method failed to register user defined functions and 
        collations.
        <LI>
        Fixed a bug in SQLiteCommand.ClearCommands() whereby only the first statement 
        was being properly cleaned up.
        <LI>
        Fixed a bug in SQLiteDataReader whereby calling NextResult() would not properly 
        reset the previously-executed command in the sequence.
        <LI>
          Added an InsertManyWithIdentityFetch test, which appends a select clause to 
          populate the ID of the last inserted row into the InsertCommand, demonstrating 
          ADO.NET's ability to auto-fetch identity columns on insert.
        </LI>
      </UL>
      <P><B>1.0.02 - Feb 21, 2005</B></P>
      <UL>
        <LI>
        Tweaks to the xxx_interop functions that return char *'s, so they also return 
        the length.&nbsp; Saves an interop call to get the UTF-8 string length during 
        conversion to a .NET string.
        <LI>
        Reworked the whole interop.c thing into interop.h and reduced the code required 
        to merge the main sqlite3 codebase.
        <LI>
          Added support for user-defined collations.
        </LI>
      </UL>
      <hr />
      <div id="footer">
        <p>
          <a href="mailto:robert@blackcastlesoft.com?subject=SQLite.NET%20Class%20Library%20Documentation%20Feedback:%20Version%20History">
            Send comments on this topic.</a>
        </p>
        <p>
        </p>
      </div>
    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted Doc/Extra/welcome.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<html dir="LTR" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:MSHelp="http://msdn.microsoft.com/mshelp" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:ndoc="urn:ndoc-preprocess">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <title>Introduction</title>
    <link rel="stylesheet" type="text/css" href="ndoc.css"> </link>
    <link rel="stylesheet" type="text/css" href="user.css"> </link>
    <script type="text/javascript" src="ndoc.js"> </script>
  </head>
  <body style="display: none;">
    <input type="hidden" id="userDataCache" class="userDataStyle" />
    <input type="hidden" id="hiddenScrollOffset" />
    <img id="dropDownImage" style="display:none; height:0; width:0;" src="drpdown.gif" />
    <img id="dropDownHoverImage" style="display:none; height:0; width:0;" src="drpdown_orange.gif" />
    <img id="collapseImage" style="display:none; height:0; width:0;" src="collapse.gif" />
    <img id="expandImage" style="display:none; height:0; width:0;" src="exp.gif" />
    <img id="collapseAllImage" style="display:none; height:0; width:0;" src="collall.gif" />
    <img id="expandAllImage" style="display:none; height:0; width:0;" src="expall.gif" />
    <img id="copyImage" style="display:none; height:0; width:0;" src="copycode.gif" />
    <img id="copyHoverImage" style="display:none; height:0; width:0;" src="copycodeHighlight.gif" />
    <div id="header">
      <table width="100%" id="topTable">
        <tr id="headerTableRow1">
          <td align="left">
            <span id="runningHeaderText">SQLite ADO.NET 2.0 Provider</span>
          </td>
        </tr>
        <tr id="headerTableRow2">
          <td align="left">
            <span id="nsrTitle">SQLite.NET Class Library Documentation</span>
          </td>
        </tr>
        <tr id="headerTableRow3" style="display:none">
          <td>
            <a id="seeAlsoSectionLink" href="#seeAlsoToggle" onclick="OpenSection(seeAlsoToggle)">See Also</a>
            <a id="exampleSectionLink" href="#codeExampleToggle" onclick="OpenSection(codeExampleToggle)">Example</a>
          </td>
        </tr>
     </table>
      <table width="100%" id="bottomTable" cellspacing="0" cellpadding="0" style="display:none">
        <tr>
          <td>
            <span onclick="ExpandCollapseAll(toggleAllImage)" style="cursor:default;" onkeypress="ExpandCollapseAll_CheckKey(toggleAllImage)" tabindex="0">
              <img ID="toggleAllImage" class="toggleAll" src="collall.gif" />
              <label id="collapseAllLabel" for="toggleAllImage" style="display: none;">
							Collapse All
						</label>
              <label id="expandAllLabel" for="toggleAllImage" style="display: none;">
							Expand All
						</label>
            </span>
          </td>
        </tr>
      </table>
    </div>
    <div id="mainSection">
    <div id="mainBody">
      <h1 class="heading">About SQLite.NET</h1>
      <p>This class library is an ADO.NET 2.0 wrapper around the popular (and free!) 
        SQLite database engine. For information on SQL syntax, features of SQLite and a 
        good understanding of how it works and what it does, I highly recommend heading 
        over to <a target="_blank" href="http://www.sqlite.org">sqlite.org</a> and 
        reading the documentation there.</p>
      <P>The C# provider, the very minor C code modifications to SQLite, documentation and 
        etc&nbsp;were written by <A href="mailto:robert@blackcastlesoft.com">Robert 
          Simpson</A>, and the SourceForge project page can be found <A target="_blank" href="http://sourceforge.net/projects/sqlite-dotnet2">
          here</A>.</P>
      <DIV>
        <br>
      </DIV>
      <h1 class="heading">What's New?</h1>
      <p><a href="version.html">Click here to see the version history of this SQLite.NET 
          provider</a></p>
      <DIV>
        <br>
      </DIV>
      <h1 class="heading">Using this library</h1>
      <p>The following are links to information on various aspects of the library and 
        how to use it in your application(s)
      </p>
      <p><a href="designer.html">How to install&nbsp;Visual Studio Design-Time Support</a></p>
      <P><A href="dbfactorysupport.html">How to configure and enumerate SQLite.NET 
          through the DbProviderFactories object</A></P>
      <p><a href="optimizing.html">Getting the best performance out of SQLite</a></p>
      <p><a href="limitations.html">Limitations of the SQLite.NET provider and the SQLite 
          engine (compared to other providers and engines)</a></p>
      <br>
      <h1 class="heading">SQLite.NET Provider Features</h1>
      <p>This SQLite provider implements every feature of the underlying SQLite 
        database engine without omission. Here's a brief summary:</p>
      <UL>
        <LI>
        Written from scratch on VS2005/2008 specifically for ADO.NET 2.0, implenting all the
        base classes and features recently introduced in the framework, including automatic
        transaction enlistment.<li>Supports the Full and Compact .NET Framework, as well as
          native C/C++ development.&nbsp; 100% binary compatible with the original sqlite3.dll.</li>
        <li>Full support for Mono via a &quot;managed only&quot; provider that runs against the 
          official SQLite 3.6.1 or higher library.</li>
        <li>Full Entity Framework support (ADO.NET 3.5 SP1)</li>
        <li>
        On the Compact Framework, it is faster than Sql Server Mobile.
          SQLite's installed size is a fraction of Sql Mobile's. It uses less memory at runtime,
          runs queries faster, and has a smaller database file size as well. </li>
        <li>Encrypted database support.&nbsp; Encrypted databases are fully encrypted and
          support both binary and cleartext password types. </li>
        <li>Visual Studio 2005/2008 Design-Time Support.&nbsp; You can add a SQLite 
        database to the Servers list, design queries with the Query Designer, 
        drag-and-drop tables onto a Typed DataSet, etc.</li>
            <li>Full SQLite schema editing inside Visual Studio.&nbsp; You can create/edit 
              tables, views, triggers, indexes, check constraints and foreign keys. </li>
        <li>
        Single file redistributable (except Compact Framework).&nbsp; The core sqlite3 codebase and the ADO.NET wrapper 
        are combined into one multi-module assembly. </li>
        <li>Binaries included for Itanium, x64, x86 and ARM processors. </li>
        <li>
        DbProviderFactory support. </li>
        <li>
          Full support for ATTACH'ed databases.&nbsp; Exposed as <i>Catalogs</i>
        in the schema.&nbsp; When cloning a connection, all attached databases are 
        automatically re-attached to the new connection. </li>
        <li>
          DbConnection.GetSchema(...) support includes the <i>MetaDataCollections</i>, <i>
          DataSourceInformation</i>, <i>Columns</i>, <i>Tables</i>, <i>Views, ViewColumns, </i>
          <i>Catalogs, </i><i>Indexes, 
            IndexColumns, ForeignKeys </i>and <em>Triggers</em>.
        </li>
        <li>
        Enhanced DbDataReader.GetSchemaTable() functionality returns catalog, namespace 
        and detailed schema information even for complex queries. </li>
        <li>
        Named and unnamed parameters. </li>
        <li>
        Full UTF-8 and UTF-16 support, each with optimized pipelines into the native 
        database core. </li>
        <li>
        Multiple simultaneous DataReaders (one DataReader per Command however). </li>
        <li>
        Full support for user-defined scalar and aggregate functions, encapsulated into 
        an easy-to-use base class in which only a couple of overrides are necessary to 
        implement new SQL functions. </li>
        <li>
        Full support for user-defined collating sequences, every bit as simple to 
        implement as user-defined functions and uses the same base class. </li>
        <li>
          Full source for the entire engine and wrapper.&nbsp; No copyrights.&nbsp; 
          Public Domain.&nbsp; 100% free for commercial and non-commercial use.&nbsp;</li>
      </UL>
      <br>
      <h1 class="heading">Distributing the Binaries (Desktop)</h1>
      <p><b>System.Data.SQLite.DLL</b> is a mixed assembly signed with a strong name 
        in case you want to add it to the Global Assembly Cache (GAC). This is the only DLL required to be redistributed with 
        your SQLite.NET application(s).&nbsp; It 
        comes in&nbsp;3
        flavors: Win32, Itanium and x64 (AMD64).</p>
      <h1 class="heading">Distributing the Binaries (Compact Framework)</h1>
      <p><b>System.Data.SQLite.DLL </b>and <b>SQLite.Interop.XXX.DLL</b> must be 
        deployed on the Compact Framework.&nbsp; The XXX is the build number of the 
        System.Data.SQLite library (e.g. &quot;059&quot;).&nbsp; SQLite.Interop.XXX is a fully 
        native assembly compiled for the ARM processor, and System.Data.SQLite is the 
        fully-managed Compact Framework assembly.</p>
      <hr />
      <div id="footer">
        <p>
          <a href="mailto:robert@blackcastlesoft.com?subject=SQLite%20ADO.NET%202.0%20Provider%201.0.0.0%20Documentation%20Feedback:%20Welcome">
          Send comments on this topic.<!--[if gte IE 5]><tool:tip element="seeAlsoToolTip" avoidmouse="false" /><tool:tip element="languageFilterToolTip" avoidmouse="false" /><![endif]-->    </div>
    </div>
  </body>
</html>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































Changes to Doc/SQLite.NET.chm.

cannot compute difference between binary files

Added Doc/SQLite.NET.hhc.

































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<meta name="GENERATOR" content="Microsoft&reg; HTML Help Workshop 4.1">
<!-- Sitemap 1.0 -->
</HEAD><BODY>
<UL>
	<LI> <OBJECT type="text/sitemap">
		<param name="Name" value="Introduction to System.Data.SQLite">
		<param name="Local" value="Provider/welcome.html">
		</OBJECT>
	<UL>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Installing Design-Time Support">
			<param name="Local" value="Provider/designer.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Using DbProviderFactories">
			<param name="Local" value="Provider/dbfactorysupport.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Environment Variables">
			<param name="Local" value="Provider/environment.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Optimizing SQL Queries">
			<param name="Local" value="Provider/optimizing.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Provider Limitations">
			<param name="Local" value="Provider/limitations.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Syntax Reference">
			<param name="Local" value="Provider/syntax.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="TYPES">
			<param name="Local" value="Provider/lang_types.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Version History">
			<param name="Local" value="Provider/version.html">
			</OBJECT>
	</UL>
	<LI> <OBJECT type="text/sitemap">
		<param name="Name" value="Query Language Understood By SQLite">
		<param name="Local" value="Core/lang.html">
		</OBJECT>
	<UL>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="JSON Functions And Operators">
			<param name="Local" value="Core/json1.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Aggregate Functions">
			<param name="Local" value="Core/lang_aggfunc.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="ALTER TABLE">
			<param name="Local" value="Core/lang_altertable.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="ANALYZE">
			<param name="Local" value="Core/lang_analyze.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="ATTACH DATABASE">
			<param name="Local" value="Core/lang_attach.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Comments">
			<param name="Local" value="Core/lang_comment.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="ON CONFLICT">
			<param name="Local" value="Core/lang_conflict.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Core Functions">
			<param name="Local" value="Core/lang_corefunc.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="CREATE INDEX">
			<param name="Local" value="Core/lang_createindex.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="CREATE TABLE">
			<param name="Local" value="Core/lang_createtable.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="CREATE TRIGGER">
			<param name="Local" value="Core/lang_createtrigger.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="CREATE VIEW">
			<param name="Local" value="Core/lang_createview.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="CREATE VIRTUAL TABLE">
			<param name="Local" value="Core/lang_createvtab.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Date And Time Functions">
			<param name="Local" value="Core/lang_datefunc.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="DELETE">
			<param name="Local" value="Core/lang_delete.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="DETACH DATABASE">
			<param name="Local" value="Core/lang_detach.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="DROP INDEX">
			<param name="Local" value="Core/lang_dropindex.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="DROP TABLE">
			<param name="Local" value="Core/lang_droptable.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="DROP TRIGGER">
			<param name="Local" value="Core/lang_droptrigger.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="DROP VIEW">
			<param name="Local" value="Core/lang_dropview.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="EXPLAIN">
			<param name="Local" value="Core/lang_explain.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Expressions">
			<param name="Local" value="Core/lang_expr.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="INDEXED BY">
			<param name="Local" value="Core/lang_indexedby.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="INSERT">
			<param name="Local" value="Core/lang_insert.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Keywords">
			<param name="Local" value="Core/lang_keywords.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Math Functions">
			<param name="Local" value="Core/lang_mathfunc.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Database Object Name Resolution">
			<param name="Local" value="Core/lang_naming.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="REINDEX">
			<param name="Local" value="Core/lang_reindex.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="REPLACE">
			<param name="Local" value="Core/lang_replace.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="RETURNING">
			<param name="Local" value="Core/lang_returning.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="SAVEPOINT">
			<param name="Local" value="Core/lang_savepoint.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="SELECT">
			<param name="Local" value="Core/lang_select.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="BEGIN TRANSACTION">
			<param name="Local" value="Core/lang_transaction.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="COMMIT TRANSACTION">
			<param name="Local" value="Core/lang_transaction.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="END TRANSACTION">
			<param name="Local" value="Core/lang_transaction.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="ROLLBACK TRANSACTION">
			<param name="Local" value="Core/lang_transaction.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="UPDATE">
			<param name="Local" value="Core/lang_update.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="UPSERT">
			<param name="Local" value="Core/lang_upsert.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="VACUUM">
			<param name="Local" value="Core/lang_vacuum.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="WITH">
			<param name="Local" value="Core/lang_with.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="PRAGMA">
			<param name="Local" value="Core/pragma.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="List of Syntax Diagrams">
			<param name="Local" value="Core/syntax.html">
			</OBJECT>
		<LI> <OBJECT type="text/sitemap">
			<param name="Name" value="Syntax Diagrams">
			<param name="Local" value="Core/syntaxdiagrams.html">
			</OBJECT>
	</UL>
</BODY><HTML>

Added Doc/SQLite.NET.hhp.













































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
[OPTIONS]
Compatibility=1.1 or later
Compiled file=SQLite.NET.extra.chm
Contents file=SQLite.NET.hhc
Default topic=Provider\welcome.html
Display compile progress=Yes
Error log file=SQLite.NET.log
Full-text search=Yes
Language=0x409 English (United States)
Title=SQLite.NET Help

[FILES]
Core\json1.html
Core\lang.html
Core\lang_aggfunc.html
Core\lang_altertable.html
Core\lang_analyze.html
Core\lang_attach.html
Core\lang_comment.html
Core\lang_conflict.html
Core\lang_corefunc.html
Core\lang_createindex.html
Core\lang_createtable.html
Core\lang_createtrigger.html
Core\lang_createview.html
Core\lang_createvtab.html
Core\lang_datefunc.html
Core\lang_delete.html
Core\lang_detach.html
Core\lang_dropindex.html
Core\lang_droptable.html
Core\lang_droptrigger.html
Core\lang_dropview.html
Core\lang_explain.html
Core\lang_expr.html
Core\lang_indexedby.html
Core\lang_insert.html
Core\lang_keywords.html
Core\lang_mathfunc.html
Core\lang_naming.html
Core\lang_reindex.html
Core\lang_replace.html
Core\lang_returning.html
Core\lang_savepoint.html
Core\lang_select.html
Core\lang_transaction.html
Core\lang_update.html
Core\lang_upsert.html
Core\lang_vacuum.html
Core\lang_with.html
Core\pragma.html
Core\sqlite.css
Core\syntax.html
Core\syntaxdiagrams.html
Core\syntax\aggregate-function-invocation.html
Core\syntax\alter-table-stmt.html
Core\syntax\analyze-stmt.html
Core\syntax\attach-stmt.html
Core\syntax\begin-stmt.html
Core\syntax\column-constraint.html
Core\syntax\column-def.html
Core\syntax\column-name-list.html
Core\syntax\comment-syntax.html
Core\syntax\commit-stmt.html
Core\syntax\common-table-expression.html
Core\syntax\compound-operator.html
Core\syntax\compound-select-stmt.html
Core\syntax\conflict-clause.html
Core\syntax\create-index-stmt.html
Core\syntax\create-table-stmt.html
Core\syntax\create-trigger-stmt.html
Core\syntax\create-view-stmt.html
Core\syntax\create-virtual-table-stmt.html
Core\syntax\cte-table-name.html
Core\syntax\delete-stmt-limited.html
Core\syntax\delete-stmt.html
Core\syntax\detach-stmt.html
Core\syntax\drop-index-stmt.html
Core\syntax\drop-table-stmt.html
Core\syntax\drop-trigger-stmt.html
Core\syntax\drop-view-stmt.html
Core\syntax\expr.html
Core\syntax\factored-select-stmt.html
Core\syntax\filter-clause.html
Core\syntax\foreign-key-clause.html
Core\syntax\frame-spec.html
Core\syntax\indexed-column.html
Core\syntax\insert-stmt.html
Core\syntax\join-clause.html
Core\syntax\join-constraint.html
Core\syntax\join-operator.html
Core\syntax\literal-value.html
Core\syntax\numeric-literal.html
Core\syntax\ordering-term.html
Core\syntax\over-clause.html
Core\syntax\pragma-stmt.html
Core\syntax\pragma-value.html
Core\syntax\qualified-table-name.html
Core\syntax\raise-function.html
Core\syntax\recursive-cte.html
Core\syntax\reindex-stmt.html
Core\syntax\release-stmt.html
Core\syntax\result-column.html
Core\syntax\returning-clause.html
Core\syntax\rollback-stmt.html
Core\syntax\savepoint-stmt.html
Core\syntax\select-core.html
Core\syntax\select-stmt.html
Core\syntax\signed-number.html
Core\syntax\simple-function-invocation.html
Core\syntax\simple-select-stmt.html
Core\syntax\sql-stmt-list.html
Core\syntax\sql-stmt.html
Core\syntax\table-constraint.html
Core\syntax\table-options.html
Core\syntax\table-or-subquery.html
Core\syntax\type-name.html
Core\syntax\update-stmt-limited.html
Core\syntax\update-stmt.html
Core\syntax\upsert-clause.html
Core\syntax\vacuum-stmt.html
Core\syntax\window-defn.html
Core\syntax\window-function-invocation.html
Core\syntax\with-clause.html
Include\ndoc.css
Provider\dbfactorysupport.html
Provider\designer.html
Provider\environment.html
Provider\lang_types.html
Provider\limitations.html
Provider\optimizing.html
Provider\syntax.html
Provider\version.html
Provider\welcome.html

Changes to Doc/SQLite.NET.ndoc.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19


20
21
22


23
24
25
26
27
28
29
30
31
32
33
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<project SchemaVersion="2.0">
    <assemblies>
        <assembly location="..\bin\System.Data.SQLite.DLL" documentation="..\bin\System.Data.SQLite.xml" />
    </assemblies>
    <documenters>
        <documenter name="MSDN-Help2">
            <property name="PlugInNamespace" value="ms.vscc" />
            <property name="OutputDirectory" value=".\doc\" />
            <property name="HtmlHelpName" value="Documentation" />
            <property name="Title" value="An NDoc documented library" />
        </documenter>
        <documenter name="MSDN-CHM">
            <property name="IncludeFavorites" value="True" />
            <property name="SdkLinksOnWeb" value="True" />
            <property name="OutputDirectory" value=".\" />
            <property name="HtmlHelpName" value="SQLite.NET" />
            <property name="Title" value="SQLite ADO.NET 2.0 Provider" />
            <property name="Version" value="" />


            <property name="AdditionalContentResourceDirectory" value=".\Extra\" />
            <property name="AssemblyVersionInfo" value="AssemblyVersion" />
            <property name="FeedbackEmailAddress" value="robert@blackcastlesoft.com" />


            <property name="DocumentAttributes" value="False" />
            <property name="IncludeDefaultThreadSafety" value="False" />
        </documenter>
        <documenter name="XML">
            <property name="OutputFile" value=".\doc\doc.xml" />
        </documenter>
        <documenter name="Intellisense">
            <property name="OutputDirectory" value=".\intellisense\" />
        </documenter>
    </documenters>
</project>



|


|
<
<
<
<
<
<


|

|

>
>


|
>
>



<
<
<
<
<
<


1
2
3
4
5
6
7






8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23






24
25
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<project SchemaVersion="2.0">
    <assemblies>
        <assembly location="..\bin\2008\Release\bin\System.Data.SQLite.dll" documentation="..\bin\2008\Release\bin\System.Data.SQLite.xml" />
    </assemblies>
    <documenters>
        <documenter name="MSDN">






            <property name="IncludeFavorites" value="True" />
            <property name="SdkLinksOnWeb" value="True" />
            <property name="OutputDirectory" value=".\Output\" />
            <property name="HtmlHelpName" value="SQLite.NET" />
            <property name="Title" value="SQLite ADO.NET Provider" />
            <property name="Version" value="" />
            <property name="OutputTarget" value="HtmlHelp" />
            <property name="BinaryTOC" value="False" />
            <property name="AdditionalContentResourceDirectory" value=".\Extra\" />
            <property name="AssemblyVersionInfo" value="AssemblyVersion" />
            <property name="FeedbackEmailAddress" value="sqlite-users@mailinglists.sqlite.org" />
            <property name="SdkDocVersion" value="SDK_v3_5" />
            <property name="SdkDocVersionString" value="VS.90" />
            <property name="DocumentAttributes" value="False" />
            <property name="IncludeDefaultThreadSafety" value="False" />
        </documenter>






    </documenters>
</project>

Added Doc/Special/Core/vtab.html.































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
<!DOCTYPE html>
<html><head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link href="sqlite.css" rel="stylesheet">
<title>The Virtual Table Mechanism Of SQLite</title>
<!-- path= -->
</head>
<body>
<div class=nosearch>
<a href="index.html">
<img class="logo" src="images/sqlite370_banner.gif" alt="SQLite" border="0">
</a>
<div><!-- IE hack to prevent disappearing logo --></div>
<div class="tagline desktoponly">
Small. Fast. Reliable.<br>Choose any three.
</div>
<div class="menu mainmenu">
<ul>
<li><a href="index.html">Home</a>
<li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a>
<li class='wideonly'><a href='about.html'>About</a>
<li class='desktoponly'><a href="docs.html">Documentation</a>
<li class='desktoponly'><a href="download.html">Download</a>
<li class='wideonly'><a href='copyright.html'>License</a>
<li class='desktoponly'><a href="support.html">Support</a>
<li class='desktoponly'><a href="prosupport.html">Purchase</a>
<li class='search' id='search_menubutton'>
<a href="javascript:void(0)" onclick='toggle_search()'>Search</a>
</ul>
</div>
<div class="menu submenu" id="submenu">
<ul>
<li><a href='about.html'>About</a>
<li><a href='docs.html'>Documentation</a>
<li><a href='download.html'>Download</a>
<li><a href='support.html'>Support</a>
<li><a href='prosupport.html'>Purchase</a>
</ul>
</div>
<div class="searchmenu" id="searchmenu">
<form method="GET" action="search">
<select name="s" id="searchtype">
<option value="d">Search Documentation</option>
<option value="c">Search Changelog</option>
</select>
<input type="text" name="q" id="searchbox" value="">
<input type="submit" value="Go">
</form>
</div>
</div>
<script>
function toggle_div(nm) {
var w = document.getElementById(nm);
if( w.style.display=="block" ){
w.style.display = "none";
}else{
w.style.display = "block";
}
}
function toggle_search() {
var w = document.getElementById("searchmenu");
if( w.style.display=="block" ){
w.style.display = "none";
} else {
w.style.display = "block";
setTimeout(function(){
document.getElementById("searchbox").focus()
}, 30);
}
}
function div_off(nm){document.getElementById(nm).style.display="none";}
window.onbeforeunload = function(e){div_off("submenu");}
/* Disable the Search feature if we are not operating from CGI, since */
/* Search is accomplished using CGI and will not work without it. */
if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){
document.getElementById("search_menubutton").style.display = "none";
}
/* Used by the Hide/Show button beside syntax diagrams, to toggle the */
function hideorshow(btn,obj){
var x = document.getElementById(obj);
var b = document.getElementById(btn);
if( x.style.display!='none' ){
x.style.display = 'none';
b.innerHTML='show';
}else{
x.style.display = '';
b.innerHTML='hide';
}
return false;
}
var antiRobot = 0;
function antiRobotGo(){
if( antiRobot!=3 ) return;
antiRobot = 7;
var j = document.getElementById("mtimelink");
if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href");
}
function antiRobotDefense(){
document.body.onmousedown=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousedown=null;
}
document.body.onmousemove=function(){
antiRobot |= 2;
antiRobotGo();
document.body.onmousemove=null;
}
setTimeout(function(){
antiRobot |= 1;
antiRobotGo();
}, 100)
antiRobotGo();
}
antiRobotDefense();
</script>
<div class=fancy>
<div class=nosearch>
<div class="fancy_title">
The Virtual Table Mechanism Of SQLite
</div>
<div class="fancy_toc">
<a onclick="toggle_toc()">
<span class="fancy_toc_mark" id="toc_mk">&#x25ba;</span>
Table Of Contents
</a>
<div id="toc_sub"><div class="fancy-toc1"><a href="#introduction">1. Introduction</a></div>
<div class="fancy-toc2"><a href="#usage">1.1. Usage</a></div>
<div class="fancy-toc3"><a href="#temporary_virtual_tables">1.1.1. Temporary virtual tables</a></div>
<div class="fancy-toc3"><a href="#eponymous_virtual_tables">1.1.2. Eponymous virtual tables</a></div>
<div class="fancy-toc3"><a href="#eponymous_only_virtual_tables">1.1.3. Eponymous-only virtual tables</a></div>
<div class="fancy-toc2"><a href="#implementation">1.2. Implementation</a></div>
<div class="fancy-toc2"><a href="#virtual_tables_and_shared_cache">1.3. Virtual Tables And Shared Cache</a></div>
<div class="fancy-toc2"><a href="#creating_new_virtual_table_implementations">1.4. Creating New Virtual Table Implementations</a></div>
<div class="fancy-toc1"><a href="#virtual_table_methods">2. Virtual Table Methods</a></div>
<div class="fancy-toc2"><a href="#the_xcreate_method">2.1. The xCreate Method</a></div>
<div class="fancy-toc3"><a href="#hidden_columns_in_virtual_tables">2.1.1. Hidden columns in virtual tables</a></div>
<div class="fancy-toc3"><a href="#table_valued_functions">2.1.2. Table-valued functions</a></div>
<div class="fancy-toc3"><a href="#_without_rowid_virtual_tables_">2.1.3.  WITHOUT ROWID Virtual Tables </a></div>
<div class="fancy-toc2"><a href="#the_xconnect_method">2.2. The xConnect Method</a></div>
<div class="fancy-toc2"><a href="#the_xbestindex_method">2.3. The xBestIndex Method</a></div>
<div class="fancy-toc3"><a href="#inputs">2.3.1. Inputs</a></div>
<div class="fancy-toc4"><a href="#like_glob_regexp_and_match_functions">2.3.1.1. LIKE, GLOB, REGEXP, and MATCH functions</a></div>
<div class="fancy-toc4"><a href="#limit_and_offset">2.3.1.2. LIMIT and OFFSET</a></div>
<div class="fancy-toc4"><a href="#right_hand_side_values_of_constraints">2.3.1.3. Right-hand side values of constraints</a></div>
<div class="fancy-toc3"><a href="#outputs">2.3.2. Outputs</a></div>
<div class="fancy-toc4"><a href="#omit_constraint_checking_in_bytecode">2.3.2.1. Omit constraint checking in bytecode</a></div>
<div class="fancy-toc4"><a href="#order_by_and_orderbyconsumed">2.3.2.2. ORDER BY and orderByConsumed</a></div>
<div class="fancy-toc3"><a href="#return_value">2.3.3. Return Value</a></div>
<div class="fancy-toc3"><a href="#enforcing_required_parameters_on_table_valued_functions">2.3.4. Enforcing Required Parameters On Table-Valued Functions</a></div>
<div class="fancy-toc2"><a href="#the_xdisconnect_method">2.4. The xDisconnect Method</a></div>
<div class="fancy-toc2"><a href="#the_xdestroy_method">2.5. The xDestroy Method</a></div>
<div class="fancy-toc2"><a href="#the_xopen_method">2.6. The xOpen Method</a></div>
<div class="fancy-toc2"><a href="#the_xclose_method">2.7. The xClose Method</a></div>
<div class="fancy-toc2"><a href="#the_xeof_method">2.8. The xEof Method</a></div>
<div class="fancy-toc2"><a href="#the_xfilter_method">2.9. The xFilter Method</a></div>
<div class="fancy-toc2"><a href="#the_xnext_method">2.10. The xNext Method</a></div>
<div class="fancy-toc2"><a href="#the_xcolumn_method">2.11. The xColumn Method</a></div>
<div class="fancy-toc2"><a href="#the_xrowid_method">2.12. The xRowid Method</a></div>
<div class="fancy-toc2"><a href="#the_xupdate_method">2.13. The xUpdate Method</a></div>
<div class="fancy-toc2"><a href="#the_xfindfunction_method">2.14. The xFindFunction Method</a></div>
<div class="fancy-toc2"><a href="#the_xbegin_method">2.15. The xBegin Method</a></div>
<div class="fancy-toc2"><a href="#the_xsync_method">2.16. The xSync Method</a></div>
<div class="fancy-toc2"><a href="#the_xcommit_method">2.17. The xCommit Method</a></div>
<div class="fancy-toc2"><a href="#the_xrollback_method">2.18. The xRollback Method</a></div>
<div class="fancy-toc2"><a href="#the_xrename_method">2.19. The xRename Method</a></div>
<div class="fancy-toc2"><a href="#the_xsavepoint_xrelease_and_xrollbackto_methods">2.20. The xSavepoint, xRelease, and xRollbackTo Methods</a></div>
<div class="fancy-toc2"><a href="#the_xshadowname_method">2.21. The xShadowName Method</a></div>
<div class="fancy-toc2"><a href="#the_xintegrity_method">2.22. The xIntegrity Method</a></div>
</div>
</div>
<script>
function toggle_toc(){
var sub = document.getElementById("toc_sub")
var mk = document.getElementById("toc_mk")
if( sub.style.display!="block" ){
sub.style.display = "block";
mk.innerHTML = "&#x25bc;";
} else {
sub.style.display = "none";
mk.innerHTML = "&#x25ba;";
}
}
</script>
</div>






<h1 id="introduction"><span>1. </span>Introduction</h1>

<p>A virtual table is an object that is registered with an open SQLite
<a href="c3ref/sqlite3.html">database connection</a>. From the perspective of an SQL statement,
the virtual table object looks like any other table or view. 
But behind the scenes, queries and updates on a virtual table
invoke callback methods of the virtual table object instead of
reading and writing on the database file.

</p><p>The virtual table mechanism allows an application to publish
interfaces that are accessible from SQL statements as if they were
tables. SQL statements can do almost anything to a
virtual table that they can do to a real table, with the following
exceptions:

</p><p>
</p><ul>
<li> One cannot create a trigger on a virtual table.
</li><li> One cannot create additional indices on a virtual table. 
     (Virtual tables can have indices but that must be built into
     the virtual table implementation.  Indices cannot be added
     separately using <a href="lang_createindex.html">CREATE INDEX</a> statements.)
</li><li> One cannot run <a href="lang_altertable.html">ALTER TABLE ... ADD COLUMN</a>
     commands against a virtual table.
</li></ul>

<p>Individual virtual table implementations might impose additional
constraints. For example, some virtual implementations might provide
read-only tables. Or some virtual table implementations might allow
<a href="lang_insert.html">INSERT</a> or <a href="lang_delete.html">DELETE</a> but not <a href="lang_update.html">UPDATE</a>.  Or some virtual table implementations
might limit the kinds of UPDATEs that can be made.

</p><p>A virtual table might represent an in-memory data structures. 
Or it might represent a view of data on disk that is not in the
SQLite format. Or the application might compute the content of the 
virtual table on demand.

</p><p>Here are some existing and postulated uses for virtual tables:

</p><ul>
<li> A <a href="fts3.html">full-text search</a> interface
</li><li> Spatial indices using <a href="rtree.html">R-Trees</a>
</li><li> Introspect the disk content of an SQLite database file
     (the <a href="dbstat.html">dbstat virtual table</a>)
</li><li> Read and/or write the content of a comma-separated value (CSV)
     file
</li><li> Access the filesystem of the host computer as if it were a database table
</li><li> Enabling SQL manipulation of data in statistics packages like R
</li></ul>

<p>See the <a href="vtablist.html">list of virtual tables</a> page for a longer list of actual
virtual table implementations.


</p><h2 id="usage"><span>1.1. </span>Usage</h2>

<p>A virtual table is created using a <a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a> statement.

<p><b><a href="syntax/create-virtual-table-stmt.html">create-virtual-table-stmt:</a></b>
<button id='x94eee4ec' onclick='hideorshow("x94eee4ec","x299a7cc2")'>hide</button></p>
 <div id='x299a7cc2' class='imgcontainer'>
 <div style="max-width:624px"><svg xmlns='http://www.w3.org/2000/svg' class="pikchr" viewBox="0 0 624.096 259.848">
<circle cx="5" cy="17" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,17 20,21 20,12" style="fill:rgb(0,0,0)"/>
<path d="M9,17L26,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M47,32L100,32A15 15 0 0 0 116 17A15 15 0 0 0 100 2L47,2A15 15 0 0 0 32 17A15 15 0 0 0 47 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="74" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">CREATE</text>
<polygon points="139,17 127,21 127,12" style="fill:rgb(0,0,0)"/>
<path d="M116,17L133,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M154,32L213,32A15 15 0 0 0 228 17A15 15 0 0 0 213 2L154,2A15 15 0 0 0 139 17A15 15 0 0 0 154 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="183" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">VIRTUAL</text>
<polygon points="251,17 240,21 240,12" style="fill:rgb(0,0,0)"/>
<path d="M228,17L246,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M266,32L306,32A15 15 0 0 0 321 17A15 15 0 0 0 306 2L266,2A15 15 0 0 0 251 17A15 15 0 0 0 266 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="286" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">TABLE</text>
<polygon points="357,17 345,21 345,12" style="fill:rgb(0,0,0)"/>
<path d="M321,17L351,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M372,32A15 15 0 0 0 387 17A15 15 0 0 0 372 2A15 15 0 0 0 357 17A15 15 0 0 0 372 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="372" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">IF</text>
<polygon points="410,17 399,21 399,12" style="fill:rgb(0,0,0)"/>
<path d="M387,17L404,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M425,32L445,32A15 15 0 0 0 461 17A15 15 0 0 0 445 2L425,2A15 15 0 0 0 410 17A15 15 0 0 0 425 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="435" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">NOT</text>
<polygon points="484,17 472,21 472,12" style="fill:rgb(0,0,0)"/>
<path d="M461,17L478,17"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M499,32L543,32A15 15 0 0 0 558 17A15 15 0 0 0 543 2L499,2A15 15 0 0 0 484 17A15 15 0 0 0 499 32Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="521" y="17" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">EXISTS</text>
<path d="M47,108L143,108A15 15 0 0 0 159 92A15 15 0 0 0 143 77L47,77A15 15 0 0 0 32 92A15 15 0 0 0 47 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="95" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">schema-name</text>
<polygon points="182,92 170,97 170,88" style="fill:rgb(0,0,0)"/>
<path d="M159,92L176,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M197,108A15 15 0 0 0 212 92A15 15 0 0 0 197 77A15 15 0 0 0 182 92A15 15 0 0 0 197 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="197" y="92" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">.</text>
<polygon points="248,92 236,97 236,88" style="fill:rgb(0,0,0)"/>
<path d="M212,92L242,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M263,108L338,108A15 15 0 0 0 353 92A15 15 0 0 0 338 77L263,77A15 15 0 0 0 248 92A15 15 0 0 0 263 108Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="92" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">table-name</text>
<path d="M47,219L86,219A15 15 0 0 0 101 204A15 15 0 0 0 86 189L47,189A15 15 0 0 0 32 204A15 15 0 0 0 47 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="67" y="204" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">USING</text>
<polygon points="124,204 113,209 113,200" style="fill:rgb(0,0,0)"/>
<path d="M101,204L118,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M139,219L234,219A15 15 0 0 0 249 204A15 15 0 0 0 234 189L139,189A15 15 0 0 0 124 204A15 15 0 0 0 139 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="187" y="204" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">module-name</text>
<polygon points="285,204 274,209 274,200" style="fill:rgb(0,0,0)"/>
<path d="M249,204L279,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M300,219A15 15 0 0 0 315 204A15 15 0 0 0 300 189A15 15 0 0 0 285 204A15 15 0 0 0 300 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="300" y="204" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">(</text>
<polygon points="351,204 340,209 340,200" style="fill:rgb(0,0,0)"/>
<path d="M315,204L346,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M366,219L497,219A15 15 0 0 0 512 204A15 15 0 0 0 497 189L366,189A15 15 0 0 0 351 204A15 15 0 0 0 366 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="204" text-anchor="middle" fill="rgb(0,0,0)" dominant-baseline="central">module-argument</text>
<polygon points="548,204 536,209 536,200" style="fill:rgb(0,0,0)"/>
<path d="M512,204L542,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M563,219A15 15 0 0 0 578 204A15 15 0 0 0 563 189A15 15 0 0 0 548 204A15 15 0 0 0 563 219Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="563" y="204" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">)</text>
<polygon points="614,204 603,209 603,200" style="fill:rgb(0,0,0)"/>
<path d="M578,204L608,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<circle cx="618" cy="204" r="3.6"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,257A15 15 0 0 0 447 242A15 15 0 0 0 432 227A15 15 0 0 0 417 242A15 15 0 0 0 432 257Z"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<text x="432" y="242" text-anchor="middle" font-weight="bold" fill="rgb(0,0,0)" dominant-baseline="central">,</text>
<polygon points="447,242 458,238 458,246" style="fill:rgb(0,0,0)"/>
<path d="M512,204 L 519,204 Q 527,204 527,219 L 527,227 Q 527,242 512,242 L 468,242 L 453,242"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M417,242 L 343,242 Q 328,242 328,227 L 328,219 Q 328,204 336,204 L 343,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="432,180 420,184 420,176" style="fill:rgb(0,0,0)"/>
<path d="M249,204 L 257,204 Q 264,204 264,192 Q 264,180 279,180 L 411,180 L 426,180"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M432,180 L 576,180 Q 591,180 591,192 Q 591,204 599,204 L 606,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="187,153 198,149 198,157" style="fill:rgb(0,0,0)"/>
<path d="M353,92 L 361,92 Q 368,92 368,107 L 368,138 Q 368,153 353,153 L 207,153 L 192,153"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,204 20,209 20,200" style="fill:rgb(0,0,0)"/>
<path d="M187,153 L 20,153 Q 5,153 5,168 L 5,189 Q 5,204 16,204 L 26,204"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="429,62 441,58 441,66" style="fill:rgb(0,0,0)"/>
<path d="M558,17 L 566,17 Q 573,17 573,32 L 573,47 Q 573,62 558,62 L 450,62 L 435,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="32,92 20,97 20,88" style="fill:rgb(0,0,0)"/>
<path d="M429,62 L 20,62 Q 5,62 5,77 L 5,77 Q 5,92 16,92 L 26,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="336,47 332,35 340,35" style="fill:rgb(0,0,0)"/>
<path d="M321,17 L 328,17 Q 336,17 336,29 L 336,41"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M336,47 L 336,54 Q 336,62 328,62 L 321,62"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<polygon points="95,123 84,127 84,118" style="fill:rgb(0,0,0)"/>
<path d="M5,77 L 5,108 Q 5,123 20,123 L 74,123 L 89,123"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
<path d="M95,123 L 210,123 Q 225,123 225,108 L 225,107 Q 225,92 231,92 L 236,92"  style="fill:none;stroke-width:2.16;stroke:rgb(0,0,0);" />
</svg>
</div>
</div>


</p><p>The CREATE VIRTUAL TABLE statement creates a new table
called <span class='yyterm'>table-name</span> derived from the class
<span class='yyterm'>module-name</span>.  The <span class='yyterm'>module-name</span>
is the name that is registered for the virtual table by
the <a href="c3ref/create_module.html">sqlite3_create_module()</a> interface.

</p><div class="codeblock"><pre>CREATE VIRTUAL TABLE tablename USING modulename;
</pre></div>

<p>One can also provide comma-separated arguments to the module following 
the module name:

</p><div class="codeblock"><pre>CREATE VIRTUAL TABLE tablename USING modulename(arg1, arg2, ...);
</pre></div>

<p>The format of the arguments to the module is very general. Each 
<span class='yyterm'>module-argument</span>
may contain keywords, string literals, identifiers, numbers, and 
punctuation. Each <span class='yyterm'>module-argument</span> is passed as 
written (as text) into the
<a href="vtab.html#xcreate">constructor method</a> of the virtual table implementation 
when the virtual 
table is created and that constructor is responsible for parsing and 
interpreting the arguments. The argument syntax is sufficiently general 
that a virtual table implementation can, if it wants to, interpret its
arguments as <a href="lang_createtable.html#tablecoldef">column definitions</a> in an ordinary <a href="lang_createtable.html">CREATE TABLE</a> statement. 
The implementation could also impose some other interpretation on the 
arguments.

</p><p>Once a virtual table has been created, it can be used like any other 
table with the exceptions noted above and imposed by specific virtual
table implementations. A virtual table is destroyed using the ordinary
<a href="lang_droptable.html">DROP TABLE</a> syntax.

</p><h3 id="temporary_virtual_tables"><span>1.1.1. </span>Temporary virtual tables</h3>

<p>There is no "CREATE TEMP VIRTUAL TABLE" statement.  To create a
temporary virtual table, add the "temp" schema
before the virtual table name.

</p><div class="codeblock"><pre>CREATE VIRTUAL TABLE <b>temp.</b>tablename USING module(arg1, ...);
</pre></div>

<a name="epovtab"></a>

<h3 id="eponymous_virtual_tables"><span>1.1.2. </span>Eponymous virtual tables</h3>

<p>Some virtual tables exist automatically in the "main" schema of
every database connection in which their
module is registered, even without a <a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a> statement.
Such virtual tables are called "eponymous virtual tables".
To use an eponymous virtual table, simply use the 
module name as if it were a table.
Eponymous virtual tables exist in the "main" schema only, so they will
not work if prefixed with a different schema name.

</p><p>An example of an eponymous virtual table is the <a href="dbstat.html">dbstat virtual table</a>.
To use the dbstat virtual table as an eponymous virtual table, 
simply query against the "dbstat"
module name, as if it were an ordinary table.  (Note that SQLite
must be compiled with the <a href="compile.html#enable_dbstat_vtab">SQLITE_ENABLE_DBSTAT_VTAB</a> option to include
the dbstat virtual table in the build.)

</p><div class="codeblock"><pre>SELECT * FROM dbstat;
</pre></div>

<p>A virtual table is eponymous if its <a href="vtab.html#xcreate">xCreate</a> method is the exact same
function as the <a href="vtab.html#xconnect">xConnect</a> method, or if the <a href="vtab.html#xcreate">xCreate</a> method is NULL.
The <a href="vtab.html#xcreate">xCreate</a> method is called when a virtual table is first created
using the <a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a> statement.  The <a href="vtab.html#xconnect">xConnect</a> method 
is invoked whenever
a database connection attaches to or reparses a schema. When these two methods
are the same, that indicates that the virtual table has no persistent
state that needs to be created and destroyed.

<a name="epoonlyvtab"></a>

</p><h3 id="eponymous_only_virtual_tables"><span>1.1.3. </span>Eponymous-only virtual tables</h3>
<p>If the <a href="vtab.html#xcreate">xCreate</a> method is NULL, then
<a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a> statements are prohibited for that virtual table,
and the virtual table is an "eponymous-only virtual table".
Eponymous-only virtual tables are useful as 
<a href="vtab.html#tabfunc2">table-valued functions</a>.

</p><p>
Note that prior to <a href="releaselog/3_9_0.html">version 3.9.0</a> (2015-10-14), 
SQLite did not check the xCreate method
for NULL before invoking it.  So if an eponymous-only virtual table is
registered with SQLite <a href="releaselog/3_8_11_1.html">version 3.8.11.1</a> (2015-07-29)
or earlier and a <a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a>
command is attempted against that virtual table module, a jump to a NULL
pointer will occur, resulting in a crash.

</p><h2 id="implementation"><span>1.2. </span>Implementation</h2>

<p>Several new C-level objects are used by the virtual table implementation:

</p><div class="codeblock"><pre>typedef struct sqlite3_vtab sqlite3_vtab;
typedef struct sqlite3_index_info sqlite3_index_info;
typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor;
typedef struct sqlite3_module sqlite3_module;
</pre></div>

<p>The <a href="c3ref/module.html">sqlite3_module</a> structure defines a module object used to implement
a virtual table. Think of a module as a class from which one can 
construct multiple virtual tables having similar properties. For example,
one might have a module that provides read-only access to 
comma-separated-value (CSV) files on disk. That one module can then be
used to create several virtual tables where each virtual table refers
to a different CSV file.

</p><p>The module structure contains methods that are invoked by SQLite to
perform various actions on the virtual table such as creating new
instances of a virtual table or destroying old ones, reading and
writing data, searching for and deleting, updating, or inserting rows. 
The module structure is explained in more detail below.

</p><p>Each virtual table instance is represented by an <a href="c3ref/vtab.html">sqlite3_vtab</a> structure. 
The sqlite3_vtab structure looks like this:

</p><div class="codeblock"><pre>struct sqlite3_vtab {
  const sqlite3_module *pModule;
  int nRef;
  char *zErrMsg;
};
</pre></div>

<p>Virtual table implementations will normally subclass this structure 
to add additional private and implementation-specific fields. 
The nRef field is used internally by the SQLite core and should not 
be altered by the virtual table implementation. The virtual table 
implementation may pass error message text to the core by putting 
an error message string in zErrMsg.
Space to hold this error message string must be obtained from an
SQLite memory allocation function such as <a href="c3ref/mprintf.html">sqlite3_mprintf()</a> or
<a href="c3ref/free.html">sqlite3_malloc()</a>.
Prior to assigning a new value to zErrMsg, the virtual table 
implementation must free any preexisting content of zErrMsg using 
<a href="c3ref/free.html">sqlite3_free()</a>. Failure to do this will result in a memory leak. 
The SQLite core will free and zero the content of zErrMsg when it 
delivers the error message text to the client application or when 
it destroys the virtual table. The virtual table implementation only 
needs to worry about freeing the zErrMsg content when it overwrites 
the content with a new, different error message.

</p><p>The <a href="c3ref/vtab_cursor.html">sqlite3_vtab_cursor</a> structure represents a pointer to a specific
row of a virtual table. This is what an sqlite3_vtab_cursor looks like:

</p><div class="codeblock"><pre>struct sqlite3_vtab_cursor {
  sqlite3_vtab *pVtab;
};
</pre></div>

<p>Once again, practical implementations will likely subclass this 
structure to add additional private fields.

</p><p>The <a href="c3ref/index_info.html">sqlite3_index_info</a> structure is used to pass information into
and out of the xBestIndex method of the module that implements a 
virtual table.

</p><p>Before a <a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a> statement can be run, the module 
specified in that statement must be registered with the database 
connection. This is accomplished using either of the <a href="c3ref/create_module.html">sqlite3_create_module()</a>
or <a href="c3ref/create_module.html">sqlite3_create_module_v2()</a> interfaces:

</p><div class="codeblock"><pre>int sqlite3_create_module(
  sqlite3 *db,               /* SQLite connection to register module with */
  const char *zName,         /* Name of the module */
  const sqlite3_module *,    /* Methods for the module */
  void *                     /* Client data for xCreate/xConnect */
);
int sqlite3_create_module_v2(
  sqlite3 *db,               /* SQLite connection to register module with */
  const char *zName,         /* Name of the module */
  const sqlite3_module *,    /* Methods for the module */
  void *,                    /* Client data for xCreate/xConnect */
  void(*xDestroy)(void*)     /* Client data destructor function */
);
</pre></div>

<p>The <a href="c3ref/create_module.html">sqlite3_create_module()</a> and <a href="c3ref/create_module.html">sqlite3_create_module_v2()</a>
routines associates a module name with 
an <a href="c3ref/module.html">sqlite3_module</a> structure and a separate client data that is specific 
to each module.  The only difference between the two create_module methods
is that the _v2 method includes an extra parameter that specifies a
destructor for client data pointer.  The module structure is what defines
the behavior of a virtual table.  The module structure looks like this:

</p><div class="codeblock"><pre>
struct sqlite3_module {
  int iVersion;
  int (*xCreate)(sqlite3*, void *pAux,
               int argc, char *const*argv,
               sqlite3_vtab **ppVTab,
               char **pzErr);
  int (*xConnect)(sqlite3*, void *pAux,
               int argc, char *const*argv,
               sqlite3_vtab **ppVTab,
               char **pzErr);
  int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*);
  int (*xDisconnect)(sqlite3_vtab *pVTab);
  int (*xDestroy)(sqlite3_vtab *pVTab);
  int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor);
  int (*xClose)(sqlite3_vtab_cursor*);
  int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr,
                int argc, sqlite3_value **argv);
  int (*xNext)(sqlite3_vtab_cursor*);
  int (*xEof)(sqlite3_vtab_cursor*);
  int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int);
  int (*xRowid)(sqlite3_vtab_cursor*, sqlite_int64 *pRowid);
  int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite_int64 *);
  int (*xBegin)(sqlite3_vtab *pVTab);
  int (*xSync)(sqlite3_vtab *pVTab);
  int (*xCommit)(sqlite3_vtab *pVTab);
  int (*xRollback)(sqlite3_vtab *pVTab);
  int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName,
                     void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),
                     void **ppArg);
  int (*xRename)(sqlite3_vtab *pVtab, const char *zNew);
  /* The methods above are in version 1 of the sqlite_module object. Those 
  ** below are for version 2 and greater. */
  int (*xSavepoint)(sqlite3_vtab *pVTab, int);
  int (*xRelease)(sqlite3_vtab *pVTab, int);
  int (*xRollbackTo)(sqlite3_vtab *pVTab, int);
  /* The methods above are in versions 1 and 2 of the sqlite_module object.
  ** Those below are for version 3 and greater. */
  int (*xShadowName)(const char*);
  /* The methods above are in versions 1 through 3 of the sqlite_module object.
  ** Those below are for version 4 and greater. */
  int (*xIntegrity)(sqlite3_vtab *pVTab, const char *zSchema,
                    const char *zTabName, int mFlags, char **pzErr);
};
</pre></div>

<p>The module structure defines all of the methods for each virtual 
table object. The module structure also contains the iVersion field which
defines the particular edition of the module table structure. Currently, 
iVersion is always 4 or less, but in future releases of SQLite the module
structure definition might be extended with additional methods and in 
that case the maximum iVersion value will be increased.

</p><p>The rest of the module structure consists of methods used to implement
various features of the virtual table. Details on what each of these 
methods do are provided in the sequel.

</p><h2 id="virtual_tables_and_shared_cache"><span>1.3. </span>Virtual Tables And Shared Cache</h2>

<p>Prior to SQLite <a href="releaselog/3_6_17.html">version 3.6.17</a> (2009-08-10), 
the virtual table mechanism assumes 
that each <a href="c3ref/sqlite3.html">database connection</a> kept
its own copy of the database schema. Hence, the virtual table mechanism
could not be used in a database that has <a href="sharedcache.html">shared cache mode</a> enabled. 
The <a href="c3ref/create_module.html">sqlite3_create_module()</a> interface would return an error if 
<a href="sharedcache.html">shared cache mode</a> is enabled.  That restriction was relaxed
beginning with SQLite <a href="releaselog/3_6_17.html">version 3.6.17</a>.

<a name="customvtab"></a>

</p><h2 id="creating_new_virtual_table_implementations"><span>1.4. </span>Creating New Virtual Table Implementations</h2>

<p>Follow these steps to create your own virtual table:

</p><p>
</p><ol>
<li> Write all necessary methods.
</li><li> Create an instance of the <a href="c3ref/module.html">sqlite3_module</a> structure containing pointers
     to all the methods from step 1.
</li><li> Register your <a href="c3ref/module.html">sqlite3_module</a> structure using one of the
     <a href="c3ref/create_module.html">sqlite3_create_module()</a> or <a href="c3ref/create_module.html">sqlite3_create_module_v2()</a> interfaces.
</li><li> Run a <a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a> command that specifies the new module in 
     the USING clause. 
</li></ol>

<p>The only really hard part is step 1. You might want to start with an 
existing virtual table implementation and modify it to suit your needs.
The <a href="https://sqlite.org/src/dir?ci=trunk&type=tree">SQLite source tree</a>
contains many virtual table implementations that are suitable for copying,
including:

</p><p>
</p><ul>
<li> <b><a href="https://sqlite.org/src/file/ext/misc/templatevtab.c">templatevtab.c</a></b>
&rarr; A virtual table created specifically to serve as a template for
other custom virtual tables.
</li><li> <b><a href="https://sqlite.org/src/file/ext/misc/series.c">series.c</a></b>
&rarr; Implementation of the generate_series() table-valued function.
</li><li> <b><a href="https://sqlite.org/src/file/src/json.c">json.c</a></b> &rarr;
Contains the sources for the <a href="json1.html#jeach">json_each()</a> and <a href="json1.html#jtree">json_tree()</a> table-valued
functions.
</li><li> <b><a href="https://sqlite.org/src/file/ext/misc/csv.c">csv.c</a></b> &rarr;
A virtual table that reads CSV files.
</li></ul>


<p>There are <a href="vtablist.html">many other virtual table implementations</a>
in the SQLite source tree that can be used as examples.  Locate 
these other virtual table implementations by searching 
for "sqlite3_create_module".

</p><p>You might also want to implement your new virtual table as a 
<a href="loadext.html">loadable extension</a>.

</p><h1 id="virtual_table_methods"><span>2. </span>Virtual Table Methods</h1>

<a name="xcreate"></a>

<h2 id="the_xcreate_method"><span>2.1. </span>The xCreate Method</h2>

<div class="codeblock"><pre>int (*xCreate)(sqlite3 *db, void *pAux,
             int argc, char *const*argv,
             sqlite3_vtab **ppVTab,
             char **pzErr);
</pre></div>

<p>The xCreate method is called to create a new instance of a virtual table 
in response to a <a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a> statement.
If the xCreate method is the same pointer as the <a href="vtab.html#xconnect">xConnect</a> method, then the
virtual table is an <a href="vtab.html#epovtab">eponymous virtual table</a>.
If the xCreate method is omitted (if it is a NULL pointer) then the virtual 
table is an <a href="vtab.html#epoonlyvtab">eponymous-only virtual table</a>.


</p><p>The db parameter is a pointer to the SQLite <a href="c3ref/sqlite3.html">database connection</a> that 
is executing the <a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a> statement. 
The pAux argument is the copy of the client data pointer that was the 
fourth argument to the <a href="c3ref/create_module.html">sqlite3_create_module()</a> or
<a href="c3ref/create_module.html">sqlite3_create_module_v2()</a> call that registered the 
<a href="c3ref/module.html">virtual table module</a>. 
The argv parameter is an array of argc pointers to null terminated strings. 
The first string, argv[0], is the name of the module being invoked.   The
module name is the name provided as the second argument to 
<a href="c3ref/create_module.html">sqlite3_create_module()</a> and as the argument to the USING clause of the
<a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a> statement that is running.
The second, argv[1], is the name of the database in which the new virtual 
table is being created. The database name is "main" for the primary database, or
"temp" for TEMP database, or the name given at the end of the <a href="lang_attach.html">ATTACH</a>
statement for attached databases.  The third element of the array, argv[2], 
is the name of the new virtual table, as specified following the TABLE
keyword in the <a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a> statement.
If present, the fourth and subsequent strings in the argv[] array report 
the arguments to the module name in the <a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a> statement.

</p><p>The job of this method is to construct the new virtual table object
(an <a href="c3ref/vtab.html">sqlite3_vtab</a> object) and return a pointer to it in *ppVTab.

</p><p>As part of the task of creating a new <a href="c3ref/vtab.html">sqlite3_vtab</a> structure, this 
method <u>must</u> invoke <a href="c3ref/declare_vtab.html">sqlite3_declare_vtab()</a> to tell the SQLite 
core about the columns and datatypes in the virtual table. 
The <a href="c3ref/declare_vtab.html">sqlite3_declare_vtab()</a> API has the following prototype:

</p><div class="codeblock"><pre>int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable)
</pre></div>

<p>The first argument to <a href="c3ref/declare_vtab.html">sqlite3_declare_vtab()</a> must be the same 
<a href="c3ref/sqlite3.html">database connection</a> pointer as the first parameter to this method.
The second argument to <a href="c3ref/declare_vtab.html">sqlite3_declare_vtab()</a> must a zero-terminated 
UTF-8 string that contains a well-formed <a href="lang_createtable.html">CREATE TABLE</a> statement that 
defines the columns in the virtual table and their data types. 
The name of the table in this CREATE TABLE statement is ignored, 
as are all constraints. Only the column names and datatypes matter.
The CREATE TABLE statement string need not to be 
held in persistent memory.  The string can be
deallocated and/or reused as soon as the <a href="c3ref/declare_vtab.html">sqlite3_declare_vtab()</a>
routine returns.

</p><p>The xConnect method can also optionally request special features
for the virtual table by making one or more calls to
the <a href="c3ref/vtab_config.html">sqlite3_vtab_config()</a> interface:

</p><div class="codeblock"><pre>int sqlite3_vtab_config(sqlite3 *db, int op, ...);
</pre></div>

<p>Calls to sqlite3_vtab_config() are optional.  But for maximum
security, it is recommended that virtual table implementations
invoke "<a href="c3ref/vtab_config.html">sqlite3_vtab_config</a>(db, <a href="c3ref/c_vtab_constraint_support.html#sqlitevtabdirectonly">SQLITE_VTAB_DIRECTONLY</a>)" if the
virtual table will not be used from inside of triggers or views.

</p><p>The xCreate method need not initialize the pModule, nRef, and zErrMsg
fields of the <a href="c3ref/vtab.html">sqlite3_vtab</a> object.  The SQLite core will take care of 
that chore.

</p><p>The xCreate should return <a href="rescode.html#ok">SQLITE_OK</a> if it is successful in 
creating the new virtual table, or <a href="rescode.html#error">SQLITE_ERROR</a> if it is not successful.
If not successful, the <a href="c3ref/vtab.html">sqlite3_vtab</a> structure must not be allocated. 
An error message may optionally be returned in *pzErr if unsuccessful.
Space to hold the error message string must be allocated using
an SQLite memory allocation function like 
<a href="c3ref/free.html">sqlite3_malloc()</a> or <a href="c3ref/mprintf.html">sqlite3_mprintf()</a> as the SQLite core will
attempt to free the space using <a href="c3ref/free.html">sqlite3_free()</a> after the error has
been reported up to the application.

</p><p>
If the xCreate method is omitted (left as a NULL pointer) then the
virtual table is an <a href="vtab.html#epoonlyvtab">eponymous-only virtual table</a>.  New instances of
the virtual table cannot be created using <a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a> and the
virtual table can only be used via its module name.
Note that SQLite versions prior to 3.9.0 (2015-10-14) do not understand
eponymous-only virtual tables and will segfault if an attempt is made
to <a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a> on an eponymous-only virtual table because
the xCreate method was not checked for null.

</p><p>
If the xCreate method is the exact same pointer as the <a href="vtab.html#xconnect">xConnect</a> method,
that indicates that the virtual table does not need to initialize backing
store.  Such a virtual table can be used as an <a href="vtab.html#epovtab">eponymous virtual table</a>
or as a named virtual table using <a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a> or both.

<a name="hiddencol"></a>

</p><h3 id="hidden_columns_in_virtual_tables"><span>2.1.1. </span>Hidden columns in virtual tables</h3>
<p>If a column datatype contains the special keyword "HIDDEN"
(in any combination of upper and lower case letters) then that keyword
it is omitted from the column datatype name and the column is marked 
as a hidden column internally. 
A hidden column differs from a normal column in three respects:

</p><p>
</p><ul>
<li> Hidden columns are not listed in the dataset returned by 
     "<a href="pragma.html#pragma_table_info">PRAGMA table_info</a>",
</li><li> Hidden columns are not included in the expansion of a "*"
     expression in the result set of a <a href="lang_select.html">SELECT</a>, and
</li><li> Hidden columns are not included in the implicit column-list 
     used by an <a href="lang_insert.html">INSERT</a> statement that lacks an explicit column-list. 
</li></ul>

<p>For example, if the following SQL is passed to <a href="c3ref/declare_vtab.html">sqlite3_declare_vtab()</a>:

</p><div class="codeblock"><pre>CREATE TABLE x(a HIDDEN VARCHAR(12), b INTEGER, c INTEGER Hidden);
</pre></div>

<p>Then the virtual table would be created with two hidden columns,
and with datatypes of "VARCHAR(12)" and "INTEGER".

</p><p>An example use of hidden columns can be seen in the <a href="fts3.html">FTS3</a> virtual 
table implementation, where every FTS virtual table
contains an <a href="fts3.html#hiddencol">FTS hidden column</a> that is used to pass information from the
virtual table into <a href="fts3.html#snippet">FTS auxiliary functions</a> and to the <a href="fts3.html#full_text_index_queries">FTS MATCH</a> operator.

<a name="tabfunc2"></a>

</p><h3 id="table_valued_functions"><span>2.1.2. </span>Table-valued functions</h3>

<p>A <a href="vtab.html">virtual table</a> that contains <a href="vtab.html#hiddencol">hidden columns</a> can be used like
a table-valued function in the FROM clause of a <a href="lang_select.html">SELECT</a> statement.
The arguments to the table-valued function become constraints on 
the HIDDEN columns of the virtual table.

</p><p>For example, the "generate_series" extension (located in the
<a href="https://www.sqlite.org/src/artifact?ci=trunk&filename=ext/misc/series.c">ext/misc/series.c</a>
file in the <a href="https://www.sqlite.org/src/tree?ci=trunk">source tree</a>)
implements an <a href="vtab.html#epovtab">eponymous virtual table</a> with the following schema:

</p><div class="codeblock"><pre>CREATE TABLE generate_series(
  value,
  start HIDDEN,
  stop HIDDEN,
  step HIDDEN
);
</pre></div>

<p>The <a href="vtab.html#xbestindex">sqlite3_module.xBestIndex</a> method in the implementation of this
table checks for equality constraints against the HIDDEN columns, and uses
those as input parameters to determine the range of integer "value" outputs
to generate.  Reasonable defaults are used for any unconstrained columns.
For example, to list all integers between 5 and 50:

</p><div class="codeblock"><pre>SELECT value FROM generate_series(5,50);
</pre></div>

<p>The previous query is equivalent to the following:

</p><div class="codeblock"><pre>SELECT value FROM generate_series WHERE start=5 AND stop=50;
</pre></div>

<p>Arguments on the virtual table name are matched to <a href="vtab.html#hiddencol">hidden columns</a>
in order.  The number of arguments can be less than the
number of hidden columns, in which case the latter hidden columns are
unconstrained.  However, an error results if there are more arguments
than there are hidden columns in the virtual table.

<a name="worid"></a>

</p><h3 id="_without_rowid_virtual_tables_"><span>2.1.3. </span> WITHOUT ROWID Virtual Tables </h3>

<p>Beginning with SQLite <a href="releaselog/3_14.html">version 3.14.0</a> (2016-08-08), 
the CREATE TABLE statement that
is passed into <a href="c3ref/declare_vtab.html">sqlite3_declare_vtab()</a> may contain a <a href="withoutrowid.html">WITHOUT ROWID</a> clause.
This is useful for cases where the virtual table rows 
cannot easily be mapped into unique integers.  A CREATE TABLE
statement that includes WITHOUT ROWID must define one or more columns as
the PRIMARY KEY.  Every column of the PRIMARY KEY must individually be
NOT NULL and all columns for each row must be collectively unique.

</p><p>Note that SQLite does not enforce the PRIMARY KEY for a WITHOUT ROWID
virtual table.  Enforcement is the responsibility of the underlying
virtual table implementation.  But SQLite does assume that the PRIMARY KEY
constraint is valid - that the identified columns really are UNIQUE and
NOT NULL - and it uses that assumption to optimize queries against the
virtual table.

</p><p>The rowid column is not accessible on a
WITHOUT ROWID virtual table (of course).

</p><p>The <a href="vtab.html#xupdate">xUpdate</a> method was originally designed around having a
<a href="lang_createtable.html#rowid">ROWID</a> as a single value.  The <a href="vtab.html#xupdate">xUpdate</a> method has been expanded to
accommodate an arbitrary PRIMARY KEY in place of the ROWID, but the
PRIMARY KEY must still be only one column.  For this reason, SQLite
will reject any WITHOUT ROWID virtual table that has more than one
PRIMARY KEY column and a non-NULL xUpdate method.

<a name="xconnect"></a>

</p><h2 id="the_xconnect_method"><span>2.2. </span>The xConnect Method</h2>

<div class="codeblock"><pre>int (*xConnect)(sqlite3*, void *pAux,
             int argc, char *const*argv,
             sqlite3_vtab **ppVTab,
             char **pzErr);
</pre></div>

<p>The xConnect method is very similar to <a href="vtab.html#xcreate">xCreate</a>. 
It has the same parameters and constructs a new <a href="c3ref/vtab.html">sqlite3_vtab</a> structure 
just like xCreate. 
And it must also call <a href="c3ref/declare_vtab.html">sqlite3_declare_vtab()</a> like xCreate.  It
should also make all of the same <a href="c3ref/vtab_config.html">sqlite3_vtab_config()</a> calls as
xCreate.

</p><p>The difference is that xConnect is called to establish a new 
connection to an existing virtual table whereas xCreate is called 
to create a new virtual table from scratch.

</p><p>The xCreate and xConnect methods are only different when the
virtual table has some kind of backing store that must be initialized 
the first time the virtual table is created. The xCreate method creates 
and initializes the backing store. The xConnect method just connects 
to an existing backing store.  When xCreate and xConnect are the same,
the table is an <a href="vtab.html#epovtab">eponymous virtual table</a>.

</p><p>As an example, consider a virtual table implementation that 
provides read-only access to existing comma-separated-value (CSV)
files on disk. There is no backing store that needs to be created 
or initialized for such a virtual table (since the CSV files already 
exist on disk) so the xCreate and xConnect methods will be identical 
for that module.

</p><p>Another example is a virtual table that implements a full-text index. 
The xCreate method must create and initialize data structures to hold 
the dictionary and posting lists for that index. The xConnect method,
on the other hand, only has to locate and use an existing dictionary 
and posting lists that were created by a prior xCreate call.

</p><p>The xConnect method must return <a href="rescode.html#ok">SQLITE_OK</a> if it is successful 
in creating the new virtual table, or <a href="rescode.html#error">SQLITE_ERROR</a> if it is not 
successful. If not successful, the <a href="c3ref/vtab.html">sqlite3_vtab</a> structure must not be 
allocated. An error message may optionally be returned in *pzErr if 
unsuccessful. 
Space to hold the error message string must be allocated using
an SQLite memory allocation function like 
<a href="c3ref/free.html">sqlite3_malloc()</a> or <a href="c3ref/mprintf.html">sqlite3_mprintf()</a> as the SQLite core will
attempt to free the space using <a href="c3ref/free.html">sqlite3_free()</a> after the error has
been reported up to the application.

</p><p>The xConnect method is required for every virtual table implementation, 
though the <a href="vtab.html#xcreate">xCreate</a> and xConnect pointers of the <a href="c3ref/module.html">sqlite3_module</a> object
may point to the same function if the virtual table does not need to
initialize backing store.

<a name="xbestindex"></a>

</p><h2 id="the_xbestindex_method"><span>2.3. </span>The xBestIndex Method</h2>

<p>SQLite uses the xBestIndex method of a virtual table module to determine
the best way to access the virtual table. 
The xBestIndex method has a prototype like this:

</p><div class="codeblock"><pre>int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*);
</pre></div>

<p>The SQLite core communicates with the xBestIndex method by filling 
in certain fields of the <a href="c3ref/index_info.html">sqlite3_index_info</a> structure and passing a 
pointer to that structure into xBestIndex as the second parameter. 
The xBestIndex method fills out other fields of this structure which
forms the reply. The <a href="c3ref/index_info.html">sqlite3_index_info</a> structure looks like this:

</p><div class="codeblock"><pre>struct sqlite3_index_info {
  /* Inputs */
  const int nConstraint;     /* Number of entries in aConstraint */
  const struct sqlite3_index_constraint {
     int iColumn;              /* Column constrained.  -1 for ROWID */
     unsigned char op;         /* Constraint operator */
     unsigned char usable;     /* True if this constraint is usable */
     int iTermOffset;          /* Used internally - xBestIndex should ignore */
  } *const aConstraint;      /* Table of WHERE clause constraints */
  const int nOrderBy;        /* Number of terms in the ORDER BY clause */
  const struct sqlite3_index_orderby {
     int iColumn;              /* Column number */
     unsigned char desc;       /* True for DESC.  False for ASC. */
  } *const aOrderBy;         /* The ORDER BY clause */

  /* Outputs */
  struct sqlite3_index_constraint_usage {
    int argvIndex;           /* if >0, constraint is part of argv to xFilter */
    unsigned char omit;      /* Do not code a test for this constraint */
  } *const aConstraintUsage;
  int idxNum;                /* Number used to identify the index */
  char *idxStr;              /* String, possibly obtained from sqlite3_malloc */
  int needToFreeIdxStr;      /* Free idxStr using sqlite3_free() if true */
  int orderByConsumed;       /* True if output is already ordered */
  double estimatedCost;      /* Estimated cost of using this index */
  <b>/* Fields below are only available in SQLite 3.8.2 and later */</b>
  sqlite3_int64 estimatedRows;    /* Estimated number of rows returned */
  <b>/* Fields below are only available in SQLite 3.9.0 and later */</b>
  int idxFlags;              /* Mask of SQLITE_INDEX_SCAN_* flags */
  <b>/* Fields below are only available in SQLite 3.10.0 and later */</b>
  sqlite3_uint64 colUsed;    /* Input: Mask of columns used by statement */
};
</pre></div>

<p>Note the warnings on the "estimatedRows", "idxFlags", and colUsed fields.
These fields were added with SQLite versions 3.8.2, 3.9.0, and 3.10.0, respectively. 
Any extension that reads or writes these fields must first check that the 
version of the SQLite library in use is greater than or equal to appropriate
version - perhaps comparing the value returned from <a href="c3ref/libversion.html">sqlite3_libversion_number()</a>
against constants 3008002, 3009000, and/or 3010000. The result of attempting 
to access these fields in an sqlite3_index_info structure created by an 
older version of SQLite are undefined.

</p><p>In addition, there are some defined constants:

</p><div class="codeblock"><pre>#define SQLITE_INDEX_CONSTRAINT_EQ         2
#define SQLITE_INDEX_CONSTRAINT_GT         4
#define SQLITE_INDEX_CONSTRAINT_LE         8
#define SQLITE_INDEX_CONSTRAINT_LT        16
#define SQLITE_INDEX_CONSTRAINT_GE        32
#define SQLITE_INDEX_CONSTRAINT_MATCH     64
#define SQLITE_INDEX_CONSTRAINT_LIKE      65  /* 3.10.0 and later */
#define SQLITE_INDEX_CONSTRAINT_GLOB      66  /* 3.10.0 and later */
#define SQLITE_INDEX_CONSTRAINT_REGEXP    67  /* 3.10.0 and later */
#define SQLITE_INDEX_CONSTRAINT_NE        68  /* 3.21.0 and later */
#define SQLITE_INDEX_CONSTRAINT_ISNOT     69  /* 3.21.0 and later */
#define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70  /* 3.21.0 and later */
#define SQLITE_INDEX_CONSTRAINT_ISNULL    71  /* 3.21.0 and later */
#define SQLITE_INDEX_CONSTRAINT_IS        72  /* 3.21.0 and later */
#define SQLITE_INDEX_CONSTRAINT_LIMIT     73  /* 3.38.0 and later */
#define SQLITE_INDEX_CONSTRAINT_OFFSET    74  /* 3.38.0 and later */
#define SQLITE_INDEX_CONSTRAINT_FUNCTION 150  /* 3.25.0 and later */
#define SQLITE_INDEX_SCAN_UNIQUE           1  /* Scan visits at most 1 row */
</pre></div>

<p>Use the <a href="c3ref/vtab_collation.html">sqlite3_vtab_collation()</a> interface to find the name of
the <a href="datatype3.html#collation">collating sequence</a> that should be used when evaluating the i-th
constraint:

</p><div class="codeblock"><pre>const char *sqlite3_vtab_collation(sqlite3_index_info*, int i);
</pre></div>

<p>The SQLite core calls the xBestIndex method when it is compiling a query
that involves a virtual table. In other words, SQLite calls this method 
when it is running <a href="c3ref/prepare.html">sqlite3_prepare()</a> or the equivalent. 
By calling this method, the 
SQLite core is saying to the virtual table that it needs to access 
some subset of the rows in the virtual table and it wants to know the
most efficient way to do that access. The xBestIndex method replies 
with information that the SQLite core can then use to conduct an 
efficient search of the virtual table.

</p><p>While compiling a single SQL query, the SQLite core might call 
xBestIndex multiple times with different settings in <a href="c3ref/index_info.html">sqlite3_index_info</a>.
The SQLite core will then select the combination that appears to 
give the best performance.

</p><p>Before calling this method, the SQLite core initializes an instance 
of the <a href="c3ref/index_info.html">sqlite3_index_info</a> structure with information about the
query that it is currently trying to process. This information 
derives mainly from the WHERE clause and ORDER BY or GROUP BY clauses 
of the query, but also from any ON or USING clauses if the query is a 
join. The information that the SQLite core provides to the xBestIndex 
method is held in the part of the structure that is marked as "Inputs". 
The "Outputs" section is initialized to zero.

</p><p>The information in the <a href="c3ref/index_info.html">sqlite3_index_info</a> structure is ephemeral
and may be overwritten or deallocated as soon as the xBestIndex method
returns.  If the xBestIndex method needs to remember any part of the
<a href="c3ref/index_info.html">sqlite3_index_info</a> structure, it should make a copy.  Care must be
take to store the copy in a place where it will be deallocated, such
as in the idxStr field with needToFreeIdxStr set to 1.

</p><p>Note that xBestIndex will always be called before <a href="vtab.html#xfilter">xFilter</a>, since
the idxNum and idxStr outputs from xBestIndex are required inputs to
xFilter.  However, there is no guarantee that xFilter will be called
following a successful xBestIndex.

</p><p>The xBestIndex method is required for every virtual table implementation.

</p><h3 id="inputs"><span>2.3.1. </span>Inputs</h3>

<p>The main thing that the SQLite core is trying to communicate to 
the virtual table is the constraints that are available to limit 
the number of rows that need to be searched. The aConstraint[] array 
contains one entry for each constraint. There will be exactly 
nConstraint entries in that array.

</p><p>Each constraint will usually correspond to a term in the WHERE clause
or in a USING or ON clause that is of the form

</p><blockquote>
     column  OP  EXPR
</blockquote>

<p>Where "column" is a column in the virtual table, OP is an operator 
like "=" or "&lt;", and EXPR is an arbitrary expression. So, for example,
if the WHERE clause contained a term like this:

</p><div class="codeblock"><pre>a = 5
</pre></div>

<p>Then one of the constraints would be on the "a" column with 
operator "=" and an expression of "5". Constraints need not have a
literal representation of the WHERE clause. The query optimizer might
make transformations to the 
WHERE clause in order to extract as many constraints 
as it can. So, for example, if the WHERE clause contained something 
like this:

</p><div class="codeblock"><pre>x BETWEEN 10 AND 100 AND 999&gt;y
</pre></div>

<p>The query optimizer might translate this into three separate constraints:

</p><div class="codeblock"><pre>x &gt;= 10
x &lt;= 100
y &lt; 999
</pre></div>

<p>For each such constraint, the aConstraint[].iColumn field indicates which 
column appears on the left-hand side of the constraint.
The first column of the virtual table is column 0. 
The rowid of the virtual table is column -1. 
The aConstraint[].op field indicates which operator is used. 
The SQLITE_INDEX_CONSTRAINT_* constants map integer constants 
into operator values.
Columns occur in the order they were defined by the call to
<a href="c3ref/declare_vtab.html">sqlite3_declare_vtab()</a> in the <a href="vtab.html#xcreate">xCreate</a> or <a href="vtab.html#xconnect">xConnect</a> method.
Hidden columns are counted when determining the column index.

</p><p>If the <a href="vtab.html#xfindfunction">xFindFunction()</a> method for the virtual table is defined, and 
if xFindFunction() sometimes returns <a href="c3ref/c_index_constraint_eq.html">SQLITE_INDEX_CONSTRAINT_FUNCTION</a> or
larger, then the constraints might also be of the form:

</p><blockquote>
     FUNCTION( column, EXPR)
</blockquote>

<p>In this case the aConstraint[].op value is the same as the value
returned by <a href="vtab.html#xfindfunction">xFindFunction()</a> for FUNCTION.

</p><p>The aConstraint[] array contains information about all constraints 
that apply to the virtual table. But some of the constraints might
not be usable because of the way tables are ordered in a join. 
The xBestIndex method must therefore only consider constraints 
that have an aConstraint[].usable flag which is true.

</p><p>In addition to WHERE clause constraints, the SQLite core also 
tells the xBestIndex method about the ORDER BY clause. 
(In an aggregate query, the SQLite core might put in GROUP BY clause 
information in place of the ORDER BY clause information, but this fact
should not make any difference to the xBestIndex method.) 
If all terms of the ORDER BY clause are columns in the virtual table, 
then nOrderBy will be the number of terms in the ORDER BY clause 
and the aOrderBy[] array will identify the column for each term 
in the order by clause and whether or not that column is ASC or DESC.

<a name="colUsed"></a>

</p><p>In SQLite <a href="releaselog/3_10_0.html">version 3.10.0</a> (2016-01-06) and later, 
the colUsed field is available
to indicate which fields of the virtual table are actually used by the
statement being prepared.  If the lowest bit of colUsed is set, that
means that the first column is used.  The second lowest bit corresponds
to the second column.  And so forth.  If the most significant bit of
colUsed is set, that means that one or more columns other than the 
first 63 columns are used.  If column usage information is needed by the
<a href="vtab.html#xfilter">xFilter</a> method, then the required bits must be encoded into either
the output idxNum field or idxStr content.

</p><h4 id="like_glob_regexp_and_match_functions"><span>2.3.1.1. </span>LIKE, GLOB, REGEXP, and MATCH functions</h4>

<p>For the LIKE, GLOB, REGEXP, and MATCH operators, the 
aConstraint[].iColumn value is the virtual table column that
is the left operand of the operator.  However, if these operators
are expressed as function calls instead of operators, then
the aConstraint[].iColumn value references the virtual table
column that is the second argument to that function:

</p><blockquote>
LIKE(<i>EXPR</i>, <i>column</i>)<br>
GLOB(<i>EXPR</i>, <i>column</i>)<br>
REGEXP(<i>EXPR</i>, <i>column</i>)<br>
MATCH(<i>EXPR</i>, <i>column</i>)<br>
</blockquote>

<p>Hence, as far as the xBestIndex() method is concerned, the following
two forms are equivalent:

</p><blockquote>
<i>column</i> LIKE <i>EXPR</i><br>
LIKE(<i>EXPR</i>,<i>column</i>)
</blockquote>

<p>This special behavior of looking at the second argument of a function
only occurs for the LIKE, GLOB, REGEXP, and MATCH functions.  For all
other functions, the aConstraint[].iColumn value references the first
argument of the function.

</p><p>This special feature of LIKE, GLOB, REGEXP, and MATCH does not
apply to the <a href="vtab.html#xfindfunction">xFindFunction()</a> method, however.  The
<a href="vtab.html#xfindfunction">xFindFunction()</a> method always keys off of the left operand of an
LIKE, GLOB, REGEXP, or MATCH operator but off of the first argument
to function-call equivalents of those operators.

</p><h4 id="limit_and_offset"><span>2.3.1.2. </span>LIMIT and OFFSET</h4>

<p>When aConstraint[].op is one of SQLITE_INDEX_CONSTRAINT_LIMIT or
SQLITE_INDEX_CONSTRAINT_OFFSET, that indicates that there is a
LIMIT or OFFSET clause on the SQL query statement that is using
the virtual table.  The LIMIT and OFFSET operators have no
left operand, and so when aConstraint[].op is one of
SQLITE_INDEX_CONSTRAINT_LIMIT or SQLITE_INDEX_CONSTRAINT_OFFSET
then the aConstraint[].iColumn value is meaningless and should
not be used.

</p><h4 id="right_hand_side_values_of_constraints"><span>2.3.1.3. </span>Right-hand side values of constraints</h4>

<p>The <a href="c3ref/vtab_rhs_value.html">sqlite3_vtab_rhs_value()</a> interface can be used to try to
access the right-hand operand of a constraint.  However, the value
of a right-hand operator might not be known at the time that
the xBestIndex method is run, so the sqlite3_vtab_rhs_value()
call might not be successful.  Usually the right operand of a
constraint is only available to xBestIndex if it is coded as
a literal value in the input SQL.  If the right operand is
coded as an expression or a <a href="c3ref/bind_blob.html">host parameter</a>, it probably will
not be accessible to xBestIndex.  Some operators, such as
<a href="c3ref/c_index_constraint_eq.html">SQLITE_INDEX_CONSTRAINT_ISNULL</a> and
<a href="c3ref/c_index_constraint_eq.html">SQLITE_INDEX_CONSTRAINT_ISNOTNULL</a> have no right-hand operand.
The sqlite3_vtab_rhs_value() interface always returns
<a href="rescode.html#notfound">SQLITE_NOTFOUND</a> for such operators.

</p><h3 id="outputs"><span>2.3.2. </span>Outputs</h3>

<p>Given all of the information above, the job of the xBestIndex 
method it to figure out the best way to search the virtual table.

</p><p>The xBestIndex method conveys an indexing strategy to the <a href="vtab.html#xfilter">xFilter</a> 
method through the idxNum and idxStr fields. The idxNum value and 
idxStr string content are arbitrary as far as the SQLite core is 
concerned and can have any meaning as long as xBestIndex and xFilter 
agree on what that meaning is. The SQLite core just copies the 
information from xBestIndex through to the <a href="vtab.html#xfilter">xFilter</a> method, assuming 
only that the char sequence referenced via idxStr is NUL terminated.

</p><p>The idxStr value may be a string obtained from an SQLite
memory allocation function such as <a href="c3ref/mprintf.html">sqlite3_mprintf()</a>. 
If this is the case, then the needToFreeIdxStr flag must be set to 
true so that the SQLite core will know to call <a href="c3ref/free.html">sqlite3_free()</a> on 
that string when it has finished with it, and thus avoid a memory leak.
The idxStr value may also be a static constant string, in which case
the needToFreeIdxStr boolean should remain false.


</p><p>The estimatedCost field should be set to the estimated number
of disk access operations required to execute this query against 
the virtual table. The SQLite core will often call xBestIndex 
multiple times with different constraints, obtain multiple cost
estimates, then choose the query plan that gives the lowest estimate.
The SQLite core initializes estimatedCost to a very large value
prior to invoking xBestIndex, so if xBestIndex determines that the
current combination of parameters is undesirable, it can leave the
estimatedCost field unchanged to discourage its use.

</p><p>If the current version of SQLite is 3.8.2 or greater, the estimatedRows
field may be set to an estimate of the number of rows returned by the
proposed query plan. If this value is not explicitly set, the default 
estimate of 25 rows is used.

</p><p>If the current version of SQLite is 3.9.0 or greater, the idxFlags field
may be set to SQLITE_INDEX_SCAN_UNIQUE to indicate that the virtual table
will return only zero or one rows given the input constraints.  Additional
bits of the idxFlags field might be understood in later versions of SQLite.

</p><p>The aConstraintUsage[] array contains one element for each of 
the nConstraint constraints in the inputs section of the 
<a href="c3ref/index_info.html">sqlite3_index_info</a> structure. 
The aConstraintUsage[] array is used by xBestIndex to tell the 
core how it is using the constraints.

</p><p>The xBestIndex method may set aConstraintUsage[].argvIndex 
entries to values greater than zero. 
Exactly one entry should be set to 1, another to 2, another to 3, 
and so forth up to as many or as few as the xBestIndex method wants. 
The EXPR of the corresponding constraints will then be passed 
in as the argv[] parameters to xFilter.

</p><p>For example, if the aConstraint[3].argvIndex is set to 1, then 
when xFilter is called, the argv[0] passed to xFilter will have 
the EXPR value of the aConstraint[3] constraint.

</p><h4 id="omit_constraint_checking_in_bytecode"><span>2.3.2.1. </span>Omit constraint checking in bytecode</h4>

<p>By default, the SQLite generates <a href="opcode.html">bytecode</a> that will double
checks all constraints on each row of the virtual table to verify
that they are satisfied.  If the virtual table can guarantee
that a constraint will always be satisfied, it can try to
suppress that double-check by setting aConstraintUsage[].omit.
However, with some exceptions, this is only a hint and
there is no guarantee that the redundant check of the constraint
will be suppressed.  Key points:

</p><ul>
<li><p>
The omit flag is only honored if the argvIndex value for the
constraint is greater than 0 and less than or equal to 16.  
Constraint checking is never suppressed for constraints
that do not pass their right operand into the xFilter method.
The current implementation is only able to suppress redundant
constraint checking for the first 16 values passed to xFilter,
though that limitation might be increased in future releases.

</p></li><li><p>
The omit flag is always honored for <a href="c3ref/c_index_constraint_eq.html">SQLITE_INDEX_CONSTRAINT_OFFSET</a>
constraints as long as argvIndex is greater than 0.  Setting the
omit flag on an SQLITE_INDEX_CONSTRAINT_OFFSET constraint indicates
to SQLite that the virtual table will itself suppress the first N
rows of output, where N is the right operand of the OFFSET operator.
If the virtual table implementation sets omit on an
SQLITE_INDEX_CONSTRAINT_OFFSET constraint but then fails to suppress
the first N rows of output, an incorrect answer will result from
the overall query.
</p></li></ul>

<a name="obc"></a>

<h4 id="order_by_and_orderbyconsumed"><span>2.3.2.2. </span>ORDER BY and orderByConsumed</h4>

<p>If the virtual table will output rows in the order specified by 
the ORDER BY clause, then the orderByConsumed flag may be set to 
true. If the output is not automatically in the correct order 
then orderByConsumed must be left in its default false setting. 
This will indicate to the SQLite core that it will need to do a 
separate sorting pass over the data after it comes out of the virtual table.
Setting orderByConsumed is an optimization.  A query will always
get the correct answer if orderByConsumed is left at its default
value (0).  Unnecessary sort operations might be avoided resulting
in a faster query if orderByConsumed is set, but setting
orderByConsumed incorrectly can result in an incorrect answer.
It is suggested that new virtual table implementations leave
the orderByConsumed value unset initially, and then after everything
else is known to be working correctly, go back and attempt to
optimize by setting orderByConsumed where appropriate.

</p><p>Sometimes the orderByConsumed flag can be safely set even if
the outputs from the virtual table are not strictly in the order
specified by nOrderBy and aOrderBy.  If the
<a href="c3ref/vtab_distinct.html">sqlite3_vtab_distinct()</a> interface returns 1 or 2, that indicates
that the ordering can be relaxed.  See the documentation on
<a href="c3ref/vtab_distinct.html">sqlite3_vtab_distinct()</a> for further information.


</p><h3 id="return_value"><span>2.3.3. </span>Return Value</h3>

<p>The xBestIndex method should return SQLITE_OK on success.  If any
kind of fatal error occurs, an appropriate error code (ex: <a href="rescode.html#nomem">SQLITE_NOMEM</a>)
should be returned instead.

</p><p>If xBestIndex returns <a href="rescode.html#constraint">SQLITE_CONSTRAINT</a>, that does not indicate an
error.  Rather, SQLITE_CONSTRAINT indicates that the particular combination
of input parameters specified is insufficient for the virtual table
to do its job.
This is logically the same as setting the estimatedCost to infinity.
If every call to xBestIndex for a particular query plan returns
SQLITE_CONSTRAINT, that means there is no way for the virtual table
to be safely used, and the <a href="c3ref/prepare.html">sqlite3_prepare()</a> call will fail with
a "no query solution" error.

</p><h3 id="enforcing_required_parameters_on_table_valued_functions"><span>2.3.4. </span>Enforcing Required Parameters On Table-Valued Functions</h3>

<p>The SQLITE_CONSTRAINT return from xBestIndex
is useful for <a href="vtab.html#tabfunc2">table-valued functions</a> that
have required parameters.  If the aConstraint[].usable field is false
for one of the required parameter, then the xBestIndex method should
return SQLITE_CONSTRAINT.  If a required field does not appear in
the aConstraint[] array at all, that means that the corresponding
parameter is omitted from the input SQL.  In that case, xBestIndex
should set an error message in pVTab-&gt;zErrMsg and return
SQLITE_ERROR.  To summarize:

</p><ol>
<li><p>
The aConstraint[].usable value for a required parameter is
false <big>&rarr;</big> return SQLITE_CONSTRAINT.
</p></li><li><p>
A required parameter does not appears anywhere in
the aConstraint[] array <big>&rarr;</big>
Set an error message in pVTab-&gt;zErrMsg and return
SQLITE_ERROR
</p></li></ol>

<p>The following example will better illustrate the use of SQLITE_CONSTRAINT
as a return value from xBestIndex:

</p><div class="codeblock"><pre>SELECT * FROM realtab, tablevaluedfunc(realtab.x);
</pre></div>

<p>Assuming that the first hidden column of "tablevaluedfunc" is "param1",
the query above is semantically equivalent to this:

</p><div class="codeblock"><pre>SELECT * FROM realtab, tablevaluedfunc
 WHERE tablevaluedfunc.param1 = realtab.x;
</pre></div>

<p>The query planner must decide between many possible implementations
of this query, but two plans in particular are of note:

</p><ol>
<li><p>Scan all
rows of realtab and for each row, find rows in tablevaluedfunc where
param1 is equal to realtab.x

</p></li><li><p>Scan all rows of tablevalued func and for each row find rows
in realtab where x is equal to tablevaluedfunc.param1.
</p></li></ol>

<p>The xBestIndex method will be invoked once for each of the potential
plans above.  For plan 1, the aConstraint[].usable flag for the
SQLITE_CONSTRAINT_EQ constraint on the param1 column will be true because
the right-hand side value for the "param1 = ?" constraint will be known,
since it is determined by the outer realtab loop.
But for plan 2, the aConstraint[].usable flag for "param1 = ?" will be false
because the right-hand side value is determined by an inner loop and is thus
an unknown quantity.  Because param1 is a required input to the table-valued
functions, the xBestIndex method should return SQLITE_CONSTRAINT when presented 
with plan 2, indicating that a required input is missing.  This forces the
query planner to select plan 1.

<a name="xdisconnect"></a>

</p><h2 id="the_xdisconnect_method"><span>2.4. </span>The xDisconnect Method</h2>

<div class="codeblock"><pre>int (*xDisconnect)(sqlite3_vtab *pVTab);
</pre></div>

<p>This method releases a connection to a virtual table. 
Only the <a href="c3ref/vtab.html">sqlite3_vtab</a> object is destroyed.
The virtual table is not destroyed and any backing store 
associated with the virtual table persists. 

This method undoes the work of <a href="vtab.html#xconnect">xConnect</a>.

</p><p>This method is a destructor for a connection to the virtual table.
Contrast this method with <a href="vtab.html#sqlite3_module.xDestroy">xDestroy</a>.  The xDestroy is a destructor
for the entire virtual table.

</p><p>The xDisconnect method is required for every virtual table implementation,
though it is acceptable for the xDisconnect and <a href="vtab.html#sqlite3_module.xDestroy">xDestroy</a> methods to be
the same function if that makes sense for the particular virtual table.

<a name="sqlite3_module.xDestroy"></a>

</p><h2 id="the_xdestroy_method"><span>2.5. </span>The xDestroy Method</h2>

<div class="codeblock"><pre>int (*xDestroy)(sqlite3_vtab *pVTab);
</pre></div>

<p>This method releases a connection to a virtual table, just like 
the <a href="vtab.html#xdisconnect">xDisconnect</a> method, and it also destroys the underlying 
table implementation. This method undoes the work of <a href="vtab.html#xcreate">xCreate</a>.

</p><p>The <a href="vtab.html#xdisconnect">xDisconnect</a> method is called whenever a database connection
that uses a virtual table is closed. The xDestroy method is only 
called when a <a href="lang_droptable.html">DROP TABLE</a> statement is executed against the virtual table.

</p><p>The xDestroy method is required for every virtual table implementation,
though it is acceptable for the <a href="vtab.html#xdisconnect">xDisconnect</a> and xDestroy methods to be
the same function if that makes sense for the particular virtual table.

<a name="xopen"></a>

</p><h2 id="the_xopen_method"><span>2.6. </span>The xOpen Method</h2>

<div class="codeblock"><pre>int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor);
</pre></div>

<p>The xOpen method creates a new cursor used for accessing (read and/or
writing) a virtual table.  A successful invocation of this method 
will allocate the memory for the <a href="c3ref/vtab_cursor.html">sqlite3_vtab_cursor</a> (or a subclass),
initialize the new object, and make *ppCursor point to the new object.
The successful call then returns <a href="rescode.html#ok">SQLITE_OK</a>.

</p><p>For every successful call to this method, the SQLite core will
later invoke the <a href="vtab.html#xclose">xClose</a> method to destroy 
the allocated cursor.

</p><p>The xOpen method need not initialize the pVtab field of the
<a href="c3ref/vtab_cursor.html">sqlite3_vtab_cursor</a> structure.  The SQLite core will take care
of that chore automatically.

</p><p>A virtual table implementation must be able to support an arbitrary
number of simultaneously open cursors.

</p><p>When initially opened, the cursor is in an undefined state.
The SQLite core will invoke the <a href="vtab.html#xfilter">xFilter</a> method
on the cursor prior to any attempt to position or read from the cursor.

</p><p>The xOpen method is required for every virtual table implementation.

<a name="xclose"></a>

</p><h2 id="the_xclose_method"><span>2.7. </span>The xClose Method</h2>

<div class="codeblock"><pre>int (*xClose)(sqlite3_vtab_cursor*);
</pre></div>

<p>The xClose method closes a cursor previously opened by 
<a href="vtab.html#xopen">xOpen</a>. 
The SQLite core will always call xClose once for each cursor opened 
using xOpen.

</p><p>This method must release all resources allocated by the
corresponding xOpen call. The routine will not be called again even if it
returns an error.  The SQLite core will not use the
<a href="c3ref/vtab_cursor.html">sqlite3_vtab_cursor</a> again after it has been closed.

</p><p>The xClose method is required for every virtual table implementation.

<a name="xeof"></a>

</p><h2 id="the_xeof_method"><span>2.8. </span>The xEof Method</h2>

<div class="codeblock"><pre>int (*xEof)(sqlite3_vtab_cursor*);
</pre></div>

<p>The xEof method must return false (zero) if the specified cursor 
currently points to a valid row of data, or true (non-zero) otherwise. 
This method is called by the SQL engine immediately after each 
<a href="vtab.html#xfilter">xFilter</a> and <a href="vtab.html#xnext">xNext</a> invocation.

</p><p>The xEof method is required for every virtual table implementation.

<a name="xfilter"></a>

</p><h2 id="the_xfilter_method"><span>2.9. </span>The xFilter Method</h2>

<div class="codeblock"><pre>int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr,
              int argc, sqlite3_value **argv);
</pre></div>

<p>This method begins a search of a virtual table. 
The first argument is a cursor opened by <a href="vtab.html#xopen">xOpen</a>. 
The next two arguments define a particular search index previously 
chosen by <a href="vtab.html#xbestindex">xBestIndex</a>. The specific meanings of idxNum and idxStr 
are unimportant as long as xFilter and xBestIndex agree on what 
that meaning is.

</p><p>The xBestIndex function may have requested the values of 
certain expressions using the aConstraintUsage[].argvIndex values 
of the <a href="c3ref/index_info.html">sqlite3_index_info</a> structure. 
Those values are passed to xFilter using the argc and argv parameters.

</p><p>If the virtual table contains one or more rows that match the
search criteria, then the cursor must be left point at the first row.
Subsequent calls to <a href="vtab.html#xeof">xEof</a> must return false (zero).
If there are no rows match, then the cursor must be left in a state 
that will cause the <a href="vtab.html#xeof">xEof</a> to return true (non-zero).
The SQLite engine will use
the <a href="vtab.html#xcolumn">xColumn</a> and <a href="vtab.html#xrowid">xRowid</a> methods to access that row content.
The <a href="vtab.html#xnext">xNext</a> method will be used to advance to the next row.

</p><p>This method must return <a href="rescode.html#ok">SQLITE_OK</a> if successful, or an sqlite 
<a href="rescode.html">error code</a> if an error occurs.

</p><p>The xFilter method is required for every virtual table implementation.

<a name="xnext"></a>

</p><h2 id="the_xnext_method"><span>2.10. </span>The xNext Method</h2>

<div class="codeblock"><pre>int (*xNext)(sqlite3_vtab_cursor*);
</pre></div>

<p>The xNext method advances a <a href="c3ref/vtab_cursor.html">virtual table cursor</a>
to the next row of a result set initiated by <a href="vtab.html#xfilter">xFilter</a>. 
If the cursor is already pointing at the last row when this 
routine is called, then the cursor no longer points to valid 
data and a subsequent call to the <a href="vtab.html#xeof">xEof</a> method must return true (non-zero). 
If the cursor is successfully advanced to another row of content, then
subsequent calls to <a href="vtab.html#xeof">xEof</a> must return false (zero).

</p><p>This method must return <a href="rescode.html#ok">SQLITE_OK</a> if successful, or an sqlite 
<a href="rescode.html">error code</a> if an error occurs.

</p><p>The xNext method is required for every virtual table implementation.

<a name="xcolumn"></a>

</p><h2 id="the_xcolumn_method"><span>2.11. </span>The xColumn Method</h2>

<div class="codeblock"><pre>int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int N);
</pre></div>

<p>The SQLite core invokes this method in order to find the value for 
the N-th column of the current row. N is zero-based so the first column 
is numbered 0. 
The xColumn method may return its result back to SQLite using one of the
following interface:

</p><p>
</p><ul>
<li> <a href="c3ref/result_blob.html">sqlite3_result_blob()</a>
</li><li> <a href="c3ref/result_blob.html">sqlite3_result_double()</a>
</li><li> <a href="c3ref/result_blob.html">sqlite3_result_int()</a>
</li><li> <a href="c3ref/result_blob.html">sqlite3_result_int64()</a>
</li><li> <a href="c3ref/result_blob.html">sqlite3_result_null()</a>
</li><li> <a href="c3ref/result_blob.html">sqlite3_result_text()</a>
</li><li> <a href="c3ref/result_blob.html">sqlite3_result_text16()</a>
</li><li> <a href="c3ref/result_blob.html">sqlite3_result_text16le()</a>
</li><li> <a href="c3ref/result_blob.html">sqlite3_result_text16be()</a>
</li><li> <a href="c3ref/result_blob.html">sqlite3_result_zeroblob()</a>
</li></ul>


<p>If the xColumn method implementation calls none of the functions above,
then the value of the column defaults to an SQL NULL.

</p><p>To raise an error, the xColumn method should use one of the result_text() 
methods to set the error message text, then return an appropriate
<a href="rescode.html">error code</a>.  The xColumn method must return <a href="rescode.html#ok">SQLITE_OK</a> on success.

</p><p>The xColumn method is required for every virtual table implementation.

<a name="xrowid"></a>

</p><h2 id="the_xrowid_method"><span>2.12. </span>The xRowid Method</h2>

<div class="codeblock"><pre>int (*xRowid)(sqlite3_vtab_cursor *pCur, sqlite_int64 *pRowid);
</pre></div>

<p>A successful invocation of this method will cause *pRowid to be
filled with the <a href="lang_createtable.html#rowid">rowid</a> of row that the
<a href="c3ref/vtab_cursor.html">virtual table cursor</a> pCur is currently pointing at.
This method returns <a href="rescode.html#ok">SQLITE_OK</a> on success.
It returns an appropriate <a href="rescode.html">error code</a> on failure.</p>

<p>The xRowid method is required for every virtual table implementation.

<a name="xupdate"></a>

</p><h2 id="the_xupdate_method"><span>2.13. </span>The xUpdate Method</h2>

<div class="codeblock"><pre>int (*xUpdate)(
  sqlite3_vtab *pVTab,
  int argc,
  sqlite3_value **argv,
  sqlite_int64 *pRowid
);
</pre></div>

<p>All changes to a virtual table are made using the xUpdate method.
This one method can be used to insert, delete, or update.

</p><p>The argc parameter specifies the number of entries in the argv array. 
The value of argc will be 1 for a pure delete operation or N+2 for an insert
or replace or update where N is the number of columns in the table.  
In the previous sentence, N includes any hidden columns.

</p><p>Every argv entry will have a non-NULL value in C but may contain the 
SQL value NULL.  In other words, it is always true that
<tt>argv&#91;i&#93;!=0</tt> for <b>i</b> between 0 and <tt>argc-1</tt>.
However, it might be the case that
<tt>sqlite3_value_type(argv&#91;i&#93;)==SQLITE_NULL</tt>.

</p><p>The argv[0] parameter is the <a href="lang_createtable.html#rowid">rowid</a> of a row in the virtual table 
to be deleted. If argv[0] is an SQL NULL, then no deletion occurs.

</p><p>The argv[1] parameter is the rowid of a new row to be inserted 
into the virtual table. If argv[1] is an SQL NULL, then the implementation 
must choose a rowid for the newly inserted row. Subsequent argv[] 
entries contain values of the columns of the virtual table, in the 
order that the columns were declared. The number of columns will
match the table declaration that the <a href="vtab.html#xconnect">xConnect</a> or <a href="vtab.html#xcreate">xCreate</a> method made 
using the <a href="c3ref/declare_vtab.html">sqlite3_declare_vtab()</a> call.  All hidden columns are included.

</p><p>When doing an insert without a rowid (argc>1, argv[1] is an SQL NULL),
on a virtual table that uses ROWID (but not on a <a href="vtab.html#worid">WITHOUT ROWID virtual table</a>),
the implementation must set *pRowid to the rowid of the newly inserted row; 
this will become the value returned by the <a href="c3ref/last_insert_rowid.html">sqlite3_last_insert_rowid()</a>
function. Setting this value in all the other cases is a harmless no-op;
the SQLite engine ignores the *pRowid return value if argc==1 or 
argv[1] is not an SQL NULL.

</p><p>Each call to xUpdate will fall into one of cases shown below.
Not that references to <b>argv&#91;i&#93;</b> mean the SQL value
held within the argv&#91;i&#93; object, not the argv&#91;i&#93;
object itself.

</p><blockquote>
<dl>
<dt><b>argc = 1 <br> argv[0] &ne; NULL</b>
</dt><dd><p>
DELETE: The single row with rowid or PRIMARY KEY equal to argv[0] is deleted. 
No insert occurs.

</p></dd><dt><b>argc &gt; 1 <br> argv[0] = NULL</b>
</dt><dd><p>
INSERT: A new row is inserted with column values taken from
argv[2] and following.  In a rowid virtual table, if argv[1] is an SQL NULL,
then a new unique rowid is generated automatically.  The argv[1] will be NULL
for a <a href="vtab.html#worid">WITHOUT ROWID virtual table</a>, in which case the implementation should
take the PRIMARY KEY value from the appropriate column in argv[2] and following.

</p></dd><dt><b>argc &gt; 1 <br> argv[0] &ne; NULL <br> argv[0] = argv[1]</b>
</dt><dd><p>
UPDATE:
The row with rowid or PRIMARY KEY argv[0] is updated with new values 
in argv[2] and following parameters.

</p></dd><dt><b>argc &gt; 1 <br> argv[0] &ne; NULL <br> argv[0] &ne; argv[1]</b>
</dt><dd><p>
UPDATE with rowid or PRIMARY KEY change:
The row with rowid or PRIMARY KEY argv[0] is updated with 
the rowid or PRIMARY KEY in argv[1] 
and new values in argv[2] and following parameters. This will occur 
when an SQL statement updates a rowid, as in the statement:
</p><blockquote>
   <a href="lang_update.html">UPDATE</a> table SET rowid=rowid+1 WHERE ...; 
</blockquote>
</dd></dl>
</blockquote>

<p>The xUpdate method must return <a href="rescode.html#ok">SQLITE_OK</a> if and only if it is
successful.  If a failure occurs, the xUpdate must return an appropriate
<a href="rescode.html">error code</a>.  On a failure, the pVTab->zErrMsg element may optionally
be replaced with error message text stored in memory allocated from SQLite 
using functions such as <a href="c3ref/mprintf.html">sqlite3_mprintf()</a> or <a href="c3ref/free.html">sqlite3_malloc()</a>.

</p><p>If the xUpdate method violates some constraint of the virtual table
(including, but not limited to, attempting to store a value of the wrong 
datatype, attempting to store a value that is too
large or too small, or attempting to change a read-only value) then the
xUpdate must fail with an appropriate <a href="rescode.html">error code</a>.

</p><p>If the xUpdate method is performing an UPDATE, then
<a href="c3ref/value_blob.html">sqlite3_value_nochange(X)</a> can be used to discover which columns
of the virtual table were actually modified by the UPDATE
statement.  The <a href="c3ref/value_blob.html">sqlite3_value_nochange(X)</a> interface returns
true for columns that do not change.
On every UPDATE, SQLite will first invoke
<a href="vtab.html#xcolumn">xColumn</a> separately for each unchanging column in the table to 
obtain the value for that column.  The <a href="vtab.html#xcolumn">xColumn</a> method can
check to see if the column is unchanged at the SQL level
by invoking <a href="c3ref/vtab_nochange.html">sqlite3_vtab_nochange()</a>.  If <a href="vtab.html#xcolumn">xColumn</a> sees that
the column is not being modified, it should return without setting 
a result using one of the <a href="c3ref/result_blob.html">sqlite3_result_xxxxx()</a>
interfaces.  Only in that case <a href="c3ref/value_blob.html">sqlite3_value_nochange()</a> will be
true within the xUpdate method.  If <a href="vtab.html#xcolumn">xColumn</a> does
invoke one or more <a href="c3ref/result_blob.html">sqlite3_result_xxxxx()</a>
interfaces, then SQLite understands that as a change in the value
of the column and the <a href="c3ref/value_blob.html">sqlite3_value_nochange()</a> call for that
column within xUpdate will return false.

</p><p>There might be one or more <a href="c3ref/vtab_cursor.html">sqlite3_vtab_cursor</a> objects open and in use 
on the virtual table instance and perhaps even on the row of the virtual
table when the xUpdate method is invoked.  The implementation of
xUpdate must be prepared for attempts to delete or modify rows of the table
out from other existing cursors.  If the virtual table cannot accommodate
such changes, the xUpdate method must return an <a href="rescode.html">error code</a>.

</p><p>The xUpdate method is optional.
If the xUpdate pointer in the <a href="c3ref/module.html">sqlite3_module</a> for a virtual table
is a NULL pointer, then the virtual table is read-only.


<a name="xfindfunction"></a>

</p><h2 id="the_xfindfunction_method"><span>2.14. </span>The xFindFunction Method</h2>

<div class="codeblock"><pre>int (*xFindFunction)(
  sqlite3_vtab *pVtab,
  int nArg,
  const char *zName,
  void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),
  void **ppArg
);
</pre></div>

<p>This method is called during <a href="c3ref/prepare.html">sqlite3_prepare()</a> to give the virtual
table implementation an opportunity to overload functions. 
This method may be set to NULL in which case no overloading occurs.

</p><p>When a function uses a column from a virtual table as its first 
argument, this method is called to see if the virtual table would 
like to overload the function. The first three parameters are inputs: 
the virtual table, the number of arguments to the function, and the 
name of the function. If no overloading is desired, this method
returns 0. To overload the function, this method writes the new 
function implementation into *pxFunc and writes user data into *ppArg 
and returns either 1 or a number between
<a href="c3ref/c_index_constraint_eq.html">SQLITE_INDEX_CONSTRAINT_FUNCTION</a> and 255.

</p><p>Historically, the return value from xFindFunction() was either zero
or one.  Zero means that the function is not overloaded and one means that
it is overload.  The ability to return values of 
<a href="c3ref/c_index_constraint_eq.html">SQLITE_INDEX_CONSTRAINT_FUNCTION</a> or greater was added in
version 3.25.0 (2018-09-15).  If xFindFunction returns
<a href="c3ref/c_index_constraint_eq.html">SQLITE_INDEX_CONSTRAINT_FUNCTION</a> or greater, than means that the function
takes two arguments and the function
can be used as a boolean in the WHERE clause of a query and that
the virtual table is able to exploit that function to speed up the query
result.  When xFindFunction returns <a href="c3ref/c_index_constraint_eq.html">SQLITE_INDEX_CONSTRAINT_FUNCTION</a> or 
larger, the value returned becomes the <a href="c3ref/index_info.html">sqlite3_index_info</a>.aConstraint.op
value for one of the constraints passed into <a href="vtab.html#xbestindex">xBestIndex()</a>.  The first
argument to the function is the column identified by 
aConstraint[].iColumn field of the constraint and the second argument to the
function is the value that will be passed into <a href="vtab.html#xfilter">xFilter()</a> (if the
aConstraintUsage[].argvIndex value is set) or the value returned from
<a href="c3ref/vtab_rhs_value.html">sqlite3_vtab_rhs_value()</a>.

</p><p>The <a href="geopoly.html">Geopoly module</a> is an example of a virtual table that makes use
of <a href="c3ref/c_index_constraint_eq.html">SQLITE_INDEX_CONSTRAINT_FUNCTION</a> to improve performance.
The xFindFunction() method for Geopoly returns
SQLITE_INDEX_CONSTRAINT_FUNCTION for the <a href="geopoly.html#goverlap">geopoly_overlap()</a> SQL function
and it returns
SQLITE_INDEX_CONSTRAINT_FUNCTION+1 for the <a href="geopoly.html#gwithin">geopoly_within()</a> SQL function.
This permits search optimizations for queries such as:

</p><div class="codeblock"><pre>SELECT * FROM geopolytab WHERE geopoly_overlap(_shape, $query_polygon);
SELECT * FROM geopolytab WHERE geopoly_within(_shape, $query_polygon);
</pre></div>

<p>Note that infix functions (<a href="lang_expr.html#like">LIKE</a>, <a href="lang_expr.html#glob">GLOB</a>, <a href="lang_expr.html#regexp">REGEXP</a>, and <a href="lang_expr.html#match">MATCH</a>) reverse 
the order of their arguments. So "like(A,B)" would normally work the same
as "B like A".
However, xFindFunction() always looks a the left-most argument, not
the first logical argument.
Hence, for the form "B like A", SQLite looks at the
left operand "B" and if that operand is a virtual table column
it invokes the xFindFunction() method on that virtual table.
But if the form "like(A,B)" is used instead, then SQLite checks
the A term to see if it is column of a virtual table and if so
it invokes the xFindFunction() method for the virtual table of
column A. 

</p><p>The function pointer returned by this routine must be valid for
the lifetime of the <a href="c3ref/vtab.html">sqlite3_vtab</a> object given in the first parameter.

<a name="xBegin"></a>

</p><h2 id="the_xbegin_method"><span>2.15. </span>The xBegin Method</h2>

<div class="codeblock"><pre>int (*xBegin)(sqlite3_vtab *pVTab);
</pre></div>

<p>This method begins a transaction on a virtual table.
This is method is optional.  The xBegin pointer of <a href="c3ref/module.html">sqlite3_module</a>
may be NULL.

</p><p>This method is always followed by one call to either the
<a href="vtab.html#xcommit">xCommit</a> or <a href="vtab.html#xrollback">xRollback</a> method.  Virtual table transactions do
not nest, so the xBegin method will not be invoked more than once
on a single virtual table
without an intervening call to either <a href="vtab.html#xcommit">xCommit</a> or <a href="vtab.html#xrollback">xRollback</a>.
Multiple calls to other methods can and likely will occur in between
the xBegin and the corresponding <a href="vtab.html#xcommit">xCommit</a> or <a href="vtab.html#xrollback">xRollback</a>.

<a name="xsync"></a>

</p><h2 id="the_xsync_method"><span>2.16. </span>The xSync Method</h2>

<div class="codeblock"><pre>int (*xSync)(sqlite3_vtab *pVTab);
</pre></div>


<p>This method signals the start of a two-phase commit on a virtual
table.
This is method is optional.  The xSync pointer of <a href="c3ref/module.html">sqlite3_module</a>
may be NULL.

</p><p>This method is only invoked after call to the <a href="vtab.html#xBegin">xBegin</a> method and
prior to an <a href="vtab.html#xcommit">xCommit</a> or <a href="vtab.html#xrollback">xRollback</a>.  In order to implement two-phase
commit, the xSync method on all virtual tables is invoked prior to
invoking the <a href="vtab.html#xcommit">xCommit</a> method on any virtual table.  If any of the 
xSync methods fail, the entire transaction is rolled back.

<a name="xcommit"></a>

</p><h2 id="the_xcommit_method"><span>2.17. </span>The xCommit Method</h2>

<div class="codeblock"><pre>int (*xCommit)(sqlite3_vtab *pVTab);
</pre></div>

<p>This method causes a virtual table transaction to commit.
This is method is optional.  The xCommit pointer of <a href="c3ref/module.html">sqlite3_module</a>
may be NULL.

</p><p>A call to this method always follows a prior call to <a href="vtab.html#xBegin">xBegin</a> and
<a href="vtab.html#xsync">xSync</a>.


<a name="xrollback"></a>

</p><h2 id="the_xrollback_method"><span>2.18. </span>The xRollback Method</h2>

<div class="codeblock"><pre>int (*xRollback)(sqlite3_vtab *pVTab);
</pre></div>

<p>This method causes a virtual table transaction to rollback.
This is method is optional.  The xRollback pointer of <a href="c3ref/module.html">sqlite3_module</a>
may be NULL.

</p><p>A call to this method always follows a prior call to <a href="vtab.html#xBegin">xBegin</a>.


<a name="xrename"></a>

</p><h2 id="the_xrename_method"><span>2.19. </span>The xRename Method</h2>

<div class="codeblock"><pre>int (*xRename)(sqlite3_vtab *pVtab, const char *zNew);
</pre></div>

<p>This method provides notification that the virtual table implementation
that the virtual table will be given a new name. 
If this method returns <a href="rescode.html#ok">SQLITE_OK</a> then SQLite renames the table.
If this method returns an <a href="rescode.html">error code</a> then the renaming is prevented.

</p><p>The xRename method is optional.  If omitted, then the virtual
table may not be renamed using the ALTER TABLE RENAME command.

</p><p>The <a href="pragma.html#pragma_legacy_alter_table">PRAGMA legacy_alter_table</a> setting is enabled prior to invoking this
method, and the value for legacy_alter_table is restored after this
method finishes.  This is necessary for the correct operation of virtual
tables that make use of <a href="vtab.html#xshadowname">shadow tables</a> where the shadow tables must be
renamed to match the new virtual table name.  If the legacy_alter_format is
off, then the xConnect method will be invoked for the virtual table every
time the xRename method tries to change the name of the shadow table.

<a name="xsavepoint"></a>

</p><h2 id="the_xsavepoint_xrelease_and_xrollbackto_methods"><span>2.20. </span>The xSavepoint, xRelease, and xRollbackTo Methods</h2>

<div class="codeblock"><pre>int (*xSavepoint)(sqlite3_vtab *pVtab, int);
int (*xRelease)(sqlite3_vtab *pVtab, int);
int (*xRollbackTo)(sqlite3_vtab *pVtab, int);
</pre></div>

<p>
These methods provide the virtual table implementation an opportunity to
implement nested transactions.  They are always optional and will only be
called in SQLite <a href="releaselog/3_7_7.html">version 3.7.7</a> (2011-06-23) and later.
</p>

<p>
When xSavepoint(X,N) is invoked, that is a signal to the virtual table X
that it should save its current state as savepoint N.  
A subsequent call
to xRollbackTo(X,R) means that the state of the virtual table should return
to what it was when xSavepoint(X,R) was last called.  
The call
to xRollbackTo(X,R) will invalidate all savepoints with N>R; none of the
invalided savepoints will be rolled back or released without first
being reinitialized by a call to xSavepoint().  
A call to xRelease(X,M) invalidates all savepoints where N>=M.
</p>

<p>
None of the xSavepoint(), xRelease(), or xRollbackTo() methods will ever
be called except in between calls to xBegin() and 
either xCommit() or xRollback().
</p>

<a name="xshadowname"></a>

<h2 id="the_xshadowname_method"><span>2.21. </span>The xShadowName Method</h2>

<p>Some virtual table implementations (ex: <a href="fts3.html">FTS3</a>, <a href="fts5.html">FTS5</a>, and <a href="rtree.html">RTREE</a>) make
use of real (non-virtual) database tables to store content.  For example,
when content is inserted into the FTS3 virtual table, the data is ultimately
stored in real tables named "%_content", "%_segdir", "%_segments", "%_stat",
and "%_docsize" where "%" is the name of the original virtual table.  This
auxiliary real tables that store content for a virtual table are called
"shadow tables".  See
(<a href="fts3.html#*shadowtab">1</a>),
(<a href="fts5.html#fts5shadowtables">2</a>), and
(<a href="rtree.html#xshadow">3</a>) for additional information.

</p><p>The xShadowName method exists to allow SQLite to determine whether a
certain real table is in fact a shadow table for a virtual table.

</p><p>SQLite understands a real table to be a shadow table if all of
the following are true:
</p><p>
</p><ul>
<li> The name of the table contains one or more "_" characters.
</li><li> The part of the name prior to the last "_" exactly matches
     the name of a virtual table that was created using <a href="lang_createvtab.html">CREATE VIRTUAL TABLE</a>.
     (Shadow tables are not recognized for <a href="vtab.html#epovtab">eponymous virtual tables</a>
     and <a href="vtab.html#tabfunc2">table-valued functions</a>.)
</li><li> The virtual table contains an xShadowName method.
</li><li> The xShadowName method returns true when its input is the part
     of the table name past the last "_" character.
</li></ul>

<p>
If SQLite recognizes a table as a shadow table, and if the
<a href="c3ref/c_dbconfig_defensive.html#sqlitedbconfigdefensive">SQLITE_DBCONFIG_DEFENSIVE</a> flag is set, then the shadow table is read-only
for ordinary SQL statements.  The shadow table can still be written, but
only by SQL that is invoked from within one of the methods of
some virtual table implementation.

</p><p>
The whole point of the xShadowName method is to protect the content of
shadow tables from being corrupted by hostile SQL.  Every virtual table
implementation that uses shadow tables should be able to detect and cope
with corrupted shadow table content.  However, bugs in particular virtual 
table implementation might allow a deliberately corrupted shadow table to
cause a crash or other malfunction.  The xShadowName mechanism seeks to 
avoid zero-day exploits by preventing ordinary SQL statements from
deliberately corrupting shadow tables.

</p><p>
Shadow tables are read/write by default.
Shadow tables only become read-only when the <a href="c3ref/c_dbconfig_defensive.html#sqlitedbconfigdefensive">SQLITE_DBCONFIG_DEFENSIVE</a>
flag is set using <a href="c3ref/db_config.html">sqlite3_db_config()</a>.
Shadow tables need to be read/write by default in order to maintain
backwards compatibility.
For example, the SQL text generated by the <a href="cli.html#dump">.dump</a> command of the <a href="cli.html">CLI</a>
writes directly into shadow tables.

<a name="xintegrity"></a>

</p><h2 id="the_xintegrity_method"><span>2.22. </span>The xIntegrity Method</h2>

<p>
If the iVersion for an sqlite3_module is 4 or more and the xIntegrity
method is not NULL, then the <a href="pragma.html#pragma_integrity_check">PRAGMA integrity_check</a> and
<a href="pragma.html#pragma_quick_check">PRAGMA quick_check</a> commands will invoke
xIntegrity as part of its processing.  If the xIntegrity method writes
an error message string into the fifth parameter, then PRAGMA integrity_check
will report that error as part of its output.  So, in other words, the
xIntegrity method allows the <a href="pragma.html#pragma_integrity_check">PRAGMA integrity_check</a> command to verify
the integrity of content stored in a virtual table.

</p><p>
The xIntegrity method is called with five parameters:

</p><ul>
<li><b>pVTab</b> &rarr; A pointer to the <a href="c3ref/vtab.html">sqlite3_vtab</a> object that is the
    virtual table being checked.
</li><li><b>zSchema</b> &rarr; The name of the schema ("main", "temp", etc.) in which
    the virtual table is defined.
</li><li><b>zTabName</b> &rarr; The name of the virtual table.
</li><li><b>mFlags</b> &rarr; A flag to indicate whether this is an "integrity_check"
    or a "quick_check".  Currently, this parameter will always be either 0 or 1,
    though future versions of SQLite might use other bits of the integer to
    indicate additional processing options.
</li><li><b>pzErr</b> &rarr;  This parameter points to a "char*" that is initialized
    to NULL. The xIntegrity() implementation should make *pzErr point to
    an error string obtained from sqlite3_malloc() or equivalent if it finds
    any problems.
</li></ul>

<p>
The xIntegrity method should normally return SQLITE_OK - even if it finds
problems in the content of the virtual table.  Any other error code
means that the xIntegrity method itself encountered problems while trying
to evaluate the virtual table content.  So, for example, if the inverted
index for <a href="fts5.html">FTS5</a> is found to be internally inconsistent, then the xIntegrity
method should write an appropriate error message into the pzErr parameter
and return SQLITE_OK.  But if the xIntegrity method is unable to complete its
evaluation of the virtual table content due to running out of memory, then
it should return SQLITE_NOMEM.

</p><p>
If an error message is generated,
space to hold the error message string should be obtained from <a href="c3ref/free.html">sqlite3_malloc64()</a>
or the equivalent.  Ownership of the error message string will pass to the
SQLite core when xIntegrity returns.  The core will make sure that
<a href="c3ref/free.html">sqlite3_free()</a> is invoked to reclaim the memory which it has finished
with the error message.  The PRAGMA integrity_check command that invokes the
xIntegrity method does not change the returned error message.  The xIntegrity
method itself should include the name of the virtual table as part of the
message.  The zSchema and zName parameters are provided to make that easier.

</p><p>
The mFlags parameter is currently a boolean value (either 0 or 1) that indicates
if the xIntegrity method was called due to <a href="pragma.html#pragma_integrity_check">PRAGMA integrity_check</a> (mFlags==0)
or due to <a href="pragma.html#pragma_quick_check">PRAGMA quick_check</a> (mFlags==1).  Generally speaking, the xIntegrity
method should do whatever validity checking it can accomplish in linear time
regardless, but only do checking that requires superlinear time if
<tt>(mFlags&1)==0</tt>.  Future versions of SQLite might
use higher-order bits of the mFlags parameter to indicate additional
processing options.

</p><p>
Support for the
xIntegrity method was added in SQLite version 3.44.0 (2023-11-01).
In that same release, the xIntegrity method was added to many built-in
virtual tables, such as <a href="fts3.html">FTS3</a>, <a href="fts5.html">FTS5</a>, and <a href="rtree.html">RTREE</a> so that the content
of those tables will henceforth be automatically checked for consistency
when <a href="pragma.html#pragma_integrity_check">PRAGMA integrity_check</a> is run.
</p><p align="center"><small><i>This page last modified on  <a href="https://sqlite.org/docsrc/honeypot" id="mtimelink"  data-href="https://sqlite.org/docsrc/finfo/pages/vtab.in?m=45e542fb54">2023-12-05 14:43:20</a> UTC </small></i></p>

Added Doc/buildChm.tcl.





































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
###############################################################################
#
# buildChm.tcl -- CHM Build Wrapper & Post-Procssing Tool
#
# WARNING: This tool requires that the "HTML Help Workshop" and "NDoc3"
#          applications are installed to their default locations.
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

proc readFile { fileName } {
  set file_id [open $fileName RDONLY]
  fconfigure $file_id -encoding binary -translation binary
  set result [read $file_id]
  close $file_id
  return $result
}

proc writeFile { fileName data } {
  set file_id [open $fileName {WRONLY CREAT TRUNC}]
  fconfigure $file_id -encoding binary -translation binary
  puts -nonewline $file_id $data
  close $file_id
  return ""
}

proc escapeSubSpec { data } {
  regsub -all -- {&} $data {\\\&} data
  regsub -all -- {\\(\d+)} $data {\\\\\1} data
  return $data
}

proc readFileAsSubSpec { fileName } {
  return [escapeSubSpec [readFile $fileName]]
}

proc getFileHash { fileName } {
  if {[catch {
    exec fossil.exe sha1sum [file nativename $fileName]
  } result] == 0} then {
    return [string trim [lindex [split $result " "] 0]]
  }
  return ""
}

#
# NOTE: This procedure unescapes certain HTML tags that are used within the
#       documentation for the virtual table methods.
#
proc unescapeHtmlTags { fileName cdata } {
  #
  # NOTE: Read all the textual data from the file.
  #
  set data [readFile $fileName]

  #
  # NOTE: No replacements made yet.
  #
  set count 0

  #
  # NOTE: If requested by the caller, unwrap all content contained with XML
  #       CDATA sections as well.
  #
  if {$cdata} then {
    #
    # NOTE: Grab everything within the CDATA tags and use verbatim.
    #
    incr count [regsub -all -- {<![CDATA[(.*?)]]>} $data {\1} data]
  }

  #
  # TODO: Handle all the HTML tags we know may be present in the virtual
  #       table method documentation.  This may need adjustments in the
  #       future.
  #
  foreach to [list \
      {<b>} {</b>} {<br>} {<dd>} {</dd>} {<dl>} {</dl>} {<dt>} \
      {</dt>} {<li>} {</li>} {<ol>} {</ol>} {<tt>} {</tt>} \
      {<ul>} {</ul>}] {
    #
    # NOTE: Figure out the escaped form of this tag and then replace it
    #       with the unescaped form.
    #
    set from [string map [list < &lt\; > &gt\;] $to]
    incr count [regsub -all -- $from $data $to data]
  }

  #
  # NOTE: Issue a warning if the HTML tag patterns were not matched.
  #
  if {$count == 0} then {
    puts stdout "*WARNING* File \"$fileName\" has no supported HTML tags"
  }

  #
  # NOTE: If some replacements were performed on the data from the file,
  #       then overwrite it with the new data.
  #
  if {$count > 0} then {
    writeFile $fileName $data
  }
}

#
# HACK: This procedure checks all the "href" attribute values in the specified
#       core documentation file.  For each value, this procedure checks if the
#       reference conforms to one of the following general categories:
#
#       1. A relative reference to a named anchor within the same document.
#       2. An absolute reference using HTTP or HTTPS.
#       3. A relative reference to an existing local file.
#       4. An absolute reference to a local file.
#
#       Otherwise, this procedure transforms the "href" attribute value into
#       an absolute reference using the specified base URL.
#
proc transformCoreDocumentationFile { fileName url } {
  #
  # NOTE: Grab the name of the directory containing the file.
  #
  set directory [file dirname $fileName]

  #
  # NOTE: Read all the textual data from the file.
  #
  set data [readFile $fileName]

  #
  # NOTE: No replacements made yet.
  #
  set count 0

  #
  # NOTE: Remove references to "!location.origin.match(/http/)" because the
  #       "match" property does not work in the CHM viewer.  Use the literal
  #       string syntax supported by the regular expression engine here.
  #
  set pattern(1) "***=!location.origin.match || !location.origin.match(/http/)"
  set subSpec(1) 1

  #
  # NOTE: Remove the (superfluous) anti-robot script.
  #
  set pattern(2) {var antiRobot.*antiRobotDefense\(\);}
  set subSpec(2) ""

  #
  # NOTE: In Internet Explorer, you cannot set the innerHTML property for
  #       some DOM elements, e.g. <tr>; therefore, remove those elements.
  #
  set pattern(3) "<table id='(.*?)' width='100%'></table>"
  set subSpec(3) {<div id='\1'></div>}
  set pattern(4) {***="<tr><td><ul class='multicol_list'>"}
  set subSpec(4) {"<ul class='multicol_list'>"}
  set pattern(5) {***="</ul></td>\n<td><ul class='multicol_list'>\n"}
  set subSpec(5) {""}
  set pattern(6) {***=<html><head>}
  set subSpec(6) {<html><head><meta http-equiv="X-UA-Compatible" content="IE=edge">}
  set pattern(7) {( viewBox="0 0 (\d+(?:\.\d+)?) (\d+(?:\.\d+)?)")>}; # SVG
  set subSpec(7) {\1 width="\2" height="\3">}

  #
  # NOTE: Perform the replacements, if any, keeping track of how many were
  #       done.
  #
  incr count [regsub -all -- $pattern(1) $data $subSpec(1) data]
  incr count [regsub -all -- $pattern(2) $data $subSpec(2) data]
  incr count [regsub -all -- $pattern(3) $data $subSpec(3) data]
  incr count [regsub -all -- $pattern(4) $data $subSpec(4) data]
  incr count [regsub -all -- $pattern(5) $data $subSpec(5) data]
  incr count [regsub -all -- $pattern(6) $data $subSpec(6) data]
  incr count [regsub -all -- $pattern(7) $data $subSpec(7) data]

  #
  # NOTE: Process all "href" attribute values from the data.  This pattern is
  #       not univeral; however, as of this writing (Feb 2014), the core docs
  #       are using it consistently.
  #
  set hrefCount 0
  set pattern(8) {href=['"](.*?)['"]}

  foreach {dummy href} [regexp -all -inline -nocase -- $pattern(8) $data] {
    #
    # NOTE: Skip all references to other items on this page.
    #
    if {[string index $href 0] eq "#"} then {
      continue
    }

    #
    # NOTE: Skip all absolute HTTP/HTTPS references.
    #
    if {[string range $href 0 6] eq "http://" || \
        [string range $href 0 7] eq "https://"} then {
      continue
    }

    #
    # NOTE: Split on the "#" character to get the file name.  There are some
    #       places within the core docs that refer to named anchors within
    #       other files.
    #
    set parts [split $href #]; set part1 [lindex $parts 0]

    #
    # NOTE: If there is no file name part, skip the reference.
    #
    if {[string length $part1] == 0} then {
      continue
    }

    #
    # NOTE: If it does not appear to be relative, skip it.
    #
    if {[file pathtype $part1] ne "relative"} then {
      continue
    }

    #
    # NOTE: If the referenced file name exists locally, skip it.
    #
    if {[file exists [file join $directory $part1]]} then {
      continue
    }

    #
    # NOTE: Replace the reference with an absolute reference using the base
    #       URL specified by the caller, escaping it as necessary for use
    #       with [regsub].  Use the literal string syntax supported by the
    #       regular expression engine here.
    #
    set pattern(9) "***=$dummy"
    set subSpec(9) "href=\"[escapeSubSpec $url$href]\""

    #
    # NOTE: Perform the replacements, if any, keeping track of how many were
    #       done.
    #
    incr hrefCount [regsub -all -- $pattern(9) $data $subSpec(9) data]
  }

  #
  # NOTE: Issue a warning if the "href" pattern was not matched.
  #
  if {$hrefCount > 0} then {
    incr count $hrefCount
  } else {
    puts stdout "*WARNING* File \"$fileName\" does not match: href=\"(.*?)\""
  }

  #
  # NOTE: Process all "src" attribute values from the data.  This pattern is
  #       not univeral; however, as of this writing (Feb 2020), the core docs
  #       are using it consistently.
  #
  set pattern(10) {src=['"](.*?)['"]}

  foreach {dummy src} [regexp -all -inline -nocase -- $pattern(10) $data] {
    #
    # NOTE: Skip all absolute HTTP/HTTPS references.
    #
    if {[string range $src 0 6] eq "http://" || \
        [string range $src 0 7] eq "https://"} then {
      continue
    }

    #
    # NOTE: If the referenced file name exists locally, skip it.
    #
    if {[file exists [file join $directory $src]]} then {
      continue
    }

    #
    # NOTE: Issue a warning if the "src" file was not found locally.
    #
    puts stdout "*WARNING* File \"$fileName\" has missing source: $src"
  }

  #
  # NOTE: If some replacements were performed on the data from the file,
  #       then overwrite it with the new data.
  #
  if {$count > 0} then {
    writeFile $fileName $data
  }
}

proc copyFile { sourceDirectory destinationDirectory fileNameOnly } {
  set sourceFileName [file join $sourceDirectory bin $fileNameOnly]
  set destinationFileName [file join $destinationDirectory bin $fileNameOnly]

  set sourceFileHash [getFileHash $sourceFileName]
  # puts stdout "Hashed \"$sourceFileName\" ==> \"$sourceFileHash\""

  set destinationFileHash [getFileHash $destinationFileName]
  # puts stdout "Hashed \"$destinationFileName\" ==> \"$destinationFileHash\""

  if {[string length $sourceFileHash] > 0 && \
      [string length $destinationFileHash] > 0 && \
      $sourceFileHash ne $destinationFileHash} then {
    if {[catch {
      file copy -force $destinationFileName $destinationFileName.bak
      file copy -force $sourceFileName $destinationFileName
    } result] == 0} then {
      puts stdout \
          "finished copying \"$sourceFileName\" to \"$destinationFileName\""
    } else {
      puts stdout $result
    }
  } else {
    puts stdout \
        "skipped copying \"$sourceFileName\" to \"$destinationFileName\""
  }
}

#
# NOTE: This is the entry point for this script.
#
set path [file normalize [file dirname [info script]]]
set nDocExtPath [file join [file dirname $path] Externals NDoc3]

if {[info exists env(ProgramFiles\(x86\))]} then {
  set programFiles $env(ProgramFiles\(x86\))
  set needConsoleExe true
} else {
  set programFiles $env(ProgramFiles)
  set needConsoleExe false
}

set nDocInstPath [file join $programFiles NDoc3]

if {![file isdirectory $nDocInstPath]} then {
  puts stdout "NDoc3 must be installed to: $nDocInstPath"
  exit 1
}

set hhcPath [file join $programFiles "HTML Help Workshop"]

if {![file isdirectory $hhcPath]} then {
  puts stdout "HTML Help Workshop must be installed to: $hhcPath"
  exit 1
}

#
# NOTE: Build the name of the NDoc project file.
#
set projectFile [file join $path SQLite.NET.ndoc]

if {![file exists $projectFile]} then {
  puts stdout "Cannot find NDoc3 project file: $projectFile"
  exit 1
}

#
# NOTE: Extract the name of the XML doc file that will be used to build
#       the final CHM file from the NDoc project file.
#
set data [readFile $projectFile]

if {[string length $data] == 0} then {
  puts stdout "NDoc3 project file contains no data: $projectFile"
  exit 1
}

if {![regexp -- { documentation="(.*?)" } $data dummy xmlDocFile]} then {
  puts stdout "Cannot find XML doc file name in NDoc3 project file:\
               $projectFile"
  exit 1
}

if {[string length $xmlDocFile] == 0 || ![file exists $xmlDocFile]} then {
  puts stdout "Cannot find XML doc file: $xmlDocFile"
  exit 1
}

set data [readFile $xmlDocFile]
set count 0

set pattern { cref="([A-Z]):System\.Data\.SQLite\.}
incr count [regsub -all -- $pattern $data { cref="\1:system.Data.SQLite.} data]

if {$count > 0} then {
  writeFile $xmlDocFile $data
} else {
  puts stdout "*WARNING* File \"$xmlDocFile\" does not match: $pattern"
}

#
# TODO: If the NDoc version number ever changes, the next line of code will
#       probably need to be updated.
#
set outputPath [file join Output]
set temporaryPath [file join $outputPath ndoc3_msdn_temp]
set corePath [file join $temporaryPath Core]
set coreSyntaxPath [file join $corePath syntax]
set providerPath [file join $temporaryPath Provider]

#
# HACK: Copy our local [fixed] copy of the MSDN documenter assembly into the
#       installed location of NDoc3, if necessary.  Actually copying the file
#       will require elevated administrator privileges; otherwise, it will
#       fail.  Any errors encountered while copying the file are reported via
#       the console; however, they will not halt further processing (i.e. the
#       CHM file will probably still get built, but it may contain some links
#       to built-in types that are blank).
#
if {[file isdirectory $nDocExtPath]} then {
  copyFile $nDocExtPath $nDocInstPath NDoc3.Documenter.Msdn.dll
}

#
# HACK: If necessary, copy our 32-bit only version of the NDoc3 executable;
#       without this, it will be unable to locate the "HTML Help Workshop"
#       directory within the "Program Files (x86)" directory.
#
if {$needConsoleExe} then {
  copyFile $nDocExtPath $nDocInstPath NDoc3Console.exe
}

set code [catch {exec [file join $nDocInstPath bin NDoc3Console.exe] \
    "-project=[file nativename $projectFile]"} result]

puts stdout $result; if {$code != 0} then {exit $code}

###############################################################################

foreach fileName [glob -nocomplain [file join $corePath *.html]] {
  set fileName [file join $path $fileName]

  if {![file isfile $fileName]} then {
    puts stdout "Cannot find core file: $fileName"
    exit 1
  }

  transformCoreDocumentationFile $fileName https://www.sqlite.org/
}

###############################################################################

foreach fileName [glob -nocomplain [file join $coreSyntaxPath *.html]] {
  set fileName [file join $path $fileName]

  if {![file isfile $fileName]} then {
    puts stdout "Cannot find core syntax file: $fileName"
    exit 1
  }

  transformCoreDocumentationFile $fileName https://www.sqlite.org/
}

###############################################################################

foreach fileName [glob -nocomplain [file join $temporaryPath \
    System.Data.SQLite~System.Data.SQLite.ISQLiteNativeModule*.html]] {
  set fileName [file join $path $fileName]

  if {![file isfile $fileName]} then {
    puts stdout "Cannot find temporary provider file: $fileName"
    exit 1
  }

  unescapeHtmlTags $fileName false
}

###############################################################################

set patterns(.hhc,1) {<!--This document contains Table of Contents information\
for the HtmlHelp compiler\.--><UL>}

set patterns(.hhp,1) {Default topic=~System\.Data\.SQLite\.html}

set patterns(.hhp,2) \
    {"~System\.Data\.SQLite\.html","~System\.Data\.SQLite\.html",,,,,}

set patterns(.html,1) \
    {"http://msdn\.microsoft\.com/en-us/library/(System\.Data\.SQLite\.(?:.*?))\(VS\.\d+\)\.aspx"}

set patterns(.html,2) {System.Collections.Generic.IEnumerable`1}
set patterns(.html,3) {System.Collections.Generic.IEnumerator`1}

set patterns(.html,4) \
    {"(System\.Data\.SQLite~System\.Data\.SQLite\.SQLiteFunction\.Dispose)\.html"}

set patterns(.html,5) \
    {"(System\.Data\.SQLite~System\.Data\.SQLite\.SQLiteModule\.SetEstimatedCost)\.html"}

set patterns(.html,6) \
    {"(System\.Data\.SQLite~System\.Data\.SQLite\.SQLiteModule\.SetTableError)\.html"}

set patterns(.html,7) \
    {"(System\.Data\.SQLite~System\.Data\.SQLite\.SQLiteModule\.Dispose)\.html"}

set patterns(.html,8) \
    {"(System\.Data\.SQLite~System\.Data\.SQLite\.SQLiteVirtualTableCursor\.Dispose)\.html"}

set patterns(.html,9) \
    {"(System\.Data\.SQLite~System\.Data\.SQLite\.ISQLiteManagedModule\.[^(]+)\((?:[^)]+)\)\.html"}

set subSpecs(.hhc,1) [readFileAsSubSpec [file join $path SQLite.NET.hhc]]

set subSpecs(.hhp,1) {Default topic=Provider\welcome.html}
set subSpecs(.hhp,2) {"Provider\welcome.html","Provider\welcome.html",,,,,}

set subSpecs(.html,1) {"System.Data.SQLite~\1.html"}
set subSpecs(.html,2) {9eekhta0}
set subSpecs(.html,3) {78dfe2yb}
set subSpecs(.html,4) {"\1~Overloads.html"}
set subSpecs(.html,5) {"\1~Overloads.html"}
set subSpecs(.html,6) {"\1~Overloads.html"}
set subSpecs(.html,7) {"\1~Overloads.html"}
set subSpecs(.html,8) {"\1~Overloads.html"}
set subSpecs(.html,9) {"\1.html"}

###############################################################################

set fileNames [list \
    [file join $temporaryPath SQLite.NET.hhp] \
    [file join $temporaryPath SQLite.NET.hhc]]

foreach fileName [glob -nocomplain [file join $providerPath *.html]] {
  lappend fileNames $fileName
}

foreach fileName [glob -nocomplain [file join $temporaryPath *.html]] {
  lappend fileNames $fileName
}

foreach fileName $fileNames {
  set fileName [file join $path $fileName]

  #
  # NOTE: Make sure the file we need actually exists.
  #
  if {![file isfile $fileName]} then {
    puts stdout "Cannot find provider file: $fileName"
    exit 1
  }

  #
  # NOTE: Read the entire file into memory.
  #
  set data [readFile $fileName]

  #
  # NOTE: No replacements have been performed yet.
  #
  set count 0

  foreach name [lsort [array names patterns [file extension $fileName],*]] {
    set pattern $patterns($name)
    set subSpec ""

    if {[info exists subSpecs($name)]} then {
      set subSpec $subSpecs($name)
    }

    set patternCount [regsub -all -- $pattern $data $subSpec data]

    if {$patternCount > 0} then {
      incr count $patternCount
    } else {
      #
      # NOTE: This will emit multiple warnings for each file, making things
      #       a bit too noisy (by default).
      #
      # puts stdout "*WARNING* File \"$fileName\" does not match: $pattern"
    }
  }

  #
  # NOTE: If we actually performed some replacements, rewrite the file.
  #
  if {$count > 0} then {
    writeFile $fileName $data
  }
}

set code [catch {exec [file join $hhcPath hhc.exe] \
    [file nativename [file join $path $temporaryPath SQLite.NET.hhp]]} result]

#
# NOTE: For hhc.exe, zero means failure.
#
puts stdout $result; if {$code == 0} then {exit 1}

file copy -force [file join $path $temporaryPath SQLite.NET.chm] \
    [file join $path SQLite.NET.chm]

puts stdout SUCCESS
exit 0

Added Doc/sync.eagle.













































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
###############################################################################
#
# sync.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

set fileNames [list \
    [file join json1.html] \
    [file join lang.html] \
    [file join lang_aggfunc.html] \
    [file join lang_altertable.html] \
    [file join lang_analyze.html] \
    [file join lang_attach.html] \
    [file join lang_comment.html] \
    [file join lang_conflict.html] \
    [file join lang_corefunc.html] \
    [file join lang_createindex.html] \
    [file join lang_createtable.html] \
    [file join lang_createtrigger.html] \
    [file join lang_createview.html] \
    [file join lang_createvtab.html] \
    [file join lang_datefunc.html] \
    [file join lang_delete.html] \
    [file join lang_detach.html] \
    [file join lang_dropindex.html] \
    [file join lang_droptable.html] \
    [file join lang_droptrigger.html] \
    [file join lang_dropview.html] \
    [file join lang_explain.html] \
    [file join lang_expr.html] \
    [file join lang_indexedby.html] \
    [file join lang_insert.html] \
    [file join lang_keywords.html] \
    [file join lang_mathfunc.html] \
    [file join lang_naming.html] \
    [file join lang_reindex.html] \
    [file join lang_replace.html] \
    [file join lang_returning.html] \
    [file join lang_savepoint.html] \
    [file join lang_select.html] \
    [file join lang_transaction.html] \
    [file join lang_update.html] \
    [file join lang_upsert.html] \
    [file join lang_vacuum.html] \
    [file join lang_with.html] \
    [file join pragma.html] \
    [file join sqlite.css] \
    [file join syntax.html] \
    [file join syntaxdiagrams.html] \
    [file join vtab.html] \
    [file join images sqlite370_banner.gif] \
    [file join syntax aggregate-function-invocation.html] \
    [file join syntax alter-table-stmt.html] \
    [file join syntax analyze-stmt.html] \
    [file join syntax attach-stmt.html] \
    [file join syntax begin-stmt.html] \
    [file join syntax column-constraint.html] \
    [file join syntax column-def.html] \
    [file join syntax column-name-list.html] \
    [file join syntax comment-syntax.html] \
    [file join syntax commit-stmt.html] \
    [file join syntax common-table-expression.html] \
    [file join syntax compound-operator.html] \
    [file join syntax compound-select-stmt.html] \
    [file join syntax conflict-clause.html] \
    [file join syntax create-index-stmt.html] \
    [file join syntax create-table-stmt.html] \
    [file join syntax create-trigger-stmt.html] \
    [file join syntax create-view-stmt.html] \
    [file join syntax create-virtual-table-stmt.html] \
    [file join syntax cte-table-name.html] \
    [file join syntax delete-stmt-limited.html] \
    [file join syntax delete-stmt.html] \
    [file join syntax detach-stmt.html] \
    [file join syntax drop-index-stmt.html] \
    [file join syntax drop-table-stmt.html] \
    [file join syntax drop-trigger-stmt.html] \
    [file join syntax drop-view-stmt.html] \
    [file join syntax expr.html] \
    [file join syntax factored-select-stmt.html] \
    [file join syntax filter-clause.html] \
    [file join syntax foreign-key-clause.html] \
    [file join syntax frame-spec.html] \
    [file join syntax indexed-column.html] \
    [file join syntax insert-stmt.html] \
    [file join syntax join-clause.html] \
    [file join syntax join-constraint.html] \
    [file join syntax join-operator.html] \
    [file join syntax literal-value.html] \
    [file join syntax numeric-literal.html] \
    [file join syntax ordering-term.html] \
    [file join syntax over-clause.html] \
    [file join syntax pragma-stmt.html] \
    [file join syntax pragma-value.html] \
    [file join syntax qualified-table-name.html] \
    [file join syntax raise-function.html] \
    [file join syntax recursive-cte.html] \
    [file join syntax reindex-stmt.html] \
    [file join syntax release-stmt.html] \
    [file join syntax result-column.html] \
    [file join syntax returning-clause.html] \
    [file join syntax rollback-stmt.html] \
    [file join syntax savepoint-stmt.html] \
    [file join syntax select-core.html] \
    [file join syntax select-stmt.html] \
    [file join syntax signed-number.html] \
    [file join syntax simple-function-invocation.html] \
    [file join syntax simple-select-stmt.html] \
    [file join syntax sql-stmt-list.html] \
    [file join syntax sql-stmt.html] \
    [file join syntax table-constraint.html] \
    [file join syntax table-options.html] \
    [file join syntax table-or-subquery.html] \
    [file join syntax type-name.html] \
    [file join syntax update-stmt-limited.html] \
    [file join syntax update-stmt.html] \
    [file join syntax upsert-clause.html] \
    [file join syntax vacuum-stmt.html] \
    [file join syntax window-defn.html] \
    [file join syntax window-function-invocation.html] \
    [file join syntax with-clause.html]]

###############################################################################

set specialFileNames [list \
    [file join vtab.html]]

###############################################################################

set path [file dirname [info script]]

if {[info exists draft] && $draft} then {
  set rootUri https://www.sqlite.org/draft
} else {
  set rootUri https://www.sqlite.org
}

set rootDirectory [file join $path]

if {[info exists argv] && \
    [lsearch -exact -- $argv --verbose] != -1} then {
  set verbose true
} else {
  set verbose false
}

if {[info exists ::eagle_platform(frameworkVersion)] && \
    [package vcompare $::eagle_platform(frameworkVersion) \
        4.0.30319.42000] >= 0} then {
  object invoke System.Net.ServicePointManager SecurityProtocol \
      {Ssl3 Tls Tls12 Tls11}
}

foreach fileName $fileNames {
  set uri [file join $rootUri $fileName]

  if {[lsearch -exact -- $specialFileNames $fileName] != -1} then {
    set directory [file join \
        $rootDirectory Special Core [file dirname $fileName]]
  } else {
    set directory [file join \
        $rootDirectory Extra Core [file dirname $fileName]]
  }

  set fileName [file normalize \
      [file join $directory [file tail $fileName]]]

  if {$verbose} then {
    puts -nonewline stdout [appendArgs \
        "Downloading \"" $uri "\" to \"" $fileName "\"... "]
  }

  catch {file delete $fileName}
  uri download $uri $fileName

  if {$verbose} then {
    puts stdout <Ok>
  }
}

Added Doc/vtab.tcl.

































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
###############################################################################
#
# vtab.tcl --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

proc readFile { fileName } {
  set file_id [open $fileName RDONLY]
  fconfigure $file_id -encoding binary -translation binary
  set result [read $file_id]
  close $file_id
  return $result
}

proc writeFile { fileName data } {
  set file_id [open $fileName {WRONLY CREAT TRUNC}]
  fconfigure $file_id -encoding binary -translation binary
  puts -nonewline $file_id $data
  close $file_id
  return ""
}

proc escapeSubSpec { data } {
  regsub -all -- {&} $data {\\\&} data
  regsub -all -- {\\(\d+)} $data {\\\\\1} data
  return $data
}

proc preProcessLine { value } {
  regsub -- { id="[0-9a-z_]+"} $value "" value
  regsub -- {</p><h(\d)>} $value </p>\n<h\\1> value
  regsub -- {</p><blockquote><pre>} $value <blockquote><pre> value
  return $value
}

proc englishToList { value } {
  set result [list]

  foreach element [split $value "\t\n ,"] {
    if {[string tolower $element] ni [list "" and or]} then {
      lappend result $element
    }
  }

  return $result
}

proc processLine { line prefix ltAndGt } {
  if {[string length [string trim $line]] == 0 || \
      [regexp -- {<h\d(?: |>)} [string range $line 0 3]] || \
      [regexp -- {</p>\n<h\d(?: |>)} [string range $line 0 8]]} then {
    return ""
  }

  set result $line

  foreach remove [list \
      {<a name=".*?">} {<a href=".*?">} {</a>} {<p>} {</p>}] {
    regsub -all -- $remove $result "" result

    if {[string length [string trim $result]] == 0} then {
      return ""
    }
  }

  foreach escape [list \
      {<b>} {</b>} {<br>} {</br>} {<dd>} {</dd>} {<dl>} {</dl>} \
      {<dt>} {</dt>} {<li>} {</li>} {<ol>} {</ol>} {<tt>} {</tt>} \
      {<ul>} {</ul>}] {
    regsub -all -- ($escape) $result {<![CDATA[\1]]>} result
  }

  regsub -all -- {&rarr;} $result {\&#8594;} result
  regsub -all -- {&ne;} $result {\&#8800;} result
  regsub -all -- {&#91(?:;)?} $result {[} result
  regsub -all -- {&#93(?:;)?} $result {]} result

  if {$ltAndGt} then {
    regsub -all -- {<( |\"|\d|=)} $result {\&lt;\1} result
    regsub -all -- {( |\"|\d|=)>} $result {\1\&gt;} result
  }

  regsub -all -- { < } $result { \&lt; } result
  regsub -all -- { > } $result { \&gt; } result

  regsub -all -- {<div class="codeblock"><pre>} $result \
      <para><code>\n${prefix} result

  regsub -all -- {</pre></div>} $result </code></para> result
  regsub -all -- {<blockquote><pre>} $result <para><code> result
  regsub -all -- {</pre></blockquote>} $result </code></para> result
  regsub -all -- {<blockquote>} $result <para><code> result
  regsub -all -- {</blockquote>} $result </code></para> result

  return $result
}

proc extractMethod {
        name lines pattern prefix indexVarName methodsVarName ltAndGt } {
  upvar 1 $indexVarName index
  upvar 1 $methodsVarName methods

  array set levels {p 0}
  set length [llength $lines]

  while {$index < $length} {
    set line [preProcessLine [lindex $lines $index]]

    if {[regexp -- $pattern $line]} then {
      break; # stop on this line for outer loop.
    } else {
      set trimLine [string trim $line]; set data ""

      if {$levels(p) > 0 && [string length $trimLine] == 0} then {
        # blank line, close paragraph.
        if {[info exists methods($name)]} then {
          # non-first line, leading line separator.
          append data \n $prefix </para>
        } else {
          # first line, no leading line separator.
          append data $prefix </para>
        }

        incr levels(p) -1
      } elseif {[string range $trimLine 0 2] eq "<p>" || \
          [string range $trimLine 0 6] eq "</p><p>"} then {
        # open tag ... maybe one line?
        if {[string range $trimLine end-3 end] eq "</p>"} then {
          set newLine [processLine $line $prefix $ltAndGt]

          if {[string length $newLine] > 0} then {
            # one line tag, wrap.
            if {[info exists methods($name)]} then {
              # non-first line, leading line separator.
              append data \n $prefix <para>
            } else {
              # first line, no leading line separator.
              append data $prefix <para>
            }

            append data \n $prefix $newLine
            append data \n $prefix </para>
          }
        } else {
          if {[info exists methods($name)]} then {
            # non-first line, leading line separator.
            append data \n $prefix <para>
          } else {
            # first line, no leading line separator.
            append data $prefix <para>
          }

          set newLine [processLine $line $prefix $ltAndGt]

          if {[string length $newLine] > 0} then {
            append data \n $prefix $newLine
          }

          incr levels(p)
        }
      } else {
        set newLine [processLine $line $prefix $ltAndGt]

        if {[string length $newLine] > 0} then {
          if {[info exists methods($name)]} then {
            # non-first line, leading line separator.
            append data \n $prefix $newLine
          } else {
            # first line, no leading line separator.
            append data $prefix $newLine
          }
        }
      }

      if {[string length $data] > 0} then {
        append methods($name) $data
      }

      incr index; # consume this line for outer loop.
    }
  }
}

#
# NOTE: This is the entry point for this script.
#
set path [file normalize [file dirname [info script]]]

set coreDocPath [file join $path Special Core]
set interfacePath [file join [file dirname $path] System.Data.SQLite]
set inputFileName [file join $coreDocPath vtab.html]

if {![file exists $inputFileName]} then {
  puts "input file \"$inputFileName\" does not exist"
  exit 1
}

set outputFileName [file join $interfacePath ISQLiteNativeModule.cs]

if {![file exists $outputFileName]} then {
  puts "output file \"$outputFileName\" does not exist"
  exit 1
}

set inputData [readFile $inputFileName]

set inputData [string map [list \
    {<font size="6" color="red">*** DRAFT ***</font>} ""] $inputData]

set inputData [string map [list {<p align="center"></p>} ""] $inputData]

if {[string first &lt\; $inputData] != -1 || \
    [string first &gt\; $inputData] != -1} then {
  set ltAndGt false
} else {
  set ltAndGt true
}

set lines [split [string map [list \r\n \n] $inputData] \n]

set patterns(start) [string trim {
  ^(?:</p>\n)?<h1>(?:<span>)?2\. (?:</span>)?Virtual Table Methods</h1>$
}]

set patterns(method) [string trim {
  ^(?:</p>\n)?<h2>(?:<span>)?2\.\d+\. (?:</span>)?The (.*) Method(?:s)?</h2>$
}]

set prefix "        /// "
unset -nocomplain methods; set start false

for {set index 0} {$index < [llength $lines]} {} {
  set line [preProcessLine [lindex $lines $index]]

  if {$start} then {
    if {[regexp -- $patterns(method) $line dummy capture]} then {
      foreach method [englishToList $capture] {
        set methodIndex [expr {$index + 1}]

        extractMethod $method $lines $patterns(method) $prefix \
            methodIndex methods $ltAndGt
      }

      set index $methodIndex
    } else {
      incr index
    }
  } elseif {[regexp -- $patterns(start) $line]} then {
    set start true; incr index
  } else {
    incr index
  }
}

set outputData [string map [list \r\n \n] [readFile $outputFileName]]
set count 0; set start 0

#
# NOTE: These method names must be processed in the EXACT order that they
#       appear in the output file.
#
foreach name [list \
    xCreate xConnect xBestIndex xDisconnect xDestroy xOpen xClose \
    xFilter xNext xEof xColumn xRowid xUpdate xBegin xSync xCommit \
    xRollback xFindFunction xRename xSavepoint xRelease xRollbackTo] {
  #
  # HACK: This assumes that a line of 71 forward slashes will be present
  #       before each method, except for the first one.
  #
  if {$count > 0} then {
    set start [string first [string repeat / 71] $outputData $start]
  }

  set pattern ""

  append pattern ^ {\s{8}} "/// <summary>"
  append pattern {((?:.|\n)*?)}
  append pattern {\n\s{8}} "/// </summary>"
  append pattern {(?:(?:.|\n)*?)}
  append pattern {\n\s{8}[\w]+?\s+?} $name {\($}

  if {[regexp -nocase -start \
      $start -line -indices -- $pattern $outputData dummy indexes]} then {
    set summaryStart [lindex $indexes 0]
    set summaryEnd [lindex $indexes 1]

    set outputData [string range \
        $outputData 0 $summaryStart]$methods($name)[string \
        range $outputData [expr {$summaryEnd + 1}] end]

    incr count; incr start [expr {[string length $methods($name)] + 1}]
  } else {
    error "cannot find virtual table method \"$name\" in \"$outputFileName\""
  }
}

if {$count > 0} then {
  writeFile $outputFileName [string map [list \n \r\n] $outputData]
}

exit 0

Added Externals/Eagle/Targets/Eagle.Builds.targets.

































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
<!--
 *
 * Eagle.Builds.targets -
 *
 * WARNING: Contains more evil MSBuild hacks than your doctor recommended.
 *
 * Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: $
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **                   Preliminary Shared Build Properties                    **
  ******************************************************************************
  -->

  <PropertyGroup>
    <!--
        HACK: When targeting the .NET Standard 2.x, et al, the target framework
              version cannot be set to the typical values (i.e. those used for
              the full .NET Framework).
    -->
    <EagleCanSetTargetFrameworkVersion Condition="'$(EagleCanSetTargetFrameworkVersion)' == '' And ('$(TargetFramework)' == 'netstandard2.0' Or '$(TargetFramework)' == 'netstandard2.1' Or '$(TargetFramework)' == 'netcoreapp2.0' Or '$(TargetFramework)' == 'netcoreapp2.1' Or '$(TargetFramework)' == 'netcoreapp2.2' Or '$(TargetFramework)' == 'netcoreapp3.0' Or '$(TargetFramework)' == 'netcoreapp3.1')">false</EagleCanSetTargetFrameworkVersion>
    <EagleCanSetTargetFrameworkVersion Condition="'$(EagleCanSetTargetFrameworkVersion)' == '' And ('$(TargetFramework)' != 'netstandard2.0' And '$(TargetFramework)' != 'netstandard2.1' And '$(TargetFramework)' != 'netcoreapp2.0' And '$(TargetFramework)' != 'netcoreapp2.1' And '$(TargetFramework)' != 'netcoreapp2.2' And '$(TargetFramework)' != 'netcoreapp3.0' And '$(TargetFramework)' != 'netcoreapp3.1')">true</EagleCanSetTargetFrameworkVersion>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                          Load Per-User Settings                          **
  ******************************************************************************
  -->

  <!--
      NOTE: If the per-user settings file exists, import it now.  The contained
            settings, if any, will override the default ones provided below.
  -->
  <Import Condition="'$(EagleDir)' != '' And
                     !HasTrailingSlash('$(EagleDir)') And
                     Exists('$(EagleDir)\Targets\Eagle.Builds.targets.user')"
          Project="$(EagleDir)\Targets\Eagle.Builds.targets.user" />

  <!--
  ******************************************************************************
  **                            Eagle Build Types                             **
  ******************************************************************************
  -->

  <!--
      NOTE: This is an "official release" build configuration.  This build
            configuration is primarily designed for use with the .NET Framework
            2.0 on Windows XP or higher.  Most default values from the settings
            file (i.e. "Eagle.Settings.targets") are used; however, some of the
            defaults are overridden.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'Default' Or
                            '$(EagleBuildType)' == 'NetFx20'">
    <EagleAppDomains Condition="'$(EagleAppDomains)' == ''">true</EagleAppDomains>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">true</EagleCacheDictionary>
    <EagleCasPolicy Condition="'$(EagleCasPolicy)' == ''">true</EagleCasPolicy>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">NetFx20</EagleConfigurationSuffix>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">true</EagleFastErrorCode>
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">true</EagleFastErrorInfo>
    <EagleIsolatedInterpreters Condition="'$(EagleIsolatedInterpreters)' == ''">true</EagleIsolatedInterpreters>
    <EagleIsolatedPlugins Condition="'$(EagleIsolatedPlugins)' == ''">true</EagleIsolatedPlugins>
    <EagleMaybeTrace Condition="'$(EagleMaybeTrace)' == ''">true</EagleMaybeTrace>
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">false</EagleMonoLegacy>
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">false</EagleNotifyExecute>
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">false</EagleNotifyExpression>
    <EagleOnlyNetFx20 Condition="'$(EagleOnlyNetFx20)' == ''">true</EagleOnlyNetFx20>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EaglePowerShellVersion Condition="'$(EaglePowerShellVersion)' == ''">1.0</EaglePowerShellVersion>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">true</EagleScriptArguments>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleUnix Condition="'$(EagleUnix)' == ''">true</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">true</EagleUseNamespaces>
    <EagleWixVersion Condition="'$(EagleWixVersion)' == ''">3.5</EagleWixVersion>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is NOT an "official release" build configuration.  This build
            configuration is primarily designed for use with the .NET Framework
            3.5 on Windows XP or higher.  Currently, the release preparation
            tool does NOT build this configuration during the automated release
            processing.  Most default values from the settings file (i.e.
            "Eagle.Settings.targets") are used; however, some of the defaults
            are overridden here.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'NetFx35'">
    <TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == '' And '$(EagleCanSetTargetFrameworkVersion)' != '' And '$(EagleCanSetTargetFrameworkVersion)' != 'false'">v3.5</TargetFrameworkVersion>
    <EagleAppDomains Condition="'$(EagleAppDomains)' == ''">true</EagleAppDomains>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">true</EagleCacheDictionary>
    <EagleCasPolicy Condition="'$(EagleCasPolicy)' == ''">true</EagleCasPolicy>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">NetFx35</EagleConfigurationSuffix>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">true</EagleFastErrorCode>
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">true</EagleFastErrorInfo>
    <EagleIsolatedInterpreters Condition="'$(EagleIsolatedInterpreters)' == ''">true</EagleIsolatedInterpreters>
    <EagleIsolatedPlugins Condition="'$(EagleIsolatedPlugins)' == ''">true</EagleIsolatedPlugins>
    <EagleMaybeTrace Condition="'$(EagleMaybeTrace)' == ''">true</EagleMaybeTrace>
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">false</EagleMonoLegacy>
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">false</EagleNotifyExecute>
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">false</EagleNotifyExpression>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EaglePowerShellVersion Condition="'$(EaglePowerShellVersion)' == ''">2.0</EaglePowerShellVersion>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">true</EagleScriptArguments>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleUnix Condition="'$(EagleUnix)' == ''">true</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">true</EagleUseNamespaces>
    <EagleWixVersion Condition="'$(EagleWixVersion)' == ''">3.5</EagleWixVersion>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is an "official release" build configuration.  This build
            configuration is primarily designed for use with the .NET Framework
            4.0 on Windows XP or higher.  Most default values from the settings
            file (i.e. "Eagle.Settings.targets") are used; however, some of the
            defaults are overridden here.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'NetFx40'">
    <TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == '' And '$(EagleCanSetTargetFrameworkVersion)' != '' And '$(EagleCanSetTargetFrameworkVersion)' != 'false'">v4.0</TargetFrameworkVersion>
    <EagleAppDomains Condition="'$(EagleAppDomains)' == ''">true</EagleAppDomains>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">true</EagleCacheDictionary>
    <EagleCasPolicy Condition="'$(EagleCasPolicy)' == ''">true</EagleCasPolicy>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">NetFx40</EagleConfigurationSuffix>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">true</EagleFastErrorCode>
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">true</EagleFastErrorInfo>
    <EagleIsolatedInterpreters Condition="'$(EagleIsolatedInterpreters)' == ''">true</EagleIsolatedInterpreters>
    <EagleIsolatedPlugins Condition="'$(EagleIsolatedPlugins)' == ''">true</EagleIsolatedPlugins>
    <EagleMaybeTrace Condition="'$(EagleMaybeTrace)' == ''">true</EagleMaybeTrace>
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">false</EagleMonoLegacy>
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">false</EagleNotifyExecute>
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">false</EagleNotifyExpression>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EaglePowerShellVersion Condition="'$(EaglePowerShellVersion)' == ''">3.0</EaglePowerShellVersion>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">true</EagleScriptArguments>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleUnix Condition="'$(EagleUnix)' == ''">true</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">true</EagleUseNamespaces>
    <EagleWixVersion Condition="'$(EagleWixVersion)' == ''">3.5</EagleWixVersion>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is NOT an "official release" build configuration.  This build
            configuration is primarily designed for use with the .NET Framework
            4.5 on Windows Vista or higher.  Most default values from the
            settings file (i.e. "Eagle.Settings.targets") are used; however,
            some of the defaults are overridden here.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'NetFx45'">
    <TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == '' And '$(EagleCanSetTargetFrameworkVersion)' != '' And '$(EagleCanSetTargetFrameworkVersion)' != 'false'">v4.5</TargetFrameworkVersion>
    <EagleAppDomains Condition="'$(EagleAppDomains)' == ''">true</EagleAppDomains>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">true</EagleCacheDictionary>
    <EagleCasPolicy Condition="'$(EagleCasPolicy)' == ''">true</EagleCasPolicy>
    <EagleCompression Condition="'$(EagleCompression)' == ''">true</EagleCompression>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">NetFx45</EagleConfigurationSuffix>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">true</EagleFastErrorCode>
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">true</EagleFastErrorInfo>
    <EagleIsolatedInterpreters Condition="'$(EagleIsolatedInterpreters)' == ''">true</EagleIsolatedInterpreters>
    <EagleIsolatedPlugins Condition="'$(EagleIsolatedPlugins)' == ''">true</EagleIsolatedPlugins>
    <EagleMaybeTrace Condition="'$(EagleMaybeTrace)' == ''">true</EagleMaybeTrace>
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">false</EagleMonoLegacy>
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">false</EagleNotifyExecute>
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">false</EagleNotifyExpression>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EaglePowerShellVersion Condition="'$(EaglePowerShellVersion)' == ''">5.0</EaglePowerShellVersion>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">true</EagleScriptArguments>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleUnix Condition="'$(EagleUnix)' == ''">true</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">true</EagleUseNamespaces>
    <EagleWixVersion Condition="'$(EagleWixVersion)' == ''">3.5</EagleWixVersion>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is NOT an "official release" build configuration.  This build
            configuration is primarily designed for use with the .NET Framework
            4.5.1 on Windows Vista SP2 or higher.  Most default values from the
            settings file (i.e. "Eagle.Settings.targets") are used; however,
            some of the defaults are overridden here.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'NetFx451'">
    <TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == '' And '$(EagleCanSetTargetFrameworkVersion)' != '' And '$(EagleCanSetTargetFrameworkVersion)' != 'false'">v4.5.1</TargetFrameworkVersion>
    <EagleAppDomains Condition="'$(EagleAppDomains)' == ''">true</EagleAppDomains>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">true</EagleCacheDictionary>
    <EagleCasPolicy Condition="'$(EagleCasPolicy)' == ''">true</EagleCasPolicy>
    <EagleCompression Condition="'$(EagleCompression)' == ''">true</EagleCompression>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">NetFx451</EagleConfigurationSuffix>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">true</EagleFastErrorCode>
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">true</EagleFastErrorInfo>
    <EagleIsolatedInterpreters Condition="'$(EagleIsolatedInterpreters)' == ''">true</EagleIsolatedInterpreters>
    <EagleIsolatedPlugins Condition="'$(EagleIsolatedPlugins)' == ''">true</EagleIsolatedPlugins>
    <EagleMaybeTrace Condition="'$(EagleMaybeTrace)' == ''">true</EagleMaybeTrace>
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">false</EagleMonoLegacy>
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">false</EagleNotifyExecute>
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">false</EagleNotifyExpression>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EaglePowerShellVersion Condition="'$(EaglePowerShellVersion)' == ''">5.0</EaglePowerShellVersion>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">true</EagleScriptArguments>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleUnix Condition="'$(EagleUnix)' == ''">true</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">true</EagleUseNamespaces>
    <EagleWixVersion Condition="'$(EagleWixVersion)' == ''">3.5</EagleWixVersion>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is NOT an "official release" build configuration.  This build
            configuration is primarily designed for use with the .NET Framework
            4.5.2 on Windows Vista SP2 or higher.  Currently, the release
            preparation tool does NOT build this configuration during the
            automated release processing.  Most default values from the settings
            file (i.e. "Eagle.Settings.targets") are used; however, some of the
            defaults are overridden here.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'NetFx452'">
    <TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == '' And '$(EagleCanSetTargetFrameworkVersion)' != '' And '$(EagleCanSetTargetFrameworkVersion)' != 'false'">v4.5.2</TargetFrameworkVersion>
    <EagleAppDomains Condition="'$(EagleAppDomains)' == ''">true</EagleAppDomains>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">true</EagleCacheDictionary>
    <EagleCasPolicy Condition="'$(EagleCasPolicy)' == ''">true</EagleCasPolicy>
    <EagleCompression Condition="'$(EagleCompression)' == ''">true</EagleCompression>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">NetFx452</EagleConfigurationSuffix>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">true</EagleFastErrorCode>
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">true</EagleFastErrorInfo>
    <EagleIsolatedInterpreters Condition="'$(EagleIsolatedInterpreters)' == ''">true</EagleIsolatedInterpreters>
    <EagleIsolatedPlugins Condition="'$(EagleIsolatedPlugins)' == ''">true</EagleIsolatedPlugins>
    <EagleMaybeTrace Condition="'$(EagleMaybeTrace)' == ''">true</EagleMaybeTrace>
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">false</EagleMonoLegacy>
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">false</EagleNotifyExecute>
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">false</EagleNotifyExpression>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EaglePowerShellVersion Condition="'$(EaglePowerShellVersion)' == ''">5.0</EaglePowerShellVersion>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">true</EagleScriptArguments>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleUnix Condition="'$(EagleUnix)' == ''">true</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">true</EagleUseNamespaces>
    <EagleWixVersion Condition="'$(EagleWixVersion)' == ''">3.5</EagleWixVersion>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is NOT an "official release" build configuration.  This build
            configuration is primarily designed for use with the .NET Framework
            4.6 on Windows Vista SP2 or higher.  Currently, the release
            preparation tool does NOT build this configuration during the
            automated release processing.  Most default values from the settings
            file (i.e. "Eagle.Settings.targets") are used; however, some of the
            defaults are overridden here.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'NetFx46'">
    <TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == '' And '$(EagleCanSetTargetFrameworkVersion)' != '' And '$(EagleCanSetTargetFrameworkVersion)' != 'false'">v4.6</TargetFrameworkVersion>
    <EagleAppDomains Condition="'$(EagleAppDomains)' == ''">true</EagleAppDomains>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">true</EagleCacheDictionary>
    <EagleCasPolicy Condition="'$(EagleCasPolicy)' == ''">true</EagleCasPolicy>
    <EagleCompression Condition="'$(EagleCompression)' == ''">true</EagleCompression>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">NetFx46</EagleConfigurationSuffix>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">true</EagleFastErrorCode>
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">true</EagleFastErrorInfo>
    <EagleIsolatedInterpreters Condition="'$(EagleIsolatedInterpreters)' == ''">true</EagleIsolatedInterpreters>
    <EagleIsolatedPlugins Condition="'$(EagleIsolatedPlugins)' == ''">true</EagleIsolatedPlugins>
    <EagleMaybeTrace Condition="'$(EagleMaybeTrace)' == ''">true</EagleMaybeTrace>
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">false</EagleMonoLegacy>
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">false</EagleNotifyExecute>
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">false</EagleNotifyExpression>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EaglePowerShellVersion Condition="'$(EaglePowerShellVersion)' == ''">5.0</EaglePowerShellVersion>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">true</EagleScriptArguments>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleUnix Condition="'$(EagleUnix)' == ''">true</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">true</EagleUseNamespaces>
    <EagleWixVersion Condition="'$(EagleWixVersion)' == ''">3.5</EagleWixVersion>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is NOT an "official release" build configuration.  This build
            configuration is primarily designed for use with the .NET Framework
            4.6.1 on Windows 7 SP1 or higher.  Most default values from the
            settings file (i.e. "Eagle.Settings.targets") are used; however,
            some of the defaults are overridden here.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'NetFx461'">
    <TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == '' And '$(EagleCanSetTargetFrameworkVersion)' != '' And '$(EagleCanSetTargetFrameworkVersion)' != 'false'">v4.6.1</TargetFrameworkVersion>
    <EagleAppDomains Condition="'$(EagleAppDomains)' == ''">true</EagleAppDomains>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">true</EagleCacheDictionary>
    <EagleCasPolicy Condition="'$(EagleCasPolicy)' == ''">true</EagleCasPolicy>
    <EagleCompression Condition="'$(EagleCompression)' == ''">true</EagleCompression>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">NetFx461</EagleConfigurationSuffix>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">true</EagleFastErrorCode>
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">true</EagleFastErrorInfo>
    <EagleIsolatedInterpreters Condition="'$(EagleIsolatedInterpreters)' == ''">true</EagleIsolatedInterpreters>
    <EagleIsolatedPlugins Condition="'$(EagleIsolatedPlugins)' == ''">true</EagleIsolatedPlugins>
    <EagleMaybeTrace Condition="'$(EagleMaybeTrace)' == ''">true</EagleMaybeTrace>
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">false</EagleMonoLegacy>
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">false</EagleNotifyExecute>
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">false</EagleNotifyExpression>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EaglePowerShellVersion Condition="'$(EaglePowerShellVersion)' == ''">5.0</EaglePowerShellVersion>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">true</EagleScriptArguments>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleUnix Condition="'$(EagleUnix)' == ''">true</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">true</EagleUseNamespaces>
    <EagleWixVersion Condition="'$(EagleWixVersion)' == ''">3.5</EagleWixVersion>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is an "official release" build configuration.  This build
            configuration is primarily designed for use with the .NET Framework
            4.6.2 on Windows 7 SP1 or higher.  Most default values from the
            settings file (i.e. "Eagle.Settings.targets") are used; however,
            some of the defaults are overridden here.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'NetFx462'">
    <TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == '' And '$(EagleCanSetTargetFrameworkVersion)' != '' And '$(EagleCanSetTargetFrameworkVersion)' != 'false'">v4.6.2</TargetFrameworkVersion>
    <EagleAppDomains Condition="'$(EagleAppDomains)' == ''">true</EagleAppDomains>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">true</EagleCacheDictionary>
    <EagleCasPolicy Condition="'$(EagleCasPolicy)' == ''">true</EagleCasPolicy>
    <EagleCompression Condition="'$(EagleCompression)' == ''">true</EagleCompression>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">NetFx462</EagleConfigurationSuffix>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">true</EagleFastErrorCode>
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">true</EagleFastErrorInfo>
    <EagleIsolatedInterpreters Condition="'$(EagleIsolatedInterpreters)' == ''">true</EagleIsolatedInterpreters>
    <EagleIsolatedPlugins Condition="'$(EagleIsolatedPlugins)' == ''">true</EagleIsolatedPlugins>
    <EagleMaybeTrace Condition="'$(EagleMaybeTrace)' == ''">true</EagleMaybeTrace>
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">false</EagleMonoLegacy>
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">false</EagleNotifyExecute>
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">false</EagleNotifyExpression>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EaglePowerShellVersion Condition="'$(EaglePowerShellVersion)' == ''">5.0</EaglePowerShellVersion>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">true</EagleScriptArguments>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleUnix Condition="'$(EagleUnix)' == ''">true</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">true</EagleUseNamespaces>
    <EagleWixVersion Condition="'$(EagleWixVersion)' == ''">3.5</EagleWixVersion>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is NOT an "official release" build configuration.  This build
            configuration is primarily designed for use with the .NET Framework
            4.7 on Windows 7 SP1 or higher.  Currently, the release preparation
            tool does NOT build this configuration during the automated release
            processing.  Most default values from the settings file (i.e.
            "Eagle.Settings.targets") are used; however, some of the defaults
            are overridden here.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'NetFx47'">
    <TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == '' And '$(EagleCanSetTargetFrameworkVersion)' != '' And '$(EagleCanSetTargetFrameworkVersion)' != 'false'">v4.7</TargetFrameworkVersion>
    <EagleAppDomains Condition="'$(EagleAppDomains)' == ''">true</EagleAppDomains>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">true</EagleCacheDictionary>
    <EagleCasPolicy Condition="'$(EagleCasPolicy)' == ''">true</EagleCasPolicy>
    <EagleCompression Condition="'$(EagleCompression)' == ''">true</EagleCompression>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">NetFx47</EagleConfigurationSuffix>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">true</EagleFastErrorCode>
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">true</EagleFastErrorInfo>
    <EagleIsolatedInterpreters Condition="'$(EagleIsolatedInterpreters)' == ''">true</EagleIsolatedInterpreters>
    <EagleIsolatedPlugins Condition="'$(EagleIsolatedPlugins)' == ''">true</EagleIsolatedPlugins>
    <EagleMaybeTrace Condition="'$(EagleMaybeTrace)' == ''">true</EagleMaybeTrace>
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">false</EagleMonoLegacy>
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">false</EagleNotifyExecute>
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">false</EagleNotifyExpression>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EaglePowerShellVersion Condition="'$(EaglePowerShellVersion)' == ''">5.0</EaglePowerShellVersion>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">true</EagleScriptArguments>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleUnix Condition="'$(EagleUnix)' == ''">true</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">true</EagleUseNamespaces>
    <EagleWixVersion Condition="'$(EagleWixVersion)' == ''">3.5</EagleWixVersion>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is NOT an "official release" build configuration.  This build
            configuration is primarily designed for use with the .NET Framework
            4.7.1 on Windows 7 SP1 or higher.  Currently, the release
            preparation tool does NOT build this configuration during the
            automated release processing.  Most default values from the settings
            file (i.e. "Eagle.Settings.targets") are used; however, some of the
            defaults are overridden here.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'NetFx471'">
    <TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == '' And '$(EagleCanSetTargetFrameworkVersion)' != '' And '$(EagleCanSetTargetFrameworkVersion)' != 'false'">v4.7.1</TargetFrameworkVersion>
    <EagleAppDomains Condition="'$(EagleAppDomains)' == ''">true</EagleAppDomains>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">true</EagleCacheDictionary>
    <EagleCasPolicy Condition="'$(EagleCasPolicy)' == ''">true</EagleCasPolicy>
    <EagleCompression Condition="'$(EagleCompression)' == ''">true</EagleCompression>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">NetFx471</EagleConfigurationSuffix>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">true</EagleFastErrorCode>
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">true</EagleFastErrorInfo>
    <EagleIsolatedInterpreters Condition="'$(EagleIsolatedInterpreters)' == ''">true</EagleIsolatedInterpreters>
    <EagleIsolatedPlugins Condition="'$(EagleIsolatedPlugins)' == ''">true</EagleIsolatedPlugins>
    <EagleMaybeTrace Condition="'$(EagleMaybeTrace)' == ''">true</EagleMaybeTrace>
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">false</EagleMonoLegacy>
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">false</EagleNotifyExecute>
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">false</EagleNotifyExpression>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EaglePowerShellVersion Condition="'$(EaglePowerShellVersion)' == ''">5.0</EaglePowerShellVersion>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">true</EagleScriptArguments>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleUnix Condition="'$(EagleUnix)' == ''">true</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">true</EagleUseNamespaces>
    <EagleWixVersion Condition="'$(EagleWixVersion)' == ''">3.5</EagleWixVersion>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is NOT an "official release" build configuration.  This build
            configuration is primarily designed for use with the .NET Framework
            4.7.2 on Windows 7 SP1 or higher.  Currently, the release
            preparation tool does NOT build this configuration during the
            automated release processing.  Most default values from the settings
            file (i.e. "Eagle.Settings.targets") are used; however, some of the
            defaults are overridden here.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'NetFx472'">
    <TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == '' And '$(EagleCanSetTargetFrameworkVersion)' != '' And '$(EagleCanSetTargetFrameworkVersion)' != 'false'">v4.7.2</TargetFrameworkVersion>
    <EagleAppDomains Condition="'$(EagleAppDomains)' == ''">true</EagleAppDomains>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">true</EagleCacheDictionary>
    <EagleCasPolicy Condition="'$(EagleCasPolicy)' == ''">true</EagleCasPolicy>
    <EagleCompression Condition="'$(EagleCompression)' == ''">true</EagleCompression>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">NetFx472</EagleConfigurationSuffix>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">true</EagleFastErrorCode>
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">true</EagleFastErrorInfo>
    <EagleIsolatedInterpreters Condition="'$(EagleIsolatedInterpreters)' == ''">true</EagleIsolatedInterpreters>
    <EagleIsolatedPlugins Condition="'$(EagleIsolatedPlugins)' == ''">true</EagleIsolatedPlugins>
    <EagleMaybeTrace Condition="'$(EagleMaybeTrace)' == ''">true</EagleMaybeTrace>
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">false</EagleMonoLegacy>
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">false</EagleNotifyExecute>
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">false</EagleNotifyExpression>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EaglePowerShellVersion Condition="'$(EaglePowerShellVersion)' == ''">5.0</EaglePowerShellVersion>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">true</EagleScriptArguments>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleUnix Condition="'$(EagleUnix)' == ''">true</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">true</EagleUseNamespaces>
    <EagleWixVersion Condition="'$(EagleWixVersion)' == ''">3.5</EagleWixVersion>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is NOT an "official release" build configuration.  This build
            configuration is primarily designed for use with the .NET Framework
            4.8 on Windows 7 SP1 or higher.  Currently, the release
            preparation tool does NOT build this configuration during the
            automated release processing.  Most default values from the settings
            file (i.e. "Eagle.Settings.targets") are used; however, some of the
            defaults are overridden here.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'NetFx48'">
    <TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == '' And '$(EagleCanSetTargetFrameworkVersion)' != '' And '$(EagleCanSetTargetFrameworkVersion)' != 'false'">v4.8</TargetFrameworkVersion>
    <EagleAppDomains Condition="'$(EagleAppDomains)' == ''">true</EagleAppDomains>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">true</EagleCacheDictionary>
    <EagleCasPolicy Condition="'$(EagleCasPolicy)' == ''">true</EagleCasPolicy>
    <EagleCompression Condition="'$(EagleCompression)' == ''">true</EagleCompression>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">NetFx48</EagleConfigurationSuffix>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">true</EagleFastErrorCode>
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">true</EagleFastErrorInfo>
    <EagleIsolatedInterpreters Condition="'$(EagleIsolatedInterpreters)' == ''">true</EagleIsolatedInterpreters>
    <EagleIsolatedPlugins Condition="'$(EagleIsolatedPlugins)' == ''">true</EagleIsolatedPlugins>
    <EagleMaybeTrace Condition="'$(EagleMaybeTrace)' == ''">true</EagleMaybeTrace>
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">false</EagleMonoLegacy>
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">false</EagleNotifyExecute>
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">false</EagleNotifyExpression>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EaglePowerShellVersion Condition="'$(EaglePowerShellVersion)' == ''">5.0</EaglePowerShellVersion>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">true</EagleScriptArguments>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleUnix Condition="'$(EagleUnix)' == ''">true</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">true</EagleUseNamespaces>
    <EagleWixVersion Condition="'$(EagleWixVersion)' == ''">3.5</EagleWixVersion>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is NOT an "official release" build configuration.  This build
            configuration is primarily designed for use with the .NET Framework
            4.8.1 on Windows 7 SP1 or higher.  Currently, the release
            preparation tool does NOT build this configuration during the
            automated release processing.  Most default values from the settings
            file (i.e. "Eagle.Settings.targets") are used; however, some of the
            defaults are overridden here.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'NetFx481'">
    <TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == '' And '$(EagleCanSetTargetFrameworkVersion)' != '' And '$(EagleCanSetTargetFrameworkVersion)' != 'false'">v4.8.1</TargetFrameworkVersion>
    <EagleAppDomains Condition="'$(EagleAppDomains)' == ''">true</EagleAppDomains>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">true</EagleCacheDictionary>
    <EagleCasPolicy Condition="'$(EagleCasPolicy)' == ''">true</EagleCasPolicy>
    <EagleCompression Condition="'$(EagleCompression)' == ''">true</EagleCompression>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">NetFx481</EagleConfigurationSuffix>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">true</EagleFastErrorCode>
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">true</EagleFastErrorInfo>
    <EagleIsolatedInterpreters Condition="'$(EagleIsolatedInterpreters)' == ''">true</EagleIsolatedInterpreters>
    <EagleIsolatedPlugins Condition="'$(EagleIsolatedPlugins)' == ''">true</EagleIsolatedPlugins>
    <EagleMaybeTrace Condition="'$(EagleMaybeTrace)' == ''">true</EagleMaybeTrace>
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">false</EagleMonoLegacy>
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">false</EagleNotifyExecute>
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">false</EagleNotifyExpression>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EaglePowerShellVersion Condition="'$(EaglePowerShellVersion)' == ''">5.0</EaglePowerShellVersion>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">true</EagleScriptArguments>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleUnix Condition="'$(EagleUnix)' == ''">true</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">true</EagleUseNamespaces>
    <EagleWixVersion Condition="'$(EagleWixVersion)' == ''">3.5</EagleWixVersion>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is NOT an "official release" build configuration.  This build
            configuration is primarily designed for use with the .NET Standard
            2.0 on Windows 7 SP1 or higher.  Most default values from the
            settings file (i.e. "Eagle.Settings.targets") are used; however,
            some of the defaults are overridden here.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'NetStandard20'">
    <TargetFramework Condition="'$(TargetFramework)' == ''">netstandard2.0</TargetFramework>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">true</EagleCacheDictionary>
    <EagleConfiguration Condition="'$(EagleConfiguration)' == ''">false</EagleConfiguration>
    <EagleCompression Condition="'$(EagleCompression)' == ''">true</EagleCompression>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">NetStandard20</EagleConfigurationSuffix>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleDrawing Condition="'$(EagleDrawing)' == ''">false</EagleDrawing>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">false</EagleMonoLegacy>
    <EagleNetStandard20 Condition="'$(EagleNetStandard20)' == ''">true</EagleNetStandard20>
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">false</EagleNotifyExecute>
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">false</EagleNotifyExpression>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EaglePowerShellVersion Condition="'$(EaglePowerShellVersion)' == ''">3.0</EaglePowerShellVersion>
    <EagleRemoting Condition="'$(EagleRemoting)' == ''">false</EagleRemoting>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">true</EagleScriptArguments>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleUnix Condition="'$(EagleUnix)' == ''">true</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">true</EagleUseNamespaces>
    <EagleWinForms Condition="'$(EagleWinForms)' == ''">false</EagleWinForms>
    <EagleWixVersion Condition="'$(EagleWixVersion)' == ''">3.5</EagleWixVersion>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is NOT an "official release" build configuration.  This build
            configuration is primarily designed for use with the .NET Standard
            2.1 on Windows 7 SP1 or higher.  Most default values from the
            settings file (i.e. "Eagle.Settings.targets") are used; however,
            some of the defaults are overridden here.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'NetStandard21'">
    <TargetFramework Condition="'$(TargetFramework)' == ''">netstandard2.1</TargetFramework>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">true</EagleCacheDictionary>
    <EagleConfiguration Condition="'$(EagleConfiguration)' == ''">false</EagleConfiguration>
    <EagleCompression Condition="'$(EagleCompression)' == ''">true</EagleCompression>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">NetStandard21</EagleConfigurationSuffix>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleDrawing Condition="'$(EagleDrawing)' == ''">false</EagleDrawing>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">false</EagleMonoLegacy>
    <EagleNetStandard20 Condition="'$(EagleNetStandard20)' == ''">true</EagleNetStandard20>
    <EagleNetStandard21 Condition="'$(EagleNetStandard21)' == ''">true</EagleNetStandard21>
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">false</EagleNotifyExecute>
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">false</EagleNotifyExpression>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EaglePowerShellVersion Condition="'$(EaglePowerShellVersion)' == ''">3.0</EaglePowerShellVersion>
    <EagleRemoting Condition="'$(EagleRemoting)' == ''">false</EagleRemoting>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">true</EagleScriptArguments>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleUnix Condition="'$(EagleUnix)' == ''">true</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">true</EagleUseNamespaces>
    <EagleWinForms Condition="'$(EagleWinForms)' == ''">false</EagleWinForms>
    <EagleWixVersion Condition="'$(EagleWixVersion)' == ''">3.5</EagleWixVersion>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is NOT an "official release" build configuration.  However, the
            "unofficial policy" governing this build configuration is to exclude
            almost every non-essential feature.  The only real purpose of this
            build configuration is to reveal any accidental hidden dependencies
            between optional features (i.e. primarily through compiler errors).
            One important thing to note about this build configuration is that
            it does NOT provide any interactive input/output functionality (i.e.
            no console host).  This build configuration is primarily designed
            for use with the .NET Framework 2.0 on Windows XP or higher.  There
            is absolutely NO guarantee whatsoever that this build configuration
            will be supported in the future.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'Bare'">
    <EagleAppDomains Condition="'$(EagleAppDomains)' == ''">false</EagleAppDomains>
    <EagleApprovedVerbs Condition="'$(EagleApprovedVerbs)' == ''">false</EagleApprovedVerbs>
    <EagleArgumentCache Condition="'$(EagleArgumentCache)' == ''">false</EagleArgumentCache>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleBreakOnExiting Condition="'$(EagleBreakOnExiting)' == ''">false</EagleBreakOnExiting>
    <EagleCacheArgumentToString Condition="'$(EagleCacheArgumentToString)' == ''">false</EagleCacheArgumentToString>
    <EagleCacheArgumentListToString Condition="'$(EagleCacheArgumentListToString)' == ''">false</EagleCacheArgumentListToString>
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">false</EagleCacheDictionary>
    <EagleCacheResultToString Condition="'$(EagleCacheResultToString)' == ''">false</EagleCacheResultToString>
    <EagleCacheStatistics Condition="'$(EagleCacheStatistics)' == ''">false</EagleCacheStatistics>
    <EagleCacheStringListToString Condition="'$(EagleCacheStringListToString)' == ''">false</EagleCacheStringListToString>
    <EagleCallbackQueue Condition="'$(EagleCallbackQueue)' == ''">false</EagleCallbackQueue>
    <EagleCasPolicy Condition="'$(EagleCasPolicy)' == ''">false</EagleCasPolicy>
    <EagleComTypeCache Condition="'$(EagleComTypeCache)' == ''">false</EagleComTypeCache>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">Bare</EagleConfigurationSuffix>
    <EagleConsole Condition="'$(EagleConsole)' == ''">false</EagleConsole>
    <EagleConfiguration Condition="'$(EagleConfiguration)' == ''">false</EagleConfiguration>
    <EagleData Condition="'$(EagleData)' == ''">false</EagleData>
    <EagleDeadCode Condition="'$(EagleDeadCode)' == ''">false</EagleDeadCode>
    <EagleDebugTrace Condition="'$(EagleDebugTrace)' == ''">false</EagleDebugTrace>
    <EagleDebugWrite Condition="'$(EagleDebugWrite)' == ''">false</EagleDebugWrite>
    <EagleDebugger Condition="'$(EagleDebugger)' == ''">false</EagleDebugger>
    <EagleDebuggerArguments Condition="'$(EagleDebuggerArguments)' == ''">false</EagleDebuggerArguments>
    <EagleDebuggerBreakpoints Condition="'$(EagleDebuggerBreakpoints)' == ''">false</EagleDebuggerBreakpoints>
    <EagleDebuggerEngine Condition="'$(EagleDebuggerEngine)' == ''">false</EagleDebuggerEngine>
    <EagleDebuggerExecute Condition="'$(EagleDebuggerExecute)' == ''">false</EagleDebuggerExecute>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleDebuggerVariable Condition="'$(EagleDebuggerVariable)' == ''">false</EagleDebuggerVariable>
    <EagleDetectNetFx20Sp Condition="'$(EagleDetectNetFx20Sp)' == ''">false</EagleDetectNetFx20Sp>
    <EagleDrawing Condition="'$(EagleDrawing)' == ''">false</EagleDrawing>
    <EagleDynamic Condition="'$(EagleDynamic)' == ''">false</EagleDynamic>
    <!--
        HACK: The EagleEmbeddedLibrary setting is being enabled here in
              order to support the "-security" command line option, et
              al, for use during release testing.  Please do not remove
              or disable this.
    -->
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleExecuteCache Condition="'$(EagleExecuteCache)' == ''">false</EagleExecuteCache>
    <EagleExpressionFlags Condition="'$(EagleExpressionFlags)' == ''">false</EagleExpressionFlags>
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">false</EagleFastErrorCode>
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">false</EagleFastErrorInfo>
    <EagleHistory Condition="'$(EagleHistory)' == ''">false</EagleHistory>
    <EagleInteractiveCommands Condition="'$(EagleInteractiveCommands)' == ''">false</EagleInteractiveCommands>
    <EagleIsolatedInterpreters Condition="'$(EagleIsolatedInterpreters)' == ''">false</EagleIsolatedInterpreters>
    <EagleIsolatedPlugins Condition="'$(EagleIsolatedPlugins)' == ''">false</EagleIsolatedPlugins>
    <EagleLibrary Condition="'$(EagleLibrary)' == ''">false</EagleLibrary>
    <EagleListCache Condition="'$(EagleListCache)' == ''">false</EagleListCache>
    <EagleMono Condition="'$(EagleMono)' == ''">false</EagleMono>
    <EagleMonoHacks Condition="'$(EagleMonoHacks)' == ''">false</EagleMonoHacks>
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">false</EagleMonoLegacy>
    <EagleNative Condition="'$(EagleNative)' == ''">false</EagleNative>
    <EagleNativePackage Condition="'$(EagleNativePackage)' == ''">false</EagleNativePackage>
    <EagleNativeThreadId Condition="'$(EagleNativeThreadId)' == ''">false</EagleNativeThreadId>
    <EagleNativeUtility Condition="'$(EagleNativeUtility)' == ''">false</EagleNativeUtility>
    <EagleNativeUtilityBstr Condition="'$(EagleNativeUtilityBstr)' == ''">false</EagleNativeUtilityBstr>
    <EagleNetwork Condition="'$(EagleNetwork)' == ''">false</EagleNetwork>
    <EagleNotify Condition="'$(EagleNotify)' == ''">false</EagleNotify>
    <EagleNotifyActive Condition="'$(EagleNotifyActive)' == ''">false</EagleNotifyActive>
    <EagleNotifyArguments Condition="'$(EagleNotifyArguments)' == ''">false</EagleNotifyArguments>
    <EagleNotifyException Condition="'$(EagleNotifyException)' == ''">false</EagleNotifyException>
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">false</EagleNotifyExecute>
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">false</EagleNotifyExpression>
    <EagleNotifyGlobal Condition="'$(EagleNotifyGlobal)' == ''">false</EagleNotifyGlobal>
    <EagleNotifyObject Condition="'$(EagleNotifyObject)' == ''">true</EagleNotifyObject>
    <EagleNotifyTcl Condition="'$(EagleNotifyTcl)' == ''">false</EagleNotifyTcl>
    <EagleOnlyNetFx20 Condition="'$(EagleOnlyNetFx20)' == ''">true</EagleOnlyNetFx20>
    <EagleParseCache Condition="'$(EagleParseCache)' == ''">false</EagleParseCache>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EaglePolicyTrace Condition="'$(EaglePolicyTrace)' == ''">false</EaglePolicyTrace>
    <EaglePowerShellVersion Condition="'$(EaglePowerShellVersion)' == ''">1.0</EaglePowerShellVersion>
    <EaglePreviousResult Condition="'$(EaglePreviousResult)' == ''">false</EaglePreviousResult>
    <EagleProfiler Condition="'$(EagleProfiler)' == ''">false</EagleProfiler>
    <EagleRandomizeId Condition="'$(EagleRandomizeId)' == ''">false</EagleRandomizeId>
    <EagleRemoting Condition="'$(EagleRemoting)' == ''">false</EagleRemoting>
    <EagleResultLimits Condition="'$(EagleResultLimits)' == ''">false</EagleResultLimits>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">false</EagleScriptArguments>
    <!--
        HACK: The EagleSerialization setting is being (left) enabled here
              in order to support the "-security" command line option (i.e.
              because Harpy requires it), et al, during release testing.
              Please do not remove or disable this.
    -->
    <!--
    <EagleSerialization Condition="'$(EagleSerialization)' == ''">false</EagleSerialization>
    -->
    <EagleSharedIdPool Condition="'$(EagleSharedIdPool)' == ''">false</EagleSharedIdPool>
    <!--
        HACK: The EagleShell setting is being (left) enabled in order to
              support running the test suite during release testing.
              Please do not remove or disable this.
    -->
    <!--
    <EagleShell Condition="'$(EagleShell)' == ''">false</EagleShell>
    -->
    <EagleShellStartupObject Condition="'$(EagleShellStartupObject)' == ''">Eagle._Shell.StaticCommandLine</EagleShellStartupObject>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleStatic Condition="'$(EagleStatic)' == ''">true</EagleStatic>
    <EagleTcl Condition="'$(EagleTcl)' == ''">false</EagleTcl>
    <EagleTclKits Condition="'$(EagleTclKits)' == ''">false</EagleTclKits>
    <EagleTclThreaded Condition="'$(EagleTclThreaded)' == ''">false</EagleTclThreaded>
    <EagleTclThreads Condition="'$(EagleTclThreads)' == ''">false</EagleTclThreads>
    <EagleTclUnicode Condition="'$(EagleTclUnicode)' == ''">false</EagleTclUnicode>
    <EagleTclWrapper Condition="'$(EagleTclWrapper)' == ''">false</EagleTclWrapper>
    <EagleThrowOnDisposed Condition="'$(EagleThrowOnDisposed)' == ''">true</EagleThrowOnDisposed>
    <EagleTest Condition="'$(EagleTest)' == ''">false</EagleTest>
    <EagleTestPlugin Condition="'$(EagleTestPlugin)' == ''">false</EagleTestPlugin>
    <EagleThreading Condition="'$(EagleThreading)' == ''">false</EagleThreading>
    <EagleTypeCache Condition="'$(EagleTypeCache)' == ''">false</EagleTypeCache>
    <EagleUnix Condition="'$(EagleUnix)' == ''">false</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">false</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">false</EagleUseNamespaces>
    <EagleVerbose Condition="'$(EagleVerbose)' == ''">false</EagleVerbose>
    <EagleWeb Condition="'$(EagleWeb)' == ''">false</EagleWeb>
    <EagleWindows Condition="'$(EagleWindows)' == ''">false</EagleWindows>
    <EagleWinForms Condition="'$(EagleWinForms)' == ''">false</EagleWinForms>
    <EagleWixVersion Condition="'$(EagleWixVersion)' == ''">3.0</EagleWixVersion>
    <!--
        HACK: The EagleXml setting is being (left) enabled here in order
              to support the "-security" command line option (i.e. because
              Harpy requires it), et al, during release testing.  Please
              do not remove or disable this.
    -->
    <!--
    <EagleXml Condition="'$(EagleXml)' == ''">false</EagleXml>
    -->
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is NOT an "official release" build configuration.  However, the
            "unofficial policy" governing this build configuration is to exclude
            every non-essential feature that can negatively impact the speed of
            the library.  This build configuration is primarily designed for use
            with the .NET Framework 4.0 on Windows XP or higher.  There is
            absolutely NO guarantee whatsoever that this build configuration
            will be supported in the future.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'LeanAndMean'">
    <!--
        HACK: Setting target framework back to v3.5 can be useful when there is
              a need to interactively debug using Visual Studio 2008, etc.
    -->
    <!--
    <TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == '' And '$(EagleCanSetTargetFrameworkVersion)' != '' And '$(EagleCanSetTargetFrameworkVersion)' != 'false'">v3.5</TargetFrameworkVersion>
    -->
    <TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == '' And '$(EagleCanSetTargetFrameworkVersion)' != '' And '$(EagleCanSetTargetFrameworkVersion)' != 'false'">v4.0</TargetFrameworkVersion>
    <EagleAppDomains Condition="'$(EagleAppDomains)' == ''">true</EagleAppDomains>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleCacheStatistics Condition="'$(EagleCacheStatistics)' == ''">false</EagleCacheStatistics>
    <EagleCallbackQueue Condition="'$(EagleCallbackQueue)' == ''">false</EagleCallbackQueue>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">LeanAndMean</EagleConfigurationSuffix>
    <EagleDeadCode Condition="'$(EagleDeadCode)' == ''">false</EagleDeadCode>
    <EagleDebugTrace Condition="'$(EagleDebugTrace)' == ''">false</EagleDebugTrace>
    <EagleDebuggerArguments Condition="'$(EagleDebuggerArguments)' == ''">false</EagleDebuggerArguments>
    <EagleDebuggerBreakpoints Condition="'$(EagleDebuggerBreakpoints)' == ''">false</EagleDebuggerBreakpoints>
    <EagleDebuggerEngine Condition="'$(EagleDebuggerEngine)' == ''">false</EagleDebuggerEngine>
    <EagleDebuggerExecute Condition="'$(EagleDebuggerExecute)' == ''">false</EagleDebuggerExecute>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleDebuggerVariable Condition="'$(EagleDebuggerVariable)' == ''">false</EagleDebuggerVariable>
    <EagleDetectNetFx20Sp Condition="'$(EagleDetectNetFx20Sp)' == ''">false</EagleDetectNetFx20Sp>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleExpressionFlags Condition="'$(EagleExpressionFlags)' == ''">false</EagleExpressionFlags>
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">true</EagleFastErrorCode>
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">true</EagleFastErrorInfo>
    <EagleIsolatedInterpreters Condition="'$(EagleIsolatedInterpreters)' == ''">true</EagleIsolatedInterpreters>
    <EagleIsolatedPlugins Condition="'$(EagleIsolatedPlugins)' == ''">true</EagleIsolatedPlugins>
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">false</EagleMonoLegacy>
    <EagleNativeThreadId Condition="'$(EagleNativeThreadId)' == ''">false</EagleNativeThreadId>
    <EagleNotify Condition="'$(EagleNotify)' == ''">false</EagleNotify>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EaglePolicyTrace Condition="'$(EaglePolicyTrace)' == ''">false</EaglePolicyTrace>
    <EaglePreviousResult Condition="'$(EaglePreviousResult)' == ''">false</EaglePreviousResult>
    <EagleProfiler Condition="'$(EagleProfiler)' == ''">false</EagleProfiler>
    <EagleResultLimits Condition="'$(EagleResultLimits)' == ''">false</EagleResultLimits>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleTclWrapper Condition="'$(EagleTclWrapper)' == ''">true</EagleTclWrapper>
    <EagleThreading Condition="'$(EagleThreading)' == ''">false</EagleThreading>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleVerbose Condition="'$(EagleVerbose)' == ''">false</EagleVerbose>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is NOT an "official release" build configuration.  However, the
            "unofficial policy" governing this build configuration is to exclude
            any feature that will not work properly when hosted inside SQL
            Server.  This build configuration is primarily designed for use with
            the .NET Framework 2.0 on Windows XP or higher.  There is absolutely
            NO guarantee whatsoever that this build configuration will be
            supported in the future.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'Database'">
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">Database</EagleConfigurationSuffix>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleDrawing Condition="'$(EagleDrawing)' == ''">false</EagleDrawing>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">true</EagleFastErrorCode>
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">true</EagleFastErrorInfo>
    <EagleMaybeTrace Condition="'$(EagleMaybeTrace)' == ''">true</EagleMaybeTrace>
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">false</EagleMonoLegacy>
    <EagleNativePackage Condition="'$(EagleNativePackage)' == ''">false</EagleNativePackage>
    <EagleNativeUtility Condition="'$(EagleNativeUtility)' == ''">false</EagleNativeUtility>
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">false</EagleNotifyExecute>
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">false</EagleNotifyExpression>
    <EagleOnlyNetFx20 Condition="'$(EagleOnlyNetFx20)' == ''">true</EagleOnlyNetFx20>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EagleRemoting Condition="'$(EagleRemoting)' == ''">false</EagleRemoting>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">true</EagleScriptArguments>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleUnix Condition="'$(EagleUnix)' == ''">true</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">true</EagleUseNamespaces>
    <EagleWeb Condition="'$(EagleWeb)' == ''">false</EagleWeb>
    <EagleWinForms Condition="'$(EagleWinForms)' == ''">false</EagleWinForms>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is an "official release" build configuration.  This build
            configuration is primarily designed for use with Mono 4.4 or higher
            on Unix (i.e. at this point, any supported operating system that is
            not Windows).  Most default values from the settings file (i.e.
            "Eagle.Settings.targets") are used; however, some of the defaults
            are overridden here.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'MonoOnUnix'">
    <TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == '' And '$(EagleCanSetTargetFrameworkVersion)' != '' And '$(EagleCanSetTargetFrameworkVersion)' != 'false'">v4.0</TargetFrameworkVersion>
    <EagleAppDomains Condition="'$(EagleAppDomains)' == ''">true</EagleAppDomains>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">true</EagleCacheDictionary>
    <EagleCasPolicy Condition="'$(EagleCasPolicy)' == ''">true</EagleCasPolicy>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">MonoOnUnix</EagleConfigurationSuffix>
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">false</EagleDebuggerExpression>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">true</EagleFastErrorCode>
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">true</EagleFastErrorInfo>
    <EagleIsolatedInterpreters Condition="'$(EagleIsolatedInterpreters)' == ''">true</EagleIsolatedInterpreters>
    <EagleIsolatedPlugins Condition="'$(EagleIsolatedPlugins)' == ''">true</EagleIsolatedPlugins>
    <EagleMaybeTrace Condition="'$(EagleMaybeTrace)' == ''">true</EagleMaybeTrace>
    <EagleMono Condition="'$(EagleMono)' == ''">true</EagleMono>
    <EagleNativeUtilityBstr Condition="'$(EagleNativeUtilityBstr)' == ''">false</EagleNativeUtilityBstr>
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">false</EagleNotifyExecute>
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">false</EagleNotifyExpression>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">true</EagleScriptArguments>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleStackSize Condition="'$(EagleStackSize)' == ''">0x100000</EagleStackSize>
    <EagleTclThreaded Condition="'$(EagleTclThreaded)' == ''">false</EagleTclThreaded>
    <EagleUnix Condition="'$(EagleUnix)' == ''">true</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">true</EagleUseNamespaces>
    <EagleWindows Condition="'$(EagleWindows)' == ''">false</EagleWindows>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: This is NOT an "official release" build configuration.  This build
            configuration is primarily designed for use when actively working
            on the Eagle core library during development.  Most default values
            from the settings file (i.e. "Eagle.Settings.targets") are used;
            however, some of the defaults are overridden here to ease testing
            of new features and optimizations.  Please refer to the file
            "Eagle.Settings.targets" (or the source code) for further details
            of what each setting does.

      NOTE: When building this configuration directly from MSBuild (i.e. not via
            the "flight.bat" tool), the EaglePatchLevel property must be set to
            false, by adding this to the build command line:

                /property:EaglePatchLevel=false

            Otherwise, compilation errors will occur due to the AssemblyVersion
            attribute value being null.
  -->
  <PropertyGroup Condition="'$(EagleBuildType)' == 'Development'">
    <EagleAppDomains Condition="'$(EagleAppDomains)' == ''">true</EagleAppDomains>
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">true</EagleAssemblyRelease>
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">true</EagleAssemblyStrongNameTag>
    <!--
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">true</EagleAssemblyTag>
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">true</EagleAssemblyText>
    <!--
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">true</EagleAssemblyUri>
    -->
    <!--
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">true</EagleAuthenticodeSign>
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">true</EagleAuthenticodeSign32BitOnly>
    -->
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">true</EagleCacheDictionary>
    <EagleCasPolicy Condition="'$(EagleCasPolicy)' == ''">true</EagleCasPolicy>
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''">Development</EagleConfigurationSuffix>
    <EagleDeadCode Condition="'$(EagleDeadCode)' == ''">true</EagleDeadCode>
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">true</EagleEmbeddedLibrary>
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">true</EagleFastErrorCode>
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">true</EagleFastErrorInfo>
    <EagleForTestUseOnly Condition="'$(EagleForTestUseOnly)' == ''">true</EagleForTestUseOnly>
    <EagleIsolatedInterpreters Condition="'$(EagleIsolatedInterpreters)' == ''">true</EagleIsolatedInterpreters>
    <EagleIsolatedPlugins Condition="'$(EagleIsolatedPlugins)' == ''">true</EagleIsolatedPlugins>
    <EagleMaybeTrace Condition="'$(EagleMaybeTrace)' == ''">true</EagleMaybeTrace>
    <EagleObsolete Condition="'$(EagleObsolete)' == ''">true</EagleObsolete>
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">true</EaglePatchLevel>
    <EaglePolicyTrace Condition="'$(EaglePolicyTrace)' == ''">true</EaglePolicyTrace>
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">true</EagleScriptArguments>
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">true</EagleSourceId>
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">true</EagleSourceTimeStamp>
    <EagleStatic Condition="'$(EagleStatic)' == ''">true</EagleStatic>
    <EagleTclWrapper Condition="'$(EagleTclWrapper)' == ''">true</EagleTclWrapper>
    <EagleUnix Condition="'$(EagleUnix)' == ''">true</EagleUnix>
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">true</EagleUseAppDomainForId>
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">true</EagleUseNamespaces>
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">true</EmbedCertificates>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                             Eagle Test Types                             **
  ******************************************************************************
  -->

  <!--
      HACK: Apparently, we must be quiet with v3.5 or higher of MSBuild because
            it sees any output to the standard error stream as an indication it
            should proceed to fail the entire build process.  There is supposed
            to be a workaround by setting the "IgnoreStandardErrorWarningFormat"
            property of the "Exec" task to true; however, some reports seem to
            indicate that this is a flaky workaround, at best.  Also, it is not
            available with the .NET Framework 2.0 version of MSBuild; therefore,
            we cannot use it anyway.  Also, disable various tests that interact
            poorly with MSBuild, such as those requiring network access, an
            interactive desktop session, integration via COM, or very precise
            timing.  Finally, set the stop-on-failure flag for the test suite so
            that we halt the entire build process immediately upon encountering
            the first test failure.
  -->
  <PropertyGroup Condition="'$(EagleTestType)' != ''">
    <EagleCommonTestArguments Condition="'$(EagleCommonTestArguments)' == ''">-namespaces true -anyInitialize &quot;set ::no(speech) true; set ::no(excel) true; set ::no(preciseTiming) true; set ::no(temporaryTestLog) true; set ::test_stop_on_failure true; set ::test_stop_on_leak true; object invoke Interpreter.GetActive Quiet true; object invoke -flags +NonPublic Interpreter.GetActive SetNoBackgroundError true; catch {source [file join $::env(XDG_STARTUP_HOME) releaseTestingHelper.eagle]; setupForReleaseTesting {$(EagleTestNotFile)} {$(EagleTestFile)} {$(EagleTestType)} {$(EagleTestAll)}}&quot;</EagleCommonTestArguments>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: For all non-default builds, set the build suffix for this test run
            (primarily for the benefit of the test log file).
  -->
  <PropertyGroup Condition="'$(EagleTestType)' != '' And
                            '$(EagleTestType)' != 'Default' And
                            '$(EagleTestType)' != 'NetFx20'">
    <EagleTestArguments Condition="'$(EagleTestArguments)' == ''">-anyInitialize &quot;set ::eagle_platform(suffix) $(EagleConfigurationSuffix)&quot;</EagleTestArguments>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <!--
      HACK: For all non-default builds, we want to show all leaked information,
            except assemblies and processes, which are not counted against the
            running test suite.
  -->
  <PropertyGroup Condition="'$(EagleTestType)' != ''">
    <!--
    <EagleTestFlags>$(EagleTestFlags) -listedLeaks &quot;afters variables commands procedures namespaces files temporaryFiles channels aliases interpreters environment loaded previousPid scopes assemblies processes objects objectCallbacks objectTypes objectInterfaces objectNamespaces connections transactions modules delegates tcl tclInterps tclThreads tclCommands scriptThreads&quot;</EagleTestFlags>
    -->
    <EagleTestFlags>$(EagleTestFlags) -listedLeaks &quot;afters variables commands procedures namespaces files temporaryFiles channels aliases interpreters environment loaded previousPid scopes objects objectCallbacks objectTypes objectInterfaces objectNamespaces connections transactions modules delegates tcl tclInterps tclThreads tclCommands scriptThreads&quot;</EagleTestFlags>
  </PropertyGroup>
</Project>

Added Externals/Eagle/Targets/Eagle.Presets.targets.































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!--
 *
 * Eagle.Presets.targets -
 *
 * WARNING: Contains more evil MSBuild hacks than your doctor recommended.
 *
 * Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: $
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **                          Load Per-User Settings                          **
  ******************************************************************************
  -->

  <!--
      NOTE: If the per-user settings file exists, import it now.  The contained
            settings, if any, will override the default ones provided below.
  -->
  <Import Condition="'$(EagleDir)' != '' And
                     !HasTrailingSlash('$(EagleDir)') And
                     Exists('$(EagleDir)\Targets\Eagle.Presets.targets.user')"
          Project="$(EagleDir)\Targets\Eagle.Presets.targets.user" />

  <!--
  ******************************************************************************
  **                   Target Framework Control Properties                    **
  ******************************************************************************
  -->

  <PropertyGroup>
    <!--
        NOTE: Building for .NET Standard 2.0?  By default, this is disabled.
              If this is enabled, features that are not present in the .NET
              Standard will be unavailable.  When building for .NET Standard,
              this is not the only setting that must be used.  The following
              settings must also be set to the following values:

              /property:EagleAppDomains=false
              /property:EagleCasPolicy=false
              /property:EagleConfiguration=false
              /property:EagleDrawing=false
              /property:EagleEmit=false
              /property:EagleIsolatedInterpreters=false
              /property:EagleIsolatedPlugins=false
              /property:EagleRemoting=false
              /property:EagleWinForms=false

              Additionally, when building to support non-Windows platforms,
              the following settings must be set:

              /property:EagleWindows=false
              /property:EagleUnix=true

        HACK: *SPECIAL* Since this property may be needed *before* the build
              types targets file (i.e. "Eagle.Builds.targets") is loaded when
              building projects targeting the .NET Standard, automatically set
              it here if the build type targets the .NET Standard 2.0.  This
              will not override a value set manually via the command line -OR-
              the default value set in the block just above this one.
    -->
    <!--
    <EagleNetStandard20 Condition="'$(EagleBuildType)' == 'NetStandard20' And '$(EagleNetStandard20)' == ''">true</EagleNetStandard20>
    -->
    <EagleNetStandard20 Condition="'$(EagleNetStandard20)' == ''">false</EagleNetStandard20>

    <!--
        NOTE: Building for .NET Standard 2.1?  By default, this is disabled.
              Also, for this to have any effect, it must be combined with the
              EagleNetStandard20 property (just above).  If this is enabled,
              some functionality unavailable in the .NET Standard 2.0 -AND-
              available in the .NET Standard 2.1 may be used.

        HACK: *SPECIAL* Since this property may be needed *before* the build
              types targets file (i.e. "Eagle.Builds.targets") is loaded when
              building projects targeting the .NET Standard, automatically set
              it here if the build type targets the .NET Standard 2.1.  This
              will not override a value set manually via the command line -OR-
              the default value set in the block just above this one.
    -->
    <EagleNetStandard21 Condition="'$(EagleBuildType)' == 'NetStandard21' And '$(EagleNetStandard21)' == ''">true</EagleNetStandard21>
    <EagleNetStandard21 Condition="'$(EagleNetStandard21)' == ''">false</EagleNetStandard21>

    <!--
        NOTE: When building for the .NET Standard 2.x, enable features that rely
              on extra package or framework references?  By default, this is
              enabled.  If this is disabled, some features will be unavailable.
    -->
    <EagleNetCoreReferences Condition="'$(EagleBuildType)' == '' And '$(EagleNetCoreReferences)' == ''">true</EagleNetCoreReferences>

    <!--
        NOTE: When building for the .NET Standard 2.x, enable features that rely
              on extra APIs provided by the .NET Core 2.0?  By default, this is
              enabled.  If this is disabled, some features will be unavailable.
    -->
    <EagleNetCore20 Condition="'$(EagleBuildType)' == '' And '$(EagleNetCore20)' == ''">true</EagleNetCore20>

    <!--
        NOTE: When building for the .NET Standard 2.x, enable features that rely
              on extra APIs provided by the .NET Core 3.0?  By default, this is
              enabled.  If this is disabled, some features will be unavailable.
    -->
    <EagleNetCore30 Condition="'$(EagleBuildType)' == '' And '$(EagleNetCore30)' == ''">true</EagleNetCore30>
  </PropertyGroup>
</Project>

Added Externals/Eagle/Targets/Eagle.Sample.targets.











































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<!--
 *
 * Eagle.Sample.targets -
 *
 * WARNING: Contains more evil MSBuild hacks than your doctor recommended.
 *
 * Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: $
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **                          Load Per-User Settings                          **
  ******************************************************************************
  -->

  <!--
      NOTE: If the per-user settings file exists, import it now.  The contained
            settings, if any, will override the default ones provided below.
  -->
  <Import Condition="'$(EagleDir)' != '' And
                     !HasTrailingSlash('$(EagleDir)') And
                     Exists('$(EagleDir)\Targets\Eagle.Sample.targets.user')"
          Project="$(EagleDir)\Targets\Eagle.Sample.targets.user" />

  <!--
  ******************************************************************************
  **                           Eagle Sample Targets                           **
  ******************************************************************************
  -->

  <Import Condition="'$(EagleSampleTargets)' != 'false'"
          Project="Eagle.tasks" />

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: *WARNING* Be sure to update the "Inputs" attribute for the targets
            EagleSamplePackagesResGen* in this file and the list of files in the
            file "Sample\Resources\packages.resx" if any files are added to the
            sample script packages.
  -->
  <Target Name="EagleSamplePackagesResGenUnsetReadOnly"
          Condition="('$(EagleSamplePackagesResGen)' != 'false' Or
                      '$(EagleSamplePackagesResGenExternals)' != 'false') And
                     '$(EagleSampleUnsetReadOnly)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(SystemRoot)' != '' And
                     !HasTrailingSlash('$(SystemRoot)') And
                     Exists('$(SystemRoot)\System32\attrib.exe')"
          Inputs="Resources\packages.resx;Resources\sample.eagle"
          Outputs="Resources\packages.resources">
    <Exec Condition="Exists('Resources\packages.resources')"
          Command="&quot;$(SystemRoot)\System32\attrib.exe&quot; -r Resources\packages.resources" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: *WARNING* Be sure to update the "Inputs" attribute for the targets
            EagleSamplePackagesResGen* in this file and the list of files in the
            file "Sample\Resources\packages.resx" if any files are added to the
            sample script packages.
  -->
  <Target Name="EagleSamplePackagesResGen"
          Condition="'$(EagleSamplePackagesResGen)' != 'false'"
          Inputs="Resources\packages.resx;Resources\sample.eagle"
          Outputs="Resources\packages.resources">
    <GenerateResource Sources="Resources\packages.resx"
                      OutputResources="Resources\packages.resources" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: *WARNING* Be sure to update the "Inputs" attribute for the targets
            EagleSamplePackagesResGen* in this file and the list of files in the
            file "Sample\Resources\packages.resx" if any files are added to the
            sample script packages.
  -->
  <Target Name="EagleSamplePackagesResGenExternals"
          Condition="'$(EagleSamplePackagesResGen)' == 'false' And
                     '$(EagleSamplePackagesResGenExternals)' != 'false' And
                     ((('$(MSBuildToolsVersion)' == '4.0' Or
                        '$(MSBuildToolsVersion)' == '12.0' Or
                        '$(MSBuildToolsVersion)' == '14.0' Or
                        '$(MSBuildToolsVersion)' == '15.0' Or
                        '$(MSBuildToolsVersion)' == 'Current') And
                       '$(TargetFrameworkVersion)' == '') Or
                      '$(TargetFrameworkVersion)' == 'v4.0' Or
                      '$(TargetFrameworkVersion)' == 'v4.5' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.6' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.7' Or
                      '$(TargetFrameworkVersion)' == 'v4.7.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.7.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.8' Or
                      '$(TargetFrameworkVersion)' == 'v4.8.1') And
                     '$(EagleDir)' != '' And
                     !HasTrailingSlash('$(EagleDir)') And
                     Exists('$(EagleDir)\Externals\NETFX\Tools\v4.0\ResGen.exe')"
          Inputs="Resources\packages.resx;Resources\sample.eagle"
          Outputs="Resources\packages.resources">
    <GenerateResource Sources="Resources\packages.resx"
                      OutputResources="Resources\packages.resources"
                      SdkToolsPath="$(EagleDir)\Externals\NETFX\Tools\v4.0" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Condition="'$(EagleSampleTargets)' != 'false'"
          Name="ProcessSampleScripts"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).ProcessSampleScripts.done">
    <!--
        NOTE: These scripts could do virtually anything.  Here we demonstrate
              something that cannot be easily accomplished by using MSBuild
              alone even though it is fairly trivial.
    -->
    <EvaluateExpression Text="2 + 2">
      <Output TaskParameter="Code" PropertyName="EvaluateExpressionCode" />
      <Output TaskParameter="Result" PropertyName="EvaluateExpressionResult" />
    </EvaluateExpression>

    <EvaluateScript Text="return [file version {$(TargetPath)}]">
      <Output TaskParameter="Code" PropertyName="EvaluateScriptCode1" />
      <Output TaskParameter="Result" PropertyName="EvaluateScriptResult1" />
    </EvaluateScript>

    <EvaluateScript Args="one two {three four}" Text="return [list [llength $argv] $argv]">
      <Output TaskParameter="Code" PropertyName="EvaluateScriptCode2" />
      <Output TaskParameter="Result" PropertyName="EvaluateScriptResult2" />
    </EvaluateScript>

    <!--
        HACK: The [catch] command used here is necessary, in some cases, to
              prevent a build error due to mismatch between the CLR version
              of the built Eagle assembly with that of MSBuild, e.g. Eagle
              built for the .NET Framework 2.0 via an MSBuild built for the
              .NET Framework 4.0.
    -->
    <EvaluateScript Args="High" Text="catch {__task BuildEngine.LogMessageEvent [set e [object create Microsoft.Build.Framework.BuildMessageEventArgs {some high-priority build message} null EagleTasks $argv]]; unset e}">
      <Output TaskParameter="Code" PropertyName="EvaluateScriptCode3" />
      <Output TaskParameter="Result" PropertyName="EvaluateScriptResult3" />
    </EvaluateScript>

    <EvaluateFile Condition="'$(EagleLibraryDir)' != '' And
                             HasTrailingSlash('$(EagleLibraryDir)') And
                             Exists('$(EagleLibraryDir)Tests\data\evaluate.eagle')"
                  Text="$(EagleLibraryDir)Tests\data\evaluate.eagle">
      <Output TaskParameter="Code" PropertyName="EvaluateFileCode" />
      <Output TaskParameter="Result" PropertyName="EvaluateFileResult" />
    </EvaluateFile>

    <SubstituteString Text="[file version {$(TargetPath)}]">
      <Output TaskParameter="Code" PropertyName="SubstituteStringCode" />
      <Output TaskParameter="Result" PropertyName="SubstituteStringResult" />
    </SubstituteString>

    <SubstituteFile Condition="'$(EagleLibraryDir)' != '' And
                               HasTrailingSlash('$(EagleLibraryDir)') And
                               Exists('$(EagleLibraryDir)Tests\data\substitute.eagle')"
                    Text="$(EagleLibraryDir)Tests\data\substitute.eagle">
      <Output TaskParameter="Code" PropertyName="SubstituteFileCode" />
      <Output TaskParameter="Result" PropertyName="SubstituteFileResult" />
    </SubstituteFile>

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).ProcessSampleScripts.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Condition="'$(EagleSampleTargets)' != 'false'"
          Name="ShowSampleScriptOutput"
          DependsOnTargets="ProcessSampleScripts"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).ShowSampleScriptOutput.done">
    <!--
        NOTE: Here, we simply display the output variables produced by the
              ProcessSampleScripts task.
    -->
    <Message Text="EvaluateExpression: $(EvaluateExpressionCode) $(EvaluateExpressionResult)" />
    <Message Text="EvaluateScript1: $(EvaluateScriptCode1) $(EvaluateScriptResult1)" />
    <Message Text="EvaluateScript2: $(EvaluateScriptCode2) $(EvaluateScriptResult2)" />
    <Message Text="EvaluateScript3: $(EvaluateScriptCode3) $(EvaluateScriptResult3)" />
    <Message Text="SubstituteString: $(SubstituteStringCode) $(SubstituteStringResult)" />

    <Message Text="EvaluateFile: $(EvaluateFileCode) $(EvaluateFileResult)" />
    <Message Text="SubstituteFile: $(SubstituteFileCode) $(SubstituteFileResult)" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).ShowSampleScriptOutput.done" />
  </Target>
</Project>

Added Externals/Eagle/Targets/Eagle.Settings.targets.







































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
<!--
 *
 * Eagle.Settings.targets -
 *
 * WARNING: Contains more evil MSBuild hacks than your doctor recommended.
 *
 * Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: $
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **                          Load Per-User Settings                          **
  ******************************************************************************
  -->

  <!--
      NOTE: If the per-user settings file exists, import it now.  The contained
            settings, if any, will override the default ones provided below.
  -->
  <Import Condition="'$(EagleDir)' != '' And
                     !HasTrailingSlash('$(EagleDir)') And
                     Exists('$(EagleDir)\Targets\Eagle.Settings.targets.user')"
          Project="$(EagleDir)\Targets\Eagle.Settings.targets.user" />

  <!--
  ******************************************************************************
  **                       [Fairly] Generic Properties                        **
  ******************************************************************************
  -->

  <PropertyGroup>
    <!--
        NOTE: *UNCONDITIONAL* We never want to the "Prefer 32-bit" setting
              to be enabled.  Make sure it is always false.  This seems to
              be necessary as of Visual Studio 2017.
    -->
    <Prefer32Bit>false</Prefer32Bit>

    <!--
        NOTE: *UNCONDITIONAL* We never want to use the hosting process for
              debugging.  It causes problems.
    -->
    <UseVSHostingProcess>false</UseVSHostingProcess>

    <!--
        NOTE: *UNCONDITIONAL* We never want to use the fast up-to-date check
              that Visual Studio provides.
    -->
    <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>

    <!--
        HACK: *UNCONDITIONAL* The Visual Studio IDE ignores the
              BaseIntermediateOutputPath property and creates empty "bin" and
              "obj" directories for every project whenever the project is opened
              or built.  Also, the Visual Studio IDE will occasionally fail to
              rebuild the project due to this confusion.  The situation appears
              to improve somewhat when this is set to false.  Please note that
              even if this is set to false, things still do not work 100%
              correctly; however, at least there appears to be less build
              failures.

              Please see Microsoft Connect FeedbackID 105854 for their official
              list of excuses, on this now more than 3 year old bug.
    -->
    <UseHostCompilerIfAvailable>false</UseHostCompilerIfAvailable>

    <!--
        HACK: *UNCONDITIONAL* Prevent the (useless?) "*.deps.json" files from
              being generated as it sometimes causes an unhandled exception to
              be thrown from within the .NET Core runtime.  It is unclear why
              this file would ever be necessary for .NET Core project that only
              relies upon assemblies included with the .NET Core base runtime.
    -->
    <GenerateDependencyFile>false</GenerateDependencyFile>

    <!--
        HACK: *UNCONDITIONAL* Prevent any "default" embedded manifest file from
              being included in the built executables.
    -->
    <NoWin32Manifest>true</NoWin32Manifest>

    <!--
        HACK: *UNCONDITIONAL* Prevent use of the new strong name handling from
              the Roslyn C# compiler.
    -->
    <!--
    <Features>$(Features);UseLegacyStrongNameProvider</Features>
    -->

    <!--
        NOTE: Enable use of the custom MSBuild tasks during the build?  By
              default, this is enabled.  If this is disabled, custom build
              targets that use these tasks may fail.
    -->
    <EagleTaskTargets Condition="'$(EagleTaskTargets)' == ''">true</EagleTaskTargets>

    <!--
        NOTE: What is the target framework version for the solution?  Normally,
              this is set at the project level; however, there are times when it
              is convenient (or necessary) to set it globally.
    -->
    <!--
    <TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v4.8.1</TargetFrameworkVersion>
    -->

    <!--
        NOTE: Should the "BaseIntermediateOutputPath" property be reset so that
              it is contained in the solution directory instead of individual
              project directories?  By default, this is enabled.  This does not
              work with .NET Core.
    -->
    <EagleBaseIntermediateOutputPath Condition="'$(EagleBaseIntermediateOutputPath)' == ''">true</EagleBaseIntermediateOutputPath>

    <!--
        NOTE: Enable use of the strong name signing tool without verifying that
              the .NET Framework SDK is installed?  If this is disabled and the
              .NET Framework SDK is not installed, strong name signing will be
              unavailable.  By default, this is disabled.
    -->
    <StrongNameWithoutSdk Condition="'$(StrongNameWithoutSdk)' == ''">false</StrongNameWithoutSdk>

    <!--
        NOTE: What is the selected build type?  Typically, this property is set
              only during the official release process (i.e. by the release
              preparation tool); however, it may be set during development as
              well.  Currently, the following build types are supported (refer
              to the "Eagle.Builds.targets" file for additional information on
              each build type):

                  "NetFx20": Official configuration for the .NET Framework 2.0.
                  "NetFx35": Configuration for the .NET Framework 3.5.
                  "NetFx40": Official configuration for the .NET Framework 4.0.
                  "NetFx45": Configuration for the .NET Framework 4.5.
                 "NetFx451": Configuration for the .NET Framework 4.5.1.
                 "NetFx452": Configuration for the .NET Framework 4.5.2.
                  "NetFx46": Configuration for the .NET Framework 4.6.
                 "NetFx461": Configuration for the .NET Framework 4.6.1.
                 "NetFx462": Configuration for the .NET Framework 4.6.2.
                  "NetFx47": Configuration for the .NET Framework 4.7.
                 "NetFx471": Configuration for the .NET Framework 4.7.1.
                 "NetFx472": Configuration for the .NET Framework 4.7.2.
                  "NetFx48": Configuration for the .NET Framework 4.8.
                 "NetFx481": Configuration for the .NET Framework 4.8.1.
            "NetStandard20": Configuration for the .NET Standard 2.0.
            "NetStandard21": Configuration for the .NET Standard 2.1.
                     "Bare": Omits all optional features for testing purposes.
              "LeanAndMean": Omits features that may negatively impact speed.
                 "Database": Omits features that do not work inside SQL Server.
               "MonoOnUnix": Official release options for Mono on Unix.
              "Development": Configuration for active Eagle development.
                  "Default": Currently, this is identical to "NetFx20".

              Since this file is not included by the project files until after
              the "Eagle.Builds.targets" file (i.e. because it relies upon some
              properties defined in this file), simply uncommenting the line
              below will not work.  Instead, it must be manually copied into a
              file named "Eagle.Builds.targets.user" in this directory.
    -->
    <!--
    <EagleBuildType Condition="'$(EagleBuildType)' == ''">Default</EagleBuildType>
    -->
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                    Eagle Standard Edition Properties                     **
  ******************************************************************************
  -->

  <PropertyGroup>
    <!--
        NOTE: Is the current project being built as part of an official Eagle
              release?  By default, this is disabled.  If this is enabled, this
              build will be considered official; otherwise, this build will not
              be considered official.  This should only be set to true by the
              Eagle Development Team.
    -->
    <EagleOfficial Condition="'$(EagleOfficial)' == ''">false</EagleOfficial>

    <!--
        NOTE: Is the current project being built as part of a stable Eagle
              release?  By default, this is disabled.  If this is enabled, this
              build will be considered stable; otherwise, this build will not
              be considered stable.  This should only be set to true by the
              Eagle Development Team.
    -->
    <EagleStable Condition="'$(EagleStable)' == ''">false</EagleStable>

    <!--
        NOTE: Is the current project being built as part of an Eagle solution
              that includes the Eagle core library source code?  By default,
              this is enabled.  If this is enabled, the current project should
              be built with a reference to the Eagle core library project (i.e.
              the project containing the source code for the Eagle core library
              itself) instead of a reference to a pre-built Eagle core library
              assembly.
    -->
    <EagleSolution Condition="'$(EagleSolution)' == ''">true</EagleSolution>

    <!--
        NOTE: The official display name for the project being compiled.  This
              can be overridden in each project file.
    -->
    <EagleProjectName Condition="'$(EagleProjectName)' == ''">Eagle</EagleProjectName>

    <!--
        NOTE: The directory where the last-known-good (LKG) build of Eagle can
              be found.
    -->
    <EagleLkgDir Condition="'$(EagleLkgDir)' == ''">$(LKG)\Eagle</EagleLkgDir>

    <!--
        NOTE: Enable the externally updated "PatchLevel.cs" file to define the
              assembly version?  By default, this is disabled.  If this is
              enabled, the assembly version will be based on the assembly
              version attribute defined in the "PatchLevel.cs" file instead of
              the assembly version attribute defined in the "AssemblyInfo.cs"
              file.
    -->
    <EaglePatchLevel Condition="'$(EaglePatchLevel)' == ''">false</EaglePatchLevel>

    <!--
        NOTE: Enable the externally updated "PatchLevel.cs" file to define the
              source identifier?  By default, this is disabled.  If this is
              enabled, the value of the source identifier attribute in the
              "PatchLevel.cs" file will be changed based on the active Fossil
              checkout, if any.  If, for any reason, the source identifier
              cannot be determined (e.g. there is no active Fossil checkout), a
              string of zeros will be used instead.
    -->
    <EagleSourceId Condition="'$(EagleSourceId)' == ''">false</EagleSourceId>

    <!--
        NOTE: Enable the externally updated "PatchLevel.cs" file to define the
              source timestamp?  By default, this is disabled.  If this is
              enabled, the value of the source timestamp attribute in the
              "PatchLevel.cs" file will be changed based on the active Fossil
              checkout, if any.  If, for any reason, the source timestamp
              cannot be determined (e.g. there is no active Fossil checkout), a
              string of zeros will be used instead.
    -->
    <EagleSourceTimeStamp Condition="'$(EagleSourceTimeStamp)' == ''">false</EagleSourceTimeStamp>

    <!--
        NOTE: Enable externally updated files, such as "PatchLevel.cs" and
              "BuildInfo.cs", to include the strong name "tag" (i.e. a string
              that describes the strong name key pair in use)?  By default, this
              is disabled.  If this is enabled, the value of the assembly strong
              name tag attribute will be changed to the value read from the
              "stdin" channel during the release preparation process, if any;
              otherwise, a null string will be used.  If this is disabled, no
              assembly strong name tag attribute will be included.
    -->
    <EagleAssemblyStrongNameTag Condition="'$(EagleAssemblyStrongNameTag)' == ''">false</EagleAssemblyStrongNameTag>

    <!--
        NOTE: Enable externally updated files, such as "PatchLevel.cs" and
              "BuildInfo.cs", to include some text defined by the user?  By
              default, this is disabled.  If this is enabled, the value of the
              assembly text attribute will be changed to the value read from the
              "stdin" channel during the release preparation process, if any;
              otherwise, a null string will be used.  If this is disabled, no
              assembly text attribute will be included.
    -->
    <EagleAssemblyText Condition="'$(EagleAssemblyText)' == ''">false</EagleAssemblyText>

    <!--
        NOTE: Enable externally updated files, such as "PatchLevel.cs" and
              "BuildInfo.cs", to include date/time information defined by the
              user?  By default, this is disabled.  If this is enabled, the
              value of the assembly date/time attribute may be changed based on
              a user-specified value during the release preparation process, if
              any; otherwise, an invalid date/time value will be used.  If this
              is disabled, a default assembly date/time attribute based on the
              executable image date/time will be included instead.
    -->
    <EagleAssemblyDateTime Condition="'$(EagleAssemblyDateTime)' == ''">false</EagleAssemblyDateTime>

    <!--
        NOTE: Enable externally updated files, such as "PatchLevel.cs" and
              "BuildInfo.cs", to include some release information defined by the
              user?  By default, this is disabled.  If this is enabled, the
              value of the assembly release attribute will be changed to the
              value read from the "stdin" channel during the release preparation
              process, if any; otherwise, a null string will be used.  If this
              is disabled, no assembly release attribute will be included.
    -->
    <EagleAssemblyRelease Condition="'$(EagleAssemblyRelease)' == ''">false</EagleAssemblyRelease>

    <!--
        NOTE: Enable externally updated files, such as "PatchLevel.cs" and
              "BuildInfo.cs", to include some text defined by the user?  By
              default, this is disabled.  If this is enabled, the value of the
              assembly tag attribute will be changed to the value read from the
              "stdin" channel during the release preparation process, if any;
              otherwise, a null string will be used.  If this is disabled, no
              assembly tag attribute will be included.
    -->
    <EagleAssemblyTag Condition="'$(EagleAssemblyTag)' == ''">false</EagleAssemblyTag>

    <!--
        NOTE: Enable externally updated files, such as "PatchLevel.cs" and
              "BuildInfo.cs", to include some text defined by the user?  By
              default, this is disabled.  If this is enabled, the value of the
              assembly URI attribute will be changed to the value read from the
              "stdin" channel during the release preparation process, if any;
              otherwise, a null string will be used.  If this is disabled, no
              assembly URI attribute will be included.
    -->
    <EagleAssemblyUri Condition="'$(EagleAssemblyUri)' == ''">false</EagleAssemblyUri>

    <!--
        NOTE: The name of an extra file to include in the core library as an
              embedded resource.  By default, this is an empty string (i.e.
              there is no extra file to embed).  If this is not an empty string,
              it will be interpreted as the name of an existing file containing
              content to include in the core library as an embedded resource.
    -->
    <EagleEmbeddedResourceFile Condition="'$(EagleEmbeddedResourceFile)' == ''"></EagleEmbeddedResourceFile>

    <!--
        NOTE: The logical name to use for the extra embedded resource that is
              specified by the EagleEmbeddedResourceFile property (above).  By
              default, this is an empty string.  If this is not an empty string,
              it will override the default logical name generated by the build
              system.
    -->
    <EagleEmbeddedResourceName Condition="'$(EagleEmbeddedResourceName)' == ''"></EagleEmbeddedResourceName>

    <!--
        NOTE: The name of a command line arguments file to include in the core
              library as an embedded resource.  By default, this is an empty
              string (i.e. there is no command line arguments file to embed).
              If this is not an empty string, it will be interpreted as the
              name of an existing file containing content to include in the
              core library as an embedded resource.
    -->
    <EagleArgsResourceFile Condition="'$(EagleArgsResourceFile)' == ''"></EagleArgsResourceFile>

    <!--
        NOTE: The logical name to use for the command line arguments embedded
              resource that is specified by the EagleArgsResourceFile property
              (above).  By default, this is an empty string.  If this is not an
              empty string, it will override the default logical name generated
              by the build system.
    -->
    <EagleArgsResourceName Condition="'$(EagleArgsResourceName)' == ''"></EagleArgsResourceName>

    <!--
        NOTE: The official URL for the project(s) being compiled.  This can be
              overridden in each project file.
    -->
    <EagleProjectUrl Condition="'$(EagleProjectUrl)' == ''">https://eagle.to/</EagleProjectUrl>

    <!--
        NOTE: The official Authenticode time-stamping URL for the project(s)
              being compiled.  This can be overridden in each project file.
    -->
    <EagleTimeStampUrl Condition="'$(EagleTimeStampUrl)' == ''">http://timestamp.verisign.com/scripts/timstamp.dll</EagleTimeStampUrl>

    <!--
        NOTE: In the event of an Authenticode time-stamping failure, the number
              of times to retry the time-stamping operation.
    -->
    <EagleTimeStampRetries Condition="'$(EagleTimeStampRetries)' == ''">10</EagleTimeStampRetries>

    <!--
        NOTE: In the event of an Authenticode time-stamping failure, the number
              of seconds to wait between each retry.
    -->
    <EagleTimeStampWait Condition="'$(EagleTimeStampWait)' == ''">60</EagleTimeStampWait>

    <!--
        NOTE: The official primary Authenticode RFC 3161 time-stamping URL
              for the project(s) being compiled.  This can be overridden in
              each project file.
    -->
    <EagleRfcTimeStampUrl1 Condition="'$(EagleRfcTimeStampUrl1)' == ''">http://timestamp.globalsign.com/</EagleRfcTimeStampUrl1>

    <!--
        NOTE: The official primary Authenticode RFC 3161 time-stamping digest
              algorithm to use.  This should be a SHA2 based algorithm, such as
              SHA512.
    -->
    <EagleRfcTimeStampAlgorithm1 Condition="'$(EagleRfcTimeStampAlgorithm1)' == ''">sha512</EagleRfcTimeStampAlgorithm1>

    <!--
        NOTE: The official secondary Authenticode RFC 3161 time-stamping URL
              for the project(s) being compiled.  This can be overridden in
              each project file.
    -->
    <EagleRfcTimeStampUrl2 Condition="'$(EagleRfcTimeStampUrl2)' == ''">http://timestamp.digicert.com/</EagleRfcTimeStampUrl2>

    <!--
        NOTE: The official secondary Authenticode RFC 3161 time-stamping digest
              algorithm to use.  This should be a SHA2 based algorithm, such as
              SHA512.
    -->
    <EagleRfcTimeStampAlgorithm2 Condition="'$(EagleRfcTimeStampAlgorithm2)' == ''">sha1</EagleRfcTimeStampAlgorithm2>

    <!--
        NOTE: The official tertiary Authenticode RFC 3161 time-stamping URL
              for the project(s) being compiled.  This can be overridden in
              each project file.
    -->
    <EagleRfcTimeStampUrl3 Condition="'$(EagleRfcTimeStampUrl3)' == ''">http://timestamp.digicert.com/</EagleRfcTimeStampUrl3>

    <!--
        NOTE: The official tertiary Authenticode RFC 3161 time-stamping digest
              algorithm to use.  This should be a SHA1 based algorithm, such as
              SHA1.
    -->
    <EagleRfcTimeStampAlgorithm3 Condition="'$(EagleRfcTimeStampAlgorithm3)' == ''">sha512</EagleRfcTimeStampAlgorithm3>

    <!--
        NOTE: The suffix for the name of the build configuration directory .  By
              default, this is an empty string.
    -->
    <EagleConfigurationSuffix Condition="'$(EagleConfigurationSuffix)' == ''"></EagleConfigurationSuffix>

    <!--
        NOTE: Include code in the library that can produce verbose diagnostic
              output?  By default, this is disabled.  If this is enabled, some
              extra diagnostic messages may be generated.
    -->
    <EagleVerbose Condition="'$(EagleVerbose)' == ''">false</EagleVerbose>

    <!--
        NOTE: Include code in the library that is not currently used?  By
              default, this is disabled.  If this is enabled, some code will be
              compiled into the library that is not currently used; however,
              this helps makes sure that the code does not become too "stale".
    -->
    <EagleDeadCode Condition="'$(EagleDeadCode)' == ''">false</EagleDeadCode>

    <!--
        NOTE: Include code in the library that is obsolete?  By default, this is
              disabled.  If this is enabled, obsolete features may be compiled
              into the library.  These features should not be used by any new
              projects.  This option is provided for backwards compatibility.
    -->
    <EagleObsolete Condition="'$(EagleObsolete)' == ''">false</EagleObsolete>

    <!--
        NOTE: Remove the read-only flag from files that are "well-known" to be
              generated during the build process?  By default, this is enabled.
              If this is disabled and files that need to be regenerated are
              flagged as read-only, build errors may occur.
    -->
    <EagleUnsetReadOnly Condition="'$(EagleUnsetReadOnly)' == ''">true</EagleUnsetReadOnly>

    <!--
        NOTE: Generate the "Generated\messages.*" files to be used by the core
              library using the "Messages\messages.xml" file as the basis for
              them?  By default, this is disabled.  If this is enabled, several
              files will be created or modified in the "Generated" directory
              during the build process for the core library.  Normally, this
              build target is not really necessary because the generated files
              are already provided with the project source code.
    -->
    <EagleMsgGen Condition="'$(EagleMsgGen)' == ''">false</EagleMsgGen>

    <!--
        NOTE: Generate the "Resources\messages.resources" file to be used by the
              core library using the "Resources\messages.resx" file as the basis
              for it?  By default, this is disabled.  If this is enabled, the
              "Resources\messages.resources" file will be created or modified
              during the build process for the core library.  Normally, this
              build target is not really necessary because the generated file is
              already provided with the project source code.
    -->
    <EagleMessagesResGen Condition="'$(EagleMessagesResGen)' == ''">false</EagleMessagesResGen>

    <!--
        NOTE: Generate the "Resources\library.resources" file to be used by the
              core library using the "Resources\library.resx" file (and all the
              files contained in the core script library itself) as the basis
              for it?  By default, this is enabled.  If this is enabled, the
              "Resources\library.resources" file will be created or modified
              during the build process for the core library.  Normally, this
              build target is not really necessary because the generated file is
              already provided with the project source code.
    -->
    <EagleLibraryResGen Condition="'$(EagleLibraryResGen)' == ''">true</EagleLibraryResGen>

    <!--
        NOTE: Generate the "Resources\packages.resources" file to be used by the
              core library using the "Resources\packages.resx" file (and all the
              files contained in the core script packages themselves) as the
              basis for it?  By default, this is enabled.  If this is enabled,
              the "Resources\packages.resources" file will be created or
              modified during the build process for the core library.  Normally,
              this build target is not really necessary because the generated
              file is already provided with the project source code.
    -->
    <EaglePackagesResGen Condition="'$(EaglePackagesResGen)' == ''">true</EaglePackagesResGen>

    <!--
        NOTE: To allow for fairly deep recursion, adjust the default stack size.
              This value must be kept in sync with the "DefaultStackSize" value
              in the "NativeStack.cs" file.  Values may be specified in decimal
              or hexadecimal.  The format of this argument mirrors that of the
              STACK option to the EditBin tool, which is "reserve[,commit]".
    -->
    <EagleDefaultStackSize Condition="'$(EagleDefaultStackSize)' == ''">0x1000000</EagleDefaultStackSize>

    <!--
        NOTE: To allow for fairly deep recursion, adjust the default stack size.
              This value must be kept in sync with the "DefaultStackSize" value
              in the "NativeStack.cs" file.  Values may be specified in decimal
              or hexadecimal.  The format of this argument mirrors that of the
              STACK option to the EditBin tool, which is "reserve[,commit]".
    -->
    <EagleStackSize Condition="'$(EagleStackSize)' == ''">$(EagleDefaultStackSize)</EagleStackSize>

    <!--
        NOTE: Throw an exception if an object has already been disposed?  By
              default, this is enabled.  If this is disabled, an exception will
              not be thrown when an Eagle object which has already been disposed
              is accessed.  While this may sound dangerous, the classes have
              been designed to be fault-tolerant in the face of their disposal;
              therefore, this has not been a real issue in practice.  That being
              said, we enable it by default anyway.
    -->
    <EagleThrowOnDisposed Condition="'$(EagleThrowOnDisposed)' == ''">true</EagleThrowOnDisposed>

    <!--
        NOTE: Embed all the necessary library scripts and other files inside the
              library (i.e. "enable single-file deployment")?  By default, this
              is disabled.  If this is enabled, library scripts will be searched
              for on the native file system first, then via the IHost.GetScript
              method, if necessary.  Otherwise, library scripts will be searched
              for via the IHost.GetScript method first, then on the native file
              system, if necessary.
    -->
    <EagleEmbeddedLibrary Condition="'$(EagleEmbeddedLibrary)' == ''">false</EagleEmbeddedLibrary>

    <!--
        NOTE: Skip all traces, notifications, watches, etc when the engine needs
              to set the global errorCode script variable?  By default, this is
              disabled.  If this is enabled, any code that relies on the default
              behavior of these "events" being fired for the global errorCode
              script variable may not work correctly; however, it can improve
              the overall speed of error handling for the entire library.
    -->
    <EagleFastErrorCode Condition="'$(EagleFastErrorCode)' == ''">false</EagleFastErrorCode>

    <!--
        NOTE: Skip all traces, notifications, watches, etc when the engine needs
              to set the global errorInfo script variable?  By default, this is
              disabled.  If this is enabled, any code that relies on the default
              behavior of these "events" being fired for the global errorInfo
              script variable may not work correctly; however, it can improve
              the overall speed of error handling for the entire library.
    -->
    <EagleFastErrorInfo Condition="'$(EagleFastErrorInfo)' == ''">false</EagleFastErrorInfo>

    <!--
        NOTE: Enable enforcement of limits for results?  By default, this is
              enabled.  If this is enabled, script evaluation performance may
              be reduced.  These limits are not guaranteed to prevent memory
              exhaustion errors.  If disabled, result limits are unavailable
              and cannot be enforced, which may increase the chances of memory
              exhaustion errors.
    -->
    <EagleResultLimits Condition="'$(EagleResultLimits)' == ''">true</EagleResultLimits>

    <!--
        NOTE: Detect the build tool (e.g. MSBuild or XBuild) that is being used.
              By default, this is enabled.  If this is disabled, all build
              targets that require a specific build tool will be disabled.
    -->
    <EagleDetectBuildTool Condition="'$(EagleDetectBuildTool)' == ''">true</EagleDetectBuildTool>

    <!--
        NOTE: Detect the operating system (e.g. Windows_NT or Unix) that is
              being used.  By default, this is enabled.  If this is disabled,
              all build targets that require a specific operating system will be
              disabled.
    -->
    <EagleDetectOperatingSystem Condition="'$(EagleDetectOperatingSystem)' == ''">true</EagleDetectOperatingSystem>

    <!--
        NOTE: Detect the processor architecture (e.g. x86 or x64) that is being
              used.  By default, this is enabled.  If this is disabled, all
              build targets that require a specific processor architecture will
              be disabled.
    -->
    <EagleDetectArchitecture Condition="'$(EagleDetectArchitecture)' == ''">true</EagleDetectArchitecture>

    <!--
        NOTE: Enable detection and use of features defined in the .NET Framework
              2.0 RTM?  By default, this is enabled.  This setting is not really
              meant to be disabled and doing so may cause the build process to
              fail.
    -->
    <EagleDetectNetFx20 Condition="'$(EagleDetectNetFx20)' == ''">true</EagleDetectNetFx20>

    <!--
        NOTE: Enable the build target for detecting which service pack of the
              .NET Framework 2.0 is being used to compile the assembly?  By
              default, this is enabled.  If this is disabled, only features
              present in the .NET Framework 2.0 RTM (i.e. SP0) will be used and
              some features that rely on later service packs may be unavailable.
    -->
    <EagleDetectNetFx20Sp Condition="'$(EagleDetectNetFx20Sp)' == ''">true</EagleDetectNetFx20Sp>

    <!--
        NOTE: Enable detection and use of features defined in the .NET Framework
              3.0 RTM?  By default, this is enabled.
    -->
    <EagleDetectNetFx30 Condition="'$(EagleDetectNetFx30)' == ''">true</EagleDetectNetFx30>

    <!--
        NOTE: Enable detection and use of features defined in the .NET Framework
              3.5 RTM?  By default, this is enabled.
    -->
    <EagleDetectNetFx35 Condition="'$(EagleDetectNetFx35)' == ''">true</EagleDetectNetFx35>

    <!--
        NOTE: Enable detection and use of features defined in the .NET Framework
              4.0 RTM?  By default, this is enabled.
    -->
    <EagleDetectNetFx40 Condition="'$(EagleDetectNetFx40)' == ''">true</EagleDetectNetFx40>

    <!--
        NOTE: Enable detection and use of features defined in the .NET Framework
              4.5 RTM?  By default, this is enabled.
    -->
    <EagleDetectNetFx45 Condition="'$(EagleDetectNetFx45)' == ''">true</EagleDetectNetFx45>

    <!--
        NOTE: Enable detection and use of features defined in the .NET Framework
              4.5.1 RTM?  By default, this is enabled.
    -->
    <EagleDetectNetFx451 Condition="'$(EagleDetectNetFx451)' == ''">true</EagleDetectNetFx451>

    <!--
        NOTE: Enable detection and use of features defined in the .NET Framework
              4.5.2 RTM?  By default, this is enabled.
    -->
    <EagleDetectNetFx452 Condition="'$(EagleDetectNetFx452)' == ''">true</EagleDetectNetFx452>

    <!--
        NOTE: Enable detection and use of features defined in the .NET Framework
              4.6 RTM?  By default, this is enabled.
    -->
    <EagleDetectNetFx46 Condition="'$(EagleDetectNetFx46)' == ''">true</EagleDetectNetFx46>

    <!--
        NOTE: Enable detection and use of features defined in the .NET Framework
              4.6.1 RTM?  By default, this is enabled.
    -->
    <EagleDetectNetFx461 Condition="'$(EagleDetectNetFx461)' == ''">true</EagleDetectNetFx461>

    <!--
        NOTE: Enable detection and use of features defined in the .NET Framework
              4.6.2 RTM?  By default, this is enabled.
    -->
    <EagleDetectNetFx462 Condition="'$(EagleDetectNetFx462)' == ''">true</EagleDetectNetFx462>

    <!--
        NOTE: Enable detection and use of features defined in the .NET Framework
              4.7 RTM?  By default, this is enabled.
    -->
    <EagleDetectNetFx47 Condition="'$(EagleDetectNetFx47)' == ''">true</EagleDetectNetFx47>

    <!--
        NOTE: Enable detection and use of features defined in the .NET Framework
              4.7.1 RTM?  By default, this is enabled.
    -->
    <EagleDetectNetFx471 Condition="'$(EagleDetectNetFx471)' == ''">true</EagleDetectNetFx471>

    <!--
        NOTE: Enable detection and use of features defined in the .NET Framework
              4.7.2 RTM?  By default, this is enabled.
    -->
    <EagleDetectNetFx472 Condition="'$(EagleDetectNetFx472)' == ''">true</EagleDetectNetFx472>

    <!--
        NOTE: Enable detection and use of features defined in the .NET Framework
              4.8 RTM?  By default, this is enabled.
    -->
    <EagleDetectNetFx48 Condition="'$(EagleDetectNetFx48)' == ''">true</EagleDetectNetFx48>

    <!--
        NOTE: Enable detection and use of features defined in the .NET Framework
              4.8.1 RTM?  By default, this is enabled.
    -->
    <EagleDetectNetFx481 Condition="'$(EagleDetectNetFx481)' == ''">true</EagleDetectNetFx481>

    <!--
        NOTE: Prohibit the use of .NET Framework features that require a version
              higher than 2.0 at compile-time?  By default, this is disabled.
              If this is enabled, some features may be unavailable.
    -->
    <EagleOnlyNetFx20 Condition="'$(EagleOnlyNetFx20)' == ''">false</EagleOnlyNetFx20>

    <!--
        NOTE: Enable use of our "Fast Enum" hack for the .NET Framework 2.0?  By
              default, this is disabled because it is flaky and relies upon
              undocumented internal functionality of the .NET Framework.  Leave
              this disabled unless you know exactly what it does.
    -->
    <EagleNetFx20FastEnum Condition="'$(EagleNetFx20FastEnum)' == ''">false</EagleNetFx20FastEnum>

    <!--
        NOTE: For the PowerShell cmdlets, only use verbs from the officially
              approved list?  By default, this is enabled.
    -->
    <EagleApprovedVerbs Condition="'$(EagleApprovedVerbs)' == ''">true</EagleApprovedVerbs>

    <!--
        NOTE: Building for what PowerShell version?  By default, we want version
              1.0.  If the value of this property is 2.0, 3.0, 4.0, or 5.0 and
              we are actually building against PowerShell version 1.0, the build
              will most likely fail.
    -->
    <EaglePowerShellVersion Condition="'$(EaglePowerShellVersion)' == ''">1.0</EaglePowerShellVersion>

    <!--
        NOTE: Building for what WiX version?  Keep in mind that version 3.0 does
              not have support custom "pragmas" nor does it guarantee the
              deterministic finalization of loaded extensions.  By default, we
              want version 3.0.  If the value of this property is 3.5, 3.6, 3.7,
              3.8, 3.9, 3.10, or 3.11 and we are building against WiX version
              3.0, the build will fail.
    -->
    <EagleWixVersion Condition="'$(EagleWixVersion)' == ''">3.0</EagleWixVersion>

    <!--
        NOTE: Where is the WiX 3.0 binary directory (i.e. "WiX.dll") in the
              default install?
    -->
    <EagleWix30Directory Condition="'$(EagleWix30Directory)' == ''">$(ProgramFiles)\Windows Installer XML v3</EagleWix30Directory>

    <!--
        NOTE: Where is the WiX 3.5 binary directory (i.e. "WiX.dll") in the
              default install?
    -->
    <EagleWix35Directory Condition="'$(EagleWix35Directory)' == ''">$(ProgramFiles)\Windows Installer XML v3.5</EagleWix35Directory>

    <!--
        NOTE: Where is the WiX 3.6 binary directory (i.e. "WiX.dll") in the
              default install?
    -->
    <EagleWix36Directory Condition="'$(EagleWix36Directory)' == ''">$(ProgramFiles)\Windows Installer XML v3.6</EagleWix36Directory>

    <!--
        NOTE: Where is the WiX 3.7 binary directory (i.e. "WiX.dll") in the
              default install?
    -->
    <EagleWix37Directory Condition="'$(EagleWix37Directory)' == ''">$(ProgramFiles)\WiX Toolset v3.7</EagleWix37Directory>

    <!--
        NOTE: Where is the WiX 3.8 binary directory (i.e. "WiX.dll") in the
              default install?
    -->
    <EagleWix38Directory Condition="'$(EagleWix38Directory)' == ''">$(ProgramFiles)\WiX Toolset v3.8</EagleWix38Directory>

    <!--
        NOTE: Where is the WiX 3.9 binary directory (i.e. "WiX.dll") in the
              default install?
    -->
    <EagleWix39Directory Condition="'$(EagleWix39Directory)' == ''">$(ProgramFiles)\WiX Toolset v3.9</EagleWix39Directory>

    <!--
        NOTE: Where is the WiX 3.10 binary directory (i.e. "WiX.dll") in the
              default install?
    -->
    <EagleWix310Directory Condition="'$(EagleWix310Directory)' == ''">$(ProgramFiles)\WiX Toolset v3.10</EagleWix310Directory>

    <!--
        NOTE: Where is the WiX 3.11 binary directory (i.e. "WiX.dll") in the
              default install?
    -->
    <EagleWix311Directory Condition="'$(EagleWix311Directory)' == ''">$(ProgramFiles)\WiX Toolset v3.11</EagleWix311Directory>

    <!--
        NOTE: Where is the WiX binary directory (i.e. "WiX.dll")?  By default,
              this is an empty string.  However, it can be manually overridden
              here if necessary (e.g. WiX is installed in a custom location).
    -->
    <EagleWixDirectory Condition="'$(EagleWixDirectory)' == ''"></EagleWixDirectory>

    <!--
        NOTE: Enable use of "unsafe" code?  By default, this is enabled.  If
              this is disabled, certain optimizations and/or optional features
              that require it will be unavailable.
    -->
    <EagleUnsafe Condition="'$(EagleUnsafe)' == ''">true</EagleUnsafe>

    <!--
        NOTE: Building for Windows?  By default, this is enabled.  If this is
              disabled, some features will be unavailable.
    -->
    <EagleWindows Condition="'$(EagleWindows)' == ''">true</EagleWindows>

    <!--
        NOTE: Enable using System.Net and related types?  By default, this is
              enabled.  If this is disabled, some features will be unavailable.
    -->
    <EagleNetwork Condition="'$(EagleNetwork)' == ''">true</EagleNetwork>

    <!--
        NOTE: Enable using System.Console and related types?  By default, this
              is enabled.  If this is disabled, no console integration will be
              available.

        WARNING: If this is disabled, other projects that rely on console
                 functionality being exposed and provided by the library may
                 fail to compile.
    -->
    <EagleConsole Condition="'$(EagleConsole)' == ''">true</EagleConsole>

    <!--
        NOTE: Break into the debugger when exiting if there is a termination or
              resource disposal failure?   By default, this is enabled.  If this
              is disabled, most termination and resource disposal failures that
              occur while exiting will be ignored.
    -->
    <EagleBreakOnExiting Condition="'$(EagleBreakOnExiting)' == ''">true</EagleBreakOnExiting>

    <!--
        NOTE: Building for Unix?  By default, this is disabled.  If this is
              enabled, features that are known to be incomplete, incorrect, or
              missing on Unix will be unavailable.  Please note that enabling
              this is not strictly required to function on Unix nor does it mean
              that everything is magically guaranteed to work on Unix.
    -->
    <EagleUnix Condition="'$(EagleUnix)' == ''">false</EagleUnix>

    <!--
        NOTE: Use random initial values for all the unique identifier pools?  By
              default, this is disabled.  If this is enabled, all unique object
              and interpreter identifiers will be far less deterministic.
    -->
    <EagleRandomizeId Condition="'$(EagleRandomizeId)' == ''">false</EagleRandomizeId>

    <!--
        NOTE: Enable pooling of object and interpreter unique identifiers?  By
              default, this is disabled.  If enabled, the unique identifiers for
              created interpreters will come from the same pool as the unique
              identifiers for global objects.  This setting does not change the
              behavior of the per-interpreter unique identifiers.
    -->
    <EagleSharedIdPool Condition="'$(EagleSharedIdPool)' == ''">false</EagleSharedIdPool>

    <!--
        NOTE: Enable using the application domain identifier when creating any
              global identifiers?  By default, this is disabled.  If enabled,
              the unique identifiers for created interpreters and other global
              objects may include the identifier of their application domain.
              This setting does not change the behavior of the per-interpreter
              unique identifiers.
    -->
    <EagleUseAppDomainForId Condition="'$(EagleUseAppDomainForId)' == ''">false</EagleUseAppDomainForId>

    <!--
        NOTE: Enable debug tracing via the DebugTrace method?  By default, this
              is enabled.  When enabled, this will cause many diagnostic trace
              messages to be emitted at various strategic points in the core
              library that can be very useful for troubleshooting.  If this is
              disabled, these diagnostic messages will not be emitted.
    -->
    <EagleDebugTrace Condition="'$(EagleDebugTrace)' == ''">true</EagleDebugTrace>

    <!--
        NOTE: Enable debug tracing via the DebugWrite method?  By default, this
              is enabled.  When enabled, this will cause selected informational
              messages to be emitted at various points in the core library.  If
              this is disabled, these diagnostic messages will not be emitted.
    -->
    <EagleDebugWrite Condition="'$(EagleDebugWrite)' == ''">true</EagleDebugWrite>

    <!--
        NOTE: Force non-essential runtime diagnostic messages to be enabled in
              release builds?  By default, this is disabled.  When enabled, this
              will cause many diagnostic trace messages to be emitted at various
              strategic points in the core library (and/or third-party plugins)
              that can be very useful for troubleshooting.  If this is disabled,
              these diagnostic messages will not be emitted in release builds.
    -->
    <EagleForceTrace Condition="'$(EagleForceTrace)' == ''">false</EagleForceTrace>

    <!--
        NOTE: Force runtime diagnostic messagess to be throttled?  By default,
              this is disabled.  When enabled, this may cause some diagnostic
              trace messages to be silently dropped (i.e. because the message
              content or category has been seen too frequently).
    -->
    <EagleMaybeTrace Condition="'$(EagleMaybeTrace)' == ''">false</EagleMaybeTrace>

    <!--
        NOTE: Enable policy tracing?  By default, this is disabled.  If enabled,
              this has the potential to slow down the library very slightly;
              however, it can be useful when debugging subtle command and file
              policy issues.
    -->
    <EaglePolicyTrace Condition="'$(EaglePolicyTrace)' == ''">false</EaglePolicyTrace>

    <!--
        NOTE: Building for Mono 2.0 or higher?  By default, this is disabled.
              If this is enabled, features that are known to be incomplete,
              incorrect, or missing on Mono will be unavailable.  Please note
              that enabling this is not strictly required to run on Mono nor
              does it mean that everything is magically guaranteed to work on
              Mono.
    -->
    <EagleMono Condition="'$(EagleMono)' == ''">false</EagleMono>

    <!--
        NOTE: Building using Mono 2.0 or higher?  By default, this is disabled.
              If this is enabled, features that are known to be incomplete,
              incorrect, or missing using the Mono compiler OR XBuild may be
              modified or unavailable.  Please note that enabling this is not
              strictly required to run on Mono nor does it mean that everything
              is magically guaranteed to work with the Mono compiler and XBuild.
              In order to actually build with XBuild and run with Mono on Unix,
              a command line similar to the following is required:

              xbuild Eagle.sln /property:EagleMono=true \
                  /property:EagleMonoBuild=true /property:EagleUnix=true \
                  /property:EagleWindows=false
    -->
    <EagleMonoBuild Condition="'$(EagleMonoBuild)' == ''">false</EagleMonoBuild>

    <!--
        NOTE: *HACK* Avoid using any identifiers or constructs that do not work
              properly in Mono 2.4 or higher?  By default, this is enabled.  If
              this is disabled, features that are known to be incomplete,
              incorrect, or missing on Mono 2.4 will NOT be worked around
              (sometimes resulting in spectacular failures).  Please note that
              enabling this is not strictly required to function on Mono nor
              does it mean that everything is magically guaranteed to work on
              Mono.
    -->
    <EagleMonoHacks Condition="'$(EagleMonoHacks)' == ''">true</EagleMonoHacks>

    <!--
        NOTE: *HACK* Avoid using any identifiers or constructs that do not work
              properly in Mono 2.2 or lower?  By default, this is enabled.  If
              this is disabled, features that are known to be incomplete,
              incorrect, or missing on Mono 2.0/2.2 will NOT be worked around
              (sometimes resulting in spectacular failures).  Please note that
              enabling this is not strictly required to function on Mono nor
              does it mean that everything is magically guaranteed to work on
              Mono.
    -->
    <EagleMonoLegacy Condition="'$(EagleMonoLegacy)' == ''">true</EagleMonoLegacy>

    <!--
        NOTE: Allow use of System.IO.Compression.FileSystem?  By default, this
              is disabled because it is not available until the .NET Framework
              4.5.  If this is enabled, functionality related to handling zip
              files will be included.
    -->
    <EagleCompression Condition="'$(EagleCompression)' == ''">false</EagleCompression>

    <!--
        NOTE: Allow use of System.Configuration?  By default, this is enabled.
              If this is disabled, some features will be unavailable.
    -->
    <EagleConfiguration Condition="'$(EagleConfiguration)' == ''">true</EagleConfiguration>

    <!--
        NOTE: Allow use of System.Data?  By default, this is enabled.  If this
              is disabled, some features will be unavailable.
    -->
    <EagleData Condition="'$(EagleData)' == ''">true</EagleData>

    <!--
        NOTE: Allow use of System.Drawing (primarily for setting up the console
              icon)?  By default, this is enabled.  If this is disabled, some
              features will be unavailable.
    -->
    <EagleDrawing Condition="'$(EagleDrawing)' == ''">true</EagleDrawing>

    <!--
        NOTE: Allow use of System.Runtime.Remoting (primarily for testing)?  By
              default, this is enabled.  If this is disabled, some features will
              be unavailable.
    -->
    <EagleRemoting Condition="'$(EagleRemoting)' == ''">true</EagleRemoting>

    <!--
        NOTE: Allow use of System.Runtime.Serialization?  By default, this is
              enabled.  If this is disabled, some features will be unavailable.
    -->
    <EagleSerialization Condition="'$(EagleSerialization)' == ''">true</EagleSerialization>

    <!--
        NOTE: Allow use of System.Web?  By default, this is enabled.  If this is
              disabled, some features will be unavailable.
    -->
    <EagleWeb Condition="'$(EagleWeb)' == ''">true</EagleWeb>

    <!--
        NOTE: Allow use of System.Windows.Forms (primarily for error reporting)?
              By default, this is enabled.  If this is disabled, some features
              will be unavailable.
    -->
    <EagleWinForms Condition="'$(EagleWinForms)' == ''">true</EagleWinForms>

    <!--
        NOTE: Allow use of System.Xml?  By default, this is enabled.  If this is
              disabled, some features will be unavailable.
    -->
    <EagleXml Condition="'$(EagleXml)' == ''">true</EagleXml>

    <!--
        NOTE: Enable the script debugger?  By default this is enabled.  If this
              is disabled, all the features provided by the script debugger will
              be unavailable (e.g. breakpoints of all types, watchpoints,
              single-step, and isolated evaluation).
    -->
    <EagleDebugger Condition="'$(EagleDebugger)' == ''">true</EagleDebugger>

    <!--
        NOTE: Enable sending the current command name arguments to the script
              debugger?  By default, this is enabled.  If enabled, this has the
              potential to slow down the library quite a bit.  If this is
              disabled, the current command arguments will be unavailable in
              the debugger diagnostic output.
    -->
    <EagleDebuggerArguments Condition="'$(EagleDebuggerArguments)' == ''">true</EagleDebuggerArguments>

    <!--
        NOTE: Enable core script debugging?  By default, this is enabled.  If
              enabled, this has the potential to slow down the library a bit.
              If this is disabled, all script debugging (including being able
              to set breakpoints for script completion and cancellation) will
              be unavailable.
    -->
    <EagleDebuggerEngine Condition="'$(EagleDebuggerEngine)' == ''">true</EagleDebuggerEngine>

    <!--
        NOTE: Enable core entity debugging (e.g. commands and procedures)?  By
              default, this is enabled.  If enabled, this has the potential to
              slow down the library somewhat.  If this is disabled, all entity
              debugging (including being able to set breakpoints and/or step
              into commands and procedures) will be unavailable.
    -->
    <EagleDebuggerExecute Condition="'$(EagleDebuggerExecute)' == ''">true</EagleDebuggerExecute>

    <!--
        NOTE: Enable core expression debugging (e.g. operators and functions)?
              By default, this is enabled.  If enabled, this has the potential
              to slow down the library quite a bit.  If this is disabled,
              all expression debugging (including being able to set breakpoints
              and/or step into expression operators and functions) will be
              unavailable.
    -->
    <EagleDebuggerExpression Condition="'$(EagleDebuggerExpression)' == ''">true</EagleDebuggerExpression>

    <!--
        NOTE: Enable core variable debugging (e.g. break-on-set, etc)?  By
              default, this is enabled.  If enabled, this has the potential to
              slow down the library somewhat.  If this is disabled, all variable
              debugging (including being able to set watchpoints) will be
              unavailable.
    -->
    <EagleDebuggerVariable Condition="'$(EagleDebuggerVariable)' == ''">true</EagleDebuggerVariable>

    <!--
        NOTE: Enable breakpoints for the script debugger?  If enabled, this has
              the potential to slow down the library slightly; however, it can
              be very useful.  By default this is enabled.  If this is disabled,
              some features will be unavailable.
    -->
    <EagleDebuggerBreakpoints Condition="'$(EagleDebuggerBreakpoints)' == ''">true</EagleDebuggerBreakpoints>

    <!--
        NOTE: Enable the per-interpreter performance profiler?  By default,
              this is enabled.  If this is disabled, no detailed performance
              metrics will be kept for the interpreter.
    -->
    <EagleProfiler Condition="'$(EagleProfiler)' == ''">true</EagleProfiler>

    <!--
        NOTE: Enable "event-style" notifications for events that may be of
              interest to plugins?  If enabled, this has the potential to slow
              down the library slightly; however, it can be very useful.  By
              default, this is enabled.  If this is disabled, no plugin
              notifications will be fired except those that are absolutely
              required for automatic reference counting of object handles to
              work properly.
    -->
    <EagleNotify Condition="'$(EagleNotify)' == ''">true</EagleNotify>

    <!--
        NOTE: Enable "event-style" notifications for command execution events?
              If enabled, this has the potential to slow down the library a bit;
              however, it can be very useful.  By default, this is enabled.  If
              this is disabled, these notifications will be unavailable.
    -->
    <EagleNotifyArguments Condition="'$(EagleNotifyArguments)' == ''">true</EagleNotifyArguments>

    <!--
        NOTE: Enable tracking of all nested script arguments?  By default, this
              is disabled.  If enabled, this has the potential to slow down the
              library a bit; however, it can be useful.
    -->
    <EagleScriptArguments Condition="'$(EagleScriptArguments)' == ''">false</EagleScriptArguments>

    <!--
        NOTE: Enable "event-style" notifications for most "global" events (i.e.
              notifications which may be of interest to plugins from multiple
              interpreters)?  If enabled, this has the potential to slow down
              the library slightly; however, it can be useful in some scenarios.
              By default, this is enabled.
    -->
    <EagleNotifyGlobal Condition="'$(EagleNotifyGlobal)' == ''">true</EagleNotifyGlobal>

    <!--
        NOTE: Enable "event-style" notifications when an interpreter is pushed
              or popped [onto/from the active interpreter stack]?  If enabled,
              this has the potential to slow down the library quite a bit;
              however, it can still be useful in some scenarios.  By default,
              this is disabled.
    -->
    <EagleNotifyActive Condition="'$(EagleNotifyActive)' == ''">false</EagleNotifyActive>

    <!--
        NOTE: Enable "event-style" notifications for certain exceptional events
              related to the script engine?  By default, this is enabled.  If
              this is disabled, these notifications will be unavailable.
    -->
    <EagleNotifyException Condition="'$(EagleNotifyException)' == ''">true</EagleNotifyException>

    <!--
        NOTE: Enable "event-style" notifications for IExecute execution events?
              By default, this is enabled.  If enabled, this has the potential
              to slow down the library somewhat.  If this is disabled, these
              notifications will be unavailable.
    -->
    <EagleNotifyExecute Condition="'$(EagleNotifyExecute)' == ''">true</EagleNotifyExecute>

    <!--
        NOTE: Enable "event-style" notifications for expression related events?
              By default, this is enabled.  If enabled, this has the potential
              to slow down the library quite a bit.  If this is disabled, all
              notifications related to expression handling within the engine
              (e.g. execution of functions and operators) will be unavailable.
    -->
    <EagleNotifyExpression Condition="'$(EagleNotifyExpression)' == ''">true</EagleNotifyExpression>

    <!--
        NOTE: Enable "event-style" notifications for events that are required by
              the object handle reference counting plugin?  If enabled, this has
              the potential to slow down the library very slightly; however, it
              is required for proper operation of object handle reference
              counting.  By default, this is enabled.  If this is disabled,
              automatic reference counting of object handles contained within
              variable values will not work properly.

        WARNING: DO NOT CHANGE OR DISABLE THIS SETTING UNLESS YOU KNOW EXACTLY
                 WHAT IT DOES AND HOW IT WORKS.
    -->
    <EagleNotifyObject Condition="'$(EagleNotifyObject)' == ''">true</EagleNotifyObject>

    <!--
        NOTE: Enable "event-style" notifications for native Tcl events?  By
              default, this is enabled.  If this is disabled, notifications
              will not be fired for any native Tcl integration events.
    -->
    <EagleNotifyTcl Condition="'$(EagleNotifyTcl)' == ''">true</EagleNotifyTcl>

    <!--
        NOTE: Enable support for command history tracking?  By default, this is
              disabled.  If enabled, this has the potential to slow the library
              down slightly; however, it can be very useful.  If disabled,
              command history cannot be tracked.
    -->
    <EagleHistory Condition="'$(EagleHistory)' == ''">false</EagleHistory>

    <!--
        NOTE: Enable support for the built-in interactive commands?  By default,
              this is enabled.  If this is disabled, the built-in interactive
              commands will be unavailable (e.g. when using the shell).
    -->
    <EagleInteractiveCommands Condition="'$(EagleInteractiveCommands)' == ''">true</EagleInteractiveCommands>

    <!--
        NOTE: Enable support for previous result tracking?  If enabled, this has
              the potential to slow down the library slightly; however, it can
              be very useful.  By default, this is enabled.  If this is
              disabled, the previous result cannot be tracked and some debugging
              functions may be impaired.
    -->
    <EaglePreviousResult Condition="'$(EaglePreviousResult)' == ''">true</EaglePreviousResult>

    <!--
        NOTE: Enable support for evaluation engine callbacks (i.e. user code
              to be invoked when the evaluation engine has completed processing
              a top-level command)?  If enabled, this has the potential to slow
              down the library slightly; however, it can be very useful.  By
              default, this is enabled.
    -->
    <EagleCallbackQueue Condition="'$(EagleCallbackQueue)' == ''">true</EagleCallbackQueue>

    <!--
        NOTE: Enable support for restricting expression token types during
              expression evaluation?  By default, this is enabled.  If this is
              disabled, the expression flags will be ignored during expression
              evaluation.
    -->
    <EagleExpressionFlags Condition="'$(EagleExpressionFlags)' == ''">true</EagleExpressionFlags>

    <!--
        NOTE: Enable inclusion of the dedicated test code?  By default, this is
              enabled.  If this is disabled, any unit tests that require the
              dedicated test code will be skipped.
    -->
    <EagleTest Condition="'$(EagleTest)' == ''">true</EagleTest>

    <!--
        NOTE: Enable inclusion of the dedicated test plugin?  By default, this
              is enabled.  If this is disabled, the dedicated test plugin will
              only be available in the debug build configuration.
    -->
    <EagleTestPlugin Condition="'$(EagleTestPlugin)' == ''">true</EagleTestPlugin>

    <!--
        NOTE: Enable multi-threaded script evaluation support?  By default, this
              is enabled.  If this is disabled, evaluating scripts in multiple
              threads may not work properly due to threading issues (e.g. call
              frame management, race conditions for the "current" and
              "procedure" call frames may occur if any procs are involved).
    -->
    <EagleThreading Condition="'$(EagleThreading)' == ''">true</EagleThreading>

    <!--
        NOTE: Allow use of native functions via P/Invoke?  By default, this is
              enabled.  If this is disabled, some features will be unavailable,
              including Tcl/Tk integration (below).
    -->
    <EagleNative Condition="'$(EagleNative)' == ''">true</EagleNative>

    <!--
        NOTE: Allow Eagle to be loaded and initialized directly by native code
              (via the ICLRRuntimeHost.ExecuteInDefaultAppDomain method)?  By
              default, this is enabled.  If this is disabled, some features will
              be unavailable, including advanced Tcl integration features such
              as the Eagle Package for Tcl (Garuda).
    -->
    <EagleNativePackage Condition="'$(EagleNativePackage)' == ''">true</EagleNativePackage>

    <!--
        NOTE: Always use the native thread Id.  Otherwise, the native thread Id
              will only be used when absolutely necessary for correctness.  By
              default, this is enabled.  If this is disabled, the native thread
              Id will only be queried and/or used by the Eagle core library when
              explicitly requested via the [info] command -OR- when integrating
              with native Tcl and/or the underlying operating system.
    -->
    <EagleNativeThreadId Condition="'$(EagleNativeThreadId)' == ''">true</EagleNativeThreadId>

    <!--
        NOTE: Allow Eagle to load and use the Eagle Native Utility Library?  By
              default, this is enabled.  If this is disabled, the performance of
              all list splitting and joining operations may be reduced.
    -->
    <EagleNativeUtility Condition="'$(EagleNativeUtility)' == ''">true</EagleNativeUtility>

    <!--
        NOTE: In the Eagle Native Utility Library, make use of the SysStringLen
              Win32 BSTR API to figure out the length of list element strings?
              By default, this is enabled.  If this is disabled, a slower, more
              portable method will be used to determine list element string
              lengths.  If this is enabled on a non-Windows platform, it will
              most likely cause the native utility library to malfunction.
    -->
    <EagleNativeUtilityBstr Condition="'$(EagleNativeUtilityBstr)' == ''">true</EagleNativeUtilityBstr>

    <!--
        NOTE: Enable support for creating interpreters in isolated application
              domains?  By default, this is disabled.
    -->
    <EagleIsolatedInterpreters Condition="'$(EagleIsolatedInterpreters)' == ''">false</EagleIsolatedInterpreters>

    <!--
        NOTE: Enable support for loading plugins into isolated application
              domains?  By default, this is disabled.
    -->
    <EagleIsolatedPlugins Condition="'$(EagleIsolatedPlugins)' == ''">false</EagleIsolatedPlugins>

    <!--
        NOTE: Enable use of the soon (i.e. as of CLR v4) to be deprecated CAS
              policy APIs?
    -->
    <EagleCasPolicy Condition="'$(EagleCasPolicy)' == ''">false</EagleCasPolicy>

    <!--
        NOTE: Allow use of System.Reflection.Emit?  By default, this is enabled.
              If this is disabled, some features will be unavailable.
    -->
    <EagleEmit Condition="'$(EagleEmit)' == ''">true</EagleEmit>

    <!--
        NOTE: Enable native library integration via P/Invoke?  By default, this
              is enabled.
    -->
    <EagleLibrary Condition="'$(EagleLibrary)' == ''">true</EagleLibrary>

    <!--
        NOTE: Enable application domain management by the interpreter?  By
              default, this is disabled.
    -->
    <EagleAppDomains Condition="'$(EagleAppDomains)' == ''">false</EagleAppDomains>

    <!--
        NOTE: Enable collection of limited cache usage statistics?  By default,
              this is enabled.  If this is disabled, cache statistics will not
              be tracked.
    -->
    <EagleCacheStatistics Condition="'$(EagleCacheStatistics)' == ''">true</EagleCacheStatistics>

    <!--
        NOTE: *EXPERIMENTAL* Enable caching of argument objects?  By default,
              this is enabled.  If this is disabled, repeated creation of
              identically valued argument objects may be slower.
    -->
    <EagleArgumentCache Condition="'$(EagleArgumentCache)' == ''">true</EagleArgumentCache>

    <!--
        NOTE: *EXPERIMENTAL* Enable caching of parser states?  This feature has
              actually been enabled out-of-the-box for quite some time.
              Unfortunately, no noticable speed improvement has been observed;
              however, further analysis and profiling may be warranted.  By
              default, this is enabled.  If this is disabled, repeated parsing
              of identical strings may be slower.
    -->
    <EagleParseCache Condition="'$(EagleParseCache)' == ''">true</EagleParseCache>

    <!--
        NOTE: *EXPERIMENTAL* Enable caching of parsed lists (where possible)?
              By default, this is enabled.  If this is disabled, repeated
              parsing of identical lists may be slower.
    -->
    <EagleListCache Condition="'$(EagleListCache)' == ''">true</EagleListCache>

    <!--
        NOTE: *EXPERIMENTAL* Enable caching of command resolution (where
              possible)?  By default, this is enabled.  If this is disabled,
              repeated lookups of identical strings may be slower.
    -->
    <EagleExecuteCache Condition="'$(EagleExecuteCache)' == ''">true</EagleExecuteCache>

    <!--
        NOTE: *EXPERIMENTAL* Enable caching of object type resolution (where
              possible)?  By default, this is enabled.  If this is disabled,
              repeated lookups of identical object types may be slower.
    -->
    <EagleTypeCache Condition="'$(EagleTypeCache)' == ''">true</EagleTypeCache>

    <!--
        NOTE: *EXPERIMENTAL* Enable caching of COM object type resolution (where
              possible)?  By default, this is enabled.  If this is disabled,
              repeated lookups of identical COM objects may be slower.
    -->
    <EagleComTypeCache Condition="'$(EagleComTypeCache)' == ''">true</EagleComTypeCache>

    <!--
        NOTE: *EXPERIMENTAL* Enable use of the custom caching dictionary class?
              By default, this is disabled.  This feature has not been fully
              regression tested and may cause performance issues.
    -->
    <EagleCacheDictionary Condition="'$(EagleCacheDictionary)' == ''">false</EagleCacheDictionary>

    <!--
        NOTE: *EXPERIMENTAL* Enable caching of the string representations that
              are returned from the Argument.ToString method?  By default, this
              is enabled.  If this is disabled, overall performance of the core
              library may be reduced.
    -->
    <EagleCacheArgumentToString Condition="'$(EagleCacheArgumentToString)' == ''">true</EagleCacheArgumentToString>

    <!--
        NOTE: *EXPERIMENTAL* Enable caching of the string representations that
              are returned from the Result.ToString method?  By default, this is
              enabled.  If this is disabled, overall performance of the core
              library may be reduced.
    -->
    <EagleCacheResultToString Condition="'$(EagleCacheResultToString)' == ''">true</EagleCacheResultToString>

    <!--
        NOTE: *EXPERIMENTAL* Enable caching of the string representations that
              are returned from the ArgumentList.ToString method?  By default,
              this is enabled.  If this is disabled, overall performance of the
              core library may be reduced.
    -->
    <EagleCacheArgumentListToString Condition="'$(EagleCacheArgumentListToString)' == ''">true</EagleCacheArgumentListToString>

    <!--
        NOTE: *EXPERIMENTAL* Enable caching of the string representations that
              are returned from the StringList.ToString method?  By default,
              this is enabled.  If this is disabled, overall performance of the
              core library may be reduced.
    -->
    <EagleCacheStringListToString Condition="'$(EagleCacheStringListToString)' == ''">true</EagleCacheStringListToString>

    <!--
        NOTE: Enable support for static loading of the Eagle library by the
              command line shell?  By default, this is disabled.  If this is
              enabled [and the dynamic loading support above is disabled], the
              command line shell will require the exact version of the Eagle
              library it was compiled against to run properly.
    -->
    <EagleStatic Condition="'$(EagleStatic)' == ''">false</EagleStatic>

    <!--
        NOTE: Enable support for dynamic loading of the Eagle library by the
              command line shell?  By default, this is enabled.  If this is
              enabled [and the static loading support above is disabled], the
              command line shell will be capable of dynamically loading and
              using any compatible version of the Eagle library.
    -->
    <EagleDynamic Condition="'$(EagleDynamic)' == ''">true</EagleDynamic>

    <!--
        NOTE: Enable interactive shell support?  By default, this is enabled.
              If this is disabled, the interactive shell and all its associated
              functionality will be unavailable.
    -->
    <EagleShell Condition="'$(EagleShell)' == ''">true</EagleShell>

    <!--
        NOTE: Which shell entry point should be used?  By default, this is set
              to the dynamic entry point.
    -->
    <!--
    <EagleShellStartupObject Condition="'$(EagleShellStartupObject)' == ''">Eagle._Shell.StaticCommandLine</EagleShellStartupObject>
    -->
    <EagleShellStartupObject Condition="'$(EagleShellStartupObject)' == ''">Eagle._Shell.DynamicCommandLine</EagleShellStartupObject>

    <!--
        NOTE: Enable Tcl/Tk integration?  By default, this is enabled.
    -->
    <EagleTcl Condition="'$(EagleTcl)' == ''">true</EagleTcl>

    <!--
        NOTE: Enforce Tcl libraries being threaded? By default, this is enabled.
              If this is enabled, the Tcl wrapper will refuse to load
              non-threaded builds of Tcl at runtime.
    -->
    <EagleTclThreaded Condition="'$(EagleTclThreaded)' == ''">true</EagleTclThreaded>

    <!--
        NOTE: *EXPERIMENTAL* Enable isolated Tcl interpreter threads?  By
              default, this is enabled.  If this is disabled, Tcl/Tk integration
              will still be available (subject to the other compile options);
              however, support for isolated Tcl interpreter worker threads will
              not be available.
    -->
    <EagleTclThreads Condition="'$(EagleTclThreads)' == ''">true</EagleTclThreads>

    <!--
        NOTE: Enable TclKit handling?  By default, this is enabled.  If this is
              disabled, "stardlls" cannot be loaded correctly.
    -->
    <EagleTclKits Condition="'$(EagleTclKits)' == ''">true</EagleTclKits>

    <!--
        NOTE: Publically expose the Tcl wrapper functionality?  By default,
              this is disabled.
    -->
    <EagleTclWrapper Condition="'$(EagleTclWrapper)' == ''">false</EagleTclWrapper>

    <!--
        NOTE: Use Unicode for Tcl/Tk integration?  By default, this is enabled.
    -->
    <EagleTclUnicode Condition="'$(EagleTclUnicode)' == ''">true</EagleTclUnicode>

    <!--
        NOTE: Enable full (Tcl 8.4 compatible) namespace support for all new
              interpreters?  By default, this is disabled.  If this is enabled,
              all new interpreters created with the default creation flags will
              have namespaces enabled.
    -->
    <EagleUseNamespaces Condition="'$(EagleUseNamespaces)' == ''">false</EagleUseNamespaces>

    <!--
        NOTE: Run the test suite when building the shell?  By default, this is
              disabled.
    -->
    <EagleRunTests Condition="'$(EagleRunTests)' == ''">false</EagleRunTests>

    <!--
        NOTE: Run the test suite using the configured code coverage tool?
    -->
    <EagleRunCoverage Condition="'$(EagleRunCoverage)' == ''">false</EagleRunCoverage>

    <!--
        NOTE: What is the code coverage tool (e.g. NCover)?
    -->
    <EagleCoverageTool Condition="'$(EagleCoverageTool)' == '' And '$(ProgramFiles)' != ''">$(ProgramFiles)\NCover\NCover.Console.exe</EagleCoverageTool>

    <!--
        NOTE: The "common" command line arguments to pass to the test suite
              (right after the executable file name).  By default, this is an
              empty string.
    -->
    <EagleCommonTestArguments Condition="'$(EagleCommonTestArguments)' == ''"></EagleCommonTestArguments>

    <!--
        NOTE: The extra command line arguments to pass to the test suite (right
              before the file name itself).  By default, this is an empty
              string.
    -->
    <EagleTestArguments Condition="'$(EagleTestArguments)' == ''"></EagleTestArguments>

    <!--
        NOTE: The extra command line arguments to pass to the test suite (right
              after the file name itself).  By default, this is an empty string.
    -->
    <EagleTestFlags Condition="'$(EagleTestFlags)' == ''"></EagleTestFlags>

    <!--
        NOTE: Reset the stack size for the shell executable(s)?  By default,
              this is enabled.  If this is disabled, the stack size will have
              the default value and deep recursion in scripts may result in
              stack overflow errors.
    -->
    <EagleSetStack Condition="'$(EagleSetStack)' == ''">true</EagleSetStack>

    <!--
        NOTE: Reset the icon for the shell executable(s)?  By default, this is
              enabled.  If this is disabled, the default application icon will
              be used.
    -->
    <EagleSetIcon Condition="'$(EagleSetIcon)' == ''">true</EagleSetIcon>

    <!--
        NOTE: Strip the directory name from the PDB file names contained in the
              built binaries?  If this is disabled, the built binaries will not
              be modified in this fashion.
    -->
    <EagleStripPdbPath Condition="'$(EagleStripPdbPath)' == ''">true</EagleStripPdbPath>

    <!--
        NOTE: If necessary, embed the application manifest into the built
              executable(s) (e.g. for UAC elevation, etc)?  By default, this is
              enabled.  If this is disabled, the built executable files may not
              work correctly on operating systems released after Windows XP.
    -->
    <EagleEmbedExeManifest Condition="'$(EagleEmbedExeManifest)' == ''">true</EagleEmbedExeManifest>

    <!--
        NOTE: Strong name sign the built binaries?  By default, this is enabled.
              If this is disabled, full strong name signing will not be done for
              the built binaries.
    -->
    <EagleStrongNameSign Condition="'$(EagleStrongNameSign)' == ''">true</EagleStrongNameSign>

    <!--
        NOTE: Strong name sign the 32-bit-only executable(s)?  By default, this
              is enabled. If this is disabled, full strong name signing will not
              be done for the built 32-bit-only executable(s).
    -->
    <EagleStrongNameSign32BitOnly Condition="'$(EagleStrongNameSign32BitOnly)' == ''">true</EagleStrongNameSign32BitOnly>

    <!--
        NOTE: Authenticode sign the built binaries?  By default, this is
              disabled [while in development] because it is an "expensive"
              operation.  If this is enabled, various [environment] variables
              will be used to find the software publishing certificates and key
              files.
    -->
    <EagleAuthenticodeSign Condition="'$(EagleAuthenticodeSign)' == ''">false</EagleAuthenticodeSign>

    <!--
        NOTE: Enable legacy, primary, secondary, and tertiary Authenticode
              signatures?  By default, these are enabled.  If any of these are
              disabled, the corresponding Authenticode signature(s) will be
              missing from the built binaries.
    -->
    <EagleAuthenticodeSign1 Condition="'$(EagleAuthenticodeSign1)' == ''">true</EagleAuthenticodeSign1>
    <EagleAuthenticodeSign2 Condition="'$(EagleAuthenticodeSign2)' == ''">true</EagleAuthenticodeSign2>
    <EagleAuthenticodeSign3 Condition="'$(EagleAuthenticodeSign3)' == ''">true</EagleAuthenticodeSign3>
    <EagleAuthenticodeSign4 Condition="'$(EagleAuthenticodeSign4)' == ''">true</EagleAuthenticodeSign4>

    <!--
        NOTE: Authenticode sign the 32-bit-only executable(s)?  By default, this
              is disabled [while in development] because it is an "expensive"
              operation.  If this is enabled, various [environment] variables
              will be used to find the software publishing certificates and key
              files.
    -->
    <EagleAuthenticodeSign32BitOnly Condition="'$(EagleAuthenticodeSign32BitOnly)' == ''">false</EagleAuthenticodeSign32BitOnly>

    <!--
        NOTE: The number of milliseconds to wait between some server operations
              (e.g. for the Authenticode timestamping servers).
    -->
    <EaglePauseForServerMilliseconds Condition="'$(EaglePauseForServerMilliseconds)' == ''">15000</EaglePauseForServerMilliseconds>

    <!--
        NOTE: Should the sample project(s) demonstrate the usage of the custom
              build tasks?  By default, this is enabled.  If this is disabled,
              the custom build tasks will be skipped.  Currently, these custom
              build tasks do not work correctly with XBuild (see Mono bug
              #635767).
    -->
    <EagleSampleTargets Condition="'$(EagleSampleTargets)' == '' And ('$(MSBuildBinPath)' != '' And !HasTrailingSlash('$(MSBuildBinPath)') And Exists('$(MSBuildBinPath)\MSBuild.exe'))">true</EagleSampleTargets>
    <EagleSampleTargets Condition="'$(EagleSampleTargets)' == '' And ('$(MSBuildBinPath)' == '' Or HasTrailingSlash('$(MSBuildBinPath)') Or !Exists('$(MSBuildBinPath)\MSBuild.exe'))">false</EagleSampleTargets>

    <!--
        NOTE: Should [XML] documentation files be produced?  By default, this is
              disabled because it totally breaks incremental builds.

              Please see Microsoft Connect FeedbackID 470485 for more
              information.
    -->
    <EagleDocumentationFile Condition="'$(EagleDocumentationFile)' == ''">false</EagleDocumentationFile>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **             Eagle Enterprise Edition Integration Properties              **
  ******************************************************************************
  -->

  <PropertyGroup>
    <!--
        NOTE: Do we want to force script certificate enforcement to be enabled?
              This is useful if only authorized script files should be allowed.
              By default, this is disabled.  If this is enabled, only signed,
              trusted script files can be evaluated -AND- script certificate
              enforcement cannot be disabled at runtime.  This rule applies to
              all created interpreters -AND- it requires the Eagle Enterprise
              Edition plugins (i.e. "Harpy" and "Badge") to be available.
    -->
    <EagleEnterpriseLockdown Condition="'$(EagleEnterpriseLockdown)' == ''">false</EagleEnterpriseLockdown>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                   Eagle Enterprise Edition Properties                    **
  ******************************************************************************
  -->

  <!--
      WARNING: These properties are included here for reference purposes only.
               They are ONLY intended for use with "Harpy" and it is available
               only as part of the Eagle Enterprise Edition feature set, under
               license.
  -->
  <PropertyGroup>
    <!--
        NOTE: Do we want to enforce the license certificate checking via the
              Harpy plugins (i.e. not when run via the command line)?  By
              default, this is enabled.  If this is disabled, then no license
              certificate checking will be performed by the Harpy plugins.
    -->
    <!--
    <Licensing Condition="'$(Licensing)' == ''">true</Licensing>
    -->

    <!--
        NOTE: Should this build of Harpy enable special handling for "demo"
              key pairs?  Without this, the "demo" key pairs may be useless
              for signing license certificates for Harpy itself.  This will
              also impact all license certificates returned from the public
              Kapok server, e.g. by [requestLicenseCertificate] in the core
              script library.  Currently, this feature has no effect unless
              Harpy is (also) built with support for IPlugin and execution
              policy enforcement; however, this may change in the future.
    -->
    <!--
    <DemoKeyPairs Condition="'$(DemoKeyPairs)' == ''">false</DemoKeyPairs>
    -->

    <!--
        NOTE: Is this build of Harpy designed for demonstration use only?
              If so, plugin commands should also be disabled.
    -->
    <!--
    <DemoEdition Condition="'$(DemoEdition)' == ''">false</DemoEdition>
    -->

    <!--
        NOTE: Is this build of Harpy designed for execution policy use only?
              If so, plugin commands should also be disabled.
    -->
    <!--
    <LimitedEdition Condition="'$(LimitedEdition)' == ''">false</LimitedEdition>
    -->

    <!--
        NOTE: Does this build of Harpy include the extra diagnostic / testing
              features?  Generally, this should only be enabled for the full
              featured SKUs because it may present copy protection issues.
    -->
    <!--
    <ExtraDiagnostics Condition="'$(ExtraDiagnostics)' == ''">false</ExtraDiagnostics>
    -->

    <!--
        NOTE: Do we want to obfuscate the built assembly using Dotfuscator
              Community Edition (and/or similar tools)?  By default, this is
              enabled; however, it may not function on Windows Vista or later
              unless Visual Studio is running as an elevated administrator.
    -->
    <!--
    <Obfuscate1 Condition="'$(Obfuscate1)' == ''">true</Obfuscate1>
    <Obfuscate2 Condition="'$(Obfuscate2)' == ''">true</Obfuscate2>
    <Obfuscate3 Condition="'$(Obfuscate3)' == ''">true</Obfuscate3>
    -->

    <!--
        NOTE: Do we want to include the plugin commands in the built assembly?
              By default, this is enabled.  If this is disabled, the commands
              provided by the plugin will be unavailable (i.e. the code will
              simply not be compiled into the built assembly).
    -->
    <!--
    <PluginCommands Condition="'$(PluginCommands)' == ''">true</PluginCommands>
    -->

    <!--
        NOTE: Do we want to include the base license manager code in the built
              assembly?  By default, this is enabled.  If this is disabled, the
              license manager, including all its components and interfaces, will
              be unavailable (i.e. the code will simply not be compiled into the
              built assembly).
    -->
    <!--
    <LicenseManager Condition="'$(LicenseManager)' == ''">true</LicenseManager>
    -->

    <!--
        NOTE: Do we want to include the certificate plugin code in the built
              assembly?  By default, this is enabled.  If this is disabled, the
              certificate plugin, including all its commands and policies, will
              be unavailable (i.e. the code will simply not be compiled into the
              built assembly).
    -->
    <!--
    <CertificatePlugin Condition="'$(CertificatePlugin)' == ''">true</CertificatePlugin>
    -->

    <!--
        NOTE: Do we want to include certificate policy enforcement in the built
              assembly?  By default, this is enabled.  If this is disabled, the
              certificate policy mechanism will be unavailable (i.e. the code
              will simply not be compiled into the built assembly).
    -->
    <!--
    <CertificatePolicy Condition="'$(CertificatePolicy)' == ''">true</CertificatePolicy>
    -->

    <!--
        NOTE: Do we want to include automatic certificate renewal in the built
              assembly?  By default, this is enabled.  If this is disabled, the
              automatic certificate renewal mechanism will be unavailable (i.e.
              the code will simply not be compiled into the built assembly).
    -->
    <!--
    <CertificateRenewal Condition="'$(CertificateRenewal)' == ''">true</CertificateRenewal>
    -->

    <!--
        NOTE: Do we want to embed license certificates in the built assembly?
              By default, this is disabled.  If this is enabled, there must be
              existing license certificates in "Resources\Certificate";
              otherwise, this property will be silently ignored.  If the license
              certificate are successfully embedded at compile-time, they will
              be used as the ultimate fallback in the event no external license
              certificates can be located at runtime.
    -->
    <!--
    <EmbedCertificates Condition="'$(EmbedCertificates)' == ''">false</EmbedCertificates>
    -->

    <!--
        NOTE: Do we want to use the ObfuscationAttribute class to mark various
              interfaces, classes, and properties as immune from the obfuscation
              processing, if any?  By default, this is enabled.  If this is
              disabled, the built assembly may not function correctly because
              there are some non-public classes that are referenced by name by
              Eagle itself, the unit tests, and various other external callers
              (typically via reflection).
    -->
    <!--
    <EagleObfuscation Condition="'$(EagleObfuscation)' == ''">true</EagleObfuscation>
    -->

    <!--
        NOTE: Do we want to use the various extra "security" features that are
              enabled to protect against casual copying and/or snooping?  By
              default, this is enabled.  If this is disabled, extra security
              measures will not be enabled, providing less protection against
              casual copying and/or snooping.
    -->
    <!--
    <EagleSecurity Condition="'$(EagleSecurity)' == ''">true</EagleSecurity>
    -->

    <!--
        NOTE: Force non-essential runtime diagnostic messages to be enabled in
              release builds?  By default, this is enabled.  If disabled, this
              will prevent many diagnostic trace messages from being emitted in
              release builds.

        HACK: This cannot be conditioned upon $(EagleForceTrace) being missing
              or empty due to it being included in the core library settings.
    -->
    <!--
    <EagleForceTrace>true</EagleForceTrace>
    -->

    <!--
        NOTE: Do we want to consider license certificates that are marked as
              "For Test Use Only" as invalid?  By default, this is disabled
              for debug builds and enabled for release builds.
    -->
    <!--
    <EagleForTestUseOnly Condition="'$(EagleForTestUseOnly)' == '' And '$(Configuration)' == 'Debug'">false</EagleForTestUseOnly>
    <EagleForTestUseOnly Condition="'$(EagleForTestUseOnly)' == '' And '$(Configuration)' == 'Release'">true</EagleForTestUseOnly>
    -->

    <!--
        NOTE: If the build type has been set, use the same one when performing
              obfuscation on the target assembly, if any.
    -->
    <ObfuscatorBuildType Condition="'$(EagleBuildType)' != '' And '$(ObfuscatorBuildType)' == ''">$(EagleBuildType)</ObfuscatorBuildType>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                    Eagle Directory Related Properties                    **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(EagleDir)' != ''">
    <!--
        NOTE: Build the official reference assembly directory name based on the
              selected PowerShell version now.
    -->
    <EaglePowerShellDirectory Condition="'$(EaglePowerShellDirectory)' == '' And '$(EaglePowerShellVersion)' == ''">$(ProgramFiles)\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0</EaglePowerShellDirectory>
    <EaglePowerShellDirectory Condition="'$(EaglePowerShellDirectory)' == '' And ('$(EaglePowerShellVersion)' == '1.0' Or '$(EaglePowerShellVersion)' == 'v1.0')">$(ProgramFiles)\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0</EaglePowerShellDirectory>
    <EaglePowerShellDirectory Condition="'$(EaglePowerShellDirectory)' == '' And ('$(EaglePowerShellVersion)' == '2.0' Or '$(EaglePowerShellVersion)' == 'v2.0')">$(ProgramFiles)\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0</EaglePowerShellDirectory>
    <EaglePowerShellDirectory Condition="'$(EaglePowerShellDirectory)' == '' And ('$(EaglePowerShellVersion)' == '3.0' Or '$(EaglePowerShellVersion)' == 'v3.0')">$(ProgramFiles)\Reference Assemblies\Microsoft\WindowsPowerShell\3.0</EaglePowerShellDirectory>
    <EaglePowerShellDirectory Condition="'$(EaglePowerShellDirectory)' == '' And ('$(EaglePowerShellVersion)' == '4.0' Or '$(EaglePowerShellVersion)' == 'v4.0')">$(ProgramFiles)\Reference Assemblies\Microsoft\WindowsPowerShell\3.0</EaglePowerShellDirectory>
    <EaglePowerShellDirectory Condition="'$(EaglePowerShellDirectory)' == '' And ('$(EaglePowerShellVersion)' == '5.0' Or '$(EaglePowerShellVersion)' == 'v5.0')">$(ProgramFiles)\Reference Assemblies\Microsoft\WindowsPowerShell\3.0</EaglePowerShellDirectory>

    <!--
        NOTE: Build the name of the directory (within our "Externals" directory)
              that contains the PowerShell reference assemblies for the selected
              version.
    -->
    <EaglePowerShellExternalsDirectory Condition="'$(EaglePowerShellExternalsDirectory)' == '' And '$(EaglePowerShellVersion)' == ''">$(EagleDir)\Externals\PowerShell\v1.0</EaglePowerShellExternalsDirectory>
    <EaglePowerShellExternalsDirectory Condition="'$(EaglePowerShellExternalsDirectory)' == '' And ('$(EaglePowerShellVersion)' == '1.0' Or '$(EaglePowerShellVersion)' == 'v1.0')">$(EagleDir)\Externals\PowerShell\v1.0</EaglePowerShellExternalsDirectory>
    <EaglePowerShellExternalsDirectory Condition="'$(EaglePowerShellExternalsDirectory)' == '' And ('$(EaglePowerShellVersion)' == '2.0' Or '$(EaglePowerShellVersion)' == 'v2.0')">$(EagleDir)\Externals\PowerShell\v2.0</EaglePowerShellExternalsDirectory>
    <EaglePowerShellExternalsDirectory Condition="'$(EaglePowerShellExternalsDirectory)' == '' And ('$(EaglePowerShellVersion)' == '3.0' Or '$(EaglePowerShellVersion)' == 'v3.0')">$(EagleDir)\Externals\PowerShell\v3.0</EaglePowerShellExternalsDirectory>
    <EaglePowerShellExternalsDirectory Condition="'$(EaglePowerShellExternalsDirectory)' == '' And ('$(EaglePowerShellVersion)' == '4.0' Or '$(EaglePowerShellVersion)' == 'v4.0')">$(EagleDir)\Externals\PowerShell\v4.0</EaglePowerShellExternalsDirectory>
    <EaglePowerShellExternalsDirectory Condition="'$(EaglePowerShellExternalsDirectory)' == '' And ('$(EaglePowerShellVersion)' == '5.0' Or '$(EaglePowerShellVersion)' == 'v5.0')">$(EagleDir)\Externals\PowerShell\v5.0</EaglePowerShellExternalsDirectory>

    <!--
        NOTE: The non-package final output files are in one place.  Ideally, we
              should be using the EagleBinaryOutputPath setting (above) here;
              unfortunately, the code coverage tool (NCover) refuses to use a
              path with a trailing backslash.
    -->
    <EagleCoverageOutputPath Condition="'$(EagleCoverageOutputPath)' == '' And '$(Configuration)' != ''">$(EagleDir)\bin\$(Configuration)$(EagleConfigurationSuffix)\bin</EagleCoverageOutputPath>

    <!--
        NOTE: What are the extra arguments for the code coverage tool (NCover)?
    -->
    <EagleCoverageArguments Condition="'$(EagleCoverageArguments)' == '' And '$(EagleCoverageOutputPath)' != '' And '$(AssemblyName)' != ''">//w &quot;$(EagleCoverageOutputPath)&quot; //x &quot;$(EagleCoverageOutputPath)\$(AssemblyName).coverage.xml&quot; //coverall //ias &quot;Eagle;Plugin;$(AssemblyName)&quot; //p Eagle</EagleCoverageArguments>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                         Eagle Warning Properties                         **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <WarningLevel>4</WarningLevel>
    <NoWarn>612,618,1591</NoWarn>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)' == 'Release'">
    <WarningLevel>4</WarningLevel>
    <NoWarn>612,618,1591</NoWarn>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                   Eagle Global Output Path Properties                    **
  ******************************************************************************
  -->

  <!--
      WARNING: Setting the "BaseIntermediateOutputPath" property breaks the
               build when using the .NET Core SDK, see:

               https://github.com/dotnet/sdk/issues/1518
  -->
  <PropertyGroup Condition="'$(EagleDir)' != '' And '$(EagleBaseIntermediateOutputPath)' != 'false'">
    <!--
        NOTE: Keep all the intermediate files in one place.  The Visual Studio
              IDE seems to have a nasty habit of ignoring this setting.  The
              Visual Studio IDE then fails to build the project(s) properly when
              the output does not end up where it expects the output to be.
              When in doubt, build from the command line.  The "build.bat" tool
              in "Library\Tools" makes the command line build process fairly
              painless.  Please note that if you do not have the Eagle private
              keys (and most people will not), you will need to use the strong
              name bypass tool first (i.e. "Library\Tools\data\strongName*.reg"
              or "Library\Tools\strongName.bat").
    -->
    <BaseIntermediateOutputPath Condition="'$(EagleConfigurationSuffix)' == ''">$(EagleDir)\obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
    <BaseIntermediateOutputPath Condition="'$(EagleConfigurationSuffix)' != ''">$(EagleDir)\obj\$(MSBuildProjectName)\$(EagleConfigurationSuffix)\</BaseIntermediateOutputPath>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **              Eagle Per-Configuration Output Path Properties              **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(EagleDir)' != '' And '$(Configuration)' != ''">
    <!--
        NOTE: The non-package final output files need to go in one place.
    -->
    <EagleBinaryOutputPath Condition="'$(EagleBinaryOutputPath)' == ''">$(EagleDir)\bin\$(Configuration)$(EagleConfigurationSuffix)\bin\</EagleBinaryOutputPath>

    <!--
        NOTE: The package final output files need to go in their package
              specific directory.
    -->
    <EaglePackageOutputPath Condition="'$(EaglePackageOutputPath)' == ''">$(EagleDir)\bin\$(Configuration)$(EagleConfigurationSuffix)\lib\$(AssemblyName)$(EaglePackageVersion)\</EaglePackageOutputPath>

    <!--
        NOTE: Setup the location of the library project directory relative to
              the base Eagle directory.
    -->
    <EagleLibraryDir Condition="'$(EagleLibraryDir)' == ''">$(EagleDir)\Library\</EagleLibraryDir>

    <!--
        NOTE: Setup the location of the library generated files directory
              relative to the library project directory.
    -->
    <EagleLibraryGeneratedDir Condition="'$(EagleLibraryGeneratedDir)' == ''">$(EagleLibraryDir)Generated\</EagleLibraryGeneratedDir>

    <!--
        NOTE: Setup the location of the library resource files directory
              relative to the library project directory.
    -->
    <EagleLibraryResourcesDir Condition="'$(EagleLibraryResourcesDir)' == ''">$(EagleLibraryDir)Resources\</EagleLibraryResourcesDir>

    <!--
        NOTE: Setup the location of the library tools directory relative to the
              library project directory.
    -->
    <EagleLibraryToolsDir Condition="'$(EagleLibraryToolsDir)' == ''">$(EagleLibraryDir)Tools\</EagleLibraryToolsDir>

    <!--
        NOTE: Setup the location of the Eagle assemblies containing the custom
              MSBuild tasks.
    -->
    <EagleTaskPath Condition="'$(EagleTaskPath)' == ''">$(EagleDir)\bin\$(Configuration)$(EagleConfigurationSuffix)\bin\BuildTasks\</EagleTaskPath>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                   Eagle Strong Name Signing Properties                   **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(EagleDir)' != ''">
    <!--
        NOTE: This is the strong name key path for all builds.  This property
              can be overridden in the project file and is used to locate the
              strong name key used to sign the output assembly.
    -->
    <EagleStrongNameDir Condition="'$(EagleStrongNameDir)' == ''">$(EagleDir)\Keys</EagleStrongNameDir>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <PropertyGroup>
    <!--
        NOTE: This is the strong name key prefix for all builds.  This property
              can be overridden in the project file and is used to help control
              the name of the strong name key used to sign the output assembly.
    -->
    <!--
    <EagleStrongNamePrefix Condition="'$(EagleStrongNamePrefix)' == ''">EagleBeta</EagleStrongNamePrefix>
    <EagleStrongNamePrefix Condition="'$(EagleStrongNamePrefix)' == ''">EagleStrong</EagleStrongNamePrefix>
    -->
    <EagleStrongNamePrefix Condition="'$(EagleStrongNamePrefix)' == ''">EagleFast</EagleStrongNamePrefix>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **             Eagle Debug Build Strong Name Signing Properties             **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(EagleStrongNameDir)' != '' And '$(Configuration)' == 'Debug'">
    <!--
        NOTE: Sign the assembly?
    -->
    <SignAssembly Condition="'$(SignAssembly)' == ''">true</SignAssembly>

    <!--
        NOTE: Use delay signing?  We almost always need to do this because we
              modify the executables with build tasks.
    -->
    <DelaySign Condition="'$(DelaySign)' == ''">true</DelaySign>

    <!--
        NOTE: This is the public strong name key file for debug builds.
    -->
    <AssemblyOriginatorKeyFile Condition="'$(AssemblyOriginatorKeyFile)' == '' And '$(DelaySign)' == 'true'">$(EagleStrongNameDir)\$(EagleStrongNamePrefix)Public.snk</AssemblyOriginatorKeyFile>
    <AssemblyOriginatorKeyFile Condition="'$(AssemblyOriginatorKeyFile)' == '' And '$(DelaySign)' == 'false'">$(EagleStrongNameDir)\$(EagleStrongNamePrefix)Private.snk</AssemblyOriginatorKeyFile>

    <!--
        NOTE: This is the private strong name key pair file for debug builds.

              For security reasons, this file is not included in the public
              source distribution.
    -->
    <EaglePrivateKeyFile Condition="'$(EaglePrivateKeyFile)' == ''">$(EagleStrongNameDir)\$(EagleStrongNamePrefix)Private.snk</EaglePrivateKeyFile>
    <AssemblyPrivateKeyFile Condition="'$(AssemblyPrivateKeyFile)' == ''">$(EagleStrongNameDir)\$(EagleStrongNamePrefix)Private.snk</AssemblyPrivateKeyFile>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **            Eagle Release Build Strong Name Signing Properties            **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(EagleStrongNameDir)' != '' And '$(Configuration)' == 'Release'">
    <!--
        NOTE: Sign the assembly?
    -->
    <SignAssembly Condition="'$(SignAssembly)' == ''">true</SignAssembly>

    <!--
        NOTE: Use delay signing?  We almost always need to do this because we
              modify the executables with build tasks.
    -->
    <DelaySign Condition="'$(DelaySign)' == ''">true</DelaySign>

    <!--
        NOTE: This is the public strong name key file for release builds.
    -->
    <AssemblyOriginatorKeyFile Condition="'$(AssemblyOriginatorKeyFile)' == '' And '$(DelaySign)' == 'true'">$(EagleStrongNameDir)\$(EagleStrongNamePrefix)Public.snk</AssemblyOriginatorKeyFile>
    <AssemblyOriginatorKeyFile Condition="'$(AssemblyOriginatorKeyFile)' == '' And '$(DelaySign)' == 'false'">$(EagleStrongNameDir)\$(EagleStrongNamePrefix)Private.snk</AssemblyOriginatorKeyFile>

    <!--
        NOTE: This is the private strong name key pair file for release builds.

              For security reasons, this file is not included in the public
              source distribution.
    -->
    <EaglePrivateKeyFile Condition="'$(EaglePrivateKeyFile)' == ''">$(EagleStrongNameDir)\$(EagleStrongNamePrefix)Private.snk</EaglePrivateKeyFile>
    <AssemblyPrivateKeyFile Condition="'$(AssemblyPrivateKeyFile)' == ''">$(EagleStrongNameDir)\$(EagleStrongNamePrefix)Private.snk</AssemblyPrivateKeyFile>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **          Forcibly Disable NuGet Package Restore (non-.NET Core)          **
  ******************************************************************************
  -->

  <PropertyGroup>
    <ResolveNuGetPackages Condition="'$(TargetFramework)' != 'netstandard2.0' And '$(TargetFramework)' != 'netstandard2.1' And '$(TargetFramework)' != 'netcoreapp2.0' And '$(TargetFramework)' != 'netcoreapp2.1' And '$(TargetFramework)' != 'netcoreapp2.2' And '$(TargetFramework)' != 'netcoreapp3.0' And '$(TargetFramework)' != 'netcoreapp3.1'">false</ResolveNuGetPackages>
  </PropertyGroup>
</Project>

Added Externals/Eagle/Targets/Eagle.targets.

















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
<!--
 *
 * Eagle.targets -
 *
 * WARNING: Contains more evil MSBuild hacks than your doctor recommended.
 *
 * Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: $
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **                          Load Per-User Settings                          **
  ******************************************************************************
  -->

  <!--
      NOTE: If the per-user settings file exists, import it now.  The contained
            settings, if any, will override the default ones provided below.
  -->
  <Import Condition="'$(EagleDir)' != '' And
                     !HasTrailingSlash('$(EagleDir)') And
                     Exists('$(EagleDir)\Targets\Eagle.targets.user')"
          Project="$(EagleDir)\Targets\Eagle.targets.user" />

  <!--
  ******************************************************************************
  **                               Hack Targets                               **
  ******************************************************************************
  -->

  <Target Name="FixCopyFilesToOutputDirectory"
          Condition="'$(BuildTool)' == 'MSBuild'"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).FixCopyFilesToOutputDirectory.done">
    <!--
        HACK: No "Inputs" or "Outputs" were specified on the built-in
              CopyFilesToOutputDirectory target?

        RANT: This hack totally sucks and should not be required, period.  The
              built-in MSBuild task CopyFilesToOutputDirectory is fundamentally
              broken for any non-trivial builds (especially those that need to
              post-process the target assembly for digital signatures, etc).
    -->
    <Copy SourceFiles="$(TargetPath)"
          DestinationFiles="@(IntermediateAssembly)"
          SkipUnchangedFiles="true" />

    <Copy SourceFiles="$(OutDir)$(TargetName).pdb"
          DestinationFiles="$(IntermediateOutputPath)$(TargetName).pdb"
          SkipUnchangedFiles="true"
          Condition="'$(_DebugSymbolsProduced)' == 'true'" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).FixCopyFilesToOutputDirectory.done" />
  </Target>

  <!--
  ******************************************************************************
  **                           Housekeeping Targets                           **
  ******************************************************************************
  -->

  <Target Name="CleanDoneFiles"
          Condition="'$(OutDir)' != '' And
                     '$(TargetFileName)' != ''">
    <CreateItem Include="$(OutDir)$(TargetFileName).*.done">
      <Output ItemName="CleanDoneFilesItem" TaskParameter="Include" />
    </CreateItem>

    <Delete Condition="'@(CleanDoneFilesItem)' != ''"
            Files="@(CleanDoneFilesItem)" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="GetDoneFiles"
          Condition="'$(OutDir)' != '' And
                     '$(TargetFileName)' != ''">
    <CreateItem Include="$(OutDir)$(TargetFileName).*.done">
      <Output ItemName="GetDoneFilesItem" TaskParameter="Include" />
    </CreateItem>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="UpdateDoneFiles"
          Inputs="$(TargetPath)"
          Outputs="@(GetDoneFilesItem)">
    <!--
        NOTE: We know that we performed all the tasks if they were necessary.
              However, since we have multiple tasks that all potentially update
              the target path, we need to resync the "*.done" files to the final
              time-stamp of the target path so that we do not accidentally
              trigger any of the tasks that rely upon them during a later build.
    -->
    <Touch Condition="'@(GetDoneFilesItem)' != ''"
           Files="@(GetDoneFilesItem)" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CleanConfigurations"
          Condition="'$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')">
    <CreateItem Include="$(OutputPath)*.config">
      <Output ItemName="CleanConfigurationsItem" TaskParameter="Include" />
    </CreateItem>

    <Delete Condition="'@(CleanConfigurationsItem)' != ''"
            Files="@(CleanConfigurationsItem)"
            ContinueOnError="true" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CleanWixOutputFiles"
          Condition="'$(MSBuildProjectDirectory)' != '' And
                     !HasTrailingSlash('$(MSBuildProjectDirectory)')">
    <CreateItem Include="$(MSBuildProjectDirectory)\Tests\*.msi;$(MSBuildProjectDirectory)\Tests\*.wixobj;$(MSBuildProjectDirectory)\Tests\*.wixpdb">
      <Output ItemName="CleanWixOutputFilesItem" TaskParameter="Include" />
    </CreateItem>

    <Delete Condition="'@(CleanWixOutputFilesItem)' != ''"
            Files="@(CleanWixOutputFilesItem)" />
  </Target>

  <!--
  ******************************************************************************
  **                         [Fairly] Generic Targets                         **
  ******************************************************************************
  -->

  <Target Name="StrongNameSign"
          Condition="'$(SignAssembly)' != 'false' And
                     '$(BuildTool)' == 'MSBuild' And
                     '$(OperatingSystem)' == 'Windows' And
                     Exists('$(AssemblyOriginatorKeyFile)') And
                     Exists('$(AssemblyPrivateKeyFile)') And
                     '$(TargetPath)' != '' And
                     !HasTrailingSlash('$(TargetPath)') And
                     Exists('$(TargetPath)') And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)') And
                     '$(TargetName)' != '' And
                     '$(TargetExt)' != ''"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).StrongNameSign.done">
    <!--
        HACK: *BROKEN* The GetFrameworkSDKPath MSBuild task was broken by the
              Visual Studio 2012 / .NET Framework 4.5 RTM release.  It now
              incorrectly returns the Windows SDK path, not the .NET Framework
              SDK path.  When Visual Studio 2012 is installed, it also breaks
              the Visual Studio 2010 / .NET Framework 4.0 build environment as
              well.  The "supported", yet sub-optimal, alternative appears to
              be using the TargetFrameworkSDKToolsDirectory variable.
    -->
    <GetFrameworkSDKPath Condition="('$(StrongNameWithoutSdk)' == '' Or
                                     '$(StrongNameWithoutSdk)' == 'false') And
                                    '$(TargetFrameworkSDKToolsDirectory)' == ''">
      <Output TaskParameter="Path"
              PropertyName="DirForStrongName" />
    </GetFrameworkSDKPath>

    <Exec Condition="'$(StrongNameWithoutSdk)' != '' And
                     '$(StrongNameWithoutSdk)' != 'false'"
          Command="sn.exe -Ra &quot;$(TargetPath)&quot; &quot;$(AssemblyPrivateKeyFile)&quot;" />

    <Exec Condition="'$(StrongNameWithoutSdk)' != '' And
                     '$(StrongNameWithoutSdk)' != 'false' And
                     Exists('$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)')"
          Command="sn.exe -Ra &quot;$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)&quot; &quot;$(AssemblyPrivateKeyFile)&quot;" />

    <Exec Condition="('$(StrongNameWithoutSdk)' == '' Or
                      '$(StrongNameWithoutSdk)' == 'false') And
                     '$(OverrideDirForStrongName)' != '' And
                     HasTrailingSlash('$(OverrideDirForStrongName)') And
                     Exists('$(OverrideDirForStrongName)sn.exe')"
          Command="&quot;$(OverrideDirForStrongName)sn.exe&quot; -Ra &quot;$(TargetPath)&quot; &quot;$(AssemblyPrivateKeyFile)&quot;" />

    <Exec Condition="('$(StrongNameWithoutSdk)' == '' Or
                      '$(StrongNameWithoutSdk)' == 'false') And
                     '$(OverrideDirForStrongName)' != '' And
                     HasTrailingSlash('$(OverrideDirForStrongName)') And
                     Exists('$(OverrideDirForStrongName)sn.exe') And
                     Exists('$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)')"
          Command="&quot;$(OverrideDirForStrongName)sn.exe&quot; -Ra &quot;$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)&quot; &quot;$(AssemblyPrivateKeyFile)&quot;" />

    <Exec Condition="('$(StrongNameWithoutSdk)' == '' Or
                      '$(StrongNameWithoutSdk)' == 'false') And
                     '$(TargetFrameworkSDKToolsDirectory)' == '' And
                     '$(OverrideDirForStrongName)' == '' And
                     '$(DirForStrongName)' != '' And
                     HasTrailingSlash('$(DirForStrongName)') And
                     Exists('$(DirForStrongName)bin\sn.exe')"
          Command="&quot;$(DirForStrongName)bin\sn.exe&quot; -Ra &quot;$(TargetPath)&quot; &quot;$(AssemblyPrivateKeyFile)&quot;" />

    <Exec Condition="('$(StrongNameWithoutSdk)' == '' Or
                      '$(StrongNameWithoutSdk)' == 'false') And
                     '$(TargetFrameworkSDKToolsDirectory)' == '' And
                     '$(OverrideDirForStrongName)' == '' And
                     '$(DirForStrongName)' != '' And
                     HasTrailingSlash('$(DirForStrongName)') And
                     Exists('$(DirForStrongName)bin\sn.exe') And
                     Exists('$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)')"
          Command="&quot;$(DirForStrongName)bin\sn.exe&quot; -Ra &quot;$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)&quot; &quot;$(AssemblyPrivateKeyFile)&quot;" />

    <Exec Condition="('$(StrongNameWithoutSdk)' == '' Or
                      '$(StrongNameWithoutSdk)' == 'false') And
                     '$(TargetFrameworkSDKToolsDirectory)' != '' And
                     '$(OverrideDirForStrongName)' == '' And
                     '$(DirForStrongName)' == '' And
                     HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And
                     Exists('$(TargetFrameworkSDKToolsDirectory)sn.exe')"
          Command="&quot;$(TargetFrameworkSDKToolsDirectory)sn.exe&quot; -Ra &quot;$(TargetPath)&quot; &quot;$(AssemblyPrivateKeyFile)&quot;" />

    <Exec Condition="('$(StrongNameWithoutSdk)' == '' Or
                      '$(StrongNameWithoutSdk)' == 'false') And
                     '$(TargetFrameworkSDKToolsDirectory)' != '' And
                     '$(OverrideDirForStrongName)' == '' And
                     '$(DirForStrongName)' == '' And
                     HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And
                     Exists('$(TargetFrameworkSDKToolsDirectory)sn.exe') And
                     Exists('$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)')"
          Command="&quot;$(TargetFrameworkSDKToolsDirectory)sn.exe&quot; -Ra &quot;$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)&quot; &quot;$(AssemblyPrivateKeyFile)&quot;" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).StrongNameSign.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="Mark32BitOnly"
          Condition="'$(Mark32BitOnly)' != 'false' And
                     ('$(OutputType)' == 'Exe' Or
                      '$(OutputType)' == 'WinExe') And
                     '$(BuildTool)' == 'MSBuild' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(TargetPath)' != '' And
                     !HasTrailingSlash('$(TargetPath)') And
                     Exists('$(TargetPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).Mark32BitOnly.done">
    <!--
        HACK: *BROKEN* The GetFrameworkSDKPath MSBuild task was broken by the
              Visual Studio 2012 / .NET Framework 4.5 RTM release.  It now
              incorrectly returns the Windows SDK path, not the .NET Framework
              SDK path.  When Visual Studio 2012 is installed, it also breaks
              the Visual Studio 2010 / .NET Framework 4.0 build environment as
              well.  The "supported", yet sub-optimal, alternative appears to
              be using the TargetFrameworkSDKToolsDirectory variable.
    -->
    <GetFrameworkSDKPath Condition="'$(TargetFrameworkSDKToolsDirectory)' == ''">
      <Output TaskParameter="Path"
              PropertyName="DirForMark32BitOnly" />
    </GetFrameworkSDKPath>

    <Exec Condition="'$(TargetFrameworkSDKToolsDirectory)' == '' And
                     '$(DirForMark32BitOnly)' != '' And
                     HasTrailingSlash('$(DirForMark32BitOnly)') And
                     Exists('$(DirForMark32BitOnly)bin\CorFlags.exe')"
          Command="&quot;$(DirForMark32BitOnly)bin\CorFlags.exe&quot; &quot;$(TargetPath)&quot; /32BIT+ /Force 1&gt;NUL" />

    <Exec Condition="'$(TargetFrameworkSDKToolsDirectory)' != '' And
                     '$(DirForMark32BitOnly)' == '' And
                     HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And
                     Exists('$(TargetFrameworkSDKToolsDirectory)CorFlags.exe')"
          Command="&quot;$(TargetFrameworkSDKToolsDirectory)CorFlags.exe&quot; &quot;$(TargetPath)&quot; /32BIT+ /Force 1&gt;NUL" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).Mark32BitOnly.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CopyPkgIndex"
          Condition="'$(CopyPkgIndex)' != 'false' And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyPkgIndex.done">
    <CreateItem Include="lib\pkgIndex.*">
      <Output ItemName="CopyPkgIndexItem" TaskParameter="Include" />
    </CreateItem>

    <Copy SourceFiles="@(CopyPkgIndexItem)"
          DestinationFolder="$(OutputPath)" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyPkgIndex.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CopyTools"
          Condition="'$(CopyTools)' != 'false' And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyTools.done">
    <CreateItem Include="Tools\*">
      <Output ItemName="CopyToolsItem" TaskParameter="Include" />
    </CreateItem>

    <Copy SourceFiles="@(CopyToolsItem)"
          DestinationFolder="$(OutputPath)" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyTools.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CopyLibrary"
          Condition="'$(CopyLibrary)' != 'false' And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyLibrary.done">
    <CreateItem Include="lib\**">
      <Output ItemName="CopyLibraryItem" TaskParameter="Include" />
    </CreateItem>

    <Copy SourceFiles="@(CopyLibraryItem)"
          DestinationFiles="@(CopyLibraryItem -> '$(OutputPath)%(RecursiveDir)%(Filename)%(Extension)')" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyLibrary.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CopyExternals"
          Condition="'$(CopyExternals)' != 'false' And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyExternals.done">
    <CreateItem Include="Externals\*" Exclude="Externals\no_*">
      <Output ItemName="CopyExternalsItem" TaskParameter="Include" />
    </CreateItem>

    <Copy SourceFiles="@(CopyExternalsItem)"
          DestinationFolder="$(OutputPath)" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyExternals.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CopyArchitectureExternals"
          Condition="'$(CopyArchitectureExternals)' != 'false' And
                     '$(Architecture)' != '' And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyArchitectureExternals.done">
    <CreateItem Include="Externals\$(Architecture)\*"
                Exclude="Externals\$(Architecture)\no_*">
      <Output ItemName="CopyArchitectureExternalsItem" TaskParameter="Include" />
    </CreateItem>

    <Copy SourceFiles="@(CopyArchitectureExternalsItem)"
          DestinationFolder="$(OutputPath)" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyArchitectureExternals.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CopyAllArchitectureExternals"
          Condition="'$(CopyAllArchitectureExternals)' != 'false' And
                     '$(Architecture)' != '' And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyAllArchitectureExternals.done">
    <CreateItem Include="Externals\**\$(Architecture)\*"
                Exclude="Externals\**\$(Architecture)\no_*">
      <Output ItemName="CopyAllArchitectureExternalsItem" TaskParameter="Include" />
    </CreateItem>

    <Copy SourceFiles="@(CopyAllArchitectureExternalsItem)"
          DestinationFolder="$(OutputPath)" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyAllArchitectureExternals.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CopyConfigurations"
          Condition="'$(CopyConfigurations)' != 'false' And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyConfigurations.done">
    <CreateItem Include="Configurations\*.config" Exclude="Configurations\no_*">
      <Output ItemName="CopyConfigurationsItem" TaskParameter="Include" />
    </CreateItem>

    <Copy SourceFiles="@(CopyConfigurationsItem)"
          DestinationFolder="$(OutputPath)" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyConfigurations.done" />
  </Target>

  <!--
  ******************************************************************************
  **                          Eagle Specific Targets                          **
  ******************************************************************************
  -->

  <Target Name="EagleDetectBuildTool"
          Condition="'$(EagleDetectBuildTool)' != 'false' And
                     '$(MSBuildBinPath)' != '' And
                     !HasTrailingSlash('$(MSBuildBinPath)')">
    <CreateProperty Condition="Exists('$(MSBuildBinPath)\MSBuild.exe')"
                    Value="MSBuild">
      <Output TaskParameter="Value" PropertyName="BuildTool" />
    </CreateProperty>

    <CreateProperty Condition="Exists('$(MSBuildBinPath)\xbuild.exe')"
                    Value="XBuild">
      <Output TaskParameter="Value" PropertyName="BuildTool" />
    </CreateProperty>

    <CreateProperty Condition="Exists('$(MSBuildBinPath)\MSBuild.dll') Or
                               '$(TargetFramework)' == 'netstandard2.0' Or
                               '$(TargetFramework)' == 'netstandard2.1' Or
                               '$(TargetFramework)' == 'netcoreapp2.0' Or
                               '$(TargetFramework)' == 'netcoreapp2.1' Or
                               '$(TargetFramework)' == 'netcoreapp2.2' Or
                               '$(TargetFramework)' == 'netcoreapp3.0' Or
                               '$(TargetFramework)' == 'netcoreapp3.1'"
                    Value="DotNetCore">
      <Output TaskParameter="Value" PropertyName="BuildTool" />
    </CreateProperty>

    <CreateProperty Condition="!Exists('$(MSBuildBinPath)\MSBuild.exe') And
                               !Exists('$(MSBuildBinPath)\xbuild.exe') And
                               !Exists('$(MSBuildBinPath)\MSBuild.dll')"
                    Value="Unknown">
      <Output TaskParameter="Value" PropertyName="BuildTool" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectOperatingSystem"
          Condition="'$(EagleDetectOperatingSystem)' != 'false'">
    <CreateProperty Condition="'$(OS)' == 'Windows_NT'" Value="Windows">
      <Output TaskParameter="Value" PropertyName="OperatingSystem" />
    </CreateProperty>

    <CreateProperty Condition="'$(OS)' == 'Unix'" Value="Unix">
      <Output TaskParameter="Value" PropertyName="OperatingSystem" />
    </CreateProperty>

    <CreateProperty Condition="'$(OS)' == 'OSX'" Value="MacOSX">
      <Output TaskParameter="Value" PropertyName="OperatingSystem" />
    </CreateProperty>

    <CreateProperty Condition="'$(OS)' != 'Windows_NT' And
                               '$(OS)' != 'Unix' And
                               '$(OS)' != 'OSX'"
                    Value="Unknown">
      <Output TaskParameter="Value" PropertyName="OperatingSystem" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectArchitecture"
          Condition="'$(EagleDetectArchitecture)' != 'false'">
    <CreateProperty Condition="'$(PROCESSOR_ARCHITECTURE)' == 'AMD64' Or
                               '$(PROCESSOR_ARCHITEW6432)' == 'AMD64'"
                    Value="x64">
      <Output TaskParameter="Value" PropertyName="Architecture" />
    </CreateProperty>

    <CreateProperty Condition="'$(PROCESSOR_ARCHITECTURE)' == 'IA64' Or
                               '$(PROCESSOR_ARCHITEW6432)' == 'IA64'"
                    Value="ia64">
      <Output TaskParameter="Value" PropertyName="Architecture" />
    </CreateProperty>

    <CreateProperty Condition="'$(PROCESSOR_ARCHITECTURE)' == 'x86' And
                               '$(PROCESSOR_ARCHITEW6432)' == ''"
                    Value="x86">
      <Output TaskParameter="Value" PropertyName="Architecture" />
    </CreateProperty>

    <CreateProperty Condition="'$(PROCESSOR_ARCHITECTURE)' == 'ARM' And
                               '$(PROCESSOR_ARCHITEW6432)' == ''"
                    Value="arm">
      <Output TaskParameter="Value" PropertyName="Architecture" />
    </CreateProperty>

    <CreateProperty Condition="'$(PROCESSOR_ARCHITECTURE)' != 'AMD64' And
                               '$(PROCESSOR_ARCHITECTURE)' != 'IA64' And
                               '$(PROCESSOR_ARCHITECTURE)' != 'x86' And
                               '$(PROCESSOR_ARCHITECTURE)' != 'ARM'"
                    Value="Unknown">
      <Output TaskParameter="Value" PropertyName="Architecture" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectNetFx20Sp"
          Condition="'$(EagleDetectNetFx20Sp)' != 'false' And
                     '$(BuildTool)' == 'MSBuild' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleLibraryToolsDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryToolsDir)') And
                     Exists('$(EagleLibraryToolsDir)SetErrorLevel.exe') And
                     Exists('$(EagleLibraryToolsDir)netFx20Sp.bat')">
    <Exec Command="&quot;$(EagleLibraryToolsDir)netFx20Sp.bat&quot;"
          IgnoreExitCode="true">
      <Output TaskParameter="ExitCode" PropertyName="EagleNetFx20Sp" />
    </Exec>

    <CreateProperty Condition="$(EagleNetFx20Sp) &gt;= 0x201"
                    Value="$(DefineConstants);NET_20_SP1">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>

    <CreateProperty Condition="$(EagleNetFx20Sp) &gt;= 0x202"
                    Value="$(DefineConstants);NET_20_SP2">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectNetCoreReferences"
          Condition="'$(EagleDetectNetCoreReferences)' != 'false'">
    <CreateProperty Condition="'$(EagleNetCoreReferences)' != 'false' And
                               ('$(TargetFramework)' == 'netstandard2.0' Or
                                '$(TargetFramework)' == 'netstandard2.1' Or
                                '$(TargetFramework)' == 'netcoreapp2.0' Or
                                '$(TargetFramework)' == 'netcoreapp2.0' Or
                                '$(TargetFramework)' == 'netcoreapp2.1' Or
                                '$(TargetFramework)' == 'netcoreapp2.2' Or
                                '$(TargetFramework)' == 'netcoreapp3.0' Or
                                '$(TargetFramework)' == 'netcoreapp3.1')"
                    Value="$(DefineConstants);NET_CORE_REFERENCES">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectNetCore20"
          Condition="'$(EagleDetectNetCore20)' != 'false'">
    <CreateProperty Condition="'$(EagleNetCore20)' != 'false' And
                               ('$(TargetFramework)' == 'netcoreapp2.0' Or
                                '$(TargetFramework)' == 'netcoreapp2.1' Or
                                '$(TargetFramework)' == 'netcoreapp2.2' Or
                                '$(TargetFramework)' == 'netcoreapp3.0' Or
                                '$(TargetFramework)' == 'netcoreapp3.1')"
                    Value="$(DefineConstants);NET_CORE_20">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectNetCore30"
          Condition="'$(EagleDetectNetCore30)' != 'false'">
    <CreateProperty Condition="'$(EagleNetCore30)' != 'false' And
                               ('$(TargetFramework)' == 'netcoreapp3.0' Or
                                '$(TargetFramework)' == 'netcoreapp3.1')"
                    Value="$(DefineConstants);NET_CORE_30">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectNetFx20"
          Condition="'$(EagleDetectNetFx20)' != 'false'">
    <CreateProperty Condition="((('$(MSBuildToolsVersion)' == '' Or
                                  '$(MSBuildToolsVersion)' == '2.0' Or
                                  '$(MSBuildToolsVersion)' == '3.5') And
                                 '$(TargetFrameworkVersion)' == '') Or
                                '$(TargetFrameworkVersion)' == 'v2.0') And
                               '$(TargetFramework)' != 'netstandard2.0' And
                               '$(TargetFramework)' != 'netstandard2.1' And
                               '$(TargetFramework)' != 'netcoreapp2.0' And
                               '$(TargetFramework)' != 'netcoreapp2.1' And
                               '$(TargetFramework)' != 'netcoreapp2.2' And
                               '$(TargetFramework)' != 'netcoreapp3.0' And
                               '$(TargetFramework)' != 'netcoreapp3.1'"
                    Value="$(DefineConstants);NET_20">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>

    <CreateProperty Condition="((('$(MSBuildToolsVersion)' != '' And
                                  '$(MSBuildToolsVersion)' != '2.0' And
                                  '$(MSBuildToolsVersion)' != '3.5') Or
                                 '$(TargetFrameworkVersion)' != '') And
                                '$(TargetFrameworkVersion)' != 'v2.0') And
                               '$(TargetFramework)' != 'netstandard2.0' And
                               '$(TargetFramework)' != 'netstandard2.1' And
                               '$(TargetFramework)' != 'netcoreapp2.0' And
                               '$(TargetFramework)' != 'netcoreapp2.1' And
                               '$(TargetFramework)' != 'netcoreapp2.2' And
                               '$(TargetFramework)' != 'netcoreapp3.0' And
                               '$(TargetFramework)' != 'netcoreapp3.1'"
                    Value="false">
      <Output TaskParameter="Value" PropertyName="EagleDetectNetFx20Sp" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectNetFx30"
          Condition="'$(EagleDetectNetFx30)' != 'false'">
    <CreateProperty Condition="'$(TargetFrameworkVersion)' == 'v3.0'"
                    Value="$(DefineConstants);NET_30">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectNetFx35"
          Condition="'$(EagleDetectNetFx35)' != 'false'">
    <CreateProperty Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
                    Value="$(DefineConstants);NET_35">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectNetFx40"
          Condition="'$(EagleDetectNetFx40)' != 'false'">
    <CreateProperty Condition="(('$(MSBuildToolsVersion)' == '4.0' Or
                                 '$(MSBuildToolsVersion)' == '12.0' Or
                                 '$(MSBuildToolsVersion)' == '14.0' Or
                                 '$(MSBuildToolsVersion)' == '15.0' Or
                                 '$(MSBuildToolsVersion)' == 'Current') And
                                '$(TargetFrameworkVersion)' == '') Or
                               '$(TargetFrameworkVersion)' == 'v4.0' Or
                               '$(TargetFrameworkVersion)' == 'v4.5' Or
                               '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                               '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                               '$(TargetFrameworkVersion)' == 'v4.6' Or
                               '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                               '$(TargetFrameworkVersion)' == 'v4.6.2' Or
                               '$(TargetFrameworkVersion)' == 'v4.7' Or
                               '$(TargetFrameworkVersion)' == 'v4.7.1' Or
                               '$(TargetFrameworkVersion)' == 'v4.7.2' Or
                               '$(TargetFrameworkVersion)' == 'v4.8' Or
                               '$(TargetFrameworkVersion)' == 'v4.8.1'"
                    Value="$(DefineConstants);NET_40">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectNetFx45"
          Condition="'$(EagleDetectNetFx45)' != 'false'">
    <CreateProperty Condition="'$(TargetFrameworkVersion)' == 'v4.5'"
                    Value="$(DefineConstants);NET_45">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectNetFx451"
          Condition="'$(EagleDetectNetFx451)' != 'false'">
    <CreateProperty Condition="'$(TargetFrameworkVersion)' == 'v4.5.1'"
                    Value="$(DefineConstants);NET_451">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectNetFx452"
          Condition="'$(EagleDetectNetFx452)' != 'false'">
    <CreateProperty Condition="'$(TargetFrameworkVersion)' == 'v4.5.2'"
                    Value="$(DefineConstants);NET_452">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectNetFx46"
          Condition="'$(EagleDetectNetFx46)' != 'false'">
    <CreateProperty Condition="'$(TargetFrameworkVersion)' == 'v4.6'"
                    Value="$(DefineConstants);NET_46">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectNetFx461"
          Condition="'$(EagleDetectNetFx461)' != 'false'">
    <CreateProperty Condition="'$(TargetFrameworkVersion)' == 'v4.6.1'"
                    Value="$(DefineConstants);NET_461">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectNetFx462"
          Condition="'$(EagleDetectNetFx462)' != 'false'">
    <CreateProperty Condition="'$(TargetFrameworkVersion)' == 'v4.6.2'"
                    Value="$(DefineConstants);NET_462">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectNetFx47"
          Condition="'$(EagleDetectNetFx47)' != 'false'">
    <CreateProperty Condition="'$(TargetFrameworkVersion)' == 'v4.7'"
                    Value="$(DefineConstants);NET_47">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectNetFx471"
          Condition="'$(EagleDetectNetFx471)' != 'false'">
    <CreateProperty Condition="'$(TargetFrameworkVersion)' == 'v4.7.1'"
                    Value="$(DefineConstants);NET_471">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectNetFx472"
          Condition="'$(EagleDetectNetFx472)' != 'false'">
    <CreateProperty Condition="'$(TargetFrameworkVersion)' == 'v4.7.2'"
                    Value="$(DefineConstants);NET_472">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectNetFx48"
          Condition="'$(EagleDetectNetFx48)' != 'false'">
    <CreateProperty Condition="'$(TargetFrameworkVersion)' == 'v4.8'"
                    Value="$(DefineConstants);NET_48">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectNetFx481"
          Condition="'$(EagleDetectNetFx481)' != 'false'">
    <CreateProperty Condition="'$(TargetFrameworkVersion)' == 'v4.8.1'"
                    Value="$(DefineConstants);NET_481">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectVs2017"
          Condition="'$(EagleDetectVs2017)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleLibraryToolsDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryToolsDir)') And
                     Exists('$(EagleLibraryToolsDir)vswhere.exe')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).DetectVs.done">
    <!--
        HACK: Use a couple undocumented properties of the Exec task in order
              to capture the console output of the "vswhere" command.  This
              is needed to locate the "EditBin" executable for Visual Studio
              2017.  For more information, see:

              https://stackoverflow.com/questions/8938679
    -->
    <Exec ConsoleToMSBuild="true" Command="&quot;$(EagleLibraryToolsDir)vswhere.exe&quot; -version 15.0 -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -latest"
          WorkingDirectory="$(EagleLibraryToolsDir)"
          IgnoreStandardErrorWarningFormat="true"
          IgnoreExitCode="true">
      <Output TaskParameter="ExitCode" PropertyName="VsWhereExitCode" />
      <Output TaskParameter="ConsoleOutput" PropertyName="VS150INSTALLATIONPATH" />
    </Exec>

    <!--
        HACK: Interestingly, the "vswhere" tool will generate an error when
              the -version command line option is used on a machine without
              Visual Studio 2017 installed.  This seems to defeat the purpose
              of a "detection" tool (i.e. it should simply return no matches
              instead of raising an error), we must work around it since this
              decision appears to be by design.
    -->
    <CreateProperty Condition="'$(VsWhereExitCode)' != '0'" Value="">
      <Output TaskParameter="Value" PropertyName="VS150INSTALLATIONPATH" />
    </CreateProperty>

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).DetectVs.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectVs2019"
          Condition="'$(EagleDetectVs2019)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleLibraryToolsDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryToolsDir)') And
                     Exists('$(EagleLibraryToolsDir)vswhere.exe')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).DetectVs.done">
    <!--
        HACK: Use a couple undocumented properties of the Exec task in order
              to capture the console output of the "vswhere" command.  This
              is needed to locate the "EditBin" executable for Visual Studio
              2019.  For more information, see:

              https://stackoverflow.com/questions/8938679
    -->
    <Exec ConsoleToMSBuild="true" Command="&quot;$(EagleLibraryToolsDir)vswhere.exe&quot; -version 16.0 -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -latest"
          WorkingDirectory="$(EagleLibraryToolsDir)"
          IgnoreStandardErrorWarningFormat="true"
          IgnoreExitCode="true">
      <Output TaskParameter="ExitCode" PropertyName="VsWhereExitCode" />
      <Output TaskParameter="ConsoleOutput" PropertyName="VS160INSTALLATIONPATH" />
    </Exec>

    <!--
        HACK: Interestingly, the "vswhere" tool will generate an error when
              the -version command line option is used on a machine without
              Visual Studio 2019 installed.  This seems to defeat the purpose
              of a "detection" tool (i.e. it should simply return no matches
              instead of raising an error), we must work around it since this
              decision appears to be by design.
    -->
    <CreateProperty Condition="'$(VsWhereExitCode)' != '0'" Value="">
      <Output TaskParameter="Value" PropertyName="VS160INSTALLATIONPATH" />
    </CreateProperty>

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).DetectVs.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectVs2022"
          Condition="'$(EagleDetectVs2022)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleLibraryToolsDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryToolsDir)') And
                     Exists('$(EagleLibraryToolsDir)vswhere.exe')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).DetectVs.done">
    <!--
        HACK: Use a couple undocumented properties of the Exec task in order
              to capture the console output of the "vswhere" command.  This
              is needed to locate the "EditBin" executable for Visual Studio
              2022.  For more information, see:

              https://stackoverflow.com/questions/8938679
    -->
    <Exec ConsoleToMSBuild="true" Command="&quot;$(EagleLibraryToolsDir)vswhere.exe&quot; -version 17.0 -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -latest"
          WorkingDirectory="$(EagleLibraryToolsDir)"
          IgnoreStandardErrorWarningFormat="true"
          IgnoreExitCode="true">
      <Output TaskParameter="ExitCode" PropertyName="VsWhereExitCode" />
      <Output TaskParameter="ConsoleOutput" PropertyName="VS170INSTALLATIONPATH" />
    </Exec>

    <!--
        HACK: Interestingly, the "vswhere" tool will generate an error when
              the -version command line option is used on a machine without
              Visual Studio 2022 installed.  This seems to defeat the purpose
              of a "detection" tool (i.e. it should simply return no matches
              instead of raising an error), we must work around it since this
              decision appears to be by design.
    -->
    <CreateProperty Condition="'$(VsWhereExitCode)' != '0'" Value="">
      <Output TaskParameter="Value" PropertyName="VS170INSTALLATIONPATH" />
    </CreateProperty>

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).DetectVs.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectVcTools2017"
          Condition="'$(EagleDetectVcTools2017)' != 'false' And
                     '$(VS150INSTALLATIONPATH)' != '' And
                     !HasTrailingSlash('$(VS150INSTALLATIONPATH)') And
                     Exists('$(VS150INSTALLATIONPATH)\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).DetectVcTools.done">
    <ReadLinesFromFile File="$(VS150INSTALLATIONPATH)\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt">
      <Output TaskParameter="Lines" PropertyName="VCToolsVersion" />
    </ReadLinesFromFile>

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).DetectVcTools.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectVcTools2019"
          Condition="'$(EagleDetectVcTools2019)' != 'false' And
                     '$(VS160INSTALLATIONPATH)' != '' And
                     !HasTrailingSlash('$(VS160INSTALLATIONPATH)') And
                     Exists('$(VS160INSTALLATIONPATH)\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).DetectVcTools.done">
    <ReadLinesFromFile File="$(VS160INSTALLATIONPATH)\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt">
      <Output TaskParameter="Lines" PropertyName="VCToolsVersion" />
    </ReadLinesFromFile>

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).DetectVcTools.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectVcTools2022"
          Condition="'$(EagleDetectVcTools2022)' != 'false' And
                     '$(VS170INSTALLATIONPATH)' != '' And
                     !HasTrailingSlash('$(VS170INSTALLATIONPATH)') And
                     Exists('$(VS170INSTALLATIONPATH)\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).DetectVcTools.done">
    <ReadLinesFromFile File="$(VS170INSTALLATIONPATH)\VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt">
      <Output TaskParameter="Lines" PropertyName="VCToolsVersion" />
    </ReadLinesFromFile>

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).DetectVcTools.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectWix30"
          Condition="'$(EagleDetectWix30)' != 'false'">
    <CreateProperty Condition="'$(EagleWixVersion)' == '3.0'"
                    Value="$(DefineConstants);WIX_30">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectWix35"
          Condition="'$(EagleDetectWix35)' != 'false'">
    <CreateProperty Condition="'$(EagleWixVersion)' == '3.5'"
                    Value="$(DefineConstants);WIX_35">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectWix36"
          Condition="'$(EagleDetectWix36)' != 'false'">
    <CreateProperty Condition="'$(EagleWixVersion)' == '3.6'"
                    Value="$(DefineConstants);WIX_36">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectWix37"
          Condition="'$(EagleDetectWix37)' != 'false'">
    <CreateProperty Condition="'$(EagleWixVersion)' == '3.7'"
                    Value="$(DefineConstants);WIX_37">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectWix38"
          Condition="'$(EagleDetectWix38)' != 'false'">
    <CreateProperty Condition="'$(EagleWixVersion)' == '3.8'"
                    Value="$(DefineConstants);WIX_38">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectWix39"
          Condition="'$(EagleDetectWix39)' != 'false'">
    <CreateProperty Condition="'$(EagleWixVersion)' == '3.9'"
                    Value="$(DefineConstants);WIX_39">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectWix310"
          Condition="'$(EagleDetectWix310)' != 'false'">
    <CreateProperty Condition="'$(EagleWixVersion)' == '3.10'"
                    Value="$(DefineConstants);WIX_310">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectWix311"
          Condition="'$(EagleDetectWix311)' != 'false'">
    <CreateProperty Condition="'$(EagleWixVersion)' == '3.11'"
                    Value="$(DefineConstants);WIX_311">
      <Output TaskParameter="Value" PropertyName="DefineConstants" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleSetStackExternals"
          Condition="'$(EagleSetStackExternals)' != 'false' And
                     ('$(OutputType)' == 'Exe' Or
                      '$(OutputType)' == 'WinExe') And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleStackSize)' != '' And
                     '$(EagleDir)' != '' And
                     !HasTrailingSlash('$(EagleDir)') And
                     Exists('$(EagleDir)\Externals\MSVCPP\Tools\EditBin.exe')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).SetStack.done">
    <Exec Command="&quot;$(EagleDir)\Externals\MSVCPP\Tools\EditBin.exe&quot; &quot;/stack:$(EagleStackSize)&quot; &quot;$(TargetPath)&quot;"
          WorkingDirectory="$(EagleDir)\Externals\MSVCPP\Tools" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).SetStack.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleSetStack2005"
          Condition="'$(EagleSetStack)' != 'false' And
                     ('$(OutputType)' == 'Exe' Or
                      '$(OutputType)' == 'WinExe') And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleStackSize)' != '' And
                     '$(VS80COMNTOOLS)' != '' And
                     HasTrailingSlash('$(VS80COMNTOOLS)') And
                     Exists('$(VS80COMNTOOLS)..\..\VC\bin\EditBin.exe')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).SetStack.done">
    <Exec Command="&quot;$(VS80COMNTOOLS)..\..\VC\bin\EditBin.exe&quot; &quot;/stack:$(EagleStackSize)&quot; &quot;$(TargetPath)&quot;"
          WorkingDirectory="$(VS80COMNTOOLS)..\..\Common7\IDE" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).SetStack.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleSetStack2008"
          Condition="'$(EagleSetStack)' != 'false' And
                     ('$(OutputType)' == 'Exe' Or
                      '$(OutputType)' == 'WinExe') And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleStackSize)' != '' And
                     '$(VS90COMNTOOLS)' != '' And
                     HasTrailingSlash('$(VS90COMNTOOLS)') And
                     Exists('$(VS90COMNTOOLS)..\..\VC\bin\EditBin.exe')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).SetStack.done">
    <Exec Command="&quot;$(VS90COMNTOOLS)..\..\VC\bin\EditBin.exe&quot; &quot;/stack:$(EagleStackSize)&quot; &quot;$(TargetPath)&quot;"
          WorkingDirectory="$(VS90COMNTOOLS)..\..\Common7\IDE" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).SetStack.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleSetStack2010"
          Condition="'$(EagleSetStack)' != 'false' And
                     ('$(OutputType)' == 'Exe' Or
                      '$(OutputType)' == 'WinExe') And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleStackSize)' != '' And
                     '$(VS100COMNTOOLS)' != '' And
                     HasTrailingSlash('$(VS100COMNTOOLS)') And
                     Exists('$(VS100COMNTOOLS)..\..\VC\bin\EditBin.exe')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).SetStack.done">
    <Exec Command="&quot;$(VS100COMNTOOLS)..\..\VC\bin\EditBin.exe&quot; &quot;/stack:$(EagleStackSize)&quot; &quot;$(TargetPath)&quot;"
          WorkingDirectory="$(VS100COMNTOOLS)..\..\Common7\IDE" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).SetStack.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleSetStack2012"
          Condition="'$(EagleSetStack)' != 'false' And
                     ('$(OutputType)' == 'Exe' Or
                      '$(OutputType)' == 'WinExe') And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleStackSize)' != '' And
                     '$(VS110COMNTOOLS)' != '' And
                     HasTrailingSlash('$(VS110COMNTOOLS)') And
                     Exists('$(VS110COMNTOOLS)..\..\VC\bin\EditBin.exe')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).SetStack.done">
    <Exec Command="&quot;$(VS110COMNTOOLS)..\..\VC\bin\EditBin.exe&quot; &quot;/stack:$(EagleStackSize)&quot; &quot;$(TargetPath)&quot;"
          WorkingDirectory="$(VS110COMNTOOLS)..\..\Common7\IDE" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).SetStack.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleSetStack2013"
          Condition="'$(EagleSetStack)' != 'false' And
                     ('$(OutputType)' == 'Exe' Or
                      '$(OutputType)' == 'WinExe') And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleStackSize)' != '' And
                     '$(VS120COMNTOOLS)' != '' And
                     HasTrailingSlash('$(VS120COMNTOOLS)') And
                     Exists('$(VS120COMNTOOLS)..\..\VC\bin\EditBin.exe')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).SetStack.done">
    <Exec Command="&quot;$(VS120COMNTOOLS)..\..\VC\bin\EditBin.exe&quot; &quot;/stack:$(EagleStackSize)&quot; &quot;$(TargetPath)&quot;"
          WorkingDirectory="$(VS120COMNTOOLS)..\..\Common7\IDE" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).SetStack.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleSetStack2015"
          Condition="'$(EagleSetStack)' != 'false' And
                     ('$(OutputType)' == 'Exe' Or
                      '$(OutputType)' == 'WinExe') And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleStackSize)' != '' And
                     '$(VS140COMNTOOLS)' != '' And
                     HasTrailingSlash('$(VS140COMNTOOLS)') And
                     Exists('$(VS140COMNTOOLS)..\..\VC\bin\EditBin.exe')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).SetStack.done">
    <Exec Command="&quot;$(VS140COMNTOOLS)..\..\VC\bin\EditBin.exe&quot; &quot;/stack:$(EagleStackSize)&quot; &quot;$(TargetPath)&quot;"
          WorkingDirectory="$(VS140COMNTOOLS)..\..\Common7\IDE" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).SetStack.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleSetStack2017"
          Condition="'$(EagleSetStack)' != 'false' And
                     ('$(OutputType)' == 'Exe' Or
                      '$(OutputType)' == 'WinExe') And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleStackSize)' != '' And
                     '$(VS150INSTALLATIONPATH)' != '' And
                     !HasTrailingSlash('$(VS150INSTALLATIONPATH)') And
                     '$(VCToolsVersion)' != '' And
                     Exists('$(VS150INSTALLATIONPATH)\VC\Tools\MSVC\$(VCToolsVersion)\bin\HostX86\x86\EditBin.exe')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).SetStack.done">
    <Exec Command="&quot;$(VS150INSTALLATIONPATH)\VC\Tools\MSVC\$(VCToolsVersion)\bin\HostX86\x86\EditBin.exe&quot; &quot;/stack:$(EagleStackSize)&quot; &quot;$(TargetPath)&quot;"
          WorkingDirectory="$(VS150INSTALLATIONPATH)\Common7\IDE" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).SetStack.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleSetStack2019"
          Condition="'$(EagleSetStack)' != 'false' And
                     ('$(OutputType)' == 'Exe' Or
                      '$(OutputType)' == 'WinExe') And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleStackSize)' != '' And
                     '$(VS160INSTALLATIONPATH)' != '' And
                     !HasTrailingSlash('$(VS160INSTALLATIONPATH)') And
                     '$(VCToolsVersion)' != '' And
                     Exists('$(VS160INSTALLATIONPATH)\VC\Tools\MSVC\$(VCToolsVersion)\bin\HostX86\x86\EditBin.exe')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).SetStack.done">
    <Exec Command="&quot;$(VS160INSTALLATIONPATH)\VC\Tools\MSVC\$(VCToolsVersion)\bin\HostX86\x86\EditBin.exe&quot; &quot;/stack:$(EagleStackSize)&quot; &quot;$(TargetPath)&quot;"
          WorkingDirectory="$(VS160INSTALLATIONPATH)\Common7\IDE" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).SetStack.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleSetStack2022"
          Condition="'$(EagleSetStack)' != 'false' And
                     ('$(OutputType)' == 'Exe' Or
                      '$(OutputType)' == 'WinExe') And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleStackSize)' != '' And
                     '$(VS170INSTALLATIONPATH)' != '' And
                     !HasTrailingSlash('$(VS170INSTALLATIONPATH)') And
                     '$(VCToolsVersion)' != '' And
                     Exists('$(VS170INSTALLATIONPATH)\VC\Tools\MSVC\$(VCToolsVersion)\bin\HostX86\x86\EditBin.exe')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).SetStack.done">
    <Exec Command="&quot;$(VS170INSTALLATIONPATH)\VC\Tools\MSVC\$(VCToolsVersion)\bin\HostX86\x86\EditBin.exe&quot; &quot;/stack:$(EagleStackSize)&quot; &quot;$(TargetPath)&quot;"
          WorkingDirectory="$(VS170INSTALLATIONPATH)\Common7\IDE" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).SetStack.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleSetIcon"
          Condition="'$(EagleSetIcon)' != 'false' And
                     ('$(OutputType)' == 'Exe' Or
                      '$(OutputType)' == 'WinExe') And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleLibraryDir)' != '' And
                     '$(EagleLibraryToolsDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryDir)') And
                     HasTrailingSlash('$(EagleLibraryToolsDir)') And
                     Exists('$(EagleLibraryToolsDir)SetIcon.exe') And
                     Exists('$(EagleLibraryDir)Resources\Eagle.ico')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).SetIcon.done">
    <Exec Command="&quot;$(EagleLibraryToolsDir)SetIcon.exe&quot; &quot;$(TargetPath)&quot; &quot;$(EagleLibraryDir)Resources\Eagle.ico&quot;" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).SetIcon.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleStripPdbPath"
          Condition="'$(EagleStripPdbPath)' != 'false' And
                     ('$(BuildTool)' == 'MSBuild' Or
                      '$(BuildTool)' == 'DotNetCore') And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleLibraryDir)' != '' And
                     '$(EagleLibraryToolsDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryDir)') And
                     HasTrailingSlash('$(EagleLibraryToolsDir)') And
                     Exists('$(EagleLibraryToolsDir)BinaryEditor.exe')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).StripPdbPath.done">
    <!--
        HACK: *WARNING* This is really evil.  Basically, we [attempt to] modify
              the built executable image to remove the directory information for
              the PDB file name in the "Debug Directory" header.  There seems to
              be no other [easy] way to accomplish this, official or otherwise.
    -->
    <Exec Command="&quot;$(EagleLibraryToolsDir)BinaryEditor.exe&quot; -noCase -paths -verbose -- &quot;$(TargetPath)&quot; &quot;$(TargetPath)&quot; &quot;$(IntermediateOutputPath)$(TargetName).pdb&quot; &quot;$(TargetName).pdb&quot;" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).StripPdbPath.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleEmbedExeManifest"
          Condition="'$(EagleEmbedExeManifest)' != 'false' And
                     ('$(OutputType)' == 'Exe' Or
                      '$(OutputType)' == 'WinExe') And
                     '$(BuildTool)' == 'MSBuild' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(MSBuildProjectDirectory)' != '' And
                     !HasTrailingSlash('$(MSBuildProjectDirectory)') And
                     Exists('$(MSBuildProjectDirectory)\Resources\manifest.xml')"
          Inputs="$(TargetPath);$(MSBuildProjectDirectory)\Resources\manifest.xml"
          Outputs="$(TargetPath).EmbedExeManifest.done">
    <!--
        HACK: *BROKEN* The GetFrameworkSDKPath MSBuild task was broken by the
              Visual Studio 2012 / .NET Framework 4.5 RTM release.  It now
              incorrectly returns the Windows SDK path, not the .NET Framework
              SDK path.  When Visual Studio 2012 is installed, it also breaks
              the Visual Studio 2010 / .NET Framework 4.0 build environment as
              well.  The "supported", yet sub-optimal, alternative appears to
              be using the TargetFrameworkSDKToolsDirectory variable.
    -->
    <GetFrameworkSDKPath Condition="'$(SDK35ToolsPath)' == '' And
                                    '$(WindowsSDK80Path)' == ''">
      <Output TaskParameter="Path"
              PropertyName="DirForManifestTool" />
    </GetFrameworkSDKPath>

    <Exec Condition="'$(SDK35ToolsPath)' != '' And
                     HasTrailingSlash('$(SDK35ToolsPath)') And
                     Exists('$(SDK35ToolsPath)mt.exe')"
          Command="&quot;$(SDK35ToolsPath)mt.exe&quot; -manifest &quot;$(MSBuildProjectDirectory)\Resources\manifest.xml&quot; -outputresource:&quot;$(TargetPath)&quot;;1" />

    <Exec Condition="('$(SDK35ToolsPath)' == '' Or
                      !HasTrailingSlash('$(SDK35ToolsPath)') Or
                      !Exists('$(SDK35ToolsPath)mt.exe')) And
                     '$(WindowsSDK80Path)' == '' And
                     '$(DirForManifestTool)' != '' And
                     HasTrailingSlash('$(DirForManifestTool)') And
                     Exists('$(DirForManifestTool)bin\mt.exe')"
          Command="&quot;$(DirForManifestTool)bin\mt.exe&quot; -manifest &quot;$(MSBuildProjectDirectory)\Resources\manifest.xml&quot; -outputresource:&quot;$(TargetPath)&quot;;1" />

    <Exec Condition="('$(SDK35ToolsPath)' == '' Or
                      !HasTrailingSlash('$(SDK35ToolsPath)') Or
                      !Exists('$(SDK35ToolsPath)mt.exe')) And
                     '$(WindowsSDK80Path)' != '' And
                     '$(DirForManifestTool)' == '' And
                     '$(Architecture)' != '' And
                     Exists('$(WindowsSDK80Path)bin\$(Architecture)\mt.exe')"
          Command="&quot;$(WindowsSDK80Path)bin\$(Architecture)\mt.exe&quot; -manifest &quot;$(MSBuildProjectDirectory)\Resources\manifest.xml&quot; -outputresource:&quot;$(TargetPath)&quot;;1" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).EmbedExeManifest.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleMake32BitOnly"
          Condition="'$(EagleMake32BitOnly)' != 'false' And
                     ('$(OutputType)' == 'Exe' Or
                      '$(OutputType)' == 'WinExe') And
                     '$(BuildTool)' == 'MSBuild' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(TargetPath)' != '' And
                     !HasTrailingSlash('$(TargetPath)') And
                     Exists('$(TargetPath)') And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)') And
                     '$(TargetName)' != '' And
                     Exists('$(OutputPath)$(TargetName).exe')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).EagleMake32BitOnly.done">
    <!--
        HACK: *BROKEN* The GetFrameworkSDKPath MSBuild task was broken by the
              Visual Studio 2012 / .NET Framework 4.5 RTM release.  It now
              incorrectly returns the Windows SDK path, not the .NET Framework
              SDK path.  When Visual Studio 2012 is installed, it also breaks
              the Visual Studio 2010 / .NET Framework 4.0 build environment as
              well.  The "supported", yet sub-optimal, alternative appears to
              be using the TargetFrameworkSDKToolsDirectory variable.
    -->
    <GetFrameworkSDKPath Condition="'$(TargetFrameworkSDKToolsDirectory)' == ''">
      <Output TaskParameter="Path"
              PropertyName="DirForEagleMake32BitOnly" />
    </GetFrameworkSDKPath>

    <Copy SourceFiles="$(OutputPath)$(TargetName).exe"
          DestinationFiles="$(OutputPath)$(TargetName)32.exe" />

    <Exec Condition="'$(TargetFrameworkSDKToolsDirectory)' == '' And
                     '$(DirForEagleMake32BitOnly)' != '' And
                     HasTrailingSlash('$(DirForEagleMake32BitOnly)') And
                     Exists('$(DirForEagleMake32BitOnly)bin\CorFlags.exe')"
          Command="&quot;$(DirForEagleMake32BitOnly)bin\CorFlags.exe&quot; &quot;$(OutputPath)$(TargetName)32.exe&quot; /32BIT+ /Force 1&gt;NUL" />

    <Exec Condition="'$(TargetFrameworkSDKToolsDirectory)' != '' And
                     '$(DirForEagleMake32BitOnly)' == '' And
                     HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And
                     Exists('$(TargetFrameworkSDKToolsDirectory)CorFlags.exe')"
          Command="&quot;$(TargetFrameworkSDKToolsDirectory)CorFlags.exe&quot; &quot;$(OutputPath)$(TargetName)32.exe&quot; /32BIT+ /Force 1&gt;NUL" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).EagleMake32BitOnly.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleStrongNameSign"
          Condition="'$(EagleStrongNameSign)' != 'false' And
                     '$(BuildTool)' == 'MSBuild' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(SignAssembly)' != 'false' And
                     Exists('$(AssemblyOriginatorKeyFile)') And
                     Exists('$(EaglePrivateKeyFile)') And
                     '$(TargetPath)' != '' And
                     !HasTrailingSlash('$(TargetPath)') And
                     Exists('$(TargetPath)') And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)') And
                     '$(TargetName)' != '' And
                     '$(TargetExt)' != ''"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).StrongNameSign.done">
    <!--
        HACK: *BROKEN* The GetFrameworkSDKPath MSBuild task was broken by the
              Visual Studio 2012 / .NET Framework 4.5 RTM release.  It now
              incorrectly returns the Windows SDK path, not the .NET Framework
              SDK path.  When Visual Studio 2012 is installed, it also breaks
              the Visual Studio 2010 / .NET Framework 4.0 build environment as
              well.  The "supported", yet sub-optimal, alternative appears to
              be using the TargetFrameworkSDKToolsDirectory variable.
    -->
    <GetFrameworkSDKPath Condition="('$(StrongNameWithoutSdk)' == '' Or
                                     '$(StrongNameWithoutSdk)' == 'false') And
                                    '$(TargetFrameworkSDKToolsDirectory)' == ''">
      <Output TaskParameter="Path"
              PropertyName="DirForStrongName" />
    </GetFrameworkSDKPath>

    <Exec Condition="'$(StrongNameWithoutSdk)' != '' And
                     '$(StrongNameWithoutSdk)' != 'false'"
          Command="sn.exe -Ra &quot;$(TargetPath)&quot; &quot;$(EaglePrivateKeyFile)&quot;" />

    <Exec Condition="'$(StrongNameWithoutSdk)' != '' And
                     '$(StrongNameWithoutSdk)' != 'false' And
                     Exists('$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)')"
          Command="sn.exe -Ra &quot;$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)&quot; &quot;$(EaglePrivateKeyFile)&quot;" />

    <Exec Condition="('$(StrongNameWithoutSdk)' == '' Or
                      '$(StrongNameWithoutSdk)' == 'false') And
                     '$(OverrideDirForStrongName)' != '' And
                     HasTrailingSlash('$(OverrideDirForStrongName)') And
                     Exists('$(OverrideDirForStrongName)sn.exe')"
          Command="&quot;$(OverrideDirForStrongName)sn.exe&quot; -Ra &quot;$(TargetPath)&quot; &quot;$(EaglePrivateKeyFile)&quot;" />

    <Exec Condition="('$(StrongNameWithoutSdk)' == '' Or
                      '$(StrongNameWithoutSdk)' == 'false') And
                     '$(OverrideDirForStrongName)' != '' And
                     HasTrailingSlash('$(OverrideDirForStrongName)') And
                     Exists('$(OverrideDirForStrongName)sn.exe') And
                     Exists('$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)')"
          Command="&quot;$(OverrideDirForStrongName)sn.exe&quot; -Ra &quot;$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)&quot; &quot;$(EaglePrivateKeyFile)&quot;" />

    <Exec Condition="('$(StrongNameWithoutSdk)' == '' Or
                      '$(StrongNameWithoutSdk)' == 'false') And
                     '$(TargetFrameworkSDKToolsDirectory)' == '' And
                     '$(OverrideDirForStrongName)' == '' And
                     '$(DirForStrongName)' != '' And
                     HasTrailingSlash('$(DirForStrongName)') And
                     Exists('$(DirForStrongName)bin\sn.exe')"
          Command="&quot;$(DirForStrongName)bin\sn.exe&quot; -Ra &quot;$(TargetPath)&quot; &quot;$(EaglePrivateKeyFile)&quot;" />

    <Exec Condition="('$(StrongNameWithoutSdk)' == '' Or
                      '$(StrongNameWithoutSdk)' == 'false') And
                     '$(TargetFrameworkSDKToolsDirectory)' == '' And
                     '$(OverrideDirForStrongName)' == '' And
                     '$(DirForStrongName)' != '' And
                     HasTrailingSlash('$(DirForStrongName)') And
                     Exists('$(DirForStrongName)bin\sn.exe') And
                     Exists('$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)')"
          Command="&quot;$(DirForStrongName)bin\sn.exe&quot; -Ra &quot;$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)&quot; &quot;$(EaglePrivateKeyFile)&quot;" />

    <Exec Condition="('$(StrongNameWithoutSdk)' == '' Or
                      '$(StrongNameWithoutSdk)' == 'false') And
                     '$(TargetFrameworkSDKToolsDirectory)' != '' And
                     '$(OverrideDirForStrongName)' == '' And
                     '$(DirForStrongName)' == '' And
                     HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And
                     Exists('$(TargetFrameworkSDKToolsDirectory)sn.exe')"
          Command="&quot;$(TargetFrameworkSDKToolsDirectory)sn.exe&quot; -Ra &quot;$(TargetPath)&quot; &quot;$(EaglePrivateKeyFile)&quot;" />

    <Exec Condition="('$(StrongNameWithoutSdk)' == '' Or
                      '$(StrongNameWithoutSdk)' == 'false') And
                     '$(TargetFrameworkSDKToolsDirectory)' != '' And
                     '$(OverrideDirForStrongName)' == '' And
                     '$(DirForStrongName)' == '' And
                     HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And
                     Exists('$(TargetFrameworkSDKToolsDirectory)sn.exe') And
                     Exists('$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)')"
          Command="&quot;$(TargetFrameworkSDKToolsDirectory)sn.exe&quot; -Ra &quot;$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)&quot; &quot;$(EaglePrivateKeyFile)&quot;" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).StrongNameSign.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleAuthenticodeSign"
          Condition="'$(EagleAuthenticodeSign)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(TargetPath)' != '' And
                     !HasTrailingSlash('$(TargetPath)') And
                     Exists('$(TargetPath)') And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)') And
                     '$(TargetName)' != '' And
                     '$(TargetExt)' != ''"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).AuthenticodeSign.done">
    <Exec Condition="'$(EagleAuthenticodeSign1)' != 'false' And
                     '$(EagleSignCodeDir)' != '' And
                     HasTrailingSlash('$(EagleSignCodeDir)') And
                     Exists('$(EagleSignCodeDir)SignCode.exe') And
                     Exists('$(SPC_FILE)') And
                     Exists('$(PVK_FILE)')"
          Command="&quot;$(EagleSignCodeDir)SignCode.exe&quot; -spc &quot;$(SPC_FILE)&quot; -v &quot;$(PVK_FILE)&quot; -n &quot;$(EagleProjectName)&quot; -i &quot;$(EagleProjectUrl)&quot; -a sha1 -t &quot;$(EagleTimeStampUrl)&quot; -tr &quot;$(EagleTimeStampRetries)&quot; -tw &quot;$(EagleTimeStampWait)&quot; &quot;$(TargetPath)&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign1)' != 'false' And
                     '$(EaglePauseForServer)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     Exists('$(SPC_FILE)') And
                     Exists('$(PVK_FILE)') And
                     '$(EagleLibraryToolsDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryToolsDir)') And
                     Exists('$(EagleLibraryToolsDir)JustWait.exe') And
                     '$(EaglePauseForServerMilliseconds)' != ''"
          Command="&quot;$(EagleLibraryToolsDir)JustWait.exe&quot; &quot;$(EaglePauseForServerMilliseconds)&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign1)' != 'false' And
                     '$(EagleSignCodeDir)' != '' And
                     HasTrailingSlash('$(EagleSignCodeDir)') And
                     Exists('$(EagleSignCodeDir)SignCode.exe') And
                     Exists('$(SPC_FILE)') And
                     Exists('$(PVK_FILE)') And
                     Exists('$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)')"
          Command="&quot;$(EagleSignCodeDir)SignCode.exe&quot; -spc &quot;$(SPC_FILE)&quot; -v &quot;$(PVK_FILE)&quot; -n &quot;$(EagleProjectName)&quot; -i &quot;$(EagleProjectUrl)&quot; -a sha1 -t &quot;$(EagleTimeStampUrl)&quot; -tr &quot;$(EagleTimeStampRetries)&quot; -tw &quot;$(EagleTimeStampWait)&quot; &quot;$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign1)' != 'false' And
                     '$(EaglePauseForServer)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     Exists('$(SPC_FILE)') And
                     Exists('$(PVK_FILE)') And
                     '$(EagleLibraryToolsDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryToolsDir)') And
                     Exists('$(EagleLibraryToolsDir)JustWait.exe') And
                     '$(EaglePauseForServerMilliseconds)' != '' And
                     Exists('$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)')"
          Command="&quot;$(EagleLibraryToolsDir)JustWait.exe&quot; &quot;$(EaglePauseForServerMilliseconds)&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign2)' != 'false' And
                     '$(EagleSignToolDir)' != '' And
                     HasTrailingSlash('$(EagleSignToolDir)') And
                     Exists('$(EagleSignToolDir)SignTool.exe') And
                     Exists('$(PFX_FILE)') And
                     '$(PFX_PASSWORD)' != ''"
          Command="&quot;$(EagleSignToolDir)SignTool.exe&quot; sign /as /v /f &quot;$(PFX_FILE)&quot; /p &quot;$(PFX_PASSWORD)&quot; /d &quot;$(EagleProjectName)&quot; /du &quot;$(EagleProjectUrl)&quot; /fd sha512 /tr &quot;$(EagleRfcTimeStampUrl1)&quot; /td &quot;$(EagleRfcTimeStampAlgorithm1)&quot; &quot;$(TargetPath)&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign2)' != 'false' And
                     '$(EaglePauseForServer)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     Exists('$(PFX_FILE)') And
                     '$(PFX_PASSWORD)' != '' And
                     '$(EagleLibraryToolsDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryToolsDir)') And
                     Exists('$(EagleLibraryToolsDir)JustWait.exe') And
                     '$(EaglePauseForServerMilliseconds)' != ''"
          Command="&quot;$(EagleLibraryToolsDir)JustWait.exe&quot; &quot;$(EaglePauseForServerMilliseconds)&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign2)' != 'false' And
                     '$(EagleSignToolDir)' != '' And
                     HasTrailingSlash('$(EagleSignToolDir)') And
                     Exists('$(EagleSignToolDir)SignTool.exe') And
                     Exists('$(PFX_FILE)') And
                     '$(PFX_PASSWORD)' != '' And
                     Exists('$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)')"
          Command="&quot;$(EagleSignToolDir)SignTool.exe&quot; sign /as /v /f &quot;$(PFX_FILE)&quot; /p &quot;$(PFX_PASSWORD)&quot; /d &quot;$(EagleProjectName)&quot; /du &quot;$(EagleProjectUrl)&quot; /fd sha512 /tr &quot;$(EagleRfcTimeStampUrl1)&quot; /td &quot;$(EagleRfcTimeStampAlgorithm1)&quot; &quot;$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign2)' != 'false' And
                     '$(EaglePauseForServer)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     Exists('$(PFX_FILE)') And
                     '$(PFX_PASSWORD)' != '' And
                     '$(EagleLibraryToolsDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryToolsDir)') And
                     Exists('$(EagleLibraryToolsDir)JustWait.exe') And
                     '$(EaglePauseForServerMilliseconds)' != '' And
                     Exists('$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)')"
          Command="&quot;$(EagleLibraryToolsDir)JustWait.exe&quot; &quot;$(EaglePauseForServerMilliseconds)&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign3)' != 'false' And
                     '$(EagleSignToolDir)' != '' And
                     HasTrailingSlash('$(EagleSignToolDir)') And
                     Exists('$(EagleSignToolDir)SignTool.exe') And
                     '$(SUBJECT_NAME)' != ''"
          Command="&quot;$(EagleSignToolDir)SignTool.exe&quot; sign /as /v /n &quot;$(SUBJECT_NAME)&quot; /d &quot;$(EagleProjectName)&quot; /du &quot;$(EagleProjectUrl)&quot; /fd sha1 /tr &quot;$(EagleRfcTimeStampUrl2)&quot; /td &quot;$(EagleRfcTimeStampAlgorithm2)&quot; &quot;$(TargetPath)&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign3)' != 'false' And
                     '$(EaglePauseForServer)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(SUBJECT_NAME)' != '' And
                     '$(EagleLibraryToolsDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryToolsDir)') And
                     Exists('$(EagleLibraryToolsDir)JustWait.exe') And
                     '$(EaglePauseForServerMilliseconds)' != ''"
          Command="&quot;$(EagleLibraryToolsDir)JustWait.exe&quot; &quot;$(EaglePauseForServerMilliseconds)&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign3)' != 'false' And
                     '$(EagleSignToolDir)' != '' And
                     HasTrailingSlash('$(EagleSignToolDir)') And
                     Exists('$(EagleSignToolDir)SignTool.exe') And
                     '$(SUBJECT_NAME)' != '' And
                     Exists('$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)')"
          Command="&quot;$(EagleSignToolDir)SignTool.exe&quot; sign /as /v /n &quot;$(SUBJECT_NAME)&quot; /d &quot;$(EagleProjectName)&quot; /du &quot;$(EagleProjectUrl)&quot; /fd sha1 /tr &quot;$(EagleRfcTimeStampUrl2)&quot; /td &quot;$(EagleRfcTimeStampAlgorithm2)&quot; &quot;$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign3)' != 'false' And
                     '$(EaglePauseForServer)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(SUBJECT_NAME)' != '' And
                     '$(EagleLibraryToolsDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryToolsDir)') And
                     Exists('$(EagleLibraryToolsDir)JustWait.exe') And
                     '$(EaglePauseForServerMilliseconds)' != '' And
                     Exists('$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)')"
          Command="&quot;$(EagleLibraryToolsDir)JustWait.exe&quot; &quot;$(EaglePauseForServerMilliseconds)&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign4)' != 'false' And
                     '$(EagleSignToolDir)' != '' And
                     HasTrailingSlash('$(EagleSignToolDir)') And
                     Exists('$(EagleSignToolDir)SignTool.exe') And
                     '$(SUBJECT_NAME)' != ''"
          Command="&quot;$(EagleSignToolDir)SignTool.exe&quot; sign /as /v /n &quot;$(SUBJECT_NAME)&quot; /d &quot;$(EagleProjectName)&quot; /du &quot;$(EagleProjectUrl)&quot; /fd sha512 /tr &quot;$(EagleRfcTimeStampUrl3)&quot; /td &quot;$(EagleRfcTimeStampAlgorithm3)&quot; &quot;$(TargetPath)&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign4)' != 'false' And
                     '$(EaglePauseForServer)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(SUBJECT_NAME)' != '' And
                     '$(EagleLibraryToolsDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryToolsDir)') And
                     Exists('$(EagleLibraryToolsDir)JustWait.exe') And
                     '$(EaglePauseForServerMilliseconds)' != ''"
          Command="&quot;$(EagleLibraryToolsDir)JustWait.exe&quot; &quot;$(EaglePauseForServerMilliseconds)&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign4)' != 'false' And
                     '$(EagleSignToolDir)' != '' And
                     HasTrailingSlash('$(EagleSignToolDir)') And
                     Exists('$(EagleSignToolDir)SignTool.exe') And
                     '$(SUBJECT_NAME)' != '' And
                     Exists('$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)')"
          Command="&quot;$(EagleSignToolDir)SignTool.exe&quot; sign /as /v /n &quot;$(SUBJECT_NAME)&quot; /d &quot;$(EagleProjectName)&quot; /du &quot;$(EagleProjectUrl)&quot; /fd sha512 /tr &quot;$(EagleRfcTimeStampUrl3)&quot; /td &quot;$(EagleRfcTimeStampAlgorithm3)&quot; &quot;$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign4)' != 'false' And
                     '$(EaglePauseForServer)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(SUBJECT_NAME)' != '' And
                     '$(EagleLibraryToolsDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryToolsDir)') And
                     Exists('$(EagleLibraryToolsDir)JustWait.exe') And
                     '$(EaglePauseForServerMilliseconds)' != '' And
                     Exists('$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)')"
          Command="&quot;$(EagleLibraryToolsDir)JustWait.exe&quot; &quot;$(EaglePauseForServerMilliseconds)&quot;" />

    <Exec Condition="'$(EagleSignToolDir)' != '' And
                     HasTrailingSlash('$(EagleSignToolDir)') And
                     Exists('$(EagleSignToolDir)SignTool.exe')"
          Command="&quot;$(EagleSignToolDir)SignTool.exe&quot; verify /pa /all /v &quot;$(TargetPath)&quot;" />

    <Exec Condition="'$(EagleSignToolDir)' != '' And
                     HasTrailingSlash('$(EagleSignToolDir)') And
                     Exists('$(EagleSignToolDir)SignTool.exe') And
                     Exists('$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)')"
          Command="&quot;$(EagleSignToolDir)SignTool.exe&quot; verify /pa /all /v &quot;$(OutputPath)Unobfuscated\$(TargetName)$(TargetExt)&quot;" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).AuthenticodeSign.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleStrongNameSign32BitOnly"
          Condition="'$(EagleStrongNameSign32BitOnly)' != 'false' And
                     ('$(OutputType)' == 'Exe' Or
                      '$(OutputType)' == 'WinExe') And
                     '$(BuildTool)' == 'MSBuild' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(SignAssembly)' != 'false' And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)') And
                     Exists('$(OutputPath)$(TargetName)32.exe') And
                     Exists('$(AssemblyOriginatorKeyFile)') And
                     Exists('$(EaglePrivateKeyFile)')"
          Inputs="$(OutputPath)$(TargetName)32.exe"
          Outputs="$(OutputPath)$(TargetName)32.exe.StrongNameSign32BitOnly.done">
    <!--
        HACK: *BROKEN* The GetFrameworkSDKPath MSBuild task was broken by the
              Visual Studio 2012 / .NET Framework 4.5 RTM release.  It now
              incorrectly returns the Windows SDK path, not the .NET Framework
              SDK path.  When Visual Studio 2012 is installed, it also breaks
              the Visual Studio 2010 / .NET Framework 4.0 build environment as
              well.  The "supported", yet sub-optimal, alternative appears to
              be using the TargetFrameworkSDKToolsDirectory variable.
    -->
    <GetFrameworkSDKPath Condition="('$(StrongNameWithoutSdk)' == '' Or
                                     '$(StrongNameWithoutSdk)' == 'false') And
                                    '$(TargetFrameworkSDKToolsDirectory)' == ''">
      <Output TaskParameter="Path"
              PropertyName="DirForStrongName" />
    </GetFrameworkSDKPath>

    <Exec Condition="'$(StrongNameWithoutSdk)' != '' And
                     '$(StrongNameWithoutSdk)' != 'false'"
          Command="sn.exe -Ra &quot;$(OutputPath)$(TargetName)32.exe&quot; &quot;$(EaglePrivateKeyFile)&quot;" />

    <Exec Condition="('$(StrongNameWithoutSdk)' == '' Or
                      '$(StrongNameWithoutSdk)' == 'false') And
                     '$(OverrideDirForStrongName)' != '' And
                     HasTrailingSlash('$(OverrideDirForStrongName)') And
                     Exists('$(OverrideDirForStrongName)sn.exe')"
          Command="&quot;$(OverrideDirForStrongName)sn.exe&quot; -Ra &quot;$(OutputPath)$(TargetName)32.exe&quot; &quot;$(EaglePrivateKeyFile)&quot;" />

    <Exec Condition="('$(StrongNameWithoutSdk)' == '' Or
                      '$(StrongNameWithoutSdk)' == 'false') And
                     '$(TargetFrameworkSDKToolsDirectory)' == '' And
                     '$(OverrideDirForStrongName)' == '' And
                     '$(DirForStrongName)' != '' And
                     HasTrailingSlash('$(DirForStrongName)') And
                     Exists('$(DirForStrongName)bin\sn.exe')"
          Command="&quot;$(DirForStrongName)bin\sn.exe&quot; -Ra &quot;$(OutputPath)$(TargetName)32.exe&quot; &quot;$(EaglePrivateKeyFile)&quot;" />

    <Exec Condition="('$(StrongNameWithoutSdk)' == '' Or
                      '$(StrongNameWithoutSdk)' == 'false') And
                     '$(TargetFrameworkSDKToolsDirectory)' != '' And
                     '$(OverrideDirForStrongName)' == '' And
                     '$(DirForStrongName)' == '' And
                     HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And
                     Exists('$(TargetFrameworkSDKToolsDirectory)sn.exe')"
          Command="&quot;$(TargetFrameworkSDKToolsDirectory)sn.exe&quot; -Ra &quot;$(OutputPath)$(TargetName)32.exe&quot; &quot;$(EaglePrivateKeyFile)&quot;" />

    <Touch AlwaysCreate="true"
           Files="$(OutputPath)$(TargetName)32.exe.StrongNameSign32BitOnly.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleAuthenticodeSign32BitOnly"
          Condition="'$(EagleAuthenticodeSign32BitOnly)' != 'false' And
                     ('$(OutputType)' == 'Exe' Or
                      '$(OutputType)' == 'WinExe') And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)') And
                     Exists('$(OutputPath)$(TargetName)32.exe')"
          Inputs="$(OutputPath)$(TargetName)32.exe"
          Outputs="$(OutputPath)$(TargetName)32.exe.AuthenticodeSign32BitOnly.done">
    <Exec Condition="'$(EagleAuthenticodeSign1)' != 'false' And
                     '$(EagleSignCodeDir)' != '' And
                     HasTrailingSlash('$(EagleSignCodeDir)') And
                     Exists('$(EagleSignCodeDir)SignCode.exe') And
                     Exists('$(SPC_FILE)') And
                     Exists('$(PVK_FILE)')"
          Command="&quot;$(EagleSignCodeDir)SignCode.exe&quot; -spc &quot;$(SPC_FILE)&quot; -v &quot;$(PVK_FILE)&quot; -n &quot;$(EagleProjectName)&quot; -i &quot;$(EagleProjectUrl)&quot; -a sha1 -t &quot;$(EagleTimeStampUrl)&quot; -tr &quot;$(EagleTimeStampRetries)&quot; -tw &quot;$(EagleTimeStampWait)&quot; &quot;$(OutputPath)$(TargetName)32.exe&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign1)' != 'false' And
                     '$(EaglePauseForServer)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     Exists('$(SPC_FILE)') And
                     Exists('$(PVK_FILE)') And
                     '$(EagleLibraryToolsDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryToolsDir)') And
                     Exists('$(EagleLibraryToolsDir)JustWait.exe') And
                     '$(EaglePauseForServerMilliseconds)' != ''"
          Command="&quot;$(EagleLibraryToolsDir)JustWait.exe&quot; &quot;$(EaglePauseForServerMilliseconds)&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign2)' != 'false' And
                     '$(EagleSignToolDir)' != '' And
                     HasTrailingSlash('$(EagleSignToolDir)') And
                     Exists('$(EagleSignToolDir)SignTool.exe') And
                     Exists('$(PFX_FILE)') And
                     '$(PFX_PASSWORD)' != ''"
          Command="&quot;$(EagleSignToolDir)SignTool.exe&quot; sign /as /v /f &quot;$(PFX_FILE)&quot; /p &quot;$(PFX_PASSWORD)&quot; /d &quot;$(EagleProjectName)&quot; /du &quot;$(EagleProjectUrl)&quot; /fd sha512 /tr &quot;$(EagleRfcTimeStampUrl1)&quot; /td &quot;$(EagleRfcTimeStampAlgorithm1)&quot; &quot;$(OutputPath)$(TargetName)32.exe&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign2)' != 'false' And
                     '$(EaglePauseForServer)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     Exists('$(PFX_FILE)') And
                     '$(PFX_PASSWORD)' != '' And
                     '$(EagleLibraryToolsDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryToolsDir)') And
                     Exists('$(EagleLibraryToolsDir)JustWait.exe') And
                     '$(EaglePauseForServerMilliseconds)' != ''"
          Command="&quot;$(EagleLibraryToolsDir)JustWait.exe&quot; &quot;$(EaglePauseForServerMilliseconds)&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign3)' != 'false' And
                     '$(EagleSignToolDir)' != '' And
                     HasTrailingSlash('$(EagleSignToolDir)') And
                     Exists('$(EagleSignToolDir)SignTool.exe') And
                     '$(SUBJECT_NAME)' != ''"
          Command="&quot;$(EagleSignToolDir)SignTool.exe&quot; sign /as /v /n &quot;$(SUBJECT_NAME)&quot; /d &quot;$(EagleProjectName)&quot; /du &quot;$(EagleProjectUrl)&quot; /fd sha1 /tr &quot;$(EagleRfcTimeStampUrl2)&quot; /td &quot;$(EagleRfcTimeStampAlgorithm2)&quot; &quot;$(OutputPath)$(TargetName)32.exe&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign3)' != 'false' And
                     '$(EaglePauseForServer)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(SUBJECT_NAME)' != '' And
                     '$(EagleLibraryToolsDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryToolsDir)') And
                     Exists('$(EagleLibraryToolsDir)JustWait.exe') And
                     '$(EaglePauseForServerMilliseconds)' != ''"
          Command="&quot;$(EagleLibraryToolsDir)JustWait.exe&quot; &quot;$(EaglePauseForServerMilliseconds)&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign4)' != 'false' And
                     '$(EagleSignToolDir)' != '' And
                     HasTrailingSlash('$(EagleSignToolDir)') And
                     Exists('$(EagleSignToolDir)SignTool.exe') And
                     '$(SUBJECT_NAME)' != ''"
          Command="&quot;$(EagleSignToolDir)SignTool.exe&quot; sign /as /v /n &quot;$(SUBJECT_NAME)&quot; /d &quot;$(EagleProjectName)&quot; /du &quot;$(EagleProjectUrl)&quot; /fd sha512 /tr &quot;$(EagleRfcTimeStampUrl3)&quot; /td &quot;$(EagleRfcTimeStampAlgorithm3)&quot; &quot;$(OutputPath)$(TargetName)32.exe&quot;" />

    <Exec Condition="'$(EagleAuthenticodeSign4)' != 'false' And
                     '$(EaglePauseForServer)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(SUBJECT_NAME)' != '' And
                     '$(EagleLibraryToolsDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryToolsDir)') And
                     Exists('$(EagleLibraryToolsDir)JustWait.exe') And
                     '$(EaglePauseForServerMilliseconds)' != ''"
          Command="&quot;$(EagleLibraryToolsDir)JustWait.exe&quot; &quot;$(EaglePauseForServerMilliseconds)&quot;" />

    <Exec Condition="'$(EagleSignToolDir)' != '' And
                     HasTrailingSlash('$(EagleSignToolDir)') And
                     Exists('$(EagleSignToolDir)SignTool.exe')"
          Command="&quot;$(EagleSignToolDir)SignTool.exe&quot; verify /pa /all /v &quot;$(OutputPath)$(TargetName)32.exe&quot;" />

    <Touch AlwaysCreate="true"
           Files="$(OutputPath)$(TargetName)32.exe.AuthenticodeSign32BitOnly.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleCleanShellExe"
          Condition="'$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)es.exe')">
    <Delete Files="$(OutputPath)es.exe" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleCleanPackage"
          Condition="'$(EaglePackageOutputPath)' != '' And
                     HasTrailingSlash('$(EaglePackageOutputPath)') And
                     Exists('$(EaglePackageOutputPath)')">
    <CreateItem Include="$(EaglePackageOutputPath)**">
      <Output ItemName="EagleCleanPackageItem" TaskParameter="Include" />
    </CreateItem>

    <Delete Condition="'@(EagleCleanPackageItem)' != ''"
            Files="@(EagleCleanPackageItem)" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleCleanTasks"
          Condition="'$(EagleBinaryOutputPath)' != '' And
                     HasTrailingSlash('$(EagleBinaryOutputPath)') And
                     Exists('$(EagleBinaryOutputPath)')">
    <CreateItem Include="$(EagleBinaryOutputPath)*.tasks">
      <Output ItemName="EagleCleanTasksItem" TaskParameter="Include" />
    </CreateItem>

    <Delete Condition="'@(EagleCleanTasksItem)' != ''"
            Files="@(EagleCleanTasksItem)" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleCleanWebConfigurations"
          Condition="'$(MSBuildProjectDirectory)' != '' And
                     !HasTrailingSlash('$(MSBuildProjectDirectory)')">
    <CreateItem Include="$(MSBuildProjectDirectory)\*.config">
      <Output ItemName="EagleCleanWebConfigurationsItem" TaskParameter="Include" />
    </CreateItem>

    <Delete Condition="'@(EagleCleanWebConfigurationsItem)' != ''"
            Files="@(EagleCleanWebConfigurationsItem)"
            ContinueOnError="true" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleCleanBuildTasks"
          Condition="'$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)') And
                     Exists('$(OutputPath)BuildTasks')">
    <CreateItem Include="$(OutputPath)BuildTasks\$(TargetFileName);$(OutputPath)BuildTasks\*.tasks">
      <Output ItemName="EagleCleanBuildTasksItem" TaskParameter="Include" />
    </CreateItem>

    <Delete Condition="'@(EagleCleanBuildTasksItem)' != ''"
            Files="@(EagleCleanBuildTasksItem)"
            ContinueOnError="true" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleCopyBuildTasks"
          Condition="'$(EagleCopyBuildTasks)' != 'false' And
                     '$(EagleDir)' != '' And
                     '$(OutputPath)' != '' And
                     !HasTrailingSlash('$(EagleDir)') And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(EagleDir)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyBuildTasks.done">
    <CreateItem Include="$(EagleDir)\Targets\*.tasks">
      <Output ItemName="EagleCopyBuildTasksItem" TaskParameter="Include" />
    </CreateItem>

    <Copy SourceFiles="@(EagleCopyBuildTasksItem)"
          DestinationFolder="$(OutputPath)" />

    <Copy SourceFiles="@(EagleCopyBuildTasksItem)"
          DestinationFolder="$(OutputPath)BuildTasks" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyBuildTasks.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleCopyToBuildTasks"
          Condition="'$(EagleCopyToBuildTasks)' != 'false' And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyToBuildTasks.done">
    <Copy SourceFiles="$(TargetPath)"
          DestinationFolder="$(OutputPath)BuildTasks"
          ContinueOnError="true" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyToBuildTasks.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <!--
      HACK: If we want to actually have the .NET Core shell executable be
            runnable, the core library must be in its output directory as
            well.
  -->
  <Target Name="EagleCopyToNetCoreApp20"
          Condition="'$(EagleCopyToNetCoreApp20)' != 'false' And
                     ('$(TargetFramework)' == 'netstandard2.0' Or
                      '$(TargetFramework)' == 'netcoreapp2.0' Or
                      '$(TargetFramework)' == 'netcoreapp2.1' Or
                      '$(TargetFramework)' == 'netcoreapp2.2') And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyToNetCoreApp20.done">
    <Copy SourceFiles="$(TargetPath)"
          DestinationFolder="$(OutputPath)..\netcoreapp2.0"
          ContinueOnError="true" />

    <Copy SourceFiles="$(OutputPath)$(TargetName).pdb"
          DestinationFiles="$(OutputPath)..\netcoreapp2.0\$(TargetName).pdb"
          ContinueOnError="true"
          Condition="'$(_DebugSymbolsProduced)' == 'true'" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyToNetCoreApp20.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <!--
      HACK: If we want to actually have the .NET Core shell executable be
            runnable, the core library must be in its output directory as
            well.
  -->
  <Target Name="EagleCopyToNetCoreApp21"
          Condition="'$(EagleCopyToNetCoreApp21)' != 'false' And
                     ('$(TargetFramework)' == 'netstandard2.0' Or
                      '$(TargetFramework)' == 'netcoreapp2.0' Or
                      '$(TargetFramework)' == 'netcoreapp2.1' Or
                      '$(TargetFramework)' == 'netcoreapp2.2') And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyToNetCoreApp21.done">
    <Copy SourceFiles="$(TargetPath)"
          DestinationFolder="$(OutputPath)..\netcoreapp2.1"
          ContinueOnError="true" />

    <Copy SourceFiles="$(OutputPath)$(TargetName).pdb"
          DestinationFiles="$(OutputPath)..\netcoreapp2.1\$(TargetName).pdb"
          ContinueOnError="true"
          Condition="'$(_DebugSymbolsProduced)' == 'true'" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyToNetCoreApp21.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <!--
      HACK: If we want to actually have the .NET Core shell executable be
            runnable, the core library must be in its output directory as
            well.
  -->
  <Target Name="EagleCopyToNetCoreApp22"
          Condition="'$(EagleCopyToNetCoreApp22)' != 'false' And
                     ('$(TargetFramework)' == 'netstandard2.0' Or
                      '$(TargetFramework)' == 'netcoreapp2.0' Or
                      '$(TargetFramework)' == 'netcoreapp2.1' Or
                      '$(TargetFramework)' == 'netcoreapp2.2') And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyToNetCoreApp22.done">
    <Copy SourceFiles="$(TargetPath)"
          DestinationFolder="$(OutputPath)..\netcoreapp2.2"
          ContinueOnError="true" />

    <Copy SourceFiles="$(OutputPath)$(TargetName).pdb"
          DestinationFiles="$(OutputPath)..\netcoreapp2.2\$(TargetName).pdb"
          ContinueOnError="true"
          Condition="'$(_DebugSymbolsProduced)' == 'true'" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyToNetCoreApp22.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <!--
      HACK: If we want to actually have the .NET Core shell executable be
            runnable, the core library must be in its output directory as
            well.
  -->
  <Target Name="EagleCopyToNetCoreApp30"
          Condition="'$(EagleCopyToNetCoreApp30)' != 'false' And
                     ('$(TargetFramework)' == 'netstandard2.1' Or
                      '$(TargetFramework)' == 'netcoreapp3.0' Or
                      '$(TargetFramework)' == 'netcoreapp3.1') And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyToNetCoreApp30.done">
    <Copy SourceFiles="$(TargetPath)"
          DestinationFolder="$(OutputPath)..\netcoreapp3.0"
          ContinueOnError="true" />

    <Copy SourceFiles="$(OutputPath)$(TargetName).pdb"
          DestinationFiles="$(OutputPath)..\netcoreapp3.0\$(TargetName).pdb"
          ContinueOnError="true"
          Condition="'$(_DebugSymbolsProduced)' == 'true'" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyToNetCoreApp30.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <!--
      HACK: If we want to actually have the .NET Core shell executable be
            runnable, the core library must be in its output directory as
            well.
  -->
  <Target Name="EagleCopyToNetCoreApp31"
          Condition="'$(EagleCopyToNetCoreApp31)' != 'false' And
                     ('$(TargetFramework)' == 'netstandard2.1' Or
                      '$(TargetFramework)' == 'netcoreapp3.0' Or
                      '$(TargetFramework)' == 'netcoreapp3.1') And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyToNetCoreApp31.done">
    <Copy SourceFiles="$(TargetPath)"
          DestinationFolder="$(OutputPath)..\netcoreapp3.1"
          ContinueOnError="true" />

    <Copy SourceFiles="$(OutputPath)$(TargetName).pdb"
          DestinationFiles="$(OutputPath)..\netcoreapp3.1\$(TargetName).pdb"
          ContinueOnError="true"
          Condition="'$(_DebugSymbolsProduced)' == 'true'" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyToNetCoreApp31.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleCopyResourcePngs"
          Condition="'$(EagleCopyResourcePngs)' != 'false' And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyResourcePngs.done">
    <CreateItem Include="Resources\*.png" Exclude="Resources\no_*">
      <Output ItemName="EagleCopyResourcePngsItem" TaskParameter="Include" />
    </CreateItem>

    <Copy SourceFiles="@(EagleCopyResourcePngsItem)"
          DestinationFolder="$(OutputPath)" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyResourcePngs.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleCopyShellExe"
          Condition="'$(EagleCopyShellExe)' != 'false' And
                     ('$(OutputType)' == 'Exe' Or
                      '$(OutputType)' == 'WinExe') And
                     '$(TargetPath)' != '' And
                     !HasTrailingSlash('$(TargetPath)') And
                     Exists('$(TargetPath)') And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyShellExe.done">
    <Copy SourceFiles="$(TargetPath)"
          DestinationFiles="$(OutputPath)es.exe" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyShellExe.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleCopySQLite3"
          Condition="'$(EagleCopySQLite3)' != 'false' And
                     '$(EagleDir)' != '' And
                     !HasTrailingSlash('$(EagleDir)') And
                     '$(EagleBinaryOutputPath)' != '' And
                     HasTrailingSlash('$(EagleBinaryOutputPath)') And
                     Exists('$(EagleBinaryOutputPath)') And
                     Exists('$(EagleDir)\Externals\sqlite3\x86') And
                     Exists('$(EagleDir)\Externals\sqlite3\x64')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopySQLite3.done">
    <CreateItem Include="$(EagleDir)\Externals\sqlite3\x86\*">
      <Output ItemName="EagleCopySQLite3X86Item" TaskParameter="Include" />
    </CreateItem>

    <CreateItem Include="$(EagleDir)\Externals\sqlite3\x64\*">
      <Output ItemName="EagleCopySQLite3X64Item" TaskParameter="Include" />
    </CreateItem>

    <Copy Condition="'$(BuildTool)' != 'DotNetCore'"
          SourceFiles="@(EagleCopySQLite3X86Item)"
          DestinationFolder="$(EagleBinaryOutputPath)x86" />

    <Copy Condition="'$(BuildTool)' != 'DotNetCore'"
          SourceFiles="@(EagleCopySQLite3X64Item)"
          DestinationFolder="$(EagleBinaryOutputPath)x64" />

    <Copy Condition="'$(BuildTool)' == 'DotNetCore' And
                     Exists('$(EagleBinaryOutputPath)netcoreapp2.0')"
          SourceFiles="@(EagleCopySQLite3X86Item)"
          DestinationFolder="$(EagleBinaryOutputPath)netcoreapp2.0\x86" />

    <Copy Condition="'$(BuildTool)' == 'DotNetCore' And
                     Exists('$(EagleBinaryOutputPath)netcoreapp2.0')"
          SourceFiles="@(EagleCopySQLite3X64Item)"
          DestinationFolder="$(EagleBinaryOutputPath)netcoreapp2.0\x64" />

    <Copy Condition="'$(BuildTool)' == 'DotNetCore' And
                     Exists('$(EagleBinaryOutputPath)netcoreapp2.1')"
          SourceFiles="@(EagleCopySQLite3X86Item)"
          DestinationFolder="$(EagleBinaryOutputPath)netcoreapp2.1\x86" />

    <Copy Condition="'$(BuildTool)' == 'DotNetCore' And
                     Exists('$(EagleBinaryOutputPath)netcoreapp2.1')"
          SourceFiles="@(EagleCopySQLite3X64Item)"
          DestinationFolder="$(EagleBinaryOutputPath)netcoreapp2.1\x64" />

    <Copy Condition="'$(BuildTool)' == 'DotNetCore' And
                     Exists('$(EagleBinaryOutputPath)netcoreapp2.2')"
          SourceFiles="@(EagleCopySQLite3X86Item)"
          DestinationFolder="$(EagleBinaryOutputPath)netcoreapp2.2\x86" />

    <Copy Condition="'$(BuildTool)' == 'DotNetCore' And
                     Exists('$(EagleBinaryOutputPath)netcoreapp2.2')"
          SourceFiles="@(EagleCopySQLite3X64Item)"
          DestinationFolder="$(EagleBinaryOutputPath)netcoreapp2.2\x64" />

    <Copy Condition="'$(BuildTool)' == 'DotNetCore' And
                     Exists('$(EagleBinaryOutputPath)netcoreapp3.0')"
          SourceFiles="@(EagleCopySQLite3X86Item)"
          DestinationFolder="$(EagleBinaryOutputPath)netcoreapp3.0\x86" />

    <Copy Condition="'$(BuildTool)' == 'DotNetCore' And
                     Exists('$(EagleBinaryOutputPath)netcoreapp3.0')"
          SourceFiles="@(EagleCopySQLite3X64Item)"
          DestinationFolder="$(EagleBinaryOutputPath)netcoreapp3.0\x64" />

    <Copy Condition="'$(BuildTool)' == 'DotNetCore' And
                     Exists('$(EagleBinaryOutputPath)netcoreapp3.1')"
          SourceFiles="@(EagleCopySQLite3X86Item)"
          DestinationFolder="$(EagleBinaryOutputPath)netcoreapp3.1\x86" />

    <Copy Condition="'$(BuildTool)' == 'DotNetCore' And
                     Exists('$(EagleBinaryOutputPath)netcoreapp3.1')"
          SourceFiles="@(EagleCopySQLite3X64Item)"
          DestinationFolder="$(EagleBinaryOutputPath)netcoreapp3.1\x64" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopySQLite3.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleCopySystemDataSQLite"
          Condition="'$(EagleCopySystemDataSQLite)' != 'false' And
                     '$(EagleBinaryOutputPath)' != '' And
                     HasTrailingSlash('$(EagleBinaryOutputPath)') And
                     Exists('$(EagleBinaryOutputPath)') And
                     Exists('$(EagleDir)\Externals\System.Data.SQLite')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopySystemDataSQLite.done">
    <CreateItem Include="$(EagleDir)\Externals\System.Data.SQLite\netFramework20\*">
      <Output ItemName="EagleCopySystemDataSQLiteItem1" TaskParameter="Include" />
    </CreateItem>

    <CreateItem Include="$(EagleDir)\Externals\System.Data.SQLite\netFramework40\*">
      <Output ItemName="EagleCopySystemDataSQLiteItem2" TaskParameter="Include" />
    </CreateItem>

    <CreateItem Include="$(EagleDir)\Externals\System.Data.SQLite\netStandard20\*">
      <Output ItemName="EagleCopySystemDataSQLiteItem3" TaskParameter="Include" />
    </CreateItem>

    <CreateItem Include="$(EagleDir)\Externals\System.Data.SQLite\netStandard21\*">
      <Output ItemName="EagleCopySystemDataSQLiteItem4" TaskParameter="Include" />
    </CreateItem>

    <Copy Condition="'$(BuildTool)' != 'DotNetCore' And
                     ((('$(MSBuildToolsVersion)' == '' Or
                        '$(MSBuildToolsVersion)' == '2.0' Or
                        '$(MSBuildToolsVersion)' == '3.5') And
                       '$(TargetFrameworkVersion)' == '') Or
                      '$(TargetFrameworkVersion)' == 'v2.0' Or
                      '$(TargetFrameworkVersion)' == 'v3.5')"
          SourceFiles="@(EagleCopySystemDataSQLiteItem1)"
          DestinationFolder="$(EagleBinaryOutputPath)" />

    <Copy Condition="'$(BuildTool)' != 'DotNetCore' And
                     ((('$(MSBuildToolsVersion)' == '4.0' Or
                        '$(MSBuildToolsVersion)' == '12.0' Or
                        '$(MSBuildToolsVersion)' == '14.0' Or
                        '$(MSBuildToolsVersion)' == '15.0' Or
                        '$(MSBuildToolsVersion)' == 'Current') And
                       '$(TargetFrameworkVersion)' == '') Or
                      '$(TargetFrameworkVersion)' == 'v4.0' Or
                      '$(TargetFrameworkVersion)' == 'v4.5' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.6' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.7' Or
                      '$(TargetFrameworkVersion)' == 'v4.7.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.7.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.8' Or
                      '$(TargetFrameworkVersion)' == 'v4.8.1')"
          SourceFiles="@(EagleCopySystemDataSQLiteItem2)"
          DestinationFolder="$(EagleBinaryOutputPath)" />

    <Copy Condition="'$(BuildTool)' == 'DotNetCore' And
                     Exists('$(EagleBinaryOutputPath)netcoreapp2.0')"
          SourceFiles="@(EagleCopySystemDataSQLiteItem3)"
          DestinationFolder="$(EagleBinaryOutputPath)netcoreapp2.0" />

    <Copy Condition="'$(BuildTool)' == 'DotNetCore' And
                     Exists('$(EagleBinaryOutputPath)netcoreapp2.1')"
          SourceFiles="@(EagleCopySystemDataSQLiteItem3)"
          DestinationFolder="$(EagleBinaryOutputPath)netcoreapp2.1" />

    <Copy Condition="'$(BuildTool)' == 'DotNetCore' And
                     Exists('$(EagleBinaryOutputPath)netcoreapp2.2')"
          SourceFiles="@(EagleCopySystemDataSQLiteItem3)"
          DestinationFolder="$(EagleBinaryOutputPath)netcoreapp2.2" />

    <Copy Condition="'$(BuildTool)' == 'DotNetCore' And
                     Exists('$(EagleBinaryOutputPath)netcoreapp3.0')"
          SourceFiles="@(EagleCopySystemDataSQLiteItem4)"
          DestinationFolder="$(EagleBinaryOutputPath)netcoreapp3.0" />

    <Copy Condition="'$(BuildTool)' == 'DotNetCore' And
                     Exists('$(EagleBinaryOutputPath)netcoreapp3.1')"
          SourceFiles="@(EagleCopySystemDataSQLiteItem4)"
          DestinationFolder="$(EagleBinaryOutputPath)netcoreapp3.1" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopySystemDataSQLite.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleCopyWebConfigurations"
          Condition="'$(EagleCopyWebConfigurations)' != 'false' And
                     '$(MSBuildProjectDirectory)' != '' And
                     !HasTrailingSlash('$(MSBuildProjectDirectory)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyWebConfigurations.done">
    <!--
        HACK: Apparently, Visual Studio cannot cope with the "Web.config" file
              not being directly in the project directory; therefore, copy it
              there now.
    -->
    <CreateItem Include="Configurations\*.config" Exclude="Configurations\no_*">
      <Output ItemName="EagleCopyWebConfigurationsItem" TaskParameter="Include" />
    </CreateItem>

    <Copy SourceFiles="@(EagleCopyWebConfigurationsItem)"
          DestinationFolder="$(MSBuildProjectDirectory)" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyWebConfigurations.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectUserBuilds"
          Condition="'$(EagleDetectUserBuilds)' != 'false' And
                     '$(EagleUserBuilds)' != ''">
    <Warning Text="One or more user build overrides may be in effect." />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleDetectUserSettings"
          Condition="'$(EagleDetectUserSettings)' != 'false' And
                     '$(EagleUserSettings)' != ''">
    <Warning Text="One or more user setting overrides may be in effect." />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="MissingShell"
          Condition="'$(ProjectName)' != ''">
    <Warning Text="Shell support is disabled, skipping project &quot;$(ProjectName)&quot;..." />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="MissingConsole"
          Condition="'$(ProjectName)' != ''">
    <Warning Text="Console support is disabled, skipping project &quot;$(ProjectName)&quot;..." />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="MissingXml"
          Condition="'$(ProjectName)' != ''">
    <Warning Text="The &quot;System.Xml&quot; assembly is disabled, skipping project &quot;$(ProjectName)&quot;..." />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="MissingSerialization"
          Condition="'$(ProjectName)' != ''">
    <Warning Text="The &quot;System.Xml.Serialization&quot; assembly is disabled, skipping project &quot;$(ProjectName)&quot;..." />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="MissingNativeCodeAndOrTclIntegration"
          Condition="'$(ProjectName)' != ''">
    <Warning Text="Native code and/or Tcl integration are disabled, skipping project &quot;$(ProjectName)&quot;..." />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="MissingWinForms"
          Condition="'$(ProjectName)' != ''">
    <Warning Text="WinForms support is disabled, skipping project &quot;$(ProjectName)&quot;..." />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="MissingSystemManagementAutomation"
          Condition="'$(ProjectName)' != ''">
    <Warning Text="The &quot;System.Management.Automation&quot; assembly could not be located, skipping project &quot;$(ProjectName)&quot;..." />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="MissingWebApplicationProjects"
          Condition="'$(ProjectName)' != ''">
    <Warning Text="The &quot;Microsoft.WebApplication.targets&quot; file could not be located, skipping project &quot;$(ProjectName)&quot;..." />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="MissingWix"
          Condition="'$(ProjectName)' != ''">
    <Warning Text="The &quot;WiX&quot; and/or &quot;Microsoft.Deployment.WindowsInstaller&quot; assemblies could not be located, skipping project &quot;$(ProjectName)&quot;..." />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="MissingWox"
          Condition="'$(ProjectName)' != ''">
    <Warning Text="The &quot;Wox&quot; assemblies could not be located, skipping project &quot;$(ProjectName)&quot;..." />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="ProjectBuildOutputIsLocked"
          Condition="'$(ProjectName)' != ''">
    <CreateProperty Value="true">
      <Output TaskParameter="Value" PropertyName="SkipCopyToOutputDirectory" />
    </CreateProperty>

    <Warning Text="The project &quot;$(ProjectName)&quot; build output is locked, skipping..." />
  </Target>

  <!--
  ******************************************************************************
  **                      Eagle Library Specific Targets                      **
  ******************************************************************************
  -->

  <Target Name="EagleMsgGenUnsetReadOnly"
          Condition="'$(EagleMsgGen)' != 'false' And
                     '$(EagleUnsetReadOnly)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(SystemRoot)' != '' And
                     !HasTrailingSlash('$(SystemRoot)') And
                     Exists('$(SystemRoot)\System32\attrib.exe')"
          Inputs="Messages\messages.xml"
          Outputs="Generated\messages.cs;Generated\messages.resources">
    <Exec Condition="Exists('Generated\messages.cs')"
          Command="&quot;$(SystemRoot)\System32\attrib.exe&quot; -r Generated\messages.cs" />

    <Exec Condition="Exists('Generated\messages.resources')"
          Command="&quot;$(SystemRoot)\System32\attrib.exe&quot; -r Generated\messages.resources" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleMessagesResGenUnsetReadOnly"
          Condition="('$(EagleMessagesResGen)' != 'false' Or
                      '$(EagleMessagesResGenExternals)' != 'false' Or
                      '$(EagleMessagesResGenForNetStandard2X)' != 'false') And
                     '$(EagleUnsetReadOnly)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(SystemRoot)' != '' And
                     !HasTrailingSlash('$(SystemRoot)') And
                     Exists('$(SystemRoot)\System32\attrib.exe')"
          Inputs="Resources\messages.resx"
          Outputs="Resources\messages.resources">
    <Exec Condition="Exists('Resources\messages.resources')"
          Command="&quot;$(SystemRoot)\System32\attrib.exe&quot; -r Resources\messages.resources" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: *WARNING* Be sure to update the "Inputs" attribute for the targets
            EagleLibraryResGen* in this file and the list of files in the file
            "Library\Resources\library.resx" if any files are added to the core
            script library.
  -->
  <Target Name="EagleLibraryResourceFiles">
    <CreateItem Include="..\lib\Eagle1.0\auxiliary.eagle;
                         ..\lib\Eagle1.0\compat.eagle;
                         ..\lib\Eagle1.0\csharp.eagle;
                         ..\lib\Eagle1.0\database.eagle;
                         ..\lib\Eagle1.0\exec.eagle;
                         ..\lib\Eagle1.0\file1.eagle;
                         ..\lib\Eagle1.0\file2.eagle;
                         ..\lib\Eagle1.0\file2u.eagle;
                         ..\lib\Eagle1.0\file3.eagle;
                         ..\lib\Eagle1.0\info.eagle;
                         ..\lib\Eagle1.0\list.eagle;
                         ..\lib\Eagle1.0\object.eagle;
                         ..\lib\Eagle1.0\pkgt.eagle;
                         ..\lib\Eagle1.0\platform.eagle;
                         ..\lib\Eagle1.0\process.eagle;
                         ..\lib\Eagle1.0\runopt.eagle;
                         ..\lib\Eagle1.0\shim.eagle;
                         ..\lib\Eagle1.0\testlog.eagle;
                         ..\lib\Eagle1.0\unkobj.eagle;
                         ..\lib\Eagle1.0\unzip.eagle;
                         ..\lib\Eagle1.0\update.eagle;
                         ..\lib\Eagle1.0\init.eagle;
                         ..\lib\Eagle1.0\embed.eagle;
                         ..\lib\Eagle1.0\safe.eagle;
                         ..\lib\Eagle1.0\shell.eagle;
                         ..\lib\Eagle1.0\test.eagle;
                         ..\lib\Eagle1.0\vendor.eagle;
                         ..\lib\Eagle1.0\word.tcl;
                         ..\lib\Eagle1.0\pkgIndex.eagle">
      <Output ItemName="LibraryResourceFilesItem" TaskParameter="Include" />
    </CreateItem>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleLibraryResGenUnsetReadOnly"
          Condition="('$(EagleLibraryResGen)' != 'false' Or
                      '$(EagleLibraryResGenExternals)' != 'false' Or
                      '$(EagleLibraryResGenForNetStandard2X)' != 'false') And
                     '$(EagleUnsetReadOnly)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleEmbeddedLibrary)' != 'false' And
                     '$(SystemRoot)' != '' And
                     !HasTrailingSlash('$(SystemRoot)') And
                     Exists('$(SystemRoot)\System32\attrib.exe')"
          Inputs="Resources\library.resx;@(LibraryResourceFilesItem)"
          Outputs="Resources\library.resources">
    <Exec Condition="Exists('Resources\library.resources')"
          Command="&quot;$(SystemRoot)\System32\attrib.exe&quot; -r Resources\library.resources" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: *WARNING* Be sure to update the "Inputs" attribute for the targets
            EaglePackagesResGen* in this file and the list of files in the file
            "Library\Resources\packages.resx" if any files are added to the core
            script packages.
  -->
  <Target Name="EaglePackagesResourceFiles">
    <CreateItem Include="..\lib\Test1.0\all.eagle;
                         ..\lib\Test1.0\constraints.eagle;
                         ..\lib\Test1.0\epilogue.eagle;
                         ..\lib\Test1.0\pkgIndex.eagle;
                         ..\lib\Test1.0\prologue.eagle">
      <Output ItemName="PackagesResourceFilesItem" TaskParameter="Include" />
    </CreateItem>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EaglePackagesResGenUnsetReadOnly"
          Condition="('$(EaglePackagesResGen)' != 'false' Or
                      '$(EaglePackagesResGenExternals)' != 'false' Or
                      '$(EaglePackagesResGenForNetStandard2X)' != 'false') And
                     '$(EagleUnsetReadOnly)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleEmbeddedLibrary)' != 'false' And
                     '$(SystemRoot)' != '' And
                     !HasTrailingSlash('$(SystemRoot)') And
                     Exists('$(SystemRoot)\System32\attrib.exe')"
          Inputs="Resources\packages.resx;@(PackagesResourceFilesItem)"
          Outputs="Resources\packages.resources">
    <Exec Condition="Exists('Resources\packages.resources')"
          Command="&quot;$(SystemRoot)\System32\attrib.exe&quot; -r Resources\packages.resources" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: *WARNING* Be sure to update the "Inputs" attribute for the targets
            EagleKitResGen* in this file and the list of files in the file
            "Kit\Resources\kit.resx" if any files are added to the core script
            packages.
  -->
  <Target Name="EagleKitResourceFiles">
    <CreateItem Include="..\lib\Kit1.0\pkgIndex.eagle;
                         ..\lib\Kit1.0\pkgIndex.eagle.harpy">
      <Output ItemName="KitResourceFilesItem" TaskParameter="Include" />
    </CreateItem>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleKitResGenUnsetReadOnly"
          Condition="('$(EagleKitResGen)' != 'false' Or
                      '$(EagleKitResGenExternals)' != 'false' Or
                      '$(EagleKitResGenForNetStandard2X)' != 'false') And
                     '$(EagleUnsetReadOnly)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleEmbeddedLibrary)' != 'false' And
                     '$(SystemRoot)' != '' And
                     !HasTrailingSlash('$(SystemRoot)') And
                     Exists('$(SystemRoot)\System32\attrib.exe')"
          Inputs="Resources\kit.resx;@(KitResourceFilesItem)"
          Outputs="Resources\kit.resources">
    <Exec Condition="Exists('Resources\kit.resources')"
          Command="&quot;$(SystemRoot)\System32\attrib.exe&quot; -r Resources\kit.resources" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleMsgGen"
          Condition="'$(EagleMsgGen)' != 'false' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleLibraryToolsDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryToolsDir)') And
                     Exists('$(EagleLibraryToolsDir)MsgGen.exe')"
          Inputs="Messages\messages.xml"
          Outputs="Generated\messages.cs;Generated\messages.resources">
    <MakeDir Directories="Generated" />

    <Exec Command="&quot;$(EagleLibraryToolsDir)MsgGen.exe&quot; Messages\messages.xml Generated\messages.cs Generated\messages.resources" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleMessagesResGen"
          Condition="'$(EagleMessagesResGen)' != 'false'"
          Inputs="Resources\messages.resx"
          Outputs="Resources\messages.resources">
    <GenerateResource Sources="Resources\messages.resx"
                      OutputResources="Resources\messages.resources" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleMessagesResGenExternals"
          Condition="'$(EagleMessagesResGen)' == 'false' And
                     '$(EagleMessagesResGenExternals)' != 'false' And
                     ((('$(MSBuildToolsVersion)' == '4.0' Or
                        '$(MSBuildToolsVersion)' == '12.0' Or
                        '$(MSBuildToolsVersion)' == '14.0' Or
                        '$(MSBuildToolsVersion)' == '15.0' Or
                        '$(MSBuildToolsVersion)' == 'Current') And
                       '$(TargetFrameworkVersion)' == '') Or
                      '$(TargetFrameworkVersion)' == 'v4.0' Or
                      '$(TargetFrameworkVersion)' == 'v4.5' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.6' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.7' Or
                      '$(TargetFrameworkVersion)' == 'v4.7.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.7.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.8' Or
                      '$(TargetFrameworkVersion)' == 'v4.8.1') And
                     '$(EagleDir)' != '' And
                     !HasTrailingSlash('$(EagleDir)') And
                     Exists('$(EagleDir)\Externals\NETFX\Tools\v4.0\ResGen.exe')"
          Inputs="Resources\messages.resx"
          Outputs="Resources\messages.resources">
    <GenerateResource Sources="Resources\messages.resx"
                      OutputResources="Resources\messages.resources"
                      SdkToolsPath="$(EagleDir)\Externals\NETFX\Tools\v4.0" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleLibraryResGen"
          Condition="'$(EagleLibraryResGen)' != 'false' And
                     '$(EagleEmbeddedLibrary)' != 'false'"
          Inputs="Resources\library.resx;@(LibraryResourceFilesItem)"
          Outputs="Resources\library.resources">
    <GenerateResource Sources="Resources\library.resx"
                      OutputResources="Resources\library.resources" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleLibraryResGenExternals"
          Condition="'$(EagleLibraryResGen)' == 'false' And
                     '$(EagleLibraryResGenExternals)' != 'false' And
                     '$(EagleEmbeddedLibrary)' != 'false' And
                     ((('$(MSBuildToolsVersion)' == '4.0' Or
                        '$(MSBuildToolsVersion)' == '12.0' Or
                        '$(MSBuildToolsVersion)' == '14.0' Or
                        '$(MSBuildToolsVersion)' == '15.0' Or
                        '$(MSBuildToolsVersion)' == 'Current') And
                       '$(TargetFrameworkVersion)' == '') Or
                      '$(TargetFrameworkVersion)' == 'v4.0' Or
                      '$(TargetFrameworkVersion)' == 'v4.5' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.6' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.7' Or
                      '$(TargetFrameworkVersion)' == 'v4.7.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.7.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.8' Or
                      '$(TargetFrameworkVersion)' == 'v4.8.1') And
                     '$(EagleDir)' != '' And
                     !HasTrailingSlash('$(EagleDir)') And
                     Exists('$(EagleDir)\Externals\NETFX\Tools\v4.0\ResGen.exe')"
          Inputs="Resources\library.resx;@(LibraryResourceFilesItem)"
          Outputs="Resources\library.resources">
    <GenerateResource Sources="Resources\library.resx"
                      OutputResources="Resources\library.resources"
                      SdkToolsPath="$(EagleDir)\Externals\NETFX\Tools\v4.0" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EaglePackagesResGen"
          Condition="'$(EaglePackagesResGen)' != 'false' And
                     '$(EagleEmbeddedLibrary)' != 'false'"
          Inputs="Resources\packages.resx;@(PackagesResourceFilesItem)"
          Outputs="Resources\packages.resources">
    <GenerateResource Sources="Resources\packages.resx"
                      OutputResources="Resources\packages.resources" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EaglePackagesResGenExternals"
          Condition="'$(EaglePackagesResGen)' == 'false' And
                     '$(EaglePackagesResGenExternals)' != 'false' And
                     '$(EagleEmbeddedLibrary)' != 'false' And
                     ((('$(MSBuildToolsVersion)' == '4.0' Or
                        '$(MSBuildToolsVersion)' == '12.0' Or
                        '$(MSBuildToolsVersion)' == '14.0' Or
                        '$(MSBuildToolsVersion)' == '15.0' Or
                        '$(MSBuildToolsVersion)' == 'Current') And
                       '$(TargetFrameworkVersion)' == '') Or
                      '$(TargetFrameworkVersion)' == 'v4.0' Or
                      '$(TargetFrameworkVersion)' == 'v4.5' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.6' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.7' Or
                      '$(TargetFrameworkVersion)' == 'v4.7.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.7.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.8' Or
                      '$(TargetFrameworkVersion)' == 'v4.8.1') And
                     '$(EagleDir)' != '' And
                     !HasTrailingSlash('$(EagleDir)') And
                     Exists('$(EagleDir)\Externals\NETFX\Tools\v4.0\ResGen.exe')"
          Inputs="Resources\packages.resx;@(PackagesResourceFilesItem)"
          Outputs="Resources\packages.resources">
    <GenerateResource Sources="Resources\packages.resx"
                      OutputResources="Resources\packages.resources"
                      SdkToolsPath="$(EagleDir)\Externals\NETFX\Tools\v4.0" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleKitResGen"
          Condition="'$(EagleKitResGen)' != 'false' And
                     '$(EagleEmbeddedLibrary)' != 'false'"
          Inputs="Resources\kit.resx;@(KitResourceFilesItem)"
          Outputs="Resources\kit.resources">
    <GenerateResource Sources="Resources\kit.resx"
                      OutputResources="Resources\kit.resources" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleKitResGenExternals"
          Condition="'$(EagleKitResGen)' == 'false' And
                     '$(EagleKitResGenExternals)' != 'false' And
                     '$(EagleEmbeddedLibrary)' != 'false' And
                     ((('$(MSBuildToolsVersion)' == '4.0' Or
                        '$(MSBuildToolsVersion)' == '12.0' Or
                        '$(MSBuildToolsVersion)' == '14.0' Or
                        '$(MSBuildToolsVersion)' == '15.0' Or
                        '$(MSBuildToolsVersion)' == 'Current') And
                       '$(TargetFrameworkVersion)' == '') Or
                      '$(TargetFrameworkVersion)' == 'v4.0' Or
                      '$(TargetFrameworkVersion)' == 'v4.5' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.6' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.7' Or
                      '$(TargetFrameworkVersion)' == 'v4.7.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.7.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.8' Or
                      '$(TargetFrameworkVersion)' == 'v4.8.1') And
                     '$(EagleDir)' != '' And
                     !HasTrailingSlash('$(EagleDir)') And
                     Exists('$(EagleDir)\Externals\NETFX\Tools\v4.0\ResGen.exe')"
          Inputs="Resources\kit.resx;@(KitResourceFilesItem)"
          Outputs="Resources\kit.resources">
    <GenerateResource Sources="Resources\kit.resx"
                      OutputResources="Resources\kit.resources"
                      SdkToolsPath="$(EagleDir)\Externals\NETFX\Tools\v4.0" />
  </Target>

  <!--
  ******************************************************************************
  **                       Eagle Test Specific Targets                        **
  ******************************************************************************
  -->

  <Target Name="EagleRunTests"
          Condition="'$(EagleRunTests)' != 'false' And
                     '$(BuildTool)' == 'MSBuild' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(EagleLibraryDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryDir)') And
                     Exists('$(EagleLibraryDir)') And
                     Exists('$(EagleLibraryDir)Tests\all.eagle')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).RunTests.done">
    <Exec Condition="'$(EagleRunCoverage)' == 'false' Or
                     '$(EagleCoverageTool)' == '' Or
                     !Exists('$(EagleCoverageTool)') Or
                     '$(EagleCoverageOutputPath)' == '' Or
                     '$(EagleCoverageArguments)' == ''"
          Command="&quot;$(TargetPath)&quot; $(EagleCommonTestArguments) $(EagleTestArguments) -file &quot;$(EagleLibraryDir)Tests\all.eagle&quot; $(EagleTestFlags)" />

    <Exec Condition="'$(EagleRunCoverage)' != 'false' And
                     '$(EagleCoverageTool)' != '' And
                     Exists('$(EagleCoverageTool)') And
                     '$(EagleCoverageOutputPath)' != '' And
                     '$(EagleCoverageArguments)' != ''"
          Command="&quot;$(EagleCoverageTool)&quot; &quot;$(TargetPath)&quot; $(EagleCommonTestArguments) $(EagleTestArguments) -file &quot;$(EagleLibraryDir)Tests\all.eagle&quot; $(EagleTestFlags) $(EagleCoverageArguments)" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).RunTests.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="EagleRunTestsForNetStandard2X"
          Condition="'$(EagleRunTests)' != 'false' And
                     '$(EagleRunTestsForNetStandard2X)' != 'false' And
                     '$(BuildTool)' == 'DotNetCore' And
                     '$(EagleLibraryDir)' != '' And
                     HasTrailingSlash('$(EagleLibraryDir)') And
                     Exists('$(EagleLibraryDir)') And
                     Exists('$(EagleLibraryDir)Tests\all.eagle')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).RunTests.done">
    <Exec Command="dotnet exec &quot;$(TargetPath)&quot; $(EagleCommonTestArguments) $(EagleTestArguments) -file &quot;$(EagleLibraryDir)Tests\all.eagle&quot; $(EagleTestFlags)" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).RunTests.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Import Condition="'$(EagleTaskTargets)' != 'false' And
                     '$(EagleTaskPath)' != '' And
                     HasTrailingSlash('$(EagleTaskPath)') And
                     Exists('$(EagleTaskPath)Eagle.tasks')"
          Project="$(EagleTaskPath)Eagle.tasks" />

  <!--
  ******************************************************************************
  -->

  <Target Name="LockBuildOutputDirectories">
    <EvaluateFile Condition="'$(BuildTool)' == 'MSBuild' And
                             '$(EagleLibraryDir)' != '' And
                             HasTrailingSlash('$(EagleLibraryDir)') And
                             Exists('$(EagleLibraryDir)Tools\lockBuild.eagle') And
                             '$(EagleTaskPath)' != '' And
                             HasTrailingSlash('$(EagleTaskPath)') And
                             Exists('$(EagleTaskPath)EagleShell.exe')"
                  Args="true" Text="$(EagleLibraryDir)Tools\lockBuild.eagle">
      <Output TaskParameter="Code" PropertyName="LockBuildOutputCode" />
      <Output TaskParameter="Result" PropertyName="LockBuildOutputResult" />
    </EvaluateFile>

    <Message Text="LockBuildOutputDirectories: $(LockBuildOutputCode) $(LockBuildOutputResult)" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="UnlockBuildOutputDirectories">
    <EvaluateFile Condition="'$(BuildTool)' == 'MSBuild' And
                             '$(EagleLibraryDir)' != '' And
                             HasTrailingSlash('$(EagleLibraryDir)') And
                             Exists('$(EagleLibraryDir)Tools\lockBuild.eagle') And
                             '$(EagleTaskPath)' != '' And
                             HasTrailingSlash('$(EagleTaskPath)') And
                             Exists('$(EagleTaskPath)EagleShell.exe')"
                  Args="false" Text="$(EagleLibraryDir)Tools\lockBuild.eagle">
      <Output TaskParameter="Code" PropertyName="UnlockBuildOutputCode" />
      <Output TaskParameter="Result" PropertyName="UnlockBuildOutputResult" />
    </EvaluateFile>

    <Message Text="UnlockBuildOutputDirectories: $(UnlockBuildOutputCode) $(UnlockBuildOutputResult)" />
  </Target>
</Project>

Added Externals/Eagle/Targets/Eagle.tasks.















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!--
 *
 * Eagle.tasks -
 *
 * WARNING: Contains more evil MSBuild hacks than your doctor recommended.
 *
 * Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: $
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **                          Load Per-User Settings                          **
  ******************************************************************************
  -->

  <!--
      NOTE: If the per-user settings file exists, import it now.  The contained
            settings, if any, will override the default ones provided below.
  -->
  <Import Condition="'$(EagleDir)' != '' And
                     !HasTrailingSlash('$(EagleDir)') And
                     Exists('$(EagleDir)\Targets\Eagle.tasks.user')"
          Project="$(EagleDir)\Targets\Eagle.tasks.user" />

  <!--
  ******************************************************************************
  **                            Eagle Build Tasks                             **
  ******************************************************************************
  -->

  <!--
      NOTE: Evaluates the expression specified by the "Text" input parameter
            and outputs the "Code" and "Result" output parameters.
  -->
  <UsingTask TaskName="EvaluateExpression"
             Condition="'$(EagleTaskPath)' != '' And
                        HasTrailingSlash('$(EagleTaskPath)') And
                        Exists('$(EagleTaskPath)EagleTasks.dll')"
             AssemblyFile="$(EagleTaskPath)EagleTasks.dll" />

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: Evaluates the file specified by the "Text" input parameter and
            outputs the "Code" and "Result" output parameters.
  -->
  <UsingTask TaskName="EvaluateFile"
             Condition="'$(EagleTaskPath)' != '' And
                        HasTrailingSlash('$(EagleTaskPath)') And
                        Exists('$(EagleTaskPath)EagleTasks.dll')"
             AssemblyFile="$(EagleTaskPath)EagleTasks.dll" />

  <!--
  ******************************************************************************
  -->
  <!--
      NOTE: Evaluates the script specified by the "Text" input parameter and
            outputs the "Code" and "Result" output parameters.
  -->
  <UsingTask TaskName="EvaluateScript"
             Condition="'$(EagleTaskPath)' != '' And
                        HasTrailingSlash('$(EagleTaskPath)') And
                        Exists('$(EagleTaskPath)EagleTasks.dll')"
             AssemblyFile="$(EagleTaskPath)EagleTasks.dll" />

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: Performs command, variable, and backslash substitutions on the file
            specified by the "Text" input parameter and outputs the "Code" and
            "Result" output parameters.
  -->
  <UsingTask TaskName="SubstituteFile"
             Condition="'$(EagleTaskPath)' != '' And
                        HasTrailingSlash('$(EagleTaskPath)') And
                        Exists('$(EagleTaskPath)EagleTasks.dll')"
             AssemblyFile="$(EagleTaskPath)EagleTasks.dll" />

  <!--
  ******************************************************************************
  -->

  <!--
      NOTE: Performs command, variable, and backslash substitutions on the
            string specified by the "Text" input parameter and outputs the
            "Code" and "Result" output parameters.
  -->
  <UsingTask TaskName="SubstituteString"
             Condition="'$(EagleTaskPath)' != '' And
                        HasTrailingSlash('$(EagleTaskPath)') And
                        Exists('$(EagleTaskPath)EagleTasks.dll')"
             AssemblyFile="$(EagleTaskPath)EagleTasks.dll" />
</Project>

Added Externals/Eagle/bin/net5/Eagle.dll.

cannot compute difference between binary files

Added Externals/Eagle/bin/net5/EagleShell.dll.

cannot compute difference between binary files

Added Externals/Eagle/bin/net5/EagleShell.runtimeconfig.json.



















>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
{
  "runtimeOptions": {
    "tfm": "net5.0",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "5.0.0"
    }
  }
}

Added Externals/Eagle/bin/net6/Eagle.dll.

cannot compute difference between binary files

Added Externals/Eagle/bin/net6/EagleShell.dll.

cannot compute difference between binary files

Added Externals/Eagle/bin/net6/EagleShell.runtimeconfig.json.



















>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
{
  "runtimeOptions": {
    "tfm": "net6.0",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "6.0.0"
    }
  }
}

Added Externals/Eagle/bin/netCore20/Eagle.dll.

cannot compute difference between binary files

Added Externals/Eagle/bin/netCore20/EagleShell.dll.

cannot compute difference between binary files

Added Externals/Eagle/bin/netCore20/EagleShell.runtimeconfig.json.



















>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
{
  "runtimeOptions": {
    "tfm": "netcoreapp2.0",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "2.0.0"
    }
  }
}

Added Externals/Eagle/bin/netCore30/Eagle.dll.

cannot compute difference between binary files

Added Externals/Eagle/bin/netCore30/EagleShell.dll.

cannot compute difference between binary files

Added Externals/Eagle/bin/netCore30/EagleShell.runtimeconfig.json.



















>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
{
  "runtimeOptions": {
    "tfm": "netcoreapp3.0",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "3.0.0"
    }
  }
}

Added Externals/Eagle/bin/netFramework20/Eagle.dll.

cannot compute difference between binary files

Added Externals/Eagle/bin/netFramework20/EagleShell.exe.

cannot compute difference between binary files

Added Externals/Eagle/bin/netFramework20/EagleShell.exe.config.



























































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<?xml version="1.0" encoding="UTF-8" ?>
<!--
 *
 * EagleShell.exe.config -
 *
 * Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: $
 *
-->
<configuration>
  <appSettings>
    <add key="NoVerbose" value="1" />
    <!--
    <add key="ArgumentCount" value="3" />
    <add key="Argument0String" value="-anyInitialize" />
    <add key="Argument1String" value="puts stdout app_settings1" />
    <add key="Argument2List" value="-anyInitialize {puts stdout app_settings2}" />
    -->
  </appSettings>

  <!--
  *****************************************************************************
  -->

  <!--
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <requiredRuntime version="v2.0.50727" safemode="false" />
    <requiredRuntime version="v4.0.30319" safemode="false" />

    <supportedRuntime version="v2.0.50727" />
    <supportedRuntime version="v4.0.30319" />

    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client" />
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0.1" />
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0.1,Profile=Client" />
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0.2" />
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0.2,Profile=Client" />
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0.3" />
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0.3,Profile=Client" />
    <supportedRuntime version="v4.5" sku=".NETFramework,Version=v4.5" />
    <supportedRuntime version="v4.5.1" sku=".NETFramework,Version=v4.5.1" />
    <supportedRuntime version="v4.5.2" sku=".NETFramework,Version=v4.5.2" />
    <supportedRuntime version="v4.6" sku=".NETFramework,Version=v4.6" />
    <supportedRuntime version="v4.6.1" sku=".NETFramework,Version=v4.6.1" />
    <supportedRuntime version="v4.6.2" sku=".NETFramework,Version=v4.6.2" />
    <supportedRuntime version="v4.7" sku=".NETFramework,Version=v4.7" />
    <supportedRuntime version="v4.7.1" sku=".NETFramework,Version=v4.7.1" />
    <supportedRuntime version="v4.7.2" sku=".NETFramework,Version=v4.7.2" />
    <supportedRuntime version="v4.8" sku=".NETFramework,Version=v4.8" />
    <supportedRuntime version="v4.8.1" sku=".NETFramework,Version=v4.8.1" />
  </startup>
  -->

  <!--
  *****************************************************************************
  -->

  <runtime>
    <!--
        NOTE: These are known to be useful with Eagle.  Some of these only
              work on the .NET Framework 4.0.
    -->
    <!--
    <legacyCorruptedStateExceptionsPolicy enabled="true" />
    <generatePublisherEvidence enabled="false" />
    <NetFx40_LegacySecurityPolicy enabled="true" />
    -->

    <!--
        NOTE: Most of these have not been tested with Eagle.  Some of these
              only work on the .NET Framework 2.0 -OR- .NET Framework 4.0.
    -->
    <!--
    <alwaysFlowImpersonationPolicy enabled="false" />
    <AppContextSwitchOverrides value="name1=value1;" />
    <appDomainManagerAssembly value="Eagle, ..." />
    <appDomainManagerType value="Eagle._Components.Public.DomainManager" />
    <appDomainResourceMonitoring enabled="false" />
    <bypassTrustedAppStrongNames enabled="false" />
    <CompatSortNLSVersion enabled="4096" />
    <developmentMode developerInstallation="false" />
    <disableCachingBindingFailure enabled="0" />
    <disableCommitThreadStack enabled="0" />
    <disableFusionUpdatesFromADManager enabled="0" />
    <enforceFIPSPolicy enabled="true" />
    <EnableAmPmParseAdjustment enabled="0" />
    <etwEnable enabled="true" />
    <forcePerformanceCounterUniqueSharedMemoryReads enabled="false" />
    <gcAllowVeryLargeObjects enabled="false" />
    <gcConcurrent enabled="true" />
    <GCCpuGroup enabled="false" />
    <GCHeapAffinitizeMask enabled="dddd" />
    <GCHeapCount enabled="dd" />
    <GCLOHThreshold enabled="dddd" />
    <GCNoAffinitize enabled="false" />
    <gcServer enabled="false" />
    <generatePublisherEvidence enabled="true" />
    <legacyCorruptedStateExceptionsPolicy enabled="false" />
    <legacyImpersonationPolicy enabled="false" />
    <legacyV1CASPolicy enabled="false" />
    <loadFromRemoteSources enabled="false" />
    <NetFx40_LegacySecurityPolicy enabled="false" />
    <NetFx40_PInvokeStackResilience enabled="0" />
    <PreferComInsteadOfManagedRemoting enabled="false" />
    <qualifyAssembly partialName="Eagle" fullName="Eagle, ..." />
    <relativeBindForResources enabled="false" />
    <shadowCopyVerifyByTimestamp enabled="false" />
    <supportPortability PKT="31bf3856ad364e35" enabled="false" />
    <Thread_UseAllCpuGroups enabled="false" />
    <ThrowUnobservedTaskExceptions enabled="false" />
    <TimeSpan_LegacyFormatMode enabled="false" />
    <useLegacyJit enabled="0" />
    <UseRandomizedStringHashAlgorithm enabled="0" />
    <UseSmallInternalThreadStacks enabled="false" />
    -->

    <!--
        NOTE: This could be used to redirect assembly binding for Eagle,
              to avoid needing the exact build number.
    -->
    <!--
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Eagle"
                          publicKeyToken="29c6297630be05eb"
                          culture="neutral" />

        <bindingRedirect oldVersion="1.0.0.0-1.0.65535.65535"
                         newVersion="[info engine PatchLevel]" />
      </dependentAssembly>

      <dependentAssembly>
        <assemblyIdentity name="Eagle"
                          publicKeyToken="1e22ec67879739a2"
                          culture="neutral" />

        <bindingRedirect oldVersion="1.0.0.0-1.0.65535.65535"
                         newVersion="[info engine PatchLevel]" />
      </dependentAssembly>

      <dependentAssembly>
        <assemblyIdentity name="Eagle"
                          publicKeyToken="358030063a832bc3"
                          culture="neutral" />

        <bindingRedirect oldVersion="1.0.0.0-1.0.65535.65535"
                         newVersion="[info engine PatchLevel]" />
      </dependentAssembly>
    </assemblyBinding>
    -->
  </runtime>

  <!--
  *****************************************************************************
  -->

  <system.diagnostics>
    <!--
        NOTE: This can be used to enable trace logging to a test file.
    -->
    <!--
    <trace>
      <listeners>
        <add name="eagleLogListener"
             type="System.Diagnostics.TextWriterTraceListener"
             initializeData="eagle.log" />
      </listeners>
    </trace>
    -->

    <!--
        NOTE: This can be used to enable tracing of various "System.Net"
              class in the .NET Framework.
    -->
    <!--
    <sources>
      <source name="System.Net" tracemode="includehex" maxdatasize="1024">
        <listeners>
          <add name="System.Net" />
        </listeners>
      </source>
      <source name="System.Net.Cache">
        <listeners>
          <add name="System.Net" />
        </listeners>
      </source>
      <source name="System.Net.Http">
        <listeners>
          <add name="System.Net" />
        </listeners>
      </source>
      <source name="System.Net.Sockets">
        <listeners>
          <add name="System.Net" />
        </listeners>
      </source>
      <source name="System.Net.WebSockets">
        <listeners>
          <add name="System.Net" />
        </listeners>
      </source>
    </sources>
    <switches>
      <add name="System.Net" value="Verbose" />
      <add name="System.Net.Cache" value="Verbose" />
      <add name="System.Net.Http" value="Verbose" />
      <add name="System.Net.Sockets" value="Verbose" />
      <add name="System.Net.WebSockets" value="Verbose" />
    </switches>
    <sharedListeners>
      <add name="System.Net"
           type="System.Diagnostics.TextWriterTraceListener"
           initializeData="eagle.system.net.log" />
    </sharedListeners>
    <trace autoflush="true" />
    -->
  </system.diagnostics>

  <!--
  *****************************************************************************
  -->

  <system.net>
    <!--
        NOTE: This setting is known to speed up the WebClient in the event
              that there is no proxy in use, please see:

              https://stackoverflow.com/questions/4415443
    -->
    <defaultProxy enabled="false" />
  </system.net>
</configuration>

Added Externals/Eagle/bin/netFramework20/EagleShell.exe.mda.config.







































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?xml version="1.0" encoding="UTF-8" ?>
<!--
 *
 * EagleShell.exe.mda.config -
 *
 * Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: $
 *
-->
<mdaConfig xmlns="http://schemas.microsoft.com/CLR/2004/10/mda">
  <!--
      NOTE: The "jitCompilationStart" and "memberInfoCacheCreation" managed
            debugging assistants are extremely noisy.

            Using the "pInvokeLog" managed debugging assistant with no filter
            shows the signature of all P/Invoke calls.  Unfortunately, as of
            the .NET Framework 4.5, it does not appear to support the standard
            wildcard (i.e. "glob") syntax in the filter "dllName" attribute.
            Also, it does not appear to monitor any native calls invoked via
            managed delegates (i.e. those created via the Marshal class using
            the GetDelegateForFunctionPointer method).
  -->
  <assistants>
    <!--++
    <asynchronousThreadAbort />
    <bindingFailure />
    <callbackOnCollectedDelegate listSize="50" />
    <contextSwitchDeadlock enable="true" />
    <dangerousThreadingAPI />
    <dateTimeInvalidLocalFormat />
    <dirtyCastAndCallOnInterface />
    <disconnectedContext enable="true" />
    <dllMainReturnsFalse />
    <exceptionSwallowedOnCallFromCom enable="true" />
    <failedQI />
    <fatalExecutionEngineError />
    <gcManagedToUnmanaged />
    <gcUnmanagedToManaged />
    <illegalPrepareConstrainedRegion />
    <invalidApartmentStateChange />
    <invalidCERCall />
    <invalidFunctionPointerInDelegate enable="true" />
    <invalidGCHandleCookie />
    <invalidIUnknown />
    <invalidMemberDeclaration />
    <invalidOverlappedToPinvoke />
    <invalidVariant />
    <jitCompilationStart>
      <methods>
        <match name="*" />
      </methods>
    </jitCompilationStart>
    <loaderLock />
    <loadFromContext />
    <marshalCleanupError enable="true" />
    <marshaling>
      <methodFilter>
        <match name="*" />
      </methodFilter>
      <fieldFilter>
        <match name="*" />
      </fieldFilter>
    </marshaling>
    <memberInfoCacheCreation />
    <moduloObjectHashcode modulus="1" />
    <nonComVisibleBaseClass />
    <notMarshalable />
    <openGenericCERCall />
    <overlappedFreeError />
    <pInvokeLog />
    <pInvokeLog>
      <filter>
        <match dllName="advapi32.dll" />
        <match dllName="advpack.dll" />
        <match dllName="crypt32.dll" />
        <match dllName="kernel32.dll" />
        <match dllName="mscoree.dll" />
        <match dllName="msvcrt.dll" />
        <match dllName="ntdll.dll" />
        <match dllName="shell32.dll" />
        <match dllName="user32.dll" />
        <match dllName="wintrust.dll" />
        <match dllName="wtsapi32.dll" />
      </filter>
    </pInvokeLog>
    <pInvokeStackImbalance />
    <raceOnRCWCleanup />
    <reentrancy />
    <releaseHandleFailed />
    <reportAvOnComRelease allowAv="true" />
    <streamWriterBufferedDataLost />
    <virtualCERCall />
    ++-->
  </assistants>
</mdaConfig>

Added Externals/Eagle/bin/netFramework20/EagleShell32.exe.

cannot compute difference between binary files

Added Externals/Eagle/bin/netFramework20/x64/Spilornis.dll.

cannot compute difference between binary files

Added Externals/Eagle/bin/netFramework20/x86/Spilornis.dll.

cannot compute difference between binary files

Added Externals/Eagle/bin/netFramework40/Eagle.dll.

cannot compute difference between binary files

Added Externals/Eagle/bin/netFramework40/EagleShell.exe.

cannot compute difference between binary files

Added Externals/Eagle/bin/netFramework40/EagleShell.exe.config.





























































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<?xml version="1.0" encoding="UTF-8" ?>
<!--
 *
 * EagleShell.exe.config -
 *
 * Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: $
 *
-->
<configuration>
  <appSettings>
    <add key="NoVerbose" value="1" />
    <!--
    <add key="ArgumentCount" value="3" />
    <add key="Argument0String" value="-anyInitialize" />
    <add key="Argument1String" value="puts stdout app_settings1" />
    <add key="Argument2List" value="-anyInitialize {puts stdout app_settings2}" />
    -->
  </appSettings>

  <!--
  *****************************************************************************
  -->

  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
    <!--
    <requiredRuntime version="v2.0.50727" safemode="false" />
    <requiredRuntime version="v4.0.30319" safemode="false" />

    <supportedRuntime version="v2.0.50727" />
    <supportedRuntime version="v4.0.30319" />

    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client" />
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0.1" />
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0.1,Profile=Client" />
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0.2" />
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0.2,Profile=Client" />
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0.3" />
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0.3,Profile=Client" />
    <supportedRuntime version="v4.5" sku=".NETFramework,Version=v4.5" />
    <supportedRuntime version="v4.5.1" sku=".NETFramework,Version=v4.5.1" />
    <supportedRuntime version="v4.5.2" sku=".NETFramework,Version=v4.5.2" />
    <supportedRuntime version="v4.6" sku=".NETFramework,Version=v4.6" />
    <supportedRuntime version="v4.6.1" sku=".NETFramework,Version=v4.6.1" />
    <supportedRuntime version="v4.6.2" sku=".NETFramework,Version=v4.6.2" />
    <supportedRuntime version="v4.7" sku=".NETFramework,Version=v4.7" />
    <supportedRuntime version="v4.7.1" sku=".NETFramework,Version=v4.7.1" />
    <supportedRuntime version="v4.7.2" sku=".NETFramework,Version=v4.7.2" />
    <supportedRuntime version="v4.8" sku=".NETFramework,Version=v4.8" />
    <supportedRuntime version="v4.8.1" sku=".NETFramework,Version=v4.8.1" />
    -->
  </startup>

  <!--
  *****************************************************************************
  -->

  <runtime>
    <!--
        NOTE: These are known to be useful with Eagle.  Some of these only
              work on the .NET Framework 4.0.
    -->
    <!--
    <legacyCorruptedStateExceptionsPolicy enabled="true" />
    <generatePublisherEvidence enabled="false" />
    <NetFx40_LegacySecurityPolicy enabled="true" />
    -->

    <!--
        NOTE: Most of these have not been tested with Eagle.  Some of these
              only work on the .NET Framework 2.0 -OR- .NET Framework 4.0.
    -->
    <!--
    <alwaysFlowImpersonationPolicy enabled="false" />
    <AppContextSwitchOverrides value="name1=value1;" />
    <appDomainManagerAssembly value="Eagle, ..." />
    <appDomainManagerType value="Eagle._Components.Public.DomainManager" />
    <appDomainResourceMonitoring enabled="false" />
    <bypassTrustedAppStrongNames enabled="false" />
    <CompatSortNLSVersion enabled="4096" />
    <developmentMode developerInstallation="false" />
    <disableCachingBindingFailure enabled="0" />
    <disableCommitThreadStack enabled="0" />
    <disableFusionUpdatesFromADManager enabled="0" />
    <enforceFIPSPolicy enabled="true" />
    <EnableAmPmParseAdjustment enabled="0" />
    <etwEnable enabled="true" />
    <forcePerformanceCounterUniqueSharedMemoryReads enabled="false" />
    <gcAllowVeryLargeObjects enabled="false" />
    <gcConcurrent enabled="true" />
    <GCCpuGroup enabled="false" />
    <GCHeapAffinitizeMask enabled="dddd" />
    <GCHeapCount enabled="dd" />
    <GCLOHThreshold enabled="dddd" />
    <GCNoAffinitize enabled="false" />
    <gcServer enabled="false" />
    <generatePublisherEvidence enabled="true" />
    <legacyCorruptedStateExceptionsPolicy enabled="false" />
    <legacyImpersonationPolicy enabled="false" />
    <legacyV1CASPolicy enabled="false" />
    <loadFromRemoteSources enabled="false" />
    <NetFx40_LegacySecurityPolicy enabled="false" />
    <NetFx40_PInvokeStackResilience enabled="0" />
    <PreferComInsteadOfManagedRemoting enabled="false" />
    <qualifyAssembly partialName="Eagle" fullName="Eagle, ..." />
    <relativeBindForResources enabled="false" />
    <shadowCopyVerifyByTimestamp enabled="false" />
    <supportPortability PKT="31bf3856ad364e35" enabled="false" />
    <Thread_UseAllCpuGroups enabled="false" />
    <ThrowUnobservedTaskExceptions enabled="false" />
    <TimeSpan_LegacyFormatMode enabled="false" />
    <useLegacyJit enabled="0" />
    <UseRandomizedStringHashAlgorithm enabled="0" />
    <UseSmallInternalThreadStacks enabled="false" />
    -->

    <!--
        NOTE: This could be used to redirect assembly binding for Eagle,
              to avoid needing the exact build number.
    -->
    <!--
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Eagle"
                          publicKeyToken="29c6297630be05eb"
                          culture="neutral" />

        <bindingRedirect oldVersion="1.0.0.0-1.0.65535.65535"
                         newVersion="[info engine PatchLevel]" />
      </dependentAssembly>

      <dependentAssembly>
        <assemblyIdentity name="Eagle"
                          publicKeyToken="1e22ec67879739a2"
                          culture="neutral" />

        <bindingRedirect oldVersion="1.0.0.0-1.0.65535.65535"
                         newVersion="[info engine PatchLevel]" />
      </dependentAssembly>

      <dependentAssembly>
        <assemblyIdentity name="Eagle"
                          publicKeyToken="358030063a832bc3"
                          culture="neutral" />

        <bindingRedirect oldVersion="1.0.0.0-1.0.65535.65535"
                         newVersion="[info engine PatchLevel]" />
      </dependentAssembly>
    </assemblyBinding>
    -->
  </runtime>

  <!--
  *****************************************************************************
  -->

  <system.diagnostics>
    <!--
        NOTE: This can be used to enable trace logging to a test file.
    -->
    <!--
    <trace>
      <listeners>
        <add name="eagleLogListener"
             type="System.Diagnostics.TextWriterTraceListener"
             initializeData="eagle.log" />
      </listeners>
    </trace>
    -->

    <!--
        NOTE: This can be used to enable tracing of various "System.Net"
              class in the .NET Framework.
    -->
    <!--
    <sources>
      <source name="System.Net" tracemode="includehex" maxdatasize="1024">
        <listeners>
          <add name="System.Net" />
        </listeners>
      </source>
      <source name="System.Net.Cache">
        <listeners>
          <add name="System.Net" />
        </listeners>
      </source>
      <source name="System.Net.Http">
        <listeners>
          <add name="System.Net" />
        </listeners>
      </source>
      <source name="System.Net.Sockets">
        <listeners>
          <add name="System.Net" />
        </listeners>
      </source>
      <source name="System.Net.WebSockets">
        <listeners>
          <add name="System.Net" />
        </listeners>
      </source>
    </sources>
    <switches>
      <add name="System.Net" value="Verbose" />
      <add name="System.Net.Cache" value="Verbose" />
      <add name="System.Net.Http" value="Verbose" />
      <add name="System.Net.Sockets" value="Verbose" />
      <add name="System.Net.WebSockets" value="Verbose" />
    </switches>
    <sharedListeners>
      <add name="System.Net"
           type="System.Diagnostics.TextWriterTraceListener"
           initializeData="eagle.system.net.log" />
    </sharedListeners>
    <trace autoflush="true" />
    -->
  </system.diagnostics>

  <!--
  *****************************************************************************
  -->

  <system.net>
    <!--
        NOTE: This setting is known to speed up the WebClient in the event
              that there is no proxy in use, please see:

              https://stackoverflow.com/questions/4415443
    -->
    <defaultProxy enabled="false" />
  </system.net>
</configuration>

Added Externals/Eagle/bin/netFramework40/EagleShell.exe.mda.config.







































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?xml version="1.0" encoding="UTF-8" ?>
<!--
 *
 * EagleShell.exe.mda.config -
 *
 * Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: $
 *
-->
<mdaConfig xmlns="http://schemas.microsoft.com/CLR/2004/10/mda">
  <!--
      NOTE: The "jitCompilationStart" and "memberInfoCacheCreation" managed
            debugging assistants are extremely noisy.

            Using the "pInvokeLog" managed debugging assistant with no filter
            shows the signature of all P/Invoke calls.  Unfortunately, as of
            the .NET Framework 4.5, it does not appear to support the standard
            wildcard (i.e. "glob") syntax in the filter "dllName" attribute.
            Also, it does not appear to monitor any native calls invoked via
            managed delegates (i.e. those created via the Marshal class using
            the GetDelegateForFunctionPointer method).
  -->
  <assistants>
    <!--++
    <asynchronousThreadAbort />
    <bindingFailure />
    <callbackOnCollectedDelegate listSize="50" />
    <contextSwitchDeadlock enable="true" />
    <dangerousThreadingAPI />
    <dateTimeInvalidLocalFormat />
    <dirtyCastAndCallOnInterface />
    <disconnectedContext enable="true" />
    <dllMainReturnsFalse />
    <exceptionSwallowedOnCallFromCom enable="true" />
    <failedQI />
    <fatalExecutionEngineError />
    <gcManagedToUnmanaged />
    <gcUnmanagedToManaged />
    <illegalPrepareConstrainedRegion />
    <invalidApartmentStateChange />
    <invalidCERCall />
    <invalidFunctionPointerInDelegate enable="true" />
    <invalidGCHandleCookie />
    <invalidIUnknown />
    <invalidMemberDeclaration />
    <invalidOverlappedToPinvoke />
    <invalidVariant />
    <jitCompilationStart>
      <methods>
        <match name="*" />
      </methods>
    </jitCompilationStart>
    <loaderLock />
    <loadFromContext />
    <marshalCleanupError enable="true" />
    <marshaling>
      <methodFilter>
        <match name="*" />
      </methodFilter>
      <fieldFilter>
        <match name="*" />
      </fieldFilter>
    </marshaling>
    <memberInfoCacheCreation />
    <moduloObjectHashcode modulus="1" />
    <nonComVisibleBaseClass />
    <notMarshalable />
    <openGenericCERCall />
    <overlappedFreeError />
    <pInvokeLog />
    <pInvokeLog>
      <filter>
        <match dllName="advapi32.dll" />
        <match dllName="advpack.dll" />
        <match dllName="crypt32.dll" />
        <match dllName="kernel32.dll" />
        <match dllName="mscoree.dll" />
        <match dllName="msvcrt.dll" />
        <match dllName="ntdll.dll" />
        <match dllName="shell32.dll" />
        <match dllName="user32.dll" />
        <match dllName="wintrust.dll" />
        <match dllName="wtsapi32.dll" />
      </filter>
    </pInvokeLog>
    <pInvokeStackImbalance />
    <raceOnRCWCleanup />
    <reentrancy />
    <releaseHandleFailed />
    <reportAvOnComRelease allowAv="true" />
    <streamWriterBufferedDataLost />
    <virtualCERCall />
    ++-->
  </assistants>
</mdaConfig>

Added Externals/Eagle/bin/netFramework40/EagleShell32.exe.

cannot compute difference between binary files

Added Externals/Eagle/bin/netFramework40/x64/Spilornis.dll.

cannot compute difference between binary files

Added Externals/Eagle/bin/netFramework40/x86/Spilornis.dll.

cannot compute difference between binary files

Added Externals/Eagle/lib/Eagle1.0/auxiliary.eagle.

































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
###############################################################################
#
# auxiliary.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Auxiliary Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This procedure returns the value of an environment variable, if
  #       it actually exists; otherwise, an empty string is returned.
  #
  proc getEnvironmentVariable { name } {
    global env

    return [expr {[info exists env($name)] ? $env($name) : ""}]
  }

  #
  # NOTE: This procedure accepts an any number of arguments.  The arguments
  #       are appended into one big string, verbatim.  The resulting string
  #       is returned.  Normally, this procedure is used to avoid undesired
  #       string interpolation operations.
  #
  proc appendArgs { args } {
    set result ""; eval append result $args
  }

  #
  # NOTE: This procedure attempts to locate the first named value we are
  #       interested in.  The dictionary argument must be a list with an
  #       even number of elements in the following format:
  #
  #       <name1> <value1> <name2> <value2> ... <nameN> <valueN>
  #
  proc getDictionaryValue { dictionary name {default ""} {wrap ""} } {
    foreach {pairName pairValue} $dictionary {
      #
      # NOTE: Does this name match the one specified by the caller?
      #
      if {$pairName eq $name} then {
        #
        # NOTE: Return the value, optionally wrapped.
        #
        return [appendArgs $wrap $pairValue $wrap]
      }
    }

    #
    # NOTE: No match was found, return the default value.
    #
    return $default
  }

  #
  # NOTE: This procedure exports one or more commands from the specified
  #       namespace and imports them into the global namespace, optionally
  #       forgetting all previous imports from the specified namespace.
  #
  proc exportAndImportPackageCommands { namespace exports forget force } {
    #
    # NOTE: If the specified namespace is global, do nothing as this is a
    #       no-op.
    #
    if {[string length [string trimleft $namespace :]] == 0} then {return}

    #
    # NOTE: Forget any previous commands that were imported from
    #       this namespace into the global namespace?
    #
    if {$forget} then {
      namespace eval :: [list namespace forget [appendArgs $namespace ::*]]
    }

    #
    # NOTE: Process each command to be exported from the specified
    #       namespace and import it into the global namespace, if
    #       necessary.
    #
    foreach export $exports {
      #
      # NOTE: Force importing of our exported commands into the global
      #       namespace?  Otherwise, see if the command is already
      #       present in the global namespace before trying to import
      #       it.
      #
      if {$force || \
          [llength [info commands [appendArgs :: $export]]] == 0} then {
        #
        # NOTE: Export the specified command from the specified namespace.
        #
        namespace eval $namespace [list namespace export $export]

        #
        # NOTE: Import the specified command into the global namespace.
        #
        set namespaceExport [appendArgs $namespace :: $export]

        if {$force} then {
          namespace eval :: [list namespace import -force $namespaceExport]
        } else {
          namespace eval :: [list namespace import $namespaceExport]
        }
      }
    }
  }

  #
  # NOTE: Provide the Eagle "auxiliary" package to the interpreter.
  #
  package provide Eagle.Auxiliary \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/compat.eagle.























































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
###############################################################################
#
# compat.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle [Native Tcl] Compatibility Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This procedure attempts to query the size from the host, in terms
  #       of columns and rows; failing that, it returns a reasonable default
  #       value.  Generally, this procedure is intended to be used only by
  #       the other procedures in this file.
  #
  proc getHostSize {} {
    if {[catch {host size} result] == 0} then {
      return $result
    }

    return [list 80 25]; # TODO: Good default?
  }

  #
  # NOTE: This procedure emulates the behavior of the native Tcl [parray]
  #       procedure: it prints (to stdout) the names and values contained
  #       in the specified array, or a subset of those names based on the
  #       specified pattern.
  #
  proc parray { a args } {
    if {[llength $args] > 2} then {
      error "wrong # args: should be \"parray a ?pattern?\""
    }

    upvar 1 $a array

    if {![array exists array]} {
      error [appendArgs \" $a "\" isn't an array"]
    }

    set names [lsort [eval array names array $args]]
    set maxLength 0

    foreach name $names {
      set length [string length $name]

      if {$length > $maxLength} {
        set maxLength $length
      }
    }

    set stringMap [list \b " " \t " " \r \xB6 \n \xB6]
    set maxLength [expr {$maxLength + [string length $a] + 2}]
    set hostLength [lindex [getHostSize] 0]
    set valueLength [expr {$hostLength - $maxLength - 5}]; # " ... "

    foreach name $names {
      #
      # NOTE: Format the array element name for display.
      #
      set nameString [string map $stringMap [appendArgs $a ( $name )]]

      #
      # NOTE: If the value by itself is too long to fit on one host line,
      #       just truncate and ellipsis it.
      #
      set valueString [string map $stringMap $array($name)]

      if {[string length $valueString] > $valueLength} then {
        set valueString [appendArgs [string range $valueString 0 \
            [expr {$valueLength - 4}]] " ..."]
      }

      #
      # HACK: Mono does not currently support calling the String.Format
      #       overload that takes a variable number of arguments via
      #       reflection (Mono bug #636939).
      #
      if {![isMono]} then {
        set line [string format -verbatim -- [appendArgs "\{0,-" \
            $maxLength "\} = {1}"] $nameString $valueString]
      } elseif {[llength [info commands object]] > 0} then {
        set line [object invoke String Format [appendArgs "\{0,-" \
            $maxLength "\} = {1}"] $nameString $valueString]
      } else {
        set line [format [appendArgs "%-" $maxLength "s = %s"] \
            $nameString $valueString]
      }

      puts stdout $line
    }
  }

  #
  # NOTE: This procedure emulates the behavior of the native Tcl [parray]
  #       procedure: it prints (to stdout) the names and values contained
  #       in the specified dictionary, or a subset of those names based on
  #       the specified pattern.
  #
  proc pdict { d } {
    set maxLength 0

    foreach {name value} $d {
      set length [string length $name]

      if {$length > $maxLength} {
        set maxLength $length
      }
    }

    set hostLength [lindex [getHostSize] 0]
    set valueLength [expr {$hostLength - $maxLength - 5}]; # " ... "

    foreach {name value} $d {
      #
      # NOTE: If the value by itself is too long to fit on one host line,
      #       just truncate and ellipsis it.
      #
      set valueString $value

      if {[string length $valueString] > $valueLength} then {
        set valueString [appendArgs [string range $valueString 0 \
            [expr {$valueLength - 4}]] " ..."]
      }

      #
      # HACK: Mono does not currently support calling the String.Format
      #       overload that takes a variable number of arguments via
      #       reflection (Mono bug #636939).
      #
      if {![isMono]} then {
        set line [string format -verbatim -- [appendArgs "\{0,-" \
            $maxLength "\} = {1}"] $name $valueString]
      } elseif {[llength [info commands object]] > 0} then {
        set line [object invoke String Format [appendArgs "\{0,-" \
            $maxLength "\} = {1}"] $name $valueString]
      } else {
        set line [format [appendArgs "%-" $maxLength "s = %s"] \
            $name $valueString]
      }

      puts stdout $line
    }
  }

  #
  # NOTE: This procedure emulates the behavior of the native Tcl [test]
  #       command as provided by its bundled "tcltest" package.  It is
  #       designed to automatically detect and handle the type of test
  #       specified by the various arguments, which may be an old style
  #       test or a new style test.
  #
  proc test { name description args } {
    #
    # NOTE: Determine if the caller is trying to run an old style or
    #       new style test and use the appropriate command.
    #
    if {[string index [lindex $args 0] 0] eq "-"} then {
      #
      # NOTE: New style test, use [test2] command.
      #
      set command test2
    } else {
      #
      # NOTE: Old style test, use [test1] command.
      #
      set command test1
    }

    return [uplevel 1 [list $command $name $description] $args]
  }

  #
  # NOTE: This procedure emulates the behavior of the native Tcl [tclLog]
  #       command.
  #
  proc tclLog { string } {
    #
    # NOTE: This should work properly in both Tcl and Eagle.
    #
    catch {puts stderr $string}
  }

  #
  # NOTE: Provide the Eagle "Tcl compatibility" package to the interpreter.
  #
  package provide Eagle.Tcl.Compatibility \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/csharp.eagle.









































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
###############################################################################
#
# csharp.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle CSharp Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This procedure is used to log various stages of the C# compilation
  #       lifecycle.  Under normal circumstances, this procedure will not do
  #       anything.
  #
  proc csharpLog { string {object ""} } {
    #
    # NOTE: If the "enableCSharpLog" runtime option is enabled, this routine
    #       will emit log output somewhere; otherwise, it will do nothing.
    #
    if {![info exists ::no(csharpLog)] && \
        [llength [info commands hasRuntimeOption]] > 0 && \
        [hasRuntimeOption enableCSharpLog]} then {
      #
      # NOTE: If the caller passed a valid opaque object handle, query its
      #       list of properties and emit them with the log output.
      #
      if {[llength [info commands object]] > 0 && \
          [isNonNullObjectHandle $object]} then {
        #
        # HACK: Attempt to dynamically query all public properties of the
        #       specified object -AND- add them to the log output.
        #
        set list null; set error null

        set code [object invoke -create -alias -flags +NonPublic \
            Eagle._Components.Private.MarshalOps ListProperties \
            "" $object null null true list error]

        #
        # HACK: Since -create was used above in the [object invoke] call,
        #       the "code" variable must be converted to a string before
        #       we can check it for success.
        #
        set code [getStringFromObjectHandle $code]

        if {$code eq "Ok"} then {
          #
          # HACK: In theory, at this point, the "list" variable must be
          #       a valid opaque object handle; however, to prevent any
          #       future issues with the ListProperties method check it
          #       just in case.
          #
          if {[isNonNullObjectHandle $list]} then {
            #
            # HACK: The [formatListAsDict] procedure will almost always
            #       be available at this point; however, we do not want
            #       to require it.
            #
            if {[llength [info commands formatListAsDict]] > 0} then {
              set suffix [formatListAsDict \
                  [getStringFromObjectHandle $list]]
            } else {
              set suffix [getStringFromObjectHandle $list]
            }
          } else {
            set suffix [appendArgs \
                "invalid property list for object \"" $object \"]
          }
        } else {
          set suffix [getStringFromObjectHandle $error]
        }

        set newString [appendArgs $string $suffix]
      } else {
        set newString $string
      }

      #
      # NOTE: If the "testCSharpLog" runtime option is enabled, emit the
      #       output to the test log.
      #
      if {[hasRuntimeOption testCSharpLog]} then {
        #
        # HACK: The [getTestChannelOrDefault] procedure will almost always
        #       be available at this point; however, we can work around the
        #       lack of it.
        #
        if {[llength [info commands getTestChannelOrDefault]] > 0} then {
          set channel [getTestChannelOrDefault]
        } else {
          if {[info exists ::test_channel]} then {
            set channel $::test_channel
          } else {
            set channel stdout
          }
        }

        #
        # HACK: The [tputs] procedure will almost always be available at
        #       this point; however, we can work around the lack of it.
        #
        set newString [appendArgs "---- " $newString \n]

        if {[llength [info commands tputs]] > 0} then {
          tputs $channel $newString
        } else {
          tqputs $channel $newString
        }
      } else {
        #
        # TODO: Is there a better place to send this log output when the
        #       test suite is not available?
        #
        tclLog $newString
      }
    }

    return ""
  }

  #
  # NOTE: This procedure is used to determine the fully qualified path to the
  #       .NET Core SDK.  An empty string will be returned to indicate an
  #       error.  This procedure should not raise script errors.
  #
  proc getDotNetCoreSdkPath {} {
    if {[catch {exec -- dotnet --info} info] == 0} then {
      csharpLog [appendArgs \
          "getDotNetCoreSdkPath ok:\n\t" \
          [string map [list \n \n\t] $info]]

      set info [string map [list \r\n \n] $info]

      if {[regexp -line -- \
          {^\s*Base Path:\s+([^\n]+)$} $info dummy path]} then {
        return [file normalize $path]
      }
    } else {
      csharpLog [appendArgs \
          "getDotNetCoreSdkPath error: " $info]
    }

    return ""
  }

  #
  # NOTE: This procedure is used to determine the fully qualified path to the
  #       directory containing the reference assemblies for the .NET Standard
  #       2.x.  An empty string will be returned to indicate an error.  This
  #       procedure should not raise script errors.
  #
  proc getDotNetStandardReferencePath {
          {packageVersion ""} {standardVersion ""} {useSdkVersion false} } {
    set path [getDotNetCoreSdkPath]

    if {[string length $path] > 0} then {
      if {[string length $standardVersion] == 0} then {
        if {!$useSdkVersion && [isDotNetCore] && \
            [info exists ::eagle_platform(runtimeVersion)]} then {
          set targetVersion $::eagle_platform(runtimeVersion)
        } else {
          set targetVersion [file tail $path]
        }

        if {[string match 8.* $targetVersion] || \
            [string match 7.* $targetVersion] || \
            [string match 6.* $targetVersion] || \
            [string match 5.* $targetVersion] || \
            [string match 3.* $targetVersion]} then {
          set standardVersion netstandard2.1
        } elseif {[string match 2.* $targetVersion]} then {
          set standardVersion netstandard2.0
        }
      }

      switch -exact -- $standardVersion {
        netstandard2.0 {
          set libraryDirectory [file normalize [file join [file dirname \
              $path] NuGetFallbackFolder netstandard.library]]

          set buildReferenceSubDirectory [file join build $standardVersion \
              ref]
        }
        netstandard2.1 {
          set libraryDirectory [file normalize [file join [file dirname \
              [file dirname $path]] packs NETStandard.Library.Ref]]

          set buildReferenceSubDirectory [file join ref $standardVersion]
        }
        default {
          #
          # TODO: Do something else here?  The version of the standard is
          #       not known.  Perhaps do some kind of search?
          #
          set libraryDirectory ""
          set buildReferenceSubDirectory ""
        }
      }

      if {[string length $libraryDirectory] > 0 && \
          [string length $buildReferenceSubDirectory] > 0} then {
        if {[string length $packageVersion] > 0} then {
          set assemblyDirectory [file normalize [file join \
              $libraryDirectory $packageVersion $buildReferenceSubDirectory]]

          if {[file exists $assemblyDirectory]} then {
            return $assemblyDirectory
          }
        } else {
          set compareCommand [list package vsort]
          set globPathPattern [file join $libraryDirectory *]

          set maybeVersions [lsort -decreasing -command $compareCommand \
              [lmap directory [glob -nocomplain -types {d} $globPathPattern] \
              { file tail $directory }]]

          catch {object removecallback $compareCommand}

          foreach maybeVersion $maybeVersions {
            set assemblyDirectory [file normalize [file join \
                $libraryDirectory $maybeVersion $buildReferenceSubDirectory]]

            if {[file exists $assemblyDirectory]} then {
              return $assemblyDirectory
            }
          }
        }
      }
    }

    return ""
  }

  #
  # NOTE: This procedure is used to obtain a test program for use with the
  #       C# compiler.  Upon success, the return value will be a list with
  #       two elements.  The first element will be the name of the C# class
  #       to be compiled.  The second element will be the C# program text.
  #       Upon failure, the return value will be an empty list.
  #
  proc getCSharpTestProgram { {name ""} } {
    set prefix Test

    if {[llength [info commands object]] > 0} then {
      set id [object invoke Interpreter.GetActive NextId]

      set className [appendArgs \
          $prefix Namespace $id [object invoke Type Delimiter] \
          $prefix Class $id]
    } else {
      set id [string trimleft [expr {random()}] -]

      set className [appendArgs \
          $prefix Namespace $id . $prefix Class $id]
    }

    return [list $className [subst {
      using System;

      namespace ${prefix}Namespace${id}
      {
        public static class ${prefix}Class${id}
        {
          public static Int32 Main(String\[\] args)
          {
            return 0;
          }
        }
      }
    }]]
  }

  #
  # NOTE: This procedure is used to determine whether the C# compiler appears
  #       to work when invoked via the interfaces defined in this script file.
  #       Non-zero is returned to indicate success.  This procedure should not
  #       raise script errors.
  #
  proc doesCompileCSharpWork {
          {name ""} {errorsVarName ""} {memory true} args } {
    if {[string length $errorsVarName] > 0} then {
      upvar 1 $errorsVarName errors
    }

    if {[catch {getCSharpTestProgram $name} program]} then {
      set errors [list [appendArgs \
          "caught error while getting \"" $name "\" test program: " \
          $program]]

      return false
    }

    if {[llength $program] < 2} then {
      set errors [list [appendArgs \
          "command \[getCSharpTestProgram\] returned malformed \"" \
          $name "\" test program: " $program]]

      return false
    }

    set local_args $args

    if {!$memory} then {
      lappend local_args GenerateExecutable true
      # lappend local_args MainClass [lindex $program 0]
    }

    unset -nocomplain results local_errors

    try {
      if {[catch {
        eval compileCSharp [list [lindex $program 1]] \
            $memory false true results local_errors $local_args
      } result]} then {
        set errors [list [appendArgs \
            "caught error while compiling \"" $name \
            "\" test program: " $code]]

        return false
      }

      if {$memory} then {
        set code $result
      } else {
        set code [lindex $result 0]
        set outputFileName [lindex $result 1]
      }

      if {$code ne "Ok"} then {
        set errors [list [appendArgs \
            "errors from compilation of \"" $name "\" test program: " \
            [expr {[info exists local_errors] ? $local_errors : $code}]]]

        return false
      }

      if {$memory} then {
        if {[llength [info commands object]] == 0} then {
          set errors [list [appendArgs "cannot invoke \"" $name \
              "\" test program, missing \"object\" command"]]

          return false
        }

        if {[catch {
          object invoke [lindex $program 0] Main null
        } haveExitCode]} then {
          set errors [list [appendArgs "caught error while invoking \"" \
              $name "\" test program: " $haveExitCode]]

          return false
        }

        set wantExitCode 0
      } else {
        if {[isDotNetCore]} then {
          #
          # NOTE: What is the fully qualified file name of the .NET Core
          #       runtime configuration file for this (managed) process?
          #
          set sourceRuntimeConfigFileName [appendArgs [file rootname \
              [getShellExecutableName]] .runtimeconfig.json]
        }

        if {[catch {
          #
          # HACK: Apparently, running even a trivial compiled executable
          #       using the .NET Core runtime requires the presence of a
          #       runtime configuration file and there is no (easy?) way
          #       to directly instruct the C# compiler to generate one;
          #       therefore, copy the one being used for this process,
          #       which is presumably running on the .NET Core runtime.
          #
          if {[info exists sourceRuntimeConfigFileName] && \
              [file exists $sourceRuntimeConfigFileName]} then {
            set targetRuntimeConfigFileName [appendArgs [file rootname \
                $outputFileName] .runtimeconfig.json]

            if {![file exists $targetRuntimeConfigFileName]} then {
              file copy $sourceRuntimeConfigFileName \
                  $targetRuntimeConfigFileName
            }
          }

          set command [list exec -exitcode haveExitCode --]
          eval lappend command [getRuntimeCommandLine $outputFileName]
          eval $command
        } error]} then {
          set errors [list [appendArgs \
              "caught error while executing \"" $name "\" test program: " \
              $error]]

          return false
        }

        set wantExitCode Success
      }
    } finally {
      if {[info exists targetRuntimeConfigFileName] && \
          [file exists $targetRuntimeConfigFileName]} then {
        catch {file delete $targetRuntimeConfigFileName}
      }

      if {[info exists outputFileName] && \
          [file exists $outputFileName]} then {
        catch {file delete $outputFileName}
      }
    }

    if {$haveExitCode ne $wantExitCode} then {
      set errors [list [appendArgs \
          "bad exit code from \"" $name \
          "\" test program: " $haveExitCode]]

      return false
    }

    return true
  }

  #
  # NOTE: This procedure is used to determine the command line arguments that
  #       are required to invoke the .NET Core SDK compiler for C#.  An empty
  #       list will be returned if the arguments cannot be determined for some
  #       reason -OR- the C# compiler cannot be found.  This procedure should
  #       not raise script errors.
  #
  proc getDotNetCoreCSharpCommandArgs {} {
    set path [getDotNetCoreSdkPath]

    if {[string length $path] > 0} then {
      set compilerFileName [file normalize [file join \
          $path Roslyn bincore csc.dll]]

      if {[file exists $compilerFileName]} then {
        return [list dotnet exec [appendArgs \
            \" [file nativename $compilerFileName] \"]]; # EXEMPT
      }
    }

    return [list]
  }

  #
  # NOTE: This procedure is used to format an option to the C# compiler.  It
  #       may have a name and/or a value.  This procedure should not raise
  #       script errors.
  #
  proc formatCompilerArgument { name value } {
    set wrap ""

    if {[regexp -- {\s} $name] || [regexp -- {\s} $value]} then {
      set wrap \"
    }

    if {[string length $name] > 0} then {
      if {[string length $value] > 0} then {
        return [appendArgs $wrap $name : $value $wrap]
      } else {
        return [appendArgs $wrap $name $wrap]
      }
    } else {
      if {[string length $value] > 0} then {
        return [appendArgs $wrap $value $wrap]
      } else {
        return ""
      }
    }
  }

  #
  # NOTE: This procedure is used to translate a name/value pair into zero or
  #       more options to the C# compiler.  This procedure should not raise
  #       script errors.
  #
  proc compilerParameterToArguments {
          name {value ""} {outputAssemblyVarName ""} } {
    switch -exact -nocase -- $name {
      WarningLevel {
        set name -warn
      }
      TreatWarningsAsErrors {
        set name -warnaserror
      }
      GenerateExecutable {
        set name -target

        if {[string is true -strict $value]} then {
          set value exe
        } else {
          set value library
        }
      }
      MainClass -
      MainEntryPoint -
      StartupObject {
        set name -main
      }
      OutputAssembly {
        if {[string length $outputAssemblyVarName] > 0} then {
          #
          # HACK: This compiler parameter is handled by our caller; however,
          #       we want to honor the value specified via the OutputAssembly
          #       property.  Therefore, reset the specified variable from the
          #       caller to the new value.
          #
          upvar 1 $outputAssemblyVarName outputAssembly

          #
          # NOTE: Use the file name value specified by the caller verbatim.
          #
          set outputAssembly $value

          #
          # HACK: Also, make sure that we do not handle this parameter again,
          #       below.
          #
          set name ""; set value ""
        } else {
          #
          # BUGBUG: Translate the compiler parameter; however, this may not
          #         actually work, depending on how our caller handles its
          #         output assembly file name.  At the time this block was
          #         originally written (2018-04-09), the only caller (i.e.
          #         [compileViaDotNetCoreCSharp]) always passed the output
          #         assembly variable name, making this a non-issue.  This
          #         convention should also be followed by future callers of
          #         this procedure.
          #
          set name -out
        }
      }
      ReferencedAssemblies.Add {
        set name -reference

        if {[file pathtype $value] ne "absolute"} then {
          set value [file nativename [file normalize \
              [file join [getDotNetStandardReferencePath] \
              $value]]]
        }
      }
    }

    set formatted [formatCompilerArgument $name $value]

    if {[string length $formatted] > 0} then {
      return [list $formatted]
    } else {
      return [list]
    }
  }

  #
  # NOTE: This procedure is used to obtain the base command line options for
  #       the C# compiler, including those that may be enabled by default.
  #       An empty string may be returned.  This procedure should not raise
  #       script errors.
  #
  proc getCSharpCompilerOptions { parameters library csharp prefix } {
    #
    # NOTE: Make sure that the "standard" preprocessor defines match those
    #       for the platform (i.e. the ones used to compile the Eagle core
    #       library assembly).  This caller may disable this handling.
    #
    if {$library} then {
      set libraryOptions [expr { \
          [info exists ::eagle_platform(compileOptions)] ? \
          $::eagle_platform(compileOptions) : [list] \
      }]
    } else {
      set libraryOptions [list]
    }

    #
    # NOTE: Permit extra C# compiler options to be passed via the global
    #       array element "csharpOptions", if it exists.  This caller may
    #       disable this handling.
    #
    if {$csharp} then {
      set csharpOptions [expr { \
          [info exists ::eagle_platform(csharpOptions)] ? \
          $::eagle_platform(csharpOptions) : [list] \
      }]
    } else {
      set csharpOptions [list]
    }

    #
    # NOTE: Start out with no compiler options.
    #
    set result ""

    #
    # NOTE: Grab the existing compiler options, if any.  This caller may
    #       disable this handling (e.g. by specifying an invalid opaque
    #       object handle for the "parameters" argument).
    #
    if {[isNonNullObjectHandle $parameters]} then {
      if {[string length $result] > 0} then {
        append result " "
      }

      append result [$parameters CompilerOptions]
    }

    #
    # NOTE: Are there any Eagle core library options to check?
    #
    if {[llength $libraryOptions] > 0} then {
      #
      # NOTE: Was the Eagle core library built in the Debug configuration?
      #
      if {"DEBUG" in $libraryOptions} then {
        if {[string length $result] > 0} then {
          append result " "
        }

        append result $prefix define:DEBUG
      }

      #
      # NOTE: Was the Eagle core library built with tracing enabled (i.e.
      #       this allows for use of System.Diagnostics.Trace, etc)?
      #
      if {"TRACE" in $libraryOptions} then {
        if {[string length $result] > 0} then {
          append result " "
        }

        append result $prefix define:TRACE
      }
    }

    #
    # NOTE: Are there any extra C# compiler options to add?
    #
    if {[llength $csharpOptions] > 0} then {
      #
      # NOTE: Append the configured extra C# compiler options configured
      #       via the global array element "csharpOptions", if any.
      #
      foreach csharpOption $csharpOptions {
        if {[string length $result] > 0} then {
          append result " "
        }

        append result $prefix $csharpOption
      }
    }

    return $result
  }

  #
  # NOTE: This procedure is used to escape all characters in the specified
  #       string for use inside of a regular expression.  An empty string
  #       may be returned.  This procedure should not raise script errors.
  #
  proc regexpEscapeAll { value } {
    set result ""

    foreach char [split $value ""] {
      append result \\u [format %04X [string ordinal $char 0]]
    }

    return $result
  }

  #
  # NOTE: This procedure is used to execute the C# compiler and returns its
  #       platform normalized results.
  #
  proc runDotNetCSharpCommand { command } {
    #
    # NOTE: Evaluate the [exec] command constructed by our caller, in their
    #       context, and return the results, with line-endings normalized.
    #
    csharpLog [appendArgs "running C# command: " $command]
    return [string map [list \r\n \n] [uplevel 1 $command]]
  }

  #
  # NOTE: This procedure is used to extract the C# compiler error messages
  #       from its results.  An empty list will be returned if the errors
  #       cannot be determined for some reason.  This procedure should not
  #       raise script errors.
  #
  proc extractCSharpErrors { fileName results } {
    set list [list]

    foreach {dummy match} [regexp -all -line -inline -- \
        [appendArgs (^(?: [regexpEscapeAll $fileName] \
        {\(\d+,\d+\): )?error CS\d{4}: [^\n]+$)}] $results] {
      lappend list $match
    }

    return $list
  }

  #
  # NOTE: This procedure is used to extract the C# compiler warning messages
  #       from its results.  An empty list will be returned if the warnings
  #       cannot be determined for some reason.  This procedure should not
  #       raise script errors.
  #
  proc extractCSharpWarnings { fileName results } {
    set list [list]

    foreach {dummy match} [regexp -all -line -inline -- \
        [appendArgs (^(?: [regexpEscapeAll $fileName] \
        {\(\d+,\d+\): )?warning CS\d{4}: [^\n]+$)}] $results] {
      lappend list $match
    }

    return $list
  }

  #
  # NOTE: This procedure is used to dynamically compile arbitrary C# code
  #       from within a script using the CSharpCodeProvider class present
  #       in the desktop .NET Framework.  It may work on some versions of
  #       Mono as well.  This procedure was originally designed to be used
  #       by the test suite; however, it can be quite useful in non-test
  #       scripts as well.
  #
  proc compileViaCSharpCodeProvider {
          string memory symbols strict resultsVarName errorsVarName args } {
    #
    # NOTE: The [object] command is required by this procedure.  If it
    #       is not available, bail out now.
    #
    if {[llength [info commands object]] == 0} then {
      #
      # NOTE: We cannot even attempt to compile anything, fail.
      #
      set code Error

      #
      # NOTE: Prepare to transfer error messages to the caller.
      #
      if {[string length $errorsVarName] > 0} then {
        upvar 1 $errorsVarName local_errors
      }

      #
      # NOTE: Append to the list of errors.
      #
      lappend local_errors "cannot compile, missing \"object\" command"

      #
      # NOTE: Return the overall result to the caller.
      #
      return [list $code]
    }

    #
    # NOTE: Create the C# code provider object (i.e. the compiler).
    #
    set provider [object create -alias Microsoft.CSharp.CSharpCodeProvider]

    #
    # NOTE: Create the object that provides various parameters to the C#
    #       code provider (i.e. the compiler options).
    #
    set parameters [object create -alias \
        System.CodeDom.Compiler.CompilerParameters]

    #
    # HACK: Pre-check the list of extra parameters now.  If it will change
    #       the assembly to an executable, use that file extension instead.
    #
    set outputExtension [object invoke \
        Eagle._Constants.FileExtension Library]

    foreach {name value} $args {
      if {[string equal $name GenerateExecutable] && \
          [string is true -strict $value]} then {
        set outputExtension [object invoke \
            Eagle._Constants.FileExtension Executable]

        break
      }
    }

    #
    # NOTE: Do we not want to persist the generated assembly to disk?
    #       Either way, we must make sure the temporary file names used
    #       are determinstic (i.e. from our perspective, so that we can
    #       delete them later).
    #
    $parameters OutputAssembly [set outputFileName [appendArgs [set \
        tempName(1) [file tempname]] $outputExtension]]

    if {$memory} then {
      $parameters GenerateInMemory true
    }

    #
    # NOTE: Use a try/finally block to cleanup temporary files.
    #
    try {
      #
      # NOTE: Do we want symbols to be generated for the generated assembly?
      #
      if {$symbols} then {
        $parameters IncludeDebugInformation true
      }

      #
      # NOTE: Start out the compiler options with the pre-existing defaults
      #       for the compiler followed by those necessary for the platform.
      #
      $parameters CompilerOptions \
          [getCSharpCompilerOptions $parameters true true /]

      #
      # NOTE: Process extra compiler settings the caller may have provided.
      #
      foreach {name value} $args {
        $parameters -nocase $name $value
      }

      #
      # NOTE: Prepare to transfer the object reference to the caller.  We
      #       must use [upvar] here because otherwise the object is lost
      #       when the procedure call frame is cleaned up.
      #
      if {[string length $resultsVarName] > 0} then {
        upvar 1 $resultsVarName results
      }

      #
      # NOTE: Attempt to compile the specified string as C# and capture the
      #       results into the variable provided by the caller.
      #
      csharpLog "compileViaCSharpCodeProvider parameters: " $parameters

      try {
        if {[info exists ::compileCSharp(preProcess)]} then {
          eval $::compileCSharp(preProcess); # pre-compilation HOOK
        }

        set results [$provider \
            -alias CompileAssemblyFromSource $parameters $string]
      } finally {
        if {[info exists ::compileCSharp(postProcess)]} then {
          eval $::compileCSharp(postProcess); # post-compilation HOOK
        }
      }

      #
      # NOTE: We no longer need the C# code provider object (i.e. the
      #       compiler); therefore, dispose it now.
      #
      unset provider; # dispose

      #
      # NOTE: Fetch the collection of compiler errors (which may be empty).
      #
      set errors [$results -alias Errors]

      #
      # NOTE: It is assumed that no assembly was generated if there were
      #       any compiler errors.  Ignore all compiler warnings unless
      #       we are in strict mode.
      #
      if {[$errors HasErrors] || \
          ($strict && [$errors HasWarnings])} then {
        #
        # NOTE: Compilation of the assembly failed.
        #
        set code Error

        #
        # NOTE: Prepare to transfer error messages to the caller.
        #
        if {[string length $errorsVarName] > 0} then {
          upvar 1 $errorsVarName local_errors
        }

        #
        # NOTE: Grab each error object and append the string itself to
        #       the overall list of errors.
        #
        for {set index 0} {$index < [$errors Count]} {incr index} {
          #
          # NOTE: Get the compiler error object at this index.
          #
          set error [$errors -alias Item $index]

          #
          # NOTE: Convert it to a string and append it to the list of
          #       errors.
          #
          lappend local_errors [getStringFromObjectHandle $error]

          #
          # NOTE: Since the error itself is actually an object, we must
          #       dispose it.
          #
          unset error; # dispose
        }
      } else {
        #
        # NOTE: Compilation of the assembly succeeded.
        #
        set code Ok
      }

      #
      # NOTE: We no longer need the compiler errors collection; therefore,
      #       dispose it now.
      #
      unset errors; # dispose

      #
      # HACK: *BREAKING CHANGE* If there is an output file name, return it
      #       as well; otherwise, just return success.
      #
      if {!$memory && [string length $outputFileName] > 0} then {
        #
        # NOTE: Return a two element list: the first element is the overall
        #       result and the second element is the output file name.
        #
        return [list $code $outputFileName]
      } else {
        #
        # NOTE: Return the overall result to the caller.
        #
        return [list $code]
      }
    } finally {
      #
      # NOTE: Make sure the created temporary files are cleaned up unless we
      #       are forbidden from doing so.
      #
      if {![info exists ::no(deleteCompileCSharpFiles)]} then {
        #
        # NOTE: Make sure the dummy temporary files are cleaned up.
        #
        if {[array exists tempName]} then {
          foreach tempFileName [array values tempName] {
            if {[string length $tempFileName] > 0} then {
              if {$memory} then {
                #
                # NOTE: When operating in in-memory generation mode, delete
                #       all the temporary files associated with the original
                #       allocated temporary name.  This includes the ".dll",
                #       the ".pdb" (if any), and the empty "dummy" file that
                #       contains nothing.
                #
                foreach deleteFileName [glob -nocomplain \
                    [appendArgs [file normalize $tempFileName] *]] {
                  if {[file exists $deleteFileName]} then {
                    catch {file delete $deleteFileName}
                  }
                }
              } else {
                #
                # NOTE: Delete the empty "dummy" file that contains nothing.
                #       The actual compiled assembly has a ".dll" suffix and
                #       its symbols, if any, have a ".pdb" suffix.
                #
                catch {file delete $tempFileName}
              }
            }
          }
        }
      }
    }
  }

  #
  # NOTE: This procedure is used to dynamically compile arbitrary C# code
  #       from within a script using the command line C# compiler provided
  #       by the .NET Core SDK.  This procedure was originally designed to
  #       be used by the test suite; however, it can be quite useful in
  #       non-test scripts as well.
  #
  proc compileViaDotNetCoreCSharp {
          string memory symbols strict resultsVarName errorsVarName args } {
    #
    # NOTE: Get the initial command line arguments needed to invoke the C#
    #       compiler on .NET Core.  If this ends up being invalid, nothing
    #       else can be done.
    #
    set command [getDotNetCoreCSharpCommandArgs]

    if {[llength $command] == 0} then {
      #
      # NOTE: We cannot even attempt to compile anything, fail.
      #
      set code Error

      #
      # NOTE: Prepare to transfer error messages to the caller.
      #
      if {[string length $errorsVarName] > 0} then {
        upvar 1 $errorsVarName local_errors
      }

      #
      # NOTE: Append to the list of errors.
      #
      lappend local_errors "cannot compile, C# compiler was not found"

      #
      # NOTE: Return the overall result to the caller.
      #
      return [list $code]
    }

    #
    # NOTE: Insert the [exec] command before the command line arguments.
    #       The -success option is not used here because we want to handle
    #       errors (only) by processing the compiler output.
    #
    set command [linsert $command 0 exec --]

    #
    # NOTE: Start out the compiler options with the pre-existing defaults
    #       for the compiler followed by those necessary for the platform.
    #
    append command " " [getCSharpCompilerOptions "" true true -]

    #
    # NOTE: Allocate a couple temporary file names, one to hold the source
    #       code to compile and one to hold the generated assembly.
    #
    set sourceFileName [appendArgs [set tempName(1) [file tempname]] .cs]

    #
    # HACK: Pre-check the list of extra parameters now.  If it will change
    #       the assembly to an executable, use that file extension instead.
    #
    set outputExtension .dll; # HACK: Always DLL on .NET Core.

    set outputFileName [appendArgs \
        [set tempName(2) [file tempname]] $outputExtension]

    #
    # NOTE: Use a try/finally block to cleanup temporary files.
    #
    try {
      #
      # NOTE: Process extra compiler settings the caller may have provided.
      #
      foreach {name value} $args {
        set nameValueArguments \
            [compilerParameterToArguments $name $value outputFileName]

        if {[llength $nameValueArguments] > 0} then {
          eval lappend command $nameValueArguments
        }
      }

      #
      # NOTE: Make the compiler output a little quieter.  This is needed
      #       to maintain compatibility with the results generated by the
      #       [compileViaCSharpCodeProvider] procedure.
      #
      lappend command -nologo

      #
      # NOTE: Always build as a library so that we do not require a static
      #       Main method.
      #
      if {[lsearch -glob -- $command -target:*] == -1} then {
        lappend command -target:library
      }

      #
      # NOTE: If symbols are enabled, add the necessary command line
      #       argument.
      #
      if {$symbols} then {lappend command -debug}

      #
      # NOTE: As of this writing (2019-10-26), the current versions of the
      #       .NET Core SDK (2.x / 3.x) use the "netstandard.dll" assembly
      #       to enable use of the .NET Standard 2.x reference library.
      #
      lappend command [formatCompilerArgument -reference [file nativename \
          [file normalize [file join [getDotNetStandardReferencePath] \
          netstandard.dll]]]]

      #
      # NOTE: Set the output assembly file name to the temporary output
      #       file name we obtained from [file tempname] above.
      #
      lappend command [formatCompilerArgument -out [file nativename [file \
          normalize $outputFileName]]]

      #
      # NOTE: Set the source code file name to the temporary source code
      #       file name we obtained from [file tempname] above.
      #
      lappend command [formatCompilerArgument "" [file nativename [file \
          normalize $sourceFileName]]]

      #
      # NOTE: First, write the specified string (containing C# code) to
      #       the temporary source code file.
      #
      writeFile $sourceFileName $string

      #
      # NOTE: Attempt to compile the temporary file as C# and capture the
      #       results into the variable provided by the caller.  Since the
      #       results are text, normalize line endings before extracting
      #       the compiler errors and/or warnings.
      #
      try {
        if {[info exists ::compileCSharp(preProcess)]} then {
          eval $::compileCSharp(preProcess); # pre-compilation HOOK
        }

        set local_results [runDotNetCSharpCommand $command]
      } finally {
        if {[info exists ::compileCSharp(postProcess)]} then {
          eval $::compileCSharp(postProcess); # post-compilation HOOK
        }
      }

      #
      # NOTE: Extract the compiler errors (which may be empty).
      #
      set errors [extractCSharpErrors $sourceFileName $local_results]

      #
      # NOTE: Extract the compiler warnings (which may be empty).
      #
      set warnings [extractCSharpWarnings $sourceFileName $local_results]

      #
      # NOTE: Prepare to transfer the "results" to the caller.
      #
      if {[string length $resultsVarName] > 0} then {
        upvar 1 $resultsVarName results
      }

      #
      # HACK: For backward compatibility with the results generated by
      #       the [compileViaCSharpCodeProvider] procedure, we must now
      #       set the results to an obviously fake opaque object handle
      #       that still matches the normal pattern.
      #
      set results System#CodeDom#Compiler#CompilerResults#0

      #
      # NOTE: It is assumed that no assembly was generated if there were
      #       any compiler errors.  Ignore all compiler warnings unless
      #       we are in strict mode.
      #
      if {[llength $errors] > 0 || \
          ($strict && [llength $warnings] > 0)} then {
        #
        # NOTE: Compilation of the assembly failed.
        #
        set code Error

        #
        # NOTE: Prepare to transfer error messages to the caller.
        #
        if {[string length $errorsVarName] > 0} then {
          upvar 1 $errorsVarName local_errors
        }

        #
        # NOTE: If there are compiler errors, add them to the list now.
        #
        if {[llength $errors] > 0} then {
          eval lappend local_errors $errors
        }

        #
        # NOTE: If there are compiler warnings, add them to the list now.
        #
        if {[llength $warnings] > 0} then {
          eval lappend local_errors $warnings
        }
      } else {
        #
        # NOTE: If the generated assembly was supposed to be loaded into
        #       memory, try to do that now.
        #
        if {$memory} then {
          #
          # HACK: In order to load the newly compiled assembly into memory,
          #       the [object] command is required.  Generally, this is not
          #       an issue; however, if the [object] command is not present
          #       in the current interpreter (i.e. because it was explicitly
          #       removed, etc), we cannot succeed.
          #
          if {[llength [info commands object]] > 0} then {
            #
            # NOTE: At this point, the output file must exist.  If not,
            #       something is very wrong (i.e. C# compilation failed
            #       and we somehow did not detect it).
            #
            if {[string length $outputFileName] > 0 && \
                [file exists $outputFileName]} then {
              try {
                set stream [object create \
                    System.IO.FileStream $outputFileName Open Read None]

                set assembly [object load -loadtype Stream $stream]
              } finally {
                if {[info exists assembly]} then {
                  unset -nocomplain assembly
                }

                if {[info exists stream]} then {
                  unset -nocomplain stream
                }
              }

              #
              # NOTE: Compilation and loading of the assembly succeeded.
              #
              set code Ok
            } else {
              #
              # NOTE: Compilation of the assembly may not have succeeded
              #       because the output file is missing.
              #
              set code Error

              #
              # NOTE: Prepare to transfer error messages to the caller.
              #
              if {[string length $errorsVarName] > 0} then {
                upvar 1 $errorsVarName local_errors
              }

              #
              # NOTE: Inform caller why we could not load the compiled
              #       assembly into memory.
              #
              lappend local_errors [appendArgs \
                  "cannot load compiled assembly \"" $outputFileName \
                  "\" into memory, compiled assembly file is missing"]
            }
          } else {
            #
            # NOTE: Compilation of the assembly succeeded; however, it
            #       cannot be loaded, due to the [object] command being
            #       missing.
            #
            set code Error

            #
            # NOTE: Prepare to transfer error messages to the caller.
            #
            if {[string length $errorsVarName] > 0} then {
              upvar 1 $errorsVarName local_errors
            }

            #
            # NOTE: Inform caller why we could not load the compiled
            #       assembly into memory.
            #
            lappend local_errors [appendArgs \
                "cannot load compiled assembly \"" $outputFileName \
                "\" into memory, missing \"object\" command"]
          }
        } else {
          #
          # NOTE: Compilation of the assembly succeeded -AND- there is
          #       no need to load it into memory.
          #
          set code Ok
        }
      }
    } finally {
      #
      # NOTE: Make sure the created temporary files are cleaned up unless we
      #       are forbidden from doing so.
      #
      if {![info exists ::no(deleteCompileCSharpFiles)]} then {
        #
        # NOTE: Delete the temporary file name used to hold the source code.
        #
        if {[string length $sourceFileName] > 0 && \
            [file exists $sourceFileName]} then {
          catch {file delete $sourceFileName}
        }

        #
        # NOTE: Make sure the dummy temporary files are cleaned up.  This is
        #       done only if the caller requested in-memory generation.
        #
        if {[array exists tempName]} then {
          foreach tempFileName [array values tempName] {
            if {[string length $tempFileName] > 0} then {
              if {$memory} then {
                #
                # NOTE: When operating in in-memory generation mode, delete
                #       all the temporary files associated with the original
                #       allocated temporary name.  This includes the ".dll",
                #       the ".pdb" (if any), and the empty "dummy" file that
                #       contains nothing.
                #
                foreach deleteFileName [glob -nocomplain \
                    [appendArgs [file normalize $tempFileName] *]] {
                  if {[file exists $deleteFileName]} then {
                    catch {file delete $deleteFileName}
                  }
                }
              } else {
                #
                # NOTE: Delete the empty "dummy" file that contains nothing.
                #       The actual compiled assembly has a ".dll" suffix and
                #       its symbols, if any, have a ".pdb" suffix.
                #
                catch {file delete $tempFileName}
              }
            }
          }
        }
      }
    }

    #
    # HACK: *BREAKING CHANGE* If there is an output file name, return it
    #       as well; otherwise, just return success.
    #
    if {!$memory && [string length $outputFileName] > 0} then {
      #
      # NOTE: Return a two element list: the first element is the overall
      #       result and the second element is the output file name.
      #
      return [list $code $outputFileName]
    } else {
      #
      # NOTE: Return the overall result to the caller.
      #
      return [list $code]
    }
  }

  #
  # NOTE: This procedure is used to dynamically compile arbitrary C# code
  #       from within a script.  This procedure was originally designed to
  #       be used by the test suite; however, it can be quite useful in
  #       non-test scripts as well.
  #
  proc compileCSharp {
          string memory symbols strict resultsVarName errorsVarName args } {
    if {[isDotNetCore]} then {
      return [uplevel 1 [list \
          compileViaDotNetCoreCSharp $string $memory $symbols $strict \
          $resultsVarName $errorsVarName] $args]
    } else {
      return [uplevel 1 [list \
          compileViaCSharpCodeProvider $string $memory $symbols $strict \
          $resultsVarName $errorsVarName] $args]
    }
  }

  #
  # NOTE: Provide the Eagle "C#" package to the interpreter.
  #
  package provide Eagle.CSharp \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/database.eagle.



































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
###############################################################################
#
# database.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Database Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This procedure returns the value of the specified database column
  #       within the specified database row value, optionally wrapping the
  #       returned value with another string -OR- returning the specified
  #       default value when the specified database column is not found.
  #
  proc getColumnValue { row column {default ""} {wrap ""} } {
    #
    # NOTE: Start with the default value.
    #
    set result $default

    #
    # NOTE: Locate the index of the named column we are interested in.
    #       This requires Tcl 8.5 (or higher) or Eagle.
    #
    set index [lsearch -exact -index 0 $row $column]

    #
    # NOTE: Did we find the column name in the row?
    #
    if {$index != -1} then {
      #
      # NOTE: Grab the column value.
      #
      set result [appendArgs $wrap [lindex [lindex $row $index] end] $wrap]
    }

    return $result
  }

  #
  # NOTE: This procedure returns the value of the specified database column
  #       within the specified array of database row values, optionally
  #       wrapping the returned value with another string -OR- returning
  #       the specified default value when the specified database column is
  #       not found.
  #
  proc getRowColumnValue { varName id column {default ""} {wrap ""} } {
    #
    # NOTE: Start with the default value.
    #
    set result $default

    #
    # NOTE: We need acccess to the result array (from the context of the
    #       caller).
    #
    upvar 1 $varName rows

    #
    # NOTE: Make sure we have the first result row.
    #
    if {[info exists rows($id)]} then {
      #
      # NOTE: Grab the entire row we are interested in.
      #
      set row $rows($id)

      #
      # NOTE: Grab the value at the specified column.
      #
      set result [getColumnValue $row $column $default $wrap]
    }

    return $result
  }

  #
  # NOTE: Provide the Eagle "database" package to the interpreter.
  #
  package provide Eagle.Database \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/embed.eagle.



















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
###############################################################################
#
# embed.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Application Embedding Initialization File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# STUB: This script file is a placeholder.  This file, when present, is always
#       evaluated when an interpreter is initialized.  Applications embedding
#       Eagle can place custom application-specific, interpreter-specific
#       initialization and/or customizations in here.  Additionally, this file
#       may contain per-interpreter customizations required when porting to
#       new platforms, operating systems, etc.
#


Added Externals/Eagle/lib/Eagle1.0/exec.eagle.



















































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
###############################################################################
#
# exec.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Execute Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This procedure returns the fully qualified file name for the shell
  #       executable, which is a native executable -OR- a managed assembly.
  #
  proc getShellExecutableName {} {
    #
    # NOTE: Check for native Tcl, Mono, and .NET Core because this impacts
    #       how the shell executable name is determined.
    #
    if {[isEagle]} then {
      if {[isMono] || [isDotNetCore]} then {
        return [lindex [info assembly true] 1]; # Mono -OR- .NET Core
      } else {
        return [info nameofexecutable]; # .NET Framework
      }
    } else {
      return [info nameofexecutable]; # native Tcl
    }
  }

  #
  # NOTE: This procedure returns a list with the command line arguments that
  #       are necessary to run an executable using the current runtime, e.g.
  #       native Tcl -OR- Eagle on the .NET Framework, Mono, or .NET Core.
  #
  proc getRuntimeCommandLine { fileName } {
    #
    # NOTE: Only the base portion of the command line arguments are returned
    #       from this procedure, i.e. we do not return the [exec] command or
    #       its options, nor are subsequent arguments for the target command
    #       included.
    #
    set result [list]

    if {[isEagle]} then {
      #
      # NOTE: Ok, running on Eagle, not native Tcl.  Check the runtime.
      #
      if {[isMono]} then {
        #
        # HACK: Assume that Mono is somewhere along the PATH.  Insert the
        #       "mono" command line argument followed by our entry assembly
        #       name.
        #
        lappend result mono \
            [appendArgs \" [file nativename $fileName] \"]
      } elseif {[isDotNetCore]} then {
        #
        # HACK: When running on .NET Core, we need to insert "dotnet exec"
        #       command line arguments followed by our entry assembly name.
        #
        lappend result dotnet exec \
            [appendArgs \" [file nativename $fileName] \"]
      } else {
        #
        # NOTE: When running on the .NET Framework, just use the executable
        #       name as this will be the same as the entry assembly name.
        #
        lappend result \
            [appendArgs \" [file nativename $fileName] \"]
      }
    } else {
      #
      # NOTE: Assumes the native Tcl shell executable (e.g. "tclsh", etc)
      #       is somewhere along the PATH -OR- the value returned is from
      #       [info nameofexecutable] is fully qualified.
      #
      lappend result \
          [appendArgs \" [file nativename $fileName] \"]
    }

    return $result
  }

  #
  # NOTE: This procedure executes a native Tcl or Eagle sub-shell using the
  #       specified arguments and returns the captured output, verbatim.
  #
  proc execShell { options args } {
    #
    # NOTE: Start out with just the base [exec] command.
    #
    set command [list exec]

    #
    # NOTE: Add options for the [exec] command, if any.
    #
    if {[llength $options] > 0} then {
      eval lappend command $options
    }

    #
    # NOTE: Always add the end-of-options marker.
    #
    lappend command --

    #
    # NOTE: Add the necessary command line arguments to run the target
    #       file using the current runtime.
    #
    eval lappend command [getRuntimeCommandLine [getShellExecutableName]]

    #
    # NOTE: If possible, check if the current interpreter has security
    #       enabled; if so, add the appropriate command line option for
    #       the sub-process.
    #
    if {[isEagle] && [llength [info commands object]] > 0} then {
      if {[catch {
        object invoke -flags +NonPublic Interpreter.GetActive HasSecurity
      } security] == 0 && $security} then {
        lappend command -security true
      }
    }

    #
    # NOTE: Add command line arguments to the shell command, if any.
    #
    if {[llength $args] > 0} then {
      #
      # HACK: For reasons which are still unexplained, .NET Core seems
      #       to have trouble with preserving an argument value if it
      #       is an empty string (i.e. they are simply dropped).  Work
      #       around this.  Nothing fancy should be done here.  Simply
      #       using a single space instead seems to work around their
      #       problem (whatever it actually is).  Please refer to the
      #       following GitHub issue for more information:
      #
      #       https://github.com/dotnet/cli/issues/8892
      #
      if {[isEagle] && [isDotNetCore]} then {
        foreach arg $args {
          #
          # HACK: For now, only handle the cases where the argument is
          #       specified as something like {""}.
          #
          if {$arg eq "\"\""} then {
            lappend command "\" \""
          } else {
            lappend command $arg
          }
        }
      } else {
        eval lappend command $args
      }
    }

    #
    # NOTE: Finally, execute the resulting [exec] command in the context
    #       of the caller, returning its result.
    #
    return [uplevel 1 $command]
  }

  #
  # NOTE: This procedure is designed to extract the exit code for a child
  #       process run via [exec] using the value of $::errorCode.  It will
  #       always return either a valid integer -OR- the specified default
  #       value, which may be an empty string.
  #
  proc maybeGetExitCode { value {default ""} } {
    if {[lindex $value 0] eq "CHILDSTATUS"} then {
      set status [lindex $value 2]

      if {[string is integer -strict $status]} then {
        return $status
      }
    }

    return $default
  }

  #
  # NOTE: Provide the Eagle "execute" package to the interpreter.
  #
  package provide Eagle.Execute \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/file1.eagle.























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
###############################################################################
#
# file1.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle File 1 Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This procedure reconfigures the specified channel to full binary
  #       mode.
  #
  proc makeBinaryChannel { channel } {
    fconfigure $channel -encoding binary -translation binary; # BINARY DATA
  }

  #
  # NOTE: This procedure reads all data from the specified binary file and
  #       returns it.
  #
  proc readFile { fileName } {
    set channel [open $fileName RDONLY]
    makeBinaryChannel $channel
    set result [read $channel]
    close $channel
    return $result
  }

  #
  # NOTE: This procedure writes all data to the specified binary file and
  #       returns an empty string.  Previous data contained in the file,
  #       if any, is lost.
  #
  proc writeFile { fileName data } {
    set channel [open $fileName {WRONLY CREAT TRUNC}]
    makeBinaryChannel $channel
    puts -nonewline $channel $data
    close $channel
    return ""
  }

  #
  # NOTE: This procedure appends data to the specified binary file and
  #       returns an empty string.  Previous data contained in the file,
  #       if any, is preserved.
  #
  proc appendFile { fileName data } {
    set channel [open $fileName {WRONLY CREAT APPEND}]
    makeBinaryChannel $channel
    puts -nonewline $channel $data
    close $channel
    return ""
  }

  #
  # NOTE: Provide the Eagle "file" package to the interpreter.
  #
  package provide Eagle.File \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/file2.eagle.





















































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
###############################################################################
#
# file2.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle File 2 Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This procedure reconfigures the specified channel to full ASCII
  #       mode.
  #
  proc makeAsciiChannel { channel } {
    fconfigure $channel -encoding ascii -translation auto; # ASCII TEXT
  }

  #
  # NOTE: This procedure reads all data from the specified ASCII file and
  #       returns it.
  #
  proc readAsciiFile { fileName } {
    set channel [open $fileName RDONLY]
    makeAsciiChannel $channel
    set result [read $channel]
    close $channel
    return $result
  }

  #
  # NOTE: This procedure writes all data to the specified ASCII file and
  #       returns an empty string.  Previous data contained in the file,
  #       if any, is lost.
  #
  proc writeAsciiFile { fileName data } {
    set channel [open $fileName {WRONLY CREAT TRUNC}]
    makeAsciiChannel $channel
    puts -nonewline $channel $data
    close $channel
    return ""
  }

  #
  # NOTE: This procedure reconfigures the specified channel for use by the
  #       logging subsystem.
  #
  proc makeLogChannel { channel } {
    set translation [expr {[isEagle] ? "protocol" : "auto"}]
    fconfigure $channel -encoding binary -translation $translation; # LOG DATA
  }

  #
  # NOTE: This procedure appends data to the specified log data file and
  #       returns an empty string.  Previous data contained in the file,
  #       if any, is preserved.
  #
  proc appendLogFile { fileName data } {
    set channel [open $fileName {WRONLY CREAT APPEND}]
    makeLogChannel $channel
    puts -nonewline $channel $data
    close $channel
    return ""
  }

  #
  # NOTE: This procedure appends data to the specified shared log data
  #       file and returns an empty string.  Previous data contained in
  #       the file, if any, is preserved.
  #
  proc appendSharedLogFile { fileName data } {
    set command [list open $fileName {WRONLY CREAT APPEND}]

    #
    # HACK: Tcl appears to do this by default; however Eagle does not and
    #       will not.  Therefore, manually add the -share option to the
    #       command if running in Eagle.
    #
    if {[isEagle]} then {
      lappend command 0 file -share readWrite
    }

    #
    # NOTE: Open the file using the command constructed above, configure
    #       the channel for binary data, and output the data to it.
    #
    set channel [eval $command]
    makeLogChannel $channel
    puts -nonewline $channel $data; flush $channel
    close $channel
    return ""
  }

  #
  # NOTE: This procedure reads all data from the specified shared binary
  #       file and returns it.
  #
  proc readSharedFile { fileName } {
    set command [list open $fileName RDONLY]

    #
    # HACK: Tcl appears to do this by default; however Eagle does not and
    #       will not.  Therefore, manually add the -share option to the
    #       command if running in Eagle.
    #
    if {[isEagle]} then {
      lappend command 0 file -share readWrite
    }

    #
    # NOTE: Open the file using the command constructed above, configure
    #       the channel for binary data, and output the data to it.
    #
    set channel [eval $command]
    makeBinaryChannel $channel
    set result [read $channel]
    close $channel
    return $result
  }

  #
  # NOTE: This procedure appends data to the specified shared binary file
  #       and returns an empty string.  Previous data contained in the
  #       file, if any, is preserved.
  #
  proc appendSharedFile { fileName data } {
    #
    # NOTE: This should work properly in both Tcl and Eagle.
    #
    set command [list open $fileName {WRONLY CREAT APPEND}]

    #
    # HACK: Tcl appears to do this by default; however Eagle does not and
    #       will not.  Therefore, manually add the -share option to the
    #       command if running in Eagle.
    #
    if {[isEagle]} then {
      lappend command 0 file -share readWrite
    }

    #
    # NOTE: Open the file using the command constructed above, configure
    #       the channel for binary data, and output the data to it.
    #
    set channel [eval $command]
    makeBinaryChannel $channel
    puts -nonewline $channel $data; flush $channel
    close $channel
    return ""
  }

  #
  # NOTE: Provide the Eagle "file types" package to the interpreter.
  #
  package provide Eagle.File.Types \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/file2u.eagle.

































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
###############################################################################
#
# file2u.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle File 2u Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This procedure reconfigures the specified channel to full Unicode
  #       mode.
  #
  proc makeUnicodeChannel { channel } {
    fconfigure $channel -encoding unicode -translation auto; # UNICODE TEXT
  }

  #
  # NOTE: This procedure reads all data from the specified Unicode file and
  #       returns it.
  #
  proc readUnicodeFile { fileName } {
    set channel [open $fileName RDONLY]
    makeUnicodeChannel $channel
    set result [read $channel]
    close $channel
    return $result
  }

  #
  # NOTE: This procedure writes all data to the specified Unicode file and
  #       returns an empty string.  Previous data contained in the file,
  #       if any, is lost.
  #
  proc writeUnicodeFile { fileName data } {
    set channel [open $fileName {WRONLY CREAT TRUNC}]
    makeUnicodeChannel $channel
    puts -nonewline $channel $data
    close $channel
    return ""
  }

  #
  # NOTE: This procedure reconfigures the specified channel to full Unicode
  #       mode without any line-ending translations.
  #
  proc makeUnicodeBinaryChannel { channel } {
    fconfigure $channel -encoding unicode -translation binary; # UNICODE BINARY
  }

  #
  # NOTE: This procedure reads all data from the specified Unicode file and
  #       returns it.
  #
  proc readUnicodeBinaryFile { fileName } {
    set channel [open $fileName RDONLY]
    makeUnicodeBinaryChannel $channel
    set result [read $channel]
    close $channel
    return $result
  }

  #
  # NOTE: This procedure writes all data to the specified Unicode file and
  #       returns an empty string.  Previous data contained in the file,
  #       if any, is lost.
  #
  proc writeUnicodeBinaryFile { fileName data } {
    set channel [open $fileName {WRONLY CREAT TRUNC}]
    makeUnicodeBinaryChannel $channel
    puts -nonewline $channel $data
    close $channel
    return ""
  }

  #
  # NOTE: This procedure reconfigures the specified channel to full UTF-8
  #       mode.
  #
  proc makeUtf8Channel { channel } {
    fconfigure $channel -encoding utf-8 -translation auto; # UTF-8 TEXT
  }

  #
  # NOTE: This procedure reads all data from the specified UTF-8 file and
  #       returns it.
  #
  proc readUtf8File { fileName } {
    set channel [open $fileName RDONLY]
    makeUtf8Channel $channel
    set result [read $channel]
    close $channel
    return $result
  }

  #
  # NOTE: This procedure writes all data to the specified UTF-8 file and
  #       returns an empty string.  Previous data contained in the file,
  #       if any, is lost.
  #
  proc writeUtf8File { fileName data } {
    set channel [open $fileName {WRONLY CREAT TRUNC}]
    makeUtf8Channel $channel
    puts -nonewline $channel $data
    close $channel
    return ""
  }

  #
  # NOTE: Provide the Eagle UTF-8 file package to the interpreter.
  #
  package provide Eagle.File.Utf8 \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/file3.eagle.











































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
###############################################################################
#
# file3.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle File 3 Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This procedure attempts to emit a Tcl log message based on the
  #       calling procedure currently being invoked.  This procedure is
  #       explicitly designed to allow overriding via external scripts.
  #
  proc tclLogForCommand { {command ""} } {
    set level [info level]; # current procedure
    set procName [lindex [info level $level] 0]
    incr level -1; # calling procedure

    if {[string length $command] > 0} then {
      set equals [string repeat = $level]

      set suffix [appendArgs \
          " " $equals "> command \{" $command \}]

      if {[uplevel 1 [list info exists error]]} then {
        set error [uplevel 1 [list set error]]

        if {[string length $error] > 0} then {
          append suffix " " $equals "> error \{" $error \}
        }
      } elseif {[uplevel 1 [list info exists result]]} then {
        set result [uplevel 1 [list set result]]

        if {[string length $result] > 0} then {
          append suffix " " $equals "> result \{" $result \}
        }
      }
    } else {
      set suffix ""
    }

    catch {
      tclLog [string trim [appendArgs \
          $procName " (level " [format %03d $level] ") " \
          [string repeat - $level] "> \{" [info level \
          $level] \} $suffix]]
    }
  }

  #
  # NOTE: This procedure figures out extra option values for use with the
  #       "dir" command of the Windows command shell based on which types
  #       of paths are being saught.  This procedure is not explicitly
  #       designed to allow overriding via external scripts; however, it
  #       can be overridden if some care is taken to maintain compatible
  #       semantics.
  #
  proc populateTypesForComSpecDir { dirVarName fileVarName } {
    upvar 1 $dirVarName dirTypes
    upvar 1 $fileVarName fileTypes

    set dirTypes(visible) {/ad}
    set dirTypes(hidden) {/ahd}

    set fileTypes(visible) {/a-d}
    set fileTypes(hidden) {/ah-d}
  }

  #
  # NOTE: This procedure figures out what the -types option values should
  #       be to locate both visible and hidden directories and/or files.
  #       This procedure is not explicitly designed to allow overriding
  #       via external scripts; however, it can be overridden if some care
  #       is taken to maintain compatible semantics.
  #
  proc populateTypesForGlob { dirVarName fileVarName } {
    upvar 1 $dirVarName dirTypes
    upvar 1 $fileVarName fileTypes

    set dirTypes(visible) {d}
    set fileTypes(visible) {f}

    if {[isEagle]} then {
      #
      # HACK: Using "hiddenonly" requires release Beta 51 or later.
      #
      set dirTypes(hidden) {d system hidden hiddenonly}
      set fileTypes(hidden) {f system hidden hiddenonly}
    } else {
      set dirTypes(hidden) {d hidden}
      set fileTypes(hidden) {f hidden}
    }
  }

  #
  # NOTE: This procedure returns a list of paths (presumably from [glob])
  #       that have been filtered to remove those that are unwanted, e.g.
  #       the "." and ".." directories, etc.  This procedure is explicitly
  #       designed to allow overriding via external scripts.
  #
  proc filterForGlob { paths } {
    set result [list]

    foreach path $paths {
      #
      # HACK: The "in" operator for [expr] cannot be used here if we want
      #       to support Tcl 8.4.
      #
      if {[lsearch -exact [list . ..] $path] != -1} then {
        continue
      }

      lappend result $path
    }

    return $result
  }

  #
  # NOTE: This procedure returns non-zero if file and directory searches
  #       are able to use the "dir" command of the Windows command shell.
  #       This procedure is not explicitly designed to allow overriding
  #       via external scripts; however, it can be overridden if some
  #       care is taken to maintain compatible semantics.
  #
  proc canUseComSpecDir { pattern } {
    if {[info exists ::no(canUseComSpecDir)]} then {
      return false
    }

    if {![isWindows]} then {
      return false
    }

    if {![info exists ::env(ComSpec)]} then {
      return false
    }

    return true
  }

  #
  # NOTE: This procedure returns the current directory value that should be
  #       used when converting relative paths to absolute paths from within
  #       the [getDirResultPath] procedure.  This procedure is explicitly
  #       designed to allow overriding via external scripts.
  #
  proc pwdForDirResultPath { pattern path } {
    return [pwd]
  }

  #
  # NOTE: This procedure uses the type of the specified path to figure out
  #       the (possibly normalized) path to add to the finder results.
  #       This procedure is not explicitly designed to allow overriding via
  #       external scripts; however, it can be overridden if some care is
  #       taken to maintain compatible semantics.
  #
  proc getDirResultPath { pattern path } {
    if {[file pathtype $path] eq "absolute"} then {
      return [file normalize $path]
    } else {
      #
      # BUGBUG: There is not much we can do here that would be correct in
      #         all situations.  The problem is that the Windows command
      #         shell "dir" command does not return enough relative path
      #         information when invoked without the sub-directories flag.
      #
      if {[hasRuntimeOption getDirResultJoinPath]} then {
        if {![isEagle] || \
            [string is path -strict $pattern] || \
            [string is component -strict $pattern]} then {
          if {[file pathtype $pattern] eq "absolute"} then {
            set newPath [file normalize $pattern]
          } else {
            set newPath [file normalize [file join \
                [pwdForDirResultPath $pattern $path] $pattern]]
          }

          if {![file exists $newPath]} then {
            set newPath [file normalize [file join $newPath $path]]
          }
        } else {
          set newPath [file normalize [file join \
              [pwdForDirResultPath $pattern $path] $path]]
        }

        if {[file exists $newPath]} then {
          return $newPath
        }
      }

      if {[hasRuntimeOption getDirResultErrorPath]} then {
        error [appendArgs \
            "could not handle relative path \"" $path \
            "\" resulting from pattern \"" $pattern \"]
      }

      return $path
    }
  }

  #
  # NOTE: This procedure attempts to normalize the specified path in a way
  #       that (ideally) should not raise a script error.  This procedure
  #       is explicitly designed to allow overriding via external scripts.
  #
  proc fileNormalizeForGlob { path } {
    if {[isEagle]} then {
      #
      # HACK: Possibly disable the legacy path resolution to avoid raising
      #       any script errors.
      #
      # TODO: This is (probably) not quite robust enough to handle all of
      #       the possible corner cases.
      #
      if {[string is path -strict $path] || \
          [string is component -strict $path]} then {
        return [file normalize -legacy true $path]
      } else {
        return [file normalize -legacy false $path]
      }
    } else {
      #
      # BUGBUG: Can this really not raise a script error in Tcl?
      #
      return [file normalize $path]
    }
  }

  #
  # NOTE: This procedure performs [glob] using specified types, directory,
  #       and pattern.  This procedure is not explicitly designed to allow
  #       overriding via external scripts; however, it can be overridden
  #       if some care is taken to maintain compatible semantics.
  #
  proc performGlob { types directory pattern } {
    if {[hasRuntimeOption tracePerformGlob]} then {
      tclLogForCommand
    }

    return [filterForGlob [glob -nocomplain -types \
        $types [fileNormalizeForGlob [file join $directory \
        $pattern]]]]
  }

  #
  # NOTE: This procedure works around the lack of the -nocase option to the
  #       native Tcl interpreter for versions before 8.5.  It should not be
  #       used by external callers.  This procedure is not explicitly
  #       designed to allow overriding via external scripts; however, it
  #       can be overridden if some care is taken to maintain compatible
  #       semantics.
  #
  proc maybeAppendPathResult { listVarName element } {
    upvar 1 $listVarName list

    if {[isEagle]} then {
      if {[lsearch -variable -exact -nocase list $element] == -1} then {
        lappend list $element
      }
    } else {
      if {[info exists ::tcl_version] && $::tcl_version >= 8.5} then {
        if {![info exists list] || \
            [lsearch -exact -nocase $list $element] == -1} then {
          lappend list $element
        }
      } else {
        if {![info exists list] || [lsearch -exact [string \
            tolower $list] [string tolower $element]] == -1} then {
          lappend list $element
        }
      }
    }

    return ""
  }

  #
  # NOTE: This procedure attempts to find files and directories within a
  #       specific parent directory.  It can optionally use recursion to
  #       traverse into sub-directories matching a specific pattern.  It
  #       can find visible items, hidden items, or both.  To find both,
  #       an empty string should be passed for the "hidden" argument.
  #
  proc findViaGlob {
          directory traversePattern wantPattern wantDirs wantFiles hidden
          recursive allowEmpty allowFiltered {callback ""} } {
    set result [list]

    if {($allowEmpty || [string length $wantPattern] > 0) && \
        ($allowFiltered || [llength [filterForGlob [list \
        $wantPattern]]] > 0)} then {
      populateTypesForGlob dirTypes fileTypes

      foreach type [list visible hidden] {
        set wantHidden [expr {
          $type eq "hidden" ? "true" : "false"
        }]

        if {[string length $hidden] == 0 || \
            [string is $wantHidden -strict $hidden]} then {
          if {$recursive && \
              [string length $traversePattern] > 0 && \
              [info exists dirTypes($type)]} then {
            if {[catch {
              performGlob $dirTypes($type) $directory \
                  $traversePattern
            } list] == 0} then {
              foreach subDirectory $list {
                eval lappend result [findViaGlob \
                    $subDirectory $traversePattern \
                    $wantPattern $wantDirs $wantFiles \
                    $hidden $recursive $allowEmpty \
                    $allowFiltered $callback]
              }
            }
          }

          if {[string length $wantPattern] > 0} then {
            if {$wantDirs && \
                [info exists dirTypes($type)]} then {
              if {[catch {
                performGlob $dirTypes($type) $directory \
                    $wantPattern
              } list] == 0} then {
                if {[string length $callback] == 0} then {
                  eval lappend result $list
                } else {
                  foreach element $list {
                    if {[$callback $callback \
                        $type directory $element]} then {
                      lappend result $element
                    }
                  }
                }
              }
            }

            if {$wantFiles && \
                [info exists fileTypes($type)]} then {
              if {[catch {
                performGlob $fileTypes($type) $directory \
                    $wantPattern
              } list] == 0} then {
                if {[string length $callback] == 0} then {
                  eval lappend result $list
                } else {
                  foreach element $list {
                    if {[$callback $callback \
                        $type file $element]} then {
                      lappend result $element
                    }
                  }
                }
              }
            }
          }
        }
      }
    }

    return $result
  }

  #
  # NOTE: This procedure attempts to find files and directories within a
  #       specific parent directory.  It can optionally use recursion to
  #       traverse into sub-directories matching a specific pattern.  It
  #       can find visible items, hidden items, or both.  To find both,
  #       an empty string should be passed for the "hidden" argument.
  #
  proc findViaComSpecDir {
          directory pattern wantDirs wantFiles hidden recursive
          allowEmpty allowFiltered } {
    set result [list]

    if {[canUseComSpecDir $pattern] && ($allowEmpty || [string length \
        $pattern] > 0) && ($allowFiltered || [llength [filterForGlob \
        [list $pattern]]] > 0)} then {
      set path ""

      if {[isEagle]} then {
        makeVariableFast result true; makeVariableFast path true
      }

      set types [list]

      if {[string length $hidden] > 0} then {
        if {[string is false -strict $hidden]} then {
          lappend types visible
        }

        if {[string is true -strict $hidden]} then {
          lappend types hidden
        }
      } else {
        lappend types visible hidden
      }

      set subTypes [list]

      if {$wantDirs} then {lappend subTypes directory}
      if {$wantFiles} then {lappend subTypes file}

      populateTypesForComSpecDir dirTypes fileTypes

      foreach type $types {
        foreach subType $subTypes {
          set wantVarName [expr {
            $subType eq "directory" ? \
                [appendArgs dirTypes( $type )] : \
                [appendArgs fileTypes( $type )]
          }]

          if {[info exists $wantVarName]} then {
            set command [list exec]

            if {[isEagle]} then {lappend command -unicode}

            lappend command $::env(ComSpec)
            if {[isEagle]} then {lappend command /u}
            lappend command /c

            if {[string length $directory] > 0 && \
                [lsearch -exact [list . ..] $directory] == -1} then {
              lappend command cd

              if {[isEagle]} then {
                lappend command [appendArgs \
                    \" [file nativename $directory] \"]
              } else {
                lappend command [file nativename $directory]
              }

              lappend command &&
            }

            lappend command dir /b
            if {$recursive} then {lappend command /s}
            lappend command [set $wantVarName]

            if {[string length $pattern] > 0} then {
              if {[isEagle]} then {
                lappend command [appendArgs \
                    \" [file nativename $pattern] \"]
              } else {
                lappend command [file nativename $pattern]
              }
            }

            if {[hasRuntimeOption traceFindViaComSpecDir]} then {
              tclLogForCommand $command
            }

            if {[catch $command exec] == 0} then {
              foreach path [split $exec \n] {
                set path [string trim $path]

                if {[string length $path] > 0} then {
                  set path [getDirResultPath $pattern $path]
                  maybeAppendPathResult result $path
                }
              }
            }
          }
        }
      }
    }

    return $result
  }

  #
  # NOTE: This procedure may return directory name information that may be
  #       present in the specified pattern.  If the directory name does not
  #       represent an absolute path, an empty string is returned instead.
  #       This procedure is explicitly designed to allow overriding via
  #       external scripts.
  #
  proc fileDirNameForFind { pattern } {
    set result [file dirname $pattern]

    if {[string length $result] > 0 && \
        [file pathtype $result] eq "absolute"} then {
      return $result
    }

    return ""
  }

  #
  # NOTE: This procedure returns the file name portion that may be present
  #       in the specified pattern.  This procedure is explicitly designed
  #       to allow overriding via external scripts.
  #
  proc fileTailForFind { pattern } {
    if {[string length $pattern] > 0 && \
        [file pathtype $pattern] eq "absolute"} then {
      return [file tail $pattern]
    }

    return $pattern
  }

  #
  # NOTE: This procedure returns a list of directories matching the pattern
  #       specified.  It does not recurse into sub-directories.
  #
  proc findDirectories { pattern } {
    if {![info exists ::no(findForEagle)] && \
        ![info exists ::no(findDirectoriesForEagle)] && \
        [isEagle]} then {
      if {![canUseComSpecDir $pattern] || \
          [hasRuntimeOption findViaGlob]} then {
        return [findViaGlob \
            [fileDirNameForFind $pattern] * \
            [fileTailForFind $pattern] \
            true false "" false false false]
      } else {
        return [findViaComSpecDir \
            [fileDirNameForFind $pattern] \
            $pattern true false "" false \
            false false]
      }
    } else {
      if {[canUseComSpecDir $pattern] && \
          [hasRuntimeOption findViaComSpecDir]} then {
        return [findViaComSpecDir \
            [fileDirNameForFind $pattern] \
            $pattern true false "" false \
            false false]
      } else {
        populateTypesForGlob dirTypes fileTypes

        set result [list]

        eval lappend result [filterForGlob [glob -nocomplain \
            -types $dirTypes(visible) [fileNormalizeForGlob \
            $pattern]]]

        eval lappend result [filterForGlob [glob -nocomplain \
            -types $dirTypes(hidden) [fileNormalizeForGlob \
            $pattern]]]

        return $result
      }
    }
  }

  #
  # NOTE: This procedure returns a list of directories matching the pattern
  #       specified.  It recurses into sub-directories.
  #
  proc findDirectoriesRecursive { pattern } {
    if {![canUseComSpecDir $pattern] || \
        [hasRuntimeOption findViaGlob]} then {
      return [findViaGlob \
          [fileDirNameForFind $pattern] * \
          [fileTailForFind $pattern] \
          true false "" true false false]
    } else {
      return [findViaComSpecDir \
          [fileDirNameForFind $pattern] \
          $pattern true false "" true \
          false false]
    }
  }

  #
  # NOTE: This procedure returns a list of files matching the pattern
  #       specified.  It does not recurse into sub-directories.
  #
  proc findFiles { pattern } {
    if {![info exists ::no(findForEagle)] && \
        ![info exists ::no(findFilesForEagle)] && \
        [isEagle]} then {
      if {![canUseComSpecDir $pattern] || \
          [hasRuntimeOption findViaGlob]} then {
        return [findViaGlob \
            [fileDirNameForFind $pattern] * \
            [fileTailForFind $pattern] false \
            true "" false false false]
      } else {
        return [findViaComSpecDir \
            [fileDirNameForFind $pattern] \
            $pattern false true "" false \
            false false]
      }
    } else {
      if {[canUseComSpecDir $pattern] && \
          [hasRuntimeOption findViaComSpecDir]} then {
        return [findViaComSpecDir \
            [fileDirNameForFind $pattern] \
            $pattern false true "" false \
            false false]
      } else {
        populateTypesForGlob dirTypes fileTypes

        set result [list]

        eval lappend result [filterForGlob [glob -nocomplain \
            -types $fileTypes(visible) [fileNormalizeForGlob \
            $pattern]]]

        eval lappend result [filterForGlob [glob -nocomplain \
            -types $fileTypes(hidden) [fileNormalizeForGlob \
            $pattern]]]

        return $result
      }
    }
  }

  #
  # NOTE: This procedure returns a list of files matching the pattern
  #       specified.  It recurses into sub-directories.
  #
  proc findFilesRecursive { pattern } {
    if {![canUseComSpecDir $pattern] || \
        [hasRuntimeOption findViaGlob]} then {
      return [findViaGlob \
          [fileDirNameForFind $pattern] * \
          [fileTailForFind $pattern] false \
          true "" true false false]
    } else {
      return [findViaComSpecDir \
          [fileDirNameForFind $pattern] \
          $pattern false true "" true \
          false false]
    }
  }

  #
  # NOTE: This procedure attempts to copy all files matching the specified
  #       source directory and patterns to the destination directory.  This
  #       procedure may raise script errors.
  #
  proc copyFilesRecursive {
          sourceDirectory targetDirectory {patterns ""} {options ""} } {
    #
    # NOTE: Block non-Windows platforms since this is Windows specific.
    #
    if {![isWindows]} then {
      error "not supported on this operating system"
    }

    #
    # NOTE: Start out with the [exec] command and the necessary options
    #       to the command.
    #
    if {[isEagle]} then {
      set command [list exec -exitcode exitCode -- robocopy]
    } else {
      set command [list exec -- robocopy]
    }

    #
    # NOTE: Add the source and target directory names.  These are always
    #       required.
    #
    if {[isEagle]} then {
      lappend command [appendArgs \" [file nativename $sourceDirectory] \"]
      lappend command [appendArgs \" [file nativename $targetDirectory] \"]
    } else {
      lappend command [file nativename $sourceDirectory]
      lappend command [file nativename $targetDirectory]
    }

    #
    # NOTE: If there are patterns specified, add them now.  By default,
    #       all files are copied (i.e. "*.*").
    #
    if {[llength $patterns] > 0} then {
      eval lappend command $patterns
    }

    #
    # NOTE: Should the default Robocopy options be excluded?  Generally,
    #       these options should not be excluded.  All matching files
    #       are copied, using restartable mode, and using extra options
    #       when running as administrator to enable copying more files
    #       and metadata, e.g. using backup mode and copying the extra
    #       file security information.
    #
    if {[lsearch -exact $options -nocopyopts] == -1} then {
      lappend command /E

      if {[isEagle] && [isAdministrator]} then {
        lappend command /ZB /COPYALL
      } else {
        lappend command /Z
      }

      lappend command /DCOPY:T
    }

    #
    # NOTE: Should we override the default number of retries per file?
    #       If no retry related option is found, the Robocopy default
    #       behavior will be used (i.e. 1 million retries per file).
    #
    if {[set index [lsearch -glob $options -retries:*]] != -1} then {
      #
      # NOTE: Grab the retry option name/value from the list of options
      #       and attempt to extract the integer number of retries from
      #       it.
      #
      set value [lindex $options $index]

      if {[regexp -- {^-retries:(\d+)$} $value dummy retries] && \
          [string is integer -strict $retries] && $retries >= 0} then {
        #
        # NOTE: Use the specified number of retries.  This value will
        #       be greater than or equal to zero and within the range
        #       of a 32-bit integer.
        #
        lappend command [appendArgs /R: $retries]
      } else {
        #
        # NOTE: The specified number of retries is somehow invalid.
        #
        error "number of retries must be a positive integer"
      }
    } elseif {[lsearch -exact $options -retry] == -1} then {
      #
      # NOTE: Fallback to setting retry count to zero, which is used
      #       to disable per-file retries.
      #
      lappend command /R:0
    }

    #
    # NOTE: By default, do not process file system junctions.  This
    #       is used to avoid the possibility of infinite loops when
    #       traversing the file system (i.e. because it is trivial
    #       to utilize file system junctions in order to construct
    #       directory trees that loop back upon themselves).
    #
    if {[lsearch -exact $options -junctions] == -1} then {
      lappend command /XJ
    }

    #
    # NOTE: By default, do not purge any files that happen to be in
    #       the target directory.
    #
    if {[lsearch -exact $options -purge] != -1} then {
      lappend command /PURGE
    }

    #
    # NOTE: By default, do not produce a verbose log files in the
    #       temporary directory.
    #
    if {[lsearch -exact $options -logging] != -1} then {
      lappend command /X /V /FP /NP

      package require Eagle.Test
      set logFileName [getTemporaryFileName]

      if {[isEagle]} then {
        lappend command [appendArgs \
            \"/LOG: [file nativename $logFileName] \"]
      } else {
        lappend command [appendArgs \
            /LOG: [file nativename $logFileName]]
      }
    }

    #
    # NOTE: Optionally emit trace to log all our command arguments.
    #
    if {[hasRuntimeOption traceCopyFilesRecursive]} then {
      tclLogForCommand $command
    }

    #
    # NOTE: Upon success, the exit code from Robocopy will be between
    #       zero and seven.  If the exit code is eight or greater, it
    #       has somehow failed and that error must be reported to the
    #       caller via raising a script error.
    #
    if {[isEagle]} then {
      #
      # NOTE: Execute the resulting [exec] command in our context and
      #       capture the results.
      #
      set result [eval $command]

      if {[info exists exitCode] && $exitCode in \
          [list Success Failure Exception 0 1 2 3 4 5 6 7]} then {
        #
        # NOTE: Return the captured output from the Robocopy command,
        #       whatever it was.  Generally, this will either be the
        #       summary and details of the files copied -OR- the log
        #       file name.
        #
        return $result
      } else {
        #
        # NOTE: Raise a script error, using the captured errors from
        #       the Robocopy command, whatever it was.
        #
        error [appendArgs \
            "command \"" $command "\" error: " $result]
      }
    } else {
      #
      # NOTE: Execute the resulting [exec] command in our context and
      #       capture the results.
      #
      if {[catch $command result] == 0 || ([info exists ::errorCode] && \
          [maybeGetExitCode $::errorCode 8] < 8)} then {
        #
        # NOTE: Return the captured output from the Robocopy command,
        #       whatever it was.  Generally, this will either be the
        #       summary and details of the files copied -OR- the log
        #       file name.
        #
        return $result
      } else {
        #
        # NOTE: Raise a script error, using the captured errors from
        #       the Robocopy command, whatever it was.
        #
        error [appendArgs \
            "command \"" $command "\" error: " $result]
      }
    }
  }

  #
  # NOTE: Provide the Eagle "file finder" package to the interpreter.
  #
  package provide Eagle.File.Finder \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/info.eagle.





























































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
###############################################################################
#
# info.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Information Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This procedure returns the list of options that were used when
  #       compiling the Eagle core library.
  #
  proc getCompileInfo {} {
    #
    # NOTE: Return the important compile-time information for use by the
    #       setup or other callers.
    #
    return [expr {[isEagle] ? [lappend result \
        TimeStamp $::eagle_platform(timeStamp) \
        ImageRuntimeVersion $::eagle_platform(imageRuntimeVersion) \
        ModuleVersionId $::eagle_platform(moduleVersionId) \
        CompileOptions $::eagle_platform(compileOptions)] : ""}]
  }

  #
  # NOTE: This procedure returns the specified Eagle platform information,
  #       if available; otherwise a default value is returned instead.
  #
  proc getPlatformInfo { name {default ""} } {
    #
    # NOTE: Return the important platform information for use by the test
    #       suite or other callers.
    #
    return [expr {[isEagle] && [info exists ::eagle_platform($name)] && \
        [string length [string trim $::eagle_platform($name)]] > 0 ? \
        $::eagle_platform($name) : $default}]
  }

  #
  # NOTE: This procedure returns the name of the first loaded plugin that
  #       matches the specified pattern.
  #
  proc getPluginName { pattern } {
    #
    # NOTE: This should work properly in both Tcl and Eagle.
    #
    foreach loaded [info loaded] {
      if {[regexp -- $pattern [lindex $loaded end]]} then {
        return [lindex $loaded 1]
      }
    }

    return ""
  }

  #
  # NOTE: This procedure returns the fully qualified file name of the first
  #       loaded plugin that matches the specified pattern.
  #
  proc getPluginPath { pattern } {
    #
    # NOTE: This should work properly in both Tcl and Eagle.
    #
    foreach loaded [info loaded] {
      if {[regexp -- $pattern [lindex $loaded end]]} then {
        return [lindex $loaded 0]
      }
    }

    return ""
  }

  #
  # NOTE: This procedure returns the fully qualified directory name where new
  #       packages targeting the interpreter should be installed.  The return
  #       values of this procedure are subject to change in future releases.
  #
  proc getPackageInstallPath { {packageName ""} {temporaryPrefix ""} } {
    #
    # NOTE: Skip using the Tcl library location if that has been explicitly
    #       forbidden.
    #
    if {![info exists ::no(getPackageInstallPath)]} then {
      #
      # NOTE: First, check if the Tcl library variable exists and its location
      #       exists.  The location may refer to a file.
      #
      global tcl_library

      if {[info exists tcl_library]} then {
        #
        # NOTE: What is the parent directory for the Tcl library location?  If
        #       the Tcl library location was a file, it should be a directory;
        #       if it was already a directory, it should still be one.  Either
        #       way, the new (directory) location must be writable.
        #
        set directory [file dirname $tcl_library]

        if {[file exists $directory] && [file isdirectory $directory] && \
            [file writable $directory]} then {
          #
          # HACK: Use a common root directory for all "dynamically" installed
          #       packages.
          #
          set directory [file join $directory install]
          file mkdir $directory

          #
          # NOTE: Ok, all checks passed, return the location.  Callers of this
          #       procedure should generally not put files directly within it;
          #       instead, they should create a sub-directory within it, named
          #       appropriately.  If a package name was supplied by the caller
          #       it will be used.  In that case, the resulting directory will
          #       be created if necessary.
          #
          if {[string length $packageName] > 0} then {
            set directory [file join $directory $packageName]
            file mkdir $directory
          }

          if {[llength [info commands pkgInstallLog]] > 0} then {
            pkgInstallLog {install persistent} $packageName $directory
          }

          return $directory
        }
      }
    }

    #
    # NOTE: Next, since the fallback location requires the test package, load
    #       it now.
    #
    package require Eagle.Test

    #
    # NOTE: Return the temporary directory as the fallback location.  Callers
    #       of this procedure should generally not put files directly within
    #       it; instead, they should create a sub-directory within it, named
    #       appropriately.  If a temporary prefix was supplied by the caller
    #       it will be used.  In that case, the resulting directory will be
    #       created if necessary.
    #
    set directory [getTemporaryPath]

    if {[string length $temporaryPrefix] > 0} then {
      set directory [file join \
          $directory [appendArgs $temporaryPrefix - \
          [pid] - [string trim [clock seconds] -]]]

      file mkdir $directory
    }

    set directory [file join $directory install]
    file mkdir $directory

    if {[string length $packageName] > 0} then {
      set directory [file join $directory $packageName]
      file mkdir $directory
    }

    if {[llength [info commands pkgInstallLog]] > 0} then {
      pkgInstallLog {install temporary} $packageName $directory
    }

    return $directory
  }

  #
  # NOTE: This procedure returns the Eagle core library base path, e.g. a
  #       value like "C:\Eagle" when loaded from "C:\Eagle\bin\Eagle.dll".
  #
  proc getBasePath {} {
    set assembly [object invoke -flags +NonPublic \
        Eagle._Components.Private.GlobalState GetAssembly]

    return [object invoke -flags +NonPublic \
        Eagle._Components.Private.PathOps GetBasePath $assembly \
        [file dirname [lindex [info assembly] 1]]]
  }

  #
  # NOTE: This procedure returns the flags for the first loaded plugin that
  #       matches the specified pattern.
  #
  proc getPluginFlags { pattern } {
    foreach loaded [info loaded] {
      set plugin [lindex $loaded end]

      if {[regexp -- $pattern $plugin]} then {
        return [string map [list , " "] \
            [getDictionaryValue [info plugin $plugin] flags]]
      }
    }

    return [list]
  }

  #
  # NOTE: This procedure returns non-zero if the Eagle Native Package for
  #       Tcl (Garuda) is loaded into the primary native Tcl interpreter.
  #
  proc haveGaruda { {varName ""} } {
    #
    # NOTE: Check for a variable name to place the Garuda package Id into.
    #
    if {[string length $varName] > 0} then {
      upvar 1 $varName packageId
    }

    #
    # NOTE: Is the Eagle Package for Tcl (Garuda) available?  This check
    #       is different in Eagle and Tcl.
    #
    if {[isEagle]} then {
      return [expr {[llength [info commands tcl]] > 0 && [tcl ready] && \
          [catch {tcl eval [tcl primary] {package present Garuda}}] == 0 && \
          [catch {tcl eval [tcl primary] {garuda packageid}} packageId] == 0}]
    } else {
      return [expr {[catch {package present Garuda}] == 0 && \
          [catch {garuda packageid} packageId] == 0}]
    }
  }

  #
  # NOTE: This procedure returns non-zero if the specified name represents
  #       a thread managed by the native Tcl integration subsystem of Eagle.
  #
  proc isTclThread { name } {
    #
    # NOTE: For now, this check only works in Eagle.
    #
    set result false

    if {[isEagle]} then {
      catch {
        if {[llength [info commands tcl]] > 0 && [tcl ready] && \
            [lsearch -exact -- [tcl threads] $name] != -1} then {
          #
          # NOTE: The name specified by the caller appears in the
          #       list of Tcl threads for this Eagle interpreter.
          #
          set result true
        }
      }
    }

    return $result
  }

  #
  # NOTE: Provide the Eagle "info" package to the interpreter.
  #
  package provide Eagle.Information \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}

Added Externals/Eagle/lib/Eagle1.0/init.eagle.























































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
###############################################################################
#
# init.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Interpreter Initialization File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This is the procedure that detects whether or not we are
  #       running in Eagle (otherwise, we are running in vanilla Tcl).
  #       This procedure must function correctly in both Tcl and Eagle
  #       and must return non-zero only when running in Eagle.  This
  #       procedure must be defined in this script file because it is
  #       needed while this script file is being evaluated.  The same
  #       procedure is also defined in the "platform.eagle" file.
  #
  # <bootstrap>
  proc isEagle {} {
    #
    # NOTE: Nothing too fancy or expensive should be done in here.  In
    #       theory, use of this routine should be rare; however, in
    #       practice, this routine is actually used quite a bit (e.g.
    #       by the test suite).
    #
    return [expr {[info exists ::tcl_platform(engine)] && \
        [string compare -nocase eagle $::tcl_platform(engine)] == 0}]
  }

  #
  # NOTE: This procedure is designed to "load" (i.e. [source]) other script
  #       files that logically belong to the package defined in this script
  #       file.  Upon success, an empty string will be returned.  A script
  #       error may be raised.  This should work properly in both Tcl and
  #       Eagle.  This procedure must be defined in this script file because
  #       it is needed while this script file is being evaluated.
  #
  # <bootstrap>
  proc loadScripts { directory fileNamesOnly } {
    #
    # NOTE: Does the directory specified by the caller contain information
    #       useful in locating the script file?
    #
    if {[string length $directory] == 0 || $directory eq "."} then {
      #
      # NOTE: The directory specified by the caller contains no useful
      #       information, use the Tcl library directory instead, if
      #       possible.
      #
      if {[info exists ::tcl_library] && \
          [string length $::tcl_library] > 0 && \
          [file isdirectory $::tcl_library]} then {
        #
        # NOTE: Ok, use the Tcl library directory.
        #
        set directory $::tcl_library
      }
    }

    #
    # NOTE: Start out with the [source] command.
    #
    set baseCommand source

    #
    # NOTE: When using Eagle, use the -withinfo option to preserve the
    #       location information for procedures defined in the specified
    #       script file.
    #
    if {[isEagle]} then {
      lappend baseCommand -withinfo true --
    }

    #
    # NOTE: Load each script file specified by the caller, in the exact
    #       order they were specified.
    #
    foreach fileNameOnly $fileNamesOnly {
      #
      # NOTE: Build (final) candidate script file name to [source].  If
      #       that file name has (then) been explicitly forbidden, skip
      #       it.
      #
      set fileName [file join $directory $fileNameOnly]

      if {[info exists ::no($fileName)]} then {
        continue
      }

      #
      # NOTE: If the "strictLoadScript" option is disabled, skip any of
      #       the script files that do not appear to exist; otherwise,
      #       just let the [source] command deal with missing scripts.
      #
      if {[info exists ::no(strictLoadScript)] && \
          ![file exists $fileName]} then {
        continue
      }

      #
      # NOTE: Start with the base [source] command, maybe with some
      #       options.
      #
      set fileCommand $baseCommand

      #
      # NOTE: Add the qualified file name, which may or may not be fully
      #       qualified.
      #
      lappend fileCommand $fileName

      #
      # NOTE: Evaluate the resulting command in the callers context.
      #
      uplevel 1 $fileCommand
    }

    #
    # NOTE: Success, return an empty string.
    #
    return ""
  }

  #
  # NOTE: This procedure is designed to "load" (i.e. [source]) other script
  #       files that logically belong to the package defined in this script
  #       file.  Upon success, an empty string will be returned.  A script
  #       error may be raised.  This should work properly in both Tcl and
  #       Eagle.  This procedure must be defined in this script file because
  #       it is needed while this script file is being evaluated.  If there
  #       exists a global array element no($fileNameOnly) corresponding to a
  #       particular script file to be loaded, it will be skipped.
  #
  # <bootstrap>
  proc maybeLoadScripts { directory fileNamesOnly } {
    set matchFileNames [list]

    foreach fileNameOnly $fileNamesOnly {
      if {![info exists ::no($fileNameOnly)]} then {
        lappend matchFileNames $fileNameOnly
      }
    }

    return [uplevel 1 [list loadScripts $directory $matchFileNames]]
  }

  if {![interp issafe] && ([isEagle] ? ![interp issdk] : true)} then {
    #
    # NOTE: Load the extra script library files that contain commonly used
    #       procedures that are shared between native Tcl and Eagle.
    #
    if {![info exists ::no(maybeLoadScripts,shared)]} then {
      maybeLoadScripts [file dirname [info script]] [list \
          auxiliary.eagle database.eagle exec.eagle file1.eagle \
          file2.eagle file2u.eagle file3.eagle info.eagle list.eagle \
          pkgt.eagle platform.eagle runopt.eagle testlog.eagle \
          unzip.eagle]
    }

    #
    # NOTE: Load the extra script library files that contain procedures that
    #       require a specific language (i.e. either native Tcl or Eagle).
    #
    if {[isEagle]} then {
      if {![info exists ::no(maybeLoadScripts,engine)] && \
          ![info exists ::no(maybeLoadScripts,eagle)]} then {
        maybeLoadScripts [file dirname [info script]] [list \
            compat.eagle csharp.eagle object.eagle process.eagle \
            unkobj.eagle update.eagle]
      }
    } else {
      if {![info exists ::no(maybeLoadScripts,engine)] && \
          ![info exists ::no(maybeLoadScripts,tcl)]} then {
        maybeLoadScripts [file dirname [info script]] [list shim.eagle]
      }
    }
  }

  if {[isEagle]} then {
    ###########################################################################
    ############################ BEGIN Eagle ONLY #############################
    ###########################################################################

    #
    # NOTE: This procedure uses the [source] command to evaluate a script
    #       file while preserving the location information for procedures
    #       defined with it.
    #
    # <pkgIndex>
    proc sourceWithInfo { args } {
      catch {
        set savedCacheFlags None

        object invoke -flags +NonPublic Interpreter.GetActive \
            BeginNoArgumentCache savedCacheFlags
      }

      try {
        catch {
          set savedInterpreterStateFlags None

          object invoke -flags +NonPublic Interpreter.GetActive \
              BeginArgumentLocation savedInterpreterStateFlags
        }

        try {
          set command [list source]; eval lappend command $args

          return [uplevel 1 $command]
        } finally {
          catch {
            object invoke -flags +NonPublic Interpreter.GetActive \
                EndArgumentLocation savedInterpreterStateFlags
          }
        }
      } finally {
        catch {
          object invoke -flags +NonPublic Interpreter.GetActive \
              EndNoArgumentCache savedCacheFlags
        }
      }
    }

    if {![interp issafe] && ![interp issdk]} then {
      #
      # NOTE: This is the [unknown] command for Eagle.  It will normally be
      #       executed by the script engine when a command is not found.
      #       By default, it will simply raise a script error; however, if
      #       the "eagleUnknownObjectInvoke" runtime option is set, it will
      #       first attempt to use the (unknown) command name as the name
      #       of a CLR type.
      #
      # <create>
      proc unknown { name args } {
        #
        # NOTE: This is an [unknown] procedure that normally produces an
        #       appropriate error message; however, it can optionally try
        #       to invoke a static object method.
        #
        # TODO: Add support for auto-loading packages here in the future?
        #
        if {[llength [info commands hasRuntimeOption]] > 0 && \
            [hasRuntimeOption eagleUnknownObjectInvoke] && \
            [llength [info commands object]] > 0 && \
            [llength [info commands unknownObjectInvoke]] > 0} then {
          #
          # NOTE: In the context of the caller, attempt to invoke a static
          #       object method using the specified arguments (which may
          #       contain variable names).
          #
          if {[catch {
            eval unknownObjectInvoke 1 [list $name] $args
          } result] == 0} then {
            #
            # NOTE: The static object method was invoked successfully.
            #       Return its result.
            #
            return -code ok $result
          } elseif {[string length $result] > 0} then {
            #
            # NOTE: Attempting to invoke the static object method raised
            #       an error.  Re-raise it now.  If no error message was
            #       provided, fallback on the default (below).
            #
            return -code error $result
          }
        }

        return -code error [appendArgs "invalid command name \"" $name \"]
      }
    } else {
      #
      # NOTE: This is the [unknown] command for Eagle.  It will normally be
      #       executed by the script engine when a command is not found.
      #       It will simply raise a script error.  This procedure is also
      #       defined in "safe.eagle".
      #
      # <create>
      proc unknown { name args } {
        #
        # NOTE: This is an [unknown] procedure that produces an appropriate
        #       error message.
        #
        # TODO: Add support for auto-loading packages here in the future?
        #
        # NOTE: This command cannot use [appendArgs] because that procedure
        #       is defined in another file that is never loaded into "safe"
        #       interpreters.
        #
        return -code error "invalid command name \"$name\""
      }
    }

    #
    # NOTE: This namespace and the procedure defined within it are used for
    #       compatibility with native Tcl.
    #
    namespace eval ::tcl::tm {
      #
      # NOTE: Ideally, this procedure should be created in the "::tcl::tm"
      #       namespace.
      #
      # <create>
      proc ::tcl::tm::UnknownHandler { original name args } {
        #
        # NOTE: Do nothing except call the original handler.
        #
        uplevel 1 $original [::linsert $args 0 $name]
      }
    }

    #
    # NOTE: This procedure is normally executed by the package management
    #       subsystem of Eagle when a package is requested that cannot be
    #       found.  By default, it will force a scan of all known package
    #       indexes.
    #
    # <create>
    proc tclPkgUnknown { name args } {
      #
      # NOTE: Force a rescan of "pkgIndex" files.  This must be done in
      #       the global scope so that the special global variable 'dir'
      #       set by the package index loading subsystem can be accessed.
      #
      uplevel #0 [list package scan -host -normal -refresh]
    }

    #
    # NOTE: This procedure marks a procedure for "fast" execution; for now,
    #       this means disabling anything that makes variable access slower
    #       while the target procedure is executing.
    #
    # <experimental>
    proc makeProcedureFast { name fast } {
      #
      # NOTE: This should work properly in Eagle only.
      #
      catch {
        uplevel 1 [list object invoke -flags +NonPublic \
            Interpreter.GetActive MakeProcedureFast $name $fast]
      }
    }

    #
    # NOTE: This procedure marks a variable for "fast" access; for now, this
    #       means disabling anything that makes variable access slower while
    #       the target variable is being read, set, or unset.
    #
    # <experimental>
    proc makeVariableFast { name fast } {
      #
      # NOTE: This should work properly in Eagle only.
      #
      catch {
        uplevel 1 [list object invoke -flags +NonPublic \
            Interpreter.GetActive MakeVariableFast $name $fast]
      }
    }

    #
    # NOTE: Add script library files borrowed from native Tcl.
    #
    if {![interp issafe] && ![interp issdk]} then {
      maybeLoadScripts [file dirname [info script]] [list word.tcl]
    }

    ###########################################################################
    ############################# END Eagle ONLY ##############################
    ###########################################################################
  } else {
    ###########################################################################
    ############################# BEGIN Tcl ONLY ##############################
    ###########################################################################

    #
    # NOTE: Exports the necessary commands from this package and import them
    #       into the global namespace.
    #
    if {[llength [info commands exportAndImportPackageCommands]] > 0} then {
      exportAndImportPackageCommands [namespace current] [list \
          isEagle loadScripts maybeLoadScripts isWindows isInteractive \
          haveGaruda isTclThread isMono isDotNetCore isSameFileName \
          getEnvironmentVariable combineFlags getCompileInfo getPlatformInfo \
          getPluginName getPluginPath getPackageInstallPath appendArgs \
          lappendArgs getDictionaryValue getColumnValue getRowColumnValue \
          vwaitLocked tqputs tqlog makeBinaryChannel makeAsciiChannel \
          makeUnicodeBinaryChannel makeUnicodeChannel makeUtf8Channel \
          makeLogChannel readFile readSharedFile writeFile \
          appendFile appendLogFile appendSharedFile appendSharedLogFile \
          readAsciiFile writeAsciiFile readUnicodeBinaryFile readUnicodeFile \
          readUtf8File writeUnicodeBinaryFile writeUnicodeFile writeUtf8File \
          addToPath removeFromPath getShellExecutableName \
          getRuntimeCommandLine execShell maybeGetExitCode lshuffle \
          ldifference filter map reduce getLengthModifier debug \
          tclLogForCommand populateTypesForComSpecDir populateTypesForGlob \
          filterForGlob canUseComSpecDir pwdForDirResultPath getDirResultPath \
          fileNormalizeForGlob performGlob maybeAppendPathResult \
          findViaGlob findViaComSpecDir fileDirNameForFind fileTailForFind \
          findDirectories findDirectoriesRecursive findFiles \
          findFilesRecursive copyFilesRecursive \
          exportAndImportPackageCommands setupUnzipVars unzipMustBeInstalled \
          extractZipArchive hasRuntimeOption listRuntimeOptions \
          addRuntimeOption removeRuntimeOption toggleRuntimeOption] false false
    }

    ###########################################################################

    #
    # HACK: Native Tcl does not have this global array; however, now it is
    #       needed because of the added support for native Tcl to use the
    #       runtime options semantics from Eagle, where this variable is a
    #       hard requirement.
    #
    if {![info exists ::eagle_platform(runtimeOptions)]} then {
      set ::eagle_platform(runtimeOptions) [list]
    }

    ###########################################################################
    ############################## END Tcl ONLY ###############################
    ###########################################################################
  }

  #
  # NOTE: Provide the Eagle "library" package to the interpreter.
  #
  package provide Eagle.Library \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/list.eagle.







































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
###############################################################################
#
# list.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle List Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This procedure appends all of its arguments as list elements and
  #       returns the resulting list.
  #
  proc lappendArgs { args } {
    #
    # NOTE: This should work properly in both Tcl and Eagle.
    #
    set result [list]; eval lappend result $args
  }

  #
  # NOTE: This procedure pseudo-randomly shuffles the specified list value
  #       and returns the resulting list.
  #
  proc lshuffle { list } {
    #
    # NOTE: This code for this algorithm was stolen from the Tcl library
    #       struct package and modified to conform with the Eagle style
    #       guide.
    #
    set result $list

    for {set length [llength $result]} \
        {$length > 1} {lset result $index $element} {
      set index [expr {int(rand() * $length)}]
      set element [lindex $result [incr length -1]]
      lset result $length [lindex $result $index]
    }

    return $result
  }

  #
  # NOTE: This procedure returns a list of elements that are present in the
  #       first list argument and missing from the second list argument -AND-
  #       elements that are present in the second list argument and missing
  #       from the first list argument.
  #
  proc ldifference { list1 list2 } {
    set result [list]

    foreach element $list1 {
      if {[lsearch -exact $list2 $element] == -1} then {
        lappend result $element
      }
    }

    foreach element $list2 {
      if {[lsearch -exact $list1 $element] == -1} then {
        lappend result $element
      }
    }

    return $result
  }

  #
  # NOTE: This procedure returns a list of elements from the specified list
  #       that cause the specified script to return non-zero.
  #
  proc filter { list script } {
    set result [list]

    foreach item $list {
      if {[uplevel 1 $script [list $item]]} then {
        lappend result $item
      }
    }

    return $result
  }

  #
  # NOTE: This procedure returns a list of elements from the specified list,
  #       each one having possibly been transformed by the specified script.
  #
  proc map { list script } {
    set result [list]

    foreach item $list {
      lappend result [uplevel 1 $script [list $item]]
    }

    return $result
  }

  #
  # NOTE: This procedure returns a value that is determined by evaluating the
  #       specified script against the result value produced so far and each
  #       element of the specified list.
  #
  proc reduce { list script } {
    set result ""

    foreach item $list {
      set result [uplevel 1 $script [list $result] [list $item]]
    }

    return $result
  }

  #
  # NOTE: Provide the Eagle "list" package to the interpreter.
  #
  package provide Eagle.List \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/object.eagle.





































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
###############################################################################
#
# object.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Object Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This procedure accepts two arguments containing the flag string
  #       that are based on an enumerated CLR type.  Flag values that are
  #       contained in these two arguments are combined and returned as
  #       the result.  The third flag string argument contains the flags
  #       to exclude from the result.
  #
  proc combineFlags { flags1 flags2 {flags3 ""} {noCase false} } {
    #
    # NOTE: This should work properly in both Tcl and Eagle.
    #
    set result [list]
    set notFlags [list]

    if {[string length $flags3] > 0} then {
      foreach flag [split $flags3 ", "] {
        set flag [string trim $flag]

        if {[string length $flag] > 0} then {
          lappend notFlags $flag
        }
      }
    }

    foreach flags [list $flags1 $flags2] {
      foreach flag [split $flags ", "] {
        set flag [string trim $flag]

        if {[string length $flag] > 0} then {
          set addFlag false

          if {[llength $notFlags] > 0} then {
            set command [list lsearch -exact]

            if {$noCase} then {
              lappend command -nocase
            }

            lappend command -- $notFlags $flag

            if {[eval $command] == -1} then {
              set addFlag true
            }
          } else {
            set addFlag true
          }

          if {$addFlag} then {
            lappend result $flag
          }
        }
      }
    }

    return [join $result ,]
  }

  #
  # NOTE: This procedure returns the type name of the return type for the
  #       specified CLR member.
  #
  proc getReturnType { object member } {
    if {[string length $object] == 0} then {
      return ""
    }

    if {[string length $member] == 0} then {
      return ""
    }

    set code [catch {
      object foreach -alias memberInfo \
          [object invoke -noinvoke $object $member] {
        #
        # NOTE: Use the member type to determine which property contains
        #       the type information we want to return.
        #
        switch -exact -- [$memberInfo MemberType] {
          Field {
            return [$memberInfo FieldType.AssemblyQualifiedName]
          }
          Method {
            return [$memberInfo ReturnType.AssemblyQualifiedName]
          }
          Property {
            return [$memberInfo PropertyType.AssemblyQualifiedName]
          }
          default {
            return ""
          }
        }
      }
    } result]

    #
    # NOTE: If no error was raised above, return the result; otherwise,
    #       return an empty string to indicate a general failure.
    #
    return [expr {$code == 2 ? $result : ""}]
  }

  #
  # NOTE: This procedure returns the default value for the specified CLR type.
  #
  proc getDefaultValue { typeName } {
    if {[llength [info commands object]] == 0} then {
      return ""
    }

    if {[string length $typeName] == 0} then {
      return ""
    }

    set type [object invoke -create -alias Utility GetType $typeName]

    if {[string length $type] == 0} then {
      return ""
    }

    return [expr {[$type IsValueType] ? 0 : "null"}]
  }

  #
  # NOTE: This procedure returns a string obtained by using the specified
  #       value as an opaque object handle -OR- a default value (e.g. an
  #       empty string) if the value is not a valid opaque object handle.
  #
  proc getStringFromObjectHandle { value {default ""} } {
    if {[isNonNullObjectHandle $value]} then {
      return [object invoke $value ToString]
    }

    if {[string length $default] > 0} then {
      return $default
    }

    return $value
  }

  #
  # NOTE: This procedure returns non-zero if the specified value can be used
  #       as an opaque object handle.
  #
  proc isObjectHandle { value } {
    if {[catch {object exists $value} result] == 0 && $result} then {
      return true
    }

    set pattern [string map \
        [list \\ \\\\ * \\* - \\- ? \\? \[ \\\[ \] \\\]] $value]

    set objects [info objects $pattern]

    if {[llength $objects] == 1 && [lindex $objects 0] eq $value} then {
      return true
    }

    return false
  }

  #
  # NOTE: This procedure returns non-zero if the specified value can be used
  #       as an opaque object handle -AND- the value does not represent a null
  #       object value.
  #
  proc isNonNullObjectHandle { value } {
    if {![isObjectHandle $value]} then {
      return false
    }

    global null

    if {$value eq $null} then {
      return false
    }

    if {[catch {object isnull $value} result] == 0 && $result} then {
      return false
    }

    return true
  }

  #
  # NOTE: This procedure returns non-zero if the specified name represents
  #       a valid CLR type name.
  #
  proc isManagedType { name } {
    if {[llength [info commands object]] > 0} then {
      if {![isObjectHandle $name]} then {
        if {[catch {
          object members -matchnameonly -nameonly -pattern Equals $name
        } result] == 0 && $result eq "Equals"} then {
          return true
        }
      }
    }

    return false
  }

  #
  # NOTE: This procedure returns non-zero if the specified name is usable
  #       as a CLR type name.
  #
  proc canGetManagedType {
          name allowExtra {typeVarName ""} {extraVarName ""} } {
    if {[llength [info commands object]] > 0} then {
      if {![isObjectHandle $name]} then {
        set cultureInfo [object invoke Interpreter.GetActive CultureInfo]
        set type null

        set code [object invoke -create -alias -flags +NonPublic \
            Value GetAnyType "" $name null null None $cultureInfo \
            type]

        if {[getStringFromObjectHandle $code] eq "Ok"} then {
          if {[string length $typeVarName] > 0} then {
            upvar 1 $typeVarName typeName
          }

          set typeName [$type AssemblyQualifiedName]

          if {[string length $extraVarName] > 0} then {
            upvar 1 $extraVarName extraName
          }

          set extraName ""; # NOTE: Entire name was used.

          if {[isManagedType $typeName]} then {
            return true
          }
        } elseif {$allowExtra && [string first . $name] != -1} then {
          set typeParts [split $name .]
          set startIndex [expr {[llength $typeParts] - 2}]

          for {set index $startIndex} {$index >= 0} {incr index -1} {
            set rangeName [lrange $typeParts 0 $index]

            if {![isObjectHandle $rangeName]} then {
              set type null

              set code [object invoke -create -alias -flags +NonPublic \
                  Value GetAnyType "" $rangeName null null None \
                  $cultureInfo type]

              if {[getStringFromObjectHandle $code] eq "Ok"} then {
                if {[string length $typeVarName] > 0} then {
                  upvar 1 $typeVarName typeName
                }

                set typeName $rangeName

                if {[string length $extraVarName] > 0} then {
                  upvar 1 $extraVarName extraName
                }

                set extraName [join [lrange $typeParts $index+1 end] .]

                if {[isManagedType $typeName]} then {
                  return true
                } else {
                  break
                }
              }
            }
          }
        }
      }
    }

    return false
  }

  #
  # NOTE: This procedure evaluates a script asynchronously and optionally
  #       notifies another script upon its completion.  The first argument
  #       is the notification script; if an empty string, there will be no
  #       notification when asynchronous script evaluation is completed.
  #       If there is exactly one more argument, it is evaluated verbatim;
  #       otherwise, all remaining arguments are concatenated via [concat]
  #       and evaluated asynchronously.  If the script cannot be submitted
  #       for asynchronous evaluation, a script error will be raised.
  #
  proc evalAsync { doneScript args } {
    #
    # NOTE: This procedure requires the [object] command in order to work.
    #       If it is not available, bail out now.
    #
    if {[llength [info commands object]] == 0} then {
      error "cannot eval async: missing \[object\] command"
    }

    #
    # NOTE: Grab the current compilation options for the core library.
    #
    if {[info exists ::eagle_platform(compileOptions)]} then {
      set options $::eagle_platform(compileOptions)
    } else {
      set options [list]
    }

    #
    # NOTE: If the core library was not compiled with thread-safety enabled,
    #       this procedure cannot be used because it could corrupt the state
    #       of the interpreter.
    #
    if {[lsearch -exact -- $options THREADING] == -1} then {
      error "cannot eval async: library missing THREADING compile-option"
    }

    #
    # NOTE: If there is more than one script optional argument, use [concat]
    #       to build up the final script; otherwise, use the single argument
    #       verbatim.  This mirrors the behavior of [eval].
    #
    if {[llength $args] > 1} then {
      set asyncScript [concat $args]
    } else {
      set asyncScript [lindex $args 0]
    }

    #
    # NOTE: Is there a script to be evaluated when the asynchronous script
    #       evaluation is complete?  If so, build an anonymous procedure
    #       that wraps it; otherwise, set the callback argument to null, so
    #       the core marshaller will handle the lack of a callback correctly.
    #       The context argument will be added to this script prior to it
    #       being evaluated; however, it is not actually used by this script.
    #       The -identifier option is NOT actually processed by the library;
    #       however, it is necessary here to avoid having multiple calls to
    #       this procedure collide with each other when attempting to remove
    #       their callbacks during cleanup.
    #
    if {[string length $doneScript] > 0} then {
      #
      # NOTE: If the core library was compiled without dynamic delegates,
      #       this procedure cannot be used when there is a callback, due
      #       to the AsynchronousCallback delegate type being unsupported.
      #
      if {[lsearch -exact -- $options EMIT] == -1} then {
        error "cannot eval async: library missing EMIT compile-option"
      }

      set callback [list -identifier [expr {random()}] -callbackflags \
          {+ResetCancel MustResetCancel FireAndForget} -- apply [list \
          [list script context] {uplevel 1 $script}] $doneScript]
    } else {
      set callback null
    }

    #
    # NOTE: Initialize the local variable that will be used to receive the
    #       script error, if any.
    #
    set error null

    #
    # NOTE: Attempt to submit the script for asynchonous evaluation.  Use
    #       the dynamic callback mechanism with the anonymous procedure we
    #       constructed above.
    #
    set interp [object invoke \
        -objectflags +NoDispose Interpreter GetActive]; # TODO: 10x speed?

    set parameterTypes [list \
        String Eagle._Components.Public.Delegates.AsynchronousCallback \
        Eagle._Interfaces.Public.IClientData Result&]; # TODO: Speed?

    set code [object invoke -verbose \
        -marshalflags +DynamicCallback -parametertypes $parameterTypes \
        -- $interp EvaluateScript $asyncScript $callback null error]

    #
    # NOTE: Check the return code, which only indicates if the script was
    #       actually submitted for asynchronous evaluation, to make sure
    #       it was successful.  If not, raise a script error.
    #
    if {$code ne "Ok"} then {
      error [getStringFromObjectHandle $error]
    }

    #
    # NOTE: Upon success, return an empty string.  The actual script result
    #       will be sent to the callback script, if any.
    #
    return ""
  }

  #
  # NOTE: Provide the Eagle "object" package to the interpreter.
  #
  package provide Eagle.Object \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/pkgIndex.eagle.



























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
###############################################################################
#
# pkgIndex.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Package Index File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

if {![package vsatisfies [package provide Tcl] 8.4]} {return}
if {![package vsatisfies [package provide Eagle] 1.0]} {return}

package ifneeded Eagle.Auxiliary 1.0 \
    [list sourceWithInfo [file join $dir auxiliary.eagle]]

package ifneeded Eagle.Tcl.Compatibility 1.0 \
    [list sourceWithInfo [file join $dir compat.eagle]]

package ifneeded Eagle.CSharp 1.0 \
    [list sourceWithInfo [file join $dir csharp.eagle]]

package ifneeded Eagle.Database 1.0 \
    [list sourceWithInfo [file join $dir database.eagle]]

package ifneeded Eagle.Execute 1.0 \
    [list sourceWithInfo [file join $dir exec.eagle]]

package ifneeded Eagle.File 1.0 \
    [list sourceWithInfo [file join $dir file1.eagle]]

package ifneeded Eagle.File.Types 1.0 \
    [list sourceWithInfo [file join $dir file2.eagle]]

package ifneeded Eagle.File.Utf8 1.0 \
    [list sourceWithInfo [file join $dir file2u.eagle]]

package ifneeded Eagle.File.Finder 1.0 \
    [list sourceWithInfo [file join $dir file3.eagle]]

package ifneeded Eagle.Information 1.0 \
    [list sourceWithInfo [file join $dir info.eagle]]

package ifneeded Eagle.Library 1.0 \
    [list sourceWithInfo [file join $dir init.eagle]]

package ifneeded Eagle.List 1.0 \
    [list sourceWithInfo [file join $dir list.eagle]]

package ifneeded Eagle.Object 1.0 \
    [list sourceWithInfo [file join $dir object.eagle]]

package ifneeded Eagle.Package.Toolset 1.0 \
    [list sourceWithInfo [file join $dir pkgt.eagle]]

package ifneeded Eagle.Platform 1.0 \
    [list sourceWithInfo [file join $dir platform.eagle]]

package ifneeded Eagle.Process 1.0 \
    [list sourceWithInfo [file join $dir process.eagle]]

package ifneeded Eagle.Runtime.Option 1.0 \
    [list sourceWithInfo [file join $dir runopt.eagle]]

package ifneeded Eagle.Safe 1.0 \
    [list sourceWithInfo [file join $dir safe.eagle]]

package ifneeded Eagle.Shell 1.0 \
    [list sourceWithInfo [file join $dir shell.eagle]]

package ifneeded Eagle.Tcl.Shim 1.0 \
    [list sourceWithInfo [file join $dir shim.eagle]]

package ifneeded Eagle.Test 1.0 \
    [list sourceWithInfo [file join $dir test.eagle]]

package ifneeded Eagle.Test.Log 1.0 \
    [list sourceWithInfo [file join $dir testlog.eagle]]

package ifneeded Eagle.Unknown.Object 1.0 \
    [list sourceWithInfo [file join $dir unkobj.eagle]]

package ifneeded Eagle.Unzip 1.0 \
    [list sourceWithInfo [file join $dir unzip.eagle]]

package ifneeded Eagle.Update 1.0 \
    [list sourceWithInfo [file join $dir update.eagle]]

Added Externals/Eagle/lib/Eagle1.0/pkgIndex.tcl.



























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
###############################################################################
#
# pkgIndex.tcl --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Package Index File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

if {![package vsatisfies [package provide Tcl] 8.4]} {return}
if {[string length [package provide Eagle]] > 0} then {return}

package ifneeded Eagle.Auxiliary 1.0 \
    [list source [file join $dir auxiliary.eagle]]

package ifneeded Eagle.Tcl.Compatibility 1.0 \
    [list source [file join $dir compat.eagle]]

package ifneeded Eagle.CSharp 1.0 \
    [list source [file join $dir csharp.eagle]]

package ifneeded Eagle.Database 1.0 \
    [list source [file join $dir database.eagle]]

package ifneeded Eagle.Execute 1.0 \
    [list source [file join $dir exec.eagle]]

package ifneeded Eagle.File 1.0 \
    [list source [file join $dir file1.eagle]]

package ifneeded Eagle.File.Types 1.0 \
    [list source [file join $dir file2.eagle]]

package ifneeded Eagle.File.Utf8 1.0 \
    [list source [file join $dir file2u.eagle]]

package ifneeded Eagle.File.Finder 1.0 \
    [list source [file join $dir file3.eagle]]

package ifneeded Eagle.Information 1.0 \
    [list source [file join $dir info.eagle]]

package ifneeded Eagle.Library 1.0 \
    [list source [file join $dir init.eagle]]

package ifneeded Eagle.List 1.0 \
    [list source [file join $dir list.eagle]]

package ifneeded Eagle.Object 1.0 \
    [list source [file join $dir object.eagle]]

package ifneeded Eagle.Package.Toolset 1.0 \
    [list source [file join $dir pkgt.eagle]]

package ifneeded Eagle.Platform 1.0 \
    [list source [file join $dir platform.eagle]]

package ifneeded Eagle.Process 1.0 \
    [list source [file join $dir process.eagle]]

package ifneeded Eagle.Runtime.Option 1.0 \
    [list source [file join $dir runopt.eagle]]

package ifneeded Eagle.Safe 1.0 \
    [list source [file join $dir safe.eagle]]

package ifneeded Eagle.Shell 1.0 \
    [list source [file join $dir shell.eagle]]

package ifneeded Eagle.Tcl.Shim 1.0 \
    [list source [file join $dir shim.eagle]]

package ifneeded Eagle.Test 1.0 \
    [list source [file join $dir test.eagle]]

package ifneeded Eagle.Test.Log 1.0 \
    [list source [file join $dir testlog.eagle]]

package ifneeded Eagle.Unknown.Object 1.0 \
    [list source [file join $dir unkobj.eagle]]

package ifneeded Eagle.Unzip 1.0 \
    [list source [file join $dir unzip.eagle]]

package ifneeded Eagle.Update 1.0 \
    [list source [file join $dir update.eagle]]

Added Externals/Eagle/lib/Eagle1.0/pkgt.eagle.















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
###############################################################################
#
# pkgt.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Package Toolset Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This procedure sets up the default values for all configuration
  #       parameters used by this package.  If the force argument is non-zero,
  #       any existing values will be overwritten and set back to their
  #       default values.
  #
  proc setupPackageToolsetVars { force {cleanup false} } {
    #
    # NOTE: Using the [getAuxiliaryBaseUri] procedure requires the update
    #       package.
    #
    # NOTE: The base URI used to build the URIs for the Package Client
    #       Toolset downloads.
    #
    variable baseUri; # DEFAULT: [getAuxiliaryBaseUri] -OR- https://urn.to/r

    if {$cleanup} then {
      unset -nocomplain baseUri
    } elseif {$force || ![info exists baseUri]} then {
      if {[isEagle]} then {
        set baseUri [getAuxiliaryBaseUri]
      } else {
        set baseUri https://urn.to/r
      }
    }

    #
    # NOTE: The URN, relative to the base URI, where the Package Client
    #       Toolset may be downloaded.
    #
    variable packageToolsetUrn; # DEFAULT: pkg_client_only

    if {$cleanup} then {
      unset -nocomplain packageToolsetUrn
    } elseif {$force || ![info exists packageToolsetUrn]} then {
      set packageToolsetUrn pkg_client_only
    }

    #
    # NOTE: The URI where the Package Client Toolset may be downloaded.
    #
    variable packageToolsetUri; # DEFAULT: ${baseUri}/${packageToolsetUrn}

    if {$cleanup} then {
      unset -nocomplain packageToolsetUri
    } elseif {$force || ![info exists packageToolsetUri]} then {
      set packageToolsetUri {${baseUri}/${packageToolsetUrn}}
    }

    #
    # NOTE: The URN, relative to the base URI, where the TclKit DLL for
    #       a particular platform may be downloaded.
    #
    variable tclKitDllUrn; # DEFAULT: tclkit_dll_${platform}

    if {$cleanup} then {
      unset -nocomplain tclKitDllUrn
    } elseif {$force || ![info exists tclKitDllUrn]} then {
      set tclKitDllUrn {tclkit_dll_${platform}}
    }

    #
    # NOTE: The URI where the TclKit DLL for a particular platform may
    #       be downloaded.
    #
    variable tclKitDllUri; # DEFAULT: ${baseUri}/${urn}

    if {$cleanup} then {
      unset -nocomplain tclKitDllUri
    } elseif {$force || ![info exists tclKitDllUri]} then {
      set tclKitDllUri {${baseUri}/${urn}}
    }

    #
    # NOTE: The URN, relative to the base URI, where the Harpy and Badge
    #       plugins for a particular build may be downloaded.
    #
    variable securityToolsetUrn; # DEFAULT: security_toolset_${platform}

    if {$cleanup} then {
      unset -nocomplain securityToolsetUrn
    } elseif {$force || ![info exists securityToolsetUrn]} then {
      set securityToolsetUrn {security_toolset_${platform}}
    }

    #
    # NOTE: The URI where the Harpy and Badge plugins for a particular
    #       build may be downloaded.
    #
    variable securityToolsetUri; # DEFAULT: ${baseUri}/${urn}

    if {$cleanup} then {
      unset -nocomplain securityToolsetUri
    } elseif {$force || ![info exists securityToolsetUri]} then {
      set securityToolsetUri {${baseUri}/${urn}}
    }

    #
    # NOTE: The list of URNs, relative to the base URI, where license
    #       certificate requests should be sent.  One of these will be
    #       selected at random.
    #
    variable licenseUrns; # DEFAULT: get_license_01 ... get_license_NN

    if {$cleanup} then {
      unset -nocomplain licenseUrns
    } elseif {$force || ![info exists licenseUrns]} then {
      set licenseUrns [list \
          get_license_01 get_license_02 get_license_03 get_license_04 \
          get_license_05 get_license_06 get_license_07]
    }

    #
    # NOTE: The URI where license certificate requests should be sent.
    #
    variable licenseUri; # DEFAULT: ${baseUri}/${urn}

    if {$cleanup} then {
      unset -nocomplain licenseUri
    } elseif {$force || ![info exists licenseUri]} then {
      set licenseUri {${baseUri}/${urn}}
    }

    #
    # NOTE: The list of URNs, relative to the base URI, where test script
    #       evaluation requests should be submitted to the "safe" sandbox.
    #       One of these will be selected at random.
    #
    variable sandboxEvalUrns; # DEFAULT: eval_01 ... eval_NN

    if {$cleanup} then {
      unset -nocomplain sandboxEvalUrns
    } elseif {$force || ![info exists sandboxEvalUrns]} then {
      set sandboxEvalUrns [list \
          eval_01 eval_02 eval_03 eval_04 eval_05 eval_06 eval_07]
    }

    #
    # NOTE: The URI where script evaluation requests should be submitted
    #       to the "safe" sandbox.
    #
    variable sandboxEvalUri; # DEFAULT: ${baseUri}/${urn}

    if {$cleanup} then {
      unset -nocomplain sandboxEvalUri
    } elseif {$force || ![info exists sandboxEvalUri]} then {
      set sandboxEvalUri {${baseUri}/${urn}}
    }

    #
    # NOTE: The list of URNs, relative to the base URI, where the named
    #       example scripts may be obtained.  One of these will be selected
    #       at random.
    #
    variable scriptUrns; # DEFAULT: script_01 ... script_NN

    if {$cleanup} then {
      unset -nocomplain scriptUrns
    } elseif {$force || ![info exists scriptUrns]} then {
      set scriptUrns [list \
          script_01 script_02 script_03 script_04 script_05 script_06 \
          script_07]
    }

    #
    # NOTE: The URI where named example scripts may be obtained.
    #
    variable scriptUri; # DEFAULT: ${baseUri}/${urn}

    if {$cleanup} then {
      unset -nocomplain scriptUri
    } elseif {$force || ![info exists scriptUri]} then {
      set scriptUri {${baseUri}/${urn}}
    }

    #
    # NOTE: The list of URNs, relative to the base URI, where the remote
    #       package index may be obtained.  One of these will be selected
    #       at random.
    #
    variable packageIndexUrns; # DEFAULT: package_index_01 ... package_index_NN

    if {$cleanup} then {
      unset -nocomplain packageIndexUrns
    } elseif {$force || ![info exists packageIndexUrns]} then {
      set packageIndexUrns [list \
          package_index_01 package_index_02 package_index_03 package_index_04 \
          package_index_05 package_index_06 package_index_07]
    }

    #
    # NOTE: The URI where the remote package index may be obtained.
    #
    variable packageIndexUri; # DEFAULT: ${baseUri}/${urn}

    if {$cleanup} then {
      unset -nocomplain packageIndexUri
    } elseif {$force || ![info exists packageIndexUri]} then {
      set packageIndexUri {${baseUri}/${urn}}
    }

    #
    # NOTE: The URI where the current external IP address may be obtained.
    #
    variable ipUri; # DEFAULT: ${baseUri}/${urn}

    if {$cleanup} then {
      unset -nocomplain ipUri
    } elseif {$force || ![info exists ipUri]} then {
      set ipUri {${baseUri}/${urn}}
    }

    #
    # NOTE: The list of URNs, relative to the base URI, where the current
    #       external IP address may be obtained.  One of these will be
    #       selected at random.
    #
    variable ipUrns; # DEFAULT: ip_01 ... ip_NN

    if {$cleanup} then {
      unset -nocomplain ipUrns
    } elseif {$force || ![info exists ipUrns]} then {
      set ipUrns [list ip_01]
    }
  }

  #
  # NOTE: This procedure attempts to download and extract the Package Client
  #       Toolset.  The optional channel argument is the output channel where
  #       diagnostic information is sent.  The optional quiet argument should
  #       be non-zero to prevent diagnostic information from being emitted.
  #       This procedure may raise script errors.  The return value is the
  #       full path to the directory that should be added to the auto-path.
  #
  proc downloadAndExtractPackageClientToolset {
          {channel stdout} {quiet false} } {
    setupPackageToolsetVars false

    variable baseUri
    variable packageToolsetUri
    variable packageToolsetUrn

    package require Eagle.Test
    package require Eagle.Unzip

    set extractRootDirectory [getPackageInstallPath pkgd ea-pt-di]

    set uri [subst $packageToolsetUri]
    set fileName [getTemporaryFileName]

    if {[isEagle]} then {
      uri download $uri $fileName
    } else {
      package require Eagle.Tools.Common

      namespace import -force \
          ::Eagle::Tools::Common::getFileViaHttp \
          ::Eagle::Tools::Common::writeFile

      set data [getFileViaHttp $uri 20 $channel $quiet -binary true]

      writeFile $fileName $data
    }

    set extractDirectory [extractZipArchive \
        $fileName $extractRootDirectory true]

    file delete $fileName

    return [file join $extractDirectory pkgr_an_d client 1.0 neutral]
  }

  #
  # NOTE: This procedure attempts to load (via [package require]) the package
  #       client toolset.  It is designed to be used in conjunction with the
  #       [downloadAndExtractPackageClientToolset] procedure, above.  Support
  #       is included for specifying an extra auto-path directory and API key
  #       to use.  By default, the [package unknown] handler is hooked to add
  #       the remote package repository lookup functionality.  Eagle supports
  #       extra script security via signed script certificates, which will be
  #       enabled by default, unless it is unavailable.
  #
  proc loadPackageClientToolset {
          {directory auto} {apiKeys ""} {hookUnknown true} {enableSecurity true}
          {isolateSecurity false} {strictSecurity false} {fetchKeyRing false}
          {debug false} } {
    #
    # NOTE: When running in Eagle, namespace support must be available and
    #       enabled.
    #
    if {[isEagle] && ![namespace enable]} then {
      error "namespace support must be enabled"
    }

    #
    # NOTE: Does the caller want automatic discovery of the directory that
    #       contains the (downloaded?) package client toolset?  Currently,
    #       this only works on Windows and searches the temporary download
    #       location, which normally obtains its value from the environment
    #       variable TEMP.
    #
    if {$directory eq "auto"} then {
      #
      # NOTE: First, before doing anything else, see if the package client
      #       toolset is already installed somewhere it can be loaded from.
      #
      set needDirectory true

      if {[isEagle]} then {
        #
        # NOTE: Force Eagle to find *ALL* available package index files.
        #       This must be done in the global scope so that the special
        #       global variable 'dir' set by the package index loading
        #       subsystem can be accessed.  Use [catch] here just in case
        #       a package index file raises a script error.
        #
        catch {
          uplevel #0 [list package scan -host -normal -refresh]
        }
      } else {
        #
        # HACK: Force Tcl to find *ALL* available package index files.
        #       Without this, checking for the available versions of a
        #       package using [package versions] likely will not succeed
        #       unless the package is already loaded.  Use [catch] here
        #       just in case a package index file raises a script error.
        #
        catch {
          package require [appendArgs \
              bogus_package_ [string trim [clock seconds] -]]
        }
      }

      #
      # NOTE: Check and see if the package repository client is a known
      #       package now.  If so, there is no need to search directories
      #       for it.
      #
      if {[llength [package versions Eagle.Package.Repository]] > 0} then {
        set needDirectory false
      }

      #
      # NOTE: Is searching for temporary download directories required at
      #       this point?
      #
      if {$needDirectory} then {
        set extractRootDirectory [getPackageInstallPath]

        foreach directory [findDirectoriesRecursive \
            [file join $extractRootDirectory pkgr_an_d]] {
          #
          # NOTE: Reset directory we just found to include the necessary
          #       sub-directory components for the actual client files
          #       and then stop, thereby selecting the first match.
          #
          set directory [file join $directory client 1.0 neutral]; break
        }
      }

      #
      # NOTE: If no directory was found, just clear the directory name,
      #       which will cause auto-path modification(s) to be skipped.
      #
      if {$directory eq "auto"} then {
        set directory ""
      }
    }

    #
    # NOTE: If there is a directory specified by the caller -OR- found
    #       via automatic directory discovery, add it to the auto-path
    #       now.
    #
    if {[string length $directory] > 0} then {
      #
      # NOTE: Only modify the auto-path if the directory is not already
      #       present.  This prevents needless variable trace execution
      #       that rescans the various auto-path directories.
      #
      if {![info exists ::auto_path] || \
          [lsearch -exact $::auto_path $directory] == -1} then {
        lappend ::auto_path $directory
      }
    }

    #
    # NOTE: If the caller wants to enable extra diagnostic information,
    #       set the appropriate environment variables now.
    #
    if {$debug} then {
      set ::env(DEBUG_PKGR) 1
      set ::env(DEBUG_PKGD) 1
      set ::env(DEBUG_PKGU) 1
    }

    #
    # NOTE: If the caller specified API keys, add them to the configured
    #       list of API keys for the package repository client now.  This
    #       uses a special global variable.
    #
    if {[llength $apiKeys] > 0} then {
      eval lappend ::pkgr_api_keys $apiKeys
    }

    #
    # NOTE: If the caller wants to enable the extra Eagle script security,
    #       attempt to do that now.  Only treat a failure here as fatal if
    #       the caller said so.
    #
    if {[isEagle] && $enableSecurity} then {
      if {[catch {
        try {
          if {$isolateSecurity} then {
            set savedPluginFlags [object invoke -flags +NonPublic \
                Interpreter.GetActive PluginFlags]

            object invoke -flags +NonPublic Interpreter.GetActive \
                PluginFlags [combineFlags $savedPluginFlags Isolated]
          }

          uplevel 1 [list source enableSecurity]
        } finally {
          if {$isolateSecurity && [info exists savedPluginFlags]} then {
            object invoke -flags +NonPublic Interpreter.GetActive \
                PluginFlags [appendArgs = $savedPluginFlags]
          }
        }
      } error] && $strictSecurity} then {
        error $error
      }
    }

    #
    # NOTE: If the caller wants to fetch an official key ring from remote
    #       URI (i.e. within Harpy), attempt to do that now.  Only treat
    #       a failure here as fatal if the caller said so.
    #
    if {[isEagle] && $fetchKeyRing} then {
      if {[catch {
        try {
          if {$isolateSecurity} then {
            set savedPluginFlags [object invoke -flags +NonPublic \
                Interpreter.GetActive PluginFlags]

            object invoke -flags +NonPublic Interpreter.GetActive \
                PluginFlags [combineFlags $savedPluginFlags Isolated]
          }

          uplevel 1 [list debug keyring]
        } finally {
          if {$isolateSecurity && [info exists savedPluginFlags]} then {
            object invoke -flags +NonPublic Interpreter.GetActive \
                PluginFlags [appendArgs = $savedPluginFlags]
          }
        }
      } error] && $strictSecurity} then {
        error $error
      }
    }

    #
    # NOTE: In Eagle, to actually enable make use of the [package unknown]
    #       handler, an interpreter flag must be disabled.  If necessary,
    #       do that now.
    #
    if {[isEagle] && $hookUnknown} then {
      object invoke -flags +NonPublic -objectflags +AutoFlagsEnum \
          Interpreter.GetActive interpreterFlags -NoPackageUnknown
    }

    #
    # NOTE: Finally, attempt to actually load the package repository client.
    #       This may fail for a number of reasons.  The most likely failure
    #       case is when the directory containing the package is not found;
    #       however, there are other possible failure modes.
    #
    package require Eagle.Package.Repository
  }

  #
  # NOTE: This procedure attempts to download and extract a native TclKit DLL
  #       for the current platform.  The optional channel argument is the
  #       output channel where diagnostic information is sent.  The optional
  #       quiet argument should be non-zero to prevent diagnostic information
  #       from being emitted.  This procedure may raise script errors.  The
  #       return value is the full path to the native TclKit DLL file.
  #
  proc downloadAndExtractNativeTclKitDll {
          {channel stdout} {quiet false} } {
    setupPackageToolsetVars false

    variable baseUri
    variable tclKitDllUri
    variable tclKitDllUrn

    package require Eagle.Test
    package require Eagle.Unzip

    set platform [machineToPlatform $::tcl_platform(machine) true]

    set extractRootDirectory [getPackageInstallPath \
        [appendArgs KitDll_ $platform] ea-td-di]

    set urn [subst $tclKitDllUrn]; set uri [subst $tclKitDllUri]
    set fileName [getTemporaryFileName]

    if {[isEagle]} then {
      uri download $uri $fileName
    } else {
      package require Eagle.Tools.Common

      namespace import -force \
          ::Eagle::Tools::Common::getFileViaHttp \
          ::Eagle::Tools::Common::writeFile

      set data [getFileViaHttp $uri 20 $channel $quiet -binary true]

      writeFile $fileName $data
    }

    set extractDirectory [extractZipArchive \
        $fileName $extractRootDirectory true]

    file delete $fileName

    return [lindex [glob -nocomplain \
        [file join $extractDirectory lib *[info sharedlibextension]]] 0]
  }

  #
  # NOTE: This procedure attempts to download and extract the Security Toolset,
  #       which includes the Harpy and Badge plugins.  The optional channel
  #       argument is the output channel where diagnostic information is sent.
  #       The optional quiet argument should be non-zero to prevent diagnostic
  #       information from being emitted.  This procedure may raise script
  #       errors.  The return value is the full path to a directory that should
  #       contain the "Harpy1.0" and "Badge1.0" plugin directories.
  #
  proc downloadAndExtractSecurityToolset {
          {channel stdout} {quiet false} } {
    setupPackageToolsetVars false

    variable baseUri
    variable securityToolsetUri
    variable securityToolsetUrn

    package require Eagle.Test
    package require Eagle.Unzip

    if {[info exists ::eagle_platform(text)] && \
        [string length $::eagle_platform(text)] > 0} then {
      set platform [string tolower $::eagle_platform(text)]
    } else {
      set platform [string tolower netFx20]; # TODO: Good default?
    }

    set extractRootDirectory [getPackageInstallPath \
        [appendArgs eee_ $platform] ea-st-di]

    set dir [string map [list fx ""] $platform]; # netfx20 -> net20
    set urn [subst $securityToolsetUrn]; set uri [subst $securityToolsetUri]
    set fileName [getTemporaryFileName]

    if {[isEagle]} then {
      uri download $uri $fileName
    } else {
      package require Eagle.Tools.Common

      namespace import -force \
          ::Eagle::Tools::Common::getFileViaHttp \
          ::Eagle::Tools::Common::writeFile

      set data [getFileViaHttp $uri 20 $channel $quiet -binary true]

      writeFile $fileName $data
    }

    set extractDirectory [extractZipArchive \
        $fileName $extractRootDirectory true]

    file delete $fileName

    return [file join $extractDirectory build $dir lib]
  }

  #
  # NOTE: This procedure attempts to request a license certificate for Eagle,
  #       which includes the Harpy and Badge plugins.  The optional channel
  #       argument is the output channel where diagnostic information is sent.
  #       The optional quiet argument should be non-zero to prevent diagnostic
  #       information from being emitted.  This procedure may raise script
  #       errors.  The return value is the fully qualified file name for the
  #       resulting license certificate.
  #
  # WARNING: This procedure will send the short name and display name of the
  #          currently logged on user to the Eagle license server as they are
  #          required for a new license certificate to be issued.  Abuse of
  #          this service may result in a permanent ban from the service and
  #          revocation of any previously issued license certificates.
  #
  proc requestLicenseCertificate {
          {channel stdout} {quiet false} } {
    setupPackageToolsetVars false

    variable baseUri
    variable licenseUri
    variable licenseUrns

    package require Eagle.Test

    set certificateRootDirectory [getTemporaryPath]

    set processDirectoryPrefix [file join $certificateRootDirectory \
        [appendArgs ea-lc-di- [pid] -]]

    #
    # NOTE: Issue a warning to the user if it appears there is already a
    #       license certificate in a temporary directory that was created
    #       by this process.  Hopefully, this should reduce the number of
    #       duplicate requests.
    #
    set varName1 YES_PLEASE_FORCE_A_LICENSE_CERTIFICATE_REQUEST

    if {![info exists ::env($varName1)]} then {
      set processFileNames [list]

      foreach processDirectory [findDirectories \
          [appendArgs $processDirectoryPrefix *]] {
        eval lappend processFileNames [findFiles \
            [file join $processDirectory *]]
      }

      if {[llength $processFileNames] > 0} then {
        set warningCommand [list]

        if {[isEagle]} then {
          lappend warningCommand host result Error
        } else {
          lappend warningCommand puts stderr
        }

        set varName2 Override_Certificate

        lappend warningCommand [appendArgs \
            "One or more temporary license certificate files " \
            "apparently belonging to this process were found.  " \
            "If you wish to override this warning and force a " \
            "new license certificate request to be submitted, " \
            "set the \"" $varName1 "\" environment variable " \
            "(to anything); however, please keep in mind that " \
            "requesting too many license certificates and/or " \
            "requesting license certificates too fast MAY be " \
            "considered abusive behavior.  Upon success, the " \
            "resulting temporary license certificate file " \
            "SHOULD be saved to a secure location on the local " \
            "file system, e.g. the home directory associated " \
            "with the user submitting the license certificate " \
            "request.  The fully qualified file name for the " \
            "temporary license certificate MUST used as the " \
            "value for the \"" $varName2 "\" environment " \
            "variable; otherwise, it MAY NOT be found when one " \
            "of its associated plugins attempts to load.\n"]

        #
        # NOTE: Emit our carefully worded license warning message.
        #
        eval $warningCommand

        #
        # NOTE: Return the first pre-existing license certificate file
        #       name that was found.
        #
        return [lindex $processFileNames 0]
      }
    }

    set directory [appendArgs \
        $processDirectoryPrefix [string trim [clock seconds] -]]

    if {[info exists ::env(LicenseUri)]} then {
      #
      # HACK: Allow license request URI to be overridden via the global
      #       environment.  This is necessary to enable testing on Mono.
      #
      set uri $::env(LicenseUri)
    } else {
      #
      # NOTE: Normally, choose a random URN, which will resolve to one
      #       of the official license request processing servers.
      #
      set urn [subst [lindex \
          $licenseUrns [expr {int(rand() * [llength $licenseUrns])}]]]

      set uri [subst $licenseUri]
    }

    #
    # HACK: If overridden (via the environment), use the user name
    #       specified; otherwise, attempt to automatically detect it.
    #       The server does not really care what this value is.  It
    #       can detect abuse by originating IP address, etc.
    #
    if {[info exists ::env(LicenseUserName)]} then {
      set userName $::env(LicenseUserName)
    } else {
      if {![isEagle] || [catch {
        object invoke System.Security.Principal.WindowsIdentity \
            GetCurrent.Name
      } userName]} then {
        #
        # HACK: Fallback to using a value from the "tcl_platform" array.
        #       For native Tcl, this is the only choice.  For Eagle, it
        #       is used as a fallback.
        #
        if {[info exists ::tcl_platform(user)]} then {
          set userName $::tcl_platform(user)
        } else {
          set userName "NO USER NAME"
        }
      }
    }

    #
    # HACK: If overridden (via the environment), use the display name
    #       specified; otherwise, attempt to automatically detect it.
    #       The server does not really care what this value is.  It
    #       can detect abuse by originating IP address, etc.
    #
    if {[info exists ::env(LicenseDisplayName)]} then {
      set displayName $::env(LicenseDisplayName)
    } else {
      if {![isEagle] || [catch {
        object load System.DirectoryServices.AccountManagement

        object invoke \
            System.DirectoryServices.AccountManagement.UserPrincipal \
            Current.DisplayName
      } displayName]} then {
        #
        # HACK: Fallback to using a value from the "tcl_platform" array.
        #       This value is not set by native Tcl or Eagle; therefore,
        #       the user would have to set it manually prior to calling
        #       this procedure.
        #
        if {[info exists ::tcl_platform(userDisplayName)]} then {
          set displayName $::tcl_platform(userDisplayName)
        } else {
          set displayName "NO DISPLAY NAME"
        }
      }
    }

    #
    # NOTE: Add the necessary query parameters to the license request
    #       URI, making sure to properly escape their values.
    #
    if {[isEagle]} then {
      append uri ?userName= [uri escape data $userName]
      append uri &displayName= [uri escape data $displayName]
    } else {
      package require http 2.0

      append uri ? [::http::formatQuery \
          userName $userName displayName $displayName]
    }

    if {[isEagle]} then {
      set data [uri download -inline $uri]
    } else {
      package require Eagle.Tools.Common

      namespace import -force \
          ::Eagle::Tools::Common::getFileViaHttp \
          ::Eagle::Tools::Common::writeFile

      set data [getFileViaHttp $uri 20 $channel $quiet -binary true]
      package require Eagle.Auxiliary
    }

    if {[getDictionaryValue $data returnCode] ne "Ok"} then {
      if {[string length $data] > 0} then {
        error [appendArgs \
            "request failed with error information: " $data]
      } else {
        error "request failed without providing error information"
      }
    }

    set fileName [getTemporaryFileName]
    writeFile $fileName [getDictionaryValue $data result]
    set newFileName [file join $directory [file tail $fileName]]

    file mkdir $directory; file copy $fileName $newFileName
    file delete $fileName

    return $newFileName
  }

  #
  # NOTE: This procedure attempts to submit the specified script to a remote
  #       sandbox for evaluation.  The apiKey parameter is the optional API
  #       key to use, which MAY enable additional permissions in the remote
  #       sandbox.  The params parameter contains any optional extra names
  #       and values to include in the submitted query.  Upon success, this
  #       procedure returns a Tcl dictionary that includes at least the keys
  #       "returnCode", "result", and "errorLine".  The "returnCode" value
  #       will be "Ok", "Error", "Return", "Break", "Continue", or possibly
  #       a signed integer.  The "result" value will be the textual result
  #       of the script or an error message.  The "errorLine" value will be
  #       zero or the line where a script error was raised.  This procedure
  #       may raise script errors.
  #
  proc evaluateInRemoteSandbox {
          script {apiKey ""} {params ""} {channel stdout} {quiet false} } {
    setupPackageToolsetVars false

    variable baseUri
    variable sandboxEvalUri
    variable sandboxEvalUrns

    if {[info exists ::env(SandboxEvalUri)]} then {
      #
      # HACK: Allow remote sandbox URI to be overridden via the global
      #       environment.  This is necessary to enable testing on Mono.
      #
      set uri $::env(SandboxEvalUri)
    } else {
      #
      # NOTE: Normally, choose a random URN, which will resolve to one
      #       of the official remote sandbox servers.
      #
      set urn [subst [lindex \
          $sandboxEvalUrns [expr {int(rand() * [llength $sandboxEvalUrns])}]]]

      set uri [subst $sandboxEvalUri]
    }

    set query [list go 1 raw 1 script $script]

    if {[string length $apiKey] > 0} then {
      lappend query apiKey $apiKey
    }

    if {[llength $params] > 0} then {
      eval lappend query $params
    }

    if {[isEagle]} then {
      return [uri upload -inline -data $query $uri]
    } else {
      package require http 2.0
      package require Eagle.Tools.Common

      namespace import -force \
          ::Eagle::Tools::Common::getFileViaHttp

      return [getFileViaHttp \
          $uri 20 $channel $quiet -binary true \
          -query [eval ::http::formatQuery $query]]
    }
  }

  #
  # NOTE: This procedure attempts to query the list of named example scripts.
  #       The apiKey parameter is the optional API key to use, which MAY enable
  #       additional permissions within the remote repository.  The optional
  #       channel argument is the output channel where diagnostic information
  #       is sent.  The optional quiet argument should be non-zero to prevent
  #       diagnostic information from being emitted.  This procedure may raise
  #       script errors.  The return value is the list of all available example
  #       scripts.
  #
  proc listExampleScripts {
          {apiKey ""} {channel stdout} {quiet false} } {
    setupPackageToolsetVars false

    variable baseUri
    variable scriptUri
    variable scriptUrns

    if {[info exists ::env(ScriptUri)]} then {
      #
      # HACK: Allow example script URI to be overridden via the global
      #       environment.  This is necessary to enable testing on Mono.
      #
      set uri $::env(ScriptUri)
    } else {
      #
      # NOTE: Normally, choose a random URN, which will resolve to one
      #       of the official example script servers.
      #
      set urn [subst [lindex \
          $scriptUrns [expr {int(rand() * [llength $scriptUrns])}]]]

      set uri [subst $scriptUri]
    }

    set query [list raw 1 method list]

    if {[string length $apiKey] > 0} then {
      lappend query apiKey $apiKey
    }

    if {[isEagle]} then {
      set fullUri $uri

      foreach {name value} $query {
        if {[string first ? $fullUri] != -1} then {
          append fullUri &
        } else {
          append fullUri ?
        }

        append fullUri \
            [uri escape data $name] = [uri escape data $value]
      }

      set data [uri download -inline $fullUri]
    } else {
      package require http 2.0
      package require Eagle.Tools.Common

      namespace import -force \
          ::Eagle::Tools::Common::getFileViaHttp \
          ::Eagle::Tools::Common::writeFile

      set data [getFileViaHttp \
          $uri 20 $channel $quiet -binary true \
          -query [eval ::http::formatQuery $query]]
    }

    if {[string length $data] == 0} then {
      error "request failed without providing error information"
    }

    if {![string is list -strict $data] || [llength $data] < 2} then {
      error [appendArgs \
          "request failed with error information: " $data]
    }

    set code [lindex $data 0]
    set result [lindex $data 1]

    if {$code ne "OK"} then {
      error $result
    }

    return $result
  }

  #
  # NOTE: This procedure attempts to download (and save) the specified named
  #       example script.  The apiKey parameter is the optional API key to use,
  #       which MAY enable additional permissions within the remote repository.
  #       The optional channel argument is the output channel where diagnostic
  #       information is sent.  The optional quiet argument should be non-zero
  #       to prevent diagnostic information from being emitted.  This procedure
  #       may raise script errors.  The return value is the full path to the
  #       saved example script.
  #
  proc downloadExampleScript {
          script {apiKey ""} {channel stdout} {quiet false} } {
    setupPackageToolsetVars false

    variable baseUri
    variable scriptUri
    variable scriptUrns

    package require Eagle.Test

    if {[info exists ::env(ScriptUri)]} then {
      #
      # HACK: Allow example script URI to be overridden via the global
      #       environment.  This is necessary to enable testing on Mono.
      #
      set uri $::env(ScriptUri)
    } else {
      #
      # NOTE: Normally, choose a random URN, which will resolve to one
      #       of the official example script servers.
      #
      set urn [subst [lindex \
          $scriptUrns [expr {int(rand() * [llength $scriptUrns])}]]]

      set uri [subst $scriptUri]
    }

    set fileName [getTemporaryFileName]
    set query [list raw 1 method get script $script]

    if {[string length $apiKey] > 0} then {
      lappend query apiKey $apiKey
    }

    if {[isEagle]} then {
      set fullUri $uri

      foreach {name value} $query {
        if {[string first ? $fullUri] != -1} then {
          append fullUri &
        } else {
          append fullUri ?
        }

        append fullUri \
            [uri escape data $name] = [uri escape data $value]
      }

      set data [uri download -inline $fullUri]
    } else {
      package require http 2.0
      package require Eagle.Tools.Common

      namespace import -force \
          ::Eagle::Tools::Common::getFileViaHttp \
          ::Eagle::Tools::Common::writeFile

      set data [getFileViaHttp \
          $uri 20 $channel $quiet -binary true \
          -query [eval ::http::formatQuery $query]]
    }

    if {[string length $data] == 0} then {
      error "request failed without providing error information"
    }

    if {![string is list -strict $data] || [llength $data] < 2} then {
      error [appendArgs \
          "request failed with error information: " $data]
    }

    set code [lindex $data 0]
    set result [lindex $data 1]

    if {$code ne "OK"} then {
      error $result
    }

    set signature ""

    if {[llength $data] >= 2} then {
      set signature [lindex $data 2]
    }

    writeFile $fileName $result

    if {[string length $signature] > 0} then {
      writeFile [appendArgs $fileName .harpy] $signature
    }

    return $fileName
  }

  #
  # NOTE: This procedure attempts to download (and save) the remote package
  #       index script.  The apiKey parameter is the optional API key to use,
  #       which MAY enable additional permissions within the remote repository.
  #       The optional channel argument is the output channel where diagnostic
  #       information is sent.  The optional quiet argument should be non-zero
  #       to prevent diagnostic information from being emitted.  The autoPath
  #       parameter should be non-zero to evaluate the returned package index
  #       -OR- zero to simply save it to the file system.  This procedure may
  #       raise script errors.  The return value is the full path to the saved
  #       package index script if the autoPath parameter is zero; otherwise,
  #       it is the result of the package index script evaluation.
  #
  proc downloadPackageIndexScript {
          {apiKey ""} {channel stdout} {quiet false} } {
    setupPackageToolsetVars false

    variable baseUri
    variable packageIndexUri
    variable packageIndexUrns

    package require Eagle.Test

    if {[info exists ::env(PackageIndexUri)]} then {
      #
      # HACK: Allow package index URI to be overridden via the global
      #       environment.  This is necessary to enable testing on Mono.
      #
      set uri $::env(PackageIndexUri)
    } else {
      #
      # NOTE: Normally, choose a random URN, which will resolve to one
      #       of the official example script servers.
      #
      set urn [subst [lindex $packageIndexUrns \
          [expr {int(rand() * [llength $packageIndexUrns])}]]]

      set uri [subst $packageIndexUri]
    }

    set directory [getTemporaryFileName]

    if {[isEagle]} then {
      file cleanup -type Directory $directory
    }

    file delete $directory; file mkdir $directory

    set fileName [file join $directory pkgIndex.eagle]
    set query [list raw 1 method get script pkgIndex.eagle]

    if {[string length $apiKey] > 0} then {
      lappend query apiKey $apiKey
    }

    if {[isEagle]} then {
      set fullUri $uri

      foreach {name value} $query {
        if {[string first ? $fullUri] != -1} then {
          append fullUri &
        } else {
          append fullUri ?
        }

        append fullUri \
            [uri escape data $name] = [uri escape data $value]
      }

      set data [uri download -inline $fullUri]
    } else {
      package require http 2.0
      package require Eagle.Tools.Common

      namespace import -force \
          ::Eagle::Tools::Common::getFileViaHttp \
          ::Eagle::Tools::Common::writeFile

      set data [getFileViaHttp \
          $uri 20 $channel $quiet -binary true \
          -query [eval ::http::formatQuery $query]]
    }

    if {[string length $data] == 0} then {
      error "request failed without providing error information"
    }

    if {![string is list -strict $data] || [llength $data] < 2} then {
      error [appendArgs \
          "request failed with error information: " $data]
    }

    set code [lindex $data 0]
    set result [lindex $data 1]

    if {$code ne "OK"} then {
      error $result
    }

    set signature ""

    if {[llength $data] >= 2} then {
      set signature [lindex $data 2]
    }

    if {[isEagle]} then {
      file cleanup $fileName
    }

    writeFile $fileName $result

    if {[string length $signature] > 0} then {
      if {[isEagle]} then {
        file cleanup [appendArgs $fileName .harpy]
      }

      writeFile [appendArgs $fileName .harpy] $signature
    }

    return $directory
  }

  #
  # NOTE: This procedure attempts to query (and return) the current external
  #       IPv4/6 address.  The apiKey parameter is the optional API key to use,
  #       which MAY enable additional permissions within the remote repository.
  #       The optional channel argument is the output channel where diagnostic
  #       information is sent.  The optional quiet argument should be non-zero
  #       to prevent diagnostic information from being emitted.  This procedure
  #       may raise script errors.
  #
  proc getExternalIpAddress {
          {apiKey ""} {channel stdout} {quiet false} } {
    setupPackageToolsetVars false

    variable baseUri
    variable ipUri
    variable ipUrns

    package require Eagle.Test

    if {[info exists ::env(IpUri)]} then {
      #
      # HACK: Allow IP address index URI to be overridden via the global
      #       environment.  This is necessary to enable testing on Mono.
      #
      set uri $::env(IpUri)
    } else {
      #
      # NOTE: Normally, choose a random URN, which will resolve to one
      #       of the official example script servers.
      #
      set urn [subst [lindex $ipUrns \
          [expr {int(rand() * [llength $ipUrns])}]]]

      set uri [subst $ipUri]
    }

    set query [list raw 1]

    if {[string length $apiKey] > 0} then {
      lappend query apiKey $apiKey
    }

    if {[isEagle]} then {
      set fullUri $uri

      foreach {name value} $query {
        if {[string first ? $fullUri] != -1} then {
          append fullUri &
        } else {
          append fullUri ?
        }

        append fullUri \
            [uri escape data $name] = [uri escape data $value]
      }

      set data [string trim [uri download -inline $fullUri]]
    } else {
      package require http 2.0
      package require Eagle.Tools.Common

      namespace import -force \
          ::Eagle::Tools::Common::getFileViaHttp \
          ::Eagle::Tools::Common::writeFile

      set data [string trim [getFileViaHttp \
          $uri 20 $channel $quiet -binary true \
          -query [eval ::http::formatQuery $query]]]
    }

    if {[string length $data] == 0} then {
      error "request failed without providing error information"
    }

    if {![string is inetaddr -strict $data]} then {
      error [appendArgs \
          "request failed with error information: " $data]
    }

    return $data
  }

  #
  # NOTE: Provide the Eagle "package toolset" package to the interpreter.
  #
  package provide Eagle.Package.Toolset \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/platform.eagle.























































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
###############################################################################
#
# platform.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Platform Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This is the procedure that detects whether or not we are running
  #       in Eagle (otherwise, it is assumed that we are running in vanilla
  #       Tcl).  This procedure must work correctly in both Tcl and Eagle
  #       and must return non-zero only when running in Eagle.  The same
  #       procedure is also defined in the "init.eagle" file.
  #
  proc isEagle {} {
    #
    # NOTE: Nothing too fancy or expensive should be done here.  In theory,
    #       use of this procedure should be rare; however, in practice, this
    #       procedure is actually used quite a bit (e.g. by the test suite).
    #
    return [expr {[info exists ::tcl_platform(engine)] && \
        [string compare -nocase eagle $::tcl_platform(engine)] == 0}]
  }

  #
  # NOTE: This is the procedure that detects whether or not we are running
  #       in Eagle on Mono (i.e. otherwise, we are running in Tcl or in Eagle
  #       on the .NET Framework or .NET Core).  This procedure must function
  #       correctly in both Tcl and Eagle and must return non-zero only when
  #       running in Eagle on Mono.
  #
  proc isMono {} {
    #
    # NOTE: Nothing too fancy or expensive should be done here.  In theory,
    #       use of this procedure should be rare; however, in practice, this
    #       procedure is actually used quite a bit (e.g. by the test suite).
    #
    return [expr {[info exists ::eagle_platform(runtime)] && \
        [string compare -nocase mono $::eagle_platform(runtime)] == 0}]
  }

  #
  # NOTE: This is the procedure that detects whether or not we are running
  #       in Eagle on .NET Core (i.e. otherwise, we are running in Tcl or in
  #       Eagle on the .NET Framework or Mono).  This procedure must function
  #       correctly in both Tcl and Eagle and must return non-zero only when
  #       running in Eagle on .NET Core.  For the purposes of this procedure,
  #       the ".NET 5" and later runtimes are still treated as .NET Core.
  #
  proc isDotNetCore {} {
    #
    # NOTE: Nothing too fancy or expensive should be done here.  In theory,
    #       use of this procedure should be rare; however, in practice, this
    #       procedure is actually used quite a bit (e.g. by the test suite).
    #
    return [expr {[info exists ::eagle_platform(runtime)] && \
        ([string compare -nocase ".net core" $::eagle_platform(runtime)] == 0 \
      || [string compare -nocase ".net" $::eagle_platform(runtime)] == 0)}]
  }

  #
  # NOTE: This procedure returns non-zero if the logged on user has full
  #       administrator rights on this machine.  Currently, this only works
  #       in Eagle; however, it may work from native Tcl in the future.
  #
  proc isAdministrator {} {
    return [expr {[info exists ::eagle_platform(administrator)] && \
        [string is true -strict $::eagle_platform(administrator)]}]
  }

  #
  # NOTE: This is the procedure that detects whether or not we are running
  #       on Windows (otherwise, it is assumed that we are running on some
  #       flavor of Unix).  This procedure must function correctly in both
  #       Tcl and Eagle and must return non-zero only when on Windows.
  #
  proc isWindows {} {
    #
    # NOTE: Nothing too fancy or expensive should be done here.  In theory,
    #       use of this procedure should be rare; however, in practice, this
    #       procedure is actually used quite a bit (e.g. by the test suite).
    #
    return [expr {[info exists ::tcl_platform(platform)] && \
        $::tcl_platform(platform) eq "windows"}]
  }

  #
  # NOTE: This procedure should return non-zero if and only if only there
  #       is currently an interactive user that can respond to prompts and
  #       other requests for input.
  #
  proc isInteractive {} {
    #
    # TODO: Is something more complex required here?
    #
    return [expr {[info exists ::tcl_interactive] && \
        [string is true -strict $::tcl_interactive]}]
  }

  #
  # NOTE: This procedure adds the specified directory to the PATH.  It is
  #       designed to work on the various flavors of Windows and Unix.
  #
  proc addToPath { dir } {
    global env
    global tcl_platform

    #
    # NOTE: This should work properly in both Tcl and Eagle.
    #       Normalize to an operating system native path.
    #
    set dir [file nativename $dir]

    #
    # NOTE: On Windows, use PATH; otherwise (i.e. Unix), use
    #       LD_LIBRARY_PATH.
    #
    if {[isWindows]} then {
      set name PATH
    } else {
      set name LD_LIBRARY_PATH
    }

    #
    # NOTE: Make sure the directory is not already in the
    #       loader search path.
    #
    if {[info exists tcl_platform(pathSeparator)]} then {
      set separator $tcl_platform(pathSeparator)
    } elseif {[isWindows]} then {
      set separator \;
    } else {
      set separator :
    }

    #
    # NOTE: Does the necessary environment variable exist?
    #
    if {[info exists env($name)]} then {
      #
      # NOTE: Grab the value of the environment variable.
      #
      set value $env($name)

      #
      # BUGBUG: Consider exact case only for now.
      #
      if {[lsearch -exact [split $value $separator] $dir] == -1} then {
        #
        # NOTE: Append the directory to the loader search path.
        #       This allows us to subsequently load DLLs that
        #       implicitly attempt to load other DLLs that are
        #       not in the application directory.
        #
        set env($name) [join [list $value $dir] $separator]

        #
        # NOTE: Yes, we altered the search path.
        #
        return true
      }
    } else {
      #
      # NOTE: Create the loader search path with the directory.
      #
      set env($name) $dir

      #
      # NOTE: Yes, we created the search path.
      #
      return true
    }

    #
    # NOTE: No, we did not alter the search path.
    #
    return false
  }

  #
  # NOTE: This procedure removes the specified directory from the PATH.
  #       It is designed to work on the various flavors of Windows and
  #       Unix.
  #
  proc removeFromPath { dir } {
    global env
    global tcl_platform

    #
    # NOTE: This should work properly in both Tcl and Eagle.
    #       Normalize to an operating system native path.
    #
    set dir [file nativename $dir]

    #
    # NOTE: On Windows, use PATH; otherwise (i.e. Unix), use
    #       LD_LIBRARY_PATH.
    #
    if {[isWindows]} then {
      set name PATH
    } else {
      set name LD_LIBRARY_PATH
    }

    #
    # NOTE: Make sure the directory is in the loader search
    #       path.
    #
    if {[info exists tcl_platform(pathSeparator)]} then {
      set separator $tcl_platform(pathSeparator)
    } elseif {[isWindows]} then {
      set separator \;
    } else {
      set separator :
    }

    #
    # NOTE: Does the necessary environment variable exist?
    #
    if {[info exists env($name)]} then {
      #
      # NOTE: We need to separate the directories in the path
      #       so that we can selectively remove the one we are
      #       looking for.
      #
      set dirs [split $env($name) $separator]

      #
      # BUGBUG: Consider exact case only for now.
      #
      set index [lsearch -exact $dirs $dir]

      #
      # NOTE: Is the directory in the loader search path?
      #
      if {$index != -1} then {
        #
        # NOTE: Remove the directory from the loader search path.
        #
        set dirs [lreplace $dirs $index $index]

        #
        # NOTE: Replace the original loader search path with
        #       our modified one.
        #
        set env($name) [join $dirs $separator]

        #
        # NOTE: Yes, we altered the search path.
        #
        return true
      }
    }

    #
    # NOTE: No, we did not alter the search path.
    #
    return false
  }

  #
  # NOTE: This procedure returns non-zero if the specified file names refer
  #       to the same file, using the most robust method available for the
  #       script engine and platform.
  #
  proc isSameFileName { fileName1 fileName2 } {
    if {[isEagle]} then {
      return [file same $fileName1 $fileName2]
    } else {
      if {[isWindows]} then {
        return [string equal -nocase $fileName1 $fileName2]
      } else {
        return [string equal $fileName1 $fileName2]
      }
    }
  }

  #
  # NOTE: Provide the Eagle "platform" package to the interpreter.
  #
  package provide Eagle.Platform \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/process.eagle.































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
###############################################################################
#
# process.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Process Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This procedure returns a list of process Ids matching the specified
  #       name -OR- all process Ids if the specified name is an empty string.
  #
  proc getProcesses { name } {
    #
    # NOTE: Start with an empty list of process Ids.
    #
    set result [list]

    #
    # NOTE: Are we able to actually query the active processes?
    #
    if {[llength [info commands object]] > 0} then {
      #
      # NOTE: Does the caller want processes matching a specific name
      #       or all processes on the local machine?
      #
      if {[string length $name] > 0} then {
        #
        # NOTE: Get the managed array of processes with matching names.
        #
        set array [object invoke -alias System.Diagnostics.Process \
            GetProcessesByName $name]; # throw
      } else {
        #
        # NOTE: Get the managed array of all processes on the local
        #       machine.
        #
        set array [object invoke -alias System.Diagnostics.Process \
            GetProcesses]; # throw
      }
    } else {
      #
      # NOTE: No, return nothing.
      #
      return $result
    }

    #
    # NOTE: For each process in the resulting array, grab the Id.
    #
    for {set index 0} {$index < [$array Length]} {incr index} {
      #
      # NOTE: Grab the Nth process array element value using the
      #       accessor method.
      #
      set process [$array -alias GetValue $index]

      #
      # NOTE: Add the Id of the process to the result list.  This
      #       may fail on some versions of Mono.
      #
      # BUGFIX: Only do this if the process has not exited?
      #
      if {[catch {
        $process Refresh; $process HasExited
      } exited] == 0 && !$exited && [catch {
        $process Id
      } id] == 0} then {
        lappend result $id
      }

      #
      # NOTE: Get rid of the process object, we no longer need it.
      #       Technically, it is not a requirement to explicitly
      #       unset variables that contain object references;
      #       however, it is useful in helping to document the
      #       code.
      #
      unset process; # dispose
    }

    #
    # NOTE: Get rid of the managed array of processes, we no longer
    #       need it.
    #
    unset array; # dispose

    #
    # NOTE: Return the list of process Ids, which may be empty.
    #
    return $result
  }

  #
  # NOTE: This procedure waits for the specified number of milliseconds for
  #       processes with the specified Ids to exit (or be terminated).
  #
  proc waitForProcesses { ids timeout {collect true} {kill true} } {
    #
    # NOTE: Start with an empty list of process Ids.
    #
    set result [list]

    #
    # NOTE: If requested, run the garbage collector now.  This may be
    #       necessary to successfully wait for processes that are being
    #       kept alive via runtime callable wrappers for out-of-process
    #       COM servers (e.g. Excel).
    #
    if {$collect} then {debug collect}

    #
    # NOTE: Wait for each process in the list to exit.
    #
    foreach id $ids {
      #
      # NOTE: Get the process object by its Id.  If it does not exist,
      #       this will raise an error.
      #
      if {[catch {
        object invoke -alias System.Diagnostics.Process \
            GetProcessById $id
      } process] == 0} then {
        #
        # NOTE: Wait a while for the process to exit.
        #
        if {[catch {
          $process WaitForExit $timeout
        } exited] == 0 && $exited} then {
          #
          # NOTE: Ok, process is now exited.
          #
          lappend result $id
        } elseif {$kill} then {
          #
          # NOTE: Attempt to kill the process.
          #
          catch {
            $process Refresh; $process Kill
            lappend result $id
          }
        }
      }

      #
      # NOTE: Get rid of the process (if we actually obtained it to
      #       begin with).
      #
      unset -nocomplain process; # dispose
    }

    return $result
  }

  #
  # NOTE: Provide the Eagle "process" package to the interpreter.
  #
  package provide Eagle.Process \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/runopt.eagle.







































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
###############################################################################
#
# runopt.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Runtime Option Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This procedure returns non-zero if the specified runtime option
  #       is currently set.
  #
  proc hasRuntimeOption { name {default false} } {
    if {[isEagle]} then {
      if {[llength [info commands debug]] > 0} then {
        if {[llength [info subcommands debug runtimeoption]] > 0} then {
          if {[catch {debug runtimeoption has $name} result] == 0} then {
            return $result
          }
        }
      }

      if {[llength [info commands object]] > 0} then {
        if {[catch {
          object invoke Interpreter.GetActive HasRuntimeOption $name
        } result] == 0} then {
          return $result
        }
      }
    } else {
      if {![info exists ::no(tclHasRuntimeOption)] && \
          [info exists ::env(tclHasRuntimeOption)]} then {
        if {[info exists ::eagle_platform(runtimeOptions)] && [set \
            index [lsearch -exact $::eagle_platform(runtimeOptions) \
            $name]] != -1} then {
          return true
        }
      } else {
        if {[info exists ::no(silentTclHasRuntimeOption)] || \
            [info exists ::env(errorOnTclHasRuntimeOption)]} then {
          error [appendArgs \
              "procedure \[" [lindex [info level [info level]] 0] \
              "\] is not enabled for native Tcl"]
        }
      }
    }

    return $default
  }

  #
  # NOTE: This procedure returns the list of runtime options that are
  #       currently set.
  #
  proc listRuntimeOptions { {default ""} } {
    if {[isEagle]} then {
      if {[llength [info commands debug]] > 0} then {
        if {[llength [info subcommands debug runtimeoption]] > 0} then {
          if {[catch {debug runtimeoption get} result] == 0} then {
            return $result
          }
        }
      }

      if {[llength [info commands object]] > 0} then {
        if {[catch {
          object invoke Interpreter.GetActive RuntimeOptions.ToString
        } result] == 0} then {
          return $result
        }
      }
    } else {
      if {![info exists ::no(tclListRuntimeOptions)] && \
          [info exists ::env(tclListRuntimeOptions)]} then {
        if {[info exists ::eagle_platform(runtimeOptions)]} then {
          return $::eagle_platform(runtimeOptions)
        }
      } else {
        if {[info exists ::no(silentTclListRuntimeOptions)] || \
            [info exists ::env(errorOnTclListRuntimeOptions)]} then {
          error [appendArgs \
              "procedure \[" [lindex [info level [info level]] 0] \
              "\] is not enabled for native Tcl"]
        }
      }
    }

    return $default
  }

  #
  # NOTE: This procedure attempts to add the specified runtime option and
  #       returns non-zero if it was actually added.
  #
  proc addRuntimeOption { name } {
    if {[isEagle]} then {
      if {[llength [info commands debug]] > 0} then {
        if {[llength [info subcommands debug runtimeoption]] > 0} then {
          if {[catch {debug runtimeoption add $name} result] == 0} then {
            return $result
          }
        }
      }

      if {[llength [info commands object]] > 0} then {
        if {[catch {
          object invoke Interpreter.GetActive AddRuntimeOption $name
        } result] == 0} then {
          return $result
        }
      }
    } else {
      if {![info exists ::no(tclAddRuntimeOption)] && \
          [info exists ::env(tclAddRuntimeOption)]} then {
        if {![info exists ::eagle_platform(runtimeOptions)] || [set \
            index [lsearch -exact $::eagle_platform(runtimeOptions) \
            $name]] == -1} then {
          lappend ::eagle_platform(runtimeOptions) $name
          return true
        }
      } else {
        if {[info exists ::no(silentTclAddRuntimeOption)] || \
            [info exists ::env(errorOnTclAddRuntimeOption)]} then {
          error [appendArgs \
              "procedure \[" [lindex [info level [info level]] 0] \
              "\] is not enabled for native Tcl"]
        }
      }
    }

    return false
  }

  #
  # NOTE: This procedure attempts to remove the specified runtime option
  #       and returns non-zero if it was actually removed.
  #
  proc removeRuntimeOption { name } {
    if {[isEagle]} then {
      if {[llength [info commands debug]] > 0} then {
        if {[llength [info subcommands debug runtimeoption]] > 0} then {
          if {[catch {debug runtimeoption remove $name} result] == 0} then {
            return $result
          }
        }
      }

      if {[llength [info commands object]] > 0} then {
        if {[catch {
          object invoke Interpreter.GetActive RemoveRuntimeOption $name
        } result] == 0} then {
          return $result
        }
      }
    } else {
      if {![info exists ::no(tclRemoveRuntimeOption)] && \
          [info exists ::env(tclRemoveRuntimeOption)]} then {
        if {[info exists ::eagle_platform(runtimeOptions)] && [set \
            index [lsearch -exact $::eagle_platform(runtimeOptions) \
            $name]] != -1} then {
          set ::eagle_platform(runtimeOptions) [lreplace \
              $::eagle_platform(runtimeOptions) $index $index]

          return true
        }
      } else {
        if {[info exists ::no(silentTclRemoveRuntimeOption)] || \
            [info exists ::env(errorOnTclRemoveRuntimeOption)]} then {
          error [appendArgs \
              "procedure \[" [lindex [info level [info level]] 0] \
              "\] is not enabled for native Tcl"]
        }
      }
    }

    return false
  }

  proc toggleRuntimeOption { name {value ""} } {
    if {[string length $value] == 0} then {
      set value [expr {![hasRuntimeOption $name]}]
    }

    if {$value} then {
      return [addRuntimeOption $name]
    } else {
      return [removeRuntimeOption $name]
    }
  }

  #
  # NOTE: Provide the Eagle "runtime option" package to the interpreter.
  #
  package provide Eagle.Runtime.Option \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/safe.eagle.





















































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
###############################################################################
#
# safe.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Safe Interpreter Initialization File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This is the procedure that detects whether or not we are
  #       running in Eagle (otherwise, we are running in vanilla Tcl).
  #       This procedure must function correctly in both Tcl and Eagle
  #       and must return non-zero only when running in Eagle.  This
  #       procedure must be defined in this script file because it is
  #       needed while this script file is being evaluated.  The same
  #       procedure is also defined in the "init.eagle" file.
  #
  # <bootstrap>
  proc isEagle {} {
    #
    # NOTE: Nothing too fancy or expensive should be done in here.  In
    #       theory, use of this routine should be rare; however, in
    #       practice, this routine is actually used quite a bit (e.g.
    #       by the test suite).
    #
    return [expr {[info exists ::tcl_platform(engine)] && \
        [string compare -nocase eagle $::tcl_platform(engine)] == 0}]
  }

  #
  # NOTE: This procedure accepts an any number of arguments.  The arguments
  #       are appended into one big string, verbatim.  The resulting string
  #       is returned.  Normally, this procedure is used to avoid undesired
  #       string interpolation operations.
  #
  # <demonstration>
  proc appendArgs { args } {
    set result ""; eval append result $args
  }

  if {[isEagle]} then {
    ###########################################################################
    ############################ BEGIN Eagle ONLY #############################
    ###########################################################################

    #
    # NOTE: This is the [unknown] command for Eagle.  It will normally be
    #       executed by the script engine when a command is not found.
    #       It will simply raise a script error.
    #
    # <create>
    proc unknown { name args } {
      #
      # NOTE: This is an [unknown] procedure that produces an appropriate
      #       error message.
      #
      # TODO: Add support for auto-loading packages here in the future?
      #
      # NOTE: This command cannot use [appendArgs] because that procedure
      #       is defined in another file that is never loaded into "safe"
      #       interpreters.
      #
      return -code error "invalid command name \"$name\""
    }

    #
    # NOTE: This namespace and the procedure defined within it are used for
    #       compatibility with native Tcl.
    #
    namespace eval ::tcl::tm {
      #
      # NOTE: Ideally, this procedure should be created in the "::tcl::tm"
      #       namespace.
      #
      # <create>
      proc ::tcl::tm::UnknownHandler { original name args } {
        #
        # NOTE: Do nothing except call the original handler.
        #
        uplevel 1 $original [::linsert $args 0 $name]
      }
    }

    #
    # NOTE: This procedure is normally executed by the package management
    #       subsystem of Eagle when a package is requested that cannot be
    #       found.
    #
    # <create>
    proc tclPkgUnknown { name args } {
      #
      # NOTE: Do nothing since this is probably a safe interpreter.
      #
      return
    }

    ###########################################################################
    ############################# END Eagle ONLY ##############################
    ###########################################################################
  }

  #
  # NOTE: Provide the Eagle "safe" package to the interpreter.
  #
  package provide Eagle.Safe \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/shell.eagle.









































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
###############################################################################
#
# shell.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Shell Initialization File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  if {[isEagle]} then {
    ###########################################################################
    ############################ BEGIN Eagle ONLY #############################
    ###########################################################################

    #
    # NOTE: Commands specific to initializing the Eagle interactive shell
    #       environment should be placed here.
    #
    proc help { args } {
      # <help>
      # Displays interactive command help using the interactive "#help"
      # command.
      # </help>

      host result Break [appendArgs \
          "\nFor interactive help please use: #help " $args \
          "\nFor commercial support, please use: #support\n"]

      catch {
        object invoke Interpreter.GetActive Host.WriteLine \
            "\nPlease press any key to continue...\n"

        set key null; object invoke Interpreter.GetActive \
            Host.ReadKey true key
      }

      eval lappend command #help $args; debug icommand $command
    }

    proc quit { args } {
      # <help>
      # Can be used to exit the interactive shell.  It does this by calling
      # the built-in [exit] command.  It is allowed to perform cleanup and
      # maintenance tasks.
      # </help>

      catch {
        host result Break [appendArgs \
            "WARNING: This command is not (simply) a synonym for the " \
            "built-in [exit] command, primarily because it is allowed " \
            "to perform additional cleanup and maintenance tasks."]
      }

      eval exit $args
    }

    proc #support {} {
      # <help>
      # Shows the requirements for obtaining commercial support and/or
      # redirects to the appropriate web site using the default browser.
      # </help>

      if {[catch {package require Licensing.Core} error(1)] == 0} then {
        #
        # NOTE: Use the command provided by the "Core" plugin to obtain
        #       the support URI.
        #
        if {[catch {set uri [support]} error(2)] == 0} then {
          #
          # NOTE: Make sure the URI is actually valid.
          #
          if {[string length $uri] > 0} then {
            exec -shell $uri &; return
          } else {
            set error(3) "invalid support URI was returned"
          }
        }
      }

      set fileName [file tempname]; set fileData ""

      foreach varName [lsort [info vars]] {
        if {$varName in [list fileData]} then {
          continue
        }

        if {[array exists $varName]} then {
          append fileData [appendArgs \n \
              [list array set $varName [array get $varName]]]
        } else {
          append fileData [appendArgs \n \
              [list set $varName [set $varName]]]
        }
      }

      append fileData \n; writeFile $fileName $fileData
      set ::eagle_shell(errorFileName) $fileName

      error [appendArgs \
          "\n\nIn order to obtain commercial support, at least " \
          "one of the\nfollowing requirements must be met:\n\n" \
          "\t1. Valid, non-expired commercial license agreement\n" \
          "\t   for Eagle Enterprise Edition.\n\n" \
          "\t2. Valid, non-expired commercial support contract\n" \
          "\t   for Eagle Standard Edition.\n\n" \
          "The original error information was saved to the file:\n\n" \
          [string repeat - 60] \n $fileName \n [string repeat - 60] \
          "\n\nPlease provide this file when contacting support."]
    }

    ###########################################################################
    ############################# END Eagle ONLY ##############################
    ###########################################################################
  } else {
    ###########################################################################
    ############################# BEGIN Tcl ONLY ##############################
    ###########################################################################

    #
    # NOTE: Commands specific to initializing the Tcl interactive shell
    #       environment should be placed here.
    #

    ###########################################################################
    ############################## END Tcl ONLY ###############################
    ###########################################################################
  }

  #
  # NOTE: Provide the Eagle "shell" package to the interpreter.
  #
  package provide Eagle.Shell \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/shim.eagle.











































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
###############################################################################
#
# shim.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle [Native Tcl] Shim Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This procedure returns the [format] modifier necessary to force
  #       native Tcl to treat the specified value as a 64-bit integer.
  #
  proc getLengthModifier { value {width ""} } {
    #
    # NOTE: This should work properly in both Tcl and Eagle.
    #
    return [appendArgs \
        $width [expr {int($value) != wide($value) ? "l" : ""}]]
  }

  #
  # NOTE: This procedure is used to intercept calls to the Eagle [debug]
  #       command from native Tcl scripts (e.g. [debug break], etc).  It
  #       simply prints a diagnostic message.
  #
  proc debug { args } {
    #
    # NOTE: This should work properly in both Tcl and Eagle.
    #
    puts stdout [lrange $args 2 end]
  }

  #
  # NOTE: Provide the Eagle "Tcl shim" package to the interpreter.
  #
  package provide Eagle.Tcl.Shim \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/test.eagle.





















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
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
7464
7465
7466
7467
7468
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
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
###############################################################################
#
# test.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Test Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  proc evalPackageIndexFile {
          fileName {directory ""} {ignoreFileDirectory false} } {
    if {[string length $directory] == 0} then {
      set directory [expr {
        $ignoreFileDirectory ? "" : [file dirname $fileName]
      }]

      if {[string length $directory] == 0 || $directory eq "."} then {
        if {[isEagle]} then {
          set directory [file dirname [lindex [info assembly true] end]]
        } else {
          set directory [file dirname [info nameofexecutable]]
        }
      }
    }

    if {[info exists ::dir]} then {
      set savedDir $::dir
    } else {
      unset -nocomplain savedDir
    }

    try {
      set ::dir $directory

      return [uplevel #0 [list source $fileName]]
    } finally {
      if {[info exists savedDir]} then {
        set ::dir $savedDir
      } else {
        unset -nocomplain ::dir
      }
    }
  }

  proc cleanupAfterEvents { {quiet false} } {
    set count 0

    if {[catch {
      foreach id [after info] {
        if {[catch {after cancel $id} error2] == 0} then {
          incr count; # canceled one more.
        } else {
          if {!$quiet} then {
            tputs $::test_channel [appendArgs \
                "---- failed to cancel after event \"" \
                $id "\": " $error2 \n]
          }
        }
      }
    } error1] == 0} then {
      if {!$quiet} then {
        tputs $::test_channel [appendArgs \
            "---- cleaned up " $count " after events\n"]
      }

      return $count
    } else {
      if {!$quiet} then {
        tputs $::test_channel [appendArgs \
            "---- failed to cleanup after events (" \
            $count "): " $error1 \n]
      }

      return -1; # failure
    }
  }

  proc findParentDirectory { path name } {
    if {[string length $name] > 0} then {
      while {[string length $path] > 0} {
        set tail [file tail $path]
        if {[string length $tail] == 0} then {break}
        if {$tail eq $name} then {return $path}
        set newPath [file dirname $path]
        if {$newPath eq $path} then {break}
        set path $newPath
      }
    }

    return ""; # NOTE: Not found.
  }

  proc enableRuntimeOptionsForTcl { enable } {
    #
    # NOTE: Enable all fallbacks for the runtime option
    #       procedures (within the core script library)
    #       that rely upon the global list value within
    #       the "eagle_platform(runtimeOptions)" script
    #       variable.
    #
    if {$enable} then {
      set ::env(tclHasRuntimeOption) 1
      set ::env(tclListRuntimeOptions) 1
      set ::env(tclAddRuntimeOption) 1
      set ::env(tclRemoveRuntimeOption) 1
    } else {
      unset -nocomplain ::env(tclRemoveRuntimeOption)
      unset -nocomplain ::env(tclAddRuntimeOption)
      unset -nocomplain ::env(tclListRuntimeOptions)
      unset -nocomplain ::env(tclHasRuntimeOption)
    }

    return ""
  }

  proc setupEvaluateViaTemporaryFile { varName name script } {
    if {[string length $varName] == 0} then {
      error "variable name is required for a temporary script file"
    }

    upvar 1 $varName array
    set element [appendArgs evaluateViaTemporaryFile : $name]

    if {[info exists array($element)]} then {
      set fileName $array($element)

      if {![file exists $fileName]} then {
        error [appendArgs \
            "temporary file \"" $fileName "\" for \"" \
            $name "\" does not exist"]
      }

      if {$script ne [readFile $fileName]} then {
        error [appendArgs \
            "temporary file \"" $fileName "\" for \"" \
            $name "\" does not match script"]
      }
    } elseif {[string length $script] > 0} then {
      set fileName [getTemporaryFileName]

      writeFile $fileName $script

      set array($element) $fileName
    } else {
      error [appendArgs \
          "cannot create temporary file for \"" $name \
          "\" without a script"]
    }

    return $fileName
  }

  proc evaluateViaTemporaryFile { varName name script {verbose 0} } {
    #
    # NOTE: Example usage of this procedure should be similar to the
    #       following:
    #
    #       try {
    #         evaluateViaTemporaryFile "" <unique script name> {
    #           <script block here>
    #         }
    #       } finally {
    #         cleanupEvaluateViaTemporaryFiles ""
    #       }
    #
    if {[string length $varName] == 0} then {
      set varName eagle_debugger; # HACK: Eagle "system" variable.
    }

    #
    # NOTE: Since this procedure uses the [try] command, it will
    #       require Tcl 8.6+ -OR- Eagle -OR- a shim.
    #
    try {
      upvar 1 $varName debugger

      set fileName [setupEvaluateViaTemporaryFile \
          debugger $name $script]

      return [uplevel 1 [list source $fileName]]
    } finally {
      if {[string length $varName] == 0 && \
          [info exists fileName] && \
          [string length $fileName] > 0} then {
        if {![info exists ::no(deleteEvaluateViaTemporaryFile)]} then {
          if {[info exists fileName] && \
              [string length $fileName] > 0 && \
              [file exists $fileName]} then {
            if {[catch {file delete $fileName} error]} then {
              if {$verbose > 0} then {
                tputs $::test_channel [appendArgs \
                    "---- temporary script cleanup failure (1): " \
                    $error \n]
              }
            }
          }
        }
      }
    }
  }

  proc cleanupEvaluateViaTemporaryFiles { varName {verbose 0} } {
    if {[string length $varName] == 0} then {
      set varName eagle_debugger; # HACK: Eagle "system" variable.
    }

    set result [list]

    upvar 1 $varName debugger

    foreach name [lsort [array names \
        debugger evaluateViaTemporaryFile:*]] {
      set fileName $debugger($name)

      if {[file exists $fileName] && \
          [file isfile $fileName]} then {
        if {[catch {file delete $fileName} error] == 0} then {
          unset -nocomplain debugger($name)
          lappend result $fileName
        } else {
          if {$verbose > 0} then {
            tputs $::test_channel [appendArgs \
                "---- temporary script cleanup failure (2): " \
                $error \n]
          }
        }
      }
    }

    return $result
  }

  proc getKnownTclVariables {} {
    #
    # HACK: If the caller is not the global frame (somehow?), then return
    #       nothing, as we can only handle global variables.
    #
    if {[uplevel 1 [list info level]] != 0} then {
      return [list]
    }

    #
    # HACK: This is the list of documented global variables that are used
    #       by the Tcl core library and/or its shell (on any platform).
    #       Please refer to the following web pages:
    #
    #       https://www.tcl.tk/man/tcl/TclCmd/tclvars.htm
    #       https://wiki.tcl.tk/tclvars
    #
    return [lsort [list \
        argc \
        argv \
        argv0 \
        auto_execs \
        auto_index \
        auto_noexec \
        auto_noload \
        auto_oldpath \
        auto_path \
        env \
        errorCode \
        errorInfo \
        tclDefaultLibrary \
        tcl_interactive \
        tcl_libpath \
        tcl_library \
        tcl_patchLevel \
        tcl_pkgPath \
        tcl_platform \
        tcl_precision \
        tcl_rcFileName \
        tcl_rcRsrcName \
        tcl_traceCompile \
        tcl_traceExec \
        tcl_version \
        tcl_wordchars \
        tcl_nonwordchars \
        unknown_pending]]
  }

  proc getKnownTestVariables {} {
    #
    # HACK: If the caller is not the global frame (somehow?), then return
    #       nothing, as we can only handle global variables.
    #
    if {[uplevel 1 [list info level]] != 0} then {
      return [list]
    }

    return [lsort [list \
        path \
        test_all_path \
        test_base_cops \
        test_base_cops_multipliers \
        test_break_on_leak \
        test_channel \
        test_configuration \
        test_constraints \
        test_cops \
        test_data_path \
        test_database \
        test_database_subst \
        test_database_table \
        test_database_type \
        test_exit_on_complete \
        test_extra_paths \
        test_file \
        test_flags \
        test_home_path \
        test_host \
        test_hosts \
        test_join_timeout \
        test_listed_leaks \
        test_log \
        test_log_id \
        test_log_path \
        test_log_queue \
        test_log_sentry \
        test_long_timeout \
        test_machine \
        test_mdas \
        test_name_prefix \
        test_package_path \
        test_path \
        test_platform \
        test_port \
        test_puts_state \
        test_random_order \
        test_repository_checkout \
        test_repository_file \
        test_repository_tags \
        test_repository_url \
        test_run_bucket \
        test_run_id \
        test_script \
        test_settings_path \
        test_statistics \
        test_stop_on_failure \
        test_stop_on_leak \
        test_stress_count \
        test_suffix \
        test_suite \
        test_suite_errors \
        test_suite_file \
        test_suite_running \
        test_tclsh \
        test_tclsh_raw \
        test_tclsh_verbose \
        test_threshold \
        test_timeout \
        test_timestamp \
        test_uncounted_leaks \
        test_visual_studio \
        test_verbose \
        test_volume \
        test_wait \
        test_well_known \
        test_wix]]
  }

  proc getKnownOtherVariables {} {
    #
    # HACK: If the caller is (somehow?) not the global frame, we should
    #       return nothing, as we can only handle global variables.
    #
    if {[uplevel 1 [list info level]] != 0} then {
      return [list]
    }

    set result [list \
        base_path \
        bin_file \
        bin_path \
        core_bin_path \
        core_lib_path \
        key_path \
        lib_path \
        native_lib_path \
        no \
        root_path]

    #
    # HACK: When running on Eagle, eagle_platform is a system variable
    #       and does not need to be returned from this procedure.
    #
    if {![isEagle]} then {
      #
      # HACK: This is necessary to preserve runtime options, which are
      #       contained in the eagle_platform(runtimeOptions) element.
      #
      lappend result eagle_platform;
    }

    return [lsort $result]
  }

  proc cleanState {
          {namespaceName ""} {excludePatterns ""} {noTest false}
          {noOther false} {checkOnly false} } {
    set result [list]

    if {[string length $namespaceName] > 0} then {
      set command(all) [list \
          info vars [appendArgs $namespaceName ::*]]

      if {[isEagle]} then {
        set command(sys) [list \
            info sysvars [appendArgs $namespaceName ::*]]
      } else {
        #
        # BUGBUG: There are no documented built-in
        #         script variables that reside in
        #         non-global namespaces within the
        #         native Tcl implementation.
        #
        # TODO: This may change in the future.
        #
        set command(sys) [list]
      }
    } else {
      set command(all) [list info vars]

      if {[isEagle]} then {
        set command(sys) [list info sysvars]
      } else {
        set command(sys) [list getKnownTclVariables]
      }
    }

    set varNames(all) [uplevel 1 $command(all)]
    set varNames(sys) [uplevel 1 $command(sys)]

    if {!$noTest} then {
      eval lappend varNames(sys) [uplevel 1 getKnownTestVariables]
    }

    if {!$noOther} then {
      eval lappend varNames(sys) [uplevel 1 getKnownOtherVariables]
    }

    foreach varName $varNames(all) {
      if {[inverseLsearchGlob false $excludePatterns $varName] == -1 && \
          [lsearch -exact $varNames(sys) $varName] == -1} then {
        #
        # NOTE: Remove the variable from the target call frame, ignoring
        #       any errors and then add the variable name to the overall
        #       result of this procedure.
        #
        if {$checkOnly || [catch {
          uplevel 1 [list unset -nocomplain $varName]
        } error] == 0} then {
          if {$checkOnly} then {
            if {[catch {expr {[uplevel 1 \
                [list array exists $varName]] ? "array" : "scalar"
            }} varResult] == 0} then {
              lappend result [list $varName $varResult]
            } else {
              lappend result [list $varName error $varResult]
            }
          } else {
            lappend result [list $varName ok]
          }
        } else {
          lappend result [list $varName error $error]
        }
      }
    }

    return $result
  }

  proc dumpState { {namespaceName ""} } {
    set result [list]

    if {[string length $namespaceName] > 0} then {
      set command [list \
          info vars [appendArgs $namespaceName ::*]]
    } else {
      set command [list info vars]
    }

    set varNames [lsort [uplevel 1 $command]]

    foreach varName $varNames {
      if {[uplevel 1 [list array exists $varName]]} then {
        lappend result $varName [list \
            array [uplevel 1 [list array get $varName]]]
      } elseif {[uplevel 1 [list info exists $varName]]} then {
        lappend result $varName [list \
            scalar [uplevel 1 [list set $varName]]]
      } else {
        lappend result $varName [list undefined]
      }
    }

    return $result
  }

  proc needTestDoEvents {} {
    if {[info exists ::no(needTestDoEvents)]} then {
      #
      # HACK: Disable this procedure, thus forcing some events to be
      #       processed.  This returns true because the default (i.e.
      #       non-exceptional) result is false.
      #
      return true
    }

    if {[isEagle] && [isMono] && [haveConstraint compile.WINFORMS] && \
        [haveConstraint winForms]} then {
      #
      # NOTE: This is Eagle running on Mono with WinForms support.
      #
      return true
    }

    #
    # NOTE: This is either native Tcl -OR- Eagle running on the .NET
    #       Framework (or .NET Core?) -OR- without WinForms support.
    #
    return false
  }

  proc testDoEvents { milliseconds } {
    set count 0; set total 0

    if {$milliseconds > 0} then {
      set sleep [expr {max(50, int($milliseconds / 40.0))}]

      while {$total < $milliseconds} {
        if {[isEagle]} then {
          incr count [update +Count]
        } else {
          update; incr count; # NOTE: Pending events (e.g. WinForms)?
        }

        after $sleep;         # NOTE: Sleep to prevent excess spinning.
        incr total $sleep;    # NOTE: Keep track of approx elapsed time.
      }
    } elseif {$milliseconds == 0} then {
      #
      # NOTE: The number of milliseconds is exactly zero, process
      #       events exactly one time.
      #
      if {[isEagle]} then {
        incr count [update +Count]
      } else {
        update; incr count
      }
    } else {
      #
      # NOTE: The number of milliseconds is negative, do nothing.
      #
    }

    return [list $count $total]
  }

  proc trawputs { channel string } {
    #
    # NOTE: If an output channel was provided, use it; otherwise, ignore
    #       the message.
    #
    if {[string length $channel] > 0} then {
      #
      # NOTE: Check if output is being actively intercepted by us.
      #
      if {![isEagle] && \
          [llength [info commands ::tcl::save::puts]] > 0} then {
        ::tcl::save::puts -nonewline $channel $string
      } else {
        puts -nonewline $channel $string
      }
    }
  }

  proc doesTestOutputRepeat { channel string } {
    #
    # NOTE: Is the test output repeat detection completely disabled?
    #
    if {[info exists ::no(testOutputRepeat)]} then {return false}

    #
    # NOTE: Is the string empty (i.e. emitting a blank line) -OR- does
    #       it consist only of whitespace?  If so, always allow it and
    #       avoid modifying our internal tracking state, for the sake
    #       of simplicity.
    #
    if {[string length $string] == 0 || \
        [string length [string trim $string]] == 0} then {
      return false
    }

    #
    # BUGFIX: In Eagle, it is possible that the "test_puts_state" global
    #         variable may be accessed from multiple threads, e.g. those
    #         that call into the [tputs] procedure; therefore, we use a
    #         variable lock to prevent it from getting into an internally
    #         inconsistent state.
    #
    vwaitLocked ::test_puts_state true {
      #
      # NOTE: Create a reusable script block that handles emitting the
      #       repeated output indicator (and resets the repeat count).
      #
      set maybeRepeatStringScript {
        if {[info exists ::test_puts_state(previousString)] && \
            [info exists ::test_puts_state(repeatCount)] && \
            $::test_puts_state(repeatCount) > 0} then {
          incr ::test_puts_state(repeatCount)

          set repeatString [appendArgs \
              $::test_puts_state(previousString) \
              "\t<was output a total of " \
              $::test_puts_state(repeatCount) \
              " consecutive times>\n"]

          toneputs $channel $repeatString
          set ::test_puts_state(repeatCount) 0
        }
      }

      #
      # HACK: For now, for partial line output, reset internal tracking
      #       state and allow it verbatim.
      #
      if {[string index $string end] ne "\n"} then {
        #
        # NOTE: *SPECIAL* Emit repeat count line now and reset it back
        #       to zero.
        #
        eval $maybeRepeatStringScript

        #
        # NOTE: Since the current string is partial line output, reset
        #       our internal tracking state and allow output verbatim.
        #
        unset -nocomplain ::test_puts_state; return false
      }

      #
      # NOTE: Have we not seen any valid previous string?
      #
      if {![info exists ::test_puts_state(previousString)]} then {
        #
        # NOTE: There was no previous string, so the current string is
        #       now the previous string.  It must be emitted directly.
        #
        set ::test_puts_state(previousString) $string; return false
      }

      #
      # NOTE: Is the current string different from the previous string?
      #
      if {![string equal $string $::test_puts_state(previousString)]} then {
        #
        # NOTE: *SPECIAL* Emit repeat count line now and reset it back
        #       to zero.
        #
        eval $maybeRepeatStringScript

        #
        # NOTE: Next, since previous string does not match the current
        #       one (i.e. it has never been emitted directly), so allow
        #       it to be emitted directly.
        #
        set ::test_puts_state(previousString) $string; return false
      }

      #
      # NOTE: Current string matches the previous one, so increment or
      #       reset the repeat count and prevent the current (repeated)
      #       string from being emitted (i.e. as it was already emitted
      #       once).
      #
      if {[info exists ::test_puts_state(repeatCount)]} then {
        incr ::test_puts_state(repeatCount); # another duplicate
      } else {
        set ::test_puts_state(repeatCount) 1; # first duplicate
      }

      return true
    }
  }

  proc toneputs { channel string } {
    trawputs $channel $string; tlog $string
  }

  proc tputs { channel string } {
    if {![doesTestOutputRepeat $channel $string]} then {
      toneputs $channel $string
    }
  }

  #
  # NOTE: This is a shim designed to act like tclLog.
  #
  proc ttclLog { string } {
    tputs $::test_channel [appendArgs $string \n]
  }

  proc doesTestLogFileExist { fileName } {
    if {[catch {
      expr {[file exists $fileName] && [file size $fileName] > 0}
    } result] == 0 && $result} then {
      return true
    } else {
      return false
    }
  }

  proc getTestLogStartSentry {} {
    #
    # TODO: Why is this necessary here?  In general, the test prologue
    #       should take care of this?  Of course, that assumption would
    #       mean a slight increase in tight coupling between components.
    #
    if {![info exists ::test_run_id]} then {
      set ::test_run_id [getNewTestRunId]
    }

    return [appendArgs \
        "**** START OF TEST LOG \"" $::test_run_id "\" ****\n"]
  }

  proc readTestLogStartSentry { fileName } {
    set channel [open $fileName RDONLY]
    makeBinaryChannel $channel
    set result ""

    while {![eof $channel]} {
      if {[catch {gets $channel line}] == 0} then {
        set trimLine [appendArgs [string trim $line] \n]
        set value [extractTestRunIdFromLogStartSentry $trimLine]

        if {[string length $value] > 0 && $value ne "<none>"} then {
          set result $value; # NOTE: Save the extracted value.
          break; # NOTE: First sentry found, stop now.
        }
      } else {
        break; # NOTE: Cannot read, do not care why.
      }
    }

    close $channel
    return $result
  }

  proc extractTestRunIdFromLogStartSentry { sentry } {
    set prefix {^\*\*\*\* START OF TEST LOG "}
    set suffix {" \*\*\*\*\n$}

    set pattern(1) [appendArgs $prefix {([0-9A-F]{32,})} $suffix]; # Tcl

    if {[regexp -- $pattern(1) $sentry dummy result]} then {
      return $result
    }

    set pattern(2) [appendArgs $prefix {([0-9A-F]{64})} $suffix]; # Eagle

    if {[regexp -- $pattern(2) $sentry dummy result]} then {
      return $result
    }

    return <none>
  }

  proc doesTestLogHaveStartSentry {} {
    set fileName [getTestLog]

    if {[string length $fileName] > 0} then {
      if {[doesTestLogFileExist $fileName]} then {
        set sentry [string trim [getTestLogStartSentry]]

        if {[string length $sentry] > 0} then {
          set data [readSharedFile $fileName]

          if {[string first $sentry $data] != -1} then {
            return true
          }
        }
      }
    }

    return false
  }

  proc didTestLogHaveStartSentry { sentry varName } {
    if {[info exists ::test_log_sentry]} then {
      if {$::test_log_sentry ne $sentry} then {
        upvar 1 $varName error

        set error [appendArgs \
            "---- test log start sentry mismatch error, was \"" \
            [extractTestRunIdFromLogStartSentry $::test_log_sentry] \
            "\", now \"" [extractTestRunIdFromLogStartSentry $sentry] \
            \"\n]
      }

      return true
    } else {
      return false
    }
  }

  proc setTestLogStartSentry { sentry varName } {
    upvar 1 $varName result

    if {[info exists ::test_log_sentry]} then {
      set result [appendArgs \
          "---- test log start sentry reinitialized to \"" \
          [extractTestRunIdFromLogStartSentry $sentry] \
          "\", was \"" [extractTestRunIdFromLogStartSentry \
          $::test_log_sentry] \"\n]
    } else {
      set result [appendArgs \
          "---- test log start sentry initialized to \"" \
          [extractTestRunIdFromLogStartSentry $sentry] \
          \"\n]
    }

    set ::test_log_sentry $sentry
  }

  proc tlog { string } {
    #
    # NOTE: If a test log file was configured, use it; otherwise, ignore the
    #       message.
    #
    set fileName [getTestLog]

    if {[string length $fileName] > 0} then {
      #
      # NOTE: Check for any queued test log data that needs to be sent to the
      #       log file prior to sending the current string.
      #
      # BUGFIX: As of beta 47, use of the "test_log_queue" global variable is
      #         thread-safe.
      #
      vwaitLocked ::test_log_queue true {
        if {[info exists ::test_log_queue]} then {
          #
          # NOTE: Process each queued log entry, in order, sending them to the
          #       test log file (as long as they are not empty strings).  Each
          #       entry is removed from the queue after it is sent to the test
          #       log file.
          #
          foreach entry [lsort -integer [array names ::test_log_queue]] {
            set newString $::test_log_queue($entry)

            if {[string length $newString] > 0} then {
              if {![doesTestLogFileExist $fileName]} then {
                set sentry [getTestLogStartSentry]

                if {[string length $sentry] > 0} then {
                  #
                  # BUGFIX: At this point, there should not be any record of
                  #         a previously used test log sentry.  If there is,
                  #         do not append a test log sentry again because the
                  #         test log file may have been deleted and we need
                  #         to make sure the test log is not considered as
                  #         "complete".
                  #
                  if {[didTestLogHaveStartSentry $sentry sentryError]} then {
                    if {[info exists sentryError]} then {
                      appendSharedLogFile $fileName $sentryError
                    }
                  } else {
                    setTestLogStartSentry $sentry sentryResult

                    appendSharedLogFile $fileName $sentry

                    if {[info exists sentryResult]} then {
                      appendSharedLogFile $fileName $sentryResult
                    }
                  }
                }
              }

              appendSharedLogFile $fileName $newString
            }

            unset ::test_log_queue($entry)
          }

          #
          # NOTE: If all entries in the test log queue were just processed,
          #       unset the entire array now.
          #
          if {[array size test_log_queue] == 0} then {
            unset ::test_log_queue
          }
        }
      }

      #
      # NOTE: If an empty string is supplied by the caller, do nothing.
      #
      if {[string length $string] > 0} then {
        if {![doesTestLogFileExist $fileName]} then {
          set sentry [getTestLogStartSentry]

          if {[string length $sentry] > 0} then {
            #
            # BUGFIX: At this point, there should not be any record of a
            #         previously used test log sentry.  If there is, do
            #         not append a test log sentry again because the test
            #         log file may have been deleted and we need to make
            #         sure the test log is not considered as "complete".
            #
            if {[didTestLogHaveStartSentry $sentry sentryError]} then {
              if {[info exists sentryError]} then {
                appendSharedLogFile $fileName $sentryError
              }
            } else {
              setTestLogStartSentry $sentry sentryResult

              appendSharedLogFile $fileName $sentry

              if {[info exists sentryResult]} then {
                appendSharedLogFile $fileName $sentryResult
              }
            }
          }
        }

        appendSharedLogFile $fileName $string
      }
    }
  }

  proc getSoftwareRegistryKey { wow64 } {
    if {$wow64 && [info exists ::tcl_platform(machine)] && [lsearch -exact \
        [list ia64 amd64 arm64] $::tcl_platform(machine)] != -1} then {
      #
      # NOTE: Return the WoW64 registry key name because we are running on a
      #       64-bit operating system and the caller specifically requested
      #       the WoW64 registry key name.
      #
      return Software\\Wow6432Node
    } else {
      #
      # NOTE: Return the native registry key name because we are either not
      #       running on a 64-bit operating system or the caller wants the
      #       native registry key name (i.e. not the WoW64 registry key name).
      #
      return Software
    }
  }

  proc haveConstraint { name } {
    if {[isEagle]} then {
      return [expr {
          [info exists ::eagle_tests(Constraints)] && \
          [lsearch -exact $::eagle_tests(Constraints) $name] != -1}]
    } else {
      return [expr {
          [info exists ::tcltest::testConstraints($name)] && \
          $::tcltest::testConstraints($name)}]
    }
  }

  proc addConstraint { name {value 1} } {
    if {[isEagle]} then {
      if {[info exists ::eagle_tests(Constraints)] && \
          [lsearch -exact $::eagle_tests(Constraints) $name] == -1 && \
          $value} then {
        lappend ::eagle_tests(Constraints) $name
      }
    } else {
      ::tcltest::testConstraint $name $value
    }

    return ""
  }

  proc haveOrAddConstraint { name {value ""} } {
    if {[isEagle]} then {
      if {[llength [info level 0]] == 2} then {
        return [haveConstraint $name]
      }

      return [addConstraint $name [expr {bool($value)}]]
    } else {
      return [::tcltest::testConstraint $name $value]
    }
  }

  proc getConstraints {} {
    set result [list]

    if {[isEagle]} then {
      if {[catch {
        set ::eagle_tests(Constraints)
      } constraints] == 0} then {
        eval lappend result $constraints
      }
    } else {
      foreach name [array names ::tcltest::testConstraints] {
        if {$::tcltest::testConstraints($name)} then {
          lappend result $name
        }
      }
    }

    return $result
  }

  proc getCachedConstraints {} {
    if {[info exists ::test_constraints] && \
        [llength $::test_constraints] > 0} then {
      return $::test_constraints
    }

    return [getConstraints]
  }

  proc useCachedConstraints {} {
    foreach name [getCachedConstraints] {
      addConstraint $name
    }
  }

  proc removeConstraint { name } {
    if {[isEagle]} then {
      if {[info exists ::eagle_tests(Constraints)]} then {
        set index [lsearch -exact $::eagle_tests(Constraints) $name]

        if {$index != -1} then {
          set ::eagle_tests(Constraints) [lreplace \
              $::eagle_tests(Constraints) $index $index]
        }
      }
    } else {
      if {[info exists ::tcltest::testConstraints($name)]} then {
        unset ::tcltest::testConstraints($name)
      }
    }

    return ""
  }

  proc fixConstraints { constraints } {
    set result [string trim $constraints]

    if {[string length $result] > 0} then {
      #
      # HACK: Fixup for the semi-magical expression (via [expr]) test
      #       constraint syntax supported by the Tcltest package and not
      #       by the Eagle.Test package.  This needs to happen for Tcl
      #       in test constraints that contain any characters that are
      #       not alphanumeric, not a period, and not a colon (e.g. in
      #       this case, the exclamation point); however, it should only
      #       be required when the number of test constraints is greater
      #       than one.
      #
      if {![isEagle]} then {
        if {[string first ! $result] != -1} then {
          #
          # HACK: All of our test constraints assume they are
          #       "logically and-ed" together.
          #
          set result [join [split $result] " && "]
        }
      }
    }

    return $result
  }

  proc getKnownPublicKeyTokens {} {; # TODO: Move to "constraints.eagle"?
    if {[info exists ::test_well_known(publicKeyTokens)]} then {
      return $::test_well_known(publicKeyTokens)
    }

    #
    # HACK: This list of "well-known" public key tokens is hard-coded.
    #
    return [list \
        29c6297630be05eb 1e22ec67879739a2 358030063a832bc3 \
        8bf43b4749e46a0b]
  }

  proc isCorePublicKeyToken { publicKeyToken } {
    set publicKeyTokens [getKnownPublicKeyTokens]

    if {[isEagle]} then {
      set expr {$publicKeyToken in $publicKeyTokens}

      if {[expr $expr]} then {
        return true
      }
    } else {
      if {[lsearch -exact $publicKeyTokens $publicKeyToken] != -1} then {
        return true
      }
    }

    return false
  }

  proc fixTimingConstraints { constraints } {
    #
    # HACK: In Eagle, when the right test constraint is present, *any* tests
    #       where PASSED / FAILED results can vary non-deterministically due
    #       to timing issues (e.g. performance) are forbidden from causing
    #       the overall test run to fail.
    #
    if {[isEagle]} then {
      if {[info exists ::no(failTimingTests)] || \
          [haveConstraint officialStableReleaseInProgress]} then {
        return [fixConstraints [concat $constraints [list fail.false]]]
      } else {
        return [fixConstraints $constraints]
      }
    } else {
      return [fixConstraints $constraints]
    }
  }

  proc testDebugBreak {} {
    if {[isEagle]} then {
      #
      # NOTE: In Eagle, simply break into the interactive loop using the
      #       integrated script debugger.
      #
      debug break
    } else {
      #
      # NOTE: In native Tcl, attempt to use the TclPro Debugger interface.
      #       This requires that the TclPro Debugger interface package be
      #       present somewhere along the auto-path.
      #
      package require tcldebugger_attach; debugger_init; debugger_break
    }
  }

  proc testArrayGet { varName {integer false} } {
    #
    # NOTE: Returns the results of [array get] in a well-defined order.
    #
    if {[string length $varName] == 0} then {
      return [list]
    }

    #
    # NOTE: Refer to the array in the context of the caller.
    #
    upvar 1 $varName array

    #
    # NOTE: Build the command that will sort the array names into order.
    #
    set command [list lsort]
    if {$integer} then {lappend command -integer}
    lappend command [array names array]

    set result [list]

    foreach name [eval $command] {
      lappend result $name $array($name)
    }

    return $result
  }

  proc testArrayGet2 { varName {pattern ""} {integer false} } {
    #
    # NOTE: Returns the results of [array get] in a well-defined order.
    #
    if {[string length $varName] == 0} then {
      return [list]
    }

    #
    # NOTE: Refer to the array in the context of the caller.
    #
    upvar 1 $varName array

    #
    # NOTE: Build the command that will sort the array names into order.
    #
    set command [list lsort]
    if {$integer} then {lappend command -integer}

    #
    # NOTE: If there is a pattern, use it; otherwise, all elements are
    #       returned.
    #
    if {[string length $pattern] > 0} then {
      lappend command [array names array $pattern]
    } else {
      lappend command [array names array]
    }

    set result [list]

    foreach name [eval $command] {
      lappend result $name $array($name)
    }

    return $result
  }

  proc testResultGet { script } {
    set code [catch {uplevel 1 $script} result]
    return [expr {$code == 0 ? $result : "<error>"}]
  }

  proc testValueGet { varName {integer false} } {
    #
    # NOTE: Returns the results of [array get] in a well-defined order
    #       -OR- the value of the scalar variable.
    #
    if {[string length $varName] == 0} then {
      return [list]
    }

    #
    # NOTE: Is the specified variable (in the context of the caller) an
    #       array?
    #
    if {[uplevel 1 [list array exists $varName]]} then {
      #
      # NOTE: Refer to the array in the context of the caller.
      #
      upvar 1 $varName array

      #
      # NOTE: Build the command that will sort the array names into order.
      #
      set command [list lsort]
      if {$integer} then {lappend command -integer}
      lappend command [array names array]

      set result [list]

      foreach name [eval $command] {
        lappend result $name $array($name)
      }
    } else {
      #
      # NOTE: Grab the value of the scalar variable in the context of the
      #       caller and then return both the name and the value.
      #
      set varValue [uplevel 1 [list set $varName]]
      set result [list $varValue]
    }

    return $result
  }

  proc getValueOrDefault { varName {default <none>} } {
    if {[uplevel 1 [list array exists $varName]]} then {
      set value [uplevel 1 [list array get $varName]]

      if {[llength $value] > 0} then {
        return $value
      }
    } elseif {[uplevel 1 [list info exists $varName]]} then {
      set value [uplevel 1 [list set $varName]]

      if {[string length $value] > 0} then {
        return $value
      }
    }

    return $default
  }

  proc getFirstLineOfError { error } {
    set error [string map [list \r\n \n] $error]
    set index [string first \n $error]

    if {$index != -1} then {
      incr index -1

      if {$index > 0} then {
        return [string range $error 0 $index]
      }
    }

    return $error
  }

  proc calculateBogoCops { {milliseconds 2000} {legacy false} } {
    #
    # NOTE: Verify that the number of milliseconds requested is greater
    #       than zero.
    #
    if {$milliseconds <= 0} then {
      unset -nocomplain ::test_suite_running
      error "number of milliseconds must be greater than zero"
    }

    #
    # HACK: Different techniques are used to calculate the performance of
    #       the machine for Tcl and Eagle.
    #
    if {!$legacy && [isEagle]} then {
      #
      # BUGBUG: Tcl 8.4 does not like this expression (and Tcl tries to
      #         compile it even though it will only actually ever be
      #         evaluated in Eagle).
      #
      set expr {[catch {
        string first -timeout [time nop 0 ---]
      } timeout] in [list 0 2] && $timeout != -1}

      #
      # HACK: Attempt to determine if the "-timeout" option for [time] is
      #       available.  If so, use it.
      #
      if {[expr $expr]} then {
        set code [catch {
          #
          # NOTE: This is the most robust method, i.e. use the "-timeout"
          #       option to the [time] command.
          #
          set before [info cmdcount]
          catch {time {nop} -1 -timeout $milliseconds}; # internal loop.
          set after [info cmdcount]

          #
          # HACK: Mono has a bug that results in excessive trailing zeros
          #       here (Mono bug #655780).
          #
          if {[isMono]} then {
            expr {double(($after - $before) / ($milliseconds / 1000.0))}
          } else {
            expr {($after - $before) / ($milliseconds / 1000.0)}
          }
        } result]

        #
        # NOTE: If we failed above, return an obviously invalid result
        #       instead.
        #
        if {$code == 0} then {
          return $result
        } else {
          return 0
        }
      } else {
        #
        # HACK: This calculation method (i.e. using [after] to cancel the
        #       [time] command after the specified number of milliseconds)
        #       is no longer necessary as of Beta 45; however, it will be
        #       retained for backward compatibility with previous releases
        #       solely for the purpose of running comparative benchmarks.
        #
        # NOTE: Save the current readiness limit for later restoration
        #       and then set the current readiness limit to always check
        #       the interpreter readiness (default).  If this was not
        #       done, the [interp cancel] command in this procedure may
        #       have no effect, which could cause this procedure to run
        #       forever.
        #
        set readylimit [interp readylimit {}]
        interp readylimit {} 0

        try {
          #
          # NOTE: Save the current background error handler for later
          #       restoration and then reset the current background
          #       error handler to nothing.
          #
          set bgerror [interp bgerror {}]
          interp bgerror {} ""

          try {
            #
            # NOTE: Save the current [after] flags for later restoration
            #       and then reset them to process events immediately.
            #
            set flags [after flags]
            after flags =Immediate

            try {
              set code [catch {
                #
                # NOTE: First, make sure that the [after] event queue
                #       for the interpreter is totally empty.
                #
                cleanupAfterEvents true

                #
                # NOTE: Schedule the event to cancel the script we are
                #       about to evaluate, capturing the name so we can
                #       cancel it later, if necessary.
                #
                set event [after $milliseconds [list interp cancel]]

                #
                # HACK: There is a potential "race condition" here.  If the
                #       specified number of milliseconds elapses before (or
                #       after) entering the [catch] script block (below)
                #       then the resulting script cancellation error will
                #       not be caught and we will be unable to return the
                #       correct result to the caller.
                #
                set before [info cmdcount]
                catch {time {nop} -1}; # uses the [time] internal busy loop.
                set after [info cmdcount]

                #
                # HACK: Mono has a bug that results in excessive trailing
                #       zeros here (Mono bug #655780).
                #
                if {[isMono]} then {
                  expr {double(($after - $before) / ($milliseconds / 1000.0))}
                } else {
                  expr {($after - $before) / ($milliseconds / 1000.0)}
                }
              } result]

              #
              # NOTE: If we failed due to the race condition explained
              #       above, return an obviously invalid result instead.
              #
              if {$code == 0} then {
                return $result
              } else {
                return 0
              }
            } finally {
              if {[info exists event]} then {
                catch {after cancel $event}
              }

              after flags [appendArgs = $flags]
            }
          } finally {
            interp bgerror {} $bgerror
          }
        } finally {
          interp readylimit {} $readylimit
        }
      }
    } else {
      #
      # NOTE: Record the initial Tcl command count.
      #
      set before [info cmdcount]

      #
      # NOTE: Calculate how many whole seconds we need to spin for.
      #
      set seconds [expr {$milliseconds / 1000}]

      #
      # NOTE: Calculate the starting and ending values of [clock seconds].
      #
      set now [clock seconds]
      set start $now; set stop [expr {$now + $seconds}]

      #
      # NOTE: Do nothing for X seconds (i.e. except call [clock seconds]).
      #
      while {$start <= $now && $now < $stop} {set now [clock seconds]}

      #
      # NOTE: Record the final Tcl command count.
      #
      set after [info cmdcount]

      #
      # NOTE: Calculate approximately how many Tcl commands per second were
      #       executed during the timed loop (above).  Due to various things,
      #       including overhead associated with [clock seconds], this number
      #       is not as accurate as the one for Eagle; however, it's generally
      #       good enough.
      #
      expr {($after - $before) / ($milliseconds / 1000.0)}
    }
  }

  proc calculateRelativePerformance { type value } {
    #
    # NOTE: Adjust the expected performance number based on the
    #       relative performance of this machine, if available.
    #
    if {[info exists ::test_base_cops] && [info exists ::test_cops]} then {
      #
      # NOTE: Calibrate the expected performance numbers based
      #       on the ratio of the baseline performace to the
      #       current performance.
      #
      switch -exact -- $type {
        elapsed {
          if {$::test_cops != 0} then {
            return [expr {double($value) * \
                ($::test_base_cops / $::test_cops)}]
          }
        }
        iterations {
          if {$::test_base_cops != 0} then {
            return [expr {double($value) * \
                ($::test_cops / $::test_base_cops)}]
          }
        }
      }
    }

    return $value
  }

  proc formatTimeStamp { seconds {gmt false} } {
    if {[isEagle]} then {
      return [clock format $seconds -gmt $gmt -iso -isotimezone]
    } else {
      return [clock format $seconds -gmt $gmt -format "%Y-%m-%dT%H:%M:%S %Z"]
    }
  }

  proc formatElapsedTime { seconds } {
    if {[isEagle] && [llength [info commands object]] > 0} then {
      #
      # NOTE: Create a TimeSpan instance based on the number of whole
      #       seconds.
      #
      set timeSpan [object invoke -create -alias TimeSpan FromSeconds \
          $seconds]

      #
      # NOTE: Return the number of seconds and a human readable string
      #       representing the TimeSpan instance created based on that
      #       same number of seconds.
      #
      return [appendArgs $seconds " seconds (" \
          [getStringFromObjectHandle $timeSpan] " elapsed time)"]
    } else {
      #
      # NOTE: Unfortunately, there is no built-in native Tcl command
      #       that can correctly format an elapsed time; therefore,
      #       just return the number of whole seconds.
      #
      return [appendArgs $seconds " seconds"]
    }
  }

  proc sourceIfValid { type fileName } {
    if {[string length $fileName] > 0} then {
      if {[file exists $fileName]} then {
        tputs $::test_channel [appendArgs \
            "---- evaluating " $type " file: \"" $fileName \"\n]

        if {[catch {uplevel 1 [list source $fileName]} error]} then {
          tputs $::test_channel [appendArgs \
              "---- error during " $type " file: " $error \n]

          #
          # NOTE: The error has been logged, now re-throw it.
          #
          unset -nocomplain ::test_suite_running
          error $error $::errorInfo $::errorCode
        }
      } else {
        tputs $::test_channel [appendArgs \
            "---- skipped " $type " file: \"" $fileName \
            "\", it does not exist\n"]
      }
    }
  }

  proc processTestArguments { varName strict args } {
    #
    # NOTE: Initially, there are no unknown (i.e. unprocessed) arguments.
    #
    set result [list]

    #
    # NOTE: We are going to place the configured options in the variable
    #       identified by the name provided by the caller.
    #
    if {[string length $varName] > 0} then {
      upvar 1 $varName array
    }

    #
    # TODO: Add more support for standard "tcltest" options here.
    #
    set options [list \
        -breakOnLeak -configuration -constraints -exitOnComplete \
        -file -listedLeaks -logFile -logId -logPath -machine -match \
        -namePrefix -no -notFile -platform -postTest -preTest -postWait \
        -preWait -randomOrder -skip -startFile -stopFile -stopOnFailure \
        -stopOnLeak -suffix -suite -tclsh -threshold -uncountedLeaks \
        -verbose]

    set length [llength $args]

    for {set index 0} {$index < $length} {incr index} {
      #
      # NOTE: Grab the current list element, which should be the name of
      #       the test option.
      #
      set name [lindex $args $index]

      #
      # NOTE: Use the [tqputs] command here just in case the test log file
      #       has not been setup yet (i.e. by default, this procedure is
      #       almost always called by the test prologue file prior to the
      #       test log file having been setup and we do not want to just
      #       lose this output).
      #
      if {[lsearch -exact $options $name] != -1} then {
        #
        # NOTE: Is there another list element available for the value?  If
        #       not, this is not a valid test option.
        #
        if {$index + 1 < $length} then {
          incr index; set value [lindex $args $index]

          set array($name) $value

          tqputs $::test_channel [appendArgs \
              "---- overrode test option \"" $name "\" with value \"" \
              $value \"\n]
        } else {
          tqputs $::test_channel [appendArgs \
              "---- no value for test option \"" $name "\", ignored\n"]
        }
      } elseif {[string index $name 0] eq "-"} then {
        #
        # NOTE: Is there another list element available for the value?  If
        #       not, it does not conform to the standard command line name
        #       and value pattern.
        #
        if {$index + 1 < $length} then {
          incr index; set value [lindex $args $index]

          if {!$strict && [lsearch -exact $options $value] != -1} then {
            incr index -1; # HACK: Resynchronize with valid test option.
            lappend result [list $name]

            tqputs $::test_channel [appendArgs \
                "---- no value for unknown test option \"" $name \
                "\", ignored, backing up one for test option \"" \
                $value \"...\n]
          } else {
            lappend result [list $name $value]

            tqputs $::test_channel [appendArgs \
                "---- unknown test option \"" $name "\" with value \"" \
                $value "\", ignored\n"]
          }
        } else {
          lappend result [list $name]

          tqputs $::test_channel [appendArgs \
              "---- no value for unknown test option \"" $name \
              "\", ignored\n"]
        }
      } else {
        #
        # NOTE: Is there another list element available for the value?  If
        #       not, it does not conform to the standard command line name
        #       and value pattern.
        #
        if {$index + 1 < $length} then {
          incr index; set value [lindex $args $index]

          if {!$strict && [lsearch -exact $options $value] != -1} then {
            incr index -1; # HACK: Resynchronize with valid test argument.
            lappend result [list $name]

            tqputs $::test_channel [appendArgs \
                "---- no value for unknown argument \"" $name \
                "\", ignored, backing up one for test option \"" \
                $value \"...\n]
          } else {
            lappend result [list $name $value]

            tqputs $::test_channel [appendArgs \
                "---- unknown argument \"" $name "\" with value \"" \
                $value "\", ignored\n"]
          }
        } else {
          #
          # NOTE: This is not an option of *any* kind that we know about.
          #       Ignore it and issue a warning.
          #
          lappend result [list $name]

          tqputs $::test_channel [appendArgs \
              "---- unknown argument \"" $name "\", ignored\n"]
        }
      }
    }

    #
    # NOTE: Now, attempt to flush the test log queue, if available.
    #
    tlog ""

    #
    # NOTE: Return the nested list of unknown arguments, formatted as
    #       name/value pairs, to the caller.
    #
    return $result
  }

  proc getTclShellFileName { automatic kits machine } {
    #
    # NOTE: Start out with an empty list of candiate Tcl shells.
    #
    set shells [list]

    #
    # NOTE: Figure out the environment variables to be checked.  If
    #       there was a machine specified, it will be used to check
    #       for machine-specific Tcl shells.
    #
    set names [list]

    foreach name [list Eagle_Tcl_Shell Tcl_Shell EAGLE_TCLSH TCLSH] {
      if {[string length $machine] > 0} then {
        set platform [machineToPlatform $machine true]

        if {[string length $platform] > 0} then {
          lappend names [appendArgs $name _ $platform]
        }

        set platform [machineToPlatform $machine false]

        if {[string length $platform] > 0} then {
          lappend names [appendArgs $name _ $platform]
        }

        lappend names [appendArgs $name _ $machine]
      }

      lappend names $name
    }

    #
    # NOTE: Check all environment variables (we know about) that
    #       may contain the path where the Tcl shell is located.
    #
    foreach name $names {
      #
      # NOTE: Grab the value of the environment variable.  This
      #       will be an empty string if it was not set.
      #
      set value [getEnvironmentVariable $name]

      #
      # TODO: Possibly add a check if the file actually exists
      #       here.
      #
      if {[string length $value] > 0} then {
        #
        # NOTE: *EXTERNAL* Use verbatim, no normalization.
        #
        if {$automatic && [isEagle]} then {
          #
          # NOTE: In automatic mode, the environment variable
          #       value simply represents another candidate
          #       Tcl shell (i.e. it does not halt the search
          #       for other candidate Tcl shells).
          #
          lappend shells $value
        } else {
          #
          # NOTE: In manual mode, the environment variable
          #       value represents an "override" and halts
          #       the search for other candidate Tcl shells.
          #
          return $value
        }
      }
    }

    #
    # NOTE: The automatic Tcl shell detection is only available when
    #       running in Eagle.
    #
    if {[isEagle]} then {
      #
      # NOTE: Attempt to check for the "best" available dynamically
      #       loadable Tcl library and then attempt to use its
      #       "associated" Tcl shell.  A very similar block of code
      #       is also used by the [checkForTclInstalls] procedure
      #       in the constraints package.
      #
      if {[catch {tcl select -architecture} tcl] == 0} then {
        #
        # NOTE: Should we also consider TclKit shells?  If so, a bit
        #       more handling is required.
        #
        if {$kits} then {
          #
          # NOTE: Did we find one?  Attempt to grab the patch
          #       level field from the returned dictionary value.
          #
          set dotPatchLevel [getDictionaryValue $tcl patchLevel]

          #
          # NOTE: Verify that the patch level we found is valid
          #       and that it conforms to the pattern we expect.
          #
          if {[string length $dotPatchLevel] > 0 && \
            [regexp -- {^\d+\.\d+\.\d+$} $dotPatchLevel]} then {
            #
            # NOTE: Build the candidate TclKit shell executable file
            #       name with the dot-separated patch level.  This is
            #       the common naming scheme on Unix.
            #
            set dotShell [appendArgs tclkit- $dotPatchLevel]

            #
            # NOTE: Build the candidate TclKit shell executable file
            #       name with the patch level, removing the dot.  This
            #       is the common naming scheme on Windows.
            #
            set shell [appendArgs \
                tclkit- [string map [list . ""] $dotPatchLevel]]

            #
            # NOTE: Always favor the TclKit shell executable file
            #       naming scheme for the current operating system
            #       first.
            #
            if {[isWindows]} then {
              lappend shells $shell
              lappend shells $dotShell
            } else {
              lappend shells $dotShell
              lappend shells $shell
            }
          }
        }

        #
        # NOTE: Did we find one?  Attempt to grab the version
        #       field from the returned dictionary value.
        #
        set dotVersion [getDictionaryValue $tcl version]

        #
        # NOTE: Verify that the version we found is valid and that
        #       it conforms to the pattern we expect.
        #
        if {[string length $dotVersion] > 0 && \
            [regexp -- {^\d+\.\d+$} $dotVersion]} then {
          #
          # NOTE: Gather the list of candidate Tcl shells to check
          #       using the range of versions we are interested in,
          #       starting with the "best" available version and
          #       ending with the absolute minimum version supported
          #       by the Eagle core library.  A very similar block
          #       of code is also used by the [checkForTclShell]
          #       procedure in the constraints package.
          #
          foreach version [lsort -real -decreasing [tcl \
              versionrange -maximumversion $dotVersion]] {
            #
            # NOTE: Build the candidate Tcl shell executable file name
            #       with the dot-separated version.  This is the common
            #       naming scheme on Unix.
            #
            set dotShell [appendArgs tclsh $version]

            #
            # NOTE: Build the candidate Tcl shell executable file name
            #       with the version, removing the dot.  This is the
            #       common naming scheme on Windows.
            #
            set shell [appendArgs tclsh [string map [list . ""] $version]]

            #
            # NOTE: Always favor the Tcl shell executable file naming
            #       scheme for the current operating system first.
            #
            if {[isWindows]} then {
              lappend shells $shell
              lappend shells $dotShell
            } else {
              lappend shells $dotShell
              lappend shells $shell
            }
          }
        }
      }

      #
      # NOTE: Are we allowed to check each candidate Tcl shell to see
      #       if it actually works?
      #
      if {![info exists ::no(getTclExecutableForTclShell)]} then {
        #
        # NOTE: First, perform one pass over the candidate Tcl shells,
        #       checking seeing if one of their machines matches that
        #       of the current process.  Finally, perform another pass
        #       over the candidate Tcl shells without checking their
        #       machines.  The first pass (without machine checks) is
        #       always skipped if we are forbidden from doing it, via
        #       use of procedure [getMachineForTclShell] being disabled.
        #
        if {[info exists ::no(getMachineForTclShell)]} then {
          set getMachines [list false]
        } else {
          set getMachines [list true false]
        }

        foreach getMachine $getMachines {
          #
          # NOTE: Check each candidate Tcl shell and query its fully
          #       qualified path from it.  If it cannot be executed,
          #       we know that candidate Tcl shell is not available.
          #
          foreach shell $shells {
            #
            # NOTE: Attempt to query the full executable file name of
            #       the candidate Tcl shell.  If this fails, consider
            #       candidate Tcl shell to be unusable.
            #
            if {[catch {
              getTclExecutableForTclShell $shell [getTclShellVerbosity]
            } executable] == 0 && $executable ne "error" && \
                ![string match "error: *" $executable]} then {
              #
              # NOTE: Check if this candidate Tcl shell is actually
              #       a match for the machine of the current process?
              #
              if {$getMachine} then {
                #
                # NOTE: Attempt to query the machine of the candidate
                #       Tcl shell.  If this fails, consider candidate
                #       Tcl shell to be unusable.
                #
                if {[catch {
                  getMachineForTclShell $shell [getTclShellVerbosity]
                } machine] || $machine eq "error" || \
                    [string match "error: *" $machine]} then {
                  #
                  # NOTE: No?  Skip this candidate Tcl shell, keep
                  #       going, etc.
                  #
                  continue
                }
              }

              #
              # NOTE: It looks like this Tcl shell is available.
              #       Return the fully qualified path to it now.
              #
              return $executable
            }
          }
        }
      }
    }

    #
    # NOTE: Return the fallback default.
    #
    return tclsh
  }

  proc getTemporaryPath { {usable true} {cloud false} } {
    #
    # NOTE: Initially, start with the list of legacy base environment
    #       variable names.
    #
    set baseNames [list \
        EAGLE_TEST_TEMP EAGLE_TEMP XDG_RUNTIME_DIR TEMP TMP]

    #
    # NOTE: If the caller enabled cloud support, insert appropriate
    #       base environment variable names near the front of the list
    #       (e.g. for test suite logs hosted on cloud drive providers).
    #       This may seem like a dumb idea; however, the log files are
    #       basically never bigger than "1Mb" and it may be useful for
    #       more than one user to be able to see them.  This decision
    #       is subject to change in the future.
    #
    if {$cloud} then {
      set baseNames [linsert $baseNames 2 XDG_CLOUD_DIR]
    }

    #
    # NOTE: Build list of "temporary directory" override environment
    #       variables to check.
    #
    set names [list]

    foreach name $baseNames {
      #
      # NOTE: Make sure we handle all the reasonable "cases" of the
      #       environment variable names.
      #
      lappend names [string toupper $name] [string tolower $name] \
          [string totitle $name]
    }

    #
    # NOTE: Check if we can use any of the environment variables.
    #
    foreach name $names {
      set value [getEnvironmentVariable $name]

      #
      # NOTE: First, make sure the environment variable was actually
      #       set to something.
      #
      if {[string length $value] > 0} then {
        #
        # NOTE: Next, when the "usable" argument is non-zero, attempt
        #       to make sure the returned temporary path is actually
        #       an existing directory, writable by us.
        #
        if {$usable} then {
          if {[file isdirectory $value] && [file writable $value]} then {
            return [file normalize $value]
          }
        } else {
          return [file normalize $value]
        }
      }
    }

    if {[isEagle] && [llength [info commands object]] > 0} then {
      #
      # NOTE: Does the caller want to prefer a cloud drive provider
      #       directory?
      #
      if {$cloud} then {
        #
        # NOTE: Eagle cloud directory fallback, use whatever is found
        #       (first) on the file system.
        #
        return [file normalize [object invoke -flags +NonPublic \
            Eagle._Components.Private.PathOps GetUserCloudDirectory]]
      } else {
        #
        # NOTE: Eagle fallback, use whatever is provided by underlying
        #       framework and/or operating system.
        #
        return [file normalize [object invoke System.IO.Path GetTempPath]]
      }
    } else {
      #
      # NOTE: Tcl fallback, just assume that we can use the directory
      #       where the executable is running for temporary storage.
      #       This will most likely not work for native Tcl, especially
      #       when it is running on a non-Windows platform, as Tcl will
      #       generally be installed into a location that would require
      #       elevated privileges in order to create and/or write files.
      #
      return [file normalize [file dirname [getShellExecutableName]]]
    }
  }

  proc getTemporaryFileName { {seconds 5} } {
    if {[isEagle]} then {
      return [file tempname]
    } else {
      set path [getTemporaryPath]

      set now [clock seconds]
      set start $now; set stop [expr {$now + $seconds}]

      while {$start <= $now && $now < $stop} {
        binary scan [binary format d* [expr {rand()}]] h* random
        set random [string toupper $random]

        set fileNameOnly [appendArgs \
            tmp [string index $random 0] [string index $random 1] \
            [string index $random end-1] [string index $random end] \
            .tmp]

        set fileName [file join $path $fileNameOnly]

        if {![file exists $fileName]} then {
          return $fileName
        }

        set now [clock seconds]
      }

      error "cannot generate temporary file name"
    }
  }

  proc getFiles { directory include {exclude ""} } {
    set result [list]

    if {[isEagle]} then {
      if {[file exists $directory] && \
          [file isdirectory $directory]} then {
        foreach fileName [lsort -dictionary [file list $directory \
            $include]] {
          if {[string length $exclude] == 0 || \
              ![string match $exclude $fileName]} then {
            if {[file isfile $fileName] && \
                [file readable $fileName]} then {
              lappend result $fileName
            }
          }
        }
      }
    } else {
      foreach fileName [lsort -dictionary [glob -directory $directory \
          -types {f r} -nocomplain -- $include]] {
        if {[string length $exclude] == 0 || \
            ![string match $exclude $fileName]} then {
          lappend result $fileName
        }
      }
    }

    return $result
  }

  proc getTestFiles {
          directories matchFilePatterns skipFilePatterns {quiet false} } {
    set result [list]

    #
    # HACK: If any "directory" appears to look like a variable name,
    #       use that variable name, in the context of the caller, in
    #       order to obtain a list of directories where test files
    #       may be located.
    #
    set newDirectories [list]

    foreach directory $directories {
      if {[regexp -nocase -- {^[A-Z][0-9A-Z_]*$} $directory]} then {
        set varName $directory

        if {[uplevel 1 info exists $varName]} then {
          set varValue [uplevel 1 set $varName]

          if {[isEagle]} then {
            if {![string is list -strict $varValue]} then {
              continue
            }
          } else {
            if {[catch {llength $varValue}]} then {
              continue
            }
          }

          eval lappend newDirectories $varValue

          if {!$quiet} then {
            set varLength [llength $varValue]

            tputs $::test_channel [appendArgs \
                "---- added " $varLength " test file " \
                [expr {$varLength == 1 ? \
                    "directory" : "directories"}] \
                " from variable: " $varName \n]
          }

          continue
        }
      }

      lappend newDirectories $directory
    }

    set count 0

    foreach directory $newDirectories {
      set matchFileNames [list]

      foreach pattern $matchFilePatterns {
        eval lappend matchFileNames [getFiles $directory $pattern]
      }

      set skipFileNames [list]

      foreach pattern $skipFilePatterns {
        eval lappend skipFileNames [getFiles $directory $pattern]
      }

      foreach fileName $matchFileNames {
        if {[lsearch -exact $skipFileNames $fileName] == -1} then {
          lappend result $fileName; incr count
        }
      }
    }

    if {!$quiet} then {
      set length [llength $newDirectories]

      tputs $::test_channel [appendArgs \
          "---- added " $count " test files from " \
          [expr {$length == 1 ? "directory" : "directories"}] \
          ": " $newDirectories \n]
    }

    return $result
  }

  proc getTestRunId {} {
    return [expr {[info exists ::test_run_id] ? $::test_run_id : ""}]
  }

  proc getTestRunBucket {} {
    return [expr {[info exists ::test_run_bucket] ? $::test_run_bucket : ""}]
  }

  proc isValidGuid { value } {
    if {[isEagle]} then {
      return [string is guid -strict $value]
    } else {
      set pattern [appendArgs \
          ^ {[0-9A-F]{8}} - {[0-9A-F]{4}} - {[0-9A-F]{4}} \
          - {[0-9A-F]{4}} - {[0-9A-F]{12}} \$]

      return [regexp -nocase -- $pattern $value]
    }
  }

  proc getNewTestRunId {} {
    #
    # HACK: Unless forbidden from doing so, include a new GUID generated
    #       either via the [guid new] sub-command -OR- using the [exec]
    #       command to execute an external "uuidgen" tool, which may be
    #       present.
    #
    set guid ""

    if {![info exists ::no(newGuidForTestRun)]} then {
      if {![info exists ::no(guidNew)] && [isEagle]} then {
        set guid [guid new]
      } elseif {![info exists ::no(uuidgenTool)] && [catch {
        exec uuidgen; # maybe in PATH?
      } exec] == 0 && [isValidGuid $exec]} then {
        set guid $exec
      }
    }

    #
    # HACK: Yes, this is a bit ugly; however, it creates a nice unique
    #       identifier to represent the test run, which makes analyzing
    #       the test log files a lot easier.
    #
    if {[isEagle]} then {
      #
      # BUGBUG: Tcl 8.4 does not like this expression (and Tcl tries to
      #         compile it even though it will only actually ever be
      #         evaluated in Eagle).
      #
      set expr {random()}

      #
      # NOTE: Include the host name to make the result more unique in both
      #       time and space.  Also, hash the entire constructed string.
      #
      if {![isMono]} then {
        #
        # NOTE: When running on the .NET Framework, we can simply use the
        #       [string format] command.
        #
        return [hash normal sha256 [string format \
            "{0}{1:X8}{2:X8}{3:X16}{4:X16}{5:X16}{6}" [info host] [pid] \
            [info tid] [clock now] [clock clicks] [expr $expr] $guid]]
      } else {
        #
        # HACK: Mono does not currently support calling the String.Format
        #       overload that takes a variable number of arguments via
        #       reflection (Mono bug #636939).  Also, strip any leading
        #       minus signs for cleanliness.
        #
        return [hash normal sha256 [appendArgs [info host] [string \
            trimleft [pid] -] [string trimleft [info tid] -] [string \
            trimleft [clock now] -] [string trimleft [clock clicks] -] \
            [string trimleft [expr $expr] -] $guid]]
      }
    } else {
      #
      # NOTE: Generate a random number using [expr] and then convert it
      #       to a 64-bit integer.
      #
      binary scan [binary format d* [expr {rand()}]] w* random

      #
      # NOTE: Convert the host name to a hexadecimal string and include
      #       it in the result in an attempt to make it more unique in
      #       both time and space.
      #
      binary scan [info host] c* host
      set host [eval [list format [string repeat %X [llength $host]]] $host]

      #
      # NOTE: Build the final result with the [format] command, converting
      #       all the pieces to hexadecimal (except for the host, which is
      #       already hexadecimal).
      #
      set pid [pid]; set seconds [clock seconds]; set clicks [clock clicks]

      return [appendArgs \
          $host [format [appendArgs % [getLengthModifier $pid] X% \
          [getLengthModifier $seconds] X% [getLengthModifier $clicks] X% \
          [getLengthModifier $random] X] $pid $seconds $clicks $random] \
          $guid]
    }
  }

  proc getDefaultTestLogSubPath {} {
    set result [file join logs [getTestRunBucket]]

    if {![info exists ::no(testLogsPerDay)]} then {
      set result [file join $result \
          [clock format [clock seconds] -format %Y-%m-%d]]
    }

    return $result
  }

  proc getDefaultTestLogPath { executable } {
    #
    # NOTE: By default, use the configured temporary directory for
    #       test log files unless we are forbidden from doing so.
    #
    if {![info exists ::no(temporaryTestLog)]} then {
      #
      # HACK: The test log file MUST reside in a usable directory
      #       -AND- it MAY need to be hosted within a cloud drive
      #       provider directory.
      #
      set path [getTemporaryPath true [info exists ::no(localTestLog)]]
    } else {
      #
      # HACK: It seems that .NET Core considers itself to be the
      #       executable-of-record for the process; in that case,
      #       relocate the log file to be nearer the assemblies.
      #
      if {[isEagle] && [isDotNetCore]} then {
        set path [info binary]
      } else {
        set path [file dirname $executable]
      }
    }

    #
    # NOTE: Attempt to create a "logs" sub-directory within the
    #       the (base) directory we determined above.  If this
    #       fails (for any reason), just fallback to the (base)
    #       directory we already have.
    #
    if {![info exists ::no(testLogsSubDirectory)]} then {
      set subPath ""

      if {[catch {
        #
        # HACK: By default, place log files within sub-directory
        #       based on the current date, unless forbidden from
        #       doing so.  In that case, just create and/or use
        #       the "logs" sub-directory.  If a test run bucket
        #       is present, use that too.
        #
        set subPath [file join $path [getDefaultTestLogSubPath]]

        #
        # HACK: Make sure the directory exists now.  If it does
        #       not -AND- it cannot be created, we will fallback
        #       to the (base) directory we determined above and
        #       which we know already exists.
        #
        file mkdir $subPath
      } error] == 0} then {
        return $subPath
      } else {
        #
        # HACK: Queue an error message indicating that something
        #       went horribly wrong (?) here.
        #
        tqputs $::test_channel [appendArgs \
            "==== WARNING: creation of test logs directory \"" \
            $subPath "\" failed: " $error \n]
      }
    }

    return $path
  }

  proc getTestLogPath {} {
    return [expr {[info exists ::test_log_path] ? $test_log_path : ""}]
  }

  proc getTestLogId {} {
    return [expr {[info exists ::test_log_id] ? \
        [append result . $::test_log_id] : ""}]
  }

  proc getDefaultTestLog {} {
    set executable [getShellExecutableName]

    if {[info exists ::test_log_path]} then {
      set path $::test_log_path
    } else {
      set path [getDefaultTestLogPath $executable]
    }

    return [file normalize [file join $path [appendArgs \
        [file tail $executable] [getTestLogId] .test. [pid] .log]]]
  }

  proc getTestLog {} {
    return [expr {[info exists ::test_log] ? $::test_log : ""}]
  }

  proc getLastTestLog {} {
    #
    # NOTE: Use the configured log file name -OR- what the configured
    #       log file name would be, by default, if it actually existed.
    #
    if {[info exists ::test_log]} then {
      set logFileName $::test_log
    } else {
      set logFileName [getDefaultTestLog]
    }

    set logFileName [file normalize $logFileName]
    set logTime [expr {[file exists $logFileName] ? \
        [file mtime $logFileName] : 0}]

    #
    # NOTE: Make the log file name into a pattern we can use to find
    #       the related log files.
    #
    if {[regsub -- {\.\d+\.} $logFileName {.*.} pattern]} then {
      set lastLogFile [list]

      foreach fileName [findFiles $pattern] {
        #
        # NOTE: Skip the current test log file, if found.
        #
        if {[isSameFileName $fileName $logFileName]} then {
          continue
        }

        #
        # NOTE: When was this log file last modified?
        #
        set time [file mtime $fileName]

        #
        # NOTE: Check if there has been no log file seen -OR- this
        #       log file has the latest modified time seen.
        #
        if {[llength $lastLogFile] == 0 || \
            $time > [lindex $lastLogFile 0]} then {
          #
          # NOTE: This is now the latest log file seen.
          #
          set lastLogFile [list $time $fileName]
        }
      }

      #
      # NOTE: Either return the last log file seen, if any -OR- the
      #       configured log file, if it actually exists.
      #
      if {[llength $lastLogFile] > 0} then {
        return [lindex $lastLogFile 1]
      } elseif {$logTime != 0} then {
        return $logFileName
      }
    }

    return ""
  }

  proc getTestSuite {} {
    #
    # NOTE: Determine the effective test suite name and return it.  If the
    #       test suite name cannot be determined, return the default based
    #       on whether we are running in Eagle or native Tcl.
    #
    if {[info exists ::test_flags(-suite)] && \
        [string length $::test_flags(-suite)] > 0} then {
      #
      # NOTE: The test suite name has been manually overridden via the test
      #       flags; therefore, use it.
      #
      return $::test_flags(-suite)
    } elseif {[info exists ::test_suite]} then {
      #
      # NOTE: Use the test suite name.  The default value is set by the test
      #       suite prologue; however, this may have been overridden.
      #
      return $::test_suite
    } elseif {[isEagle]} then {
      #
      # NOTE: Use the default test suite name for Eagle.
      #
      return "Eagle Test Suite for Eagle"
    } else {
      #
      # NOTE: Use the default test suite name for native Tcl.
      #
      return "Eagle Test Suite for Tcl"
    }
  }

  proc getTestSuiteFileName {} {
    if {[isEagle]} then {
      set fileName [probeForScriptFileName [list \
          [file join * prologue.eagle] [file join * epilogue.eagle] \
          [file join * Test1.0 *]]]
    } else {
      set fileName ""
    }

    if {[string length $fileName] == 0} then {
      if {[info exists ::test_suite_file]} then {
        set fileName $::test_suite_file
      }
    }

    if {[string length $fileName] == 0} then {
      set fileName [info script]
    }

    return $fileName
  }

  proc getTestSuiteFullName {} {
    set fileName [getTestSuiteFileName]

    if {[string length $fileName] == 0} then {
      set fileName <none>
    }

    set suiteName [getTestSuite]

    if {[string length $suiteName] == 0} then {
      set suiteName <none>
    }

    return [appendArgs "script " $fileName ", suite " $suiteName]
  }

  proc getTestSuiteVariantName {} {
    if {[isEagle]} then {
      if {[catch {
        object invoke -flags +NonPublic \
            Interpreter.GetActive.Host DefaultTitle
      } part1]} then {
        if {[info exists ::eagle_platform(engine)] && \
            [info exists ::eagle_platform(patchLevel)]} then {
          set part1 [appendArgs \
              $::eagle_platform(engine) " v" \
              $::eagle_platform(patchLevel)]
        } else {
          set part1 unknown
        }
      }
    } else {
      if {[info exists ::tcl_patchLevel]} then {
        if {[info exists ::tcl_platform(engine)]} then {
          set part1 [appendArgs \
              $::tcl_platform(engine) " v" \
              $::tcl_patchLevel]
        } else {
          set part1 [appendArgs \
              "Tcl v" $::tcl_patchLevel]
        }
      } else {
        set part1 unknown
      }
    }

    if {[info exists ::tcl_platform(processBits)] && \
        [string is integer -strict $::tcl_platform(processBits)]} then {
      set part2a [appendArgs $::tcl_platform(processBits) -bit]
    } else {
      set part2a ""
    }

    if {[info exists ::tcl_platform(os)]} then {
      set part2b $::tcl_platform(os)
    } else {
      set part2b ""
    }

    if {[info exists ::tcl_platform(platform)]} then {
      set part2c [string totitle $::tcl_platform(platform)]
    } else {
      set part2c ""
    }

    set part2 [string trim [appendArgs $part2a " " $part2b]]

    if {[string length $part2c] > 0} then {
      append part2 " (" $part2c )
    }

    if {[string length $part2] == 0} then {
      set part2 unknown
    }

    if {[info exists ::tcl_platform(machine)]} then {
      set part3 [architectureForPlatform $::tcl_platform(machine)]
    } else {
      set part3 unknown
    }

    if {[info exists ::tcl_platform(host)]} then {
      set part4 $::tcl_platform(host); # Eagle only?
    } elseif {[catch {info host} part4]} then {
      set part4 unknown
    }

    return [appendArgs \
        "variant " $part1 ", platform " $part2 ", machine " $part3 \
        ", host " $part4]
  }

  proc getTestMachine {} {
    #
    # NOTE: Determine the effective test machine and return it.  If the
    #       test machine cannot be determined, return an empty string.
    #
    if {[info exists ::test_flags(-machine)] && \
        [string length $::test_flags(-machine)] > 0} then {
      #
      # NOTE: The test machine has been manually overridden via the test
      #       flags; therefore, use it.
      #
      return $::test_flags(-machine)
    } elseif {[info exists ::test_machine]} then {
      #
      # NOTE: Use the test machine.  The default value is set by the test
      #       suite prologue; however, this may have been overridden.
      #
      return $::test_machine
    } elseif {[info exists ::tcl_platform(machine)]} then {
      #
      # NOTE: Use the build machine of Eagle itself.
      #
      return $::tcl_platform(machine)
    } else {
      #
      # NOTE: We are missing the machine, return nothing.
      #
      return ""
    }
  }

  proc getTestPlatform { {architecture false} } {
    #
    # NOTE: Determine the effective test platform and return it.  If the
    #       test platform cannot be determined, return an empty string.
    #
    if {[info exists ::test_flags(-platform)] && \
        [string length $::test_flags(-platform)] > 0} then {
      #
      # NOTE: The test platform has been manually overridden via the test
      #       flags; therefore, use it.
      #
      return $::test_flags(-platform)
    } elseif {[info exists ::test_platform]} then {
      #
      # NOTE: Use the test platform.  The default value is set by the test
      #       suite prologue; however, this may have been overridden.
      #
      return $::test_platform
    } else {
      set machine [getTestMachine]

      if {[string length $machine] > 0} then {
        #
        # NOTE: Use the machine architecture to figure out the platform
        #       and then return it.
        #
        return [machineToPlatform $machine $architecture]
      } else {
        #
        # NOTE: We are missing the machine and we cannot figure out the
        #       platform without it; therefore, return nothing.
        #
        return ""
      }
    }
  }

  proc getTestConfiguration {} {
    #
    # NOTE: Determine the effective test configuration and return it.  If
    #       the test configuration cannot be determined, return an empty
    #       string.
    #
    if {[info exists ::test_flags(-configuration)] && \
        [string length $::test_flags(-configuration)] > 0} then {
      #
      # NOTE: The test configuration has been manually overridden via the
      #       test flags; therefore, use it.
      #
      return $::test_flags(-configuration)
    } elseif {[info exists ::test_configuration]} then {
      #
      # NOTE: Use the test configuration.  The default value is set by the
      #       test suite prologue; however, this may have been overridden.
      #
      return $::test_configuration
    } elseif {[info exists ::eagle_platform(configuration)]} then {
      #
      # NOTE: Use the build configuration of Eagle itself.  This value will
      #       most likely be either "Debug" or "Release".
      #
      return $::eagle_platform(configuration)
    } else {
      #
      # NOTE: We are missing the configuration, return nothing.
      #
      return ""
    }
  }

  proc getTestNamePrefix {} {
    #
    # NOTE: Determine the effective test name prefix and return it.  If
    #       the test name prefix cannot be determined, return an empty
    #       string.
    #
    if {[info exists ::test_flags(-namePrefix)] && \
        [string length $::test_flags(-namePrefix)] > 0} then {
      #
      # NOTE: The test name prefix has been manually overridden via the
      #       test flags; therefore, use it.
      #
      return $::test_flags(-namePrefix)
    } elseif {[info exists ::test_name_prefix] && \
        [string length $::test_name_prefix] > 0} then {
      #
      # NOTE: Use the default test name prefix.
      #
      return $::test_name_prefix
    } else {
      #
      # NOTE: We are missing the test name prefix, return nothing.
      #
      return ""
    }
  }

  proc getTestSuffix {} {
    #
    # NOTE: Determine the effective test suffix and return it.  If
    #       the test suffix cannot be determined, return an empty
    #       string.
    #
    if {[info exists ::test_flags(-suffix)] && \
        [string length $::test_flags(-suffix)] > 0} then {
      #
      # NOTE: The test suffix has been manually overridden via the
      #       test flags; therefore, use it.
      #
      return $::test_flags(-suffix)
    } elseif {[info exists ::test_suffix]} then {
      #
      # NOTE: Use the test suffix.  There is no default value for
      #       this variable (i.e. by default, it does not exist).
      #
      return $::test_suffix
    } elseif {[info exists ::eagle_platform(text)] && \
        [string length $::eagle_platform(text)] > 0} then {
      #
      # NOTE: Use the build "text" of Eagle itself.  This value
      #       will typically be "NetFx20", "NetFx40", etc.  The
      #       default value of this element is an empty string.
      #
      return $::eagle_platform(text)
    } elseif {[info exists ::eagle_platform(suffix)] && \
        [string length $::eagle_platform(suffix)] > 0} then {
      #
      # NOTE: Use the build suffix of Eagle itself.  This value
      #       will typically be "NetFx20", "NetFx40", etc.  The
      #       default value of this element is an empty string.
      #
      return $::eagle_platform(suffix)
    } else {
      #
      # NOTE: We are missing the test suffix, return nothing.
      #
      return ""
    }
  }

  proc getTestUncountedLeaks {} {
    if {[info exists ::test_uncounted_leaks] && \
        [string length $::test_uncounted_leaks] > 0} then {
      return $::test_uncounted_leaks
    }

    return [list]
  }

  proc getTestListedLeaks {} {
    if {[info exists ::test_listed_leaks] && \
        [string length $::test_listed_leaks] > 0} then {
      return $::test_listed_leaks
    }

    return [list]
  }

  proc getRuntimeAssemblyName {} {
    if {[isEagle]} then {
      if {[isDotNetCore]} then {
        if {[llength [info commands object]] > 0} then {
          #
          # HACK: The core runtime assembly (i.e. the one containing
          #       System.Object, et al) must have already been loaded
          #       (?), so just abuse the [object load] sub-command to
          #       return its assembly name.
          #
          return [lindex [object load System.Private.CoreLib] 0]
        } else {
          #
          # HACK: The [object] command is unavailable, just fake it.
          #
          return "System.Private.CoreLib, Version=4.0.0.0,\
              Culture=neutral, PublicKeyToken=7cec85d7bea7798e"
        }
      } else {
        if {[llength [info commands object]] > 0} then {
          #
          # HACK: The core runtime assembly (i.e. the one containing
          #       System.Object, et al) must have already been loaded
          #       (?), so just abuse the [object load] sub-command to
          #       return its assembly name.
          #
          return [lindex [object load mscorlib] 0]
        } else {
          #
          # HACK: The [object] command is unavailable, just fake it.
          #
          if {[info exists ::eagle_platform(runtimeVersion)] && \
              [string index $::eagle_platform(runtimeVersion) 0] >= 4} then {
            #
            # BUGBUG: Does not handle a major CLR version greater than
            #         four (4).
            #
            return "mscorlib, Version=4.0.0.0, Culture=neutral,\
                PublicKeyToken=b77a5c561934e089"
          } else {
            return "mscorlib, Version=2.0.0.0, Culture=neutral,\
                PublicKeyToken=b77a5c561934e089"
          }
        }
      }
    } else {
      #
      # HACK: Native Tcl has no runtime assembly name as it is native.
      #
      return ""
    }
  }

  proc getTestAssemblyName {} {
    if {[isEagle]} then {
      return [lindex [split [lindex [info assembly] 0] ,] 0]
    } else {
      return Eagle
    }
  }

  #
  # NOTE: This procedure should return non-zero if the [exec] command may be
  #       used by the specified test package procedure.
  #
  proc canTestExec { procName } {
    if {[info exists ::no(exec)]} then {
      return false
    }

    if {[info exists ::no(canTestExec)]} then {
      return false
    }

    if {[string length $procName] > 0 && \
        [info exists [appendArgs ::no(canTestExec. $procName )]]} then {
      return false
    }

    return true
  }

  proc testExec { commandName options args } {
    set command [list exec]

    if {[llength $options] > 0} then {eval lappend command $options}

    lappend command -- $commandName

    if {[llength $args] > 0} then {eval lappend command $args}
    set procName [lindex [info level [info level]] 0]

    if {![canTestExec $procName]} then {
      tputs $::test_channel [appendArgs "---- skipping command: " $command \n]

      error "test use of \[$procName\] has been disabled"
    } else {
      tputs $::test_channel [appendArgs "---- running command: " $command \n]

      return [uplevel 1 $command]
    }
  }

  proc testClrExec { commandName options args } {
    set command [list exec]

    if {[llength $options] > 0} then {eval lappend command $options}

    lappend command --
    eval lappend command [getRuntimeCommandLine $commandName]
    if {[llength $args] > 0} then {eval lappend command $args}
    set procName [lindex [info level [info level]] 0]

    if {![canTestExec $procName]} then {
      tputs $::test_channel [appendArgs "---- skipping command: " $command \n]

      error "test use of \[$procName\] has been disabled"
    } else {
      tputs $::test_channel [appendArgs "---- running command: " $command \n]

      return [uplevel 1 $command]
    }
  }

  proc execTestShell { options args } {
    set procName [lindex [info level [info level]] 0]

    if {![canTestExec $procName]} then {
      tputs $::test_channel [appendArgs \
          "---- skipping nested shell with options \{" \
          $options "\} and arguments \{" $args \}\n]

      error "test use of \[$procName\] has been disabled"
    } else {
      tputs $::test_channel [appendArgs \
          "---- running nested shell with options \{" \
          $options "\} and arguments \{" $args \}\n]

      return [uplevel 1 execShell [list $options] $args]
    }
  }

  proc isRandomOrder {} {
    return [expr {[info exists ::test_random_order] && \
                  [string is boolean -strict $::test_random_order] && \
                  $::test_random_order}]
  }

  proc isBreakOnLeak {} {
    return [expr {[info exists ::test_break_on_leak] && \
                  [string is boolean -strict $::test_break_on_leak] && \
                  $::test_break_on_leak}]
  }

  proc isBreakOnDemand {} {
    global env

    return [expr {[info exists env(isBreakOnDemand)] && \
                  [string is boolean -strict $env(isBreakOnDemand)] && \
                  $env(isBreakOnDemand)}]
  }

  proc isStopOnFailure {} {
    return [expr {[info exists ::test_stop_on_failure] && \
                  [string is boolean -strict $::test_stop_on_failure] && \
                  $::test_stop_on_failure}]
  }

  proc isStopOnLeak {} {
    return [expr {[info exists ::test_stop_on_leak] && \
                  [string is boolean -strict $::test_stop_on_leak] && \
                  $::test_stop_on_leak}]
  }

  proc isExitOnComplete {} {
    return [expr {[info exists ::test_exit_on_complete] && \
                  [string is boolean -strict $::test_exit_on_complete] && \
                  $::test_exit_on_complete}]
  }

  proc returnInfoScript {} {
    return [info script]
  }

  proc runTestPrologue {} {
    #
    # NOTE: Verify that the global test path variable is available.
    #
    if {![info exists ::test_path]} then {
      error "cannot run test prologue, \"::test_path\" must be set"
    }

    #
    # NOTE: Reset the primary test suite file name to our caller.
    #
    set script [info script]

    if {![info exists ::no(testSuiteFile)]} then {
      set ::test_suite_file $script
    }

    #
    # HACK: We do not want to force every third-party test suite
    #       to come up with a half-baked solution to finding its
    #       own files.
    #
    if {![info exists ::no(prologue.eagle)] && ![info exists ::path]} then {
      set ::path [file normalize [file dirname $script]]
    }

    #
    # NOTE: Evaluate the standard test prologue in the context of
    #       the caller.
    #
    uplevel 1 [list source [file join $::test_path prologue.eagle]]
  }

  proc runTestEpilogue {} {
    #
    # NOTE: Verify that the global test path variable is available.
    #
    if {![info exists ::test_path]} then {
      error "cannot run test epilogue, \"::test_path\" must be set"
    }

    #
    # NOTE: Reset the primary test suite file name to our caller.
    #
    set script [info script]

    if {![info exists ::no(testSuiteFile)]} then {
      set ::test_suite_file $script
    }

    #
    # NOTE: Evaluate the standard test epilogue in the context of
    #       the caller.
    #
    uplevel 1 [list source [file join $::test_path epilogue.eagle]]

    #
    # HACK: We do not want to force every third-party test suite
    #       to come up with a half-baked solution to finding its
    #       own files.
    #
    if {![info exists ::no(epilogue.eagle)] && [info exists ::path]} then {
      unset ::path
    }
  }

  proc hookPuts {} {
    #
    # NOTE: This code was stolen from "tcltest" and heavily modified to
    #       work with Eagle.
    #
    proc [namespace current]::testPuts { args } {
      switch [llength $args] {
        1 {
          #
          # NOTE: Only the string to be printed is specified (stdout).
          #
          return [tputs $::test_channel [appendArgs [lindex $args 0] \n]]
        }
        2 {
          #
          # NOTE: Either -nonewline or channelId has been specified.
          #
          if {[lindex $args 0] eq "-nonewline"} then {
            return [tputs $::test_channel [lindex $args end]]
          } else {
            set channel [lindex $args 0]
            set newLine \n
          }
        }
        3 {
          #
          # NOTE: Both -nonewline and channelId are specified, unless
          #       it's an error.  The -nonewline option is supposed to
          #       be argv[0].
          #
          if {[lindex $args 0] eq "-nonewline"} then {
            set channel [lindex $args 1]
            set newLine ""
          }
        }
      }

      if {[info exists channel] && $channel eq "stdout"} then {
        #
        # NOTE: Write output for stdout to the test channel.
        #
        return [tputs $::test_channel [appendArgs [lindex $args end] \
            $newLine]]
      }

      #
      # NOTE: If we haven't returned by now, we don't know how to
      #       handle the input.  Let puts handle it.
      #
      return [eval ::tcl::save::puts $args]
    }

    rename ::puts ::tcl::save::puts; # save Tcl command
    rename [namespace current]::testPuts ::puts; # insert our proc
  }

  proc unhookPuts {} {
    rename ::puts ""; # remove our proc
    rename ::tcl::save::puts ::puts; # restore Tcl command
  }

  proc runTest { script } {
    #
    # NOTE: This should work properly in both Tcl and Eagle as long as the
    #       "init" script has been evaluated first.
    #
    if {![isEagle]} then {
      hookPuts
    }

    set code [catch {uplevel 1 $script} result]
    set error [expr {$code == 0 ? false : true}]

    if {[isEagle]} then {
      #
      # NOTE: Initially, the call to [tresult] (i.e. [host result]) will
      #       use the actual return code from the test command; however,
      #       if that return code was 3 (i.e. break), that indicates the
      #       test results should be highlighted in yellow -AND- that the
      #       test should still be considered successful even though the
      #       test was skipped.  If the return code was 4 (i.e. continue),
      #       that indicates the test results should be highlighted in
      #       dark yellow -AND- that the test should still be considered
      #       successful because failures are being ignored for it.
      #
      set tresultCode $code

      if {$code == 3 || $code == 5} then {
        set code 0; set error false
      } elseif {$code == 4} then {
        set code 0
      }

      #
      # NOTE: If the return code from the test command indicates success
      #       and the test results contain a clear indication of failure,
      #       reset both return codes to indicate that failure.
      #
      if {$code == 0 && [regexp -- {\s==== (.*?) FAILED\s} $result]} then {
        set code 1; set tresultCode $code
      }

      #
      # NOTE: Display and/or log the results for the test that we just
      #       completed.
      #
      if {[shouldWriteTestData $code]} then {
        tresult $tresultCode $result
      } else {
        tlog $result
      }

      #
      # NOTE: If the test failed with an actual error (i.e. not just a
      #       test failure), make sure we do not obscure the error
      #       message with test suite output.
      #
      if {$error} then {
        tputs $::test_channel \n; # emit a blank line.
      }

      #
      # NOTE: If this test failed and the stop-on-failure flag is set,
      #       raise an error now.  If we are being run from inside
      #       runAllTests, this will also serve to signal it to stop
      #       processing further test files.
      #
      if {$code != 0 && [isStopOnFailure]} then {
        tresult Error "OVERALL RESULT: STOP-ON-FAILURE\n"

        unset -nocomplain ::test_suite_running
        error ""; # no message
      }

      #
      # NOTE: Unless forbidden from doing so, attempt to automatically
      #       cleanup any stale (e.g. temporary) object references now.
      #
      if {![info exists ::no(cleanupReferences)]} then {
        catch {object cleanup -references}
      }
    } else {
      if {$error} then {
        #
        # HACK: Prevent spurious errors dealing with [test] command options
        #       that are missing from native Tcl.
        #
        set badOptionPattern {^bad option ".*?":\
            must be -body, -cleanup, -constraints, -errorOutput,\
            -match, -output, -result, -returnCodes, or -setup$}

        set badMatchValuePattern {^bad -match value ".*?": must be\
            exact, glob, or regexp$}

        if {[isEagle] || \
            (![regexp -- $badOptionPattern $result] && \
             ![regexp -- $badMatchValuePattern $result])} then {
          tputs $::test_channel [appendArgs \
              "ERROR (runTest): " $result \n]
        }
      }

      unhookPuts
    }

    #
    # HACK: Return an empty string here just in case we are being called
    #       via the [testShim] procedure.  Doing this should prevent any
    #       superfluous output from being displayed via [host result] in
    #       the outermost call to this procedure.
    #
    return ""
  }

  proc testShim { args } {
    #
    # NOTE: Call the original (saved) [test] command, wrapping it in
    #       our standard [runTest] wrapper.
    #
    uplevel 1 [list runTest [concat ::savedTest $args]]; return ""
  }

  proc tsource { fileName {prologue true} {epilogue true} } {
    #
    # NOTE: Run the test prologue in the context of the caller (which
    #       must be global)?
    #
    if {$prologue} then {
      uplevel 1 runTestPrologue
    }

    #
    # NOTE: Save the original [test] command and setup our test shim in
    #       its place.
    #
    rename ::test ::savedTest
    interp alias {} ::test {} testShim

    #
    # NOTE: Source the specified test file in the context of the caller
    #       (which should be global).
    #
    set code [catch {uplevel 1 [list source $fileName]} result]
    set error [expr {$code == 0 ? false : true}]

    #
    # NOTE: Remove our test shim and restore the original (saved) [test]
    #       command.
    #
    interp alias {} ::test {}
    rename ::savedTest ::test

    #
    # NOTE: Run the test epilogue in the context of the caller (which
    #       must be global)?
    #
    if {$epilogue} then {
      uplevel 1 runTestEpilogue
    }

    #
    # NOTE: If the test raised an error, re-raise it now; otherwise,
    #       just return the result.
    #
    if {$error} then {
      unset -nocomplain ::test_suite_running
      error $result
    } else {
      return $result
    }
  }

  proc getKnownEagleVersions { {force false} } {
    #
    # NOTE: This job of this procedure is to return the list of "known"
    #       officially released versions of Eagle.
    #
    if {[info exists ::test_well_known(eagleVersions)]} then {
      return $::test_well_known(eagleVersions)
    }

    if {$force || ![info exists ::no(eagleVersions)]} then {
      return [list \
          1.0.3218.15461 1.0.3285.13304 1.0.3299.874   1.0.3321.8911  \
          1.0.3344.10975 1.0.3508.7783  1.0.3756.18875 1.0.3933.37600 \
          1.0.3935.30806 1.0.3936.949   1.0.3972.10358 1.0.3993.40193 \
          1.0.4010.41132 1.0.4031.13865 1.0.4093.38850 1.0.4173.1269  \
          1.0.4215.24284 1.0.4221.27588 1.0.4291.26291 1.0.4312.34328 \
          1.0.4375.30934 1.0.4375.38149 1.0.4472.20308 1.0.4511.33828 \
          1.0.4567.36231 1.0.4629.29317 1.0.4691.37889 1.0.4807.22448 \
          1.0.5000.25377 1.0.5173.31244 1.0.5217.20046 1.0.5384.19912 \
          1.0.5542.25903 1.0.5633.18513 1.0.5749.32588 1.0.5934.21851 \
          1.0.6018.45959 1.0.6119.57133 1.0.6120.16902 1.0.6234.51946 \
          1.0.6483.12345 1.0.6543.58654 1.0.6781.49000 1.0.6781.49042 \
          1.0.6848.11041 1.0.7213.50727 1.0.7790.43198 1.0.7897.33333 \
          1.0.7900.33333 1.0.7945.33333 1.0.8192.54321 1.0.8251.52012 \
          1.0.8369.11942 1.0.8503.24499 1.0.8613.27347 1.0.8734.30319]
    } else {
      return [list]
    }
  }

  proc isStableEagleRelease {
          {sequence end} {higherOnly false} {orHigher true} } {
    if {[isEagle] && [catch {
      #
      # HACK: Since the sequence starts at "Beta 0", there is no
      #       need to adjust the index into the list returned by
      #       the [getKnownEagleVersions] procedure.
      #
      package vcompare $::eagle_platform(patchLevel) \
          [lindex [getKnownEagleVersions] $sequence]
    } result] == 0 && [string is integer -strict $result]} then {
      if {$higherOnly} then {
        return [expr {$result > 0}]; # NOTE: Released after?
      } elseif {$orHigher} then {
        return [expr {$result >= 0}]; # NOTE: Is compatible?
      } else {
        return [expr {$result == 0}]; # NOTE: Exact version?
      }
    } else {
      return false; # NOTE: Not Eagle -OR- something failed?
    }
  }

  proc recordTestStatistics { varName index } {
    #
    # NOTE: Record counts of all object types that we track.
    #
    upvar 1 $varName array

    ###########################################################################

    if {![info exists array(uncounted,$index)]} then {
      set array(uncounted,$index) [getTestUncountedLeaks]
    }

    if {![info exists array(listed,$index)]} then {
      set array(listed,$index) [getTestListedLeaks]
    }

    ###########################################################################

    set array(time,$index) [clock seconds]; # keep track of when...

    ###########################################################################

    if {![info exists ::no(query,afters)]} then {
      set list [after info]
    } else {
      set list [list]
    }

    set array(afters,$index) [llength $list]

    if {[info exists array(listed,$index)] && \
        [lsearch -exact $array(listed,$index) afters] != -1} then {
      set array(afters,$index,list) $list
    }

    ###########################################################################

    if {![info exists ::no(query,globals)]} then {
      set list [info globals]
    } else {
      set list [list]
    }

    set array(variables,$index) [llength $list]

    if {[info exists array(listed,$index)] && \
        [lsearch -exact $array(listed,$index) variables] != -1} then {
      set array(variables,$index,list) $list
    }

    ###########################################################################

    if {![info exists ::no(query,commands)]} then {
      set list [info commands]
    } else {
      set list [list]
    }

    set array(commands,$index) [llength $list]

    if {[info exists array(listed,$index)] && \
        [lsearch -exact $array(listed,$index) commands] != -1} then {
      set array(commands,$index,list) $list
    }

    ###########################################################################

    if {![info exists ::no(query,procedures)]} then {
      set list [info procs]
    } else {
      set list [list]
    }

    set array(procedures,$index) [llength $list]

    if {[info exists array(listed,$index)] && \
        [lsearch -exact $array(listed,$index) procedures] != -1} then {
      set array(procedures,$index,list) $list
    }

    ###########################################################################

    if {![info exists ::no(query,namespaces)]} then {
      if {[isStableEagleRelease 47 true]} then {; # NOTE: Post Beta 47.
        set list [namespace descendants ::]
      } else {
        set list [namespace children ::]
      }
    } else {
      set list [list]
    }

    set array(namespaces,$index) [llength $list]

    if {[info exists array(listed,$index)] && \
        [lsearch -exact $array(listed,$index) namespaces] != -1} then {
      set array(namespaces,$index,list) $list
    }

    ###########################################################################

    if {![info exists ::no(query,files)]} then {
      if {[info exists ::test_path]} then {
        set list [getFiles $::test_path *]
      } else {
        set list [list]; # NOTE: Information not available.
      }
    } else {
      set list [list]
    }

    set array(files,$index) [llength $list]

    if {[info exists array(listed,$index)] && \
        [lsearch -exact $array(listed,$index) files] != -1} then {
      set array(files,$index,list) $list
    }

    ###########################################################################

    if {![info exists ::no(query,binaryFiles)]} then {
      if {[info exists ::bin_path]} then {
        set list [getFiles $::bin_path *]
      } else {
        set list [list]; # NOTE: Information not available.
      }
    } else {
      set list [list]
    }

    set array(binaryFiles,$index) [llength $list]

    if {[info exists array(listed,$index)] && \
        [lsearch -exact $array(listed,$index) binaryFiles] != -1} then {
      set array(binaryFiles,$index,list) $list
    }

    ###########################################################################

    #
    # NOTE: Should any temporary files be exluced from leak accounting?
    #
    if {[info exists ::no(excludedTemporaryFiles)]} then {
      set excludeTemporaryFiles $::no(excludedTemporaryFiles)
    } else {
      set excludeTemporaryFiles ""
    }

    if {![info exists ::no(query,temporaryFiles)]} then {
      set list [getFiles [getTemporaryPath] * $excludeTemporaryFiles]
    } else {
      set list [list]
    }

    set array(temporaryFiles,$index) [llength $list]

    if {[info exists array(listed,$index)] && \
        [lsearch -exact $array(listed,$index) temporaryFiles] != -1} then {
      set array(temporaryFiles,$index,list) $list
    }

    ###########################################################################

    if {![info exists ::no(query,channels)]} then {
      set list [file channels]
    } else {
      set list [list]
    }

    set array(channels,$index) [llength $list]

    if {[info exists array(listed,$index)] && \
        [lsearch -exact $array(listed,$index) channels] != -1} then {
      set array(channels,$index,list) $list
    }

    ###########################################################################

    if {![info exists ::no(query,aliases)]} then {
      set list [interp aliases]
    } else {
      set list [list]
    }

    set array(aliases,$index) [llength $list]

    if {[info exists array(listed,$index)] && \
        [lsearch -exact $array(listed,$index) aliases] != -1} then {
      set array(aliases,$index,list) $list
    }

    ###########################################################################

    if {![info exists ::no(query,interpreters)]} then {
      if {[isStableEagleRelease 45 true]} then {; # NOTE: Post Beta 45.
        #
        # NOTE: This version of Eagle should support the [interp children]
        #       sub-command.
        #
        set list [interp children]; # Beta 46+
      } elseif {[catch {interp children} children] == 0} then {
        #
        # NOTE: The version of native Tcl in use appears to support the new
        #       [interp children] sub-command.
        #
        set list $children; # Tcl 8.7+ (?)
      } else {
        #
        # NOTE: Unfortunately, this exact terminology is needed to retain
        #       backward compatibility with native Tcl 8.4+.  Please see:
        #
        #       https://urn.to/r/tcl_interp_slaves
        #
        set list [interp slaves]; # COMPAT: Tcl.
      }
    } else {
      set list [list]
    }

    set array(interpreters,$index) [llength $list]

    if {[info exists array(listed,$index)] && \
        [lsearch -exact $array(listed,$index) interpreters] != -1} then {
      set array(interpreters,$index,list) $list
    }

    ###########################################################################

    if {![info exists ::no(query,environment)]} then {
      set list [array names env]
    } else {
      set list [list]
    }

    set array(environment,$index) [llength $list]

    if {[info exists array(listed,$index)] && \
        [lsearch -exact $array(listed,$index) environment] != -1} then {
      set array(environment,$index,list) $list
    }

    ###########################################################################

    if {![info exists ::no(query,loaded)]} then {
      set list [info loaded]
    } else {
      set list [list]
    }

    set array(loaded,$index) [llength $list]

    if {[info exists array(listed,$index)] && \
        [lsearch -exact $array(listed,$index) loaded] != -1} then {
      set array(loaded,$index,list) $list
    }

    ###########################################################################

    #
    # NOTE: These native resource types cannot be positively checked
    #       for leaks (i.e. because the "leak" may be from an external
    #       process).
    #
    if {![info exists ::no(uncountedTemporaryFiles)]} then {
      lappend array(uncounted,$index) temporaryFiles
    }

    ###########################################################################

    if {[isEagle]} then {
      #########################################################################
      #
      # NOTE: Support for some of all of these entity types may not be
      #       present in the interpreter, initialize all these counts
      #       to zero and then try to query each one individually below
      #       wrapped in a catch.
      #
      #########################################################################

      if {[info exists ::no(query,previousPid)] || \
          [catch {info previouspid} list]} then {
        set list 0; # NOTE: Integer, zero for "not in use", negative ok.
      }

      #
      # NOTE: Convert the integer to a boolean.  True means the previous
      #       [pid] value has been used and not reset (i.e. leaked).
      #
      set array(previousPid,$index) [expr {$list != 0}]

      if {[info exists array(listed,$index)] && \
          [lsearch -exact $array(listed,$index) previousPid] != -1} then {
        set array(previousPid,$index,list) $list
      }

      #########################################################################

      if {[info exists ::no(query,scopes)] || \
          [catch {scope list} list]} then {
        set list [list]
      }

      set array(scopes,$index) [llength $list]

      if {[info exists array(listed,$index)] && \
          [lsearch -exact $array(listed,$index) scopes] != -1} then {
        set array(scopes,$index,list) $list
      }

      #########################################################################

      if {[info exists ::no(query,snippets)] || [catch {
        if {[llength [info commands object]] > 0} then {
          set names null; set error null

          set code [object invoke Interpreter.GetActive \
              ListSnippets null false None None names error]

          if {$code ne "Ok"} then {
            error [getStringFromObjectHandle $error]
          }
        }
      } list]} then {
        set list [list]
      }

      set array(snippets,$index) [llength $list]

      if {[info exists array(listed,$index)] && \
          [lsearch -exact $array(listed,$index) snippets] != -1} then {
        set array(snippets,$index,list) $list
      }

      #########################################################################

      if {[info exists ::no(query,assemblies)] || \
          [catch {object assemblies} list]} then {
        set list [list]
      }

      set array(assemblies,$index) [llength $list]

      if {[info exists array(listed,$index)] && \
          [lsearch -exact $array(listed,$index) assemblies] != -1} then {
        set array(assemblies,$index,list) $list
      }

      #########################################################################

      if {[info exists ::no(query,processes)] || \
          [catch {getProcesses ""} list]} then {
        set list [list]
      }

      set array(processes,$index) [llength $list]

      if {[info exists array(listed,$index)] && \
          [lsearch -exact $array(listed,$index) processes] != -1} then {
        set array(processes,$index,list) $list
      }

      #########################################################################

      if {[info exists ::no(query,objects)] || \
          [catch {info objects} list]} then {
        set list [list]
      }

      set array(objects,$index) [llength $list]

      if {[info exists array(listed,$index)] && \
          [lsearch -exact $array(listed,$index) objects] != -1} then {
        set array(objects,$index,list) $list
      }

      #########################################################################

      if {[info exists ::no(query,objectCallbacks)] || \
          [catch {info callbacks} list]} then {
        set list [list]
      }

      set array(objectCallbacks,$index) [llength $list]

      if {[info exists array(listed,$index)] && \
          [lsearch -exact $array(listed,$index) objectCallbacks] != -1} then {
        set array(objectCallbacks,$index,list) $list
      }

      #########################################################################

      if {[info exists ::no(query,objectTypes)] || \
          [catch {object types} list]} then {
        set list [list]
      }

      set array(objectTypes,$index) [llength $list]

      if {[info exists array(listed,$index)] && \
          [lsearch -exact $array(listed,$index) objectTypes] != -1} then {
        set array(objectTypes,$index,list) $list
      }

      #########################################################################

      if {[info exists ::no(query,objectInterfaces)] || \
          [catch {object interfaces} list]} then {
        set list [list]
      }

      set array(objectInterfaces,$index) [llength $list]

      if {[info exists array(listed,$index)] && \
          [lsearch -exact $array(listed,$index) objectInterfaces] != -1} then {
        set array(objectInterfaces,$index,list) $list
      }

      #########################################################################

      if {[info exists ::no(query,objectNamespaces)] || \
          [catch {object namespaces} list]} then {
        set list [list]
      }

      set array(objectNamespaces,$index) [llength $list]

      if {[info exists array(listed,$index)] && \
          [lsearch -exact $array(listed,$index) objectNamespaces] != -1} then {
        set array(objectNamespaces,$index,list) $list
      }

      #########################################################################
      #
      # NOTE: Support for some of all of these entity types may not be
      #       present in the interpreter, initialize all these counts
      #       to zero and then try to query each one individually below
      #       wrapped in a catch.
      #
      #########################################################################

      if {[info exists ::no(query,connections)] || \
          [catch {info connections} list]} then {
        set list [list]
      }

      set array(connections,$index) [llength $list]

      if {[info exists array(listed,$index)] && \
          [lsearch -exact $array(listed,$index) connections] != -1} then {
        set array(connections,$index,list) $list
      }

      #########################################################################

      if {[info exists ::no(query,transactions)] || \
          [catch {info transactions} list]} then {
        set list [list]
      }

      set array(transactions,$index) [llength $list]

      if {[info exists array(listed,$index)] && \
          [lsearch -exact $array(listed,$index) transactions] != -1} then {
        set array(transactions,$index,list) $list
      }

      #########################################################################

      if {[info exists ::no(query,modules)] || \
          [catch {info modules} list]} then {
        set list [list]
      }

      set array(modules,$index) [llength $list]

      if {[info exists array(listed,$index)] && \
          [lsearch -exact $array(listed,$index) modules] != -1} then {
        set array(modules,$index,list) $list
      }

      #########################################################################

      if {[info exists ::no(query,delegates)] || \
          [catch {info delegates} list]} then {
        set list [list]
      }

      set array(delegates,$index) [llength $list]

      if {[info exists array(listed,$index)] && \
          [lsearch -exact $array(listed,$index) delegates] != -1} then {
        set array(delegates,$index,list) $list
      }

      #########################################################################

      set haveTclCmd [expr {[llength [info commands tcl]] > 0}]

      #########################################################################

      if {[info exists ::no(query,tcl)] || \
          !$haveTclCmd || [catch {tcl ready} list]} then {
        set list False; # NOTE: Boolean, false is "not in use".
      }

      set array(tcl,$index) $list; # verbatim

      if {[info exists array(listed,$index)] && \
          [lsearch -exact $array(listed,$index) tcl] != -1} then {
        set array(tcl,$index,list) $list
      }

      #######################################################################

      if {[info exists ::no(query,tclInterps)] || \
          !$haveTclCmd || [catch {tcl interps} list]} then {
        set list [list]
      }

      set array(tclInterps,$index) [llength $list]

      if {[info exists array(listed,$index)] && \
          [lsearch -exact $array(listed,$index) tclInterps] != -1} then {
        set array(tclInterps,$index,list) $list
      }

      #######################################################################

      if {[info exists ::no(query,tclThreads)] || \
          !$haveTclCmd || [catch {tcl threads} list]} then {
        set list [list]
      }

      set array(tclThreads,$index) [llength $list]

      if {[info exists array(listed,$index)] && \
          [lsearch -exact $array(listed,$index) tclThreads] != -1} then {
        set array(tclThreads,$index,list) $list
      }

      #######################################################################

      if {[info exists ::no(query,tclCommands)] || \
          !$haveTclCmd || [catch {tcl command list} list]} then {
        set list [list]
      }

      set array(tclCommands,$index) [llength $list]

      if {[info exists array(listed,$index)] && \
          [lsearch -exact $array(listed,$index) tclCommands] != -1} then {
        set array(tclCommands,$index,list) $list
      }

      #########################################################################

      if {[info exists ::no(query,scriptThreads)] || [catch {
        #
        # NOTE: Grab the number of active threads that are active because
        #       of ScriptThread object instances.  This will only work if
        #       Eagle is Beta 31 or higher.
        #
        object invoke -flags +NonPublic ScriptThread activeCount
      } list]} then {
        set list 0; # NOTE: Integer, zero for "not in use", negative ok.
      }

      set array(scriptThreads,$index) $list; # verbatim

      if {[info exists array(listed,$index)] && \
          [lsearch -exact $array(listed,$index) scriptThreads] != -1} then {
        set array(scriptThreads,$index,list) $list
      }

      #########################################################################
      #
      # NOTE: These managed resource types cannot be positively checked
      #       for leaks (i.e. because the "leak" may be from an external
      #       process).
      #
      #########################################################################

      if {![info exists ::no(uncountedAssemblies)]} then {
        lappend array(uncounted,$index) assemblies
      }

      if {![info exists ::no(uncountedProcesses)]} then {
        lappend array(uncounted,$index) processes
      }
    }
  }

  proc reportTestStatistics {
          channel fileName stop statsVarName filesVarName {quiet false} } {
    set statistics [list afters variables commands procedures namespaces \
        files binaryFiles temporaryFiles channels aliases interpreters \
        environment loaded]

    if {[isEagle]} then {
      #
      # TODO: For now, tracking "leaked" assemblies is meaningless because
      #       the .NET Framework has no way to unload them without tearing
      #       down the entire application domain.
      #
      lappend statistics \
          previousPid scopes assemblies processes objects objectCallbacks \
          objectTypes objectInterfaces objectNamespaces connections \
          transactions modules delegates tcl tclInterps tclThreads \
          tclCommands scriptThreads
    }

    #
    # NOTE: Show what leaked, if anything.
    #
    set count 0; upvar 1 $statsVarName array

    foreach statistic $statistics {
      if {![info exists array($statistic,after)]} then {
        if {!$quiet} then {
          tputs $channel [appendArgs "==== \"" $fileName "\" MISSING " \
              $statistic " AFTER\n"]
        }

        continue
      }

      if {![info exists array($statistic,before)]} then {
        if {!$quiet} then {
          tputs $channel [appendArgs "==== \"" $fileName "\" MISSING " \
              $statistic " BEFORE\n"]
        }

        continue
      }

      if {$array($statistic,after) > $array($statistic,before)} then {
        lappend array(statistics,leaked) $statistic

        if {!$quiet} then {
          tputs $channel [appendArgs "==== \"" $fileName "\" LEAKED " \
              $statistic \n]
        }

        if {[info exists array($statistic,before,list)]} then {
          if {!$quiet} then {
            tputs $channel [appendArgs "---- " $statistic " BEFORE: " \
                [formatList $array($statistic,before,list)] \n]
          }
        }

        if {[info exists array($statistic,after,list)]} then {
          if {!$quiet} then {
            tputs $channel [appendArgs "---- " $statistic " AFTER: " \
                [formatList $array($statistic,after,list)] \n]
          }
        }

        if {[info exists array(uncounted,before)] && \
            [lsearch -exact $array(uncounted,before) $statistic] != -1} then {
          continue
        }

        if {[info exists array(uncounted,after)] && \
            [lsearch -exact $array(uncounted,after) $statistic] != -1} then {
          continue
        }

        incr count
      }
    }

    #
    # NOTE: Make sure this file name is recorded in the list of file names with
    #       leaking tests.
    #
    upvar 1 $filesVarName fileNames

    if {$count > 0 && \
        [lsearch -exact $fileNames [file tail $fileName]] == -1} then {
      lappend fileNames [file tail $fileName]
    }

    #
    # NOTE: Disable test suite interaction in "quiet" mode.  Just return the
    #       leak count.
    #
    if {!$quiet} then {
      #
      # NOTE: If we are supposed to stop or break into the debugger whenever
      #       a leak is detected, do it now.
      #
      if {$count > 0} then {
        #
        # BUGFIX: Is we are already stopping (e.g. due to a test failure),
        #         do not try to stop again.
        #
        if {!$stop && [isStopOnLeak]} then {
          tresult Error "OVERALL RESULT: STOP-ON-LEAK\n"

          unset -nocomplain ::test_suite_running
          error ""; # no message
        } elseif {[isBreakOnLeak]} then {
          testDebugBreak
        }
      }
    }

    return [list leak $count]
  }

  proc formatList { list {default ""} {columns 1} } {
    if {[catch {
      set result ""
      set count 1

      foreach item $list {
        if {[incr count -1] == 0} then {
          set count $columns
          append result \n
        }

        append result \t

        if {[string length $item] > 0} then {
          append result $item
        } else {
          append result <noItem>
        }
      }
    }] == 0} then {
      return [expr {[string length $result] > 0 ? $result : $default}]
    } else {
      return ""
    }
  }

  proc formatListAsDict { list {default ""} } {
    if {[catch {
      set result ""

      foreach {name value} $list {
        append result \n\t

        if {[string length $name] > 0} then {
          if {[regexp -- {^[_\w]*$} $name]} then {
            set wrap ""
          } else {
            set wrap \"
          }

          append result $wrap $name $wrap
        } else {
          append result <noName>
        }

        append result ": "

        if {[string length $value] > 0} then {
          append result $value
        } else {
          append result <noValue>
        }
      }
    }] == 0} then {
      return [expr {[string length $result] > 0 ? $result : $default}]
    } else {
      return ""
    }
  }

  proc pathToRegexp { path {list false} } {
    #
    # NOTE: This procedure needs to escape all characters that
    #       have any special meaning to the regular expression
    #       engine.  Typically, the only characters we need to
    #       really worry about are the directory separator and
    #       the file extension separator (e.g. backslash and
    #       period on Windows and/or forward slash and period
    #       on Unix).  Since the forward slash has no special
    #       meaning to the regular expression engine, Windows
    #       is somewhat more difficult to handle.
    #
    set map [list \
        \\ \\\\ \$ \\\$ ( \\( ) \\) * \\* + \\+ - \\- . \\. \
        ? \\? \[ \\\[ \] \\\] ^ \\^ \{ \\\{ \} \\\}]

    return [string map $map [expr {$list ? [list $path] : $path}]]
  }

  proc assemblyNameToRegexp { assemblyName {list false} } {
    #
    # NOTE: This procedure needs to escape all characters that
    #       have any special meaning to the regular expression
    #       engine -AND- that can actually appear in a legal
    #       assembly name.  Normally, this would only include
    #       the period character.
    #
    # HACK: For now, just abuse the [pathToRegexp] procedure
    #       for this.
    #
    return [pathToRegexp $assemblyName $list]
  }

  proc maybeGetOption {
          argv varName {required true} {override true} {default ""}
          {class ""} } {
    upvar 1 $varName optionValue

    set wasPresent false

    if {[info exists optionValue]} then {
      if {[string length $class] > 0 && \
          ![string is $class -strict $optionValue]} then {
        error [appendArgs \
            "present option value \"" $optionValue "\" is not " \
            $class]
      }

      if {$override} then {
        set wasPresent true
      } else {
        return isPresent
      }
    }

    set length [llength $argv]

    if {$length % 2} then {
      error "even number of arguments required (option pairs)"
    }

    set optionName [appendArgs - $varName]

    for {set index 0} {$index < $length} {incr index 2} {
      set name [lindex $argv $index]
      set value [lindex $argv [expr {$index + 1}]]

      if {$name eq $optionName} then {; # found?
        if {[string length $class] > 0 && \
            ![string is $class -strict $value]} then {
          error [appendArgs \
              "found option value \"" $value "\" is not " \
              $class]
        }

        set optionValue $value; return [expr {
          $wasPresent ? "isOverridden" : "isFound"
        }]
      }
    }

    if {$wasPresent} then {
      return wasPresent
    }

    if {[string length $default] > 0} then {
      if {[string length $class] > 0 && \
          ![string is $class -strict $default]} then {
        error [appendArgs \
            "default option value \"" $default "\" is not " \
            $class]
      }

      set optionValue $default; return isDefault
    } elseif {$required} then {
      error [appendArgs \
          "missing required option \"" $optionName \"]
    } else {
      return isMissing
    }
  }

  proc inverseLsearchGlob { noCase patterns element } {
    #
    # NOTE: Perform the inverse of [lsearch -glob], attempt
    #       to match an element against a list of patterns.
    #
    set command [list string match]
    if {$noCase} then {lappend command -nocase}

    set length [llength $patterns]

    for {set index 0} {$index < $length} {incr index} {
      set pattern [lindex $patterns $index]

      if {[eval $command [list $pattern] [list $element]]} then {
        return $index
      }
    }

    return -1
  }

  proc removePathFromFileNames { path fileNames } {
    set result [list]

    foreach fileName $fileNames {
      if {[file normalize [file dirname $fileName]] eq \
          [file normalize $path]} then {
        #
        # NOTE: Strip the path name from this file name.
        #
        lappend result [file tail $fileName]
      } else {
        lappend result $fileName
      }
    }

    return $result
  }

  proc formatDecimal { value {places 4} {zeros false} } {
    #
    # NOTE: If the value is an empty string, do nothing and return an empty
    #       string.
    #
    if {[string length $value] == 0} then {
      return ""
    }

    #
    # NOTE: For now, use slightly different methods for formatting floating
    #       pointer numbers for native Tcl and Eagle.
    #
    if {[isEagle] && [llength [info commands object]] > 0} then {
      #
      # HACK: This works; however, in order to do this kind of thing cleanly,
      #       we really need the Tcl [format] command.
      #
      set result [object invoke String Format [appendArgs "{0:0." \
          [string repeat [expr {$zeros ? "0" : "#"}] $places] "}"] \
          [set object [object invoke -create Double Parse $value]]]

      unset object; # dispose
    } else {
      #
      # NOTE: See, nice and clean when done in Tcl?
      #
      set result [format [appendArgs %. $places f] $value]

      #
      # HACK: Since native Tcl does not appear to expose a method to only
      #       preserve non-zero trailing digits, we may need to manually
      #       remove extra trailing zeros.
      #
      if {!$zeros} then {
        #
        # NOTE: Remove all trailing zeros and the trailing decimal point,
        #       if necessary.
        #
        set result [string trimright [string trimright $result 0] .]
      }
    }

    return $result
  }

  proc clearTestPercent { channel } {
    if {[isEagle]} then {
      host title ""
    }
  }

  proc reportTestPercent {
          channel percent doneFiles totalFiles failedFiles leakedFiles } {
    if {[isEagle]} then {
      set totalTests $::eagle_tests(Total)
      set failedTests $::eagle_tests(Failed)
      set skippedTests $::eagle_tests(Skipped)
    } else {
      set totalTests $::tcltest::numTests(Total)
      set failedTests $::tcltest::numTests(Failed)
      set skippedTests $::tcltest::numTests(Skipped)
    }

    set suiteName [getTestSuite]

    if {[string length $suiteName] == 0} then {
      set suiteName unknown
    }

    set suiteFileName [getTestSuiteFileName]

    if {[string length $suiteFileName] == 0} then {
      set suiteFileName unknown
    }

    set suiteVariantName [getTestSuiteVariantName]

    if {[string length $suiteVariantName] == 0} then {
      set suiteVariantName "variant unknown"
    }

    set status(title) [appendArgs \
        "---- test suite running, about " $percent "% complete (" \
        $totalTests " tests total, " $failedTests " tests failed, " \
        $skippedTests " tests skipped, " $doneFiles " files done, " \
        $totalFiles " files total, " $failedFiles " files failed, " \
        $leakedFiles " files leaked)..."]

    set status(tputs) [appendArgs \
        "---- test suite \"" $suiteName ", " $suiteVariantName \
        "\" running from \"" $suiteFileName "\", about " $percent \
        "% complete (" $totalTests " tests total, " $failedTests \
        " tests failed, " $skippedTests " tests skipped, " $doneFiles \
        " files done, " $totalFiles " files total, " $failedFiles \
        " files failed, " $leakedFiles " files leaked)..."]

    tputs $channel [appendArgs $status(tputs) \n]

    if {[isEagle]} then {
      host title $status(title)
    }
  }

  proc reportArrayGet { varName } {
    if {[string length $varName] == 0} then {
      return [list]
    }

    upvar 1 $varName array

    if {![info exists ::no(reportArrayGet)]} then {
      set list(1) [list]

      foreach {name value} [array get array] {
        lappend list(1) [list $name $value]
      }

      #
      # HACK: This assumes that we are dealing with integer values.
      #
      set list(2) [lsort -index 1 -integer -decreasing $list(1)]
      set list(3) [list]

      foreach pair $list(2) {
        lappend list(3) [lindex $pair 0] [lindex $pair 1]
      }

      return $list(3)
    } else {
      return [array get array]
    }
  }

  proc reportTestStatisticCounts { channel statsVarName } {
    upvar 1 $statsVarName array

    #
    # NOTE: Were any counts recorded during the testing?
    #
    if {[info exists array(statistics,leaked)]} then {
      #
      # NOTE: Process each leak type in the list, recording any duplicates
      #       in the temporary count array.
      #
      foreach statistic $array(statistics,leaked) {
        if {[info exists count($statistic)]} then {
          incr count($statistic)
        } else {
          set count($statistic) 1
        }
      }

      #
      # NOTE: Flatten the temporary count array into a dictionary formatted
      #       list and then possibly display it (i.e. if it actually contains
      #       any data).
      #
      set statistics [reportArrayGet count]

      if {[llength statistics] > 0} then {
        tputs $channel [appendArgs "---- types of leaks detected: " \
            [formatListAsDict $statistics] \n]
      }
    }
  }

  proc runAllTests {
          channel path fileNames skipFileNames startFileNames stopFileNames } {
    #
    # NOTE: Are we configured to run the test files in random order?
    #
    if {[isRandomOrder]} then {
      set fileNames [lshuffle $fileNames]
    }

    #
    # NOTE: Show the exact arguments we received since they may not
    #       have been displayed by the caller (or anybody else).
    #
    if {![info exists ::no(runMetadata)]} then {
      tputs $channel [appendArgs "---- test run path: \"" $path \"\n]

      tputs $channel [appendArgs "---- test run file names: " \
          [formatList [removePathFromFileNames $path $fileNames]] \n]

      tputs $channel [appendArgs "---- test run skip file names: " \
          [formatList $skipFileNames] \n]
    }

    #
    # NOTE: Keep going unless this becomes true (i.e. if one of the
    #       test files signals us to stop).
    #
    set stop false

    #
    # NOTE: So far, we have run no tests.
    #
    set count 0

    #
    # NOTE: So far, no files have had failing or leaking tests.
    #
    set failed [list]
    set leaked [list]

    #
    # NOTE: Process each file name we have been given by the caller...
    #
    set total [llength $fileNames]; set lastPercent -1

    foreach fileName $fileNames {
      #
      # NOTE: If configured to break into the debugger before running the
      #       test file, do it now.
      #
      if {[isBreakOnDemand]} then {
        testDebugBreak
      }

      #
      # NOTE: In terms of files, not tests, what percent done are we now?
      #
      set percent [formatDecimal \
          [expr {$total != 0 ? 100.0 * ($count / double($total)) : 0}]]

      if {$percent != $lastPercent} then {
        if {![info exists ::no(runPercent)]} then {
          reportTestPercent $channel $percent \
              $count $total [llength $failed] [llength $leaked]
        }

        set lastPercent $percent
      }

      #
      # NOTE: If the starting file names have been specified by the caller,
      #       skip over all the file names before one of them.
      #
      if {[llength $startFileNames] > 0} then {
        if {[inverseLsearchGlob false $startFileNames \
            [file tail $fileName]] != -1} then {
          #
          # NOTE: Now that we found the starting test file name, do not
          #       skip any more test files.
          #
          set startFileNames [list]
        } else {
          #
          # NOTE: We have not found the starting test file name yet, skip
          #       over this test file.
          #
          continue
        }
      }

      #
      # NOTE: If the stopping file names have been specified by the caller,
      #       skip over all the file names after one of them.
      #
      if {[llength $stopFileNames] > 0} then {
        if {[inverseLsearchGlob false $stopFileNames \
            [file tail $fileName]] != -1} then {
          #
          # NOTE: Now that we found the stopping test file name, do not
          #       run any more test files.
          #
          set stopFileNames [list]

          #
          # NOTE: This will terminate the loop right after the test file
          #       cleanup code (i.e. at the bottom of the loop).
          #
          set stop true
        }
      }

      #
      # NOTE: Skipping over any file name that matches a pattern in the
      #       list of file names to skip.
      #
      if {[inverseLsearchGlob false $skipFileNames \
          [file tail $fileName]] == -1} then {
        #
        # NOTE: Does the file name contain directory information?
        #
        if {[string length [file dirname $fileName]] <= 1} then {
          #
          # NOTE: If not, assume it is under the supplied test path.
          #
          set fileName [file normalize [file join $path $fileName]]
        }

        #
        # NOTE: The "magic" pattern we are looking for to determine if
        #       a given file is part of the formal test suite.
        #
        set pattern {^(\s)*runTest .*$}

        #
        # NOTE: Skip files that are not part of the test suite.
        #
        set data [readFile $fileName]

        #
        # NOTE: Check for a match.
        #
        set match [regexp -line -- $pattern $data]

        #
        # NOTE: Failing that, in Eagle only, check if the data, when
        #       interpreted as Unicode, matches the pattern.
        #
        if {!$match && [isEagle]} then {
          set match [regexp -line -- $pattern \
              [encoding convertfrom unicode $data]]
        }

        #
        # NOTE: Does this "look" like an actual test suite file?
        #
        if {$match} then {
          #
          # BUGFIX: Unset the current test file name so that variable
          #         accounting works correctly.  It will be reset below
          #         prior to running any actual test(s).
          #
          unset -nocomplain ::test_file

          #
          # NOTE: Is resource leak checking explicitly disabled?
          #
          if {![info exists ::no(leak)]} then {
            #
            # NOTE: Get "before" resource counts for leak tracking.
            #
            recordTestStatistics leaks before
          }

          #
          # NOTE: Let the test prologue code know which file we are
          #       evaluating.
          #
          set ::test_file $fileName

          #
          # NOTE: Record failed test count before this file.
          #
          if {[isEagle]} then {
            set before $::eagle_tests(Failed)
          } else {
            set before $::tcltest::numTests(Failed)
          }

          #
          # NOTE: Evaluate the test file, optionally waiting for a certain
          #       number of milliseconds before and/or after doing so.
          #
          if {[catch {
            #
            # NOTE: Are we being prevented from waiting before the file?
            #
            if {![info exists ::no(preWait)]} then {
              if {[info exists ::test_wait(pre)] && \
                  [string is integer -strict $::test_wait(pre)]} then {
                if {![info exists ::no(runMetadata)]} then {
                  tputs $channel [appendArgs \
                      "---- waiting for " $::test_wait(pre) \
                      " milliseconds before test file...\n"]
                }

                after $::test_wait(pre); # NOTE: Sleep.
              }
            }

            #
            # NOTE: Log that this test file has started.
            #
            if {![info exists ::no(runStartFile)]} then {
              tputs $channel [appendArgs "==== \"" $fileName "\" START\n"]
            }

            #
            # NOTE: Evaluate the file in the context of the caller,
            #       catching any errors.  If an error is raised and
            #       the stop-on-failure flag is set, assume it was
            #       a test failure and that we need to stop any and
            #       all further processing of test files.
            #
            uplevel 1 [list source $fileName]

            #
            # NOTE: Log that this test file has ended.
            #
            if {![info exists ::no(runEndFile)]} then {
              tputs $channel [appendArgs "==== \"" $fileName "\" END\n"]
            }

            #
            # NOTE: When running in Eagle and not explicitly forbidden
            #       from doing so, check the current memory load -AND-
            #       possibly attempt to forcibly clean things up now.
            #
            if {![info exists ::no(runCleanupMemory)] && [isEagle]} then {
              if {[catch {debug memory} memory] == 0} then {
                set memoryLoad [getDictionaryValue $memory memoryLoad]; # %

                if {[string is integer -strict $memoryLoad] && \
                    $memoryLoad >= 0 && $memoryLoad <= 100} then {
                  if {[info exists ::env(runCleanupMemoryThreshold)]} then {
                    set memoryThreshold $::env(runCleanupMemoryThreshold)
                  } else {
                    set memoryThreshold 75; # TODO: Good default?
                  }

                  if {$memoryLoad > $memoryThreshold} then {
                    tputs $channel [appendArgs \
                        "==== MEMORY: load " $memoryLoad \
                        " is above automatic cleanup threshold " \
                        $memoryThreshold \n]

                    if {[catch {
                      uplevel #0 [list purgeAndCleanup $channel $fileName]
                    } memoryError]} then {
                      tputs $channel [appendArgs \
                          "==== WARNING: \[purgeAndCleanup\] for \"" \
                          $fileName "\" failed: " $memoryError \n]
                    }
                  } else {
                    tputs $channel [appendArgs \
                        "==== MEMORY: load " $memoryLoad \
                        " is below automatic cleanup threshold " \
                        $memoryThreshold \n]
                  }
                } elseif {[string length $memoryLoad] > 0} then {
                  tputs $channel [appendArgs \
                      "==== WARNING: bad memory load value \"" \
                      $memoryLoad \"\n]
                }
              }
            }

            #
            # NOTE: Are we being prevented from waiting after the file?
            #
            if {![info exists ::no(postWait)]} then {
              if {[info exists ::test_wait(post)] && \
                  [string is integer -strict $::test_wait(post)]} then {
                if {![info exists ::no(runMetadata)]} then {
                  tputs $channel [appendArgs \
                      "---- waiting for " $::test_wait(post) \
                      " milliseconds after test file...\n"]
                }

                after $::test_wait(post); # NOTE: Sleep.
              }
            }
          } error]} then {
            #
            # NOTE: Most likely, this error was caused by malformed or
            #       incorrect code in-between the tests themselves.  We
            #       need to report this.
            #
            if {![info exists ::no(runErrorFile)]} then {
              tputs $channel [appendArgs "==== \"" $fileName "\" ERROR \"" \
                  $error \"\n]
            }

            #
            # NOTE: Stop further processing after this loop iteration?
            #
            if {[isStopOnFailure]} then {
              #
              # NOTE: This will terminate the loop right after the test
              #       file cleanup code (i.e. at the bottom of the loop).
              #
              set stop true

              #
              # BUGFIX: If there are no actual test failures recorded yet,
              #         make sure there is one now.  This is necessary to
              #         handle the case where an error occurs in a test
              #         file that does not directly cause at least one of
              #         its contained tests to fail.  Otherwise, the test
              #         suite will still be stopped; however, an overall
              #         result of success will be returned by the process.
              #
              if {[isEagle]} then {
                if {$::eagle_tests(Failed) == 0} then {
                  incr ::eagle_tests(Total)
                  incr ::eagle_tests(Failed)
                }
              } else {
                if {$::tcltest::numTests(Failed) == 0} then {
                  incr ::tcltest::numTests(Total)
                  incr ::tcltest::numTests(Failed)
                }
              }
            } else {
              #
              # NOTE: At this point, we know the test file had an error that
              #       probably caused it to skip a bunch of tests -AND- the
              #       option to stop-testing-on-error is not enabled.  That
              #       being said, we must not simply ignore the error.  The
              #       overall results of the test suite run must now reflect
              #       the failure.  Set a special variable for the epilogue
              #       to pick up on (later).
              #
              lappend ::test_suite_errors [list $fileName $error]
            }
          }

          #
          # NOTE: Record failed test count after this file.
          #
          if {[isEagle]} then {
            set after $::eagle_tests(Failed)
          } else {
            set after $::tcltest::numTests(Failed)
          }

          #
          # NOTE: Did this file have any failing tests?
          #
          if {$after > $before} then {
            lappend failed [file tail $fileName]
          }

          #
          # NOTE: In terms of files, not tests, what percent done are we now?
          #
          set percent [formatDecimal \
              [expr {$total != 0 ? 100.0 * ($count / double($total)) : 0}]]

          if {$percent != $lastPercent} then {
            if {![info exists ::no(runPercent)]} then {
              reportTestPercent $channel $percent \
                  $count $total [llength $failed] [llength $leaked]
            }

            set lastPercent $percent
          }

          #
          # NOTE: Unset the current test file name, it is no longer
          #       needed.
          #
          unset -nocomplain ::test_file

          #
          # NOTE: Is resource leak checking explicitly disabled?
          #
          if {![info exists ::no(leak)]} then {
            #
            # NOTE: Get "after" resource counts for leak tracking.
            #
            recordTestStatistics leaks after

            if {![info exists ::no(runStatistics)]} then {
              #
              # NOTE: Determine if any resource leaks have occurred and
              #       output diagnostics as necessary if they have.
              #
              reportTestStatistics $channel $fileName $stop leaks leaked
            }
          }
        } else {
          #
          # NOTE: This entire file has been skipped.  Record that fact in the
          #       test suite log file.
          #
          if {![info exists ::no(runNonTestFile)]} then {
            tputs $channel [appendArgs \
                "==== \"" $fileName "\" NON_TEST_FILE\n"]
          }
        }

        #
        # NOTE: Another file of some kind was processed.  It may have been
        #       skipped; however, that does not matter.
        #
        incr count

        #
        # NOTE: In terms of files, not tests, what percent done are we now?
        #
        set percent [formatDecimal \
            [expr {$total != 0 ? 100.0 * ($count / double($total)) : 0}]]

        if {$percent != $lastPercent} then {
          if {![info exists ::no(runPercent)]} then {
            reportTestPercent $channel $percent \
                $count $total [llength $failed] [llength $leaked]
          }

          set lastPercent $percent
        }

        #
        # NOTE: If the test file raised an error (i.e. to indicate a
        #       test failure with the stop-on-failure flag enabled),
        #       break out of the test loop now.
        #
        if {$stop} then {
          break
        }
      } else {
        #
        # NOTE: This entire file has been skipped.  Record that fact in the
        #       test suite log file.
        #
        if {![info exists ::no(runSkippedFile)]} then {
          tputs $channel [appendArgs "==== \"" $fileName "\" SKIPPED\n"]
        }

        #
        # NOTE: This file was skipped.
        #
        incr count
      }

      #
      # NOTE: In terms of files, not tests, what percent done are we now?
      #
      set percent [formatDecimal \
          [expr {$total != 0 ? 100.0 * ($count / double($total)) : 0}]]

      if {$percent != $lastPercent} then {
        if {![info exists ::no(runPercent)]} then {
          reportTestPercent $channel $percent \
              $count $total [llength $failed] [llength $leaked]
        }

        set lastPercent $percent
      }
    }

    #
    # NOTE: Reset the host title because we may have changed it in the for
    #       loop (above).
    #
    if {![info exists ::no(runPercent)]} then {
      clearTestPercent $channel
    }

    if {![info exists ::no(runMetadata)]} then {
      tputs $channel [appendArgs "---- sourced " $count " test " \
          [expr {$count > 1 ? "files" : "file"}] \n]

      #
      # NOTE: Show the files that had failing and/or leaking tests.
      #
      if {[llength $failed] > 0} then {
        tputs $channel [appendArgs "---- files with failing tests: " \
            [formatList $failed] \n]
      }

      if {[llength $leaked] > 0} then {
        tputs $channel [appendArgs "---- files with leaking tests: " \
            [formatList $leaked] \n]
      }
    }

    if {![info exists ::no(runStatisticCounts)]} then {
      reportTestStatisticCounts $channel leaks
    }
  }

  proc isTestSuiteRunning {} {
    #
    # NOTE: Return non-zero if the test suite appears to be running.
    #
    return [expr {[info exists ::test_suite_running] && \
        $::test_suite_running}]
  }

  proc getTestChannelOrDefault { {channel stdout} } {; # TODO: Good default?
    if {[info exists ::test_channel]} then {
      return $::test_channel
    }

    return $channel
  }

  proc tryVerifyTestPath {} {
    #
    # NOTE: If the test path variable does not exist, the directory it
    #       points to does not exist (or is not really a directory), or
    #       it appears to be an empty directory, return false; otherwise,
    #       return true.
    #
    if {![info exists ::test_path] || \
        ![file exists $::test_path] || \
        ![file isdirectory $::test_path] || \
        [llength [getFiles $::test_path *]] == 0} then {
      return false
    }

    return true
  }

  proc checkForAndSetTestPath { whatIf {quiet false} } {
    #
    # NOTE: Everything in this procedure requires access to the file system;
    #       therefore, it cannot be used in a stock "safe" interpreter.
    #
    if {![interp issafe] && ![info exists ::test_path]} then {
      #
      # NOTE: Grab the name of the current script file.  If this is an empty
      #       string, many test path checks will have to be skipped.
      #
      set script [info script]

      #
      # NOTE: Eagle and native Tcl have different requirements and possible
      #       locations for the test path; therefore, handle them separately.
      #
      if {[isEagle]} then {
        #
        # NOTE: Grab the base directory and the library directory.  Without
        #       these, several test path checks will be skipped.
        #
        set library [getTestLibraryDirectory]; set base [info base]

        if {[string length $library] > 0} then {
          #
          # NOTE: Try the source release directory structure.  For this
          #       case, the final test path would be:
          #
          #           $library/../../Library/Tests
          #
          set ::test_path [file normalize [file join [file dirname [file \
              dirname $library]] Library Tests]]

          if {!$quiet} then {
            tqputs [getTestChannelOrDefault] [appendArgs \
                "---- checking #1 for Eagle test path at \"" \
                $::test_path \"...\n]
          }
        }

        if {[string length $base] > 0 && \
            ($whatIf || ![tryVerifyTestPath])} then {
          #
          # NOTE: Try the source release directory structure again; this
          #       time, assume only the embedded script library was used.
          #       For this case, the final test path would be:
          #
          #           $base/Library/Tests
          #
          set ::test_path [file normalize [file join $base Library Tests]]

          if {!$quiet} then {
            tqputs [getTestChannelOrDefault] [appendArgs \
                "---- checking #2 for Eagle test path at \"" \
                $::test_path \"...\n]
          }
        }

        if {[string length $script] > 0 && \
            ($whatIf || ![tryVerifyTestPath])} then {
          #
          # NOTE: Try for the test package directory.  For this case, the
          #       final test path would be:
          #
          #           $script/../Test1.0
          #
          set ::test_path [file normalize [file join [file dirname [file \
              dirname $script]] [appendArgs Test [info engine Version]]]]

          if {!$quiet} then {
            tqputs [getTestChannelOrDefault] [appendArgs \
                "---- checking #3 for Eagle test path at \"" \
                $::test_path \"...\n]
          }
        }

        if {[string length $base] > 0 && \
            ($whatIf || ![tryVerifyTestPath])} then {
          #
          # NOTE: Try for the test package directory again; this time, use
          #       the base path and assume the source release directory
          #       structure.  For this case, the final test path would be:
          #
          #           $base/lib/Test1.0
          #
          set ::test_path [file normalize [file join $base lib [appendArgs \
              Test [info engine Version]]]]

          if {!$quiet} then {
            tqputs [getTestChannelOrDefault] [appendArgs \
                "---- checking #4 for Eagle test path at \"" \
                $::test_path \"...\n]
          }
        }

        if {[string length $base] > 0 && \
            ($whatIf || ![tryVerifyTestPath])} then {
          #
          # NOTE: Try for the test package directory again; this time, use
          #       the base path.  For this case, the final test path would
          #       be:
          #
          #           $base/Test1.0
          #
          set ::test_path [file normalize [file join $base [appendArgs \
              Test [info engine Version]]]]

          if {!$quiet} then {
            tqputs [getTestChannelOrDefault] [appendArgs \
                "---- checking #5 for Eagle test path at \"" \
                $::test_path \"...\n]
          }
        }

        if {[string length $library] > 0 && \
            ($whatIf || ![tryVerifyTestPath])} then {
          #
          # NOTE: This must be a binary release, no "Library" directory
          #       then.  Also, binary releases have an upper-case "Tests"
          #       directory name that originates from the "update.bat"
          #       tool.  This must match the casing used in "update.bat".
          #       For this case, the final test path would be:
          #
          #           $library/../../Tests
          #
          set ::test_path [file normalize [file join [file dirname [file \
              dirname $library]] Tests]]

          if {!$quiet} then {
            tqputs [getTestChannelOrDefault] [appendArgs \
                "---- checking #6 for Eagle test path at \"" \
                $::test_path \"...\n]
          }
        }

        if {[string length $base] > 0 && \
            ($whatIf || ![tryVerifyTestPath])} then {
          #
          # NOTE: Fallback to using the base directory and checking for a
          #       "Tests" directory beneath it.  For this case, the final
          #       test path would be:
          #
          #           $base/Tests
          #
          set ::test_path [file normalize [file join $base Tests]]

          if {!$quiet} then {
            tqputs [getTestChannelOrDefault] [appendArgs \
                "---- checking #7 for Eagle test path at \"" \
                $::test_path \"...\n]
          }
        }

        if {!$quiet} then {
          tqputs [getTestChannelOrDefault] [appendArgs \
              "---- final Eagle test path is \"" \
              [expr {[info exists ::test_path] ? \
              $::test_path : "<none>"}] \"\n]
        }
      } else {
        if {[string length $script] > 0} then {
          #
          # NOTE: Try the source release directory structure.  For this
          #       case, the final test path would be:
          #
          #           $script/../../Library/Tests
          #
          set ::test_path [file normalize [file join [file dirname [file \
              dirname [file dirname $script]]] Library Tests]]

          if {!$quiet} then {
            tqputs [getTestChannelOrDefault] [appendArgs \
                "---- checking #1 for Tcl test path at \"" \
                $::test_path \"...\n]
          }
        }

        if {[string length $script] > 0 && \
            ($whatIf || ![tryVerifyTestPath])} then {
          #
          # NOTE: Try for the test package directory.  For this case, the
          #       final test path would be:
          #
          #           $script/../Test1.0
          #
          set ::test_path [file normalize [file join [file dirname [file \
              dirname $script]] Test1.0]]

          if {!$quiet} then {
            tqputs [getTestChannelOrDefault] [appendArgs \
                "---- checking #2 for Tcl test path at \"" \
                $::test_path \"...\n]
          }
        }

        if {[string length $script] > 0 && \
            ($whatIf || ![tryVerifyTestPath])} then {
          #
          # NOTE: This must be a binary release, no "Library" directory
          #       then.  Also, binary releases have an upper-case "Tests"
          #       directory name that originates from the "update.bat"
          #       tool.  This must match the casing used in "update.bat".
          #       For this case, the final test path would be:
          #
          #           $script/../../Tests
          #
          set ::test_path [file normalize [file join [file dirname [file \
              dirname [file dirname $script]]] Tests]]

          if {!$quiet} then {
            tqputs [getTestChannelOrDefault] [appendArgs \
                "---- checking #3 for Tcl test path at \"" \
                $::test_path \"...\n]
          }
        }

        if {!$quiet} then {
          tqputs [getTestChannelOrDefault] [appendArgs \
              "---- final Tcl test path is \"" \
              [expr {[info exists ::test_path] ? \
              $::test_path : "<none>"}] \"\n]
        }
      }
    }
  }

  proc configureTcltest { verbose match skip constraints imports force } {
    #
    # NOTE: Eagle and native Tcl have different configuration requirements
    #       for the "tcltest" package.  For Eagle, the necessary testing
    #       functionality is built-in.  In native Tcl, the package must be
    #       loaded now and that cannot be done in a "safe" interpreter.
    #
    if {[isEagle]} then {
      #
      # HACK: Flag the "test" and "runTest" script library procedures so
      #       that they use the script location of their caller and not
      #       their own.
      #
      # BUGBUG: Even this does not yet fix the script location issues in
      #         the test suite:
      #
      #         debug procedureflags test +ScriptLocation
      #         debug procedureflags runTest +ScriptLocation
      #
      # NOTE: Setup the necessary compatibility shims for the test suite.
      #
      namespace eval ::tcltest {}; # HACK: Force namespace creation now.
      setupTestShims true [expr {![isTestSuiteRunning]}]

      #
      # NOTE: Fake having the package as the functionality is built-in.
      #
      package provide tcltest 2.2.10; # Tcl 8.4
    } elseif {![interp issafe]} then {
      #
      # NOTE: Attempt to detect if the package is already loaded.
      #
      set loaded [expr {[catch {package present tcltest}] == 0}]

      #
      # NOTE: Always attempt to load the package.
      #
      package require tcltest

      #
      # NOTE: Configure it for our use (only when it was not loaded).
      #
      if {!$loaded} then {
        if {[string length $verbose] > 0} then {
          ::tcltest::configure -verbose $verbose
        } else {
          ::tcltest::configure -verbose pbste
        }
      }

      #
      # NOTE: We need to copy the Eagle test names to match over to Tcl.
      #
      if {[llength $match] > 0} then {
        ::tcltest::configure -match $match
      }

      #
      # NOTE: We need to copy the Eagle test names to skip over to Tcl.
      #
      if {[llength $skip] > 0} then {
        ::tcltest::configure -skip $skip
      }

      #
      # NOTE: We need to copy the Eagle test constraints over to Tcl.
      #
      if {[llength $constraints] > 0} then {
        ::tcltest::configure -constraints $constraints
      }

      #
      # NOTE: For the benefit of the Eagle test suite, always add the
      #       pseudo-constraints "fail.false" and "fail.true".
      #
      ::tcltest::testConstraint fail.false 1
      ::tcltest::testConstraint fail.true 1

      #
      # NOTE: We need the [test] command in the global namespace.
      #
      if {[llength $imports] > 0} then {
        set command [list namespace import]

        if {$force} then {
          lappend command -force
        }

        foreach import $imports {
          lappend command [appendArgs ::tcltest:: $import]
        }

        namespace eval :: $command
      }
    }
  }

  proc machineToPlatform { machine {architecture false} } {
    #
    # NOTE: Cannot use "-nocase" option here because Tcl 8.4 does not
    #       support it (i.e. because it is pre-TIP #241).
    #
    switch -exact -- [string tolower $machine] {
      intel {
        if {!$architecture && [isWindows]} then {
          return Win32
        } else {
          return x86
        }
      }
      arm {
        return arm
      }
      ia64 {
        return itanium
      }
      msil {
        return clr
      }
      amd64 {
        return x64
      }
      ia32_on_win64 {
        return wow64
      }
      arm64 {
        return arm64
      }
      default {
        return unknown
      }
    }
  }

  proc architectureForPlatform { platform } {
    #
    # NOTE: Cannot use "-nocase" option here because Tcl 8.4 does not
    #       support it (i.e. because it is pre-TIP #241).
    #
    switch -exact -- [string tolower $platform] {
      intel -
      win32 -
      x86 {
        return x86
      }
      arm {
        return arm
      }
      ia64 -
      itanium {
        return ia64
      }
      msil -
      clr {
        return msil
      }
      amd64 -
      x64 {
        return x64
      }
      ia32_on_win64 -
      wow64 {
        return ia32_on_win64
      }
      arm64 {
        return arm64
      }
      default {
        return unknown
      }
    }
  }

  proc calculateTestConstraintCounts {
          skippedNames maximumVarName countsVarName } {
    #
    # NOTE: Process the list of skipped tests, which is really a dictionary
    #       of test names to the list of constraints that caused them to be
    #       skipped.  We need to "roll them up", on a per-constraint basis,
    #       and produce counts for each constraint.  At the same time, we
    #       need to keep track of the maximum count seen, to help align the
    #       final output.
    #
    upvar 1 $maximumVarName maximum
    upvar 1 $countsVarName counts

    if {[isEagle]} then {
      foreach {testName constraintNames} $skippedNames {
        foreach constraintName $constraintNames {
          if {[info exists counts($constraintName)]} then {
            incr counts($constraintName)
          } else {
            set counts($constraintName) 1
          }

          if {![info exists maximum] || \
              $counts($constraintName) > $maximum} then {
            set maximum $counts($constraintName)
          }
        }
      }
    } else {
      foreach {constraintName constraintCount} $skippedNames {
        if {[info exists counts($constraintName)]} then {
          incr counts($constraintName) $constraintCount
        } else {
          set counts($constraintName) $constraintCount
        }

        if {![info exists maximum] || \
            $counts($constraintName) > $maximum} then {
          set maximum $counts($constraintName)
        }
      }
    }
  }

  proc logRemoteMessage {
          message {uri ""} {apiKey ""} {password ""} {channel stdout}
          {quiet false} } {
    #
    # NOTE: This procedure attempts to (securely) send the specified
    #       log message to the specified logging endpoint.
    #
    if {[string length $uri] == 0} then {
      if {[isEagle]} then {
        set uri [appendArgs [getAuxiliaryBaseUri] /log]
      } elseif {[info exists ::env(AuxiliaryBaseUri)]} then {
        set uri [appendArgs $::env(AuxiliaryBaseUri) /log]
      } else {
        #
        # HACK: This URI is hard-coded for native Tcl.
        #
        set uri [appendArgs https://urn.to/r/log]
      }
    }

    if {[string length $apiKey] == 0} then {
      if {[info exists ::env(logRemoteMessageApiKey)]} then {
        set apiKey $::env(logRemoteMessageApiKey)
      } else {
        set apiKey 0000000000000000000000000000000000000000; # Fake.
      }
    }

    if {[string length $password] == 0} then {
      if {[info exists ::env(logRemoteMessagePassword)]} then {
        set password $::env(logRemoteMessagePassword)
      } else {
        set password {nopenotarealpassword}; # Fake.
      }
    }

    set message [encoding convertto utf-8 $message]

    if {[isEagle]} then {
      set base64 [base64 encode $message]

      set hash [string tolower \
          [hash keyed hmacsha1 $message $password]]
    } else {
      package require base64
      package require sha1

      set base64 [::base64::encode $message]
      set hash [::sha1::hmac -hex -key $password $message]
    }

    set query [list \
        raw 1 apiKey $apiKey message $base64 hash $hash]

    if {[isEagle]} then {
      return [string trim \
          [uri upload -inline -data $query $uri]]
    } else {
      package require http 2.0
      package require Eagle.Tools.Common

      namespace import -force \
          ::Eagle::Tools::Common::getFileViaHttp

      return [getFileViaHttp \
          $uri 20 $channel $quiet -binary true \
          -query [eval ::http::formatQuery $query]]
    }
  }

  proc logRemoteTestResults { success {verbose false} {quiet false} } {
    set id [getTestRunId]
    if {[string length $id] == 0} then {set id <noId>}

    set bucket [getTestRunBucket]
    if {[string length $bucket] == 0} then {set bucket <noBucket>}

    set log [getTestLog]
    if {[string length $log] == 0} then {set log <noLog>}

    set url [getValueOrDefault ::test_repository_url <noUrl>]
    set checkout [getValueOrDefault ::test_repository_checkout <noCheckout>]

    set tags [getValueOrDefault ::test_repository_tags <noTags>]
    set tags [string map [list "  " " "] [string map [list , " "] $tags]]

    set header [appendArgs \
        [expr {$success ? "SUCCESS" : "FAILURE"}] \
        " TEST-RUN " $id " bucket " $bucket ": " [getTestSuiteFullName] \
        ", url " $url ", checkout " $checkout ", tags " $tags ", log " \
        $log ", " [getTestSuiteVariantName]]

    set argv [getValueOrDefault ::argv [list]]

    if {[llength $argv] > 0} then {
      append header ", argv " [list $argv]
    }

    if {[isEagle]} then {
      set cmdLine [info cmdline]

      if {[string length $cmdLine] > 0} then {
        append header ", command line " [list $cmdLine]
      }
    }

    set detail ""

    if {[isEagle]} then {
      foreach name [list Passed Failed Skipped Disabled Total] {
        if {[info exists ::eagle_tests($name)]} then {
          set value $::eagle_tests($name)

          if {$verbose || $value != 0} then {
            append detail ", " [string tolower $name] " " \
                $value
          }
        }
      }

      if {[info exists ::eagle_tests(FailedNames)]} then {
        set value $::eagle_tests(FailedNames)

        if {$verbose || [llength $value] > 0} then {
          if {[llength $value] == 0} then {set value <none>}
          append detail ", failedNames " $value
        }
      }

      if {[info exists ::eagle_tests(SkippedNames)]} then {
        calculateTestConstraintCounts \
            $::eagle_tests(SkippedNames) maximum counts

        set value [testArrayGet counts]

        if {$verbose || [llength $value] > 0} then {
          if {[llength $value] == 0} then {set value <none>}
          append detail ", skippedConstraints " $value
        }
      }

      if {[info exists ::test_timestamp(elapsedMicroseconds)]} then {
        set value $::test_timestamp(elapsedMicroseconds)

        if {[string is double -strict $value]} then {
          append detail ", duration " [formatDecimal $value] \
              " microseconds"
        }
      }
    } else {
      foreach name [list Passed Failed Skipped Total] {
        if {[info exists ::tcltest::numTests($name)]} then {
          set value $::tcltest::numTests($name)

          if {$verbose || $value != 0} then {
            append detail ", " [string tolower $name] " " \
                $value
          }
        }
      }

      if {[array exists ::tcltest::skippedBecause]} then {
        calculateTestConstraintCounts \
            [array get ::tcltest::skippedBecause] maximum counts

        set value [testArrayGet counts]

        if {$verbose || [llength $value] > 0} then {
          if {[llength $value] == 0} then {set value <none>}
          append detail ", skippedConstraints " $value
        }
      }

      if {[info exists ::tcltest::failFiles]} then {
        set value $::tcltest::failFiles

        if {$verbose || [llength $value] > 0} then {
          if {[llength $value] == 0} then {set value <none>}
          append detail ", failFiles " $value
        }
      }
    }

    if {[catch {
      set message [appendArgs $header $detail]

      if {!$quiet} then {
        tputs $::test_channel [appendArgs \
            "---- test results: " $message \n]
      }

      logRemoteMessage $message
    } result] == 0} then {
      if {!$quiet} then {
        tputs $::test_channel [appendArgs \
            "---- success logging remote test results: " \
            $result \n]
      }
    } else {
      if {!$quiet} then {
        tputs $::test_channel [appendArgs \
            "---- failure logging remote test results: " \
            $result \n]
      }
    }

    return $result
  }

  if {[isEagle]} then {
    ###########################################################################
    ############################ BEGIN Eagle ONLY #############################
    ###########################################################################

    proc initializeTests {} {
      uplevel #0 {
        #
        # NOTE: Reset the information in the global "tests" array, which is
        #       used to interface with the internal test tracking information
        #       in the interpreter via a variable trace.
        #
        set eagle_tests(Total) 0

        set eagle_tests(Skipped) 0
        set eagle_tests(Disabled) 0
        set eagle_tests(Passed) 0
        set eagle_tests(Failed) 0

        #
        # HACK: These are only present in beta 47 or later; therefore, wrap
        #       them in a [catch] block.
        #
        catch {
          set eagle_tests(SkippedBug) 0
          set eagle_tests(DisabledBug) 0
          set eagle_tests(PassedBug) 0
          set eagle_tests(FailedBug) 0
        }

        #
        # NOTE: Setup the lists of patterns to match test names against.  In
        #       Eagle, these originate from the command line arguments and are
        #       passed to the interpreter via this virtual array.
        #
        if {[info exists test_flags(-match)]} then {
          set eagle_tests(MatchNames) $test_flags(-match); # run these tests.
        } else {
          set eagle_tests(MatchNames) [list *]; # default to running all tests.
        }

        if {[info exists test_flags(-skip)]} then {
          set eagle_tests(SkipNames) $test_flags(-skip); # skip these tests.
        } else {
          set eagle_tests(SkipNames) [list]; # default to skipping no tests.
        }

        #
        # NOTE: What tests have been skipped, if any?
        #
        set eagle_tests(SkippedNames) [list]

        #
        # NOTE: What tests have failed, if any?
        #
        set eagle_tests(FailedNames) [list]

        #
        # NOTE: Initialize the list of active test constraints from the
        #       environment variable and/or the test flags.
        #
        set eagle_tests(Constraints) [getEnvironmentVariable testConstraints]

        if {[info exists test_flags(-constraints)]} then {
          eval lappend eagle_tests(Constraints) $test_flags(-constraints)
        }

        unset -nocomplain test_verbose
        set test_verbose [getEnvironmentVariable testVerbose]

        if {[string length $test_verbose] == 0} then {
          set test_verbose Default
        }

        if {[info exists test_flags(-verbose)] && \
            [string length $test_flags(-verbose)] > 0} then {
          #
          # NOTE: Map all test verbosity flags we support for script usage
          #       to their abbreviated names (which are all one letter) and
          #       then split them into a list.
          #
          set test_verbose [split [string map [list \
              Body B Pass P Skip S Start T Error E Line L \
              Fail F Reason R Time I Exit X StdOut O StdErr D] \
              $test_flags(-verbose)] ""]
        }

        set eagle_tests(Verbose) $test_verbose; unset test_verbose
      }
    }

    proc setupTestShims { setup {quiet false} } {
      if {$setup} then {
        #
        # HACK: Compatibility shim(s) for use with various tests in the Tcl
        #       test suite.  Make sure these commands do not already exist
        #       prior to attempt to adding them.
        #
        if {[llength [info commands testConstraint]] == 0} then {
          interp alias {} testConstraint {} haveOrAddConstraint

          if {!$quiet} then {
            tqputs [getTestChannelOrDefault] \
                "---- added \"testConstraint\" alias\n"
          }
        }

        if {[llength [info commands ::tcltest::testConstraint]] == 0} then {
          interp alias {} ::tcltest::testConstraint {} haveOrAddConstraint

          if {!$quiet} then {
            tqputs [getTestChannelOrDefault] \
                "---- added \"::tcltest::testConstraint\" alias\n"
          }
        }

        #
        # NOTE: This is needed by most tests in the Tcl test suite.  Make
        #       sure this command does not already exist prior to adding it.
        #
        if {[llength [info commands ::tcltest::cleanupTests]] == 0} then {
          proc ::tcltest::cleanupTests { args } {}

          if {!$quiet} then {
            tqputs [getTestChannelOrDefault] \
                "---- added \"::tcltest::cleanupTests\" procedure\n"
          }
        }

        #
        # NOTE: This is needed by some tests in the Tcl test suite.  Make
        #       sure this command does not already exist prior to adding it.
        #
        if {[llength [info commands \
            ::tcltest::loadTestedCommands]] == 0} then {
          proc ::tcltest::loadTestedCommands { args } {}

          if {!$quiet} then {
            tqputs [getTestChannelOrDefault] \
                "---- added \"::tcltest::loadTestedCommands\" procedure\n"
          }
        }
      } else {
        #
        # NOTE: Remove the compatibility shim command aliases that we setup
        #       earlier.
        #
        if {[llength [info commands \
            ::tcltest::loadTestedCommands]] > 0} then {
          rename ::tcltest::loadTestedCommands ""

          if {!$quiet} then {
            tqputs $::test_channel \
                "---- removed \"::tcltest::loadTestedCommands\" procedure\n"
          }
        }

        if {[llength [info commands ::tcltest::cleanupTests]] > 0} then {
          rename ::tcltest::cleanupTests ""

          if {!$quiet} then {
            tqputs $::test_channel \
                "---- removed \"::tcltest::cleanupTests\" procedure\n"
          }
        }

        if {[llength [interp aliases ::tcltest::testConstraint]] > 0} then {
          interp alias {} ::tcltest::testConstraint {} {}

          if {!$quiet} then {
            tqputs $::test_channel \
                "---- removed \"::tcltest::testConstraint\" alias\n"
          }
        }

        if {[llength [interp aliases testConstraint]] > 0} then {
          interp alias {} testConstraint {} {}

          if {!$quiet} then {
            tqputs $::test_channel \
                "---- removed \"testConstraint\" alias\n"
          }
        }
      }
    }

    proc shouldWriteTestData { code } {
      if {[llength [info commands object]] > 0 && [catch {
        object invoke -flags +NonPublic \
            Eagle._Components.Private.TestOps ShouldWriteTestData "" $code
      } writeTestData] == 0 && $writeTestData} then {
        return false
      }

      return true
    }

    proc probeForScriptFileName { {excludePatterns ""} {overridePatterns ""} } {
      if {[llength [info commands object]] > 0 && [catch {
        set locations [object invoke -alias -flags +NonPublic \
            Interpreter.GetActive ScriptLocations]

        set count [$locations Count]

        for {set index 0} {$index < $count} {incr index} {
          set location [$locations -alias Peek $index]

          if {[isNonNullObjectHandle $location]} then {
            set locationFileName [file normalize [$location FileName]]

            if {[string length $locationFileName] > 0} then {
              if {[llength $overridePatterns] > 0 && \
                  [lsearch -inverse -glob -- \
                      $overridePatterns $locationFileName] != -1} then {
                return $locationFileName
              }

              if {[llength $excludePatterns] == 0 || \
                  [lsearch -inverse -glob -- \
                      $excludePatterns $locationFileName] == -1} then {
                return $locationFileName
              }
            }
          }
        }

        return ""
      } result] in [list 0 2]} then {
        return $result
      }

      return ""
    }

    proc getPidFromTestLogFileName { fileName baseFileNameOnly } {
      set pattern [appendArgs \
          {[/\\]} [string map [list . \\. * (?:.*?)?] \
          $baseFileNameOnly] {\.test\.(\d+)\.log$}]

      if {[regexp -skip 1 -- $pattern $fileName pid] && \
          [string is integer -strict $pid]} then {
        return $pid
      } else {
        return ""
      }
    }

    proc isActiveProcess { pid } {
      if {[catch {
        object invoke -alias \
            System.Diagnostics.Process GetProcessById $pid
      } process]} then {
        return false
      }

      if {[catch {
        $process Refresh; $process HasExited
      } exited] || [string is true -strict $exited]} then {
        return false
      }

      return true
    }

    #
    # WARNING: This procedure is ONLY intended to be used via the
    #          "clean.bat" batch tool.
    #
    proc checkActiveTestLogFile { baseFileNameOnly fileName } {
      set pid [getPidFromTestLogFileName $fileName $baseFileNameOnly]

      if {[string length $pid] > 0 && ![isActiveProcess $pid]} then {
        puts stdout 1; # NOTE: Output needed by "clean.bat"
      }
    }

    proc deleteInactiveTestLogFiles { baseDirectory baseFileNameOnly } {
      set result [list]

      foreach fileName [lsort -decreasing [findFilesRecursive [file join \
          $baseDirectory [appendArgs $baseFileNameOnly .test.*.log]]]] {
        set pid [getPidFromTestLogFileName $fileName $baseFileNameOnly]

        if {[string length $pid] > 0 && ![isActiveProcess $pid]} then {
          if {[catch {file delete $fileName} error] == 0} then {
            lappend result $fileName; # deleted
            set directory [file dirname $fileName]

            if {![file same $directory $baseDirectory] && [regexp -- \
                {^\d{4}-\d{2}-\d{2}$} [file tail $directory]] && [catch {
              file rmdir $directory
            }] == 0} then {
              lappend result $directory; # removed
            }
          } elseif {[info exists ::test_channel]} then {
            #
            # TODO: Is this actually valid to use here?
            #
            tputs $::test_channel [appendArgs \
                "---- inactive test log cleanup error: " $error \n]
          }
        }
      }

      set directory [file normalize [file join $baseDirectory logs]]

      if {[file isdirectory $directory] && [catch {
        file rmdir $directory
      }] == 0} then {
        lappend result $directory; # removed
      }

      return $result
    }

    proc isNetFx40 {} {
      if {![info exists ::eagle_platform(frameworkVersion)]} then {
        return false
      }

      set haveVersion $::eagle_platform(frameworkVersion)
      set wantVersion 4.0.30319.42000; # .NET Framework 4.0 RTM

      if {[package vcompare $haveVersion $wantVersion] >= 0} then {
        return true
      } else {
        return false
      }
    }

    proc createMultipartFormData {
            request {fileName ""} {boundaryVarName ""} } {
      #
      # FIXME: This needs to create textual data that conforms to the
      #        content type "multipart/form-data", per RFC 2388.
      #
      if {[string length $boundaryVarName] > 0} then {
        upvar 1 $boundaryVarName boundary
      }

      set boundary [string map \
          [list + "" / "" = ""] [base64 encode [expr {randstr(50)}]]]

      set result ""

      foreach {name value} $request {
        append result -- $boundary \r\n
        append result "Content-Disposition: form-data; name=\""
        append result $name \"\r\n\r\n
        append result $value \r\n
      }

      if {[string length $fileName] > 0} then {
        append result -- $boundary \r\n

        append result \
            "Content-Disposition: form-data; name=\"file\"; filename=\""

        append result [file tail $fileName] \"\r\n
        append result "Content-Type: application/octet-stream\r\n"
        # append result "Content-Transfer-Encoding: binary\r\n"
        append result \r\n
        append result [readFile $fileName] \r\n
      }

      if {[string length $result] > 0} then {
        append result -- $boundary --\r\n
      }

      return [object create \
          -alias -objectflags +NoReturnReference String $result]
    }

    proc recursiveGetDirectories { path pattern } {
      #
      # HACK: Use brute-force search of all files beneath the specified
      #       directory in order to locate the test data files we need.
      #
      if {[isDotNetCore]} then {
        #
        # HACK: Why does .NET Core require assembly qualified type name
        #       usage here?
        #
        return [object invoke \
            "System.IO.Directory, netstandard" GetDirectories $path \
            $pattern AllDirectories]
      } else {
        return [object invoke \
            System.IO.Directory GetDirectories $path $pattern \
            AllDirectories]
      }
    }

    proc recursiveGetFiles { path pattern } {
      #
      # HACK: Use brute-force search of all files beneath the specified
      #       directory in order to locate the test data files we need.
      #
      if {[isDotNetCore]} then {
        #
        # HACK: Why does .NET Core require assembly qualified type name
        #       usage here?
        #
        return [object invoke \
            "System.IO.Directory, netstandard" GetFiles $path $pattern \
            AllDirectories]
      } else {
        return [object invoke \
            System.IO.Directory GetFiles $path $pattern AllDirectories]
      }
    }

    proc tresult { code result } {
      host result $code $result; tlog $result
    }

    proc getPassedPercentage {} {
      if {$::eagle_tests(Total) > 0} then {
        return [expr \
            {100.0 * (($::eagle_tests(Passed) + \
            $::eagle_tests(Skipped)) / \
            double($::eagle_tests(Total)))}]
      }

      return 0; # no tests were run, etc.
    }

    proc getSkippedPercentage {} {
      if {$::eagle_tests(Total) > 0} then {
        return [expr \
            {100.0 * ($::eagle_tests(Skipped) / \
            double($::eagle_tests(Total)))}]
      }

      return 0; # no tests were run, etc.
    }

    proc getDisabledPercentage {} {
      if {$::eagle_tests(Total) > 0} then {
        return [expr \
            {100.0 * ($::eagle_tests(Disabled) / \
            double($::eagle_tests(Total)))}]
      }

      return 0; # no tests were run, etc.
    }

    proc testCheckOverallResult {
            channel percent haveStartSentry {varName ""} {quiet false} } {
      #
      # NOTE: Does the caller want to change the exit code to an appropriate
      #       value based on the overall test results?
      #
      if {[string length $varName] > 0} then {upvar 1 $varName exitCode}

      #
      # NOTE: Has the test pass threshold been set?  If so, is it set to the
      #       default value?
      #
      # HACK: If the test suite error message exists, the entire run will be
      #       considered a "failure", without regard for the pass percentage
      #       or the configured test pass threshold.
      #
      if {![info exists ::test_threshold] || $::test_threshold == 100} then {
        #
        # HACK: Check for the required elements of the global Eagle tests
        #       array.
        #
        if {[info exists ::eagle_tests(Passed)] && \
            [info exists ::eagle_tests(Skipped)] && \
            [info exists ::eagle_tests(Disabled)] && \
            [info exists ::eagle_tests(Total)]} then {
          #
          # NOTE: The test pass threshold is set to the default value (100%).
          #       Check to make sure that all tests passed and then set the
          #       exit code to success; otherwise, we set it to failure.
          #
          set passedSkippedOrDisabled [expr {
              $::eagle_tests(Passed) + $::eagle_tests(Skipped) + \
              $::eagle_tests(Disabled)
          }]

          if {![info exists ::test_suite_errors] && \
              ([info exists ::no(failLogStartSentry)] || \
                  $haveStartSentry) && \
              $passedSkippedOrDisabled == $::eagle_tests(Total)} then {
            set exitCode Success

            if {!$quiet} then {
              tresult Ok [appendArgs \
                  "OVERALL RESULT: " [getTestSuiteFullName] \n]

              if {$::eagle_tests(Total) > 0} then {
                tresult Ok "OVERALL RESULT: SUCCESS\n"
              } else {
                tresult Ok "OVERALL RESULT: NONE\n"
              }
            }

            return true
          } else {
            set exitCode Failure

            if {!$quiet} then {
              tresult Error [appendArgs \
                  "OVERALL RESULT: " [getTestSuiteFullName] \n]

              if {[info exists ::test_suite_errors]} then {
                tresult Error [appendArgs "OVERALL ERRORS: " \
                    [expr {[llength $::test_suite_errors] > 0 ? \
                    $::test_suite_errors : "<empty>"}] \n]
              }

              tresult Error "OVERALL RESULT: FAILURE\n"
            }

            return false
          }
        } else {
          set exitCode Failure

          if {!$quiet} then {
            tresult Error [appendArgs \
                "OVERALL RESULT: " [getTestSuiteFullName] \n]

            if {[info exists ::test_suite_errors]} then {
              tresult Error [appendArgs "OVERALL ERRORS: " \
                  [expr {[llength $::test_suite_errors] > 0 ? \
                  $::test_suite_errors : "<empty>"}] \n]
            }

            tresult Error "OVERALL RESULT: MISSING test counts (1)\n"
            tresult Error "OVERALL RESULT: FAILURE\n"
          }

          return false
        }
      } else {
        #
        # NOTE: They specified a non-default test pass threshold.  Check to
        #       make sure that we meet or exceed the requirement and then
        #       set the exit code to success; otherwise, set it to failure.
        #
        if {![info exists ::test_suite_errors] && \
            ([info exists ::no(failLogStartSentry)] || \
                $haveStartSentry) && \
            $percent >= $::test_threshold} then {
          #
          # HACK: Check for the required elements of the global Eagle tests
          #       array.
          #
          if {[info exists ::eagle_tests(Total)]} then {
            set exitCode Success

            if {!$quiet} then {
              tresult Ok [appendArgs \
                  "OVERALL RESULT: " [getTestSuiteFullName] \n]

              if {$::eagle_tests(Total) > 0} then {
                tresult Ok [appendArgs \
                    "OVERALL RESULT: SUCCESS (" \
                    $percent "% >= " $::test_threshold %)\n]
              } else {
                tresult Ok [appendArgs \
                    "OVERALL RESULT: NONE (" \
                    $percent "% >= " $::test_threshold %)\n]
              }
            }

            return true
          } else {
            set exitCode Failure

            if {!$quiet} then {
              tresult Error [appendArgs \
                  "OVERALL RESULT: " [getTestSuiteFullName] \n]

              if {[info exists ::test_suite_errors]} then {
                tresult Error [appendArgs "OVERALL ERRORS: " \
                    [expr {[llength $::test_suite_errors] > 0 ? \
                    $::test_suite_errors : "<empty>"}] \n]
              }

              tresult Error "OVERALL RESULT: MISSING test counts (2)\n"
              tresult Error "OVERALL RESULT: FAILURE\n"
            }

            return false
          }
        } else {
          set exitCode Failure

          if {!$quiet} then {
            tresult Error [appendArgs \
                "OVERALL RESULT: " [getTestSuiteFullName] \n]

            if {[info exists ::test_suite_errors]} then {
              tresult Error [appendArgs "OVERALL ERRORS: " \
                  [expr {[llength $::test_suite_errors] > 0 ? \
                  $::test_suite_errors : "<empty>"}] \n]
            }

            tresult Error [appendArgs \
                "OVERALL RESULT: FAILURE (" \
                $percent "% < " $::test_threshold %)\n]
          }

          return false
        }
      }
    }

    proc reportTestResultCounts { channel {varName ""} } {
      #
      # NOTE: Does the caller want to change the percent to an appropriate
      #       value based on the overall test results?
      #
      if {[string length $varName] > 0} then {
        upvar 1 $varName percent
      }

      #
      # NOTE: Check if this build (i.e. of Eagle) has support for tracking
      #       statistics of tests that contain the "knownBug" constraint.
      #
      set trackBugs false

      if {[info exists ::eagle_tests(KnownBugs)]} then {
        set trackBugs true

        if {[llength $::eagle_tests(KnownBugs)] > 0} then {
          tresult Continue [appendArgs \
              "KNOWN BUGS: " $::eagle_tests(KnownBugs) \n]
        }
      }

      if {$::eagle_tests(Passed) > 0} then {
        tresult Ok [appendArgs \
            "PASSED: " $::eagle_tests(Passed) \n]
      }

      if {$trackBugs && $::eagle_tests(PassedBug) > 0} then {
        tresult Ok [appendArgs \
            "PASSED (BUG): " $::eagle_tests(PassedBug) \n]
      }

      if {$::eagle_tests(Failed) > 0} then {
        tresult Error [appendArgs \
            "FAILED: " $::eagle_tests(Failed) \n]

        if {[llength $::eagle_tests(FailedNames)] > 0} then {
          tresult Error [appendArgs \
              "FAILED: " $::eagle_tests(FailedNames) \n]
        }
      }

      if {$trackBugs && $::eagle_tests(FailedBug) > 0} then {
        tresult Error [appendArgs \
            "FAILED (BUG): " $::eagle_tests(FailedBug) \n]
      }

      if {$::eagle_tests(Skipped) > 0} then {
        tresult Break [appendArgs \
            "SKIPPED: " $::eagle_tests(Skipped) \n]

        if {[llength $::eagle_tests(SkippedNames)] > 0} then {
          tresult Break [appendArgs \
              "SKIPPED: " $::eagle_tests(SkippedNames) \n]
        }
      }

      if {$trackBugs && $::eagle_tests(SkippedBug) > 0} then {
        tresult Break [appendArgs \
            "SKIPPED (BUG): " $::eagle_tests(SkippedBug) \n]
      }

      if {$::eagle_tests(Disabled) > 0} then {
        tresult WhatIf [appendArgs \
            "DISABLED: " $::eagle_tests(Disabled) \n]
      }

      if {$trackBugs && $::eagle_tests(DisabledBug) > 0} then {
        tresult WhatIf [appendArgs \
            "DISABLED (BUG): " $::eagle_tests(DisabledBug) \n]
      }

      if {$::eagle_tests(Total) > 0} then {
        tresult Return [appendArgs \
            "TOTAL: " $::eagle_tests(Total) \n]

        if {$::eagle_tests(Skipped) > 0} then {
          set percent [getSkippedPercentage]

          tresult Break [appendArgs \
              "SKIP PERCENTAGE: " [formatDecimal $percent] %\n]
        }

        if {$::eagle_tests(Disabled) > 0} then {
          set percent [getDisabledPercentage]

          tresult WhatIf [appendArgs \
              "DISABLED PERCENTAGE: " [formatDecimal $percent] %\n]
        }

        set percent [getPassedPercentage]

        tresult Return [appendArgs \
            "PASS PERCENTAGE: " [formatDecimal $percent] %\n]
      } else {
        #
        # NOTE: No tests.
        #
        set percent 0
      }

      unset trackBugs
      return ""
    }

    proc testObjectMembers { args } {
      if {[llength $args] == 0} then {
        error [appendArgs \
            "wrong # args: should be \"" \
            [lindex [info level [info level]] 0] \
            " ?options? object\""]
      }

      set command [list object members]
      eval lappend command $args

      return [lsort [uplevel 1 $command]]
    }

    proc getThreadTimeout { timeout type } {
      #
      # NOTE: Is the specified timeout value an integer?  If this ends
      #       up being a negative value, the caller may wait "forever"
      #       and that is fine for our purposes.
      #
      if {[string is integer -strict $timeout]} then {
        #
        # NOTE: Use the specified (integer) timeout value verbatim.
        #
        return $timeout
      }

      #
      # NOTE: Is the caller specifically wanting an infinite timeout?
      #
      if {[string tolower $timeout] in [list infinite]} then {
        return [object invoke Eagle._Constants._Timeout Infinite]; # <0
      }

      #
      # NOTE: Otherwise, check for various special values that are not
      #       integers.
      #
      if {[string tolower $timeout] in [list "" effective]} then {
        #
        # NOTE: Get effective timeout for the current interpreter
        #       and the timeout type.
        #
        set timeout null; set interpreter ""
      } elseif {[string tolower $timeout] in [list default]} then {
        #
        # NOTE: Get default timeout for the timeout type (i.e. no
        #       interpreter context).
        #
        set timeout null; set interpreter null
      } else {
        #
        # NOTE: No other values, including an empty string, are valid.
        #
        error "invalid thread timeout value"
      }

      return [object invoke -flags +NonPublic \
          Eagle._Components.Private.ThreadOps GetTimeout $interpreter \
          $timeout [appendArgs $type " +Infinite"]]
    }

    proc createThread { script {parameterized false} {maxStackSize ""} } {
      if {![info exists ::no(createEngineThread)] && \
          [llength [info commands hasRuntimeOption]] > 0 && \
          [hasRuntimeOption createEngineThread]} then {
        if {[string length $maxStackSize] == 0} then {
          set maxStackSize 0; # NOTE: Use engine default.
        }

        if {$parameterized} then {
          return [object invoke -alias \
              -objectflags +NoReturnReference -parametertypes \
              [list Eagle._Components.Public.Interpreter \
              System.Threading.ParameterizedThreadStart System.Int32 \
              System.Boolean System.Boolean System.Boolean] Engine \
              CreateThread "" $script $maxStackSize true false true]
        } else {
          return [object invoke -alias \
              -objectflags +NoReturnReference -parametertypes \
              [list Eagle._Components.Public.Interpreter \
              System.Threading.ThreadStart System.Int32 \
              System.Boolean System.Boolean System.Boolean] Engine \
              CreateThread "" $script $maxStackSize true false true]
        }
      } else {
        if {[isDotNetCore]} then {
          #
          # HACK: This seems to make .NET Core happier for reasons
          #       that are not entirely clear.
          #
          set typeName "System.Threading.Thread, mscorlib"
        } else {
          set typeName System.Threading.Thread
        }

        if {$parameterized} then {
          if {[string length $maxStackSize] > 0} then {
            return [object create -alias \
                -objectflags +NoReturnReference -parametertypes \
                [list System.Threading.ParameterizedThreadStart \
                System.Int32] $typeName $script $maxStackSize]
          } else {
            return [object create -alias \
                -objectflags +NoReturnReference -parametertypes \
                [list System.Threading.ParameterizedThreadStart] \
                $typeName $script]
          }
        } else {
          if {[string length $maxStackSize] > 0} then {
            return [object create -alias \
                -objectflags +NoReturnReference -parametertypes \
                [list System.Threading.ThreadStart System.Int32] \
                $typeName $script $maxStackSize]
          } else {
            return [object create -alias \
                -objectflags +NoReturnReference -parametertypes \
                [list System.Threading.ThreadStart] $typeName \
                $script]
          }
        }
      }
    }

    proc startThread { thread {parameterized false} {parameter null} } {
      if {$parameterized} then {
        $thread Start $parameter
      } else {
        $thread Start
      }
    }

    proc syncThread { thread {timeout ""} {state WaitSleepJoin} } {
      set timeout [getThreadTimeout $timeout Start]
      set start [clock milliseconds]

      while {1} {
        set now [clock milliseconds]
        set diff [expr {$now - $start}]

        if {[$thread ThreadState] eq $state} then {
          tputs $::test_channel [appendArgs \
              "---- sleep success after " $diff " milliseconds\n"]

          break
        }

        if {$timeout >= 0 && $diff > $timeout} then {
          tputs $::test_channel [appendArgs \
              "---- sleep timeout after " $diff " milliseconds\n"]

          break
        }
      }
    }

    proc joinThread { thread {timeout ""} } {
      if {[string length $timeout] > 0} then {
        return [$thread -parametertypes [list Int32] Join \
            [getThreadTimeout $timeout Join]]
      } elseif {[info exists ::test_join_timeout] && \
          [string length $::test_join_timeout] > 0} then {
        return [$thread -parametertypes [list Int32] Join \
            [getThreadTimeout $::test_join_timeout Join]]
      } else {
        $thread Join; return true
      }
    }

    proc cleanupThread { thread {timeout ""} } {
      #
      # NOTE: First, translate the specified timeout value, if any, into an
      #       integer value we can actually use.  Since this timeout value
      #       is used with the Thread.Join method, that is what is used for
      #       the timeout type here.  An argument could be made for using a
      #       timeout type of Interrupt or Dispose instead.
      #
      set timeout [getThreadTimeout $timeout Join]

      #
      # HACK: When running on .NET Core, it seems that using the Interrupt
      #       method can result in a held lock being lost, even when using
      #       a lock statement, which should have try / finally semantics.
      #       Therefore, in that case, attempt to wait on the thread prior
      #       to attempting to use the Interrupt method.
      #
      if {[isDotNetCore]} then {
        if {[$thread IsAlive]} then {
          if {[catch {
            $thread -parametertypes [list Int32] Join $timeout
          } error]} then {
            tputs $::test_channel [appendArgs \
                "---- failed to pre-join test thread \"" $thread "\": " \
                $error \n]
          } elseif {$error} then {
            tputs $::test_channel [appendArgs \
                "---- pre-joined test thread \"" $thread \"\n]
          } else {
            tputs $::test_channel [appendArgs \
                "---- timeout pre-joining test thread \"" $thread " (" \
                $timeout " milliseconds)\"\n"]
          }
        }
      }

      if {[$thread IsAlive]} then {
        if {[catch {$thread Interrupt} error]} then {
          tputs $::test_channel [appendArgs \
              "---- failed to interrupt test thread \"" $thread "\": " \
              $error \n]
        } else {
          tputs $::test_channel [appendArgs "---- test thread \"" $thread \
              "\" interrupted\n"]
        }

        if {[$thread IsAlive]} then {
          if {[catch {
            $thread -parametertypes [list Int32] Join $timeout
          } error]} then {
            tputs $::test_channel [appendArgs \
                "---- failed to join test thread \"" $thread "\": " \
                $error \n]
          } elseif {$error} then {
            tputs $::test_channel [appendArgs "---- joined test thread \"" \
                $thread \"\n]
          } else {
            tputs $::test_channel [appendArgs \
                "---- timeout joining test thread \"" $thread " (" \
                $timeout " milliseconds)\"\n"]
          }

          if {[$thread IsAlive]} then {
            if {[catch {$thread Abort} error]} then {
              tputs $::test_channel [appendArgs \
                  "---- failed to abort test thread \"" $thread "\": " \
                  $error \n]
            } else {
              tputs $::test_channel [appendArgs "---- test thread \"" \
                  $thread "\" aborted\n"]
            }

            if {[$thread IsAlive]} then {
              tputs $::test_channel [appendArgs "---- test thread \"" \
                  $thread "\" appears to be a zombie\n"]
            } else {
              return true; # aborted?
            }
          } else {
            return true; # joined?
          }
        } else {
          return true; # interrupted?
        }
      } else {
        return true; # already dead?
      }

      return false; # still alive (or error).
    }

    proc reportTestDuplicateNames { channel } {
      #
      # NOTE: Check and display any duplicate test names that we
      #       found.  In theory, this checking may produce false
      #       positives if a test file (or the entire test suite)
      #       is run multiple times without resetting statistics
      #       and/or restarting Eagle; however, duplicate test
      #       names must be avoided and this is considered a good
      #       trade-off.
      #
      foreach {name count} $::eagle_tests(Counts) {
        if {$count > 1} then {
          tputs $channel [appendArgs \
              "==== test name \"" $name "\" DUPLICATED (" \
              $count ")\n"]
        } elseif {$count <= 0} then {
          tputs $channel [appendArgs \
              "==== test name \"" $name "\" BAD COUNT (" \
              $count ")\n"]
        }
      }

      return ""
    }

    proc reportTestConstraintCounts { channel skippedNames } {
      #
      # NOTE: Produce the final output, which includes a single line header
      #       followed by one line per test constraint seen.
      #
      set maximum 0

      calculateTestConstraintCounts $skippedNames maximum counts

      if {$maximum > 0 && [array size counts] > 0} then {
        set places [expr {int(log10($maximum)) + 1}]

        tputs $channel "Number of tests skipped for each constraint:\n"

        foreach {name value} [reportArrayGet counts] {
          tputs $channel [appendArgs \
              \t [format [appendArgs % $places s] $value] \t $name \n]
        }

        tputs $channel \n
      }
    }

    proc purgeAndCleanup { channel name } {
      catch {uplevel 1 [list debug purge]} result

      tputs $channel [appendArgs \
          "---- purge \"" $name "\" results: " $result \n]

      catch {uplevel 1 [list debug cleanup {
        Default -Miscellaneous
      }]} result

      tputs $channel [appendArgs \
          "---- cleanup \"" $name "\" results: " $result \n]

      catch {uplevel 1 [list object invoke -flags +NonPublic \
          Eagle._Components.Private.ProcessOps Cleanup]} result

      tputs $channel [appendArgs \
          "---- ProcessOps cleanup results: " $result \n]

      catch {uplevel 1 [list object invoke -flags +NonPublic \
          Eagle._Components.Private.EnumOps ClearCache]} result

      tputs $channel [appendArgs \
          "---- EnumOps cleanup results: " $result \n]

      if {[info exists ::eagle_platform(compileOptions)]} then {
        set options $::eagle_platform(compileOptions)
      } else {
        set options [list]
      }

      if {[lsearch -exact -- $options SHELL] != -1 && \
          [lsearch -exact -- $options INTERACTIVE_COMMANDS] != -1} then {
        catch {uplevel 1 [list object invoke -flags +NonPublic \
            Eagle._Components.Private.HelpOps ClearCache]} result

        tputs $channel [appendArgs \
            "---- HelpOps cleanup results: " $result \n]
      }

      catch {uplevel 1 [list object invoke -flags +NonPublic \
          Eagle._Components.Private.StringOps ClearPreambleEncodings]} result

      tputs $channel [appendArgs \
          "---- StringOps cleanup results: " $result \n]

      catch {uplevel 1 [list object invoke -flags +NonPublic \
          Eagle._Comparers.StringFileName ClearCache]} result

      tputs $channel [appendArgs \
          "---- Comparers.StringFileName cleanup results: " $result \n]

      catch {uplevel 1 [list object invoke -flags +NonPublic \
          Eagle._Components.Private.HashOps Cleanup]} result

      tputs $channel [appendArgs \
          "---- HashOps cleanup results: " $result \n]

      catch {uplevel 1 [list object invoke -flags +NonPublic \
          Eagle._Components.Private.FactoryOps Cleanup]} result

      tputs $channel [appendArgs \
          "---- FactoryOps cleanup results: " $result \n]

      catch {uplevel 1 [list object invoke -flags +NonPublic \
          Eagle._Components.Private.ScriptOps ClearInterpreterCache]} result

      tputs $channel [appendArgs \
          "---- ScriptOps cleanup results: " $result \n]

      catch {uplevel 1 [list object invoke -flags +NonPublic \
          Eagle._Components.Private.SyntaxOps ClearCache]} result

      tputs $channel [appendArgs \
          "---- SyntaxOps cleanup results: " $result \n]

      catch {uplevel 1 [list object invoke -flags +NonPublic \
          Eagle._Components.Private.ConfigurationOps Cleanup false]} result

      tputs $channel [appendArgs \
          "---- ConfigurationOps cleanup results: " $result \n]

      catch {uplevel 1 [list object invoke -flags +NonPublic \
          Eagle._Components.Private.TraceLimits Cleanup]} result

      tputs $channel [appendArgs \
          "---- TraceLimits cleanup results: " $result \n]

      catch {uplevel 1 [list object invoke -flags +NonPublic \
          Eagle._Components.Private.MarshalOps+ToStringCache Clear]} result

      tputs $channel [appendArgs \
          "---- ToStringCache cleanup results: " $result \n]

      catch {uplevel 1 [list object invoke -flags +NonPublic \
          Eagle._Components.Private.CertificateOps ClearCache]} result

      tputs $channel [appendArgs \
          "---- CertificateOps cleanup results: " $result \n]

      catch {uplevel 1 [list object invoke -flags +NonPublic \
          Eagle._Components.Private.RuntimeOps ClearCache]} result

      tputs $channel [appendArgs \
          "---- RuntimeOps cleanup results: " $result \n]

      catch {uplevel 1 [list object invoke -flags +NonPublic \
          Eagle._Components.Private.StringBuilderCache Clear]} result

      tputs $channel [appendArgs \
          "---- StringBuilderCache cleanup results: " $result \n]
    }

    proc evalWithTimeout { script {milliseconds 2000} {resultVarName ""} } {
      #
      # NOTE: Verify that the number of milliseconds requested is greater than
      #       zero.
      #
      if {$milliseconds <= 0} then {
        error "number of milliseconds must be greater than zero"
      }

      #
      # NOTE: Evaluate the specified script in the context of the caller,
      #       returning the result to the caller.
      #
      if {[string length $resultVarName] > 0} then {
        upvar 1 $resultVarName result
      }

      return [catch {
        #
        # NOTE: Evaluate the script in the context of the caller, forcing
        #       any [vwait] that may be in the contained script to stop
        #       when it hits a script cancellation -AND- reset the script
        #       cancellation flags upon completion (i.e. important due to
        #       the use of script cancellation to enforce the timeout).
        #
        uplevel 1 [list \
            debug secureeval -nocancel true -globalcancel true \
            -stoponerror true -timeout $milliseconds {} $script]
      } result]
    }

    proc vwaitWithTimeout { varName {milliseconds 2000} } {
      #
      # NOTE: Verify that the number of milliseconds requested is positive
      #       or zero.
      #
      if {$milliseconds < 0} then {
        error "number of milliseconds cannot be negative"
      }

      if {[catch {
        #
        # NOTE: Refer to the specified variable in the context of our
        #       caller.
        #
        upvar 1 $varName variable

        #
        # NOTE: Wait for the variable to be changed -OR- for the wait
        #       to be canceled.
        #
        vwait -eventwaitflags {+NoBgError StopOnError} -force -timeout \
            $milliseconds -- variable
      } result] == 0} then {
        #
        # NOTE: The wait completed successfully, the variable may have
        #       been changed.
        #
        return $result
      } else {
        #
        # NOTE: The wait failed in some way, it may have been canceled
        #       and the variable may or may not have been changed.
        #
        return false
      }
    }

    proc tclLoadForTest { {varName ""} {findFlags ""} {loadFlags ""} } {
      if {[string length $varName] > 0} then {
        upvar 1 $varName loaded
      }

      set loaded 0

      if {![tcl ready]} then {
        set command [list tcl load]

        if {[string length $findFlags] > 0} then {
          lappend command -findflags $findFlags
        }

        if {[string length $loadFlags] > 0} then {
          lappend command -loadflags $loadFlags
        }

        uplevel 1 $command; set loaded 1

        set module [tcl module]
        set interp [tcl primary]

        tputs $::test_channel [appendArgs \
            "---- native Tcl loaded, module \"" $module \
            "\", interpreter \"" $interp \"\n]
      }
    }

    proc tclUnloadForTest { {force false} {varName ""} } {
      set unload false

      if {$force} then {
        #
        # NOTE: This cannot check [tcl ready] as some tests actually
        #       rely upon errors from the [tcl unload] sub-command.
        #
        set unload true
      }

      if {[string length $varName] > 0} then {
        upvar 1 $varName loaded

        if {$loaded && !$unload} then {
          set unload true
        }

        unset -nocomplain loaded
      }

      if {$unload} then {
        set module [tcl module]
        set interp [tcl primary]

        uplevel 1 [list tcl unload]

        tputs $::test_channel [appendArgs \
            "---- native Tcl " [expr {$force ? "forcibly " : ""}] \
            "unloaded, module \"" $module "\", interpreter \"" \
            $interp \"\n]
      }
    }

    proc generateUniqueId { {text ""} {length 16} } {
      #
      # HACK: This should generate a reasonably random unique identifier
      #       suitable for non-cryptographic use by the test suite.
      #
      set last [expr {$length - 1}]

      if {[string length $text] > 0} then {
        return [string range \
            [string tolower [hash normal sha512 $text]] 0 $last]
      } else {
        return [string range \
            [string tolower [hash normal sha512 [appendArgs uniq \
            [info context] [info tid] [pid] [clock clicks] [clock \
            now]]]] 0 $last]
      }
    }

    proc testExecTclScript { script {shell ""} {verbose 0} } {
      try {
        #
        # NOTE: Get a temporary file name for the script we are going to
        #       use to query the machine type for the native Tcl shell.
        #
        set fileName [file tempname]

        #
        # NOTE: Since the native Tcl shell cannot simply evaluate a string
        #       supplied via the command line, write the script to be
        #       evaluated to the temporary file.
        #
        writeFile $fileName $script

        #
        # NOTE: Use the specified shell, if it is valid; otherwise, use
        #       the configured Tcl shell.
        #
        if {[string length $shell] == 0} then {
          #
          # NOTE: Before attempting to use the configured Tcl shell, make
          #       sure it has actually been set.
          #
          if {[info exists ::test_tclsh] && \
              [string length $::test_tclsh] > 0} then {
            #
            # NOTE: Use the currently configured Tcl shell, which may or
            #       may not actually exist.
            #
            set shell $::test_tclsh
          } else {
            #
            # NOTE: We cannot execute the native Tcl shell because one
            #       has not been specified, nor configured.
            #
            set error "error: \"::test_tclsh\" variable is missing"

            if {$verbose > 0} then {
              tputs $::test_channel [appendArgs \
                  "---- native Tcl script failure: " $error \n]
            }

            if {$verbose > 4} then {
              error $error
            } else {
              return [expr {$verbose > 3 ? $error : "error"}]
            }
          }
        }

        #
        # NOTE: Generate a unique identifier to make it easier to locate
        #       this script and its results in the test log file.
        #
        if {$verbose > 1} then {
          set id [generateUniqueId $script]
        }

        #
        # NOTE: When in "ultra-verbose" mode, emit native Tcl script to
        #       the log file.
        #
        if {$verbose > 2} then {
          tputs $::test_channel [appendArgs \
              "---- native Tcl script (" $id ") text: " [string trim \
              $script] \n]
        }

        #
        # NOTE: Evaluate the script using the native Tcl shell, trim the
        #       excess whitespace from the output, and return it to the
        #       caller.
        #
        if {[catch {string trim \
            [testExec $shell [list -success Success] \
            [appendArgs \" $fileName \"]]} result] == 0} then {
          #
          # NOTE: When in "super-verbose" mode, emit native Tcl script
          #       results to the log file.
          #
          if {$verbose > 1} then {
            tputs $::test_channel [appendArgs \
                "---- native Tcl script (" $id ") result: " $result \n]
          }

          #
          # NOTE: Success, return the result to the caller.
          #
          return $result
        } else {
          #
          # NOTE: We could not execute the native Tcl shell (perhaps one
          #       is not available?).
          #
          set error [appendArgs "error: " $result]

          if {$verbose > 0} then {
            tputs $::test_channel [appendArgs \
                "---- native Tcl script failure: " $error \n]
          }

          if {$verbose > 4} then {
            error $error
          } else {
            return [expr {$verbose > 3 ? $error : "error"}]
          }
        }
      } finally {
        #
        # NOTE: Should we delete the temporary file we created, if any?
        #
        if {![info exists ::no(deleteTestExecTclFile)]} then {
          #
          # NOTE: Did we create a temporary file to hold the Tcl script?
          #
          if {[info exists fileName] && \
              [string length $fileName] > 0 && \
              [file exists $fileName]} then {
            #
            # NOTE: Delete temporary file we used to evaluate the script
            #       using the native Tcl shell.
            #
            if {[catch {file delete $fileName} error]} then {
              if {$verbose > 0} then {
                tputs $::test_channel [appendArgs \
                    "---- native Tcl cleanup failure: " $error \n]
              }

              if {$verbose > 4} then {
                error $error
              }
            }
          }
        }
      }
    }

    proc getTclShellRaw {} {
      if {[info exists ::test_tclsh_raw] && \
          [string is boolean -strict $::test_tclsh_raw]} then {
        return $::test_tclsh_raw
      } else {
        return ""; # TODO: Good default?
      }
    }

    proc getTclShellVerbosity {} {
      if {[info exists ::test_tclsh_verbose] && \
          [string is integer -strict $::test_tclsh_verbose]} then {
        return $::test_tclsh_verbose
      } else {
        return 0; # TODO: Good default?
      }
    }

    proc getTclVersionForTclShell { {shell ""} {verbose 0} } {
      return [testExecTclScript {
        puts -nonewline stdout [info tclversion]
      } $shell $verbose]
    }

    proc getCommandsForTclShell { {shell ""} {verbose 0} } {
      return [testExecTclScript {
        puts -nonewline stdout [info commands]
      } $shell $verbose]
    }

    proc getMachineForTclShell { {shell ""} {verbose 0} } {
      return [testExecTclScript {
        puts -nonewline stdout $tcl_platform(machine)
      } $shell $verbose]
    }

    proc getTclExecutableForTclShell { {shell ""} {verbose 0} } {
      return [testExecTclScript {
        puts -nonewline stdout [info nameofexecutable]; # EXEMPT
      } $shell $verbose]
    }

    proc getTkVersionForTclShell { {shell ""} {verbose 0} } {
      return [testExecTclScript {
        puts -nonewline stdout [package require Tk]; exit
      } $shell $verbose]
    }

    proc fileNormalizeWithTclShell { path {shell ""} {verbose 0} } {
      return [testExecTclScript [string map [list %path% $path] {
        puts -nonewline stdout [file normalize {%path%}]
      }] $shell $verbose]
    }

    proc evalWithTclShell { script {raw ""} {shell ""} {verbose 0} } {
      return [testExecTclScript [string map \
          [list %script% $script %raw% $raw] {
        if {[string length {%raw%}] == 0} then {
          set code [catch {%script%} result]
          if {$code == 0} then {
            puts -nonewline stdout $result; # success
          } else {
            puts -nonewline stdout [list $code $result]; # error
          }
        } elseif {%raw%} then {
          set code [catch {%script%} result]
          puts -nonewline stdout [list $code $result]
        } else {
          puts -nonewline stdout [eval {%script%}]
        }
      }] $shell $verbose]
    }

    proc getGarudaDll { {machine ""} } {
      #
      # NOTE: Get the Garuda DLL of the same platform (i.e. machine type)
      #       as the native Tcl shell.
      #
      if {[info exists ::base_path]} then {
        #
        # NOTE: Get the effective test configuration.
        #
        set configuration [getTestConfiguration]

        #
        # NOTE: If there is no effective test configuration available, we
        #       cannot continue.
        #
        if {[string length $configuration] == 0} then {
          return ""
        }

        #
        # NOTE: Get the effective test suffix.  This is allowed to be an
        #       empty string.
        #
        set suffix [getTestSuffix]

        #
        # NOTE: If necessary, automatically detect the machine for the Tcl
        #       shell that we plan on using.
        #
        if {[string length $machine] == 0 && \
            ![info exists ::no(getMachineForTclShell)]} then {
          set machine [getMachineForTclShell "" [getTclShellVerbosity]]
        }

        #
        # NOTE: Build the full path and file name of the Garuda DLL, using
        #       the Eagle base path.  Currently, this will only work
        #       correctly if the test suite is being run from inside the
        #       source tree.
        #
        return [file join $::base_path bin \
            [machineToPlatform $machine] [appendArgs $configuration Dll \
            $suffix] [appendArgs Garuda [info sharedlibextension]]]
      } else {
        #
        # NOTE: We are missing the base path, return nothing.
        #
        return ""
      }
    }

    proc cleanupExcel {} {
      #
      # TODO: These may need to be changed in later Excel versions.
      #
      object undeclare -declarepattern Microsoft.Office.Interop.Excel*
      object unimport -importpattern Microsoft.Office.Interop.Excel
    }

    proc cleanupVisualBasic {} {
      #
      # TODO: These may need to be changed in later framework versions.
      #
      object unimport -importpattern Microsoft.VisualBasic*
    }

    proc cleanupXml {} {
      #
      # TODO: These may need to be changed in later framework versions.
      #
      object unimport -importpattern System.Xml*
    }

    proc cleanupWinForms {} {
      #
      # TODO: These may need to be changed in later framework versions.
      #
      object unimport -importpattern System.Resources
      object unimport -importpattern System.Windows.Forms
      object unimport -importpattern System.Windows.Forms.Automation

      object unimport -importpattern \
          System.Windows.Forms.ComponentModel.Com2Interop

      object unimport -importpattern System.Windows.Forms.Design
      object unimport -importpattern System.Windows.Forms.Layout
      object unimport -importpattern System.Windows.Forms.PropertyGridInternal
      object unimport -importpattern System.Windows.Forms.VisualStyles
    }

    proc getTestLibraryDirectory {} {
      #
      # NOTE: First, query the location of the script library.  This will
      #       not work right in a "safe" interpreter.
      #
      if {[catch {info library} result] == 0} then {
        #
        # NOTE: Next, If the script library is embedded within the core
        #       library itself (i.e. the script library location refers
        #       to a file, not a directory), strip off the file name.
        #
        if {[file exists $result] && [file isfile $result]} then {
          set result [file dirname $result]
        }

        #
        # NOTE: Finally, return the resulting script library directory.
        #
        return $result
      }

      return ""
    }

    #
    # NOTE: Check for the test path in the various well-known locations
    #       and set the associated variable.
    #
    if {![info exists ::no(checkForAndSetTestPath)]} then {
      checkForAndSetTestPath false [expr {![isTestSuiteRunning]}]
    }

    #
    # NOTE: Fake loading and configuring the "tcltest" package unless we
    #       are prevented.
    #
    if {![info exists ::no(configureTcltest)]} then {
      configureTcltest "" [list] [list] [list] [list] false
    }

    ###########################################################################
    ############################# END Eagle ONLY ##############################
    ###########################################################################
  } else {
    ###########################################################################
    ############################# BEGIN Tcl ONLY ##############################
    ###########################################################################

    proc getPassedPercentage {} {
      if {$::tcltest::numTests(Total) > 0} then {
        return [expr \
            {100.0 * (($::tcltest::numTests(Passed) + \
            $::tcltest::numTests(Skipped)) / \
            double($::tcltest::numTests(Total)))}]
      }

      return 0; # no tests were run, etc.
    }

    proc getSkippedPercentage {} {
      if {$::tcltest::numTests(Total) > 0} then {
        return [expr \
            {100.0 * ($::tcltest::numTests(Skipped) / \
            double($::tcltest::numTests(Total)))}]
      }

      return 0; # no tests were run, etc.
    }

    proc testCheckOverallResult {
            channel percent haveStartSentry {varName ""} {quiet false} } {
      #
      # NOTE: Does the caller want to change the exit code to an appropriate
      #       value based on the overall test results?
      #
      if {[string length $varName] > 0} then {upvar 1 $varName exitCode}

      #
      # NOTE: Has the test pass threshold been set?  If so, is it set to the
      #       default value?
      #
      # HACK: If the test suite error message exists, the entire run will be
      #       considered a "failure", without regard for the pass percentage
      #       or the configured test pass threshold.
      #
      if {![info exists ::test_threshold] || $::test_threshold == 100} then {
        #
        # HACK: Check for the required elements of the global Tcl tests
        #       array.
        #
        if {[info exists ::tcltest::numTests(Passed)] && \
            [info exists ::tcltest::numTests(Skipped)] && \
            [info exists ::tcltest::numTests(Total)]} then {
          #
          # NOTE: The test pass threshold is set to the default value (100%).
          #       Check to make sure that all tests passed and then set the
          #       exit code to success; otherwise, we set it to failure.
          #
          set passedOrSkipped [expr {
              $::tcltest::numTests(Passed) + $::tcltest::numTests(Skipped)
          }]

          if {![info exists ::test_suite_errors] && \
              ([info exists ::no(failLogStartSentry)] || \
                  $haveStartSentry) && \
              $passedOrSkipped == $::tcltest::numTests(Total)} then {
            set exitCode 0; # Success.

            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "OVERALL RESULT: " [getTestSuiteFullName] \n]

              if {$::tcltest::numTests(Total) > 0} then {
                tputs $channel "OVERALL RESULT: SUCCESS\n"
              } else {
                tputs $channel "OVERALL RESULT: NONE\n"
              }
            }

            return true
          } else {
            set exitCode 1; # Failure.

            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "OVERALL RESULT: " [getTestSuiteFullName] \n]

              if {[info exists ::test_suite_errors]} then {
                tputs $channel [appendArgs "OVERALL ERRORS: " \
                    [expr {[llength $::test_suite_errors] > 0 ? \
                    $::test_suite_errors : "<empty>"}] \n]
              }

              tputs $channel "OVERALL RESULT: FAILURE\n"
            }

            return false
          }
        } else {
          set exitCode 1; # Failure.

          if {!$quiet} then {
            tputs $channel [appendArgs \
                "OVERALL RESULT: " [getTestSuiteFullName] \n]

            if {[info exists ::test_suite_errors]} then {
              tputs $channel [appendArgs "OVERALL ERRORS: " \
                  [expr {[llength $::test_suite_errors] > 0 ? \
                  $::test_suite_errors : "<empty>"}] \n]
            }

            tputs $channel "OVERALL RESULT: MISSING test counts (1)\n"
            tputs $channel "OVERALL RESULT: FAILURE\n"
          }

          return false
        }
      } else {
        #
        # NOTE: They specified a non-default test pass threshold.  Check to
        #       make sure that we meet or exceed the requirement and then
        #       set the exit code to success; otherwise, set it to failure.
        #
        if {![info exists ::test_suite_errors] && \
            ([info exists ::no(failLogStartSentry)] || \
                $haveStartSentry) && \
            $percent >= $::test_threshold} then {
          #
          # HACK: Check for the required elements of the global Tcl tests
          #       array.
          #
          if {[info exists ::tcltest::numTests(Total)]} then {
            set exitCode 0; # Success.

            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "OVERALL RESULT: " [getTestSuiteFullName] \n]

              if {$::tcltest::numTests(Total) > 0} then {
                tputs $channel [appendArgs \
                    "OVERALL RESULT: SUCCESS (" \
                    $percent "% >= " $::test_threshold %)\n]
              } else {
                tputs $channel [appendArgs \
                    "OVERALL RESULT: NONE (" \
                    $percent "% >= " $::test_threshold %)\n]
              }
            }

            return true
          } else {
            set exitCode 1; # Failure.

            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "OVERALL RESULT: " [getTestSuiteFullName] \n]

              if {[info exists ::test_suite_errors]} then {
                tputs $channel [appendArgs "OVERALL ERRORS: " \
                    [expr {[llength $::test_suite_errors] > 0 ? \
                    $::test_suite_errors : "<empty>"}] \n]
              }

              tputs $channel "OVERALL RESULT: MISSING test counts (2)\n"
              tputs $channel "OVERALL RESULT: FAILURE\n"
            }

            return false
          }
        } else {
          set exitCode 1; # Failure.

          if {!$quiet} then {
            tputs $channel [appendArgs \
                "OVERALL RESULT: " [getTestSuiteFullName] \n]

            if {[info exists ::test_suite_errors]} then {
              tputs $channel [appendArgs "OVERALL ERRORS: " \
                  [expr {[llength $::test_suite_errors] > 0 ? \
                  $::test_suite_errors : "<empty>"}] \n]
            }

            tputs $channel [appendArgs \
                "OVERALL RESULT: FAILURE (" \
                $percent "% < " $::test_threshold %)\n]
          }

          return false
        }
      }
    }

    proc reportTestResultCounts { channel {varName ""} } {
      if {[string length $varName] > 0} then {
        upvar 1 $varName percent
      }

      if {$::tcltest::numTests(Passed) > 0} then {
        tputs $channel [appendArgs \
            "PASSED: " $::tcltest::numTests(Passed) \n]
      }

      if {$::tcltest::numTests(Failed) > 0} then {
        tputs $channel [appendArgs \
            "FAILED: " $::tcltest::numTests(Failed) \n]

        if {[llength $::tcltest::failFiles] > 0} then {
          tputs $channel [appendArgs \
              "FAILED: " $::tcltest::failFiles \n]
        }
      }

      if {$::tcltest::numTests(Skipped) > 0} then {
        tputs $channel [appendArgs \
            "SKIPPED: " $::tcltest::numTests(Skipped) \n]
      }

      if {$::tcltest::numTests(Total) > 0} then {
        tputs $channel [appendArgs \
            "TOTAL: " $::tcltest::numTests(Total) \n]

        if {$::tcltest::numTests(Skipped) > 0} then {
          set percent [getSkippedPercentage]

          tputs $channel [appendArgs \
              "SKIP PERCENTAGE: " [formatDecimal $percent] %\n]
        }

        set percent [getPassedPercentage]

        tputs $channel [appendArgs \
            "PASS PERCENTAGE: " [formatDecimal $percent] %\n]
      } else {
        #
        # NOTE: No tests.
        #
        set percent 0
      }

      return ""
    }

    #
    # NOTE: Check for the test path in the various well-known locations
    #       and set the associated variable.
    #
    if {![info exists ::no(checkForAndSetTestPath)]} then {
      checkForAndSetTestPath false [expr {![isTestSuiteRunning]}]
    }

    #
    # NOTE: Load and configure the "tcltest" package unless we are prevented.
    #
    if {![info exists ::no(configureTcltest)]} then {
      configureTcltest "" [list] [list] [list] [list test testConstraint] false
    }

    #
    # NOTE: We need several of our test related commands in the global
    #       namespace as well.
    #
    exportAndImportPackageCommands [namespace current] [list \
        cleanupAfterEvents findParentDirectory enableRuntimeOptionsForTcl \
        setupEvaluateViaTemporaryFile evaluateViaTemporaryFile \
        cleanupEvaluateViaTemporaryFiles getKnownTclVariables \
        getKnownTestVariables getKnownOtherVariables cleanState dumpState \
        needTestDoEvents testDoEvents trawputs doesTestOutputRepeat \
        toneputs tputs ttclLog doesTestLogFileExist getTestLogStartSentry \
        readTestLogStartSentry extractTestRunIdFromLogStartSentry \
        doesTestLogHaveStartSentry didTestLogHaveStartSentry \
        setTestLogStartSentry tlog getSoftwareRegistryKey haveConstraint \
        addConstraint haveOrAddConstraint getConstraints \
        getCachedConstraints useCachedConstraints removeConstraint \
        fixConstraints fixTimingConstraints testDebugBreak testArrayGet \
        testArrayGet2 testResultGet testValueGet getValueOrDefault \
        getFirstLineOfError calculateBogoCops calculateRelativePerformance \
        formatTimeStamp formatElapsedTime sourceIfValid processTestArguments \
        getTclShellFileName getTemporaryPath getTemporaryFileName getFiles \
        getTestFiles getTestRunId getTestRunBucket isValidGuid \
        getNewTestRunId getDefaultTestLogSubPath getDefaultTestLogPath \
        getTestLogPath getTestLogId getDefaultTestLog getTestLog \
        getLastTestLog getTestSuite getTestSuiteFileName \
        getTestSuiteFullName getTestSuiteVariantName getTestMachine \
        getTestPlatform getTestConfiguration getTestNamePrefix getTestSuffix \
        getTestUncountedLeaks getTestListedLeaks getRuntimeAssemblyName \
        getTestAssemblyName canTestExec testExec testClrExec execTestShell \
        isRandomOrder isBreakOnDemand isBreakOnLeak isStopOnFailure \
        isStopOnLeak isExitOnComplete returnInfoScript runTestPrologue \
        runTestEpilogue hookPuts unhookPuts runTest testShim tsource \
        getKnownEagleVersions isStableEagleRelease recordTestStatistics \
        reportTestStatistics formatList formatListAsDict pathToRegexp \
        assemblyNameToRegexp maybeGetOption inverseLsearchGlob \
        removePathFromFileNames formatDecimal clearTestPercent \
        reportTestPercent reportArrayGet reportTestStatisticCounts \
        runAllTests isTestSuiteRunning getTestChannelOrDefault \
        tryVerifyTestPath checkForAndSetTestPath configureTcltest \
        machineToPlatform architectureForPlatform \
        calculateTestConstraintCounts logRemoteMessage logRemoteTestResults \
        getPassedPercentage getSkippedPercentage testCheckOverallResult \
        reportTestResultCounts] false false

    ###########################################################################
    ############################## END Tcl ONLY ###############################
    ###########################################################################
  }

  #
  # NOTE: Provide the Eagle "test" package to the interpreter.
  #
  package provide Eagle.Test \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/testlog.eagle.





















































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
###############################################################################
#
# testlog.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Test Log Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This procedure locks the specified variable in the call frame of
  #       the caller while it evaluates the specified script, also in the
  #       context of the caller.
  #
  proc vwaitLocked { varName isArray script } {
    if {[isEagle]} then {
      #
      # HACK: The [info exists] sub-command may return false even if the
      #       variable exists, *IF* that variable is currently locked by
      #       another thread.
      #
      if {[string length $isArray] > 0 && \
          ![uplevel 1 [list info exists $varName]]} then {
        #
        # BUGFIX: If another thread has the variable locked, this could
        #         fail.  That would be bad because the caller wishes to
        #         block until the variable is available.
        #
        if {$isArray} then {
          catch {
            #
            # HACK: This will either create the array variable without
            #       elements -OR- fail because the variable has been
            #       locked by another thread; either way, that's fine.
            #
            uplevel 1 [list array set $varName [list]]
          }
        } else {
          catch {
            #
            # HACK: This will either create the scalar variable with an
            #       empty value -OR- fail because the variable has been
            #       locked by another thread; either way, that's fine.
            #
            uplevel 1 [list set $varName ""]
          }
        }
      }

      uplevel 1 [list vwait -force -locked $script -- $varName]
    } else {
      uplevel 1 $script
    }
  }

  #
  # NOTE: This procedure emits a message to the specified channel and adds
  #       it to the test log queue.
  #
  proc tqputs { channel string } {
    #
    # NOTE: If an output channel was provided, use it; otherwise, ignore
    #       the message.
    #
    if {[string length $channel] > 0} then {
      puts -nonewline $channel $string
    }

    tqlog $string
  }

  #
  # NOTE: This procedure adds a message to the test log queue.  It will be
  #       written to the test log file the next time the [tlog] procedure
  #       is called.  If the [tlog] procedure is never called, then it will
  #       never be written to the test log file.
  #
  proc tqlog { string } {
    #
    # NOTE: If an empty string is supplied by the caller, do nothing.
    #
    if {[string length $string] > 0} then {
      #
      # NOTE: *SPECIAL* The special global variable "test_log_queue" is used
      #       by the [tlog] script library procedure from the test package to
      #       enable it to emit "queued" data into the test log file prior to
      #       emitting the string requested by its caller.  The only job for
      #       this procedure is to populate the "test_log_queue" variable for
      #       later use by the test package.
      #
      # BUGFIX: As of beta 47, use of the "test_log_queue" global variable is
      #         thread-safe.
      #
      vwaitLocked ::test_log_queue true {
        if {[info exists ::test_log_queue]} then {
          #
          # NOTE: Use the next queued test log entry.
          #
          set entry [expr {[array size ::test_log_queue] + 1}]
        } else {
          #
          # NOTE: Use the first queued test log entry.
          #
          set entry 1
        }

        #
        # NOTE: Add the new entry to the test log queue.  All entries will
        #       be sent to the actual test log file the very next time the
        #       [tlog] command from the test package is executed.
        #
        set ::test_log_queue($entry) $string
      }
    }

    return ""
  }

  #
  # NOTE: Provide the Eagle "test log" package to the interpreter.
  #
  package provide Eagle.Test.Log \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/unkobj.eagle.





















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
###############################################################################
#
# unkobj.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Unknown Object Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This is an [unknown] procedure that attempts to lookup the name
  #       as a CLR type and then attempts to use [object invoke] with it,
  #       merging options and arguments as necessary.
  #
  proc unknownObjectInvoke { level name args } {
    set typeName $name; set extraName ""

    if {[llength [info commands object]] > 0 && \
       ([isManagedType $typeName] || \
        [canGetManagedType $typeName true typeName extraName])} then {
      #
      # NOTE: Get possible options for the [object invoke] sub-command.
      #
      set options [object invoke Utility GetInvokeOptions Invoke]

      #
      # NOTE: Create argument list for the artificial [object invoke]
      #       alias.  This always has two arguments.
      #
      set arguments1 [object create ArgumentList object invoke]

      #
      # NOTE: Create argument list for the entire command being handled.
      #       There may be options right after the command name itself.
      #
      if {[string length $extraName] > 0} then {
        #
        # HACK: Construct a new type name with the NUL character between
        #       it and the extra parts that must be moved into the member
        #       name by the core marshaller.
        #
        set arguments2 [eval \
            object create ArgumentList [concat [list [appendArgs \
            $typeName \x00 [string map [list . \x00] $extraName]]] \
            $args]]
      } else {
        set arguments2 [eval \
            object create ArgumentList [concat [list $typeName] \
            $args]]
      }

      #
      # NOTE: Setup output arguments needed for the MergeArguments method.
      #
      set arguments3 null; set error null

      #
      # NOTE: Attempt to merge the option and non-option arguments into a
      #       single list of arguments.
      #
      set code [object invoke -alias \
          Interpreter.GetActive MergeArguments $options $arguments1 \
          $arguments2 2 1 false false false arguments3 error]

      #
      # NOTE: Was the argument merging process successful?
      #
      if {$code eq "Ok"} then {
        #
        # NOTE: Jump up from our call frame (and optionally that of our
        #       caller) and attempt to invoke the specified static object
        #       method with the final list of merged arguments.
        #
        return [uplevel [expr {$level + 1}] \
            [getStringFromObjectHandle $arguments3]]
      } else {
        #
        # NOTE: Failed to merge the arguments, raise an error.
        #
        error [getStringFromObjectHandle $error]
      }
    }

    continue; # NOTE: Not handled.
  }

  #
  # NOTE: Provide the Eagle "unknown object" package to the interpreter.
  #
  package provide Eagle.Unknown.Object \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/unzip.eagle.







































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
###############################################################################
#
# unzip.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Unzip Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This procedure sets up the default values for all configuration
  #       parameters used by this package.  If the force argument is non-zero,
  #       any existing values will be overwritten and set back to their
  #       default values.
  #
  proc setupUnzipVars { force {cleanup false} } {
    #
    # NOTE: Using the [getAuxiliaryBaseUri] procedure requires the update
    #       package.
    #
    # NOTE: The base URI used to build the URIs for the unzip command line
    #       tool downloads.
    #
    variable baseUri; # DEFAULT: [getAuxiliaryBaseUri] -OR- https://urn.to/r

    if {$cleanup} then {
      unset -nocomplain baseUri
    } elseif {$force || ![info exists baseUri]} then {
      if {[isEagle]} then {
        set baseUri [getAuxiliaryBaseUri]
      } else {
        set baseUri https://urn.to/r
      }
    }

    #
    # NOTE: The URN, relative to the base URI, where the unzip command
    #       line tool may be downloaded.
    #
    variable unzipUrn; # DEFAULT: unzip

    if {$cleanup} then {
      unset -nocomplain unzipUrn
    } elseif {$force || ![info exists unzipUrn]} then {
      set unzipUrn unzip
    }

    #
    # NOTE: The URI where the unzip command line tool may be downloaded.
    #
    variable unzipUri; # DEFAULT: ${baseUri}/${unzipUrn}

    if {$cleanup} then {
      unset -nocomplain unzipUri
    } elseif {$force || ![info exists unzipUri]} then {
      set unzipUri {${baseUri}/${unzipUrn}}
    }

    #
    # NOTE: The command to use when attempting to verify that UnZip is
    #       installed locally.
    #
    variable unzipInstalledCommand; # DEFAULT: unzip

    if {$cleanup} then {
      unset -nocomplain unzipInstalledCommand
    } elseif {$force || ![info exists unzipInstalledCommand]} then {
      set unzipInstalledCommand unzip
    }

    #
    # NOTE: The regular expression pattern used when attempting to verify
    #       that UnZip is installed locally.
    #
    variable unzipInstalledPattern; # DEFAULT: ^UnZip ..., by Info-ZIP\.

    if {$cleanup} then {
      unset -nocomplain unzipInstalledPattern
    } elseif {$force || ![info exists unzipInstalledPattern]} then {
      set unzipInstalledPattern \
          {^UnZip \d+\.\d+ of \d{1,2} \w+ \d{4},[\w\s\.]* by Info-ZIP\.}
    }

    #
    # NOTE: The command to use when attempting to unzip an archive.
    #
    variable unzipExtractCommand; # DEFAULT: unzip ...

    if {$cleanup} then {
      unset -nocomplain unzipExtractCommand
    } elseif {$force || ![info exists unzipExtractCommand]} then {
      set unzipExtractCommand {unzip -n {${fileName}} -d {${directory}}}
    }
  }

  #
  # NOTE: This procedure attempts to verify that an implementation of the
  #       unzip command line tool is installed locally.  There are no
  #       arguments.  Script errors are raised if any problems are found.
  #       The return value is undefined.
  #
  proc unzipMustBeInstalled {} {
    variable unzipInstalledCommand
    variable unzipInstalledPattern

    set message {
      Cannot use UnZip: it does not appear to be installed.

      UnZip may be downloaded from "https://www.info-zip.org/"
      and then installed by copying the (single) UnZip binary to
      a directory that lies somewhere along the executable search
      path.

      Alternatively, it may be possible to install UnZip via the
      package management subsystem included with your operating
      system.
    }

    if {[isEagle]} then {
      if {[catch {
        eval exec -success Success $unzipInstalledCommand
      } result]} then {
        error $message
      }
    } else {
      if {[catch {
        eval exec $unzipInstalledCommand
      } result]} then {
        error $message
      }
    }

    if {![info exists result] || \
        ![regexp -- $unzipInstalledPattern $result]} then {
      error "cannot use UnZip: unknown or unsupported version"
    }

    return ""
  }

  #
  # NOTE: This procedure attempts to use the unzip command line tool in order
  #       to extract a ZIP archive file.  The archiveFileName argument is the
  #       ZIP archive file to extract.  The extractRootDirectory argument is
  #       the location of a directory that should contain a new temporary
  #       extraction directory.  The actual temporary extraction directory is
  #       returned.
  #
  proc extractZipArchive { archiveFileName extractRootDirectory rootOnly } {
    setupUnzipVars false

    variable baseUri
    variable unzipExtractCommand
    variable unzipUri
    variable unzipUrn
    variable unzipVersionCommand

    set fileName [file nativename $archiveFileName]

    if {$rootOnly} then {
      set extractDirectory $extractRootDirectory
    } else {
      set extractDirectory [file join $extractRootDirectory \
          [appendArgs ea-uz-xa- [pid] - [string trim [clock seconds] -]]]
    }

    set directory [file nativename $extractDirectory]

    if {[isEagle]} then {
      #
      # HACK: On Windows only, when the unzip command line tool does
      #       not appear to be installed, attempt to download it to a
      #       temporary directory and use it from there.  In theory,
      #       if this procedure is called multiple times, this should
      #       only be necessary the first time.
      #
      if {[isWindows] && [catch {unzipMustBeInstalled}]} then {
        set uri [subst $unzipUri]
        set exeFileName [file tempname]

        uri download $uri $exeFileName

        #
        # NOTE: *SECURITY* The downloaded unzip command line tool must
        #       be signed; otherwise, it will be deleted and a script
        #       error will be raised.
        #
        if {[catch {library certificate $exeFileName}]} then {
          if {![info exists ::no(deleteExtractZipArchiveFile)]} then {
            catch {file delete $exeFileName}
          }

          error "cannot use UnZip: downloaded file was not properly signed"
        }

        #
        # NOTE: Create a brand new temporary directory, underneath the
        #       extraction root directory, that will be added to the
        #       executable search path and move the downloaded file to
        #       it.
        #
        set exeDirectory [file join $extractRootDirectory \
            [appendArgs ea-uz-xt- [pid] - [string trim [clock seconds] -]]]

        file mkdir $exeDirectory
        file copy $exeFileName [file join $exeDirectory unzip.exe]

        if {![info exists ::no(deleteExtractZipArchiveFile)]} then {
          catch {file delete $exeFileName}
        }

        addToPath $exeDirectory
      }

      unzipMustBeInstalled

      set fileName [appendArgs \" $fileName \"]
      set directory [appendArgs \" $directory \"]

      if {[catch {
        eval exec -success Success [subst $unzipExtractCommand]
      } error]} then {
        error [appendArgs \
            "could not extract archive " $fileName ": " $error]
      }
    } else {
      unzipMustBeInstalled

      if {[catch {
        eval exec [subst $unzipExtractCommand]
      } error]} then {
        error [appendArgs \
            "could not extract archive \"" $fileName "\": " $error]
      }
    }

    return $extractDirectory
  }

  #
  # NOTE: Provide the Eagle "unzip" package to the interpreter.
  #
  package provide Eagle.Unzip \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/update.eagle.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
###############################################################################
#
# update.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Update Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  #
  # NOTE: This procedure creates an identifier suitable for use with the
  #       [isUpdateInstalled] and [markUpdateInstalled] script library
  #       procedures.  The format of the returned string identifier is
  #       unspecified.
  #
  proc makeUpdateId { args } {
    #
    # NOTE: Enforce a restriction that there must be at least one string
    #       in the list of arguments.
    #
    if {[llength $args] == 0} then {
      error "cannot make update identifier without any arguments"
    }

    if {[isEagle]} then {
      #
      # NOTE: Attempt to load Eagle test package as it is required for its
      #       [generateUniqueId] procedure.
      #
      package require Eagle.Test

      #
      # NOTE: Attempt to generate a stable unique identifier that is based
      #       on the arguments specified.
      #
      return [generateUniqueId $args]
    } elseif {[catch {package require sha1}] == 0} then {
      #
      # BUGBUG: Apparently, the ActiveState tcllib sha1 package may have a
      #         bug that produces the wrong values here.  No attempt is made
      #         here to work around any such bug.  For further information,
      #         please see:
      #
      #         https://core.tcl.tk/tcllib/info/ad20454023
      #
      return [sha1::sha1 -hex $args]
    } else {
      error "cannot make unique identifier without the sha1 package"
    }
  }

  #
  # NOTE: This procedure returns a fully qualified file name for the updates
  #       file -OR- an empty string if it cannot be determined.
  #
  proc getUpdateFileName { {directory ""} } {
    #
    # NOTE: The (installed) updates file, if it exists, must reside in the
    #       specified directory by the caller, the current update directory
    #       for the target interpreter, or the directory containing the Tcl
    #       script library.  It must be a textual file with fields and lines
    #       delimited by tab characters and new line characters.
    #
    if {[string length $directory] > 0} then {
      return [file join $directory updates.tsv]
    } elseif {[isEagle] && [llength [info commands object]] > 0} then {
      set directory [object invoke -flags +NonPublic \
          Eagle._Components.Private.ShellOps GetUpdateDirectory ""]

      if {[string length $directory] > 0} then {
        return [file join $directory updates.tsv]
      }
    }

    return [file join [info library] updates.tsv]
  }

  #
  # NOTE: This procedure returns non-zero if the specified updated has been
  #       installed on the local machine.  Optionally, it will evaluate an
  #       arbitrary script for each update found.
  #
  proc isUpdateInstalled { updateId {directory ""} {script ""} } {
    #
    # NOTE: Assume that the specified update is not installed and then try
    #       to prove otherwise.
    #
    set result false

    #
    # NOTE: The (installed) updates file, if it exists, must reside in the
    #       specified directory by the caller, the current update directory
    #       for the target interpreter, or the directory containing the Tcl
    #       script library.  It must be a textual file with fields and lines
    #       delimited by tab characters and new line characters.
    #
    set fileName [getUpdateFileName $directory]

    if {[file isfile $fileName] && [file readable $fileName]} then {
      #
      # NOTE: Attempt to read all the update data from the file, which must
      #       exist within the script library directory.  This may raise an
      #       error.  Convert the read data to Unix-style line-endings.  If
      #       there is no data, do nothing.
      #
      set data [string map [list \r\n \n] [readFile $fileName]]

      if {[string length $data] > 0} then {
        #
        # NOTE: Split the data into lines.  This will always use Unix-style
        #       line-endings.
        #
        set lines [split $data \n]

        foreach line $lines {
          #
          # NOTE: Save the original line for use by the script callback, if
          #       any.
          #
          set savedLine $line

          #
          # NOTE: Remove surrounding spaces (but not tabs), skip blank lines
          #       and comment lines.
          #
          set line [string trim $line " "]

          if {[string length $line] == 0} then {
            if {[string length $script] > 0} then {eval $script}
            continue
          }

          set char [string index $line 0]

          if {$char eq "#" || $char eq ";"} then {
            if {[string length $script] > 0} then {eval $script}
            continue
          }

          #
          # NOTE: Split the tab-delimited line into its fields.  The format
          #       of all lines in the data must be as follows, all on the
          #       same line:
          #
          #       <startLine> updateId <tab> timeStamp <tab> notes <newLine>
          #
          set fields [split $line \t]

          if {[llength $fields] < 3} then {
            if {[string length $script] > 0} then {eval $script}
            continue
          }

          #
          # NOTE: Grab all fields from the update line.  The caller supplied
          #       script may need them.
          #
          set field(updateId) [lindex $fields 0]
          set field(timeStamp) [lindex $fields 1]
          set field(notes) [lindex $fields 2]

          #
          # NOTE: If the caller specified a script, it will be evaluated for
          #       each line, even blank lines and comment lines.
          #
          if {[string length $script] > 0} then {eval $script}

          #
          # NOTE: Compare this update identifier with the update identifier
          #       specified by the caller.
          #
          if {$field(updateId) eq $updateId} then {
            #
            # NOTE: The update appears to be installed.  We cannot simply
            #       here because the caller supplied script, if any, needs
            #       access to all the lines.
            #
            set result true
          }
        }
      }
    }

    return $result
  }

  #
  # NOTE: This procedure marks the specified update as being installed on
  #       the local machine (or not).
  #
  proc markUpdateInstalled { updateId installed {directory ""} {notes ""} } {
    #
    # NOTE: Check if the update is installed while capturing each line of
    #       the updates file.
    #
    set lines [list]; set result [isUpdateInstalled $updateId $directory {
      #
      # HACK: The list of lines is only used when marking an update as not
      #       being installed; therefore, always omit that update line, if
      #       present.
      #
      if {![info exists field(updateId)] || \
          $field(updateId) ne [uplevel 1 [list set updateId]]} then {
        #
        # NOTE: This is either a blank line, comment line, unknown line,
        #       or an update line not pertaining to the update specified
        #       by the caller; therefore, retain it in the filtered list.
        #
        uplevel 1 [list lappend lines $savedLine]
      }
    }]

    #
    # NOTE: The (installed) updates file, if it exists, must reside in the
    #       specified directory by the caller, the current update directory
    #       for the target interpreter, or the directory containing the Tcl
    #       script library.  It must be a textual file with fields and lines
    #       delimited by tab characters and new line characters.
    #
    set fileName [getUpdateFileName $directory]

    #
    # NOTE: Are we marking the update as "installed"?  Otherwise, we are
    #       removing the installation mark.
    #
    if {$installed} then {
      #
      # NOTE: Is the update currently marked as "installed"?  If so, raise
      #       a script error; otherwise, mark it as "installed" by simply
      #       appending a properly formed update line to the updates file.
      #
      if {$result} then {
        error [appendArgs \
            "update \"" $updateId "\" is already installed"]
      } else {
        if {[isEagle]} then {
          # 2019.10.24T00:12:28.503 -0400
          set timeStamp [clock format \
              [clock seconds] -iso -isotimezone]
        } else {
          # 2019.10.24T00:12:28.000
          set timeStamp [clock format \
              [clock seconds] -format %Y.%m.%dT%H:%M:%S.000]
        }

        appendFile $fileName [appendArgs \
            [expr {[llength $lines] > 0 ? "\n" : ""}] $updateId \t \
            $timeStamp \t [escapeUpdateNotes $notes]]
      }
    } else {
      #
      # NOTE: Is the update currently marked as installed?  If so, write
      #       out the (filtered) list of lines to the updates file, which
      #       will have the effect of removing that installation mark;
      #       otherwise, raise a script error.
      #
      if {$result} then {
        writeFile $fileName [join $lines \n]
      } else {
        error [appendArgs \
            "update \"" $updateId "\" is not installed"]
      }
    }

    return $result
  }

  #
  # NOTE: This procedure returns non-zero if the specified public key tokens
  #       match.  An empty string matches any public key token (including an
  #       empty string).
  #
  proc matchUpdatePublicKeyToken { publicKeyToken1 publicKeyToken2 } {
    if {[string length $publicKeyToken1] == 0} then {
      return true
    }

    if {[string length $publicKeyToken2] == 0} then {
      return true
    }

    return [expr {$publicKeyToken1 eq $publicKeyToken2}]
  }

  #
  # NOTE: This procedure returns non-zero if the specified product / update
  #       names match.  An empty string matches any name (including an empty
  #       string).
  #
  proc matchUpdateName { name1 name2 } {
    return [expr {[string length $name1] == 0 || $name1 eq $name2}]
  }

  #
  # NOTE: This procedure returns non-zero if the specified culture names
  #       match.  An empty string matches any culture name (including an
  #       empty string).
  #
  proc matchUpdateCulture { culture1 culture2 } {
    return [expr {[string length $culture1] == 0 || $culture1 eq $culture2}]
  }

  #
  # NOTE: This procedure returns non-zero if the specified public key token
  #       matches the one in use by the Eagle script engine.
  #
  proc matchEnginePublicKeyToken { publicKeyToken } {
    return [matchUpdatePublicKeyToken \
        $publicKeyToken [info engine PublicKeyToken]]
  }

  #
  # NOTE: This procedure returns non-zero if the specified product / update
  #       name matches the Eagle script engine.
  #
  proc matchEngineName { name } {
    return [matchUpdateName $name [info engine Name]]
  }

  #
  # NOTE: This procedure returns non-zero if the specified culture name
  #       matches the one in use by the Eagle script engine.
  #
  proc matchEngineCulture { culture } {
    return [matchUpdateCulture $culture [info engine Culture]]
  }

  #
  # NOTE: This procedure escapes the reserved characters in the specified
  #       update notes and returns the resulting string.
  #
  proc escapeUpdateNotes { notes } {
    #
    # NOTE: Escape any embedded tab and line-ending characters.
    #
    return [string map \
        [list & &amp\; \t &htab\; \v &vtab\; \n &lf\; \r &cr\;] $notes]
  }

  #
  # NOTE: This procedure unescapes reserved characters in the specified
  #       update notes and returns the resulting string.
  #
  proc unescapeUpdateNotes { notes } {
    #
    # NOTE: Unescape any embedded tab and line-ending characters.
    #
    return [string map \
        [list &htab\; \t &vtab\; \v &lf\; \n &cr\; \r &amp\; &] $notes]
  }

  #
  # NOTE: This procedure returns the list of arguments to be passed to the
  #       [uri download] call that performs the auto-update check.
  #
  proc getFetchUpdateArgs { name type directory metadata extension varName } {
    #
    # NOTE: Use a variable in the context of the caller to communicate the
    #       exact error condition, if any.
    #
    upvar 1 $varName error

    #
    # NOTE: Initially, set the result to an empty list to indicate
    #       unrecognized input.
    #
    set result [list]

    #
    # NOTE: Make sure the base URI is valid.
    #
    set baseUri [getDictionaryValue $metadata uri]

    if {[uri isvalid $baseUri]} then {
      #
      # NOTE: Make sure the base (product) name looks valid.
      #
      if {[regexp -nocase -- {^[0-9A-Z_]+$} $name]} then {
        #
        # NOTE: Make sure the patch level looks valid.
        #
        set patchLevel [getDictionaryValue $metadata patchLevel]

        if {[regexp -- {^\d+\.\d+\.\d+\.\d+$} $patchLevel]} then {
          #
          # NOTE: Make sure the directory is either empty or an existing
          #       valid directory.
          #
          if {[string length $directory] == 0 || \
              [file isdirectory $directory]} then {
            #
            # NOTE: Make sure the extension is supported.
            #
            if {$extension eq ".exe" || \
                $extension eq ".rar" || $extension eq ".zip"} then {
              #
              # NOTE: Start with URI components common to all release
              #       types.
              #
              set components [list $baseUri releases $patchLevel]

              #
              # NOTE: Next, figure out what type of download is being
              #       requested.
              #
              switch -exact -nocase -- $type {
                source -
                setup -
                binary {
                  #
                  # NOTE: *LEGACY* These release types only support the ".exe"
                  #       and ".rar" file extensions.  Of these, the ".exe" is
                  #       always preferred (on Windows), primarily because it
                  #       can be securely signed (via Authenticode).
                  #
                  if {$extension eq ".exe" || $extension eq ".rar"} then {
                    #
                    # HACK: Setup files, which are currently only for Windows,
                    #       must always have an ".exe" file extension.
                    #
                    if {[string tolower $type] eq "setup"} then {
                      set extension .exe
                    }

                    #
                    # NOTE: Source code, setup, or binary download.  This may
                    #       be a RAR or an EXE file.  Append the appropriate
                    #       file name and then join all the URI components to
                    #       form the final URI.
                    #
                    set fileName [appendArgs \
                        $name [string totitle $type] $patchLevel $extension]

                    lappend components $fileName

                    set result [list \
                        [eval uri join $components] [file join $directory \
                        $fileName]]
                  } else {
                    set error [appendArgs \
                        "file extension is unsupported for release type \"" \
                        $type \"]
                  }
                }
                plugin {
                  #
                  # NOTE: Since this release type must work on all platforms,
                  #       use of the ".zip" file extension is a requirement.
                  #
                  if {$extension eq ".zip"} then {
                    set fileName [appendArgs \
                        $name [string totitle $type] $patchLevel $extension]

                    lappend components $fileName

                    set result [list \
                        [eval uri join $components] [file join $directory \
                        $fileName]]
                  } else {
                    set error [appendArgs \
                        "file extension is unsupported for release type \"" \
                        $type \"]
                  }
                }
                default {
                  set error "release type is unsupported"
                }
              }
            } else {
              set error "file extension is unsupported"
            }
          } else {
            set error "directory is invalid"
          }
        } else {
          set error "patch level is invalid"
        }
      } else {
        set error "base name is invalid"
      }
    } else {
      set error "base URI is invalid"
    }

    return $result
  }

  #
  # NOTE: This procedure fetches an update package with the specified patch
  #       level and package type and then saves it to the specified local
  #       directory.
  #
  proc fetchUpdate {
          type publicKeyToken name culture patchLevel targetDirectory
          metadata varName } {
    #
    # NOTE: Figure out the appropriate file extension to download for this
    #       release type and platform.
    #
    if {[string tolower $type] eq "plugin"} then {
      #
      # NOTE: Plugin updates are always packaged as ZIP archives on all
      #       supported platforms.  There is no portable way to securely
      #       sign these files.  In general, these should be checked via
      #       OpenPGP signatures before being used.
      #
      set extension .zip
    } elseif {[isWindows]} then {
      #
      # NOTE: Otherwise, on Windows, prefer self-extracting executables,
      #       because they can be secure signed and trivially verified.
      #
      set extension .exe
    } else {
      #
      # NOTE: Otherwise, fallback to using RAR archives, which should be
      #       cross-platform.  There is no portable way to securely sign
      #       these files.  In general, these should also be checked via
      #       OpenPGP signatures before being used.
      #
      set extension .rar
    }

    #
    # NOTE: Build the necessary arguments for the download, optionally
    #       capturing them into a variable provided by the caller.
    #
    if {[string length $varName] > 0} then {
      upvar 1 $varName args
    }

    set args [getFetchUpdateArgs \
        $name $type $targetDirectory $metadata $extension error]

    if {[llength $args] > 0} then {
      #
      # NOTE: Start trusting ONLY our self-signed SSL certificate.
      #
      set trusted true

      if {[lindex [uri softwareupdates] end] eq "untrusted"} then {
        catch {uri softwareupdates true}
      } else {
        set trusted false; # NOTE: Already trusted.
      }

      try {
        #
        # NOTE: Download the file from the web site.
        #
        eval uri download $args; # synchronous.
      } finally {
        if {$trusted && \
            [lindex [uri softwareupdates] end] eq "trusted"} then {
          #
          # NOTE: Stop trusting ONLY our self-signed SSL certificate.
          #
          catch {uri softwareupdates false}
        }
      }

      #
      # NOTE: Return a result indicating what was done.
      #
      return [appendArgs \
          "downloaded URI " [lindex $args 0] " to directory \"" \
          $targetDirectory \"]
    } else {
      return [appendArgs "cannot fetch update: " $error]
    }
  }

  #
  # NOTE: This procedure runs the updater tool and then immediately exits the
  #       process.
  #
  proc runUpdateAndExit { {automatic false} {whatIf false} } {
    global tcl_platform

    #
    # NOTE: Determine the fully qualified file name for the updater.  If
    #       it is not available, we cannot continue.
    #
    set fileName [file join [file normalize \
        [file dirname [getShellExecutableName]]] Hippogriff.exe]

    if {![file exists $fileName]} then {
      error [appendArgs \
          "updater executable \"" $fileName "\" is not available"]
    }

    #
    # NOTE: If this procedure has been forbidden from actually running,
    #       return an error now.
    #
    if {[info exists ::no(runUpdateAndExit)]} then {
      error [appendArgs \
          "updater executable \"" $fileName "\" is manually forbidden"]
    }

    #
    # NOTE: Start out with just the base [exec] command, -shell option,
    #       and the end-of-options marker.
    #
    set command [list exec -shell --]

    #
    # NOTE: Add the necessary command line arguments to run the target
    #       file using the current runtime.
    #
    eval lappend command [getRuntimeCommandLine $fileName]

    #
    # NOTE: Add the base options to the updater executable.  Typically,
    #       this only includes the initial (mutex checking) delay.
    #
    lappend command -delay

    #
    # NOTE: Figure out the configured timeout value, if any.  If we fail,
    #       just fallback to the (legacy) default value.
    #
    if {[catch {info engine Timeout} timeout] == 0} then {
      lappend command $timeout
    } else {
      lappend command 2000; # COMPAT: Eagle beta.
    }

    #
    # HACK: The native StrongNameSignatureVerificationEx() function does
    #       not appear to work on WOA (Windows-on-ARM) on the Surface RT
    #       tablet; therefore, attempt to disable its use when calling
    #       into the updater on that platform.
    #
    if {[isWindows] && \
        [info exists tcl_platform(machine)] && \
        $tcl_platform(machine) eq "arm"} then {
      #
      # NOTE: We appear to be running on WOA (Windows-on-ARM), add the
      #       command line option that skips strong name verification.
      #
      lappend command -noStrongNameSigned true
    }

    #
    # NOTE: If requested, enable fully automatic update mode.
    #
    if {$automatic} then {
      lappend command -silent true -confirm false
    }

    set baseUri [getUpdateBaseUri]

    if {[string length $baseUri] > 0} then {
      lappend command -baseUri $baseUri
    }

    set pathAndQuery [getUpdatePathAndQuery]

    if {[string length $pathAndQuery] > 0} then {
      lappend command -tagPathAndQuery $pathAndQuery
    }

    if {$whatIf} then {
      return $command
    } else {
      eval $command &; exit -force
    }
  }

  #
  # NOTE: This procedure fetches an update file (based on a URI), saves it to
  #       a temporary directory, verifies its authenticity, extracts its files
  #       to another temporary directory, and then copies them to the target
  #       directory.
  #
  proc downloadAndExtractUpdate {
          type publicKeyToken name culture patchLevel targetDirectory
          metadata varName } {
    #
    # NOTE: Currently, this procedure will not work properly without the
    #       [object] command.
    #
    if {[llength [info commands object]] == 0} then {
      error "cannot update: missing \"object\" command"
    }

    #
    # NOTE: Attempt to load Eagle test package as it is required for its
    #       [getTemporaryPath] procedure.
    #
    package require Eagle.Test

    #
    # NOTE: Figure out where, underneath the temporary directory, the
    #       update file should be downloaded and extracted to.
    #
    set temporaryDirectory [file join \
        [getTemporaryPath] [appendArgs ea-tu-pb- [pid] - [string trim \
        [clock seconds] -]]]

    try {
      #
      # NOTE: Create outer temporary directory used by this procedure.
      #       This makes it easy to cleanup later as it will contain
      #       all other temporary directories and files created within
      #       this procedure.
      #
      file mkdir $temporaryDirectory

      #
      # NOTE: Create the temporary directory only used for fetching the
      #       update (archive?) file.
      #
      set fetchDirectory [file join $temporaryDirectory fetch]
      file mkdir $fetchDirectory

      #
      # NOTE: Actually fetch (download) the update (archive?) file from
      #       its built URI, saving it to a temporary directory created
      #       specially for this operation.  Optionally capture all the
      #       arguments used for the fetch operation into the variable
      #       specified by the caller.
      #
      if {[string length $varName] > 0} then {
        upvar 1 $varName fetchArgs
      }

      fetchUpdate $type $publicKeyToken $name $culture $patchLevel \
          $fetchDirectory $metadata fetchArgs

      #
      # NOTE: Grab the downloaded file name from the arguments returned
      #       by the fetch operation.
      #
      set archiveFileName [lindex $fetchArgs 1]

      #
      # NOTE: Match up the md5, sha1, and sha512 fields from the metadata
      #       and verify they match the fetched update (archive?) file.
      #
      if {[set md5 [string tolower [hash normal -filename md5 \
          $archiveFileName]]] ne [getDictionaryValue $metadata md5]} then {
        error [appendArgs \
            "cannot update: fetched update archive file \"" \
            $archiveFileName "\" has wrong MD5 hash, want \"" \
            [getDictionaryValue $metadata md5] "\", have \"" \
            $md5 \"]
      }

      if {[set sha1 [string tolower [hash normal -filename sha1 \
          $archiveFileName]]] ne [string tolower [getDictionaryValue \
          $metadata sha1]]} then {
        error [appendArgs \
            "cannot update: fetched update archive file \"" \
            $archiveFileName "\" has wrong SHA1 hash, want \"" \
            [getDictionaryValue $metadata sha1] "\", have \"" \
            $sha1 \"]
      }

      if {[set sha512 [string tolower [hash normal -filename sha512 \
          $archiveFileName]]] ne [string tolower [getDictionaryValue \
          $metadata sha512]]} then {
        error [appendArgs \
            "cannot update: fetched update archive file \"" \
            $archiveFileName "\" has wrong SHA512 hash, want \"" \
            [getDictionaryValue $metadata sha512] "\", have \"" \
            $sha512 \"]
      }

      #
      # NOTE: Create the temporary directory only used to contain the
      #       files extracted from the update (archive?) file.  These
      #       are the files that will be copied to the final target
      #       directory (after they have been fully verified).
      #
      set extractRootDirectory [file join $temporaryDirectory extract]
      file mkdir $extractRootDirectory

      #
      # NOTE: Attempt to load Eagle unzip package as it is required for
      #       the [extractZipArchive] procedure.
      #
      package require Eagle.Unzip

      #
      # NOTE: Extract the contents of the fetched update (archive?) file
      #       and then figure out the list of included content files.
      #
      set extractDirectory [extractZipArchive \
          $archiveFileName $extractRootDirectory true]

      if {![info exists ::no(deleteDownloadAndExtractUpdateFiles)]} then {
        catch {file delete $archiveFileName}; # NOTE: No longer needed.
      }

      set extractFileNames [object invoke System.IO.Directory GetFiles \
          $extractDirectory * AllDirectories]

      #########################################################################
      #################### PHASE 1: VERIFY EXTRACTED FILES ####################
      #########################################################################

      foreach extractFileName $extractFileNames {
        #
        # NOTE: Based on the extension of the extracted file, attempt to
        #       verify its contents (e.g. check signatures, etc).
        #
        switch -exact -nocase -- [file extension $extractFileName] {
          .dll -
          .exe {
            #
            # NOTE: Verify the Authenticode signature for the native
            #       executable file is intact.  This always applies,
            #       even when the executable file contains a managed
            #       assembly (i.e. with its strong name signature).
            #
            if {[catch {library certificate $extractFileName}]} then {
              error [appendArgs \
                  "cannot update: extracted native executable \"" \
                  $extractFileName "\" was not properly signed"]
            }

            #
            # HACK: If this platform does not appear to have access to
            #       the necessary native CLR API used to verify strong
            #       name signatures, just skip it.
            #
            if {[info exists ::eagle_platform(strongName)] && \
                [string is true -strict [getDictionaryValue \
                $::eagle_platform(strongName) verified]]} then {
              #
              # NOTE: Does the extracted executable actually contain a
              #       managed assembly?
              #
              if {[catch {
                object invoke System.Reflection.AssemblyName \
                    GetAssemblyName $extractFileName
              }] == 0} then {
                #
                # NOTE: Forcibly verify the strong name signature for
                #       the managed assembly is intact.
                #
                if {[catch {
                  object invoke -flags +NonPublic \
                      Eagle._Components.Private.RuntimeOps \
                      IsStrongNameVerified $extractFileName true
                } verified] == 0 && $verified} then {
                  #
                  # NOTE: Everything is properly signed, do nothing.
                  #
                } else {
                  error [appendArgs \
                      "cannot update: extracted managed assembly \"" \
                      $extractFileName "\" was not properly signed"]
                }
              }
            }
          }
          .eagle -
          .harpy -
          .pdb -
          .xml {
            #
            # NOTE: *SECURITY* These file types are allowed -AND- do not
            #       (currently) require any further verification.
            #
          }
          .rar -
          .zip {
            #
            # NOTE: *SECURITY* These file types are forbidden (for now),
            #       due to the potential for abuse.
            #
            error [appendArgs \
                "cannot update: extracted file \"" $extractFileName \
                "\" has forbidden file extension"]
          }
          default {
            #
            # NOTE: *SECURITY* Other file types are forbidden (for now),
            #       due to the potential for abuse.
            #
            error [appendArgs \
                "cannot update: extracted file \"" $extractFileName \
                "\" has unrecognized file extension"]
          }
        }
      }

      #########################################################################
      ################## PHASE 2: VERIFY RELATIVE FILE NAMES ##################
      #########################################################################

      #
      # NOTE: If we get to this point, all extracted files are verified.
      #       The only remaining thing to do is to copy them to the final
      #       target directory specified by the caller.
      #
      set extractDirectoryLength1 [expr {
        [string length $extractDirectory]
      }]

      set extractDirectoryLength2 [expr {
        $extractDirectoryLength1 - 1
      }]

      foreach extractFileName $extractFileNames {
        #
        # NOTE: Sanity-check that the (prefix) portion of the extracted file
        #       name matches the originally specified extract directory name.
        #
        if {[string range $extractFileName 0 \
            $extractDirectoryLength2] ne $extractDirectory} then {
          error [appendArgs \
              "bad extracted file name \"" $extractFileName \
              "\", not relative to the extract directory"]
        }

        #
        # NOTE: Sanity-check the first character of the calculated relative
        #       file name is a legal directory separator.
        #
        set relativeFileName [string range \
            $extractFileName $extractDirectoryLength1 end]

        if {[string index $relativeFileName 0] ni [list / \\]} then {
          error [appendArgs \
              "bad relative file name \"" $relativeFileName \
              "\", malformed, missing leading directory separator"]
        }
      }

      #########################################################################
      ################### PHASE 3: COPY TO TARGET DIRECTORY ###################
      #########################################################################

      foreach extractFileName $extractFileNames {
        #
        # NOTE: Grab the relative file name from the extracted file name.
        #       This exact relative file name was already sanity-checked
        #       in the previous phase.
        #
        set relativeFileName [string range \
            $extractFileName $extractDirectoryLength1 end]

        #
        # NOTE: Figure out final target file name using the final target
        #       directory and the relative file name for this extracted
        #       file.
        #
        set targetFileName [appendArgs \
            $targetDirectory $relativeFileName]

        #
        # NOTE: Just in case the target sub-directory does not exist yet,
        #       create it now.  Then, copy the extracted file to its final
        #       target sub-directory.
        #
        file mkdir [file dirname $targetFileName]
        file copy -force $extractFileName $targetFileName
      }

      #########################################################################
      ################### PHASE 4: MARK UPDATE AS INSTALLED ###################
      #########################################################################

      #
      # NOTE: The update should now be "installed".  Mark it as such.
      #
      markUpdateInstalled [makeUpdateId $type $publicKeyToken $name \
          $culture $patchLevel] true "" $targetDirectory
    } finally {
      #
      # NOTE: Completely delete the outer temporary directory, which will
      #       cleanup the fetched update (archive?) file name and all the
      #       files subsequently extracted from the archive.
      #
      if {![info exists ::no(deleteDownloadAndExtractUpdateFiles)]} then {
        catch {file delete -recursive -- $temporaryDirectory}
      }
    }
  }

  #
  # NOTE: This procedure returns the base URI that should be used to check
  #       for available updates.
  #
  proc getUpdateBaseUri { {refresh ""} } {
    #
    # NOTE: Does the caller want to force a choice between the current and
    #       default base URI?
    #
    if {[string length $refresh] > 0} then {
      #
      # NOTE: Return the specified base URI for updates.
      #
      return [info engine UpdateBaseUri $refresh]
    } else {
      #
      # NOTE: Check the current base URI for updates against the one baked
      #       into the assembly.  If they are different, then the base URI
      #       must have been overridden.  In that case, we must return the
      #       current base URI; otherwise, we must return an empty string.
      #
      set baseUri(0) [info engine UpdateBaseUri false]; # NOTE: Current.
      set baseUri(1) [info engine UpdateBaseUri true];  # NOTE: Default.

      if {[string length $baseUri(0)] > 0 && \
          [string length $baseUri(1)] > 0} then {
        #
        # NOTE: Ok, they are both valid.  Are they different?
        #
        if {$baseUri(0) ne $baseUri(1)} then {
          return $baseUri(0)
        }
      }

      return ""
    }
  }

  #
  # NOTE: This procedure returns the path and query portions of the URI that
  #       should be used to check for available updates.
  #
  proc getUpdatePathAndQuery { {refresh ""} } {
    #
    # NOTE: Does the caller want to force a choice between the current and
    #       default tag path and query?
    #
    if {[string length $refresh] > 0} then {
      #
      # NOTE: Return the specified tag path and query for updates.
      #
      return [info engine UpdatePathAndQuery $refresh]
    } else {
      #
      # NOTE: Check the current tag path and query for updates against the
      #       one baked into the assembly.  If they are different, then the
      #       tag path and query must have been overridden.  In that case,
      #       we must return the current tag path and query; otherwise, we
      #       must return an empty string.
      #
      set pathAndQuery(0) [info engine UpdatePathAndQuery \
          false]; # NOTE: Current.

      set pathAndQuery(1) [info engine UpdatePathAndQuery \
          true];  # NOTE: Default.

      if {[string length $pathAndQuery(0)] > 0 && \
          [string length $pathAndQuery(1)] > 0} then {
        #
        # NOTE: Ok, they are both valid.  Are they different?
        #
        if {$pathAndQuery(0) ne $pathAndQuery(1)} then {
          return $pathAndQuery(0)
        }
      }

      return ""
    }
  }

  #
  # NOTE: This procedure downloads the available update data and returns it
  #       verbatim.
  #
  proc getUpdateData { uri } {
    #
    # NOTE: Figure out the configured timeout value, if any.  If we fail,
    #       just fallback to the (legacy) default value.
    #
    if {[catch {info engine NetworkTimeout} timeout]} then {
      set timeout 2000; # COMPAT: Eagle beta.
    }

    #
    # NOTE: Start trusting ONLY our own self-signed SSL certificate.
    #
    set trusted true

    if {[lindex [uri softwareupdates] end] eq "untrusted"} then {
      catch {uri softwareupdates true}
    } else {
      set trusted false; # NOTE: Already trusted.
    }

    try {
      #
      # NOTE: Download the tag file from the web site.
      #
      return [uri download -timeout $timeout -inline $uri]; # synchronous.
    } finally {
      if {$trusted && \
          [lindex [uri softwareupdates] end] eq "trusted"} then {
        #
        # NOTE: Stop trusting ONLY our own self-signed SSL certificate.
        #
        catch {uri softwareupdates false}
      }
    }
  }

  #
  # NOTE: This procedure downloads an update script and then returns it
  #       verbatim.
  #
  proc getUpdateScriptData { uri } {
    #
    # NOTE: Start trusting ONLY our own self-signed SSL certificate.
    #
    set trusted true

    if {[lindex [uri softwareupdates] end] eq "untrusted"} then {
      catch {uri softwareupdates true}
    } else {
      set trusted false; # NOTE: Already trusted.
    }

    try {
      #
      # NOTE: Download the script file from the web site.
      #
      return [interp readorgetscriptfile -- "" $uri]; # synchronous.
    } finally {
      if {$trusted && \
          [lindex [uri softwareupdates] end] eq "trusted"} then {
        #
        # NOTE: Stop trusting ONLY our own self-signed SSL certificate.
        #
        catch {uri softwareupdates false}
      }
    }
  }

  #
  # NOTE: This procedure returns the base URI that should be used to download
  #       available updates, if a specific base URI is not specified via the
  #       manifest of available updates.
  #
  proc getDownloadBaseUri {} {
    #
    # NOTE: Just return the current base URI for downloads.
    #
    return [info engine DownloadBaseUri]; # NOTE: Current.
  }

  #
  # NOTE: This procedure returns the base URI that should be used to download
  #       available scripts, if a specific base URI is not specified via the
  #       manifest of available scripts.
  #
  proc getScriptBaseUri {} {
    #
    # NOTE: Just return the current base URI for scripts.
    #
    return [info engine ScriptBaseUri]; # NOTE: Current.
  }

  #
  # NOTE: This procedure returns the base URI that should be used to download
  #       auxiliary data.
  #
  proc getAuxiliaryBaseUri {} {
    #
    # NOTE: Just return the current base URI for auxiliary data.
    #
    return [info engine AuxiliaryBaseUri]; # NOTE: Current.
  }

  #
  # NOTE: This procedure is used to check for new versions -OR- new update
  #       scripts for the runtime when a user executes the interactive
  #       "#check" command.  To disable this functionality, simply redefine
  #       this procedure to do nothing.
  #
  proc checkForEngine {
          {wantScripts false} {quiet false} {prompt false}
          {automatic false} } {
    return [checkForUpdate \
        "" "" "" "" "" "" "" $wantScripts $quiet $prompt $automatic]
  }

  #
  # NOTE: This procedure is used to check for new versions of a plugin just
  #       prior to it being loaded into an interpreter (when an appropriate
  #       flag is enabled).  To disable this functionality, simply redefine
  #       this procedure to do nothing.
  #
  proc checkForPlugin {
          {uri ""} {publicKeyToken ""} {name ""} {culture ""}
          {patchLevel ""} {timeStamp ""} {wantScripts false}
          {quiet false} {prompt false} {automatic false} } {
    return [checkForUpdate \
        plugin $uri $publicKeyToken $name $culture $patchLevel \
        $timeStamp $wantScripts $quiet $prompt $automatic]
  }

  #
  # NOTE: This procedure is used to check for new versions -OR- new update
  #       scripts for the runtime when a user executes the interactive
  #       "#check" command.  To disable this functionality, simply redefine
  #       this procedure to do nothing.
  #
  proc checkForUpdate {
          {type ""} {uri ""} {publicKeyToken ""} {name ""} {culture ""}
          {patchLevel ""} {timeStamp ""} {wantScripts false} {quiet false}
          {prompt false} {automatic false} } {
    #
    # NOTE: First, set default channel for update script status messages.
    #       If the test channel has been set (i.e. by the test suite), it
    #       will be used instead.
    #
    set channel [expr {
      [info exists ::test_channel] ? $::test_channel : "stdout"
    }]

    #
    # NOTE: First of all, what type of update are we checking?  Possible
    #       values for this include "build", "plugin", "script", et al.
    #       These mirror the values of the UpdateType enumeration.
    #
    if {[string length $type] > 0} then {
      #
      # NOTE: Use the update type specified by the caller directly.  In
      #       the future, perhaps sanity check this?  Currently, its use
      #       is entirely cosmetic.
      #
      set updateType $type
    } else {
      #
      # NOTE: Default to the legacy update type of "build".  Currently,
      #       this is only used to construct messages to be displayed to
      #       the user.
      #
      set updateType build; # LEGACY
    }

    #
    # NOTE: Did the caller directly specify a URI to use?
    #
    if {[string length $uri] > 0} then {
      #
      # NOTE: If the caller specified a URI, it must be fully qualified.
      #       It will be used verbatim.
      #
      set updateBaseUri $uri

      #
      # NOTE: Assume that the URI refers to the latest available version
      #       of the specified product.
      #
      set updateUriType latest; # TODO: Good default?

      #
      # NOTE: If the caller specified a URI, it must be fully qualified.
      #       It will be used verbatim.
      #
      set updateUri $updateBaseUri
    } else {
      #
      # NOTE: Grab the (current) base URI for updates.
      #
      set updateBaseUri [getUpdateBaseUri false]

      #
      # NOTE: Grab the (current) update path and query string used for
      #       updates.
      #
      set updatePathAndQuery [getUpdatePathAndQuery false]

      #
      # TODO: Exract the URI type (e.g. "stable" or "latest") from the
      #       update path and query.  This code may need to be modified
      #       in the future.
      #
      set updateUriType [lindex [split $updatePathAndQuery .] 0]

      #
      # NOTE: Combine them to form the complete update URI.
      #
      set updateUri [appendArgs $updateBaseUri $updatePathAndQuery]
    }

    #
    # NOTE: Did the caller directly specify a public key token to use?
    #
    if {[string length $publicKeyToken] > 0} then {
      #
      # NOTE: Use the public key token specified by the caller to match
      #       against.
      #
      set updatePublicKeyToken $publicKeyToken
    } else {
      #
      # NOTE: Use the public key token of the script engine to match
      #       against.
      #
      set updatePublicKeyToken [info engine PublicKeyToken]
    }

    #
    # NOTE: Did the caller directly specify a (product) name to use?  In
    #       almost all cases, this will be the base name of the manifest
    #       assembly associated with the product.
    #
    if {[string length $name] > 0} then {
      #
      # NOTE: Use the (product) name specified by the caller to match
      #       against.
      #
      set updateName $name
    } else {
      #
      # HACK: The [getKnownBuildTypes] procedure is required to validate
      #       the build type against the engine text attribute.
      #
      if {[catch {
        package require Eagle.Test.Constraints
      } error] == 0} then {
        set engineTextOrSuffix [info engine TextOrSuffix]

        if {$engineTextOrSuffix ni [list "" Default] && \
            $engineTextOrSuffix ni [getKnownBuildTypes]} then {
          if {!$quiet} then {
            tqputs $channel [appendArgs \
                "---- ignored unknown build type: " \
                $engineTextOrSuffix \n]
          }

          set engineTextOrSuffix ""; # invalid, do not use.
        }
      } else {
        if {!$quiet} then {
          tqputs $channel [appendArgs \
              "---- known build types unavailable: " $error \n]
        }

        set engineTextOrSuffix ""; # cannot check, do not use.
      }

      #
      # NOTE: Use assembly name of the script engine to match against.
      #
      set engineName [info engine Name]

      if {[string length $engineName] > 0} then {
        if {[string length $engineTextOrSuffix] > 0 && \
            $engineTextOrSuffix ni [list Default NetFx20]} then {
          set updateName [appendArgs \
              $engineName _ $engineTextOrSuffix]; # NetFx40, etc.
        } else {
          set updateName $engineName; # NetFx20
        }
      } else {
        if {[string length $engineTextOrSuffix] > 0} then {
          set updateName [appendArgs \
              Eagle_ $engineTextOrSuffix]; # LEGACY NetFx40, etc.
        } else {
          set updateName Eagle; # LEGACY
        }
      }
    }

    #
    # NOTE: Did the caller directly specify a culture name to use?  In
    #       almost all cases, this will be the invariant culture.
    #
    if {[string length $culture] > 0} then {
      #
      # NOTE: Use the culture name specified by the caller to match
      #       against.
      #
      set updateCulture $culture
    } else {
      #
      # NOTE: Use culture name of the script engine to match against.
      #
      set updateCulture [info engine Culture]
    }

    #
    # NOTE: Did the caller directly specify a patch level to use?
    #
    if {[string length $patchLevel] > 0} then {
      #
      # NOTE: Use the patch level specified by the caller to compare
      #       against versions available on the server.
      #
      set updatePatchLevel $patchLevel
    } else {
      #
      # NOTE: Use patch level of the script engine to compare against
      #       versions available on the server.
      #
      set updatePatchLevel [info engine PatchLevel]
    }

    #
    # NOTE: Did the caller directly specify a timestamp to use?  As of
    #       this writing (2019-05-10) this is only used to construct an
    #       information message to the user.
    #
    if {[string length $timeStamp] > 0} then {
      #
      # NOTE: Use the timestamp specified by the caller.
      #
      set updateTimeStamp $timeStamp
    } else {
      #
      # NOTE: Use timestamp of the script engine.
      #
      set updateTimeStamp [info engine TimeStamp]
    }

    if {[string length $updateTimeStamp] == 0} then {
      #
      # NOTE: This will end up displaying as the Unix epoch, which would
      #       be January 1st, 1970 at midnight (UTC).
      #
      set updateTimeStamp 0; #never?
    }

    #
    # NOTE: What should the DateTime format be for display?  This should
    #       be some variation on ISO-8601.
    #
    set dateTimeFormat yyyy-MM-ddTHH:mm:ss

    #
    # NOTE: Does it look like the number of seconds since the epoch -OR-
    #       some kind of date/time string?
    #
    if {[string is integer -strict $updateTimeStamp]} then {
      set updateDateTime [clock format \
          $updateTimeStamp -format $dateTimeFormat]
    } else {
      set updateDateTime [clock format \
          [clock scan $updateTimeStamp] -format $dateTimeFormat]
    }

    #
    # NOTE: Fetch the update data from the configured distribution site
    #       and normalize to Unix-style line-endings.
    #
    set updateData [string map [list \r\n \n] [getUpdateData $updateUri]]

    #
    # NOTE: Split the data into lines.  Given the previous command, this
    #       will always use Unix-style line-endings.
    #
    set lines [split $updateData \n]

    #
    # NOTE: Keep track of how many update scripts are processed -AND- their
    #       associated (final) dispositions.
    #
    array set scriptCounts {
      invalid              0 fail                 0 bad                  0
      ok                   0 error                0 match                0
    }

    #
    # NOTE: Check each update line to find the build information...  Lines
    #       that do not conform to the correct format should be skipped.
    #
    foreach line $lines {
      #
      # NOTE: Remove surrounding spaces (but not tabs), skip blank lines
      #       and comment lines.
      #
      set line [string trim $line " "]
      if {[string length $line] == 0} then {continue}

      set char [string index $line 0]
      if {$char eq "#" || $char eq ";"} then {continue}

      #
      # NOTE: Split the tab-delimited line into its fields.  The format of
      #       all lines in the data must be as follows, all on the same
      #       line:
      #
      #       <startLine> protocolId <tab> publicKeyToken <tab> name <tab>
      #       culture <tab> patchLevel <tab> timeStamp <tab> baseUri <tab>
      #       md5Hash <tab> sha1Hash <tab> sha512Hash <tab> notes <newLine>
      #
      set fields [split $line \t]
      if {[llength $fields] < 11} then {continue}

      #
      # NOTE: Grab the protocol Id field.
      #
      set field(protocolId) [lindex $fields 0]

      #
      # NOTE: Grab the public key token field.
      #
      set field(publicKeyToken) [lindex $fields 1]

      #
      # NOTE: Grab the (product) name field.
      #
      set field(name) [lindex $fields 2]

      #
      # NOTE: Grab the culture field.
      #
      set field(culture) [lindex $fields 3]

      #
      # NOTE: Figure out which protocol is in use for this line.  The value
      #       "1" means this line specifies a build of the script engine.
      #       The value "2" means this line specifies an update script (via
      #       a URI) to evaluate.  The value "3" means this line specifies
      #       a build of the GUI updater tool (not handled by this script).
      #       The value "4" means this line specifies a build of a (binary)
      #       plugin.  All other values are currently reserved and ignored.
      #
      set checkBuild [expr {
        !$wantScripts && $field(protocolId) eq "1"
      }]

      set checkScript [expr {
        $wantScripts && $field(protocolId) eq "2"
      }]

      set checkSelf [expr {
        !$wantScripts && $field(protocolId) eq "3"
      }]

      set checkPlugin [expr {
        !$wantScripts && $field(protocolId) eq "4"
      }]

      #
      # NOTE: We only want to find the first line that matches our target.
      #       The public key token is being used here to make sure we get
      #       the same build "flavor" of the script engine -OR- the binary
      #       plugin vendor / identity.  These lines are organized so that
      #       the "latest stable version" should be on the first line (for
      #       a given public key token) and may be followed by development
      #       / experimental versions, etc.  Prior to checking patch level
      #
      #
      if {($checkBuild || $checkScript || $checkPlugin) && \
          [matchUpdatePublicKeyToken \
              $field(publicKeyToken) $updatePublicKeyToken] && \
          [matchUpdateName $field(name) $updateName] && \
          [matchUpdateCulture $field(culture) $updateCulture]} then {
        #
        # NOTE: Keep track that another line was matched.
        #
        incr scriptCounts(match)

        #
        # NOTE: Grab the patch level field.
        #
        set field(patchLevel) [lindex $fields 4]

        if {[string length $field(patchLevel)] == 0} then {
          set field(patchLevel) 0.0.0.0; # no patch level?
        }

        #
        # NOTE: Grab the time-stamp field.
        #
        set field(timeStamp) [lindex $fields 5]

        if {[string length $field(timeStamp)] == 0} then {
          set field(timeStamp) 0; #never?
        }

        #
        # NOTE: What should the DateTime format be for display?  This
        #       should be some variation on ISO-8601.
        #
        set dateTimeFormat yyyy-MM-ddTHH:mm:ss

        #
        # NOTE: Does it look like the number of seconds since the epoch
        #       or some kind of date/time string?
        #
        if {[string is integer -strict $field(timeStamp)]} then {
          set field(dateTime) [clock format \
              $field(timeStamp) -format $dateTimeFormat]
        } else {
          set field(dateTime) [clock format \
              [clock scan $field(timeStamp)] -format $dateTimeFormat]
        }

        #
        # NOTE: For build lines, compare the patch level from the line
        #       to the one we are currently using using a simple patch
        #       level comparison.
        #
        if {$checkBuild || $checkPlugin} then {
          #
          # NOTE: Compare patch level from this line against the one
          #       associated with the target product.
          #
          set compare [package \
              vcompare $field(patchLevel) $updatePatchLevel]
        } else {
          #
          # NOTE: This is not a build line, no match.
          #
          set compare -1; # force less than as fake result
        }

        #
        # NOTE: For script lines, use regular expression matching.
        #
        if {$checkScript} then {
          #
          # NOTE: Use [catch] here to prevent raising a script error due
          #       to a malformed patch level regular expression.
          #
          if {[catch {
            regexp -nocase -- $field(patchLevel) $updatePatchLevel
          } match]} then {
            #
            # NOTE: The patch level from the script line was most likely
            #       not a valid regular expression.
            #
            set match false
          }
        } else {
          #
          # NOTE: This is not a script line, so no match.
          #
          set match false
        }

        #
        # NOTE: Are we interested in further processing this line?
        #
        # HACK: For plugins, process any line for the current patch
        #       level -OR- higher.
        #
        if {($checkBuild && $compare > 0) ||
            ($checkScript && $match) ||
            ($checkPlugin && $compare > 0) ||
            ($checkPlugin && $compare == 0 && \
             ![isUpdateInstalled [makeUpdateId Plugin $field(publicKeyToken) \
             $field(name) $field(culture) $field(patchLevel)]])} then {
          #
          # NOTE: Grab the base URI field (i.e. may be a mirror site).
          #       Then, if set, use it as the base URI for the build
          #       and/or script.  Fallback to using the default base
          #       URI for builds (or scripts) when the base URI field
          #       is not present.
          #
          set field(baseUri) [lindex $fields 6]

          if {$checkBuild || $checkPlugin} then {
            if {[string length $field(baseUri)] > 0} then {
              set buildUri $field(baseUri)
            } else {
              set buildUri [getDownloadBaseUri]; # primary site.
            }
          }

          if {$checkScript} then {
            if {[string length $field(baseUri)] > 0} then {
              set scriptUri $field(baseUri)
            } else {
              set scriptUri [getScriptBaseUri]; # primary site.
            }
          }

          #
          # NOTE: Grab the md5, sha1, and sha512 fields.  These will only
          #       be used (and validated) if a script update is processed
          #       (below).  However, they will always be included in the
          #       result if the build is a later version.
          #
          set field(md5) [lindex $fields 7]
          set field(sha1) [lindex $fields 8]
          set field(sha512) [lindex $fields 9]

          #
          # NOTE: Grab the notes field (which may be empty) and unescape
          #       any reserved characters within it.  The notes may end
          #       up being included in the result returned to the caller
          #       and in that case they will be [list] escaped instead.
          #
          set field(notes) [lindex $fields 10]

          if {[string length $field(notes)] > 0} then {
            set field(notes) [unescapeUpdateNotes $field(notes)]
          }

          #
          # NOTE: The update patch level from the line is greater, we
          #       are out-of-date.  Return the result of our checking
          #       now.
          #
          if {$checkBuild || $checkPlugin} then {
            #
            # NOTE: Are we supposed to prompt the interactive user, if
            #       any, to upgrade now?
            #
            set text [appendArgs \
                $updateUriType " " $updateType " " \
                $field(patchLevel) ", dated " $field(dateTime) \
                ", is newer than the running " $updateType " " \
                $updatePatchLevel ", dated " $updateDateTime \
                ", based on the data from " $updateBaseUri]

            if {$prompt && [isInteractive]} then {
              #
              # NOTE: Is the [object] command available?  If not, this
              #       cannot be done.
              #
              if {[llength [info commands object]] > 0} then {
                #
                # BUGFIX: Only prompt to run the updater tool if this is
                #         the default AppDomain for the process -AND- it
                #         is the first Interpreter in that AppDomain.
                #
                if {[object invoke Utility IsDefaultAppDomain] && \
                    [object invoke -flags +NonPublic \
                    Eagle._Components.Private.GlobalState \
                    IsFirstInterpreter ""]} then {
                  #
                  # BUGFIX: Do not bother with this if the updater tool
                  #         is unavailable -OR- is manually forbidden.
                  #         This is checked by using what-if parameter
                  #         for the [runUpdateAndExit] procedure.
                  #
                  if {[catch {
                    runUpdateAndExit $automatic true
                  } result] == 0} then {
                    if {!$quiet} then {
                      tqputs $channel [appendArgs \
                          "---- updater executable command line: " \
                          $result \n]
                    }

                    set messageCaption [appendArgs \
                        [info engine Name] " (" [lindex [info level 0] 0] \
                        " script)"]

                    set messageText [appendArgs \
                        "The " $text \n\n "Run the updater tool now?"]

                    if {$automatic} then {
                      append messageText \n\n \
                          "WARNING: The updater tool process will be " \
                          "run in automatic mode and there will be no " \
                          "further prompts."
                    }

                    if {[object invoke -flags +NonPublic \
                        Eagle._Components.Private.WindowOps YesOrNo \
                        $messageText $messageCaption false]} then {
                      #
                      # NOTE: Ok, run the updater tool now and then exit.
                      #
                      runUpdateAndExit $automatic
                    }
                  }
                }
              }
            }

            #
            # NOTE: If we get to this point, the user has opted to not run
            #       the updater tool -OR- it cannot be run for some reason.
            #
            return [list \
                $text [list uri $buildUri patchLevel $field(patchLevel) \
                notes $field(notes) md5 $field(md5) sha1 $field(sha1) \
                sha512 $field(sha512)]]
          }

          #
          # NOTE: The script patch level from this line matches the current
          #       engine patch level exactly.  Therefore, the script should
          #       be evaluated if it can be authenticated.
          #
          if {$checkScript} then {
            #
            # NOTE: Next, verify the script has a valid base URI.  For update
            #       scripts, this must be the location where the update script
            #       data can be downloaded.
            #
            if {[string length $scriptUri] == 0} then {
              if {!$quiet} then {
                tqputs $channel [appendArgs \
                    "---- invalid baseUri value for update script " \
                    "line: " $line \n]
              }

              incr scriptCounts(invalid); continue
            }

            #
            # NOTE: Next, grab md5 field and see if it looks valid.  Below,
            #       the value of this field will be compared to that of the
            #       actual MD5 hash of the downloaded script data.
            #
            if {[string length $field(md5)] == 0} then {
              if {!$quiet} then {
                tqputs $channel [appendArgs \
                    "---- invalid md5 value for update script " \
                    "line: " $line \n]
              }

              incr scriptCounts(invalid); continue
            }

            #
            # NOTE: Next, grab sha1 field and see if it looks valid.  Below,
            #       the value of this field will be compared to that of the
            #       actual SHA1 hash of the downloaded script data.
            #
            if {[string length $field(sha1)] == 0} then {
              if {!$quiet} then {
                tqputs $channel [appendArgs \
                    "---- invalid sha1 value for update script " \
                    "line: " $line \n]
              }

              incr scriptCounts(invalid); continue
            }

            #
            # NOTE: Next, grab sha512 field and see if it looks valid.  Below,
            #       the value of this field will be compared to that of the
            #       actual SHA512 hash of the downloaded script data.
            #
            if {[string length $field(sha512)] == 0} then {
              if {!$quiet} then {
                tqputs $channel [appendArgs \
                    "---- invalid sha512 value for update script " \
                    "line: " $line \n]
              }

              incr scriptCounts(invalid); continue
            }

            #
            # NOTE: Next, show the extra information associated with this
            #       update script, if any.
            #
            if {!$quiet} then {
              tqputs $channel [appendArgs \
                  "---- fetching update script from \"" $scriptUri \
                  "\" (" $field(dateTime) ") with notes:\n"]

              set trimNotes [string trim $field(notes)]

              tqputs $channel [appendArgs \
                  [expr {[string length $trimNotes] > 0 ? $trimNotes : \
                  "<none>"}] "\n---- end of update script notes\n"]
            }

            #
            # NOTE: Next, attempt to fetch the update script data.
            #
            set code [catch {getUpdateScriptData $scriptUri} result]

            if {$code == 0} then {
              #
              # NOTE: Success, set the script data from the result.
              #
              set scriptData $result
            } else {
              #
              # NOTE: Failure, report the error message to the log.
              #
              if {!$quiet} then {
                tqputs $channel [appendArgs \
                    "---- failed to fetch update script: " $result \n]
              }

              incr scriptCounts(fail); continue
            }

            #
            # NOTE: Next, verify that the md5, sha1, and sha512 hashes of
            #       the raw script data match what was specified in the
            #       md5, sha1, and sha512 fields.
            #
            set md5 [hash normal md5 $scriptData]

            if {![string equal -nocase $field(md5) $md5]} then {
              if {!$quiet} then {
                tqputs $channel [appendArgs \
                    "---- wrong md5 value \"" $md5 \
                    "\" for update script line: " $line \n]
              }

              incr scriptCounts(bad); continue
            }

            set sha1 [hash normal sha1 $scriptData]

            if {![string equal -nocase $field(sha1) $sha1]} then {
              if {!$quiet} then {
                tqputs $channel [appendArgs \
                    "---- wrong sha1 value \"" $sha1 \
                    "\" for update script line: " $line \n]
              }

              incr scriptCounts(bad); continue
            }

            set sha512 [hash normal sha512 $scriptData]

            if {![string equal -nocase $field(sha512) $sha512]} then {
              if {!$quiet} then {
                tqputs $channel [appendArgs \
                    "---- wrong sha512 value \"" $sha512 \
                    "\" for update script line: " $line \n]
              }

              incr scriptCounts(bad); continue
            }

            #
            # NOTE: Everything looks good.  Therefore, evaluate the update
            #       script and print the result.
            #
            if {!$quiet} then {
              tqputs $channel [appendArgs \
                  "---- evaluating update script from \"" $scriptUri \
                  \"...\n]
            }

            #
            # NOTE: Reset the variables that will be used to contain the
            #       result of the update script.
            #
            set code 0; set result ""

            #
            # NOTE: Must manually override the file name to be returned by
            #       [info script] to refer back to the original script base
            #       URI.
            #
            set pushed false

            if {[llength [info commands object]] > 0} then {
              object invoke -flags +NonPublic Interpreter.GetActive \
                  PushScriptLocation $scriptUri true pushed
            }

            try {
              #
              # NOTE: Evaluate the update script in the context of the
              #       caller.
              #
              set code [catch {uplevel 1 $scriptData} result]
            } finally {
              if {[llength [info commands object]] > 0} then {
                #
                # NOTE: Reset manual override of the script file name to
                #       be returned by [info script].
                #
                object invoke -flags +NonPublic Interpreter.GetActive \
                    PopScriptLocation true pushed
              }
            }

            #
            # NOTE: Keep track of number of update scripts that generate
            #       Ok and Error return codes.
            #
            if {$code == 0} then {
              incr scriptCounts(ok)
            } else {
              incr scriptCounts(error)
            }

            if {!$quiet} then {
              host result $code $result
              tqputs $channel "\n---- end of update script results\n"
            }
          }
        } elseif {($checkBuild || $checkPlugin) && $compare < 0} then {
          #
          # NOTE: The patch level from the line is less, we are more
          #       up-to-date than the latest version?
          #
          return [list [appendArgs \
              "running " $updateType " " $updatePatchLevel ", dated " \
              $updateDateTime ", is newer than the " $updateUriType " " \
              $updateType " " $field(patchLevel) ", dated " \
              $field(dateTime) ", based on the data " "from " \
              $updateBaseUri]]
        } elseif {$checkBuild || $checkPlugin} then {
          #
          # NOTE: The patch levels are equal, we are up-to-date.
          #
          return [list [appendArgs \
              "running " $updateType " " $updatePatchLevel ", dated " \
              $updateDateTime ", is the " $updateUriType " " $updateType \
              ", based on the data from " $updateBaseUri]]
        }
      }
    }

    #
    # NOTE: Figure out what the final result should be.  If we get to this
    #       point when checking for a new build, something must have gone
    #       awry.  Otherwise, report the number of update scripts that were
    #       successfully processed.
    #
    if {$wantScripts} then {
      set scriptCounts(total) [expr [join [array values scriptCounts] +]]

      if {$scriptCounts(total) > 0} then {
        return [list [appendArgs \
            "processed " $scriptCounts(total) " update scripts: " [array \
            get scriptCounts]]]
      } else {
        return [list "no update scripts were processed"]
      }
    } else {
      if {$scriptCounts(match) > 0} then {
        set error [appendArgs \
            "matched " $scriptCounts(match) " running " $updateType \
            "; however, none was fully processed"]
      } else {
        set error [appendArgs \
            "missing public key token \"" $updatePublicKeyToken "\", " \
            $updateType " name \"" $updateName "\", and culture \"" \
            $updateCulture \"]
      }

      return [list [appendArgs \
          "could not determine if running " $updateType " is the latest " \
          $updateType ": " $error]]
    }
  }

  #
  # NOTE: Provide the Eagle "update" package to the interpreter.
  #
  package provide Eagle.Update \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Eagle1.0/vendor.eagle.











































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
###############################################################################
#
# vendor.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Vendor Initialization File for System.Data.SQLite
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# STUB: This script file is a placeholder.  This file, when present, is always
#       evaluated when an interpreter is initialized.  Vendors distributing
#       Eagle can place custom application-specific, interpreter-specific
#       initialization and/or customizations in here.  Additionally, this file
#       may contain per-interpreter customizations required when porting to
#       new platforms, operating systems, etc.
#

###############################################################################
############################## BEGIN VENDOR CODE ##############################
###############################################################################
#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  if {[isEagle]} then {
    #
    # NOTE: This procedure is designed to make it easy to use strings from
    #       the various batch tools that may contain characters or strings
    #       that cannot be (easily) escaped in Win32 batch files.
    #
    proc setToolVariables {} {
      #
      # NOTE: This [regexp] pattern is used by the "build_nuget.bat" batch
      #       tool.
      #
      set ::nuget_version_pattern {<version>(\d+\.\d+\.\d+\.\d+)</version>}
    }

    proc checkForVendorQuiet { {name ""} } {
      if {![interp issafe]} then {
        if {[info exists ::env(checkForVendorQuiet)]} then {
          return true
        }

        if {[string length $name] > 0} then {
          set envVarName [appendArgs quiet [string toupper \
              [string index $name 0]] [string range $name 1 end]]

          if {[info exists ::env($envVarName)]} then {
            return true
          }
        }
      }

      return false
    }

    proc checkForTestOverrides { channel varNames quiet } {
      set result 0

      foreach varName $varNames {
        if {![uplevel 1 [list info exists $varName]]} then {
          continue
        }

        incr result

        if {!$quiet} then {
          catch {
            tqputs $channel [appendArgs \
                "---- found vendor-specific test override \"" $varName \
                "\" with value \"" [uplevel 1 [list set $varName]] \"\n]
          }
        }
      }

      #
      # NOTE: Keep track of the list of test override variables, for later
      #       use by the test suite.  This needs to be done after the loop
      #       above because the variable used to keep track is listed with
      #       the other possible test override variables.
      #
      if {![uplevel 1 [list info exists test_overrides]]} then {
        uplevel 1 [list set test_overrides $varNames]
      }

      return $result
    }

    proc refreshAutoPath {} {
      if {[llength [info commands debug]] > 0 && \
          [llength [info subcommands debug refreshautopath]] > 0 && \
          [catch {debug refreshautopath true}] == 0} then {
        return debug
      }

      if {[llength [info commands object]] > 0 && \
          [catch {object invoke Utility RefreshAutoPathList true}] == 0} then {
        return object
      }

      return ""
    }

    proc addTestSuiteToAutoPath { channel varName quiet } {
      #
      # NOTE: Start with the directory containing this file.
      #
      set dir [file normalize [file dirname [info script]]]

      #
      # NOTE: Keep going until the directory name is empty OR is actually the
      #       root of the associated volume.
      #
      while {[string length $dir] > 0 && \
          [lsearch -exact -nocase -- [file volumes] $dir] == -1} {
        #
        # NOTE: Set the sub-directory where the package index file should
        #       be located within the directory to be searched.
        #
        set dir2 [file join lib System.Data.SQLite]

        #
        # NOTE: Does this directory have the necessary sub-directory that
        #       contains a package index file?
        #
        if {[file exists [file join $dir $dir2]] && \
            [file isdirectory [file join $dir $dir2]] && \
            [file exists [file join $dir $dir2 pkgIndex.eagle]] && \
            [file isfile [file join $dir $dir2 pkgIndex.eagle]]} then {
          #
          # NOTE: If requested, give our caller access to the name of the
          #       directory we just found.
          #
          if {[string length $varName] > 0} then {
            upvar 1 $varName dir3
          }

          #
          # NOTE: Ok, show the directory we found.
          #
          set dir3 [file join $dir $dir2]

          #
          # NOTE: We found the necessary directory to add to the auto-path;
          #       However, we cannot simply add it to the auto-path directly
          #       because the auto-path is dynamically constructed after this
          #       script is evaluated; therefore, set the Eagle library path
          #       environment variable and force the appropriate internal path
          #       list to be refreshed.
          #
          if {![info exists ::env(EAGLELIBPATH)] || \
              [lsearch -exact $::env(EAGLELIBPATH) $dir3] == -1} then {
            #
            # NOTE: If we have NOT been instructed to be quiet, report now.
            #
            if {!$quiet} then {
              catch {
                tqputs $channel [appendArgs \
                    "---- found vendor-specific test package directory \"" \
                    $dir3 "\", adding...\n"]
              }
            }

            #
            # NOTE: Append the directory to the necessary environment variable
            #       so that it will get picked up when Eagle actually rebuilds
            #       the auto-path list (below).
            #
            lappend ::env(EAGLELIBPATH) $dir3

            #
            # NOTE: Attempt to force Eagle to rebuild the auto-path for the
            #       current interpreter right now.
            #
            set refresh [refreshAutoPath]

            if {[string length $refresh] == 0} then {
              #
              # NOTE: Ok, maybe the [object] command is not available.  Rescan
              #       the package indexes using the [package scan] sub-command
              #       in that case.  The directories within EAGLELIBPATH will
              #       not be added to the auto-path; however, all the package
              #       indexes and their associated packages will be available.
              #
              if {!$quiet} then {
                catch {
                  tqputs $channel [appendArgs \
                      "---- unable to forcibly refresh auto-path list, " \
                      "scanning \"" $::env(EAGLELIBPATH) "\" instead...\n"]
                }
              }

              #
              # NOTE: In theory, this call to the [package scan] sub-command
              #       could fail, raising a script error here; however, that
              #       is highly unlikely.
              #
              eval package scan -host -normal -refresh -- $::env(EAGLELIBPATH)
            } else {
              if {!$quiet} then {
                catch {
                  tqputs $channel [appendArgs \
                      "---- forcibly refreshed auto-path list via \"" \
                      $refresh "\" command\n"]
                }
              }
            }
          }

          #
          # NOTE: We are done, return success.
          #
          return true
        }

        #
        # NOTE: Keep going up the directory tree...
        #
        set dir [file dirname $dir]
      }

      #
      # NOTE: If we have NOT been instructed to be quiet, report now.
      #
      if {!$quiet} then {
        catch {
          tqputs $channel \
              "---- could not find vendor-specific test package directory\n"
        }
      }

      #
      # NOTE: Directory not found, return failure.
      #
      return false
    }

    proc findInterpreterTestPath { channel dir varName quiet } {
      #
      # NOTE: Start with the specified directory.
      #
      set dir2 $dir

      #
      # NOTE: Keep going until the directory name is empty OR is actually the
      #       root of the associated volume.
      #
      while {[string length $dir2] > 0 && \
          [lsearch -exact -nocase -- [file volumes] $dir2] == -1} {
        #
        # NOTE: Set the sub-directory where the test suite file should be
        #       located within the directory to be searched.
        #
        set dir3 Tests

        #
        # NOTE: Does this directory have the necessary sub-directory that
        #       contains the test suite file?
        #
        if {[file exists [file join $dir2 $dir3]] && \
            [file isdirectory [file join $dir2 $dir3]] && \
            [file exists [file join $dir2 $dir3 all.eagle]] && \
            [file isfile [file join $dir2 $dir3 all.eagle]]} then {
          #
          # NOTE: If requested, give our caller access to the name of the
          #       directory we just found.
          #
          if {[string length $varName] > 0} then {
            upvar 1 $varName dir4
          }

          #
          # NOTE: Ok, show the directory we found.
          #
          set dir4 [file join $dir2 $dir3]

          #
          # NOTE: If we have NOT been instructed to be quiet, report now.
          #
          if {!$quiet} then {
            catch {
              tqputs $channel [appendArgs \
                  "---- found vendor-specific test suite directory \"" \
                  $dir4 \"\n]
            }
          }

          #
          # NOTE: We are done, return success.
          #
          return true
        }

        #
        # NOTE: Keep going up the directory tree...
        #
        set dir2 [file dirname $dir2]
      }

      #
      # NOTE: If we have NOT been instructed to be quiet, report now.
      #
      if {!$quiet} then {
        catch {
          tqputs $channel \
              "---- could not find vendor-specific test suite directory\n"
        }
      }

      #
      # NOTE: Directory not found, return failure.
      #
      return false
    }

    proc setupInterpreterTestPath { channel dir quiet } {
      if {[llength [info commands debug]] > 0 && \
          [llength [info subcommands debug testpath]] > 0 && \
          [catch {debug testpath} testPath] == 0} then {
        if {$dir ne $testPath} then {
          debug testpath $dir

          if {!$quiet} then {
            catch {
              tqputs $channel [appendArgs \
                  "---- set interpreter test path to \"" $dir \
                  "\" via \"debug\" command\n"]
            }
          }
        }
      } elseif {[llength [info commands object]] > 0 && [catch {
        object invoke -flags +NonPublic Interpreter.GetActive TestPath
      } testPath] == 0} then {
        if {$dir ne $testPath} then {
          object invoke -flags +NonPublic Interpreter.GetActive TestPath $dir

          if {!$quiet} then {
            catch {
              tqputs $channel [appendArgs \
                  "---- set interpreter test path to \"" $dir \
                  "\" via \"object\" command\n"]
            }
          }
        }
      } else {
        if {!$quiet} then {
          catch {
            tqputs $channel "---- cannot set interpreter test path\n"
          }
        }
      }
    }

    #
    # NOTE: Check for any overridden settings that may have been specified via
    #       the command line, etc.
    #
    checkForTestOverrides stdout [expr {[info exists test_overrides] ? \
        $test_overrides : [list binary_directory build_base_directory \
        build_directory common_directory compile_option_prefix \
        connection_extra connection_flags core_library_version \
        database_directory datetime_format define_constant_prefix \
        execute_on_setup interop_assembly_file_names \
        native_library_file_names release_version scratch_directory \
        temporary_directory test_clr test_clr_v2 test_clr_v4 \
        test_configuration test_configurations test_configuration_suffix \
        test_configuration_suffixes test_constraints test_extra test_extras \
        test_machine test_native test_native_configuration_suffix \
        test_native_extra test_native_extras test_native_year test_net_fx \
        test_net_fx_2005 test_net_fx_2008 test_net_fx_2010 test_net_fx_2012 \
        test_net_fx_2013 test_net_fx_2015 test_net_fx_2017 test_overrides \
        test_platform test_suite test_year test_years test_year_clr_v2 \
        test_year_clr_v4 vendor_directory vendor_test_directory]}] \
        [checkForVendorQuiet checkForTestOverrides]

    #
    # NOTE: Set the name of the running test suite, if necessary.
    #
    if {![info exists test_suite]} then {
      set test_suite "System.Data.SQLite Test Suite for Eagle"
    }

    #
    # NOTE: When being evaluated in a "safe" interpreter, some steps must be
    #       skipped due to missing commands and/or sub-commands.
    #
    if {![interp issafe]} then {
      #
      # NOTE: This variable will contain the name of the directory containing
      #       the vendor-specific testing infrastructure.  If the variable does
      #       not exist, create it; otherwise, it has been overridden and the
      #       existing value should be left intact.
      #
      set have_vendor_directory [info exists vendor_directory]

      if {!$have_vendor_directory} then {
        set vendor_directory ""
      }

      #
      # NOTE: This variable will contain the name of the directory containing
      #       the vendor-specific test suite.  If the variable does not exist,
      #       create it; otherwise, it has been overridden and the existing
      #       value should be left intact.
      #
      set have_vendor_test_directory [info exists vendor_test_directory]

      if {!$have_vendor_test_directory} then {
        set vendor_test_directory ""
      }

      #
      # NOTE: This procedure will attempt to find the vendor-specific testing
      #       infrastructure directory and add it to the auto-path for the
      #       current interpreter.  Normally, this will also set the variable
      #       created above to point to the directory added to the auto-path;
      #       however, this will not be done if the variable was not created
      #       by us.
      #
      addTestSuiteToAutoPath stdout \
          [expr {$have_vendor_directory ? "" : "vendor_directory"}] \
          [checkForVendorQuiet addTestSuiteToAutoPath]

      unset have_vendor_directory

      #
      # NOTE: This procedure will attempt to find the vendor-specific testing
      #       directory.  Normally, this will also set the variable created
      #       above to point to the directory; however, this will not be done
      #       if the variable was not created by us.
      #
      findInterpreterTestPath stdout $vendor_directory \
          [expr {$have_vendor_test_directory ? "" : "vendor_test_directory"}] \
          [checkForVendorQuiet findInterpreterTestPath]

      unset have_vendor_test_directory

      #
      # NOTE: If we actually found a vendor-specific testing infrastructure
      #       directory then modify the TestPath property of the current
      #       interpreter to point directly to it.
      #
      if {[string length $vendor_test_directory] > 0} then {
        setupInterpreterTestPath stdout $vendor_test_directory \
            [checkForVendorQuiet setupInterpreterTestPath]
      }
    }

    #
    # HACK: When using [compileCSharp] on .NET Core 3.0, it will produce
    #       compiler warnings complaining about mismatched versions of the
    #       .NET Standard reference assemblies, e.g. 2.0 versus 2.1; Since
    #       the test suite considers these warnings to be an indication of
    #       test failure, we disable them here.  When everything has been
    #       updated to support both, remove this.
    #
    if {![info exists no(disableWarning1701)] && [isDotNetCore]} then {
      lappend eagle_platform(csharpOptions) nowarn:1701
    }

    #
    # HACK: Prevent the Eagle core test suite infrastructure from checking
    #       test constraints that are time-consuming and/or most likely to
    #       be superfluous to third-party test suites (i.e. those that are
    #       not testing the Eagle core library itself).
    #
    set no(core) 1

    #
    # HACK: The custom test prologue already shows the final list of test
    #       constraints; there is no need to repeat them.
    #
    set no(showActiveConstraints) 1
    set no(showCachedConstraints) 1

    #
    # HACK: Prevent the Eagle core test suite infrastructure from checking
    #       for a usable instance of Excel because it can be quite slow to
    #       do so.
    #
    set no(excelUsable) 1

    #
    # NOTE: Prevent the System.Data.SQLite assembly from being loaded via
    #       the Eagle core test suite infrastructure.
    #
    set no(System.Data.SQLite) 1

    #
    # NOTE: Prevent our custom global variables from being removed by the
    #       Eagle core library test suite infrastructure.
    #
    set no(cleanState) 1

    #
    # NOTE: Make the per-test connection flags output a little less noisy.
    #
    set no(emitLocalFlagsIfNone) 1
    set no(emitSharedFlagsIfNone) 1
    set no(emitGlobalFlagsIfNone) 1
    set no(emitCombinedFlagsIfNone) 1

    #
    # NOTE: Make the per-test connection props output a little less noisy.
    #
    set no(emitLocalExtraIfNone) 1
    set no(emitGlobalExtraIfNone) 1
    set no(emitCombinedExtraIfNone) 1

    #
    # NOTE: Force use of the native library pre-loader when applicable.
    #
    if {![interp issafe] && [isWindows]} then {
      set no(deleteSqliteImplicitNativeFiles) 1
      set no(copySqliteImplicitNativeFiles) 1
    }
  }
}

###############################################################################
############################### END VENDOR CODE ###############################
###############################################################################

Added Externals/Eagle/lib/Eagle1.0/word.tcl.





























































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# word.tcl --
#
# This file defines various procedures for computing word boundaries
# in strings.  This file is primarily needed so Tk text and entry
# widgets behave properly for different platforms.
#
# Copyright (c) 1996 by Sun Microsystems, Inc.
# Copyright (c) 1998 by Scritpics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.

#
# NOTE: Stolen from Tcl 8.4 (3ad9139367d5d1c480d6f55dd4821410f6a481b9) and
#       modified:
#
#       1. Converted line-endings to DOS (i.e. cr/lf).
#
#       2. Added [info exists ::tcl_platform(platform)] check, below.
#
# -- Joe Mistachkin, 2021/02/15
#

# The following variables are used to determine which characters are
# interpreted as white space.  

if {[info exists ::tcl_platform(platform)] && \
    $::tcl_platform(platform) eq "windows"} {
    # Windows style - any but a unicode space char
    set tcl_wordchars "\\S"
    set tcl_nonwordchars "\\s"
} else {
    # Motif style - any unicode word char (number, letter, or underscore)
    set tcl_wordchars "\\w"
    set tcl_nonwordchars "\\W"
}

# tcl_wordBreakAfter --
#
# This procedure returns the index of the first word boundary
# after the starting point in the given string, or -1 if there
# are no more boundaries in the given string.  The index returned refers
# to the first character of the pair that comprises a boundary.
#
# Arguments:
# str -		String to search.
# start -	Index into string specifying starting point.

proc tcl_wordBreakAfter {str start} {
    global tcl_nonwordchars tcl_wordchars
    set str [string range $str $start end]
    if {[regexp -indices "$tcl_wordchars$tcl_nonwordchars|$tcl_nonwordchars$tcl_wordchars" $str result]} {
	return [expr {[lindex $result 1] + $start}]
    }
    return -1
}

# tcl_wordBreakBefore --
#
# This procedure returns the index of the first word boundary
# before the starting point in the given string, or -1 if there
# are no more boundaries in the given string.  The index returned
# refers to the second character of the pair that comprises a boundary.
#
# Arguments:
# str -		String to search.
# start -	Index into string specifying starting point.

proc tcl_wordBreakBefore {str start} {
    global tcl_nonwordchars tcl_wordchars
    if {$start eq "end"} {
	set start [string length $str]
    }
    if {[regexp -indices "^.*($tcl_wordchars$tcl_nonwordchars|$tcl_nonwordchars$tcl_wordchars)" [string range $str 0 $start] result]} {
	return [lindex $result 1]
    }
    return -1
}

# tcl_endOfWord --
#
# This procedure returns the index of the first end-of-word location
# after a starting index in the given string.  An end-of-word location
# is defined to be the first whitespace character following the first
# non-whitespace character after the starting point.  Returns -1 if
# there are no more words after the starting point.
#
# Arguments:
# str -		String to search.
# start -	Index into string specifying starting point.

proc tcl_endOfWord {str start} {
    global tcl_nonwordchars tcl_wordchars
    if {[regexp -indices "$tcl_nonwordchars*$tcl_wordchars+$tcl_nonwordchars" \
	    [string range $str $start end] result]} {
	return [expr {[lindex $result 1] + $start}]
    }
    return -1
}

# tcl_startOfNextWord --
#
# This procedure returns the index of the first start-of-word location
# after a starting index in the given string.  A start-of-word
# location is defined to be a non-whitespace character following a
# whitespace character.  Returns -1 if there are no more start-of-word
# locations after the starting point.
#
# Arguments:
# str -		String to search.
# start -	Index into string specifying starting point.

proc tcl_startOfNextWord {str start} {
    global tcl_nonwordchars tcl_wordchars
    if {[regexp -indices "$tcl_wordchars*$tcl_nonwordchars+$tcl_wordchars" \
	    [string range $str $start end] result]} {
	return [expr {[lindex $result 1] + $start}]
    }
    return -1
}

# tcl_startOfPreviousWord --
#
# This procedure returns the index of the first start-of-word location
# before a starting index in the given string.
#
# Arguments:
# str -		String to search.
# start -	Index into string specifying starting point.

proc tcl_startOfPreviousWord {str start} {
    global tcl_nonwordchars tcl_wordchars
    if {$start eq "end"} {
	set start [string length $str]
    }
    if {[regexp -indices \
	    "$tcl_nonwordchars*($tcl_wordchars+)$tcl_nonwordchars*\$" \
	    [string range $str 0 [expr {$start - 1}]] result word]} {
	return [lindex $word 0]
    }
    return -1
}

Added Externals/Eagle/lib/Test1.0/all.eagle.









































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
###############################################################################
#
# all.eagle --
#
# This file contains a top-level script to run all of the Eagle tests.
# Execute it by invoking "source all.eagle".
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Test Suite File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: *WARNING* This file must be capable of being evaluated in both Tcl and
#       Eagle in a completely "clean" interpreter; therefore, no script library
#       procedures provided by the Eagle.Library or Eagle.Test packages may be
#       used, including [isEagle], until after the test prologue has been
#       evaluated (below).  Unfortunately, this makes it somewhat impractical
#       to evaluate the test prologue using the abstracted [runTestPrologue]
#       script library procedure from the Eagle.Test package.  Instead, we must
#       assume that the test prologue file exists in the same directory as this
#       file and evaluate it using [source].  For third-party applications and
#       plugins that are Eagle-specific (i.e. they cannot be used in Tcl), the
#       following code snippet may be used instead of setting the "test_path"
#       variable and then evaluating the "prologue.eagle" file directly:
#
#           package require Eagle.Library
#           package require Eagle.Test
#
#           runTestPrologue
#
#       When using the above code snippet, the following code snippet may also
#       be used at the very end of the corresponding "all.eagle" file instead
#       of evaluating the "epilogue.eagle" file directly:
#
#           runTestEpilogue
#
if {![info exists test_all_path]} then {
  set test_all_path \
      [file normalize [file dirname [info script]]]
}

if {![info exists test_suite_file]} then {
  set test_suite_file [file normalize [info script]]
}

source [file join $test_all_path prologue.eagle]

if {![info exists test_path]} then {
  #
  # NOTE: Build a reusable expression that can be used to verify the
  #       candidate paths.  This is done to avoid duplication of this
  #       (quite complex) expression several times (just below).
  #
  set expr {![info exists test_path] || ![file exists $test_path] || \
      ![file isdirectory $test_path] || ([llength [info commands \
      glob]] > 0 && [llength [glob -directory $test_path -types {f r} \
      -nocomplain -- *]] == 0)}

  #
  # NOTE: Search for the "Library/Tests" -OR- "Tests" sub-directories
  #       within the sub-directory one level up and then two levels up
  #       from the sub-directory containing the "all.eagle" file from
  #       the test suite package.
  #
  set test_path [file normalize \
      [file join [file dirname $test_all_path] Library Tests]]

  if {[expr $expr]} then {
    set test_path [file normalize \
        [file join [file dirname [file dirname $test_all_path]] \
        Library Tests]]
  }

  if {[expr $expr]} then {
    set test_path [file normalize \
        [file join [file dirname $test_all_path] Tests]]
  }

  if {[expr $expr]} then {
    set test_path [file normalize \
        [file join [file dirname [file dirname $test_all_path]] \
        Tests]]
  }

  unset expr
}

set no(prologue.eagle) true
set no(epilogue.eagle) true

set test_time [time {
  runAllTests $test_channel $test_path \
      [getTestFiles [list $test_path test_extra_paths] \
          $test_flags(-file) $test_flags(-notFile)] \
      [list [file tail [info script]] *.tcl \
          epilogue.eagle prologue.eagle] \
      $test_flags(-startFile) $test_flags(-stopFile)
}]

tputs $test_channel [appendArgs "---- all tests completed in " $test_time \n]
unset test_time

unset no(epilogue.eagle)
unset no(prologue.eagle)

if {[array size no] == 0} then {unset no}

source [file join $test_all_path epilogue.eagle]

Added Externals/Eagle/lib/Test1.0/constraints.eagle.







































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
###############################################################################
#
# constraints.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Eagle Test Constraints Package File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  proc getKnownBuildTypes {} {
    if {[info exists ::test_well_known(buildTypes)]} then {
      return $::test_well_known(buildTypes)
    }

    return [list \
        NetFx20 NetFx35 NetFx40 NetFx45 \
        NetFx451 NetFx452 NetFx46 NetFx461 \
        NetFx462 NetFx47 NetFx471 NetFx472 \
        NetFx48 NetFx481 NetStandard20 NetStandard21 \
        Bare LeanAndMean Database MonoOnUnix \
        Development]
  }

  proc getKnownCompileOptions {} {
    if {[info exists ::test_well_known(compileOptions)]} then {
      return $::test_well_known(compileOptions)
    }

    return [list \
        APPDOMAINS APPROVED_VERBS ARGUMENT_CACHE ARM ARM64 ASSEMBLY_DATETIME \
        ASSEMBLY_RELEASE ASSEMBLY_STRONG_NAME_TAG ASSEMBLY_TAG ASSEMBLY_TEXT \
        ASSEMBLY_URI BREAK_ON_EXITING CACHE_ARGUMENT_TOSTRING \
        CACHE_ARGUMENTLIST_TOSTRING CACHE_DICTIONARY CACHE_RESULT_TOSTRING \
        CACHE_STATISTICS CACHE_STRINGLIST_TOSTRING CALLBACK_QUEUE CAS_POLICY \
        CERTIFICATE_PLUGIN CERTIFICATE_POLICY CERTIFICATE_RENEWAL \
        CODE_ANALYSIS COM_TYPE_CACHE COMPRESSION CONFIGURATION CONSOLE DAEMON \
        DATA DEAD_CODE DEBUG DEBUGGER DEBUGGER_ARGUMENTS DEBUGGER_BREAKPOINTS \
        DEBUGGER_ENGINE DEBUGGER_EXECUTE DEBUGGER_EXPRESSION \
        DEBUGGER_VARIABLE DEBUG_TRACE DEBUG_WRITE DEMO_EDITION DEMO_KEY_PAIRS \
        DRAWING DYNAMIC EAGLE EMBEDDED_LIBRARY EMBED_CERTIFICATES EMIT \
        ENTERPRISE_LOCKDOWN EXECUTE_CACHE EXPRESSION_FLAGS EXTRA_DIAGNOSTICS \
        FAST_ERRORCODE FAST_ERRORINFO FOR_TEST_USE_ONLY \
        FORCE_TRACE HAVE_SIZEOF HISTORY IA64 INTERACTIVE_COMMANDS \
        INTERNALS_VISIBLE_TO ISOLATED_INTERPRETERS ISOLATED_PLUGINS LIBRARY \
        LICENSE_MANAGER LICENSING LICENSING_NOP LIMITED_EDITION LIST_CACHE \
        MAYBE_TRACE MONO MONO_BUILD MONO_HACKS MONO_LEGACY NATIVE \
        NATIVE_PACKAGE NATIVE_THREAD_ID NATIVE_UTILITY NATIVE_UTILITY_BSTR \
        NETWORK NET_20 NET_20_FAST_ENUM NET_20_ONLY NET_20_SP1 NET_20_SP2 \
        NET_30 NET_35 NET_40 NET_45 NET_451 NET_452 NET_46 NET_461 NET_462 \
        NET_47 NET_471 NET_472 NET_48 NET_481 NET_CORE_REFERENCES NET_CORE_20 \
        NET_CORE_30 NET_STANDARD_20 NET_STANDARD_21 NON_WORKING_CODE NOTIFY \
        NOTIFY_ACTIVE NOTIFY_ARGUMENTS NOTIFY_EXCEPTION NOTIFY_EXECUTE \
        NOTIFY_EXPRESSION NOTIFY_GLOBAL NOTIFY_OBJECT NOTIFY_TCL OBSOLETE \
        OBFUSCATION OFFICIAL PARSE_CACHE PATCHLEVEL PLUGIN_COMMANDS \
        POLICY_TRACE PREVIOUS_RESULT PROFILER RANDOMIZE_ID REMOTING \
        RESULT_LIMITS SAMPLE SCRIPT_ARGUMENTS SECURITY SERIALIZATION \
        SHARED_ID_POOL SHELL SOURCE_ID SOURCE_TIMESTAMP STATIC \
        STRICT_FEATURES TCL TCL_KITS TCL_THREADED TCL_THREADS TCL_UNICODE \
        TCL_WRAPPER TEST TEST_PLUGIN THREADING THROW_ON_DISPOSED TRACE \
        TYPE_CACHE UNIX UNSAFE USE_APPDOMAIN_FOR_ID USE_NAMESPACES VERBOSE \
        WEB WINDOWS WINFORMS WIX_30 WIX_35 WIX_36 WIX_37 WIX_38 WIX_39 \
        WIX_310 WIX_311 X64 X86 XML]
  }

  proc getKnownWindowsVersions { {force false} } {
    if {[info exists ::test_well_known(windowsVersions)]} then {
      return $::test_well_known(windowsVersions)
    }

    if {$force || ![info exists ::no(windowsVersions)]} then {
      #
      # NOTE: Apparently, "Windows 11" still identifies as "10.0".
      #
      return [list [list 3 1] [list 3 5] [list 3 51] [list 4 0] [list 5 0] \
          [list 5 1] [list 5 2] [list 6 0] [list 6 1] [list 6 2] [list 6 3] \
          [list 10 0]]
    } else {
      return [list]
    }
  }

  proc getKnownDotNetVersions {} {
    #
    # NOTE: This job of this procedure is to return the list of "known"
    #       versions of the .NET Framework supported by the test suite
    #       infrastructure.  This means versions of the .NET Framework
    #       prior to 2.0 (i.e. 1.0 and 1.1) are purposely excluded.
    #
    #       https://en.wikipedia.org/wiki/.NET_framework
    #       https://dotnet.microsoft.com/en-us/download/dotnet-framework
    #
    # TODO: This list should be manually updated when a new version of
    #       the .NET Core runtime is released.
    #
    if {[info exists ::test_well_known(dotNetVersions)]} then {
      return $::test_well_known(dotNetVersions)
    }

    if {$force || ![info exists ::no(dotNetVersions)]} then {
      return [list [list 2 0] [list 3 5] [list 4 0] [list 4 0 1] \
          [list 4 0 2] [list 4 0 3] [list 4 5] [list 4 5 1] [list 4 5 2] \
          [list 4 6] [list 4 6 1] [list 4 6 2] [list 4 7] [list 4 7 1] \
          [list 4 7 2] [list 4 8] [list 4 8 1]]
    } else {
      return [list]
    }
  }

  proc getKnownPublicKeyTokenPattern {} {
    if {[info exists ::test_well_known(publicKeyTokenPattern)]} then {
      return $::test_well_known(publicKeyTokenPattern)
    }

    set list [list null]
    eval lappend list [getKnownPublicKeyTokens]

    return [join $list |]
  }

  proc addKnownDotNetConstraints { generic } {
    #
    # NOTE: Does the caller want to add the version-specific constraints
    #       or the generic ones?
    #
    if {!$generic} then {
      #
      # NOTE: Add the necessary constraints for each version of the .NET
      #       Framework that we know about.
      #
      # WARNING: None of these constraints are used by the core library
      #          test suite itself.
      #
      foreach dotNetVersion [getKnownDotNetVersions] {
        set constraintVersion [join $dotNetVersion ""]

        addConstraint [appendArgs dotNetToDo $constraintVersion]
        addConstraint [appendArgs dotNetToDo $constraintVersion Only]
        addConstraint [appendArgs dotNetBug $constraintVersion]
        addConstraint [appendArgs dotNetBug $constraintVersion Only]
        addConstraint [appendArgs dotNetCrash $constraintVersion]
        addConstraint [appendArgs dotNetCrash $constraintVersion Only]
      }
    } else {
      #
      # NOTE: Also add just the generic the .NET Framework constraints
      #       that do not have a trailing version.
      #
      # WARNING: None of these constraints are used by the core library
      #          test suite itself.
      #
      set constraints [list dotNetToDo dotNetBug dotNetCrash]

      foreach constraint $constraints {
        addConstraint $constraint
      }
    }
  }

  proc getKnownMonoVersions { {force false} } {
    #
    # NOTE: This job of this procedure is to return the list of "known"
    #       versions of Mono supported by the test suite infrastructure.
    #       This means versions of Mono prior to 2.0 (i.e. 0.* and 1.*)
    #       are purposely excluded.
    #
    # NOTE: Other than version 2.11 (which was officially announced and
    #       released), all of these releases are listed on the official
    #       release history pages:
    #
    #       https://en.wikipedia.org/wiki/Mono_%28software%29
    #       https://www.mono-project.com/docs/about-mono/releases/
    #       https://www.mono-project.com/docs/about-mono/versioning/
    #
    # TODO: This list should be manually updated when a new version of
    #       the Mono runtime is released -OR- when one is skipped (e.g.
    #       5.6 and 5.22).
    #
    if {[info exists ::test_well_known(monoVersions)]} then {
      return $::test_well_known(monoVersions)
    }

    if {$force || ![info exists ::no(monoVersions)]} then {
      return [list \
          [list 2 0] [list 2 2] [list 2 4] [list 2 6] [list 2 8] [list 2 10] \
          [list 2 11] [list 3 0] [list 3 1] [list 3 2] [list 3 4] [list 3 6] \
          [list 3 8] [list 3 10] [list 3 12] [list 4 0] [list 4 2] [list 4 4] \
          [list 4 6] [list 4 8] [list 5 0] [list 5 2] [list 5 4] [list 5 8] \
          [list 5 10] [list 5 12] [list 5 14] [list 5 16] [list 5 18] \
          [list 5 20] [list 6 0] [list 6 4] [list 6 6] [list 6 8] [list 6 10] \
          [list 6 12]]
    } else {
      return [list]
    }
  }

  proc addKnownMonoConstraints { generic } {
    #
    # NOTE: Does the caller want to add the version-specific constraints
    #       or the generic ones?
    #
    if {!$generic} then {
      #
      # NOTE: Add the necessary constraints for each version of Mono that
      #       we know about.
      #
      foreach monoVersion [getKnownMonoVersions] {
        set constraintVersion [join $monoVersion ""]

        addConstraint [appendArgs monoToDo $constraintVersion]
        addConstraint [appendArgs monoToDo $constraintVersion Only]
        addConstraint [appendArgs monoBug $constraintVersion]
        addConstraint [appendArgs monoBug $constraintVersion Only]
        addConstraint [appendArgs monoCrash $constraintVersion]
        addConstraint [appendArgs monoCrash $constraintVersion Only]
      }
    } else {
      #
      # NOTE: Also add just the generic Mono constraints that do not have
      #       a trailing version.
      #
      set constraints [list monoToDo monoBug monoCrash]

      foreach constraint $constraints {
        addConstraint $constraint
      }
    }
  }

  proc getKnownDotNetCoreVersions { {force false} } {
    #
    # NOTE: This job of this procedure is to return the list of "known"
    #       versions of .NET Core supported by the test suite
    #       infrastructure.  This means versions of .NET Core prior to
    #       2.0 (i.e. 1.0 and 1.1) are purposely excluded.
    #
    #       https://en.wikipedia.org/wiki/.NET_Core
    #       https://github.com/dotnet/core/releases
    #
    # TODO: This list should be manually updated when a new version of
    #       the .NET Core runtime is released.
    #
    if {[info exists ::test_well_known(dotNetCoreVersions)]} then {
      return $::test_well_known(dotNetCoreVersions)
    }

    if {$force || ![info exists ::no(dotNetCoreVersions)]} then {
      return [list [list 2 0] [list 2 1] [list 2 2] [list 3 0] \
          [list 3 1] [list 5 0] [list 6 0] [list 7 0] [list 8 0]]
    } else {
      return [list]
    }
  }

  proc addKnownDotNetCoreConstraints { generic } {
    #
    # NOTE: Does the caller want to add the version-specific constraints
    #       or the generic ones?
    #
    if {!$generic} then {
      #
      # NOTE: Add the necessary constraints for each version of .NET Core
      #       that we know about.
      #
      foreach dotNetCoreVersion [getKnownDotNetCoreVersions] {
        set constraintVersion [join $dotNetCoreVersion ""]

        addConstraint [appendArgs dotNetCoreToDo $constraintVersion]
        addConstraint [appendArgs dotNetCoreToDo $constraintVersion Only]
        addConstraint [appendArgs dotNetCoreBug $constraintVersion]
        addConstraint [appendArgs dotNetCoreBug $constraintVersion Only]
        addConstraint [appendArgs dotNetCoreCrash $constraintVersion]
        addConstraint [appendArgs dotNetCoreCrash $constraintVersion Only]
      }
    } else {
      #
      # NOTE: Also add just the generic .NET Core constraints that do not
      #       have a trailing version.
      #
      set constraints [list dotNetCoreToDo dotNetCoreBug dotNetCoreCrash]

      foreach constraint $constraints {
        addConstraint $constraint
      }
    }
  }

  proc getKnownTclVersions { {force false} } {
    #
    # NOTE: This job of this procedure is to return the list of "known"
    #       versions of Tcl/Tk supported by the test suite infrastructure.
    #       This means versions of Tcl/Tk prior to 8.4 are purposely
    #       excluded.
    #
    if {[info exists ::test_well_known(tclVersions)]} then {
      return $::test_well_known(tclVersions)
    }

    if {$force || ![info exists ::no(tclVersions)]} then {
      return [list [list 8 4] [list 8 5] [list 8 6] [list 8 7]]
    } else {
      return [list]
    }
  }

  proc filterKnownVersions {
          versions {minimumVersion ""} {maximumVersion ""} } {
    if {[string length $minimumVersion] > 0} then {
      set dotMinimumVersion [getDottedVersion $minimumVersion]
    } else {
      set dotMinimumVersion ""
    }

    if {[string length $maximumVersion] > 0} then {
      set dotMaximumVersion [getDottedVersion $maximumVersion]
    } else {
      set dotMaximumVersion ""
    }

    set result [list]

    foreach version $versions {
      set dotVersion [getDottedVersion $version]

      if {[string length $dotMinimumVersion] > 0 && \
          $dotVersion < $dotMinimumVersion} then {
        continue
      }

      if {[string length $dotMaximumVersion] > 0 && \
          $dotVersion > $dotMaximumVersion} then {
        continue
      }

      lappend result $version
    }

    return $result
  }

  proc getDotNetCoreDirectoryNameOnly { path } {
    #
    # HACK: Obtain parent directory name that matches "net*", if any (e.g.
    #       "netcoreapp2.0", "netstandard2.0", etc).
    #
    if {[string length $path] > 0} then {
      set tail [file tail $path]

      if {[string match net* $tail]} then {
        return $tail
      }
    }

    return ""
  }

  proc getDotNetCoreLibPathDirectoryNameOnly { {name ""} } {
    #
    # NOTE: Search for matching directories based on the globally detected
    #       library path associated with the current core library.
    #
    if {[info exists ::core_lib_path] && \
        [string length $::core_lib_path] > 0} then {
      #
      # NOTE: Make sure the directory actually exists before trying to find
      #       things within it.
      #
      if {[file isdirectory $::core_lib_path]} then {
        #
        # NOTE: Grab all directories that are directly beneath the detected
        #       library path, if any.
        #
        foreach directory [glob \
            -nocomplain -types {d} -- [file join $::core_lib_path *]] {
          #
          # NOTE: If the caller specified a (plugin) name to match against,
          #       make sure it matches; otherwise, skip this directory.
          #
          if {[string length $name] > 0 && \
              ![string match $name [file tail $directory]]} then {
            continue
          }

          #
          # NOTE: Find directories beneath the current candidate directory
          #       that are .NET Core output directories.
          #
          set directories [glob \
              -nocomplain -types {d} -- [file join $directory net*]]

          #
          # NOTE: If there is at least one match, we are done.  Return the
          #       final path segment of the directory name to the caller.
          #
          if {[llength $directories] > 0} then {
            return [file tail [lindex $directories 0]]
          }
        }
      }
    }

    #
    # NOTE: There was no match, just return something obviously invalid.
    #
    return ""
  }

  proc getRuntimeVersion { verify } {
    if {[isEagle]} then {
      if {[info exists ::eagle_platform(runtimeVersion)]} then {
        set version $::eagle_platform(runtimeVersion)

        if {!$verify || [string is version -strict $version]} then {
          return $version
        }
      }
    }

    return [expr {$verify ? "0.0" : ""}]
  }

  proc getDottedVersion { version } {
    return [join $version .]
  }

  proc getDotlessVersion { version } {
    if {[string first . $version] != -1} then {
      return [string map [list . ""] $version]
    } else {
      return [join $version ""]
    }
  }

  proc getMajorMinorVersion { version } {
    return [join [lrange [split $version .] 0 1] .]
  }

  proc loadTestSettings { channel {suffix ""} {quiet false} } {
    #
    # NOTE: Skip loading settings if their usage has been disabled.
    #
    if {![info exists ::no(testSettings)]} then {
      #
      # NOTE: Figure out which directory should contain test settings
      #       files, if any.
      #
      if {[info exists ::test_settings_path]} then {
        set directory $::test_settings_path; # NOTE: Override path?
      } elseif {[info exists ::path]} then {
        set directory $::path; # NOTE: Plugin test suite?
      } elseif {[info exists ::test_path]} then {
        set directory $::test_path; # NOTE: Core test suite?
      }

      #
      # NOTE: Was any candidate test directory available?
      #
      if {[info exists directory]} then {
        #
        # NOTE: Attempt to determine the active test configuration.
        #
        if {[info exists ::test_configuration]} then {
          set configuration $::test_configuration
        } else {
          set configuration Unknown; # ???
        }

        #
        # NOTE: This will contain the candidate list of test settings
        #       file names to load.
        #
        set fileNames [list]

        #
        # NOTE: Is a user name available?
        #
        if {[info exists ::tcl_platform(user)]} then {
          lappend fileNames [file join $directory [appendArgs \
              settings $suffix . $::tcl_platform(user) . \
              $configuration .eagle]]

          lappend fileNames [file join $directory [appendArgs \
              settings $suffix . $::tcl_platform(user) .eagle]]
        }

        #
        # NOTE: Is a host name available?
        #
        if {[info exists ::tcl_platform(host)]} then {
          lappend fileNames [file join $directory [appendArgs \
              settings $suffix . $::tcl_platform(host) . \
              $configuration .eagle]]

          lappend fileNames [file join $directory [appendArgs \
              settings $suffix . $::tcl_platform(host) .eagle]]
        }

        #
        # NOTE: Check each candidate test settings file, in order.  Any
        #       that actually exist will be evaluated.
        #
        foreach fileName $fileNames {
          if {[file exists $fileName]} then {
            if {[catch {
              uplevel 1 [list source $fileName]
            } error] == 0} then {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "==== OK: test settings file \"" $fileName \
                    "\" loaded\n"]
              }
            } else {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "==== WARNING: test settings file \"" $fileName \
                    "\" error: " \n\t $error \n]
              }
            }
          } else {
            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "---- skipped loading test settings file \"" \
                  $fileName "\", it does not exist\n"]
            }
          }
        }
      } else {
        if {!$quiet} then {
          tputs $channel \
              "---- skipped loading test settings files, no directory\n"
        }
      }
    }
  }

  #
  # NOTE: This procedure was adapted from the one listed on the Tcl Wiki page
  #       at "https://wiki.tcl.tk/43".  It is only intended to be used on very
  #       small lists because of its heavy use of recursion and complexity on
  #       the order of O(N!).
  #
  proc lpermute { list } {
    set length [llength $list]
    if {$length < 2} {
      return [list $list]
    }
    set index 0
    foreach element1 $list {
      if {$index == 0} then {
        set rest [lrange $list 1 end]
      } elseif {$index == $length - 1} then {
        set rest [lrange $list 0 end-1]
      } else {
        set rest [concat \
            [lrange $list 0 [expr {$index - 1}]] \
            [lrange $list [expr {$index + 1}] end]]
      }
      incr index
      foreach list2 [lpermute $rest] {
        lappend result [concat [list $element1] $list2]
      }
    }
    return $result
  }

  #
  # NOTE: This procedure was adapted from the one listed on the Tcl Wiki page
  #       at "https://wiki.tcl.tk/2553".  It is only intended to be used on
  #       very small lists because of its heavy use of recursion and complexity
  #       on the order of O(N!).
  #
  proc lcombine { list wantLength } {
    if {$wantLength <= 0} then {
      return [list [list]]
    }

    set result [list]
    set haveLength [llength $list]

    for {set index 0} {$index + $wantLength <= $haveLength} {incr index} {
      set element1 [lindex $list $index]
      set nextIndex [expr {$index + 1}]
      set rest [lrange $list $nextIndex end]
      set restLength [expr {$wantLength - 1}]

      foreach subList [lcombine $rest $restLength] {
        lappend result [linsert $subList 0 $element1]
      }
    }

    return $result
  }

  proc alwaysFullInterpReady {} {
    #
    # NOTE: The [interp readylimit] sub-command is only in Eagle.
    #
    if {![isEagle]} then {
      return true
    }

    #
    # NOTE: If this Eagle version lacks [interp readylimit] -OR- it has
    #       the default value (i.e. it always fully checks readiness),
    #       return true.
    #
    return [expr {
      [catch {interp readylimit {}} readylimit] || $readylimit == 0
    }]
  }

  #
  # NOTE: This procedure should return non-zero if the operating system
  #       shell may be executed by the test suite infrastructure outside
  #       the context of any specific tests.  The specific tests themselves
  #       must make use of their own constraints to prevent its execution.
  #
  proc canExecComSpec {} {
    if {[info exists ::no(exec)]} then {
      return false
    }

    if {[info exists ::no(comSpec)]} then {
      return false
    }

    if {[info exists ::no(canExecComSpec)]} then {
      return false
    }

    return true
  }

  #
  # NOTE: This procedure should return non-zero if the "whoami" command may
  #       be executed by the test suite infrastructure outside the context
  #       of any specific tests.  The specific tests themselves must make
  #       use of their own constraints to prevent its execution.
  #
  proc canExecWhoAmI {} {
    if {[info exists ::no(exec)]} then {
      return false
    }

    if {[info exists ::no(whoami)]} then {
      return false
    }

    if {[info exists ::no(canExecWhoAmI)]} then {
      return false
    }

    return true
  }

  #
  # NOTE: This procedure should return non-zero if the native Tcl shell may
  #       be executed by the test suite infrastructure outside the context
  #       of any specific tests.  The specific tests themselves must make
  #       use of their own constraints to prevent its execution.
  #
  proc canExecTclShell {} {
    if {[info exists ::no(exec)]} then {
      return false
    }

    if {[info exists ::no(tcl)]} then {
      return false
    }

    if {[info exists ::no(canExecTclShell)]} then {
      return false
    }

    return true
  }

  #
  # NOTE: This procedure should return non-zero if Fossil may be executed by
  #       the test suite infrastructure outside the context of any specific
  #       tests.  The specific tests themselves must make use of their own
  #       constraints to prevent its execution.
  #
  proc canExecFossil {} {
    if {[info exists ::no(exec)]} then {
      return false
    }

    if {[info exists ::no(fossil)]} then {
      return false
    }

    if {[info exists ::no(canExecFossil)]} then {
      return false
    }

    return true
  }

  #
  # NOTE: This procedure should return non-zero if the "fsutil" tool may be
  #       executed by the test suite infrastructure outside the context of
  #       any specific tests.  The specific tests themselves must make use
  #       of their own constraints to prevent its execution.
  #
  proc canExecFsUtil {} {
    if {[info exists ::no(exec)]} then {
      return false
    }

    if {[info exists ::no(fsutil)]} then {
      return false
    }

    if {[info exists ::no(canExecFsUtil)]} then {
      return false
    }

    return true
  }

  #
  # NOTE: This procedure should return non-zero if the "vswhere" tool may be
  #       executed by the test suite infrastructure outside the context of
  #       any specific tests.  The specific tests themselves must make use
  #       of their own constraints to prevent its execution.
  #
  proc canExecVsWhere {} {
    if {[info exists ::no(exec)]} then {
      return false
    }

    if {[info exists ::no(vswhere)]} then {
      return false
    }

    if {[info exists ::no(canExecVsWhere)]} then {
      return false
    }

    return true
  }

  #
  # NOTE: This procedure should return non-zero if the "wmic" tool may be
  #       executed by the test suite infrastructure outside the context of
  #       any specific tests.  The specific tests themselves must make use
  #       of their own constraints to prevent its execution.
  #
  proc canExecWmic {} {
    if {[info exists ::no(exec)]} then {
      return false
    }

    if {[info exists ::no(wmic)]} then {
      return false
    }

    if {[info exists ::no(canExecWmic)]} then {
      return false
    }

    return true
  }

  proc getCpuStatus {} {
    if {[isWindows] && [canExecWmic]} then {
      if {[catch {
        exec -- wmic CPU GET CurrentClockSpeed, MaxClockSpeed, Name
      } cpu] == 0} then {
        set cpu [string map [list \r\n \n] [string trim $cpu]]

        if {[regexp -line -- {^(\d+)\s+(\d+)\s+(.+)$} $cpu dummy \
            current maximum name]} then {
          set name [string trim $name]

          return [list status [appendArgs \
              $name ", current " $current "MHz, maximum " $maximum MHz]]
        }
      }
    }

    if {[file exists /proc/cpuinfo]} then {
      if {[catch {
        set data [readFile /proc/cpuinfo]
      } cpu] == 0} then {
        set cpu [string map [list \r\n \n] [string trim $cpu]]

        if {[regexp -line -- {^model name\s+: (.*)$} $cpu dummy name] && \
            [regexp -line -- {^cpu MHz\s+: (.*)$} $cpu dummy current]} then {
          set name [string trim $name]

          return [list status [appendArgs \
              $name ", current " $current MHz]]
        }
      }
    }

    return ""
  }

  #
  # NOTE: This procedure should return non-zero if the test suite should be
  #       considered to be running on Mono.
  #
  proc isTestMono {} {
    return [expr {![info exists ::no(mono)] && [isMono]}]
  }

  #
  # NOTE: This procedure should return non-zero if the test suite should be
  #       considered to be running on .NET Core.
  #
  proc isTestDotNetCore {} {
    return [expr {![info exists ::no(dotNetCore)] && [isDotNetCore]}]
  }

  proc isTestAdministrator { {force false} } {
    #
    # NOTE: This is a workaround for the [isAdministrator] procedure being
    #       inaccurate for Mono on Windows, primarily due to the inability
    #       of Mono to call a P/Invoke method by ordinal.  Also, this can
    #       be used for native Tcl on Windows.  This only works on Windows.
    #
    if {[isWindows]} then {
      #
      # NOTE: Normally, this is only used for native Tcl or Eagle on Mono;
      #       however, it can be used for Eagle on the .NET Framework if
      #       forced.
      #
      if {$force || ![isEagle] || [isTestMono]} then {
        if {[canExecWhoAmI] && \
            [catch {exec -- whoami /groups} groups] == 0} then {
          set groups [string map [list \r\n \n] $groups]

          foreach group [split $groups \n] {
            #
            # NOTE: Match this group line against the "well-known" SID for
            #       the "Administrators" group on Windows.
            #
            if {[regexp -- {\sS-1-5-32-544\s} $group]} then {
              #
              # NOTE: Match this group line against the attributes column
              #       sub-value that should be present when running with
              #       elevated administrator credentials.
              #
              if {[regexp -- {\sEnabled group(?:,|\s)} $group]} then {
                return true
              }
            }
          }
        }
      }
    }

    #
    # NOTE: We must be running in native Tcl, running on Unix, running in
    #       Eagle on the .NET Framework, or unable to execute the "whoami"
    #       command.  If running in Eagle, we can just fallback to using
    #       the [isAdministrator] procedure; otherwise, just return false.
    #
    return [expr {[isEagle] ? [isAdministrator] : false}]
  }

  proc canPing { {varName ""} } {
    #
    # NOTE: If requested by the caller, provide a reason whenever false is
    #       returned from this procedure.
    #
    if {[string length $varName] > 0} then {
      upvar 1 $varName reason
    }

    #
    # NOTE: Native Tcl (without extra packages) does not provide support for
    #       pinging a network host.
    #
    if {[isEagle]} then {
      if {[isTestMono]} then {
        #
        # NOTE: Using [uri ping] on the Mono 3.3.0 (or 3.4.0?) release will
        #       lock up the process; therefore, skip it in that case.
        #
        if {[haveConstraint mono33] || [haveConstraint mono34]} then {
          set reason "skipped, may hang on Mono 3.3.0 and 3.4.0"
          return false
        }

        #
        # NOTE: Other versions of Mono, e.g. 3.12, appear to require elevated
        #       privileges (i.e. full administrator) in order to successfully
        #       execute [uri ping].  This has been verified on Windows.  New
        #       versions of Mono, e.g. 6.x, do not appear to have this issue
        #       any longer.
        #
        if {![isTestAdministrator] && \
            [package vcompare [getRuntimeVersion true] 6.0] < 0} then {
          set reason "skipped, need administrator privileges"
          return false
        }
      }

      #
      # NOTE: Eagle, when running on the Microsoft .NET Framework, supports
      #       pinging a network host as long as it was compiled with network
      #       support (which this procedure purposely does not check).  That
      #       is done using [checkForCompileOption], by the test prologue.
      #
      return true
    }

    set reason "skipped, need Eagle"
    return false
  }

  proc cleanConstraintName { name } {
    #
    # NOTE: Start with the original constraint name, removing surrounding
    #       whitespace.  If this results in an empty string, we are done.
    #
    set result [string trim $name]

    if {[string length $result] == 0} then {
      return $result
    }

    #
    # NOTE: The constraints for a test are actually a list; therefore, we
    #       must remove anything that might confuse the list parser.
    #
    set result [string map [list \" "" \\ "" \{ "" \} ""] $result]

    #
    # NOTE: In order to avoid semantic confusion, remove other characters
    #       that may be reserved by the test suite subsystems.
    #
    set result [string map [list ! "" # "" \$ "" \; "" \[ "" \] ""] $result]

    #
    # NOTE: Finally, remove all remaining whitespace.
    #
    regsub -all -- {\s} $result "" result; return $result
  }

  proc cleanPackageName { package full } {
    #
    # NOTE: Start out with the original package name, removing surrounding
    #       whitespace.  If this results in an empty string, we are done.
    #
    set result [string trim $package]

    if {[string length $result] == 0} then {
      return $result
    }

    #
    # NOTE: If the full package name is NOT wanted, use the short name.  It
    #       will be whatever occurs before the first comma.  If this results
    #       in an empty string, we are done.
    #
    if {!$full} then {
      set result [string trim [lindex [split $result ,] 0]]

      if {[string length $result] == 0} then {
        return $result
      }
    }

    #
    # HACK: This is the list of "special" characters that are documented to
    #       be used when constructing fully qualified .NET Framework type
    #       names.  For now, they are all replaced with underscores by this
    #       procedure.  Any existing underscores in the string are doubled.
    #
    set charMap [list _ __ " " _ + _ , _ . _ = _ \[ _ \\ _ \] _ ` _]

    return [string map $charMap $result]
  }

  proc haveTclPlatformOsExtraUpdateName { name } {
    if {[info exists ::tcl_platform(osExtra)]} then {
      set updateNames [getDictionaryValue $::tcl_platform(osExtra) \
          UpdateNames]

      if {[lsearch -exact $updateNames $name] != -1} then {
        return true
      }
    }

    return false
  }

  proc appendExecArguments { varName args } {
    upvar 1 $varName command

    if {[isEagle]} then {
      foreach arg $args {
        if {[list $arg] eq $arg} then {
          lappend command $arg
        } else {
          lappend command [appendArgs \" $arg \"]
        }
      }
    } else {
      eval lappend command $args
    }

    return ""
  }

  proc tryDetectFossilRoot { directory } {
    set saveDir [file normalize $directory]; set dir $saveDir

    while {[string length $dir] > 0 && \
        [lsearch -exact -nocase -- [file volumes] $dir] == -1} {
      set command [list exec -- fossil info]
      appendExecArguments command --chdir $dir

      if {[catch $command result]} then {
        break
      }

      if {![regexp -line -skip 1 -- \
          {^local-root:\s+(.*?)$} $result root]} then {
        break
      }

      set root [string trim $root]

      if {[string starts $root $saveDir]} then {
        return $root
      }

      set dir [file dirname $dir]
    }

    return $directory; # NOTE: Return original verbatim.
  }

  proc execFossilCommand { directory args } {
    set command [list exec -- fossil]
    eval appendExecArguments command $args

    if {[string length $directory] > 0} then {
      if {![isWindows]} then {
        set directory [tryDetectFossilRoot $directory]
      }

      appendExecArguments command --chdir $directory
    }

    return [eval $command]
  }

  proc checkForTestSuiteFiles { channel } {
    tputs $channel "---- checking for test suite files... "

    #
    # NOTE: Start out with no test suite files to check.
    #
    set fileNames [list]

    #
    # NOTE: Check if the base package path is available.
    #
    if {[info exists ::test_package_path]} then {
      #
      # TODO: If additional test suite files are added within the base
      #       package path, add them here as well.
      #
      foreach fileNameOnly [list \
          auxiliary.eagle compat.eagle csharp.eagle database.eagle \
          embed.eagle exec.eagle file1.eagle file2.eagle file2u.eagle \
          file3.eagle info.eagle init.eagle list.eagle \
          object.eagle pkgIndex.eagle pkgIndex.tcl pkgt.eagle \
          platform.eagle process.eagle runopt.eagle safe.eagle \
          shell.eagle shim.eagle startup.eagle test.eagle \
          testlog.eagle unkobj.eagle unzip.eagle update.eagle \
          vendor.eagle word.tcl] {
        #
        # NOTE: First, check if the file resides in the Eagle-specific
        #       package sub-directory.  Failing that, fallback to using
        #       the base package path itself.
        #
        set fileName [file join \
            $::test_package_path Eagle1.0 $fileNameOnly]

        if {![file exists $fileName]} then {
          set fileName [file join $::test_package_path $fileNameOnly]
        }

        #
        # NOTE: If the test suite file exists, add it to the list of file
        #       names to process.
        #
        if {[file exists $fileName]} then {
          lappend fileNames $fileName
        }
      }

      #
      # TODO: If additional test suite files are added within the test
      #       package path, add them here as well.
      #
      foreach fileNameOnly [list \
          all.eagle constraints.eagle epilogue.eagle pkgIndex.eagle \
          pkgIndex.tcl prologue.eagle] {
        #
        # NOTE: First, check if the file resides in the Eagle-specific
        #       package sub-directory.  Failing that, fallback to using
        #       the base package path itself.
        #
        set fileName [file join \
            $::test_package_path Test1.0 $fileNameOnly]

        if {![file exists $fileName]} then {
          set fileName [file join $::test_package_path $fileNameOnly]
        }

        #
        # NOTE: If the test suite file exists, add it to the list of file
        #       names to process.
        #
        if {[file exists $fileName]} then {
          lappend fileNames $fileName
        }
      }
    }

    #
    # NOTE: Check if the test package path is available.
    #
    if {[info exists ::test_path]} then {
      #
      # TODO: If additional test suite files are added within the test
      #       suite path, add them here as well.
      #
      foreach fileNameOnly [list all.eagle epilogue.eagle prologue.eagle] {
        #
        # NOTE: Check if the file resides in the test package directory.
        #
        set fileName [file join $::test_path $fileNameOnly]

        #
        # NOTE: If the test suite file exists, add it to the list of file
        #       names to process.
        #
        if {[file exists $fileName]} then {
          lappend fileNames $fileName
        }
      }
    }

    #
    # NOTE: Did we find any test suite files?
    #
    if {[llength $fileNames] > 0} then {
      #
      # NOTE: Eagle has a built-in hashing command; however, Tcl requires
      #       a package.  Make sure we can hash content before proceeding.
      #
      if {[isEagle] || [catch {package require sha1}] == 0} then {
        tputs $channel yes\n

        foreach fileName $fileNames {
          if {[isEagle]} then {
            #
            # NOTE: Use the relatively new -filename option to the Eagle
            #       [hash] command.
            #
            set sha1 [hash normal -filename sha1 $fileName]
          } else {
            #
            # BUGBUG: Apparently, the ActiveState tcllib sha1 package may
            #         have a bug that produces the wrong values here.  No
            #         attempt is made here to work around any such bug.
            #         For further information, please see:
            #
            #         https://core.tcl.tk/tcllib/info/ad20454023
            #
            set sha1 [sha1::sha1 -hex -filename $fileName]
          }

          tputs $channel [appendArgs \
              "---- file \"" $fileName "\"... sha1 (" $sha1 ")\n"]
        }

        #
        # NOTE: We are done here, return now.
        #
        return
      }
    }

    tputs $channel no\n
  }

  proc checkForPlatform { channel } {
    tputs $channel "---- checking for platform... "

    if {[info exists ::tcl_platform(platform)]} then {
      addConstraint $::tcl_platform(platform)

      tputs $channel [appendArgs $::tcl_platform(platform) \n]
    } else {
      tputs $channel unknown\n
    }

    ###########################################################################

    if {![isEagle]} then {
      #
      # BUGFIX: We do not normally want to skip any Mono bugs in native Tcl.
      #
      if {![info exists ::no(runtimeVersion)]} then {
        addKnownMonoConstraints true; # running in native Tcl.
        addKnownMonoConstraints false; # running in native Tcl.
        addKnownDotNetCoreConstraints true; # running in native Tcl.
        addKnownDotNetCoreConstraints false; # running in native Tcl.
      }
    }
  }

  proc checkForWindowsVersion { channel } {
    tputs $channel "---- checking for Windows version... "

    #
    # NOTE: Are we running on Windows at all?
    #
    if {[isWindows]} then {
      #
      # NOTE: Is the specific OS name and version number available?
      #
      if {[info exists ::tcl_platform(os)] && \
          [string length $::tcl_platform(os)] > 0 && \
          [info exists ::tcl_platform(osVersion)] && \
          [string length $::tcl_platform(osVersion)] > 0 && \
          [regexp -- {^\d+\.\d+$} $::tcl_platform(osVersion)]} then {
        #
        # NOTE: Grab the reported Windows version.
        #
        set osVersion $::tcl_platform(osVersion)

        #
        # NOTE: Double check that we are not being lied to by Windows
        #       about its real version number.
        #
        set extra ""

        if {[canExecComSpec] && [info exists ::env(ComSpec)]} then {
          #
          # NOTE: Take advantage of the Windows command processor to
          #       run its internal VER command, which appears to always
          #       report the real Windows version number.
          #
          if {[catch {
            exec $::env(ComSpec) /C VER
          } comSpecVersion] == 0 && \
              [regexp -- {Version (\d+\.\d+)} $comSpecVersion \
              dummy comSpecVersion]} then {
            #
            # NOTE: If the value reported to the process does not match
            #       the value returned from the Windows command processor,
            #       replace it.  We must know the real Windows version.
            #
            if {$osVersion eq $comSpecVersion} then {
              set extra "---- reported and detected Windows versions match\n"
            } else {
              set extra [appendArgs \
                  "==== WARNING: reported and detected Windows versions " \
                  "do not match: " $osVersion " versus " $comSpecVersion \
                  ", resetting...\n"]

              set osVersion $comSpecVersion
            }
          }
        }

        #
        # NOTE: Check all the well-known versions of Windows -AND- add
        #       appropriate test constraints.
        #
        foreach windowsVersion [getKnownWindowsVersions] {
          set dotWindowsVersion [getDottedVersion $windowsVersion]

          if {$osVersion >= $dotWindowsVersion} then {
            #
            # NOTE: Start out with the OS name, removing all spaces and
            #       then append the well-known OS version number as well
            #       as the suffix "_OrHigher" to indicate a inexact match.
            #
            set version [appendArgs \
                [string map [list " " ""] $::tcl_platform(os)] _ \
                $dotWindowsVersion _ OrHigher]

            addConstraint [appendArgs osVersion. $version]
          }
        }

        #
        # NOTE: Start out with the OS name, removing all spaces and then
        #       append the reported (or detected) OS version number.
        #
        set version [appendArgs \
            [string map [list " " ""] $::tcl_platform(os)] _ \
            $osVersion]

        #
        # NOTE: Add constraint containing the OS name and version number.
        #
        addConstraint [appendArgs osVersion. $version]

        #
        # NOTE: Show what we found for the OS name and version number.
        #
        tputs $channel [appendArgs \
            "yes (" $::tcl_platform(os) " v" $osVersion ")\n"]

        #
        # NOTE: Log any extra message now.
        #
        if {[string length $extra] > 0} then {
          tputs $channel $extra
        }

        #
        # NOTE: We are done here, return now.
        #
        return
      }
    }

    tputs $channel no\n
  }

  proc checkForGetInstalledUpdates { channel {timeout 60000} {populate true} } {
    tputs $channel "---- checking for installed updates support... "

    if {[info exists ::tcl_platform(osExtra)]} then {
      #
      # HACK: When running in Eagle, wait for the "setup" event in
      #       the active interpreter.  This event will be signaled
      #       (only) after the "tcl_platform(osExtra)" element has
      #       been fully populated by its dedicated thread.
      #
      if {[isEagle]} then {
        if {[catch {
          object invoke -flags +NonPublic \
              Eagle._Components.Private.PlatformOps \
              ShouldPopulateOperatingSystemExtra "" \
              false true false false true
        } should] == 0 && $should} then {
          if {[catch {
            if {$populate} then {
              object invoke -flags +NonPublic \
                  Eagle._Components.Private.PlatformOps \
                  PopulateOperatingSystemExtra "" \
                  false true true
            }

            object invoke -flags +NonPublic \
                Interpreter.GetActive WaitSetupEvent \
                $timeout
          } code] || $code ne "Ok"} then {
            tputs $channel timeout\n

            return
          }
        } else {
          tputs $channel disabled\n

          return
        }
      }

      #
      # HACK: Assume the GetInstalledUpdates method works if the
      #       associated "tcl_platform" element is populated with
      #       the update names.  Technically, this check does not
      #       rely on anything specific to Windows; however, the
      #       underlying functionality is currently only present
      #       on Windows.
      #
      if {[llength [getDictionaryValue \
          $::tcl_platform(osExtra) UpdateNames]] > 0} then {
        addConstraint getInstalledUpdates

        tputs $channel yes\n

        return
      }
    }

    tputs $channel no\n
  }

  proc checkForOperatingSystemUpdate { channel name } {
    tputs $channel [appendArgs \
        "---- checking for operating system update \"" \
        $name "\"... "]

    #
    # NOTE: Is the specific OS update currently installed?
    #
    if {[haveTclPlatformOsExtraUpdateName $name]} then {
      addConstraint [appendArgs osUpdate . [cleanConstraintName $name]]

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForScriptLibrary { channel } {
    tputs $channel "---- checking for script library... "

    #
    # NOTE: See if the variable containing the script library location
    #       exists.
    #
    if {[info exists ::tcl_library] && \
        [string length $::tcl_library] > 0} then {
      #
      # NOTE: Now see if the script library is external or embedded.
      #
      if {[file isdirectory $::tcl_library]} then {
        #
        # NOTE: Yes, it appears to be a directory name, which should
        #       mean that the necessary files are physically contained
        #       within it.
        #
        addConstraint tcl_library_external

        tputs $channel "yes (external)\n"

        #
        # NOTE: We are done here, return now.
        #
        return
      } elseif {[file isfile $::tcl_library]} then {
        #
        # NOTE: Yes, it appears to be a file name, which should mean
        #       that the necessary files are physically embedded within
        #       it.
        #
        addConstraint tcl_library_embedded

        tputs $channel "yes (embedded)\n"

        #
        # NOTE: We are done here, return now.
        #
        return
      }
    }

    tputs $channel no\n
  }

  proc checkForEnvironmentVariable {
          channel name {notEmpty true} {constraint ""} } {
    tputs $channel [appendArgs "---- checking for environment variable \"" \
        $name "\"... "]

    #
    # NOTE: Next, always check if it actually exists (as of right now).
    #
    if {[info exists ::env($name)]} then {
      #
      # NOTE: Next, optionally check if it constains anything.
      #
      if {!$notEmpty || [string length [set ::env($name)]] > 0} then {
        #
        # NOTE: The variable exists and it either contains something
        #       or we do not care about its contents.
        #
        if {[string length $constraint] > 0} then {
          addConstraint [appendArgs environment_ $constraint]
        } else {
          addConstraint [appendArgs environment_ $name]
        }

        #
        # NOTE: Show that we found the variable and whether it actually
        #       contained anything.
        #
        tputs $channel [appendArgs "yes (" \
            [expr {$notEmpty ? "exists, not empty" : "exists"}] ")\n"]

        #
        # NOTE: We are done here, return now.
        #
        return
      }
    }

    tputs $channel no\n
  }

  proc checkForVariable { channel name {notEmpty true} {constraint ""} } {
    tputs $channel [appendArgs "---- checking for variable \"" $name \
        "\"... "]

    #
    # NOTE: First, normalize the variable name to be in the global scope.
    #
    set newName [appendArgs :: [string trimleft $name :]]

    #
    # NOTE: Next, always check if it actually exists (as of right now).
    #
    if {[info exists $newName]} then {
      #
      # NOTE: Next, optionally check if it constains anything.
      #
      if {!$notEmpty || [string length [set $newName]] > 0} then {
        #
        # NOTE: The variable exists and it either contains something
        #       or we do not care about its contents.
        #
        if {[string length $constraint] > 0} then {
          addConstraint [appendArgs variable_ $constraint]
        } else {
          addConstraint [appendArgs variable_ [string trimleft $newName :]]
        }

        #
        # NOTE: Show that we found the variable and whether it actually
        #       contained anything.
        #
        tputs $channel [appendArgs "yes (" \
            [expr {$notEmpty ? "exists, not empty" : "exists"}] ")\n"]

        #
        # NOTE: We are done here, return now.
        #
        return
      }
    }

    tputs $channel no\n
  }

  proc checkForTclOptions { channel } {
    tputs $channel "---- checking for Tcl options... "

    if {![isEagle]} then {
      set result [list]

      #
      # NOTE: This test constraint is needed by test "benchmark-1.22".
      #
      if {![info exists ::no(compileNative)]} then {
        lappend result compile.NATIVE
        addConstraint compile.NATIVE
      }

      #
      # NOTE: This test constraint is needed by test "benchmark-1.22".
      #
      if {![info exists ::no(compileWindows)]} then {
        #
        # NOTE: If the current platform is Windows the Tcl binary must have
        #       been compiled for Windows.
        #
        if {[isWindows]} then {
          lappend result compile.WINDOWS
          addConstraint compile.WINDOWS
        }
      }

      #
      # NOTE: These test constraints are needed by tests "socket-*.*".
      #
      if {![info exists ::no(compileNetwork)]} then {
        lappend result compile.NETWORK
        addConstraint compile.NETWORK
      }

      if {![info exists ::no(compileConfiguration)]} then {
        lappend result compile.CONFIGURATION
        addConstraint compile.CONFIGURATION
      }

      #
      # NOTE: Just fake the invariant culture when running in native Tcl.
      #
      if {![info exists ::no(culture)]} then {
        lappend result culture.invariant
        addConstraint culture.invariant
      }

      tputs $channel [appendArgs "yes (" $result ")\n"]
    } else {
      tputs $channel no\n
    }
  }

  proc checkForWindowsCommandProcessor { channel pattern {constraint ""} } {
    tputs $channel "---- checking for Windows Command Processor... "

    if {[isWindows]} then {
      #
      # NOTE: Grab the "ComSpec" from the Windows environment and make sure it
      #       matches the file pattern supplied by the caller (e.g. "cmd.exe").
      #
      if {[info exists ::env(ComSpec)] && \
          [string match -nocase $pattern [file tail $::env(ComSpec)]]} then {
        #
        # NOTE: We are running with a matching command processor.
        #
        if {[string length $constraint] > 0} then {
          addConstraint [appendArgs comSpec_ $constraint]
        } else {
          addConstraint [appendArgs comSpec_ \
              [string map [list * _ - _ ? _ \[ _ \\ _ \] _] $pattern]]
        }

        tputs $channel [appendArgs "yes (\"" $::env(ComSpec) "\")\n"]

        #
        # NOTE: We are done here, return now.
        #
        return
      }
    }

    tputs $channel no\n
  }

  proc checkForPackage { channel pattern } {
    tputs $channel [appendArgs \
        "---- checking for loaded package matching \"" \
        $pattern "\"... "]

    if {[catch {
      foreach loaded [info loaded] {
        if {[regexp -- $pattern [lindex $loaded end]]} then {
          set package [lindex $loaded 1]; break
        }
      }
    }] == 0} then {
      #
      # NOTE: Make sure that a matching package name was found.
      #
      if {[info exists package]} then {
        #
        # NOTE: Yes, it appears that it is loaded.
        #
        addConstraint [appendArgs \
            loaded.name. [cleanPackageName $package false]]

        addConstraint [appendArgs \
            loaded.fullName. [cleanPackageName $package true]]

        #
        # NOTE: Show that the sub-command was found.
        #
        tputs $channel yes\n

        #
        # NOTE: We are done here, return now.
        #
        return
      }
    }

    tputs $channel no\n
  }

  proc checkForFossil { channel } {
    tputs $channel "---- checking for Fossil... "

    if {[info exists ::test_path]} then {
      set directory $::test_path
    } else {
      set directory ""
    }

    if {[canExecFossil] && [catch {
      execFossilCommand $directory version
    } version] == 0} then {
      set version [string trim $version]

      set pattern {^This is fossil version (.*) \[([0-9a-f]+)\]\
          \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} UTC$}

      if {[regexp -- $pattern $version dummy version sourceId]} then {
        #
        # NOTE: Add a constraint to show that the Fossil executable
        #       itself is available.
        #
        addConstraint fossil_version

        #
        # NOTE: Append the version of Fossil currently in use.
        #
        append result version " " $version " \[" $sourceId \]

        if {[canExecFossil] && [catch {
          execFossilCommand $directory remote-url
        } remoteUrl] == 0} then {
          set remoteUrl [string trim $remoteUrl]; set validUrl false

          if {[isEagle]} then {
            #
            # NOTE: With Eagle, we can actually validate the URL.
            #
            if {[uri isvalid $remoteUrl]} then {
              set validUrl true
            }
          } else {
            #
            # HACK: Currently, there is no simple way to validate
            #       an arbitrary URL with Tcl (i.e. without using
            #       some hideously complex regular expression).
            #
            if {[string length $remoteUrl] > 0} then {
              set validUrl true
            }
          }

          if {$validUrl} then {
            #
            # NOTE: Add a constraint to show that a valid Fossil
            #       repository URL appears to be available.
            #
            addConstraint fossil_repository_url

            #
            # NOTE: Unless forbidden from doing so, attempt to detect
            #       if an HTTP redirect response may have been used.
            #
            set typeOfUrl ""

            if {[isEagle] && \
                ![info exists ::no(detectRepositoryUrlType)]} then {
              if {[catch {
                uri download -inline $remoteUrl
              } remoteBody] == 0} then {
                if {[regexp -- {<!--\s*?TestBaseUrl\s*?=\s*?"(.*?)"\s*?-->} \
                        $remoteBody dummy baseUrl] || \
                    [regexp -- {<base href="(.*?)" />} $remoteBody dummy \
                        baseUrl]} then {
                  set typeOfUrl " redirected"

                  if {[string range $baseUrl end-5 end] eq "/login"} then {
                    set baseUrl [string range $baseUrl 0 end-6]
                  }

                  set remoteUrl $baseUrl
                }
              }
            }

            #
            # NOTE: If we are not prevented from doing so, save
            #       the test repository URL to the repository
            #       currently in use to a suitably named global
            #       variable.
            #
            if {![info exists ::no(setRepositoryUrl)]} then {
              set ::test_repository_url $remoteUrl
            }

            #
            # NOTE: Append the repository URL currently in use.
            #
            append result ", remote" $typeOfUrl " URL \"" $remoteUrl \"
          }
        }

        if {[canExecFossil] && [catch {
          execFossilCommand $directory info
        } info] == 0} then {
          set info [string trim $info]; set validFile false

          if {[string length $info] > 0} then {
            set pattern {^repository:\s+(.*?)$}

            if {[regexp -line -- $pattern $info dummy repository]} then {
              set repository [string trim $repository]

              if {[file exists $repository]} then {
                set validFile true
              }
            }
          }

          if {$validFile} then {
            #
            # NOTE: Add a constraint to show that a valid Fossil
            #       repository file appears to be available.
            #
            addConstraint fossil_repository_file

            #
            # NOTE: Make sure the file name is fully normalized.
            #
            set repository [file normalize $repository]

            #
            # NOTE: If we are not prevented from doing so, save
            #       the test repository file for the repository
            #       currently in use to a suitably named global
            #       variable.
            #
            if {![info exists ::no(setRepositoryFile)]} then {
              set ::test_repository_file $repository
            }

            #
            # NOTE: Append the repository file currently in use.
            #
            append result ", local file \"" $repository \"
          }
        }

        #
        # NOTE: Show the result of the checking.
        #
        tputs $channel [appendArgs "yes (" $result ")\n"]

        #
        # NOTE: We are done here, return now.
        #
        return
      }
    }

    tputs $channel no\n
  }

  proc checkForVisualStudioViaVsWhere { channel } {
    tputs $channel "---- checking for Visual Studio using \"vswhere\"... "

    #
    # NOTE: Initially, no versions of Visual Studio have been found.
    #
    set visualStudioVersions [list]

    #
    # NOTE: Use of the "vswhere" tool must be enabled for us to detect
    #       any instances of Visual Studio.
    #
    if {[isWindows] && [canExecVsWhere]} then {
      #
      # NOTE: The versions of Visual Studio that we support detection
      #       of using the "vswhere" tool.
      #
      set versions [list \
          [list 15.0 2017] [list 16.0 2019] [list 17.0 2022]]

      #
      # NOTE: Check each version and keep track of the ones we find.
      #
      foreach version $versions {
        #
        # NOTE: Attempt to fetch Visual Studio install directories
        #       value using the "vswhere" tool.
        #
        if {[catch {
          exec -- vswhere -products * -version [lindex $version 0] \
              -property installationPath -latest
        } installationPaths] == 0} then {
          #
          # NOTE: Check each Visual Studio install directory, in the
          #       order they were returned, after splitting them into
          #       a proper Tcl list.
          #
          set installationPaths [split [string map [list \r\n \n] \
              [string trim $installationPaths]] \n]

          foreach installationPath $installationPaths {
            #
            # NOTE: Remove the trailing backslash, if any.  Does the
            #       directory name look valid and does it actually
            #       exist?
            #
            set fileName [file join \
                [string trimright $installationPath \\] Common7 IDE \
                msenv.dll]

            if {[file isfile $fileName]} then {
              #
              # NOTE: Yes, it appears that it is available.
              #
              addConstraint [appendArgs \
                  visualStudio [lindex $version 1]]

              #
              # NOTE: Keep track of all the versions that we find.
              #
              lappend visualStudioVersions [lindex $version 1]

              #
              # NOTE: Save the directory for later usage by the test
              #       suite itself.
              #
              if {![info exists ::no(setVisualStudio)]} then {
                set ::test_visual_studio [file dirname $fileName]
              }

              #
              # HACK: Stop after we find the first instance of Visual
              #       Studio with the requested version.
              #
              break
            }
          }
        }
      }
    }

    if {[llength $visualStudioVersions] > 0} then {
      #
      # NOTE: Show where we found the latest version.
      #
      tputs $channel [appendArgs \
          "yes (" $visualStudioVersions ", \"" \
          [expr {[info exists ::test_visual_studio] ? \
              $::test_visual_studio : "<none>"}] "\")\n"]
    } else {
      tputs $channel no\n
    }
  }

  proc checkForEagle { channel } {
    tputs $channel "---- checking for Eagle... "

    if {[isEagle]} then {
      #
      # NOTE: We are running inside Eagle.
      #
      addConstraint eagle

      #
      # NOTE: We do not want to skip bugs or crashing
      #       issues for Tcl since we are not running
      #       in Tcl.
      #
      addConstraint tclBug
      addConstraint tclCrash

      #
      # NOTE: Add the necessary constraints for each
      #       version of Tcl we know about.
      #
      foreach tclVersion [getKnownTclVersions] {
        set version [getDotlessVersion $tclVersion]

        addConstraint [appendArgs tclBug $version]
        addConstraint [appendArgs tclCrash $version]
      }

      tputs $channel yes\n
    } else {
      #
      # NOTE: We are running inside Tcl.
      #
      addConstraint tcl

      #
      # NOTE: Each Tcl bug and crash constraint is set
      #       based on the exact Tcl version (i.e. not
      #       greater than or equal to).
      #
      if {[info exists ::tcl_version]} then {
        #
        # NOTE: For each Tcl version we know about,
        #       check it against the currently running
        #       Tcl version.  If the two are not equal,
        #       add the test constraints that prevent
        #       skipping those tests that are buggy
        #       only for the particular version of Tcl.
        #
        foreach tclVersion [getKnownTclVersions] {
          set dotVersion [getDottedVersion $tclVersion]

          if {$::tcl_version ne $dotVersion} then {
            set version [getDotlessVersion $tclVersion]

            addConstraint [appendArgs tclBug $version]
            addConstraint [appendArgs tclCrash $version]
          }
        }
      }

      #
      # NOTE: We do not want to skip bugs or crashing
      #       issues for Eagle since we are not running
      #       in Eagle.
      #
      addConstraint eagleBug
      addConstraint eagleCrash

      tputs $channel no\n
    }
  }

  proc checkForSymbols { channel name {constraint ""} } {
    set fileName [file normalize [appendArgs [file rootname $name] .pdb]]

    tputs $channel [appendArgs "---- checking for symbols \"" $fileName \
        "\"... "]

    if {[file exists $fileName]} then {
      #
      # NOTE: The file appears to have associated symbols available.
      #
      if {[string length $constraint] > 0} then {
        addConstraint [appendArgs symbols_ $constraint]
      } else {
        addConstraint [appendArgs symbols_ [file tail $name]]
      }

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForLogFile { channel } {
    tputs $channel "---- checking for log file... "

    if {[info exists ::test_log] && \
        [string length $::test_log] > 0 && \
        [file exists $::test_log]} then {
      #
      # NOTE: The log file appears to be available.
      #
      addConstraint logFile

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForGaruda { channel } {
    tputs $channel "---- checking for Garuda... "

    if {[haveGaruda packageId]} then {
      #
      # NOTE: We are running with or via Garuda.
      #
      addConstraint garuda

      tputs $channel [appendArgs "yes (" $packageId ")\n"]
    } else {
      tputs $channel no\n
    }
  }

  proc checkForShell { channel } {
    tputs $channel "---- checking for shell... "

    set name [file rootname [file tail [getShellExecutableName]]]

    if {[isEagle]} then {
      #
      # NOTE: By default, use strict matching of the shell executable
      #       name (exact); otherwise, match any executable names that
      #       start with "Eagle".
      #
      if {![info exists ::no(strictCheckForShell)]} then {
        set match [expr {
          $name in [list \
              Eagle Eagle32 Eagle64 EagleShell EagleShell32 \
              EagleShell64 EagleKit EagleKit32 EagleKit64]
        }]
      } else {
        set match [string match Eagle* $name]
      }

      #
      # NOTE: Does the name of the executable file appear to be a match
      #       for one of the "well-known" shells?
      #
      if {$match} then {
        #
        # NOTE: We are running in Eagle via the EagleShell.
        #
        addConstraint shell
        addConstraint [appendArgs shell. $name]
        addConstraint dotNetCoreOrShell

        tputs $channel "yes (Eagle)\n"

        #
        # NOTE: We are done here, return now.
        #
        return
      }
    } else {
      if {[string match tclsh* $name]} then {
        #
        # NOTE: We are running in Tcl via tclsh.
        #
        addConstraint shell
        addConstraint [appendArgs shell. $name]
        addConstraint dotNetCoreOrShell

        tputs $channel "yes (Tcl)\n"

        #
        # NOTE: We are done here, return now.
        #
        return
      }
    }

    tputs $channel no\n
  }

  proc checkForOfficialStableReleaseInProgress { channel } {
    #
    # NOTE: If the tests appear to be running as part of the official stable
    #       release process for Eagle, then add the test constraint that will
    #       be checked by the [fixTimingConstraints] procedure, so that tests
    #       using it will not be counted against the overall results of the
    #       test run.
    #
    tputs $channel "---- checking for official stable release in progress... "

    if {[info exists ::env(OFFICIAL)] && [info exists ::env(STABLE)]} then {
      addConstraint officialStableReleaseInProgress

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForDebug { channel } {
    tputs $channel "---- checking for debug... "

    if {[info exists ::tcl_platform(debug)] && $::tcl_platform(debug)} then {
      addConstraint debug

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTk { channel } {
    tputs $channel "---- checking for Tk... "

    #
    # HACK: For now, disable testing Tk 8.4/8.5 when running in Eagle.
    #
    if {![isEagle] || [haveConstraint tclLibrary86] || \
        [haveConstraint tclLibrary87]} then {
      addConstraint tk

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForVersion { channel } {
    tputs $channel "---- checking for language version... "

    if {[info exists ::tcl_version]} then {
      #
      # NOTE: First, obtain the list of all "known" Tcl versions.
      #
      set tclVersions [getKnownTclVersions]

      #
      # NOTE: *EAGLE* We do want to include any tests that target
      #       "Tcl 8.X or higher" features because those tests
      #       would not be in the test suite if we did not support
      #       that particular feature, regardless of the language
      #       version.
      #
      if {[isEagle]} then {
        #
        # NOTE: Process each "known" Tcl version, adding each of
        #       the "feature" constraints (i.e. since this is an
        #       Eagle test suite infrastructure package).
        #
        foreach tclVersion(1) $tclVersions {
          set version(1) [getDotlessVersion $tclVersion(1)]
          addConstraint [appendArgs tcl $version(1) Feature]
        }
      }

      #
      # NOTE: Process each "known" Tcl version, checking for an
      #       exact match with the running Tcl version.  When an
      #       exact match is found, add appropriate constraints.
      #
      foreach tclVersion(1) $tclVersions {
        #
        # NOTE: Does the running Tcl version match this "known"
        #       Tcl version exactly?
        #
        if {$::tcl_version eq [getDottedVersion $tclVersion(1)]} then {
          #
          # NOTE: Yes, it does.  First, add the "exact" match
          #       constraint.  There can be only one of these.
          #
          addConstraint [appendArgs \
              tcl [getDotlessVersion $tclVersion(1)]]

          #
          # NOTE: Next, process each of the "known" Tcl versions
          #       less than or equal to the running Tcl version,
          #       while adding both the "feature" and "or higher"
          #       constraints.  There will always be at least one
          #       of these.
          #
          foreach tclVersion(2) [filterKnownVersions \
              $tclVersions "" $tclVersion(1)] {
            set version(2) [getDotlessVersion $tclVersion(2)]
            addConstraint [appendArgs tcl $version(2) Feature]
            addConstraint [appendArgs tcl $version(2) OrHigher]
          }

          #
          # NOTE: Finally, process each of the "known" Tcl versions
          #       greater than or equal to the running Tcl version,
          #       while adding the "or lower" constraints.  There
          #       will always be at least one of these.
          #
          foreach tclVersion(3) [filterKnownVersions \
              $tclVersions $tclVersion(1) ""] {
            set version(3) [getDotlessVersion $tclVersion(3)]
            addConstraint [appendArgs tcl $version(3) OrLower]
          }

          #
          # NOTE: There can be only one exact Tcl version match;
          #       therefore, we are done.
          #
          break
        }
      }

      tputs $channel [appendArgs $::tcl_version \n]
    } else {
      tputs $channel no\n
    }
  }

  proc checkForCommand { channel name } {
    tputs $channel [appendArgs "---- checking for command \"" $name \
        "\"... "]

    #
    # NOTE: Is the command available?
    #
    if {[llength [info commands $name]] > 0} then {
      #
      # NOTE: Yes, it appears that it is available.
      #
      addConstraint [appendArgs command. $name]

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForSubCommand { channel names } {
    tputs $channel [appendArgs "---- checking for sub-command \"" $names \
        "\"... "]

    #
    # NOTE: Is the sub-command available?  The list of names must have
    #       exactly two elements.  The first element must be the command
    #       name and the second element must be the sub-command name.
    #
    if {[llength $names] == 2} then {
      set commandName [lindex $names 0]
      set subCommandName [lindex $names 1]

      if {[isEagle]} then {
        if {[catch {
          #
          # NOTE: For Eagle, use the [info subcommands] sub-command.
          #
          info subcommands $commandName
        } subCommands] == 0} then {
          if {[lsearch -exact -- $subCommands $subCommandName] != -1} then {
            #
            # NOTE: Yes, it appears that it is available.
            #
            addConstraint [appendArgs \
                subCommand. $commandName . $subCommandName]

            #
            # NOTE: Show that the sub-command was found.
            #
            tputs $channel yes\n

            #
            # NOTE: We are done here, return now.
            #
            return
          }
        }
      } elseif {$::tcl_version >= 8.5} then {
        if {[catch {
          #
          # NOTE: For Tcl 8.5+, use the [namespace ensemble] sub-command.
          #
          namespace ensemble configure $commandName
        } subCommands] == 0} then {
          foreach {name value} [getDictionaryValue $subCommands -map] {
            if {$name eq $subCommandName} then {
              #
              # NOTE: Yes, it appears that it is available.
              #
              addConstraint [appendArgs \
                  subCommand. $commandName . $subCommandName]

              #
              # NOTE: Show that the sub-command was found.
              #
              tputs $channel yes\n

              #
              # NOTE: We are done here, return now.
              #
              return
            }
          }
        }
      }
    }

    tputs $channel no\n
  }

  proc checkForIntIsWide { channel } {
    tputs $channel "---- checking for \"int\" same as \"wide\"... "

    if {[catch {
      #
      # HACK: On some systems (e.g. Linux x86_64), the "int" Tcl type
      #       is the same as the "wide" Tcl type.  This never applies
      #       to Eagle.
      #
      expr {int(0x7fffffffffffffff) == wide(0x7fffffffffffffff)}
    } sameAsWide] == 0 && [string is true -strict $sameAsWide]} then {
      addConstraint intIsWide

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForEFormat { channel } {
    tputs $channel "---- checking for \"eformat\" support... "

    if {[catch {
      #
      # HACK: This test was stolen directly from the native Tcl source
      #       file "library/tcltest/tcltest.tcl", which is part of the
      #       "tcltest" package.
      #
      if {[isEagle]} then {
        expr {
          [string equal [format %.0e 5e-5] 5e-05] && \
              [string equal [format %#.5g 0] 0.0000]
        }
      } else {
        expr {
          [string equal [format %g 5e-5] 5e-05] && \
              [string equal [format %#.5g 0] 0.0000]
        }
      }
    } eformat] == 0 && [string is true -strict $eformat]} then {
      addConstraint eformat

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForNamespaces { channel quiet } {
    tputs $channel "---- checking for namespace support... "

    if {[isEagle]} then {
      #
      # NOTE: Check if namespace support was compiled into the core
      #       library (i.e. this is beta 30 or later).
      #
      if {[catch {namespace enable} enabled] == 0} then {
        set available true

        addConstraint namespaces.available
      } else {
        set available false

        addConstraint namespaces.unavailable
      }

      #
      # NOTE: We were able to query for namespace support (i.e. this
      #       must be beta 29 or later); however, we still need to
      #       check if it has been enabled at runtime.
      #
      if {[string is true -strict $enabled]} then {
        #
        # NOTE: Yes, it appears that it is available and enabled.
        #
        addConstraint namespaces

        tputs $channel enabled\n
      } else {
        tputs $channel disabled\n

        #
        # NOTE: Check if namespace support was compiled into the core
        #       library (i.e. is this beta 30 or later).
        #
        if {!$quiet && $available} then {
          #
          # NOTE: The tests seem to be running with namespace support
          #       available, but disabled.  Emit a warning into the
          #       test log file.
          #
          tputs $channel \
              "==== WARNING: running with namespaces available and disabled\n"
        }
      }
    } else {
      #
      # NOTE: All supported versions of native Tcl have namespaces enabled
      #       and available.
      #
      addConstraint namespaces.available
      addConstraint namespaces

      tputs $channel enabled\n
    }
  }

  proc checkForTestExec { channel quiet } {
    tputs $channel "---- checking for test use of \"exec\" command... "

    set procName [lindex [info level [info level]] 0]

    if {![info exists ::no(testExec)] && [canTestExec $procName]} then {
      addConstraint testExec

      tputs $channel yes\n

      if {!$quiet && [info exists ::no(exec)]} then {
        tputs $channel \
            "==== WARNING: running with the \"testExec\" procedure disabled\n"
      }
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTestMachine { channel } {
    tputs $channel "---- checking for test machine... "

    if {[info exists ::test_machine] && \
        [string length $::test_machine] > 0} then {
      addConstraint [appendArgs machine. $::test_machine]

      tputs $channel [appendArgs $::test_machine \n]
    } else {
      tputs $channel unknown\n
    }
  }

  proc checkForTestPlatform { channel } {
    tputs $channel "---- checking for test platform... "

    if {[info exists ::test_platform] && \
        [string length $::test_platform] > 0} then {
      addConstraint [appendArgs platform. $::test_platform]

      tputs $channel [appendArgs $::test_platform \n]
    } else {
      tputs $channel unknown\n
    }
  }

  proc checkForTestConfiguration { channel } {
    tputs $channel "---- checking for test configuration... "

    if {[info exists ::test_configuration] && \
        [string length $::test_configuration] > 0} then {
      addConstraint [appendArgs configuration. $::test_configuration]

      tputs $channel [appendArgs $::test_configuration \n]
    } else {
      tputs $channel unknown\n
    }
  }

  proc checkForTestNamePrefix { channel } {
    tputs $channel "---- checking for test name prefix... "

    if {[info exists ::test_name_prefix] && \
        [string length $::test_name_prefix] > 0} then {
      addConstraint [appendArgs namePrefix. $::test_name_prefix]

      tputs $channel [appendArgs $::test_name_prefix \n]
    } else {
      tputs $channel unknown\n
    }
  }

  proc checkForTestSuffix { channel } {
    tputs $channel "---- checking for test suffix... "

    if {[info exists ::test_suffix] && \
        [string length $::test_suffix] > 0} then {
      addConstraint [appendArgs suffix. $::test_suffix]

      tputs $channel [appendArgs $::test_suffix \n]
    } else {
      tputs $channel unknown\n
    }
  }

  proc checkForGnuScreen { channel } {
    #
    # HACK: This is not 100% reliable; however, it should be "good enough"
    #       for our purposes.
    #
    tputs $channel "---- checking for GNU Screen... "

    if {([info exists ::env(TERM)] && $::env(TERM) eq "screen") || \
        [info exists ::env(STY)]} then {
      addConstraint gnuScreen

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForFile { channel name {constraint ""} } {
    tputs $channel [appendArgs "---- checking for file \"" \
        [file normalize $name] "\"... "]

    if {[file exists $name]} then {
      #
      # NOTE: Yes, it appears that it is available.
      #
      if {[string length $constraint] > 0} then {
        addConstraint [appendArgs file_ $constraint]
      } else {
        addConstraint [appendArgs file_ [file tail $name]]
      }

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForPathFile { channel name {constraint ""} } {
    tputs $channel [appendArgs "---- checking for file \"" $name \
        "\" along PATH... "]

    if {[file exists $name]} then {
      #
      # NOTE: Yes, it appears that it is available [in the exact location they
      #       specified].
      #
      if {[string length $constraint] > 0} then {
        addConstraint [appendArgs file_ $constraint]
      } else {
        addConstraint [appendArgs file_ [file tail $name]]
      }

      tputs $channel yes\n

      #
      # NOTE: We are done here, return now.
      #
      return
    } else {
      #
      # NOTE: Use the appropriate environment variable for the platform.
      #
      if {[isWindows]} then {
        set pathName PATH
      } else {
        #
        # HACK: For shared libraries, use the LD_LIBRARY_PATH.
        #
        if {[file extension $name] eq [info sharedlibextension]} then {
          set pathName LD_LIBRARY_PATH
        } else {
          set pathName PATH
        }
      }

      #
      # NOTE: Is the required environment variable available?
      #
      if {[info exists ::env($pathName)]} then {
        #
        # NOTE: Ok, grab it now.
        #
        set path $::env($pathName)

        #
        # NOTE: Use the appropriate path separator for the platform.
        #
        if {[info exists ::tcl_platform(pathSeparator)]} then {
          set separator $::tcl_platform(pathSeparator)
        } elseif {[isWindows]} then {
          set separator \;
        } else {
          set separator :
        }

        #
        # NOTE: Grab just the file name from the possibly fully qualified file
        #       name provided by the caller.
        #
        set tail [file tail $name]

        #
        # NOTE: Check each directory in the PATH for the file.
        #
        foreach directory [split $path $separator] {
          #
          # NOTE: Check for the file in this directory contained in the PATH.
          #       This strips the directory portion off the file name specified
          #       by the caller, if any, before joining that file name to the
          #       current directory of the PATH being searched.
          #
          if {[file exists [file join $directory $tail]]} then {
            #
            # NOTE: Yes, it appears that it is available in the PATH.
            #
            if {[string length $constraint] > 0} then {
              addConstraint [appendArgs file_ $constraint]
            } else {
              addConstraint [appendArgs file_ [file tail $name]]
            }

            tputs $channel yes\n

            #
            # NOTE: We are done here, return now.
            #
            return
          }
        }
      }
    }

    tputs $channel no\n
  }

  proc checkForNativeCode { channel } {
    tputs $channel "---- checking for native code... "

    if {[isEagle]} then {
      if {[info exists ::eagle_platform(compileOptions)] && \
          [info exists ::tcl_platform(platform)] && \
          [lsearch -exact -nocase $::eagle_platform(compileOptions) \
          $::tcl_platform(platform)] != -1} then {
        #
        # NOTE: Yes, the binary matches the current platform,
        #       native code can be used.
        #
        addConstraint native

        tputs $channel yes\n
      } else {
        tputs $channel no\n
      }
    } else {
      #
      # NOTE: Tcl is always native code and can always execute native code.
      #
      addConstraint native

      tputs $channel yes\n
    }
  }

  proc checkForTip127 { channel } {
    tputs $channel "---- checking for TIP #127... "

    #
    # NOTE: Is the interpreter TIP #127 ready?
    #
    if {[catch {lsearch -index 0 0 0}] == 0} then {
      addConstraint tip127

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTip182 { channel } {
    tputs $channel "---- checking for TIP #182... "

    #
    # NOTE: Is the interpreter TIP #182 ready?
    #
    if {[catch {expr {bool(0)}}] == 0} then {
      addConstraint tip182

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTip194 { channel } {
    tputs $channel "---- checking for TIP #194... "

    #
    # NOTE: Is the interpreter TIP #194 ready?
    #
    catch {apply} error

    if {$error ne {invalid command name "apply"}} then {
      addConstraint tip194

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTip207 { channel } {
    tputs $channel "---- checking for TIP #207... "

    #
    # NOTE: Is the interpreter TIP #207 ready?
    #
    catch {interp invokehidden {} -namespace -- info} error

    if {![string match {bad option "-namespace": *} $error]} then {
      addConstraint tip207

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTip241 { channel } {
    tputs $channel "---- checking for TIP #241... "

    #
    # NOTE: Is the interpreter TIP #241 ready?
    #
    if {[catch {lsearch -nocase 0 0}] == 0} then {
      addConstraint tip241

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTip285 { channel } {
    tputs $channel "---- checking for TIP #285... "

    if {[alwaysFullInterpReady]} then {
      #
      # NOTE: Is the interpreter TIP #285 ready?
      #
      catch {interp cancel} error

      if {$error eq "eval canceled"} then {
        addConstraint tip285

        tputs $channel yes\n

        #
        # NOTE: We are done here, return now.
        #
        return
      }
    }

    tputs $channel no\n
  }

  proc checkForTip405 { channel } {
    tputs $channel "---- checking for TIP #405... "

    #
    # NOTE: Does the interpreter have TIP #405 (i.e. [lmap])?
    #
    catch {lmap} error

    if {$error ne "invalid command name \"lmap\""} then {
      addConstraint tip405

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTip421 { channel } {
    tputs $channel "---- checking for TIP #421... "

    #
    # NOTE: Is the interpreter TIP #421 ready?
    #
    if {[catch {
      set array(1) one; set list [list]

      array for {name value} array {
        lappend list $name $value
      }

      set list
    } result] == 0 && $result eq [list 1 one]} then {
      addConstraint tip421

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTip426 { channel } {
    tputs $channel "---- checking for TIP #426... "

    #
    # NOTE: Is the interpreter TIP #426 ready?
    #
    catch {info cmdtype} error

    if {$error eq {wrong # args: should be "info cmdtype commandName"}} then {
      addConstraint tip426

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTip429 { channel } {
    tputs $channel "---- checking for TIP #429... "

    #
    # NOTE: Is the interpreter TIP #429 ready?
    #
    if {[catch {string cat}] == 0} then {
      addConstraint tip429

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTip440 { channel } {
    tputs $channel "---- checking for TIP #440... "

    #
    # NOTE: Is the interpreter TIP #440 ready?
    #
    if {[catch {set ::tcl_platform(engine)} engine] == 0} then {
      addConstraint tip440

      tputs $channel [appendArgs "yes (" $engine ")\n"]
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTip461 { channel } {
    tputs $channel "---- checking for TIP #461... "

    #
    # NOTE: Is the interpreter TIP #461 ready?
    #
    if {[catch {
      set expr(ge) {int("abc" ge "abc")}
      set expr(gt) {int("abc" gt "abc")}
      set expr(le) {int("abc" le "abc")}
      set expr(lt) {int("abc" lt "abc")}

      list [expr $expr(ge)] [expr $expr(gt)] \
          [expr $expr(le)] [expr $expr(lt)]
    }] == 0} then {
      addConstraint tip461

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTip463 { channel } {
    tputs $channel "---- checking for TIP #463... "

    #
    # NOTE: Is the interpreter TIP #463 ready?
    #
    if {[catch {
      regsub -command . . list
    }] == 0} then {
      addConstraint tip463

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTip471 { channel } {
    tputs $channel "---- checking for TIP #471... "

    #
    # NOTE: Is the interpreter TIP #471 ready?
    #
    catch {info linkedname} error

    if {[string match {wrong # args: should be "*} $error]} then {
      addConstraint tip471

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTip508 { channel } {
    tputs $channel "---- checking for TIP #508... "

    #
    # NOTE: Is the interpreter TIP #508 ready?
    #
    catch {array default} error

    if {[string match {wrong # args: should be "*} $error]} then {
      addConstraint tip508

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTip521 { channel } {
    tputs $channel "---- checking for TIP #521... "

    #
    # NOTE: Is the interpreter TIP #521 ready?
    #
    if {[catch {fpclassify 1.0}] == 0} then {
      addConstraint tip521

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTiming {
          channel threshold {constraint ""} {tries 1} {delay 1000}
          {average false} {asynchronous false} } {
    tputs $channel [appendArgs \
        "---- checking for precision timing (threshold of " $threshold \
        " milliseconds" [expr {$average ? " average" : ""}] ", delay of " \
        $delay " milliseconds)... "]

    #
    # HACK: Sometimes the first try takes quite a bit longer than subsequent
    #       tries.  We attempt to bypass this problem by retrying a set number
    #       of times (which can be overridden by the caller) before giving up.
    #
    set total 0
    set difference unknown

    for {set try 0} {$try < $tries} {incr try} {
      #
      # NOTE: Create a script that will set the final clicks value.  This must
      #       use a global variable due to the nature of [after].
      #
      set stopScript {
        set ::stopClicks [expr {[clock clicks -milliseconds] & 0x7fffffff}]
      }

      #
      # NOTE: Set the initial clicks value and then attempt to wait for about
      #       one second, either synchronously or asynchronously, depending on
      #       the preference of the caller.
      #
      set start [expr {[clock clicks -milliseconds] & 0x7fffffff}]

      if {$asynchronous} then {
        set event [after $delay $stopScript]; vwait ::stopClicks
      } else {
        after $delay; eval $stopScript
      }

      #
      # NOTE: Move the final clicks value from the global frame to this one.
      #
      set stop $::stopClicks; unset ::stopClicks

      #
      # NOTE: Calculate the difference between the actual and expected
      #       number of milliseconds.
      #
      set difference [expr {abs($stop - $start - $delay)}]

      #
      # NOTE: Keep track of the total number of milliseconds elapsed for
      #       all iterations of this loop.
      #
      incr total $difference

      #
      # NOTE: If we are using the average difference, handle that now.
      #
      if {$average && $tries > 1} then {
        set difference [expr {$total / $tries}]
      }

      #
      # NOTE: Are we within the threshold specified by the caller?
      #
      if {$difference >= 0 && $difference <= $threshold} then {
        #
        # NOTE: We appear to be capable of fairly precise timing.
        #
        if {[string length $constraint] == 0} then {
          set constraint timing
        }

        addConstraint $constraint

        tputs $channel [appendArgs \
            "yes (0 <= " $difference " <= " $threshold " milliseconds" \
            [expr {$average ? " average" : ""}] ", tried " [expr {$try + 1}] \
            " out of " $tries " " [expr {$tries > 1 ? "times" : "time"}] \
            ", \"" $constraint "\")\n"]

        #
        # NOTE: We are done here, return now.
        #
        return
      }
    }

    tputs $channel [appendArgs \
        "no (0 <= " $difference " > " $threshold " milliseconds" \
        [expr {$average ? " average" : ""}] ", tried " $try " out of " \
        $tries " " [expr {$tries > 1 ? "times" : "time"}] ")\n"]
  }

  proc checkForPerformance { channel } {
    tputs $channel "---- checking for performance testing... "

    #
    # NOTE: Are we allowed to do performance testing?
    #
    if {![info exists ::no(performance)]} then {
      addConstraint performance

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForBigLists { channel } {
    tputs $channel "---- checking for big list testing... "

    #
    # NOTE: Are we allowed to do big list testing?
    #
    if {![info exists ::no(bigLists)]} then {
      if {[isEagle]} then {
        #
        # MONO: Using the native utility library when running on Mono to
        #       join big lists seems to cause StackOverflowException to
        #       be thrown.
        #
        if {![isTestMono] || ![haveConstraint nativeUtility]} then {
          #
          # NOTE: Yes, it appears that it is available.
          #
          addConstraint bigLists

          tputs $channel yes\n
        } else {
          tputs $channel "no, broken on Mono with native utility\n"
        }
      } else {
        addConstraint bigLists

        tputs $channel yes\n
      }
    } else {
      tputs $channel no\n
    }
  }

  proc checkForProcessorIntensive { channel } {
    tputs $channel "---- checking for processor intensive testing... "

    #
    # NOTE: Are we allowed to do processor intensive testing?
    #
    if {![info exists ::no(processorIntensive)]} then {
      addConstraint maybeProcessorIntensive
      addConstraint processorIntensive

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForFileSystemIntensive { channel } {
    tputs $channel "---- checking for file system intensive testing... "

    #
    # NOTE: Are we allowed to do file system intensive testing?
    #
    if {![info exists ::no(fileSystemIntensive)]} then {
      addConstraint maybeFileSystemIntensive
      addConstraint fileSystemIntensive

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTimeIntensive { channel } {
    tputs $channel "---- checking for time intensive testing... "

    #
    # NOTE: Are we allowed to do time intensive testing?
    #
    if {![info exists ::no(timeIntensive)]} then {
      addConstraint maybeTimeIntensive
      addConstraint timeIntensive

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForFullTest { channel } {
    tputs $channel "---- checking for full testing... "

    #
    # NOTE: Are we allowed to do full testing (i.e. to run rarely
    #       needed tests)?
    #
    if {![info exists ::no(fullTest)]} then {
      addConstraint fullTest

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForMemoryIntensive { channel {memoryThreshold 3000000000} } {
    tputs $channel "---- checking for memory intensive testing... "

    #
    # NOTE: Are we allowed to do memory intensive testing?
    #
    if {![info exists ::no(memoryIntensive)]} then {
      if {[isEagle] && $memoryThreshold > 0} then {
        if {[catch {debug memory} memory] == 0} then {
          set totalPhysical [getDictionaryValue $memory totalPhysical]

          if {[string length $totalPhysical] == 0} then {
            addConstraint memoryIntensive

            tputs $channel "yes (unknown)\n"
          } else {
            if {[string is wideinteger -strict $totalPhysical] && \
                $totalPhysical >= $memoryThreshold} then {
              addConstraint memoryIntensive

              tputs $channel yes\n
            } else {
              tputs $channel no\n
            }
          }
        } else {
          tputs $channel error\n
        }
      } else {
        #
        # HACK: This is either native Tcl -OR- memory threshold
        #       checks have been explicitly disabled.
        #
        addConstraint memoryIntensive

        tputs $channel "yes (skipped)\n"
      }
    } else {
      tputs $channel no\n
    }
  }

  proc checkForStackIntensive { channel } {
    tputs $channel "---- checking for stack intensive testing... "

    #
    # NOTE: Are we allowed to do stack intensive testing?
    #
    if {![info exists ::no(stackIntensive)]} then {
      if {[isEagle]} then {
        #
        # NOTE: Attempt to query for native stack checking in Eagle.
        #
        if {[catch {
          object invoke -flags +NonPublic \
              Eagle._Components.Private.NativeStack IsAvailable
        } isAvailable] == 0 && \
            [string is true -strict $isAvailable]} then {
          #
          # NOTE: Yes, it appears that it is available.
          #
          addConstraint stackIntensive

          tputs $channel yes\n
        } else {
          tputs $channel no\n
        }
      } else {
        addConstraint stackIntensive

        tputs $channel yes\n
      }
    } else {
      tputs $channel no\n
    }
  }

  proc checkForStackSize { channel } {
    tputs $channel "---- checking for stack size... "

    #
    # NOTE: Are we allowed to do stack size testing?
    #
    if {![info exists ::no(stackSize)]} then {
      if {[isEagle]} then {
        #
        # NOTE: Attempt to query for the executable stack size.
        #
        if {[catch {
          set reserve [object invoke -create UIntPtr Zero]
          set commit [object invoke -create UIntPtr Zero]

          #
          # HACK: This does not use the [getShellExecutableName] script
          #       library procedure because it must always refer to the
          #       name of the file that started the current process.
          #
          object invoke -flags +NonPublic \
              Eagle._Components.Private.FileOps \
              GetPeFileStackReserveAndCommit \
              [info nameofexecutable] reserve commit; # EXEMPT

          set reserve; # primitive, already numeric.
        } stackSize] == 0 && \
            [string is integer -strict $stackSize] && $stackSize > 0} then {
          addConstraint [appendArgs stackSize.0x [format %x $stackSize]]

          tputs $channel [appendArgs "yes (" $stackSize ")\n"]
        } else {
          tputs $channel no\n
        }
      } else {
        #
        # NOTE: There is no cross-platform way to check this in
        #       native Tcl.
        #
        addConstraint stackSize.unlimited; # TODO: Fix me?

        tputs $channel yes\n
      }
    } else {
      tputs $channel no\n
    }
  }

  proc checkForInteractive { channel } {
    tputs $channel "---- checking for interactive user... "

    #
    # NOTE: Is there an interactive user?
    #
    if {[info exists ::tcl_interactive] && $::tcl_interactive} then {
      addConstraint interactive

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForInteractiveFocus { channel } {
    tputs $channel "---- checking for interactive focus... "

    if {[isEagle]} then {
      if {[catch {
        set error null

        object invoke -flags +NonPublic \
            Eagle._Components.Private.NativeConsole \
            HasWindowFocus null error
      } hasFocus] == 0} then {
        if {$hasFocus} then {
          addConstraint interactiveFocus

          tputs $channel yes\n
        } else {
          tputs $channel no\n
        }
      } else {
        tputs $channel error\n
      }
    } else {
      tputs $channel unknown\n
    }
  }

  proc checkForInteractiveCommand { channel name } {
    tputs $channel [appendArgs "---- checking for interactive command \"" \
        $name "\"... "]

    #
    # NOTE: Currently, only Eagle has "interactive commands".
    #
    if {[isEagle]} then {
      #
      # NOTE: Attempt to query the interactive command names from Eagle.
      #
      if {[catch {
        object invoke Utility GetInteractiveCommandNames "" $name false
      } names] == 0 && [llength $names] > 0} then {
        #
        # NOTE: Yes, it appears that it is available.
        #
        addConstraint [appendArgs interactiveCommand. $name]

        tputs $channel yes\n

        #
        # NOTE: We are done here, return now.
        #
        return
      }
    }

    tputs $channel no\n
  }

  proc checkForUserInteraction { channel } {
    tputs $channel "---- checking for user interaction... "

    #
    # HACK: For now, do the exact same check as checkForInteractive; however,
    #       this is still useful as a separate constraint because it can be
    #       individually disabled in "prologue.eagle".
    #
    if {[info exists ::tcl_interactive] && $::tcl_interactive} then {
      addConstraint userInteraction

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForOfflineMode { channel } {
    tputs $channel "---- checking for offline mode... "

    if {[isEagle]} then {
      if {[catch {uri offline} offline] == 0} then {
        if {$offline} then {
          addConstraint offlineMode

          tputs $channel yes\n
        } else {
          tputs $channel no\n
        }
      } else {
        tputs $channel error\n
      }
    } else {
      tputs $channel no\n
    }
  }

  proc checkForNetwork { channel host timeout {successOnly false} } {
    tputs $channel [appendArgs \
        "---- checking for network connectivity to host \"" $host "\"... "]

    if {[isEagle]} then {
      #
      # HACK: Fixup the "host" argument in case it is actually a full URI,
      #       with a scheme, etc, e.g. "https://eagle.to/" ==> "eagle.to".
      #       This should not happen, but it does, because the prologue is
      #       maintained by a very lazy programmer.
      #
      if {[regexp -skip 1 -- \
          {^(?:http(?:s)?:\/\/)([^\/]+)(?:\/.*)?$} $host hostOnly]} then {
        set host $hostOnly
      }

      #
      # NOTE: Running this check on the Mono 3.3.0 (or 3.4.0?) release build
      #       will lock up the process; therefore, skip it in that case.
      #
      set reason unknown

      if {[canPing reason]} then {
        #
        # BUGBUG: Tcl 8.4 does not like this expression (and Tcl tries to
        #         compile it even though it will only actually ever be
        #         evaluated in Eagle).
        #
        set expr {[llength [info commands uri]] > 0 && \
            [catch {uri ping $host $timeout} response] == 0 && \
            [lindex $response 0] in ($successOnly ? [list Success] : \
            [list Success TimedOut]) && [string is integer -strict \
            [lindex $response 1]] && [lindex $response 1] <= $timeout}

        #
        # NOTE: Does it look like we are able to contact the network host?
        #
        if {[expr $expr]} then {
          #
          # NOTE: Yes, it appears that it is available.
          #
          addConstraint [appendArgs network_ $host]

          tputs $channel [appendArgs "yes (" $response ")\n"]
        } else {
          tputs $channel no\n
        }
      } else {
        tputs $channel [appendArgs $reason \n]
      }
    } else {
      #
      # HACK: Running in Tcl, just assume we have network access.
      #
      addConstraint [appendArgs network_ $host]

      tputs $channel yes\n
    }
  }

  proc maybeDownloadFromUri {
          channel uri timeout {pattern ""} {quiet false} } {
    if {[isEagle]} then {
      if {[catch {
        uri download -inline -timeout $timeout $uri
      } response] == 0} then {
        if {[string length $pattern] == 0 || \
            [regexp -- $pattern $response]} then {
          return true
        }
      } else {
        if {!$quiet} then {
          tputs $channel [appendArgs \
              "==== WARNING: download failed \"" $uri \
              "\" error: " \n\t $response \n]
        }
      }
   } elseif {[info exists ::native_lib_path]} then {
      if {[catch {
        lappend ::auto_path $::native_lib_path
        package require Eagle.Tools.Common

        ::Eagle::Tools::Common::getFileViaHttp $uri 20 \
            $channel true -binary true -timeout $timeout
      } response] == 0} then {
        if {[string length $pattern] == 0 || \
            [regexp -- $pattern $response]} then {
          return true
        }
      } else {
        if {!$quiet} then {
          tputs $channel [appendArgs \
              "==== WARNING: download failed \"" $uri \
              "\" error: " \n\t $response \n]
        }
      }
    }

    return false
  }

  proc checkForInternet { channel uri timeout } {
    tputs $channel [appendArgs \
        "---- checking for Internet connectivity to URI \"" $uri "\"... "]

    set pattern {[^\w]The Eagle Project[^\w]}

    if {[maybeDownloadFromUri \
        $channel $uri $timeout $pattern true]} then {
      set host [string map [list http:// "" https:// ""] $uri]
      regsub -all -- {:.*$|/.*$} $host "" host

      addConstraint [appendArgs internet_ $host]

      tputs $channel yes\n
    } else {
      tputs $channel no\n
    }
  }

  proc checkForTlsOk { channel hosts timeout } {
    tputs $channel [appendArgs "---- checking for TLS to hosts \"" \
        $hosts "\"... "]

    set count 0

    foreach host $hosts {
      set host [string map [list http:// "" https:// ""] $host]
      regsub -all -- {:.*$|/.*$} $host "" host

      set uri [appendArgs https:// $host /]

      if {$host eq "urn.to"} then {
        append uri r/eagle; # HACK: Cannot access root here.
      } elseif {$host eq "pkg.management"} then {
        append uri pkgr; # HACK: Cannot access root here.
      }

      if {![maybeDownloadFromUri \
          $channel $uri $timeout "" true]} then {
        tputs $channel [appendArgs "no (" $uri ")\n"]

        return
      }
    }

    addConstraint tlsOk

    tputs $channel yes\n
  }

  proc checkForCompileOption { channel name } {
    tputs $channel [appendArgs "---- checking for compile option \"" \
        $name "\"... "]

    if {[isEagle]} then {
      if {[info exists ::eagle_platform(compileOptions)] && \
          [lsearch -exact -nocase $::eagle_platform(compileOptions) \
              $name] != -1} then {
        #
        # NOTE: Yes, support for the Eagle compile option is present.
        #
        addConstraint [appendArgs compile. $name]

        tputs $channel yes\n
      } else {
        tputs $channel no\n
      }
    } else {
      #
      # NOTE: We are running inside Tcl; however, we need to check for an
      #       Eagle compile option.  This can now be accomplished via the
      #       [eagle] command supplied by the Eagle Package for Tcl, if
      #       it is actually loaded and available.
      #
      if {[llength [info commands eagle]] > 0} then {
        set options [eagle [list expr {[info exists \
            ::eagle_platform(compileOptions)] ? \
            $::eagle_platform(compileOptions) : [list]}]]

        if {[lsearch -exact $options $name] != -1} then {
          #
          # NOTE: Yes, support for the Eagle compile option is present.
          #
          addConstraint [appendArgs compile. $name]

          tputs $channel yes\n

          #
          # NOTE: We are done here, return now.
          #
          return
        }
      }

      tputs $channel no\n
    }
  }

  proc checkForBuildType { channel name } {
    tputs $channel [appendArgs "---- checking for build type \"" \
        $name "\"... "]

    if {[isEagle]} then {
      if {[string length $name] > 0} then {
        if {[info exists ::eagle_platform(text)] && \
            $name eq $::eagle_platform(text)} then {
          addConstraint [appendArgs buildTypeText. $name]
          addConstraint [appendArgs buildType. $name]

          tputs $channel [appendArgs \
              "yes (" $name ", found via text)\n"]
        } elseif {[info exists ::eagle_platform(suffix)] && \
            $name eq $::eagle_platform(suffix)} then {
          addConstraint [appendArgs buildTypeSuffix. $name]
          addConstraint [appendArgs buildType. $name]

          tputs $channel [appendArgs \
              "yes (" $name ", found via suffix)\n"]
        } else {
          tputs $channel no\n
        }
      } else {
        if {(![info exists ::eagle_platform(text)] || \
              [string length $::eagle_platform(text)] == 0) && \
            (![info exists ::eagle_platform(suffix)] || \
              [string length $::eagle_platform(suffix)] == 0)} then {
          addConstraint buildType.Default

          tputs $channel yes\n
        } else {
          tputs $channel no\n
        }
      }
    } else {
      if {[llength [info commands eagle]] > 0} then {
        if {[eagle [list info exists ::eagle_platform(text)]]} then {
          set text [eagle [list set ::eagle_platform(text)]]
        }

        if {[eagle [list info exists ::eagle_platform(suffix)]]} then {
          set suffix [eagle [list set ::eagle_platform(suffix)]]
        }

        if {[string length $name] > 0} then {
          if {[info exists text] && $name eq $text} then {
            addConstraint [appendArgs buildTypeText. $name]
            addConstraint [appendArgs buildType. $name]

            tputs $channel [appendArgs \
                "yes (" $name ", found via text)\n"]

            #
            # NOTE: We are done here, return now.
            #
            return
          } elseif {[info exists suffix] && $name eq $suffix} then {
            addConstraint [appendArgs buildTypeSuffix. $name]
            addConstraint [appendArgs buildType. $name]

            tputs $channel [appendArgs \
                "yes (" $name ", found via suffix)\n"]

            #
            # NOTE: We are done here, return now.
            #
            return
          }
        } else {
          if {(![info exists text] || \
                [string length $text] == 0) && \
              (![info exists suffix] || \
                [string length $suffix] == 0)} then {
            addConstraint buildType.Default

            tputs $channel yes\n

            #
            # NOTE: We are done here, return now.
            #
            return
          }
        }
      }

      tputs $channel no\n
    }
  }

  proc checkForKnownBuildTypes { channel } {
    #
    # NOTE: Check for all "known" build types.
    #
    tputs $channel "---- checking for known build types... "

    set buildTypes [getKnownBuildTypes]
    lappend buildTypes ""; # HACK: Add default build type.

    if {[llength $buildTypes] > 0} then {
      tputs $channel [appendArgs "yes (" [llength $buildTypes] ")\n"]

      foreach buildType $buildTypes {
        if {[string length $buildType] > 0} then {
          if {[info exists [appendArgs ::no(buildType. $buildType )]]} then {
            continue
          }
        } else {
          if {[info exists ::no(buildType.Default)]} then {
            continue
          }
        }

        checkForBuildType $channel $buildType
      }
    } else {
      tputs $channel no\n
    }
  }

  proc checkForKnownCompileOptions { channel } {
    #
    # NOTE: Check for all "known" compile options.
    #
    tputs $channel "---- checking for known compile options... "

    set options [getKnownCompileOptions]

    if {[llength $options] > 0} then {
      tputs $channel [appendArgs "yes (" [llength $options] ")\n"]

      foreach option $options {
        if {![info exists [appendArgs ::no(compile. $option )]]} then {
          checkForCompileOption $channel $option
        }
      }
    } else {
      tputs $channel no\n
    }
  }

  if {[isEagle]} then {
    ###########################################################################
    ############################ BEGIN Eagle ONLY #############################
    ###########################################################################

    proc saveRuntimeOptions { varName } {
      upvar 1 $varName runtimeOptions

      if {[info exists ::eagle_platform(runtimeOptions)]} then {
        set runtimeOptions $::eagle_platform(runtimeOptions)
      } else {
        set runtimeOptions [list]
      }

      return [llength $runtimeOptions]
    }

    proc clearRuntimeOptions { {ignoreError false} {names ""} } {
      set count 0

      saveRuntimeOptions runtimeOptions

      foreach name $runtimeOptions {
        if {[llength $names] == 0 || \
            [lsearch -exact -- $names $name] == -1} then {
          if {[removeRuntimeOption $name]} then {
            incr count
          } elseif {!$ignoreError} then {
            error [appendArgs \
                "failed to remove runtime option \"" $name \"]
          }
        }
      }

      return $count
    }

    proc restoreRuntimeOptions { varName {full true} {ignoreError false} } {
      upvar 1 $varName runtimeOptions

      set count [clearRuntimeOptions \
          $ignoreError [expr {$full ? [list] : $runtimeOptions}]]

      foreach name $runtimeOptions {
        if {$full || ![hasRuntimeOption $name]} then {
          if {[addRuntimeOption $name]} then {
            incr count
          } elseif {!$ignoreError} then {
            error [appendArgs \
                "failed to add runtime option \"" $name \"]
          }
        }
      }

      return $count
    }

    proc addListStreamChannel { name list } {
      set error null

      set code [object invoke \
          Eagle._Tests.Default TestAddListStreamChannel "" \
          $name null $list {NeedBuffer TraceReadLines} error]

      if {$code ne "Ok"} then {
        error [getStringFromObjectHandle $error]
      }
    }

    proc removeChannel { name {strict true} } {
      set error null

      set code [object invoke \
          Interpreter.GetActive RemoveChannel \
          $name None false true true error]

      if {$strict && $code ne "Ok"} then {
        error [getStringFromObjectHandle $error]
      }
    }

    proc getUnicodeCategoryCode { category } {
      array set codes [list \
          UppercaseLetter            Lu \
          LowercaseLetter            Ll \
          TitlecaseLetter            Lt \
          ModifierLetter             Lm \
          OtherLetter                Lo \
          NonSpacingMark             Mn \
          SpacingCombiningMark       Mc \
          EnclosingMark              Me \
          DecimalDigitNumber         Nd \
          LetterNumber               Nl \
          OtherNumber                No \
          SpaceSeparator             Zs \
          LineSeparator              Zl \
          ParagraphSeparator         Zp \
          Control                    Cc \
          Format                     Cf \
          Surrogate                  Cs \
          PrivateUse                 Co \
          ConnectorPunctuation       Pc \
          DashPunctuation            Pd \
          OpenPunctuation            Ps \
          ClosePunctuation           Pe \
          InitialQuotePunctuation    Pi \
          FinalQuotePunctuation      Pf \
          OtherPunctuation           Po \
          MathSymbol                 Sm \
          CurrencySymbol             Sc \
          ModifierSymbol             Sk \
          OtherSymbol                So \
          OtherNotAssigned           Cn]

      if {[info exists codes($category)]} then {
        return $codes($category)
      } else {
        return Xx; # NOTE: Unknown.
      }
    }

    proc checkForUnicodeCategory { channel character wantCode } {
      set ordinal [string ordinal $character 0]

      tputs $channel [appendArgs \
          "---- checking for Unicode category of \"" \
          [format U+%04X $ordinal] "\"... "]

      if {[catch {
        object invoke Char GetUnicodeCategory $character 0
      } category] == 0} then {
        set haveCode [getUnicodeCategoryCode $category]

        addConstraint [appendArgs \
            unicodeCategory_ [format U%04X $ordinal] \
            _ $haveCode]

        if {$haveCode eq $wantCode} then {
          tputs $channel [appendArgs \
              "yes (" $category " ==> " $haveCode \
              ", CORRECT)\n"]
        } else {
          tputs $channel [appendArgs \
              "yes (" $category " ==> " $haveCode \
              ", INCORRECT, WANT " $wantCode ")\n"]
        }

        #
        # NOTE: We are done here, return now.
        #
        return
      }

      tputs $channel no\n
    }

    proc checkForGlobalTip285 { channel } {
      tputs $channel [appendArgs \
          "---- checking for global TIP #285... "]

      if {[catch {interp resetcancel {} -global}] == 0} then {
        addConstraint globalTip285

        tputs $channel yes\n

        #
        # NOTE: We are done here, return now.
        #
        return
      }

      tputs $channel no\n
    }

    proc checkForIeee754r2008 { channel } {
      tputs $channel [appendArgs \
          "---- checking for IEEE 754-2008... "]

      if {[catch {expr {pi()}} pi] == 0} then {
        #
        # HACK: This seems to be a reliable way to determine if breaking
        #       Double.ToString semantics are present, e.g. .NET Core 3.0.
        #
        if {$pi eq "3.141592653589793"} then {
          addConstraint ieee754r2008

          tputs $channel yes\n
        } else {
          tputs $channel no\n
        }
      } else {
        tputs $channel error\n
      }
    }

    proc checkForSystemDataSQLite { channel } {
      tputs $channel [appendArgs \
          "---- checking for System.Data.SQLite assembly... "]

      if {[haveConstraint file_System.Data.SQLite.dll]} then {
        if {[catch {
          saveRuntimeOptions savedRuntimeOptions

          try {
            addRuntimeOption ResolveAssemblySearch
            object resolve "System.Data.SQLite, *"
          } finally {
            restoreRuntimeOptions savedRuntimeOptions
          }
        } assemblyName] == 0} then {
          addConstraint System.Data.SQLite

          tputs $channel [appendArgs "yes (" $assemblyName ")\n"]
        } else {
          tputs $channel error\n
        }
      } else {
        tputs $channel missing\n
      }
    }

    proc checkForGuru { channel enable } {
      tputs $channel [appendArgs \
          "---- checking for Guru using \"" $enable "\"... "]

      if {[catch {
        set result null

        object invoke -flags +NonPublic \
            Eagle._Components.Private.ObjectOps MaybeEnableGuru \
            "" $enable result

        getStringFromObjectHandle $result
      } guru] == 0} then {
        addConstraint guru.available

        if {[string is list -strict $guru] && \
            [string is true -strict [lindex $guru end]]} then {
          addConstraint guru.enabled

          tputs $channel yes\n
        } else {
          addConstraint guru.disabled

          tputs $channel no\n
        }

        tputs $channel [appendArgs \
            "---- checking for Guru raw results: " \
            [formatList $guru <none>] \n]
      } else {
        addConstraint guru.unavailable

        tputs $channel unavailable\n
        tputs $channel [appendArgs "---- Guru Meditation: " $guru \n]
      }
    }

    proc checkForSecurity { channel } {
      tputs $channel "---- checking for security... "

      if {[catch {
        object invoke -flags +NonPublic Interpreter.GetActive HasSecurity
      } security] == 0} then {
        if {[string is true -strict $security]} then {
          addConstraint security.enabled

          tputs $channel yes\n
        } else {
          addConstraint security.disabled

          tputs $channel no\n
        }
      } else {
        addConstraint security.unavailable

        tputs $channel unavailable\n
      }
    }

    proc checkForSoftwareUpdateTrust { channel } {
      tputs $channel "---- checking for software update trust... "

      if {[llength [info commands uri]] > 0 && \
          [catch {uri softwareupdates} trust] == 0 && \
          $trust eq "software update certificate is trusted"} then {
        #
        # NOTE: Yes, it appears that we trust our software updates.
        #       Since this setting is off by default, the user (or
        #       a script evaluated by the user) must have manually
        #       turned it on.
        #
        addConstraint softwareUpdate

        tputs $channel trusted\n
      } else {
        tputs $channel untrusted\n
      }
    }

    proc checkForManagedDebuggingAssistants { channel } {
      set fileName [file normalize [appendArgs [getShellExecutableName] \
          .mda.config]]

      tputs $channel [appendArgs \
          "---- checking for managed debugging assistants enabled via \"" \
          $fileName "\"... "]

      if {[file exists $fileName]} then {
        #
        # NOTE: Since the System.Xml assembly may not be loaded, wrap the
        #       detection in a [catch] block.
        #
        if {[catch {
          #
          # NOTE: Create and load an XML document based on the data from the
          #       MDA configuration file associated with the executable that
          #       started this process.
          #
          set document [object create -alias System.Xml.XmlDocument]
          $document LoadXml [readFile $fileName]

          #
          # NOTE: Setup the XML namespace manager for use when using XPath
          #       to query the XML document.
          #
          set nameTable [$document NameTable]

          set namespaceManager [object create \
              -alias System.Xml.XmlNamespaceManager $nameTable]

          $namespaceManager AddNamespace mda \
              http://schemas.microsoft.com/CLR/2004/10/mda

          #
          # NOTE: Select all nodes underneath the location where they should
          #       reside in the MDA configuration XML document.
          #
          set nodes [$document SelectNodes \
              /mda:mdaConfig/mda:assistants/* $namespaceManager]

          #
          # NOTE: Populate the local result variable with the names of
          #       all the XML nodes found.
          #
          set names [object lmap -alias node $nodes {
            $node Name
          }]
        }] == 0} then {
          #
          # NOTE: Ok, the XML configuration file was loaded and parsed
          #       correctly, see if any managed debugging assistants were
          #       found enabled within it.
          #
          if {[info exists names] && [llength $names] > 0} then {
            #
            # NOTE: Add a test constraint for each managed debugging
            #       assistant that appears to be enabled.
            #
            addConstraint mda

            foreach name $names {
              addConstraint [appendArgs mda. $name]
            }

            #
            # NOTE: Save the list of managed debugging assistants for
            #       later use by the test suite.
            #
            if {![info exists ::no(setMdas)]} then {
              set ::test_mdas $names
            }

            #
            # NOTE: Yes, it appears that at least one managed debugging
            #       assistant is enabled.
            #
            tputs $channel [appendArgs "yes (" $names ")\n"]

            #
            # NOTE: We are done here, return now.
            #
            return
          }
        }
      }

      tputs $channel no\n
    }

    proc checkForStrongName { channel } {
      tputs $channel "---- checking for strong name... "

      if {[catch {
        object invoke Interpreter.GetActive GetStrongName
      } strongName] == 0 && [isNonNullObjectHandle $strongName]} then {
        #
        # NOTE: Yes, it appears that the core library was signed with a
        #       strong name key.
        #
        addConstraint strongName

        tputs $channel yes\n
      } else {
        tputs $channel no\n
      }
    }

    proc checkForStrongNameKey { channel } {
      tputs $channel "---- checking for strong name key... "

      if {[catch {info engine PublicKeyToken} publicKeyToken] == 0 && \
          [string length $publicKeyToken] > 0} then {
        #
        # NOTE: Add a test constraint for this specific strong name key.
        #
        addConstraint [appendArgs strongName. $publicKeyToken]

        #
        # NOTE: Show the strong name key that we found.
        #
        tputs $channel [appendArgs "yes (" $publicKeyToken ")\n"]

        #
        # BUGBUG: Tcl 8.4 does not seem to like this expression because it
        #         contains the "ni" operator added in Tcl 8.5 (and Tcl 8.4
        #         tries to compile it even though it will only be evaluated
        #         in Eagle).
        #
        set expr {$publicKeyToken ni [getKnownPublicKeyTokens]}

        if {[expr $expr]} then {
          #
          # NOTE: The Eagle core library is strong name signed with a key that
          #       is not official.  This is also not an error, per se; however,
          #       it may cause some tests to fail and it should be reported to
          #       the user and noted in the test suite log file.
          #
          addConstraint strongName.unofficial

          #
          # NOTE: Unless forbidden, issue and log a warning.
          #
          if {![info exists no(warningForStrongNameKey)] && \
              ![haveConstraint quiet]} then {
            tputs $channel [appendArgs \
                "==== WARNING: unofficial Eagle strong name signature " \
                "detected: " $publicKeyToken \n]
          }
        } else {
          #
          # NOTE: Several tests require one of the official strong name keys to
          #       be used in order for them to pass.
          #
          addConstraint strongName.official

          tputs $channel [appendArgs \
              "---- official Eagle strong name signature detected: " \
              $publicKeyToken \n]
        }
      } else {
        #
        # NOTE: The Eagle core library is not signed with a strong name key.
        #       This is not an error, per se; however, it may cause selected
        #       tests to fail and it should be reported to the user and noted
        #       in the test suite log file.
        #
        addConstraint strongName.none

        #
        # NOTE: Show that we did not find a strong name key.
        #
        tputs $channel no\n

        #
        # NOTE: Unless forbidden, issue and log a warning.
        #
        if {![info exists no(warningForStrongNameKey)] && \
            ![haveConstraint quiet]} then {
          tputs $channel \
              "==== WARNING: no Eagle strong name signature detected...\n"
        }
      }
    }

    proc checkForCertificate { channel } {
      tputs $channel "---- checking for certificate... "

      if {[catch {
        object invoke Interpreter.GetActive GetCertificate
      } certificate] == 0 && [isNonNullObjectHandle $certificate]} then {
        #
        # NOTE: Yes, it appears that the core library was signed with a
        #       code-signing certificate.
        #
        addConstraint certificate

        #
        # NOTE: Attempt to query the subject from the certificate.
        #
        if {[catch {
          object invoke $certificate Subject
        } subject] || [string length $subject] == 0} then {
          #
          # TODO: No certificate subject, better handling here?
          #
          set subject unknown
        }

        tputs $channel [appendArgs "yes (" $subject ")\n"]
      } else {
        tputs $channel no\n
      }
    }

    proc checkForCompileCSharp { channel } {
      tputs $channel "---- checking for test use of C# compiler... "

      if {![info exists ::no(compileCSharp)]} then {
        if {[info exists ::no(csharpLog)]} then {
          set hadNoCsharpLog true
        } else {
          set ::no(csharpLog) 1
          set hadNoCsharpLog false
        }

        try {
          if {[doesCompileCSharpWork]} then {
            addConstraint compileCSharp

            tputs $channel yes\n
          } else {
            tputs $channel no\n
          }
        } finally {
          if {!$hadNoCsharpLog} then {
            unset ::no(csharpLog)
          }
        }
      } else {
        tputs $channel no\n
      }
    }

    proc checkForAdministrator { channel } {
      tputs $channel "---- checking for administrator... "

      if {[isTestAdministrator]} then {
        addConstraint administrator; # running as full admin.

        tputs $channel yes\n
      } else {
        tputs $channel no\n
      }
    }

    proc checkForHost { channel } {
      tputs $channel "---- checking for host... "

      if {[catch {host isopen} open] == 0} then {
        if {[string is true -strict $open]} then {
          addConstraint hostIsOpen

          tputs $channel open\n
        } else {
          if {[catch {host redirected Input} redirected] == 0} then {
            if {[string is true -strict $redirected]} then {
              addConstraint hostInputRedirected

              tputs $channel redirected\n
            } else {
              addConstraint hostIsClosed

              tputs $channel closed\n
            }
          } else {
            tlog $redirected; tputs $channel error\n
          }
        }
      } else {
        tlog $open; tputs $channel error\n
      }
    }

    proc checkForHostType { channel } {
      tputs $channel "---- checking for host type... "

      if {[set code [catch {
        object invoke Interpreter.GetActive.Host.GetType ToString
      } hostType]] == 0 && [string length $hostType] > 0} then {
        addConstraint [appendArgs hostType. [string map \
            [list , _ + _ & _ * _ \[ _ \] _ . _ \\ _] $hostType]]

        tputs $channel [appendArgs $hostType \n]
      } elseif {$code == 0} then {
        tputs $channel unknown\n
      } else {
        tputs $channel error\n
      }
    }

    proc checkForPrimaryThread { channel } {
      tputs $channel "---- checking for primary thread... "

      if {[info tid] == [set threadId [info ptid]]} then {
        addConstraint primaryThread

        tputs $channel [appendArgs "yes (" $threadId ")\n"]
      } else {
        tputs $channel [appendArgs "no (" $threadId ")\n"]
      }
    }

    proc checkForDefaultAppDomain { channel } {
      tputs $channel "---- checking for default application domain... "

      if {[catch {
        object invoke AppDomain CurrentDomain
      } appDomain] == 0 && [isNonNullObjectHandle $appDomain]} then {
        if {[catch {
          object invoke $appDomain IsDefaultAppDomain
        } default] || [string length $default] == 0} then {
          set default false
        }

        if {[catch {object invoke $appDomain Id} id] || \
            [string length $id] == 0} then {
          set id unknown
        }

        if {$default} then {
          addConstraint defaultAppDomain

          tputs $channel [appendArgs "yes (" $id ")\n"]
        } else {
          tputs $channel [appendArgs "no (" $id ")\n"]
        }
      } else {
        tputs $channel [appendArgs "no (null)\n"]
      }
    }

    proc checkForRuntime { channel } {
      tputs $channel "---- checking for runtime... "

      #
      # NOTE: Are we running inside Mono -OR- on .NET Core (regardless
      #       of operating system)?
      #
      if {[isTestDotNetCore]} then {
        #
        # NOTE: Yes, it appears that we are running on .NET Core.
        #
        addConstraint dotNetCore; # running on .NET Core.
        addConstraint dotNetOrDotNetCore
        addConstraint dotNetCoreOrShell

        #
        # NOTE: We do not want to skip Mono bugs on .NET Core.
        #
        addKnownMonoConstraints true; # running on .NET Core.

        tputs $channel [appendArgs [expr {[info exists \
            ::eagle_platform(runtime)] ? \
            $::eagle_platform(runtime) : ".NET Core"}] \n]
      } elseif {[isTestMono]} then {
        #
        # NOTE: Yes, it appears that we are running inside Mono.
        #
        addConstraint mono; # running on Mono.
        addConstraint monoOrDotNetCore

        #
        # NOTE: We do not want to skip .NET Core bugs on Mono.
        #
        addKnownDotNetCoreConstraints true; # running on Mono.

        tputs $channel [appendArgs [expr {[info exists \
            ::eagle_platform(runtime)] ? \
            $::eagle_platform(runtime) : "Mono"}] \n]
      } else {
        #
        # NOTE: It appears that we are running on the full .NET.
        #
        addConstraint dotNet; # running on .NET.
        addConstraint dotNetOrDotNetCore

        #
        # NOTE: We do not want to skip Mono -OR- .NET Core bugs on .NET.
        #
        addKnownMonoConstraints true; # running on .NET.
        addKnownDotNetCoreConstraints true; # running on .NET.

        tputs $channel [appendArgs [expr {[info exists \
            ::eagle_platform(runtime)] ? \
            $::eagle_platform(runtime) : "Microsoft.NET"}] \n]
      }
    }

    proc checkForImageRuntimeVersion { channel } {
      tputs $channel "---- checking for image runtime version... "

      if {[info exists ::eagle_platform(imageRuntimeVersion)] && \
          [string length $::eagle_platform(imageRuntimeVersion)] > 0} then {
        #
        # NOTE: Get the major and minor portions of the version only.
        #
        set dotVersion [getMajorMinorVersion \
            $::eagle_platform(imageRuntimeVersion)]

        #
        # NOTE: Now create a version string for use in the constraint name
        #       (remove the periods).
        #
        set version [string map [list v "" . ""] $dotVersion]

        #
        # NOTE: Keep track of the specific image runtime version for usage in
        #       test constraints.
        #
        addConstraint [appendArgs imageRuntime $version]

        tputs $channel [appendArgs \
            $::eagle_platform(imageRuntimeVersion) " (" $dotVersion ")\n"]
      } else {
        tputs $channel no\n
      }
    }

    proc checkForFrameworkVersion { channel } {
      tputs $channel "---- checking for framework version... "

      if {[info exists ::eagle_platform(frameworkVersion)] && \
          [string length $::eagle_platform(frameworkVersion)] > 0} then {
        #
        # NOTE: Get the major and minor portions of the version only.
        #
        set dotVersion [getMajorMinorVersion \
            $::eagle_platform(frameworkVersion)]

        #
        # NOTE: Now create a version string for use in the constraint name
        #       (remove the periods).
        #
        set version [getDotlessVersion $dotVersion]

        #
        # NOTE: If the framework version was found, add a test constraint
        #       for it now.
        #
        if {[string length $version] > 0} then {
          addConstraint [appendArgs framework $version]
        }

        tputs $channel [appendArgs \
            $::eagle_platform(frameworkVersion) " (" $dotVersion ")\n"]
      } else {
        tputs $channel no\n
      }
    }

    proc checkForMatchingFrameworkVersion { channel } {
      tputs $channel "---- checking for matching framework version... "

      if {[info exists ::eagle_platform(frameworkVersion)] && \
          [string length $::eagle_platform(frameworkVersion)] > 0} then {
        if {[info exists ::eagle_platform(imageRuntimeVersion)] && \
            [string length $::eagle_platform(imageRuntimeVersion)] > 0} then {
          #
          # NOTE: Get the major and minor portions of the versions only.
          #
          set dotVersion(1) [getMajorMinorVersion \
              $::eagle_platform(frameworkVersion)]

          set dotVersion(2) [getMajorMinorVersion \
              $::eagle_platform(imageRuntimeVersion)]

          #
          # NOTE: Remove single leading "v" characters, if applicable.
          #
          if {[string index $dotVersion(1) 0] eq "v"} then {
            set dotVersion(1) [string range $dotVersion(1) 1 end]
          }

          if {[string index $dotVersion(2) 0] eq "v"} then {
            set dotVersion(2) [string range $dotVersion(2) 1 end]
          }

          #
          # NOTE: Now create a version string for use in the constraint
          #       name (remove the periods).
          #
          set version(1) [string map [list . ""] $dotVersion(1)]

          #
          # NOTE: Check for an exact match between the image runtime
          #       version and the framework version.
          #
          if {$dotVersion(1) eq $dotVersion(2)} then {
            #
            # NOTE: Yes, the image runtime version matches the framework.
            #
            addConstraint matchFramework
            addConstraint [appendArgs matchFramework $version(1)]

            addConstraint dotNetMatchFramework
            addConstraint [appendArgs dotNetMatchFramework $version(1)]

            addConstraint monoMatchFramework
            addConstraint [appendArgs monoMatchFramework $version(1)]

            addConstraint dotNetCoreMatchFramework
            addConstraint [appendArgs dotNetCoreMatchFramework $version(1)]

            tputs $channel yes\n
          } else {
            if {[isTestDotNetCore]} then {
              addConstraint dotNetMatchFramework
              addConstraint [appendArgs dotNetMatchFramework $version(1)]

              addConstraint monoMatchFramework
              addConstraint [appendArgs monoMatchFramework $version(1)]
            } elseif {[isTestMono]} then {
              addConstraint dotNetMatchFramework
              addConstraint [appendArgs dotNetMatchFramework $version(1)]

              addConstraint dotNetCoreMatchFramework
              addConstraint [appendArgs dotNetCoreMatchFramework $version(1)]
            } else {
              addConstraint monoMatchFramework
              addConstraint [appendArgs monoMatchFramework $version(1)]

              addConstraint dotNetCoreMatchFramework
              addConstraint [appendArgs dotNetCoreMatchFramework $version(1)]
            }

            tputs $channel no\n
          }
        } else {
          tputs $channel "no, missing image runtime version\n"
        }
      } else {
        tputs $channel "no, missing framework version\n"
      }
    }

    proc checkForRuntimeVersion { channel } {
      tputs $channel "---- checking for runtime version... "

      if {[info exists ::eagle_platform(runtimeVersion)] && \
          [string length $::eagle_platform(runtimeVersion)] > 0} then {
        #
        # NOTE: Get the major and minor portions of the version only.
        #
        set dotVersion [getMajorMinorVersion \
            $::eagle_platform(runtimeVersion)]

        #
        # NOTE: Now create a version string for use in the constraint name
        #       (remove the periods).
        #
        set version [string map [list . ""] $dotVersion]

        if {[isTestDotNetCore]} then {
          #
          # NOTE: If the runtime version was found, add a test constraint
          #       for it now.
          #
          if {[string length $version] > 0} then {
            #
            # NOTE: We are running on the .NET Core.  Keep track of the
            #       specific version for usage in test constraints.
            #
            addConstraint [appendArgs dotNetCore $version]
            addConstraint [appendArgs dotNetCore $version OrHigher]
          }

          #
          # NOTE: Attempt to parse the version into its major and minor
          #       components.
          #
          if {[string length $dotVersion] > 0 && [regexp -- {^(\d+)\.(\d+)$} \
              $dotVersion dummy majorVersion minorVersion]} then {
            #
            # NOTE: This is the list of .NET Core versions to add test
            #       constraints for.
            #
            set dotNetCoreVersions [list]

            #
            # NOTE: Check each .NET Core version "known" to the test
            #       suite.
            #
            foreach dotNetCoreVersion [getKnownDotNetCoreVersions] {
              #
              # NOTE: Check for any .NET Core major version X or higher.
              #
              if {$majorVersion >= [lindex $dotNetCoreVersion 0]} then {
                #
                # NOTE: Check for any .NET Core major/minor version
                #       higher than X.Y.
                #
                if {$majorVersion > [lindex $dotNetCoreVersion 0] || \
                    $minorVersion > [lindex $dotNetCoreVersion 1]} then {
                  #
                  # NOTE: Add this "known" version of .NET Core.
                  #
                  lappend dotNetCoreVersions $dotNetCoreVersion
                }
              }
            }

            #
            # NOTE: Add the necessary constraints for each version of .NET
            #       Core we should NOT skip bugs for.
            #
            foreach dotNetCoreVersion $dotNetCoreVersions {
              set constraintVersion [join $dotNetCoreVersion ""]

              addConstraint [appendArgs \
                  dotNetCore $constraintVersion OrHigher]

              addConstraint [appendArgs \
                  dotNetCoreToDo $constraintVersion]

              addConstraint [appendArgs \
                  dotNetCoreBug $constraintVersion]

              addConstraint [appendArgs \
                  dotNetCoreCrash $constraintVersion]
            }

            #
            # NOTE: Check all known versions of .NET Core for an exact match
            #       with the currently running one.
            #
            foreach dotNetCoreVersion [getKnownDotNetCoreVersions] {
              #
              # NOTE: Check if .NET Core major/minor version is exactly the
              #       one we are currently processing.
              #
              set constraintVersion [join $dotNetCoreVersion ""]

              if {[lindex $dotNetCoreVersion 0] == $majorVersion && \
                  [lindex $dotNetCoreVersion 1] == $minorVersion} then {
                #
                # NOTE: Add test constraints that only apply to this exact
                #       version of .NET Core.
                #
                addConstraint [appendArgs \
                    dotNetCore $constraintVersion Only]
              } else {
                #
                # NOTE: Add test constraints that apply to all versions of
                #       .NET Core except this exact version.
                #
                addConstraint [appendArgs \
                    dotNetCoreToDo $constraintVersion Only]

                addConstraint [appendArgs \
                    dotNetCoreBug $constraintVersion Only]

                addConstraint [appendArgs \
                    dotNetCoreCrash $constraintVersion Only]
              }
            }
          }

          #
          # NOTE: We do not want to skip any Mono bugs on .NET Core.  Add
          #       the necessary constraints for each version of Mono we
          #       know about.
          #
          addKnownMonoConstraints false; # running on .NET.
        } elseif {[isTestMono]} then {
          #
          # NOTE: If the runtime version was found, add a test constraint
          #       for it now.
          #
          if {[string length $version] > 0} then {
              #
              # NOTE: We are running on Mono.  Keep track of the specific
              #       version for usage in test constraints.
              #
              addConstraint [appendArgs mono $version]
              addConstraint [appendArgs mono $version OrHigher]
          }

          #
          # NOTE: Attempt to parse the version into its major and minor
          #       components.
          #
          if {[string length $dotVersion] > 0 && [regexp -- {^(\d+)\.(\d+)$} \
              $dotVersion dummy majorVersion minorVersion]} then {
            #
            # NOTE: This is the list of Mono versions to add test
            #       constraints for.
            #
            set monoVersions [list]

            #
            # NOTE: Check each Mono version "known" to the test suite.
            #
            foreach monoVersion [getKnownMonoVersions] {
              #
              # NOTE: Check for any Mono major version X or higher.
              #
              if {$majorVersion >= [lindex $monoVersion 0]} then {
                #
                # NOTE: Check for any Mono major/minor version higher
                #       than X.Y.
                #
                if {$majorVersion > [lindex $monoVersion 0] || \
                    $minorVersion > [lindex $monoVersion 1]} then {
                  #
                  # NOTE: Add this "known" version of Mono.
                  #
                  lappend monoVersions $monoVersion
                }
              }
            }

            #
            # NOTE: Add the necessary constraints for each version of Mono
            #       we should NOT skip bugs for.
            #
            foreach monoVersion $monoVersions {
              set constraintVersion [join $monoVersion ""]

              addConstraint [appendArgs mono $constraintVersion OrHigher]
              addConstraint [appendArgs monoToDo $constraintVersion]
              addConstraint [appendArgs monoBug $constraintVersion]
              addConstraint [appendArgs monoCrash $constraintVersion]
            }

            #
            # NOTE: Check all known versions of Mono for an exact match with
            #       the currently running one.
            #
            foreach monoVersion [getKnownMonoVersions] {
              #
              # NOTE: Check if Mono major/minor version is exactly the one
              #       we are currently processing.
              #
              set constraintVersion [join $monoVersion ""]

              if {[lindex $monoVersion 0] == $majorVersion && \
                  [lindex $monoVersion 1] == $minorVersion} then {
                #
                # NOTE: Add test constraints that only apply to this exact
                #       version of Mono.
                #
                addConstraint [appendArgs mono $constraintVersion Only]
              } else {
                #
                # NOTE: Add test constraints that apply to all versions of
                #       Mono except this exact version.
                #
                addConstraint [appendArgs monoToDo $constraintVersion Only]
                addConstraint [appendArgs monoBug $constraintVersion Only]
                addConstraint [appendArgs monoCrash $constraintVersion Only]
              }
            }
          }

          #
          # NOTE: We do not want to skip any .NET Core bugs on Mono.  Add
          #       the necessary constraints for each version of Mono we
          #       know about.
          #
          addKnownDotNetCoreConstraints false; # running on Mono.
        } else {
          #
          # NOTE: If the runtime version was found, add a test constraint
          #       for it now.
          #
          if {[string length $version] > 0} then {
            #
            # NOTE: We are running on the .NET Framework.  Keep track of the
            #       specific version for usage in test constraints.
            #
            addConstraint [appendArgs dotNet $version]
            addConstraint [appendArgs dotNet $version OrHigher]
          }

          #
          # NOTE: We do not want to skip any Mono bugs on .NET.  Add the
          #       necessary constraints for each version of Mono we know
          #       about.
          #
          addKnownMonoConstraints false; # running on .NET.
          addKnownDotNetCoreConstraints false; # running on .NET.
        }

        tputs $channel [appendArgs \
            $::eagle_platform(runtimeVersion) " (" $dotVersion ")\n"]
      } else {
        tputs $channel no\n
      }
    }

    proc checkForRuntimeBuild { channel } {
      tputs $channel "---- checking for runtime build... "

      if {[info exists ::eagle_platform(runtimeBuild)] && \
          [string length $::eagle_platform(runtimeBuild)] > 0} then {
        if {[regexp -- {^(\d+\.\d+(?:\.\d+)*) } \
            $::eagle_platform(runtimeBuild) dummy build]} then {
          addConstraint [appendArgs runtimeBuild. $build]
        } else {
          set build unknown
        }

        tputs $channel [appendArgs \
            $::eagle_platform(runtimeBuild) " (" $build ")\n"]
      } else {
        tputs $channel no\n
      }
    }

    proc checkForProcessBits { channel } {
      tputs $channel "---- checking for process bits... "

      if {[info exists ::tcl_platform(processBits)] && \
          [string is integer -strict $::tcl_platform(processBits)]} then {
        addConstraint [appendArgs $::tcl_platform(processBits) bit]

        tputs $channel [appendArgs $::tcl_platform(processBits) -bit\n]
      } else {
        tputs $channel unknown\n
      }
    }

    proc checkForMachine { channel bits machine } {
      tputs $channel [appendArgs "---- checking for machine \"" $bits \
          "-bit " $machine "\"... "]

      #
      # NOTE: What are the machine architecture and the
      #       number of bits for this operating system?
      #
      if {[info exists ::tcl_platform(machine)] && \
          [info exists ::tcl_platform(processBits)]} then {
        #
        # NOTE: Does the machine and number of bits match
        #       what the caller specified?
        #
        if {$::tcl_platform(machine) eq $machine && \
            $::tcl_platform(processBits) eq $bits} then {
          #
          # NOTE: Yes, it matches.
          #
          addConstraint [appendArgs $machine . $bits bit]

          tputs $channel yes\n
        } else {
          tputs $channel no\n
        }
      } else {
        tputs $channel "no, unknown\n"
      }
    }

    proc checkForTestCallStack { channel } {
      tputs $channel "---- checking for test call stack... "

      #
      # NOTE: Search for a call frame with associated arguments.
      #       At this point, there must be at least one such call
      #       frame (this one).  Therefore, this loop will always
      #       terminate.
      #
      set index 0; set arguments [list]
      set script {info level [info level]}

      while {1} {
        set level [appendArgs ## $index]

        if {[catch {uplevel $level $script} arguments] == 0} then {
          break
        }

        incr index
      }

      #
      # NOTE: Grab the command name from the arguments, if any.
      #
      set command [expr {
        [llength $arguments] > 0 ? [lindex $arguments 0] : ""
      }]

      #
      # HACK: Make sure the call stack does not end up confusing
      #       the tests that rely on absolute call frames.  The
      #       [runTestPrologue] is allowed here because it will
      #       not be active on the call stack at the point the
      #       tests are actually run.  Actually, the same thing
      #       goes for [checkForTestCallStack] as well.
      #
      if {$command in \
          [list runTestPrologue checkForTestCallStack]} then {
        addConstraint testCallStack

        tputs $channel [appendArgs "yes (\"" $command "\")\n"]

        #
        # NOTE: We are done here, return now.
        #
        return
      }

      tputs $channel [appendArgs "no (\"" $command "\")\n"]
    }

    proc checkForGarudaDll { channel } {
      #
      # NOTE: Skip automatic Tcl shell machine detection if we are not
      #       allowed to execute external commands.
      #
      if {[canExecTclShell]} then {
        #
        # NOTE: Have the [getGarudaDll] procedure automatically detect the
        #       machine.
        #
        set machine ""
      } else {
        #
        # NOTE: Use the machine for this test run.
        #
        set machine [getTestMachine]

        #
        # NOTE: Since an empty string means "automatically detect" to the
        #       [getGarudaDll] procedure, we must make sure the value is
        #       something else.
        #
        if {[string length $machine] == 0} then {
          set machine unknown
        }
      }

      #
      # NOTE: First, figure out what the file name for the Garuda DLL is,
      #       if anything.
      #
      set fileName [getGarudaDll $machine]

      if {[string length $fileName] > 0} then {
        #
        # NOTE: Next, check if the Garuda DLL is the same platform (i.e.
        #       machine type) as the native Tcl shell.
        #
        checkForFile $channel $fileName

        #
        # NOTE: Next, check if the Garuda DLL appears to be compatible
        #       with this platform.
        #
        tputs $channel [appendArgs \
            "---- checking if file \"" $fileName \
            "\" matches architecture for current process... "]

        if {[catch {
          library matcharchitecture $fileName; # maybe missing command?
        } match] == 0 && $match} then {
          addConstraint garudaLibrary

          tputs $channel yes\n
        } else {
          tputs $channel no\n
        }
      }
    }

    proc checkForCulture { channel } {
      tputs $channel "---- checking for culture... "

      #
      # NOTE: Grab the current culture.
      #
      set culture [info culture]

      if {[string length $culture] > 0} then {
        #
        # NOTE: The culture information is present, use it and show it.
        #
        addConstraint [appendArgs culture. [string map [list - _] $culture]]

        tputs $channel [appendArgs $culture \n]
      } else {
        tputs $channel unknown\n
      }
    }

    proc checkForThreadCulture { channel } {
      tputs $channel "---- checking for thread culture... "

      #
      # NOTE: Grab the current thread culture.
      #
      if {[catch {
        object invoke System.Threading.Thread.CurrentThread CurrentCulture
      } culture] == 0 && [catch {
        object invoke Eagle._Components.Private.FormatOps CultureName \
            $culture false
      } culture] == 0 && [string length $culture] > 0} then {
        #
        # NOTE: The culture information is present, use it and show it.
        #
        addConstraint [appendArgs threadCulture. [string map [list - _] \
            $culture]]

        tputs $channel [appendArgs $culture \n]
      } else {
        tputs $channel unknown\n
      }
    }

    proc checkForQuiet { channel quiet } {
      if {!$quiet} then {
        tputs $channel "---- checking for quiet... "
      }

      if {[catch {
        object invoke Interpreter.GetActive Quiet
      } isQuiet] == 0 && [string is true -strict $isQuiet]} then {
        #
        # NOTE: Yes, quiet mode is enabled.
        #
        addConstraint quiet

        if {!$quiet} then {
          tputs $channel yes\n
        }
      } else {
        if {!$quiet} then {
          tputs $channel no\n
        }
      }
    }

    proc checkForReferenceCountTracking { channel } {
      tputs $channel "---- checking for object reference count tracking... "

      if {[info exists ::eagle_platform(compileOptions)] && \
          ([lsearch -exact -nocase $::eagle_platform(compileOptions) \
              NOTIFY] != -1 || \
           [lsearch -exact -nocase $::eagle_platform(compileOptions) \
              NOTIFY_OBJECT] != -1)} then {
        #
        # NOTE: Yes, support for object reference count tracking is present.
        #
        addConstraint referenceCounts

        tputs $channel yes\n
      } else {
        tputs $channel no\n
      }
    }

    proc checkForRuntimeOption { channel option } {
      tputs $channel [appendArgs "---- checking for runtime option \"" \
          $option "\"... "]

      if {[info exists ::eagle_platform(runtimeOptions)] && \
          [lsearch -exact -nocase $::eagle_platform(runtimeOptions) \
              $option] != -1} then {
        #
        # NOTE: Yes, support for the runtime option is present.
        #
        addConstraint [appendArgs runtime. $option]

        tputs $channel yes\n
      } else {
        tputs $channel no\n
      }
    }

    proc testForDynamicLoading { {fileName ""} } {
      if {[catch {
        if {[string length $fileName] == 0} then {
          if {[isWindows]} then {
            set fileName kernel32; # HACK: Always pre-loaded?
          } elseif {[info exists ::tcl_platform(os)] && \
              $::tcl_platform(os) eq "Darwin"} then {
            set fileName libdl.dylib; # TODO: Good default?
          } else {
            set fileName libdl.so; # TODO: Good default?
          }
        }

        set error null

        object invoke -flags +NonPublic \
            Eagle._Components.Private.NativeOps TestLoadLibrary \
            $fileName error
      } code] == 0 && $code eq "Ok"} then {
        return true
      }

      return false
    }

    proc checkForDynamicLoading { channel } {
      tputs $channel "---- checking for dynamic loading... "

      #
      # NOTE: As far as we know, dynamic loading always works on Windows.
      #       On some Unix systems, dlopen does not work (e.g. because
      #       Mono is statically linked, etc).
      #
      if {[isWindows] || [testForDynamicLoading]} then {
        #
        # NOTE: Yes, it appears that it is available.
        #
        addConstraint dynamic

        tputs $channel yes\n
      } else {
        tputs $channel no\n
      }
    }

    proc checkForWindowsForms { channel } {
      tputs $channel "---- checking for Windows Forms... "

      #
      # HACK: When running on Windows, we do not need to do any other
      #       special checks here; however, on Unix (and Mac OS X?),
      #       we should check for the DISPLAY environment variable as
      #       some basic indication that the X server is available.
      #       This appears to be very necessary on Mono because it
      #       crashes after repeated failed attempts to create a
      #       Windows Form when the X server is unavailable (e.g. on
      #       OpenBSD).
      #
      if {[isWindows] || [info exists ::env(DISPLAY)]} then {
        #
        # NOTE: Is the Windows Forms assembly available?
        #
        if {[catch {
          object resolve System.Windows.Forms
        } assembly] == 0} then {
          #
          # NOTE: Yes, it appears that it is available.
          #
          addConstraint winForms

          tputs $channel yes\n

          #
          # NOTE: We are done here, return now.
          #
          return
        }
      }

      tputs $channel no\n
    }

    proc checkForWindowsTerminal { channel } {
      tputs $channel "---- checking for Windows Terminal (Cascadia)... "

      if {[catch {
        #
        # HACK: Rather than simply checking the associated environment
        #       variable directly, make sure the core library actually
        #       knows how to deal with Windows Terminal.
        #
        object invoke -flags +NonPublic \
            Eagle._Components.Private.WindowOps IsWindowsTerminal
      } windowsTerminal] == 0 && \
          [string is true -strict $windowsTerminal]} then {
        #
        # NOTE: Yes, it appears that it is available.
        #
        addConstraint windowsTerminal

        tputs $channel yes\n

        #
        # NOTE: We are done here, return now.
        #
        return
      }

      tputs $channel no\n
    }

    proc checkForWoW64 { channel } {
      tputs $channel "---- checking for WoW64... "

      if {[info exists ::eagle_platform(wow64)] && \
          [string is boolean -strict $::eagle_platform(wow64)] && \
          $::eagle_platform(wow64)} then {
        #
        # NOTE: Yes, we are running in a WoW64 process.
        #
        addConstraint wow64

        tputs $channel yes\n
      } else {
        tputs $channel no\n
      }
    }

    proc checkForStaThread { channel } {
      tputs $channel "---- checking for STA thread... "

      if {[catch {
        object invoke System.Threading.Thread.CurrentThread GetApartmentState
      } apartmentState] == 0 && $apartmentState eq "STA"} then {
        #
        # NOTE: Yes, we are running in an STA thread.
        #
        addConstraint staThread

        tputs $channel yes\n
      } else {
        tputs $channel no\n
      }
    }

    proc checkForWindowsPresentationFoundation { channel } {
      tputs $channel "---- checking for Windows Presentation Foundation... "

      #
      # NOTE: Is the Windows Presentation Foundation available?
      #
      if {[catch {
        object resolve PresentationFramework
      } assembly] == 0} then {
        #
        # NOTE: Yes, it appears that it is available.
        #
        addConstraint wpf

        tputs $channel yes\n
      } else {
        tputs $channel no\n
      }
    }

    proc checkForDatabase { channel type string } {
      tputs $channel "---- checking for database... "

      #
      # HACK: Disable database connectivity testing on Mono because
      #       it fails to timeout (unless special test suite hacks
      #       for Mono have been disabled by the user).
      #
      if {![isTestMono]} then {
        #
        # NOTE: Can we access the local database?
        #
        if {[catch {sql open -type $type $string} connection] == 0} then {
          #
          # NOTE: Yes, it appears that we can connect to the local database.
          #
          addConstraint database

          #
          # NOTE: Also record the test database connection type used as a
          #       test constraint.
          #
          if {[string length $type] > 0} then {
            addConstraint [appendArgs database. [string tolower $type]]
          }

          #
          # NOTE: Cleanup the database connection we just opened.
          #
          sql close $connection

          tputs $channel yes\n
        } else {
          tputs $channel no\n
        }
      } else {
        tputs $channel disabled\n
      }
    }

    proc checkForLibraryAssemblyName { channel } {
      tputs $channel "---- checking for library assembly name... "

      #
      # NOTE: What is the name of the core library assembly?  Normally,
      #       this will be "Eagle"; however, it could be something else.
      #
      if {[catch {getTestAssemblyName} assemblyName] == 0} then {
        addConstraint [appendArgs libraryAssemblyName. $assemblyName]

        tputs $channel [appendArgs "yes (" $assemblyName ")\n"]
      } else {
        tputs $channel no\n
      }
    }

    proc checkForAssembly { channel name } {
      tputs $channel [appendArgs "---- checking for assembly \"" $name \
          "\"... "]

      #
      # NOTE: Can the assembly be loaded?
      #
      if {[catch {object resolve $name} assembly] == 0} then {
        #
        # NOTE: Yes, it appears that it is available.
        #
        addConstraint $name

        tputs $channel yes\n
      } else {
        tputs $channel no\n
      }
    }

    proc checkForObjectMember { channel object member {constraint ""} } {
      tputs $channel [appendArgs "---- checking for object member \"" \
          $object . $member "\"... "]

      if {[catch {
        object members -flags +NonPublic -pattern $member $object
      } members] == 0 && [llength $members] > 0} then {
        #
        # NOTE: Yes, it appears that it is available.
        #
        if {[string length $constraint] > 0} then {
          addConstraint [appendArgs member_ $constraint]
        } else {
          addConstraint [appendArgs $object . [string trim $member *?]]
        }

        tputs $channel yes\n
      } else {
        tputs $channel no\n
      }
    }

    proc checkForExcelUsable { channel {milliseconds 5000} } {
      tputs $channel "---- checking for usable instance of Excel... "

      #
      # NOTE: As of this writing, this check is only supported on Windows.
      #
      if {[isWindows]} then {
        #
        # NOTE: This constraint check must run after the interop assembly for
        #       Excel has been detected, because this check makes use of it.
        #
        if {[haveConstraint Microsoft.Office.Interop.Excel]} then {
          #
          # NOTE: This constraint check requires the (optional) interpreter
          #       isolation feature of Eagle in order to keep the primary
          #       interpreter and AppDomain tidy.  It also requires access
          #       to native Windows support in order to use the [info hwnd]
          #       sub-command.
          #
          if {[haveConstraint compile.ISOLATED_INTERPRETERS] && \
              [haveConstraint compile.NATIVE] && \
              [haveConstraint compile.WINDOWS]} then {
            #
            # NOTE: Allocate a temporary file name that can be used to save
            #       the Excel spreadsheet.  This name will be provided to a
            #       child interpreter for its use -AND- cleaned up by this
            #       interpreter before exiting this procedure.
            #
            set tempName(1) [getTemporaryFileName]

            #
            # NOTE: Use a try/finally block to cleanup temporary files.
            #
            try {
              if {[catch {
                #
                # NOTE: In an attempt to limit the assemblies loaded into the
                #       primary AppDomain, create an isolated interpreter.
                #
                set interp [interp create -isolated]

                #
                # NOTE: Give the newly created (isolated) interpreter a means
                #       to set variables in the parent (this) interpreter.
                #
                interp alias $interp pset {} set; # parent set

                #
                # NOTE: Give the newly created (isolated) interpreter a base
                #       name for a temporary file and our milliseconds value.
                #
                interp set $interp milliseconds $milliseconds
                interp set $interp tempName(1) $tempName(1)

                #
                # NOTE: Setup reasonable script timeout for the newly created
                #       (isolated) interpreter so that Excel detection cannot
                #       simply hang forever.
                #
                catch {interp watchdog $interp false}; # NOTE: Superfluous?
                interp timeout $interp [expr {$milliseconds * 2}]
                interp watchdog $interp true +Interrupt

                #
                # NOTE: Evaluate all the Excel interop assembly related code
                #       in the other AppDomain.
                #
                interp eval $interp {
                  #
                  # NOTE: First, attempt to load the Excel interop assembly.
                  #       If this fails, we cannot continue and Excel is not
                  #       considered usable.
                  #
                  set assembly [object load -import -declare \
                      Microsoft.Office.Interop.Excel]

                  #
                  # NOTE: Next, attempt to run the Excel application using
                  #       its automation object model.  If this fails, we
                  #       cannot continue and Excel is not considered usable.
                  #
                  set application [object create -alias \
                      Microsoft.Office.Interop.Excel.ApplicationClass]; # run

                  #
                  # NOTE: Next, attempt to extract the process ID associated
                  #       with the Excel application window.  This is used to
                  #       help make sure the running Excel instance is closed
                  #       after our testing is complete.  Generally, this will
                  #       not fail because we know the [info hwnd] sub-command
                  #       should be available, due to define constant checks.
                  #
                  pset pid [getDictionaryValue \
                      [info hwnd [$application Hwnd]] processId]

                  #
                  # NOTE: Next, attempt to make sure that the Excel instance
                  #       is not visible and will not display alerts/prompts.
                  #       If this fails, Excel is not considered usable.
                  #
                  $application Visible false
                  $application DisplayAlerts false

                  #
                  # NOTE: Wait for a bit to make sure that the Excel process
                  #       is actually running (?).
                  #
                  after $milliseconds

                  #
                  # NOTE: Next, create a value of an enumerated type exposed
                  #       by the Excel automation object model so that we can
                  #       add a new workbook.  Generally, this does not fail.
                  #       If this fails, Excel is not considered usable.
                  #
                  set enumValue [object invoke -create \
                      Enum Parse XlWBATemplate xlWBATWorksheet]

                  #
                  # NOTE: Next, attempt to add a new workbook.  If this fails,
                  #       Excel is not considered usable.
                  #
                  set workbook [object invoke -alias \
                      $application.Workbooks Add $enumValue]

                  #
                  # NOTE: Setup a temporary file name that can be used to save
                  #       the Excel spreadsheet.
                  #
                  pset fileName [set fileName [file nativename [appendArgs \
                      $tempName(1) .xls]]]

                  #
                  # NOTE: Next, attempt to save a new workbook.  If this fails,
                  #       Excel is not considered usable.
                  #
                  $workbook SaveAs $fileName

                  #
                  # NOTE: Next, attempt to close Excel.  If this fails, Excel
                  #       is not considered usable.
                  #
                  $application Quit; # close

                  #
                  # NOTE: Finally, cleanup our local state just to be tidy.
                  #
                  unset workbook enumValue application assembly; # dispose
                }
              } result] == 0} then {
                #
                # NOTE: It appears the Excel instance is usable.
                #
                addConstraint excel.usable

                #
                # NOTE: Show that a usable Excel instance was found.
                #
                tputs $channel yes\n
              } else {
                #
                # NOTE: Check for runaway script error message.  Matching
                #       this would mean the watchdog thread canceled the
                #       detection script (i.e. after the blocking creation
                #       call).
                #
                if {[string match "runaway script *" $result] || \
                    [string match "*ThreadInterruptedException*" $result] || \
                    [string match "* 0x80080005*" $result]} then {
                  #
                  # NOTE: It appears that Excel is taking too long to
                  #       startup.
                  #
                  addConstraint excel.timeout

                  #
                  # NOTE: Show that Excel took too long starting up.
                  #
                  tputs $channel "no, timeout\n"

                  #
                  # NOTE: We are done here, return now.
                  #
                  return
                }

                #
                # NOTE: This is the list of error message patterns that may
                #       indicate a trial version of Excel is being used.
                #
                set patterns [list \
                    "* 0x80010001*" "* 0x800AC472*" "* 0x800A03EC*" \
                    "* application has expired.*"]

                #
                # NOTE: Check each error message pattern.  Upon finding any
                #       match, mark Excel as unusable due to being a trial
                #       edition and then stop.
                #
                foreach pattern $patterns {
                  #
                  # TODO: For now, just use [string match] here; eventually,
                  #       regular expressions may be needed.
                  #
                  if {[string match $pattern $result]} then {
                    #
                    # NOTE: It appears that Excel is a trial edition.
                    #
                    addConstraint excel.trial

                    #
                    # NOTE: Show that the Excel trial edition was found.
                    #
                    tputs $channel "no, trial\n"

                    #
                    # NOTE: We are done here, return now.
                    #
                    return
                  }
                }

                #
                # NOTE: It appears the Excel instance is not usable.
                #
                addConstraint excel.unusable

                #
                # NOTE: Show that a unusable Excel instance was found.
                #
                tputs $channel "no, broken\n"
              }
            } finally {
              #
              # NOTE: Make sure the isolated interpreter is deleted if it was
              #       actually created.
              #
              if {[info exists interp] && [interp exists $interp]} then {
                catch {interp delete $interp}
              }

              #
              # NOTE: Make sure the Excel process is (forcibly) closed if it
              #       is still running at this point.
              #
              if {[info exists pid] && $pid in [getProcesses excel]} then {
                catch {kill -force $pid}
              }

              #
              # NOTE: Make sure the temporary spreadsheet file is deleted if
              #       it was actually created.
              #
              if {[info exists fileName] && [file exists $fileName]} then {
                catch {file delete $fileName}
              }

              #
              # NOTE: Make sure the dummy temporary files are cleaned up.
              #
              if {[array exists tempName]} then {
                foreach tempFileName [array values tempName] {
                  if {[file exists $tempFileName]} then {
                    catch {file delete $tempFileName}
                  }
                }
              }
            }
          } else {
            tputs $channel "unknown, missing optional feature\n"
          }
        } else {
          tputs $channel "unknown, no Excel interop assembly\n"
        }
      } else {
        tputs $channel "unknown, not running on Windows\n"
      }
    }

    proc checkForTclInstalls { channel } {
      tputs $channel "---- checking for Tcl installs... "

      #
      # NOTE: Check for dynamically loadable Tcl libraries (for this
      #       architecture only).
      #
      if {[catch {tcl select -architecture} tcl] == 0} then {
        #
        # NOTE: Found one?  Ok, attempt to grab the index of the version
        #       field from the list.
        #
        set index [lsearch -exact $tcl version]

        if {$index != -1} then {
          #
          # NOTE: The very next list index contains the value (i.e. like
          #       a Tcl 8.5+ dict).
          #
          set dotVersion [lindex $tcl [incr index]]

          #
          # NOTE: Do we know the version?
          #
          if {[string length $dotVersion] > 0 && \
              [regexp -- {^\d+\.\d+$} $dotVersion]} then {
            #
            # NOTE: Yes, some version of Tcl is available.
            #
            addConstraint tclLibrary

            #
            # NOTE: Is the version 8.x or higher?
            #
            foreach tclVersion [lreverse [getKnownTclVersions]] {
              if {$dotVersion >= [getDottedVersion $tclVersion]} then {
                addConstraint [appendArgs \
                    tclLibrary [getDotlessVersion $tclVersion]]

                #
                # NOTE: For now, there can be only one Tcl library match;
                #       therefore, we are done.
                #
                break
              }
            }

            tputs $channel [appendArgs $dotVersion \n]

            #
            # NOTE: We are done here, return now.
            #
            return
          }
        }
      }

      tputs $channel no\n
    }

    proc checkForTclReady { channel } {
      tputs $channel "---- checking for Tcl readiness... "

      if {[catch {tcl ready} ready] == 0 && \
          [string is true -strict $ready]} then {
        #
        # NOTE: Yes, native Tcl is loaded and ready.
        #
        addConstraint tclReady

        #
        # NOTE: Yes, native Tcl is ready -OR- available.
        #
        addConstraint tclReadyOrLibrary

        #
        # NOTE: Ok, attempt to determine the loaded Tcl version.
        #
        if {[catch {
          tcl eval [tcl primary] {info tclversion}
        } dotVersion] == 0 && [regexp -- {^\d+\.\d+$} $dotVersion]} then {
          addConstraint [appendArgs \
              tclReady [getDotlessVersion $dotVersion]]

          #
          # NOTE: The Tcl library is ready; however, we need to add the
          #       appropriate test constraint to indicate that a specific
          #       version of Tcl is "either ready or available".
          #
          foreach tclVersion [lreverse [getKnownTclVersions]] {
            set version [getDotlessVersion $tclVersion]

            if {[haveConstraint [appendArgs tclLibrary $version]] && \
                $dotVersion >= [getDottedVersion $tclVersion]} then {
              addConstraint [appendArgs tclReadyOrLibrary $version]

              #
              # NOTE: For now, there can be only one Tcl library match;
              #       therefore, we are done.
              #
              break
            }
          }

          tputs $channel [appendArgs "yes (" $dotVersion ")\n"]
        } else {
          #
          # NOTE: The Tcl library is ready; however, we have no idea what
          #       version it actually is; therefore, skip adding the test
          #       constraint to indicate that a specific version of Tcl
          #       is "either ready or available".
          #
          tputs $channel yes\n
        }
      } else {
        #
        # NOTE: The Tcl library is not ready; however, we still need to add
        #       the appropriate test constraint to indicate that a specific
        #       version of Tcl is "either ready or available".
        #
        foreach tclVersion [lreverse [getKnownTclVersions]] {
          set version [getDotlessVersion $tclVersion]

          if {[haveConstraint [appendArgs tclLibrary $version]]} then {
            addConstraint [appendArgs tclReadyOrLibrary $version]

            #
            # NOTE: For now, there can be only one Tcl library match;
            #       therefore, we are done.
            #
            break
          }
        }

        tputs $channel no\n
      }
    }

    proc checkForTclSelect { channel } {
      tputs $channel "---- checking for Tcl library selection... "

      if {[catch {tcl select -architecture} select] == 0} then {
        #
        # NOTE: Yes, native Tcl is "probably loadable".
        #
        addConstraint tclSelect

        #
        # NOTE: Ok, attempt to determine the selected Tcl version.
        #
        if {[catch {
          getDictionaryValue $select version
        } version] == 0 && [regexp -- {^\d+\.\d+$} $version]} then {
          addConstraint [appendArgs \
              tclSelect [string map [list . ""] $version]]

          tputs $channel [appendArgs "yes (" $select ")\n"]
        } else {
          #
          # NOTE: The Tcl library is "probably loadable"; however, we have
          #       no idea what version it actually is.
          #
          tputs $channel yes\n
        }
      } else {
        tputs $channel no\n
      }
    }

    proc checkForTclShell { channel } {
      #
      # HACK: If this returns "error" that normally indicates an error was
      #       caught during [exec] (i.e. the native Tcl shell could not be
      #       executed).
      #
      set prefix "---- checking for Tcl shell version... "

      if {[canExecTclShell] && \
          ![info exists ::no(getTclVersionForTclShell)] && [catch {
        getTclVersionForTclShell "" [getTclShellVerbosity]
      } version] == 0 && $version ne "error" && \
          ![string match "error: *" $version]} then {
        #
        # NOTE: Yes, a native Tcl shell appears to be available.
        #
        addConstraint tclShell

        #
        # NOTE: Now, add the version specific test constraint.
        #
        addConstraint [appendArgs \
            tclShell [string map [list . ""] $version]]

        tputs $channel [appendArgs $prefix "yes (" $version ")\n"]
      } else {
        tputs $channel [appendArgs $prefix no\n]
      }
    }

    proc checkForTkPackage { channel } {
      #
      # HACK: We do not care about the Tk version returned from this
      #       procedure, we only care if it returns "error" because that
      #       would indicate an error was caught during [exec] (i.e. the
      #       native Tcl shell could not be executed).
      #
      set prefix "---- checking for Tk package version... "

      if {[canExecTclShell] && \
          ![info exists ::no(getTkVersionForTclShell)] && [catch {
        getTkVersionForTclShell "" [getTclShellVerbosity]
      } version] == 0 && $version ne "error" && \
          ![string match "error: *" $version]} then {
        #
        # NOTE: Yes, a native Tk package appears to be available.
        #
        addConstraint tkPackage

        tputs $channel [appendArgs $prefix "yes (" $version ")\n"]
      } else {
        tputs $channel [appendArgs $prefix no\n]
      }
    }

    proc checkForPowerShell { channel } {
      tputs $channel "---- checking for PowerShell... "

      #
      # NOTE: Can the PowerShell assembly be loaded?
      #
      if {[catch {
        object resolve System.Management.Automation
      } assembly] == 0} then {
        #
        # NOTE: Yes, it appears that it is available.
        #
        addConstraint powerShell

        tputs $channel yes\n
      } else {
        tputs $channel no\n
      }
    }

    proc checkForWix { channel } {
      tputs $channel "---- checking for WiX... "

      #
      # NOTE: Platform must be Windows for this constraint to
      #       even be checked (i.e. we require the registry).
      #
      if {[isWindows]} then {
        #
        # NOTE: Indicate that we have not found it yet.
        #
        set directory ""

        #
        # NOTE: Have we not found the directory yet?
        #
        #       Yes, this is somewhat redundant because we just set
        #       the directory to an empty string (above); however,
        #       maintaining a uniform pattern is more important.
        #
        if {[string length $directory] == 0} then {
          #
          # NOTE: Check for the WIX environment variable.
          #
          if {[info exists ::env(WIX)]} then {
            set directory [file normalize [string trimright $::env(WIX)]]

            if {[string length $directory] > 0} then {
              #
              # NOTE: We need the directory containing the binaries.
              #
              set directory [file join $directory bin]

              #
              # NOTE: Does the directory actually exist?
              #
              if {[file isdirectory $directory]} then {
                #
                # NOTE: The file name of the primary WiX assembly.
                #
                set fileName [file join $directory wix.dll]

                #
                # NOTE: We do not know the file version yet.
                #
                set version ""

                #
                # NOTE: Attempt to query the version of the file.
                #
                if {[catch {file version $fileName} version] == 0 && \
                    [string length $version] > 0} then {
                  #
                  # NOTE: Indicate where we found the file.
                  #
                  set where environment
                } else {
                  #
                  # NOTE: The file does not exist or is not properly
                  #       versioned.
                  #
                  set directory ""
                }
              } else {
                #
                # NOTE: The directory does not exist.
                #
                set directory ""
              }
            }
          }
        }

        #
        # NOTE: Have we not found the directory yet?
        #
        if {[string length $directory] == 0} then {
          #
          # NOTE: Registry hive where WiX install information is stored.  Make
          #       sure to look in the WoW64 registry because WiX is currently
          #       always installed as a 32-bit application.
          #
          set key [appendArgs HKEY_LOCAL_MACHINE\\ \
              [getSoftwareRegistryKey true] {\Microsoft\Windows Installer XML}]

          #
          # NOTE: The versions of WiX that we support.
          #
          set versions [list 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.0]

          #
          # NOTE: Check each version, stopping when one is found.
          #
          foreach version $versions {
            #
            # NOTE: Attempt to fetch the WiX install directory value from the
            #       registry, removing the trailing backslash, if any.  Does
            #       the directory name look valid and does it actually exist?
            #
            if {[catch {file normalize [string trimright [object invoke \
                    Microsoft.Win32.Registry GetValue [appendArgs $key \\ \
                    $version] InstallRoot null] \\]} directory] == 0 && \
                    [string length $directory] > 0 && \
                [file isdirectory $directory]} then {
              #
              # NOTE: The file name of the primary WiX assembly.
              #
              set fileName [file join $directory wix.dll]

              #
              # NOTE: We do not know the file version yet.
              #
              set version ""

              #
              # NOTE: Attempt to query the version of the file.
              #
              if {[catch {file version $fileName} version] == 0 && \
                  [string length $version] > 0} then {
                #
                # NOTE: Indicate where we found the file.
                #
                set where registry

                #
                # NOTE: We found it, bail out now.
                #
                break
              } else {
                #
                # NOTE: The file does not exist or is not properly
                #       versioned.
                #
                set directory ""
              }
            }
          }
        }

        #
        # NOTE: Did we find the directory?
        #
        if {[string length $directory] > 0 && \
            [file isdirectory $directory]} then {
          #
          # NOTE: Yes, it appears that it is available.
          #
          addConstraint wix

          #
          # NOTE: Save the directory for later usage by
          #       the test itself.
          #
          if {![info exists ::no(setWix)]} then {
            set ::test_wix $directory
          }

          #
          # NOTE: Show where we found it.
          #
          tputs $channel [appendArgs \
              "yes (" $version ", via " $where ", \"" \
              $directory "\")\n"]

          #
          # NOTE: We are done here, return now.
          #
          return
        }
      }

      tputs $channel no\n
    }

    proc checkForTargetFramework { channel } {
      tputs $channel "---- checking for target framework... "

      if {[info exists ::eagle_platform(targetFramework)] && \
          [string length $::eagle_platform(targetFramework)] > 0} then {
        #
        # NOTE: Now create a string for use in the constraint name (remove
        #       the invalid characters).  For example:
        #
        #       ".NETFramework,Version=v2.0" --> "NETFramework.Version.v2.0"
        #
        set targetFramework [string trimleft [string map [list , . = .] \
            $::eagle_platform(targetFramework)] .]

        #
        # NOTE: Keep track of the specific target framework for usage in test
        #       constraints.
        #
        addConstraint [appendArgs targetFramework. $targetFramework]

        tputs $channel [appendArgs "yes (" $targetFramework ")\n"]
      } else {
        tputs $channel no\n
      }
    }

    proc checkForNativeUtility { channel } {
      tputs $channel "---- checking for native utility... "

      if {[info exists ::eagle_platform(nativeUtility)] && \
          [string length $::eagle_platform(nativeUtility)] > 0} then {
        set name [lindex $::eagle_platform(nativeUtility) 0]

        if {[string length $name] > 0} then {
          set version [lindex $::eagle_platform(nativeUtility) 1]

          if {[string length $version] > 0} then {
            set nativeUtility [appendArgs \
                $name . [getMajorMinorVersion $version]]
          } else {
            set nativeUtility $name
          }

          if {$nativeUtility ni "disabled unavailable"} then {
            addConstraint nativeUtility
          }

          addConstraint [appendArgs nativeUtility. $nativeUtility]

          tputs $channel [appendArgs \
              $::eagle_platform(nativeUtility) " (" $nativeUtility ")\n"]
        } else {
          tputs $channel unknown\n
        }
      } else {
        tputs $channel no\n
      }
    }

    proc checkForNetFx20ServicePack { channel } {
      tputs $channel "---- checking for .NET Framework 2.0 Service Pack... "

      #
      # NOTE: Platform must be Windows for this constraint to even be
      #       checked (i.e. we require the registry).
      #
      if {[isWindows]} then {
        #
        # NOTE: Registry hive where the .NET Framework 2.0 setup and
        #       servicing information is stored.  No need to look in
        #       the WoW64 registry because the .NET Framework should
        #       be installed natively as well.
        #
        set key [appendArgs HKEY_LOCAL_MACHINE\\ \
            {Software\Microsoft\NET Framework Setup\NDP\v2.0.50727}]

        #
        # NOTE: Attempt to fetch the .NET Framework 2.0 "SP" value from the
        #       servicing registry hive.  If this value does not exist -OR-
        #       is less than 1, then no .NET Framework 2.0 service pack is
        #       installed.  If this raises a script error, that will almost
        #       certainly cause the result to be a non-integer, thus failing
        #       the check below.
        #
        catch {
          object invoke Microsoft.Win32.Registry GetValue $key SP null
        } servicePack

        if {[string is integer -strict $servicePack]} then {
          #
          # NOTE: Service packs are always cumulative; therefore, add test
          #       constraints for all service pack levels up to the one that
          #       is actually installed.
          #
          for {set level 0} {$level <= $servicePack} {incr level} {
            addConstraint [appendArgs dotNet20Sp $level OrHigher]
          }

          #
          # NOTE: Also add the "exact" service pack test constraint even
          #       though it should almost never be used.
          #
          addConstraint [appendArgs dotNet20Sp $servicePack]

          #
          # NOTE: Show the "servicePack" value we found in the registry.
          #
          tputs $channel [appendArgs "yes (" $servicePack ")\n"]

          #
          # NOTE: We are done here, return now.
          #
          return
        }
      }

      tputs $channel no\n
    }

    proc getOsBuild {} {
      if {[info exists ::tcl_platform(osPatchLevel)]} then {
        return [lindex [split $::tcl_platform(osPatchLevel) .] 2]
      }

      return -1
    }

    proc isOsWindows11 {} {
      return [expr {[getOsBuild] >= 22000}]
    }

    proc isOsReleaseId { releaseId } {
      return [expr {[info exists ::tcl_platform(osReleaseId)] && \
          $::tcl_platform(osReleaseId) eq $releaseId}]
    }

    proc isOsProductType { type } {
      set type [string tolower $type]

      switch -exact -- $type {
        missing {
          #
          # NOTE: Used for backward compatibility with Eagle beta.
          #
          return [expr {![info exists ::tcl_platform(osProductType)]}]
        }
        unknown -
        none {
          set productTypes [list $type]
        }
        client {
          set productTypes [list workstation]
        }
        server {
          set productTypes [list "server domain controller" server]
        }
        default {
          return false; # NOTE: Unknown, so not it.
        }
      }

      return [expr {[info exists ::tcl_platform(osProductType)] && \
          $::tcl_platform(osProductType) in $productTypes}]
    }

    proc getFrameworkSetup45Value {} {
      #
      # NOTE: Return the "normal" value.
      #
      return 378389
    }

    proc getFrameworkSetup451Value {} {
      #
      # NOTE: Check if we are running on Windows.
      #
      if {[isWindows]} then {
        #
        # NOTE: Check if we are running on a server (or client) operating
        #       system.
        #
        if {[isOsProductType server]} then {
          #
          # NOTE: Is this Windows Server 2012 R2 (NT v6.3)?
          #
          # BUGBUG: Is exact matching correct here?
          #
          if {[info exists ::tcl_platform(osVersion)] && \
              $::tcl_platform(osVersion) == 6.3} then {
            #
            # NOTE: Return the "special" value.
            #
            return 378675
          }
        } elseif {[isOsProductType missing] || [isOsProductType client]} then {
          #
          # NOTE: Is this Windows 8.1 (NT v6.3)?
          #
          # BUGBUG: Is exact matching correct here?
          #
          if {[info exists ::tcl_platform(osVersion)] && \
              $::tcl_platform(osVersion) == 6.3} then {
            #
            # NOTE: Return the "special" value.
            #
            return 378675
          }
        }
      }

      #
      # NOTE: Return the "normal" value.
      #
      return 378758
    }

    proc getFrameworkSetup452Value {} {
      #
      # NOTE: Return the "normal" value.
      #
      return 379893
    }

    proc isFrameworkSetup453Installed {} {
      #
      # NOTE: Platform must be Windows for this constraint to even be
      #       checked (i.e. we require the registry).
      #
      if {[isWindows]} then {
        #
        # NOTE: Registry hive where the .NET Framework 4.0 setup and
        #       servicing information is stored.  No need to look in
        #       the WoW64 registry because the .NET Framework should
        #       be installed natively as well.
        #
        if {[catch {
          object invoke -alias Microsoft.Win32.Registry LocalMachine
        } rootKey] == 0 && [isNonNullObjectHandle $rootKey]} then {
          set key [appendArgs \
              {Software\Microsoft\.NETFramework\v4.0.30319\SKUs} \\ \
              .NETFramework,Version=v4.5.3]

          if {[catch {
            $rootKey OpenSubKey $key
          } skuKey] == 0 && [isNonNullObjectHandle $skuKey]} then {
            return true
          }
        }
      }

      return false
    }

    proc getFrameworkSetup46Value {} {
      #
      # NOTE: Check if we are running on Windows.
      #
      if {[isWindows]} then {
        #
        # NOTE: Check if we are running on a client operating system.
        #
        if {[isOsProductType missing] || [isOsProductType client]} then {
          #
          # NOTE: Is this Windows 10 (NT v10.0)?
          #
          # BUGBUG: Is exact matching correct here?
          #
          # BUGBUG: Treats Windows 11 differently than Windows 10.
          #
          if {[info exists ::tcl_platform(osVersion)] && \
              $::tcl_platform(osVersion) == 10.0 && \
              ![isOsWindows11]} then {
            #
            # NOTE: Return the "special" value.
            #
            return 393295
          }
        }
      }

      #
      # NOTE: Return the "normal" value.
      #
      return 393297
    }

    proc getFrameworkSetup461Value {} {
      #
      # NOTE: Check if we are running on Windows.
      #
      if {[isWindows]} then {
        #
        # NOTE: Check if we are running on a client operating system.
        #
        if {[isOsProductType missing] || [isOsProductType client]} then {
          #
          # NOTE: Is this Windows 10 (NT v10.0) with the
          #       "November Update" installed?
          #
          # BUGBUG: Is exact matching correct here?
          #
          if {[info exists ::tcl_platform(osVersion)] && \
              $::tcl_platform(osVersion) == 10.0 && \
              [haveTclPlatformOsExtraUpdateName \
                  "Windows 10, November Update"]} then {
            #
            # NOTE: Return the "special" value.
            #
            return 394254; # BUGBUG: November Update only?
          }
        }
      }

      #
      # NOTE: Return the "normal" value.
      #
      return 394271
    }

    proc getFrameworkSetup462Value {} {
      #
      # NOTE: Check if we are running on Windows.
      #
      if {[isWindows]} then {
        #
        # NOTE: Check if we are running on a server (or client) operating
        #       system.
        #
        if {[isOsProductType server]} then {
          #
          # NOTE: Is this Windows Server 2016 (NT v10.0 release 1607)?
          #
          # BUGBUG: Is exact matching correct here?
          #
          if {[info exists ::tcl_platform(osVersion)] && \
              $::tcl_platform(osVersion) == 10.0 && \
              [isOsReleaseId 1607]} then {
            #
            # NOTE: Return the "special" value.
            #
            return 394802
          }
        } elseif {[isOsProductType missing] || [isOsProductType client]} then {
          #
          # NOTE: Is this Windows 10 (NT v10.0) with the
          #       "Anniversary Update" installed?
          #
          # BUGBUG: Is exact matching correct here?
          #
          if {[info exists ::tcl_platform(osVersion)] && \
              $::tcl_platform(osVersion) == 10.0 && \
              [haveTclPlatformOsExtraUpdateName \
                  "Windows 10, Anniversary Update"]} then {
            #
            # NOTE: Return the "special" value.
            #
            return 394802; # BUGBUG: Anniversary Update only?
          }
        }
      }

      #
      # NOTE: Return the "normal" value.
      #
      return 394806
    }

    proc getFrameworkSetup47Value {} {
      #
      # NOTE: Check if we are running on Windows.
      #
      if {[isWindows]} then {
        #
        # NOTE: Check if we are running on a client operating system.
        #
        if {[isOsProductType missing] || [isOsProductType client]} then {
          #
          # NOTE: Is this Windows 10 (NT v10.0) with the
          #       "Creators Update" installed?
          #
          # BUGBUG: Is exact matching correct here?
          #
          if {[info exists ::tcl_platform(osVersion)] && \
              $::tcl_platform(osVersion) == 10.0 && \
              [haveTclPlatformOsExtraUpdateName \
                  "Windows 10, Creators Update"]} then {
            #
            # NOTE: Return the "special" value.
            #
            return 460798; # BUGBUG: Creators Update only?
          }
        }
      }

      #
      # NOTE: Return the "normal" value.
      #
      return 460805
    }

    proc getFrameworkSetup471Value {} {
      #
      # NOTE: Check if we are running on Windows.
      #
      if {[isWindows]} then {
        #
        # NOTE: Check if we are running on a server (or client) operating
        #       system.
        #
        if {[isOsProductType server]} then {
          #
          # NOTE: Is this Windows Server (NT v10.0 release 1709)?
          #
          # BUGBUG: Is exact matching correct here?
          #
          if {[info exists ::tcl_platform(osVersion)] && \
              $::tcl_platform(osVersion) == 10.0 && \
              [isOsReleaseId 1709]} then {
            #
            # NOTE: Return the "special" value.
            #
            return 461308
          }
        } elseif {[isOsProductType missing] || [isOsProductType client]} then {
          #
          # NOTE: Is this Windows 10 (NT v10.0) with the
          #       "Fall Creators Update" installed?
          #
          # BUGBUG: Is exact matching correct here?
          #
          if {[info exists ::tcl_platform(osVersion)] && \
              $::tcl_platform(osVersion) == 10.0 && \
              [haveTclPlatformOsExtraUpdateName \
                  "Windows 10, Fall Creators Update"]} then {
            #
            # NOTE: Return the "special" value.
            #
            return 461308; # BUGBUG: Fall Creators Update only?
          }
        }
      }

      #
      # NOTE: Return the "normal" value.
      #
      return 461310
    }

    proc getFrameworkSetup472Value {} {
      #
      # NOTE: Check if we are running on Windows.
      #
      if {[isWindows]} then {
        #
        # NOTE: Check if we are running on a server (or client) operating
        #       system.
        #
        if {[isOsProductType server]} then {
          #
          # NOTE: Is this Windows Server (NT v10.0 release 1803)?
          #
          # BUGBUG: Is exact matching correct here?
          #
          if {[info exists ::tcl_platform(osVersion)] && \
              $::tcl_platform(osVersion) == 10.0 && \
              [isOsReleaseId 1803]} then {
            #
            # NOTE: Return the "special" value.
            #
            return 461808
          }
        } elseif {[isOsProductType missing] || [isOsProductType client]} then {
          #
          # NOTE: Is this Windows 10 (NT v10.0) with the
          #       "April 2018 Update" installed?
          #
          # BUGBUG: Is exact matching correct here?
          #
          if {[info exists ::tcl_platform(osVersion)] && \
              $::tcl_platform(osVersion) == 10.0 && \
              [haveTclPlatformOsExtraUpdateName \
                  "Windows 10, April 2018 Update"]} then {
            #
            # NOTE: Return the "special" value.
            #
            return 461808; # BUGBUG: April 2018 Update only?
          }
        }
      }

      #
      # NOTE: Return the "normal" value.
      #
      return 461814
    }

    proc getFrameworkSetup48Value {} {
      #
      # NOTE: Check if we are running on Windows.
      #
      if {[isWindows]} then {
        #
        # NOTE: Check if we are running on a server (or client) operating
        #       system.
        #
        if {[isOsProductType server]} then {
          #
          # NOTE: Is this Windows Server 2022 (NT v10.0)?
          #
          # BUGBUG: Is exact matching correct here?
          #
          if {[info exists ::tcl_platform(osVersion)] && \
              $::tcl_platform(osVersion) == 10.0 && \
              [isOsReleaseId 21H2]} then {
            #
            # NOTE: Return the "special" value.
            #
            return 528449
          }
        } elseif {[isOsProductType missing] || [isOsProductType client]} then {
          #
          # NOTE: Is this Windows 10 -OR- 11 (NT v10.0)?
          #
          # BUGBUG: Is exact matching correct here?
          #
          if {[info exists ::tcl_platform(osVersion)] && \
              $::tcl_platform(osVersion) == 10.0} then {
            #
            # NOTE: Is this Windows 11 (NT v10.0)?
            #
            if {[isOsWindows11]} then {
              #
              # NOTE: Return the "special" value.
              #
              return 528449
            } else {
              #
              # NOTE: Is the "May 2020 Update" -OR- "October 2020 Update"
              #       -OR- "May 2021 Update" installed?
              #
              if {[haveTclPlatformOsExtraUpdateName \
                      "Windows 10, May 2020 Update"] || \
                  [haveTclPlatformOsExtraUpdateName \
                      "Windows 10, October 2020 Update"] || \
                  [haveTclPlatformOsExtraUpdateName \
                      "Windows 10, May 2021 Update"]} then {
                #
                # NOTE: Return the "special" value.
                #
                return 528372; # BUGBUG: May / October 2020 Update(s) only?
              } else {
                #
                # NOTE: Is the "May 2019 Update" -OR- "November 2019 Update"
                #       installed?
                #
                if {[haveTclPlatformOsExtraUpdateName \
                        "Windows 10, May 2019 Update"] || \
                    [haveTclPlatformOsExtraUpdateName \
                        "Windows 10, November 2019 Update"]} then {
                  #
                  # NOTE: Return the "special" value.
                  #
                  return 528040; # BUGBUG: May / November 2019 Update(s) only?
                }
              }
            }
          }
        }
      }

      #
      # NOTE: Return the "normal" value.
      #
      return 528049
    }

    proc getFrameworkSetup481Value {} {
      #
      # NOTE: Check if we are running on Windows.
      #
      if {[isWindows]} then {
        if {[isOsProductType missing] || [isOsProductType client]} then {
          #
          # NOTE: Is this Windows 11 (NT v10.0)?
          #
          # BUGBUG: Is exact matching correct here?
          #
          if {[info exists ::tcl_platform(osVersion)] && \
              $::tcl_platform(osVersion) == 10.0} then {
            #
            # NOTE: Is this Windows 11 (NT v10.0)?
            #
            if {[isOsWindows11]} then {
              #
              # NOTE: Is the "September 2022 Update" installed?
              #
              if {[haveTclPlatformOsExtraUpdateName \
                      "Windows 11, September 2022 Update"]} then {
                #
                # NOTE: Return the "special" value.
                #
                return 533320; # BUGBUG: September 2022 Update only?
              }
            }
          }
        }
      }

      #
      # NOTE: Return the "normal" value.
      #
      return 533325
    }

    proc checkForNetFx40 { channel } {
      tputs $channel "---- checking for .NET Framework 4.0... "

      #
      # NOTE: Platform must be Windows for this constraint to even be
      #       checked (i.e. we require the registry).
      #
      if {[isWindows]} then {
        #
        # NOTE: Registry hive where the .NET Framework 4.0 setup and
        #       servicing information is stored.  No need to look in
        #       the WoW64 registry because the .NET Framework should
        #       be installed natively as well.
        #
        if {[catch {
          object invoke -alias Microsoft.Win32.Registry LocalMachine
        } rootKey] == 0 && [isNonNullObjectHandle $rootKey]} then {
          set key [appendArgs \
              {Software\Microsoft\.NETFramework\v4.0.30319\SKUs}]

          set subKeys [list \
              .NETFramework,Version=v4.0                  \
              .NETFramework,Version=v4.0,Profile=Client   \
              .NETFramework,Version=v4.0.1                \
              .NETFramework,Version=v4.0.1,Profile=Client \
              .NETFramework,Version=v4.0.2                \
              .NETFramework,Version=v4.0.2,Profile=Client \
              .NETFramework,Version=v4.0.3                \
              .NETFramework,Version=v4.0.3,Profile=Client]

          foreach subKey [lreverse $subKeys] {
            if {[catch {
              $rootKey OpenSubKey [appendArgs $key \\ $subKey]
            } skuKey] == 0 && [isNonNullObjectHandle $skuKey]} then {
              if {[regexp -- {=v(4\.0(?:\.\d+)*)(?:,Profile=(.*)$)?} \
                  $subKey dummy dotVersion profile]} then {
                set version [getDotlessVersion $dotVersion]

                if {$dotVersion ne "4.0"} then {; # checkForRuntimeVersion
                  addConstraint [appendArgs dotNet $version]
                  addConstraint [appendArgs dotNet $version OrHigher]
                }

                if {[string length $profile] > 0} then {
                  addConstraint [appendArgs dotNet $version $profile]

                  tputs $channel [appendArgs \
                      "yes (" $dotVersion ", " $profile " Profile)\n"]
                } else {
                  tputs $channel [appendArgs "yes (" $dotVersion ")\n"]
                }

                return
              }
            }
          }
        }
      }

      tputs $channel no\n
    }

    proc checkForNetFx45 { channel } {
      tputs $channel "---- checking for .NET Framework 4.5 or higher... "

      #
      # NOTE: Platform must be Windows for this constraint to even be
      #       checked (i.e. we require the registry).
      #
      if {[isWindows]} then {
        #
        # NOTE: Registry hive where the .NET Framework 4.0 setup and
        #       servicing information is stored.  No need to look in
        #       the WoW64 registry because the .NET Framework should
        #       be installed natively as well.
        #
        set key [appendArgs HKEY_LOCAL_MACHINE\\ \
            {Software\Microsoft\NET Framework Setup\NDP\v4\Full}]

        #
        # NOTE: Attempt to fetch the .NET Framework 4.0 "release" value from
        #       the servicing registry hive.  If this value does not exist
        #       -OR- is less than 378389, then the .NET Framework 4.5 is not
        #       installed.  If this raises a script error, that will almost
        #       certainly cause the result to be a non-integer, thus failing
        #       the check below.
        #
        catch {
          object invoke Microsoft.Win32.Registry GetValue $key Release null
        } release

        if {[string is integer -strict $release] && \
            $release >= [getFrameworkSetup45Value]} then {
          #
          # NOTE: Yes, it appears that it is available.
          #
          addConstraint dotNet45OrHigher

          #
          # NOTE: If the "release" value is greater than or equal to 378758
          #       (or 378675 for Windows 8.1), then the .NET Framework 4.5.1
          #       is installed.  However, if the "release" value is also
          #       greater than or equal to 379893, then the .NET Framework
          #       4.5.2 is installed, which is an in-place upgrade to 4.5.1
          #       (and 4.5).  If the "release" value is also greater than or
          #       equal to 393297 (393295 on Windows 10), then the .NET
          #       Framework 4.6 is installed, which is an in-place upgrade
          #       to 4.5.x.  Similar handling is necessary for the .NET
          #       Framework 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, and 4.8.1.
          #       For more information, see:
          #
          #       https://msdn.microsoft.com/en-us/library/hh925568.aspx
          #
          if {$release >= [getFrameworkSetup481Value]} then {
            addConstraint dotNet451OrHigher
            addConstraint dotNet452OrHigher
            addConstraint dotNet453OrHigher
            addConstraint dotNet46OrHigher
            addConstraint dotNet461OrHigher
            addConstraint dotNet462OrHigher
            addConstraint dotNet47OrHigher
            addConstraint dotNet471OrHigher
            addConstraint dotNet472OrHigher
            addConstraint dotNet48OrHigher
            addConstraint dotNet481
            addConstraint dotNet481OrHigher

            set version 4.8.1
          } elseif {$release >= [getFrameworkSetup48Value]} then {
            addConstraint dotNet451OrHigher
            addConstraint dotNet452OrHigher
            addConstraint dotNet453OrHigher
            addConstraint dotNet46OrHigher
            addConstraint dotNet461OrHigher
            addConstraint dotNet462OrHigher
            addConstraint dotNet47OrHigher
            addConstraint dotNet471OrHigher
            addConstraint dotNet472OrHigher
            addConstraint dotNet48
            addConstraint dotNet48OrHigher

            set version 4.8
          } elseif {$release >= [getFrameworkSetup472Value]} then {
            addConstraint dotNet451OrHigher
            addConstraint dotNet452OrHigher
            addConstraint dotNet453OrHigher
            addConstraint dotNet46OrHigher
            addConstraint dotNet461OrHigher
            addConstraint dotNet462OrHigher
            addConstraint dotNet47OrHigher
            addConstraint dotNet471OrHigher
            addConstraint dotNet472
            addConstraint dotNet472OrHigher

            set version 4.7.2
          } elseif {$release >= [getFrameworkSetup471Value]} then {
            addConstraint dotNet451OrHigher
            addConstraint dotNet452OrHigher
            addConstraint dotNet453OrHigher
            addConstraint dotNet46OrHigher
            addConstraint dotNet461OrHigher
            addConstraint dotNet462OrHigher
            addConstraint dotNet47OrHigher
            addConstraint dotNet471
            addConstraint dotNet471OrHigher

            set version 4.7.1
          } elseif {$release >= [getFrameworkSetup47Value]} then {
            addConstraint dotNet451OrHigher
            addConstraint dotNet452OrHigher
            addConstraint dotNet453OrHigher
            addConstraint dotNet46OrHigher
            addConstraint dotNet461OrHigher
            addConstraint dotNet462OrHigher
            addConstraint dotNet47
            addConstraint dotNet47OrHigher

            set version 4.7
          } elseif {$release >= [getFrameworkSetup462Value]} then {
            addConstraint dotNet451OrHigher
            addConstraint dotNet452OrHigher
            addConstraint dotNet453OrHigher
            addConstraint dotNet46OrHigher
            addConstraint dotNet461OrHigher
            addConstraint dotNet462
            addConstraint dotNet462OrHigher

            set version 4.6.2
          } elseif {$release >= [getFrameworkSetup461Value]} then {
            addConstraint dotNet451OrHigher
            addConstraint dotNet452OrHigher
            addConstraint dotNet453OrHigher
            addConstraint dotNet46OrHigher
            addConstraint dotNet461
            addConstraint dotNet461OrHigher

            set version 4.6.1
          } elseif {$release >= [getFrameworkSetup46Value]} then {
            addConstraint dotNet451OrHigher
            addConstraint dotNet452OrHigher
            addConstraint dotNet453OrHigher
            addConstraint dotNet46
            addConstraint dotNet46OrHigher

            set version 4.6
          } elseif {$release >= [getFrameworkSetup452Value]} then {
            addConstraint dotNet451OrHigher
            addConstraint dotNet452OrHigher

            if {[isFrameworkSetup453Installed]} then {
              addConstraint dotNet453
              addConstraint dotNet453OrHigher

              set version 4.5.3
            } else {
              addConstraint dotNet452

              set version 4.5.2
            }
          } elseif {$release >= [getFrameworkSetup451Value]} then {
            addConstraint dotNet451
            addConstraint dotNet451OrHigher

            set version 4.5.1
          } else {
            addConstraint dotNet45

            set version 4.5
          }

          #
          # NOTE: Show the "release" value we found in the registry.
          #
          tputs $channel [appendArgs "yes (" $release ", " $version ")\n"]

          #
          # NOTE: We are done here, return now.
          #
          return
        }
      }

      tputs $channel no\n
    }

    proc checkForVisualStudioViaRegistry { channel } {
      tputs $channel "---- checking for Visual Studio using registry... "

      #
      # NOTE: Initially, no versions of Visual Studio have been found.
      #
      set visualStudioVersions [list]

      #
      # NOTE: Platform must be Windows for this constraint to even be
      #       checked (i.e. we require the registry).
      #
      if {[isWindows]} then {
        #
        # NOTE: Registry hive where Visual Studio install information is
        #       stored.  Make sure to look in the WoW64 registry because
        #       Visual Studio is currently always a 32-bit application.
        #
        set key [appendArgs HKEY_LOCAL_MACHINE\\ \
            [getSoftwareRegistryKey true] {\Microsoft\VisualStudio}]

        #
        # NOTE: The versions of Visual Studio that we support detection
        #       of using the registry.  This no longer works as of the
        #       release of Visual Studio 2017.  For Visual Studio 2017
        #       and beyond, the [checkForVisualStudioViaVsWhere] method
        #       must be used instead.
        #
        set versions [list [list 8.0 2005] [list 9.0 2008] \
            [list 10.0 2010] [list 11.0 2012] [list 12.0 2013] \
            [list 14.0 2015]]

        #
        # NOTE: Check each version and keep track of the ones we find.
        #
        foreach version $versions {
          #
          # NOTE: Attempt to fetch the Visual Studio install directory
          #       value from the registry, removing the trailing backslash,
          #       if any.
          #
          if {[catch {
            file normalize [file join [string trimright [object \
                invoke Microsoft.Win32.Registry GetValue [appendArgs \
                $key \\ [lindex $version 0]] InstallDir null] \\] \
                msenv.dll]
          } fileName] == 0} then {
            #
            # NOTE: Does the directory name look valid and does it
            #       actually exist?
            #
            if {[string length $fileName] > 0 && \
                [file isfile $fileName]} then {
              #
              # NOTE: Yes, it appears that it is available.
              #
              addConstraint [appendArgs \
                  visualStudio [lindex $version 1]]

              #
              # NOTE: Keep track of all the versions that we find.
              #
              lappend visualStudioVersions [lindex $version 1]

              #
              # NOTE: Save the directory for later usage by the test
              #       suite itself.
              #
              if {![info exists ::no(setVisualStudio)]} then {
                set ::test_visual_studio [file dirname $fileName]
              }
            }
          }
        }
      }

      if {[llength $visualStudioVersions] > 0} then {
        #
        # NOTE: Show where we found the latest version.
        #
        tputs $channel [appendArgs \
            "yes (" $visualStudioVersions ", \"" \
            [expr {[info exists ::test_visual_studio] ? \
                $::test_visual_studio : "<none>"}] "\")\n"]
      } else {
        tputs $channel no\n
      }
    }

    proc checkForNativeDebugger { channel } {
      tputs $channel "---- checking for native debugger... "

      #
      # NOTE: Is the native debugger present?
      #
      if {[catch {
        object invoke -flags +NonPublic \
            Eagle._Components.Private.NativeOps+SafeNativeMethods \
            IsDebuggerPresent
      } present] == 0 && [string is true -strict $present]} then {
        #
        # NOTE: Yes, it appears that it is present.
        #
        addConstraint nativeDebugger

        tputs $channel yes\n
      } else {
        tputs $channel no\n
      }
    }

    proc checkForManagedDebugger { channel } {
      tputs $channel "---- checking for managed debugger... "

      #
      # NOTE: Is the managed debugger attached?
      #
      if {[catch {
        object invoke System.Diagnostics.Debugger IsAttached
      } attached] == 0 && [string is true -strict $attached]} then {
        #
        # NOTE: Yes, it appears that it is attached.
        #
        addConstraint managedDebugger

        tputs $channel yes\n
      } else {
        tputs $channel no\n
      }
    }

    proc checkForScriptDebugger { channel } {
      tputs $channel "---- checking for script debugger... "

      #
      # NOTE: Is the script debugger available?
      #
      if {[catch {
        object invoke -flags +NonPublic Interpreter.GetActive Debugger
      } debugger] == 0} then {
        #
        # NOTE: We do not own this, do not dispose it.
        #
        if {[isNonNullObjectHandle $debugger]} then {
          catch {object flags $debugger +NoDispose}
        }

        if {[regexp -- {^Debugger#\d+$} $debugger]} then {
          #
          # NOTE: Yes, it appears that it is available.
          #
          addConstraint scriptDebugger

          tputs $channel yes\n

          #
          # NOTE: We are done here, return now.
          #
          return
        }
      }

      tputs $channel no\n
    }

    proc checkForScriptDebuggerInterpreter { channel } {
      tputs $channel "---- checking for script debugger interpreter... "

      #
      # NOTE: Is the script debugger interpreter available?
      #
      if {[catch {
        object invoke -flags +NonPublic Interpreter.GetActive Debugger
      } debugger] == 0} then {
        #
        # NOTE: We do not own this, do not dispose it.
        #
        if {[isNonNullObjectHandle $debugger]} then {
          catch {object flags $debugger +NoDispose}
        }

        if {[regexp -- {^Debugger#\d+$} $debugger] && \
            [catch {object invoke $debugger Interpreter} interp] == 0} then {
          #
          # NOTE: We do not own this, do not dispose it.
          #
          if {[isNonNullObjectHandle $interp]} then {
            catch {object flags $interp +NoDispose}
          }

          if {[regexp -- {^Interpreter#\d+$} $interp]} then {
            #
            # NOTE: Yes, it appears that it is available.
            #
            addConstraint scriptDebuggerInterpreter

            tputs $channel yes\n

            #
            # NOTE: We are done here, return now.
            #
            return
          }
        }
      }

      tputs $channel no\n
    }

    ###########################################################################
    ############################# END Eagle ONLY ##############################
    ###########################################################################
  } else {
    ###########################################################################
    ############################# BEGIN Tcl ONLY ##############################
    ###########################################################################

    #
    # NOTE: We need several of our test constraint related commands in the
    #       global namespace.
    #
    exportAndImportPackageCommands [namespace current] [list \
        getKnownBuildTypes getKnownCompileOptions getKnownWindowsVersions \
        getKnownDotNetVersions getKnownMonoVersions addKnownMonoConstraints \
        getKnownDotNetCoreVersions getKnownPublicKeyTokenPattern \
        addKnownDotNetConstraints addKnownDotNetCoreConstraints \
        getKnownMonoVersions addKnownMonoConstraints \
        getKnownDotNetCoreVersions addKnownDotNetCoreConstraints \
        getKnownTclVersions filterKnownVersions \
        getDotNetCoreDirectoryNameOnly getDotNetCoreLibPathDirectoryNameOnly \
        getRuntimeVersion getDottedVersion getDotlessVersion \
        getMajorMinorVersion loadTestSettings lpermute lcombine \
        alwaysFullInterpReady canExecComSpec canExecWhoAmI canExecTclShell \
        canExecFossil canExecFsUtil canExecVsWhere canExecWmic getCpuStatus \
        isTestMono isTestDotNetCore isTestAdministrator canPing \
        cleanConstraintName cleanPackageName haveTclPlatformOsExtraUpdateName \
        appendExecArguments tryDetectFossilRoot execFossilCommand \
        checkForTestSuiteFiles checkForPlatform checkForWindowsVersion \
        checkForGetInstalledUpdates checkForOperatingSystemUpdate \
        checkForScriptLibrary checkForEnvironmentVariable checkForVariable \
        checkForTclOptions checkForWindowsCommandProcessor checkForPackage \
        checkForFossil checkForVisualStudioViaVsWhere checkForEagle \
        checkForSymbols checkForLogFile checkForGaruda checkForShell \
        checkForOfficialStableReleaseInProgress checkForDebug checkForTk \
        checkForVersion checkForCommand checkForSubCommand checkForIntIsWide \
        checkForEFormat checkForNamespaces checkForTestExec \
        checkForTestMachine checkForTestPlatform checkForTestConfiguration \
        checkForTestNamePrefix checkForTestSuffix checkForGnuScreen \
        checkForFile checkForPathFile checkForNativeCode checkForTip127 \
        checkForTip182 checkForTip194 checkForTip207 checkForTip241 \
        checkForTip285 checkForTip405 checkForTip421 checkForTip426 \
        checkForTip429 checkForTip440 checkForTip461 checkForTip463 \
        checkForTip471 checkForTip508 checkForTip521 checkForTiming \
        checkForPerformance checkForBigLists checkForProcessorIntensive \
        checkForFileSystemIntensive checkForTimeIntensive checkForFullTest \
        checkForMemoryIntensive checkForStackIntensive checkForStackSize \
        checkForInteractive checkForInteractiveFocus \
        checkForInteractiveCommand checkForUserInteraction \
        checkForOfflineMode checkForNetwork maybeDownloadFromUri \
        checkForInternet checkForTlsOk checkForCompileOption \
        checkForBuildType checkForKnownBuildTypes \
        checkForKnownCompileOptions] false false

    ###########################################################################
    ############################## END Tcl ONLY ###############################
    ###########################################################################
  }

  #
  # NOTE: Provide the Eagle "test constraints" package to the interpreter.
  #
  package provide Eagle.Test.Constraints \
    [expr {[isEagle] ? [info engine PatchLevel] : "1.0"}]
}


Added Externals/Eagle/lib/Test1.0/epilogue.eagle.





























































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
###############################################################################
#
# epilogue.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Test Epilogue File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

if {![info exists no([file tail [info script]])]} then {
  if {[info level] > 0} then {
    error "cannot run, current level is not global"
  }

  #
  # NOTE: Verify that the current call frame is correct and that the
  #       interpreter call stack has not been imbalanced by previous
  #       tests or other errors.  This check only applies to Eagle.
  #
  if {[isEagle] && [llength [info commands object]] > 0} then {
    #
    # NOTE: Check the name of the current call frame against the one
    #       that should be used for evaluating this script file.
    #
    if {[object invoke -flags +NonPublic \
            Interpreter.GetActive.CurrentFrame Name] ne \
        [list source [file normalize [info script]]]} then {
      unset -nocomplain test_suite_running
      error "cannot run epilogue, current frame not for this script"
    }
  }

  #
  # NOTE: Make sure all the variables used by this epilogue are unset.
  #
  unset -nocomplain haveStartSentry operationCount memory stack \
      name count percent exitCode milliseconds code dictionary \
      error usageKind usageType pair usageData key value cmdType \
      usage

  #
  # HACK: Maybe process events for a little while on this thread to
  #       give the window manager the opporutnity to hopefully remove
  #       closed windows, etc, from the screen.
  #
  if {![info exists no(epilogueEvents)] && [needTestDoEvents]} then {
    if {[isEagle] || [haveConstraint tcl85OrHigher]} then {
      set expr {max(2000, $test_timeout)}

      set milliseconds [expr $expr]

      unset expr
    } else {
      set milliseconds 2000; # HACK: Tcl 8.4, no max()
    }

    tputs $test_channel [appendArgs \
        "---- processing pending events for about " $milliseconds \
        " milliseconds... "]

    testDoEvents $milliseconds

    tputs $test_channel done\n

    unset milliseconds
  }

  #
  # NOTE: Show when the tests actually ended (now).
  #
  tputs $test_channel [appendArgs "---- tests ended at " \
      [formatTimeStamp [set test_timestamp(endSeconds) \
      [clock seconds]]] \n]

  #
  # NOTE: We can only calculate the elapsed seconds for the tests if
  #       the necessary variables exist and contain valid values.
  #
  if {[info exists test_timestamp(startSeconds)] && \
      [string is integer -strict $test_timestamp(startSeconds)] && \
      [info exists test_timestamp(endSeconds)] && \
      [string is integer -strict $test_timestamp(endSeconds)]} then {
    #
    # NOTE: First, figure out how many whole seconds elapsed during
    #       roughly the entire testing process (which is rougly the
    #       same time taken to just run the tests themselves).
    #
    set test_timestamp(elapsedSeconds) [expr \
        {$test_timestamp(endSeconds) - $test_timestamp(startSeconds)}]

    #
    # NOTE: Show (and log) the number of elapsed seconds and possibly
    #       a human readable elapsed time string as well.
    #
    tputs $test_channel [appendArgs "---- tests took approximately " \
        [formatElapsedTime $test_timestamp(elapsedSeconds)] \n]
  }

  #
  # NOTE: Show the ending command count (for both Tcl and Eagle).
  #
  tputs $test_channel [appendArgs "---- ending command count: " \
      [info cmdcount] \n]

  #
  # NOTE: Maybe check for the start-of-log sentry in the test log file.
  #       If it is not found, there is a problem.
  #
  if {![info exists no(checkLogStartSentry)]} then {
    set haveStartSentry [doesTestLogHaveStartSentry]

    if {$haveStartSentry} then {
      tputs $test_channel "---- found start-of-log sentry\n"
    } else {
      tputs $test_channel "---- missing start-of-log sentry\n"
    }
  } else {
    set haveStartSentry false

    tputs $test_channel "---- skipped start-of-log sentry\n"
  }

  if {[isEagle]} then {
    #
    # NOTE: We can only calculate the elapsed microseconds for the tests
    #       if the necessary variables exist and contain valid values.
    #
    if {[info exists test_timestamp(startCount)] && \
        [string is wideinteger -strict $test_timestamp(startCount)]} then {
      #
      # NOTE: First, figure out how many microseconds elapsed during
      #       roughly the entire testing process (which is rougly the
      #       same time taken to just run the tests themselves).
      #
      catch {
        set test_timestamp(elapsedMicroseconds) \
            [clock stop $test_timestamp(startCount)]
      }

      #
      # NOTE: Show the approximate number of elapsed microseconds.
      #
      if {[info exists test_timestamp(elapsedMicroseconds)] && [string \
          is double -strict $test_timestamp(elapsedMicroseconds)]} then {
        tputs $test_channel [appendArgs "---- tests took approximately " \
            [formatDecimal $test_timestamp(elapsedMicroseconds)] \
            " microseconds\n"]
      }
    }

    #
    # NOTE: Show the ending operation count (for Eagle only).
    #
    if {[llength [info commands object]] > 0} then {
      catch {
        object invoke -flags +NonPublic Interpreter.GetActive OperationCount
      } operationCount
    } else {
      set operationCount unavailable
    }

    tputs $test_channel [appendArgs "---- ending operation count: " \
        $operationCount \n]

    unset operationCount

    #
    # NOTE: Maybe show the current state of the CPU.
    #
    if {![info exists no(showEndingCpu)]} then {
      set cpu(0) [catch {getCpuStatus} cpu(1)]

      tputs $test_channel [appendArgs "---- ending cpu: " \
          [formatListAsDict [expr {$cpu(0) == 0 ? $cpu(1) : ""}] \
          <none>] \n]

      unset cpu
    }

    #
    # NOTE: Maybe show the current state of the memory.
    #
    if {![info exists no(showEndingMemory)]} then {
      set memory(0) [catch {debug memory} memory(1)]

      tputs $test_channel [appendArgs "---- ending memory: " \
          [formatListAsDict [expr {$memory(0) == 0 ? $memory(1) : ""}] \
          <none>] \n]

      unset memory
    }

    #
    # NOTE: Maybe show the current state of the native stack.
    #
    if {![info exists no(showEndingStack)]} then {
      set stack(0) [catch {debug stack true} stack(1)]

      tputs $test_channel [appendArgs "---- ending stack: " \
          [formatListAsDict [expr {$stack(0) == 0 ? $stack(1) : ""}] \
          <none>] \n]

      unset stack
    }

    #
    # NOTE: Maybe show the (maximum?) levels that were hit by whichever
    #       tests actually ran.
    #
    if {![info exists no(showEndingLevels)]} then {
      set levels(0) [catch {debug levels} levels(1)]

      tputs $test_channel [appendArgs "---- ending levels: " \
          [formatListAsDict [expr {$levels(0) == 0 ? $levels(1) : ""}] \
          <none>] \n]

      unset levels
    }

    #
    # NOTE: Maybe show usage data for all commands.
    #
    if {![info exists no(showEndingUsageData)] && \
        [llength [info commands object]] > 0} then {
      #
      # HACK: Many things can go wrong here and we do not want to cause
      #       problems for the test run; therefore, wrap all this usage
      #       data gathering and reporting in a [catch] block.
      #
      foreach usageKind [list Command Function Procedure Operator] {
        if {[catch {
          unset -nocomplain usageData

          foreach usageType [list Count Microseconds] {
            set dictionary null; set error null

            set code [object invoke Interpreter.GetActive \
                GetUsageData $usageKind $usageType dictionary \
                error]

            if {$code eq "Ok"} then {
              object foreach -alias pair $dictionary {
                set value [$pair Value]

                if {$value == 0} then {continue}
                set key [lindex [split [$pair Key] \t] 2]

                if {$usageKind ne "Command" || \
                    ([catch {info cmdtype $key} cmdType] == 0 && \
                    $cmdType in [list native ensemble])} then {
                  lappend usageData($key) [list $usageType $value]
                }
              }
            } else {
              tputs $test_channel [appendArgs \
                  "---- received usage data error: " \
                  [getStringFromObjectHandle $error] \n]
            }
          }

          array get usageData
        } usage] == 0} then {
          tputs $test_channel [appendArgs \
              "---- " [string tolower $usageKind] " usage data: " \
              [formatListAsDict $usage <none>] \n]
        } else {
          tputs $test_channel [appendArgs \
              "---- caught " [string tolower $usageKind] \
              " usage data error: " $usage \n]
        }
      }

      unset -nocomplain code dictionary error usageKind usageType \
          pair usageData key value cmdType usage
    }

    #
    # NOTE: Check the overall test suite results and report them now.
    #
    reportTestDuplicateNames $test_channel

    tputs $test_channel \n; # NOTE: Blank line.

    reportTestConstraintCounts $test_channel $eagle_tests(SkippedNames)
    reportTestResultCounts $test_channel percent

    set success [testCheckOverallResult \
        $test_channel $percent $haveStartSentry exitCode]

    tputs $test_channel \n; # NOTE: Blank line.

    #
    # NOTE: Attempt to log the overall test suite results with the test
    #       server, as long as we are not forbidden from doing so.
    #
    if {![info exists no(logRemoteTestResults)] && \
        ![info exists no(eagleLogRemoteTestResults)]} then {
      catch {logRemoteTestResults $success}; # NOTE: Server errors, etc.
    }

    unset percent success
  } else {
    #
    # NOTE: Check the overall test suite results and report them now.
    #
    tputs $test_channel \n; # NOTE: Blank line.

    reportTestResultCounts $test_channel percent

    set success [testCheckOverallResult \
        $test_channel $percent $haveStartSentry exitCode]

    tputs $test_channel \n; # NOTE: Blank line.

    #
    # NOTE: Attempt to log the overall test suite results with the test
    #       server, as long as we are not forbidden from doing so.
    #
    if {![info exists no(logRemoteTestResults)] && \
        ![info exists no(tclLogRemoteTestResults)]} then {
      logRemoteTestResults $success; # NOTE: Server errors, etc.
    }

    unset percent success
  }

  #
  # NOTE: We no longer need the result of the start-of-log sentry check.
  #
  unset haveStartSentry

  #
  # NOTE: Call the Tcl test cleanup procedure now to give it a chance to do
  #       any custom cleanup that has been registered.
  #
  ::tcltest::cleanupTests

  #
  # NOTE: Check for and process any custom test epilogue script that may
  #       be set in the environment.
  #
  sourceIfValid epilogue [getEnvironmentVariable testEpilogue]

  #
  # NOTE: Are we being prevented from evaluating the "post-test" script?
  #
  if {![info exists no(postTest)]} then {
    #
    # NOTE: Evaluate the specified post-test script now, if any.
    #
    if {[info exists test_script(post)] && \
        [string length $test_script(post)] > 0} then {
      #
      # TODO: Perhaps use [uplevel] here instead of [eval].  For now, it does
      #       not matter since we enforce this file being evaluated at the
      #       top-level.
      #
      if {[catch $test_script(post) test_script(post,result)]} then {
        #
        # NOTE: Make 100% sure, even in "quiet" mode, that this script error
        #       gets into the test log file.
        #
        tputs $test_channel [appendArgs "---- post-test script error: " \
            $test_script(post,result) \n]

        #
        # NOTE: The post-test script failed in some way.  This is considered
        #       to be an overall failure of the test suite; therefore, raise
        #       the error now that we are sure it has been recorded in the
        #       test log file.
        #
        unset -nocomplain test_suite_running
        error $test_script(post,result)
      }
    }
  }

  #
  # NOTE: Indicate that the test suite is no longer running.
  #
  if {[info exists test_suite_running] && $test_suite_running} then {
    set test_suite_running false
  }

  #
  # NOTE: Do we need to exit now?
  #
  if {[isExitOnComplete]} then {
    #
    # NOTE: Exit now.  In Eagle, this will not exit the entire process.
    #       Zero (0) will be the exit code if all the selected tests have
    #       succeeded or the test success threshold has been met or
    #       exceeded; otherwise, one (1) will be the exit code.
    #
    exit $exitCode
  } else {
    #
    # NOTE: For Eagle, even when not exiting, we still set the ExitCode
    #       property of the interpreter.
    #
    if {[isEagle] && [llength [info commands object]] > 0} then {
      object invoke -alias Interpreter.GetActive ExitCode $exitCode
    }

    unset exitCode
  }
}

Added Externals/Eagle/lib/Test1.0/pkgIndex.eagle.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
###############################################################################
#
# pkgIndex.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Package Index File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

if {![package vsatisfies [package provide Tcl] 8.4]} {return}
if {![package vsatisfies [package provide Eagle] 1.0]} {return}

package ifneeded Eagle.Test.Constraints 1.0 \
    [list sourceWithInfo [file join $dir constraints.eagle]]

Added Externals/Eagle/lib/Test1.0/pkgIndex.tcl.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
###############################################################################
#
# pkgIndex.tcl --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Package Index File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

if {![package vsatisfies [package provide Tcl] 8.4]} {return}
if {[string length [package provide Eagle]] > 0} then {return}

package ifneeded Eagle.Test.Constraints 1.0 [list source [file join $dir \
    constraints.eagle]]

Added Externals/Eagle/lib/Test1.0/prologue.eagle.

























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
###############################################################################
#
# prologue.eagle --
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Test Prologue File
#
# Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id: $
#
###############################################################################

if {![info exists no([file tail [info script]])]} then {
  if {[info level] > 0} then {
    error "cannot run, current level is not global"
  }

  #
  # NOTE: Make sure all the variables used by this prologue are unset.
  #
  unset -nocomplain expr pkg_dir pattern dummy directory name value \
      exec encoding host memory stack drive server database timeout \
      user password percent checkout timeStamp loaded

  #
  # NOTE: Remove any stale test suite error messages from prior runs.
  #
  unset -nocomplain test_suite_errors

  #
  # NOTE: Indicate that the test suite is currently running.
  #
  if {![info exists test_suite_running] || !$test_suite_running} then {
    set test_suite_running true
  }

  #
  # NOTE: Set the location of the test suite package, if necessary.
  #
  if {![info exists test_all_path]} then {
    set test_all_path [file normalize [file dirname [info script]]]
  }

  #
  # NOTE: Set the location of the primary test suite file, if necessary.
  #
  if {![info exists test_suite_file]} then {
    set test_suite_file [file normalize [info script]]
  }

  #
  # NOTE: Set the location of the test suite, if necessary.
  #
  if {![info exists test_path]} then {
    #
    # NOTE: Build a reusable expression that can be used to verify the
    #       candidate paths.  This is done to avoid duplication of this
    #       (quite complex) expression several times (just below).
    #
    set expr {![info exists test_path] || ![file exists $test_path] || \
        ![file isdirectory $test_path] || ([llength [info commands \
        glob]] > 0 && [llength [glob -directory $test_path -types {f r} \
        -nocomplain -- *]] == 0)}

    #
    # NOTE: Search for the "Library/Tests" -OR- "Tests" sub-directories
    #       within the sub-directory one level up and then two levels up
    #       from the sub-directory containing the "all.eagle" file from
    #       the test suite package.
    #
    set test_path [file normalize \
        [file join [file dirname $test_all_path] Library Tests]]

    if {[expr $expr]} then {
      set test_path [file normalize \
          [file join [file dirname [file dirname $test_all_path]] \
          Library Tests]]
    }

    if {[expr $expr]} then {
      set test_path [file normalize \
          [file join [file dirname $test_all_path] Tests]]
    }

    if {[expr $expr]} then {
      set test_path [file normalize \
          [file join [file dirname [file dirname $test_all_path]] \
          Tests]]
    }

    unset expr
  }

  #
  # NOTE: If the optional extra paths have not been set, do that now.
  #
  if {![info exists test_extra_paths]} then {
    set test_extra_paths [list]
  }

  #
  # NOTE: Set the location of the home directory for the current
  #       user.
  #
  if {![info exists test_home_path]} then {
    set test_home_path [file normalize ~]
  }

  #
  # NOTE: Set the location of the test suite data, if necessary.
  #
  if {![info exists test_data_path]} then {
    set test_data_path [file join $test_path data]
  }

  #
  # NOTE: Set the location of the base Eagle directory, if
  #       necessary.
  #
  if {![info exists base_path]} then {
    #
    # NOTE: Start out going up one level and check for a "lib"
    #       sub-directory.  If not found, go up another level
    #       because we will always be two levels down from the
    #       base directory when running inside the source tree.
    #
    set base_path [file normalize [file dirname $test_path]]

    #
    # HACK: We must verify that the "init.eagle" file can eventually
    #       be found under the "lib" directory since Visual Studio
    #       insists on creating a superfluous (and empty) "lib\Eagle1.0"
    #       sub-directory inside of the "Library" project directory
    #       simply due to the links contained in the project file that
    #       actually point to the "lib\Eagle1.0" sub-directory under the
    #       solution directory.
    #
    # WARNING: The Eagle package name and version are hard-coded here.
    #
    set pkg_dir Eagle1.0; # TODO: Change me.

    if {![file exists [file join $base_path lib]] || \
        ![file isdirectory [file join $base_path lib]] || \
        ![file exists [file join $base_path lib $pkg_dir]] || \
        ![file isdirectory [file join $base_path lib $pkg_dir]] || \
        ![file exists [file join $base_path lib $pkg_dir init.eagle]] || \
        ![file isfile [file join $base_path lib $pkg_dir init.eagle]]} then {
      #
      # NOTE: We do not bother to check if the "lib" sub-directory actually
      #       exists as a child of this one.  This is the previous (legacy)
      #       behavior (i.e. where we always went up two levels to the base
      #       directory).
      #
      set base_path [file dirname $base_path]
    }

    unset pkg_dir
  }

  #############################################################################

  #
  # NOTE: Set the location of the native Tcl library directory (i.e. should
  #       contain the "Eagle.Tools.Common" package, etc), if necessary.
  #
  if {![info exists native_lib_path]} then {
    #
    # NOTE: Normally, there should be a "Native/Common/Tools" sub-directory
    #       within the base directory, e.g. if we are within an actual copy
    #       of a source checkout.
    #
    set native_lib_path [file join $base_path Native Common Tools]
  }

  #############################################################################

  #
  # NOTE: Set the location of the Eagle main strong name keys directory,
  #       if necessary.
  #
  if {![info exists key_path]} then {
    #
    # NOTE: Normally, there should be a "Keys" sub-directory just within
    #       the base directory.
    #
    set key_path [file join $base_path Keys]
  }

  #############################################################################

  #
  # NOTE: Set the executable file name for the process, if
  #       necessary.
  #
  if {![info exists bin_file]} then {
    #
    # HACK: This does not use the [getShellExecutableName]
    #       script library procedure because it must always
    #       refer to the name of the file that started the
    #       current process.
    #
    set bin_file [info nameofexecutable]; # EXEMPT
  }

  #
  # NOTE: Set the location of the directory containing the
  #       executable file for the process, if necessary.
  #
  if {![info exists bin_path]} then {
    set bin_path [file normalize [file dirname $bin_file]]
  }

  #
  # NOTE: Set the location of the [non-script] library directory
  #       (i.e. the directory where the plugins are located), if
  #       necessary.  This variant is based on where the process
  #       executable is located.
  #
  if {![info exists lib_path]} then {
    #
    # NOTE: This should go one directory up from the directory
    #       containing the executable file for the process (e.g.
    #       the shell) and then into the "lib" directory just
    #       beneath that.
    #
    set lib_path [file normalize [file join [file dirname $bin_path] lib]]
  }

  #
  # NOTE: Set the location of the Eagle core library -OR- Tcl core
  #       library file is located.  This may be different than the
  #       location of the (shell?) executable file.
  #
  if {![info exists core_bin_path]} then {
    #
    # NOTE: Attempt to obtain the information for the Eagle core
    #       library assembly.  This will not work for native Tcl.
    #
    if {[catch {info assembly} bin_dir] == 0} then {
      #
      # NOTE: Grab the directory for the core library assembly.
      #
      set core_bin_path [file dirname [lindex $bin_dir end]]
    } else {
      #
      # NOTE: This is native Tcl.  There is no way to query the
      #       path for the Tcl core library itself (e.g. "tcl*.dll",
      #       "libtcl*.so", etc); however, using [info library] is
      #       close enough.
      #
      set core_bin_path [file dirname [info library]]
    }

    unset bin_dir
  }

  #
  # NOTE: Set the location of the [non-script] library directory
  #       (i.e. the directory where the plugins are located), if
  #       necessary.  This variant is based on where the Eagle
  #       core library -OR- Tcl core library file is located.
  #
  if {![info exists core_lib_path]} then {
    #
    # NOTE: Start with the directory for the core library assembly.
    #
    set core_lib_path $core_bin_path

    #
    # NOTE: Perform a check for the .NET Core output directories
    #       (e.g. "netcoreapp2.0", etc), which must be removed
    #       if present, prior to further checks.
    #
    if {![info exists no(dotNetCoreLibPath)] && \
        [string match net* [file tail $core_lib_path]]} then {
      #
      # NOTE: Remove the .NET Core output directory name.
      #
      set core_lib_path [file dirname $core_lib_path]
    }

    #
    # NOTE: Go up one level, to remove the "bin" directory and
    #       then append the "lib" directory.  This gives us the
    #       final path we need.
    #
    set core_lib_path [file normalize \
        [file join [file dirname $core_lib_path] lib]]
  }

  #
  # NOTE: Set the port to use for server sockets, if necessary.
  #
  if {![info exists test_port]} then {
    set test_port 12346; # IANA, 12346-12752 Unassigned
  }

  #
  # NOTE: Set the timeout, if necessary.  This is a "short" timeout
  #       that has historically been used for network related calls.
  #
  if {![info exists test_timeout]} then {
    if {[catch {
      info engine NetworkTimeout
    } test_timeout]} then {
      set test_timeout 2000; # in milliseconds (COMPAT: Eagle beta).
    }
  }

  #
  # NOTE: Set the default number of iterations for stress tests.
  #
  if {![info exists test_stress_count]} then {
    set test_stress_count 10000; # in iterations.
  }

  #
  # NOTE: Set the channel to use for test output, if necessary.
  #
  if {![info exists test_channel]} then {
    set test_channel stdout
  }

  #
  # NOTE: Set the primary package path, if necessary.
  #
  if {![info exists test_package_path]} then {
    set test_package_path [file join $base_path lib]
  }

  #
  # NOTE: Make sure our primary package path is part of the auto-path.
  #
  if {[info exists auto_path] && \
      [lsearch -exact $auto_path $test_package_path] == -1} then {
    lappend auto_path $test_package_path
  }

  #
  # NOTE: Make sure the test suite package is part of the auto-path.
  #
  if {[info exists auto_path] && \
      [lsearch -exact $auto_path $test_all_path] == -1} then {
    lappend auto_path $test_all_path
  }

  #
  # NOTE: Make sure the test suite is part of the auto-path.  This is
  #       now done for legacy compatibility only.
  #
  if {[info exists auto_path] && \
      [lsearch -exact $auto_path $test_path] == -1} then {
    lappend auto_path $test_path
  }

  #############################################################################

  #
  # NOTE: Check for and load the Eagle library package, if necessary.
  #
  if {[catch {package present Eagle.Library}]} then {
    package require Eagle.Library
  }

  #
  # NOTE: Check for and load the Eagle test package, if necessary.
  #
  if {[catch {package present Eagle.Test}]} then {
    package require Eagle.Test
  }

  #
  # NOTE: Check for and load the Eagle test constraints package, if
  #       necessary.
  #
  if {[catch {package present Eagle.Test.Constraints}]} then {
    package require Eagle.Test.Constraints
  }

  #############################################################################

  #
  # NOTE: Set the web hosts to test TLS (1.2, etc) against, if
  #       necessary.
  #
  if {![info exists test_hosts]} then {
    set hostsFile [file join $test_data_path hosts.txt]

    if {[file exists $hostsFile]} then {
      set test_hosts [split [readFile $hostsFile] \n]
    } else {
      set test_hosts [list]
    }

    unset -nocomplain hostsFile
  }

  #
  # NOTE: Set the web host to test against, if necessary.
  #
  if {![info exists test_host]} then {
    if {[llength $test_hosts] > 0} then {
      set test_host [lindex $test_hosts 0]
    } else {
      set test_host eagle.to; # COMPAT: Eagle beta.
    }
  }

  #############################################################################

  #
  # NOTE: *SPECIAL* This test constraint must be checked first as it can
  #       determine if subsequent ones will emit warnings.  This is only
  #       applicable to Eagle.  This block requires the "Eagle.Test" and
  #       "Eagle.Test.Constraints" packages.
  #
  if {[isEagle]} then {
    #
    # NOTE: Has quiet testing support been disabled?
    #
    if {![info exists no(preQuiet)]} then {
      #
      # NOTE: There are checks for the "quiet" test constraint prior to
      #       the real test constraints being initialized.  Prepare for
      #       those checks now.  This will have to be repeated later,
      #       after the real test constraints are initialized.
      #
      checkForQuiet $test_channel true
    }
  }

  #############################################################################

  #
  # NOTE: Verify that the current call frame is correct and that the
  #       interpreter call stack has not been imbalanced by previous
  #       tests or other errors.  This check only applies to Eagle.
  #       This block requires the "Eagle.Library" package.
  #
  if {[isEagle] && [llength [info commands object]] > 0} then {
    #
    # NOTE: Check the name of the current call frame against the one
    #       that should be used for evaluating this script file.
    #
    if {[object invoke -flags +NonPublic \
            Interpreter.GetActive.CurrentFrame Name] ne \
        [list source [file normalize [info script]]]} then {
      unset -nocomplain test_suite_running
      error "cannot run prologue, current frame not for this script"
    }

    #
    # NOTE: Attempt to determine if the this script file being run as
    #       part of the overall test suite script file itself.  If not,
    #       issue a warning about the inability to detect "leaks" from
    #       the tests.
    #
    if {[lsearch -glob -index 0 -- [object invoke -flags +NonPublic \
            Interpreter.GetActive ScriptLocations.ToString] \
            {*[/\]all.eagle}] == -1} then {
      #
      # NOTE: Check if the warning should actually be emitted.  If this
      #       warning has specifically been disabled or we are in quiet
      #       mode, do nothing.
      #
      if {![info exists no(warningForAllEagle)] && \
          ![haveConstraint quiet]} then {
        tputs $test_channel [appendArgs \
            "==== WARNING: tests are not being run via suite script file " \
            "\"all.eagle\", resource leaks will probably not be reported.\n"]
      }
    }
  }

  #############################################################################

  #
  # NOTE: Set the local root directory of the source checkout (i.e. of Eagle
  #       or whatever project the Eagle binaries are being used by) using a
  #       Fossil binary in the PATH, if available.  This block now requires
  #       the "Eagle.Test.Constraints" package.
  #
  if {![info exists root_path]} then {
    #
    # NOTE: Is the use of Fossil by the test suite allowed?
    #
    if {[canExecFossil]} then {
      set pattern {^local-root:\s+(.*?)$}

      if {[catch {
        execFossilCommand \
            [expr {[info exists path] ? $path : $test_path}] info
      } exec] || ![regexp -line -- $pattern $exec dummy directory]} then {
        #
        # NOTE: We could not query local root directory of the source
        #       checkout from Fossil; therefore, attempt to make an
        #       educated guess.  This value will probably be wrong for
        #       any project(s) other than Eagle.  In that case, this
        #       value should be overridden by that project to reflect
        #       the actual local root directory of the source checkout
        #       for that project.
        #
        set root_path $base_path
      } else {
        #
        # NOTE: We extracted the local root directory of the source
        #       checkout from Fossil.  Now, make sure it is fully
        #       normalized and has no trailing slashes.  Also, make
        #       sure and remove any trailing newline "just in case"
        #       the regular expression engine included it.
        #
        set root_path [file normalize [string trim $directory]]
      }

      unset -nocomplain directory dummy exec pattern
    } else {
      #
      # NOTE: Use of Fossil by the test suite is forbidden.  Fallback
      #       to using the base path.
      #
      set root_path $base_path
    }
  }

  #############################################################################

  #
  # NOTE: If command line arguments were supplied, process them now.
  #
  set test_flags(-suite) ""; # test suite name, default to empty.
  set test_flags(-machine) ""; # machine architecture, default to empty.
  set test_flags(-platform) ""; # build platform, default to empty.
  set test_flags(-configuration) ""; # build configuration, default to empty.
  set test_flags(-namePrefix) ""; # test name prefix, default to empty.
  set test_flags(-suffix) ""; # build suffix, default to empty.
  set test_flags(-file) [list *.eagle]; # default to running all test files.
  set test_flags(-notFile) [list l.*.eagle]; # COMPAT: Tcl.
  set test_flags(-startFile) [list]; # start running at these test files.
  set test_flags(-stopFile) [list]; # stop running after these test files.
  set test_flags(-match) [list *]; # default to running all tests.
  set test_flags(-skip) [list]; # default to skipping no tests.
  set test_flags(-constraints) [list]; # default to no manual constraints.
  set test_flags(-verbose) ""; # default to pass, body, skip, start, error.
  set test_flags(-logPath) ""; # default to using standard log file path.
  set test_flags(-logId) ""; # default to using no log identifier.
  set test_flags(-logFile) ""; # default to using standard log file naming.
  set test_flags(-threshold) ""; # default to requiring all tests to pass.
  set test_flags(-randomOrder) ""; # default to deterministic order.
  set test_flags(-uncountedLeaks) [list]; # defaults for uncounted resources.
  set test_flags(-listedLeaks) [list]; # defaults for listed resources.
  set test_flags(-breakOnLeak) ""; # default to continue on leak.
  set test_flags(-stopOnFailure) ""; # default to continue on failure.
  set test_flags(-stopOnLeak) ""; # default to continue on leak.
  set test_flags(-exitOnComplete) ""; # default to not exit after complete.
  set test_flags(-preTest) ""; # default to not evaluating anything.
  set test_flags(-postTest) ""; # default to not evaluating anything.
  set test_flags(-preWait) ""; # default to not waiting.
  set test_flags(-postWait) ""; # default to not waiting.
  set test_flags(-tclsh) ""; # Tcl shell, default to empty.
  set test_flags(-bad) [list]; # these are the unrecognized arguments.
  set test_flags(-no) [list]; # default to not having any restrictions.

  #
  # NOTE: Check for and process any command line arguments.
  #
  if {[info exists argv]} then {
    set test_flags(-bad) [eval processTestArguments test_flags false $argv]

    if {[info exists test_flags(-no)] && \
        [string length $test_flags(-no)] > 0} then {
      #
      # NOTE: Set the test run restrictions based on the provided command line
      #       argument value (which is assumed to be a "dictionary-style" list
      #       containing name/value pairs to add to the global "no" array).
      #
      foreach {name value} $test_flags(-no) {
        set no($name) $value
      }

      unset -nocomplain name value
    }

    if {[info exists test_flags(-logPath)] && \
        [string length $test_flags(-logPath)] > 0} then {
      #
      # NOTE: Set the log path to the one provided by the command line.
      #
      set test_log_path $test_flags(-logPath)
    }

    if {[info exists test_flags(-logId)] && \
        [string length $test_flags(-logId)] > 0} then {
      #
      # NOTE: Set the log identifier to the one provided by the command line.
      #
      set test_log_id $test_flags(-logId)
    }

    if {[info exists test_flags(-logFile)] && \
        [string length $test_flags(-logFile)] > 0} then {
      #
      # NOTE: Set the log file name to the one provided by the command line.
      #
      set test_log $test_flags(-logFile)
    }

    if {[info exists test_flags(-threshold)] && \
        [string is integer -strict $test_flags(-threshold)]} then {
      #
      # NOTE: Set the test pass threshold to the one provided by the command
      #       line.
      #
      set test_threshold $test_flags(-threshold)
    }

    if {[info exists test_flags(-randomOrder)] && \
        [string is boolean -strict $test_flags(-randomOrder)]} then {
      #
      # NOTE: Set the test random-order flag to the one provided by the
      #       command line.
      #
      set test_random_order $test_flags(-randomOrder)
    }

    if {[info exists test_flags(-uncountedLeaks)] && \
        [string length $test_flags(-uncountedLeaks)] > 0} then {
      #
      # NOTE: Set the test uncounted leaks "list" to the one provided by
      #       the command line.  We should probably use [string is list]
      #       here; however, that is not available until native Tcl 8.5.
      #
      set test_uncounted_leaks $test_flags(-uncountedLeaks)
    }

    if {[info exists test_flags(-listedLeaks)] && \
        [string length $test_flags(-listedLeaks)] > 0} then {
      #
      # NOTE: Set the test listed leaks "list" to the one provided by
      #       the command line.  We should probably use [string is list]
      #       here; however, that is not available until native Tcl 8.5.
      #
      set test_listed_leaks $test_flags(-listedLeaks)
    }

    if {[info exists test_flags(-breakOnLeak)] && \
        [string is boolean -strict $test_flags(-breakOnLeak)]} then {
      #
      # NOTE: Set the test break-on-leak flag to the one provided by the
      #       command line.
      #
      set test_break_on_leak $test_flags(-breakOnLeak)
    }

    if {[info exists test_flags(-stopOnFailure)] && \
        [string is boolean -strict $test_flags(-stopOnFailure)]} then {
      #
      # NOTE: Set the test stop-on-failure flag to the one provided by the
      #       command line.
      #
      set test_stop_on_failure $test_flags(-stopOnFailure)
    }

    if {[info exists test_flags(-stopOnLeak)] && \
        [string is boolean -strict $test_flags(-stopOnLeak)]} then {
      #
      # NOTE: Set the test stop-on-leak flag to the one provided by the
      #       command line.
      #
      set test_stop_on_leak $test_flags(-stopOnLeak)
    }

    if {[info exists test_flags(-exitOnComplete)] && \
        [string is boolean -strict $test_flags(-exitOnComplete)]} then {
      #
      # NOTE: Set the test exit-on-complete flag to the one provided by the
      #       command line.
      #
      set test_exit_on_complete $test_flags(-exitOnComplete)
    }

    if {[info exists test_flags(-preTest)] && \
        [string length $test_flags(-preTest)] > 0} then {
      #
      # NOTE: Set the pre-test script to the one provided by the command line.
      #
      set test_script(pre) $test_flags(-preTest)
    }

    if {[info exists test_flags(-postTest)] && \
        [string length $test_flags(-postTest)] > 0} then {
      #
      # NOTE: Set the pre-test script to the one provided by the command line.
      #
      set test_script(post) $test_flags(-postTest)
    }

    if {[info exists test_flags(-preWait)] && \
        [string is integer -strict $test_flags(-preWait)]} then {
      #
      # NOTE: Set the specified wait (in milliseconds) before each file.
      #
      set test_wait(pre) $test_flags(-preWait)
    }

    if {[info exists test_flags(-postWait)] && \
        [string is integer -strict $test_flags(-postWait)]} then {
      #
      # NOTE: Set the specified wait (in milliseconds) after each file.
      #
      set test_wait(post) $test_flags(-postWait)
    }
  }

  #
  # NOTE: Set the default test suite name, if necessary.
  #
  if {![info exists test_suite]} then {
    set test_suite [getTestSuite]
  }

  #
  # NOTE: Set the default test machine (e.g. amd64, intel, etc), if necessary.
  #
  if {![info exists test_machine]} then {
    set test_machine [getTestMachine]
  }

  #
  # NOTE: Set the default test platform (e.g. x86, x64, etc), if necessary.
  #
  if {![info exists test_platform]} then {
    set test_platform [getTestPlatform]
  }

  #
  # NOTE: Set the default test configuration (i.e. Debug or Release), if
  #       necessary.
  #
  if {![info exists test_configuration]} then {
    set test_configuration [getPlatformInfo configuration Release]
  }

  #
  # NOTE: Set the name prefix used for some tests, if necessary.
  #
  if {![info exists test_name_prefix]} then {
    set test_name_prefix ""
  }

  #
  # NOTE: Has automatic log file naming been disabled?
  #
  if {![info exists no(logFileName)]} then {
    #
    # NOTE: Set the log to use for test output, if necessary.
    #
    if {![info exists test_log]} then {
      set test_log [getDefaultTestLog]
    }
  }

  #############################################################################

  #
  # NOTE: Has native Tcl shell detection and use been disabled?
  #
  if {![info exists no(tclsh)]} then {
    #
    # NOTE: By default, disable raw output when using the native Tcl
    #       shell within the test suite.
    #
    if {![info exists test_tclsh_raw]} then {
      set test_tclsh_raw false
    }

    #
    # NOTE: By default, disable verbose output when using the native
    #       Tcl shell within the test suite.
    #
    if {![info exists test_tclsh_verbose]} then {
      set test_tclsh_verbose 0
    }

    #
    # NOTE: Set the Tcl shell executable to use for those specialized
    #       tests that may require it, if necessary.
    #
    if {![info exists test_tclsh]} then {
      #
      # NOTE: When running in Eagle, more complex logic is required to
      #       determine the native Tcl shell to use for the various tests
      #       that require it.  Also, this same logic is used with Tcl
      #       when it is not running from an instance of the Tcl shell
      #       executable.
      #
      if {[isEagle] || ![string match tclsh* $bin_file]} then {
        if {[info exists test_flags(-tclsh)] && \
            [string length $test_flags(-tclsh)] > 0} then {
          #
          # NOTE: Use the native Tcl shell specified via the command line.
          #
          set test_tclsh $test_flags(-tclsh)
        } else {
          if {[canExecTclShell] && \
              ![info exists no(getTclShellFileName)]} then {
            #
            # NOTE: Attempt to automatically select the native Tcl shell
            #       to use.
            #
            if {![info exists no(warningForTclShell)] && \
                ![info exists no(automaticTclShell)] && \
                ![haveConstraint quiet]} then {
              tputs $test_channel \
                  "==== WARNING: attempting automatic Tcl shell selection...\n"
            }

            set test_tclsh [getTclShellFileName \
                [expr {![info exists no(automaticTclShell)]}] \
                [expr {![info exists no(tclKit)]}] \
                [expr {[info exists test_machine] ? $test_machine : ""}]]
          } else {
            #
            # NOTE: Skip detection and use the fallback default.
            #
            set test_tclsh tclsh
          }
        }
      } else {
        set test_tclsh $bin_file
      }
    }
  }

  #
  # NOTE: When running in Eagle, check for any non-core plugins loaded into
  #       the interpreter and issue warnings if any are found.  The warning
  #       may be used to explain subsequent test failures due to the extra
  #       plugins being loaded (i.e. there are some tests are sensitive to
  #       having "unexpected" plugins loaded).
  #
  if {[isEagle] && \
      ![info exists no(warningForPlugin)] && \
      ![haveConstraint quiet]} then {
    foreach loaded [info loaded] {
      #
      # HACK: This code assumes that all plugins in the "Eagle._Plugins"
      #       namespace belong to the Eagle core library itself.
      #
      if {![string match Eagle._Plugins.* [lindex $loaded 1]]} then {
        tputs $test_channel [appendArgs \
            "==== WARNING: extra plugin found: " $loaded \n]
      }
    }

    unset -nocomplain loaded
  }

  #
  # NOTE: Show both the pre-test and post-test scripts now, prior to actually
  #       evaluating either of them (even if their use has been disabled).
  #
  tputs $test_channel [appendArgs "---- pre-test script: " \
      [expr {[info exists test_script(pre)] && \
      [string length $test_script(pre)] > 0 ? \
      [appendArgs \" $test_script(pre) \"] : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- post-test script: " \
      [expr {[info exists test_script(post)] && \
      [string length $test_script(post)] > 0 ? \
      [appendArgs \" $test_script(post) \"] : "<none>"}] \n]

  #
  # NOTE: Show both the pre-test and post-test waits now, prior to actually
  #       using either of them (even if their use has been disabled).
  #
  tputs $test_channel [appendArgs "---- pre-test wait: " \
      [expr {[info exists test_wait(pre)] && \
      [string is integer -strict $test_wait(pre)] ? \
      [appendArgs $test_wait(pre) " milliseconds"] : \
      "<none>"}] \n]

  tputs $test_channel [appendArgs "---- post-test wait: " \
      [expr {[info exists test_wait(post)] && \
      [string is integer -strict $test_wait(post)] ? \
      [appendArgs $test_wait(post) " milliseconds"] : \
      "<none>"}] \n]

  #
  # NOTE: Are we being prevented from evaluating the "pre-test" script?
  #
  if {![info exists no(preTest)]} then {
    #
    # NOTE: Evaluate the specified pre-test script now, if any.
    #
    if {[info exists test_script(pre)] && \
        [string length $test_script(pre)] > 0} then {
      #
      # TODO: Perhaps use [uplevel] here instead of [eval].  For now, it does
      #       not matter since we enforce this file being evaluated at the
      #       top-level.
      #
      if {[catch $test_script(pre) test_script(pre,result)]} then {
        #
        # NOTE: Make 100% sure, even in "quiet" mode, that this script error
        #       gets into the test log file.
        #
        tputs $test_channel [appendArgs "---- pre-test script error: " \
            $test_script(pre,result) \n]

        #
        # NOTE: The pre-test script failed in some way.  This is considered
        #       to be an overall failure of the test suite; therefore, raise
        #       the error now that we are sure it has been recorded in the
        #       test log file.
        #
        unset -nocomplain test_suite_running
        error $test_script(pre,result)
      }
    }
  }

  #
  # NOTE: Check for and process any custom test prologue script that may
  #       be set in the environment.  This must be done after the Eagle
  #       test package has been made available and after the log file has
  #       been setup.
  #
  sourceIfValid prologue [getEnvironmentVariable testPrologue]

  #
  # NOTE: If there is an existing test log file, make sure it contains a
  #       test log start sentry -AND- that its contained test log start
  #       sentry matches the current (in-memory) test log start sentry.
  #
  if {[info exists test_log] && [file exists $test_log]} then {
    set old_test_run_id [readTestLogStartSentry $test_log]

    if {[string length $old_test_run_id] > 0} then {
      #
      # NOTE: At this point, everything MAY be fine, i.e. if the test log
      #       sentry was read from the test log file -AND- it matches the
      #       one currently in-memory; otherwise, we have a problem.
      #
      if {![info exists test_run_id] || \
          $test_run_id ne $old_test_run_id} then {
        #
        # HACK: Generally, this is a fairly serious warning.  It probably
        #       means the operating system (re?)used a process identifier
        #       and that there was already existed an associated test log
        #       file from a previous test run.  This has been observed to
        #       occur on fully patched Windows 7.
        #
        if {[info exists test_run_id]} then {
          tputs $test_channel [appendArgs \
              "==== WARNING: read mismatched test log start sentry, " \
              "was \"" $old_test_run_id "\", now \"" $test_run_id \"\n]
        } else {
          tputs $test_channel [appendArgs \
              "==== WARNING: read stale test log start sentry \"" \
              $old_test_run_id \"\n]
        }
      }
    } else {
      #
      # NOTE: There is an existing test log file without any start
      #       sentry?  Eventually, this will cause the test run to
      #       fail.
      #
      tputs $test_channel \
          "==== WARNING: could not read test log start sentry\n"
    }

    unset -nocomplain old_test_run_id
  }

  #
  # NOTE: Show the name of the executable and the command line arguments,
  #       if any.  This must be done after the log file has been setup;
  #       otherwise, this information will not be visible in the log file.
  #
  if {![info exists test_run_id]} then {
    set test_run_id [getNewTestRunId]
  }

  tputs $test_channel [appendArgs "---- testRunId: " \
      [expr {[info exists test_run_id] ? \
          $test_run_id : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- testRunBucket: " \
      [expr {[info exists test_run_bucket] ? \
          $test_run_bucket : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- processId: " \
      [pid] \n]

  set ppid(0) [catch {info ppid} ppid(1)]

  tputs $test_channel [appendArgs "---- parentProcessId: " \
      [expr {$ppid(0) == 0 ? \
          $ppid(1) : "<none>"}] \n]

  unset ppid

  tputs $test_channel [appendArgs "---- test suite: " \
      [expr {[info exists test_suite] ? \
          $test_suite : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- test channel: " \
      $test_channel \n]

  tputs $test_channel [appendArgs "---- test host: " \
      [expr {[info exists test_host] ? \
          $test_host : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- test port: " \
      [expr {[info exists test_port] ? \
          $test_port : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- test short timeout: " \
      [expr {[info exists test_timeout] ? \
          $test_timeout : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- test join timeout: " \
      [expr {[info exists test_join_timeout] ? \
          $test_join_timeout : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- test stress count: " \
      [expr {[info exists test_stress_count] ? \
          $test_stress_count : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- test machine: " \
      [expr {[info exists test_machine] ? \
          $test_machine : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- test platform: " \
      [expr {[info exists test_platform] ? \
          $test_platform : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- test configuration: " \
      [expr {[info exists test_configuration] ? \
          $test_configuration : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- test name prefix: " \
      [expr {[info exists test_name_prefix] ? \
          $test_name_prefix : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- test suffix: " \
      [expr {[info exists test_suffix] ? \
          $test_suffix : "<none>"}] \n]

  if {[isEagle]} then {
    tputs $test_channel [appendArgs "---- original command line: " \
        [info cmdline] \n]

    tputs $test_channel [appendArgs "---- threadId: " \
        [info tid] \n]

    tputs $test_channel [appendArgs "---- processors: " \
        [info processors] \n]

    if {[llength [info commands object]] > 0} then {
      set encoding(0) [catch {
        object invoke Console.InputEncoding WebName
      } encoding(1)]
    } else {
      set encoding(0) 0; set encoding(1) unavailable
    }

    tputs $test_channel [appendArgs "---- input encoding: " \
        [expr {$encoding(0) == 0 ? $encoding(1) : "<none>"}] \n]

    if {[llength [info commands object]] > 0} then {
      set encoding(0) [catch {
        object invoke Console.OutputEncoding WebName
      } encoding(1)]
    } else {
      set encoding(0) 0; set encoding(1) unavailable
    }

    tputs $test_channel [appendArgs "---- output encoding: " \
        [expr {$encoding(0) == 0 ? $encoding(1) : "<none>"}] \n]

    unset encoding

    if {![info exists no(showHostQuery)]} then {
      set host(0) [catch {host query} host(1)]

      tputs $test_channel [appendArgs "---- host query: " \
          [formatListAsDict [expr {$host(0) == 0 ? $host(1) : ""}] \
          <none>] \n]

      unset host
    }

    if {![info exists no(showStartingCpu)]} then {
      set cpu(0) [catch {getCpuStatus} cpu(1)]

      tputs $test_channel [appendArgs "---- starting cpu: " \
          [formatListAsDict [expr {$cpu(0) == 0 ? $cpu(1) : ""}] \
          <none>] \n]

      unset cpu
    }

    if {![info exists no(showStartingMemory)]} then {
      set memory(0) [catch {debug memory} memory(1)]

      tputs $test_channel [appendArgs "---- starting memory: " \
          [formatListAsDict [expr {$memory(0) == 0 ? $memory(1) : ""}] \
          <none>] \n]

      unset memory
    }

    if {![info exists no(showStartingStack)]} then {
      set stack(0) [catch {debug stack true} stack(1)]

      tputs $test_channel [appendArgs "---- starting stack: " \
          [formatListAsDict [expr {$stack(0) == 0 ? $stack(1) : ""}] \
          <none>] \n]

      unset stack
    }

    if {![info exists no(showStartingLevels)]} then {
      set levels(0) [catch {debug levels} levels(1)]

      tputs $test_channel [appendArgs "---- starting levels: " \
          [formatListAsDict [expr {$levels(0) == 0 ? $levels(1) : ""}] \
          <none>] \n]

      unset levels
    }

    if {![info exists no(showSystemDrive)]} then {
      set drive(0) [catch {file drive} drive(1)]

      tputs $test_channel [appendArgs "---- system drive: " \
          [formatListAsDict [expr {$drive(0) == 0 ? $drive(1) : ""}] \
          <none>] \n]

      unset drive
    }
  }

  tputs $test_channel [appendArgs "---- executable: \"" \
      $bin_file \"\n]

  tputs $test_channel [appendArgs "---- command line: " \
      [expr {[info exists argv] && [string length $argv] > 0 ? \
          $argv : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- unrecognized arguments: " \
      [expr {[info exists test_flags(-bad)] && \
          [string length $test_flags(-bad)] > 0 ? \
              $test_flags(-bad) : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- extra paths: " \
      [expr {[info exists test_extra_paths] && \
          [llength $test_extra_paths] > 0 ? \
              $test_extra_paths : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- logging path: " \
      [expr {[info exists test_log_path] && \
          [string length $test_log_path] > 0 ? \
              [appendArgs \" $test_log_path \"] : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- logging identifier: " \
      [expr {[info exists test_log_id] && \
          [string length $test_log_id] > 0 ? \
              [appendArgs \" $test_log_id \"] : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- logging to: " \
      [expr {[info exists test_log] && [string length $test_log] > 0 ? \
          [appendArgs \" $test_log \"] : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- pass threshold: " \
      [expr {[info exists test_threshold] && \
          [string is integer -strict $test_threshold] ? \
              [appendArgs $test_threshold %] : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- random order: " \
      [expr {[info exists test_random_order] && \
          [string is boolean -strict $test_random_order] ? \
              $test_random_order : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- uncounted leaks: " \
      [expr {[info exists test_uncounted_leaks] && \
          [string length $test_uncounted_leaks] > 0 ? \
              $test_uncounted_leaks : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- listed leaks: " \
      [expr {[info exists test_listed_leaks] && \
          [string length $test_listed_leaks] > 0 ? \
              $test_listed_leaks : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- break on leak: " \
      [expr {[info exists test_break_on_leak] && \
          [string is boolean -strict $test_break_on_leak] ? \
              $test_break_on_leak : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- stop on failure: " \
      [expr {[info exists test_stop_on_failure] && \
          [string is boolean -strict $test_stop_on_failure] ? \
              $test_stop_on_failure : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- stop on leak: " \
      [expr {[info exists test_stop_on_leak] && \
          [string is boolean -strict $test_stop_on_leak] ? \
              $test_stop_on_leak : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- exit on complete: " \
      [expr {[info exists test_exit_on_complete] && \
          [string is boolean -strict $test_exit_on_complete] ? \
              $test_exit_on_complete : "<none>"}] \n]

  #
  # NOTE: Show the information about which tests and files are being run
  #       and/or skipped (COMPAT: Tcl).
  #
  tputs $test_channel [appendArgs "---- running test files that match: " \
      [expr {[info exists test_flags(-file)] && \
          [llength $test_flags(-file)] > 0 ? \
              $test_flags(-file) : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- skipping test files that match: " \
      [expr {[info exists test_flags(-notFile)] && \
          [llength $test_flags(-notFile)] > 0 ? \
              $test_flags(-notFile) : "<none>"}] \n]

  tputs $test_channel [appendArgs \
      "---- starting with test files that match: " \
      [expr {[info exists test_flags(-startFile)] && \
          [llength $test_flags(-startFile)] > 0 ? \
              $test_flags(-startFile) : "<none>"}] \n]

  tputs $test_channel [appendArgs \
      "---- stopping after test files that match: " \
      [expr {[info exists test_flags(-stopFile)] && \
          [llength $test_flags(-stopFile)] > 0 ? \
              $test_flags(-stopFile) : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- running tests that match: " \
      [expr {[info exists test_flags(-match)] && \
          [llength $test_flags(-match)] > 0 ? \
              $test_flags(-match) : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- skipping tests that match: " \
      [expr {[info exists test_flags(-skip)] && \
          [llength $test_flags(-skip)] > 0 ? \
              $test_flags(-skip) : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- verbosity level for tests: " \
      [expr {[info exists test_flags(-verbose)] && \
          [string length $test_flags(-verbose)] > 0 ? \
              $test_flags(-verbose) : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- path: " \
      [expr {[info exists path] && [string length $path] > 0 ? \
          [appendArgs \" $path \"] : "<none>"}] \n]

  tputs $test_channel [appendArgs "---- base path: \"" \
      $base_path \"\n]

  tputs $test_channel [appendArgs "---- key path: \"" \
      $key_path \"\n]

  tputs $test_channel [appendArgs "---- root path: \"" \
      $root_path \"\n]

  tputs $test_channel [appendArgs "---- binary path: \"" \
      $bin_path \"\n]

  tputs $test_channel [appendArgs "---- library path: \"" \
      $lib_path \"\n]

  tputs $test_channel [appendArgs "---- core binary path: \"" \
      $core_bin_path \"\n]

  tputs $test_channel [appendArgs "---- core library path: \"" \
      $core_lib_path \"\n]

  tputs $test_channel [appendArgs "---- test home path: \"" \
      $test_home_path \"\n]

  tputs $test_channel [appendArgs "---- test package files located in: \"" \
      $test_package_path \"\n]

  tputs $test_channel [appendArgs "---- test suite files located in: \"" \
      $test_all_path \"\n]

  tputs $test_channel [appendArgs "---- test script files located in: \"" \
      $test_path \"\n]

  tputs $test_channel [appendArgs "---- test data files located in: \"" \
      $test_data_path \"\n]

  tputs $test_channel [appendArgs "---- running in: \"" \
      [pwd] \"\n]

  tputs $test_channel [appendArgs "---- temporary files stored in: \"" \
      [getTemporaryPath] \"\n]

  tputs $test_channel [appendArgs "---- native Tcl shell: " \
      [expr {[info exists test_tclsh] && [string length $test_tclsh] > 0 ? \
          [appendArgs \" $test_tclsh \"] : "<none>"}] \n]

  tputs $test_channel [appendArgs \
      "---- raw mode for native Tcl shell: " [expr {[info exists \
          test_tclsh_raw] && [string length $test_tclsh_raw] > 0 ? \
          $test_tclsh_raw : "<none>"}] \n]

  tputs $test_channel [appendArgs \
      "---- verbosity level for native Tcl shell: " [expr {[info exists \
          test_tclsh_verbose] && [string length $test_tclsh_verbose] > 0 ? \
          $test_tclsh_verbose : "<none>"}] \n]

  if {![info exists no(showDisabledOptions)]} then {
    tputs $test_channel [appendArgs "---- disabled options: " \
        [formatList [lsort [array names no]] <none>] \n]
  }

  if {![info exists no(showRuntimeOptions)]} then {
    if {[isEagle]} then {
      tputs $test_channel [appendArgs "---- runtime options: " \
          [formatList [lsort [info engine RuntimeOptions]] <none>] \n]
    } else {
      tputs $test_channel [appendArgs "---- runtime options: " \
          [formatList [lsort [expr {[info exists \
          eagle_platform(runtimeOptions)] ? \
          $eagle_platform(runtimeOptions) : [list]}]] <none>] \n]
    }
  }

  #
  # NOTE: Is the use of Fossil by the test suite allowed?
  #
  if {[canExecFossil]} then {
    #
    # NOTE: Get the source checkout and tags (i.e. of Eagle or whatever
    #       project the Eagle binaries are being used by) using a Fossil
    #       binary in the PATH, if available.
    #
    if {[catch {
      execFossilCommand \
          [expr {[info exists path] ? $path : $test_path}] info
    } exec] == 0} then {
      set pattern {^checkout:\s+(.*?)$}

      if {[regexp -line -- $pattern $exec dummy checkout]} then {
        #
        # NOTE: Remove any trailing newline.
        #
        set checkout [string trim $checkout]

        if {![info exists no(setRepositoryCheckout)]} then {
          set test_repository_checkout $checkout
        }
      } else {
        #
        # NOTE: We could not query the source checkout from Fossil.
        #
        set checkout <none>

        if {![info exists no(setRepositoryCheckout)]} then {
          set test_repository_checkout ""
        }
      }

      set pattern {^tags:\s+(.*?)$}

      if {[regexp -line -- $pattern $exec dummy tags]} then {
        #
        # NOTE: Remove any trailing newline.
        #
        set tags [string trim $tags]

        if {![info exists no(setRepositoryTags)]} then {
          set test_repository_tags $tags
        }
      } else {
        #
        # NOTE: We could not query the tags from Fossil.
        #
        set tags <none>

        if {![info exists no(setRepositoryTags)]} then {
          set test_repository_tags ""
        }
      }
    } else {
      #
      # NOTE: We could not query information from Fossil.
      #
      set checkout <none>

      if {![info exists no(setRepositoryCheckout)]} then {
        set test_repository_checkout $checkout
      }

      set tags <none>

      if {![info exists no(setRepositoryTags)]} then {
        set test_repository_tags ""
      }
    }

    unset -nocomplain dummy exec pattern
  } else {
    #
    # NOTE: Use of Fossil by the test suite is forbidden.
    #
    set checkout <none>
    set tags <none>
  }

  tputs $test_channel [appendArgs "---- checkout: " \
      $checkout \n]

  tputs $test_channel [appendArgs "---- tags: " \
      $tags \n]

  unset tags checkout

  #
  # NOTE: Initialize the Eagle test constraints.
  #
  if {[isEagle]} then {
    #
    # NOTE: *WARNING* This has the effect of removing test constraints
    #       added prior to this point.
    #
    initializeTests; configureTcltest "" [list] [list] [list] [list] false

    #
    # NOTE: If the "no(mono)" variable is set (to anything) then any
    #       special test suite hacks for Mono will be disabled. This
    #       does not control or change any hacks for Mono that may
    #       be present in the library itself.
    #
    # if {[isMono]} then {
    #   set no(mono) true
    # }

    ###########################################################################
    ######################### BEGIN Eagle Constraints #########################
    ###########################################################################

    tputs $test_channel \
        "---- start of Eagle specific test constraints...\n"

    #
    # NOTE: Check various Unicode character categories against
    #       the official standard (and the non-standard values
    #       that were used in previous versions of .NET).
    #
    if {![info exists no(unicodeCategory)]} then {
      checkForUnicodeCategory $test_channel \u0009 Cc; # "HT"
      checkForUnicodeCategory $test_channel \u00A7 So; # "SECT"
      checkForUnicodeCategory $test_channel \u00A7 Po; # "SECT"
      checkForUnicodeCategory $test_channel \u00AA Ll; # "ORDF"
      checkForUnicodeCategory $test_channel \u00AA Lo; # "ORDF"
      checkForUnicodeCategory $test_channel \u00AD Pd; # "SHY"
      checkForUnicodeCategory $test_channel \u00AD Cf; # "SHY"
      checkForUnicodeCategory $test_channel \u00B6 So; # "PARA"
      checkForUnicodeCategory $test_channel \u00B6 Po; # "PARA"
      checkForUnicodeCategory $test_channel \u00BA Ll; # "ORDM"
      checkForUnicodeCategory $test_channel \u00BA Lo; # "ORDM"
    }

    #
    # NOTE: Do [interp cancel] and [interp resetcancel] support
    #       the -global option?
    #
    if {![info exists no(globalTip285)]} then {
      checkForGlobalTip285 $test_channel
    }

    #
    # NOTE: *WARNING* Has quiet testing support been disabled?
    #       Please do not move this "quietness" test constraint
    #       check as subsequent test constraints may rely on it
    #       when determining if a warning should be emitted.
    #
    if {![info exists no(quiet)]} then {
      #
      # NOTE: For tests "basic-1.36", "benchmark-1.*", "debug-1.3",
      #       "debug-1.4.*", "glob-99.*", "object-10.*", "perf-2.2",
      #       and various other places within the test suite code
      #       itself.
      #
      checkForQuiet $test_channel false
    }

    #
    # NOTE: Has administrator detection support been disabled?  We do
    #       this check [nearly] first as it may [eventually] be used
    #       to help determine if other constraints should be skipped.
    #
    if {![info exists no(administrator)]} then {
      checkForAdministrator $test_channel
    }

    #
    # NOTE: Has host detection support been disabled?
    #
    if {![info exists no(host)]} then {
      checkForHost $test_channel
    }

    #
    # NOTE: Has host type detection support been disabled?
    #
    if {![info exists no(hostType)]} then {
      checkForHostType $test_channel
    }

    #
    # NOTE: Has primary thread detection support been disabled?  We do
    #       this check [nearly] first as it may [eventually] be used
    #       to help determine if other constraints should be skipped.
    #
    if {![info exists no(primaryThread)]} then {
      checkForPrimaryThread $test_channel
    }

    #
    # NOTE: Has default application domain detection support been
    #       disabled?  We do this check [nearly] first as it may
    #       [eventually] be used to help determine if other
    #       constraints should be skipped.
    #
    if {![info exists no(defaultAppDomain)]} then {
      checkForDefaultAppDomain $test_channel
    }

    #
    # NOTE: Has runtime detection support been disabled?  We do this
    #       checking [nearly] first as it may skip other constraints.
    #
    if {![info exists no(runtime)]} then {
      checkForRuntime $test_channel
    }

    #
    # NOTE: Check the variant and/or version of the CLR that we are
    #       currently running on.
    #
    if {![info exists no(checkForRuntimeVersion)]} then {
      checkForRuntimeVersion $test_channel
    }

    #
    # NOTE: Check the variant and/or build of the CLR that we are
    #       currently running on.
    #
    if {![info exists no(checkForRuntimeBuild)]} then {
      checkForRuntimeBuild $test_channel
    }

    #
    # NOTE: Check the framework version (i.e. regardless of runtime) that
    #       we are currently running on.
    #
    if {![info exists no(frameworkVersion)]} then {
      checkForFrameworkVersion $test_channel
    }

    #
    # NOTE: Check the image runtime version (i.e. the runtime version that
    #       this assembly compiled against).
    #
    if {![info exists no(imageRuntimeVersion)]} then {
      checkForImageRuntimeVersion $test_channel
    }

    #
    # NOTE: Check if the image runtime version matches the framework.
    #
    if {![info exists no(matchingFrameworkVersion)]} then {
      checkForMatchingFrameworkVersion $test_channel
    }

    #
    # NOTE: Has process bits detection support been disabled?
    #
    if {![info exists no(processBits)]} then {
      checkForProcessBits $test_channel
    }

    #
    # NOTE: Has machine detection support been disabled?
    #
    if {![info exists no(machine)]} then {
      checkForMachine $test_channel 32 intel; # (i.e. x86)
      checkForMachine $test_channel 32 arm;   # (i.e. arm)
      checkForMachine $test_channel 64 ia64;  # (i.e. itanium)
      checkForMachine $test_channel 64 amd64; # (i.e. x64)
      checkForMachine $test_channel 64 arm64; # (i.e. arm64)
    }

    #
    # NOTE: Has test suite call stack probing been disabled?
    #
    if {![info exists no(testCallStack)]} then {
      checkForTestCallStack $test_channel
    }

    #
    # NOTE: Has culture detection support been disabled?
    #
    if {![info exists no(culture)]} then {
      checkForCulture $test_channel
    }

    #
    # NOTE: Has thread culture detection support been disabled?
    #
    if {![info exists no(threadCulture)]} then {
      checkForThreadCulture $test_channel
    }

    #
    # NOTE: Has security detection support been disabled?
    #
    if {![info exists no(security)]} then {
      checkForSecurity $test_channel
    }

    #
    # NOTE: Has Guru testing support been disabled?
    #
    if {![info exists no(guru)]} then {
      if {![info exists no(checkForGuru)]} then {
        checkForGuru $test_channel null
      }

      if {![info exists no(disableGuru)]} then {
        checkForGuru $test_channel false
      }
    }

    #
    # NOTE: Has IEEE 754 (2008?) testing support been disabled?
    #
    if {![info exists no(ieee754r2008)]} then {
      checkForIeee754r2008 $test_channel
    }

    #
    # NOTE: Has software update trust detection support been disabled?
    #
    if {![info exists no(softwareUpdate)]} then {
      checkForSoftwareUpdateTrust $test_channel
    }

    #
    # NOTE: Has library assembly name detection support been disabled?
    #
    if {![info exists no(libraryAssemblyName)]} then {
      checkForLibraryAssemblyName $test_channel
    }

    #
    # NOTE: Has strong name detection support been disabled?
    #
    if {![info exists no(strongName)]} then {
      checkForStrongName $test_channel
    }

    #
    # NOTE: Has strong name key detection been disabled?
    #
    if {![info exists no(strongNameKey)]} then {
      checkForStrongNameKey $test_channel
    }

    #
    # NOTE: Has certificate detection support been disabled?
    #
    if {![info exists no(certificate)]} then {
      checkForCertificate $test_channel
    }

    #
    # NOTE: Has database testing support been disabled?
    #
    if {![info exists no(core)] && ![info exists no(database)]} then {
      #
      # NOTE: Set the server name, if necessary.
      #
      if {![info exists server]} then {
        set server .
      }

      #
      # NOTE: Set the database name, if necessary.
      #
      if {![info exists database]} then {
        #
        # NOTE: Please see "https://urn.to/r/mssql_master" for details.
        #
        set database master; # COMPAT: Microsoft SQL Server
      }

      #
      # NOTE: Set the connection timeout, if necessary.
      #
      if {![info exists timeout]} then {
        set timeout [expr {$test_timeout / 1000}]; # milliseconds to seconds.
      }

      #
      # NOTE: Set the test user name, if necessary.
      #
      if {![info exists user]} then {
        set user [getEnvironmentVariable user]
      }

      #
      # NOTE: Set the test password, if necessary.
      #
      if {![info exists password]} then {
        set password [getEnvironmentVariable password]
      }

      #
      # NOTE: Set the test database connection type, if necessary.
      #
      if {![info exists test_database_type]} then {
        #
        # NOTE: Use the default database connection type.
        #
        set test_database_type Sql; # TODO: Good test default?
      }

      #
      # NOTE: Set the test database connection string, if necessary.
      #
      if {![info exists test_database]} then {
        #
        # NOTE: Mono does not have support for "trusted connections";
        #       therefore, we must emit a different connection string
        #       when running there.
        #
        set test_database [subst \
            {Data Source=${server};Initial Catalog=${database};Connect\
            Timeout=${timeout};[expr {[isMono] ? [subst \
            {User Id=${user};Password=${password};}] : {Integrated\
            Security=SSPI;}}]}]; # NOTE: Microsoft SQL Server specific.
      } elseif {[info exists test_database_subst]} then {
        #
        # NOTE: The test database connection string must be dynamically
        #       post-processed using [subst], per request.  This allows
        #       the [custom] test database connection string to contain
        #       references to the other test database variables setup
        #       by this test prologue.
        #
        set test_database [subst $test_database]
      }

      #
      # NOTE: Set the test database table, if necessary.
      #
      if {![info exists test_database_table]} then {
        #
        # NOTE: Use the default database table.
        #
        set test_database_table eagle_sql_test_ok_to_delete
      }

      #
      # NOTE: Can we access the configured test database?
      #
      checkForDatabase $test_channel $test_database_type $test_database

      unset password user timeout database server
    }

    #
    # NOTE: Has symbol testing support been disabled?
    #
    if {![info exists no(assemblySymbols)]} then {
      checkForSymbols $test_channel [lindex [info assembly] end] assembly
    }

    #
    # NOTE: Has object handle reference count tracking support been disabled
    #       (at compile-time)?
    #
    if {![info exists no(referenceCounts)]} then {
      #
      # NOTE: For tests "excel-*", "object-2.*", "object-7.1", "object-8.*",
      #       and "object-98.*".
      #
      checkForReferenceCountTracking $test_channel
    }

    #
    # NOTE: Has build type testing support been disabled?
    #
    if {![info exists no(buildTypes)]} then {
      #
      # NOTE: Has "known" build type testing support been disabled?
      #
      if {![info exists no(knownBuildTypes)]} then {
        #
        # NOTE: Check for all "known" compile options.
        #
        checkForKnownBuildTypes $test_channel
      } else {
        #
        # NOTE: Nothing is currently done here.  All supported build
        #       types are considered "well-known".
        #
      }
    }

    #
    # NOTE: Has compile/runtime option testing support been disabled?
    #
    if {![info exists no(compileOptions)]} then {
      #
      # NOTE: Has "known" compile option testing support been disabled?
      #
      if {![info exists no(knownCompileOptions)]} then {
        #
        # NOTE: Check for all "known" compile options.
        #
        checkForKnownCompileOptions $test_channel
      } else {
        #
        # NOTE: Has callback queue support been enabled (at compile-time)?
        #
        if {![info exists no(compileCallbackQueue)]} then {
          #
          # NOTE: For tests "basic-1.54" and "commands-1.4".
          #
          checkForCompileOption $test_channel CALLBACK_QUEUE
        }

        #
        # NOTE: Has legacy CAS policy support been enabled (at compile-time)?
        #
        if {![info exists no(compileCasPolicy)]} then {
          #
          # NOTE: For tests "load-1.6" and "load-1.7".
          #
          checkForCompileOption $test_channel CAS_POLICY
        }

        #
        # NOTE: Has configuration support been enabled (at compile-time)?
        #
        if {![info exists no(compileConfiguration)]} then {
          #
          # NOTE: For tests "debug-1.3", "object-99.1", "object-11.4",
          #       and "garuda-1.2".
          #
          checkForCompileOption $test_channel CONFIGURATION
        }

        #
        # NOTE: Has console support been enabled (at compile-time)?
        #
        if {![info exists no(compileConsole)]} then {
          #
          # NOTE: For test "host-1.2".
          #
          checkForCompileOption $test_channel CONSOLE
        }

        #
        # NOTE: Has database support been enabled (at compile-time)?
        #
        if {![info exists no(compileData)]} then {
          #
          # NOTE: For tests "sql-1.1" and "upvar-99.1".
          #
          checkForCompileOption $test_channel DATA
        }

        #
        # NOTE: Has script debugger support been enabled (at compile-time)?
        #
        if {![info exists no(compileDebugger)]} then {
          #
          # NOTE: For tests "debug-1.1", "debug-2.1", "debug-3.1",
          #       "debug-4.1", and "proc-2.1".
          #
          checkForCompileOption $test_channel DEBUGGER
        }

        #
        # NOTE: Has script debugger arguments support been enabled (at
        #       compile-time)?
        #
        if {![info exists no(compileDebuggerArguments)]} then {
          #
          # NOTE: For tests "object-5.1.*".
          #
          checkForCompileOption $test_channel DEBUGGER_ARGUMENTS
        }

        #
        # NOTE: Has script arguments stack support been enabled (at
        #       compile-time)?
        #
        if {![info exists no(compileScriptArguments)]} then {
          #
          # NOTE: For test "debug-2.86".
          #
          checkForCompileOption $test_channel SCRIPT_ARGUMENTS
        }

        #
        # NOTE: Has script breakpoint support been enabled (at compile-time)?
        #
        if {![info exists no(compileDebuggerBreakpoints)]} then {
          #
          # NOTE: For tests "debug-2.35" and "proc-2.1".
          #
          checkForCompileOption $test_channel DEBUGGER_BREAKPOINTS
        }

        #
        # NOTE: Has application domain management support been enabled (at
        #       compile-time)?
        #
        if {![info exists no(compileAppDomains)]} then {
          #
          # NOTE: For test "interp-1.27".
          #
          checkForCompileOption $test_channel APPDOMAINS
        }

        #
        # NOTE: Has isolated interpreter support been enabled (at compile-time)?
        #
        if {![info exists no(compileIsolatedInterpreters)]} then {
          #
          # NOTE: For test "xaml-1.2".
          #
          checkForCompileOption $test_channel ISOLATED_INTERPRETERS
        }

        #
        # NOTE: Has expression flags support been enabled (at compile-time)?
        #
        if {![info exists no(compileExpressionFlags)]} then {
          #
          # NOTE: For test "function-2.16".
          #
          checkForCompileOption $test_channel EXPRESSION_FLAGS
        }

        #
        # NOTE: Has isolated plugin support been enabled (at compile-time)?
        #
        if {![info exists no(compileIsolatedPlugins)]} then {
          #
          # NOTE: For test "load-1.1.1".
          #
          checkForCompileOption $test_channel ISOLATED_PLUGINS
        }

        #
        # NOTE: Has PowerShell approved-verbs support been enabled (at
        #       compile-time)?
        #
        if {![info exists no(compileApprovedVerbs)]} then {
          #
          # NOTE: For test "object-4.8".
          #
          checkForCompileOption $test_channel APPROVED_VERBS
        }

        #
        # NOTE: Has embedded library support been enabled (at
        #       compile-time)?
        #
        if {![info exists no(compileEmbeddedLibrary)]} then {
          #
          # NOTE: For test "interp-1.400".
          #
          checkForCompileOption $test_channel EMBEDDED_LIBRARY
        }

        #
        # NOTE: Has System.Reflection.Emit support been enabled (at
        #       compile-time)?
        #
        if {![info exists no(compileEmit)]} then {
          #
          # NOTE: For tests "commands-1.1.*", "debug-9.1", "library-*",
          #       "object-4.10", "object-4.11", "object-4.12",
          #       "object-8.1??", and "perf-101.0".
          #
          checkForCompileOption $test_channel EMIT
        }

        #
        # NOTE: Has .NET Standard 2.0 support been enabled (at
        #       compile-time)?
        #
        if {![info exists no(compileNetStandard20)]} then {
          #
          # NOTE: For tests "basic-1.29.*", "basic-1.30.*", "host-1.1",
          #       "interp-1.601", "redefine-6.2", and "sql-1.17".
          #
          checkForCompileOption $test_channel NET_STANDARD_20
        }

        #
        # NOTE: Has .NET Standard 2.1 support been enabled (at
        #       compile-time)?
        #
        if {![info exists no(compileNetStandard21)]} then {
          checkForCompileOption $test_channel NET_STANDARD_21
        }

        #
        # NOTE: Has support for extra .NET Core references been
        #       enabled (at compile-time)?
        #
        if {![info exists no(compileNetCoreReferences)]} then {
          checkForCompileOption $test_channel NET_CORE_REFERENCES
        }

        #
        # NOTE: Has .NET Core 2.0 support been enabled (at
        #       compile-time)?
        #
        if {![info exists no(compileNetCore20)]} then {
          checkForCompileOption $test_channel NET_CORE_20
        }

        #
        # NOTE: Has .NET Core 3.0 support been enabled (at
        #       compile-time)?
        #
        if {![info exists no(compileNetCore30)]} then {
          checkForCompileOption $test_channel NET_CORE_30
        }

        #
        # NOTE: Has Mono support been enabled (at compile-time)?
        #
        if {![info exists no(compileMono)]} then {
          #
          # NOTE: For test "object-4.13".
          #
          checkForCompileOption $test_channel MONO
        }

        #
        # NOTE: Has Windows support been enabled (at compile-time)?
        #
        if {![info exists no(compileWindows)]} then {
          #
          # NOTE: For tests "garuda-1.1" and "garuda-1.2".
          #
          checkForCompileOption $test_channel WINDOWS
        }

        #
        # NOTE: Has Windows Forms support been enabled (at compile-time)?
        #
        if {![info exists no(compileWinForms)]} then {
          #
          # NOTE: For tests "object-10.21", "tclLoad-1.2", "winForms-*.*".
          #
          checkForCompileOption $test_channel WINFORMS
        }

        #
        # NOTE: Has native library support been enabled (at compile-time)?
        #
        if {![info exists no(compileLibrary)]} then {
          #
          # NOTE: For tests "commands-1.*".
          #
          checkForCompileOption $test_channel LIBRARY
        }

        #
        # NOTE: Has native code support been enabled (at compile-time)?
        #
        if {![info exists no(compileNative)]} then {
          #
          # NOTE: For tests "debug-3.2", "expr-3.2", and "host-1.1".
          #
          checkForCompileOption $test_channel NATIVE
        }

        #
        # NOTE: Has native package support been enabled (at compile-time)?
        #
        if {![info exists no(compileNativePackage)]} then {
          #
          # NOTE: For tests "garuda-1.1" and "garuda-1.2".
          #
          checkForCompileOption $test_channel NATIVE_PACKAGE
        }

        #
        # NOTE: Has network support been enabled (at compile-time)?
        #
        if {![info exists no(compileNetwork)]} then {
          #
          # NOTE: For tests "commands-1.4", "socket-1.*", "socket-2.1", and
          #       "socket-3.1".
          #
          checkForCompileOption $test_channel NETWORK
        }

        #
        # NOTE: Has notification support been enabled (at compile-time)?
        #
        if {![info exists no(compileNotify)]} then {
          #
          # NOTE: For test "basic-1.75".
          #
          checkForCompileOption $test_channel NOTIFY
        }

        #
        # NOTE: Has notification argument support been enabled (at
        #       compile-time)?
        #
        if {![info exists no(compileNotifyArguments)]} then {
          #
          # NOTE: For test "basic-1.75".
          #
          checkForCompileOption $test_channel NOTIFY_ARGUMENTS
        }

        #
        # NOTE: Has native Tcl support been enabled (at compile-time)?
        #
        if {![info exists no(compileTcl)]} then {
          #
          # NOTE: For tests "commands-1.1.*", "excel-2.2", "tclCancel-1.1",
          #       "tclEncoding-1.*", "tclErrorInfo-1.*", "tclLoad-*.*",
          #       "tclResetCancel-1.1", "tclResetCancel-2.1",
          #       "tclResetCancel-2.2", "tclResetCancel-3.1",
          #       "tclResetCancel-4.1", "tclSet-1.1", and "tclSubst-1.1".
          #
          checkForCompileOption $test_channel TCL
        }

        #
        # NOTE: Has XML support been enabled (at compile-time)?
        #
        if {![info exists no(compileXml)]} then {
          #
          # NOTE: For tests "commands-1.4", "object-7.3" and "xml-1.1.*".
          #
          checkForCompileOption $test_channel XML
        }

        #
        # NOTE: Has serialization support been enabled (at compile-time)?
        #
        if {![info exists no(compileSerialization)]} then {
          #
          # NOTE: For test "interp-1.10".
          #
          checkForCompileOption $test_channel SERIALIZATION
        }

        #
        # NOTE: Has remoting support been enabled (at compile-time)?
        #
        if {![info exists no(compileRemoting)]} then {
          #
          # NOTE: For tests "remotingServer-1.*".
          #
          checkForCompileOption $test_channel REMOTING
        }

        #
        # NOTE: Has result size limit support been enabled (at
        #       compile-time)?
        #
        if {![info exists no(compileResultLimits)]} then {
          #
          # NOTE: For tests "interp-1.500" and "interp-1.501".
          #
          checkForCompileOption $test_channel RESULT_LIMITS
        }

        #
        # NOTE: Has dedicated test support been enabled (at compile-time)?
        #
        if {![info exists no(compileTest)]} then {
          #
          # NOTE: For tests "basic-1.20", "basic-1.21", "function-1.1",
          #       "object-2.1", "object-3.1", "object-4.1", "object-7.1",
          #       "object-7.2", "object-7.4", "object-14.4", "object-14.5",
          #       "object-14.6", "remotingServer-1.*", and "debug-5.*".
          #
          checkForCompileOption $test_channel TEST
        }

        #
        # NOTE: Has threading support been enabled (at compile-time)?
        #
        if {![info exists no(compileThreading)]} then {
          #
          # NOTE: For tests "object-10.2" and "object-10.3".
          #
          checkForCompileOption $test_channel THREADING
        }

        #
        # NOTE: Has Tcl threading support been enabled (at compile-time)?
        #
        if {![info exists no(compileTclThreaded)]} then {
          #
          # NOTE: For tests "tclLoad-3.*".
          #
          checkForCompileOption $test_channel TCL_THREADED
        }

        #
        # NOTE: Has Tcl isolated interpreter thread support been enabled (at
        #       compile-time)?
        #
        if {![info exists no(compileTclThreads)]} then {
          #
          # NOTE: For tests "tclLoad-3.*".
          #
          checkForCompileOption $test_channel TCL_THREADS
        }

        #
        # NOTE: Has GDI+ drawing support been enabled (at compile-time)?
        #
        if {![info exists no(compileDrawing)]} then {
          checkForCompileOption $test_channel DRAWING
        }

        #
        # NOTE: Has runtime license checking support been disabled (at
        #       compile-time)?  This only applies to third-party plugins
        #       and applications.
        #
        if {![info exists no(compileLicensing)]} then {
          #
          # NOTE: This is not currently used by any tests.
          #
          checkForCompileOption $test_channel LICENSING
        }

        #
        # NOTE: Has runtime "limited edition" checking support been
        #       disabled (at compile-time)?  This only applies to
        #       third-party plugins and applications.
        #
        if {![info exists no(compileLimitedEdition)]} then {
          #
          # NOTE: This is not currently used by any tests.
          #
          checkForCompileOption $test_channel LIMITED_EDITION
        }

        #
        # NOTE: Has runtime "demo edition" checking support been
        #       disabled (at compile-time)?  This only applies to
        #       third-party plugins and applications.
        #
        if {![info exists no(compileDemoEdition)]} then {
          #
          # NOTE: This is not currently used by any tests.
          #
          checkForCompileOption $test_channel DEMO_EDITION
        }

        #
        # NOTE: Has runtime "demo key pairs" checking support been
        #       disabled (at compile-time)?  This only applies to
        #       third-party plugins and applications.
        #
        if {![info exists no(compileDemoKeyPairs)]} then {
          #
          # NOTE: This is not currently used by any tests.
          #
          checkForCompileOption $test_channel DEMO_KEY_PAIRS
        }
      }
    }

    #
    # NOTE: Has testing using the C# compiler been disabled?
    #
    if {![info exists no(checkForCompileCSharp)]} then {
      checkForCompileCSharp $test_channel
    }

    #
    # NOTE: Has dynamic loading testing support been disabled?
    #
    if {![info exists no(dynamic)]} then {
      #
      # NOTE: For tests "commands-1.1.*", "library-3.*", and "tcl*-*.*".
      #
      checkForDynamicLoading $test_channel
    }

    #
    # NOTE: Has Tcl testing support been disabled?
    #
    if {![info exists no(tcl)]} then {
      if {![info exists no(tclInstalls)]} then {
        #
        # NOTE: For tests "commands-1.1.*", "library-3.*", and "tcl*-*.*".
        #
        checkForTclInstalls $test_channel
      }

      if {![info exists no(tclReady)]} then {
        checkForTclReady $test_channel
      }

      if {![info exists no(tclSelect)]} then {
        checkForTclSelect $test_channel
      }

      if {![info exists no(tclShell)]} then {
        #
        # NOTE: For test "garuda-1.1".
        #
        checkForTclShell $test_channel
      }

      if {![info exists no(tkPackage)]} then {
        #
        # NOTE: For test "tclLoad-1.1".
        #
        checkForTkPackage $test_channel
      }
    }

    #
    # NOTE: Has custom test method support been disabled?
    #
    if {![info exists no(core)] && ![info exists no(test)]} then {
      #
      # NOTE: Has fail-safe abort testing support been disabled?
      #
      if {![info exists no(testFailSafeAbort)]} then {
        #
        # NOTE: For test "basic-1.108".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestFailSafeAbortWithTrace*
      }

      #
      # NOTE: Has ruleset command testing support been disabled?
      #
      if {![info exists no(testRuleSetCommands)]} then {
        #
        # NOTE: For test "interp-1.70000".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestAddRuleSetCommands*
      }

      #
      # NOTE: Has simluated keyboard testing support been disabled?
      #
      if {![info exists no(testSimulateKeyboardString)]} then {
        #
        # NOTE: For test "basic-1.109".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestStartKeyboardStream*
      }

      #
      # NOTE: Has TraceFilterCallback testing support been disabled?
      #
      if {![info exists no(testTraceFilterCallback)]} then {
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetTraceFilterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestTraceFilterGetOutput*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestTraceFilterResetOutput*
      }

      #
      # NOTE: Has UnknownCallback testing support been disabled?
      #
      if {![info exists no(testUnknownCallback)]} then {
        #
        # NOTE: For tests "unknown-*".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetUnknownSpyCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetUnknownScriptObjectCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetUnknownScriptCommandCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetUnknownObjectInvokeCallback*
      }

      #
      # NOTE: Has PackageCallback testing support been disabled?
      #
      if {![info exists no(testPackageCallback)]} then {
        #
        # NOTE: For test "package-2.1".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetPackageFallbackCallback*
      }

      #
      # NOTE: Has ExecuteCallback testing support been disabled?
      #
      if {![info exists no(testExecuteCallback)]} then {
        #
        # NOTE: For tests "executeCallback-1.*".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestAddExecuteCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestExecuteCallback1*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestExecuteCallback2*
      }

      #
      # NOTE: Has SleepWaitCallback testing support been disabled?
      #
      if {![info exists no(testSleepWaitCallback)]} then {
        #
        # NOTE: For test "vwait-1.31".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestGetSleepWaitCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetSleepWaitCallback*
      }

      #
      # NOTE: Has WriteHeader testing support been disabled?
      #
      if {![info exists no(testWriteHeader)]} then {
        #
        # NOTE: For test "host-1.5".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestDisposedWriteHeader*
      }

      #
      # NOTE: Has optional parameter testing support been disabled?
      #
      if {![info exists no(testOptionalParameter)]} then {
        #
        # NOTE: For tests "object-2.81", "object-2.82", "object-2.83",
        #       and "object-2.84".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestOptionalParameter0*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestOptionalParameter1*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestOptionalParameter2*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestOptionalParameterZ*
      }

      #
      # NOTE: Has plugin policy testing support been disabled?
      #
      if {![info exists no(testPluginPolicy)]} then {
        #
        # NOTE: For tests "load-2.0" and "load-2.1".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestAddLoadPluginPolicy*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestLoadPluginPolicy*
      }

      #
      # NOTE: Has script stream testing support been disabled?
      #
      if {![info exists no(testScriptStream)]} then {
        #
        # NOTE: For tests "basic-1.46" and "basic-1.47".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestScriptStream*
      }

      #
      # NOTE: Has complaint testing support been disabled?
      #
      if {![info exists no(testComplain)]} then {
        #
        # NOTE: For tests "debug-1.98" and "debug-1.99".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetComplainCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestComplainCallbackThrow*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestComplainCallbackNoThrow*
      }

      #
      # NOTE: Has interpreter callback testing support been disabled?
      #
      if {![info exists no(testNewInterpreter)]} then {
        #
        # NOTE: For tests "interp-1.101" and "interp-1.102".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetNewInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestNewInterpreterCallback*
      }

      #
      # NOTE: Has interpreter callback testing support been disabled?
      #
      if {![info exists no(testUseInterpreter)]} then {
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetUseInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestUseInterpreterCallback*
      }

      #
      # NOTE: Has interpreter callback testing support been disabled?
      #
      if {![info exists no(testPrepareInterpreter)]} then {
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetPrepareInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPrepareInterpreterCallback*
      }

      #
      # NOTE: Has interpreter callback testing support been disabled?
      #
      if {![info exists no(testInitializeInterpreter)]} then {
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetInitializeInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestInitializeInterpreterCallback*
      }

      #
      # NOTE: Has interpreter callback testing support been disabled?
      #
      if {![info exists no(testFreeInterpreter)]} then {
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetFreeInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestFreeInterpreterCallback*
      }

      #
      # NOTE: Has custom match mode testing been disabled?
      #
      if {![info exists no(testMatchMode)]} then {
        #
        # NOTE: For test "stringMatch-101.1".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetMatchCallback*
      }

      #
      # NOTE: Has web client testing been disabled?
      #
      if {![info exists no(testWebClient)]} then {
        #
        # NOTE: For test "socket-3.50".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestHasScriptNewWebClientCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestHasErrorNewWebClientCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetScriptNewWebClientCallback*
      }

      if {![info exists no(testLoad)]} then {
        #
        # NOTE: For tests "load-1.6" and "load-1.7".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestLoadPluginViaBytes*
      }

      if {![info exists no(testPermute)]} then {
        #
        # NOTE: For tests "lpermute-1.3" and "lpermute-1.4".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPermute*
      }

      if {![info exists no(testDynamicCallback)]} then {
        #
        # NOTE: For tests "object-8.1??".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestCallDynamicCallback0*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestCallDynamicCallback1*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestCallDynamicCallback2*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestCallDynamicCallback3*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestCallDynamicCallback4*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestGetDynamicCallbacks*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestCallStaticDynamicCallback0*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestCallStaticDynamicCallback1*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestCallStaticDynamicCallback2*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestCallStaticDynamicCallback3*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestCallStaticDynamicCallback4*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestGetStaticDynamicCallbacks*
      }

      #
      # NOTE: Has SimpleCallback testing support been disabled?
      #
      if {![info exists no(testSimpleCallback)]} then {
        #
        # NOTE: For test "object-8.201".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPrivateInstanceNewInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPublicInstanceNewInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPrivateStaticNewInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPublicStaticNewInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPrivateInstanceUseInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPublicInstanceUseInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPrivateStaticUseInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPublicStaticUseInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPrivateInstancePrepareInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPublicInstancePrepareInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPrivateStaticPrepareInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPublicStaticPrepareInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPrivateInstanceInitializeInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPublicInstanceInitializeInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPrivateStaticInitializeInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPublicStaticInitializeInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPrivateInstanceFreeInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPublicInstanceFreeInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPrivateStaticFreeInterpreterCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestPublicStaticFreeInterpreterCallback*
      }

      #
      # NOTE: Has DateTime testing support been disabled?
      #
      if {![info exists no(testDateTime)]} then {
        #
        # NOTE: For test "vwait-1.11".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetDateTimeNowCallback*
      }

      #
      # NOTE: Has remoting testing support been disabled?
      #
      if {![info exists no(testRemoting)]} then {
        #
        # NOTE: For tests "remotingServer-1.*".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestRemoting*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestRemotingHaveChannel*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestRemotingTryGetChannel*
      }

      #
      # NOTE: Has embedded resource testing support been disabled?
      #
      if {![info exists no(testResources)]} then {
        #
        # NOTE: For test "interp-1.400".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestGetResourceString*
      }

      #
      # NOTE: Has asynchronous testing support been disabled?
      #
      if {![info exists no(testAsynchronous)]} then {
        #
        # NOTE: For tests "basic-1.20" and "basic-1.21".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestEvaluateAsync*
      }

      #
      # NOTE: Has custom function testing support been disabled?
      #
      if {![info exists no(testFunction)]} then {
        #
        # NOTE: For test "function-1.1".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestAddFunction*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestRemoveFunction*

        #
        # NOTE: For tests "function-5.*".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestAddNamedFunction*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestRemoveNamedFunction*

        #
        # NOTE: For test "interp-1.19".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestAddNamedFunction2*

        #
        # NOTE: For tests "function-5.*".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestAddNamedFunction3*
      }

      #
      # NOTE: Has write-box testing support been disabled?
      #
      if {![info exists no(testWriteBox)]} then {
        #
        # NOTE: For tests "debug-5.*".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestWriteBox*
      }

      #
      # NOTE: Has shell testing support been disabled?
      #
      if {![info exists no(testShell)]} then {
        #
        # NOTE: For test "debug-1.3".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestShellMainCore*
      }

      #
      # NOTE: Has quiet property testing support been disabled?
      #
      if {![info exists no(testSetQuiet)]} then {
        #
        # NOTE: For tests "basic-1.36" and "debug-1.3".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetQuiet*
      }

      #
      # NOTE: Has complaint testing support been disabled?
      #
      if {![info exists no(testSetComplain)]} then {
        #
        # NOTE: This is not currently used by any tests.
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetComplain*
      }

      #
      # NOTE: Has special variable testing support been disabled?
      #
      if {![info exists no(testSetVariable)]} then {
        #
        # NOTE: For test "basic-1.107".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetVariableWithTypedValue*
      }

      #
      # NOTE: Has enumerable variable testing support been disabled?
      #
      if {![info exists no(testEnumerableVariables)]} then {
        #
        # NOTE: For test "basic-1.105".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetupIntArray*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetVariableEnumerable*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestUnsetVariableEnumerable*
      }

      #
      # NOTE: Has linked variable testing support been disabled?
      #
      if {![info exists no(testLinkedVariables)]} then {
        #
        # NOTE: For tests "basic-1.39", "basic-1.40", "basic-1.41",
        #       "basic-1.42", and "basic-1.43".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetVariableLinks*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestUnsetVariableLinks*
      }

      #
      # NOTE: Has system array variable testing support been disabled?
      #
      if {![info exists no(testSystemArrayVariables)]} then {
        #
        # NOTE: For tests "basic-1.62", "basic-1.63", "basic-1.64",
        #       and "basic-1.65".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestIntPtrChangeTypeCallback*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSetVariableSystemArray*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestUnsetVariableSystemArray*
      }

      #
      # NOTE: Has reparse point testing support been disabled?
      #
      if {![info exists no(reparsePoints)]} then {
        #
        # NOTE: For tests "fileIO-14.*".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestProcessReparseData*
      }

      #
      # NOTE: Has field testing support been disabled?
      #
      if {![info exists no(testFields)]} then {
        #
        # NOTE: For tests "basic-1.39", "basic-1.40", "basic-1.41",
        #       "basic-1.42", and "basic-1.43".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *privateField*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *objectField*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *intField*
      }

      #
      # NOTE: Has property testing support been disabled?
      #
      if {![info exists no(testProperties)]} then {
        #
        # NOTE: For tests "basic-1.39", "basic-1.40", "basic-1.41",
        #       "basic-1.42", and "basic-1.43".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *get_SimpleIntProperty*

        #
        # NOTE: For test "object-3.1".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *get_Item*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *set_Item*
      }

      #
      # NOTE: Has core marshaller testing support been disabled?
      #
      if {![info exists no(testMarshaller)]} then {
        #
        # NOTE: These are not currently used by any tests.
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestSaveObjects*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestRestoreObjects*

        #
        # NOTE: For test "basic-1.29.*".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestExecuteStaticDelegates*

        #
        # NOTE: For tests "basic-1.30.*" and "basic-1.31".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestExecuteDelegateCommands*

        #
        # NOTE: For test "namespace-97.10".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestRenameNamespace*

        #
        # NOTE: For test "object-2.1".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestComplexMethod*

        #
        # NOTE: For test "object-2.12".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestMoreComplexMethod*

        #
        # NOTE: For test "object-2.3".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestToHexadecimalString*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestMulti2Array*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestMulti3Array*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestNestedArray*

        #
        # NOTE: For test "object-2.11".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestObjectAsArray*

        #
        # NOTE: For tests "object-3.6" and "object-3.7".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestStringIListReturnValue*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestStringIListIListIListReturnValue*

        #
        # NOTE: For test "object-3.8".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestByteList*

        #
        # NOTE: For test "object-3.9".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestIntList*

        #
        # NOTE: For test "object-3.10".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestLongList*

        #
        # NOTE: For test "object-3.11".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestDerivedList*

        #
        # NOTE: For tests "object-3.12" and "object-3.13".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestStringIDictionaryReturnValue*

        #
        # NOTE: For tests "object-3.14" and "object-3.15".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestReturnOfSelf*

        #
        # NOTE: For test "object-3.17".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestByRefByteArray*

        #
        # NOTE: For test "object-4.1".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestExpr*

        #
        # NOTE: For tests "basic-1.66", "basic-1.67", "basic-1.68",
        #       and "basic-1.69".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestTakeEventHandler*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestTakeGenericEventHandler*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestTakeResolveEventHandler*

        #
        # NOTE: For test "array-4.1".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestTwoByteArrays*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestReturnByteArray*

        #
        # NOTE: For test "object-7.1".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestByRefValueTypeMethod*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestNullableValueTypeMethod*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestByRefNullableValueTypeMethod*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestIntArrayReturnValue*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestStringArrayReturnValue*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestStringListReturnValue*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestStringListArrayReturnValue*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestByRefStringListArray*

        #
        # NOTE: For tests "object-7.2" and "object-7.4".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestNullArray*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestOutArray*

        #
        # NOTE: For tests "object-7.6" and "object-7.7".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestByRefArray*

        #
        # NOTE: For test "object-7.5".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestEnum*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestByRefEnum*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestNullableEnum*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestByRefNullableEnum*

        #
        # NOTE: For tests "object-14.4" and "object-14.5".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *StaticObjectProperty*

        #
        # NOTE: For test "object-14.6".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TypeProperty*
      }

      #
      # NOTE: Has test string support been disabled?
      #
      if {![info exists no(testStrings)]} then {
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestInitializeStrings*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestResetStrings*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestChangeString*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestRemoveString*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestGetString*
      }

      #
      # NOTE: Has script XML testing been disabled?
      #
      if {![info exists no(testXml)]} then {
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestGetScriptStreamXmlDataHash*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestGetScriptStreamXmlData*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestGetScriptStreamXmlSignature*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestGetScriptStreamXmlBlock1Signature*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestGetScriptStreamXmlBlock2Signature*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestReadScriptXml*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestScriptStreamXml*
      }

      #
      # NOTE: Has IDisposable testing support been disabled?
      #
      if {![info exists no(testDisposable)]} then {
        #
        # NOTE: For test "object-2.8".
        #
        checkForObjectMember $test_channel \
            Eagle._Tests.Default+Disposable \
            *ToString* Eagle._Tests.Default.Disposable.ToString
      }

      #
      # NOTE: Has ISubCommand testing support been disabled?
      #
      if {![info exists no(testSubCommand)]} then {
        #
        # NOTE: For tests "redefine-2.*".
        #
        checkForObjectMember $test_channel \
            Eagle._Tests.Default+SubCommand \
            *ToString* Eagle._Tests.Default.SubCommand.ToString
      }

      #
      # NOTE: Has IResolve testing support been disabled?
      #
      if {![info exists no(testResolve)]} then {
        #
        # NOTE: For tests "resolver-1.*".
        #
        checkForObjectMember $test_channel \
            Eagle._Tests.Default+Resolve \
            *ToString* Eagle._Tests.Default.Resolve.ToString
      }

      #
      # NOTE: Has script limiter testing support been disabled?
      #
      if {![info exists no(testLimiter)]} then {
        #
        # NOTE: For tests "interp-1.90?".
        #
        checkForObjectMember $test_channel \
            Eagle._Tests.Default+ScriptLimiter *ToString* \
            Eagle._Tests.Default.ScriptLimiter.ToString
      }

      #
      # NOTE: Has TraceListener testing support been disabled?
      #
      if {![info exists no(testTraceListener)]} then {
        #
        # NOTE: For test "basic-1.74".
        #
        checkForObjectMember $test_channel \
            Eagle._Tests.Default+Listener \
            *WriteLine* Eagle._Tests.Default.Listener.WriteLine

        checkForObjectMember $test_channel \
            Eagle._Tests.Default+Listener \
            *Flush* Eagle._Tests.Default.Listener.Flush

        #
        # NOTE: For test "basic-1.75".
        #
        checkForObjectMember $test_channel \
            Eagle._Tests.Default+Listener \
            * Eagle._Tests.Default.Listener
      }

      #
      # NOTE: Has script event thread testing support been disabled?
      #
      if {![info exists no(testScriptEventThread)]} then {
        #
        # NOTE: For test "interp-1.801".
        #
        checkForObjectMember $test_channel \
            Eagle._Tests.Default+ScriptEventState \
            *ToString* Eagle._Tests.Default.ScriptEventState.ToString

        checkForObjectMember $test_channel \
            Eagle._Tests.Default+ScriptEventThread \
            *ToString* Eagle._Tests.Default.ScriptEventThread.ToString

        checkForObjectMember $test_channel \
            Eagle._Tests.Default+ScriptThreadClientData \
            *ToString* Eagle._Tests.Default.ScriptThreadClientData.ToString

        checkForObjectMember $test_channel \
            Eagle._Tests.Default+ScriptTimeoutThread \
            *ToString* Eagle._Tests.Default.ScriptTimeoutThread.ToString
      }

      #
      # NOTE: Has channel testing support been disabled?
      #
      if {![info exists no(testChannels)]} then {
        #
        # NOTE: For test "channelBuffer-1.1".
        #
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestAddListStreamChannel*
      }

      #
      # NOTE: For test "interp-1.50000".
      #
      if {![info exists no(testShellArguments)]} then {
        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestMayEnterInteractiveLoop*

        checkForObjectMember $test_channel Eagle._Tests.Default \
            *TestShellGetProcessedArguments*
      }
    }

    #
    # NOTE: Has MSBuild testing support been disabled?
    #
    if {![info exists no(msBuild)]} then {
      #
      # NOTE: Has assembly loading support been disabled?
      #
      if {![info exists no(checkForAssembly)]} then {
        #
        # NOTE: For test "object-4.13".
        #
        checkForAssembly $test_channel Microsoft.Build.Framework

        #
        # NOTE: For test "object-6.1".
        #
        checkForAssembly $test_channel Microsoft.Build.Engine
      }
    }

    #
    # NOTE: Has Excel testing support been disabled?
    #
    if {![info exists no(excel)]} then {
      #
      # NOTE: Has assembly loading support been disabled?
      #
      if {![info exists no(checkForAssembly)]} then {
        #
        # NOTE: For tests "excel-*.*".
        #
        checkForAssembly $test_channel Microsoft.Office.Interop.Excel
      }

      #
      # NOTE: Has Excel usability testing been disabled?
      #
      if {![info exists no(excelUsable)]} then {
        #
        # NOTE: For tests "excel-*.*".
        #
        checkForExcelUsable $test_channel
      }
    }

    #
    # NOTE: Has speech testing support been disabled?
    #
    if {![info exists no(speech)]} then {
      #
      # NOTE: Set the audio volume, if necessary.
      #
      if {![info exists test_volume]} then {
        set test_volume 0; # in percent, 0 is silent.
      }

      #
      # NOTE: Has assembly loading support been disabled?
      #
      if {![info exists no(checkForAssembly)]} then {
        #
        # NOTE: For test "object-4.5".
        #
        checkForAssembly $test_channel System.Speech
      }
    }

    #
    # NOTE: Has WinForms testing support been disabled?
    #
    if {![info exists no(winForms)]} then {
      #
      # NOTE: For tests "object-13.1.*", "object-13.2.*", and
      #       "winForms-*.*".
      #
      checkForWindowsForms $test_channel
    }

    #
    # NOTE: Has Windows Terminal testing support been disabled?
    #
    if {![info exists no(noWindowsTerminal)]} then {
      #
      # NOTE: For tests "debug-10.1" and "host-1.1".
      #
      checkForWindowsTerminal $test_channel
    }

    #
    # NOTE: Are we running in a WoW64 process?
    #
    if {![info exists no(wow64)]} then {
      #
      # NOTE: This is not currently used by any tests.
      #
      checkForWoW64 $test_channel
    }

    #
    # NOTE: Are we running in an STA thread?
    #
    if {![info exists no(staThread)]} then {
      #
      # NOTE: For tests "xaml-1.*".
      #
      checkForStaThread $test_channel
    }

    #
    # NOTE: Has WPF testing support been disabled?
    #
    if {![info exists no(wpf)]} then {
      #
      # NOTE: For tests "xaml-1.*".
      #
      checkForWindowsPresentationFoundation $test_channel
    }

    #
    # NOTE: Has PowerShell testing support been disabled?
    #
    if {![info exists no(powerShell)]} then {
      #
      # NOTE: For tests "object-4.7", "object-4.8", and "object-4.9".
      #
      checkForPowerShell $test_channel
    }

    #
    # NOTE: Has .NET Framework 2.0 Service Pack testing support been
    #       disabled?
    #
    if {![info exists no(netFx20Sp)]} then {
      #
      # NOTE: For test "hash-1.1".
      #
      checkForNetFx20ServicePack $test_channel
    }

    #
    # NOTE: Has .NET Framework 4.0+ testing support been disabled?
    #
    if {![info exists no(netFx40)]} then {
      #
      # NOTE: For test "object-12.1.*".
      #
      checkForNetFx40 $test_channel
    }

    #
    # NOTE: Has .NET Framework 4.5+ testing support been disabled?
    #
    if {![info exists no(netFx45)]} then {
      #
      # NOTE: For test "object-12.1.*".
      #
      checkForNetFx45 $test_channel
    }

    #
    # NOTE: Has target framework testing support been disabled?
    #
    if {![info exists no(targetFramework)]} then {
      checkForTargetFramework $test_channel
    }

    #
    # NOTE: Has native utility testing support been disabled?
    #
    if {![info exists no(nativeUtility)]} then {
      checkForNativeUtility $test_channel
    }

    #
    # NOTE: Has Visual Studio testing support been disabled?
    #
    if {![info exists no(visualStudio)]} then {
      checkForVisualStudioViaRegistry $test_channel
    }

    #
    # NOTE: Has WiX testing support been disabled?
    #
    if {![info exists no(wix)]} then {
      #
      # NOTE: For test "object-4.10".
      #
      checkForWix $test_channel
    }

    #
    # NOTE: Has native debugger testing support been disabled?
    #
    if {![info exists no(nativeDebugger)]} then {
      checkForNativeDebugger $test_channel
    }

    #
    # NOTE: Has managed debugger testing support been disabled?
    #
    if {![info exists no(managedDebugger)]} then {
      checkForManagedDebugger $test_channel
    }

    #
    # NOTE: Has managed debugging assistants testing support been
    #       disabled?
    #
    if {![info exists no(managedDebuggingAssistants)]} then {
      checkForManagedDebuggingAssistants $test_channel
    }

    #
    # NOTE: Has script debugger testing support been disabled?
    #
    if {![info exists no(scriptDebugger)]} then {
      #
      # NOTE: For tests "debug-1.1", "debug-2.1", "debug-3.1", and
      #       "debug-4.1".
      #
      checkForScriptDebugger $test_channel
    }

    #
    # NOTE: Has script debugger interpreter testing support been
    #       disabled?
    #
    if {![info exists no(scriptDebuggerInterpreter)]} then {
      #
      # NOTE: For test "debug-2.1".
      #
      checkForScriptDebuggerInterpreter $test_channel
    }

    #
    # NOTE: Are we running under the Mono debugger?  If so, several
    #       tests will have to be disabled because they do not appear
    #       to work there.
    #
    if {![info exists no(monoDebugger)]} then {
      tputs $test_channel "---- checking for Mono debugger... "

      if {[haveConstraint mono] && [haveConstraint managedDebugger]} then {
        #
        # NOTE: Add a special test constraint to simplify the Mono debugger
        #       test constraint checking for the tests that need it.
        #
        addConstraint monoDebugger

        tputs $test_channel yes\n
      } else {
        tputs $test_channel no\n
      }
    }

    #
    # NOTE: Has Garuda testing support been disabled?
    #
    if {![info exists no(garudaDll)]} then {
      #
      # NOTE: For tests "garuda-1.1" and "garuda-1.2".
      #
      checkForGarudaDll $test_channel
    }

    ###########################################################################
    ########################## END Eagle Constraints ##########################
    ###########################################################################
  } else {
    #
    # NOTE: Make sure that Tcl honors the Eagle test constraints.
    #
    configureTcltest \
        [expr {[info exists test_flags(-verbose)] ? \
            $test_flags(-verbose) : ""}] \
        [expr {[info exists test_flags(-match)] ? \
            $test_flags(-match) : [list]}] \
        [expr {[info exists test_flags(-skip)] ? \
            $test_flags(-skip) : [list]}] \
        [expr {[info exists test_flags(-constraints)] ? \
            $test_flags(-constraints) : [list]}] \
        [list] false

    #
    # HACK: Reset the test counts for tcltest.
    #
    set ::tcltest::numTests(Total) 0
    set ::tcltest::numTests(Skipped) 0
    set ::tcltest::numTests(Passed) 0
    set ::tcltest::numTests(Failed) 0

    #
    # HACK: Reset the list of failed files.
    #
    set ::tcltest::failFiles [list]

    ###########################################################################
    ########################## BEGIN Tcl Constraints ##########################
    ###########################################################################

    tputs $test_channel \
        "---- start of Tcl specific test constraints...\n"

    #
    # NOTE: Has build type testing support been disabled?
    #
    if {![info exists no(buildTypes)]} then {
      #
      # NOTE: Has "known" build type testing support been disabled?
      #
      if {![info exists no(knownBuildTypes)]} then {
        #
        # NOTE: Check for all "known" compile options.
        #
        checkForKnownBuildTypes $test_channel
      } else {
        #
        # NOTE: Nothing is currently done here.  All supported build
        #       types are considered "well-known".
        #
      }
    }

    #
    # NOTE: Has compile/runtime option testing support been disabled?
    #
    if {![info exists no(compileOptions)]} then {
      #
      # NOTE: Has "known" compile option testing support been disabled?
      #
      if {![info exists no(knownCompileOptions)]} then {
        #
        # NOTE: Check for all "known" compile options.
        #
        checkForKnownCompileOptions $test_channel
      } else {
        #
        # NOTE: Has dedicated test support been enabled (at compile-time)?
        #
        if {![info exists no(compileTest)]} then {
          #
          # NOTE: For tests "tclLoad-13.1.1" and "tclLoad-13.1.2".
          #
          checkForCompileOption $test_channel TEST
        }
      }
    }

    ###########################################################################
    ########################### END Tcl Constraints ###########################
    ###########################################################################
  }

  #############################################################################
  ####################### BEGIN Tcl & Eagle Constraints #######################
  #############################################################################

  tputs $test_channel \
      "---- start of common (Tcl & Eagle) test constraints...\n"

  #
  # NOTE: Force tests that are normally blocked by Mono issues to run?
  #
  if {[info exists no(monoHacks)]} then {
    addKnownMonoConstraints true
    addKnownMonoConstraints false

    tputs $test_channel \
        "---- added all known Mono test constraints (forced)\n"
  }

  #
  # NOTE: Has Visual Studio testing support been disabled?
  #
  if {![info exists no(visualStudio)]} then {
    checkForVisualStudioViaVsWhere $test_channel
  }

  #
  # NOTE: Check for Eagle core library package names...
  #
  if {![info exists no(corePackageNames)]} then {
    checkForPackage $test_channel {^Eagle\._Plugins\.Core, .*$}
    checkForPackage $test_channel {^Eagle\._Plugins\.Object, .*$}
    checkForPackage $test_channel {^Eagle\._Plugins\.Test, .*$}
    checkForPackage $test_channel {^Eagle\._Plugins\.Monitor, .*$}
  }

  #
  # NOTE: Check for Eagle Enterprise Edition package names...
  #
  if {![info exists no(enterprisePackageNames)]} then {
    #
    # NOTE: These are from various SKUs of the Harpy plugin.
    #
    checkForPackage $test_channel {^Licensing\.Core, .*$}
    checkForPackage $test_channel {^Licensing\.Standard, .*$}
    checkForPackage $test_channel {^Licensing\.Enterprise, .*$}
    checkForPackage $test_channel {^Security\.Core, .*$}

    #
    # NOTE: These are from various SKUs of the Badge plugin.
    #
    checkForPackage $test_channel {^Badge\.Enterprise, .*$}
    checkForPackage $test_channel {^Security\.Certificates, .*$}
  }

  #
  # NOTE: Check for the test suite infrastructure files...
  #
  if {![info exists no(testSuiteFiles)]} then {
    checkForTestSuiteFiles $test_channel
  }

  #
  # NOTE: Has all use of [exec] for tests been disabled?
  #
  if {![info exists no(checkForTestExec)]} then {
    checkForTestExec $test_channel [haveConstraint quiet]
  }

  #
  # NOTE: Has checking for the test machine been disabled?
  #
  if {![info exists no(testMachine)]} then {
    checkForTestMachine $test_channel
  }

  #
  # NOTE: Has checking for the test platform been disabled?
  #
  if {![info exists no(testPlatform)]} then {
    checkForTestPlatform $test_channel
  }

  #
  # NOTE: Has checking for the test configuration been disabled?
  #
  if {![info exists no(testConfiguration)]} then {
    checkForTestConfiguration $test_channel
  }

  #
  # NOTE: Has checking for the test name prefix been disabled?
  #
  if {![info exists no(testNamePrefix)]} then {
    checkForTestNamePrefix $test_channel
  }

  #
  # NOTE: Has checking for the test suffix been disabled?
  #
  if {![info exists no(testSuffix)]} then {
    checkForTestSuffix $test_channel
  }

  #
  # NOTE: Are we likely running on a terminal using GNU Screen?
  #
  if {![info exists no(gnuScreen)]} then {
    checkForGnuScreen $test_channel
  }

  #
  # NOTE: Has checking for the extra files needed by various tests in the
  #       Eagle core test suite been disabled?
  #
  if {![info exists no(core)] && ![info exists no(checkForFile)]} then {
    #
    # NOTE: For tests "benchmark-1.3[89]" and "benchmark-1.40".
    #
    if {![info exists no(benchmark.txt)]} then {
      checkForFile $test_channel [file join $test_data_path benchmark.txt]
    }

    #
    # NOTE: For test "benchmark-1.42".
    #
    if {![info exists no(pngDump.txt)]} then {
      checkForFile $test_channel [file join $test_data_path pngDump.txt]
    }

    #
    # NOTE: For test "file3-1.1".
    #
    if {![info exists no(Eagle.csproj)]} then {
      checkForFile $test_channel \
          [file join $base_path Library Eagle.csproj]
    }

    if {![info exists no(file3_1_1_expected_cmd.txt)]} then {
      checkForFile $test_channel \
          [file join $test_data_path file3_1_1_expected_cmd.txt]
    }

    if {![info exists no(file3_1_1_expected_glob.txt)]} then {
      checkForFile $test_channel \
          [file join $test_data_path file3_1_1_expected_glob.txt]
    }

    if {![info exists no(file3_1_1_expected_mixed.txt)]} then {
      checkForFile $test_channel \
          [file join $test_data_path file3_1_1_expected_mixed.txt]
    }

    #
    # NOTE: For test "garuda-1.1".
    #
    if {![info exists no(pkgAll.tcl)]} then {
      checkForFile $test_channel [file join $base_path Native Package \
          Tests all.tcl] pkgAll.tcl
    }

    #
    # NOTE: For tests "subst-1.*".
    #
    if {![info exists no(bad_subst.txt)]} then {
      checkForFile $test_channel [file join $test_data_path bad_subst.txt]
    }

    #
    # NOTE: This is not currently used by any tests.  However, it is
    #       used later in this file.
    #
    if {![info exists no(hosts.txt)]} then {
      checkForFile $test_channel [file join $test_data_path hosts.txt]
    }

    #
    # NOTE: For test "exec-2.1".
    #
    if {![info exists no(big_exec.txt)]} then {
      checkForFile $test_channel [file join $test_data_path big_exec.txt]
    }

    if {![info exists no(big_exec_raw.txt)]} then {
      checkForFile $test_channel [file join $test_data_path big_exec_raw.txt]
    }

    #
    # NOTE: For test "processIsolation-1.1".
    #
    if {![info exists no(isolated.eagle)]} then {
      checkForFile $test_channel [file join $test_data_path isolated.eagle]
    }

    #
    # NOTE: For test "basic-1.73".
    #
    if {![info exists no(callStack.eagle)]} then {
      checkForFile $test_channel [file join $test_data_path callStack.eagle]
    }

    #
    # NOTE: This is not currently used by any tests.  However, it is
    #       used by the sample targets file "Eagle.Sample.targets".
    #
    if {![info exists no(evaluate.eagle)]} then {
      checkForFile $test_channel [file join $test_data_path evaluate.eagle]
    }

    #
    # NOTE: For test "interp-1.50000".
    #
    if {![info exists no(showArgv.eagle)]} then {
      checkForFile $test_channel [file join $test_data_path showArgv.eagle]
    }

    #
    # NOTE: This is not currently used by any tests.  However, it is
    #       used by the sample targets file "Eagle.Sample.targets".
    #
    if {![info exists no(substitute.eagle)]} then {
      checkForFile $test_channel [file join $test_data_path substitute.eagle]
    }

    #
    # NOTE: This is not currently used by any tests.
    #
    if {![info exists no(unicode_bom.txt)]} then {
      checkForFile $test_channel [file join $test_data_path unicode_bom.txt]
    }

    #
    # NOTE: This is not currently used by any tests.
    #
    if {![info exists no(unicode_no_bom.txt)]} then {
      checkForFile $test_channel [file join $test_data_path unicode_no_bom.txt]
    }

    #
    # NOTE: This is not currently used by any tests.
    #
    if {![info exists no(utf8.txt)]} then {
      checkForFile $test_channel [file join $test_data_path utf8.txt]
    }

    #
    # NOTE: For tests "fileIO-1.*".
    #
    if {![info exists no(file.dat)]} then {
      checkForFile $test_channel [file join $test_data_path file.dat]
    }

    #
    # NOTE: For tests "fileIO-5.6.*".
    #
    if {![info exists no(HomeDocuments)]} then {
      checkForFile $test_channel [file join \
          $test_home_path Documents] HomeDocuments
    }

    #
    # NOTE: For test "garbage-1.1".
    #
    if {![info exists no(garbage.txt)]} then {
      checkForFile $test_channel [file join $test_data_path garbage.txt]
    }

    #
    # NOTE: For tests "xaml-1.*".
    #
    if {![info exists no(test.png)]} then {
      checkForFile $test_channel [file join $test_data_path test.png]
    }

    #
    # NOTE: For test "socket-1.2".
    #
    if {![info exists no(client.tcl)]} then {
      checkForFile $test_channel [file join $test_data_path client.tcl]
    }

    #
    # NOTE: For test "tclLoad-1.2".
    #
    if {![info exists no(tcl_unload.tcl)]} then {
      checkForFile $test_channel [file join $test_data_path tcl_unload.tcl]
    }

    #
    # NOTE: For test "basic-1.4".
    #
    if {![info exists no(read.eagle)]} then {
      checkForFile $test_channel [file join $test_data_path read.eagle]
    }

    #
    # NOTE: For test "basic-1.5".
    #
    if {![info exists no(read2.eagle)]} then {
      checkForFile $test_channel [file join $test_data_path read2.eagle]
    }

    #
    # NOTE: For test "basic-1.6".
    #
    if {![info exists no(read3.eagle)]} then {
      checkForFile $test_channel [file join $test_data_path read3.eagle]
    }

    #
    # NOTE: For test "basic-1.7".
    #
    if {![info exists no(read4.eagle)]} then {
      checkForFile $test_channel [file join $test_data_path read4.eagle]
    }

    #
    # NOTE: For test "infoScript-1.1".
    #
    if {![info exists no(script.eagle)]} then {
      checkForFile $test_channel [file join $test_data_path script.eagle]
    }

    #
    # NOTE: For test "basic-1.1".
    #
    if {![info exists no(source.eagle)]} then {
      checkForFile $test_channel [file join $test_data_path source.eagle]
    }

    #
    # NOTE: For test "basic-1.2".
    #
    if {![info exists no(unbalanced_brace.eagle)]} then {
      checkForFile $test_channel [file join \
          $test_data_path unbalanced_brace.eagle]
    }

    #
    # NOTE: For test "basic-1.3".
    #
    if {![info exists no(unbalanced_brace2.eagle)]} then {
      checkForFile $test_channel [file join \
          $test_data_path unbalanced_brace2.eagle]
    }

    #
    # NOTE: For tests "excel-2.*".
    #
    if {![info exists no(test.xls)]} then {
      checkForFile $test_channel [file join $test_data_path test.xls]
    }

    #
    # NOTE: For test "proc-1.9".
    #
    if {![info exists no(testProcs.tcl)]} then {
      checkForFile $test_channel [file join $test_data_path testProcs.tcl]
    }

    #
    # NOTE: For tests "interp-1.10.*" and "interp-1.11.*".
    #
    if {![info exists no(settings.xml)]} then {
      checkForFile $test_channel [file join $test_data_path settings.xml]
    }

    if {![info exists no(settings.ini)]} then {
      checkForFile $test_channel [file join $test_data_path settings.ini]
    }

    #
    # NOTE: For tests "load-1.1.*".
    #
    if {![info exists no(Plugin.dll)]} then {
      checkForFile $test_channel [file join \
          $core_lib_path Plugin1.0 [getDotNetCoreLibPathDirectoryNameOnly \
          Plugin1.0] Plugin.dll]
    }

    #
    # NOTE: For test "object-6.1".
    #
    if {![info exists no(Sample.exe)]} then {
      checkForFile $test_channel [file join $core_bin_path Sample.exe]
    }

    #
    # NOTE: For test "object-4.8".
    #
    if {![info exists no(EagleCmdlets.dll)]} then {
      checkForFile $test_channel [file join $core_bin_path EagleCmdlets.dll]
    }

    #
    # NOTE: For test "object-4.10".
    #
    if {![info exists no(EagleExtensions.dll)]} then {
      checkForFile $test_channel [file join $core_bin_path EagleExtensions.dll]
    }

    #
    # NOTE: For test "object-4.10".
    #
    if {![info exists no(test.wxs)]} then {
      checkForFile $test_channel [file join $base_path Installer Tests test.wxs]
    }

    #
    # NOTE: For tests "sql-1.2", "sql-1.4", "sql-1.5", "sql-1.6", "sql-1.7",
    #       "sql-1.8", and "sql-1.9".
    #
    if {![info exists no(sqlite3.dll)]} then {
      checkForFile $test_channel [file join $core_bin_path sqlite3.dll]

      #
      # NOTE: Did we manage to find the native SQLite library yet?  If not,
      #       try to check using the machine type as a sub-directory.
      #
      if {![haveConstraint file_sqlite3.dll]} then {
        #
        # NOTE: Ok, now try to check for the machine specific native
        #       SQLite library.
        #
        checkForFile $test_channel [file join $core_bin_path \
            [machineToPlatform $test_machine true] sqlite3.dll]

        #
        # NOTE: Did we manage to find the native SQLite library yet?
        #
        if {![haveConstraint file_sqlite3.dll]} then {
          #
          # NOTE: Ok, now try to check for the platform specific native
          #       SQLite library.
          #
          checkForFile $test_channel [file join $core_bin_path \
              [machineToPlatform $test_machine false] sqlite3.dll]
        }
      }

      if {[isEagle] && ![isWindows]} then {
        #
        # NOTE: Did we manage to find the native SQLite library yet?  If not,
        #       try to check using the machine type as a sub-directory -AND-
        #       using the Unix file name.
        #
        if {![haveConstraint file_sqlite3.dll]} then {
          #
          # NOTE: Ok, now try to check for the machine specific native
          #       SQLite library, near the binary, using the Unix name.
          #
          checkForFile $test_channel [file join $core_bin_path \
              [machineToPlatform $test_machine true] [appendArgs \
              libsqlite3 [info sharedlibextension]]] sqlite3.dll

          #
          # NOTE: Did we manage to find the native SQLite library yet?
          #
          if {![haveConstraint file_sqlite3.dll]} then {
            #
            # NOTE: Ok, now try to check for the platform specific native
            #       SQLite library, near the binary, using the Unix name.
            #
            checkForFile $test_channel [file join $core_bin_path \
                [machineToPlatform $test_machine false] [appendArgs \
                libsqlite3 [info sharedlibextension]]] sqlite3.dll
          }
        }

        #
        # NOTE: Did we manage to find the native SQLite library yet?  If not,
        #       try to check using the Unix library directories -AND- using
        #       the Unix file name.
        #
        if {![haveConstraint file_sqlite3.dll]} then {
          #
          # NOTE: Attempt to obtain the path information for the Unix
          #       local library directory.  This will not work for
          #       native Tcl.
          #
          if {[catch {
            info path "=NativeLibrary +Local"
          } lib_dir] == 0} then {
            #
            # NOTE: Ok, now try to check for the machine specific native
            #       SQLite library, in the Unix local library directory,
            #       and the Unix file name.
            #
            checkForFile $test_channel [file join $lib_dir [appendArgs \
                libsqlite3 [info sharedlibextension]]] sqlite3.dll
          }

          #
          # NOTE: Did we manage to find the native SQLite library yet?
          #
          if {![haveConstraint file_sqlite3.dll]} then {
            #
            # NOTE: Attempt to obtain the path information for the Unix
            #       global library directory.  This will not work for
            #       native Tcl.
            #
            if {[catch {
              info path "=NativeLibrary -Local"
            } lib_dir] == 0} then {
              #
              # NOTE: Ok, now try to check for the machine specific native
              #       SQLite library, in the Unix global library directory,
              #       and the Unix file name.
              #
              checkForFile $test_channel [file join $lib_dir [appendArgs \
                  libsqlite3 [info sharedlibextension]]] sqlite3.dll
            }
          }

          unset lib_dir
        }

        #
        # NOTE: Did we manage to find the native SQLite library yet?  If not,
        #       try to check using the Unix library directories -AND- using
        #       the Unix file name, without using the processor name.
        #
        if {![haveConstraint file_sqlite3.dll]} then {
          #
          # NOTE: Attempt to obtain the path information for the Unix
          #       local library directory without the processor name.
          #       This will not work for native Tcl.
          #
          if {[catch {
            info path "=NativeLibrary +Local +NoProcessor"
          } lib_dir] == 0} then {
            #
            # NOTE: Ok, now try to check for the machine specific native
            #       SQLite library, in the Unix local library directory,
            #       and the Unix file name.
            #
            checkForFile $test_channel [file join $lib_dir [appendArgs \
                libsqlite3 [info sharedlibextension]]] sqlite3.dll
          }

          #
          # NOTE: Did we manage to find the native SQLite library yet?
          #
          if {![haveConstraint file_sqlite3.dll]} then {
            #
            # NOTE: Attempt to obtain the path information for the Unix
            #       global library directory without the processor name.
            #       This will not work for native Tcl.
            #
            if {[catch {
              info path "=NativeLibrary -Local +NoProcessor"
            } lib_dir] == 0} then {
              #
              # NOTE: Ok, now try to check for the machine specific native
              #       SQLite library, in the Unix global library directory,
              #       and the Unix file name.
              #
              checkForFile $test_channel [file join $lib_dir [appendArgs \
                  libsqlite3 [info sharedlibextension]]] sqlite3.dll
            }
          }

          unset lib_dir
        }
      }
    }

    if {![info exists no(System.Data.SQLite.dll)]} then {
      checkForFile $test_channel [file join $core_bin_path \
          System.Data.SQLite.dll]
    }

    if {![info exists no(test.sqlite3)]} then {
      checkForFile $test_channel [file join $test_data_path test.sqlite3]
    }
  }

  #
  # NOTE: Check the core test constraints unless they have been
  #       explicitly disabled.
  #
  if {![info exists no(platform)]} then {
    checkForPlatform $test_channel
  }

  if {![info exists no(windowsVersion)]} then {
    checkForWindowsVersion $test_channel
  }

  if {![info exists no(scriptLibrary)]} then {
    checkForScriptLibrary $test_channel
  }

  if {![info exists no(tclOptions)]} then {
    checkForTclOptions $test_channel
  }

  if {![info exists no(checkForBigLists)]} then {
    checkForBigLists $test_channel
  }

  if {![info exists no(checkForProcessorIntensive)]} then {
    checkForProcessorIntensive $test_channel
  }

  if {![info exists no(checkForFileSystemIntensive)]} then {
    checkForFileSystemIntensive $test_channel
  }

  if {![info exists no(checkForTimeIntensive)]} then {
    checkForTimeIntensive $test_channel
  }

  if {![info exists no(checkForFullTest)]} then {
    checkForFullTest $test_channel
  }

  if {![info exists no(checkForMemoryIntensive)]} then {
    checkForMemoryIntensive $test_channel
  }

  if {![info exists no(checkForStackIntensive)]} then {
    checkForStackIntensive $test_channel
  }

  if {![info exists no(checkForStackSize)]} then {
    checkForStackSize $test_channel
  }

  if {![info exists no(windowsCommandProcessor)]} then {
    checkForWindowsCommandProcessor $test_channel cmd.exe
  }

  if {![info exists no(fossil)]} then {
    checkForFossil $test_channel
  }

  if {![info exists no(testRepositoryCheckout)]} then {
    checkForVariable $test_channel test_repository_checkout
  }

  if {![info exists no(testRepositoryFile)]} then {
    checkForVariable $test_channel test_repository_file
  }

  if {![info exists no(testRepositoryTags)]} then {
    checkForVariable $test_channel test_repository_tags
  }

  if {![info exists no(testRepositoryUrl)]} then {
    checkForVariable $test_channel test_repository_url
  }

  if {![info exists no(testXdgShellsDir)]} then {
    checkForEnvironmentVariable $test_channel XDG_SHELLS_DIR
  }

  if {![info exists no(testXdgRuleSetDir)]} then {
    checkForEnvironmentVariable $test_channel XDG_RULESET_DIR
  }

  if {![info exists no(version)]} then {
    checkForVersion $test_channel
  }

  if {![info exists no(eagle)]} then {
    checkForEagle $test_channel
  }

  if {![info exists no(noLogFile)]} then {
    checkForLogFile $test_channel
  }

  if {![info exists no(executableSymbols)]} then {
    checkForSymbols $test_channel [getShellExecutableName] executable
  }

  if {![info exists no(garuda)]} then {
    checkForGaruda $test_channel
  }

  if {![info exists no(shell)]} then {
    checkForShell $test_channel
  }

  if {![info exists no(officialStableReleaseInProgress)]} then {
    checkForOfficialStableReleaseInProgress $test_channel
  }

  if {![info exists no(debug)]} then {
    checkForDebug $test_channel
  }

  #
  # NOTE: Has Tk testing support been disabled?
  #
  if {![info exists no(tk)]} then {
    checkForTk $test_channel
  }

  #
  # NOTE: Has native code detection support been disabled?
  #
  if {![info exists no(native)]} then {
    checkForNativeCode $test_channel
  }

  #
  # NOTE: Check for various extra commands that may be present.
  #
  if {![info exists no(base64Command)]} then {
    checkForCommand $test_channel base64
  }

  if {![info exists no(bgerrorCommand)]} then {
    checkForCommand $test_channel bgerror
  }

  if {![info exists no(callbackCommand)]} then {
    checkForCommand $test_channel callback
  }

  if {![info exists no(debugCommand)]} then {
    checkForCommand $test_channel debug
  }

  if {![info exists no(doCommand)]} then {
    checkForCommand $test_channel do
  }

  if {![info exists no(downlevelCommand)]} then {
    checkForCommand $test_channel downlevel
  }

  if {![info exists no(guidCommand)]} then {
    checkForCommand $test_channel guid
  }

  if {![info exists no(hashCommand)]} then {
    checkForCommand $test_channel hash
  }

  if {![info exists no(hostCommand)]} then {
    checkForCommand $test_channel host
  }

  if {![info exists no(invokeCommand)]} then {
    checkForCommand $test_channel invoke
  }

  if {![info exists no(killCommand)]} then {
    checkForCommand $test_channel kill
  }

  if {![info exists no(lgetCommand)]} then {
    checkForCommand $test_channel lget
  }

  if {![info exists no(libraryCommand)]} then {
    checkForCommand $test_channel library
  }

  if {![info exists no(lremoveCommand)]} then {
    checkForCommand $test_channel lremove
  }

  if {![info exists no(nopCommand)]} then {
    checkForCommand $test_channel nop
  }

  if {![info exists no(nprocCommand)]} then {
    checkForCommand $test_channel nproc
  }

  if {![info exists no(objectCommand)]} then {
    checkForCommand $test_channel object
  }

  if {![info exists no(parseCommand)]} then {
    checkForCommand $test_channel parse
  }

  if {![info exists no(scopeCommand)]} then {
    checkForCommand $test_channel scope
  }

  if {![info exists no(socketCommand)]} then {
    checkForCommand $test_channel socket
  }

  if {![info exists no(sqlCommand)]} then {
    checkForCommand $test_channel sql
  }

  if {![info exists no(tclCommand)]} then {
    checkForCommand $test_channel tcl
  }

  if {![info exists no(throwCommand)]} then {
    checkForCommand $test_channel throw
  }

  if {![info exists no(truncateCommand)]} then {
    checkForCommand $test_channel truncate
  }

  if {![info exists no(tryCommand)]} then {
    checkForCommand $test_channel try
  }

  if {![info exists no(uriCommand)]} then {
    checkForCommand $test_channel uri
  }

  if {![info exists no(versionCommand)]} then {
    checkForCommand $test_channel version
  }

  if {![info exists no(xmlCommand)]} then {
    checkForCommand $test_channel xml
  }

  #
  # NOTE: Has "eformat" detection support been disabled?
  #
  if {![info exists no(eformat)]} then {
    checkForEFormat $test_channel
  }

  #
  # NOTE: Is the "int" type really the same as "wide"?
  #
  if {![info exists no(intIsWide)]} then {
    checkForIntIsWide $test_channel
  }

  #
  # NOTE: Has namespace detection support been disabled?
  #
  if {![info exists no(namespaces)]} then {
    checkForNamespaces $test_channel [haveConstraint quiet]
  }

  #
  # NOTE: Check for various native Tcl features that were added
  #       (or simply proposed) through the TIP process.
  #
  if {![info exists no(tip127)]} then {
    checkForTip127 $test_channel
  }

  if {![info exists no(tip182)]} then {
    checkForTip182 $test_channel
  }

  if {![info exists no(tip194)]} then {
    checkForTip194 $test_channel
  }

  if {![info exists no(tip207)]} then {
    checkForTip207 $test_channel
  }

  if {![info exists no(tip241)]} then {
    checkForTip241 $test_channel
  }

  if {![info exists no(tip285)]} then {
    checkForTip285 $test_channel
  }

  if {![info exists no(tip405)]} then {
    checkForTip405 $test_channel
  }

  if {![info exists no(tip421)]} then {
    checkForTip421 $test_channel
  }

  if {![info exists no(tip426)]} then {
    checkForTip426 $test_channel
  }

  if {![info exists no(tip429)]} then {
    checkForTip429 $test_channel
  }

  if {![info exists no(tip440)]} then {
    checkForTip440 $test_channel
  }

  if {![info exists no(tip461)]} then {
    checkForTip461 $test_channel
  }

  if {![info exists no(tip463)]} then {
    checkForTip463 $test_channel
  }

  if {![info exists no(tip471)]} then {
    checkForTip471 $test_channel
  }

  if {![info exists no(tip508)]} then {
    checkForTip508 $test_channel
  }

  if {![info exists no(tip521)]} then {
    checkForTip521 $test_channel
  }

  #
  # NOTE: Has performance testing been disabled?
  #
  if {![info exists no(core)] && \
      ![info exists no(checkForPerformance)]} then {
    checkForPerformance $test_channel
  }

  #
  # NOTE: Have any timing related constraints been disabled?
  #
  # BUGBUG: In Eagle, these checks for "precision" timing are not overly
  #         reliable.  This may be due to the semi-random nature of the
  #         garbage collection.  More research into the precise cause of
  #         timing issues is certainly warranted.
  #
  #
  if {![info exists no(core)] && \
      ![info exists no(timing)]} then {
    checkForTiming $test_channel 50; # 1/20th second.
  }

  if {![info exists no(core)] && \
      ![info exists no(preciseTiming)]} then {
    #
    # NOTE: Normally, the "preciseTiming" constraint implicitly requires that
    #       the "timing" constraint be present as well; however, that can be
    #       overridden.
    #
    if {[info exists no(requireTiming)] || \
        [haveConstraint timing]} then {
      checkForTiming $test_channel 25 preciseTiming; # 1/40th second.
    }
  }

  #
  # NOTE: Has interactive testing been disabled?
  #
  if {![info exists no(interactive)]} then {
    checkForInteractive $test_channel
  }

  #
  # NOTE: Has interactive focus testing been disabled?
  #
  if {![info exists no(interactiveFocus)]} then {
    checkForInteractiveFocus $test_channel
  }

  #
  # NOTE: Has interactive command testing been disabled?
  #
  if {![info exists no(core)] && \
      ![info exists no(interactiveCommand)]} then {
    #
    # NOTE: For test "debug-1.8".
    #
    checkForInteractiveCommand $test_channel go

    #
    # NOTE: For test "debug-1.9".
    #
    checkForInteractiveCommand $test_channel done

    #
    # NOTE: For test "object-15.9".
    #
    checkForInteractiveCommand $test_channel args

    #
    # NOTE: For test "debug-10.1".
    #
    checkForInteractiveCommand $test_channel exit
    checkForInteractiveCommand $test_channel pause
    checkForInteractiveCommand $test_channel unpause
  }

  if {![info exists no(userInteraction)]} then {
    checkForUserInteraction $test_channel
  }

  #
  # NOTE: Check for offline mode, which may forbid all network.
  #
  if {![info exists no(core)] && ![info exists no(offlineMode)]} then {
    checkForOfflineMode $test_channel
  }

  #
  # NOTE: Check for basic network connectivity to our test host.
  #
  if {![info exists no(core)] && ![info exists no(network)]} then {
    checkForNetwork $test_channel $test_host $test_timeout
  }

  #
  # NOTE: Check for basic network connectivity to the [checkForUpdate]
  #       host.
  #
  if {![info exists no(core)] && \
      ![info exists no(network)] && ![info exists no(updateNetwork)]} then {
    if {[llength [info commands getUpdateBaseUri]] > 0} then {
      checkForNetwork $test_channel [getUpdateBaseUri false] $test_timeout
    } else {
      #
      # HACK: This host value is hard-coded when the [getUpdateBaseUri]
      #       procedure is unavailable.
      #
      checkForNetwork $test_channel update.eagle.to $test_timeout
    }
  }

  #
  # NOTE: Check for Internet connectivity via The Eagle Project official
  #       web site.
  #
  if {![info exists no(core)] && ![info exists no(internet)]} then {
    #
    # HACK: This URI should require HTTPS to prevent test connections
    #       from being intercepted.
    #
    checkForInternet $test_channel [appendArgs https:// $test_host /] \
        $test_timeout
  }

  #
  # NOTE: Check for Internet connectivity using TLS to all of the various
  #       official web sites for The Eagle Project.
  #
  if {![info exists no(core)] && ![info exists no(tlsOk)]} then {
    checkForTlsOk $test_channel $test_hosts $test_timeout
  }

  #############################################################################

  #
  # NOTE: Figure out the approximate relative performance of this machine.
  #
  if {![info exists no(bogoCops)] && [haveConstraint performance]} then {
    tputs $test_channel \
        "---- checking for baseline BogoCops (commands-per-second)... "

    if {![info exists test_base_cops]} then {
      #
      # NOTE: The expected performance numbers for all the
      #       performance tests will be calibrated based on
      #       this number (which is based on the measured
      #       performance of the actual machine that was
      #       used to determine those expected performance
      #       numbers).
      #
      if {[isEagle]} then {
        set test_base_cops 36000.0; # NOTE: Eagle 1.0 Win32
      } else {
        set test_base_cops 1570000.0; # NOTE: Tcl 8.4.19 Win32
      }
    }

    tputs $test_channel [appendArgs $test_base_cops \n]
    tputs $test_channel \
        "---- checking for baseline BogoCops multipliers... "

    if {![info exists test_base_cops_multipliers]} then {
      set test_base_cops_multipliers [list \
          2 4 8 10 16 20 32 50 64 100 1000 10000 100000 1000000]
    }

    tputs $test_channel [appendArgs $test_base_cops_multipliers \n]
    tputs $test_channel \
        "---- checking for current BogoCops (commands-per-second)... "

    if {![info exists test_cops]} then {
      set test_cops [calculateBogoCops]
    }

    tputs $test_channel [appendArgs [formatDecimal $test_cops] \n]
    tputs $test_channel \
        "---- checking for current BogoCops against baseline BogoCops... "

    if {$test_cops > $test_base_cops} then {
      if {![info exists no(fasterBogoCops)]} then {
        addConstraint sameOrFasterBogoCops
        addConstraint fasterBogoCops

        if {![info exists no(bogoCopsMultipliers)]} then {
          foreach multiplier $test_base_cops_multipliers {
            if {$test_cops >= $test_base_cops * $multiplier} then {
              addConstraint [appendArgs fasterBogoCopsBy $multiplier X]
            }
          }

          unset multiplier
        }
      }

      tputs $test_channel faster\n
    } elseif {$test_cops < $test_base_cops} then {
      if {![info exists no(slowerBogoCops)]} then {
        addConstraint sameOrSlowerBogoCops
        addConstraint slowerBogoCops

        if {![info exists no(bogoCopsMultipliers)]} then {
          foreach multiplier $test_base_cops_multipliers {
            if {$multiplier != 0 && \
                $test_cops <= $test_base_cops * (1.0 / $multiplier)} then {
              addConstraint [appendArgs slowerBogoCopsBy $multiplier X]
            }
          }

          unset multiplier
        }
      }

      tputs $test_channel slower\n
    } else {
      if {![info exists no(sameBogoCops)]} then {
        addConstraint sameOrFasterBogoCops
        addConstraint sameOrSlowerBogoCops
        addConstraint sameBogoCops
      }

      tputs $test_channel same\n
    }

    set percent [expr {[calculateRelativePerformance iterations 1] * 100}]

    tputs $test_channel [appendArgs \
        "---- current BogoCops (commands-per-second) is " [formatDecimal \
        [expr {$percent > 100 ? $percent - 100 : $percent}] 2] "% " \
        [expr {$percent > 100 ? "faster than" : "as fast as"}] \
        " the baseline\n"]

    unset percent
  }

  #############################################################################

  #
  # NOTE: Set the "long" timeout, if necessary.  This should be used
  #       for operations that may take a long time on slower machines.
  #
  if {![info exists test_long_timeout]} then {
    set test_long_timeout 60000; # in milliseconds.

    if {![info exists no(bogoCops)] && [haveConstraint performance]} then {
      set test_long_timeout [expr {
        int([calculateRelativePerformance elapsed $test_long_timeout])
      }]
    }
  }

  #############################################################################

  #
  # HACK: Next, check for any installed operating system updates.
  #       Since this can take a long time on slow machines, it is
  #       calibrated against the performance of this machine.
  #
  if {![info exists no(core)] && \
      ![info exists no(getInstalledUpdates)]} then {
    checkForGetInstalledUpdates $test_channel $test_long_timeout
  }

  if {![info exists no(core)] && \
      ![info exists no(operatingSystemUpdates)]} then {
    #
    # HACK: If the installed update names are not actually present
    #       in the extra operating system information yet, wait a
    #       little while for them to possibly appear.
    #
    if {[isEagle] && [haveConstraint getInstalledUpdates] && \
        [info exists tcl_platform(osExtra)] && \
        [lsearch -exact $tcl_platform(osExtra) UpdateNames] == -1} then {
      vwaitWithTimeout tcl_platform(osExtra) $test_long_timeout
    }

    checkForOperatingSystemUpdate $test_channel KB936929
    checkForOperatingSystemUpdate $test_channel KB976932
    checkForOperatingSystemUpdate $test_channel "Windows 10, RTM"
    checkForOperatingSystemUpdate $test_channel "Windows 10, November Update"
    checkForOperatingSystemUpdate $test_channel "Windows 10, Anniversary Update"
    checkForOperatingSystemUpdate $test_channel "Windows 10, Creators Update"
    checkForOperatingSystemUpdate $test_channel "Windows 10, Fall Creators Update"
    checkForOperatingSystemUpdate $test_channel "Windows 10, April 2018 Update"
    checkForOperatingSystemUpdate $test_channel "Windows 10, October 2018 Update"
    checkForOperatingSystemUpdate $test_channel "Windows 10, May 2019 Update"
    checkForOperatingSystemUpdate $test_channel "Windows 10, November 2019 Update"
    checkForOperatingSystemUpdate $test_channel "Windows 10, May 2020 Update"
    checkForOperatingSystemUpdate $test_channel "Windows 10, October 2020 Update"
    checkForOperatingSystemUpdate $test_channel "Windows 10, May 2021 Update"
    checkForOperatingSystemUpdate $test_channel "Windows 10, November 2021 Update"
    checkForOperatingSystemUpdate $test_channel "Windows 10, October 2022 Update"
    checkForOperatingSystemUpdate $test_channel "Windows 11, RTM"
    checkForOperatingSystemUpdate $test_channel "Windows 11, September 2022 Update"
    checkForOperatingSystemUpdate $test_channel "Windows 11, September 2023 Update"
  }

  #############################################################################

  #
  # NOTE: The test constraints should now be fully built, cache them.
  #
  if {![info exists test_constraints]} then {
    set test_constraints [getConstraints]
  }

  #############################################################################
  ######################## END Eagle & Tcl Constraints ########################
  #############################################################################

  if {[isEagle]} then {
    ###########################################################################
    ###################### BEGIN Late-Eagle Constraints #######################
    ###########################################################################

    #
    # NOTE: Has System.Data.SQLite testing support been disabled?
    #
    if {![info exists no(System.Data.SQLite)]} then {
      #
      # NOTE: For test "sql-1.19".
      #
      checkForSystemDataSQLite $test_channel

      #
      # NOTE: Has assembly loading support been disabled?
      #
      if {![haveConstraint System.Data.SQLite] && \
          ![info exists no(checkForAssembly)]} then {
        checkForAssembly $test_channel System.Data.SQLite
      }
    }

    ###########################################################################
    ####################### END Late-Eagle Constraints ########################
    ###########################################################################
  }

  #
  # NOTE: For Eagle, dump the platform information, including the compile
  #       options.
  #
  if {[isEagle]} then {
    set timeStamp [getPlatformInfo timeStamp ""]

    if {[string length $timeStamp] > 0} then {
      #########################################################################
      # MONO: Bug, see: https://bugzilla.novell.com/show_bug.cgi?id=479061
      #########################################################################

      if {[isMono]} then {
        #
        # HACK: We need something to go into the log file.
        #
        set timeStamp [lindex $timeStamp 0]
      } else {
        set timeStamp [formatTimeStamp [clock scan $timeStamp]]
      }
    } else {
      set timeStamp <none>
    }

    tputs $test_channel [appendArgs "---- build: " \
        [list [getPlatformInfo engine <none>]] " " \
        [list [getPlatformInfo patchLevel <none>]] " " \
        [list [getPlatformInfo tag <none>]] " " \
        [list [getPlatformInfo release <none>]] " " \
        [list [getPlatformInfo text <none>]] " " \
        [list [getPlatformInfo configuration <none>]] " " \
        [list [getPlatformInfo suffix <none>]] " " \
        [list $timeStamp] " " \
        [list [getPlatformInfo sourceId <none>]] " " \
        [list [getPlatformInfo sourceTimeStamp <none>]] \n]

    unset timeStamp

    tputs $test_channel [appendArgs "---- os: " \
        [getPlatformInfo os <none>] \n]

    tputs $test_channel [appendArgs "---- globalAssemblyCache: " \
        [getPlatformInfo globalAssemblyCache <none>] \n]

    tputs $test_channel [appendArgs "---- moduleVersionId: " \
        [getPlatformInfo moduleVersionId <none>] \n]

    if {![info exists no(showCompileOptions)]} then {
      tputs $test_channel [appendArgs "---- compileOptions: " \
          [formatList [getPlatformInfo compileOptions <none>]] \n]
    }

    tputs $test_channel [appendArgs "---- strongName: " \
        [getPlatformInfo strongName <none>] \n]

    tputs $test_channel [appendArgs "---- certificate: " \
        [getPlatformInfo certificate <none>] \n]

    tputs $test_channel [appendArgs "---- targetFramework: " \
        [getPlatformInfo targetFramework <none>] \n]
  }

  #
  # NOTE: Show the (dynamically calculated?) long timeout.
  #
  tputs $test_channel [appendArgs "---- test long timeout: " \
      [expr {[info exists test_long_timeout] ? \
          $test_long_timeout : "<none>"}] \n]

  #
  # NOTE: Show the current test file name, if any.
  #
  tputs $test_channel [appendArgs "---- test file: " \
      [expr {[info exists test_file] && [string length $test_file] > 0 ? \
      $test_file : "<none>"}] \n]

  #
  # NOTE: Maybe show the active test constraints.
  #
  if {![info exists no(showActiveConstraints)]} then {
    tputs $test_channel [appendArgs "---- active constraints: " \
        [formatList [lsort [getConstraints]] <none>] \n]
  }

  #
  # NOTE: Maybe show the cached test constraints.
  #
  if {![info exists no(showCachedConstraints)]} then {
    tputs $test_channel [appendArgs "---- cached constraints: " \
        [formatList [lsort [getCachedConstraints]] <none>] \n]
  }

  #
  # NOTE: Maybe show the lists of "well known" metadata.
  #
  if {![info exists no(showWellKnown)]} then {
    tputs $test_channel [appendArgs "---- well known metadata: " \
        [formatListAsDict [array get test_well_known] <none>] \n]
  }

  #
  # NOTE: Show the starting command count (for both Tcl and Eagle).
  #
  tputs $test_channel [appendArgs "---- starting command count: " \
      [info cmdcount] \n]

  if {[isEagle]} then {
    #
    # NOTE: Show the starting operation count (for Eagle only).
    #
    if {[llength [info commands object]] > 0} then {
      catch {
        object invoke -flags +NonPublic Interpreter.GetActive OperationCount
      } operationCount
    } else {
      set operationCount unavailable
    }

    tputs $test_channel [appendArgs "---- starting operation count: " \
        $operationCount \n]

    unset operationCount

    #
    # NOTE: Record the raw starting performance count, for later use in
    #       calculating the approximate number of microseconds elapsed.
    #
    catch {set test_timestamp(startCount) [clock start]}
  }

  #
  # NOTE: Load the test settings file(s) now, if any.
  #
  loadTestSettings $test_channel

  #
  # NOTE: Next, before doing *anything* else, remove all global variables
  #       that are not built-in, specifically allowed for use within the
  #       test suite, or specifically reserved for user-defined overrides.
  #
  if {![info exists no(cleanState)]} then {
    tputs $test_channel [appendArgs "---- cleaned up global state: " \
        [formatList [cleanState] <none>] \n]
  }

  #
  # NOTE: Show when the tests actually began (now).
  #
  tputs $test_channel [appendArgs "---- tests started at " \
      [formatTimeStamp [set test_timestamp(startSeconds) \
      [clock seconds]]] \n]
}

Added Externals/EntityFramework/v6.2/lib/net40/EntityFramework.SqlServer.dll.

cannot compute difference between binary files

Added Externals/EntityFramework/v6.2/lib/net40/EntityFramework.SqlServer.xml.















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>EntityFramework.SqlServer</name>
    </assembly>
    <members>
        <member name="T:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy">
            <summary>
            An <see cref="T:System.Data.Entity.Infrastructure.IDbExecutionStrategy"/> that retries actions that throw exceptions caused by SQL Azure transient failures.
            </summary>
            <remarks>
            This execution strategy will retry the operation on <see cref="T:System.TimeoutException"/> and <see cref="T:System.Data.SqlClient.SqlException"/>
            if the <see cref="P:System.Data.SqlClient.SqlException.Errors"/> contains any of the following error numbers:
            40613, 40501, 40197, 10929, 10928, 10060, 10054, 10053, 233, 64 and 20
            </remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy.#ctor">
            <summary>
            Creates a new instance of <see cref="T:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy"/>.
            </summary>
            <remarks>
            The default retry limit is 5, which means that the total amount of time spent between retries is 26 seconds plus the random factor.
            </remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy.#ctor(System.Int32,System.TimeSpan)">
            <summary>
            Creates a new instance of <see cref="T:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy"/> with the specified limits for
            number of retries and the delay between retries.
            </summary>
            <param name="maxRetryCount"> The maximum number of retry attempts. </param>
            <param name="maxDelay"> The maximum delay in milliseconds between retries. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy.ShouldRetryOn(System.Exception)">
            <inheritdoc/>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlFunctions">
            <summary>
            Contains function stubs that expose SqlServer methods in Linq to Entities.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.ChecksumAggregate(System.Collections.Generic.IEnumerable{System.Int32})">
            <summary>Returns the checksum of the values in a collection. Null values are ignored.</summary>
            <returns>The checksum computed from the input collection.</returns>
            <param name="arg">The collection of values over which the checksum is computed.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.ChecksumAggregate(System.Collections.Generic.IEnumerable{System.Nullable{System.Int32}})">
            <summary>Returns the checksum of the values in a collection. Null values are ignored.</summary>
            <returns>The checksum computed from the input collection.</returns>
            <param name="arg">The collection of values over which the checksum is computed.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Ascii(System.String)">
            <summary>Returns the ASCII code value of the left-most character of a character expression.</summary>
            <returns>The ASCII code of the first character in the input string.</returns>
            <param name="arg">A valid string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Char(System.Nullable{System.Int32})">
            <summary>Returns the character that corresponds to the specified integer ASCII value.</summary>
            <returns>The character that corresponds to the specified ASCII value.</returns>
            <param name="arg">An ASCII code.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.String,System.String)">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.Byte[],System.Byte[])">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.String,System.String,System.Nullable{System.Int32})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.Byte[],System.Byte[],System.Nullable{System.Int32})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.String,System.String,System.Nullable{System.Int64})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>
            A <see cref="T:System.Nullable`1" /> of <see cref="T:System.Int64" /> value that is the starting position of  toFind  if it is found in  toSearch .
            </returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.Byte[],System.Byte[],System.Nullable{System.Int64})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Difference(System.String,System.String)">
            <summary>Returns an integer value that indicates the difference between the SOUNDEX values of two character expressions.</summary>
            <returns>The SOUNDEX difference between the two strings.</returns>
            <param name="string1">The first string.</param>
            <param name="string2">The second string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.NChar(System.Nullable{System.Int32})">
            <summary>Returns the Unicode character with the specified integer code, as defined by the Unicode standard.</summary>
            <returns>The character that corresponds to the input character code.</returns>
            <param name="arg">A character code.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.PatIndex(System.String,System.String)">
            <summary>Returns the starting position of the first occurrence of a pattern in a specified expression, or zeros if the pattern is not found, on all valid text and character data types.</summary>
            <returns>The starting character position where the string pattern was found.</returns>
            <param name="stringPattern">A string pattern to search for.</param>
            <param name="target">The string to search.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.QuoteName(System.String)">
            <summary>Returns a Unicode string with the delimiters added to make the input string a valid Microsoft SQL Server delimited identifier.</summary>
            <returns>The original string with brackets added.</returns>
            <param name="stringArg">The expression that quote characters will be added to.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.QuoteName(System.String,System.String)">
            <summary>Returns a Unicode string with the delimiters added to make the input string a valid Microsoft SQL Server delimited identifier.</summary>
            <returns>The original string with the specified quote characters added.</returns>
            <param name="stringArg">The expression that quote characters will be added to.</param>
            <param name="quoteCharacter">The one-character string to use as the delimiter. It can be a single quotation mark ( ' ), a left or right bracket ( [ ] ), or a double quotation mark ( " ). If quote_character is not specified, brackets are used.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Replicate(System.String,System.Nullable{System.Int32})">
            <summary>Repeats a string value a specified number of times.</summary>
            <returns>The target string, repeated the number of times specified by  count .</returns>
            <param name="target">A valid string.</param>
            <param name="count">The value that specifies how many time to repeat  target .</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.SoundCode(System.String)">
            <summary>Converts an alphanumeric string to a four-character (SOUNDEX) code to find similar-sounding words or names.</summary>
            <returns>The SOUNDEX code of the input string.</returns>
            <param name="arg">A valid string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Space(System.Nullable{System.Int32})">
            <summary>Returns a string of repeated spaces.</summary>
            <returns>A string that consists of the specified number of spaces.</returns>
            <param name="arg1">The number of spaces. If negative, a null string is returned.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Double})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The numeric input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Decimal})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Double},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The numeric input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Decimal},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Double},System.Nullable{System.Int32},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The numeric input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
            <param name="decimalArg">The number of places to the right of the decimal point.  decimal  must be less than or equal to 16. If  decimal  is more than 16 then the result is truncated to sixteen places to the right of the decimal point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Decimal},System.Nullable{System.Int32},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
            <param name="decimalArg">The number of places to the right of the decimal point.  decimal  must be less than or equal to 16. If  decimal  is more than 16 then the result is truncated to sixteen places to the right of the decimal point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Stuff(System.String,System.Nullable{System.Int32},System.Nullable{System.Int32},System.String)">
            <summary>Inserts a string into another string. It deletes a specified length of characters in the target string at the start position and then inserts the second string into the target string at the start position.</summary>
            <returns>A string consisting of the two strings.</returns>
            <param name="stringInput">The target string.</param>
            <param name="start">The character position in  stringinput  where the replacement string is to be inserted.</param>
            <param name="length">The number of characters to delete from  stringInput . If  length  is longer than  stringInput , deletion occurs up to the last character in  stringReplacement .</param>
            <param name="stringReplacement">The substring to be inserted into  stringInput .</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Unicode(System.String)">
            <summary>Returns the integer value, as defined by the Unicode standard, for the first character of the input expression.</summary>
            <returns>The character code for the first character in the input string.</returns>
            <param name="arg">A valid string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Acos(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the angle, in radians, whose cosine is the specified numerical value. This angle is called the arccosine.</summary>
            <returns>The angle, in radians, defined by the input cosine value.</returns>
            <param name="arg1">The cosine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Acos(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the angle, in radians, whose cosine is the specified numerical value. This angle is called the arccosine.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg1">The cosine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Asin(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the angle, in radians, whose sine is the specified numerical value. This angle is called the arcsine.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The sine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Asin(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the angle, in radians, whose sine is the specified numerical value. This angle is called the arcsine.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The sine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the angle, in radians, whose tangent is the specified numerical value. This angle is called the arctangent.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The tangent of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the angle, in radians, whose tangent is the specified numerical value. This angle is called the arctangent.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The tangent of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan2(System.Nullable{System.Double},System.Nullable{System.Double})">
            <summary>Returns the positive angle, in radians, between the positive x-axis and the ray from the origin through the point (x, y), where x and y are the two specified numerical values. The first parameter passed to the function is the y-value and the second parameter is the x-value.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg1">The y-coordinate of a point.</param>
            <param name="arg2">The x-coordinate of a point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan2(System.Nullable{System.Decimal},System.Nullable{System.Decimal})">
            <summary>Returns the positive angle, in radians, between the positive x-axis and the ray from the origin through the point (x, y), where x and y are the two specified numerical values. The first parameter passed to the function is the y-value and the second parameter is the x-value.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg1">The y-coordinate of a point.</param>
            <param name="arg2">The x-coordinate of a point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cos(System.Nullable{System.Double})">
            <summary>Returns the trigonometric cosine of the specified angle, in radians, in the specified expression.</summary>
            <returns>The trigonometric cosine of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cos(System.Nullable{System.Decimal})">
            <summary>Returns the trigonometric cosine of the specified angle, in radians, in the specified expression.</summary>
            <returns>The trigonometric cosine of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cot(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the trigonometric cotangent of the specified angle, in radians.</summary>
            <returns>The trigonometric cotangent of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cot(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the trigonometric cotangent of the specified angle, in radians.</summary>
            <returns>The trigonometric cotangent of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Int32})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Int64})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Decimal})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Double})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Exp(System.Nullable{System.Double})">
            <summary>Returns the exponential value of the specified float expression.</summary>
            <returns>The constant e raised to the power of the input value.</returns>
            <param name="arg">The input value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Exp(System.Nullable{System.Decimal})">
            <summary>Returns the exponential value of the specified float expression.</summary>
            <returns>The constant e raised to the power of the input value.</returns>
            <param name="arg">The input value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log(System.Nullable{System.Double})">
            <summary>Returns the natural logarithm of the specified input value.</summary>
            <returns>The natural logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log(System.Nullable{System.Decimal})">
            <summary>Returns the natural logarithm of the specified input value.</summary>
            <returns>The natural logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log10(System.Nullable{System.Double})">
            <summary>Returns the base-10 logarithm of the specified input value.</summary>
            <returns>The base-10 logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log10(System.Nullable{System.Decimal})">
            <summary>Returns the base-10 logarithm of the specified input value.</summary>
            <returns>The base-10 logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Pi">
            <summary>Returns the constant value of pi.</summary>
            <returns>The numeric value of pi.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Int32})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Int64})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Decimal})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Double})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Rand">
            <summary>Returns a pseudo-random float value from 0 through 1, exclusive.</summary>
            <returns>The pseudo-random value.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Rand(System.Nullable{System.Int32})">
            <summary>Returns a pseudo-random float value from 0 through 1, exclusive.</summary>
            <returns>The pseudo-random value.</returns>
            <param name="seed">The seed value. If  seed  is not specified, the SQL Server Database Engine assigns a seed value at random. For a specified seed value, the result returned is always the same.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Int32})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Int64})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Decimal})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Double})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sin(System.Nullable{System.Decimal})">
            <summary>Returns the trigonometric sine of the specified angle.</summary>
            <returns>The trigonometric sine of the input expression.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sin(System.Nullable{System.Double})">
            <summary>Returns the trigonometric sine of the specified angle.</summary>
            <returns>The trigonometric sine of the input expression.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.SquareRoot(System.Nullable{System.Double})">
            <summary>Returns the square root of the specified number.</summary>
            <returns>The square root of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.SquareRoot(System.Nullable{System.Decimal})">
            <summary>Returns the square root of the specified number.</summary>
            <returns>The square root of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Square(System.Nullable{System.Double})">
            <summary>Returns the square of the specified number.</summary>
            <returns>The square of the input value.</returns>
            <param name="arg1">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Square(System.Nullable{System.Decimal})">
            <summary>Returns the square of the specified number.</summary>
            <returns>The square of the input value.</returns>
            <param name="arg1">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Tan(System.Nullable{System.Double})">
            <summary>Returns the trigonometric tangent of the input expression.</summary>
            <returns>The tangent of the input angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Tan(System.Nullable{System.Decimal})">
            <summary>Returns the trigonometric tangent of the input expression.</summary>
            <returns>The tangent of the input angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.Nullable{System.DateTime})">
            <summary>Returns a new datetime value based on adding an interval to the specified date.</summary>
            <returns>The new date.</returns>
            <param name="datePartArg">The part of the date to increment. </param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="date">The date to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.Nullable{System.TimeSpan})">
            <summary>Returns a new time span value based on adding an interval to the specified time span.</summary>
            <returns>The new time span.</returns>
            <param name="datePartArg">The part of the date to increment.</param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="time">The time span to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.Nullable{System.DateTimeOffset})">
            <summary>Returns a new date value based on adding an interval to the specified date.</summary>
            <returns>The new point in time, expressed as a date and time of day, relative to Coordinated Universal Time (UTC).</returns>
            <param name="datePartArg">The part of the date to increment.</param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="dateTimeOffsetArg">The date to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.String)">
            <summary>Returns a new datetime value based on adding an interval to the specified date.</summary>
            <returns>
            A <see cref="T:System.Nullable`1" /> of <see cref="T:System.DateTime" /> value that is the new date.
            </returns>
            <param name="datePartArg">The part of the date to increment.</param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="date">The date to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The value specifying the number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two Dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.Nullable{System.DateTime})">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.String)">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.Nullable{System.TimeSpan})">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.Nullable{System.DateTimeOffset})">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.Nullable{System.DateTime})">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The the specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.Nullable{System.DateTimeOffset})">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.String)">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.Nullable{System.TimeSpan})">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.GetDate">
            <summary>Returns the current database system timestamp as a datetime value without the database time zone offset. This value is derived from the operating system of the computer on which the instance of SQL Server is running.</summary>
            <returns>The current database timestamp.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.GetUtcDate">
            <summary>Returns the current database system timestamp as a datetime value. The database time zone offset is not included. This value represents the current UTC time (Coordinated Universal Time). This value is derived from the operating system of the computer on which the instance of SQL Server is running.</summary>
            <returns>The current database UTC timestamp.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Boolean})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Double})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Decimal})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.DateTime})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.TimeSpan})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.DateTimeOffset})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.String)">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Byte[])">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Guid})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Boolean})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Double})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Decimal})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.String)">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTime})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.TimeSpan})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTimeOffset})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Byte[])">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The character array for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Guid})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Double},System.Nullable{System.Double})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Decimal},System.Nullable{System.Decimal})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.String,System.String)">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTime},System.Nullable{System.DateTime})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Byte[],System.Byte[])">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The character array for which the checksum is calculated.</param>
            <param name="arg2">The character array for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Guid},System.Nullable{System.Guid})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Double})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Decimal},System.Nullable{System.Decimal},System.Nullable{System.Decimal})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.String,System.String,System.String)">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTime},System.Nullable{System.DateTime},System.Nullable{System.DateTime})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Byte[],System.Byte[],System.Byte[])">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The character array for which the checksum is calculated.</param>
            <param name="arg2">The character array for which the checksum is calculated.</param>
            <param name="arg3">The character array for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Guid},System.Nullable{System.Guid},System.Nullable{System.Guid})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CurrentTimestamp">
            <summary>Returns the current date and time. </summary>
            <returns>The current date and time.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CurrentUser">
            <summary>Returns the name of the current user.</summary>
            <returns>The name of the current user.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.HostName">
            <summary>Returns the workstation name.</summary>
            <returns>The name of the workstation.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.UserName(System.Nullable{System.Int32})">
            <summary>Returns a database user name corresponding to a specified identification number.</summary>
            <returns>The user name.</returns>
            <param name="arg">A user ID.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.UserName">
            <summary>Returns a database user name corresponding to a specified identification number.</summary>
            <returns>The user name.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.IsNumeric(System.String)">
            <summary>Indicates whether the input value is a valid numeric type.</summary>
            <returns>1 if the input expression is a valid numeric data type; otherwise, 0.</returns>
            <param name="arg">A string expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.IsDate(System.String)">
            <summary>Indicates whether the input value is a valid date or time.</summary>
            <returns>1 if the input expression is a valid date or time value of datetime or smalldatetime data types; otherwise, 0.</returns>
            <param name="arg">The tested value.</param>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator">
            <summary>
            Provider to convert provider agnostic migration operations into SQL commands
            that can be run against a Microsoft SQL Server database.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.IsPermissionDeniedError(System.Exception)">
            <summary>
            Determines if a provider specific exception corresponds to a database-level permission denied error.
            </summary>
            <param name="exception">The database exception.</param>
            <returns> true if the supplied exception corresponds to a database-level permission denied error; otherwise false. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Collections.Generic.IEnumerable{System.Data.Entity.Migrations.Model.MigrationOperation},System.String)">
            <summary>
            Converts a set of migration operations into Microsoft SQL Server specific SQL.
            </summary>
            <param name="migrationOperations"> The operations to be converted. </param>
            <param name="providerManifestToken"> Token representing the version of SQL Server being targeted (i.e. "2005", "2008"). </param>
            <returns> A list of SQL statements to be executed to perform the migration operations. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GenerateProcedureBody(System.Collections.Generic.ICollection{System.Data.Entity.Core.Common.CommandTrees.DbModificationCommandTree},System.String,System.String)">
            <summary>
            Generates the SQL body for a stored procedure.
            </summary>
            <param name="commandTrees">The command trees representing the commands for an insert, update or delete operation.</param>
            <param name="rowsAffectedParameter">The rows affected parameter name.</param>
            <param name="providerManifestToken">The provider manifest token.</param>
            <returns>The SQL body for the stored procedure.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.UpdateDatabaseOperation)">
            <summary>
            Generates the specified update database operation which represents applying a series of migrations.
            The generated script is idempotent, meaning it contains conditional logic to check if individual migrations 
            have already been applied and only apply the pending ones.
            </summary>
            <param name="updateDatabaseOperation">The update database operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.MigrationOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.MigrationOperation"/>.
            Allows derived providers to handle additional operation types.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="migrationOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.CreateConnection">
            <summary>
            Creates an empty connection for the current provider.
            Allows derived providers to use connection other than <see cref="T:System.Data.SqlClient.SqlConnection"/>.
            </summary>
            <returns> An empty connection for the current provider. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.CreateProcedureOperation)">
            <summary>
            Generates the specified create procedure operation.
            </summary>
            <param name="createProcedureOperation">The create procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AlterProcedureOperation)">
            <summary>
            Generates the specified alter procedure operation.
            </summary>
            <param name="alterProcedureOperation">The alter procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropProcedureOperation)">
            <summary>
            Generates the specified drop procedure operation.
            </summary>
            <param name="dropProcedureOperation">The drop procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.CreateTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.CreateTableOperation"/>. This method differs from
            <see cref="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.WriteCreateTable(System.Data.Entity.Migrations.Model.CreateTableOperation)"/> in that it will
            create the target database schema if it does not already exist.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.WriteCreateTable(System.Data.Entity.Migrations.Model.CreateTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.CreateTableOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.WriteCreateTable(System.Data.Entity.Migrations.Model.CreateTableOperation,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Writes CREATE TABLE SQL to the target writer.
            </summary>
            <param name="createTableOperation"> The operation to produce SQL for. </param>
            <param name="writer"> The target writer. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AlterTableOperation)">
            <summary>
            Override this method to generate SQL when the definition of a table or its attributes are changed.
            The default implementation of this method does nothing.
            </summary>
            <param name="alterTableOperation"> The operation describing changes to the table. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GenerateMakeSystemTable(System.Data.Entity.Migrations.Model.CreateTableOperation,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Generates SQL to mark a table as a system table.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createTableOperation"> The table to mark as a system table. </param>
            <param name="writer"> The <see cref="T:System.Data.Entity.Migrations.Utilities.IndentedTextWriter"/> to write the generated SQL to. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GenerateCreateSchema(System.String)">
            <summary>
            Generates SQL to create a database schema.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="schema"> The name of the schema to create. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AddForeignKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AddForeignKeyOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="addForeignKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropForeignKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropForeignKeyOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropForeignKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.CreateIndexOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.CreateIndexOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createIndexOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropIndexOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropIndexOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropIndexOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AddPrimaryKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AddPrimaryKeyOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="addPrimaryKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropPrimaryKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropPrimaryKeyOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropPrimaryKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AddColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AddColumnOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="addColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropColumnOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AlterColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AlterColumnOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="alterColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.DropDefaultConstraint(System.String,System.String,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Call this method to generate SQL that will attempt to drop the default constraint created
            when a column is created. This method is usually called by code that overrides the creation or
            altering of columns.
            </summary>
            <param name="table">The table to which the constraint applies.</param>
            <param name="column">The column to which the constraint applies.</param>
            <param name="writer">The writer to which generated SQL should be written.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropTableOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.SqlOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.SqlOperation"/>.
            Generated SQL should be added using the Statement or StatementBatch methods.
            </summary>
            <param name="sqlOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.RenameColumnOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="renameColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameIndexOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.RenameIndexOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="renameIndexOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.RenameTableOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="renameTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameProcedureOperation)">
            <summary>
            Generates the specified rename procedure operation.
            </summary>
            <param name="renameProcedureOperation">The rename procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.MoveProcedureOperation)">
            <summary>
            Generates the specified move procedure operation.
            </summary>
            <param name="moveProcedureOperation">The move procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.MoveTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.MoveTableOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="moveTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.ColumnModel,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Generates SQL for the given column model. This method is called by other methods that
            process columns and can be overridden to change the SQL generated.
            </summary>
            <param name="column">The column for which SQL is being generated.</param>
            <param name="writer">The writer to which generated SQL should be written.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.HistoryOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.HistoryOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="historyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Byte[])">
            <summary>
            Generates SQL to specify a constant byte[] default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Boolean)">
            <summary>
            Generates SQL to specify a constant bool default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.DateTime)">
            <summary>
            Generates SQL to specify a constant DateTime default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.DateTimeOffset)">
            <summary>
            Generates SQL to specify a constant DateTimeOffset default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Guid)">
            <summary>
            Generates SQL to specify a constant Guid default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.String)">
            <summary>
            Generates SQL to specify a constant string default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.TimeSpan)">
            <summary>
            Generates SQL to specify a constant TimeSpan default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Spatial.DbGeography)">
            <summary>
            Generates SQL to specify a constant geogrpahy default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Spatial.DbGeometry)">
            <summary>
            Generates SQL to specify a constant geometry default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Object)">
            <summary>
            Generates SQL to specify a constant default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.BuildColumnType(System.Data.Entity.Migrations.Model.ColumnModel)">
            <summary>
            Generates SQL to specify the data type of a column.
            This method just generates the actual type, not the SQL to create the column.
            </summary>
            <param name="columnModel"> The definition of the column. </param>
            <returns> SQL representing the data type. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Name(System.String)">
            <summary>
            Generates a quoted name. The supplied name may or may not contain the schema.
            </summary>
            <param name="name"> The name to be quoted. </param>
            <returns> The quoted name. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Quote(System.String)">
            <summary>
            Quotes an identifier for SQL Server.
            </summary>
            <param name="identifier"> The identifier to be quoted. </param>
            <returns> The quoted identifier. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Statement(System.String,System.Boolean,System.String)">
            <summary>
            Adds a new Statement to be executed against the database.
            </summary>
            <param name="sql"> The statement to be executed. </param>
            <param name="suppressTransaction"> Gets or sets a value indicating whether this statement should be performed outside of the transaction scope that is used to make the migration process transactional. If set to true, this operation will not be rolled back if the migration process fails. </param>
            <param name="batchTerminator">The batch terminator for the database provider.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Writer">
            <summary>
            Gets a new <see cref="T:System.Data.Entity.Migrations.Utilities.IndentedTextWriter"/> that can be used to build SQL.
            This is just a helper method to create a writer. Writing to the writer will
            not cause SQL to be registered for execution. You must pass the generated
            SQL to the Statement method.
            </summary>
            <returns> An empty text writer to use for SQL generation. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Statement(System.Data.Entity.Migrations.Utilities.IndentedTextWriter,System.String)">
            <summary>
            Adds a new Statement to be executed against the database.
            </summary>
            <param name="writer"> The writer containing the SQL to be executed. </param>
            <param name="batchTerminator">The batch terminator for the database provider.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.StatementBatch(System.String,System.Boolean)">
            <summary>
            Breaks sql string into one or more statements, handling T-SQL utility statements as necessary.
            </summary>
            <param name="sqlBatch"> The SQL to split into one ore more statements to be executed. </param>
            <param name="suppressTransaction"> Gets or sets a value indicating whether this statement should be performed outside of the transaction scope that is used to make the migration process transactional. If set to true, this operation will not be rolled back if the migration process fails. </param>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GuidColumnDefault">
            <summary>
            Returns the column default value to use for store-generated GUID columns when
            no default value is explicitly specified in the migration.
            Returns newsequentialid() for on-premises SQL Server 2005 and later.
            Returns newid() for SQL Azure.
            </summary>
            <value>Either newsequentialid() or newid() as described above.</value>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlSpatialFunctions">
            <summary>
            Contains function stubs that expose SqlServer methods in Linq to Entities.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.PointGeography(System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Int32})">
            <summary>Constructs a geography instance representing a Point instance from its x and y values and a spatial reference ID (SRID). </summary>
            <returns>The constructed geography instance.</returns>
            <param name="latitude">The x-coordinate of the Point being generated.</param>
            <param name="longitude">The y-coordinate of the Point being generated</param>
            <param name="spatialReferenceId">The SRID of the geography instance.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.AsTextZM(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns the Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geography instance augmented with any Z (elevation) and M (measure) values carried by the instance.</summary>
            <returns>The Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geography instance.</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.BufferWithTolerance(System.Data.Entity.Spatial.DbGeography,System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Boolean})">
            <summary>Returns a geometric object representing the union of all point values whose distance from a geography instance is less than or equal to a specified value, allowing for a specified tolerance.</summary>
            <returns>The union of all point values whose distance from a geography instance is less than or equal to a specified value</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="distance">The distance.</param>
            <param name="tolerance">The specified tolerance.</param>
            <param name="relative">Specifying whether the tolerance value is relative or absolute.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.EnvelopeAngle(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns the maximum angle between the point returned by EnvelopeCenter() and a point in the geography instance in degrees.</summary>
            <returns>the maximum angle between the point returned by EnvelopeCenter().</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.EnvelopeCenter(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns a point that can be used as the center of a bounding circle for the geography instance.</summary>
            <returns>A SqlGeography value that specifies the location of the center of a bounding circle.</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Filter(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <summary>Offers a fast, index-only intersection method to determine if a geography instance intersects another SqlGeography instance, assuming an index is available.</summary>
            <returns>True if a geography instance potentially intersects another SqlGeography instance; otherwise, false.</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="geographyOther">Another geography instance to compare against the instance on which Filter is invoked.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.InstanceOf(System.Data.Entity.Spatial.DbGeography,System.String)">
            <summary>Tests if the SqlGeography instance is the same as the specified type.</summary>
            <returns>A string that specifies one of the 12 types exposed in the geography type hierarchy.</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="geometryTypeName">A string that specifies one of the 12 types exposed in the geography type hierarchy.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.NumRings(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns the total number of rings in a Polygon instance.</summary>
            <returns>The total number of rings.</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Reduce(System.Data.Entity.Spatial.DbGeography,System.Nullable{System.Double})">
            <summary>Returns an approximation of the given geography instance produced by running the Douglas-Peucker algorithm on the instance with the given tolerance.</summary>
            <returns>
            Returns <see cref="T:System.Data.Entity.Spatial.DbGeography" />.
            </returns>
            <param name="geographyValue">The geography value.</param>
            <param name="tolerance">The tolerance to input to the Douglas-Peucker algorithm. tolerance must be a positive number.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.RingN(System.Data.Entity.Spatial.DbGeography,System.Nullable{System.Int32})">
            <summary>Returns the specified ring of the SqlGeography instance: 1 ≤ n ≤ NumRings().</summary>
            <returns>A SqlGeography object that represents the ring specified by n.</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="index">An int expression between 1 and the number of rings in a polygon instance.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.PointGeometry(System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Int32})">
            <summary>Constructs a geometry instance representing a Point instance from its x and y values and a spatial reference ID (SRID). </summary>
            <returns>The constructed geometry instance.</returns>
            <param name="xCoordinate">The x-coordinate of the Point being generated.</param>
            <param name="yCoordinate">The y-coordinate of the Point being generated</param>
            <param name="spatialReferenceId">The SRID of the geography instance.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.AsTextZM(System.Data.Entity.Spatial.DbGeometry)">
            <summary>Returns the Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geography instance augmented with any Z (elevation) and M (measure) values carried by the instance.</summary>
            <returns>The Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geometry instance.</returns>
            <param name="geometryValue">The geometry value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.BufferWithTolerance(System.Data.Entity.Spatial.DbGeometry,System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Boolean})">
            <summary>Returns a geometric object representing the union of all point values whose distance from a geometry instance is less than or equal to a specified value, allowing for a specified tolerance.</summary>
            <returns>The union of all point values whose distance from a geometry instance is less than or equal to a specified value</returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="distance">The distance.</param>
            <param name="tolerance">The specified tolerance.</param>
            <param name="relative">Specifying whether the tolerance value is relative or absolute.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.InstanceOf(System.Data.Entity.Spatial.DbGeometry,System.String)">
            <summary>Tests if the SqlGeometry instance is the same as the specified type.</summary>
            <returns>A string that specifies one of the 12 types exposed in the geography type hierarchy.</returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="geometryTypeName">A string that specifies one of the 12 types exposed in the geography type hierarchy.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Filter(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <summary>Offers a fast, index-only intersection method to determine if a geography instance intersects another SqlGeometry instance, assuming an index is available.</summary>
            <returns>True if a geography instance potentially intersects another SqlGeography instance; otherwise, false.</returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="geometryOther">Another geography instance to compare against the instance on which Filter is invoked.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.MakeValid(System.Data.Entity.Spatial.DbGeometry)">
            <summary>Converts an invalid geometry instance into a geometry instance with a valid Open Geospatial Consortium (OGC) type. </summary>
            <returns>The converted geometry instance.</returns>
            <param name="geometryValue">The geometry value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Reduce(System.Data.Entity.Spatial.DbGeometry,System.Nullable{System.Double})">
            <summary>Returns an approximation of the given geography instance produced by running the Douglas-Peucker algorithm on the instance with the given tolerance.</summary>
            <returns>
            Returns <see cref="T:System.Data.Entity.Spatial.DbGeometry" />.
            </returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="tolerance">The tolerance to input to the Douglas-Peucker algorithm. tolerance must be a positive number.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderManifest.SupportsParameterOptimizationInSchemaQueries">
            <summary>
            Indicates if the provider supports the parameter optimization described in EntityFramework6 GitHub issue #195.
            </summary>
            <returns><c>True</c> since this provider supports the parameter optimization.</returns>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlProviderServices">
            <summary>
            The DbProviderServices implementation for the SqlClient provider for SQL Server.
            </summary>
            <remarks>
            Note that instance of this type also resolve additional provider services for Microsoft SQL Server
            when this type is registered as an EF provider either using an entry in the application's config file
            or through code-based registration in <see cref="T:System.Data.Entity.DbConfiguration"/>.
            The services resolved are:
            Requests for <see cref="T:System.Data.Entity.Infrastructure.IDbConnectionFactory"/> are resolved to a Singleton instance of
            <see cref="T:System.Data.Entity.Infrastructure.SqlConnectionFactory"/> to create connections to SQL Express by default.
            Requests for <see cref="T:System.Func`1"/> for the invariant name "System.Data.SqlClient"
            for any server name are resolved to a delegate that returns a <see cref="T:System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy"/>
            to provide a non-retrying policy for SQL Server.
            Requests for <see cref="T:System.Data.Entity.Migrations.Sql.MigrationSqlGenerator"/> for the invariant name "System.Data.SqlClient" are
            resolved to <see cref="T:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator"/> instances to provide default Migrations SQL
            generation for SQL Server.
            Requests for <see cref="T:System.Data.Entity.Spatial.DbSpatialServices"/> for the invariant name "System.Data.SqlClient" are
            resolved to a Singleton instance of <see cref="T:System.Data.Entity.SqlServer.SqlSpatialServices"/> to provide default spatial
            services for SQL Server.
            </remarks>
        </member>
        <member name="F:System.Data.Entity.SqlServer.SqlProviderServices.ProviderInvariantName">
            <summary>
            This is the well-known string using in configuration files and code-based configuration as
            the "provider invariant name" used to specify Microsoft SQL Server for ADO.NET and
            Entity Framework provider services.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.RegisterInfoMessageHandler(System.Data.Common.DbConnection,System.Action{System.String})">
            <summary>
            Registers a handler to process non-error messages coming from the database provider.
            </summary>
            <param name="connection"> The connection to receive information for. </param>
            <param name="handler"> The handler to process messages. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.CreateDbCommandDefinition(System.Data.Entity.Core.Common.DbProviderManifest,System.Data.Entity.Core.Common.CommandTrees.DbCommandTree)">
            <summary>
            Create a Command Definition object, given the connection and command tree
            </summary>
            <param name="providerManifest"> provider manifest that was determined from metadata </param>
            <param name="commandTree"> command tree for the statement </param>
            <returns> an executable command definition object </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.CloneDbCommand(System.Data.Common.DbCommand)">
            <summary>
            See issue 2390 - cloning the DesignTimeVisible property on the
            <see cref="T:System.Data.SqlClient.SqlCommand" /> can cause deadlocks.
            So here overriding to provide a method that does not clone DesignTimeVisible.
            </summary>
            <param name="fromDbCommand"> the <see cref="T:System.Data.Common.DbCommand" /> object to clone </param>
            <returns >a clone of the <see cref="T:System.Data.Common.DbCommand" /> </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.SetDbParameterValue(System.Data.Common.DbParameter,System.Data.Entity.Core.Metadata.Edm.TypeUsage,System.Object)">
            <summary>
            Sets the parameter value and appropriate facets for the given <see cref="T:System.Data.Entity.Core.Metadata.Edm.TypeUsage"/>.
            </summary>
            <param name="parameter">The parameter.</param>
            <param name="parameterType">The type of the parameter.</param>
            <param name="value">The value of the parameter.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.GetDbProviderManifestToken(System.Data.Common.DbConnection)">
            <summary>
            Returns provider manifest token for a given connection.
            </summary>
            <param name="connection"> Connection to find manifest token from. </param>
            <returns> The provider manifest token for the specified connection. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.GetDbProviderManifest(System.String)">
            <summary>
            Returns the provider manifest by using the specified version information.
            </summary>
            <param name="versionHint"> The token information associated with the provider manifest. </param>
            <returns> The provider manifest by using the specified version information. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.GetDbSpatialDataReader(System.Data.Common.DbDataReader,System.String)">
            <summary>
            Gets a spatial data reader for SQL Server.
            </summary>
            <param name="fromReader"> The reader where the spatial data came from. </param>
            <param name="versionHint"> The manifest token associated with the provider manifest. </param>
            <returns> The spatial data reader. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbGetSpatialServices(System.String)">
            <summary>
            Gets a spatial data reader for SQL Server.
            </summary>
            <param name="versionHint"> The manifest token associated with the provider manifest. </param>
            <returns> The spatial data reader. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabaseScript(System.String,System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Generates a data definition language (DDL) script that creates schema objects 
            (tables, primary keys, foreign keys) based on the contents of the StoreItemCollection 
            parameter and targeted for the version of the database corresponding to the provider manifest token.
            </summary>
            <param name="providerManifestToken"> The provider manifest token identifying the target version. </param>
            <param name="storeItemCollection"> The structure of the database. </param>
            <returns>
            A DDL script that creates schema objects based on the contents of the StoreItemCollection parameter 
            and targeted for the version of the database corresponding to the provider manifest token.
            </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabase(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Create the database and the database objects.
            If initial catalog is not specified, but AttachDBFilename is specified, we generate a random database name based on the AttachDBFilename.
            Note: this causes pollution of the db, as when the connection string is later used, the mdf will get attached under a different name.
            However if we try to replicate the name under which it would be attached, the following scenario would fail:
            The file does not exist, but registered with database.
            The user calls:  If (DatabaseExists) DeleteDatabase
            CreateDatabase
            For further details on the behavior when AttachDBFilename is specified see Dev10# 188936
            </summary>
            <param name="connection">Connection to a non-existent database that needs to be created and populated with the store objects indicated with the storeItemCollection parameter.</param>
            <param name="commandTimeout">Execution timeout for any commands needed to create the database.</param>
            <param name="storeItemCollection">The collection of all store items based on which the script should be created.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbDatabaseExists(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Determines whether the database for the given connection exists.
            There are three cases:
            1.  Initial Catalog = X, AttachDBFilename = null:   (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            2.  Initial Catalog = X, AttachDBFilename = F:      if (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0 then <c>true</c>,
            if not, try to open the connection and then return (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            3.  Initial Catalog = null, AttachDBFilename = F:   Try to open the connection. If that succeeds the result is true, otherwise
            if the there are no databases corresponding to the given file return <c>false</c>, otherwise throw.
            Note: We open the connection to cover the scenario when the mdf exists, but is not attached.
            Given that opening the connection would auto-attach it, it would not be appropriate to return <c>false</c> in this case.
            Also note that checking for the existence of the file does not work for a remote server.  (Dev11 #290487)
            For further details on the behavior when AttachDBFilename is specified see Dev10# 188936
            </summary>
            <param name="connection">Connection to a database whose existence is checked by this method.</param>
            <param name="commandTimeout">Execution timeout for any commands needed to determine the existence of the database.</param>
            <param name="storeItemCollection">The collection of all store items from the model. This parameter is no longer used for determining database existence.</param>
            <returns>True if the provider can deduce the database only based on the connection.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbDatabaseExists(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Lazy{System.Data.Entity.Core.Metadata.Edm.StoreItemCollection})">
            <summary>
            Determines whether the database for the given connection exists.
            There are three cases:
            1.  Initial Catalog = X, AttachDBFilename = null:   (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            2.  Initial Catalog = X, AttachDBFilename = F:      if (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0 then <c>true</c>,
            if not, try to open the connection and then return (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            3.  Initial Catalog = null, AttachDBFilename = F:   Try to open the connection. If that succeeds the result is true, otherwise
            if the there are no databases corresponding to the given file return <c>false</c>, otherwise throw.
            Note: We open the connection to cover the scenario when the mdf exists, but is not attached.
            Given that opening the connection would auto-attach it, it would not be appropriate to return <c>false</c> in this case.
            Also note that checking for the existence of the file does not work for a remote server.  (Dev11 #290487)
            For further details on the behavior when AttachDBFilename is specified see Dev10# 188936
            </summary>
            <param name="connection">Connection to a database whose existence is checked by this method.</param>
            <param name="commandTimeout">Execution timeout for any commands needed to determine the existence of the database.</param>
            <param name="storeItemCollection">The collection of all store items from the model. This parameter is no longer used for determining database existence.</param>
            <returns>True if the provider can deduce the database only based on the connection.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbDeleteDatabase(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Delete the database for the given connection.
            There are three cases:
            1.  If Initial Catalog is specified (X) drop database X
            2.  Else if AttachDBFilename is specified (F) drop all the databases corresponding to F
            if none throw
            3.  If niether the catalog not the file name is specified - throw
            Note that directly deleting the files does not work for a remote server.  However, even for not attached
            databases the current logic would work assuming the user does: if (DatabaseExists) DeleteDatabase
            </summary>
            <param name="connection"> Connection </param>
            <param name="commandTimeout"> Timeout for internal commands. </param>
            <param name="storeItemCollection"> Item Collection. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.CloneDbConnection(System.Data.Common.DbConnection,System.Data.Common.DbProviderFactory)">
            <summary>
            Clones the connection.
            </summary>
            <param name="connection">The original connection.</param>
            <param name="factory">The factory to use.</param>
            <returns>Cloned connection</returns>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.Instance">
            <summary>
            The Singleton instance of the SqlProviderServices type.
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.SqlServerTypesAssemblyName">
            <summary>
            Set to the full name of the Microsoft.SqlServer.Types assembly to override the default selection
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.TruncateDecimalsToScale">
            <summary>
            Get or sets a value indicating whether <see cref="T:System.Decimal"/> parameter values are truncated to 
            the scale (number of decimal places) defined for their corresponding columns when they are sent 
            to the database. A value of <c>true</c> indicates that <see cref="T:System.Data.SqlClient.SqlParameter"/> objects 
            created for <see cref="T:System.Decimal"/> columns will have their <see cref="P:System.Data.SqlClient.SqlParameter.Scale"/> 
            properties set, which will cause the parameter values to be truncated. If set to <c>false</c> 
            then the <see cref="P:System.Data.SqlClient.SqlParameter.Scale"/> properties will not be set, avoiding the truncation 
            behavior of <see cref="T:System.Data.SqlClient.SqlParameter"/> and allowing SQL Server to round values if necessary. 
            The default value is <c>true</c> to prevent breaking existing applications that depend on this 
            behavior. 
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.UseScopeIdentity">
            <summary>
            Gets or sets a value indicating whether to use the SCOPE_IDENTITY() function to retrieve values 
            generated by the database for numeric columns during an INSERT operation. The default value of 
            <c>true</c> is recommended and can provide better performance if all numeric values are generated 
            using IDENTITY columns. If set to <c>false</c>, an OUTPUT clause will be used instead. An OUTPUT 
            clause makes it possible to retrieve values generated by sequences or other means.
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.UseRowNumberOrderingInOffsetQueries">
            <summary>
            Gets or sets a value indicating whether the ROW_NUMBER() function is used in sort expression 
            passed to the ORDER BY clause when OFFSET is present in query. The default value of <c>true</c> 
            is recommended to obtain query results that are stable for paging operations. The value of 
            <c>false</c> can be used for compatibility with previous versions of EF and will cause the sort 
            expression to be passed unmodified to the ORDER BY clause, which can lead to unstable results 
            if the ordering is ambiguous. 
            </summary>
            <remarks>
            This flag only applies to SQL Server 2012 or later. This flag does not affect queries that have 
            already been translated to SQL and cached, therefore applications that need to set the value to 
            <c>false</c> for compatibility should do so before executing any queries.
            </remarks>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlSpatialServices">
            <summary>
            An implementation of <see cref="T:System.Data.Entity.Spatial.DbSpatialServices"/> to provide support for geospatial types when using
            Entity Framework with Microsoft SQL Server.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateProviderValue(System.Data.Entity.Spatial.DbGeographyWellKnownValue)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromProviderValue(System.Object)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateWellKnownValue(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateProviderValue(System.Data.Entity.Spatial.DbGeometryWellKnownValue)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromProviderValue(System.Object)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateWellKnownValue(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsTextIncludingElevationAndMeasure(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsTextIncludingElevationAndMeasure(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromText(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyCollectionFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromBinary(System.Byte[])">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyCollectionFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromGml(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromGml(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetCoordinateSystemId(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetSpatialTypeName(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetDimension(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsBinary(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsGml(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsText(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsEmpty(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SpatialEquals(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Disjoint(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersects(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Buffer(System.Data.Entity.Spatial.DbGeography,System.Double)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Distance(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersection(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Union(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Difference(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SymmetricDifference(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElementCount(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.ElementAt(System.Data.Entity.Spatial.DbGeography,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLatitude(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLongitude(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElevation(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetMeasure(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLength(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetStartPoint(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetEndPoint(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsClosed(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetPointCount(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.PointAt(System.Data.Entity.Spatial.DbGeography,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetArea(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromText(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryCollectionFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromBinary(System.Byte[])">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryCollectionFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromGml(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromGml(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetCoordinateSystemId(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetSpatialTypeName(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetDimension(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetEnvelope(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsBinary(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsGml(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsText(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsEmpty(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsSimple(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetBoundary(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsValid(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SpatialEquals(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Disjoint(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersects(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Touches(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Crosses(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Within(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Contains(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Overlaps(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Relate(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry,System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Buffer(System.Data.Entity.Spatial.DbGeometry,System.Double)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Distance(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetConvexHull(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersection(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Union(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Difference(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SymmetricDifference(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElementCount(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.ElementAt(System.Data.Entity.Spatial.DbGeometry,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetXCoordinate(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetYCoordinate(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElevation(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetMeasure(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLength(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetStartPoint(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetEndPoint(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsClosed(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsRing(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetPointCount(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.PointAt(System.Data.Entity.Spatial.DbGeometry,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetArea(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetCentroid(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetPointOnSurface(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetExteriorRing(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetInteriorRingCount(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.InteriorRingAt(System.Data.Entity.Spatial.DbGeometry,System.Int32)">
            <inheritdoc />
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlSpatialServices.NativeTypesAvailable">
            <inheritdoc />
        </member>
    </members>
</doc>

Added Externals/EntityFramework/v6.2/lib/net40/EntityFramework.dll.

cannot compute difference between binary files

Added Externals/EntityFramework/v6.2/lib/net40/EntityFramework.xml.

more than 10,000 changes

Added Externals/EntityFramework/v6.2/lib/net45/EntityFramework.SqlServer.dll.

cannot compute difference between binary files

Added Externals/EntityFramework/v6.2/lib/net45/EntityFramework.SqlServer.xml.



























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>EntityFramework.SqlServer</name>
    </assembly>
    <members>
        <member name="T:System.Data.Entity.SqlServer.Utilities.TaskExtensions">
            <summary>
            Contains extension methods for the <see cref="T:System.Threading.Tasks.Task"/> class.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.WithCurrentCulture``1(System.Threading.Tasks.Task{``0})">
            <summary>
            Configures an awaiter used to await this <see cref="T:System.Threading.Tasks.Task`1"/> to avoid
            marshalling the continuation
            back to the original context, but preserve the current culture and UI culture.
            </summary>
            <typeparam name="T">
            The type of the result produced by the associated <see cref="T:System.Threading.Tasks.Task`1"/>.
            </typeparam>
            <param name="task">The task to be awaited on.</param>
            <returns>An object used to await this task.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.WithCurrentCulture(System.Threading.Tasks.Task)">
            <summary>
            Configures an awaiter used to await this <see cref="T:System.Threading.Tasks.Task"/> to avoid
            marshalling the continuation
            back to the original context, but preserve the current culture and UI culture.
            </summary>
            <param name="task">The task to be awaited on.</param>
            <returns>An object used to await this task.</returns>
        </member>
        <member name="T:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1">
            <summary>
            Provides an awaitable object that allows for awaits on <see cref="T:System.Threading.Tasks.Task`1"/> that
            preserve the culture.
            </summary>
            <typeparam name="T">
            The type of the result produced by the associated <see cref="T:System.Threading.Tasks.Task`1"/>.
            </typeparam>
            <remarks>This type is intended for compiler use only.</remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.#ctor(System.Threading.Tasks.Task{`0})">
            <summary>
            Constructs a new instance of the <see cref="T:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1"/> class.
            </summary>
            <param name="task">The task to be awaited on.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.GetAwaiter">
            <summary>Gets an awaiter used to await this <see cref="T:System.Threading.Tasks.Task`1"/>.</summary>
            <returns>An awaiter instance.</returns>
            <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.GetResult">
            <summary>Ends the await on the completed <see cref="T:System.Threading.Tasks.Task`1"/>.</summary>
            <returns>The result of the completed <see cref="T:System.Threading.Tasks.Task`1"/>.</returns>
            <exception cref="T:System.NullReferenceException">The awaiter was not properly initialized.</exception>
            <exception cref="T:System.Threading.Tasks.TaskCanceledException">The task was canceled.</exception>
            <exception cref="T:System.Exception">The task completed in a Faulted state.</exception>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.OnCompleted(System.Action)">
            <summary>This method is not implemented and should not be called.</summary>
            <param name="continuation">The action to invoke when the await operation completes.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.UnsafeOnCompleted(System.Action)">
            <summary>
            Schedules the continuation onto the <see cref="T:System.Threading.Tasks.Task`1"/> associated with this
            <see cref="T:System.Runtime.CompilerServices.TaskAwaiter`1"/>.
            </summary>
            <param name="continuation">The action to invoke when the await operation completes.</param>
            <exception cref="T:System.ArgumentNullException">
            The <paramref name="continuation"/> argument is null
            (Nothing in Visual Basic).
            </exception>
            <exception cref="T:System.InvalidOperationException">The awaiter was not properly initialized.</exception>
            <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
        </member>
        <member name="P:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.IsCompleted">
            <summary>
            Gets whether this <see cref="T:System.Threading.Tasks.Task">Task</see> has completed.
            </summary>
            <remarks>
            <see cref="P:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.IsCompleted"/> will return true when the Task is in one of the three
            final states: <see cref="F:System.Threading.Tasks.TaskStatus.RanToCompletion">RanToCompletion</see>,
            <see cref="F:System.Threading.Tasks.TaskStatus.Faulted">Faulted</see>, or
            <see cref="F:System.Threading.Tasks.TaskStatus.Canceled">Canceled</see>.
            </remarks>
        </member>
        <member name="T:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter">
            <summary>
            Provides an awaitable object that allows for awaits on <see cref="T:System.Threading.Tasks.Task"/> that
            preserve the culture.
            </summary>
            <remarks>This type is intended for compiler use only.</remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.#ctor(System.Threading.Tasks.Task)">
            <summary>
            Constructs a new instance of the <see cref="T:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter"/> class.
            </summary>
            <param name="task">The task to be awaited on.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.GetAwaiter">
            <summary>Gets an awaiter used to await this <see cref="T:System.Threading.Tasks.Task"/>.</summary>
            <returns>An awaiter instance.</returns>
            <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.GetResult">
            <summary>Ends the await on the completed <see cref="T:System.Threading.Tasks.Task"/>.</summary>
            <exception cref="T:System.NullReferenceException">The awaiter was not properly initialized.</exception>
            <exception cref="T:System.Threading.Tasks.TaskCanceledException">The task was canceled.</exception>
            <exception cref="T:System.Exception">The task completed in a Faulted state.</exception>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.OnCompleted(System.Action)">
            <summary>This method is not implemented and should not be called.</summary>
            <param name="continuation">The action to invoke when the await operation completes.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.UnsafeOnCompleted(System.Action)">
            <summary>
            Schedules the continuation onto the <see cref="T:System.Threading.Tasks.Task"/> associated with this
            <see cref="T:System.Runtime.CompilerServices.TaskAwaiter"/>.
            </summary>
            <param name="continuation">The action to invoke when the await operation completes.</param>
            <exception cref="T:System.ArgumentNullException">
            The <paramref name="continuation"/> argument is null
            (Nothing in Visual Basic).
            </exception>
            <exception cref="T:System.InvalidOperationException">The awaiter was not properly initialized.</exception>
            <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
        </member>
        <member name="P:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.IsCompleted">
            <summary>
            Gets whether this <see cref="T:System.Threading.Tasks.Task">Task</see> has completed.
            </summary>
            <remarks>
            <see cref="P:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.IsCompleted"/> will return true when the Task is in one of the three
            final states: <see cref="F:System.Threading.Tasks.TaskStatus.RanToCompletion">RanToCompletion</see>,
            <see cref="F:System.Threading.Tasks.TaskStatus.Faulted">Faulted</see>, or
            <see cref="F:System.Threading.Tasks.TaskStatus.Canceled">Canceled</see>.
            </remarks>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy">
            <summary>
            An <see cref="T:System.Data.Entity.Infrastructure.IDbExecutionStrategy"/> that retries actions that throw exceptions caused by SQL Azure transient failures.
            </summary>
            <remarks>
            This execution strategy will retry the operation on <see cref="T:System.TimeoutException"/> and <see cref="T:System.Data.SqlClient.SqlException"/>
            if the <see cref="P:System.Data.SqlClient.SqlException.Errors"/> contains any of the following error numbers:
            40613, 40501, 40197, 10929, 10928, 10060, 10054, 10053, 233, 64 and 20
            </remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy.#ctor">
            <summary>
            Creates a new instance of <see cref="T:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy"/>.
            </summary>
            <remarks>
            The default retry limit is 5, which means that the total amount of time spent between retries is 26 seconds plus the random factor.
            </remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy.#ctor(System.Int32,System.TimeSpan)">
            <summary>
            Creates a new instance of <see cref="T:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy"/> with the specified limits for
            number of retries and the delay between retries.
            </summary>
            <param name="maxRetryCount"> The maximum number of retry attempts. </param>
            <param name="maxDelay"> The maximum delay in milliseconds between retries. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy.ShouldRetryOn(System.Exception)">
            <inheritdoc/>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlFunctions">
            <summary>
            Contains function stubs that expose SqlServer methods in Linq to Entities.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.ChecksumAggregate(System.Collections.Generic.IEnumerable{System.Int32})">
            <summary>Returns the checksum of the values in a collection. Null values are ignored.</summary>
            <returns>The checksum computed from the input collection.</returns>
            <param name="arg">The collection of values over which the checksum is computed.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.ChecksumAggregate(System.Collections.Generic.IEnumerable{System.Nullable{System.Int32}})">
            <summary>Returns the checksum of the values in a collection. Null values are ignored.</summary>
            <returns>The checksum computed from the input collection.</returns>
            <param name="arg">The collection of values over which the checksum is computed.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Ascii(System.String)">
            <summary>Returns the ASCII code value of the left-most character of a character expression.</summary>
            <returns>The ASCII code of the first character in the input string.</returns>
            <param name="arg">A valid string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Char(System.Nullable{System.Int32})">
            <summary>Returns the character that corresponds to the specified integer ASCII value.</summary>
            <returns>The character that corresponds to the specified ASCII value.</returns>
            <param name="arg">An ASCII code.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.String,System.String)">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.Byte[],System.Byte[])">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.String,System.String,System.Nullable{System.Int32})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.Byte[],System.Byte[],System.Nullable{System.Int32})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.String,System.String,System.Nullable{System.Int64})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>
            A <see cref="T:System.Nullable`1" /> of <see cref="T:System.Int64" /> value that is the starting position of  toFind  if it is found in  toSearch .
            </returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.Byte[],System.Byte[],System.Nullable{System.Int64})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Difference(System.String,System.String)">
            <summary>Returns an integer value that indicates the difference between the SOUNDEX values of two character expressions.</summary>
            <returns>The SOUNDEX difference between the two strings.</returns>
            <param name="string1">The first string.</param>
            <param name="string2">The second string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.NChar(System.Nullable{System.Int32})">
            <summary>Returns the Unicode character with the specified integer code, as defined by the Unicode standard.</summary>
            <returns>The character that corresponds to the input character code.</returns>
            <param name="arg">A character code.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.PatIndex(System.String,System.String)">
            <summary>Returns the starting position of the first occurrence of a pattern in a specified expression, or zeros if the pattern is not found, on all valid text and character data types.</summary>
            <returns>The starting character position where the string pattern was found.</returns>
            <param name="stringPattern">A string pattern to search for.</param>
            <param name="target">The string to search.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.QuoteName(System.String)">
            <summary>Returns a Unicode string with the delimiters added to make the input string a valid Microsoft SQL Server delimited identifier.</summary>
            <returns>The original string with brackets added.</returns>
            <param name="stringArg">The expression that quote characters will be added to.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.QuoteName(System.String,System.String)">
            <summary>Returns a Unicode string with the delimiters added to make the input string a valid Microsoft SQL Server delimited identifier.</summary>
            <returns>The original string with the specified quote characters added.</returns>
            <param name="stringArg">The expression that quote characters will be added to.</param>
            <param name="quoteCharacter">The one-character string to use as the delimiter. It can be a single quotation mark ( ' ), a left or right bracket ( [ ] ), or a double quotation mark ( " ). If quote_character is not specified, brackets are used.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Replicate(System.String,System.Nullable{System.Int32})">
            <summary>Repeats a string value a specified number of times.</summary>
            <returns>The target string, repeated the number of times specified by  count .</returns>
            <param name="target">A valid string.</param>
            <param name="count">The value that specifies how many time to repeat  target .</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.SoundCode(System.String)">
            <summary>Converts an alphanumeric string to a four-character (SOUNDEX) code to find similar-sounding words or names.</summary>
            <returns>The SOUNDEX code of the input string.</returns>
            <param name="arg">A valid string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Space(System.Nullable{System.Int32})">
            <summary>Returns a string of repeated spaces.</summary>
            <returns>A string that consists of the specified number of spaces.</returns>
            <param name="arg1">The number of spaces. If negative, a null string is returned.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Double})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The numeric input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Decimal})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Double},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The numeric input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Decimal},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Double},System.Nullable{System.Int32},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The numeric input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
            <param name="decimalArg">The number of places to the right of the decimal point.  decimal  must be less than or equal to 16. If  decimal  is more than 16 then the result is truncated to sixteen places to the right of the decimal point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Decimal},System.Nullable{System.Int32},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
            <param name="decimalArg">The number of places to the right of the decimal point.  decimal  must be less than or equal to 16. If  decimal  is more than 16 then the result is truncated to sixteen places to the right of the decimal point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Stuff(System.String,System.Nullable{System.Int32},System.Nullable{System.Int32},System.String)">
            <summary>Inserts a string into another string. It deletes a specified length of characters in the target string at the start position and then inserts the second string into the target string at the start position.</summary>
            <returns>A string consisting of the two strings.</returns>
            <param name="stringInput">The target string.</param>
            <param name="start">The character position in  stringinput  where the replacement string is to be inserted.</param>
            <param name="length">The number of characters to delete from  stringInput . If  length  is longer than  stringInput , deletion occurs up to the last character in  stringReplacement .</param>
            <param name="stringReplacement">The substring to be inserted into  stringInput .</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Unicode(System.String)">
            <summary>Returns the integer value, as defined by the Unicode standard, for the first character of the input expression.</summary>
            <returns>The character code for the first character in the input string.</returns>
            <param name="arg">A valid string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Acos(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the angle, in radians, whose cosine is the specified numerical value. This angle is called the arccosine.</summary>
            <returns>The angle, in radians, defined by the input cosine value.</returns>
            <param name="arg1">The cosine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Acos(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the angle, in radians, whose cosine is the specified numerical value. This angle is called the arccosine.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg1">The cosine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Asin(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the angle, in radians, whose sine is the specified numerical value. This angle is called the arcsine.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The sine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Asin(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the angle, in radians, whose sine is the specified numerical value. This angle is called the arcsine.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The sine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the angle, in radians, whose tangent is the specified numerical value. This angle is called the arctangent.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The tangent of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the angle, in radians, whose tangent is the specified numerical value. This angle is called the arctangent.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The tangent of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan2(System.Nullable{System.Double},System.Nullable{System.Double})">
            <summary>Returns the positive angle, in radians, between the positive x-axis and the ray from the origin through the point (x, y), where x and y are the two specified numerical values. The first parameter passed to the function is the y-value and the second parameter is the x-value.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg1">The y-coordinate of a point.</param>
            <param name="arg2">The x-coordinate of a point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan2(System.Nullable{System.Decimal},System.Nullable{System.Decimal})">
            <summary>Returns the positive angle, in radians, between the positive x-axis and the ray from the origin through the point (x, y), where x and y are the two specified numerical values. The first parameter passed to the function is the y-value and the second parameter is the x-value.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg1">The y-coordinate of a point.</param>
            <param name="arg2">The x-coordinate of a point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cos(System.Nullable{System.Double})">
            <summary>Returns the trigonometric cosine of the specified angle, in radians, in the specified expression.</summary>
            <returns>The trigonometric cosine of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cos(System.Nullable{System.Decimal})">
            <summary>Returns the trigonometric cosine of the specified angle, in radians, in the specified expression.</summary>
            <returns>The trigonometric cosine of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cot(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the trigonometric cotangent of the specified angle, in radians.</summary>
            <returns>The trigonometric cotangent of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cot(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the trigonometric cotangent of the specified angle, in radians.</summary>
            <returns>The trigonometric cotangent of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Int32})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Int64})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Decimal})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Double})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Exp(System.Nullable{System.Double})">
            <summary>Returns the exponential value of the specified float expression.</summary>
            <returns>The constant e raised to the power of the input value.</returns>
            <param name="arg">The input value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Exp(System.Nullable{System.Decimal})">
            <summary>Returns the exponential value of the specified float expression.</summary>
            <returns>The constant e raised to the power of the input value.</returns>
            <param name="arg">The input value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log(System.Nullable{System.Double})">
            <summary>Returns the natural logarithm of the specified input value.</summary>
            <returns>The natural logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log(System.Nullable{System.Decimal})">
            <summary>Returns the natural logarithm of the specified input value.</summary>
            <returns>The natural logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log10(System.Nullable{System.Double})">
            <summary>Returns the base-10 logarithm of the specified input value.</summary>
            <returns>The base-10 logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log10(System.Nullable{System.Decimal})">
            <summary>Returns the base-10 logarithm of the specified input value.</summary>
            <returns>The base-10 logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Pi">
            <summary>Returns the constant value of pi.</summary>
            <returns>The numeric value of pi.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Int32})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Int64})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Decimal})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Double})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Rand">
            <summary>Returns a pseudo-random float value from 0 through 1, exclusive.</summary>
            <returns>The pseudo-random value.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Rand(System.Nullable{System.Int32})">
            <summary>Returns a pseudo-random float value from 0 through 1, exclusive.</summary>
            <returns>The pseudo-random value.</returns>
            <param name="seed">The seed value. If  seed  is not specified, the SQL Server Database Engine assigns a seed value at random. For a specified seed value, the result returned is always the same.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Int32})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Int64})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Decimal})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Double})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sin(System.Nullable{System.Decimal})">
            <summary>Returns the trigonometric sine of the specified angle.</summary>
            <returns>The trigonometric sine of the input expression.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sin(System.Nullable{System.Double})">
            <summary>Returns the trigonometric sine of the specified angle.</summary>
            <returns>The trigonometric sine of the input expression.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.SquareRoot(System.Nullable{System.Double})">
            <summary>Returns the square root of the specified number.</summary>
            <returns>The square root of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.SquareRoot(System.Nullable{System.Decimal})">
            <summary>Returns the square root of the specified number.</summary>
            <returns>The square root of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Square(System.Nullable{System.Double})">
            <summary>Returns the square of the specified number.</summary>
            <returns>The square of the input value.</returns>
            <param name="arg1">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Square(System.Nullable{System.Decimal})">
            <summary>Returns the square of the specified number.</summary>
            <returns>The square of the input value.</returns>
            <param name="arg1">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Tan(System.Nullable{System.Double})">
            <summary>Returns the trigonometric tangent of the input expression.</summary>
            <returns>The tangent of the input angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Tan(System.Nullable{System.Decimal})">
            <summary>Returns the trigonometric tangent of the input expression.</summary>
            <returns>The tangent of the input angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.Nullable{System.DateTime})">
            <summary>Returns a new datetime value based on adding an interval to the specified date.</summary>
            <returns>The new date.</returns>
            <param name="datePartArg">The part of the date to increment. </param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="date">The date to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.Nullable{System.TimeSpan})">
            <summary>Returns a new time span value based on adding an interval to the specified time span.</summary>
            <returns>The new time span.</returns>
            <param name="datePartArg">The part of the date to increment.</param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="time">The time span to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.Nullable{System.DateTimeOffset})">
            <summary>Returns a new date value based on adding an interval to the specified date.</summary>
            <returns>The new point in time, expressed as a date and time of day, relative to Coordinated Universal Time (UTC).</returns>
            <param name="datePartArg">The part of the date to increment.</param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="dateTimeOffsetArg">The date to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.String)">
            <summary>Returns a new datetime value based on adding an interval to the specified date.</summary>
            <returns>
            A <see cref="T:System.Nullable`1" /> of <see cref="T:System.DateTime" /> value that is the new date.
            </returns>
            <param name="datePartArg">The part of the date to increment.</param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="date">The date to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The value specifying the number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two Dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.Nullable{System.DateTime})">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.String)">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.Nullable{System.TimeSpan})">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.Nullable{System.DateTimeOffset})">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.Nullable{System.DateTime})">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The the specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.Nullable{System.DateTimeOffset})">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.String)">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.Nullable{System.TimeSpan})">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.GetDate">
            <summary>Returns the current database system timestamp as a datetime value without the database time zone offset. This value is derived from the operating system of the computer on which the instance of SQL Server is running.</summary>
            <returns>The current database timestamp.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.GetUtcDate">
            <summary>Returns the current database system timestamp as a datetime value. The database time zone offset is not included. This value represents the current UTC time (Coordinated Universal Time). This value is derived from the operating system of the computer on which the instance of SQL Server is running.</summary>
            <returns>The current database UTC timestamp.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Boolean})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Double})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Decimal})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.DateTime})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.TimeSpan})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.DateTimeOffset})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.String)">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Byte[])">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Guid})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Boolean})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Double})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Decimal})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.String)">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTime})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.TimeSpan})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTimeOffset})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Byte[])">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The character array for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Guid})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Double},System.Nullable{System.Double})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Decimal},System.Nullable{System.Decimal})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.String,System.String)">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTime},System.Nullable{System.DateTime})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Byte[],System.Byte[])">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The character array for which the checksum is calculated.</param>
            <param name="arg2">The character array for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Guid},System.Nullable{System.Guid})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Double})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Decimal},System.Nullable{System.Decimal},System.Nullable{System.Decimal})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.String,System.String,System.String)">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTime},System.Nullable{System.DateTime},System.Nullable{System.DateTime})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Byte[],System.Byte[],System.Byte[])">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The character array for which the checksum is calculated.</param>
            <param name="arg2">The character array for which the checksum is calculated.</param>
            <param name="arg3">The character array for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Guid},System.Nullable{System.Guid},System.Nullable{System.Guid})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CurrentTimestamp">
            <summary>Returns the current date and time. </summary>
            <returns>The current date and time.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CurrentUser">
            <summary>Returns the name of the current user.</summary>
            <returns>The name of the current user.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.HostName">
            <summary>Returns the workstation name.</summary>
            <returns>The name of the workstation.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.UserName(System.Nullable{System.Int32})">
            <summary>Returns a database user name corresponding to a specified identification number.</summary>
            <returns>The user name.</returns>
            <param name="arg">A user ID.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.UserName">
            <summary>Returns a database user name corresponding to a specified identification number.</summary>
            <returns>The user name.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.IsNumeric(System.String)">
            <summary>Indicates whether the input value is a valid numeric type.</summary>
            <returns>1 if the input expression is a valid numeric data type; otherwise, 0.</returns>
            <param name="arg">A string expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.IsDate(System.String)">
            <summary>Indicates whether the input value is a valid date or time.</summary>
            <returns>1 if the input expression is a valid date or time value of datetime or smalldatetime data types; otherwise, 0.</returns>
            <param name="arg">The tested value.</param>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator">
            <summary>
            Provider to convert provider agnostic migration operations into SQL commands
            that can be run against a Microsoft SQL Server database.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.IsPermissionDeniedError(System.Exception)">
            <summary>
            Determines if a provider specific exception corresponds to a database-level permission denied error.
            </summary>
            <param name="exception">The database exception.</param>
            <returns> true if the supplied exception corresponds to a database-level permission denied error; otherwise false. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Collections.Generic.IEnumerable{System.Data.Entity.Migrations.Model.MigrationOperation},System.String)">
            <summary>
            Converts a set of migration operations into Microsoft SQL Server specific SQL.
            </summary>
            <param name="migrationOperations"> The operations to be converted. </param>
            <param name="providerManifestToken"> Token representing the version of SQL Server being targeted (i.e. "2005", "2008"). </param>
            <returns> A list of SQL statements to be executed to perform the migration operations. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GenerateProcedureBody(System.Collections.Generic.ICollection{System.Data.Entity.Core.Common.CommandTrees.DbModificationCommandTree},System.String,System.String)">
            <summary>
            Generates the SQL body for a stored procedure.
            </summary>
            <param name="commandTrees">The command trees representing the commands for an insert, update or delete operation.</param>
            <param name="rowsAffectedParameter">The rows affected parameter name.</param>
            <param name="providerManifestToken">The provider manifest token.</param>
            <returns>The SQL body for the stored procedure.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.UpdateDatabaseOperation)">
            <summary>
            Generates the specified update database operation which represents applying a series of migrations.
            The generated script is idempotent, meaning it contains conditional logic to check if individual migrations 
            have already been applied and only apply the pending ones.
            </summary>
            <param name="updateDatabaseOperation">The update database operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.MigrationOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.MigrationOperation"/>.
            Allows derived providers to handle additional operation types.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="migrationOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.CreateConnection">
            <summary>
            Creates an empty connection for the current provider.
            Allows derived providers to use connection other than <see cref="T:System.Data.SqlClient.SqlConnection"/>.
            </summary>
            <returns> An empty connection for the current provider. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.CreateProcedureOperation)">
            <summary>
            Generates the specified create procedure operation.
            </summary>
            <param name="createProcedureOperation">The create procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AlterProcedureOperation)">
            <summary>
            Generates the specified alter procedure operation.
            </summary>
            <param name="alterProcedureOperation">The alter procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropProcedureOperation)">
            <summary>
            Generates the specified drop procedure operation.
            </summary>
            <param name="dropProcedureOperation">The drop procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.CreateTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.CreateTableOperation"/>. This method differs from
            <see cref="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.WriteCreateTable(System.Data.Entity.Migrations.Model.CreateTableOperation)"/> in that it will
            create the target database schema if it does not already exist.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.WriteCreateTable(System.Data.Entity.Migrations.Model.CreateTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.CreateTableOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.WriteCreateTable(System.Data.Entity.Migrations.Model.CreateTableOperation,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Writes CREATE TABLE SQL to the target writer.
            </summary>
            <param name="createTableOperation"> The operation to produce SQL for. </param>
            <param name="writer"> The target writer. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AlterTableOperation)">
            <summary>
            Override this method to generate SQL when the definition of a table or its attributes are changed.
            The default implementation of this method does nothing.
            </summary>
            <param name="alterTableOperation"> The operation describing changes to the table. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GenerateMakeSystemTable(System.Data.Entity.Migrations.Model.CreateTableOperation,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Generates SQL to mark a table as a system table.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createTableOperation"> The table to mark as a system table. </param>
            <param name="writer"> The <see cref="T:System.Data.Entity.Migrations.Utilities.IndentedTextWriter"/> to write the generated SQL to. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GenerateCreateSchema(System.String)">
            <summary>
            Generates SQL to create a database schema.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="schema"> The name of the schema to create. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AddForeignKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AddForeignKeyOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="addForeignKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropForeignKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropForeignKeyOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropForeignKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.CreateIndexOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.CreateIndexOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createIndexOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropIndexOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropIndexOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropIndexOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AddPrimaryKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AddPrimaryKeyOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="addPrimaryKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropPrimaryKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropPrimaryKeyOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropPrimaryKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AddColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AddColumnOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="addColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropColumnOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AlterColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AlterColumnOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="alterColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.DropDefaultConstraint(System.String,System.String,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Call this method to generate SQL that will attempt to drop the default constraint created
            when a column is created. This method is usually called by code that overrides the creation or
            altering of columns.
            </summary>
            <param name="table">The table to which the constraint applies.</param>
            <param name="column">The column to which the constraint applies.</param>
            <param name="writer">The writer to which generated SQL should be written.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropTableOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.SqlOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.SqlOperation"/>.
            Generated SQL should be added using the Statement or StatementBatch methods.
            </summary>
            <param name="sqlOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.RenameColumnOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="renameColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameIndexOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.RenameIndexOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="renameIndexOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.RenameTableOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="renameTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameProcedureOperation)">
            <summary>
            Generates the specified rename procedure operation.
            </summary>
            <param name="renameProcedureOperation">The rename procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.MoveProcedureOperation)">
            <summary>
            Generates the specified move procedure operation.
            </summary>
            <param name="moveProcedureOperation">The move procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.MoveTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.MoveTableOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="moveTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.ColumnModel,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Generates SQL for the given column model. This method is called by other methods that
            process columns and can be overridden to change the SQL generated.
            </summary>
            <param name="column">The column for which SQL is being generated.</param>
            <param name="writer">The writer to which generated SQL should be written.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.HistoryOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.HistoryOperation"/>.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="historyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Byte[])">
            <summary>
            Generates SQL to specify a constant byte[] default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Boolean)">
            <summary>
            Generates SQL to specify a constant bool default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.DateTime)">
            <summary>
            Generates SQL to specify a constant DateTime default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.DateTimeOffset)">
            <summary>
            Generates SQL to specify a constant DateTimeOffset default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Guid)">
            <summary>
            Generates SQL to specify a constant Guid default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.String)">
            <summary>
            Generates SQL to specify a constant string default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.TimeSpan)">
            <summary>
            Generates SQL to specify a constant TimeSpan default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Spatial.DbGeography)">
            <summary>
            Generates SQL to specify a constant geogrpahy default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Spatial.DbGeometry)">
            <summary>
            Generates SQL to specify a constant geometry default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Object)">
            <summary>
            Generates SQL to specify a constant default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.BuildColumnType(System.Data.Entity.Migrations.Model.ColumnModel)">
            <summary>
            Generates SQL to specify the data type of a column.
            This method just generates the actual type, not the SQL to create the column.
            </summary>
            <param name="columnModel"> The definition of the column. </param>
            <returns> SQL representing the data type. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Name(System.String)">
            <summary>
            Generates a quoted name. The supplied name may or may not contain the schema.
            </summary>
            <param name="name"> The name to be quoted. </param>
            <returns> The quoted name. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Quote(System.String)">
            <summary>
            Quotes an identifier for SQL Server.
            </summary>
            <param name="identifier"> The identifier to be quoted. </param>
            <returns> The quoted identifier. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Statement(System.String,System.Boolean,System.String)">
            <summary>
            Adds a new Statement to be executed against the database.
            </summary>
            <param name="sql"> The statement to be executed. </param>
            <param name="suppressTransaction"> Gets or sets a value indicating whether this statement should be performed outside of the transaction scope that is used to make the migration process transactional. If set to true, this operation will not be rolled back if the migration process fails. </param>
            <param name="batchTerminator">The batch terminator for the database provider.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Writer">
            <summary>
            Gets a new <see cref="T:System.Data.Entity.Migrations.Utilities.IndentedTextWriter"/> that can be used to build SQL.
            This is just a helper method to create a writer. Writing to the writer will
            not cause SQL to be registered for execution. You must pass the generated
            SQL to the Statement method.
            </summary>
            <returns> An empty text writer to use for SQL generation. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Statement(System.Data.Entity.Migrations.Utilities.IndentedTextWriter,System.String)">
            <summary>
            Adds a new Statement to be executed against the database.
            </summary>
            <param name="writer"> The writer containing the SQL to be executed. </param>
            <param name="batchTerminator">The batch terminator for the database provider.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.StatementBatch(System.String,System.Boolean)">
            <summary>
            Breaks sql string into one or more statements, handling T-SQL utility statements as necessary.
            </summary>
            <param name="sqlBatch"> The SQL to split into one ore more statements to be executed. </param>
            <param name="suppressTransaction"> Gets or sets a value indicating whether this statement should be performed outside of the transaction scope that is used to make the migration process transactional. If set to true, this operation will not be rolled back if the migration process fails. </param>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GuidColumnDefault">
            <summary>
            Returns the column default value to use for store-generated GUID columns when
            no default value is explicitly specified in the migration.
            Returns newsequentialid() for on-premises SQL Server 2005 and later.
            Returns newid() for SQL Azure.
            </summary>
            <value>Either newsequentialid() or newid() as described above.</value>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlSpatialFunctions">
            <summary>
            Contains function stubs that expose SqlServer methods in Linq to Entities.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.PointGeography(System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Int32})">
            <summary>Constructs a geography instance representing a Point instance from its x and y values and a spatial reference ID (SRID). </summary>
            <returns>The constructed geography instance.</returns>
            <param name="latitude">The x-coordinate of the Point being generated.</param>
            <param name="longitude">The y-coordinate of the Point being generated</param>
            <param name="spatialReferenceId">The SRID of the geography instance.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.AsTextZM(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns the Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geography instance augmented with any Z (elevation) and M (measure) values carried by the instance.</summary>
            <returns>The Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geography instance.</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.BufferWithTolerance(System.Data.Entity.Spatial.DbGeography,System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Boolean})">
            <summary>Returns a geometric object representing the union of all point values whose distance from a geography instance is less than or equal to a specified value, allowing for a specified tolerance.</summary>
            <returns>The union of all point values whose distance from a geography instance is less than or equal to a specified value</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="distance">The distance.</param>
            <param name="tolerance">The specified tolerance.</param>
            <param name="relative">Specifying whether the tolerance value is relative or absolute.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.EnvelopeAngle(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns the maximum angle between the point returned by EnvelopeCenter() and a point in the geography instance in degrees.</summary>
            <returns>the maximum angle between the point returned by EnvelopeCenter().</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.EnvelopeCenter(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns a point that can be used as the center of a bounding circle for the geography instance.</summary>
            <returns>A SqlGeography value that specifies the location of the center of a bounding circle.</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Filter(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <summary>Offers a fast, index-only intersection method to determine if a geography instance intersects another SqlGeography instance, assuming an index is available.</summary>
            <returns>True if a geography instance potentially intersects another SqlGeography instance; otherwise, false.</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="geographyOther">Another geography instance to compare against the instance on which Filter is invoked.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.InstanceOf(System.Data.Entity.Spatial.DbGeography,System.String)">
            <summary>Tests if the SqlGeography instance is the same as the specified type.</summary>
            <returns>A string that specifies one of the 12 types exposed in the geography type hierarchy.</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="geometryTypeName">A string that specifies one of the 12 types exposed in the geography type hierarchy.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.NumRings(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns the total number of rings in a Polygon instance.</summary>
            <returns>The total number of rings.</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Reduce(System.Data.Entity.Spatial.DbGeography,System.Nullable{System.Double})">
            <summary>Returns an approximation of the given geography instance produced by running the Douglas-Peucker algorithm on the instance with the given tolerance.</summary>
            <returns>
            Returns <see cref="T:System.Data.Entity.Spatial.DbGeography" />.
            </returns>
            <param name="geographyValue">The geography value.</param>
            <param name="tolerance">The tolerance to input to the Douglas-Peucker algorithm. tolerance must be a positive number.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.RingN(System.Data.Entity.Spatial.DbGeography,System.Nullable{System.Int32})">
            <summary>Returns the specified ring of the SqlGeography instance: 1 ≤ n ≤ NumRings().</summary>
            <returns>A SqlGeography object that represents the ring specified by n.</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="index">An int expression between 1 and the number of rings in a polygon instance.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.PointGeometry(System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Int32})">
            <summary>Constructs a geometry instance representing a Point instance from its x and y values and a spatial reference ID (SRID). </summary>
            <returns>The constructed geometry instance.</returns>
            <param name="xCoordinate">The x-coordinate of the Point being generated.</param>
            <param name="yCoordinate">The y-coordinate of the Point being generated</param>
            <param name="spatialReferenceId">The SRID of the geography instance.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.AsTextZM(System.Data.Entity.Spatial.DbGeometry)">
            <summary>Returns the Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geography instance augmented with any Z (elevation) and M (measure) values carried by the instance.</summary>
            <returns>The Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geometry instance.</returns>
            <param name="geometryValue">The geometry value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.BufferWithTolerance(System.Data.Entity.Spatial.DbGeometry,System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Boolean})">
            <summary>Returns a geometric object representing the union of all point values whose distance from a geometry instance is less than or equal to a specified value, allowing for a specified tolerance.</summary>
            <returns>The union of all point values whose distance from a geometry instance is less than or equal to a specified value</returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="distance">The distance.</param>
            <param name="tolerance">The specified tolerance.</param>
            <param name="relative">Specifying whether the tolerance value is relative or absolute.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.InstanceOf(System.Data.Entity.Spatial.DbGeometry,System.String)">
            <summary>Tests if the SqlGeometry instance is the same as the specified type.</summary>
            <returns>A string that specifies one of the 12 types exposed in the geography type hierarchy.</returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="geometryTypeName">A string that specifies one of the 12 types exposed in the geography type hierarchy.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Filter(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <summary>Offers a fast, index-only intersection method to determine if a geography instance intersects another SqlGeometry instance, assuming an index is available.</summary>
            <returns>True if a geography instance potentially intersects another SqlGeography instance; otherwise, false.</returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="geometryOther">Another geography instance to compare against the instance on which Filter is invoked.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.MakeValid(System.Data.Entity.Spatial.DbGeometry)">
            <summary>Converts an invalid geometry instance into a geometry instance with a valid Open Geospatial Consortium (OGC) type. </summary>
            <returns>The converted geometry instance.</returns>
            <param name="geometryValue">The geometry value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Reduce(System.Data.Entity.Spatial.DbGeometry,System.Nullable{System.Double})">
            <summary>Returns an approximation of the given geography instance produced by running the Douglas-Peucker algorithm on the instance with the given tolerance.</summary>
            <returns>
            Returns <see cref="T:System.Data.Entity.Spatial.DbGeometry" />.
            </returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="tolerance">The tolerance to input to the Douglas-Peucker algorithm. tolerance must be a positive number.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderManifest.SupportsParameterOptimizationInSchemaQueries">
            <summary>
            Indicates if the provider supports the parameter optimization described in EntityFramework6 GitHub issue #195.
            </summary>
            <returns><c>True</c> since this provider supports the parameter optimization.</returns>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlProviderServices">
            <summary>
            The DbProviderServices implementation for the SqlClient provider for SQL Server.
            </summary>
            <remarks>
            Note that instance of this type also resolve additional provider services for Microsoft SQL Server
            when this type is registered as an EF provider either using an entry in the application's config file
            or through code-based registration in <see cref="T:System.Data.Entity.DbConfiguration"/>.
            The services resolved are:
            Requests for <see cref="T:System.Data.Entity.Infrastructure.IDbConnectionFactory"/> are resolved to a Singleton instance of
            <see cref="T:System.Data.Entity.Infrastructure.SqlConnectionFactory"/> to create connections to SQL Express by default.
            Requests for <see cref="T:System.Func`1"/> for the invariant name "System.Data.SqlClient"
            for any server name are resolved to a delegate that returns a <see cref="T:System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy"/>
            to provide a non-retrying policy for SQL Server.
            Requests for <see cref="T:System.Data.Entity.Migrations.Sql.MigrationSqlGenerator"/> for the invariant name "System.Data.SqlClient" are
            resolved to <see cref="T:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator"/> instances to provide default Migrations SQL
            generation for SQL Server.
            Requests for <see cref="T:System.Data.Entity.Spatial.DbSpatialServices"/> for the invariant name "System.Data.SqlClient" are
            resolved to a Singleton instance of <see cref="T:System.Data.Entity.SqlServer.SqlSpatialServices"/> to provide default spatial
            services for SQL Server.
            </remarks>
        </member>
        <member name="F:System.Data.Entity.SqlServer.SqlProviderServices.ProviderInvariantName">
            <summary>
            This is the well-known string using in configuration files and code-based configuration as
            the "provider invariant name" used to specify Microsoft SQL Server for ADO.NET and
            Entity Framework provider services.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.RegisterInfoMessageHandler(System.Data.Common.DbConnection,System.Action{System.String})">
            <summary>
            Registers a handler to process non-error messages coming from the database provider.
            </summary>
            <param name="connection"> The connection to receive information for. </param>
            <param name="handler"> The handler to process messages. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.CreateDbCommandDefinition(System.Data.Entity.Core.Common.DbProviderManifest,System.Data.Entity.Core.Common.CommandTrees.DbCommandTree)">
            <summary>
            Create a Command Definition object, given the connection and command tree
            </summary>
            <param name="providerManifest"> provider manifest that was determined from metadata </param>
            <param name="commandTree"> command tree for the statement </param>
            <returns> an executable command definition object </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.CloneDbCommand(System.Data.Common.DbCommand)">
            <summary>
            See issue 2390 - cloning the DesignTimeVisible property on the
            <see cref="T:System.Data.SqlClient.SqlCommand" /> can cause deadlocks.
            So here overriding to provide a method that does not clone DesignTimeVisible.
            </summary>
            <param name="fromDbCommand"> the <see cref="T:System.Data.Common.DbCommand" /> object to clone </param>
            <returns >a clone of the <see cref="T:System.Data.Common.DbCommand" /> </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.SetDbParameterValue(System.Data.Common.DbParameter,System.Data.Entity.Core.Metadata.Edm.TypeUsage,System.Object)">
            <summary>
            Sets the parameter value and appropriate facets for the given <see cref="T:System.Data.Entity.Core.Metadata.Edm.TypeUsage"/>.
            </summary>
            <param name="parameter">The parameter.</param>
            <param name="parameterType">The type of the parameter.</param>
            <param name="value">The value of the parameter.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.GetDbProviderManifestToken(System.Data.Common.DbConnection)">
            <summary>
            Returns provider manifest token for a given connection.
            </summary>
            <param name="connection"> Connection to find manifest token from. </param>
            <returns> The provider manifest token for the specified connection. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.GetDbProviderManifest(System.String)">
            <summary>
            Returns the provider manifest by using the specified version information.
            </summary>
            <param name="versionHint"> The token information associated with the provider manifest. </param>
            <returns> The provider manifest by using the specified version information. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.GetDbSpatialDataReader(System.Data.Common.DbDataReader,System.String)">
            <summary>
            Gets a spatial data reader for SQL Server.
            </summary>
            <param name="fromReader"> The reader where the spatial data came from. </param>
            <param name="versionHint"> The manifest token associated with the provider manifest. </param>
            <returns> The spatial data reader. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbGetSpatialServices(System.String)">
            <summary>
            Gets a spatial data reader for SQL Server.
            </summary>
            <param name="versionHint"> The manifest token associated with the provider manifest. </param>
            <returns> The spatial data reader. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabaseScript(System.String,System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Generates a data definition language (DDL) script that creates schema objects 
            (tables, primary keys, foreign keys) based on the contents of the StoreItemCollection 
            parameter and targeted for the version of the database corresponding to the provider manifest token.
            </summary>
            <param name="providerManifestToken"> The provider manifest token identifying the target version. </param>
            <param name="storeItemCollection"> The structure of the database. </param>
            <returns>
            A DDL script that creates schema objects based on the contents of the StoreItemCollection parameter 
            and targeted for the version of the database corresponding to the provider manifest token.
            </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabase(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Create the database and the database objects.
            If initial catalog is not specified, but AttachDBFilename is specified, we generate a random database name based on the AttachDBFilename.
            Note: this causes pollution of the db, as when the connection string is later used, the mdf will get attached under a different name.
            However if we try to replicate the name under which it would be attached, the following scenario would fail:
            The file does not exist, but registered with database.
            The user calls:  If (DatabaseExists) DeleteDatabase
            CreateDatabase
            For further details on the behavior when AttachDBFilename is specified see Dev10# 188936
            </summary>
            <param name="connection">Connection to a non-existent database that needs to be created and populated with the store objects indicated with the storeItemCollection parameter.</param>
            <param name="commandTimeout">Execution timeout for any commands needed to create the database.</param>
            <param name="storeItemCollection">The collection of all store items based on which the script should be created.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbDatabaseExists(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Determines whether the database for the given connection exists.
            There are three cases:
            1.  Initial Catalog = X, AttachDBFilename = null:   (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            2.  Initial Catalog = X, AttachDBFilename = F:      if (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0 then <c>true</c>,
            if not, try to open the connection and then return (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            3.  Initial Catalog = null, AttachDBFilename = F:   Try to open the connection. If that succeeds the result is true, otherwise
            if the there are no databases corresponding to the given file return <c>false</c>, otherwise throw.
            Note: We open the connection to cover the scenario when the mdf exists, but is not attached.
            Given that opening the connection would auto-attach it, it would not be appropriate to return <c>false</c> in this case.
            Also note that checking for the existence of the file does not work for a remote server.  (Dev11 #290487)
            For further details on the behavior when AttachDBFilename is specified see Dev10# 188936
            </summary>
            <param name="connection">Connection to a database whose existence is checked by this method.</param>
            <param name="commandTimeout">Execution timeout for any commands needed to determine the existence of the database.</param>
            <param name="storeItemCollection">The collection of all store items from the model. This parameter is no longer used for determining database existence.</param>
            <returns>True if the provider can deduce the database only based on the connection.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbDatabaseExists(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Lazy{System.Data.Entity.Core.Metadata.Edm.StoreItemCollection})">
            <summary>
            Determines whether the database for the given connection exists.
            There are three cases:
            1.  Initial Catalog = X, AttachDBFilename = null:   (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            2.  Initial Catalog = X, AttachDBFilename = F:      if (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0 then <c>true</c>,
            if not, try to open the connection and then return (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            3.  Initial Catalog = null, AttachDBFilename = F:   Try to open the connection. If that succeeds the result is true, otherwise
            if the there are no databases corresponding to the given file return <c>false</c>, otherwise throw.
            Note: We open the connection to cover the scenario when the mdf exists, but is not attached.
            Given that opening the connection would auto-attach it, it would not be appropriate to return <c>false</c> in this case.
            Also note that checking for the existence of the file does not work for a remote server.  (Dev11 #290487)
            For further details on the behavior when AttachDBFilename is specified see Dev10# 188936
            </summary>
            <param name="connection">Connection to a database whose existence is checked by this method.</param>
            <param name="commandTimeout">Execution timeout for any commands needed to determine the existence of the database.</param>
            <param name="storeItemCollection">The collection of all store items from the model. This parameter is no longer used for determining database existence.</param>
            <returns>True if the provider can deduce the database only based on the connection.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbDeleteDatabase(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Delete the database for the given connection.
            There are three cases:
            1.  If Initial Catalog is specified (X) drop database X
            2.  Else if AttachDBFilename is specified (F) drop all the databases corresponding to F
            if none throw
            3.  If niether the catalog not the file name is specified - throw
            Note that directly deleting the files does not work for a remote server.  However, even for not attached
            databases the current logic would work assuming the user does: if (DatabaseExists) DeleteDatabase
            </summary>
            <param name="connection"> Connection </param>
            <param name="commandTimeout"> Timeout for internal commands. </param>
            <param name="storeItemCollection"> Item Collection. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.CloneDbConnection(System.Data.Common.DbConnection,System.Data.Common.DbProviderFactory)">
            <summary>
            Clones the connection.
            </summary>
            <param name="connection">The original connection.</param>
            <param name="factory">The factory to use.</param>
            <returns>Cloned connection</returns>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.Instance">
            <summary>
            The Singleton instance of the SqlProviderServices type.
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.SqlServerTypesAssemblyName">
            <summary>
            Set to the full name of the Microsoft.SqlServer.Types assembly to override the default selection
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.TruncateDecimalsToScale">
            <summary>
            Get or sets a value indicating whether <see cref="T:System.Decimal"/> parameter values are truncated to 
            the scale (number of decimal places) defined for their corresponding columns when they are sent 
            to the database. A value of <c>true</c> indicates that <see cref="T:System.Data.SqlClient.SqlParameter"/> objects 
            created for <see cref="T:System.Decimal"/> columns will have their <see cref="P:System.Data.SqlClient.SqlParameter.Scale"/> 
            properties set, which will cause the parameter values to be truncated. If set to <c>false</c> 
            then the <see cref="P:System.Data.SqlClient.SqlParameter.Scale"/> properties will not be set, avoiding the truncation 
            behavior of <see cref="T:System.Data.SqlClient.SqlParameter"/> and allowing SQL Server to round values if necessary. 
            The default value is <c>true</c> to prevent breaking existing applications that depend on this 
            behavior. 
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.UseScopeIdentity">
            <summary>
            Gets or sets a value indicating whether to use the SCOPE_IDENTITY() function to retrieve values 
            generated by the database for numeric columns during an INSERT operation. The default value of 
            <c>true</c> is recommended and can provide better performance if all numeric values are generated 
            using IDENTITY columns. If set to <c>false</c>, an OUTPUT clause will be used instead. An OUTPUT 
            clause makes it possible to retrieve values generated by sequences or other means.
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.UseRowNumberOrderingInOffsetQueries">
            <summary>
            Gets or sets a value indicating whether the ROW_NUMBER() function is used in sort expression 
            passed to the ORDER BY clause when OFFSET is present in query. The default value of <c>true</c> 
            is recommended to obtain query results that are stable for paging operations. The value of 
            <c>false</c> can be used for compatibility with previous versions of EF and will cause the sort 
            expression to be passed unmodified to the ORDER BY clause, which can lead to unstable results 
            if the ordering is ambiguous. 
            </summary>
            <remarks>
            This flag only applies to SQL Server 2012 or later. This flag does not affect queries that have 
            already been translated to SQL and cached, therefore applications that need to set the value to 
            <c>false</c> for compatibility should do so before executing any queries.
            </remarks>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlSpatialServices">
            <summary>
            An implementation of <see cref="T:System.Data.Entity.Spatial.DbSpatialServices"/> to provide support for geospatial types when using
            Entity Framework with Microsoft SQL Server.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateProviderValue(System.Data.Entity.Spatial.DbGeographyWellKnownValue)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromProviderValue(System.Object)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateWellKnownValue(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateProviderValue(System.Data.Entity.Spatial.DbGeometryWellKnownValue)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromProviderValue(System.Object)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateWellKnownValue(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsTextIncludingElevationAndMeasure(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsTextIncludingElevationAndMeasure(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromText(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyCollectionFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromBinary(System.Byte[])">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyCollectionFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromGml(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromGml(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetCoordinateSystemId(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetSpatialTypeName(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetDimension(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsBinary(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsGml(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsText(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsEmpty(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SpatialEquals(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Disjoint(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersects(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Buffer(System.Data.Entity.Spatial.DbGeography,System.Double)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Distance(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersection(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Union(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Difference(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SymmetricDifference(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElementCount(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.ElementAt(System.Data.Entity.Spatial.DbGeography,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLatitude(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLongitude(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElevation(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetMeasure(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLength(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetStartPoint(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetEndPoint(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsClosed(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetPointCount(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.PointAt(System.Data.Entity.Spatial.DbGeography,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetArea(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromText(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryCollectionFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromBinary(System.Byte[])">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryCollectionFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromGml(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromGml(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetCoordinateSystemId(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetSpatialTypeName(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetDimension(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetEnvelope(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsBinary(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsGml(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsText(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsEmpty(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsSimple(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetBoundary(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsValid(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SpatialEquals(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Disjoint(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersects(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Touches(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Crosses(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Within(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Contains(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Overlaps(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Relate(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry,System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Buffer(System.Data.Entity.Spatial.DbGeometry,System.Double)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Distance(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetConvexHull(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersection(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Union(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Difference(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SymmetricDifference(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElementCount(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.ElementAt(System.Data.Entity.Spatial.DbGeometry,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetXCoordinate(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetYCoordinate(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElevation(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetMeasure(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLength(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetStartPoint(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetEndPoint(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsClosed(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsRing(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetPointCount(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.PointAt(System.Data.Entity.Spatial.DbGeometry,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetArea(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetCentroid(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetPointOnSurface(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetExteriorRing(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetInteriorRingCount(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.InteriorRingAt(System.Data.Entity.Spatial.DbGeometry,System.Int32)">
            <inheritdoc />
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlSpatialServices.NativeTypesAvailable">
            <inheritdoc />
        </member>
    </members>
</doc>

Added Externals/EntityFramework/v6.2/lib/net45/EntityFramework.dll.

cannot compute difference between binary files

Added Externals/EntityFramework/v6.2/lib/net45/EntityFramework.xml.

more than 10,000 changes

Added Externals/EntityFramework/v6.4/lib/net40/EntityFramework.SqlServer.dll.

cannot compute difference between binary files

Added Externals/EntityFramework/v6.4/lib/net40/EntityFramework.SqlServer.xml.













































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>EntityFramework.SqlServer</name>
    </assembly>
    <members>
        <member name="T:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy">
            <summary>
            An <see cref="T:System.Data.Entity.Infrastructure.IDbExecutionStrategy"/> that retries actions that throw exceptions caused by SQL Azure transient failures.
            </summary>
            <remarks>
            This execution strategy will retry the operation on <see cref="T:System.TimeoutException"/> and <see cref="T:System.Data.SqlClient.SqlException"/>
            if the <see cref="P:System.Data.SqlClient.SqlException.Errors"/> contains any of the following error numbers:
            40613, 40501, 40197, 10929, 10928, 10060, 10054, 10053, 233, 64 and 20
            </remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy.#ctor">
            <summary>
            Creates a new instance of <see cref="T:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy" />.
            </summary>
            <remarks>
            The default retry limit is 5, which means that the total amount of time spent between retries is 26 seconds plus the random factor.
            </remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy.#ctor(System.Int32,System.TimeSpan)">
            <summary>
            Creates a new instance of <see cref="T:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy" /> with the specified limits for
            number of retries and the delay between retries.
            </summary>
            <param name="maxRetryCount"> The maximum number of retry attempts. </param>
            <param name="maxDelay"> The maximum delay in milliseconds between retries. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy.ShouldRetryOn(System.Exception)">
            <inheritdoc/>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlFunctions">
            <summary>
            Contains function stubs that expose SqlServer methods in Linq to Entities.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.ChecksumAggregate(System.Collections.Generic.IEnumerable{System.Int32})">
            <summary>Returns the checksum of the values in a collection. Null values are ignored.</summary>
            <returns>The checksum computed from the input collection.</returns>
            <param name="arg">The collection of values over which the checksum is computed.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.ChecksumAggregate(System.Collections.Generic.IEnumerable{System.Nullable{System.Int32}})">
            <summary>Returns the checksum of the values in a collection. Null values are ignored.</summary>
            <returns>The checksum computed from the input collection.</returns>
            <param name="arg">The collection of values over which the checksum is computed.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Ascii(System.String)">
            <summary>Returns the ASCII code value of the left-most character of a character expression.</summary>
            <returns>The ASCII code of the first character in the input string.</returns>
            <param name="arg">A valid string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Char(System.Nullable{System.Int32})">
            <summary>Returns the character that corresponds to the specified integer ASCII value.</summary>
            <returns>The character that corresponds to the specified ASCII value.</returns>
            <param name="arg">An ASCII code.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.String,System.String)">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.Byte[],System.Byte[])">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.String,System.String,System.Nullable{System.Int32})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.Byte[],System.Byte[],System.Nullable{System.Int32})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.String,System.String,System.Nullable{System.Int64})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>
            A <see cref="T:System.Nullable`1" /> of <see cref="T:System.Int64" /> value that is the starting position of  toFind  if it is found in  toSearch .
            </returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.Byte[],System.Byte[],System.Nullable{System.Int64})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Difference(System.String,System.String)">
            <summary>Returns an integer value that indicates the difference between the SOUNDEX values of two character expressions.</summary>
            <returns>The SOUNDEX difference between the two strings.</returns>
            <param name="string1">The first string.</param>
            <param name="string2">The second string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.NChar(System.Nullable{System.Int32})">
            <summary>Returns the Unicode character with the specified integer code, as defined by the Unicode standard.</summary>
            <returns>The character that corresponds to the input character code.</returns>
            <param name="arg">A character code.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.PatIndex(System.String,System.String)">
            <summary>Returns the starting position of the first occurrence of a pattern in a specified expression, or zeros if the pattern is not found, on all valid text and character data types.</summary>
            <returns>The starting character position where the string pattern was found.</returns>
            <param name="stringPattern">A string pattern to search for.</param>
            <param name="target">The string to search.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.QuoteName(System.String)">
            <summary>Returns a Unicode string with the delimiters added to make the input string a valid Microsoft SQL Server delimited identifier.</summary>
            <returns>The original string with brackets added.</returns>
            <param name="stringArg">The expression that quote characters will be added to.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.QuoteName(System.String,System.String)">
            <summary>Returns a Unicode string with the delimiters added to make the input string a valid Microsoft SQL Server delimited identifier.</summary>
            <returns>The original string with the specified quote characters added.</returns>
            <param name="stringArg">The expression that quote characters will be added to.</param>
            <param name="quoteCharacter">The one-character string to use as the delimiter. It can be a single quotation mark ( ' ), a left or right bracket ( [ ] ), or a double quotation mark ( " ). If quote_character is not specified, brackets are used.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Replicate(System.String,System.Nullable{System.Int32})">
            <summary>Repeats a string value a specified number of times.</summary>
            <returns>The target string, repeated the number of times specified by  count .</returns>
            <param name="target">A valid string.</param>
            <param name="count">The value that specifies how many time to repeat  target .</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.SoundCode(System.String)">
            <summary>Converts an alphanumeric string to a four-character (SOUNDEX) code to find similar-sounding words or names.</summary>
            <returns>The SOUNDEX code of the input string.</returns>
            <param name="arg">A valid string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Space(System.Nullable{System.Int32})">
            <summary>Returns a string of repeated spaces.</summary>
            <returns>A string that consists of the specified number of spaces.</returns>
            <param name="arg1">The number of spaces. If negative, a null string is returned.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Double})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The numeric input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Decimal})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Double},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The numeric input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Decimal},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Double},System.Nullable{System.Int32},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The numeric input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
            <param name="decimalArg">The number of places to the right of the decimal point.  decimal  must be less than or equal to 16. If  decimal  is more than 16 then the result is truncated to sixteen places to the right of the decimal point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Decimal},System.Nullable{System.Int32},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
            <param name="decimalArg">The number of places to the right of the decimal point.  decimal  must be less than or equal to 16. If  decimal  is more than 16 then the result is truncated to sixteen places to the right of the decimal point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Stuff(System.String,System.Nullable{System.Int32},System.Nullable{System.Int32},System.String)">
            <summary>Inserts a string into another string. It deletes a specified length of characters in the target string at the start position and then inserts the second string into the target string at the start position.</summary>
            <returns>A string consisting of the two strings.</returns>
            <param name="stringInput">The target string.</param>
            <param name="start">The character position in  stringinput  where the replacement string is to be inserted.</param>
            <param name="length">The number of characters to delete from  stringInput . If  length  is longer than  stringInput , deletion occurs up to the last character in  stringReplacement .</param>
            <param name="stringReplacement">The substring to be inserted into  stringInput .</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Unicode(System.String)">
            <summary>Returns the integer value, as defined by the Unicode standard, for the first character of the input expression.</summary>
            <returns>The character code for the first character in the input string.</returns>
            <param name="arg">A valid string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Acos(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the angle, in radians, whose cosine is the specified numerical value. This angle is called the arccosine.</summary>
            <returns>The angle, in radians, defined by the input cosine value.</returns>
            <param name="arg1">The cosine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Acos(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the angle, in radians, whose cosine is the specified numerical value. This angle is called the arccosine.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg1">The cosine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Asin(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the angle, in radians, whose sine is the specified numerical value. This angle is called the arcsine.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The sine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Asin(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the angle, in radians, whose sine is the specified numerical value. This angle is called the arcsine.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The sine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the angle, in radians, whose tangent is the specified numerical value. This angle is called the arctangent.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The tangent of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the angle, in radians, whose tangent is the specified numerical value. This angle is called the arctangent.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The tangent of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan2(System.Nullable{System.Double},System.Nullable{System.Double})">
            <summary>Returns the positive angle, in radians, between the positive x-axis and the ray from the origin through the point (x, y), where x and y are the two specified numerical values. The first parameter passed to the function is the y-value and the second parameter is the x-value.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg1">The y-coordinate of a point.</param>
            <param name="arg2">The x-coordinate of a point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan2(System.Nullable{System.Decimal},System.Nullable{System.Decimal})">
            <summary>Returns the positive angle, in radians, between the positive x-axis and the ray from the origin through the point (x, y), where x and y are the two specified numerical values. The first parameter passed to the function is the y-value and the second parameter is the x-value.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg1">The y-coordinate of a point.</param>
            <param name="arg2">The x-coordinate of a point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cos(System.Nullable{System.Double})">
            <summary>Returns the trigonometric cosine of the specified angle, in radians, in the specified expression.</summary>
            <returns>The trigonometric cosine of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cos(System.Nullable{System.Decimal})">
            <summary>Returns the trigonometric cosine of the specified angle, in radians, in the specified expression.</summary>
            <returns>The trigonometric cosine of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cot(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the trigonometric cotangent of the specified angle, in radians.</summary>
            <returns>The trigonometric cotangent of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cot(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the trigonometric cotangent of the specified angle, in radians.</summary>
            <returns>The trigonometric cotangent of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Int32})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Int64})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Decimal})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Double})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Exp(System.Nullable{System.Double})">
            <summary>Returns the exponential value of the specified float expression.</summary>
            <returns>The constant e raised to the power of the input value.</returns>
            <param name="arg">The input value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Exp(System.Nullable{System.Decimal})">
            <summary>Returns the exponential value of the specified float expression.</summary>
            <returns>The constant e raised to the power of the input value.</returns>
            <param name="arg">The input value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log(System.Nullable{System.Double})">
            <summary>Returns the natural logarithm of the specified input value.</summary>
            <returns>The natural logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log(System.Nullable{System.Decimal})">
            <summary>Returns the natural logarithm of the specified input value.</summary>
            <returns>The natural logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log10(System.Nullable{System.Double})">
            <summary>Returns the base-10 logarithm of the specified input value.</summary>
            <returns>The base-10 logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log10(System.Nullable{System.Decimal})">
            <summary>Returns the base-10 logarithm of the specified input value.</summary>
            <returns>The base-10 logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Pi">
            <summary>Returns the constant value of pi.</summary>
            <returns>The numeric value of pi.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Int32})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Int64})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Decimal})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Double})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Rand">
            <summary>Returns a pseudo-random float value from 0 through 1, exclusive.</summary>
            <returns>The pseudo-random value.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Rand(System.Nullable{System.Int32})">
            <summary>Returns a pseudo-random float value from 0 through 1, exclusive.</summary>
            <returns>The pseudo-random value.</returns>
            <param name="seed">The seed value. If  seed  is not specified, the SQL Server Database Engine assigns a seed value at random. For a specified seed value, the result returned is always the same.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Int32})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Int64})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Decimal})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Double})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sin(System.Nullable{System.Decimal})">
            <summary>Returns the trigonometric sine of the specified angle.</summary>
            <returns>The trigonometric sine of the input expression.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sin(System.Nullable{System.Double})">
            <summary>Returns the trigonometric sine of the specified angle.</summary>
            <returns>The trigonometric sine of the input expression.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.SquareRoot(System.Nullable{System.Double})">
            <summary>Returns the square root of the specified number.</summary>
            <returns>The square root of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.SquareRoot(System.Nullable{System.Decimal})">
            <summary>Returns the square root of the specified number.</summary>
            <returns>The square root of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Square(System.Nullable{System.Double})">
            <summary>Returns the square of the specified number.</summary>
            <returns>The square of the input value.</returns>
            <param name="arg1">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Square(System.Nullable{System.Decimal})">
            <summary>Returns the square of the specified number.</summary>
            <returns>The square of the input value.</returns>
            <param name="arg1">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Tan(System.Nullable{System.Double})">
            <summary>Returns the trigonometric tangent of the input expression.</summary>
            <returns>The tangent of the input angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Tan(System.Nullable{System.Decimal})">
            <summary>Returns the trigonometric tangent of the input expression.</summary>
            <returns>The tangent of the input angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.Nullable{System.DateTime})">
            <summary>Returns a new datetime value based on adding an interval to the specified date.</summary>
            <returns>The new date.</returns>
            <param name="datePartArg">The part of the date to increment. </param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="date">The date to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.Nullable{System.TimeSpan})">
            <summary>Returns a new time span value based on adding an interval to the specified time span.</summary>
            <returns>The new time span.</returns>
            <param name="datePartArg">The part of the date to increment.</param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="time">The time span to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.Nullable{System.DateTimeOffset})">
            <summary>Returns a new date value based on adding an interval to the specified date.</summary>
            <returns>The new point in time, expressed as a date and time of day, relative to Coordinated Universal Time (UTC).</returns>
            <param name="datePartArg">The part of the date to increment.</param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="dateTimeOffsetArg">The date to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.String)">
            <summary>Returns a new datetime value based on adding an interval to the specified date.</summary>
            <returns>
            A <see cref="T:System.Nullable`1" /> of <see cref="T:System.DateTime" /> value that is the new date.
            </returns>
            <param name="datePartArg">The part of the date to increment.</param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="date">The date to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The value specifying the number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two Dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.Nullable{System.DateTime})">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.String)">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.Nullable{System.TimeSpan})">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.Nullable{System.DateTimeOffset})">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.Nullable{System.DateTime})">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.Nullable{System.DateTimeOffset})">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.String)">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.Nullable{System.TimeSpan})">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.GetDate">
            <summary>Returns the current database system timestamp as a datetime value without the database time zone offset. This value is derived from the operating system of the computer on which the instance of SQL Server is running.</summary>
            <returns>The current database timestamp.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.GetUtcDate">
            <summary>Returns the current database system timestamp as a datetime value. The database time zone offset is not included. This value represents the current UTC time (Coordinated Universal Time). This value is derived from the operating system of the computer on which the instance of SQL Server is running.</summary>
            <returns>The current database UTC timestamp.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Boolean})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Double})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Decimal})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.DateTime})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.TimeSpan})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.DateTimeOffset})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.String)">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Byte[])">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Guid})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Boolean})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Double})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Decimal})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.String)">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTime})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.TimeSpan})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTimeOffset})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Byte[])">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The character array for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Guid})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Double},System.Nullable{System.Double})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Decimal},System.Nullable{System.Decimal})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.String,System.String)">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTime},System.Nullable{System.DateTime})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Byte[],System.Byte[])">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The character array for which the checksum is calculated.</param>
            <param name="arg2">The character array for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Guid},System.Nullable{System.Guid})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Double})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Decimal},System.Nullable{System.Decimal},System.Nullable{System.Decimal})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.String,System.String,System.String)">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTime},System.Nullable{System.DateTime},System.Nullable{System.DateTime})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Byte[],System.Byte[],System.Byte[])">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The character array for which the checksum is calculated.</param>
            <param name="arg2">The character array for which the checksum is calculated.</param>
            <param name="arg3">The character array for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Guid},System.Nullable{System.Guid},System.Nullable{System.Guid})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CurrentTimestamp">
            <summary>Returns the current date and time. </summary>
            <returns>The current date and time.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CurrentUser">
            <summary>Returns the name of the current user.</summary>
            <returns>The name of the current user.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.HostName">
            <summary>Returns the workstation name.</summary>
            <returns>The name of the workstation.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.UserName(System.Nullable{System.Int32})">
            <summary>Returns a database user name corresponding to a specified identification number.</summary>
            <returns>The user name.</returns>
            <param name="arg">A user ID.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.UserName">
            <summary>Returns a database user name corresponding to a specified identification number.</summary>
            <returns>The user name.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.IsNumeric(System.String)">
            <summary>Indicates whether the input value is a valid numeric type.</summary>
            <returns>1 if the input expression is a valid numeric data type; otherwise, 0.</returns>
            <param name="arg">A string expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.IsDate(System.String)">
            <summary>Indicates whether the input value is a valid date or time.</summary>
            <returns>1 if the input expression is a valid date or time value of datetime or smalldatetime data types; otherwise, 0.</returns>
            <param name="arg">The tested value.</param>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions">
            <summary>
            Contains function stubs that expose SqlServer methods in Linq to Entities.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.GetAncestor(System.Data.Entity.Hierarchy.HierarchyId,System.Int32)">
            <summary>Returns a hierarchyid representing the nth ancestor of this.</summary>
            <returns>A hierarchyid representing the nth ancestor of this.</returns>
            <param name="hierarchyIdValue">The hierarchyid value.</param>
            <param name="n">n</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.GetDescendant(System.Data.Entity.Hierarchy.HierarchyId,System.Data.Entity.Hierarchy.HierarchyId,System.Data.Entity.Hierarchy.HierarchyId)">
            <summary>Returns a child node of the parent.</summary>
            <param name="hierarchyIdValue">The hierarchyid value.</param>
            <param name="child1"> null or the hierarchyid of a child of the current node. </param>
            <param name="child2"> null or the hierarchyid of a child of the current node. </param>
            <returns>
            Returns one child node that is a descendant of the parent.
            If parent is null, returns null.
            If parent is not null, and both child1 and child2 are null, returns a child of parent.
            If parent and child1 are not null, and child2 is null, returns a child of parent greater than child1.
            If parent and child2 are not null and child1 is null, returns a child of parent less than child2.
            If parent, child1, and child2 are not null, returns a child of parent greater than child1 and less than child2.
            If child1 is not null and not a child of parent, an exception is raised.
            If child2 is not null and not a child of parent, an exception is raised.
            If child1 >= child2, an exception is raised.
            </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.GetLevel(System.Data.Entity.Hierarchy.HierarchyId)">
            <summary>Returns an integer that represents the depth of the node this in the tree.</summary>
            <returns>An integer that represents the depth of the node this in the tree.</returns>
            <param name="hierarchyIdValue">The hierarchyid value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.GetRoot">
            <summary>Returns the root of the hierarchy tree.</summary>
            <returns>The root of the hierarchy tree.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.IsDescendantOf(System.Data.Entity.Hierarchy.HierarchyId,System.Data.Entity.Hierarchy.HierarchyId)">
            <summary>Returns true if this is a descendant of parent.</summary>
            <returns>True if this is a descendant of parent.</returns>
            <param name="hierarchyIdValue">The hierarchyid value.</param>
            <param name="parent">parent</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.GetReparentedValue(System.Data.Entity.Hierarchy.HierarchyId,System.Data.Entity.Hierarchy.HierarchyId,System.Data.Entity.Hierarchy.HierarchyId)">
            <summary>Returns a node whose path from the root is the path to newRoot, followed by the path from oldRoot to this.</summary>
            <returns>Hierarchyid value.</returns>
            <param name="hierarchyIdValue">The hierarchyid value.</param>
            <param name="oldRoot">oldRoot</param>
            <param name="newRoot">newRoot</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.Parse(System.String)">
            <summary>Converts the canonical string representation of a hierarchyid to a hierarchyid value.</summary>
            <returns>Hierarchyid value.</returns>
            <param name="input">input</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderManifest.SupportsParameterOptimizationInSchemaQueries">
            <summary>
            Indicates if the provider supports the parameter optimization described in EntityFramework6 GitHub issue #195.
            </summary>
            <returns><c>True</c> since this provider supports the parameter optimization.</returns>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlProviderServices">
            <summary>
            The DbProviderServices implementation for the SqlClient provider for SQL Server.
            </summary>
            <remarks>
            Note that instance of this type also resolve additional provider services for Microsoft SQL Server
            when this type is registered as an EF provider either using an entry in the application's config file
            or through code-based registration in <see cref="T:System.Data.Entity.DbConfiguration" />.
            The services resolved are:
            Requests for <see cref="T:System.Data.Entity.Infrastructure.IDbConnectionFactory" /> are resolved to a Singleton instance of
            <see cref="T:System.Data.Entity.Infrastructure.LocalDbConnectionFactory" /> to create connections to LocalDB by default.
            Requests for <see cref="T:System.Func`1" /> for the invariant name "System.Data.SqlClient"
            for any server name are resolved to a delegate that returns a <see cref="T:System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy" />
            to provide a non-retrying policy for SQL Server.
            Requests for <see cref="T:System.Data.Entity.Migrations.Sql.MigrationSqlGenerator" /> for the invariant name "System.Data.SqlClient" are
            resolved to <see cref="T:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator" /> instances to provide default Migrations SQL
            generation for SQL Server.
            Requests for <see cref="T:System.Data.Entity.Spatial.DbSpatialServices" /> for the invariant name "System.Data.SqlClient" are
            resolved to a Singleton instance of <see cref="T:System.Data.Entity.SqlServer.SqlSpatialServices" /> to provide default spatial
            services for SQL Server.
            </remarks>
        </member>
        <member name="F:System.Data.Entity.SqlServer.SqlProviderServices.ProviderInvariantName">
            <summary>
            This is the well-known string using in configuration files and code-based configuration as
            the "provider invariant name" used to specify Microsoft SQL Server for ADO.NET and
            Entity Framework provider services.
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.Instance">
            <summary>
            The Singleton instance of the SqlProviderServices type.
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.SqlServerTypesAssemblyName">
            <summary>
            Set to the full name of the Microsoft.SqlServer.Types assembly to override the default selection
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.TruncateDecimalsToScale">
            <summary>
            Get or sets a value indicating whether <see cref="T:System.Decimal" /> parameter values are truncated to 
            the scale (number of decimal places) defined for their corresponding columns when they are sent 
            to the database. A value of <c>true</c> indicates that <see cref="T:System.Data.SqlClient.SqlParameter" /> objects 
            created for <see cref="T:System.Decimal" /> columns will have their <see cref="P:System.Data.SqlClient.SqlParameter.Scale" /> 
            properties set, which will cause the parameter values to be truncated. If set to <c>false</c> 
            then the <see cref="P:System.Data.SqlClient.SqlParameter.Scale" /> properties will not be set, avoiding the truncation 
            behavior of <see cref="T:System.Data.SqlClient.SqlParameter" /> and allowing SQL Server to round values if necessary. 
            The default value is <c>true</c> to prevent breaking existing applications that depend on this 
            behavior. 
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.UseScopeIdentity">
            <summary>
            Gets or sets a value indicating whether to use the SCOPE_IDENTITY() function to retrieve values 
            generated by the database for numeric columns during an INSERT operation. The default value of 
            <c>true</c> is recommended and can provide better performance if all numeric values are generated 
            using IDENTITY columns. If set to <c>false</c>, an OUTPUT clause will be used instead. An OUTPUT 
            clause makes it possible to retrieve values generated by sequences or other means.
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.UseRowNumberOrderingInOffsetQueries">
            <summary>
            Gets or sets a value indicating whether the ROW_NUMBER() function is used in sort expression 
            passed to the ORDER BY clause when OFFSET is present in query. The default value of <c>true</c> 
            is recommended to obtain query results that are stable for paging operations. The value of 
            <c>false</c> can be used for compatibility with previous versions of EF and will cause the sort 
            expression to be passed unmodified to the ORDER BY clause, which can lead to unstable results 
            if the ordering is ambiguous. 
            </summary>
            <remarks>
            This flag only applies to SQL Server 2012 or later. This flag does not affect queries that have 
            already been translated to SQL and cached, therefore applications that need to set the value to 
            <c>false</c> for compatibility should do so before executing any queries.
            </remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.RegisterInfoMessageHandler(System.Data.Common.DbConnection,System.Action{System.String})">
            <summary>
            Registers a handler to process non-error messages coming from the database provider.
            </summary>
            <param name="connection"> The connection to receive information for. </param>
            <param name="handler"> The handler to process messages. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.CreateDbCommandDefinition(System.Data.Entity.Core.Common.DbProviderManifest,System.Data.Entity.Core.Common.CommandTrees.DbCommandTree)">
            <summary>
            Create a Command Definition object, given the connection and command tree
            </summary>
            <param name="providerManifest"> provider manifest that was determined from metadata </param>
            <param name="commandTree"> command tree for the statement </param>
            <returns> an executable command definition object </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.CloneDbCommand(System.Data.Common.DbCommand)">
            <summary>
            See issue 2390 - cloning the DesignTimeVisible property on the
            <see cref="T:System.Data.SqlClient.SqlCommand" /> can cause deadlocks.
            So here overriding to provide a method that does not clone DesignTimeVisible.
            </summary>
            <param name="fromDbCommand"> the <see cref="T:System.Data.Common.DbCommand" /> object to clone </param>
            <returns >a clone of the <see cref="T:System.Data.Common.DbCommand" /> </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.SetDbParameterValue(System.Data.Common.DbParameter,System.Data.Entity.Core.Metadata.Edm.TypeUsage,System.Object)">
            <summary>
            Sets the parameter value and appropriate facets for the given <see cref="T:System.Data.Entity.Core.Metadata.Edm.TypeUsage"/>.
            </summary>
            <param name="parameter">The parameter.</param>
            <param name="parameterType">The type of the parameter.</param>
            <param name="value">The value of the parameter.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.GetDbProviderManifestToken(System.Data.Common.DbConnection)">
            <summary>
            Returns provider manifest token for a given connection.
            </summary>
            <param name="connection"> Connection to find manifest token from. </param>
            <returns> The provider manifest token for the specified connection. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.GetDbProviderManifest(System.String)">
            <summary>
            Returns the provider manifest by using the specified version information.
            </summary>
            <param name="versionHint"> The token information associated with the provider manifest. </param>
            <returns> The provider manifest by using the specified version information. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.GetDbSpatialDataReader(System.Data.Common.DbDataReader,System.String)">
            <summary>
            Gets a spatial data reader for SQL Server.
            </summary>
            <param name="fromReader"> The reader where the spatial data came from. </param>
            <param name="versionHint"> The manifest token associated with the provider manifest. </param>
            <returns> The spatial data reader. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbGetSpatialServices(System.String)">
            <summary>
            Gets a spatial data reader for SQL Server.
            </summary>
            <param name="versionHint"> The manifest token associated with the provider manifest. </param>
            <returns> The spatial data reader. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabaseScript(System.String,System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Generates a data definition language (DDL) script that creates schema objects 
            (tables, primary keys, foreign keys) based on the contents of the StoreItemCollection 
            parameter and targeted for the version of the database corresponding to the provider manifest token.
            </summary>
            <param name="providerManifestToken"> The provider manifest token identifying the target version. </param>
            <param name="storeItemCollection"> The structure of the database. </param>
            <returns>
            A DDL script that creates schema objects based on the contents of the StoreItemCollection parameter 
            and targeted for the version of the database corresponding to the provider manifest token.
            </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabase(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Create the database and the database objects.
            If initial catalog is not specified, but AttachDBFilename is specified, we generate a random database name based on the AttachDBFilename.
            Note: this causes pollution of the db, as when the connection string is later used, the mdf will get attached under a different name.
            However if we try to replicate the name under which it would be attached, the following scenario would fail:
            The file does not exist, but registered with database.
            The user calls:  If (DatabaseExists) DeleteDatabase
            CreateDatabase
            For further details on the behavior when AttachDBFilename is specified see Dev10# 188936
            </summary>
            <param name="connection">Connection to a non-existent database that needs to be created and populated with the store objects indicated with the storeItemCollection parameter.</param>
            <param name="commandTimeout">Execution timeout for any commands needed to create the database.</param>
            <param name="storeItemCollection">The collection of all store items based on which the script should be created.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbDatabaseExists(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Determines whether the database for the given connection exists.
            There are three cases:
            1.  Initial Catalog = X, AttachDBFilename = null:   (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            2.  Initial Catalog = X, AttachDBFilename = F:      if (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0 then <c>true</c>,
            if not, try to open the connection and then return (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            3.  Initial Catalog = null, AttachDBFilename = F:   Try to open the connection. If that succeeds the result is true, otherwise
            if the there are no databases corresponding to the given file return <c>false</c>, otherwise throw.
            Note: We open the connection to cover the scenario when the mdf exists, but is not attached.
            Given that opening the connection would auto-attach it, it would not be appropriate to return <c>false</c> in this case.
            Also note that checking for the existence of the file does not work for a remote server.  (Dev11 #290487)
            For further details on the behavior when AttachDBFilename is specified see Dev10# 188936
            </summary>
            <param name="connection">Connection to a database whose existence is checked by this method.</param>
            <param name="commandTimeout">Execution timeout for any commands needed to determine the existence of the database.</param>
            <param name="storeItemCollection">The collection of all store items from the model. This parameter is no longer used for determining database existence.</param>
            <returns>True if the provider can deduce the database only based on the connection.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbDatabaseExists(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Lazy{System.Data.Entity.Core.Metadata.Edm.StoreItemCollection})">
            <summary>
            Determines whether the database for the given connection exists.
            There are three cases:
            1.  Initial Catalog = X, AttachDBFilename = null:   (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            2.  Initial Catalog = X, AttachDBFilename = F:      if (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0 then <c>true</c>,
            if not, try to open the connection and then return (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            3.  Initial Catalog = null, AttachDBFilename = F:   Try to open the connection. If that succeeds the result is true, otherwise
            if the there are no databases corresponding to the given file return <c>false</c>, otherwise throw.
            Note: We open the connection to cover the scenario when the mdf exists, but is not attached.
            Given that opening the connection would auto-attach it, it would not be appropriate to return <c>false</c> in this case.
            Also note that checking for the existence of the file does not work for a remote server.  (Dev11 #290487)
            For further details on the behavior when AttachDBFilename is specified see Dev10# 188936
            </summary>
            <param name="connection">Connection to a database whose existence is checked by this method.</param>
            <param name="commandTimeout">Execution timeout for any commands needed to determine the existence of the database.</param>
            <param name="storeItemCollection">The collection of all store items from the model. This parameter is no longer used for determining database existence.</param>
            <returns>True if the provider can deduce the database only based on the connection.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbDeleteDatabase(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Delete the database for the given connection.
            There are three cases:
            1.  If Initial Catalog is specified (X) drop database X
            2.  Else if AttachDBFilename is specified (F) drop all the databases corresponding to F
            if none throw
            3.  If niether the catalog not the file name is specified - throw
            Note that directly deleting the files does not work for a remote server.  However, even for not attached
            databases the current logic would work assuming the user does: if (DatabaseExists) DeleteDatabase
            </summary>
            <param name="connection"> Connection </param>
            <param name="commandTimeout"> Timeout for internal commands. </param>
            <param name="storeItemCollection"> Item Collection. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.CloneDbConnection(System.Data.Common.DbConnection,System.Data.Common.DbProviderFactory)">
            <summary>
            Clones the connection.
            </summary>
            <param name="connection">The original connection.</param>
            <param name="factory">The factory to use.</param>
            <returns>Cloned connection</returns>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator">
            <summary>
            Provider to convert provider agnostic migration operations into SQL commands
            that can be run against a Microsoft SQL Server database.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.IsPermissionDeniedError(System.Exception)">
            <summary>
            Determines if a provider specific exception corresponds to a database-level permission denied error.
            </summary>
            <param name="exception">The database exception.</param>
            <returns> true if the supplied exception corresponds to a database-level permission denied error; otherwise false. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Collections.Generic.IEnumerable{System.Data.Entity.Migrations.Model.MigrationOperation},System.String)">
            <summary>
            Converts a set of migration operations into Microsoft SQL Server specific SQL.
            </summary>
            <param name="migrationOperations"> The operations to be converted. </param>
            <param name="providerManifestToken"> Token representing the version of SQL Server being targeted (i.e. "2005", "2008"). </param>
            <returns> A list of SQL statements to be executed to perform the migration operations. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GenerateProcedureBody(System.Collections.Generic.ICollection{System.Data.Entity.Core.Common.CommandTrees.DbModificationCommandTree},System.String,System.String)">
            <summary>
            Generates the SQL body for a stored procedure.
            </summary>
            <param name="commandTrees">The command trees representing the commands for an insert, update or delete operation.</param>
            <param name="rowsAffectedParameter">The rows affected parameter name.</param>
            <param name="providerManifestToken">The provider manifest token.</param>
            <returns>The SQL body for the stored procedure.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.UpdateDatabaseOperation)">
            <summary>
            Generates the specified update database operation which represents applying a series of migrations.
            The generated script is idempotent, meaning it contains conditional logic to check if individual migrations 
            have already been applied and only apply the pending ones.
            </summary>
            <param name="updateDatabaseOperation">The update database operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.MigrationOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.MigrationOperation" />.
            Allows derived providers to handle additional operation types.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="migrationOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.CreateConnection">
            <summary>
            Creates an empty connection for the current provider.
            Allows derived providers to use connection other than <see cref="T:System.Data.SqlClient.SqlConnection" />.
            </summary>
            <returns> An empty connection for the current provider. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.CreateProcedureOperation)">
            <summary>
            Generates the specified create procedure operation.
            </summary>
            <param name="createProcedureOperation">The create procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AlterProcedureOperation)">
            <summary>
            Generates the specified alter procedure operation.
            </summary>
            <param name="alterProcedureOperation">The alter procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropProcedureOperation)">
            <summary>
            Generates the specified drop procedure operation.
            </summary>
            <param name="dropProcedureOperation">The drop procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.CreateTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.CreateTableOperation" />. This method differs from
            <see cref="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.WriteCreateTable(System.Data.Entity.Migrations.Model.CreateTableOperation)" /> in that it will
            create the target database schema if it does not already exist.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.WriteCreateTable(System.Data.Entity.Migrations.Model.CreateTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.CreateTableOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.WriteCreateTable(System.Data.Entity.Migrations.Model.CreateTableOperation,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Writes CREATE TABLE SQL to the target writer.
            </summary>
            <param name="createTableOperation"> The operation to produce SQL for. </param>
            <param name="writer"> The target writer. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AlterTableOperation)">
            <summary>
            Override this method to generate SQL when the definition of a table or its attributes are changed.
            The default implementation of this method does nothing.
            </summary>
            <param name="alterTableOperation"> The operation describing changes to the table. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GenerateMakeSystemTable(System.Data.Entity.Migrations.Model.CreateTableOperation,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Generates SQL to mark a table as a system table.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createTableOperation"> The table to mark as a system table. </param>
            <param name="writer"> The <see cref='T:System.Data.Entity.Migrations.Utilities.IndentedTextWriter' /> to write the generated SQL to. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GenerateCreateSchema(System.String)">
            <summary>
            Generates SQL to create a database schema.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="schema"> The name of the schema to create. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AddForeignKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AddForeignKeyOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="addForeignKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropForeignKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropForeignKeyOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropForeignKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.CreateIndexOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.CreateIndexOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createIndexOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropIndexOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropIndexOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropIndexOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AddPrimaryKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AddPrimaryKeyOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="addPrimaryKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropPrimaryKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropPrimaryKeyOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropPrimaryKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AddColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AddColumnOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="addColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropColumnOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AlterColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AlterColumnOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="alterColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.DropDefaultConstraint(System.String,System.String,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Call this method to generate SQL that will attempt to drop the default constraint created
            when a column is created. This method is usually called by code that overrides the creation or
            altering of columns.
            </summary>
            <param name="table">The table to which the constraint applies.</param>
            <param name="column">The column to which the constraint applies.</param>
            <param name="writer">The writer to which generated SQL should be written.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropTableOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.SqlOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.SqlOperation" />.
            Generated SQL should be added using the Statement or StatementBatch methods.
            </summary>
            <param name="sqlOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.RenameColumnOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="renameColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameIndexOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.RenameIndexOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="renameIndexOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.RenameTableOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="renameTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameProcedureOperation)">
            <summary>
            Generates the specified rename procedure operation.
            </summary>
            <param name="renameProcedureOperation">The rename procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.MoveProcedureOperation)">
            <summary>
            Generates the specified move procedure operation.
            </summary>
            <param name="moveProcedureOperation">The move procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.MoveTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.MoveTableOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="moveTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.ColumnModel,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Generates SQL for the given column model. This method is called by other methods that
            process columns and can be overridden to change the SQL generated.
            </summary>
            <param name="column">The column for which SQL is being generated.</param>
            <param name="writer">The writer to which generated SQL should be written.</param>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GuidColumnDefault">
            <summary>
            Returns the column default value to use for store-generated GUID columns when
            no default value is explicitly specified in the migration.
            Returns newsequentialid() for on-premises SQL Server 2005 and later.
            Returns newid() for SQL Azure.
            </summary>
            <value>Either newsequentialid() or newid() as described above.</value>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.HistoryOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.HistoryOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="historyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Byte[])">
            <summary>
            Generates SQL to specify a constant byte[] default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Boolean)">
            <summary>
            Generates SQL to specify a constant bool default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.DateTime)">
            <summary>
            Generates SQL to specify a constant DateTime default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.DateTimeOffset)">
            <summary>
            Generates SQL to specify a constant DateTimeOffset default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Guid)">
            <summary>
            Generates SQL to specify a constant Guid default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.String)">
            <summary>
            Generates SQL to specify a constant string default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.TimeSpan)">
            <summary>
            Generates SQL to specify a constant TimeSpan default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Hierarchy.HierarchyId)">
            <summary>
            Generates SQL to specify a constant hierarchyid default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Spatial.DbGeography)">
            <summary>
            Generates SQL to specify a constant geogrpahy default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Spatial.DbGeometry)">
            <summary>
            Generates SQL to specify a constant geometry default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Object)">
            <summary>
            Generates SQL to specify a constant default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.BuildColumnType(System.Data.Entity.Migrations.Model.ColumnModel)">
            <summary>
            Generates SQL to specify the data type of a column.
            This method just generates the actual type, not the SQL to create the column.
            </summary>
            <param name="columnModel"> The definition of the column. </param>
            <returns> SQL representing the data type. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Name(System.String)">
            <summary>
            Generates a quoted name. The supplied name may or may not contain the schema.
            </summary>
            <param name="name"> The name to be quoted. </param>
            <returns> The quoted name. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Quote(System.String)">
            <summary>
            Quotes an identifier for SQL Server.
            </summary>
            <param name="identifier"> The identifier to be quoted. </param>
            <returns> The quoted identifier. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Statement(System.String,System.Boolean,System.String)">
            <summary>
            Adds a new Statement to be executed against the database.
            </summary>
            <param name="sql"> The statement to be executed. </param>
            <param name="suppressTransaction"> Gets or sets a value indicating whether this statement should be performed outside of the transaction scope that is used to make the migration process transactional. If set to true, this operation will not be rolled back if the migration process fails. </param>
            <param name="batchTerminator">The batch terminator for the database provider.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Writer">
            <summary>
            Gets a new <see cref="T:System.Data.Entity.Migrations.Utilities.IndentedTextWriter" /> that can be used to build SQL.
            This is just a helper method to create a writer. Writing to the writer will
            not cause SQL to be registered for execution. You must pass the generated
            SQL to the Statement method.
            </summary>
            <returns> An empty text writer to use for SQL generation. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Statement(System.Data.Entity.Migrations.Utilities.IndentedTextWriter,System.String)">
            <summary>
            Adds a new Statement to be executed against the database.
            </summary>
            <param name="writer"> The writer containing the SQL to be executed. </param>
            <param name="batchTerminator">The batch terminator for the database provider.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.StatementBatch(System.String,System.Boolean)">
            <summary>
            Breaks sql string into one or more statements, handling T-SQL utility statements as necessary.
            </summary>
            <param name="sqlBatch"> The SQL to split into one ore more statements to be executed. </param>
            <param name="suppressTransaction"> Gets or sets a value indicating whether this statement should be performed outside of the transaction scope that is used to make the migration process transactional. If set to true, this operation will not be rolled back if the migration process fails. </param>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlSpatialFunctions">
            <summary>
            Contains function stubs that expose SqlServer methods in Linq to Entities.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.PointGeography(System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Int32})">
            <summary>Constructs a geography instance representing a Point instance from its x and y values and a spatial reference ID (SRID). </summary>
            <returns>The constructed geography instance.</returns>
            <param name="latitude">The x-coordinate of the Point being generated.</param>
            <param name="longitude">The y-coordinate of the Point being generated</param>
            <param name="spatialReferenceId">The SRID of the geography instance.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.AsTextZM(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns the Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geography instance augmented with any Z (elevation) and M (measure) values carried by the instance.</summary>
            <returns>The Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geography instance.</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.BufferWithTolerance(System.Data.Entity.Spatial.DbGeography,System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Boolean})">
            <summary>Returns a geometric object representing the union of all point values whose distance from a geography instance is less than or equal to a specified value, allowing for a specified tolerance.</summary>
            <returns>The union of all point values whose distance from a geography instance is less than or equal to a specified value</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="distance">The distance.</param>
            <param name="tolerance">The specified tolerance.</param>
            <param name="relative">Specifying whether the tolerance value is relative or absolute.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.EnvelopeAngle(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns the maximum angle between the point returned by EnvelopeCenter() and a point in the geography instance in degrees.</summary>
            <returns>the maximum angle between the point returned by EnvelopeCenter().</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.EnvelopeCenter(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns a point that can be used as the center of a bounding circle for the geography instance.</summary>
            <returns>A SqlGeography value that specifies the location of the center of a bounding circle.</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Filter(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <summary>Offers a fast, index-only intersection method to determine if a geography instance intersects another SqlGeography instance, assuming an index is available.</summary>
            <returns>True if a geography instance potentially intersects another SqlGeography instance; otherwise, false.</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="geographyOther">Another geography instance to compare against the instance on which Filter is invoked.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.InstanceOf(System.Data.Entity.Spatial.DbGeography,System.String)">
            <summary>Tests if the SqlGeography instance is the same as the specified type.</summary>
            <returns>A string that specifies one of the 12 types exposed in the geography type hierarchy.</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="geometryTypeName">A string that specifies one of the 12 types exposed in the geography type hierarchy.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.NumRings(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns the total number of rings in a Polygon instance.</summary>
            <returns>The total number of rings.</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Reduce(System.Data.Entity.Spatial.DbGeography,System.Nullable{System.Double})">
            <summary>Returns an approximation of the given geography instance produced by running the Douglas-Peucker algorithm on the instance with the given tolerance.</summary>
            <returns>
            Returns <see cref="T:System.Data.Entity.Spatial.DbGeography" />.
            </returns>
            <param name="geographyValue">The geography value.</param>
            <param name="tolerance">The tolerance to input to the Douglas-Peucker algorithm. tolerance must be a positive number.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.RingN(System.Data.Entity.Spatial.DbGeography,System.Nullable{System.Int32})">
            <summary>Returns the specified ring of the SqlGeography instance: 1 ≤ n ≤ NumRings().</summary>
            <returns>A SqlGeography object that represents the ring specified by n.</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="index">An int expression between 1 and the number of rings in a polygon instance.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.PointGeometry(System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Int32})">
            <summary>Constructs a geometry instance representing a Point instance from its x and y values and a spatial reference ID (SRID). </summary>
            <returns>The constructed geometry instance.</returns>
            <param name="xCoordinate">The x-coordinate of the Point being generated.</param>
            <param name="yCoordinate">The y-coordinate of the Point being generated</param>
            <param name="spatialReferenceId">The SRID of the geography instance.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.AsTextZM(System.Data.Entity.Spatial.DbGeometry)">
            <summary>Returns the Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geography instance augmented with any Z (elevation) and M (measure) values carried by the instance.</summary>
            <returns>The Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geometry instance.</returns>
            <param name="geometryValue">The geometry value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.BufferWithTolerance(System.Data.Entity.Spatial.DbGeometry,System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Boolean})">
            <summary>Returns a geometric object representing the union of all point values whose distance from a geometry instance is less than or equal to a specified value, allowing for a specified tolerance.</summary>
            <returns>The union of all point values whose distance from a geometry instance is less than or equal to a specified value</returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="distance">The distance.</param>
            <param name="tolerance">The specified tolerance.</param>
            <param name="relative">Specifying whether the tolerance value is relative or absolute.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.InstanceOf(System.Data.Entity.Spatial.DbGeometry,System.String)">
            <summary>Tests if the SqlGeometry instance is the same as the specified type.</summary>
            <returns>A string that specifies one of the 12 types exposed in the geography type hierarchy.</returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="geometryTypeName">A string that specifies one of the 12 types exposed in the geography type hierarchy.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Filter(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <summary>Offers a fast, index-only intersection method to determine if a geography instance intersects another SqlGeometry instance, assuming an index is available.</summary>
            <returns>True if a geography instance potentially intersects another SqlGeography instance; otherwise, false.</returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="geometryOther">Another geography instance to compare against the instance on which Filter is invoked.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.MakeValid(System.Data.Entity.Spatial.DbGeometry)">
            <summary>Converts an invalid geometry instance into a geometry instance with a valid Open Geospatial Consortium (OGC) type. </summary>
            <returns>The converted geometry instance.</returns>
            <param name="geometryValue">The geometry value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Reduce(System.Data.Entity.Spatial.DbGeometry,System.Nullable{System.Double})">
            <summary>Returns an approximation of the given geography instance produced by running the Douglas-Peucker algorithm on the instance with the given tolerance.</summary>
            <returns>
            Returns <see cref="T:System.Data.Entity.Spatial.DbGeometry" />.
            </returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="tolerance">The tolerance to input to the Douglas-Peucker algorithm. tolerance must be a positive number.</param>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlSpatialServices">
            <summary>
            An implementation of <see cref="T:System.Data.Entity.Spatial.DbSpatialServices"/> to provide support for geospatial types when using
            Entity Framework with Microsoft SQL Server.
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlSpatialServices.NativeTypesAvailable">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateProviderValue(System.Data.Entity.Spatial.DbGeographyWellKnownValue)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromProviderValue(System.Object)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateWellKnownValue(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateProviderValue(System.Data.Entity.Spatial.DbGeometryWellKnownValue)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromProviderValue(System.Object)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateWellKnownValue(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsTextIncludingElevationAndMeasure(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsTextIncludingElevationAndMeasure(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromText(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyCollectionFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromBinary(System.Byte[])">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyCollectionFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromGml(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromGml(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetCoordinateSystemId(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetSpatialTypeName(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetDimension(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsBinary(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsGml(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsText(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsEmpty(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SpatialEquals(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Disjoint(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersects(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Buffer(System.Data.Entity.Spatial.DbGeography,System.Double)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Distance(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersection(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Union(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Difference(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SymmetricDifference(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElementCount(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.ElementAt(System.Data.Entity.Spatial.DbGeography,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLatitude(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLongitude(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElevation(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetMeasure(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLength(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetStartPoint(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetEndPoint(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsClosed(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetPointCount(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.PointAt(System.Data.Entity.Spatial.DbGeography,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetArea(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromText(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryCollectionFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromBinary(System.Byte[])">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryCollectionFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromGml(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromGml(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetCoordinateSystemId(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetSpatialTypeName(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetDimension(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetEnvelope(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsBinary(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsGml(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsText(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsEmpty(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsSimple(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetBoundary(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsValid(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SpatialEquals(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Disjoint(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersects(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Touches(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Crosses(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Within(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Contains(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Overlaps(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Relate(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry,System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Buffer(System.Data.Entity.Spatial.DbGeometry,System.Double)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Distance(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetConvexHull(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersection(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Union(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Difference(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SymmetricDifference(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElementCount(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.ElementAt(System.Data.Entity.Spatial.DbGeometry,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetXCoordinate(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetYCoordinate(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElevation(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetMeasure(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLength(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetStartPoint(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetEndPoint(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsClosed(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsRing(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetPointCount(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.PointAt(System.Data.Entity.Spatial.DbGeometry,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetArea(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetCentroid(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetPointOnSurface(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetExteriorRing(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetInteriorRingCount(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.InteriorRingAt(System.Data.Entity.Spatial.DbGeometry,System.Int32)">
            <inheritdoc />
        </member>
    </members>
</doc>

Added Externals/EntityFramework/v6.4/lib/net40/EntityFramework.dll.

cannot compute difference between binary files

Added Externals/EntityFramework/v6.4/lib/net40/EntityFramework.xml.

more than 10,000 changes

Added Externals/EntityFramework/v6.4/lib/net45/EntityFramework.SqlServer.dll.

cannot compute difference between binary files

Added Externals/EntityFramework/v6.4/lib/net45/EntityFramework.SqlServer.xml.

























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>EntityFramework.SqlServer</name>
    </assembly>
    <members>
        <member name="T:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy">
            <summary>
            An <see cref="T:System.Data.Entity.Infrastructure.IDbExecutionStrategy"/> that retries actions that throw exceptions caused by SQL Azure transient failures.
            </summary>
            <remarks>
            This execution strategy will retry the operation on <see cref="T:System.TimeoutException"/> and <see cref="T:System.Data.SqlClient.SqlException"/>
            if the <see cref="P:System.Data.SqlClient.SqlException.Errors"/> contains any of the following error numbers:
            40613, 40501, 40197, 10929, 10928, 10060, 10054, 10053, 233, 64 and 20
            </remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy.#ctor">
            <summary>
            Creates a new instance of <see cref="T:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy" />.
            </summary>
            <remarks>
            The default retry limit is 5, which means that the total amount of time spent between retries is 26 seconds plus the random factor.
            </remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy.#ctor(System.Int32,System.TimeSpan)">
            <summary>
            Creates a new instance of <see cref="T:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy" /> with the specified limits for
            number of retries and the delay between retries.
            </summary>
            <param name="maxRetryCount"> The maximum number of retry attempts. </param>
            <param name="maxDelay"> The maximum delay in milliseconds between retries. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy.ShouldRetryOn(System.Exception)">
            <inheritdoc/>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlFunctions">
            <summary>
            Contains function stubs that expose SqlServer methods in Linq to Entities.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.ChecksumAggregate(System.Collections.Generic.IEnumerable{System.Int32})">
            <summary>Returns the checksum of the values in a collection. Null values are ignored.</summary>
            <returns>The checksum computed from the input collection.</returns>
            <param name="arg">The collection of values over which the checksum is computed.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.ChecksumAggregate(System.Collections.Generic.IEnumerable{System.Nullable{System.Int32}})">
            <summary>Returns the checksum of the values in a collection. Null values are ignored.</summary>
            <returns>The checksum computed from the input collection.</returns>
            <param name="arg">The collection of values over which the checksum is computed.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Ascii(System.String)">
            <summary>Returns the ASCII code value of the left-most character of a character expression.</summary>
            <returns>The ASCII code of the first character in the input string.</returns>
            <param name="arg">A valid string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Char(System.Nullable{System.Int32})">
            <summary>Returns the character that corresponds to the specified integer ASCII value.</summary>
            <returns>The character that corresponds to the specified ASCII value.</returns>
            <param name="arg">An ASCII code.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.String,System.String)">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.Byte[],System.Byte[])">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.String,System.String,System.Nullable{System.Int32})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.Byte[],System.Byte[],System.Nullable{System.Int32})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.String,System.String,System.Nullable{System.Int64})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>
            A <see cref="T:System.Nullable`1" /> of <see cref="T:System.Int64" /> value that is the starting position of  toFind  if it is found in  toSearch .
            </returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.Byte[],System.Byte[],System.Nullable{System.Int64})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Difference(System.String,System.String)">
            <summary>Returns an integer value that indicates the difference between the SOUNDEX values of two character expressions.</summary>
            <returns>The SOUNDEX difference between the two strings.</returns>
            <param name="string1">The first string.</param>
            <param name="string2">The second string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.NChar(System.Nullable{System.Int32})">
            <summary>Returns the Unicode character with the specified integer code, as defined by the Unicode standard.</summary>
            <returns>The character that corresponds to the input character code.</returns>
            <param name="arg">A character code.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.PatIndex(System.String,System.String)">
            <summary>Returns the starting position of the first occurrence of a pattern in a specified expression, or zeros if the pattern is not found, on all valid text and character data types.</summary>
            <returns>The starting character position where the string pattern was found.</returns>
            <param name="stringPattern">A string pattern to search for.</param>
            <param name="target">The string to search.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.QuoteName(System.String)">
            <summary>Returns a Unicode string with the delimiters added to make the input string a valid Microsoft SQL Server delimited identifier.</summary>
            <returns>The original string with brackets added.</returns>
            <param name="stringArg">The expression that quote characters will be added to.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.QuoteName(System.String,System.String)">
            <summary>Returns a Unicode string with the delimiters added to make the input string a valid Microsoft SQL Server delimited identifier.</summary>
            <returns>The original string with the specified quote characters added.</returns>
            <param name="stringArg">The expression that quote characters will be added to.</param>
            <param name="quoteCharacter">The one-character string to use as the delimiter. It can be a single quotation mark ( ' ), a left or right bracket ( [ ] ), or a double quotation mark ( " ). If quote_character is not specified, brackets are used.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Replicate(System.String,System.Nullable{System.Int32})">
            <summary>Repeats a string value a specified number of times.</summary>
            <returns>The target string, repeated the number of times specified by  count .</returns>
            <param name="target">A valid string.</param>
            <param name="count">The value that specifies how many time to repeat  target .</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.SoundCode(System.String)">
            <summary>Converts an alphanumeric string to a four-character (SOUNDEX) code to find similar-sounding words or names.</summary>
            <returns>The SOUNDEX code of the input string.</returns>
            <param name="arg">A valid string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Space(System.Nullable{System.Int32})">
            <summary>Returns a string of repeated spaces.</summary>
            <returns>A string that consists of the specified number of spaces.</returns>
            <param name="arg1">The number of spaces. If negative, a null string is returned.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Double})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The numeric input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Decimal})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Double},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The numeric input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Decimal},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Double},System.Nullable{System.Int32},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The numeric input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
            <param name="decimalArg">The number of places to the right of the decimal point.  decimal  must be less than or equal to 16. If  decimal  is more than 16 then the result is truncated to sixteen places to the right of the decimal point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Decimal},System.Nullable{System.Int32},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
            <param name="decimalArg">The number of places to the right of the decimal point.  decimal  must be less than or equal to 16. If  decimal  is more than 16 then the result is truncated to sixteen places to the right of the decimal point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Stuff(System.String,System.Nullable{System.Int32},System.Nullable{System.Int32},System.String)">
            <summary>Inserts a string into another string. It deletes a specified length of characters in the target string at the start position and then inserts the second string into the target string at the start position.</summary>
            <returns>A string consisting of the two strings.</returns>
            <param name="stringInput">The target string.</param>
            <param name="start">The character position in  stringinput  where the replacement string is to be inserted.</param>
            <param name="length">The number of characters to delete from  stringInput . If  length  is longer than  stringInput , deletion occurs up to the last character in  stringReplacement .</param>
            <param name="stringReplacement">The substring to be inserted into  stringInput .</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Unicode(System.String)">
            <summary>Returns the integer value, as defined by the Unicode standard, for the first character of the input expression.</summary>
            <returns>The character code for the first character in the input string.</returns>
            <param name="arg">A valid string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Acos(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the angle, in radians, whose cosine is the specified numerical value. This angle is called the arccosine.</summary>
            <returns>The angle, in radians, defined by the input cosine value.</returns>
            <param name="arg1">The cosine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Acos(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the angle, in radians, whose cosine is the specified numerical value. This angle is called the arccosine.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg1">The cosine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Asin(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the angle, in radians, whose sine is the specified numerical value. This angle is called the arcsine.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The sine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Asin(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the angle, in radians, whose sine is the specified numerical value. This angle is called the arcsine.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The sine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the angle, in radians, whose tangent is the specified numerical value. This angle is called the arctangent.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The tangent of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the angle, in radians, whose tangent is the specified numerical value. This angle is called the arctangent.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The tangent of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan2(System.Nullable{System.Double},System.Nullable{System.Double})">
            <summary>Returns the positive angle, in radians, between the positive x-axis and the ray from the origin through the point (x, y), where x and y are the two specified numerical values. The first parameter passed to the function is the y-value and the second parameter is the x-value.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg1">The y-coordinate of a point.</param>
            <param name="arg2">The x-coordinate of a point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan2(System.Nullable{System.Decimal},System.Nullable{System.Decimal})">
            <summary>Returns the positive angle, in radians, between the positive x-axis and the ray from the origin through the point (x, y), where x and y are the two specified numerical values. The first parameter passed to the function is the y-value and the second parameter is the x-value.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg1">The y-coordinate of a point.</param>
            <param name="arg2">The x-coordinate of a point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cos(System.Nullable{System.Double})">
            <summary>Returns the trigonometric cosine of the specified angle, in radians, in the specified expression.</summary>
            <returns>The trigonometric cosine of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cos(System.Nullable{System.Decimal})">
            <summary>Returns the trigonometric cosine of the specified angle, in radians, in the specified expression.</summary>
            <returns>The trigonometric cosine of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cot(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the trigonometric cotangent of the specified angle, in radians.</summary>
            <returns>The trigonometric cotangent of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cot(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the trigonometric cotangent of the specified angle, in radians.</summary>
            <returns>The trigonometric cotangent of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Int32})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Int64})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Decimal})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Double})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Exp(System.Nullable{System.Double})">
            <summary>Returns the exponential value of the specified float expression.</summary>
            <returns>The constant e raised to the power of the input value.</returns>
            <param name="arg">The input value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Exp(System.Nullable{System.Decimal})">
            <summary>Returns the exponential value of the specified float expression.</summary>
            <returns>The constant e raised to the power of the input value.</returns>
            <param name="arg">The input value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log(System.Nullable{System.Double})">
            <summary>Returns the natural logarithm of the specified input value.</summary>
            <returns>The natural logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log(System.Nullable{System.Decimal})">
            <summary>Returns the natural logarithm of the specified input value.</summary>
            <returns>The natural logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log10(System.Nullable{System.Double})">
            <summary>Returns the base-10 logarithm of the specified input value.</summary>
            <returns>The base-10 logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log10(System.Nullable{System.Decimal})">
            <summary>Returns the base-10 logarithm of the specified input value.</summary>
            <returns>The base-10 logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Pi">
            <summary>Returns the constant value of pi.</summary>
            <returns>The numeric value of pi.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Int32})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Int64})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Decimal})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Double})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Rand">
            <summary>Returns a pseudo-random float value from 0 through 1, exclusive.</summary>
            <returns>The pseudo-random value.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Rand(System.Nullable{System.Int32})">
            <summary>Returns a pseudo-random float value from 0 through 1, exclusive.</summary>
            <returns>The pseudo-random value.</returns>
            <param name="seed">The seed value. If  seed  is not specified, the SQL Server Database Engine assigns a seed value at random. For a specified seed value, the result returned is always the same.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Int32})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Int64})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Decimal})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Double})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sin(System.Nullable{System.Decimal})">
            <summary>Returns the trigonometric sine of the specified angle.</summary>
            <returns>The trigonometric sine of the input expression.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sin(System.Nullable{System.Double})">
            <summary>Returns the trigonometric sine of the specified angle.</summary>
            <returns>The trigonometric sine of the input expression.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.SquareRoot(System.Nullable{System.Double})">
            <summary>Returns the square root of the specified number.</summary>
            <returns>The square root of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.SquareRoot(System.Nullable{System.Decimal})">
            <summary>Returns the square root of the specified number.</summary>
            <returns>The square root of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Square(System.Nullable{System.Double})">
            <summary>Returns the square of the specified number.</summary>
            <returns>The square of the input value.</returns>
            <param name="arg1">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Square(System.Nullable{System.Decimal})">
            <summary>Returns the square of the specified number.</summary>
            <returns>The square of the input value.</returns>
            <param name="arg1">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Tan(System.Nullable{System.Double})">
            <summary>Returns the trigonometric tangent of the input expression.</summary>
            <returns>The tangent of the input angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Tan(System.Nullable{System.Decimal})">
            <summary>Returns the trigonometric tangent of the input expression.</summary>
            <returns>The tangent of the input angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.Nullable{System.DateTime})">
            <summary>Returns a new datetime value based on adding an interval to the specified date.</summary>
            <returns>The new date.</returns>
            <param name="datePartArg">The part of the date to increment. </param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="date">The date to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.Nullable{System.TimeSpan})">
            <summary>Returns a new time span value based on adding an interval to the specified time span.</summary>
            <returns>The new time span.</returns>
            <param name="datePartArg">The part of the date to increment.</param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="time">The time span to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.Nullable{System.DateTimeOffset})">
            <summary>Returns a new date value based on adding an interval to the specified date.</summary>
            <returns>The new point in time, expressed as a date and time of day, relative to Coordinated Universal Time (UTC).</returns>
            <param name="datePartArg">The part of the date to increment.</param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="dateTimeOffsetArg">The date to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.String)">
            <summary>Returns a new datetime value based on adding an interval to the specified date.</summary>
            <returns>
            A <see cref="T:System.Nullable`1" /> of <see cref="T:System.DateTime" /> value that is the new date.
            </returns>
            <param name="datePartArg">The part of the date to increment.</param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="date">The date to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The value specifying the number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two Dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.Nullable{System.DateTime})">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.String)">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.Nullable{System.TimeSpan})">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.Nullable{System.DateTimeOffset})">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.Nullable{System.DateTime})">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.Nullable{System.DateTimeOffset})">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.String)">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.Nullable{System.TimeSpan})">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.GetDate">
            <summary>Returns the current database system timestamp as a datetime value without the database time zone offset. This value is derived from the operating system of the computer on which the instance of SQL Server is running.</summary>
            <returns>The current database timestamp.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.GetUtcDate">
            <summary>Returns the current database system timestamp as a datetime value. The database time zone offset is not included. This value represents the current UTC time (Coordinated Universal Time). This value is derived from the operating system of the computer on which the instance of SQL Server is running.</summary>
            <returns>The current database UTC timestamp.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Boolean})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Double})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Decimal})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.DateTime})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.TimeSpan})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.DateTimeOffset})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.String)">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Byte[])">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Guid})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Boolean})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Double})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Decimal})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.String)">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTime})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.TimeSpan})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTimeOffset})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Byte[])">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The character array for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Guid})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Double},System.Nullable{System.Double})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Decimal},System.Nullable{System.Decimal})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.String,System.String)">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTime},System.Nullable{System.DateTime})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Byte[],System.Byte[])">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The character array for which the checksum is calculated.</param>
            <param name="arg2">The character array for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Guid},System.Nullable{System.Guid})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Double})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Decimal},System.Nullable{System.Decimal},System.Nullable{System.Decimal})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.String,System.String,System.String)">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTime},System.Nullable{System.DateTime},System.Nullable{System.DateTime})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Byte[],System.Byte[],System.Byte[])">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The character array for which the checksum is calculated.</param>
            <param name="arg2">The character array for which the checksum is calculated.</param>
            <param name="arg3">The character array for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Guid},System.Nullable{System.Guid},System.Nullable{System.Guid})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CurrentTimestamp">
            <summary>Returns the current date and time. </summary>
            <returns>The current date and time.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CurrentUser">
            <summary>Returns the name of the current user.</summary>
            <returns>The name of the current user.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.HostName">
            <summary>Returns the workstation name.</summary>
            <returns>The name of the workstation.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.UserName(System.Nullable{System.Int32})">
            <summary>Returns a database user name corresponding to a specified identification number.</summary>
            <returns>The user name.</returns>
            <param name="arg">A user ID.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.UserName">
            <summary>Returns a database user name corresponding to a specified identification number.</summary>
            <returns>The user name.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.IsNumeric(System.String)">
            <summary>Indicates whether the input value is a valid numeric type.</summary>
            <returns>1 if the input expression is a valid numeric data type; otherwise, 0.</returns>
            <param name="arg">A string expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.IsDate(System.String)">
            <summary>Indicates whether the input value is a valid date or time.</summary>
            <returns>1 if the input expression is a valid date or time value of datetime or smalldatetime data types; otherwise, 0.</returns>
            <param name="arg">The tested value.</param>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions">
            <summary>
            Contains function stubs that expose SqlServer methods in Linq to Entities.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.GetAncestor(System.Data.Entity.Hierarchy.HierarchyId,System.Int32)">
            <summary>Returns a hierarchyid representing the nth ancestor of this.</summary>
            <returns>A hierarchyid representing the nth ancestor of this.</returns>
            <param name="hierarchyIdValue">The hierarchyid value.</param>
            <param name="n">n</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.GetDescendant(System.Data.Entity.Hierarchy.HierarchyId,System.Data.Entity.Hierarchy.HierarchyId,System.Data.Entity.Hierarchy.HierarchyId)">
            <summary>Returns a child node of the parent.</summary>
            <param name="hierarchyIdValue">The hierarchyid value.</param>
            <param name="child1"> null or the hierarchyid of a child of the current node. </param>
            <param name="child2"> null or the hierarchyid of a child of the current node. </param>
            <returns>
            Returns one child node that is a descendant of the parent.
            If parent is null, returns null.
            If parent is not null, and both child1 and child2 are null, returns a child of parent.
            If parent and child1 are not null, and child2 is null, returns a child of parent greater than child1.
            If parent and child2 are not null and child1 is null, returns a child of parent less than child2.
            If parent, child1, and child2 are not null, returns a child of parent greater than child1 and less than child2.
            If child1 is not null and not a child of parent, an exception is raised.
            If child2 is not null and not a child of parent, an exception is raised.
            If child1 >= child2, an exception is raised.
            </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.GetLevel(System.Data.Entity.Hierarchy.HierarchyId)">
            <summary>Returns an integer that represents the depth of the node this in the tree.</summary>
            <returns>An integer that represents the depth of the node this in the tree.</returns>
            <param name="hierarchyIdValue">The hierarchyid value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.GetRoot">
            <summary>Returns the root of the hierarchy tree.</summary>
            <returns>The root of the hierarchy tree.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.IsDescendantOf(System.Data.Entity.Hierarchy.HierarchyId,System.Data.Entity.Hierarchy.HierarchyId)">
            <summary>Returns true if this is a descendant of parent.</summary>
            <returns>True if this is a descendant of parent.</returns>
            <param name="hierarchyIdValue">The hierarchyid value.</param>
            <param name="parent">parent</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.GetReparentedValue(System.Data.Entity.Hierarchy.HierarchyId,System.Data.Entity.Hierarchy.HierarchyId,System.Data.Entity.Hierarchy.HierarchyId)">
            <summary>Returns a node whose path from the root is the path to newRoot, followed by the path from oldRoot to this.</summary>
            <returns>Hierarchyid value.</returns>
            <param name="hierarchyIdValue">The hierarchyid value.</param>
            <param name="oldRoot">oldRoot</param>
            <param name="newRoot">newRoot</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.Parse(System.String)">
            <summary>Converts the canonical string representation of a hierarchyid to a hierarchyid value.</summary>
            <returns>Hierarchyid value.</returns>
            <param name="input">input</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderManifest.SupportsParameterOptimizationInSchemaQueries">
            <summary>
            Indicates if the provider supports the parameter optimization described in EntityFramework6 GitHub issue #195.
            </summary>
            <returns><c>True</c> since this provider supports the parameter optimization.</returns>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlProviderServices">
            <summary>
            The DbProviderServices implementation for the SqlClient provider for SQL Server.
            </summary>
            <remarks>
            Note that instance of this type also resolve additional provider services for Microsoft SQL Server
            when this type is registered as an EF provider either using an entry in the application's config file
            or through code-based registration in <see cref="T:System.Data.Entity.DbConfiguration" />.
            The services resolved are:
            Requests for <see cref="T:System.Data.Entity.Infrastructure.IDbConnectionFactory" /> are resolved to a Singleton instance of
            <see cref="T:System.Data.Entity.Infrastructure.LocalDbConnectionFactory" /> to create connections to LocalDB by default.
            Requests for <see cref="T:System.Func`1" /> for the invariant name "System.Data.SqlClient"
            for any server name are resolved to a delegate that returns a <see cref="T:System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy" />
            to provide a non-retrying policy for SQL Server.
            Requests for <see cref="T:System.Data.Entity.Migrations.Sql.MigrationSqlGenerator" /> for the invariant name "System.Data.SqlClient" are
            resolved to <see cref="T:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator" /> instances to provide default Migrations SQL
            generation for SQL Server.
            Requests for <see cref="T:System.Data.Entity.Spatial.DbSpatialServices" /> for the invariant name "System.Data.SqlClient" are
            resolved to a Singleton instance of <see cref="T:System.Data.Entity.SqlServer.SqlSpatialServices" /> to provide default spatial
            services for SQL Server.
            </remarks>
        </member>
        <member name="F:System.Data.Entity.SqlServer.SqlProviderServices.ProviderInvariantName">
            <summary>
            This is the well-known string using in configuration files and code-based configuration as
            the "provider invariant name" used to specify Microsoft SQL Server for ADO.NET and
            Entity Framework provider services.
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.Instance">
            <summary>
            The Singleton instance of the SqlProviderServices type.
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.SqlServerTypesAssemblyName">
            <summary>
            Set to the full name of the Microsoft.SqlServer.Types assembly to override the default selection
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.TruncateDecimalsToScale">
            <summary>
            Get or sets a value indicating whether <see cref="T:System.Decimal" /> parameter values are truncated to 
            the scale (number of decimal places) defined for their corresponding columns when they are sent 
            to the database. A value of <c>true</c> indicates that <see cref="T:System.Data.SqlClient.SqlParameter" /> objects 
            created for <see cref="T:System.Decimal" /> columns will have their <see cref="P:System.Data.SqlClient.SqlParameter.Scale" /> 
            properties set, which will cause the parameter values to be truncated. If set to <c>false</c> 
            then the <see cref="P:System.Data.SqlClient.SqlParameter.Scale" /> properties will not be set, avoiding the truncation 
            behavior of <see cref="T:System.Data.SqlClient.SqlParameter" /> and allowing SQL Server to round values if necessary. 
            The default value is <c>true</c> to prevent breaking existing applications that depend on this 
            behavior. 
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.UseScopeIdentity">
            <summary>
            Gets or sets a value indicating whether to use the SCOPE_IDENTITY() function to retrieve values 
            generated by the database for numeric columns during an INSERT operation. The default value of 
            <c>true</c> is recommended and can provide better performance if all numeric values are generated 
            using IDENTITY columns. If set to <c>false</c>, an OUTPUT clause will be used instead. An OUTPUT 
            clause makes it possible to retrieve values generated by sequences or other means.
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.UseRowNumberOrderingInOffsetQueries">
            <summary>
            Gets or sets a value indicating whether the ROW_NUMBER() function is used in sort expression 
            passed to the ORDER BY clause when OFFSET is present in query. The default value of <c>true</c> 
            is recommended to obtain query results that are stable for paging operations. The value of 
            <c>false</c> can be used for compatibility with previous versions of EF and will cause the sort 
            expression to be passed unmodified to the ORDER BY clause, which can lead to unstable results 
            if the ordering is ambiguous. 
            </summary>
            <remarks>
            This flag only applies to SQL Server 2012 or later. This flag does not affect queries that have 
            already been translated to SQL and cached, therefore applications that need to set the value to 
            <c>false</c> for compatibility should do so before executing any queries.
            </remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.RegisterInfoMessageHandler(System.Data.Common.DbConnection,System.Action{System.String})">
            <summary>
            Registers a handler to process non-error messages coming from the database provider.
            </summary>
            <param name="connection"> The connection to receive information for. </param>
            <param name="handler"> The handler to process messages. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.CreateDbCommandDefinition(System.Data.Entity.Core.Common.DbProviderManifest,System.Data.Entity.Core.Common.CommandTrees.DbCommandTree)">
            <summary>
            Create a Command Definition object, given the connection and command tree
            </summary>
            <param name="providerManifest"> provider manifest that was determined from metadata </param>
            <param name="commandTree"> command tree for the statement </param>
            <returns> an executable command definition object </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.CloneDbCommand(System.Data.Common.DbCommand)">
            <summary>
            See issue 2390 - cloning the DesignTimeVisible property on the
            <see cref="T:System.Data.SqlClient.SqlCommand" /> can cause deadlocks.
            So here overriding to provide a method that does not clone DesignTimeVisible.
            </summary>
            <param name="fromDbCommand"> the <see cref="T:System.Data.Common.DbCommand" /> object to clone </param>
            <returns >a clone of the <see cref="T:System.Data.Common.DbCommand" /> </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.SetDbParameterValue(System.Data.Common.DbParameter,System.Data.Entity.Core.Metadata.Edm.TypeUsage,System.Object)">
            <summary>
            Sets the parameter value and appropriate facets for the given <see cref="T:System.Data.Entity.Core.Metadata.Edm.TypeUsage"/>.
            </summary>
            <param name="parameter">The parameter.</param>
            <param name="parameterType">The type of the parameter.</param>
            <param name="value">The value of the parameter.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.GetDbProviderManifestToken(System.Data.Common.DbConnection)">
            <summary>
            Returns provider manifest token for a given connection.
            </summary>
            <param name="connection"> Connection to find manifest token from. </param>
            <returns> The provider manifest token for the specified connection. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.GetDbProviderManifest(System.String)">
            <summary>
            Returns the provider manifest by using the specified version information.
            </summary>
            <param name="versionHint"> The token information associated with the provider manifest. </param>
            <returns> The provider manifest by using the specified version information. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.GetDbSpatialDataReader(System.Data.Common.DbDataReader,System.String)">
            <summary>
            Gets a spatial data reader for SQL Server.
            </summary>
            <param name="fromReader"> The reader where the spatial data came from. </param>
            <param name="versionHint"> The manifest token associated with the provider manifest. </param>
            <returns> The spatial data reader. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbGetSpatialServices(System.String)">
            <summary>
            Gets a spatial data reader for SQL Server.
            </summary>
            <param name="versionHint"> The manifest token associated with the provider manifest. </param>
            <returns> The spatial data reader. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabaseScript(System.String,System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Generates a data definition language (DDL) script that creates schema objects 
            (tables, primary keys, foreign keys) based on the contents of the StoreItemCollection 
            parameter and targeted for the version of the database corresponding to the provider manifest token.
            </summary>
            <param name="providerManifestToken"> The provider manifest token identifying the target version. </param>
            <param name="storeItemCollection"> The structure of the database. </param>
            <returns>
            A DDL script that creates schema objects based on the contents of the StoreItemCollection parameter 
            and targeted for the version of the database corresponding to the provider manifest token.
            </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabase(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Create the database and the database objects.
            If initial catalog is not specified, but AttachDBFilename is specified, we generate a random database name based on the AttachDBFilename.
            Note: this causes pollution of the db, as when the connection string is later used, the mdf will get attached under a different name.
            However if we try to replicate the name under which it would be attached, the following scenario would fail:
            The file does not exist, but registered with database.
            The user calls:  If (DatabaseExists) DeleteDatabase
            CreateDatabase
            For further details on the behavior when AttachDBFilename is specified see Dev10# 188936
            </summary>
            <param name="connection">Connection to a non-existent database that needs to be created and populated with the store objects indicated with the storeItemCollection parameter.</param>
            <param name="commandTimeout">Execution timeout for any commands needed to create the database.</param>
            <param name="storeItemCollection">The collection of all store items based on which the script should be created.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbDatabaseExists(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Determines whether the database for the given connection exists.
            There are three cases:
            1.  Initial Catalog = X, AttachDBFilename = null:   (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            2.  Initial Catalog = X, AttachDBFilename = F:      if (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0 then <c>true</c>,
            if not, try to open the connection and then return (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            3.  Initial Catalog = null, AttachDBFilename = F:   Try to open the connection. If that succeeds the result is true, otherwise
            if the there are no databases corresponding to the given file return <c>false</c>, otherwise throw.
            Note: We open the connection to cover the scenario when the mdf exists, but is not attached.
            Given that opening the connection would auto-attach it, it would not be appropriate to return <c>false</c> in this case.
            Also note that checking for the existence of the file does not work for a remote server.  (Dev11 #290487)
            For further details on the behavior when AttachDBFilename is specified see Dev10# 188936
            </summary>
            <param name="connection">Connection to a database whose existence is checked by this method.</param>
            <param name="commandTimeout">Execution timeout for any commands needed to determine the existence of the database.</param>
            <param name="storeItemCollection">The collection of all store items from the model. This parameter is no longer used for determining database existence.</param>
            <returns>True if the provider can deduce the database only based on the connection.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbDatabaseExists(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Lazy{System.Data.Entity.Core.Metadata.Edm.StoreItemCollection})">
            <summary>
            Determines whether the database for the given connection exists.
            There are three cases:
            1.  Initial Catalog = X, AttachDBFilename = null:   (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            2.  Initial Catalog = X, AttachDBFilename = F:      if (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0 then <c>true</c>,
            if not, try to open the connection and then return (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            3.  Initial Catalog = null, AttachDBFilename = F:   Try to open the connection. If that succeeds the result is true, otherwise
            if the there are no databases corresponding to the given file return <c>false</c>, otherwise throw.
            Note: We open the connection to cover the scenario when the mdf exists, but is not attached.
            Given that opening the connection would auto-attach it, it would not be appropriate to return <c>false</c> in this case.
            Also note that checking for the existence of the file does not work for a remote server.  (Dev11 #290487)
            For further details on the behavior when AttachDBFilename is specified see Dev10# 188936
            </summary>
            <param name="connection">Connection to a database whose existence is checked by this method.</param>
            <param name="commandTimeout">Execution timeout for any commands needed to determine the existence of the database.</param>
            <param name="storeItemCollection">The collection of all store items from the model. This parameter is no longer used for determining database existence.</param>
            <returns>True if the provider can deduce the database only based on the connection.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbDeleteDatabase(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Delete the database for the given connection.
            There are three cases:
            1.  If Initial Catalog is specified (X) drop database X
            2.  Else if AttachDBFilename is specified (F) drop all the databases corresponding to F
            if none throw
            3.  If niether the catalog not the file name is specified - throw
            Note that directly deleting the files does not work for a remote server.  However, even for not attached
            databases the current logic would work assuming the user does: if (DatabaseExists) DeleteDatabase
            </summary>
            <param name="connection"> Connection </param>
            <param name="commandTimeout"> Timeout for internal commands. </param>
            <param name="storeItemCollection"> Item Collection. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.CloneDbConnection(System.Data.Common.DbConnection,System.Data.Common.DbProviderFactory)">
            <summary>
            Clones the connection.
            </summary>
            <param name="connection">The original connection.</param>
            <param name="factory">The factory to use.</param>
            <returns>Cloned connection</returns>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator">
            <summary>
            Provider to convert provider agnostic migration operations into SQL commands
            that can be run against a Microsoft SQL Server database.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.IsPermissionDeniedError(System.Exception)">
            <summary>
            Determines if a provider specific exception corresponds to a database-level permission denied error.
            </summary>
            <param name="exception">The database exception.</param>
            <returns> true if the supplied exception corresponds to a database-level permission denied error; otherwise false. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Collections.Generic.IEnumerable{System.Data.Entity.Migrations.Model.MigrationOperation},System.String)">
            <summary>
            Converts a set of migration operations into Microsoft SQL Server specific SQL.
            </summary>
            <param name="migrationOperations"> The operations to be converted. </param>
            <param name="providerManifestToken"> Token representing the version of SQL Server being targeted (i.e. "2005", "2008"). </param>
            <returns> A list of SQL statements to be executed to perform the migration operations. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GenerateProcedureBody(System.Collections.Generic.ICollection{System.Data.Entity.Core.Common.CommandTrees.DbModificationCommandTree},System.String,System.String)">
            <summary>
            Generates the SQL body for a stored procedure.
            </summary>
            <param name="commandTrees">The command trees representing the commands for an insert, update or delete operation.</param>
            <param name="rowsAffectedParameter">The rows affected parameter name.</param>
            <param name="providerManifestToken">The provider manifest token.</param>
            <returns>The SQL body for the stored procedure.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.UpdateDatabaseOperation)">
            <summary>
            Generates the specified update database operation which represents applying a series of migrations.
            The generated script is idempotent, meaning it contains conditional logic to check if individual migrations 
            have already been applied and only apply the pending ones.
            </summary>
            <param name="updateDatabaseOperation">The update database operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.MigrationOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.MigrationOperation" />.
            Allows derived providers to handle additional operation types.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="migrationOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.CreateConnection">
            <summary>
            Creates an empty connection for the current provider.
            Allows derived providers to use connection other than <see cref="T:System.Data.SqlClient.SqlConnection" />.
            </summary>
            <returns> An empty connection for the current provider. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.CreateProcedureOperation)">
            <summary>
            Generates the specified create procedure operation.
            </summary>
            <param name="createProcedureOperation">The create procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AlterProcedureOperation)">
            <summary>
            Generates the specified alter procedure operation.
            </summary>
            <param name="alterProcedureOperation">The alter procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropProcedureOperation)">
            <summary>
            Generates the specified drop procedure operation.
            </summary>
            <param name="dropProcedureOperation">The drop procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.CreateTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.CreateTableOperation" />. This method differs from
            <see cref="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.WriteCreateTable(System.Data.Entity.Migrations.Model.CreateTableOperation)" /> in that it will
            create the target database schema if it does not already exist.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.WriteCreateTable(System.Data.Entity.Migrations.Model.CreateTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.CreateTableOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.WriteCreateTable(System.Data.Entity.Migrations.Model.CreateTableOperation,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Writes CREATE TABLE SQL to the target writer.
            </summary>
            <param name="createTableOperation"> The operation to produce SQL for. </param>
            <param name="writer"> The target writer. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AlterTableOperation)">
            <summary>
            Override this method to generate SQL when the definition of a table or its attributes are changed.
            The default implementation of this method does nothing.
            </summary>
            <param name="alterTableOperation"> The operation describing changes to the table. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GenerateMakeSystemTable(System.Data.Entity.Migrations.Model.CreateTableOperation,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Generates SQL to mark a table as a system table.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createTableOperation"> The table to mark as a system table. </param>
            <param name="writer"> The <see cref='T:System.Data.Entity.Migrations.Utilities.IndentedTextWriter' /> to write the generated SQL to. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GenerateCreateSchema(System.String)">
            <summary>
            Generates SQL to create a database schema.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="schema"> The name of the schema to create. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AddForeignKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AddForeignKeyOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="addForeignKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropForeignKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropForeignKeyOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropForeignKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.CreateIndexOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.CreateIndexOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createIndexOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropIndexOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropIndexOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropIndexOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AddPrimaryKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AddPrimaryKeyOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="addPrimaryKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropPrimaryKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropPrimaryKeyOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropPrimaryKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AddColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AddColumnOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="addColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropColumnOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AlterColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AlterColumnOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="alterColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.DropDefaultConstraint(System.String,System.String,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Call this method to generate SQL that will attempt to drop the default constraint created
            when a column is created. This method is usually called by code that overrides the creation or
            altering of columns.
            </summary>
            <param name="table">The table to which the constraint applies.</param>
            <param name="column">The column to which the constraint applies.</param>
            <param name="writer">The writer to which generated SQL should be written.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropTableOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.SqlOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.SqlOperation" />.
            Generated SQL should be added using the Statement or StatementBatch methods.
            </summary>
            <param name="sqlOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.RenameColumnOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="renameColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameIndexOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.RenameIndexOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="renameIndexOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.RenameTableOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="renameTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameProcedureOperation)">
            <summary>
            Generates the specified rename procedure operation.
            </summary>
            <param name="renameProcedureOperation">The rename procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.MoveProcedureOperation)">
            <summary>
            Generates the specified move procedure operation.
            </summary>
            <param name="moveProcedureOperation">The move procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.MoveTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.MoveTableOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="moveTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.ColumnModel,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Generates SQL for the given column model. This method is called by other methods that
            process columns and can be overridden to change the SQL generated.
            </summary>
            <param name="column">The column for which SQL is being generated.</param>
            <param name="writer">The writer to which generated SQL should be written.</param>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GuidColumnDefault">
            <summary>
            Returns the column default value to use for store-generated GUID columns when
            no default value is explicitly specified in the migration.
            Returns newsequentialid() for on-premises SQL Server 2005 and later.
            Returns newid() for SQL Azure.
            </summary>
            <value>Either newsequentialid() or newid() as described above.</value>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.HistoryOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.HistoryOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="historyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Byte[])">
            <summary>
            Generates SQL to specify a constant byte[] default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Boolean)">
            <summary>
            Generates SQL to specify a constant bool default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.DateTime)">
            <summary>
            Generates SQL to specify a constant DateTime default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.DateTimeOffset)">
            <summary>
            Generates SQL to specify a constant DateTimeOffset default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Guid)">
            <summary>
            Generates SQL to specify a constant Guid default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.String)">
            <summary>
            Generates SQL to specify a constant string default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.TimeSpan)">
            <summary>
            Generates SQL to specify a constant TimeSpan default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Hierarchy.HierarchyId)">
            <summary>
            Generates SQL to specify a constant hierarchyid default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Spatial.DbGeography)">
            <summary>
            Generates SQL to specify a constant geogrpahy default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Spatial.DbGeometry)">
            <summary>
            Generates SQL to specify a constant geometry default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Object)">
            <summary>
            Generates SQL to specify a constant default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.BuildColumnType(System.Data.Entity.Migrations.Model.ColumnModel)">
            <summary>
            Generates SQL to specify the data type of a column.
            This method just generates the actual type, not the SQL to create the column.
            </summary>
            <param name="columnModel"> The definition of the column. </param>
            <returns> SQL representing the data type. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Name(System.String)">
            <summary>
            Generates a quoted name. The supplied name may or may not contain the schema.
            </summary>
            <param name="name"> The name to be quoted. </param>
            <returns> The quoted name. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Quote(System.String)">
            <summary>
            Quotes an identifier for SQL Server.
            </summary>
            <param name="identifier"> The identifier to be quoted. </param>
            <returns> The quoted identifier. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Statement(System.String,System.Boolean,System.String)">
            <summary>
            Adds a new Statement to be executed against the database.
            </summary>
            <param name="sql"> The statement to be executed. </param>
            <param name="suppressTransaction"> Gets or sets a value indicating whether this statement should be performed outside of the transaction scope that is used to make the migration process transactional. If set to true, this operation will not be rolled back if the migration process fails. </param>
            <param name="batchTerminator">The batch terminator for the database provider.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Writer">
            <summary>
            Gets a new <see cref="T:System.Data.Entity.Migrations.Utilities.IndentedTextWriter" /> that can be used to build SQL.
            This is just a helper method to create a writer. Writing to the writer will
            not cause SQL to be registered for execution. You must pass the generated
            SQL to the Statement method.
            </summary>
            <returns> An empty text writer to use for SQL generation. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Statement(System.Data.Entity.Migrations.Utilities.IndentedTextWriter,System.String)">
            <summary>
            Adds a new Statement to be executed against the database.
            </summary>
            <param name="writer"> The writer containing the SQL to be executed. </param>
            <param name="batchTerminator">The batch terminator for the database provider.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.StatementBatch(System.String,System.Boolean)">
            <summary>
            Breaks sql string into one or more statements, handling T-SQL utility statements as necessary.
            </summary>
            <param name="sqlBatch"> The SQL to split into one ore more statements to be executed. </param>
            <param name="suppressTransaction"> Gets or sets a value indicating whether this statement should be performed outside of the transaction scope that is used to make the migration process transactional. If set to true, this operation will not be rolled back if the migration process fails. </param>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlSpatialFunctions">
            <summary>
            Contains function stubs that expose SqlServer methods in Linq to Entities.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.PointGeography(System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Int32})">
            <summary>Constructs a geography instance representing a Point instance from its x and y values and a spatial reference ID (SRID). </summary>
            <returns>The constructed geography instance.</returns>
            <param name="latitude">The x-coordinate of the Point being generated.</param>
            <param name="longitude">The y-coordinate of the Point being generated</param>
            <param name="spatialReferenceId">The SRID of the geography instance.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.AsTextZM(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns the Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geography instance augmented with any Z (elevation) and M (measure) values carried by the instance.</summary>
            <returns>The Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geography instance.</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.BufferWithTolerance(System.Data.Entity.Spatial.DbGeography,System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Boolean})">
            <summary>Returns a geometric object representing the union of all point values whose distance from a geography instance is less than or equal to a specified value, allowing for a specified tolerance.</summary>
            <returns>The union of all point values whose distance from a geography instance is less than or equal to a specified value</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="distance">The distance.</param>
            <param name="tolerance">The specified tolerance.</param>
            <param name="relative">Specifying whether the tolerance value is relative or absolute.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.EnvelopeAngle(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns the maximum angle between the point returned by EnvelopeCenter() and a point in the geography instance in degrees.</summary>
            <returns>the maximum angle between the point returned by EnvelopeCenter().</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.EnvelopeCenter(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns a point that can be used as the center of a bounding circle for the geography instance.</summary>
            <returns>A SqlGeography value that specifies the location of the center of a bounding circle.</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Filter(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <summary>Offers a fast, index-only intersection method to determine if a geography instance intersects another SqlGeography instance, assuming an index is available.</summary>
            <returns>True if a geography instance potentially intersects another SqlGeography instance; otherwise, false.</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="geographyOther">Another geography instance to compare against the instance on which Filter is invoked.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.InstanceOf(System.Data.Entity.Spatial.DbGeography,System.String)">
            <summary>Tests if the SqlGeography instance is the same as the specified type.</summary>
            <returns>A string that specifies one of the 12 types exposed in the geography type hierarchy.</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="geometryTypeName">A string that specifies one of the 12 types exposed in the geography type hierarchy.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.NumRings(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns the total number of rings in a Polygon instance.</summary>
            <returns>The total number of rings.</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Reduce(System.Data.Entity.Spatial.DbGeography,System.Nullable{System.Double})">
            <summary>Returns an approximation of the given geography instance produced by running the Douglas-Peucker algorithm on the instance with the given tolerance.</summary>
            <returns>
            Returns <see cref="T:System.Data.Entity.Spatial.DbGeography" />.
            </returns>
            <param name="geographyValue">The geography value.</param>
            <param name="tolerance">The tolerance to input to the Douglas-Peucker algorithm. tolerance must be a positive number.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.RingN(System.Data.Entity.Spatial.DbGeography,System.Nullable{System.Int32})">
            <summary>Returns the specified ring of the SqlGeography instance: 1 ≤ n ≤ NumRings().</summary>
            <returns>A SqlGeography object that represents the ring specified by n.</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="index">An int expression between 1 and the number of rings in a polygon instance.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.PointGeometry(System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Int32})">
            <summary>Constructs a geometry instance representing a Point instance from its x and y values and a spatial reference ID (SRID). </summary>
            <returns>The constructed geometry instance.</returns>
            <param name="xCoordinate">The x-coordinate of the Point being generated.</param>
            <param name="yCoordinate">The y-coordinate of the Point being generated</param>
            <param name="spatialReferenceId">The SRID of the geography instance.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.AsTextZM(System.Data.Entity.Spatial.DbGeometry)">
            <summary>Returns the Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geography instance augmented with any Z (elevation) and M (measure) values carried by the instance.</summary>
            <returns>The Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geometry instance.</returns>
            <param name="geometryValue">The geometry value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.BufferWithTolerance(System.Data.Entity.Spatial.DbGeometry,System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Boolean})">
            <summary>Returns a geometric object representing the union of all point values whose distance from a geometry instance is less than or equal to a specified value, allowing for a specified tolerance.</summary>
            <returns>The union of all point values whose distance from a geometry instance is less than or equal to a specified value</returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="distance">The distance.</param>
            <param name="tolerance">The specified tolerance.</param>
            <param name="relative">Specifying whether the tolerance value is relative or absolute.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.InstanceOf(System.Data.Entity.Spatial.DbGeometry,System.String)">
            <summary>Tests if the SqlGeometry instance is the same as the specified type.</summary>
            <returns>A string that specifies one of the 12 types exposed in the geography type hierarchy.</returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="geometryTypeName">A string that specifies one of the 12 types exposed in the geography type hierarchy.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Filter(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <summary>Offers a fast, index-only intersection method to determine if a geography instance intersects another SqlGeometry instance, assuming an index is available.</summary>
            <returns>True if a geography instance potentially intersects another SqlGeography instance; otherwise, false.</returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="geometryOther">Another geography instance to compare against the instance on which Filter is invoked.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.MakeValid(System.Data.Entity.Spatial.DbGeometry)">
            <summary>Converts an invalid geometry instance into a geometry instance with a valid Open Geospatial Consortium (OGC) type. </summary>
            <returns>The converted geometry instance.</returns>
            <param name="geometryValue">The geometry value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Reduce(System.Data.Entity.Spatial.DbGeometry,System.Nullable{System.Double})">
            <summary>Returns an approximation of the given geography instance produced by running the Douglas-Peucker algorithm on the instance with the given tolerance.</summary>
            <returns>
            Returns <see cref="T:System.Data.Entity.Spatial.DbGeometry" />.
            </returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="tolerance">The tolerance to input to the Douglas-Peucker algorithm. tolerance must be a positive number.</param>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlSpatialServices">
            <summary>
            An implementation of <see cref="T:System.Data.Entity.Spatial.DbSpatialServices"/> to provide support for geospatial types when using
            Entity Framework with Microsoft SQL Server.
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlSpatialServices.NativeTypesAvailable">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateProviderValue(System.Data.Entity.Spatial.DbGeographyWellKnownValue)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromProviderValue(System.Object)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateWellKnownValue(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateProviderValue(System.Data.Entity.Spatial.DbGeometryWellKnownValue)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromProviderValue(System.Object)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateWellKnownValue(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsTextIncludingElevationAndMeasure(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsTextIncludingElevationAndMeasure(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromText(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyCollectionFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromBinary(System.Byte[])">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyCollectionFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromGml(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromGml(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetCoordinateSystemId(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetSpatialTypeName(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetDimension(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsBinary(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsGml(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsText(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsEmpty(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SpatialEquals(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Disjoint(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersects(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Buffer(System.Data.Entity.Spatial.DbGeography,System.Double)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Distance(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersection(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Union(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Difference(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SymmetricDifference(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElementCount(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.ElementAt(System.Data.Entity.Spatial.DbGeography,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLatitude(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLongitude(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElevation(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetMeasure(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLength(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetStartPoint(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetEndPoint(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsClosed(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetPointCount(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.PointAt(System.Data.Entity.Spatial.DbGeography,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetArea(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromText(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryCollectionFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromBinary(System.Byte[])">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryCollectionFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromGml(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromGml(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetCoordinateSystemId(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetSpatialTypeName(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetDimension(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetEnvelope(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsBinary(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsGml(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsText(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsEmpty(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsSimple(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetBoundary(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsValid(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SpatialEquals(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Disjoint(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersects(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Touches(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Crosses(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Within(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Contains(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Overlaps(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Relate(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry,System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Buffer(System.Data.Entity.Spatial.DbGeometry,System.Double)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Distance(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetConvexHull(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersection(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Union(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Difference(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SymmetricDifference(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElementCount(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.ElementAt(System.Data.Entity.Spatial.DbGeometry,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetXCoordinate(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetYCoordinate(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElevation(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetMeasure(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLength(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetStartPoint(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetEndPoint(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsClosed(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsRing(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetPointCount(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.PointAt(System.Data.Entity.Spatial.DbGeometry,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetArea(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetCentroid(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetPointOnSurface(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetExteriorRing(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetInteriorRingCount(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.InteriorRingAt(System.Data.Entity.Spatial.DbGeometry,System.Int32)">
            <inheritdoc />
        </member>
        <member name="T:System.Data.Entity.SqlServer.Utilities.TaskExtensions">
            <summary>
            Contains extension methods for the <see cref="T:System.Threading.Tasks.Task" /> class.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.WithCurrentCulture``1(System.Threading.Tasks.Task{``0})">
            <summary>
            Configures an awaiter used to await this <see cref="T:System.Threading.Tasks.Task`1" /> to avoid
            marshalling the continuation
            back to the original context, but preserve the current culture and UI culture.
            </summary>
            <typeparam name="T">
            The type of the result produced by the associated <see cref="T:System.Threading.Tasks.Task`1"/>.
            </typeparam>
            <param name="task">The task to be awaited on.</param>
            <returns>An object used to await this task.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.WithCurrentCulture(System.Threading.Tasks.Task)">
            <summary>
            Configures an awaiter used to await this <see cref="T:System.Threading.Tasks.Task" /> to avoid
            marshalling the continuation
            back to the original context, but preserve the current culture and UI culture.
            </summary>
            <param name="task">The task to be awaited on.</param>
            <returns>An object used to await this task.</returns>
        </member>
        <member name="T:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1">
            <summary>
            Provides an awaitable object that allows for awaits on <see cref="T:System.Threading.Tasks.Task`1" /> that
            preserve the culture.
            </summary>
            <typeparam name="T">
            The type of the result produced by the associated <see cref="T:System.Threading.Tasks.Task`1"/>.
            </typeparam>
            <remarks>This type is intended for compiler use only.</remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.#ctor(System.Threading.Tasks.Task{`0})">
            <summary>
            Constructs a new instance of the <see cref="T:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1" /> class.
            </summary>
            <param name="task">The task to be awaited on.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.GetAwaiter">
            <summary>Gets an awaiter used to await this <see cref="T:System.Threading.Tasks.Task`1" />.</summary>
            <returns>An awaiter instance.</returns>
            <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
        </member>
        <member name="P:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.IsCompleted">
            <summary>
            Gets whether this <see cref="T:System.Threading.Tasks.Task">Task</see> has completed.
            </summary>
            <remarks>
            <see cref="P:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.IsCompleted" /> will return true when the Task is in one of the three
            final states: <see cref="F:System.Threading.Tasks.TaskStatus.RanToCompletion">RanToCompletion</see>,
            <see cref="F:System.Threading.Tasks.TaskStatus.Faulted">Faulted</see>, or
            <see cref="F:System.Threading.Tasks.TaskStatus.Canceled">Canceled</see>.
            </remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.GetResult">
            <summary>Ends the await on the completed <see cref="T:System.Threading.Tasks.Task`1" />.</summary>
            <returns>The result of the completed <see cref="T:System.Threading.Tasks.Task`1" />.</returns>
            <exception cref="T:System.NullReferenceException">The awaiter was not properly initialized.</exception>
            <exception cref="T:System.Threading.Tasks.TaskCanceledException">The task was canceled.</exception>
            <exception cref="T:System.Exception">The task completed in a Faulted state.</exception>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.OnCompleted(System.Action)">
            <summary>This method is not implemented and should not be called.</summary>
            <param name="continuation">The action to invoke when the await operation completes.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.UnsafeOnCompleted(System.Action)">
            <summary>
            Schedules the continuation onto the <see cref="T:System.Threading.Tasks.Task`1" /> associated with this
            <see cref="T:System.Runtime.CompilerServices.TaskAwaiter`1" />.
            </summary>
            <param name="continuation">The action to invoke when the await operation completes.</param>
            <exception cref="T:System.ArgumentNullException">
            The <paramref name="continuation" /> argument is null
            (Nothing in Visual Basic).
            </exception>
            <exception cref="T:System.InvalidOperationException">The awaiter was not properly initialized.</exception>
            <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
        </member>
        <member name="T:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter">
            <summary>
            Provides an awaitable object that allows for awaits on <see cref="T:System.Threading.Tasks.Task" /> that
            preserve the culture.
            </summary>
            <remarks>This type is intended for compiler use only.</remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.#ctor(System.Threading.Tasks.Task)">
            <summary>
            Constructs a new instance of the <see cref="T:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter" /> class.
            </summary>
            <param name="task">The task to be awaited on.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.GetAwaiter">
            <summary>Gets an awaiter used to await this <see cref="T:System.Threading.Tasks.Task" />.</summary>
            <returns>An awaiter instance.</returns>
            <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
        </member>
        <member name="P:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.IsCompleted">
            <summary>
            Gets whether this <see cref="T:System.Threading.Tasks.Task">Task</see> has completed.
            </summary>
            <remarks>
            <see cref="P:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.IsCompleted" /> will return true when the Task is in one of the three
            final states: <see cref="F:System.Threading.Tasks.TaskStatus.RanToCompletion">RanToCompletion</see>,
            <see cref="F:System.Threading.Tasks.TaskStatus.Faulted">Faulted</see>, or
            <see cref="F:System.Threading.Tasks.TaskStatus.Canceled">Canceled</see>.
            </remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.GetResult">
            <summary>Ends the await on the completed <see cref="T:System.Threading.Tasks.Task" />.</summary>
            <exception cref="T:System.NullReferenceException">The awaiter was not properly initialized.</exception>
            <exception cref="T:System.Threading.Tasks.TaskCanceledException">The task was canceled.</exception>
            <exception cref="T:System.Exception">The task completed in a Faulted state.</exception>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.OnCompleted(System.Action)">
            <summary>This method is not implemented and should not be called.</summary>
            <param name="continuation">The action to invoke when the await operation completes.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.UnsafeOnCompleted(System.Action)">
            <summary>
            Schedules the continuation onto the <see cref="T:System.Threading.Tasks.Task" /> associated with this
            <see cref="T:System.Runtime.CompilerServices.TaskAwaiter" />.
            </summary>
            <param name="continuation">The action to invoke when the await operation completes.</param>
            <exception cref="T:System.ArgumentNullException">
            The <paramref name="continuation" /> argument is null
            (Nothing in Visual Basic).
            </exception>
            <exception cref="T:System.InvalidOperationException">The awaiter was not properly initialized.</exception>
            <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
        </member>
    </members>
</doc>

Added Externals/EntityFramework/v6.4/lib/net45/EntityFramework.dll.

cannot compute difference between binary files

Added Externals/EntityFramework/v6.4/lib/net45/EntityFramework.xml.

more than 10,000 changes

Added Externals/EntityFramework/v6.4/lib/netstandard2.1/EntityFramework.SqlServer.dll.

cannot compute difference between binary files

Added Externals/EntityFramework/v6.4/lib/netstandard2.1/EntityFramework.SqlServer.xml.

























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>EntityFramework.SqlServer</name>
    </assembly>
    <members>
        <member name="T:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy">
            <summary>
            An <see cref="T:System.Data.Entity.Infrastructure.IDbExecutionStrategy"/> that retries actions that throw exceptions caused by SQL Azure transient failures.
            </summary>
            <remarks>
            This execution strategy will retry the operation on <see cref="T:System.TimeoutException"/> and <see cref="T:System.Data.SqlClient.SqlException"/>
            if the <see cref="P:System.Data.SqlClient.SqlException.Errors"/> contains any of the following error numbers:
            40613, 40501, 40197, 10929, 10928, 10060, 10054, 10053, 233, 64 and 20
            </remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy.#ctor">
            <summary>
            Creates a new instance of <see cref="T:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy" />.
            </summary>
            <remarks>
            The default retry limit is 5, which means that the total amount of time spent between retries is 26 seconds plus the random factor.
            </remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy.#ctor(System.Int32,System.TimeSpan)">
            <summary>
            Creates a new instance of <see cref="T:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy" /> with the specified limits for
            number of retries and the delay between retries.
            </summary>
            <param name="maxRetryCount"> The maximum number of retry attempts. </param>
            <param name="maxDelay"> The maximum delay in milliseconds between retries. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlAzureExecutionStrategy.ShouldRetryOn(System.Exception)">
            <inheritdoc/>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlFunctions">
            <summary>
            Contains function stubs that expose SqlServer methods in Linq to Entities.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.ChecksumAggregate(System.Collections.Generic.IEnumerable{System.Int32})">
            <summary>Returns the checksum of the values in a collection. Null values are ignored.</summary>
            <returns>The checksum computed from the input collection.</returns>
            <param name="arg">The collection of values over which the checksum is computed.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.ChecksumAggregate(System.Collections.Generic.IEnumerable{System.Nullable{System.Int32}})">
            <summary>Returns the checksum of the values in a collection. Null values are ignored.</summary>
            <returns>The checksum computed from the input collection.</returns>
            <param name="arg">The collection of values over which the checksum is computed.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Ascii(System.String)">
            <summary>Returns the ASCII code value of the left-most character of a character expression.</summary>
            <returns>The ASCII code of the first character in the input string.</returns>
            <param name="arg">A valid string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Char(System.Nullable{System.Int32})">
            <summary>Returns the character that corresponds to the specified integer ASCII value.</summary>
            <returns>The character that corresponds to the specified ASCII value.</returns>
            <param name="arg">An ASCII code.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.String,System.String)">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.Byte[],System.Byte[])">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.String,System.String,System.Nullable{System.Int32})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.Byte[],System.Byte[],System.Nullable{System.Int32})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.String,System.String,System.Nullable{System.Int64})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>
            A <see cref="T:System.Nullable`1" /> of <see cref="T:System.Int64" /> value that is the starting position of  toFind  if it is found in  toSearch .
            </returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CharIndex(System.Byte[],System.Byte[],System.Nullable{System.Int64})">
            <summary>Returns the starting position of one expression found within another expression.</summary>
            <returns>The starting position of  toFind  if it is found in  toSearch .</returns>
            <param name="toFind">The string expression to be found.</param>
            <param name="toSearch">The string expression to be searched.</param>
            <param name="startLocation">The character position in  toSearch  where searching begins.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Difference(System.String,System.String)">
            <summary>Returns an integer value that indicates the difference between the SOUNDEX values of two character expressions.</summary>
            <returns>The SOUNDEX difference between the two strings.</returns>
            <param name="string1">The first string.</param>
            <param name="string2">The second string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.NChar(System.Nullable{System.Int32})">
            <summary>Returns the Unicode character with the specified integer code, as defined by the Unicode standard.</summary>
            <returns>The character that corresponds to the input character code.</returns>
            <param name="arg">A character code.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.PatIndex(System.String,System.String)">
            <summary>Returns the starting position of the first occurrence of a pattern in a specified expression, or zeros if the pattern is not found, on all valid text and character data types.</summary>
            <returns>The starting character position where the string pattern was found.</returns>
            <param name="stringPattern">A string pattern to search for.</param>
            <param name="target">The string to search.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.QuoteName(System.String)">
            <summary>Returns a Unicode string with the delimiters added to make the input string a valid Microsoft SQL Server delimited identifier.</summary>
            <returns>The original string with brackets added.</returns>
            <param name="stringArg">The expression that quote characters will be added to.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.QuoteName(System.String,System.String)">
            <summary>Returns a Unicode string with the delimiters added to make the input string a valid Microsoft SQL Server delimited identifier.</summary>
            <returns>The original string with the specified quote characters added.</returns>
            <param name="stringArg">The expression that quote characters will be added to.</param>
            <param name="quoteCharacter">The one-character string to use as the delimiter. It can be a single quotation mark ( ' ), a left or right bracket ( [ ] ), or a double quotation mark ( " ). If quote_character is not specified, brackets are used.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Replicate(System.String,System.Nullable{System.Int32})">
            <summary>Repeats a string value a specified number of times.</summary>
            <returns>The target string, repeated the number of times specified by  count .</returns>
            <param name="target">A valid string.</param>
            <param name="count">The value that specifies how many time to repeat  target .</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.SoundCode(System.String)">
            <summary>Converts an alphanumeric string to a four-character (SOUNDEX) code to find similar-sounding words or names.</summary>
            <returns>The SOUNDEX code of the input string.</returns>
            <param name="arg">A valid string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Space(System.Nullable{System.Int32})">
            <summary>Returns a string of repeated spaces.</summary>
            <returns>A string that consists of the specified number of spaces.</returns>
            <param name="arg1">The number of spaces. If negative, a null string is returned.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Double})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The numeric input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Decimal})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Double},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The numeric input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Decimal},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Double},System.Nullable{System.Int32},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The numeric input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
            <param name="decimalArg">The number of places to the right of the decimal point.  decimal  must be less than or equal to 16. If  decimal  is more than 16 then the result is truncated to sixteen places to the right of the decimal point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.StringConvert(System.Nullable{System.Decimal},System.Nullable{System.Int32},System.Nullable{System.Int32})">
            <summary>Returns character data converted from numeric data.</summary>
            <returns>The input expression converted to a string.</returns>
            <param name="number">A numeric expression.</param>
            <param name="length">The total length of the string. This includes decimal point, sign, digits, and spaces. The default is 10.</param>
            <param name="decimalArg">The number of places to the right of the decimal point.  decimal  must be less than or equal to 16. If  decimal  is more than 16 then the result is truncated to sixteen places to the right of the decimal point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Stuff(System.String,System.Nullable{System.Int32},System.Nullable{System.Int32},System.String)">
            <summary>Inserts a string into another string. It deletes a specified length of characters in the target string at the start position and then inserts the second string into the target string at the start position.</summary>
            <returns>A string consisting of the two strings.</returns>
            <param name="stringInput">The target string.</param>
            <param name="start">The character position in  stringinput  where the replacement string is to be inserted.</param>
            <param name="length">The number of characters to delete from  stringInput . If  length  is longer than  stringInput , deletion occurs up to the last character in  stringReplacement .</param>
            <param name="stringReplacement">The substring to be inserted into  stringInput .</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Unicode(System.String)">
            <summary>Returns the integer value, as defined by the Unicode standard, for the first character of the input expression.</summary>
            <returns>The character code for the first character in the input string.</returns>
            <param name="arg">A valid string.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Acos(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the angle, in radians, whose cosine is the specified numerical value. This angle is called the arccosine.</summary>
            <returns>The angle, in radians, defined by the input cosine value.</returns>
            <param name="arg1">The cosine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Acos(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the angle, in radians, whose cosine is the specified numerical value. This angle is called the arccosine.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg1">The cosine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Asin(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the angle, in radians, whose sine is the specified numerical value. This angle is called the arcsine.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The sine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Asin(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the angle, in radians, whose sine is the specified numerical value. This angle is called the arcsine.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The sine of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the angle, in radians, whose tangent is the specified numerical value. This angle is called the arctangent.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The tangent of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the angle, in radians, whose tangent is the specified numerical value. This angle is called the arctangent.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg">The tangent of an angle.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan2(System.Nullable{System.Double},System.Nullable{System.Double})">
            <summary>Returns the positive angle, in radians, between the positive x-axis and the ray from the origin through the point (x, y), where x and y are the two specified numerical values. The first parameter passed to the function is the y-value and the second parameter is the x-value.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg1">The y-coordinate of a point.</param>
            <param name="arg2">The x-coordinate of a point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Atan2(System.Nullable{System.Decimal},System.Nullable{System.Decimal})">
            <summary>Returns the positive angle, in radians, between the positive x-axis and the ray from the origin through the point (x, y), where x and y are the two specified numerical values. The first parameter passed to the function is the y-value and the second parameter is the x-value.</summary>
            <returns>An angle, measured in radians.</returns>
            <param name="arg1">The y-coordinate of a point.</param>
            <param name="arg2">The x-coordinate of a point.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cos(System.Nullable{System.Double})">
            <summary>Returns the trigonometric cosine of the specified angle, in radians, in the specified expression.</summary>
            <returns>The trigonometric cosine of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cos(System.Nullable{System.Decimal})">
            <summary>Returns the trigonometric cosine of the specified angle, in radians, in the specified expression.</summary>
            <returns>The trigonometric cosine of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cot(System.Nullable{System.Double})">
            <summary>A mathematical function that returns the trigonometric cotangent of the specified angle, in radians.</summary>
            <returns>The trigonometric cotangent of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Cot(System.Nullable{System.Decimal})">
            <summary>A mathematical function that returns the trigonometric cotangent of the specified angle, in radians.</summary>
            <returns>The trigonometric cotangent of the specified angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Int32})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Int64})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Decimal})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Degrees(System.Nullable{System.Double})">
            <summary>Returns the corresponding angle in degrees for an angle specified in radians.</summary>
            <returns>The specified angle converted to degrees.</returns>
            <param name="arg1">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Exp(System.Nullable{System.Double})">
            <summary>Returns the exponential value of the specified float expression.</summary>
            <returns>The constant e raised to the power of the input value.</returns>
            <param name="arg">The input value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Exp(System.Nullable{System.Decimal})">
            <summary>Returns the exponential value of the specified float expression.</summary>
            <returns>The constant e raised to the power of the input value.</returns>
            <param name="arg">The input value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log(System.Nullable{System.Double})">
            <summary>Returns the natural logarithm of the specified input value.</summary>
            <returns>The natural logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log(System.Nullable{System.Decimal})">
            <summary>Returns the natural logarithm of the specified input value.</summary>
            <returns>The natural logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log10(System.Nullable{System.Double})">
            <summary>Returns the base-10 logarithm of the specified input value.</summary>
            <returns>The base-10 logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Log10(System.Nullable{System.Decimal})">
            <summary>Returns the base-10 logarithm of the specified input value.</summary>
            <returns>The base-10 logarithm of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Pi">
            <summary>Returns the constant value of pi.</summary>
            <returns>The numeric value of pi.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Int32})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Int64})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Decimal})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Radians(System.Nullable{System.Double})">
            <summary>Returns the radian measure corresponding to the specified angle in degrees.</summary>
            <returns>The radian measure of the specified angle.</returns>
            <param name="arg">The angle, measured in degrees.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Rand">
            <summary>Returns a pseudo-random float value from 0 through 1, exclusive.</summary>
            <returns>The pseudo-random value.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Rand(System.Nullable{System.Int32})">
            <summary>Returns a pseudo-random float value from 0 through 1, exclusive.</summary>
            <returns>The pseudo-random value.</returns>
            <param name="seed">The seed value. If  seed  is not specified, the SQL Server Database Engine assigns a seed value at random. For a specified seed value, the result returned is always the same.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Int32})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Int64})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Decimal})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sign(System.Nullable{System.Double})">
            <summary>Returns the positive (+1), zero (0), or negative (-1) sign of the specified expression.</summary>
            <returns>The sign of the input expression.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sin(System.Nullable{System.Decimal})">
            <summary>Returns the trigonometric sine of the specified angle.</summary>
            <returns>The trigonometric sine of the input expression.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Sin(System.Nullable{System.Double})">
            <summary>Returns the trigonometric sine of the specified angle.</summary>
            <returns>The trigonometric sine of the input expression.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.SquareRoot(System.Nullable{System.Double})">
            <summary>Returns the square root of the specified number.</summary>
            <returns>The square root of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.SquareRoot(System.Nullable{System.Decimal})">
            <summary>Returns the square root of the specified number.</summary>
            <returns>The square root of the input value.</returns>
            <param name="arg">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Square(System.Nullable{System.Double})">
            <summary>Returns the square of the specified number.</summary>
            <returns>The square of the input value.</returns>
            <param name="arg1">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Square(System.Nullable{System.Decimal})">
            <summary>Returns the square of the specified number.</summary>
            <returns>The square of the input value.</returns>
            <param name="arg1">A numeric expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Tan(System.Nullable{System.Double})">
            <summary>Returns the trigonometric tangent of the input expression.</summary>
            <returns>The tangent of the input angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Tan(System.Nullable{System.Decimal})">
            <summary>Returns the trigonometric tangent of the input expression.</summary>
            <returns>The tangent of the input angle.</returns>
            <param name="arg">An angle, measured in radians.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.Nullable{System.DateTime})">
            <summary>Returns a new datetime value based on adding an interval to the specified date.</summary>
            <returns>The new date.</returns>
            <param name="datePartArg">The part of the date to increment. </param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="date">The date to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.Nullable{System.TimeSpan})">
            <summary>Returns a new time span value based on adding an interval to the specified time span.</summary>
            <returns>The new time span.</returns>
            <param name="datePartArg">The part of the date to increment.</param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="time">The time span to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.Nullable{System.DateTimeOffset})">
            <summary>Returns a new date value based on adding an interval to the specified date.</summary>
            <returns>The new point in time, expressed as a date and time of day, relative to Coordinated Universal Time (UTC).</returns>
            <param name="datePartArg">The part of the date to increment.</param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="dateTimeOffsetArg">The date to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateAdd(System.String,System.Nullable{System.Double},System.String)">
            <summary>Returns a new datetime value based on adding an interval to the specified date.</summary>
            <returns>
            A <see cref="T:System.Nullable`1" /> of <see cref="T:System.DateTime" /> value that is the new date.
            </returns>
            <param name="datePartArg">The part of the date to increment.</param>
            <param name="number">The value used to increment a date by a specified amount.</param>
            <param name="date">The date to increment.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The value specifying the number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.String,System.String)">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.TimeSpan},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.Nullable{System.TimeSpan})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two Dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTime},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateDiff(System.String,System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTime})">
            <summary>Returns the count of the specified datepart boundaries crossed between the specified start date and end date.</summary>
            <returns>The number of time intervals between the two dates.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="startDate">The first date.</param>
            <param name="endDate">The second date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.Nullable{System.DateTime})">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.String)">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.Nullable{System.TimeSpan})">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DateName(System.String,System.Nullable{System.DateTimeOffset})">
            <summary>Returns a character string that represents the specified datepart of the specified date.</summary>
            <returns>The specified part of the specified date.</returns>
            <param name="datePartArg">The part of the date to calculate the differing number of time intervals.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.Nullable{System.DateTime})">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.Nullable{System.DateTimeOffset})">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.String)">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DatePart(System.String,System.Nullable{System.TimeSpan})">
            <summary>Returns an integer that represents the specified datepart of the specified date.</summary>
            <returns>The specified datepart of the specified date.</returns>
            <param name="datePartArg">The part of the date to return the value.</param>
            <param name="date">The date.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.GetDate">
            <summary>Returns the current database system timestamp as a datetime value without the database time zone offset. This value is derived from the operating system of the computer on which the instance of SQL Server is running.</summary>
            <returns>The current database timestamp.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.GetUtcDate">
            <summary>Returns the current database system timestamp as a datetime value. The database time zone offset is not included. This value represents the current UTC time (Coordinated Universal Time). This value is derived from the operating system of the computer on which the instance of SQL Server is running.</summary>
            <returns>The current database UTC timestamp.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Boolean})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Double})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Decimal})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.DateTime})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.TimeSpan})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.DateTimeOffset})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.String)">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Byte[])">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.DataLength(System.Nullable{System.Guid})">
            <summary>Returns the number of bytes used to represent any expression.</summary>
            <returns>The number of bytes in the input value.</returns>
            <param name="arg">The value to be examined for data length.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Boolean})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Double})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Decimal})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.String)">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTime})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.TimeSpan})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTimeOffset})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Byte[])">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The character array for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Guid})">
            <summary>Returns the checksum value computed over the input argument.</summary>
            <returns>The checksum computed over the input value.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Double},System.Nullable{System.Double})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Decimal},System.Nullable{System.Decimal})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.String,System.String)">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTime},System.Nullable{System.DateTime})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Byte[],System.Byte[])">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The character array for which the checksum is calculated.</param>
            <param name="arg2">The character array for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Guid},System.Nullable{System.Guid})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Double})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Decimal},System.Nullable{System.Decimal},System.Nullable{System.Decimal})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.String,System.String,System.String)">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTime},System.Nullable{System.DateTime},System.Nullable{System.DateTime})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset},System.Nullable{System.DateTimeOffset})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Byte[],System.Byte[],System.Byte[])">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The character array for which the checksum is calculated.</param>
            <param name="arg2">The character array for which the checksum is calculated.</param>
            <param name="arg3">The character array for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.Checksum(System.Nullable{System.Guid},System.Nullable{System.Guid},System.Nullable{System.Guid})">
            <summary>Returns the checksum value computed over the input arguments.</summary>
            <returns>The checksum computed over the input values.</returns>
            <param name="arg1">The value for which the checksum is calculated.</param>
            <param name="arg2">The value for which the checksum is calculated.</param>
            <param name="arg3">The value for which the checksum is calculated.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CurrentTimestamp">
            <summary>Returns the current date and time. </summary>
            <returns>The current date and time.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.CurrentUser">
            <summary>Returns the name of the current user.</summary>
            <returns>The name of the current user.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.HostName">
            <summary>Returns the workstation name.</summary>
            <returns>The name of the workstation.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.UserName(System.Nullable{System.Int32})">
            <summary>Returns a database user name corresponding to a specified identification number.</summary>
            <returns>The user name.</returns>
            <param name="arg">A user ID.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.UserName">
            <summary>Returns a database user name corresponding to a specified identification number.</summary>
            <returns>The user name.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.IsNumeric(System.String)">
            <summary>Indicates whether the input value is a valid numeric type.</summary>
            <returns>1 if the input expression is a valid numeric data type; otherwise, 0.</returns>
            <param name="arg">A string expression.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlFunctions.IsDate(System.String)">
            <summary>Indicates whether the input value is a valid date or time.</summary>
            <returns>1 if the input expression is a valid date or time value of datetime or smalldatetime data types; otherwise, 0.</returns>
            <param name="arg">The tested value.</param>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions">
            <summary>
            Contains function stubs that expose SqlServer methods in Linq to Entities.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.GetAncestor(System.Data.Entity.Hierarchy.HierarchyId,System.Int32)">
            <summary>Returns a hierarchyid representing the nth ancestor of this.</summary>
            <returns>A hierarchyid representing the nth ancestor of this.</returns>
            <param name="hierarchyIdValue">The hierarchyid value.</param>
            <param name="n">n</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.GetDescendant(System.Data.Entity.Hierarchy.HierarchyId,System.Data.Entity.Hierarchy.HierarchyId,System.Data.Entity.Hierarchy.HierarchyId)">
            <summary>Returns a child node of the parent.</summary>
            <param name="hierarchyIdValue">The hierarchyid value.</param>
            <param name="child1"> null or the hierarchyid of a child of the current node. </param>
            <param name="child2"> null or the hierarchyid of a child of the current node. </param>
            <returns>
            Returns one child node that is a descendant of the parent.
            If parent is null, returns null.
            If parent is not null, and both child1 and child2 are null, returns a child of parent.
            If parent and child1 are not null, and child2 is null, returns a child of parent greater than child1.
            If parent and child2 are not null and child1 is null, returns a child of parent less than child2.
            If parent, child1, and child2 are not null, returns a child of parent greater than child1 and less than child2.
            If child1 is not null and not a child of parent, an exception is raised.
            If child2 is not null and not a child of parent, an exception is raised.
            If child1 >= child2, an exception is raised.
            </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.GetLevel(System.Data.Entity.Hierarchy.HierarchyId)">
            <summary>Returns an integer that represents the depth of the node this in the tree.</summary>
            <returns>An integer that represents the depth of the node this in the tree.</returns>
            <param name="hierarchyIdValue">The hierarchyid value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.GetRoot">
            <summary>Returns the root of the hierarchy tree.</summary>
            <returns>The root of the hierarchy tree.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.IsDescendantOf(System.Data.Entity.Hierarchy.HierarchyId,System.Data.Entity.Hierarchy.HierarchyId)">
            <summary>Returns true if this is a descendant of parent.</summary>
            <returns>True if this is a descendant of parent.</returns>
            <param name="hierarchyIdValue">The hierarchyid value.</param>
            <param name="parent">parent</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.GetReparentedValue(System.Data.Entity.Hierarchy.HierarchyId,System.Data.Entity.Hierarchy.HierarchyId,System.Data.Entity.Hierarchy.HierarchyId)">
            <summary>Returns a node whose path from the root is the path to newRoot, followed by the path from oldRoot to this.</summary>
            <returns>Hierarchyid value.</returns>
            <param name="hierarchyIdValue">The hierarchyid value.</param>
            <param name="oldRoot">oldRoot</param>
            <param name="newRoot">newRoot</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlHierarchyIdFunctions.Parse(System.String)">
            <summary>Converts the canonical string representation of a hierarchyid to a hierarchyid value.</summary>
            <returns>Hierarchyid value.</returns>
            <param name="input">input</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderManifest.SupportsParameterOptimizationInSchemaQueries">
            <summary>
            Indicates if the provider supports the parameter optimization described in EntityFramework6 GitHub issue #195.
            </summary>
            <returns><c>True</c> since this provider supports the parameter optimization.</returns>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlProviderServices">
            <summary>
            The DbProviderServices implementation for the SqlClient provider for SQL Server.
            </summary>
            <remarks>
            Note that instance of this type also resolve additional provider services for Microsoft SQL Server
            when this type is registered as an EF provider either using an entry in the application's config file
            or through code-based registration in <see cref="T:System.Data.Entity.DbConfiguration" />.
            The services resolved are:
            Requests for <see cref="T:System.Data.Entity.Infrastructure.IDbConnectionFactory" /> are resolved to a Singleton instance of
            <see cref="T:System.Data.Entity.Infrastructure.LocalDbConnectionFactory" /> to create connections to LocalDB by default.
            Requests for <see cref="T:System.Func`1" /> for the invariant name "System.Data.SqlClient"
            for any server name are resolved to a delegate that returns a <see cref="T:System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy" />
            to provide a non-retrying policy for SQL Server.
            Requests for <see cref="T:System.Data.Entity.Migrations.Sql.MigrationSqlGenerator" /> for the invariant name "System.Data.SqlClient" are
            resolved to <see cref="T:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator" /> instances to provide default Migrations SQL
            generation for SQL Server.
            Requests for <see cref="T:System.Data.Entity.Spatial.DbSpatialServices" /> for the invariant name "System.Data.SqlClient" are
            resolved to a Singleton instance of <see cref="T:System.Data.Entity.SqlServer.SqlSpatialServices" /> to provide default spatial
            services for SQL Server.
            </remarks>
        </member>
        <member name="F:System.Data.Entity.SqlServer.SqlProviderServices.ProviderInvariantName">
            <summary>
            This is the well-known string using in configuration files and code-based configuration as
            the "provider invariant name" used to specify Microsoft SQL Server for ADO.NET and
            Entity Framework provider services.
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.Instance">
            <summary>
            The Singleton instance of the SqlProviderServices type.
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.SqlServerTypesAssemblyName">
            <summary>
            Set to the full name of the Microsoft.SqlServer.Types assembly to override the default selection
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.TruncateDecimalsToScale">
            <summary>
            Get or sets a value indicating whether <see cref="T:System.Decimal" /> parameter values are truncated to 
            the scale (number of decimal places) defined for their corresponding columns when they are sent 
            to the database. A value of <c>true</c> indicates that <see cref="T:System.Data.SqlClient.SqlParameter" /> objects 
            created for <see cref="T:System.Decimal" /> columns will have their <see cref="P:System.Data.SqlClient.SqlParameter.Scale" /> 
            properties set, which will cause the parameter values to be truncated. If set to <c>false</c> 
            then the <see cref="P:System.Data.SqlClient.SqlParameter.Scale" /> properties will not be set, avoiding the truncation 
            behavior of <see cref="T:System.Data.SqlClient.SqlParameter" /> and allowing SQL Server to round values if necessary. 
            The default value is <c>true</c> to prevent breaking existing applications that depend on this 
            behavior. 
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.UseScopeIdentity">
            <summary>
            Gets or sets a value indicating whether to use the SCOPE_IDENTITY() function to retrieve values 
            generated by the database for numeric columns during an INSERT operation. The default value of 
            <c>true</c> is recommended and can provide better performance if all numeric values are generated 
            using IDENTITY columns. If set to <c>false</c>, an OUTPUT clause will be used instead. An OUTPUT 
            clause makes it possible to retrieve values generated by sequences or other means.
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlProviderServices.UseRowNumberOrderingInOffsetQueries">
            <summary>
            Gets or sets a value indicating whether the ROW_NUMBER() function is used in sort expression 
            passed to the ORDER BY clause when OFFSET is present in query. The default value of <c>true</c> 
            is recommended to obtain query results that are stable for paging operations. The value of 
            <c>false</c> can be used for compatibility with previous versions of EF and will cause the sort 
            expression to be passed unmodified to the ORDER BY clause, which can lead to unstable results 
            if the ordering is ambiguous. 
            </summary>
            <remarks>
            This flag only applies to SQL Server 2012 or later. This flag does not affect queries that have 
            already been translated to SQL and cached, therefore applications that need to set the value to 
            <c>false</c> for compatibility should do so before executing any queries.
            </remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.RegisterInfoMessageHandler(System.Data.Common.DbConnection,System.Action{System.String})">
            <summary>
            Registers a handler to process non-error messages coming from the database provider.
            </summary>
            <param name="connection"> The connection to receive information for. </param>
            <param name="handler"> The handler to process messages. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.CreateDbCommandDefinition(System.Data.Entity.Core.Common.DbProviderManifest,System.Data.Entity.Core.Common.CommandTrees.DbCommandTree)">
            <summary>
            Create a Command Definition object, given the connection and command tree
            </summary>
            <param name="providerManifest"> provider manifest that was determined from metadata </param>
            <param name="commandTree"> command tree for the statement </param>
            <returns> an executable command definition object </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.CloneDbCommand(System.Data.Common.DbCommand)">
            <summary>
            See issue 2390 - cloning the DesignTimeVisible property on the
            <see cref="T:System.Data.SqlClient.SqlCommand" /> can cause deadlocks.
            So here overriding to provide a method that does not clone DesignTimeVisible.
            </summary>
            <param name="fromDbCommand"> the <see cref="T:System.Data.Common.DbCommand" /> object to clone </param>
            <returns >a clone of the <see cref="T:System.Data.Common.DbCommand" /> </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.SetDbParameterValue(System.Data.Common.DbParameter,System.Data.Entity.Core.Metadata.Edm.TypeUsage,System.Object)">
            <summary>
            Sets the parameter value and appropriate facets for the given <see cref="T:System.Data.Entity.Core.Metadata.Edm.TypeUsage"/>.
            </summary>
            <param name="parameter">The parameter.</param>
            <param name="parameterType">The type of the parameter.</param>
            <param name="value">The value of the parameter.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.GetDbProviderManifestToken(System.Data.Common.DbConnection)">
            <summary>
            Returns provider manifest token for a given connection.
            </summary>
            <param name="connection"> Connection to find manifest token from. </param>
            <returns> The provider manifest token for the specified connection. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.GetDbProviderManifest(System.String)">
            <summary>
            Returns the provider manifest by using the specified version information.
            </summary>
            <param name="versionHint"> The token information associated with the provider manifest. </param>
            <returns> The provider manifest by using the specified version information. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.GetDbSpatialDataReader(System.Data.Common.DbDataReader,System.String)">
            <summary>
            Gets a spatial data reader for SQL Server.
            </summary>
            <param name="fromReader"> The reader where the spatial data came from. </param>
            <param name="versionHint"> The manifest token associated with the provider manifest. </param>
            <returns> The spatial data reader. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbGetSpatialServices(System.String)">
            <summary>
            Gets a spatial data reader for SQL Server.
            </summary>
            <param name="versionHint"> The manifest token associated with the provider manifest. </param>
            <returns> The spatial data reader. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabaseScript(System.String,System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Generates a data definition language (DDL) script that creates schema objects 
            (tables, primary keys, foreign keys) based on the contents of the StoreItemCollection 
            parameter and targeted for the version of the database corresponding to the provider manifest token.
            </summary>
            <param name="providerManifestToken"> The provider manifest token identifying the target version. </param>
            <param name="storeItemCollection"> The structure of the database. </param>
            <returns>
            A DDL script that creates schema objects based on the contents of the StoreItemCollection parameter 
            and targeted for the version of the database corresponding to the provider manifest token.
            </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabase(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Create the database and the database objects.
            If initial catalog is not specified, but AttachDBFilename is specified, we generate a random database name based on the AttachDBFilename.
            Note: this causes pollution of the db, as when the connection string is later used, the mdf will get attached under a different name.
            However if we try to replicate the name under which it would be attached, the following scenario would fail:
            The file does not exist, but registered with database.
            The user calls:  If (DatabaseExists) DeleteDatabase
            CreateDatabase
            For further details on the behavior when AttachDBFilename is specified see Dev10# 188936
            </summary>
            <param name="connection">Connection to a non-existent database that needs to be created and populated with the store objects indicated with the storeItemCollection parameter.</param>
            <param name="commandTimeout">Execution timeout for any commands needed to create the database.</param>
            <param name="storeItemCollection">The collection of all store items based on which the script should be created.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbDatabaseExists(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Determines whether the database for the given connection exists.
            There are three cases:
            1.  Initial Catalog = X, AttachDBFilename = null:   (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            2.  Initial Catalog = X, AttachDBFilename = F:      if (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0 then <c>true</c>,
            if not, try to open the connection and then return (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            3.  Initial Catalog = null, AttachDBFilename = F:   Try to open the connection. If that succeeds the result is true, otherwise
            if the there are no databases corresponding to the given file return <c>false</c>, otherwise throw.
            Note: We open the connection to cover the scenario when the mdf exists, but is not attached.
            Given that opening the connection would auto-attach it, it would not be appropriate to return <c>false</c> in this case.
            Also note that checking for the existence of the file does not work for a remote server.  (Dev11 #290487)
            For further details on the behavior when AttachDBFilename is specified see Dev10# 188936
            </summary>
            <param name="connection">Connection to a database whose existence is checked by this method.</param>
            <param name="commandTimeout">Execution timeout for any commands needed to determine the existence of the database.</param>
            <param name="storeItemCollection">The collection of all store items from the model. This parameter is no longer used for determining database existence.</param>
            <returns>True if the provider can deduce the database only based on the connection.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbDatabaseExists(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Lazy{System.Data.Entity.Core.Metadata.Edm.StoreItemCollection})">
            <summary>
            Determines whether the database for the given connection exists.
            There are three cases:
            1.  Initial Catalog = X, AttachDBFilename = null:   (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            2.  Initial Catalog = X, AttachDBFilename = F:      if (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0 then <c>true</c>,
            if not, try to open the connection and then return (SELECT Count(*) FROM sys.databases WHERE [name]= X) > 0
            3.  Initial Catalog = null, AttachDBFilename = F:   Try to open the connection. If that succeeds the result is true, otherwise
            if the there are no databases corresponding to the given file return <c>false</c>, otherwise throw.
            Note: We open the connection to cover the scenario when the mdf exists, but is not attached.
            Given that opening the connection would auto-attach it, it would not be appropriate to return <c>false</c> in this case.
            Also note that checking for the existence of the file does not work for a remote server.  (Dev11 #290487)
            For further details on the behavior when AttachDBFilename is specified see Dev10# 188936
            </summary>
            <param name="connection">Connection to a database whose existence is checked by this method.</param>
            <param name="commandTimeout">Execution timeout for any commands needed to determine the existence of the database.</param>
            <param name="storeItemCollection">The collection of all store items from the model. This parameter is no longer used for determining database existence.</param>
            <returns>True if the provider can deduce the database only based on the connection.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.DbDeleteDatabase(System.Data.Common.DbConnection,System.Nullable{System.Int32},System.Data.Entity.Core.Metadata.Edm.StoreItemCollection)">
            <summary>
            Delete the database for the given connection.
            There are three cases:
            1.  If Initial Catalog is specified (X) drop database X
            2.  Else if AttachDBFilename is specified (F) drop all the databases corresponding to F
            if none throw
            3.  If niether the catalog not the file name is specified - throw
            Note that directly deleting the files does not work for a remote server.  However, even for not attached
            databases the current logic would work assuming the user does: if (DatabaseExists) DeleteDatabase
            </summary>
            <param name="connection"> Connection </param>
            <param name="commandTimeout"> Timeout for internal commands. </param>
            <param name="storeItemCollection"> Item Collection. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlProviderServices.CloneDbConnection(System.Data.Common.DbConnection,System.Data.Common.DbProviderFactory)">
            <summary>
            Clones the connection.
            </summary>
            <param name="connection">The original connection.</param>
            <param name="factory">The factory to use.</param>
            <returns>Cloned connection</returns>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator">
            <summary>
            Provider to convert provider agnostic migration operations into SQL commands
            that can be run against a Microsoft SQL Server database.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.IsPermissionDeniedError(System.Exception)">
            <summary>
            Determines if a provider specific exception corresponds to a database-level permission denied error.
            </summary>
            <param name="exception">The database exception.</param>
            <returns> true if the supplied exception corresponds to a database-level permission denied error; otherwise false. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Collections.Generic.IEnumerable{System.Data.Entity.Migrations.Model.MigrationOperation},System.String)">
            <summary>
            Converts a set of migration operations into Microsoft SQL Server specific SQL.
            </summary>
            <param name="migrationOperations"> The operations to be converted. </param>
            <param name="providerManifestToken"> Token representing the version of SQL Server being targeted (i.e. "2005", "2008"). </param>
            <returns> A list of SQL statements to be executed to perform the migration operations. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GenerateProcedureBody(System.Collections.Generic.ICollection{System.Data.Entity.Core.Common.CommandTrees.DbModificationCommandTree},System.String,System.String)">
            <summary>
            Generates the SQL body for a stored procedure.
            </summary>
            <param name="commandTrees">The command trees representing the commands for an insert, update or delete operation.</param>
            <param name="rowsAffectedParameter">The rows affected parameter name.</param>
            <param name="providerManifestToken">The provider manifest token.</param>
            <returns>The SQL body for the stored procedure.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.UpdateDatabaseOperation)">
            <summary>
            Generates the specified update database operation which represents applying a series of migrations.
            The generated script is idempotent, meaning it contains conditional logic to check if individual migrations 
            have already been applied and only apply the pending ones.
            </summary>
            <param name="updateDatabaseOperation">The update database operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.MigrationOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.MigrationOperation" />.
            Allows derived providers to handle additional operation types.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="migrationOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.CreateConnection">
            <summary>
            Creates an empty connection for the current provider.
            Allows derived providers to use connection other than <see cref="T:System.Data.SqlClient.SqlConnection" />.
            </summary>
            <returns> An empty connection for the current provider. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.CreateProcedureOperation)">
            <summary>
            Generates the specified create procedure operation.
            </summary>
            <param name="createProcedureOperation">The create procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AlterProcedureOperation)">
            <summary>
            Generates the specified alter procedure operation.
            </summary>
            <param name="alterProcedureOperation">The alter procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropProcedureOperation)">
            <summary>
            Generates the specified drop procedure operation.
            </summary>
            <param name="dropProcedureOperation">The drop procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.CreateTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.CreateTableOperation" />. This method differs from
            <see cref="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.WriteCreateTable(System.Data.Entity.Migrations.Model.CreateTableOperation)" /> in that it will
            create the target database schema if it does not already exist.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.WriteCreateTable(System.Data.Entity.Migrations.Model.CreateTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.CreateTableOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.WriteCreateTable(System.Data.Entity.Migrations.Model.CreateTableOperation,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Writes CREATE TABLE SQL to the target writer.
            </summary>
            <param name="createTableOperation"> The operation to produce SQL for. </param>
            <param name="writer"> The target writer. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AlterTableOperation)">
            <summary>
            Override this method to generate SQL when the definition of a table or its attributes are changed.
            The default implementation of this method does nothing.
            </summary>
            <param name="alterTableOperation"> The operation describing changes to the table. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GenerateMakeSystemTable(System.Data.Entity.Migrations.Model.CreateTableOperation,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Generates SQL to mark a table as a system table.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createTableOperation"> The table to mark as a system table. </param>
            <param name="writer"> The <see cref='T:System.Data.Entity.Migrations.Utilities.IndentedTextWriter' /> to write the generated SQL to. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GenerateCreateSchema(System.String)">
            <summary>
            Generates SQL to create a database schema.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="schema"> The name of the schema to create. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AddForeignKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AddForeignKeyOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="addForeignKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropForeignKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropForeignKeyOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropForeignKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.CreateIndexOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.CreateIndexOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="createIndexOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropIndexOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropIndexOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropIndexOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AddPrimaryKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AddPrimaryKeyOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="addPrimaryKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropPrimaryKeyOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropPrimaryKeyOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropPrimaryKeyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AddColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AddColumnOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="addColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropColumnOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.AlterColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.AlterColumnOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="alterColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.DropDefaultConstraint(System.String,System.String,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Call this method to generate SQL that will attempt to drop the default constraint created
            when a column is created. This method is usually called by code that overrides the creation or
            altering of columns.
            </summary>
            <param name="table">The table to which the constraint applies.</param>
            <param name="column">The column to which the constraint applies.</param>
            <param name="writer">The writer to which generated SQL should be written.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.DropTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.DropTableOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="dropTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.SqlOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.SqlOperation" />.
            Generated SQL should be added using the Statement or StatementBatch methods.
            </summary>
            <param name="sqlOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameColumnOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.RenameColumnOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="renameColumnOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameIndexOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.RenameIndexOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="renameIndexOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.RenameTableOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="renameTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.RenameProcedureOperation)">
            <summary>
            Generates the specified rename procedure operation.
            </summary>
            <param name="renameProcedureOperation">The rename procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.MoveProcedureOperation)">
            <summary>
            Generates the specified move procedure operation.
            </summary>
            <param name="moveProcedureOperation">The move procedure operation.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.MoveTableOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.MoveTableOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="moveTableOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.ColumnModel,System.Data.Entity.Migrations.Utilities.IndentedTextWriter)">
            <summary>
            Generates SQL for the given column model. This method is called by other methods that
            process columns and can be overridden to change the SQL generated.
            </summary>
            <param name="column">The column for which SQL is being generated.</param>
            <param name="writer">The writer to which generated SQL should be written.</param>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.GuidColumnDefault">
            <summary>
            Returns the column default value to use for store-generated GUID columns when
            no default value is explicitly specified in the migration.
            Returns newsequentialid() for on-premises SQL Server 2005 and later.
            Returns newid() for SQL Azure.
            </summary>
            <value>Either newsequentialid() or newid() as described above.</value>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Migrations.Model.HistoryOperation)">
            <summary>
            Generates SQL for a <see cref="T:System.Data.Entity.Migrations.Model.HistoryOperation" />.
            Generated SQL should be added using the Statement method.
            </summary>
            <param name="historyOperation"> The operation to produce SQL for. </param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Byte[])">
            <summary>
            Generates SQL to specify a constant byte[] default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Boolean)">
            <summary>
            Generates SQL to specify a constant bool default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.DateTime)">
            <summary>
            Generates SQL to specify a constant DateTime default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.DateTimeOffset)">
            <summary>
            Generates SQL to specify a constant DateTimeOffset default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Guid)">
            <summary>
            Generates SQL to specify a constant Guid default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.String)">
            <summary>
            Generates SQL to specify a constant string default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.TimeSpan)">
            <summary>
            Generates SQL to specify a constant TimeSpan default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Hierarchy.HierarchyId)">
            <summary>
            Generates SQL to specify a constant hierarchyid default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Spatial.DbGeography)">
            <summary>
            Generates SQL to specify a constant geogrpahy default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Data.Entity.Spatial.DbGeometry)">
            <summary>
            Generates SQL to specify a constant geometry default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Generate(System.Object)">
            <summary>
            Generates SQL to specify a constant default value being set on a column.
            This method just generates the actual value, not the SQL to set the default value.
            </summary>
            <param name="defaultValue"> The value to be set. </param>
            <returns> SQL representing the default value. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.BuildColumnType(System.Data.Entity.Migrations.Model.ColumnModel)">
            <summary>
            Generates SQL to specify the data type of a column.
            This method just generates the actual type, not the SQL to create the column.
            </summary>
            <param name="columnModel"> The definition of the column. </param>
            <returns> SQL representing the data type. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Name(System.String)">
            <summary>
            Generates a quoted name. The supplied name may or may not contain the schema.
            </summary>
            <param name="name"> The name to be quoted. </param>
            <returns> The quoted name. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Quote(System.String)">
            <summary>
            Quotes an identifier for SQL Server.
            </summary>
            <param name="identifier"> The identifier to be quoted. </param>
            <returns> The quoted identifier. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Statement(System.String,System.Boolean,System.String)">
            <summary>
            Adds a new Statement to be executed against the database.
            </summary>
            <param name="sql"> The statement to be executed. </param>
            <param name="suppressTransaction"> Gets or sets a value indicating whether this statement should be performed outside of the transaction scope that is used to make the migration process transactional. If set to true, this operation will not be rolled back if the migration process fails. </param>
            <param name="batchTerminator">The batch terminator for the database provider.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Writer">
            <summary>
            Gets a new <see cref="T:System.Data.Entity.Migrations.Utilities.IndentedTextWriter" /> that can be used to build SQL.
            This is just a helper method to create a writer. Writing to the writer will
            not cause SQL to be registered for execution. You must pass the generated
            SQL to the Statement method.
            </summary>
            <returns> An empty text writer to use for SQL generation. </returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.Statement(System.Data.Entity.Migrations.Utilities.IndentedTextWriter,System.String)">
            <summary>
            Adds a new Statement to be executed against the database.
            </summary>
            <param name="writer"> The writer containing the SQL to be executed. </param>
            <param name="batchTerminator">The batch terminator for the database provider.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlServerMigrationSqlGenerator.StatementBatch(System.String,System.Boolean)">
            <summary>
            Breaks sql string into one or more statements, handling T-SQL utility statements as necessary.
            </summary>
            <param name="sqlBatch"> The SQL to split into one ore more statements to be executed. </param>
            <param name="suppressTransaction"> Gets or sets a value indicating whether this statement should be performed outside of the transaction scope that is used to make the migration process transactional. If set to true, this operation will not be rolled back if the migration process fails. </param>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlSpatialFunctions">
            <summary>
            Contains function stubs that expose SqlServer methods in Linq to Entities.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.PointGeography(System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Int32})">
            <summary>Constructs a geography instance representing a Point instance from its x and y values and a spatial reference ID (SRID). </summary>
            <returns>The constructed geography instance.</returns>
            <param name="latitude">The x-coordinate of the Point being generated.</param>
            <param name="longitude">The y-coordinate of the Point being generated</param>
            <param name="spatialReferenceId">The SRID of the geography instance.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.AsTextZM(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns the Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geography instance augmented with any Z (elevation) and M (measure) values carried by the instance.</summary>
            <returns>The Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geography instance.</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.BufferWithTolerance(System.Data.Entity.Spatial.DbGeography,System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Boolean})">
            <summary>Returns a geometric object representing the union of all point values whose distance from a geography instance is less than or equal to a specified value, allowing for a specified tolerance.</summary>
            <returns>The union of all point values whose distance from a geography instance is less than or equal to a specified value</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="distance">The distance.</param>
            <param name="tolerance">The specified tolerance.</param>
            <param name="relative">Specifying whether the tolerance value is relative or absolute.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.EnvelopeAngle(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns the maximum angle between the point returned by EnvelopeCenter() and a point in the geography instance in degrees.</summary>
            <returns>the maximum angle between the point returned by EnvelopeCenter().</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.EnvelopeCenter(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns a point that can be used as the center of a bounding circle for the geography instance.</summary>
            <returns>A SqlGeography value that specifies the location of the center of a bounding circle.</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Filter(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <summary>Offers a fast, index-only intersection method to determine if a geography instance intersects another SqlGeography instance, assuming an index is available.</summary>
            <returns>True if a geography instance potentially intersects another SqlGeography instance; otherwise, false.</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="geographyOther">Another geography instance to compare against the instance on which Filter is invoked.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.InstanceOf(System.Data.Entity.Spatial.DbGeography,System.String)">
            <summary>Tests if the SqlGeography instance is the same as the specified type.</summary>
            <returns>A string that specifies one of the 12 types exposed in the geography type hierarchy.</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="geometryTypeName">A string that specifies one of the 12 types exposed in the geography type hierarchy.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.NumRings(System.Data.Entity.Spatial.DbGeography)">
            <summary>Returns the total number of rings in a Polygon instance.</summary>
            <returns>The total number of rings.</returns>
            <param name="geographyValue">The geography value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Reduce(System.Data.Entity.Spatial.DbGeography,System.Nullable{System.Double})">
            <summary>Returns an approximation of the given geography instance produced by running the Douglas-Peucker algorithm on the instance with the given tolerance.</summary>
            <returns>
            Returns <see cref="T:System.Data.Entity.Spatial.DbGeography" />.
            </returns>
            <param name="geographyValue">The geography value.</param>
            <param name="tolerance">The tolerance to input to the Douglas-Peucker algorithm. tolerance must be a positive number.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.RingN(System.Data.Entity.Spatial.DbGeography,System.Nullable{System.Int32})">
            <summary>Returns the specified ring of the SqlGeography instance: 1 ≤ n ≤ NumRings().</summary>
            <returns>A SqlGeography object that represents the ring specified by n.</returns>
            <param name="geographyValue">The geography value.</param>
            <param name="index">An int expression between 1 and the number of rings in a polygon instance.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.PointGeometry(System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Int32})">
            <summary>Constructs a geometry instance representing a Point instance from its x and y values and a spatial reference ID (SRID). </summary>
            <returns>The constructed geometry instance.</returns>
            <param name="xCoordinate">The x-coordinate of the Point being generated.</param>
            <param name="yCoordinate">The y-coordinate of the Point being generated</param>
            <param name="spatialReferenceId">The SRID of the geography instance.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.AsTextZM(System.Data.Entity.Spatial.DbGeometry)">
            <summary>Returns the Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geography instance augmented with any Z (elevation) and M (measure) values carried by the instance.</summary>
            <returns>The Open Geospatial Consortium (OGC) Well-Known Text (WKT) representation of a geometry instance.</returns>
            <param name="geometryValue">The geometry value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.BufferWithTolerance(System.Data.Entity.Spatial.DbGeometry,System.Nullable{System.Double},System.Nullable{System.Double},System.Nullable{System.Boolean})">
            <summary>Returns a geometric object representing the union of all point values whose distance from a geometry instance is less than or equal to a specified value, allowing for a specified tolerance.</summary>
            <returns>The union of all point values whose distance from a geometry instance is less than or equal to a specified value</returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="distance">The distance.</param>
            <param name="tolerance">The specified tolerance.</param>
            <param name="relative">Specifying whether the tolerance value is relative or absolute.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.InstanceOf(System.Data.Entity.Spatial.DbGeometry,System.String)">
            <summary>Tests if the SqlGeometry instance is the same as the specified type.</summary>
            <returns>A string that specifies one of the 12 types exposed in the geography type hierarchy.</returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="geometryTypeName">A string that specifies one of the 12 types exposed in the geography type hierarchy.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Filter(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <summary>Offers a fast, index-only intersection method to determine if a geography instance intersects another SqlGeometry instance, assuming an index is available.</summary>
            <returns>True if a geography instance potentially intersects another SqlGeography instance; otherwise, false.</returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="geometryOther">Another geography instance to compare against the instance on which Filter is invoked.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.MakeValid(System.Data.Entity.Spatial.DbGeometry)">
            <summary>Converts an invalid geometry instance into a geometry instance with a valid Open Geospatial Consortium (OGC) type. </summary>
            <returns>The converted geometry instance.</returns>
            <param name="geometryValue">The geometry value.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialFunctions.Reduce(System.Data.Entity.Spatial.DbGeometry,System.Nullable{System.Double})">
            <summary>Returns an approximation of the given geography instance produced by running the Douglas-Peucker algorithm on the instance with the given tolerance.</summary>
            <returns>
            Returns <see cref="T:System.Data.Entity.Spatial.DbGeometry" />.
            </returns>
            <param name="geometryValue">The geometry value.</param>
            <param name="tolerance">The tolerance to input to the Douglas-Peucker algorithm. tolerance must be a positive number.</param>
        </member>
        <member name="T:System.Data.Entity.SqlServer.SqlSpatialServices">
            <summary>
            An implementation of <see cref="T:System.Data.Entity.Spatial.DbSpatialServices"/> to provide support for geospatial types when using
            Entity Framework with Microsoft SQL Server.
            </summary>
        </member>
        <member name="P:System.Data.Entity.SqlServer.SqlSpatialServices.NativeTypesAvailable">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateProviderValue(System.Data.Entity.Spatial.DbGeographyWellKnownValue)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromProviderValue(System.Object)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateWellKnownValue(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateProviderValue(System.Data.Entity.Spatial.DbGeometryWellKnownValue)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromProviderValue(System.Object)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.CreateWellKnownValue(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsTextIncludingElevationAndMeasure(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsTextIncludingElevationAndMeasure(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromText(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyCollectionFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromBinary(System.Byte[])">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyMultiPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyCollectionFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromGml(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromGml(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetCoordinateSystemId(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetSpatialTypeName(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetDimension(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsBinary(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsGml(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsText(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsEmpty(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SpatialEquals(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Disjoint(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersects(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Buffer(System.Data.Entity.Spatial.DbGeography,System.Double)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Distance(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersection(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Union(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Difference(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SymmetricDifference(System.Data.Entity.Spatial.DbGeography,System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElementCount(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.ElementAt(System.Data.Entity.Spatial.DbGeography,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLatitude(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLongitude(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElevation(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetMeasure(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLength(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetStartPoint(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetEndPoint(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsClosed(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetPointCount(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.PointAt(System.Data.Entity.Spatial.DbGeography,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetArea(System.Data.Entity.Spatial.DbGeography)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromText(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPointFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiLineFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPolygonFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryCollectionFromText(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromBinary(System.Byte[])">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPointFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiLineFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryMultiPolygonFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryCollectionFromBinary(System.Byte[],System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromGml(System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GeometryFromGml(System.String,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetCoordinateSystemId(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetSpatialTypeName(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetDimension(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetEnvelope(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsBinary(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsGml(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.AsText(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsEmpty(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsSimple(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetBoundary(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsValid(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SpatialEquals(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Disjoint(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersects(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Touches(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Crosses(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Within(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Contains(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Overlaps(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Relate(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry,System.String)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Buffer(System.Data.Entity.Spatial.DbGeometry,System.Double)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Distance(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetConvexHull(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Intersection(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Union(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.Difference(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.SymmetricDifference(System.Data.Entity.Spatial.DbGeometry,System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElementCount(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.ElementAt(System.Data.Entity.Spatial.DbGeometry,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetXCoordinate(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetYCoordinate(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetElevation(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetMeasure(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetLength(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetStartPoint(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetEndPoint(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsClosed(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetIsRing(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetPointCount(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.PointAt(System.Data.Entity.Spatial.DbGeometry,System.Int32)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetArea(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetCentroid(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetPointOnSurface(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetExteriorRing(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.GetInteriorRingCount(System.Data.Entity.Spatial.DbGeometry)">
            <inheritdoc />
        </member>
        <member name="M:System.Data.Entity.SqlServer.SqlSpatialServices.InteriorRingAt(System.Data.Entity.Spatial.DbGeometry,System.Int32)">
            <inheritdoc />
        </member>
        <member name="T:System.Data.Entity.SqlServer.Utilities.TaskExtensions">
            <summary>
            Contains extension methods for the <see cref="T:System.Threading.Tasks.Task" /> class.
            </summary>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.WithCurrentCulture``1(System.Threading.Tasks.Task{``0})">
            <summary>
            Configures an awaiter used to await this <see cref="T:System.Threading.Tasks.Task`1" /> to avoid
            marshalling the continuation
            back to the original context, but preserve the current culture and UI culture.
            </summary>
            <typeparam name="T">
            The type of the result produced by the associated <see cref="T:System.Threading.Tasks.Task`1"/>.
            </typeparam>
            <param name="task">The task to be awaited on.</param>
            <returns>An object used to await this task.</returns>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.WithCurrentCulture(System.Threading.Tasks.Task)">
            <summary>
            Configures an awaiter used to await this <see cref="T:System.Threading.Tasks.Task" /> to avoid
            marshalling the continuation
            back to the original context, but preserve the current culture and UI culture.
            </summary>
            <param name="task">The task to be awaited on.</param>
            <returns>An object used to await this task.</returns>
        </member>
        <member name="T:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1">
            <summary>
            Provides an awaitable object that allows for awaits on <see cref="T:System.Threading.Tasks.Task`1" /> that
            preserve the culture.
            </summary>
            <typeparam name="T">
            The type of the result produced by the associated <see cref="T:System.Threading.Tasks.Task`1"/>.
            </typeparam>
            <remarks>This type is intended for compiler use only.</remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.#ctor(System.Threading.Tasks.Task{`0})">
            <summary>
            Constructs a new instance of the <see cref="T:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1" /> class.
            </summary>
            <param name="task">The task to be awaited on.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.GetAwaiter">
            <summary>Gets an awaiter used to await this <see cref="T:System.Threading.Tasks.Task`1" />.</summary>
            <returns>An awaiter instance.</returns>
            <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
        </member>
        <member name="P:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.IsCompleted">
            <summary>
            Gets whether this <see cref="T:System.Threading.Tasks.Task">Task</see> has completed.
            </summary>
            <remarks>
            <see cref="P:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.IsCompleted" /> will return true when the Task is in one of the three
            final states: <see cref="F:System.Threading.Tasks.TaskStatus.RanToCompletion">RanToCompletion</see>,
            <see cref="F:System.Threading.Tasks.TaskStatus.Faulted">Faulted</see>, or
            <see cref="F:System.Threading.Tasks.TaskStatus.Canceled">Canceled</see>.
            </remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.GetResult">
            <summary>Ends the await on the completed <see cref="T:System.Threading.Tasks.Task`1" />.</summary>
            <returns>The result of the completed <see cref="T:System.Threading.Tasks.Task`1" />.</returns>
            <exception cref="T:System.NullReferenceException">The awaiter was not properly initialized.</exception>
            <exception cref="T:System.Threading.Tasks.TaskCanceledException">The task was canceled.</exception>
            <exception cref="T:System.Exception">The task completed in a Faulted state.</exception>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.OnCompleted(System.Action)">
            <summary>This method is not implemented and should not be called.</summary>
            <param name="continuation">The action to invoke when the await operation completes.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter`1.UnsafeOnCompleted(System.Action)">
            <summary>
            Schedules the continuation onto the <see cref="T:System.Threading.Tasks.Task`1" /> associated with this
            <see cref="T:System.Runtime.CompilerServices.TaskAwaiter`1" />.
            </summary>
            <param name="continuation">The action to invoke when the await operation completes.</param>
            <exception cref="T:System.ArgumentNullException">
            The <paramref name="continuation" /> argument is null
            (Nothing in Visual Basic).
            </exception>
            <exception cref="T:System.InvalidOperationException">The awaiter was not properly initialized.</exception>
            <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
        </member>
        <member name="T:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter">
            <summary>
            Provides an awaitable object that allows for awaits on <see cref="T:System.Threading.Tasks.Task" /> that
            preserve the culture.
            </summary>
            <remarks>This type is intended for compiler use only.</remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.#ctor(System.Threading.Tasks.Task)">
            <summary>
            Constructs a new instance of the <see cref="T:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter" /> class.
            </summary>
            <param name="task">The task to be awaited on.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.GetAwaiter">
            <summary>Gets an awaiter used to await this <see cref="T:System.Threading.Tasks.Task" />.</summary>
            <returns>An awaiter instance.</returns>
            <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
        </member>
        <member name="P:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.IsCompleted">
            <summary>
            Gets whether this <see cref="T:System.Threading.Tasks.Task">Task</see> has completed.
            </summary>
            <remarks>
            <see cref="P:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.IsCompleted" /> will return true when the Task is in one of the three
            final states: <see cref="F:System.Threading.Tasks.TaskStatus.RanToCompletion">RanToCompletion</see>,
            <see cref="F:System.Threading.Tasks.TaskStatus.Faulted">Faulted</see>, or
            <see cref="F:System.Threading.Tasks.TaskStatus.Canceled">Canceled</see>.
            </remarks>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.GetResult">
            <summary>Ends the await on the completed <see cref="T:System.Threading.Tasks.Task" />.</summary>
            <exception cref="T:System.NullReferenceException">The awaiter was not properly initialized.</exception>
            <exception cref="T:System.Threading.Tasks.TaskCanceledException">The task was canceled.</exception>
            <exception cref="T:System.Exception">The task completed in a Faulted state.</exception>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.OnCompleted(System.Action)">
            <summary>This method is not implemented and should not be called.</summary>
            <param name="continuation">The action to invoke when the await operation completes.</param>
        </member>
        <member name="M:System.Data.Entity.SqlServer.Utilities.TaskExtensions.CultureAwaiter.UnsafeOnCompleted(System.Action)">
            <summary>
            Schedules the continuation onto the <see cref="T:System.Threading.Tasks.Task" /> associated with this
            <see cref="T:System.Runtime.CompilerServices.TaskAwaiter" />.
            </summary>
            <param name="continuation">The action to invoke when the await operation completes.</param>
            <exception cref="T:System.ArgumentNullException">
            The <paramref name="continuation" /> argument is null
            (Nothing in Visual Basic).
            </exception>
            <exception cref="T:System.InvalidOperationException">The awaiter was not properly initialized.</exception>
            <remarks>This method is intended for compiler user rather than use directly in code.</remarks>
        </member>
    </members>
</doc>

Added Externals/EntityFramework/v6.4/lib/netstandard2.1/EntityFramework.dll.

cannot compute difference between binary files

Added Externals/EntityFramework/v6.4/lib/netstandard2.1/EntityFramework.xml.

more than 10,000 changes

Added Externals/HtmlHelp/HelpDocs.zip.

cannot compute difference between binary files

Added Externals/HtmlHelp/htmlhelp.exe.

cannot compute difference between binary files

Added Externals/HtmlHelp/htmlhelpj.exe.

cannot compute difference between binary files

Added Externals/MSVCPP/vcredist_x64_2005_SP1_MFC.exe.

cannot compute difference between binary files

Added Externals/MSVCPP/vcredist_x64_2008_SP1_MFC.exe.

cannot compute difference between binary files

Added Externals/MSVCPP/vcredist_x64_2010_SP1_MFC.exe.

cannot compute difference between binary files

Added Externals/MSVCPP/vcredist_x64_2012_VSU4.exe.

cannot compute difference between binary files

Added Externals/MSVCPP/vcredist_x64_2013_VSU2.exe.

cannot compute difference between binary files

Added Externals/MSVCPP/vcredist_x64_2015_VSU3.exe.

cannot compute difference between binary files

Added Externals/MSVCPP/vcredist_x86_2005_SP1_MFC.exe.

cannot compute difference between binary files

Added Externals/MSVCPP/vcredist_x86_2008_SP1_MFC.exe.

cannot compute difference between binary files

Added Externals/MSVCPP/vcredist_x86_2010_SP1_MFC.exe.

cannot compute difference between binary files

Added Externals/MSVCPP/vcredist_x86_2012_VSU4.exe.

cannot compute difference between binary files

Added Externals/MSVCPP/vcredist_x86_2013_VSU2.exe.

cannot compute difference between binary files

Added Externals/MSVCPP/vcredist_x86_2015_VSU3.exe.

cannot compute difference between binary files

Added Externals/NDoc3/NDoc3 Beta 4.msi.

cannot compute difference between binary files

Added Externals/NDoc3/bin/NDoc3.Documenter.Msdn.dll.

cannot compute difference between binary files

Added Externals/NDoc3/bin/NDoc3Console.exe.

cannot compute difference between binary files

Added Externals/NDoc3/src/MsdnDocumenter.cs.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
// MsdnDocumenter.cs - a MSDN-like documenter
// Copyright (C) 2001  Kral Ferch, Jason Diamond
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.IO;
using System.Xml;
using System.Xml.XPath;
using System.Xml.Xsl;
using System.Globalization;

using NDoc3.Core;
using NDoc3.Core.Reflection;
using NDoc3.Documenter.Msdn.onlinefiles;
using NDoc3.Documenter.Msdn.onlinetemplates;
using NDoc3.Xml;

namespace NDoc3.Documenter.Msdn
{
	/// <summary>The MsdnDocumenter class.</summary>
	public class MsdnDocumenter : BaseReflectionDocumenter
	{
		private enum WhichType
		{
			Class,
			Interface,
			Structure,
			Enumeration,
			Delegate,
			Unknown
		};

		private readonly Dictionary<WhichType, string> lowerCaseTypeNames;
		private readonly Dictionary<WhichType, string> mixedCaseTypeNames;
		private List<string> filesToInclude = new List<string>();

		/// <summary>
		/// Initializes a new instance of the <see cref="MsdnDocumenter" />
		/// class.
		/// </summary>
		public MsdnDocumenter(MsdnDocumenterConfig config)
			: base(config)
		{
			lowerCaseTypeNames = new Dictionary<WhichType, string>();
			lowerCaseTypeNames.Add(WhichType.Class, "class");
			lowerCaseTypeNames.Add(WhichType.Interface, "interface");
			lowerCaseTypeNames.Add(WhichType.Structure, "structure");
			lowerCaseTypeNames.Add(WhichType.Enumeration, "enumeration");
			lowerCaseTypeNames.Add(WhichType.Delegate, "delegate");

			mixedCaseTypeNames = new Dictionary<WhichType, string>();
			mixedCaseTypeNames.Add(WhichType.Class, "Class");
			mixedCaseTypeNames.Add(WhichType.Interface, "Interface");
			mixedCaseTypeNames.Add(WhichType.Structure, "Structure");
			mixedCaseTypeNames.Add(WhichType.Enumeration, "Enumeration");
			mixedCaseTypeNames.Add(WhichType.Delegate, "Delegate");
		}

		/// <summary>See <see cref="IDocumenter"/>.</summary>
		public override string MainOutputFile
		{
			get
			{
				if ((MyConfig.OutputTarget & OutputType.HtmlHelp) > 0) {
					return Path.Combine(MyConfig.OutputDirectory,
						MyConfig.HtmlHelpName + ".chm");
				}
				return Path.Combine(MyConfig.OutputDirectory, "index.html");
			}
		}

		/// <summary>See <see cref="IDocumenter"/>.</summary>
		public override string CanBuild(Project project, bool checkInputOnly)
		{
			string result = base.CanBuild(project, checkInputOnly);
			if (result != null) {
				return result;
			}

			string AdditionalContentResourceDirectory = MyConfig.AdditionalContentResourceDirectory;
			if (AdditionalContentResourceDirectory.Length != 0 && !Directory.Exists(AdditionalContentResourceDirectory))
				return string.Format("The Additional Content Resource Directory {0} could not be found", AdditionalContentResourceDirectory);

			string ExtensibilityStylesheet = MyConfig.ExtensibilityStylesheet;
			if (ExtensibilityStylesheet.Length != 0 && !File.Exists(ExtensibilityStylesheet))
				return string.Format("The Extensibility Stylesheet file {0} could not be found", ExtensibilityStylesheet);

			if (checkInputOnly) {
				return null;
			}

			string path = Path.Combine(MyConfig.OutputDirectory,
				MyConfig.HtmlHelpName + ".chm");

			string temp = Path.Combine(MyConfig.OutputDirectory, "~chm.tmp");

			try {

				if (File.Exists(path)) {
					//if we can move the file, then it is not open...
					File.Move(path, temp);
					File.Move(temp, path);
				}
			} catch (Exception) {
				result = "The compiled HTML Help file is probably open.\nPlease close it and try again.";
			}

			return result;
		}

		/// <summary>See <see cref="IDocumenter"/>.</summary>
		public override void Build(Project project)
		{
			BuildProjectContext buildContext = new BuildProjectContext(new CultureInfo(MyConfig.LangID),
				new DirectoryInfo(MyConfig.OutputDirectory), MyConfig.CleanIntermediates);

			try {
				OnDocBuildingStep(0, "Initializing...");

				buildContext.Initialize();

				OnDocBuildingStep(10, "Merging XML documentation...");

				// Will hold the name of the file name containing the XML doc
				XmlDocument projectXml = CreateNDocXml(project);
				buildContext.SetProjectXml(projectXml, MyConfig.MergeAssemblies);

				OnDocBuildingStep(30, "Loading XSLT files...");

				buildContext.stylesheets = StyleSheetCollection.LoadStyleSheets(MyConfig.ExtensibilityStylesheet);

				OnDocBuildingStep(40, "Generating HTML pages...");

				// setup for root page
				string defaultTopic;
				string rootPageFileName = null;
				string rootPageTOCName = null;

				if (!String.IsNullOrEmpty(MyConfig.RootPageFileName)) {
					rootPageFileName = MyConfig.RootPageFileName;
					defaultTopic = "default.html";

					rootPageTOCName = "Overview";
					// what to call the top page in the table of contents?
					if (!String.IsNullOrEmpty(MyConfig.RootPageTOCName)) {
						rootPageTOCName = MyConfig.RootPageTOCName;
					}
				} else {
					// TODO (EE): check MergeAssemblies and adjust defaultTopic accordingly
					XmlNode defaultNamespace;
					if (MyConfig.MergeAssemblies)
					{
						XmlNodeList namespaceNodes = buildContext.SelectNodes("/ndoc:ndoc/ndoc:assembly/ndoc:module/ndoc:namespace");
						int[] indexes = SortNodesByAttribute(namespaceNodes, "name");

						defaultNamespace = namespaceNodes[indexes[0]];
					}
					else
					{
						XmlNodeList assemblyNodes = buildContext.SelectNodes("/ndoc:ndoc/ndoc:assembly");
						int[] assemblyIndexes = SortNodesByAttribute(assemblyNodes, "name");
						XmlNode defaultAssemblyNode = assemblyNodes[assemblyIndexes[0]];
						XmlNodeList namespaceNodes = buildContext.SelectNodes(defaultAssemblyNode, "ndoc:module/ndoc:namespace");
						int[] indexes = SortNodesByAttribute(namespaceNodes, "name");
						defaultNamespace = namespaceNodes[indexes[0]];
					}
					string defaultNamespaceName = GetNodeName(defaultNamespace);
					string assemblyName = GetNodeName(buildContext.SelectSingleNode(defaultNamespace, "ancestor::ndoc:assembly"));
					defaultTopic = buildContext._nameResolver.GetFilenameForNamespace(assemblyName, defaultNamespaceName);
				}
				buildContext.htmlHelp = SetupHtmlHelpBuilder(buildContext.WorkingDirectory, defaultTopic);

				using (buildContext.htmlHelp.OpenProjectFile())
				using (buildContext.htmlHelp.OpenContentsFile(string.Empty, true)) {
					// Write the embedded css files to the html output directory
					WriteHtmlContentResources(buildContext);

					GenerateHtmlContentFiles(buildContext, rootPageFileName, rootPageTOCName);
				}

				HtmlHelp htmlHelp = buildContext.htmlHelp;
				htmlHelp.WriteEmptyIndexFile();

				if ((MyConfig.OutputTarget & OutputType.Web) > 0) {
					OnDocBuildingStep(75, "Generating HTML index file...");

					// Write the embedded online templates to the html output directory
					GenerateHtmlIndexFile(buildContext, defaultTopic);
				}

				if ((MyConfig.OutputTarget & OutputType.HtmlHelp) > 0) {
					OnDocBuildingStep(85, "Compiling HTML Help file...");
					htmlHelp.CompileProject();
				}
#if !DEBUG
				else
				{
					//remove .hhc file
					File.Delete(htmlHelp.GetPathToContentsFile());
				}
#endif

				// if we're only building a CHM, copy that to the Outpur dir
				if ((MyConfig.OutputTarget & OutputType.HtmlHelp) > 0 && (MyConfig.OutputTarget & OutputType.Web) == 0) {
					buildContext.SaveOutputs("*.chm");
				} else {
					// otherwise copy everything to the output dir (cause the help file is all the html, not just one chm)
					buildContext.SaveOutputs("*.*");
				}

				OnDocBuildingStep(100, "Done.");
			} catch(DocumenterException) {
				throw;
			} catch (Exception ex) {
				throw new DocumenterException(ex.Message, ex);
			} finally {
				buildContext.Dispose();
			}
		}

		private void GenerateHtmlIndexFile(BuildProjectContext ctx, string defaultTopic)
		{
			EmbeddedResources.WriteEmbeddedResources(typeof(OnlineFilesLocationHint), ctx.WorkingDirectory);

			using (TemplateWriter indexWriter = new TemplateWriter(
				Path.Combine(ctx.WorkingDirectory.FullName, "index.html"),
				EmbeddedResources.GetEmbeddedResourceReader(typeof(OnlineTemplatesLocationHint), "index.html", null))) {
				indexWriter.CopyToLine("\t\t<title><%TITLE%></title>");
				indexWriter.WriteLine("\t\t<title>" + MyConfig.HtmlHelpName + "</title>");
				indexWriter.CopyToLine("\t\t<frame name=\"main\" src=\"<%HOME_PAGE%>\" frameborder=\"1\">");
				indexWriter.WriteLine("\t\t<frame name=\"main\" src=\"" + defaultTopic + "\" frameborder=\"1\">");
				indexWriter.CopyToEnd();
				indexWriter.Close();
			}

			Trace.WriteLine("transform the HHC contents file into html");
#if DEBUG
			int start = Environment.TickCount;
#endif
			//transform the HHC contents file into html
			using (StreamReader contentsFile = new StreamReader(ctx.HtmlHelpContentFilePath.FullName, ctx.CurrentFileEncoding)) {
				XPathDocument xpathDocument = new XPathDocument(contentsFile);
				string contentsFilename = Path.Combine(ctx.WorkingDirectory.FullName, "contents.html");
				using (StreamWriter streamWriter = new StreamWriter(
					File.Open(contentsFilename, FileMode.CreateNew, FileAccess.Write, FileShare.None), ctx.CurrentFileEncoding)) {
					XslTransform(ctx, "htmlcontents", xpathDocument, null, streamWriter, contentsFilename);
				}
			}
#if DEBUG
			Trace.WriteLine(string.Format("{0} msec.", (Environment.TickCount - start)));
#endif
		}

		private HtmlHelp SetupHtmlHelpBuilder(DirectoryInfo workingDirectory, string defaultTopic)
		{
			HtmlHelp htmlHelp = new HtmlHelp(
				workingDirectory,
				MyConfig.HtmlHelpName,
				defaultTopic,
				((MyConfig.OutputTarget & OutputType.HtmlHelp) == 0));
			htmlHelp.IncludeFavorites = MyConfig.IncludeFavorites;
			htmlHelp.BinaryTOC = MyConfig.BinaryTOC;
			htmlHelp.LangID = MyConfig.LangID;
			return htmlHelp;
		}

		private void GenerateHtmlContentFiles(BuildProjectContext buildContext, string rootPageFileName, string rootPageTOCName)
		{
			if (!String.IsNullOrEmpty(MyConfig.CopyrightHref)) {
				if (!MyConfig.CopyrightHref.StartsWith("http:")) {
					string copyrightFile = Path.Combine(buildContext.WorkingDirectory.FullName, Path.GetFileName(MyConfig.CopyrightHref));
					File.Copy(MyConfig.CopyrightHref, copyrightFile, true);
					File.SetAttributes(copyrightFile, FileAttributes.Archive);
					buildContext.htmlHelp.AddFileToProject(Path.GetFileName(MyConfig.CopyrightHref));
				}
			}

			// add root page if requested
			if (rootPageFileName != null) {
				if (!File.Exists(rootPageFileName)) {
					throw new DocumenterException("Cannot find the documentation's root page file:\n"
												  + rootPageFileName);
				}

				// add the file
				string rootPageOutputName = Path.Combine(buildContext.WorkingDirectory.FullName, "default.html");
				if (Path.GetFullPath(rootPageFileName) != Path.GetFullPath(rootPageOutputName)) {
					File.Copy(rootPageFileName, rootPageOutputName, true);
					File.SetAttributes(rootPageOutputName, FileAttributes.Archive);
				}
				buildContext.htmlHelp.AddFileToProject(Path.GetFileName(rootPageOutputName));
				buildContext.htmlHelp.AddFileToContents(rootPageTOCName,
										   Path.GetFileName(rootPageOutputName));

				// depending on peer setting, make root page the container
				if (MyConfig.RootPageContainsNamespaces)
					buildContext.htmlHelp.OpenBookInContents();
			}

			MakeHtmlForAssemblies(buildContext, MyConfig.MergeAssemblies);
			foreach (string filename in filesToInclude) {
				buildContext.htmlHelp.AddFileToProject(filename);
			}

			// close root book if applicable
			if (rootPageFileName != null) {
				if (MyConfig.RootPageContainsNamespaces)
					buildContext.htmlHelp.CloseBookInContents();
			}
		}

		private XmlDocument CreateNDocXml(Project project)
		{
			string tempFileName = null;
			try {
				// determine temp file name
				tempFileName = Path.GetTempFileName();
				// Let the Documenter base class do it's thing.
				MakeXmlFile(project, new FileInfo(tempFileName));

				// Load the XML documentation into DOM and XPATH doc.
				using (FileStream tempFile = File.Open(tempFileName, FileMode.Open, FileAccess.Read)) {

					XmlDocument xml = new XmlDocument();
					xml.Load(tempFile);
					return xml;
				}
			} finally {
				if (tempFileName != null && File.Exists(tempFileName)) {
#if DEBUG
					File.Copy(tempFileName, MyConfig.OutputDirectory.TrimEnd('\\', '/') + "\\ndoc.xml", true);
#endif
					File.Delete(tempFileName);
				}
			}
		}

		private void WriteHtmlContentResources(BuildProjectContext buildContext)
		{
			EmbeddedResources.WriteEmbeddedResources(
				GetType().Module.Assembly,
				GetType().Namespace + ".css",
				buildContext.WorkingDirectory);

			// Write the embedded icons to the html output directory
			EmbeddedResources.WriteEmbeddedResources(
				GetType().Module.Assembly,
				GetType().Namespace + ".images",
				buildContext.WorkingDirectory);

			// Write the embedded scripts to the html output directory
			EmbeddedResources.WriteEmbeddedResources(
				GetType().Module.Assembly,
				GetType().Namespace + ".scripts",
				buildContext.WorkingDirectory);

			if (((string)MyConfig.AdditionalContentResourceDirectory).Length > 0)
				buildContext.CopyToWorkingDirectory(new DirectoryInfo(MyConfig.AdditionalContentResourceDirectory));

			// Write the external files (FilesToInclude) to the html output directory

			foreach (string srcFilePattern in MyConfig.FilesToInclude.Split('|')) {
				if (string.IsNullOrEmpty(srcFilePattern))
					continue;

				string path = Path.GetDirectoryName(srcFilePattern);
				string pattern = Path.GetFileName(srcFilePattern);

				// Path.GetDirectoryName can return null in some cases.
				// Treat this as an empty string.
				if (path == null)
					path = string.Empty;

				// Make sure we have a fully-qualified path name
				if (!Path.IsPathRooted(path))
					path = Path.Combine(Environment.CurrentDirectory, path);

				// Directory.GetFiles does not accept null or empty string
				// for the searchPattern parameter. When no pattern was
				// specified, assume all files (*) are wanted.
				if (string.IsNullOrEmpty(pattern))
					pattern = "*";

				foreach (string srcFile in Directory.GetFiles(path, pattern)) {
					string dstFile = Path.Combine(buildContext.WorkingDirectory.FullName, Path.GetFileName(srcFile));
					File.Copy(srcFile, dstFile, true);
					File.SetAttributes(dstFile, FileAttributes.Archive);
					filesToInclude.Add(dstFile);
				}
			}
		}

		private static void XslTransform(BuildProjectContext buildContext, string stylesheetName, IXPathNavigable xpathNavigable, XsltArgumentList arguments, TextWriter writer, string targetFilename)
		{
			StyleSheet stylesheet = buildContext.stylesheets[stylesheetName];
			try {
				stylesheet.Transform(xpathNavigable, arguments, writer);
			} catch (XsltException ex) {
				throw new DocumenterException(string.Format("XSLT error while writing file {0} using stylesheet {1}({2}:{3}) : {4}", targetFilename, stylesheetName, ex.LineNumber, ex.LinePosition, ex.Message));
			}
		}

		private MsdnDocumenterConfig MyConfig
		{
			get
			{
				return (MsdnDocumenterConfig)Config;
			}
		}

		private static WhichType GetWhichType(XmlNode typeNode)
		{
			WhichType whichType;

			switch (typeNode.Name) {
				case "class":
					whichType = WhichType.Class;
					break;
				case "interface":
					whichType = WhichType.Interface;
					break;
				case "structure":
					whichType = WhichType.Structure;
					break;
				case "enumeration":
					whichType = WhichType.Enumeration;
					break;
				case "delegate":
					whichType = WhichType.Delegate;
					break;
				default:
					whichType = WhichType.Unknown;
					break;
			}

			return whichType;
		}

		private void MakeHtmlForAssemblies(BuildProjectContext ctx, bool mergeAssemblies)
		{
#if DEBUG
			int start = Environment.TickCount;
#endif

			MakeHtmlForAssembliesSorted(ctx, mergeAssemblies);

#if DEBUG
			Trace.WriteLine("Making Html: " + ((Environment.TickCount - start) / 1000.0) + " sec.");
#endif
		}

		private void MakeHtmlForAssembliesSorted(BuildProjectContext ctx, bool mergeAssemblies)
		{
			const string defaultNamespace = null;

			XmlNodeList assemblyNodes = ctx.SelectNodes("/ndoc:ndoc/ndoc:assembly");

			List<string> assemblyNames = new List<string>();
			foreach(XmlNode node in assemblyNodes) assemblyNames.Add(GetNodeName(node));
			assemblyNames.Sort();

			if (mergeAssemblies)
            {
                // sort namespaces alphabetically except for defaultNamespace, which is always first
				string[] namespaces = SortNamespaces(ctx, assemblyNames, defaultNamespace);
				MakeHtmlForNamespaces(ctx, null, namespaces);                
            }
            else
            {
                foreach (string currentAssemblyName in assemblyNames)
                {
                    MakeHtmlForAssembly(ctx, currentAssemblyName);

					ctx.htmlHelp.OpenBookInContents();
                    string[] namespaces = SortNamespaces(ctx, new List<string>( new[] { currentAssemblyName }) , defaultNamespace);
					MakeHtmlForNamespaces(ctx, currentAssemblyName, namespaces);
					ctx.htmlHelp.CloseBookInContents();
                }
            }
        }

		private void MakeHtmlForAssembly(BuildProjectContext ctx, string assemblyName)
		{
			BuildAssemblyContext actx = new BuildAssemblyContext(ctx, assemblyName);
			string fileName = ctx._nameResolver.GetFilenameForAssembly(assemblyName);

			XsltArgumentList arguments = new XsltArgumentList();
			arguments.AddParam("assembly-name", String.Empty, assemblyName);
			TransformAndWriteResult(actx, "assembly", arguments, fileName);

			ctx.htmlHelp.AddFileToContents(assemblyName + " Assembly", fileName, HtmlHelpIcon.Page);
		}

		private void MakeHtmlForNamespaces(BuildProjectContext ctx, string currentAssembly, IList<string> namespaces)
		{
			int nNodes = namespaces.Count;

			bool heirTOC = (MyConfig.NamespaceTOCStyle == TOCStyle.Hierarchical);
			int level = 0;

			string[] last = new string[0];

			BuildAssemblyContext generatorContext = null;
			for (int i = 0; i < nNodes; i++) {
				OnDocBuildingProgress(i * 100 / nNodes); // TODO (EE): fix calc for !MergeAssemblies mode

				string currentNamespace = namespaces[i];
				// determine assembly containing this namespace
				XmlNodeList namespaceNodes = (currentAssembly==null) 
					? ctx.SelectNodes(string.Format("/ndoc:ndoc/ndoc:assembly/ndoc:module/ndoc:namespace[@name='{0}']", currentNamespace))
					: ctx.SelectNodes(string.Format("/ndoc:ndoc/ndoc:assembly[@name='{0}']/ndoc:module/ndoc:namespace[@name='{1}']", currentAssembly, currentNamespace));

				string assemblyName = GetNodeName(ctx.SelectSingleNode(namespaceNodes[0], "ancestor::ndoc:assembly"));
				generatorContext = new BuildAssemblyContext(ctx, assemblyName);

				if (heirTOC) {
					string[] split = currentNamespace.Split('.');

					for (level = last.Length; level >= 0 &&
						ArrayEquals(split, 0, last, 0, level) == false; level--) {
						if (level > last.Length)
							continue;

						string namespaceName = string.Join(".", last, 0, level);
						XmlNodeList typeNodes = GetTypeNodes(ctx, currentAssembly, namespaceName);
						MakeHtmlForTypes(generatorContext, typeNodes);
						ctx.htmlHelp.CloseBookInContents();
					}

					if (level < 0)
						level = 0;

					for (; level < split.Length; level++) {
						string namespaceName = string.Join(".", split, 0, level + 1);

						if (!namespaces.Contains(namespaceName))
//						if (Array.BinarySearch(namespaces, namespaceName) < 0)
							MakeHtmlForNamespace(generatorContext, split[level], namespaceName, false);
						else
							MakeHtmlForNamespace(generatorContext, split[level], namespaceName, true);

						ctx.htmlHelp.OpenBookInContents();
					}

					last = split;
				} else {
					MakeHtmlForNamespace(generatorContext, currentNamespace, currentNamespace, true);
					using (ctx.htmlHelp.OpenBookInContents()) {
						XmlNodeList typeNodes = GetTypeNodes(ctx, currentAssembly, currentNamespace);
						MakeHtmlForTypes(generatorContext, typeNodes);
					}
				}
			}


			if (heirTOC && last.Length > 0) {
				for (; level >= 1; level--) {
					string ns = string.Join(".", last, 0, level);
					XmlNodeList typeNodes = GetTypeNodes(ctx, currentAssembly, ns);
					MakeHtmlForTypes(generatorContext, typeNodes);
					ctx.htmlHelp.CloseBookInContents();
				}
			}

			OnDocBuildingProgress(100);
		}

		private static XmlNodeList GetTypeNodes(BuildProjectContext ctx, string assembly, string namespaceName)
		{
			string xpath = (assembly == null)
			               	? string.Format(
			               	  	"/ndoc:ndoc/ndoc:assembly/ndoc:module/ndoc:namespace[@name='{0}']/*[local-name()!='documentation' and local-name()!='typeHierarchy']",
			               	  	namespaceName)
			               	: string.Format(
			               	  	"/ndoc:ndoc/ndoc:assembly[@name='{0}']/ndoc:module/ndoc:namespace[@name='{1}']/*[local-name()!='documentation' and local-name()!='typeHierarchy']",
								assembly,
			               	  	namespaceName);
			XmlNodeList typeNodes = ctx.SelectNodes(xpath);
			return typeNodes;			
		}

		private static bool ArrayEquals(string[] array1, int from1, string[] array2, int from2, int count)
		{
			for (int i = 0; i < count; i++) {
				if (array1[from1 + i] != array2[from2 + i])
					return false;
			}

			return true;
		}

		private static void GetNamespacesFromAssembly(BuildProjectContext buildContext, string assemblyName, NameValueCollection namespaceAssemblies)
		{
			XmlNodeList namespaceNodes = buildContext.SelectNodes(string.Format("/ndoc:ndoc/ndoc:assembly[@name='{0}']/ndoc:module/ndoc:namespace", assemblyName));
			foreach (XmlNode namespaceNode in namespaceNodes) {
				string namespaceName = GetNodeName(namespaceNode);
				namespaceAssemblies.Add(namespaceName, assemblyName);
			}
		}

		/// <summary>
		/// Add the namespace elements to the output
		/// </summary>
		/// <remarks>
		/// The namespace 
		/// </remarks>
		/// <param name="ctx"></param>
		/// <param name="namespacePart">If nested, the namespace part will be the current
		/// namespace element being documented</param>
		/// <param name="namespaceName">The full namespace name being documented</param>
		/// <param name="addDocumentation">If true, the namespace will be documented, if false
		/// the node in the TOC will not link to a page</param>
		private void MakeHtmlForNamespace(BuildAssemblyContext ctx, string namespacePart, string namespaceName,
			bool addDocumentation)
		{
			//			// handle duplicate namespace documentation
			//			if (ctx.documentedNamespaces.Contains(namespaceName)) 
			//				return;
			//			ctx.documentedNamespaces.Add(namespaceName);

			if (addDocumentation) {
				string currentAssemblyName = (ctx.MergeAssemblies) ? string.Empty : ctx.CurrentAssemblyName;

				string namespaceFilename = ctx._nameResolver.GetFilenameForNamespace(currentAssemblyName, namespaceName);

				ctx.htmlHelp.AddFileToContents(namespacePart, namespaceFilename);

				XsltArgumentList arguments = new XsltArgumentList();
				arguments.AddParam("merge-assemblies", String.Empty, ctx.MergeAssemblies);
				arguments.AddParam("namespace", String.Empty, namespaceName);
				TransformAndWriteResult(ctx, "namespace", arguments, namespaceFilename);

				string namespaceHierarchyFilename = ctx._nameResolver.GetFilenameForNamespaceHierarchy(currentAssemblyName, namespaceName);
				arguments = new XsltArgumentList();
				arguments.AddParam("merge-assemblies", String.Empty, ctx.MergeAssemblies);
				arguments.AddParam("namespace", String.Empty, namespaceName);
				TransformAndWriteResult(ctx, "namespacehierarchy", arguments, namespaceHierarchyFilename);
			} else {
				ctx.htmlHelp.AddFileToContents(namespacePart);
			}
		}

		private void MakeHtmlForTypes(BuildProjectContext projectCtx, XmlNodeList typeNodes)
		{
			int[] indexes = SortNodesByAttribute(typeNodes, "id");
			int nNodes = typeNodes.Count;

			for (int i = 0; i < nNodes; i++) {
				XmlNode typeNode = typeNodes[indexes[i]];
				WhichType whichType = GetWhichType(typeNode);

				string assemblyName = XmlUtils.GetNodeName(projectCtx.SelectSingleNode(typeNode, "ancestor::ndoc:assembly"));
				BuildAssemblyContext ctx = new BuildAssemblyContext(projectCtx, assemblyName); // TODO (EE): initialize w/ assembly name

				switch (whichType) {
					case WhichType.Class:
						MakeHtmlForInterfaceOrClassOrStructure(ctx, whichType, typeNode);
						break;
					case WhichType.Interface:
						MakeHtmlForInterfaceOrClassOrStructure(ctx, whichType, typeNode);
						break;
					case WhichType.Structure:
						MakeHtmlForInterfaceOrClassOrStructure(ctx, whichType, typeNode);
						break;
					case WhichType.Enumeration:
						MakeHtmlForEnumerationOrDelegate(ctx, whichType, typeNode);
						break;
					case WhichType.Delegate:
						MakeHtmlForEnumerationOrDelegate(ctx, whichType, typeNode);
						break;
					default:
						break;
				}
			}
		}

		private void MakeHtmlForEnumerationOrDelegate(BuildAssemblyContext ctx, WhichType whichType, XmlNode typeNode)
		{
			string typeName = whichType == WhichType.Delegate ? GetNodeDisplayName(typeNode) : GetNodeName(typeNode);
			string typeID = GetNodeId(typeNode);
			string fileName = ctx._nameResolver.GetFilenameForId(ctx.CurrentAssemblyName, typeID);

			ctx.htmlHelp.AddFileToContents(typeName + " " + mixedCaseTypeNames[whichType], fileName, HtmlHelpIcon.Page);

			XsltArgumentList arguments = new XsltArgumentList();
			arguments.AddParam("type-id", String.Empty, typeID);
			TransformAndWriteResult(ctx, "type", arguments, fileName);
		}

		private void MakeHtmlForInterfaceOrClassOrStructure(BuildAssemblyContext ctx,
			WhichType whichType,
			XmlNode typeNode)
		{
			string typeName = GetNodeDisplayName(typeNode);
			string typeID = GetNodeId(typeNode);
			string fileName = ctx._nameResolver.GetFilenameForId(ctx.CurrentAssemblyName, typeID);

			ctx.htmlHelp.AddFileToContents(typeName + " " + mixedCaseTypeNames[whichType], fileName);

			bool hasMembers = ctx.SelectNodes(typeNode, "ndoc:constructor|ndoc:field|ndoc:property|ndoc:method|ndoc:operator|ndoc:event").Count > 0;

			if (hasMembers) {
				ctx.htmlHelp.OpenBookInContents();
			}

			XsltArgumentList arguments = new XsltArgumentList();
			arguments.AddParam("type-id", String.Empty, typeID);
			TransformAndWriteResult(ctx, "type", arguments, fileName);

			if (ctx.SelectNodes(typeNode, "ndoc:derivedBy").Count > 5) {
				fileName = ctx._nameResolver.GetFilenameForTypeHierarchy(ctx.CurrentAssemblyName, typeID);
				arguments = new XsltArgumentList();
				arguments.AddParam("type-id", String.Empty, typeID);
				TransformAndWriteResult(ctx, "typehierarchy", arguments, fileName);
			}

			if (hasMembers) {
				fileName = ctx._nameResolver.GetFilenameForTypeMemberList(ctx.CurrentAssemblyName, typeID);
				ctx.htmlHelp.AddFileToContents(typeName + " Members",
					fileName,
					HtmlHelpIcon.Page);

				arguments = new XsltArgumentList();
				arguments.AddParam("type-id", String.Empty, typeID);
				TransformAndWriteResult(ctx, "allmembers", arguments, fileName);

				MakeHtmlForConstructors(ctx, typeNode);
				MakeHtmlForFields(ctx, typeNode);
				MakeHtmlForProperties(ctx, typeNode);
				MakeHtmlForMethods(ctx, typeNode);
				MakeHtmlForOperators(ctx, typeNode);
				MakeHtmlForEvents(ctx, typeNode);

				ctx.htmlHelp.CloseBookInContents();
			}
		}

		private void MakeHtmlForConstructors(BuildAssemblyContext ctx, XmlNode typeNode)
		{
			string constructorID;
			string fileName;

			string typeName = GetNodeDisplayName(typeNode);
			string typeID = GetNodeId(typeNode);

			XmlNodeList constructorNodes = ctx.SelectNodes(typeNode, "ndoc:constructor[@contract!='Static']");
			// If the constructor is overloaded then make an overload page.
			if (constructorNodes.Count > 1) {
				fileName = ctx._nameResolver.GetFilenameForConstructorList(ctx.CurrentAssemblyName, typeID);
				ctx.htmlHelp.AddFileToContents(typeName + " Constructor", fileName);

				ctx.htmlHelp.OpenBookInContents();

				constructorID = constructorNodes[0].Attributes["id"].Value;

				XsltArgumentList arguments = new XsltArgumentList();
				arguments.AddParam("member-id", String.Empty, constructorID);
				TransformAndWriteResult(ctx, "memberoverload", arguments, fileName);
			}

			foreach (XmlNode constructorNode in constructorNodes) {
				constructorID = constructorNode.Attributes["id"].Value;
				fileName = ctx._nameResolver.GetFilenameForId(ctx.CurrentAssemblyName, constructorID);

				if (constructorNodes.Count > 1) {
					XmlNodeList parameterNodes = ctx.SelectNodes(constructorNode, "ndoc:parameter");
					ctx.htmlHelp.AddFileToContents(typeName + " Constructor " + GetParamList(parameterNodes), fileName,
						HtmlHelpIcon.Page);
				} else {
					ctx.htmlHelp.AddFileToContents(typeName + " Constructor", fileName, HtmlHelpIcon.Page);
				}

				XsltArgumentList arguments = new XsltArgumentList();
				arguments.AddParam("member-id", String.Empty, constructorID);
				TransformAndWriteResult(ctx, "member", arguments, fileName);
			}

			if (constructorNodes.Count > 1) {
				ctx.htmlHelp.CloseBookInContents();
			}

			XmlNode staticConstructorNode = ctx.SelectSingleNode(typeNode, "ndoc:constructor[@contract='Static']");
			if (staticConstructorNode != null) {
				constructorID = staticConstructorNode.Attributes["id"].Value;
				fileName = ctx._nameResolver.GetFilenameForId(ctx.CurrentAssemblyName, constructorID);

				ctx.htmlHelp.AddFileToContents(typeName + " Static Constructor", fileName, HtmlHelpIcon.Page);

				XsltArgumentList arguments = new XsltArgumentList();
				arguments.AddParam("member-id", String.Empty, constructorID);
				TransformAndWriteResult(ctx, "member", arguments, fileName);
			}
		}

		private void MakeHtmlForFields(BuildAssemblyContext ctx, XmlNode typeNode)
		{
			XmlNodeList fields = ctx.SelectNodes(typeNode, "ndoc:field[not(@declaringType)]");

			if (fields.Count > 0) {
				//string typeName = typeNode.Attributes["name"].Value;
				string typeID = GetNodeId(typeNode);
				string fileName = ctx._nameResolver.GetFilenameForFieldList(ctx.CurrentAssemblyName, typeID);

				ctx.htmlHelp.AddFileToContents("Fields", fileName);

				XsltArgumentList arguments = new XsltArgumentList();
				arguments.AddParam("type-id", String.Empty, typeID);
				arguments.AddParam("member-type", String.Empty, "field");
				TransformAndWriteResult(ctx, "individualmembers", arguments, fileName);

				ctx.htmlHelp.OpenBookInContents();

				int[] indexes = SortNodesByAttribute(fields, "id");

				foreach (int index in indexes) {
					XmlNode field = fields[index];

					string fieldName = GetNodeName(field);
					string fieldID = GetNodeId(field);
					fileName = ctx._nameResolver.GetFilenameForId(ctx.CurrentAssemblyName, fieldID);
					ctx.htmlHelp.AddFileToContents(fieldName + " Field", fileName, HtmlHelpIcon.Page);

					arguments = new XsltArgumentList();
					arguments.AddParam("field-id", String.Empty, fieldID);
					TransformAndWriteResult(ctx, "field", arguments, fileName);
				}

				ctx.htmlHelp.CloseBookInContents();
			}
		}

		private void MakeHtmlForProperties(BuildAssemblyContext ctx, XmlNode typeNode)
		{
			XmlNodeList declaredPropertyNodes = ctx.SelectNodes(typeNode, "ndoc:property[not(@declaringType)]");

			if (declaredPropertyNodes.Count > 0) {
				XmlNode propertyNode;
				bool bOverloaded = false;
				int i;

				string typeID = GetNodeId(typeNode);
				XmlNodeList propertyNodes = ctx.SelectNodes(typeNode, "ndoc:property[not(@declaringType)]");
				int nNodes = propertyNodes.Count;

				int[] indexes = SortNodesByAttribute(propertyNodes, "id");

				string fileName = ctx._nameResolver.GetFilenameForPropertyList(ctx.CurrentAssemblyName, typeID);
				ctx.htmlHelp.AddFileToContents("Properties", fileName);

				XsltArgumentList arguments = new XsltArgumentList();
				arguments.AddParam("type-id", String.Empty, typeID);
				arguments.AddParam("member-type", String.Empty, "property");
				TransformAndWriteResult(ctx, "individualmembers", arguments, fileName);

				ctx.htmlHelp.OpenBookInContents();

				for (i = 0; i < nNodes; i++) {
					propertyNode = propertyNodes[indexes[i]];

					string propertyName = propertyNode.Attributes["name"].Value;
					string propertyID = propertyNode.Attributes["id"].Value;

					// If the method is overloaded then make an overload page.
					string previousPropertyName = ((i - 1 < 0) || (propertyNodes[indexes[i - 1]].Attributes.Count == 0))
													? "" : propertyNodes[indexes[i - 1]].Attributes[0].Value;
					string nextPropertyName = ((i + 1 == nNodes) || (propertyNodes[indexes[i + 1]].Attributes.Count == 0))
												? "" : propertyNodes[indexes[i + 1]].Attributes[0].Value;

					if ((previousPropertyName != propertyName) && (nextPropertyName == propertyName)) {
						fileName = ctx._nameResolver.GetFilenameForPropertyOverloads(ctx.CurrentAssemblyName, typeID, propertyName);
						ctx.htmlHelp.AddFileToContents(propertyName + " Property", fileName);

						arguments = new XsltArgumentList();
						arguments.AddParam("member-id", String.Empty, propertyID);
						TransformAndWriteResult(ctx, "memberoverload", arguments, fileName);

						ctx.htmlHelp.OpenBookInContents();

						bOverloaded = true;
					}

					fileName = ctx._nameResolver.GetFilenameForId(ctx.CurrentAssemblyName, propertyID);

					string pageTitle;
					if (!bOverloaded) {
						pageTitle = string.Format("{0} Property", propertyName);
					} else {
						XmlNodeList parameterNodes = ctx.SelectNodes(propertyNode, "ns:parameter");
						pageTitle = string.Format("{0} Property {1}", propertyName, GetParamList(parameterNodes));
					}
					ctx.htmlHelp.AddFileToContents(pageTitle, fileName, HtmlHelpIcon.Page);

					XsltArgumentList arguments2 = new XsltArgumentList();
					arguments2.AddParam("property-id", String.Empty, propertyID);
					TransformAndWriteResult(ctx, "property", arguments2, fileName);

					if ((previousPropertyName == propertyName) && (nextPropertyName != propertyName)) {
						ctx.htmlHelp.CloseBookInContents();
						bOverloaded = false;
					}
				}

				ctx.htmlHelp.CloseBookInContents();
			}
		}

		private static string GetPreviousMethodName(XmlNodeList methodNodes, int[] indexes, int index)
		{
			while (--index >= 0) {
				if (methodNodes[indexes[index]].Attributes["declaringType"] == null)
					return methodNodes[indexes[index]].Attributes["name"].Value;
			}
			return null;
		}

		private static string GetNextMethodName(XmlNodeList methodNodes, int[] indexes, int index)
		{
			while (++index < methodNodes.Count) {
				if (methodNodes[indexes[index]].Attributes["declaringType"] == null)
					return methodNodes[indexes[index]].Attributes["name"].Value;
			}
			return null;
		}

		// returns true, if method is neither overload of a method in the same class,
		// nor overload of a method in the base class.
		private static bool IsMethodAlone(XmlNodeList methodNodes, int[] indexes, int index)
		{
			string name = methodNodes[indexes[index]].Attributes["name"].Value;
			int lastIndex = methodNodes.Count - 1;
			if (lastIndex <= 0)
				return true;
			bool previousNameDifferent = (index == 0)
				|| (methodNodes[indexes[index - 1]].Attributes["name"].Value != name);
			bool nextNameDifferent = (index == lastIndex)
				|| (methodNodes[indexes[index + 1]].Attributes["name"].Value != name);
			return (previousNameDifferent && nextNameDifferent);
		}

		private static bool IsMethodFirstOverload(XmlNodeList methodNodes, int[] indexes, int index)
		{
			if ((methodNodes[indexes[index]].Attributes["declaringType"] != null)
				|| IsMethodAlone(methodNodes, indexes, index))
				return false;

			string name = methodNodes[indexes[index]].Attributes["name"].Value;
			string previousName = GetPreviousMethodName(methodNodes, indexes, index);
			return previousName != name;
		}

		private static bool IsMethodLastOverload(XmlNodeList methodNodes, int[] indexes, int index)
		{
			if ((methodNodes[indexes[index]].Attributes["declaringType"] != null)
				|| IsMethodAlone(methodNodes, indexes, index))
				return false;

			string name = methodNodes[indexes[index]].Attributes["name"].Value;
			string nextName = GetNextMethodName(methodNodes, indexes, index);
			return nextName != name;
		}

		private void MakeHtmlForMethods(BuildAssemblyContext ctx, XmlNode typeNode)
		{
			XmlNodeList declaredMethodNodes = ctx.SelectNodes(typeNode, "ndoc:method[not(@declaringType)]");

			if (declaredMethodNodes.Count > 0) {
				bool bOverloaded = false;

				string typeID = GetNodeId(typeNode);
				XmlNodeList methodNodes = ctx.SelectNodes(typeNode, "ndoc:method");
				int nNodes = methodNodes.Count;

				int[] indexes = SortNodesByAttribute(methodNodes, "id");

				string fileName = ctx._nameResolver.GetFilenameForMethodList(ctx.CurrentAssemblyName, typeID);
				ctx.htmlHelp.AddFileToContents("Methods", fileName);

				XsltArgumentList arguments = new XsltArgumentList();
				arguments.AddParam("type-id", String.Empty, typeID);
				arguments.AddParam("member-type", String.Empty, "method");
				TransformAndWriteResult(ctx, "individualmembers", arguments, fileName);

				ctx.htmlHelp.OpenBookInContents();

				for (int i = 0; i < nNodes; i++) {
					XmlNode methodNode = methodNodes[indexes[i]];
					string methodDisplayName = GetNodeDisplayName(methodNode);
					string methodName = GetNodeName(methodNode);
					string methodID = GetNodeId(methodNode);

					if (IsMethodFirstOverload(methodNodes, indexes, i)) {
						bOverloaded = true;

						fileName = ctx._nameResolver.GetFilenameForMethodOverloads(ctx.CurrentAssemblyName, typeID, methodName);
						ctx.htmlHelp.AddFileToContents(methodDisplayName + " Method", fileName);

						arguments = new XsltArgumentList();
						arguments.AddParam("member-id", String.Empty, methodID);
						TransformAndWriteResult(ctx, "memberoverload", arguments, fileName);

						ctx.htmlHelp.OpenBookInContents();
					}

					if (XmlUtils.GetAttributeString(methodNode, "declaringType", false) == null) {
						fileName = ctx._nameResolver.GetFilenameForId(ctx.CurrentAssemblyName, methodID);

						string pageTitle;
						if (bOverloaded) {
							XmlNodeList parameterNodes = ctx.SelectNodes(methodNode, "ndoc:parameter");
							pageTitle = methodDisplayName + GetParamList(parameterNodes) + " Method ";
						} else {
							pageTitle = methodDisplayName + " Method";
						}
						ctx.htmlHelp.AddFileToContents(pageTitle, fileName,
							HtmlHelpIcon.Page);

						XsltArgumentList arguments2 = new XsltArgumentList();
						arguments2.AddParam("member-id", String.Empty, methodID);
						TransformAndWriteResult(ctx, "member", arguments2, fileName);
					}

					if (bOverloaded && IsMethodLastOverload(methodNodes, indexes, i)) {
						bOverloaded = false;
						ctx.htmlHelp.CloseBookInContents();
					}
				}

				ctx.htmlHelp.CloseBookInContents();
			}
		}

		private void MakeHtmlForOperators(BuildAssemblyContext ctx, XmlNode typeNode)
		{
			XmlNodeList opNodes = ctx.SelectNodes(typeNode, "ndoc:operator");

			if (opNodes.Count == 0)
				return;

			string typeID = GetNodeId(typeNode);
			string fileName = ctx._nameResolver.GetFilenameForOperatorList(ctx.CurrentAssemblyName, typeID);
			bool bOverloaded = false;

			bool bHasOperators =
				(ctx.SelectSingleNode(typeNode, "ndoc:operator[@name != 'op_Explicit' and @name != 'op_Implicit']") != null);
			bool bHasConverters =
				(ctx.SelectSingleNode(typeNode, "ndoc:operator[@name  = 'op_Explicit' or  @name  = 'op_Implicit']") != null);
			string pageTitle = "";

			if (bHasOperators) {
				pageTitle = bHasConverters ? "Operators and Type Conversions" : "Operators";
			} else {
				if (bHasConverters) {
					pageTitle = "Type Conversions";
				}
			}

			ctx.htmlHelp.AddFileToContents(pageTitle, fileName);

			XsltArgumentList arguments = new XsltArgumentList();
			arguments.AddParam("type-id", String.Empty, typeID);
			arguments.AddParam("member-type", String.Empty, "operator");
			TransformAndWriteResult(ctx, "individualmembers", arguments, fileName);

			ctx.htmlHelp.OpenBookInContents();

			int[] indexes = SortNodesByAttribute(opNodes, "id");
			int nNodes = opNodes.Count;

			//operators first
			for (int i = 0; i < nNodes; i++) {
				XmlNode operatorNode = opNodes[indexes[i]];

				string operatorID = GetNodeId(operatorNode);
				string opName = GetNodeName(operatorNode);
				if ((opName != "op_Implicit") && (opName != "op_Explicit")) {
					if (IsMethodFirstOverload(opNodes, indexes, i)) {
						bOverloaded = true;

						fileName = ctx._nameResolver.GetFilenameForOperatorOverloads(ctx.CurrentAssemblyName, typeID, opName);
						ctx.htmlHelp.AddFileToContents(GetOperatorDisplayName(ctx, operatorNode), fileName);

						arguments = new XsltArgumentList();
						arguments.AddParam("member-id", String.Empty, operatorID);
						TransformAndWriteResult(ctx, "memberoverload", arguments, fileName);

						ctx.htmlHelp.OpenBookInContents();
					}


					fileName = ctx._nameResolver.GetFilenameForId(ctx.CurrentAssemblyName, operatorID);
					string opPageTitle;
					if (bOverloaded) {
						XmlNodeList parameterNodes = ctx.SelectNodes(operatorNode, "ns:parameter");
						opPageTitle = GetOperatorDisplayName(ctx, operatorNode) + GetParamList(parameterNodes);
					} else {
						opPageTitle = GetOperatorDisplayName(ctx, operatorNode);
					}
					ctx.htmlHelp.AddFileToContents(opPageTitle, fileName,
												   HtmlHelpIcon.Page);

					arguments = new XsltArgumentList();
					arguments.AddParam("member-id", String.Empty, operatorID);
					TransformAndWriteResult(ctx, "member", arguments, fileName);

					if (bOverloaded && IsMethodLastOverload(opNodes, indexes, i)) {
						bOverloaded = false;
						ctx.htmlHelp.CloseBookInContents();
					}
				}
			}

			//type converters
			for (int i = 0; i < nNodes; i++) {
				XmlNode operatorNode = opNodes[indexes[i]];
				string operatorID = GetNodeId(operatorNode);
				string opName = GetNodeName(operatorNode);

				if ((opName == "op_Implicit") || (opName == "op_Explicit")) {
					fileName = ctx._nameResolver.GetFilenameForId(ctx.CurrentAssemblyName, operatorID);
					ctx.htmlHelp.AddFileToContents(GetOperatorDisplayName(ctx, operatorNode), fileName,
												   HtmlHelpIcon.Page);

					arguments = new XsltArgumentList();
					arguments.AddParam("member-id", String.Empty, operatorID);
					TransformAndWriteResult(ctx, "member", arguments, fileName);
				}
			}

			ctx.htmlHelp.CloseBookInContents();
		}

		private static string GetOperatorDisplayName(BuildProjectContext ctx, XmlNode operatorNode)
		{
			string name = GetNodeName(operatorNode);

			switch (name) {
				case "op_Decrement":
					return "Decrement Operator";
				case "op_Increment":
					return "Increment Operator";
				case "op_UnaryNegation":
					return "Unary Negation Operator";
				case "op_UnaryPlus":
					return "Unary Plus Operator";
				case "op_LogicalNot":
					return "Logical Not Operator";
				case "op_True":
					return "True Operator";
				case "op_False":
					return "False Operator";
				case "op_AddressOf":
					return "Address Of Operator";
				case "op_OnesComplement":
					return "Ones Complement Operator";
				case "op_PointerDereference":
					return "Pointer Dereference Operator";
				case "op_Addition":
					return "Addition Operator";
				case "op_Subtraction":
					return "Subtraction Operator";
				case "op_Multiply":
					return "Multiplication Operator";
				case "op_Division":
					return "Division Operator";
				case "op_Modulus":
					return "Modulus Operator";
				case "op_ExclusiveOr":
					return "Exclusive Or Operator";
				case "op_BitwiseAnd":
					return "Bitwise And Operator";
				case "op_BitwiseOr":
					return "Bitwise Or Operator";
				case "op_LogicalAnd":
					return "LogicalAnd Operator";
				case "op_LogicalOr":
					return "Logical Or Operator";
				case "op_Assign":
					return "Assignment Operator";
				case "op_LeftShift":
					return "Left Shift Operator";
				case "op_RightShift":
					return "Right Shift Operator";
				case "op_SignedRightShift":
					return "Signed Right Shift Operator";
				case "op_UnsignedRightShift":
					return "Unsigned Right Shift Operator";
				case "op_Equality":
					return "Equality Operator";
				case "op_GreaterThan":
					return "Greater Than Operator";
				case "op_LessThan":
					return "Less Than Operator";
				case "op_Inequality":
					return "Inequality Operator";
				case "op_GreaterThanOrEqual":
					return "Greater Than Or Equal Operator";
				case "op_LessThanOrEqual":
					return "Less Than Or Equal Operator";
				case "op_UnsignedRightShiftAssignment":
					return "Unsigned Right Shift Assignment Operator";
				case "op_MemberSelection":
					return "Member Selection Operator";
				case "op_RightShiftAssignment":
					return "Right Shift Assignment Operator";
				case "op_MultiplicationAssignment":
					return "Multiplication Assignment Operator";
				case "op_PointerToMemberSelection":
					return "Pointer To Member Selection Operator";
				case "op_SubtractionAssignment":
					return "Subtraction Assignment Operator";
				case "op_ExclusiveOrAssignment":
					return "Exclusive Or Assignment Operator";
				case "op_LeftShiftAssignment":
					return "Left Shift Assignment Operator";
				case "op_ModulusAssignment":
					return "Modulus Assignment Operator";
				case "op_AdditionAssignment":
					return "Addition Assignment Operator";
				case "op_BitwiseAndAssignment":
					return "Bitwise And Assignment Operator";
				case "op_BitwiseOrAssignment":
					return "Bitwise Or Assignment Operator";
				case "op_Comma":
					return "Comma Operator";
				case "op_DivisionAssignment":
					return "Division Assignment Operator";
				case "op_Explicit": {
						XmlNode parameterNode = ctx.SelectSingleNode(operatorNode, "ndoc:parameter");
						string from = GetNodeTypeId(parameterNode);
						string to = GetNodeTypeId(ctx.SelectSingleNode(operatorNode, "ndoc:returnType"));
						return "Explicit " + StripNamespace(from) + " to " + StripNamespace(to) + " Conversion";
					}
				case "op_Implicit": {
						XmlNode parameterNode = ctx.SelectSingleNode(operatorNode, "ndoc:parameter");
						string from = GetNodeTypeId(parameterNode);
						string to = GetNodeTypeId(ctx.SelectSingleNode(operatorNode, "ndoc:returnType"));
						return "Implicit " + StripNamespace(from) + " to " + StripNamespace(to) + " Conversion";
					}
				default:
					return "ERROR";
			}
		}

		private void MakeHtmlForEvents(BuildAssemblyContext ctx, XmlNode typeNode)
		{
			XmlNodeList declaredEventNodes = ctx.SelectNodes(typeNode, "ndoc:event[not(@declaringType)]");

			if (declaredEventNodes.Count > 0) {
				XmlNodeList events = ctx.SelectNodes(typeNode, "ns:event");

				if (events.Count > 0) {
					//string typeName = (string)typeNode.Attributes["name"].Value;
					string typeID = GetNodeId(typeNode);
					string fileName = ctx._nameResolver.GetFilenameForEventList(ctx.CurrentAssemblyName, typeID);

					ctx.htmlHelp.AddFileToContents("Events", fileName);

					XsltArgumentList arguments = new XsltArgumentList();
					arguments.AddParam("type-id", String.Empty, typeID);
					arguments.AddParam("member-type", String.Empty, "event");
					TransformAndWriteResult(ctx, "individualmembers", arguments, fileName);

					ctx.htmlHelp.OpenBookInContents();

					int[] indexes = SortNodesByAttribute(events, "id");

					foreach (int index in indexes) {
						XmlNode eventElement = events[index];

						if (XmlUtils.GetAttributeString(eventElement, "declaringType", false) == null) {
							string eventName = GetNodeName(eventElement);
							string eventID = GetNodeId(eventElement);

							fileName = ctx._nameResolver.GetFilenameForId(ctx.CurrentAssemblyName, eventID);
							ctx.htmlHelp.AddFileToContents(eventName + " Event",
								fileName,
								HtmlHelpIcon.Page);

							arguments = new XsltArgumentList();
							arguments.AddParam("event-id", String.Empty, eventID);
							TransformAndWriteResult(ctx, "event", arguments, fileName);
						}
					}

					ctx.htmlHelp.CloseBookInContents();
				}
			}
		}

		private static string GetParamList(XmlNodeList parameterNodes)
		{
			ArrayList parameters = new ArrayList();

			foreach (XmlNode parameterNode in parameterNodes) {

				string parameterTypeName = GetParameterTypeName(parameterNode, "displayName");
				
				parameters.Add(parameterTypeName);
			}

			string[] parameterTypeNames = (string[]) parameters.ToArray(typeof (string));
			string paramList = "(" + string.Join(",", parameterTypeNames) + ")";

			return paramList;
		}

		private static string GetParameterTypeName(XmlNode root, string typeAttributeName)
		{
			XmlAttribute typeAtt = root.Attributes[typeAttributeName];
			return typeAtt.Value;
		}

		private static string GetNodeId(XmlNode node)
		{
			return XmlUtils.GetNodeId(node);
		}

		private static string GetNodeTypeId(XmlNode node)
		{
			return XmlUtils.GetNodeTypeId(node);
		}

		private static string GetNodeName(XmlNode node)
		{
			return XmlUtils.GetNodeName(node);
		}

		private static string GetNodeDisplayName(XmlNode node)
		{
			return XmlUtils.GetNodeDisplayName(node);
		}

		private static string StripNamespace(string name)
		{
			string result = name;

			int lastDot = name.LastIndexOf('.');

			if (lastDot != -1) {
				result = name.Substring(lastDot + 1);
			}

			return result;
		}

		private static int[] SortNodesByAttribute(XmlNodeList nodes, string attributeName)
		{
			int length = nodes.Count;
			string[] names = new string[length];
			int[] indexes = new int[length];
			int i = 0;

			foreach (XmlNode node in nodes) {
				names[i] = node.Attributes[attributeName].Value;
				indexes[i] = i++;
			}

			Array.Sort(names, indexes);

			return indexes;
		}

		private static string[] SortNamespaces(BuildProjectContext ctx, IList<string> assemblyNames, string defaultNamespace)
		{
			NameValueCollection namespaceAssemblies = new NameValueCollection();
			int nNodes = assemblyNames.Count;
			for (int i = 0; i < nNodes; i++) {
				string assemblyName = assemblyNames[i];
				GetNamespacesFromAssembly(ctx, assemblyName, namespaceAssemblies);
			}

			string[] namespaces = namespaceAssemblies.AllKeys;
			if (string.IsNullOrEmpty(defaultNamespace)) {
				Array.Sort(namespaces);
			} else {
				Array.Sort(namespaces, (x, y) =>
				{
					if (x == y) {
						return 0;
					} else if (x == null || x == defaultNamespace) {
						return -1;
					} else if (y == defaultNamespace) {
						return 1;
					}
					return x.CompareTo(y);
				});
			}
			return namespaces;
		}

		private void TransformAndWriteResult(BuildAssemblyContext ctx,
			string transformName,
			XsltArgumentList arguments,
			string filename)
		{
			Trace.WriteLine(filename);
#if DEBUG
			int start = Environment.TickCount;
#endif

			ExternalHtmlProvider htmlProvider = new ExternalHtmlProvider(MyConfig, filename);

			try {

				StreamWriter streamWriter;
				string fullPath = Path.Combine(ctx.WorkingDirectory.FullName, filename);
				using (streamWriter = new StreamWriter(
					File.Open(fullPath, FileMode.Create),
					ctx.CurrentFileEncoding)) {
					string DocLangCode = Enum.GetName(typeof(SdkLanguage), MyConfig.SdkDocLanguage).Replace("_", "-");
					
					MsdnXsltUtilities utilities = new MsdnXsltUtilities(ctx._nameResolver, ctx.CurrentAssemblyName, MyConfig.SdkDocVersionString, DocLangCode, MyConfig.SdkLinksOnWeb, ctx.CurrentFileEncoding);
					ctx._nameResolver.utilities = utilities;

					if (arguments.GetParam("assembly-name", string.Empty) == null) {
						arguments.AddParam("assembly-name", String.Empty, ctx.CurrentAssemblyName);
					}
					arguments.AddParam("ndoc-title", String.Empty, MyConfig.Title);
					arguments.AddParam("ndoc-vb-syntax", String.Empty, MyConfig.ShowVisualBasic);
					arguments.AddParam("ndoc-omit-object-tags", String.Empty, ((MyConfig.OutputTarget & OutputType.HtmlHelp) == 0));
					arguments.AddParam("ndoc-document-attributes", String.Empty, MyConfig.DocumentAttributes);
					arguments.AddParam("ndoc-documented-attributes", String.Empty, MyConfig.DocumentedAttributes);

					arguments.AddParam("ndoc-sdk-doc-base-url", String.Empty, utilities.SdkDocBaseUrl);
					arguments.AddParam("ndoc-sdk-doc-file-ext", String.Empty, utilities.SdkDocExt);
					arguments.AddParam("ndoc-sdk-doc-language", String.Empty, utilities.SdkDocLanguage);

					arguments.AddExtensionObject("urn:NDocUtil", utilities);
					arguments.AddExtensionObject("urn:NDocExternalHtml", htmlProvider);

					//Use new overload so we don't get obsolete warnings - clean compile :)

					XslTransform(ctx, transformName, ctx.GetXPathNavigable(), arguments, streamWriter, fullPath);
				}
			}
			catch(IOException ex)
			{
				throw new DocumenterException(string.Format("IO error while creating file {0}", filename), ex);
			}
//			catch (PathTooLongException e) {
//				throw new PathTooLongException(e.Message + "\nThe file that NDoc3 was trying to create had the following name:\n" + Path.Combine(ctx.WorkingDirectory.FullName, filename));
//			}

#if DEBUG
			Debug.WriteLine((Environment.TickCount - start) + " msec.");
#endif
			ctx.htmlHelp.AddFileToProject(filename);
		}
	}
}

Added Externals/NDoc3/src/NameResolver.cs.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Xml;
using NDoc3.Core;
using NDoc3.Xml;

namespace NDoc3.Documenter.Msdn {
	///<summary>
	///</summary>
	public class NameResolver {
		public const string EXT = ".html";

		public MsdnXsltUtilities utilities;
		private readonly bool mergeAssemblies;
		private readonly StringDictionary fileNames = new StringDictionary();
		private readonly StringDictionary elemNames = new StringDictionary();

		private readonly ReferenceTypeDictionary<string, string[]> assemblyReferences = new ReferenceTypeDictionary<string, string[]>();

		///<summary>
		///</summary>
		///<param name="documentation"></param>
		///<param name="mergeAssemblies"></param>
		public NameResolver(XmlDocument documentation, bool mergeAssemblies) {
			this.mergeAssemblies = mergeAssemblies;
			BuildNameTables(documentation, mergeAssemblies);
		}

		#region Used for Html file generation

		///<summary>
		///</summary>
		///<param name="assemblyName"></param>
		///<param name="typeID"></param>
		///<returns></returns>
		public string GetFilenameForFieldList(string assemblyName, string typeID) {
			return GetFilenameForIdSpecial(assemblyName, typeID, "~Fields");
		}

		///<summary>
		///</summary>
		///<param name="assemblyName"></param>
		///<param name="typeID"></param>
		///<returns></returns>
		public string GetFilenameForOperatorList(string assemblyName, string typeID) {
			return GetFilenameForIdSpecial(assemblyName, typeID, "~Operators");
		}

		///<summary>
		///</summary>
		///<param name="assemblyName"></param>
		///<param name="typeID"></param>
		///<returns></returns>
		public string GetFilenameForMethodList(string assemblyName, string typeID) {
			return GetFilenameForIdSpecial(assemblyName, typeID, "~Methods");
		}

		///<summary>
		///</summary>
		///<param name="assemblyName"></param>
		///<param name="typeID"></param>
		///<returns></returns>
		public string GetFilenameForPropertyList(string assemblyName, string typeID) {
			return GetFilenameForIdSpecial(assemblyName, typeID, "~Properties");
		}

		///<summary>
		///</summary>
		///<param name="assemblyName"></param>
		///<param name="typeID"></param>
		///<returns></returns>
		public string GetFilenameForEventList(string assemblyName, string typeID) {
			return GetFilenameForIdSpecial(assemblyName, typeID, "~Events");
		}
		#endregion

		// exposed to XSLT
		///<summary>
		///</summary>
		///<param name="currentAssemblyName"></param>
		///<param name="memberId"></param>
		///<returns></returns>
		public string GetDisplayNameForId(string currentAssemblyName, string memberId) {
			string name = elemNames[currentAssemblyName + memberId];
			if (name == null) {
				// search for identifier in referenced assemblies
				string[] assemblyReference = assemblyReferences[currentAssemblyName];
				if (assemblyReference != null) {
					foreach (string assemblyName in assemblyReference) {
						name = elemNames[assemblyName + memberId];
						if (name != null)
							break;
					}
				}
			}

			if (name == null) {
				name = elemNames[memberId];
			}
			return name;
		}

		// exposed to XSLT
		///<summary>
		///</summary>
		///<param name="currentAssemblyName"></param>
		///<param name="memberId"></param>
		///<returns></returns>
		public string GetFilenameForId(string currentAssemblyName, string memberId) {
			// lookup current assembly
			string filename = GetFilenameForIdInternal(currentAssemblyName, memberId);
			return filename;
		}

		///<summary>
		///</summary>
		///<param name="assemblyName"></param>
		///<returns></returns>
		public string GetFilenameForAssembly(string assemblyName) {
			return GetFilenameForId(assemblyName, null);
		}

		// exposed to XSLT
		///<summary>
		///</summary>
		///<param name="assemblyName"></param>
		///<param name="namespaceName"></param>
		///<returns></returns>
		public string GetFilenameForNamespaceHierarchy(string assemblyName, string namespaceName) {
			return GetFilenameForIdSpecial(assemblyName, "N:" + namespaceName, "~Hierarchy");
		}

		// exposed to XSLT
		///<summary>
		///</summary>
		///<param name="assemblyName"></param>
		///<param name="namespaceName"></param>
		///<returns></returns>
		public string GetFilenameForNamespace(string assemblyName, string namespaceName) {
			if (mergeAssemblies)
				assemblyName = string.Empty;
			if (string.IsNullOrEmpty(namespaceName))
				namespaceName = "(global)";
			return GetFilenameForId(assemblyName, "N:" + namespaceName);
		}

		// exposed to XSLT
		///<summary>
		///</summary>
		///<param name="assemblyName"></param>
		///<param name="typeID"></param>
		///<returns></returns>
		public string GetFilenameForTypeHierarchy(string assemblyName, string typeID) {
			return GetFilenameForIdSpecial(assemblyName, typeID, "~Hierarchy");
		}

		// exposed to XSLT
		///<summary>
		///</summary>
		///<param name="assemblyName"></param>
		///<param name="typeID"></param>
		///<returns></returns>
		public string GetFilenameForTypeMemberList(string assemblyName, string typeID) {
			return GetFilenameForIdSpecial(assemblyName, typeID, "~Members");
		}

		// exposed to XSLT
		///<summary>
		///</summary>
		///<param name="assemblyName"></param>
		///<param name="typeID"></param>
		///<returns></returns>
		public string GetFilenameForConstructorList(string assemblyName, string typeID) {
			return GetFilenameForIdSpecial(assemblyName, typeID, "~Constructors");
		}

		// exposed to XSLT
		///<summary>
		///</summary>
		///<param name="assemblyName"></param>
		///<param name="typeID"></param>
		///<param name="operatorName"></param>
		///<returns></returns>
		public string GetFilenameForOperatorOverloads(string assemblyName, string typeID, string operatorName) {
			return GetFilenameForIdSpecial(assemblyName, typeID, "." + operatorName.Replace('`', '$') + "~Overloads");
		}

		// exposed to XSLT
		///<summary>
		///</summary>
		///<param name="assemblyName"></param>
		///<param name="typeID"></param>
		///<param name="propertyName"></param>
		///<returns></returns>
		public string GetFilenameForPropertyOverloads(string assemblyName, string typeID, string propertyName) {
			string fileName = GetFilenameForIdSpecial(assemblyName, typeID, "." + propertyName.Replace('`', '$') + "~Overloads");
			return fileName;
		}

		// exposed to XSLT
		///<summary>
		///</summary>
		///<param name="assemblyName"></param>
		///<param name="typeID"></param>
		///<param name="methodName"></param>
		///<returns></returns>
		public string GetFilenameForMethodOverloads(string assemblyName, string typeID, string methodName) {
			string fileName = GetFilenameForIdSpecial(assemblyName, typeID, "." + methodName.Replace('`', '$').Replace("<", "(").Replace(">", ")") + "~Overloads");
			return fileName;
		}

		// exposed to XSLT
		///<summary>
		///</summary>
		///<param name="currentAssemblyName"></param>
		///<param name="typeName"></param>
		///<returns></returns>
		public string GetFilenameForTypename(string currentAssemblyName, string typeName) {

			// strip leading type identifier
			if (typeName.Length > 1 && typeName[1] != ':')
				typeName = "T:" + typeName;
			string filename = GetFilenameForId(currentAssemblyName, typeName);
			return filename;
		}

		// exposed
		///<summary>
		///</summary>
		///<param name="currentAssemblyName"></param>
		///<param name="cref"></param>
		///<param name="overload"></param>
		///<returns></returns>
		public string GetFilenameForCRefOverload(string currentAssemblyName, string cref, string overload) {
			// lookup current assembly
			string filename = GetFilenameForId(currentAssemblyName, cref);
			return filename;

			#region Original XSLT Logic
			/*
					<!--<xsl:choose>
						<xsl:when test="starts-with($cref, 'T:')">
							<xsl:call-template name="get-filename-for-type-name">
								<xsl:with-param name="type-name" select="substring-after($cref, 'T:')" />
							</xsl:call-template>
						</xsl:when>
						<xsl:when test="starts-with($cref, 'M:')">
							<xsl:choose>
								<xsl:when test="contains($cref, '.#c')">
									<xsl:value-of select="concat(translate(substring-after(substring-before($cref, '.#c'), 'M:'), '[,]', ''), 'Constructor', $overload, '.html')" />
								</xsl:when>
								<xsl:when test="contains($cref, '(')">
									<xsl:choose>
										<xsl:when test="string-length($overload) &gt; 0">
											<xsl:value-of select="concat(translate(substring-after(substring-before($cref, '('), 'M:'), '[,]', ''), '_overload_', $overload, '.html')" />
										</xsl:when>
										<xsl:otherwise>
											<xsl:value-of select="concat(translate(substring-after(substring-before($cref, '('), 'M:'), '[,]', ''), '.html')" />
										</xsl:otherwise>
									</xsl:choose>
								</xsl:when>
								<xsl:otherwise>
									<xsl:choose>
										<xsl:when test="string-length($overload) &gt; 0">
											<xsl:value-of select="concat(translate(substring-after($cref, 'M:'), '[,]', ''), '_overload_', $overload, '.html')" />
										</xsl:when>
										<xsl:otherwise>
											<xsl:value-of select="concat(translate(substring-after($cref, 'M:'), '[,]', ''), '.html')" />
										</xsl:otherwise>
									</xsl:choose>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:when>
						<xsl:when test="starts-with($cref, 'E:')">
							<xsl:value-of select="concat(translate(substring-after($cref, 'E:'), '[,]', ''), $overload, '.html')" />
						</xsl:when>
						<xsl:when test="starts-with($cref, 'F:')">
							<xsl:variable name="enum" select="/ndoc/assembly/module/namespace//enumeration[field/@id = $cref]" />
							<xsl:choose>
								<xsl:when test="$enum">
									<xsl:call-template name="get-filename-for-type-name">
										<xsl:with-param name="type-name" select="substring-after($enum/@id, 'T:')" />
									</xsl:call-template>
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="concat(translate(substring-after($cref, 'F:'), '[,]', ''), $overload, '.html')" />
								</xsl:otherwise>
							</xsl:choose>
						</xsl:when>
						<xsl:when test="starts-with($cref, 'P:')">
							<xsl:choose>
								<xsl:when test="contains($cref, '(')">
									<xsl:value-of select="concat(translate(substring-after(substring-before($cref, '('), 'P:'), '[,]', ''), $overload, '.html')" />
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="concat(translate(substring-after($cref, 'P:'), '[,]', ''), $overload, '.html')" />
								</xsl:otherwise>
							</xsl:choose>
						</xsl:when>
						<xsl:otherwise>
							<xsl:value-of select="$cref" />
						</xsl:otherwise>
					</xsl:choose>-->
			*/
			#endregion
		}

		#region BuildNameTables

		private void BuildNameTables(XmlDocument xmlDocumentation, bool mergeNamespaces) {
			XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlDocumentation.NameTable);
			nsmgr.AddNamespace("ns", "urn:ndoc-schema");
			XmlNodeList assemblies = xmlDocumentation.SelectNodes("/ns:ndoc/ns:assembly", nsmgr);
			if(assemblies == null) throw new Exception("No assemblies found");
			foreach (XmlElement assemblyNode in assemblies) {
				string assemblyName = GetNodeName(assemblyNode);
				RegisterAssembly(assemblyName);

				// build list of assemblyReferences
				XmlNodeList assemblyReferenceNodes = assemblyNode.SelectNodes("ns:assemblyReference", nsmgr);
				if(assemblyReferenceNodes == null) throw new Exception("No assembly reference nodes found");
				List<string> assemblyReferenceNames = new List<string>();
				foreach (XmlNode assemblyReferenceNode in assemblyReferenceNodes) {
					assemblyReferenceNames.Add(GetNodeName(assemblyReferenceNode));
				}
				assemblyReferences.Add(assemblyName, assemblyReferenceNames.ToArray());

				// foreach namespace
				XmlNodeList namespaces = assemblyNode.SelectNodes("ns:module/ns:namespace", nsmgr);
				if(namespaces == null) throw new Exception("No namespaces found");
				foreach (XmlElement namespaceNode in namespaces) {
					string namespaceName = GetNodeName(namespaceNode);
					// register namespace
					RegisterNamespace((mergeNamespaces ? string.Empty : assemblyName), namespaceName);

					XmlNodeList types = namespaceNode.SelectNodes("*[@id]", nsmgr);
					if(types == null) throw new Exception("No types found");
					foreach (XmlElement typeNode in types) {
						string typeId = GetNodeId(typeNode);
						//TODO The rest should also use displayName ((EE): clarify what above line means - shall we remove 'name' attribute then?)
						string typeDisplayName = GetNodeDisplayName(typeNode);
						RegisterType(assemblyName, typeId, typeDisplayName);

						// foreach member
						XmlNodeList members = typeNode.SelectNodes("*[@id]");
						if(members == null) throw new Exception("No type members found");
						foreach (XmlElement memberNode in members) {
							string memberId = GetNodeId(memberNode);
							switch (memberNode.Name) {
								case "constructor": {
									string overload = XmlUtils.GetAttributeString(memberNode, "overload", false);
										RegisterConstructor(assemblyName, typeId, memberId, overload);
									}
									break;
								case "field": {
										bool isEnum = (typeNode.Name == "enumeration");
										string memberName = GetNodeName(memberNode);
										RegisterField(assemblyName, typeId, memberId, isEnum, memberName);
									}
									break;
								case "property": {
										string overload = GetNodeOverload(memberNode);
										string memberName = GetNodeName(memberNode);
										RegisterProperty(assemblyName, memberId, memberName, overload);
									}
									break;
								case "method": {
										string overload = GetNodeOverload(memberNode);
										string memberDisplayName = GetNodeDisplayName(memberNode);
										RegisterMethod(assemblyName, memberId, memberDisplayName, overload);
									}
									break;
								case "operator": {
										string overload = GetNodeOverload(memberNode);
										string memberName = GetNodeName(memberNode);
										RegisterOperator(assemblyName, memberId, memberName, overload);
									}
									break;
								case "event": {
										string memberName = GetNodeName(memberNode);
										RegisterEvent(assemblyName, memberId, memberName);
									}
									break;
							}
						}
					}
				}
			}
		}

		private void RegisterAssembly(string assemblyName) {
			Register(assemblyName, null, assemblyName, CalculateFilenameForId(assemblyName, null, null));
		}

		private void RegisterNamespace(string assemblyName, string namespaceName) {
			if (string.IsNullOrEmpty(namespaceName)) {
				namespaceName = "(global)";
			}
			string namespaceId = "N:" + namespaceName;
			Register(assemblyName, namespaceId, namespaceName, CalculateFilenameForId(assemblyName, namespaceId, null));
		}

		private void RegisterType(string assemblyName, string typeId, string displayName) {
			Register(assemblyName, typeId, displayName, CalculateFilenameForId(assemblyName, typeId, null));
		}

		private void RegisterConstructor(string assemblyName, string typeId, string id, string overload) {
			Register(assemblyName, id, GetDisplayNameForId(assemblyName, typeId), CalculateFilenameForId(assemblyName, id, overload));
		}

		private void RegisterOperator(string assemblyName, string memberId, string memberName, string overload) {
			Register(assemblyName, memberId, memberName, CalculateFilenameForId(assemblyName, memberId, overload));
		}

		private void RegisterMethod(string assemblyName, string memberId, string memberDisplayName, string overload) {
			Register(assemblyName, memberId, memberDisplayName, CalculateFilenameForId(assemblyName, memberId, overload));
		}

		private void RegisterProperty(string assemblyName, string memberId, string memberName, string overload) {
			Register(assemblyName, memberId, memberName, CalculateFilenameForId(assemblyName, memberId, overload));
		}

		private void RegisterField(string assemblyName, string typeId, string memberId, bool isEnum, string memberName) {
			if (isEnum) {
				Register(assemblyName, memberId, memberName, GetFilenameForId(assemblyName, typeId));
			} else {
				Register(assemblyName, memberId, memberName, CalculateFilenameForId(assemblyName, memberId, null));
			}
		}

		private void RegisterEvent(string assemblyName, string memberId, string memberName) {
			Register(assemblyName, memberId, memberName, CalculateFilenameForId(assemblyName, memberId, null));
		}


		#endregion

		#region Registration & Lookup Logic

		private string GetFilenameForIdInternal(string currentAssemblyName, string memberId) {
			string filename = fileNames[currentAssemblyName + memberId];
			if (filename == null) {
				// search for identifier in referenced assemblies
				string[] assemblyReference = assemblyReferences[currentAssemblyName];
				if (assemblyReference != null) {
					foreach (string assemblyName in assemblyReference) {
						filename = fileNames[assemblyName + memberId];
						if (filename != null)
							break;
					}
				}
			}

			if (filename == null && memberId != null) {
				filename = fileNames[memberId];
			}

			//			Debug.Assert(filename != null, string.Format("Filename for assembly:memberId [{0}:{1}] not found", currentAssemblyName, memberId));
			//			Debug.WriteLine(string.Format("GetFilenameForIdInternal('{0}','{1}') => {2}", currentAssemblyName, memberId, filename));
			if (filename != null)
				return filename;

			if (utilities != null)
			{
				if (memberId.Length > 2 && memberId[1] == ':')
					memberId = memberId.Substring(2);

				filename = utilities.FormatOnlineSDKLink(memberId);

				if (filename != null)
					return filename;
			}

			return String.Empty;
		}

		private string GetFilenameForIdSpecial(string assemblyName, string memberId, string postfix) {
			string fn = GetFilenameForIdInternal(assemblyName, memberId);
			if (fn != null && fn.Length > EXT.Length) {
				fn = fn.Insert(fn.Length - EXT.Length, postfix);
			}
			//			Debug.WriteLine(string.Format("GetFilenameForIdSpecial('{0}','{1}') => {2}", assemblyName, memberId, fn));
			return fn;
		}

		private void Register(string assemblyName, string id, string displayName, string fileName) {
			//			Debug.WriteLine(string.Format("Registering [{0},{1}]=[{2},{3}]", assemblyName, id, displayName, fileName));
			fileNames[assemblyName + id] = fileName;
			elemNames[assemblyName + id] = displayName;
		}

		/// <summary>
		/// of the form "T:XXX", "F:XXX" etc
		/// </summary>
		private static string CalculateFilenameForId(string assemblyName, string id, string overload) {
			if (id == null) {
				return assemblyName + EXT;
			}

			//			char idType = '\0';
			int ix = id.IndexOf(':');
			//			if (ix > -1) {
			//				idType = id[0];
			//			}
			id = id.Substring(ix + 1);

			// constructors could be #ctor or #cctor
			//			int ixDotHash = id.IndexOf(".#c"); 
			//			if (ixDotHash > -1)
			//				id = id.Substring(0, ixDotHash);

			// methods could have "("
			int ixLBrace = id.IndexOf("(");
			if (ixLBrace > -1)
				id = id.Substring(0, ixLBrace);

			if (overload != null) {
				id += overload;
			}

			id = id.Replace('#', '~');
			// generic methods have the form "methodname<Arg1, Arg2, ...>"
			id = id.Replace('<', '{');
			id = id.Replace('>', '}');

			id = id.Replace('`', '$');
			return assemblyName + "~" + id + EXT;
		}

		#endregion

		#region Xml Utility Methods

		private static string GetNodeOverload(XmlNode memberNode) {
			return XmlUtils.GetAttributeString(memberNode, "overload", false);
		}

		private static string GetNodeId(XmlNode node) {
			return XmlUtils.GetNodeId(node);
		}

		private static string GetNodeName(XmlNode node) {
			return XmlUtils.GetNodeName(node);
		}

		private static string GetNodeDisplayName(XmlNode node) {
			return XmlUtils.GetNodeDisplayName(node);
		}

		#endregion
	}
}

Added Externals/NuGet/NuGet.exe.

cannot compute difference between binary files

Added Externals/ResGen/ResGen.exe.

cannot compute difference between binary files

Added Externals/ResGen/ResGen.exe.config.















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?xml version="1.0" encoding="UTF-8" ?>
<!--
 *
 * ResGen.exe.config -
 *
 * Copyright (c) 2007-2012 by Joe Mistachkin.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution of
 * this file, and for a DISCLAIMER OF ALL WARRANTIES.
 *
 * RCS: @(#) $Id: $
 *
-->
<configuration>
  <startup>
    <supportedRuntime version="v2.0.50727" />
    <supportedRuntime version="v4.0.30319" />
  </startup>

  <runtime>
    <generatePublisherEvidence enabled="false" />
  </runtime>
</configuration>

Added Externals/vswhere/vswhere.exe.

cannot compute difference between binary files

Added Keys/System.Data.SQLite.CF.snk.

cannot compute difference between binary files

Added Keys/System.Data.SQLite.snk.

cannot compute difference between binary files

Deleted Membership/MembershipProvider/Initialize.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
using System.Web.Security;
using System.Configuration.Provider;
using System.Collections.Specialized;
using System;
using System.Data;
using System.Data.SQLite;
using System.Configuration;
using System.Diagnostics;
using System.Web;
using System.Globalization;
using System.Security.Cryptography;
using System.Text;
using System.Web.Configuration;

namespace SQLiteProvider
{

    public sealed partial class SQLiteMembership : MembershipProvider
    {
        private bool _initialized = false;
        private Object _InitLock = new Object();
        public override void Initialize(string name, NameValueCollection config)
        {
            bool te = _initialized;
            if (te)
                return;
            
            lock (_InitLock)
            {

                if (config == null)
                    throw new ArgumentNullException("config");

                if (name == null || name.Length == 0)
                    name = "SQLiteMembershipProvider";

                if (String.IsNullOrEmpty(config["description"]))
                {
                    config.Remove("description");
                    config.Add("description", "SQLite Membership provider");
                }

                // Initialize the abstract base class.
                base.Initialize(name, config);


                _MaxInvalidPasswordAttempts = ConfigAsInt32(config["maxInvalidPasswordAttempts"], 5);
                _PasswordAttemptWindow = ConfigAsInt32(config["passwordAttemptWindow"], 10);
                _MinRequiredNonAlphanumericCharacters = ConfigAsInt32(config["minRequiredNonAlphanumericCharacters"], 0);
                _MinRequiredPasswordLength = ConfigAsInt32(config["minRequiredPasswordLength"], 7);
                _PasswordStrengthRegularExpression = ConfigAsString(config["passwordStrengthRegularExpression"], "");
                _EnablePasswordReset = ConfigAsBoolean(config["enablePasswordReset"], true);
                _EnablePasswordRetrieval = ConfigAsBoolean(config["enablePasswordRetrieval"], false);
                _RequiresQuestionAndAnswer = ConfigAsBoolean(config["requiresQuestionAndAnswer"], false);
                _RequiresUniqueEmail = ConfigAsBoolean(config["requiresUniqueEmail"], true);


                string temp_format = Convert.ToString(ConfigAsString(config["passwordFormat"], "Hashed"));
                try
                {
                    _PasswordFormat = (MembershipPasswordFormat)Enum.Parse(typeof(MembershipPasswordFormat), temp_format);
                }
                catch
                {
                    throw new ProviderException("Invalid Password Format.");
                }


                _WriteExceptionsToEventLog = ProviderUtility.GetExceptionDesitination(config["writeExceptionsToEventLog"]);
                connectionString = ProviderUtility.GetConnectionString(config["connectionStringName"]);
                ApplicationName = ProviderUtility.GetApplicationName(config["applicationName"]);


                // Get encryption and decryption key information from the configuration.
                Configuration cfg =
                  WebConfigurationManager.OpenWebConfiguration(System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath);
                machineKey = (MachineKeySection)cfg.GetSection("system.web/machineKey");

                if (machineKey.ValidationKey.Contains("AutoGenerate"))
                    if (PasswordFormat != MembershipPasswordFormat.Clear)
                        throw new ProviderException("Hashed or Encrypted passwords are not supported with auto-generated keys.");
                _initialized = true;
            }

        }


        //
        // A helper function to retrieve config values from the configuration file.
        //

        private string ConfigAsString(string configValue, string defaultValue)
        {
            if (String.IsNullOrEmpty(configValue))
                return defaultValue;

            return configValue;
        }

        private bool ConfigAsBoolean(string configValue, bool defaultValue){
            if (String.IsNullOrEmpty(configValue))
                return defaultValue;

            return Convert.ToBoolean(configValue);
        }

        private Int32 ConfigAsInt32(string configValue, int defaultValue)
        {
            if (String.IsNullOrEmpty(configValue))
                return defaultValue;

            return Convert.ToInt32(configValue);
        }

    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































































































Deleted Membership/MembershipProvider/Membership.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
using System.Web.Security;
using System.Web.Profile;
using System.Configuration.Provider;
using System.Collections.Specialized;
using System;
using System.Data;
using System.Data.SQLite;
using System.Configuration;
using System.Diagnostics;
using System.Web;
using System.Globalization;
using System.Security.Cryptography;
using System.Text;
using System.Web.Configuration;




namespace SQLiteProvider
{

    public sealed partial class SQLiteMembership : MembershipProvider
    {

        //
        // Global connection string, generated password length, generic exception message, event log info.
        //

        private int newPasswordLength = 8;
        private string eventSource = "SQLiteMembership";

        private string connectionString;
        private bool _WriteExceptionsToEventLog;
        private MachineKeySection machineKey;
        private string _ApplicationName;
        private long _AppID;
        private bool _EnablePasswordReset;
        private bool _EnablePasswordRetrieval;
        private bool _RequiresQuestionAndAnswer;
        private bool _RequiresUniqueEmail;
        private int _MaxInvalidPasswordAttempts;
        private int _PasswordAttemptWindow;
        private MembershipPasswordFormat _PasswordFormat;
     

        public bool WriteExceptionsToEventLog
        {
            get { return _WriteExceptionsToEventLog; }
            set { _WriteExceptionsToEventLog = value; }
        }






        public override bool ChangePassword(string username, string oldPwd, string newPwd)
        {
            if (!ValidateUser(username, oldPwd))
                return false;


            ValidatePasswordEventArgs args =
              new ValidatePasswordEventArgs(username, newPwd, true);

            OnValidatingPassword(args);

            if (args.Cancel)
                if (args.FailureInformation != null)
                    throw args.FailureInformation;
                else
                    throw new MembershipPasswordException("Change password canceled due to new password validation failure.");

            
            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(MembershipSql.ChangePassword , conn);

             
            cmd.Parameters.Add("$Password", DbType.String).Value = EncodePassword(newPwd);
            cmd.Parameters.Add("$Username", DbType.String).Value = username;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            int rowsAffected = 0;

            try
            {
                conn.Open();

                rowsAffected = cmd.ExecuteNonQuery();
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "ChangePassword", WriteExceptionsToEventLog);

            }
            finally
            {
                conn.Close();
            }

            if (rowsAffected > 0)
            {
                return true;
            }

            return false;
        }
        public override bool ChangePasswordQuestionAndAnswer(string username, string password, string newPwdQuestion, string newPwdAnswer)
        {
            if (!ValidateUser(username, password))
                return false;

            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(MembershipSql.ChangePasswordQA, conn);

            cmd.Parameters.Add("$Question", DbType.String).Value = newPwdQuestion;
            cmd.Parameters.Add("$Answer", DbType.String).Value = EncodePassword(newPwdAnswer);
            cmd.Parameters.Add("$Username", DbType.String).Value = username;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;


            int rowsAffected = 0;

            try
            {
                conn.Open();

                rowsAffected = cmd.ExecuteNonQuery();
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "ChangePasswordQuestionAndAnswer", WriteExceptionsToEventLog);
            }
            finally
            {
                conn.Close();
            }

            if (rowsAffected > 0)
            {
                return true;
            }

            return false;
        }
        public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status)
        {
            ValidatePasswordEventArgs args =
              new ValidatePasswordEventArgs(username, password, true);

            OnValidatingPassword(args);

            if (args.Cancel)
            {
                status = MembershipCreateStatus.InvalidPassword;
                return null;
            }



            if (RequiresUniqueEmail && GetUserNameByEmail(email) != "")
            {
                status = MembershipCreateStatus.DuplicateEmail;
                return null;
            }

            MembershipUser u = GetUser(username, false);

            if (u == null)
            {
                DateTime createDate = DateTime.Now;

                if (providerUserKey != null)
                {
                    status = MembershipCreateStatus.InvalidProviderUserKey;
                    return null;
                }

                SQLiteConnection conn = new SQLiteConnection(connectionString);
                SQLiteCommand cmd = new SQLiteCommand(MembershipSql.CreateUser, conn);

                cmd.Parameters.Add("$Username", DbType.String).Value = username;
                cmd.Parameters.Add("$Password", DbType.String).Value = EncodePassword(password);
                cmd.Parameters.Add("$Email", DbType.String).Value = email;
                cmd.Parameters.Add("$PasswordQuestion", DbType.String).Value = passwordQuestion;
                cmd.Parameters.Add("$PasswordAnswer", DbType.String).Value = EncodePassword(passwordAnswer);
                cmd.Parameters.Add("$IsApproved", DbType.Boolean).Value = isApproved;
                cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;
                cmd.Parameters.Add("$IsLockedOut", DbType.Boolean).Value = false;

                try
                {
                    conn.Open();

                    int recAdded = cmd.ExecuteNonQuery();

                    if (recAdded > 0)
                    {
                        status = MembershipCreateStatus.Success;
                    }
                    else
                    {
                        status = MembershipCreateStatus.UserRejected;
                    }
                }
                catch (SQLiteException e)
                {
                    try
                    {
                        ProviderUtility.HandleException(e, eventSource, "CreateUser", WriteExceptionsToEventLog);
                    }
                    catch { }


                    status = MembershipCreateStatus.ProviderError;
                }
                finally
                {
                    conn.Close();
                }


                return GetUser(username, false);
            }
            else
            {
                status = MembershipCreateStatus.DuplicateUserName;
            }


            return null;
        }
        public override bool DeleteUser(string username, bool deleteAllRelatedData)
        {
            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(MembershipSql.DeleteUser , conn);

            cmd.Parameters.Add("$Username", DbType.String).Value = username;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            int rowsAffected = 0;

            try
            {
                if (deleteAllRelatedData)
                {
                    Roles.RemoveUserFromRoles(username, Roles.GetRolesForUser(username));
                    
                    // Process commands to delete all data for the user in the database.
                }
                conn.Open();
                rowsAffected = cmd.ExecuteNonQuery();


            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "DeleteUser", WriteExceptionsToEventLog);
                    
            }
            finally
            {
                conn.Close();
            }

            if (rowsAffected > 0)
                return true;

            return false;
        }
        public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords)
        {
            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(MembershipSql.GetAppUsers, conn);
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;
            cmd.Parameters.Add("$Count", DbType.Int32).Value = pageSize;
            cmd.Parameters.Add("$Skip", DbType.Int32).Value = pageSize * pageIndex;
            MembershipUserCollection users = new MembershipUserCollection();
            SQLiteDataReader r = null;

            int recordCount = 0;

            try
            {
                conn.Open();
                r = cmd.ExecuteReader();
                while (r.Read())
                {
                    users.Add(this.GetUserFromReader(r));
                    recordCount++;
                }
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "GetAllUsers", WriteExceptionsToEventLog);
                
            }
            finally
            {
                totalRecords = recordCount;
                if (r != null) { r.Close(); }

                conn.Close();
            }
            return users;
        }
        public override int GetNumberOfUsersOnline()
        {
            TimeSpan onlineSpan = new TimeSpan(0, System.Web.Security.Membership.UserIsOnlineTimeWindow, 0);
            DateTime compareTime = DateTime.Now.Subtract(onlineSpan);

            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(MembershipSql.GetUsersOnline , conn);

            cmd.Parameters.Add("$CompareDate", DbType.DateTime).Value = compareTime;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            int numOnline = 0;

            try
            {
                conn.Open();

                numOnline = (int)cmd.ExecuteScalar();
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "GetNumberOfUsersOnline", WriteExceptionsToEventLog);
                    
            }
            finally
            {
                conn.Close();
            }

            return numOnline;
        }
        public override string GetPassword(string username, string answer)
        {
            if (!EnablePasswordRetrieval)
            {
                throw new ProviderException("Password Retrieval Not Enabled.");
            }

            if (PasswordFormat == MembershipPasswordFormat.Hashed)
            {
                throw new ProviderException("Cannot retrieve Hashed passwords.");
            }

            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(MembershipSql.GetPassword , conn);

            cmd.Parameters.Add("$Username", DbType.String).Value = username;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            string password = "";
            string passwordAnswer = "";
            SQLiteDataReader reader = null;

            try
            {
                conn.Open();

                reader = cmd.ExecuteReader(CommandBehavior.SingleRow);

                if (reader.HasRows)
                {
                    reader.Read();

                    if (reader.GetBoolean(2))
                        throw new MembershipPasswordException("The supplied user is locked out.");

                    password = reader.GetString(0);
                    passwordAnswer = reader.GetString(1);
                }
                else
                {
                    throw new MembershipPasswordException("The supplied user name is not found.");
                }
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "GetPassword", WriteExceptionsToEventLog);
                    
            }
            finally
            {
                if (reader != null) { reader.Close(); }
                conn.Close();
            }


            if (RequiresQuestionAndAnswer && !CheckPassword(answer, passwordAnswer))
            {
                UpdateFailureCount(username, "passwordAnswer");

                throw new MembershipPasswordException("Incorrect password answer.");
            }


            if (PasswordFormat == MembershipPasswordFormat.Encrypted)
            {
                password = UnEncodePassword(password);
            }

            return password;
        }
        public override MembershipUser GetUser(string username, bool userIsOnline)
        {
            SQLiteConnection conn = new SQLiteConnection(connectionString);

            string sql = "Select Count(*) from User where Username = $Username AND AppID = $AppID;";
            SQLiteCommand userExistsCmd = new SQLiteCommand(sql,conn );
            SQLiteCommand cmd = new SQLiteCommand(MembershipSql.GetUserByName , conn);
            SQLiteCommand updateCmd = new SQLiteCommand(MembershipSql.UpdateUserAccessTimeByName, conn);

            userExistsCmd.Parameters.Add("$Username", DbType.String).Value = username;
            userExistsCmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            updateCmd.Parameters.Add("$Username", DbType.String).Value = username;
            updateCmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;
            
            cmd.Parameters.Add("$Username", DbType.String).Value = username;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            MembershipUser u = null;
            SQLiteDataReader reader = null;

            try
            {
                conn.Open();

                Object o = userExistsCmd.ExecuteScalar();

                long count = (o == DBNull.Value ? 0 : (long)o);


                reader = cmd.ExecuteReader();
                reader.Read();
                if (count != 0)
                {
                    u = GetUserFromReader(reader);

                    if (userIsOnline)
                    {
                        updateCmd.ExecuteNonQuery();
                    }
                }

            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "GetUser(String, Boolean)", WriteExceptionsToEventLog);

                    
            }
            finally
            {
                if (reader != null) { reader.Close(); }

                conn.Close();
            }

            return u;
        }
        public override MembershipUser GetUser(object providerUserKey, bool userIsOnline)
        {
            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(MembershipSql.GetUserByID , conn);
            SQLiteCommand updateCmd = new SQLiteCommand(MembershipSql.UpdateAccessTimeByID, conn);


            updateCmd.Parameters.Add("$UserID", DbType.Int64).Value = providerUserKey;
            cmd.Parameters.Add("$UserID", DbType.Int64).Value = providerUserKey;

            MembershipUser u = null;
            SQLiteDataReader reader = null;

            try
            {
                conn.Open();

                reader = cmd.ExecuteReader();

                if (reader.HasRows)
                {
                    reader.Read();
                    u = GetUserFromReader(reader);

                    if (userIsOnline)
                    {

                        updateCmd.ExecuteNonQuery();
                    }
                }

            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "GetUser(Object, Boolean)", WriteExceptionsToEventLog);

                    

            }
            finally
            {
                if (reader != null) { reader.Close(); }

                conn.Close();
            }

            return u;
        }
        private MembershipUser GetUserFromReader(SQLiteDataReader reader)
        {
            object providerUserKey = reader.GetValue(0);
            string username = reader.GetString(1);
            string email = reader.GetString(2);
            string passwordQuestion = (reader.GetValue(3) != DBNull.Value ? reader.GetString(3) : "");
            string comment = (reader.GetValue(4) != DBNull.Value ? reader.GetString(4) : "");
            bool isApproved = reader.GetBoolean(5);
            bool isLockedOut = reader.GetBoolean(6);
            DateTime creationDate = reader.GetDateTime(7);
            DateTime lastLoginDate = (reader.GetValue(8) != DBNull.Value ? reader.GetDateTime(8) : new DateTime() );
            DateTime lastActivityDate = reader.GetDateTime(9);
            DateTime lastPasswordChangedDate = reader.GetDateTime(10);
            DateTime lastLockedOutDate = (reader.GetValue(11) != DBNull.Value ? reader.GetDateTime(11) : new DateTime() );
            
            MembershipUser u = new MembershipUser(this.Name,
                                                  username,
                                                  providerUserKey,
                                                  email,
                                                  passwordQuestion,
                                                  comment,
                                                  isApproved,
                                                  isLockedOut,
                                                  creationDate,
                                                  lastLoginDate,
                                                  lastActivityDate,
                                                  lastPasswordChangedDate,
                                                  lastLockedOutDate);

            return u;
        }
        public override bool UnlockUser(string username)
        {
            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(MembershipSql.UnlockUser , conn);

            
            cmd.Parameters.Add("$Username", DbType.String).Value = username;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            int rowsAffected = 0;

            try
            {
                conn.Open();

                rowsAffected = cmd.ExecuteNonQuery();
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "UnlockUser", WriteExceptionsToEventLog);
                    
            }
            finally
            {
                conn.Close();
            }

            if (rowsAffected > 0)
                return true;

            return false;
        }
        public override string GetUserNameByEmail(string email)
        {
            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(MembershipSql.GetUserNameByEmail , conn);

            cmd.Parameters.Add("$Email", DbType.String).Value = email;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            string username = "";

            try
            {
                conn.Open();
                Object o = cmd.ExecuteScalar();
                username = (o == DBNull.Value ? "" : (string)o);
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "GetUserNameByEmail", WriteExceptionsToEventLog);
                    
            }
            finally
            {
                conn.Close();
            }

            if (username == null)
                username = "";

            return username;
        }
        public override string ResetPassword(string username, string answer)
        {
            if (!EnablePasswordReset)
            {
                throw new NotSupportedException("Password reset is not enabled.");
            }

            if (answer == null && RequiresQuestionAndAnswer)
            {
                UpdateFailureCount(username, "passwordAnswer");

                throw new ProviderException("Password answer required for password reset.");
            }

            string newPassword =
              System.Web.Security.Membership.GeneratePassword(newPasswordLength, MinRequiredNonAlphanumericCharacters);


            ValidatePasswordEventArgs args =
              new ValidatePasswordEventArgs(username, newPassword, true);

            OnValidatingPassword(args);

            if (args.Cancel)
                if (args.FailureInformation != null)
                    throw args.FailureInformation;
                else
                    throw new MembershipPasswordException("Reset password canceled due to password validation failure.");


            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(MembershipSql.QueryPasswordReset , conn);
            SQLiteCommand updateCmd = new SQLiteCommand(MembershipSql.ResetPassword, conn);


            cmd.Parameters.Add("$Username", DbType.String).Value = username;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            updateCmd.Parameters.Add("$Password", DbType.String).Value = EncodePassword(newPassword);
            updateCmd.Parameters.Add("$Username", DbType.String).Value = username;
            updateCmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;


            int rowsAffected = 0;
            string passwordAnswer = "";
            SQLiteDataReader reader = null;

            try
            {
                conn.Open();

                reader = cmd.ExecuteReader(CommandBehavior.SingleRow);

                if (reader.HasRows)
                {
                    reader.Read();

                    if (reader.GetBoolean(1))
                        throw new MembershipPasswordException("The supplied user is locked out.");

                    passwordAnswer = reader.GetString(0);
                }
                else
                {
                    throw new MembershipPasswordException("The supplied user name is not found.");
                }

                if (RequiresQuestionAndAnswer && !CheckPassword(answer, passwordAnswer))
                {
                    UpdateFailureCount(username, "passwordAnswer");

                    throw new MembershipPasswordException("Incorrect password answer.");
                }

                rowsAffected = updateCmd.ExecuteNonQuery();
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "ResetPassword", WriteExceptionsToEventLog);

            }
            finally
            {
                if (reader != null) { reader.Close(); }
                conn.Close();
            }

            if (rowsAffected > 0)
            {
                return newPassword;
            }
            else
            {
                throw new MembershipPasswordException("User not found, or user is locked out. Password not Reset.");
            }
        }
        public override void UpdateUser(MembershipUser user)
        {
            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(MembershipSql.UpdateUser, conn);

            cmd.Parameters.Add("$Email", DbType.String).Value = user.Email;
            cmd.Parameters.Add("$Comment", DbType.String).Value = user.Comment;
            cmd.Parameters.Add("$IsApproved", DbType.Boolean).Value = user.IsApproved;
            cmd.Parameters.Add("$Username", DbType.String).Value = user.UserName;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;


            try
            {
                conn.Open();

                cmd.ExecuteNonQuery();
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "UpdateUser", WriteExceptionsToEventLog);
                
            }
            finally
            {
                conn.Close();
            }
        }
        public override bool ValidateUser(string username, string password)
        {
            bool isValid = false;

            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(MembershipSql.ValidateUser , conn);
            SQLiteCommand updateCmd = new SQLiteCommand(MembershipSql.UpdateLastLoginDate, conn);


            updateCmd.Parameters.Add("$Username", DbType.String).Value = username;
            updateCmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID; 

            cmd.Parameters.Add("$Username", DbType.String).Value = username;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            SQLiteDataReader reader = null;
            bool isApproved = false;
            string pwd = "";

            try
            {
                conn.Open();

                reader = cmd.ExecuteReader(CommandBehavior.SingleRow);

                if (reader.HasRows)
                {
                    reader.Read();
                    pwd = reader.GetString(0);
                    isApproved = reader.GetBoolean(1);
                }
                else
                {
                    return false;
                }

                reader.Close();

                if (CheckPassword(password, pwd))
                {
                    if (isApproved)
                    {
                        isValid = true;
                        updateCmd.ExecuteNonQuery();
                    }
                }
                else
                {
                    conn.Close();

                    UpdateFailureCount(username, "password");
                }
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "ValidateUser", WriteExceptionsToEventLog);
                    
            }
            finally
            {
                if (reader != null) { reader.Close(); }
                conn.Close();
            }

            return isValid;
        }
        private void UpdateFailureCount(string username, string failureType)
        {
            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand queryCmd = new SQLiteCommand(MembershipSql.QueryFailureCount , conn);
            SQLiteCommand updateCmd = new SQLiteCommand();
            SQLiteCommand lockoutCmd = new SQLiteCommand(MembershipSql.LockOutUser, conn);


            updateCmd.Connection = conn;
            updateCmd.Parameters.Add("$Username", DbType.String).Value = username;
            updateCmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;
            updateCmd.Parameters.Add("$Count", DbType.Int32);

            queryCmd.Parameters.Add("$Username", DbType.String).Value = username;
            queryCmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;
            
            lockoutCmd.Parameters.Add("$IsLockedOut", DbType.Boolean).Value = true;
            lockoutCmd.Parameters.Add("$Username", DbType.String).Value = username;
            lockoutCmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            SQLiteDataReader reader = null;
            DateTime windowStart = new DateTime();
            int failureCount = 0;

            try
            {
                conn.Open();

                reader = queryCmd.ExecuteReader(CommandBehavior.SingleRow);

                if (reader.HasRows)
                {
                    reader.Read();

                    if (failureType == "password")
                    {
                        failureCount = reader.GetInt32(0);
                        windowStart = reader.GetDateTime(1);
                    }

                    if (failureType == "passwordAnswer")
                    {
                        failureCount = reader.GetInt32(2);
                        windowStart = reader.GetDateTime(3);
                    }
                }

                reader.Close();

                DateTime windowEnd = windowStart.AddMinutes(PasswordAttemptWindow);

                if (failureCount == 0 || DateTime.Now > windowEnd)
                {
                    // First password failure or outside of PasswordAttemptWindow. 
                    // Start a new password failure count from 1 and a new window starting now.

                    if (failureType == "password")
                        updateCmd.CommandText = MembershipSql.UpdatePasswordFailureCountStart;

                    if (failureType == "passwordAnswer")
                        updateCmd.CommandText = MembershipSql.UpdateAnswerFailureCountStart;

                    updateCmd.Parameters["$Count"].Value = 1;

                    if (updateCmd.ExecuteNonQuery() < 0)
                        throw new ProviderException("Unable to update failure count and window start.");
                }
                else
                {
                    if (failureCount++ >= MaxInvalidPasswordAttempts)
                    {

                        if (lockoutCmd.ExecuteNonQuery() < 0)
                            throw new ProviderException("Unable to lock out user.");
                    }
                    else
                    {
                        // Password attempts have not exceeded the failure threshold. Update
                        // the failure counts. Leave the window the same.

                        if (failureType == "password")
                            updateCmd.CommandText = MembershipSql.UpdatePasswordFailureCount;

                        if (failureType == "passwordAnswer")
                            updateCmd.CommandText = MembershipSql.UpdateAnswerFailureCount;

                        updateCmd.Parameters["$Count"].Value = failureCount;


                        if (updateCmd.ExecuteNonQuery() < 0)
                            throw new ProviderException("Unable to update failure count.");
                    }
                }
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "UpdateFailureCount", WriteExceptionsToEventLog);

                    
            }
            finally
            {
                if (reader != null) { reader.Close(); }
                conn.Close();
            }
        }
        public override MembershipUserCollection FindUsersByName(string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
        {

            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(MembershipSql.FindUsersByName, conn);

            MembershipUserCollection users = new MembershipUserCollection();
            SQLiteDataReader r = null;
            cmd.Parameters.Add("$UsernameSearch", DbType.String).Value = usernameToMatch;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;
            cmd.Parameters.Add("$Count", DbType.Int32).Value = pageSize;
            cmd.Parameters.Add("$Skip", DbType.Int32).Value = pageIndex * pageSize;

            int recordCount = 0;

            try
            {
                conn.Open();
                r = cmd.ExecuteReader();
                while (r.Read())
                {
                    users.Add(this.GetUserFromReader(r));
                    recordCount++;
                }
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "FindUsersByName", WriteExceptionsToEventLog);
                
            }
            finally
            {
                totalRecords = recordCount;
                if (r != null) { r.Close(); }

                conn.Close();
            }
            return users;
        }
        public override MembershipUserCollection FindUsersByEmail(string emailToMatch, int pageIndex, int pageSize, out int totalRecords)
        {

            
            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(MembershipSql.FindUsersByEmail, conn);

            MembershipUserCollection users = new MembershipUserCollection();
            SQLiteDataReader r = null;
            cmd.Parameters.Add("$EmailSearch", DbType.String).Value = emailToMatch;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;
            cmd.Parameters.Add("$Count", DbType.Int32).Value = pageSize;
            cmd.Parameters.Add("$Skip", DbType.Int32).Value = pageIndex * pageSize;

            int recordCount = 0;

            try
            {
                conn.Open();
                r = cmd.ExecuteReader();
                while (r.Read())
                {
                    users.Add(this.GetUserFromReader(r));
                    recordCount++;
                }
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "FindUsersByEmail", WriteExceptionsToEventLog);
                
            }
            finally
            {
                totalRecords = recordCount;
                if (r != null) { r.Close(); }

                conn.Close();
            }
            return users;


        }



    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted Membership/MembershipProvider/MembershipUtility.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
using System.Web.Security;
using System.Configuration.Provider;
using System.Collections.Specialized;
using System;
using System.Data;
using System.Data.SQLite;
using System.Configuration;
using System.Diagnostics;
using System.Web;
using System.Globalization;
using System.Security.Cryptography;
using System.Text;
using System.Web.Configuration;




namespace SQLiteProvider
{

    public sealed partial class SQLiteMembership : MembershipProvider
    {
        //
        // CheckPassword
        //   Compares password values based on the MembershipPasswordFormat.
        //

        private bool CheckPassword(string password, string dbpassword)
        {
            string pass1 = password;
            string pass2 = dbpassword;

            switch (PasswordFormat)
            {
                case MembershipPasswordFormat.Encrypted:
                    pass2 = UnEncodePassword(dbpassword);
                    break;
                case MembershipPasswordFormat.Hashed:
                    pass1 = EncodePassword(password);
                    break;
                default:
                    break;
            }

            if (pass1 == pass2)
            {
                return true;
            }

            return false;
        }


        //
        // EncodePassword
        //   Encrypts, Hashes, or leaves the password clear based on the PasswordFormat.
        //

        private string EncodePassword(string password)
        {
            string pw = (password == null ? "" : password);
            string encodedPassword = pw;

            switch (PasswordFormat)
            {
                case MembershipPasswordFormat.Clear:
                    break;
                case MembershipPasswordFormat.Encrypted:
                    encodedPassword =
                      Convert.ToBase64String(EncryptPassword(Encoding.Unicode.GetBytes(pw)));
                    break;
                case MembershipPasswordFormat.Hashed:
                    HMACSHA1 hash = new HMACSHA1();
                    hash.Key = HexToByte(machineKey.ValidationKey);
                    encodedPassword =
                      Convert.ToBase64String(hash.ComputeHash(Encoding.Unicode.GetBytes(pw)));
                    break;
                default:
                    throw new ProviderException("Unsupported password format.");
            }

            return encodedPassword;
        }


        //
        // UnEncodePassword
        //   Decrypts or leaves the password clear based on the PasswordFormat.
        //

        private string UnEncodePassword(string encodedPassword)
        {
            string password = encodedPassword;

            switch (PasswordFormat)
            {
                case MembershipPasswordFormat.Clear:
                    break;
                case MembershipPasswordFormat.Encrypted:
                    password =
                      Encoding.Unicode.GetString(DecryptPassword(Convert.FromBase64String(password)));
                    break;
                case MembershipPasswordFormat.Hashed:
                    throw new ProviderException("Cannot unencode a hashed password.");
                default:
                    throw new ProviderException("Unsupported password format.");
            }

            return password;
        }

        //
        // HexToByte
        //   Converts a hexadecimal string to a byte array. Used to convert encryption
        // key values from the configuration.
        //

        private byte[] HexToByte(string hexString)
        {
            byte[] returnBytes = new byte[hexString.Length / 2];
            for (int i = 0; i < returnBytes.Length; i++)
                returnBytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16);
            return returnBytes;
        }

    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































Deleted Membership/MembershipProvider/ProviderProperties.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using System.Web.Security;
using System.Configuration.Provider;
using System.Collections.Specialized;
using System;
using System.Data;
using System.Data.SQLite;
using System.Configuration;
using System.Diagnostics;
using System.Web;
using System.Globalization;
using System.Security.Cryptography;
using System.Text;
using System.Web.Configuration;




namespace SQLiteProvider
{

    public sealed partial class SQLiteMembership : MembershipProvider
    {
        private Object _appLock = new Object();
        public override string ApplicationName
        {
            get { return _ApplicationName; }
            set
            {
                lock (_appLock)
                {
                    _ApplicationName = value;
                    _AppID = ProviderUtility.GetApplicationID(connectionString, value);
                }
            }
        }
        public override bool EnablePasswordReset
        {
            get { return _EnablePasswordReset; }
        }


        public override bool EnablePasswordRetrieval
        {
            get { return _EnablePasswordRetrieval; }
        }


        public override bool RequiresQuestionAndAnswer
        {
            get { return _RequiresQuestionAndAnswer; }
        }


        public override bool RequiresUniqueEmail
        {
            get { return _RequiresUniqueEmail; }
        }


        public override int MaxInvalidPasswordAttempts
        {
            get { return _MaxInvalidPasswordAttempts; }
        }


        public override int PasswordAttemptWindow
        {
            get { return _PasswordAttemptWindow; }
        }


        public override MembershipPasswordFormat PasswordFormat
        {
            get { return _PasswordFormat; }
        }

        private int _MinRequiredNonAlphanumericCharacters;

        public override int MinRequiredNonAlphanumericCharacters
        {
            get { return _MinRequiredNonAlphanumericCharacters; }
        }

        private int _MinRequiredPasswordLength;

        public override int MinRequiredPasswordLength
        {
            get { return _MinRequiredPasswordLength; }
        }

        private string _PasswordStrengthRegularExpression;

        public override string PasswordStrengthRegularExpression
        {
            get { return _PasswordStrengthRegularExpression; }
        }
    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































Deleted Membership/Properties/AssemblyInfo.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SQLiteProvider")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Fresnel Computing")]
[assembly: AssemblyProduct("SQLiteProvider")]
[assembly: AssemblyCopyright("Copyright © Fresnel Computing 2006")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("08669110-651d-458d-8c01-0bf683bbe931")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Revision and Build Numbers 
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































Deleted Membership/Properties/Settings.Designer.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.42
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace SQLiteProvider.Properties {
    
    
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
        
        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
        
        public static Settings Default {
            get {
                return defaultInstance;
            }
        }
    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































Deleted Membership/Properties/Settings.settings.

1
2
3
4
5
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
  <Profiles />
  <Settings />
</SettingsFile>
<
<
<
<
<










Deleted Membership/RoleProvider/RoleProvider.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
using System.Web.Security;
using System.Configuration.Provider;
using System.Collections.Specialized;
using System.Collections.Generic;
using System;
using System.Data;
using System.Data.SQLite;
using System.Configuration;
using System.Diagnostics;
using System.Web;
using System.Globalization;



namespace SQLiteProvider
{

    public sealed partial class SQLiteRole : RoleProvider
    {


        private string eventSource = "SQLiteRole";

        private string connectionString;
        private bool _WriteExceptionsToEventLog = false;
        private string _ApplicationName;
        private long _AppID;

        private bool _initialized = false;
        private object _InitLock = new Object();
        private object _AppLock = new Object();

        public bool WriteExceptionsToEventLog
        {
            get { return _WriteExceptionsToEventLog; }
        }

        public override void Initialize(string name, NameValueCollection config)
        {
            bool TempInit = _initialized;
            if (_initialized)
                return;

            lock (_InitLock)
            {

                if (config == null)
                    throw new ArgumentNullException("config");

                if (name == null || name.Length == 0)
                    name = "SQLiteRoleProvider";

                if (String.IsNullOrEmpty(config["description"]))
                {
                    config.Remove("description");
                    config.Add("description", "SQLite Role Privider");
                }

                // Initialize the abstract base class.
                base.Initialize(name, config);
                _WriteExceptionsToEventLog = ProviderUtility.GetExceptionDesitination(config["writeExceptionsToEventLog"]);
                connectionString = ProviderUtility.GetConnectionString(config["connectionStringName"]);
                ApplicationName = ProviderUtility.GetApplicationName(config["applicationName"]);

                _initialized = true;
            }
        }
        public override string ApplicationName
        {
            get { return _ApplicationName; }
            set
            {
                lock (_AppLock)
                {
                    _ApplicationName = value;
                    _AppID = ProviderUtility.GetApplicationID(connectionString, value);
                }
            }
        }
        public override void AddUsersToRoles(string[] usernames, string[] rolenames)
        {
            foreach (string rolename in rolenames)
            {
                if (!RoleExists(rolename))
                {
                    throw new ProviderException("Role name not found.");
                }
            }

            foreach (string username in usernames)
            {
                foreach (string rolename in rolenames)
                {
                    if (IsUserInRole(username, rolename))
                    {
                        throw new ProviderException("User is already in role.");
                    }
                }
            }


            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(RoleSql.AddUserToRole, conn);

            SQLiteParameter userParm = cmd.Parameters.Add("$Username", DbType.String);
            SQLiteParameter roleParm = cmd.Parameters.Add("$Rolename", DbType.String);
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            SQLiteTransaction tran = null;

            try
            {
                conn.Open();
                tran = conn.BeginTransaction();
                cmd.Transaction = tran;

                foreach (string username in usernames)
                {
                    foreach (string rolename in rolenames)
                    {
                        userParm.Value = username;
                        roleParm.Value = rolename;
                        cmd.ExecuteNonQuery();
                    }
                }

                tran.Commit();
            }
            catch (SQLiteException e)
            {
                try
                {
                    tran.Rollback();
                }
                catch { }

                ProviderUtility.HandleException(e, eventSource, "AddUsersToRoles", WriteExceptionsToEventLog);

            }
            finally
            {
                conn.Close();
            }
        }
        public override void CreateRole(string rolename)
        {
            if (RoleExists(rolename))
            {
                throw new ProviderException("Role name already exists.");
            }

            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(RoleSql.CreateRole, conn);

            cmd.Parameters.Add("$Rolename", DbType.String).Value = rolename;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            try
            {
                conn.Open();

                cmd.ExecuteNonQuery();
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "CreateRole", WriteExceptionsToEventLog);

            }
            finally
            {
                conn.Close();
            }
        }
        public override bool DeleteRole(string rolename, bool throwOnPopulatedRole)
        {
            if (!RoleExists(rolename))
            {
                throw new ProviderException("Role does not exist.");
            }

            if (throwOnPopulatedRole && GetUsersInRole(rolename).Length > 0)
            {
                throw new ProviderException("Cannot delete a populated role.");
            }

            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(RoleSql.DeleteRole, conn);

            cmd.Parameters.Add("$Rolename", DbType.String).Value = rolename;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;


            SQLiteCommand cmd2 = new SQLiteCommand(RoleSql.DeleteRoleFromMap, conn);

            cmd2.Parameters.Add("$Rolename", DbType.String).Value = rolename;
            cmd2.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            SQLiteTransaction tran = null;

            try
            {
                conn.Open();
                tran = conn.BeginTransaction();
                cmd.Transaction = tran;
                cmd2.Transaction = tran;

                cmd2.ExecuteNonQuery();
                cmd.ExecuteNonQuery();

                tran.Commit();
            }
            catch (SQLiteException e)
            {
                try
                {
                    tran.Rollback();
                }
                catch { }

                ProviderUtility.HandleException(e, eventSource, "DeleteRole", WriteExceptionsToEventLog);
            }
            finally
            {
                conn.Close();
            }

            return true;
        }
        public override string[] GetAllRoles()
        {
            List<String> names = new List<string>();
            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(RoleSql.GetAllRoles, conn);

            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            SQLiteDataReader reader = null;

            try
            {
                conn.Open();

                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    names.Add(reader.GetString(0));
                }
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "GetAllRoles", WriteExceptionsToEventLog);
            }
            finally
            {
                if (reader != null) { reader.Close(); }
                conn.Close();
            }


            return names.ToArray();
        }
        public override string[] GetRolesForUser(string username)
        {
            List<string> roles = new List<string>();

            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(RoleSql.GetRolesForUser, conn);

            cmd.Parameters.Add("$Username", DbType.String).Value = username;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            SQLiteDataReader reader = null;

            try
            {
                conn.Open();

                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    roles.Add(reader.GetString(0));
                }
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "GetRolesForUser", WriteExceptionsToEventLog);
            }
            finally
            {
                if (reader != null) { reader.Close(); }
                conn.Close();
            }


            return roles.ToArray();
        }
        public override string[] GetUsersInRole(string rolename)
        {
            List<String> users = new List<string>();

            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(RoleSql.GetUsersInRole, conn);

            cmd.Parameters.Add("$Rolename", DbType.String).Value = rolename;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            SQLiteDataReader reader = null;

            try
            {
                conn.Open();

                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    users.Add(reader.GetString(0));
                }
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "GetUsersInRole", WriteExceptionsToEventLog);
            }
            finally
            {
                if (reader != null) { reader.Close(); }
                conn.Close();
            }
            return users.ToArray();
        }
        public override bool IsUserInRole(string username, string rolename)
        {
            long count = 0;

            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(RoleSql.IsUserInRole, conn);

            cmd.Parameters.Add("$Username", DbType.String).Value = username;
            cmd.Parameters.Add("$Rolename", DbType.String).Value = rolename;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            try
            {
                conn.Open();
                count = (long)cmd.ExecuteScalar();
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "IsUserInRole", WriteExceptionsToEventLog);
            }
            finally
            {
                conn.Close();
            }

            return (count != 0);
        }
        public override void RemoveUsersFromRoles(string[] usernames, string[] rolenames)
        {
            foreach (string rolename in rolenames)
            {
                if (!RoleExists(rolename))
                {
                    throw new ProviderException("Role name not found.");
                }
            }

            foreach (string username in usernames)
            {
                foreach (string rolename in rolenames)
                {
                    if (!IsUserInRole(username, rolename))
                    {
                        throw new ProviderException("User is not in role.");
                    }
                }
            }


            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(RoleSql.DeleteUserFromRole, conn);

            SQLiteParameter userParm = cmd.Parameters.Add("$Username", DbType.String);
            SQLiteParameter roleParm = cmd.Parameters.Add("$Rolename", DbType.String);
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            SQLiteTransaction tran = null;

            try
            {
                conn.Open();
                tran = conn.BeginTransaction();
                cmd.Transaction = tran;

                foreach (string username in usernames)
                {
                    foreach (string rolename in rolenames)
                    {
                        userParm.Value = username;
                        roleParm.Value = rolename;
                        cmd.ExecuteNonQuery();
                    }
                }

                tran.Commit();
            }
            catch (SQLiteException e)
            {
                try
                {
                    tran.Rollback();
                }
                catch { }
                ProviderUtility.HandleException(e, eventSource, "RemoveUsersFromRoles", WriteExceptionsToEventLog);

            }
            finally
            {
                conn.Close();
            }
        }
        public override bool RoleExists(string rolename)
        {
            long count = 0;

            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(RoleSql.RoleExists, conn);

            cmd.Parameters.Add("$Rolename", DbType.String).Value = rolename;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            try
            {
                conn.Open();
                count = (long)cmd.ExecuteScalar();
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "RoleExists", WriteExceptionsToEventLog);


            }
            finally
            {
                conn.Close();
            }

            return (count != 0);
        }
        public override string[] FindUsersInRole(string rolename, string usernameToMatch)
        {
            SQLiteConnection conn = new SQLiteConnection(connectionString);
            SQLiteCommand cmd = new SQLiteCommand(RoleSql.FindUsersInRole, conn);
            cmd.Parameters.Add("$Username", DbType.String).Value = usernameToMatch;
            cmd.Parameters.Add("$Rolename", DbType.String).Value = rolename;
            cmd.Parameters.Add("$AppID", DbType.Int64).Value = _AppID;

            List<String> users = new List<string>();
            SQLiteDataReader reader = null;

            try
            {
                conn.Open();

                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    users.Add(reader.GetString(0));
                }
            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, eventSource, "FindUsersInRole", WriteExceptionsToEventLog);                

            }
            finally
            {
                if (reader != null) { reader.Close(); }

                conn.Close();
            }

            return users.ToArray();
        }

    }
}


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
























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted Membership/SQLiteProvider.csproj.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{1B7C6ACE-35AA-481C-9CF6-56B702E3E043}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>SQLiteProvider</RootNamespace>
    <AssemblyName>SQLiteProvider</AssemblyName>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.configuration" />
    <Reference Include="System.Data" />
    <Reference Include="System.Data.SQLite" />
    <Reference Include="System.Web" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Profile\SQLiteProfile.cs" />
    <Compile Include="Properties\Settings.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
      <DependentUpon>Settings.settings</DependentUpon>
    </Compile>
    <Compile Include="SiteMap\DynamicSiteMap.cs" />
    <Compile Include="SiteMap\StaticSiteMap.cs" />
    <Compile Include="Sql\ApplicationSql.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>ApplicationSql.resx</DependentUpon>
    </Compile>
    <Compile Include="Sql\MembershipSql.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>MembershipSql.resx</DependentUpon>
    </Compile>
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Sql\RoleSql.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>RoleSql.resx</DependentUpon>
    </Compile>
    <Compile Include="MembershipProvider\Membership.cs" />
    <Compile Include="MembershipProvider\Initialize.cs" />
    <Compile Include="MembershipProvider\ProviderProperties.cs" />
    <Compile Include="MembershipProvider\MembershipUtility.cs" />
    <Compile Include="Sql\SiteMapSql.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>SiteMapSql.resx</DependentUpon>
      <CustomToolNamespace>SQLiteProvider</CustomToolNamespace>
    </Compile>
    <Compile Include="Utiliy\ProviderUtility.cs" />
    <Compile Include="RoleProvider\RoleProvider.cs" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Sql\ApplicationSql.resx">
      <SubType>Designer</SubType>
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>ApplicationSql.Designer.cs</LastGenOutput>
      <CustomToolNamespace>SQLiteProvider</CustomToolNamespace>
    </EmbeddedResource>
    <EmbeddedResource Include="Sql\MembershipSql.resx">
      <SubType>Designer</SubType>
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>MembershipSql.Designer.cs</LastGenOutput>
      <CustomToolNamespace>SQLiteProvider</CustomToolNamespace>
    </EmbeddedResource>
    <EmbeddedResource Include="Sql\RoleSql.resx">
      <SubType>Designer</SubType>
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>RoleSql.Designer.cs</LastGenOutput>
      <CustomToolNamespace>SQLiteProvider</CustomToolNamespace>
    </EmbeddedResource>
    <EmbeddedResource Include="Sql\SiteMapSql.resx">
      <SubType>Designer</SubType>
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>SiteMapSql.Designer.cs</LastGenOutput>
      <CustomToolNamespace>SQLiteProvider</CustomToolNamespace>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="app.config" />
    <None Include="Properties\Settings.settings">
      <Generator>SettingsSingleFileGenerator</Generator>
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
    </None>
    <None Include="Sql\Schema.sql" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="TODO.txt" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































Deleted Membership/SQLiteProvider.sln.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C# Express 2005
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLiteProvider", "SQLiteProvider.csproj", "{1B7C6ACE-35AA-481C-9CF6-56B702E3E043}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{1B7C6ACE-35AA-481C-9CF6-56B702E3E043}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{1B7C6ACE-35AA-481C-9CF6-56B702E3E043}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{1B7C6ACE-35AA-481C-9CF6-56B702E3E043}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{1B7C6ACE-35AA-481C-9CF6-56B702E3E043}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































Deleted Membership/SQLiteProvider.suo.

cannot compute difference between binary files

Deleted Membership/Sql/ApplicationSql.Designer.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.42
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace SQLiteProvider {
    using System;
    
    
    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class ApplicationSql {
        
        private static global::System.Resources.ResourceManager resourceMan;
        
        private static global::System.Globalization.CultureInfo resourceCulture;
        
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal ApplicationSql() {
        }
        
        /// <summary>
        ///   Returns the cached ResourceManager instance used by this class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SQLiteProvider.Sql.ApplicationSql", typeof(ApplicationSql).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }
        
        /// <summary>
        ///   Overrides the current thread's CurrentUICulture property for all
        ///   resource lookups using this strongly typed resource class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to Select Count(*) from Application where ApplicationName = $ApplicationName.
        /// </summary>
        internal static string AppExists {
            get {
                return ResourceManager.GetString("AppExists", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to Select AppID from Application where ApplicationName = $ApplicationName;.
        /// </summary>
        internal static string GetAppID {
            get {
                return ResourceManager.GetString("GetAppID", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to Insert into Application (ApplicationName) values ($ApplicationName).
        /// </summary>
        internal static string InsertApp {
            get {
                return ResourceManager.GetString("InsertApp", resourceCulture);
            }
        }
    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































Deleted Membership/Sql/ApplicationSql.resx.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?xml version="1.0" encoding="utf-8"?>
<root>
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <data name="AppExists" xml:space="preserve">
    <value>Select Count(*) from Application where ApplicationName = $ApplicationName</value>
  </data>
  <data name="GetAppID" xml:space="preserve">
    <value>Select AppID from Application where ApplicationName = $ApplicationName;</value>
  </data>
  <data name="InsertApp" xml:space="preserve">
    <value>Insert into Application (ApplicationName) values ($ApplicationName)</value>
  </data>
</root>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































Deleted Membership/Sql/MembershipSql.Designer.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.42
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace SQLiteProvider {
    using System;
    
    
    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class MembershipSql {
        
        private static global::System.Resources.ResourceManager resourceMan;
        
        private static global::System.Globalization.CultureInfo resourceCulture;
        
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal MembershipSql() {
        }
        
        /// <summary>
        ///   Returns the cached ResourceManager instance used by this class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SQLiteProvider.Sql.MembershipSql", typeof(MembershipSql).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }
        
        /// <summary>
        ///   Overrides the current thread's CurrentUICulture property for all
        ///   resource lookups using this strongly typed resource class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to UPDATE User SET Password = $Password, LastPasswordChangedDate = datetime(&apos;now&apos;,&apos;utc&apos;) WHERE Username = $Username AND AppID = $AppID;.
        /// </summary>
        internal static string ChangePassword {
            get {
                return ResourceManager.GetString("ChangePassword", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to UPDATE User SET PasswordQuestion = $Question, PasswordAnswer = $Answer WHERE Username = $Username AND AppID = $AppID;.
        /// </summary>
        internal static string ChangePasswordQA {
            get {
                return ResourceManager.GetString("ChangePasswordQA", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to INSERT INTO User
        ///(
        ///	Username,
        ///	Password,
        ///	Email,
        ///	PasswordQuestion,
        ///	PasswordAnswer,
        ///	IsApproved,
        ///	Comment,
        ///	CreationDate,
        ///	LastPasswordChangedDate,
        ///	LastActivityDate,
        ///	AppID,
        ///	IsLockedOut,
        ///	LastLockedOutDate,
        ///	FailedPasswordAttemptCount,
        ///	FailedPasswordAttemptWindowStart,
        ///	FailedPasswordAnswerAttemptCount,
        ///	FailedPasswordAnswerAttemptWindowStart
        ///)
        ///Values(
        ///	$Username,
        ///	$Password,
        ///	$Email,
        ///	$PasswordQuestion,
        ///	$PasswordAnswer,
        ///	$IsApproved,
        ///	&apos;&apos;,
        ///	datetime(&apos;now&apos;,&apos;utc&apos;),
        ///	datetime( [rest of string was truncated]&quot;;.
        /// </summary>
        internal static string CreateUser {
            get {
                return ResourceManager.GetString("CreateUser", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to DELETE FROM User WHERE Username = $Username AND AppID = $AppID;.
        /// </summary>
        internal static string DeleteUser {
            get {
                return ResourceManager.GetString("DeleteUser", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to SELECT UserID, Username, Email, PasswordQuestion,
        ///Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate,
        ///LastActivityDate, LastPasswordChangedDate, LastLockedOutDate 
        ///FROM User 
        ///WHERE Email LIKE $EmailSearch AND AppID = $AppID 
        ///ORDER BY Username Asc
        ///LIMIT $Count, $Skip .
        /// </summary>
        internal static string FindUsersByEmail {
            get {
                return ResourceManager.GetString("FindUsersByEmail", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to SELECT UserID, Username, Email, PasswordQuestion,
        ///Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate,
        ///LastActivityDate, LastPasswordChangedDate, LastLockedOutDate 
        ///FROM User 
        ///WHERE Username LIKE $UsernameSearch AND AppID = $AppID
        ///ORDER BY Username Asc
        ///LIMIT $Count, $Skip .
        /// </summary>
        internal static string FindUsersByName {
            get {
                return ResourceManager.GetString("FindUsersByName", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to SELECT 
        ///	UserID, Username, Email, PasswordQuestion, Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate, LastActivityDate, LastPasswordChangedDate, LastLockedOutDate 
        ///FROM 
        ///	User 
        ///WHERE 
        ///	AppID = $AppID 
        ///ORDER BY 
        ///	Username Asc
        ///LIMIT
        ///	$Skip, $Count.
        /// </summary>
        internal static string GetAppUsers {
            get {
                return ResourceManager.GetString("GetAppUsers", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to SELECT Password, PasswordAnswer, IsLockedOut FROM User WHERE Username = $Username AND AppID = $AppID;.
        /// </summary>
        internal static string GetPassword {
            get {
                return ResourceManager.GetString("GetPassword", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to SELECT UserID, Username, Email, PasswordQuestion,
        ///Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate,
        ///LastActivityDate, LastPasswordChangedDate, LastLockedOutDate
        ///FROM User WHERE UserID = $UserID;.
        /// </summary>
        internal static string GetUserByID {
            get {
                return ResourceManager.GetString("GetUserByID", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to SELECT 
        ///	UserID, Username, Email, PasswordQuestion, Comment, 
        ///	IsApproved, IsLockedOut, CreationDate, LastLoginDate, 
        ///	LastActivityDate, LastPasswordChangedDate, LastLockedOutDate 
        ///FROM 
        ///	User 
        ///WHERE 
        ///	Username = $Username AND AppID = $AppID;.
        /// </summary>
        internal static string GetUserByName {
            get {
                return ResourceManager.GetString("GetUserByName", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to SELECT Username  FROM User WHERE Email = $Email AND AppID = $AppID;.
        /// </summary>
        internal static string GetUserNameByEmail {
            get {
                return ResourceManager.GetString("GetUserNameByEmail", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to SELECT Count(*) FROM User WHERE LastActivityDate &gt; $CompareDate AND AppID = $AppID;.
        /// </summary>
        internal static string GetUsersOnline {
            get {
                return ResourceManager.GetString("GetUsersOnline", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to UPDATE User
        ///SET IsLockedOut = $IsLockedOut, LastLockedOutDate = datetime(&apos;now&apos;,&apos;utc&apos;)
        ///WHERE Username = $Username AND AppID = $AppID.
        /// </summary>
        internal static string LockOutUser {
            get {
                return ResourceManager.GetString("LockOutUser", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to SELECT FailedPasswordAttemptCount, 
        ///FailedPasswordAttemptWindowStart, 
        ///FailedPasswordAnswerAttemptCount, 
        ///FailedPasswordAnswerAttemptWindowStart 
        ///FROM User 
        ///WHERE Username = $Username AND AppID = $AppID.
        /// </summary>
        internal static string QueryFailureCount {
            get {
                return ResourceManager.GetString("QueryFailureCount", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to SELECT PasswordAnswer, IsLockedOut FROM User WHERE Username = $Username AND AppID = $AppID;.
        /// </summary>
        internal static string QueryPasswordReset {
            get {
                return ResourceManager.GetString("QueryPasswordReset", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to UPDATE User SET Password = $Password, LastPasswordChangedDate = datetime(&apos;now&apos;,&apos;utc&apos;) WHERE Username = $Username AND AppID = $AppID AND IsLockedOut = 0.
        /// </summary>
        internal static string ResetPassword {
            get {
                return ResourceManager.GetString("ResetPassword", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to UPDATE User 
        ///SET IsLockedOut = 0, LastLockedOutDate = datetime(&apos;now&apos;,&apos;utc&apos;) 
        ///WHERE Username = $Username AND AppID = $AppID;.
        /// </summary>
        internal static string UnlockUser {
            get {
                return ResourceManager.GetString("UnlockUser", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to UPDATE User 
        ///SET LastActivityDate = datetime(&apos;now&apos;,&apos;utc&apos;) 
        ///WHERE UserID = $UserID;.
        /// </summary>
        internal static string UpdateAccessTimeByID {
            get {
                return ResourceManager.GetString("UpdateAccessTimeByID", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to UPDATE User 
        ///SET FailedPasswordAnswerAttemptCount = $Count
        ///WHERE Username = $Username AND AppID = $AppID.
        /// </summary>
        internal static string UpdateAnswerFailureCount {
            get {
                return ResourceManager.GetString("UpdateAnswerFailureCount", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to UPDATE User 
        ///SET FailedPasswordAnswerAttemptCount = $Count, 
        ///FailedPasswordAnswerAttemptWindowStart = datetime(&apos;now&apos;,&apos;utc&apos;) 
        ///WHERE Username = $Username AND AppID = $AppID.
        /// </summary>
        internal static string UpdateAnswerFailureCountStart {
            get {
                return ResourceManager.GetString("UpdateAnswerFailureCountStart", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to UPDATE User SET LastLoginDate = datetime(&apos;now&apos;,&apos;utc&apos;) WHERE Username = $Username AND AppID = $AppID.
        /// </summary>
        internal static string UpdateLastLoginDate {
            get {
                return ResourceManager.GetString("UpdateLastLoginDate", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to UPDATE User 
        ///SET FailedPasswordAttemptCount = $Count
        ///WHERE Username = $Username AND AppID = $AppID.
        /// </summary>
        internal static string UpdatePasswordFailureCount {
            get {
                return ResourceManager.GetString("UpdatePasswordFailureCount", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to UPDATE User 
        ///SET FailedPasswordAttemptCount = $Count, 
        ///FailedPasswordAttemptWindowStart = datetime(&apos;now&apos;,&apos;utc&apos;) 
        ///WHERE Username = $Username AND AppID = $AppID.
        /// </summary>
        internal static string UpdatePasswordFailureCountStart {
            get {
                return ResourceManager.GetString("UpdatePasswordFailureCountStart", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to UPDATE User
        ///SET Email = $Email, Comment = $Comment,
        ///IsApproved = $IsApproved
        ///WHERE Username = $Username AND AppID = $AppID.
        /// </summary>
        internal static string UpdateUser {
            get {
                return ResourceManager.GetString("UpdateUser", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to UPDATE User SET LastActivityDate = datetime(&apos;now&apos;,&apos;utc&apos;) WHERE Username = $Username AND AppID = $AppID;.
        /// </summary>
        internal static string UpdateUserAccessTimeByName {
            get {
                return ResourceManager.GetString("UpdateUserAccessTimeByName", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to SELECT Password, IsApproved FROM User WHERE Username = $Username AND AppID = $AppID AND IsLockedOut = 0.
        /// </summary>
        internal static string ValidateUser {
            get {
                return ResourceManager.GetString("ValidateUser", resourceCulture);
            }
        }
    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































































































































































































































































































































































































































































































Deleted Membership/Sql/MembershipSql.resx.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<?xml version="1.0" encoding="utf-8"?>
<root>
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <data name="ChangePassword" xml:space="preserve">
    <value>UPDATE User SET Password = $Password, LastPasswordChangedDate = datetime('now','utc') WHERE Username = $Username AND AppID = $AppID;</value>
  </data>
  <data name="ChangePasswordQA" xml:space="preserve">
    <value>UPDATE User SET PasswordQuestion = $Question, PasswordAnswer = $Answer WHERE Username = $Username AND AppID = $AppID;</value>
  </data>
  <data name="CreateUser" xml:space="preserve">
    <value>INSERT INTO User
(
	Username,
	Password,
	Email,
	PasswordQuestion,
	PasswordAnswer,
	IsApproved,
	Comment,
	CreationDate,
	LastPasswordChangedDate,
	LastActivityDate,
	AppID,
	IsLockedOut,
	LastLockedOutDate,
	FailedPasswordAttemptCount,
	FailedPasswordAttemptWindowStart,
	FailedPasswordAnswerAttemptCount,
	FailedPasswordAnswerAttemptWindowStart
)
Values(
	$Username,
	$Password,
	$Email,
	$PasswordQuestion,
	$PasswordAnswer,
	$IsApproved,
	'',
	datetime('now','utc'),
	datetime('now','utc'),
	datetime('now','utc'),
	$AppID,
	$IsLockedOut,
	datetime('now','utc'),
	0,
	datetime('now','utc'),
	0,
	datetime('now','utc')
);</value>
  </data>
  <data name="DeleteUser" xml:space="preserve">
    <value>DELETE FROM User WHERE Username = $Username AND AppID = $AppID;</value>
  </data>
  <data name="FindUsersByEmail" xml:space="preserve">
    <value>SELECT UserID, Username, Email, PasswordQuestion,
Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate,
LastActivityDate, LastPasswordChangedDate, LastLockedOutDate 
FROM User 
WHERE Email LIKE $EmailSearch AND AppID = $AppID 
ORDER BY Username Asc
LIMIT $Count, $Skip </value>
  </data>
  <data name="FindUsersByName" xml:space="preserve">
    <value>SELECT UserID, Username, Email, PasswordQuestion,
Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate,
LastActivityDate, LastPasswordChangedDate, LastLockedOutDate 
FROM User 
WHERE Username LIKE $UsernameSearch AND AppID = $AppID
ORDER BY Username Asc
LIMIT $Count, $Skip </value>
  </data>
  <data name="GetAppUsers" xml:space="preserve">
    <value>SELECT 
	UserID, Username, Email, PasswordQuestion, Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate, LastActivityDate, LastPasswordChangedDate, LastLockedOutDate 
FROM 
	User 
WHERE 
	AppID = $AppID 
ORDER BY 
	Username Asc
LIMIT
	$Skip, $Count</value>
  </data>
  <data name="GetPassword" xml:space="preserve">
    <value>SELECT Password, PasswordAnswer, IsLockedOut FROM User WHERE Username = $Username AND AppID = $AppID;</value>
  </data>
  <data name="GetUserByID" xml:space="preserve">
    <value>SELECT UserID, Username, Email, PasswordQuestion,
Comment, IsApproved, IsLockedOut, CreationDate, LastLoginDate,
LastActivityDate, LastPasswordChangedDate, LastLockedOutDate
FROM User WHERE UserID = $UserID;</value>
  </data>
  <data name="GetUserByName" xml:space="preserve">
    <value>SELECT 
	UserID, Username, Email, PasswordQuestion, Comment, 
	IsApproved, IsLockedOut, CreationDate, LastLoginDate, 
	LastActivityDate, LastPasswordChangedDate, LastLockedOutDate 
FROM 
	User 
WHERE 
	Username = $Username AND AppID = $AppID;</value>
  </data>
  <data name="GetUserNameByEmail" xml:space="preserve">
    <value>SELECT Username  FROM User WHERE Email = $Email AND AppID = $AppID;</value>
  </data>
  <data name="GetUsersOnline" xml:space="preserve">
    <value>SELECT Count(*) FROM User WHERE LastActivityDate &gt; $CompareDate AND AppID = $AppID;</value>
  </data>
  <data name="LockOutUser" xml:space="preserve">
    <value>UPDATE User
SET IsLockedOut = $IsLockedOut, LastLockedOutDate = datetime('now','utc')
WHERE Username = $Username AND AppID = $AppID</value>
  </data>
  <data name="QueryFailureCount" xml:space="preserve">
    <value>SELECT FailedPasswordAttemptCount, 
FailedPasswordAttemptWindowStart, 
FailedPasswordAnswerAttemptCount, 
FailedPasswordAnswerAttemptWindowStart 
FROM User 
WHERE Username = $Username AND AppID = $AppID</value>
  </data>
  <data name="QueryPasswordReset" xml:space="preserve">
    <value>SELECT PasswordAnswer, IsLockedOut FROM User WHERE Username = $Username AND AppID = $AppID;</value>
  </data>
  <data name="ResetPassword" xml:space="preserve">
    <value>UPDATE User SET Password = $Password, LastPasswordChangedDate = datetime('now','utc') WHERE Username = $Username AND AppID = $AppID AND IsLockedOut = 0</value>
  </data>
  <data name="UnlockUser" xml:space="preserve">
    <value>UPDATE User 
SET IsLockedOut = 0, LastLockedOutDate = datetime('now','utc') 
WHERE Username = $Username AND AppID = $AppID;</value>
  </data>
  <data name="UpdateAccessTimeByID" xml:space="preserve">
    <value>UPDATE User 
SET LastActivityDate = datetime('now','utc') 
WHERE UserID = $UserID;</value>
  </data>
  <data name="UpdateAnswerFailureCount" xml:space="preserve">
    <value>UPDATE User 
SET FailedPasswordAnswerAttemptCount = $Count
WHERE Username = $Username AND AppID = $AppID</value>
  </data>
  <data name="UpdateAnswerFailureCountStart" xml:space="preserve">
    <value>UPDATE User 
SET FailedPasswordAnswerAttemptCount = $Count, 
FailedPasswordAnswerAttemptWindowStart = datetime('now','utc') 
WHERE Username = $Username AND AppID = $AppID</value>
  </data>
  <data name="UpdateLastLoginDate" xml:space="preserve">
    <value>UPDATE User SET LastLoginDate = datetime('now','utc') WHERE Username = $Username AND AppID = $AppID</value>
  </data>
  <data name="UpdatePasswordFailureCount" xml:space="preserve">
    <value>UPDATE User 
SET FailedPasswordAttemptCount = $Count
WHERE Username = $Username AND AppID = $AppID</value>
  </data>
  <data name="UpdatePasswordFailureCountStart" xml:space="preserve">
    <value>UPDATE User 
SET FailedPasswordAttemptCount = $Count, 
FailedPasswordAttemptWindowStart = datetime('now','utc') 
WHERE Username = $Username AND AppID = $AppID</value>
  </data>
  <data name="UpdateUser" xml:space="preserve">
    <value>UPDATE User
SET Email = $Email, Comment = $Comment,
IsApproved = $IsApproved
WHERE Username = $Username AND AppID = $AppID</value>
  </data>
  <data name="UpdateUserAccessTimeByName" xml:space="preserve">
    <value>UPDATE User SET LastActivityDate = datetime('now','utc') WHERE Username = $Username AND AppID = $AppID;</value>
  </data>
  <data name="ValidateUser" xml:space="preserve">
    <value>SELECT Password, IsApproved FROM User WHERE Username = $Username AND AppID = $AppID AND IsLockedOut = 0</value>
  </data>
</root>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































































































































































































































































Deleted Membership/Sql/RoleSql.Designer.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.42
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace SQLiteProvider {
    using System;
    
    
    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class RoleSql {
        
        private static global::System.Resources.ResourceManager resourceMan;
        
        private static global::System.Globalization.CultureInfo resourceCulture;
        
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal RoleSql() {
        }
        
        /// <summary>
        ///   Returns the cached ResourceManager instance used by this class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SQLiteProvider.Sql.RoleSql", typeof(RoleSql).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }
        
        /// <summary>
        ///   Overrides the current thread's CurrentUICulture property for all
        ///   resource lookups using this strongly typed resource class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to Insert into UserRoleMap
        ///	(UserID, RoleID, AppID) values
        ///	(
        ///		(Select UserID from User where Username = $Username and AppID = $AppID),
        ///		(Select RoleID from Role where Rolename = $Rolename and AppID = $AppID),
        ///		$AppID
        ///	);.
        /// </summary>
        internal static string AddUserToRole {
            get {
                return ResourceManager.GetString("AddUserToRole", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to Insert into Role (Rolename, AppID) values ($Rolename, $AppID);.
        /// </summary>
        internal static string CreateRole {
            get {
                return ResourceManager.GetString("CreateRole", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to DELETE FROM Role WHERE Rolename = $Rolename AND AppID = $AppID.
        /// </summary>
        internal static string DeleteRole {
            get {
                return ResourceManager.GetString("DeleteRole", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to DELETE FROM UserRoleMap WHERE RoleID = (Select RoleID from Role where Rolename = $Rolename  AND AppID = $AppID) AND AppID = $AppID.
        /// </summary>
        internal static string DeleteRoleFromMap {
            get {
                return ResourceManager.GetString("DeleteRoleFromMap", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to Delete From UserRoleMap
        ///Where
        ///UserID = (Select UserID from User where Username = $Username and AppID = $AppID)
        ///AND
        ///RoleID = (Select RoleID from Role Where Rolename = $Rolename AND AppID = $AppID);
        ///.
        /// </summary>
        internal static string DeleteUserFromRole {
            get {
                return ResourceManager.GetString("DeleteUserFromRole", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to Select User.Username from User
        ///Inner Join UserRoleMap on User.UserID = UserRoleMap.UserID
        ///Inner Join Role on UserRoleMap.RoleID = Role.RoleID
        ///Where Role.Rolename = $RoleName and Role.AppID = $AppID and User.Username Like $Username;.
        /// </summary>
        internal static string FindUsersInRole {
            get {
                return ResourceManager.GetString("FindUsersInRole", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to SELECT Rolename FROM Role WHERE AppID = $AppID.
        /// </summary>
        internal static string GetAllRoles {
            get {
                return ResourceManager.GetString("GetAllRoles", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to Select Rolename from Role
        ///Inner Join UserRoleMap On Role.RoleID = UserRoleMap.RoleID and Role.AppID = UserRoleMap.AppID
        ///Inner Join User On User.UserID = UserRoleMap.UserID and User.AppID = UserRoleMap.AppID
        ///Where User.Username = $Username and User.AppID = $AppID;.
        /// </summary>
        internal static string GetRolesForUser {
            get {
                return ResourceManager.GetString("GetRolesForUser", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to Select User.Username from User
        ///Inner Join UserRoleMap on User.UserID = UserRoleMap.UserID
        ///Inner Join Role on UserRoleMap.RoleID = Role.RoleID
        ///Where Role.Rolename = $RoleName and Role.AppID = $AppID;
        ///.
        /// </summary>
        internal static string GetUsersInRole {
            get {
                return ResourceManager.GetString("GetUsersInRole", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to Select Count(*) from User
        ///Inner Join UserRoleMap on User.UserID = UserRoleMap.UserID
        ///Inner Join Role on UserRoleMap.RoleID = Role.RoleID
        ///Where Role.Rolename = $Rolename  and User.Username=$Username and Role.AppID = $AppID;.
        /// </summary>
        internal static string IsUserInRole {
            get {
                return ResourceManager.GetString("IsUserInRole", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to SELECT COUNT(*) FROM Role WHERE Rolename = $Rolename AND AppID = $AppID;.
        /// </summary>
        internal static string RoleExists {
            get {
                return ResourceManager.GetString("RoleExists", resourceCulture);
            }
        }
    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































































































































Deleted Membership/Sql/RoleSql.resx.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!-- 
    Microsoft ResX Schema 
    
    Version 2.0
    
    The primary goals of this format is to allow a simple XML format 
    that is mostly human readable. The generation and parsing of the 
    various data types are done through the TypeConverter classes 
    associated with the data types.
    
    Example:
    
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
                
    There are any number of "resheader" rows that contain simple 
    name/value pairs.
    
    Each data row contains a name, and value. The row also contains a 
    type or mimetype. Type corresponds to a .NET class that support 
    text/value conversion through the TypeConverter architecture. 
    Classes that don't support this are serialized and stored with the 
    mimetype set.
    
    The mimetype is used for serialized objects, and tells the 
    ResXResourceReader how to depersist the object. This is currently not 
    extensible. For a given mimetype the value must be set accordingly:
    
    Note - application/x-microsoft.net.object.binary.base64 is the format 
    that the ResXResourceWriter will generate, however the reader can 
    read any of the formats listed below.
    
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array 
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <data name="AddUserToRole" xml:space="preserve">
    <value>Insert into UserRoleMap
	(UserID, RoleID, AppID) values
	(
		(Select UserID from User where Username = $Username and AppID = $AppID),
		(Select RoleID from Role where Rolename = $Rolename and AppID = $AppID),
		$AppID
	);</value>
  </data>
  <data name="CreateRole" xml:space="preserve">
    <value>Insert into Role (Rolename, AppID) values ($Rolename, $AppID);</value>
  </data>
  <data name="DeleteRole" xml:space="preserve">
    <value>DELETE FROM Role WHERE Rolename = $Rolename AND AppID = $AppID</value>
  </data>
  <data name="DeleteRoleFromMap" xml:space="preserve">
    <value>DELETE FROM UserRoleMap WHERE RoleID = (Select RoleID from Role where Rolename = $Rolename  AND AppID = $AppID) AND AppID = $AppID</value>
  </data>
  <data name="DeleteUserFromRole" xml:space="preserve">
    <value>Delete From UserRoleMap
Where
UserID = (Select UserID from User where Username = $Username and AppID = $AppID)
AND
RoleID = (Select RoleID from Role Where Rolename = $Rolename AND AppID = $AppID);
</value>
  </data>
  <data name="FindUsersInRole" xml:space="preserve">
    <value>Select User.Username from User
Inner Join UserRoleMap on User.UserID = UserRoleMap.UserID
Inner Join Role on UserRoleMap.RoleID = Role.RoleID
Where Role.Rolename = $RoleName and Role.AppID = $AppID and User.Username Like $Username;</value>
  </data>
  <data name="GetAllRoles" xml:space="preserve">
    <value>SELECT Rolename FROM Role WHERE AppID = $AppID</value>
  </data>
  <data name="GetRolesForUser" xml:space="preserve">
    <value>Select Rolename from Role
Inner Join UserRoleMap On Role.RoleID = UserRoleMap.RoleID and Role.AppID = UserRoleMap.AppID
Inner Join User On User.UserID = UserRoleMap.UserID and User.AppID = UserRoleMap.AppID
Where User.Username = $Username and User.AppID = $AppID;</value>
  </data>
  <data name="GetUsersInRole" xml:space="preserve">
    <value>Select User.Username from User
Inner Join UserRoleMap on User.UserID = UserRoleMap.UserID
Inner Join Role on UserRoleMap.RoleID = Role.RoleID
Where Role.Rolename = $RoleName and Role.AppID = $AppID;
</value>
  </data>
  <data name="IsUserInRole" xml:space="preserve">
    <value>Select Count(*) from User
Inner Join UserRoleMap on User.UserID = UserRoleMap.UserID
Inner Join Role on UserRoleMap.RoleID = Role.RoleID
Where Role.Rolename = $Rolename  and User.Username=$Username and Role.AppID = $AppID;</value>
  </data>
  <data name="RoleExists" xml:space="preserve">
    <value>SELECT COUNT(*) FROM Role WHERE Rolename = $Rolename AND AppID = $AppID;</value>
  </data>
</root>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































































Deleted Membership/Sql/Schema.sql.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Create Table Application(
  AppID  INTEGER PRIMARY KEY,
  ApplicationName text
);

Create Table Role(
	RoleID INTEGER PRIMARY KEY,
	Rolename text,
	AppID integer NOT NULL
);

Create Table UserRoleMap(
	UserID integer NOT NULL,
	RoleID integer NOT NULL,
	AppID integer NOT NULL
);
	
CREATE TABLE User
(
  UserID INTEGER PRIMARY KEY,
  Username text NOT NULL,
  AppID integer NOT NULL,
  Email text  NOT NULL,
  Comment text,
  Password text NOT NULL,
  PasswordQuestion text,
  PasswordAnswer text,
  IsApproved bool, 
  LastActivityDate DateTime,
  LastLoginDate DateTime,
  LastPasswordChangedDate DateTime,
  CreationDate DateTime, 
  IsOnLine bool,
  IsLockedOut bool,
  LastLockedOutDate DateTime,
  FailedPasswordAttemptCount integer,
  FailedPasswordAttemptWindowStart DateTime,
  FailedPasswordAnswerAttemptCount integer,
  FailedPasswordAnswerAttemptWindowStart DateTime
);

Create Table SiteMapNode(
	NodeID	INTEGER PRIMARY KEY,
	AppID integer NOT NULL,
	Title text,
	Description text,
	Url text,
	Parent integer
);

Create Table SiteMapNodeRoles(
	NodeID integer NOT NULL,
	RoleID integer NOT NULL,
	AppID integer NOT NULL
);


Create Table Profile(
	ProfileID INTEGER PRIMARY KEY,
	UserName text NOT NULL,
	AppID integer NOT NULL,
	LastUpdatedDate Datetime,
	LastActivityDate Datetime
);

Create Table ProfileData(
	ItemID INTEGER PRIMARY KEY,
	ProfileID integer NOT NULL,
	ItemData BLOB,
	ItemName text NOT NULL,
	ItemFormat text NOT NULL
);
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































Deleted Membership/Sql/SiteMapSql.Designer.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.42
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace SQLiteProvider {
    using System;
    
    
    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class SiteMapSql {
        
        private static global::System.Resources.ResourceManager resourceMan;
        
        private static global::System.Globalization.CultureInfo resourceCulture;
        
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal SiteMapSql() {
        }
        
        /// <summary>
        ///   Returns the cached ResourceManager instance used by this class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SQLiteProvider.Sql.SiteMapSql", typeof(SiteMapSql).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }
        
        /// <summary>
        ///   Overrides the current thread's CurrentUICulture property for all
        ///   resource lookups using this strongly typed resource class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to Select NodeID, Title, Description, Url from SiteMapNode where AppID = $AppID and Parent = $ParentID;.
        /// </summary>
        internal static string GetNodeByParentID {
            get {
                return ResourceManager.GetString("GetNodeByParentID", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to Select NodeID Title, Description, Url from SiteMapNode where AppID = $AppID and Url like $Url;.
        /// </summary>
        internal static string GetNodeByUrl {
            get {
                return ResourceManager.GetString("GetNodeByUrl", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to Select RoleName from Role
        ///Inner Join SiteMapNodeRoles on Role.RoleID = SiteMapNodeRoles.RoleID and Role.AppID = SiteMapNodeRoles.AppID
        ///Where SiteMapNodeRoles.NodeID = $NodeID and Role.AppID = $AppID;.
        /// </summary>
        internal static string GetNodeRoles {
            get {
                return ResourceManager.GetString("GetNodeRoles", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to Select NodeID, Title, Description, Url, Parent from SiteMapNode where AppID = $AppID order by Parent;.
        /// </summary>
        internal static string GetNodes {
            get {
                return ResourceManager.GetString("GetNodes", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to Select Parent.NodeID, Parent.Title, Parent.Description, Parent.Url from SiteMapNode Parent
        ///left join SiteMapNode Child on Parent.NodeID = Child.Parent and Parent.AppID = Child.AppID
        ///where Child.AppID = $AppID and Child.NodeID = $NodeID;.
        /// </summary>
        internal static string GetParentByNodeID {
            get {
                return ResourceManager.GetString("GetParentByNodeID", resourceCulture);
            }
        }
    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































Deleted Membership/Sql/SiteMapSql.resx.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!-- 
    Microsoft ResX Schema 
    
    Version 2.0
    
    The primary goals of this format is to allow a simple XML format 
    that is mostly human readable. The generation and parsing of the 
    various data types are done through the TypeConverter classes 
    associated with the data types.
    
    Example:
    
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
                
    There are any number of "resheader" rows that contain simple 
    name/value pairs.
    
    Each data row contains a name, and value. The row also contains a 
    type or mimetype. Type corresponds to a .NET class that support 
    text/value conversion through the TypeConverter architecture. 
    Classes that don't support this are serialized and stored with the 
    mimetype set.
    
    The mimetype is used for serialized objects, and tells the 
    ResXResourceReader how to depersist the object. This is currently not 
    extensible. For a given mimetype the value must be set accordingly:
    
    Note - application/x-microsoft.net.object.binary.base64 is the format 
    that the ResXResourceWriter will generate, however the reader can 
    read any of the formats listed below.
    
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array 
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <data name="GetNodeByParentID" xml:space="preserve">
    <value>Select NodeID, Title, Description, Url from SiteMapNode where AppID = $AppID and Parent = $ParentID;</value>
  </data>
  <data name="GetNodeByUrl" xml:space="preserve">
    <value>Select NodeID Title, Description, Url from SiteMapNode where AppID = $AppID and Url like $Url;</value>
  </data>
  <data name="GetNodeRoles" xml:space="preserve">
    <value>Select RoleName from Role
Inner Join SiteMapNodeRoles on Role.RoleID = SiteMapNodeRoles.RoleID and Role.AppID = SiteMapNodeRoles.AppID
Where SiteMapNodeRoles.NodeID = $NodeID and Role.AppID = $AppID;</value>
  </data>
  <data name="GetNodes" xml:space="preserve">
    <value>Select NodeID, Title, Description, Url, Parent from SiteMapNode where AppID = $AppID order by Parent;</value>
  </data>
  <data name="GetParentByNodeID" xml:space="preserve">
    <value>Select Parent.NodeID, Parent.Title, Parent.Description, Parent.Url from SiteMapNode Parent
left join SiteMapNode Child on Parent.NodeID = Child.Parent and Parent.AppID = Child.AppID
where Child.AppID = $AppID and Child.NodeID = $NodeID;</value>
  </data>
</root>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































Deleted Membership/TODO.txt.

1
2
3
4
5
6
7
8

Optimize SQL.
Write some documentation eg: how to configure the provider via web.config
Dump SQL statements to some sort of human readable format & possibly document them.

? Create a default DB location & make the schema a resource so one can just plunk the provider in and have it just work with little or no config.
? Implement Profile Provider
? Implement a fully dynamic SiteMap Provider so changes to the DB get reflected immediatly
<
<
<
<
<
<
<
<
















Deleted Membership/Utiliy/ProviderUtility.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
using System.Web.Security;
using System.Configuration.Provider;
using System.Collections.Specialized;
using System;
using System.Data;
using System.Data.SQLite;
using System.Configuration;
using System.Diagnostics;
using System.Web;
using System.Globalization;

namespace SQLiteProvider
{
    internal class ProviderUtility
    {

        public static void HandleException(Exception e, string source, string action, bool logging)
        {
            if (logging)
            {
                EventLog log = new EventLog();
                log.Source = source;
                log.Log = "Application";

                string message = "An exception occurred communicating with the data source.\n\n";
                message += "Action: " + action + "\n\n";
                message += "Exception: " + e.ToString();

                log.WriteEntry(message);
                throw new ProviderException("An exception occurred. Please check the Event Log.");
            }
            else
            {
                string msg = String.Format("An exception occured during {0} in {1}. \n Message:{2}", action, source, e.Message );
                throw new ProviderException(msg, e);
            }
        }
        public static long GetApplicationID(String ConnString, string AppName)
        {
            long AppID = 0;
            SQLiteConnection conn = new SQLiteConnection(ConnString);
            SQLiteCommand existsCmd = new SQLiteCommand(ApplicationSql.AppExists, conn);
            SQLiteCommand idCmd = new SQLiteCommand(ApplicationSql.GetAppID, conn);
            SQLiteCommand insertCmd = new SQLiteCommand(ApplicationSql.InsertApp, conn);

            existsCmd.Parameters.Add("$ApplicationName", DbType.String).Value = AppName;
            idCmd.Parameters.Add("$ApplicationName", DbType.String).Value = AppName;
            insertCmd.Parameters.Add("$ApplicationName", DbType.String).Value = AppName;
            try
            {
                conn.Open();
                if (((long)existsCmd.ExecuteScalar()) == 0)
                {
                    insertCmd.ExecuteNonQuery();
                }
                AppID = (long)idCmd.ExecuteScalar();

            }
            catch (SQLiteException e)
            {
                ProviderUtility.HandleException(e, "Utility", "ApplicationName Property", false);
            }
            finally
            {
                conn.Close();
            }
            return AppID;
        }

        public static string GetConnectionString(string csName)
        {
            string cs = "";
            ConnectionStringSettings css = ConfigurationManager.ConnectionStrings[csName];

            if (css == null || css.ConnectionString.Trim() == "")
            {
                // use default location, creating the DB if need be
                throw new ProviderException("Connection string cannot be blank.");
            }
            else
            {
                cs = css.ConnectionString;
            }
            return cs;
        }
        public static string GetApplicationName(string appName)
        {
            return (String.IsNullOrEmpty(appName)? System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath:appName);
        }
        public static bool GetExceptionDesitination(string exToLog)
        {
            bool res = false;
            if (!String.IsNullOrEmpty(exToLog) && exToLog.ToUpper() == "TRUE")
            {
                res = true;
            }
            return res;
        }
    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































































Deleted Membership/app.config.

1
2
3
4
5
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
    </configSections>
</configuration>
<
<
<
<
<










Added NuGet/SQLite.Beta.nuspec.





























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Beta.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.Beta</id>
    <title>System.Data.SQLite (x86/x64) Beta</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>This is a &quot;beta&quot; package and is not intended for production use.  The official SQLite database engine for both x86 and x64 along with the ADO.NET provider.  This package includes support for LINQ and Entity Framework 6.</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net20">
        <dependency id="System.Data.SQLite.Core.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.Core.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.Core.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.Core.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.Core.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.0">
        <dependency id="System.Data.SQLite.Core.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.1">
        <dependency id="System.Data.SQLite.Core.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net20">
        <dependency id="System.Data.SQLite.Linq.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.Linq.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.Linq.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.Linq.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.Linq.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.EF6.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.EF6.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.EF6.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.EF6.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.1">
        <dependency id="System.Data.SQLite.EF6.Beta" version="[1.0.119.0]" />
      </group>
    </dependencies>
  </metadata>
  <files />
</package>

Added NuGet/SQLite.Core.Beta.nuspec.

































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Core.Beta.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.Core.Beta</id>
    <title>System.Data.SQLite Core (x86/x64) Beta</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>This is a &quot;beta&quot; package and is not intended for production use.  The official SQLite database engine for both x86 and x64 along with the ADO.NET provider.</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net20" />
      <group targetFramework="net40" />
      <group targetFramework="net45" />
      <group targetFramework="net451" />
      <group targetFramework="net46" />
      <group targetFramework="netstandard2.0" />
      <group targetFramework="netstandard2.1" />
    </dependencies>
  </metadata>
  <files>
    <file src="..\bin\2008\Release\bin\System.Data.SQLite.dll" target="lib\net20" />
    <file src="..\bin\2008\Release\bin\System.Data.SQLite.xml" target="lib\net20" />
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.dll" target="lib\net40" />
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.xml" target="lib\net40" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.dll" target="lib\net45" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.xml" target="lib\net45" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.dll" target="lib\net451" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.xml" target="lib\net451" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.dll" target="lib\net46" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.xml" target="lib\net46" />
    <file src="..\bin\NetStandard20\ReleaseNetStandard20\bin\netstandard2.0\System.Data.SQLite.dll" target="lib\netstandard2.0" />
    <file src="..\bin\NetStandard20\ReleaseNetStandard20\bin\netstandard2.0\System.Data.SQLite.xml" target="lib\netstandard2.0" />
    <file src="..\bin\NetStandard21\ReleaseNetStandard21\bin\netstandard2.1\System.Data.SQLite.dll" target="lib\netstandard2.1" />
    <file src="..\bin\NetStandard21\ReleaseNetStandard21\bin\netstandard2.1\System.Data.SQLite.xml" target="lib\netstandard2.1" />
    <file src="..\bin\2008\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net20\x86" />
    <file src="..\bin\2008\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net20\x64" />
    <file src="..\bin\2010\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net40\x86" />
    <file src="..\bin\2010\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net40\x64" />
    <file src="..\bin\2012\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net45\x86" />
    <file src="..\bin\2012\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net45\x64" />
    <file src="..\bin\2013\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net451\x86" />
    <file src="..\bin\2013\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net451\x64" />
    <file src="..\bin\2015\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net46\x86" />
    <file src="..\bin\2015\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net46\x64" />
    <file src="..\bin\2015\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="runtimes\win-x86\native" />
    <file src="..\bin\2015\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="runtimes\win-x64\native" />
    <file src="..\bin\2016\linux-x64\ReleaseNativeOnly\SQLite.Interop.dll" target="runtimes\linux-x64\native" />
    <file src="..\bin\2016\osx-x64\ReleaseNativeOnly\SQLite.Interop.dll" target="runtimes\osx-x64\native" />
    <file src="shared\Core\build\System.Data.SQLite.Core.NetFramework.targets" target="build\net20\System.Data.SQLite.Core.Beta.targets" />
    <file src="shared\Core\build\System.Data.SQLite.Core.NetFramework.targets" target="build\net40\System.Data.SQLite.Core.Beta.targets" />
    <file src="shared\Core\build\System.Data.SQLite.Core.NetFramework.targets" target="build\net45\System.Data.SQLite.Core.Beta.targets" />
    <file src="shared\Core\build\System.Data.SQLite.Core.NetFramework.targets" target="build\net451\System.Data.SQLite.Core.Beta.targets" />
    <file src="shared\Core\build\System.Data.SQLite.Core.NetFramework.targets" target="build\net46\System.Data.SQLite.Core.Beta.targets" />
    <file src="shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets" target="buildTransitive\net20\System.Data.SQLite.Core.Beta.targets" />
    <file src="shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets" target="buildTransitive\net40\System.Data.SQLite.Core.Beta.targets" />
    <file src="shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets" target="buildTransitive\net45\System.Data.SQLite.Core.Beta.targets" />
    <file src="shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets" target="buildTransitive\net451\System.Data.SQLite.Core.Beta.targets" />
    <file src="shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets" target="buildTransitive\net46\System.Data.SQLite.Core.Beta.targets" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\net20" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\net40" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\net45" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\net451" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\net46" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\netstandard2.0" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\netstandard2.1" />
  </files>
</package>

Added NuGet/SQLite.Core.MSIL.Beta.nuspec.



































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Core.MSIL.Beta.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.Core.MSIL.Beta</id>
    <title>System.Data.SQLite (MSIL) Beta</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>This is a &quot;beta&quot; package and is not intended for production use.  An ADO.NET provider for SQLite (managed-only).</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net20" />
      <group targetFramework="net40" />
      <group targetFramework="net45" />
      <group targetFramework="net451" />
      <group targetFramework="net46" />
      <group targetFramework="netstandard2.0" />
      <group targetFramework="netstandard2.1" />
    </dependencies>
  </metadata>
  <files>
    <file src="..\bin\2008\Release\bin\System.Data.SQLite.dll" target="lib\net20" />
    <file src="..\bin\2008\Release\bin\System.Data.SQLite.xml" target="lib\net20" />
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.dll" target="lib\net40" />
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.xml" target="lib\net40" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.dll" target="lib\net45" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.xml" target="lib\net45" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.dll" target="lib\net451" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.xml" target="lib\net451" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.dll" target="lib\net46" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.xml" target="lib\net46" />
    <file src="..\bin\NetStandard20\ReleaseNetStandard20\bin\netstandard2.0\System.Data.SQLite.dll" target="lib\netstandard2.0" />
    <file src="..\bin\NetStandard20\ReleaseNetStandard20\bin\netstandard2.0\System.Data.SQLite.xml" target="lib\netstandard2.0" />
    <file src="..\bin\NetStandard21\ReleaseNetStandard21\bin\netstandard2.1\System.Data.SQLite.dll" target="lib\netstandard2.1" />
    <file src="..\bin\NetStandard21\ReleaseNetStandard21\bin\netstandard2.1\System.Data.SQLite.xml" target="lib\netstandard2.1" />
  </files>
</package>

Added NuGet/SQLite.Core.MSIL.Test.nuspec.



































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Core.MSIL.Test.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.Core.MSIL.Test</id>
    <title>System.Data.SQLite (MSIL) Test</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>This is a pre-release package and is not intended for production use.  An ADO.NET provider for SQLite (managed-only).</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net20" />
      <group targetFramework="net40" />
      <group targetFramework="net45" />
      <group targetFramework="net451" />
      <group targetFramework="net46" />
      <group targetFramework="netstandard2.0" />
      <group targetFramework="netstandard2.1" />
    </dependencies>
  </metadata>
  <files>
    <file src="..\bin\2008\Release\bin\System.Data.SQLite.dll" target="lib\net20" />
    <file src="..\bin\2008\Release\bin\System.Data.SQLite.xml" target="lib\net20" />
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.dll" target="lib\net40" />
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.xml" target="lib\net40" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.dll" target="lib\net45" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.xml" target="lib\net45" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.dll" target="lib\net451" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.xml" target="lib\net451" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.dll" target="lib\net46" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.xml" target="lib\net46" />
    <file src="..\bin\NetStandard20\ReleaseNetStandard20\bin\netstandard2.0\System.Data.SQLite.dll" target="lib\netstandard2.0" />
    <file src="..\bin\NetStandard20\ReleaseNetStandard20\bin\netstandard2.0\System.Data.SQLite.xml" target="lib\netstandard2.0" />
    <file src="..\bin\NetStandard21\ReleaseNetStandard21\bin\netstandard2.1\System.Data.SQLite.dll" target="lib\netstandard2.1" />
    <file src="..\bin\NetStandard21\ReleaseNetStandard21\bin\netstandard2.1\System.Data.SQLite.xml" target="lib\netstandard2.1" />
  </files>
</package>

Added NuGet/SQLite.Core.MSIL.nuspec.



































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Core.MSIL.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.Core.MSIL</id>
    <title>System.Data.SQLite Core (MSIL)</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>An ADO.NET provider for SQLite (managed-only).</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net20" />
      <group targetFramework="net40" />
      <group targetFramework="net45" />
      <group targetFramework="net451" />
      <group targetFramework="net46" />
      <group targetFramework="netstandard2.0" />
      <group targetFramework="netstandard2.1" />
    </dependencies>
  </metadata>
  <files>
    <file src="..\bin\2008\Release\bin\System.Data.SQLite.dll" target="lib\net20" />
    <file src="..\bin\2008\Release\bin\System.Data.SQLite.xml" target="lib\net20" />
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.dll" target="lib\net40" />
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.xml" target="lib\net40" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.dll" target="lib\net45" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.xml" target="lib\net45" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.dll" target="lib\net451" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.xml" target="lib\net451" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.dll" target="lib\net46" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.xml" target="lib\net46" />
    <file src="..\bin\NetStandard20\ReleaseNetStandard20\bin\netstandard2.0\System.Data.SQLite.dll" target="lib\netstandard2.0" />
    <file src="..\bin\NetStandard20\ReleaseNetStandard20\bin\netstandard2.0\System.Data.SQLite.xml" target="lib\netstandard2.0" />
    <file src="..\bin\NetStandard21\ReleaseNetStandard21\bin\netstandard2.1\System.Data.SQLite.dll" target="lib\netstandard2.1" />
    <file src="..\bin\NetStandard21\ReleaseNetStandard21\bin\netstandard2.1\System.Data.SQLite.xml" target="lib\netstandard2.1" />
  </files>
</package>

Added NuGet/SQLite.Core.NetFramework.nuspec.









































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Core.NetFramework.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>Stub.System.Data.SQLite.Core.NetFramework</id>
    <title>System.Data.SQLite Core for the .NET Framework (x86/x64)</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>The official SQLite database engine for both x86 and x64 along with the ADO.NET provider.</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net20" />
      <group targetFramework="net40" />
      <group targetFramework="net45" />
      <group targetFramework="net451" />
      <group targetFramework="net46" />
    </dependencies>
  </metadata>
  <files>
    <file src="..\bin\2008\Release\bin\System.Data.SQLite.dll" target="lib\net20" />
    <file src="..\bin\2008\Release\bin\System.Data.SQLite.xml" target="lib\net20" />
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.dll" target="lib\net40" />
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.xml" target="lib\net40" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.dll" target="lib\net45" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.xml" target="lib\net45" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.dll" target="lib\net451" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.xml" target="lib\net451" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.dll" target="lib\net46" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.xml" target="lib\net46" />
    <file src="..\bin\2008\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net20\x86" />
    <file src="..\bin\2008\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net20\x64" />
    <file src="..\bin\2010\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net40\x86" />
    <file src="..\bin\2010\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net40\x64" />
    <file src="..\bin\2012\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net45\x86" />
    <file src="..\bin\2012\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net45\x64" />
    <file src="..\bin\2013\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net451\x86" />
    <file src="..\bin\2013\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net451\x64" />
    <file src="..\bin\2015\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net46\x86" />
    <file src="..\bin\2015\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net46\x64" />
    <file src="shared\Core\build\System.Data.SQLite.Core.NetFramework.targets" target="build\net20\Stub.System.Data.SQLite.Core.NetFramework.targets" />
    <file src="shared\Core\build\System.Data.SQLite.Core.NetFramework.targets" target="build\net40\Stub.System.Data.SQLite.Core.NetFramework.targets" />
    <file src="shared\Core\build\System.Data.SQLite.Core.NetFramework.targets" target="build\net45\Stub.System.Data.SQLite.Core.NetFramework.targets" />
    <file src="shared\Core\build\System.Data.SQLite.Core.NetFramework.targets" target="build\net451\Stub.System.Data.SQLite.Core.NetFramework.targets" />
    <file src="shared\Core\build\System.Data.SQLite.Core.NetFramework.targets" target="build\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" />
    <file src="shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets" target="buildTransitive\net20\Stub.System.Data.SQLite.Core.NetFramework.targets" />
    <file src="shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets" target="buildTransitive\net40\Stub.System.Data.SQLite.Core.NetFramework.targets" />
    <file src="shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets" target="buildTransitive\net45\Stub.System.Data.SQLite.Core.NetFramework.targets" />
    <file src="shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets" target="buildTransitive\net451\Stub.System.Data.SQLite.Core.NetFramework.targets" />
    <file src="shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets" target="buildTransitive\net46\Stub.System.Data.SQLite.Core.NetFramework.targets" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\net20" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\net40" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\net45" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\net451" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\net46" />
  </files>
</package>

Added NuGet/SQLite.Core.NetStandard.nuspec.

















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Core.NetStandard.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>Stub.System.Data.SQLite.Core.NetStandard</id>
    <title>System.Data.SQLite Core for the .NET Standard 2.x (x86/x64)</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>The official SQLite database engine for both x86 and x64 along with the ADO.NET provider.</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="netstandard2.0" />
      <group targetFramework="netstandard2.1" />
    </dependencies>
  </metadata>
  <files>
    <file src="..\bin\NetStandard20\ReleaseNetStandard20\bin\netstandard2.0\System.Data.SQLite.dll" target="lib\netstandard2.0" />
    <file src="..\bin\NetStandard20\ReleaseNetStandard20\bin\netstandard2.0\System.Data.SQLite.xml" target="lib\netstandard2.0" />
    <file src="..\bin\NetStandard21\ReleaseNetStandard21\bin\netstandard2.1\System.Data.SQLite.dll" target="lib\netstandard2.1" />
    <file src="..\bin\NetStandard21\ReleaseNetStandard21\bin\netstandard2.1\System.Data.SQLite.xml" target="lib\netstandard2.1" />
    <file src="..\bin\2015\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="runtimes\win-x86\native" />
    <file src="..\bin\2015\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="runtimes\win-x64\native" />
    <file src="..\bin\2016\linux-x64\ReleaseNativeOnly\SQLite.Interop.dll" target="runtimes\linux-x64\native" />
    <file src="..\bin\2016\osx-x64\ReleaseNativeOnly\SQLite.Interop.dll" target="runtimes\osx-x64\native" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\netstandard2.0" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\netstandard2.1" />
  </files>
</package>

Added NuGet/SQLite.Core.Test.nuspec.

































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Core.Test.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.Core.Test</id>
    <title>System.Data.SQLite Core (x86/x64) Test</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>This is a pre-release package and is not intended for production use.  The official SQLite database engine for both x86 and x64 along with the ADO.NET provider.</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net20" />
      <group targetFramework="net40" />
      <group targetFramework="net45" />
      <group targetFramework="net451" />
      <group targetFramework="net46" />
      <group targetFramework="netstandard2.0" />
      <group targetFramework="netstandard2.1" />
    </dependencies>
  </metadata>
  <files>
    <file src="..\bin\2008\Release\bin\System.Data.SQLite.dll" target="lib\net20" />
    <file src="..\bin\2008\Release\bin\System.Data.SQLite.xml" target="lib\net20" />
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.dll" target="lib\net40" />
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.xml" target="lib\net40" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.dll" target="lib\net45" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.xml" target="lib\net45" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.dll" target="lib\net451" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.xml" target="lib\net451" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.dll" target="lib\net46" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.xml" target="lib\net46" />
    <file src="..\bin\NetStandard20\ReleaseNetStandard20\bin\netstandard2.0\System.Data.SQLite.dll" target="lib\netstandard2.0" />
    <file src="..\bin\NetStandard20\ReleaseNetStandard20\bin\netstandard2.0\System.Data.SQLite.xml" target="lib\netstandard2.0" />
    <file src="..\bin\NetStandard21\ReleaseNetStandard21\bin\netstandard2.1\System.Data.SQLite.dll" target="lib\netstandard2.1" />
    <file src="..\bin\NetStandard21\ReleaseNetStandard21\bin\netstandard2.1\System.Data.SQLite.xml" target="lib\netstandard2.1" />
    <file src="..\bin\2008\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net20\x86" />
    <file src="..\bin\2008\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net20\x64" />
    <file src="..\bin\2010\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net40\x86" />
    <file src="..\bin\2010\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net40\x64" />
    <file src="..\bin\2012\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net45\x86" />
    <file src="..\bin\2012\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net45\x64" />
    <file src="..\bin\2013\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net451\x86" />
    <file src="..\bin\2013\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net451\x64" />
    <file src="..\bin\2015\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net46\x86" />
    <file src="..\bin\2015\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="build\net46\x64" />
    <file src="..\bin\2015\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="runtimes\win-x86\native" />
    <file src="..\bin\2015\x64\ReleaseNativeOnlyStatic\SQLite.Interop.dll" target="runtimes\win-x64\native" />
    <file src="..\bin\2016\linux-x64\ReleaseNativeOnly\SQLite.Interop.dll" target="runtimes\linux-x64\native" />
    <file src="..\bin\2016\osx-x64\ReleaseNativeOnly\SQLite.Interop.dll" target="runtimes\osx-x64\native" />
    <file src="shared\Core\build\System.Data.SQLite.Core.NetFramework.targets" target="build\net20\System.Data.SQLite.Core.Test.targets" />
    <file src="shared\Core\build\System.Data.SQLite.Core.NetFramework.targets" target="build\net40\System.Data.SQLite.Core.Test.targets" />
    <file src="shared\Core\build\System.Data.SQLite.Core.NetFramework.targets" target="build\net45\System.Data.SQLite.Core.Test.targets" />
    <file src="shared\Core\build\System.Data.SQLite.Core.NetFramework.targets" target="build\net451\System.Data.SQLite.Core.Test.targets" />
    <file src="shared\Core\build\System.Data.SQLite.Core.NetFramework.targets" target="build\net46\System.Data.SQLite.Core.Test.targets" />
    <file src="shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets" target="buildTransitive\net20\System.Data.SQLite.Core.Test.targets" />
    <file src="shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets" target="buildTransitive\net40\System.Data.SQLite.Core.Test.targets" />
    <file src="shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets" target="buildTransitive\net45\System.Data.SQLite.Core.Test.targets" />
    <file src="shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets" target="buildTransitive\net451\System.Data.SQLite.Core.Test.targets" />
    <file src="shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets" target="buildTransitive\net46\System.Data.SQLite.Core.Test.targets" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\net20" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\net40" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\net45" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\net451" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\net46" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\netstandard2.0" />
    <file src="shared\Core\lib\System.Data.SQLite.dll.altconfig" target="lib\netstandard2.1" />
  </files>
</package>

Added NuGet/SQLite.Core.nuspec.

































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Core.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.Core</id>
    <title>System.Data.SQLite Core (x86/x64)</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>The official SQLite database engine for both x86 and x64 along with the ADO.NET provider.</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net20">
        <dependency id="Stub.System.Data.SQLite.Core.NetFramework" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="Stub.System.Data.SQLite.Core.NetFramework" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="Stub.System.Data.SQLite.Core.NetFramework" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="Stub.System.Data.SQLite.Core.NetFramework" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="Stub.System.Data.SQLite.Core.NetFramework" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.0">
        <dependency id="Stub.System.Data.SQLite.Core.NetStandard" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.1">
        <dependency id="Stub.System.Data.SQLite.Core.NetStandard" version="[1.0.119.0]" />
      </group>
    </dependencies>
  </metadata>
  <files />
</package>

Added NuGet/SQLite.EF6.Beta.nuspec.









































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.EF6.Beta.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.EF6.Beta</id>
    <title>System.Data.SQLite EF6 Beta</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>This is a &quot;beta&quot; package and is not intended for production use.  Support for Entity Framework 6 using System.Data.SQLite.</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net40">
        <dependency id="EntityFramework" version="6.4.4" />
      </group>
      <group targetFramework="net45">
        <dependency id="EntityFramework" version="6.4.4" />
      </group>
      <group targetFramework="net451">
        <dependency id="EntityFramework" version="6.4.4" />
      </group>
      <group targetFramework="net46">
        <dependency id="EntityFramework" version="6.4.4" />
      </group>
      <group targetFramework="netstandard2.1">
        <dependency id="EntityFramework" version="6.4.4" />
      </group>
    </dependencies>
  </metadata>
  <files>
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.EF6.dll" target="lib\net40" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.EF6.dll" target="lib\net45" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.EF6.dll" target="lib\net451" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.EF6.dll" target="lib\net46" />
    <file src="..\bin\NetStandard21\ReleaseNetStandard21\bin\netstandard2.1\System.Data.SQLite.EF6.dll" target="lib\netstandard2.1" />
    <file src="shared\Core\content\config.install.xdt" target="content\net40\app.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net40\web.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net45\app.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net45\web.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net451\app.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net451\web.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net46\app.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net46\web.config.install.xdt" />
    <file src="net40\EF6\content\config.transform" target="content\net40\app.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net40\web.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net45\app.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net45\web.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net451\app.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net451\web.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net46\app.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net46\web.config.transform" />
    <file src="net40\EF6\tools\provider.ps1" target="tools\net40\install.ps1" />
    <file src="net40\EF6\tools\provider.ps1" target="tools\net45\install.ps1" />
    <file src="net40\EF6\tools\provider.ps1" target="tools\net451\install.ps1" />
    <file src="net40\EF6\tools\provider.ps1" target="tools\net46\install.ps1" />
  </files>
</package>

Added NuGet/SQLite.EF6.Test.nuspec.









































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.EF6.Test.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.EF6.Test</id>
    <title>System.Data.SQLite EF6 Test</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>This is a pre-release package and is not intended for production use.  Support for Entity Framework 6 using System.Data.SQLite.</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net40">
        <dependency id="EntityFramework" version="6.4.4" />
      </group>
      <group targetFramework="net45">
        <dependency id="EntityFramework" version="6.4.4" />
      </group>
      <group targetFramework="net451">
        <dependency id="EntityFramework" version="6.4.4" />
      </group>
      <group targetFramework="net46">
        <dependency id="EntityFramework" version="6.4.4" />
      </group>
      <group targetFramework="netstandard2.1">
        <dependency id="EntityFramework" version="6.4.4" />
      </group>
    </dependencies>
  </metadata>
  <files>
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.EF6.dll" target="lib\net40" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.EF6.dll" target="lib\net45" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.EF6.dll" target="lib\net451" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.EF6.dll" target="lib\net46" />
    <file src="..\bin\NetStandard21\ReleaseNetStandard21\bin\netstandard2.1\System.Data.SQLite.EF6.dll" target="lib\netstandard2.1" />
    <file src="shared\Core\content\config.install.xdt" target="content\net40\app.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net40\web.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net45\app.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net45\web.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net451\app.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net451\web.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net46\app.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net46\web.config.install.xdt" />
    <file src="net40\EF6\content\config.transform" target="content\net40\app.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net40\web.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net45\app.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net45\web.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net451\app.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net451\web.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net46\app.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net46\web.config.transform" />
    <file src="net40\EF6\tools\provider.ps1" target="tools\net40\install.ps1" />
    <file src="net40\EF6\tools\provider.ps1" target="tools\net45\install.ps1" />
    <file src="net40\EF6\tools\provider.ps1" target="tools\net451\install.ps1" />
    <file src="net40\EF6\tools\provider.ps1" target="tools\net46\install.ps1" />
  </files>
</package>

Added NuGet/SQLite.EF6.nuspec.









































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.EF6.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.EF6</id>
    <title>System.Data.SQLite EF6</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>Support for Entity Framework 6 using System.Data.SQLite.</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net40">
        <dependency id="EntityFramework" version="6.4.4" />
      </group>
      <group targetFramework="net45">
        <dependency id="EntityFramework" version="6.4.4" />
      </group>
      <group targetFramework="net451">
        <dependency id="EntityFramework" version="6.4.4" />
      </group>
      <group targetFramework="net46">
        <dependency id="EntityFramework" version="6.4.4" />
      </group>
      <group targetFramework="netstandard2.1">
        <dependency id="EntityFramework" version="6.4.4" />
      </group>
    </dependencies>
  </metadata>
  <files>
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.EF6.dll" target="lib\net40" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.EF6.dll" target="lib\net45" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.EF6.dll" target="lib\net451" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.EF6.dll" target="lib\net46" />
    <file src="..\bin\NetStandard21\ReleaseNetStandard21\bin\netstandard2.1\System.Data.SQLite.EF6.dll" target="lib\netstandard2.1" />
    <file src="shared\Core\content\config.install.xdt" target="content\net40\app.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net40\web.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net45\app.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net45\web.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net451\app.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net451\web.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net46\app.config.install.xdt" />
    <file src="shared\Core\content\config.install.xdt" target="content\net46\web.config.install.xdt" />
    <file src="net40\EF6\content\config.transform" target="content\net40\app.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net40\web.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net45\app.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net45\web.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net451\app.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net451\web.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net46\app.config.transform" />
    <file src="net40\EF6\content\config.transform" target="content\net46\web.config.transform" />
    <file src="net40\EF6\tools\provider.ps1" target="tools\net40\install.ps1" />
    <file src="net40\EF6\tools\provider.ps1" target="tools\net45\install.ps1" />
    <file src="net40\EF6\tools\provider.ps1" target="tools\net451\install.ps1" />
    <file src="net40\EF6\tools\provider.ps1" target="tools\net46\install.ps1" />
  </files>
</package>

Added NuGet/SQLite.Linq.Beta.nuspec.

































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Linq.Beta.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.Linq.Beta</id>
    <title>System.Data.SQLite LINQ Beta</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>This is a &quot;beta&quot; package and is not intended for production use.  Support for LINQ using System.Data.SQLite.</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net20" />
      <group targetFramework="net40" />
      <group targetFramework="net45" />
      <group targetFramework="net451" />
      <group targetFramework="net46" />
    </dependencies>
  </metadata>
  <files>
    <file src="..\bin\2008\Release\bin\System.Data.SQLite.Linq.dll" target="lib\net20" />
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.Linq.dll" target="lib\net40" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.Linq.dll" target="lib\net45" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.Linq.dll" target="lib\net451" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.Linq.dll" target="lib\net46" />
    <file src="shared\Core\content\config.transform" target="content\net20\app.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net20\web.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net40\app.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net40\web.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net45\app.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net45\web.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net451\app.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net451\web.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net46\app.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net46\web.config.transform" />
  </files>
</package>

Added NuGet/SQLite.Linq.Test.nuspec.

































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Linq.Test.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.Linq.Test</id>
    <title>System.Data.SQLite LINQ Test</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>This is a pre-release package and is not intended for production use.  Support for LINQ using System.Data.SQLite.</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net20" />
      <group targetFramework="net40" />
      <group targetFramework="net45" />
      <group targetFramework="net451" />
      <group targetFramework="net46" />
    </dependencies>
  </metadata>
  <files>
    <file src="..\bin\2008\Release\bin\System.Data.SQLite.Linq.dll" target="lib\net20" />
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.Linq.dll" target="lib\net40" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.Linq.dll" target="lib\net45" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.Linq.dll" target="lib\net451" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.Linq.dll" target="lib\net46" />
    <file src="shared\Core\content\config.transform" target="content\net20\app.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net20\web.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net40\app.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net40\web.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net45\app.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net45\web.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net451\app.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net451\web.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net46\app.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net46\web.config.transform" />
  </files>
</package>

Added NuGet/SQLite.Linq.nuspec.

































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Linq.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.Linq</id>
    <title>System.Data.SQLite LINQ</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>Support for LINQ using System.Data.SQLite.</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net20" />
      <group targetFramework="net40" />
      <group targetFramework="net45" />
      <group targetFramework="net451" />
      <group targetFramework="net46" />
    </dependencies>
  </metadata>
  <files>
    <file src="..\bin\2008\Release\bin\System.Data.SQLite.Linq.dll" target="lib\net20" />
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.Linq.dll" target="lib\net40" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.Linq.dll" target="lib\net45" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.Linq.dll" target="lib\net451" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.Linq.dll" target="lib\net46" />
    <file src="shared\Core\content\config.transform" target="content\net20\app.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net20\web.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net40\app.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net40\web.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net45\app.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net45\web.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net451\app.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net451\web.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net46\app.config.transform" />
    <file src="shared\Core\content\config.transform" target="content\net46\web.config.transform" />
  </files>
</package>

Added NuGet/SQLite.MSIL.Beta.nuspec.





























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.MSIL.Beta.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.MSIL.Beta</id>
    <title>System.Data.SQLite (MSIL) Beta</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>This is a &quot;beta&quot; package and is not intended for production use.  This is a legacy package; if possible, please use either the &quot;System.Data.SQLite.Beta&quot; or &quot;System.Data.SQLite.Core.Beta&quot; package instead.  An ADO.NET provider for SQLite (managed-only).</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net20">
        <dependency id="System.Data.SQLite.Core.MSIL.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.Core.MSIL.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.Core.MSIL.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.Core.MSIL.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.Core.MSIL.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.0">
        <dependency id="System.Data.SQLite.Core.MSIL.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.1">
        <dependency id="System.Data.SQLite.Core.MSIL.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net20">
        <dependency id="System.Data.SQLite.Linq.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.Linq.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.Linq.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.Linq.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.Linq.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.EF6.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.EF6.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.EF6.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.EF6.Beta" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.1">
        <dependency id="System.Data.SQLite.EF6.Beta" version="[1.0.119.0]" />
      </group>
    </dependencies>
  </metadata>
  <files />
</package>

Added NuGet/SQLite.MSIL.Test.nuspec.





























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.MSIL.Test.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.MSIL.Test</id>
    <title>System.Data.SQLite (MSIL) Test</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>This is a pre-release package and is not intended for production use.  This is a legacy package; if possible, please use either the &quot;System.Data.SQLite.Test&quot; or &quot;System.Data.SQLite.Core.Test&quot; package instead.  An ADO.NET provider for SQLite (managed-only).</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net20">
        <dependency id="System.Data.SQLite.Core.MSIL.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.Core.MSIL.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.Core.MSIL.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.Core.MSIL.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.Core.MSIL.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.0">
        <dependency id="System.Data.SQLite.Core.MSIL.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.1">
        <dependency id="System.Data.SQLite.Core.MSIL.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net20">
        <dependency id="System.Data.SQLite.Linq.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.Linq.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.Linq.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.Linq.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.Linq.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.EF6.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.EF6.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.EF6.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.EF6.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.1">
        <dependency id="System.Data.SQLite.EF6.Test" version="[1.0.119.0]" />
      </group>
    </dependencies>
  </metadata>
  <files />
</package>

Added NuGet/SQLite.MSIL.nuspec.





























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.MSIL.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.MSIL</id>
    <title>System.Data.SQLite (MSIL)</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>This is a legacy package; if possible, please use either the &quot;System.Data.SQLite&quot; or &quot;System.Data.SQLite.Core&quot; package instead.  An ADO.NET provider for SQLite (managed-only).</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net20">
        <dependency id="System.Data.SQLite.Core.MSIL" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.Core.MSIL" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.Core.MSIL" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.Core.MSIL" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.Core.MSIL" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.0">
        <dependency id="System.Data.SQLite.Core.MSIL" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.1">
        <dependency id="System.Data.SQLite.Core.MSIL" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net20">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.EF6" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.EF6" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.EF6" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.EF6" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.1">
        <dependency id="System.Data.SQLite.EF6" version="[1.0.119.0]" />
      </group>
    </dependencies>
  </metadata>
  <files />
</package>

Added NuGet/SQLite.Test.nuspec.





























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Test.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.Test</id>
    <title>System.Data.SQLite (x86/x64) Test</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>This is a pre-release package and is not intended for production use.  The official SQLite database engine for both x86 and x64 along with the ADO.NET provider.  This package includes support for LINQ and Entity Framework 6.</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net20">
        <dependency id="System.Data.SQLite.Core.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.Core.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.Core.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.Core.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.Core.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.0">
        <dependency id="System.Data.SQLite.Core.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.1">
        <dependency id="System.Data.SQLite.Core.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net20">
        <dependency id="System.Data.SQLite.Linq.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.Linq.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.Linq.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.Linq.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.Linq.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.EF6.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.EF6.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.EF6.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.EF6.Test" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.1">
        <dependency id="System.Data.SQLite.EF6.Test" version="[1.0.119.0]" />
      </group>
    </dependencies>
  </metadata>
  <files />
</package>

Added NuGet/SQLite.nuspec.





























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite</id>
    <title>System.Data.SQLite (x86/x64)</title>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>The official SQLite database engine for both x86 and x64 along with the ADO.NET provider.  This package includes support for LINQ and Entity Framework 6.</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net20">
        <dependency id="System.Data.SQLite.Core" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.Core" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.Core" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.Core" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.Core" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.0">
        <dependency id="System.Data.SQLite.Core" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.1">
        <dependency id="System.Data.SQLite.Core" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net20">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.EF6" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.EF6" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.EF6" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.EF6" version="[1.0.119.0]" />
      </group>
      <group targetFramework="netstandard2.1">
        <dependency id="System.Data.SQLite.EF6" version="[1.0.119.0]" />
      </group>
    </dependencies>
  </metadata>
  <files />
</package>

Added NuGet/SQLite.x64.nuspec.

































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.x64.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.x64</id>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>This is a legacy package; if possible, please use either the &quot;System.Data.SQLite&quot; or &quot;System.Data.SQLite.Core&quot; package instead.  The official SQLite database engine combined with a complete ADO.NET provider all rolled into a single mixed-mode assembly for x64.</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net20">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.EF6" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.EF6" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.EF6" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.EF6" version="[1.0.119.0]" />
      </group>
    </dependencies>
  </metadata>
  <files>
    <file src="..\bin\2008\x64\ReleaseStatic\System.Data.SQLite.dll" target="lib\net20" />
    <file src="..\bin\2008\Release\bin\System.Data.SQLite.xml" target="lib\net20" />
    <file src="..\bin\2010\x64\ReleaseStatic\System.Data.SQLite.dll" target="lib\net40" />
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.xml" target="lib\net40" />
    <file src="..\bin\2012\x64\ReleaseStatic\System.Data.SQLite.dll" target="lib\net45" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.xml" target="lib\net45" />
    <file src="..\bin\2013\x64\ReleaseStatic\System.Data.SQLite.dll" target="lib\net451" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.xml" target="lib\net451" />
    <file src="..\bin\2015\x64\ReleaseStatic\System.Data.SQLite.dll" target="lib\net46" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.xml" target="lib\net46" />
  </files>
</package>

Added NuGet/SQLite.x86.nuspec.

































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.x86.nuspec -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<package>
  <metadata>
    <id>System.Data.SQLite.x86</id>
    <version>1.0.119.0</version>
    <authors>SQLite Development Team</authors>
    <description>This is a legacy package; if possible, please use either the &quot;System.Data.SQLite&quot; or &quot;System.Data.SQLite.Core&quot; package instead.  The official SQLite database engine combined with a complete ADO.NET provider all rolled into a single mixed-mode assembly for x86.</description>
    <language>en-US</language>
    <projectUrl>https://system.data.sqlite.org/</projectUrl>
    <iconUrl>https://system.data.sqlite.org/images/sqlite128.png</iconUrl>
    <licenseUrl>https://www.sqlite.org/copyright.html</licenseUrl>
    <tags>sqlite database ado.net provider interop</tags>
    <copyright>Public Domain</copyright>
    <dependencies>
      <group targetFramework="net20">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.Linq" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net40">
        <dependency id="System.Data.SQLite.EF6" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net45">
        <dependency id="System.Data.SQLite.EF6" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net451">
        <dependency id="System.Data.SQLite.EF6" version="[1.0.119.0]" />
      </group>
      <group targetFramework="net46">
        <dependency id="System.Data.SQLite.EF6" version="[1.0.119.0]" />
      </group>
    </dependencies>
  </metadata>
  <files>
    <file src="..\bin\2008\Win32\ReleaseStatic\System.Data.SQLite.dll" target="lib\net20" />
    <file src="..\bin\2008\Release\bin\System.Data.SQLite.xml" target="lib\net20" />
    <file src="..\bin\2010\Win32\ReleaseStatic\System.Data.SQLite.dll" target="lib\net40" />
    <file src="..\bin\2010\Release\bin\System.Data.SQLite.xml" target="lib\net40" />
    <file src="..\bin\2012\Win32\ReleaseStatic\System.Data.SQLite.dll" target="lib\net45" />
    <file src="..\bin\2012\Release\bin\System.Data.SQLite.xml" target="lib\net45" />
    <file src="..\bin\2013\Win32\ReleaseStatic\System.Data.SQLite.dll" target="lib\net451" />
    <file src="..\bin\2013\Release\bin\System.Data.SQLite.xml" target="lib\net451" />
    <file src="..\bin\2015\Win32\ReleaseStatic\System.Data.SQLite.dll" target="lib\net46" />
    <file src="..\bin\2015\Release\bin\System.Data.SQLite.xml" target="lib\net46" />
  </files>
</package>

Added NuGet/net40/EF6/content/config.transform.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
<configuration>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.EF6" />
      <add name="SQLite Data Provider (Entity Framework 6)"
           invariant="System.Data.SQLite.EF6"
           description=".NET Framework Data Provider for SQLite (Entity Framework 6)"
           type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
    </DbProviderFactories>
  </system.data>
</configuration>

Added NuGet/net40/EF6/tools/provider.ps1.



























>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
###############################################################################
#
# provider.ps1 --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

param($installPath, $toolsPath, $package, $project)

Add-EFProvider $project "System.Data.SQLite.EF6" `
    "System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6"

Added NuGet/shared/Core/build/System.Data.SQLite.Core.NetFramework.targets.































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<!--
 *
 * System.Data.SQLite.Core.NetFramework.targets -
 *
 * WARNING: This MSBuild file requires MSBuild 4.0 features.
 *
 * Written by Joe Mistachkin and David Archer.
 * Released to the public domain, use at your own risk!
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **                          Load Per-User Settings                          **
  ******************************************************************************
  -->

  <!--
      NOTE: If the per-user settings file exists, import it now.  The contained
            settings, if any, will override the default ones provided below.
  -->
  <Import Condition="'$(MSBuildThisFileFullPath)' != '' And
                     Exists('$(MSBuildThisFileFullPath).user')"
          Project="$(MSBuildThisFileFullPath).user" />

  <!--
  ******************************************************************************
  **                    SQLite Interop Library Build Items                    **
  ******************************************************************************
  -->

  <ItemGroup>
    <SQLiteInteropFiles Condition="'$(MSBuildThisFileDirectory)' != '' And
                                   HasTrailingSlash('$(MSBuildThisFileDirectory)')"
                        Include="$(MSBuildThisFileDirectory)**\SQLite.Interop.*" />
  </ItemGroup>

  <!--
  ******************************************************************************
  **                   SQLite Interop Library Content Items                   **
  ******************************************************************************
  -->

  <ItemGroup Condition="'$(ContentSQLiteInteropFiles)' != '' And
                        '$(ContentSQLiteInteropFiles)' != 'false' And
                        '@(SQLiteInteropFiles)' != ''">
    <Content Include="@(SQLiteInteropFiles)">
      <Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>

  <!--
  ******************************************************************************
  **                   SQLite Interop Library Build Targets                   **
  ******************************************************************************
  -->

  <Target Name="CopySQLiteInteropFiles"
          Condition="'$(CopySQLiteInteropFiles)' != 'false' And
                     '$(OutDir)' != '' And
                     HasTrailingSlash('$(OutDir)') And
                     Exists('$(OutDir)')"
          Inputs="@(SQLiteInteropFiles)"
          Outputs="@(SQLiteInteropFiles -> '$(OutDir)%(RecursiveDir)%(Filename)%(Extension)')">
    <!--
        NOTE: Copy "SQLite.Interop.dll" and all related files, for every
              architecture that we support, to the build output directory.
    -->
    <Copy SourceFiles="@(SQLiteInteropFiles)"
          DestinationFiles="@(SQLiteInteropFiles -> '$(OutDir)%(RecursiveDir)%(Filename)%(Extension)')" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CleanSQLiteInteropFiles"
          Condition="'$(CleanSQLiteInteropFiles)' != 'false' And
                     '$(OutDir)' != '' And
                     HasTrailingSlash('$(OutDir)') And
                     Exists('$(OutDir)')">
    <!--
        NOTE: Delete "SQLite.Interop.dll" and all related files, for every
              architecture that we support, from the build output directory.
    -->
    <Delete Files="@(SQLiteInteropFiles -> '$(OutDir)%(RecursiveDir)%(Filename)%(Extension)')" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CollectSQLiteInteropFiles"
          Condition="'$(CollectSQLiteInteropFiles)' != 'false'">
    <ItemGroup>
      <FilesForPackagingFromProject Include="@(SQLiteInteropFiles)">
        <DestinationRelativePath>bin\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>
  </Target>

  <!--
  ******************************************************************************
  **                 SQLite Interop Library Build Properties                  **
  ******************************************************************************
  -->

  <PropertyGroup>
    <PostBuildEventDependsOn>
      $(PostBuildEventDependsOn);
      CopySQLiteInteropFiles;
    </PostBuildEventDependsOn>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopySQLiteInteropFiles;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanSQLiteInteropFiles;
    </CleanDependsOn>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **     SQLite Interop Library Publish Properties for Visual Studio 20xx     **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(VisualStudioVersion)' == '' Or
                            '$(VisualStudioVersion)' == '10.0' Or
                            '$(VisualStudioVersion)' == '11.0' Or
                            '$(VisualStudioVersion)' == '12.0' Or
                            '$(VisualStudioVersion)' == '14.0' Or
                            '$(VisualStudioVersion)' == '15.0' Or
                            '$(VisualStudioVersion)' == '16.0' Or
                            '$(VisualStudioVersion)' == '17.0'">
    <PipelineCollectFilesPhaseDependsOn>
      CollectSQLiteInteropFiles;
      $(PipelineCollectFilesPhaseDependsOn);
    </PipelineCollectFilesPhaseDependsOn>
  </PropertyGroup>
</Project>

Added NuGet/shared/Core/buildTransitive/System.Data.SQLite.Core.NetFramework.targets.













































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<!--
 *
 * System.Data.SQLite.Core.NetFramework.targets -
 *
 * WARNING: This MSBuild file requires MSBuild 4.0 features.
 *
 * Written by Joe Mistachkin and David Archer.
 * Released to the public domain, use at your own risk!
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **                          Load Per-User Settings                          **
  ******************************************************************************
  -->

  <!--
      NOTE: If the per-user settings file exists, import it now.  The contained
            settings, if any, will override the default ones provided below.
  -->
  <Import Condition="'$(MSBuildThisFileFullPath)' != '' And
                     Exists('$(MSBuildThisFileFullPath).user')"
          Project="$(MSBuildThisFileFullPath).user" />

  <!--
  ******************************************************************************
  **               Target Framework Version Directory Base Name               **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(MSBuildThisFileDirectory)' != '' And
                            HasTrailingSlash('$(MSBuildThisFileDirectory)')">
    <!--
        NOTE: Attempt to determine the name of our immediate parent directory,
              e.g. "net40".  This is needed in order to locate the correct set
              of SQLite interop files.  This value will have a trailing slash.
    -->
    <SQLiteTargetFramework>$([MSBuild]::MakeRelative('$(MSBuildThisFileDirectory)..', '$(MSBuildThisFileDirectory)'))</SQLiteTargetFramework>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                    SQLite Interop Library Build Items                    **
  ******************************************************************************
  -->

  <ItemGroup>
    <!--
        NOTE: Grab the list of SQLite interop files to be copied to the build
              output directory.  There should be one file for each supported
              processor architecture.
    -->
    <SQLiteInteropFiles Condition="'$(MSBuildThisFileDirectory)' != '' And
                                   HasTrailingSlash('$(MSBuildThisFileDirectory)') And
                                   '$(SQLiteTargetFramework)' != '' And
                                   HasTrailingSlash('$(SQLiteTargetFramework)')"
                        Include="$(MSBuildThisFileDirectory)..\..\build\$(SQLiteTargetFramework)**\SQLite.Interop.*" />
  </ItemGroup>

  <!--
  ******************************************************************************
  **                   SQLite Interop Library Content Items                   **
  ******************************************************************************
  -->

  <ItemGroup Condition="'$(ContentSQLiteInteropFiles)' != '' And
                        '$(ContentSQLiteInteropFiles)' != 'false' And
                        '@(SQLiteInteropFiles)' != ''">
    <Content Include="@(SQLiteInteropFiles)">
      <Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>

  <!--
  ******************************************************************************
  **                   SQLite Interop Library Build Targets                   **
  ******************************************************************************
  -->

  <Target Name="CopySQLiteInteropFiles"
          Condition="'$(CopySQLiteInteropFiles)' != 'false' And
                     '$(OutDir)' != '' And
                     HasTrailingSlash('$(OutDir)') And
                     Exists('$(OutDir)')"
          Inputs="@(SQLiteInteropFiles)"
          Outputs="@(SQLiteInteropFiles -> '$(OutDir)%(RecursiveDir)%(Filename)%(Extension)')">
    <!--
        NOTE: Copy "SQLite.Interop.dll" and all related files, for every
              architecture that we support, to the build output directory.
    -->
    <Copy SourceFiles="@(SQLiteInteropFiles)"
          DestinationFiles="@(SQLiteInteropFiles -> '$(OutDir)%(RecursiveDir)%(Filename)%(Extension)')" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CleanSQLiteInteropFiles"
          Condition="'$(CleanSQLiteInteropFiles)' != 'false' And
                     '$(OutDir)' != '' And
                     HasTrailingSlash('$(OutDir)') And
                     Exists('$(OutDir)')">
    <!--
        NOTE: Delete "SQLite.Interop.dll" and all related files, for every
              architecture that we support, from the build output directory.
    -->
    <Delete Files="@(SQLiteInteropFiles -> '$(OutDir)%(RecursiveDir)%(Filename)%(Extension)')" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CollectSQLiteInteropFiles"
          Condition="'$(CollectSQLiteInteropFiles)' != 'false'">
    <ItemGroup>
      <FilesForPackagingFromProject Include="@(SQLiteInteropFiles)">
        <DestinationRelativePath>bin\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>
  </Target>

  <!--
  ******************************************************************************
  **                 SQLite Interop Library Build Properties                  **
  ******************************************************************************
  -->

  <PropertyGroup>
    <PostBuildEventDependsOn>
      $(PostBuildEventDependsOn);
      CopySQLiteInteropFiles;
    </PostBuildEventDependsOn>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopySQLiteInteropFiles;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanSQLiteInteropFiles;
    </CleanDependsOn>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **     SQLite Interop Library Publish Properties for Visual Studio 20xx     **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(VisualStudioVersion)' == '' Or
                            '$(VisualStudioVersion)' == '10.0' Or
                            '$(VisualStudioVersion)' == '11.0' Or
                            '$(VisualStudioVersion)' == '12.0' Or
                            '$(VisualStudioVersion)' == '14.0' Or
                            '$(VisualStudioVersion)' == '15.0' Or
                            '$(VisualStudioVersion)' == '16.0' Or
                            '$(VisualStudioVersion)' == '17.0'">
    <PipelineCollectFilesPhaseDependsOn>
      CollectSQLiteInteropFiles;
      $(PipelineCollectFilesPhaseDependsOn);
    </PipelineCollectFilesPhaseDependsOn>
  </PropertyGroup>
</Project>

Added NuGet/shared/Core/content/config.install.xdt.

























>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <system.data>
    <DbProviderFactories>
      <remove xdt:Transform="RemoveAll"
              xdt:Locator="Condition(@invariant='System.Data.SQLite' or
                                     @invariant='System.Data.SQLite.Linq')" />
      <add xdt:Transform="RemoveAll"
           xdt:Locator="Condition(@invariant='System.Data.SQLite' or
                                  @invariant='System.Data.SQLite.Linq')" />
    </DbProviderFactories>
  </system.data>
</configuration>

Added NuGet/shared/Core/content/config.transform.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
<configuration>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite" />
      <add name="SQLite Data Provider"
           invariant="System.Data.SQLite"
           description=".NET Framework Data Provider for SQLite"
           type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
    </DbProviderFactories>
  </system.data>
</configuration>

Added NuGet/shared/Core/lib/System.Data.SQLite.dll.altconfig.













































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?xml version="1.0"?>
<!--
 *
 * System.Data.SQLite.dll.altconfig -
 *
 * WARNING: This XML configuration file is intended for use within the NuGet
 *          package directories only.  Please do not copy this file to any of
 *          the build output directories because it could interfere with the
 *          native library pre-loading feature.
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<configuration>
  <appSettings>
    <add key="PreLoadSQLite_BaseDirectory"
         value="%PreLoadSQLite_AssemblyDirectory%\..\..\build\%PreLoadSQLite_TargetFramework%" />
  </appSettings>

  <dllmap dll="SQLite.Interop" target="SQLite.Interop.dll" />
</configuration>

Changes to SQLite.Designer/AssemblyInfo.cs.








1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16


17

18

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41







using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.ConstrainedExecution;
using System.Resources;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SQLite.Designer")]
[assembly: AssemblyDescription("ADO.NET 2.0 Data Designer for SQLite")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("http://sqlite.phxsoftware.com")]
[assembly: AssemblyProduct("SQLite Designer")]
[assembly: AssemblyCopyright("Public Domain")]


[assembly: AssemblyTrademark("")]

[assembly: AssemblyCulture("")]


// Setting ComVisible to false makes the types in this assembly not visible 
// to COM componenets.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[assembly: NeutralResourcesLanguage("en")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Revision and Build Numbers 
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.37.0")]
[assembly: AssemblyFileVersion("1.0.37.0")]
[assembly: AssemblyDelaySignAttribute(false)]
[assembly: AssemblyKeyFileAttribute("..\\System.Data.SQLite\\System.Data.SQLite.snk")]
[assembly: AssemblyKeyNameAttribute("")]
>
>
>
>
>
>
>


<







|
|
<
|
|

>
>
|
>
|
>





|












|
|
<
<
<
1
2
3
4
5
6
7
8
9

10
11
12
13
14
15
16
17
18

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47



/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System;
using System.Reflection;

using System.Runtime.InteropServices;
using System.Runtime.ConstrainedExecution;
using System.Resources;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("System.Data.SQLite Designer")]
[assembly: AssemblyDescription("ADO.NET Data Provider for SQLite")]

[assembly: AssemblyCompany("https://system.data.sqlite.org/")]
[assembly: AssemblyProduct("System.Data.SQLite")]
[assembly: AssemblyCopyright("Public Domain")]

#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM componenets.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// [assembly: CLSCompliant(true)]
[assembly: ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[assembly: NeutralResourcesLanguage("en")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Revision and Build Numbers 
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.119.0")]
[assembly: AssemblyFileVersion("1.0.119.0")]



Changes to SQLite.Designer/ChangePasswordDialog.Designer.cs.








1
2
3
4
5
6
7







namespace SQLite.Designer
{
  partial class ChangePasswordDialog
  {
    /// <summary>
    /// Required designer variable.
    /// </summary>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer
{
  partial class ChangePasswordDialog
  {
    /// <summary>
    /// Required designer variable.
    /// </summary>

Changes to SQLite.Designer/ChangePasswordDialog.cs.

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

    private void password_TextChanged(object sender, EventArgs e)
    {
      if (String.IsNullOrEmpty(password.Text) || password.Text == GetCurrentPassword())
      {
        confirmLabel.Enabled = false;
        passwordConfirm.Enabled = false;
        passwordConfirm.Text = "";

        if (String.IsNullOrEmpty(password.Text) && String.IsNullOrEmpty(GetCurrentPassword()) == false)
          action.Text = VSPackage.Decrypt;
        else
          action.Text = "";
      }
      else
      {
        confirmLabel.Enabled = true;
        passwordConfirm.Enabled = true;

        if (String.IsNullOrEmpty(GetCurrentPassword()) == false)







|




|







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

    private void password_TextChanged(object sender, EventArgs e)
    {
      if (String.IsNullOrEmpty(password.Text) || password.Text == GetCurrentPassword())
      {
        confirmLabel.Enabled = false;
        passwordConfirm.Enabled = false;
        passwordConfirm.Text = String.Empty;

        if (String.IsNullOrEmpty(password.Text) && String.IsNullOrEmpty(GetCurrentPassword()) == false)
          action.Text = VSPackage.Decrypt;
        else
          action.Text = String.Empty;
      }
      else
      {
        confirmLabel.Enabled = true;
        passwordConfirm.Enabled = true;

        if (String.IsNullOrEmpty(GetCurrentPassword()) == false)

Changes to SQLite.Designer/ChangeScriptDialog.Designer.cs.

Changes to SQLite.Designer/ChangeScriptDialog.cs.

70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
          _defaultSave = _saveOrig.Checked;

          using (System.IO.StreamWriter writer = new System.IO.StreamWriter(save.FileName, false, Encoding.UTF8))
          {
            if ((_show.Visible == true && _saveOrig.Checked == true) || (_show.Visible == false && _splitter.Panel2Collapsed == true))
            {
              if (_show.Visible == true) writer.WriteLine("/*");
              writer.WriteLine(_original.Text.Replace("\r", "").TrimEnd('\n').Replace("\n", "\r\n"));
              if (_show.Visible == true) writer.WriteLine("*/");
            }
            if (_show.Visible == true || _splitter.Panel2Collapsed == false) 
              writer.WriteLine(_script.Text.Replace("\r", "").TrimEnd('\n').Replace("\n", "\r\n"));
          }
        }
      }
      Close();
    }

    private void _show_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)







|



|







70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
          _defaultSave = _saveOrig.Checked;

          using (System.IO.StreamWriter writer = new System.IO.StreamWriter(save.FileName, false, Encoding.UTF8))
          {
            if ((_show.Visible == true && _saveOrig.Checked == true) || (_show.Visible == false && _splitter.Panel2Collapsed == true))
            {
              if (_show.Visible == true) writer.WriteLine("/*");
              writer.WriteLine(_original.Text.Replace("\r", String.Empty).TrimEnd('\n').Replace("\n", "\r\n"));
              if (_show.Visible == true) writer.WriteLine("*/");
            }
            if (_show.Visible == true || _splitter.Panel2Collapsed == false) 
              writer.WriteLine(_script.Text.Replace("\r", String.Empty).TrimEnd('\n').Replace("\n", "\r\n"));
          }
        }
      }
      Close();
    }

    private void _show_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)

Changes to SQLite.Designer/Design/Check.cs.

Changes to SQLite.Designer/Design/Column.cs.

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  using System.Data;
  using System.Data.Common;
  using System.Globalization;

  internal class Column : IHaveConnection
  {
    private bool _allowNulls;
    private string _dataType = "";
    private string _defaultValue = "";
    private string _columnName = "";
    private string _origName = "";
    private string _collate;
    private DataGridViewRow _parent;
    private Unique _unique;
    private Table _table;

    internal Column(Table table, DataGridViewRow row)
    {







|
|
|
|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
  using System.Data;
  using System.Data.Common;
  using System.Globalization;

  internal class Column : IHaveConnection
  {
    private bool _allowNulls;
    private string _dataType = String.Empty;
    private string _defaultValue = String.Empty;
    private string _columnName = String.Empty;
    private string _origName = String.Empty;
    private string _collate;
    private DataGridViewRow _parent;
    private Unique _unique;
    private Table _table;

    internal Column(Table table, DataGridViewRow row)
    {
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
      else if (edmtype == "decimal")
      {
        int size = (row.IsNull("NUMERIC_PRECISION") == false) ? Convert.ToInt32(row["NUMERIC_PRECISION"], CultureInfo.InvariantCulture) : 53;
        int scale = (row.IsNull("NUMERIC_SCALE") == false) ? Convert.ToInt32(row["NUMERIC_SCALE"], CultureInfo.InvariantCulture) : int.MaxValue;

        if (size != 53)
        {
          string scalestr = (scale == int.MaxValue) ? "" : String.Format(CultureInfo.InvariantCulture, ",{0}", scale);
          _dataType = string.Format(CultureInfo.InvariantCulture, "{0}({1}{2})", _dataType, size, scalestr);
        }
      }
    }

    #region IHaveConnection Members








|







62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
      else if (edmtype == "decimal")
      {
        int size = (row.IsNull("NUMERIC_PRECISION") == false) ? Convert.ToInt32(row["NUMERIC_PRECISION"], CultureInfo.InvariantCulture) : 53;
        int scale = (row.IsNull("NUMERIC_SCALE") == false) ? Convert.ToInt32(row["NUMERIC_SCALE"], CultureInfo.InvariantCulture) : int.MaxValue;

        if (size != 53)
        {
          string scalestr = (scale == int.MaxValue) ? String.Empty : String.Format(CultureInfo.InvariantCulture, ",{0}", scale);
          _dataType = string.Format(CultureInfo.InvariantCulture, "{0}({1}{2})", _dataType, size, scalestr);
        }
      }
    }

    #region IHaveConnection Members

Changes to SQLite.Designer/Design/ForeignKey.cs.

1
2
3
4
5
6
7
8
9
10
11
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer.Design
{
  using System;
  using System.Collections.Generic;



|







1
2
3
4
5
6
7
8
9
10
11
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer.Design
{
  using System;
  using System.Collections.Generic;
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
          {
            if (fkey.IsDirty) dirty = true;

            list.Add(value[i]);
          }
        }
        if ((dirty == true || list.Count != _count) && _form.DialogResult == DialogResult.OK)
        _table.MakeDirty();      
      }
      return editValue;
    }
  }

  internal class ForeignKeyItem : IHaveConnectionScope
  {







|







100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
          {
            if (fkey.IsDirty) dirty = true;

            list.Add(value[i]);
          }
        }
        if ((dirty == true || list.Count != _count) && _form.DialogResult == DialogResult.OK)
        _table.MakeDirty();
      }
      return editValue;
    }
  }

  internal class ForeignKeyItem : IHaveConnectionScope
  {
280
281
282
283
284
285
286


287
288
289



290
291
292
293
294


295
296
297



298
299
300
301
302
303
304
    }
  }

  [DefaultProperty("From")]
  internal class ForeignKey : IHaveConnection, ICloneable
  {
    internal Table _table;


    internal ForeignKeyFromItem _from;
    internal ForeignKeyToItem _to;
    internal string _name;



    private bool _dirty;

    private ForeignKey(ForeignKey source)
    {
      _table = source._table;


      _from = new ForeignKeyFromItem(this, source._from.Column);
      _to = new ForeignKeyToItem(this, source._to.Catalog, source._to.Table, source._to.Column);
      _name = source._name;



      _dirty = source._dirty;
    }

    internal void MakeDirty()
    {
      _dirty = true;
    }







>
>



>
>
>





>
>



>
>
>







280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
    }
  }

  [DefaultProperty("From")]
  internal class ForeignKey : IHaveConnection, ICloneable
  {
    internal Table _table;
    internal int _id;
    internal int _ordinal;
    internal ForeignKeyFromItem _from;
    internal ForeignKeyToItem _to;
    internal string _name;
    internal string _onUpdate;
    internal string _onDelete;
    internal string _match;
    private bool _dirty;

    private ForeignKey(ForeignKey source)
    {
      _table = source._table;
      _id = source._id;
      _ordinal = source._ordinal;
      _from = new ForeignKeyFromItem(this, source._from.Column);
      _to = new ForeignKeyToItem(this, source._to.Catalog, source._to.Table, source._to.Column);
      _name = source._name;
      _onUpdate = source._onUpdate;
      _onDelete = source._onDelete;
      _match = source._match;
      _dirty = source._dirty;
    }

    internal void MakeDirty()
    {
      _dirty = true;
    }
315
316
317
318
319
320
321


322
323
324



325
326
327


328
329
330
331
332
333
334
335
336
    }

    internal ForeignKey(DbConnection cnn, Table table, DataRow row)
    {
      _table = table;
      if (row != null)
      {


        _from = new ForeignKeyFromItem(this, row["FKEY_FROM_COLUMN"].ToString());
        _to = new ForeignKeyToItem(this, row["FKEY_TO_CATALOG"].ToString(), row["FKEY_TO_TABLE"].ToString(), row["FKEY_TO_COLUMN"].ToString());
        _name = row["CONSTRAINT_NAME"].ToString();



      }
      else
      {


        _from = new ForeignKeyFromItem(this, "");
        _to = new ForeignKeyToItem(this, _table.Catalog, "", "");
      }
    }

    //internal void WriteSql(StringBuilder builder)
    //{
    //  if (String.IsNullOrEmpty(_from.Column) == false && String.IsNullOrEmpty(_to.Catalog) == false &&
    //    String.IsNullOrEmpty(_to.Table) == false && String.IsNullOrEmpty(_to.Column) == false)







>
>



>
>
>



>
>
|
|







325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
    }

    internal ForeignKey(DbConnection cnn, Table table, DataRow row)
    {
      _table = table;
      if (row != null)
      {
        _id = (int)row["FKEY_ID"];
        _ordinal = (int)row["FKEY_FROM_ORDINAL_POSITION"];
        _from = new ForeignKeyFromItem(this, row["FKEY_FROM_COLUMN"].ToString());
        _to = new ForeignKeyToItem(this, row["FKEY_TO_CATALOG"].ToString(), row["FKEY_TO_TABLE"].ToString(), row["FKEY_TO_COLUMN"].ToString());
        _name = row["CONSTRAINT_NAME"].ToString();
        _onUpdate = row["FKEY_ON_UPDATE"].ToString();
        _onDelete = row["FKEY_ON_DELETE"].ToString();
        _match = row["FKEY_MATCH"].ToString();
      }
      else
      {
        _id = -1;
        _ordinal = -1;
        _from = new ForeignKeyFromItem(this, String.Empty);
        _to = new ForeignKeyToItem(this, _table.Catalog, String.Empty, String.Empty);
      }
    }

    //internal void WriteSql(StringBuilder builder)
    //{
    //  if (String.IsNullOrEmpty(_from.Column) == false && String.IsNullOrEmpty(_to.Catalog) == false &&
    //    String.IsNullOrEmpty(_to.Table) == false && String.IsNullOrEmpty(_to.Column) == false)
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
    [Description("The name of the foreign key.")]
    public string Name
    {
      get
      {
        if (String.IsNullOrEmpty(_name) == false) return _name;

        return String.Format(CultureInfo.InvariantCulture, "FK_{0}_{1}_{2}_{3}", _from.Table, _from.Column, _to.Table, _to.Column);
      }
      set
      {
        if (_name != value)
        {
          _name = value;
          MakeDirty();







|







361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
    [Description("The name of the foreign key.")]
    public string Name
    {
      get
      {
        if (String.IsNullOrEmpty(_name) == false) return _name;

        return String.Format(CultureInfo.InvariantCulture, "FK_{0}_{1}_{2}", _from.Table, _id, _ordinal);
      }
      set
      {
        if (_name != value)
        {
          _name = value;
          MakeDirty();
370
371
372
373
374
375
376
















377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
























393
394
395
396
397
398
399
400
401
402
403

    public DbConnection GetConnection()
    {
      return ((IHaveConnection)_table).GetConnection();
    }

    #endregion

















    [DisplayName("From Key")]
    [Category("From")]
    [Description("The source column in the current table that refers to the foreign key.")]
    public ForeignKeyFromItem From
    {
      get { return _from; }
    }

    [DisplayName("To Key")]
    [Category("To")]
    [Description("The table and column to which the specified from column is related.")]
    public ForeignKeyToItem To
    {
      get { return _to; }
    }

























    #region ICloneable Members

    public object Clone()
    {
      return new ForeignKey(this);
    }

    #endregion
  }
}







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
















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











387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460

    public DbConnection GetConnection()
    {
      return ((IHaveConnection)_table).GetConnection();
    }

    #endregion

    [DisplayName("Id")]
    [Category("Id")]
    [Description("The identifier of this foreign key.")]
    public int Id
    {
      get { return _id; }
    }

    [DisplayName("Ordinal")]
    [Category("Ordinal")]
    [Description("The column ordinal of this foreign key.")]
    public int Ordinal
    {
      get { return _ordinal; }
    }

    [DisplayName("From Key")]
    [Category("From")]
    [Description("The source column in the current table that refers to the foreign key.")]
    public ForeignKeyFromItem From
    {
      get { return _from; }
    }

    [DisplayName("To Key")]
    [Category("To")]
    [Description("The table and column to which the specified from column is related.")]
    public ForeignKeyToItem To
    {
      get { return _to; }
    }

    [DisplayName("On Update")]
    [Category("Action")]
    [Description("The action to take when modifying the parent key values of an existing row.")]
    public string OnUpdate
    {
        get { return _onUpdate; }
    }

    [DisplayName("On Delete")]
    [Category("Action")]
    [Description("The action to take when deleting a row from the parent table.")]
    public string OnDelete
    {
        get { return _onDelete; }
    }

    [DisplayName("Match")]
    [Category("Match")]
    [Description("Used with composite foreign key definitions to modify the way NULL values that occur in child keys are handled.  Not currently supported.")]
    public string Match
    {
        get { return _match; }
    }

    #region ICloneable Members

    public object Clone()
    {
      return new ForeignKey(this);
    }

    #endregion
  }
}

Changes to SQLite.Designer/Design/Index.cs.

265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
    }

    public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
    {
      if (destinationType == typeof(string))
      {
        StringBuilder builder = new StringBuilder();
        string separator = "";
        foreach (IndexColumn c in (List<IndexColumn>)value)
        {
          builder.AppendFormat("{0}[{1}]", separator, c.Column);
          if (c.SortMode != ColumnSortMode.Ascending)
            builder.Append(" DESC");
          if (c.Collate != "BINARY")
            builder.AppendFormat(" COLLATE {0}", c.Collate.ToUpperInvariant());







|







265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
    }

    public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
    {
      if (destinationType == typeof(string))
      {
        StringBuilder builder = new StringBuilder();
        string separator = String.Empty;
        foreach (IndexColumn c in (List<IndexColumn>)value)
        {
          builder.AppendFormat("{0}[{1}]", separator, c.Column);
          if (c.SortMode != ColumnSortMode.Ascending)
            builder.Append(" DESC");
          if (c.Collate != "BINARY")
            builder.AppendFormat(" COLLATE {0}", c.Collate.ToUpperInvariant());
389
390
391
392
393
394
395

396



397
398
399
400
401
402
403
    }

    internal IndexColumn(Index parent, DataRow row)
    {
      _parent = parent;
      if (row != null)
      {

        _column = row["COLUMN_NAME"].ToString();



        if (row.IsNull("SORT_MODE") == false && (string)row["SORT_MODE"] != "ASC")
          _mode = ColumnSortMode.Descending;

        if (row.IsNull("COLLATION_NAME") == false)
          _collate = row["COLLATION_NAME"].ToString().ToUpperInvariant();
      }
    }







>
|
>
>
>







389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
    }

    internal IndexColumn(Index parent, DataRow row)
    {
      _parent = parent;
      if (row != null)
      {
        if (!row.IsNull("COLUMN_NAME"))
          _column = row["COLUMN_NAME"].ToString();
        else
          _column = null;

        if (row.IsNull("SORT_MODE") == false && (string)row["SORT_MODE"] != "ASC")
          _mode = ColumnSortMode.Descending;

        if (row.IsNull("COLLATION_NAME") == false)
          _collate = row["COLLATION_NAME"].ToString().ToUpperInvariant();
      }
    }
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
      return ((IHaveConnection)_table).GetConnection();
    }

    #endregion

    internal virtual void WriteSql(StringBuilder builder)
    {
      string separator = "";
      builder.AppendFormat(CultureInfo.InvariantCulture, "CREATE {0}INDEX [{1}].[{2}] ON [{3}] (", (_unique == true) ? "UNIQUE " : "", _table.Catalog, Name, _table.Name);
      foreach (IndexColumn c in Columns)
      {
        builder.AppendFormat(CultureInfo.InvariantCulture, "{0}[{1}]", separator, c.Column);
        
        if (c.SortMode != ColumnSortMode.Ascending)
          builder.Append(" DESC");








|
|







518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
      return ((IHaveConnection)_table).GetConnection();
    }

    #endregion

    internal virtual void WriteSql(StringBuilder builder)
    {
      string separator = String.Empty;
      builder.AppendFormat(CultureInfo.InvariantCulture, "CREATE {0}INDEX [{1}].[{2}] ON [{3}] (", (_unique == true) ? "UNIQUE " : String.Empty, _table.Catalog, Name, _table.Name);
      foreach (IndexColumn c in Columns)
      {
        builder.AppendFormat(CultureInfo.InvariantCulture, "{0}[{1}]", separator, c.Column);
        
        if (c.SortMode != ColumnSortMode.Ascending)
          builder.Append(" DESC");

615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
          int count = 0;
          string proposed = name;

          _calcname = true;
          for (int n = 0; n < _table.Indexes.Count; n++)
          {
            Index idx = _table.Indexes[n];
            proposed = String.Format(CultureInfo.InvariantCulture, "{0}{1}", name, (count > 0) ? count.ToString() : "");
            if (idx.Name == proposed)
            {
              count++;
              n = -1;
            }
          }
          _calcname = false;







|







619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
          int count = 0;
          string proposed = name;

          _calcname = true;
          for (int n = 0; n < _table.Indexes.Count; n++)
          {
            Index idx = _table.Indexes[n];
            proposed = String.Format(CultureInfo.InvariantCulture, "{0}{1}", name, (count > 0) ? count.ToString() : String.Empty);
            if (idx.Name == proposed)
            {
              count++;
              n = -1;
            }
          }
          _calcname = false;

Changes to SQLite.Designer/Design/SimpleTokenizer.cs.

22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
      internal bool sep;
      internal int depth;
      internal string keyword;
      internal char sepchar;

      public override string ToString()
      {
        return String.Format(CultureInfo.InvariantCulture, "{0} {1} at {2} {3} depth {4}", value, quote, position, sep == true ? "(sep)" : "", depth);
      }
    }

    public static StringParts[] BreakString(string source)
    {
      char[] opens = new char[] { '\"', '[', '\'', '(', ')', ',', ' ', ';', '\r', '\n', '\t' };
      char[] opens2 = new char[] { '\"', '[', '\'', '(', ')', ',', ' ', ';', '\r', '\n', '\t', '.' };







|







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
      internal bool sep;
      internal int depth;
      internal string keyword;
      internal char sepchar;

      public override string ToString()
      {
        return String.Format(CultureInfo.InvariantCulture, "{0} {1} at {2} {3} depth {4}", value, quote, position, sep == true ? "(sep)" : String.Empty, depth);
      }
    }

    public static StringParts[] BreakString(string source)
    {
      char[] opens = new char[] { '\"', '[', '\'', '(', ')', ',', ' ', ';', '\r', '\n', '\t' };
      char[] opens2 = new char[] { '\"', '[', '\'', '(', ')', ',', ' ', ';', '\r', '\n', '\t', '.' };

Changes to SQLite.Designer/Design/Table.cs.

1
2
3
4
5
6
7
8
9
10
11
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer.Design
{
  using System;
  using System.Data.Common;



|







1
2
3
4
5
6
7
8
9
10
11
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer.Design
{
  using System;
  using System.Data.Common;
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
        }
        else
        {
          _exists = false;
          return;
        }
      }
      
      _indexes.Clear();
      _oldindexes.Clear();

      using (DataTable tbl = _connection.GetSchema("Indexes", new string[] { Catalog, null, Name }))
      {
        foreach (DataRow row in tbl.Rows)
        {







|







99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
        }
        else
        {
          _exists = false;
          return;
        }
      }

      _indexes.Clear();
      _oldindexes.Clear();

      using (DataTable tbl = _connection.GetSchema("Indexes", new string[] { Catalog, null, Name }))
      {
        foreach (DataRow row in tbl.Rows)
        {
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
          c.WriteSql(builder);
          separator = ",\r\n    ";
        }
      }

      if (_key.Columns.Count > 1)
      {
        string innersep = "";
        builder.AppendFormat(CultureInfo.InvariantCulture, "{0}CONSTRAINT [PK_{1}] PRIMARY KEY (", separator, Name);
        foreach (IndexColumn c in _key.Columns)
        {
          builder.AppendFormat(CultureInfo.InvariantCulture, "{0}[{1}]", innersep, c.Column);
          if (String.IsNullOrEmpty(c.Collate) == false && String.Compare(c.Collate, "BINARY", StringComparison.OrdinalIgnoreCase) != 0)
            builder.AppendFormat(CultureInfo.InvariantCulture, " COLLATE {0}", c.Collate.ToUpperInvariant());








|







368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
          c.WriteSql(builder);
          separator = ",\r\n    ";
        }
      }

      if (_key.Columns.Count > 1)
      {
        string innersep = String.Empty;
        builder.AppendFormat(CultureInfo.InvariantCulture, "{0}CONSTRAINT [PK_{1}] PRIMARY KEY (", separator, Name);
        foreach (IndexColumn c in _key.Columns)
        {
          builder.AppendFormat(CultureInfo.InvariantCulture, "{0}[{1}]", innersep, c.Column);
          if (String.IsNullOrEmpty(c.Collate) == false && String.Compare(c.Collate, "BINARY", StringComparison.OrdinalIgnoreCase) != 0)
            builder.AppendFormat(CultureInfo.InvariantCulture, " COLLATE {0}", c.Collate.ToUpperInvariant());

405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
            break;
          }
        }
        builder.Append(separator);
        builder.AppendFormat("CONSTRAINT [CK_{0}_{1}] CHECK {2}", Name, n + 1, check);
      }

      List<ForeignKey> keys = new List<ForeignKey>();

      for (int x = 0; x < ForeignKeys.Count; x++)
      {
        ForeignKey key = ForeignKeys[x];

        if (String.IsNullOrEmpty(key.From.Column) == true || String.IsNullOrEmpty(key.From.Catalog) == true ||
          String.IsNullOrEmpty(key.To.Table) == true || String.IsNullOrEmpty(key.To.Column) == true)
          continue;

        if (keys.Count > 0)
        {
          if (keys[0].Name == key.Name && keys[0].To.Catalog == key.To.Catalog && keys[0].To.Table == key.To.Table)
          {
            keys.Add(key);
            continue;
          }
          builder.Append(separator);
          WriteFKeys(keys, builder);
          keys.Clear();
        }
        keys.Add(key);
      }

      if (keys.Count > 0)
      {
        builder.Append(separator);
        WriteFKeys(keys, builder);
      }

      builder.Append("\r\n);\r\n");

      // Rebuilding an existing table
      if (altName != null)
      {
        separator = "";
        builder.Append("\r\n-- Copy the contents of the old table into the new table\r\n");
        builder.AppendFormat("INSERT INTO [{0}].[{1}] (", _catalog, Name);
        foreach (Column c in Columns)
        {
          if (String.IsNullOrEmpty(c.OriginalName) == false)
          {
            builder.AppendFormat("{1}[{0}]", c.ColumnName, separator);
            separator = ", ";
          }
        }
        builder.Append(")\r\n  SELECT ");
        separator = "";
        foreach (Column c in Columns)
        {
          if (String.IsNullOrEmpty(c.OriginalName) == false)
          {
            builder.AppendFormat("{1}[{0}]", c.OriginalName, separator);
            separator = ", ";
          }







<
<
<
<
<
<
<
<
<
<
|
|
<
<
<
<
<
|
|
<
<
<
<
<
<
<
<
<







|











|







405
406
407
408
409
410
411










412
413





414
415









416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
            break;
          }
        }
        builder.Append(separator);
        builder.AppendFormat("CONSTRAINT [CK_{0}_{1}] CHECK {2}", Name, n + 1, check);
      }











      if (ForeignKeys.Count > 0)
      {





        builder.Append(separator);
        WriteFKeys(ForeignKeys, builder);









      }

      builder.Append("\r\n);\r\n");

      // Rebuilding an existing table
      if (altName != null)
      {
        separator = String.Empty;
        builder.Append("\r\n-- Copy the contents of the old table into the new table\r\n");
        builder.AppendFormat("INSERT INTO [{0}].[{1}] (", _catalog, Name);
        foreach (Column c in Columns)
        {
          if (String.IsNullOrEmpty(c.OriginalName) == false)
          {
            builder.AppendFormat("{1}[{0}]", c.ColumnName, separator);
            separator = ", ";
          }
        }
        builder.Append(")\r\n  SELECT ");
        separator = String.Empty;
        foreach (Column c in Columns)
        {
          if (String.IsNullOrEmpty(c.OriginalName) == false)
          {
            builder.AppendFormat("{1}[{0}]", c.OriginalName, separator);
            separator = ", ";
          }
496
497
498
499
500
501
502







503

504

505
506

507
508
509

510


511
512
513



514
515

516
517


518


519
520














521
522
523
524
525
526
527
      }

      return builder.ToString();
    }

    private void WriteFKeys(List<ForeignKey> keys, StringBuilder builder)
    {







      builder.AppendFormat("CONSTRAINT [{0}] FOREIGN KEY (", keys[0].Name);

      string separator = "";


      foreach (ForeignKey key in keys)

      {
        builder.AppendFormat("{0}[{1}]", separator, key.From.Column);
        separator = ", ";

      }



      builder.AppendFormat(") REFERENCES [{0}] (", keys[0].To.Table);




      separator = "";
      foreach (ForeignKey key in keys)

      {
        builder.AppendFormat("{0}[{1}]", separator, key.To.Column);


        separator = ", ";


      }
      builder.Append(")");














    }

    [Browsable(false)]
    public override ViewTableBase DesignTable
    {
      get { return this; }
    }







>
>
>
>
>
>
>
|
>
|
>

<
>
|
|
|
>
|
>
>

|

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







472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490

491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
      }

      return builder.ToString();
    }

    private void WriteFKeys(List<ForeignKey> keys, StringBuilder builder)
    {
        for (int index = 0; index < keys.Count; )
        {
            ForeignKey key = keys[index];

            if (index > 0)
                builder.Append(",\r\n    ");

            builder.AppendFormat(
                "CONSTRAINT [{0}] FOREIGN KEY (", key.Name);

            int startIndex = index;


            do
            {
                builder.AppendFormat("{0}[{1}]",
                    index > startIndex ? ", " : String.Empty,
                    keys[index].From.Column);

                index++;
            } while (index < keys.Count && keys[index].Id == key.Id);

            builder.AppendFormat(") REFERENCES [{0}]", key.To.Table);

            if (!String.IsNullOrEmpty(key.To.Column))
            {
                builder.Append(" (");
                index = startIndex;

                do
                {
                    builder.AppendFormat("{0}[{1}]",
                        index > startIndex ? ", " : String.Empty,
                        keys[index].To.Column);

                    index++;
                } while (index < keys.Count && keys[index].Id == key.Id);

                builder.Append(')');
            }

            if (!String.IsNullOrEmpty(key.Match))
                builder.AppendFormat(" MATCH {0}", key.Match);

            if (!String.IsNullOrEmpty(key.OnUpdate))
                builder.AppendFormat(" ON UPDATE {0}", key.OnUpdate);

            if (!String.IsNullOrEmpty(key.OnDelete))
                builder.AppendFormat(" ON DELETE {0}", key.OnDelete);

            if (index == startIndex)
                index++;
        }
    }

    [Browsable(false)]
    public override ViewTableBase DesignTable
    {
      get { return this; }
    }

Changes to SQLite.Designer/Design/Trigger.cs.

252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
          int count = 0;
          string proposed = name;

          _calcname = true;
          for (int n = 0; n < ((IList)_table.Triggers).Count; n++)
          {
            Trigger idx = ((IList)_table.Triggers)[n] as Trigger;
            proposed = string.Format(CultureInfo.InvariantCulture, "{0}{1}", name, (count > 0) ? count.ToString() : "");
            if (idx.Name == proposed)
            {
              count++;
              n = -1;
            }
          }
          _calcname = false;







|







252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
          int count = 0;
          string proposed = name;

          _calcname = true;
          for (int n = 0; n < ((IList)_table.Triggers).Count; n++)
          {
            Trigger idx = ((IList)_table.Triggers)[n] as Trigger;
            proposed = string.Format(CultureInfo.InvariantCulture, "{0}{1}", name, (count > 0) ? count.ToString() : String.Empty);
            if (idx.Name == proposed)
            {
              count++;
              n = -1;
            }
          }
          _calcname = false;
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
        {
          case "UPDATE":
            _type = TriggerType.Update;
            if (arr[x + 1].keyword == "OF")
            {
              x++;
              StringBuilder builder = new StringBuilder();
              string separator = "";
              while (arr[x + 1].keyword != "ON")
              {
                builder.AppendFormat("{0}[{1}]", separator, arr[x + 1].value);
                separator = ", ";
                x++;
              }
              _columns = builder.ToString();







|







360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
        {
          case "UPDATE":
            _type = TriggerType.Update;
            if (arr[x + 1].keyword == "OF")
            {
              x++;
              StringBuilder builder = new StringBuilder();
              string separator = String.Empty;
              while (arr[x + 1].keyword != "ON")
              {
                builder.AppendFormat("{0}[{1}]", separator, arr[x + 1].value);
                separator = ", ";
                x++;
              }
              _columns = builder.ToString();

Changes to SQLite.Designer/Design/View.cs.

175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
          builder.AppendFormat("DROP TRIGGER [{0}].[{1}];\r\n", Catalog, trig.Name);
        }
        builder.AppendFormat("DROP VIEW [{0}].[{1}];\r\n", Catalog, _oldname);
      }

      builder.AppendFormat("CREATE VIEW [{0}].[{1}] AS {2};\r\n", Catalog, Name, SqlText);

      string sep = "";
      foreach (ViewTrigger trig in _triggers)
      {
        builder.Append(sep);
        trig.WriteSql(builder);
        sep = "\r\n";
      }








|







175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
          builder.AppendFormat("DROP TRIGGER [{0}].[{1}];\r\n", Catalog, trig.Name);
        }
        builder.AppendFormat("DROP VIEW [{0}].[{1}];\r\n", Catalog, _oldname);
      }

      builder.AppendFormat("CREATE VIEW [{0}].[{1}] AS {2};\r\n", Catalog, Name, SqlText);

      string sep = String.Empty;
      foreach (ViewTrigger trig in _triggers)
      {
        builder.Append(sep);
        trig.WriteSql(builder);
        sep = "\r\n";
      }

Changes to SQLite.Designer/Editors/TableDesignerDoc.Designer.cs.








1
2
3
4
5
6
7







namespace SQLite.Designer.Editors
{
  partial class TableDesignerDoc
  {
    /// <summary>
    /// Required designer variable.
    /// </summary>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer.Editors
{
  partial class TableDesignerDoc
  {
    /// <summary>
    /// Required designer variable.
    /// </summary>

Changes to SQLite.Designer/Editors/TableDesignerDoc.cs.

795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
      {
        case __FRAMESHOW.FRAMESHOW_WinShown:
        case __FRAMESHOW.FRAMESHOW_WinRestored:
          SetPropertyWindow();
          if (_warned == false)
          {
            _warned = true;
            MessageBox.Show(this, "The table designer is still in development.  Please report bugs to robert@blackcastlesoft.com", "Feature Under Review", MessageBoxButtons.OK);
          }
          break;
      }
      return VSConstants.S_OK;
    }

    int IVsWindowFrameNotify.OnSize()







|







795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
      {
        case __FRAMESHOW.FRAMESHOW_WinShown:
        case __FRAMESHOW.FRAMESHOW_WinRestored:
          SetPropertyWindow();
          if (_warned == false)
          {
            _warned = true;
            MessageBox.Show(this, "The table designer is still in development.  Please report bugs to the sqlite-users mailing list at sqlite-users@mailinglists.sqlite.org", "Feature Under Review", MessageBoxButtons.OK);
          }
          break;
      }
      return VSConstants.S_OK;
    }

    int IVsWindowFrameNotify.OnSize()

Changes to SQLite.Designer/Editors/ViewDesignerDoc.Designer.cs.








1
2
3
4
5
6
7







namespace SQLite.Designer.Editors
{
  partial class ViewDesignerDoc
  {
    /// <summary> 
    /// Required designer variable.
    /// </summary>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer.Editors
{
  partial class ViewDesignerDoc
  {
    /// <summary> 
    /// Required designer variable.
    /// </summary>

Changes to SQLite.Designer/Editors/ViewDesignerDoc.cs.

73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
      try
      {
        _typeQB = SQLiteDataAdapterToolboxItem._vsdesigner.GetType("Microsoft.VSDesigner.Data.Design.QueryBuilderControl");

        if (_typeQB != null)
        {
          _queryDesigner = Activator.CreateInstance(_typeQB) as UserControl;
          _typeQB.InvokeMember("Provider", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.SetProperty | System.Reflection.BindingFlags.NonPublic, null, _queryDesigner, new object[] { "System.Data.SQLite" });
          _typeQB.InvokeMember("ConnectionString", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.SetProperty | System.Reflection.BindingFlags.NonPublic, null, _queryDesigner, new object[] { _connection.ConnectionSupport.ConnectionString });
          _typeQB.InvokeMember("EnableMorphing", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.SetProperty | System.Reflection.BindingFlags.NonPublic, null, _queryDesigner, new object[] { false });
          Controls.Add(_queryDesigner);
          _queryDesigner.Dock = DockStyle.Fill;
          _queryDesigner.Visible = true;
        }








|







73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
      try
      {
        _typeQB = SQLiteDataAdapterToolboxItem._vsdesigner.GetType("Microsoft.VSDesigner.Data.Design.QueryBuilderControl");

        if (_typeQB != null)
        {
          _queryDesigner = Activator.CreateInstance(_typeQB) as UserControl;
          _typeQB.InvokeMember("Provider", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.SetProperty | System.Reflection.BindingFlags.NonPublic, null, _queryDesigner, new object[] { SQLiteOptions.GetProviderName() });
          _typeQB.InvokeMember("ConnectionString", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.SetProperty | System.Reflection.BindingFlags.NonPublic, null, _queryDesigner, new object[] { _connection.ConnectionSupport.ConnectionString });
          _typeQB.InvokeMember("EnableMorphing", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.SetProperty | System.Reflection.BindingFlags.NonPublic, null, _queryDesigner, new object[] { false });
          Controls.Add(_queryDesigner);
          _queryDesigner.Dock = DockStyle.Fill;
          _queryDesigner.Visible = true;
        }

564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
        case __FRAMESHOW.FRAMESHOW_WinShown:
        case __FRAMESHOW.FRAMESHOW_WinRestored:
          _timer.Enabled = true;
          SetPropertyWindow();
          if (_warned == false)
          {
            _warned = true;
            MessageBox.Show(this, "The view designer is still in development.  Please report bugs to robert@blackcastlesoft.com", "Feature Under Review", MessageBoxButtons.OK);
          }
          break;
      }
      return VSConstants.S_OK;
    }

    int IVsWindowFrameNotify.OnSize()







|







564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
        case __FRAMESHOW.FRAMESHOW_WinShown:
        case __FRAMESHOW.FRAMESHOW_WinRestored:
          _timer.Enabled = true;
          SetPropertyWindow();
          if (_warned == false)
          {
            _warned = true;
            MessageBox.Show(this, "The view designer is still in development.  Please report bugs to the sqlite-users mailing list at sqlite-users@mailinglists.sqlite.org", "Feature Under Review", MessageBoxButtons.OK);
          }
          break;
      }
      return VSConstants.S_OK;
    }

    int IVsWindowFrameNotify.OnSize()

Changes to SQLite.Designer/PkgCmd.vsct.

Added SQLite.Designer/SQLite.Designer.2005.csproj.

























































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Designer.2005.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>SQLite.Designer</RootNamespace>
    <AssemblyName>SQLite.Designer</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx20>true</NetFx20>
    <ConfigurationYear>2005</ConfigurationYear>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)SQLite.Designer.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Design" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
    <Reference Include="EnvDTE">
      <HintPath>$(VS80COMNTOOLS)..\IDE\PublicAssemblies\EnvDTE.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.Data.ConnectionUI">
      <HintPath>$(VSSDK80Install)VisualStudioIntegration\Common\Assemblies\Microsoft.Data.ConnectionUI.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Data">
      <HintPath>$(VSSDK80Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.Data.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.OLE.Interop">
      <HintPath>$(VSSDK80Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.OLE.Interop.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell">
      <HintPath>$(VSSDK80Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.Shell.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop">
      <HintPath>$(VSSDK80Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.Shell.Interop.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0">
      <HintPath>$(VSSDK80Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.Shell.Interop.8.0.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="ChangePasswordDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="ChangePasswordDialog.Designer.cs">
      <DependentUpon>ChangePasswordDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="ChangeScriptDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="ChangeScriptDialog.Designer.cs">
      <DependentUpon>ChangeScriptDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="Design\Check.cs" />
    <Compile Include="Design\Column.cs" />
    <Compile Include="Design\ForeignKey.cs" />
    <Compile Include="Design\Index.cs" />
    <Compile Include="Design\PrimaryKey.cs" />
    <Compile Include="Design\SimpleTokenizer.cs" />
    <Compile Include="Design\Table.cs" />
    <Compile Include="Design\Trigger.cs" />
    <Compile Include="Design\Unique.cs" />
    <Compile Include="Design\View.cs" />
    <Compile Include="Editors\AutoCompleteColumn.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="Editors\TableDesignerDoc.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="Editors\TableDesignerDoc.Designer.cs">
      <DependentUpon>TableDesignerDoc.cs</DependentUpon>
    </Compile>
    <Compile Include="Editors\ViewDesignerDoc.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="Editors\ViewDesignerDoc.Designer.cs">
      <DependentUpon>ViewDesignerDoc.cs</DependentUpon>
    </Compile>
    <Compile Include="SQLiteAdapterDesigner.cs" />
    <Compile Include="SQLiteCommandDesigner.cs" />
    <Compile Include="SQLiteCommandHandler.cs" />
    <Compile Include="SQLiteConnectionProperties.cs" />
    <Compile Include="SQLiteConnectionStringEditor.cs" />
    <Compile Include="SQLiteConnectionUIControl.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="SQLiteConnectionUIControl.Designer.cs">
      <DependentUpon>SQLiteConnectionUIControl.cs</DependentUpon>
    </Compile>
    <Compile Include="SQLiteDataAdapterToolboxItem.cs" />
    <Compile Include="SQLiteDataConnectionSupport.cs" />
    <Compile Include="SQLiteDataObjectIdentifierResolver.cs" />
    <Compile Include="SQLiteDataObjectSupport.cs" />
    <Compile Include="SQLiteDataSourceInformation.cs" />
    <Compile Include="SQLiteDataViewSupport.cs" />
    <Compile Include="SQLiteOptions.cs" />
    <Compile Include="SQLitePackage.cs" />
    <Compile Include="SQLiteProviderObjectFactory.cs" />
    <Compile Include="TableNameDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="TableNameDialog.Designer.cs">
      <DependentUpon>TableNameDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="VSPackage.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>VSPackage.resx</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <VSCTCompile Include="PkgCmd.vsct">
      <ResourceName>1000</ResourceName>
    </VSCTCompile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="SQLiteDataObjectSupport2005.xml" />
    <EmbeddedResource Include="SQLiteDataViewSupport2005.xml" />
    <EmbeddedResource Include="VSPackage.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>VSPackage.Designer.cs</LastGenOutput>
      <MergeWithCTO>true</MergeWithCTO>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="ChangePasswordDialog.resx">
      <SubType>Designer</SubType>
      <DependentUpon>ChangePasswordDialog.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Editors\TableDesignerDoc.resx">
      <SubType>Designer</SubType>
      <DependentUpon>TableDesignerDoc.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Editors\ViewDesignerDoc.resx">
      <DependentUpon>ViewDesignerDoc.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="SQLiteConnectionUIControl.resx">
      <SubType>Designer</SubType>
      <DependentUpon>SQLiteConnectionUIControl.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="TableNameDialog.resx">
      <DependentUpon>TableNameDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="ChangeScriptDialog.resx">
      <DependentUpon>ChangeScriptDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\info.png" />
    <None Include="Resources\ToolboxItems.txt" />
    <None Include="source.extension.vsixmanifest" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup Condition="'$(VSSDK80Install)' == ''">
    <VSSDK80Install Condition="'$(ProgramFiles)' != '' And ('$(PROCESSOR_ARCHITECTURE)' == 'x86' And '$(PROCESSOR_ARCHITEW6432)' == '')">$(ProgramFiles)\Visual Studio 2005 SDK\2007.02\</VSSDK80Install>
    <VSSDK80Install Condition="'$(ProgramFiles%28x86%29)' != '' And ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or '$(PROCESSOR_ARCHITEW6432)' != '')">$(ProgramFiles%28x86%29)\Visual Studio 2005 SDK\2007.02\</VSSDK80Install>
  </PropertyGroup>
  <PropertyGroup Condition="'$(NetFx20)' == 'false'">
    <!--
        NOTE: We cannot build this project unless the version of the .NET
              Framework matches exactly.
    -->
    <BuildDependsOn>
      WrongNetFx
    </BuildDependsOn>
  </PropertyGroup>
  <PropertyGroup Condition="'$(VSSDK80Install)' == '' Or
                            !Exists('$(VSSDK80Install)VisualStudioIntegration\Common\Assemblies\Microsoft.Data.ConnectionUI.dll') Or
                            !Exists('$(VSSDK80Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.Data.dll') Or
                            !Exists('$(VSSDK80Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.OLE.Interop.dll') Or
                            !Exists('$(VSSDK80Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.Shell.dll') Or
                            !Exists('$(VSSDK80Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.Shell.Interop.dll') Or
                            !Exists('$(VSSDK80Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.Shell.Interop.8.0.dll')">
    <!--
        NOTE: We cannot build this project without the necessary reference
              assemblies; therefore, skip building it altogether.
    -->
    <BuildDependsOn>
      MissingVsSdk
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added SQLite.Designer/SQLite.Designer.2008.csproj.





























































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Designer.2008.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>SQLite.Designer</RootNamespace>
    <AssemblyName>SQLite.Designer</AssemblyName>
    <OldToolsVersion>2.0</OldToolsVersion>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx35>true</NetFx35>
    <ConfigurationYear>2008</ConfigurationYear>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)SQLite.Designer.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Design" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
    <Reference Include="EnvDTE">
      <HintPath>$(VS90COMNTOOLS)..\IDE\PublicAssemblies\EnvDTE.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.Data.ConnectionUI">
      <HintPath>$(VSSDK90Install)VisualStudioIntegration\Common\Assemblies\Microsoft.Data.ConnectionUI.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Data">
      <HintPath>$(VSSDK90Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.Data.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Data.Services">
      <HintPath>$(VSSDK90Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.Data.Services.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.OLE.Interop">
      <HintPath>$(VSSDK90Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.OLE.Interop.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell">
      <HintPath>$(VSSDK90Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.Shell.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop">
      <HintPath>$(VSSDK90Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.Shell.Interop.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0">
      <HintPath>$(VSSDK90Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.Shell.Interop.8.0.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="ChangePasswordDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="ChangePasswordDialog.Designer.cs">
      <DependentUpon>ChangePasswordDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="ChangeScriptDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="ChangeScriptDialog.Designer.cs">
      <DependentUpon>ChangeScriptDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="Design\Check.cs" />
    <Compile Include="Design\Column.cs" />
    <Compile Include="Design\ForeignKey.cs" />
    <Compile Include="Design\Index.cs" />
    <Compile Include="Design\PrimaryKey.cs" />
    <Compile Include="Design\SimpleTokenizer.cs" />
    <Compile Include="Design\Table.cs" />
    <Compile Include="Design\Trigger.cs" />
    <Compile Include="Design\Unique.cs" />
    <Compile Include="Design\View.cs" />
    <Compile Include="Editors\AutoCompleteColumn.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="Editors\TableDesignerDoc.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="Editors\TableDesignerDoc.Designer.cs">
      <DependentUpon>TableDesignerDoc.cs</DependentUpon>
    </Compile>
    <Compile Include="Editors\ViewDesignerDoc.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="Editors\ViewDesignerDoc.Designer.cs">
      <DependentUpon>ViewDesignerDoc.cs</DependentUpon>
    </Compile>
    <Compile Include="SQLiteAdapterDesigner.cs" />
    <Compile Include="SQLiteCommandDesigner.cs" />
    <Compile Include="SQLiteCommandHandler.cs" />
    <Compile Include="SQLiteConnectionProperties.cs" />
    <Compile Include="SQLiteConnectionStringEditor.cs" />
    <Compile Include="SQLiteConnectionUIControl.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="SQLiteConnectionUIControl.Designer.cs">
      <DependentUpon>SQLiteConnectionUIControl.cs</DependentUpon>
    </Compile>
    <Compile Include="SQLiteDataAdapterToolboxItem.cs" />
    <Compile Include="SQLiteDataConnectionSupport.cs" />
    <Compile Include="SQLiteDataObjectIdentifierResolver.cs" />
    <Compile Include="SQLiteDataObjectSupport.cs" />
    <Compile Include="SQLiteDataSourceInformation.cs" />
    <Compile Include="SQLiteDataViewSupport.cs" />
    <Compile Include="SQLiteOptions.cs" />
    <Compile Include="SQLitePackage.cs" />
    <Compile Include="SQLiteProviderObjectFactory.cs" />
    <Compile Include="TableNameDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="TableNameDialog.Designer.cs">
      <DependentUpon>TableNameDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="VSPackage.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>VSPackage.resx</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <VSCTCompile Include="PkgCmd.vsct">
      <ResourceName>1000</ResourceName>
    </VSCTCompile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="SQLiteDataObjectSupport2008.xml" />
    <EmbeddedResource Include="SQLiteDataViewSupport2008.xml" />
    <EmbeddedResource Include="VSPackage.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>VSPackage.Designer.cs</LastGenOutput>
      <MergeWithCTO>true</MergeWithCTO>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="ChangePasswordDialog.resx">
      <SubType>Designer</SubType>
      <DependentUpon>ChangePasswordDialog.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Editors\TableDesignerDoc.resx">
      <SubType>Designer</SubType>
      <DependentUpon>TableDesignerDoc.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Editors\ViewDesignerDoc.resx">
      <DependentUpon>ViewDesignerDoc.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="SQLiteConnectionUIControl.resx">
      <SubType>Designer</SubType>
      <DependentUpon>SQLiteConnectionUIControl.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="TableNameDialog.resx">
      <DependentUpon>TableNameDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="ChangeScriptDialog.resx">
      <DependentUpon>ChangeScriptDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\info.png" />
    <None Include="Resources\ToolboxItems.txt" />
    <None Include="source.extension.vsixmanifest" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup Condition="'$(NetFx35)' == 'false'">
    <!--
        NOTE: We cannot build this project unless the version of the .NET
              Framework matches exactly.
    -->
    <BuildDependsOn>
      WrongNetFx
    </BuildDependsOn>
  </PropertyGroup>
  <PropertyGroup Condition="'$(VSSDK90Install)' == '' Or
                            !Exists('$(VSSDK90Install)VisualStudioIntegration\Common\Assemblies\Microsoft.Data.ConnectionUI.dll') Or
                            !Exists('$(VSSDK90Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.Data.dll') Or
                            !Exists('$(VSSDK90Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.Data.Services.dll') Or
                            !Exists('$(VSSDK90Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.OLE.Interop.dll') Or
                            !Exists('$(VSSDK90Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.Shell.dll') Or
                            !Exists('$(VSSDK90Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.Shell.Interop.dll') Or
                            !Exists('$(VSSDK90Install)VisualStudioIntegration\Common\Assemblies\Microsoft.VisualStudio.Shell.Interop.8.0.dll')">
    <!--
        NOTE: We cannot build this project without the necessary reference
              assemblies; therefore, skip building it altogether.
    -->
    <BuildDependsOn>
      MissingVsSdk
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added SQLite.Designer/SQLite.Designer.2010.csproj.





























































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Designer.2010.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>10.0.30319</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>SQLite.Designer</RootNamespace>
    <AssemblyName>SQLite.Designer</AssemblyName>
    <OldToolsVersion>3.5</OldToolsVersion>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx40>true</NetFx40>
    <ConfigurationYear>2010</ConfigurationYear>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)SQLite.Designer.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Design" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
    <Reference Include="EnvDTE">
      <HintPath>$(VS100COMNTOOLS)..\IDE\PublicAssemblies\EnvDTE.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.Data.ConnectionUI">
      <HintPath>$(VSSDK100Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.Data.ConnectionUI.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Data">
      <HintPath>$(VSSDK100Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Data.Services">
      <HintPath>$(VSSDK100Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.Services.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.OLE.Interop">
      <HintPath>$(VSSDK100Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.OLE.Interop.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell">
      <HintPath>$(VSSDK100Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop">
      <HintPath>$(VSSDK100Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0">
      <HintPath>$(VSSDK100Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.8.0.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="ChangePasswordDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="ChangePasswordDialog.Designer.cs">
      <DependentUpon>ChangePasswordDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="ChangeScriptDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="ChangeScriptDialog.Designer.cs">
      <DependentUpon>ChangeScriptDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="Design\Check.cs" />
    <Compile Include="Design\Column.cs" />
    <Compile Include="Design\ForeignKey.cs" />
    <Compile Include="Design\Index.cs" />
    <Compile Include="Design\PrimaryKey.cs" />
    <Compile Include="Design\SimpleTokenizer.cs" />
    <Compile Include="Design\Table.cs" />
    <Compile Include="Design\Trigger.cs" />
    <Compile Include="Design\Unique.cs" />
    <Compile Include="Design\View.cs" />
    <Compile Include="Editors\AutoCompleteColumn.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="Editors\TableDesignerDoc.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="Editors\TableDesignerDoc.Designer.cs">
      <DependentUpon>TableDesignerDoc.cs</DependentUpon>
    </Compile>
    <Compile Include="Editors\ViewDesignerDoc.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="Editors\ViewDesignerDoc.Designer.cs">
      <DependentUpon>ViewDesignerDoc.cs</DependentUpon>
    </Compile>
    <Compile Include="SQLiteAdapterDesigner.cs" />
    <Compile Include="SQLiteCommandDesigner.cs" />
    <Compile Include="SQLiteCommandHandler.cs" />
    <Compile Include="SQLiteConnectionProperties.cs" />
    <Compile Include="SQLiteConnectionStringEditor.cs" />
    <Compile Include="SQLiteConnectionUIControl.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="SQLiteConnectionUIControl.Designer.cs">
      <DependentUpon>SQLiteConnectionUIControl.cs</DependentUpon>
    </Compile>
    <Compile Include="SQLiteDataAdapterToolboxItem.cs" />
    <Compile Include="SQLiteDataConnectionSupport.cs" />
    <Compile Include="SQLiteDataObjectIdentifierResolver.cs" />
    <Compile Include="SQLiteDataObjectSupport.cs" />
    <Compile Include="SQLiteDataSourceInformation.cs" />
    <Compile Include="SQLiteDataViewSupport.cs" />
    <Compile Include="SQLiteOptions.cs" />
    <Compile Include="SQLitePackage.cs" />
    <Compile Include="SQLiteProviderObjectFactory.cs" />
    <Compile Include="TableNameDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="TableNameDialog.Designer.cs">
      <DependentUpon>TableNameDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="VSPackage.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>VSPackage.resx</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <VSCTCompile Include="PkgCmd.vsct">
      <ResourceName>1000</ResourceName>
    </VSCTCompile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="SQLiteDataObjectSupport2010.xml" />
    <EmbeddedResource Include="SQLiteDataViewSupport2010.xml" />
    <EmbeddedResource Include="VSPackage.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>VSPackage.Designer.cs</LastGenOutput>
      <MergeWithCTO>true</MergeWithCTO>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="ChangePasswordDialog.resx">
      <SubType>Designer</SubType>
      <DependentUpon>ChangePasswordDialog.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Editors\TableDesignerDoc.resx">
      <SubType>Designer</SubType>
      <DependentUpon>TableDesignerDoc.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Editors\ViewDesignerDoc.resx">
      <DependentUpon>ViewDesignerDoc.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="SQLiteConnectionUIControl.resx">
      <SubType>Designer</SubType>
      <DependentUpon>SQLiteConnectionUIControl.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="TableNameDialog.resx">
      <DependentUpon>TableNameDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="ChangeScriptDialog.resx">
      <DependentUpon>ChangeScriptDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\info.png" />
    <None Include="Resources\ToolboxItems.txt" />
    <None Include="source.extension.vsixmanifest" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup Condition="'$(NetFx40)' == 'false'">
    <!--
        NOTE: We cannot build this project unless the version of the .NET
              Framework matches exactly.
    -->
    <BuildDependsOn>
      WrongNetFx
    </BuildDependsOn>
  </PropertyGroup>
  <PropertyGroup Condition="'$(VSSDK100Install)' == '' Or
                            !Exists('$(VSSDK100Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.Data.ConnectionUI.dll') Or
                            !Exists('$(VSSDK100Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.dll') Or
                            !Exists('$(VSSDK100Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.Services.dll') Or
                            !Exists('$(VSSDK100Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.OLE.Interop.dll') Or
                            !Exists('$(VSSDK100Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.dll') Or
                            !Exists('$(VSSDK100Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.dll') Or
                            !Exists('$(VSSDK100Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.8.0.dll')">
    <!--
        NOTE: We cannot build this project without the necessary reference
              assemblies; therefore, skip building it altogether.
    -->
    <BuildDependsOn>
      MissingVsSdk
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added SQLite.Designer/SQLite.Designer.2012.csproj.













































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Designer.2012.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>SQLite.Designer</RootNamespace>
    <AssemblyName>SQLite.Designer</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx45>true</NetFx45>
    <ConfigurationYear>2012</ConfigurationYear>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)SQLite.Designer.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Design" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
    <Reference Include="EnvDTE">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.Data.ConnectionUI">
      <HintPath>$(VSSDK110Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.Data.ConnectionUI.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Data">
      <HintPath>$(VSSDK110Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Data.Services">
      <HintPath>$(VSSDK110Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.Services.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.OLE.Interop">
      <HintPath>$(VSSDK110Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.OLE.Interop.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.11.0">
      <HintPath>$(VSSDK110Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Shell.11.0.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop">
      <HintPath>$(VSSDK110Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0">
      <HintPath>$(VSSDK110Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.8.0.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0">
      <HintPath>$(VSSDK110Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.9.0.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.10.0">
      <HintPath>$(VSSDK110Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.10.0.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="ChangePasswordDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="ChangePasswordDialog.Designer.cs">
      <DependentUpon>ChangePasswordDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="ChangeScriptDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="ChangeScriptDialog.Designer.cs">
      <DependentUpon>ChangeScriptDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="Design\Check.cs" />
    <Compile Include="Design\Column.cs" />
    <Compile Include="Design\ForeignKey.cs" />
    <Compile Include="Design\Index.cs" />
    <Compile Include="Design\PrimaryKey.cs" />
    <Compile Include="Design\SimpleTokenizer.cs" />
    <Compile Include="Design\Table.cs" />
    <Compile Include="Design\Trigger.cs" />
    <Compile Include="Design\Unique.cs" />
    <Compile Include="Design\View.cs" />
    <Compile Include="Editors\AutoCompleteColumn.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="Editors\TableDesignerDoc.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="Editors\TableDesignerDoc.Designer.cs">
      <DependentUpon>TableDesignerDoc.cs</DependentUpon>
    </Compile>
    <Compile Include="Editors\ViewDesignerDoc.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="Editors\ViewDesignerDoc.Designer.cs">
      <DependentUpon>ViewDesignerDoc.cs</DependentUpon>
    </Compile>
    <Compile Include="SQLiteAdapterDesigner.cs" />
    <Compile Include="SQLiteCommandDesigner.cs" />
    <Compile Include="SQLiteCommandHandler.cs" />
    <Compile Include="SQLiteConnectionProperties.cs" />
    <Compile Include="SQLiteConnectionStringEditor.cs" />
    <Compile Include="SQLiteConnectionUIControl.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="SQLiteConnectionUIControl.Designer.cs">
      <DependentUpon>SQLiteConnectionUIControl.cs</DependentUpon>
    </Compile>
    <Compile Include="SQLiteDataAdapterToolboxItem.cs" />
    <Compile Include="SQLiteDataConnectionSupport.cs" />
    <Compile Include="SQLiteDataObjectIdentifierResolver.cs" />
    <Compile Include="SQLiteDataObjectSupport.cs" />
    <Compile Include="SQLiteDataSourceInformation.cs" />
    <Compile Include="SQLiteDataViewSupport.cs" />
    <Compile Include="SQLiteOptions.cs" />
    <Compile Include="SQLitePackage.cs" />
    <Compile Include="SQLiteProviderObjectFactory.cs" />
    <Compile Include="TableNameDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="TableNameDialog.Designer.cs">
      <DependentUpon>TableNameDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="VSPackage.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>VSPackage.resx</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <VSCTCompile Include="PkgCmd.vsct">
      <ResourceName>1000</ResourceName>
    </VSCTCompile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="SQLiteDataObjectSupport2012.xml" />
    <EmbeddedResource Include="SQLiteDataViewSupport2012.xml" />
    <EmbeddedResource Include="VSPackage.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>VSPackage.Designer.cs</LastGenOutput>
      <MergeWithCTO>true</MergeWithCTO>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="ChangePasswordDialog.resx">
      <SubType>Designer</SubType>
      <DependentUpon>ChangePasswordDialog.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Editors\TableDesignerDoc.resx">
      <SubType>Designer</SubType>
      <DependentUpon>TableDesignerDoc.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Editors\ViewDesignerDoc.resx">
      <DependentUpon>ViewDesignerDoc.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="SQLiteConnectionUIControl.resx">
      <SubType>Designer</SubType>
      <DependentUpon>SQLiteConnectionUIControl.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="TableNameDialog.resx">
      <DependentUpon>TableNameDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="ChangeScriptDialog.resx">
      <DependentUpon>ChangeScriptDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\info.png" />
    <None Include="Resources\ToolboxItems.txt" />
    <None Include="source.extension.vsixmanifest" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup Condition="'$(NetFx45)' == 'false'">
    <!--
        NOTE: We cannot build this project unless the version of the .NET
              Framework matches exactly.
    -->
    <BuildDependsOn>
      WrongNetFx
    </BuildDependsOn>
  </PropertyGroup>
  <PropertyGroup Condition="'$(VSSDK110Install)' == '' Or
                            !Exists('$(VSSDK110Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.Data.ConnectionUI.dll') Or
                            !Exists('$(VSSDK110Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.dll') Or
                            !Exists('$(VSSDK110Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.Services.dll') Or
                            !Exists('$(VSSDK110Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.OLE.Interop.dll') Or
                            !Exists('$(VSSDK110Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Shell.11.0.dll') Or
                            !Exists('$(VSSDK110Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.dll') Or
                            !Exists('$(VSSDK110Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.8.0.dll') Or
                            !Exists('$(VSSDK110Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.9.0.dll') Or
                            !Exists('$(VSSDK110Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.10.0.dll')">
    <!--
        NOTE: We cannot build this project without the necessary reference
              assemblies; therefore, skip building it altogether.
    -->
    <BuildDependsOn>
      MissingVsSdk
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added SQLite.Designer/SQLite.Designer.2013.csproj.













































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Designer.2013.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>SQLite.Designer</RootNamespace>
    <AssemblyName>SQLite.Designer</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx451>true</NetFx451>
    <ConfigurationYear>2013</ConfigurationYear>
    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)SQLite.Designer.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Design" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
    <Reference Include="EnvDTE">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.Data.ConnectionUI">
      <HintPath>$(VSSDK120Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.Data.ConnectionUI.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Data">
      <HintPath>$(VSSDK120Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Data.Services">
      <HintPath>$(VSSDK120Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.Services.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.OLE.Interop">
      <HintPath>$(VSSDK120Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.OLE.Interop.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.12.0">
      <HintPath>$(VSSDK120Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Shell.12.0.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop">
      <HintPath>$(VSSDK120Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0">
      <HintPath>$(VSSDK120Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.8.0.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0">
      <HintPath>$(VSSDK120Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.9.0.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.10.0">
      <HintPath>$(VSSDK120Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.10.0.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="ChangePasswordDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="ChangePasswordDialog.Designer.cs">
      <DependentUpon>ChangePasswordDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="ChangeScriptDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="ChangeScriptDialog.Designer.cs">
      <DependentUpon>ChangeScriptDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="Design\Check.cs" />
    <Compile Include="Design\Column.cs" />
    <Compile Include="Design\ForeignKey.cs" />
    <Compile Include="Design\Index.cs" />
    <Compile Include="Design\PrimaryKey.cs" />
    <Compile Include="Design\SimpleTokenizer.cs" />
    <Compile Include="Design\Table.cs" />
    <Compile Include="Design\Trigger.cs" />
    <Compile Include="Design\Unique.cs" />
    <Compile Include="Design\View.cs" />
    <Compile Include="Editors\AutoCompleteColumn.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="Editors\TableDesignerDoc.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="Editors\TableDesignerDoc.Designer.cs">
      <DependentUpon>TableDesignerDoc.cs</DependentUpon>
    </Compile>
    <Compile Include="Editors\ViewDesignerDoc.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="Editors\ViewDesignerDoc.Designer.cs">
      <DependentUpon>ViewDesignerDoc.cs</DependentUpon>
    </Compile>
    <Compile Include="SQLiteAdapterDesigner.cs" />
    <Compile Include="SQLiteCommandDesigner.cs" />
    <Compile Include="SQLiteCommandHandler.cs" />
    <Compile Include="SQLiteConnectionProperties.cs" />
    <Compile Include="SQLiteConnectionStringEditor.cs" />
    <Compile Include="SQLiteConnectionUIControl.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="SQLiteConnectionUIControl.Designer.cs">
      <DependentUpon>SQLiteConnectionUIControl.cs</DependentUpon>
    </Compile>
    <Compile Include="SQLiteDataAdapterToolboxItem.cs" />
    <Compile Include="SQLiteDataConnectionSupport.cs" />
    <Compile Include="SQLiteDataObjectIdentifierResolver.cs" />
    <Compile Include="SQLiteDataObjectSupport.cs" />
    <Compile Include="SQLiteDataSourceInformation.cs" />
    <Compile Include="SQLiteDataViewSupport.cs" />
    <Compile Include="SQLiteOptions.cs" />
    <Compile Include="SQLitePackage.cs" />
    <Compile Include="SQLiteProviderObjectFactory.cs" />
    <Compile Include="TableNameDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="TableNameDialog.Designer.cs">
      <DependentUpon>TableNameDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="VSPackage.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>VSPackage.resx</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <VSCTCompile Include="PkgCmd.vsct">
      <ResourceName>1000</ResourceName>
    </VSCTCompile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="SQLiteDataObjectSupport2013.xml" />
    <EmbeddedResource Include="SQLiteDataViewSupport2013.xml" />
    <EmbeddedResource Include="VSPackage.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>VSPackage.Designer.cs</LastGenOutput>
      <MergeWithCTO>true</MergeWithCTO>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="ChangePasswordDialog.resx">
      <SubType>Designer</SubType>
      <DependentUpon>ChangePasswordDialog.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Editors\TableDesignerDoc.resx">
      <SubType>Designer</SubType>
      <DependentUpon>TableDesignerDoc.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Editors\ViewDesignerDoc.resx">
      <DependentUpon>ViewDesignerDoc.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="SQLiteConnectionUIControl.resx">
      <SubType>Designer</SubType>
      <DependentUpon>SQLiteConnectionUIControl.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="TableNameDialog.resx">
      <DependentUpon>TableNameDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="ChangeScriptDialog.resx">
      <DependentUpon>ChangeScriptDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\info.png" />
    <None Include="Resources\ToolboxItems.txt" />
    <None Include="source.extension.vsixmanifest" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup Condition="'$(NetFx451)' == 'false'">
    <!--
        NOTE: We cannot build this project unless the version of the .NET
              Framework matches exactly.
    -->
    <BuildDependsOn>
      WrongNetFx
    </BuildDependsOn>
  </PropertyGroup>
  <PropertyGroup Condition="'$(VSSDK120Install)' == '' Or
                            !Exists('$(VSSDK120Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.Data.ConnectionUI.dll') Or
                            !Exists('$(VSSDK120Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.dll') Or
                            !Exists('$(VSSDK120Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.Services.dll') Or
                            !Exists('$(VSSDK120Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.OLE.Interop.dll') Or
                            !Exists('$(VSSDK120Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Shell.12.0.dll') Or
                            !Exists('$(VSSDK120Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.dll') Or
                            !Exists('$(VSSDK120Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.8.0.dll') Or
                            !Exists('$(VSSDK120Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.9.0.dll') Or
                            !Exists('$(VSSDK120Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.10.0.dll')">
    <!--
        NOTE: We cannot build this project without the necessary reference
              assemblies; therefore, skip building it altogether.
    -->
    <BuildDependsOn>
      MissingVsSdk
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added SQLite.Designer/SQLite.Designer.2015.csproj.













































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Designer.2015.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>SQLite.Designer</RootNamespace>
    <AssemblyName>SQLite.Designer</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx46>true</NetFx46>
    <ConfigurationYear>2015</ConfigurationYear>
    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)SQLite.Designer.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Design" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
    <Reference Include="EnvDTE">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.Data.ConnectionUI">
      <HintPath>$(VSSDK140Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.Data.ConnectionUI.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Data">
      <HintPath>$(VSSDK140Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Data.Services">
      <HintPath>$(VSSDK140Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.Services.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.OLE.Interop">
      <HintPath>$(VSSDK140Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.OLE.Interop.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.14.0">
      <HintPath>$(VSSDK140Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Shell.14.0.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop">
      <HintPath>$(VSSDK140Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0">
      <HintPath>$(VSSDK140Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.8.0.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0">
      <HintPath>$(VSSDK140Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.9.0.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.10.0">
      <HintPath>$(VSSDK140Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.10.0.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="ChangePasswordDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="ChangePasswordDialog.Designer.cs">
      <DependentUpon>ChangePasswordDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="ChangeScriptDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="ChangeScriptDialog.Designer.cs">
      <DependentUpon>ChangeScriptDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="Design\Check.cs" />
    <Compile Include="Design\Column.cs" />
    <Compile Include="Design\ForeignKey.cs" />
    <Compile Include="Design\Index.cs" />
    <Compile Include="Design\PrimaryKey.cs" />
    <Compile Include="Design\SimpleTokenizer.cs" />
    <Compile Include="Design\Table.cs" />
    <Compile Include="Design\Trigger.cs" />
    <Compile Include="Design\Unique.cs" />
    <Compile Include="Design\View.cs" />
    <Compile Include="Editors\AutoCompleteColumn.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="Editors\TableDesignerDoc.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="Editors\TableDesignerDoc.Designer.cs">
      <DependentUpon>TableDesignerDoc.cs</DependentUpon>
    </Compile>
    <Compile Include="Editors\ViewDesignerDoc.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="Editors\ViewDesignerDoc.Designer.cs">
      <DependentUpon>ViewDesignerDoc.cs</DependentUpon>
    </Compile>
    <Compile Include="SQLiteAdapterDesigner.cs" />
    <Compile Include="SQLiteCommandDesigner.cs" />
    <Compile Include="SQLiteCommandHandler.cs" />
    <Compile Include="SQLiteConnectionProperties.cs" />
    <Compile Include="SQLiteConnectionStringEditor.cs" />
    <Compile Include="SQLiteConnectionUIControl.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="SQLiteConnectionUIControl.Designer.cs">
      <DependentUpon>SQLiteConnectionUIControl.cs</DependentUpon>
    </Compile>
    <Compile Include="SQLiteDataAdapterToolboxItem.cs" />
    <Compile Include="SQLiteDataConnectionSupport.cs" />
    <Compile Include="SQLiteDataObjectIdentifierResolver.cs" />
    <Compile Include="SQLiteDataObjectSupport.cs" />
    <Compile Include="SQLiteDataSourceInformation.cs" />
    <Compile Include="SQLiteDataViewSupport.cs" />
    <Compile Include="SQLiteOptions.cs" />
    <Compile Include="SQLitePackage.cs" />
    <Compile Include="SQLiteProviderObjectFactory.cs" />
    <Compile Include="TableNameDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="TableNameDialog.Designer.cs">
      <DependentUpon>TableNameDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="VSPackage.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>VSPackage.resx</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <VSCTCompile Include="PkgCmd.vsct">
      <ResourceName>1000</ResourceName>
    </VSCTCompile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="SQLiteDataObjectSupport2015.xml" />
    <EmbeddedResource Include="SQLiteDataViewSupport2015.xml" />
    <EmbeddedResource Include="VSPackage.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>VSPackage.Designer.cs</LastGenOutput>
      <MergeWithCTO>true</MergeWithCTO>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="ChangePasswordDialog.resx">
      <SubType>Designer</SubType>
      <DependentUpon>ChangePasswordDialog.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Editors\TableDesignerDoc.resx">
      <SubType>Designer</SubType>
      <DependentUpon>TableDesignerDoc.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Editors\ViewDesignerDoc.resx">
      <DependentUpon>ViewDesignerDoc.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="SQLiteConnectionUIControl.resx">
      <SubType>Designer</SubType>
      <DependentUpon>SQLiteConnectionUIControl.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="TableNameDialog.resx">
      <DependentUpon>TableNameDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="ChangeScriptDialog.resx">
      <DependentUpon>ChangeScriptDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\info.png" />
    <None Include="Resources\ToolboxItems.txt" />
    <None Include="source.extension.vsixmanifest" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup Condition="'$(NetFx46)' == 'false'">
    <!--
        NOTE: We cannot build this project unless the version of the .NET
              Framework matches exactly.
    -->
    <BuildDependsOn>
      WrongNetFx
    </BuildDependsOn>
  </PropertyGroup>
  <PropertyGroup Condition="'$(VSSDK140Install)' == '' Or
                            !Exists('$(VSSDK140Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.Data.ConnectionUI.dll') Or
                            !Exists('$(VSSDK140Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.dll') Or
                            !Exists('$(VSSDK140Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.Services.dll') Or
                            !Exists('$(VSSDK140Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.OLE.Interop.dll') Or
                            !Exists('$(VSSDK140Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Shell.14.0.dll') Or
                            !Exists('$(VSSDK140Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.dll') Or
                            !Exists('$(VSSDK140Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.8.0.dll') Or
                            !Exists('$(VSSDK140Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.9.0.dll') Or
                            !Exists('$(VSSDK140Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.10.0.dll')">
    <!--
        NOTE: We cannot build this project without the necessary reference
              assemblies; therefore, skip building it altogether.
    -->
    <BuildDependsOn>
      MissingVsSdk
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added SQLite.Designer/SQLite.Designer.2017.csproj.

















































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Designer.2017.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project InitialTargets="MaybeFindVsSdk2017;MaybeMissingVsSdk2017" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>SQLite.Designer</RootNamespace>
    <AssemblyName>SQLite.Designer</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx47>true</NetFx47>
    <ConfigurationYear>2017</ConfigurationYear>
    <TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)SQLite.Designer.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Design" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
    <Reference Include="EnvDTE">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.Data.ConnectionUI">
      <HintPath>$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.Data.ConnectionUI.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Data">
      <HintPath>$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Data.Services">
      <HintPath>$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.Services.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.OLE.Interop">
      <HintPath>$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.OLE.Interop.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.15.0">
      <HintPath>$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Shell.15.0.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop">
      <HintPath>$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0">
      <HintPath>$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.8.0.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0">
      <HintPath>$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.9.0.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.10.0">
      <HintPath>$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.10.0.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.15.3.DesignTime">
      <HintPath>$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Shell.Interop.15.3.DesignTime.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="ChangePasswordDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="ChangePasswordDialog.Designer.cs">
      <DependentUpon>ChangePasswordDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="ChangeScriptDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="ChangeScriptDialog.Designer.cs">
      <DependentUpon>ChangeScriptDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="Design\Check.cs" />
    <Compile Include="Design\Column.cs" />
    <Compile Include="Design\ForeignKey.cs" />
    <Compile Include="Design\Index.cs" />
    <Compile Include="Design\PrimaryKey.cs" />
    <Compile Include="Design\SimpleTokenizer.cs" />
    <Compile Include="Design\Table.cs" />
    <Compile Include="Design\Trigger.cs" />
    <Compile Include="Design\Unique.cs" />
    <Compile Include="Design\View.cs" />
    <Compile Include="Editors\AutoCompleteColumn.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="Editors\TableDesignerDoc.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="Editors\TableDesignerDoc.Designer.cs">
      <DependentUpon>TableDesignerDoc.cs</DependentUpon>
    </Compile>
    <Compile Include="Editors\ViewDesignerDoc.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="Editors\ViewDesignerDoc.Designer.cs">
      <DependentUpon>ViewDesignerDoc.cs</DependentUpon>
    </Compile>
    <Compile Include="SQLiteAdapterDesigner.cs" />
    <Compile Include="SQLiteCommandDesigner.cs" />
    <Compile Include="SQLiteCommandHandler.cs" />
    <Compile Include="SQLiteConnectionProperties.cs" />
    <Compile Include="SQLiteConnectionStringEditor.cs" />
    <Compile Include="SQLiteConnectionUIControl.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="SQLiteConnectionUIControl.Designer.cs">
      <DependentUpon>SQLiteConnectionUIControl.cs</DependentUpon>
    </Compile>
    <Compile Include="SQLiteDataAdapterToolboxItem.cs" />
    <Compile Include="SQLiteDataConnectionSupport.cs" />
    <Compile Include="SQLiteDataObjectIdentifierResolver.cs" />
    <Compile Include="SQLiteDataObjectSupport.cs" />
    <Compile Include="SQLiteDataSourceInformation.cs" />
    <Compile Include="SQLiteDataViewSupport.cs" />
    <Compile Include="SQLiteOptions.cs" />
    <Compile Include="SQLitePackage.cs" />
    <Compile Include="SQLiteProviderObjectFactory.cs" />
    <Compile Include="TableNameDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="TableNameDialog.Designer.cs">
      <DependentUpon>TableNameDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="VSPackage.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>VSPackage.resx</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <VSCTCompile Include="PkgCmd.vsct">
      <ResourceName>1000</ResourceName>
    </VSCTCompile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="SQLiteDataObjectSupport2017.xml" />
    <EmbeddedResource Include="SQLiteDataViewSupport2017.xml" />
    <EmbeddedResource Include="VSPackage.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>VSPackage.Designer.cs</LastGenOutput>
      <MergeWithCTO>true</MergeWithCTO>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="ChangePasswordDialog.resx">
      <SubType>Designer</SubType>
      <DependentUpon>ChangePasswordDialog.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Editors\TableDesignerDoc.resx">
      <SubType>Designer</SubType>
      <DependentUpon>TableDesignerDoc.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Editors\ViewDesignerDoc.resx">
      <DependentUpon>ViewDesignerDoc.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="SQLiteConnectionUIControl.resx">
      <SubType>Designer</SubType>
      <DependentUpon>SQLiteConnectionUIControl.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="TableNameDialog.resx">
      <DependentUpon>TableNameDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="ChangeScriptDialog.resx">
      <DependentUpon>ChangeScriptDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\info.png" />
    <None Include="Resources\ToolboxItems.txt" />
    <None Include="source.extension.vsixmanifest" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup Condition="'$(NetFx47)' == 'false'">
    <!--
        NOTE: We cannot build this project unless the version of the .NET
              Framework matches exactly.
    -->
    <BuildDependsOn>
      WrongNetFx
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Deleted SQLite.Designer/SQLite.Designer.csproj.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>SQLite.Designer</RootNamespace>
    <AssemblyName>SQLite.Designer</AssemblyName>
    <SignAssembly>false</SignAssembly>
    <RegisterOutputPackage>false</RegisterOutputPackage>
    <RegisterWithCodebase>false</RegisterWithCodebase>
    <GeneratePkgDefFile>false</GeneratePkgDefFile>
    <FileUpgradeFlags>
    </FileUpgradeFlags>
    <OldToolsVersion>2.0</OldToolsVersion>
    <UpgradeBackupLocation>
    </UpgradeBackupLocation>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>..\bin\designer\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <NoWarn>1701;1702;1699;3001</NoWarn>
    <FileAlignment>512</FileAlignment>
    <PlatformTarget>x86</PlatformTarget>
    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
    <RegisterOutputPackage>false</RegisterOutputPackage>
    <GeneratePkgDefFile>false</GeneratePkgDefFile>
    <RegisterWithCodebase>false</RegisterWithCodebase>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>none</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>..\bin\Designer\</OutputPath>
    <DefineConstants>
    </DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <NoWarn>1701;1702;1699;3001</NoWarn>
    <FileAlignment>512</FileAlignment>
    <PlatformTarget>x86</PlatformTarget>
    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
    <RegisterOutputPackage>false</RegisterOutputPackage>
    <RegisterWithCodebase>false</RegisterWithCodebase>
    <GeneratePkgDefFile>false</GeneratePkgDefFile>
    <UseVSHostingProcess>false</UseVSHostingProcess>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PublicAssemblies\EnvDTE.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Data.ConnectionUI, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\Microsoft.Data.ConnectionUI.dll</HintPath>
      <Private>False</Private>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.CommandBars, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\..\Program Files (x86)\Common Files\Microsoft Shared\MSEnv\PublicAssemblies\Microsoft.VisualStudio.CommandBars.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Data, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <HintPath>..\..\Microsoft.VisualStudio.Data.dll</HintPath>
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
      <SpecificVersion>False</SpecificVersion>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Design" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="ChangePasswordDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="ChangePasswordDialog.Designer.cs">
      <DependentUpon>ChangePasswordDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="ChangeScriptDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="ChangeScriptDialog.Designer.cs">
      <DependentUpon>ChangeScriptDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="Design\Check.cs" />
    <Compile Include="Design\Column.cs" />
    <Compile Include="Design\ForeignKey.cs" />
    <Compile Include="Design\Index.cs" />
    <Compile Include="Design\PrimaryKey.cs" />
    <Compile Include="Design\SimpleTokenizer.cs" />
    <Compile Include="Design\Table.cs" />
    <Compile Include="Design\Trigger.cs" />
    <Compile Include="Design\Unique.cs" />
    <Compile Include="Design\View.cs" />
    <Compile Include="Editors\AutoCompleteColumn.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="Editors\TableDesignerDoc.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="Editors\TableDesignerDoc.Designer.cs">
      <DependentUpon>TableDesignerDoc.cs</DependentUpon>
    </Compile>
    <Compile Include="Editors\ViewDesignerDoc.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="Editors\ViewDesignerDoc.Designer.cs">
      <DependentUpon>ViewDesignerDoc.cs</DependentUpon>
    </Compile>
    <Compile Include="SQLiteAdapterDesigner.cs">
    </Compile>
    <Compile Include="SQLiteCommandDesigner.cs">
    </Compile>
    <Compile Include="SQLiteCommandHandler.cs" />
    <Compile Include="SQLiteConnectionProperties.cs" />
    <Compile Include="SQLiteConnectionStringEditor.cs" />
    <Compile Include="SQLiteConnectionUIControl.cs">
      <SubType>UserControl</SubType>
    </Compile>
    <Compile Include="SQLiteConnectionUIControl.Designer.cs">
      <DependentUpon>SQLiteConnectionUIControl.cs</DependentUpon>
    </Compile>
    <Compile Include="SQLiteDataAdapterToolboxItem.cs" />
    <Compile Include="SQLiteDataConnectionSupport.cs" />
    <Compile Include="SQLiteDataObjectIdentifierResolver.cs" />
    <Compile Include="SQLiteDataObjectSupport.cs" />
    <Compile Include="SQLiteDataSourceInformation.cs" />
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="SQLiteDataViewSupport.cs" />
    <Compile Include="SQLitePackage.cs" />
    <Compile Include="SQLiteProviderObjectFactory.cs" />
    <Compile Include="TableNameDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="TableNameDialog.Designer.cs">
      <DependentUpon>TableNameDialog.cs</DependentUpon>
    </Compile>
    <Compile Include="VSPackage.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>VSPackage.resx</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <VSCTCompile Include="PkgCmd.vsct">
      <ResourceName>1000</ResourceName>
    </VSCTCompile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="SQLiteDataViewSupport2008.xml" />
    <EmbeddedResource Include="VSPackage.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>VSPackage.Designer.cs</LastGenOutput>
      <MergeWithCTO>true</MergeWithCTO>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="ChangePasswordDialog.resx">
      <SubType>Designer</SubType>
      <DependentUpon>ChangePasswordDialog.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Editors\TableDesignerDoc.resx">
      <SubType>Designer</SubType>
      <DependentUpon>TableDesignerDoc.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Editors\ViewDesignerDoc.resx">
      <DependentUpon>ViewDesignerDoc.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="SQLiteConnectionUIControl.resx">
      <SubType>Designer</SubType>
      <DependentUpon>SQLiteConnectionUIControl.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="SQLiteDataObjectSupport.xml" />
    <EmbeddedResource Include="TableNameDialog.resx">
      <DependentUpon>TableNameDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="ChangeScriptDialog.resx">
      <DependentUpon>ChangeScriptDialog.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="SQLiteDataViewSupport2005.xml" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\info.png" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\ToolboxItems.txt" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Properties\" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\VSSDK\Microsoft.VsSDK.targets" />
  <PropertyGroup>
    <PostBuildEvent>
    </PostBuildEvent>
  </PropertyGroup>
</Project>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































































































































































Deleted SQLite.Designer/SQLite.Designer.sln.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Designer", "SQLite.Designer.csproj", "{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "install", "..\tools\install\install.csproj", "{71EED886-B5BF-488E-A4AA-1403E393D224}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139962-261A-4463-B6FA-AEBC25283A66} = {AC139962-261A-4463-B6FA-AEBC25283A66}
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198} = {9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite - CFDT", "..\System.Data.SQLite\System.Data.SQLite - CFDT.csproj", "{AC139962-261A-4463-B6FA-AEBC25283A66}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.Build.0 = Release|Any CPU
		{71EED886-B5BF-488E-A4AA-1403E393D224}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{71EED886-B5BF-488E-A4AA-1403E393D224}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{71EED886-B5BF-488E-A4AA-1403E393D224}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{71EED886-B5BF-488E-A4AA-1403E393D224}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139962-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139962-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139962-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139962-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































Changes to SQLite.Designer/SQLiteCommandHandler.cs.

241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
        TableDesignerDoc form = new TableDesignerDoc(itemId, DataViewHierarchyAccessor, tableName);
        IntPtr formptr = System.Runtime.InteropServices.Marshal.GetIUnknownForObject(form);
        Guid empty = Guid.Empty;
        FakeHierarchy fake = new FakeHierarchy(form, hier);

        int code = shell.CreateDocumentWindow(
          0, // (uint)(__VSCREATEDOCWIN.CDW_fCreateNewWindow | __VSCREATEDOCWIN.CDW_RDTFLAGS_MASK) | (uint)(_VSRDTFLAGS.RDT_CanBuildFromMemory | _VSRDTFLAGS.RDT_NonCreatable | _VSRDTFLAGS.RDT_VirtualDocument | _VSRDTFLAGS.RDT_DontAddToMRU),
          form.Name, fake, (uint)itemId, formptr, formptr, ref empty, null, ref guidTableDesignContext, provider, "", form.Caption, null, out frame);

        if (frame != null)
        {
          object ret;
          int prop = (int)__VSFPROPID.VSFPROPID_Caption;
          
          code = frame.GetProperty(prop, out ret);







|







241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
        TableDesignerDoc form = new TableDesignerDoc(itemId, DataViewHierarchyAccessor, tableName);
        IntPtr formptr = System.Runtime.InteropServices.Marshal.GetIUnknownForObject(form);
        Guid empty = Guid.Empty;
        FakeHierarchy fake = new FakeHierarchy(form, hier);

        int code = shell.CreateDocumentWindow(
          0, // (uint)(__VSCREATEDOCWIN.CDW_fCreateNewWindow | __VSCREATEDOCWIN.CDW_RDTFLAGS_MASK) | (uint)(_VSRDTFLAGS.RDT_CanBuildFromMemory | _VSRDTFLAGS.RDT_NonCreatable | _VSRDTFLAGS.RDT_VirtualDocument | _VSRDTFLAGS.RDT_DontAddToMRU),
          form.Name, fake, (uint)itemId, formptr, formptr, ref empty, null, ref guidTableDesignContext, provider, String.Empty, form.Caption, null, out frame);

        if (frame != null)
        {
          object ret;
          int prop = (int)__VSFPROPID.VSFPROPID_Caption;
          
          code = frame.GetProperty(prop, out ret);
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
        ViewDesignerDoc form = new ViewDesignerDoc(itemId, DataViewHierarchyAccessor, viewName);
        IntPtr formptr = System.Runtime.InteropServices.Marshal.GetIUnknownForObject(form);
        Guid empty = Guid.Empty;
        FakeHierarchy fake = new FakeHierarchy(form, hier);

        int code = shell.CreateDocumentWindow(
          0, // (uint)(__VSCREATEDOCWIN.CDW_fCreateNewWindow | __VSCREATEDOCWIN.CDW_RDTFLAGS_MASK) | (uint)(_VSRDTFLAGS.RDT_CanBuildFromMemory | _VSRDTFLAGS.RDT_NonCreatable | _VSRDTFLAGS.RDT_VirtualDocument | _VSRDTFLAGS.RDT_DontAddToMRU),
          form.Name, fake, (uint)itemId, formptr, formptr, ref empty, null, ref guidViewDesignContext, provider, "", form.Caption, null, out frame);

        if (frame != null)
        {
          object ret;
          int prop = (int)__VSFPROPID.VSFPROPID_Caption;

          code = frame.GetProperty(prop, out ret);







|







271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
        ViewDesignerDoc form = new ViewDesignerDoc(itemId, DataViewHierarchyAccessor, viewName);
        IntPtr formptr = System.Runtime.InteropServices.Marshal.GetIUnknownForObject(form);
        Guid empty = Guid.Empty;
        FakeHierarchy fake = new FakeHierarchy(form, hier);

        int code = shell.CreateDocumentWindow(
          0, // (uint)(__VSCREATEDOCWIN.CDW_fCreateNewWindow | __VSCREATEDOCWIN.CDW_RDTFLAGS_MASK) | (uint)(_VSRDTFLAGS.RDT_CanBuildFromMemory | _VSRDTFLAGS.RDT_NonCreatable | _VSRDTFLAGS.RDT_VirtualDocument | _VSRDTFLAGS.RDT_DontAddToMRU),
          form.Name, fake, (uint)itemId, formptr, formptr, ref empty, null, ref guidViewDesignContext, provider, String.Empty, form.Caption, null, out frame);

        if (frame != null)
        {
          object ret;
          int prop = (int)__VSFPROPID.VSFPROPID_Caption;

          code = frame.GetProperty(prop, out ret);

Changes to SQLite.Designer/SQLiteConnectionProperties.cs.

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
  {
    public SQLiteConnectionProperties()
      : this(null)
    {
    }

    public SQLiteConnectionProperties(string connectionString)
      : base("System.Data.SQLite", connectionString)
    {
    }

    public override string[] GetBasicProperties()
    {
      return new string[] { "data source" };
    }

    protected override bool ShouldPersistProperty(string propertyName)
    {
      if (String.Compare(propertyName, "Database", StringComparison.OrdinalIgnoreCase) == 0) return false;

      return base.ShouldPersistProperty(propertyName);
    }

    public override bool Contains(string propertyName)
    {
      if (String.Compare(propertyName, "Database", StringComparison.OrdinalIgnoreCase) == 0)
        return (base.Contains("data source") || base.Contains("uri"));

      return base.Contains(propertyName);
    }

    public override object this[string propertyName]
    {
      get







|


















|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
  {
    public SQLiteConnectionProperties()
      : this(null)
    {
    }

    public SQLiteConnectionProperties(string connectionString)
      : base(SQLiteOptions.GetProviderName(), connectionString)
    {
    }

    public override string[] GetBasicProperties()
    {
      return new string[] { "data source" };
    }

    protected override bool ShouldPersistProperty(string propertyName)
    {
      if (String.Compare(propertyName, "Database", StringComparison.OrdinalIgnoreCase) == 0) return false;

      return base.ShouldPersistProperty(propertyName);
    }

    public override bool Contains(string propertyName)
    {
      if (String.Compare(propertyName, "Database", StringComparison.OrdinalIgnoreCase) == 0)
        return (base.Contains("data source") || base.Contains("uri") || base.Contains("fulluri"));

      return base.Contains(propertyName);
    }

    public override object this[string propertyName]
    {
      get
64
65
66
67
68
69
70


71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86





87
88
89
90
91
92
93

    internal string GetDatabaseFile()
    {
      if (this["data source"] is string && ((string)this["data source"]).Length > 0)
        return (string)this["data source"];
      else if (this["uri"] is string)
        return MapUriPath((string)this["uri"]);


      return String.Empty;
    }

    public override bool  IsComplete
    {
      get 
      {
        if (Contains("data source") == true)
        {
          if (this["data source"] is string && ((string)this["data source"]).Length > 0)
            return true;
        }
        else if (Contains("uri") == true)
        {
          if (this["uri"] is string && MapUriPath((string)this["uri"]).Length > 0)
            return true;





        }

        return false;
      }
    }

    internal static string MapUriPath(string path)







>
>
















>
>
>
>
>







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100

    internal string GetDatabaseFile()
    {
      if (this["data source"] is string && ((string)this["data source"]).Length > 0)
        return (string)this["data source"];
      else if (this["uri"] is string)
        return MapUriPath((string)this["uri"]);
      else if (this["fulluri"] is string)
        return (string)this["fulluri"];
      return String.Empty;
    }

    public override bool  IsComplete
    {
      get 
      {
        if (Contains("data source") == true)
        {
          if (this["data source"] is string && ((string)this["data source"]).Length > 0)
            return true;
        }
        else if (Contains("uri") == true)
        {
          if (this["uri"] is string && MapUriPath((string)this["uri"]).Length > 0)
            return true;
        }
        else if (Contains("fulluri") == true)
        {
          if (this["fulluri"] is string && ((string)this["fulluri"]).Length > 0)
            return true;
        }

        return false;
      }
    }

    internal static string MapUriPath(string path)

Changes to SQLite.Designer/SQLiteConnectionStringEditor.cs.

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
        if (connectionString == null && newConnection != null)
        {
          if (_managerType != null)
          {
            object manager = Activator.CreateInstance(_managerType, new object[] { provider });
            if (manager != null)
            {
              index = (int)_managerType.InvokeMember("AddNewConnection", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { "System.Data.SQLite" });
              if (index > -1 && _selector != null)
              {
                connectionString = (string)_managerType.InvokeMember("GetConnectionString", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { index });
                _selector.SelectedNode = _selector.AddNode((string)_managerType.InvokeMember("GetConnectionName", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { index }), connectionString, null);
              }
            }
          }







|







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
        if (connectionString == null && newConnection != null)
        {
          if (_managerType != null)
          {
            object manager = Activator.CreateInstance(_managerType, new object[] { provider });
            if (manager != null)
            {
              index = (int)_managerType.InvokeMember("AddNewConnection", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { SQLiteOptions.GetProviderName() });
              if (index > -1 && _selector != null)
              {
                connectionString = (string)_managerType.InvokeMember("GetConnectionString", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { index });
                _selector.SelectedNode = _selector.AddNode((string)_managerType.InvokeMember("GetConnectionName", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { index }), connectionString, null);
              }
            }
          }
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
        string connectionName;

        for (int n = 0; n < items; n++)
        {
          connectionString = (string)_managerType.InvokeMember("GetConnectionString", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { n });
          connectionName = (string)_managerType.InvokeMember("GetConnectionName", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { n });
          dataProvider = (string)_managerType.InvokeMember("GetProvider", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { n });
          if (String.Compare(dataProvider, "System.Data.SQLite", StringComparison.OrdinalIgnoreCase) == 0)
          {
            node = selector.AddNode(connectionName, connectionString, null);
            
            if (String.Compare(connectionString, connection.ConnectionString, StringComparison.OrdinalIgnoreCase) == 0)
              selector.SelectedNode = node;
          }
        }
        selector.AddNode("<New Connection...>", this, null);
      }
    }
  }
}







|












100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
        string connectionName;

        for (int n = 0; n < items; n++)
        {
          connectionString = (string)_managerType.InvokeMember("GetConnectionString", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { n });
          connectionName = (string)_managerType.InvokeMember("GetConnectionName", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { n });
          dataProvider = (string)_managerType.InvokeMember("GetProvider", BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.Public, null, manager, new object[] { n });
          if (String.Compare(dataProvider, SQLiteOptions.GetProviderName(), StringComparison.OrdinalIgnoreCase) == 0)
          {
            node = selector.AddNode(connectionName, connectionString, null);
            
            if (String.Compare(connectionString, connection.ConnectionString, StringComparison.OrdinalIgnoreCase) == 0)
              selector.SelectedNode = node;
          }
        }
        selector.AddNode("<New Connection...>", this, null);
      }
    }
  }
}

Changes to SQLite.Designer/SQLiteConnectionUIControl.Designer.cs.








1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60

61
62
63
64
65

66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308




















309
310
311

312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331

332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349

350
351







namespace SQLite.Designer
{
  partial class SQLiteConnectionUIControl
  {
    /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    protected override void Dispose(bool disposing)
    {
      if (disposing && (components != null))
      {
        components.Dispose();
      }
      base.Dispose(disposing);
    }

    #region Windows Form Designer generated code

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
      System.Windows.Forms.Label labelPassword;
      System.Windows.Forms.GroupBox securityGroup;
      System.Windows.Forms.GroupBox encodingGroup;
      System.Windows.Forms.GroupBox dateTimeGroup;
      System.Windows.Forms.GroupBox databaseGroup;
      System.Windows.Forms.Label cacheSizeLabel;
      System.Windows.Forms.Label pageSizeLabel;
      System.Windows.Forms.GroupBox syncGroup;

      this.passwordTextBox = new System.Windows.Forms.TextBox();
      this.utf16RadioButton = new System.Windows.Forms.RadioButton();
      this.utf8RadioButton = new System.Windows.Forms.RadioButton();
      this.ticksRadioButton = new System.Windows.Forms.RadioButton();
      this.iso8601RadioButton = new System.Windows.Forms.RadioButton();
      this.cacheSizeTextbox = new System.Windows.Forms.TextBox();
      this.pageSizeTextBox = new System.Windows.Forms.TextBox();
      this.fileTextBox = new System.Windows.Forms.TextBox();
      this.browseButton = new System.Windows.Forms.Button();
      this.newDatabase = new System.Windows.Forms.Button();
      this.offRadioButton = new System.Windows.Forms.RadioButton();
      this.normalRadioButton = new System.Windows.Forms.RadioButton();
      this.fullRadioButton = new System.Windows.Forms.RadioButton();
      this.julianRadioButton = new System.Windows.Forms.RadioButton();

      labelPassword = new System.Windows.Forms.Label();
      securityGroup = new System.Windows.Forms.GroupBox();
      encodingGroup = new System.Windows.Forms.GroupBox();
      dateTimeGroup = new System.Windows.Forms.GroupBox();
      databaseGroup = new System.Windows.Forms.GroupBox();
      cacheSizeLabel = new System.Windows.Forms.Label();
      pageSizeLabel = new System.Windows.Forms.Label();
      syncGroup = new System.Windows.Forms.GroupBox();

      securityGroup.SuspendLayout();
      encodingGroup.SuspendLayout();
      dateTimeGroup.SuspendLayout();
      databaseGroup.SuspendLayout();
      syncGroup.SuspendLayout();

      this.SuspendLayout();
      // 
      // labelPassword
      // 
      labelPassword.AutoSize = true;
      labelPassword.Location = new System.Drawing.Point(6, 23);
      labelPassword.Name = "labelPassword";
      labelPassword.Size = new System.Drawing.Size(53, 13);
      labelPassword.TabIndex = 0;
      labelPassword.Text = "Password";
      // 
      // securityGroup
      // 
      securityGroup.Controls.Add(this.passwordTextBox);
      securityGroup.Controls.Add(labelPassword);
      securityGroup.Location = new System.Drawing.Point(3, 263);
      securityGroup.Name = "securityGroup";
      securityGroup.Size = new System.Drawing.Size(306, 56);
      securityGroup.TabIndex = 10;
      securityGroup.TabStop = false;
      securityGroup.Text = "Encryption";
      // 
      // passwordTextBox
      // 
      this.passwordTextBox.Location = new System.Drawing.Point(65, 20);
      this.passwordTextBox.Name = "passwordTextBox";
      this.passwordTextBox.Size = new System.Drawing.Size(235, 21);
      this.passwordTextBox.TabIndex = 1;
      this.passwordTextBox.UseSystemPasswordChar = true;
      this.passwordTextBox.Leave += new System.EventHandler(this.passwordTextBox_Leave);
      // 
      // encodingGroup
      // 
      encodingGroup.Controls.Add(this.utf16RadioButton);
      encodingGroup.Controls.Add(this.utf8RadioButton);
      encodingGroup.Location = new System.Drawing.Point(3, 159);
      encodingGroup.Name = "encodingGroup";
      encodingGroup.Size = new System.Drawing.Size(75, 98);
      encodingGroup.TabIndex = 7;
      encodingGroup.TabStop = false;
      encodingGroup.Text = "Encoding";
      // 
      // utf16RadioButton
      // 
      this.utf16RadioButton.AutoSize = true;
      this.utf16RadioButton.Location = new System.Drawing.Point(6, 44);
      this.utf16RadioButton.Name = "utf16RadioButton";
      this.utf16RadioButton.Size = new System.Drawing.Size(60, 17);
      this.utf16RadioButton.TabIndex = 1;
      this.utf16RadioButton.TabStop = true;
      this.utf16RadioButton.Text = "UTF-16";
      this.utf16RadioButton.UseVisualStyleBackColor = true;
      this.utf16RadioButton.CheckedChanged += new System.EventHandler(this.encoding_Changed);
      // 
      // utf8RadioButton
      // 
      this.utf8RadioButton.AutoSize = true;
      this.utf8RadioButton.Checked = true;
      this.utf8RadioButton.Location = new System.Drawing.Point(7, 21);
      this.utf8RadioButton.Name = "utf8RadioButton";
      this.utf8RadioButton.Size = new System.Drawing.Size(54, 17);
      this.utf8RadioButton.TabIndex = 0;
      this.utf8RadioButton.TabStop = true;
      this.utf8RadioButton.Text = "UTF-8";
      this.utf8RadioButton.UseVisualStyleBackColor = true;
      this.utf8RadioButton.CheckedChanged += new System.EventHandler(this.encoding_Changed);
      // 
      // dateTimeGroup
      // 
      dateTimeGroup.Controls.Add(this.julianRadioButton);
      dateTimeGroup.Controls.Add(this.ticksRadioButton);
      dateTimeGroup.Controls.Add(this.iso8601RadioButton);
      dateTimeGroup.Location = new System.Drawing.Point(84, 159);
      dateTimeGroup.Name = "dateTimeGroup";
      dateTimeGroup.Size = new System.Drawing.Size(113, 98);
      dateTimeGroup.TabIndex = 8;
      dateTimeGroup.TabStop = false;
      dateTimeGroup.Text = "Date/Time Format";
      // 
      // ticksRadioButton
      // 
      this.ticksRadioButton.AutoSize = true;
      this.ticksRadioButton.Location = new System.Drawing.Point(7, 66);
      this.ticksRadioButton.Name = "ticksRadioButton";
      this.ticksRadioButton.Size = new System.Drawing.Size(48, 17);
      this.ticksRadioButton.TabIndex = 1;
      this.ticksRadioButton.TabStop = true;
      this.ticksRadioButton.Text = "Ticks";
      this.ticksRadioButton.UseVisualStyleBackColor = true;
      this.ticksRadioButton.CheckedChanged += new System.EventHandler(this.datetime_Changed);
      // 
      // iso8601RadioButton
      // 
      this.iso8601RadioButton.AutoSize = true;
      this.iso8601RadioButton.Checked = true;
      this.iso8601RadioButton.Location = new System.Drawing.Point(7, 21);
      this.iso8601RadioButton.Name = "iso8601RadioButton";
      this.iso8601RadioButton.Size = new System.Drawing.Size(71, 17);
      this.iso8601RadioButton.TabIndex = 0;
      this.iso8601RadioButton.TabStop = true;
      this.iso8601RadioButton.Text = "ISO-8601";
      this.iso8601RadioButton.UseVisualStyleBackColor = true;
      this.iso8601RadioButton.CheckedChanged += new System.EventHandler(this.datetime_Changed);
      // 
      // databaseGroup
      // 
      databaseGroup.Controls.Add(cacheSizeLabel);
      databaseGroup.Controls.Add(this.cacheSizeTextbox);
      databaseGroup.Controls.Add(pageSizeLabel);
      databaseGroup.Controls.Add(this.pageSizeTextBox);
      databaseGroup.Controls.Add(this.fileTextBox);
      databaseGroup.Controls.Add(this.browseButton);
      databaseGroup.Controls.Add(this.newDatabase);
      databaseGroup.Location = new System.Drawing.Point(3, 3);
      databaseGroup.Name = "databaseGroup";
      databaseGroup.Size = new System.Drawing.Size(306, 150);
      databaseGroup.TabIndex = 8;
      databaseGroup.TabStop = false;
      databaseGroup.Text = "Database";
      // 
      // cacheSizeLabel
      // 
      cacheSizeLabel.AutoSize = true;
      cacheSizeLabel.Location = new System.Drawing.Point(7, 116);
      cacheSizeLabel.Name = "cacheSizeLabel";
      cacheSizeLabel.Size = new System.Drawing.Size(59, 13);
      cacheSizeLabel.TabIndex = 5;
      cacheSizeLabel.Text = "Cache Size";
      // 
      // cacheSizeTextbox
      // 
      this.cacheSizeTextbox.Location = new System.Drawing.Point(72, 113);
      this.cacheSizeTextbox.Name = "cacheSizeTextbox";
      this.cacheSizeTextbox.Size = new System.Drawing.Size(100, 21);
      this.cacheSizeTextbox.TabIndex = 6;
      this.cacheSizeTextbox.Text = "2000";
      this.cacheSizeTextbox.Leave += new System.EventHandler(this.cacheSizeTextbox_Leave);
      // 
      // pageSizeLabel
      // 
      pageSizeLabel.AutoSize = true;
      pageSizeLabel.Location = new System.Drawing.Point(13, 89);
      pageSizeLabel.Name = "pageSizeLabel";
      pageSizeLabel.Size = new System.Drawing.Size(53, 13);
      pageSizeLabel.TabIndex = 3;
      pageSizeLabel.Text = "Page Size";
      // 
      // pageSizeTextBox
      // 
      this.pageSizeTextBox.Location = new System.Drawing.Point(72, 86);
      this.pageSizeTextBox.Name = "pageSizeTextBox";
      this.pageSizeTextBox.Size = new System.Drawing.Size(100, 21);
      this.pageSizeTextBox.TabIndex = 4;
      this.pageSizeTextBox.Text = "1024";
      this.pageSizeTextBox.Leave += new System.EventHandler(this.pageSizeTextBox_Leave);
      // 
      // fileTextBox
      // 
      this.fileTextBox.Location = new System.Drawing.Point(6, 20);
      this.fileTextBox.Name = "fileTextBox";
      this.fileTextBox.Size = new System.Drawing.Size(294, 21);
      this.fileTextBox.TabIndex = 0;
      this.fileTextBox.Leave += new System.EventHandler(this.fileTextBox_Leave);
      // 
      // browseButton
      // 
      this.browseButton.Location = new System.Drawing.Point(6, 47);
      this.browseButton.Name = "browseButton";
      this.browseButton.Size = new System.Drawing.Size(75, 23);
      this.browseButton.TabIndex = 1;
      this.browseButton.Text = "&Browse ...";
      this.browseButton.UseVisualStyleBackColor = true;
      this.browseButton.Click += new System.EventHandler(this.browseButton_Click);
      // 
      // newDatabase
      // 
      this.newDatabase.Location = new System.Drawing.Point(87, 47);
      this.newDatabase.Name = "newDatabase";
      this.newDatabase.Size = new System.Drawing.Size(75, 23);
      this.newDatabase.TabIndex = 2;
      this.newDatabase.Text = "&New ...";
      this.newDatabase.UseVisualStyleBackColor = true;
      this.newDatabase.Click += new System.EventHandler(this.newDatabase_Click);
      // 
      // syncGroup
      // 
      syncGroup.Controls.Add(this.offRadioButton);
      syncGroup.Controls.Add(this.normalRadioButton);
      syncGroup.Controls.Add(this.fullRadioButton);
      syncGroup.Location = new System.Drawing.Point(204, 159);
      syncGroup.Name = "syncGroup";
      syncGroup.Size = new System.Drawing.Size(105, 98);
      syncGroup.TabIndex = 9;
      syncGroup.TabStop = false;
      syncGroup.Text = "Synchronization";
      // 
      // offRadioButton
      // 
      this.offRadioButton.AutoSize = true;
      this.offRadioButton.Location = new System.Drawing.Point(6, 66);
      this.offRadioButton.Name = "offRadioButton";
      this.offRadioButton.Size = new System.Drawing.Size(41, 17);
      this.offRadioButton.TabIndex = 2;
      this.offRadioButton.Text = "Off";
      this.offRadioButton.UseVisualStyleBackColor = true;
      this.offRadioButton.CheckedChanged += new System.EventHandler(this.sync_Changed);
      // 
      // normalRadioButton
      // 
      this.normalRadioButton.AutoSize = true;
      this.normalRadioButton.Checked = true;
      this.normalRadioButton.Location = new System.Drawing.Point(6, 43);
      this.normalRadioButton.Name = "normalRadioButton";
      this.normalRadioButton.Size = new System.Drawing.Size(58, 17);
      this.normalRadioButton.TabIndex = 1;
      this.normalRadioButton.TabStop = true;
      this.normalRadioButton.Text = "Normal";
      this.normalRadioButton.UseVisualStyleBackColor = true;
      this.normalRadioButton.CheckedChanged += new System.EventHandler(this.sync_Changed);
      // 
      // fullRadioButton
      // 
      this.fullRadioButton.AutoSize = true;
      this.fullRadioButton.Location = new System.Drawing.Point(6, 20);
      this.fullRadioButton.Name = "fullRadioButton";
      this.fullRadioButton.Size = new System.Drawing.Size(41, 17);
      this.fullRadioButton.TabIndex = 0;
      this.fullRadioButton.Text = "Full";
      this.fullRadioButton.UseVisualStyleBackColor = true;
      this.fullRadioButton.CheckedChanged += new System.EventHandler(this.sync_Changed);
      // 
      // julianRadioButton
      // 
      this.julianRadioButton.AutoSize = true;
      this.julianRadioButton.Location = new System.Drawing.Point(7, 44);
      this.julianRadioButton.Name = "julianRadioButton";
      this.julianRadioButton.Size = new System.Drawing.Size(74, 17);
      this.julianRadioButton.TabIndex = 2;
      this.julianRadioButton.TabStop = true;
      this.julianRadioButton.Text = "Julian Day";
      this.julianRadioButton.UseVisualStyleBackColor = true;
      this.julianRadioButton.CheckedChanged += new System.EventHandler(this.datetime_Changed);
      // 




















      // SQLiteConnectionUIControl
      // 
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;

      this.Controls.Add(syncGroup);
      this.Controls.Add(databaseGroup);
      this.Controls.Add(dateTimeGroup);
      this.Controls.Add(encodingGroup);
      this.Controls.Add(securityGroup);
      this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
      this.Name = "SQLiteConnectionUIControl";
      this.Size = new System.Drawing.Size(312, 322);
      securityGroup.ResumeLayout(false);
      securityGroup.PerformLayout();
      encodingGroup.ResumeLayout(false);
      encodingGroup.PerformLayout();
      dateTimeGroup.ResumeLayout(false);
      dateTimeGroup.PerformLayout();
      databaseGroup.ResumeLayout(false);
      databaseGroup.PerformLayout();
      syncGroup.ResumeLayout(false);
      syncGroup.PerformLayout();
      this.ResumeLayout(false);


    }

    #endregion

    private System.Windows.Forms.TextBox fileTextBox;
    private System.Windows.Forms.Button browseButton;
    private System.Windows.Forms.Button newDatabase;
    private System.Windows.Forms.TextBox passwordTextBox;
    private System.Windows.Forms.RadioButton utf16RadioButton;
    private System.Windows.Forms.RadioButton utf8RadioButton;
    private System.Windows.Forms.RadioButton ticksRadioButton;
    private System.Windows.Forms.RadioButton iso8601RadioButton;
    private System.Windows.Forms.TextBox pageSizeTextBox;
    private System.Windows.Forms.TextBox cacheSizeTextbox;
    private System.Windows.Forms.RadioButton offRadioButton;
    private System.Windows.Forms.RadioButton normalRadioButton;
    private System.Windows.Forms.RadioButton fullRadioButton;
    private System.Windows.Forms.RadioButton julianRadioButton;

  }
}
>
>
>
>
>
>
>


|
|
|
|
|
|

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

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

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364

365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer
{
    partial class SQLiteConnectionUIControl
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.Windows.Forms.Label labelPassword;
            System.Windows.Forms.GroupBox securityGroup;
            System.Windows.Forms.GroupBox encodingGroup;
            System.Windows.Forms.GroupBox dateTimeGroup;
            System.Windows.Forms.GroupBox databaseGroup;
            System.Windows.Forms.Label cacheSizeLabel;
            System.Windows.Forms.Label pageSizeLabel;
            System.Windows.Forms.GroupBox syncGroup;
            System.Windows.Forms.GroupBox providerGroup;
            this.passwordTextBox = new System.Windows.Forms.TextBox();
            this.utf16RadioButton = new System.Windows.Forms.RadioButton();
            this.utf8RadioButton = new System.Windows.Forms.RadioButton();
            this.ticksRadioButton = new System.Windows.Forms.RadioButton();
            this.iso8601RadioButton = new System.Windows.Forms.RadioButton();
            this.cacheSizeTextbox = new System.Windows.Forms.TextBox();
            this.pageSizeTextBox = new System.Windows.Forms.TextBox();
            this.fileTextBox = new System.Windows.Forms.TextBox();
            this.browseButton = new System.Windows.Forms.Button();
            this.newDatabase = new System.Windows.Forms.Button();
            this.offRadioButton = new System.Windows.Forms.RadioButton();
            this.normalRadioButton = new System.Windows.Forms.RadioButton();
            this.fullRadioButton = new System.Windows.Forms.RadioButton();
            this.julianRadioButton = new System.Windows.Forms.RadioButton();
            this.providerComboBox = new System.Windows.Forms.ComboBox();
            labelPassword = new System.Windows.Forms.Label();
            securityGroup = new System.Windows.Forms.GroupBox();
            encodingGroup = new System.Windows.Forms.GroupBox();
            dateTimeGroup = new System.Windows.Forms.GroupBox();
            databaseGroup = new System.Windows.Forms.GroupBox();
            cacheSizeLabel = new System.Windows.Forms.Label();
            pageSizeLabel = new System.Windows.Forms.Label();
            syncGroup = new System.Windows.Forms.GroupBox();
            providerGroup = new System.Windows.Forms.GroupBox();
            securityGroup.SuspendLayout();
            encodingGroup.SuspendLayout();
            dateTimeGroup.SuspendLayout();
            databaseGroup.SuspendLayout();
            syncGroup.SuspendLayout();
            providerGroup.SuspendLayout();
            this.SuspendLayout();
            //
            // labelPassword
            //
            labelPassword.AutoSize = true;
            labelPassword.Location = new System.Drawing.Point(6, 23);
            labelPassword.Name = "labelPassword";
            labelPassword.Size = new System.Drawing.Size(53, 13);
            labelPassword.TabIndex = 0;
            labelPassword.Text = "Password";
            //
            // securityGroup
            //
            securityGroup.Controls.Add(this.passwordTextBox);
            securityGroup.Controls.Add(labelPassword);
            securityGroup.Location = new System.Drawing.Point(3, 263);
            securityGroup.Name = "securityGroup";
            securityGroup.Size = new System.Drawing.Size(306, 56);
            securityGroup.TabIndex = 10;
            securityGroup.TabStop = false;
            securityGroup.Text = "Encryption";
            //
            // passwordTextBox
            //
            this.passwordTextBox.Location = new System.Drawing.Point(65, 20);
            this.passwordTextBox.Name = "passwordTextBox";
            this.passwordTextBox.Size = new System.Drawing.Size(235, 21);
            this.passwordTextBox.TabIndex = 1;
            this.passwordTextBox.UseSystemPasswordChar = true;
            this.passwordTextBox.Leave += new System.EventHandler(this.passwordTextBox_Leave);
            //
            // encodingGroup
            //
            encodingGroup.Controls.Add(this.utf16RadioButton);
            encodingGroup.Controls.Add(this.utf8RadioButton);
            encodingGroup.Location = new System.Drawing.Point(3, 159);
            encodingGroup.Name = "encodingGroup";
            encodingGroup.Size = new System.Drawing.Size(75, 98);
            encodingGroup.TabIndex = 7;
            encodingGroup.TabStop = false;
            encodingGroup.Text = "Encoding";
            //
            // utf16RadioButton
            //
            this.utf16RadioButton.AutoSize = true;
            this.utf16RadioButton.Location = new System.Drawing.Point(6, 44);
            this.utf16RadioButton.Name = "utf16RadioButton";
            this.utf16RadioButton.Size = new System.Drawing.Size(60, 17);
            this.utf16RadioButton.TabIndex = 1;
            this.utf16RadioButton.TabStop = true;
            this.utf16RadioButton.Text = "UTF-16";
            this.utf16RadioButton.UseVisualStyleBackColor = true;
            this.utf16RadioButton.CheckedChanged += new System.EventHandler(this.encoding_Changed);
            //
            // utf8RadioButton
            //
            this.utf8RadioButton.AutoSize = true;
            this.utf8RadioButton.Checked = true;
            this.utf8RadioButton.Location = new System.Drawing.Point(7, 21);
            this.utf8RadioButton.Name = "utf8RadioButton";
            this.utf8RadioButton.Size = new System.Drawing.Size(54, 17);
            this.utf8RadioButton.TabIndex = 0;
            this.utf8RadioButton.TabStop = true;
            this.utf8RadioButton.Text = "UTF-8";
            this.utf8RadioButton.UseVisualStyleBackColor = true;
            this.utf8RadioButton.CheckedChanged += new System.EventHandler(this.encoding_Changed);
            //
            // dateTimeGroup
            //
            dateTimeGroup.Controls.Add(this.julianRadioButton);
            dateTimeGroup.Controls.Add(this.ticksRadioButton);
            dateTimeGroup.Controls.Add(this.iso8601RadioButton);
            dateTimeGroup.Location = new System.Drawing.Point(84, 159);
            dateTimeGroup.Name = "dateTimeGroup";
            dateTimeGroup.Size = new System.Drawing.Size(113, 98);
            dateTimeGroup.TabIndex = 8;
            dateTimeGroup.TabStop = false;
            dateTimeGroup.Text = "Date/Time Format";
            //
            // ticksRadioButton
            //
            this.ticksRadioButton.AutoSize = true;
            this.ticksRadioButton.Location = new System.Drawing.Point(7, 66);
            this.ticksRadioButton.Name = "ticksRadioButton";
            this.ticksRadioButton.Size = new System.Drawing.Size(48, 17);
            this.ticksRadioButton.TabIndex = 1;
            this.ticksRadioButton.TabStop = true;
            this.ticksRadioButton.Text = "Ticks";
            this.ticksRadioButton.UseVisualStyleBackColor = true;
            this.ticksRadioButton.CheckedChanged += new System.EventHandler(this.datetime_Changed);
            //
            // iso8601RadioButton
            //
            this.iso8601RadioButton.AutoSize = true;
            this.iso8601RadioButton.Checked = true;
            this.iso8601RadioButton.Location = new System.Drawing.Point(7, 21);
            this.iso8601RadioButton.Name = "iso8601RadioButton";
            this.iso8601RadioButton.Size = new System.Drawing.Size(71, 17);
            this.iso8601RadioButton.TabIndex = 0;
            this.iso8601RadioButton.TabStop = true;
            this.iso8601RadioButton.Text = "ISO-8601";
            this.iso8601RadioButton.UseVisualStyleBackColor = true;
            this.iso8601RadioButton.CheckedChanged += new System.EventHandler(this.datetime_Changed);
            //
            // databaseGroup
            //
            databaseGroup.Controls.Add(cacheSizeLabel);
            databaseGroup.Controls.Add(this.cacheSizeTextbox);
            databaseGroup.Controls.Add(pageSizeLabel);
            databaseGroup.Controls.Add(this.pageSizeTextBox);
            databaseGroup.Controls.Add(this.fileTextBox);
            databaseGroup.Controls.Add(this.browseButton);
            databaseGroup.Controls.Add(this.newDatabase);
            databaseGroup.Location = new System.Drawing.Point(3, 3);
            databaseGroup.Name = "databaseGroup";
            databaseGroup.Size = new System.Drawing.Size(306, 150);
            databaseGroup.TabIndex = 8;
            databaseGroup.TabStop = false;
            databaseGroup.Text = "Database";
            //
            // cacheSizeLabel
            //
            cacheSizeLabel.AutoSize = true;
            cacheSizeLabel.Location = new System.Drawing.Point(7, 116);
            cacheSizeLabel.Name = "cacheSizeLabel";
            cacheSizeLabel.Size = new System.Drawing.Size(59, 13);
            cacheSizeLabel.TabIndex = 5;
            cacheSizeLabel.Text = "Cache Size";
            //
            // cacheSizeTextbox
            //
            this.cacheSizeTextbox.Location = new System.Drawing.Point(72, 113);
            this.cacheSizeTextbox.Name = "cacheSizeTextbox";
            this.cacheSizeTextbox.Size = new System.Drawing.Size(100, 21);
            this.cacheSizeTextbox.TabIndex = 6;
            this.cacheSizeTextbox.Text = "2000";
            this.cacheSizeTextbox.Leave += new System.EventHandler(this.cacheSizeTextbox_Leave);
            //
            // pageSizeLabel
            //
            pageSizeLabel.AutoSize = true;
            pageSizeLabel.Location = new System.Drawing.Point(13, 89);
            pageSizeLabel.Name = "pageSizeLabel";
            pageSizeLabel.Size = new System.Drawing.Size(53, 13);
            pageSizeLabel.TabIndex = 3;
            pageSizeLabel.Text = "Page Size";
            //
            // pageSizeTextBox
            //
            this.pageSizeTextBox.Location = new System.Drawing.Point(72, 86);
            this.pageSizeTextBox.Name = "pageSizeTextBox";
            this.pageSizeTextBox.Size = new System.Drawing.Size(100, 21);
            this.pageSizeTextBox.TabIndex = 4;
            this.pageSizeTextBox.Text = "1024";
            this.pageSizeTextBox.Leave += new System.EventHandler(this.pageSizeTextBox_Leave);
            //
            // fileTextBox
            //
            this.fileTextBox.Location = new System.Drawing.Point(6, 20);
            this.fileTextBox.Name = "fileTextBox";
            this.fileTextBox.Size = new System.Drawing.Size(294, 21);
            this.fileTextBox.TabIndex = 0;
            this.fileTextBox.Leave += new System.EventHandler(this.fileTextBox_Leave);
            //
            // browseButton
            //
            this.browseButton.Location = new System.Drawing.Point(6, 47);
            this.browseButton.Name = "browseButton";
            this.browseButton.Size = new System.Drawing.Size(75, 23);
            this.browseButton.TabIndex = 1;
            this.browseButton.Text = "&Browse ...";
            this.browseButton.UseVisualStyleBackColor = true;
            this.browseButton.Click += new System.EventHandler(this.browseButton_Click);
            //
            // newDatabase
            //
            this.newDatabase.Location = new System.Drawing.Point(87, 47);
            this.newDatabase.Name = "newDatabase";
            this.newDatabase.Size = new System.Drawing.Size(75, 23);
            this.newDatabase.TabIndex = 2;
            this.newDatabase.Text = "&New ...";
            this.newDatabase.UseVisualStyleBackColor = true;
            this.newDatabase.Click += new System.EventHandler(this.newDatabase_Click);
            //
            // syncGroup
            //
            syncGroup.Controls.Add(this.offRadioButton);
            syncGroup.Controls.Add(this.normalRadioButton);
            syncGroup.Controls.Add(this.fullRadioButton);
            syncGroup.Location = new System.Drawing.Point(204, 159);
            syncGroup.Name = "syncGroup";
            syncGroup.Size = new System.Drawing.Size(105, 98);
            syncGroup.TabIndex = 9;
            syncGroup.TabStop = false;
            syncGroup.Text = "Synchronization";
            //
            // offRadioButton
            //
            this.offRadioButton.AutoSize = true;
            this.offRadioButton.Location = new System.Drawing.Point(6, 66);
            this.offRadioButton.Name = "offRadioButton";
            this.offRadioButton.Size = new System.Drawing.Size(41, 17);
            this.offRadioButton.TabIndex = 2;
            this.offRadioButton.Text = "Off";
            this.offRadioButton.UseVisualStyleBackColor = true;
            this.offRadioButton.CheckedChanged += new System.EventHandler(this.sync_Changed);
            //
            // normalRadioButton
            //
            this.normalRadioButton.AutoSize = true;
            this.normalRadioButton.Checked = true;
            this.normalRadioButton.Location = new System.Drawing.Point(6, 43);
            this.normalRadioButton.Name = "normalRadioButton";
            this.normalRadioButton.Size = new System.Drawing.Size(58, 17);
            this.normalRadioButton.TabIndex = 1;
            this.normalRadioButton.TabStop = true;
            this.normalRadioButton.Text = "Normal";
            this.normalRadioButton.UseVisualStyleBackColor = true;
            this.normalRadioButton.CheckedChanged += new System.EventHandler(this.sync_Changed);
            //
            // fullRadioButton
            //
            this.fullRadioButton.AutoSize = true;
            this.fullRadioButton.Location = new System.Drawing.Point(6, 20);
            this.fullRadioButton.Name = "fullRadioButton";
            this.fullRadioButton.Size = new System.Drawing.Size(41, 17);
            this.fullRadioButton.TabIndex = 0;
            this.fullRadioButton.Text = "Full";
            this.fullRadioButton.UseVisualStyleBackColor = true;
            this.fullRadioButton.CheckedChanged += new System.EventHandler(this.sync_Changed);
            //
            // julianRadioButton
            //
            this.julianRadioButton.AutoSize = true;
            this.julianRadioButton.Location = new System.Drawing.Point(7, 44);
            this.julianRadioButton.Name = "julianRadioButton";
            this.julianRadioButton.Size = new System.Drawing.Size(74, 17);
            this.julianRadioButton.TabIndex = 2;
            this.julianRadioButton.TabStop = true;
            this.julianRadioButton.Text = "Julian Day";
            this.julianRadioButton.UseVisualStyleBackColor = true;
            this.julianRadioButton.CheckedChanged += new System.EventHandler(this.datetime_Changed);
            //
            // providerGroup
            //
            providerGroup.Controls.Add(this.providerComboBox);
            providerGroup.Location = new System.Drawing.Point(3, 325);
            providerGroup.Name = "providerGroup";
            providerGroup.Size = new System.Drawing.Size(306, 56);
            providerGroup.TabIndex = 11;
            providerGroup.TabStop = false;
            providerGroup.Text = "Provider";
            //
            // providerComboBox
            //
            this.providerComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.providerComboBox.FormattingEnabled = true;
            this.providerComboBox.Location = new System.Drawing.Point(6, 20);
            this.providerComboBox.Name = "providerComboBox";
            this.providerComboBox.Size = new System.Drawing.Size(294, 21);
            this.providerComboBox.TabIndex = 0;
            this.providerComboBox.SelectedIndexChanged += new System.EventHandler(this.provider_Changed);
            //
            // SQLiteConnectionUIControl
            //
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
            this.Controls.Add(providerGroup);
            this.Controls.Add(syncGroup);
            this.Controls.Add(databaseGroup);
            this.Controls.Add(dateTimeGroup);
            this.Controls.Add(encodingGroup);
            this.Controls.Add(securityGroup);
            this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.Name = "SQLiteConnectionUIControl";
            this.Size = new System.Drawing.Size(312, 386);
            securityGroup.ResumeLayout(false);
            securityGroup.PerformLayout();
            encodingGroup.ResumeLayout(false);
            encodingGroup.PerformLayout();
            dateTimeGroup.ResumeLayout(false);
            dateTimeGroup.PerformLayout();
            databaseGroup.ResumeLayout(false);
            databaseGroup.PerformLayout();
            syncGroup.ResumeLayout(false);
            syncGroup.PerformLayout();
            providerGroup.ResumeLayout(false);
            providerGroup.PerformLayout();
            this.ResumeLayout(false);
        }

        #endregion

        private System.Windows.Forms.TextBox fileTextBox;
        private System.Windows.Forms.Button browseButton;
        private System.Windows.Forms.Button newDatabase;
        private System.Windows.Forms.TextBox passwordTextBox;
        private System.Windows.Forms.RadioButton utf16RadioButton;
        private System.Windows.Forms.RadioButton utf8RadioButton;
        private System.Windows.Forms.RadioButton ticksRadioButton;
        private System.Windows.Forms.RadioButton iso8601RadioButton;
        private System.Windows.Forms.TextBox pageSizeTextBox;
        private System.Windows.Forms.TextBox cacheSizeTextbox;
        private System.Windows.Forms.RadioButton offRadioButton;
        private System.Windows.Forms.RadioButton normalRadioButton;
        private System.Windows.Forms.RadioButton fullRadioButton;
        private System.Windows.Forms.RadioButton julianRadioButton;
        private System.Windows.Forms.ComboBox providerComboBox;
    }
}

Changes to SQLite.Designer/SQLiteConnectionUIControl.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

30
31
32
33
34
35
36
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer
{
  using System;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Text;
  using System.Windows.Forms;
  using System.Globalization;
  using Microsoft.VisualStudio.Data;
  using Microsoft.Win32;

  /// <summary>
  /// Provides a UI to edit/create SQLite database connections
  /// </summary>
  [ToolboxItem(false)]
  public partial class SQLiteConnectionUIControl : DataConnectionUIControl
  {
    public SQLiteConnectionUIControl()
    {
      InitializeComponent();

    }

    private void browseButton_Click(object sender, EventArgs e)
    {
      OpenFileDialog dlg = new OpenFileDialog();
      dlg.FileName = fileTextBox.Text;
      dlg.Title = "Select SQLite Database File";



|






<

<
<
<



<










>







1
2
3
4
5
6
7
8
9
10

11



12
13
14

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer
{
  using System;

  using System.ComponentModel;



  using System.Windows.Forms;
  using System.Globalization;
  using Microsoft.VisualStudio.Data;


  /// <summary>
  /// Provides a UI to edit/create SQLite database connections
  /// </summary>
  [ToolboxItem(false)]
  public partial class SQLiteConnectionUIControl : DataConnectionUIControl
  {
    public SQLiteConnectionUIControl()
    {
      InitializeComponent();
      SQLiteOptions.AddProviderNames(providerComboBox.Items);
    }

    private void browseButton_Click(object sender, EventArgs e)
    {
      OpenFileDialog dlg = new OpenFileDialog();
      dlg.FileName = fileTextBox.Text;
      dlg.Title = "Select SQLite Database File";
53
54
55
56
57
58
59








60
61
62
63
64
65
66
67
68
69
70
71
72
73
74



75
76
77
78
79
80
81
82



83
84
85
86
87
88
89
90



91
92
93
94
95
96
97








98
99
100



101
102
103
104
105
106
107
108
109
110
111
112



113
114
115
116
117
118



119
120
121
122
123
124



125
126
127
128
      }
    }

    #region IDataConnectionUIControl Members

    public override void LoadProperties()
    {








      if (ConnectionProperties.Contains("data source"))
        fileTextBox.Text = ConnectionProperties["data source"] as string;
      else
        fileTextBox.Text = String.Empty;

      if (ConnectionProperties.Contains("password"))
        passwordTextBox.Text = ConnectionProperties["password"] as string;
      else
        passwordTextBox.Text = String.Empty;
    }

    #endregion

    private void passwordTextBox_Leave(object sender, EventArgs e)
    {



      if (String.IsNullOrEmpty(passwordTextBox.Text))
        ConnectionProperties.Remove("password");
      else
        ConnectionProperties["password"] = passwordTextBox.Text;
    }

    private void encoding_Changed(object sender, EventArgs e)
    {



      if (utf8RadioButton.Checked == true)
        ConnectionProperties.Remove("useutf16encoding");
      else
        ConnectionProperties["useutf16encoding"] = utf16RadioButton.Checked;
    }

    private void datetime_Changed(object sender, EventArgs e)
    {



      if (iso8601RadioButton.Checked == true)
        ConnectionProperties.Remove("datetimeformat");
      else if (ticksRadioButton.Checked == true)
        ConnectionProperties["datetimeformat"] = "Ticks";
      else
        ConnectionProperties["datetimeformat"] = "JulianDay";
    }









    private void sync_Changed(object sender, EventArgs e)
    {



      string sync = "Normal";
      if (fullRadioButton.Checked == true) sync = "Full";
      else if (offRadioButton.Checked == true) sync = "Off";

      if (sync == "Normal")
        ConnectionProperties.Remove("synchronous");
      else
        ConnectionProperties["synchronous"] = sync;
    }

    private void pageSizeTextBox_Leave(object sender, EventArgs e)
    {



      int n = Convert.ToInt32(pageSizeTextBox.Text, CultureInfo.CurrentCulture);
      ConnectionProperties["page size"] = n;
    }

    private void cacheSizeTextbox_Leave(object sender, EventArgs e)
    {



      int n = Convert.ToInt32(cacheSizeTextbox.Text, CultureInfo.CurrentCulture);
      ConnectionProperties["cache size"] = n;
    }

    private void fileTextBox_Leave(object sender, EventArgs e)
    {



      ConnectionProperties["data source"] = fileTextBox.Text;
    }
  }
}







>
>
>
>
>
>
>
>


<
<



<
<






>
>
>








>
>
>








>
>
>







>
>
>
>
>
>
>
>



>
>
>












>
>
>






>
>
>






>
>
>




49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65


66
67
68


69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
      }
    }

    #region IDataConnectionUIControl Members

    public override void LoadProperties()
    {
      SQLiteOptions.SelectProviderName(providerComboBox);

      fileTextBox.Text = String.Empty;
      passwordTextBox.Text = String.Empty;

      if (ConnectionProperties == null)
        return;

      if (ConnectionProperties.Contains("data source"))
        fileTextBox.Text = ConnectionProperties["data source"] as string;



      if (ConnectionProperties.Contains("password"))
        passwordTextBox.Text = ConnectionProperties["password"] as string;


    }

    #endregion

    private void passwordTextBox_Leave(object sender, EventArgs e)
    {
      if (ConnectionProperties == null)
       return;

      if (String.IsNullOrEmpty(passwordTextBox.Text))
        ConnectionProperties.Remove("password");
      else
        ConnectionProperties["password"] = passwordTextBox.Text;
    }

    private void encoding_Changed(object sender, EventArgs e)
    {
      if (ConnectionProperties == null)
        return;

      if (utf8RadioButton.Checked == true)
        ConnectionProperties.Remove("useutf16encoding");
      else
        ConnectionProperties["useutf16encoding"] = utf16RadioButton.Checked;
    }

    private void datetime_Changed(object sender, EventArgs e)
    {
      if (ConnectionProperties == null)
        return;

      if (iso8601RadioButton.Checked == true)
        ConnectionProperties.Remove("datetimeformat");
      else if (ticksRadioButton.Checked == true)
        ConnectionProperties["datetimeformat"] = "Ticks";
      else
        ConnectionProperties["datetimeformat"] = "JulianDay";
    }

    private void provider_Changed(object sender, EventArgs e)
    {
        object item = providerComboBox.SelectedItem;

        if (item != null)
            SQLiteOptions.SetProviderName(item.ToString());
    }

    private void sync_Changed(object sender, EventArgs e)
    {
      if (ConnectionProperties == null)
        return;

      string sync = "Normal";
      if (fullRadioButton.Checked == true) sync = "Full";
      else if (offRadioButton.Checked == true) sync = "Off";

      if (sync == "Normal")
        ConnectionProperties.Remove("synchronous");
      else
        ConnectionProperties["synchronous"] = sync;
    }

    private void pageSizeTextBox_Leave(object sender, EventArgs e)
    {
      if (ConnectionProperties == null)
        return;

      int n = Convert.ToInt32(pageSizeTextBox.Text, CultureInfo.CurrentCulture);
      ConnectionProperties["page size"] = n;
    }

    private void cacheSizeTextbox_Leave(object sender, EventArgs e)
    {
      if (ConnectionProperties == null)
        return;

      int n = Convert.ToInt32(cacheSizeTextbox.Text, CultureInfo.CurrentCulture);
      ConnectionProperties["cache size"] = n;
    }

    private void fileTextBox_Leave(object sender, EventArgs e)
    {
      if (ConnectionProperties == null)
        return;

      ConnectionProperties["data source"] = fileTextBox.Text;
    }
  }
}

Deleted SQLite.Designer/SQLiteConnectionUIControl.resources.

cannot compute difference between binary files

Changes to SQLite.Designer/SQLiteConnectionUIControl.resx.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!-- 
    Microsoft ResX Schema 
    
    Version 2.0
    
    The primary goals of this format is to allow a simple XML format 
    that is mostly human readable. The generation and parsing of the 
    various data types are done through the TypeConverter classes 
    associated with the data types.
    
    Example:
    
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
                
    There are any number of "resheader" rows that contain simple 
    name/value pairs.
    
    Each data row contains a name, and value. The row also contains a 
    type or mimetype. Type corresponds to a .NET class that support 
    text/value conversion through the TypeConverter architecture. 
    Classes that don't support this are serialized and stored with the 
    mimetype set.
    
    The mimetype is used for serialized objects, and tells the 
    ResXResourceReader how to depersist the object. This is currently not 
    extensible. For a given mimetype the value must be set accordingly:
    
    Note - application/x-microsoft.net.object.binary.base64 is the format 
    that the ResXResourceWriter will generate, however the reader can 
    read any of the formats listed below.
    
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array 
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>


|
|
|

|
|
|
|

|

|














|
|

|
|
|
|
|

|
|
|

|
|
|

|

|


|

|




|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema

    Version 2.0

    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.

    Example:

    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>

    There are any number of "resheader" rows that contain simple
    name/value pairs.

    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.

    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:

    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.

    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
136
137
138
139
140
141
142
143



144
    <value>False</value>
  </metadata>
  <metadata name="pageSizeLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>False</value>
  </metadata>
  <metadata name="syncGroup.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>False</value>
  </metadata>



</root>








>
>
>

136
137
138
139
140
141
142
143
144
145
146
147
    <value>False</value>
  </metadata>
  <metadata name="pageSizeLabel.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>False</value>
  </metadata>
  <metadata name="syncGroup.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>False</value>
  </metadata>
  <metadata name="providerGroup.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>False</value>
  </metadata>
</root>

Changes to SQLite.Designer/SQLiteDataAdapterToolboxItem.cs.

59
60
61
62
63
64
65

66
67


68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113

114
115
116
117
118
119
120
121
    /// <summary>
    /// Creates the necessary components associated with this data adapter instance
    /// </summary>
    /// <param name="host">The designer host</param>
    /// <returns>The components created by this toolbox item</returns>
    protected override IComponent[] CreateComponentsCore(IDesignerHost host)
    {

      DbProviderFactory fact = DbProviderFactories.GetFactory("System.Data.SQLite");



      DbDataAdapter dataAdapter = fact.CreateDataAdapter();
      IContainer container = host.Container;
      
      using (DbCommand adapterCommand = fact.CreateCommand())
      {
        ICloneable adapter = (ICloneable)adapterCommand;

        adapterCommand.DesignTimeVisible = false;
        dataAdapter.SelectCommand = (DbCommand)adapter.Clone();
        container.Add(dataAdapter.SelectCommand, GenerateName(container, "SelectCommand"));

        dataAdapter.InsertCommand = (DbCommand)adapter.Clone();
        container.Add(dataAdapter.InsertCommand, GenerateName(container, "InsertCommand"));

        dataAdapter.UpdateCommand = (DbCommand)adapter.Clone();
        container.Add(dataAdapter.UpdateCommand, GenerateName(container, "UpdateCommand"));

        dataAdapter.DeleteCommand = (DbCommand)adapter.Clone();
        container.Add(dataAdapter.DeleteCommand, GenerateName(container, "DeleteCommand"));
      }

      ITypeResolutionService typeResService = (ITypeResolutionService)host.GetService(typeof(ITypeResolutionService));
      if (typeResService != null)
      {
        typeResService.ReferenceAssembly(dataAdapter.GetType().Assembly.GetName());
      }

      container.Add(dataAdapter);

      List<IComponent> list = new List<IComponent>();
      list.Add(dataAdapter);

      // Show the connection wizard if we have a type for it
      if (_wizard != null)
      {
        using (Form wizard = (Form)Activator.CreateInstance(_wizard, new object[] { host, dataAdapter }))
        {
          wizard.ShowDialog();
        }
      }

      if (dataAdapter.SelectCommand != null) list.Add(dataAdapter.SelectCommand);
      if (dataAdapter.InsertCommand != null) list.Add(dataAdapter.InsertCommand);
      if (dataAdapter.DeleteCommand != null) list.Add(dataAdapter.DeleteCommand);
      if (dataAdapter.UpdateCommand != null) list.Add(dataAdapter.UpdateCommand);


      return list.ToArray();      
    }

    /// <summary>
    /// Generates a unique name for the given object
    /// </summary>
    /// <param name="container">The container where we're being instantiated</param>
    /// <param name="baseName">The core name of the object to create a unique instance of</param>







>
|

>
>
|
|
|
|
|
|

|
|
|

|
|

|
|

|
|
|

|
|
|
|
|

|

<
|

|
|
|
|
|
|
|
|

|
|
|
|
|
>
|







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99

100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
    /// <summary>
    /// Creates the necessary components associated with this data adapter instance
    /// </summary>
    /// <param name="host">The designer host</param>
    /// <returns>The components created by this toolbox item</returns>
    protected override IComponent[] CreateComponentsCore(IDesignerHost host)
    {
        List<IComponent> list = new List<IComponent>();
        DbProviderFactory fact;

        if (SQLiteOptions.GetProviderFactory(SQLiteOptions.GetProviderName(), true, out fact))
        {
            DbDataAdapter dataAdapter = fact.CreateDataAdapter();
            IContainer container = host.Container;

            using (DbCommand adapterCommand = fact.CreateCommand())
            {
                ICloneable adapter = (ICloneable)adapterCommand;

                adapterCommand.DesignTimeVisible = false;
                dataAdapter.SelectCommand = (DbCommand)adapter.Clone();
                container.Add(dataAdapter.SelectCommand, GenerateName(container, "SelectCommand"));

                dataAdapter.InsertCommand = (DbCommand)adapter.Clone();
                container.Add(dataAdapter.InsertCommand, GenerateName(container, "InsertCommand"));

                dataAdapter.UpdateCommand = (DbCommand)adapter.Clone();
                container.Add(dataAdapter.UpdateCommand, GenerateName(container, "UpdateCommand"));

                dataAdapter.DeleteCommand = (DbCommand)adapter.Clone();
                container.Add(dataAdapter.DeleteCommand, GenerateName(container, "DeleteCommand"));
            }

            ITypeResolutionService typeResService = (ITypeResolutionService)host.GetService(typeof(ITypeResolutionService));
            if (typeResService != null)
            {
                typeResService.ReferenceAssembly(dataAdapter.GetType().Assembly.GetName());
            }

            container.Add(dataAdapter);


            list.Add(dataAdapter);

            // Show the connection wizard if we have a type for it
            if (_wizard != null)
            {
                using (Form wizard = (Form)Activator.CreateInstance(_wizard, new object[] { host, dataAdapter }))
                {
                    wizard.ShowDialog();
                }
            }

            if (dataAdapter.SelectCommand != null) list.Add(dataAdapter.SelectCommand);
            if (dataAdapter.InsertCommand != null) list.Add(dataAdapter.InsertCommand);
            if (dataAdapter.DeleteCommand != null) list.Add(dataAdapter.DeleteCommand);
            if (dataAdapter.UpdateCommand != null) list.Add(dataAdapter.UpdateCommand);
        }

        return list.ToArray();
    }

    /// <summary>
    /// Generates a unique name for the given object
    /// </summary>
    /// <param name="container">The container where we're being instantiated</param>
    /// <param name="baseName">The core name of the object to create a unique instance of</param>

Changes to SQLite.Designer/SQLiteDataConnectionSupport.cs.

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  internal sealed class SQLiteDataConnectionSupport : AdoDotNetConnectionSupport
  {
    private SQLiteDataViewSupport _dataViewSupport;
    private SQLiteDataObjectSupport _dataObjectSupport;
    private SQLiteDataObjectIdentifierResolver _dataObjectIdentifierResolver;

    public SQLiteDataConnectionSupport()
      : base("System.Data.SQLite")
    {
    }

    protected override DataSourceInformation CreateDataSourceInformation()
    {
      return new SQLiteDataSourceInformation(Site as DataConnection);
    }







|







19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  internal sealed class SQLiteDataConnectionSupport : AdoDotNetConnectionSupport
  {
    private SQLiteDataViewSupport _dataViewSupport;
    private SQLiteDataObjectSupport _dataObjectSupport;
    private SQLiteDataObjectIdentifierResolver _dataObjectIdentifierResolver;

    public SQLiteDataConnectionSupport()
      : base(SQLiteOptions.GetProviderName())
    {
    }

    protected override DataSourceInformation CreateDataSourceInformation()
    {
      return new SQLiteDataSourceInformation(Site as DataConnection);
    }

Changes to SQLite.Designer/SQLiteDataObjectSupport.cs.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19
20
21
22
23


24
25






















26
27
28
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer
{
  using System;
  using System.Collections.Generic;
  using System.Text;

  using Microsoft.VisualStudio.Data;
  using Microsoft.VisualStudio.OLE.Interop;
  using Microsoft.VisualStudio.Data.AdoDotNet;

  /// <summary>
  /// Doesn't do much other than provide the DataObjectSupport base object with a location
  /// where the XML resource can be found.
  /// </summary>
  internal sealed class SQLiteDataObjectSupport : DataObjectSupport
  {
    public SQLiteDataObjectSupport()


      : base("SQLite.Designer.SQLiteDataObjectSupport", typeof(SQLiteDataObjectSupport).Assembly)
    {






















    }
  }
}



|








>











>
>
|

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



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer
{
  using System;
  using System.Collections.Generic;
  using System.Text;
  using System.Globalization;
  using Microsoft.VisualStudio.Data;
  using Microsoft.VisualStudio.OLE.Interop;
  using Microsoft.VisualStudio.Data.AdoDotNet;

  /// <summary>
  /// Doesn't do much other than provide the DataObjectSupport base object with a location
  /// where the XML resource can be found.
  /// </summary>
  internal sealed class SQLiteDataObjectSupport : DataObjectSupport
  {
    public SQLiteDataObjectSupport()
      : base(String.Format(CultureInfo.InvariantCulture,
          "SQLite.Designer.SQLiteDataObjectSupport{0}", GetVSVersion()),
          typeof(SQLiteDataObjectSupport).Assembly)
    {
    }

    private static string GetVSVersion()
    {
      switch (System.Diagnostics.FileVersionInfo.GetVersionInfo(
          Environment.GetCommandLineArgs()[0]).FileMajorPart)
      {
        case 8:
          return "2005";
        case 9:
          return "2008";
        case 10:
          return "2010";
        case 11:
          return "2012";
        case 12:
          return "2013";
        case 14:
          return "2015";
        default:
          return null;
      }
    }
  }
}

Deleted SQLite.Designer/SQLiteDataObjectSupport.xml.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
<?xml version="1.0" encoding="utf-8"?> 

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<VSDataObjectSupport xmlns="http://tempuri.org/VSDataObjectSupport.xsd">
	<Types>
		<RootType>
			<Properties>
        <Property name="Server" type="System.String" itemName="DataSource"/>
        <Property name="Database" type="System.String" itemName="Database"/>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetRootObjectEnumerator"/>
			</Actions>
		</RootType>

		<Type name="Table" defaultSort="Database,Name">
			<Concepts>
				<Concept name="Table" restrictions="{Catalog},null,{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="table_name"/>
				<Property name="Schema" type="System.String" itemName="table_schema"/>
        <Property name="Type" type="System.String" itemName="table_type">
          <Concepts>
            <Concept name="Type">
              <Conversion>
                <Calculate expr="IIF({0}='TABLE','USER','SYSTEM')" type="System.String"/>
              </Conversion>
            </Concept>
          </Concepts>
        </Property>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Tables"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="Table"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="101" type="System.Int32"/> <!-- Table -->
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<Type name="TableColumn" defaultSort="Database,Table,Ordinal">
			<Concepts>
				<Concept name="TableColumn" restrictions="{Catalog},null,{Table},{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Table" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="column_name">
					<Concepts>
						<Concept name="Identifier3"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="column_name"/>
				<Property name="Ordinal" type="System.Int32" itemName="ordinal_position">
					<Concepts>
						<Concept name="Ordinal">
						</Concept>
					</Concepts>
				</Property>
        <Property name="DataType" type="System.String" itemName="data_type" />
        <Property name="SystemType" type="System.String" itemName="data_type">
          <Concepts>
            <Concept name="UserDataType"/>
            <Concept name="NativeDataType"/>
            <Concept name="ProviderDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="ProviderDbType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="FrameworkDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
          </Concepts>
        </Property>
        <Property name="Length" type="System.Int32" itemName='character_maximum_length'>
					<Concepts>
						<Concept name="Length"/>
					</Concepts>
				</Property>
				<Property name="Precision" type="System.Int32" itemName="numeric_precision">
					<Concepts>
						<Concept name="Precision">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Scale" type="System.Int32" itemName="numeric_scale">
					<Concepts>
						<Concept name="Scale"/>
					</Concepts>
				</Property>
				<Property name="Nullable" type="System.Boolean" itemName="is_nullable">
					<Concepts>
						<Concept name="Nullable">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Default" type="System.String" itemName="column_default">
					<Concepts>
						<Concept name="Default"/>
					</Concepts>
				</Property>
        <Property name="InPrimaryKey" type="System.Boolean" itemName="primary_key"/>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Columns"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="Table"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="101" type="System.Int32"/> <!-- Table -->
							</Parameter>
						</Parameter>
						<Parameter>
							<Parameter>
								<Parameter value="{3}"/>
								<Parameter/>
								<Parameter value="Field"/>
								<Parameter/>
								<Parameter>
									<!-- GUID_DSRefProperty_PreciseType -->
									<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
										<Parameter value="102" type="System.Int32"/> <!-- Table_Column -->
									</Parameter>
								</Parameter>
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<Type name="View" defaultSort="Database,Name">
			<Concepts>
				<Concept name="View" restrictions="{Catalog},null,{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="table_name"/>
				<Property name="Schema" type="System.String" itemName="table_schema">
					<Concepts>
						<Concept name="Schema"/>
					</Concepts>
				</Property>
				<Property name="CheckOption" type="System.Boolean" itemName="check_option"/>
				<Property name="IsUpdatable" type="System.Boolean" itemName="is_updatable"/>
			</Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Views"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="View"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="301" type="System.Int32"/> <!-- View -->
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<!--
			Defines a type that represents a view column.
		-->
		<Type name="ViewColumn" defaultSort="Database,View,Ordinal">
			<Concepts>
				<Concept name="ViewColumn" restrictions="{Catalog},null,{View},{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="View" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="column_name">
					<Concepts>
						<Concept name="Identifier3"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="column_name"/>
				<Property name="Ordinal" type="System.Int32" itemName="ordinal_position">
					<Concepts>
						<Concept name="Ordinal">
						</Concept>
					</Concepts>
				</Property>
        <Property name="DataType" type="System.String" itemName="data_type" />
        <Property name="SystemType" type="System.String" itemName="data_type">
          <Concepts>
            <Concept name="UserDataType"/>
            <Concept name="NativeDataType"/>
            <Concept name="ProviderDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="ProviderDbType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="FrameworkDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
          </Concepts>
        </Property>
        <Property name="Length" type="System.Int32" itemName='character_maximum_length'>
					<Concepts>
						<Concept name="Length"/>
					</Concepts>
				</Property>
				<Property name="Precision" type="System.Int32" itemName="numeric_precision">
					<Concepts>
						<Concept name="Precision">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Scale" type="System.Int32" itemName="numeric_scale">
					<Concepts>
						<Concept name="Scale"/>
					</Concepts>
				</Property>
				<Property name="Nullable" type="System.Boolean" itemName="is_nullable">
					<Concepts>
						<Concept name="Nullable">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Default" type="System.String" itemName="column_default">
					<Concepts>
						<Concept name="Default"/>
					</Concepts>
				</Property>
			</Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Columns"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="View"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="301" type="System.Int32"/> <!-- View -->
							</Parameter>
						</Parameter>
						<Parameter>
							<Parameter>
								<Parameter value="{3}"/>
								<Parameter/>
								<Parameter value="Field"/>
								<Parameter/>
								<Parameter>
									<!-- GUID_DSRefProperty_PreciseType -->
									<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
										<Parameter value="302" type="System.Int32"/> <!-- View_Column -->
									</Parameter>
								</Parameter>
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>
    <!--
			Defines a type that represents an index.
		-->
    <Type name="Index" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableUniqueKey" restrictions="{Catalog},null,{Table},{Name}" filter="IsUnique = true"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="index_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="index_name"/>
        <Property name="IsUnique" type="System.Boolean" itemName="UNIQUE">
          <Concepts>
            <Concept name="IsUnique"/>
          </Concepts>
        </Property>                  
        <Property name="IsPrimary" type="System.Boolean" itemName="PRIMARY_KEY">
          <Concepts>
            <Concept name="IsPrimary"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="Indexes"/>
        </Action>
        <Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
          <Parameter>
            <Parameter value="{2}"/>
            <Parameter value="{1}"/>
            <Parameter value="Table"/>
            <Parameter/>
            <Parameter>
              <!-- GUID_DSRefProperty_Qualifier -->
              <Parameter value="4656BAEA-F397-11ce-BFE1-00AA0057B34E">
                <Parameter value="{0}"/>
              </Parameter>
              <!-- GUID_DSRefProperty_PreciseType -->
              <Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
                <Parameter value="101" type="System.Int32"/>
                <!-- Table -->
              </Parameter>
            </Parameter>
            <Parameter>
              <Parameter>
                <Parameter value="{3}"/>
                <Parameter/>
                <Parameter value="Index"/>
              </Parameter>
            </Parameter>
          </Parameter>
        </Action>
      </Actions>
    </Type>

    <Type name="IndexColumn" defaultSort="Database,Table,Index,Ordinal">
      <Concepts>
        <Concept name="TableUniqueKeyColumn" restrictions="{Catalog},null,{Table},{TableUniqueKey},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Index" itemName="index_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="column_name">
          <Concepts>
            <Concept name="Identifier4"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="column_name"/>
        <Property name="Ordinal" type="System.Byte" itemName="ordinal_position">
          <Concepts>
            <Concept name="Ordinal">
              <Conversion>
                <ChangeType type="System.Int32"/>
              </Conversion>
            </Concept>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="IndexColumns"/>
        </Action>
        <Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
          <Parameter>
            <Parameter value="{2}"/>
            <Parameter value="{1}"/>
            <Parameter value="Table"/>
            <Parameter/>
            <Parameter>
              <!-- GUID_DSRefProperty_Qualifier -->
              <Parameter value="4656BAEA-F397-11ce-BFE1-00AA0057B34E">
                <Parameter value="{0}"/>
              </Parameter>
              <!-- GUID_DSRefProperty_PreciseType -->
              <Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
                <Parameter value="101" type="System.Int32"/>
                <!-- Table -->
              </Parameter>
            </Parameter>
            <Parameter>
              <Parameter>
                <Parameter value="{3}"/>
                <Parameter/>
                <Parameter value="Index"/>
                <Parameter/>
                <Parameter/>
                <Parameter>
                  <Parameter>
                    <Parameter value="{4}"/>
                    <Parameter/>
                    <Parameter value="Field"/>
                  </Parameter>
                </Parameter>
              </Parameter>
            </Parameter>
          </Parameter>
        </Action>
      </Actions>
    </Type>

    <Type name="Triggers" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableTriggers" restrictions="{Catalog},null,{Table},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="trigger_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="trigger_name"/>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="Triggers"/>
        </Action>
      </Actions>
    </Type>
    
    <Type name="ForeignKey" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableForeignKey" restrictions="{Catalog},null,{Table},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="constraint_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="constraint_name"/>
        <Property name="ReferencedColumnName" type="System.String" itemName="fkey_to_column"/>
        <Property name="ColumnName" type="System.String" itemName="fkey_from_column"/>
        <Property name="ReferencedTableDatabase" type="System.String" itemName="fkey_to_catalog">
          <Concepts>
            <Concept name="ReferencedTableId0"/>
          </Concepts>
        </Property>
        <Property name="ReferencedTableSchema" type="System.String" itemName="fkey_to_schema">
          <Concepts>
            <Concept name="ReferencedTableId1"/>
          </Concepts>
        </Property>
        <Property name="ReferencedTableName" type="System.String" itemName="fkey_to_table">
          <Concepts>
            <Concept name="ReferencedTableId2"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="ForeignKeys"/>
        </Action>
      </Actions>
    </Type>

    <Type name="ForeignKeyColumn" defaultSort="Database,Table,ForeignKey,Ordinal">
      <Concepts>
        <Concept name="TableForeignKeyColumn" restrictions="{Catalog},null,{Table},{TableForeignKey},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="ForeignKey" itemName="constraint_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="fkey_from_column">
          <Concepts>
            <Concept name="Identifier4"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="fkey_from_column"/>
        <Property name="Ordinal" type="System.Int32" itemName="fkey_from_ordinal_position">
          <Concepts>
            <Concept name="Ordinal"/>
          </Concepts>
        </Property>
        <Property name="ReferencedColumnName" type="System.String" itemName="fkey_to_column">
          <Concepts>
            <Concept name="ReferencedTableColumn"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="ForeignKeys"/>
        </Action>
      </Actions>
    </Type>
  </Types>
</VSDataObjectSupport>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Added SQLite.Designer/SQLiteDataObjectSupport2005.xml.









































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<VSDataObjectSupport xmlns="http://tempuri.org/VSDataObjectSupport.xsd">
	<Types>
		<RootType>
			<Properties>
        <Property name="Server" type="System.String" itemName="DataSource"/>
        <Property name="Database" type="System.String" itemName="Database"/>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetRootObjectEnumerator"/>
			</Actions>
		</RootType>

		<Type name="Table" defaultSort="Database,Name">
			<Concepts>
				<Concept name="Table" restrictions="{Catalog},null,{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="table_name"/>
				<Property name="Schema" type="System.String" itemName="table_schema"/>
        <Property name="Type" type="System.String" itemName="table_type">
          <Concepts>
            <Concept name="Type">
              <Conversion>
                <Calculate expr="IIF({0}='TABLE','USER','SYSTEM')" type="System.String"/>
              </Conversion>
            </Concept>
          </Concepts>
        </Property>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Tables"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="Table"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="101" type="System.Int32"/> <!-- Table -->
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<Type name="TableColumn" defaultSort="Database,Table,Ordinal">
			<Concepts>
				<Concept name="TableColumn" restrictions="{Catalog},null,{Table},{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Table" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="column_name">
					<Concepts>
						<Concept name="Identifier3"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="column_name"/>
				<Property name="Ordinal" type="System.Int32" itemName="ordinal_position">
					<Concepts>
						<Concept name="Ordinal">
						</Concept>
					</Concepts>
				</Property>
        <Property name="DataType" type="System.String" itemName="data_type" />
        <Property name="SystemType" type="System.String" itemName="data_type">
          <Concepts>
            <Concept name="UserDataType"/>
            <Concept name="NativeDataType"/>
            <Concept name="ProviderDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="ProviderDbType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="FrameworkDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
          </Concepts>
        </Property>
        <Property name="Length" type="System.Int32" itemName='character_maximum_length'>
					<Concepts>
						<Concept name="Length"/>
					</Concepts>
				</Property>
				<Property name="Precision" type="System.Int32" itemName="numeric_precision">
					<Concepts>
						<Concept name="Precision">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Scale" type="System.Int32" itemName="numeric_scale">
					<Concepts>
						<Concept name="Scale"/>
					</Concepts>
				</Property>
				<Property name="Nullable" type="System.Boolean" itemName="is_nullable">
					<Concepts>
						<Concept name="Nullable">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Default" type="System.String" itemName="column_default">
					<Concepts>
						<Concept name="Default"/>
					</Concepts>
				</Property>
        <Property name="InPrimaryKey" type="System.Boolean" itemName="primary_key"/>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Columns"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="Table"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="101" type="System.Int32"/> <!-- Table -->
							</Parameter>
						</Parameter>
						<Parameter>
							<Parameter>
								<Parameter value="{3}"/>
								<Parameter/>
								<Parameter value="Field"/>
								<Parameter/>
								<Parameter>
									<!-- GUID_DSRefProperty_PreciseType -->
									<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
										<Parameter value="102" type="System.Int32"/> <!-- Table_Column -->
									</Parameter>
								</Parameter>
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<Type name="View" defaultSort="Database,Name">
			<Concepts>
				<Concept name="View" restrictions="{Catalog},null,{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="table_name"/>
				<Property name="Schema" type="System.String" itemName="table_schema">
					<Concepts>
						<Concept name="Schema"/>
					</Concepts>
				</Property>
				<Property name="CheckOption" type="System.Boolean" itemName="check_option"/>
				<Property name="IsUpdatable" type="System.Boolean" itemName="is_updatable"/>
			</Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Views"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="View"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="301" type="System.Int32"/> <!-- View -->
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<!--
			Defines a type that represents a view column.
		-->
		<Type name="ViewColumn" defaultSort="Database,View,Ordinal">
			<Concepts>
				<Concept name="ViewColumn" restrictions="{Catalog},null,{View},{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="View" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="column_name">
					<Concepts>
						<Concept name="Identifier3"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="column_name"/>
				<Property name="Ordinal" type="System.Int32" itemName="ordinal_position">
					<Concepts>
						<Concept name="Ordinal">
						</Concept>
					</Concepts>
				</Property>
        <Property name="DataType" type="System.String" itemName="data_type" />
        <Property name="SystemType" type="System.String" itemName="data_type">
          <Concepts>
            <Concept name="UserDataType"/>
            <Concept name="NativeDataType"/>
            <Concept name="ProviderDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="ProviderDbType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="FrameworkDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
          </Concepts>
        </Property>
        <Property name="Length" type="System.Int32" itemName='character_maximum_length'>
					<Concepts>
						<Concept name="Length"/>
					</Concepts>
				</Property>
				<Property name="Precision" type="System.Int32" itemName="numeric_precision">
					<Concepts>
						<Concept name="Precision">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Scale" type="System.Int32" itemName="numeric_scale">
					<Concepts>
						<Concept name="Scale"/>
					</Concepts>
				</Property>
				<Property name="Nullable" type="System.Boolean" itemName="is_nullable">
					<Concepts>
						<Concept name="Nullable">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Default" type="System.String" itemName="column_default">
					<Concepts>
						<Concept name="Default"/>
					</Concepts>
				</Property>
			</Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Columns"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="View"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="301" type="System.Int32"/> <!-- View -->
							</Parameter>
						</Parameter>
						<Parameter>
							<Parameter>
								<Parameter value="{3}"/>
								<Parameter/>
								<Parameter value="Field"/>
								<Parameter/>
								<Parameter>
									<!-- GUID_DSRefProperty_PreciseType -->
									<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
										<Parameter value="302" type="System.Int32"/> <!-- View_Column -->
									</Parameter>
								</Parameter>
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>
    <!--
			Defines a type that represents an index.
		-->
    <Type name="Index" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableUniqueKey" restrictions="{Catalog},null,{Table},{Name}" filter="IsUnique = true"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="index_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="index_name"/>
        <Property name="IsUnique" type="System.Boolean" itemName="UNIQUE">
          <Concepts>
            <Concept name="IsUnique"/>
          </Concepts>
        </Property>
        <Property name="IsPrimary" type="System.Boolean" itemName="PRIMARY_KEY">
          <Concepts>
            <Concept name="IsPrimary"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="Indexes"/>
        </Action>
        <Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
          <Parameter>
            <Parameter value="{2}"/>
            <Parameter value="{1}"/>
            <Parameter value="Table"/>
            <Parameter/>
            <Parameter>
              <!-- GUID_DSRefProperty_Qualifier -->
              <Parameter value="4656BAEA-F397-11ce-BFE1-00AA0057B34E">
                <Parameter value="{0}"/>
              </Parameter>
              <!-- GUID_DSRefProperty_PreciseType -->
              <Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
                <Parameter value="101" type="System.Int32"/>
                <!-- Table -->
              </Parameter>
            </Parameter>
            <Parameter>
              <Parameter>
                <Parameter value="{3}"/>
                <Parameter/>
                <Parameter value="Index"/>
              </Parameter>
            </Parameter>
          </Parameter>
        </Action>
      </Actions>
    </Type>

    <Type name="IndexColumn" defaultSort="Database,Table,Index,Ordinal">
      <Concepts>
        <Concept name="TableUniqueKeyColumn" restrictions="{Catalog},null,{Table},{TableUniqueKey},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Index" itemName="index_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="column_name">
          <Concepts>
            <Concept name="Identifier4"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="column_name"/>
        <Property name="Ordinal" type="System.Byte" itemName="ordinal_position">
          <Concepts>
            <Concept name="Ordinal">
              <Conversion>
                <ChangeType type="System.Int32"/>
              </Conversion>
            </Concept>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="IndexColumns"/>
        </Action>
        <Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
          <Parameter>
            <Parameter value="{2}"/>
            <Parameter value="{1}"/>
            <Parameter value="Table"/>
            <Parameter/>
            <Parameter>
              <!-- GUID_DSRefProperty_Qualifier -->
              <Parameter value="4656BAEA-F397-11ce-BFE1-00AA0057B34E">
                <Parameter value="{0}"/>
              </Parameter>
              <!-- GUID_DSRefProperty_PreciseType -->
              <Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
                <Parameter value="101" type="System.Int32"/>
                <!-- Table -->
              </Parameter>
            </Parameter>
            <Parameter>
              <Parameter>
                <Parameter value="{3}"/>
                <Parameter/>
                <Parameter value="Index"/>
                <Parameter/>
                <Parameter/>
                <Parameter>
                  <Parameter>
                    <Parameter value="{4}"/>
                    <Parameter/>
                    <Parameter value="Field"/>
                  </Parameter>
                </Parameter>
              </Parameter>
            </Parameter>
          </Parameter>
        </Action>
      </Actions>
    </Type>

    <Type name="Triggers" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableTriggers" restrictions="{Catalog},null,{Table},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="trigger_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="trigger_name"/>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="Triggers"/>
        </Action>
      </Actions>
    </Type>

    <Type name="ForeignKey" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableForeignKey" restrictions="{Catalog},null,{Table},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="constraint_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="constraint_name"/>
        <Property name="ReferencedColumnName" type="System.String" itemName="fkey_to_column"/>
        <Property name="ColumnName" type="System.String" itemName="fkey_from_column"/>
        <Property name="ReferencedTableDatabase" type="System.String" itemName="fkey_to_catalog">
          <Concepts>
            <Concept name="ReferencedTableId0"/>
          </Concepts>
        </Property>
        <Property name="ReferencedTableSchema" type="System.String" itemName="fkey_to_schema">
          <Concepts>
            <Concept name="ReferencedTableId1"/>
          </Concepts>
        </Property>
        <Property name="ReferencedTableName" type="System.String" itemName="fkey_to_table">
          <Concepts>
            <Concept name="ReferencedTableId2"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="ForeignKeys"/>
        </Action>
      </Actions>
    </Type>

    <Type name="ForeignKeyColumn" defaultSort="Database,Table,ForeignKey,Ordinal">
      <Concepts>
        <Concept name="TableForeignKeyColumn" restrictions="{Catalog},null,{Table},{TableForeignKey},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="ForeignKey" itemName="constraint_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="fkey_from_column">
          <Concepts>
            <Concept name="Identifier4"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="fkey_from_column"/>
        <Property name="Ordinal" type="System.Int32" itemName="fkey_from_ordinal_position">
          <Concepts>
            <Concept name="Ordinal"/>
          </Concepts>
        </Property>
        <Property name="ReferencedColumnName" type="System.String" itemName="fkey_to_column">
          <Concepts>
            <Concept name="ReferencedTableColumn"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="ForeignKeys"/>
        </Action>
      </Actions>
    </Type>
  </Types>
</VSDataObjectSupport>

Added SQLite.Designer/SQLiteDataObjectSupport2008.xml.









































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<VSDataObjectSupport xmlns="http://tempuri.org/VSDataObjectSupport.xsd">
	<Types>
		<RootType>
			<Properties>
        <Property name="Server" type="System.String" itemName="DataSource"/>
        <Property name="Database" type="System.String" itemName="Database"/>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetRootObjectEnumerator"/>
			</Actions>
		</RootType>

		<Type name="Table" defaultSort="Database,Name">
			<Concepts>
				<Concept name="Table" restrictions="{Catalog},null,{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="table_name"/>
				<Property name="Schema" type="System.String" itemName="table_schema"/>
        <Property name="Type" type="System.String" itemName="table_type">
          <Concepts>
            <Concept name="Type">
              <Conversion>
                <Calculate expr="IIF({0}='TABLE','USER','SYSTEM')" type="System.String"/>
              </Conversion>
            </Concept>
          </Concepts>
        </Property>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Tables"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="Table"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="101" type="System.Int32"/> <!-- Table -->
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<Type name="TableColumn" defaultSort="Database,Table,Ordinal">
			<Concepts>
				<Concept name="TableColumn" restrictions="{Catalog},null,{Table},{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Table" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="column_name">
					<Concepts>
						<Concept name="Identifier3"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="column_name"/>
				<Property name="Ordinal" type="System.Int32" itemName="ordinal_position">
					<Concepts>
						<Concept name="Ordinal">
						</Concept>
					</Concepts>
				</Property>
        <Property name="DataType" type="System.String" itemName="data_type" />
        <Property name="SystemType" type="System.String" itemName="data_type">
          <Concepts>
            <Concept name="UserDataType"/>
            <Concept name="NativeDataType"/>
            <Concept name="ProviderDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="ProviderDbType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="FrameworkDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
          </Concepts>
        </Property>
        <Property name="Length" type="System.Int32" itemName='character_maximum_length'>
					<Concepts>
						<Concept name="Length"/>
					</Concepts>
				</Property>
				<Property name="Precision" type="System.Int32" itemName="numeric_precision">
					<Concepts>
						<Concept name="Precision">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Scale" type="System.Int32" itemName="numeric_scale">
					<Concepts>
						<Concept name="Scale"/>
					</Concepts>
				</Property>
				<Property name="Nullable" type="System.Boolean" itemName="is_nullable">
					<Concepts>
						<Concept name="Nullable">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Default" type="System.String" itemName="column_default">
					<Concepts>
						<Concept name="Default"/>
					</Concepts>
				</Property>
        <Property name="InPrimaryKey" type="System.Boolean" itemName="primary_key"/>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Columns"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="Table"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="101" type="System.Int32"/> <!-- Table -->
							</Parameter>
						</Parameter>
						<Parameter>
							<Parameter>
								<Parameter value="{3}"/>
								<Parameter/>
								<Parameter value="Field"/>
								<Parameter/>
								<Parameter>
									<!-- GUID_DSRefProperty_PreciseType -->
									<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
										<Parameter value="102" type="System.Int32"/> <!-- Table_Column -->
									</Parameter>
								</Parameter>
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<Type name="View" defaultSort="Database,Name">
			<Concepts>
				<Concept name="View" restrictions="{Catalog},null,{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="table_name"/>
				<Property name="Schema" type="System.String" itemName="table_schema">
					<Concepts>
						<Concept name="Schema"/>
					</Concepts>
				</Property>
				<Property name="CheckOption" type="System.Boolean" itemName="check_option"/>
				<Property name="IsUpdatable" type="System.Boolean" itemName="is_updatable"/>
			</Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Views"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="View"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="301" type="System.Int32"/> <!-- View -->
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<!--
			Defines a type that represents a view column.
		-->
		<Type name="ViewColumn" defaultSort="Database,View,Ordinal">
			<Concepts>
				<Concept name="ViewColumn" restrictions="{Catalog},null,{View},{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="View" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="column_name">
					<Concepts>
						<Concept name="Identifier3"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="column_name"/>
				<Property name="Ordinal" type="System.Int32" itemName="ordinal_position">
					<Concepts>
						<Concept name="Ordinal">
						</Concept>
					</Concepts>
				</Property>
        <Property name="DataType" type="System.String" itemName="data_type" />
        <Property name="SystemType" type="System.String" itemName="data_type">
          <Concepts>
            <Concept name="UserDataType"/>
            <Concept name="NativeDataType"/>
            <Concept name="ProviderDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="ProviderDbType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="FrameworkDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
          </Concepts>
        </Property>
        <Property name="Length" type="System.Int32" itemName='character_maximum_length'>
					<Concepts>
						<Concept name="Length"/>
					</Concepts>
				</Property>
				<Property name="Precision" type="System.Int32" itemName="numeric_precision">
					<Concepts>
						<Concept name="Precision">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Scale" type="System.Int32" itemName="numeric_scale">
					<Concepts>
						<Concept name="Scale"/>
					</Concepts>
				</Property>
				<Property name="Nullable" type="System.Boolean" itemName="is_nullable">
					<Concepts>
						<Concept name="Nullable">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Default" type="System.String" itemName="column_default">
					<Concepts>
						<Concept name="Default"/>
					</Concepts>
				</Property>
			</Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Columns"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="View"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="301" type="System.Int32"/> <!-- View -->
							</Parameter>
						</Parameter>
						<Parameter>
							<Parameter>
								<Parameter value="{3}"/>
								<Parameter/>
								<Parameter value="Field"/>
								<Parameter/>
								<Parameter>
									<!-- GUID_DSRefProperty_PreciseType -->
									<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
										<Parameter value="302" type="System.Int32"/> <!-- View_Column -->
									</Parameter>
								</Parameter>
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>
    <!--
			Defines a type that represents an index.
		-->
    <Type name="Index" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableUniqueKey" restrictions="{Catalog},null,{Table},{Name}" filter="IsUnique = true"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="index_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="index_name"/>
        <Property name="IsUnique" type="System.Boolean" itemName="UNIQUE">
          <Concepts>
            <Concept name="IsUnique"/>
          </Concepts>
        </Property>
        <Property name="IsPrimary" type="System.Boolean" itemName="PRIMARY_KEY">
          <Concepts>
            <Concept name="IsPrimary"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="Indexes"/>
        </Action>
        <Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
          <Parameter>
            <Parameter value="{2}"/>
            <Parameter value="{1}"/>
            <Parameter value="Table"/>
            <Parameter/>
            <Parameter>
              <!-- GUID_DSRefProperty_Qualifier -->
              <Parameter value="4656BAEA-F397-11ce-BFE1-00AA0057B34E">
                <Parameter value="{0}"/>
              </Parameter>
              <!-- GUID_DSRefProperty_PreciseType -->
              <Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
                <Parameter value="101" type="System.Int32"/>
                <!-- Table -->
              </Parameter>
            </Parameter>
            <Parameter>
              <Parameter>
                <Parameter value="{3}"/>
                <Parameter/>
                <Parameter value="Index"/>
              </Parameter>
            </Parameter>
          </Parameter>
        </Action>
      </Actions>
    </Type>

    <Type name="IndexColumn" defaultSort="Database,Table,Index,Ordinal">
      <Concepts>
        <Concept name="TableUniqueKeyColumn" restrictions="{Catalog},null,{Table},{TableUniqueKey},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Index" itemName="index_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="column_name">
          <Concepts>
            <Concept name="Identifier4"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="column_name"/>
        <Property name="Ordinal" type="System.Byte" itemName="ordinal_position">
          <Concepts>
            <Concept name="Ordinal">
              <Conversion>
                <ChangeType type="System.Int32"/>
              </Conversion>
            </Concept>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="IndexColumns"/>
        </Action>
        <Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
          <Parameter>
            <Parameter value="{2}"/>
            <Parameter value="{1}"/>
            <Parameter value="Table"/>
            <Parameter/>
            <Parameter>
              <!-- GUID_DSRefProperty_Qualifier -->
              <Parameter value="4656BAEA-F397-11ce-BFE1-00AA0057B34E">
                <Parameter value="{0}"/>
              </Parameter>
              <!-- GUID_DSRefProperty_PreciseType -->
              <Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
                <Parameter value="101" type="System.Int32"/>
                <!-- Table -->
              </Parameter>
            </Parameter>
            <Parameter>
              <Parameter>
                <Parameter value="{3}"/>
                <Parameter/>
                <Parameter value="Index"/>
                <Parameter/>
                <Parameter/>
                <Parameter>
                  <Parameter>
                    <Parameter value="{4}"/>
                    <Parameter/>
                    <Parameter value="Field"/>
                  </Parameter>
                </Parameter>
              </Parameter>
            </Parameter>
          </Parameter>
        </Action>
      </Actions>
    </Type>

    <Type name="Triggers" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableTriggers" restrictions="{Catalog},null,{Table},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="trigger_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="trigger_name"/>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="Triggers"/>
        </Action>
      </Actions>
    </Type>

    <Type name="ForeignKey" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableForeignKey" restrictions="{Catalog},null,{Table},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="constraint_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="constraint_name"/>
        <Property name="ReferencedColumnName" type="System.String" itemName="fkey_to_column"/>
        <Property name="ColumnName" type="System.String" itemName="fkey_from_column"/>
        <Property name="ReferencedTableDatabase" type="System.String" itemName="fkey_to_catalog">
          <Concepts>
            <Concept name="ReferencedTableId0"/>
          </Concepts>
        </Property>
        <Property name="ReferencedTableSchema" type="System.String" itemName="fkey_to_schema">
          <Concepts>
            <Concept name="ReferencedTableId1"/>
          </Concepts>
        </Property>
        <Property name="ReferencedTableName" type="System.String" itemName="fkey_to_table">
          <Concepts>
            <Concept name="ReferencedTableId2"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="ForeignKeys"/>
        </Action>
      </Actions>
    </Type>

    <Type name="ForeignKeyColumn" defaultSort="Database,Table,ForeignKey,Ordinal">
      <Concepts>
        <Concept name="TableForeignKeyColumn" restrictions="{Catalog},null,{Table},{TableForeignKey},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="ForeignKey" itemName="constraint_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="fkey_from_column">
          <Concepts>
            <Concept name="Identifier4"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="fkey_from_column"/>
        <Property name="Ordinal" type="System.Int32" itemName="fkey_from_ordinal_position">
          <Concepts>
            <Concept name="Ordinal"/>
          </Concepts>
        </Property>
        <Property name="ReferencedColumnName" type="System.String" itemName="fkey_to_column">
          <Concepts>
            <Concept name="ReferencedTableColumn"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="ForeignKeys"/>
        </Action>
      </Actions>
    </Type>
  </Types>
</VSDataObjectSupport>

Added SQLite.Designer/SQLiteDataObjectSupport2010.xml.









































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<VSDataObjectSupport xmlns="http://tempuri.org/VSDataObjectSupport.xsd">
	<Types>
		<RootType>
			<Properties>
        <Property name="Server" type="System.String" itemName="DataSource"/>
        <Property name="Database" type="System.String" itemName="Database"/>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetRootObjectEnumerator"/>
			</Actions>
		</RootType>

		<Type name="Table" defaultSort="Database,Name">
			<Concepts>
				<Concept name="Table" restrictions="{Catalog},null,{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="table_name"/>
				<Property name="Schema" type="System.String" itemName="table_schema"/>
        <Property name="Type" type="System.String" itemName="table_type">
          <Concepts>
            <Concept name="Type">
              <Conversion>
                <Calculate expr="IIF({0}='TABLE','USER','SYSTEM')" type="System.String"/>
              </Conversion>
            </Concept>
          </Concepts>
        </Property>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Tables"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="Table"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="101" type="System.Int32"/> <!-- Table -->
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<Type name="TableColumn" defaultSort="Database,Table,Ordinal">
			<Concepts>
				<Concept name="TableColumn" restrictions="{Catalog},null,{Table},{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Table" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="column_name">
					<Concepts>
						<Concept name="Identifier3"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="column_name"/>
				<Property name="Ordinal" type="System.Int32" itemName="ordinal_position">
					<Concepts>
						<Concept name="Ordinal">
						</Concept>
					</Concepts>
				</Property>
        <Property name="DataType" type="System.String" itemName="data_type" />
        <Property name="SystemType" type="System.String" itemName="data_type">
          <Concepts>
            <Concept name="UserDataType"/>
            <Concept name="NativeDataType"/>
            <Concept name="ProviderDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="ProviderDbType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="FrameworkDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
          </Concepts>
        </Property>
        <Property name="Length" type="System.Int32" itemName='character_maximum_length'>
					<Concepts>
						<Concept name="Length"/>
					</Concepts>
				</Property>
				<Property name="Precision" type="System.Int32" itemName="numeric_precision">
					<Concepts>
						<Concept name="Precision">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Scale" type="System.Int32" itemName="numeric_scale">
					<Concepts>
						<Concept name="Scale"/>
					</Concepts>
				</Property>
				<Property name="Nullable" type="System.Boolean" itemName="is_nullable">
					<Concepts>
						<Concept name="Nullable">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Default" type="System.String" itemName="column_default">
					<Concepts>
						<Concept name="Default"/>
					</Concepts>
				</Property>
        <Property name="InPrimaryKey" type="System.Boolean" itemName="primary_key"/>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Columns"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="Table"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="101" type="System.Int32"/> <!-- Table -->
							</Parameter>
						</Parameter>
						<Parameter>
							<Parameter>
								<Parameter value="{3}"/>
								<Parameter/>
								<Parameter value="Field"/>
								<Parameter/>
								<Parameter>
									<!-- GUID_DSRefProperty_PreciseType -->
									<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
										<Parameter value="102" type="System.Int32"/> <!-- Table_Column -->
									</Parameter>
								</Parameter>
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<Type name="View" defaultSort="Database,Name">
			<Concepts>
				<Concept name="View" restrictions="{Catalog},null,{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="table_name"/>
				<Property name="Schema" type="System.String" itemName="table_schema">
					<Concepts>
						<Concept name="Schema"/>
					</Concepts>
				</Property>
				<Property name="CheckOption" type="System.Boolean" itemName="check_option"/>
				<Property name="IsUpdatable" type="System.Boolean" itemName="is_updatable"/>
			</Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Views"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="View"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="301" type="System.Int32"/> <!-- View -->
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<!--
			Defines a type that represents a view column.
		-->
		<Type name="ViewColumn" defaultSort="Database,View,Ordinal">
			<Concepts>
				<Concept name="ViewColumn" restrictions="{Catalog},null,{View},{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="View" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="column_name">
					<Concepts>
						<Concept name="Identifier3"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="column_name"/>
				<Property name="Ordinal" type="System.Int32" itemName="ordinal_position">
					<Concepts>
						<Concept name="Ordinal">
						</Concept>
					</Concepts>
				</Property>
        <Property name="DataType" type="System.String" itemName="data_type" />
        <Property name="SystemType" type="System.String" itemName="data_type">
          <Concepts>
            <Concept name="UserDataType"/>
            <Concept name="NativeDataType"/>
            <Concept name="ProviderDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="ProviderDbType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="FrameworkDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
          </Concepts>
        </Property>
        <Property name="Length" type="System.Int32" itemName='character_maximum_length'>
					<Concepts>
						<Concept name="Length"/>
					</Concepts>
				</Property>
				<Property name="Precision" type="System.Int32" itemName="numeric_precision">
					<Concepts>
						<Concept name="Precision">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Scale" type="System.Int32" itemName="numeric_scale">
					<Concepts>
						<Concept name="Scale"/>
					</Concepts>
				</Property>
				<Property name="Nullable" type="System.Boolean" itemName="is_nullable">
					<Concepts>
						<Concept name="Nullable">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Default" type="System.String" itemName="column_default">
					<Concepts>
						<Concept name="Default"/>
					</Concepts>
				</Property>
			</Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Columns"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="View"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="301" type="System.Int32"/> <!-- View -->
							</Parameter>
						</Parameter>
						<Parameter>
							<Parameter>
								<Parameter value="{3}"/>
								<Parameter/>
								<Parameter value="Field"/>
								<Parameter/>
								<Parameter>
									<!-- GUID_DSRefProperty_PreciseType -->
									<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
										<Parameter value="302" type="System.Int32"/> <!-- View_Column -->
									</Parameter>
								</Parameter>
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>
    <!--
			Defines a type that represents an index.
		-->
    <Type name="Index" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableUniqueKey" restrictions="{Catalog},null,{Table},{Name}" filter="IsUnique = true"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="index_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="index_name"/>
        <Property name="IsUnique" type="System.Boolean" itemName="UNIQUE">
          <Concepts>
            <Concept name="IsUnique"/>
          </Concepts>
        </Property>
        <Property name="IsPrimary" type="System.Boolean" itemName="PRIMARY_KEY">
          <Concepts>
            <Concept name="IsPrimary"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="Indexes"/>
        </Action>
        <Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
          <Parameter>
            <Parameter value="{2}"/>
            <Parameter value="{1}"/>
            <Parameter value="Table"/>
            <Parameter/>
            <Parameter>
              <!-- GUID_DSRefProperty_Qualifier -->
              <Parameter value="4656BAEA-F397-11ce-BFE1-00AA0057B34E">
                <Parameter value="{0}"/>
              </Parameter>
              <!-- GUID_DSRefProperty_PreciseType -->
              <Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
                <Parameter value="101" type="System.Int32"/>
                <!-- Table -->
              </Parameter>
            </Parameter>
            <Parameter>
              <Parameter>
                <Parameter value="{3}"/>
                <Parameter/>
                <Parameter value="Index"/>
              </Parameter>
            </Parameter>
          </Parameter>
        </Action>
      </Actions>
    </Type>

    <Type name="IndexColumn" defaultSort="Database,Table,Index,Ordinal">
      <Concepts>
        <Concept name="TableUniqueKeyColumn" restrictions="{Catalog},null,{Table},{TableUniqueKey},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Index" itemName="index_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="column_name">
          <Concepts>
            <Concept name="Identifier4"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="column_name"/>
        <Property name="Ordinal" type="System.Byte" itemName="ordinal_position">
          <Concepts>
            <Concept name="Ordinal">
              <Conversion>
                <ChangeType type="System.Int32"/>
              </Conversion>
            </Concept>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="IndexColumns"/>
        </Action>
        <Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
          <Parameter>
            <Parameter value="{2}"/>
            <Parameter value="{1}"/>
            <Parameter value="Table"/>
            <Parameter/>
            <Parameter>
              <!-- GUID_DSRefProperty_Qualifier -->
              <Parameter value="4656BAEA-F397-11ce-BFE1-00AA0057B34E">
                <Parameter value="{0}"/>
              </Parameter>
              <!-- GUID_DSRefProperty_PreciseType -->
              <Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
                <Parameter value="101" type="System.Int32"/>
                <!-- Table -->
              </Parameter>
            </Parameter>
            <Parameter>
              <Parameter>
                <Parameter value="{3}"/>
                <Parameter/>
                <Parameter value="Index"/>
                <Parameter/>
                <Parameter/>
                <Parameter>
                  <Parameter>
                    <Parameter value="{4}"/>
                    <Parameter/>
                    <Parameter value="Field"/>
                  </Parameter>
                </Parameter>
              </Parameter>
            </Parameter>
          </Parameter>
        </Action>
      </Actions>
    </Type>

    <Type name="Triggers" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableTriggers" restrictions="{Catalog},null,{Table},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="trigger_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="trigger_name"/>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="Triggers"/>
        </Action>
      </Actions>
    </Type>

    <Type name="ForeignKey" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableForeignKey" restrictions="{Catalog},null,{Table},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="constraint_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="constraint_name"/>
        <Property name="ReferencedColumnName" type="System.String" itemName="fkey_to_column"/>
        <Property name="ColumnName" type="System.String" itemName="fkey_from_column"/>
        <Property name="ReferencedTableDatabase" type="System.String" itemName="fkey_to_catalog">
          <Concepts>
            <Concept name="ReferencedTableId0"/>
          </Concepts>
        </Property>
        <Property name="ReferencedTableSchema" type="System.String" itemName="fkey_to_schema">
          <Concepts>
            <Concept name="ReferencedTableId1"/>
          </Concepts>
        </Property>
        <Property name="ReferencedTableName" type="System.String" itemName="fkey_to_table">
          <Concepts>
            <Concept name="ReferencedTableId2"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="ForeignKeys"/>
        </Action>
      </Actions>
    </Type>

    <Type name="ForeignKeyColumn" defaultSort="Database,Table,ForeignKey,Ordinal">
      <Concepts>
        <Concept name="TableForeignKeyColumn" restrictions="{Catalog},null,{Table},{TableForeignKey},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="ForeignKey" itemName="constraint_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="fkey_from_column">
          <Concepts>
            <Concept name="Identifier4"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="fkey_from_column"/>
        <Property name="Ordinal" type="System.Int32" itemName="fkey_from_ordinal_position">
          <Concepts>
            <Concept name="Ordinal"/>
          </Concepts>
        </Property>
        <Property name="ReferencedColumnName" type="System.String" itemName="fkey_to_column">
          <Concepts>
            <Concept name="ReferencedTableColumn"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="ForeignKeys"/>
        </Action>
      </Actions>
    </Type>
  </Types>
</VSDataObjectSupport>

Added SQLite.Designer/SQLiteDataObjectSupport2012.xml.









































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<VSDataObjectSupport xmlns="http://tempuri.org/VSDataObjectSupport.xsd">
	<Types>
		<RootType>
			<Properties>
        <Property name="Server" type="System.String" itemName="DataSource"/>
        <Property name="Database" type="System.String" itemName="Database"/>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetRootObjectEnumerator"/>
			</Actions>
		</RootType>

		<Type name="Table" defaultSort="Database,Name">
			<Concepts>
				<Concept name="Table" restrictions="{Catalog},null,{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="table_name"/>
				<Property name="Schema" type="System.String" itemName="table_schema"/>
        <Property name="Type" type="System.String" itemName="table_type">
          <Concepts>
            <Concept name="Type">
              <Conversion>
                <Calculate expr="IIF({0}='TABLE','USER','SYSTEM')" type="System.String"/>
              </Conversion>
            </Concept>
          </Concepts>
        </Property>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Tables"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="Table"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="101" type="System.Int32"/> <!-- Table -->
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<Type name="TableColumn" defaultSort="Database,Table,Ordinal">
			<Concepts>
				<Concept name="TableColumn" restrictions="{Catalog},null,{Table},{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Table" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="column_name">
					<Concepts>
						<Concept name="Identifier3"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="column_name"/>
				<Property name="Ordinal" type="System.Int32" itemName="ordinal_position">
					<Concepts>
						<Concept name="Ordinal">
						</Concept>
					</Concepts>
				</Property>
        <Property name="DataType" type="System.String" itemName="data_type" />
        <Property name="SystemType" type="System.String" itemName="data_type">
          <Concepts>
            <Concept name="UserDataType"/>
            <Concept name="NativeDataType"/>
            <Concept name="ProviderDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="ProviderDbType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="FrameworkDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
          </Concepts>
        </Property>
        <Property name="Length" type="System.Int32" itemName='character_maximum_length'>
					<Concepts>
						<Concept name="Length"/>
					</Concepts>
				</Property>
				<Property name="Precision" type="System.Int32" itemName="numeric_precision">
					<Concepts>
						<Concept name="Precision">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Scale" type="System.Int32" itemName="numeric_scale">
					<Concepts>
						<Concept name="Scale"/>
					</Concepts>
				</Property>
				<Property name="Nullable" type="System.Boolean" itemName="is_nullable">
					<Concepts>
						<Concept name="Nullable">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Default" type="System.String" itemName="column_default">
					<Concepts>
						<Concept name="Default"/>
					</Concepts>
				</Property>
        <Property name="InPrimaryKey" type="System.Boolean" itemName="primary_key"/>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Columns"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="Table"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="101" type="System.Int32"/> <!-- Table -->
							</Parameter>
						</Parameter>
						<Parameter>
							<Parameter>
								<Parameter value="{3}"/>
								<Parameter/>
								<Parameter value="Field"/>
								<Parameter/>
								<Parameter>
									<!-- GUID_DSRefProperty_PreciseType -->
									<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
										<Parameter value="102" type="System.Int32"/> <!-- Table_Column -->
									</Parameter>
								</Parameter>
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<Type name="View" defaultSort="Database,Name">
			<Concepts>
				<Concept name="View" restrictions="{Catalog},null,{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="table_name"/>
				<Property name="Schema" type="System.String" itemName="table_schema">
					<Concepts>
						<Concept name="Schema"/>
					</Concepts>
				</Property>
				<Property name="CheckOption" type="System.Boolean" itemName="check_option"/>
				<Property name="IsUpdatable" type="System.Boolean" itemName="is_updatable"/>
			</Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Views"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="View"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="301" type="System.Int32"/> <!-- View -->
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<!--
			Defines a type that represents a view column.
		-->
		<Type name="ViewColumn" defaultSort="Database,View,Ordinal">
			<Concepts>
				<Concept name="ViewColumn" restrictions="{Catalog},null,{View},{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="View" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="column_name">
					<Concepts>
						<Concept name="Identifier3"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="column_name"/>
				<Property name="Ordinal" type="System.Int32" itemName="ordinal_position">
					<Concepts>
						<Concept name="Ordinal">
						</Concept>
					</Concepts>
				</Property>
        <Property name="DataType" type="System.String" itemName="data_type" />
        <Property name="SystemType" type="System.String" itemName="data_type">
          <Concepts>
            <Concept name="UserDataType"/>
            <Concept name="NativeDataType"/>
            <Concept name="ProviderDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="ProviderDbType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="FrameworkDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
          </Concepts>
        </Property>
        <Property name="Length" type="System.Int32" itemName='character_maximum_length'>
					<Concepts>
						<Concept name="Length"/>
					</Concepts>
				</Property>
				<Property name="Precision" type="System.Int32" itemName="numeric_precision">
					<Concepts>
						<Concept name="Precision">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Scale" type="System.Int32" itemName="numeric_scale">
					<Concepts>
						<Concept name="Scale"/>
					</Concepts>
				</Property>
				<Property name="Nullable" type="System.Boolean" itemName="is_nullable">
					<Concepts>
						<Concept name="Nullable">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Default" type="System.String" itemName="column_default">
					<Concepts>
						<Concept name="Default"/>
					</Concepts>
				</Property>
			</Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Columns"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="View"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="301" type="System.Int32"/> <!-- View -->
							</Parameter>
						</Parameter>
						<Parameter>
							<Parameter>
								<Parameter value="{3}"/>
								<Parameter/>
								<Parameter value="Field"/>
								<Parameter/>
								<Parameter>
									<!-- GUID_DSRefProperty_PreciseType -->
									<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
										<Parameter value="302" type="System.Int32"/> <!-- View_Column -->
									</Parameter>
								</Parameter>
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>
    <!--
			Defines a type that represents an index.
		-->
    <Type name="Index" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableUniqueKey" restrictions="{Catalog},null,{Table},{Name}" filter="IsUnique = true"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="index_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="index_name"/>
        <Property name="IsUnique" type="System.Boolean" itemName="UNIQUE">
          <Concepts>
            <Concept name="IsUnique"/>
          </Concepts>
        </Property>
        <Property name="IsPrimary" type="System.Boolean" itemName="PRIMARY_KEY">
          <Concepts>
            <Concept name="IsPrimary"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="Indexes"/>
        </Action>
        <Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
          <Parameter>
            <Parameter value="{2}"/>
            <Parameter value="{1}"/>
            <Parameter value="Table"/>
            <Parameter/>
            <Parameter>
              <!-- GUID_DSRefProperty_Qualifier -->
              <Parameter value="4656BAEA-F397-11ce-BFE1-00AA0057B34E">
                <Parameter value="{0}"/>
              </Parameter>
              <!-- GUID_DSRefProperty_PreciseType -->
              <Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
                <Parameter value="101" type="System.Int32"/>
                <!-- Table -->
              </Parameter>
            </Parameter>
            <Parameter>
              <Parameter>
                <Parameter value="{3}"/>
                <Parameter/>
                <Parameter value="Index"/>
              </Parameter>
            </Parameter>
          </Parameter>
        </Action>
      </Actions>
    </Type>

    <Type name="IndexColumn" defaultSort="Database,Table,Index,Ordinal">
      <Concepts>
        <Concept name="TableUniqueKeyColumn" restrictions="{Catalog},null,{Table},{TableUniqueKey},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Index" itemName="index_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="column_name">
          <Concepts>
            <Concept name="Identifier4"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="column_name"/>
        <Property name="Ordinal" type="System.Byte" itemName="ordinal_position">
          <Concepts>
            <Concept name="Ordinal">
              <Conversion>
                <ChangeType type="System.Int32"/>
              </Conversion>
            </Concept>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="IndexColumns"/>
        </Action>
        <Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
          <Parameter>
            <Parameter value="{2}"/>
            <Parameter value="{1}"/>
            <Parameter value="Table"/>
            <Parameter/>
            <Parameter>
              <!-- GUID_DSRefProperty_Qualifier -->
              <Parameter value="4656BAEA-F397-11ce-BFE1-00AA0057B34E">
                <Parameter value="{0}"/>
              </Parameter>
              <!-- GUID_DSRefProperty_PreciseType -->
              <Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
                <Parameter value="101" type="System.Int32"/>
                <!-- Table -->
              </Parameter>
            </Parameter>
            <Parameter>
              <Parameter>
                <Parameter value="{3}"/>
                <Parameter/>
                <Parameter value="Index"/>
                <Parameter/>
                <Parameter/>
                <Parameter>
                  <Parameter>
                    <Parameter value="{4}"/>
                    <Parameter/>
                    <Parameter value="Field"/>
                  </Parameter>
                </Parameter>
              </Parameter>
            </Parameter>
          </Parameter>
        </Action>
      </Actions>
    </Type>

    <Type name="Triggers" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableTriggers" restrictions="{Catalog},null,{Table},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="trigger_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="trigger_name"/>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="Triggers"/>
        </Action>
      </Actions>
    </Type>

    <Type name="ForeignKey" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableForeignKey" restrictions="{Catalog},null,{Table},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="constraint_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="constraint_name"/>
        <Property name="ReferencedColumnName" type="System.String" itemName="fkey_to_column"/>
        <Property name="ColumnName" type="System.String" itemName="fkey_from_column"/>
        <Property name="ReferencedTableDatabase" type="System.String" itemName="fkey_to_catalog">
          <Concepts>
            <Concept name="ReferencedTableId0"/>
          </Concepts>
        </Property>
        <Property name="ReferencedTableSchema" type="System.String" itemName="fkey_to_schema">
          <Concepts>
            <Concept name="ReferencedTableId1"/>
          </Concepts>
        </Property>
        <Property name="ReferencedTableName" type="System.String" itemName="fkey_to_table">
          <Concepts>
            <Concept name="ReferencedTableId2"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="ForeignKeys"/>
        </Action>
      </Actions>
    </Type>

    <Type name="ForeignKeyColumn" defaultSort="Database,Table,ForeignKey,Ordinal">
      <Concepts>
        <Concept name="TableForeignKeyColumn" restrictions="{Catalog},null,{Table},{TableForeignKey},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="ForeignKey" itemName="constraint_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="fkey_from_column">
          <Concepts>
            <Concept name="Identifier4"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="fkey_from_column"/>
        <Property name="Ordinal" type="System.Int32" itemName="fkey_from_ordinal_position">
          <Concepts>
            <Concept name="Ordinal"/>
          </Concepts>
        </Property>
        <Property name="ReferencedColumnName" type="System.String" itemName="fkey_to_column">
          <Concepts>
            <Concept name="ReferencedTableColumn"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="ForeignKeys"/>
        </Action>
      </Actions>
    </Type>
  </Types>
</VSDataObjectSupport>

Added SQLite.Designer/SQLiteDataObjectSupport2013.xml.









































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<VSDataObjectSupport xmlns="http://tempuri.org/VSDataObjectSupport.xsd">
	<Types>
		<RootType>
			<Properties>
        <Property name="Server" type="System.String" itemName="DataSource"/>
        <Property name="Database" type="System.String" itemName="Database"/>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetRootObjectEnumerator"/>
			</Actions>
		</RootType>

		<Type name="Table" defaultSort="Database,Name">
			<Concepts>
				<Concept name="Table" restrictions="{Catalog},null,{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="table_name"/>
				<Property name="Schema" type="System.String" itemName="table_schema"/>
        <Property name="Type" type="System.String" itemName="table_type">
          <Concepts>
            <Concept name="Type">
              <Conversion>
                <Calculate expr="IIF({0}='TABLE','USER','SYSTEM')" type="System.String"/>
              </Conversion>
            </Concept>
          </Concepts>
        </Property>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Tables"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="Table"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="101" type="System.Int32"/> <!-- Table -->
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<Type name="TableColumn" defaultSort="Database,Table,Ordinal">
			<Concepts>
				<Concept name="TableColumn" restrictions="{Catalog},null,{Table},{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Table" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="column_name">
					<Concepts>
						<Concept name="Identifier3"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="column_name"/>
				<Property name="Ordinal" type="System.Int32" itemName="ordinal_position">
					<Concepts>
						<Concept name="Ordinal">
						</Concept>
					</Concepts>
				</Property>
        <Property name="DataType" type="System.String" itemName="data_type" />
        <Property name="SystemType" type="System.String" itemName="data_type">
          <Concepts>
            <Concept name="UserDataType"/>
            <Concept name="NativeDataType"/>
            <Concept name="ProviderDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="ProviderDbType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="FrameworkDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
          </Concepts>
        </Property>
        <Property name="Length" type="System.Int32" itemName='character_maximum_length'>
					<Concepts>
						<Concept name="Length"/>
					</Concepts>
				</Property>
				<Property name="Precision" type="System.Int32" itemName="numeric_precision">
					<Concepts>
						<Concept name="Precision">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Scale" type="System.Int32" itemName="numeric_scale">
					<Concepts>
						<Concept name="Scale"/>
					</Concepts>
				</Property>
				<Property name="Nullable" type="System.Boolean" itemName="is_nullable">
					<Concepts>
						<Concept name="Nullable">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Default" type="System.String" itemName="column_default">
					<Concepts>
						<Concept name="Default"/>
					</Concepts>
				</Property>
        <Property name="InPrimaryKey" type="System.Boolean" itemName="primary_key"/>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Columns"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="Table"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="101" type="System.Int32"/> <!-- Table -->
							</Parameter>
						</Parameter>
						<Parameter>
							<Parameter>
								<Parameter value="{3}"/>
								<Parameter/>
								<Parameter value="Field"/>
								<Parameter/>
								<Parameter>
									<!-- GUID_DSRefProperty_PreciseType -->
									<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
										<Parameter value="102" type="System.Int32"/> <!-- Table_Column -->
									</Parameter>
								</Parameter>
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<Type name="View" defaultSort="Database,Name">
			<Concepts>
				<Concept name="View" restrictions="{Catalog},null,{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="table_name"/>
				<Property name="Schema" type="System.String" itemName="table_schema">
					<Concepts>
						<Concept name="Schema"/>
					</Concepts>
				</Property>
				<Property name="CheckOption" type="System.Boolean" itemName="check_option"/>
				<Property name="IsUpdatable" type="System.Boolean" itemName="is_updatable"/>
			</Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Views"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="View"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="301" type="System.Int32"/> <!-- View -->
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<!--
			Defines a type that represents a view column.
		-->
		<Type name="ViewColumn" defaultSort="Database,View,Ordinal">
			<Concepts>
				<Concept name="ViewColumn" restrictions="{Catalog},null,{View},{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="View" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="column_name">
					<Concepts>
						<Concept name="Identifier3"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="column_name"/>
				<Property name="Ordinal" type="System.Int32" itemName="ordinal_position">
					<Concepts>
						<Concept name="Ordinal">
						</Concept>
					</Concepts>
				</Property>
        <Property name="DataType" type="System.String" itemName="data_type" />
        <Property name="SystemType" type="System.String" itemName="data_type">
          <Concepts>
            <Concept name="UserDataType"/>
            <Concept name="NativeDataType"/>
            <Concept name="ProviderDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="ProviderDbType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="FrameworkDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
          </Concepts>
        </Property>
        <Property name="Length" type="System.Int32" itemName='character_maximum_length'>
					<Concepts>
						<Concept name="Length"/>
					</Concepts>
				</Property>
				<Property name="Precision" type="System.Int32" itemName="numeric_precision">
					<Concepts>
						<Concept name="Precision">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Scale" type="System.Int32" itemName="numeric_scale">
					<Concepts>
						<Concept name="Scale"/>
					</Concepts>
				</Property>
				<Property name="Nullable" type="System.Boolean" itemName="is_nullable">
					<Concepts>
						<Concept name="Nullable">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Default" type="System.String" itemName="column_default">
					<Concepts>
						<Concept name="Default"/>
					</Concepts>
				</Property>
			</Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Columns"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="View"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="301" type="System.Int32"/> <!-- View -->
							</Parameter>
						</Parameter>
						<Parameter>
							<Parameter>
								<Parameter value="{3}"/>
								<Parameter/>
								<Parameter value="Field"/>
								<Parameter/>
								<Parameter>
									<!-- GUID_DSRefProperty_PreciseType -->
									<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
										<Parameter value="302" type="System.Int32"/> <!-- View_Column -->
									</Parameter>
								</Parameter>
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>
    <!--
			Defines a type that represents an index.
		-->
    <Type name="Index" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableUniqueKey" restrictions="{Catalog},null,{Table},{Name}" filter="IsUnique = true"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="index_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="index_name"/>
        <Property name="IsUnique" type="System.Boolean" itemName="UNIQUE">
          <Concepts>
            <Concept name="IsUnique"/>
          </Concepts>
        </Property>
        <Property name="IsPrimary" type="System.Boolean" itemName="PRIMARY_KEY">
          <Concepts>
            <Concept name="IsPrimary"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="Indexes"/>
        </Action>
        <Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
          <Parameter>
            <Parameter value="{2}"/>
            <Parameter value="{1}"/>
            <Parameter value="Table"/>
            <Parameter/>
            <Parameter>
              <!-- GUID_DSRefProperty_Qualifier -->
              <Parameter value="4656BAEA-F397-11ce-BFE1-00AA0057B34E">
                <Parameter value="{0}"/>
              </Parameter>
              <!-- GUID_DSRefProperty_PreciseType -->
              <Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
                <Parameter value="101" type="System.Int32"/>
                <!-- Table -->
              </Parameter>
            </Parameter>
            <Parameter>
              <Parameter>
                <Parameter value="{3}"/>
                <Parameter/>
                <Parameter value="Index"/>
              </Parameter>
            </Parameter>
          </Parameter>
        </Action>
      </Actions>
    </Type>

    <Type name="IndexColumn" defaultSort="Database,Table,Index,Ordinal">
      <Concepts>
        <Concept name="TableUniqueKeyColumn" restrictions="{Catalog},null,{Table},{TableUniqueKey},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Index" itemName="index_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="column_name">
          <Concepts>
            <Concept name="Identifier4"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="column_name"/>
        <Property name="Ordinal" type="System.Byte" itemName="ordinal_position">
          <Concepts>
            <Concept name="Ordinal">
              <Conversion>
                <ChangeType type="System.Int32"/>
              </Conversion>
            </Concept>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="IndexColumns"/>
        </Action>
        <Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
          <Parameter>
            <Parameter value="{2}"/>
            <Parameter value="{1}"/>
            <Parameter value="Table"/>
            <Parameter/>
            <Parameter>
              <!-- GUID_DSRefProperty_Qualifier -->
              <Parameter value="4656BAEA-F397-11ce-BFE1-00AA0057B34E">
                <Parameter value="{0}"/>
              </Parameter>
              <!-- GUID_DSRefProperty_PreciseType -->
              <Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
                <Parameter value="101" type="System.Int32"/>
                <!-- Table -->
              </Parameter>
            </Parameter>
            <Parameter>
              <Parameter>
                <Parameter value="{3}"/>
                <Parameter/>
                <Parameter value="Index"/>
                <Parameter/>
                <Parameter/>
                <Parameter>
                  <Parameter>
                    <Parameter value="{4}"/>
                    <Parameter/>
                    <Parameter value="Field"/>
                  </Parameter>
                </Parameter>
              </Parameter>
            </Parameter>
          </Parameter>
        </Action>
      </Actions>
    </Type>

    <Type name="Triggers" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableTriggers" restrictions="{Catalog},null,{Table},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="trigger_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="trigger_name"/>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="Triggers"/>
        </Action>
      </Actions>
    </Type>

    <Type name="ForeignKey" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableForeignKey" restrictions="{Catalog},null,{Table},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="constraint_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="constraint_name"/>
        <Property name="ReferencedColumnName" type="System.String" itemName="fkey_to_column"/>
        <Property name="ColumnName" type="System.String" itemName="fkey_from_column"/>
        <Property name="ReferencedTableDatabase" type="System.String" itemName="fkey_to_catalog">
          <Concepts>
            <Concept name="ReferencedTableId0"/>
          </Concepts>
        </Property>
        <Property name="ReferencedTableSchema" type="System.String" itemName="fkey_to_schema">
          <Concepts>
            <Concept name="ReferencedTableId1"/>
          </Concepts>
        </Property>
        <Property name="ReferencedTableName" type="System.String" itemName="fkey_to_table">
          <Concepts>
            <Concept name="ReferencedTableId2"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="ForeignKeys"/>
        </Action>
      </Actions>
    </Type>

    <Type name="ForeignKeyColumn" defaultSort="Database,Table,ForeignKey,Ordinal">
      <Concepts>
        <Concept name="TableForeignKeyColumn" restrictions="{Catalog},null,{Table},{TableForeignKey},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="ForeignKey" itemName="constraint_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="fkey_from_column">
          <Concepts>
            <Concept name="Identifier4"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="fkey_from_column"/>
        <Property name="Ordinal" type="System.Int32" itemName="fkey_from_ordinal_position">
          <Concepts>
            <Concept name="Ordinal"/>
          </Concepts>
        </Property>
        <Property name="ReferencedColumnName" type="System.String" itemName="fkey_to_column">
          <Concepts>
            <Concept name="ReferencedTableColumn"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="ForeignKeys"/>
        </Action>
      </Actions>
    </Type>
  </Types>
</VSDataObjectSupport>

Added SQLite.Designer/SQLiteDataObjectSupport2015.xml.









































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<VSDataObjectSupport xmlns="http://tempuri.org/VSDataObjectSupport.xsd">
	<Types>
		<RootType>
			<Properties>
        <Property name="Server" type="System.String" itemName="DataSource"/>
        <Property name="Database" type="System.String" itemName="Database"/>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetRootObjectEnumerator"/>
			</Actions>
		</RootType>

		<Type name="Table" defaultSort="Database,Name">
			<Concepts>
				<Concept name="Table" restrictions="{Catalog},null,{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="table_name"/>
				<Property name="Schema" type="System.String" itemName="table_schema"/>
        <Property name="Type" type="System.String" itemName="table_type">
          <Concepts>
            <Concept name="Type">
              <Conversion>
                <Calculate expr="IIF({0}='TABLE','USER','SYSTEM')" type="System.String"/>
              </Conversion>
            </Concept>
          </Concepts>
        </Property>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Tables"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="Table"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="101" type="System.Int32"/> <!-- Table -->
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<Type name="TableColumn" defaultSort="Database,Table,Ordinal">
			<Concepts>
				<Concept name="TableColumn" restrictions="{Catalog},null,{Table},{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Table" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="column_name">
					<Concepts>
						<Concept name="Identifier3"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="column_name"/>
				<Property name="Ordinal" type="System.Int32" itemName="ordinal_position">
					<Concepts>
						<Concept name="Ordinal">
						</Concept>
					</Concepts>
				</Property>
        <Property name="DataType" type="System.String" itemName="data_type" />
        <Property name="SystemType" type="System.String" itemName="data_type">
          <Concepts>
            <Concept name="UserDataType"/>
            <Concept name="NativeDataType"/>
            <Concept name="ProviderDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="ProviderDbType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="FrameworkDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
          </Concepts>
        </Property>
        <Property name="Length" type="System.Int32" itemName='character_maximum_length'>
					<Concepts>
						<Concept name="Length"/>
					</Concepts>
				</Property>
				<Property name="Precision" type="System.Int32" itemName="numeric_precision">
					<Concepts>
						<Concept name="Precision">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Scale" type="System.Int32" itemName="numeric_scale">
					<Concepts>
						<Concept name="Scale"/>
					</Concepts>
				</Property>
				<Property name="Nullable" type="System.Boolean" itemName="is_nullable">
					<Concepts>
						<Concept name="Nullable">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Default" type="System.String" itemName="column_default">
					<Concepts>
						<Concept name="Default"/>
					</Concepts>
				</Property>
        <Property name="InPrimaryKey" type="System.Boolean" itemName="primary_key"/>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Columns"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="Table"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="101" type="System.Int32"/> <!-- Table -->
							</Parameter>
						</Parameter>
						<Parameter>
							<Parameter>
								<Parameter value="{3}"/>
								<Parameter/>
								<Parameter value="Field"/>
								<Parameter/>
								<Parameter>
									<!-- GUID_DSRefProperty_PreciseType -->
									<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
										<Parameter value="102" type="System.Int32"/> <!-- Table_Column -->
									</Parameter>
								</Parameter>
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<Type name="View" defaultSort="Database,Name">
			<Concepts>
				<Concept name="View" restrictions="{Catalog},null,{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="table_name"/>
				<Property name="Schema" type="System.String" itemName="table_schema">
					<Concepts>
						<Concept name="Schema"/>
					</Concepts>
				</Property>
				<Property name="CheckOption" type="System.Boolean" itemName="check_option"/>
				<Property name="IsUpdatable" type="System.Boolean" itemName="is_updatable"/>
			</Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Views"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="View"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="301" type="System.Int32"/> <!-- View -->
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<!--
			Defines a type that represents a view column.
		-->
		<Type name="ViewColumn" defaultSort="Database,View,Ordinal">
			<Concepts>
				<Concept name="ViewColumn" restrictions="{Catalog},null,{View},{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="View" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="column_name">
					<Concepts>
						<Concept name="Identifier3"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="column_name"/>
				<Property name="Ordinal" type="System.Int32" itemName="ordinal_position">
					<Concepts>
						<Concept name="Ordinal">
						</Concept>
					</Concepts>
				</Property>
        <Property name="DataType" type="System.String" itemName="data_type" />
        <Property name="SystemType" type="System.String" itemName="data_type">
          <Concepts>
            <Concept name="UserDataType"/>
            <Concept name="NativeDataType"/>
            <Concept name="ProviderDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="ProviderDbType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="FrameworkDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
          </Concepts>
        </Property>
        <Property name="Length" type="System.Int32" itemName='character_maximum_length'>
					<Concepts>
						<Concept name="Length"/>
					</Concepts>
				</Property>
				<Property name="Precision" type="System.Int32" itemName="numeric_precision">
					<Concepts>
						<Concept name="Precision">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Scale" type="System.Int32" itemName="numeric_scale">
					<Concepts>
						<Concept name="Scale"/>
					</Concepts>
				</Property>
				<Property name="Nullable" type="System.Boolean" itemName="is_nullable">
					<Concepts>
						<Concept name="Nullable">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Default" type="System.String" itemName="column_default">
					<Concepts>
						<Concept name="Default"/>
					</Concepts>
				</Property>
			</Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Columns"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="View"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="301" type="System.Int32"/> <!-- View -->
							</Parameter>
						</Parameter>
						<Parameter>
							<Parameter>
								<Parameter value="{3}"/>
								<Parameter/>
								<Parameter value="Field"/>
								<Parameter/>
								<Parameter>
									<!-- GUID_DSRefProperty_PreciseType -->
									<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
										<Parameter value="302" type="System.Int32"/> <!-- View_Column -->
									</Parameter>
								</Parameter>
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>
    <!--
			Defines a type that represents an index.
		-->
    <Type name="Index" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableUniqueKey" restrictions="{Catalog},null,{Table},{Name}" filter="IsUnique = true"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="index_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="index_name"/>
        <Property name="IsUnique" type="System.Boolean" itemName="UNIQUE">
          <Concepts>
            <Concept name="IsUnique"/>
          </Concepts>
        </Property>
        <Property name="IsPrimary" type="System.Boolean" itemName="PRIMARY_KEY">
          <Concepts>
            <Concept name="IsPrimary"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="Indexes"/>
        </Action>
        <Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
          <Parameter>
            <Parameter value="{2}"/>
            <Parameter value="{1}"/>
            <Parameter value="Table"/>
            <Parameter/>
            <Parameter>
              <!-- GUID_DSRefProperty_Qualifier -->
              <Parameter value="4656BAEA-F397-11ce-BFE1-00AA0057B34E">
                <Parameter value="{0}"/>
              </Parameter>
              <!-- GUID_DSRefProperty_PreciseType -->
              <Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
                <Parameter value="101" type="System.Int32"/>
                <!-- Table -->
              </Parameter>
            </Parameter>
            <Parameter>
              <Parameter>
                <Parameter value="{3}"/>
                <Parameter/>
                <Parameter value="Index"/>
              </Parameter>
            </Parameter>
          </Parameter>
        </Action>
      </Actions>
    </Type>

    <Type name="IndexColumn" defaultSort="Database,Table,Index,Ordinal">
      <Concepts>
        <Concept name="TableUniqueKeyColumn" restrictions="{Catalog},null,{Table},{TableUniqueKey},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Index" itemName="index_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="column_name">
          <Concepts>
            <Concept name="Identifier4"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="column_name"/>
        <Property name="Ordinal" type="System.Byte" itemName="ordinal_position">
          <Concepts>
            <Concept name="Ordinal">
              <Conversion>
                <ChangeType type="System.Int32"/>
              </Conversion>
            </Concept>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="IndexColumns"/>
        </Action>
        <Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
          <Parameter>
            <Parameter value="{2}"/>
            <Parameter value="{1}"/>
            <Parameter value="Table"/>
            <Parameter/>
            <Parameter>
              <!-- GUID_DSRefProperty_Qualifier -->
              <Parameter value="4656BAEA-F397-11ce-BFE1-00AA0057B34E">
                <Parameter value="{0}"/>
              </Parameter>
              <!-- GUID_DSRefProperty_PreciseType -->
              <Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
                <Parameter value="101" type="System.Int32"/>
                <!-- Table -->
              </Parameter>
            </Parameter>
            <Parameter>
              <Parameter>
                <Parameter value="{3}"/>
                <Parameter/>
                <Parameter value="Index"/>
                <Parameter/>
                <Parameter/>
                <Parameter>
                  <Parameter>
                    <Parameter value="{4}"/>
                    <Parameter/>
                    <Parameter value="Field"/>
                  </Parameter>
                </Parameter>
              </Parameter>
            </Parameter>
          </Parameter>
        </Action>
      </Actions>
    </Type>

    <Type name="Triggers" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableTriggers" restrictions="{Catalog},null,{Table},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="trigger_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="trigger_name"/>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="Triggers"/>
        </Action>
      </Actions>
    </Type>

    <Type name="ForeignKey" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableForeignKey" restrictions="{Catalog},null,{Table},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="constraint_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="constraint_name"/>
        <Property name="ReferencedColumnName" type="System.String" itemName="fkey_to_column"/>
        <Property name="ColumnName" type="System.String" itemName="fkey_from_column"/>
        <Property name="ReferencedTableDatabase" type="System.String" itemName="fkey_to_catalog">
          <Concepts>
            <Concept name="ReferencedTableId0"/>
          </Concepts>
        </Property>
        <Property name="ReferencedTableSchema" type="System.String" itemName="fkey_to_schema">
          <Concepts>
            <Concept name="ReferencedTableId1"/>
          </Concepts>
        </Property>
        <Property name="ReferencedTableName" type="System.String" itemName="fkey_to_table">
          <Concepts>
            <Concept name="ReferencedTableId2"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="ForeignKeys"/>
        </Action>
      </Actions>
    </Type>

    <Type name="ForeignKeyColumn" defaultSort="Database,Table,ForeignKey,Ordinal">
      <Concepts>
        <Concept name="TableForeignKeyColumn" restrictions="{Catalog},null,{Table},{TableForeignKey},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="ForeignKey" itemName="constraint_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="fkey_from_column">
          <Concepts>
            <Concept name="Identifier4"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="fkey_from_column"/>
        <Property name="Ordinal" type="System.Int32" itemName="fkey_from_ordinal_position">
          <Concepts>
            <Concept name="Ordinal"/>
          </Concepts>
        </Property>
        <Property name="ReferencedColumnName" type="System.String" itemName="fkey_to_column">
          <Concepts>
            <Concept name="ReferencedTableColumn"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="ForeignKeys"/>
        </Action>
      </Actions>
    </Type>
  </Types>
</VSDataObjectSupport>

Added SQLite.Designer/SQLiteDataObjectSupport2017.xml.









































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<VSDataObjectSupport xmlns="http://tempuri.org/VSDataObjectSupport.xsd">
	<Types>
		<RootType>
			<Properties>
        <Property name="Server" type="System.String" itemName="DataSource"/>
        <Property name="Database" type="System.String" itemName="Database"/>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetRootObjectEnumerator"/>
			</Actions>
		</RootType>

		<Type name="Table" defaultSort="Database,Name">
			<Concepts>
				<Concept name="Table" restrictions="{Catalog},null,{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="table_name"/>
				<Property name="Schema" type="System.String" itemName="table_schema"/>
        <Property name="Type" type="System.String" itemName="table_type">
          <Concepts>
            <Concept name="Type">
              <Conversion>
                <Calculate expr="IIF({0}='TABLE','USER','SYSTEM')" type="System.String"/>
              </Conversion>
            </Concept>
          </Concepts>
        </Property>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Tables"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="Table"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="101" type="System.Int32"/> <!-- Table -->
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<Type name="TableColumn" defaultSort="Database,Table,Ordinal">
			<Concepts>
				<Concept name="TableColumn" restrictions="{Catalog},null,{Table},{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Table" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="column_name">
					<Concepts>
						<Concept name="Identifier3"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="column_name"/>
				<Property name="Ordinal" type="System.Int32" itemName="ordinal_position">
					<Concepts>
						<Concept name="Ordinal">
						</Concept>
					</Concepts>
				</Property>
        <Property name="DataType" type="System.String" itemName="data_type" />
        <Property name="SystemType" type="System.String" itemName="data_type">
          <Concepts>
            <Concept name="UserDataType"/>
            <Concept name="NativeDataType"/>
            <Concept name="ProviderDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="ProviderDbType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="FrameworkDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
          </Concepts>
        </Property>
        <Property name="Length" type="System.Int32" itemName='character_maximum_length'>
					<Concepts>
						<Concept name="Length"/>
					</Concepts>
				</Property>
				<Property name="Precision" type="System.Int32" itemName="numeric_precision">
					<Concepts>
						<Concept name="Precision">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Scale" type="System.Int32" itemName="numeric_scale">
					<Concepts>
						<Concept name="Scale"/>
					</Concepts>
				</Property>
				<Property name="Nullable" type="System.Boolean" itemName="is_nullable">
					<Concepts>
						<Concept name="Nullable">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Default" type="System.String" itemName="column_default">
					<Concepts>
						<Concept name="Default"/>
					</Concepts>
				</Property>
        <Property name="InPrimaryKey" type="System.Boolean" itemName="primary_key"/>
      </Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Columns"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="Table"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="101" type="System.Int32"/> <!-- Table -->
							</Parameter>
						</Parameter>
						<Parameter>
							<Parameter>
								<Parameter value="{3}"/>
								<Parameter/>
								<Parameter value="Field"/>
								<Parameter/>
								<Parameter>
									<!-- GUID_DSRefProperty_PreciseType -->
									<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
										<Parameter value="102" type="System.Int32"/> <!-- Table_Column -->
									</Parameter>
								</Parameter>
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<Type name="View" defaultSort="Database,Name">
			<Concepts>
				<Concept name="View" restrictions="{Catalog},null,{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="table_name"/>
				<Property name="Schema" type="System.String" itemName="table_schema">
					<Concepts>
						<Concept name="Schema"/>
					</Concepts>
				</Property>
				<Property name="CheckOption" type="System.Boolean" itemName="check_option"/>
				<Property name="IsUpdatable" type="System.Boolean" itemName="is_updatable"/>
			</Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Views"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="View"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="301" type="System.Int32"/> <!-- View -->
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>

		<!--
			Defines a type that represents a view column.
		-->
		<Type name="ViewColumn" defaultSort="Database,View,Ordinal">
			<Concepts>
				<Concept name="ViewColumn" restrictions="{Catalog},null,{View},{Name}"/>
			</Concepts>
			<Identifier>
				<Part name="Database" itemName="table_catalog">
					<Concepts>
						<Concept name="Identifier0"/>
					</Concepts>
				</Part>
				<Part name="Schema" itemName="table_schema">
					<Concepts>
						<Concept name="Identifier1"/>
					</Concepts>
				</Part>
				<Part name="View" itemName="table_name">
					<Concepts>
						<Concept name="Identifier2"/>
					</Concepts>
				</Part>
				<Part name="Name" itemName="column_name">
					<Concepts>
						<Concept name="Identifier3"/>
					</Concepts>
				</Part>
			</Identifier>
			<Properties>
				<Property name="Name" type="System.String" itemName="column_name"/>
				<Property name="Ordinal" type="System.Int32" itemName="ordinal_position">
					<Concepts>
						<Concept name="Ordinal">
						</Concept>
					</Concepts>
				</Property>
        <Property name="DataType" type="System.String" itemName="data_type" />
        <Property name="SystemType" type="System.String" itemName="data_type">
          <Concepts>
            <Concept name="UserDataType"/>
            <Concept name="NativeDataType"/>
            <Concept name="ProviderDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="ProviderDbType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
            <Concept name="FrameworkDataType">
              <Conversion mapper="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectConceptMapper"/>
            </Concept>
          </Concepts>
        </Property>
        <Property name="Length" type="System.Int32" itemName='character_maximum_length'>
					<Concepts>
						<Concept name="Length"/>
					</Concepts>
				</Property>
				<Property name="Precision" type="System.Int32" itemName="numeric_precision">
					<Concepts>
						<Concept name="Precision">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Scale" type="System.Int32" itemName="numeric_scale">
					<Concepts>
						<Concept name="Scale"/>
					</Concepts>
				</Property>
				<Property name="Nullable" type="System.Boolean" itemName="is_nullable">
					<Concepts>
						<Concept name="Nullable">
						</Concept>
					</Concepts>
				</Property>
				<Property name="Default" type="System.String" itemName="column_default">
					<Concepts>
						<Concept name="Default"/>
					</Concepts>
				</Property>
			</Properties>
			<Actions>
				<Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
					<Parameter value="Columns"/>
				</Action>
				<Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
					<Parameter>
						<Parameter value="{2}"/>
						<Parameter value="{1}"/>
						<Parameter value="View"/>
						<Parameter/>
						<Parameter>
							<!-- GUID_DSRefProperty_PreciseType -->
							<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
								<Parameter value="301" type="System.Int32"/> <!-- View -->
							</Parameter>
						</Parameter>
						<Parameter>
							<Parameter>
								<Parameter value="{3}"/>
								<Parameter/>
								<Parameter value="Field"/>
								<Parameter/>
								<Parameter>
									<!-- GUID_DSRefProperty_PreciseType -->
									<Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
										<Parameter value="302" type="System.Int32"/> <!-- View_Column -->
									</Parameter>
								</Parameter>
							</Parameter>
						</Parameter>
					</Parameter>
				</Action>
			</Actions>
		</Type>
    <!--
			Defines a type that represents an index.
		-->
    <Type name="Index" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableUniqueKey" restrictions="{Catalog},null,{Table},{Name}" filter="IsUnique = true"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="index_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="index_name"/>
        <Property name="IsUnique" type="System.Boolean" itemName="UNIQUE">
          <Concepts>
            <Concept name="IsUnique"/>
          </Concepts>
        </Property>
        <Property name="IsPrimary" type="System.Boolean" itemName="PRIMARY_KEY">
          <Concepts>
            <Concept name="IsPrimary"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="Indexes"/>
        </Action>
        <Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
          <Parameter>
            <Parameter value="{2}"/>
            <Parameter value="{1}"/>
            <Parameter value="Table"/>
            <Parameter/>
            <Parameter>
              <!-- GUID_DSRefProperty_Qualifier -->
              <Parameter value="4656BAEA-F397-11ce-BFE1-00AA0057B34E">
                <Parameter value="{0}"/>
              </Parameter>
              <!-- GUID_DSRefProperty_PreciseType -->
              <Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
                <Parameter value="101" type="System.Int32"/>
                <!-- Table -->
              </Parameter>
            </Parameter>
            <Parameter>
              <Parameter>
                <Parameter value="{3}"/>
                <Parameter/>
                <Parameter value="Index"/>
              </Parameter>
            </Parameter>
          </Parameter>
        </Action>
      </Actions>
    </Type>

    <Type name="IndexColumn" defaultSort="Database,Table,Index,Ordinal">
      <Concepts>
        <Concept name="TableUniqueKeyColumn" restrictions="{Catalog},null,{Table},{TableUniqueKey},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Index" itemName="index_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="column_name">
          <Concepts>
            <Concept name="Identifier4"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="column_name"/>
        <Property name="Ordinal" type="System.Byte" itemName="ordinal_position">
          <Concepts>
            <Concept name="Ordinal">
              <Conversion>
                <ChangeType type="System.Int32"/>
              </Conversion>
            </Concept>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="IndexColumns"/>
        </Action>
        <Action name="BuildDSRef" guid="7C030900-E8DD-471b-8F18-D83DA7036144" handler="Microsoft.VisualStudio.Data.DSRefBuilder">
          <Parameter>
            <Parameter value="{2}"/>
            <Parameter value="{1}"/>
            <Parameter value="Table"/>
            <Parameter/>
            <Parameter>
              <!-- GUID_DSRefProperty_Qualifier -->
              <Parameter value="4656BAEA-F397-11ce-BFE1-00AA0057B34E">
                <Parameter value="{0}"/>
              </Parameter>
              <!-- GUID_DSRefProperty_PreciseType -->
              <Parameter value="39A5A7E7-513F-44a4-B79D-7652CD8962D9">
                <Parameter value="101" type="System.Int32"/>
                <!-- Table -->
              </Parameter>
            </Parameter>
            <Parameter>
              <Parameter>
                <Parameter value="{3}"/>
                <Parameter/>
                <Parameter value="Index"/>
                <Parameter/>
                <Parameter/>
                <Parameter>
                  <Parameter>
                    <Parameter value="{4}"/>
                    <Parameter/>
                    <Parameter value="Field"/>
                  </Parameter>
                </Parameter>
              </Parameter>
            </Parameter>
          </Parameter>
        </Action>
      </Actions>
    </Type>

    <Type name="Triggers" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableTriggers" restrictions="{Catalog},null,{Table},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="trigger_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="trigger_name"/>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="Triggers"/>
        </Action>
      </Actions>
    </Type>

    <Type name="ForeignKey" defaultSort="Database,Table,Name">
      <Concepts>
        <Concept name="TableForeignKey" restrictions="{Catalog},null,{Table},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="constraint_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="constraint_name"/>
        <Property name="ReferencedColumnName" type="System.String" itemName="fkey_to_column"/>
        <Property name="ColumnName" type="System.String" itemName="fkey_from_column"/>
        <Property name="ReferencedTableDatabase" type="System.String" itemName="fkey_to_catalog">
          <Concepts>
            <Concept name="ReferencedTableId0"/>
          </Concepts>
        </Property>
        <Property name="ReferencedTableSchema" type="System.String" itemName="fkey_to_schema">
          <Concepts>
            <Concept name="ReferencedTableId1"/>
          </Concepts>
        </Property>
        <Property name="ReferencedTableName" type="System.String" itemName="fkey_to_table">
          <Concepts>
            <Concept name="ReferencedTableId2"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="ForeignKeys"/>
        </Action>
      </Actions>
    </Type>

    <Type name="ForeignKeyColumn" defaultSort="Database,Table,ForeignKey,Ordinal">
      <Concepts>
        <Concept name="TableForeignKeyColumn" restrictions="{Catalog},null,{Table},{TableForeignKey},{Name}"/>
      </Concepts>
      <Identifier>
        <Part name="Database" itemName="table_catalog">
          <Concepts>
            <Concept name="Identifier0"/>
          </Concepts>
        </Part>
        <Part name="Schema" itemName="table_schema">
          <Concepts>
            <Concept name="Identifier1"/>
          </Concepts>
        </Part>
        <Part name="Table" itemName="table_name">
          <Concepts>
            <Concept name="Identifier2"/>
          </Concepts>
        </Part>
        <Part name="ForeignKey" itemName="constraint_name">
          <Concepts>
            <Concept name="Identifier3"/>
          </Concepts>
        </Part>
        <Part name="Name" itemName="fkey_from_column">
          <Concepts>
            <Concept name="Identifier4"/>
          </Concepts>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Name" type="System.String" itemName="fkey_from_column"/>
        <Property name="Ordinal" type="System.Int32" itemName="fkey_from_ordinal_position">
          <Concepts>
            <Concept name="Ordinal"/>
          </Concepts>
        </Property>
        <Property name="ReferencedColumnName" type="System.String" itemName="fkey_to_column">
          <Concepts>
            <Concept name="ReferencedTableColumn"/>
          </Concepts>
        </Property>
      </Properties>
      <Actions>
        <Action name="Enumerate" guid="61CC0372-384D-42e5-9707-6D7C8DC5287A" handler="Microsoft.VisualStudio.Data.AdoDotNet.AdoDotNetObjectEnumerator">
          <Parameter value="ForeignKeys"/>
        </Action>
      </Actions>
    </Type>
  </Types>
</VSDataObjectSupport>

Changes to SQLite.Designer/SQLiteDataSourceInformation.cs.

32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
      AddProperty(IdentifierOpenQuote, "[");
      AddProperty(IdentifierCloseQuote, "]");
      AddProperty(CatalogSeparator, ".");
      AddProperty(CatalogSupported, true);
      AddProperty(CatalogSupportedInDml, true);
      AddProperty(SchemaSupported, false);
      AddProperty(SchemaSupportedInDml, false);
      AddProperty(SchemaSeparator, "");
      AddProperty(ParameterPrefix, "@");
      AddProperty(ParameterPrefixInName, true);
      AddProperty("DeskTopDataSource", true);
      AddProperty("LocalDatabase", true);
    }
  }
}







|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
      AddProperty(IdentifierOpenQuote, "[");
      AddProperty(IdentifierCloseQuote, "]");
      AddProperty(CatalogSeparator, ".");
      AddProperty(CatalogSupported, true);
      AddProperty(CatalogSupportedInDml, true);
      AddProperty(SchemaSupported, false);
      AddProperty(SchemaSupportedInDml, false);
      AddProperty(SchemaSeparator, String.Empty);
      AddProperty(ParameterPrefix, "@");
      AddProperty(ParameterPrefixInName, true);
      AddProperty("DeskTopDataSource", true);
      AddProperty("LocalDatabase", true);
    }
  }
}

Changes to SQLite.Designer/SQLiteDataViewSupport.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24


25
26
27
28
29
30

31
32
33
34
35
36
37








38
39
40
41
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer
{
  using System;
  using System.Collections.Generic;
  using System.Text;
  using System.Globalization;
  using Microsoft.VisualStudio.Data;
  using Microsoft.VisualStudio.OLE.Interop;
  using Microsoft.VisualStudio.Data.AdoDotNet;

  /// <summary>
  /// Provides DataViewSupport with a location where the XML file is for the Server Explorer's view.
  /// </summary>
  internal sealed class SQLiteDataViewSupport : DataViewSupport
  {
    public SQLiteDataViewSupport()
      : base(String.Format(CultureInfo.InvariantCulture, "SQLite.Designer.SQLiteDataViewSupport{0}", GetVSVersion()), typeof(SQLiteDataViewSupport).Assembly)


    {
    }

    private static string GetVSVersion()
    {
      switch (System.Diagnostics.FileVersionInfo.GetVersionInfo(Environment.GetCommandLineArgs()[0]).FileMajorPart)

      {
        case 8:
          return "2005";
        case 9:
          return "2008";
		case 10:
		  return "2010";








      }
    }
  }
}



|



















|
>
>





|
>





|
|
>
>
>
>
>
>
>
>




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer
{
  using System;
  using System.Collections.Generic;
  using System.Text;
  using System.Globalization;
  using Microsoft.VisualStudio.Data;
  using Microsoft.VisualStudio.OLE.Interop;
  using Microsoft.VisualStudio.Data.AdoDotNet;

  /// <summary>
  /// Provides DataViewSupport with a location where the XML file is for the Server Explorer's view.
  /// </summary>
  internal sealed class SQLiteDataViewSupport : DataViewSupport
  {
    public SQLiteDataViewSupport()
      : base(String.Format(CultureInfo.InvariantCulture,
          "SQLite.Designer.SQLiteDataViewSupport{0}", GetVSVersion()),
          typeof(SQLiteDataViewSupport).Assembly)
    {
    }

    private static string GetVSVersion()
    {
      switch (System.Diagnostics.FileVersionInfo.GetVersionInfo(
          Environment.GetCommandLineArgs()[0]).FileMajorPart)
      {
        case 8:
          return "2005";
        case 9:
          return "2008";
        case 10:
          return "2010";
        case 11:
          return "2012";
        case 12:
          return "2013";
        case 14:
          return "2015";
        default:
          return null;
      }
    }
  }
}

Changes to SQLite.Designer/SQLiteDataViewSupport2005.xml.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<VSDataViewSupport xmlns="http://tempuri.org/VSDataViewSupport.xsd">
	<DataViews>
		<!-- This sample defines a single data view -->
		<DataView name="SQLite">
      <DisplayName>SQLite</DisplayName>
			<!-- The connection node is static, i.e. has no underlying object -->
			<StaticConnectionNode>
				<!-- We can always specify data from the root object -->
				<InitialDisplayName>SQLite [{Root.Server}]</InitialDisplayName>
				<CommandBindings>
          <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13600" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
          <CommandBinding name="Vacuum"   guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="262" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="Rekey"    guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="263" handler="SQLite.Designer.SQLiteCommandHandler"/>
        </CommandBindings>
				<Children>
          
					<StaticNode nid="Tables">
            <DisplayName>Tables</DisplayName>
						<CommandBindings>
              <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13600" handler="SQLite.Designer.SQLiteCommandHandler"/>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
            </CommandBindings>
						<Children>






|




















|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<VSDataViewSupport xmlns="http://tempuri.org/VSDataViewSupport.xsd">
	<DataViews>
		<!-- This sample defines a single data view -->
		<DataView name="SQLite">
      <DisplayName>SQLite</DisplayName>
			<!-- The connection node is static, i.e. has no underlying object -->
			<StaticConnectionNode>
				<!-- We can always specify data from the root object -->
				<InitialDisplayName>SQLite [{Root.Server}]</InitialDisplayName>
				<CommandBindings>
          <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13600" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
          <CommandBinding name="Vacuum"   guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="262" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="Rekey"    guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="263" handler="SQLite.Designer.SQLiteCommandHandler"/>
        </CommandBindings>
				<Children>

					<StaticNode nid="Tables">
            <DisplayName>Tables</DisplayName>
						<CommandBindings>
              <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13600" handler="SQLite.Designer.SQLiteCommandHandler"/>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
            </CommandBindings>
						<Children>
75
76
77
78
79
80
81
82
83
84
85
86

87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
									<Children>
                    <SubHierarchyRef name="View children"/>
									</Children>
								</SelectionNode>
							</Selection>
						</Children>
					</StaticNode>
                  
        </Children>
			</StaticConnectionNode>
		</DataView>
	</DataViews>

  <SubHierarchies>
    <SubHierarchy name="table children">      
      <StaticNode nid="Columns">
        <DisplayName>Columns</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="TableColumn" restrictions="{Table.Database},null,{Table.Name}" filter="InPrimaryKey=True">
            <SelectionNode>
              <Icon name="PrimaryKey"/>
            </SelectionNode>
          </Selection>
          <Selection type="TableColumn" restrictions="{Table.Database},null,{Table.Name}" filter="InPrimaryKey=False">
            <SelectionNode>
              <Icon name="Column"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
      
      <StaticNode nid="Indexes">
        <DisplayName>Indexes</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="Index" restrictions="{Table.Database},null,{Table.Name}">







|
|



>

|


















|







75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
									<Children>
                    <SubHierarchyRef name="View children"/>
									</Children>
								</SelectionNode>
							</Selection>
						</Children>
					</StaticNode>

				</Children>
			</StaticConnectionNode>
		</DataView>
	</DataViews>

  <SubHierarchies>
    <SubHierarchy name="table children">
      <StaticNode nid="Columns">
        <DisplayName>Columns</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="TableColumn" restrictions="{Table.Database},null,{Table.Name}" filter="InPrimaryKey=True">
            <SelectionNode>
              <Icon name="PrimaryKey"/>
            </SelectionNode>
          </Selection>
          <Selection type="TableColumn" restrictions="{Table.Database},null,{Table.Name}" filter="InPrimaryKey=False">
            <SelectionNode>
              <Icon name="Column"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="Indexes">
        <DisplayName>Indexes</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="Index" restrictions="{Table.Database},null,{Table.Name}">
142
143
144
145
146
147
148

149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174

175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
            <SelectionNode>
              <Icon name="Index" />
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
    </SubHierarchy>

    <SubHierarchy name="view children">      
      <StaticNode nid="Columns">
        <DisplayName>Columns</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="ViewColumn" restrictions="{View.Database},null,{View.Name}">
            <SelectionNode>
              <Icon name="Column"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
      
      <StaticNode nid="Triggers">
        <DisplayName>Triggers</DisplayName>
        <Children>
          <Selection type="Triggers" restrictions="{View.Database},null,{View.Name}">
            <SelectionNode>
              <Icon name="Index" />
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
    </SubHierarchy>

  </SubHierarchies>
  <TypeExtensions>
    
    <TypeExtension name="Table">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropTable" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Table"/>
        </CommandBinding>
        <CommandBinding name="Browse_DataVS2005" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="Microsoft.VisualStudio.DataTools.DBPackage.VDT_OLEDB_CommandHandler_TableTools">
          <Parameter value="Open"/>
        </CommandBinding>
        <CommandBinding name="Design" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12291" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Table"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>
    
    <TypeExtension name="View">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>







>
|













|











>


|















|







|







143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
            <SelectionNode>
              <Icon name="Index" />
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
    </SubHierarchy>

    <SubHierarchy name="view children">
      <StaticNode nid="Columns">
        <DisplayName>Columns</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="ViewColumn" restrictions="{View.Database},null,{View.Name}">
            <SelectionNode>
              <Icon name="Column"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="Triggers">
        <DisplayName>Triggers</DisplayName>
        <Children>
          <Selection type="Triggers" restrictions="{View.Database},null,{View.Name}">
            <SelectionNode>
              <Icon name="Index" />
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
    </SubHierarchy>

  </SubHierarchies>
  <TypeExtensions>

    <TypeExtension name="Table">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropTable" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Table"/>
        </CommandBinding>
        <CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="884DD964-5327-461f-9F06-6484DD540F8F">
          <Parameter value="Open"/>
        </CommandBinding>
        <CommandBinding name="Design" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12291" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Table"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="View">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropView" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="View"/>
        </CommandBinding>
        <CommandBinding name="Design" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12291" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="View"/>
        </CommandBinding>
        <CommandBinding name="Browse_DataVS2005" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="Microsoft.VisualStudio.DataTools.DBPackage.VDT_OLEDB_CommandHandler_TableTools">
          <Parameter value="Open"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>
    
    <TypeExtension name="ViewColumn">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>







|




|







221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropView" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="View"/>
        </CommandBinding>
        <CommandBinding name="Design" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12291" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="View"/>
        </CommandBinding>
        <CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="884DD964-5327-461f-9F06-6484DD540F8F">
          <Parameter value="Open"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="ViewColumn">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
          <DisplayName>Default Value</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
      </CommandBindings>
    </TypeExtension>
    
    <TypeExtension name="Index">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>







|







257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
          <DisplayName>Default Value</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="Index">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>

Changes to SQLite.Designer/SQLiteDataViewSupport2008.xml.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<VSDataViewSupport xmlns="http://tempuri.org/VSDataViewSupport.xsd">
	<DataViews>
		<!-- This sample defines a single data view -->
		<DataView name="SQLite">
      <DisplayName>SQLite</DisplayName>
			<!-- The connection node is static, i.e. has no underlying object -->
			<StaticConnectionNode>
				<!-- We can always specify data from the root object -->
				<InitialDisplayName>SQLite [{Root.Server}]</InitialDisplayName>
				<CommandBindings>
          <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13600" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
          <CommandBinding name="Vacuum"   guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="262" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="Rekey"    guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="263" handler="SQLite.Designer.SQLiteCommandHandler"/>
        </CommandBindings>
				<Children>
          
					<StaticNode nid="Tables">
            <DisplayName>Tables</DisplayName>
						<CommandBindings>
              <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13600" handler="SQLite.Designer.SQLiteCommandHandler"/>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
            </CommandBindings>
						<Children>






|




















|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<VSDataViewSupport xmlns="http://tempuri.org/VSDataViewSupport.xsd">
	<DataViews>
		<!-- This sample defines a single data view -->
		<DataView name="SQLite">
      <DisplayName>SQLite</DisplayName>
			<!-- The connection node is static, i.e. has no underlying object -->
			<StaticConnectionNode>
				<!-- We can always specify data from the root object -->
				<InitialDisplayName>SQLite [{Root.Server}]</InitialDisplayName>
				<CommandBindings>
          <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13600" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
          <CommandBinding name="Vacuum"   guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="262" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="Rekey"    guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="263" handler="SQLite.Designer.SQLiteCommandHandler"/>
        </CommandBindings>
				<Children>

					<StaticNode nid="Tables">
            <DisplayName>Tables</DisplayName>
						<CommandBindings>
              <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13600" handler="SQLite.Designer.SQLiteCommandHandler"/>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
            </CommandBindings>
						<Children>
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
                  <Icon name="View"/>
									<Children>
                    <SubHierarchyRef name="View children"/>
									</Children>
								</SelectionNode>
							</Selection>
						</Children>
					</StaticNode>   
          
				</Children>
			</StaticConnectionNode>
		</DataView>
	</DataViews>
  
  <SubHierarchies>
    <SubHierarchy name="table children">      
      <StaticNode nid="Columns">
        <DisplayName>Columns</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="TableColumn" restrictions="{Table.Database},null,{Table.Name}" filter="InPrimaryKey=True">
            <SelectionNode>
              <Icon name="PrimaryKey"/>
            </SelectionNode>
          </Selection>
          <Selection type="TableColumn" restrictions="{Table.Database},null,{Table.Name}" filter="InPrimaryKey=False">
            <SelectionNode>
              <Icon name="Column"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
      
      <StaticNode nid="Indexes">
        <DisplayName>Indexes</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="Index" restrictions="{Table.Database},null,{Table.Name}">







|
|




|

|


















|







74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
                  <Icon name="View"/>
									<Children>
                    <SubHierarchyRef name="View children"/>
									</Children>
								</SelectionNode>
							</Selection>
						</Children>
					</StaticNode>

				</Children>
			</StaticConnectionNode>
		</DataView>
	</DataViews>

  <SubHierarchies>
    <SubHierarchy name="table children">
      <StaticNode nid="Columns">
        <DisplayName>Columns</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="TableColumn" restrictions="{Table.Database},null,{Table.Name}" filter="InPrimaryKey=True">
            <SelectionNode>
              <Icon name="PrimaryKey"/>
            </SelectionNode>
          </Selection>
          <Selection type="TableColumn" restrictions="{Table.Database},null,{Table.Name}" filter="InPrimaryKey=False">
            <SelectionNode>
              <Icon name="Column"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="Indexes">
        <DisplayName>Indexes</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="Index" restrictions="{Table.Database},null,{Table.Name}">
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
            <SelectionNode>
              <Icon name="Index" />
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
    </SubHierarchy>
    
    <SubHierarchy name="view children">      
      <StaticNode nid="Columns">
        <DisplayName>Columns</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="ViewColumn" restrictions="{View.Database},null,{View.Name}">
            <SelectionNode>
              <Icon name="Column"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
      
      <StaticNode nid="Triggers">
        <DisplayName>Triggers</DisplayName>
        <Children>
          <Selection type="Triggers" restrictions="{View.Database},null,{View.Name}">
            <SelectionNode>
              <Icon name="Index" />
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
    </SubHierarchy>
    
  </SubHierarchies>
  <TypeExtensions>
    
    <TypeExtension name="Table">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>







|
|













|











|


|







143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
            <SelectionNode>
              <Icon name="Index" />
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
    </SubHierarchy>

    <SubHierarchy name="view children">
      <StaticNode nid="Columns">
        <DisplayName>Columns</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="ViewColumn" restrictions="{View.Database},null,{View.Name}">
            <SelectionNode>
              <Icon name="Column"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="Triggers">
        <DisplayName>Triggers</DisplayName>
        <Children>
          <Selection type="Triggers" restrictions="{View.Database},null,{View.Name}">
            <SelectionNode>
              <Icon name="Index" />
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
    </SubHierarchy>

  </SubHierarchies>
  <TypeExtensions>

    <TypeExtension name="Table">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
          <Parameter value="Open"/>
        </CommandBinding>
        <CommandBinding name="Design" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12291" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Table"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>
    
    <TypeExtension name="View">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>







|







197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
          <Parameter value="Open"/>
        </CommandBinding>
        <CommandBinding name="Design" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12291" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Table"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="View">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
          <Parameter value="View"/>
        </CommandBinding>
        <CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="884DD964-5327-461f-9F06-6484DD540F8F">
          <Parameter value="Open"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>
    
    <TypeExtension name="ViewColumn">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>







|







226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
          <Parameter value="View"/>
        </CommandBinding>
        <CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="884DD964-5327-461f-9F06-6484DD540F8F">
          <Parameter value="Open"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="ViewColumn">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
          <DisplayName>Default Value</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
      </CommandBindings>
    </TypeExtension>
    
    <TypeExtension name="Index">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>







|







257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
          <DisplayName>Default Value</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="Index">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>

Added SQLite.Designer/SQLiteDataViewSupport2010.xml.





































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<VSDataViewSupport xmlns="http://tempuri.org/VSDataViewSupport.xsd">
	<DataViews>
		<!-- This sample defines a single data view -->
		<DataView name="SQLite">
      <DisplayName>SQLite</DisplayName>
			<!-- The connection node is static, i.e. has no underlying object -->
			<StaticConnectionNode>
				<!-- We can always specify data from the root object -->
				<InitialDisplayName>SQLite [{Root.Server}]</InitialDisplayName>
				<CommandBindings>
          <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13600" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
          <CommandBinding name="Vacuum"   guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="262" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="Rekey"    guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="263" handler="SQLite.Designer.SQLiteCommandHandler"/>
        </CommandBindings>
				<Children>

					<StaticNode nid="Tables">
            <DisplayName>Tables</DisplayName>
						<CommandBindings>
              <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13600" handler="SQLite.Designer.SQLiteCommandHandler"/>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
            </CommandBindings>
						<Children>
              <Selection type="Table" filter="TYPE='TABLE'">
                <SelectionNode nid="Table">
                  <Icon name="Table"/>
                  <Children>
                    <SubHierarchyRef name="Table children"/>
                  </Children>
                </SelectionNode>
              </Selection>
            </Children>
					</StaticNode>

          <StaticNode nid="Tables">
            <DisplayName>System Tables</DisplayName>
            <CommandBindings>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
            </CommandBindings>
            <Children>
              <Selection type="Table" filter="TYPE='SYSTEM_TABLE'">
                <SelectionNode nid="Table">
                  <Icon name="Table"/>
                  <Children>
                    <SubHierarchyRef name="Table children"/>
                  </Children>
                </SelectionNode>
              </Selection>
            </Children>
          </StaticNode>

          <StaticNode nid="Views">
            <DisplayName>Views</DisplayName>
						<CommandBindings>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
              <CommandBinding name="NewView" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13601" handler="SQLite.Designer.SQLiteCommandHandler" />
            </CommandBindings>
						<Children>
							<Selection type="View">
								<SelectionNode nid="View">
                  <DisplayName>{View.Name}</DisplayName>
                  <Icon name="View"/>
									<Children>
                    <SubHierarchyRef name="View children"/>
									</Children>
								</SelectionNode>
							</Selection>
						</Children>
					</StaticNode>

				</Children>
			</StaticConnectionNode>
		</DataView>
	</DataViews>

  <SubHierarchies>
    <SubHierarchy name="table children">
      <StaticNode nid="Columns">
        <DisplayName>Columns</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="TableColumn" restrictions="{Table.Database},null,{Table.Name}" filter="InPrimaryKey=True">
            <SelectionNode>
              <Icon name="PrimaryKey"/>
            </SelectionNode>
          </Selection>
          <Selection type="TableColumn" restrictions="{Table.Database},null,{Table.Name}" filter="InPrimaryKey=False">
            <SelectionNode>
              <Icon name="Column"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="Indexes">
        <DisplayName>Indexes</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="Index" restrictions="{Table.Database},null,{Table.Name}">
            <SelectionNode>
              <Icon when="{IsPrimary}=true" name="PrimaryKey"/>
              <Icon when="{IsUnique}=true" name="UniqueKey"/>
              <Icon name="Index"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="ForeignKeys">
        <DisplayName>Foreign Keys</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="ForeignKey" restrictions="{Table.Database},null,{Table.Name}">
            <SelectionNode>
              <Icon name="ForeignKey"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="Triggers">
        <DisplayName>Triggers</DisplayName>
        <Children>
          <Selection type="Triggers" restrictions="{Table.Database},null,{Table.Name}">
            <SelectionNode>
              <Icon name="Index" />
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
    </SubHierarchy>

    <SubHierarchy name="view children">
      <StaticNode nid="Columns">
        <DisplayName>Columns</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="ViewColumn" restrictions="{View.Database},null,{View.Name}">
            <SelectionNode>
              <Icon name="Column"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="Triggers">
        <DisplayName>Triggers</DisplayName>
        <Children>
          <Selection type="Triggers" restrictions="{View.Database},null,{View.Name}">
            <SelectionNode>
              <Icon name="Index" />
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
    </SubHierarchy>

  </SubHierarchies>
  <TypeExtensions>

    <TypeExtension name="Table">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropTable" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Table"/>
        </CommandBinding>
        <CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="884DD964-5327-461f-9F06-6484DD540F8F">
          <Parameter value="Open"/>
        </CommandBinding>
        <CommandBinding name="Design" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12291" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Table"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="View">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="IsUpdatable">
          <DisplayName>Updatable</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropView" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="View"/>
        </CommandBinding>
        <CommandBinding name="Design" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12291" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="View"/>
        </CommandBinding>
        <CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="884DD964-5327-461f-9F06-6484DD540F8F">
          <Parameter value="Open"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="ViewColumn">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="View">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Ordinal"/>
        <Property name="Length"/>
        <Property name="DataType">
          <DisplayName>Data Type</DisplayName>
        </Property>
        <Property name="Nullable">
          <DisplayName>Allow Nulls</DisplayName>
        </Property>
        <Property name="Default">
          <DisplayName>Default Value</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="Index">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="IsUnique">
          <DisplayName>Is Unique</DisplayName>
        </Property>
        <Property name="IsPrimary">
          <DisplayName>Primary Key</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropIndex" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Index"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="Triggers">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
    </TypeExtension>

    <TypeExtension name="TableColumn">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Ordinal"/>
        <Property name="Length"/>
        <Property name="DataType">
          <DisplayName>Data Type</DisplayName>
        </Property>
        <Property name="Nullable">
          <DisplayName>Allow Nulls</DisplayName>
        </Property>
        <Property name="Default">
          <DisplayName>Default Value</DisplayName>
        </Property>
        <Property name="InPrimaryKey">
          <DisplayName>Primary Key</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="ForeignKey">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <!--<Property name="ColumnName">
          <DisplayName>Source Column</DisplayName>
          <Category resource="Category_Source"/>
        </Property>-->
        <Property name="ReferencedTableDatabase">
          <DisplayName>Referenced Database</DisplayName>
          <Category resource="Category_Refs"/>
        </Property>
        <Property name="ReferencedTableName">
          <DisplayName>Referenced Table</DisplayName>
          <Category resource="Category_Refs"/>
        </Property>
        <!--<Property name="ReferencedColumnName">
          <DisplayName>Referenced Column</DisplayName>
          <Category resource="Category_Refs"/>
        </Property>-->
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
      </CommandBindings>
    </TypeExtension>
  </TypeExtensions>

  <Resources baseName="SQLite.Designer.VSPackage">
    <Resource name="Category_Identity">(Identity)</Resource>
    <Resource name="Category_Location">(Location)</Resource>
    <Resource name="Category_Source">(Source)</Resource>
    <Resource name="Category_Refs">References</Resource>
  </Resources>
</VSDataViewSupport>

Added SQLite.Designer/SQLiteDataViewSupport2012.xml.





































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<VSDataViewSupport xmlns="http://tempuri.org/VSDataViewSupport.xsd">
	<DataViews>
		<!-- This sample defines a single data view -->
		<DataView name="SQLite">
      <DisplayName>SQLite</DisplayName>
			<!-- The connection node is static, i.e. has no underlying object -->
			<StaticConnectionNode>
				<!-- We can always specify data from the root object -->
				<InitialDisplayName>SQLite [{Root.Server}]</InitialDisplayName>
				<CommandBindings>
          <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13600" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
          <CommandBinding name="Vacuum"   guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="262" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="Rekey"    guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="263" handler="SQLite.Designer.SQLiteCommandHandler"/>
        </CommandBindings>
				<Children>

					<StaticNode nid="Tables">
            <DisplayName>Tables</DisplayName>
						<CommandBindings>
              <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13600" handler="SQLite.Designer.SQLiteCommandHandler"/>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
            </CommandBindings>
						<Children>
              <Selection type="Table" filter="TYPE='TABLE'">
                <SelectionNode nid="Table">
                  <Icon name="Table"/>
                  <Children>
                    <SubHierarchyRef name="Table children"/>
                  </Children>
                </SelectionNode>
              </Selection>
            </Children>
					</StaticNode>

          <StaticNode nid="Tables">
            <DisplayName>System Tables</DisplayName>
            <CommandBindings>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
            </CommandBindings>
            <Children>
              <Selection type="Table" filter="TYPE='SYSTEM_TABLE'">
                <SelectionNode nid="Table">
                  <Icon name="Table"/>
                  <Children>
                    <SubHierarchyRef name="Table children"/>
                  </Children>
                </SelectionNode>
              </Selection>
            </Children>
          </StaticNode>

          <StaticNode nid="Views">
            <DisplayName>Views</DisplayName>
						<CommandBindings>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
              <CommandBinding name="NewView" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13601" handler="SQLite.Designer.SQLiteCommandHandler" />
            </CommandBindings>
						<Children>
							<Selection type="View">
								<SelectionNode nid="View">
                  <DisplayName>{View.Name}</DisplayName>
                  <Icon name="View"/>
									<Children>
                    <SubHierarchyRef name="View children"/>
									</Children>
								</SelectionNode>
							</Selection>
						</Children>
					</StaticNode>

				</Children>
			</StaticConnectionNode>
		</DataView>
	</DataViews>

  <SubHierarchies>
    <SubHierarchy name="table children">
      <StaticNode nid="Columns">
        <DisplayName>Columns</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="TableColumn" restrictions="{Table.Database},null,{Table.Name}" filter="InPrimaryKey=True">
            <SelectionNode>
              <Icon name="PrimaryKey"/>
            </SelectionNode>
          </Selection>
          <Selection type="TableColumn" restrictions="{Table.Database},null,{Table.Name}" filter="InPrimaryKey=False">
            <SelectionNode>
              <Icon name="Column"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="Indexes">
        <DisplayName>Indexes</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="Index" restrictions="{Table.Database},null,{Table.Name}">
            <SelectionNode>
              <Icon when="{IsPrimary}=true" name="PrimaryKey"/>
              <Icon when="{IsUnique}=true" name="UniqueKey"/>
              <Icon name="Index"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="ForeignKeys">
        <DisplayName>Foreign Keys</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="ForeignKey" restrictions="{Table.Database},null,{Table.Name}">
            <SelectionNode>
              <Icon name="ForeignKey"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="Triggers">
        <DisplayName>Triggers</DisplayName>
        <Children>
          <Selection type="Triggers" restrictions="{Table.Database},null,{Table.Name}">
            <SelectionNode>
              <Icon name="Index" />
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
    </SubHierarchy>

    <SubHierarchy name="view children">
      <StaticNode nid="Columns">
        <DisplayName>Columns</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="ViewColumn" restrictions="{View.Database},null,{View.Name}">
            <SelectionNode>
              <Icon name="Column"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="Triggers">
        <DisplayName>Triggers</DisplayName>
        <Children>
          <Selection type="Triggers" restrictions="{View.Database},null,{View.Name}">
            <SelectionNode>
              <Icon name="Index" />
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
    </SubHierarchy>

  </SubHierarchies>
  <TypeExtensions>

    <TypeExtension name="Table">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropTable" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Table"/>
        </CommandBinding>
        <CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="884DD964-5327-461f-9F06-6484DD540F8F">
          <Parameter value="Open"/>
        </CommandBinding>
        <CommandBinding name="Design" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12291" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Table"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="View">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="IsUpdatable">
          <DisplayName>Updatable</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropView" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="View"/>
        </CommandBinding>
        <CommandBinding name="Design" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12291" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="View"/>
        </CommandBinding>
        <CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="884DD964-5327-461f-9F06-6484DD540F8F">
          <Parameter value="Open"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="ViewColumn">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="View">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Ordinal"/>
        <Property name="Length"/>
        <Property name="DataType">
          <DisplayName>Data Type</DisplayName>
        </Property>
        <Property name="Nullable">
          <DisplayName>Allow Nulls</DisplayName>
        </Property>
        <Property name="Default">
          <DisplayName>Default Value</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="Index">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="IsUnique">
          <DisplayName>Is Unique</DisplayName>
        </Property>
        <Property name="IsPrimary">
          <DisplayName>Primary Key</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropIndex" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Index"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="Triggers">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
    </TypeExtension>

    <TypeExtension name="TableColumn">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Ordinal"/>
        <Property name="Length"/>
        <Property name="DataType">
          <DisplayName>Data Type</DisplayName>
        </Property>
        <Property name="Nullable">
          <DisplayName>Allow Nulls</DisplayName>
        </Property>
        <Property name="Default">
          <DisplayName>Default Value</DisplayName>
        </Property>
        <Property name="InPrimaryKey">
          <DisplayName>Primary Key</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="ForeignKey">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <!--<Property name="ColumnName">
          <DisplayName>Source Column</DisplayName>
          <Category resource="Category_Source"/>
        </Property>-->
        <Property name="ReferencedTableDatabase">
          <DisplayName>Referenced Database</DisplayName>
          <Category resource="Category_Refs"/>
        </Property>
        <Property name="ReferencedTableName">
          <DisplayName>Referenced Table</DisplayName>
          <Category resource="Category_Refs"/>
        </Property>
        <!--<Property name="ReferencedColumnName">
          <DisplayName>Referenced Column</DisplayName>
          <Category resource="Category_Refs"/>
        </Property>-->
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
      </CommandBindings>
    </TypeExtension>
  </TypeExtensions>

  <Resources baseName="SQLite.Designer.VSPackage">
    <Resource name="Category_Identity">(Identity)</Resource>
    <Resource name="Category_Location">(Location)</Resource>
    <Resource name="Category_Source">(Source)</Resource>
    <Resource name="Category_Refs">References</Resource>
  </Resources>
</VSDataViewSupport>

Added SQLite.Designer/SQLiteDataViewSupport2013.xml.





































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<VSDataViewSupport xmlns="http://tempuri.org/VSDataViewSupport.xsd">
	<DataViews>
		<!-- This sample defines a single data view -->
		<DataView name="SQLite">
      <DisplayName>SQLite</DisplayName>
			<!-- The connection node is static, i.e. has no underlying object -->
			<StaticConnectionNode>
				<!-- We can always specify data from the root object -->
				<InitialDisplayName>SQLite [{Root.Server}]</InitialDisplayName>
				<CommandBindings>
          <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13600" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
          <CommandBinding name="Vacuum"   guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="262" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="Rekey"    guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="263" handler="SQLite.Designer.SQLiteCommandHandler"/>
        </CommandBindings>
				<Children>

					<StaticNode nid="Tables">
            <DisplayName>Tables</DisplayName>
						<CommandBindings>
              <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13600" handler="SQLite.Designer.SQLiteCommandHandler"/>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
            </CommandBindings>
						<Children>
              <Selection type="Table" filter="TYPE='TABLE'">
                <SelectionNode nid="Table">
                  <Icon name="Table"/>
                  <Children>
                    <SubHierarchyRef name="Table children"/>
                  </Children>
                </SelectionNode>
              </Selection>
            </Children>
					</StaticNode>

          <StaticNode nid="Tables">
            <DisplayName>System Tables</DisplayName>
            <CommandBindings>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
            </CommandBindings>
            <Children>
              <Selection type="Table" filter="TYPE='SYSTEM_TABLE'">
                <SelectionNode nid="Table">
                  <Icon name="Table"/>
                  <Children>
                    <SubHierarchyRef name="Table children"/>
                  </Children>
                </SelectionNode>
              </Selection>
            </Children>
          </StaticNode>

          <StaticNode nid="Views">
            <DisplayName>Views</DisplayName>
						<CommandBindings>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
              <CommandBinding name="NewView" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13601" handler="SQLite.Designer.SQLiteCommandHandler" />
            </CommandBindings>
						<Children>
							<Selection type="View">
								<SelectionNode nid="View">
                  <DisplayName>{View.Name}</DisplayName>
                  <Icon name="View"/>
									<Children>
                    <SubHierarchyRef name="View children"/>
									</Children>
								</SelectionNode>
							</Selection>
						</Children>
					</StaticNode>

				</Children>
			</StaticConnectionNode>
		</DataView>
	</DataViews>

  <SubHierarchies>
    <SubHierarchy name="table children">
      <StaticNode nid="Columns">
        <DisplayName>Columns</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="TableColumn" restrictions="{Table.Database},null,{Table.Name}" filter="InPrimaryKey=True">
            <SelectionNode>
              <Icon name="PrimaryKey"/>
            </SelectionNode>
          </Selection>
          <Selection type="TableColumn" restrictions="{Table.Database},null,{Table.Name}" filter="InPrimaryKey=False">
            <SelectionNode>
              <Icon name="Column"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="Indexes">
        <DisplayName>Indexes</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="Index" restrictions="{Table.Database},null,{Table.Name}">
            <SelectionNode>
              <Icon when="{IsPrimary}=true" name="PrimaryKey"/>
              <Icon when="{IsUnique}=true" name="UniqueKey"/>
              <Icon name="Index"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="ForeignKeys">
        <DisplayName>Foreign Keys</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="ForeignKey" restrictions="{Table.Database},null,{Table.Name}">
            <SelectionNode>
              <Icon name="ForeignKey"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="Triggers">
        <DisplayName>Triggers</DisplayName>
        <Children>
          <Selection type="Triggers" restrictions="{Table.Database},null,{Table.Name}">
            <SelectionNode>
              <Icon name="Index" />
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
    </SubHierarchy>

    <SubHierarchy name="view children">
      <StaticNode nid="Columns">
        <DisplayName>Columns</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="ViewColumn" restrictions="{View.Database},null,{View.Name}">
            <SelectionNode>
              <Icon name="Column"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="Triggers">
        <DisplayName>Triggers</DisplayName>
        <Children>
          <Selection type="Triggers" restrictions="{View.Database},null,{View.Name}">
            <SelectionNode>
              <Icon name="Index" />
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
    </SubHierarchy>

  </SubHierarchies>
  <TypeExtensions>

    <TypeExtension name="Table">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropTable" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Table"/>
        </CommandBinding>
        <CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="884DD964-5327-461f-9F06-6484DD540F8F">
          <Parameter value="Open"/>
        </CommandBinding>
        <CommandBinding name="Design" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12291" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Table"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="View">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="IsUpdatable">
          <DisplayName>Updatable</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropView" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="View"/>
        </CommandBinding>
        <CommandBinding name="Design" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12291" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="View"/>
        </CommandBinding>
        <CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="884DD964-5327-461f-9F06-6484DD540F8F">
          <Parameter value="Open"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="ViewColumn">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="View">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Ordinal"/>
        <Property name="Length"/>
        <Property name="DataType">
          <DisplayName>Data Type</DisplayName>
        </Property>
        <Property name="Nullable">
          <DisplayName>Allow Nulls</DisplayName>
        </Property>
        <Property name="Default">
          <DisplayName>Default Value</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="Index">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="IsUnique">
          <DisplayName>Is Unique</DisplayName>
        </Property>
        <Property name="IsPrimary">
          <DisplayName>Primary Key</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropIndex" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Index"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="Triggers">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
    </TypeExtension>

    <TypeExtension name="TableColumn">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Ordinal"/>
        <Property name="Length"/>
        <Property name="DataType">
          <DisplayName>Data Type</DisplayName>
        </Property>
        <Property name="Nullable">
          <DisplayName>Allow Nulls</DisplayName>
        </Property>
        <Property name="Default">
          <DisplayName>Default Value</DisplayName>
        </Property>
        <Property name="InPrimaryKey">
          <DisplayName>Primary Key</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="ForeignKey">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <!--<Property name="ColumnName">
          <DisplayName>Source Column</DisplayName>
          <Category resource="Category_Source"/>
        </Property>-->
        <Property name="ReferencedTableDatabase">
          <DisplayName>Referenced Database</DisplayName>
          <Category resource="Category_Refs"/>
        </Property>
        <Property name="ReferencedTableName">
          <DisplayName>Referenced Table</DisplayName>
          <Category resource="Category_Refs"/>
        </Property>
        <!--<Property name="ReferencedColumnName">
          <DisplayName>Referenced Column</DisplayName>
          <Category resource="Category_Refs"/>
        </Property>-->
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
      </CommandBindings>
    </TypeExtension>
  </TypeExtensions>

  <Resources baseName="SQLite.Designer.VSPackage">
    <Resource name="Category_Identity">(Identity)</Resource>
    <Resource name="Category_Location">(Location)</Resource>
    <Resource name="Category_Source">(Source)</Resource>
    <Resource name="Category_Refs">References</Resource>
  </Resources>
</VSDataViewSupport>

Added SQLite.Designer/SQLiteDataViewSupport2015.xml.





































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<VSDataViewSupport xmlns="http://tempuri.org/VSDataViewSupport.xsd">
	<DataViews>
		<!-- This sample defines a single data view -->
		<DataView name="SQLite">
      <DisplayName>SQLite</DisplayName>
			<!-- The connection node is static, i.e. has no underlying object -->
			<StaticConnectionNode>
				<!-- We can always specify data from the root object -->
				<InitialDisplayName>SQLite [{Root.Server}]</InitialDisplayName>
				<CommandBindings>
          <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13600" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
          <CommandBinding name="Vacuum"   guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="262" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="Rekey"    guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="263" handler="SQLite.Designer.SQLiteCommandHandler"/>
        </CommandBindings>
				<Children>

					<StaticNode nid="Tables">
            <DisplayName>Tables</DisplayName>
						<CommandBindings>
              <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13600" handler="SQLite.Designer.SQLiteCommandHandler"/>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
            </CommandBindings>
						<Children>
              <Selection type="Table" filter="TYPE='TABLE'">
                <SelectionNode nid="Table">
                  <Icon name="Table"/>
                  <Children>
                    <SubHierarchyRef name="Table children"/>
                  </Children>
                </SelectionNode>
              </Selection>
            </Children>
					</StaticNode>

          <StaticNode nid="Tables">
            <DisplayName>System Tables</DisplayName>
            <CommandBindings>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
            </CommandBindings>
            <Children>
              <Selection type="Table" filter="TYPE='SYSTEM_TABLE'">
                <SelectionNode nid="Table">
                  <Icon name="Table"/>
                  <Children>
                    <SubHierarchyRef name="Table children"/>
                  </Children>
                </SelectionNode>
              </Selection>
            </Children>
          </StaticNode>

          <StaticNode nid="Views">
            <DisplayName>Views</DisplayName>
						<CommandBindings>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
              <CommandBinding name="NewView" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13601" handler="SQLite.Designer.SQLiteCommandHandler" />
            </CommandBindings>
						<Children>
							<Selection type="View">
								<SelectionNode nid="View">
                  <DisplayName>{View.Name}</DisplayName>
                  <Icon name="View"/>
									<Children>
                    <SubHierarchyRef name="View children"/>
									</Children>
								</SelectionNode>
							</Selection>
						</Children>
					</StaticNode>

				</Children>
			</StaticConnectionNode>
		</DataView>
	</DataViews>

  <SubHierarchies>
    <SubHierarchy name="table children">
      <StaticNode nid="Columns">
        <DisplayName>Columns</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="TableColumn" restrictions="{Table.Database},null,{Table.Name}" filter="InPrimaryKey=True">
            <SelectionNode>
              <Icon name="PrimaryKey"/>
            </SelectionNode>
          </Selection>
          <Selection type="TableColumn" restrictions="{Table.Database},null,{Table.Name}" filter="InPrimaryKey=False">
            <SelectionNode>
              <Icon name="Column"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="Indexes">
        <DisplayName>Indexes</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="Index" restrictions="{Table.Database},null,{Table.Name}">
            <SelectionNode>
              <Icon when="{IsPrimary}=true" name="PrimaryKey"/>
              <Icon when="{IsUnique}=true" name="UniqueKey"/>
              <Icon name="Index"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="ForeignKeys">
        <DisplayName>Foreign Keys</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="ForeignKey" restrictions="{Table.Database},null,{Table.Name}">
            <SelectionNode>
              <Icon name="ForeignKey"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="Triggers">
        <DisplayName>Triggers</DisplayName>
        <Children>
          <Selection type="Triggers" restrictions="{Table.Database},null,{Table.Name}">
            <SelectionNode>
              <Icon name="Index" />
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
    </SubHierarchy>

    <SubHierarchy name="view children">
      <StaticNode nid="Columns">
        <DisplayName>Columns</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="ViewColumn" restrictions="{View.Database},null,{View.Name}">
            <SelectionNode>
              <Icon name="Column"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="Triggers">
        <DisplayName>Triggers</DisplayName>
        <Children>
          <Selection type="Triggers" restrictions="{View.Database},null,{View.Name}">
            <SelectionNode>
              <Icon name="Index" />
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
    </SubHierarchy>

  </SubHierarchies>
  <TypeExtensions>

    <TypeExtension name="Table">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropTable" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Table"/>
        </CommandBinding>
        <CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="884DD964-5327-461f-9F06-6484DD540F8F">
          <Parameter value="Open"/>
        </CommandBinding>
        <CommandBinding name="Design" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12291" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Table"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="View">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="IsUpdatable">
          <DisplayName>Updatable</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropView" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="View"/>
        </CommandBinding>
        <CommandBinding name="Design" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12291" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="View"/>
        </CommandBinding>
        <CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="884DD964-5327-461f-9F06-6484DD540F8F">
          <Parameter value="Open"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="ViewColumn">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="View">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Ordinal"/>
        <Property name="Length"/>
        <Property name="DataType">
          <DisplayName>Data Type</DisplayName>
        </Property>
        <Property name="Nullable">
          <DisplayName>Allow Nulls</DisplayName>
        </Property>
        <Property name="Default">
          <DisplayName>Default Value</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="Index">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="IsUnique">
          <DisplayName>Is Unique</DisplayName>
        </Property>
        <Property name="IsPrimary">
          <DisplayName>Primary Key</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropIndex" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Index"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="Triggers">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
    </TypeExtension>

    <TypeExtension name="TableColumn">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Ordinal"/>
        <Property name="Length"/>
        <Property name="DataType">
          <DisplayName>Data Type</DisplayName>
        </Property>
        <Property name="Nullable">
          <DisplayName>Allow Nulls</DisplayName>
        </Property>
        <Property name="Default">
          <DisplayName>Default Value</DisplayName>
        </Property>
        <Property name="InPrimaryKey">
          <DisplayName>Primary Key</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="ForeignKey">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <!--<Property name="ColumnName">
          <DisplayName>Source Column</DisplayName>
          <Category resource="Category_Source"/>
        </Property>-->
        <Property name="ReferencedTableDatabase">
          <DisplayName>Referenced Database</DisplayName>
          <Category resource="Category_Refs"/>
        </Property>
        <Property name="ReferencedTableName">
          <DisplayName>Referenced Table</DisplayName>
          <Category resource="Category_Refs"/>
        </Property>
        <!--<Property name="ReferencedColumnName">
          <DisplayName>Referenced Column</DisplayName>
          <Category resource="Category_Refs"/>
        </Property>-->
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
      </CommandBindings>
    </TypeExtension>
  </TypeExtensions>

  <Resources baseName="SQLite.Designer.VSPackage">
    <Resource name="Category_Identity">(Identity)</Resource>
    <Resource name="Category_Location">(Location)</Resource>
    <Resource name="Category_Source">(Source)</Resource>
    <Resource name="Category_Refs">References</Resource>
  </Resources>
</VSDataViewSupport>

Added SQLite.Designer/SQLiteDataViewSupport2017.xml.





































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<VSDataViewSupport xmlns="http://tempuri.org/VSDataViewSupport.xsd">
	<DataViews>
		<!-- This sample defines a single data view -->
		<DataView name="SQLite">
      <DisplayName>SQLite</DisplayName>
			<!-- The connection node is static, i.e. has no underlying object -->
			<StaticConnectionNode>
				<!-- We can always specify data from the root object -->
				<InitialDisplayName>SQLite [{Root.Server}]</InitialDisplayName>
				<CommandBindings>
          <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13600" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
          <CommandBinding name="Vacuum"   guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="262" handler="SQLite.Designer.SQLiteCommandHandler"/>
          <CommandBinding name="Rekey"    guid="814658EE-A28E-4b97-BC33-4B1BC81EBECB" cmdid="263" handler="SQLite.Designer.SQLiteCommandHandler"/>
        </CommandBindings>
				<Children>

					<StaticNode nid="Tables">
            <DisplayName>Tables</DisplayName>
						<CommandBindings>
              <CommandBinding name="NewTable" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13600" handler="SQLite.Designer.SQLiteCommandHandler"/>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
            </CommandBindings>
						<Children>
              <Selection type="Table" filter="TYPE='TABLE'">
                <SelectionNode nid="Table">
                  <Icon name="Table"/>
                  <Children>
                    <SubHierarchyRef name="Table children"/>
                  </Children>
                </SelectionNode>
              </Selection>
            </Children>
					</StaticNode>

          <StaticNode nid="Tables">
            <DisplayName>System Tables</DisplayName>
            <CommandBindings>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
            </CommandBindings>
            <Children>
              <Selection type="Table" filter="TYPE='SYSTEM_TABLE'">
                <SelectionNode nid="Table">
                  <Icon name="Table"/>
                  <Children>
                    <SubHierarchyRef name="Table children"/>
                  </Children>
                </SelectionNode>
              </Selection>
            </Children>
          </StaticNode>

          <StaticNode nid="Views">
            <DisplayName>Views</DisplayName>
						<CommandBindings>
              <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
              <CommandBinding name="NewView" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13601" handler="SQLite.Designer.SQLiteCommandHandler" />
            </CommandBindings>
						<Children>
							<Selection type="View">
								<SelectionNode nid="View">
                  <DisplayName>{View.Name}</DisplayName>
                  <Icon name="View"/>
									<Children>
                    <SubHierarchyRef name="View children"/>
									</Children>
								</SelectionNode>
							</Selection>
						</Children>
					</StaticNode>

				</Children>
			</StaticConnectionNode>
		</DataView>
	</DataViews>

  <SubHierarchies>
    <SubHierarchy name="table children">
      <StaticNode nid="Columns">
        <DisplayName>Columns</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="TableColumn" restrictions="{Table.Database},null,{Table.Name}" filter="InPrimaryKey=True">
            <SelectionNode>
              <Icon name="PrimaryKey"/>
            </SelectionNode>
          </Selection>
          <Selection type="TableColumn" restrictions="{Table.Database},null,{Table.Name}" filter="InPrimaryKey=False">
            <SelectionNode>
              <Icon name="Column"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="Indexes">
        <DisplayName>Indexes</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="Index" restrictions="{Table.Database},null,{Table.Name}">
            <SelectionNode>
              <Icon when="{IsPrimary}=true" name="PrimaryKey"/>
              <Icon when="{IsUnique}=true" name="UniqueKey"/>
              <Icon name="Index"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="ForeignKeys">
        <DisplayName>Foreign Keys</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="ForeignKey" restrictions="{Table.Database},null,{Table.Name}">
            <SelectionNode>
              <Icon name="ForeignKey"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="Triggers">
        <DisplayName>Triggers</DisplayName>
        <Children>
          <Selection type="Triggers" restrictions="{Table.Database},null,{Table.Name}">
            <SelectionNode>
              <Icon name="Index" />
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
    </SubHierarchy>

    <SubHierarchy name="view children">
      <StaticNode nid="Columns">
        <DisplayName>Columns</DisplayName>
        <CommandBindings>
          <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        </CommandBindings>
        <Children>
          <Selection type="ViewColumn" restrictions="{View.Database},null,{View.Name}">
            <SelectionNode>
              <Icon name="Column"/>
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>

      <StaticNode nid="Triggers">
        <DisplayName>Triggers</DisplayName>
        <Children>
          <Selection type="Triggers" restrictions="{View.Database},null,{View.Name}">
            <SelectionNode>
              <Icon name="Index" />
            </SelectionNode>
          </Selection>
        </Children>
      </StaticNode>
    </SubHierarchy>

  </SubHierarchies>
  <TypeExtensions>

    <TypeExtension name="Table">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropTable" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Table"/>
        </CommandBinding>
        <CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="884DD964-5327-461f-9F06-6484DD540F8F">
          <Parameter value="Open"/>
        </CommandBinding>
        <CommandBinding name="Design" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12291" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Table"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="View">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="IsUpdatable">
          <DisplayName>Updatable</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropView" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="View"/>
        </CommandBinding>
        <CommandBinding name="Design" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12291" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="View"/>
        </CommandBinding>
        <CommandBinding name="Browse_Data" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="12384" handler="884DD964-5327-461f-9F06-6484DD540F8F">
          <Parameter value="Open"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="ViewColumn">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="View">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Ordinal"/>
        <Property name="Length"/>
        <Property name="DataType">
          <DisplayName>Data Type</DisplayName>
        </Property>
        <Property name="Nullable">
          <DisplayName>Allow Nulls</DisplayName>
        </Property>
        <Property name="Default">
          <DisplayName>Default Value</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="Index">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="IsUnique">
          <DisplayName>Is Unique</DisplayName>
        </Property>
        <Property name="IsPrimary">
          <DisplayName>Primary Key</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
        <CommandBinding name="DropIndex" guid="5efc7975-14bc-11cf-9b2b-00aa00573819" cmdid="17" handler="SQLite.Designer.SQLiteCommandHandler">
          <Parameter value="Index"/>
        </CommandBinding>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="Triggers">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
    </TypeExtension>

    <TypeExtension name="TableColumn">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <Property name="Ordinal"/>
        <Property name="Length"/>
        <Property name="DataType">
          <DisplayName>Data Type</DisplayName>
        </Property>
        <Property name="Nullable">
          <DisplayName>Allow Nulls</DisplayName>
        </Property>
        <Property name="Default">
          <DisplayName>Default Value</DisplayName>
        </Property>
        <Property name="InPrimaryKey">
          <DisplayName>Primary Key</DisplayName>
        </Property>
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
      </CommandBindings>
    </TypeExtension>

    <TypeExtension name="ForeignKey">
      <Identifier>
        <Part name="Name">
          <Category resource="Category_Identity"/>
        </Part>
        <Part name="Database">
          <DisplayName>Catalog</DisplayName>
          <Category resource="Category_Location"/>
        </Part>
        <Part name="Table">
          <Category resource="Category_Location"/>
        </Part>
      </Identifier>
      <Properties>
        <!--<Property name="ColumnName">
          <DisplayName>Source Column</DisplayName>
          <Category resource="Category_Source"/>
        </Property>-->
        <Property name="ReferencedTableDatabase">
          <DisplayName>Referenced Database</DisplayName>
          <Category resource="Category_Refs"/>
        </Property>
        <Property name="ReferencedTableName">
          <DisplayName>Referenced Table</DisplayName>
          <Category resource="Category_Refs"/>
        </Property>
        <!--<Property name="ReferencedColumnName">
          <DisplayName>Referenced Column</DisplayName>
          <Category resource="Category_Refs"/>
        </Property>-->
      </Properties>
      <CommandBindings>
        <CommandBinding name="NewQuery" guid="501822E1-B5AF-11d0-B4DC-00A0C91506EF" cmdid="13608" handler="884DD964-5327-461f-9F06-6484DD540F8F"/>
      </CommandBindings>
    </TypeExtension>
  </TypeExtensions>

  <Resources baseName="SQLite.Designer.VSPackage">
    <Resource name="Category_Identity">(Identity)</Resource>
    <Resource name="Category_Location">(Location)</Resource>
    <Resource name="Category_Source">(Source)</Resource>
    <Resource name="Category_Refs">References</Resource>
  </Resources>
</VSDataViewSupport>

Added SQLite.Designer/SQLiteOptions.cs.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Joe Mistachkin (joe@mistachkin.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System;
using System.Collections.Generic;
using System.Data.Common;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Microsoft.VisualStudio.Shell;

namespace SQLite.Designer
{
    /// <summary>
    /// This class keeps track of the options configured on a per-solution file
    /// basis pertaining to the System.Data.SQLite design-time components.
    /// </summary>
    [Guid("5cf5656c-ccbe-4162-8780-0cbee936b90c")]
    internal static class SQLiteOptions
    {
        #region Private Constants
        /// <summary>
        /// This is the name of the setting containing the configured ADO.NET
        /// provider name.
        /// </summary>
        private static readonly string ProviderNameKey = "ProviderName";

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This is the name of the environment variable that will be checked
        /// prior to setting the initial default value for the configured
        /// ADO.NET provider name, thus allowing the default value to be
        /// overridden via the environment.
        /// </summary>
        private static readonly string ProviderNameEnvVarName =
            "ProviderName_SQLiteDesigner";

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This is the legacy provider name used by the System.Data.SQLite
        /// design-time components.  It is also the default value for the
        /// associated option key.
        /// </summary>
        private static readonly string LegacyProviderName = "System.Data.SQLite";

        ///////////////////////////////////////////////////////////////////////

#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48
        /// <summary>
        /// This is the provider name used when Entity Framework 6.x support is
        /// required for use with the System.Data.SQLite design-time components.
        /// This provider name is only available when this class is compiled for
        /// the .NET Framework 4.0 or later.
        /// </summary>
        private static readonly string Ef6ProviderName = "System.Data.SQLite.EF6";
#endif
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Static Data
        /// <summary>
        /// This is used to synchronize access to the static dictionary of
        /// options and <see cref="DbProviderFactory" /> objects.
        /// </summary>
        private static readonly object syncRoot = new object();

        /// <summary>
        /// This dictionary contains the key/value pairs representing the
        /// per-solution options configured for the current solution.  When
        /// a new solution is loaded by Visual Studio, this dictionary must
        /// be reset.
        /// </summary>
        private static Dictionary<string, string> options;

        /// <summary>
        /// This dictionary contains the <see cref="DbProviderFactory" />
        /// objects cached by this class.
        /// </summary>
        private static Dictionary<string, DbProviderFactory>
            dbProviderFactories;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Static Methods
        /// <summary>
        /// This method initializes (or resets) the per-solution configuration
        /// options.
        /// </summary>
        /// <param name="reset">
        /// Non-zero to reset the options if they are already initialized.
        /// When this method is called from the <see cref="SQLitePackage" />
        /// constructor, this value should always be true.
        /// </param>
        private static void Initialize(
            bool reset
            )
        {
            lock (syncRoot)
            {
                if (options != null)
                    options.Clear();
                else
                    options = new Dictionary<string, string>();

                string key = ProviderNameKey;
                string value = Environment.GetEnvironmentVariable(
                    ProviderNameEnvVarName);

                if (IsValidValue(key, value))
                    options[key] = value;
#if !NET_40 && !NET_45 && !NET_451 && !NET_452 && !NET_46 && !NET_461 && !NET_462 && !NET_47 && !NET_471 && !NET_472 && !NET_48
                else
                    options[key] = LegacyProviderName;
#endif
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Static Methods
        #region Provider Name Handling
        /// <summary>
        /// This method determines the name of the ADO.NET provider for the
        /// System.Data.SQLite design-time components to use.
        /// </summary>
        /// <returns>
        /// The configured ADO.NET provider name for System.Data.SQLite -OR-
        /// the default ADO.NET provider name for System.Data.SQLite in the
        /// event of any failure.  This method cannot return null.
        /// </returns>
        public static string GetProviderName()
        {
#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48
            return GetProviderName(Ef6ProviderName);
#else
            return GetProviderName(LegacyProviderName);
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method determines the name of the ADO.NET provider for the
        /// System.Data.SQLite design-time components to use.
        /// </summary>
        /// <param name="default">
        /// The value to return from this method if the name of the ADO.NET
        /// provider is unavailable or cannot be determined.
        /// </param>
        /// <returns>
        /// The configured ADO.NET provider name for System.Data.SQLite -OR-
        /// the default ADO.NET provider name for System.Data.SQLite in the
        /// event of any failure.
        /// </returns>
        private static string GetProviderName(
            string @default
            )
        {
            string key = ProviderNameKey;
            string value;

            if (GetValue(key, out value) && IsValidValue(key, value))
                return value;

            return @default;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method attempts to set the name of the ADO.NET provider for
        /// the System.Data.SQLite design-time components to use.
        /// </summary>
        /// <param name="value">
        /// The ADO.NET provider name to use.
        /// </param>
        /// <returns>
        /// Non-zero upon success; otherwise, zero.  All ADO.NET provider names
        /// unknown to this class are rejected.
        /// </returns>
        public static bool SetProviderName(
            string value
            )
        {
            string key = ProviderNameKey;

            if (IsValidValue(key, value))
                return SetValue(key, value);

            return false;
        }

        ///////////////////////////////////////////////////////////////////////

        #region User-Interface Handling
        /// <summary>
        /// This method attempts to select the configured ADO.NET provider name
        /// in the specified <see cref="ComboBox" />.  This method will only
        /// work correctly when called from the user-interface thread.
        /// </summary>
        /// <param name="comboBox">
        /// The <see cref="ComboBox" /> object where the selection is to be
        /// modified.
        /// </param>
        /// <returns>
        /// Non-zero upon success; otherwise, zero.
        /// </returns>
        public static bool SelectProviderName(
            ComboBox comboBox
            )
        {
            if (comboBox == null)
                return false;

            string value = GetProviderName(null);

            for (int index = 0; index < comboBox.Items.Count; index++)
            {
                object item = comboBox.Items[index];

                if (item == null)
                    continue;

                if ((value == null) || String.Equals(
                        item.ToString(), value, StringComparison.Ordinal))
                {
                    comboBox.SelectedIndex = index;
                    return true;
                }
            }

            return false;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Determines if the specified ADO.NET provider name appears to be
        /// usable.
        /// </summary>
        /// <param name="name">
        /// The invariant name of the ADO.NET provider to create.  Using null
        /// or an empty string will cause this method to return false.
        /// </param>
        /// <returns>
        /// Non-zero if the <see cref="DbProviderFactory" /> was created or
        /// queried successfully; otherwise, zero.
        /// </returns>
        private static bool CheckProviderName(
            string name
            )
        {
            DbProviderFactory dbProviderFactory; /* NOT USED */

            return GetProviderFactory(name, true, out dbProviderFactory);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets the cached <see cref="DbProviderFactory" /> object associated
        /// with the specified name, creating a new instance if necessary.
        /// </summary>
        /// <param name="name">
        /// The invariant name of the ADO.NET provider to create.  Using null
        /// or an empty string will cause this method to return false.
        /// </param>
        /// <param name="create">
        /// Non-zero to create a new instance of the ADO.NET provider, if
        /// necessary.
        /// </param>
        /// <param name="dbProviderFactory">
        /// The newly created <see cref="DbProviderFactory" /> object or null
        /// if it is unavailable or could not be created.
        /// </param>
        /// <returns>
        /// Non-zero if the <see cref="DbProviderFactory" /> was created or
        /// queried successfully; otherwise, zero.
        /// </returns>
        public static bool GetProviderFactory(
            string name,
            bool create,
            out DbProviderFactory dbProviderFactory
            )
        {
            lock (syncRoot)
            {
                dbProviderFactory = null;

                if (dbProviderFactories == null)
                {
                    dbProviderFactories =
                        new Dictionary<string, DbProviderFactory>();
                }

                if (String.IsNullOrEmpty(name))
                    return false;

                if (dbProviderFactories.TryGetValue(
                        name, out dbProviderFactory))
                {
                    return (dbProviderFactory != null);
                }

                if (!create)
                    return false;

                dbProviderFactory = null; /* NOTE: Pedantic. */

                try
                {
                    dbProviderFactory = DbProviderFactories.GetFactory(name);
                }
                catch
                {
                    // do nothing.
                }

                dbProviderFactories.Add(name, dbProviderFactory);
                return (dbProviderFactory != null);
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method populates the specified <see cref="ComboBox" /> item
        /// list with the recognized ADO.NET provider names.  This method will
        /// only work correctly when called from the user-interface thread.
        /// </summary>
        /// <param name="items">
        /// The <see cref="ComboBox.Items" /> property value containing the
        /// list of items to be modified.  This value cannot be null.
        /// </param>
        /// <returns>
        /// The number of items actually added to the list, which may be zero.
        /// </returns>
        public static int AddProviderNames(
            ComboBox.ObjectCollection items
            )
        {
            int result = 0;

            if (items == null)
                return result;

            IList<string> names = new List<string>();

#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48
            names.Add(Ef6ProviderName);
#endif

            names.Add(LegacyProviderName);

            foreach (string name in names)
            {
                if (CheckProviderName(name))
                {
                    items.Add(name);
                    result++;
                }
            }

            return result;
        }
        #endregion
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Hard-Coded Default Value Handling
        /// <summary>
        /// This method determines if the specified key/value pair represents
        /// the default value for that option.
        /// </summary>
        /// <param name="key">
        /// The name ("key") of the configuration option.
        /// </param>
        /// <param name="value">
        /// The value of the configuration option.
        /// </param>
        /// <returns>
        /// Non-zero if the key/value pair represents its default value.
        /// </returns>
        public static bool IsDefaultValue(
            string key,
            string value
            )
        {
            if (String.Equals(
                    key, ProviderNameKey, StringComparison.Ordinal) &&
                String.Equals(
                    value, LegacyProviderName, StringComparison.Ordinal))
            {
                return true;
            }

            return false;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method determines if the specified key/value pair is valid
        /// and supported by this class.
        /// </summary>
        /// <param name="key">
        /// The name ("key") of the configuration option.
        /// </param>
        /// <param name="value">
        /// The value of the configuration option.
        /// </param>
        /// <returns>
        /// Non-zero if the key/value pair represents a valid option key and
        /// value supported by this class.
        /// </returns>
        public static bool IsValidValue(
            string key,
            string value
            )
        {
            if (String.Equals(
                    key, ProviderNameKey, StringComparison.Ordinal) &&
                (String.Equals(
                    value, LegacyProviderName, StringComparison.Ordinal)
#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48
                || String.Equals(
                    value, Ef6ProviderName, StringComparison.Ordinal)
#endif
                ))
            {
                return true;
            }

            return false;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Core Option Handling
        /// <summary>
        /// This method returns the current list of option keys supported by
        /// the System.Data.SQLite design-time components.
        /// </summary>
        /// <returns>
        /// An <see cref="IEnumerable{T}" /> of strings containing the list of
        /// option keys supported by the System.Data.SQLite design-time
        /// components -OR- null in the event of any failure.
        /// </returns>
        public static IEnumerable<string> GetKeys(
            bool reset
            )
        {
            lock (syncRoot) /* TRANSACTIONAL */
            {
                Initialize(reset);

                return (options != null) ?
                    new List<string>(options.Keys) : null;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method determines if the specified option key is supported by
        /// this class.
        /// </summary>
        /// <param name="key">
        /// The name ("key") of the configuration option.
        /// </param>
        /// <returns>
        /// Non-zero if the specified option key is supported by this class.
        /// </returns>
        public static bool HaveKey(
            string key
            )
        {
            lock (syncRoot)
            {
                if ((key == null) || (options == null))
                    return false;

                return options.ContainsKey(key);
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method attempts to query and return the current value of the
        /// specified option key.
        /// </summary>
        /// <param name="key">
        /// The name ("key") of the configuration option.
        /// </param>
        /// <param name="value">
        /// Upon success, the current value for the configuration option;
        /// otherwise, null.
        /// </param>
        /// <returns>
        /// Non-zero for success; otherwise, zero.
        /// </returns>
        public static bool GetValue(
            string key,
            out string value
            )
        {
            lock (syncRoot)
            {
                value = null;

                if ((key == null) || (options == null))
                    return false;

                if (options.TryGetValue(key, out value))
                    return true;

                return false;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method attempts to set the value of the specified option key.
        /// </summary>
        /// <param name="key">
        /// The name ("key") of the configuration option.
        /// </param>
        /// <param name="value">
        /// The new value for the configuration option.
        /// </param>
        /// <returns>
        /// Non-zero for success; otherwise, zero.
        /// </returns>
        public static bool SetValue(
            string key,
            string value
            )
        {
            lock (syncRoot)
            {
                if ((key == null) || (options == null))
                    return false;

                options[key] = value;
                return true;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Stream Handling
        /// <summary>
        /// This method attempts to read an option value from the specified
        /// stream.  The stream must be readable.  After this method returns,
        /// the stream may no longer be usable.
        /// </summary>
        /// <param name="stream">
        /// The stream to read the option value from.
        /// </param>
        /// <param name="value">
        /// Upon success, the read value for the configuration option;
        /// otherwise, null.
        /// </param>
        /// <returns>
        /// Non-zero for success; otherwise, zero.
        /// </returns>
        public static bool ReadValue(
            Stream stream,
            out string value
            )
        {
            value = null;

            if ((stream == null) || !stream.CanRead)
                return false;

            try
            {
                using (StreamReader streamReader = new StreamReader(stream))
                {
                    value = streamReader.ReadToEnd();
                    return true;
                }
            }
            catch (Exception)
            {
                // do nothing.
            }

            return false;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method attempts to write an option value to the specified
        /// stream.  The stream must be writable.  After this method returns,
        /// the stream may no longer be usable.
        /// </summary>
        /// <param name="stream">
        /// The stream to write the option value to.
        /// </param>
        /// <param name="value">
        /// The option value to be written.  This value may be null.
        /// </param>
        /// <returns>
        /// Non-zero for success; otherwise, zero.
        /// </returns>
        public static bool WriteValue(
            Stream stream,
            string value
            )
        {
            if ((stream == null) || !stream.CanWrite)
                return false;

            try
            {
                using (StreamWriter streamWriter = new StreamWriter(stream))
                {
                    streamWriter.Write(value);
                    return true;
                }
            }
            catch (Exception)
            {
                // do nothing.
            }

            return false;
        }
        #endregion
        #endregion
    }
}

Changes to SQLite.Designer/SQLitePackage.cs.

1
2
3
4
5
6
7
8
9
10


11
12
13
14
15
16
17
18
19
20
21
22
23
24












25
26
27
28
29
30
31
32
33
34
35





































36
37
38
39
40
41
42
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer
{
  using System;


  using Microsoft.VisualStudio.Shell;
  using System.Runtime.InteropServices;
  using System.ComponentModel.Design;
  using Microsoft.VisualStudio.Shell.Interop;

  /// <summary>
  /// Ideally we'd be a package provider, but the VS Express Editions don't support us, so this class
  /// exists so that in the future we can perhaps work with the Express Editions.
  /// </summary>
  [Guid("DCBE6C8D-0E57-4099-A183-98FF74C64D9C")]
  internal sealed class SQLitePackage : Package
  {
    public SQLitePackage()
    {












    }

    protected override void Initialize()
    {
      IServiceContainer sc = (IServiceContainer)this;
      sc.AddService(typeof(SQLiteProviderObjectFactory), new ServiceCreatorCallback(CreateService), true);

      ToolboxInitialized += new EventHandler(SQLitePackage_ToolboxInitialized);
      ToolboxUpgraded += new EventHandler(SQLitePackage_ToolboxUpgraded);
      base.Initialize();
    }






































    void SQLitePackage_ToolboxUpgraded(object sender, EventArgs e)
    {
      IVsToolbox vstbx = GetService(typeof(SVsToolbox)) as IVsToolbox;

      vstbx.RemoveTab("SQLite");




|






>
>














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











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







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer
{
  using System;
  using System.Collections.Generic;
  using System.IO;
  using Microsoft.VisualStudio.Shell;
  using System.Runtime.InteropServices;
  using System.ComponentModel.Design;
  using Microsoft.VisualStudio.Shell.Interop;

  /// <summary>
  /// Ideally we'd be a package provider, but the VS Express Editions don't support us, so this class
  /// exists so that in the future we can perhaps work with the Express Editions.
  /// </summary>
  [Guid("DCBE6C8D-0E57-4099-A183-98FF74C64D9C")]
  internal sealed class SQLitePackage : Package
  {
    public SQLitePackage()
    {
        IEnumerable<string> keys = SQLiteOptions.GetKeys(true);

        if (keys != null)
        {
            foreach (string key in keys)
            {
                if (key == null)
                    continue;

                AddOptionKey(key);
            }
        }
    }

    protected override void Initialize()
    {
      IServiceContainer sc = (IServiceContainer)this;
      sc.AddService(typeof(SQLiteProviderObjectFactory), new ServiceCreatorCallback(CreateService), true);

      ToolboxInitialized += new EventHandler(SQLitePackage_ToolboxInitialized);
      ToolboxUpgraded += new EventHandler(SQLitePackage_ToolboxUpgraded);
      base.Initialize();
    }

    protected override void OnLoadOptions(string key, Stream stream)
    {
        if (SQLiteOptions.HaveKey(key))
        {
            string value;

            if (SQLiteOptions.ReadValue(stream, out value) &&
                SQLiteOptions.IsValidValue(key, value))
            {
                SQLiteOptions.SetValue(key, value);
            }

            return;
        }

        base.OnLoadOptions(key, stream);
    }

    protected override void OnSaveOptions(string key, Stream stream)
    {
        if (SQLiteOptions.HaveKey(key))
        {
            string value;

            if (SQLiteOptions.GetValue(key, out value) &&
                SQLiteOptions.IsValidValue(key, value) &&
                !SQLiteOptions.IsDefaultValue(key, value))
            {
                SQLiteOptions.WriteValue(stream, value);
            }

            return;
        }

        base.OnSaveOptions(key, stream);
    }

    void SQLitePackage_ToolboxUpgraded(object sender, EventArgs e)
    {
      IVsToolbox vstbx = GetService(typeof(SVsToolbox)) as IVsToolbox;

      vstbx.RemoveTab("SQLite");

Changes to SQLite.Designer/TableNameDialog.Designer.cs.








1
2
3
4
5
6
7







namespace SQLite.Designer
{
  partial class TableNameDialog
  {
    /// <summary>
    /// Required designer variable.
    /// </summary>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace SQLite.Designer
{
  partial class TableNameDialog
  {
    /// <summary>
    /// Required designer variable.
    /// </summary>

Changes to SQLite.Designer/TableNameDialog.cs.

Changes to SQLite.Designer/VSPackage.Designer.cs.








1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29







//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.3031
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace SQLite.Designer {
    using System;
    
    
    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class VSPackage {
        
        private static global::System.Resources.ResourceManager resourceMan;
        
        private static global::System.Globalization.CultureInfo resourceCulture;
>
>
>
>
>
>
>



|

















|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.1
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace SQLite.Designer {
    using System;
    
    
    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class VSPackage {
        
        private static global::System.Resources.ResourceManager resourceMan;
        
        private static global::System.Globalization.CultureInfo resourceCulture;
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
            }
            set {
                resourceCulture = value;
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to MHM2ZQETQKDTJEPTC1MTQCZ1R1KQEMAPZHETDZPZI9RPJ0E0DHAHKCHZPKQ8AQZICADHKIZ1JAQED8IDEHZPZKZEIKAQERHPRCQMAMRKDEZZQRDRDHJEZIKECZPDIIKC.
        /// </summary>
        internal static string _400 {
            get {
                return ResourceManager.GetString("400", resourceCulture);
            }
        }
        







|







64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
            }
            set {
                resourceCulture = value;
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to PTA9I2P3DHDAHKKZHZHJMDEQCCPTQCRMDZC9DAARARZHZCHPDEPQZAJ0JZECKJQJJ0DCDDA3AEEPEHRJHMAIAPQHDEEHRCZQE2DHKKQTK0DTQ9C2E9C9R8ZCKPK3RRK2.
        /// </summary>
        internal static string _400 {
            get {
                return ResourceManager.GetString("400", resourceCulture);
            }
        }
        
100
101
102
103
104
105
106
107




108
109
110
111
112
113
114
115
        internal static string ReEncrypt {
            get {
                return ResourceManager.GetString("ReEncrypt", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to .




        /// </summary>
        internal static string ToolboxItems {
            get {
                return ResourceManager.GetString("ToolboxItems", resourceCulture);
            }
        }
    }
}







|
>
>
>
>








107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
        internal static string ReEncrypt {
            get {
                return ResourceManager.GetString("ReEncrypt", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to [SQLite]
        ///System.Data.SQLite.SQLiteConnection, System.Data.SQLite
        ///System.Data.SQLite.SQLiteDataAdapter, System.Data.SQLite
        ///System.Data.SQLite.SQLiteCommand, System.Data.SQLite
        ///.
        /// </summary>
        internal static string ToolboxItems {
            get {
                return ResourceManager.GetString("ToolboxItems", resourceCulture);
            }
        }
    }
}

Changes to SQLite.Designer/VSPackage.resx.

123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
  <data name="Encrypt" xml:space="preserve">
    <value>The database and its metadata will be encrypted using the supplied password as a hash.</value>
  </data>
  <data name="ReEncrypt" xml:space="preserve">
    <value>The database and its metadata will be re-encrypted using the supplied password as a hash.</value>
  </data>
  <data name="400" xml:space="preserve">
    <value>MHM2ZQETQKDTJEPTC1MTQCZ1R1KQEMAPZHETDZPZI9RPJ0E0DHAHKCHZPKQ8AQZICADHKIZ1JAQED8IDEHZPZKZEIKAQERHPRCQMAMRKDEZZQRDRDHJEZIKECZPDIIKC</value>
  </data>
  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  <data name="info" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>Resources\info.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
  </data>
  <data name="ToolboxItems" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>Resources\ToolboxItems.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>







|







123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
  <data name="Encrypt" xml:space="preserve">
    <value>The database and its metadata will be encrypted using the supplied password as a hash.</value>
  </data>
  <data name="ReEncrypt" xml:space="preserve">
    <value>The database and its metadata will be re-encrypted using the supplied password as a hash.</value>
  </data>
  <data name="400" xml:space="preserve">
    <value>PTA9I2P3DHDAHKKZHZHJMDEQCCPTQCRMDZC9DAARARZHZCHPDEPQZAJ0JZECKJQJJ0DCDDA3AEEPEHRJHMAIAPQHDEEHRCZQE2DHKKQTK0DTQ9C2E9C9R8ZCKPK3RRK2</value>
  </data>
  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  <data name="info" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>Resources\info.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
  </data>
  <data name="ToolboxItems" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>Resources\ToolboxItems.txt;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>

Added SQLite.Designer/plk.txt.

















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Package Load Key (PLK)

  PTA9I2P3DHDAHKKZHZHJMDEQCCPTQCRMDZC9DAARARZHZCHPDEPQZAJ0JZECKJQJ
  J0DCDDA3AEEPEHRJHMAIAPQHDEEHRCZQE2DHKKQTK0DTQ9C2E9C9R8ZCKPK3RRK2

Contact Email Address

  plk@system.data.sqlite.org

Company Name

  https://system.data.sqlite.org/

Product Name

  System.Data.SQLite

Key Type

  PLK

Package Name

  System.Data.SQLite Designer Package

Guid {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}

  {dcbe6c8d-0e57-4099-a183-98ff74c64d9c}

Package Version

  1.0

Min Product Edition

  Standard

Min Visual Studio Version

  Visual Studio 2005

Added SQLite.Designer/source.extension.vsixmanifest.











































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?xml version="1.0" encoding="utf-8"?>
<Vsix Version="1.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010">
  <Identifier Id="67b5f3a9-cde1-430f-a12b-af95bb064851">
    <Name>System.Data.SQLite Designer</Name>
    <Author>https://system.data.sqlite.org/</Author>
    <Version>1.0.119.0</Version>
    <Description>ADO.NET Data Designer for SQLite</Description>
    <Locale>1033</Locale>
    <InstalledByMsi>false</InstalledByMsi>
    <SupportedProducts>
      <VisualStudio Version="10.0">
        <Edition>Pro</Edition>
      </VisualStudio>
    </SupportedProducts>
    <SupportedFrameworkRuntimeEdition MinVersion="4.0" MaxVersion="4.0" />
  </Identifier>
  <References />
  <Content>
    <VsPackage>|SQLite.Designer;PkgdefProjectOutputGroup|</VsPackage>
  </Content>
</Vsix>

Deleted SQLite.Interop/AssemblyInfo.cpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;

//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly:AssemblyTitleAttribute("System.Data.SQLite")];
[assembly:AssemblyDescriptionAttribute("http://sourceforge.net/projects/sqlite-dotnet2")];
[assembly:AssemblyConfigurationAttribute("")];
[assembly:AssemblyCompanyAttribute("")];
[assembly:AssemblyProductAttribute("System.Data.SQLite")];
[assembly:AssemblyCopyrightAttribute("Released to the public domain")];
[assembly:AssemblyTrademarkAttribute("")];
[assembly:AssemblyCultureAttribute("")];

//
// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the value or you can default the Revision and Build Numbers
// by using the '*' as shown below:

[assembly:AssemblyVersionAttribute("1.0.17.0")];
[assembly:AssemblyFileVersionAttribute("1.0.17.0")];

//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft CLR Framework documentation for more information on assembly signing.
//
// You can use the attributes below to control which key is used for signing.
// You can also use the project property page for signing under Common Properties
// to set the same information.
//
// Notes:
//   (*) If no key is specified, the assembly is not signed.
//   (*) KeyName refers to a key that has been installed in the Crypto Service
//       Provider (CSP) on your machine. KeyFile refers to a file which contains
//       a key.
//   (*) If the KeyFile and the KeyName values are both specified, the
//       following processing occurs:
//       (1) If the KeyName can be found in the CSP, that key is used.
//       (2) If the KeyName does not exist and the KeyFile does exist, the key
//           in the KeyFile is installed into the CSP and used.
//   (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
//        When specifying the KeyFile, the location of the KeyFile should be
//        relative to the project directory.
//   (*) Delay Signing is an advanced option - see the Microsoft CLR Framework
//       documentation for more information on this.
//
[assembly:AssemblyDelaySignAttribute(false)];

#ifdef _WIN64
#ifdef _M_IA64 // Itanium
[assembly:AssemblyKeyFileAttribute("..\\System.Data.SQLite\\System.Data.SQLite.IA64.snk")];
#else // AMD64
[assembly:AssemblyKeyFileAttribute("..\\System.Data.SQLite\\System.Data.SQLite.X64.snk")];
#endif
#else
[assembly:AssemblyKeyFileAttribute("..\\System.Data.SQLite\\System.Data.SQLite.snk")];
#endif
[assembly:AssemblyKeyNameAttribute("")];

[assembly:ComVisible(false)];

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














































































































































Deleted SQLite.Interop/FTS1/FTS1.vcproj.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
	ProjectType="Visual C++"
	Version="8.00"
	Name="SQLite.Interop.FTS1"
	ProjectGUID="{BCD6CA74-771B-49EE-9025-606CB839DA0B}"
	RootNamespace="FTS1"
	Keyword="Win32Proj"
	>
	<Platforms>
		<Platform
			Name="Win32"
		/>
		<Platform
			Name="Pocket PC 2003 (ARMV4)"
		/>
		<Platform
			Name="Itanium"
		/>
		<Platform
			Name="x64"
		/>
	</Platforms>
	<ToolFiles>
	</ToolFiles>
	<Configurations>
		<Configuration
			Name="Debug|Win32"
			OutputDirectory="$(ConfigurationName)"
			IntermediateDirectory="$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;SQLITE_ENABLE_FTS1;SQLITE_ENABLE_BROKEN_FTS1;SQLITE_CORE"
				RuntimeLibrary="3"
				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
				DebugInformationFormat="3"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLibrarianTool"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
		<Configuration
			Name="Debug|Pocket PC 2003 (ARMV4)"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="1"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				AdditionalOptions="/GS-"
				Optimization="0"
				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;SQLITE_ENABLE_FTS1;SQLITE_ENABLE_BROKEN_FTS1;SQLITE_CORE"
				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
				DebugInformationFormat="3"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLibrarianTool"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory=""
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
		<Configuration
			Name="Debug|Itanium"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="2"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN64;_DEBUG;_LIB;SQLITE_ENABLE_FTS1;SQLITE_ENABLE_BROKEN_FTS1;SQLITE_CORE"
				RuntimeLibrary="3"
				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
				DebugInformationFormat="3"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLibrarianTool"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
		<Configuration
			Name="Debug|x64"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN64;_DEBUG;_LIB;SQLITE_ENABLE_FTS1;SQLITE_ENABLE_BROKEN_FTS1;SQLITE_CORE"
				RuntimeLibrary="3"
				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
				DebugInformationFormat="3"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLibrarianTool"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
		<Configuration
			Name="Release|Win32"
			OutputDirectory="$(ConfigurationName)"
			IntermediateDirectory="$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;SQLITE_ENABLE_FTS1;SQLITE_ENABLE_BROKEN_FTS1;SQLITE_CORE"
				StringPooling="true"
				ExceptionHandling="0"
				BufferSecurityCheck="false"
				EnableFunctionLevelLinking="true"
				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLibrarianTool"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
		<Configuration
			Name="Release|Pocket PC 2003 (ARMV4)"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="1"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;SQLITE_ENABLE_FTS1;SQLITE_ENABLE_BROKEN_FTS1;SQLITE_CORE"
				StringPooling="true"
				ExceptionHandling="0"
				BufferSecurityCheck="false"
				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLibrarianTool"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory=""
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
		<Configuration
			Name="Release|Itanium"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="2"
			/>
			<Tool
				Name="VCCLCompilerTool"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN64;NDEBUG;_LIB;SQLITE_ENABLE_FTS1;SQLITE_ENABLE_BROKEN_FTS1;SQLITE_CORE"
				StringPooling="true"
				ExceptionHandling="0"
				BufferSecurityCheck="false"
				EnableFunctionLevelLinking="true"
				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLibrarianTool"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
		<Configuration
			Name="Release|x64"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN64;NDEBUG;_LIB;SQLITE_ENABLE_FTS1;SQLITE_ENABLE_BROKEN_FTS1;SQLITE_CORE"
				StringPooling="true"
				ExceptionHandling="0"
				BufferSecurityCheck="false"
				EnableFunctionLevelLinking="true"
				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLibrarianTool"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
	</Configurations>
	<References>
	</References>
	<Files>
		<Filter
			Name="Source Files"
			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
			>
			<File
				RelativePath=".\fts1.c"
				>
			</File>
			<File
				RelativePath=".\fts1_hash.c"
				>
			</File>
			<File
				RelativePath=".\fts1_porter.c"
				>
			</File>
			<File
				RelativePath=".\fts1_tokenizer1.c"
				>
			</File>
		</Filter>
		<Filter
			Name="Header Files"
			Filter="h;hpp;hxx;hm;inl;inc;xsd"
			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
			>
			<File
				RelativePath=".\fts1.h"
				>
			</File>
			<File
				RelativePath=".\fts1_hash.h"
				>
			</File>
			<File
				RelativePath=".\fts1_tokenizer.h"
				>
			</File>
		</Filter>
		<Filter
			Name="Resource Files"
			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
			>
		</Filter>
		<File
			RelativePath=".\ReadMe.txt"
			>
		</File>
	</Files>
	<Globals>
	</Globals>
</VisualStudioProject>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/FTS1/fts1.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
/* fts1 has a design flaw which can lead to database corruption (see
** below).  It is recommended not to use it any longer, instead use
** fts3 (or higher).  If you believe that your use of fts1 is safe,
** add -DSQLITE_ENABLE_BROKEN_FTS1=1 to your CFLAGS.
*/
#ifndef SQLITE_ENABLE_BROKEN_FTS1
#error fts1 has a design flaw and has been deprecated.
#endif
/* The flaw is that fts1 uses the content table's unaliased rowid as
** the unique docid.  fts1 embeds the rowid in the index it builds,
** and expects the rowid to not change.  The SQLite VACUUM operation
** will renumber such rowids, thereby breaking fts1.  If you are using
** fts1 in a system which has disabled VACUUM, then you can continue
** to use it safely.  Note that PRAGMA auto_vacuum does NOT disable
** VACUUM, though systems using auto_vacuum are unlikely to invoke
** VACUUM.
**
** fts1 should be safe even across VACUUM if you only insert documents
** and never delete.
*/

/* The author disclaims copyright to this source code.
 *
 * This is an SQLite module implementing full-text search.
 */

/*
** The code in this file is only compiled if:
**
**     * The FTS1 module is being built as an extension
**       (in which case SQLITE_CORE is not defined), or
**
**     * The FTS1 module is being built into the core of
**       SQLite (in which case SQLITE_ENABLE_FTS1 is defined).
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1)

#if defined(SQLITE_ENABLE_FTS1) && !defined(SQLITE_CORE)
# define SQLITE_CORE 1
#endif

#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

#include "fts1.h"
#include "fts1_hash.h"
#include "fts1_tokenizer.h"
#include "sqlite3.h"
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1


#if 0
# define TRACE(A)  printf A; fflush(stdout)
#else
# define TRACE(A)
#endif

/* utility functions */

typedef struct StringBuffer {
  int len;      /* length, not including null terminator */
  int alloced;  /* Space allocated for s[] */ 
  char *s;      /* Content of the string */
} StringBuffer;

static void initStringBuffer(StringBuffer *sb){
  sb->len = 0;
  sb->alloced = 100;
  sb->s = malloc(100);
  sb->s[0] = '\0';
}

static void nappend(StringBuffer *sb, const char *zFrom, int nFrom){
  if( sb->len + nFrom >= sb->alloced ){
    sb->alloced = sb->len + nFrom + 100;
    sb->s = realloc(sb->s, sb->alloced+1);
    if( sb->s==0 ){
      initStringBuffer(sb);
      return;
    }
  }
  memcpy(sb->s + sb->len, zFrom, nFrom);
  sb->len += nFrom;
  sb->s[sb->len] = 0;
}
static void append(StringBuffer *sb, const char *zFrom){
  nappend(sb, zFrom, strlen(zFrom));
}

/* We encode variable-length integers in little-endian order using seven bits
 * per byte as follows:
**
** KEY:
**         A = 0xxxxxxx    7 bits of data and one flag bit
**         B = 1xxxxxxx    7 bits of data and one flag bit
**
**  7 bits - A
** 14 bits - BA
** 21 bits - BBA
** and so on.
*/

/* We may need up to VARINT_MAX bytes to store an encoded 64-bit integer. */
#define VARINT_MAX 10

/* Write a 64-bit variable-length integer to memory starting at p[0].
 * The length of data written will be between 1 and VARINT_MAX bytes.
 * The number of bytes written is returned. */
static int putVarint(char *p, sqlite_int64 v){
  unsigned char *q = (unsigned char *) p;
  sqlite_uint64 vu = v;
  do{
    *q++ = (unsigned char) ((vu & 0x7f) | 0x80);
    vu >>= 7;
  }while( vu!=0 );
  q[-1] &= 0x7f;  /* turn off high bit in final byte */
  assert( q - (unsigned char *)p <= VARINT_MAX );
  return (int) (q - (unsigned char *)p);
}

/* Read a 64-bit variable-length integer from memory starting at p[0].
 * Return the number of bytes read, or 0 on error.
 * The value is stored in *v. */
static int getVarint(const char *p, sqlite_int64 *v){
  const unsigned char *q = (const unsigned char *) p;
  sqlite_uint64 x = 0, y = 1;
  while( (*q & 0x80) == 0x80 ){
    x += y * (*q++ & 0x7f);
    y <<= 7;
    if( q - (unsigned char *)p >= VARINT_MAX ){  /* bad data */
      assert( 0 );
      return 0;
    }
  }
  x += y * (*q++);
  *v = (sqlite_int64) x;
  return (int) (q - (unsigned char *)p);
}

static int getVarint32(const char *p, int *pi){
 sqlite_int64 i;
 int ret = getVarint(p, &i);
 *pi = (int) i;
 assert( *pi==i );
 return ret;
}

/*** Document lists ***
 *
 * A document list holds a sorted list of varint-encoded document IDs.
 *
 * A doclist with type DL_POSITIONS_OFFSETS is stored like this:
 *
 * array {
 *   varint docid;
 *   array {
 *     varint position;     (delta from previous position plus POS_BASE)
 *     varint startOffset;  (delta from previous startOffset)
 *     varint endOffset;    (delta from startOffset)
 *   }
 * }
 *
 * Here, array { X } means zero or more occurrences of X, adjacent in memory.
 *
 * A position list may hold positions for text in multiple columns.  A position
 * POS_COLUMN is followed by a varint containing the index of the column for
 * following positions in the list.  Any positions appearing before any
 * occurrences of POS_COLUMN are for column 0.
 *
 * A doclist with type DL_POSITIONS is like the above, but holds only docids
 * and positions without offset information.
 *
 * A doclist with type DL_DOCIDS is like the above, but holds only docids
 * without positions or offset information.
 *
 * On disk, every document list has positions and offsets, so we don't bother
 * to serialize a doclist's type.
 * 
 * We don't yet delta-encode document IDs; doing so will probably be a
 * modest win.
 *
 * NOTE(shess) I've thought of a slightly (1%) better offset encoding.
 * After the first offset, estimate the next offset by using the
 * current token position and the previous token position and offset,
 * offset to handle some variance.  So the estimate would be
 * (iPosition*w->iStartOffset/w->iPosition-64), which is delta-encoded
 * as normal.  Offsets more than 64 chars from the estimate are
 * encoded as the delta to the previous start offset + 128.  An
 * additional tiny increment can be gained by using the end offset of
 * the previous token to make the estimate a tiny bit more precise.
*/

/* It is not safe to call isspace(), tolower(), or isalnum() on
** hi-bit-set characters.  This is the same solution used in the
** tokenizer.
*/
/* TODO(shess) The snippet-generation code should be using the
** tokenizer-generated tokens rather than doing its own local
** tokenization.
*/
/* TODO(shess) Is __isascii() a portable version of (c&0x80)==0? */
static int safe_isspace(char c){
  return (c&0x80)==0 ? isspace(c) : 0;
}
static int safe_tolower(char c){
  return (c&0x80)==0 ? tolower(c) : c;
}
static int safe_isalnum(char c){
  return (c&0x80)==0 ? isalnum(c) : 0;
}

typedef enum DocListType {
  DL_DOCIDS,              /* docids only */
  DL_POSITIONS,           /* docids + positions */
  DL_POSITIONS_OFFSETS    /* docids + positions + offsets */
} DocListType;

/*
** By default, only positions and not offsets are stored in the doclists.
** To change this so that offsets are stored too, compile with
**
**          -DDL_DEFAULT=DL_POSITIONS_OFFSETS
**
*/
#ifndef DL_DEFAULT
# define DL_DEFAULT DL_POSITIONS
#endif

typedef struct DocList {
  char *pData;
  int nData;
  DocListType iType;
  int iLastColumn;    /* the last column written */
  int iLastPos;       /* the last position written */
  int iLastOffset;    /* the last start offset written */
} DocList;

enum {
  POS_END = 0,        /* end of this position list */
  POS_COLUMN,         /* followed by new column number */
  POS_BASE
};

/* Initialize a new DocList to hold the given data. */
static void docListInit(DocList *d, DocListType iType,
                        const char *pData, int nData){
  d->nData = nData;
  if( nData>0 ){
    d->pData = malloc(nData);
    memcpy(d->pData, pData, nData);
  } else {
    d->pData = NULL;
  }
  d->iType = iType;
  d->iLastColumn = 0;
  d->iLastPos = d->iLastOffset = 0;
}

/* Create a new dynamically-allocated DocList. */
static DocList *docListNew(DocListType iType){
  DocList *d = (DocList *) malloc(sizeof(DocList));
  docListInit(d, iType, 0, 0);
  return d;
}

static void docListDestroy(DocList *d){
  free(d->pData);
#ifndef NDEBUG
  memset(d, 0x55, sizeof(*d));
#endif
}

static void docListDelete(DocList *d){
  docListDestroy(d);
  free(d);
}

static char *docListEnd(DocList *d){
  return d->pData + d->nData;
}

/* Append a varint to a DocList's data. */
static void appendVarint(DocList *d, sqlite_int64 i){
  char c[VARINT_MAX];
  int n = putVarint(c, i);
  d->pData = realloc(d->pData, d->nData + n);
  memcpy(d->pData + d->nData, c, n);
  d->nData += n;
}

static void docListAddDocid(DocList *d, sqlite_int64 iDocid){
  appendVarint(d, iDocid);
  if( d->iType>=DL_POSITIONS ){
    appendVarint(d, POS_END);  /* initially empty position list */
    d->iLastColumn = 0;
    d->iLastPos = d->iLastOffset = 0;
  }
}

/* helper function for docListAddPos and docListAddPosOffset */
static void addPos(DocList *d, int iColumn, int iPos){
  assert( d->nData>0 );
  --d->nData;  /* remove previous terminator */
  if( iColumn!=d->iLastColumn ){
    assert( iColumn>d->iLastColumn );
    appendVarint(d, POS_COLUMN);
    appendVarint(d, iColumn);
    d->iLastColumn = iColumn;
    d->iLastPos = d->iLastOffset = 0;
  }
  assert( iPos>=d->iLastPos );
  appendVarint(d, iPos-d->iLastPos+POS_BASE);
  d->iLastPos = iPos;
}

/* Add a position to the last position list in a doclist. */
static void docListAddPos(DocList *d, int iColumn, int iPos){
  assert( d->iType==DL_POSITIONS );
  addPos(d, iColumn, iPos);
  appendVarint(d, POS_END);  /* add new terminator */
}

/*
** Add a position and starting and ending offsets to a doclist.
**
** If the doclist is setup to handle only positions, then insert
** the position only and ignore the offsets.
*/
static void docListAddPosOffset(
  DocList *d,             /* Doclist under construction */
  int iColumn,            /* Column the inserted term is part of */
  int iPos,               /* Position of the inserted term */
  int iStartOffset,       /* Starting offset of inserted term */
  int iEndOffset          /* Ending offset of inserted term */
){
  assert( d->iType>=DL_POSITIONS );
  addPos(d, iColumn, iPos);
  if( d->iType==DL_POSITIONS_OFFSETS ){
    assert( iStartOffset>=d->iLastOffset );
    appendVarint(d, iStartOffset-d->iLastOffset);
    d->iLastOffset = iStartOffset;
    assert( iEndOffset>=iStartOffset );
    appendVarint(d, iEndOffset-iStartOffset);
  }
  appendVarint(d, POS_END);  /* add new terminator */
}

/*
** A DocListReader object is a cursor into a doclist.  Initialize
** the cursor to the beginning of the doclist by calling readerInit().
** Then use routines
**
**      peekDocid()
**      readDocid()
**      readPosition()
**      skipPositionList()
**      and so forth...
**
** to read information out of the doclist.  When we reach the end
** of the doclist, atEnd() returns TRUE.
*/
typedef struct DocListReader {
  DocList *pDoclist;  /* The document list we are stepping through */
  char *p;            /* Pointer to next unread byte in the doclist */
  int iLastColumn;
  int iLastPos;  /* the last position read, or -1 when not in a position list */
} DocListReader;

/*
** Initialize the DocListReader r to point to the beginning of pDoclist.
*/
static void readerInit(DocListReader *r, DocList *pDoclist){
  r->pDoclist = pDoclist;
  if( pDoclist!=NULL ){
    r->p = pDoclist->pData;
  }
  r->iLastColumn = -1;
  r->iLastPos = -1;
}

/*
** Return TRUE if we have reached then end of pReader and there is
** nothing else left to read.
*/
static int atEnd(DocListReader *pReader){
  return pReader->pDoclist==0 || (pReader->p >= docListEnd(pReader->pDoclist));
}

/* Peek at the next docid without advancing the read pointer. 
*/
static sqlite_int64 peekDocid(DocListReader *pReader){
  sqlite_int64 ret;
  assert( !atEnd(pReader) );
  assert( pReader->iLastPos==-1 );
  getVarint(pReader->p, &ret);
  return ret;
}

/* Read the next docid.   See also nextDocid().
*/
static sqlite_int64 readDocid(DocListReader *pReader){
  sqlite_int64 ret;
  assert( !atEnd(pReader) );
  assert( pReader->iLastPos==-1 );
  pReader->p += getVarint(pReader->p, &ret);
  if( pReader->pDoclist->iType>=DL_POSITIONS ){
    pReader->iLastColumn = 0;
    pReader->iLastPos = 0;
  }
  return ret;
}

/* Read the next position and column index from a position list.
 * Returns the position, or -1 at the end of the list. */
static int readPosition(DocListReader *pReader, int *iColumn){
  int i;
  int iType = pReader->pDoclist->iType;

  if( pReader->iLastPos==-1 ){
    return -1;
  }
  assert( !atEnd(pReader) );

  if( iType<DL_POSITIONS ){
    return -1;
  }
  pReader->p += getVarint32(pReader->p, &i);
  if( i==POS_END ){
    pReader->iLastColumn = pReader->iLastPos = -1;
    *iColumn = -1;
    return -1;
  }
  if( i==POS_COLUMN ){
    pReader->p += getVarint32(pReader->p, &pReader->iLastColumn);
    pReader->iLastPos = 0;
    pReader->p += getVarint32(pReader->p, &i);
    assert( i>=POS_BASE );
  }
  pReader->iLastPos += ((int) i)-POS_BASE;
  if( iType>=DL_POSITIONS_OFFSETS ){
    /* Skip over offsets, ignoring them for now. */
    int iStart, iEnd;
    pReader->p += getVarint32(pReader->p, &iStart);
    pReader->p += getVarint32(pReader->p, &iEnd);
  }
  *iColumn = pReader->iLastColumn;
  return pReader->iLastPos;
}

/* Skip past the end of a position list. */
static void skipPositionList(DocListReader *pReader){
  DocList *p = pReader->pDoclist;
  if( p && p->iType>=DL_POSITIONS ){
    int iColumn;
    while( readPosition(pReader, &iColumn)!=-1 ){}
  }
}

/* Skip over a docid, including its position list if the doclist has
 * positions. */
static void skipDocument(DocListReader *pReader){
  readDocid(pReader);
  skipPositionList(pReader);
}

/* Skip past all docids which are less than [iDocid].  Returns 1 if a docid
 * matching [iDocid] was found.  */
static int skipToDocid(DocListReader *pReader, sqlite_int64 iDocid){
  sqlite_int64 d = 0;
  while( !atEnd(pReader) && (d=peekDocid(pReader))<iDocid ){
    skipDocument(pReader);
  }
  return !atEnd(pReader) && d==iDocid;
}

/* Return the first document in a document list.
*/
static sqlite_int64 firstDocid(DocList *d){
  DocListReader r;
  readerInit(&r, d);
  return readDocid(&r);
}

#ifdef SQLITE_DEBUG
/*
** This routine is used for debugging purpose only.
**
** Write the content of a doclist to standard output.
*/
static void printDoclist(DocList *p){
  DocListReader r;
  const char *zSep = "";

  readerInit(&r, p);
  while( !atEnd(&r) ){
    sqlite_int64 docid = readDocid(&r);
    if( docid==0 ){
      skipPositionList(&r);
      continue;
    }
    printf("%s%lld", zSep, docid);
    zSep =  ",";
    if( p->iType>=DL_POSITIONS ){
      int iPos, iCol;
      const char *zDiv = "";
      printf("(");
      while( (iPos = readPosition(&r, &iCol))>=0 ){
        printf("%s%d:%d", zDiv, iCol, iPos);
        zDiv = ":";
      }
      printf(")");
    }
  }
  printf("\n");
  fflush(stdout);
}
#endif /* SQLITE_DEBUG */

/* Trim the given doclist to contain only positions in column
 * [iRestrictColumn]. */
static void docListRestrictColumn(DocList *in, int iRestrictColumn){
  DocListReader r;
  DocList out;

  assert( in->iType>=DL_POSITIONS );
  readerInit(&r, in);
  docListInit(&out, DL_POSITIONS, NULL, 0);

  while( !atEnd(&r) ){
    sqlite_int64 iDocid = readDocid(&r);
    int iPos, iColumn;

    docListAddDocid(&out, iDocid);
    while( (iPos = readPosition(&r, &iColumn)) != -1 ){
      if( iColumn==iRestrictColumn ){
        docListAddPos(&out, iColumn, iPos);
      }
    }
  }

  docListDestroy(in);
  *in = out;
}

/* Trim the given doclist by discarding any docids without any remaining
 * positions. */
static void docListDiscardEmpty(DocList *in) {
  DocListReader r;
  DocList out;

  /* TODO: It would be nice to implement this operation in place; that
   * could save a significant amount of memory in queries with long doclists. */
  assert( in->iType>=DL_POSITIONS );
  readerInit(&r, in);
  docListInit(&out, DL_POSITIONS, NULL, 0);

  while( !atEnd(&r) ){
    sqlite_int64 iDocid = readDocid(&r);
    int match = 0;
    int iPos, iColumn;
    while( (iPos = readPosition(&r, &iColumn)) != -1 ){
      if( !match ){
        docListAddDocid(&out, iDocid);
        match = 1;
      }
      docListAddPos(&out, iColumn, iPos);
    }
  }

  docListDestroy(in);
  *in = out;
}

/* Helper function for docListUpdate() and docListAccumulate().
** Splices a doclist element into the doclist represented by r,
** leaving r pointing after the newly spliced element.
*/
static void docListSpliceElement(DocListReader *r, sqlite_int64 iDocid,
                                 const char *pSource, int nSource){
  DocList *d = r->pDoclist;
  char *pTarget;
  int nTarget, found;

  found = skipToDocid(r, iDocid);

  /* Describe slice in d to place pSource/nSource. */
  pTarget = r->p;
  if( found ){
    skipDocument(r);
    nTarget = r->p-pTarget;
  }else{
    nTarget = 0;
  }

  /* The sense of the following is that there are three possibilities.
  ** If nTarget==nSource, we should not move any memory nor realloc.
  ** If nTarget>nSource, trim target and realloc.
  ** If nTarget<nSource, realloc then expand target.
  */
  if( nTarget>nSource ){
    memmove(pTarget+nSource, pTarget+nTarget, docListEnd(d)-(pTarget+nTarget));
  }
  if( nTarget!=nSource ){
    int iDoclist = pTarget-d->pData;
    d->pData = realloc(d->pData, d->nData+nSource-nTarget);
    pTarget = d->pData+iDoclist;
  }
  if( nTarget<nSource ){
    memmove(pTarget+nSource, pTarget+nTarget, docListEnd(d)-(pTarget+nTarget));
  }

  memcpy(pTarget, pSource, nSource);
  d->nData += nSource-nTarget;
  r->p = pTarget+nSource;
}

/* Insert/update pUpdate into the doclist. */
static void docListUpdate(DocList *d, DocList *pUpdate){
  DocListReader reader;

  assert( d!=NULL && pUpdate!=NULL );
  assert( d->iType==pUpdate->iType);

  readerInit(&reader, d);
  docListSpliceElement(&reader, firstDocid(pUpdate),
                       pUpdate->pData, pUpdate->nData);
}

/* Propagate elements from pUpdate to pAcc, overwriting elements with
** matching docids.
*/
static void docListAccumulate(DocList *pAcc, DocList *pUpdate){
  DocListReader accReader, updateReader;

  /* Handle edge cases where one doclist is empty. */
  assert( pAcc!=NULL );
  if( pUpdate==NULL || pUpdate->nData==0 ) return;
  if( pAcc->nData==0 ){
    pAcc->pData = malloc(pUpdate->nData);
    memcpy(pAcc->pData, pUpdate->pData, pUpdate->nData);
    pAcc->nData = pUpdate->nData;
    return;
  }

  readerInit(&accReader, pAcc);
  readerInit(&updateReader, pUpdate);

  while( !atEnd(&updateReader) ){
    char *pSource = updateReader.p;
    sqlite_int64 iDocid = readDocid(&updateReader);
    skipPositionList(&updateReader);
    docListSpliceElement(&accReader, iDocid, pSource, updateReader.p-pSource);
  }
}

/*
** Read the next docid off of pIn.  Return 0 if we reach the end.
*
* TODO: This assumes that docids are never 0, but they may actually be 0 since
* users can choose docids when inserting into a full-text table.  Fix this.
*/
static sqlite_int64 nextDocid(DocListReader *pIn){
  skipPositionList(pIn);
  return atEnd(pIn) ? 0 : readDocid(pIn);
}

/*
** pLeft and pRight are two DocListReaders that are pointing to
** positions lists of the same document: iDocid. 
**
** If there are no instances in pLeft or pRight where the position
** of pLeft is one less than the position of pRight, then this
** routine adds nothing to pOut.
**
** If there are one or more instances where positions from pLeft
** are exactly one less than positions from pRight, then add a new
** document record to pOut.  If pOut wants to hold positions, then
** include the positions from pRight that are one more than a
** position in pLeft.  In other words:  pRight.iPos==pLeft.iPos+1.
**
** pLeft and pRight are left pointing at the next document record.
*/
static void mergePosList(
  DocListReader *pLeft,    /* Left position list */
  DocListReader *pRight,   /* Right position list */
  sqlite_int64 iDocid,     /* The docid from pLeft and pRight */
  DocList *pOut            /* Write the merged document record here */
){
  int iLeftCol, iLeftPos = readPosition(pLeft, &iLeftCol);
  int iRightCol, iRightPos = readPosition(pRight, &iRightCol);
  int match = 0;

  /* Loop until we've reached the end of both position lists. */
  while( iLeftPos!=-1 && iRightPos!=-1 ){
    if( iLeftCol==iRightCol && iLeftPos+1==iRightPos ){
      if( !match ){
        docListAddDocid(pOut, iDocid);
        match = 1;
      }
      if( pOut->iType>=DL_POSITIONS ){
        docListAddPos(pOut, iRightCol, iRightPos);
      }
      iLeftPos = readPosition(pLeft, &iLeftCol);
      iRightPos = readPosition(pRight, &iRightCol);
    }else if( iRightCol<iLeftCol ||
              (iRightCol==iLeftCol && iRightPos<iLeftPos+1) ){
      iRightPos = readPosition(pRight, &iRightCol);
    }else{
      iLeftPos = readPosition(pLeft, &iLeftCol);
    }
  }
  if( iLeftPos>=0 ) skipPositionList(pLeft);
  if( iRightPos>=0 ) skipPositionList(pRight);
}

/* We have two doclists:  pLeft and pRight.
** Write the phrase intersection of these two doclists into pOut.
**
** A phrase intersection means that two documents only match
** if pLeft.iPos+1==pRight.iPos.
**
** The output pOut may or may not contain positions.  If pOut
** does contain positions, they are the positions of pRight.
*/
static void docListPhraseMerge(
  DocList *pLeft,    /* Doclist resulting from the words on the left */
  DocList *pRight,   /* Doclist for the next word to the right */
  DocList *pOut      /* Write the combined doclist here */
){
  DocListReader left, right;
  sqlite_int64 docidLeft, docidRight;

  readerInit(&left, pLeft);
  readerInit(&right, pRight);
  docidLeft = nextDocid(&left);
  docidRight = nextDocid(&right);

  while( docidLeft>0 && docidRight>0 ){
    if( docidLeft<docidRight ){
      docidLeft = nextDocid(&left);
    }else if( docidRight<docidLeft ){
      docidRight = nextDocid(&right);
    }else{
      mergePosList(&left, &right, docidLeft, pOut);
      docidLeft = nextDocid(&left);
      docidRight = nextDocid(&right);
    }
  }
}

/* We have two doclists:  pLeft and pRight.
** Write the intersection of these two doclists into pOut.
** Only docids are matched.  Position information is ignored.
**
** The output pOut never holds positions.
*/
static void docListAndMerge(
  DocList *pLeft,    /* Doclist resulting from the words on the left */
  DocList *pRight,   /* Doclist for the next word to the right */
  DocList *pOut      /* Write the combined doclist here */
){
  DocListReader left, right;
  sqlite_int64 docidLeft, docidRight;

  assert( pOut->iType<DL_POSITIONS );

  readerInit(&left, pLeft);
  readerInit(&right, pRight);
  docidLeft = nextDocid(&left);
  docidRight = nextDocid(&right);

  while( docidLeft>0 && docidRight>0 ){
    if( docidLeft<docidRight ){
      docidLeft = nextDocid(&left);
    }else if( docidRight<docidLeft ){
      docidRight = nextDocid(&right);
    }else{
      docListAddDocid(pOut, docidLeft);
      docidLeft = nextDocid(&left);
      docidRight = nextDocid(&right);
    }
  }
}

/* We have two doclists:  pLeft and pRight.
** Write the union of these two doclists into pOut.
** Only docids are matched.  Position information is ignored.
**
** The output pOut never holds positions.
*/
static void docListOrMerge(
  DocList *pLeft,    /* Doclist resulting from the words on the left */
  DocList *pRight,   /* Doclist for the next word to the right */
  DocList *pOut      /* Write the combined doclist here */
){
  DocListReader left, right;
  sqlite_int64 docidLeft, docidRight, priorLeft;

  readerInit(&left, pLeft);
  readerInit(&right, pRight);
  docidLeft = nextDocid(&left);
  docidRight = nextDocid(&right);

  while( docidLeft>0 && docidRight>0 ){
    if( docidLeft<=docidRight ){
      docListAddDocid(pOut, docidLeft);
    }else{
      docListAddDocid(pOut, docidRight);
    }
    priorLeft = docidLeft;
    if( docidLeft<=docidRight ){
      docidLeft = nextDocid(&left);
    }
    if( docidRight>0 && docidRight<=priorLeft ){
      docidRight = nextDocid(&right);
    }
  }
  while( docidLeft>0 ){
    docListAddDocid(pOut, docidLeft);
    docidLeft = nextDocid(&left);
  }
  while( docidRight>0 ){
    docListAddDocid(pOut, docidRight);
    docidRight = nextDocid(&right);
  }
}

/* We have two doclists:  pLeft and pRight.
** Write into pOut all documents that occur in pLeft but not
** in pRight.
**
** Only docids are matched.  Position information is ignored.
**
** The output pOut never holds positions.
*/
static void docListExceptMerge(
  DocList *pLeft,    /* Doclist resulting from the words on the left */
  DocList *pRight,   /* Doclist for the next word to the right */
  DocList *pOut      /* Write the combined doclist here */
){
  DocListReader left, right;
  sqlite_int64 docidLeft, docidRight, priorLeft;

  readerInit(&left, pLeft);
  readerInit(&right, pRight);
  docidLeft = nextDocid(&left);
  docidRight = nextDocid(&right);

  while( docidLeft>0 && docidRight>0 ){
    priorLeft = docidLeft;
    if( docidLeft<docidRight ){
      docListAddDocid(pOut, docidLeft);
    }
    if( docidLeft<=docidRight ){
      docidLeft = nextDocid(&left);
    }
    if( docidRight>0 && docidRight<=priorLeft ){
      docidRight = nextDocid(&right);
    }
  }
  while( docidLeft>0 ){
    docListAddDocid(pOut, docidLeft);
    docidLeft = nextDocid(&left);
  }
}

static char *string_dup_n(const char *s, int n){
  char *str = malloc(n + 1);
  memcpy(str, s, n);
  str[n] = '\0';
  return str;
}

/* Duplicate a string; the caller must free() the returned string.
 * (We don't use strdup() since it's not part of the standard C library and
 * may not be available everywhere.) */
static char *string_dup(const char *s){
  return string_dup_n(s, strlen(s));
}

/* Format a string, replacing each occurrence of the % character with
 * zDb.zName.  This may be more convenient than sqlite_mprintf()
 * when one string is used repeatedly in a format string.
 * The caller must free() the returned string. */
static char *string_format(const char *zFormat,
                           const char *zDb, const char *zName){
  const char *p;
  size_t len = 0;
  size_t nDb = strlen(zDb);
  size_t nName = strlen(zName);
  size_t nFullTableName = nDb+1+nName;
  char *result;
  char *r;

  /* first compute length needed */
  for(p = zFormat ; *p ; ++p){
    len += (*p=='%' ? nFullTableName : 1);
  }
  len += 1;  /* for null terminator */

  r = result = malloc(len);
  for(p = zFormat; *p; ++p){
    if( *p=='%' ){
      memcpy(r, zDb, nDb);
      r += nDb;
      *r++ = '.';
      memcpy(r, zName, nName);
      r += nName;
    } else {
      *r++ = *p;
    }
  }
  *r++ = '\0';
  assert( r == result + len );
  return result;
}

static int sql_exec(sqlite3 *db, const char *zDb, const char *zName,
                    const char *zFormat){
  char *zCommand = string_format(zFormat, zDb, zName);
  int rc;
  TRACE(("FTS1 sql: %s\n", zCommand));
  rc = sqlite3_exec(db, zCommand, NULL, 0, NULL);
  free(zCommand);
  return rc;
}

static int sql_prepare(sqlite3 *db, const char *zDb, const char *zName,
                       sqlite3_stmt **ppStmt, const char *zFormat){
  char *zCommand = string_format(zFormat, zDb, zName);
  int rc;
  TRACE(("FTS1 prepare: %s\n", zCommand));
  rc = sqlite3_prepare(db, zCommand, -1, ppStmt, NULL);
  free(zCommand);
  return rc;
}

/* end utility functions */

/* Forward reference */
typedef struct fulltext_vtab fulltext_vtab;

/* A single term in a query is represented by an instances of
** the following structure.
*/
typedef struct QueryTerm {
  short int nPhrase; /* How many following terms are part of the same phrase */
  short int iPhrase; /* This is the i-th term of a phrase. */
  short int iColumn; /* Column of the index that must match this term */
  signed char isOr;  /* this term is preceded by "OR" */
  signed char isNot; /* this term is preceded by "-" */
  char *pTerm;       /* text of the term.  '\000' terminated.  malloced */
  int nTerm;         /* Number of bytes in pTerm[] */
} QueryTerm;


/* A query string is parsed into a Query structure.
 *
 * We could, in theory, allow query strings to be complicated
 * nested expressions with precedence determined by parentheses.
 * But none of the major search engines do this.  (Perhaps the
 * feeling is that an parenthesized expression is two complex of
 * an idea for the average user to grasp.)  Taking our lead from
 * the major search engines, we will allow queries to be a list
 * of terms (with an implied AND operator) or phrases in double-quotes,
 * with a single optional "-" before each non-phrase term to designate
 * negation and an optional OR connector.
 *
 * OR binds more tightly than the implied AND, which is what the
 * major search engines seem to do.  So, for example:
 * 
 *    [one two OR three]     ==>    one AND (two OR three)
 *    [one OR two three]     ==>    (one OR two) AND three
 *
 * A "-" before a term matches all entries that lack that term.
 * The "-" must occur immediately before the term with in intervening
 * space.  This is how the search engines do it.
 *
 * A NOT term cannot be the right-hand operand of an OR.  If this
 * occurs in the query string, the NOT is ignored:
 *
 *    [one OR -two]          ==>    one OR two
 *
 */
typedef struct Query {
  fulltext_vtab *pFts;  /* The full text index */
  int nTerms;           /* Number of terms in the query */
  QueryTerm *pTerms;    /* Array of terms.  Space obtained from malloc() */
  int nextIsOr;         /* Set the isOr flag on the next inserted term */
  int nextColumn;       /* Next word parsed must be in this column */
  int dfltColumn;       /* The default column */
} Query;


/*
** An instance of the following structure keeps track of generated
** matching-word offset information and snippets.
*/
typedef struct Snippet {
  int nMatch;     /* Total number of matches */
  int nAlloc;     /* Space allocated for aMatch[] */
  struct snippetMatch { /* One entry for each matching term */
    char snStatus;       /* Status flag for use while constructing snippets */
    short int iCol;      /* The column that contains the match */
    short int iTerm;     /* The index in Query.pTerms[] of the matching term */
    short int nByte;     /* Number of bytes in the term */
    int iStart;          /* The offset to the first character of the term */
  } *aMatch;      /* Points to space obtained from malloc */
  char *zOffset;  /* Text rendering of aMatch[] */
  int nOffset;    /* strlen(zOffset) */
  char *zSnippet; /* Snippet text */
  int nSnippet;   /* strlen(zSnippet) */
} Snippet;


typedef enum QueryType {
  QUERY_GENERIC,   /* table scan */
  QUERY_ROWID,     /* lookup by rowid */
  QUERY_FULLTEXT   /* QUERY_FULLTEXT + [i] is a full-text search for column i*/
} QueryType;

/* TODO(shess) CHUNK_MAX controls how much data we allow in segment 0
** before we start aggregating into larger segments.  Lower CHUNK_MAX
** means that for a given input we have more individual segments per
** term, which means more rows in the table and a bigger index (due to
** both more rows and bigger rowids).  But it also reduces the average
** cost of adding new elements to the segment 0 doclist, and it seems
** to reduce the number of pages read and written during inserts.  256
** was chosen by measuring insertion times for a certain input (first
** 10k documents of Enron corpus), though including query performance
** in the decision may argue for a larger value.
*/
#define CHUNK_MAX 256

typedef enum fulltext_statement {
  CONTENT_INSERT_STMT,
  CONTENT_SELECT_STMT,
  CONTENT_UPDATE_STMT,
  CONTENT_DELETE_STMT,

  TERM_SELECT_STMT,
  TERM_SELECT_ALL_STMT,
  TERM_INSERT_STMT,
  TERM_UPDATE_STMT,
  TERM_DELETE_STMT,

  MAX_STMT                     /* Always at end! */
} fulltext_statement;

/* These must exactly match the enum above. */
/* TODO(adam): Is there some risk that a statement (in particular,
** pTermSelectStmt) will be used in two cursors at once, e.g.  if a
** query joins a virtual table to itself?  If so perhaps we should
** move some of these to the cursor object.
*/
static const char *const fulltext_zStatement[MAX_STMT] = {
  /* CONTENT_INSERT */ NULL,  /* generated in contentInsertStatement() */
  /* CONTENT_SELECT */ "select * from %_content where rowid = ?",
  /* CONTENT_UPDATE */ NULL,  /* generated in contentUpdateStatement() */
  /* CONTENT_DELETE */ "delete from %_content where rowid = ?",

  /* TERM_SELECT */
  "select rowid, doclist from %_term where term = ? and segment = ?",
  /* TERM_SELECT_ALL */
  "select doclist from %_term where term = ? order by segment",
  /* TERM_INSERT */
  "insert into %_term (rowid, term, segment, doclist) values (?, ?, ?, ?)",
  /* TERM_UPDATE */ "update %_term set doclist = ? where rowid = ?",
  /* TERM_DELETE */ "delete from %_term where rowid = ?",
};

/*
** A connection to a fulltext index is an instance of the following
** structure.  The xCreate and xConnect methods create an instance
** of this structure and xDestroy and xDisconnect free that instance.
** All other methods receive a pointer to the structure as one of their
** arguments.
*/
struct fulltext_vtab {
  sqlite3_vtab base;               /* Base class used by SQLite core */
  sqlite3 *db;                     /* The database connection */
  const char *zDb;                 /* logical database name */
  const char *zName;               /* virtual table name */
  int nColumn;                     /* number of columns in virtual table */
  char **azColumn;                 /* column names.  malloced */
  char **azContentColumn;          /* column names in content table; malloced */
  sqlite3_tokenizer *pTokenizer;   /* tokenizer for inserts and queries */

  /* Precompiled statements which we keep as long as the table is
  ** open.
  */
  sqlite3_stmt *pFulltextStatements[MAX_STMT];
};

/*
** When the core wants to do a query, it create a cursor using a
** call to xOpen.  This structure is an instance of a cursor.  It
** is destroyed by xClose.
*/
typedef struct fulltext_cursor {
  sqlite3_vtab_cursor base;        /* Base class used by SQLite core */
  QueryType iCursorType;           /* Copy of sqlite3_index_info.idxNum */
  sqlite3_stmt *pStmt;             /* Prepared statement in use by the cursor */
  int eof;                         /* True if at End Of Results */
  Query q;                         /* Parsed query string */
  Snippet snippet;                 /* Cached snippet for the current row */
  int iColumn;                     /* Column being searched */
  DocListReader result;  /* used when iCursorType == QUERY_FULLTEXT */ 
} fulltext_cursor;

static struct fulltext_vtab *cursor_vtab(fulltext_cursor *c){
  return (fulltext_vtab *) c->base.pVtab;
}

static const sqlite3_module fulltextModule;   /* forward declaration */

/* Append a list of strings separated by commas to a StringBuffer. */
static void appendList(StringBuffer *sb, int nString, char **azString){
  int i;
  for(i=0; i<nString; ++i){
    if( i>0 ) append(sb, ", ");
    append(sb, azString[i]);
  }
}

/* Return a dynamically generated statement of the form
 *   insert into %_content (rowid, ...) values (?, ...)
 */
static const char *contentInsertStatement(fulltext_vtab *v){
  StringBuffer sb;
  int i;

  initStringBuffer(&sb);
  append(&sb, "insert into %_content (rowid, ");
  appendList(&sb, v->nColumn, v->azContentColumn);
  append(&sb, ") values (?");
  for(i=0; i<v->nColumn; ++i)
    append(&sb, ", ?");
  append(&sb, ")");
  return sb.s;
}

/* Return a dynamically generated statement of the form
 *   update %_content set [col_0] = ?, [col_1] = ?, ...
 *                    where rowid = ?
 */
static const char *contentUpdateStatement(fulltext_vtab *v){
  StringBuffer sb;
  int i;

  initStringBuffer(&sb);
  append(&sb, "update %_content set ");
  for(i=0; i<v->nColumn; ++i) {
    if( i>0 ){
      append(&sb, ", ");
    }
    append(&sb, v->azContentColumn[i]);
    append(&sb, " = ?");
  }
  append(&sb, " where rowid = ?");
  return sb.s;
}

/* Puts a freshly-prepared statement determined by iStmt in *ppStmt.
** If the indicated statement has never been prepared, it is prepared
** and cached, otherwise the cached version is reset.
*/
static int sql_get_statement(fulltext_vtab *v, fulltext_statement iStmt,
                             sqlite3_stmt **ppStmt){
  assert( iStmt<MAX_STMT );
  if( v->pFulltextStatements[iStmt]==NULL ){
    const char *zStmt;
    int rc;
    switch( iStmt ){
      case CONTENT_INSERT_STMT:
        zStmt = contentInsertStatement(v); break;
      case CONTENT_UPDATE_STMT:
        zStmt = contentUpdateStatement(v); break;
      default:
        zStmt = fulltext_zStatement[iStmt];
    }
    rc = sql_prepare(v->db, v->zDb, v->zName, &v->pFulltextStatements[iStmt],
                         zStmt);
    if( zStmt != fulltext_zStatement[iStmt]) free((void *) zStmt);
    if( rc!=SQLITE_OK ) return rc;
  } else {
    int rc = sqlite3_reset(v->pFulltextStatements[iStmt]);
    if( rc!=SQLITE_OK ) return rc;
  }

  *ppStmt = v->pFulltextStatements[iStmt];
  return SQLITE_OK;
}

/* Step the indicated statement, handling errors SQLITE_BUSY (by
** retrying) and SQLITE_SCHEMA (by re-preparing and transferring
** bindings to the new statement).
** TODO(adam): We should extend this function so that it can work with
** statements declared locally, not only globally cached statements.
*/
static int sql_step_statement(fulltext_vtab *v, fulltext_statement iStmt,
                              sqlite3_stmt **ppStmt){
  int rc;
  sqlite3_stmt *s = *ppStmt;
  assert( iStmt<MAX_STMT );
  assert( s==v->pFulltextStatements[iStmt] );

  while( (rc=sqlite3_step(s))!=SQLITE_DONE && rc!=SQLITE_ROW ){
    if( rc==SQLITE_BUSY ) continue;
    if( rc!=SQLITE_ERROR ) return rc;

    /* If an SQLITE_SCHEMA error has occured, then finalizing this
     * statement is going to delete the fulltext_vtab structure. If
     * the statement just executed is in the pFulltextStatements[]
     * array, it will be finalized twice. So remove it before
     * calling sqlite3_finalize().
     */
    v->pFulltextStatements[iStmt] = NULL;
    rc = sqlite3_finalize(s);
    break;
  }
  return rc;

 err:
  sqlite3_finalize(s);
  return rc;
}

/* Like sql_step_statement(), but convert SQLITE_DONE to SQLITE_OK.
** Useful for statements like UPDATE, where we expect no results.
*/
static int sql_single_step_statement(fulltext_vtab *v,
                                     fulltext_statement iStmt,
                                     sqlite3_stmt **ppStmt){
  int rc = sql_step_statement(v, iStmt, ppStmt);
  return (rc==SQLITE_DONE) ? SQLITE_OK : rc;
}

/* insert into %_content (rowid, ...) values ([rowid], [pValues]) */
static int content_insert(fulltext_vtab *v, sqlite3_value *rowid,
                          sqlite3_value **pValues){
  sqlite3_stmt *s;
  int i;
  int rc = sql_get_statement(v, CONTENT_INSERT_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_value(s, 1, rowid);
  if( rc!=SQLITE_OK ) return rc;

  for(i=0; i<v->nColumn; ++i){
    rc = sqlite3_bind_value(s, 2+i, pValues[i]);
    if( rc!=SQLITE_OK ) return rc;
  }

  return sql_single_step_statement(v, CONTENT_INSERT_STMT, &s);
}

/* update %_content set col0 = pValues[0], col1 = pValues[1], ...
 *                  where rowid = [iRowid] */
static int content_update(fulltext_vtab *v, sqlite3_value **pValues,
                          sqlite_int64 iRowid){
  sqlite3_stmt *s;
  int i;
  int rc = sql_get_statement(v, CONTENT_UPDATE_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  for(i=0; i<v->nColumn; ++i){
    rc = sqlite3_bind_value(s, 1+i, pValues[i]);
    if( rc!=SQLITE_OK ) return rc;
  }

  rc = sqlite3_bind_int64(s, 1+v->nColumn, iRowid);
  if( rc!=SQLITE_OK ) return rc;

  return sql_single_step_statement(v, CONTENT_UPDATE_STMT, &s);
}

static void freeStringArray(int nString, const char **pString){
  int i;

  for (i=0 ; i < nString ; ++i) {
    if( pString[i]!=NULL ) free((void *) pString[i]);
  }
  free((void *) pString);
}

/* select * from %_content where rowid = [iRow]
 * The caller must delete the returned array and all strings in it.
 * null fields will be NULL in the returned array.
 *
 * TODO: Perhaps we should return pointer/length strings here for consistency
 * with other code which uses pointer/length. */
static int content_select(fulltext_vtab *v, sqlite_int64 iRow,
                          const char ***pValues){
  sqlite3_stmt *s;
  const char **values;
  int i;
  int rc;

  *pValues = NULL;

  rc = sql_get_statement(v, CONTENT_SELECT_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 1, iRow);
  if( rc!=SQLITE_OK ) return rc;

  rc = sql_step_statement(v, CONTENT_SELECT_STMT, &s);
  if( rc!=SQLITE_ROW ) return rc;

  values = (const char **) malloc(v->nColumn * sizeof(const char *));
  for(i=0; i<v->nColumn; ++i){
    if( sqlite3_column_type(s, i)==SQLITE_NULL ){
      values[i] = NULL;
    }else{
      values[i] = string_dup((char*)sqlite3_column_text(s, i));
    }
  }

  /* We expect only one row.  We must execute another sqlite3_step()
   * to complete the iteration; otherwise the table will remain locked. */
  rc = sqlite3_step(s);
  if( rc==SQLITE_DONE ){
    *pValues = values;
    return SQLITE_OK;
  }

  freeStringArray(v->nColumn, values);
  return rc;
}

/* delete from %_content where rowid = [iRow ] */
static int content_delete(fulltext_vtab *v, sqlite_int64 iRow){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, CONTENT_DELETE_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 1, iRow);
  if( rc!=SQLITE_OK ) return rc;

  return sql_single_step_statement(v, CONTENT_DELETE_STMT, &s);
}

/* select rowid, doclist from %_term
 *  where term = [pTerm] and segment = [iSegment]
 * If found, returns SQLITE_ROW; the caller must free the
 * returned doclist.  If no rows found, returns SQLITE_DONE. */
static int term_select(fulltext_vtab *v, const char *pTerm, int nTerm,
                       int iSegment,
                       sqlite_int64 *rowid, DocList *out){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, TERM_SELECT_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_text(s, 1, pTerm, nTerm, SQLITE_STATIC);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int(s, 2, iSegment);
  if( rc!=SQLITE_OK ) return rc;

  rc = sql_step_statement(v, TERM_SELECT_STMT, &s);
  if( rc!=SQLITE_ROW ) return rc;

  *rowid = sqlite3_column_int64(s, 0);
  docListInit(out, DL_DEFAULT,
              sqlite3_column_blob(s, 1), sqlite3_column_bytes(s, 1));

  /* We expect only one row.  We must execute another sqlite3_step()
   * to complete the iteration; otherwise the table will remain locked. */
  rc = sqlite3_step(s);
  return rc==SQLITE_DONE ? SQLITE_ROW : rc;
}

/* Load the segment doclists for term pTerm and merge them in
** appropriate order into out.  Returns SQLITE_OK if successful.  If
** there are no segments for pTerm, successfully returns an empty
** doclist in out.
**
** Each document consists of 1 or more "columns".  The number of
** columns is v->nColumn.  If iColumn==v->nColumn, then return
** position information about all columns.  If iColumn<v->nColumn,
** then only return position information about the iColumn-th column
** (where the first column is 0).
*/
static int term_select_all(
  fulltext_vtab *v,     /* The fulltext index we are querying against */
  int iColumn,          /* If <nColumn, only look at the iColumn-th column */
  const char *pTerm,    /* The term whose posting lists we want */
  int nTerm,            /* Number of bytes in pTerm */
  DocList *out          /* Write the resulting doclist here */
){
  DocList doclist;
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, TERM_SELECT_ALL_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_text(s, 1, pTerm, nTerm, SQLITE_STATIC);
  if( rc!=SQLITE_OK ) return rc;

  docListInit(&doclist, DL_DEFAULT, 0, 0);

  /* TODO(shess) Handle schema and busy errors. */
  while( (rc=sql_step_statement(v, TERM_SELECT_ALL_STMT, &s))==SQLITE_ROW ){
    DocList old;

    /* TODO(shess) If we processed doclists from oldest to newest, we
    ** could skip the malloc() involved with the following call.  For
    ** now, I'd rather keep this logic similar to index_insert_term().
    ** We could additionally drop elements when we see deletes, but
    ** that would require a distinct version of docListAccumulate().
    */
    docListInit(&old, DL_DEFAULT,
                sqlite3_column_blob(s, 0), sqlite3_column_bytes(s, 0));

    if( iColumn<v->nColumn ){   /* querying a single column */
      docListRestrictColumn(&old, iColumn);
    }

    /* doclist contains the newer data, so write it over old.  Then
    ** steal accumulated result for doclist.
    */
    docListAccumulate(&old, &doclist);
    docListDestroy(&doclist);
    doclist = old;
  }
  if( rc!=SQLITE_DONE ){
    docListDestroy(&doclist);
    return rc;
  }

  docListDiscardEmpty(&doclist);
  *out = doclist;
  return SQLITE_OK;
}

/* insert into %_term (rowid, term, segment, doclist)
               values ([piRowid], [pTerm], [iSegment], [doclist])
** Lets sqlite select rowid if piRowid is NULL, else uses *piRowid.
**
** NOTE(shess) piRowid is IN, with values of "space of int64" plus
** null, it is not used to pass data back to the caller.
*/
static int term_insert(fulltext_vtab *v, sqlite_int64 *piRowid,
                       const char *pTerm, int nTerm,
                       int iSegment, DocList *doclist){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, TERM_INSERT_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  if( piRowid==NULL ){
    rc = sqlite3_bind_null(s, 1);
  }else{
    rc = sqlite3_bind_int64(s, 1, *piRowid);
  }
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_text(s, 2, pTerm, nTerm, SQLITE_STATIC);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int(s, 3, iSegment);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_blob(s, 4, doclist->pData, doclist->nData, SQLITE_STATIC);
  if( rc!=SQLITE_OK ) return rc;

  return sql_single_step_statement(v, TERM_INSERT_STMT, &s);
}

/* update %_term set doclist = [doclist] where rowid = [rowid] */
static int term_update(fulltext_vtab *v, sqlite_int64 rowid,
                       DocList *doclist){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, TERM_UPDATE_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_blob(s, 1, doclist->pData, doclist->nData, SQLITE_STATIC);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 2, rowid);
  if( rc!=SQLITE_OK ) return rc;

  return sql_single_step_statement(v, TERM_UPDATE_STMT, &s);
}

static int term_delete(fulltext_vtab *v, sqlite_int64 rowid){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, TERM_DELETE_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 1, rowid);
  if( rc!=SQLITE_OK ) return rc;

  return sql_single_step_statement(v, TERM_DELETE_STMT, &s);
}

/*
** Free the memory used to contain a fulltext_vtab structure.
*/
static void fulltext_vtab_destroy(fulltext_vtab *v){
  int iStmt, i;

  TRACE(("FTS1 Destroy %p\n", v));
  for( iStmt=0; iStmt<MAX_STMT; iStmt++ ){
    if( v->pFulltextStatements[iStmt]!=NULL ){
      sqlite3_finalize(v->pFulltextStatements[iStmt]);
      v->pFulltextStatements[iStmt] = NULL;
    }
  }

  if( v->pTokenizer!=NULL ){
    v->pTokenizer->pModule->xDestroy(v->pTokenizer);
    v->pTokenizer = NULL;
  }
  
  free(v->azColumn);
  for(i = 0; i < v->nColumn; ++i) {
    sqlite3_free(v->azContentColumn[i]);
  }
  free(v->azContentColumn);
  free(v);
}

/*
** Token types for parsing the arguments to xConnect or xCreate.
*/
#define TOKEN_EOF         0    /* End of file */
#define TOKEN_SPACE       1    /* Any kind of whitespace */
#define TOKEN_ID          2    /* An identifier */
#define TOKEN_STRING      3    /* A string literal */
#define TOKEN_PUNCT       4    /* A single punctuation character */

/*
** If X is a character that can be used in an identifier then
** IdChar(X) will be true.  Otherwise it is false.
**
** For ASCII, any character with the high-order bit set is
** allowed in an identifier.  For 7-bit characters, 
** sqlite3IsIdChar[X] must be 1.
**
** Ticket #1066.  the SQL standard does not allow '$' in the
** middle of identfiers.  But many SQL implementations do. 
** SQLite will allow '$' in identifiers for compatibility.
** But the feature is undocumented.
*/
static const char isIdChar[] = {
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
    0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* 2x */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  /* 3x */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 4x */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,  /* 5x */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 6x */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,  /* 7x */
};
#define IdChar(C)  (((c=C)&0x80)!=0 || (c>0x1f && isIdChar[c-0x20]))


/*
** Return the length of the token that begins at z[0]. 
** Store the token type in *tokenType before returning.
*/
static int getToken(const char *z, int *tokenType){
  int i, c;
  switch( *z ){
    case 0: {
      *tokenType = TOKEN_EOF;
      return 0;
    }
    case ' ': case '\t': case '\n': case '\f': case '\r': {
      for(i=1; safe_isspace(z[i]); i++){}
      *tokenType = TOKEN_SPACE;
      return i;
    }
    case '`':
    case '\'':
    case '"': {
      int delim = z[0];
      for(i=1; (c=z[i])!=0; i++){
        if( c==delim ){
          if( z[i+1]==delim ){
            i++;
          }else{
            break;
          }
        }
      }
      *tokenType = TOKEN_STRING;
      return i + (c!=0);
    }
    case '[': {
      for(i=1, c=z[0]; c!=']' && (c=z[i])!=0; i++){}
      *tokenType = TOKEN_ID;
      return i;
    }
    default: {
      if( !IdChar(*z) ){
        break;
      }
      for(i=1; IdChar(z[i]); i++){}
      *tokenType = TOKEN_ID;
      return i;
    }
  }
  *tokenType = TOKEN_PUNCT;
  return 1;
}

/*
** A token extracted from a string is an instance of the following
** structure.
*/
typedef struct Token {
  const char *z;       /* Pointer to token text.  Not '\000' terminated */
  short int n;         /* Length of the token text in bytes. */
} Token;

/*
** Given a input string (which is really one of the argv[] parameters
** passed into xConnect or xCreate) split the string up into tokens.
** Return an array of pointers to '\000' terminated strings, one string
** for each non-whitespace token.
**
** The returned array is terminated by a single NULL pointer.
**
** Space to hold the returned array is obtained from a single
** malloc and should be freed by passing the return value to free().
** The individual strings within the token list are all a part of
** the single memory allocation and will all be freed at once.
*/
static char **tokenizeString(const char *z, int *pnToken){
  int nToken = 0;
  Token *aToken = malloc( strlen(z) * sizeof(aToken[0]) );
  int n = 1;
  int e, i;
  int totalSize = 0;
  char **azToken;
  char *zCopy;
  while( n>0 ){
    n = getToken(z, &e);
    if( e!=TOKEN_SPACE ){
      aToken[nToken].z = z;
      aToken[nToken].n = n;
      nToken++;
      totalSize += n+1;
    }
    z += n;
  }
  azToken = (char**)malloc( nToken*sizeof(char*) + totalSize );
  zCopy = (char*)&azToken[nToken];
  nToken--;
  for(i=0; i<nToken; i++){
    azToken[i] = zCopy;
    n = aToken[i].n;
    memcpy(zCopy, aToken[i].z, n);
    zCopy[n] = 0;
    zCopy += n+1;
  }
  azToken[nToken] = 0;
  free(aToken);
  *pnToken = nToken;
  return azToken;
}

/*
** Convert an SQL-style quoted string into a normal string by removing
** the quote characters.  The conversion is done in-place.  If the
** input does not begin with a quote character, then this routine
** is a no-op.
**
** Examples:
**
**     "abc"   becomes   abc
**     'xyz'   becomes   xyz
**     [pqr]   becomes   pqr
**     `mno`   becomes   mno
*/
static void dequoteString(char *z){
  int quote;
  int i, j;
  if( z==0 ) return;
  quote = z[0];
  switch( quote ){
    case '\'':  break;
    case '"':   break;
    case '`':   break;                /* For MySQL compatibility */
    case '[':   quote = ']';  break;  /* For MS SqlServer compatibility */
    default:    return;
  }
  for(i=1, j=0; z[i]; i++){
    if( z[i]==quote ){
      if( z[i+1]==quote ){
        z[j++] = quote;
        i++;
      }else{
        z[j++] = 0;
        break;
      }
    }else{
      z[j++] = z[i];
    }
  }
}

/*
** The input azIn is a NULL-terminated list of tokens.  Remove the first
** token and all punctuation tokens.  Remove the quotes from
** around string literal tokens.
**
** Example:
**
**     input:      tokenize chinese ( 'simplifed' , 'mixed' )
**     output:     chinese simplifed mixed
**
** Another example:
**
**     input:      delimiters ( '[' , ']' , '...' )
**     output:     [ ] ...
*/
static void tokenListToIdList(char **azIn){
  int i, j;
  if( azIn ){
    for(i=0, j=-1; azIn[i]; i++){
      if( safe_isalnum(azIn[i][0]) || azIn[i][1] ){
        dequoteString(azIn[i]);
        if( j>=0 ){
          azIn[j] = azIn[i];
        }
        j++;
      }
    }
    azIn[j] = 0;
  }
}


/*
** Find the first alphanumeric token in the string zIn.  Null-terminate
** this token.  Remove any quotation marks.  And return a pointer to
** the result.
*/
static char *firstToken(char *zIn, char **pzTail){
  int n, ttype;
  while(1){
    n = getToken(zIn, &ttype);
    if( ttype==TOKEN_SPACE ){
      zIn += n;
    }else if( ttype==TOKEN_EOF ){
      *pzTail = zIn;
      return 0;
    }else{
      zIn[n] = 0;
      *pzTail = &zIn[1];
      dequoteString(zIn);
      return zIn;
    }
  }
  /*NOTREACHED*/
}

/* Return true if...
**
**   *  s begins with the string t, ignoring case
**   *  s is longer than t
**   *  The first character of s beyond t is not a alphanumeric
** 
** Ignore leading space in *s.
**
** To put it another way, return true if the first token of
** s[] is t[].
*/
static int startsWith(const char *s, const char *t){
  while( safe_isspace(*s) ){ s++; }
  while( *t ){
    if( safe_tolower(*s++)!=safe_tolower(*t++) ) return 0;
  }
  return *s!='_' && !safe_isalnum(*s);
}

/*
** An instance of this structure defines the "spec" of a
** full text index.  This structure is populated by parseSpec
** and use by fulltextConnect and fulltextCreate.
*/
typedef struct TableSpec {
  const char *zDb;         /* Logical database name */
  const char *zName;       /* Name of the full-text index */
  int nColumn;             /* Number of columns to be indexed */
  char **azColumn;         /* Original names of columns to be indexed */
  char **azContentColumn;  /* Column names for %_content */
  char **azTokenizer;      /* Name of tokenizer and its arguments */
} TableSpec;

/*
** Reclaim all of the memory used by a TableSpec
*/
static void clearTableSpec(TableSpec *p) {
  free(p->azColumn);
  free(p->azContentColumn);
  free(p->azTokenizer);
}

/* Parse a CREATE VIRTUAL TABLE statement, which looks like this:
 *
 * CREATE VIRTUAL TABLE email
 *        USING fts1(subject, body, tokenize mytokenizer(myarg))
 *
 * We return parsed information in a TableSpec structure.
 * 
 */
static int parseSpec(TableSpec *pSpec, int argc, const char *const*argv,
                     char**pzErr){
  int i, n;
  char *z, *zDummy;
  char **azArg;
  const char *zTokenizer = 0;    /* argv[] entry describing the tokenizer */

  assert( argc>=3 );
  /* Current interface:
  ** argv[0] - module name
  ** argv[1] - database name
  ** argv[2] - table name
  ** argv[3..] - columns, optionally followed by tokenizer specification
  **             and snippet delimiters specification.
  */

  /* Make a copy of the complete argv[][] array in a single allocation.
  ** The argv[][] array is read-only and transient.  We can write to the
  ** copy in order to modify things and the copy is persistent.
  */
  memset(pSpec, 0, sizeof(*pSpec));
  for(i=n=0; i<argc; i++){
    n += strlen(argv[i]) + 1;
  }
  azArg = malloc( sizeof(char*)*argc + n );
  if( azArg==0 ){
    return SQLITE_NOMEM;
  }
  z = (char*)&azArg[argc];
  for(i=0; i<argc; i++){
    azArg[i] = z;
    strcpy(z, argv[i]);
    z += strlen(z)+1;
  }

  /* Identify the column names and the tokenizer and delimiter arguments
  ** in the argv[][] array.
  */
  pSpec->zDb = azArg[1];
  pSpec->zName = azArg[2];
  pSpec->nColumn = 0;
  pSpec->azColumn = azArg;
  zTokenizer = "tokenize simple";
  for(i=3; i<argc; ++i){
    if( startsWith(azArg[i],"tokenize") ){
      zTokenizer = azArg[i];
    }else{
      z = azArg[pSpec->nColumn] = firstToken(azArg[i], &zDummy);
      pSpec->nColumn++;
    }
  }
  if( pSpec->nColumn==0 ){
    azArg[0] = "content";
    pSpec->nColumn = 1;
  }

  /*
  ** Construct the list of content column names.
  **
  ** Each content column name will be of the form cNNAAAA
  ** where NN is the column number and AAAA is the sanitized
  ** column name.  "sanitized" means that special characters are
  ** converted to "_".  The cNN prefix guarantees that all column
  ** names are unique.
  **
  ** The AAAA suffix is not strictly necessary.  It is included
  ** for the convenience of people who might examine the generated
  ** %_content table and wonder what the columns are used for.
  */
  pSpec->azContentColumn = malloc( pSpec->nColumn * sizeof(char *) );
  if( pSpec->azContentColumn==0 ){
    clearTableSpec(pSpec);
    return SQLITE_NOMEM;
  }
  for(i=0; i<pSpec->nColumn; i++){
    char *p;
    pSpec->azContentColumn[i] = sqlite3_mprintf("c%d%s", i, azArg[i]);
    for (p = pSpec->azContentColumn[i]; *p ; ++p) {
      if( !safe_isalnum(*p) ) *p = '_';
    }
  }

  /*
  ** Parse the tokenizer specification string.
  */
  pSpec->azTokenizer = tokenizeString(zTokenizer, &n);
  tokenListToIdList(pSpec->azTokenizer);

  return SQLITE_OK;
}

/*
** Generate a CREATE TABLE statement that describes the schema of
** the virtual table.  Return a pointer to this schema string.
**
** Space is obtained from sqlite3_mprintf() and should be freed
** using sqlite3_free().
*/
static char *fulltextSchema(
  int nColumn,                  /* Number of columns */
  const char *const* azColumn,  /* List of columns */
  const char *zTableName        /* Name of the table */
){
  int i;
  char *zSchema, *zNext;
  const char *zSep = "(";
  zSchema = sqlite3_mprintf("CREATE TABLE x");
  for(i=0; i<nColumn; i++){
    zNext = sqlite3_mprintf("%s%s%Q", zSchema, zSep, azColumn[i]);
    sqlite3_free(zSchema);
    zSchema = zNext;
    zSep = ",";
  }
  zNext = sqlite3_mprintf("%s,%Q)", zSchema, zTableName);
  sqlite3_free(zSchema);
  return zNext;
}

/*
** Build a new sqlite3_vtab structure that will describe the
** fulltext index defined by spec.
*/
static int constructVtab(
  sqlite3 *db,              /* The SQLite database connection */
  TableSpec *spec,          /* Parsed spec information from parseSpec() */
  sqlite3_vtab **ppVTab,    /* Write the resulting vtab structure here */
  char **pzErr              /* Write any error message here */
){
  int rc;
  int n;
  fulltext_vtab *v = 0;
  const sqlite3_tokenizer_module *m = NULL;
  char *schema;

  v = (fulltext_vtab *) malloc(sizeof(fulltext_vtab));
  if( v==0 ) return SQLITE_NOMEM;
  memset(v, 0, sizeof(*v));
  /* sqlite will initialize v->base */
  v->db = db;
  v->zDb = spec->zDb;       /* Freed when azColumn is freed */
  v->zName = spec->zName;   /* Freed when azColumn is freed */
  v->nColumn = spec->nColumn;
  v->azContentColumn = spec->azContentColumn;
  spec->azContentColumn = 0;
  v->azColumn = spec->azColumn;
  spec->azColumn = 0;

  if( spec->azTokenizer==0 ){
    return SQLITE_NOMEM;
  }
  /* TODO(shess) For now, add new tokenizers as else if clauses. */
  if( spec->azTokenizer[0]==0 || startsWith(spec->azTokenizer[0], "simple") ){
    sqlite3Fts1SimpleTokenizerModule(&m);
  }else if( startsWith(spec->azTokenizer[0], "porter") ){
    sqlite3Fts1PorterTokenizerModule(&m);
  }else{
    *pzErr = sqlite3_mprintf("unknown tokenizer: %s", spec->azTokenizer[0]);
    rc = SQLITE_ERROR;
    goto err;
  }
  for(n=0; spec->azTokenizer[n]; n++){}
  if( n ){
    rc = m->xCreate(n-1, (const char*const*)&spec->azTokenizer[1],
                    &v->pTokenizer);
  }else{
    rc = m->xCreate(0, 0, &v->pTokenizer);
  }
  if( rc!=SQLITE_OK ) goto err;
  v->pTokenizer->pModule = m;

  /* TODO: verify the existence of backing tables foo_content, foo_term */

  schema = fulltextSchema(v->nColumn, (const char*const*)v->azColumn,
                          spec->zName);
  rc = sqlite3_declare_vtab(db, schema);
  sqlite3_free(schema);
  if( rc!=SQLITE_OK ) goto err;

  memset(v->pFulltextStatements, 0, sizeof(v->pFulltextStatements));

  *ppVTab = &v->base;
  TRACE(("FTS1 Connect %p\n", v));

  return rc;

err:
  fulltext_vtab_destroy(v);
  return rc;
}

static int fulltextConnect(
  sqlite3 *db,
  void *pAux,
  int argc, const char *const*argv,
  sqlite3_vtab **ppVTab,
  char **pzErr
){
  TableSpec spec;
  int rc = parseSpec(&spec, argc, argv, pzErr);
  if( rc!=SQLITE_OK ) return rc;

  rc = constructVtab(db, &spec, ppVTab, pzErr);
  clearTableSpec(&spec);
  return rc;
}

  /* The %_content table holds the text of each document, with
  ** the rowid used as the docid.
  **
  ** The %_term table maps each term to a document list blob
  ** containing elements sorted by ascending docid, each element
  ** encoded as:
  **
  **   docid varint-encoded
  **   token elements:
  **     position+1 varint-encoded as delta from previous position
  **     start offset varint-encoded as delta from previous start offset
  **     end offset varint-encoded as delta from start offset
  **
  ** The sentinel position of 0 indicates the end of the token list.
  **
  ** Additionally, doclist blobs are chunked into multiple segments,
  ** using segment to order the segments.  New elements are added to
  ** the segment at segment 0, until it exceeds CHUNK_MAX.  Then
  ** segment 0 is deleted, and the doclist is inserted at segment 1.
  ** If there is already a doclist at segment 1, the segment 0 doclist
  ** is merged with it, the segment 1 doclist is deleted, and the
  ** merged doclist is inserted at segment 2, repeating those
  ** operations until an insert succeeds.
  **
  ** Since this structure doesn't allow us to update elements in place
  ** in case of deletion or update, these are simply written to
  ** segment 0 (with an empty token list in case of deletion), with
  ** docListAccumulate() taking care to retain lower-segment
  ** information in preference to higher-segment information.
  */
  /* TODO(shess) Provide a VACUUM type operation which both removes
  ** deleted elements which are no longer necessary, and duplicated
  ** elements.  I suspect this will probably not be necessary in
  ** practice, though.
  */
static int fulltextCreate(sqlite3 *db, void *pAux,
                          int argc, const char * const *argv,
                          sqlite3_vtab **ppVTab, char **pzErr){
  int rc;
  TableSpec spec;
  StringBuffer schema;
  TRACE(("FTS1 Create\n"));

  rc = parseSpec(&spec, argc, argv, pzErr);
  if( rc!=SQLITE_OK ) return rc;

  initStringBuffer(&schema);
  append(&schema, "CREATE TABLE %_content(");
  appendList(&schema, spec.nColumn, spec.azContentColumn);
  append(&schema, ")");
  rc = sql_exec(db, spec.zDb, spec.zName, schema.s);
  free(schema.s);
  if( rc!=SQLITE_OK ) goto out;

  rc = sql_exec(db, spec.zDb, spec.zName,
    "create table %_term(term text, segment integer, doclist blob, "
                        "primary key(term, segment));");
  if( rc!=SQLITE_OK ) goto out;

  rc = constructVtab(db, &spec, ppVTab, pzErr);

out:
  clearTableSpec(&spec);
  return rc;
}

/* Decide how to handle an SQL query. */
static int fulltextBestIndex(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){
  int i;
  TRACE(("FTS1 BestIndex\n"));

  for(i=0; i<pInfo->nConstraint; ++i){
    const struct sqlite3_index_constraint *pConstraint;
    pConstraint = &pInfo->aConstraint[i];
    if( pConstraint->usable ) {
      if( pConstraint->iColumn==-1 &&
          pConstraint->op==SQLITE_INDEX_CONSTRAINT_EQ ){
        pInfo->idxNum = QUERY_ROWID;      /* lookup by rowid */
        TRACE(("FTS1 QUERY_ROWID\n"));
      } else if( pConstraint->iColumn>=0 &&
                 pConstraint->op==SQLITE_INDEX_CONSTRAINT_MATCH ){
        /* full-text search */
        pInfo->idxNum = QUERY_FULLTEXT + pConstraint->iColumn;
        TRACE(("FTS1 QUERY_FULLTEXT %d\n", pConstraint->iColumn));
      } else continue;

      pInfo->aConstraintUsage[i].argvIndex = 1;
      pInfo->aConstraintUsage[i].omit = 1;

      /* An arbitrary value for now.
       * TODO: Perhaps rowid matches should be considered cheaper than
       * full-text searches. */
      pInfo->estimatedCost = 1.0;   

      return SQLITE_OK;
    }
  }
  pInfo->idxNum = QUERY_GENERIC;
  return SQLITE_OK;
}

static int fulltextDisconnect(sqlite3_vtab *pVTab){
  TRACE(("FTS1 Disconnect %p\n", pVTab));
  fulltext_vtab_destroy((fulltext_vtab *)pVTab);
  return SQLITE_OK;
}

static int fulltextDestroy(sqlite3_vtab *pVTab){
  fulltext_vtab *v = (fulltext_vtab *)pVTab;
  int rc;

  TRACE(("FTS1 Destroy %p\n", pVTab));
  rc = sql_exec(v->db, v->zDb, v->zName,
                "drop table if exists %_content;"
                "drop table if exists %_term;"
                );
  if( rc!=SQLITE_OK ) return rc;

  fulltext_vtab_destroy((fulltext_vtab *)pVTab);
  return SQLITE_OK;
}

static int fulltextOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){
  fulltext_cursor *c;

  c = (fulltext_cursor *) calloc(sizeof(fulltext_cursor), 1);
  /* sqlite will initialize c->base */
  *ppCursor = &c->base;
  TRACE(("FTS1 Open %p: %p\n", pVTab, c));

  return SQLITE_OK;
}


/* Free all of the dynamically allocated memory held by *q
*/
static void queryClear(Query *q){
  int i;
  for(i = 0; i < q->nTerms; ++i){
    free(q->pTerms[i].pTerm);
  }
  free(q->pTerms);
  memset(q, 0, sizeof(*q));
}

/* Free all of the dynamically allocated memory held by the
** Snippet
*/
static void snippetClear(Snippet *p){
  free(p->aMatch);
  free(p->zOffset);
  free(p->zSnippet);
  memset(p, 0, sizeof(*p));
}
/*
** Append a single entry to the p->aMatch[] log.
*/
static void snippetAppendMatch(
  Snippet *p,               /* Append the entry to this snippet */
  int iCol, int iTerm,      /* The column and query term */
  int iStart, int nByte     /* Offset and size of the match */
){
  int i;
  struct snippetMatch *pMatch;
  if( p->nMatch+1>=p->nAlloc ){
    p->nAlloc = p->nAlloc*2 + 10;
    p->aMatch = realloc(p->aMatch, p->nAlloc*sizeof(p->aMatch[0]) );
    if( p->aMatch==0 ){
      p->nMatch = 0;
      p->nAlloc = 0;
      return;
    }
  }
  i = p->nMatch++;
  pMatch = &p->aMatch[i];
  pMatch->iCol = iCol;
  pMatch->iTerm = iTerm;
  pMatch->iStart = iStart;
  pMatch->nByte = nByte;
}

/*
** Sizing information for the circular buffer used in snippetOffsetsOfColumn()
*/
#define FTS1_ROTOR_SZ   (32)
#define FTS1_ROTOR_MASK (FTS1_ROTOR_SZ-1)

/*
** Add entries to pSnippet->aMatch[] for every match that occurs against
** document zDoc[0..nDoc-1] which is stored in column iColumn.
*/
static void snippetOffsetsOfColumn(
  Query *pQuery,
  Snippet *pSnippet,
  int iColumn,
  const char *zDoc,
  int nDoc
){
  const sqlite3_tokenizer_module *pTModule;  /* The tokenizer module */
  sqlite3_tokenizer *pTokenizer;             /* The specific tokenizer */
  sqlite3_tokenizer_cursor *pTCursor;        /* Tokenizer cursor */
  fulltext_vtab *pVtab;                /* The full text index */
  int nColumn;                         /* Number of columns in the index */
  const QueryTerm *aTerm;              /* Query string terms */
  int nTerm;                           /* Number of query string terms */  
  int i, j;                            /* Loop counters */
  int rc;                              /* Return code */
  unsigned int match, prevMatch;       /* Phrase search bitmasks */
  const char *zToken;                  /* Next token from the tokenizer */
  int nToken;                          /* Size of zToken */
  int iBegin, iEnd, iPos;              /* Offsets of beginning and end */

  /* The following variables keep a circular buffer of the last
  ** few tokens */
  unsigned int iRotor = 0;             /* Index of current token */
  int iRotorBegin[FTS1_ROTOR_SZ];      /* Beginning offset of token */
  int iRotorLen[FTS1_ROTOR_SZ];        /* Length of token */

  pVtab = pQuery->pFts;
  nColumn = pVtab->nColumn;
  pTokenizer = pVtab->pTokenizer;
  pTModule = pTokenizer->pModule;
  rc = pTModule->xOpen(pTokenizer, zDoc, nDoc, &pTCursor);
  if( rc ) return;
  pTCursor->pTokenizer = pTokenizer;
  aTerm = pQuery->pTerms;
  nTerm = pQuery->nTerms;
  if( nTerm>=FTS1_ROTOR_SZ ){
    nTerm = FTS1_ROTOR_SZ - 1;
  }
  prevMatch = 0;
  while(1){
    rc = pTModule->xNext(pTCursor, &zToken, &nToken, &iBegin, &iEnd, &iPos);
    if( rc ) break;
    iRotorBegin[iRotor&FTS1_ROTOR_MASK] = iBegin;
    iRotorLen[iRotor&FTS1_ROTOR_MASK] = iEnd-iBegin;
    match = 0;
    for(i=0; i<nTerm; i++){
      int iCol;
      iCol = aTerm[i].iColumn;
      if( iCol>=0 && iCol<nColumn && iCol!=iColumn ) continue;
      if( aTerm[i].nTerm!=nToken ) continue;
      if( memcmp(aTerm[i].pTerm, zToken, nToken) ) continue;
      if( aTerm[i].iPhrase>1 && (prevMatch & (1<<i))==0 ) continue;
      match |= 1<<i;
      if( i==nTerm-1 || aTerm[i+1].iPhrase==1 ){
        for(j=aTerm[i].iPhrase-1; j>=0; j--){
          int k = (iRotor-j) & FTS1_ROTOR_MASK;
          snippetAppendMatch(pSnippet, iColumn, i-j,
                iRotorBegin[k], iRotorLen[k]);
        }
      }
    }
    prevMatch = match<<1;
    iRotor++;
  }
  pTModule->xClose(pTCursor);  
}


/*
** Compute all offsets for the current row of the query.  
** If the offsets have already been computed, this routine is a no-op.
*/
static void snippetAllOffsets(fulltext_cursor *p){
  int nColumn;
  int iColumn, i;
  int iFirst, iLast;
  fulltext_vtab *pFts;

  if( p->snippet.nMatch ) return;
  if( p->q.nTerms==0 ) return;
  pFts = p->q.pFts;
  nColumn = pFts->nColumn;
  iColumn = p->iCursorType - QUERY_FULLTEXT;
  if( iColumn<0 || iColumn>=nColumn ){
    iFirst = 0;
    iLast = nColumn-1;
  }else{
    iFirst = iColumn;
    iLast = iColumn;
  }
  for(i=iFirst; i<=iLast; i++){
    const char *zDoc;
    int nDoc;
    zDoc = (const char*)sqlite3_column_text(p->pStmt, i+1);
    nDoc = sqlite3_column_bytes(p->pStmt, i+1);
    snippetOffsetsOfColumn(&p->q, &p->snippet, i, zDoc, nDoc);
  }
}

/*
** Convert the information in the aMatch[] array of the snippet
** into the string zOffset[0..nOffset-1].
*/
static void snippetOffsetText(Snippet *p){
  int i;
  int cnt = 0;
  StringBuffer sb;
  char zBuf[200];
  if( p->zOffset ) return;
  initStringBuffer(&sb);
  for(i=0; i<p->nMatch; i++){
    struct snippetMatch *pMatch = &p->aMatch[i];
    zBuf[0] = ' ';
    sprintf(&zBuf[cnt>0], "%d %d %d %d", pMatch->iCol,
        pMatch->iTerm, pMatch->iStart, pMatch->nByte);
    append(&sb, zBuf);
    cnt++;
  }
  p->zOffset = sb.s;
  p->nOffset = sb.len;
}

/*
** zDoc[0..nDoc-1] is phrase of text.  aMatch[0..nMatch-1] are a set
** of matching words some of which might be in zDoc.  zDoc is column
** number iCol.
**
** iBreak is suggested spot in zDoc where we could begin or end an
** excerpt.  Return a value similar to iBreak but possibly adjusted
** to be a little left or right so that the break point is better.
*/
static int wordBoundary(
  int iBreak,                   /* The suggested break point */
  const char *zDoc,             /* Document text */
  int nDoc,                     /* Number of bytes in zDoc[] */
  struct snippetMatch *aMatch,  /* Matching words */
  int nMatch,                   /* Number of entries in aMatch[] */
  int iCol                      /* The column number for zDoc[] */
){
  int i;
  if( iBreak<=10 ){
    return 0;
  }
  if( iBreak>=nDoc-10 ){
    return nDoc;
  }
  for(i=0; i<nMatch && aMatch[i].iCol<iCol; i++){}
  while( i<nMatch && aMatch[i].iStart+aMatch[i].nByte<iBreak ){ i++; }
  if( i<nMatch ){
    if( aMatch[i].iStart<iBreak+10 ){
      return aMatch[i].iStart;
    }
    if( i>0 && aMatch[i-1].iStart+aMatch[i-1].nByte>=iBreak ){
      return aMatch[i-1].iStart;
    }
  }
  for(i=1; i<=10; i++){
    if( safe_isspace(zDoc[iBreak-i]) ){
      return iBreak - i + 1;
    }
    if( safe_isspace(zDoc[iBreak+i]) ){
      return iBreak + i + 1;
    }
  }
  return iBreak;
}

/*
** If the StringBuffer does not end in white space, add a single
** space character to the end.
*/
static void appendWhiteSpace(StringBuffer *p){
  if( p->len==0 ) return;
  if( safe_isspace(p->s[p->len-1]) ) return;
  append(p, " ");
}

/*
** Remove white space from teh end of the StringBuffer
*/
static void trimWhiteSpace(StringBuffer *p){
  while( p->len>0 && safe_isspace(p->s[p->len-1]) ){
    p->len--;
  }
}



/*
** Allowed values for Snippet.aMatch[].snStatus
*/
#define SNIPPET_IGNORE  0   /* It is ok to omit this match from the snippet */
#define SNIPPET_DESIRED 1   /* We want to include this match in the snippet */

/*
** Generate the text of a snippet.
*/
static void snippetText(
  fulltext_cursor *pCursor,   /* The cursor we need the snippet for */
  const char *zStartMark,     /* Markup to appear before each match */
  const char *zEndMark,       /* Markup to appear after each match */
  const char *zEllipsis       /* Ellipsis mark */
){
  int i, j;
  struct snippetMatch *aMatch;
  int nMatch;
  int nDesired;
  StringBuffer sb;
  int tailCol;
  int tailOffset;
  int iCol;
  int nDoc;
  const char *zDoc;
  int iStart, iEnd;
  int tailEllipsis = 0;
  int iMatch;
  

  free(pCursor->snippet.zSnippet);
  pCursor->snippet.zSnippet = 0;
  aMatch = pCursor->snippet.aMatch;
  nMatch = pCursor->snippet.nMatch;
  initStringBuffer(&sb);

  for(i=0; i<nMatch; i++){
    aMatch[i].snStatus = SNIPPET_IGNORE;
  }
  nDesired = 0;
  for(i=0; i<pCursor->q.nTerms; i++){
    for(j=0; j<nMatch; j++){
      if( aMatch[j].iTerm==i ){
        aMatch[j].snStatus = SNIPPET_DESIRED;
        nDesired++;
        break;
      }
    }
  }

  iMatch = 0;
  tailCol = -1;
  tailOffset = 0;
  for(i=0; i<nMatch && nDesired>0; i++){
    if( aMatch[i].snStatus!=SNIPPET_DESIRED ) continue;
    nDesired--;
    iCol = aMatch[i].iCol;
    zDoc = (const char*)sqlite3_column_text(pCursor->pStmt, iCol+1);
    nDoc = sqlite3_column_bytes(pCursor->pStmt, iCol+1);
    iStart = aMatch[i].iStart - 40;
    iStart = wordBoundary(iStart, zDoc, nDoc, aMatch, nMatch, iCol);
    if( iStart<=10 ){
      iStart = 0;
    }
    if( iCol==tailCol && iStart<=tailOffset+20 ){
      iStart = tailOffset;
    }
    if( (iCol!=tailCol && tailCol>=0) || iStart!=tailOffset ){
      trimWhiteSpace(&sb);
      appendWhiteSpace(&sb);
      append(&sb, zEllipsis);
      appendWhiteSpace(&sb);
    }
    iEnd = aMatch[i].iStart + aMatch[i].nByte + 40;
    iEnd = wordBoundary(iEnd, zDoc, nDoc, aMatch, nMatch, iCol);
    if( iEnd>=nDoc-10 ){
      iEnd = nDoc;
      tailEllipsis = 0;
    }else{
      tailEllipsis = 1;
    }
    while( iMatch<nMatch && aMatch[iMatch].iCol<iCol ){ iMatch++; }
    while( iStart<iEnd ){
      while( iMatch<nMatch && aMatch[iMatch].iStart<iStart
             && aMatch[iMatch].iCol<=iCol ){
        iMatch++;
      }
      if( iMatch<nMatch && aMatch[iMatch].iStart<iEnd
             && aMatch[iMatch].iCol==iCol ){
        nappend(&sb, &zDoc[iStart], aMatch[iMatch].iStart - iStart);
        iStart = aMatch[iMatch].iStart;
        append(&sb, zStartMark);
        nappend(&sb, &zDoc[iStart], aMatch[iMatch].nByte);
        append(&sb, zEndMark);
        iStart += aMatch[iMatch].nByte;
        for(j=iMatch+1; j<nMatch; j++){
          if( aMatch[j].iTerm==aMatch[iMatch].iTerm
              && aMatch[j].snStatus==SNIPPET_DESIRED ){
            nDesired--;
            aMatch[j].snStatus = SNIPPET_IGNORE;
          }
        }
      }else{
        nappend(&sb, &zDoc[iStart], iEnd - iStart);
        iStart = iEnd;
      }
    }
    tailCol = iCol;
    tailOffset = iEnd;
  }
  trimWhiteSpace(&sb);
  if( tailEllipsis ){
    appendWhiteSpace(&sb);
    append(&sb, zEllipsis);
  }
  pCursor->snippet.zSnippet = sb.s;
  pCursor->snippet.nSnippet = sb.len;  
}


/*
** Close the cursor.  For additional information see the documentation
** on the xClose method of the virtual table interface.
*/
static int fulltextClose(sqlite3_vtab_cursor *pCursor){
  fulltext_cursor *c = (fulltext_cursor *) pCursor;
  TRACE(("FTS1 Close %p\n", c));
  sqlite3_finalize(c->pStmt);
  queryClear(&c->q);
  snippetClear(&c->snippet);
  if( c->result.pDoclist!=NULL ){
    docListDelete(c->result.pDoclist);
  }
  free(c);
  return SQLITE_OK;
}

static int fulltextNext(sqlite3_vtab_cursor *pCursor){
  fulltext_cursor *c = (fulltext_cursor *) pCursor;
  sqlite_int64 iDocid;
  int rc;

  TRACE(("FTS1 Next %p\n", pCursor));
  snippetClear(&c->snippet);
  if( c->iCursorType < QUERY_FULLTEXT ){
    /* TODO(shess) Handle SQLITE_SCHEMA AND SQLITE_BUSY. */
    rc = sqlite3_step(c->pStmt);
    switch( rc ){
      case SQLITE_ROW:
        c->eof = 0;
        return SQLITE_OK;
      case SQLITE_DONE:
        c->eof = 1;
        return SQLITE_OK;
      default:
        c->eof = 1;
        return rc;
    }
  } else {  /* full-text query */
    rc = sqlite3_reset(c->pStmt);
    if( rc!=SQLITE_OK ) return rc;

    iDocid = nextDocid(&c->result);
    if( iDocid==0 ){
      c->eof = 1;
      return SQLITE_OK;
    }
    rc = sqlite3_bind_int64(c->pStmt, 1, iDocid);
    if( rc!=SQLITE_OK ) return rc;
    /* TODO(shess) Handle SQLITE_SCHEMA AND SQLITE_BUSY. */
    rc = sqlite3_step(c->pStmt);
    if( rc==SQLITE_ROW ){   /* the case we expect */
      c->eof = 0;
      return SQLITE_OK;
    }
    /* an error occurred; abort */
    return rc==SQLITE_DONE ? SQLITE_ERROR : rc;
  }
}


/* Return a DocList corresponding to the query term *pTerm.  If *pTerm
** is the first term of a phrase query, go ahead and evaluate the phrase
** query and return the doclist for the entire phrase query.
**
** The result is stored in pTerm->doclist.
*/
static int docListOfTerm(
  fulltext_vtab *v,     /* The full text index */
  int iColumn,          /* column to restrict to.  No restrition if >=nColumn */
  QueryTerm *pQTerm,    /* Term we are looking for, or 1st term of a phrase */
  DocList **ppResult    /* Write the result here */
){
  DocList *pLeft, *pRight, *pNew;
  int i, rc;

  pLeft = docListNew(DL_POSITIONS);
  rc = term_select_all(v, iColumn, pQTerm->pTerm, pQTerm->nTerm, pLeft);
  if( rc ){
    docListDelete(pLeft);
    return rc;
  }
  for(i=1; i<=pQTerm->nPhrase; i++){
    pRight = docListNew(DL_POSITIONS);
    rc = term_select_all(v, iColumn, pQTerm[i].pTerm, pQTerm[i].nTerm, pRight);
    if( rc ){
      docListDelete(pLeft);
      return rc;
    }
    pNew = docListNew(i<pQTerm->nPhrase ? DL_POSITIONS : DL_DOCIDS);
    docListPhraseMerge(pLeft, pRight, pNew);
    docListDelete(pLeft);
    docListDelete(pRight);
    pLeft = pNew;
  }
  *ppResult = pLeft;
  return SQLITE_OK;
}

/* Add a new term pTerm[0..nTerm-1] to the query *q.
*/
static void queryAdd(Query *q, const char *pTerm, int nTerm){
  QueryTerm *t;
  ++q->nTerms;
  q->pTerms = realloc(q->pTerms, q->nTerms * sizeof(q->pTerms[0]));
  if( q->pTerms==0 ){
    q->nTerms = 0;
    return;
  }
  t = &q->pTerms[q->nTerms - 1];
  memset(t, 0, sizeof(*t));
  t->pTerm = malloc(nTerm+1);
  memcpy(t->pTerm, pTerm, nTerm);
  t->pTerm[nTerm] = 0;
  t->nTerm = nTerm;
  t->isOr = q->nextIsOr;
  q->nextIsOr = 0;
  t->iColumn = q->nextColumn;
  q->nextColumn = q->dfltColumn;
}

/*
** Check to see if the string zToken[0...nToken-1] matches any
** column name in the virtual table.   If it does,
** return the zero-indexed column number.  If not, return -1.
*/
static int checkColumnSpecifier(
  fulltext_vtab *pVtab,    /* The virtual table */
  const char *zToken,      /* Text of the token */
  int nToken               /* Number of characters in the token */
){
  int i;
  for(i=0; i<pVtab->nColumn; i++){
    if( memcmp(pVtab->azColumn[i], zToken, nToken)==0
        && pVtab->azColumn[i][nToken]==0 ){
      return i;
    }
  }
  return -1;
}

/*
** Parse the text at pSegment[0..nSegment-1].  Add additional terms
** to the query being assemblied in pQuery.
**
** inPhrase is true if pSegment[0..nSegement-1] is contained within
** double-quotes.  If inPhrase is true, then the first term
** is marked with the number of terms in the phrase less one and
** OR and "-" syntax is ignored.  If inPhrase is false, then every
** term found is marked with nPhrase=0 and OR and "-" syntax is significant.
*/
static int tokenizeSegment(
  sqlite3_tokenizer *pTokenizer,          /* The tokenizer to use */
  const char *pSegment, int nSegment,     /* Query expression being parsed */
  int inPhrase,                           /* True if within "..." */
  Query *pQuery                           /* Append results here */
){
  const sqlite3_tokenizer_module *pModule = pTokenizer->pModule;
  sqlite3_tokenizer_cursor *pCursor;
  int firstIndex = pQuery->nTerms;
  int iCol;
  int nTerm = 1;
  
  int rc = pModule->xOpen(pTokenizer, pSegment, nSegment, &pCursor);
  if( rc!=SQLITE_OK ) return rc;
  pCursor->pTokenizer = pTokenizer;

  while( 1 ){
    const char *pToken;
    int nToken, iBegin, iEnd, iPos;

    rc = pModule->xNext(pCursor,
                        &pToken, &nToken,
                        &iBegin, &iEnd, &iPos);
    if( rc!=SQLITE_OK ) break;
    if( !inPhrase &&
        pSegment[iEnd]==':' &&
         (iCol = checkColumnSpecifier(pQuery->pFts, pToken, nToken))>=0 ){
      pQuery->nextColumn = iCol;
      continue;
    }
    if( !inPhrase && pQuery->nTerms>0 && nToken==2
         && pSegment[iBegin]=='O' && pSegment[iBegin+1]=='R' ){
      pQuery->nextIsOr = 1;
      continue;
    }
    queryAdd(pQuery, pToken, nToken);
    if( !inPhrase && iBegin>0 && pSegment[iBegin-1]=='-' ){
      pQuery->pTerms[pQuery->nTerms-1].isNot = 1;
    }
    pQuery->pTerms[pQuery->nTerms-1].iPhrase = nTerm;
    if( inPhrase ){
      nTerm++;
    }
  }

  if( inPhrase && pQuery->nTerms>firstIndex ){
    pQuery->pTerms[firstIndex].nPhrase = pQuery->nTerms - firstIndex - 1;
  }

  return pModule->xClose(pCursor);
}

/* Parse a query string, yielding a Query object pQuery.
**
** The calling function will need to queryClear() to clean up
** the dynamically allocated memory held by pQuery.
*/
static int parseQuery(
  fulltext_vtab *v,        /* The fulltext index */
  const char *zInput,      /* Input text of the query string */
  int nInput,              /* Size of the input text */
  int dfltColumn,          /* Default column of the index to match against */
  Query *pQuery            /* Write the parse results here. */
){
  int iInput, inPhrase = 0;

  if( zInput==0 ) nInput = 0;
  if( nInput<0 ) nInput = strlen(zInput);
  pQuery->nTerms = 0;
  pQuery->pTerms = NULL;
  pQuery->nextIsOr = 0;
  pQuery->nextColumn = dfltColumn;
  pQuery->dfltColumn = dfltColumn;
  pQuery->pFts = v;

  for(iInput=0; iInput<nInput; ++iInput){
    int i;
    for(i=iInput; i<nInput && zInput[i]!='"'; ++i){}
    if( i>iInput ){
      tokenizeSegment(v->pTokenizer, zInput+iInput, i-iInput, inPhrase,
                       pQuery);
    }
    iInput = i;
    if( i<nInput ){
      assert( zInput[i]=='"' );
      inPhrase = !inPhrase;
    }
  }

  if( inPhrase ){
    /* unmatched quote */
    queryClear(pQuery);
    return SQLITE_ERROR;
  }
  return SQLITE_OK;
}

/* Perform a full-text query using the search expression in
** zInput[0..nInput-1].  Return a list of matching documents
** in pResult.
**
** Queries must match column iColumn.  Or if iColumn>=nColumn
** they are allowed to match against any column.
*/
static int fulltextQuery(
  fulltext_vtab *v,      /* The full text index */
  int iColumn,           /* Match against this column by default */
  const char *zInput,    /* The query string */
  int nInput,            /* Number of bytes in zInput[] */
  DocList **pResult,     /* Write the result doclist here */
  Query *pQuery          /* Put parsed query string here */
){
  int i, iNext, rc;
  DocList *pLeft = NULL;
  DocList *pRight, *pNew, *pOr;
  int nNot = 0;
  QueryTerm *aTerm;

  rc = parseQuery(v, zInput, nInput, iColumn, pQuery);
  if( rc!=SQLITE_OK ) return rc;

  /* Merge AND terms. */
  aTerm = pQuery->pTerms;
  for(i = 0; i<pQuery->nTerms; i=iNext){
    if( aTerm[i].isNot ){
      /* Handle all NOT terms in a separate pass */
      nNot++;
      iNext = i + aTerm[i].nPhrase+1;
      continue;
    }
    iNext = i + aTerm[i].nPhrase + 1;
    rc = docListOfTerm(v, aTerm[i].iColumn, &aTerm[i], &pRight);
    if( rc ){
      queryClear(pQuery);
      return rc;
    }
    while( iNext<pQuery->nTerms && aTerm[iNext].isOr ){
      rc = docListOfTerm(v, aTerm[iNext].iColumn, &aTerm[iNext], &pOr);
      iNext += aTerm[iNext].nPhrase + 1;
      if( rc ){
        queryClear(pQuery);
        return rc;
      }
      pNew = docListNew(DL_DOCIDS);
      docListOrMerge(pRight, pOr, pNew);
      docListDelete(pRight);
      docListDelete(pOr);
      pRight = pNew;
    }
    if( pLeft==0 ){
      pLeft = pRight;
    }else{
      pNew = docListNew(DL_DOCIDS);
      docListAndMerge(pLeft, pRight, pNew);
      docListDelete(pRight);
      docListDelete(pLeft);
      pLeft = pNew;
    }
  }

  if( nNot && pLeft==0 ){
    /* We do not yet know how to handle a query of only NOT terms */
    return SQLITE_ERROR;
  }

  /* Do the EXCEPT terms */
  for(i=0; i<pQuery->nTerms;  i += aTerm[i].nPhrase + 1){
    if( !aTerm[i].isNot ) continue;
    rc = docListOfTerm(v, aTerm[i].iColumn, &aTerm[i], &pRight);
    if( rc ){
      queryClear(pQuery);
      docListDelete(pLeft);
      return rc;
    }
    pNew = docListNew(DL_DOCIDS);
    docListExceptMerge(pLeft, pRight, pNew);
    docListDelete(pRight);
    docListDelete(pLeft);
    pLeft = pNew;
  }

  *pResult = pLeft;
  return rc;
}

/*
** This is the xFilter interface for the virtual table.  See
** the virtual table xFilter method documentation for additional
** information.
**
** If idxNum==QUERY_GENERIC then do a full table scan against
** the %_content table.
**
** If idxNum==QUERY_ROWID then do a rowid lookup for a single entry
** in the %_content table.
**
** If idxNum>=QUERY_FULLTEXT then use the full text index.  The
** column on the left-hand side of the MATCH operator is column
** number idxNum-QUERY_FULLTEXT, 0 indexed.  argv[0] is the right-hand
** side of the MATCH operator.
*/
/* TODO(shess) Upgrade the cursor initialization and destruction to
** account for fulltextFilter() being called multiple times on the
** same cursor.  The current solution is very fragile.  Apply fix to
** fts2 as appropriate.
*/
static int fulltextFilter(
  sqlite3_vtab_cursor *pCursor,     /* The cursor used for this query */
  int idxNum, const char *idxStr,   /* Which indexing scheme to use */
  int argc, sqlite3_value **argv    /* Arguments for the indexing scheme */
){
  fulltext_cursor *c = (fulltext_cursor *) pCursor;
  fulltext_vtab *v = cursor_vtab(c);
  int rc;
  char *zSql;

  TRACE(("FTS1 Filter %p\n",pCursor));

  zSql = sqlite3_mprintf("select rowid, * from %%_content %s",
                          idxNum==QUERY_GENERIC ? "" : "where rowid=?");
  sqlite3_finalize(c->pStmt);
  rc = sql_prepare(v->db, v->zDb, v->zName, &c->pStmt, zSql);
  sqlite3_free(zSql);
  if( rc!=SQLITE_OK ) return rc;

  c->iCursorType = idxNum;
  switch( idxNum ){
    case QUERY_GENERIC:
      break;

    case QUERY_ROWID:
      rc = sqlite3_bind_int64(c->pStmt, 1, sqlite3_value_int64(argv[0]));
      if( rc!=SQLITE_OK ) return rc;
      break;

    default:   /* full-text search */
    {
      const char *zQuery = (const char *)sqlite3_value_text(argv[0]);
      DocList *pResult;
      assert( idxNum<=QUERY_FULLTEXT+v->nColumn);
      assert( argc==1 );
      queryClear(&c->q);
      rc = fulltextQuery(v, idxNum-QUERY_FULLTEXT, zQuery, -1, &pResult, &c->q);
      if( rc!=SQLITE_OK ) return rc;
      if( c->result.pDoclist!=NULL ) docListDelete(c->result.pDoclist);
      readerInit(&c->result, pResult);
      break;
    }
  }

  return fulltextNext(pCursor);
}

/* This is the xEof method of the virtual table.  The SQLite core
** calls this routine to find out if it has reached the end of
** a query's results set.
*/
static int fulltextEof(sqlite3_vtab_cursor *pCursor){
  fulltext_cursor *c = (fulltext_cursor *) pCursor;
  return c->eof;
}

/* This is the xColumn method of the virtual table.  The SQLite
** core calls this method during a query when it needs the value
** of a column from the virtual table.  This method needs to use
** one of the sqlite3_result_*() routines to store the requested
** value back in the pContext.
*/
static int fulltextColumn(sqlite3_vtab_cursor *pCursor,
                          sqlite3_context *pContext, int idxCol){
  fulltext_cursor *c = (fulltext_cursor *) pCursor;
  fulltext_vtab *v = cursor_vtab(c);

  if( idxCol<v->nColumn ){
    sqlite3_value *pVal = sqlite3_column_value(c->pStmt, idxCol+1);
    sqlite3_result_value(pContext, pVal);
  }else if( idxCol==v->nColumn ){
    /* The extra column whose name is the same as the table.
    ** Return a blob which is a pointer to the cursor
    */
    sqlite3_result_blob(pContext, &c, sizeof(c), SQLITE_TRANSIENT);
  }
  return SQLITE_OK;
}

/* This is the xRowid method.  The SQLite core calls this routine to
** retrive the rowid for the current row of the result set.  The
** rowid should be written to *pRowid.
*/
static int fulltextRowid(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){
  fulltext_cursor *c = (fulltext_cursor *) pCursor;

  *pRowid = sqlite3_column_int64(c->pStmt, 0);
  return SQLITE_OK;
}

/* Add all terms in [zText] to the given hash table.  If [iColumn] > 0,
 * we also store positions and offsets in the hash table using the given
 * column number. */
static int buildTerms(fulltext_vtab *v, fts1Hash *terms, sqlite_int64 iDocid,
                      const char *zText, int iColumn){
  sqlite3_tokenizer *pTokenizer = v->pTokenizer;
  sqlite3_tokenizer_cursor *pCursor;
  const char *pToken;
  int nTokenBytes;
  int iStartOffset, iEndOffset, iPosition;
  int rc;

  rc = pTokenizer->pModule->xOpen(pTokenizer, zText, -1, &pCursor);
  if( rc!=SQLITE_OK ) return rc;

  pCursor->pTokenizer = pTokenizer;
  while( SQLITE_OK==pTokenizer->pModule->xNext(pCursor,
                                               &pToken, &nTokenBytes,
                                               &iStartOffset, &iEndOffset,
                                               &iPosition) ){
    DocList *p;

    /* Positions can't be negative; we use -1 as a terminator internally. */
    if( iPosition<0 ){
      pTokenizer->pModule->xClose(pCursor);
      return SQLITE_ERROR;
    }

    p = fts1HashFind(terms, pToken, nTokenBytes);
    if( p==NULL ){
      p = docListNew(DL_DEFAULT);
      docListAddDocid(p, iDocid);
      fts1HashInsert(terms, pToken, nTokenBytes, p);
    }
    if( iColumn>=0 ){
      docListAddPosOffset(p, iColumn, iPosition, iStartOffset, iEndOffset);
    }
  }

  /* TODO(shess) Check return?  Should this be able to cause errors at
  ** this point?  Actually, same question about sqlite3_finalize(),
  ** though one could argue that failure there means that the data is
  ** not durable.  *ponder*
  */
  pTokenizer->pModule->xClose(pCursor);
  return rc;
}

/* Update the %_terms table to map the term [pTerm] to the given rowid. */
static int index_insert_term(fulltext_vtab *v, const char *pTerm, int nTerm,
                             DocList *d){
  sqlite_int64 iIndexRow;
  DocList doclist;
  int iSegment = 0, rc;

  rc = term_select(v, pTerm, nTerm, iSegment, &iIndexRow, &doclist);
  if( rc==SQLITE_DONE ){
    docListInit(&doclist, DL_DEFAULT, 0, 0);
    docListUpdate(&doclist, d);
    /* TODO(shess) Consider length(doclist)>CHUNK_MAX? */
    rc = term_insert(v, NULL, pTerm, nTerm, iSegment, &doclist);
    goto err;
  }
  if( rc!=SQLITE_ROW ) return SQLITE_ERROR;

  docListUpdate(&doclist, d);
  if( doclist.nData<=CHUNK_MAX ){
    rc = term_update(v, iIndexRow, &doclist);
    goto err;
  }

  /* Doclist doesn't fit, delete what's there, and accumulate
  ** forward.
  */
  rc = term_delete(v, iIndexRow);
  if( rc!=SQLITE_OK ) goto err;

  /* Try to insert the doclist into a higher segment bucket.  On
  ** failure, accumulate existing doclist with the doclist from that
  ** bucket, and put results in the next bucket.
  */
  iSegment++;
  while( (rc=term_insert(v, &iIndexRow, pTerm, nTerm, iSegment,
                         &doclist))!=SQLITE_OK ){
    sqlite_int64 iSegmentRow;
    DocList old;
    int rc2;

    /* Retain old error in case the term_insert() error was really an
    ** error rather than a bounced insert.
    */
    rc2 = term_select(v, pTerm, nTerm, iSegment, &iSegmentRow, &old);
    if( rc2!=SQLITE_ROW ) goto err;

    rc = term_delete(v, iSegmentRow);
    if( rc!=SQLITE_OK ) goto err;

    /* Reusing lowest-number deleted row keeps the index smaller. */
    if( iSegmentRow<iIndexRow ) iIndexRow = iSegmentRow;

    /* doclist contains the newer data, so accumulate it over old.
    ** Then steal accumulated data for doclist.
    */
    docListAccumulate(&old, &doclist);
    docListDestroy(&doclist);
    doclist = old;

    iSegment++;
  }

 err:
  docListDestroy(&doclist);
  return rc;
}

/* Add doclists for all terms in [pValues] to the hash table [terms]. */
static int insertTerms(fulltext_vtab *v, fts1Hash *terms, sqlite_int64 iRowid,
                sqlite3_value **pValues){
  int i;
  for(i = 0; i < v->nColumn ; ++i){
    char *zText = (char*)sqlite3_value_text(pValues[i]);
    int rc = buildTerms(v, terms, iRowid, zText, i);
    if( rc!=SQLITE_OK ) return rc;
  }
  return SQLITE_OK;
}

/* Add empty doclists for all terms in the given row's content to the hash
 * table [pTerms]. */
static int deleteTerms(fulltext_vtab *v, fts1Hash *pTerms, sqlite_int64 iRowid){
  const char **pValues;
  int i;

  int rc = content_select(v, iRowid, &pValues);
  if( rc!=SQLITE_OK ) return rc;

  for(i = 0 ; i < v->nColumn; ++i) {
    rc = buildTerms(v, pTerms, iRowid, pValues[i], -1);
    if( rc!=SQLITE_OK ) break;
  }

  freeStringArray(v->nColumn, pValues);
  return SQLITE_OK;
}

/* Insert a row into the %_content table; set *piRowid to be the ID of the
 * new row.  Fill [pTerms] with new doclists for the %_term table. */
static int index_insert(fulltext_vtab *v, sqlite3_value *pRequestRowid,
                        sqlite3_value **pValues,
                        sqlite_int64 *piRowid, fts1Hash *pTerms){
  int rc;

  rc = content_insert(v, pRequestRowid, pValues);  /* execute an SQL INSERT */
  if( rc!=SQLITE_OK ) return rc;
  *piRowid = sqlite3_last_insert_rowid(v->db);
  return insertTerms(v, pTerms, *piRowid, pValues);
}

/* Delete a row from the %_content table; fill [pTerms] with empty doclists
 * to be written to the %_term table. */
static int index_delete(fulltext_vtab *v, sqlite_int64 iRow, fts1Hash *pTerms){
  int rc = deleteTerms(v, pTerms, iRow);
  if( rc!=SQLITE_OK ) return rc;
  return content_delete(v, iRow);  /* execute an SQL DELETE */
}

/* Update a row in the %_content table; fill [pTerms] with new doclists for the
 * %_term table. */
static int index_update(fulltext_vtab *v, sqlite_int64 iRow,
                        sqlite3_value **pValues, fts1Hash *pTerms){
  /* Generate an empty doclist for each term that previously appeared in this
   * row. */
  int rc = deleteTerms(v, pTerms, iRow);
  if( rc!=SQLITE_OK ) return rc;

  rc = content_update(v, pValues, iRow);  /* execute an SQL UPDATE */
  if( rc!=SQLITE_OK ) return rc;

  /* Now add positions for terms which appear in the updated row. */
  return insertTerms(v, pTerms, iRow, pValues);
}

/* This function implements the xUpdate callback; it's the top-level entry
 * point for inserting, deleting or updating a row in a full-text table. */
static int fulltextUpdate(sqlite3_vtab *pVtab, int nArg, sqlite3_value **ppArg,
                   sqlite_int64 *pRowid){
  fulltext_vtab *v = (fulltext_vtab *) pVtab;
  fts1Hash terms;   /* maps term string -> PosList */
  int rc;
  fts1HashElem *e;

  TRACE(("FTS1 Update %p\n", pVtab));
  
  fts1HashInit(&terms, FTS1_HASH_STRING, 1);

  if( nArg<2 ){
    rc = index_delete(v, sqlite3_value_int64(ppArg[0]), &terms);
  } else if( sqlite3_value_type(ppArg[0]) != SQLITE_NULL ){
    /* An update:
     * ppArg[0] = old rowid
     * ppArg[1] = new rowid
     * ppArg[2..2+v->nColumn-1] = values
     * ppArg[2+v->nColumn] = value for magic column (we ignore this)
     */
    sqlite_int64 rowid = sqlite3_value_int64(ppArg[0]);
    if( sqlite3_value_type(ppArg[1]) != SQLITE_INTEGER ||
      sqlite3_value_int64(ppArg[1]) != rowid ){
      rc = SQLITE_ERROR;  /* we don't allow changing the rowid */
    } else {
      assert( nArg==2+v->nColumn+1);
      rc = index_update(v, rowid, &ppArg[2], &terms);
    }
  } else {
    /* An insert:
     * ppArg[1] = requested rowid
     * ppArg[2..2+v->nColumn-1] = values
     * ppArg[2+v->nColumn] = value for magic column (we ignore this)
     */
    assert( nArg==2+v->nColumn+1);
    rc = index_insert(v, ppArg[1], &ppArg[2], pRowid, &terms);
  }

  if( rc==SQLITE_OK ){
    /* Write updated doclists to disk. */
    for(e=fts1HashFirst(&terms); e; e=fts1HashNext(e)){
      DocList *p = fts1HashData(e);
      rc = index_insert_term(v, fts1HashKey(e), fts1HashKeysize(e), p);
      if( rc!=SQLITE_OK ) break;
    }
  }

  /* clean up */
  for(e=fts1HashFirst(&terms); e; e=fts1HashNext(e)){
    DocList *p = fts1HashData(e);
    docListDelete(p);
  }
  fts1HashClear(&terms);

  return rc;
}

/*
** Implementation of the snippet() function for FTS1
*/
static void snippetFunc(
  sqlite3_context *pContext,
  int argc,
  sqlite3_value **argv
){
  fulltext_cursor *pCursor;
  if( argc<1 ) return;
  if( sqlite3_value_type(argv[0])!=SQLITE_BLOB ||
      sqlite3_value_bytes(argv[0])!=sizeof(pCursor) ){
    sqlite3_result_error(pContext, "illegal first argument to html_snippet",-1);
  }else{
    const char *zStart = "<b>";
    const char *zEnd = "</b>";
    const char *zEllipsis = "<b>...</b>";
    memcpy(&pCursor, sqlite3_value_blob(argv[0]), sizeof(pCursor));
    if( argc>=2 ){
      zStart = (const char*)sqlite3_value_text(argv[1]);
      if( argc>=3 ){
        zEnd = (const char*)sqlite3_value_text(argv[2]);
        if( argc>=4 ){
          zEllipsis = (const char*)sqlite3_value_text(argv[3]);
        }
      }
    }
    snippetAllOffsets(pCursor);
    snippetText(pCursor, zStart, zEnd, zEllipsis);
    sqlite3_result_text(pContext, pCursor->snippet.zSnippet,
                        pCursor->snippet.nSnippet, SQLITE_STATIC);
  }
}

/*
** Implementation of the offsets() function for FTS1
*/
static void snippetOffsetsFunc(
  sqlite3_context *pContext,
  int argc,
  sqlite3_value **argv
){
  fulltext_cursor *pCursor;
  if( argc<1 ) return;
  if( sqlite3_value_type(argv[0])!=SQLITE_BLOB ||
      sqlite3_value_bytes(argv[0])!=sizeof(pCursor) ){
    sqlite3_result_error(pContext, "illegal first argument to offsets",-1);
  }else{
    memcpy(&pCursor, sqlite3_value_blob(argv[0]), sizeof(pCursor));
    snippetAllOffsets(pCursor);
    snippetOffsetText(&pCursor->snippet);
    sqlite3_result_text(pContext,
                        pCursor->snippet.zOffset, pCursor->snippet.nOffset,
                        SQLITE_STATIC);
  }
}

/*
** This routine implements the xFindFunction method for the FTS1
** virtual table.
*/
static int fulltextFindFunction(
  sqlite3_vtab *pVtab,
  int nArg,
  const char *zName,
  void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),
  void **ppArg
){
  if( strcmp(zName,"snippet")==0 ){
    *pxFunc = snippetFunc;
    return 1;
  }else if( strcmp(zName,"offsets")==0 ){
    *pxFunc = snippetOffsetsFunc;
    return 1;
  }
  return 0;
}

/*
** Rename an fts1 table.
*/
static int fulltextRename(
  sqlite3_vtab *pVtab,
  const char *zName
){
  fulltext_vtab *p = (fulltext_vtab *)pVtab;
  int rc = SQLITE_NOMEM;
  char *zSql = sqlite3_mprintf(
    "ALTER TABLE %Q.'%q_content'  RENAME TO '%q_content';"
    "ALTER TABLE %Q.'%q_term' RENAME TO '%q_term';"
    , p->zDb, p->zName, zName
    , p->zDb, p->zName, zName
  );
  if( zSql ){
    rc = sqlite3_exec(p->db, zSql, 0, 0, 0);
    sqlite3_free(zSql);
  }
  return rc;
}

static const sqlite3_module fulltextModule = {
  /* iVersion      */ 0,
  /* xCreate       */ fulltextCreate,
  /* xConnect      */ fulltextConnect,
  /* xBestIndex    */ fulltextBestIndex,
  /* xDisconnect   */ fulltextDisconnect,
  /* xDestroy      */ fulltextDestroy,
  /* xOpen         */ fulltextOpen,
  /* xClose        */ fulltextClose,
  /* xFilter       */ fulltextFilter,
  /* xNext         */ fulltextNext,
  /* xEof          */ fulltextEof,
  /* xColumn       */ fulltextColumn,
  /* xRowid        */ fulltextRowid,
  /* xUpdate       */ fulltextUpdate,
  /* xBegin        */ 0, 
  /* xSync         */ 0,
  /* xCommit       */ 0,
  /* xRollback     */ 0,
  /* xFindFunction */ fulltextFindFunction,
  /* xRename       */ fulltextRename,
};

int sqlite3Fts1Init(sqlite3 *db){
  sqlite3_overload_function(db, "snippet", -1);
  sqlite3_overload_function(db, "offsets", -1);
  return sqlite3_create_module(db, "fts1", &fulltextModule, 0);
}

#if !SQLITE_CORE
int sqlite3_extension_init(sqlite3 *db, char **pzErrMsg,
                           const sqlite3_api_routines *pApi){
  SQLITE_EXTENSION_INIT2(pApi)
  return sqlite3Fts1Init(db);
}
#endif

#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/FTS1/fts1.h.

1
2
3
4
5
6
7
8
9
10
11
#include "sqlite3.h"

#ifdef __cplusplus
extern "C" {
#endif  /* __cplusplus */

int sqlite3Fts1Init(sqlite3 *db);

#ifdef __cplusplus
}  /* extern "C" */
#endif  /* __cplusplus */
<
<
<
<
<
<
<
<
<
<
<






















Deleted SQLite.Interop/FTS1/fts1_hash.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
/*
** 2001 September 22
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This is the implementation of generic hash-tables used in SQLite.
** We've modified it slightly to serve as a standalone hash table
** implementation for the full-text indexing module.
*/
#include <assert.h>
#include <stdlib.h>
#include <string.h>

/*
** The code in this file is only compiled if:
**
**     * The FTS1 module is being built as an extension
**       (in which case SQLITE_CORE is not defined), or
**
**     * The FTS1 module is being built into the core of
**       SQLite (in which case SQLITE_ENABLE_FTS1 is defined).
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1)


#include "fts1_hash.h"

static void *malloc_and_zero(int n){
  void *p = malloc(n);
  if( p ){
    memset(p, 0, n);
  }
  return p;
}

/* Turn bulk memory into a hash table object by initializing the
** fields of the Hash structure.
**
** "pNew" is a pointer to the hash table that is to be initialized.
** keyClass is one of the constants 
** FTS1_HASH_BINARY or FTS1_HASH_STRING.  The value of keyClass 
** determines what kind of key the hash table will use.  "copyKey" is
** true if the hash table should make its own private copy of keys and
** false if it should just use the supplied pointer.
*/
void sqlite3Fts1HashInit(fts1Hash *pNew, int keyClass, int copyKey){
  assert( pNew!=0 );
  assert( keyClass>=FTS1_HASH_STRING && keyClass<=FTS1_HASH_BINARY );
  pNew->keyClass = keyClass;
  pNew->copyKey = copyKey;
  pNew->first = 0;
  pNew->count = 0;
  pNew->htsize = 0;
  pNew->ht = 0;
  pNew->xMalloc = malloc_and_zero;
  pNew->xFree = free;
}

/* Remove all entries from a hash table.  Reclaim all memory.
** Call this routine to delete a hash table or to reset a hash table
** to the empty state.
*/
void sqlite3Fts1HashClear(fts1Hash *pH){
  fts1HashElem *elem;         /* For looping over all elements of the table */

  assert( pH!=0 );
  elem = pH->first;
  pH->first = 0;
  if( pH->ht ) pH->xFree(pH->ht);
  pH->ht = 0;
  pH->htsize = 0;
  while( elem ){
    fts1HashElem *next_elem = elem->next;
    if( pH->copyKey && elem->pKey ){
      pH->xFree(elem->pKey);
    }
    pH->xFree(elem);
    elem = next_elem;
  }
  pH->count = 0;
}

/*
** Hash and comparison functions when the mode is FTS1_HASH_STRING
*/
static int strHash(const void *pKey, int nKey){
  const char *z = (const char *)pKey;
  int h = 0;
  if( nKey<=0 ) nKey = (int) strlen(z);
  while( nKey > 0  ){
    h = (h<<3) ^ h ^ *z++;
    nKey--;
  }
  return h & 0x7fffffff;
}
static int strCompare(const void *pKey1, int n1, const void *pKey2, int n2){
  if( n1!=n2 ) return 1;
  return strncmp((const char*)pKey1,(const char*)pKey2,n1);
}

/*
** Hash and comparison functions when the mode is FTS1_HASH_BINARY
*/
static int binHash(const void *pKey, int nKey){
  int h = 0;
  const char *z = (const char *)pKey;
  while( nKey-- > 0 ){
    h = (h<<3) ^ h ^ *(z++);
  }
  return h & 0x7fffffff;
}
static int binCompare(const void *pKey1, int n1, const void *pKey2, int n2){
  if( n1!=n2 ) return 1;
  return memcmp(pKey1,pKey2,n1);
}

/*
** Return a pointer to the appropriate hash function given the key class.
**
** The C syntax in this function definition may be unfamilar to some 
** programmers, so we provide the following additional explanation:
**
** The name of the function is "hashFunction".  The function takes a
** single parameter "keyClass".  The return value of hashFunction()
** is a pointer to another function.  Specifically, the return value
** of hashFunction() is a pointer to a function that takes two parameters
** with types "const void*" and "int" and returns an "int".
*/
static int (*hashFunction(int keyClass))(const void*,int){
  if( keyClass==FTS1_HASH_STRING ){
    return &strHash;
  }else{
    assert( keyClass==FTS1_HASH_BINARY );
    return &binHash;
  }
}

/*
** Return a pointer to the appropriate hash function given the key class.
**
** For help in interpreted the obscure C code in the function definition,
** see the header comment on the previous function.
*/
static int (*compareFunction(int keyClass))(const void*,int,const void*,int){
  if( keyClass==FTS1_HASH_STRING ){
    return &strCompare;
  }else{
    assert( keyClass==FTS1_HASH_BINARY );
    return &binCompare;
  }
}

/* Link an element into the hash table
*/
static void insertElement(
  fts1Hash *pH,            /* The complete hash table */
  struct _fts1ht *pEntry,  /* The entry into which pNew is inserted */
  fts1HashElem *pNew       /* The element to be inserted */
){
  fts1HashElem *pHead;     /* First element already in pEntry */
  pHead = pEntry->chain;
  if( pHead ){
    pNew->next = pHead;
    pNew->prev = pHead->prev;
    if( pHead->prev ){ pHead->prev->next = pNew; }
    else             { pH->first = pNew; }
    pHead->prev = pNew;
  }else{
    pNew->next = pH->first;
    if( pH->first ){ pH->first->prev = pNew; }
    pNew->prev = 0;
    pH->first = pNew;
  }
  pEntry->count++;
  pEntry->chain = pNew;
}


/* Resize the hash table so that it cantains "new_size" buckets.
** "new_size" must be a power of 2.  The hash table might fail 
** to resize if sqliteMalloc() fails.
*/
static void rehash(fts1Hash *pH, int new_size){
  struct _fts1ht *new_ht;          /* The new hash table */
  fts1HashElem *elem, *next_elem;  /* For looping over existing elements */
  int (*xHash)(const void*,int);   /* The hash function */

  assert( (new_size & (new_size-1))==0 );
  new_ht = (struct _fts1ht *)pH->xMalloc( new_size*sizeof(struct _fts1ht) );
  if( new_ht==0 ) return;
  if( pH->ht ) pH->xFree(pH->ht);
  pH->ht = new_ht;
  pH->htsize = new_size;
  xHash = hashFunction(pH->keyClass);
  for(elem=pH->first, pH->first=0; elem; elem = next_elem){
    int h = (*xHash)(elem->pKey, elem->nKey) & (new_size-1);
    next_elem = elem->next;
    insertElement(pH, &new_ht[h], elem);
  }
}

/* This function (for internal use only) locates an element in an
** hash table that matches the given key.  The hash for this key has
** already been computed and is passed as the 4th parameter.
*/
static fts1HashElem *findElementGivenHash(
  const fts1Hash *pH, /* The pH to be searched */
  const void *pKey,   /* The key we are searching for */
  int nKey,
  int h               /* The hash for this key. */
){
  fts1HashElem *elem;            /* Used to loop thru the element list */
  int count;                     /* Number of elements left to test */
  int (*xCompare)(const void*,int,const void*,int);  /* comparison function */

  if( pH->ht ){
    struct _fts1ht *pEntry = &pH->ht[h];
    elem = pEntry->chain;
    count = pEntry->count;
    xCompare = compareFunction(pH->keyClass);
    while( count-- && elem ){
      if( (*xCompare)(elem->pKey,elem->nKey,pKey,nKey)==0 ){ 
        return elem;
      }
      elem = elem->next;
    }
  }
  return 0;
}

/* Remove a single entry from the hash table given a pointer to that
** element and a hash on the element's key.
*/
static void removeElementGivenHash(
  fts1Hash *pH,         /* The pH containing "elem" */
  fts1HashElem* elem,   /* The element to be removed from the pH */
  int h                 /* Hash value for the element */
){
  struct _fts1ht *pEntry;
  if( elem->prev ){
    elem->prev->next = elem->next; 
  }else{
    pH->first = elem->next;
  }
  if( elem->next ){
    elem->next->prev = elem->prev;
  }
  pEntry = &pH->ht[h];
  if( pEntry->chain==elem ){
    pEntry->chain = elem->next;
  }
  pEntry->count--;
  if( pEntry->count<=0 ){
    pEntry->chain = 0;
  }
  if( pH->copyKey && elem->pKey ){
    pH->xFree(elem->pKey);
  }
  pH->xFree( elem );
  pH->count--;
  if( pH->count<=0 ){
    assert( pH->first==0 );
    assert( pH->count==0 );
    fts1HashClear(pH);
  }
}

/* Attempt to locate an element of the hash table pH with a key
** that matches pKey,nKey.  Return the data for this element if it is
** found, or NULL if there is no match.
*/
void *sqlite3Fts1HashFind(const fts1Hash *pH, const void *pKey, int nKey){
  int h;                 /* A hash on key */
  fts1HashElem *elem;    /* The element that matches key */
  int (*xHash)(const void*,int);  /* The hash function */

  if( pH==0 || pH->ht==0 ) return 0;
  xHash = hashFunction(pH->keyClass);
  assert( xHash!=0 );
  h = (*xHash)(pKey,nKey);
  assert( (pH->htsize & (pH->htsize-1))==0 );
  elem = findElementGivenHash(pH,pKey,nKey, h & (pH->htsize-1));
  return elem ? elem->data : 0;
}

/* Insert an element into the hash table pH.  The key is pKey,nKey
** and the data is "data".
**
** If no element exists with a matching key, then a new
** element is created.  A copy of the key is made if the copyKey
** flag is set.  NULL is returned.
**
** If another element already exists with the same key, then the
** new data replaces the old data and the old data is returned.
** The key is not copied in this instance.  If a malloc fails, then
** the new data is returned and the hash table is unchanged.
**
** If the "data" parameter to this function is NULL, then the
** element corresponding to "key" is removed from the hash table.
*/
void *sqlite3Fts1HashInsert(
  fts1Hash *pH,        /* The hash table to insert into */
  const void *pKey,    /* The key */
  int nKey,            /* Number of bytes in the key */
  void *data           /* The data */
){
  int hraw;                 /* Raw hash value of the key */
  int h;                    /* the hash of the key modulo hash table size */
  fts1HashElem *elem;       /* Used to loop thru the element list */
  fts1HashElem *new_elem;   /* New element added to the pH */
  int (*xHash)(const void*,int);  /* The hash function */

  assert( pH!=0 );
  xHash = hashFunction(pH->keyClass);
  assert( xHash!=0 );
  hraw = (*xHash)(pKey, nKey);
  assert( (pH->htsize & (pH->htsize-1))==0 );
  h = hraw & (pH->htsize-1);
  elem = findElementGivenHash(pH,pKey,nKey,h);
  if( elem ){
    void *old_data = elem->data;
    if( data==0 ){
      removeElementGivenHash(pH,elem,h);
    }else{
      elem->data = data;
    }
    return old_data;
  }
  if( data==0 ) return 0;
  new_elem = (fts1HashElem*)pH->xMalloc( sizeof(fts1HashElem) );
  if( new_elem==0 ) return data;
  if( pH->copyKey && pKey!=0 ){
    new_elem->pKey = pH->xMalloc( nKey );
    if( new_elem->pKey==0 ){
      pH->xFree(new_elem);
      return data;
    }
    memcpy((void*)new_elem->pKey, pKey, nKey);
  }else{
    new_elem->pKey = (void*)pKey;
  }
  new_elem->nKey = nKey;
  pH->count++;
  if( pH->htsize==0 ){
    rehash(pH,8);
    if( pH->htsize==0 ){
      pH->count = 0;
      pH->xFree(new_elem);
      return data;
    }
  }
  if( pH->count > pH->htsize ){
    rehash(pH,pH->htsize*2);
  }
  assert( pH->htsize>0 );
  assert( (pH->htsize & (pH->htsize-1))==0 );
  h = hraw & (pH->htsize-1);
  insertElement(pH, &pH->ht[h], new_elem);
  new_elem->data = data;
  return 0;
}

#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/FTS1/fts1_hash.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
** 2001 September 22
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This is the header file for the generic hash-table implemenation
** used in SQLite.  We've modified it slightly to serve as a standalone
** hash table implementation for the full-text indexing module.
**
*/
#ifndef _FTS1_HASH_H_
#define _FTS1_HASH_H_

/* Forward declarations of structures. */
typedef struct fts1Hash fts1Hash;
typedef struct fts1HashElem fts1HashElem;

/* A complete hash table is an instance of the following structure.
** The internals of this structure are intended to be opaque -- client
** code should not attempt to access or modify the fields of this structure
** directly.  Change this structure only by using the routines below.
** However, many of the "procedures" and "functions" for modifying and
** accessing this structure are really macros, so we can't really make
** this structure opaque.
*/
struct fts1Hash {
  char keyClass;          /* HASH_INT, _POINTER, _STRING, _BINARY */
  char copyKey;           /* True if copy of key made on insert */
  int count;              /* Number of entries in this table */
  fts1HashElem *first;    /* The first element of the array */
  void *(*xMalloc)(int);  /* malloc() function to use */
  void (*xFree)(void *);  /* free() function to use */
  int htsize;             /* Number of buckets in the hash table */
  struct _fts1ht {        /* the hash table */
    int count;               /* Number of entries with this hash */
    fts1HashElem *chain;     /* Pointer to first entry with this hash */
  } *ht;
};

/* Each element in the hash table is an instance of the following 
** structure.  All elements are stored on a single doubly-linked list.
**
** Again, this structure is intended to be opaque, but it can't really
** be opaque because it is used by macros.
*/
struct fts1HashElem {
  fts1HashElem *next, *prev; /* Next and previous elements in the table */
  void *data;                /* Data associated with this element */
  void *pKey; int nKey;      /* Key associated with this element */
};

/*
** There are 2 different modes of operation for a hash table:
**
**   FTS1_HASH_STRING        pKey points to a string that is nKey bytes long
**                           (including the null-terminator, if any).  Case
**                           is respected in comparisons.
**
**   FTS1_HASH_BINARY        pKey points to binary data nKey bytes long. 
**                           memcmp() is used to compare keys.
**
** A copy of the key is made if the copyKey parameter to fts1HashInit is 1.  
*/
#define FTS1_HASH_STRING    1
#define FTS1_HASH_BINARY    2

/*
** Access routines.  To delete, insert a NULL pointer.
*/
void sqlite3Fts1HashInit(fts1Hash*, int keytype, int copyKey);
void *sqlite3Fts1HashInsert(fts1Hash*, const void *pKey, int nKey, void *pData);
void *sqlite3Fts1HashFind(const fts1Hash*, const void *pKey, int nKey);
void sqlite3Fts1HashClear(fts1Hash*);

/*
** Shorthand for the functions above
*/
#define fts1HashInit   sqlite3Fts1HashInit
#define fts1HashInsert sqlite3Fts1HashInsert
#define fts1HashFind   sqlite3Fts1HashFind
#define fts1HashClear  sqlite3Fts1HashClear

/*
** Macros for looping over all elements of a hash table.  The idiom is
** like this:
**
**   fts1Hash h;
**   fts1HashElem *p;
**   ...
**   for(p=fts1HashFirst(&h); p; p=fts1HashNext(p)){
**     SomeStructure *pData = fts1HashData(p);
**     // do something with pData
**   }
*/
#define fts1HashFirst(H)  ((H)->first)
#define fts1HashNext(E)   ((E)->next)
#define fts1HashData(E)   ((E)->data)
#define fts1HashKey(E)    ((E)->pKey)
#define fts1HashKeysize(E) ((E)->nKey)

/*
** Number of entries in a hash table
*/
#define fts1HashCount(H)  ((H)->count)

#endif /* _FTS1_HASH_H_ */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































Deleted SQLite.Interop/FTS1/fts1_porter.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
/*
** 2006 September 30
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Implementation of the full-text-search tokenizer that implements
** a Porter stemmer.
*/

/*
** The code in this file is only compiled if:
**
**     * The FTS1 module is being built as an extension
**       (in which case SQLITE_CORE is not defined), or
**
**     * The FTS1 module is being built into the core of
**       SQLite (in which case SQLITE_ENABLE_FTS1 is defined).
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1)


#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

#include "fts1_tokenizer.h"

/*
** Class derived from sqlite3_tokenizer
*/
typedef struct porter_tokenizer {
  sqlite3_tokenizer base;      /* Base class */
} porter_tokenizer;

/*
** Class derived from sqlit3_tokenizer_cursor
*/
typedef struct porter_tokenizer_cursor {
  sqlite3_tokenizer_cursor base;
  const char *zInput;          /* input we are tokenizing */
  int nInput;                  /* size of the input */
  int iOffset;                 /* current position in zInput */
  int iToken;                  /* index of next token to be returned */
  char *zToken;                /* storage for current token */
  int nAllocated;              /* space allocated to zToken buffer */
} porter_tokenizer_cursor;


/* Forward declaration */
static const sqlite3_tokenizer_module porterTokenizerModule;


/*
** Create a new tokenizer instance.
*/
static int porterCreate(
  int argc, const char * const *argv,
  sqlite3_tokenizer **ppTokenizer
){
  porter_tokenizer *t;
  t = (porter_tokenizer *) calloc(sizeof(*t), 1);
  if( t==NULL ) return SQLITE_NOMEM;

  *ppTokenizer = &t->base;
  return SQLITE_OK;
}

/*
** Destroy a tokenizer
*/
static int porterDestroy(sqlite3_tokenizer *pTokenizer){
  free(pTokenizer);
  return SQLITE_OK;
}

/*
** Prepare to begin tokenizing a particular string.  The input
** string to be tokenized is zInput[0..nInput-1].  A cursor
** used to incrementally tokenize this string is returned in 
** *ppCursor.
*/
static int porterOpen(
  sqlite3_tokenizer *pTokenizer,         /* The tokenizer */
  const char *zInput, int nInput,        /* String to be tokenized */
  sqlite3_tokenizer_cursor **ppCursor    /* OUT: Tokenization cursor */
){
  porter_tokenizer_cursor *c;

  c = (porter_tokenizer_cursor *) malloc(sizeof(*c));
  if( c==NULL ) return SQLITE_NOMEM;

  c->zInput = zInput;
  if( zInput==0 ){
    c->nInput = 0;
  }else if( nInput<0 ){
    c->nInput = (int)strlen(zInput);
  }else{
    c->nInput = nInput;
  }
  c->iOffset = 0;                 /* start tokenizing at the beginning */
  c->iToken = 0;
  c->zToken = NULL;               /* no space allocated, yet. */
  c->nAllocated = 0;

  *ppCursor = &c->base;
  return SQLITE_OK;
}

/*
** Close a tokenization cursor previously opened by a call to
** porterOpen() above.
*/
static int porterClose(sqlite3_tokenizer_cursor *pCursor){
  porter_tokenizer_cursor *c = (porter_tokenizer_cursor *) pCursor;
  free(c->zToken);
  free(c);
  return SQLITE_OK;
}
/*
** Vowel or consonant
*/
static const char cType[] = {
   0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0,
   1, 1, 1, 2, 1
};

/*
** isConsonant() and isVowel() determine if their first character in
** the string they point to is a consonant or a vowel, according
** to Porter ruls.  
**
** A consonate is any letter other than 'a', 'e', 'i', 'o', or 'u'.
** 'Y' is a consonant unless it follows another consonant,
** in which case it is a vowel.
**
** In these routine, the letters are in reverse order.  So the 'y' rule
** is that 'y' is a consonant unless it is followed by another
** consonent.
*/
static int isVowel(const char*);
static int isConsonant(const char *z){
  int j;
  char x = *z;
  if( x==0 ) return 0;
  assert( x>='a' && x<='z' );
  j = cType[x-'a'];
  if( j<2 ) return j;
  return z[1]==0 || isVowel(z + 1);
}
static int isVowel(const char *z){
  int j;
  char x = *z;
  if( x==0 ) return 0;
  assert( x>='a' && x<='z' );
  j = cType[x-'a'];
  if( j<2 ) return 1-j;
  return isConsonant(z + 1);
}

/*
** Let any sequence of one or more vowels be represented by V and let
** C be sequence of one or more consonants.  Then every word can be
** represented as:
**
**           [C] (VC){m} [V]
**
** In prose:  A word is an optional consonant followed by zero or
** vowel-consonant pairs followed by an optional vowel.  "m" is the
** number of vowel consonant pairs.  This routine computes the value
** of m for the first i bytes of a word.
**
** Return true if the m-value for z is 1 or more.  In other words,
** return true if z contains at least one vowel that is followed
** by a consonant.
**
** In this routine z[] is in reverse order.  So we are really looking
** for an instance of of a consonant followed by a vowel.
*/
static int m_gt_0(const char *z){
  while( isVowel(z) ){ z++; }
  if( *z==0 ) return 0;
  while( isConsonant(z) ){ z++; }
  return *z!=0;
}

/* Like mgt0 above except we are looking for a value of m which is
** exactly 1
*/
static int m_eq_1(const char *z){
  while( isVowel(z) ){ z++; }
  if( *z==0 ) return 0;
  while( isConsonant(z) ){ z++; }
  if( *z==0 ) return 0;
  while( isVowel(z) ){ z++; }
  if( *z==0 ) return 1;
  while( isConsonant(z) ){ z++; }
  return *z==0;
}

/* Like mgt0 above except we are looking for a value of m>1 instead
** or m>0
*/
static int m_gt_1(const char *z){
  while( isVowel(z) ){ z++; }
  if( *z==0 ) return 0;
  while( isConsonant(z) ){ z++; }
  if( *z==0 ) return 0;
  while( isVowel(z) ){ z++; }
  if( *z==0 ) return 0;
  while( isConsonant(z) ){ z++; }
  return *z!=0;
}

/*
** Return TRUE if there is a vowel anywhere within z[0..n-1]
*/
static int hasVowel(const char *z){
  while( isConsonant(z) ){ z++; }
  return *z!=0;
}

/*
** Return TRUE if the word ends in a double consonant.
**
** The text is reversed here. So we are really looking at
** the first two characters of z[].
*/
static int doubleConsonant(const char *z){
  return isConsonant(z) && z[0]==z[1] && isConsonant(z+1);
}

/*
** Return TRUE if the word ends with three letters which
** are consonant-vowel-consonent and where the final consonant
** is not 'w', 'x', or 'y'.
**
** The word is reversed here.  So we are really checking the
** first three letters and the first one cannot be in [wxy].
*/
static int star_oh(const char *z){
  return
    z[0]!=0 && isConsonant(z) &&
    z[0]!='w' && z[0]!='x' && z[0]!='y' &&
    z[1]!=0 && isVowel(z+1) &&
    z[2]!=0 && isConsonant(z+2);
}

/*
** If the word ends with zFrom and xCond() is true for the stem
** of the word that preceeds the zFrom ending, then change the 
** ending to zTo.
**
** The input word *pz and zFrom are both in reverse order.  zTo
** is in normal order. 
**
** Return TRUE if zFrom matches.  Return FALSE if zFrom does not
** match.  Not that TRUE is returned even if xCond() fails and
** no substitution occurs.
*/
static int stem(
  char **pz,             /* The word being stemmed (Reversed) */
  const char *zFrom,     /* If the ending matches this... (Reversed) */
  const char *zTo,       /* ... change the ending to this (not reversed) */
  int (*xCond)(const char*)   /* Condition that must be true */
){
  char *z = *pz;
  while( *zFrom && *zFrom==*z ){ z++; zFrom++; }
  if( *zFrom!=0 ) return 0;
  if( xCond && !xCond(z) ) return 1;
  while( *zTo ){
    *(--z) = *(zTo++);
  }
  *pz = z;
  return 1;
}

/*
** This is the fallback stemmer used when the porter stemmer is
** inappropriate.  The input word is copied into the output with
** US-ASCII case folding.  If the input word is too long (more
** than 20 bytes if it contains no digits or more than 6 bytes if
** it contains digits) then word is truncated to 20 or 6 bytes
** by taking 10 or 3 bytes from the beginning and end.
*/
static void copy_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){
  int i, mx, j;
  int hasDigit = 0;
  for(i=0; i<nIn; i++){
    int c = zIn[i];
    if( c>='A' && c<='Z' ){
      zOut[i] = c - 'A' + 'a';
    }else{
      if( c>='0' && c<='9' ) hasDigit = 1;
      zOut[i] = c;
    }
  }
  mx = hasDigit ? 3 : 10;
  if( nIn>mx*2 ){
    for(j=mx, i=nIn-mx; i<nIn; i++, j++){
      zOut[j] = zOut[i];
    }
    i = j;
  }
  zOut[i] = 0;
  *pnOut = i;
}


/*
** Stem the input word zIn[0..nIn-1].  Store the output in zOut.
** zOut is at least big enough to hold nIn bytes.  Write the actual
** size of the output word (exclusive of the '\0' terminator) into *pnOut.
**
** Any upper-case characters in the US-ASCII character set ([A-Z])
** are converted to lower case.  Upper-case UTF characters are
** unchanged.
**
** Words that are longer than about 20 bytes are stemmed by retaining
** a few bytes from the beginning and the end of the word.  If the
** word contains digits, 3 bytes are taken from the beginning and
** 3 bytes from the end.  For long words without digits, 10 bytes
** are taken from each end.  US-ASCII case folding still applies.
** 
** If the input word contains not digits but does characters not 
** in [a-zA-Z] then no stemming is attempted and this routine just 
** copies the input into the input into the output with US-ASCII
** case folding.
**
** Stemming never increases the length of the word.  So there is
** no chance of overflowing the zOut buffer.
*/
static void porter_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){
  int i, j, c;
  char zReverse[28];
  char *z, *z2;
  if( nIn<3 || nIn>=sizeof(zReverse)-7 ){
    /* The word is too big or too small for the porter stemmer.
    ** Fallback to the copy stemmer */
    copy_stemmer(zIn, nIn, zOut, pnOut);
    return;
  }
  for(i=0, j=sizeof(zReverse)-6; i<nIn; i++, j--){
    c = zIn[i];
    if( c>='A' && c<='Z' ){
      zReverse[j] = c + 'a' - 'A';
    }else if( c>='a' && c<='z' ){
      zReverse[j] = c;
    }else{
      /* The use of a character not in [a-zA-Z] means that we fallback
      ** to the copy stemmer */
      copy_stemmer(zIn, nIn, zOut, pnOut);
      return;
    }
  }
  memset(&zReverse[sizeof(zReverse)-5], 0, 5);
  z = &zReverse[j+1];


  /* Step 1a */
  if( z[0]=='s' ){
    if(
     !stem(&z, "sess", "ss", 0) &&
     !stem(&z, "sei", "i", 0)  &&
     !stem(&z, "ss", "ss", 0)
    ){
      z++;
    }
  }

  /* Step 1b */  
  z2 = z;
  if( stem(&z, "dee", "ee", m_gt_0) ){
    /* Do nothing.  The work was all in the test */
  }else if( 
     (stem(&z, "gni", "", hasVowel) || stem(&z, "de", "", hasVowel))
      && z!=z2
  ){
     if( stem(&z, "ta", "ate", 0) ||
         stem(&z, "lb", "ble", 0) ||
         stem(&z, "zi", "ize", 0) ){
       /* Do nothing.  The work was all in the test */
     }else if( doubleConsonant(z) && (*z!='l' && *z!='s' && *z!='z') ){
       z++;
     }else if( m_eq_1(z) && star_oh(z) ){
       *(--z) = 'e';
     }
  }

  /* Step 1c */
  if( z[0]=='y' && hasVowel(z+1) ){
    z[0] = 'i';
  }

  /* Step 2 */
  switch( z[1] ){
   case 'a':
     stem(&z, "lanoita", "ate", m_gt_0) ||
     stem(&z, "lanoit", "tion", m_gt_0);
     break;
   case 'c':
     stem(&z, "icne", "ence", m_gt_0) ||
     stem(&z, "icna", "ance", m_gt_0);
     break;
   case 'e':
     stem(&z, "rezi", "ize", m_gt_0);
     break;
   case 'g':
     stem(&z, "igol", "log", m_gt_0);
     break;
   case 'l':
     stem(&z, "ilb", "ble", m_gt_0) ||
     stem(&z, "illa", "al", m_gt_0) ||
     stem(&z, "iltne", "ent", m_gt_0) ||
     stem(&z, "ile", "e", m_gt_0) ||
     stem(&z, "ilsuo", "ous", m_gt_0);
     break;
   case 'o':
     stem(&z, "noitazi", "ize", m_gt_0) ||
     stem(&z, "noita", "ate", m_gt_0) ||
     stem(&z, "rota", "ate", m_gt_0);
     break;
   case 's':
     stem(&z, "msila", "al", m_gt_0) ||
     stem(&z, "ssenevi", "ive", m_gt_0) ||
     stem(&z, "ssenluf", "ful", m_gt_0) ||
     stem(&z, "ssensuo", "ous", m_gt_0);
     break;
   case 't':
     stem(&z, "itila", "al", m_gt_0) ||
     stem(&z, "itivi", "ive", m_gt_0) ||
     stem(&z, "itilib", "ble", m_gt_0);
     break;
  }

  /* Step 3 */
  switch( z[0] ){
   case 'e':
     stem(&z, "etaci", "ic", m_gt_0) ||
     stem(&z, "evita", "", m_gt_0)   ||
     stem(&z, "ezila", "al", m_gt_0);
     break;
   case 'i':
     stem(&z, "itici", "ic", m_gt_0);
     break;
   case 'l':
     stem(&z, "laci", "ic", m_gt_0) ||
     stem(&z, "luf", "", m_gt_0);
     break;
   case 's':
     stem(&z, "ssen", "", m_gt_0);
     break;
  }

  /* Step 4 */
  switch( z[1] ){
   case 'a':
     if( z[0]=='l' && m_gt_1(z+2) ){
       z += 2;
     }
     break;
   case 'c':
     if( z[0]=='e' && z[2]=='n' && (z[3]=='a' || z[3]=='e')  && m_gt_1(z+4)  ){
       z += 4;
     }
     break;
   case 'e':
     if( z[0]=='r' && m_gt_1(z+2) ){
       z += 2;
     }
     break;
   case 'i':
     if( z[0]=='c' && m_gt_1(z+2) ){
       z += 2;
     }
     break;
   case 'l':
     if( z[0]=='e' && z[2]=='b' && (z[3]=='a' || z[3]=='i') && m_gt_1(z+4) ){
       z += 4;
     }
     break;
   case 'n':
     if( z[0]=='t' ){
       if( z[2]=='a' ){
         if( m_gt_1(z+3) ){
           z += 3;
         }
       }else if( z[2]=='e' ){
         stem(&z, "tneme", "", m_gt_1) ||
         stem(&z, "tnem", "", m_gt_1) ||
         stem(&z, "tne", "", m_gt_1);
       }
     }
     break;
   case 'o':
     if( z[0]=='u' ){
       if( m_gt_1(z+2) ){
         z += 2;
       }
     }else if( z[3]=='s' || z[3]=='t' ){
       stem(&z, "noi", "", m_gt_1);
     }
     break;
   case 's':
     if( z[0]=='m' && z[2]=='i' && m_gt_1(z+3) ){
       z += 3;
     }
     break;
   case 't':
     stem(&z, "eta", "", m_gt_1) ||
     stem(&z, "iti", "", m_gt_1);
     break;
   case 'u':
     if( z[0]=='s' && z[2]=='o' && m_gt_1(z+3) ){
       z += 3;
     }
     break;
   case 'v':
   case 'z':
     if( z[0]=='e' && z[2]=='i' && m_gt_1(z+3) ){
       z += 3;
     }
     break;
  }

  /* Step 5a */
  if( z[0]=='e' ){
    if( m_gt_1(z+1) ){
      z++;
    }else if( m_eq_1(z+1) && !star_oh(z+1) ){
      z++;
    }
  }

  /* Step 5b */
  if( m_gt_1(z) && z[0]=='l' && z[1]=='l' ){
    z++;
  }

  /* z[] is now the stemmed word in reverse order.  Flip it back
  ** around into forward order and return.
  */
  *pnOut = i = strlen(z);
  zOut[i] = 0;
  while( *z ){
    zOut[--i] = *(z++);
  }
}

/*
** Characters that can be part of a token.  We assume any character
** whose value is greater than 0x80 (any UTF character) can be
** part of a token.  In other words, delimiters all must have
** values of 0x7f or lower.
*/
static const char isIdChar[] = {
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  /* 3x */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 4x */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,  /* 5x */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 6x */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,  /* 7x */
};
#define idChar(C)  (((ch=C)&0x80)!=0 || (ch>0x2f && isIdChar[ch-0x30]))
#define isDelim(C) (((ch=C)&0x80)==0 && (ch<0x30 || !isIdChar[ch-0x30]))

/*
** Extract the next token from a tokenization cursor.  The cursor must
** have been opened by a prior call to porterOpen().
*/
static int porterNext(
  sqlite3_tokenizer_cursor *pCursor,  /* Cursor returned by porterOpen */
  const char **pzToken,               /* OUT: *pzToken is the token text */
  int *pnBytes,                       /* OUT: Number of bytes in token */
  int *piStartOffset,                 /* OUT: Starting offset of token */
  int *piEndOffset,                   /* OUT: Ending offset of token */
  int *piPosition                     /* OUT: Position integer of token */
){
  porter_tokenizer_cursor *c = (porter_tokenizer_cursor *) pCursor;
  const char *z = c->zInput;

  while( c->iOffset<c->nInput ){
    int iStartOffset, ch;

    /* Scan past delimiter characters */
    while( c->iOffset<c->nInput && isDelim(z[c->iOffset]) ){
      c->iOffset++;
    }

    /* Count non-delimiter characters. */
    iStartOffset = c->iOffset;
    while( c->iOffset<c->nInput && !isDelim(z[c->iOffset]) ){
      c->iOffset++;
    }

    if( c->iOffset>iStartOffset ){
      int n = c->iOffset-iStartOffset;
      if( n>c->nAllocated ){
        c->nAllocated = n+20;
        c->zToken = realloc(c->zToken, c->nAllocated);
        if( c->zToken==NULL ) return SQLITE_NOMEM;
      }
      porter_stemmer(&z[iStartOffset], n, c->zToken, pnBytes);
      *pzToken = c->zToken;
      *piStartOffset = iStartOffset;
      *piEndOffset = c->iOffset;
      *piPosition = c->iToken++;
      return SQLITE_OK;
    }
  }
  return SQLITE_DONE;
}

/*
** The set of routines that implement the porter-stemmer tokenizer
*/
static const sqlite3_tokenizer_module porterTokenizerModule = {
  0,
  porterCreate,
  porterDestroy,
  porterOpen,
  porterClose,
  porterNext,
};

/*
** Allocate a new porter tokenizer.  Return a pointer to the new
** tokenizer in *ppModule
*/
void sqlite3Fts1PorterTokenizerModule(
  sqlite3_tokenizer_module const**ppModule
){
  *ppModule = &porterTokenizerModule;
}

#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/FTS1/fts1_tokenizer.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
** 2006 July 10
**
** The author disclaims copyright to this source code.
**
*************************************************************************
** Defines the interface to tokenizers used by fulltext-search.  There
** are three basic components:
**
** sqlite3_tokenizer_module is a singleton defining the tokenizer
** interface functions.  This is essentially the class structure for
** tokenizers.
**
** sqlite3_tokenizer is used to define a particular tokenizer, perhaps
** including customization information defined at creation time.
**
** sqlite3_tokenizer_cursor is generated by a tokenizer to generate
** tokens from a particular input.
*/
#ifndef _FTS1_TOKENIZER_H_
#define _FTS1_TOKENIZER_H_

/* TODO(shess) Only used for SQLITE_OK and SQLITE_DONE at this time.
** If tokenizers are to be allowed to call sqlite3_*() functions, then
** we will need a way to register the API consistently.
*/
#include "sqlite3.h"

/*
** Structures used by the tokenizer interface.
*/
typedef struct sqlite3_tokenizer sqlite3_tokenizer;
typedef struct sqlite3_tokenizer_cursor sqlite3_tokenizer_cursor;
typedef struct sqlite3_tokenizer_module sqlite3_tokenizer_module;

struct sqlite3_tokenizer_module {
  int iVersion;                  /* currently 0 */

  /*
  ** Create and destroy a tokenizer.  argc/argv are passed down from
  ** the fulltext virtual table creation to allow customization.
  */
  int (*xCreate)(int argc, const char *const*argv,
                 sqlite3_tokenizer **ppTokenizer);
  int (*xDestroy)(sqlite3_tokenizer *pTokenizer);

  /*
  ** Tokenize a particular input.  Call xOpen() to prepare to
  ** tokenize, xNext() repeatedly until it returns SQLITE_DONE, then
  ** xClose() to free any internal state.  The pInput passed to
  ** xOpen() must exist until the cursor is closed.  The ppToken
  ** result from xNext() is only valid until the next call to xNext()
  ** or until xClose() is called.
  */
  /* TODO(shess) current implementation requires pInput to be
  ** nul-terminated.  This should either be fixed, or pInput/nBytes
  ** should be converted to zInput.
  */
  int (*xOpen)(sqlite3_tokenizer *pTokenizer,
               const char *pInput, int nBytes,
               sqlite3_tokenizer_cursor **ppCursor);
  int (*xClose)(sqlite3_tokenizer_cursor *pCursor);
  int (*xNext)(sqlite3_tokenizer_cursor *pCursor,
               const char **ppToken, int *pnBytes,
               int *piStartOffset, int *piEndOffset, int *piPosition);
};

struct sqlite3_tokenizer {
  const sqlite3_tokenizer_module *pModule;  /* The module for this tokenizer */
  /* Tokenizer implementations will typically add additional fields */
};

struct sqlite3_tokenizer_cursor {
  sqlite3_tokenizer *pTokenizer;       /* Tokenizer for this cursor. */
  /* Tokenizer implementations will typically add additional fields */
};

/*
** Get the module for a tokenizer which generates tokens based on a
** set of non-token characters.  The default is to break tokens at any
** non-alnum character, though the set of delimiters can also be
** specified by the first argv argument to xCreate().
*/
/* TODO(shess) This doesn't belong here.  Need some sort of
** registration process.
*/
void sqlite3Fts1SimpleTokenizerModule(sqlite3_tokenizer_module const**ppModule);
void sqlite3Fts1PorterTokenizerModule(sqlite3_tokenizer_module const**ppModule);

#endif /* _FTS1_TOKENIZER_H_ */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































Deleted SQLite.Interop/FTS1/fts1_tokenizer1.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
/*
** The author disclaims copyright to this source code.
**
*************************************************************************
** Implementation of the "simple" full-text-search tokenizer.
*/

/*
** The code in this file is only compiled if:
**
**     * The FTS1 module is being built as an extension
**       (in which case SQLITE_CORE is not defined), or
**
**     * The FTS1 module is being built into the core of
**       SQLite (in which case SQLITE_ENABLE_FTS1 is defined).
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1)


#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

#include "fts1_tokenizer.h"

typedef struct simple_tokenizer {
  sqlite3_tokenizer base;
  char delim[128];             /* flag ASCII delimiters */
} simple_tokenizer;

typedef struct simple_tokenizer_cursor {
  sqlite3_tokenizer_cursor base;
  const char *pInput;          /* input we are tokenizing */
  int nBytes;                  /* size of the input */
  int iOffset;                 /* current position in pInput */
  int iToken;                  /* index of next token to be returned */
  char *pToken;                /* storage for current token */
  int nTokenAllocated;         /* space allocated to zToken buffer */
} simple_tokenizer_cursor;


/* Forward declaration */
static const sqlite3_tokenizer_module simpleTokenizerModule;

static int isDelim(simple_tokenizer *t, unsigned char c){
  return c<0x80 && t->delim[c];
}

/*
** Create a new tokenizer instance.
*/
static int simpleCreate(
  int argc, const char * const *argv,
  sqlite3_tokenizer **ppTokenizer
){
  simple_tokenizer *t;

  t = (simple_tokenizer *) calloc(sizeof(*t), 1);
  if( t==NULL ) return SQLITE_NOMEM;

  /* TODO(shess) Delimiters need to remain the same from run to run,
  ** else we need to reindex.  One solution would be a meta-table to
  ** track such information in the database, then we'd only want this
  ** information on the initial create.
  */
  if( argc>1 ){
    int i, n = strlen(argv[1]);
    for(i=0; i<n; i++){
      unsigned char ch = argv[1][i];
      /* We explicitly don't support UTF-8 delimiters for now. */
      if( ch>=0x80 ){
        free(t);
        return SQLITE_ERROR;
      }
      t->delim[ch] = 1;
    }
  } else {
    /* Mark non-alphanumeric ASCII characters as delimiters */
    int i;
    for(i=1; i<0x80; i++){
      t->delim[i] = !isalnum(i);
    }
  }

  *ppTokenizer = &t->base;
  return SQLITE_OK;
}

/*
** Destroy a tokenizer
*/
static int simpleDestroy(sqlite3_tokenizer *pTokenizer){
  free(pTokenizer);
  return SQLITE_OK;
}

/*
** Prepare to begin tokenizing a particular string.  The input
** string to be tokenized is pInput[0..nBytes-1].  A cursor
** used to incrementally tokenize this string is returned in 
** *ppCursor.
*/
static int simpleOpen(
  sqlite3_tokenizer *pTokenizer,         /* The tokenizer */
  const char *pInput, int nBytes,        /* String to be tokenized */
  sqlite3_tokenizer_cursor **ppCursor    /* OUT: Tokenization cursor */
){
  simple_tokenizer_cursor *c;

  c = (simple_tokenizer_cursor *) malloc(sizeof(*c));
  if( c==NULL ) return SQLITE_NOMEM;

  c->pInput = pInput;
  if( pInput==0 ){
    c->nBytes = 0;
  }else if( nBytes<0 ){
    c->nBytes = (int)strlen(pInput);
  }else{
    c->nBytes = nBytes;
  }
  c->iOffset = 0;                 /* start tokenizing at the beginning */
  c->iToken = 0;
  c->pToken = NULL;               /* no space allocated, yet. */
  c->nTokenAllocated = 0;

  *ppCursor = &c->base;
  return SQLITE_OK;
}

/*
** Close a tokenization cursor previously opened by a call to
** simpleOpen() above.
*/
static int simpleClose(sqlite3_tokenizer_cursor *pCursor){
  simple_tokenizer_cursor *c = (simple_tokenizer_cursor *) pCursor;
  free(c->pToken);
  free(c);
  return SQLITE_OK;
}

/*
** Extract the next token from a tokenization cursor.  The cursor must
** have been opened by a prior call to simpleOpen().
*/
static int simpleNext(
  sqlite3_tokenizer_cursor *pCursor,  /* Cursor returned by simpleOpen */
  const char **ppToken,               /* OUT: *ppToken is the token text */
  int *pnBytes,                       /* OUT: Number of bytes in token */
  int *piStartOffset,                 /* OUT: Starting offset of token */
  int *piEndOffset,                   /* OUT: Ending offset of token */
  int *piPosition                     /* OUT: Position integer of token */
){
  simple_tokenizer_cursor *c = (simple_tokenizer_cursor *) pCursor;
  simple_tokenizer *t = (simple_tokenizer *) pCursor->pTokenizer;
  unsigned char *p = (unsigned char *)c->pInput;

  while( c->iOffset<c->nBytes ){
    int iStartOffset;

    /* Scan past delimiter characters */
    while( c->iOffset<c->nBytes && isDelim(t, p[c->iOffset]) ){
      c->iOffset++;
    }

    /* Count non-delimiter characters. */
    iStartOffset = c->iOffset;
    while( c->iOffset<c->nBytes && !isDelim(t, p[c->iOffset]) ){
      c->iOffset++;
    }

    if( c->iOffset>iStartOffset ){
      int i, n = c->iOffset-iStartOffset;
      if( n>c->nTokenAllocated ){
        c->nTokenAllocated = n+20;
        c->pToken = realloc(c->pToken, c->nTokenAllocated);
        if( c->pToken==NULL ) return SQLITE_NOMEM;
      }
      for(i=0; i<n; i++){
        /* TODO(shess) This needs expansion to handle UTF-8
        ** case-insensitivity.
        */
        unsigned char ch = p[iStartOffset+i];
        c->pToken[i] = ch<0x80 ? tolower(ch) : ch;
      }
      *ppToken = c->pToken;
      *pnBytes = n;
      *piStartOffset = iStartOffset;
      *piEndOffset = c->iOffset;
      *piPosition = c->iToken++;

      return SQLITE_OK;
    }
  }
  return SQLITE_DONE;
}

/*
** The set of routines that implement the simple tokenizer
*/
static const sqlite3_tokenizer_module simpleTokenizerModule = {
  0,
  simpleCreate,
  simpleDestroy,
  simpleOpen,
  simpleClose,
  simpleNext,
};

/*
** Allocate a new simple tokenizer.  Return a pointer to the new
** tokenizer in *ppModule
*/
void sqlite3Fts1SimpleTokenizerModule(
  sqlite3_tokenizer_module const**ppModule
){
  *ppModule = &simpleTokenizerModule;
}

#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































































































































































Deleted SQLite.Interop/FTS2/FTS2.vcproj.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
	ProjectType="Visual C++"
	Version="8.00"
	Name="SQLite.Interop.FTS2"
	ProjectGUID="{BCD4CA74-771B-49EE-9025-606CB839DA0B}"
	RootNamespace="FTS2"
	Keyword="Win32Proj"
	>
	<Platforms>
		<Platform
			Name="Win32"
		/>
		<Platform
			Name="Pocket PC 2003 (ARMV4)"
		/>
		<Platform
			Name="Itanium"
		/>
		<Platform
			Name="x64"
		/>
	</Platforms>
	<ToolFiles>
	</ToolFiles>
	<Configurations>
		<Configuration
			Name="Debug|Win32"
			OutputDirectory="$(ConfigurationName)"
			IntermediateDirectory="$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;SQLITE_ENABLE_FTS2;SQLITE_CORE;SQLITE_ENABLE_BROKEN_FTS2"
				RuntimeLibrary="3"
				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
				DebugInformationFormat="3"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLibrarianTool"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
		<Configuration
			Name="Debug|Pocket PC 2003 (ARMV4)"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="1"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				AdditionalOptions="/GS-"
				Optimization="0"
				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;SQLITE_ENABLE_FTS2;SQLITE_CORE;SQLITE_ENABLE_BROKEN_FTS2"
				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
				DebugInformationFormat="3"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLibrarianTool"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory=""
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
		<Configuration
			Name="Debug|Itanium"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="2"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN64;_DEBUG;_LIB;SQLITE_ENABLE_FTS2;SQLITE_CORE;SQLITE_ENABLE_BROKEN_FTS2"
				RuntimeLibrary="3"
				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
				DebugInformationFormat="3"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLibrarianTool"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
		<Configuration
			Name="Debug|x64"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN64;_DEBUG;_LIB;SQLITE_ENABLE_FTS2;SQLITE_CORE;SQLITE_ENABLE_BROKEN_FTS2"
				RuntimeLibrary="3"
				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
				DebugInformationFormat="3"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLibrarianTool"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
		<Configuration
			Name="Release|Win32"
			OutputDirectory="$(ConfigurationName)"
			IntermediateDirectory="$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;SQLITE_ENABLE_FTS2;SQLITE_CORE;SQLITE_ENABLE_BROKEN_FTS2"
				StringPooling="true"
				ExceptionHandling="0"
				BufferSecurityCheck="false"
				EnableFunctionLevelLinking="true"
				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLibrarianTool"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
		<Configuration
			Name="Release|Pocket PC 2003 (ARMV4)"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="1"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;SQLITE_ENABLE_FTS2;SQLITE_CORE;SQLITE_ENABLE_BROKEN_FTS2"
				StringPooling="true"
				ExceptionHandling="0"
				BufferSecurityCheck="false"
				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLibrarianTool"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory=""
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
		<Configuration
			Name="Release|Itanium"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="2"
			/>
			<Tool
				Name="VCCLCompilerTool"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN64;NDEBUG;_LIB;SQLITE_ENABLE_FTS2;SQLITE_CORE;SQLITE_ENABLE_BROKEN_FTS2"
				StringPooling="true"
				ExceptionHandling="0"
				BufferSecurityCheck="false"
				EnableFunctionLevelLinking="true"
				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLibrarianTool"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
		<Configuration
			Name="Release|x64"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="4"
			CharacterSet="2"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="..\src"
				PreprocessorDefinitions="WIN64;NDEBUG;_LIB;SQLITE_ENABLE_FTS2;SQLITE_CORE;SQLITE_ENABLE_BROKEN_FTS2"
				StringPooling="true"
				ExceptionHandling="0"
				BufferSecurityCheck="false"
				EnableFunctionLevelLinking="true"
				RuntimeTypeInfo="false"
				UsePrecompiledHeader="0"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLibrarianTool"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
	</Configurations>
	<References>
	</References>
	<Files>
		<Filter
			Name="Source Files"
			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
			>
			<File
				RelativePath=".\fts2.c"
				>
			</File>
			<File
				RelativePath=".\fts2_hash.c"
				>
			</File>
			<File
				RelativePath=".\fts2_porter.c"
				>
			</File>
			<File
				RelativePath=".\fts2_tokenizer.c"
				>
			</File>
			<File
				RelativePath=".\fts2_tokenizer1.c"
				>
			</File>
		</Filter>
		<Filter
			Name="Header Files"
			Filter="h;hpp;hxx;hm;inl;inc;xsd"
			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
			>
			<File
				RelativePath=".\fts2.h"
				>
			</File>
			<File
				RelativePath=".\fts2_hash.h"
				>
			</File>
			<File
				RelativePath=".\fts2_tokenizer.h"
				>
			</File>
		</Filter>
		<Filter
			Name="Resource Files"
			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
			>
		</Filter>
		<File
			RelativePath=".\ReadMe.txt"
			>
		</File>
	</Files>
	<Globals>
	</Globals>
</VisualStudioProject>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/FTS2/fts2.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
/* fts2 has a design flaw which can lead to database corruption (see
** below).  It is recommended not to use it any longer, instead use
** fts3 (or higher).  If you believe that your use of fts2 is safe,
** add -DSQLITE_ENABLE_BROKEN_FTS2=1 to your CFLAGS.
*/
#ifndef SQLITE_ENABLE_BROKEN_FTS2
#error fts2 has a design flaw and has been deprecated.
#endif
/* The flaw is that fts2 uses the content table's unaliased rowid as
** the unique docid.  fts2 embeds the rowid in the index it builds,
** and expects the rowid to not change.  The SQLite VACUUM operation
** will renumber such rowids, thereby breaking fts2.  If you are using
** fts2 in a system which has disabled VACUUM, then you can continue
** to use it safely.  Note that PRAGMA auto_vacuum does NOT disable
** VACUUM, though systems using auto_vacuum are unlikely to invoke
** VACUUM.
**
** Unlike fts1, which is safe across VACUUM if you never delete
** documents, fts2 has a second exposure to this flaw, in the segments
** table.  So fts2 should be considered unsafe across VACUUM in all
** cases.
*/

/*
** 2006 Oct 10
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This is an SQLite module implementing full-text search.
*/

/*
** The code in this file is only compiled if:
**
**     * The FTS2 module is being built as an extension
**       (in which case SQLITE_CORE is not defined), or
**
**     * The FTS2 module is being built into the core of
**       SQLite (in which case SQLITE_ENABLE_FTS2 is defined).
*/

/* TODO(shess) Consider exporting this comment to an HTML file or the
** wiki.
*/
/* The full-text index is stored in a series of b+tree (-like)
** structures called segments which map terms to doclists.  The
** structures are like b+trees in layout, but are constructed from the
** bottom up in optimal fashion and are not updatable.  Since trees
** are built from the bottom up, things will be described from the
** bottom up.
**
**
**** Varints ****
** The basic unit of encoding is a variable-length integer called a
** varint.  We encode variable-length integers in little-endian order
** using seven bits * per byte as follows:
**
** KEY:
**         A = 0xxxxxxx    7 bits of data and one flag bit
**         B = 1xxxxxxx    7 bits of data and one flag bit
**
**  7 bits - A
** 14 bits - BA
** 21 bits - BBA
** and so on.
**
** This is identical to how sqlite encodes varints (see util.c).
**
**
**** Document lists ****
** A doclist (document list) holds a docid-sorted list of hits for a
** given term.  Doclists hold docids, and can optionally associate
** token positions and offsets with docids.
**
** A DL_POSITIONS_OFFSETS doclist is stored like this:
**
** array {
**   varint docid;
**   array {                (position list for column 0)
**     varint position;     (delta from previous position plus POS_BASE)
**     varint startOffset;  (delta from previous startOffset)
**     varint endOffset;    (delta from startOffset)
**   }
**   array {
**     varint POS_COLUMN;   (marks start of position list for new column)
**     varint column;       (index of new column)
**     array {
**       varint position;   (delta from previous position plus POS_BASE)
**       varint startOffset;(delta from previous startOffset)
**       varint endOffset;  (delta from startOffset)
**     }
**   }
**   varint POS_END;        (marks end of positions for this document.
** }
**
** Here, array { X } means zero or more occurrences of X, adjacent in
** memory.  A "position" is an index of a token in the token stream
** generated by the tokenizer, while an "offset" is a byte offset,
** both based at 0.  Note that POS_END and POS_COLUMN occur in the
** same logical place as the position element, and act as sentinals
** ending a position list array.
**
** A DL_POSITIONS doclist omits the startOffset and endOffset
** information.  A DL_DOCIDS doclist omits both the position and
** offset information, becoming an array of varint-encoded docids.
**
** On-disk data is stored as type DL_DEFAULT, so we don't serialize
** the type.  Due to how deletion is implemented in the segmentation
** system, on-disk doclists MUST store at least positions.
**
**
**** Segment leaf nodes ****
** Segment leaf nodes store terms and doclists, ordered by term.  Leaf
** nodes are written using LeafWriter, and read using LeafReader (to
** iterate through a single leaf node's data) and LeavesReader (to
** iterate through a segment's entire leaf layer).  Leaf nodes have
** the format:
**
** varint iHeight;             (height from leaf level, always 0)
** varint nTerm;               (length of first term)
** char pTerm[nTerm];          (content of first term)
** varint nDoclist;            (length of term's associated doclist)
** char pDoclist[nDoclist];    (content of doclist)
** array {
**                             (further terms are delta-encoded)
**   varint nPrefix;           (length of prefix shared with previous term)
**   varint nSuffix;           (length of unshared suffix)
**   char pTermSuffix[nSuffix];(unshared suffix of next term)
**   varint nDoclist;          (length of term's associated doclist)
**   char pDoclist[nDoclist];  (content of doclist)
** }
**
** Here, array { X } means zero or more occurrences of X, adjacent in
** memory.
**
** Leaf nodes are broken into blocks which are stored contiguously in
** the %_segments table in sorted order.  This means that when the end
** of a node is reached, the next term is in the node with the next
** greater node id.
**
** New data is spilled to a new leaf node when the current node
** exceeds LEAF_MAX bytes (default 2048).  New data which itself is
** larger than STANDALONE_MIN (default 1024) is placed in a standalone
** node (a leaf node with a single term and doclist).  The goal of
** these settings is to pack together groups of small doclists while
** making it efficient to directly access large doclists.  The
** assumption is that large doclists represent terms which are more
** likely to be query targets.
**
** TODO(shess) It may be useful for blocking decisions to be more
** dynamic.  For instance, it may make more sense to have a 2.5k leaf
** node rather than splitting into 2k and .5k nodes.  My intuition is
** that this might extend through 2x or 4x the pagesize.
**
**
**** Segment interior nodes ****
** Segment interior nodes store blockids for subtree nodes and terms
** to describe what data is stored by the each subtree.  Interior
** nodes are written using InteriorWriter, and read using
** InteriorReader.  InteriorWriters are created as needed when
** SegmentWriter creates new leaf nodes, or when an interior node
** itself grows too big and must be split.  The format of interior
** nodes:
**
** varint iHeight;           (height from leaf level, always >0)
** varint iBlockid;          (block id of node's leftmost subtree)
** optional {
**   varint nTerm;           (length of first term)
**   char pTerm[nTerm];      (content of first term)
**   array {
**                                (further terms are delta-encoded)
**     varint nPrefix;            (length of shared prefix with previous term)
**     varint nSuffix;            (length of unshared suffix)
**     char pTermSuffix[nSuffix]; (unshared suffix of next term)
**   }
** }
**
** Here, optional { X } means an optional element, while array { X }
** means zero or more occurrences of X, adjacent in memory.
**
** An interior node encodes n terms separating n+1 subtrees.  The
** subtree blocks are contiguous, so only the first subtree's blockid
** is encoded.  The subtree at iBlockid will contain all terms less
** than the first term encoded (or all terms if no term is encoded).
** Otherwise, for terms greater than or equal to pTerm[i] but less
** than pTerm[i+1], the subtree for that term will be rooted at
** iBlockid+i.  Interior nodes only store enough term data to
** distinguish adjacent children (if the rightmost term of the left
** child is "something", and the leftmost term of the right child is
** "wicked", only "w" is stored).
**
** New data is spilled to a new interior node at the same height when
** the current node exceeds INTERIOR_MAX bytes (default 2048).
** INTERIOR_MIN_TERMS (default 7) keeps large terms from monopolizing
** interior nodes and making the tree too skinny.  The interior nodes
** at a given height are naturally tracked by interior nodes at
** height+1, and so on.
**
**
**** Segment directory ****
** The segment directory in table %_segdir stores meta-information for
** merging and deleting segments, and also the root node of the
** segment's tree.
**
** The root node is the top node of the segment's tree after encoding
** the entire segment, restricted to ROOT_MAX bytes (default 1024).
** This could be either a leaf node or an interior node.  If the top
** node requires more than ROOT_MAX bytes, it is flushed to %_segments
** and a new root interior node is generated (which should always fit
** within ROOT_MAX because it only needs space for 2 varints, the
** height and the blockid of the previous root).
**
** The meta-information in the segment directory is:
**   level               - segment level (see below)
**   idx                 - index within level
**                       - (level,idx uniquely identify a segment)
**   start_block         - first leaf node
**   leaves_end_block    - last leaf node
**   end_block           - last block (including interior nodes)
**   root                - contents of root node
**
** If the root node is a leaf node, then start_block,
** leaves_end_block, and end_block are all 0.
**
**
**** Segment merging ****
** To amortize update costs, segments are groups into levels and
** merged in matches.  Each increase in level represents exponentially
** more documents.
**
** New documents (actually, document updates) are tokenized and
** written individually (using LeafWriter) to a level 0 segment, with
** incrementing idx.  When idx reaches MERGE_COUNT (default 16), all
** level 0 segments are merged into a single level 1 segment.  Level 1
** is populated like level 0, and eventually MERGE_COUNT level 1
** segments are merged to a single level 2 segment (representing
** MERGE_COUNT^2 updates), and so on.
**
** A segment merge traverses all segments at a given level in
** parallel, performing a straightforward sorted merge.  Since segment
** leaf nodes are written in to the %_segments table in order, this
** merge traverses the underlying sqlite disk structures efficiently.
** After the merge, all segment blocks from the merged level are
** deleted.
**
** MERGE_COUNT controls how often we merge segments.  16 seems to be
** somewhat of a sweet spot for insertion performance.  32 and 64 show
** very similar performance numbers to 16 on insertion, though they're
** a tiny bit slower (perhaps due to more overhead in merge-time
** sorting).  8 is about 20% slower than 16, 4 about 50% slower than
** 16, 2 about 66% slower than 16.
**
** At query time, high MERGE_COUNT increases the number of segments
** which need to be scanned and merged.  For instance, with 100k docs
** inserted:
**
**    MERGE_COUNT   segments
**       16           25
**        8           12
**        4           10
**        2            6
**
** This appears to have only a moderate impact on queries for very
** frequent terms (which are somewhat dominated by segment merge
** costs), and infrequent and non-existent terms still seem to be fast
** even with many segments.
**
** TODO(shess) That said, it would be nice to have a better query-side
** argument for MERGE_COUNT of 16.  Also, it's possible/likely that
** optimizations to things like doclist merging will swing the sweet
** spot around.
**
**
**
**** Handling of deletions and updates ****
** Since we're using a segmented structure, with no docid-oriented
** index into the term index, we clearly cannot simply update the term
** index when a document is deleted or updated.  For deletions, we
** write an empty doclist (varint(docid) varint(POS_END)), for updates
** we simply write the new doclist.  Segment merges overwrite older
** data for a particular docid with newer data, so deletes or updates
** will eventually overtake the earlier data and knock it out.  The
** query logic likewise merges doclists so that newer data knocks out
** older data.
**
** TODO(shess) Provide a VACUUM type operation to clear out all
** deletions and duplications.  This would basically be a forced merge
** into a single segment.
*/

#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2)

#if defined(SQLITE_ENABLE_FTS2) && !defined(SQLITE_CORE)
# define SQLITE_CORE 1
#endif

#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

#include "fts2.h"
#include "fts2_hash.h"
#include "fts2_tokenizer.h"
#include "sqlite3.h"
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1


/* TODO(shess) MAN, this thing needs some refactoring.  At minimum, it
** would be nice to order the file better, perhaps something along the
** lines of:
**
**  - utility functions
**  - table setup functions
**  - table update functions
**  - table query functions
**
** Put the query functions last because they're likely to reference
** typedefs or functions from the table update section.
*/

#if 0
# define TRACE(A)  printf A; fflush(stdout)
#else
# define TRACE(A)
#endif

/* It is not safe to call isspace(), tolower(), or isalnum() on
** hi-bit-set characters.  This is the same solution used in the
** tokenizer.
*/
/* TODO(shess) The snippet-generation code should be using the
** tokenizer-generated tokens rather than doing its own local
** tokenization.
*/
/* TODO(shess) Is __isascii() a portable version of (c&0x80)==0? */
static int safe_isspace(char c){
  return (c&0x80)==0 ? isspace(c) : 0;
}
static int safe_tolower(char c){
  return (c&0x80)==0 ? tolower(c) : c;
}
static int safe_isalnum(char c){
  return (c&0x80)==0 ? isalnum(c) : 0;
}

typedef enum DocListType {
  DL_DOCIDS,              /* docids only */
  DL_POSITIONS,           /* docids + positions */
  DL_POSITIONS_OFFSETS    /* docids + positions + offsets */
} DocListType;

/*
** By default, only positions and not offsets are stored in the doclists.
** To change this so that offsets are stored too, compile with
**
**          -DDL_DEFAULT=DL_POSITIONS_OFFSETS
**
** If DL_DEFAULT is set to DL_DOCIDS, your table can only be inserted
** into (no deletes or updates).
*/
#ifndef DL_DEFAULT
# define DL_DEFAULT DL_POSITIONS
#endif

enum {
  POS_END = 0,        /* end of this position list */
  POS_COLUMN,         /* followed by new column number */
  POS_BASE
};

/* MERGE_COUNT controls how often we merge segments (see comment at
** top of file).
*/
#define MERGE_COUNT 16

/* utility functions */

/* CLEAR() and SCRAMBLE() abstract memset() on a pointer to a single
** record to prevent errors of the form:
**
** my_function(SomeType *b){
**   memset(b, '\0', sizeof(b));  // sizeof(b)!=sizeof(*b)
** }
*/
/* TODO(shess) Obvious candidates for a header file. */
#define CLEAR(b) memset(b, '\0', sizeof(*(b)))

#ifndef NDEBUG
#  define SCRAMBLE(b) memset(b, 0x55, sizeof(*(b)))
#else
#  define SCRAMBLE(b)
#endif

/* We may need up to VARINT_MAX bytes to store an encoded 64-bit integer. */
#define VARINT_MAX 10

/* Write a 64-bit variable-length integer to memory starting at p[0].
 * The length of data written will be between 1 and VARINT_MAX bytes.
 * The number of bytes written is returned. */
static int putVarint(char *p, sqlite_int64 v){
  unsigned char *q = (unsigned char *) p;
  sqlite_uint64 vu = v;
  do{
    *q++ = (unsigned char) ((vu & 0x7f) | 0x80);
    vu >>= 7;
  }while( vu!=0 );
  q[-1] &= 0x7f;  /* turn off high bit in final byte */
  assert( q - (unsigned char *)p <= VARINT_MAX );
  return (int) (q - (unsigned char *)p);
}

/* Read a 64-bit variable-length integer from memory starting at p[0].
 * Return the number of bytes read, or 0 on error.
 * The value is stored in *v. */
static int getVarint(const char *p, sqlite_int64 *v){
  const unsigned char *q = (const unsigned char *) p;
  sqlite_uint64 x = 0, y = 1;
  while( (*q & 0x80) == 0x80 ){
    x += y * (*q++ & 0x7f);
    y <<= 7;
    if( q - (unsigned char *)p >= VARINT_MAX ){  /* bad data */
      assert( 0 );
      return 0;
    }
  }
  x += y * (*q++);
  *v = (sqlite_int64) x;
  return (int) (q - (unsigned char *)p);
}

static int getVarint32(const char *p, int *pi){
 sqlite_int64 i;
 int ret = getVarint(p, &i);
 *pi = (int) i;
 assert( *pi==i );
 return ret;
}

/*******************************************************************/
/* DataBuffer is used to collect data into a buffer in piecemeal
** fashion.  It implements the usual distinction between amount of
** data currently stored (nData) and buffer capacity (nCapacity).
**
** dataBufferInit - create a buffer with given initial capacity.
** dataBufferReset - forget buffer's data, retaining capacity.
** dataBufferDestroy - free buffer's data.
** dataBufferExpand - expand capacity without adding data.
** dataBufferAppend - append data.
** dataBufferAppend2 - append two pieces of data at once.
** dataBufferReplace - replace buffer's data.
*/
typedef struct DataBuffer {
  char *pData;          /* Pointer to malloc'ed buffer. */
  int nCapacity;        /* Size of pData buffer. */
  int nData;            /* End of data loaded into pData. */
} DataBuffer;

static void dataBufferInit(DataBuffer *pBuffer, int nCapacity){
  assert( nCapacity>=0 );
  pBuffer->nData = 0;
  pBuffer->nCapacity = nCapacity;
  pBuffer->pData = nCapacity==0 ? NULL : malloc(nCapacity);
}
static void dataBufferReset(DataBuffer *pBuffer){
  pBuffer->nData = 0;
}
static void dataBufferDestroy(DataBuffer *pBuffer){
  if( pBuffer->pData!=NULL ) free(pBuffer->pData);
  SCRAMBLE(pBuffer);
}
static void dataBufferExpand(DataBuffer *pBuffer, int nAddCapacity){
  assert( nAddCapacity>0 );
  /* TODO(shess) Consider expanding more aggressively.  Note that the
  ** underlying malloc implementation may take care of such things for
  ** us already.
  */
  if( pBuffer->nData+nAddCapacity>pBuffer->nCapacity ){
    pBuffer->nCapacity = pBuffer->nData+nAddCapacity;
    pBuffer->pData = realloc(pBuffer->pData, pBuffer->nCapacity);
  }
}
static void dataBufferAppend(DataBuffer *pBuffer,
                             const char *pSource, int nSource){
  assert( nSource>0 && pSource!=NULL );
  dataBufferExpand(pBuffer, nSource);
  memcpy(pBuffer->pData+pBuffer->nData, pSource, nSource);
  pBuffer->nData += nSource;
}
static void dataBufferAppend2(DataBuffer *pBuffer,
                              const char *pSource1, int nSource1,
                              const char *pSource2, int nSource2){
  assert( nSource1>0 && pSource1!=NULL );
  assert( nSource2>0 && pSource2!=NULL );
  dataBufferExpand(pBuffer, nSource1+nSource2);
  memcpy(pBuffer->pData+pBuffer->nData, pSource1, nSource1);
  memcpy(pBuffer->pData+pBuffer->nData+nSource1, pSource2, nSource2);
  pBuffer->nData += nSource1+nSource2;
}
static void dataBufferReplace(DataBuffer *pBuffer,
                              const char *pSource, int nSource){
  dataBufferReset(pBuffer);
  dataBufferAppend(pBuffer, pSource, nSource);
}

/* StringBuffer is a null-terminated version of DataBuffer. */
typedef struct StringBuffer {
  DataBuffer b;            /* Includes null terminator. */
} StringBuffer;

static void initStringBuffer(StringBuffer *sb){
  dataBufferInit(&sb->b, 100);
  dataBufferReplace(&sb->b, "", 1);
}
static int stringBufferLength(StringBuffer *sb){
  return sb->b.nData-1;
}
static char *stringBufferData(StringBuffer *sb){
  return sb->b.pData;
}
static void stringBufferDestroy(StringBuffer *sb){
  dataBufferDestroy(&sb->b);
}

static void nappend(StringBuffer *sb, const char *zFrom, int nFrom){
  assert( sb->b.nData>0 );
  if( nFrom>0 ){
    sb->b.nData--;
    dataBufferAppend2(&sb->b, zFrom, nFrom, "", 1);
  }
}
static void append(StringBuffer *sb, const char *zFrom){
  nappend(sb, zFrom, strlen(zFrom));
}

/* Append a list of strings separated by commas. */
static void appendList(StringBuffer *sb, int nString, char **azString){
  int i;
  for(i=0; i<nString; ++i){
    if( i>0 ) append(sb, ", ");
    append(sb, azString[i]);
  }
}

static int endsInWhiteSpace(StringBuffer *p){
  return stringBufferLength(p)>0 &&
    safe_isspace(stringBufferData(p)[stringBufferLength(p)-1]);
}

/* If the StringBuffer ends in something other than white space, add a
** single space character to the end.
*/
static void appendWhiteSpace(StringBuffer *p){
  if( stringBufferLength(p)==0 ) return;
  if( !endsInWhiteSpace(p) ) append(p, " ");
}

/* Remove white space from the end of the StringBuffer */
static void trimWhiteSpace(StringBuffer *p){
  while( endsInWhiteSpace(p) ){
    p->b.pData[--p->b.nData-1] = '\0';
  }
}

/*******************************************************************/
/* DLReader is used to read document elements from a doclist.  The
** current docid is cached, so dlrDocid() is fast.  DLReader does not
** own the doclist buffer.
**
** dlrAtEnd - true if there's no more data to read.
** dlrDocid - docid of current document.
** dlrDocData - doclist data for current document (including docid).
** dlrDocDataBytes - length of same.
** dlrAllDataBytes - length of all remaining data.
** dlrPosData - position data for current document.
** dlrPosDataLen - length of pos data for current document (incl POS_END).
** dlrStep - step to current document.
** dlrInit - initial for doclist of given type against given data.
** dlrDestroy - clean up.
**
** Expected usage is something like:
**
**   DLReader reader;
**   dlrInit(&reader, pData, nData);
**   while( !dlrAtEnd(&reader) ){
**     // calls to dlrDocid() and kin.
**     dlrStep(&reader);
**   }
**   dlrDestroy(&reader);
*/
typedef struct DLReader {
  DocListType iType;
  const char *pData;
  int nData;

  sqlite_int64 iDocid;
  int nElement;
} DLReader;

static int dlrAtEnd(DLReader *pReader){
  assert( pReader->nData>=0 );
  return pReader->nData==0;
}
static sqlite_int64 dlrDocid(DLReader *pReader){
  assert( !dlrAtEnd(pReader) );
  return pReader->iDocid;
}
static const char *dlrDocData(DLReader *pReader){
  assert( !dlrAtEnd(pReader) );
  return pReader->pData;
}
static int dlrDocDataBytes(DLReader *pReader){
  assert( !dlrAtEnd(pReader) );
  return pReader->nElement;
}
static int dlrAllDataBytes(DLReader *pReader){
  assert( !dlrAtEnd(pReader) );
  return pReader->nData;
}
/* TODO(shess) Consider adding a field to track iDocid varint length
** to make these two functions faster.  This might matter (a tiny bit)
** for queries.
*/
static const char *dlrPosData(DLReader *pReader){
  sqlite_int64 iDummy;
  int n = getVarint(pReader->pData, &iDummy);
  assert( !dlrAtEnd(pReader) );
  return pReader->pData+n;
}
static int dlrPosDataLen(DLReader *pReader){
  sqlite_int64 iDummy;
  int n = getVarint(pReader->pData, &iDummy);
  assert( !dlrAtEnd(pReader) );
  return pReader->nElement-n;
}
static void dlrStep(DLReader *pReader){
  assert( !dlrAtEnd(pReader) );

  /* Skip past current doclist element. */
  assert( pReader->nElement<=pReader->nData );
  pReader->pData += pReader->nElement;
  pReader->nData -= pReader->nElement;

  /* If there is more data, read the next doclist element. */
  if( pReader->nData!=0 ){
    sqlite_int64 iDocidDelta;
    int iDummy, n = getVarint(pReader->pData, &iDocidDelta);
    pReader->iDocid += iDocidDelta;
    if( pReader->iType>=DL_POSITIONS ){
      assert( n<pReader->nData );
      while( 1 ){
        n += getVarint32(pReader->pData+n, &iDummy);
        assert( n<=pReader->nData );
        if( iDummy==POS_END ) break;
        if( iDummy==POS_COLUMN ){
          n += getVarint32(pReader->pData+n, &iDummy);
          assert( n<pReader->nData );
        }else if( pReader->iType==DL_POSITIONS_OFFSETS ){
          n += getVarint32(pReader->pData+n, &iDummy);
          n += getVarint32(pReader->pData+n, &iDummy);
          assert( n<pReader->nData );
        }
      }
    }
    pReader->nElement = n;
    assert( pReader->nElement<=pReader->nData );
  }
}
static void dlrInit(DLReader *pReader, DocListType iType,
                    const char *pData, int nData){
  assert( pData!=NULL && nData!=0 );
  pReader->iType = iType;
  pReader->pData = pData;
  pReader->nData = nData;
  pReader->nElement = 0;
  pReader->iDocid = 0;

  /* Load the first element's data.  There must be a first element. */
  dlrStep(pReader);
}
static void dlrDestroy(DLReader *pReader){
  SCRAMBLE(pReader);
}

#ifndef NDEBUG
/* Verify that the doclist can be validly decoded.  Also returns the
** last docid found because it's convenient in other assertions for
** DLWriter.
*/
static void docListValidate(DocListType iType, const char *pData, int nData,
                            sqlite_int64 *pLastDocid){
  sqlite_int64 iPrevDocid = 0;
  assert( nData>0 );
  assert( pData!=0 );
  assert( pData+nData>pData );
  while( nData!=0 ){
    sqlite_int64 iDocidDelta;
    int n = getVarint(pData, &iDocidDelta);
    iPrevDocid += iDocidDelta;
    if( iType>DL_DOCIDS ){
      int iDummy;
      while( 1 ){
        n += getVarint32(pData+n, &iDummy);
        if( iDummy==POS_END ) break;
        if( iDummy==POS_COLUMN ){
          n += getVarint32(pData+n, &iDummy);
        }else if( iType>DL_POSITIONS ){
          n += getVarint32(pData+n, &iDummy);
          n += getVarint32(pData+n, &iDummy);
        }
        assert( n<=nData );
      }
    }
    assert( n<=nData );
    pData += n;
    nData -= n;
  }
  if( pLastDocid ) *pLastDocid = iPrevDocid;
}
#define ASSERT_VALID_DOCLIST(i, p, n, o) docListValidate(i, p, n, o)
#else
#define ASSERT_VALID_DOCLIST(i, p, n, o) assert( 1 )
#endif

/*******************************************************************/
/* DLWriter is used to write doclist data to a DataBuffer.  DLWriter
** always appends to the buffer and does not own it.
**
** dlwInit - initialize to write a given type doclistto a buffer.
** dlwDestroy - clear the writer's memory.  Does not free buffer.
** dlwAppend - append raw doclist data to buffer.
** dlwCopy - copy next doclist from reader to writer.
** dlwAdd - construct doclist element and append to buffer.
**    Only apply dlwAdd() to DL_DOCIDS doclists (else use PLWriter).
*/
typedef struct DLWriter {
  DocListType iType;
  DataBuffer *b;
  sqlite_int64 iPrevDocid;
#ifndef NDEBUG
  int has_iPrevDocid;
#endif
} DLWriter;

static void dlwInit(DLWriter *pWriter, DocListType iType, DataBuffer *b){
  pWriter->b = b;
  pWriter->iType = iType;
  pWriter->iPrevDocid = 0;
#ifndef NDEBUG
  pWriter->has_iPrevDocid = 0;
#endif
}
static void dlwDestroy(DLWriter *pWriter){
  SCRAMBLE(pWriter);
}
/* iFirstDocid is the first docid in the doclist in pData.  It is
** needed because pData may point within a larger doclist, in which
** case the first item would be delta-encoded.
**
** iLastDocid is the final docid in the doclist in pData.  It is
** needed to create the new iPrevDocid for future delta-encoding.  The
** code could decode the passed doclist to recreate iLastDocid, but
** the only current user (docListMerge) already has decoded this
** information.
*/
/* TODO(shess) This has become just a helper for docListMerge.
** Consider a refactor to make this cleaner.
*/
static void dlwAppend(DLWriter *pWriter,
                      const char *pData, int nData,
                      sqlite_int64 iFirstDocid, sqlite_int64 iLastDocid){
  sqlite_int64 iDocid = 0;
  char c[VARINT_MAX];
  int nFirstOld, nFirstNew;     /* Old and new varint len of first docid. */
#ifndef NDEBUG
  sqlite_int64 iLastDocidDelta;
#endif

  /* Recode the initial docid as delta from iPrevDocid. */
  nFirstOld = getVarint(pData, &iDocid);
  assert( nFirstOld<nData || (nFirstOld==nData && pWriter->iType==DL_DOCIDS) );
  nFirstNew = putVarint(c, iFirstDocid-pWriter->iPrevDocid);

  /* Verify that the incoming doclist is valid AND that it ends with
  ** the expected docid.  This is essential because we'll trust this
  ** docid in future delta-encoding.
  */
  ASSERT_VALID_DOCLIST(pWriter->iType, pData, nData, &iLastDocidDelta);
  assert( iLastDocid==iFirstDocid-iDocid+iLastDocidDelta );

  /* Append recoded initial docid and everything else.  Rest of docids
  ** should have been delta-encoded from previous initial docid.
  */
  if( nFirstOld<nData ){
    dataBufferAppend2(pWriter->b, c, nFirstNew,
                      pData+nFirstOld, nData-nFirstOld);
  }else{
    dataBufferAppend(pWriter->b, c, nFirstNew);
  }
  pWriter->iPrevDocid = iLastDocid;
}
static void dlwCopy(DLWriter *pWriter, DLReader *pReader){
  dlwAppend(pWriter, dlrDocData(pReader), dlrDocDataBytes(pReader),
            dlrDocid(pReader), dlrDocid(pReader));
}
static void dlwAdd(DLWriter *pWriter, sqlite_int64 iDocid){
  char c[VARINT_MAX];
  int n = putVarint(c, iDocid-pWriter->iPrevDocid);

  /* Docids must ascend. */
  assert( !pWriter->has_iPrevDocid || iDocid>pWriter->iPrevDocid );
  assert( pWriter->iType==DL_DOCIDS );

  dataBufferAppend(pWriter->b, c, n);
  pWriter->iPrevDocid = iDocid;
#ifndef NDEBUG
  pWriter->has_iPrevDocid = 1;
#endif
}

/*******************************************************************/
/* PLReader is used to read data from a document's position list.  As
** the caller steps through the list, data is cached so that varints
** only need to be decoded once.
**
** plrInit, plrDestroy - create/destroy a reader.
** plrColumn, plrPosition, plrStartOffset, plrEndOffset - accessors
** plrAtEnd - at end of stream, only call plrDestroy once true.
** plrStep - step to the next element.
*/
typedef struct PLReader {
  /* These refer to the next position's data.  nData will reach 0 when
  ** reading the last position, so plrStep() signals EOF by setting
  ** pData to NULL.
  */
  const char *pData;
  int nData;

  DocListType iType;
  int iColumn;         /* the last column read */
  int iPosition;       /* the last position read */
  int iStartOffset;    /* the last start offset read */
  int iEndOffset;      /* the last end offset read */
} PLReader;

static int plrAtEnd(PLReader *pReader){
  return pReader->pData==NULL;
}
static int plrColumn(PLReader *pReader){
  assert( !plrAtEnd(pReader) );
  return pReader->iColumn;
}
static int plrPosition(PLReader *pReader){
  assert( !plrAtEnd(pReader) );
  return pReader->iPosition;
}
static int plrStartOffset(PLReader *pReader){
  assert( !plrAtEnd(pReader) );
  return pReader->iStartOffset;
}
static int plrEndOffset(PLReader *pReader){
  assert( !plrAtEnd(pReader) );
  return pReader->iEndOffset;
}
static void plrStep(PLReader *pReader){
  int i, n;

  assert( !plrAtEnd(pReader) );

  if( pReader->nData==0 ){
    pReader->pData = NULL;
    return;
  }

  n = getVarint32(pReader->pData, &i);
  if( i==POS_COLUMN ){
    n += getVarint32(pReader->pData+n, &pReader->iColumn);
    pReader->iPosition = 0;
    pReader->iStartOffset = 0;
    n += getVarint32(pReader->pData+n, &i);
  }
  /* Should never see adjacent column changes. */
  assert( i!=POS_COLUMN );

  if( i==POS_END ){
    pReader->nData = 0;
    pReader->pData = NULL;
    return;
  }

  pReader->iPosition += i-POS_BASE;
  if( pReader->iType==DL_POSITIONS_OFFSETS ){
    n += getVarint32(pReader->pData+n, &i);
    pReader->iStartOffset += i;
    n += getVarint32(pReader->pData+n, &i);
    pReader->iEndOffset = pReader->iStartOffset+i;
  }
  assert( n<=pReader->nData );
  pReader->pData += n;
  pReader->nData -= n;
}

static void plrInit(PLReader *pReader, DLReader *pDLReader){
  pReader->pData = dlrPosData(pDLReader);
  pReader->nData = dlrPosDataLen(pDLReader);
  pReader->iType = pDLReader->iType;
  pReader->iColumn = 0;
  pReader->iPosition = 0;
  pReader->iStartOffset = 0;
  pReader->iEndOffset = 0;
  plrStep(pReader);
}
static void plrDestroy(PLReader *pReader){
  SCRAMBLE(pReader);
}

/*******************************************************************/
/* PLWriter is used in constructing a document's position list.  As a
** convenience, if iType is DL_DOCIDS, PLWriter becomes a no-op.
** PLWriter writes to the associated DLWriter's buffer.
**
** plwInit - init for writing a document's poslist.
** plwDestroy - clear a writer.
** plwAdd - append position and offset information.
** plwCopy - copy next position's data from reader to writer.
** plwTerminate - add any necessary doclist terminator.
**
** Calling plwAdd() after plwTerminate() may result in a corrupt
** doclist.
*/
/* TODO(shess) Until we've written the second item, we can cache the
** first item's information.  Then we'd have three states:
**
** - initialized with docid, no positions.
** - docid and one position.
** - docid and multiple positions.
**
** Only the last state needs to actually write to dlw->b, which would
** be an improvement in the DLCollector case.
*/
typedef struct PLWriter {
  DLWriter *dlw;

  int iColumn;    /* the last column written */
  int iPos;       /* the last position written */
  int iOffset;    /* the last start offset written */
} PLWriter;

/* TODO(shess) In the case where the parent is reading these values
** from a PLReader, we could optimize to a copy if that PLReader has
** the same type as pWriter.
*/
static void plwAdd(PLWriter *pWriter, int iColumn, int iPos,
                   int iStartOffset, int iEndOffset){
  /* Worst-case space for POS_COLUMN, iColumn, iPosDelta,
  ** iStartOffsetDelta, and iEndOffsetDelta.
  */
  char c[5*VARINT_MAX];
  int n = 0;

  /* Ban plwAdd() after plwTerminate(). */
  assert( pWriter->iPos!=-1 );

  if( pWriter->dlw->iType==DL_DOCIDS ) return;

  if( iColumn!=pWriter->iColumn ){
    n += putVarint(c+n, POS_COLUMN);
    n += putVarint(c+n, iColumn);
    pWriter->iColumn = iColumn;
    pWriter->iPos = 0;
    pWriter->iOffset = 0;
  }
  assert( iPos>=pWriter->iPos );
  n += putVarint(c+n, POS_BASE+(iPos-pWriter->iPos));
  pWriter->iPos = iPos;
  if( pWriter->dlw->iType==DL_POSITIONS_OFFSETS ){
    assert( iStartOffset>=pWriter->iOffset );
    n += putVarint(c+n, iStartOffset-pWriter->iOffset);
    pWriter->iOffset = iStartOffset;
    assert( iEndOffset>=iStartOffset );
    n += putVarint(c+n, iEndOffset-iStartOffset);
  }
  dataBufferAppend(pWriter->dlw->b, c, n);
}
static void plwCopy(PLWriter *pWriter, PLReader *pReader){
  plwAdd(pWriter, plrColumn(pReader), plrPosition(pReader),
         plrStartOffset(pReader), plrEndOffset(pReader));
}
static void plwInit(PLWriter *pWriter, DLWriter *dlw, sqlite_int64 iDocid){
  char c[VARINT_MAX];
  int n;

  pWriter->dlw = dlw;

  /* Docids must ascend. */
  assert( !pWriter->dlw->has_iPrevDocid || iDocid>pWriter->dlw->iPrevDocid );
  n = putVarint(c, iDocid-pWriter->dlw->iPrevDocid);
  dataBufferAppend(pWriter->dlw->b, c, n);
  pWriter->dlw->iPrevDocid = iDocid;
#ifndef NDEBUG
  pWriter->dlw->has_iPrevDocid = 1;
#endif

  pWriter->iColumn = 0;
  pWriter->iPos = 0;
  pWriter->iOffset = 0;
}
/* TODO(shess) Should plwDestroy() also terminate the doclist?  But
** then plwDestroy() would no longer be just a destructor, it would
** also be doing work, which isn't consistent with the overall idiom.
** Another option would be for plwAdd() to always append any necessary
** terminator, so that the output is always correct.  But that would
** add incremental work to the common case with the only benefit being
** API elegance.  Punt for now.
*/
static void plwTerminate(PLWriter *pWriter){
  if( pWriter->dlw->iType>DL_DOCIDS ){
    char c[VARINT_MAX];
    int n = putVarint(c, POS_END);
    dataBufferAppend(pWriter->dlw->b, c, n);
  }
#ifndef NDEBUG
  /* Mark as terminated for assert in plwAdd(). */
  pWriter->iPos = -1;
#endif
}
static void plwDestroy(PLWriter *pWriter){
  SCRAMBLE(pWriter);
}

/*******************************************************************/
/* DLCollector wraps PLWriter and DLWriter to provide a
** dynamically-allocated doclist area to use during tokenization.
**
** dlcNew - malloc up and initialize a collector.
** dlcDelete - destroy a collector and all contained items.
** dlcAddPos - append position and offset information.
** dlcAddDoclist - add the collected doclist to the given buffer.
** dlcNext - terminate the current document and open another.
*/
typedef struct DLCollector {
  DataBuffer b;
  DLWriter dlw;
  PLWriter plw;
} DLCollector;

/* TODO(shess) This could also be done by calling plwTerminate() and
** dataBufferAppend().  I tried that, expecting nominal performance
** differences, but it seemed to pretty reliably be worth 1% to code
** it this way.  I suspect it's the incremental malloc overhead (some
** percentage of the plwTerminate() calls will cause a realloc), so
** this might be worth revisiting if the DataBuffer implementation
** changes.
*/
static void dlcAddDoclist(DLCollector *pCollector, DataBuffer *b){
  if( pCollector->dlw.iType>DL_DOCIDS ){
    char c[VARINT_MAX];
    int n = putVarint(c, POS_END);
    dataBufferAppend2(b, pCollector->b.pData, pCollector->b.nData, c, n);
  }else{
    dataBufferAppend(b, pCollector->b.pData, pCollector->b.nData);
  }
}
static void dlcNext(DLCollector *pCollector, sqlite_int64 iDocid){
  plwTerminate(&pCollector->plw);
  plwDestroy(&pCollector->plw);
  plwInit(&pCollector->plw, &pCollector->dlw, iDocid);
}
static void dlcAddPos(DLCollector *pCollector, int iColumn, int iPos,
                      int iStartOffset, int iEndOffset){
  plwAdd(&pCollector->plw, iColumn, iPos, iStartOffset, iEndOffset);
}

static DLCollector *dlcNew(sqlite_int64 iDocid, DocListType iType){
  DLCollector *pCollector = malloc(sizeof(DLCollector));
  dataBufferInit(&pCollector->b, 0);
  dlwInit(&pCollector->dlw, iType, &pCollector->b);
  plwInit(&pCollector->plw, &pCollector->dlw, iDocid);
  return pCollector;
}
static void dlcDelete(DLCollector *pCollector){
  plwDestroy(&pCollector->plw);
  dlwDestroy(&pCollector->dlw);
  dataBufferDestroy(&pCollector->b);
  SCRAMBLE(pCollector);
  free(pCollector);
}


/* Copy the doclist data of iType in pData/nData into *out, trimming
** unnecessary data as we go.  Only columns matching iColumn are
** copied, all columns copied if iColumn is -1.  Elements with no
** matching columns are dropped.  The output is an iOutType doclist.
*/
/* NOTE(shess) This code is only valid after all doclists are merged.
** If this is run before merges, then doclist items which represent
** deletion will be trimmed, and will thus not effect a deletion
** during the merge.
*/
static void docListTrim(DocListType iType, const char *pData, int nData,
                        int iColumn, DocListType iOutType, DataBuffer *out){
  DLReader dlReader;
  DLWriter dlWriter;

  assert( iOutType<=iType );

  dlrInit(&dlReader, iType, pData, nData);
  dlwInit(&dlWriter, iOutType, out);

  while( !dlrAtEnd(&dlReader) ){
    PLReader plReader;
    PLWriter plWriter;
    int match = 0;

    plrInit(&plReader, &dlReader);

    while( !plrAtEnd(&plReader) ){
      if( iColumn==-1 || plrColumn(&plReader)==iColumn ){
        if( !match ){
          plwInit(&plWriter, &dlWriter, dlrDocid(&dlReader));
          match = 1;
        }
        plwAdd(&plWriter, plrColumn(&plReader), plrPosition(&plReader),
               plrStartOffset(&plReader), plrEndOffset(&plReader));
      }
      plrStep(&plReader);
    }
    if( match ){
      plwTerminate(&plWriter);
      plwDestroy(&plWriter);
    }

    plrDestroy(&plReader);
    dlrStep(&dlReader);
  }
  dlwDestroy(&dlWriter);
  dlrDestroy(&dlReader);
}

/* Used by docListMerge() to keep doclists in the ascending order by
** docid, then ascending order by age (so the newest comes first).
*/
typedef struct OrderedDLReader {
  DLReader *pReader;

  /* TODO(shess) If we assume that docListMerge pReaders is ordered by
  ** age (which we do), then we could use pReader comparisons to break
  ** ties.
  */
  int idx;
} OrderedDLReader;

/* Order eof to end, then by docid asc, idx desc. */
static int orderedDLReaderCmp(OrderedDLReader *r1, OrderedDLReader *r2){
  if( dlrAtEnd(r1->pReader) ){
    if( dlrAtEnd(r2->pReader) ) return 0;  /* Both atEnd(). */
    return 1;                              /* Only r1 atEnd(). */
  }
  if( dlrAtEnd(r2->pReader) ) return -1;   /* Only r2 atEnd(). */

  if( dlrDocid(r1->pReader)<dlrDocid(r2->pReader) ) return -1;
  if( dlrDocid(r1->pReader)>dlrDocid(r2->pReader) ) return 1;

  /* Descending on idx. */
  return r2->idx-r1->idx;
}

/* Bubble p[0] to appropriate place in p[1..n-1].  Assumes that
** p[1..n-1] is already sorted.
*/
/* TODO(shess) Is this frequent enough to warrant a binary search?
** Before implementing that, instrument the code to check.  In most
** current usage, I expect that p[0] will be less than p[1] a very
** high proportion of the time.
*/
static void orderedDLReaderReorder(OrderedDLReader *p, int n){
  while( n>1 && orderedDLReaderCmp(p, p+1)>0 ){
    OrderedDLReader tmp = p[0];
    p[0] = p[1];
    p[1] = tmp;
    n--;
    p++;
  }
}

/* Given an array of doclist readers, merge their doclist elements
** into out in sorted order (by docid), dropping elements from older
** readers when there is a duplicate docid.  pReaders is assumed to be
** ordered by age, oldest first.
*/
/* TODO(shess) nReaders must be <= MERGE_COUNT.  This should probably
** be fixed.
*/
static void docListMerge(DataBuffer *out,
                         DLReader *pReaders, int nReaders){
  OrderedDLReader readers[MERGE_COUNT];
  DLWriter writer;
  int i, n;
  const char *pStart = 0;
  int nStart = 0;
  sqlite_int64 iFirstDocid = 0, iLastDocid = 0;

  assert( nReaders>0 );
  if( nReaders==1 ){
    dataBufferAppend(out, dlrDocData(pReaders), dlrAllDataBytes(pReaders));
    return;
  }

  assert( nReaders<=MERGE_COUNT );
  n = 0;
  for(i=0; i<nReaders; i++){
    assert( pReaders[i].iType==pReaders[0].iType );
    readers[i].pReader = pReaders+i;
    readers[i].idx = i;
    n += dlrAllDataBytes(&pReaders[i]);
  }
  /* Conservatively size output to sum of inputs.  Output should end
  ** up strictly smaller than input.
  */
  dataBufferExpand(out, n);

  /* Get the readers into sorted order. */
  while( i-->0 ){
    orderedDLReaderReorder(readers+i, nReaders-i);
  }

  dlwInit(&writer, pReaders[0].iType, out);
  while( !dlrAtEnd(readers[0].pReader) ){
    sqlite_int64 iDocid = dlrDocid(readers[0].pReader);

    /* If this is a continuation of the current buffer to copy, extend
    ** that buffer.  memcpy() seems to be more efficient if it has a
    ** lots of data to copy.
    */
    if( dlrDocData(readers[0].pReader)==pStart+nStart ){
      nStart += dlrDocDataBytes(readers[0].pReader);
    }else{
      if( pStart!=0 ){
        dlwAppend(&writer, pStart, nStart, iFirstDocid, iLastDocid);
      }
      pStart = dlrDocData(readers[0].pReader);
      nStart = dlrDocDataBytes(readers[0].pReader);
      iFirstDocid = iDocid;
    }
    iLastDocid = iDocid;
    dlrStep(readers[0].pReader);

    /* Drop all of the older elements with the same docid. */
    for(i=1; i<nReaders &&
             !dlrAtEnd(readers[i].pReader) &&
             dlrDocid(readers[i].pReader)==iDocid; i++){
      dlrStep(readers[i].pReader);
    }

    /* Get the readers back into order. */
    while( i-->0 ){
      orderedDLReaderReorder(readers+i, nReaders-i);
    }
  }

  /* Copy over any remaining elements. */
  if( nStart>0 ) dlwAppend(&writer, pStart, nStart, iFirstDocid, iLastDocid);
  dlwDestroy(&writer);
}

/* Helper function for posListUnion().  Compares the current position
** between left and right, returning as standard C idiom of <0 if
** left<right, >0 if left>right, and 0 if left==right.  "End" always
** compares greater.
*/
static int posListCmp(PLReader *pLeft, PLReader *pRight){
  assert( pLeft->iType==pRight->iType );
  if( pLeft->iType==DL_DOCIDS ) return 0;

  if( plrAtEnd(pLeft) ) return plrAtEnd(pRight) ? 0 : 1;
  if( plrAtEnd(pRight) ) return -1;

  if( plrColumn(pLeft)<plrColumn(pRight) ) return -1;
  if( plrColumn(pLeft)>plrColumn(pRight) ) return 1;

  if( plrPosition(pLeft)<plrPosition(pRight) ) return -1;
  if( plrPosition(pLeft)>plrPosition(pRight) ) return 1;
  if( pLeft->iType==DL_POSITIONS ) return 0;

  if( plrStartOffset(pLeft)<plrStartOffset(pRight) ) return -1;
  if( plrStartOffset(pLeft)>plrStartOffset(pRight) ) return 1;

  if( plrEndOffset(pLeft)<plrEndOffset(pRight) ) return -1;
  if( plrEndOffset(pLeft)>plrEndOffset(pRight) ) return 1;

  return 0;
}

/* Write the union of position lists in pLeft and pRight to pOut.
** "Union" in this case meaning "All unique position tuples".  Should
** work with any doclist type, though both inputs and the output
** should be the same type.
*/
static void posListUnion(DLReader *pLeft, DLReader *pRight, DLWriter *pOut){
  PLReader left, right;
  PLWriter writer;

  assert( dlrDocid(pLeft)==dlrDocid(pRight) );
  assert( pLeft->iType==pRight->iType );
  assert( pLeft->iType==pOut->iType );

  plrInit(&left, pLeft);
  plrInit(&right, pRight);
  plwInit(&writer, pOut, dlrDocid(pLeft));

  while( !plrAtEnd(&left) || !plrAtEnd(&right) ){
    int c = posListCmp(&left, &right);
    if( c<0 ){
      plwCopy(&writer, &left);
      plrStep(&left);
    }else if( c>0 ){
      plwCopy(&writer, &right);
      plrStep(&right);
    }else{
      plwCopy(&writer, &left);
      plrStep(&left);
      plrStep(&right);
    }
  }

  plwTerminate(&writer);
  plwDestroy(&writer);
  plrDestroy(&left);
  plrDestroy(&right);
}

/* Write the union of doclists in pLeft and pRight to pOut.  For
** docids in common between the inputs, the union of the position
** lists is written.  Inputs and outputs are always type DL_DEFAULT.
*/
static void docListUnion(
  const char *pLeft, int nLeft,
  const char *pRight, int nRight,
  DataBuffer *pOut      /* Write the combined doclist here */
){
  DLReader left, right;
  DLWriter writer;

  if( nLeft==0 ){
    dataBufferAppend(pOut, pRight, nRight);
    return;
  }
  if( nRight==0 ){
    dataBufferAppend(pOut, pLeft, nLeft);
    return;
  }

  dlrInit(&left, DL_DEFAULT, pLeft, nLeft);
  dlrInit(&right, DL_DEFAULT, pRight, nRight);
  dlwInit(&writer, DL_DEFAULT, pOut);

  while( !dlrAtEnd(&left) || !dlrAtEnd(&right) ){
    if( dlrAtEnd(&right) ){
      dlwCopy(&writer, &left);
      dlrStep(&left);
    }else if( dlrAtEnd(&left) ){
      dlwCopy(&writer, &right);
      dlrStep(&right);
    }else if( dlrDocid(&left)<dlrDocid(&right) ){
      dlwCopy(&writer, &left);
      dlrStep(&left);
    }else if( dlrDocid(&left)>dlrDocid(&right) ){
      dlwCopy(&writer, &right);
      dlrStep(&right);
    }else{
      posListUnion(&left, &right, &writer);
      dlrStep(&left);
      dlrStep(&right);
    }
  }

  dlrDestroy(&left);
  dlrDestroy(&right);
  dlwDestroy(&writer);
}

/* pLeft and pRight are DLReaders positioned to the same docid.
**
** If there are no instances in pLeft or pRight where the position
** of pLeft is one less than the position of pRight, then this
** routine adds nothing to pOut.
**
** If there are one or more instances where positions from pLeft
** are exactly one less than positions from pRight, then add a new
** document record to pOut.  If pOut wants to hold positions, then
** include the positions from pRight that are one more than a
** position in pLeft.  In other words:  pRight.iPos==pLeft.iPos+1.
*/
static void posListPhraseMerge(DLReader *pLeft, DLReader *pRight,
                               DLWriter *pOut){
  PLReader left, right;
  PLWriter writer;
  int match = 0;

  assert( dlrDocid(pLeft)==dlrDocid(pRight) );
  assert( pOut->iType!=DL_POSITIONS_OFFSETS );

  plrInit(&left, pLeft);
  plrInit(&right, pRight);

  while( !plrAtEnd(&left) && !plrAtEnd(&right) ){
    if( plrColumn(&left)<plrColumn(&right) ){
      plrStep(&left);
    }else if( plrColumn(&left)>plrColumn(&right) ){
      plrStep(&right);
    }else if( plrPosition(&left)+1<plrPosition(&right) ){
      plrStep(&left);
    }else if( plrPosition(&left)+1>plrPosition(&right) ){
      plrStep(&right);
    }else{
      if( !match ){
        plwInit(&writer, pOut, dlrDocid(pLeft));
        match = 1;
      }
      plwAdd(&writer, plrColumn(&right), plrPosition(&right), 0, 0);
      plrStep(&left);
      plrStep(&right);
    }
  }

  if( match ){
    plwTerminate(&writer);
    plwDestroy(&writer);
  }

  plrDestroy(&left);
  plrDestroy(&right);
}

/* We have two doclists with positions:  pLeft and pRight.
** Write the phrase intersection of these two doclists into pOut.
**
** A phrase intersection means that two documents only match
** if pLeft.iPos+1==pRight.iPos.
**
** iType controls the type of data written to pOut.  If iType is
** DL_POSITIONS, the positions are those from pRight.
*/
static void docListPhraseMerge(
  const char *pLeft, int nLeft,
  const char *pRight, int nRight,
  DocListType iType,
  DataBuffer *pOut      /* Write the combined doclist here */
){
  DLReader left, right;
  DLWriter writer;

  if( nLeft==0 || nRight==0 ) return;

  assert( iType!=DL_POSITIONS_OFFSETS );

  dlrInit(&left, DL_POSITIONS, pLeft, nLeft);
  dlrInit(&right, DL_POSITIONS, pRight, nRight);
  dlwInit(&writer, iType, pOut);

  while( !dlrAtEnd(&left) && !dlrAtEnd(&right) ){
    if( dlrDocid(&left)<dlrDocid(&right) ){
      dlrStep(&left);
    }else if( dlrDocid(&right)<dlrDocid(&left) ){
      dlrStep(&right);
    }else{
      posListPhraseMerge(&left, &right, &writer);
      dlrStep(&left);
      dlrStep(&right);
    }
  }

  dlrDestroy(&left);
  dlrDestroy(&right);
  dlwDestroy(&writer);
}

/* We have two DL_DOCIDS doclists:  pLeft and pRight.
** Write the intersection of these two doclists into pOut as a
** DL_DOCIDS doclist.
*/
static void docListAndMerge(
  const char *pLeft, int nLeft,
  const char *pRight, int nRight,
  DataBuffer *pOut      /* Write the combined doclist here */
){
  DLReader left, right;
  DLWriter writer;

  if( nLeft==0 || nRight==0 ) return;

  dlrInit(&left, DL_DOCIDS, pLeft, nLeft);
  dlrInit(&right, DL_DOCIDS, pRight, nRight);
  dlwInit(&writer, DL_DOCIDS, pOut);

  while( !dlrAtEnd(&left) && !dlrAtEnd(&right) ){
    if( dlrDocid(&left)<dlrDocid(&right) ){
      dlrStep(&left);
    }else if( dlrDocid(&right)<dlrDocid(&left) ){
      dlrStep(&right);
    }else{
      dlwAdd(&writer, dlrDocid(&left));
      dlrStep(&left);
      dlrStep(&right);
    }
  }

  dlrDestroy(&left);
  dlrDestroy(&right);
  dlwDestroy(&writer);
}

/* We have two DL_DOCIDS doclists:  pLeft and pRight.
** Write the union of these two doclists into pOut as a
** DL_DOCIDS doclist.
*/
static void docListOrMerge(
  const char *pLeft, int nLeft,
  const char *pRight, int nRight,
  DataBuffer *pOut      /* Write the combined doclist here */
){
  DLReader left, right;
  DLWriter writer;

  if( nLeft==0 ){
    dataBufferAppend(pOut, pRight, nRight);
    return;
  }
  if( nRight==0 ){
    dataBufferAppend(pOut, pLeft, nLeft);
    return;
  }

  dlrInit(&left, DL_DOCIDS, pLeft, nLeft);
  dlrInit(&right, DL_DOCIDS, pRight, nRight);
  dlwInit(&writer, DL_DOCIDS, pOut);

  while( !dlrAtEnd(&left) || !dlrAtEnd(&right) ){
    if( dlrAtEnd(&right) ){
      dlwAdd(&writer, dlrDocid(&left));
      dlrStep(&left);
    }else if( dlrAtEnd(&left) ){
      dlwAdd(&writer, dlrDocid(&right));
      dlrStep(&right);
    }else if( dlrDocid(&left)<dlrDocid(&right) ){
      dlwAdd(&writer, dlrDocid(&left));
      dlrStep(&left);
    }else if( dlrDocid(&right)<dlrDocid(&left) ){
      dlwAdd(&writer, dlrDocid(&right));
      dlrStep(&right);
    }else{
      dlwAdd(&writer, dlrDocid(&left));
      dlrStep(&left);
      dlrStep(&right);
    }
  }

  dlrDestroy(&left);
  dlrDestroy(&right);
  dlwDestroy(&writer);
}

/* We have two DL_DOCIDS doclists:  pLeft and pRight.
** Write into pOut as DL_DOCIDS doclist containing all documents that
** occur in pLeft but not in pRight.
*/
static void docListExceptMerge(
  const char *pLeft, int nLeft,
  const char *pRight, int nRight,
  DataBuffer *pOut      /* Write the combined doclist here */
){
  DLReader left, right;
  DLWriter writer;

  if( nLeft==0 ) return;
  if( nRight==0 ){
    dataBufferAppend(pOut, pLeft, nLeft);
    return;
  }

  dlrInit(&left, DL_DOCIDS, pLeft, nLeft);
  dlrInit(&right, DL_DOCIDS, pRight, nRight);
  dlwInit(&writer, DL_DOCIDS, pOut);

  while( !dlrAtEnd(&left) ){
    while( !dlrAtEnd(&right) && dlrDocid(&right)<dlrDocid(&left) ){
      dlrStep(&right);
    }
    if( dlrAtEnd(&right) || dlrDocid(&left)<dlrDocid(&right) ){
      dlwAdd(&writer, dlrDocid(&left));
    }
    dlrStep(&left);
  }

  dlrDestroy(&left);
  dlrDestroy(&right);
  dlwDestroy(&writer);
}

static char *string_dup_n(const char *s, int n){
  char *str = malloc(n + 1);
  memcpy(str, s, n);
  str[n] = '\0';
  return str;
}

/* Duplicate a string; the caller must free() the returned string.
 * (We don't use strdup() since it's not part of the standard C library and
 * may not be available everywhere.) */
static char *string_dup(const char *s){
  return string_dup_n(s, strlen(s));
}

/* Format a string, replacing each occurrence of the % character with
 * zDb.zName.  This may be more convenient than sqlite_mprintf()
 * when one string is used repeatedly in a format string.
 * The caller must free() the returned string. */
static char *string_format(const char *zFormat,
                           const char *zDb, const char *zName){
  const char *p;
  size_t len = 0;
  size_t nDb = strlen(zDb);
  size_t nName = strlen(zName);
  size_t nFullTableName = nDb+1+nName;
  char *result;
  char *r;

  /* first compute length needed */
  for(p = zFormat ; *p ; ++p){
    len += (*p=='%' ? nFullTableName : 1);
  }
  len += 1;  /* for null terminator */

  r = result = malloc(len);
  for(p = zFormat; *p; ++p){
    if( *p=='%' ){
      memcpy(r, zDb, nDb);
      r += nDb;
      *r++ = '.';
      memcpy(r, zName, nName);
      r += nName;
    } else {
      *r++ = *p;
    }
  }
  *r++ = '\0';
  assert( r == result + len );
  return result;
}

static int sql_exec(sqlite3 *db, const char *zDb, const char *zName,
                    const char *zFormat){
  char *zCommand = string_format(zFormat, zDb, zName);
  int rc;
  TRACE(("FTS2 sql: %s\n", zCommand));
  rc = sqlite3_exec(db, zCommand, NULL, 0, NULL);
  free(zCommand);
  return rc;
}

static int sql_prepare(sqlite3 *db, const char *zDb, const char *zName,
                       sqlite3_stmt **ppStmt, const char *zFormat){
  char *zCommand = string_format(zFormat, zDb, zName);
  int rc;
  TRACE(("FTS2 prepare: %s\n", zCommand));
  rc = sqlite3_prepare_v2(db, zCommand, -1, ppStmt, NULL);
  free(zCommand);
  return rc;
}

/* end utility functions */

/* Forward reference */
typedef struct fulltext_vtab fulltext_vtab;

/* A single term in a query is represented by an instances of
** the following structure.
*/
typedef struct QueryTerm {
  short int nPhrase; /* How many following terms are part of the same phrase */
  short int iPhrase; /* This is the i-th term of a phrase. */
  short int iColumn; /* Column of the index that must match this term */
  signed char isOr;  /* this term is preceded by "OR" */
  signed char isNot; /* this term is preceded by "-" */
  signed char isPrefix; /* this term is followed by "*" */
  char *pTerm;       /* text of the term.  '\000' terminated.  malloced */
  int nTerm;         /* Number of bytes in pTerm[] */
} QueryTerm;


/* A query string is parsed into a Query structure.
 *
 * We could, in theory, allow query strings to be complicated
 * nested expressions with precedence determined by parentheses.
 * But none of the major search engines do this.  (Perhaps the
 * feeling is that an parenthesized expression is two complex of
 * an idea for the average user to grasp.)  Taking our lead from
 * the major search engines, we will allow queries to be a list
 * of terms (with an implied AND operator) or phrases in double-quotes,
 * with a single optional "-" before each non-phrase term to designate
 * negation and an optional OR connector.
 *
 * OR binds more tightly than the implied AND, which is what the
 * major search engines seem to do.  So, for example:
 * 
 *    [one two OR three]     ==>    one AND (two OR three)
 *    [one OR two three]     ==>    (one OR two) AND three
 *
 * A "-" before a term matches all entries that lack that term.
 * The "-" must occur immediately before the term with in intervening
 * space.  This is how the search engines do it.
 *
 * A NOT term cannot be the right-hand operand of an OR.  If this
 * occurs in the query string, the NOT is ignored:
 *
 *    [one OR -two]          ==>    one OR two
 *
 */
typedef struct Query {
  fulltext_vtab *pFts;  /* The full text index */
  int nTerms;           /* Number of terms in the query */
  QueryTerm *pTerms;    /* Array of terms.  Space obtained from malloc() */
  int nextIsOr;         /* Set the isOr flag on the next inserted term */
  int nextColumn;       /* Next word parsed must be in this column */
  int dfltColumn;       /* The default column */
} Query;


/*
** An instance of the following structure keeps track of generated
** matching-word offset information and snippets.
*/
typedef struct Snippet {
  int nMatch;     /* Total number of matches */
  int nAlloc;     /* Space allocated for aMatch[] */
  struct snippetMatch { /* One entry for each matching term */
    char snStatus;       /* Status flag for use while constructing snippets */
    short int iCol;      /* The column that contains the match */
    short int iTerm;     /* The index in Query.pTerms[] of the matching term */
    short int nByte;     /* Number of bytes in the term */
    int iStart;          /* The offset to the first character of the term */
  } *aMatch;      /* Points to space obtained from malloc */
  char *zOffset;  /* Text rendering of aMatch[] */
  int nOffset;    /* strlen(zOffset) */
  char *zSnippet; /* Snippet text */
  int nSnippet;   /* strlen(zSnippet) */
} Snippet;


typedef enum QueryType {
  QUERY_GENERIC,   /* table scan */
  QUERY_ROWID,     /* lookup by rowid */
  QUERY_FULLTEXT   /* QUERY_FULLTEXT + [i] is a full-text search for column i*/
} QueryType;

typedef enum fulltext_statement {
  CONTENT_INSERT_STMT,
  CONTENT_SELECT_STMT,
  CONTENT_UPDATE_STMT,
  CONTENT_DELETE_STMT,

  BLOCK_INSERT_STMT,
  BLOCK_SELECT_STMT,
  BLOCK_DELETE_STMT,

  SEGDIR_MAX_INDEX_STMT,
  SEGDIR_SET_STMT,
  SEGDIR_SELECT_STMT,
  SEGDIR_SPAN_STMT,
  SEGDIR_DELETE_STMT,
  SEGDIR_SELECT_ALL_STMT,

  MAX_STMT                     /* Always at end! */
} fulltext_statement;

/* These must exactly match the enum above. */
/* TODO(shess): Is there some risk that a statement will be used in two
** cursors at once, e.g.  if a query joins a virtual table to itself?
** If so perhaps we should move some of these to the cursor object.
*/
static const char *const fulltext_zStatement[MAX_STMT] = {
  /* CONTENT_INSERT */ NULL,  /* generated in contentInsertStatement() */
  /* CONTENT_SELECT */ "select * from %_content where rowid = ?",
  /* CONTENT_UPDATE */ NULL,  /* generated in contentUpdateStatement() */
  /* CONTENT_DELETE */ "delete from %_content where rowid = ?",

  /* BLOCK_INSERT */ "insert into %_segments values (?)",
  /* BLOCK_SELECT */ "select block from %_segments where rowid = ?",
  /* BLOCK_DELETE */ "delete from %_segments where rowid between ? and ?",

  /* SEGDIR_MAX_INDEX */ "select max(idx) from %_segdir where level = ?",
  /* SEGDIR_SET */ "insert into %_segdir values (?, ?, ?, ?, ?, ?)",
  /* SEGDIR_SELECT */
  "select start_block, leaves_end_block, root from %_segdir "
  " where level = ? order by idx",
  /* SEGDIR_SPAN */
  "select min(start_block), max(end_block) from %_segdir "
  " where level = ? and start_block <> 0",
  /* SEGDIR_DELETE */ "delete from %_segdir where level = ?",
  /* SEGDIR_SELECT_ALL */
  "select root, leaves_end_block from %_segdir order by level desc, idx",
};

/*
** A connection to a fulltext index is an instance of the following
** structure.  The xCreate and xConnect methods create an instance
** of this structure and xDestroy and xDisconnect free that instance.
** All other methods receive a pointer to the structure as one of their
** arguments.
*/
struct fulltext_vtab {
  sqlite3_vtab base;               /* Base class used by SQLite core */
  sqlite3 *db;                     /* The database connection */
  const char *zDb;                 /* logical database name */
  const char *zName;               /* virtual table name */
  int nColumn;                     /* number of columns in virtual table */
  char **azColumn;                 /* column names.  malloced */
  char **azContentColumn;          /* column names in content table; malloced */
  sqlite3_tokenizer *pTokenizer;   /* tokenizer for inserts and queries */

  /* Precompiled statements which we keep as long as the table is
  ** open.
  */
  sqlite3_stmt *pFulltextStatements[MAX_STMT];

  /* Precompiled statements used for segment merges.  We run a
  ** separate select across the leaf level of each tree being merged.
  */
  sqlite3_stmt *pLeafSelectStmts[MERGE_COUNT];
  /* The statement used to prepare pLeafSelectStmts. */
#define LEAF_SELECT \
  "select block from %_segments where rowid between ? and ? order by rowid"

  /* These buffer pending index updates during transactions.
  ** nPendingData estimates the memory size of the pending data.  It
  ** doesn't include the hash-bucket overhead, nor any malloc
  ** overhead.  When nPendingData exceeds kPendingThreshold, the
  ** buffer is flushed even before the transaction closes.
  ** pendingTerms stores the data, and is only valid when nPendingData
  ** is >=0 (nPendingData<0 means pendingTerms has not been
  ** initialized).  iPrevDocid is the last docid written, used to make
  ** certain we're inserting in sorted order.
  */
  int nPendingData;
#define kPendingThreshold (1*1024*1024)
  sqlite_int64 iPrevDocid;
  fts2Hash pendingTerms;
};

/*
** When the core wants to do a query, it create a cursor using a
** call to xOpen.  This structure is an instance of a cursor.  It
** is destroyed by xClose.
*/
typedef struct fulltext_cursor {
  sqlite3_vtab_cursor base;        /* Base class used by SQLite core */
  QueryType iCursorType;           /* Copy of sqlite3_index_info.idxNum */
  sqlite3_stmt *pStmt;             /* Prepared statement in use by the cursor */
  int eof;                         /* True if at End Of Results */
  Query q;                         /* Parsed query string */
  Snippet snippet;                 /* Cached snippet for the current row */
  int iColumn;                     /* Column being searched */
  DataBuffer result;               /* Doclist results from fulltextQuery */
  DLReader reader;                 /* Result reader if result not empty */
} fulltext_cursor;

static struct fulltext_vtab *cursor_vtab(fulltext_cursor *c){
  return (fulltext_vtab *) c->base.pVtab;
}

static const sqlite3_module fts2Module;   /* forward declaration */

/* Return a dynamically generated statement of the form
 *   insert into %_content (rowid, ...) values (?, ...)
 */
static const char *contentInsertStatement(fulltext_vtab *v){
  StringBuffer sb;
  int i;

  initStringBuffer(&sb);
  append(&sb, "insert into %_content (rowid, ");
  appendList(&sb, v->nColumn, v->azContentColumn);
  append(&sb, ") values (?");
  for(i=0; i<v->nColumn; ++i)
    append(&sb, ", ?");
  append(&sb, ")");
  return stringBufferData(&sb);
}

/* Return a dynamically generated statement of the form
 *   update %_content set [col_0] = ?, [col_1] = ?, ...
 *                    where rowid = ?
 */
static const char *contentUpdateStatement(fulltext_vtab *v){
  StringBuffer sb;
  int i;

  initStringBuffer(&sb);
  append(&sb, "update %_content set ");
  for(i=0; i<v->nColumn; ++i) {
    if( i>0 ){
      append(&sb, ", ");
    }
    append(&sb, v->azContentColumn[i]);
    append(&sb, " = ?");
  }
  append(&sb, " where rowid = ?");
  return stringBufferData(&sb);
}

/* Puts a freshly-prepared statement determined by iStmt in *ppStmt.
** If the indicated statement has never been prepared, it is prepared
** and cached, otherwise the cached version is reset.
*/
static int sql_get_statement(fulltext_vtab *v, fulltext_statement iStmt,
                             sqlite3_stmt **ppStmt){
  assert( iStmt<MAX_STMT );
  if( v->pFulltextStatements[iStmt]==NULL ){
    const char *zStmt;
    int rc;
    switch( iStmt ){
      case CONTENT_INSERT_STMT:
        zStmt = contentInsertStatement(v); break;
      case CONTENT_UPDATE_STMT:
        zStmt = contentUpdateStatement(v); break;
      default:
        zStmt = fulltext_zStatement[iStmt];
    }
    rc = sql_prepare(v->db, v->zDb, v->zName, &v->pFulltextStatements[iStmt],
                         zStmt);
    if( zStmt != fulltext_zStatement[iStmt]) free((void *) zStmt);
    if( rc!=SQLITE_OK ) return rc;
  } else {
    int rc = sqlite3_reset(v->pFulltextStatements[iStmt]);
    if( rc!=SQLITE_OK ) return rc;
  }

  *ppStmt = v->pFulltextStatements[iStmt];
  return SQLITE_OK;
}

/* Like sqlite3_step(), but convert SQLITE_DONE to SQLITE_OK and
** SQLITE_ROW to SQLITE_ERROR.  Useful for statements like UPDATE,
** where we expect no results.
*/
static int sql_single_step(sqlite3_stmt *s){
  int rc = sqlite3_step(s);
  return (rc==SQLITE_DONE) ? SQLITE_OK : rc;
}

/* Like sql_get_statement(), but for special replicated LEAF_SELECT
** statements.
*/
/* TODO(shess) Write version for generic statements and then share
** that between the cached-statement functions.
*/
static int sql_get_leaf_statement(fulltext_vtab *v, int idx,
                                  sqlite3_stmt **ppStmt){
  assert( idx>=0 && idx<MERGE_COUNT );
  if( v->pLeafSelectStmts[idx]==NULL ){
    int rc = sql_prepare(v->db, v->zDb, v->zName, &v->pLeafSelectStmts[idx],
                         LEAF_SELECT);
    if( rc!=SQLITE_OK ) return rc;
  }else{
    int rc = sqlite3_reset(v->pLeafSelectStmts[idx]);
    if( rc!=SQLITE_OK ) return rc;
  }

  *ppStmt = v->pLeafSelectStmts[idx];
  return SQLITE_OK;
}

/* insert into %_content (rowid, ...) values ([rowid], [pValues]) */
static int content_insert(fulltext_vtab *v, sqlite3_value *rowid,
                          sqlite3_value **pValues){
  sqlite3_stmt *s;
  int i;
  int rc = sql_get_statement(v, CONTENT_INSERT_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_value(s, 1, rowid);
  if( rc!=SQLITE_OK ) return rc;

  for(i=0; i<v->nColumn; ++i){
    rc = sqlite3_bind_value(s, 2+i, pValues[i]);
    if( rc!=SQLITE_OK ) return rc;
  }

  return sql_single_step(s);
}

/* update %_content set col0 = pValues[0], col1 = pValues[1], ...
 *                  where rowid = [iRowid] */
static int content_update(fulltext_vtab *v, sqlite3_value **pValues,
                          sqlite_int64 iRowid){
  sqlite3_stmt *s;
  int i;
  int rc = sql_get_statement(v, CONTENT_UPDATE_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  for(i=0; i<v->nColumn; ++i){
    rc = sqlite3_bind_value(s, 1+i, pValues[i]);
    if( rc!=SQLITE_OK ) return rc;
  }

  rc = sqlite3_bind_int64(s, 1+v->nColumn, iRowid);
  if( rc!=SQLITE_OK ) return rc;

  return sql_single_step(s);
}

static void freeStringArray(int nString, const char **pString){
  int i;

  for (i=0 ; i < nString ; ++i) {
    if( pString[i]!=NULL ) free((void *) pString[i]);
  }
  free((void *) pString);
}

/* select * from %_content where rowid = [iRow]
 * The caller must delete the returned array and all strings in it.
 * null fields will be NULL in the returned array.
 *
 * TODO: Perhaps we should return pointer/length strings here for consistency
 * with other code which uses pointer/length. */
static int content_select(fulltext_vtab *v, sqlite_int64 iRow,
                          const char ***pValues){
  sqlite3_stmt *s;
  const char **values;
  int i;
  int rc;

  *pValues = NULL;

  rc = sql_get_statement(v, CONTENT_SELECT_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 1, iRow);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_step(s);
  if( rc!=SQLITE_ROW ) return rc;

  values = (const char **) malloc(v->nColumn * sizeof(const char *));
  for(i=0; i<v->nColumn; ++i){
    if( sqlite3_column_type(s, i)==SQLITE_NULL ){
      values[i] = NULL;
    }else{
      values[i] = string_dup((char*)sqlite3_column_text(s, i));
    }
  }

  /* We expect only one row.  We must execute another sqlite3_step()
   * to complete the iteration; otherwise the table will remain locked. */
  rc = sqlite3_step(s);
  if( rc==SQLITE_DONE ){
    *pValues = values;
    return SQLITE_OK;
  }

  freeStringArray(v->nColumn, values);
  return rc;
}

/* delete from %_content where rowid = [iRow ] */
static int content_delete(fulltext_vtab *v, sqlite_int64 iRow){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, CONTENT_DELETE_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 1, iRow);
  if( rc!=SQLITE_OK ) return rc;

  return sql_single_step(s);
}

/* insert into %_segments values ([pData])
**   returns assigned rowid in *piBlockid
*/
static int block_insert(fulltext_vtab *v, const char *pData, int nData,
                        sqlite_int64 *piBlockid){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, BLOCK_INSERT_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_blob(s, 1, pData, nData, SQLITE_STATIC);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_step(s);
  if( rc==SQLITE_ROW ) return SQLITE_ERROR;
  if( rc!=SQLITE_DONE ) return rc;

  *piBlockid = sqlite3_last_insert_rowid(v->db);
  return SQLITE_OK;
}

/* delete from %_segments
**   where rowid between [iStartBlockid] and [iEndBlockid]
**
** Deletes the range of blocks, inclusive, used to delete the blocks
** which form a segment.
*/
static int block_delete(fulltext_vtab *v,
                        sqlite_int64 iStartBlockid, sqlite_int64 iEndBlockid){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, BLOCK_DELETE_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 1, iStartBlockid);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 2, iEndBlockid);
  if( rc!=SQLITE_OK ) return rc;

  return sql_single_step(s);
}

/* Returns SQLITE_ROW with *pidx set to the maximum segment idx found
** at iLevel.  Returns SQLITE_DONE if there are no segments at
** iLevel.  Otherwise returns an error.
*/
static int segdir_max_index(fulltext_vtab *v, int iLevel, int *pidx){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, SEGDIR_MAX_INDEX_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int(s, 1, iLevel);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_step(s);
  /* Should always get at least one row due to how max() works. */
  if( rc==SQLITE_DONE ) return SQLITE_DONE;
  if( rc!=SQLITE_ROW ) return rc;

  /* NULL means that there were no inputs to max(). */
  if( SQLITE_NULL==sqlite3_column_type(s, 0) ){
    rc = sqlite3_step(s);
    if( rc==SQLITE_ROW ) return SQLITE_ERROR;
    return rc;
  }

  *pidx = sqlite3_column_int(s, 0);

  /* We expect only one row.  We must execute another sqlite3_step()
   * to complete the iteration; otherwise the table will remain locked. */
  rc = sqlite3_step(s);
  if( rc==SQLITE_ROW ) return SQLITE_ERROR;
  if( rc!=SQLITE_DONE ) return rc;
  return SQLITE_ROW;
}

/* insert into %_segdir values (
**   [iLevel], [idx],
**   [iStartBlockid], [iLeavesEndBlockid], [iEndBlockid],
**   [pRootData]
** )
*/
static int segdir_set(fulltext_vtab *v, int iLevel, int idx,
                      sqlite_int64 iStartBlockid,
                      sqlite_int64 iLeavesEndBlockid,
                      sqlite_int64 iEndBlockid,
                      const char *pRootData, int nRootData){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, SEGDIR_SET_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int(s, 1, iLevel);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int(s, 2, idx);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 3, iStartBlockid);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 4, iLeavesEndBlockid);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 5, iEndBlockid);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_blob(s, 6, pRootData, nRootData, SQLITE_STATIC);
  if( rc!=SQLITE_OK ) return rc;

  return sql_single_step(s);
}

/* Queries %_segdir for the block span of the segments in level
** iLevel.  Returns SQLITE_DONE if there are no blocks for iLevel,
** SQLITE_ROW if there are blocks, else an error.
*/
static int segdir_span(fulltext_vtab *v, int iLevel,
                       sqlite_int64 *piStartBlockid,
                       sqlite_int64 *piEndBlockid){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, SEGDIR_SPAN_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int(s, 1, iLevel);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_step(s);
  if( rc==SQLITE_DONE ) return SQLITE_DONE;  /* Should never happen */
  if( rc!=SQLITE_ROW ) return rc;

  /* This happens if all segments at this level are entirely inline. */
  if( SQLITE_NULL==sqlite3_column_type(s, 0) ){
    /* We expect only one row.  We must execute another sqlite3_step()
     * to complete the iteration; otherwise the table will remain locked. */
    int rc2 = sqlite3_step(s);
    if( rc2==SQLITE_ROW ) return SQLITE_ERROR;
    return rc2;
  }

  *piStartBlockid = sqlite3_column_int64(s, 0);
  *piEndBlockid = sqlite3_column_int64(s, 1);

  /* We expect only one row.  We must execute another sqlite3_step()
   * to complete the iteration; otherwise the table will remain locked. */
  rc = sqlite3_step(s);
  if( rc==SQLITE_ROW ) return SQLITE_ERROR;
  if( rc!=SQLITE_DONE ) return rc;
  return SQLITE_ROW;
}

/* Delete the segment blocks and segment directory records for all
** segments at iLevel.
*/
static int segdir_delete(fulltext_vtab *v, int iLevel){
  sqlite3_stmt *s;
  sqlite_int64 iStartBlockid, iEndBlockid;
  int rc = segdir_span(v, iLevel, &iStartBlockid, &iEndBlockid);
  if( rc!=SQLITE_ROW && rc!=SQLITE_DONE ) return rc;

  if( rc==SQLITE_ROW ){
    rc = block_delete(v, iStartBlockid, iEndBlockid);
    if( rc!=SQLITE_OK ) return rc;
  }

  /* Delete the segment directory itself. */
  rc = sql_get_statement(v, SEGDIR_DELETE_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 1, iLevel);
  if( rc!=SQLITE_OK ) return rc;

  return sql_single_step(s);
}

/* TODO(shess) clearPendingTerms() is far down the file because
** writeZeroSegment() is far down the file because LeafWriter is far
** down the file.  Consider refactoring the code to move the non-vtab
** code above the vtab code so that we don't need this forward
** reference.
*/
static int clearPendingTerms(fulltext_vtab *v);

/*
** Free the memory used to contain a fulltext_vtab structure.
*/
static void fulltext_vtab_destroy(fulltext_vtab *v){
  int iStmt, i;

  TRACE(("FTS2 Destroy %p\n", v));
  for( iStmt=0; iStmt<MAX_STMT; iStmt++ ){
    if( v->pFulltextStatements[iStmt]!=NULL ){
      sqlite3_finalize(v->pFulltextStatements[iStmt]);
      v->pFulltextStatements[iStmt] = NULL;
    }
  }

  for( i=0; i<MERGE_COUNT; i++ ){
    if( v->pLeafSelectStmts[i]!=NULL ){
      sqlite3_finalize(v->pLeafSelectStmts[i]);
      v->pLeafSelectStmts[i] = NULL;
    }
  }

  if( v->pTokenizer!=NULL ){
    v->pTokenizer->pModule->xDestroy(v->pTokenizer);
    v->pTokenizer = NULL;
  }

  clearPendingTerms(v);

  free(v->azColumn);
  for(i = 0; i < v->nColumn; ++i) {
    sqlite3_free(v->azContentColumn[i]);
  }
  free(v->azContentColumn);
  free(v);
}

/*
** Token types for parsing the arguments to xConnect or xCreate.
*/
#define TOKEN_EOF         0    /* End of file */
#define TOKEN_SPACE       1    /* Any kind of whitespace */
#define TOKEN_ID          2    /* An identifier */
#define TOKEN_STRING      3    /* A string literal */
#define TOKEN_PUNCT       4    /* A single punctuation character */

/*
** If X is a character that can be used in an identifier then
** IdChar(X) will be true.  Otherwise it is false.
**
** For ASCII, any character with the high-order bit set is
** allowed in an identifier.  For 7-bit characters, 
** sqlite3IsIdChar[X] must be 1.
**
** Ticket #1066.  the SQL standard does not allow '$' in the
** middle of identfiers.  But many SQL implementations do. 
** SQLite will allow '$' in identifiers for compatibility.
** But the feature is undocumented.
*/
static const char isIdChar[] = {
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
    0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* 2x */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  /* 3x */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 4x */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,  /* 5x */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 6x */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,  /* 7x */
};
#define IdChar(C)  (((c=C)&0x80)!=0 || (c>0x1f && isIdChar[c-0x20]))


/*
** Return the length of the token that begins at z[0]. 
** Store the token type in *tokenType before returning.
*/
static int getToken(const char *z, int *tokenType){
  int i, c;
  switch( *z ){
    case 0: {
      *tokenType = TOKEN_EOF;
      return 0;
    }
    case ' ': case '\t': case '\n': case '\f': case '\r': {
      for(i=1; safe_isspace(z[i]); i++){}
      *tokenType = TOKEN_SPACE;
      return i;
    }
    case '`':
    case '\'':
    case '"': {
      int delim = z[0];
      for(i=1; (c=z[i])!=0; i++){
        if( c==delim ){
          if( z[i+1]==delim ){
            i++;
          }else{
            break;
          }
        }
      }
      *tokenType = TOKEN_STRING;
      return i + (c!=0);
    }
    case '[': {
      for(i=1, c=z[0]; c!=']' && (c=z[i])!=0; i++){}
      *tokenType = TOKEN_ID;
      return i;
    }
    default: {
      if( !IdChar(*z) ){
        break;
      }
      for(i=1; IdChar(z[i]); i++){}
      *tokenType = TOKEN_ID;
      return i;
    }
  }
  *tokenType = TOKEN_PUNCT;
  return 1;
}

/*
** A token extracted from a string is an instance of the following
** structure.
*/
typedef struct Token {
  const char *z;       /* Pointer to token text.  Not '\000' terminated */
  short int n;         /* Length of the token text in bytes. */
} Token;

/*
** Given a input string (which is really one of the argv[] parameters
** passed into xConnect or xCreate) split the string up into tokens.
** Return an array of pointers to '\000' terminated strings, one string
** for each non-whitespace token.
**
** The returned array is terminated by a single NULL pointer.
**
** Space to hold the returned array is obtained from a single
** malloc and should be freed by passing the return value to free().
** The individual strings within the token list are all a part of
** the single memory allocation and will all be freed at once.
*/
static char **tokenizeString(const char *z, int *pnToken){
  int nToken = 0;
  Token *aToken = malloc( strlen(z) * sizeof(aToken[0]) );
  int n = 1;
  int e, i;
  int totalSize = 0;
  char **azToken;
  char *zCopy;
  while( n>0 ){
    n = getToken(z, &e);
    if( e!=TOKEN_SPACE ){
      aToken[nToken].z = z;
      aToken[nToken].n = n;
      nToken++;
      totalSize += n+1;
    }
    z += n;
  }
  azToken = (char**)malloc( nToken*sizeof(char*) + totalSize );
  zCopy = (char*)&azToken[nToken];
  nToken--;
  for(i=0; i<nToken; i++){
    azToken[i] = zCopy;
    n = aToken[i].n;
    memcpy(zCopy, aToken[i].z, n);
    zCopy[n] = 0;
    zCopy += n+1;
  }
  azToken[nToken] = 0;
  free(aToken);
  *pnToken = nToken;
  return azToken;
}

/*
** Convert an SQL-style quoted string into a normal string by removing
** the quote characters.  The conversion is done in-place.  If the
** input does not begin with a quote character, then this routine
** is a no-op.
**
** Examples:
**
**     "abc"   becomes   abc
**     'xyz'   becomes   xyz
**     [pqr]   becomes   pqr
**     `mno`   becomes   mno
*/
static void dequoteString(char *z){
  int quote;
  int i, j;
  if( z==0 ) return;
  quote = z[0];
  switch( quote ){
    case '\'':  break;
    case '"':   break;
    case '`':   break;                /* For MySQL compatibility */
    case '[':   quote = ']';  break;  /* For MS SqlServer compatibility */
    default:    return;
  }
  for(i=1, j=0; z[i]; i++){
    if( z[i]==quote ){
      if( z[i+1]==quote ){
        z[j++] = quote;
        i++;
      }else{
        z[j++] = 0;
        break;
      }
    }else{
      z[j++] = z[i];
    }
  }
}

/*
** The input azIn is a NULL-terminated list of tokens.  Remove the first
** token and all punctuation tokens.  Remove the quotes from
** around string literal tokens.
**
** Example:
**
**     input:      tokenize chinese ( 'simplifed' , 'mixed' )
**     output:     chinese simplifed mixed
**
** Another example:
**
**     input:      delimiters ( '[' , ']' , '...' )
**     output:     [ ] ...
*/
static void tokenListToIdList(char **azIn){
  int i, j;
  if( azIn ){
    for(i=0, j=-1; azIn[i]; i++){
      if( safe_isalnum(azIn[i][0]) || azIn[i][1] ){
        dequoteString(azIn[i]);
        if( j>=0 ){
          azIn[j] = azIn[i];
        }
        j++;
      }
    }
    azIn[j] = 0;
  }
}


/*
** Find the first alphanumeric token in the string zIn.  Null-terminate
** this token.  Remove any quotation marks.  And return a pointer to
** the result.
*/
static char *firstToken(char *zIn, char **pzTail){
  int n, ttype;
  while(1){
    n = getToken(zIn, &ttype);
    if( ttype==TOKEN_SPACE ){
      zIn += n;
    }else if( ttype==TOKEN_EOF ){
      *pzTail = zIn;
      return 0;
    }else{
      zIn[n] = 0;
      *pzTail = &zIn[1];
      dequoteString(zIn);
      return zIn;
    }
  }
  /*NOTREACHED*/
}

/* Return true if...
**
**   *  s begins with the string t, ignoring case
**   *  s is longer than t
**   *  The first character of s beyond t is not a alphanumeric
** 
** Ignore leading space in *s.
**
** To put it another way, return true if the first token of
** s[] is t[].
*/
static int startsWith(const char *s, const char *t){
  while( safe_isspace(*s) ){ s++; }
  while( *t ){
    if( safe_tolower(*s++)!=safe_tolower(*t++) ) return 0;
  }
  return *s!='_' && !safe_isalnum(*s);
}

/*
** An instance of this structure defines the "spec" of a
** full text index.  This structure is populated by parseSpec
** and use by fulltextConnect and fulltextCreate.
*/
typedef struct TableSpec {
  const char *zDb;         /* Logical database name */
  const char *zName;       /* Name of the full-text index */
  int nColumn;             /* Number of columns to be indexed */
  char **azColumn;         /* Original names of columns to be indexed */
  char **azContentColumn;  /* Column names for %_content */
  char **azTokenizer;      /* Name of tokenizer and its arguments */
} TableSpec;

/*
** Reclaim all of the memory used by a TableSpec
*/
static void clearTableSpec(TableSpec *p) {
  free(p->azColumn);
  free(p->azContentColumn);
  free(p->azTokenizer);
}

/* Parse a CREATE VIRTUAL TABLE statement, which looks like this:
 *
 * CREATE VIRTUAL TABLE email
 *        USING fts2(subject, body, tokenize mytokenizer(myarg))
 *
 * We return parsed information in a TableSpec structure.
 * 
 */
static int parseSpec(TableSpec *pSpec, int argc, const char *const*argv,
                     char**pzErr){
  int i, n;
  char *z, *zDummy;
  char **azArg;
  const char *zTokenizer = 0;    /* argv[] entry describing the tokenizer */

  assert( argc>=3 );
  /* Current interface:
  ** argv[0] - module name
  ** argv[1] - database name
  ** argv[2] - table name
  ** argv[3..] - columns, optionally followed by tokenizer specification
  **             and snippet delimiters specification.
  */

  /* Make a copy of the complete argv[][] array in a single allocation.
  ** The argv[][] array is read-only and transient.  We can write to the
  ** copy in order to modify things and the copy is persistent.
  */
  CLEAR(pSpec);
  for(i=n=0; i<argc; i++){
    n += strlen(argv[i]) + 1;
  }
  azArg = malloc( sizeof(char*)*argc + n );
  if( azArg==0 ){
    return SQLITE_NOMEM;
  }
  z = (char*)&azArg[argc];
  for(i=0; i<argc; i++){
    azArg[i] = z;
    strcpy(z, argv[i]);
    z += strlen(z)+1;
  }

  /* Identify the column names and the tokenizer and delimiter arguments
  ** in the argv[][] array.
  */
  pSpec->zDb = azArg[1];
  pSpec->zName = azArg[2];
  pSpec->nColumn = 0;
  pSpec->azColumn = azArg;
  zTokenizer = "tokenize simple";
  for(i=3; i<argc; ++i){
    if( startsWith(azArg[i],"tokenize") ){
      zTokenizer = azArg[i];
    }else{
      z = azArg[pSpec->nColumn] = firstToken(azArg[i], &zDummy);
      pSpec->nColumn++;
    }
  }
  if( pSpec->nColumn==0 ){
    azArg[0] = "content";
    pSpec->nColumn = 1;
  }

  /*
  ** Construct the list of content column names.
  **
  ** Each content column name will be of the form cNNAAAA
  ** where NN is the column number and AAAA is the sanitized
  ** column name.  "sanitized" means that special characters are
  ** converted to "_".  The cNN prefix guarantees that all column
  ** names are unique.
  **
  ** The AAAA suffix is not strictly necessary.  It is included
  ** for the convenience of people who might examine the generated
  ** %_content table and wonder what the columns are used for.
  */
  pSpec->azContentColumn = malloc( pSpec->nColumn * sizeof(char *) );
  if( pSpec->azContentColumn==0 ){
    clearTableSpec(pSpec);
    return SQLITE_NOMEM;
  }
  for(i=0; i<pSpec->nColumn; i++){
    char *p;
    pSpec->azContentColumn[i] = sqlite3_mprintf("c%d%s", i, azArg[i]);
    for (p = pSpec->azContentColumn[i]; *p ; ++p) {
      if( !safe_isalnum(*p) ) *p = '_';
    }
  }

  /*
  ** Parse the tokenizer specification string.
  */
  pSpec->azTokenizer = tokenizeString(zTokenizer, &n);
  tokenListToIdList(pSpec->azTokenizer);

  return SQLITE_OK;
}

/*
** Generate a CREATE TABLE statement that describes the schema of
** the virtual table.  Return a pointer to this schema string.
**
** Space is obtained from sqlite3_mprintf() and should be freed
** using sqlite3_free().
*/
static char *fulltextSchema(
  int nColumn,                  /* Number of columns */
  const char *const* azColumn,  /* List of columns */
  const char *zTableName        /* Name of the table */
){
  int i;
  char *zSchema, *zNext;
  const char *zSep = "(";
  zSchema = sqlite3_mprintf("CREATE TABLE x");
  for(i=0; i<nColumn; i++){
    zNext = sqlite3_mprintf("%s%s%Q", zSchema, zSep, azColumn[i]);
    sqlite3_free(zSchema);
    zSchema = zNext;
    zSep = ",";
  }
  zNext = sqlite3_mprintf("%s,%Q)", zSchema, zTableName);
  sqlite3_free(zSchema);
  return zNext;
}

/*
** Build a new sqlite3_vtab structure that will describe the
** fulltext index defined by spec.
*/
static int constructVtab(
  sqlite3 *db,              /* The SQLite database connection */
  fts2Hash *pHash,          /* Hash table containing tokenizers */
  TableSpec *spec,          /* Parsed spec information from parseSpec() */
  sqlite3_vtab **ppVTab,    /* Write the resulting vtab structure here */
  char **pzErr              /* Write any error message here */
){
  int rc;
  int n;
  fulltext_vtab *v = 0;
  const sqlite3_tokenizer_module *m = NULL;
  char *schema;

  char const *zTok;         /* Name of tokenizer to use for this fts table */
  int nTok;                 /* Length of zTok, including nul terminator */

  v = (fulltext_vtab *) malloc(sizeof(fulltext_vtab));
  if( v==0 ) return SQLITE_NOMEM;
  CLEAR(v);
  /* sqlite will initialize v->base */
  v->db = db;
  v->zDb = spec->zDb;       /* Freed when azColumn is freed */
  v->zName = spec->zName;   /* Freed when azColumn is freed */
  v->nColumn = spec->nColumn;
  v->azContentColumn = spec->azContentColumn;
  spec->azContentColumn = 0;
  v->azColumn = spec->azColumn;
  spec->azColumn = 0;

  if( spec->azTokenizer==0 ){
    return SQLITE_NOMEM;
  }

  zTok = spec->azTokenizer[0]; 
  if( !zTok ){
    zTok = "simple";
  }
  nTok = strlen(zTok)+1;

  m = (sqlite3_tokenizer_module *)sqlite3Fts2HashFind(pHash, zTok, nTok);
  if( !m ){
    *pzErr = sqlite3_mprintf("unknown tokenizer: %s", spec->azTokenizer[0]);
    rc = SQLITE_ERROR;
    goto err;
  }

  for(n=0; spec->azTokenizer[n]; n++){}
  if( n ){
    rc = m->xCreate(n-1, (const char*const*)&spec->azTokenizer[1],
                    &v->pTokenizer);
  }else{
    rc = m->xCreate(0, 0, &v->pTokenizer);
  }
  if( rc!=SQLITE_OK ) goto err;
  v->pTokenizer->pModule = m;

  /* TODO: verify the existence of backing tables foo_content, foo_term */

  schema = fulltextSchema(v->nColumn, (const char*const*)v->azColumn,
                          spec->zName);
  rc = sqlite3_declare_vtab(db, schema);
  sqlite3_free(schema);
  if( rc!=SQLITE_OK ) goto err;

  memset(v->pFulltextStatements, 0, sizeof(v->pFulltextStatements));

  /* Indicate that the buffer is not live. */
  v->nPendingData = -1;

  *ppVTab = &v->base;
  TRACE(("FTS2 Connect %p\n", v));

  return rc;

err:
  fulltext_vtab_destroy(v);
  return rc;
}

static int fulltextConnect(
  sqlite3 *db,
  void *pAux,
  int argc, const char *const*argv,
  sqlite3_vtab **ppVTab,
  char **pzErr
){
  TableSpec spec;
  int rc = parseSpec(&spec, argc, argv, pzErr);
  if( rc!=SQLITE_OK ) return rc;

  rc = constructVtab(db, (fts2Hash *)pAux, &spec, ppVTab, pzErr);
  clearTableSpec(&spec);
  return rc;
}

/* The %_content table holds the text of each document, with
** the rowid used as the docid.
*/
/* TODO(shess) This comment needs elaboration to match the updated
** code.  Work it into the top-of-file comment at that time.
*/
static int fulltextCreate(sqlite3 *db, void *pAux,
                          int argc, const char * const *argv,
                          sqlite3_vtab **ppVTab, char **pzErr){
  int rc;
  TableSpec spec;
  StringBuffer schema;
  TRACE(("FTS2 Create\n"));

  rc = parseSpec(&spec, argc, argv, pzErr);
  if( rc!=SQLITE_OK ) return rc;

  initStringBuffer(&schema);
  append(&schema, "CREATE TABLE %_content(");
  appendList(&schema, spec.nColumn, spec.azContentColumn);
  append(&schema, ")");
  rc = sql_exec(db, spec.zDb, spec.zName, stringBufferData(&schema));
  stringBufferDestroy(&schema);
  if( rc!=SQLITE_OK ) goto out;

  rc = sql_exec(db, spec.zDb, spec.zName,
                "create table %_segments(block blob);");
  if( rc!=SQLITE_OK ) goto out;

  rc = sql_exec(db, spec.zDb, spec.zName,
                "create table %_segdir("
                "  level integer,"
                "  idx integer,"
                "  start_block integer,"
                "  leaves_end_block integer,"
                "  end_block integer,"
                "  root blob,"
                "  primary key(level, idx)"
                ");");
  if( rc!=SQLITE_OK ) goto out;

  rc = constructVtab(db, (fts2Hash *)pAux, &spec, ppVTab, pzErr);

out:
  clearTableSpec(&spec);
  return rc;
}

/* Decide how to handle an SQL query. */
static int fulltextBestIndex(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){
  int i;
  TRACE(("FTS2 BestIndex\n"));

  for(i=0; i<pInfo->nConstraint; ++i){
    const struct sqlite3_index_constraint *pConstraint;
    pConstraint = &pInfo->aConstraint[i];
    if( pConstraint->usable ) {
      if( pConstraint->iColumn==-1 &&
          pConstraint->op==SQLITE_INDEX_CONSTRAINT_EQ ){
        pInfo->idxNum = QUERY_ROWID;      /* lookup by rowid */
        TRACE(("FTS2 QUERY_ROWID\n"));
      } else if( pConstraint->iColumn>=0 &&
                 pConstraint->op==SQLITE_INDEX_CONSTRAINT_MATCH ){
        /* full-text search */
        pInfo->idxNum = QUERY_FULLTEXT + pConstraint->iColumn;
        TRACE(("FTS2 QUERY_FULLTEXT %d\n", pConstraint->iColumn));
      } else continue;

      pInfo->aConstraintUsage[i].argvIndex = 1;
      pInfo->aConstraintUsage[i].omit = 1;

      /* An arbitrary value for now.
       * TODO: Perhaps rowid matches should be considered cheaper than
       * full-text searches. */
      pInfo->estimatedCost = 1.0;   

      return SQLITE_OK;
    }
  }
  pInfo->idxNum = QUERY_GENERIC;
  return SQLITE_OK;
}

static int fulltextDisconnect(sqlite3_vtab *pVTab){
  TRACE(("FTS2 Disconnect %p\n", pVTab));
  fulltext_vtab_destroy((fulltext_vtab *)pVTab);
  return SQLITE_OK;
}

static int fulltextDestroy(sqlite3_vtab *pVTab){
  fulltext_vtab *v = (fulltext_vtab *)pVTab;
  int rc;

  TRACE(("FTS2 Destroy %p\n", pVTab));
  rc = sql_exec(v->db, v->zDb, v->zName,
                "drop table if exists %_content;"
                "drop table if exists %_segments;"
                "drop table if exists %_segdir;"
                );
  if( rc!=SQLITE_OK ) return rc;

  fulltext_vtab_destroy((fulltext_vtab *)pVTab);
  return SQLITE_OK;
}

static int fulltextOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){
  fulltext_cursor *c;

  c = (fulltext_cursor *) calloc(sizeof(fulltext_cursor), 1);
  /* sqlite will initialize c->base */
  *ppCursor = &c->base;
  TRACE(("FTS2 Open %p: %p\n", pVTab, c));

  return SQLITE_OK;
}


/* Free all of the dynamically allocated memory held by *q
*/
static void queryClear(Query *q){
  int i;
  for(i = 0; i < q->nTerms; ++i){
    free(q->pTerms[i].pTerm);
  }
  free(q->pTerms);
  CLEAR(q);
}

/* Free all of the dynamically allocated memory held by the
** Snippet
*/
static void snippetClear(Snippet *p){
  free(p->aMatch);
  free(p->zOffset);
  free(p->zSnippet);
  CLEAR(p);
}
/*
** Append a single entry to the p->aMatch[] log.
*/
static void snippetAppendMatch(
  Snippet *p,               /* Append the entry to this snippet */
  int iCol, int iTerm,      /* The column and query term */
  int iStart, int nByte     /* Offset and size of the match */
){
  int i;
  struct snippetMatch *pMatch;
  if( p->nMatch+1>=p->nAlloc ){
    p->nAlloc = p->nAlloc*2 + 10;
    p->aMatch = realloc(p->aMatch, p->nAlloc*sizeof(p->aMatch[0]) );
    if( p->aMatch==0 ){
      p->nMatch = 0;
      p->nAlloc = 0;
      return;
    }
  }
  i = p->nMatch++;
  pMatch = &p->aMatch[i];
  pMatch->iCol = iCol;
  pMatch->iTerm = iTerm;
  pMatch->iStart = iStart;
  pMatch->nByte = nByte;
}

/*
** Sizing information for the circular buffer used in snippetOffsetsOfColumn()
*/
#define FTS2_ROTOR_SZ   (32)
#define FTS2_ROTOR_MASK (FTS2_ROTOR_SZ-1)

/*
** Add entries to pSnippet->aMatch[] for every match that occurs against
** document zDoc[0..nDoc-1] which is stored in column iColumn.
*/
static void snippetOffsetsOfColumn(
  Query *pQuery,
  Snippet *pSnippet,
  int iColumn,
  const char *zDoc,
  int nDoc
){
  const sqlite3_tokenizer_module *pTModule;  /* The tokenizer module */
  sqlite3_tokenizer *pTokenizer;             /* The specific tokenizer */
  sqlite3_tokenizer_cursor *pTCursor;        /* Tokenizer cursor */
  fulltext_vtab *pVtab;                /* The full text index */
  int nColumn;                         /* Number of columns in the index */
  const QueryTerm *aTerm;              /* Query string terms */
  int nTerm;                           /* Number of query string terms */  
  int i, j;                            /* Loop counters */
  int rc;                              /* Return code */
  unsigned int match, prevMatch;       /* Phrase search bitmasks */
  const char *zToken;                  /* Next token from the tokenizer */
  int nToken;                          /* Size of zToken */
  int iBegin, iEnd, iPos;              /* Offsets of beginning and end */

  /* The following variables keep a circular buffer of the last
  ** few tokens */
  unsigned int iRotor = 0;             /* Index of current token */
  int iRotorBegin[FTS2_ROTOR_SZ];      /* Beginning offset of token */
  int iRotorLen[FTS2_ROTOR_SZ];        /* Length of token */

  pVtab = pQuery->pFts;
  nColumn = pVtab->nColumn;
  pTokenizer = pVtab->pTokenizer;
  pTModule = pTokenizer->pModule;
  rc = pTModule->xOpen(pTokenizer, zDoc, nDoc, &pTCursor);
  if( rc ) return;
  pTCursor->pTokenizer = pTokenizer;
  aTerm = pQuery->pTerms;
  nTerm = pQuery->nTerms;
  if( nTerm>=FTS2_ROTOR_SZ ){
    nTerm = FTS2_ROTOR_SZ - 1;
  }
  prevMatch = 0;
  while(1){
    rc = pTModule->xNext(pTCursor, &zToken, &nToken, &iBegin, &iEnd, &iPos);
    if( rc ) break;
    iRotorBegin[iRotor&FTS2_ROTOR_MASK] = iBegin;
    iRotorLen[iRotor&FTS2_ROTOR_MASK] = iEnd-iBegin;
    match = 0;
    for(i=0; i<nTerm; i++){
      int iCol;
      iCol = aTerm[i].iColumn;
      if( iCol>=0 && iCol<nColumn && iCol!=iColumn ) continue;
      if( aTerm[i].nTerm>nToken ) continue;
      if( !aTerm[i].isPrefix && aTerm[i].nTerm<nToken ) continue;
      assert( aTerm[i].nTerm<=nToken );
      if( memcmp(aTerm[i].pTerm, zToken, aTerm[i].nTerm) ) continue;
      if( aTerm[i].iPhrase>1 && (prevMatch & (1<<i))==0 ) continue;
      match |= 1<<i;
      if( i==nTerm-1 || aTerm[i+1].iPhrase==1 ){
        for(j=aTerm[i].iPhrase-1; j>=0; j--){
          int k = (iRotor-j) & FTS2_ROTOR_MASK;
          snippetAppendMatch(pSnippet, iColumn, i-j,
                iRotorBegin[k], iRotorLen[k]);
        }
      }
    }
    prevMatch = match<<1;
    iRotor++;
  }
  pTModule->xClose(pTCursor);  
}


/*
** Compute all offsets for the current row of the query.  
** If the offsets have already been computed, this routine is a no-op.
*/
static void snippetAllOffsets(fulltext_cursor *p){
  int nColumn;
  int iColumn, i;
  int iFirst, iLast;
  fulltext_vtab *pFts;

  if( p->snippet.nMatch ) return;
  if( p->q.nTerms==0 ) return;
  pFts = p->q.pFts;
  nColumn = pFts->nColumn;
  iColumn = (p->iCursorType - QUERY_FULLTEXT);
  if( iColumn<0 || iColumn>=nColumn ){
    iFirst = 0;
    iLast = nColumn-1;
  }else{
    iFirst = iColumn;
    iLast = iColumn;
  }
  for(i=iFirst; i<=iLast; i++){
    const char *zDoc;
    int nDoc;
    zDoc = (const char*)sqlite3_column_text(p->pStmt, i+1);
    nDoc = sqlite3_column_bytes(p->pStmt, i+1);
    snippetOffsetsOfColumn(&p->q, &p->snippet, i, zDoc, nDoc);
  }
}

/*
** Convert the information in the aMatch[] array of the snippet
** into the string zOffset[0..nOffset-1].
*/
static void snippetOffsetText(Snippet *p){
  int i;
  int cnt = 0;
  StringBuffer sb;
  char zBuf[200];
  if( p->zOffset ) return;
  initStringBuffer(&sb);
  for(i=0; i<p->nMatch; i++){
    struct snippetMatch *pMatch = &p->aMatch[i];
    zBuf[0] = ' ';
    sprintf(&zBuf[cnt>0], "%d %d %d %d", pMatch->iCol,
        pMatch->iTerm, pMatch->iStart, pMatch->nByte);
    append(&sb, zBuf);
    cnt++;
  }
  p->zOffset = stringBufferData(&sb);
  p->nOffset = stringBufferLength(&sb);
}

/*
** zDoc[0..nDoc-1] is phrase of text.  aMatch[0..nMatch-1] are a set
** of matching words some of which might be in zDoc.  zDoc is column
** number iCol.
**
** iBreak is suggested spot in zDoc where we could begin or end an
** excerpt.  Return a value similar to iBreak but possibly adjusted
** to be a little left or right so that the break point is better.
*/
static int wordBoundary(
  int iBreak,                   /* The suggested break point */
  const char *zDoc,             /* Document text */
  int nDoc,                     /* Number of bytes in zDoc[] */
  struct snippetMatch *aMatch,  /* Matching words */
  int nMatch,                   /* Number of entries in aMatch[] */
  int iCol                      /* The column number for zDoc[] */
){
  int i;
  if( iBreak<=10 ){
    return 0;
  }
  if( iBreak>=nDoc-10 ){
    return nDoc;
  }
  for(i=0; i<nMatch && aMatch[i].iCol<iCol; i++){}
  while( i<nMatch && aMatch[i].iStart+aMatch[i].nByte<iBreak ){ i++; }
  if( i<nMatch ){
    if( aMatch[i].iStart<iBreak+10 ){
      return aMatch[i].iStart;
    }
    if( i>0 && aMatch[i-1].iStart+aMatch[i-1].nByte>=iBreak ){
      return aMatch[i-1].iStart;
    }
  }
  for(i=1; i<=10; i++){
    if( safe_isspace(zDoc[iBreak-i]) ){
      return iBreak - i + 1;
    }
    if( safe_isspace(zDoc[iBreak+i]) ){
      return iBreak + i + 1;
    }
  }
  return iBreak;
}



/*
** Allowed values for Snippet.aMatch[].snStatus
*/
#define SNIPPET_IGNORE  0   /* It is ok to omit this match from the snippet */
#define SNIPPET_DESIRED 1   /* We want to include this match in the snippet */

/*
** Generate the text of a snippet.
*/
static void snippetText(
  fulltext_cursor *pCursor,   /* The cursor we need the snippet for */
  const char *zStartMark,     /* Markup to appear before each match */
  const char *zEndMark,       /* Markup to appear after each match */
  const char *zEllipsis       /* Ellipsis mark */
){
  int i, j;
  struct snippetMatch *aMatch;
  int nMatch;
  int nDesired;
  StringBuffer sb;
  int tailCol;
  int tailOffset;
  int iCol;
  int nDoc;
  const char *zDoc;
  int iStart, iEnd;
  int tailEllipsis = 0;
  int iMatch;
  

  free(pCursor->snippet.zSnippet);
  pCursor->snippet.zSnippet = 0;
  aMatch = pCursor->snippet.aMatch;
  nMatch = pCursor->snippet.nMatch;
  initStringBuffer(&sb);

  for(i=0; i<nMatch; i++){
    aMatch[i].snStatus = SNIPPET_IGNORE;
  }
  nDesired = 0;
  for(i=0; i<pCursor->q.nTerms; i++){
    for(j=0; j<nMatch; j++){
      if( aMatch[j].iTerm==i ){
        aMatch[j].snStatus = SNIPPET_DESIRED;
        nDesired++;
        break;
      }
    }
  }

  iMatch = 0;
  tailCol = -1;
  tailOffset = 0;
  for(i=0; i<nMatch && nDesired>0; i++){
    if( aMatch[i].snStatus!=SNIPPET_DESIRED ) continue;
    nDesired--;
    iCol = aMatch[i].iCol;
    zDoc = (const char*)sqlite3_column_text(pCursor->pStmt, iCol+1);
    nDoc = sqlite3_column_bytes(pCursor->pStmt, iCol+1);
    iStart = aMatch[i].iStart - 40;
    iStart = wordBoundary(iStart, zDoc, nDoc, aMatch, nMatch, iCol);
    if( iStart<=10 ){
      iStart = 0;
    }
    if( iCol==tailCol && iStart<=tailOffset+20 ){
      iStart = tailOffset;
    }
    if( (iCol!=tailCol && tailCol>=0) || iStart!=tailOffset ){
      trimWhiteSpace(&sb);
      appendWhiteSpace(&sb);
      append(&sb, zEllipsis);
      appendWhiteSpace(&sb);
    }
    iEnd = aMatch[i].iStart + aMatch[i].nByte + 40;
    iEnd = wordBoundary(iEnd, zDoc, nDoc, aMatch, nMatch, iCol);
    if( iEnd>=nDoc-10 ){
      iEnd = nDoc;
      tailEllipsis = 0;
    }else{
      tailEllipsis = 1;
    }
    while( iMatch<nMatch && aMatch[iMatch].iCol<iCol ){ iMatch++; }
    while( iStart<iEnd ){
      while( iMatch<nMatch && aMatch[iMatch].iStart<iStart
             && aMatch[iMatch].iCol<=iCol ){
        iMatch++;
      }
      if( iMatch<nMatch && aMatch[iMatch].iStart<iEnd
             && aMatch[iMatch].iCol==iCol ){
        nappend(&sb, &zDoc[iStart], aMatch[iMatch].iStart - iStart);
        iStart = aMatch[iMatch].iStart;
        append(&sb, zStartMark);
        nappend(&sb, &zDoc[iStart], aMatch[iMatch].nByte);
        append(&sb, zEndMark);
        iStart += aMatch[iMatch].nByte;
        for(j=iMatch+1; j<nMatch; j++){
          if( aMatch[j].iTerm==aMatch[iMatch].iTerm
              && aMatch[j].snStatus==SNIPPET_DESIRED ){
            nDesired--;
            aMatch[j].snStatus = SNIPPET_IGNORE;
          }
        }
      }else{
        nappend(&sb, &zDoc[iStart], iEnd - iStart);
        iStart = iEnd;
      }
    }
    tailCol = iCol;
    tailOffset = iEnd;
  }
  trimWhiteSpace(&sb);
  if( tailEllipsis ){
    appendWhiteSpace(&sb);
    append(&sb, zEllipsis);
  }
  pCursor->snippet.zSnippet = stringBufferData(&sb);
  pCursor->snippet.nSnippet = stringBufferLength(&sb);
}


/*
** Close the cursor.  For additional information see the documentation
** on the xClose method of the virtual table interface.
*/
static int fulltextClose(sqlite3_vtab_cursor *pCursor){
  fulltext_cursor *c = (fulltext_cursor *) pCursor;
  TRACE(("FTS2 Close %p\n", c));
  sqlite3_finalize(c->pStmt);
  queryClear(&c->q);
  snippetClear(&c->snippet);
  if( c->result.nData!=0 ) dlrDestroy(&c->reader);
  dataBufferDestroy(&c->result);
  free(c);
  return SQLITE_OK;
}

static int fulltextNext(sqlite3_vtab_cursor *pCursor){
  fulltext_cursor *c = (fulltext_cursor *) pCursor;
  int rc;

  TRACE(("FTS2 Next %p\n", pCursor));
  snippetClear(&c->snippet);
  if( c->iCursorType < QUERY_FULLTEXT ){
    /* TODO(shess) Handle SQLITE_SCHEMA AND SQLITE_BUSY. */
    rc = sqlite3_step(c->pStmt);
    switch( rc ){
      case SQLITE_ROW:
        c->eof = 0;
        return SQLITE_OK;
      case SQLITE_DONE:
        c->eof = 1;
        return SQLITE_OK;
      default:
        c->eof = 1;
        return rc;
    }
  } else {  /* full-text query */
    rc = sqlite3_reset(c->pStmt);
    if( rc!=SQLITE_OK ) return rc;

    if( c->result.nData==0 || dlrAtEnd(&c->reader) ){
      c->eof = 1;
      return SQLITE_OK;
    }
    rc = sqlite3_bind_int64(c->pStmt, 1, dlrDocid(&c->reader));
    dlrStep(&c->reader);
    if( rc!=SQLITE_OK ) return rc;
    /* TODO(shess) Handle SQLITE_SCHEMA AND SQLITE_BUSY. */
    rc = sqlite3_step(c->pStmt);
    if( rc==SQLITE_ROW ){   /* the case we expect */
      c->eof = 0;
      return SQLITE_OK;
    }
    /* an error occurred; abort */
    return rc==SQLITE_DONE ? SQLITE_ERROR : rc;
  }
}


/* TODO(shess) If we pushed LeafReader to the top of the file, or to
** another file, term_select() could be pushed above
** docListOfTerm().
*/
static int termSelect(fulltext_vtab *v, int iColumn,
                      const char *pTerm, int nTerm, int isPrefix,
                      DocListType iType, DataBuffer *out);

/* Return a DocList corresponding to the query term *pTerm.  If *pTerm
** is the first term of a phrase query, go ahead and evaluate the phrase
** query and return the doclist for the entire phrase query.
**
** The resulting DL_DOCIDS doclist is stored in pResult, which is
** overwritten.
*/
static int docListOfTerm(
  fulltext_vtab *v,   /* The full text index */
  int iColumn,        /* column to restrict to.  No restriction if >=nColumn */
  QueryTerm *pQTerm,  /* Term we are looking for, or 1st term of a phrase */
  DataBuffer *pResult /* Write the result here */
){
  DataBuffer left, right, new;
  int i, rc;

  /* No phrase search if no position info. */
  assert( pQTerm->nPhrase==0 || DL_DEFAULT!=DL_DOCIDS );

  /* This code should never be called with buffered updates. */
  assert( v->nPendingData<0 );

  dataBufferInit(&left, 0);
  rc = termSelect(v, iColumn, pQTerm->pTerm, pQTerm->nTerm, pQTerm->isPrefix,
                  0<pQTerm->nPhrase ? DL_POSITIONS : DL_DOCIDS, &left);
  if( rc ) return rc;
  for(i=1; i<=pQTerm->nPhrase && left.nData>0; i++){
    dataBufferInit(&right, 0);
    rc = termSelect(v, iColumn, pQTerm[i].pTerm, pQTerm[i].nTerm,
                    pQTerm[i].isPrefix, DL_POSITIONS, &right);
    if( rc ){
      dataBufferDestroy(&left);
      return rc;
    }
    dataBufferInit(&new, 0);
    docListPhraseMerge(left.pData, left.nData, right.pData, right.nData,
                       i<pQTerm->nPhrase ? DL_POSITIONS : DL_DOCIDS, &new);
    dataBufferDestroy(&left);
    dataBufferDestroy(&right);
    left = new;
  }
  *pResult = left;
  return SQLITE_OK;
}

/* Add a new term pTerm[0..nTerm-1] to the query *q.
*/
static void queryAdd(Query *q, const char *pTerm, int nTerm){
  QueryTerm *t;
  ++q->nTerms;
  q->pTerms = realloc(q->pTerms, q->nTerms * sizeof(q->pTerms[0]));
  if( q->pTerms==0 ){
    q->nTerms = 0;
    return;
  }
  t = &q->pTerms[q->nTerms - 1];
  CLEAR(t);
  t->pTerm = malloc(nTerm+1);
  memcpy(t->pTerm, pTerm, nTerm);
  t->pTerm[nTerm] = 0;
  t->nTerm = nTerm;
  t->isOr = q->nextIsOr;
  t->isPrefix = 0;
  q->nextIsOr = 0;
  t->iColumn = q->nextColumn;
  q->nextColumn = q->dfltColumn;
}

/*
** Check to see if the string zToken[0...nToken-1] matches any
** column name in the virtual table.   If it does,
** return the zero-indexed column number.  If not, return -1.
*/
static int checkColumnSpecifier(
  fulltext_vtab *pVtab,    /* The virtual table */
  const char *zToken,      /* Text of the token */
  int nToken               /* Number of characters in the token */
){
  int i;
  for(i=0; i<pVtab->nColumn; i++){
    if( memcmp(pVtab->azColumn[i], zToken, nToken)==0
        && pVtab->azColumn[i][nToken]==0 ){
      return i;
    }
  }
  return -1;
}

/*
** Parse the text at pSegment[0..nSegment-1].  Add additional terms
** to the query being assemblied in pQuery.
**
** inPhrase is true if pSegment[0..nSegement-1] is contained within
** double-quotes.  If inPhrase is true, then the first term
** is marked with the number of terms in the phrase less one and
** OR and "-" syntax is ignored.  If inPhrase is false, then every
** term found is marked with nPhrase=0 and OR and "-" syntax is significant.
*/
static int tokenizeSegment(
  sqlite3_tokenizer *pTokenizer,          /* The tokenizer to use */
  const char *pSegment, int nSegment,     /* Query expression being parsed */
  int inPhrase,                           /* True if within "..." */
  Query *pQuery                           /* Append results here */
){
  const sqlite3_tokenizer_module *pModule = pTokenizer->pModule;
  sqlite3_tokenizer_cursor *pCursor;
  int firstIndex = pQuery->nTerms;
  int iCol;
  int nTerm = 1;
  
  int rc = pModule->xOpen(pTokenizer, pSegment, nSegment, &pCursor);
  if( rc!=SQLITE_OK ) return rc;
  pCursor->pTokenizer = pTokenizer;

  while( 1 ){
    const char *pToken;
    int nToken, iBegin, iEnd, iPos;

    rc = pModule->xNext(pCursor,
                        &pToken, &nToken,
                        &iBegin, &iEnd, &iPos);
    if( rc!=SQLITE_OK ) break;
    if( !inPhrase &&
        pSegment[iEnd]==':' &&
         (iCol = checkColumnSpecifier(pQuery->pFts, pToken, nToken))>=0 ){
      pQuery->nextColumn = iCol;
      continue;
    }
    if( !inPhrase && pQuery->nTerms>0 && nToken==2
         && pSegment[iBegin]=='O' && pSegment[iBegin+1]=='R' ){
      pQuery->nextIsOr = 1;
      continue;
    }
    queryAdd(pQuery, pToken, nToken);
    if( !inPhrase && iBegin>0 && pSegment[iBegin-1]=='-' ){
      pQuery->pTerms[pQuery->nTerms-1].isNot = 1;
    }
    if( iEnd<nSegment && pSegment[iEnd]=='*' ){
      pQuery->pTerms[pQuery->nTerms-1].isPrefix = 1;
    }
    pQuery->pTerms[pQuery->nTerms-1].iPhrase = nTerm;
    if( inPhrase ){
      nTerm++;
    }
  }

  if( inPhrase && pQuery->nTerms>firstIndex ){
    pQuery->pTerms[firstIndex].nPhrase = pQuery->nTerms - firstIndex - 1;
  }

  return pModule->xClose(pCursor);
}

/* Parse a query string, yielding a Query object pQuery.
**
** The calling function will need to queryClear() to clean up
** the dynamically allocated memory held by pQuery.
*/
static int parseQuery(
  fulltext_vtab *v,        /* The fulltext index */
  const char *zInput,      /* Input text of the query string */
  int nInput,              /* Size of the input text */
  int dfltColumn,          /* Default column of the index to match against */
  Query *pQuery            /* Write the parse results here. */
){
  int iInput, inPhrase = 0;

  if( zInput==0 ) nInput = 0;
  if( nInput<0 ) nInput = strlen(zInput);
  pQuery->nTerms = 0;
  pQuery->pTerms = NULL;
  pQuery->nextIsOr = 0;
  pQuery->nextColumn = dfltColumn;
  pQuery->dfltColumn = dfltColumn;
  pQuery->pFts = v;

  for(iInput=0; iInput<nInput; ++iInput){
    int i;
    for(i=iInput; i<nInput && zInput[i]!='"'; ++i){}
    if( i>iInput ){
      tokenizeSegment(v->pTokenizer, zInput+iInput, i-iInput, inPhrase,
                       pQuery);
    }
    iInput = i;
    if( i<nInput ){
      assert( zInput[i]=='"' );
      inPhrase = !inPhrase;
    }
  }

  if( inPhrase ){
    /* unmatched quote */
    queryClear(pQuery);
    return SQLITE_ERROR;
  }
  return SQLITE_OK;
}

/* TODO(shess) Refactor the code to remove this forward decl. */
static int flushPendingTerms(fulltext_vtab *v);

/* Perform a full-text query using the search expression in
** zInput[0..nInput-1].  Return a list of matching documents
** in pResult.
**
** Queries must match column iColumn.  Or if iColumn>=nColumn
** they are allowed to match against any column.
*/
static int fulltextQuery(
  fulltext_vtab *v,      /* The full text index */
  int iColumn,           /* Match against this column by default */
  const char *zInput,    /* The query string */
  int nInput,            /* Number of bytes in zInput[] */
  DataBuffer *pResult,   /* Write the result doclist here */
  Query *pQuery          /* Put parsed query string here */
){
  int i, iNext, rc;
  DataBuffer left, right, or, new;
  int nNot = 0;
  QueryTerm *aTerm;

  /* TODO(shess) Instead of flushing pendingTerms, we could query for
  ** the relevant term and merge the doclist into what we receive from
  ** the database.  Wait and see if this is a common issue, first.
  **
  ** A good reason not to flush is to not generate update-related
  ** error codes from here.
  */

  /* Flush any buffered updates before executing the query. */
  rc = flushPendingTerms(v);
  if( rc!=SQLITE_OK ) return rc;

  /* TODO(shess) I think that the queryClear() calls below are not
  ** necessary, because fulltextClose() already clears the query.
  */
  rc = parseQuery(v, zInput, nInput, iColumn, pQuery);
  if( rc!=SQLITE_OK ) return rc;

  /* Empty or NULL queries return no results. */
  if( pQuery->nTerms==0 ){
    dataBufferInit(pResult, 0);
    return SQLITE_OK;
  }

  /* Merge AND terms. */
  /* TODO(shess) I think we can early-exit if( i>nNot && left.nData==0 ). */
  aTerm = pQuery->pTerms;
  for(i = 0; i<pQuery->nTerms; i=iNext){
    if( aTerm[i].isNot ){
      /* Handle all NOT terms in a separate pass */
      nNot++;
      iNext = i + aTerm[i].nPhrase+1;
      continue;
    }
    iNext = i + aTerm[i].nPhrase + 1;
    rc = docListOfTerm(v, aTerm[i].iColumn, &aTerm[i], &right);
    if( rc ){
      if( i!=nNot ) dataBufferDestroy(&left);
      queryClear(pQuery);
      return rc;
    }
    while( iNext<pQuery->nTerms && aTerm[iNext].isOr ){
      rc = docListOfTerm(v, aTerm[iNext].iColumn, &aTerm[iNext], &or);
      iNext += aTerm[iNext].nPhrase + 1;
      if( rc ){
        if( i!=nNot ) dataBufferDestroy(&left);
        dataBufferDestroy(&right);
        queryClear(pQuery);
        return rc;
      }
      dataBufferInit(&new, 0);
      docListOrMerge(right.pData, right.nData, or.pData, or.nData, &new);
      dataBufferDestroy(&right);
      dataBufferDestroy(&or);
      right = new;
    }
    if( i==nNot ){           /* first term processed. */
      left = right;
    }else{
      dataBufferInit(&new, 0);
      docListAndMerge(left.pData, left.nData, right.pData, right.nData, &new);
      dataBufferDestroy(&right);
      dataBufferDestroy(&left);
      left = new;
    }
  }

  if( nNot==pQuery->nTerms ){
    /* We do not yet know how to handle a query of only NOT terms */
    return SQLITE_ERROR;
  }

  /* Do the EXCEPT terms */
  for(i=0; i<pQuery->nTerms;  i += aTerm[i].nPhrase + 1){
    if( !aTerm[i].isNot ) continue;
    rc = docListOfTerm(v, aTerm[i].iColumn, &aTerm[i], &right);
    if( rc ){
      queryClear(pQuery);
      dataBufferDestroy(&left);
      return rc;
    }
    dataBufferInit(&new, 0);
    docListExceptMerge(left.pData, left.nData, right.pData, right.nData, &new);
    dataBufferDestroy(&right);
    dataBufferDestroy(&left);
    left = new;
  }

  *pResult = left;
  return rc;
}

/*
** This is the xFilter interface for the virtual table.  See
** the virtual table xFilter method documentation for additional
** information.
**
** If idxNum==QUERY_GENERIC then do a full table scan against
** the %_content table.
**
** If idxNum==QUERY_ROWID then do a rowid lookup for a single entry
** in the %_content table.
**
** If idxNum>=QUERY_FULLTEXT then use the full text index.  The
** column on the left-hand side of the MATCH operator is column
** number idxNum-QUERY_FULLTEXT, 0 indexed.  argv[0] is the right-hand
** side of the MATCH operator.
*/
/* TODO(shess) Upgrade the cursor initialization and destruction to
** account for fulltextFilter() being called multiple times on the
** same cursor.  The current solution is very fragile.  Apply fix to
** fts2 as appropriate.
*/
static int fulltextFilter(
  sqlite3_vtab_cursor *pCursor,     /* The cursor used for this query */
  int idxNum, const char *idxStr,   /* Which indexing scheme to use */
  int argc, sqlite3_value **argv    /* Arguments for the indexing scheme */
){
  fulltext_cursor *c = (fulltext_cursor *) pCursor;
  fulltext_vtab *v = cursor_vtab(c);
  int rc;
  char *zSql;

  TRACE(("FTS2 Filter %p\n",pCursor));

  zSql = sqlite3_mprintf("select rowid, * from %%_content %s",
                          idxNum==QUERY_GENERIC ? "" : "where rowid=?");
  sqlite3_finalize(c->pStmt);
  rc = sql_prepare(v->db, v->zDb, v->zName, &c->pStmt, zSql);
  sqlite3_free(zSql);
  if( rc!=SQLITE_OK ) return rc;

  c->iCursorType = idxNum;
  switch( idxNum ){
    case QUERY_GENERIC:
      break;

    case QUERY_ROWID:
      rc = sqlite3_bind_int64(c->pStmt, 1, sqlite3_value_int64(argv[0]));
      if( rc!=SQLITE_OK ) return rc;
      break;

    default:   /* full-text search */
    {
      const char *zQuery = (const char *)sqlite3_value_text(argv[0]);
      assert( idxNum<=QUERY_FULLTEXT+v->nColumn);
      assert( argc==1 );
      queryClear(&c->q);
      if( c->result.nData!=0 ){
        /* This case happens if the same cursor is used repeatedly. */
        dlrDestroy(&c->reader);
        dataBufferReset(&c->result);
      }else{
        dataBufferInit(&c->result, 0);
      }
      rc = fulltextQuery(v, idxNum-QUERY_FULLTEXT, zQuery, -1, &c->result, &c->q);
      if( rc!=SQLITE_OK ) return rc;
      if( c->result.nData!=0 ){
        dlrInit(&c->reader, DL_DOCIDS, c->result.pData, c->result.nData);
      }
      break;
    }
  }

  return fulltextNext(pCursor);
}

/* This is the xEof method of the virtual table.  The SQLite core
** calls this routine to find out if it has reached the end of
** a query's results set.
*/
static int fulltextEof(sqlite3_vtab_cursor *pCursor){
  fulltext_cursor *c = (fulltext_cursor *) pCursor;
  return c->eof;
}

/* This is the xColumn method of the virtual table.  The SQLite
** core calls this method during a query when it needs the value
** of a column from the virtual table.  This method needs to use
** one of the sqlite3_result_*() routines to store the requested
** value back in the pContext.
*/
static int fulltextColumn(sqlite3_vtab_cursor *pCursor,
                          sqlite3_context *pContext, int idxCol){
  fulltext_cursor *c = (fulltext_cursor *) pCursor;
  fulltext_vtab *v = cursor_vtab(c);

  if( idxCol<v->nColumn ){
    sqlite3_value *pVal = sqlite3_column_value(c->pStmt, idxCol+1);
    sqlite3_result_value(pContext, pVal);
  }else if( idxCol==v->nColumn ){
    /* The extra column whose name is the same as the table.
    ** Return a blob which is a pointer to the cursor
    */
    sqlite3_result_blob(pContext, &c, sizeof(c), SQLITE_TRANSIENT);
  }
  return SQLITE_OK;
}

/* This is the xRowid method.  The SQLite core calls this routine to
** retrive the rowid for the current row of the result set.  The
** rowid should be written to *pRowid.
*/
static int fulltextRowid(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){
  fulltext_cursor *c = (fulltext_cursor *) pCursor;

  *pRowid = sqlite3_column_int64(c->pStmt, 0);
  return SQLITE_OK;
}

/* Add all terms in [zText] to pendingTerms table.  If [iColumn] > 0,
** we also store positions and offsets in the hash table using that
** column number.
*/
static int buildTerms(fulltext_vtab *v, sqlite_int64 iDocid,
                      const char *zText, int iColumn){
  sqlite3_tokenizer *pTokenizer = v->pTokenizer;
  sqlite3_tokenizer_cursor *pCursor;
  const char *pToken;
  int nTokenBytes;
  int iStartOffset, iEndOffset, iPosition;
  int rc;

  rc = pTokenizer->pModule->xOpen(pTokenizer, zText, -1, &pCursor);
  if( rc!=SQLITE_OK ) return rc;

  pCursor->pTokenizer = pTokenizer;
  while( SQLITE_OK==pTokenizer->pModule->xNext(pCursor,
                                               &pToken, &nTokenBytes,
                                               &iStartOffset, &iEndOffset,
                                               &iPosition) ){
    DLCollector *p;
    int nData;                   /* Size of doclist before our update. */

    /* Positions can't be negative; we use -1 as a terminator internally. */
    if( iPosition<0 ){
      pTokenizer->pModule->xClose(pCursor);
      return SQLITE_ERROR;
    }

    p = fts2HashFind(&v->pendingTerms, pToken, nTokenBytes);
    if( p==NULL ){
      nData = 0;
      p = dlcNew(iDocid, DL_DEFAULT);
      fts2HashInsert(&v->pendingTerms, pToken, nTokenBytes, p);

      /* Overhead for our hash table entry, the key, and the value. */
      v->nPendingData += sizeof(struct fts2HashElem)+sizeof(*p)+nTokenBytes;
    }else{
      nData = p->b.nData;
      if( p->dlw.iPrevDocid!=iDocid ) dlcNext(p, iDocid);
    }
    if( iColumn>=0 ){
      dlcAddPos(p, iColumn, iPosition, iStartOffset, iEndOffset);
    }

    /* Accumulate data added by dlcNew or dlcNext, and dlcAddPos. */
    v->nPendingData += p->b.nData-nData;
  }

  /* TODO(shess) Check return?  Should this be able to cause errors at
  ** this point?  Actually, same question about sqlite3_finalize(),
  ** though one could argue that failure there means that the data is
  ** not durable.  *ponder*
  */
  pTokenizer->pModule->xClose(pCursor);
  return rc;
}

/* Add doclists for all terms in [pValues] to pendingTerms table. */
static int insertTerms(fulltext_vtab *v, sqlite_int64 iRowid,
                       sqlite3_value **pValues){
  int i;
  for(i = 0; i < v->nColumn ; ++i){
    char *zText = (char*)sqlite3_value_text(pValues[i]);
    int rc = buildTerms(v, iRowid, zText, i);
    if( rc!=SQLITE_OK ) return rc;
  }
  return SQLITE_OK;
}

/* Add empty doclists for all terms in the given row's content to
** pendingTerms.
*/
static int deleteTerms(fulltext_vtab *v, sqlite_int64 iRowid){
  const char **pValues;
  int i, rc;

  /* TODO(shess) Should we allow such tables at all? */
  if( DL_DEFAULT==DL_DOCIDS ) return SQLITE_ERROR;

  rc = content_select(v, iRowid, &pValues);
  if( rc!=SQLITE_OK ) return rc;

  for(i = 0 ; i < v->nColumn; ++i) {
    rc = buildTerms(v, iRowid, pValues[i], -1);
    if( rc!=SQLITE_OK ) break;
  }

  freeStringArray(v->nColumn, pValues);
  return SQLITE_OK;
}

/* TODO(shess) Refactor the code to remove this forward decl. */
static int initPendingTerms(fulltext_vtab *v, sqlite_int64 iDocid);

/* Insert a row into the %_content table; set *piRowid to be the ID of the
** new row.  Add doclists for terms to pendingTerms.
*/
static int index_insert(fulltext_vtab *v, sqlite3_value *pRequestRowid,
                        sqlite3_value **pValues, sqlite_int64 *piRowid){
  int rc;

  rc = content_insert(v, pRequestRowid, pValues);  /* execute an SQL INSERT */
  if( rc!=SQLITE_OK ) return rc;

  *piRowid = sqlite3_last_insert_rowid(v->db);
  rc = initPendingTerms(v, *piRowid);
  if( rc!=SQLITE_OK ) return rc;

  return insertTerms(v, *piRowid, pValues);
}

/* Delete a row from the %_content table; add empty doclists for terms
** to pendingTerms.
*/
static int index_delete(fulltext_vtab *v, sqlite_int64 iRow){
  int rc = initPendingTerms(v, iRow);
  if( rc!=SQLITE_OK ) return rc;

  rc = deleteTerms(v, iRow);
  if( rc!=SQLITE_OK ) return rc;

  return content_delete(v, iRow);  /* execute an SQL DELETE */
}

/* Update a row in the %_content table; add delete doclists to
** pendingTerms for old terms not in the new data, add insert doclists
** to pendingTerms for terms in the new data.
*/
static int index_update(fulltext_vtab *v, sqlite_int64 iRow,
                        sqlite3_value **pValues){
  int rc = initPendingTerms(v, iRow);
  if( rc!=SQLITE_OK ) return rc;

  /* Generate an empty doclist for each term that previously appeared in this
   * row. */
  rc = deleteTerms(v, iRow);
  if( rc!=SQLITE_OK ) return rc;

  rc = content_update(v, pValues, iRow);  /* execute an SQL UPDATE */
  if( rc!=SQLITE_OK ) return rc;

  /* Now add positions for terms which appear in the updated row. */
  return insertTerms(v, iRow, pValues);
}

/*******************************************************************/
/* InteriorWriter is used to collect terms and block references into
** interior nodes in %_segments.  See commentary at top of file for
** format.
*/

/* How large interior nodes can grow. */
#define INTERIOR_MAX 2048

/* Minimum number of terms per interior node (except the root). This
** prevents large terms from making the tree too skinny - must be >0
** so that the tree always makes progress.  Note that the min tree
** fanout will be INTERIOR_MIN_TERMS+1.
*/
#define INTERIOR_MIN_TERMS 7
#if INTERIOR_MIN_TERMS<1
# error INTERIOR_MIN_TERMS must be greater than 0.
#endif

/* ROOT_MAX controls how much data is stored inline in the segment
** directory.
*/
/* TODO(shess) Push ROOT_MAX down to whoever is writing things.  It's
** only here so that interiorWriterRootInfo() and leafWriterRootInfo()
** can both see it, but if the caller passed it in, we wouldn't even
** need a define.
*/
#define ROOT_MAX 1024
#if ROOT_MAX<VARINT_MAX*2
# error ROOT_MAX must have enough space for a header.
#endif

/* InteriorBlock stores a linked-list of interior blocks while a lower
** layer is being constructed.
*/
typedef struct InteriorBlock {
  DataBuffer term;           /* Leftmost term in block's subtree. */
  DataBuffer data;           /* Accumulated data for the block. */
  struct InteriorBlock *next;
} InteriorBlock;

static InteriorBlock *interiorBlockNew(int iHeight, sqlite_int64 iChildBlock,
                                       const char *pTerm, int nTerm){
  InteriorBlock *block = calloc(1, sizeof(InteriorBlock));
  char c[VARINT_MAX+VARINT_MAX];
  int n;

  dataBufferInit(&block->term, 0);
  dataBufferReplace(&block->term, pTerm, nTerm);

  n = putVarint(c, iHeight);
  n += putVarint(c+n, iChildBlock);
  dataBufferInit(&block->data, INTERIOR_MAX);
  dataBufferReplace(&block->data, c, n);

  return block;
}

#ifndef NDEBUG
/* Verify that the data is readable as an interior node. */
static void interiorBlockValidate(InteriorBlock *pBlock){
  const char *pData = pBlock->data.pData;
  int nData = pBlock->data.nData;
  int n, iDummy;
  sqlite_int64 iBlockid;

  assert( nData>0 );
  assert( pData!=0 );
  assert( pData+nData>pData );

  /* Must lead with height of node as a varint(n), n>0 */
  n = getVarint32(pData, &iDummy);
  assert( n>0 );
  assert( iDummy>0 );
  assert( n<nData );
  pData += n;
  nData -= n;

  /* Must contain iBlockid. */
  n = getVarint(pData, &iBlockid);
  assert( n>0 );
  assert( n<=nData );
  pData += n;
  nData -= n;

  /* Zero or more terms of positive length */
  if( nData!=0 ){
    /* First term is not delta-encoded. */
    n = getVarint32(pData, &iDummy);
    assert( n>0 );
    assert( iDummy>0 );
    assert( n+iDummy>0);
    assert( n+iDummy<=nData );
    pData += n+iDummy;
    nData -= n+iDummy;

    /* Following terms delta-encoded. */
    while( nData!=0 ){
      /* Length of shared prefix. */
      n = getVarint32(pData, &iDummy);
      assert( n>0 );
      assert( iDummy>=0 );
      assert( n<nData );
      pData += n;
      nData -= n;

      /* Length and data of distinct suffix. */
      n = getVarint32(pData, &iDummy);
      assert( n>0 );
      assert( iDummy>0 );
      assert( n+iDummy>0);
      assert( n+iDummy<=nData );
      pData += n+iDummy;
      nData -= n+iDummy;
    }
  }
}
#define ASSERT_VALID_INTERIOR_BLOCK(x) interiorBlockValidate(x)
#else
#define ASSERT_VALID_INTERIOR_BLOCK(x) assert( 1 )
#endif

typedef struct InteriorWriter {
  int iHeight;                   /* from 0 at leaves. */
  InteriorBlock *first, *last;
  struct InteriorWriter *parentWriter;

  DataBuffer term;               /* Last term written to block "last". */
  sqlite_int64 iOpeningChildBlock; /* First child block in block "last". */
#ifndef NDEBUG
  sqlite_int64 iLastChildBlock;  /* for consistency checks. */
#endif
} InteriorWriter;

/* Initialize an interior node where pTerm[nTerm] marks the leftmost
** term in the tree.  iChildBlock is the leftmost child block at the
** next level down the tree.
*/
static void interiorWriterInit(int iHeight, const char *pTerm, int nTerm,
                               sqlite_int64 iChildBlock,
                               InteriorWriter *pWriter){
  InteriorBlock *block;
  assert( iHeight>0 );
  CLEAR(pWriter);

  pWriter->iHeight = iHeight;
  pWriter->iOpeningChildBlock = iChildBlock;
#ifndef NDEBUG
  pWriter->iLastChildBlock = iChildBlock;
#endif
  block = interiorBlockNew(iHeight, iChildBlock, pTerm, nTerm);
  pWriter->last = pWriter->first = block;
  ASSERT_VALID_INTERIOR_BLOCK(pWriter->last);
  dataBufferInit(&pWriter->term, 0);
}

/* Append the child node rooted at iChildBlock to the interior node,
** with pTerm[nTerm] as the leftmost term in iChildBlock's subtree.
*/
static void interiorWriterAppend(InteriorWriter *pWriter,
                                 const char *pTerm, int nTerm,
                                 sqlite_int64 iChildBlock){
  char c[VARINT_MAX+VARINT_MAX];
  int n, nPrefix = 0;

  ASSERT_VALID_INTERIOR_BLOCK(pWriter->last);

  /* The first term written into an interior node is actually
  ** associated with the second child added (the first child was added
  ** in interiorWriterInit, or in the if clause at the bottom of this
  ** function).  That term gets encoded straight up, with nPrefix left
  ** at 0.
  */
  if( pWriter->term.nData==0 ){
    n = putVarint(c, nTerm);
  }else{
    while( nPrefix<pWriter->term.nData &&
           pTerm[nPrefix]==pWriter->term.pData[nPrefix] ){
      nPrefix++;
    }

    n = putVarint(c, nPrefix);
    n += putVarint(c+n, nTerm-nPrefix);
  }

#ifndef NDEBUG
  pWriter->iLastChildBlock++;
#endif
  assert( pWriter->iLastChildBlock==iChildBlock );

  /* Overflow to a new block if the new term makes the current block
  ** too big, and the current block already has enough terms.
  */
  if( pWriter->last->data.nData+n+nTerm-nPrefix>INTERIOR_MAX &&
      iChildBlock-pWriter->iOpeningChildBlock>INTERIOR_MIN_TERMS ){
    pWriter->last->next = interiorBlockNew(pWriter->iHeight, iChildBlock,
                                           pTerm, nTerm);
    pWriter->last = pWriter->last->next;
    pWriter->iOpeningChildBlock = iChildBlock;
    dataBufferReset(&pWriter->term);
  }else{
    dataBufferAppend2(&pWriter->last->data, c, n,
                      pTerm+nPrefix, nTerm-nPrefix);
    dataBufferReplace(&pWriter->term, pTerm, nTerm);
  }
  ASSERT_VALID_INTERIOR_BLOCK(pWriter->last);
}

/* Free the space used by pWriter, including the linked-list of
** InteriorBlocks, and parentWriter, if present.
*/
static int interiorWriterDestroy(InteriorWriter *pWriter){
  InteriorBlock *block = pWriter->first;

  while( block!=NULL ){
    InteriorBlock *b = block;
    block = block->next;
    dataBufferDestroy(&b->term);
    dataBufferDestroy(&b->data);
    free(b);
  }
  if( pWriter->parentWriter!=NULL ){
    interiorWriterDestroy(pWriter->parentWriter);
    free(pWriter->parentWriter);
  }
  dataBufferDestroy(&pWriter->term);
  SCRAMBLE(pWriter);
  return SQLITE_OK;
}

/* If pWriter can fit entirely in ROOT_MAX, return it as the root info
** directly, leaving *piEndBlockid unchanged.  Otherwise, flush
** pWriter to %_segments, building a new layer of interior nodes, and
** recursively ask for their root into.
*/
static int interiorWriterRootInfo(fulltext_vtab *v, InteriorWriter *pWriter,
                                  char **ppRootInfo, int *pnRootInfo,
                                  sqlite_int64 *piEndBlockid){
  InteriorBlock *block = pWriter->first;
  sqlite_int64 iBlockid = 0;
  int rc;

  /* If we can fit the segment inline */
  if( block==pWriter->last && block->data.nData<ROOT_MAX ){
    *ppRootInfo = block->data.pData;
    *pnRootInfo = block->data.nData;
    return SQLITE_OK;
  }

  /* Flush the first block to %_segments, and create a new level of
  ** interior node.
  */
  ASSERT_VALID_INTERIOR_BLOCK(block);
  rc = block_insert(v, block->data.pData, block->data.nData, &iBlockid);
  if( rc!=SQLITE_OK ) return rc;
  *piEndBlockid = iBlockid;

  pWriter->parentWriter = malloc(sizeof(*pWriter->parentWriter));
  interiorWriterInit(pWriter->iHeight+1,
                     block->term.pData, block->term.nData,
                     iBlockid, pWriter->parentWriter);

  /* Flush additional blocks and append to the higher interior
  ** node.
  */
  for(block=block->next; block!=NULL; block=block->next){
    ASSERT_VALID_INTERIOR_BLOCK(block);
    rc = block_insert(v, block->data.pData, block->data.nData, &iBlockid);
    if( rc!=SQLITE_OK ) return rc;
    *piEndBlockid = iBlockid;

    interiorWriterAppend(pWriter->parentWriter,
                         block->term.pData, block->term.nData, iBlockid);
  }

  /* Parent node gets the chance to be the root. */
  return interiorWriterRootInfo(v, pWriter->parentWriter,
                                ppRootInfo, pnRootInfo, piEndBlockid);
}

/****************************************************************/
/* InteriorReader is used to read off the data from an interior node
** (see comment at top of file for the format).
*/
typedef struct InteriorReader {
  const char *pData;
  int nData;

  DataBuffer term;          /* previous term, for decoding term delta. */

  sqlite_int64 iBlockid;
} InteriorReader;

static void interiorReaderDestroy(InteriorReader *pReader){
  dataBufferDestroy(&pReader->term);
  SCRAMBLE(pReader);
}

/* TODO(shess) The assertions are great, but what if we're in NDEBUG
** and the blob is empty or otherwise contains suspect data?
*/
static void interiorReaderInit(const char *pData, int nData,
                               InteriorReader *pReader){
  int n, nTerm;

  /* Require at least the leading flag byte */
  assert( nData>0 );
  assert( pData[0]!='\0' );

  CLEAR(pReader);

  /* Decode the base blockid, and set the cursor to the first term. */
  n = getVarint(pData+1, &pReader->iBlockid);
  assert( 1+n<=nData );
  pReader->pData = pData+1+n;
  pReader->nData = nData-(1+n);

  /* A single-child interior node (such as when a leaf node was too
  ** large for the segment directory) won't have any terms.
  ** Otherwise, decode the first term.
  */
  if( pReader->nData==0 ){
    dataBufferInit(&pReader->term, 0);
  }else{
    n = getVarint32(pReader->pData, &nTerm);
    dataBufferInit(&pReader->term, nTerm);
    dataBufferReplace(&pReader->term, pReader->pData+n, nTerm);
    assert( n+nTerm<=pReader->nData );
    pReader->pData += n+nTerm;
    pReader->nData -= n+nTerm;
  }
}

static int interiorReaderAtEnd(InteriorReader *pReader){
  return pReader->term.nData==0;
}

static sqlite_int64 interiorReaderCurrentBlockid(InteriorReader *pReader){
  return pReader->iBlockid;
}

static int interiorReaderTermBytes(InteriorReader *pReader){
  assert( !interiorReaderAtEnd(pReader) );
  return pReader->term.nData;
}
static const char *interiorReaderTerm(InteriorReader *pReader){
  assert( !interiorReaderAtEnd(pReader) );
  return pReader->term.pData;
}

/* Step forward to the next term in the node. */
static void interiorReaderStep(InteriorReader *pReader){
  assert( !interiorReaderAtEnd(pReader) );

  /* If the last term has been read, signal eof, else construct the
  ** next term.
  */
  if( pReader->nData==0 ){
    dataBufferReset(&pReader->term);
  }else{
    int n, nPrefix, nSuffix;

    n = getVarint32(pReader->pData, &nPrefix);
    n += getVarint32(pReader->pData+n, &nSuffix);

    /* Truncate the current term and append suffix data. */
    pReader->term.nData = nPrefix;
    dataBufferAppend(&pReader->term, pReader->pData+n, nSuffix);

    assert( n+nSuffix<=pReader->nData );
    pReader->pData += n+nSuffix;
    pReader->nData -= n+nSuffix;
  }
  pReader->iBlockid++;
}

/* Compare the current term to pTerm[nTerm], returning strcmp-style
** results.  If isPrefix, equality means equal through nTerm bytes.
*/
static int interiorReaderTermCmp(InteriorReader *pReader,
                                 const char *pTerm, int nTerm, int isPrefix){
  const char *pReaderTerm = interiorReaderTerm(pReader);
  int nReaderTerm = interiorReaderTermBytes(pReader);
  int c, n = nReaderTerm<nTerm ? nReaderTerm : nTerm;

  if( n==0 ){
    if( nReaderTerm>0 ) return -1;
    if( nTerm>0 ) return 1;
    return 0;
  }

  c = memcmp(pReaderTerm, pTerm, n);
  if( c!=0 ) return c;
  if( isPrefix && n==nTerm ) return 0;
  return nReaderTerm - nTerm;
}

/****************************************************************/
/* LeafWriter is used to collect terms and associated doclist data
** into leaf blocks in %_segments (see top of file for format info).
** Expected usage is:
**
** LeafWriter writer;
** leafWriterInit(0, 0, &writer);
** while( sorted_terms_left_to_process ){
**   // data is doclist data for that term.
**   rc = leafWriterStep(v, &writer, pTerm, nTerm, pData, nData);
**   if( rc!=SQLITE_OK ) goto err;
** }
** rc = leafWriterFinalize(v, &writer);
**err:
** leafWriterDestroy(&writer);
** return rc;
**
** leafWriterStep() may write a collected leaf out to %_segments.
** leafWriterFinalize() finishes writing any buffered data and stores
** a root node in %_segdir.  leafWriterDestroy() frees all buffers and
** InteriorWriters allocated as part of writing this segment.
**
** TODO(shess) Document leafWriterStepMerge().
*/

/* Put terms with data this big in their own block. */
#define STANDALONE_MIN 1024

/* Keep leaf blocks below this size. */
#define LEAF_MAX 2048

typedef struct LeafWriter {
  int iLevel;
  int idx;
  sqlite_int64 iStartBlockid;     /* needed to create the root info */
  sqlite_int64 iEndBlockid;       /* when we're done writing. */

  DataBuffer term;                /* previous encoded term */
  DataBuffer data;                /* encoding buffer */

  /* bytes of first term in the current node which distinguishes that
  ** term from the last term of the previous node.
  */
  int nTermDistinct;

  InteriorWriter parentWriter;    /* if we overflow */
  int has_parent;
} LeafWriter;

static void leafWriterInit(int iLevel, int idx, LeafWriter *pWriter){
  CLEAR(pWriter);
  pWriter->iLevel = iLevel;
  pWriter->idx = idx;

  dataBufferInit(&pWriter->term, 32);

  /* Start out with a reasonably sized block, though it can grow. */
  dataBufferInit(&pWriter->data, LEAF_MAX);
}

#ifndef NDEBUG
/* Verify that the data is readable as a leaf node. */
static void leafNodeValidate(const char *pData, int nData){
  int n, iDummy;

  if( nData==0 ) return;
  assert( nData>0 );
  assert( pData!=0 );
  assert( pData+nData>pData );

  /* Must lead with a varint(0) */
  n = getVarint32(pData, &iDummy);
  assert( iDummy==0 );
  assert( n>0 );
  assert( n<nData );
  pData += n;
  nData -= n;

  /* Leading term length and data must fit in buffer. */
  n = getVarint32(pData, &iDummy);
  assert( n>0 );
  assert( iDummy>0 );
  assert( n+iDummy>0 );
  assert( n+iDummy<nData );
  pData += n+iDummy;
  nData -= n+iDummy;

  /* Leading term's doclist length and data must fit. */
  n = getVarint32(pData, &iDummy);
  assert( n>0 );
  assert( iDummy>0 );
  assert( n+iDummy>0 );
  assert( n+iDummy<=nData );
  ASSERT_VALID_DOCLIST(DL_DEFAULT, pData+n, iDummy, NULL);
  pData += n+iDummy;
  nData -= n+iDummy;

  /* Verify that trailing terms and doclists also are readable. */
  while( nData!=0 ){
    n = getVarint32(pData, &iDummy);
    assert( n>0 );
    assert( iDummy>=0 );
    assert( n<nData );
    pData += n;
    nData -= n;
    n = getVarint32(pData, &iDummy);
    assert( n>0 );
    assert( iDummy>0 );
    assert( n+iDummy>0 );
    assert( n+iDummy<nData );
    pData += n+iDummy;
    nData -= n+iDummy;

    n = getVarint32(pData, &iDummy);
    assert( n>0 );
    assert( iDummy>0 );
    assert( n+iDummy>0 );
    assert( n+iDummy<=nData );
    ASSERT_VALID_DOCLIST(DL_DEFAULT, pData+n, iDummy, NULL);
    pData += n+iDummy;
    nData -= n+iDummy;
  }
}
#define ASSERT_VALID_LEAF_NODE(p, n) leafNodeValidate(p, n)
#else
#define ASSERT_VALID_LEAF_NODE(p, n) assert( 1 )
#endif

/* Flush the current leaf node to %_segments, and adding the resulting
** blockid and the starting term to the interior node which will
** contain it.
*/
static int leafWriterInternalFlush(fulltext_vtab *v, LeafWriter *pWriter,
                                   int iData, int nData){
  sqlite_int64 iBlockid = 0;
  const char *pStartingTerm;
  int nStartingTerm, rc, n;

  /* Must have the leading varint(0) flag, plus at least some
  ** valid-looking data.
  */
  assert( nData>2 );
  assert( iData>=0 );
  assert( iData+nData<=pWriter->data.nData );
  ASSERT_VALID_LEAF_NODE(pWriter->data.pData+iData, nData);

  rc = block_insert(v, pWriter->data.pData+iData, nData, &iBlockid);
  if( rc!=SQLITE_OK ) return rc;
  assert( iBlockid!=0 );

  /* Reconstruct the first term in the leaf for purposes of building
  ** the interior node.
  */
  n = getVarint32(pWriter->data.pData+iData+1, &nStartingTerm);
  pStartingTerm = pWriter->data.pData+iData+1+n;
  assert( pWriter->data.nData>iData+1+n+nStartingTerm );
  assert( pWriter->nTermDistinct>0 );
  assert( pWriter->nTermDistinct<=nStartingTerm );
  nStartingTerm = pWriter->nTermDistinct;

  if( pWriter->has_parent ){
    interiorWriterAppend(&pWriter->parentWriter,
                         pStartingTerm, nStartingTerm, iBlockid);
  }else{
    interiorWriterInit(1, pStartingTerm, nStartingTerm, iBlockid,
                       &pWriter->parentWriter);
    pWriter->has_parent = 1;
  }

  /* Track the span of this segment's leaf nodes. */
  if( pWriter->iEndBlockid==0 ){
    pWriter->iEndBlockid = pWriter->iStartBlockid = iBlockid;
  }else{
    pWriter->iEndBlockid++;
    assert( iBlockid==pWriter->iEndBlockid );
  }

  return SQLITE_OK;
}
static int leafWriterFlush(fulltext_vtab *v, LeafWriter *pWriter){
  int rc = leafWriterInternalFlush(v, pWriter, 0, pWriter->data.nData);
  if( rc!=SQLITE_OK ) return rc;

  /* Re-initialize the output buffer. */
  dataBufferReset(&pWriter->data);

  return SQLITE_OK;
}

/* Fetch the root info for the segment.  If the entire leaf fits
** within ROOT_MAX, then it will be returned directly, otherwise it
** will be flushed and the root info will be returned from the
** interior node.  *piEndBlockid is set to the blockid of the last
** interior or leaf node written to disk (0 if none are written at
** all).
*/
static int leafWriterRootInfo(fulltext_vtab *v, LeafWriter *pWriter,
                              char **ppRootInfo, int *pnRootInfo,
                              sqlite_int64 *piEndBlockid){
  /* we can fit the segment entirely inline */
  if( !pWriter->has_parent && pWriter->data.nData<ROOT_MAX ){
    *ppRootInfo = pWriter->data.pData;
    *pnRootInfo = pWriter->data.nData;
    *piEndBlockid = 0;
    return SQLITE_OK;
  }

  /* Flush remaining leaf data. */
  if( pWriter->data.nData>0 ){
    int rc = leafWriterFlush(v, pWriter);
    if( rc!=SQLITE_OK ) return rc;
  }

  /* We must have flushed a leaf at some point. */
  assert( pWriter->has_parent );

  /* Tenatively set the end leaf blockid as the end blockid.  If the
  ** interior node can be returned inline, this will be the final
  ** blockid, otherwise it will be overwritten by
  ** interiorWriterRootInfo().
  */
  *piEndBlockid = pWriter->iEndBlockid;

  return interiorWriterRootInfo(v, &pWriter->parentWriter,
                                ppRootInfo, pnRootInfo, piEndBlockid);
}

/* Collect the rootInfo data and store it into the segment directory.
** This has the effect of flushing the segment's leaf data to
** %_segments, and also flushing any interior nodes to %_segments.
*/
static int leafWriterFinalize(fulltext_vtab *v, LeafWriter *pWriter){
  sqlite_int64 iEndBlockid;
  char *pRootInfo;
  int rc, nRootInfo;

  rc = leafWriterRootInfo(v, pWriter, &pRootInfo, &nRootInfo, &iEndBlockid);
  if( rc!=SQLITE_OK ) return rc;

  /* Don't bother storing an entirely empty segment. */
  if( iEndBlockid==0 && nRootInfo==0 ) return SQLITE_OK;

  return segdir_set(v, pWriter->iLevel, pWriter->idx,
                    pWriter->iStartBlockid, pWriter->iEndBlockid,
                    iEndBlockid, pRootInfo, nRootInfo);
}

static void leafWriterDestroy(LeafWriter *pWriter){
  if( pWriter->has_parent ) interiorWriterDestroy(&pWriter->parentWriter);
  dataBufferDestroy(&pWriter->term);
  dataBufferDestroy(&pWriter->data);
}

/* Encode a term into the leafWriter, delta-encoding as appropriate.
** Returns the length of the new term which distinguishes it from the
** previous term, which can be used to set nTermDistinct when a node
** boundary is crossed.
*/
static int leafWriterEncodeTerm(LeafWriter *pWriter,
                                const char *pTerm, int nTerm){
  char c[VARINT_MAX+VARINT_MAX];
  int n, nPrefix = 0;

  assert( nTerm>0 );
  while( nPrefix<pWriter->term.nData &&
         pTerm[nPrefix]==pWriter->term.pData[nPrefix] ){
    nPrefix++;
    /* Failing this implies that the terms weren't in order. */
    assert( nPrefix<nTerm );
  }

  if( pWriter->data.nData==0 ){
    /* Encode the node header and leading term as:
    **  varint(0)
    **  varint(nTerm)
    **  char pTerm[nTerm]
    */
    n = putVarint(c, '\0');
    n += putVarint(c+n, nTerm);
    dataBufferAppend2(&pWriter->data, c, n, pTerm, nTerm);
  }else{
    /* Delta-encode the term as:
    **  varint(nPrefix)
    **  varint(nSuffix)
    **  char pTermSuffix[nSuffix]
    */
    n = putVarint(c, nPrefix);
    n += putVarint(c+n, nTerm-nPrefix);
    dataBufferAppend2(&pWriter->data, c, n, pTerm+nPrefix, nTerm-nPrefix);
  }
  dataBufferReplace(&pWriter->term, pTerm, nTerm);

  return nPrefix+1;
}

/* Used to avoid a memmove when a large amount of doclist data is in
** the buffer.  This constructs a node and term header before
** iDoclistData and flushes the resulting complete node using
** leafWriterInternalFlush().
*/
static int leafWriterInlineFlush(fulltext_vtab *v, LeafWriter *pWriter,
                                 const char *pTerm, int nTerm,
                                 int iDoclistData){
  char c[VARINT_MAX+VARINT_MAX];
  int iData, n = putVarint(c, 0);
  n += putVarint(c+n, nTerm);

  /* There should always be room for the header.  Even if pTerm shared
  ** a substantial prefix with the previous term, the entire prefix
  ** could be constructed from earlier data in the doclist, so there
  ** should be room.
  */
  assert( iDoclistData>=n+nTerm );

  iData = iDoclistData-(n+nTerm);
  memcpy(pWriter->data.pData+iData, c, n);
  memcpy(pWriter->data.pData+iData+n, pTerm, nTerm);

  return leafWriterInternalFlush(v, pWriter, iData, pWriter->data.nData-iData);
}

/* Push pTerm[nTerm] along with the doclist data to the leaf layer of
** %_segments.
*/
static int leafWriterStepMerge(fulltext_vtab *v, LeafWriter *pWriter,
                               const char *pTerm, int nTerm,
                               DLReader *pReaders, int nReaders){
  char c[VARINT_MAX+VARINT_MAX];
  int iTermData = pWriter->data.nData, iDoclistData;
  int i, nData, n, nActualData, nActual, rc, nTermDistinct;

  ASSERT_VALID_LEAF_NODE(pWriter->data.pData, pWriter->data.nData);
  nTermDistinct = leafWriterEncodeTerm(pWriter, pTerm, nTerm);

  /* Remember nTermDistinct if opening a new node. */
  if( iTermData==0 ) pWriter->nTermDistinct = nTermDistinct;

  iDoclistData = pWriter->data.nData;

  /* Estimate the length of the merged doclist so we can leave space
  ** to encode it.
  */
  for(i=0, nData=0; i<nReaders; i++){
    nData += dlrAllDataBytes(&pReaders[i]);
  }
  n = putVarint(c, nData);
  dataBufferAppend(&pWriter->data, c, n);

  docListMerge(&pWriter->data, pReaders, nReaders);
  ASSERT_VALID_DOCLIST(DL_DEFAULT,
                       pWriter->data.pData+iDoclistData+n,
                       pWriter->data.nData-iDoclistData-n, NULL);

  /* The actual amount of doclist data at this point could be smaller
  ** than the length we encoded.  Additionally, the space required to
  ** encode this length could be smaller.  For small doclists, this is
  ** not a big deal, we can just use memmove() to adjust things.
  */
  nActualData = pWriter->data.nData-(iDoclistData+n);
  nActual = putVarint(c, nActualData);
  assert( nActualData<=nData );
  assert( nActual<=n );

  /* If the new doclist is big enough for force a standalone leaf
  ** node, we can immediately flush it inline without doing the
  ** memmove().
  */
  /* TODO(shess) This test matches leafWriterStep(), which does this
  ** test before it knows the cost to varint-encode the term and
  ** doclist lengths.  At some point, change to
  ** pWriter->data.nData-iTermData>STANDALONE_MIN.
  */
  if( nTerm+nActualData>STANDALONE_MIN ){
    /* Push leaf node from before this term. */
    if( iTermData>0 ){
      rc = leafWriterInternalFlush(v, pWriter, 0, iTermData);
      if( rc!=SQLITE_OK ) return rc;

      pWriter->nTermDistinct = nTermDistinct;
    }

    /* Fix the encoded doclist length. */
    iDoclistData += n - nActual;
    memcpy(pWriter->data.pData+iDoclistData, c, nActual);

    /* Push the standalone leaf node. */
    rc = leafWriterInlineFlush(v, pWriter, pTerm, nTerm, iDoclistData);
    if( rc!=SQLITE_OK ) return rc;

    /* Leave the node empty. */
    dataBufferReset(&pWriter->data);

    return rc;
  }

  /* At this point, we know that the doclist was small, so do the
  ** memmove if indicated.
  */
  if( nActual<n ){
    memmove(pWriter->data.pData+iDoclistData+nActual,
            pWriter->data.pData+iDoclistData+n,
            pWriter->data.nData-(iDoclistData+n));
    pWriter->data.nData -= n-nActual;
  }

  /* Replace written length with actual length. */
  memcpy(pWriter->data.pData+iDoclistData, c, nActual);

  /* If the node is too large, break things up. */
  /* TODO(shess) This test matches leafWriterStep(), which does this
  ** test before it knows the cost to varint-encode the term and
  ** doclist lengths.  At some point, change to
  ** pWriter->data.nData>LEAF_MAX.
  */
  if( iTermData+nTerm+nActualData>LEAF_MAX ){
    /* Flush out the leading data as a node */
    rc = leafWriterInternalFlush(v, pWriter, 0, iTermData);
    if( rc!=SQLITE_OK ) return rc;

    pWriter->nTermDistinct = nTermDistinct;

    /* Rebuild header using the current term */
    n = putVarint(pWriter->data.pData, 0);
    n += putVarint(pWriter->data.pData+n, nTerm);
    memcpy(pWriter->data.pData+n, pTerm, nTerm);
    n += nTerm;

    /* There should always be room, because the previous encoding
    ** included all data necessary to construct the term.
    */
    assert( n<iDoclistData );
    /* So long as STANDALONE_MIN is half or less of LEAF_MAX, the
    ** following memcpy() is safe (as opposed to needing a memmove).
    */
    assert( 2*STANDALONE_MIN<=LEAF_MAX );
    assert( n+pWriter->data.nData-iDoclistData<iDoclistData );
    memcpy(pWriter->data.pData+n,
           pWriter->data.pData+iDoclistData,
           pWriter->data.nData-iDoclistData);
    pWriter->data.nData -= iDoclistData-n;
  }
  ASSERT_VALID_LEAF_NODE(pWriter->data.pData, pWriter->data.nData);

  return SQLITE_OK;
}

/* Push pTerm[nTerm] along with the doclist data to the leaf layer of
** %_segments.
*/
/* TODO(shess) Revise writeZeroSegment() so that doclists are
** constructed directly in pWriter->data.
*/
static int leafWriterStep(fulltext_vtab *v, LeafWriter *pWriter,
                          const char *pTerm, int nTerm,
                          const char *pData, int nData){
  int rc;
  DLReader reader;

  dlrInit(&reader, DL_DEFAULT, pData, nData);
  rc = leafWriterStepMerge(v, pWriter, pTerm, nTerm, &reader, 1);
  dlrDestroy(&reader);

  return rc;
}


/****************************************************************/
/* LeafReader is used to iterate over an individual leaf node. */
typedef struct LeafReader {
  DataBuffer term;          /* copy of current term. */

  const char *pData;        /* data for current term. */
  int nData;
} LeafReader;

static void leafReaderDestroy(LeafReader *pReader){
  dataBufferDestroy(&pReader->term);
  SCRAMBLE(pReader);
}

static int leafReaderAtEnd(LeafReader *pReader){
  return pReader->nData<=0;
}

/* Access the current term. */
static int leafReaderTermBytes(LeafReader *pReader){
  return pReader->term.nData;
}
static const char *leafReaderTerm(LeafReader *pReader){
  assert( pReader->term.nData>0 );
  return pReader->term.pData;
}

/* Access the doclist data for the current term. */
static int leafReaderDataBytes(LeafReader *pReader){
  int nData;
  assert( pReader->term.nData>0 );
  getVarint32(pReader->pData, &nData);
  return nData;
}
static const char *leafReaderData(LeafReader *pReader){
  int n, nData;
  assert( pReader->term.nData>0 );
  n = getVarint32(pReader->pData, &nData);
  return pReader->pData+n;
}

static void leafReaderInit(const char *pData, int nData,
                           LeafReader *pReader){
  int nTerm, n;

  assert( nData>0 );
  assert( pData[0]=='\0' );

  CLEAR(pReader);

  /* Read the first term, skipping the header byte. */
  n = getVarint32(pData+1, &nTerm);
  dataBufferInit(&pReader->term, nTerm);
  dataBufferReplace(&pReader->term, pData+1+n, nTerm);

  /* Position after the first term. */
  assert( 1+n+nTerm<nData );
  pReader->pData = pData+1+n+nTerm;
  pReader->nData = nData-1-n-nTerm;
}

/* Step the reader forward to the next term. */
static void leafReaderStep(LeafReader *pReader){
  int n, nData, nPrefix, nSuffix;
  assert( !leafReaderAtEnd(pReader) );

  /* Skip previous entry's data block. */
  n = getVarint32(pReader->pData, &nData);
  assert( n+nData<=pReader->nData );
  pReader->pData += n+nData;
  pReader->nData -= n+nData;

  if( !leafReaderAtEnd(pReader) ){
    /* Construct the new term using a prefix from the old term plus a
    ** suffix from the leaf data.
    */
    n = getVarint32(pReader->pData, &nPrefix);
    n += getVarint32(pReader->pData+n, &nSuffix);
    assert( n+nSuffix<pReader->nData );
    pReader->term.nData = nPrefix;
    dataBufferAppend(&pReader->term, pReader->pData+n, nSuffix);

    pReader->pData += n+nSuffix;
    pReader->nData -= n+nSuffix;
  }
}

/* strcmp-style comparison of pReader's current term against pTerm.
** If isPrefix, equality means equal through nTerm bytes.
*/
static int leafReaderTermCmp(LeafReader *pReader,
                             const char *pTerm, int nTerm, int isPrefix){
  int c, n = pReader->term.nData<nTerm ? pReader->term.nData : nTerm;
  if( n==0 ){
    if( pReader->term.nData>0 ) return -1;
    if(nTerm>0 ) return 1;
    return 0;
  }

  c = memcmp(pReader->term.pData, pTerm, n);
  if( c!=0 ) return c;
  if( isPrefix && n==nTerm ) return 0;
  return pReader->term.nData - nTerm;
}


/****************************************************************/
/* LeavesReader wraps LeafReader to allow iterating over the entire
** leaf layer of the tree.
*/
typedef struct LeavesReader {
  int idx;                  /* Index within the segment. */

  sqlite3_stmt *pStmt;      /* Statement we're streaming leaves from. */
  int eof;                  /* we've seen SQLITE_DONE from pStmt. */

  LeafReader leafReader;    /* reader for the current leaf. */
  DataBuffer rootData;      /* root data for inline. */
} LeavesReader;

/* Access the current term. */
static int leavesReaderTermBytes(LeavesReader *pReader){
  assert( !pReader->eof );
  return leafReaderTermBytes(&pReader->leafReader);
}
static const char *leavesReaderTerm(LeavesReader *pReader){
  assert( !pReader->eof );
  return leafReaderTerm(&pReader->leafReader);
}

/* Access the doclist data for the current term. */
static int leavesReaderDataBytes(LeavesReader *pReader){
  assert( !pReader->eof );
  return leafReaderDataBytes(&pReader->leafReader);
}
static const char *leavesReaderData(LeavesReader *pReader){
  assert( !pReader->eof );
  return leafReaderData(&pReader->leafReader);
}

static int leavesReaderAtEnd(LeavesReader *pReader){
  return pReader->eof;
}

/* loadSegmentLeaves() may not read all the way to SQLITE_DONE, thus
** leaving the statement handle open, which locks the table.
*/
/* TODO(shess) This "solution" is not satisfactory.  Really, there
** should be check-in function for all statement handles which
** arranges to call sqlite3_reset().  This most likely will require
** modification to control flow all over the place, though, so for now
** just punt.
**
** Note the the current system assumes that segment merges will run to
** completion, which is why this particular probably hasn't arisen in
** this case.  Probably a brittle assumption.
*/
static int leavesReaderReset(LeavesReader *pReader){
  return sqlite3_reset(pReader->pStmt);
}

static void leavesReaderDestroy(LeavesReader *pReader){
  leafReaderDestroy(&pReader->leafReader);
  dataBufferDestroy(&pReader->rootData);
  SCRAMBLE(pReader);
}

/* Initialize pReader with the given root data (if iStartBlockid==0
** the leaf data was entirely contained in the root), or from the
** stream of blocks between iStartBlockid and iEndBlockid, inclusive.
*/
static int leavesReaderInit(fulltext_vtab *v,
                            int idx,
                            sqlite_int64 iStartBlockid,
                            sqlite_int64 iEndBlockid,
                            const char *pRootData, int nRootData,
                            LeavesReader *pReader){
  CLEAR(pReader);
  pReader->idx = idx;

  dataBufferInit(&pReader->rootData, 0);
  if( iStartBlockid==0 ){
    /* Entire leaf level fit in root data. */
    dataBufferReplace(&pReader->rootData, pRootData, nRootData);
    leafReaderInit(pReader->rootData.pData, pReader->rootData.nData,
                   &pReader->leafReader);
  }else{
    sqlite3_stmt *s;
    int rc = sql_get_leaf_statement(v, idx, &s);
    if( rc!=SQLITE_OK ) return rc;

    rc = sqlite3_bind_int64(s, 1, iStartBlockid);
    if( rc!=SQLITE_OK ) return rc;

    rc = sqlite3_bind_int64(s, 2, iEndBlockid);
    if( rc!=SQLITE_OK ) return rc;

    rc = sqlite3_step(s);
    if( rc==SQLITE_DONE ){
      pReader->eof = 1;
      return SQLITE_OK;
    }
    if( rc!=SQLITE_ROW ) return rc;

    pReader->pStmt = s;
    leafReaderInit(sqlite3_column_blob(pReader->pStmt, 0),
                   sqlite3_column_bytes(pReader->pStmt, 0),
                   &pReader->leafReader);
  }
  return SQLITE_OK;
}

/* Step the current leaf forward to the next term.  If we reach the
** end of the current leaf, step forward to the next leaf block.
*/
static int leavesReaderStep(fulltext_vtab *v, LeavesReader *pReader){
  assert( !leavesReaderAtEnd(pReader) );
  leafReaderStep(&pReader->leafReader);

  if( leafReaderAtEnd(&pReader->leafReader) ){
    int rc;
    if( pReader->rootData.pData ){
      pReader->eof = 1;
      return SQLITE_OK;
    }
    rc = sqlite3_step(pReader->pStmt);
    if( rc!=SQLITE_ROW ){
      pReader->eof = 1;
      return rc==SQLITE_DONE ? SQLITE_OK : rc;
    }
    leafReaderDestroy(&pReader->leafReader);
    leafReaderInit(sqlite3_column_blob(pReader->pStmt, 0),
                   sqlite3_column_bytes(pReader->pStmt, 0),
                   &pReader->leafReader);
  }
  return SQLITE_OK;
}

/* Order LeavesReaders by their term, ignoring idx.  Readers at eof
** always sort to the end.
*/
static int leavesReaderTermCmp(LeavesReader *lr1, LeavesReader *lr2){
  if( leavesReaderAtEnd(lr1) ){
    if( leavesReaderAtEnd(lr2) ) return 0;
    return 1;
  }
  if( leavesReaderAtEnd(lr2) ) return -1;

  return leafReaderTermCmp(&lr1->leafReader,
                           leavesReaderTerm(lr2), leavesReaderTermBytes(lr2),
                           0);
}

/* Similar to leavesReaderTermCmp(), with additional ordering by idx
** so that older segments sort before newer segments.
*/
static int leavesReaderCmp(LeavesReader *lr1, LeavesReader *lr2){
  int c = leavesReaderTermCmp(lr1, lr2);
  if( c!=0 ) return c;
  return lr1->idx-lr2->idx;
}

/* Assume that pLr[1]..pLr[nLr] are sorted.  Bubble pLr[0] into its
** sorted position.
*/
static void leavesReaderReorder(LeavesReader *pLr, int nLr){
  while( nLr>1 && leavesReaderCmp(pLr, pLr+1)>0 ){
    LeavesReader tmp = pLr[0];
    pLr[0] = pLr[1];
    pLr[1] = tmp;
    nLr--;
    pLr++;
  }
}

/* Initializes pReaders with the segments from level iLevel, returning
** the number of segments in *piReaders.  Leaves pReaders in sorted
** order.
*/
static int leavesReadersInit(fulltext_vtab *v, int iLevel,
                             LeavesReader *pReaders, int *piReaders){
  sqlite3_stmt *s;
  int i, rc = sql_get_statement(v, SEGDIR_SELECT_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int(s, 1, iLevel);
  if( rc!=SQLITE_OK ) return rc;

  i = 0;
  while( (rc = sqlite3_step(s))==SQLITE_ROW ){
    sqlite_int64 iStart = sqlite3_column_int64(s, 0);
    sqlite_int64 iEnd = sqlite3_column_int64(s, 1);
    const char *pRootData = sqlite3_column_blob(s, 2);
    int nRootData = sqlite3_column_bytes(s, 2);

    assert( i<MERGE_COUNT );
    rc = leavesReaderInit(v, i, iStart, iEnd, pRootData, nRootData,
                          &pReaders[i]);
    if( rc!=SQLITE_OK ) break;

    i++;
  }
  if( rc!=SQLITE_DONE ){
    while( i-->0 ){
      leavesReaderDestroy(&pReaders[i]);
    }
    return rc;
  }

  *piReaders = i;

  /* Leave our results sorted by term, then age. */
  while( i-- ){
    leavesReaderReorder(pReaders+i, *piReaders-i);
  }
  return SQLITE_OK;
}

/* Merge doclists from pReaders[nReaders] into a single doclist, which
** is written to pWriter.  Assumes pReaders is ordered oldest to
** newest.
*/
/* TODO(shess) Consider putting this inline in segmentMerge(). */
static int leavesReadersMerge(fulltext_vtab *v,
                              LeavesReader *pReaders, int nReaders,
                              LeafWriter *pWriter){
  DLReader dlReaders[MERGE_COUNT];
  const char *pTerm = leavesReaderTerm(pReaders);
  int i, nTerm = leavesReaderTermBytes(pReaders);

  assert( nReaders<=MERGE_COUNT );

  for(i=0; i<nReaders; i++){
    dlrInit(&dlReaders[i], DL_DEFAULT,
            leavesReaderData(pReaders+i),
            leavesReaderDataBytes(pReaders+i));
  }

  return leafWriterStepMerge(v, pWriter, pTerm, nTerm, dlReaders, nReaders);
}

/* Forward ref due to mutual recursion with segdirNextIndex(). */
static int segmentMerge(fulltext_vtab *v, int iLevel);

/* Put the next available index at iLevel into *pidx.  If iLevel
** already has MERGE_COUNT segments, they are merged to a higher
** level to make room.
*/
static int segdirNextIndex(fulltext_vtab *v, int iLevel, int *pidx){
  int rc = segdir_max_index(v, iLevel, pidx);
  if( rc==SQLITE_DONE ){              /* No segments at iLevel. */
    *pidx = 0;
  }else if( rc==SQLITE_ROW ){
    if( *pidx==(MERGE_COUNT-1) ){
      rc = segmentMerge(v, iLevel);
      if( rc!=SQLITE_OK ) return rc;
      *pidx = 0;
    }else{
      (*pidx)++;
    }
  }else{
    return rc;
  }
  return SQLITE_OK;
}

/* Merge MERGE_COUNT segments at iLevel into a new segment at
** iLevel+1.  If iLevel+1 is already full of segments, those will be
** merged to make room.
*/
static int segmentMerge(fulltext_vtab *v, int iLevel){
  LeafWriter writer;
  LeavesReader lrs[MERGE_COUNT];
  int i, rc, idx = 0;

  /* Determine the next available segment index at the next level,
  ** merging as necessary.
  */
  rc = segdirNextIndex(v, iLevel+1, &idx);
  if( rc!=SQLITE_OK ) return rc;

  /* TODO(shess) This assumes that we'll always see exactly
  ** MERGE_COUNT segments to merge at a given level.  That will be
  ** broken if we allow the developer to request preemptive or
  ** deferred merging.
  */
  memset(&lrs, '\0', sizeof(lrs));
  rc = leavesReadersInit(v, iLevel, lrs, &i);
  if( rc!=SQLITE_OK ) return rc;
  assert( i==MERGE_COUNT );

  leafWriterInit(iLevel+1, idx, &writer);

  /* Since leavesReaderReorder() pushes readers at eof to the end,
  ** when the first reader is empty, all will be empty.
  */
  while( !leavesReaderAtEnd(lrs) ){
    /* Figure out how many readers share their next term. */
    for(i=1; i<MERGE_COUNT && !leavesReaderAtEnd(lrs+i); i++){
      if( 0!=leavesReaderTermCmp(lrs, lrs+i) ) break;
    }

    rc = leavesReadersMerge(v, lrs, i, &writer);
    if( rc!=SQLITE_OK ) goto err;

    /* Step forward those that were merged. */
    while( i-->0 ){
      rc = leavesReaderStep(v, lrs+i);
      if( rc!=SQLITE_OK ) goto err;

      /* Reorder by term, then by age. */
      leavesReaderReorder(lrs+i, MERGE_COUNT-i);
    }
  }

  for(i=0; i<MERGE_COUNT; i++){
    leavesReaderDestroy(&lrs[i]);
  }

  rc = leafWriterFinalize(v, &writer);
  leafWriterDestroy(&writer);
  if( rc!=SQLITE_OK ) return rc;

  /* Delete the merged segment data. */
  return segdir_delete(v, iLevel);

 err:
  for(i=0; i<MERGE_COUNT; i++){
    leavesReaderDestroy(&lrs[i]);
  }
  leafWriterDestroy(&writer);
  return rc;
}

/* Scan pReader for pTerm/nTerm, and merge the term's doclist over
** *out (any doclists with duplicate docids overwrite those in *out).
** Internal function for loadSegmentLeaf().
*/
static int loadSegmentLeavesInt(fulltext_vtab *v, LeavesReader *pReader,
                                const char *pTerm, int nTerm, int isPrefix,
                                DataBuffer *out){
  assert( nTerm>0 );

  /* Process while the prefix matches. */
  while( !leavesReaderAtEnd(pReader) ){
    /* TODO(shess) Really want leavesReaderTermCmp(), but that name is
    ** already taken to compare the terms of two LeavesReaders.  Think
    ** on a better name.  [Meanwhile, break encapsulation rather than
    ** use a confusing name.]
    */
    int rc;
    int c = leafReaderTermCmp(&pReader->leafReader, pTerm, nTerm, isPrefix);
    if( c==0 ){
      const char *pData = leavesReaderData(pReader);
      int nData = leavesReaderDataBytes(pReader);
      if( out->nData==0 ){
        dataBufferReplace(out, pData, nData);
      }else{
        DataBuffer result;
        dataBufferInit(&result, out->nData+nData);
        docListUnion(out->pData, out->nData, pData, nData, &result);
        dataBufferDestroy(out);
        *out = result;
        /* TODO(shess) Rather than destroy out, we could retain it for
        ** later reuse.
        */
      }
    }
    if( c>0 ) break;      /* Past any possible matches. */

    rc = leavesReaderStep(v, pReader);
    if( rc!=SQLITE_OK ) return rc;
  }
  return SQLITE_OK;
}

/* Call loadSegmentLeavesInt() with pData/nData as input. */
static int loadSegmentLeaf(fulltext_vtab *v, const char *pData, int nData,
                           const char *pTerm, int nTerm, int isPrefix,
                           DataBuffer *out){
  LeavesReader reader;
  int rc;

  assert( nData>1 );
  assert( *pData=='\0' );
  rc = leavesReaderInit(v, 0, 0, 0, pData, nData, &reader);
  if( rc!=SQLITE_OK ) return rc;

  rc = loadSegmentLeavesInt(v, &reader, pTerm, nTerm, isPrefix, out);
  leavesReaderReset(&reader);
  leavesReaderDestroy(&reader);
  return rc;
}

/* Call loadSegmentLeavesInt() with the leaf nodes from iStartLeaf to
** iEndLeaf (inclusive) as input, and merge the resulting doclist into
** out.
*/
static int loadSegmentLeaves(fulltext_vtab *v,
                             sqlite_int64 iStartLeaf, sqlite_int64 iEndLeaf,
                             const char *pTerm, int nTerm, int isPrefix,
                             DataBuffer *out){
  int rc;
  LeavesReader reader;

  assert( iStartLeaf<=iEndLeaf );
  rc = leavesReaderInit(v, 0, iStartLeaf, iEndLeaf, NULL, 0, &reader);
  if( rc!=SQLITE_OK ) return rc;

  rc = loadSegmentLeavesInt(v, &reader, pTerm, nTerm, isPrefix, out);
  leavesReaderReset(&reader);
  leavesReaderDestroy(&reader);
  return rc;
}

/* Taking pData/nData as an interior node, find the sequence of child
** nodes which could include pTerm/nTerm/isPrefix.  Note that the
** interior node terms logically come between the blocks, so there is
** one more blockid than there are terms (that block contains terms >=
** the last interior-node term).
*/
/* TODO(shess) The calling code may already know that the end child is
** not worth calculating, because the end may be in a later sibling
** node.  Consider whether breaking symmetry is worthwhile.  I suspect
** it's not worthwhile.
*/
static void getChildrenContaining(const char *pData, int nData,
                                  const char *pTerm, int nTerm, int isPrefix,
                                  sqlite_int64 *piStartChild,
                                  sqlite_int64 *piEndChild){
  InteriorReader reader;

  assert( nData>1 );
  assert( *pData!='\0' );
  interiorReaderInit(pData, nData, &reader);

  /* Scan for the first child which could contain pTerm/nTerm. */
  while( !interiorReaderAtEnd(&reader) ){
    if( interiorReaderTermCmp(&reader, pTerm, nTerm, 0)>0 ) break;
    interiorReaderStep(&reader);
  }
  *piStartChild = interiorReaderCurrentBlockid(&reader);

  /* Keep scanning to find a term greater than our term, using prefix
  ** comparison if indicated.  If isPrefix is false, this will be the
  ** same blockid as the starting block.
  */
  while( !interiorReaderAtEnd(&reader) ){
    if( interiorReaderTermCmp(&reader, pTerm, nTerm, isPrefix)>0 ) break;
    interiorReaderStep(&reader);
  }
  *piEndChild = interiorReaderCurrentBlockid(&reader);

  interiorReaderDestroy(&reader);

  /* Children must ascend, and if !prefix, both must be the same. */
  assert( *piEndChild>=*piStartChild );
  assert( isPrefix || *piStartChild==*piEndChild );
}

/* Read block at iBlockid and pass it with other params to
** getChildrenContaining().
*/
static int loadAndGetChildrenContaining(
  fulltext_vtab *v,
  sqlite_int64 iBlockid,
  const char *pTerm, int nTerm, int isPrefix,
  sqlite_int64 *piStartChild, sqlite_int64 *piEndChild
){
  sqlite3_stmt *s = NULL;
  int rc;

  assert( iBlockid!=0 );
  assert( pTerm!=NULL );
  assert( nTerm!=0 );        /* TODO(shess) Why not allow this? */
  assert( piStartChild!=NULL );
  assert( piEndChild!=NULL );

  rc = sql_get_statement(v, BLOCK_SELECT_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 1, iBlockid);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_step(s);
  if( rc==SQLITE_DONE ) return SQLITE_ERROR;
  if( rc!=SQLITE_ROW ) return rc;

  getChildrenContaining(sqlite3_column_blob(s, 0), sqlite3_column_bytes(s, 0),
                        pTerm, nTerm, isPrefix, piStartChild, piEndChild);

  /* We expect only one row.  We must execute another sqlite3_step()
   * to complete the iteration; otherwise the table will remain
   * locked. */
  rc = sqlite3_step(s);
  if( rc==SQLITE_ROW ) return SQLITE_ERROR;
  if( rc!=SQLITE_DONE ) return rc;

  return SQLITE_OK;
}

/* Traverse the tree represented by pData[nData] looking for
** pTerm[nTerm], placing its doclist into *out.  This is internal to
** loadSegment() to make error-handling cleaner.
*/
static int loadSegmentInt(fulltext_vtab *v, const char *pData, int nData,
                          sqlite_int64 iLeavesEnd,
                          const char *pTerm, int nTerm, int isPrefix,
                          DataBuffer *out){
  /* Special case where root is a leaf. */
  if( *pData=='\0' ){
    return loadSegmentLeaf(v, pData, nData, pTerm, nTerm, isPrefix, out);
  }else{
    int rc;
    sqlite_int64 iStartChild, iEndChild;

    /* Process pData as an interior node, then loop down the tree
    ** until we find the set of leaf nodes to scan for the term.
    */
    getChildrenContaining(pData, nData, pTerm, nTerm, isPrefix,
                          &iStartChild, &iEndChild);
    while( iStartChild>iLeavesEnd ){
      sqlite_int64 iNextStart, iNextEnd;
      rc = loadAndGetChildrenContaining(v, iStartChild, pTerm, nTerm, isPrefix,
                                        &iNextStart, &iNextEnd);
      if( rc!=SQLITE_OK ) return rc;

      /* If we've branched, follow the end branch, too. */
      if( iStartChild!=iEndChild ){
        sqlite_int64 iDummy;
        rc = loadAndGetChildrenContaining(v, iEndChild, pTerm, nTerm, isPrefix,
                                          &iDummy, &iNextEnd);
        if( rc!=SQLITE_OK ) return rc;
      }

      assert( iNextStart<=iNextEnd );
      iStartChild = iNextStart;
      iEndChild = iNextEnd;
    }
    assert( iStartChild<=iLeavesEnd );
    assert( iEndChild<=iLeavesEnd );

    /* Scan through the leaf segments for doclists. */
    return loadSegmentLeaves(v, iStartChild, iEndChild,
                             pTerm, nTerm, isPrefix, out);
  }
}

/* Call loadSegmentInt() to collect the doclist for pTerm/nTerm, then
** merge its doclist over *out (any duplicate doclists read from the
** segment rooted at pData will overwrite those in *out).
*/
/* TODO(shess) Consider changing this to determine the depth of the
** leaves using either the first characters of interior nodes (when
** ==1, we're one level above the leaves), or the first character of
** the root (which will describe the height of the tree directly).
** Either feels somewhat tricky to me.
*/
/* TODO(shess) The current merge is likely to be slow for large
** doclists (though it should process from newest/smallest to
** oldest/largest, so it may not be that bad).  It might be useful to
** modify things to allow for N-way merging.  This could either be
** within a segment, with pairwise merges across segments, or across
** all segments at once.
*/
static int loadSegment(fulltext_vtab *v, const char *pData, int nData,
                       sqlite_int64 iLeavesEnd,
                       const char *pTerm, int nTerm, int isPrefix,
                       DataBuffer *out){
  DataBuffer result;
  int rc;

  assert( nData>1 );

  /* This code should never be called with buffered updates. */
  assert( v->nPendingData<0 );

  dataBufferInit(&result, 0);
  rc = loadSegmentInt(v, pData, nData, iLeavesEnd,
                      pTerm, nTerm, isPrefix, &result);
  if( rc==SQLITE_OK && result.nData>0 ){
    if( out->nData==0 ){
      DataBuffer tmp = *out;
      *out = result;
      result = tmp;
    }else{
      DataBuffer merged;
      DLReader readers[2];

      dlrInit(&readers[0], DL_DEFAULT, out->pData, out->nData);
      dlrInit(&readers[1], DL_DEFAULT, result.pData, result.nData);
      dataBufferInit(&merged, out->nData+result.nData);
      docListMerge(&merged, readers, 2);
      dataBufferDestroy(out);
      *out = merged;
      dlrDestroy(&readers[0]);
      dlrDestroy(&readers[1]);
    }
  }
  dataBufferDestroy(&result);
  return rc;
}

/* Scan the database and merge together the posting lists for the term
** into *out.
*/
static int termSelect(fulltext_vtab *v, int iColumn,
                      const char *pTerm, int nTerm, int isPrefix,
                      DocListType iType, DataBuffer *out){
  DataBuffer doclist;
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, SEGDIR_SELECT_ALL_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  /* This code should never be called with buffered updates. */
  assert( v->nPendingData<0 );

  dataBufferInit(&doclist, 0);

  /* Traverse the segments from oldest to newest so that newer doclist
  ** elements for given docids overwrite older elements.
  */
  while( (rc = sqlite3_step(s))==SQLITE_ROW ){
    const char *pData = sqlite3_column_blob(s, 0);
    const int nData = sqlite3_column_bytes(s, 0);
    const sqlite_int64 iLeavesEnd = sqlite3_column_int64(s, 1);
    rc = loadSegment(v, pData, nData, iLeavesEnd, pTerm, nTerm, isPrefix,
                     &doclist);
    if( rc!=SQLITE_OK ) goto err;
  }
  if( rc==SQLITE_DONE ){
    if( doclist.nData!=0 ){
      /* TODO(shess) The old term_select_all() code applied the column
      ** restrict as we merged segments, leading to smaller buffers.
      ** This is probably worthwhile to bring back, once the new storage
      ** system is checked in.
      */
      if( iColumn==v->nColumn) iColumn = -1;
      docListTrim(DL_DEFAULT, doclist.pData, doclist.nData,
                  iColumn, iType, out);
    }
    rc = SQLITE_OK;
  }

 err:
  dataBufferDestroy(&doclist);
  return rc;
}

/****************************************************************/
/* Used to hold hashtable data for sorting. */
typedef struct TermData {
  const char *pTerm;
  int nTerm;
  DLCollector *pCollector;
} TermData;

/* Orders TermData elements in strcmp fashion ( <0 for less-than, 0
** for equal, >0 for greater-than).
*/
static int termDataCmp(const void *av, const void *bv){
  const TermData *a = (const TermData *)av;
  const TermData *b = (const TermData *)bv;
  int n = a->nTerm<b->nTerm ? a->nTerm : b->nTerm;
  int c = memcmp(a->pTerm, b->pTerm, n);
  if( c!=0 ) return c;
  return a->nTerm-b->nTerm;
}

/* Order pTerms data by term, then write a new level 0 segment using
** LeafWriter.
*/
static int writeZeroSegment(fulltext_vtab *v, fts2Hash *pTerms){
  fts2HashElem *e;
  int idx, rc, i, n;
  TermData *pData;
  LeafWriter writer;
  DataBuffer dl;

  /* Determine the next index at level 0, merging as necessary. */
  rc = segdirNextIndex(v, 0, &idx);
  if( rc!=SQLITE_OK ) return rc;

  n = fts2HashCount(pTerms);
  pData = malloc(n*sizeof(TermData));

  for(i = 0, e = fts2HashFirst(pTerms); e; i++, e = fts2HashNext(e)){
    assert( i<n );
    pData[i].pTerm = fts2HashKey(e);
    pData[i].nTerm = fts2HashKeysize(e);
    pData[i].pCollector = fts2HashData(e);
  }
  assert( i==n );

  /* TODO(shess) Should we allow user-defined collation sequences,
  ** here?  I think we only need that once we support prefix searches.
  */
  if( n>1 ) qsort(pData, n, sizeof(*pData), termDataCmp);

  /* TODO(shess) Refactor so that we can write directly to the segment
  ** DataBuffer, as happens for segment merges.
  */
  leafWriterInit(0, idx, &writer);
  dataBufferInit(&dl, 0);
  for(i=0; i<n; i++){
    dataBufferReset(&dl);
    dlcAddDoclist(pData[i].pCollector, &dl);
    rc = leafWriterStep(v, &writer,
                        pData[i].pTerm, pData[i].nTerm, dl.pData, dl.nData);
    if( rc!=SQLITE_OK ) goto err;
  }
  rc = leafWriterFinalize(v, &writer);

 err:
  dataBufferDestroy(&dl);
  free(pData);
  leafWriterDestroy(&writer);
  return rc;
}

/* If pendingTerms has data, free it. */
static int clearPendingTerms(fulltext_vtab *v){
  if( v->nPendingData>=0 ){
    fts2HashElem *e;
    for(e=fts2HashFirst(&v->pendingTerms); e; e=fts2HashNext(e)){
      dlcDelete(fts2HashData(e));
    }
    fts2HashClear(&v->pendingTerms);
    v->nPendingData = -1;
  }
  return SQLITE_OK;
}

/* If pendingTerms has data, flush it to a level-zero segment, and
** free it.
*/
static int flushPendingTerms(fulltext_vtab *v){
  if( v->nPendingData>=0 ){
    int rc = writeZeroSegment(v, &v->pendingTerms);
    if( rc==SQLITE_OK ) clearPendingTerms(v);
    return rc;
  }
  return SQLITE_OK;
}

/* If pendingTerms is "too big", or docid is out of order, flush it.
** Regardless, be certain that pendingTerms is initialized for use.
*/
static int initPendingTerms(fulltext_vtab *v, sqlite_int64 iDocid){
  /* TODO(shess) Explore whether partially flushing the buffer on
  ** forced-flush would provide better performance.  I suspect that if
  ** we ordered the doclists by size and flushed the largest until the
  ** buffer was half empty, that would let the less frequent terms
  ** generate longer doclists.
  */
  if( iDocid<=v->iPrevDocid || v->nPendingData>kPendingThreshold ){
    int rc = flushPendingTerms(v);
    if( rc!=SQLITE_OK ) return rc;
  }
  if( v->nPendingData<0 ){
    fts2HashInit(&v->pendingTerms, FTS2_HASH_STRING, 1);
    v->nPendingData = 0;
  }
  v->iPrevDocid = iDocid;
  return SQLITE_OK;
}

/* This function implements the xUpdate callback; it's the top-level entry
 * point for inserting, deleting or updating a row in a full-text table. */
static int fulltextUpdate(sqlite3_vtab *pVtab, int nArg, sqlite3_value **ppArg,
                   sqlite_int64 *pRowid){
  fulltext_vtab *v = (fulltext_vtab *) pVtab;
  int rc;

  TRACE(("FTS2 Update %p\n", pVtab));

  if( nArg<2 ){
    rc = index_delete(v, sqlite3_value_int64(ppArg[0]));
  } else if( sqlite3_value_type(ppArg[0]) != SQLITE_NULL ){
    /* An update:
     * ppArg[0] = old rowid
     * ppArg[1] = new rowid
     * ppArg[2..2+v->nColumn-1] = values
     * ppArg[2+v->nColumn] = value for magic column (we ignore this)
     */
    sqlite_int64 rowid = sqlite3_value_int64(ppArg[0]);
    if( sqlite3_value_type(ppArg[1]) != SQLITE_INTEGER ||
      sqlite3_value_int64(ppArg[1]) != rowid ){
      rc = SQLITE_ERROR;  /* we don't allow changing the rowid */
    } else {
      assert( nArg==2+v->nColumn+1);
      rc = index_update(v, rowid, &ppArg[2]);
    }
  } else {
    /* An insert:
     * ppArg[1] = requested rowid
     * ppArg[2..2+v->nColumn-1] = values
     * ppArg[2+v->nColumn] = value for magic column (we ignore this)
     */
    assert( nArg==2+v->nColumn+1);
    rc = index_insert(v, ppArg[1], &ppArg[2], pRowid);
  }

  return rc;
}

static int fulltextSync(sqlite3_vtab *pVtab){
  TRACE(("FTS2 xSync()\n"));
  return flushPendingTerms((fulltext_vtab *)pVtab);
}

static int fulltextBegin(sqlite3_vtab *pVtab){
  fulltext_vtab *v = (fulltext_vtab *) pVtab;
  TRACE(("FTS2 xBegin()\n"));

  /* Any buffered updates should have been cleared by the previous
  ** transaction.
  */
  assert( v->nPendingData<0 );
  return clearPendingTerms(v);
}

static int fulltextCommit(sqlite3_vtab *pVtab){
  fulltext_vtab *v = (fulltext_vtab *) pVtab;
  TRACE(("FTS2 xCommit()\n"));

  /* Buffered updates should have been cleared by fulltextSync(). */
  assert( v->nPendingData<0 );
  return clearPendingTerms(v);
}

static int fulltextRollback(sqlite3_vtab *pVtab){
  TRACE(("FTS2 xRollback()\n"));
  return clearPendingTerms((fulltext_vtab *)pVtab);
}

/*
** Implementation of the snippet() function for FTS2
*/
static void snippetFunc(
  sqlite3_context *pContext,
  int argc,
  sqlite3_value **argv
){
  fulltext_cursor *pCursor;
  if( argc<1 ) return;
  if( sqlite3_value_type(argv[0])!=SQLITE_BLOB ||
      sqlite3_value_bytes(argv[0])!=sizeof(pCursor) ){
    sqlite3_result_error(pContext, "illegal first argument to html_snippet",-1);
  }else{
    const char *zStart = "<b>";
    const char *zEnd = "</b>";
    const char *zEllipsis = "<b>...</b>";
    memcpy(&pCursor, sqlite3_value_blob(argv[0]), sizeof(pCursor));
    if( argc>=2 ){
      zStart = (const char*)sqlite3_value_text(argv[1]);
      if( argc>=3 ){
        zEnd = (const char*)sqlite3_value_text(argv[2]);
        if( argc>=4 ){
          zEllipsis = (const char*)sqlite3_value_text(argv[3]);
        }
      }
    }
    snippetAllOffsets(pCursor);
    snippetText(pCursor, zStart, zEnd, zEllipsis);
    sqlite3_result_text(pContext, pCursor->snippet.zSnippet,
                        pCursor->snippet.nSnippet, SQLITE_STATIC);
  }
}

/*
** Implementation of the offsets() function for FTS2
*/
static void snippetOffsetsFunc(
  sqlite3_context *pContext,
  int argc,
  sqlite3_value **argv
){
  fulltext_cursor *pCursor;
  if( argc<1 ) return;
  if( sqlite3_value_type(argv[0])!=SQLITE_BLOB ||
      sqlite3_value_bytes(argv[0])!=sizeof(pCursor) ){
    sqlite3_result_error(pContext, "illegal first argument to offsets",-1);
  }else{
    memcpy(&pCursor, sqlite3_value_blob(argv[0]), sizeof(pCursor));
    snippetAllOffsets(pCursor);
    snippetOffsetText(&pCursor->snippet);
    sqlite3_result_text(pContext,
                        pCursor->snippet.zOffset, pCursor->snippet.nOffset,
                        SQLITE_STATIC);
  }
}

/*
** This routine implements the xFindFunction method for the FTS2
** virtual table.
*/
static int fulltextFindFunction(
  sqlite3_vtab *pVtab,
  int nArg,
  const char *zName,
  void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),
  void **ppArg
){
  if( strcmp(zName,"snippet")==0 ){
    *pxFunc = snippetFunc;
    return 1;
  }else if( strcmp(zName,"offsets")==0 ){
    *pxFunc = snippetOffsetsFunc;
    return 1;
  }
  return 0;
}

/*
** Rename an fts2 table.
*/
static int fulltextRename(
  sqlite3_vtab *pVtab,
  const char *zName
){
  fulltext_vtab *p = (fulltext_vtab *)pVtab;
  int rc = SQLITE_NOMEM;
  char *zSql = sqlite3_mprintf(
    "ALTER TABLE %Q.'%q_content'  RENAME TO '%q_content';"
    "ALTER TABLE %Q.'%q_segments' RENAME TO '%q_segments';"
    "ALTER TABLE %Q.'%q_segdir'   RENAME TO '%q_segdir';"
    , p->zDb, p->zName, zName 
    , p->zDb, p->zName, zName 
    , p->zDb, p->zName, zName
  );
  if( zSql ){
    rc = sqlite3_exec(p->db, zSql, 0, 0, 0);
    sqlite3_free(zSql);
  }
  return rc;
}

static const sqlite3_module fts2Module = {
  /* iVersion      */ 0,
  /* xCreate       */ fulltextCreate,
  /* xConnect      */ fulltextConnect,
  /* xBestIndex    */ fulltextBestIndex,
  /* xDisconnect   */ fulltextDisconnect,
  /* xDestroy      */ fulltextDestroy,
  /* xOpen         */ fulltextOpen,
  /* xClose        */ fulltextClose,
  /* xFilter       */ fulltextFilter,
  /* xNext         */ fulltextNext,
  /* xEof          */ fulltextEof,
  /* xColumn       */ fulltextColumn,
  /* xRowid        */ fulltextRowid,
  /* xUpdate       */ fulltextUpdate,
  /* xBegin        */ fulltextBegin,
  /* xSync         */ fulltextSync,
  /* xCommit       */ fulltextCommit,
  /* xRollback     */ fulltextRollback,
  /* xFindFunction */ fulltextFindFunction,
  /* xRename */       fulltextRename,
};

static void hashDestroy(void *p){
  fts2Hash *pHash = (fts2Hash *)p;
  sqlite3Fts2HashClear(pHash);
  sqlite3_free(pHash);
}

/*
** The fts2 built-in tokenizers - "simple" and "porter" - are implemented
** in files fts2_tokenizer1.c and fts2_porter.c respectively. The following
** two forward declarations are for functions declared in these files
** used to retrieve the respective implementations.
**
** Calling sqlite3Fts2SimpleTokenizerModule() sets the value pointed
** to by the argument to point a the "simple" tokenizer implementation.
** Function ...PorterTokenizerModule() sets *pModule to point to the
** porter tokenizer/stemmer implementation.
*/
void sqlite3Fts2SimpleTokenizerModule(sqlite3_tokenizer_module const**ppModule);
void sqlite3Fts2PorterTokenizerModule(sqlite3_tokenizer_module const**ppModule);
void sqlite3Fts2IcuTokenizerModule(sqlite3_tokenizer_module const**ppModule);

int sqlite3Fts2InitHashTable(sqlite3 *, fts2Hash *, const char *);

/*
** Initialise the fts2 extension. If this extension is built as part
** of the sqlite library, then this function is called directly by
** SQLite. If fts2 is built as a dynamically loadable extension, this
** function is called by the sqlite3_extension_init() entry point.
*/
int sqlite3Fts2Init(sqlite3 *db){
  int rc = SQLITE_OK;
  fts2Hash *pHash = 0;
  const sqlite3_tokenizer_module *pSimple = 0;
  const sqlite3_tokenizer_module *pPorter = 0;
  const sqlite3_tokenizer_module *pIcu = 0;

  sqlite3Fts2SimpleTokenizerModule(&pSimple);
  sqlite3Fts2PorterTokenizerModule(&pPorter);
#ifdef SQLITE_ENABLE_ICU
  sqlite3Fts2IcuTokenizerModule(&pIcu);
#endif

  /* Allocate and initialise the hash-table used to store tokenizers. */
  pHash = sqlite3_malloc(sizeof(fts2Hash));
  if( !pHash ){
    rc = SQLITE_NOMEM;
  }else{
    sqlite3Fts2HashInit(pHash, FTS2_HASH_STRING, 1);
  }

  /* Load the built-in tokenizers into the hash table */
  if( rc==SQLITE_OK ){
    if( sqlite3Fts2HashInsert(pHash, "simple", 7, (void *)pSimple)
     || sqlite3Fts2HashInsert(pHash, "porter", 7, (void *)pPorter) 
     || (pIcu && sqlite3Fts2HashInsert(pHash, "icu", 4, (void *)pIcu))
    ){
      rc = SQLITE_NOMEM;
    }
  }

  /* Create the virtual table wrapper around the hash-table and overload 
  ** the two scalar functions. If this is successful, register the
  ** module with sqlite.
  */
  if( SQLITE_OK==rc 
   && SQLITE_OK==(rc = sqlite3Fts2InitHashTable(db, pHash, "fts2_tokenizer"))
   && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
   && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", -1))
  ){
    return sqlite3_create_module_v2(
        db, "fts2", &fts2Module, (void *)pHash, hashDestroy
    );
  }

  /* An error has occured. Delete the hash table and return the error code. */
  assert( rc!=SQLITE_OK );
  if( pHash ){
    sqlite3Fts2HashClear(pHash);
    sqlite3_free(pHash);
  }
  return rc;
}

#if !SQLITE_CORE
int sqlite3_extension_init(
  sqlite3 *db, 
  char **pzErrMsg,
  const sqlite3_api_routines *pApi
){
  SQLITE_EXTENSION_INIT2(pApi)
  return sqlite3Fts2Init(db);
}
#endif

#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/FTS2/fts2.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
** 2006 Oct 10
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This header file is used by programs that want to link against the
** FTS2 library.  All it does is declare the sqlite3Fts2Init() interface.
*/
#include "sqlite3.h"

#ifdef __cplusplus
extern "C" {
#endif  /* __cplusplus */

int sqlite3Fts2Init(sqlite3 *db);

#ifdef __cplusplus
}  /* extern "C" */
#endif  /* __cplusplus */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































Deleted SQLite.Interop/FTS2/fts2_hash.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
/*
** 2001 September 22
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This is the implementation of generic hash-tables used in SQLite.
** We've modified it slightly to serve as a standalone hash table
** implementation for the full-text indexing module.
*/

/*
** The code in this file is only compiled if:
**
**     * The FTS2 module is being built as an extension
**       (in which case SQLITE_CORE is not defined), or
**
**     * The FTS2 module is being built into the core of
**       SQLite (in which case SQLITE_ENABLE_FTS2 is defined).
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2)

#include <assert.h>
#include <stdlib.h>
#include <string.h>

#include "fts2_hash.h"

static void *malloc_and_zero(int n){
  void *p = malloc(n);
  if( p ){
    memset(p, 0, n);
  }
  return p;
}

/* Turn bulk memory into a hash table object by initializing the
** fields of the Hash structure.
**
** "pNew" is a pointer to the hash table that is to be initialized.
** keyClass is one of the constants 
** FTS2_HASH_BINARY or FTS2_HASH_STRING.  The value of keyClass 
** determines what kind of key the hash table will use.  "copyKey" is
** true if the hash table should make its own private copy of keys and
** false if it should just use the supplied pointer.
*/
void sqlite3Fts2HashInit(fts2Hash *pNew, int keyClass, int copyKey){
  assert( pNew!=0 );
  assert( keyClass>=FTS2_HASH_STRING && keyClass<=FTS2_HASH_BINARY );
  pNew->keyClass = keyClass;
  pNew->copyKey = copyKey;
  pNew->first = 0;
  pNew->count = 0;
  pNew->htsize = 0;
  pNew->ht = 0;
  pNew->xMalloc = malloc_and_zero;
  pNew->xFree = free;
}

/* Remove all entries from a hash table.  Reclaim all memory.
** Call this routine to delete a hash table or to reset a hash table
** to the empty state.
*/
void sqlite3Fts2HashClear(fts2Hash *pH){
  fts2HashElem *elem;         /* For looping over all elements of the table */

  assert( pH!=0 );
  elem = pH->first;
  pH->first = 0;
  if( pH->ht ) pH->xFree(pH->ht);
  pH->ht = 0;
  pH->htsize = 0;
  while( elem ){
    fts2HashElem *next_elem = elem->next;
    if( pH->copyKey && elem->pKey ){
      pH->xFree(elem->pKey);
    }
    pH->xFree(elem);
    elem = next_elem;
  }
  pH->count = 0;
}

/*
** Hash and comparison functions when the mode is FTS2_HASH_STRING
*/
static int strHash(const void *pKey, int nKey){
  const char *z = (const char *)pKey;
  int h = 0;
  if( nKey<=0 ) nKey = (int) strlen(z);
  while( nKey > 0  ){
    h = (h<<3) ^ h ^ *z++;
    nKey--;
  }
  return h & 0x7fffffff;
}
static int strCompare(const void *pKey1, int n1, const void *pKey2, int n2){
  if( n1!=n2 ) return 1;
  return strncmp((const char*)pKey1,(const char*)pKey2,n1);
}

/*
** Hash and comparison functions when the mode is FTS2_HASH_BINARY
*/
static int binHash(const void *pKey, int nKey){
  int h = 0;
  const char *z = (const char *)pKey;
  while( nKey-- > 0 ){
    h = (h<<3) ^ h ^ *(z++);
  }
  return h & 0x7fffffff;
}
static int binCompare(const void *pKey1, int n1, const void *pKey2, int n2){
  if( n1!=n2 ) return 1;
  return memcmp(pKey1,pKey2,n1);
}

/*
** Return a pointer to the appropriate hash function given the key class.
**
** The C syntax in this function definition may be unfamilar to some 
** programmers, so we provide the following additional explanation:
**
** The name of the function is "hashFunction".  The function takes a
** single parameter "keyClass".  The return value of hashFunction()
** is a pointer to another function.  Specifically, the return value
** of hashFunction() is a pointer to a function that takes two parameters
** with types "const void*" and "int" and returns an "int".
*/
static int (*hashFunction(int keyClass))(const void*,int){
  if( keyClass==FTS2_HASH_STRING ){
    return &strHash;
  }else{
    assert( keyClass==FTS2_HASH_BINARY );
    return &binHash;
  }
}

/*
** Return a pointer to the appropriate hash function given the key class.
**
** For help in interpreted the obscure C code in the function definition,
** see the header comment on the previous function.
*/
static int (*compareFunction(int keyClass))(const void*,int,const void*,int){
  if( keyClass==FTS2_HASH_STRING ){
    return &strCompare;
  }else{
    assert( keyClass==FTS2_HASH_BINARY );
    return &binCompare;
  }
}

/* Link an element into the hash table
*/
static void insertElement(
  fts2Hash *pH,            /* The complete hash table */
  struct _fts2ht *pEntry,  /* The entry into which pNew is inserted */
  fts2HashElem *pNew       /* The element to be inserted */
){
  fts2HashElem *pHead;     /* First element already in pEntry */
  pHead = pEntry->chain;
  if( pHead ){
    pNew->next = pHead;
    pNew->prev = pHead->prev;
    if( pHead->prev ){ pHead->prev->next = pNew; }
    else             { pH->first = pNew; }
    pHead->prev = pNew;
  }else{
    pNew->next = pH->first;
    if( pH->first ){ pH->first->prev = pNew; }
    pNew->prev = 0;
    pH->first = pNew;
  }
  pEntry->count++;
  pEntry->chain = pNew;
}


/* Resize the hash table so that it cantains "new_size" buckets.
** "new_size" must be a power of 2.  The hash table might fail 
** to resize if sqliteMalloc() fails.
*/
static void rehash(fts2Hash *pH, int new_size){
  struct _fts2ht *new_ht;          /* The new hash table */
  fts2HashElem *elem, *next_elem;  /* For looping over existing elements */
  int (*xHash)(const void*,int);   /* The hash function */

  assert( (new_size & (new_size-1))==0 );
  new_ht = (struct _fts2ht *)pH->xMalloc( new_size*sizeof(struct _fts2ht) );
  if( new_ht==0 ) return;
  if( pH->ht ) pH->xFree(pH->ht);
  pH->ht = new_ht;
  pH->htsize = new_size;
  xHash = hashFunction(pH->keyClass);
  for(elem=pH->first, pH->first=0; elem; elem = next_elem){
    int h = (*xHash)(elem->pKey, elem->nKey) & (new_size-1);
    next_elem = elem->next;
    insertElement(pH, &new_ht[h], elem);
  }
}

/* This function (for internal use only) locates an element in an
** hash table that matches the given key.  The hash for this key has
** already been computed and is passed as the 4th parameter.
*/
static fts2HashElem *findElementGivenHash(
  const fts2Hash *pH, /* The pH to be searched */
  const void *pKey,   /* The key we are searching for */
  int nKey,
  int h               /* The hash for this key. */
){
  fts2HashElem *elem;            /* Used to loop thru the element list */
  int count;                     /* Number of elements left to test */
  int (*xCompare)(const void*,int,const void*,int);  /* comparison function */

  if( pH->ht ){
    struct _fts2ht *pEntry = &pH->ht[h];
    elem = pEntry->chain;
    count = pEntry->count;
    xCompare = compareFunction(pH->keyClass);
    while( count-- && elem ){
      if( (*xCompare)(elem->pKey,elem->nKey,pKey,nKey)==0 ){ 
        return elem;
      }
      elem = elem->next;
    }
  }
  return 0;
}

/* Remove a single entry from the hash table given a pointer to that
** element and a hash on the element's key.
*/
static void removeElementGivenHash(
  fts2Hash *pH,         /* The pH containing "elem" */
  fts2HashElem* elem,   /* The element to be removed from the pH */
  int h                 /* Hash value for the element */
){
  struct _fts2ht *pEntry;
  if( elem->prev ){
    elem->prev->next = elem->next; 
  }else{
    pH->first = elem->next;
  }
  if( elem->next ){
    elem->next->prev = elem->prev;
  }
  pEntry = &pH->ht[h];
  if( pEntry->chain==elem ){
    pEntry->chain = elem->next;
  }
  pEntry->count--;
  if( pEntry->count<=0 ){
    pEntry->chain = 0;
  }
  if( pH->copyKey && elem->pKey ){
    pH->xFree(elem->pKey);
  }
  pH->xFree( elem );
  pH->count--;
  if( pH->count<=0 ){
    assert( pH->first==0 );
    assert( pH->count==0 );
    fts2HashClear(pH);
  }
}

/* Attempt to locate an element of the hash table pH with a key
** that matches pKey,nKey.  Return the data for this element if it is
** found, or NULL if there is no match.
*/
void *sqlite3Fts2HashFind(const fts2Hash *pH, const void *pKey, int nKey){
  int h;                 /* A hash on key */
  fts2HashElem *elem;    /* The element that matches key */
  int (*xHash)(const void*,int);  /* The hash function */

  if( pH==0 || pH->ht==0 ) return 0;
  xHash = hashFunction(pH->keyClass);
  assert( xHash!=0 );
  h = (*xHash)(pKey,nKey);
  assert( (pH->htsize & (pH->htsize-1))==0 );
  elem = findElementGivenHash(pH,pKey,nKey, h & (pH->htsize-1));
  return elem ? elem->data : 0;
}

/* Insert an element into the hash table pH.  The key is pKey,nKey
** and the data is "data".
**
** If no element exists with a matching key, then a new
** element is created.  A copy of the key is made if the copyKey
** flag is set.  NULL is returned.
**
** If another element already exists with the same key, then the
** new data replaces the old data and the old data is returned.
** The key is not copied in this instance.  If a malloc fails, then
** the new data is returned and the hash table is unchanged.
**
** If the "data" parameter to this function is NULL, then the
** element corresponding to "key" is removed from the hash table.
*/
void *sqlite3Fts2HashInsert(
  fts2Hash *pH,        /* The hash table to insert into */
  const void *pKey,    /* The key */
  int nKey,            /* Number of bytes in the key */
  void *data           /* The data */
){
  int hraw;                 /* Raw hash value of the key */
  int h;                    /* the hash of the key modulo hash table size */
  fts2HashElem *elem;       /* Used to loop thru the element list */
  fts2HashElem *new_elem;   /* New element added to the pH */
  int (*xHash)(const void*,int);  /* The hash function */

  assert( pH!=0 );
  xHash = hashFunction(pH->keyClass);
  assert( xHash!=0 );
  hraw = (*xHash)(pKey, nKey);
  assert( (pH->htsize & (pH->htsize-1))==0 );
  h = hraw & (pH->htsize-1);
  elem = findElementGivenHash(pH,pKey,nKey,h);
  if( elem ){
    void *old_data = elem->data;
    if( data==0 ){
      removeElementGivenHash(pH,elem,h);
    }else{
      elem->data = data;
    }
    return old_data;
  }
  if( data==0 ) return 0;
  new_elem = (fts2HashElem*)pH->xMalloc( sizeof(fts2HashElem) );
  if( new_elem==0 ) return data;
  if( pH->copyKey && pKey!=0 ){
    new_elem->pKey = pH->xMalloc( nKey );
    if( new_elem->pKey==0 ){
      pH->xFree(new_elem);
      return data;
    }
    memcpy((void*)new_elem->pKey, pKey, nKey);
  }else{
    new_elem->pKey = (void*)pKey;
  }
  new_elem->nKey = nKey;
  pH->count++;
  if( pH->htsize==0 ){
    rehash(pH,8);
    if( pH->htsize==0 ){
      pH->count = 0;
      pH->xFree(new_elem);
      return data;
    }
  }
  if( pH->count > pH->htsize ){
    rehash(pH,pH->htsize*2);
  }
  assert( pH->htsize>0 );
  assert( (pH->htsize & (pH->htsize-1))==0 );
  h = hraw & (pH->htsize-1);
  insertElement(pH, &pH->ht[h], new_elem);
  new_elem->data = data;
  return 0;
}

#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/FTS2/fts2_hash.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
** 2001 September 22
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This is the header file for the generic hash-table implemenation
** used in SQLite.  We've modified it slightly to serve as a standalone
** hash table implementation for the full-text indexing module.
**
*/
#ifndef _FTS2_HASH_H_
#define _FTS2_HASH_H_

/* Forward declarations of structures. */
typedef struct fts2Hash fts2Hash;
typedef struct fts2HashElem fts2HashElem;

/* A complete hash table is an instance of the following structure.
** The internals of this structure are intended to be opaque -- client
** code should not attempt to access or modify the fields of this structure
** directly.  Change this structure only by using the routines below.
** However, many of the "procedures" and "functions" for modifying and
** accessing this structure are really macros, so we can't really make
** this structure opaque.
*/
struct fts2Hash {
  char keyClass;          /* HASH_INT, _POINTER, _STRING, _BINARY */
  char copyKey;           /* True if copy of key made on insert */
  int count;              /* Number of entries in this table */
  fts2HashElem *first;    /* The first element of the array */
  void *(*xMalloc)(int);  /* malloc() function to use */
  void (*xFree)(void *);  /* free() function to use */
  int htsize;             /* Number of buckets in the hash table */
  struct _fts2ht {        /* the hash table */
    int count;               /* Number of entries with this hash */
    fts2HashElem *chain;     /* Pointer to first entry with this hash */
  } *ht;
};

/* Each element in the hash table is an instance of the following 
** structure.  All elements are stored on a single doubly-linked list.
**
** Again, this structure is intended to be opaque, but it can't really
** be opaque because it is used by macros.
*/
struct fts2HashElem {
  fts2HashElem *next, *prev; /* Next and previous elements in the table */
  void *data;                /* Data associated with this element */
  void *pKey; int nKey;      /* Key associated with this element */
};

/*
** There are 2 different modes of operation for a hash table:
**
**   FTS2_HASH_STRING        pKey points to a string that is nKey bytes long
**                           (including the null-terminator, if any).  Case
**                           is respected in comparisons.
**
**   FTS2_HASH_BINARY        pKey points to binary data nKey bytes long. 
**                           memcmp() is used to compare keys.
**
** A copy of the key is made if the copyKey parameter to fts2HashInit is 1.  
*/
#define FTS2_HASH_STRING    1
#define FTS2_HASH_BINARY    2

/*
** Access routines.  To delete, insert a NULL pointer.
*/
void sqlite3Fts2HashInit(fts2Hash*, int keytype, int copyKey);
void *sqlite3Fts2HashInsert(fts2Hash*, const void *pKey, int nKey, void *pData);
void *sqlite3Fts2HashFind(const fts2Hash*, const void *pKey, int nKey);
void sqlite3Fts2HashClear(fts2Hash*);

/*
** Shorthand for the functions above
*/
#define fts2HashInit   sqlite3Fts2HashInit
#define fts2HashInsert sqlite3Fts2HashInsert
#define fts2HashFind   sqlite3Fts2HashFind
#define fts2HashClear  sqlite3Fts2HashClear

/*
** Macros for looping over all elements of a hash table.  The idiom is
** like this:
**
**   fts2Hash h;
**   fts2HashElem *p;
**   ...
**   for(p=fts2HashFirst(&h); p; p=fts2HashNext(p)){
**     SomeStructure *pData = fts2HashData(p);
**     // do something with pData
**   }
*/
#define fts2HashFirst(H)  ((H)->first)
#define fts2HashNext(E)   ((E)->next)
#define fts2HashData(E)   ((E)->data)
#define fts2HashKey(E)    ((E)->pKey)
#define fts2HashKeysize(E) ((E)->nKey)

/*
** Number of entries in a hash table
*/
#define fts2HashCount(H)  ((H)->count)

#endif /* _FTS2_HASH_H_ */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































Deleted SQLite.Interop/FTS2/fts2_porter.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
/*
** 2006 September 30
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Implementation of the full-text-search tokenizer that implements
** a Porter stemmer.
*/

/*
** The code in this file is only compiled if:
**
**     * The FTS2 module is being built as an extension
**       (in which case SQLITE_CORE is not defined), or
**
**     * The FTS2 module is being built into the core of
**       SQLite (in which case SQLITE_ENABLE_FTS2 is defined).
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2)


#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

#include "fts2_tokenizer.h"

/*
** Class derived from sqlite3_tokenizer
*/
typedef struct porter_tokenizer {
  sqlite3_tokenizer base;      /* Base class */
} porter_tokenizer;

/*
** Class derived from sqlit3_tokenizer_cursor
*/
typedef struct porter_tokenizer_cursor {
  sqlite3_tokenizer_cursor base;
  const char *zInput;          /* input we are tokenizing */
  int nInput;                  /* size of the input */
  int iOffset;                 /* current position in zInput */
  int iToken;                  /* index of next token to be returned */
  char *zToken;                /* storage for current token */
  int nAllocated;              /* space allocated to zToken buffer */
} porter_tokenizer_cursor;


/* Forward declaration */
static const sqlite3_tokenizer_module porterTokenizerModule;


/*
** Create a new tokenizer instance.
*/
static int porterCreate(
  int argc, const char * const *argv,
  sqlite3_tokenizer **ppTokenizer
){
  porter_tokenizer *t;
  t = (porter_tokenizer *) calloc(sizeof(*t), 1);
  if( t==NULL ) return SQLITE_NOMEM;

  *ppTokenizer = &t->base;
  return SQLITE_OK;
}

/*
** Destroy a tokenizer
*/
static int porterDestroy(sqlite3_tokenizer *pTokenizer){
  free(pTokenizer);
  return SQLITE_OK;
}

/*
** Prepare to begin tokenizing a particular string.  The input
** string to be tokenized is zInput[0..nInput-1].  A cursor
** used to incrementally tokenize this string is returned in 
** *ppCursor.
*/
static int porterOpen(
  sqlite3_tokenizer *pTokenizer,         /* The tokenizer */
  const char *zInput, int nInput,        /* String to be tokenized */
  sqlite3_tokenizer_cursor **ppCursor    /* OUT: Tokenization cursor */
){
  porter_tokenizer_cursor *c;

  c = (porter_tokenizer_cursor *) malloc(sizeof(*c));
  if( c==NULL ) return SQLITE_NOMEM;

  c->zInput = zInput;
  if( zInput==0 ){
    c->nInput = 0;
  }else if( nInput<0 ){
    c->nInput = (int)strlen(zInput);
  }else{
    c->nInput = nInput;
  }
  c->iOffset = 0;                 /* start tokenizing at the beginning */
  c->iToken = 0;
  c->zToken = NULL;               /* no space allocated, yet. */
  c->nAllocated = 0;

  *ppCursor = &c->base;
  return SQLITE_OK;
}

/*
** Close a tokenization cursor previously opened by a call to
** porterOpen() above.
*/
static int porterClose(sqlite3_tokenizer_cursor *pCursor){
  porter_tokenizer_cursor *c = (porter_tokenizer_cursor *) pCursor;
  free(c->zToken);
  free(c);
  return SQLITE_OK;
}
/*
** Vowel or consonant
*/
static const char cType[] = {
   0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0,
   1, 1, 1, 2, 1
};

/*
** isConsonant() and isVowel() determine if their first character in
** the string they point to is a consonant or a vowel, according
** to Porter ruls.  
**
** A consonate is any letter other than 'a', 'e', 'i', 'o', or 'u'.
** 'Y' is a consonant unless it follows another consonant,
** in which case it is a vowel.
**
** In these routine, the letters are in reverse order.  So the 'y' rule
** is that 'y' is a consonant unless it is followed by another
** consonent.
*/
static int isVowel(const char*);
static int isConsonant(const char *z){
  int j;
  char x = *z;
  if( x==0 ) return 0;
  assert( x>='a' && x<='z' );
  j = cType[x-'a'];
  if( j<2 ) return j;
  return z[1]==0 || isVowel(z + 1);
}
static int isVowel(const char *z){
  int j;
  char x = *z;
  if( x==0 ) return 0;
  assert( x>='a' && x<='z' );
  j = cType[x-'a'];
  if( j<2 ) return 1-j;
  return isConsonant(z + 1);
}

/*
** Let any sequence of one or more vowels be represented by V and let
** C be sequence of one or more consonants.  Then every word can be
** represented as:
**
**           [C] (VC){m} [V]
**
** In prose:  A word is an optional consonant followed by zero or
** vowel-consonant pairs followed by an optional vowel.  "m" is the
** number of vowel consonant pairs.  This routine computes the value
** of m for the first i bytes of a word.
**
** Return true if the m-value for z is 1 or more.  In other words,
** return true if z contains at least one vowel that is followed
** by a consonant.
**
** In this routine z[] is in reverse order.  So we are really looking
** for an instance of of a consonant followed by a vowel.
*/
static int m_gt_0(const char *z){
  while( isVowel(z) ){ z++; }
  if( *z==0 ) return 0;
  while( isConsonant(z) ){ z++; }
  return *z!=0;
}

/* Like mgt0 above except we are looking for a value of m which is
** exactly 1
*/
static int m_eq_1(const char *z){
  while( isVowel(z) ){ z++; }
  if( *z==0 ) return 0;
  while( isConsonant(z) ){ z++; }
  if( *z==0 ) return 0;
  while( isVowel(z) ){ z++; }
  if( *z==0 ) return 1;
  while( isConsonant(z) ){ z++; }
  return *z==0;
}

/* Like mgt0 above except we are looking for a value of m>1 instead
** or m>0
*/
static int m_gt_1(const char *z){
  while( isVowel(z) ){ z++; }
  if( *z==0 ) return 0;
  while( isConsonant(z) ){ z++; }
  if( *z==0 ) return 0;
  while( isVowel(z) ){ z++; }
  if( *z==0 ) return 0;
  while( isConsonant(z) ){ z++; }
  return *z!=0;
}

/*
** Return TRUE if there is a vowel anywhere within z[0..n-1]
*/
static int hasVowel(const char *z){
  while( isConsonant(z) ){ z++; }
  return *z!=0;
}

/*
** Return TRUE if the word ends in a double consonant.
**
** The text is reversed here. So we are really looking at
** the first two characters of z[].
*/
static int doubleConsonant(const char *z){
  return isConsonant(z) && z[0]==z[1] && isConsonant(z+1);
}

/*
** Return TRUE if the word ends with three letters which
** are consonant-vowel-consonent and where the final consonant
** is not 'w', 'x', or 'y'.
**
** The word is reversed here.  So we are really checking the
** first three letters and the first one cannot be in [wxy].
*/
static int star_oh(const char *z){
  return
    z[0]!=0 && isConsonant(z) &&
    z[0]!='w' && z[0]!='x' && z[0]!='y' &&
    z[1]!=0 && isVowel(z+1) &&
    z[2]!=0 && isConsonant(z+2);
}

/*
** If the word ends with zFrom and xCond() is true for the stem
** of the word that preceeds the zFrom ending, then change the 
** ending to zTo.
**
** The input word *pz and zFrom are both in reverse order.  zTo
** is in normal order. 
**
** Return TRUE if zFrom matches.  Return FALSE if zFrom does not
** match.  Not that TRUE is returned even if xCond() fails and
** no substitution occurs.
*/
static int stem(
  char **pz,             /* The word being stemmed (Reversed) */
  const char *zFrom,     /* If the ending matches this... (Reversed) */
  const char *zTo,       /* ... change the ending to this (not reversed) */
  int (*xCond)(const char*)   /* Condition that must be true */
){
  char *z = *pz;
  while( *zFrom && *zFrom==*z ){ z++; zFrom++; }
  if( *zFrom!=0 ) return 0;
  if( xCond && !xCond(z) ) return 1;
  while( *zTo ){
    *(--z) = *(zTo++);
  }
  *pz = z;
  return 1;
}

/*
** This is the fallback stemmer used when the porter stemmer is
** inappropriate.  The input word is copied into the output with
** US-ASCII case folding.  If the input word is too long (more
** than 20 bytes if it contains no digits or more than 6 bytes if
** it contains digits) then word is truncated to 20 or 6 bytes
** by taking 10 or 3 bytes from the beginning and end.
*/
static void copy_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){
  int i, mx, j;
  int hasDigit = 0;
  for(i=0; i<nIn; i++){
    int c = zIn[i];
    if( c>='A' && c<='Z' ){
      zOut[i] = c - 'A' + 'a';
    }else{
      if( c>='0' && c<='9' ) hasDigit = 1;
      zOut[i] = c;
    }
  }
  mx = hasDigit ? 3 : 10;
  if( nIn>mx*2 ){
    for(j=mx, i=nIn-mx; i<nIn; i++, j++){
      zOut[j] = zOut[i];
    }
    i = j;
  }
  zOut[i] = 0;
  *pnOut = i;
}


/*
** Stem the input word zIn[0..nIn-1].  Store the output in zOut.
** zOut is at least big enough to hold nIn bytes.  Write the actual
** size of the output word (exclusive of the '\0' terminator) into *pnOut.
**
** Any upper-case characters in the US-ASCII character set ([A-Z])
** are converted to lower case.  Upper-case UTF characters are
** unchanged.
**
** Words that are longer than about 20 bytes are stemmed by retaining
** a few bytes from the beginning and the end of the word.  If the
** word contains digits, 3 bytes are taken from the beginning and
** 3 bytes from the end.  For long words without digits, 10 bytes
** are taken from each end.  US-ASCII case folding still applies.
** 
** If the input word contains not digits but does characters not 
** in [a-zA-Z] then no stemming is attempted and this routine just 
** copies the input into the input into the output with US-ASCII
** case folding.
**
** Stemming never increases the length of the word.  So there is
** no chance of overflowing the zOut buffer.
*/
static void porter_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){
  int i, j, c;
  char zReverse[28];
  char *z, *z2;
  if( nIn<3 || nIn>=sizeof(zReverse)-7 ){
    /* The word is too big or too small for the porter stemmer.
    ** Fallback to the copy stemmer */
    copy_stemmer(zIn, nIn, zOut, pnOut);
    return;
  }
  for(i=0, j=sizeof(zReverse)-6; i<nIn; i++, j--){
    c = zIn[i];
    if( c>='A' && c<='Z' ){
      zReverse[j] = c + 'a' - 'A';
    }else if( c>='a' && c<='z' ){
      zReverse[j] = c;
    }else{
      /* The use of a character not in [a-zA-Z] means that we fallback
      ** to the copy stemmer */
      copy_stemmer(zIn, nIn, zOut, pnOut);
      return;
    }
  }
  memset(&zReverse[sizeof(zReverse)-5], 0, 5);
  z = &zReverse[j+1];


  /* Step 1a */
  if( z[0]=='s' ){
    if(
     !stem(&z, "sess", "ss", 0) &&
     !stem(&z, "sei", "i", 0)  &&
     !stem(&z, "ss", "ss", 0)
    ){
      z++;
    }
  }

  /* Step 1b */  
  z2 = z;
  if( stem(&z, "dee", "ee", m_gt_0) ){
    /* Do nothing.  The work was all in the test */
  }else if( 
     (stem(&z, "gni", "", hasVowel) || stem(&z, "de", "", hasVowel))
      && z!=z2
  ){
     if( stem(&z, "ta", "ate", 0) ||
         stem(&z, "lb", "ble", 0) ||
         stem(&z, "zi", "ize", 0) ){
       /* Do nothing.  The work was all in the test */
     }else if( doubleConsonant(z) && (*z!='l' && *z!='s' && *z!='z') ){
       z++;
     }else if( m_eq_1(z) && star_oh(z) ){
       *(--z) = 'e';
     }
  }

  /* Step 1c */
  if( z[0]=='y' && hasVowel(z+1) ){
    z[0] = 'i';
  }

  /* Step 2 */
  switch( z[1] ){
   case 'a':
     stem(&z, "lanoita", "ate", m_gt_0) ||
     stem(&z, "lanoit", "tion", m_gt_0);
     break;
   case 'c':
     stem(&z, "icne", "ence", m_gt_0) ||
     stem(&z, "icna", "ance", m_gt_0);
     break;
   case 'e':
     stem(&z, "rezi", "ize", m_gt_0);
     break;
   case 'g':
     stem(&z, "igol", "log", m_gt_0);
     break;
   case 'l':
     stem(&z, "ilb", "ble", m_gt_0) ||
     stem(&z, "illa", "al", m_gt_0) ||
     stem(&z, "iltne", "ent", m_gt_0) ||
     stem(&z, "ile", "e", m_gt_0) ||
     stem(&z, "ilsuo", "ous", m_gt_0);
     break;
   case 'o':
     stem(&z, "noitazi", "ize", m_gt_0) ||
     stem(&z, "noita", "ate", m_gt_0) ||
     stem(&z, "rota", "ate", m_gt_0);
     break;
   case 's':
     stem(&z, "msila", "al", m_gt_0) ||
     stem(&z, "ssenevi", "ive", m_gt_0) ||
     stem(&z, "ssenluf", "ful", m_gt_0) ||
     stem(&z, "ssensuo", "ous", m_gt_0);
     break;
   case 't':
     stem(&z, "itila", "al", m_gt_0) ||
     stem(&z, "itivi", "ive", m_gt_0) ||
     stem(&z, "itilib", "ble", m_gt_0);
     break;
  }

  /* Step 3 */
  switch( z[0] ){
   case 'e':
     stem(&z, "etaci", "ic", m_gt_0) ||
     stem(&z, "evita", "", m_gt_0)   ||
     stem(&z, "ezila", "al", m_gt_0);
     break;
   case 'i':
     stem(&z, "itici", "ic", m_gt_0);
     break;
   case 'l':
     stem(&z, "laci", "ic", m_gt_0) ||
     stem(&z, "luf", "", m_gt_0);
     break;
   case 's':
     stem(&z, "ssen", "", m_gt_0);
     break;
  }

  /* Step 4 */
  switch( z[1] ){
   case 'a':
     if( z[0]=='l' && m_gt_1(z+2) ){
       z += 2;
     }
     break;
   case 'c':
     if( z[0]=='e' && z[2]=='n' && (z[3]=='a' || z[3]=='e')  && m_gt_1(z+4)  ){
       z += 4;
     }
     break;
   case 'e':
     if( z[0]=='r' && m_gt_1(z+2) ){
       z += 2;
     }
     break;
   case 'i':
     if( z[0]=='c' && m_gt_1(z+2) ){
       z += 2;
     }
     break;
   case 'l':
     if( z[0]=='e' && z[2]=='b' && (z[3]=='a' || z[3]=='i') && m_gt_1(z+4) ){
       z += 4;
     }
     break;
   case 'n':
     if( z[0]=='t' ){
       if( z[2]=='a' ){
         if( m_gt_1(z+3) ){
           z += 3;
         }
       }else if( z[2]=='e' ){
         stem(&z, "tneme", "", m_gt_1) ||
         stem(&z, "tnem", "", m_gt_1) ||
         stem(&z, "tne", "", m_gt_1);
       }
     }
     break;
   case 'o':
     if( z[0]=='u' ){
       if( m_gt_1(z+2) ){
         z += 2;
       }
     }else if( z[3]=='s' || z[3]=='t' ){
       stem(&z, "noi", "", m_gt_1);
     }
     break;
   case 's':
     if( z[0]=='m' && z[2]=='i' && m_gt_1(z+3) ){
       z += 3;
     }
     break;
   case 't':
     stem(&z, "eta", "", m_gt_1) ||
     stem(&z, "iti", "", m_gt_1);
     break;
   case 'u':
     if( z[0]=='s' && z[2]=='o' && m_gt_1(z+3) ){
       z += 3;
     }
     break;
   case 'v':
   case 'z':
     if( z[0]=='e' && z[2]=='i' && m_gt_1(z+3) ){
       z += 3;
     }
     break;
  }

  /* Step 5a */
  if( z[0]=='e' ){
    if( m_gt_1(z+1) ){
      z++;
    }else if( m_eq_1(z+1) && !star_oh(z+1) ){
      z++;
    }
  }

  /* Step 5b */
  if( m_gt_1(z) && z[0]=='l' && z[1]=='l' ){
    z++;
  }

  /* z[] is now the stemmed word in reverse order.  Flip it back
  ** around into forward order and return.
  */
  *pnOut = i = strlen(z);
  zOut[i] = 0;
  while( *z ){
    zOut[--i] = *(z++);
  }
}

/*
** Characters that can be part of a token.  We assume any character
** whose value is greater than 0x80 (any UTF character) can be
** part of a token.  In other words, delimiters all must have
** values of 0x7f or lower.
*/
static const char porterIdChar[] = {
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  /* 3x */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 4x */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,  /* 5x */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 6x */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,  /* 7x */
};
#define isDelim(C) (((ch=C)&0x80)==0 && (ch<0x30 || !porterIdChar[ch-0x30]))

/*
** Extract the next token from a tokenization cursor.  The cursor must
** have been opened by a prior call to porterOpen().
*/
static int porterNext(
  sqlite3_tokenizer_cursor *pCursor,  /* Cursor returned by porterOpen */
  const char **pzToken,               /* OUT: *pzToken is the token text */
  int *pnBytes,                       /* OUT: Number of bytes in token */
  int *piStartOffset,                 /* OUT: Starting offset of token */
  int *piEndOffset,                   /* OUT: Ending offset of token */
  int *piPosition                     /* OUT: Position integer of token */
){
  porter_tokenizer_cursor *c = (porter_tokenizer_cursor *) pCursor;
  const char *z = c->zInput;

  while( c->iOffset<c->nInput ){
    int iStartOffset, ch;

    /* Scan past delimiter characters */
    while( c->iOffset<c->nInput && isDelim(z[c->iOffset]) ){
      c->iOffset++;
    }

    /* Count non-delimiter characters. */
    iStartOffset = c->iOffset;
    while( c->iOffset<c->nInput && !isDelim(z[c->iOffset]) ){
      c->iOffset++;
    }

    if( c->iOffset>iStartOffset ){
      int n = c->iOffset-iStartOffset;
      if( n>c->nAllocated ){
        c->nAllocated = n+20;
        c->zToken = realloc(c->zToken, c->nAllocated);
        if( c->zToken==NULL ) return SQLITE_NOMEM;
      }
      porter_stemmer(&z[iStartOffset], n, c->zToken, pnBytes);
      *pzToken = c->zToken;
      *piStartOffset = iStartOffset;
      *piEndOffset = c->iOffset;
      *piPosition = c->iToken++;
      return SQLITE_OK;
    }
  }
  return SQLITE_DONE;
}

/*
** The set of routines that implement the porter-stemmer tokenizer
*/
static const sqlite3_tokenizer_module porterTokenizerModule = {
  0,
  porterCreate,
  porterDestroy,
  porterOpen,
  porterClose,
  porterNext,
};

/*
** Allocate a new porter tokenizer.  Return a pointer to the new
** tokenizer in *ppModule
*/
void sqlite3Fts2PorterTokenizerModule(
  sqlite3_tokenizer_module const**ppModule
){
  *ppModule = &porterTokenizerModule;
}

#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/FTS2/fts2_tokenizer.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
/*
** 2007 June 22
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This is part of an SQLite module implementing full-text search.
** This particular file implements the generic tokenizer interface.
*/

/*
** The code in this file is only compiled if:
**
**     * The FTS2 module is being built as an extension
**       (in which case SQLITE_CORE is not defined), or
**
**     * The FTS2 module is being built into the core of
**       SQLite (in which case SQLITE_ENABLE_FTS2 is defined).
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2)


#include "sqlite3.h"
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1

#include "fts2_hash.h"
#include "fts2_tokenizer.h"
#include <assert.h>

/*
** Implementation of the SQL scalar function for accessing the underlying 
** hash table. This function may be called as follows:
**
**   SELECT <function-name>(<key-name>);
**   SELECT <function-name>(<key-name>, <pointer>);
**
** where <function-name> is the name passed as the second argument
** to the sqlite3Fts2InitHashTable() function (e.g. 'fts2_tokenizer').
**
** If the <pointer> argument is specified, it must be a blob value
** containing a pointer to be stored as the hash data corresponding
** to the string <key-name>. If <pointer> is not specified, then
** the string <key-name> must already exist in the has table. Otherwise,
** an error is returned.
**
** Whether or not the <pointer> argument is specified, the value returned
** is a blob containing the pointer stored as the hash data corresponding
** to string <key-name> (after the hash-table is updated, if applicable).
*/
static void scalarFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  fts2Hash *pHash;
  void *pPtr = 0;
  const unsigned char *zName;
  int nName;

  assert( argc==1 || argc==2 );

  pHash = (fts2Hash *)sqlite3_user_data(context);

  zName = sqlite3_value_text(argv[0]);
  nName = sqlite3_value_bytes(argv[0])+1;

  if( argc==2 ){
    void *pOld;
    int n = sqlite3_value_bytes(argv[1]);
    if( n!=sizeof(pPtr) ){
      sqlite3_result_error(context, "argument type mismatch", -1);
      return;
    }
    pPtr = *(void **)sqlite3_value_blob(argv[1]);
    pOld = sqlite3Fts2HashInsert(pHash, (void *)zName, nName, pPtr);
    if( pOld==pPtr ){
      sqlite3_result_error(context, "out of memory", -1);
      return;
    }
  }else{
    pPtr = sqlite3Fts2HashFind(pHash, zName, nName);
    if( !pPtr ){
      char *zErr = sqlite3_mprintf("unknown tokenizer: %s", zName);
      sqlite3_result_error(context, zErr, -1);
      sqlite3_free(zErr);
      return;
    }
  }

  sqlite3_result_blob(context, (void *)&pPtr, sizeof(pPtr), SQLITE_TRANSIENT);
}

#ifdef SQLITE_TEST

#include <tcl.h>
#include <string.h>

/*
** Implementation of a special SQL scalar function for testing tokenizers 
** designed to be used in concert with the Tcl testing framework. This
** function must be called with two arguments:
**
**   SELECT <function-name>(<key-name>, <input-string>);
**   SELECT <function-name>(<key-name>, <pointer>);
**
** where <function-name> is the name passed as the second argument
** to the sqlite3Fts2InitHashTable() function (e.g. 'fts2_tokenizer')
** concatenated with the string '_test' (e.g. 'fts2_tokenizer_test').
**
** The return value is a string that may be interpreted as a Tcl
** list. For each token in the <input-string>, three elements are
** added to the returned list. The first is the token position, the 
** second is the token text (folded, stemmed, etc.) and the third is the
** substring of <input-string> associated with the token. For example, 
** using the built-in "simple" tokenizer:
**
**   SELECT fts_tokenizer_test('simple', 'I don't see how');
**
** will return the string:
**
**   "{0 i I 1 dont don't 2 see see 3 how how}"
**   
*/
static void testFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  fts2Hash *pHash;
  sqlite3_tokenizer_module *p;
  sqlite3_tokenizer *pTokenizer = 0;
  sqlite3_tokenizer_cursor *pCsr = 0;

  const char *zErr = 0;

  const char *zName;
  int nName;
  const char *zInput;
  int nInput;

  const char *zArg = 0;

  const char *zToken;
  int nToken;
  int iStart;
  int iEnd;
  int iPos;

  Tcl_Obj *pRet;

  assert( argc==2 || argc==3 );

  nName = sqlite3_value_bytes(argv[0]);
  zName = (const char *)sqlite3_value_text(argv[0]);
  nInput = sqlite3_value_bytes(argv[argc-1]);
  zInput = (const char *)sqlite3_value_text(argv[argc-1]);

  if( argc==3 ){
    zArg = (const char *)sqlite3_value_text(argv[1]);
  }

  pHash = (fts2Hash *)sqlite3_user_data(context);
  p = (sqlite3_tokenizer_module *)sqlite3Fts2HashFind(pHash, zName, nName+1);

  if( !p ){
    char *zErr = sqlite3_mprintf("unknown tokenizer: %s", zName);
    sqlite3_result_error(context, zErr, -1);
    sqlite3_free(zErr);
    return;
  }

  pRet = Tcl_NewObj();
  Tcl_IncrRefCount(pRet);

  if( SQLITE_OK!=p->xCreate(zArg ? 1 : 0, &zArg, &pTokenizer) ){
    zErr = "error in xCreate()";
    goto finish;
  }
  pTokenizer->pModule = p;
  if( SQLITE_OK!=p->xOpen(pTokenizer, zInput, nInput, &pCsr) ){
    zErr = "error in xOpen()";
    goto finish;
  }
  pCsr->pTokenizer = pTokenizer;

  while( SQLITE_OK==p->xNext(pCsr, &zToken, &nToken, &iStart, &iEnd, &iPos) ){
    Tcl_ListObjAppendElement(0, pRet, Tcl_NewIntObj(iPos));
    Tcl_ListObjAppendElement(0, pRet, Tcl_NewStringObj(zToken, nToken));
    zToken = &zInput[iStart];
    nToken = iEnd-iStart;
    Tcl_ListObjAppendElement(0, pRet, Tcl_NewStringObj(zToken, nToken));
  }

  if( SQLITE_OK!=p->xClose(pCsr) ){
    zErr = "error in xClose()";
    goto finish;
  }
  if( SQLITE_OK!=p->xDestroy(pTokenizer) ){
    zErr = "error in xDestroy()";
    goto finish;
  }

finish:
  if( zErr ){
    sqlite3_result_error(context, zErr, -1);
  }else{
    sqlite3_result_text(context, Tcl_GetString(pRet), -1, SQLITE_TRANSIENT);
  }
  Tcl_DecrRefCount(pRet);
}

static
int registerTokenizer(
  sqlite3 *db, 
  char *zName, 
  const sqlite3_tokenizer_module *p
){
  int rc;
  sqlite3_stmt *pStmt;
  const char zSql[] = "SELECT fts2_tokenizer(?, ?)";

  rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
  if( rc!=SQLITE_OK ){
    return rc;
  }

  sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC);
  sqlite3_bind_blob(pStmt, 2, &p, sizeof(p), SQLITE_STATIC);
  sqlite3_step(pStmt);

  return sqlite3_finalize(pStmt);
}

static
int queryTokenizer(
  sqlite3 *db, 
  char *zName,  
  const sqlite3_tokenizer_module **pp
){
  int rc;
  sqlite3_stmt *pStmt;
  const char zSql[] = "SELECT fts2_tokenizer(?)";

  *pp = 0;
  rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
  if( rc!=SQLITE_OK ){
    return rc;
  }

  sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC);
  if( SQLITE_ROW==sqlite3_step(pStmt) ){
    if( sqlite3_column_type(pStmt, 0)==SQLITE_BLOB ){
      memcpy(pp, sqlite3_column_blob(pStmt, 0), sizeof(*pp));
    }
  }

  return sqlite3_finalize(pStmt);
}

void sqlite3Fts2SimpleTokenizerModule(sqlite3_tokenizer_module const**ppModule);

/*
** Implementation of the scalar function fts2_tokenizer_internal_test().
** This function is used for testing only, it is not included in the
** build unless SQLITE_TEST is defined.
**
** The purpose of this is to test that the fts2_tokenizer() function
** can be used as designed by the C-code in the queryTokenizer and
** registerTokenizer() functions above. These two functions are repeated
** in the README.tokenizer file as an example, so it is important to
** test them.
**
** To run the tests, evaluate the fts2_tokenizer_internal_test() scalar
** function with no arguments. An assert() will fail if a problem is
** detected. i.e.:
**
**     SELECT fts2_tokenizer_internal_test();
**
*/
static void intTestFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  int rc;
  const sqlite3_tokenizer_module *p1;
  const sqlite3_tokenizer_module *p2;
  sqlite3 *db = (sqlite3 *)sqlite3_user_data(context);

  /* Test the query function */
  sqlite3Fts2SimpleTokenizerModule(&p1);
  rc = queryTokenizer(db, "simple", &p2);
  assert( rc==SQLITE_OK );
  assert( p1==p2 );
  rc = queryTokenizer(db, "nosuchtokenizer", &p2);
  assert( rc==SQLITE_ERROR );
  assert( p2==0 );
  assert( 0==strcmp(sqlite3_errmsg(db), "unknown tokenizer: nosuchtokenizer") );

  /* Test the storage function */
  rc = registerTokenizer(db, "nosuchtokenizer", p1);
  assert( rc==SQLITE_OK );
  rc = queryTokenizer(db, "nosuchtokenizer", &p2);
  assert( rc==SQLITE_OK );
  assert( p2==p1 );

  sqlite3_result_text(context, "ok", -1, SQLITE_STATIC);
}

#endif

/*
** Set up SQL objects in database db used to access the contents of
** the hash table pointed to by argument pHash. The hash table must
** been initialised to use string keys, and to take a private copy 
** of the key when a value is inserted. i.e. by a call similar to:
**
**    sqlite3Fts2HashInit(pHash, FTS2_HASH_STRING, 1);
**
** This function adds a scalar function (see header comment above
** scalarFunc() in this file for details) and, if ENABLE_TABLE is
** defined at compilation time, a temporary virtual table (see header 
** comment above struct HashTableVtab) to the database schema. Both 
** provide read/write access to the contents of *pHash.
**
** The third argument to this function, zName, is used as the name
** of both the scalar and, if created, the virtual table.
*/
int sqlite3Fts2InitHashTable(
  sqlite3 *db, 
  fts2Hash *pHash, 
  const char *zName
){
  int rc = SQLITE_OK;
  void *p = (void *)pHash;
  const int any = SQLITE_ANY;
  char *zTest = 0;
  char *zTest2 = 0;

#ifdef SQLITE_TEST
  void *pdb = (void *)db;
  zTest = sqlite3_mprintf("%s_test", zName);
  zTest2 = sqlite3_mprintf("%s_internal_test", zName);
  if( !zTest || !zTest2 ){
    rc = SQLITE_NOMEM;
  }
#endif

  if( rc!=SQLITE_OK
   || (rc = sqlite3_create_function(db, zName, 1, any, p, scalarFunc, 0, 0))
   || (rc = sqlite3_create_function(db, zName, 2, any, p, scalarFunc, 0, 0))
#ifdef SQLITE_TEST
   || (rc = sqlite3_create_function(db, zTest, 2, any, p, testFunc, 0, 0))
   || (rc = sqlite3_create_function(db, zTest, 3, any, p, testFunc, 0, 0))
   || (rc = sqlite3_create_function(db, zTest2, 0, any, pdb, intTestFunc, 0, 0))
#endif
  );

  sqlite3_free(zTest);
  sqlite3_free(zTest2);
  return rc;
}

#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/FTS2/fts2_tokenizer.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
** 2006 July 10
**
** The author disclaims copyright to this source code.
**
*************************************************************************
** Defines the interface to tokenizers used by fulltext-search.  There
** are three basic components:
**
** sqlite3_tokenizer_module is a singleton defining the tokenizer
** interface functions.  This is essentially the class structure for
** tokenizers.
**
** sqlite3_tokenizer is used to define a particular tokenizer, perhaps
** including customization information defined at creation time.
**
** sqlite3_tokenizer_cursor is generated by a tokenizer to generate
** tokens from a particular input.
*/
#ifndef _FTS2_TOKENIZER_H_
#define _FTS2_TOKENIZER_H_

/* TODO(shess) Only used for SQLITE_OK and SQLITE_DONE at this time.
** If tokenizers are to be allowed to call sqlite3_*() functions, then
** we will need a way to register the API consistently.
*/
#include "sqlite3.h"

/*
** Structures used by the tokenizer interface. When a new tokenizer
** implementation is registered, the caller provides a pointer to
** an sqlite3_tokenizer_module containing pointers to the callback
** functions that make up an implementation.
**
** When an fts2 table is created, it passes any arguments passed to
** the tokenizer clause of the CREATE VIRTUAL TABLE statement to the
** sqlite3_tokenizer_module.xCreate() function of the requested tokenizer
** implementation. The xCreate() function in turn returns an 
** sqlite3_tokenizer structure representing the specific tokenizer to
** be used for the fts2 table (customized by the tokenizer clause arguments).
**
** To tokenize an input buffer, the sqlite3_tokenizer_module.xOpen()
** method is called. It returns an sqlite3_tokenizer_cursor object
** that may be used to tokenize a specific input buffer based on
** the tokenization rules supplied by a specific sqlite3_tokenizer
** object.
*/
typedef struct sqlite3_tokenizer_module sqlite3_tokenizer_module;
typedef struct sqlite3_tokenizer sqlite3_tokenizer;
typedef struct sqlite3_tokenizer_cursor sqlite3_tokenizer_cursor;

struct sqlite3_tokenizer_module {

  /*
  ** Structure version. Should always be set to 0.
  */
  int iVersion;

  /*
  ** Create a new tokenizer. The values in the argv[] array are the
  ** arguments passed to the "tokenizer" clause of the CREATE VIRTUAL
  ** TABLE statement that created the fts2 table. For example, if
  ** the following SQL is executed:
  **
  **   CREATE .. USING fts2( ... , tokenizer <tokenizer-name> arg1 arg2)
  **
  ** then argc is set to 2, and the argv[] array contains pointers
  ** to the strings "arg1" and "arg2".
  **
  ** This method should return either SQLITE_OK (0), or an SQLite error 
  ** code. If SQLITE_OK is returned, then *ppTokenizer should be set
  ** to point at the newly created tokenizer structure. The generic
  ** sqlite3_tokenizer.pModule variable should not be initialised by
  ** this callback. The caller will do so.
  */
  int (*xCreate)(
    int argc,                           /* Size of argv array */
    const char *const*argv,             /* Tokenizer argument strings */
    sqlite3_tokenizer **ppTokenizer     /* OUT: Created tokenizer */
  );

  /*
  ** Destroy an existing tokenizer. The fts2 module calls this method
  ** exactly once for each successful call to xCreate().
  */
  int (*xDestroy)(sqlite3_tokenizer *pTokenizer);

  /*
  ** Create a tokenizer cursor to tokenize an input buffer. The caller
  ** is responsible for ensuring that the input buffer remains valid
  ** until the cursor is closed (using the xClose() method). 
  */
  int (*xOpen)(
    sqlite3_tokenizer *pTokenizer,       /* Tokenizer object */
    const char *pInput, int nBytes,      /* Input buffer */
    sqlite3_tokenizer_cursor **ppCursor  /* OUT: Created tokenizer cursor */
  );

  /*
  ** Destroy an existing tokenizer cursor. The fts2 module calls this 
  ** method exactly once for each successful call to xOpen().
  */
  int (*xClose)(sqlite3_tokenizer_cursor *pCursor);

  /*
  ** Retrieve the next token from the tokenizer cursor pCursor. This
  ** method should either return SQLITE_OK and set the values of the
  ** "OUT" variables identified below, or SQLITE_DONE to indicate that
  ** the end of the buffer has been reached, or an SQLite error code.
  **
  ** *ppToken should be set to point at a buffer containing the 
  ** normalized version of the token (i.e. after any case-folding and/or
  ** stemming has been performed). *pnBytes should be set to the length
  ** of this buffer in bytes. The input text that generated the token is
  ** identified by the byte offsets returned in *piStartOffset and
  ** *piEndOffset.
  **
  ** The buffer *ppToken is set to point at is managed by the tokenizer
  ** implementation. It is only required to be valid until the next call
  ** to xNext() or xClose(). 
  */
  /* TODO(shess) current implementation requires pInput to be
  ** nul-terminated.  This should either be fixed, or pInput/nBytes
  ** should be converted to zInput.
  */
  int (*xNext)(
    sqlite3_tokenizer_cursor *pCursor,   /* Tokenizer cursor */
    const char **ppToken, int *pnBytes,  /* OUT: Normalized text for token */
    int *piStartOffset,  /* OUT: Byte offset of token in input buffer */
    int *piEndOffset,    /* OUT: Byte offset of end of token in input buffer */
    int *piPosition      /* OUT: Number of tokens returned before this one */
  );
};

struct sqlite3_tokenizer {
  const sqlite3_tokenizer_module *pModule;  /* The module for this tokenizer */
  /* Tokenizer implementations will typically add additional fields */
};

struct sqlite3_tokenizer_cursor {
  sqlite3_tokenizer *pTokenizer;       /* Tokenizer for this cursor. */
  /* Tokenizer implementations will typically add additional fields */
};

#endif /* _FTS2_TOKENIZER_H_ */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































Deleted SQLite.Interop/FTS2/fts2_tokenizer1.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
/*
** 2006 Oct 10
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** Implementation of the "simple" full-text-search tokenizer.
*/

/*
** The code in this file is only compiled if:
**
**     * The FTS2 module is being built as an extension
**       (in which case SQLITE_CORE is not defined), or
**
**     * The FTS2 module is being built into the core of
**       SQLite (in which case SQLITE_ENABLE_FTS2 is defined).
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2)


#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

#include "fts2_tokenizer.h"

typedef struct simple_tokenizer {
  sqlite3_tokenizer base;
  char delim[128];             /* flag ASCII delimiters */
} simple_tokenizer;

typedef struct simple_tokenizer_cursor {
  sqlite3_tokenizer_cursor base;
  const char *pInput;          /* input we are tokenizing */
  int nBytes;                  /* size of the input */
  int iOffset;                 /* current position in pInput */
  int iToken;                  /* index of next token to be returned */
  char *pToken;                /* storage for current token */
  int nTokenAllocated;         /* space allocated to zToken buffer */
} simple_tokenizer_cursor;


/* Forward declaration */
static const sqlite3_tokenizer_module simpleTokenizerModule;

static int simpleDelim(simple_tokenizer *t, unsigned char c){
  return c<0x80 && t->delim[c];
}

/*
** Create a new tokenizer instance.
*/
static int simpleCreate(
  int argc, const char * const *argv,
  sqlite3_tokenizer **ppTokenizer
){
  simple_tokenizer *t;

  t = (simple_tokenizer *) calloc(sizeof(*t), 1);
  if( t==NULL ) return SQLITE_NOMEM;

  /* TODO(shess) Delimiters need to remain the same from run to run,
  ** else we need to reindex.  One solution would be a meta-table to
  ** track such information in the database, then we'd only want this
  ** information on the initial create.
  */
  if( argc>1 ){
    int i, n = strlen(argv[1]);
    for(i=0; i<n; i++){
      unsigned char ch = argv[1][i];
      /* We explicitly don't support UTF-8 delimiters for now. */
      if( ch>=0x80 ){
        free(t);
        return SQLITE_ERROR;
      }
      t->delim[ch] = 1;
    }
  } else {
    /* Mark non-alphanumeric ASCII characters as delimiters */
    int i;
    for(i=1; i<0x80; i++){
      t->delim[i] = !isalnum(i);
    }
  }

  *ppTokenizer = &t->base;
  return SQLITE_OK;
}

/*
** Destroy a tokenizer
*/
static int simpleDestroy(sqlite3_tokenizer *pTokenizer){
  free(pTokenizer);
  return SQLITE_OK;
}

/*
** Prepare to begin tokenizing a particular string.  The input
** string to be tokenized is pInput[0..nBytes-1].  A cursor
** used to incrementally tokenize this string is returned in 
** *ppCursor.
*/
static int simpleOpen(
  sqlite3_tokenizer *pTokenizer,         /* The tokenizer */
  const char *pInput, int nBytes,        /* String to be tokenized */
  sqlite3_tokenizer_cursor **ppCursor    /* OUT: Tokenization cursor */
){
  simple_tokenizer_cursor *c;

  c = (simple_tokenizer_cursor *) malloc(sizeof(*c));
  if( c==NULL ) return SQLITE_NOMEM;

  c->pInput = pInput;
  if( pInput==0 ){
    c->nBytes = 0;
  }else if( nBytes<0 ){
    c->nBytes = (int)strlen(pInput);
  }else{
    c->nBytes = nBytes;
  }
  c->iOffset = 0;                 /* start tokenizing at the beginning */
  c->iToken = 0;
  c->pToken = NULL;               /* no space allocated, yet. */
  c->nTokenAllocated = 0;

  *ppCursor = &c->base;
  return SQLITE_OK;
}

/*
** Close a tokenization cursor previously opened by a call to
** simpleOpen() above.
*/
static int simpleClose(sqlite3_tokenizer_cursor *pCursor){
  simple_tokenizer_cursor *c = (simple_tokenizer_cursor *) pCursor;
  free(c->pToken);
  free(c);
  return SQLITE_OK;
}

/*
** Extract the next token from a tokenization cursor.  The cursor must
** have been opened by a prior call to simpleOpen().
*/
static int simpleNext(
  sqlite3_tokenizer_cursor *pCursor,  /* Cursor returned by simpleOpen */
  const char **ppToken,               /* OUT: *ppToken is the token text */
  int *pnBytes,                       /* OUT: Number of bytes in token */
  int *piStartOffset,                 /* OUT: Starting offset of token */
  int *piEndOffset,                   /* OUT: Ending offset of token */
  int *piPosition                     /* OUT: Position integer of token */
){
  simple_tokenizer_cursor *c = (simple_tokenizer_cursor *) pCursor;
  simple_tokenizer *t = (simple_tokenizer *) pCursor->pTokenizer;
  unsigned char *p = (unsigned char *)c->pInput;

  while( c->iOffset<c->nBytes ){
    int iStartOffset;

    /* Scan past delimiter characters */
    while( c->iOffset<c->nBytes && simpleDelim(t, p[c->iOffset]) ){
      c->iOffset++;
    }

    /* Count non-delimiter characters. */
    iStartOffset = c->iOffset;
    while( c->iOffset<c->nBytes && !simpleDelim(t, p[c->iOffset]) ){
      c->iOffset++;
    }

    if( c->iOffset>iStartOffset ){
      int i, n = c->iOffset-iStartOffset;
      if( n>c->nTokenAllocated ){
        c->nTokenAllocated = n+20;
        c->pToken = realloc(c->pToken, c->nTokenAllocated);
        if( c->pToken==NULL ) return SQLITE_NOMEM;
      }
      for(i=0; i<n; i++){
        /* TODO(shess) This needs expansion to handle UTF-8
        ** case-insensitivity.
        */
        unsigned char ch = p[iStartOffset+i];
        c->pToken[i] = ch<0x80 ? tolower(ch) : ch;
      }
      *ppToken = c->pToken;
      *pnBytes = n;
      *piStartOffset = iStartOffset;
      *piEndOffset = c->iOffset;
      *piPosition = c->iToken++;

      return SQLITE_OK;
    }
  }
  return SQLITE_DONE;
}

/*
** The set of routines that implement the simple tokenizer
*/
static const sqlite3_tokenizer_module simpleTokenizerModule = {
  0,
  simpleCreate,
  simpleDestroy,
  simpleOpen,
  simpleClose,
  simpleNext,
};

/*
** Allocate a new simple tokenizer.  Return a pointer to the new
** tokenizer in *ppModule
*/
void sqlite3Fts2SimpleTokenizerModule(
  sqlite3_tokenizer_module const**ppModule
){
  *ppModule = &simpleTokenizerModule;
}

#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS2) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































Added SQLite.Interop/SQLite.Interop.2005.vcproj.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
<?xml version="1.0" encoding="Windows-1252"?>
<!--
 *
 * SQLite.Interop.2005.vcproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<VisualStudioProject
	ProjectType="Visual C++"
	Version="8.00"
	Name="SQLite.Interop.2005"
	ProjectGUID="{53784BC1-A8BC-4AC8-8A3E-158D6807345A}"
	RootNamespace="SQLite.Interop"
	Keyword="Win32Proj"
	TargetFrameworkVersion="131072"
	>
	<Platforms>
		<Platform
			Name="Win32"
		/>
		<Platform
			Name="x64"
		/>
	</Platforms>
	<ToolFiles>
	</ToolFiles>
	<Configurations>
		<Configuration
			Name="Debug|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="3"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1400;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions="$(INTEROP_ASSEMBLY_RESOURCES)"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(ProjectDir)..\bin\$(ConfigurationYear)\$(ConfigurationName)Module\bin\System.Data.SQLite.netmodule $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_MIXED_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				AssemblyDebug="1"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_MIXED_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				LinkTimeCodeGeneration="1"
				ImportLibrary="$(OutDir)\$(INTEROP_MIXED_NAME).lib"
				TargetMachine="1"
				KeyFile="$(INTEROP_KEY_FILE)"
				DelaySign="true"
				CLRUnmanagedCodeCheck="true"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="&quot;$(FrameworkSDKDir)Bin\sn.exe&quot; -Ra &quot;$(TargetDir)$(INTEROP_MIXED_NAME).dll&quot; &quot;$(INTEROP_KEY_FILE)&quot;"
			/>
		</Configuration>
		<Configuration
			Name="Debug|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="3"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1400;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions="$(INTEROP_ASSEMBLY_RESOURCES)"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(ProjectDir)..\bin\$(ConfigurationYear)\$(ConfigurationName)Module\bin\System.Data.SQLite.netmodule $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_MIXED_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				AssemblyDebug="1"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_MIXED_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				LinkTimeCodeGeneration="1"
				ImportLibrary="$(OutDir)\$(INTEROP_MIXED_NAME).lib"
				TargetMachine="17"
				KeyFile="$(INTEROP_KEY_FILE)"
				DelaySign="true"
				CLRUnmanagedCodeCheck="true"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="&quot;$(FrameworkSDKDir)Bin\sn.exe&quot; -Ra &quot;$(TargetDir)$(INTEROP_MIXED_NAME).dll&quot; &quot;$(INTEROP_KEY_FILE)&quot;"
			/>
		</Configuration>
		<Configuration
			Name="DebugNativeOnly|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="3"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1400;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_NATIVE_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				AssemblyDebug="1"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_NATIVE_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				ImportLibrary="$(OutDir)\$(INTEROP_NATIVE_NAME).lib"
				TargetMachine="1"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="DebugNativeOnly|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="3"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1400;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_NATIVE_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				AssemblyDebug="1"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_NATIVE_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				ImportLibrary="$(OutDir)\$(INTEROP_NATIVE_NAME).lib"
				TargetMachine="17"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="Release|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="2"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1400;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions="$(INTEROP_ASSEMBLY_RESOURCES)"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(ProjectDir)..\bin\$(ConfigurationYear)\$(ConfigurationName)Module\bin\System.Data.SQLite.netmodule $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_MIXED_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_MIXED_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				LargeAddressAware="0"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				LinkTimeCodeGeneration="1"
				ImportLibrary="$(OutDir)\$(INTEROP_MIXED_NAME).lib"
				TargetMachine="1"
				KeyFile="$(INTEROP_KEY_FILE)"
				DelaySign="true"
				CLRUnmanagedCodeCheck="true"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="&quot;$(FrameworkSDKDir)Bin\sn.exe&quot; -Ra &quot;$(TargetDir)$(INTEROP_MIXED_NAME).dll&quot; &quot;$(INTEROP_KEY_FILE)&quot;"
			/>
		</Configuration>
		<Configuration
			Name="Release|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="2"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1400;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions="$(INTEROP_ASSEMBLY_RESOURCES)"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(ProjectDir)..\bin\$(ConfigurationYear)\$(ConfigurationName)Module\bin\System.Data.SQLite.netmodule $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_MIXED_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_MIXED_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				LargeAddressAware="0"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				LinkTimeCodeGeneration="1"
				ImportLibrary="$(OutDir)\$(INTEROP_MIXED_NAME).lib"
				TargetMachine="17"
				KeyFile="$(INTEROP_KEY_FILE)"
				DelaySign="true"
				CLRUnmanagedCodeCheck="true"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="&quot;$(FrameworkSDKDir)Bin\sn.exe&quot; -Ra &quot;$(TargetDir)$(INTEROP_MIXED_NAME).dll&quot; &quot;$(INTEROP_KEY_FILE)&quot;"
			/>
		</Configuration>
		<Configuration
			Name="ReleaseNativeOnly|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="2"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1400;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_NATIVE_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_NATIVE_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				LargeAddressAware="0"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				ImportLibrary="$(OutDir)\$(INTEROP_NATIVE_NAME).lib"
				TargetMachine="1"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="ReleaseNativeOnly|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="2"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1400;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_NATIVE_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_NATIVE_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				LargeAddressAware="0"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				ImportLibrary="$(OutDir)\$(INTEROP_NATIVE_NAME).lib"
				TargetMachine="17"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
	</Configurations>
	<References>
	</References>
	<Files>
		<Filter
			Name="Source Files"
			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
			>
			<File
				RelativePath=".\src\win\AssemblyInfo.cpp"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\win\crypt.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\contrib\extension-functions.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\fts5.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\percentile.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\regexp.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\sha1.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\shathree.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\totype.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\vtshim.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\generic\interop.c"
				>
			</File>
			<File
				RelativePath=".\src\core\sqlite3.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
		</Filter>
		<Filter
			Name="Header Files"
			Filter="h;hpp;hxx;hm;inl;inc;xsd"
			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
			>
			<File
				RelativePath=".\src\core\sqlite3.h"
				>
			</File>
			<File
				RelativePath=".\src\core\sqlite3ext.h"
				>
			</File>
			<File
				RelativePath=".\src\generic\interop.h"
				>
			</File>
		</Filter>
		<Filter
			Name="Resource Files"
			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
			>
			<File
				RelativePath=".\src\win\SQLite.Interop.rc"
				>
			</File>
			<File
				RelativePath="..\System.Data.SQLite\Resources\SR.resx"
				>
				<FileConfiguration
					Name="Debug|Win32"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\$(INTEROP_MIXED_NAME).$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\$(INTEROP_MIXED_NAME).$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\$(INTEROP_MIXED_NAME).$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\$(INTEROP_MIXED_NAME).$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
			</File>
		</Filter>
		<Filter
			Name="Property Files"
			>
			<File
				RelativePath=".\props\include.vsprops"
				>
			</File>
			<File
				RelativePath=".\props\SQLite.Interop.2005.vsprops"
				>
			</File>
			<File
				RelativePath=".\props\sqlite3.vsprops"
				>
			</File>
		</Filter>
	</Files>
	<Globals>
	</Globals>
</VisualStudioProject>

Added SQLite.Interop/SQLite.Interop.2008.vcproj.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
<?xml version="1.0" encoding="Windows-1252"?>
<!--
 *
 * SQLite.Interop.2008.vcproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<VisualStudioProject
	ProjectType="Visual C++"
	Version="9.00"
	Name="SQLite.Interop.2008"
	ProjectGUID="{53784BC1-A8BC-4AC8-8A3E-158D6807345A}"
	RootNamespace="SQLite.Interop"
	Keyword="Win32Proj"
	TargetFrameworkVersion="131072"
	>
	<Platforms>
		<Platform
			Name="Win32"
		/>
		<Platform
			Name="x64"
		/>
	</Platforms>
	<ToolFiles>
	</ToolFiles>
	<Configurations>
		<Configuration
			Name="Debug|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="3"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1500;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions="$(INTEROP_ASSEMBLY_RESOURCES)"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(ProjectDir)..\bin\$(ConfigurationYear)\$(ConfigurationName)Module\bin\System.Data.SQLite.netmodule $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_MIXED_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				AssemblyDebug="1"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_MIXED_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				LinkTimeCodeGeneration="1"
				ImportLibrary="$(OutDir)\$(INTEROP_MIXED_NAME).lib"
				TargetMachine="1"
				KeyFile="$(INTEROP_KEY_FILE)"
				DelaySign="true"
				CLRUnmanagedCodeCheck="true"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="&quot;$(FrameworkSDKDir)Bin\sn.exe&quot; -Ra &quot;$(TargetDir)$(INTEROP_MIXED_NAME).dll&quot; &quot;$(INTEROP_KEY_FILE)&quot;"
			/>
		</Configuration>
		<Configuration
			Name="Debug|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="3"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1500;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions="$(INTEROP_ASSEMBLY_RESOURCES)"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(ProjectDir)..\bin\$(ConfigurationYear)\$(ConfigurationName)Module\bin\System.Data.SQLite.netmodule $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_MIXED_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				AssemblyDebug="1"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_MIXED_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				LinkTimeCodeGeneration="1"
				ImportLibrary="$(OutDir)\$(INTEROP_MIXED_NAME).lib"
				TargetMachine="17"
				KeyFile="$(INTEROP_KEY_FILE)"
				DelaySign="true"
				CLRUnmanagedCodeCheck="true"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="&quot;$(FrameworkSDKDir)Bin\sn.exe&quot; -Ra &quot;$(TargetDir)$(INTEROP_MIXED_NAME).dll&quot; &quot;$(INTEROP_KEY_FILE)&quot;"
			/>
		</Configuration>
		<Configuration
			Name="DebugNativeOnly|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="3"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1500;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_NATIVE_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				AssemblyDebug="1"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_NATIVE_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				ImportLibrary="$(OutDir)\$(INTEROP_NATIVE_NAME).lib"
				TargetMachine="1"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="DebugNativeOnly|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="3"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1500;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_NATIVE_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				AssemblyDebug="1"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_NATIVE_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				ImportLibrary="$(OutDir)\$(INTEROP_NATIVE_NAME).lib"
				TargetMachine="17"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="Release|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="2"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1500;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions="$(INTEROP_ASSEMBLY_RESOURCES)"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(ProjectDir)..\bin\$(ConfigurationYear)\$(ConfigurationName)Module\bin\System.Data.SQLite.netmodule $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_MIXED_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_MIXED_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				LargeAddressAware="0"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				LinkTimeCodeGeneration="1"
				ImportLibrary="$(OutDir)\$(INTEROP_MIXED_NAME).lib"
				TargetMachine="1"
				KeyFile="$(INTEROP_KEY_FILE)"
				DelaySign="true"
				CLRUnmanagedCodeCheck="true"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="&quot;$(FrameworkSDKDir)Bin\sn.exe&quot; -Ra &quot;$(TargetDir)$(INTEROP_MIXED_NAME).dll&quot; &quot;$(INTEROP_KEY_FILE)&quot;"
			/>
		</Configuration>
		<Configuration
			Name="Release|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="2"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1500;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions="$(INTEROP_ASSEMBLY_RESOURCES)"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(ProjectDir)..\bin\$(ConfigurationYear)\$(ConfigurationName)Module\bin\System.Data.SQLite.netmodule $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_MIXED_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_MIXED_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				LargeAddressAware="0"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				LinkTimeCodeGeneration="1"
				ImportLibrary="$(OutDir)\$(INTEROP_MIXED_NAME).lib"
				TargetMachine="17"
				KeyFile="$(INTEROP_KEY_FILE)"
				DelaySign="true"
				CLRUnmanagedCodeCheck="true"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="&quot;$(FrameworkSDKDir)Bin\sn.exe&quot; -Ra &quot;$(TargetDir)$(INTEROP_MIXED_NAME).dll&quot; &quot;$(INTEROP_KEY_FILE)&quot;"
			/>
		</Configuration>
		<Configuration
			Name="ReleaseNativeOnly|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="2"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1500;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_NATIVE_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_NATIVE_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				LargeAddressAware="0"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				ImportLibrary="$(OutDir)\$(INTEROP_NATIVE_NAME).lib"
				TargetMachine="1"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="ReleaseNativeOnly|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="2"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1500;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_NATIVE_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_NATIVE_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				LargeAddressAware="0"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				ImportLibrary="$(OutDir)\$(INTEROP_NATIVE_NAME).lib"
				TargetMachine="17"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
	</Configurations>
	<References>
	</References>
	<Files>
		<Filter
			Name="Source Files"
			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
			>
			<File
				RelativePath=".\src\win\AssemblyInfo.cpp"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\win\crypt.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\contrib\extension-functions.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\fts5.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\percentile.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\regexp.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\sha1.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\shathree.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\totype.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\vtshim.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\generic\interop.c"
				>
			</File>
			<File
				RelativePath=".\src\core\sqlite3.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
		</Filter>
		<Filter
			Name="Header Files"
			Filter="h;hpp;hxx;hm;inl;inc;xsd"
			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
			>
			<File
				RelativePath=".\src\core\sqlite3.h"
				>
			</File>
			<File
				RelativePath=".\src\core\sqlite3ext.h"
				>
			</File>
			<File
				RelativePath=".\src\generic\interop.h"
				>
			</File>
		</Filter>
		<Filter
			Name="Resource Files"
			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
			>
			<File
				RelativePath=".\src\win\SQLite.Interop.rc"
				>
			</File>
			<File
				RelativePath="..\System.Data.SQLite\Resources\SR.resx"
				>
				<FileConfiguration
					Name="Debug|Win32"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\$(INTEROP_MIXED_NAME).$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\$(INTEROP_MIXED_NAME).$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\$(INTEROP_MIXED_NAME).$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\$(INTEROP_MIXED_NAME).$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
			</File>
		</Filter>
		<Filter
			Name="Property Files"
			>
			<File
				RelativePath=".\props\include.vsprops"
				>
			</File>
			<File
				RelativePath=".\props\SQLite.Interop.2008.vsprops"
				>
			</File>
			<File
				RelativePath=".\props\sqlite3.vsprops"
				>
			</File>
		</Filter>
	</Files>
	<Globals>
	</Globals>
</VisualStudioProject>

Added SQLite.Interop/SQLite.Interop.2010.vcxproj.















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.2010.vcxproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="DebugNativeOnly|x64">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="DebugNativeOnly|Win32">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|x64">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|Win32">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectName>SQLite.Interop.2010</ProjectName>
    <ProjectGuid>{53784BC1-A8BC-4AC8-8A3E-158D6807345A}</ProjectGuid>
    <RootNamespace>SQLite.Interop</RootNamespace>
    <Keyword>Win32Proj</Keyword>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <Import Project="props\sqlite3.props" />
  <Import Project="props\SQLite.Interop.2010.props" />
  <PropertyGroup>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <Import Project="$(INTEROP_EXTRA_PROPS_FILE)"
          Condition="'$(INTEROP_EXTRA_PROPS_FILE)' != '' And
                     Exists('$(INTEROP_EXTRA_PROPS_FILE)')" />
  <PropertyGroup Condition="('$(Configuration)' == 'DebugNativeOnly' Or
                             '$(Configuration)' == 'ReleaseNativeOnly') And
                            (('$(Platform)' == 'Win32' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != '')) Or
                             ('$(Platform)' == 'x64' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != 'AMD64')))"
                 Label="PostBuildEvent">
    <DoesMachineMatchPlatform>false</DoesMachineMatchPlatform>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  <PropertyGroup>
    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
    <OutDir>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Platform)\$(Configuration)\</OutDir>
    <IntDir>..\obj\$(ConfigurationYear)\$(Platform)\$(Configuration)\</IntDir>
    <LinkIncremental>false</LinkIncremental>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkDelaySign>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1600;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1600;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1600;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1600;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1600;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1600;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1600;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1600;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c" />
    <ClCompile Include="src\core\sqlite3.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\SQLite.Interop.2010.props" />
    <None Include="props\sqlite3.props" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h" />
    <ClInclude Include="src\core\sqlite3ext.h" />
    <ClInclude Include="src\generic\interop.h" />
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <LogicalName>System.Data.SQLite.%(Filename).resources</LogicalName>
      <SubType>Designer</SubType>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">true</ExcludedFromBuild>
    </EmbeddedResource>
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

Added SQLite.Interop/SQLite.Interop.2010.vcxproj.filters.



























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.2010.vcxproj.filters -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <Filter Include="Source Files">
      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
    </Filter>
    <Filter Include="Header Files">
      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
    </Filter>
    <Filter Include="Resource Files">
      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
    </Filter>
    <Filter Include="Property Files">
      <UniqueIdentifier>{d69d5c95-1d03-4325-ad06-fce223ab4e42}</UniqueIdentifier>
    </Filter>
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\core\sqlite3.c">
      <Filter>Source Files</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\sqlite3.props">
      <Filter>Property Files</Filter>
    </None>
    <None Include="props\SQLite.Interop.2010.props">
      <Filter>Property Files</Filter>
    </None>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\core\sqlite3ext.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\generic\interop.h">
      <Filter>Header Files</Filter>
    </ClInclude>
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc">
      <Filter>Resource Files</Filter>
    </ResourceCompile>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <Filter>Resource Files</Filter>
    </EmbeddedResource>
  </ItemGroup>
</Project>

Added SQLite.Interop/SQLite.Interop.2012.vcxproj.





























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.2012.vcxproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="DebugNativeOnly|x64">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="DebugNativeOnly|Win32">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|x64">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|Win32">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectName>SQLite.Interop.2012</ProjectName>
    <ProjectGuid>{53784BC1-A8BC-4AC8-8A3E-158D6807345A}</ProjectGuid>
    <RootNamespace>SQLite.Interop</RootNamespace>
    <Keyword>Win32Proj</Keyword>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <Import Project="props\sqlite3.props" />
  <Import Project="props\SQLite.Interop.2012.props" />
  <PropertyGroup>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <Import Project="$(INTEROP_EXTRA_PROPS_FILE)"
          Condition="'$(INTEROP_EXTRA_PROPS_FILE)' != '' And
                     Exists('$(INTEROP_EXTRA_PROPS_FILE)')" />
  <PropertyGroup Condition="('$(Configuration)' == 'DebugNativeOnly' Or
                             '$(Configuration)' == 'ReleaseNativeOnly') And
                            (('$(Platform)' == 'Win32' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != '')) Or
                             ('$(Platform)' == 'x64' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != 'AMD64')))"
                 Label="PostBuildEvent">
    <DoesMachineMatchPlatform>false</DoesMachineMatchPlatform>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v110</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v110</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v110</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v110</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v110</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v110</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v110</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v110</PlatformToolset>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  <PropertyGroup>
    <OutDir>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Platform)\$(Configuration)\</OutDir>
    <IntDir>..\obj\$(ConfigurationYear)\$(Platform)\$(Configuration)\</IntDir>
    <LinkIncremental>false</LinkIncremental>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkDelaySign>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c" />
    <ClCompile Include="src\core\sqlite3.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\SQLite.Interop.2012.props" />
    <None Include="props\sqlite3.props" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h" />
    <ClInclude Include="src\core\sqlite3ext.h" />
    <ClInclude Include="src\generic\interop.h" />
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <LogicalName>System.Data.SQLite.%(Filename).resources</LogicalName>
      <SubType>Designer</SubType>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">true</ExcludedFromBuild>
    </EmbeddedResource>
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

Added SQLite.Interop/SQLite.Interop.2012.vcxproj.filters.



























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.2012.vcxproj.filters -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <Filter Include="Source Files">
      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
    </Filter>
    <Filter Include="Header Files">
      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
    </Filter>
    <Filter Include="Resource Files">
      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
    </Filter>
    <Filter Include="Property Files">
      <UniqueIdentifier>{d69d5c95-1d03-4325-ad06-fce223ab4e42}</UniqueIdentifier>
    </Filter>
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\core\sqlite3.c">
      <Filter>Source Files</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\sqlite3.props">
      <Filter>Property Files</Filter>
    </None>
    <None Include="props\SQLite.Interop.2012.props">
      <Filter>Property Files</Filter>
    </None>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\core\sqlite3ext.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\generic\interop.h">
      <Filter>Header Files</Filter>
    </ClInclude>
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc">
      <Filter>Resource Files</Filter>
    </ResourceCompile>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <Filter>Resource Files</Filter>
    </EmbeddedResource>
  </ItemGroup>
</Project>

Added SQLite.Interop/SQLite.Interop.2013.vcxproj.





























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.2013.vcxproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="DebugNativeOnly|x64">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="DebugNativeOnly|Win32">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|x64">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|Win32">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectName>SQLite.Interop.2013</ProjectName>
    <ProjectGuid>{53784BC1-A8BC-4AC8-8A3E-158D6807345A}</ProjectGuid>
    <RootNamespace>SQLite.Interop</RootNamespace>
    <Keyword>Win32Proj</Keyword>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <Import Project="props\sqlite3.props" />
  <Import Project="props\SQLite.Interop.2013.props" />
  <PropertyGroup>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <Import Project="$(INTEROP_EXTRA_PROPS_FILE)"
          Condition="'$(INTEROP_EXTRA_PROPS_FILE)' != '' And
                     Exists('$(INTEROP_EXTRA_PROPS_FILE)')" />
  <PropertyGroup Condition="('$(Configuration)' == 'DebugNativeOnly' Or
                             '$(Configuration)' == 'ReleaseNativeOnly') And
                            (('$(Platform)' == 'Win32' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != '')) Or
                             ('$(Platform)' == 'x64' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != 'AMD64')))"
                 Label="PostBuildEvent">
    <DoesMachineMatchPlatform>false</DoesMachineMatchPlatform>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v120</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v120</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v120</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v120</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v120</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v120</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v120</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v120</PlatformToolset>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  <PropertyGroup>
    <OutDir>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Platform)\$(Configuration)\</OutDir>
    <IntDir>..\obj\$(ConfigurationYear)\$(Platform)\$(Configuration)\</IntDir>
    <LinkIncremental>false</LinkIncremental>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkDelaySign>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1800;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1800;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1800;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1800;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1800;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1800;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1800;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1800;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c" />
    <ClCompile Include="src\core\sqlite3.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\SQLite.Interop.2013.props" />
    <None Include="props\sqlite3.props" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h" />
    <ClInclude Include="src\core\sqlite3ext.h" />
    <ClInclude Include="src\generic\interop.h" />
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <LogicalName>System.Data.SQLite.%(Filename).resources</LogicalName>
      <SubType>Designer</SubType>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">true</ExcludedFromBuild>
    </EmbeddedResource>
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

Added SQLite.Interop/SQLite.Interop.2013.vcxproj.filters.



























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.2013.vcxproj.filters -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <Filter Include="Source Files">
      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
    </Filter>
    <Filter Include="Header Files">
      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
    </Filter>
    <Filter Include="Resource Files">
      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
    </Filter>
    <Filter Include="Property Files">
      <UniqueIdentifier>{d69d5c95-1d03-4325-ad06-fce223ab4e42}</UniqueIdentifier>
    </Filter>
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\core\sqlite3.c">
      <Filter>Source Files</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\sqlite3.props">
      <Filter>Property Files</Filter>
    </None>
    <None Include="props\SQLite.Interop.2013.props">
      <Filter>Property Files</Filter>
    </None>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\core\sqlite3ext.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\generic\interop.h">
      <Filter>Header Files</Filter>
    </ClInclude>
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc">
      <Filter>Resource Files</Filter>
    </ResourceCompile>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <Filter>Resource Files</Filter>
    </EmbeddedResource>
  </ItemGroup>
</Project>

Added SQLite.Interop/SQLite.Interop.2015.vcxproj.





























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.2015.vcxproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="DebugNativeOnly|x64">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="DebugNativeOnly|Win32">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|x64">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|Win32">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectName>SQLite.Interop.2015</ProjectName>
    <ProjectGuid>{53784BC1-A8BC-4AC8-8A3E-158D6807345A}</ProjectGuid>
    <RootNamespace>SQLite.Interop</RootNamespace>
    <Keyword>Win32Proj</Keyword>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <Import Project="props\sqlite3.props" />
  <Import Project="props\SQLite.Interop.2015.props" />
  <PropertyGroup>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <Import Project="$(INTEROP_EXTRA_PROPS_FILE)"
          Condition="'$(INTEROP_EXTRA_PROPS_FILE)' != '' And
                     Exists('$(INTEROP_EXTRA_PROPS_FILE)')" />
  <PropertyGroup Condition="('$(Configuration)' == 'DebugNativeOnly' Or
                             '$(Configuration)' == 'ReleaseNativeOnly') And
                            (('$(Platform)' == 'Win32' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != '')) Or
                             ('$(Platform)' == 'x64' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != 'AMD64')))"
                 Label="PostBuildEvent">
    <DoesMachineMatchPlatform>false</DoesMachineMatchPlatform>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v140</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v140</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v140</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v140</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v140</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v140</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v140</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v140</PlatformToolset>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  <PropertyGroup>
    <OutDir>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Platform)\$(Configuration)\</OutDir>
    <IntDir>..\obj\$(ConfigurationYear)\$(Platform)\$(Configuration)\</IntDir>
    <LinkIncremental>false</LinkIncremental>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkDelaySign>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1900;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1900;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1900;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1900;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1900;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1900;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1900;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1900;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c" />
    <ClCompile Include="src\core\sqlite3.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\SQLite.Interop.2015.props" />
    <None Include="props\sqlite3.props" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h" />
    <ClInclude Include="src\core\sqlite3ext.h" />
    <ClInclude Include="src\generic\interop.h" />
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <LogicalName>System.Data.SQLite.%(Filename).resources</LogicalName>
      <SubType>Designer</SubType>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">true</ExcludedFromBuild>
    </EmbeddedResource>
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

Added SQLite.Interop/SQLite.Interop.2015.vcxproj.filters.



























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.2015.vcxproj.filters -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <Filter Include="Source Files">
      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
    </Filter>
    <Filter Include="Header Files">
      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
    </Filter>
    <Filter Include="Resource Files">
      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
    </Filter>
    <Filter Include="Property Files">
      <UniqueIdentifier>{d69d5c95-1d03-4325-ad06-fce223ab4e42}</UniqueIdentifier>
    </Filter>
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\core\sqlite3.c">
      <Filter>Source Files</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\sqlite3.props">
      <Filter>Property Files</Filter>
    </None>
    <None Include="props\SQLite.Interop.2015.props">
      <Filter>Property Files</Filter>
    </None>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\core\sqlite3ext.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\generic\interop.h">
      <Filter>Header Files</Filter>
    </ClInclude>
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc">
      <Filter>Resource Files</Filter>
    </ResourceCompile>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <Filter>Resource Files</Filter>
    </EmbeddedResource>
  </ItemGroup>
</Project>

Added SQLite.Interop/SQLite.Interop.2017.vcxproj.





























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.2017.vcxproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="DebugNativeOnly|x64">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="DebugNativeOnly|Win32">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|x64">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|Win32">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectName>SQLite.Interop.2017</ProjectName>
    <ProjectGuid>{53784BC1-A8BC-4AC8-8A3E-158D6807345A}</ProjectGuid>
    <RootNamespace>SQLite.Interop</RootNamespace>
    <Keyword>Win32Proj</Keyword>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <Import Project="props\sqlite3.props" />
  <Import Project="props\SQLite.Interop.2017.props" />
  <PropertyGroup>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <Import Project="$(INTEROP_EXTRA_PROPS_FILE)"
          Condition="'$(INTEROP_EXTRA_PROPS_FILE)' != '' And
                     Exists('$(INTEROP_EXTRA_PROPS_FILE)')" />
  <PropertyGroup Condition="('$(Configuration)' == 'DebugNativeOnly' Or
                             '$(Configuration)' == 'ReleaseNativeOnly') And
                            (('$(Platform)' == 'Win32' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != '')) Or
                             ('$(Platform)' == 'x64' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != 'AMD64')))"
                 Label="PostBuildEvent">
    <DoesMachineMatchPlatform>false</DoesMachineMatchPlatform>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v141</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v141</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v141</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v141</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v141</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v141</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v141</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v141</PlatformToolset>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  <PropertyGroup>
    <OutDir>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Platform)\$(Configuration)\</OutDir>
    <IntDir>..\obj\$(ConfigurationYear)\$(Platform)\$(Configuration)\</IntDir>
    <LinkIncremental>false</LinkIncremental>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkDelaySign>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1910;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1910;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1910;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1910;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1910;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1910;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1910;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1910;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c" />
    <ClCompile Include="src\core\sqlite3.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\SQLite.Interop.2017.props" />
    <None Include="props\sqlite3.props" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h" />
    <ClInclude Include="src\core\sqlite3ext.h" />
    <ClInclude Include="src\generic\interop.h" />
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <LogicalName>System.Data.SQLite.%(Filename).resources</LogicalName>
      <SubType>Designer</SubType>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">true</ExcludedFromBuild>
    </EmbeddedResource>
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

Added SQLite.Interop/SQLite.Interop.2017.vcxproj.filters.



























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.2017.vcxproj.filters -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <Filter Include="Source Files">
      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
    </Filter>
    <Filter Include="Header Files">
      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
    </Filter>
    <Filter Include="Resource Files">
      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
    </Filter>
    <Filter Include="Property Files">
      <UniqueIdentifier>{d69d5c95-1d03-4325-ad06-fce223ab4e42}</UniqueIdentifier>
    </Filter>
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\core\sqlite3.c">
      <Filter>Source Files</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\sqlite3.props">
      <Filter>Property Files</Filter>
    </None>
    <None Include="props\SQLite.Interop.2017.props">
      <Filter>Property Files</Filter>
    </None>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\core\sqlite3ext.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\generic\interop.h">
      <Filter>Header Files</Filter>
    </ClInclude>
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc">
      <Filter>Resource Files</Filter>
    </ResourceCompile>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <Filter>Resource Files</Filter>
    </EmbeddedResource>
  </ItemGroup>
</Project>

Added SQLite.Interop/SQLite.Interop.CE.2005.vcproj.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
<?xml version="1.0" encoding="Windows-1252"?>
<!--
 *
 * SQLite.Interop.CE.2005.vcproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<VisualStudioProject
	ProjectType="Visual C++"
	Version="8.00"
	Name="SQLite.Interop.CE.2005"
	ProjectGUID="{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}"
	Keyword="Win32Proj"
	TargetFrameworkVersion="196613"
	>
	<Platforms>
		<Platform
			Name="Pocket PC 2003 (ARMV4)"
		/>
		<Platform
			Name="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
		/>
		<Platform
			Name="Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
		/>
	</Platforms>
	<ToolFiles>
	</ToolFiles>
	<Configurations>
		<Configuration
			Name="Debug|Pocket PC 2003 (ARMV4)"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="1"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_200X_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="true"
				RuntimeLibrary="1"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1400;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
				Culture="1033"
				AdditionalIncludeDirectories="$(IntDir)"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM /ARMPADCODE"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="secchk.lib $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="2"
				GenerateManifest="true"
				DelayLoadDLLs="$(NOINHERIT)"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).pdb"
				GenerateMapFile="true"
				SubSystem="0"
				StackReserveSize="65536"
				StackCommitSize="4096"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).lib"
				TargetMachine="0"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory="%CSIDL_PROGRAM_FILES%\testce"
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
		<Configuration
			Name="Release|Pocket PC 2003 (ARMV4)"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="1"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="2"
				FavorSizeOrSpeed="2"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_200X_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				RuntimeLibrary="0"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1400;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
				Culture="1033"
				AdditionalIncludeDirectories="$(IntDir)"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM /ARMPADCODE"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="secchk.lib $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateManifest="true"
				DelayLoadDLLs="$(NOINHERIT)"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).pdb"
				GenerateMapFile="true"
				SubSystem="0"
				StackReserveSize="65536"
				StackCommitSize="4096"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).lib"
				TargetMachine="0"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory="%CSIDL_PROGRAM_FILES%\testce"
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
		<Configuration
			Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_200X_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="true"
				RuntimeLibrary="1"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1400;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
				Culture="1033"
				AdditionalIncludeDirectories="$(IntDir)"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions=" /subsystem:windowsce,5.01"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="2"
				GenerateManifest="true"
				DelayLoadDLLs="$(NOINHERIT)"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).pdb"
				GenerateMapFile="true"
				SubSystem="0"
				StackReserveSize="65536"
				StackCommitSize="4096"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).lib"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory="%CSIDL_PROGRAM_FILES%\testce"
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
		<Configuration
			Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_200X_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="true"
				RuntimeLibrary="1"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1400;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
				Culture="1033"
				AdditionalIncludeDirectories="$(IntDir)"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions=" /subsystem:windowsce,5.01"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="2"
				GenerateManifest="true"
				DelayLoadDLLs="$(NOINHERIT)"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).pdb"
				GenerateMapFile="true"
				SubSystem="0"
				StackReserveSize="65536"
				StackCommitSize="4096"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).lib"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory="%CSIDL_PROGRAM_FILES%\testce"
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
		<Configuration
			Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="2"
				FavorSizeOrSpeed="2"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_200X_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				RuntimeLibrary="0"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1400;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
				Culture="1033"
				AdditionalIncludeDirectories="$(IntDir)"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions=" /subsystem:windowsce,5.01"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateManifest="true"
				DelayLoadDLLs="$(NOINHERIT)"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).pdb"
				GenerateMapFile="true"
				SubSystem="0"
				StackReserveSize="65536"
				StackCommitSize="4096"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).lib"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory="%CSIDL_PROGRAM_FILES%\testce"
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
		<Configuration
			Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="2"
				FavorSizeOrSpeed="2"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_200X_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				RuntimeLibrary="0"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1400;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
				Culture="1033"
				AdditionalIncludeDirectories="$(IntDir)"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions=" /subsystem:windowsce,5.01"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateManifest="true"
				DelayLoadDLLs="$(NOINHERIT)"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).pdb"
				GenerateMapFile="true"
				SubSystem="0"
				StackReserveSize="65536"
				StackCommitSize="4096"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).lib"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory="%CSIDL_PROGRAM_FILES%\testce"
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
	</Configurations>
	<References>
	</References>
	<Files>
		<Filter
			Name="Source Files"
			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
			>
			<File
				RelativePath=".\src\win\AssemblyInfo.cpp"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\win\crypt.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\contrib\extension-functions.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\fts5.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\percentile.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\regexp.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\sha1.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\shathree.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\totype.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\vtshim.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\generic\interop.c"
				>
			</File>
			<File
				RelativePath=".\src\core\sqlite3.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
		</Filter>
		<Filter
			Name="Header Files"
			Filter="h;hpp;hxx;hm;inl;inc;xsd"
			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
			>
			<File
				RelativePath=".\src\generic\interop.h"
				>
			</File>
			<File
				RelativePath=".\src\core\sqlite3.h"
				>
			</File>
			<File
				RelativePath=".\src\core\sqlite3ext.h"
				>
			</File>
		</Filter>
		<Filter
			Name="Resource Files"
			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
			>
			<File
				RelativePath=".\src\win\SQLite.Interop.rc"
				>
			</File>
		</Filter>
		<Filter
			Name="Property Files"
			>
			<File
				RelativePath=".\props\include.vsprops"
				>
			</File>
			<File
				RelativePath=".\props\SQLite.Interop.2005.vsprops"
				>
			</File>
			<File
				RelativePath=".\props\sqlite3.vsprops"
				>
			</File>
		</Filter>
	</Files>
	<Globals>
	</Globals>
</VisualStudioProject>

Added SQLite.Interop/SQLite.Interop.CE.2008.vcproj.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
<?xml version="1.0" encoding="Windows-1252"?>
<!--
 *
 * SQLite.Interop.CE.2008.vcproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<VisualStudioProject
	ProjectType="Visual C++"
	Version="9.00"
	Name="SQLite.Interop.CE.2008"
	ProjectGUID="{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}"
	Keyword="Win32Proj"
	TargetFrameworkVersion="196613"
	>
	<Platforms>
		<Platform
			Name="Pocket PC 2003 (ARMV4)"
		/>
		<Platform
			Name="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
		/>
		<Platform
			Name="Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
		/>
	</Platforms>
	<ToolFiles>
	</ToolFiles>
	<Configurations>
		<Configuration
			Name="Debug|Pocket PC 2003 (ARMV4)"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="1"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_200X_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="true"
				RuntimeLibrary="1"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1500;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
				Culture="1033"
				AdditionalIncludeDirectories="$(IntDir)"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM /ARMPADCODE"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="secchk.lib $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="2"
				GenerateManifest="true"
				DelayLoadDLLs="$(NOINHERIT)"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).pdb"
				GenerateMapFile="true"
				SubSystem="0"
				StackReserveSize="65536"
				StackCommitSize="4096"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).lib"
				TargetMachine="0"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory="%CSIDL_PROGRAM_FILES%\testce"
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
		<Configuration
			Name="Release|Pocket PC 2003 (ARMV4)"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="1"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="2"
				FavorSizeOrSpeed="2"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_200X_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				RuntimeLibrary="0"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1500;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
				Culture="1033"
				AdditionalIncludeDirectories="$(IntDir)"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM /ARMPADCODE"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="secchk.lib $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateManifest="true"
				DelayLoadDLLs="$(NOINHERIT)"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).pdb"
				GenerateMapFile="true"
				SubSystem="0"
				StackReserveSize="65536"
				StackCommitSize="4096"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).lib"
				TargetMachine="0"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory="%CSIDL_PROGRAM_FILES%\testce"
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
		<Configuration
			Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_200X_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="true"
				RuntimeLibrary="1"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1500;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
				Culture="1033"
				AdditionalIncludeDirectories="$(IntDir)"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions=" /subsystem:windowsce,5.01"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="2"
				GenerateManifest="true"
				DelayLoadDLLs="$(NOINHERIT)"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).pdb"
				GenerateMapFile="true"
				SubSystem="0"
				StackReserveSize="65536"
				StackCommitSize="4096"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).lib"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory="%CSIDL_PROGRAM_FILES%\testce"
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
		<Configuration
			Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;DEBUG;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_200X_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="true"
				RuntimeLibrary="1"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1500;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
				Culture="1033"
				AdditionalIncludeDirectories="$(IntDir)"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions=" /subsystem:windowsce,5.01"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="2"
				GenerateManifest="true"
				DelayLoadDLLs="$(NOINHERIT)"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).pdb"
				GenerateMapFile="true"
				SubSystem="0"
				StackReserveSize="65536"
				StackCommitSize="4096"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).lib"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory="%CSIDL_PROGRAM_FILES%\testce"
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
		<Configuration
			Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="2"
				FavorSizeOrSpeed="2"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_200X_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				RuntimeLibrary="0"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1500;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
				Culture="1033"
				AdditionalIncludeDirectories="$(IntDir)"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions=" /subsystem:windowsce,5.01"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateManifest="true"
				DelayLoadDLLs="$(NOINHERIT)"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).pdb"
				GenerateMapFile="true"
				SubSystem="0"
				StackReserveSize="65536"
				StackCommitSize="4096"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).lib"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory="%CSIDL_PROGRAM_FILES%\testce"
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
		<Configuration
			Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="2"
				FavorSizeOrSpeed="2"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="NDEBUG;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);WINCE;_WINDOWS;_USRDLL;$(ARCHFAM);$(_ARCHFAM_);_UNICODE;UNICODE;$(SQLITE_WINCE_200X_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				RuntimeLibrary="0"
				FloatingPointModel="0"
				UsePrecompiledHeader="0"
				WarningLevel="3"
				DebugInformationFormat="3"
				CompileAs="1"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1500;_WIN32_WCE=$(CEVER);UNDER_CE;$(PLATFORMDEFINES);$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
				Culture="1033"
				AdditionalIncludeDirectories="$(IntDir)"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions=" /subsystem:windowsce,5.01"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateManifest="true"
				DelayLoadDLLs="$(NOINHERIT)"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).pdb"
				GenerateMapFile="true"
				SubSystem="0"
				StackReserveSize="65536"
				StackCommitSize="4096"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary="$(OutDir)\SQLite.Interop.$(INTEROP_BUILD_NUMBER).lib"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory="%CSIDL_PROGRAM_FILES%\testce"
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
	</Configurations>
	<References>
	</References>
	<Files>
		<Filter
			Name="Source Files"
			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
			>
			<File
				RelativePath=".\src\win\AssemblyInfo.cpp"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\win\crypt.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\contrib\extension-functions.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\fts5.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\percentile.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\regexp.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\sha1.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\shathree.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\totype.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\vtshim.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\generic\interop.c"
				>
			</File>
			<File
				RelativePath=".\src\core\sqlite3.c"
				>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
		</Filter>
		<Filter
			Name="Header Files"
			Filter="h;hpp;hxx;hm;inl;inc;xsd"
			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
			>
			<File
				RelativePath=".\src\generic\interop.h"
				>
			</File>
			<File
				RelativePath=".\src\core\sqlite3.h"
				>
			</File>
			<File
				RelativePath=".\src\core\sqlite3ext.h"
				>
			</File>
		</Filter>
		<Filter
			Name="Resource Files"
			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
			>
			<File
				RelativePath=".\src\win\SQLite.Interop.rc"
				>
			</File>
		</Filter>
		<Filter
			Name="Property Files"
			>
			<File
				RelativePath=".\props\include.vsprops"
				>
			</File>
			<File
				RelativePath=".\props\SQLite.Interop.2008.vsprops"
				>
			</File>
			<File
				RelativePath=".\props\sqlite3.vsprops"
				>
			</File>
		</Filter>
	</Files>
	<Globals>
	</Globals>
</VisualStudioProject>

Added SQLite.Interop/SQLite.Interop.CE.2012.vcxproj.























































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.CE.2012.vcxproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="Debug|CEPC DevPlatform">
      <Configuration>Debug</Configuration>
      <Platform>CEPC DevPlatform</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|CEPC DevPlatform">
      <Configuration>Release</Configuration>
      <Platform>CEPC DevPlatform</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|ARMV7">
      <Configuration>Debug</Configuration>
      <Platform>ARMV7</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|ARMV7">
      <Configuration>Release</Configuration>
      <Platform>ARMV7</Platform>
    </ProjectConfiguration>
  </ItemGroup>

  <PropertyGroup Label="Globals">
    <ProjectGuid>{9e5a8f20-5f04-4629-b2e1-27b5e30f2af6}</ProjectGuid>
    <RootNamespace>SQLite.Interop</RootNamespace>
    <DefaultLanguage>en-US</DefaultLanguage>
    <VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and '$(VisualStudioVersion)' == ''">$(VCTargetsPath11)</VCTargetsPath>
    <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
    <EnableRedirectPlatform>true</EnableRedirectPlatform>
    <RedirectPlatformValue>CEPC DevPlatform</RedirectPlatformValue>
    <PlatformToolset>CE800</PlatformToolset>
  </PropertyGroup>

  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <Import Project="props\sqlite3.props" />
  <Import Project="props\SQLite.Interop.2012.props" />
  <PropertyGroup>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <Import Project="$(INTEROP_EXTRA_PROPS_FILE)"
          Condition="'$(INTEROP_EXTRA_PROPS_FILE)' != '' And
                     Exists('$(INTEROP_EXTRA_PROPS_FILE)')" />

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|CEPC DevPlatform'" Label="Configuration">
    <TargetName>SQLite.Interop.$(INTEROP_BUILD_NUMBER)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>CE800</PlatformToolset>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|CEPC DevPlatform'" Label="Configuration">
    <TargetName>SQLite.Interop.$(INTEROP_BUILD_NUMBER)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>CE800</PlatformToolset>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARMV7'" Label="Configuration">
    <TargetName>SQLite.Interop.$(INTEROP_BUILD_NUMBER)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>CE800</PlatformToolset>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARMV7'" Label="Configuration">
    <TargetName>SQLite.Interop.$(INTEROP_BUILD_NUMBER)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <UseDebugLibraries>false</UseDebugLibraries>
    <PlatformToolset>CE800</PlatformToolset>
  </PropertyGroup>

  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />

  <PropertyGroup>
    <OutDir>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Platform)\$(Configuration)\</OutDir>
    <IntDir>..\obj\$(ConfigurationYear)\$(Platform)\$(Configuration)\</IntDir>
  </PropertyGroup>

  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|CEPC DevPlatform'">
    <ClCompile>
      <PrecompiledHeader>NotUsing</PrecompiledHeader>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;UNICODE;$(SQLITE_WINCE_2013_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <AdditionalOptions>/D "DEBUG" /D "STANDARDSHELL_UI_MODEL" %(AdditionalOptions)</AdditionalOptions>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
      <FunctionLevelLinking>true</FunctionLevelLinking>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
    </Link>
  </ItemDefinitionGroup>

  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|CEPC DevPlatform'">
    <ClCompile>
      <PrecompiledHeader>NotUsing</PrecompiledHeader>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;UNICODE;$(SQLITE_WINCE_2013_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <AdditionalOptions>/D "_WINDOWS" /D "STANDARDSHELL_UI_MODEL" %(AdditionalOptions)</AdditionalOptions>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
      <FunctionLevelLinking>true</FunctionLevelLinking>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
    </Link>
  </ItemDefinitionGroup>

  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARMV7'">
    <ClCompile>
      <PrecompiledHeader>NotUsing</PrecompiledHeader>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;UNICODE;$(SQLITE_WINCE_2013_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <AdditionalOptions>/D "DEBUG" /D "STANDARDSHELL_UI_MODEL" %(AdditionalOptions)</AdditionalOptions>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
      <FunctionLevelLinking>true</FunctionLevelLinking>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
    </Link>
  </ItemDefinitionGroup>

  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARMV7'">
    <ClCompile>
      <PrecompiledHeader>NotUsing</PrecompiledHeader>
      <Optimization>MaxSpeed</Optimization>
      <FunctionLevelLinking>true</FunctionLevelLinking>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;UNICODE;$(SQLITE_WINCE_2013_DEFINES);$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <AdditionalOptions>/D "_WINDOWS" /D "STANDARDSHELL_UI_MODEL" %(AdditionalOptions)</AdditionalOptions>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
      <FunctionLevelLinking>true</FunctionLevelLinking>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <OptimizeReferences>true</OptimizeReferences>
    </Link>
  </ItemDefinitionGroup>

  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c" />
    <ClCompile Include="src\core\sqlite3.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
  </ItemGroup>

  <ItemGroup>
    <None Include="props\SQLite.Interop.2012.props" />
    <None Include="props\sqlite3.props" />
  </ItemGroup>

  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h" />
    <ClInclude Include="src\core\sqlite3ext.h" />
    <ClInclude Include="src\generic\interop.h" />
  </ItemGroup>

  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc" />
  </ItemGroup>

  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

Added SQLite.Interop/SQLite.Interop.CE.2012.vcxproj.filters.





















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.CE.2012.vcxproj.filters -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <Filter Include="Source Files">
      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
    </Filter>
    <Filter Include="Header Files">
      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
    </Filter>
    <Filter Include="Resource Files">
      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
    </Filter>
    <Filter Include="Property Files">
      <UniqueIdentifier>{d69d5c95-1d03-4325-ad06-fce223ab4e42}</UniqueIdentifier>
    </Filter>
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\core\sqlite3.c">
      <Filter>Source Files</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\sqlite3.props">
      <Filter>Property Files</Filter>
    </None>
    <None Include="props\SQLite.Interop.2012.props">
      <Filter>Property Files</Filter>
    </None>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\core\sqlite3ext.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\generic\interop.h">
      <Filter>Header Files</Filter>
    </ClInclude>
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc">
      <Filter>Resource Files</Filter>
    </ResourceCompile>
  </ItemGroup>
</Project>

Added SQLite.Interop/SQLite.Interop.Static.2005.vcproj.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
<?xml version="1.0" encoding="Windows-1252"?>
<!--
 *
 * SQLite.Interop.Static.2005.vcproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<VisualStudioProject
	ProjectType="Visual C++"
	Version="8.00"
	Name="SQLite.Interop.Static.2005"
	ProjectGUID="{490CBC51-A3B2-4397-89F9-16E858DCB4F8}"
	RootNamespace="SQLite.Interop"
	Keyword="Win32Proj"
	TargetFrameworkVersion="131072"
	>
	<Platforms>
		<Platform
			Name="Win32"
		/>
		<Platform
			Name="x64"
		/>
	</Platforms>
	<ToolFiles>
	</ToolFiles>
	<Configurations>
		<Configuration
			Name="Debug|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="1"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1400;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions="$(INTEROP_ASSEMBLY_RESOURCES)"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(ProjectDir)..\bin\$(ConfigurationYear)\$(ConfigurationName)Module\bin\System.Data.SQLite.netmodule $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_MIXED_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				AssemblyDebug="1"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_MIXED_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				LinkTimeCodeGeneration="1"
				ImportLibrary="$(OutDir)\$(INTEROP_MIXED_NAME).lib"
				TargetMachine="1"
				KeyFile="$(INTEROP_KEY_FILE)"
				DelaySign="true"
				CLRUnmanagedCodeCheck="true"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="&quot;$(FrameworkSDKDir)Bin\sn.exe&quot; -Ra &quot;$(TargetDir)$(INTEROP_MIXED_NAME).dll&quot; &quot;$(INTEROP_KEY_FILE)&quot;"
			/>
		</Configuration>
		<Configuration
			Name="Debug|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="1"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1400;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions="$(INTEROP_ASSEMBLY_RESOURCES)"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(ProjectDir)..\bin\$(ConfigurationYear)\$(ConfigurationName)Module\bin\System.Data.SQLite.netmodule $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_MIXED_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				AssemblyDebug="1"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_MIXED_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				LinkTimeCodeGeneration="1"
				ImportLibrary="$(OutDir)\$(INTEROP_MIXED_NAME).lib"
				TargetMachine="17"
				KeyFile="$(INTEROP_KEY_FILE)"
				DelaySign="true"
				CLRUnmanagedCodeCheck="true"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="&quot;$(FrameworkSDKDir)Bin\sn.exe&quot; -Ra &quot;$(TargetDir)$(INTEROP_MIXED_NAME).dll&quot; &quot;$(INTEROP_KEY_FILE)&quot;"
			/>
		</Configuration>
		<Configuration
			Name="DebugNativeOnly|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="1"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1400;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_NATIVE_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				AssemblyDebug="1"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_NATIVE_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				ImportLibrary="$(OutDir)\$(INTEROP_NATIVE_NAME).lib"
				TargetMachine="1"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="DebugNativeOnly|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="1"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1400;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_NATIVE_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				AssemblyDebug="1"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_NATIVE_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				ImportLibrary="$(OutDir)\$(INTEROP_NATIVE_NAME).lib"
				TargetMachine="17"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="Release|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="0"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1400;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions="$(INTEROP_ASSEMBLY_RESOURCES)"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(ProjectDir)..\bin\$(ConfigurationYear)\$(ConfigurationName)Module\bin\System.Data.SQLite.netmodule $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_MIXED_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_MIXED_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				LargeAddressAware="0"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				LinkTimeCodeGeneration="1"
				ImportLibrary="$(OutDir)\$(INTEROP_MIXED_NAME).lib"
				TargetMachine="1"
				KeyFile="$(INTEROP_KEY_FILE)"
				DelaySign="true"
				CLRUnmanagedCodeCheck="true"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="&quot;$(FrameworkSDKDir)Bin\sn.exe&quot; -Ra &quot;$(TargetDir)$(INTEROP_MIXED_NAME).dll&quot; &quot;$(INTEROP_KEY_FILE)&quot;"
			/>
		</Configuration>
		<Configuration
			Name="Release|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="0"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1400;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions="$(INTEROP_ASSEMBLY_RESOURCES)"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(ProjectDir)..\bin\$(ConfigurationYear)\$(ConfigurationName)Module\bin\System.Data.SQLite.netmodule $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_MIXED_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_MIXED_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				LargeAddressAware="0"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				LinkTimeCodeGeneration="1"
				ImportLibrary="$(OutDir)\$(INTEROP_MIXED_NAME).lib"
				TargetMachine="17"
				KeyFile="$(INTEROP_KEY_FILE)"
				DelaySign="true"
				CLRUnmanagedCodeCheck="true"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="&quot;$(FrameworkSDKDir)Bin\sn.exe&quot; -Ra &quot;$(TargetDir)$(INTEROP_MIXED_NAME).dll&quot; &quot;$(INTEROP_KEY_FILE)&quot;"
			/>
		</Configuration>
		<Configuration
			Name="ReleaseNativeOnly|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="0"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1400;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_NATIVE_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_NATIVE_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				LargeAddressAware="0"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				ImportLibrary="$(OutDir)\$(INTEROP_NATIVE_NAME).lib"
				TargetMachine="1"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="ReleaseNativeOnly|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2005.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_WIN32_WINNT=0x0400;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="0"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1400;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_NATIVE_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_NATIVE_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				LargeAddressAware="0"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				ImportLibrary="$(OutDir)\$(INTEROP_NATIVE_NAME).lib"
				TargetMachine="17"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
	</Configurations>
	<References>
	</References>
	<Files>
		<Filter
			Name="Source Files"
			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
			>
			<File
				RelativePath=".\src\win\AssemblyInfo.cpp"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\win\crypt.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\contrib\extension-functions.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\fts5.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\percentile.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\regexp.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\sha1.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\shathree.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\totype.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\vtshim.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\generic\interop.c"
				>
			</File>
			<File
				RelativePath=".\src\core\sqlite3.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
		</Filter>
		<Filter
			Name="Header Files"
			Filter="h;hpp;hxx;hm;inl;inc;xsd"
			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
			>
			<File
				RelativePath=".\src\core\sqlite3.h"
				>
			</File>
			<File
				RelativePath=".\src\core\sqlite3ext.h"
				>
			</File>
			<File
				RelativePath=".\src\generic\interop.h"
				>
			</File>
		</Filter>
		<Filter
			Name="Resource Files"
			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
			>
			<File
				RelativePath=".\src\win\SQLite.Interop.rc"
				>
			</File>
			<File
				RelativePath="..\System.Data.SQLite\Resources\SR.resx"
				>
				<FileConfiguration
					Name="Debug|Win32"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\$(INTEROP_MIXED_NAME).$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\$(INTEROP_MIXED_NAME).$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\$(INTEROP_MIXED_NAME).$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\$(INTEROP_MIXED_NAME).$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
			</File>
		</Filter>
		<Filter
			Name="Property Files"
			>
			<File
				RelativePath=".\props\include.vsprops"
				>
			</File>
			<File
				RelativePath=".\props\SQLite.Interop.2005.vsprops"
				>
			</File>
			<File
				RelativePath=".\props\sqlite3.vsprops"
				>
			</File>
		</Filter>
	</Files>
	<Globals>
	</Globals>
</VisualStudioProject>

Added SQLite.Interop/SQLite.Interop.Static.2008.vcproj.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
<?xml version="1.0" encoding="Windows-1252"?>
<!--
 *
 * SQLite.Interop.Static.2008.vcproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<VisualStudioProject
	ProjectType="Visual C++"
	Version="9.00"
	Name="SQLite.Interop.Static.2008"
	ProjectGUID="{490CBC51-A3B2-4397-89F9-16E858DCB4F8}"
	RootNamespace="SQLite.Interop"
	Keyword="Win32Proj"
	TargetFrameworkVersion="131072"
	>
	<Platforms>
		<Platform
			Name="Win32"
		/>
		<Platform
			Name="x64"
		/>
	</Platforms>
	<ToolFiles>
	</ToolFiles>
	<Configurations>
		<Configuration
			Name="Debug|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="1"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1500;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions="$(INTEROP_ASSEMBLY_RESOURCES)"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(ProjectDir)..\bin\$(ConfigurationYear)\$(ConfigurationName)Module\bin\System.Data.SQLite.netmodule $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_MIXED_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				AssemblyDebug="1"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_MIXED_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				LinkTimeCodeGeneration="1"
				ImportLibrary="$(OutDir)\$(INTEROP_MIXED_NAME).lib"
				TargetMachine="1"
				KeyFile="$(INTEROP_KEY_FILE)"
				DelaySign="true"
				CLRUnmanagedCodeCheck="true"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="&quot;$(FrameworkSDKDir)Bin\sn.exe&quot; -Ra &quot;$(TargetDir)$(INTEROP_MIXED_NAME).dll&quot; &quot;$(INTEROP_KEY_FILE)&quot;"
			/>
		</Configuration>
		<Configuration
			Name="Debug|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="1"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1500;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions="$(INTEROP_ASSEMBLY_RESOURCES)"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(ProjectDir)..\bin\$(ConfigurationYear)\$(ConfigurationName)Module\bin\System.Data.SQLite.netmodule $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_MIXED_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				AssemblyDebug="1"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_MIXED_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				LinkTimeCodeGeneration="1"
				ImportLibrary="$(OutDir)\$(INTEROP_MIXED_NAME).lib"
				TargetMachine="17"
				KeyFile="$(INTEROP_KEY_FILE)"
				DelaySign="true"
				CLRUnmanagedCodeCheck="true"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="&quot;$(FrameworkSDKDir)Bin\sn.exe&quot; -Ra &quot;$(TargetDir)$(INTEROP_MIXED_NAME).dll&quot; &quot;$(INTEROP_KEY_FILE)&quot;"
			/>
		</Configuration>
		<Configuration
			Name="DebugNativeOnly|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="1"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1500;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_NATIVE_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				AssemblyDebug="1"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_NATIVE_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				ImportLibrary="$(OutDir)\$(INTEROP_NATIVE_NAME).lib"
				TargetMachine="1"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="DebugNativeOnly|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES)"
				MinimalRebuild="false"
				ExceptionHandling="0"
				BasicRuntimeChecks="0"
				RuntimeLibrary="1"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="_DEBUG;RC_MSC_VER=1500;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_NATIVE_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				AssemblyDebug="1"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_NATIVE_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				ImportLibrary="$(OutDir)\$(INTEROP_NATIVE_NAME).lib"
				TargetMachine="17"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Debug\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Debug\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="Release|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="0"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1500;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions="$(INTEROP_ASSEMBLY_RESOURCES)"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(ProjectDir)..\bin\$(ConfigurationYear)\$(ConfigurationName)Module\bin\System.Data.SQLite.netmodule $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_MIXED_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_MIXED_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				LargeAddressAware="0"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				LinkTimeCodeGeneration="1"
				ImportLibrary="$(OutDir)\$(INTEROP_MIXED_NAME).lib"
				TargetMachine="1"
				KeyFile="$(INTEROP_KEY_FILE)"
				DelaySign="true"
				CLRUnmanagedCodeCheck="true"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="&quot;$(FrameworkSDKDir)Bin\sn.exe&quot; -Ra &quot;$(TargetDir)$(INTEROP_MIXED_NAME).dll&quot; &quot;$(INTEROP_KEY_FILE)&quot;"
			/>
		</Configuration>
		<Configuration
			Name="Release|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="0"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1500;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions="$(INTEROP_ASSEMBLY_RESOURCES)"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(ProjectDir)..\bin\$(ConfigurationYear)\$(ConfigurationName)Module\bin\System.Data.SQLite.netmodule $(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_MIXED_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_MIXED_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				LargeAddressAware="0"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				LinkTimeCodeGeneration="1"
				ImportLibrary="$(OutDir)\$(INTEROP_MIXED_NAME).lib"
				TargetMachine="17"
				KeyFile="$(INTEROP_KEY_FILE)"
				DelaySign="true"
				CLRUnmanagedCodeCheck="true"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="&quot;$(FrameworkSDKDir)Bin\sn.exe&quot; -Ra &quot;$(TargetDir)$(INTEROP_MIXED_NAME).dll&quot; &quot;$(INTEROP_KEY_FILE)&quot;"
			/>
		</Configuration>
		<Configuration
			Name="ReleaseNativeOnly|Win32"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="0"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1500;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_NATIVE_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_NATIVE_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				LargeAddressAware="0"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				ImportLibrary="$(OutDir)\$(INTEROP_NATIVE_NAME).lib"
				TargetMachine="1"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;&quot; XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
		<Configuration
			Name="ReleaseNativeOnly|x64"
			OutputDirectory="$(ProjectDir)..\bin\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			IntermediateDirectory="..\obj\$(ConfigurationYear)\$(PlatformName)\$(ConfigurationName)Static"
			ConfigurationType="2"
			InheritedPropertySheets=".\props\sqlite3.vsprops;.\props\SQLite.Interop.2008.vsprops;.\props\include.vsprops"
			CharacterSet="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="3"
				EnableIntrinsicFunctions="true"
				FavorSizeOrSpeed="1"
				AdditionalIncludeDirectories="$(INTEROP_INCLUDE_DIRECTORIES)"
				PreprocessorDefinitions="WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES)"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeLibrary="0"
				UsePrecompiledHeader="0"
				WarningLevel="4"
				DebugInformationFormat="3"
				CompileAs="0"
				DisableSpecificWarnings="$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS)"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;RC_MSC_VER=1500;$(INTEROP_RESOURCE_DEFINES);&quot;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION)&quot;"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalLibraryDirectories="$(INTEROP_LIBRARY_DIRECTORIES)"
				AdditionalDependencies="$(INTEROP_LIBRARY_DEPENDENCIES)"
				OutputFile="$(OutDir)\$(INTEROP_NATIVE_NAME).dll"
				Version="$(INTEROP_LINKER_VERSION)"
				LinkIncremental="1"
				GenerateDebugInformation="true"
				ProgramDatabaseFile="$(OutDir)\$(INTEROP_NATIVE_NAME).pdb"
				GenerateMapFile="true"
				MapExports="true"
				SubSystem="2"
				LargeAddressAware="0"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				ImportLibrary="$(OutDir)\$(INTEROP_NATIVE_NAME).lib"
				TargetMachine="17"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				VerboseOutput="true"
				AssemblyIdentity="$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32"
				UpdateFileHashes="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine="XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Release\bin\$(PlatformName)\&quot; /D /E /V /I /F /H /Y &amp;&amp; IF /I &quot;%PROCESSOR_ARCHITECTURE%&quot; == &quot;x86&quot; IF /I &quot;%PROCESSOR_ARCHITEW6432%&quot; == &quot;AMD64&quot; XCOPY &quot;$(TargetDir)$(TargetName).*&quot; &quot;$(TargetDir)..\..\Release\bin\&quot; /D /E /V /I /F /H /Y"
			/>
		</Configuration>
	</Configurations>
	<References>
	</References>
	<Files>
		<Filter
			Name="Source Files"
			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
			>
			<File
				RelativePath=".\src\win\AssemblyInfo.cpp"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\win\crypt.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\contrib\extension-functions.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\fts5.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\percentile.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\regexp.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\sha1.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\shathree.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\totype.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\ext\vtshim.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\src\generic\interop.c"
				>
			</File>
			<File
				RelativePath=".\src\core\sqlite3.c"
				>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCCLCompilerTool"
					/>
				</FileConfiguration>
			</File>
		</Filter>
		<Filter
			Name="Header Files"
			Filter="h;hpp;hxx;hm;inl;inc;xsd"
			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
			>
			<File
				RelativePath=".\src\core\sqlite3.h"
				>
			</File>
			<File
				RelativePath=".\src\core\sqlite3ext.h"
				>
			</File>
			<File
				RelativePath=".\src\generic\interop.h"
				>
			</File>
		</Filter>
		<Filter
			Name="Resource Files"
			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
			>
			<File
				RelativePath=".\src\win\SQLite.Interop.rc"
				>
			</File>
			<File
				RelativePath="..\System.Data.SQLite\Resources\SR.resx"
				>
				<FileConfiguration
					Name="Debug|Win32"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\$(INTEROP_MIXED_NAME).$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\$(INTEROP_MIXED_NAME).$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="DebugNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\$(INTEROP_MIXED_NAME).$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\$(INTEROP_MIXED_NAME).$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="ReleaseNativeOnly|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
			</File>
		</Filter>
		<Filter
			Name="Property Files"
			>
			<File
				RelativePath=".\props\include.vsprops"
				>
			</File>
			<File
				RelativePath=".\props\SQLite.Interop.2008.vsprops"
				>
			</File>
			<File
				RelativePath=".\props\sqlite3.vsprops"
				>
			</File>
		</Filter>
	</Files>
	<Globals>
	</Globals>
</VisualStudioProject>

Added SQLite.Interop/SQLite.Interop.Static.2010.vcxproj.















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.Static.2010.vcxproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="DebugNativeOnly|x64">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="DebugNativeOnly|Win32">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|x64">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|Win32">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectName>SQLite.Interop.Static.2010</ProjectName>
    <ProjectGuid>{490CBC51-A3B2-4397-89F9-16E858DCB4F8}</ProjectGuid>
    <RootNamespace>SQLite.Interop</RootNamespace>
    <Keyword>Win32Proj</Keyword>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <Import Project="props\sqlite3.props" />
  <Import Project="props\SQLite.Interop.2010.props" />
  <PropertyGroup>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <Import Project="$(INTEROP_EXTRA_PROPS_FILE)"
          Condition="'$(INTEROP_EXTRA_PROPS_FILE)' != '' And
                     Exists('$(INTEROP_EXTRA_PROPS_FILE)')" />
  <PropertyGroup Condition="('$(Configuration)' == 'DebugNativeOnly' Or
                             '$(Configuration)' == 'ReleaseNativeOnly') And
                            (('$(Platform)' == 'Win32' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != '')) Or
                             ('$(Platform)' == 'x64' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != 'AMD64')))"
                 Label="PostBuildEvent">
    <DoesMachineMatchPlatform>false</DoesMachineMatchPlatform>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  <PropertyGroup>
    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
    <OutDir>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Platform)\$(Configuration)Static\</OutDir>
    <IntDir>..\obj\$(ConfigurationYear)\$(Platform)\$(Configuration)Static\</IntDir>
    <LinkIncremental>false</LinkIncremental>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkDelaySign>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1600;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1600;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1600;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1600;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1600;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1600;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1600;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1600;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c" />
    <ClCompile Include="src\core\sqlite3.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\SQLite.Interop.2010.props" />
    <None Include="props\sqlite3.props" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h" />
    <ClInclude Include="src\core\sqlite3ext.h" />
    <ClInclude Include="src\generic\interop.h" />
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <LogicalName>System.Data.SQLite.%(Filename).resources</LogicalName>
      <SubType>Designer</SubType>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">true</ExcludedFromBuild>
    </EmbeddedResource>
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

Added SQLite.Interop/SQLite.Interop.Static.2010.vcxproj.filters.



























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.Static.2010.vcxproj.filters -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <Filter Include="Source Files">
      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
    </Filter>
    <Filter Include="Header Files">
      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
    </Filter>
    <Filter Include="Resource Files">
      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
    </Filter>
    <Filter Include="Property Files">
      <UniqueIdentifier>{d69d5c95-1d03-4325-ad06-fce223ab4e42}</UniqueIdentifier>
    </Filter>
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\core\sqlite3.c">
      <Filter>Source Files</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\sqlite3.props">
      <Filter>Property Files</Filter>
    </None>
    <None Include="props\SQLite.Interop.2010.props">
      <Filter>Property Files</Filter>
    </None>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\core\sqlite3ext.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\generic\interop.h">
      <Filter>Header Files</Filter>
    </ClInclude>
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc">
      <Filter>Resource Files</Filter>
    </ResourceCompile>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <Filter>Resource Files</Filter>
    </EmbeddedResource>
  </ItemGroup>
</Project>

Added SQLite.Interop/SQLite.Interop.Static.2012.vcxproj.





























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.Static.2012.vcxproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="DebugNativeOnly|x64">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="DebugNativeOnly|Win32">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|x64">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|Win32">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectName>SQLite.Interop.Static.2012</ProjectName>
    <ProjectGuid>{490CBC51-A3B2-4397-89F9-16E858DCB4F8}</ProjectGuid>
    <RootNamespace>SQLite.Interop</RootNamespace>
    <Keyword>Win32Proj</Keyword>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <Import Project="props\sqlite3.props" />
  <Import Project="props\SQLite.Interop.2012.props" />
  <PropertyGroup>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <Import Project="$(INTEROP_EXTRA_PROPS_FILE)"
          Condition="'$(INTEROP_EXTRA_PROPS_FILE)' != '' And
                     Exists('$(INTEROP_EXTRA_PROPS_FILE)')" />
  <PropertyGroup Condition="('$(Configuration)' == 'DebugNativeOnly' Or
                             '$(Configuration)' == 'ReleaseNativeOnly') And
                            (('$(Platform)' == 'Win32' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != '')) Or
                             ('$(Platform)' == 'x64' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != 'AMD64')))"
                 Label="PostBuildEvent">
    <DoesMachineMatchPlatform>false</DoesMachineMatchPlatform>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v110</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v110</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v110</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v110</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v110</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v110</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v110</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v110</PlatformToolset>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  <PropertyGroup>
    <OutDir>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Platform)\$(Configuration)Static\</OutDir>
    <IntDir>..\obj\$(ConfigurationYear)\$(Platform)\$(Configuration)Static\</IntDir>
    <LinkIncremental>false</LinkIncremental>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkDelaySign>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1700;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c" />
    <ClCompile Include="src\core\sqlite3.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\SQLite.Interop.2012.props" />
    <None Include="props\sqlite3.props" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h" />
    <ClInclude Include="src\core\sqlite3ext.h" />
    <ClInclude Include="src\generic\interop.h" />
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <LogicalName>System.Data.SQLite.%(Filename).resources</LogicalName>
      <SubType>Designer</SubType>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">true</ExcludedFromBuild>
    </EmbeddedResource>
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

Added SQLite.Interop/SQLite.Interop.Static.2012.vcxproj.filters.



























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.Static.2012.vcxproj.filters -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <Filter Include="Source Files">
      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
    </Filter>
    <Filter Include="Header Files">
      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
    </Filter>
    <Filter Include="Resource Files">
      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
    </Filter>
    <Filter Include="Property Files">
      <UniqueIdentifier>{d69d5c95-1d03-4325-ad06-fce223ab4e42}</UniqueIdentifier>
    </Filter>
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\core\sqlite3.c">
      <Filter>Source Files</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\sqlite3.props">
      <Filter>Property Files</Filter>
    </None>
    <None Include="props\SQLite.Interop.2012.props">
      <Filter>Property Files</Filter>
    </None>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\core\sqlite3ext.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\generic\interop.h">
      <Filter>Header Files</Filter>
    </ClInclude>
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc">
      <Filter>Resource Files</Filter>
    </ResourceCompile>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <Filter>Resource Files</Filter>
    </EmbeddedResource>
  </ItemGroup>
</Project>

Added SQLite.Interop/SQLite.Interop.Static.2013.vcxproj.





























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.Static.2013.vcxproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="DebugNativeOnly|x64">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="DebugNativeOnly|Win32">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|x64">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|Win32">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectName>SQLite.Interop.Static.2013</ProjectName>
    <ProjectGuid>{490CBC51-A3B2-4397-89F9-16E858DCB4F8}</ProjectGuid>
    <RootNamespace>SQLite.Interop</RootNamespace>
    <Keyword>Win32Proj</Keyword>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <Import Project="props\sqlite3.props" />
  <Import Project="props\SQLite.Interop.2013.props" />
  <PropertyGroup>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <Import Project="$(INTEROP_EXTRA_PROPS_FILE)"
          Condition="'$(INTEROP_EXTRA_PROPS_FILE)' != '' And
                     Exists('$(INTEROP_EXTRA_PROPS_FILE)')" />
  <PropertyGroup Condition="('$(Configuration)' == 'DebugNativeOnly' Or
                             '$(Configuration)' == 'ReleaseNativeOnly') And
                            (('$(Platform)' == 'Win32' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != '')) Or
                             ('$(Platform)' == 'x64' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != 'AMD64')))"
                 Label="PostBuildEvent">
    <DoesMachineMatchPlatform>false</DoesMachineMatchPlatform>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v120</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v120</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v120</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v120</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v120</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v120</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v120</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v120</PlatformToolset>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  <PropertyGroup>
    <OutDir>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Platform)\$(Configuration)Static\</OutDir>
    <IntDir>..\obj\$(ConfigurationYear)\$(Platform)\$(Configuration)Static\</IntDir>
    <LinkIncremental>false</LinkIncremental>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkDelaySign>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1800;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1800;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1800;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1800;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1800;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1800;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1800;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1800;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c" />
    <ClCompile Include="src\core\sqlite3.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\SQLite.Interop.2013.props" />
    <None Include="props\sqlite3.props" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h" />
    <ClInclude Include="src\core\sqlite3ext.h" />
    <ClInclude Include="src\generic\interop.h" />
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <LogicalName>System.Data.SQLite.%(Filename).resources</LogicalName>
      <SubType>Designer</SubType>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">true</ExcludedFromBuild>
    </EmbeddedResource>
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

Added SQLite.Interop/SQLite.Interop.Static.2013.vcxproj.filters.



























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.Static.2013.vcxproj.filters -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <Filter Include="Source Files">
      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
    </Filter>
    <Filter Include="Header Files">
      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
    </Filter>
    <Filter Include="Resource Files">
      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
    </Filter>
    <Filter Include="Property Files">
      <UniqueIdentifier>{d69d5c95-1d03-4325-ad06-fce223ab4e42}</UniqueIdentifier>
    </Filter>
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\core\sqlite3.c">
      <Filter>Source Files</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\sqlite3.props">
      <Filter>Property Files</Filter>
    </None>
    <None Include="props\SQLite.Interop.2013.props">
      <Filter>Property Files</Filter>
    </None>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\core\sqlite3ext.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\generic\interop.h">
      <Filter>Header Files</Filter>
    </ClInclude>
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc">
      <Filter>Resource Files</Filter>
    </ResourceCompile>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <Filter>Resource Files</Filter>
    </EmbeddedResource>
  </ItemGroup>
</Project>

Added SQLite.Interop/SQLite.Interop.Static.2015.vcxproj.





























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.Static.2015.vcxproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="DebugNativeOnly|x64">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="DebugNativeOnly|Win32">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|x64">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|Win32">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectName>SQLite.Interop.Static.2015</ProjectName>
    <ProjectGuid>{490CBC51-A3B2-4397-89F9-16E858DCB4F8}</ProjectGuid>
    <RootNamespace>SQLite.Interop</RootNamespace>
    <Keyword>Win32Proj</Keyword>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <Import Project="props\sqlite3.props" />
  <Import Project="props\SQLite.Interop.2015.props" />
  <PropertyGroup>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <Import Project="$(INTEROP_EXTRA_PROPS_FILE)"
          Condition="'$(INTEROP_EXTRA_PROPS_FILE)' != '' And
                     Exists('$(INTEROP_EXTRA_PROPS_FILE)')" />
  <PropertyGroup Condition="('$(Configuration)' == 'DebugNativeOnly' Or
                             '$(Configuration)' == 'ReleaseNativeOnly') And
                            (('$(Platform)' == 'Win32' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != '')) Or
                             ('$(Platform)' == 'x64' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != 'AMD64')))"
                 Label="PostBuildEvent">
    <DoesMachineMatchPlatform>false</DoesMachineMatchPlatform>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v140</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v140</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v140</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v140</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v140</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v140</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v140</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v140</PlatformToolset>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  <PropertyGroup>
    <OutDir>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Platform)\$(Configuration)Static\</OutDir>
    <IntDir>..\obj\$(ConfigurationYear)\$(Platform)\$(Configuration)Static\</IntDir>
    <LinkIncremental>false</LinkIncremental>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkDelaySign>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1900;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1900;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1900;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1900;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1900;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1900;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1900;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1900;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c" />
    <ClCompile Include="src\core\sqlite3.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\SQLite.Interop.2015.props" />
    <None Include="props\sqlite3.props" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h" />
    <ClInclude Include="src\core\sqlite3ext.h" />
    <ClInclude Include="src\generic\interop.h" />
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <LogicalName>System.Data.SQLite.%(Filename).resources</LogicalName>
      <SubType>Designer</SubType>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">true</ExcludedFromBuild>
    </EmbeddedResource>
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

Added SQLite.Interop/SQLite.Interop.Static.2015.vcxproj.filters.



























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.Static.2015.vcxproj.filters -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <Filter Include="Source Files">
      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
    </Filter>
    <Filter Include="Header Files">
      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
    </Filter>
    <Filter Include="Resource Files">
      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
    </Filter>
    <Filter Include="Property Files">
      <UniqueIdentifier>{d69d5c95-1d03-4325-ad06-fce223ab4e42}</UniqueIdentifier>
    </Filter>
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\core\sqlite3.c">
      <Filter>Source Files</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\sqlite3.props">
      <Filter>Property Files</Filter>
    </None>
    <None Include="props\SQLite.Interop.2015.props">
      <Filter>Property Files</Filter>
    </None>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\core\sqlite3ext.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\generic\interop.h">
      <Filter>Header Files</Filter>
    </ClInclude>
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc">
      <Filter>Resource Files</Filter>
    </ResourceCompile>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <Filter>Resource Files</Filter>
    </EmbeddedResource>
  </ItemGroup>
</Project>

Added SQLite.Interop/SQLite.Interop.Static.2017.vcxproj.





























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.Static.2017.vcxproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup Label="ProjectConfigurations">
    <ProjectConfiguration Include="DebugNativeOnly|x64">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|Win32">
      <Configuration>Debug</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="DebugNativeOnly|Win32">
      <Configuration>DebugNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Debug|x64">
      <Configuration>Debug</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|x64">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|Win32">
      <Configuration>Release</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="ReleaseNativeOnly|Win32">
      <Configuration>ReleaseNativeOnly</Configuration>
      <Platform>Win32</Platform>
    </ProjectConfiguration>
    <ProjectConfiguration Include="Release|x64">
      <Configuration>Release</Configuration>
      <Platform>x64</Platform>
    </ProjectConfiguration>
  </ItemGroup>
  <PropertyGroup Label="Globals">
    <ProjectName>SQLite.Interop.Static.2017</ProjectName>
    <ProjectGuid>{490CBC51-A3B2-4397-89F9-16E858DCB4F8}</ProjectGuid>
    <RootNamespace>SQLite.Interop</RootNamespace>
    <Keyword>Win32Proj</Keyword>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
  <Import Project="props\sqlite3.props" />
  <Import Project="props\SQLite.Interop.2017.props" />
  <PropertyGroup>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <Import Project="$(INTEROP_EXTRA_PROPS_FILE)"
          Condition="'$(INTEROP_EXTRA_PROPS_FILE)' != '' And
                     Exists('$(INTEROP_EXTRA_PROPS_FILE)')" />
  <PropertyGroup Condition="('$(Configuration)' == 'DebugNativeOnly' Or
                             '$(Configuration)' == 'ReleaseNativeOnly') And
                            (('$(Platform)' == 'Win32' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != '')) Or
                             ('$(Platform)' == 'x64' And
                             ('$(PROCESSOR_ARCHITECTURE)' != 'x86' Or
                              '$(PROCESSOR_ARCHITEW6432)' != 'AMD64')))"
                 Label="PostBuildEvent">
    <DoesMachineMatchPlatform>false</DoesMachineMatchPlatform>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v141</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v141</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v141</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <PlatformToolset>v141</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v141</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
    <TargetName>$(INTEROP_MIXED_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v141</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v141</PlatformToolset>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'" Label="Configuration">
    <TargetName>$(INTEROP_NATIVE_NAME)</TargetName>
    <ConfigurationType>DynamicLibrary</ConfigurationType>
    <CharacterSet>Unicode</CharacterSet>
    <WholeProgramOptimization>true</WholeProgramOptimization>
    <PlatformToolset>v141</PlatformToolset>
  </PropertyGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
  <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
  <PropertyGroup>
    <OutDir>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Platform)\$(Configuration)Static\</OutDir>
    <IntDir>..\obj\$(ConfigurationYear)\$(Platform)\$(Configuration)Static\</IntDir>
    <LinkIncremental>false</LinkIncremental>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkKeyFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(INTEROP_KEY_FILE)</LinkKeyFile>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkDelaySign>
    <LinkDelaySign Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkDelaySign>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1910;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1910;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <AssemblyDebug>true</AssemblyDebug>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1910;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <ClCompile>
      <Optimization>Disabled</Optimization>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;_DEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_DEBUG_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);$(INTEROP_DEBUG_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>_DEBUG;RC_MSC_VER=1910;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">
    <BaseConfiguration>Debug</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1910;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX86</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1910;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalOptions>$(INTEROP_ASSEMBLY_RESOURCES) %(AdditionalOptions)</AdditionalOptions>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(ProjectDir)..\bin\$(ConfigurationYear)\$(Configuration)Module\bin\System.Data.SQLite.netmodule;$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
      <TargetMachine>MachineX64</TargetMachine>
      <CLRUnmanagedCodeCheck>true</CLRUnmanagedCodeCheck>
      <KeyFile>$(INTEROP_KEY_FILE)</KeyFile>
      <DelaySign>true</DelaySign>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      ReSignMixedModeAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1910;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX86</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=x86, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <ClCompile>
      <Optimization>Full</Optimization>
      <IntrinsicFunctions>true</IntrinsicFunctions>
      <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
      <AdditionalIncludeDirectories>$(INTEROP_INCLUDE_DIRECTORIES);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
      <PreprocessorDefinitions>WIN32;x64;NDEBUG;_WINDOWS;_USRDLL;$(SQLITE_COMMON_DEFINES);$(SQLITE_EXTRA_DEFINES);$(SQLITE_USER_DEFINES);$(SQLITE_RELEASE_DEFINES);$(INTEROP_EXTRA_DEFINES);$(INTEROP_USER_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
      <MinimalRebuild>false</MinimalRebuild>
      <BasicRuntimeChecks>Default</BasicRuntimeChecks>
      <StringPooling>true</StringPooling>
      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
      <WarningLevel>Level4</WarningLevel>
      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
      <CompileAs>Default</CompileAs>
      <DisableSpecificWarnings>$(SQLITE_DISABLE_WARNINGS);$(SQLITE_DISABLE_X64_WARNINGS);%(DisableSpecificWarnings)</DisableSpecificWarnings>
    </ClCompile>
    <ResourceCompile>
      <PreprocessorDefinitions>NDEBUG;RC_MSC_VER=1910;INTEROP_RC_VERSION=$(INTEROP_RC_VERSION);$(INTEROP_RESOURCE_DEFINES);%(PreprocessorDefinitions)</PreprocessorDefinitions>
    </ResourceCompile>
    <Link>
      <AdditionalLibraryDirectories>$(INTEROP_LIBRARY_DIRECTORIES)</AdditionalLibraryDirectories>
      <AdditionalDependencies>$(INTEROP_LIBRARY_DEPENDENCIES);%(AdditionalDependencies)</AdditionalDependencies>
      <Version>$(INTEROP_LINKER_VERSION)</Version>
      <GenerateDebugInformation>true</GenerateDebugInformation>
      <GenerateMapFile>true</GenerateMapFile>
      <MapExports>true</MapExports>
      <SubSystem>Windows</SubSystem>
      <OptimizeReferences>true</OptimizeReferences>
      <EnableCOMDATFolding>true</EnableCOMDATFolding>
      <TargetMachine>MachineX64</TargetMachine>
    </Link>
    <Manifest>
      <VerboseOutput>true</VerboseOutput>
      <AssemblyIdentity>$(ProjectName), processorArchitecture=amd64, version=$(INTEROP_MANIFEST_VERSION), type=win32</AssemblyIdentity>
      <UpdateFileHashes>true</UpdateFileHashes>
    </Manifest>
  </ItemDefinitionGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">
    <BaseConfiguration>Release</BaseConfiguration>
    <AfterBuildLinkTargets>
      $(AfterBuildLinkTargets);
      CopyInteropAssembly;
    </AfterBuildLinkTargets>
  </PropertyGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c" />
    <ClCompile Include="src\core\sqlite3.c">
      <ExcludedFromBuild>true</ExcludedFromBuild>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\SQLite.Interop.2017.props" />
    <None Include="props\sqlite3.props" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h" />
    <ClInclude Include="src\core\sqlite3ext.h" />
    <ClInclude Include="src\generic\interop.h" />
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <LogicalName>System.Data.SQLite.%(Filename).resources</LogicalName>
      <SubType>Designer</SubType>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugNativeOnly|x64'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|Win32'">true</ExcludedFromBuild>
      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ReleaseNativeOnly|x64'">true</ExcludedFromBuild>
    </EmbeddedResource>
  </ItemGroup>
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>

Added SQLite.Interop/SQLite.Interop.Static.2017.vcxproj.filters.



























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.Static.2017.vcxproj.filters -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <Filter Include="Source Files">
      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
    </Filter>
    <Filter Include="Header Files">
      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
    </Filter>
    <Filter Include="Resource Files">
      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
    </Filter>
    <Filter Include="Property Files">
      <UniqueIdentifier>{d69d5c95-1d03-4325-ad06-fce223ab4e42}</UniqueIdentifier>
    </Filter>
  </ItemGroup>
  <ItemGroup>
    <ClCompile Include="src\win\AssemblyInfo.cpp">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\win\crypt.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\contrib\extension-functions.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\fts5.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\percentile.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\regexp.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\sha1.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\shathree.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\totype.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\ext\vtshim.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\generic\interop.c">
      <Filter>Source Files</Filter>
    </ClCompile>
    <ClCompile Include="src\core\sqlite3.c">
      <Filter>Source Files</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <None Include="props\sqlite3.props">
      <Filter>Property Files</Filter>
    </None>
    <None Include="props\SQLite.Interop.2017.props">
      <Filter>Property Files</Filter>
    </None>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\core\sqlite3.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\core\sqlite3ext.h">
      <Filter>Header Files</Filter>
    </ClInclude>
    <ClInclude Include="src\generic\interop.h">
      <Filter>Header Files</Filter>
    </ClInclude>
  </ItemGroup>
  <ItemGroup>
    <ResourceCompile Include="src\win\SQLite.Interop.rc">
      <Filter>Resource Files</Filter>
    </ResourceCompile>
    <EmbeddedResource Include="..\System.Data.SQLite\Resources\SR.resx">
      <Filter>Resource Files</Filter>
    </EmbeddedResource>
  </ItemGroup>
</Project>

Deleted SQLite.Interop/SQLite.Interop.rc.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE 
BEGIN
    "#include ""afxres.h""\r\n"
    "\0"
END

3 TEXTINCLUDE 
BEGIN
    "\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,67,0
 PRODUCTVERSION 1,0,0,0
 FILEFLAGSMASK 0x17L
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x2L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "Comments", "http://sqlite.phxsoftware.com"
            VALUE "FileDescription", "System.Data.SQLite Interop Library"
            VALUE "FileVersion", "1.0.67.0"
            VALUE "InternalName", "SQLite.Interop.DLL"
            VALUE "LegalCopyright", "Released to the public domain"
            VALUE "OriginalFilename", "SQLite3.DLL 3.7.0.1"
            VALUE "ProductName", "System.Data.SQLite"
            VALUE "ProductVersion", "1.0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END

#endif    // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED

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












































































































































































































Deleted SQLite.Interop/SQLite.Interop.vcproj.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
	ProjectType="Visual C++"
	Version="9.00"
	Name="SQLite.Interop"
	ProjectGUID="{10B51CE8-A838-44DE-BD82-B658F0296F80}"
	RootNamespace="SQLite.Interop"
	Keyword="Win32Proj"
	TargetFrameworkVersion="131072"
	>
	<Platforms>
		<Platform
			Name="Win32"
		/>
		<Platform
			Name="Pocket PC 2003 (ARMV4)"
		/>
		<Platform
			Name="Itanium"
		/>
		<Platform
			Name="x64"
		/>
	</Platforms>
	<ToolFiles>
	</ToolFiles>
	<Configurations>
		<Configuration
			Name="Release|Win32"
			OutputDirectory="$(ConfigurationName)"
			IntermediateDirectory="$(ConfigurationName)"
			ConfigurationType="2"
			CharacterSet="2"
			ManagedExtensions="0"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
				CommandLine=""
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				AdditionalOptions="/GS-"
				Optimization="2"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_RTREE;SQLITE_ENABLE_LOAD_EXTENSION;SQLITE_SOUNDEX"
				StringPooling="true"
				ExceptionHandling="0"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
				ResourceFileName="$(IntDir)\System.Data.SQLite.$(InputName).resources"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions="/ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteCommand.bmp,System.Data.SQLite.SQLiteCommand.bmp&#x0D;&#x0A;/ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteConnection.bmp,System.Data.SQLite.SQLiteConnection.bmp&#x0D;&#x0A;/ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteDataAdapter.bmp,System.Data.SQLite.SQLiteDataAdapter.bmp"
				AdditionalDependencies="..\System.Data.SQLite\bin\System.Data.SQLite.netmodule"
				OutputFile="../bin/System.Data.SQLite.DLL"
				GenerateManifest="false"
				IgnoreDefaultLibraryNames=""
				ModuleDefinitionFile="src\sqlite3.def"
				EmbedManagedResourceFile=""
				DelayLoadDLLs="advapi32.dll"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary=""
				TargetMachine="1"
				KeyFile="..\System.Data.SQLite\System.Data.SQLite.snk"
				CLRUnmanagedCodeCheck="true"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				EmbedManifest="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine=""
			/>
		</Configuration>
		<Configuration
			Name="Release|Pocket PC 2003 (ARMV4)"
			OutputDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			IntermediateDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			ConfigurationType="2"
			CharacterSet="1"
			WholeProgramOptimization="0"
			>
			<Tool
				Name="VCPreBuildEventTool"
				CommandLine=""
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				Optimization="1"
				FavorSizeOrSpeed="2"
				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);NDEBUG;_WINDOWS;_USRDLL;CPPSMART_EXPORTS;$(ARCHFAM);$(_ARCHFAM_);UNICODE;_UNICODE;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_RTREE;SQLITE_ENABLE_LOAD_EXTENSION;SQLITE_SOUNDEX;INVALID_FILE_ATTRIBUTES=((DWORD)-1);SQLITE_OMIT_WAL"
				StringPooling="true"
				ExceptionHandling="0"
				BufferSecurityCheck="false"
				CompileForArchitecture="0"
				InterworkCalls="false"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
				ResourceFileName="$(IntDir)\System.Data.SQLite.$(InputName).resources"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
				Culture="1033"
				AdditionalIncludeDirectories="$(IntDir)"
			/>
			<Tool
				Name="VCPreLinkEventTool"
				CommandLine=""
			/>
			<Tool
				Name="VCLinkerTool"
				IgnoreImportLibrary="true"
				AdditionalOptions=" /subsystem:windowsce,4.20 /ARMPADCODE"
				OutputFile="../bin/CompactFramework/$(InputName).067.DLL"
				AdditionalLibraryDirectories=""
				IgnoreDefaultLibraryNames=""
				ModuleDefinitionFile="src\sqlite3.def"
				AddModuleNamesToAssembly=""
				EmbedManagedResourceFile=""
				EntryPointSymbol=""
				MergeSections=""
				TargetMachine="3"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine=""
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory="\Program Files\testce"
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
		<Configuration
			Name="Release|Itanium"
			OutputDirectory="ia64\$(ConfigurationName)"
			IntermediateDirectory="ia64\$(ConfigurationName)"
			ConfigurationType="2"
			CharacterSet="2"
			ManagedExtensions="0"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
				CommandLine=""
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="2"
			/>
			<Tool
				Name="VCCLCompilerTool"
				AdditionalOptions="/GS-"
				Optimization="2"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;WIN64;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_RTREE;SQLITE_ENABLE_LOAD_EXTENSION;SQLITE_SOUNDEX"
				StringPooling="true"
				ExceptionHandling="0"
				BufferSecurityCheck="false"
				EnableFunctionLevelLinking="true"
				RuntimeTypeInfo="false"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
				ResourceFileName="$(IntDir)\System.Data.SQLite.$(InputName).resources"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions="/ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteCommand.bmp,System.Data.SQLite.SQLiteCommand.bmp&#x0D;&#x0A;/ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteConnection.bmp,System.Data.SQLite.SQLiteConnection.bmp&#x0D;&#x0A;/ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteDataAdapter.bmp,System.Data.SQLite.SQLiteDataAdapter.bmp"
				AdditionalDependencies="..\System.Data.SQLite\bin\System.Data.SQLite.netmodule"
				OutputFile="../bin/Itanium/System.Data.SQLite.DLL"
				ModuleDefinitionFile="src\sqlite3.def"
				EmbedManagedResourceFile=""
				DelayLoadDLLs="advapi32.dll"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary=""
				TargetMachine="5"
				KeyFile="..\System.Data.SQLite\System.Data.SQLite.snk"
				CLRUnmanagedCodeCheck="true"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				EmbedManifest="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine=""
			/>
		</Configuration>
		<Configuration
			Name="Release|x64"
			OutputDirectory="x64\$(ConfigurationName)"
			IntermediateDirectory="x64\$(ConfigurationName)"
			ConfigurationType="2"
			CharacterSet="2"
			ManagedExtensions="0"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
				CommandLine=""
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				AdditionalOptions="/GS-"
				Optimization="2"
				FavorSizeOrSpeed="1"
				PreprocessorDefinitions="NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;WIN64;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_RTREE;SQLITE_ENABLE_LOAD_EXTENSION;SQLITE_SOUNDEX"
				StringPooling="true"
				ExceptionHandling="0"
				BufferSecurityCheck="false"
				EnableFunctionLevelLinking="true"
				RuntimeTypeInfo="false"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
				ResourceFileName="$(IntDir)\System.Data.SQLite.$(InputName).resources"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				AdditionalOptions="/ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteCommand.bmp,System.Data.SQLite.SQLiteCommand.bmp&#x0D;&#x0A;/ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteConnection.bmp,System.Data.SQLite.SQLiteConnection.bmp&#x0D;&#x0A;/ASSEMBLYRESOURCE:..\System.Data.SQLite\SQLiteDataAdapter.bmp,System.Data.SQLite.SQLiteDataAdapter.bmp"
				AdditionalDependencies="..\System.Data.SQLite\bin\System.Data.SQLite.netmodule"
				OutputFile="../bin/x64/System.Data.SQLite.DLL"
				ModuleDefinitionFile="src\sqlite3.def"
				EmbedManagedResourceFile=""
				DelayLoadDLLs="advapi32.dll"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary=""
				TargetMachine="17"
				KeyFile="..\System.Data.SQLite\System.Data.SQLite.snk"
				CLRUnmanagedCodeCheck="true"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				EmbedManifest="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine=""
			/>
		</Configuration>
		<Configuration
			Name="Debug|Win32"
			OutputDirectory="$(ConfigurationName)"
			IntermediateDirectory="$(ConfigurationName)"
			ConfigurationType="2"
			CharacterSet="2"
			ManagedExtensions="0"
			WholeProgramOptimization="0"
			>
			<Tool
				Name="VCPreBuildEventTool"
				CommandLine=""
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				AdditionalOptions="/GS-"
				Optimization="0"
				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_RTREE;SQLITE_ENABLE_LOAD_EXTENSION;SQLITE_SOUNDEX"
				BasicRuntimeChecks="3"
				RuntimeLibrary="3"
				RuntimeTypeInfo="false"
				DebugInformationFormat="3"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				OutputFile="../bin/$(InputName).DLL"
				LinkIncremental="1"
				ModuleDefinitionFile="src\sqlite3.def"
				EmbedManagedResourceFile=""
				DelayLoadDLLs="advapi32.dll"
				GenerateDebugInformation="true"
				ImportLibrary=""
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				EmbedManifest="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine=""
			/>
		</Configuration>
		<Configuration
			Name="Debug|Pocket PC 2003 (ARMV4)"
			OutputDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			IntermediateDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			ConfigurationType="2"
			CharacterSet="1"
			WholeProgramOptimization="0"
			>
			<Tool
				Name="VCPreBuildEventTool"
				CommandLine=""
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="1"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				AdditionalOptions="/GS-"
				Optimization="0"
				PreprocessorDefinitions="_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;_WINDOWS;_USRDLL;CPPSMART_EXPORTS;$(ARCHFAM);$(_ARCHFAM_);UNICODE;_UNICODE;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_RTREE;SQLITE_ENABLE_LOAD_EXTENSION;SQLITE_SOUNDEX;INVALID_FILE_ATTRIBUTES=((DWORD)-1)"
				DebugInformationFormat="3"
				InterworkCalls="false"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
				Culture="1033"
				AdditionalIncludeDirectories="$(IntDir)"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				IgnoreImportLibrary="true"
				AdditionalOptions=" /subsystem:windowsce,4.20 /ARMPADCODE"
				OutputFile="../bin/CompactFramework/$(InputName).065.DLL"
				AdditionalLibraryDirectories=""
				IgnoreDefaultLibraryNames=""
				ModuleDefinitionFile="src\sqlite3.def"
				AddModuleNamesToAssembly=""
				EmbedManagedResourceFile=""
				GenerateDebugInformation="true"
				SubSystem="8"
				TargetMachine="3"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine=""
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory="\Program Files\testce"
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
		<Configuration
			Name="Debug|Itanium"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			CharacterSet="2"
			ManagedExtensions="0"
			WholeProgramOptimization="0"
			>
			<Tool
				Name="VCPreBuildEventTool"
				CommandLine=""
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="2"
			/>
			<Tool
				Name="VCCLCompilerTool"
				AdditionalOptions="/GS-"
				Optimization="0"
				PreprocessorDefinitions="SQLITE_DEBUG;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;WIN64;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_RTREE;SQLITE_ENABLE_LOAD_EXTENSION;SQLITE_SOUNDEX"
				RuntimeLibrary="3"
				RuntimeTypeInfo="false"
				DebugInformationFormat="3"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				OutputFile="../bin/Itanium/$(InputName).DLL"
				ModuleDefinitionFile="src\sqlite3.def"
				EmbedManagedResourceFile=""
				DelayLoadDLLs="advapi32.dll"
				GenerateDebugInformation="true"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary=""
				TargetMachine="5"
				KeyFile="..\System.Data.SQLite\System.Data.SQLite.snk"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				EmbedManifest="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
		<Configuration
			Name="Debug|x64"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			CharacterSet="2"
			ManagedExtensions="0"
			WholeProgramOptimization="0"
			>
			<Tool
				Name="VCPreBuildEventTool"
				CommandLine=""
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				AdditionalOptions="/GS-"
				Optimization="0"
				PreprocessorDefinitions="SQLITE_DEBUG;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;WIN64;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_RTREE;SQLITE_ENABLE_LOAD_EXTENSION;SQLITE_SOUNDEX"
				RuntimeLibrary="3"
				RuntimeTypeInfo="false"
				DebugInformationFormat="3"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				OutputFile="../bin/x64/$(InputName).DLL"
				ModuleDefinitionFile="src\sqlite3.def"
				EmbedManagedResourceFile=""
				DelayLoadDLLs="advapi32.dll"
				GenerateDebugInformation="true"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary=""
				TargetMachine="17"
				KeyFile="..\System.Data.SQLite\System.Data.SQLite.snk"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				EmbedManifest="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
		<Configuration
			Name="StockDebug|Win32"
			OutputDirectory="$(ConfigurationName)"
			IntermediateDirectory="$(ConfigurationName)"
			ConfigurationType="2"
			CharacterSet="2"
			ManagedExtensions="0"
			WholeProgramOptimization="0"
			>
			<Tool
				Name="VCPreBuildEventTool"
				CommandLine=""
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				AdditionalOptions="/GS-"
				Optimization="0"
				PreprocessorDefinitions="WIN32;SQLITE_DEBUG;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_RTREE;SQLITE_ENABLE_LOAD_EXTENSION;SQLITE_SOUNDEX;SQLITE_CORE"
				RuntimeLibrary="3"
				RuntimeTypeInfo="false"
				DebugInformationFormat="3"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				OutputFile="../bin/sqlite3.dll"
				LinkIncremental="1"
				ModuleDefinitionFile="src\sqlite3.def"
				EmbedManagedResourceFile=""
				DelayLoadDLLs="advapi32.dll"
				GenerateDebugInformation="true"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary=""
				TargetMachine="1"
				KeyFile="..\System.Data.SQLite\System.Data.SQLite.snk"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				EmbedManifest="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine=""
			/>
		</Configuration>
		<Configuration
			Name="StockDebug|Pocket PC 2003 (ARMV4)"
			OutputDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			IntermediateDirectory="Pocket PC 2003 (ARMV4)\$(ConfigurationName)"
			ConfigurationType="2"
			CharacterSet="1"
			WholeProgramOptimization="0"
			>
			<Tool
				Name="VCPreBuildEventTool"
				CommandLine=""
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="1"
			/>
			<Tool
				Name="VCCLCompilerTool"
				ExecutionBucket="7"
				AdditionalOptions="/GS-"
				Optimization="0"
				PreprocessorDefinitions="SQLITE_DEBUG;_WIN32_WCE=$(CEVER);UNDER_CE=$(CEVER);WINCE;$(PLATFORMDEFINES);_DEBUG;_WINDOWS;_USRDLL;CPPSMART_EXPORTS;$(ARCHFAM);$(_ARCHFAM_);UNICODE;_UNICODE;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_RTREE;SQLITE_ENABLE_LOAD_EXTENSION;SQLITE_SOUNDEX;SQLITE_CORE;INVALID_FILE_ATTRIBUTES=((DWORD)-1)"
				DebugInformationFormat="3"
				InterworkCalls="true"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
				PreprocessorDefinitions="NDEBUG;_UNICODE;UNICODE;_WIN32_WCE;UNDER_CE"
				Culture="1033"
				AdditionalIncludeDirectories="$(IntDir)"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				IgnoreImportLibrary="true"
				AdditionalOptions=" /subsystem:windowsce,4.20 /machine:ARM /ARMPADCODE"
				OutputFile="../bin/CompactFramework/sqlite3.dll"
				AdditionalLibraryDirectories=""
				IgnoreDefaultLibraryNames=""
				ModuleDefinitionFile="src\sqlite3.def"
				AddModuleNamesToAssembly=""
				EmbedManagedResourceFile=""
				GenerateDebugInformation="true"
				TargetMachine="0"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCCodeSignTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
				CommandLine=""
			/>
			<DeploymentTool
				ForceDirty="-1"
				RemoteDirectory="\Program Files\testce"
				RegisterOutput="0"
				AdditionalFiles=""
			/>
			<DebuggerTool
			/>
		</Configuration>
		<Configuration
			Name="StockDebug|Itanium"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			CharacterSet="2"
			ManagedExtensions="0"
			WholeProgramOptimization="0"
			>
			<Tool
				Name="VCPreBuildEventTool"
				CommandLine=""
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="2"
			/>
			<Tool
				Name="VCCLCompilerTool"
				AdditionalOptions="/GS-"
				Optimization="0"
				PreprocessorDefinitions="SQLITE_DEBUG;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;WIN64;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_RTREE;SQLITE_ENABLE_LOAD_EXTENSION;SQLITE_SOUNDEX"
				RuntimeLibrary="3"
				RuntimeTypeInfo="false"
				DebugInformationFormat="3"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				OutputFile="../bin/Itanium/$(InputName).DLL"
				ModuleDefinitionFile="src\sqlite3.def"
				EmbedManagedResourceFile=""
				DelayLoadDLLs="advapi32.dll"
				GenerateDebugInformation="true"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary=""
				TargetMachine="5"
				KeyFile="..\System.Data.SQLite\System.Data.SQLite.snk"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				EmbedManifest="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
		<Configuration
			Name="StockDebug|x64"
			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
			ConfigurationType="2"
			CharacterSet="2"
			ManagedExtensions="0"
			WholeProgramOptimization="0"
			>
			<Tool
				Name="VCPreBuildEventTool"
				CommandLine=""
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
				TargetEnvironment="3"
			/>
			<Tool
				Name="VCCLCompilerTool"
				AdditionalOptions="/GS-"
				Optimization="0"
				PreprocessorDefinitions="SQLITE_DEBUG;_DEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_DEPRECATE;NO_TCL;THREADSAFE=1;WIN64;SQLITE_HAS_CODEC;SQLITE_ENABLE_COLUMN_METADATA;SQLITE_ENABLE_FTS3;SQLITE_ENABLE_RTREE;SQLITE_ENABLE_LOAD_EXTENSION;SQLITE_SOUNDEX"
				RuntimeLibrary="3"
				RuntimeTypeInfo="false"
				DebugInformationFormat="3"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				OutputFile="../bin/x64/$(InputName).DLL"
				ModuleDefinitionFile="src\sqlite3.def"
				EmbedManagedResourceFile=""
				DelayLoadDLLs="advapi32.dll"
				GenerateDebugInformation="true"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				ImportLibrary=""
				TargetMachine="17"
				KeyFile="..\System.Data.SQLite\System.Data.SQLite.snk"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				EmbedManifest="true"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
	</Configurations>
	<References>
	</References>
	<Files>
		<Filter
			Name="Header Files"
			Filter="h;hpp;hxx;hm;inl;inc;xsd"
			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
			>
			<File
				RelativePath=".\resource.h"
				>
			</File>
			<File
				RelativePath=".\src\sqlite3.h"
				>
			</File>
		</Filter>
		<Filter
			Name="Extras"
			>
			<File
				RelativePath=".\interop.c"
				>
			</File>
		</Filter>
		<Filter
			Name="Managed Resources"
			>
			<File
				RelativePath="..\System.Data.SQLite\SR.resx"
				>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\System.Data.SQLite.$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\System.Data.SQLite.$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Itanium"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\System.Data.SQLite.$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|x64"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
						ResourceFileName="$(IntDir)\System.Data.SQLite.$(InputName).resources"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|Itanium"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Debug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="StockDebug|Win32"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="StockDebug|Pocket PC 2003 (ARMV4)"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="StockDebug|Itanium"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="StockDebug|x64"
					ExcludedFromBuild="true"
					>
					<Tool
						Name="VCManagedResourceCompilerTool"
					/>
				</FileConfiguration>
			</File>
		</Filter>
		<Filter
			Name="Resources"
			>
			<File
				RelativePath=".\SQLite.Interop.rc"
				>
			</File>
		</Filter>
	</Files>
	<Globals>
	</Globals>
</VisualStudioProject>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/crypt.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
#ifndef SQLITE_OMIT_DISKIO
#ifdef SQLITE_HAS_CODEC

//#ifdef SQLITE_DEBUG
//#include "splitsource\pager.c"
//#endif

#include <windows.h>
#include <wincrypt.h>

// Extra padding before and after the cryptographic buffer
#define CRYPT_OFFSET 8

typedef struct _CRYPTBLOCK
{
  Pager    *pPager;       // Pager this cryptblock belongs to
  HCRYPTKEY hReadKey;     // Key used to read from the database and write to the journal
  HCRYPTKEY hWriteKey;    // Key used to write to the database
  DWORD     dwPageSize;   // Size of pages
  LPVOID    pvCrypt;      // A buffer for encrypting/decrypting (if necessary)
  DWORD     dwCryptSize;  // Equal to or greater than dwPageSize.  If larger, pvCrypt is valid and this is its size
} CRYPTBLOCK, *LPCRYPTBLOCK;

HCRYPTPROV g_hProvider = 0; // Global instance of the cryptographic provider

#define SQLITECRYPTERROR_PROVIDER "Cryptographic provider not available"

// Needed for re-keying
static void * sqlite3pager_get_codecarg(Pager *pPager)
{
  return (pPager->xCodec) ? pPager->pCodec: NULL;
}

void sqlite3_activate_see(const char *info)
{
}

// Create a cryptographic context.  Use the enhanced provider because it is available on
// most platforms
static BOOL InitializeProvider()
{
  if (g_hProvider) return TRUE;

  if (!CryptAcquireContext(&g_hProvider, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
  {
    return FALSE;
  }
  return TRUE;
}

// Create or update a cryptographic context for a pager.
// This function will automatically determine if the encryption algorithm requires
// extra padding, and if it does, will create a temp buffer big enough to provide
// space to hold it.
static LPCRYPTBLOCK CreateCryptBlock(HCRYPTKEY hKey, Pager *pager, int pageSize, LPCRYPTBLOCK pExisting)
{
  LPCRYPTBLOCK pBlock;

  if (!pExisting) // Creating a new cryptblock
  {
    pBlock = sqlite3_malloc(sizeof(CRYPTBLOCK));
    if (!pBlock) return NULL;

    ZeroMemory(pBlock, sizeof(CRYPTBLOCK));
    pBlock->hReadKey = hKey;
    pBlock->hWriteKey = hKey;
  }
  else // Updating an existing cryptblock
  {
    pBlock = pExisting;
  }

  if (pageSize == -1)
    pageSize = pager->pageSize;

  pBlock->pPager = pager;
  pBlock->dwPageSize = (DWORD)pageSize;
  pBlock->dwCryptSize = pBlock->dwPageSize;

  // Existing cryptblocks may have a buffer, if so, delete it
  if (pBlock->pvCrypt)
  {
    sqlite3_free(pBlock->pvCrypt);
    pBlock->pvCrypt = NULL;
  }

  // Figure out how big to make our spare crypt block
  CryptEncrypt(hKey, 0, TRUE, 0, NULL, &pBlock->dwCryptSize, pBlock->dwCryptSize * 2);
  pBlock->pvCrypt = sqlite3_malloc(pBlock->dwCryptSize + (CRYPT_OFFSET * 2));
  if (!pBlock->pvCrypt)
  {
    // We created a new block in here, so free it.  Otherwise leave the original intact
    if (pBlock != pExisting) 
      sqlite3_free(pBlock);

    return NULL;
  }

  return pBlock;
}

// Destroy a cryptographic context and any buffers and keys allocated therein
static void sqlite3CodecFree(LPVOID pv)
{
  LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)pv;
  // Destroy the read key if there is one
  if (pBlock->hReadKey)
  {
    CryptDestroyKey(pBlock->hReadKey);
  }

  // If there's a writekey and its not equal to the readkey, destroy it
  if (pBlock->hWriteKey && pBlock->hWriteKey != pBlock->hReadKey)
  {
    CryptDestroyKey(pBlock->hWriteKey);
  }

  // If there's extra buffer space allocated, free it as well
  if (pBlock->pvCrypt)
  {
    sqlite3_free(pBlock->pvCrypt);
  }

  // All done with this cryptblock
  sqlite3_free(pBlock);
}

void sqlite3CodecSizeChange(void *pArg, int pageSize, int reservedSize)
{
  LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)pArg;

  if (pBlock->dwPageSize != pageSize)
  {
    CreateCryptBlock(pBlock->hReadKey, pBlock->pPager, pageSize, pBlock);
    // If this fails, pvCrypt will be NULL, and the next time sqlite3Codec() is called, it will result in an error
  }
}

// Encrypt/Decrypt functionality, called by pager.c
void * sqlite3Codec(void *pArg, void *data, Pgno nPageNum, int nMode)
{
  LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)pArg;
  DWORD dwPageSize;
  LPVOID pvTemp;

  if (!pBlock) return data;
  if (pBlock->pvCrypt == NULL) return NULL; // This only happens if CreateCryptBlock() failed to make scratch space

  switch(nMode)
  {
  case 0: // Undo a "case 7" journal file encryption
  case 2: // Reload a page
  case 3: // Load a page
    if (!pBlock->hReadKey) break;

    /* Block ciphers often need to write extra padding beyond the 
    data block.  We don't have that luxury for a given page of data so
    we must copy the page data to a buffer that IS large enough to hold
    the padding.  We then encrypt the block and write the buffer back to
    the page without the unnecessary padding.
    We only use the special block of memory if its absolutely necessary. */
    if (pBlock->dwCryptSize != pBlock->dwPageSize)
    {
      CopyMemory(((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET, data, pBlock->dwPageSize);
      pvTemp = data;
      data = ((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET;
    }

    dwPageSize = pBlock->dwCryptSize;
    CryptDecrypt(pBlock->hReadKey, 0, TRUE, 0, (LPBYTE)data, &dwPageSize);

    // If the encryption algorithm required extra padding and we were forced to encrypt or
    // decrypt a copy of the page data to a temp buffer, then write the contents of the temp
    // buffer back to the page data minus any padding applied.
    if (pBlock->dwCryptSize != pBlock->dwPageSize)
    {
      CopyMemory(pvTemp, data, pBlock->dwPageSize);
      data = pvTemp;
    }
    break;
  case 6: // Encrypt a page for the main database file
    if (!pBlock->hWriteKey) break;

    CopyMemory(((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET, data, pBlock->dwPageSize);
    data = ((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET;

    dwPageSize = pBlock->dwPageSize;
    CryptEncrypt(pBlock->hWriteKey, 0, TRUE, 0, ((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET, &dwPageSize, pBlock->dwCryptSize);
    break;
  case 7: // Encrypt a page for the journal file
    /* Under normal circumstances, the readkey is the same as the writekey.  However,
    when the database is being rekeyed, the readkey is not the same as the writekey.
    The rollback journal must be written using the original key for the
    database file because it is, by nature, a rollback journal.
    Therefore, for case 7, when the rollback is being written, always encrypt using
    the database's readkey, which is guaranteed to be the same key that was used to
    read the original data.
    */
    if (!pBlock->hReadKey) break;

    CopyMemory(((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET, data, pBlock->dwPageSize);
    data = ((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET;

    dwPageSize = pBlock->dwPageSize;
    CryptEncrypt(pBlock->hReadKey, 0, TRUE, 0, ((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET, &dwPageSize, pBlock->dwCryptSize);
    break;
  }

  return data;
}

// Derive an encryption key from a user-supplied buffer
static HCRYPTKEY DeriveKey(const void *pKey, int nKeyLen)
{
  HCRYPTHASH hHash = 0;
  HCRYPTKEY  hKey;

  if (!pKey || !nKeyLen) return 0;

  if (!InitializeProvider())
  {
    return MAXDWORD;
  }

  if (CryptCreateHash(g_hProvider, CALG_SHA1, 0, 0, &hHash))
  {
    if (CryptHashData(hHash, (LPBYTE)pKey, nKeyLen, 0))
    {
      CryptDeriveKey(g_hProvider, CALG_RC4, hHash, 0, &hKey);
    }
    CryptDestroyHash(hHash);
  }  
  return hKey;
}

// Called by sqlite and sqlite3_key_interop to attach a key to a database.
int sqlite3CodecAttach(sqlite3 *db, int nDb, const void *pKey, int nKeyLen)
{
  int rc = SQLITE_ERROR;
  HCRYPTKEY hKey = 0;

  // No key specified, could mean either use the main db's encryption or no encryption
  if (!pKey || !nKeyLen)
  {
    if (!nDb)
    {
      return SQLITE_OK; // Main database, no key specified so not encrypted
    }
    else // Attached database, use the main database's key
    {
      // Get the encryption block for the main database and attempt to duplicate the key
      // for use by the attached database
      Pager *p = sqlite3BtreePager(db->aDb[0].pBt);
      LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)sqlite3pager_get_codecarg(p);

      if (!pBlock) return SQLITE_OK; // Main database is not encrypted so neither will be any attached database
      if (!pBlock->hReadKey) return SQLITE_OK; // Not encrypted

      if (!CryptDuplicateKey(pBlock->hReadKey, NULL, 0, &hKey))
        return rc; // Unable to duplicate the key
    }
  }
  else // User-supplied passphrase, so create a cryptographic key out of it
  {
    hKey = DeriveKey(pKey, nKeyLen);
    if (hKey == MAXDWORD)
    {
      sqlite3Error(db, rc, SQLITECRYPTERROR_PROVIDER);
      return rc;
    }
  }

  // Create a new encryption block and assign the codec to the new attached database
  if (hKey)
  {
    Pager *p = sqlite3BtreePager(db->aDb[nDb].pBt);
    LPCRYPTBLOCK pBlock = CreateCryptBlock(hKey, p, -1, NULL);
    if (!pBlock) return SQLITE_NOMEM;

    sqlite3PagerSetCodec(p, sqlite3Codec, sqlite3CodecSizeChange, sqlite3CodecFree, pBlock);
    //db->aDb[nDb].pAux = pBlock;
    //db->aDb[nDb].xFreeAux = DestroyCryptBlock;

    rc = SQLITE_OK;
  }
  return rc;
}

// Once a password has been supplied and a key created, we don't keep the 
// original password for security purposes.  Therefore return NULL.
void sqlite3CodecGetKey(sqlite3 *db, int nDb, void **ppKey, int *pnKeyLen)
{
  Btree *pbt = db->aDb[0].pBt;
  Pager *p = sqlite3BtreePager(pbt);
  LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)sqlite3pager_get_codecarg(p);

  if (ppKey) *ppKey = 0;
  if (pnKeyLen && pBlock) *pnKeyLen = 1;
}

// We do not attach this key to the temp store, only the main database.
int sqlite3_key(sqlite3 *db, const unsigned char *pKey, int nKeySize)
{
  return sqlite3CodecAttach(db, 0, pKey, nKeySize);
}

// Changes the encryption key for an existing database.
int sqlite3_rekey(sqlite3 *db, const unsigned char *pKey, int nKeySize)
{
  Btree *pbt = db->aDb[0].pBt;
  Pager *p = sqlite3BtreePager(pbt);
  LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)sqlite3pager_get_codecarg(p);
  HCRYPTKEY hKey = DeriveKey(pKey, nKeySize);
  int rc = SQLITE_ERROR;

  if (hKey == MAXDWORD)
  {
    sqlite3Error(db, rc, SQLITECRYPTERROR_PROVIDER);
    return rc;
  }

  if (!pBlock && !hKey) return SQLITE_OK; // Wasn't encrypted to begin with

  // To rekey a database, we change the writekey for the pager.  The readkey remains
  // the same
  if (!pBlock) // Encrypt an unencrypted database
  {
    pBlock = CreateCryptBlock(hKey, p, -1, NULL);
    if (!pBlock)
      return SQLITE_NOMEM;

    pBlock->hReadKey = 0; // Original database is not encrypted
    sqlite3PagerSetCodec(sqlite3BtreePager(pbt), sqlite3Codec, sqlite3CodecSizeChange, sqlite3CodecFree, pBlock);
    //db->aDb[0].pAux = pBlock;
    //db->aDb[0].xFreeAux = DestroyCryptBlock;
  }
  else // Change the writekey for an already-encrypted database
  {
    pBlock->hWriteKey = hKey;
  }

  // Start a transaction
  rc = sqlite3BtreeBeginTrans(pbt, 1);

  if (!rc)
  {
    // Rewrite all the pages in the database using the new encryption key
    Pgno nPage;
    Pgno nSkip = PAGER_MJ_PGNO(p);
    DbPage *pPage;
    Pgno n;

    rc = sqlite3PagerPagecount(p, &nPage);

    for(n = 1; rc == SQLITE_OK && n <= nPage; n ++)
    {
      if (n == nSkip) continue;
      rc = sqlite3PagerGet(p, n, &pPage);
      if(!rc)
      {
        rc = sqlite3PagerWrite(pPage);
        sqlite3PagerUnref(pPage);
      }
    }
  }

  // If we succeeded, try and commit the transaction
  if (!rc)
  {
    rc = sqlite3BtreeCommit(pbt);
  }

  // If we failed, rollback
  if (rc)
  {
    sqlite3BtreeRollback(pbt);
  }

  // If we succeeded, destroy any previous read key this database used
  // and make the readkey equal to the writekey
  if (!rc)
  {
    if (pBlock->hReadKey)
    {
      CryptDestroyKey(pBlock->hReadKey);
    }
    pBlock->hReadKey = pBlock->hWriteKey;
  }
  // We failed.  Destroy the new writekey (if there was one) and revert it back to
  // the original readkey
  else
  {
    if (pBlock->hWriteKey)
    {
      CryptDestroyKey(pBlock->hWriteKey);
    }
    pBlock->hWriteKey = pBlock->hReadKey;
  }

  // If the readkey and writekey are both empty, there's no need for a codec on this
  // pager anymore.  Destroy the crypt block and remove the codec from the pager.
  if (!pBlock->hReadKey && !pBlock->hWriteKey)
  {
    sqlite3PagerSetCodec(p, NULL, NULL, NULL, NULL);
  }

  return rc;
}

#endif // SQLITE_HAS_CODEC

#endif // SQLITE_OMIT_DISKIO
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/extension-functions.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
/*
This library will provide common mathematical and string functions in
SQL queries using the operating system math library.  It includes the
following functions:

Math: acos, asin, atan, atn2, atan2, acosh, asinh, atanh, difference,
degrees, radians, cos, sin, tan, cot, cosh, sinh, tanh, coth, exp,
log, log10, power, sign, sqrt, square, ceil, floor, pi.

String: replicate, charindex, leftstr, rightstr, ltrim, rtrim, trim,
replace, reverse, proper, padl, padr, padc, strfilter.

Aggregate: stdev, variance, mode, median, lower_quartile,
upper_quartile.

The string functions ltrim, rtrim, trim, replace are included in
recent versions of SQLite and so by default do not build.

Instructions:
1) Compile with
   Linux:
     gcc -fPIC -lm -shared extension-functions.c -o libsqlitefunctions.so
   Mac OS X:
     gcc -fno-common -dynamiclib extension-functions.c -o libsqlitefunctions.dylib
   (You may need to add flags
    -I /opt/local/include/ -L/opt/local/lib -lsqlite3
    if your sqlite3 is installed from Mac ports, or
    -I /sw/include/ -L/sw/lib -lsqlite3
    if installed with Fink.)
2) In your application, call sqlite3_enable_load_extension(db,1) to
   allow loading external libraries.  Then load the library libsqlitefunctions
   using sqlite3_load_extension; the third argument should be 0.
   See http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions.
3) Use, for example:
   SELECT cos(radians(inclination)) FROM satsum WHERE satnum = 25544;

Note: Loading extensions is by default prohibited as a
security measure; see "Security Considerations" in
http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions.
If the sqlite3 program and library are built this
way, you cannot use these functions from the program, you 
must write your own program using the sqlite3 API, and call
sqlite3_enable_load_extension as described above.

If the program is built so that loading extensions is permitted,
the following will work:
sqlite> SELECT load_extension('./libsqlitefunctions.so');
sqlite> select cos(radians(45));
0.707106781186548

Alterations:
The instructions are for Linux or Mac OS X; users of other OSes may
need to modify this procedure.  In particular, if your math library
lacks one or more of the needed trig or log functions, comment out the
appropriate HAVE_ #define at the top of file.  If you do not
wish to make a loadable module, comment out the define for
COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE.  If you are using a
version of SQLite without the trim functions and replace, comment out
the HAVE_TRIM #define.

Liam Healy

History:
2008-06-13 Change to instructions to indicate use of the math library
and that program might work.
2007-10-01 Minor clarification to instructions.
2007-09-29 Compilation as loadable module is optional with
COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE.
2007-09-28 Use sqlite3_extension_init and macros
SQLITE_EXTENSION_INIT1, SQLITE_EXTENSION_INIT2, so that it works with
sqlite3_load_extension.  Thanks to Eric Higashino and Joe Wilson.
New instructions for Mac compilation.
2007-09-17 With help from Joe Wilson and Nuno Luca, made use of
external interfaces so that compilation is no longer dependent on
SQLite source code.  Merged source, header, and README into a single
file.  Added casts so that Mac will compile without warnings (unsigned
and signed char).
2007-09-05 Included some definitions from sqlite 3.3.13 so that this
will continue to work in newer versions of sqlite.  Completed
description of functions available.
2007-03-27 Revised description.
2007-03-23 Small cleanup and a bug fix on the code.  This was mainly
letting errno flag errors encountered in the math library and checking
the result, rather than pre-checking.  This fixes a bug in power that
would cause an error if any non-positive number was raised to any
power.
2007-02-07 posted by Mikey C to sqlite mailing list.
Original code 2006 June 05 by relicoder.

*/

//#include "config.h"
#include <windows.h>

// #define COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE
//#define HAVE_ACOSH 1
//#define HAVE_ASINH 1
//#define HAVE_ATANH 1
#define HAVE_SINH 1
#define HAVE_COSH 1
#define HAVE_TANH 1
#define HAVE_LOG10 1
//#define HAVE_ISBLANK 1
#define SQLITE_SOUNDEX 1
#define HAVE_TRIM 1		/* LMH 2007-03-25 if sqlite has trim functions */

#ifdef COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1
#else
#include "src/sqlite3.h"
#endif

#include <ctype.h>
/* relicoder */
#include <math.h>
#include <string.h>
#include <stdio.h>

#ifndef _WIN32_WCE
#include <errno.h>		/* LMH 2007-03-25 */
#else
int errno;
#define strerror(x) ""
#endif

#include <stdlib.h>
#include <assert.h>

#ifndef _MAP_H_
#define _MAP_H_

//#include <stdint.h>

typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed int int16_t;
typedef unsigned int uint16_t;
typedef signed long int int32_t;
typedef unsigned long int uint32_t;
typedef signed long long int int64_t;
typedef unsigned long long int uint64_t;

/*
** Simple binary tree implementation to use in median, mode and quartile calculations
** Tree is not necessarily balanced. That would require something like red&black trees of AVL
*/

typedef int(*cmp_func)(const void *, const void *);
typedef void(*map_iterator)(void*, int64_t, void*);

typedef struct node{
  struct node *l;
  struct node *r;
  void* data;
  int64_t count;
} node;

typedef struct map{
  node *base;
  cmp_func cmp;
  short free;
} map;

/*
** creates a map given a comparison function
*/
map map_make(cmp_func cmp);

/*
** inserts the element e into map m
*/
void map_insert(map *m, void *e);

/*
** executes function iter over all elements in the map, in key increasing order
*/
void map_iterate(map *m, map_iterator iter, void* p);

/*
** frees all memory used by a map
*/
void map_destroy(map *m);

/*
** compares 2 integers
** to use with map_make
*/
int int_cmp(const void *a, const void *b);

/*
** compares 2 doubles
** to use with map_make
*/
int double_cmp(const void *a, const void *b);

#endif /* _MAP_H_ */

typedef uint8_t         u8;
//typedef uint16_t        u16;
typedef int64_t         i64;

static char *sqlite3StrDup( const char *z ) {
    char *res = sqlite3_malloc( strlen(z)+1 );
    return strcpy( res, z );
}

/*
** These are copied verbatim from fun.c so as to not have the names exported
*/

/* LMH from sqlite3 3.3.13 */
/*
** This table maps from the first byte of a UTF-8 character to the number
** of trailing bytes expected. A value '4' indicates that the table key
** is not a legal first byte for a UTF-8 character.
*/
static const u8 xtra_utf8_bytes[256]  = {
/* 0xxxxxxx */
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,

/* 10wwwwww */
4, 4, 4, 4, 4, 4, 4, 4,     4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4,     4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4,     4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4,     4, 4, 4, 4, 4, 4, 4, 4,

/* 110yyyyy */
1, 1, 1, 1, 1, 1, 1, 1,     1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,     1, 1, 1, 1, 1, 1, 1, 1,

/* 1110zzzz */
2, 2, 2, 2, 2, 2, 2, 2,     2, 2, 2, 2, 2, 2, 2, 2,

/* 11110yyy */
3, 3, 3, 3, 3, 3, 3, 3,     4, 4, 4, 4, 4, 4, 4, 4,
};


/*
** This table maps from the number of trailing bytes in a UTF-8 character
** to an integer constant that is effectively calculated for each character
** read by a naive implementation of a UTF-8 character reader. The code
** in the READ_UTF8 macro explains things best.
*/
static const int xtra_utf8_bits[] =  {
  0,
  12416,          /* (0xC0 << 6) + (0x80) */
  925824,         /* (0xE0 << 12) + (0x80 << 6) + (0x80) */
  63447168        /* (0xF0 << 18) + (0x80 << 12) + (0x80 << 6) + 0x80 */
};

/*
** If a UTF-8 character contains N bytes extra bytes (N bytes follow
** the initial byte so that the total character length is N+1) then
** masking the character with utf8_mask[N] must produce a non-zero
** result.  Otherwise, we have an (illegal) overlong encoding.
*/
static const int utf_mask[] = {
  0x00000000,
  0xffffff80,
  0xfffff800,
  0xffff0000,
};

/* LMH salvaged from sqlite3 3.3.13 source code src/utf.c */
#define OLD_READ_UTF8(zIn, c) { \
  int xtra;                                            \
  c = *(zIn)++;                                        \
  xtra = xtra_utf8_bytes[c];                           \
  switch( xtra ){                                      \
    case 4: c = (int)0xFFFD; break;                    \
    case 3: c = (c<<6) + *(zIn)++;                     \
    case 2: c = (c<<6) + *(zIn)++;                     \
    case 1: c = (c<<6) + *(zIn)++;                     \
    c -= xtra_utf8_bits[xtra];                         \
    if( (utf_mask[xtra]&c)==0                          \
        || (c&0xFFFFF800)==0xD800                      \
        || (c&0xFFFFFFFE)==0xFFFE ){  c = 0xFFFD; }    \
  }                                                    \
}

static int sqlite3ReadUtf8(const unsigned char *z){
  int c;
  OLD_READ_UTF8(z, c);
  return c;
}

#define SKIP_UTF8(zIn) {                               \
  zIn += (xtra_utf8_bytes[*(u8 *)zIn] + 1);            \
}

/*
** X is a pointer to the first byte of a UTF-8 character.  Increment
** X so that it points to the next character.  This only works right
** if X points to a well-formed UTF-8 string.
*/
#define sqliteNextChar(X)  while( (0xc0&*++(X))==0x80 ){}
#define sqliteCharVal(X)   sqlite3ReadUtf8(X)

/*
** This is a macro that facilitates writting wrappers for math.h functions
** it creates code for a function to use in SQlite that gets one numeric input
** and returns a floating point value.
**
** Could have been implemented using pointers to functions but this way it's inline
** and thus more efficient. Lower * ranking though...
** 
** Parameters:
** name:      function name to de defined (eg: sinFunc)
** function:  function defined in math.h to wrap (eg: sin)
** domain:    boolean condition that CAN'T happen in terms of the input parameter rVal
**            (eg: rval<0 for sqrt)
*/
/* LMH 2007-03-25 Changed to use errno and remove domain; no pre-checking for errors. */
#define GEN_MATH_WRAP_DOUBLE_1(name, function) \
static void name(sqlite3_context *context, int argc, sqlite3_value **argv){\
  double rVal = 0.0, val;\
  assert( argc==1 );\
  switch( sqlite3_value_type(argv[0]) ){\
    case SQLITE_NULL: {\
      sqlite3_result_null(context);\
      break;\
    }\
    default: {\
      rVal = sqlite3_value_double(argv[0]);\
      errno = 0;\
      val = function(rVal);\
      if (errno == 0) {\
        sqlite3_result_double(context, val);\
      } else {\
        sqlite3_result_error(context, strerror(errno), errno);\
      }\
      break;\
    }\
  }\
}\


/*
** Example of GEN_MATH_WRAP_DOUBLE_1 usage
** this creates function sqrtFunc to wrap the math.h standard function sqrt(x)=x^0.5
*/
GEN_MATH_WRAP_DOUBLE_1(sqrtFunc, sqrt)

/* trignometric functions */
GEN_MATH_WRAP_DOUBLE_1(acosFunc, acos)
GEN_MATH_WRAP_DOUBLE_1(asinFunc, asin)
GEN_MATH_WRAP_DOUBLE_1(atanFunc, atan)

/*
** Many of systems don't have inverse hyperbolic trig functions so this will emulate
** them on those systems in terms of log and sqrt (formulas are too trivial to demand 
** written proof here)
*/

#ifndef HAVE_ACOSH
static double acosh(double x){
  return log(x + sqrt(x*x - 1.0));
}
#endif

GEN_MATH_WRAP_DOUBLE_1(acoshFunc, acosh)

#ifndef HAVE_ASINH
static double asinh(double x){
  return log(x + sqrt(x*x + 1.0));
}
#endif

GEN_MATH_WRAP_DOUBLE_1(asinhFunc, asinh)

#ifndef HAVE_ATANH
static double atanh(double x){
  return (1.0/2.0)*log((1+x)/(1-x)) ;
}
#endif

GEN_MATH_WRAP_DOUBLE_1(atanhFunc, atanh)

/*
** math.h doesn't require cot (cotangent) so it's defined here
*/
static double cot(double x){
  return 1.0/tan(x);
}

GEN_MATH_WRAP_DOUBLE_1(sinFunc, sin)
GEN_MATH_WRAP_DOUBLE_1(cosFunc, cos)
GEN_MATH_WRAP_DOUBLE_1(tanFunc, tan)
GEN_MATH_WRAP_DOUBLE_1(cotFunc, cot)

static double coth(double x){
  return 1.0/tanh(x);
}

/*
** Many systems don't have hyperbolic trigonometric functions so this will emulate
** them on those systems directly from the definition in terms of exp
*/
#ifndef HAVE_SINH
static double sinh(double x){
  return (exp(x)-exp(-x))/2.0;
}
#endif

GEN_MATH_WRAP_DOUBLE_1(sinhFunc, sinh)

#ifndef HAVE_COSH
static double cosh(double x){
  return (exp(x)+exp(-x))/2.0;
}
#endif

GEN_MATH_WRAP_DOUBLE_1(coshFunc, cosh)

#ifndef HAVE_TANH
static double tanh(double x){
  return sinh(x)/cosh(x);
}
#endif

GEN_MATH_WRAP_DOUBLE_1(tanhFunc, tanh)

GEN_MATH_WRAP_DOUBLE_1(cothFunc, coth)

/*
** Some systems lack log in base 10. This will emulate it
*/

#ifndef HAVE_LOG10
static double log10(double x){
  static double l10 = -1.0;
  if( l10<0.0 ){
    l10 = log(10.0);
  }
  return log(x)/l10;
}
#endif

GEN_MATH_WRAP_DOUBLE_1(logFunc, log)
GEN_MATH_WRAP_DOUBLE_1(log10Func, log10)
GEN_MATH_WRAP_DOUBLE_1(expFunc, exp)

/*
** Fallback for systems where math.h doesn't define M_PI
*/
#undef M_PI
#ifndef M_PI
/*
** static double PI = acos(-1.0);
** #define M_PI (PI)
*/
#define M_PI 3.14159265358979323846
#endif

/* Convert Degrees into Radians */
static double deg2rad(double x){
  return x*M_PI/180.0;
}

/* Convert Radians into Degrees */
static double rad2deg(double x){
  return 180.0*x/M_PI;
}

GEN_MATH_WRAP_DOUBLE_1(rad2degFunc, rad2deg)
GEN_MATH_WRAP_DOUBLE_1(deg2radFunc, deg2rad)

/* constant function that returns the value of PI=3.1415... */
static void piFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  sqlite3_result_double(context, M_PI);
}

/*
** Implements the sqrt function, it has the peculiarity of returning an integer when the
** the argument is an integer.
** Since SQLite isn't strongly typed (almost untyped actually) this is a bit pedantic
*/
static void squareFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  i64 iVal = 0;
  double rVal = 0.0;
  assert( argc==2 );
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_INTEGER: {
      iVal = sqlite3_value_int64(argv[0]);
      sqlite3_result_int64(context, iVal*iVal);
      break;
    }
    case SQLITE_NULL: {
      sqlite3_result_null(context);
      break;
    }
    default: {
      rVal = sqlite3_value_double(argv[0]);
      sqlite3_result_double(context, rVal*rVal);
      break;
    }
  }
}

/*
** Wraps the pow math.h function
** When both the base and the exponent are integers the result should be integer
** (see sqrt just before this). Here the result is always double
*/
/* LMH 2007-03-25 Changed to use errno; no pre-checking for errors.  Also removes
  but that was present in the pre-checking that called sqlite3_result_error on 
  a non-positive first argument, which is not always an error. */
static void powerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  double r1 = 0.0;
  double r2 = 0.0;
  double val;

  assert( argc==2 );
  
  if( sqlite3_value_type(argv[0]) == SQLITE_NULL || sqlite3_value_type(argv[1]) == SQLITE_NULL ){
    sqlite3_result_null(context); 
  }else{
    r1 = sqlite3_value_double(argv[0]);
    r2 = sqlite3_value_double(argv[1]);
    errno = 0;
    val = pow(r1,r2);
    if (errno == 0) {
      sqlite3_result_double(context, val);
    } else {  
      sqlite3_result_error(context, strerror(errno), errno);
    }  
  }
}

/*
** atan2 wrapper
*/
static void atn2Func(sqlite3_context *context, int argc, sqlite3_value **argv){
  double r1 = 0.0;
  double r2 = 0.0;

  assert( argc==2 );
  
  if( sqlite3_value_type(argv[0]) == SQLITE_NULL || sqlite3_value_type(argv[1]) == SQLITE_NULL ){
    sqlite3_result_null(context); 
  }else{
    r1 = sqlite3_value_double(argv[0]);
    r2 = sqlite3_value_double(argv[1]);
    sqlite3_result_double(context, atan2(r1,r2));
  }
}

/*
** Implementation of the sign() function
** return one of 3 possibilities +1,0 or -1 when the argument is respectively
** positive, 0 or negative.
** When the argument is NULL the result is also NULL (completly conventional)
*/
static void signFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  double rVal=0.0;
  i64 iVal=0;
  assert( argc==1 );
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_INTEGER: {
      iVal = sqlite3_value_int64(argv[0]);
      iVal = ( iVal > 0) ? 1: ( iVal < 0 ) ? -1: 0;
      sqlite3_result_int64(context, iVal);
      break;
    }
    case SQLITE_NULL: {
      sqlite3_result_null(context);
      break;
    }
    default: {
 /* 2nd change below. Line for abs was: if( rVal<0 ) rVal = rVal * -1.0;  */

      rVal = sqlite3_value_double(argv[0]);
      rVal = ( rVal > 0) ? 1: ( rVal < 0 ) ? -1: 0;
      sqlite3_result_double(context, rVal);
      break;
    }
  }
}


/*
** smallest integer value not less than argument
*/
static void ceilFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  double rVal=0.0;
  i64 iVal=0;
  assert( argc==1 );
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_INTEGER: {
      i64 iVal = sqlite3_value_int64(argv[0]);
      sqlite3_result_int64(context, iVal);
      break;
    }
    case SQLITE_NULL: {
      sqlite3_result_null(context);
      break;
    }
    default: {
      rVal = sqlite3_value_double(argv[0]);
      sqlite3_result_int64(context, (i64) ceil(rVal));
      break;
    }
  }
}

/*
** largest integer value not greater than argument
*/
static void floorFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  double rVal=0.0;
  i64 iVal=0;
  assert( argc==1 );
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_INTEGER: {
      i64 iVal = sqlite3_value_int64(argv[0]);
      sqlite3_result_int64(context, iVal);
      break;
    }
    case SQLITE_NULL: {
      sqlite3_result_null(context);
      break;
    }
    default: {
      rVal = sqlite3_value_double(argv[0]);
      sqlite3_result_int64(context, (i64) floor(rVal));
      break;
    }
  }
}

/*
** Given a string (s) in the first argument and an integer (n) in the second returns the 
** string that constains s contatenated n times
*/
static void replicateFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  unsigned char *z;        /* input string */
  unsigned char *zo;       /* result string */
  i64 iCount;              /* times to repeat */
  i64 nLen;                /* length of the input string (no multibyte considerations) */ 
  i64 nTLen;               /* length of the result string (no multibyte considerations) */
  i64 i=0;

  if( argc!=2 || SQLITE_NULL==sqlite3_value_type(argv[0]) )
    return;

  iCount = sqlite3_value_int64(argv[1]);

  if( iCount<0 ){
    sqlite3_result_error(context, "domain error", -1);
  }else{

    nLen  = sqlite3_value_bytes(argv[0]);
    nTLen = nLen*iCount;
    z=sqlite3_malloc(nTLen+1);
    zo=sqlite3_malloc(nLen+1);
    if (!z || !zo){
      sqlite3_result_error_nomem(context);
      if (z) sqlite3_free(z);
      if (zo) sqlite3_free(zo);
      return;
    }
    strcpy((char*)zo, (char*)sqlite3_value_text(argv[0]));

    for(i=0; i<iCount; ++i){
      strcpy((char*)(z+i*nLen), (char*)zo);
    }

    sqlite3_result_text(context, (char*)z, -1, SQLITE_TRANSIENT);
    sqlite3_free(z);
    sqlite3_free(zo);
  }
}

/* 
** Some systems (win32 among others) don't have an isblank function, this will emulate it.
** This function is not UFT-8 safe since it only analyses a byte character.
*/
#ifndef HAVE_ISBLANK
int isblank(char c){
  return( ' '==c || '\t'==c );
}
#endif

static void properFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  const unsigned char *z;     /* input string */
  unsigned char *zo;          /* output string */
  unsigned char *zt;          /* iterator */
  char r;
  int c=1;

  assert( argc!=1);
  if( SQLITE_NULL==sqlite3_value_type(argv[0]) ){
    sqlite3_result_null(context);
    return;
  }

  z = sqlite3_value_text(argv[0]);
  zo = (unsigned char *)sqlite3StrDup((char *) z);
  if (!zo) {
    sqlite3_result_error_nomem(context);
    return;
  }
  zt = zo;

  while( (r = *(z++))!=0 ){
    if( isblank(r) ){
      c=1;
    }else{
      if( c==1 ){
        r = toupper(r);
      }else{
        r = tolower(r);
      }
      c=0;
    }
    *(zt++) = r;
  }
  *zt = '\0';

  sqlite3_result_text(context, (char*)zo, -1, SQLITE_TRANSIENT);
  sqlite3_free(zo);
}

/*
** given an input string (s) and an integer (n) adds spaces at the begining of  s
** until it has a length of n characters.
** When s has a length >=n it's a NOP
** padl(NULL) = NULL
*/
static void padlFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  i64 ilen;          /* length to pad to */
  i64 zl;            /* length of the input string (UTF-8 chars) */
  int i = 0;
  const char *zi;    /* input string */
  char *zo;          /* output string */
  char *zt;

  assert( argc==2 );
  
  if( sqlite3_value_type(argv[0]) == SQLITE_NULL ){
    sqlite3_result_null(context); 
  }else{
    zi = (char *)sqlite3_value_text(argv[0]);
    ilen = sqlite3_value_int64(argv[1]);
    /* check domain */
    if(ilen<0){
      sqlite3_result_error(context, "domain error", -1);
      return;
    }
    zl = sqlite3Utf8CharLen(zi, -1);
    if( zl>=ilen ){
      /* string is longer than the requested pad length, return the same string (dup it) */
      zo = sqlite3StrDup(zi);
      if (!zo){
        sqlite3_result_error_nomem(context);
        return;
      }
      sqlite3_result_text(context, zo, -1, SQLITE_TRANSIENT);
    }else{
      zo = sqlite3_malloc(strlen(zi)+ilen-zl+1);
      if (!zo){
        sqlite3_result_error_nomem(context);
        return;
      }
      zt = zo;
      for(i=1; i+zl<=ilen; ++i){
        *(zt++)=' ';
      }
      /* no need to take UTF-8 into consideration here */
      strcpy(zt,zi);
    }
    sqlite3_result_text(context, zo, -1, SQLITE_TRANSIENT);
    sqlite3_free(zo);
  }
}

/*
** given an input string (s) and an integer (n) appends spaces at the end of  s
** until it has a length of n characters.
** When s has a length >=n it's a NOP
** padl(NULL) = NULL
*/
static void padrFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  i64 ilen;          /* length to pad to */
  i64 zl;            /* length of the input string (UTF-8 chars) */
  i64 zll;           /* length of the input string (bytes) */
  int i = 0;
  const char *zi;    /* input string */
  char *zo;          /* output string */
  char *zt;

  assert( argc==2 );
  
  if( sqlite3_value_type(argv[0]) == SQLITE_NULL ){
    sqlite3_result_null(context); 
  }else{
    zi = (char *)sqlite3_value_text(argv[0]);
    ilen = sqlite3_value_int64(argv[1]);
    /* check domain */
    if(ilen<0){
      sqlite3_result_error(context, "domain error", -1);
      return;
    }
    zl = sqlite3Utf8CharLen(zi, -1);
    if( zl>=ilen ){
      /* string is longer than the requested pad length, return the same string (dup it) */
      zo = sqlite3StrDup(zi);
      if (!zo){
        sqlite3_result_error_nomem(context);
        return;
      }
      sqlite3_result_text(context, zo, -1, SQLITE_TRANSIENT);
    }else{
      zll = strlen(zi);
      zo = sqlite3_malloc(zll+ilen-zl+1);
      if (!zo){
        sqlite3_result_error_nomem(context);
        return;
      }
      zt = strcpy(zo,zi)+zll;
      for(i=1; i+zl<=ilen; ++i){
        *(zt++) = ' ';
      }
      *zt = '\0';
    }
    sqlite3_result_text(context, zo, -1, SQLITE_TRANSIENT);
    sqlite3_free(zo);
  }
}

/*
** given an input string (s) and an integer (n) appends spaces at the end of  s
** and adds spaces at the begining of s until it has a length of n characters.
** Tries to add has many characters at the left as at the right.
** When s has a length >=n it's a NOP
** padl(NULL) = NULL
*/
static void padcFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  i64 ilen;           /* length to pad to */
  i64 zl;             /* length of the input string (UTF-8 chars) */
  i64 zll;            /* length of the input string (bytes) */
  int i = 0;
  const char *zi;     /* input string */
  char *zo;           /* output string */
  char *zt;

  assert( argc==2 );
  
  if( sqlite3_value_type(argv[0]) == SQLITE_NULL ){
    sqlite3_result_null(context); 
  }else{
    zi = (char *)sqlite3_value_text(argv[0]);
    ilen = sqlite3_value_int64(argv[1]);
    /* check domain */
    if(ilen<0){
      sqlite3_result_error(context, "domain error", -1);
      return;
    }
    zl = sqlite3Utf8CharLen(zi, -1);
    if( zl>=ilen ){
      /* string is longer than the requested pad length, return the same string (dup it) */
      zo = sqlite3StrDup(zi);
      if (!zo){
        sqlite3_result_error_nomem(context);
        return;
      }
      sqlite3_result_text(context, zo, -1, SQLITE_TRANSIENT);
    }else{
      zll = strlen(zi);
      zo = sqlite3_malloc(zll+ilen-zl+1);
      if (!zo){
        sqlite3_result_error_nomem(context);
        return;
      }
      zt = zo;
      for(i=1; 2*i+zl<=ilen; ++i){
        *(zt++) = ' ';
      }
      strcpy(zt, zi);
      zt+=zll;
      for(; i+zl<=ilen; ++i){
        *(zt++) = ' ';
      }
      *zt = '\0';
    }
    sqlite3_result_text(context, zo, -1, SQLITE_TRANSIENT);
    sqlite3_free(zo);
  }
}

/*
** given 2 string (s1,s2) returns the string s1 with the characters NOT in s2 removed
** assumes strings are UTF-8 encoded
*/
static void strfilterFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  const char *zi1;        /* first parameter string (searched string) */
  const char *zi2;        /* second parameter string (vcontains valid characters) */
  const char *z1;
  const char *z21;
  const char *z22;
  char *zo;               /* output string */
  char *zot;
  int c1 = 0;
  int c2 = 0;

  assert( argc==2 );
  
  if( sqlite3_value_type(argv[0]) == SQLITE_NULL || sqlite3_value_type(argv[1]) == SQLITE_NULL ){
    sqlite3_result_null(context); 
  }else{
    zi1 = (char *)sqlite3_value_text(argv[0]);
    zi2 = (char *)sqlite3_value_text(argv[1]);
    /* 
    ** maybe I could allocate less, but that would imply 2 passes, rather waste 
    ** (possibly) some memory
    */
    zo = sqlite3_malloc(strlen(zi1)+1); 
    if (!zo){
      sqlite3_result_error_nomem(context);
      return;
    }
    zot = zo;
    z1 = zi1;
    while( (c1=sqliteCharVal((unsigned char *)z1))!=0 ){
      z21=zi2;
      while( (c2=sqliteCharVal((unsigned char *)z21))!=0 && c2!=c1 ){
        sqliteNextChar(z21);
      }
      if( c2!=0){
        z22=z21;
        sqliteNextChar(z22);
        strncpy(zot, z21, z22-z21);
        zot+=z22-z21;
      }
      sqliteNextChar(z1);
    }
    *zot = '\0';

    sqlite3_result_text(context, zo, -1, SQLITE_TRANSIENT);
    sqlite3_free(zo);
  }
}

/*
** Given a string z1, retutns the (0 based) index of it's first occurence
** in z2 after the first s characters.
** Returns -1 when there isn't a match.
** updates p to point to the character where the match occured.
** This is an auxiliary function.
*/
static int _substr(const char* z1, const char* z2, int s, CollSeq *pColl, const char** p){
  int c = 0;
  int rVal=-1;
  const char* zt1;
  const char* zt2;
  int c1,c2;

  if( '\0'==*z1 ){
    return -1;
  }
  
  while( (sqliteCharVal((unsigned char *)z2) != 0) && (c++)<s){
    sqliteNextChar(z2);
  }
  
  c = 0;
  while( (sqliteCharVal((unsigned char *)z2)) != 0 ){
    zt1 = z1;
    zt2 = z2;

    do{
      c1 = sqliteCharVal((unsigned char *)zt1);
      c2 = sqliteCharVal((unsigned char *)zt2);
      if (pColl->enc == SQLITE_UTF8){
        if (pColl->xCmp(pColl->pUser, 1, zt1, 1, zt2) == 0) {
          c1 = c2;
        }
        else {
          c1 = (c1) ? 1 : 0;
          c2 = (c2) ? 2 : 0;
        }
      }
      // TODO:  Maybe try and convert the chars to UTF16 and run them thru the collating sequence?
      sqliteNextChar(zt1);
      sqliteNextChar(zt2);
    }while( c1 == c2 && c1 != 0 && c2 != 0 );

    if( c1 == 0 ){
      rVal = c;
      break; 
    }
    
    sqliteNextChar(z2);
    ++c;
  }
  if(p){
    *p=z2;
  }
  return rVal >=0 ? rVal+s : rVal;
}

/*
** given 2 input strings (s1,s2) and an integer (n) searches from the nth character
** for the string s1. Returns the position where the match occured.
** Characters are counted from 1.
** 0 is returned when no match occurs.
*/

static void charindexFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  const u8 *z1;          /* s1 string */
  u8 *z2;                /* s2 string */
  int s=0;
  int rVal=0;
  CollSeq *pColl = context->pColl;

  assert( argc==3 ||argc==2);

  if( SQLITE_NULL==sqlite3_value_type(argv[0]) || SQLITE_NULL==sqlite3_value_type(argv[1])){
    sqlite3_result_null(context);
    return;
  }

  z1 = sqlite3_value_text(argv[0]);
  if( z1==0 ) return;
  z2 = (u8*) sqlite3_value_text(argv[1]);
  if(argc==3){
    s = sqlite3_value_int(argv[2])-1;
    if(s<0){
      s=0;
    }
  }else{
    s = 0;
  }

  rVal = _substr((char *)z1,(char *)z2,s,pColl,NULL);
  sqlite3_result_int(context, rVal+1);
}

/*
** given a string (s) and an integer (n) returns the n leftmost (UTF-8) characters
** if the string has a length<=n or is NULL this function is NOP
*/
static void leftFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  int c=0;
  int cc=0;
  int l=0;
  const unsigned char *z;       /* input string */
  const unsigned char *zt;
  unsigned char *rz;            /* output string */

  assert( argc==2);

  if( SQLITE_NULL==sqlite3_value_type(argv[0]) || SQLITE_NULL==sqlite3_value_type(argv[1])){
    sqlite3_result_null(context);
    return;
  }

  z  = sqlite3_value_text(argv[0]);
  l  = sqlite3_value_int(argv[1]);
  zt = z;

  while( sqliteCharVal(zt) && c++<l)
    sqliteNextChar(zt);

  cc=zt-z;

  rz = sqlite3_malloc(zt-z+1);
  if (!rz){
    sqlite3_result_error_nomem(context);
    return;
  }
  strncpy((char*) rz, (char*) z, zt-z);
  *(rz+cc) = '\0';
  sqlite3_result_text(context, (char*)rz, -1, SQLITE_TRANSIENT); 
  sqlite3_free(rz);
}

/*
** given a string (s) and an integer (n) returns the n rightmost (UTF-8) characters
** if the string has a length<=n or is NULL this function is NOP
*/
static void rightFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  int l=0;
  int c=0;
  int cc=0;
  const char *z;
  const char *zt;
  const char *ze;
  char *rz;

  assert( argc==2);

  if( SQLITE_NULL == sqlite3_value_type(argv[0]) || SQLITE_NULL == sqlite3_value_type(argv[1])){
    sqlite3_result_null(context);
    return;
  }

  z  = (char *)sqlite3_value_text(argv[0]);
  l  = sqlite3_value_int(argv[1]);
  zt = z;

  while( sqliteCharVal((unsigned char *)zt)!=0){
    sqliteNextChar(zt);
    ++c;
  }

  ze = zt;
  zt = z;

  cc=c-l;
  if(cc<0)
    cc=0;
  
  while( cc-- > 0 ){
    sqliteNextChar(zt);
  }

  rz = sqlite3_malloc(ze-zt+1);
  if (!rz){
    sqlite3_result_error_nomem(context);
    return;
  }
  strcpy((char*) rz, (char*) (zt));
  sqlite3_result_text(context, (char*)rz, -1, SQLITE_TRANSIENT); 
  sqlite3_free(rz);
}

#ifndef HAVE_TRIM
/*
** removes the whitespaces at the begining of a string.
*/
const char* ltrim(const char* s){
  while( *s==' ' )
    ++s;
  return s;
}

/*
** removes the whitespaces at the end of a string.
** !mutates the input string!
*/
void rtrim(char* s){
  char* ss = s+strlen(s)-1;
  while( ss>=s && *ss==' ' )
    --ss;
  *(ss+1)='\0';
}

/*
**  Removes the whitespace at the begining of a string
*/
static void ltrimFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  const char *z;

  assert( argc==1);

  if( SQLITE_NULL==sqlite3_value_type(argv[0]) ){
    sqlite3_result_null(context);
    return;
  }
  z = sqlite3_value_text(argv[0]);
  sqlite3_result_text(context, ltrim(z), -1, SQLITE_TRANSIENT); 
}

/*
**  Removes the whitespace at the end of a string
*/
static void rtrimFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  const char *z;
  char *rz;
  /* try not to change data in argv */

  assert( argc==1);

  if( SQLITE_NULL==sqlite3_value_type(argv[0]) ){
    sqlite3_result_null(context);
    return;
  }
  z = sqlite3_value_text(argv[0]);
  rz = sqlite3StrDup(z);
  rtrim(rz);
  sqlite3_result_text(context, rz, -1, SQLITE_TRANSIENT);
  sqlite3_free(rz);
}

/*
**  Removes the whitespace at the begining and end of a string
*/
static void trimFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  const char *z;
  char *rz;
  /* try not to change data in argv */

  assert( argc==1);

  if( SQLITE_NULL==sqlite3_value_type(argv[0]) ){
    sqlite3_result_null(context);
    return;
  }
  z = sqlite3_value_text(argv[0]);
  rz = sqlite3StrDup(z);
  rtrim(rz);
  sqlite3_result_text(context, ltrim(rz), -1, SQLITE_TRANSIENT);
  sqlite3_free(rz);
}
#endif

/*
** given a pointer to a string s1, the length of that string (l1), a new string (s2)
** and it's length (l2) appends s2 to s1.
** All lengths in bytes.
** This is just an auxiliary function
*/
// static void _append(char **s1, int l1, const char *s2, int l2){
//   *s1 = realloc(*s1, (l1+l2+1)*sizeof(char));
//   strncpy((*s1)+l1, s2, l2);
//   *(*(s1)+l1+l2) = '\0';
// }

#ifndef HAVE_TRIM

/*
** given strings s, s1 and s2 replaces occurrences of s1 in s by s2
*/
static void replaceFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  const char *z1;     /* string s (first parameter) */
  const char *z2;     /* string s1 (second parameter) string to look for */
  const char *z3;     /* string s2 (third parameter) string to replace occurrences of s1 with */
  int lz1;
  int lz2;
  int lz3;
  int lzo=0;
  char *zo=0;
  int ret=0;
  const char *zt1;
  const char *zt2;

  assert( 3==argc );

  if( SQLITE_NULL==sqlite3_value_type(argv[0]) ){
    sqlite3_result_null(context);
    return;
  }

  z1 = sqlite3_value_text(argv[0]);
  z2 = sqlite3_value_text(argv[1]);
  z3 = sqlite3_value_text(argv[2]);
  /* handle possible null values */
  if( 0==z2 ){
    z2="";
  }
  if( 0==z3 ){
    z3="";
  }

  lz1 = strlen(z1);
  lz2 = strlen(z2);
  lz3 = strlen(z3);

#if 0
  /* special case when z2 is empty (or null) nothing will be changed */
  if( 0==lz2 ){
    sqlite3_result_text(context, z1, -1, SQLITE_TRANSIENT);
    return;
  }
#endif

  zt1=z1;
  zt2=z1;

  while(1){
    ret=_substr(z2,zt1 , 0, &zt2);

    if( ret<0 )
      break;

    _append(&zo, lzo, zt1, zt2-zt1);
    lzo+=zt2-zt1;
    _append(&zo, lzo, z3, lz3);
    lzo+=lz3;

    zt1=zt2+lz2;
  }
  _append(&zo, lzo, zt1, lz1-(zt1-z1));
  sqlite3_result_text(context, zo, -1, SQLITE_TRANSIENT);
  sqlite3_free(zo);
}
#endif

/*
** given a string returns the same string but with the characters in reverse order
*/
static void reverseFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  const char *z;
  const char *zt;
  char *rz;
  char *rzt;
  int l = 0;
  int i = 0;

  assert( 1==argc );

  if( SQLITE_NULL==sqlite3_value_type(argv[0]) ){
    sqlite3_result_null(context);
    return;
  }
  z = (char *)sqlite3_value_text(argv[0]);
  l = strlen(z);
  rz = sqlite3_malloc(l+1);
  if (!rz){
    sqlite3_result_error_nomem(context);
    return;
  }
  rzt = rz+l;
  *(rzt--) = '\0';

  zt=z;
  while( sqliteCharVal((unsigned char *)zt)!=0 ){
    z=zt;
    sqliteNextChar(zt);
    for(i=1; zt-i>=z; ++i){
      *(rzt--)=*(zt-i);
    }
  }

  sqlite3_result_text(context, rz, -1, SQLITE_TRANSIENT);
  sqlite3_free(rz);
}

/*
** An instance of the following structure holds the context of a
** stdev() or variance() aggregate computation.
** implementaion of http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Algorithm_II
** less prone to rounding errors
*/
typedef struct StdevCtx StdevCtx;
struct StdevCtx {
  double rM;
  double rS;
  i64 cnt;          /* number of elements */
};

/*
** An instance of the following structure holds the context of a
** mode() or median() aggregate computation.
** Depends on structures defined in map.c (see map & map)
** These aggregate functions only work for integers and floats although
** they could be made to work for strings. This is usually considered meaningless.
** Only usuall order (for median), no use of collation functions (would this even make sense?)
*/
typedef struct ModeCtx ModeCtx;
struct ModeCtx {
  i64 riM;            /* integer value found so far */
  double rdM;         /* double value found so far */
  i64 cnt;            /* number of elements so far */
  double pcnt;        /* number of elements smaller than a percentile */
  i64 mcnt;           /* maximum number of occurrences (for mode) */
  i64 mn;             /* number of occurrences (for mode and percentiles) */
  i64 is_double;      /* whether the computation is being done for doubles (>0) or integers (=0) */
  map* m;             /* map structure used for the computation */
  int done;           /* whether the answer has been found */
};

/*
** called for each value received during a calculation of stdev or variance
*/
static void varianceStep(sqlite3_context *context, int argc, sqlite3_value **argv){
  StdevCtx *p;

  double delta;
  double x;

  assert( argc==1 );
  p = sqlite3_aggregate_context(context, sizeof(*p));
  /* only consider non-null values */
  if( SQLITE_NULL != sqlite3_value_numeric_type(argv[0]) ){
    p->cnt++;
    x = sqlite3_value_double(argv[0]);
    delta = (x-p->rM);
    p->rM += delta/p->cnt;
    p->rS += delta*(x-p->rM);
  }
}

/*
** called for each value received during a calculation of mode of median
*/
static void modeStep(sqlite3_context *context, int argc, sqlite3_value **argv){
  ModeCtx *p;
  i64 xi=0;
  double xd=0.0;
  i64 *iptr;
  double *dptr;
  int type;

  assert( argc==1 );
  type = sqlite3_value_numeric_type(argv[0]);

  if( type == SQLITE_NULL)
    return;
  
  p = sqlite3_aggregate_context(context, sizeof(*p));

  if( 0==(p->m) ){
    p->m = calloc(1, sizeof(map));
    if( type==SQLITE_INTEGER ){
      /* map will be used for integers */
      *(p->m) = map_make(int_cmp);
      p->is_double = 0;
    }else{
      p->is_double = 1;
      /* map will be used for doubles */
      *(p->m) = map_make(double_cmp);
    }
  }

  ++(p->cnt);

  if( 0==p->is_double ){
    xi = sqlite3_value_int64(argv[0]);
    iptr = (i64*)calloc(1,sizeof(i64));
    *iptr = xi;
    map_insert(p->m, iptr);
  }else{
    xd = sqlite3_value_double(argv[0]);
    dptr = (double*)calloc(1,sizeof(double));
    *dptr = xd;
    map_insert(p->m, dptr);
  }
}

/*
**  Auxiliary function that iterates all elements in a map and finds the mode
**  (most frequent value)
*/
static void modeIterate(void* e, i64 c, void* pp){
  i64 ei;
  double ed;
  ModeCtx *p = (ModeCtx*)pp;
  
  if( 0==p->is_double ){
    ei = *(int*)(e);

	if( p->mcnt==c ){
      ++p->mn;
    }else if( p->mcnt<c ){
      p->riM = ei;
      p->mcnt = c;
	  p->mn=1;
    }
  }else{
    ed = *(double*)(e);

	if( p->mcnt==c ){
      ++p->mn;
    }else if(p->mcnt<c){
      p->rdM = ed;
      p->mcnt = c;
	  p->mn=1;
    }
  }
}

/*
**  Auxiliary function that iterates all elements in a map and finds the median
**  (the value such that the number of elements smaller is equal the the number of 
**  elements larger)
*/
static void medianIterate(void* e, i64 c, void* pp){
  i64 ei;
  double ed;
  double iL;
  double iR;
  int il;
  int ir;
  ModeCtx *p = (ModeCtx*)pp;

  if(p->done>0)
    return;

  iL = p->pcnt;
  iR = p->cnt - p->pcnt;
  il = p->mcnt + c;
  ir = p->cnt - p->mcnt;

  if( il >= iL ){
    if( ir >= iR ){
    ++p->mn;
      if( 0==p->is_double ){
        ei = *(int*)(e);
        p->riM += ei;
      }else{
        ed = *(double*)(e);
        p->rdM += ed;
      }
    }else{
      p->done=1;
    }
  }
  p->mcnt+=c;
}

/*
** Returns the mode value
*/
static void modeFinalize(sqlite3_context *context){
  ModeCtx *p;
  p = sqlite3_aggregate_context(context, 0);
  if( p && p->m ){
    map_iterate(p->m, modeIterate, p);
    map_destroy(p->m);
    free(p->m);

    if( 1==p->mn ){
      if( 0==p->is_double )
        sqlite3_result_int64(context, p->riM);
      else
        sqlite3_result_double(context, p->rdM);
    }
  }
}

/*
** auxiliary function for percentiles
*/
static void _medianFinalize(sqlite3_context *context){
  ModeCtx *p;
  p = (ModeCtx*) sqlite3_aggregate_context(context, 0);
  if( p && p->m ){
    p->done=0;
    map_iterate(p->m, medianIterate, p);
    map_destroy(p->m);
    free(p->m);

    if( 0==p->is_double )
      if( 1==p->mn )
      	sqlite3_result_int64(context, p->riM);
      else
      	sqlite3_result_double(context, p->riM*1.0/p->mn);
    else
      sqlite3_result_double(context, p->rdM/p->mn);
  }
}

/*
** Returns the median value
*/
static void medianFinalize(sqlite3_context *context){
  ModeCtx *p;
  p = (ModeCtx*) sqlite3_aggregate_context(context, 0);
  if( p!=0 ){
    p->pcnt = (p->cnt)/2.0;
    _medianFinalize(context);
  }
}

/*
** Returns the lower_quartile value
*/
static void lower_quartileFinalize(sqlite3_context *context){
  ModeCtx *p;
  p = (ModeCtx*) sqlite3_aggregate_context(context, 0);
  if( p!=0 ){
    p->pcnt = (p->cnt)/4.0;
    _medianFinalize(context);
  }
}

/*
** Returns the upper_quartile value
*/
static void upper_quartileFinalize(sqlite3_context *context){
  ModeCtx *p;
  p = (ModeCtx*) sqlite3_aggregate_context(context, 0);
  if( p!=0 ){
    p->pcnt = (p->cnt)*3/4.0;
    _medianFinalize(context);
  }
}

/*
** Returns the stdev value
*/
static void stdevFinalize(sqlite3_context *context){
  StdevCtx *p;
  p = sqlite3_aggregate_context(context, 0);
  if( p && p->cnt>1 ){
    sqlite3_result_double(context, sqrt(p->rS/(p->cnt-1)));
  }else{
    sqlite3_result_double(context, 0.0);
  }
}

/*
** Returns the variance value
*/
static void varianceFinalize(sqlite3_context *context){
  StdevCtx *p;
  p = sqlite3_aggregate_context(context, 0);
  if( p && p->cnt>1 ){
    sqlite3_result_double(context, p->rS/(p->cnt-1));
  }else{
    sqlite3_result_double(context, 0.0);
  }
}

#ifdef SQLITE_SOUNDEX

/* relicoder factored code */
/*
** Calculates the soundex value of a string
*/

static void soundex(const u8 *zIn, char *zResult){
  int i, j;
  static const unsigned char iCode[] = {
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5, 5, 0,
    1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0,
    0, 0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5, 5, 0,
    1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0,
  };

  for(i=0; zIn[i] && !isalpha(zIn[i]); i++){}
  if( zIn[i] ){
    zResult[0] = toupper(zIn[i]);
    for(j=1; j<4 && zIn[i]; i++){
      int code = iCode[zIn[i]&0x7f];
      if( code>0 ){
        zResult[j++] = code + '0';
      }
    }
    while( j<4 ){
      zResult[j++] = '0';
    }
    zResult[j] = 0;
  }else{
    strcpy(zResult, "?000");
  }
}

/*
** computes the number of different characters between the soundex value fo 2 strings
*/
static void differenceFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  char zResult1[8];
  char zResult2[8];
  char *zR1 = zResult1;
  char *zR2 = zResult2;
  int rVal = 0;
  int i = 0;
  const u8 *zIn1;
  const u8 *zIn2;

  assert( argc==2 );
  
  if( sqlite3_value_type(argv[0])==SQLITE_NULL || sqlite3_value_type(argv[1])==SQLITE_NULL ){
    sqlite3_result_null(context);
    return;
  }
  
  zIn1 = (u8*)sqlite3_value_text(argv[0]);
  zIn2 = (u8*)sqlite3_value_text(argv[1]);

  soundex(zIn1, zR1);
  soundex(zIn2, zR2);

  for(i=0; i<4; ++i){
    if( sqliteCharVal((unsigned char *)zR1)==sqliteCharVal((unsigned char *)zR2) )
      ++rVal;
    sqliteNextChar(zR1);
    sqliteNextChar(zR2);
  }
  sqlite3_result_int(context, rVal);
}
#endif

static void lastRowsFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  sqlite3 *db = sqlite3_context_db_handle(context);
  sqlite3_result_int64(context, sqlite3_changes(db));
}

/*
** This function registered all of the above C functions as SQL
** functions.  This should be the only routine in this file with
** external linkage.
*/
int RegisterExtensionFunctions(sqlite3 *db){
  static const struct FuncDefs {
     char *zName;
     signed char nArg;
     u8 argType;           /* 0: none.  1: db  2: (-1) */
     u8 eTextRep;          /* 1: UTF-16.  0: UTF-8 */
     u8 needCollSeq;
     void (*xFunc)(sqlite3_context*,int,sqlite3_value **);
  } aFuncs[] = {
    /* math.h */
    { "acos",               1, 0, SQLITE_UTF8,    0, acosFunc  },
    { "asin",               1, 0, SQLITE_UTF8,    0, asinFunc  },
    { "atan",               1, 0, SQLITE_UTF8,    0, atanFunc  },
    { "atn2",               2, 0, SQLITE_UTF8,    0, atn2Func  },
    /* XXX alias */
    { "atan2",              2, 0, SQLITE_UTF8,    0, atn2Func  },
    { "acosh",              1, 0, SQLITE_UTF8,    0, acoshFunc  },
    { "asinh",              1, 0, SQLITE_UTF8,    0, asinhFunc  },
    { "atanh",              1, 0, SQLITE_UTF8,    0, atanhFunc  },

    { "difference",         2, 0, SQLITE_UTF8,    0, differenceFunc},
    { "degrees",            1, 0, SQLITE_UTF8,    0, rad2degFunc  },
    { "radians",            1, 0, SQLITE_UTF8,    0, deg2radFunc  },

    { "cos",                1, 0, SQLITE_UTF8,    0, cosFunc  },
    { "sin",                1, 0, SQLITE_UTF8,    0, sinFunc },
    { "tan",                1, 0, SQLITE_UTF8,    0, tanFunc },
    { "cot",                1, 0, SQLITE_UTF8,    0, cotFunc },
    { "cosh",               1, 0, SQLITE_UTF8,    0, coshFunc  },
    { "sinh",               1, 0, SQLITE_UTF8,    0, sinhFunc },
    { "tanh",               1, 0, SQLITE_UTF8,    0, tanhFunc },
    { "coth",               1, 0, SQLITE_UTF8,    0, cothFunc },

    { "exp",                1, 0, SQLITE_UTF8,    0, expFunc  },
    { "log",                1, 0, SQLITE_UTF8,    0, logFunc  },
    { "log10",              1, 0, SQLITE_UTF8,    0, log10Func  },
    { "power",              2, 0, SQLITE_UTF8,    0, powerFunc  },
    { "sign",               1, 0, SQLITE_UTF8,    0, signFunc },
    { "sqrt",               1, 0, SQLITE_UTF8,    0, sqrtFunc },
    { "square",             1, 0, SQLITE_UTF8,    0, squareFunc },

    { "ceil",               1, 0, SQLITE_UTF8,    0, ceilFunc },
    { "ceiling",            1, 0, SQLITE_UTF8,    0, ceilFunc },
    { "floor",              1, 0, SQLITE_UTF8,    0, floorFunc },

    { "pi",                 0, 0, SQLITE_UTF8,    0, piFunc },
    { "last_rows_affected", 0, 0, SQLITE_UTF8,    0, lastRowsFunc },

    /* string */
    { "replicate",          2, 0, SQLITE_UTF8,    0, replicateFunc },
    { "charindex",          2, 0, SQLITE_UTF8,    1, charindexFunc },
    { "charindex",          3, 0, SQLITE_UTF8,    1, charindexFunc },
    { "leftstr",            2, 0, SQLITE_UTF8,    0, leftFunc },
    { "rightstr",           2, 0, SQLITE_UTF8,    0, rightFunc },
#ifndef HAVE_TRIM
    { "ltrim",              1, 0, SQLITE_UTF8,    0, ltrimFunc },
    { "rtrim",              1, 0, SQLITE_UTF8,    0, rtrimFunc },
    { "trim",               1, 0, SQLITE_UTF8,    0, trimFunc },
    { "replace",            3, 0, SQLITE_UTF8,    0, replaceFunc },
#endif
    { "reverse",            1, 0, SQLITE_UTF8,    0, reverseFunc },
    { "proper",             1, 0, SQLITE_UTF8,    0, properFunc },
    { "padl",               2, 0, SQLITE_UTF8,    0, padlFunc },
    { "padr",               2, 0, SQLITE_UTF8,    0, padrFunc },
    { "padc",               2, 0, SQLITE_UTF8,    0, padcFunc },
    { "strfilter",          2, 0, SQLITE_UTF8,    0, strfilterFunc },

  };
  /* Aggregate functions */
  static const struct FuncDefAgg {
    char *zName;
    signed char nArg;
    u8 argType;
    u8 needCollSeq;
    void (*xStep)(sqlite3_context*,int,sqlite3_value**);
    void (*xFinalize)(sqlite3_context*);
  } aAggs[] = {
    { "stdev",            1, 0, 0, varianceStep, stdevFinalize  },
    { "variance",         1, 0, 0, varianceStep, varianceFinalize  },
    { "mode",             1, 0, 0, modeStep,     modeFinalize  },
    { "median",           1, 0, 0, modeStep,     medianFinalize  },
    { "lower_quartile",   1, 0, 0, modeStep,     lower_quartileFinalize  },
    { "upper_quartile",   1, 0, 0, modeStep,     upper_quartileFinalize  },
  };
  int i;

  for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){
    void *pArg = 0;
    switch( aFuncs[i].argType ){
      case 1: pArg = db; break;
      case 2: pArg = (void *)(-1); break;
    }
    //sqlite3CreateFunc
    /* LMH no error checking */
    sqlite3_create_function(db, aFuncs[i].zName, aFuncs[i].nArg,
        aFuncs[i].eTextRep, pArg, aFuncs[i].xFunc, 0, 0);
#if 1
    if( aFuncs[i].needCollSeq ){
      struct FuncDef *pFunc = sqlite3FindFunction(db, aFuncs[i].zName, 
          strlen(aFuncs[i].zName), aFuncs[i].nArg, aFuncs[i].eTextRep, 0);
      if( pFunc && aFuncs[i].needCollSeq ){
        pFunc->flags |= SQLITE_FUNC_NEEDCOLL;
      }
    }
#endif
  }

  for(i=0; i<sizeof(aAggs)/sizeof(aAggs[0]); i++){
    void *pArg = 0;
    switch( aAggs[i].argType ){
      case 1: pArg = db; break;
      case 2: pArg = (void *)(-1); break;
    }
    //sqlite3CreateFunc
    /* LMH no error checking */
    sqlite3_create_function(db, aAggs[i].zName, aAggs[i].nArg, SQLITE_UTF8, 
        pArg, 0, aAggs[i].xStep, aAggs[i].xFinalize);
#if 0
    if( aAggs[i].needCollSeq ){
      struct FuncDefAgg *pFunc = sqlite3FindFunction( db, aAggs[i].zName,
          strlen(aAggs[i].zName), aAggs[i].nArg, SQLITE_UTF8, 0);
      if( pFunc && aAggs[i].needCollSeq ){
        pFunc->needCollSeq = 1;
      }
    }
#endif
  }
  return 0;
}

#ifdef COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE
int sqlite3_extension_init(
    sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi){
  SQLITE_EXTENSION_INIT2(pApi);
  RegisterExtensionFunctions(db);
  return 0;
}
#endif /* COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE */

map map_make(cmp_func cmp){
  map r;
  r.cmp=cmp;
  r.base = 0;

  return r;
}

void* xcalloc(size_t nmemb, size_t size, char* s){
  void* ret = calloc(nmemb, size);
  return ret;
}

void xfree(void* p){
  free(p);
}

void node_insert(node** n, cmp_func cmp, void *e){
  int c;
  node* nn;
  if(*n==0){
    nn = (node*)xcalloc(1,sizeof(node), "for node");
    nn->data = e;
    nn->count = 1;
    *n=nn;
  }else{
    c=cmp((*n)->data,e);
    if(0==c){
      ++((*n)->count);
      xfree(e);
    }else if(c>0){
      /* put it right here */
      node_insert(&((*n)->l), cmp, e);
    }else{
      node_insert(&((*n)->r), cmp, e);
    }
  }
}

void map_insert(map *m, void *e){
  node_insert(&(m->base), m->cmp, e);
}

void node_iterate(node *n, map_iterator iter, void* p){
  if(n){
    if(n->l)
      node_iterate(n->l, iter, p);
    iter(n->data, n->count, p);
    if(n->r)
      node_iterate(n->r, iter, p);
  }
}

void map_iterate(map *m, map_iterator iter, void* p){
  node_iterate(m->base, iter, p);
}

void node_destroy(node *n){
  if(0!=n){
    xfree(n->data);
    if(n->l)
      node_destroy(n->l);
    if(n->r)
      node_destroy(n->r);

    xfree(n);
  }
}

void map_destroy(map *m){
  node_destroy(m->base);
}

int int_cmp(const void *a, const void *b){
  int64_t aa = *(int64_t *)(a);
  int64_t bb = *(int64_t *)(b);
  /* printf("cmp %d <=> %d\n",aa,bb); */
  if(aa==bb)
    return 0;
  else if(aa<bb)
    return -1;
  else
    return 1;
}

int double_cmp(const void *a, const void *b){
  double aa = *(double *)(a);
  double bb = *(double *)(b);
  /* printf("cmp %d <=> %d\n",aa,bb); */
  if(aa==bb)
    return 0;
  else if(aa<bb)
    return -1;
  else
    return 1;
}

void print_elem(void *e, int64_t c, void* p){
  int ee = *(int*)(e);
  printf("%d => %lld\n", ee,c);
}

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








































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/interop.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
#include "src/sqlite3.c"
#include "extension-functions.c"
#include "crypt.c"

extern int RegisterExtensionFunctions(sqlite3 *db);

#ifdef SQLITE_OS_WIN

// Additional open flags, we use this one privately
//#define SQLITE_OPEN_SHAREDCACHE      0x01000000

typedef void (*SQLITEUSERFUNC)(sqlite3_context *, int, sqlite3_value **);
typedef void (*SQLITEFUNCFINAL)(sqlite3_context *);

/*
    The goal of this version of close is different than that of sqlite3_close(), and is designed to lend itself better to .NET's non-deterministic finalizers and
    the GC thread.  SQLite will not close a database if statements are open on it -- but for our purposes, we'd rather finalize all active statements
    and forcibly close the database.  The reason is simple -- a lot of people don't Dispose() of their objects correctly and let the garbage collector
    do it.  This leads to unexpected behavior when a user thinks they've closed a database, but it's still open because not all the statements have
    hit the GC yet.

    So, here we have a problem ... .NET has a pointer to any number of sqlite3_stmt objects.  We can't call sqlite3_finalize() on these because
    their memory is freed and can be used for something else.  The GC thread could potentially try and call finalize again on the statement after
    that memory was deallocated.  BAD.  So, what we need to do is make a copy of each statement, and call finalize() on the copy -- so that the original
    statement's memory is preserved, and marked as BAD, but we can still manage to finalize everything and forcibly close the database.  Later when the 
    GC gets around to calling finalize_interop() on the "bad" statement, we detect that and finish deallocating the pointer.
*/
__declspec(dllexport) int WINAPI sqlite3_close_interop(sqlite3 *db)
{
  int ret;
  
  ret = sqlite3_close(db);

  if (ret == SQLITE_BUSY && db->pVdbe)
  {
    while (db->pVdbe)
    {
      // Make a copy of the first prepared statement
      Vdbe *p = (Vdbe *)sqlite3_malloc(sizeof(Vdbe));
      Vdbe *po = db->pVdbe;

      if (!p) 
      {
        ret = SQLITE_NOMEM;
        break;
      }

      CopyMemory(p, po, sizeof(Vdbe));

      // Put it on the chain so we can free it
      db->pVdbe = p;
      ret = sqlite3_finalize((sqlite3_stmt *)p); // This will also free the copy's memory
      if (ret)
      {
        // finalize failed -- so we must put back anything we munged
        CopyMemory(po, p, sizeof(Vdbe));
        db->pVdbe = po;
        break;
      }
      else
      {
        ZeroMemory(po, sizeof(Vdbe));
        po->magic = VDBE_MAGIC_DEAD;
      }
    }
    ret = sqlite3_close(db);
  }

  return ret;
}

__declspec(dllexport) int WINAPI sqlite3_open_interop(const char*filename, int flags, sqlite3 **ppdb)
{
  int ret;
  //int sharedcache = ((flags & SQLITE_OPEN_SHAREDCACHE) != 0);
  //flags &= ~SQLITE_OPEN_SHAREDCACHE;

  //sqlite3_enable_shared_cache(sharedcache);
  ret = sqlite3_open_v2(filename, ppdb, flags, NULL);
  //sqlite3_enable_shared_cache(0);

  if (ret == 0)
    RegisterExtensionFunctions(*ppdb);

  return ret;
}

__declspec(dllexport) int WINAPI sqlite3_open16_interop(const char *filename, int flags, sqlite3 **ppdb)
{
  int ret = sqlite3_open_interop(filename, flags, ppdb);
  if (!ret)
  {
    if(!DbHasProperty(*ppdb, 0, DB_SchemaLoaded))
      ENC(*ppdb) = SQLITE_UTF16NATIVE;
  }
  return ret;
}

__declspec(dllexport) const char * WINAPI sqlite3_errmsg_interop(sqlite3 *db, int *plen)
{
  const char *pval = sqlite3_errmsg(db);
  *plen = (pval != 0) ? strlen(pval) : 0;
  return pval;
}

__declspec(dllexport) int WINAPI sqlite3_prepare_interop(sqlite3 *db, const char *sql, int nbytes, sqlite3_stmt **ppstmt, const char **pztail, int *plen)
{
  int n;

  n = sqlite3_prepare(db, sql, nbytes, ppstmt, pztail);
  *plen = (*pztail != 0) ? strlen(*pztail) : 0;

  return n;
}

__declspec(dllexport) int WINAPI sqlite3_prepare16_interop(sqlite3 *db, const void *sql, int nchars, sqlite3_stmt **ppstmt, const void **pztail, int *plen)
{
  int n;

  n = sqlite3_prepare16(db, sql, nchars * sizeof(wchar_t), ppstmt, pztail);
  *plen = (*pztail != 0) ? wcslen((wchar_t *)*pztail) * sizeof(wchar_t) : 0;

  return n;
}

__declspec(dllexport) int WINAPI sqlite3_bind_double_interop(sqlite3_stmt *stmt, int iCol, double *val)
{
	return sqlite3_bind_double(stmt,iCol,*val);
}

__declspec(dllexport) int WINAPI sqlite3_bind_int64_interop(sqlite3_stmt *stmt, int iCol, sqlite_int64 *val)
{
	return sqlite3_bind_int64(stmt,iCol,*val);
}

__declspec(dllexport) const char * WINAPI sqlite3_bind_parameter_name_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const char *pval = sqlite3_bind_parameter_name(stmt, iCol);
  *plen = (pval != 0) ? strlen(pval) : 0;
  return pval;
}

__declspec(dllexport) const char * WINAPI sqlite3_column_name_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const char *pval = sqlite3_column_name(stmt, iCol);
  *plen = (pval != 0) ? strlen(pval) : 0;
  return pval;
}

__declspec(dllexport) const void * WINAPI sqlite3_column_name16_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const void *pval = sqlite3_column_name16(stmt, iCol);
  *plen = (pval != 0) ? wcslen((wchar_t *)pval) * sizeof(wchar_t) : 0;
  return pval;
}

__declspec(dllexport) const char * WINAPI sqlite3_column_decltype_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const char *pval = sqlite3_column_decltype(stmt, iCol);
  *plen = (pval != 0) ? strlen(pval) : 0;
  return pval;
}

__declspec(dllexport) const void * WINAPI sqlite3_column_decltype16_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const void *pval = sqlite3_column_decltype16(stmt, iCol);
  *plen = (pval != 0) ? wcslen((wchar_t *)pval) * sizeof(wchar_t) : 0;
  return pval;
}

__declspec(dllexport) void WINAPI sqlite3_column_double_interop(sqlite3_stmt *stmt, int iCol, double *val)
{
	*val = sqlite3_column_double(stmt,iCol);
}

__declspec(dllexport) void WINAPI sqlite3_column_int64_interop(sqlite3_stmt *stmt, int iCol, sqlite_int64 *val)
{
	*val = sqlite3_column_int64(stmt,iCol);
}

__declspec(dllexport) const unsigned char * WINAPI sqlite3_column_text_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const unsigned char *pval = sqlite3_column_text(stmt, iCol);
  *plen = (pval != 0) ? strlen((char *)pval) : 0;
  return pval;
}

__declspec(dllexport) const void * WINAPI sqlite3_column_text16_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const void *pval = sqlite3_column_text16(stmt, iCol);
  *plen = (pval != 0) ? wcslen((wchar_t *)pval) * sizeof(wchar_t): 0;
  return pval;
}

__declspec(dllexport) int WINAPI sqlite3_finalize_interop(sqlite3_stmt *stmt)
{
  Vdbe *p;
  sqlite3 *db;
  int ret;

  p = (Vdbe *)stmt;
  db = (p == NULL) ? NULL : p->db;

  if (p->magic == VDBE_MAGIC_DEAD)
  {
    if (db == NULL)
    {
      sqlite3_free(p);
      ret = SQLITE_OK;
    }
  }
  else
    ret = sqlite3_finalize(stmt);

  return ret;
}

__declspec(dllexport) int WINAPI sqlite3_reset_interop(sqlite3_stmt *stmt)
{
  int ret;

  if (((Vdbe *)stmt)->magic == VDBE_MAGIC_DEAD) return SQLITE_SCHEMA;
  ret = sqlite3_reset(stmt);
  return ret;
}

__declspec(dllexport) int WINAPI sqlite3_create_function_interop(sqlite3 *psql, const char *zFunctionName, int nArg, int eTextRep, void *pvUser, SQLITEUSERFUNC func, SQLITEUSERFUNC funcstep, SQLITEFUNCFINAL funcfinal, int needCollSeq)
{
  int n;

  if (eTextRep == SQLITE_UTF16)
    eTextRep = SQLITE_UTF16NATIVE;

  n = sqlite3_create_function(psql, zFunctionName, nArg, eTextRep, 0, func, funcstep, funcfinal);
  if (n == 0)
  {
    if (needCollSeq)
    {
      FuncDef *pFunc = sqlite3FindFunction(psql, zFunctionName, strlen(zFunctionName), nArg, eTextRep, 0);
      if( pFunc )
      {
        pFunc->flags |= SQLITE_FUNC_NEEDCOLL;
      }
    }
  }

  return n;
}

__declspec(dllexport) void WINAPI sqlite3_value_double_interop(sqlite3_value *pval, double *val)
{
  *val = sqlite3_value_double(pval);
}

__declspec(dllexport) void WINAPI sqlite3_value_int64_interop(sqlite3_value *pval, sqlite_int64 *val)
{
  *val = sqlite3_value_int64(pval);
}

__declspec(dllexport) const unsigned char * WINAPI sqlite3_value_text_interop(sqlite3_value *val, int *plen)
{
  const unsigned char *pval = sqlite3_value_text(val);
  *plen = (pval != 0) ? strlen((char *)pval) : 0;
  return pval;
}

__declspec(dllexport) const void * WINAPI sqlite3_value_text16_interop(sqlite3_value *val, int *plen)
{
  const void *pval = sqlite3_value_text16(val);
  *plen = (pval != 0) ? wcslen((wchar_t *)pval) * sizeof(wchar_t) : 0;
  return pval;
}

__declspec(dllexport) void WINAPI sqlite3_result_double_interop(sqlite3_context *pctx, double *val)
{
  sqlite3_result_double(pctx, *val);
}

__declspec(dllexport) void WINAPI sqlite3_result_int64_interop(sqlite3_context *pctx, sqlite_int64 *val)
{
  sqlite3_result_int64(pctx, *val);
}

__declspec(dllexport) int WINAPI sqlite3_context_collcompare(sqlite3_context *ctx, const void *p1, int p1len, const void *p2, int p2len)
{
  if ((ctx->pFunc->flags & SQLITE_FUNC_NEEDCOLL) == 0) return 2;
  return ctx->pColl->xCmp(ctx->pColl->pUser, p1len, p1, p2len, p2);
}

__declspec(dllexport) const char * WINAPI sqlite3_context_collseq(sqlite3_context *ctx, int *ptype, int *enc, int *plen)
{
  CollSeq *pColl = ctx->pColl;
  *ptype = 0;
  *plen = 0;
  *enc = 0;

  if ((ctx->pFunc->flags & SQLITE_FUNC_NEEDCOLL) == 0) return NULL;

  if (pColl)
  {
    *enc = pColl->enc;
    *ptype = pColl->type;
    *plen = (pColl->zName != 0) ? strlen(pColl->zName) : 0;

    return pColl->zName;
  }
  return NULL;
}

__declspec(dllexport) const char * WINAPI sqlite3_column_database_name_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const char *pval = sqlite3_column_database_name(stmt, iCol);
  *plen = (pval != 0) ? strlen(pval) : 0;
  return pval;
}

__declspec(dllexport) const void * WINAPI sqlite3_column_database_name16_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const void *pval = sqlite3_column_database_name16(stmt, iCol);
  *plen = (pval != 0) ? wcslen((wchar_t *)pval) * sizeof(wchar_t) : 0;
  return pval;
}

__declspec(dllexport) const char * WINAPI sqlite3_column_table_name_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const char *pval = sqlite3_column_table_name(stmt, iCol);
  *plen = (pval != 0) ? strlen(pval) : 0;
  return pval;
}

__declspec(dllexport) const void * WINAPI sqlite3_column_table_name16_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const void *pval = sqlite3_column_table_name16(stmt, iCol);
  *plen = (pval != 0) ? wcslen((wchar_t *)pval) * sizeof(wchar_t) : 0;
  return pval;
}

__declspec(dllexport) const char * WINAPI sqlite3_column_origin_name_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const char *pval = sqlite3_column_origin_name(stmt, iCol);
  *plen = (pval != 0) ? strlen(pval) : 0;
  return pval;
}

__declspec(dllexport) const void * WINAPI sqlite3_column_origin_name16_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const void *pval = sqlite3_column_origin_name16(stmt, iCol);
  *plen = (pval != 0) ? wcslen((wchar_t *)pval) * sizeof(wchar_t) : 0;
  return pval;
}

__declspec(dllexport) int WINAPI sqlite3_table_column_metadata_interop(sqlite3 *db, const char *zDbName, const char *zTableName, const char *zColumnName, char **pzDataType, char **pzCollSeq, int *pNotNull, int *pPrimaryKey, int *pAutoinc, int *pdtLen, int *pcsLen)
{
  int n;
  
  n = sqlite3_table_column_metadata(db, zDbName, zTableName, zColumnName, pzDataType, pzCollSeq, pNotNull, pPrimaryKey, pAutoinc);
  *pdtLen = (*pzDataType != 0) ? strlen(*pzDataType) : 0;
  *pcsLen = (*pzCollSeq != 0) ? strlen(*pzCollSeq) : 0;

  return n;
}

__declspec(dllexport) int WINAPI sqlite3_index_column_info_interop(sqlite3 *db, const char *zDb, const char *zIndexName, const char *zColumnName, int *sortOrder, int *onError, char **pzColl, int *plen)
{
  Index *pIdx;
  Table *pTab;
  char *zErrMsg = 0;
  int n;
  pIdx = sqlite3FindIndex(db, zIndexName, zDb);
  if (!pIdx) return SQLITE_ERROR;

  pTab = pIdx->pTable;
  for (n = 0; n < pIdx->nColumn; n++)
  {
    int cnum = pIdx->aiColumn[n];
    if (sqlite3StrICmp(pTab->aCol[cnum].zName, zColumnName) == 0)
    {
      *sortOrder = pIdx->aSortOrder[n];
      *pzColl = pIdx->azColl[n];
      *plen = strlen(*pzColl);
      *onError = pIdx->onError;

      return SQLITE_OK;
    }
  }
  return SQLITE_ERROR;
}

__declspec(dllexport) int WINAPI sqlite3_table_cursor(sqlite3_stmt *pstmt, int iDb, Pgno tableRootPage)
{
  Vdbe *p = (Vdbe *)pstmt;
  sqlite3 *db = (p == NULL) ? NULL : p->db;
  int n;
  int ret = -1;

  sqlite3_mutex_enter(db->mutex);
  for (n = 0; n < p->nCursor && p->apCsr[n] != NULL; n++)
  {
    if (p->apCsr[n]->isTable == FALSE) continue;
    if (p->apCsr[n]->iDb != iDb) continue;
    if (p->apCsr[n]->pCursor->pgnoRoot == tableRootPage)
    {
      ret = n;
      break;
    }
  }
  sqlite3_mutex_leave(db->mutex);

  return ret;
}

__declspec(dllexport) int WINAPI sqlite3_cursor_rowid(sqlite3_stmt *pstmt, int cursor, sqlite_int64 *prowid)
{
  Vdbe *p = (Vdbe *)pstmt;
  sqlite3 *db = (p == NULL) ? NULL : p->db;
  int rc = 0;
  VdbeCursor *pC;
  int ret = 0;

  sqlite3_mutex_enter(db->mutex);
  while (1)
  {
    if (cursor < 0 || cursor >= p->nCursor)
    {
      ret = SQLITE_ERROR;
      break;
    }
    if (p->apCsr[cursor] == NULL)
    {
      ret = SQLITE_ERROR;
      break;
    }

    pC = p->apCsr[cursor];

    ret = sqlite3VdbeCursorMoveto(pC);
    if(ret)
      break;

    if(pC->rowidIsValid)
    {
      *prowid = pC->lastRowid;
    }
    else if(pC->pseudoTableReg > 0)
    {
      ret = SQLITE_ERROR;
      break;
    }
    else if(pC->nullRow || pC->pCursor==0)
    {
      ret = SQLITE_ERROR;
      break;
    }
    else
    {
      if (pC->pCursor == NULL)
      {
        ret = SQLITE_ERROR;
        break;
      }
      sqlite3BtreeKeySize(pC->pCursor, prowid);
      *prowid = *prowid;
    }
    break;
  }
  sqlite3_mutex_leave(db->mutex);

  return ret;
}

#endif // SQLITE_OS_WIN

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
















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Added SQLite.Interop/props/SQLite.Interop.2005.vsprops.





















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?xml version="1.0" encoding="Windows-1252"?>
<!--
 *
 * SQLite.Interop.2005.vsprops -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<VisualStudioPropertySheet
	ProjectType="Visual C++"
	Version="8.00"
	Name="SQLite.Interop"
	>
	<UserMacro
		Name="ConfigurationYear"
		Value="2005"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_BUILD_NUMBER"
		Value="119"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_LINKER_VERSION"
		Value="1.0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_MANIFEST_VERSION"
		Value="1.0.119.0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_RC_VERSION"
		Value="1,0,119,0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_INCLUDE_DIRECTORIES"
		Value="src\core"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_LIBRARY_DIRECTORIES"
		Value=""
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_LIBRARY_DEPENDENCIES"
		Value=""
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_DEBUG_DEFINES"
		Value="INTEROP_DEBUG=0x200;INTEROP_LOG=1;INTEROP_TEST_EXTENSION=1"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_EXTRA_DEFINES"
		Value="INTEROP_PLACEHOLDER=1;INTEROP_EXTENSION_FUNCTIONS=1;INTEROP_VIRTUAL_TABLE=1;INTEROP_FTS5_EXTENSION=1;INTEROP_PERCENTILE_EXTENSION=1;INTEROP_TOTYPE_EXTENSION=1;INTEROP_REGEXP_EXTENSION=1;INTEROP_JSON1_EXTENSION=1;INTEROP_SHA1_EXTENSION=1;INTEROP_SHA3_EXTENSION=1;INTEROP_SESSION_EXTENSION=1"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_RESOURCE_DEFINES"
		Value="INTEROP_RESOURCE_PLACEHOLDER=1"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_ASSEMBLY_RESOURCES"
		Value="/ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteCommand.bmp,System.Data.SQLite.SQLiteCommand.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteConnection.bmp,System.Data.SQLite.SQLiteConnection.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteDataAdapter.bmp,System.Data.SQLite.SQLiteDataAdapter.bmp"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_KEY_FILE"
		Value="$(ProjectDir)..\Keys\System.Data.SQLite.snk"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_NATIVE_NAME"
		Value="SQLite.Interop"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_MIXED_NAME"
		Value="System.Data.SQLite"
		PerformEnvironmentSet="true"
	/>
</VisualStudioPropertySheet>

Added SQLite.Interop/props/SQLite.Interop.2008.vsprops.





















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?xml version="1.0" encoding="Windows-1252"?>
<!--
 *
 * SQLite.Interop.2008.vsprops -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<VisualStudioPropertySheet
	ProjectType="Visual C++"
	Version="8.00"
	Name="SQLite.Interop"
	>
	<UserMacro
		Name="ConfigurationYear"
		Value="2008"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_BUILD_NUMBER"
		Value="119"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_LINKER_VERSION"
		Value="1.0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_MANIFEST_VERSION"
		Value="1.0.119.0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_RC_VERSION"
		Value="1,0,119,0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_INCLUDE_DIRECTORIES"
		Value="src\core"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_LIBRARY_DIRECTORIES"
		Value=""
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_LIBRARY_DEPENDENCIES"
		Value=""
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_DEBUG_DEFINES"
		Value="INTEROP_DEBUG=0x200;INTEROP_LOG=1;INTEROP_TEST_EXTENSION=1"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_EXTRA_DEFINES"
		Value="INTEROP_PLACEHOLDER=1;INTEROP_EXTENSION_FUNCTIONS=1;INTEROP_VIRTUAL_TABLE=1;INTEROP_FTS5_EXTENSION=1;INTEROP_PERCENTILE_EXTENSION=1;INTEROP_TOTYPE_EXTENSION=1;INTEROP_REGEXP_EXTENSION=1;INTEROP_JSON1_EXTENSION=1;INTEROP_SHA1_EXTENSION=1;INTEROP_SHA3_EXTENSION=1;INTEROP_SESSION_EXTENSION=1"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_RESOURCE_DEFINES"
		Value="INTEROP_RESOURCE_PLACEHOLDER=1"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_ASSEMBLY_RESOURCES"
		Value="/ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteCommand.bmp,System.Data.SQLite.SQLiteCommand.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteConnection.bmp,System.Data.SQLite.SQLiteConnection.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteDataAdapter.bmp,System.Data.SQLite.SQLiteDataAdapter.bmp"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_KEY_FILE"
		Value="$(ProjectDir)..\Keys\System.Data.SQLite.snk"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_NATIVE_NAME"
		Value="SQLite.Interop"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="INTEROP_MIXED_NAME"
		Value="System.Data.SQLite"
		PerformEnvironmentSet="true"
	/>
</VisualStudioPropertySheet>

Added SQLite.Interop/props/SQLite.Interop.2010.props.













































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.2010.props -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup Label="UserMacros">
    <ConfigurationYear>2010</ConfigurationYear>
    <INTEROP_BUILD_NUMBER>119</INTEROP_BUILD_NUMBER>
    <INTEROP_LINKER_VERSION>1.0</INTEROP_LINKER_VERSION>
    <INTEROP_MANIFEST_VERSION>1.0.119.0</INTEROP_MANIFEST_VERSION>
    <INTEROP_RC_VERSION>1,0,119,0</INTEROP_RC_VERSION>
    <INTEROP_INCLUDE_DIRECTORIES>src\core</INTEROP_INCLUDE_DIRECTORIES>
    <INTEROP_LIBRARY_DIRECTORIES></INTEROP_LIBRARY_DIRECTORIES>
    <INTEROP_LIBRARY_DEPENDENCIES></INTEROP_LIBRARY_DEPENDENCIES>
    <INTEROP_DEBUG_DEFINES>INTEROP_DEBUG=0x200;INTEROP_LOG=1;INTEROP_TEST_EXTENSION=1</INTEROP_DEBUG_DEFINES>
    <INTEROP_EXTRA_DEFINES>INTEROP_PLACEHOLDER=1;INTEROP_EXTENSION_FUNCTIONS=1;INTEROP_VIRTUAL_TABLE=1;INTEROP_FTS5_EXTENSION=1;INTEROP_PERCENTILE_EXTENSION=1;INTEROP_TOTYPE_EXTENSION=1;INTEROP_REGEXP_EXTENSION=1;INTEROP_JSON1_EXTENSION=1;INTEROP_SHA1_EXTENSION=1;INTEROP_SHA3_EXTENSION=1;INTEROP_SESSION_EXTENSION=1</INTEROP_EXTRA_DEFINES>
    <INTEROP_RESOURCE_DEFINES>INTEROP_RESOURCE_PLACEHOLDER=1</INTEROP_RESOURCE_DEFINES>
    <INTEROP_ASSEMBLY_RESOURCES>/ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteCommand.bmp,System.Data.SQLite.SQLiteCommand.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteConnection.bmp,System.Data.SQLite.SQLiteConnection.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteDataAdapter.bmp,System.Data.SQLite.SQLiteDataAdapter.bmp</INTEROP_ASSEMBLY_RESOURCES>
    <INTEROP_KEY_FILE>$(ProjectDir)..\Keys\System.Data.SQLite.snk</INTEROP_KEY_FILE>
    <INTEROP_NATIVE_NAME>SQLite.Interop</INTEROP_NATIVE_NAME>
    <INTEROP_MIXED_NAME>System.Data.SQLite</INTEROP_MIXED_NAME>
  </PropertyGroup>
  <ItemGroup>
    <BuildMacro Include="ConfigurationYear">
      <Value>$(ConfigurationYear)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_BUILD_NUMBER">
      <Value>$(INTEROP_BUILD_NUMBER)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_LINKER_VERSION">
      <Value>$(INTEROP_LINKER_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_MANIFEST_VERSION">
      <Value>$(INTEROP_MANIFEST_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_RC_VERSION">
      <Value>$(INTEROP_RC_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_INCLUDE_DIRECTORIES">
      <Value>$(INTEROP_INCLUDE_DIRECTORIES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_LIBRARY_DIRECTORIES">
      <Value>$(INTEROP_LIBRARY_DIRECTORIES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_LIBRARY_DEPENDENCIES">
      <Value>$(INTEROP_LIBRARY_DEPENDENCIES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_DEBUG_DEFINES">
      <Value>$(INTEROP_DEBUG_DEFINES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_EXTRA_DEFINES">
      <Value>$(INTEROP_EXTRA_DEFINES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_ASSEMBLY_RESOURCES">
      <Value>$(INTEROP_ASSEMBLY_RESOURCES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_KEY_FILE">
      <Value>$(INTEROP_KEY_FILE)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_NATIVE_NAME">
      <Value>$(INTEROP_NATIVE_NAME)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_MIXED_NAME">
      <Value>$(INTEROP_MIXED_NAME)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
  </ItemGroup>
</Project>

Added SQLite.Interop/props/SQLite.Interop.2012.props.













































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.2012.props -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup Label="UserMacros">
    <ConfigurationYear>2012</ConfigurationYear>
    <INTEROP_BUILD_NUMBER>119</INTEROP_BUILD_NUMBER>
    <INTEROP_LINKER_VERSION>1.0</INTEROP_LINKER_VERSION>
    <INTEROP_MANIFEST_VERSION>1.0.119.0</INTEROP_MANIFEST_VERSION>
    <INTEROP_RC_VERSION>1,0,119,0</INTEROP_RC_VERSION>
    <INTEROP_INCLUDE_DIRECTORIES>src\core</INTEROP_INCLUDE_DIRECTORIES>
    <INTEROP_LIBRARY_DIRECTORIES></INTEROP_LIBRARY_DIRECTORIES>
    <INTEROP_LIBRARY_DEPENDENCIES></INTEROP_LIBRARY_DEPENDENCIES>
    <INTEROP_DEBUG_DEFINES>INTEROP_DEBUG=0x200;INTEROP_LOG=1;INTEROP_TEST_EXTENSION=1</INTEROP_DEBUG_DEFINES>
    <INTEROP_EXTRA_DEFINES>INTEROP_PLACEHOLDER=1;INTEROP_EXTENSION_FUNCTIONS=1;INTEROP_VIRTUAL_TABLE=1;INTEROP_FTS5_EXTENSION=1;INTEROP_PERCENTILE_EXTENSION=1;INTEROP_TOTYPE_EXTENSION=1;INTEROP_REGEXP_EXTENSION=1;INTEROP_JSON1_EXTENSION=1;INTEROP_SHA1_EXTENSION=1;INTEROP_SHA3_EXTENSION=1;INTEROP_SESSION_EXTENSION=1</INTEROP_EXTRA_DEFINES>
    <INTEROP_RESOURCE_DEFINES>INTEROP_RESOURCE_PLACEHOLDER=1</INTEROP_RESOURCE_DEFINES>
    <INTEROP_ASSEMBLY_RESOURCES>/ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteCommand.bmp,System.Data.SQLite.SQLiteCommand.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteConnection.bmp,System.Data.SQLite.SQLiteConnection.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteDataAdapter.bmp,System.Data.SQLite.SQLiteDataAdapter.bmp</INTEROP_ASSEMBLY_RESOURCES>
    <INTEROP_KEY_FILE>$(ProjectDir)..\Keys\System.Data.SQLite.snk</INTEROP_KEY_FILE>
    <INTEROP_NATIVE_NAME>SQLite.Interop</INTEROP_NATIVE_NAME>
    <INTEROP_MIXED_NAME>System.Data.SQLite</INTEROP_MIXED_NAME>
  </PropertyGroup>
  <ItemGroup>
    <BuildMacro Include="ConfigurationYear">
      <Value>$(ConfigurationYear)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_BUILD_NUMBER">
      <Value>$(INTEROP_BUILD_NUMBER)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_LINKER_VERSION">
      <Value>$(INTEROP_LINKER_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_MANIFEST_VERSION">
      <Value>$(INTEROP_MANIFEST_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_RC_VERSION">
      <Value>$(INTEROP_RC_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_INCLUDE_DIRECTORIES">
      <Value>$(INTEROP_INCLUDE_DIRECTORIES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_LIBRARY_DIRECTORIES">
      <Value>$(INTEROP_LIBRARY_DIRECTORIES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_LIBRARY_DEPENDENCIES">
      <Value>$(INTEROP_LIBRARY_DEPENDENCIES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_DEBUG_DEFINES">
      <Value>$(INTEROP_DEBUG_DEFINES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_EXTRA_DEFINES">
      <Value>$(INTEROP_EXTRA_DEFINES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_ASSEMBLY_RESOURCES">
      <Value>$(INTEROP_ASSEMBLY_RESOURCES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_KEY_FILE">
      <Value>$(INTEROP_KEY_FILE)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_NATIVE_NAME">
      <Value>$(INTEROP_NATIVE_NAME)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_MIXED_NAME">
      <Value>$(INTEROP_MIXED_NAME)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
  </ItemGroup>
</Project>

Added SQLite.Interop/props/SQLite.Interop.2013.props.













































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.2013.props -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
  <PropertyGroup Label="UserMacros">
    <ConfigurationYear>2013</ConfigurationYear>
    <INTEROP_BUILD_NUMBER>119</INTEROP_BUILD_NUMBER>
    <INTEROP_LINKER_VERSION>1.0</INTEROP_LINKER_VERSION>
    <INTEROP_MANIFEST_VERSION>1.0.119.0</INTEROP_MANIFEST_VERSION>
    <INTEROP_RC_VERSION>1,0,119,0</INTEROP_RC_VERSION>
    <INTEROP_INCLUDE_DIRECTORIES>src\core</INTEROP_INCLUDE_DIRECTORIES>
    <INTEROP_LIBRARY_DIRECTORIES></INTEROP_LIBRARY_DIRECTORIES>
    <INTEROP_LIBRARY_DEPENDENCIES></INTEROP_LIBRARY_DEPENDENCIES>
    <INTEROP_DEBUG_DEFINES>INTEROP_DEBUG=0x200;INTEROP_LOG=1;INTEROP_TEST_EXTENSION=1</INTEROP_DEBUG_DEFINES>
    <INTEROP_EXTRA_DEFINES>INTEROP_PLACEHOLDER=1;INTEROP_EXTENSION_FUNCTIONS=1;INTEROP_VIRTUAL_TABLE=1;INTEROP_FTS5_EXTENSION=1;INTEROP_PERCENTILE_EXTENSION=1;INTEROP_TOTYPE_EXTENSION=1;INTEROP_REGEXP_EXTENSION=1;INTEROP_JSON1_EXTENSION=1;INTEROP_SHA1_EXTENSION=1;INTEROP_SHA3_EXTENSION=1;INTEROP_SESSION_EXTENSION=1</INTEROP_EXTRA_DEFINES>
    <INTEROP_RESOURCE_DEFINES>INTEROP_RESOURCE_PLACEHOLDER=1</INTEROP_RESOURCE_DEFINES>
    <INTEROP_ASSEMBLY_RESOURCES>/ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteCommand.bmp,System.Data.SQLite.SQLiteCommand.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteConnection.bmp,System.Data.SQLite.SQLiteConnection.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteDataAdapter.bmp,System.Data.SQLite.SQLiteDataAdapter.bmp</INTEROP_ASSEMBLY_RESOURCES>
    <INTEROP_KEY_FILE>$(ProjectDir)..\Keys\System.Data.SQLite.snk</INTEROP_KEY_FILE>
    <INTEROP_NATIVE_NAME>SQLite.Interop</INTEROP_NATIVE_NAME>
    <INTEROP_MIXED_NAME>System.Data.SQLite</INTEROP_MIXED_NAME>
  </PropertyGroup>
  <ItemGroup>
    <BuildMacro Include="ConfigurationYear">
      <Value>$(ConfigurationYear)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_BUILD_NUMBER">
      <Value>$(INTEROP_BUILD_NUMBER)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_LINKER_VERSION">
      <Value>$(INTEROP_LINKER_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_MANIFEST_VERSION">
      <Value>$(INTEROP_MANIFEST_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_RC_VERSION">
      <Value>$(INTEROP_RC_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_INCLUDE_DIRECTORIES">
      <Value>$(INTEROP_INCLUDE_DIRECTORIES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_LIBRARY_DIRECTORIES">
      <Value>$(INTEROP_LIBRARY_DIRECTORIES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_LIBRARY_DEPENDENCIES">
      <Value>$(INTEROP_LIBRARY_DEPENDENCIES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_DEBUG_DEFINES">
      <Value>$(INTEROP_DEBUG_DEFINES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_EXTRA_DEFINES">
      <Value>$(INTEROP_EXTRA_DEFINES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_ASSEMBLY_RESOURCES">
      <Value>$(INTEROP_ASSEMBLY_RESOURCES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_KEY_FILE">
      <Value>$(INTEROP_KEY_FILE)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_NATIVE_NAME">
      <Value>$(INTEROP_NATIVE_NAME)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_MIXED_NAME">
      <Value>$(INTEROP_MIXED_NAME)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
  </ItemGroup>
</Project>

Added SQLite.Interop/props/SQLite.Interop.2015.props.













































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.2015.props -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
  <PropertyGroup Label="UserMacros">
    <ConfigurationYear>2015</ConfigurationYear>
    <INTEROP_BUILD_NUMBER>119</INTEROP_BUILD_NUMBER>
    <INTEROP_LINKER_VERSION>1.0</INTEROP_LINKER_VERSION>
    <INTEROP_MANIFEST_VERSION>1.0.119.0</INTEROP_MANIFEST_VERSION>
    <INTEROP_RC_VERSION>1,0,119,0</INTEROP_RC_VERSION>
    <INTEROP_INCLUDE_DIRECTORIES>src\core</INTEROP_INCLUDE_DIRECTORIES>
    <INTEROP_LIBRARY_DIRECTORIES></INTEROP_LIBRARY_DIRECTORIES>
    <INTEROP_LIBRARY_DEPENDENCIES></INTEROP_LIBRARY_DEPENDENCIES>
    <INTEROP_DEBUG_DEFINES>INTEROP_DEBUG=0x200;INTEROP_LOG=1;INTEROP_TEST_EXTENSION=1</INTEROP_DEBUG_DEFINES>
    <INTEROP_EXTRA_DEFINES>INTEROP_PLACEHOLDER=1;INTEROP_EXTENSION_FUNCTIONS=1;INTEROP_VIRTUAL_TABLE=1;INTEROP_FTS5_EXTENSION=1;INTEROP_PERCENTILE_EXTENSION=1;INTEROP_TOTYPE_EXTENSION=1;INTEROP_REGEXP_EXTENSION=1;INTEROP_JSON1_EXTENSION=1;INTEROP_SHA1_EXTENSION=1;INTEROP_SHA3_EXTENSION=1;INTEROP_SESSION_EXTENSION=1</INTEROP_EXTRA_DEFINES>
    <INTEROP_RESOURCE_DEFINES>INTEROP_RESOURCE_PLACEHOLDER=1</INTEROP_RESOURCE_DEFINES>
    <INTEROP_ASSEMBLY_RESOURCES>/ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteCommand.bmp,System.Data.SQLite.SQLiteCommand.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteConnection.bmp,System.Data.SQLite.SQLiteConnection.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteDataAdapter.bmp,System.Data.SQLite.SQLiteDataAdapter.bmp</INTEROP_ASSEMBLY_RESOURCES>
    <INTEROP_KEY_FILE>$(ProjectDir)..\Keys\System.Data.SQLite.snk</INTEROP_KEY_FILE>
    <INTEROP_NATIVE_NAME>SQLite.Interop</INTEROP_NATIVE_NAME>
    <INTEROP_MIXED_NAME>System.Data.SQLite</INTEROP_MIXED_NAME>
  </PropertyGroup>
  <ItemGroup>
    <BuildMacro Include="ConfigurationYear">
      <Value>$(ConfigurationYear)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_BUILD_NUMBER">
      <Value>$(INTEROP_BUILD_NUMBER)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_LINKER_VERSION">
      <Value>$(INTEROP_LINKER_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_MANIFEST_VERSION">
      <Value>$(INTEROP_MANIFEST_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_RC_VERSION">
      <Value>$(INTEROP_RC_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_INCLUDE_DIRECTORIES">
      <Value>$(INTEROP_INCLUDE_DIRECTORIES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_LIBRARY_DIRECTORIES">
      <Value>$(INTEROP_LIBRARY_DIRECTORIES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_LIBRARY_DEPENDENCIES">
      <Value>$(INTEROP_LIBRARY_DEPENDENCIES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_DEBUG_DEFINES">
      <Value>$(INTEROP_DEBUG_DEFINES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_EXTRA_DEFINES">
      <Value>$(INTEROP_EXTRA_DEFINES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_ASSEMBLY_RESOURCES">
      <Value>$(INTEROP_ASSEMBLY_RESOURCES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_KEY_FILE">
      <Value>$(INTEROP_KEY_FILE)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_NATIVE_NAME">
      <Value>$(INTEROP_NATIVE_NAME)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_MIXED_NAME">
      <Value>$(INTEROP_MIXED_NAME)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
  </ItemGroup>
</Project>

Added SQLite.Interop/props/SQLite.Interop.2017.props.













































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * SQLite.Interop.2017.props -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup Label="UserMacros">
    <ConfigurationYear>2017</ConfigurationYear>
    <INTEROP_BUILD_NUMBER>119</INTEROP_BUILD_NUMBER>
    <INTEROP_LINKER_VERSION>1.0</INTEROP_LINKER_VERSION>
    <INTEROP_MANIFEST_VERSION>1.0.119.0</INTEROP_MANIFEST_VERSION>
    <INTEROP_RC_VERSION>1,0,119,0</INTEROP_RC_VERSION>
    <INTEROP_INCLUDE_DIRECTORIES>src\core</INTEROP_INCLUDE_DIRECTORIES>
    <INTEROP_LIBRARY_DIRECTORIES></INTEROP_LIBRARY_DIRECTORIES>
    <INTEROP_LIBRARY_DEPENDENCIES></INTEROP_LIBRARY_DEPENDENCIES>
    <INTEROP_DEBUG_DEFINES>INTEROP_DEBUG=0x200;INTEROP_LOG=1;INTEROP_TEST_EXTENSION=1</INTEROP_DEBUG_DEFINES>
    <INTEROP_EXTRA_DEFINES>INTEROP_PLACEHOLDER=1;INTEROP_EXTENSION_FUNCTIONS=1;INTEROP_VIRTUAL_TABLE=1;INTEROP_FTS5_EXTENSION=1;INTEROP_PERCENTILE_EXTENSION=1;INTEROP_TOTYPE_EXTENSION=1;INTEROP_REGEXP_EXTENSION=1;INTEROP_JSON1_EXTENSION=1;INTEROP_SHA1_EXTENSION=1;INTEROP_SHA3_EXTENSION=1;INTEROP_SESSION_EXTENSION=1</INTEROP_EXTRA_DEFINES>
    <INTEROP_RESOURCE_DEFINES>INTEROP_RESOURCE_PLACEHOLDER=1</INTEROP_RESOURCE_DEFINES>
    <INTEROP_ASSEMBLY_RESOURCES>/ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteCommand.bmp,System.Data.SQLite.SQLiteCommand.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteConnection.bmp,System.Data.SQLite.SQLiteConnection.bmp /ASSEMBLYRESOURCE:..\System.Data.SQLite\Resources\SQLiteDataAdapter.bmp,System.Data.SQLite.SQLiteDataAdapter.bmp</INTEROP_ASSEMBLY_RESOURCES>
    <INTEROP_KEY_FILE>$(ProjectDir)..\Keys\System.Data.SQLite.snk</INTEROP_KEY_FILE>
    <INTEROP_NATIVE_NAME>SQLite.Interop</INTEROP_NATIVE_NAME>
    <INTEROP_MIXED_NAME>System.Data.SQLite</INTEROP_MIXED_NAME>
  </PropertyGroup>
  <ItemGroup>
    <BuildMacro Include="ConfigurationYear">
      <Value>$(ConfigurationYear)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_BUILD_NUMBER">
      <Value>$(INTEROP_BUILD_NUMBER)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_LINKER_VERSION">
      <Value>$(INTEROP_LINKER_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_MANIFEST_VERSION">
      <Value>$(INTEROP_MANIFEST_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_RC_VERSION">
      <Value>$(INTEROP_RC_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_INCLUDE_DIRECTORIES">
      <Value>$(INTEROP_INCLUDE_DIRECTORIES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_LIBRARY_DIRECTORIES">
      <Value>$(INTEROP_LIBRARY_DIRECTORIES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_LIBRARY_DEPENDENCIES">
      <Value>$(INTEROP_LIBRARY_DEPENDENCIES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_DEBUG_DEFINES">
      <Value>$(INTEROP_DEBUG_DEFINES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_EXTRA_DEFINES">
      <Value>$(INTEROP_EXTRA_DEFINES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_ASSEMBLY_RESOURCES">
      <Value>$(INTEROP_ASSEMBLY_RESOURCES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_KEY_FILE">
      <Value>$(INTEROP_KEY_FILE)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_NATIVE_NAME">
      <Value>$(INTEROP_NATIVE_NAME)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="INTEROP_MIXED_NAME">
      <Value>$(INTEROP_MIXED_NAME)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
  </ItemGroup>
</Project>

Added SQLite.Interop/props/empty.vsprops.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="Windows-1252"?>
<!--
 *
 * empty.vsprops -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<VisualStudioPropertySheet
	ProjectType="Visual C++"
	Version="8.00"
	Name="empty"
	>
</VisualStudioPropertySheet>

Added SQLite.Interop/props/include.vsprops.

































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?xml version="1.0" encoding="Windows-1252"?>
<!--
 *
 * include.vsprops -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<VisualStudioPropertySheet
	ProjectType="Visual C++"
	Version="8.00"
	Name="include"
	InheritedPropertySheets=""
	>
  <!--
      NOTE: The value of the "InheritedPropertySheets" attribute (above)
            should actually be "$(INTEROP_EXTRA_PROPS_FILE)".

            Unfortunately, due to how Visual Studio 2005/2008 parses the
            "InheritedPropertySheets" attribute value, it cannot be set to
            "$(INTEROP_EXTRA_PROPS_FILE)" when the referenced macro should
            expand to an empty string.

            If a custom Visual Studio properties file is needed, the value
            of the "InheritedPropertySheets" attribute (above) should be
            manually changed to "$(INTEROP_EXTRA_PROPS_FILE)".  In addition,
            the "INTEROP_EXTRA_PROPS_FILE" environment variable should be set
            to the fully qualified file name of the Visual Studio properties
            file to include.
  -->
</VisualStudioPropertySheet>

Added SQLite.Interop/props/sqlite3.props.



































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * sqlite3.props -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup Label="UserMacros">
    <SQLITE_MANIFEST_VERSION>3.45.3.0</SQLITE_MANIFEST_VERSION>
    <SQLITE_RC_VERSION>3,45,3,0</SQLITE_RC_VERSION>
    <SQLITE_COMMON_DEFINES>_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;HAVE_LOG2=0;SQLITE_THREADSAFE=1;SQLITE_USE_URI=1;SQLITE_ENABLE_COLUMN_METADATA=1;SQLITE_ENABLE_STAT4=1;SQLITE_ENABLE_FTS3=1;SQLITE_ENABLE_LOAD_EXTENSION=1;SQLITE_ENABLE_RTREE=1;SQLITE_SOUNDEX=1;SQLITE_ENABLE_MEMORY_MANAGEMENT=1;SQLITE_ENABLE_API_ARMOR=1;SQLITE_ENABLE_DBSTAT_VTAB=1;SQLITE_ENABLE_STMTVTAB=1;SQLITE_ENABLE_UPDATE_DELETE_LIMIT=1;SQLITE_ENABLE_MATH_FUNCTIONS=1;SQLITE_ENABLE_DBPAGE_VTAB=1</SQLITE_COMMON_DEFINES>
    <SQLITE_EXTRA_DEFINES>SQLITE_PLACEHOLDER=1</SQLITE_EXTRA_DEFINES>
    <SQLITE_WINCE_200X_DEFINES>SQLITE_OMIT_WAL=1;FILENAME_MAX=260</SQLITE_WINCE_200X_DEFINES>
    <SQLITE_WINCE_2013_DEFINES>HAVE_ERRNO_H=1;SQLITE_MSVC_LOCALTIME_API=1</SQLITE_WINCE_2013_DEFINES>
    <SQLITE_DEBUG_DEFINES>SQLITE_DEBUG=1;SQLITE_MEMDEBUG=1;SQLITE_ENABLE_EXPENSIVE_ASSERT=1</SQLITE_DEBUG_DEFINES>
    <SQLITE_RELEASE_DEFINES>SQLITE_WIN32_MALLOC=1</SQLITE_RELEASE_DEFINES>
    <SQLITE_DISABLE_WARNINGS>4055;4100;4127;4146;4210;4232;4244;4245;4267;4306;4389;4701;4703;4706</SQLITE_DISABLE_WARNINGS>
    <SQLITE_DISABLE_X64_WARNINGS></SQLITE_DISABLE_X64_WARNINGS>
  </PropertyGroup>
  <ItemGroup>
    <BuildMacro Include="SQLITE_MANIFEST_VERSION">
      <Value>$(SQLITE_MANIFEST_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="SQLITE_RC_VERSION">
      <Value>$(SQLITE_RC_VERSION)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="SQLITE_COMMON_DEFINES">
      <Value>$(SQLITE_COMMON_DEFINES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="SQLITE_EXTRA_DEFINES">
      <Value>$(SQLITE_EXTRA_DEFINES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="SQLITE_WINCE_200X_DEFINES">
      <Value>$(SQLITE_WINCE_200X_DEFINES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="SQLITE_WINCE_2013_DEFINES">
      <Value>$(SQLITE_WINCE_2013_DEFINES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="SQLITE_DEBUG_DEFINES">
      <Value>$(SQLITE_DEBUG_DEFINES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="SQLITE_RELEASE_DEFINES">
      <Value>$(SQLITE_RELEASE_DEFINES)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="SQLITE_DISABLE_WARNINGS">
      <Value>$(SQLITE_DISABLE_WARNINGS)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
    <BuildMacro Include="SQLITE_DISABLE_X64_WARNINGS">
      <Value>$(SQLITE_DISABLE_X64_WARNINGS)</Value>
      <EnvironmentVariable>true</EnvironmentVariable>
    </BuildMacro>
  </ItemGroup>
</Project>

Added SQLite.Interop/props/sqlite3.vsprops.



































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?xml version="1.0" encoding="Windows-1252"?>
<!--
 *
 * sqlite3.vsprops -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<VisualStudioPropertySheet
	ProjectType="Visual C++"
	Version="8.00"
	Name="sqlite3"
	>
	<UserMacro
		Name="SQLITE_MANIFEST_VERSION"
		Value="3.45.3.0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="SQLITE_RC_VERSION"
		Value="3,45,3,0"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="SQLITE_COMMON_DEFINES"
		Value="_CRT_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_NONSTDC_NO_WARNINGS;HAVE_LOG2=0;SQLITE_THREADSAFE=1;SQLITE_USE_URI=1;SQLITE_ENABLE_COLUMN_METADATA=1;SQLITE_ENABLE_STAT4=1;SQLITE_ENABLE_FTS3=1;SQLITE_ENABLE_LOAD_EXTENSION=1;SQLITE_ENABLE_RTREE=1;SQLITE_SOUNDEX=1;SQLITE_ENABLE_MEMORY_MANAGEMENT=1;SQLITE_ENABLE_API_ARMOR=1;SQLITE_ENABLE_DBSTAT_VTAB=1;SQLITE_ENABLE_STMTVTAB=1;SQLITE_ENABLE_UPDATE_DELETE_LIMIT=1;SQLITE_ENABLE_MATH_FUNCTIONS=1;SQLITE_ENABLE_DBPAGE_VTAB=1"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="SQLITE_EXTRA_DEFINES"
		Value="SQLITE_PLACEHOLDER=1"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="SQLITE_WINCE_200X_DEFINES"
		Value="SQLITE_OMIT_WAL=1;FILENAME_MAX=260"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="SQLITE_WINCE_2013_DEFINES"
		Value="HAVE_ERRNO_H=1;SQLITE_MSVC_LOCALTIME_API=1"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="SQLITE_DEBUG_DEFINES"
		Value="SQLITE_DEBUG=1;SQLITE_MEMDEBUG=1;SQLITE_ENABLE_EXPENSIVE_ASSERT=1"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="SQLITE_RELEASE_DEFINES"
		Value="SQLITE_WIN32_MALLOC=1"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="SQLITE_DISABLE_WARNINGS"
		Value="4055;4100;4127;4146;4210;4232;4244;4245;4267;4306;4389;4701;4703;4706"
		PerformEnvironmentSet="true"
	/>
	<UserMacro
		Name="SQLITE_DISABLE_X64_WARNINGS"
		Value=""
		PerformEnvironmentSet="true"
	/>
</VisualStudioPropertySheet>

Deleted SQLite.Interop/resource.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by SQLite.Interop.rc

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        101
#define _APS_NEXT_COMMAND_VALUE         40001
#define _APS_NEXT_CONTROL_VALUE         1001
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























Deleted SQLite.Interop/splitsource/alter.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
/*
** 2005 February 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that used to generate VDBE code
** that implements the ALTER TABLE command.
**
** $Id: alter.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** The code in this file only exists if we are not omitting the
** ALTER TABLE logic from the build.
*/
#ifndef SQLITE_OMIT_ALTERTABLE


/*
** This function is used by SQL generated to implement the 
** ALTER TABLE command. The first argument is the text of a CREATE TABLE or
** CREATE INDEX command. The second is a table name. The table name in 
** the CREATE TABLE or CREATE INDEX statement is replaced with the third
** argument and the result returned. Examples:
**
** sqlite_rename_table('CREATE TABLE abc(a, b, c)', 'def')
**     -> 'CREATE TABLE def(a, b, c)'
**
** sqlite_rename_table('CREATE INDEX i ON abc(a)', 'def')
**     -> 'CREATE INDEX i ON def(a, b, c)'
*/
static void renameTableFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  unsigned char const *zSql = sqlite3_value_text(argv[0]);
  unsigned char const *zTableName = sqlite3_value_text(argv[1]);

  int token;
  Token tname;
  unsigned char const *zCsr = zSql;
  int len = 0;
  char *zRet;

  sqlite3 *db = sqlite3_context_db_handle(context);

  /* The principle used to locate the table name in the CREATE TABLE 
  ** statement is that the table name is the first non-space token that
  ** is immediately followed by a TK_LP or TK_USING token.
  */
  if( zSql ){
    do {
      if( !*zCsr ){
        /* Ran out of input before finding an opening bracket. Return NULL. */
        return;
      }

      /* Store the token that zCsr points to in tname. */
      tname.z = zCsr;
      tname.n = len;

      /* Advance zCsr to the next token. Store that token type in 'token',
      ** and its length in 'len' (to be used next iteration of this loop).
      */
      do {
        zCsr += len;
        len = sqlite3GetToken(zCsr, &token);
      } while( token==TK_SPACE || token==TK_COMMENT );
      assert( len>0 );
    } while( token!=TK_LP && token!=TK_USING );

    zRet = sqlite3MPrintf(db, "%.*s\"%w\"%s", tname.z - zSql, zSql, 
       zTableName, tname.z+tname.n);
    sqlite3_result_text(context, zRet, -1, SQLITE_DYNAMIC);
  }
}

#ifndef SQLITE_OMIT_TRIGGER
/* This function is used by SQL generated to implement the
** ALTER TABLE command. The first argument is the text of a CREATE TRIGGER 
** statement. The second is a table name. The table name in the CREATE 
** TRIGGER statement is replaced with the third argument and the result 
** returned. This is analagous to renameTableFunc() above, except for CREATE
** TRIGGER, not CREATE INDEX and CREATE TABLE.
*/
static void renameTriggerFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  unsigned char const *zSql = sqlite3_value_text(argv[0]);
  unsigned char const *zTableName = sqlite3_value_text(argv[1]);

  int token;
  Token tname;
  int dist = 3;
  unsigned char const *zCsr = zSql;
  int len = 0;
  char *zRet;

  sqlite3 *db = sqlite3_context_db_handle(context);

  /* The principle used to locate the table name in the CREATE TRIGGER 
  ** statement is that the table name is the first token that is immediatedly
  ** preceded by either TK_ON or TK_DOT and immediatedly followed by one
  ** of TK_WHEN, TK_BEGIN or TK_FOR.
  */
  if( zSql ){
    do {

      if( !*zCsr ){
        /* Ran out of input before finding the table name. Return NULL. */
        return;
      }

      /* Store the token that zCsr points to in tname. */
      tname.z = zCsr;
      tname.n = len;

      /* Advance zCsr to the next token. Store that token type in 'token',
      ** and its length in 'len' (to be used next iteration of this loop).
      */
      do {
        zCsr += len;
        len = sqlite3GetToken(zCsr, &token);
      }while( token==TK_SPACE );
      assert( len>0 );

      /* Variable 'dist' stores the number of tokens read since the most
      ** recent TK_DOT or TK_ON. This means that when a WHEN, FOR or BEGIN 
      ** token is read and 'dist' equals 2, the condition stated above
      ** to be met.
      **
      ** Note that ON cannot be a database, table or column name, so
      ** there is no need to worry about syntax like 
      ** "CREATE TRIGGER ... ON ON.ON BEGIN ..." etc.
      */
      dist++;
      if( token==TK_DOT || token==TK_ON ){
        dist = 0;
      }
    } while( dist!=2 || (token!=TK_WHEN && token!=TK_FOR && token!=TK_BEGIN) );

    /* Variable tname now contains the token that is the old table-name
    ** in the CREATE TRIGGER statement.
    */
    zRet = sqlite3MPrintf(db, "%.*s\"%w\"%s", tname.z - zSql, zSql, 
       zTableName, tname.z+tname.n);
    sqlite3_result_text(context, zRet, -1, SQLITE_DYNAMIC);
  }
}
#endif   /* !SQLITE_OMIT_TRIGGER */

/*
** Register built-in functions used to help implement ALTER TABLE
*/
void sqlite3AlterFunctions(sqlite3 *db){
  sqlite3CreateFunc(db, "sqlite_rename_table", 2, SQLITE_UTF8, 0,
                         renameTableFunc, 0, 0);
#ifndef SQLITE_OMIT_TRIGGER
  sqlite3CreateFunc(db, "sqlite_rename_trigger", 2, SQLITE_UTF8, 0,
                         renameTriggerFunc, 0, 0);
#endif
}

/*
** Generate the text of a WHERE expression which can be used to select all
** temporary triggers on table pTab from the sqlite_temp_master table. If
** table pTab has no temporary triggers, or is itself stored in the 
** temporary database, NULL is returned.
*/
static char *whereTempTriggers(Parse *pParse, Table *pTab){
  Trigger *pTrig;
  char *zWhere = 0;
  char *tmp = 0;
  const Schema *pTempSchema = pParse->db->aDb[1].pSchema; /* Temp db schema */

  /* If the table is not located in the temp-db (in which case NULL is 
  ** returned, loop through the tables list of triggers. For each trigger
  ** that is not part of the temp-db schema, add a clause to the WHERE 
  ** expression being built up in zWhere.
  */
  if( pTab->pSchema!=pTempSchema ){
    sqlite3 *db = pParse->db;
    for( pTrig=pTab->pTrigger; pTrig; pTrig=pTrig->pNext ){
      if( pTrig->pSchema==pTempSchema ){
        if( !zWhere ){
          zWhere = sqlite3MPrintf(db, "name=%Q", pTrig->name);
        }else{
          tmp = zWhere;
          zWhere = sqlite3MPrintf(db, "%s OR name=%Q", zWhere, pTrig->name);
          sqlite3DbFree(db, tmp);
        }
      }
    }
  }
  return zWhere;
}

/*
** Generate code to drop and reload the internal representation of table
** pTab from the database, including triggers and temporary triggers.
** Argument zName is the name of the table in the database schema at
** the time the generated code is executed. This can be different from
** pTab->zName if this function is being called to code part of an 
** "ALTER TABLE RENAME TO" statement.
*/
static void reloadTableSchema(Parse *pParse, Table *pTab, const char *zName){
  Vdbe *v;
  char *zWhere;
  int iDb;                   /* Index of database containing pTab */
#ifndef SQLITE_OMIT_TRIGGER
  Trigger *pTrig;
#endif

  v = sqlite3GetVdbe(pParse);
  if( !v ) return;
  assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );
  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
  assert( iDb>=0 );

#ifndef SQLITE_OMIT_TRIGGER
  /* Drop any table triggers from the internal schema. */
  for(pTrig=pTab->pTrigger; pTrig; pTrig=pTrig->pNext){
    int iTrigDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema);
    assert( iTrigDb==iDb || iTrigDb==1 );
    sqlite3VdbeAddOp4(v, OP_DropTrigger, iTrigDb, 0, 0, pTrig->name, 0);
  }
#endif

  /* Drop the table and index from the internal schema */
  sqlite3VdbeAddOp4(v, OP_DropTable, iDb, 0, 0, pTab->zName, 0);

  /* Reload the table, index and permanent trigger schemas. */
  zWhere = sqlite3MPrintf(pParse->db, "tbl_name=%Q", zName);
  if( !zWhere ) return;
  sqlite3VdbeAddOp4(v, OP_ParseSchema, iDb, 0, 0, zWhere, P4_DYNAMIC);

#ifndef SQLITE_OMIT_TRIGGER
  /* Now, if the table is not stored in the temp database, reload any temp 
  ** triggers. Don't use IN(...) in case SQLITE_OMIT_SUBQUERY is defined. 
  */
  if( (zWhere=whereTempTriggers(pParse, pTab))!=0 ){
    sqlite3VdbeAddOp4(v, OP_ParseSchema, 1, 0, 0, zWhere, P4_DYNAMIC);
  }
#endif
}

/*
** Generate code to implement the "ALTER TABLE xxx RENAME TO yyy" 
** command. 
*/
void sqlite3AlterRenameTable(
  Parse *pParse,            /* Parser context. */
  SrcList *pSrc,            /* The table to rename. */
  Token *pName              /* The new table name. */
){
  int iDb;                  /* Database that contains the table */
  char *zDb;                /* Name of database iDb */
  Table *pTab;              /* Table being renamed */
  char *zName = 0;          /* NULL-terminated version of pName */ 
  sqlite3 *db = pParse->db; /* Database connection */
  int nTabName;             /* Number of UTF-8 characters in zTabName */
  const char *zTabName;     /* Original name of the table */
  Vdbe *v;
#ifndef SQLITE_OMIT_TRIGGER
  char *zWhere = 0;         /* Where clause to locate temp triggers */
#endif
  int isVirtualRename = 0;  /* True if this is a v-table with an xRename() */
  
  if( db->mallocFailed ) goto exit_rename_table;
  assert( pSrc->nSrc==1 );
  assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );

  pTab = sqlite3LocateTable(pParse, 0, pSrc->a[0].zName, pSrc->a[0].zDatabase);
  if( !pTab ) goto exit_rename_table;
  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
  zDb = db->aDb[iDb].zName;

  /* Get a NULL terminated version of the new table name. */
  zName = sqlite3NameFromToken(db, pName);
  if( !zName ) goto exit_rename_table;

  /* Check that a table or index named 'zName' does not already exist
  ** in database iDb. If so, this is an error.
  */
  if( sqlite3FindTable(db, zName, zDb) || sqlite3FindIndex(db, zName, zDb) ){
    sqlite3ErrorMsg(pParse, 
        "there is already another table or index with this name: %s", zName);
    goto exit_rename_table;
  }

  /* Make sure it is not a system table being altered, or a reserved name
  ** that the table is being renamed to.
  */
  if( strlen(pTab->zName)>6 && 0==sqlite3StrNICmp(pTab->zName, "sqlite_", 7) ){
    sqlite3ErrorMsg(pParse, "table %s may not be altered", pTab->zName);
    goto exit_rename_table;
  }
  if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){
    goto exit_rename_table;
  }

#ifndef SQLITE_OMIT_VIEW
  if( pTab->pSelect ){
    sqlite3ErrorMsg(pParse, "view %s may not be altered", pTab->zName);
    goto exit_rename_table;
  }
#endif

#ifndef SQLITE_OMIT_AUTHORIZATION
  /* Invoke the authorization callback. */
  if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){
    goto exit_rename_table;
  }
#endif

#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( sqlite3ViewGetColumnNames(pParse, pTab) ){
    goto exit_rename_table;
  }
  if( IsVirtual(pTab) && pTab->pMod->pModule->xRename ){
    isVirtualRename = 1;
  }
#endif

  /* Begin a transaction and code the VerifyCookie for database iDb. 
  ** Then modify the schema cookie (since the ALTER TABLE modifies the
  ** schema). Open a statement transaction if the table is a virtual
  ** table.
  */
  v = sqlite3GetVdbe(pParse);
  if( v==0 ){
    goto exit_rename_table;
  }
  sqlite3BeginWriteOperation(pParse, isVirtualRename, iDb);
  sqlite3ChangeCookie(pParse, iDb);

  /* If this is a virtual table, invoke the xRename() function if
  ** one is defined. The xRename() callback will modify the names
  ** of any resources used by the v-table implementation (including other
  ** SQLite tables) that are identified by the name of the virtual table.
  */
#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( isVirtualRename ){
    int i = ++pParse->nMem;
    sqlite3VdbeAddOp4(v, OP_String8, 0, i, 0, zName, 0);
    sqlite3VdbeAddOp4(v, OP_VRename, i, 0, 0,(const char*)pTab->pVtab, P4_VTAB);
  }
#endif

  /* figure out how many UTF-8 characters are in zName */
  zTabName = pTab->zName;
  nTabName = sqlite3Utf8CharLen(zTabName, -1);

  /* Modify the sqlite_master table to use the new table name. */
  sqlite3NestedParse(pParse,
      "UPDATE %Q.%s SET "
#ifdef SQLITE_OMIT_TRIGGER
          "sql = sqlite_rename_table(sql, %Q), "
#else
          "sql = CASE "
            "WHEN type = 'trigger' THEN sqlite_rename_trigger(sql, %Q)"
            "ELSE sqlite_rename_table(sql, %Q) END, "
#endif
          "tbl_name = %Q, "
          "name = CASE "
            "WHEN type='table' THEN %Q "
            "WHEN name LIKE 'sqlite_autoindex%%' AND type='index' THEN "
             "'sqlite_autoindex_' || %Q || substr(name,%d+18) "
            "ELSE name END "
      "WHERE tbl_name=%Q AND "
          "(type='table' OR type='index' OR type='trigger');", 
      zDb, SCHEMA_TABLE(iDb), zName, zName, zName, 
#ifndef SQLITE_OMIT_TRIGGER
      zName,
#endif
      zName, nTabName, zTabName
  );

#ifndef SQLITE_OMIT_AUTOINCREMENT
  /* If the sqlite_sequence table exists in this database, then update 
  ** it with the new table name.
  */
  if( sqlite3FindTable(db, "sqlite_sequence", zDb) ){
    sqlite3NestedParse(pParse,
        "UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q",
        zDb, zName, pTab->zName);
  }
#endif

#ifndef SQLITE_OMIT_TRIGGER
  /* If there are TEMP triggers on this table, modify the sqlite_temp_master
  ** table. Don't do this if the table being ALTERed is itself located in
  ** the temp database.
  */
  if( (zWhere=whereTempTriggers(pParse, pTab))!=0 ){
    sqlite3NestedParse(pParse, 
        "UPDATE sqlite_temp_master SET "
            "sql = sqlite_rename_trigger(sql, %Q), "
            "tbl_name = %Q "
            "WHERE %s;", zName, zName, zWhere);
    sqlite3DbFree(db, zWhere);
  }
#endif

  /* Drop and reload the internal table schema. */
  reloadTableSchema(pParse, pTab, zName);

exit_rename_table:
  sqlite3SrcListDelete(db, pSrc);
  sqlite3DbFree(db, zName);
}


/*
** This function is called after an "ALTER TABLE ... ADD" statement
** has been parsed. Argument pColDef contains the text of the new
** column definition.
**
** The Table structure pParse->pNewTable was extended to include
** the new column during parsing.
*/
void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){
  Table *pNew;              /* Copy of pParse->pNewTable */
  Table *pTab;              /* Table being altered */
  int iDb;                  /* Database number */
  const char *zDb;          /* Database name */
  const char *zTab;         /* Table name */
  char *zCol;               /* Null-terminated column definition */
  Column *pCol;             /* The new column */
  Expr *pDflt;              /* Default value for the new column */
  sqlite3 *db;              /* The database connection; */

  if( pParse->nErr ) return;
  pNew = pParse->pNewTable;
  assert( pNew );

  db = pParse->db;
  assert( sqlite3BtreeHoldsAllMutexes(db) );
  iDb = sqlite3SchemaToIndex(db, pNew->pSchema);
  zDb = db->aDb[iDb].zName;
  zTab = pNew->zName;
  pCol = &pNew->aCol[pNew->nCol-1];
  pDflt = pCol->pDflt;
  pTab = sqlite3FindTable(db, zTab, zDb);
  assert( pTab );

#ifndef SQLITE_OMIT_AUTHORIZATION
  /* Invoke the authorization callback. */
  if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){
    return;
  }
#endif

  /* If the default value for the new column was specified with a 
  ** literal NULL, then set pDflt to 0. This simplifies checking
  ** for an SQL NULL default below.
  */
  if( pDflt && pDflt->op==TK_NULL ){
    pDflt = 0;
  }

  /* Check that the new column is not specified as PRIMARY KEY or UNIQUE.
  ** If there is a NOT NULL constraint, then the default value for the
  ** column must not be NULL.
  */
  if( pCol->isPrimKey ){
    sqlite3ErrorMsg(pParse, "Cannot add a PRIMARY KEY column");
    return;
  }
  if( pNew->pIndex ){
    sqlite3ErrorMsg(pParse, "Cannot add a UNIQUE column");
    return;
  }
  if( pCol->notNull && !pDflt ){
    sqlite3ErrorMsg(pParse, 
        "Cannot add a NOT NULL column with default value NULL");
    return;
  }

  /* Ensure the default expression is something that sqlite3ValueFromExpr()
  ** can handle (i.e. not CURRENT_TIME etc.)
  */
  if( pDflt ){
    sqlite3_value *pVal;
    if( sqlite3ValueFromExpr(db, pDflt, SQLITE_UTF8, SQLITE_AFF_NONE, &pVal) ){
      db->mallocFailed = 1;
      return;
    }
    if( !pVal ){
      sqlite3ErrorMsg(pParse, "Cannot add a column with non-constant default");
      return;
    }
    sqlite3ValueFree(pVal);
  }

  /* Modify the CREATE TABLE statement. */
  zCol = sqlite3DbStrNDup(db, (char*)pColDef->z, pColDef->n);
  if( zCol ){
    char *zEnd = &zCol[pColDef->n-1];
    while( (zEnd>zCol && *zEnd==';') || isspace(*(unsigned char *)zEnd) ){
      *zEnd-- = '\0';
    }
    sqlite3NestedParse(pParse, 
        "UPDATE \"%w\".%s SET "
          "sql = substr(sql,1,%d) || ', ' || %Q || substr(sql,%d) "
        "WHERE type = 'table' AND name = %Q", 
      zDb, SCHEMA_TABLE(iDb), pNew->addColOffset, zCol, pNew->addColOffset+1,
      zTab
    );
    sqlite3DbFree(db, zCol);
  }

  /* If the default value of the new column is NULL, then set the file
  ** format to 2. If the default value of the new column is not NULL,
  ** the file format becomes 3.
  */
  sqlite3MinimumFileFormat(pParse, iDb, pDflt ? 3 : 2);

  /* Reload the schema of the modified table. */
  reloadTableSchema(pParse, pTab, pTab->zName);
}

/*
** This function is called by the parser after the table-name in
** an "ALTER TABLE <table-name> ADD" statement is parsed. Argument 
** pSrc is the full-name of the table being altered.
**
** This routine makes a (partial) copy of the Table structure
** for the table being altered and sets Parse.pNewTable to point
** to it. Routines called by the parser as the column definition
** is parsed (i.e. sqlite3AddColumn()) add the new Column data to 
** the copy. The copy of the Table structure is deleted by tokenize.c 
** after parsing is finished.
**
** Routine sqlite3AlterFinishAddColumn() will be called to complete
** coding the "ALTER TABLE ... ADD" statement.
*/
void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){
  Table *pNew;
  Table *pTab;
  Vdbe *v;
  int iDb;
  int i;
  int nAlloc;
  sqlite3 *db = pParse->db;

  /* Look up the table being altered. */
  assert( pParse->pNewTable==0 );
  assert( sqlite3BtreeHoldsAllMutexes(db) );
  if( db->mallocFailed ) goto exit_begin_add_column;
  pTab = sqlite3LocateTable(pParse, 0, pSrc->a[0].zName, pSrc->a[0].zDatabase);
  if( !pTab ) goto exit_begin_add_column;

#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( IsVirtual(pTab) ){
    sqlite3ErrorMsg(pParse, "virtual tables may not be altered");
    goto exit_begin_add_column;
  }
#endif

  /* Make sure this is not an attempt to ALTER a view. */
  if( pTab->pSelect ){
    sqlite3ErrorMsg(pParse, "Cannot add a column to a view");
    goto exit_begin_add_column;
  }

  assert( pTab->addColOffset>0 );
  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);

  /* Put a copy of the Table struct in Parse.pNewTable for the
  ** sqlite3AddColumn() function and friends to modify.
  */
  pNew = (Table*)sqlite3DbMallocZero(db, sizeof(Table));
  if( !pNew ) goto exit_begin_add_column;
  pParse->pNewTable = pNew;
  pNew->nRef = 1;
  pNew->db = db;
  pNew->nCol = pTab->nCol;
  assert( pNew->nCol>0 );
  nAlloc = (((pNew->nCol-1)/8)*8)+8;
  assert( nAlloc>=pNew->nCol && nAlloc%8==0 && nAlloc-pNew->nCol<8 );
  pNew->aCol = (Column*)sqlite3DbMallocZero(db, sizeof(Column)*nAlloc);
  pNew->zName = sqlite3DbStrDup(db, pTab->zName);
  if( !pNew->aCol || !pNew->zName ){
    db->mallocFailed = 1;
    goto exit_begin_add_column;
  }
  memcpy(pNew->aCol, pTab->aCol, sizeof(Column)*pNew->nCol);
  for(i=0; i<pNew->nCol; i++){
    Column *pCol = &pNew->aCol[i];
    pCol->zName = sqlite3DbStrDup(db, pCol->zName);
    pCol->zColl = 0;
    pCol->zType = 0;
    pCol->pDflt = 0;
  }
  pNew->pSchema = db->aDb[iDb].pSchema;
  pNew->addColOffset = pTab->addColOffset;
  pNew->nRef = 1;

  /* Begin a transaction and increment the schema cookie.  */
  sqlite3BeginWriteOperation(pParse, 0, iDb);
  v = sqlite3GetVdbe(pParse);
  if( !v ) goto exit_begin_add_column;
  sqlite3ChangeCookie(pParse, iDb);

exit_begin_add_column:
  sqlite3SrcListDelete(db, pSrc);
  return;
}
#endif  /* SQLITE_ALTER_TABLE */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/analyze.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
/*
** 2005 July 8
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code associated with the ANALYZE command.
**
** @(#) $Id: analyze.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#ifndef SQLITE_OMIT_ANALYZE
#include "sqliteInt.h"

/*
** This routine generates code that opens the sqlite_stat1 table on cursor
** iStatCur.
**
** If the sqlite_stat1 tables does not previously exist, it is created.
** If it does previously exist, all entires associated with table zWhere
** are removed.  If zWhere==0 then all entries are removed.
*/
static void openStatTable(
  Parse *pParse,          /* Parsing context */
  int iDb,                /* The database we are looking in */
  int iStatCur,           /* Open the sqlite_stat1 table on this cursor */
  const char *zWhere      /* Delete entries associated with this table */
){
  sqlite3 *db = pParse->db;
  Db *pDb;
  int iRootPage;
  int createStat1 = 0;
  Table *pStat;
  Vdbe *v = sqlite3GetVdbe(pParse);

  if( v==0 ) return;
  assert( sqlite3BtreeHoldsAllMutexes(db) );
  assert( sqlite3VdbeDb(v)==db );
  pDb = &db->aDb[iDb];
  if( (pStat = sqlite3FindTable(db, "sqlite_stat1", pDb->zName))==0 ){
    /* The sqlite_stat1 tables does not exist.  Create it.  
    ** Note that a side-effect of the CREATE TABLE statement is to leave
    ** the rootpage of the new table in register pParse->regRoot.  This is
    ** important because the OpenWrite opcode below will be needing it. */
    sqlite3NestedParse(pParse,
      "CREATE TABLE %Q.sqlite_stat1(tbl,idx,stat)",
      pDb->zName
    );
    iRootPage = pParse->regRoot;
    createStat1 = 1;  /* Cause rootpage to be taken from top of stack */
  }else if( zWhere ){
    /* The sqlite_stat1 table exists.  Delete all entries associated with
    ** the table zWhere. */
    sqlite3NestedParse(pParse,
       "DELETE FROM %Q.sqlite_stat1 WHERE tbl=%Q",
       pDb->zName, zWhere
    );
    iRootPage = pStat->tnum;
  }else{
    /* The sqlite_stat1 table already exists.  Delete all rows. */
    iRootPage = pStat->tnum;
    sqlite3VdbeAddOp2(v, OP_Clear, pStat->tnum, iDb);
  }

  /* Open the sqlite_stat1 table for writing. Unless it was created
  ** by this vdbe program, lock it for writing at the shared-cache level. 
  ** If this vdbe did create the sqlite_stat1 table, then it must have 
  ** already obtained a schema-lock, making the write-lock redundant.
  */
  if( !createStat1 ){
    sqlite3TableLock(pParse, iDb, iRootPage, 1, "sqlite_stat1");
  }
  sqlite3VdbeAddOp2(v, OP_SetNumColumns, 0, 3);
  sqlite3VdbeAddOp3(v, OP_OpenWrite, iStatCur, iRootPage, iDb);
  sqlite3VdbeChangeP5(v, createStat1);
}

/*
** Generate code to do an analysis of all indices associated with
** a single table.
*/
static void analyzeOneTable(
  Parse *pParse,   /* Parser context */
  Table *pTab,     /* Table whose indices are to be analyzed */
  int iStatCur,    /* Cursor that writes to the sqlite_stat1 table */
  int iMem         /* Available memory locations begin here */
){
  Index *pIdx;     /* An index to being analyzed */
  int iIdxCur;     /* Cursor number for index being analyzed */
  int nCol;        /* Number of columns in the index */
  Vdbe *v;         /* The virtual machine being built up */
  int i;           /* Loop counter */
  int topOfLoop;   /* The top of the loop */
  int endOfLoop;   /* The end of the loop */
  int addr;        /* The address of an instruction */
  int iDb;         /* Index of database containing pTab */

  v = sqlite3GetVdbe(pParse);
  if( v==0 || pTab==0 || pTab->pIndex==0 ){
    /* Do no analysis for tables that have no indices */
    return;
  }
  assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );
  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
  assert( iDb>=0 );
#ifndef SQLITE_OMIT_AUTHORIZATION
  if( sqlite3AuthCheck(pParse, SQLITE_ANALYZE, pTab->zName, 0,
      pParse->db->aDb[iDb].zName ) ){
    return;
  }
#endif

  /* Establish a read-lock on the table at the shared-cache level. */
  sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);

  iIdxCur = pParse->nTab;
  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
    KeyInfo *pKey = sqlite3IndexKeyinfo(pParse, pIdx);
    int regFields;    /* Register block for building records */
    int regRec;       /* Register holding completed record */
    int regTemp;      /* Temporary use register */
    int regCol;       /* Content of a column from the table being analyzed */
    int regRowid;     /* Rowid for the inserted record */
    int regF2;

    /* Open a cursor to the index to be analyzed
    */
    assert( iDb==sqlite3SchemaToIndex(pParse->db, pIdx->pSchema) );
    nCol = pIdx->nColumn;
    sqlite3VdbeAddOp2(v, OP_SetNumColumns, 0, nCol+1);
    sqlite3VdbeAddOp4(v, OP_OpenRead, iIdxCur, pIdx->tnum, iDb,
        (char *)pKey, P4_KEYINFO_HANDOFF);
    VdbeComment((v, "%s", pIdx->zName));
    regFields = iMem+nCol*2;
    regTemp = regRowid = regCol = regFields+3;
    regRec = regCol+1;
    if( regRec>pParse->nMem ){
      pParse->nMem = regRec;
    }

    /* Memory cells are used as follows:
    **
    **    mem[iMem]:             The total number of rows in the table.
    **    mem[iMem+1]:           Number of distinct values in column 1
    **    ...
    **    mem[iMem+nCol]:        Number of distinct values in column N
    **    mem[iMem+nCol+1]       Last observed value of column 1
    **    ...
    **    mem[iMem+nCol+nCol]:   Last observed value of column N
    **
    ** Cells iMem through iMem+nCol are initialized to 0.  The others
    ** are initialized to NULL.
    */
    for(i=0; i<=nCol; i++){
      sqlite3VdbeAddOp2(v, OP_Integer, 0, iMem+i);
    }
    for(i=0; i<nCol; i++){
      sqlite3VdbeAddOp2(v, OP_Null, 0, iMem+nCol+i+1);
    }

    /* Do the analysis.
    */
    endOfLoop = sqlite3VdbeMakeLabel(v);
    sqlite3VdbeAddOp2(v, OP_Rewind, iIdxCur, endOfLoop);
    topOfLoop = sqlite3VdbeCurrentAddr(v);
    sqlite3VdbeAddOp2(v, OP_AddImm, iMem, 1);
    for(i=0; i<nCol; i++){
      sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, i, regCol);
      sqlite3VdbeAddOp3(v, OP_Ne, regCol, 0, iMem+nCol+i+1);
      /**** TODO:  add collating sequence *****/
      sqlite3VdbeChangeP5(v, SQLITE_JUMPIFNULL);
    }
    sqlite3VdbeAddOp2(v, OP_Goto, 0, endOfLoop);
    for(i=0; i<nCol; i++){
      sqlite3VdbeJumpHere(v, topOfLoop + 2*(i + 1));
      sqlite3VdbeAddOp2(v, OP_AddImm, iMem+i+1, 1);
      sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, i, iMem+nCol+i+1);
    }
    sqlite3VdbeResolveLabel(v, endOfLoop);
    sqlite3VdbeAddOp2(v, OP_Next, iIdxCur, topOfLoop);
    sqlite3VdbeAddOp1(v, OP_Close, iIdxCur);

    /* Store the results.  
    **
    ** The result is a single row of the sqlite_stat1 table.  The first
    ** two columns are the names of the table and index.  The third column
    ** is a string composed of a list of integer statistics about the
    ** index.  The first integer in the list is the total number of entires
    ** in the index.  There is one additional integer in the list for each
    ** column of the table.  This additional integer is a guess of how many
    ** rows of the table the index will select.  If D is the count of distinct
    ** values and K is the total number of rows, then the integer is computed
    ** as:
    **
    **        I = (K+D-1)/D
    **
    ** If K==0 then no entry is made into the sqlite_stat1 table.  
    ** If K>0 then it is always the case the D>0 so division by zero
    ** is never possible.
    */
    addr = sqlite3VdbeAddOp1(v, OP_IfNot, iMem);
    sqlite3VdbeAddOp4(v, OP_String8, 0, regFields, 0, pTab->zName, 0);
    sqlite3VdbeAddOp4(v, OP_String8, 0, regFields+1, 0, pIdx->zName, 0);
    regF2 = regFields+2;
    sqlite3VdbeAddOp2(v, OP_SCopy, iMem, regF2);
    for(i=0; i<nCol; i++){
      sqlite3VdbeAddOp4(v, OP_String8, 0, regTemp, 0, " ", 0);
      sqlite3VdbeAddOp3(v, OP_Concat, regTemp, regF2, regF2);
      sqlite3VdbeAddOp3(v, OP_Add, iMem, iMem+i+1, regTemp);
      sqlite3VdbeAddOp2(v, OP_AddImm, regTemp, -1);
      sqlite3VdbeAddOp3(v, OP_Divide, iMem+i+1, regTemp, regTemp);
      sqlite3VdbeAddOp1(v, OP_ToInt, regTemp);
      sqlite3VdbeAddOp3(v, OP_Concat, regTemp, regF2, regF2);
    }
    sqlite3VdbeAddOp4(v, OP_MakeRecord, regFields, 3, regRec, "aaa", 0);
    sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur, regRowid);
    sqlite3VdbeAddOp3(v, OP_Insert, iStatCur, regRec, regRowid);
    sqlite3VdbeChangeP5(v, OPFLAG_APPEND);
    sqlite3VdbeJumpHere(v, addr);
  }
}

/*
** Generate code that will cause the most recent index analysis to
** be laoded into internal hash tables where is can be used.
*/
static void loadAnalysis(Parse *pParse, int iDb){
  Vdbe *v = sqlite3GetVdbe(pParse);
  if( v ){
    sqlite3VdbeAddOp1(v, OP_LoadAnalysis, iDb);
  }
}

/*
** Generate code that will do an analysis of an entire database
*/
static void analyzeDatabase(Parse *pParse, int iDb){
  sqlite3 *db = pParse->db;
  Schema *pSchema = db->aDb[iDb].pSchema;    /* Schema of database iDb */
  HashElem *k;
  int iStatCur;
  int iMem;

  sqlite3BeginWriteOperation(pParse, 0, iDb);
  iStatCur = pParse->nTab++;
  openStatTable(pParse, iDb, iStatCur, 0);
  iMem = pParse->nMem+1;
  for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){
    Table *pTab = (Table*)sqliteHashData(k);
    analyzeOneTable(pParse, pTab, iStatCur, iMem);
  }
  loadAnalysis(pParse, iDb);
}

/*
** Generate code that will do an analysis of a single table in
** a database.
*/
static void analyzeTable(Parse *pParse, Table *pTab){
  int iDb;
  int iStatCur;

  assert( pTab!=0 );
  assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );
  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
  sqlite3BeginWriteOperation(pParse, 0, iDb);
  iStatCur = pParse->nTab++;
  openStatTable(pParse, iDb, iStatCur, pTab->zName);
  analyzeOneTable(pParse, pTab, iStatCur, pParse->nMem+1);
  loadAnalysis(pParse, iDb);
}

/*
** Generate code for the ANALYZE command.  The parser calls this routine
** when it recognizes an ANALYZE command.
**
**        ANALYZE                            -- 1
**        ANALYZE  <database>                -- 2
**        ANALYZE  ?<database>.?<tablename>  -- 3
**
** Form 1 causes all indices in all attached databases to be analyzed.
** Form 2 analyzes all indices the single database named.
** Form 3 analyzes all indices associated with the named table.
*/
void sqlite3Analyze(Parse *pParse, Token *pName1, Token *pName2){
  sqlite3 *db = pParse->db;
  int iDb;
  int i;
  char *z, *zDb;
  Table *pTab;
  Token *pTableName;

  /* Read the database schema. If an error occurs, leave an error message
  ** and code in pParse and return NULL. */
  assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );
  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
    return;
  }

  if( pName1==0 ){
    /* Form 1:  Analyze everything */
    for(i=0; i<db->nDb; i++){
      if( i==1 ) continue;  /* Do not analyze the TEMP database */
      analyzeDatabase(pParse, i);
    }
  }else if( pName2==0 || pName2->n==0 ){
    /* Form 2:  Analyze the database or table named */
    iDb = sqlite3FindDb(db, pName1);
    if( iDb>=0 ){
      analyzeDatabase(pParse, iDb);
    }else{
      z = sqlite3NameFromToken(db, pName1);
      if( z ){
        pTab = sqlite3LocateTable(pParse, 0, z, 0);
        sqlite3DbFree(db, z);
        if( pTab ){
          analyzeTable(pParse, pTab);
        }
      }
    }
  }else{
    /* Form 3: Analyze the fully qualified table name */
    iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pTableName);
    if( iDb>=0 ){
      zDb = db->aDb[iDb].zName;
      z = sqlite3NameFromToken(db, pTableName);
      if( z ){
        pTab = sqlite3LocateTable(pParse, 0, z, zDb);
        sqlite3DbFree(db, z);
        if( pTab ){
          analyzeTable(pParse, pTab);
        }
      }
    }   
  }
}

/*
** Used to pass information from the analyzer reader through to the
** callback routine.
*/
typedef struct analysisInfo analysisInfo;
struct analysisInfo {
  sqlite3 *db;
  const char *zDatabase;
};

/*
** This callback is invoked once for each index when reading the
** sqlite_stat1 table.  
**
**     argv[0] = name of the index
**     argv[1] = results of analysis - on integer for each column
*/
static int analysisLoader(void *pData, int argc, char **argv, char **azNotUsed){
  analysisInfo *pInfo = (analysisInfo*)pData;
  Index *pIndex;
  int i, c;
  unsigned int v;
  const char *z;

  assert( argc==2 );
  if( argv==0 || argv[0]==0 || argv[1]==0 ){
    return 0;
  }
  pIndex = sqlite3FindIndex(pInfo->db, argv[0], pInfo->zDatabase);
  if( pIndex==0 ){
    return 0;
  }
  z = argv[1];
  for(i=0; *z && i<=pIndex->nColumn; i++){
    v = 0;
    while( (c=z[0])>='0' && c<='9' ){
      v = v*10 + c - '0';
      z++;
    }
    pIndex->aiRowEst[i] = v;
    if( *z==' ' ) z++;
  }
  return 0;
}

/*
** Load the content of the sqlite_stat1 table into the index hash tables.
*/
int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
  analysisInfo sInfo;
  HashElem *i;
  char *zSql;
  int rc;

  assert( iDb>=0 && iDb<db->nDb );
  assert( db->aDb[iDb].pBt!=0 );
  assert( sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) );

  /* Clear any prior statistics */
  for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){
    Index *pIdx = sqliteHashData(i);
    sqlite3DefaultRowEst(pIdx);
  }

  /* Check to make sure the sqlite_stat1 table existss */
  sInfo.db = db;
  sInfo.zDatabase = db->aDb[iDb].zName;
  if( sqlite3FindTable(db, "sqlite_stat1", sInfo.zDatabase)==0 ){
     return SQLITE_ERROR;
  }


  /* Load new statistics out of the sqlite_stat1 table */
  zSql = sqlite3MPrintf(db, "SELECT idx, stat FROM %Q.sqlite_stat1",
                        sInfo.zDatabase);
  (void)sqlite3SafetyOff(db);
  rc = sqlite3_exec(db, zSql, analysisLoader, &sInfo, 0);
  (void)sqlite3SafetyOn(db);
  sqlite3DbFree(db, zSql);
  return rc;
}


#endif /* SQLITE_OMIT_ANALYZE */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/attach.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
/*
** 2003 April 6
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to implement the ATTACH and DETACH commands.
**
** $Id: attach.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"

#ifndef SQLITE_OMIT_ATTACH
/*
** Resolve an expression that was part of an ATTACH or DETACH statement. This
** is slightly different from resolving a normal SQL expression, because simple
** identifiers are treated as strings, not possible column names or aliases.
**
** i.e. if the parser sees:
**
**     ATTACH DATABASE abc AS def
**
** it treats the two expressions as literal strings 'abc' and 'def' instead of
** looking for columns of the same name.
**
** This only applies to the root node of pExpr, so the statement:
**
**     ATTACH DATABASE abc||def AS 'db2'
**
** will fail because neither abc or def can be resolved.
*/
static int resolveAttachExpr(NameContext *pName, Expr *pExpr)
{
  int rc = SQLITE_OK;
  if( pExpr ){
    if( pExpr->op!=TK_ID ){
      rc = sqlite3ExprResolveNames(pName, pExpr);
      if( rc==SQLITE_OK && !sqlite3ExprIsConstant(pExpr) ){
        sqlite3ErrorMsg(pName->pParse, "invalid name: \"%T\"", &pExpr->span);
        return SQLITE_ERROR;
      }
    }else{
      pExpr->op = TK_STRING;
    }
  }
  return rc;
}

/*
** An SQL user-function registered to do the work of an ATTACH statement. The
** three arguments to the function come directly from an attach statement:
**
**     ATTACH DATABASE x AS y KEY z
**
**     SELECT sqlite_attach(x, y, z)
**
** If the optional "KEY z" syntax is omitted, an SQL NULL is passed as the
** third argument.
*/
static void attachFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  int i;
  int rc = 0;
  sqlite3 *db = sqlite3_context_db_handle(context);
  const char *zName;
  const char *zFile;
  Db *aNew;
  char *zErrDyn = 0;
  char zErr[128];

  zFile = (const char *)sqlite3_value_text(argv[0]);
  zName = (const char *)sqlite3_value_text(argv[1]);
  if( zFile==0 ) zFile = "";
  if( zName==0 ) zName = "";

  /* Check for the following errors:
  **
  **     * Too many attached databases,
  **     * Transaction currently open
  **     * Specified database name already being used.
  */
  if( db->nDb>=db->aLimit[SQLITE_LIMIT_ATTACHED]+2 ){
    sqlite3_snprintf(
      sizeof(zErr), zErr, "too many attached databases - max %d", 
      db->aLimit[SQLITE_LIMIT_ATTACHED]
    );
    goto attach_error;
  }
  if( !db->autoCommit ){
    sqlite3_snprintf(sizeof(zErr), zErr,
                     "cannot ATTACH database within transaction");
    goto attach_error;
  }
  for(i=0; i<db->nDb; i++){
    char *z = db->aDb[i].zName;
    if( z && zName && sqlite3StrICmp(z, zName)==0 ){
      sqlite3_snprintf(sizeof(zErr), zErr, 
                       "database %s is already in use", zName);
      goto attach_error;
    }
  }

  /* Allocate the new entry in the db->aDb[] array and initialise the schema
  ** hash tables.
  */
  if( db->aDb==db->aDbStatic ){
    aNew = sqlite3DbMallocRaw(db, sizeof(db->aDb[0])*3 );
    if( aNew==0 ) return;
    memcpy(aNew, db->aDb, sizeof(db->aDb[0])*2);
  }else{
    aNew = sqlite3DbRealloc(db, db->aDb, sizeof(db->aDb[0])*(db->nDb+1) );
    if( aNew==0 ) return;
  }
  db->aDb = aNew;
  aNew = &db->aDb[db->nDb++];
  memset(aNew, 0, sizeof(*aNew));

  /* Open the database file. If the btree is successfully opened, use
  ** it to obtain the database schema. At this point the schema may
  ** or may not be initialised.
  */
  rc = sqlite3BtreeFactory(db, zFile, 0, SQLITE_DEFAULT_CACHE_SIZE,
                           db->openFlags | SQLITE_OPEN_MAIN_DB,
                           &aNew->pBt);
  if( rc==SQLITE_OK ){
    Pager *pPager;
    aNew->pSchema = sqlite3SchemaGet(db, aNew->pBt);
    if( !aNew->pSchema ){
      rc = SQLITE_NOMEM;
    }else if( aNew->pSchema->file_format && aNew->pSchema->enc!=ENC(db) ){
      sqlite3_snprintf(sizeof(zErr), zErr, 
        "attached databases must use the same text encoding as main database");
      goto attach_error;
    }
    pPager = sqlite3BtreePager(aNew->pBt);
    sqlite3PagerLockingMode(pPager, db->dfltLockMode);
    sqlite3PagerJournalMode(pPager, db->dfltJournalMode);
  }
  aNew->zName = sqlite3DbStrDup(db, zName);
  aNew->safety_level = 3;

#if SQLITE_HAS_CODEC
  {
    extern int sqlite3CodecAttach(sqlite3*, int, const void*, int);
    extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*);
    int nKey;
    char *zKey;
    int t = sqlite3_value_type(argv[2]);
    switch( t ){
      case SQLITE_INTEGER:
      case SQLITE_FLOAT:
        zErrDyn = sqlite3DbStrDup(db, "Invalid key value");
        rc = SQLITE_ERROR;
        break;
        
      case SQLITE_TEXT:
      case SQLITE_BLOB:
        nKey = sqlite3_value_bytes(argv[2]);
        zKey = (char *)sqlite3_value_blob(argv[2]);
        sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);
        break;

      case SQLITE_NULL:
        /* No key specified.  Use the key from the main database */
        sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey);
        sqlite3CodecAttach(db, db->nDb-1, zKey, nKey);
        break;
    }
  }
#endif

  /* If the file was opened successfully, read the schema for the new database.
  ** If this fails, or if opening the file failed, then close the file and 
  ** remove the entry from the db->aDb[] array. i.e. put everything back the way
  ** we found it.
  */
  if( rc==SQLITE_OK ){
    (void)sqlite3SafetyOn(db);
    sqlite3BtreeEnterAll(db);
    rc = sqlite3Init(db, &zErrDyn);
    sqlite3BtreeLeaveAll(db);
    (void)sqlite3SafetyOff(db);
  }
  if( rc ){
    int iDb = db->nDb - 1;
    assert( iDb>=2 );
    if( db->aDb[iDb].pBt ){
      sqlite3BtreeClose(db->aDb[iDb].pBt);
      db->aDb[iDb].pBt = 0;
      db->aDb[iDb].pSchema = 0;
    }
    sqlite3ResetInternalSchema(db, 0);
    db->nDb = iDb;
    if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){
      db->mallocFailed = 1;
      sqlite3_snprintf(sizeof(zErr),zErr, "out of memory");
    }else{
      sqlite3_snprintf(sizeof(zErr),zErr, "unable to open database: %s", zFile);
    }
    goto attach_error;
  }
  
  return;

attach_error:
  /* Return an error if we get here */
  if( zErrDyn ){
    sqlite3_result_error(context, zErrDyn, -1);
    sqlite3DbFree(db, zErrDyn);
  }else{
    zErr[sizeof(zErr)-1] = 0;
    sqlite3_result_error(context, zErr, -1);
  }
  if( rc ) sqlite3_result_error_code(context, rc);
}

/*
** An SQL user-function registered to do the work of an DETACH statement. The
** three arguments to the function come directly from a detach statement:
**
**     DETACH DATABASE x
**
**     SELECT sqlite_detach(x)
*/
static void detachFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  const char *zName = (const char *)sqlite3_value_text(argv[0]);
  sqlite3 *db = sqlite3_context_db_handle(context);
  int i;
  Db *pDb = 0;
  char zErr[128];

  if( zName==0 ) zName = "";
  for(i=0; i<db->nDb; i++){
    pDb = &db->aDb[i];
    if( pDb->pBt==0 ) continue;
    if( sqlite3StrICmp(pDb->zName, zName)==0 ) break;
  }

  if( i>=db->nDb ){
    sqlite3_snprintf(sizeof(zErr),zErr, "no such database: %s", zName);
    goto detach_error;
  }
  if( i<2 ){
    sqlite3_snprintf(sizeof(zErr),zErr, "cannot detach database %s", zName);
    goto detach_error;
  }
  if( !db->autoCommit ){
    sqlite3_snprintf(sizeof(zErr), zErr,
                     "cannot DETACH database within transaction");
    goto detach_error;
  }
  if( sqlite3BtreeIsInReadTrans(pDb->pBt) ){
    sqlite3_snprintf(sizeof(zErr),zErr, "database %s is locked", zName);
    goto detach_error;
  }

  sqlite3BtreeClose(pDb->pBt);
  pDb->pBt = 0;
  pDb->pSchema = 0;
  sqlite3ResetInternalSchema(db, 0);
  return;

detach_error:
  sqlite3_result_error(context, zErr, -1);
}

/*
** This procedure generates VDBE code for a single invocation of either the
** sqlite_detach() or sqlite_attach() SQL user functions.
*/
static void codeAttach(
  Parse *pParse,       /* The parser context */
  int type,            /* Either SQLITE_ATTACH or SQLITE_DETACH */
  const char *zFunc,   /* Either "sqlite_attach" or "sqlite_detach */
  int nFunc,           /* Number of args to pass to zFunc */
  Expr *pAuthArg,      /* Expression to pass to authorization callback */
  Expr *pFilename,     /* Name of database file */
  Expr *pDbname,       /* Name of the database to use internally */
  Expr *pKey           /* Database key for encryption extension */
){
  int rc;
  NameContext sName;
  Vdbe *v;
  FuncDef *pFunc;
  sqlite3* db = pParse->db;
  int regArgs;

#ifndef SQLITE_OMIT_AUTHORIZATION
  assert( db->mallocFailed || pAuthArg );
  if( pAuthArg ){
    char *zAuthArg = sqlite3NameFromToken(db, &pAuthArg->span);
    if( !zAuthArg ){
      goto attach_end;
    }
    rc = sqlite3AuthCheck(pParse, type, zAuthArg, 0, 0);
    sqlite3DbFree(db, zAuthArg);
    if(rc!=SQLITE_OK ){
      goto attach_end;
    }
  }
#endif /* SQLITE_OMIT_AUTHORIZATION */

  memset(&sName, 0, sizeof(NameContext));
  sName.pParse = pParse;

  if( 
      SQLITE_OK!=(rc = resolveAttachExpr(&sName, pFilename)) ||
      SQLITE_OK!=(rc = resolveAttachExpr(&sName, pDbname)) ||
      SQLITE_OK!=(rc = resolveAttachExpr(&sName, pKey))
  ){
    pParse->nErr++;
    goto attach_end;
  }

  v = sqlite3GetVdbe(pParse);
  regArgs = sqlite3GetTempRange(pParse, 4);
  sqlite3ExprCode(pParse, pFilename, regArgs);
  sqlite3ExprCode(pParse, pDbname, regArgs+1);
  sqlite3ExprCode(pParse, pKey, regArgs+2);

  assert( v || db->mallocFailed );
  if( v ){
    sqlite3VdbeAddOp3(v, OP_Function, 0, regArgs+3-nFunc, regArgs+3);
    sqlite3VdbeChangeP5(v, nFunc);
    pFunc = sqlite3FindFunction(db, zFunc, strlen(zFunc), nFunc, SQLITE_UTF8,0);
    sqlite3VdbeChangeP4(v, -1, (char *)pFunc, P4_FUNCDEF);

    /* Code an OP_Expire. For an ATTACH statement, set P1 to true (expire this
    ** statement only). For DETACH, set it to false (expire all existing
    ** statements).
    */
    sqlite3VdbeAddOp1(v, OP_Expire, (type==SQLITE_ATTACH));
  }
  
attach_end:
  sqlite3ExprDelete(db, pFilename);
  sqlite3ExprDelete(db, pDbname);
  sqlite3ExprDelete(db, pKey);
}

/*
** Called by the parser to compile a DETACH statement.
**
**     DETACH pDbname
*/
void sqlite3Detach(Parse *pParse, Expr *pDbname){
  codeAttach(pParse, SQLITE_DETACH, "sqlite_detach", 1, pDbname, 0, 0, pDbname);
}

/*
** Called by the parser to compile an ATTACH statement.
**
**     ATTACH p AS pDbname KEY pKey
*/
void sqlite3Attach(Parse *pParse, Expr *p, Expr *pDbname, Expr *pKey){
  codeAttach(pParse, SQLITE_ATTACH, "sqlite_attach", 3, p, p, pDbname, pKey);
}
#endif /* SQLITE_OMIT_ATTACH */

/*
** Register the functions sqlite_attach and sqlite_detach.
*/
void sqlite3AttachFunctions(sqlite3 *db){
#ifndef SQLITE_OMIT_ATTACH
  static const int enc = SQLITE_UTF8;
  sqlite3CreateFunc(db, "sqlite_attach", 3, enc, 0, attachFunc, 0, 0);
  sqlite3CreateFunc(db, "sqlite_detach", 1, enc, 0, detachFunc, 0, 0);
#endif
}

/*
** Initialize a DbFixer structure.  This routine must be called prior
** to passing the structure to one of the sqliteFixAAAA() routines below.
**
** The return value indicates whether or not fixation is required.  TRUE
** means we do need to fix the database references, FALSE means we do not.
*/
int sqlite3FixInit(
  DbFixer *pFix,      /* The fixer to be initialized */
  Parse *pParse,      /* Error messages will be written here */
  int iDb,            /* This is the database that must be used */
  const char *zType,  /* "view", "trigger", or "index" */
  const Token *pName  /* Name of the view, trigger, or index */
){
  sqlite3 *db;

  if( iDb<0 || iDb==1 ) return 0;
  db = pParse->db;
  assert( db->nDb>iDb );
  pFix->pParse = pParse;
  pFix->zDb = db->aDb[iDb].zName;
  pFix->zType = zType;
  pFix->pName = pName;
  return 1;
}

/*
** The following set of routines walk through the parse tree and assign
** a specific database to all table references where the database name
** was left unspecified in the original SQL statement.  The pFix structure
** must have been initialized by a prior call to sqlite3FixInit().
**
** These routines are used to make sure that an index, trigger, or
** view in one database does not refer to objects in a different database.
** (Exception: indices, triggers, and views in the TEMP database are
** allowed to refer to anything.)  If a reference is explicitly made
** to an object in a different database, an error message is added to
** pParse->zErrMsg and these routines return non-zero.  If everything
** checks out, these routines return 0.
*/
int sqlite3FixSrcList(
  DbFixer *pFix,       /* Context of the fixation */
  SrcList *pList       /* The Source list to check and modify */
){
  int i;
  const char *zDb;
  struct SrcList_item *pItem;

  if( pList==0 ) return 0;
  zDb = pFix->zDb;
  for(i=0, pItem=pList->a; i<pList->nSrc; i++, pItem++){
    if( pItem->zDatabase==0 ){
      pItem->zDatabase = sqlite3DbStrDup(pFix->pParse->db, zDb);
    }else if( sqlite3StrICmp(pItem->zDatabase,zDb)!=0 ){
      sqlite3ErrorMsg(pFix->pParse,
         "%s %T cannot reference objects in database %s",
         pFix->zType, pFix->pName, pItem->zDatabase);
      return 1;
    }
#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER)
    if( sqlite3FixSelect(pFix, pItem->pSelect) ) return 1;
    if( sqlite3FixExpr(pFix, pItem->pOn) ) return 1;
#endif
  }
  return 0;
}
#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER)
int sqlite3FixSelect(
  DbFixer *pFix,       /* Context of the fixation */
  Select *pSelect      /* The SELECT statement to be fixed to one database */
){
  while( pSelect ){
    if( sqlite3FixExprList(pFix, pSelect->pEList) ){
      return 1;
    }
    if( sqlite3FixSrcList(pFix, pSelect->pSrc) ){
      return 1;
    }
    if( sqlite3FixExpr(pFix, pSelect->pWhere) ){
      return 1;
    }
    if( sqlite3FixExpr(pFix, pSelect->pHaving) ){
      return 1;
    }
    pSelect = pSelect->pPrior;
  }
  return 0;
}
int sqlite3FixExpr(
  DbFixer *pFix,     /* Context of the fixation */
  Expr *pExpr        /* The expression to be fixed to one database */
){
  while( pExpr ){
    if( sqlite3FixSelect(pFix, pExpr->pSelect) ){
      return 1;
    }
    if( sqlite3FixExprList(pFix, pExpr->pList) ){
      return 1;
    }
    if( sqlite3FixExpr(pFix, pExpr->pRight) ){
      return 1;
    }
    pExpr = pExpr->pLeft;
  }
  return 0;
}
int sqlite3FixExprList(
  DbFixer *pFix,     /* Context of the fixation */
  ExprList *pList    /* The expression to be fixed to one database */
){
  int i;
  struct ExprList_item *pItem;
  if( pList==0 ) return 0;
  for(i=0, pItem=pList->a; i<pList->nExpr; i++, pItem++){
    if( sqlite3FixExpr(pFix, pItem->pExpr) ){
      return 1;
    }
  }
  return 0;
}
#endif

#ifndef SQLITE_OMIT_TRIGGER
int sqlite3FixTriggerStep(
  DbFixer *pFix,     /* Context of the fixation */
  TriggerStep *pStep /* The trigger step be fixed to one database */
){
  while( pStep ){
    if( sqlite3FixSelect(pFix, pStep->pSelect) ){
      return 1;
    }
    if( sqlite3FixExpr(pFix, pStep->pWhere) ){
      return 1;
    }
    if( sqlite3FixExprList(pFix, pStep->pExprList) ){
      return 1;
    }
    pStep = pStep->pNext;
  }
  return 0;
}
#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/auth.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
/*
** 2003 January 11
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to implement the sqlite3_set_authorizer()
** API.  This facility is an optional feature of the library.  Embedded
** systems that do not need this facility may omit it by recompiling
** the library with -DSQLITE_OMIT_AUTHORIZATION=1
**
** $Id: auth.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** All of the code in this file may be omitted by defining a single
** macro.
*/
#ifndef SQLITE_OMIT_AUTHORIZATION

/*
** Set or clear the access authorization function.
**
** The access authorization function is be called during the compilation
** phase to verify that the user has read and/or write access permission on
** various fields of the database.  The first argument to the auth function
** is a copy of the 3rd argument to this routine.  The second argument
** to the auth function is one of these constants:
**
**       SQLITE_CREATE_INDEX
**       SQLITE_CREATE_TABLE
**       SQLITE_CREATE_TEMP_INDEX
**       SQLITE_CREATE_TEMP_TABLE
**       SQLITE_CREATE_TEMP_TRIGGER
**       SQLITE_CREATE_TEMP_VIEW
**       SQLITE_CREATE_TRIGGER
**       SQLITE_CREATE_VIEW
**       SQLITE_DELETE
**       SQLITE_DROP_INDEX
**       SQLITE_DROP_TABLE
**       SQLITE_DROP_TEMP_INDEX
**       SQLITE_DROP_TEMP_TABLE
**       SQLITE_DROP_TEMP_TRIGGER
**       SQLITE_DROP_TEMP_VIEW
**       SQLITE_DROP_TRIGGER
**       SQLITE_DROP_VIEW
**       SQLITE_INSERT
**       SQLITE_PRAGMA
**       SQLITE_READ
**       SQLITE_SELECT
**       SQLITE_TRANSACTION
**       SQLITE_UPDATE
**
** The third and fourth arguments to the auth function are the name of
** the table and the column that are being accessed.  The auth function
** should return either SQLITE_OK, SQLITE_DENY, or SQLITE_IGNORE.  If
** SQLITE_OK is returned, it means that access is allowed.  SQLITE_DENY
** means that the SQL statement will never-run - the sqlite3_exec() call
** will return with an error.  SQLITE_IGNORE means that the SQL statement
** should run but attempts to read the specified column will return NULL
** and attempts to write the column will be ignored.
**
** Setting the auth function to NULL disables this hook.  The default
** setting of the auth function is NULL.
*/
int sqlite3_set_authorizer(
  sqlite3 *db,
  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
  void *pArg
){
  sqlite3_mutex_enter(db->mutex);
  db->xAuth = xAuth;
  db->pAuthArg = pArg;
  sqlite3ExpirePreparedStatements(db);
  sqlite3_mutex_leave(db->mutex);
  return SQLITE_OK;
}

/*
** Write an error message into pParse->zErrMsg that explains that the
** user-supplied authorization function returned an illegal value.
*/
static void sqliteAuthBadReturnCode(Parse *pParse, int rc){
  sqlite3ErrorMsg(pParse, "illegal return value (%d) from the "
    "authorization function - should be SQLITE_OK, SQLITE_IGNORE, "
    "or SQLITE_DENY", rc);
  pParse->rc = SQLITE_ERROR;
}

/*
** The pExpr should be a TK_COLUMN expression.  The table referred to
** is in pTabList or else it is the NEW or OLD table of a trigger.  
** Check to see if it is OK to read this particular column.
**
** If the auth function returns SQLITE_IGNORE, change the TK_COLUMN 
** instruction into a TK_NULL.  If the auth function returns SQLITE_DENY,
** then generate an error.
*/
void sqlite3AuthRead(
  Parse *pParse,        /* The parser context */
  Expr *pExpr,          /* The expression to check authorization on */
  Schema *pSchema,      /* The schema of the expression */
  SrcList *pTabList     /* All table that pExpr might refer to */
){
  sqlite3 *db = pParse->db;
  int rc;
  Table *pTab = 0;      /* The table being read */
  const char *zCol;     /* Name of the column of the table */
  int iSrc;             /* Index in pTabList->a[] of table being read */
  const char *zDBase;   /* Name of database being accessed */
  TriggerStack *pStack; /* The stack of current triggers */
  int iDb;              /* The index of the database the expression refers to */

  if( db->xAuth==0 ) return;
  if( pExpr->op!=TK_COLUMN ) return;
  iDb = sqlite3SchemaToIndex(pParse->db, pSchema);
  if( iDb<0 ){
    /* An attempt to read a column out of a subquery or other
    ** temporary table. */
    return;
  }
  for(iSrc=0; pTabList && iSrc<pTabList->nSrc; iSrc++){
    if( pExpr->iTable==pTabList->a[iSrc].iCursor ) break;
  }
  if( iSrc>=0 && pTabList && iSrc<pTabList->nSrc ){
    pTab = pTabList->a[iSrc].pTab;
  }else if( (pStack = pParse->trigStack)!=0 ){
    /* This must be an attempt to read the NEW or OLD pseudo-tables
    ** of a trigger.
    */
    assert( pExpr->iTable==pStack->newIdx || pExpr->iTable==pStack->oldIdx );
    pTab = pStack->pTab;
  }
  if( pTab==0 ) return;
  if( pExpr->iColumn>=0 ){
    assert( pExpr->iColumn<pTab->nCol );
    zCol = pTab->aCol[pExpr->iColumn].zName;
  }else if( pTab->iPKey>=0 ){
    assert( pTab->iPKey<pTab->nCol );
    zCol = pTab->aCol[pTab->iPKey].zName;
  }else{
    zCol = "ROWID";
  }
  assert( iDb>=0 && iDb<db->nDb );
  zDBase = db->aDb[iDb].zName;
  rc = db->xAuth(db->pAuthArg, SQLITE_READ, pTab->zName, zCol, zDBase, 
                 pParse->zAuthContext);
  if( rc==SQLITE_IGNORE ){
    pExpr->op = TK_NULL;
  }else if( rc==SQLITE_DENY ){
    if( db->nDb>2 || iDb!=0 ){
      sqlite3ErrorMsg(pParse, "access to %s.%s.%s is prohibited", 
         zDBase, pTab->zName, zCol);
    }else{
      sqlite3ErrorMsg(pParse, "access to %s.%s is prohibited",pTab->zName,zCol);
    }
    pParse->rc = SQLITE_AUTH;
  }else if( rc!=SQLITE_OK ){
    sqliteAuthBadReturnCode(pParse, rc);
  }
}

/*
** Do an authorization check using the code and arguments given.  Return
** either SQLITE_OK (zero) or SQLITE_IGNORE or SQLITE_DENY.  If SQLITE_DENY
** is returned, then the error count and error message in pParse are
** modified appropriately.
*/
int sqlite3AuthCheck(
  Parse *pParse,
  int code,
  const char *zArg1,
  const char *zArg2,
  const char *zArg3
){
  sqlite3 *db = pParse->db;
  int rc;

  /* Don't do any authorization checks if the database is initialising
  ** or if the parser is being invoked from within sqlite3_declare_vtab.
  */
  if( db->init.busy || IN_DECLARE_VTAB ){
    return SQLITE_OK;
  }

  if( db->xAuth==0 ){
    return SQLITE_OK;
  }
  rc = db->xAuth(db->pAuthArg, code, zArg1, zArg2, zArg3, pParse->zAuthContext);
  if( rc==SQLITE_DENY ){
    sqlite3ErrorMsg(pParse, "not authorized");
    pParse->rc = SQLITE_AUTH;
  }else if( rc!=SQLITE_OK && rc!=SQLITE_IGNORE ){
    rc = SQLITE_DENY;
    sqliteAuthBadReturnCode(pParse, rc);
  }
  return rc;
}

/*
** Push an authorization context.  After this routine is called, the
** zArg3 argument to authorization callbacks will be zContext until
** popped.  Or if pParse==0, this routine is a no-op.
*/
void sqlite3AuthContextPush(
  Parse *pParse,
  AuthContext *pContext, 
  const char *zContext
){
  pContext->pParse = pParse;
  if( pParse ){
    pContext->zAuthContext = pParse->zAuthContext;
    pParse->zAuthContext = zContext;
  }
}

/*
** Pop an authorization context that was previously pushed
** by sqlite3AuthContextPush
*/
void sqlite3AuthContextPop(AuthContext *pContext){
  if( pContext->pParse ){
    pContext->pParse->zAuthContext = pContext->zAuthContext;
    pContext->pParse = 0;
  }
}

#endif /* SQLITE_OMIT_AUTHORIZATION */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/bitvec.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
/*
** 2008 February 16
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file implements an object that represents a fixed-length
** bitmap.  Bits are numbered starting with 1.
**
** A bitmap is used to record what pages a database file have been
** journalled during a transaction.  Usually only a few pages are
** journalled.  So the bitmap is usually sparse and has low cardinality.
** But sometimes (for example when during a DROP of a large table) most
** or all of the pages get journalled.  In those cases, the bitmap becomes
** dense.  The algorithm needs to handle both cases well.
**
** The size of the bitmap is fixed when the object is created.
**
** All bits are clear when the bitmap is created.  Individual bits
** may be set or cleared one at a time.
**
** Test operations are about 100 times more common that set operations.
** Clear operations are exceedingly rare.  There are usually between
** 5 and 500 set operations per Bitvec object, though the number of sets can
** sometimes grow into tens of thousands or larger.  The size of the
** Bitvec object is the number of pages in the database file at the
** start of a transaction, and is thus usually less than a few thousand,
** but can be as large as 2 billion for a really big database.
**
** @(#) $Id: bitvec.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"

#define BITVEC_SZ        512
/* Round the union size down to the nearest pointer boundary, since that's how 
** it will be aligned within the Bitvec struct. */
#define BITVEC_USIZE     (((BITVEC_SZ-12)/sizeof(Bitvec*))*sizeof(Bitvec*))
#define BITVEC_NCHAR     BITVEC_USIZE
#define BITVEC_NBIT      (BITVEC_NCHAR*8)
#define BITVEC_NINT      (BITVEC_USIZE/4)
#define BITVEC_MXHASH    (BITVEC_NINT/2)
#define BITVEC_NPTR      (BITVEC_USIZE/sizeof(Bitvec *))

#define BITVEC_HASH(X)   (((X)*37)%BITVEC_NINT)

/*
** A bitmap is an instance of the following structure.
**
** This bitmap records the existance of zero or more bits
** with values between 1 and iSize, inclusive.
**
** There are three possible representations of the bitmap.
** If iSize<=BITVEC_NBIT, then Bitvec.u.aBitmap[] is a straight
** bitmap.  The least significant bit is bit 1.
**
** If iSize>BITVEC_NBIT and iDivisor==0 then Bitvec.u.aHash[] is
** a hash table that will hold up to BITVEC_MXHASH distinct values.
**
** Otherwise, the value i is redirected into one of BITVEC_NPTR
** sub-bitmaps pointed to by Bitvec.u.apSub[].  Each subbitmap
** handles up to iDivisor separate values of i.  apSub[0] holds
** values between 1 and iDivisor.  apSub[1] holds values between
** iDivisor+1 and 2*iDivisor.  apSub[N] holds values between
** N*iDivisor+1 and (N+1)*iDivisor.  Each subbitmap is normalized
** to hold deal with values between 1 and iDivisor.
*/
struct Bitvec {
  u32 iSize;      /* Maximum bit index */
  u32 nSet;       /* Number of bits that are set */
  u32 iDivisor;   /* Number of bits handled by each apSub[] entry */
  union {
    u8 aBitmap[BITVEC_NCHAR];    /* Bitmap representation */
    u32 aHash[BITVEC_NINT];      /* Hash table representation */
    Bitvec *apSub[BITVEC_NPTR];  /* Recursive representation */
  } u;
};

/*
** Create a new bitmap object able to handle bits between 0 and iSize,
** inclusive.  Return a pointer to the new object.  Return NULL if 
** malloc fails.
*/
Bitvec *sqlite3BitvecCreate(u32 iSize){
  Bitvec *p;
  assert( sizeof(*p)==BITVEC_SZ );
  p = sqlite3MallocZero( sizeof(*p) );
  if( p ){
    p->iSize = iSize;
  }
  return p;
}

/*
** Check to see if the i-th bit is set.  Return true or false.
** If p is NULL (if the bitmap has not been created) or if
** i is out of range, then return false.
*/
int sqlite3BitvecTest(Bitvec *p, u32 i){
  if( p==0 ) return 0;
  if( i>p->iSize || i==0 ) return 0;
  if( p->iSize<=BITVEC_NBIT ){
    i--;
    return (p->u.aBitmap[i/8] & (1<<(i&7)))!=0;
  }
  if( p->iDivisor>0 ){
    u32 bin = (i-1)/p->iDivisor;
    i = (i-1)%p->iDivisor + 1;
    return sqlite3BitvecTest(p->u.apSub[bin], i);
  }else{
    u32 h = BITVEC_HASH(i);
    while( p->u.aHash[h] ){
      if( p->u.aHash[h]==i ) return 1;
      h++;
      if( h>=BITVEC_NINT ) h = 0;
    }
    return 0;
  }
}

/*
** Set the i-th bit.  Return 0 on success and an error code if
** anything goes wrong.
*/
int sqlite3BitvecSet(Bitvec *p, u32 i){
  u32 h;
  assert( p!=0 );
  assert( i>0 );
  assert( i<=p->iSize );
  if( p->iSize<=BITVEC_NBIT ){
    i--;
    p->u.aBitmap[i/8] |= 1 << (i&7);
    return SQLITE_OK;
  }
  if( p->iDivisor ){
    u32 bin = (i-1)/p->iDivisor;
    i = (i-1)%p->iDivisor + 1;
    if( p->u.apSub[bin]==0 ){
      sqlite3BeginBenignMalloc();
      p->u.apSub[bin] = sqlite3BitvecCreate( p->iDivisor );
      sqlite3EndBenignMalloc();
      if( p->u.apSub[bin]==0 ) return SQLITE_NOMEM;
    }
    return sqlite3BitvecSet(p->u.apSub[bin], i);
  }
  h = BITVEC_HASH(i);
  while( p->u.aHash[h] ){
    if( p->u.aHash[h]==i ) return SQLITE_OK;
    h++;
    if( h==BITVEC_NINT ) h = 0;
  }
  p->nSet++;
  if( p->nSet>=BITVEC_MXHASH ){
    int j, rc;
    u32 aiValues[BITVEC_NINT];
    memcpy(aiValues, p->u.aHash, sizeof(aiValues));
    memset(p->u.apSub, 0, sizeof(p->u.apSub[0])*BITVEC_NPTR);
    p->iDivisor = (p->iSize + BITVEC_NPTR - 1)/BITVEC_NPTR;
    rc = sqlite3BitvecSet(p, i);
    for(j=0; j<BITVEC_NINT; j++){
      if( aiValues[j] ) rc |= sqlite3BitvecSet(p, aiValues[j]);
    }
    return rc;
  }
  p->u.aHash[h] = i;
  return SQLITE_OK;
}

/*
** Clear the i-th bit.  Return 0 on success and an error code if
** anything goes wrong.
*/
void sqlite3BitvecClear(Bitvec *p, u32 i){
  assert( p!=0 );
  assert( i>0 );
  if( p->iSize<=BITVEC_NBIT ){
    i--;
    p->u.aBitmap[i/8] &= ~(1 << (i&7));
  }else if( p->iDivisor ){
    u32 bin = (i-1)/p->iDivisor;
    i = (i-1)%p->iDivisor + 1;
    if( p->u.apSub[bin] ){
      sqlite3BitvecClear(p->u.apSub[bin], i);
    }
  }else{
    int j;
    u32 aiValues[BITVEC_NINT];
    memcpy(aiValues, p->u.aHash, sizeof(aiValues));
    memset(p->u.aHash, 0, sizeof(p->u.aHash[0])*BITVEC_NINT);
    p->nSet = 0;
    for(j=0; j<BITVEC_NINT; j++){
      if( aiValues[j] && aiValues[j]!=i ){
        sqlite3BitvecSet(p, aiValues[j]);
      }
    }
  }
}

/*
** Destroy a bitmap object.  Reclaim all memory used.
*/
void sqlite3BitvecDestroy(Bitvec *p){
  if( p==0 ) return;
  if( p->iDivisor ){
    int i;
    for(i=0; i<BITVEC_NPTR; i++){
      sqlite3BitvecDestroy(p->u.apSub[i]);
    }
  }
  sqlite3_free(p);
}

#ifndef SQLITE_OMIT_BUILTIN_TEST
/*
** Let V[] be an array of unsigned characters sufficient to hold
** up to N bits.  Let I be an integer between 0 and N.  0<=I<N.
** Then the following macros can be used to set, clear, or test
** individual bits within V.
*/
#define SETBIT(V,I)      V[I>>3] |= (1<<(I&7))
#define CLEARBIT(V,I)    V[I>>3] &= ~(1<<(I&7))
#define TESTBIT(V,I)     (V[I>>3]&(1<<(I&7)))!=0

/*
** This routine runs an extensive test of the Bitvec code.
**
** The input is an array of integers that acts as a program
** to test the Bitvec.  The integers are opcodes followed
** by 0, 1, or 3 operands, depending on the opcode.  Another
** opcode follows immediately after the last operand.
**
** There are 6 opcodes numbered from 0 through 5.  0 is the
** "halt" opcode and causes the test to end.
**
**    0          Halt and return the number of errors
**    1 N S X    Set N bits beginning with S and incrementing by X
**    2 N S X    Clear N bits beginning with S and incrementing by X
**    3 N        Set N randomly chosen bits
**    4 N        Clear N randomly chosen bits
**    5 N S X    Set N bits from S increment X in array only, not in bitvec
**
** The opcodes 1 through 4 perform set and clear operations are performed
** on both a Bitvec object and on a linear array of bits obtained from malloc.
** Opcode 5 works on the linear array only, not on the Bitvec.
** Opcode 5 is used to deliberately induce a fault in order to
** confirm that error detection works.
**
** At the conclusion of the test the linear array is compared
** against the Bitvec object.  If there are any differences,
** an error is returned.  If they are the same, zero is returned.
**
** If a memory allocation error occurs, return -1.
*/
int sqlite3BitvecBuiltinTest(int sz, int *aOp){
  Bitvec *pBitvec = 0;
  unsigned char *pV = 0;
  int rc = -1;
  int i, nx, pc, op;

  /* Allocate the Bitvec to be tested and a linear array of
  ** bits to act as the reference */
  pBitvec = sqlite3BitvecCreate( sz );
  pV = sqlite3_malloc( (sz+7)/8 + 1 );
  if( pBitvec==0 || pV==0 ) goto bitvec_end;
  memset(pV, 0, (sz+7)/8 + 1);

  /* Run the program */
  pc = 0;
  while( (op = aOp[pc])!=0 ){
    switch( op ){
      case 1:
      case 2:
      case 5: {
        nx = 4;
        i = aOp[pc+2] - 1;
        aOp[pc+2] += aOp[pc+3];
        break;
      }
      case 3:
      case 4: 
      default: {
        nx = 2;
        sqlite3_randomness(sizeof(i), &i);
        break;
      }
    }
    if( (--aOp[pc+1]) > 0 ) nx = 0;
    pc += nx;
    i = (i & 0x7fffffff)%sz;
    if( (op & 1)!=0 ){
      SETBIT(pV, (i+1));
      if( op!=5 ){
        if( sqlite3BitvecSet(pBitvec, i+1) ) goto bitvec_end;
      }
    }else{
      CLEARBIT(pV, (i+1));
      sqlite3BitvecClear(pBitvec, i+1);
    }
  }

  /* Test to make sure the linear array exactly matches the
  ** Bitvec object.  Start with the assumption that they do
  ** match (rc==0).  Change rc to non-zero if a discrepancy
  ** is found.
  */
  rc = sqlite3BitvecTest(0,0) + sqlite3BitvecTest(pBitvec, sz+1)
          + sqlite3BitvecTest(pBitvec, 0);
  for(i=1; i<=sz; i++){
    if(  (TESTBIT(pV,i))!=sqlite3BitvecTest(pBitvec,i) ){
      rc = i;
      break;
    }
  }

  /* Free allocated structure */
bitvec_end:
  sqlite3_free(pV);
  sqlite3BitvecDestroy(pBitvec);
  return rc;
}
#endif /* SQLITE_OMIT_BUILTIN_TEST */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/btmutex.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
/*
** 2007 August 27
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** $Id: btmutex.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
**
** This file contains code used to implement mutexes on Btree objects.
** This code really belongs in btree.c.  But btree.c is getting too
** big and we want to break it down some.  This packaged seemed like
** a good breakout.
*/
#include "btreeInt.h"
#if SQLITE_THREADSAFE && !defined(SQLITE_OMIT_SHARED_CACHE)


/*
** Enter a mutex on the given BTree object.
**
** If the object is not sharable, then no mutex is ever required
** and this routine is a no-op.  The underlying mutex is non-recursive.
** But we keep a reference count in Btree.wantToLock so the behavior
** of this interface is recursive.
**
** To avoid deadlocks, multiple Btrees are locked in the same order
** by all database connections.  The p->pNext is a list of other
** Btrees belonging to the same database connection as the p Btree
** which need to be locked after p.  If we cannot get a lock on
** p, then first unlock all of the others on p->pNext, then wait
** for the lock to become available on p, then relock all of the
** subsequent Btrees that desire a lock.
*/
void sqlite3BtreeEnter(Btree *p){
  Btree *pLater;

  /* Some basic sanity checking on the Btree.  The list of Btrees
  ** connected by pNext and pPrev should be in sorted order by
  ** Btree.pBt value. All elements of the list should belong to
  ** the same connection. Only shared Btrees are on the list. */
  assert( p->pNext==0 || p->pNext->pBt>p->pBt );
  assert( p->pPrev==0 || p->pPrev->pBt<p->pBt );
  assert( p->pNext==0 || p->pNext->db==p->db );
  assert( p->pPrev==0 || p->pPrev->db==p->db );
  assert( p->sharable || (p->pNext==0 && p->pPrev==0) );

  /* Check for locking consistency */
  assert( !p->locked || p->wantToLock>0 );
  assert( p->sharable || p->wantToLock==0 );

  /* We should already hold a lock on the database connection */
  assert( sqlite3_mutex_held(p->db->mutex) );

  if( !p->sharable ) return;
  p->wantToLock++;
  if( p->locked ) return;

#ifndef SQLITE_MUTEX_NOOP
  /* In most cases, we should be able to acquire the lock we
  ** want without having to go throught the ascending lock
  ** procedure that follows.  Just be sure not to block.
  */
  if( sqlite3_mutex_try(p->pBt->mutex)==SQLITE_OK ){
    p->locked = 1;
    return;
  }

  /* To avoid deadlock, first release all locks with a larger
  ** BtShared address.  Then acquire our lock.  Then reacquire
  ** the other BtShared locks that we used to hold in ascending
  ** order.
  */
  for(pLater=p->pNext; pLater; pLater=pLater->pNext){
    assert( pLater->sharable );
    assert( pLater->pNext==0 || pLater->pNext->pBt>pLater->pBt );
    assert( !pLater->locked || pLater->wantToLock>0 );
    if( pLater->locked ){
      sqlite3_mutex_leave(pLater->pBt->mutex);
      pLater->locked = 0;
    }
  }
  sqlite3_mutex_enter(p->pBt->mutex);
  p->locked = 1;
  for(pLater=p->pNext; pLater; pLater=pLater->pNext){
    if( pLater->wantToLock ){
      sqlite3_mutex_enter(pLater->pBt->mutex);
      pLater->locked = 1;
    }
  }
#endif /* SQLITE_MUTEX_NOOP */
}

/*
** Exit the recursive mutex on a Btree.
*/
void sqlite3BtreeLeave(Btree *p){
  if( p->sharable ){
    assert( p->wantToLock>0 );
    p->wantToLock--;
    if( p->wantToLock==0 ){
      assert( p->locked );
      sqlite3_mutex_leave(p->pBt->mutex);
      p->locked = 0;
    }
  }
}

#ifndef NDEBUG
/*
** Return true if the BtShared mutex is held on the btree.  
**
** This routine makes no determination one why or another if the
** database connection mutex is held.
**
** This routine is used only from within assert() statements.
*/
int sqlite3BtreeHoldsMutex(Btree *p){
  return (p->sharable==0 ||
             (p->locked && p->wantToLock && sqlite3_mutex_held(p->pBt->mutex)));
}
#endif


#ifndef SQLITE_OMIT_INCRBLOB
/*
** Enter and leave a mutex on a Btree given a cursor owned by that
** Btree.  These entry points are used by incremental I/O and can be
** omitted if that module is not used.
*/
void sqlite3BtreeEnterCursor(BtCursor *pCur){
  sqlite3BtreeEnter(pCur->pBtree);
}
void sqlite3BtreeLeaveCursor(BtCursor *pCur){
  sqlite3BtreeLeave(pCur->pBtree);
}
#endif /* SQLITE_OMIT_INCRBLOB */


/*
** Enter the mutex on every Btree associated with a database
** connection.  This is needed (for example) prior to parsing
** a statement since we will be comparing table and column names
** against all schemas and we do not want those schemas being
** reset out from under us.
**
** There is a corresponding leave-all procedures.
**
** Enter the mutexes in accending order by BtShared pointer address
** to avoid the possibility of deadlock when two threads with
** two or more btrees in common both try to lock all their btrees
** at the same instant.
*/
void sqlite3BtreeEnterAll(sqlite3 *db){
  int i;
  Btree *p, *pLater;
  assert( sqlite3_mutex_held(db->mutex) );
  for(i=0; i<db->nDb; i++){
    p = db->aDb[i].pBt;
    if( p && p->sharable ){
      p->wantToLock++;
      if( !p->locked ){
        assert( p->wantToLock==1 );
        while( p->pPrev ) p = p->pPrev;
        while( p->locked && p->pNext ) p = p->pNext;
        for(pLater = p->pNext; pLater; pLater=pLater->pNext){
          if( pLater->locked ){
            sqlite3_mutex_leave(pLater->pBt->mutex);
            pLater->locked = 0;
          }
        }
        while( p ){
          sqlite3_mutex_enter(p->pBt->mutex);
          p->locked++;
          p = p->pNext;
        }
      }
    }
  }
}
void sqlite3BtreeLeaveAll(sqlite3 *db){
  int i;
  Btree *p;
  assert( sqlite3_mutex_held(db->mutex) );
  for(i=0; i<db->nDb; i++){
    p = db->aDb[i].pBt;
    if( p && p->sharable ){
      assert( p->wantToLock>0 );
      p->wantToLock--;
      if( p->wantToLock==0 ){
        assert( p->locked );
        sqlite3_mutex_leave(p->pBt->mutex);
        p->locked = 0;
      }
    }
  }
}

#ifndef NDEBUG
/*
** Return true if the current thread holds the database connection
** mutex and all required BtShared mutexes.
**
** This routine is used inside assert() statements only.
*/
int sqlite3BtreeHoldsAllMutexes(sqlite3 *db){
  int i;
  if( !sqlite3_mutex_held(db->mutex) ){
    return 0;
  }
  for(i=0; i<db->nDb; i++){
    Btree *p;
    p = db->aDb[i].pBt;
    if( p && p->sharable &&
         (p->wantToLock==0 || !sqlite3_mutex_held(p->pBt->mutex)) ){
      return 0;
    }
  }
  return 1;
}
#endif /* NDEBUG */

/*
** Add a new Btree pointer to a BtreeMutexArray. 
** if the pointer can possibly be shared with
** another database connection.
**
** The pointers are kept in sorted order by pBtree->pBt.  That
** way when we go to enter all the mutexes, we can enter them
** in order without every having to backup and retry and without
** worrying about deadlock.
**
** The number of shared btrees will always be small (usually 0 or 1)
** so an insertion sort is an adequate algorithm here.
*/
void sqlite3BtreeMutexArrayInsert(BtreeMutexArray *pArray, Btree *pBtree){
  int i, j;
  BtShared *pBt;
  if( pBtree==0 || pBtree->sharable==0 ) return;
#ifndef NDEBUG
  {
    for(i=0; i<pArray->nMutex; i++){
      assert( pArray->aBtree[i]!=pBtree );
    }
  }
#endif
  assert( pArray->nMutex>=0 );
  assert( pArray->nMutex<sizeof(pArray->aBtree)/sizeof(pArray->aBtree[0])-1 );
  pBt = pBtree->pBt;
  for(i=0; i<pArray->nMutex; i++){
    assert( pArray->aBtree[i]!=pBtree );
    if( pArray->aBtree[i]->pBt>pBt ){
      for(j=pArray->nMutex; j>i; j--){
        pArray->aBtree[j] = pArray->aBtree[j-1];
      }
      pArray->aBtree[i] = pBtree;
      pArray->nMutex++;
      return;
    }
  }
  pArray->aBtree[pArray->nMutex++] = pBtree;
}

/*
** Enter the mutex of every btree in the array.  This routine is
** called at the beginning of sqlite3VdbeExec().  The mutexes are
** exited at the end of the same function.
*/
void sqlite3BtreeMutexArrayEnter(BtreeMutexArray *pArray){
  int i;
  for(i=0; i<pArray->nMutex; i++){
    Btree *p = pArray->aBtree[i];
    /* Some basic sanity checking */
    assert( i==0 || pArray->aBtree[i-1]->pBt<p->pBt );
    assert( !p->locked || p->wantToLock>0 );

    /* We should already hold a lock on the database connection */
    assert( sqlite3_mutex_held(p->db->mutex) );

    p->wantToLock++;
    if( !p->locked && p->sharable ){
      sqlite3_mutex_enter(p->pBt->mutex);
      p->locked = 1;
    }
  }
}

/*
** Leave the mutex of every btree in the group.
*/
void sqlite3BtreeMutexArrayLeave(BtreeMutexArray *pArray){
  int i;
  for(i=0; i<pArray->nMutex; i++){
    Btree *p = pArray->aBtree[i];
    /* Some basic sanity checking */
    assert( i==0 || pArray->aBtree[i-1]->pBt<p->pBt );
    assert( p->locked || !p->sharable );
    assert( p->wantToLock>0 );

    /* We should already hold a lock on the database connection */
    assert( sqlite3_mutex_held(p->db->mutex) );

    p->wantToLock--;
    if( p->wantToLock==0 && p->locked ){
      sqlite3_mutex_leave(p->pBt->mutex);
      p->locked = 0;
    }
  }
}


#endif  /* SQLITE_THREADSAFE && !SQLITE_OMIT_SHARED_CACHE */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/btree.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
/*
** 2004 April 6
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
** Including a description of file format and an overview of operation.
*/
#include "btreeInt.h"

/*
** The header string that appears at the beginning of every
** SQLite database.
*/
static const char zMagicHeader[] = SQLITE_FILE_HEADER;

/*
** Set this global variable to 1 to enable tracing using the TRACE
** macro.
*/
#if 0
int sqlite3BtreeTrace=0;  /* True to enable tracing */
# define TRACE(X)  if(sqlite3BtreeTrace){printf X;fflush(stdout);}
#else
# define TRACE(X)
#endif



#ifndef SQLITE_OMIT_SHARED_CACHE
/*
** A flag to indicate whether or not shared cache is enabled.  Also,
** a list of BtShared objects that are eligible for participation
** in shared cache.  The variables have file scope during normal builds,
** but the test harness needs to access these variables so we make them
** global for test builds.
*/
#ifdef SQLITE_TEST
BtShared *sqlite3SharedCacheList = 0;
int sqlite3SharedCacheEnabled = 0;
#else
static BtShared *sqlite3SharedCacheList = 0;
static int sqlite3SharedCacheEnabled = 0;
#endif
#endif /* SQLITE_OMIT_SHARED_CACHE */

#ifndef SQLITE_OMIT_SHARED_CACHE
/*
** Enable or disable the shared pager and schema features.
**
** This routine has no effect on existing database connections.
** The shared cache setting effects only future calls to
** sqlite3_open(), sqlite3_open16(), or sqlite3_open_v2().
*/
int sqlite3_enable_shared_cache(int enable){
  sqlite3SharedCacheEnabled = enable;
  return SQLITE_OK;
}
#endif


/*
** Forward declaration
*/
static int checkReadLocks(Btree*, Pgno, BtCursor*, i64);


#ifdef SQLITE_OMIT_SHARED_CACHE
  /*
  ** The functions queryTableLock(), lockTable() and unlockAllTables()
  ** manipulate entries in the BtShared.pLock linked list used to store
  ** shared-cache table level locks. If the library is compiled with the
  ** shared-cache feature disabled, then there is only ever one user
  ** of each BtShared structure and so this locking is not necessary. 
  ** So define the lock related functions as no-ops.
  */
  #define queryTableLock(a,b,c) SQLITE_OK
  #define lockTable(a,b,c) SQLITE_OK
  #define unlockAllTables(a)
#endif

#ifndef SQLITE_OMIT_SHARED_CACHE
/*
** 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 lockTable()), or
** SQLITE_LOCKED if not.
*/
static int queryTableLock(Btree *p, Pgno iTab, u8 eLock){
  BtShared *pBt = p->pBt;
  BtLock *pIter;

  assert( sqlite3BtreeHoldsMutex(p) );
  assert( eLock==READ_LOCK || eLock==WRITE_LOCK );
  assert( p->db!=0 );
  
  /* 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.
  */
  if( pBt->pExclusive && pBt->pExclusive!=p ){
    return SQLITE_LOCKED;
  }

  /* This (along with lockTable()) is where the ReadUncommitted flag is
  ** dealt with. If the caller is querying for a read-lock and the flag is
  ** set, it is unconditionally granted - even if there are write-locks
  ** on the table. If a write-lock is requested, the ReadUncommitted flag
  ** is not considered.
  **
  ** In function lockTable(), if a read-lock is demanded and the 
  ** ReadUncommitted flag is set, no entry is added to the locks list 
  ** (BtShared.pLock).
  **
  ** To summarize: If the ReadUncommitted flag is set, then read cursors do
  ** not create or respect table locks. The locking procedure for a 
  ** write-cursor does not change.
  */
  if( 
    0==(p->db->flags&SQLITE_ReadUncommitted) || 
    eLock==WRITE_LOCK ||
    iTab==MASTER_ROOT
  ){
    for(pIter=pBt->pLock; pIter; pIter=pIter->pNext){
      if( pIter->pBtree!=p && pIter->iTable==iTab && 
          (pIter->eLock!=eLock || eLock!=READ_LOCK) ){
        return SQLITE_LOCKED;
      }
    }
  }
  return SQLITE_OK;
}
#endif /* !SQLITE_OMIT_SHARED_CACHE */

#ifndef SQLITE_OMIT_SHARED_CACHE
/*
** 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.
**
** SQLITE_OK is returned if the lock is added successfully. SQLITE_BUSY and
** SQLITE_NOMEM may also be returned.
*/
static int lockTable(Btree *p, Pgno iTable, u8 eLock){
  BtShared *pBt = p->pBt;
  BtLock *pLock = 0;
  BtLock *pIter;

  assert( sqlite3BtreeHoldsMutex(p) );
  assert( eLock==READ_LOCK || eLock==WRITE_LOCK );
  assert( p->db!=0 );

  /* This is a no-op if the shared-cache is not enabled */
  if( !p->sharable ){
    return SQLITE_OK;
  }

  assert( SQLITE_OK==queryTableLock(p, iTable, eLock) );

  /* If the read-uncommitted flag is set and a read-lock is requested,
  ** return early without adding an entry to the BtShared.pLock list. See
  ** comment in function queryTableLock() for more info on handling 
  ** the ReadUncommitted flag.
  */
  if( 
    (p->db->flags&SQLITE_ReadUncommitted) && 
    (eLock==READ_LOCK) &&
    iTable!=MASTER_ROOT
  ){
    return SQLITE_OK;
  }

  /* First search the list for an existing lock on this table. */
  for(pIter=pBt->pLock; pIter; pIter=pIter->pNext){
    if( pIter->iTable==iTable && pIter->pBtree==p ){
      pLock = pIter;
      break;
    }
  }

  /* If the above search did not find a BtLock struct associating Btree p
  ** with table iTable, allocate one and link it into the list.
  */
  if( !pLock ){
    pLock = (BtLock *)sqlite3MallocZero(sizeof(BtLock));
    if( !pLock ){
      return SQLITE_NOMEM;
    }
    pLock->iTable = iTable;
    pLock->pBtree = p;
    pLock->pNext = pBt->pLock;
    pBt->pLock = pLock;
  }

  /* Set the BtLock.eLock variable to the maximum of the current lock
  ** and the requested lock. This means if a write-lock was already held
  ** and a read-lock requested, we don't incorrectly downgrade the lock.
  */
  assert( WRITE_LOCK>READ_LOCK );
  if( eLock>pLock->eLock ){
    pLock->eLock = 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 lockTable()
** procedure) held by Btree handle p.
*/
static void unlockAllTables(Btree *p){
  BtShared *pBt = p->pBt;
  BtLock **ppIter = &pBt->pLock;

  assert( sqlite3BtreeHoldsMutex(p) );
  assert( p->sharable || 0==*ppIter );

  while( *ppIter ){
    BtLock *pLock = *ppIter;
    assert( pBt->pExclusive==0 || pBt->pExclusive==pLock->pBtree );
    if( pLock->pBtree==p ){
      *ppIter = pLock->pNext;
      sqlite3_free(pLock);
    }else{
      ppIter = &pLock->pNext;
    }
  }

  if( pBt->pExclusive==p ){
    pBt->pExclusive = 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
/*
** Invalidate the overflow page-list cache for cursor pCur, if any.
*/
static void invalidateOverflowCache(BtCursor *pCur){
  assert( cursorHoldsMutex(pCur) );
  sqlite3_free(pCur->aOverflow);
  pCur->aOverflow = 0;
}

/*
** Invalidate the overflow page-list cache for all cursors opened
** on the shared btree structure pBt.
*/
static void invalidateAllOverflowCache(BtShared *pBt){
  BtCursor *p;
  assert( sqlite3_mutex_held(pBt->mutex) );
  for(p=pBt->pCursor; p; p=p->pNext){
    invalidateOverflowCache(p);
  }
}
#else
  #define invalidateOverflowCache(x)
  #define invalidateAllOverflowCache(x)
#endif

/*
** Save the current cursor position in the variables BtCursor.nKey 
** and BtCursor.pKey. The cursor's state is set to CURSOR_REQUIRESEEK.
*/
static int saveCursorPosition(BtCursor *pCur){
  int rc;

  assert( CURSOR_VALID==pCur->eState );
  assert( 0==pCur->pKey );
  assert( cursorHoldsMutex(pCur) );

  rc = sqlite3BtreeKeySize(pCur, &pCur->nKey);

  /* If this is an intKey table, then the above call to BtreeKeySize()
  ** stores the integer key in pCur->nKey. In this case this value is
  ** all that is required. Otherwise, if pCur is not open on an intKey
  ** table, then malloc space for and store the pCur->nKey bytes of key 
  ** data.
  */
  if( rc==SQLITE_OK && 0==pCur->pPage->intKey){
    void *pKey = sqlite3Malloc(pCur->nKey);
    if( pKey ){
      rc = sqlite3BtreeKey(pCur, 0, pCur->nKey, pKey);
      if( rc==SQLITE_OK ){
        pCur->pKey = pKey;
      }else{
        sqlite3_free(pKey);
      }
    }else{
      rc = SQLITE_NOMEM;
    }
  }
  assert( !pCur->pPage->intKey || !pCur->pKey );

  if( rc==SQLITE_OK ){
    releasePage(pCur->pPage);
    pCur->pPage = 0;
    pCur->eState = CURSOR_REQUIRESEEK;
  }

  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( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) && 
        p->eState==CURSOR_VALID ){
      int rc = saveCursorPosition(p);
      if( SQLITE_OK!=rc ){
        return rc;
      }
    }
  }
  return SQLITE_OK;
}

/*
** Clear the current cursor position.
*/
static void clearCursorPosition(BtCursor *pCur){
  assert( cursorHoldsMutex(pCur) );
  sqlite3_free(pCur->pKey);
  pCur->pKey = 0;
  pCur->eState = CURSOR_INVALID;
}

/*
** Restore the cursor to the position it was in (or as close to as possible)
** when saveCursorPosition() was called. Note that this call deletes the 
** saved position info stored by saveCursorPosition(), so there can be
** at most one effective restoreCursorPosition() call after each 
** saveCursorPosition().
*/
int sqlite3BtreeRestoreCursorPosition(BtCursor *pCur){
  int rc;
  assert( cursorHoldsMutex(pCur) );
  assert( pCur->eState>=CURSOR_REQUIRESEEK );
  if( pCur->eState==CURSOR_FAULT ){
    return pCur->skip;
  }
  pCur->eState = CURSOR_INVALID;
  rc = sqlite3BtreeMoveto(pCur, pCur->pKey, 0, pCur->nKey, 0, &pCur->skip);
  if( rc==SQLITE_OK ){
    sqlite3_free(pCur->pKey);
    pCur->pKey = 0;
    assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_INVALID );
  }
  return rc;
}

#define restoreCursorPosition(p) \
  (p->eState>=CURSOR_REQUIRESEEK ? \
         sqlite3BtreeRestoreCursorPosition(p) : \
         SQLITE_OK)

/*
** Determine whether or not a cursor has moved from the position it
** was last placed at.  Cursor can move when the row they are pointing
** at is deleted out from under them.
**
** This routine returns an error code if something goes wrong.  The
** integer *pHasMoved is set to one if the cursor has moved and 0 if not.
*/
int sqlite3BtreeCursorHasMoved(BtCursor *pCur, int *pHasMoved){
  int rc;

  rc = restoreCursorPosition(pCur);
  if( rc ){
    *pHasMoved = 1;
    return rc;
  }
  if( pCur->eState!=CURSOR_VALID || pCur->skip!=0 ){
    *pHasMoved = 1;
  }else{
    *pHasMoved = 0;
  }
  return SQLITE_OK;
}

#ifndef SQLITE_OMIT_AUTOVACUUM
/*
** Given a page number of a regular database page, return the page
** number for the pointer-map page that contains the entry for the
** input page number.
*/
static Pgno ptrmapPageno(BtShared *pBt, Pgno pgno){
  int nPagesPerMapPage, iPtrMap, ret;
  assert( sqlite3_mutex_held(pBt->mutex) );
  nPagesPerMapPage = (pBt->usableSize/5)+1;
  iPtrMap = (pgno-2)/nPagesPerMapPage;
  ret = (iPtrMap*nPagesPerMapPage) + 2; 
  if( ret==PENDING_BYTE_PAGE(pBt) ){
    ret++;
  }
  return ret;
}

/*
** Write an entry into the pointer map.
**
** This routine updates the pointer map entry for page number 'key'
** so that it maps to type 'eType' and parent page number 'pgno'.
** An error code is returned if something goes wrong, otherwise SQLITE_OK.
*/
static int ptrmapPut(BtShared *pBt, Pgno key, u8 eType, Pgno parent){
  DbPage *pDbPage;  /* The pointer map page */
  u8 *pPtrmap;      /* The pointer map data */
  Pgno iPtrmap;     /* The pointer map page number */
  int offset;       /* Offset in pointer map page */
  int rc;

  assert( sqlite3_mutex_held(pBt->mutex) );
  /* The master-journal page number must never be used as a pointer map page */
  assert( 0==PTRMAP_ISPAGE(pBt, PENDING_BYTE_PAGE(pBt)) );

  assert( pBt->autoVacuum );
  if( key==0 ){
    return SQLITE_CORRUPT_BKPT;
  }
  iPtrmap = PTRMAP_PAGENO(pBt, key);
  rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage);
  if( rc!=SQLITE_OK ){
    return rc;
  }
  offset = PTRMAP_PTROFFSET(iPtrmap, key);
  pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);

  if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){
    TRACE(("PTRMAP_UPDATE: %d->(%d,%d)\n", key, eType, parent));
    rc = sqlite3PagerWrite(pDbPage);
    if( rc==SQLITE_OK ){
      pPtrmap[offset] = eType;
      put4byte(&pPtrmap[offset+1], parent);
    }
  }

  sqlite3PagerUnref(pDbPage);
  return rc;
}

/*
** Read an entry from the pointer map.
**
** This routine retrieves the pointer map entry for page 'key', writing
** the type and parent page number to *pEType and *pPgno respectively.
** An error code is returned if something goes wrong, otherwise SQLITE_OK.
*/
static int ptrmapGet(BtShared *pBt, Pgno key, u8 *pEType, Pgno *pPgno){
  DbPage *pDbPage;   /* The pointer map page */
  int iPtrmap;       /* Pointer map page index */
  u8 *pPtrmap;       /* Pointer map page data */
  int offset;        /* Offset of entry in pointer map */
  int rc;

  assert( sqlite3_mutex_held(pBt->mutex) );

  iPtrmap = PTRMAP_PAGENO(pBt, key);
  rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage);
  if( rc!=0 ){
    return rc;
  }
  pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage);

  offset = PTRMAP_PTROFFSET(iPtrmap, key);
  assert( pEType!=0 );
  *pEType = pPtrmap[offset];
  if( pPgno ) *pPgno = get4byte(&pPtrmap[offset+1]);

  sqlite3PagerUnref(pDbPage);
  if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT_BKPT;
  return SQLITE_OK;
}

#else /* if defined SQLITE_OMIT_AUTOVACUUM */
  #define ptrmapPut(w,x,y,z) SQLITE_OK
  #define ptrmapGet(w,x,y,z) SQLITE_OK
  #define ptrmapPutOvfl(y,z) SQLITE_OK
#endif

/*
** Given a btree page and a cell index (0 means the first cell on
** the page, 1 means the second cell, and so forth) return a pointer
** to the cell content.
**
** This routine works only for pages that do not contain overflow cells.
*/
#define findCell(P,I) \
  ((P)->aData + ((P)->maskPage & get2byte(&(P)->aData[(P)->cellOffset+2*(I)])))

/*
** This a more complex version of findCell() that works for
** pages that do contain overflow cells.  See insert
*/
static u8 *findOverflowCell(MemPage *pPage, int iCell){
  int i;
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  for(i=pPage->nOverflow-1; i>=0; i--){
    int k;
    struct _OvflCell *pOvfl;
    pOvfl = &pPage->aOvfl[i];
    k = pOvfl->idx;
    if( k<=iCell ){
      if( k==iCell ){
        return pOvfl->pCell;
      }
      iCell--;
    }
  }
  return findCell(pPage, iCell);
}

/*
** Parse a cell content block and fill in the CellInfo structure.  There
** are two versions of this function.  sqlite3BtreeParseCell() takes a 
** cell index as the second argument and sqlite3BtreeParseCellPtr() 
** takes a pointer to the body of the cell as its second argument.
**
** Within this file, the parseCell() macro can be called instead of
** sqlite3BtreeParseCellPtr(). Using some compilers, this will be faster.
*/
void sqlite3BtreeParseCellPtr(
  MemPage *pPage,         /* Page containing the cell */
  u8 *pCell,              /* Pointer to the cell text. */
  CellInfo *pInfo         /* Fill in this structure */
){
  int n;                  /* Number bytes in cell content header */
  u32 nPayload;           /* Number of bytes of cell payload */

  assert( sqlite3_mutex_held(pPage->pBt->mutex) );

  pInfo->pCell = pCell;
  assert( pPage->leaf==0 || pPage->leaf==1 );
  n = pPage->childPtrSize;
  assert( n==4-4*pPage->leaf );
  if( pPage->intKey ){
    if( pPage->hasData ){
      n += getVarint32(&pCell[n], nPayload);
    }else{
      nPayload = 0;
    }
    n += getVarint(&pCell[n], (u64*)&pInfo->nKey);
    pInfo->nData = nPayload;
  }else{
    pInfo->nData = 0;
    n += getVarint32(&pCell[n], nPayload);
    pInfo->nKey = nPayload;
  }
  pInfo->nPayload = nPayload;
  pInfo->nHeader = n;
  if( likely(nPayload<=pPage->maxLocal) ){
    /* This is the (easy) common case where the entire payload fits
    ** on the local page.  No overflow is required.
    */
    int nSize;          /* Total size of cell content in bytes */
    nSize = nPayload + n;
    pInfo->nLocal = nPayload;
    pInfo->iOverflow = 0;
    if( (nSize & ~3)==0 ){
      nSize = 4;        /* Minimum cell size is 4 */
    }
    pInfo->nSize = nSize;
  }else{
    /* If the payload will not fit completely on the local page, we have
    ** to decide how much to store locally and how much to spill onto
    ** overflow pages.  The strategy is to minimize the amount of unused
    ** space on overflow pages while keeping the amount of local storage
    ** in between minLocal and maxLocal.
    **
    ** Warning:  changing the way overflow payload is distributed in any
    ** way will result in an incompatible file format.
    */
    int minLocal;  /* Minimum amount of payload held locally */
    int maxLocal;  /* Maximum amount of payload held locally */
    int surplus;   /* Overflow payload available for local storage */

    minLocal = pPage->minLocal;
    maxLocal = pPage->maxLocal;
    surplus = minLocal + (nPayload - minLocal)%(pPage->pBt->usableSize - 4);
    if( surplus <= maxLocal ){
      pInfo->nLocal = surplus;
    }else{
      pInfo->nLocal = minLocal;
    }
    pInfo->iOverflow = pInfo->nLocal + n;
    pInfo->nSize = pInfo->iOverflow + 4;
  }
}
#define parseCell(pPage, iCell, pInfo) \
  sqlite3BtreeParseCellPtr((pPage), findCell((pPage), (iCell)), (pInfo))
void sqlite3BtreeParseCell(
  MemPage *pPage,         /* Page containing the cell */
  int iCell,              /* The cell index.  First cell is 0 */
  CellInfo *pInfo         /* Fill in this structure */
){
  parseCell(pPage, iCell, pInfo);
}

/*
** Compute the total number of bytes that a Cell needs in the cell
** data area of the btree-page.  The return number includes the cell
** data header and the local payload, but not any overflow page or
** the space used by the cell pointer.
*/
#ifndef NDEBUG
static u16 cellSize(MemPage *pPage, int iCell){
  CellInfo info;
  sqlite3BtreeParseCell(pPage, iCell, &info);
  return info.nSize;
}
#endif
static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
  CellInfo info;
  sqlite3BtreeParseCellPtr(pPage, pCell, &info);
  return info.nSize;
}

#ifndef SQLITE_OMIT_AUTOVACUUM
/*
** If the cell pCell, part of page pPage contains a pointer
** to an overflow page, insert an entry into the pointer-map
** for the overflow page.
*/
static int ptrmapPutOvflPtr(MemPage *pPage, u8 *pCell){
  CellInfo info;
  assert( pCell!=0 );
  sqlite3BtreeParseCellPtr(pPage, pCell, &info);
  assert( (info.nData+(pPage->intKey?0:info.nKey))==info.nPayload );
  if( (info.nData+(pPage->intKey?0:info.nKey))>info.nLocal ){
    Pgno ovfl = get4byte(&pCell[info.iOverflow]);
    return ptrmapPut(pPage->pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno);
  }
  return SQLITE_OK;
}
/*
** If the cell with index iCell on page pPage contains a pointer
** to an overflow page, insert an entry into the pointer-map
** for the overflow page.
*/
static int ptrmapPutOvfl(MemPage *pPage, int iCell){
  u8 *pCell;
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  pCell = findOverflowCell(pPage, iCell);
  return ptrmapPutOvflPtr(pPage, pCell);
}
#endif


/*
** Defragment the page given.  All Cells are moved to the
** end of the page and all free space is collected into one
** big FreeBlk that occurs in between the header and cell
** pointer array and the cell content area.
*/
static void defragmentPage(MemPage *pPage){
  int i;                     /* Loop counter */
  int pc;                    /* Address of a i-th cell */
  int addr;                  /* Offset of first byte after cell pointer array */
  int hdr;                   /* Offset to the page header */
  int size;                  /* Size of a cell */
  int usableSize;            /* Number of usable bytes on a page */
  int cellOffset;            /* Offset to the cell pointer array */
  int brk;                   /* Offset to the cell content area */
  int nCell;                 /* Number of cells on the page */
  unsigned char *data;       /* The page data */
  unsigned char *temp;       /* Temp area for cell content */

  assert( sqlite3PagerIswriteable(pPage->pDbPage) );
  assert( pPage->pBt!=0 );
  assert( pPage->pBt->usableSize <= SQLITE_MAX_PAGE_SIZE );
  assert( pPage->nOverflow==0 );
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  temp = sqlite3PagerTempSpace(pPage->pBt->pPager);
  data = pPage->aData;
  hdr = pPage->hdrOffset;
  cellOffset = pPage->cellOffset;
  nCell = pPage->nCell;
  assert( nCell==get2byte(&data[hdr+3]) );
  usableSize = pPage->pBt->usableSize;
  brk = get2byte(&data[hdr+5]);
  memcpy(&temp[brk], &data[brk], usableSize - brk);
  brk = usableSize;
  for(i=0; i<nCell; i++){
    u8 *pAddr;     /* The i-th cell pointer */
    pAddr = &data[cellOffset + i*2];
    pc = get2byte(pAddr);
    assert( pc<pPage->pBt->usableSize );
    size = cellSizePtr(pPage, &temp[pc]);
    brk -= size;
    memcpy(&data[brk], &temp[pc], size);
    put2byte(pAddr, brk);
  }
  assert( brk>=cellOffset+2*nCell );
  put2byte(&data[hdr+5], brk);
  data[hdr+1] = 0;
  data[hdr+2] = 0;
  data[hdr+7] = 0;
  addr = cellOffset+2*nCell;
  memset(&data[addr], 0, brk-addr);
}

/*
** Allocate nByte bytes of space on a page.
**
** Return the index into pPage->aData[] of the first byte of
** the new allocation.  The caller guarantees that there is enough
** space.  This routine will never fail.
**
** If the page contains nBytes of free space but does not contain
** nBytes of contiguous free space, then this routine automatically
** calls defragementPage() to consolidate all free space before 
** allocating the new chunk.
*/
static int allocateSpace(MemPage *pPage, int nByte){
  int addr, pc, hdr;
  int size;
  int nFrag;
  int top;
  int nCell;
  int cellOffset;
  unsigned char *data;
  
  data = pPage->aData;
  assert( sqlite3PagerIswriteable(pPage->pDbPage) );
  assert( pPage->pBt );
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  assert( nByte>=0 );  /* Minimum cell size is 4 */
  assert( pPage->nFree>=nByte );
  assert( pPage->nOverflow==0 );
  pPage->nFree -= nByte;
  hdr = pPage->hdrOffset;

  nFrag = data[hdr+7];
  if( nFrag<60 ){
    /* Search the freelist looking for a slot big enough to satisfy the
    ** space request. */
    addr = hdr+1;
    while( (pc = get2byte(&data[addr]))>0 ){
      size = get2byte(&data[pc+2]);
      if( size>=nByte ){
        if( size<nByte+4 ){
          memcpy(&data[addr], &data[pc], 2);
          data[hdr+7] = nFrag + size - nByte;
          return pc;
        }else{
          put2byte(&data[pc+2], size-nByte);
          return pc + size - nByte;
        }
      }
      addr = pc;
    }
  }

  /* Allocate memory from the gap in between the cell pointer array
  ** and the cell content area.
  */
  top = get2byte(&data[hdr+5]);
  nCell = get2byte(&data[hdr+3]);
  cellOffset = pPage->cellOffset;
  if( nFrag>=60 || cellOffset + 2*nCell > top - nByte ){
    defragmentPage(pPage);
    top = get2byte(&data[hdr+5]);
  }
  top -= nByte;
  assert( cellOffset + 2*nCell <= top );
  put2byte(&data[hdr+5], top);
  return top;
}

/*
** Return a section of the pPage->aData to the freelist.
** The first byte of the new free block is pPage->aDisk[start]
** and the size of the block is "size" bytes.
**
** Most of the effort here is involved in coalesing adjacent
** free blocks into a single big free block.
*/
static void freeSpace(MemPage *pPage, int start, int size){
  int addr, pbegin, hdr;
  unsigned char *data = pPage->aData;

  assert( pPage->pBt!=0 );
  assert( sqlite3PagerIswriteable(pPage->pDbPage) );
  assert( start>=pPage->hdrOffset+6+(pPage->leaf?0:4) );
  assert( (start + size)<=pPage->pBt->usableSize );
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  assert( size>=0 );   /* Minimum cell size is 4 */

#ifdef SQLITE_SECURE_DELETE
  /* Overwrite deleted information with zeros when the SECURE_DELETE 
  ** option is enabled at compile-time */
  memset(&data[start], 0, size);
#endif

  /* Add the space back into the linked list of freeblocks */
  hdr = pPage->hdrOffset;
  addr = hdr + 1;
  while( (pbegin = get2byte(&data[addr]))<start && pbegin>0 ){
    assert( pbegin<=pPage->pBt->usableSize-4 );
    assert( pbegin>addr );
    addr = pbegin;
  }
  assert( pbegin<=pPage->pBt->usableSize-4 );
  assert( pbegin>addr || pbegin==0 );
  put2byte(&data[addr], start);
  put2byte(&data[start], pbegin);
  put2byte(&data[start+2], size);
  pPage->nFree += size;

  /* Coalesce adjacent free blocks */
  addr = pPage->hdrOffset + 1;
  while( (pbegin = get2byte(&data[addr]))>0 ){
    int pnext, psize;
    assert( pbegin>addr );
    assert( pbegin<=pPage->pBt->usableSize-4 );
    pnext = get2byte(&data[pbegin]);
    psize = get2byte(&data[pbegin+2]);
    if( pbegin + psize + 3 >= pnext && pnext>0 ){
      int frag = pnext - (pbegin+psize);
      assert( frag<=data[pPage->hdrOffset+7] );
      data[pPage->hdrOffset+7] -= frag;
      put2byte(&data[pbegin], get2byte(&data[pnext]));
      put2byte(&data[pbegin+2], pnext+get2byte(&data[pnext+2])-pbegin);
    }else{
      addr = pbegin;
    }
  }

  /* If the cell content area begins with a freeblock, remove it. */
  if( data[hdr+1]==data[hdr+5] && data[hdr+2]==data[hdr+6] ){
    int top;
    pbegin = get2byte(&data[hdr+1]);
    memcpy(&data[hdr+1], &data[pbegin], 2);
    top = get2byte(&data[hdr+5]);
    put2byte(&data[hdr+5], top + get2byte(&data[pbegin+2]));
  }
}

/*
** Decode the flags byte (the first byte of the header) for a page
** and initialize fields of the MemPage structure accordingly.
**
** Only the following combinations are supported.  Anything different
** indicates a corrupt database files:
**
**         PTF_ZERODATA
**         PTF_ZERODATA | PTF_LEAF
**         PTF_LEAFDATA | PTF_INTKEY
**         PTF_LEAFDATA | PTF_INTKEY | PTF_LEAF
*/
static int decodeFlags(MemPage *pPage, int flagByte){
  BtShared *pBt;     /* A copy of pPage->pBt */

  assert( pPage->hdrOffset==(pPage->pgno==1 ? 100 : 0) );
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  pPage->leaf = flagByte>>3;  assert( PTF_LEAF == 1<<3 );
  flagByte &= ~PTF_LEAF;
  pPage->childPtrSize = 4-4*pPage->leaf;
  pBt = pPage->pBt;
  if( flagByte==(PTF_LEAFDATA | PTF_INTKEY) ){
    pPage->intKey = 1;
    pPage->hasData = pPage->leaf;
    pPage->maxLocal = pBt->maxLeaf;
    pPage->minLocal = pBt->minLeaf;
  }else if( flagByte==PTF_ZERODATA ){
    pPage->intKey = 0;
    pPage->hasData = 0;
    pPage->maxLocal = pBt->maxLocal;
    pPage->minLocal = pBt->minLocal;
  }else{
    return SQLITE_CORRUPT_BKPT;
  }
  return SQLITE_OK;
}

/*
** Initialize the auxiliary information for a disk block.
**
** The pParent parameter must be a pointer to the MemPage which
** is the parent of the page being initialized.  The root of a
** BTree has no parent and so for that page, pParent==NULL.
**
** Return SQLITE_OK on success.  If we see that the page does
** not contain a well-formed database page, then return 
** SQLITE_CORRUPT.  Note that a return of SQLITE_OK does not
** guarantee that the page is well-formed.  It only shows that
** we failed to detect any corruption.
*/
int sqlite3BtreeInitPage(
  MemPage *pPage,        /* The page to be initialized */
  MemPage *pParent       /* The parent.  Might be NULL */
){
  int pc;            /* Address of a freeblock within pPage->aData[] */
  int hdr;           /* Offset to beginning of page header */
  u8 *data;          /* Equal to pPage->aData */
  BtShared *pBt;        /* The main btree structure */
  int usableSize;    /* Amount of usable space on each page */
  int cellOffset;    /* Offset from start of page to first cell pointer */
  int nFree;         /* Number of unused bytes on the page */
  int top;           /* First byte of the cell content area */

  pBt = pPage->pBt;
  assert( pBt!=0 );
  assert( pParent==0 || pParent->pBt==pBt );
  assert( sqlite3_mutex_held(pBt->mutex) );
  assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) );
  assert( pPage == sqlite3PagerGetExtra(pPage->pDbPage) );
  assert( pPage->aData == sqlite3PagerGetData(pPage->pDbPage) );
  if( pPage->pParent!=pParent && (pPage->pParent!=0 || pPage->isInit) ){
    /* The parent page should never change unless the file is corrupt */
    return SQLITE_CORRUPT_BKPT;
  }
  if( pPage->isInit ) return SQLITE_OK;
  if( pPage->pParent==0 && pParent!=0 ){
    pPage->pParent = pParent;
    sqlite3PagerRef(pParent->pDbPage);
  }
  hdr = pPage->hdrOffset;
  data = pPage->aData;
  if( decodeFlags(pPage, data[hdr]) ) return SQLITE_CORRUPT_BKPT;
  assert( pBt->pageSize>=512 && pBt->pageSize<=32768 );
  pPage->maskPage = pBt->pageSize - 1;
  pPage->nOverflow = 0;
  pPage->idxShift = 0;
  usableSize = pBt->usableSize;
  pPage->cellOffset = cellOffset = hdr + 12 - 4*pPage->leaf;
  top = get2byte(&data[hdr+5]);
  pPage->nCell = get2byte(&data[hdr+3]);
  if( pPage->nCell>MX_CELL(pBt) ){
    /* To many cells for a single page.  The page must be corrupt */
    return SQLITE_CORRUPT_BKPT;
  }
  if( pPage->nCell==0 && pParent!=0 && pParent->pgno!=1 ){
    /* All pages must have at least one cell, except for root pages */
    return SQLITE_CORRUPT_BKPT;
  }

  /* Compute the total free space on the page */
  pc = get2byte(&data[hdr+1]);
  nFree = data[hdr+7] + top - (cellOffset + 2*pPage->nCell);
  while( pc>0 ){
    int next, size;
    if( pc>usableSize-4 ){
      /* Free block is off the page */
      return SQLITE_CORRUPT_BKPT; 
    }
    next = get2byte(&data[pc]);
    size = get2byte(&data[pc+2]);
    if( next>0 && next<=pc+size+3 ){
      /* Free blocks must be in accending order */
      return SQLITE_CORRUPT_BKPT; 
    }
    nFree += size;
    pc = next;
  }
  pPage->nFree = nFree;
  if( nFree>=usableSize ){
    /* Free space cannot exceed total page size */
    return SQLITE_CORRUPT_BKPT; 
  }

#if 0
  /* Check that all the offsets in the cell offset array are within range. 
  ** 
  ** Omitting this consistency check and using the pPage->maskPage mask
  ** to prevent overrunning the page buffer in findCell() results in a
  ** 2.5% performance gain.
  */
  {
    u8 *pOff;        /* Iterator used to check all cell offsets are in range */
    u8 *pEnd;        /* Pointer to end of cell offset array */
    u8 mask;         /* Mask of bits that must be zero in MSB of cell offsets */
    mask = ~(((u8)(pBt->pageSize>>8))-1);
    pEnd = &data[cellOffset + pPage->nCell*2];
    for(pOff=&data[cellOffset]; pOff!=pEnd && !((*pOff)&mask); pOff+=2);
    if( pOff!=pEnd ){
      return SQLITE_CORRUPT_BKPT;
    }
  }
#endif

  pPage->isInit = 1;
  return SQLITE_OK;
}

/*
** Set up a raw page so that it looks like a database page holding
** no entries.
*/
static void zeroPage(MemPage *pPage, int flags){
  unsigned char *data = pPage->aData;
  BtShared *pBt = pPage->pBt;
  int hdr = pPage->hdrOffset;
  int first;

  assert( sqlite3PagerPagenumber(pPage->pDbPage)==pPage->pgno );
  assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage );
  assert( sqlite3PagerGetData(pPage->pDbPage) == data );
  assert( sqlite3PagerIswriteable(pPage->pDbPage) );
  assert( sqlite3_mutex_held(pBt->mutex) );
  /*memset(&data[hdr], 0, pBt->usableSize - hdr);*/
  data[hdr] = flags;
  first = hdr + 8 + 4*((flags&PTF_LEAF)==0);
  memset(&data[hdr+1], 0, 4);
  data[hdr+7] = 0;
  put2byte(&data[hdr+5], pBt->usableSize);
  pPage->nFree = pBt->usableSize - first;
  decodeFlags(pPage, flags);
  pPage->hdrOffset = hdr;
  pPage->cellOffset = first;
  pPage->nOverflow = 0;
  assert( pBt->pageSize>=512 && pBt->pageSize<=32768 );
  pPage->maskPage = pBt->pageSize - 1;
  pPage->idxShift = 0;
  pPage->nCell = 0;
  pPage->isInit = 1;
}

/*
** Get a page from the pager.  Initialize the MemPage.pBt and
** MemPage.aData elements if needed.
**
** If the noContent flag is set, it means that we do not care about
** the content of the page at this time.  So do not go to the disk
** to fetch the content.  Just fill in the content with zeros for now.
** If in the future we call sqlite3PagerWrite() on this page, that
** means we have started to be concerned about content and the disk
** read should occur at that point.
*/
int sqlite3BtreeGetPage(
  BtShared *pBt,       /* The btree */
  Pgno pgno,           /* Number of the page to fetch */
  MemPage **ppPage,    /* Return the page in this parameter */
  int noContent        /* Do not load page content if true */
){
  int rc;
  MemPage *pPage;
  DbPage *pDbPage;

  assert( sqlite3_mutex_held(pBt->mutex) );
  rc = sqlite3PagerAcquire(pBt->pPager, pgno, (DbPage**)&pDbPage, noContent);
  if( rc ) return rc;
  pPage = (MemPage *)sqlite3PagerGetExtra(pDbPage);
  pPage->aData = sqlite3PagerGetData(pDbPage);
  pPage->pDbPage = pDbPage;
  pPage->pBt = pBt;
  pPage->pgno = pgno;
  pPage->hdrOffset = pPage->pgno==1 ? 100 : 0;
  *ppPage = pPage;
  return SQLITE_OK;
}

/*
** Get a page from the pager and initialize it.  This routine
** is just a convenience wrapper around separate calls to
** sqlite3BtreeGetPage() and sqlite3BtreeInitPage().
*/
static int getAndInitPage(
  BtShared *pBt,          /* The database file */
  Pgno pgno,           /* Number of the page to get */
  MemPage **ppPage,    /* Write the page pointer here */
  MemPage *pParent     /* Parent of the page */
){
  int rc;
  assert( sqlite3_mutex_held(pBt->mutex) );
  if( pgno==0 ){
    return SQLITE_CORRUPT_BKPT; 
  }
  rc = sqlite3BtreeGetPage(pBt, pgno, ppPage, 0);
  if( rc==SQLITE_OK && (*ppPage)->isInit==0 ){
    rc = sqlite3BtreeInitPage(*ppPage, pParent);
    if( rc!=SQLITE_OK ){
      releasePage(*ppPage);
      *ppPage = 0;
    }
  }
  return rc;
}

/*
** Release a MemPage.  This should be called once for each prior
** call to sqlite3BtreeGetPage.
*/
static void releasePage(MemPage *pPage){
  if( pPage ){
    assert( pPage->aData );
    assert( pPage->pBt );
    assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage );
    assert( sqlite3PagerGetData(pPage->pDbPage)==pPage->aData );
    assert( sqlite3_mutex_held(pPage->pBt->mutex) );
    sqlite3PagerUnref(pPage->pDbPage);
  }
}

/*
** This routine is called when the reference count for a page
** reaches zero.  We need to unref the pParent pointer when that
** happens.
*/
static void pageDestructor(DbPage *pData, int pageSize){
  MemPage *pPage;
  assert( (pageSize & 7)==0 );
  pPage = (MemPage *)sqlite3PagerGetExtra(pData);
  assert( pPage->isInit==0 || sqlite3_mutex_held(pPage->pBt->mutex) );
  if( pPage->pParent ){
    MemPage *pParent = pPage->pParent;
    assert( pParent->pBt==pPage->pBt );
    pPage->pParent = 0;
    releasePage(pParent);
  }
  pPage->isInit = 0;
}

/*
** During a rollback, when the pager reloads information into the cache
** so that the cache is restored to its original state at the start of
** the transaction, for each page restored this routine is called.
**
** This routine needs to reset the extra data section at the end of the
** page to agree with the restored data.
*/
static void pageReinit(DbPage *pData, int pageSize){
  MemPage *pPage;
  assert( (pageSize & 7)==0 );
  pPage = (MemPage *)sqlite3PagerGetExtra(pData);
  if( pPage->isInit ){
    assert( sqlite3_mutex_held(pPage->pBt->mutex) );
    pPage->isInit = 0;
    sqlite3BtreeInitPage(pPage, pPage->pParent);
  }
}

/*
** Invoke the busy handler for a btree.
*/
static int sqlite3BtreeInvokeBusyHandler(void *pArg, int n){
  BtShared *pBt = (BtShared*)pArg;
  assert( pBt->db );
  assert( sqlite3_mutex_held(pBt->db->mutex) );
  return sqlite3InvokeBusyHandler(&pBt->db->busyHandler);
}

/*
** Open a database file.
** 
** zFilename is the name of the database file.  If zFilename is NULL
** a new database with a random name is created.  This randomly named
** database file will be deleted when sqlite3BtreeClose() is called.
** If zFilename is ":memory:" then an in-memory database is created
** that is automatically destroyed when it is closed.
*/
int sqlite3BtreeOpen(
  const char *zFilename,  /* Name of the file containing the BTree database */
  sqlite3 *db,            /* Associated database handle */
  Btree **ppBtree,        /* Pointer to new Btree object written here */
  int flags,              /* Options */
  int vfsFlags            /* Flags passed through to sqlite3_vfs.xOpen() */
){
  sqlite3_vfs *pVfs;      /* The VFS to use for this btree */
  BtShared *pBt = 0;      /* Shared part of btree structure */
  Btree *p;               /* Handle to return */
  int rc = SQLITE_OK;
  int nReserve;
  unsigned char zDbHeader[100];

  /* Set the variable isMemdb to true for an in-memory database, or 
  ** false for a file-based database. This symbol is only required if
  ** either of the shared-data or autovacuum features are compiled 
  ** into the library.
  */
#if !defined(SQLITE_OMIT_SHARED_CACHE) || !defined(SQLITE_OMIT_AUTOVACUUM)
  #ifdef SQLITE_OMIT_MEMORYDB
    const int isMemdb = 0;
  #else
    const int isMemdb = zFilename && !strcmp(zFilename, ":memory:");
  #endif
#endif

  assert( db!=0 );
  assert( sqlite3_mutex_held(db->mutex) );

  pVfs = db->pVfs;
  p = sqlite3MallocZero(sizeof(Btree));
  if( !p ){
    return SQLITE_NOMEM;
  }
  p->inTrans = TRANS_NONE;
  p->db = db;

#if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO)
  /*
  ** If this Btree is a candidate for shared cache, try to find an
  ** existing BtShared object that we can share with
  */
  if( isMemdb==0
   && (db->flags & SQLITE_Vtab)==0
   && zFilename && zFilename[0]
  ){
    if( sqlite3SharedCacheEnabled ){
      int nFullPathname = pVfs->mxPathname+1;
      char *zFullPathname = sqlite3Malloc(nFullPathname);
      sqlite3_mutex *mutexShared;
      p->sharable = 1;
      db->flags |= SQLITE_SharedCache;
      if( !zFullPathname ){
        sqlite3_free(p);
        return SQLITE_NOMEM;
      }
      sqlite3OsFullPathname(pVfs, zFilename, nFullPathname, zFullPathname);
      mutexShared = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
      sqlite3_mutex_enter(mutexShared);
      for(pBt=sqlite3SharedCacheList; pBt; pBt=pBt->pNext){
        assert( pBt->nRef>0 );
        if( 0==strcmp(zFullPathname, sqlite3PagerFilename(pBt->pPager))
                 && sqlite3PagerVfs(pBt->pPager)==pVfs ){
          p->pBt = pBt;
          pBt->nRef++;
          break;
        }
      }
      sqlite3_mutex_leave(mutexShared);
      sqlite3_free(zFullPathname);
    }
#ifdef SQLITE_DEBUG
    else{
      /* In debug mode, we mark all persistent databases as sharable
      ** even when they are not.  This exercises the locking code and
      ** gives more opportunity for asserts(sqlite3_mutex_held())
      ** statements to find locking problems.
      */
      p->sharable = 1;
    }
#endif
  }
#endif
  if( pBt==0 ){
    /*
    ** The following asserts make sure that structures used by the btree are
    ** the right size.  This is to guard against size changes that result
    ** when compiling on a different architecture.
    */
    assert( sizeof(i64)==8 || sizeof(i64)==4 );
    assert( sizeof(u64)==8 || sizeof(u64)==4 );
    assert( sizeof(u32)==4 );
    assert( sizeof(u16)==2 );
    assert( sizeof(Pgno)==4 );
  
    pBt = sqlite3MallocZero( sizeof(*pBt) );
    if( pBt==0 ){
      rc = SQLITE_NOMEM;
      goto btree_open_out;
    }
    pBt->busyHdr.xFunc = sqlite3BtreeInvokeBusyHandler;
    pBt->busyHdr.pArg = pBt;
    rc = sqlite3PagerOpen(pVfs, &pBt->pPager, zFilename,
                          EXTRA_SIZE, flags, vfsFlags);
    if( rc==SQLITE_OK ){
      rc = sqlite3PagerReadFileheader(pBt->pPager,sizeof(zDbHeader),zDbHeader);
    }
    if( rc!=SQLITE_OK ){
      goto btree_open_out;
    }
    sqlite3PagerSetBusyhandler(pBt->pPager, &pBt->busyHdr);
    p->pBt = pBt;
  
    sqlite3PagerSetDestructor(pBt->pPager, pageDestructor);
    sqlite3PagerSetReiniter(pBt->pPager, pageReinit);
    pBt->pCursor = 0;
    pBt->pPage1 = 0;
    pBt->readOnly = sqlite3PagerIsreadonly(pBt->pPager);
    pBt->pageSize = get2byte(&zDbHeader[16]);
    if( pBt->pageSize<512 || pBt->pageSize>SQLITE_MAX_PAGE_SIZE
         || ((pBt->pageSize-1)&pBt->pageSize)!=0 ){
      pBt->pageSize = 0;
      sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize);
#ifndef SQLITE_OMIT_AUTOVACUUM
      /* If the magic name ":memory:" will create an in-memory database, then
      ** leave the autoVacuum mode at 0 (do not auto-vacuum), even if
      ** SQLITE_DEFAULT_AUTOVACUUM is true. On the other hand, if
      ** SQLITE_OMIT_MEMORYDB has been defined, then ":memory:" is just a
      ** regular file-name. In this case the auto-vacuum applies as per normal.
      */
      if( zFilename && !isMemdb ){
        pBt->autoVacuum = (SQLITE_DEFAULT_AUTOVACUUM ? 1 : 0);
        pBt->incrVacuum = (SQLITE_DEFAULT_AUTOVACUUM==2 ? 1 : 0);
      }
#endif
      nReserve = 0;
    }else{
      nReserve = zDbHeader[20];
      pBt->pageSizeFixed = 1;
#ifndef SQLITE_OMIT_AUTOVACUUM
      pBt->autoVacuum = (get4byte(&zDbHeader[36 + 4*4])?1:0);
      pBt->incrVacuum = (get4byte(&zDbHeader[36 + 7*4])?1:0);
#endif
    }
    pBt->usableSize = pBt->pageSize - nReserve;
    assert( (pBt->pageSize & 7)==0 );  /* 8-byte alignment of pageSize */
    sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize);
   
#if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO)
    /* Add the new BtShared object to the linked list sharable BtShareds.
    */
    if( p->sharable ){
      sqlite3_mutex *mutexShared;
      pBt->nRef = 1;
      mutexShared = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
      if( SQLITE_THREADSAFE && sqlite3Config.bCoreMutex ){
        pBt->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_FAST);
        if( pBt->mutex==0 ){
          rc = SQLITE_NOMEM;
          db->mallocFailed = 0;
          goto btree_open_out;
        }
      }
      sqlite3_mutex_enter(mutexShared);
      pBt->pNext = sqlite3SharedCacheList;
      sqlite3SharedCacheList = pBt;
      sqlite3_mutex_leave(mutexShared);
    }
#endif
  }

#if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO)
  /* If the new Btree uses a sharable pBtShared, then link the new
  ** Btree into the list of all sharable Btrees for the same connection.
  ** The list is kept in ascending order by pBt address.
  */
  if( p->sharable ){
    int i;
    Btree *pSib;
    for(i=0; i<db->nDb; i++){
      if( (pSib = db->aDb[i].pBt)!=0 && pSib->sharable ){
        while( pSib->pPrev ){ pSib = pSib->pPrev; }
        if( p->pBt<pSib->pBt ){
          p->pNext = pSib;
          p->pPrev = 0;
          pSib->pPrev = p;
        }else{
          while( pSib->pNext && pSib->pNext->pBt<p->pBt ){
            pSib = pSib->pNext;
          }
          p->pNext = pSib->pNext;
          p->pPrev = pSib;
          if( p->pNext ){
            p->pNext->pPrev = p;
          }
          pSib->pNext = p;
        }
        break;
      }
    }
  }
#endif
  *ppBtree = p;

btree_open_out:
  if( rc!=SQLITE_OK ){
    if( pBt && pBt->pPager ){
      sqlite3PagerClose(pBt->pPager);
    }
    sqlite3_free(pBt);
    sqlite3_free(p);
    *ppBtree = 0;
  }
  return rc;
}

/*
** Decrement the BtShared.nRef counter.  When it reaches zero,
** remove the BtShared structure from the sharing list.  Return
** true if the BtShared.nRef counter reaches zero and return
** false if it is still positive.
*/
static int removeFromSharingList(BtShared *pBt){
#ifndef SQLITE_OMIT_SHARED_CACHE
  sqlite3_mutex *pMaster;
  BtShared *pList;
  int removed = 0;

  assert( sqlite3_mutex_notheld(pBt->mutex) );
  pMaster = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
  sqlite3_mutex_enter(pMaster);
  pBt->nRef--;
  if( pBt->nRef<=0 ){
    if( sqlite3SharedCacheList==pBt ){
      sqlite3SharedCacheList = pBt->pNext;
    }else{
      pList = sqlite3SharedCacheList;
      while( ALWAYS(pList) && pList->pNext!=pBt ){
        pList=pList->pNext;
      }
      if( ALWAYS(pList) ){
        pList->pNext = pBt->pNext;
      }
    }
    if( SQLITE_THREADSAFE ){
      sqlite3_mutex_free(pBt->mutex);
    }
    removed = 1;
  }
  sqlite3_mutex_leave(pMaster);
  return removed;
#else
  return 1;
#endif
}

/*
** Make sure pBt->pTmpSpace points to an allocation of 
** MX_CELL_SIZE(pBt) bytes.
*/
static void allocateTempSpace(BtShared *pBt){
  if( !pBt->pTmpSpace ){
    pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize );
  }
}

/*
** Free the pBt->pTmpSpace allocation
*/
static void freeTempSpace(BtShared *pBt){
  sqlite3PageFree( pBt->pTmpSpace);
  pBt->pTmpSpace = 0;
}

/*
** Close an open database and invalidate all cursors.
*/
int sqlite3BtreeClose(Btree *p){
  BtShared *pBt = p->pBt;
  BtCursor *pCur;

  /* Close all cursors opened via this handle.  */
  assert( sqlite3_mutex_held(p->db->mutex) );
  sqlite3BtreeEnter(p);
  pBt->db = p->db;
  pCur = pBt->pCursor;
  while( pCur ){
    BtCursor *pTmp = pCur;
    pCur = pCur->pNext;
    if( pTmp->pBtree==p ){
      sqlite3BtreeCloseCursor(pTmp);
    }
  }

  /* Rollback any active transaction and free the handle structure.
  ** The call to sqlite3BtreeRollback() drops any table-locks held by
  ** this handle.
  */
  sqlite3BtreeRollback(p);
  sqlite3BtreeLeave(p);

  /* If there are still other outstanding references to the shared-btree
  ** structure, return now. The remainder of this procedure cleans 
  ** up the shared-btree.
  */
  assert( p->wantToLock==0 && p->locked==0 );
  if( !p->sharable || removeFromSharingList(pBt) ){
    /* The pBt is no longer on the sharing list, so we can access
    ** it without having to hold the mutex.
    **
    ** Clean out and delete the BtShared object.
    */
    assert( !pBt->pCursor );
    sqlite3PagerClose(pBt->pPager);
    if( pBt->xFreeSchema && pBt->pSchema ){
      pBt->xFreeSchema(pBt->pSchema);
    }
    sqlite3_free(pBt->pSchema);
    freeTempSpace(pBt);
    sqlite3_free(pBt);
  }

#ifndef SQLITE_OMIT_SHARED_CACHE
  assert( p->wantToLock==0 );
  assert( p->locked==0 );
  if( p->pPrev ) p->pPrev->pNext = p->pNext;
  if( p->pNext ) p->pNext->pPrev = p->pPrev;
#endif

  sqlite3_free(p);
  return SQLITE_OK;
}

/*
** Change the limit on the number of pages allowed in the cache.
**
** The maximum number of cache pages is set to the absolute
** value of mxPage.  If mxPage is negative, the pager will
** operate asynchronously - it will not stop to do fsync()s
** to insure data is written to the disk surface before
** continuing.  Transactions still work if synchronous is off,
** and the database cannot be corrupted if this program
** crashes.  But if the operating system crashes or there is
** an abrupt power failure when synchronous is off, the database
** could be left in an inconsistent and unrecoverable state.
** Synchronous is on by default so database corruption is not
** normally a worry.
*/
int sqlite3BtreeSetCacheSize(Btree *p, int mxPage){
  BtShared *pBt = p->pBt;
  assert( sqlite3_mutex_held(p->db->mutex) );
  sqlite3BtreeEnter(p);
  sqlite3PagerSetCachesize(pBt->pPager, mxPage);
  sqlite3BtreeLeave(p);
  return SQLITE_OK;
}

/*
** Change the way data is synced to disk in order to increase or decrease
** how well the database resists damage due to OS crashes and power
** failures.  Level 1 is the same as asynchronous (no syncs() occur and
** there is a high probability of damage)  Level 2 is the default.  There
** is a very low but non-zero probability of damage.  Level 3 reduces the
** probability of damage to near zero but with a write performance reduction.
*/
#ifndef SQLITE_OMIT_PAGER_PRAGMAS
int sqlite3BtreeSetSafetyLevel(Btree *p, int level, int fullSync){
  BtShared *pBt = p->pBt;
  assert( sqlite3_mutex_held(p->db->mutex) );
  sqlite3BtreeEnter(p);
  sqlite3PagerSetSafetyLevel(pBt->pPager, level, fullSync);
  sqlite3BtreeLeave(p);
  return SQLITE_OK;
}
#endif

/*
** Return TRUE if the given btree is set to safety level 1.  In other
** words, return TRUE if no sync() occurs on the disk files.
*/
int sqlite3BtreeSyncDisabled(Btree *p){
  BtShared *pBt = p->pBt;
  int rc;
  assert( sqlite3_mutex_held(p->db->mutex) );  
  sqlite3BtreeEnter(p);
  assert( pBt && pBt->pPager );
  rc = sqlite3PagerNosync(pBt->pPager);
  sqlite3BtreeLeave(p);
  return rc;
}

#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) || !defined(SQLITE_OMIT_VACUUM)
/*
** Change the default pages size and the number of reserved bytes per page.
**
** The page size must be a power of 2 between 512 and 65536.  If the page
** size supplied does not meet this constraint then the page size is not
** changed.
**
** Page sizes are constrained to be a power of two so that the region
** of the database file used for locking (beginning at PENDING_BYTE,
** the first byte past the 1GB boundary, 0x40000000) needs to occur
** at the beginning of a page.
**
** If parameter nReserve is less than zero, then the number of reserved
** bytes per page is left unchanged.
*/
int sqlite3BtreeSetPageSize(Btree *p, int pageSize, int nReserve){
  int rc = SQLITE_OK;
  BtShared *pBt = p->pBt;
  sqlite3BtreeEnter(p);
  if( pBt->pageSizeFixed ){
    sqlite3BtreeLeave(p);
    return SQLITE_READONLY;
  }
  if( nReserve<0 ){
    nReserve = pBt->pageSize - pBt->usableSize;
  }
  if( pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE &&
        ((pageSize-1)&pageSize)==0 ){
    assert( (pageSize & 7)==0 );
    assert( !pBt->pPage1 && !pBt->pCursor );
    pBt->pageSize = pageSize;
    freeTempSpace(pBt);
    rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize);
  }
  pBt->usableSize = pBt->pageSize - nReserve;
  sqlite3BtreeLeave(p);
  return rc;
}

/*
** Return the currently defined page size
*/
int sqlite3BtreeGetPageSize(Btree *p){
  return p->pBt->pageSize;
}
int sqlite3BtreeGetReserve(Btree *p){
  int n;
  sqlite3BtreeEnter(p);
  n = p->pBt->pageSize - p->pBt->usableSize;
  sqlite3BtreeLeave(p);
  return n;
}

/*
** Set the maximum page count for a database if mxPage is positive.
** No changes are made if mxPage is 0 or negative.
** Regardless of the value of mxPage, return the maximum page count.
*/
int sqlite3BtreeMaxPageCount(Btree *p, int mxPage){
  int n;
  sqlite3BtreeEnter(p);
  n = sqlite3PagerMaxPageCount(p->pBt->pPager, mxPage);
  sqlite3BtreeLeave(p);
  return n;
}
#endif /* !defined(SQLITE_OMIT_PAGER_PRAGMAS) || !defined(SQLITE_OMIT_VACUUM) */

/*
** Change the 'auto-vacuum' property of the database. If the 'autoVacuum'
** parameter is non-zero, then auto-vacuum mode is enabled. If zero, it
** is disabled. The default value for the auto-vacuum property is 
** determined by the SQLITE_DEFAULT_AUTOVACUUM macro.
*/
int sqlite3BtreeSetAutoVacuum(Btree *p, int autoVacuum){
#ifdef SQLITE_OMIT_AUTOVACUUM
  return SQLITE_READONLY;
#else
  BtShared *pBt = p->pBt;
  int rc = SQLITE_OK;
  int av = (autoVacuum?1:0);

  sqlite3BtreeEnter(p);
  if( pBt->pageSizeFixed && av!=pBt->autoVacuum ){
    rc = SQLITE_READONLY;
  }else{
    pBt->autoVacuum = av;
  }
  sqlite3BtreeLeave(p);
  return rc;
#endif
}

/*
** Return the value of the 'auto-vacuum' property. If auto-vacuum is 
** enabled 1 is returned. Otherwise 0.
*/
int sqlite3BtreeGetAutoVacuum(Btree *p){
#ifdef SQLITE_OMIT_AUTOVACUUM
  return BTREE_AUTOVACUUM_NONE;
#else
  int rc;
  sqlite3BtreeEnter(p);
  rc = (
    (!p->pBt->autoVacuum)?BTREE_AUTOVACUUM_NONE:
    (!p->pBt->incrVacuum)?BTREE_AUTOVACUUM_FULL:
    BTREE_AUTOVACUUM_INCR
  );
  sqlite3BtreeLeave(p);
  return rc;
#endif
}


/*
** Get a reference to pPage1 of the database file.  This will
** also acquire a readlock on that file.
**
** SQLITE_OK is returned on success.  If the file is not a
** well-formed database file, then SQLITE_CORRUPT is returned.
** SQLITE_BUSY is returned if the database is locked.  SQLITE_NOMEM
** is returned if we run out of memory. 
*/
static int lockBtree(BtShared *pBt){
  int rc;
  MemPage *pPage1;
  int nPage;

  assert( sqlite3_mutex_held(pBt->mutex) );
  if( pBt->pPage1 ) return SQLITE_OK;
  rc = sqlite3BtreeGetPage(pBt, 1, &pPage1, 0);
  if( rc!=SQLITE_OK ) return rc;

  /* Do some checking to help insure the file we opened really is
  ** a valid database file. 
  */
  rc = sqlite3PagerPagecount(pBt->pPager, &nPage);
  if( rc!=SQLITE_OK ){
    goto page1_init_failed;
  }else if( nPage>0 ){
    int pageSize;
    int usableSize;
    u8 *page1 = pPage1->aData;
    rc = SQLITE_NOTADB;
    if( memcmp(page1, zMagicHeader, 16)!=0 ){
      goto page1_init_failed;
    }
    if( page1[18]>1 ){
      pBt->readOnly = 1;
    }
    if( page1[19]>1 ){
      goto page1_init_failed;
    }

    /* The maximum embedded fraction must be exactly 25%.  And the minimum
    ** embedded fraction must be 12.5% for both leaf-data and non-leaf-data.
    ** The original design allowed these amounts to vary, but as of
    ** version 3.6.0, we require them to be fixed.
    */
    if( memcmp(&page1[21], "\100\040\040",3)!=0 ){
      goto page1_init_failed;
    }
    pageSize = get2byte(&page1[16]);
    if( ((pageSize-1)&pageSize)!=0 || pageSize<512 ||
        (SQLITE_MAX_PAGE_SIZE<32768 && pageSize>SQLITE_MAX_PAGE_SIZE)
    ){
      goto page1_init_failed;
    }
    assert( (pageSize & 7)==0 );
    usableSize = pageSize - page1[20];
    if( pageSize!=pBt->pageSize ){
      /* After reading the first page of the database assuming a page size
      ** of BtShared.pageSize, we have discovered that the page-size is
      ** actually pageSize. Unlock the database, leave pBt->pPage1 at
      ** zero and return SQLITE_OK. The caller will call this function
      ** again with the correct page-size.
      */
      releasePage(pPage1);
      pBt->usableSize = usableSize;
      pBt->pageSize = pageSize;
      freeTempSpace(pBt);
      sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize);
      return SQLITE_OK;
    }
    if( usableSize<500 ){
      goto page1_init_failed;
    }
    pBt->pageSize = pageSize;
    pBt->usableSize = usableSize;
#ifndef SQLITE_OMIT_AUTOVACUUM
    pBt->autoVacuum = (get4byte(&page1[36 + 4*4])?1:0);
    pBt->incrVacuum = (get4byte(&page1[36 + 7*4])?1:0);
#endif
  }

  /* maxLocal is the maximum amount of payload to store locally for
  ** a cell.  Make sure it is small enough so that at least minFanout
  ** cells can will fit on one page.  We assume a 10-byte page header.
  ** Besides the payload, the cell must store:
  **     2-byte pointer to the cell
  **     4-byte child pointer
  **     9-byte nKey value
  **     4-byte nData value
  **     4-byte overflow page pointer
  ** So a cell consists of a 2-byte poiner, a header which is as much as
  ** 17 bytes long, 0 to N bytes of payload, and an optional 4 byte overflow
  ** page pointer.
  */
  pBt->maxLocal = (pBt->usableSize-12)*64/255 - 23;
  pBt->minLocal = (pBt->usableSize-12)*32/255 - 23;
  pBt->maxLeaf = pBt->usableSize - 35;
  pBt->minLeaf = (pBt->usableSize-12)*32/255 - 23;
  assert( pBt->maxLeaf + 23 <= MX_CELL_SIZE(pBt) );
  pBt->pPage1 = pPage1;
  return SQLITE_OK;

page1_init_failed:
  releasePage(pPage1);
  pBt->pPage1 = 0;
  return rc;
}

/*
** This routine works like lockBtree() except that it also invokes the
** busy callback if there is lock contention.
*/
static int lockBtreeWithRetry(Btree *pRef){
  int rc = SQLITE_OK;

  assert( sqlite3BtreeHoldsMutex(pRef) );
  if( pRef->inTrans==TRANS_NONE ){
    u8 inTransaction = pRef->pBt->inTransaction;
    btreeIntegrity(pRef);
    rc = sqlite3BtreeBeginTrans(pRef, 0);
    pRef->pBt->inTransaction = inTransaction;
    pRef->inTrans = TRANS_NONE;
    if( rc==SQLITE_OK ){
      pRef->pBt->nTransaction--;
    }
    btreeIntegrity(pRef);
  }
  return rc;
}
       

/*
** If there are no outstanding cursors and we are not in the middle
** of a transaction but there is a read lock on the database, then
** this routine unrefs the first page of the database file which 
** has the effect of releasing the read lock.
**
** If there are any outstanding cursors, this routine is a no-op.
**
** If there is a transaction in progress, this routine is a no-op.
*/
static void unlockBtreeIfUnused(BtShared *pBt){
  assert( sqlite3_mutex_held(pBt->mutex) );
  if( pBt->inTransaction==TRANS_NONE && pBt->pCursor==0 && pBt->pPage1!=0 ){
    if( sqlite3PagerRefcount(pBt->pPager)>=1 ){
      assert( pBt->pPage1->aData );
#if 0
      if( pBt->pPage1->aData==0 ){
        MemPage *pPage = pBt->pPage1;
        pPage->aData = sqlite3PagerGetData(pPage->pDbPage);
        pPage->pBt = pBt;
        pPage->pgno = 1;
      }
#endif
      releasePage(pBt->pPage1);
    }
    pBt->pPage1 = 0;
    pBt->inStmt = 0;
  }
}

/*
** Create a new database by initializing the first page of the
** file.
*/
static int newDatabase(BtShared *pBt){
  MemPage *pP1;
  unsigned char *data;
  int rc;
  int nPage;

  assert( sqlite3_mutex_held(pBt->mutex) );
  rc = sqlite3PagerPagecount(pBt->pPager, &nPage);
  if( rc!=SQLITE_OK || nPage>0 ){
    return rc;
  }
  pP1 = pBt->pPage1;
  assert( pP1!=0 );
  data = pP1->aData;
  rc = sqlite3PagerWrite(pP1->pDbPage);
  if( rc ) return rc;
  memcpy(data, zMagicHeader, sizeof(zMagicHeader));
  assert( sizeof(zMagicHeader)==16 );
  put2byte(&data[16], pBt->pageSize);
  data[18] = 1;
  data[19] = 1;
  data[20] = pBt->pageSize - pBt->usableSize;
  data[21] = 64;
  data[22] = 32;
  data[23] = 32;
  memset(&data[24], 0, 100-24);
  zeroPage(pP1, PTF_INTKEY|PTF_LEAF|PTF_LEAFDATA );
  pBt->pageSizeFixed = 1;
#ifndef SQLITE_OMIT_AUTOVACUUM
  assert( pBt->autoVacuum==1 || pBt->autoVacuum==0 );
  assert( pBt->incrVacuum==1 || pBt->incrVacuum==0 );
  put4byte(&data[36 + 4*4], pBt->autoVacuum);
  put4byte(&data[36 + 7*4], pBt->incrVacuum);
#endif
  return SQLITE_OK;
}

/*
** Attempt to start a new transaction. A write-transaction
** is started if the second argument is nonzero, otherwise a read-
** transaction.  If the second argument is 2 or more and exclusive
** transaction is started, meaning that no other process is allowed
** to access the database.  A preexisting transaction may not be
** upgraded to exclusive by calling this routine a second time - the
** exclusivity flag only works for a new transaction.
**
** A write-transaction must be started before attempting any 
** changes to the database.  None of the following routines 
** will work unless a transaction is started first:
**
**      sqlite3BtreeCreateTable()
**      sqlite3BtreeCreateIndex()
**      sqlite3BtreeClearTable()
**      sqlite3BtreeDropTable()
**      sqlite3BtreeInsert()
**      sqlite3BtreeDelete()
**      sqlite3BtreeUpdateMeta()
**
** If an initial attempt to acquire the lock fails because of lock contention
** and the database was previously unlocked, then invoke the busy handler
** if there is one.  But if there was previously a read-lock, do not
** invoke the busy handler - just return SQLITE_BUSY.  SQLITE_BUSY is 
** returned when there is already a read-lock in order to avoid a deadlock.
**
** Suppose there are two processes A and B.  A has a read lock and B has
** a reserved lock.  B tries to promote to exclusive but is blocked because
** of A's read lock.  A tries to promote to reserved but is blocked by B.
** One or the other of the two processes must give way or there can be
** no progress.  By returning SQLITE_BUSY and not invoking the busy callback
** when A already has a read lock, we encourage A to give up and let B
** proceed.
*/
int sqlite3BtreeBeginTrans(Btree *p, int wrflag){
  BtShared *pBt = p->pBt;
  int rc = SQLITE_OK;

  sqlite3BtreeEnter(p);
  pBt->db = p->db;
  btreeIntegrity(p);

  /* If the btree is already in a write-transaction, or it
  ** is already in a read-transaction and a read-transaction
  ** is requested, this is a no-op.
  */
  if( p->inTrans==TRANS_WRITE || (p->inTrans==TRANS_READ && !wrflag) ){
    goto trans_begun;
  }

  /* Write transactions are not possible on a read-only database */
  if( pBt->readOnly && wrflag ){
    rc = SQLITE_READONLY;
    goto trans_begun;
  }

  /* If another database handle has already opened a write transaction 
  ** on this shared-btree structure and a second write transaction is
  ** requested, return SQLITE_BUSY.
  */
  if( pBt->inTransaction==TRANS_WRITE && wrflag ){
    rc = SQLITE_BUSY;
    goto trans_begun;
  }

#ifndef SQLITE_OMIT_SHARED_CACHE
  if( wrflag>1 ){
    BtLock *pIter;
    for(pIter=pBt->pLock; pIter; pIter=pIter->pNext){
      if( pIter->pBtree!=p ){
        rc = SQLITE_BUSY;
        goto trans_begun;
      }
    }
  }
#endif

  do {
    if( pBt->pPage1==0 ){
      do{
        rc = lockBtree(pBt);
      }while( pBt->pPage1==0 && rc==SQLITE_OK );
    }

    if( rc==SQLITE_OK && wrflag ){
      if( pBt->readOnly ){
        rc = SQLITE_READONLY;
      }else{
        rc = sqlite3PagerBegin(pBt->pPage1->pDbPage, wrflag>1);
        if( rc==SQLITE_OK ){
          rc = newDatabase(pBt);
        }
      }
    }
  
    if( rc==SQLITE_OK ){
      if( wrflag ) pBt->inStmt = 0;
    }else{
      unlockBtreeIfUnused(pBt);
    }
  }while( rc==SQLITE_BUSY && pBt->inTransaction==TRANS_NONE &&
          sqlite3BtreeInvokeBusyHandler(pBt, 0) );

  if( rc==SQLITE_OK ){
    if( p->inTrans==TRANS_NONE ){
      pBt->nTransaction++;
    }
    p->inTrans = (wrflag?TRANS_WRITE:TRANS_READ);
    if( p->inTrans>pBt->inTransaction ){
      pBt->inTransaction = p->inTrans;
    }
#ifndef SQLITE_OMIT_SHARED_CACHE
    if( wrflag>1 ){
      assert( !pBt->pExclusive );
      pBt->pExclusive = p;
    }
#endif
  }


trans_begun:
  btreeIntegrity(p);
  sqlite3BtreeLeave(p);
  return rc;
}

/*
** Return the size of the database file in pages.  Or return -1 if
** there is any kind of error.
*/
static int pagerPagecount(Pager *pPager){
  int rc;
  int nPage;
  rc = sqlite3PagerPagecount(pPager, &nPage);
  return (rc==SQLITE_OK?nPage:-1);
}


#ifndef SQLITE_OMIT_AUTOVACUUM

/*
** Set the pointer-map entries for all children of page pPage. Also, if
** pPage contains cells that point to overflow pages, set the pointer
** map entries for the overflow pages as well.
*/
static int setChildPtrmaps(MemPage *pPage){
  int i;                             /* Counter variable */
  int nCell;                         /* Number of cells in page pPage */
  int rc;                            /* Return code */
  BtShared *pBt = pPage->pBt;
  int isInitOrig = pPage->isInit;
  Pgno pgno = pPage->pgno;

  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  rc = sqlite3BtreeInitPage(pPage, pPage->pParent);
  if( rc!=SQLITE_OK ){
    goto set_child_ptrmaps_out;
  }
  nCell = pPage->nCell;

  for(i=0; i<nCell; i++){
    u8 *pCell = findCell(pPage, i);

    rc = ptrmapPutOvflPtr(pPage, pCell);
    if( rc!=SQLITE_OK ){
      goto set_child_ptrmaps_out;
    }

    if( !pPage->leaf ){
      Pgno childPgno = get4byte(pCell);
      rc = ptrmapPut(pBt, childPgno, PTRMAP_BTREE, pgno);
       if( rc!=SQLITE_OK ) goto set_child_ptrmaps_out;
    }
  }

  if( !pPage->leaf ){
    Pgno childPgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);
    rc = ptrmapPut(pBt, childPgno, PTRMAP_BTREE, pgno);
  }

set_child_ptrmaps_out:
  pPage->isInit = isInitOrig;
  return rc;
}

/*
** Somewhere on pPage, which is guarenteed to be a btree page, not an overflow
** page, is a pointer to page iFrom. Modify this pointer so that it points to
** iTo. Parameter eType describes the type of pointer to be modified, as 
** follows:
**
** PTRMAP_BTREE:     pPage is a btree-page. The pointer points at a child 
**                   page of pPage.
**
** PTRMAP_OVERFLOW1: pPage is a btree-page. The pointer points at an overflow
**                   page pointed to by one of the cells on pPage.
**
** PTRMAP_OVERFLOW2: pPage is an overflow-page. The pointer points at the next
**                   overflow page in the list.
*/
static int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType){
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  if( eType==PTRMAP_OVERFLOW2 ){
    /* The pointer is always the first 4 bytes of the page in this case.  */
    if( get4byte(pPage->aData)!=iFrom ){
      return SQLITE_CORRUPT_BKPT;
    }
    put4byte(pPage->aData, iTo);
  }else{
    int isInitOrig = pPage->isInit;
    int i;
    int nCell;

    sqlite3BtreeInitPage(pPage, 0);
    nCell = pPage->nCell;

    for(i=0; i<nCell; i++){
      u8 *pCell = findCell(pPage, i);
      if( eType==PTRMAP_OVERFLOW1 ){
        CellInfo info;
        sqlite3BtreeParseCellPtr(pPage, pCell, &info);
        if( info.iOverflow ){
          if( iFrom==get4byte(&pCell[info.iOverflow]) ){
            put4byte(&pCell[info.iOverflow], iTo);
            break;
          }
        }
      }else{
        if( get4byte(pCell)==iFrom ){
          put4byte(pCell, iTo);
          break;
        }
      }
    }
  
    if( i==nCell ){
      if( eType!=PTRMAP_BTREE || 
          get4byte(&pPage->aData[pPage->hdrOffset+8])!=iFrom ){
        return SQLITE_CORRUPT_BKPT;
      }
      put4byte(&pPage->aData[pPage->hdrOffset+8], iTo);
    }

    pPage->isInit = isInitOrig;
  }
  return SQLITE_OK;
}


/*
** Move the open database page pDbPage to location iFreePage in the 
** database. The pDbPage reference remains valid.
*/
static int relocatePage(
  BtShared *pBt,           /* Btree */
  MemPage *pDbPage,        /* Open page to move */
  u8 eType,                /* Pointer map 'type' entry for pDbPage */
  Pgno iPtrPage,           /* Pointer map 'page-no' entry for pDbPage */
  Pgno iFreePage,          /* The location to move pDbPage to */
  int isCommit
){
  MemPage *pPtrPage;   /* The page that contains a pointer to pDbPage */
  Pgno iDbPage = pDbPage->pgno;
  Pager *pPager = pBt->pPager;
  int rc;

  assert( eType==PTRMAP_OVERFLOW2 || eType==PTRMAP_OVERFLOW1 || 
      eType==PTRMAP_BTREE || eType==PTRMAP_ROOTPAGE );
  assert( sqlite3_mutex_held(pBt->mutex) );
  assert( pDbPage->pBt==pBt );

  /* Move page iDbPage from its current location to page number iFreePage */
  TRACE(("AUTOVACUUM: Moving %d to free page %d (ptr page %d type %d)\n", 
      iDbPage, iFreePage, iPtrPage, eType));
  rc = sqlite3PagerMovepage(pPager, pDbPage->pDbPage, iFreePage, isCommit);
  if( rc!=SQLITE_OK ){
    return rc;
  }
  pDbPage->pgno = iFreePage;

  /* If pDbPage was a btree-page, then it may have child pages and/or cells
  ** that point to overflow pages. The pointer map entries for all these
  ** pages need to be changed.
  **
  ** If pDbPage is an overflow page, then the first 4 bytes may store a
  ** pointer to a subsequent overflow page. If this is the case, then
  ** the pointer map needs to be updated for the subsequent overflow page.
  */
  if( eType==PTRMAP_BTREE || eType==PTRMAP_ROOTPAGE ){
    rc = setChildPtrmaps(pDbPage);
    if( rc!=SQLITE_OK ){
      return rc;
    }
  }else{
    Pgno nextOvfl = get4byte(pDbPage->aData);
    if( nextOvfl!=0 ){
      rc = ptrmapPut(pBt, nextOvfl, PTRMAP_OVERFLOW2, iFreePage);
      if( rc!=SQLITE_OK ){
        return rc;
      }
    }
  }

  /* Fix the database pointer on page iPtrPage that pointed at iDbPage so
  ** that it points at iFreePage. Also fix the pointer map entry for
  ** iPtrPage.
  */
  if( eType!=PTRMAP_ROOTPAGE ){
    rc = sqlite3BtreeGetPage(pBt, iPtrPage, &pPtrPage, 0);
    if( rc!=SQLITE_OK ){
      return rc;
    }
    rc = sqlite3PagerWrite(pPtrPage->pDbPage);
    if( rc!=SQLITE_OK ){
      releasePage(pPtrPage);
      return rc;
    }
    rc = modifyPagePointer(pPtrPage, iDbPage, iFreePage, eType);
    releasePage(pPtrPage);
    if( rc==SQLITE_OK ){
      rc = ptrmapPut(pBt, iFreePage, eType, iPtrPage);
    }
  }
  return rc;
}

/* Forward declaration required by incrVacuumStep(). */
static int allocateBtreePage(BtShared *, MemPage **, Pgno *, Pgno, u8);

/*
** Perform a single step of an incremental-vacuum. If successful,
** return SQLITE_OK. If there is no work to do (and therefore no
** point in calling this function again), return SQLITE_DONE.
**
** More specificly, this function attempts to re-organize the 
** database so that the last page of the file currently in use
** is no longer in use.
**
** If the nFin parameter is non-zero, the implementation assumes
** that the caller will keep calling incrVacuumStep() until
** it returns SQLITE_DONE or an error, and that nFin is the
** number of pages the database file will contain after this 
** process is complete.
*/
static int incrVacuumStep(BtShared *pBt, Pgno nFin){
  Pgno iLastPg;             /* Last page in the database */
  Pgno nFreeList;           /* Number of pages still on the free-list */

  assert( sqlite3_mutex_held(pBt->mutex) );
  iLastPg = pBt->nTrunc;
  if( iLastPg==0 ){
    iLastPg = pagerPagecount(pBt->pPager);
  }

  if( !PTRMAP_ISPAGE(pBt, iLastPg) && iLastPg!=PENDING_BYTE_PAGE(pBt) ){
    int rc;
    u8 eType;
    Pgno iPtrPage;

    nFreeList = get4byte(&pBt->pPage1->aData[36]);
    if( nFreeList==0 || nFin==iLastPg ){
      return SQLITE_DONE;
    }

    rc = ptrmapGet(pBt, iLastPg, &eType, &iPtrPage);
    if( rc!=SQLITE_OK ){
      return rc;
    }
    if( eType==PTRMAP_ROOTPAGE ){
      return SQLITE_CORRUPT_BKPT;
    }

    if( eType==PTRMAP_FREEPAGE ){
      if( nFin==0 ){
        /* Remove the page from the files free-list. This is not required
        ** if nFin is non-zero. In that case, the free-list will be
        ** truncated to zero after this function returns, so it doesn't 
        ** matter if it still contains some garbage entries.
        */
        Pgno iFreePg;
        MemPage *pFreePg;
        rc = allocateBtreePage(pBt, &pFreePg, &iFreePg, iLastPg, 1);
        if( rc!=SQLITE_OK ){
          return rc;
        }
        assert( iFreePg==iLastPg );
        releasePage(pFreePg);
      }
    } else {
      Pgno iFreePg;             /* Index of free page to move pLastPg to */
      MemPage *pLastPg;

      rc = sqlite3BtreeGetPage(pBt, iLastPg, &pLastPg, 0);
      if( rc!=SQLITE_OK ){
        return rc;
      }

      /* If nFin is zero, this loop runs exactly once and page pLastPg
      ** is swapped with the first free page pulled off the free list.
      **
      ** On the other hand, if nFin is greater than zero, then keep
      ** looping until a free-page located within the first nFin pages
      ** of the file is found.
      */
      do {
        MemPage *pFreePg;
        rc = allocateBtreePage(pBt, &pFreePg, &iFreePg, 0, 0);
        if( rc!=SQLITE_OK ){
          releasePage(pLastPg);
          return rc;
        }
        releasePage(pFreePg);
      }while( nFin!=0 && iFreePg>nFin );
      assert( iFreePg<iLastPg );
      
      rc = sqlite3PagerWrite(pLastPg->pDbPage);
      if( rc==SQLITE_OK ){
        rc = relocatePage(pBt, pLastPg, eType, iPtrPage, iFreePg, nFin!=0);
      }
      releasePage(pLastPg);
      if( rc!=SQLITE_OK ){
        return rc;
      }
    }
  }

  pBt->nTrunc = iLastPg - 1;
  while( pBt->nTrunc==PENDING_BYTE_PAGE(pBt)||PTRMAP_ISPAGE(pBt, pBt->nTrunc) ){
    pBt->nTrunc--;
  }
  return SQLITE_OK;
}

/*
** A write-transaction must be opened before calling this function.
** It performs a single unit of work towards an incremental vacuum.
**
** If the incremental vacuum is finished after this function has run,
** SQLITE_DONE is returned. If it is not finished, but no error occured,
** SQLITE_OK is returned. Otherwise an SQLite error code. 
*/
int sqlite3BtreeIncrVacuum(Btree *p){
  int rc;
  BtShared *pBt = p->pBt;

  sqlite3BtreeEnter(p);
  pBt->db = p->db;
  assert( pBt->inTransaction==TRANS_WRITE && p->inTrans==TRANS_WRITE );
  if( !pBt->autoVacuum ){
    rc = SQLITE_DONE;
  }else{
    invalidateAllOverflowCache(pBt);
    rc = incrVacuumStep(pBt, 0);
  }
  sqlite3BtreeLeave(p);
  return rc;
}

/*
** This routine is called prior to sqlite3PagerCommit when a transaction
** is commited for an auto-vacuum database.
**
** If SQLITE_OK is returned, then *pnTrunc is set to the number of pages
** the database file should be truncated to during the commit process. 
** i.e. the database has been reorganized so that only the first *pnTrunc
** pages are in use.
*/
static int autoVacuumCommit(BtShared *pBt, Pgno *pnTrunc){
  int rc = SQLITE_OK;
  Pager *pPager = pBt->pPager;
#ifndef NDEBUG
  int nRef = sqlite3PagerRefcount(pPager);
#endif

  assert( sqlite3_mutex_held(pBt->mutex) );
  invalidateAllOverflowCache(pBt);
  assert(pBt->autoVacuum);
  if( !pBt->incrVacuum ){
    Pgno nFin = 0;

    if( pBt->nTrunc==0 ){
      Pgno nFree;
      Pgno nPtrmap;
      const int pgsz = pBt->pageSize;
      int nOrig = pagerPagecount(pBt->pPager);

      if( PTRMAP_ISPAGE(pBt, nOrig) ){
        return SQLITE_CORRUPT_BKPT;
      }
      if( nOrig==PENDING_BYTE_PAGE(pBt) ){
        nOrig--;
      }
      nFree = get4byte(&pBt->pPage1->aData[36]);
      nPtrmap = (nFree-nOrig+PTRMAP_PAGENO(pBt, nOrig)+pgsz/5)/(pgsz/5);
      nFin = nOrig - nFree - nPtrmap;
      if( nOrig>PENDING_BYTE_PAGE(pBt) && nFin<=PENDING_BYTE_PAGE(pBt) ){
        nFin--;
      }
      while( PTRMAP_ISPAGE(pBt, nFin) || nFin==PENDING_BYTE_PAGE(pBt) ){
        nFin--;
      }
    }

    while( rc==SQLITE_OK ){
      rc = incrVacuumStep(pBt, nFin);
    }
    if( rc==SQLITE_DONE ){
      assert(nFin==0 || pBt->nTrunc==0 || nFin<=pBt->nTrunc);
      rc = SQLITE_OK;
      if( pBt->nTrunc && nFin ){
        rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);
        put4byte(&pBt->pPage1->aData[32], 0);
        put4byte(&pBt->pPage1->aData[36], 0);
        pBt->nTrunc = nFin;
      }
    }
    if( rc!=SQLITE_OK ){
      sqlite3PagerRollback(pPager);
    }
  }

  if( rc==SQLITE_OK ){
    *pnTrunc = pBt->nTrunc;
    pBt->nTrunc = 0;
  }
  assert( nRef==sqlite3PagerRefcount(pPager) );
  return rc;
}

#endif

/*
** This routine does the first phase of a two-phase commit.  This routine
** causes a rollback journal to be created (if it does not already exist)
** and populated with enough information so that if a power loss occurs
** the database can be restored to its original state by playing back
** the journal.  Then the contents of the journal are flushed out to
** the disk.  After the journal is safely on oxide, the changes to the
** database are written into the database file and flushed to oxide.
** At the end of this call, the rollback journal still exists on the
** disk and we are still holding all locks, so the transaction has not
** committed.  See sqlite3BtreeCommit() for the second phase of the
** commit process.
**
** This call is a no-op if no write-transaction is currently active on pBt.
**
** Otherwise, sync the database file for the btree pBt. zMaster points to
** the name of a master journal file that should be written into the
** individual journal file, or is NULL, indicating no master journal file 
** (single database transaction).
**
** When this is called, the master journal should already have been
** created, populated with this journal pointer and synced to disk.
**
** Once this is routine has returned, the only thing required to commit
** the write-transaction for this database file is to delete the journal.
*/
int sqlite3BtreeCommitPhaseOne(Btree *p, const char *zMaster){
  int rc = SQLITE_OK;
  if( p->inTrans==TRANS_WRITE ){
    BtShared *pBt = p->pBt;
    Pgno nTrunc = 0;
    sqlite3BtreeEnter(p);
    pBt->db = p->db;
#ifndef SQLITE_OMIT_AUTOVACUUM
    if( pBt->autoVacuum ){
      rc = autoVacuumCommit(pBt, &nTrunc); 
      if( rc!=SQLITE_OK ){
        sqlite3BtreeLeave(p);
        return rc;
      }
    }
#endif
    rc = sqlite3PagerCommitPhaseOne(pBt->pPager, zMaster, nTrunc, 0);
    sqlite3BtreeLeave(p);
  }
  return rc;
}

/*
** Commit the transaction currently in progress.
**
** This routine implements the second phase of a 2-phase commit.  The
** sqlite3BtreeSync() routine does the first phase and should be invoked
** prior to calling this routine.  The sqlite3BtreeSync() routine did
** all the work of writing information out to disk and flushing the
** contents so that they are written onto the disk platter.  All this
** routine has to do is delete or truncate the rollback journal
** (which causes the transaction to commit) and drop locks.
**
** This will release the write lock on the database file.  If there
** are no active cursors, it also releases the read lock.
*/
int sqlite3BtreeCommitPhaseTwo(Btree *p){
  BtShared *pBt = p->pBt;

  sqlite3BtreeEnter(p);
  pBt->db = p->db;
  btreeIntegrity(p);

  /* If the handle has a write-transaction open, commit the shared-btrees 
  ** transaction and set the shared state to TRANS_READ.
  */
  if( p->inTrans==TRANS_WRITE ){
    int rc;
    assert( pBt->inTransaction==TRANS_WRITE );
    assert( pBt->nTransaction>0 );
    rc = sqlite3PagerCommitPhaseTwo(pBt->pPager);
    if( rc!=SQLITE_OK ){
      sqlite3BtreeLeave(p);
      return rc;
    }
    pBt->inTransaction = TRANS_READ;
    pBt->inStmt = 0;
  }
  unlockAllTables(p);

  /* If the handle has 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.
  */
  if( p->inTrans!=TRANS_NONE ){
    pBt->nTransaction--;
    if( 0==pBt->nTransaction ){
      pBt->inTransaction = TRANS_NONE;
    }
  }

  /* Set the handles current transaction state to TRANS_NONE and unlock
  ** the pager if this call closed the only read or write transaction.
  */
  p->inTrans = TRANS_NONE;
  unlockBtreeIfUnused(pBt);

  btreeIntegrity(p);
  sqlite3BtreeLeave(p);
  return SQLITE_OK;
}

/*
** Do both phases of a commit.
*/
int sqlite3BtreeCommit(Btree *p){
  int rc;
  sqlite3BtreeEnter(p);
  rc = sqlite3BtreeCommitPhaseOne(p, 0);
  if( rc==SQLITE_OK ){
    rc = sqlite3BtreeCommitPhaseTwo(p);
  }
  sqlite3BtreeLeave(p);
  return rc;
}

#ifndef NDEBUG
/*
** Return the number of write-cursors open on this handle. This is for use
** in assert() expressions, so it is only compiled if NDEBUG is not
** defined.
**
** For the purposes of this routine, a write-cursor is any cursor that
** is capable of writing to the databse.  That means the cursor was
** originally opened for writing and the cursor has not be disabled
** by having its state changed to CURSOR_FAULT.
*/
static int countWriteCursors(BtShared *pBt){
  BtCursor *pCur;
  int r = 0;
  for(pCur=pBt->pCursor; pCur; pCur=pCur->pNext){
    if( pCur->wrFlag && pCur->eState!=CURSOR_FAULT ) r++; 
  }
  return r;
}
#endif

/*
** This routine sets the state to CURSOR_FAULT and the error
** code to errCode for every cursor on BtShared that pBtree
** references.
**
** Every cursor is tripped, including cursors that belong
** to other database connections that happen to be sharing
** the cache with pBtree.
**
** This routine gets called when a rollback occurs.
** All cursors using the same cache must be tripped
** to prevent them from trying to use the btree after
** the rollback.  The rollback may have deleted tables
** or moved root pages, so it is not sufficient to
** save the state of the cursor.  The cursor must be
** invalidated.
*/
void sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode){
  BtCursor *p;
  sqlite3BtreeEnter(pBtree);
  for(p=pBtree->pBt->pCursor; p; p=p->pNext){
    clearCursorPosition(p);
    p->eState = CURSOR_FAULT;
    p->skip = errCode;
  }
  sqlite3BtreeLeave(pBtree);
}

/*
** Rollback the transaction in progress.  All cursors will be
** invalided by this operation.  Any attempt to use a cursor
** that was open at the beginning of this operation will result
** in an error.
**
** This will release the write lock on the database file.  If there
** are no active cursors, it also releases the read lock.
*/
int sqlite3BtreeRollback(Btree *p){
  int rc;
  BtShared *pBt = p->pBt;
  MemPage *pPage1;

  sqlite3BtreeEnter(p);
  pBt->db = p->db;
  rc = saveAllCursors(pBt, 0, 0);
#ifndef SQLITE_OMIT_SHARED_CACHE
  if( rc!=SQLITE_OK ){
    /* This is a horrible situation. An IO or malloc() error occured whilst
    ** trying to save cursor positions. If this is an automatic rollback (as
    ** the result of a constraint, malloc() failure or IO error) then 
    ** the cache may be internally inconsistent (not contain valid trees) so
    ** we cannot simply return the error to the caller. Instead, abort 
    ** all queries that may be using any of the cursors that failed to save.
    */
    sqlite3BtreeTripAllCursors(p, rc);
  }
#endif
  btreeIntegrity(p);
  unlockAllTables(p);

  if( p->inTrans==TRANS_WRITE ){
    int rc2;

#ifndef SQLITE_OMIT_AUTOVACUUM
    pBt->nTrunc = 0;
#endif

    assert( TRANS_WRITE==pBt->inTransaction );
    rc2 = sqlite3PagerRollback(pBt->pPager);
    if( rc2!=SQLITE_OK ){
      rc = rc2;
    }

    /* The rollback may have destroyed the pPage1->aData value.  So
    ** call sqlite3BtreeGetPage() on page 1 again to make
    ** sure pPage1->aData is set correctly. */
    if( sqlite3BtreeGetPage(pBt, 1, &pPage1, 0)==SQLITE_OK ){
      releasePage(pPage1);
    }
    assert( countWriteCursors(pBt)==0 );
    pBt->inTransaction = TRANS_READ;
  }

  if( p->inTrans!=TRANS_NONE ){
    assert( pBt->nTransaction>0 );
    pBt->nTransaction--;
    if( 0==pBt->nTransaction ){
      pBt->inTransaction = TRANS_NONE;
    }
  }

  p->inTrans = TRANS_NONE;
  pBt->inStmt = 0;
  unlockBtreeIfUnused(pBt);

  btreeIntegrity(p);
  sqlite3BtreeLeave(p);
  return rc;
}

/*
** Start a statement subtransaction.  The subtransaction can
** can be rolled back independently of the main transaction.
** You must start a transaction before starting a subtransaction.
** The subtransaction is ended automatically if the main transaction
** commits or rolls back.
**
** Only one subtransaction may be active at a time.  It is an error to try
** to start a new subtransaction if another subtransaction is already active.
**
** Statement subtransactions are used around individual SQL statements
** that are contained within a BEGIN...COMMIT block.  If a constraint
** error occurs within the statement, the effect of that one statement
** can be rolled back without having to rollback the entire transaction.
*/
int sqlite3BtreeBeginStmt(Btree *p){
  int rc;
  BtShared *pBt = p->pBt;
  sqlite3BtreeEnter(p);
  pBt->db = p->db;
  if( (p->inTrans!=TRANS_WRITE) || pBt->inStmt ){
    rc = pBt->readOnly ? SQLITE_READONLY : SQLITE_ERROR;
  }else{
    assert( pBt->inTransaction==TRANS_WRITE );
    rc = pBt->readOnly ? SQLITE_OK : sqlite3PagerStmtBegin(pBt->pPager);
    pBt->inStmt = 1;
  }
  sqlite3BtreeLeave(p);
  return rc;
}


/*
** Commit the statment subtransaction currently in progress.  If no
** subtransaction is active, this is a no-op.
*/
int sqlite3BtreeCommitStmt(Btree *p){
  int rc;
  BtShared *pBt = p->pBt;
  sqlite3BtreeEnter(p);
  pBt->db = p->db;
  if( pBt->inStmt && !pBt->readOnly ){
    rc = sqlite3PagerStmtCommit(pBt->pPager);
  }else{
    rc = SQLITE_OK;
  }
  pBt->inStmt = 0;
  sqlite3BtreeLeave(p);
  return rc;
}

/*
** Rollback the active statement subtransaction.  If no subtransaction
** is active this routine is a no-op.
**
** All cursors will be invalidated by this operation.  Any attempt
** to use a cursor that was open at the beginning of this operation
** will result in an error.
*/
int sqlite3BtreeRollbackStmt(Btree *p){
  int rc = SQLITE_OK;
  BtShared *pBt = p->pBt;
  sqlite3BtreeEnter(p);
  pBt->db = p->db;
  if( pBt->inStmt && !pBt->readOnly ){
    rc = sqlite3PagerStmtRollback(pBt->pPager);
    pBt->inStmt = 0;
  }
  sqlite3BtreeLeave(p);
  return rc;
}

/*
** Create a new cursor for the BTree whose root is on the page
** iTable.  The act of acquiring a cursor gets a read lock on 
** the database file.
**
** If wrFlag==0, then the cursor can only be used for reading.
** If wrFlag==1, then the cursor can be used for reading or for
** writing if other conditions for writing are also met.  These
** are the conditions that must be met in order for writing to
** be allowed:
**
** 1:  The cursor must have been opened with wrFlag==1
**
** 2:  Other database connections that share the same pager cache
**     but which are not in the READ_UNCOMMITTED state may not have
**     cursors open with wrFlag==0 on the same table.  Otherwise
**     the changes made by this write cursor would be visible to
**     the read cursors in the other database connection.
**
** 3:  The database must be writable (not on read-only media)
**
** 4:  There must be an active transaction.
**
** No checking is done to make sure that page iTable really is the
** root page of a b-tree.  If it is not, then the cursor acquired
** will not work correctly.
*/
static int btreeCursor(
  Btree *p,                              /* The btree */
  int iTable,                            /* Root page of table to open */
  int wrFlag,                            /* 1 to write. 0 read-only */
  struct KeyInfo *pKeyInfo,              /* First arg to comparison function */
  BtCursor *pCur                         /* Space for new cursor */
){
  int rc;
  BtShared *pBt = p->pBt;

  assert( sqlite3BtreeHoldsMutex(p) );
  if( wrFlag ){
    if( pBt->readOnly ){
      return SQLITE_READONLY;
    }
    if( checkReadLocks(p, iTable, 0, 0) ){
      return SQLITE_LOCKED;
    }
  }

  if( pBt->pPage1==0 ){
    rc = lockBtreeWithRetry(p);
    if( rc!=SQLITE_OK ){
      return rc;
    }
    if( pBt->readOnly && wrFlag ){
      return SQLITE_READONLY;
    }
  }
  pCur->pgnoRoot = (Pgno)iTable;
  if( iTable==1 && pagerPagecount(pBt->pPager)==0 ){
    rc = SQLITE_EMPTY;
    goto create_cursor_exception;
  }
  rc = getAndInitPage(pBt, pCur->pgnoRoot, &pCur->pPage, 0);
  if( rc!=SQLITE_OK ){
    goto create_cursor_exception;
  }

  /* Now that no other errors can occur, finish filling in the BtCursor
  ** variables, link the cursor into the BtShared list and set *ppCur (the
  ** output argument to this function).
  */
  pCur->pKeyInfo = pKeyInfo;
  pCur->pBtree = p;
  pCur->pBt = pBt;
  pCur->wrFlag = wrFlag;
  pCur->pNext = pBt->pCursor;
  if( pCur->pNext ){
    pCur->pNext->pPrev = pCur;
  }
  pBt->pCursor = pCur;
  pCur->eState = CURSOR_INVALID;

  return SQLITE_OK;

create_cursor_exception:
  releasePage(pCur->pPage);
  unlockBtreeIfUnused(pBt);
  return rc;
}
int sqlite3BtreeCursor(
  Btree *p,                                   /* The btree */
  int iTable,                                 /* Root page of table to open */
  int wrFlag,                                 /* 1 to write. 0 read-only */
  struct KeyInfo *pKeyInfo,                   /* First arg to xCompare() */
  BtCursor *pCur                              /* Write new cursor here */
){
  int rc;
  sqlite3BtreeEnter(p);
  p->pBt->db = p->db;
  rc = btreeCursor(p, iTable, wrFlag, pKeyInfo, pCur);
  sqlite3BtreeLeave(p);
  return rc;
}
int sqlite3BtreeCursorSize(){
  return sizeof(BtCursor);
}



/*
** Close a cursor.  The read lock on the database file is released
** when the last cursor is closed.
*/
int sqlite3BtreeCloseCursor(BtCursor *pCur){
  Btree *pBtree = pCur->pBtree;
  if( pBtree ){
    BtShared *pBt = pCur->pBt;
    sqlite3BtreeEnter(pBtree);
    pBt->db = pBtree->db;
    clearCursorPosition(pCur);
    if( pCur->pPrev ){
      pCur->pPrev->pNext = pCur->pNext;
    }else{
      pBt->pCursor = pCur->pNext;
    }
    if( pCur->pNext ){
      pCur->pNext->pPrev = pCur->pPrev;
    }
    releasePage(pCur->pPage);
    unlockBtreeIfUnused(pBt);
    invalidateOverflowCache(pCur);
    /* sqlite3_free(pCur); */
    sqlite3BtreeLeave(pBtree);
  }
  return SQLITE_OK;
}

/*
** Make a temporary cursor by filling in the fields of pTempCur.
** The temporary cursor is not on the cursor list for the Btree.
*/
void sqlite3BtreeGetTempCursor(BtCursor *pCur, BtCursor *pTempCur){
  assert( cursorHoldsMutex(pCur) );
  memcpy(pTempCur, pCur, sizeof(*pCur));
  pTempCur->pNext = 0;
  pTempCur->pPrev = 0;
  if( pTempCur->pPage ){
    sqlite3PagerRef(pTempCur->pPage->pDbPage);
  }
}

/*
** Delete a temporary cursor such as was made by the CreateTemporaryCursor()
** function above.
*/
void sqlite3BtreeReleaseTempCursor(BtCursor *pCur){
  assert( cursorHoldsMutex(pCur) );
  if( pCur->pPage ){
    sqlite3PagerUnref(pCur->pPage->pDbPage);
  }
}

/*
** Make sure the BtCursor* given in the argument has a valid
** BtCursor.info structure.  If it is not already valid, call
** sqlite3BtreeParseCell() to fill it in.
**
** BtCursor.info is a cache of the information in the current cell.
** Using this cache reduces the number of calls to sqlite3BtreeParseCell().
**
** 2007-06-25:  There is a bug in some versions of MSVC that cause the
** compiler to crash when getCellInfo() is implemented as a macro.
** But there is a measureable speed advantage to using the macro on gcc
** (when less compiler optimizations like -Os or -O0 are used and the
** compiler is not doing agressive inlining.)  So we use a real function
** for MSVC and a macro for everything else.  Ticket #2457.
*/
#ifndef NDEBUG
  static void assertCellInfo(BtCursor *pCur){
    CellInfo info;
    memset(&info, 0, sizeof(info));
    sqlite3BtreeParseCell(pCur->pPage, pCur->idx, &info);
    assert( memcmp(&info, &pCur->info, sizeof(info))==0 );
  }
#else
  #define assertCellInfo(x)
#endif
#ifdef _MSC_VER
  /* Use a real function in MSVC to work around bugs in that compiler. */
  static void getCellInfo(BtCursor *pCur){
    if( pCur->info.nSize==0 ){
      sqlite3BtreeParseCell(pCur->pPage, pCur->idx, &pCur->info);
      pCur->validNKey = 1;
    }else{
      assertCellInfo(pCur);
    }
  }
#else /* if not _MSC_VER */
  /* Use a macro in all other compilers so that the function is inlined */
#define getCellInfo(pCur)                                               \
  if( pCur->info.nSize==0 ){                                            \
    sqlite3BtreeParseCell(pCur->pPage, pCur->idx, &pCur->info);         \
    pCur->validNKey = 1;                                                \
  }else{                                                                \
    assertCellInfo(pCur);                                               \
  }
#endif /* _MSC_VER */

/*
** Set *pSize to the size of the buffer needed to hold the value of
** the key for the current entry.  If the cursor is not pointing
** to a valid entry, *pSize is set to 0. 
**
** For a table with the INTKEY flag set, this routine returns the key
** itself, not the number of bytes in the key.
*/
int sqlite3BtreeKeySize(BtCursor *pCur, i64 *pSize){
  int rc;

  assert( cursorHoldsMutex(pCur) );
  rc = restoreCursorPosition(pCur);
  if( rc==SQLITE_OK ){
    assert( pCur->eState==CURSOR_INVALID || pCur->eState==CURSOR_VALID );
    if( pCur->eState==CURSOR_INVALID ){
      *pSize = 0;
    }else{
      getCellInfo(pCur);
      *pSize = pCur->info.nKey;
    }
  }
  return rc;
}

/*
** Set *pSize to the number of bytes of data in the entry the
** cursor currently points to.  Always return SQLITE_OK.
** Failure is not possible.  If the cursor is not currently
** pointing to an entry (which can happen, for example, if
** the database is empty) then *pSize is set to 0.
*/
int sqlite3BtreeDataSize(BtCursor *pCur, u32 *pSize){
  int rc;

  assert( cursorHoldsMutex(pCur) );
  rc = restoreCursorPosition(pCur);
  if( rc==SQLITE_OK ){
    assert( pCur->eState==CURSOR_INVALID || pCur->eState==CURSOR_VALID );
    if( pCur->eState==CURSOR_INVALID ){
      /* Not pointing at a valid entry - set *pSize to 0. */
      *pSize = 0;
    }else{
      getCellInfo(pCur);
      *pSize = pCur->info.nData;
    }
  }
  return rc;
}

/*
** Given the page number of an overflow page in the database (parameter
** ovfl), this function finds the page number of the next page in the 
** linked list of overflow pages. If possible, it uses the auto-vacuum
** pointer-map data instead of reading the content of page ovfl to do so. 
**
** If an error occurs an SQLite error code is returned. Otherwise:
**
** Unless pPgnoNext is NULL, the page number of the next overflow 
** page in the linked list is written to *pPgnoNext. If page ovfl
** is the last page in its linked list, *pPgnoNext is set to zero. 
**
** If ppPage is not NULL, *ppPage is set to the MemPage* handle
** for page ovfl. The underlying pager page may have been requested
** with the noContent flag set, so the page data accessable via
** this handle may not be trusted.
*/
static int getOverflowPage(
  BtShared *pBt, 
  Pgno ovfl,                   /* Overflow page */
  MemPage **ppPage,            /* OUT: MemPage handle */
  Pgno *pPgnoNext              /* OUT: Next overflow page number */
){
  Pgno next = 0;
  int rc;

  assert( sqlite3_mutex_held(pBt->mutex) );
  /* One of these must not be NULL. Otherwise, why call this function? */
  assert(ppPage || pPgnoNext);

  /* If pPgnoNext is NULL, then this function is being called to obtain
  ** a MemPage* reference only. No page-data is required in this case.
  */
  if( !pPgnoNext ){
    return sqlite3BtreeGetPage(pBt, ovfl, ppPage, 1);
  }

#ifndef SQLITE_OMIT_AUTOVACUUM
  /* Try to find the next page in the overflow list using the
  ** autovacuum pointer-map pages. Guess that the next page in 
  ** the overflow list is page number (ovfl+1). If that guess turns 
  ** out to be wrong, fall back to loading the data of page 
  ** number ovfl to determine the next page number.
  */
  if( pBt->autoVacuum ){
    Pgno pgno;
    Pgno iGuess = ovfl+1;
    u8 eType;

    while( PTRMAP_ISPAGE(pBt, iGuess) || iGuess==PENDING_BYTE_PAGE(pBt) ){
      iGuess++;
    }

    if( iGuess<=pagerPagecount(pBt->pPager) ){
      rc = ptrmapGet(pBt, iGuess, &eType, &pgno);
      if( rc!=SQLITE_OK ){
        return rc;
      }
      if( eType==PTRMAP_OVERFLOW2 && pgno==ovfl ){
        next = iGuess;
      }
    }
  }
#endif

  if( next==0 || ppPage ){
    MemPage *pPage = 0;

    rc = sqlite3BtreeGetPage(pBt, ovfl, &pPage, next!=0);
    assert(rc==SQLITE_OK || pPage==0);
    if( next==0 && rc==SQLITE_OK ){
      next = get4byte(pPage->aData);
    }

    if( ppPage ){
      *ppPage = pPage;
    }else{
      releasePage(pPage);
    }
  }
  *pPgnoNext = next;

  return rc;
}

/*
** Copy data from a buffer to a page, or from a page to a buffer.
**
** pPayload is a pointer to data stored on database page pDbPage.
** If argument eOp is false, then nByte bytes of data are copied
** from pPayload to the buffer pointed at by pBuf. If eOp is true,
** then sqlite3PagerWrite() is called on pDbPage and nByte bytes
** of data are copied from the buffer pBuf to pPayload.
**
** SQLITE_OK is returned on success, otherwise an error code.
*/
static int copyPayload(
  void *pPayload,           /* Pointer to page data */
  void *pBuf,               /* Pointer to buffer */
  int nByte,                /* Number of bytes to copy */
  int eOp,                  /* 0 -> copy from page, 1 -> copy to page */
  DbPage *pDbPage           /* Page containing pPayload */
){
  if( eOp ){
    /* Copy data from buffer to page (a write operation) */
    int rc = sqlite3PagerWrite(pDbPage);
    if( rc!=SQLITE_OK ){
      return rc;
    }
    memcpy(pPayload, pBuf, nByte);
  }else{
    /* Copy data from page to buffer (a read operation) */
    memcpy(pBuf, pPayload, nByte);
  }
  return SQLITE_OK;
}

/*
** This function is used to read or overwrite payload information
** for the entry that the pCur cursor is pointing to. If the eOp
** parameter is 0, this is a read operation (data copied into
** buffer pBuf). If it is non-zero, a write (data copied from
** buffer pBuf).
**
** A total of "amt" bytes are read or written beginning at "offset".
** Data is read to or from the buffer pBuf.
**
** This routine does not make a distinction between key and data.
** It just reads or writes bytes from the payload area.  Data might 
** appear on the main page or be scattered out on multiple overflow 
** pages.
**
** If the BtCursor.isIncrblobHandle flag is set, and the current
** cursor entry uses one or more overflow pages, this function
** allocates space for and lazily popluates the overflow page-list 
** cache array (BtCursor.aOverflow). Subsequent calls use this
** cache to make seeking to the supplied offset more efficient.
**
** Once an overflow page-list cache has been allocated, it may be
** invalidated if some other cursor writes to the same table, or if
** the cursor is moved to a different row. Additionally, in auto-vacuum
** mode, the following events may invalidate an overflow page-list cache.
**
**   * An incremental vacuum,
**   * A commit in auto_vacuum="full" mode,
**   * Creating a table (may require moving an overflow page).
*/
static int accessPayload(
  BtCursor *pCur,      /* Cursor pointing to entry to read from */
  int offset,          /* Begin reading this far into payload */
  int amt,             /* Read this many bytes */
  unsigned char *pBuf, /* Write the bytes into this buffer */ 
  int skipKey,         /* offset begins at data if this is true */
  int eOp              /* zero to read. non-zero to write. */
){
  unsigned char *aPayload;
  int rc = SQLITE_OK;
  u32 nKey;
  int iIdx = 0;
  MemPage *pPage = pCur->pPage;     /* Btree page of current cursor entry */
  BtShared *pBt;                   /* Btree this cursor belongs to */

  assert( pPage );
  assert( pCur->eState==CURSOR_VALID );
  assert( pCur->idx>=0 && pCur->idx<pPage->nCell );
  assert( offset>=0 );
  assert( cursorHoldsMutex(pCur) );

  getCellInfo(pCur);
  aPayload = pCur->info.pCell + pCur->info.nHeader;
  nKey = (pPage->intKey ? 0 : pCur->info.nKey);

  if( skipKey ){
    offset += nKey;
  }
  if( offset+amt > nKey+pCur->info.nData ){
    /* Trying to read or write past the end of the data is an error */
    return SQLITE_ERROR;
  }

  /* Check if data must be read/written to/from the btree page itself. */
  if( offset<pCur->info.nLocal ){
    int a = amt;
    if( a+offset>pCur->info.nLocal ){
      a = pCur->info.nLocal - offset;
    }
    rc = copyPayload(&aPayload[offset], pBuf, a, eOp, pPage->pDbPage);
    offset = 0;
    pBuf += a;
    amt -= a;
  }else{
    offset -= pCur->info.nLocal;
  }

  pBt = pCur->pBt;
  if( rc==SQLITE_OK && amt>0 ){
    const int ovflSize = pBt->usableSize - 4;  /* Bytes content per ovfl page */
    Pgno nextPage;

    nextPage = get4byte(&aPayload[pCur->info.nLocal]);

#ifndef SQLITE_OMIT_INCRBLOB
    /* If the isIncrblobHandle flag is set and the BtCursor.aOverflow[]
    ** has not been allocated, allocate it now. The array is sized at
    ** one entry for each overflow page in the overflow chain. The
    ** page number of the first overflow page is stored in aOverflow[0],
    ** etc. A value of 0 in the aOverflow[] array means "not yet known"
    ** (the cache is lazily populated).
    */
    if( pCur->isIncrblobHandle && !pCur->aOverflow ){
      int nOvfl = (pCur->info.nPayload-pCur->info.nLocal+ovflSize-1)/ovflSize;
      pCur->aOverflow = (Pgno *)sqlite3MallocZero(sizeof(Pgno)*nOvfl);
      if( nOvfl && !pCur->aOverflow ){
        rc = SQLITE_NOMEM;
      }
    }

    /* If the overflow page-list cache has been allocated and the
    ** entry for the first required overflow page is valid, skip
    ** directly to it.
    */
    if( pCur->aOverflow && pCur->aOverflow[offset/ovflSize] ){
      iIdx = (offset/ovflSize);
      nextPage = pCur->aOverflow[iIdx];
      offset = (offset%ovflSize);
    }
#endif

    for( ; rc==SQLITE_OK && amt>0 && nextPage; iIdx++){

#ifndef SQLITE_OMIT_INCRBLOB
      /* If required, populate the overflow page-list cache. */
      if( pCur->aOverflow ){
        assert(!pCur->aOverflow[iIdx] || pCur->aOverflow[iIdx]==nextPage);
        pCur->aOverflow[iIdx] = nextPage;
      }
#endif

      if( offset>=ovflSize ){
        /* The only reason to read this page is to obtain the page
        ** number for the next page in the overflow chain. The page
        ** data is not required. So first try to lookup the overflow
        ** page-list cache, if any, then fall back to the getOverflowPage()
        ** function.
        */
#ifndef SQLITE_OMIT_INCRBLOB
        if( pCur->aOverflow && pCur->aOverflow[iIdx+1] ){
          nextPage = pCur->aOverflow[iIdx+1];
        } else 
#endif
          rc = getOverflowPage(pBt, nextPage, 0, &nextPage);
        offset -= ovflSize;
      }else{
        /* Need to read this page properly. It contains some of the
        ** range of data that is being read (eOp==0) or written (eOp!=0).
        */
        DbPage *pDbPage;
        int a = amt;
        rc = sqlite3PagerGet(pBt->pPager, nextPage, &pDbPage);
        if( rc==SQLITE_OK ){
          aPayload = sqlite3PagerGetData(pDbPage);
          nextPage = get4byte(aPayload);
          if( a + offset > ovflSize ){
            a = ovflSize - offset;
          }
          rc = copyPayload(&aPayload[offset+4], pBuf, a, eOp, pDbPage);
          sqlite3PagerUnref(pDbPage);
          offset = 0;
          amt -= a;
          pBuf += a;
        }
      }
    }
  }

  if( rc==SQLITE_OK && amt>0 ){
    return SQLITE_CORRUPT_BKPT;
  }
  return rc;
}

/*
** Read part of the key associated with cursor pCur.  Exactly
** "amt" bytes will be transfered into pBuf[].  The transfer
** begins at "offset".
**
** Return SQLITE_OK on success or an error code if anything goes
** wrong.  An error is returned if "offset+amt" is larger than
** the available payload.
*/
int sqlite3BtreeKey(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){
  int rc;

  assert( cursorHoldsMutex(pCur) );
  rc = restoreCursorPosition(pCur);
  if( rc==SQLITE_OK ){
    assert( pCur->eState==CURSOR_VALID );
    assert( pCur->pPage!=0 );
    if( pCur->pPage->intKey ){
      return SQLITE_CORRUPT_BKPT;
    }
    assert( pCur->pPage->intKey==0 );
    assert( pCur->idx>=0 && pCur->idx<pCur->pPage->nCell );
    rc = accessPayload(pCur, offset, amt, (unsigned char*)pBuf, 0, 0);
  }
  return rc;
}

/*
** Read part of the data associated with cursor pCur.  Exactly
** "amt" bytes will be transfered into pBuf[].  The transfer
** begins at "offset".
**
** Return SQLITE_OK on success or an error code if anything goes
** wrong.  An error is returned if "offset+amt" is larger than
** the available payload.
*/
int sqlite3BtreeData(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){
  int rc;

#ifndef SQLITE_OMIT_INCRBLOB
  if ( pCur->eState==CURSOR_INVALID ){
    return SQLITE_ABORT;
  }
#endif

  assert( cursorHoldsMutex(pCur) );
  rc = restoreCursorPosition(pCur);
  if( rc==SQLITE_OK ){
    assert( pCur->eState==CURSOR_VALID );
    assert( pCur->pPage!=0 );
    assert( pCur->idx>=0 && pCur->idx<pCur->pPage->nCell );
    rc = accessPayload(pCur, offset, amt, pBuf, 1, 0);
  }
  return rc;
}

/*
** Return a pointer to payload information from the entry that the 
** pCur cursor is pointing to.  The pointer is to the beginning of
** the key if skipKey==0 and it points to the beginning of data if
** skipKey==1.  The number of bytes of available key/data is written
** into *pAmt.  If *pAmt==0, then the value returned will not be
** a valid pointer.
**
** This routine is an optimization.  It is common for the entire key
** and data to fit on the local page and for there to be no overflow
** pages.  When that is so, this routine can be used to access the
** key and data without making a copy.  If the key and/or data spills
** onto overflow pages, then accessPayload() must be used to reassembly
** the key/data and copy it into a preallocated buffer.
**
** The pointer returned by this routine looks directly into the cached
** page of the database.  The data might change or move the next time
** any btree routine is called.
*/
static const unsigned char *fetchPayload(
  BtCursor *pCur,      /* Cursor pointing to entry to read from */
  int *pAmt,           /* Write the number of available bytes here */
  int skipKey          /* read beginning at data if this is true */
){
  unsigned char *aPayload;
  MemPage *pPage;
  u32 nKey;
  int nLocal;

  assert( pCur!=0 && pCur->pPage!=0 );
  assert( pCur->eState==CURSOR_VALID );
  assert( cursorHoldsMutex(pCur) );
  pPage = pCur->pPage;
  assert( pCur->idx>=0 && pCur->idx<pPage->nCell );
  getCellInfo(pCur);
  aPayload = pCur->info.pCell;
  aPayload += pCur->info.nHeader;
  if( pPage->intKey ){
    nKey = 0;
  }else{
    nKey = pCur->info.nKey;
  }
  if( skipKey ){
    aPayload += nKey;
    nLocal = pCur->info.nLocal - nKey;
  }else{
    nLocal = pCur->info.nLocal;
    if( nLocal>nKey ){
      nLocal = nKey;
    }
  }
  *pAmt = nLocal;
  return aPayload;
}


/*
** For the entry that cursor pCur is point to, return as
** many bytes of the key or data as are available on the local
** b-tree page.  Write the number of available bytes into *pAmt.
**
** The pointer returned is ephemeral.  The key/data may move
** or be destroyed on the next call to any Btree routine,
** including calls from other threads against the same cache.
** Hence, a mutex on the BtShared should be held prior to calling
** this routine.
**
** These routines is used to get quick access to key and data
** in the common case where no overflow pages are used.
*/
const void *sqlite3BtreeKeyFetch(BtCursor *pCur, int *pAmt){
  assert( cursorHoldsMutex(pCur) );
  if( pCur->eState==CURSOR_VALID ){
    return (const void*)fetchPayload(pCur, pAmt, 0);
  }
  return 0;
}
const void *sqlite3BtreeDataFetch(BtCursor *pCur, int *pAmt){
  assert( cursorHoldsMutex(pCur) );
  if( pCur->eState==CURSOR_VALID ){
    return (const void*)fetchPayload(pCur, pAmt, 1);
  }
  return 0;
}


/*
** Move the cursor down to a new child page.  The newPgno argument is the
** page number of the child page to move to.
*/
static int moveToChild(BtCursor *pCur, u32 newPgno){
  int rc;
  MemPage *pNewPage;
  MemPage *pOldPage;
  BtShared *pBt = pCur->pBt;

  assert( cursorHoldsMutex(pCur) );
  assert( pCur->eState==CURSOR_VALID );
  rc = getAndInitPage(pBt, newPgno, &pNewPage, pCur->pPage);
  if( rc ) return rc;
  pNewPage->idxParent = pCur->idx;
  pOldPage = pCur->pPage;
  pOldPage->idxShift = 0;
  releasePage(pOldPage);
  pCur->pPage = pNewPage;
  pCur->idx = 0;
  pCur->info.nSize = 0;
  pCur->validNKey = 0;
  if( pNewPage->nCell<1 ){
    return SQLITE_CORRUPT_BKPT;
  }
  return SQLITE_OK;
}

/*
** Return true if the page is the virtual root of its table.
**
** The virtual root page is the root page for most tables.  But
** for the table rooted on page 1, sometime the real root page
** is empty except for the right-pointer.  In such cases the
** virtual root page is the page that the right-pointer of page
** 1 is pointing to.
*/
int sqlite3BtreeIsRootPage(MemPage *pPage){
  MemPage *pParent;

  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  pParent = pPage->pParent;
  if( pParent==0 ) return 1;
  if( pParent->pgno>1 ) return 0;
  if( get2byte(&pParent->aData[pParent->hdrOffset+3])==0 ) return 1;
  return 0;
}

/*
** Move the cursor up to the parent page.
**
** pCur->idx is set to the cell index that contains the pointer
** to the page we are coming from.  If we are coming from the
** right-most child page then pCur->idx is set to one more than
** the largest cell index.
*/
void sqlite3BtreeMoveToParent(BtCursor *pCur){
  MemPage *pParent;
  MemPage *pPage;
  int idxParent;

  assert( cursorHoldsMutex(pCur) );
  assert( pCur->eState==CURSOR_VALID );
  pPage = pCur->pPage;
  assert( pPage!=0 );
  assert( !sqlite3BtreeIsRootPage(pPage) );
  pParent = pPage->pParent;
  assert( pParent!=0 );
  idxParent = pPage->idxParent;
  sqlite3PagerRef(pParent->pDbPage);
  releasePage(pPage);
  pCur->pPage = pParent;
  pCur->info.nSize = 0;
  pCur->validNKey = 0;
  assert( pParent->idxShift==0 );
  pCur->idx = idxParent;
}

/*
** Move the cursor to the root page
*/
static int moveToRoot(BtCursor *pCur){
  MemPage *pRoot;
  int rc = SQLITE_OK;
  Btree *p = pCur->pBtree;
  BtShared *pBt = p->pBt;

  assert( cursorHoldsMutex(pCur) );
  assert( CURSOR_INVALID < CURSOR_REQUIRESEEK );
  assert( CURSOR_VALID   < CURSOR_REQUIRESEEK );
  assert( CURSOR_FAULT   > CURSOR_REQUIRESEEK );
  if( pCur->eState>=CURSOR_REQUIRESEEK ){
    if( pCur->eState==CURSOR_FAULT ){
      return pCur->skip;
    }
    clearCursorPosition(pCur);
  }
  pRoot = pCur->pPage;
  if( pRoot && pRoot->pgno==pCur->pgnoRoot ){
    assert( pRoot->isInit );
  }else{
    if( 
      SQLITE_OK!=(rc = getAndInitPage(pBt, pCur->pgnoRoot, &pRoot, 0))
    ){
      pCur->eState = CURSOR_INVALID;
      return rc;
    }
    releasePage(pCur->pPage);
    pCur->pPage = pRoot;
  }
  pCur->idx = 0;
  pCur->info.nSize = 0;
  pCur->atLast = 0;
  pCur->validNKey = 0;
  if( pRoot->nCell==0 && !pRoot->leaf ){
    Pgno subpage;
    assert( pRoot->pgno==1 );
    subpage = get4byte(&pRoot->aData[pRoot->hdrOffset+8]);
    assert( subpage>0 );
    pCur->eState = CURSOR_VALID;
    rc = moveToChild(pCur, subpage);
  }
  pCur->eState = ((pCur->pPage->nCell>0)?CURSOR_VALID:CURSOR_INVALID);
  return rc;
}

/*
** Move the cursor down to the left-most leaf entry beneath the
** entry to which it is currently pointing.
**
** The left-most leaf is the one with the smallest key - the first
** in ascending order.
*/
static int moveToLeftmost(BtCursor *pCur){
  Pgno pgno;
  int rc = SQLITE_OK;
  MemPage *pPage;

  assert( cursorHoldsMutex(pCur) );
  assert( pCur->eState==CURSOR_VALID );
  while( rc==SQLITE_OK && !(pPage = pCur->pPage)->leaf ){
    assert( pCur->idx>=0 && pCur->idx<pPage->nCell );
    pgno = get4byte(findCell(pPage, pCur->idx));
    rc = moveToChild(pCur, pgno);
  }
  return rc;
}

/*
** Move the cursor down to the right-most leaf entry beneath the
** page to which it is currently pointing.  Notice the difference
** between moveToLeftmost() and moveToRightmost().  moveToLeftmost()
** finds the left-most entry beneath the *entry* whereas moveToRightmost()
** finds the right-most entry beneath the *page*.
**
** The right-most entry is the one with the largest key - the last
** key in ascending order.
*/
static int moveToRightmost(BtCursor *pCur){
  Pgno pgno;
  int rc = SQLITE_OK;
  MemPage *pPage;

  assert( cursorHoldsMutex(pCur) );
  assert( pCur->eState==CURSOR_VALID );
  while( rc==SQLITE_OK && !(pPage = pCur->pPage)->leaf ){
    pgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);
    pCur->idx = pPage->nCell;
    rc = moveToChild(pCur, pgno);
  }
  if( rc==SQLITE_OK ){
    pCur->idx = pPage->nCell - 1;
    pCur->info.nSize = 0;
    pCur->validNKey = 0;
  }
  return SQLITE_OK;
}

/* Move the cursor to the first entry in the table.  Return SQLITE_OK
** on success.  Set *pRes to 0 if the cursor actually points to something
** or set *pRes to 1 if the table is empty.
*/
int sqlite3BtreeFirst(BtCursor *pCur, int *pRes){
  int rc;

  assert( cursorHoldsMutex(pCur) );
  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
  rc = moveToRoot(pCur);
  if( rc==SQLITE_OK ){
    if( pCur->eState==CURSOR_INVALID ){
      assert( pCur->pPage->nCell==0 );
      *pRes = 1;
      rc = SQLITE_OK;
    }else{
      assert( pCur->pPage->nCell>0 );
      *pRes = 0;
      rc = moveToLeftmost(pCur);
    }
  }
  return rc;
}

/* Move the cursor to the last entry in the table.  Return SQLITE_OK
** on success.  Set *pRes to 0 if the cursor actually points to something
** or set *pRes to 1 if the table is empty.
*/
int sqlite3BtreeLast(BtCursor *pCur, int *pRes){
  int rc;
 
  assert( cursorHoldsMutex(pCur) );
  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
  rc = moveToRoot(pCur);
  if( rc==SQLITE_OK ){
    if( CURSOR_INVALID==pCur->eState ){
      assert( pCur->pPage->nCell==0 );
      *pRes = 1;
    }else{
      assert( pCur->eState==CURSOR_VALID );
      *pRes = 0;
      rc = moveToRightmost(pCur);
      getCellInfo(pCur);
      pCur->atLast = rc==SQLITE_OK;
    }
  }
  return rc;
}

/* Move the cursor so that it points to an entry near the key 
** specified by pKey/nKey/pUnKey. Return a success code.
**
** For INTKEY tables, only the nKey parameter is used.  pKey 
** and pUnKey must be NULL.  For index tables, either pUnKey
** must point to a key that has already been unpacked, or else
** pKey/nKey describes a blob containing the key.
**
** If an exact match is not found, then the cursor is always
** left pointing at a leaf page which would hold the entry if it
** were present.  The cursor might point to an entry that comes
** before or after the key.
**
** The result of comparing the key with the entry to which the
** cursor is written to *pRes if pRes!=NULL.  The meaning of
** this value is as follows:
**
**     *pRes<0      The cursor is left pointing at an entry that
**                  is smaller than pKey or if the table is empty
**                  and the cursor is therefore left point to nothing.
**
**     *pRes==0     The cursor is left pointing at an entry that
**                  exactly matches pKey.
**
**     *pRes>0      The cursor is left pointing at an entry that
**                  is larger than pKey.
**
*/
int sqlite3BtreeMoveto(
  BtCursor *pCur,        /* The cursor to be moved */
  const void *pKey,      /* The key content for indices.  Not used by tables */
  UnpackedRecord *pUnKey,/* Unpacked version of pKey */
  i64 nKey,              /* Size of pKey.  Or the key for tables */
  int biasRight,         /* If true, bias the search to the high end */
  int *pRes              /* Search result flag */
){
  int rc;
  char aSpace[200];

  assert( cursorHoldsMutex(pCur) );
  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );

  /* If the cursor is already positioned at the point we are trying
  ** to move to, then just return without doing any work */
  if( pCur->eState==CURSOR_VALID && pCur->validNKey && pCur->pPage->intKey ){
    if( pCur->info.nKey==nKey ){
      *pRes = 0;
      return SQLITE_OK;
    }
    if( pCur->atLast && pCur->info.nKey<nKey ){
      *pRes = -1;
      return SQLITE_OK;
    }
  }


  rc = moveToRoot(pCur);
  if( rc ){
    return rc;
  }
  assert( pCur->pPage );
  assert( pCur->pPage->isInit );
  if( pCur->eState==CURSOR_INVALID ){
    *pRes = -1;
    assert( pCur->pPage->nCell==0 );
    return SQLITE_OK;
  }
  if( pCur->pPage->intKey ){
    /* We are given an SQL table to search.  The key is the integer
    ** rowid contained in nKey.  pKey and pUnKey should both be NULL */
    assert( pUnKey==0 );
    assert( pKey==0 );
  }else if( pUnKey==0 ){
    /* We are to search an SQL index using a key encoded as a blob.
    ** The blob is found at pKey and is nKey bytes in length.  Unpack
    ** this key so that we can use it. */
    assert( pKey!=0 );
    pUnKey = sqlite3VdbeRecordUnpack(pCur->pKeyInfo, nKey, pKey,
                                   aSpace, sizeof(aSpace));
    if( pUnKey==0 ) return SQLITE_NOMEM;
  }else{
    /* We are to search an SQL index using a key that is already unpacked
    ** and handed to us in pUnKey. */
    assert( pKey==0 );
  }
  for(;;){
    int lwr, upr;
    Pgno chldPg;
    MemPage *pPage = pCur->pPage;
    int c = -1;  /* pRes return if table is empty must be -1 */
    lwr = 0;
    upr = pPage->nCell-1;
    if( !pPage->intKey && pUnKey==0 ){
      rc = SQLITE_CORRUPT_BKPT;
      goto moveto_finish;
    }
    if( biasRight ){
      pCur->idx = upr;
    }else{
      pCur->idx = (upr+lwr)/2;
    }
    if( lwr<=upr ) for(;;){
      void *pCellKey;
      i64 nCellKey;
      pCur->info.nSize = 0;
      pCur->validNKey = 1;
      if( pPage->intKey ){
        u8 *pCell;
        pCell = findCell(pPage, pCur->idx) + pPage->childPtrSize;
        if( pPage->hasData ){
          u32 dummy;
          pCell += getVarint32(pCell, dummy);
        }
        getVarint(pCell, (u64*)&nCellKey);
        if( nCellKey==nKey ){
          c = 0;
        }else if( nCellKey<nKey ){
          c = -1;
        }else{
          assert( nCellKey>nKey );
          c = +1;
        }
      }else{
        int available;
        pCellKey = (void *)fetchPayload(pCur, &available, 0);
        nCellKey = pCur->info.nKey;
        if( available>=nCellKey ){
          c = sqlite3VdbeRecordCompare(nCellKey, pCellKey, pUnKey);
        }else{
          pCellKey = sqlite3Malloc( nCellKey );
          if( pCellKey==0 ){
            rc = SQLITE_NOMEM;
            goto moveto_finish;
          }
          rc = sqlite3BtreeKey(pCur, 0, nCellKey, (void *)pCellKey);
          c = sqlite3VdbeRecordCompare(nCellKey, pCellKey, pUnKey);
          sqlite3_free(pCellKey);
          if( rc ) goto moveto_finish;
        }
      }
      if( c==0 ){
        pCur->info.nKey = nCellKey;
        if( pPage->intKey && !pPage->leaf ){
          lwr = pCur->idx;
          upr = lwr - 1;
          break;
        }else{
          if( pRes ) *pRes = 0;
          rc = SQLITE_OK;
          goto moveto_finish;
        }
      }
      if( c<0 ){
        lwr = pCur->idx+1;
      }else{
        upr = pCur->idx-1;
      }
      if( lwr>upr ){
        pCur->info.nKey = nCellKey;
        break;
      }
      pCur->idx = (lwr+upr)/2;
    }
    assert( lwr==upr+1 );
    assert( pPage->isInit );
    if( pPage->leaf ){
      chldPg = 0;
    }else if( lwr>=pPage->nCell ){
      chldPg = get4byte(&pPage->aData[pPage->hdrOffset+8]);
    }else{
      chldPg = get4byte(findCell(pPage, lwr));
    }
    if( chldPg==0 ){
      assert( pCur->idx>=0 && pCur->idx<pCur->pPage->nCell );
      if( pRes ) *pRes = c;
      rc = SQLITE_OK;
      goto moveto_finish;
    }
    pCur->idx = lwr;
    pCur->info.nSize = 0;
    pCur->validNKey = 0;
    rc = moveToChild(pCur, chldPg);
    if( rc ) goto moveto_finish;
  }
moveto_finish:
  if( pKey ){
    /* If we created our own unpacked key at the top of this
    ** procedure, then destroy that key before returning. */
    sqlite3VdbeDeleteUnpackedRecord(pUnKey);
  }
  return rc;
}


/*
** Return TRUE if the cursor is not pointing at an entry of the table.
**
** TRUE will be returned after a call to sqlite3BtreeNext() moves
** past the last entry in the table or sqlite3BtreePrev() moves past
** the first entry.  TRUE is also returned if the table is empty.
*/
int sqlite3BtreeEof(BtCursor *pCur){
  /* TODO: What if the cursor is in CURSOR_REQUIRESEEK but all table entries
  ** have been deleted? This API will need to change to return an error code
  ** as well as the boolean result value.
  */
  return (CURSOR_VALID!=pCur->eState);
}

/*
** Return the database connection handle for a cursor.
*/
sqlite3 *sqlite3BtreeCursorDb(const BtCursor *pCur){
  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
  return pCur->pBtree->db;
}

/*
** Advance the cursor to the next entry in the database.  If
** successful then set *pRes=0.  If the cursor
** was already pointing to the last entry in the database before
** this routine was called, then set *pRes=1.
*/
int sqlite3BtreeNext(BtCursor *pCur, int *pRes){
  int rc;
  MemPage *pPage;

  assert( cursorHoldsMutex(pCur) );
  rc = restoreCursorPosition(pCur);
  if( rc!=SQLITE_OK ){
    return rc;
  }
  assert( pRes!=0 );
  pPage = pCur->pPage;
  if( CURSOR_INVALID==pCur->eState ){
    *pRes = 1;
    return SQLITE_OK;
  }
  if( pCur->skip>0 ){
    pCur->skip = 0;
    *pRes = 0;
    return SQLITE_OK;
  }
  pCur->skip = 0;

  assert( pPage->isInit );
  assert( pCur->idx<pPage->nCell );

  pCur->idx++;
  pCur->info.nSize = 0;
  pCur->validNKey = 0;
  if( pCur->idx>=pPage->nCell ){
    if( !pPage->leaf ){
      rc = moveToChild(pCur, get4byte(&pPage->aData[pPage->hdrOffset+8]));
      if( rc ) return rc;
      rc = moveToLeftmost(pCur);
      *pRes = 0;
      return rc;
    }
    do{
      if( sqlite3BtreeIsRootPage(pPage) ){
        *pRes = 1;
        pCur->eState = CURSOR_INVALID;
        return SQLITE_OK;
      }
      sqlite3BtreeMoveToParent(pCur);
      pPage = pCur->pPage;
    }while( pCur->idx>=pPage->nCell );
    *pRes = 0;
    if( pPage->intKey ){
      rc = sqlite3BtreeNext(pCur, pRes);
    }else{
      rc = SQLITE_OK;
    }
    return rc;
  }
  *pRes = 0;
  if( pPage->leaf ){
    return SQLITE_OK;
  }
  rc = moveToLeftmost(pCur);
  return rc;
}


/*
** Step the cursor to the back to the previous entry in the database.  If
** successful then set *pRes=0.  If the cursor
** was already pointing to the first entry in the database before
** this routine was called, then set *pRes=1.
*/
int sqlite3BtreePrevious(BtCursor *pCur, int *pRes){
  int rc;
  Pgno pgno;
  MemPage *pPage;

  assert( cursorHoldsMutex(pCur) );
  rc = restoreCursorPosition(pCur);
  if( rc!=SQLITE_OK ){
    return rc;
  }
  pCur->atLast = 0;
  if( CURSOR_INVALID==pCur->eState ){
    *pRes = 1;
    return SQLITE_OK;
  }
  if( pCur->skip<0 ){
    pCur->skip = 0;
    *pRes = 0;
    return SQLITE_OK;
  }
  pCur->skip = 0;

  pPage = pCur->pPage;
  assert( pPage->isInit );
  assert( pCur->idx>=0 );
  if( !pPage->leaf ){
    pgno = get4byte( findCell(pPage, pCur->idx) );
    rc = moveToChild(pCur, pgno);
    if( rc ){
      return rc;
    }
    rc = moveToRightmost(pCur);
  }else{
    while( pCur->idx==0 ){
      if( sqlite3BtreeIsRootPage(pPage) ){
        pCur->eState = CURSOR_INVALID;
        *pRes = 1;
        return SQLITE_OK;
      }
      sqlite3BtreeMoveToParent(pCur);
      pPage = pCur->pPage;
    }
    pCur->idx--;
    pCur->info.nSize = 0;
    pCur->validNKey = 0;
    if( pPage->intKey && !pPage->leaf ){
      rc = sqlite3BtreePrevious(pCur, pRes);
    }else{
      rc = SQLITE_OK;
    }
  }
  *pRes = 0;
  return rc;
}

/*
** Allocate a new page from the database file.
**
** The new page is marked as dirty.  (In other words, sqlite3PagerWrite()
** has already been called on the new page.)  The new page has also
** been referenced and the calling routine is responsible for calling
** sqlite3PagerUnref() on the new page when it is done.
**
** SQLITE_OK is returned on success.  Any other return value indicates
** an error.  *ppPage and *pPgno are undefined in the event of an error.
** Do not invoke sqlite3PagerUnref() on *ppPage if an error is returned.
**
** If the "nearby" parameter is not 0, then a (feeble) effort is made to 
** locate a page close to the page number "nearby".  This can be used in an
** attempt to keep related pages close to each other in the database file,
** which in turn can make database access faster.
**
** If the "exact" parameter is not 0, and the page-number nearby exists 
** anywhere on the free-list, then it is guarenteed to be returned. This
** is only used by auto-vacuum databases when allocating a new table.
*/
static int allocateBtreePage(
  BtShared *pBt, 
  MemPage **ppPage, 
  Pgno *pPgno, 
  Pgno nearby,
  u8 exact
){
  MemPage *pPage1;
  int rc;
  int n;     /* Number of pages on the freelist */
  int k;     /* Number of leaves on the trunk of the freelist */
  MemPage *pTrunk = 0;
  MemPage *pPrevTrunk = 0;

  assert( sqlite3_mutex_held(pBt->mutex) );
  pPage1 = pBt->pPage1;
  n = get4byte(&pPage1->aData[36]);
  if( n>0 ){
    /* There are pages on the freelist.  Reuse one of those pages. */
    Pgno iTrunk;
    u8 searchList = 0; /* If the free-list must be searched for 'nearby' */
    
    /* If the 'exact' parameter was true and a query of the pointer-map
    ** shows that the page 'nearby' is somewhere on the free-list, then
    ** the entire-list will be searched for that page.
    */
#ifndef SQLITE_OMIT_AUTOVACUUM
    if( exact && nearby<=pagerPagecount(pBt->pPager) ){
      u8 eType;
      assert( nearby>0 );
      assert( pBt->autoVacuum );
      rc = ptrmapGet(pBt, nearby, &eType, 0);
      if( rc ) return rc;
      if( eType==PTRMAP_FREEPAGE ){
        searchList = 1;
      }
      *pPgno = nearby;
    }
#endif

    /* Decrement the free-list count by 1. Set iTrunk to the index of the
    ** first free-list trunk page. iPrevTrunk is initially 1.
    */
    rc = sqlite3PagerWrite(pPage1->pDbPage);
    if( rc ) return rc;
    put4byte(&pPage1->aData[36], n-1);

    /* The code within this loop is run only once if the 'searchList' variable
    ** is not true. Otherwise, it runs once for each trunk-page on the
    ** free-list until the page 'nearby' is located.
    */
    do {
      pPrevTrunk = pTrunk;
      if( pPrevTrunk ){
        iTrunk = get4byte(&pPrevTrunk->aData[0]);
      }else{
        iTrunk = get4byte(&pPage1->aData[32]);
      }
      rc = sqlite3BtreeGetPage(pBt, iTrunk, &pTrunk, 0);
      if( rc ){
        pTrunk = 0;
        goto end_allocate_page;
      }

      k = get4byte(&pTrunk->aData[4]);
      if( k==0 && !searchList ){
        /* The trunk has no leaves and the list is not being searched. 
        ** So extract the trunk page itself and use it as the newly 
        ** allocated page */
        assert( pPrevTrunk==0 );
        rc = sqlite3PagerWrite(pTrunk->pDbPage);
        if( rc ){
          goto end_allocate_page;
        }
        *pPgno = iTrunk;
        memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4);
        *ppPage = pTrunk;
        pTrunk = 0;
        TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1));
      }else if( k>pBt->usableSize/4 - 2 ){
        /* Value of k is out of range.  Database corruption */
        rc = SQLITE_CORRUPT_BKPT;
        goto end_allocate_page;
#ifndef SQLITE_OMIT_AUTOVACUUM
      }else if( searchList && nearby==iTrunk ){
        /* The list is being searched and this trunk page is the page
        ** to allocate, regardless of whether it has leaves.
        */
        assert( *pPgno==iTrunk );
        *ppPage = pTrunk;
        searchList = 0;
        rc = sqlite3PagerWrite(pTrunk->pDbPage);
        if( rc ){
          goto end_allocate_page;
        }
        if( k==0 ){
          if( !pPrevTrunk ){
            memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4);
          }else{
            memcpy(&pPrevTrunk->aData[0], &pTrunk->aData[0], 4);
          }
        }else{
          /* The trunk page is required by the caller but it contains 
          ** pointers to free-list leaves. The first leaf becomes a trunk
          ** page in this case.
          */
          MemPage *pNewTrunk;
          Pgno iNewTrunk = get4byte(&pTrunk->aData[8]);
          rc = sqlite3BtreeGetPage(pBt, iNewTrunk, &pNewTrunk, 0);
          if( rc!=SQLITE_OK ){
            goto end_allocate_page;
          }
          rc = sqlite3PagerWrite(pNewTrunk->pDbPage);
          if( rc!=SQLITE_OK ){
            releasePage(pNewTrunk);
            goto end_allocate_page;
          }
          memcpy(&pNewTrunk->aData[0], &pTrunk->aData[0], 4);
          put4byte(&pNewTrunk->aData[4], k-1);
          memcpy(&pNewTrunk->aData[8], &pTrunk->aData[12], (k-1)*4);
          releasePage(pNewTrunk);
          if( !pPrevTrunk ){
            put4byte(&pPage1->aData[32], iNewTrunk);
          }else{
            rc = sqlite3PagerWrite(pPrevTrunk->pDbPage);
            if( rc ){
              goto end_allocate_page;
            }
            put4byte(&pPrevTrunk->aData[0], iNewTrunk);
          }
        }
        pTrunk = 0;
        TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1));
#endif
      }else{
        /* Extract a leaf from the trunk */
        int closest;
        Pgno iPage;
        unsigned char *aData = pTrunk->aData;
        rc = sqlite3PagerWrite(pTrunk->pDbPage);
        if( rc ){
          goto end_allocate_page;
        }
        if( nearby>0 ){
          int i, dist;
          closest = 0;
          dist = get4byte(&aData[8]) - nearby;
          if( dist<0 ) dist = -dist;
          for(i=1; i<k; i++){
            int d2 = get4byte(&aData[8+i*4]) - nearby;
            if( d2<0 ) d2 = -d2;
            if( d2<dist ){
              closest = i;
              dist = d2;
            }
          }
        }else{
          closest = 0;
        }

        iPage = get4byte(&aData[8+closest*4]);
        if( !searchList || iPage==nearby ){
          int nPage;
          *pPgno = iPage;
          nPage = pagerPagecount(pBt->pPager);
          if( *pPgno>nPage ){
            /* Free page off the end of the file */
            rc = SQLITE_CORRUPT_BKPT;
            goto end_allocate_page;
          }
          TRACE(("ALLOCATE: %d was leaf %d of %d on trunk %d"
                 ": %d more free pages\n",
                 *pPgno, closest+1, k, pTrunk->pgno, n-1));
          if( closest<k-1 ){
            memcpy(&aData[8+closest*4], &aData[4+k*4], 4);
          }
          put4byte(&aData[4], k-1);
          rc = sqlite3BtreeGetPage(pBt, *pPgno, ppPage, 1);
          if( rc==SQLITE_OK ){
            sqlite3PagerDontRollback((*ppPage)->pDbPage);
            rc = sqlite3PagerWrite((*ppPage)->pDbPage);
            if( rc!=SQLITE_OK ){
              releasePage(*ppPage);
            }
          }
          searchList = 0;
        }
      }
      releasePage(pPrevTrunk);
      pPrevTrunk = 0;
    }while( searchList );
  }else{
    /* There are no pages on the freelist, so create a new page at the
    ** end of the file */
    int nPage = pagerPagecount(pBt->pPager);
    *pPgno = nPage + 1;

#ifndef SQLITE_OMIT_AUTOVACUUM
    if( pBt->nTrunc ){
      /* An incr-vacuum has already run within this transaction. So the
      ** page to allocate is not from the physical end of the file, but
      ** at pBt->nTrunc. 
      */
      *pPgno = pBt->nTrunc+1;
      if( *pPgno==PENDING_BYTE_PAGE(pBt) ){
        (*pPgno)++;
      }
    }
    if( pBt->autoVacuum && PTRMAP_ISPAGE(pBt, *pPgno) ){
      /* If *pPgno refers to a pointer-map page, allocate two new pages
      ** at the end of the file instead of one. The first allocated page
      ** becomes a new pointer-map page, the second is used by the caller.
      */
      TRACE(("ALLOCATE: %d from end of file (pointer-map page)\n", *pPgno));
      assert( *pPgno!=PENDING_BYTE_PAGE(pBt) );
      (*pPgno)++;
      if( *pPgno==PENDING_BYTE_PAGE(pBt) ){ (*pPgno)++; }
    }
    if( pBt->nTrunc ){
      pBt->nTrunc = *pPgno;
    }
#endif

    assert( *pPgno!=PENDING_BYTE_PAGE(pBt) );
    rc = sqlite3BtreeGetPage(pBt, *pPgno, ppPage, 0);
    if( rc ) return rc;
    rc = sqlite3PagerWrite((*ppPage)->pDbPage);
    if( rc!=SQLITE_OK ){
      releasePage(*ppPage);
    }
    TRACE(("ALLOCATE: %d from end of file\n", *pPgno));
  }

  assert( *pPgno!=PENDING_BYTE_PAGE(pBt) );

end_allocate_page:
  releasePage(pTrunk);
  releasePage(pPrevTrunk);
  return rc;
}

/*
** Add a page of the database file to the freelist.
**
** sqlite3PagerUnref() is NOT called for pPage.
*/
static int freePage(MemPage *pPage){
  BtShared *pBt = pPage->pBt;
  MemPage *pPage1 = pBt->pPage1;
  int rc, n, k;

  /* Prepare the page for freeing */
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  assert( pPage->pgno>1 );
  pPage->isInit = 0;
  releasePage(pPage->pParent);
  pPage->pParent = 0;

  /* Increment the free page count on pPage1 */
  rc = sqlite3PagerWrite(pPage1->pDbPage);
  if( rc ) return rc;
  n = get4byte(&pPage1->aData[36]);
  put4byte(&pPage1->aData[36], n+1);

#ifdef SQLITE_SECURE_DELETE
  /* If the SQLITE_SECURE_DELETE compile-time option is enabled, then
  ** always fully overwrite deleted information with zeros.
  */
  rc = sqlite3PagerWrite(pPage->pDbPage);
  if( rc ) return rc;
  memset(pPage->aData, 0, pPage->pBt->pageSize);
#endif

  /* If the database supports auto-vacuum, write an entry in the pointer-map
  ** to indicate that the page is free.
  */
  if( ISAUTOVACUUM ){
    rc = ptrmapPut(pBt, pPage->pgno, PTRMAP_FREEPAGE, 0);
    if( rc ) return rc;
  }

  if( n==0 ){
    /* This is the first free page */
    rc = sqlite3PagerWrite(pPage->pDbPage);
    if( rc ) return rc;
    memset(pPage->aData, 0, 8);
    put4byte(&pPage1->aData[32], pPage->pgno);
    TRACE(("FREE-PAGE: %d first\n", pPage->pgno));
  }else{
    /* Other free pages already exist.  Retrive the first trunk page
    ** of the freelist and find out how many leaves it has. */
    MemPage *pTrunk;
    rc = sqlite3BtreeGetPage(pBt, get4byte(&pPage1->aData[32]), &pTrunk, 0);
    if( rc ) return rc;
    k = get4byte(&pTrunk->aData[4]);
    if( k>=pBt->usableSize/4 - 8 ){
      /* The trunk is full.  Turn the page being freed into a new
      ** trunk page with no leaves.
      **
      ** Note that the trunk page is not really full until it contains
      ** usableSize/4 - 2 entries, not usableSize/4 - 8 entries as we have
      ** coded.  But due to a coding error in versions of SQLite prior to
      ** 3.6.0, databases with freelist trunk pages holding more than
      ** usableSize/4 - 8 entries will be reported as corrupt.  In order
      ** to maintain backwards compatibility with older versions of SQLite,
      ** we will contain to restrict the number of entries to usableSize/4 - 8
      ** for now.  At some point in the future (once everyone has upgraded
      ** to 3.6.0 or later) we should consider fixing the conditional above
      ** to read "usableSize/4-2" instead of "usableSize/4-8".
      */
      rc = sqlite3PagerWrite(pPage->pDbPage);
      if( rc==SQLITE_OK ){
        put4byte(pPage->aData, pTrunk->pgno);
        put4byte(&pPage->aData[4], 0);
        put4byte(&pPage1->aData[32], pPage->pgno);
        TRACE(("FREE-PAGE: %d new trunk page replacing %d\n",
                pPage->pgno, pTrunk->pgno));
      }
    }else if( k<0 ){
      rc = SQLITE_CORRUPT;
    }else{
      /* Add the newly freed page as a leaf on the current trunk */
      rc = sqlite3PagerWrite(pTrunk->pDbPage);
      if( rc==SQLITE_OK ){
        put4byte(&pTrunk->aData[4], k+1);
        put4byte(&pTrunk->aData[8+k*4], pPage->pgno);
#ifndef SQLITE_SECURE_DELETE
        sqlite3PagerDontWrite(pPage->pDbPage);
#endif
      }
      TRACE(("FREE-PAGE: %d leaf on trunk page %d\n",pPage->pgno,pTrunk->pgno));
    }
    releasePage(pTrunk);
  }
  return rc;
}

/*
** Free any overflow pages associated with the given Cell.
*/
static int clearCell(MemPage *pPage, unsigned char *pCell){
  BtShared *pBt = pPage->pBt;
  CellInfo info;
  Pgno ovflPgno;
  int rc;
  int nOvfl;
  int ovflPageSize;

  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  sqlite3BtreeParseCellPtr(pPage, pCell, &info);
  if( info.iOverflow==0 ){
    return SQLITE_OK;  /* No overflow pages. Return without doing anything */
  }
  ovflPgno = get4byte(&pCell[info.iOverflow]);
  ovflPageSize = pBt->usableSize - 4;
  nOvfl = (info.nPayload - info.nLocal + ovflPageSize - 1)/ovflPageSize;
  assert( ovflPgno==0 || nOvfl>0 );
  while( nOvfl-- ){
    MemPage *pOvfl;
    if( ovflPgno==0 || ovflPgno>pagerPagecount(pBt->pPager) ){
      return SQLITE_CORRUPT_BKPT;
    }

    rc = getOverflowPage(pBt, ovflPgno, &pOvfl, (nOvfl==0)?0:&ovflPgno);
    if( rc ) return rc;
    rc = freePage(pOvfl);
    sqlite3PagerUnref(pOvfl->pDbPage);
    if( rc ) return rc;
  }
  return SQLITE_OK;
}

/*
** Create the byte sequence used to represent a cell on page pPage
** and write that byte sequence into pCell[].  Overflow pages are
** allocated and filled in as necessary.  The calling procedure
** is responsible for making sure sufficient space has been allocated
** for pCell[].
**
** Note that pCell does not necessary need to point to the pPage->aData
** area.  pCell might point to some temporary storage.  The cell will
** be constructed in this temporary area then copied into pPage->aData
** later.
*/
static int fillInCell(
  MemPage *pPage,                /* The page that contains the cell */
  unsigned char *pCell,          /* Complete text of the cell */
  const void *pKey, i64 nKey,    /* The key */
  const void *pData,int nData,   /* The data */
  int nZero,                     /* Extra zero bytes to append to pData */
  int *pnSize                    /* Write cell size here */
){
  int nPayload;
  const u8 *pSrc;
  int nSrc, n, rc;
  int spaceLeft;
  MemPage *pOvfl = 0;
  MemPage *pToRelease = 0;
  unsigned char *pPrior;
  unsigned char *pPayload;
  BtShared *pBt = pPage->pBt;
  Pgno pgnoOvfl = 0;
  int nHeader;
  CellInfo info;

  assert( sqlite3_mutex_held(pPage->pBt->mutex) );

  /* Fill in the header. */
  nHeader = 0;
  if( !pPage->leaf ){
    nHeader += 4;
  }
  if( pPage->hasData ){
    nHeader += putVarint(&pCell[nHeader], nData+nZero);
  }else{
    nData = nZero = 0;
  }
  nHeader += putVarint(&pCell[nHeader], *(u64*)&nKey);
  sqlite3BtreeParseCellPtr(pPage, pCell, &info);
  assert( info.nHeader==nHeader );
  assert( info.nKey==nKey );
  assert( info.nData==nData+nZero );
  
  /* Fill in the payload */
  nPayload = nData + nZero;
  if( pPage->intKey ){
    pSrc = pData;
    nSrc = nData;
    nData = 0;
  }else{
    nPayload += nKey;
    pSrc = pKey;
    nSrc = nKey;
  }
  *pnSize = info.nSize;
  spaceLeft = info.nLocal;
  pPayload = &pCell[nHeader];
  pPrior = &pCell[info.iOverflow];

  while( nPayload>0 ){
    if( spaceLeft==0 ){
      int isExact = 0;
#ifndef SQLITE_OMIT_AUTOVACUUM
      Pgno pgnoPtrmap = pgnoOvfl; /* Overflow page pointer-map entry page */
      if( pBt->autoVacuum ){
        do{
          pgnoOvfl++;
        } while( 
          PTRMAP_ISPAGE(pBt, pgnoOvfl) || pgnoOvfl==PENDING_BYTE_PAGE(pBt) 
        );
        if( pgnoOvfl>1 ){
          /* isExact = 1; */
        }
      }
#endif
      rc = allocateBtreePage(pBt, &pOvfl, &pgnoOvfl, pgnoOvfl, isExact);
#ifndef SQLITE_OMIT_AUTOVACUUM
      /* If the database supports auto-vacuum, and the second or subsequent
      ** overflow page is being allocated, add an entry to the pointer-map
      ** for that page now. 
      **
      ** If this is the first overflow page, then write a partial entry 
      ** to the pointer-map. If we write nothing to this pointer-map slot,
      ** then the optimistic overflow chain processing in clearCell()
      ** may misinterpret the uninitialised values and delete the
      ** wrong pages from the database.
      */
      if( pBt->autoVacuum && rc==SQLITE_OK ){
        u8 eType = (pgnoPtrmap?PTRMAP_OVERFLOW2:PTRMAP_OVERFLOW1);
        rc = ptrmapPut(pBt, pgnoOvfl, eType, pgnoPtrmap);
        if( rc ){
          releasePage(pOvfl);
        }
      }
#endif
      if( rc ){
        releasePage(pToRelease);
        return rc;
      }
      put4byte(pPrior, pgnoOvfl);
      releasePage(pToRelease);
      pToRelease = pOvfl;
      pPrior = pOvfl->aData;
      put4byte(pPrior, 0);
      pPayload = &pOvfl->aData[4];
      spaceLeft = pBt->usableSize - 4;
    }
    n = nPayload;
    if( n>spaceLeft ) n = spaceLeft;
    if( nSrc>0 ){
      if( n>nSrc ) n = nSrc;
      assert( pSrc );
      memcpy(pPayload, pSrc, n);
    }else{
      memset(pPayload, 0, n);
    }
    nPayload -= n;
    pPayload += n;
    pSrc += n;
    nSrc -= n;
    spaceLeft -= n;
    if( nSrc==0 ){
      nSrc = nData;
      pSrc = pData;
    }
  }
  releasePage(pToRelease);
  return SQLITE_OK;
}


/*
** Change the MemPage.pParent pointer on the page whose number is
** given in the second argument so that MemPage.pParent holds the
** pointer in the third argument.
**
** If the final argument, updatePtrmap, is non-zero and the database
** is an auto-vacuum database, then the pointer-map entry for pgno
** is updated.
*/
static int reparentPage(
  BtShared *pBt,                /* B-Tree structure */
  Pgno pgno,                    /* Page number of child being adopted */
  MemPage *pNewParent,          /* New parent of pgno */
  int idx,                      /* Index of child page pgno in pNewParent */
  int updatePtrmap              /* If true, update pointer-map for pgno */
){
  MemPage *pThis;
  DbPage *pDbPage;

  assert( sqlite3_mutex_held(pBt->mutex) );
  assert( pNewParent!=0 );
  if( pgno==0 ) return SQLITE_OK;
  assert( pBt->pPager!=0 );
  pDbPage = sqlite3PagerLookup(pBt->pPager, pgno);
  if( pDbPage ){
    pThis = (MemPage *)sqlite3PagerGetExtra(pDbPage);
    if( pThis->isInit ){
      assert( pThis->aData==sqlite3PagerGetData(pDbPage) );
      if( pThis->pParent!=pNewParent ){
        if( pThis->pParent ) sqlite3PagerUnref(pThis->pParent->pDbPage);
        pThis->pParent = pNewParent;
        sqlite3PagerRef(pNewParent->pDbPage);
      }
      pThis->idxParent = idx;
    }
    sqlite3PagerUnref(pDbPage);
  }

  if( ISAUTOVACUUM && updatePtrmap ){
    return ptrmapPut(pBt, pgno, PTRMAP_BTREE, pNewParent->pgno);
  }

#ifndef NDEBUG
  /* If the updatePtrmap flag was clear, assert that the entry in the
  ** pointer-map is already correct.
  */
  if( ISAUTOVACUUM ){
    pDbPage = sqlite3PagerLookup(pBt->pPager,PTRMAP_PAGENO(pBt,pgno));
    if( pDbPage ){
      u8 eType;
      Pgno ii;
      int rc = ptrmapGet(pBt, pgno, &eType, &ii);
      assert( rc==SQLITE_OK && ii==pNewParent->pgno && eType==PTRMAP_BTREE );
      sqlite3PagerUnref(pDbPage);
    }
  }
#endif

  return SQLITE_OK;
}



/*
** Change the pParent pointer of all children of pPage to point back
** to pPage.
**
** In other words, for every child of pPage, invoke reparentPage()
** to make sure that each child knows that pPage is its parent.
**
** This routine gets called after you memcpy() one page into
** another.
**
** If updatePtrmap is true, then the pointer-map entries for all child
** pages of pPage are updated.
*/
static int reparentChildPages(MemPage *pPage, int updatePtrmap){
  int rc = SQLITE_OK;
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  if( !pPage->leaf ){
    int i;
    BtShared *pBt = pPage->pBt;
    Pgno iRight = get4byte(&pPage->aData[pPage->hdrOffset+8]);

    for(i=0; i<pPage->nCell; i++){
      u8 *pCell = findCell(pPage, i);
      rc = reparentPage(pBt, get4byte(pCell), pPage, i, updatePtrmap);
      if( rc!=SQLITE_OK ) return rc;
    }
    rc = reparentPage(pBt, iRight, pPage, i, updatePtrmap);
    pPage->idxShift = 0;
  }
  return rc;
}

/*
** Remove the i-th cell from pPage.  This routine effects pPage only.
** The cell content is not freed or deallocated.  It is assumed that
** the cell content has been copied someplace else.  This routine just
** removes the reference to the cell from pPage.
**
** "sz" must be the number of bytes in the cell.
*/
static void dropCell(MemPage *pPage, int idx, int sz){
  int i;          /* Loop counter */
  int pc;         /* Offset to cell content of cell being deleted */
  u8 *data;       /* pPage->aData */
  u8 *ptr;        /* Used to move bytes around within data[] */

  assert( idx>=0 && idx<pPage->nCell );
  assert( sz==cellSize(pPage, idx) );
  assert( sqlite3PagerIswriteable(pPage->pDbPage) );
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  data = pPage->aData;
  ptr = &data[pPage->cellOffset + 2*idx];
  pc = get2byte(ptr);
  assert( pc>10 && pc+sz<=pPage->pBt->usableSize );
  freeSpace(pPage, pc, sz);
  for(i=idx+1; i<pPage->nCell; i++, ptr+=2){
    ptr[0] = ptr[2];
    ptr[1] = ptr[3];
  }
  pPage->nCell--;
  put2byte(&data[pPage->hdrOffset+3], pPage->nCell);
  pPage->nFree += 2;
  pPage->idxShift = 1;
}

/*
** Insert a new cell on pPage at cell index "i".  pCell points to the
** content of the cell.
**
** If the cell content will fit on the page, then put it there.  If it
** will not fit, then make a copy of the cell content into pTemp if
** pTemp is not null.  Regardless of pTemp, allocate a new entry
** in pPage->aOvfl[] and make it point to the cell content (either
** in pTemp or the original pCell) and also record its index. 
** Allocating a new entry in pPage->aCell[] implies that 
** pPage->nOverflow is incremented.
**
** If nSkip is non-zero, then do not copy the first nSkip bytes of the
** cell. The caller will overwrite them after this function returns. If
** nSkip is non-zero, then pCell may not point to an invalid memory location 
** (but pCell+nSkip is always valid).
*/
static int insertCell(
  MemPage *pPage,   /* Page into which we are copying */
  int i,            /* New cell becomes the i-th cell of the page */
  u8 *pCell,        /* Content of the new cell */
  int sz,           /* Bytes of content in pCell */
  u8 *pTemp,        /* Temp storage space for pCell, if needed */
  u8 nSkip          /* Do not write the first nSkip bytes of the cell */
){
  int idx;          /* Where to write new cell content in data[] */
  int j;            /* Loop counter */
  int top;          /* First byte of content for any cell in data[] */
  int end;          /* First byte past the last cell pointer in data[] */
  int ins;          /* Index in data[] where new cell pointer is inserted */
  int hdr;          /* Offset into data[] of the page header */
  int cellOffset;   /* Address of first cell pointer in data[] */
  u8 *data;         /* The content of the whole page */
  u8 *ptr;          /* Used for moving information around in data[] */

  assert( i>=0 && i<=pPage->nCell+pPage->nOverflow );
  assert( sz==cellSizePtr(pPage, pCell) );
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  if( pPage->nOverflow || sz+2>pPage->nFree ){
    if( pTemp ){
      memcpy(pTemp+nSkip, pCell+nSkip, sz-nSkip);
      pCell = pTemp;
    }
    j = pPage->nOverflow++;
    assert( j<sizeof(pPage->aOvfl)/sizeof(pPage->aOvfl[0]) );
    pPage->aOvfl[j].pCell = pCell;
    pPage->aOvfl[j].idx = i;
    pPage->nFree = 0;
  }else{
    int rc = sqlite3PagerWrite(pPage->pDbPage);
    if( rc!=SQLITE_OK ){
      return rc;
    }
    assert( sqlite3PagerIswriteable(pPage->pDbPage) );
    data = pPage->aData;
    hdr = pPage->hdrOffset;
    top = get2byte(&data[hdr+5]);
    cellOffset = pPage->cellOffset;
    end = cellOffset + 2*pPage->nCell + 2;
    ins = cellOffset + 2*i;
    if( end > top - sz ){
      defragmentPage(pPage);
      top = get2byte(&data[hdr+5]);
      assert( end + sz <= top );
    }
    idx = allocateSpace(pPage, sz);
    assert( idx>0 );
    assert( end <= get2byte(&data[hdr+5]) );
    pPage->nCell++;
    pPage->nFree -= 2;
    memcpy(&data[idx+nSkip], pCell+nSkip, sz-nSkip);
    for(j=end-2, ptr=&data[j]; j>ins; j-=2, ptr-=2){
      ptr[0] = ptr[-2];
      ptr[1] = ptr[-1];
    }
    put2byte(&data[ins], idx);
    put2byte(&data[hdr+3], pPage->nCell);
    pPage->idxShift = 1;
#ifndef SQLITE_OMIT_AUTOVACUUM
    if( pPage->pBt->autoVacuum ){
      /* The cell may contain a pointer to an overflow page. If so, write
      ** the entry for the overflow page into the pointer map.
      */
      CellInfo info;
      sqlite3BtreeParseCellPtr(pPage, pCell, &info);
      assert( (info.nData+(pPage->intKey?0:info.nKey))==info.nPayload );
      if( (info.nData+(pPage->intKey?0:info.nKey))>info.nLocal ){
        Pgno pgnoOvfl = get4byte(&pCell[info.iOverflow]);
        rc = ptrmapPut(pPage->pBt, pgnoOvfl, PTRMAP_OVERFLOW1, pPage->pgno);
        if( rc!=SQLITE_OK ) return rc;
      }
    }
#endif
  }

  return SQLITE_OK;
}

/*
** Add a list of cells to a page.  The page should be initially empty.
** The cells are guaranteed to fit on the page.
*/
static void assemblePage(
  MemPage *pPage,   /* The page to be assemblied */
  int nCell,        /* The number of cells to add to this page */
  u8 **apCell,      /* Pointers to cell bodies */
  u16 *aSize        /* Sizes of the cells */
){
  int i;            /* Loop counter */
  int totalSize;    /* Total size of all cells */
  int hdr;          /* Index of page header */
  int cellptr;      /* Address of next cell pointer */
  int cellbody;     /* Address of next cell body */
  u8 *data;         /* Data for the page */

  assert( pPage->nOverflow==0 );
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  totalSize = 0;
  for(i=0; i<nCell; i++){
    totalSize += aSize[i];
  }
  assert( totalSize+2*nCell<=pPage->nFree );
  assert( pPage->nCell==0 );
  cellptr = pPage->cellOffset;
  data = pPage->aData;
  hdr = pPage->hdrOffset;
  put2byte(&data[hdr+3], nCell);
  if( nCell ){
    cellbody = allocateSpace(pPage, totalSize);
    assert( cellbody>0 );
    assert( pPage->nFree >= 2*nCell );
    pPage->nFree -= 2*nCell;
    for(i=0; i<nCell; i++){
      put2byte(&data[cellptr], cellbody);
      memcpy(&data[cellbody], apCell[i], aSize[i]);
      cellptr += 2;
      cellbody += aSize[i];
    }
    assert( cellbody==pPage->pBt->usableSize );
  }
  pPage->nCell = nCell;
}

/*
** The following parameters determine how many adjacent pages get involved
** in a balancing operation.  NN is the number of neighbors on either side
** of the page that participate in the balancing operation.  NB is the
** total number of pages that participate, including the target page and
** NN neighbors on either side.
**
** The minimum value of NN is 1 (of course).  Increasing NN above 1
** (to 2 or 3) gives a modest improvement in SELECT and DELETE performance
** in exchange for a larger degradation in INSERT and UPDATE performance.
** The value of NN appears to give the best results overall.
*/
#define NN 1             /* Number of neighbors on either side of pPage */
#define NB (NN*2+1)      /* Total pages involved in the balance */

/* Forward reference */
static int balance(MemPage*, int);

#ifndef SQLITE_OMIT_QUICKBALANCE
/*
** This version of balance() handles the common special case where
** a new entry is being inserted on the extreme right-end of the
** tree, in other words, when the new entry will become the largest
** entry in the tree.
**
** Instead of trying balance the 3 right-most leaf pages, just add
** a new page to the right-hand side and put the one new entry in
** that page.  This leaves the right side of the tree somewhat
** unbalanced.  But odds are that we will be inserting new entries
** at the end soon afterwards so the nearly empty page will quickly
** fill up.  On average.
**
** pPage is the leaf page which is the right-most page in the tree.
** pParent is its parent.  pPage must have a single overflow entry
** which is also the right-most entry on the page.
*/
static int balance_quick(MemPage *pPage, MemPage *pParent){
  int rc;
  MemPage *pNew;
  Pgno pgnoNew;
  u8 *pCell;
  u16 szCell;
  CellInfo info;
  BtShared *pBt = pPage->pBt;
  int parentIdx = pParent->nCell;   /* pParent new divider cell index */
  int parentSize;                   /* Size of new divider cell */
  u8 parentCell[64];                /* Space for the new divider cell */

  assert( sqlite3_mutex_held(pPage->pBt->mutex) );

  /* Allocate a new page. Insert the overflow cell from pPage
  ** into it. Then remove the overflow cell from pPage.
  */
  rc = allocateBtreePage(pBt, &pNew, &pgnoNew, 0, 0);
  if( rc!=SQLITE_OK ){
    return rc;
  }
  pCell = pPage->aOvfl[0].pCell;
  szCell = cellSizePtr(pPage, pCell);
  zeroPage(pNew, pPage->aData[0]);
  assemblePage(pNew, 1, &pCell, &szCell);
  pPage->nOverflow = 0;

  /* Set the parent of the newly allocated page to pParent. */
  pNew->pParent = pParent;
  sqlite3PagerRef(pParent->pDbPage);

  /* pPage is currently the right-child of pParent. Change this
  ** so that the right-child is the new page allocated above and
  ** pPage is the next-to-right child. 
  **
  ** Ignore the return value of the call to fillInCell(). fillInCell()
  ** may only return other than SQLITE_OK if it is required to allocate
  ** one or more overflow pages. Since an internal table B-Tree cell 
  ** may never spill over onto an overflow page (it is a maximum of 
  ** 13 bytes in size), it is not neccessary to check the return code.
  **
  ** Similarly, the insertCell() function cannot fail if the page
  ** being inserted into is already writable and the cell does not 
  ** contain an overflow pointer. So ignore this return code too.
  */
  assert( pPage->nCell>0 );
  pCell = findCell(pPage, pPage->nCell-1);
  sqlite3BtreeParseCellPtr(pPage, pCell, &info);
  fillInCell(pParent, parentCell, 0, info.nKey, 0, 0, 0, &parentSize);
  assert( parentSize<64 );
  assert( sqlite3PagerIswriteable(pParent->pDbPage) );
  insertCell(pParent, parentIdx, parentCell, parentSize, 0, 4);
  put4byte(findOverflowCell(pParent,parentIdx), pPage->pgno);
  put4byte(&pParent->aData[pParent->hdrOffset+8], pgnoNew);

  /* If this is an auto-vacuum database, update the pointer map
  ** with entries for the new page, and any pointer from the 
  ** cell on the page to an overflow page.
  */
  if( ISAUTOVACUUM ){
    rc = ptrmapPut(pBt, pgnoNew, PTRMAP_BTREE, pParent->pgno);
    if( rc==SQLITE_OK ){
      rc = ptrmapPutOvfl(pNew, 0);
    }
    if( rc!=SQLITE_OK ){
      releasePage(pNew);
      return rc;
    }
  }

  /* Release the reference to the new page and balance the parent page,
  ** in case the divider cell inserted caused it to become overfull.
  */
  releasePage(pNew);
  return balance(pParent, 0);
}
#endif /* SQLITE_OMIT_QUICKBALANCE */

/*
** This routine redistributes Cells on pPage and up to NN*2 siblings
** of pPage so that all pages have about the same amount of free space.
** Usually NN siblings on either side of pPage is used in the balancing,
** though more siblings might come from one side if pPage is the first
** or last child of its parent.  If pPage has fewer than 2*NN siblings
** (something which can only happen if pPage is the root page or a 
** child of root) then all available siblings participate in the balancing.
**
** The number of siblings of pPage might be increased or decreased by one or
** two in an effort to keep pages nearly full but not over full. The root page
** is special and is allowed to be nearly empty. If pPage is 
** the root page, then the depth of the tree might be increased
** or decreased by one, as necessary, to keep the root page from being
** overfull or completely empty.
**
** Note that when this routine is called, some of the Cells on pPage
** might not actually be stored in pPage->aData[].  This can happen
** if the page is overfull.  Part of the job of this routine is to
** make sure all Cells for pPage once again fit in pPage->aData[].
**
** In the course of balancing the siblings of pPage, the parent of pPage
** might become overfull or underfull.  If that happens, then this routine
** is called recursively on the parent.
**
** If this routine fails for any reason, it might leave the database
** in a corrupted state.  So if this routine fails, the database should
** be rolled back.
*/
static int balance_nonroot(MemPage *pPage){
  MemPage *pParent;            /* The parent of pPage */
  BtShared *pBt;               /* The whole database */
  int nCell = 0;               /* Number of cells in apCell[] */
  int nMaxCells = 0;           /* Allocated size of apCell, szCell, aFrom. */
  int nOld;                    /* Number of pages in apOld[] */
  int nNew;                    /* Number of pages in apNew[] */
  int nDiv;                    /* Number of cells in apDiv[] */
  int i, j, k;                 /* Loop counters */
  int idx;                     /* Index of pPage in pParent->aCell[] */
  int nxDiv;                   /* Next divider slot in pParent->aCell[] */
  int rc;                      /* The return code */
  int leafCorrection;          /* 4 if pPage is a leaf.  0 if not */
  int leafData;                /* True if pPage is a leaf of a LEAFDATA tree */
  int usableSpace;             /* Bytes in pPage beyond the header */
  int pageFlags;               /* Value of pPage->aData[0] */
  int subtotal;                /* Subtotal of bytes in cells on one page */
  int iSpace1 = 0;             /* First unused byte of aSpace1[] */
  int iSpace2 = 0;             /* First unused byte of aSpace2[] */
  int szScratch;               /* Size of scratch memory requested */
  MemPage *apOld[NB];          /* pPage and up to two siblings */
  Pgno pgnoOld[NB];            /* Page numbers for each page in apOld[] */
  MemPage *apCopy[NB];         /* Private copies of apOld[] pages */
  MemPage *apNew[NB+2];        /* pPage and up to NB siblings after balancing */
  Pgno pgnoNew[NB+2];          /* Page numbers for each page in apNew[] */
  u8 *apDiv[NB];               /* Divider cells in pParent */
  int cntNew[NB+2];            /* Index in aCell[] of cell after i-th page */
  int szNew[NB+2];             /* Combined size of cells place on i-th page */
  u8 **apCell = 0;             /* All cells begin balanced */
  u16 *szCell;                 /* Local size of all cells in apCell[] */
  u8 *aCopy[NB];         /* Space for holding data of apCopy[] */
  u8 *aSpace1;           /* Space for copies of dividers cells before balance */
  u8 *aSpace2 = 0;       /* Space for overflow dividers cells after balance */
  u8 *aFrom = 0;

  assert( sqlite3_mutex_held(pPage->pBt->mutex) );

  /* 
  ** Find the parent page.
  */
  assert( pPage->isInit );
  assert( sqlite3PagerIswriteable(pPage->pDbPage) || pPage->nOverflow==1 );
  pBt = pPage->pBt;
  pParent = pPage->pParent;
  assert( pParent );
  if( SQLITE_OK!=(rc = sqlite3PagerWrite(pParent->pDbPage)) ){
    return rc;
  }

  TRACE(("BALANCE: begin page %d child of %d\n", pPage->pgno, pParent->pgno));

#ifndef SQLITE_OMIT_QUICKBALANCE
  /*
  ** A special case:  If a new entry has just been inserted into a
  ** table (that is, a btree with integer keys and all data at the leaves)
  ** and the new entry is the right-most entry in the tree (it has the
  ** largest key) then use the special balance_quick() routine for
  ** balancing.  balance_quick() is much faster and results in a tighter
  ** packing of data in the common case.
  */
  if( pPage->leaf &&
      pPage->intKey &&
      pPage->nOverflow==1 &&
      pPage->aOvfl[0].idx==pPage->nCell &&
      pPage->pParent->pgno!=1 &&
      get4byte(&pParent->aData[pParent->hdrOffset+8])==pPage->pgno
  ){
    assert( pPage->intKey );
    /*
    ** TODO: Check the siblings to the left of pPage. It may be that
    ** they are not full and no new page is required.
    */
    return balance_quick(pPage, pParent);
  }
#endif

  if( SQLITE_OK!=(rc = sqlite3PagerWrite(pPage->pDbPage)) ){
    return rc;
  }

  /*
  ** Find the cell in the parent page whose left child points back
  ** to pPage.  The "idx" variable is the index of that cell.  If pPage
  ** is the rightmost child of pParent then set idx to pParent->nCell 
  */
  if( pParent->idxShift ){
    Pgno pgno;
    pgno = pPage->pgno;
    assert( pgno==sqlite3PagerPagenumber(pPage->pDbPage) );
    for(idx=0; idx<pParent->nCell; idx++){
      if( get4byte(findCell(pParent, idx))==pgno ){
        break;
      }
    }
    assert( idx<pParent->nCell
             || get4byte(&pParent->aData[pParent->hdrOffset+8])==pgno );
  }else{
    idx = pPage->idxParent;
  }

  /*
  ** Initialize variables so that it will be safe to jump
  ** directly to balance_cleanup at any moment.
  */
  nOld = nNew = 0;
  sqlite3PagerRef(pParent->pDbPage);

  /*
  ** Find sibling pages to pPage and the cells in pParent that divide
  ** the siblings.  An attempt is made to find NN siblings on either
  ** side of pPage.  More siblings are taken from one side, however, if
  ** pPage there are fewer than NN siblings on the other side.  If pParent
  ** has NB or fewer children then all children of pParent are taken.
  */
  nxDiv = idx - NN;
  if( nxDiv + NB > pParent->nCell ){
    nxDiv = pParent->nCell - NB + 1;
  }
  if( nxDiv<0 ){
    nxDiv = 0;
  }
  nDiv = 0;
  for(i=0, k=nxDiv; i<NB; i++, k++){
    if( k<pParent->nCell ){
      apDiv[i] = findCell(pParent, k);
      nDiv++;
      assert( !pParent->leaf );
      pgnoOld[i] = get4byte(apDiv[i]);
    }else if( k==pParent->nCell ){
      pgnoOld[i] = get4byte(&pParent->aData[pParent->hdrOffset+8]);
    }else{
      break;
    }
    rc = getAndInitPage(pBt, pgnoOld[i], &apOld[i], pParent);
    if( rc ) goto balance_cleanup;
    apOld[i]->idxParent = k;
    apCopy[i] = 0;
    assert( i==nOld );
    nOld++;
    nMaxCells += 1+apOld[i]->nCell+apOld[i]->nOverflow;
  }

  /* Make nMaxCells a multiple of 4 in order to preserve 8-byte
  ** alignment */
  nMaxCells = (nMaxCells + 3)&~3;

  /*
  ** Allocate space for memory structures
  */
  szScratch =
       nMaxCells*sizeof(u8*)                       /* apCell */
     + nMaxCells*sizeof(u16)                       /* szCell */
     + (ROUND8(sizeof(MemPage))+pBt->pageSize)*NB  /* aCopy */
     + pBt->pageSize                               /* aSpace1 */
     + (ISAUTOVACUUM ? nMaxCells : 0);             /* aFrom */
  apCell = sqlite3ScratchMalloc( szScratch ); 
  if( apCell==0 ){
    rc = SQLITE_NOMEM;
    goto balance_cleanup;
  }
  szCell = (u16*)&apCell[nMaxCells];
  aCopy[0] = (u8*)&szCell[nMaxCells];
  assert( ((aCopy[0] - (u8*)apCell) & 7)==0 ); /* 8-byte alignment required */
  for(i=1; i<NB; i++){
    aCopy[i] = &aCopy[i-1][pBt->pageSize+ROUND8(sizeof(MemPage))];
    assert( ((aCopy[i] - (u8*)apCell) & 7)==0 ); /* 8-byte alignment required */
  }
  aSpace1 = &aCopy[NB-1][pBt->pageSize+ROUND8(sizeof(MemPage))];
  assert( ((aSpace1 - (u8*)apCell) & 7)==0 ); /* 8-byte alignment required */
  if( ISAUTOVACUUM ){
    aFrom = &aSpace1[pBt->pageSize];
  }
  aSpace2 = sqlite3PageMalloc(pBt->pageSize);
  if( aSpace2==0 ){
    rc = SQLITE_NOMEM;
    goto balance_cleanup;
  }
  
  /*
  ** Make copies of the content of pPage and its siblings into aOld[].
  ** The rest of this function will use data from the copies rather
  ** that the original pages since the original pages will be in the
  ** process of being overwritten.
  */
  for(i=0; i<nOld; i++){
    MemPage *p = apCopy[i] = (MemPage*)aCopy[i];
    memcpy(p, apOld[i], sizeof(MemPage));
    p->aData = (void*)&p[1];
    memcpy(p->aData, apOld[i]->aData, pBt->pageSize);
  }

  /*
  ** Load pointers to all cells on sibling pages and the divider cells
  ** into the local apCell[] array.  Make copies of the divider cells
  ** into space obtained form aSpace1[] and remove the the divider Cells
  ** from pParent.
  **
  ** If the siblings are on leaf pages, then the child pointers of the
  ** divider cells are stripped from the cells before they are copied
  ** into aSpace1[].  In this way, all cells in apCell[] are without
  ** child pointers.  If siblings are not leaves, then all cell in
  ** apCell[] include child pointers.  Either way, all cells in apCell[]
  ** are alike.
  **
  ** leafCorrection:  4 if pPage is a leaf.  0 if pPage is not a leaf.
  **       leafData:  1 if pPage holds key+data and pParent holds only keys.
  */
  nCell = 0;
  leafCorrection = pPage->leaf*4;
  leafData = pPage->hasData;
  for(i=0; i<nOld; i++){
    MemPage *pOld = apCopy[i];
    int limit = pOld->nCell+pOld->nOverflow;
    for(j=0; j<limit; j++){
      assert( nCell<nMaxCells );
      apCell[nCell] = findOverflowCell(pOld, j);
      szCell[nCell] = cellSizePtr(pOld, apCell[nCell]);
      if( ISAUTOVACUUM ){
        int a;
        aFrom[nCell] = i;
        for(a=0; a<pOld->nOverflow; a++){
          if( pOld->aOvfl[a].pCell==apCell[nCell] ){
            aFrom[nCell] = 0xFF;
            break;
          }
        }
      }
      nCell++;
    }
    if( i<nOld-1 ){
      u16 sz = cellSizePtr(pParent, apDiv[i]);
      if( leafData ){
        /* With the LEAFDATA flag, pParent cells hold only INTKEYs that
        ** are duplicates of keys on the child pages.  We need to remove
        ** the divider cells from pParent, but the dividers cells are not
        ** added to apCell[] because they are duplicates of child cells.
        */
        dropCell(pParent, nxDiv, sz);
      }else{
        u8 *pTemp;
        assert( nCell<nMaxCells );
        szCell[nCell] = sz;
        pTemp = &aSpace1[iSpace1];
        iSpace1 += sz;
        assert( sz<=pBt->pageSize/4 );
        assert( iSpace1<=pBt->pageSize );
        memcpy(pTemp, apDiv[i], sz);
        apCell[nCell] = pTemp+leafCorrection;
        if( ISAUTOVACUUM ){
          aFrom[nCell] = 0xFF;
        }
        dropCell(pParent, nxDiv, sz);
        szCell[nCell] -= leafCorrection;
        assert( get4byte(pTemp)==pgnoOld[i] );
        if( !pOld->leaf ){
          assert( leafCorrection==0 );
          /* The right pointer of the child page pOld becomes the left
          ** pointer of the divider cell */
          memcpy(apCell[nCell], &pOld->aData[pOld->hdrOffset+8], 4);
        }else{
          assert( leafCorrection==4 );
          if( szCell[nCell]<4 ){
            /* Do not allow any cells smaller than 4 bytes. */
            szCell[nCell] = 4;
          }
        }
        nCell++;
      }
    }
  }

  /*
  ** Figure out the number of pages needed to hold all nCell cells.
  ** Store this number in "k".  Also compute szNew[] which is the total
  ** size of all cells on the i-th page and cntNew[] which is the index
  ** in apCell[] of the cell that divides page i from page i+1.  
  ** cntNew[k] should equal nCell.
  **
  ** Values computed by this block:
  **
  **           k: The total number of sibling pages
  **    szNew[i]: Spaced used on the i-th sibling page.
  **   cntNew[i]: Index in apCell[] and szCell[] for the first cell to
  **              the right of the i-th sibling page.
  ** usableSpace: Number of bytes of space available on each sibling.
  ** 
  */
  usableSpace = pBt->usableSize - 12 + leafCorrection;
  for(subtotal=k=i=0; i<nCell; i++){
    assert( i<nMaxCells );
    subtotal += szCell[i] + 2;
    if( subtotal > usableSpace ){
      szNew[k] = subtotal - szCell[i];
      cntNew[k] = i;
      if( leafData ){ i--; }
      subtotal = 0;
      k++;
    }
  }
  szNew[k] = subtotal;
  cntNew[k] = nCell;
  k++;

  /*
  ** The packing computed by the previous block is biased toward the siblings
  ** on the left side.  The left siblings are always nearly full, while the
  ** right-most sibling might be nearly empty.  This block of code attempts
  ** to adjust the packing of siblings to get a better balance.
  **
  ** This adjustment is more than an optimization.  The packing above might
  ** be so out of balance as to be illegal.  For example, the right-most
  ** sibling might be completely empty.  This adjustment is not optional.
  */
  for(i=k-1; i>0; i--){
    int szRight = szNew[i];  /* Size of sibling on the right */
    int szLeft = szNew[i-1]; /* Size of sibling on the left */
    int r;              /* Index of right-most cell in left sibling */
    int d;              /* Index of first cell to the left of right sibling */

    r = cntNew[i-1] - 1;
    d = r + 1 - leafData;
    assert( d<nMaxCells );
    assert( r<nMaxCells );
    while( szRight==0 || szRight+szCell[d]+2<=szLeft-(szCell[r]+2) ){
      szRight += szCell[d] + 2;
      szLeft -= szCell[r] + 2;
      cntNew[i-1]--;
      r = cntNew[i-1] - 1;
      d = r + 1 - leafData;
    }
    szNew[i] = szRight;
    szNew[i-1] = szLeft;
  }

  /* Either we found one or more cells (cntnew[0])>0) or we are the
  ** a virtual root page.  A virtual root page is when the real root
  ** page is page 1 and we are the only child of that page.
  */
  assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) );

  /*
  ** Allocate k new pages.  Reuse old pages where possible.
  */
  assert( pPage->pgno>1 );
  pageFlags = pPage->aData[0];
  for(i=0; i<k; i++){
    MemPage *pNew;
    if( i<nOld ){
      pNew = apNew[i] = apOld[i];
      pgnoNew[i] = pgnoOld[i];
      apOld[i] = 0;
      rc = sqlite3PagerWrite(pNew->pDbPage);
      nNew++;
      if( rc ) goto balance_cleanup;
    }else{
      assert( i>0 );
      rc = allocateBtreePage(pBt, &pNew, &pgnoNew[i], pgnoNew[i-1], 0);
      if( rc ) goto balance_cleanup;
      apNew[i] = pNew;
      nNew++;
    }
  }

  /* Free any old pages that were not reused as new pages.
  */
  while( i<nOld ){
    rc = freePage(apOld[i]);
    if( rc ) goto balance_cleanup;
    releasePage(apOld[i]);
    apOld[i] = 0;
    i++;
  }

  /*
  ** Put the new pages in accending order.  This helps to
  ** keep entries in the disk file in order so that a scan
  ** of the table is a linear scan through the file.  That
  ** in turn helps the operating system to deliver pages
  ** from the disk more rapidly.
  **
  ** An O(n^2) insertion sort algorithm is used, but since
  ** n is never more than NB (a small constant), that should
  ** not be a problem.
  **
  ** When NB==3, this one optimization makes the database
  ** about 25% faster for large insertions and deletions.
  */
  for(i=0; i<k-1; i++){
    int minV = pgnoNew[i];
    int minI = i;
    for(j=i+1; j<k; j++){
      if( pgnoNew[j]<(unsigned)minV ){
        minI = j;
        minV = pgnoNew[j];
      }
    }
    if( minI>i ){
      int t;
      MemPage *pT;
      t = pgnoNew[i];
      pT = apNew[i];
      pgnoNew[i] = pgnoNew[minI];
      apNew[i] = apNew[minI];
      pgnoNew[minI] = t;
      apNew[minI] = pT;
    }
  }
  TRACE(("BALANCE: old: %d %d %d  new: %d(%d) %d(%d) %d(%d) %d(%d) %d(%d)\n",
    pgnoOld[0], 
    nOld>=2 ? pgnoOld[1] : 0,
    nOld>=3 ? pgnoOld[2] : 0,
    pgnoNew[0], szNew[0],
    nNew>=2 ? pgnoNew[1] : 0, nNew>=2 ? szNew[1] : 0,
    nNew>=3 ? pgnoNew[2] : 0, nNew>=3 ? szNew[2] : 0,
    nNew>=4 ? pgnoNew[3] : 0, nNew>=4 ? szNew[3] : 0,
    nNew>=5 ? pgnoNew[4] : 0, nNew>=5 ? szNew[4] : 0));

  /*
  ** Evenly distribute the data in apCell[] across the new pages.
  ** Insert divider cells into pParent as necessary.
  */
  j = 0;
  for(i=0; i<nNew; i++){
    /* Assemble the new sibling page. */
    MemPage *pNew = apNew[i];
    assert( j<nMaxCells );
    assert( pNew->pgno==pgnoNew[i] );
    zeroPage(pNew, pageFlags);
    assemblePage(pNew, cntNew[i]-j, &apCell[j], &szCell[j]);
    assert( pNew->nCell>0 || (nNew==1 && cntNew[0]==0) );
    assert( pNew->nOverflow==0 );

    /* If this is an auto-vacuum database, update the pointer map entries
    ** that point to the siblings that were rearranged. These can be: left
    ** children of cells, the right-child of the page, or overflow pages
    ** pointed to by cells.
    */
    if( ISAUTOVACUUM ){
      for(k=j; k<cntNew[i]; k++){
        assert( k<nMaxCells );
        if( aFrom[k]==0xFF || apCopy[aFrom[k]]->pgno!=pNew->pgno ){
          rc = ptrmapPutOvfl(pNew, k-j);
          if( rc==SQLITE_OK && leafCorrection==0 ){
            rc = ptrmapPut(pBt, get4byte(apCell[k]), PTRMAP_BTREE, pNew->pgno);
          }
          if( rc!=SQLITE_OK ){
            goto balance_cleanup;
          }
        }
      }
    }

    j = cntNew[i];

    /* If the sibling page assembled above was not the right-most sibling,
    ** insert a divider cell into the parent page.
    */
    if( i<nNew-1 && j<nCell ){
      u8 *pCell;
      u8 *pTemp;
      int sz;

      assert( j<nMaxCells );
      pCell = apCell[j];
      sz = szCell[j] + leafCorrection;
      pTemp = &aSpace2[iSpace2];
      if( !pNew->leaf ){
        memcpy(&pNew->aData[8], pCell, 4);
        if( ISAUTOVACUUM 
         && (aFrom[j]==0xFF || apCopy[aFrom[j]]->pgno!=pNew->pgno)
        ){
          rc = ptrmapPut(pBt, get4byte(pCell), PTRMAP_BTREE, pNew->pgno);
          if( rc!=SQLITE_OK ){
            goto balance_cleanup;
          }
        }
      }else if( leafData ){
        /* If the tree is a leaf-data tree, and the siblings are leaves, 
        ** then there is no divider cell in apCell[]. Instead, the divider 
        ** cell consists of the integer key for the right-most cell of 
        ** the sibling-page assembled above only.
        */
        CellInfo info;
        j--;
        sqlite3BtreeParseCellPtr(pNew, apCell[j], &info);
        pCell = pTemp;
        fillInCell(pParent, pCell, 0, info.nKey, 0, 0, 0, &sz);
        pTemp = 0;
      }else{
        pCell -= 4;
        /* Obscure case for non-leaf-data trees: If the cell at pCell was
        ** previously stored on a leaf node, and its reported size was 4
        ** bytes, then it may actually be smaller than this 
        ** (see sqlite3BtreeParseCellPtr(), 4 bytes is the minimum size of
        ** any cell). But it is important to pass the correct size to 
        ** insertCell(), so reparse the cell now.
        **
        ** Note that this can never happen in an SQLite data file, as all
        ** cells are at least 4 bytes. It only happens in b-trees used
        ** to evaluate "IN (SELECT ...)" and similar clauses.
        */
        if( szCell[j]==4 ){
          assert(leafCorrection==4);
          sz = cellSizePtr(pParent, pCell);
        }
      }
      iSpace2 += sz;
      assert( sz<=pBt->pageSize/4 );
      assert( iSpace2<=pBt->pageSize );
      rc = insertCell(pParent, nxDiv, pCell, sz, pTemp, 4);
      if( rc!=SQLITE_OK ) goto balance_cleanup;
      put4byte(findOverflowCell(pParent,nxDiv), pNew->pgno);

      /* If this is an auto-vacuum database, and not a leaf-data tree,
      ** then update the pointer map with an entry for the overflow page
      ** that the cell just inserted points to (if any).
      */
      if( ISAUTOVACUUM && !leafData ){
        rc = ptrmapPutOvfl(pParent, nxDiv);
        if( rc!=SQLITE_OK ){
          goto balance_cleanup;
        }
      }
      j++;
      nxDiv++;
    }

    /* Set the pointer-map entry for the new sibling page. */
    if( ISAUTOVACUUM ){
      rc = ptrmapPut(pBt, pNew->pgno, PTRMAP_BTREE, pParent->pgno);
      if( rc!=SQLITE_OK ){
        goto balance_cleanup;
      }
    }
  }
  assert( j==nCell );
  assert( nOld>0 );
  assert( nNew>0 );
  if( (pageFlags & PTF_LEAF)==0 ){
    u8 *zChild = &apCopy[nOld-1]->aData[8];
    memcpy(&apNew[nNew-1]->aData[8], zChild, 4);
    if( ISAUTOVACUUM ){
      rc = ptrmapPut(pBt, get4byte(zChild), PTRMAP_BTREE, apNew[nNew-1]->pgno);
      if( rc!=SQLITE_OK ){
        goto balance_cleanup;
      }
    }
  }
  if( nxDiv==pParent->nCell+pParent->nOverflow ){
    /* Right-most sibling is the right-most child of pParent */
    put4byte(&pParent->aData[pParent->hdrOffset+8], pgnoNew[nNew-1]);
  }else{
    /* Right-most sibling is the left child of the first entry in pParent
    ** past the right-most divider entry */
    put4byte(findOverflowCell(pParent, nxDiv), pgnoNew[nNew-1]);
  }

  /*
  ** Reparent children of all cells.
  */
  for(i=0; i<nNew; i++){
    rc = reparentChildPages(apNew[i], 0);
    if( rc!=SQLITE_OK ) goto balance_cleanup;
  }
  rc = reparentChildPages(pParent, 0);
  if( rc!=SQLITE_OK ) goto balance_cleanup;

  /*
  ** Balance the parent page.  Note that the current page (pPage) might
  ** have been added to the freelist so it might no longer be initialized.
  ** But the parent page will always be initialized.
  */
  assert( pParent->isInit );
  sqlite3ScratchFree(apCell);
  apCell = 0;
  rc = balance(pParent, 0);
  
  /*
  ** Cleanup before returning.
  */
balance_cleanup:
  sqlite3PageFree(aSpace2);
  sqlite3ScratchFree(apCell);
  for(i=0; i<nOld; i++){
    releasePage(apOld[i]);
  }
  for(i=0; i<nNew; i++){
    releasePage(apNew[i]);
  }
  releasePage(pParent);
  TRACE(("BALANCE: finished with %d: old=%d new=%d cells=%d\n",
          pPage->pgno, nOld, nNew, nCell));
  return rc;
}

/*
** This routine is called for the root page of a btree when the root
** page contains no cells.  This is an opportunity to make the tree
** shallower by one level.
*/
static int balance_shallower(MemPage *pPage){
  MemPage *pChild;             /* The only child page of pPage */
  Pgno pgnoChild;              /* Page number for pChild */
  int rc = SQLITE_OK;          /* Return code from subprocedures */
  BtShared *pBt;                  /* The main BTree structure */
  int mxCellPerPage;           /* Maximum number of cells per page */
  u8 **apCell;                 /* All cells from pages being balanced */
  u16 *szCell;                 /* Local size of all cells */

  assert( pPage->pParent==0 );
  assert( pPage->nCell==0 );
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  pBt = pPage->pBt;
  mxCellPerPage = MX_CELL(pBt);
  apCell = sqlite3Malloc( mxCellPerPage*(sizeof(u8*)+sizeof(u16)) );
  if( apCell==0 ) return SQLITE_NOMEM;
  szCell = (u16*)&apCell[mxCellPerPage];
  if( pPage->leaf ){
    /* The table is completely empty */
    TRACE(("BALANCE: empty table %d\n", pPage->pgno));
  }else{
    /* The root page is empty but has one child.  Transfer the
    ** information from that one child into the root page if it 
    ** will fit.  This reduces the depth of the tree by one.
    **
    ** If the root page is page 1, it has less space available than
    ** its child (due to the 100 byte header that occurs at the beginning
    ** of the database fle), so it might not be able to hold all of the 
    ** information currently contained in the child.  If this is the 
    ** case, then do not do the transfer.  Leave page 1 empty except
    ** for the right-pointer to the child page.  The child page becomes
    ** the virtual root of the tree.
    */
    pgnoChild = get4byte(&pPage->aData[pPage->hdrOffset+8]);
    assert( pgnoChild>0 );
    assert( pgnoChild<=pagerPagecount(pPage->pBt->pPager) );
    rc = sqlite3BtreeGetPage(pPage->pBt, pgnoChild, &pChild, 0);
    if( rc ) goto end_shallow_balance;
    if( pPage->pgno==1 ){
      rc = sqlite3BtreeInitPage(pChild, pPage);
      if( rc ) goto end_shallow_balance;
      assert( pChild->nOverflow==0 );
      if( pChild->nFree>=100 ){
        /* The child information will fit on the root page, so do the
        ** copy */
        int i;
        zeroPage(pPage, pChild->aData[0]);
        for(i=0; i<pChild->nCell; i++){
          apCell[i] = findCell(pChild,i);
          szCell[i] = cellSizePtr(pChild, apCell[i]);
        }
        assemblePage(pPage, pChild->nCell, apCell, szCell);
        /* Copy the right-pointer of the child to the parent. */
        put4byte(&pPage->aData[pPage->hdrOffset+8], 
            get4byte(&pChild->aData[pChild->hdrOffset+8]));
        freePage(pChild);
        TRACE(("BALANCE: child %d transfer to page 1\n", pChild->pgno));
      }else{
        /* The child has more information that will fit on the root.
        ** The tree is already balanced.  Do nothing. */
        TRACE(("BALANCE: child %d will not fit on page 1\n", pChild->pgno));
      }
    }else{
      memcpy(pPage->aData, pChild->aData, pPage->pBt->usableSize);
      pPage->isInit = 0;
      pPage->pParent = 0;
      rc = sqlite3BtreeInitPage(pPage, 0);
      assert( rc==SQLITE_OK );
      freePage(pChild);
      TRACE(("BALANCE: transfer child %d into root %d\n",
              pChild->pgno, pPage->pgno));
    }
    rc = reparentChildPages(pPage, 1);
    assert( pPage->nOverflow==0 );
    if( ISAUTOVACUUM ){
      int i;
      for(i=0; i<pPage->nCell; i++){ 
        rc = ptrmapPutOvfl(pPage, i);
        if( rc!=SQLITE_OK ){
          goto end_shallow_balance;
        }
      }
    }
    releasePage(pChild);
  }
end_shallow_balance:
  sqlite3_free(apCell);
  return rc;
}


/*
** The root page is overfull
**
** When this happens, Create a new child page and copy the
** contents of the root into the child.  Then make the root
** page an empty page with rightChild pointing to the new
** child.   Finally, call balance_internal() on the new child
** to cause it to split.
*/
static int balance_deeper(MemPage *pPage){
  int rc;             /* Return value from subprocedures */
  MemPage *pChild;    /* Pointer to a new child page */
  Pgno pgnoChild;     /* Page number of the new child page */
  BtShared *pBt;         /* The BTree */
  int usableSize;     /* Total usable size of a page */
  u8 *data;           /* Content of the parent page */
  u8 *cdata;          /* Content of the child page */
  int hdr;            /* Offset to page header in parent */
  int brk;            /* Offset to content of first cell in parent */

  assert( pPage->pParent==0 );
  assert( pPage->nOverflow>0 );
  pBt = pPage->pBt;
  assert( sqlite3_mutex_held(pBt->mutex) );
  rc = allocateBtreePage(pBt, &pChild, &pgnoChild, pPage->pgno, 0);
  if( rc ) return rc;
  assert( sqlite3PagerIswriteable(pChild->pDbPage) );
  usableSize = pBt->usableSize;
  data = pPage->aData;
  hdr = pPage->hdrOffset;
  brk = get2byte(&data[hdr+5]);
  cdata = pChild->aData;
  memcpy(cdata, &data[hdr], pPage->cellOffset+2*pPage->nCell-hdr);
  memcpy(&cdata[brk], &data[brk], usableSize-brk);
  if( pChild->isInit ) return SQLITE_CORRUPT;
  rc = sqlite3BtreeInitPage(pChild, pPage);
  if( rc ) goto balancedeeper_out;
  memcpy(pChild->aOvfl, pPage->aOvfl, pPage->nOverflow*sizeof(pPage->aOvfl[0]));
  pChild->nOverflow = pPage->nOverflow;
  if( pChild->nOverflow ){
    pChild->nFree = 0;
  }
  assert( pChild->nCell==pPage->nCell );
  zeroPage(pPage, pChild->aData[0] & ~PTF_LEAF);
  put4byte(&pPage->aData[pPage->hdrOffset+8], pgnoChild);
  TRACE(("BALANCE: copy root %d into %d\n", pPage->pgno, pChild->pgno));
  if( ISAUTOVACUUM ){
    int i;
    rc = ptrmapPut(pBt, pChild->pgno, PTRMAP_BTREE, pPage->pgno);
    if( rc ) goto balancedeeper_out;
    for(i=0; i<pChild->nCell; i++){
      rc = ptrmapPutOvfl(pChild, i);
      if( rc!=SQLITE_OK ){
        goto balancedeeper_out;
      }
    }
    rc = reparentChildPages(pChild, 1);
  }
  if( rc==SQLITE_OK ){
    rc = balance_nonroot(pChild);
  }

balancedeeper_out:
  releasePage(pChild);
  return rc;
}

/*
** Decide if the page pPage needs to be balanced.  If balancing is
** required, call the appropriate balancing routine.
*/
static int balance(MemPage *pPage, int insert){
  int rc = SQLITE_OK;
  assert( sqlite3_mutex_held(pPage->pBt->mutex) );
  if( pPage->pParent==0 ){
    rc = sqlite3PagerWrite(pPage->pDbPage);
    if( rc==SQLITE_OK && pPage->nOverflow>0 ){
      rc = balance_deeper(pPage);
    }
    if( rc==SQLITE_OK && pPage->nCell==0 ){
      rc = balance_shallower(pPage);
    }
  }else{
    if( pPage->nOverflow>0 || 
        (!insert && pPage->nFree>pPage->pBt->usableSize*2/3) ){
      rc = balance_nonroot(pPage);
    }
  }
  return rc;
}

/*
** This routine checks all cursors that point to table pgnoRoot.
** If any of those cursors were opened with wrFlag==0 in a different
** database connection (a database connection that shares the pager
** cache with the current connection) and that other connection 
** is not in the ReadUncommmitted state, then this routine returns 
** SQLITE_LOCKED.
**
** As well as cursors with wrFlag==0, cursors with wrFlag==1 and 
** isIncrblobHandle==1 are also considered 'read' cursors. Incremental 
** blob cursors are used for both reading and writing.
**
** When pgnoRoot is the root page of an intkey table, this function is also
** responsible for invalidating incremental blob cursors when the table row
** on which they are opened is deleted or modified. Cursors are invalidated
** according to the following rules:
**
**   1) When BtreeClearTable() is called to completely delete the contents
**      of a B-Tree table, pExclude is set to zero and parameter iRow is 
**      set to non-zero. In this case all incremental blob cursors open
**      on the table rooted at pgnoRoot are invalidated.
**
**   2) When BtreeInsert(), BtreeDelete() or BtreePutData() is called to 
**      modify a table row via an SQL statement, pExclude is set to the 
**      write cursor used to do the modification and parameter iRow is set
**      to the integer row id of the B-Tree entry being modified. Unless
**      pExclude is itself an incremental blob cursor, then all incremental
**      blob cursors open on row iRow of the B-Tree are invalidated.
**
**   3) If both pExclude and iRow are set to zero, no incremental blob 
**      cursors are invalidated.
*/
static int checkReadLocks(
  Btree *pBtree, 
  Pgno pgnoRoot, 
  BtCursor *pExclude,
  i64 iRow
){
  BtCursor *p;
  BtShared *pBt = pBtree->pBt;
  sqlite3 *db = pBtree->db;
  assert( sqlite3BtreeHoldsMutex(pBtree) );
  for(p=pBt->pCursor; p; p=p->pNext){
    if( p==pExclude ) continue;
    if( p->pgnoRoot!=pgnoRoot ) continue;
#ifndef SQLITE_OMIT_INCRBLOB
    if( p->isIncrblobHandle && ( 
         (!pExclude && iRow)
      || (pExclude && !pExclude->isIncrblobHandle && p->info.nKey==iRow)
    )){
      p->eState = CURSOR_INVALID;
    }
#endif
    if( p->eState!=CURSOR_VALID ) continue;
    if( p->wrFlag==0 
#ifndef SQLITE_OMIT_INCRBLOB
     || p->isIncrblobHandle
#endif
    ){
      sqlite3 *dbOther = p->pBtree->db;
      if( dbOther==0 ||
         (dbOther!=db && (dbOther->flags & SQLITE_ReadUncommitted)==0) ){
        return SQLITE_LOCKED;
      }
    }
  }
  return SQLITE_OK;
}

/*
** Insert a new record into the BTree.  The key is given by (pKey,nKey)
** and the data is given by (pData,nData).  The cursor is used only to
** define what table the record should be inserted into.  The cursor
** is left pointing at a random location.
**
** For an INTKEY table, only the nKey value of the key is used.  pKey is
** ignored.  For a ZERODATA table, the pData and nData are both ignored.
*/
int sqlite3BtreeInsert(
  BtCursor *pCur,                /* Insert data into the table of this cursor */
  const void *pKey, i64 nKey,    /* The key of the new record */
  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 rc;
  int loc;
  int szNew;
  MemPage *pPage;
  Btree *p = pCur->pBtree;
  BtShared *pBt = p->pBt;
  unsigned char *oldCell;
  unsigned char *newCell = 0;

  assert( cursorHoldsMutex(pCur) );
  if( pBt->inTransaction!=TRANS_WRITE ){
    /* Must start a transaction before doing an insert */
    rc = pBt->readOnly ? SQLITE_READONLY : SQLITE_ERROR;
    return rc;
  }
  assert( !pBt->readOnly );
  if( !pCur->wrFlag ){
    return SQLITE_PERM;   /* Cursor not open for writing */
  }
  if( checkReadLocks(pCur->pBtree, pCur->pgnoRoot, pCur, nKey) ){
    return SQLITE_LOCKED; /* The table pCur points to has a read lock */
  }
  if( pCur->eState==CURSOR_FAULT ){
    return pCur->skip;
  }

  /* Save the positions of any other cursors open on this table */
  clearCursorPosition(pCur);
  if( 
    SQLITE_OK!=(rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur)) ||
    SQLITE_OK!=(rc = sqlite3BtreeMoveto(pCur, pKey, 0, nKey, appendBias, &loc))
  ){
    return rc;
  }

  pPage = pCur->pPage;
  assert( pPage->intKey || nKey>=0 );
  assert( pPage->leaf || !pPage->intKey );
  TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n",
          pCur->pgnoRoot, nKey, nData, pPage->pgno,
          loc==0 ? "overwrite" : "new entry"));
  assert( pPage->isInit );
  allocateTempSpace(pBt);
  newCell = pBt->pTmpSpace;
  if( newCell==0 ) return SQLITE_NOMEM;
  rc = fillInCell(pPage, newCell, pKey, nKey, pData, nData, nZero, &szNew);
  if( rc ) goto end_insert;
  assert( szNew==cellSizePtr(pPage, newCell) );
  assert( szNew<=MX_CELL_SIZE(pBt) );
  if( loc==0 && CURSOR_VALID==pCur->eState ){
    u16 szOld;
    assert( pCur->idx>=0 && pCur->idx<pPage->nCell );
    rc = sqlite3PagerWrite(pPage->pDbPage);
    if( rc ){
      goto end_insert;
    }
    oldCell = findCell(pPage, pCur->idx);
    if( !pPage->leaf ){
      memcpy(newCell, oldCell, 4);
    }
    szOld = cellSizePtr(pPage, oldCell);
    rc = clearCell(pPage, oldCell);
    if( rc ) goto end_insert;
    dropCell(pPage, pCur->idx, szOld);
  }else if( loc<0 && pPage->nCell>0 ){
    assert( pPage->leaf );
    pCur->idx++;
    pCur->info.nSize = 0;
    pCur->validNKey = 0;
  }else{
    assert( pPage->leaf );
  }
  rc = insertCell(pPage, pCur->idx, newCell, szNew, 0, 0);
  if( rc!=SQLITE_OK ) goto end_insert;
  rc = balance(pPage, 1);
  if( rc==SQLITE_OK ){
    moveToRoot(pCur);
  }
end_insert:
  return rc;
}

/*
** Delete the entry that the cursor is pointing to.  The cursor
** is left pointing at a random location.
*/
int sqlite3BtreeDelete(BtCursor *pCur){
  MemPage *pPage = pCur->pPage;
  unsigned char *pCell;
  int rc;
  Pgno pgnoChild = 0;
  Btree *p = pCur->pBtree;
  BtShared *pBt = p->pBt;

  assert( cursorHoldsMutex(pCur) );
  assert( pPage->isInit );
  if( pBt->inTransaction!=TRANS_WRITE ){
    /* Must start a transaction before doing a delete */
    rc = pBt->readOnly ? SQLITE_READONLY : SQLITE_ERROR;
    return rc;
  }
  assert( !pBt->readOnly );
  if( pCur->eState==CURSOR_FAULT ){
    return pCur->skip;
  }
  if( pCur->idx >= pPage->nCell ){
    return SQLITE_ERROR;  /* The cursor is not pointing to anything */
  }
  if( !pCur->wrFlag ){
    return SQLITE_PERM;   /* Did not open this cursor for writing */
  }
  if( checkReadLocks(pCur->pBtree, pCur->pgnoRoot, pCur, pCur->info.nKey) ){
    return SQLITE_LOCKED; /* The table pCur points to has a read lock */
  }

  /* Restore the current cursor position (a no-op if the cursor is not in 
  ** CURSOR_REQUIRESEEK state) and save the positions of any other cursors 
  ** open on the same table. Then call sqlite3PagerWrite() on the page
  ** that the entry will be deleted from.
  */
  if( 
    (rc = restoreCursorPosition(pCur))!=0 ||
    (rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur))!=0 ||
    (rc = sqlite3PagerWrite(pPage->pDbPage))!=0
  ){
    return rc;
  }

  /* Locate the cell within its page and leave pCell pointing to the
  ** data. The clearCell() call frees any overflow pages associated with the
  ** cell. The cell itself is still intact.
  */
  pCell = findCell(pPage, pCur->idx);
  if( !pPage->leaf ){
    pgnoChild = get4byte(pCell);
  }
  rc = clearCell(pPage, pCell);
  if( rc ){
    return rc;
  }

  if( !pPage->leaf ){
    /*
    ** The entry we are about to delete is not a leaf so if we do not
    ** do something we will leave a hole on an internal page.
    ** We have to fill the hole by moving in a cell from a leaf.  The
    ** next Cell after the one to be deleted is guaranteed to exist and
    ** to be a leaf so we can use it.
    */
    BtCursor leafCur;
    unsigned char *pNext;
    int notUsed;
    unsigned char *tempCell = 0;
    assert( !pPage->intKey );
    sqlite3BtreeGetTempCursor(pCur, &leafCur);
    rc = sqlite3BtreeNext(&leafCur, &notUsed);
    if( rc==SQLITE_OK ){
      rc = sqlite3PagerWrite(leafCur.pPage->pDbPage);
    }
    if( rc==SQLITE_OK ){
      u16 szNext;
      TRACE(("DELETE: table=%d delete internal from %d replace from leaf %d\n",
         pCur->pgnoRoot, pPage->pgno, leafCur.pPage->pgno));
      dropCell(pPage, pCur->idx, cellSizePtr(pPage, pCell));
      pNext = findCell(leafCur.pPage, leafCur.idx);
      szNext = cellSizePtr(leafCur.pPage, pNext);
      assert( MX_CELL_SIZE(pBt)>=szNext+4 );
      allocateTempSpace(pBt);
      tempCell = pBt->pTmpSpace;
      if( tempCell==0 ){
        rc = SQLITE_NOMEM;
      }
      if( rc==SQLITE_OK ){
        rc = insertCell(pPage, pCur->idx, pNext-4, szNext+4, tempCell, 0);
      }
      if( rc==SQLITE_OK ){
        put4byte(findOverflowCell(pPage, pCur->idx), pgnoChild);
        rc = balance(pPage, 0);
      }
      if( rc==SQLITE_OK ){
        dropCell(leafCur.pPage, leafCur.idx, szNext);
        rc = balance(leafCur.pPage, 0);
      }
    }
    sqlite3BtreeReleaseTempCursor(&leafCur);
  }else{
    TRACE(("DELETE: table=%d delete from leaf %d\n",
       pCur->pgnoRoot, pPage->pgno));
    dropCell(pPage, pCur->idx, cellSizePtr(pPage, pCell));
    rc = balance(pPage, 0);
  }
  if( rc==SQLITE_OK ){
    moveToRoot(pCur);
  }
  return rc;
}

/*
** Create a new BTree table.  Write into *piTable the page
** number for the root page of the new table.
**
** The type of type is determined by the flags parameter.  Only the
** following values of flags are currently in use.  Other values for
** flags might not work:
**
**     BTREE_INTKEY|BTREE_LEAFDATA     Used for SQL tables with rowid keys
**     BTREE_ZERODATA                  Used for SQL indices
*/
static int btreeCreateTable(Btree *p, int *piTable, int flags){
  BtShared *pBt = p->pBt;
  MemPage *pRoot;
  Pgno pgnoRoot;
  int rc;

  assert( sqlite3BtreeHoldsMutex(p) );
  if( pBt->inTransaction!=TRANS_WRITE ){
    /* Must start a transaction first */
    rc = pBt->readOnly ? SQLITE_READONLY : SQLITE_ERROR;
    return rc;
  }
  assert( !pBt->readOnly );

#ifdef SQLITE_OMIT_AUTOVACUUM
  rc = allocateBtreePage(pBt, &pRoot, &pgnoRoot, 1, 0);
  if( rc ){
    return rc;
  }
#else
  if( pBt->autoVacuum ){
    Pgno pgnoMove;      /* Move a page here to make room for the root-page */
    MemPage *pPageMove; /* The page to move to. */

    /* Creating a new table may probably require moving an existing database
    ** to make room for the new tables root page. In case this page turns
    ** out to be an overflow page, delete all overflow page-map caches
    ** held by open cursors.
    */
    invalidateAllOverflowCache(pBt);

    /* Read the value of meta[3] from the database to determine where the
    ** root page of the new table should go. meta[3] is the largest root-page
    ** created so far, so the new root-page is (meta[3]+1).
    */
    rc = sqlite3BtreeGetMeta(p, 4, &pgnoRoot);
    if( rc!=SQLITE_OK ){
      return rc;
    }
    pgnoRoot++;

    /* The new root-page may not be allocated on a pointer-map page, or the
    ** PENDING_BYTE page.
    */
    while( pgnoRoot==PTRMAP_PAGENO(pBt, pgnoRoot) ||
        pgnoRoot==PENDING_BYTE_PAGE(pBt) ){
      pgnoRoot++;
    }
    assert( pgnoRoot>=3 );

    /* Allocate a page. The page that currently resides at pgnoRoot will
    ** be moved to the allocated page (unless the allocated page happens
    ** to reside at pgnoRoot).
    */
    rc = allocateBtreePage(pBt, &pPageMove, &pgnoMove, pgnoRoot, 1);
    if( rc!=SQLITE_OK ){
      return rc;
    }

    if( pgnoMove!=pgnoRoot ){
      /* pgnoRoot is the page that will be used for the root-page of
      ** the new table (assuming an error did not occur). But we were
      ** allocated pgnoMove. If required (i.e. if it was not allocated
      ** by extending the file), the current page at position pgnoMove
      ** is already journaled.
      */
      u8 eType;
      Pgno iPtrPage;

      releasePage(pPageMove);

      /* Move the page currently at pgnoRoot to pgnoMove. */
      rc = sqlite3BtreeGetPage(pBt, pgnoRoot, &pRoot, 0);
      if( rc!=SQLITE_OK ){
        return rc;
      }
      rc = ptrmapGet(pBt, pgnoRoot, &eType, &iPtrPage);
      if( rc!=SQLITE_OK || eType==PTRMAP_ROOTPAGE || eType==PTRMAP_FREEPAGE ){
        releasePage(pRoot);
        return rc;
      }
      assert( eType!=PTRMAP_ROOTPAGE );
      assert( eType!=PTRMAP_FREEPAGE );
      rc = sqlite3PagerWrite(pRoot->pDbPage);
      if( rc!=SQLITE_OK ){
        releasePage(pRoot);
        return rc;
      }
      rc = relocatePage(pBt, pRoot, eType, iPtrPage, pgnoMove, 0);
      releasePage(pRoot);

      /* Obtain the page at pgnoRoot */
      if( rc!=SQLITE_OK ){
        return rc;
      }
      rc = sqlite3BtreeGetPage(pBt, pgnoRoot, &pRoot, 0);
      if( rc!=SQLITE_OK ){
        return rc;
      }
      rc = sqlite3PagerWrite(pRoot->pDbPage);
      if( rc!=SQLITE_OK ){
        releasePage(pRoot);
        return rc;
      }
    }else{
      pRoot = pPageMove;
    } 

    /* Update the pointer-map and meta-data with the new root-page number. */
    rc = ptrmapPut(pBt, pgnoRoot, PTRMAP_ROOTPAGE, 0);
    if( rc ){
      releasePage(pRoot);
      return rc;
    }
    rc = sqlite3BtreeUpdateMeta(p, 4, pgnoRoot);
    if( rc ){
      releasePage(pRoot);
      return rc;
    }

  }else{
    rc = allocateBtreePage(pBt, &pRoot, &pgnoRoot, 1, 0);
    if( rc ) return rc;
  }
#endif
  assert( sqlite3PagerIswriteable(pRoot->pDbPage) );
  zeroPage(pRoot, flags | PTF_LEAF);
  sqlite3PagerUnref(pRoot->pDbPage);
  *piTable = (int)pgnoRoot;
  return SQLITE_OK;
}
int sqlite3BtreeCreateTable(Btree *p, int *piTable, int flags){
  int rc;
  sqlite3BtreeEnter(p);
  p->pBt->db = p->db;
  rc = btreeCreateTable(p, piTable, flags);
  sqlite3BtreeLeave(p);
  return rc;
}

/*
** Erase the given database page and all its children.  Return
** the page to the freelist.
*/
static int clearDatabasePage(
  BtShared *pBt,           /* The BTree that contains the table */
  Pgno pgno,            /* Page number to clear */
  MemPage *pParent,     /* Parent page.  NULL for the root */
  int freePageFlag      /* Deallocate page if true */
){
  MemPage *pPage = 0;
  int rc;
  unsigned char *pCell;
  int i;

  assert( sqlite3_mutex_held(pBt->mutex) );
  if( pgno>pagerPagecount(pBt->pPager) ){
    return SQLITE_CORRUPT_BKPT;
  }

  rc = getAndInitPage(pBt, pgno, &pPage, pParent);
  if( rc ) goto cleardatabasepage_out;
  for(i=0; i<pPage->nCell; i++){
    pCell = findCell(pPage, i);
    if( !pPage->leaf ){
      rc = clearDatabasePage(pBt, get4byte(pCell), pPage->pParent, 1);
      if( rc ) goto cleardatabasepage_out;
    }
    rc = clearCell(pPage, pCell);
    if( rc ) goto cleardatabasepage_out;
  }
  if( !pPage->leaf ){
    rc = clearDatabasePage(pBt, get4byte(&pPage->aData[8]), pPage->pParent, 1);
    if( rc ) goto cleardatabasepage_out;
  }
  if( freePageFlag ){
    rc = freePage(pPage);
  }else if( (rc = sqlite3PagerWrite(pPage->pDbPage))==0 ){
    zeroPage(pPage, pPage->aData[0] | PTF_LEAF);
  }

cleardatabasepage_out:
  releasePage(pPage);
  return rc;
}

/*
** Delete all information from a single table in the database.  iTable is
** the page number of the root of the table.  After this routine returns,
** the root page is empty, but still exists.
**
** This routine will fail with SQLITE_LOCKED if there are any open
** read cursors on the table.  Open write cursors are moved to the
** root of the table.
*/
int sqlite3BtreeClearTable(Btree *p, int iTable){
  int rc;
  BtShared *pBt = p->pBt;
  sqlite3BtreeEnter(p);
  pBt->db = p->db;
  if( p->inTrans!=TRANS_WRITE ){
    rc = pBt->readOnly ? SQLITE_READONLY : SQLITE_ERROR;
  }else if( (rc = checkReadLocks(p, iTable, 0, 1))!=SQLITE_OK ){
    /* nothing to do */
  }else if( SQLITE_OK!=(rc = saveAllCursors(pBt, iTable, 0)) ){
    /* nothing to do */
  }else{
    rc = clearDatabasePage(pBt, (Pgno)iTable, 0, 0);
  }
  sqlite3BtreeLeave(p);
  return rc;
}

/*
** Erase all information in a table and add the root of the table to
** the freelist.  Except, the root of the principle table (the one on
** page 1) is never added to the freelist.
**
** This routine will fail with SQLITE_LOCKED if there are any open
** cursors on the table.
**
** If AUTOVACUUM is enabled and the page at iTable is not the last
** root page in the database file, then the last root page 
** in the database file is moved into the slot formerly occupied by
** iTable and that last slot formerly occupied by the last root page
** is added to the freelist instead of iTable.  In this say, all
** root pages are kept at the beginning of the database file, which
** is necessary for AUTOVACUUM to work right.  *piMoved is set to the 
** page number that used to be the last root page in the file before
** the move.  If no page gets moved, *piMoved is set to 0.
** The last root page is recorded in meta[3] and the value of
** meta[3] is updated by this procedure.
*/
static int btreeDropTable(Btree *p, int iTable, int *piMoved){
  int rc;
  MemPage *pPage = 0;
  BtShared *pBt = p->pBt;

  assert( sqlite3BtreeHoldsMutex(p) );
  if( p->inTrans!=TRANS_WRITE ){
    return pBt->readOnly ? SQLITE_READONLY : SQLITE_ERROR;
  }

  /* It is illegal to drop a table if any cursors are open on the
  ** database. This is because in auto-vacuum mode the backend may
  ** need to move another root-page to fill a gap left by the deleted
  ** root page. If an open cursor was using this page a problem would 
  ** occur.
  */
  if( pBt->pCursor ){
    return SQLITE_LOCKED;
  }

  rc = sqlite3BtreeGetPage(pBt, (Pgno)iTable, &pPage, 0);
  if( rc ) return rc;
  rc = sqlite3BtreeClearTable(p, iTable);
  if( rc ){
    releasePage(pPage);
    return rc;
  }

  *piMoved = 0;

  if( iTable>1 ){
#ifdef SQLITE_OMIT_AUTOVACUUM
    rc = freePage(pPage);
    releasePage(pPage);
#else
    if( pBt->autoVacuum ){
      Pgno maxRootPgno;
      rc = sqlite3BtreeGetMeta(p, 4, &maxRootPgno);
      if( rc!=SQLITE_OK ){
        releasePage(pPage);
        return rc;
      }

      if( iTable==maxRootPgno ){
        /* If the table being dropped is the table with the largest root-page
        ** number in the database, put the root page on the free list. 
        */
        rc = freePage(pPage);
        releasePage(pPage);
        if( rc!=SQLITE_OK ){
          return rc;
        }
      }else{
        /* The table being dropped does not have the largest root-page
        ** number in the database. So move the page that does into the 
        ** gap left by the deleted root-page.
        */
        MemPage *pMove;
        releasePage(pPage);
        rc = sqlite3BtreeGetPage(pBt, maxRootPgno, &pMove, 0);
        if( rc!=SQLITE_OK ){
          return rc;
        }
        rc = relocatePage(pBt, pMove, PTRMAP_ROOTPAGE, 0, iTable, 0);
        releasePage(pMove);
        if( rc!=SQLITE_OK ){
          return rc;
        }
        rc = sqlite3BtreeGetPage(pBt, maxRootPgno, &pMove, 0);
        if( rc!=SQLITE_OK ){
          return rc;
        }
        rc = freePage(pMove);
        releasePage(pMove);
        if( rc!=SQLITE_OK ){
          return rc;
        }
        *piMoved = maxRootPgno;
      }

      /* Set the new 'max-root-page' value in the database header. This
      ** is the old value less one, less one more if that happens to
      ** be a root-page number, less one again if that is the
      ** PENDING_BYTE_PAGE.
      */
      maxRootPgno--;
      if( maxRootPgno==PENDING_BYTE_PAGE(pBt) ){
        maxRootPgno--;
      }
      if( maxRootPgno==PTRMAP_PAGENO(pBt, maxRootPgno) ){
        maxRootPgno--;
      }
      assert( maxRootPgno!=PENDING_BYTE_PAGE(pBt) );

      rc = sqlite3BtreeUpdateMeta(p, 4, maxRootPgno);
    }else{
      rc = freePage(pPage);
      releasePage(pPage);
    }
#endif
  }else{
    /* If sqlite3BtreeDropTable was called on page 1. */
    zeroPage(pPage, PTF_INTKEY|PTF_LEAF );
    releasePage(pPage);
  }
  return rc;  
}
int sqlite3BtreeDropTable(Btree *p, int iTable, int *piMoved){
  int rc;
  sqlite3BtreeEnter(p);
  p->pBt->db = p->db;
  rc = btreeDropTable(p, iTable, piMoved);
  sqlite3BtreeLeave(p);
  return rc;
}


/*
** Read the meta-information out of a database file.  Meta[0]
** is the number of free pages currently in the database.  Meta[1]
** through meta[15] are available for use by higher layers.  Meta[0]
** is read-only, the others are read/write.
** 
** The schema layer numbers meta values differently.  At the schema
** layer (and the SetCookie and ReadCookie opcodes) the number of
** free pages is not visible.  So Cookie[0] is the same as Meta[1].
*/
int sqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){
  DbPage *pDbPage;
  int rc;
  unsigned char *pP1;
  BtShared *pBt = p->pBt;

  sqlite3BtreeEnter(p);
  pBt->db = p->db;

  /* Reading a meta-data value requires a read-lock on page 1 (and hence
  ** the sqlite_master table. We grab this lock regardless of whether or
  ** not the SQLITE_ReadUncommitted flag is set (the table rooted at page
  ** 1 is treated as a special case by queryTableLock() and lockTable()).
  */
  rc = queryTableLock(p, 1, READ_LOCK);
  if( rc!=SQLITE_OK ){
    sqlite3BtreeLeave(p);
    return rc;
  }

  assert( idx>=0 && idx<=15 );
  rc = sqlite3PagerGet(pBt->pPager, 1, &pDbPage);
  if( rc ){
    sqlite3BtreeLeave(p);
    return rc;
  }
  pP1 = (unsigned char *)sqlite3PagerGetData(pDbPage);
  *pMeta = get4byte(&pP1[36 + idx*4]);
  sqlite3PagerUnref(pDbPage);

  /* If autovacuumed is disabled in this build but we are trying to 
  ** access an autovacuumed database, then make the database readonly. 
  */
#ifdef SQLITE_OMIT_AUTOVACUUM
  if( idx==4 && *pMeta>0 ) pBt->readOnly = 1;
#endif

  /* Grab the read-lock on page 1. */
  rc = lockTable(p, 1, READ_LOCK);
  sqlite3BtreeLeave(p);
  return rc;
}

/*
** Write meta-information back into the database.  Meta[0] is
** read-only and may not be written.
*/
int sqlite3BtreeUpdateMeta(Btree *p, int idx, u32 iMeta){
  BtShared *pBt = p->pBt;
  unsigned char *pP1;
  int rc;
  assert( idx>=1 && idx<=15 );
  sqlite3BtreeEnter(p);
  pBt->db = p->db;
  if( p->inTrans!=TRANS_WRITE ){
    rc = pBt->readOnly ? SQLITE_READONLY : SQLITE_ERROR;
  }else{
    assert( pBt->pPage1!=0 );
    pP1 = pBt->pPage1->aData;
    rc = sqlite3PagerWrite(pBt->pPage1->pDbPage);
    if( rc==SQLITE_OK ){
      put4byte(&pP1[36 + idx*4], iMeta);
#ifndef SQLITE_OMIT_AUTOVACUUM
      if( idx==7 ){
        assert( pBt->autoVacuum || iMeta==0 );
        assert( iMeta==0 || iMeta==1 );
        pBt->incrVacuum = iMeta;
      }
#endif
    }
  }
  sqlite3BtreeLeave(p);
  return rc;
}

/*
** Return the flag byte at the beginning of the page that the cursor
** is currently pointing to.
*/
int sqlite3BtreeFlags(BtCursor *pCur){
  /* TODO: What about CURSOR_REQUIRESEEK state? Probably need to call
  ** restoreCursorPosition() here.
  */
  MemPage *pPage;
  restoreCursorPosition(pCur);
  pPage = pCur->pPage;
  assert( cursorHoldsMutex(pCur) );
  assert( pPage->pBt==pCur->pBt );
  return pPage ? pPage->aData[pPage->hdrOffset] : 0;
}


/*
** Return the pager associated with a BTree.  This routine is used for
** testing and debugging only.
*/
Pager *sqlite3BtreePager(Btree *p){
  return p->pBt->pPager;
}

#ifndef SQLITE_OMIT_INTEGRITY_CHECK
/*
** Append a message to the error message string.
*/
static void checkAppendMsg(
  IntegrityCk *pCheck,
  char *zMsg1,
  const char *zFormat,
  ...
){
  va_list ap;
  if( !pCheck->mxErr ) return;
  pCheck->mxErr--;
  pCheck->nErr++;
  va_start(ap, zFormat);
  if( pCheck->errMsg.nChar ){
    sqlite3StrAccumAppend(&pCheck->errMsg, "\n", 1);
  }
  if( zMsg1 ){
    sqlite3StrAccumAppend(&pCheck->errMsg, zMsg1, -1);
  }
  sqlite3VXPrintf(&pCheck->errMsg, 1, zFormat, ap);
  va_end(ap);
  if( pCheck->errMsg.mallocFailed ){
    pCheck->mallocFailed = 1;
  }
}
#endif /* SQLITE_OMIT_INTEGRITY_CHECK */

#ifndef SQLITE_OMIT_INTEGRITY_CHECK
/*
** Add 1 to the reference count for page iPage.  If this is the second
** reference to the page, add an error message to pCheck->zErrMsg.
** Return 1 if there are 2 ore more references to the page and 0 if
** if this is the first reference to the page.
**
** Also check that the page number is in bounds.
*/
static int checkRef(IntegrityCk *pCheck, int iPage, char *zContext){
  if( iPage==0 ) return 1;
  if( iPage>pCheck->nPage || iPage<0 ){
    checkAppendMsg(pCheck, zContext, "invalid page number %d", iPage);
    return 1;
  }
  if( pCheck->anRef[iPage]==1 ){
    checkAppendMsg(pCheck, zContext, "2nd reference to page %d", iPage);
    return 1;
  }
  return  (pCheck->anRef[iPage]++)>1;
}

#ifndef SQLITE_OMIT_AUTOVACUUM
/*
** Check that the entry in the pointer-map for page iChild maps to 
** page iParent, pointer type ptrType. If not, append an error message
** to pCheck.
*/
static void checkPtrmap(
  IntegrityCk *pCheck,   /* Integrity check context */
  Pgno iChild,           /* Child page number */
  u8 eType,              /* Expected pointer map type */
  Pgno iParent,          /* Expected pointer map parent page number */
  char *zContext         /* Context description (used for error msg) */
){
  int rc;
  u8 ePtrmapType;
  Pgno iPtrmapParent;

  rc = ptrmapGet(pCheck->pBt, iChild, &ePtrmapType, &iPtrmapParent);
  if( rc!=SQLITE_OK ){
    checkAppendMsg(pCheck, zContext, "Failed to read ptrmap key=%d", iChild);
    return;
  }

  if( ePtrmapType!=eType || iPtrmapParent!=iParent ){
    checkAppendMsg(pCheck, zContext, 
      "Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)", 
      iChild, eType, iParent, ePtrmapType, iPtrmapParent);
  }
}
#endif

/*
** Check the integrity of the freelist or of an overflow page list.
** Verify that the number of pages on the list is N.
*/
static void checkList(
  IntegrityCk *pCheck,  /* Integrity checking context */
  int isFreeList,       /* True for a freelist.  False for overflow page list */
  int iPage,            /* Page number for first page in the list */
  int N,                /* Expected number of pages in the list */
  char *zContext        /* Context for error messages */
){
  int i;
  int expected = N;
  int iFirst = iPage;
  while( N-- > 0 && pCheck->mxErr ){
    DbPage *pOvflPage;
    unsigned char *pOvflData;
    if( iPage<1 ){
      checkAppendMsg(pCheck, zContext,
         "%d of %d pages missing from overflow list starting at %d",
          N+1, expected, iFirst);
      break;
    }
    if( checkRef(pCheck, iPage, zContext) ) break;
    if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage) ){
      checkAppendMsg(pCheck, zContext, "failed to get page %d", iPage);
      break;
    }
    pOvflData = (unsigned char *)sqlite3PagerGetData(pOvflPage);
    if( isFreeList ){
      int n = get4byte(&pOvflData[4]);
#ifndef SQLITE_OMIT_AUTOVACUUM
      if( pCheck->pBt->autoVacuum ){
        checkPtrmap(pCheck, iPage, PTRMAP_FREEPAGE, 0, zContext);
      }
#endif
      if( n>pCheck->pBt->usableSize/4-2 ){
        checkAppendMsg(pCheck, zContext,
           "freelist leaf count too big on page %d", iPage);
        N--;
      }else{
        for(i=0; i<n; i++){
          Pgno iFreePage = get4byte(&pOvflData[8+i*4]);
#ifndef SQLITE_OMIT_AUTOVACUUM
          if( pCheck->pBt->autoVacuum ){
            checkPtrmap(pCheck, iFreePage, PTRMAP_FREEPAGE, 0, zContext);
          }
#endif
          checkRef(pCheck, iFreePage, zContext);
        }
        N -= n;
      }
    }
#ifndef SQLITE_OMIT_AUTOVACUUM
    else{
      /* If this database supports auto-vacuum and iPage is not the last
      ** page in this overflow list, check that the pointer-map entry for
      ** the following page matches iPage.
      */
      if( pCheck->pBt->autoVacuum && N>0 ){
        i = get4byte(pOvflData);
        checkPtrmap(pCheck, i, PTRMAP_OVERFLOW2, iPage, zContext);
      }
    }
#endif
    iPage = get4byte(pOvflData);
    sqlite3PagerUnref(pOvflPage);
  }
}
#endif /* SQLITE_OMIT_INTEGRITY_CHECK */

#ifndef SQLITE_OMIT_INTEGRITY_CHECK
/*
** Do various sanity checks on a single page of a tree.  Return
** the tree depth.  Root pages return 0.  Parents of root pages
** return 1, and so forth.
** 
** These checks are done:
**
**      1.  Make sure that cells and freeblocks do not overlap
**          but combine to completely cover the page.
**  NO  2.  Make sure cell keys are in order.
**  NO  3.  Make sure no key is less than or equal to zLowerBound.
**  NO  4.  Make sure no key is greater than or equal to zUpperBound.
**      5.  Check the integrity of overflow pages.
**      6.  Recursively call checkTreePage on all children.
**      7.  Verify that the depth of all children is the same.
**      8.  Make sure this page is at least 33% full or else it is
**          the root of the tree.
*/
static int checkTreePage(
  IntegrityCk *pCheck,  /* Context for the sanity check */
  int iPage,            /* Page number of the page to check */
  MemPage *pParent,     /* Parent page */
  char *zParentContext  /* Parent context */
){
  MemPage *pPage;
  int i, rc, depth, d2, pgno, cnt;
  int hdr, cellStart;
  int nCell;
  u8 *data;
  BtShared *pBt;
  int usableSize;
  char zContext[100];
  char *hit;

  sqlite3_snprintf(sizeof(zContext), zContext, "Page %d: ", iPage);

  /* Check that the page exists
  */
  pBt = pCheck->pBt;
  usableSize = pBt->usableSize;
  if( iPage==0 ) return 0;
  if( checkRef(pCheck, iPage, zParentContext) ) return 0;
  if( (rc = sqlite3BtreeGetPage(pBt, (Pgno)iPage, &pPage, 0))!=0 ){
    checkAppendMsg(pCheck, zContext,
       "unable to get the page. error code=%d", rc);
    return 0;
  }
  if( (rc = sqlite3BtreeInitPage(pPage, pParent))!=0 ){
    checkAppendMsg(pCheck, zContext, 
                   "sqlite3BtreeInitPage() returns error code %d", rc);
    releasePage(pPage);
    return 0;
  }

  /* Check out all the cells.
  */
  depth = 0;
  for(i=0; i<pPage->nCell && pCheck->mxErr; i++){
    u8 *pCell;
    int sz;
    CellInfo info;

    /* Check payload overflow pages
    */
    sqlite3_snprintf(sizeof(zContext), zContext,
             "On tree page %d cell %d: ", iPage, i);
    pCell = findCell(pPage,i);
    sqlite3BtreeParseCellPtr(pPage, pCell, &info);
    sz = info.nData;
    if( !pPage->intKey ) sz += info.nKey;
    assert( sz==info.nPayload );
    if( sz>info.nLocal ){
      int nPage = (sz - info.nLocal + usableSize - 5)/(usableSize - 4);
      Pgno pgnoOvfl = get4byte(&pCell[info.iOverflow]);
#ifndef SQLITE_OMIT_AUTOVACUUM
      if( pBt->autoVacuum ){
        checkPtrmap(pCheck, pgnoOvfl, PTRMAP_OVERFLOW1, iPage, zContext);
      }
#endif
      checkList(pCheck, 0, pgnoOvfl, nPage, zContext);
    }

    /* Check sanity of left child page.
    */
    if( !pPage->leaf ){
      pgno = get4byte(pCell);
#ifndef SQLITE_OMIT_AUTOVACUUM
      if( pBt->autoVacuum ){
        checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage, zContext);
      }
#endif
      d2 = checkTreePage(pCheck,pgno,pPage,zContext);
      if( i>0 && d2!=depth ){
        checkAppendMsg(pCheck, zContext, "Child page depth differs");
      }
      depth = d2;
    }
  }
  if( !pPage->leaf ){
    pgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);
    sqlite3_snprintf(sizeof(zContext), zContext, 
                     "On page %d at right child: ", iPage);
#ifndef SQLITE_OMIT_AUTOVACUUM
    if( pBt->autoVacuum ){
      checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage, 0);
    }
#endif
    checkTreePage(pCheck, pgno, pPage, zContext);
  }
 
  /* Check for complete coverage of the page
  */
  data = pPage->aData;
  hdr = pPage->hdrOffset;
  hit = sqlite3PageMalloc( pBt->pageSize );
  if( hit==0 ){
    pCheck->mallocFailed = 1;
  }else{
    memset(hit, 0, usableSize );
    memset(hit, 1, get2byte(&data[hdr+5]));
    nCell = get2byte(&data[hdr+3]);
    cellStart = hdr + 12 - 4*pPage->leaf;
    for(i=0; i<nCell; i++){
      int pc = get2byte(&data[cellStart+i*2]);
      u16 size = cellSizePtr(pPage, &data[pc]);
      int j;
      if( (pc+size-1)>=usableSize || pc<0 ){
        checkAppendMsg(pCheck, 0, 
            "Corruption detected in cell %d on page %d",i,iPage,0);
      }else{
        for(j=pc+size-1; j>=pc; j--) hit[j]++;
      }
    }
    for(cnt=0, i=get2byte(&data[hdr+1]); i>0 && i<usableSize && cnt<10000; 
           cnt++){
      int size = get2byte(&data[i+2]);
      int j;
      if( (i+size-1)>=usableSize || i<0 ){
        checkAppendMsg(pCheck, 0,  
            "Corruption detected in cell %d on page %d",i,iPage,0);
      }else{
        for(j=i+size-1; j>=i; j--) hit[j]++;
      }
      i = get2byte(&data[i]);
    }
    for(i=cnt=0; i<usableSize; i++){
      if( hit[i]==0 ){
        cnt++;
      }else if( hit[i]>1 ){
        checkAppendMsg(pCheck, 0,
          "Multiple uses for byte %d of page %d", i, iPage);
        break;
      }
    }
    if( cnt!=data[hdr+7] ){
      checkAppendMsg(pCheck, 0, 
          "Fragmented space is %d byte reported as %d on page %d",
          cnt, data[hdr+7], iPage);
    }
  }
  sqlite3PageFree(hit);

  releasePage(pPage);
  return depth+1;
}
#endif /* SQLITE_OMIT_INTEGRITY_CHECK */

#ifndef SQLITE_OMIT_INTEGRITY_CHECK
/*
** This routine does a complete check of the given BTree file.  aRoot[] is
** an array of pages numbers were each page number is the root page of
** a table.  nRoot is the number of entries in aRoot.
**
** Write the number of error seen in *pnErr.  Except for some memory
** allocation errors,  nn error message is held in memory obtained from
** malloc is returned if *pnErr is non-zero.  If *pnErr==0 then NULL is
** returned.
*/
char *sqlite3BtreeIntegrityCheck(
  Btree *p,     /* The btree to be checked */
  int *aRoot,   /* An array of root pages numbers for individual trees */
  int nRoot,    /* Number of entries in aRoot[] */
  int mxErr,    /* Stop reporting errors after this many */
  int *pnErr    /* Write number of errors seen to this variable */
){
  int i;
  int nRef;
  IntegrityCk sCheck;
  BtShared *pBt = p->pBt;
  char zErr[100];

  sqlite3BtreeEnter(p);
  pBt->db = p->db;
  nRef = sqlite3PagerRefcount(pBt->pPager);
  if( lockBtreeWithRetry(p)!=SQLITE_OK ){
    *pnErr = 1;
    sqlite3BtreeLeave(p);
    return sqlite3DbStrDup(0, "cannot acquire a read lock on the database");
  }
  sCheck.pBt = pBt;
  sCheck.pPager = pBt->pPager;
  sCheck.nPage = pagerPagecount(sCheck.pPager);
  sCheck.mxErr = mxErr;
  sCheck.nErr = 0;
  sCheck.mallocFailed = 0;
  *pnErr = 0;
#ifndef SQLITE_OMIT_AUTOVACUUM
  if( pBt->nTrunc!=0 ){
    sCheck.nPage = pBt->nTrunc;
  }
#endif
  if( sCheck.nPage==0 ){
    unlockBtreeIfUnused(pBt);
    sqlite3BtreeLeave(p);
    return 0;
  }
  sCheck.anRef = sqlite3Malloc( (sCheck.nPage+1)*sizeof(sCheck.anRef[0]) );
  if( !sCheck.anRef ){
    unlockBtreeIfUnused(pBt);
    *pnErr = 1;
    sqlite3BtreeLeave(p);
    return 0;
  }
  for(i=0; i<=sCheck.nPage; i++){ sCheck.anRef[i] = 0; }
  i = PENDING_BYTE_PAGE(pBt);
  if( i<=sCheck.nPage ){
    sCheck.anRef[i] = 1;
  }
  sqlite3StrAccumInit(&sCheck.errMsg, zErr, sizeof(zErr), 20000);

  /* Check the integrity of the freelist
  */
  checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]),
            get4byte(&pBt->pPage1->aData[36]), "Main freelist: ");

  /* Check all the tables.
  */
  for(i=0; i<nRoot && sCheck.mxErr; i++){
    if( aRoot[i]==0 ) continue;
#ifndef SQLITE_OMIT_AUTOVACUUM
    if( pBt->autoVacuum && aRoot[i]>1 ){
      checkPtrmap(&sCheck, aRoot[i], PTRMAP_ROOTPAGE, 0, 0);
    }
#endif
    checkTreePage(&sCheck, aRoot[i], 0, "List of tree roots: ");
  }

  /* Make sure every page in the file is referenced
  */
  for(i=1; i<=sCheck.nPage && sCheck.mxErr; i++){
#ifdef SQLITE_OMIT_AUTOVACUUM
    if( sCheck.anRef[i]==0 ){
      checkAppendMsg(&sCheck, 0, "Page %d is never used", i);
    }
#else
    /* If the database supports auto-vacuum, make sure no tables contain
    ** references to pointer-map pages.
    */
    if( sCheck.anRef[i]==0 && 
       (PTRMAP_PAGENO(pBt, i)!=i || !pBt->autoVacuum) ){
      checkAppendMsg(&sCheck, 0, "Page %d is never used", i);
    }
    if( sCheck.anRef[i]!=0 && 
       (PTRMAP_PAGENO(pBt, i)==i && pBt->autoVacuum) ){
      checkAppendMsg(&sCheck, 0, "Pointer map page %d is referenced", i);
    }
#endif
  }

  /* Make sure this analysis did not leave any unref() pages
  */
  unlockBtreeIfUnused(pBt);
  if( nRef != sqlite3PagerRefcount(pBt->pPager) ){
    checkAppendMsg(&sCheck, 0, 
      "Outstanding page count goes from %d to %d during this analysis",
      nRef, sqlite3PagerRefcount(pBt->pPager)
    );
  }

  /* Clean  up and report errors.
  */
  sqlite3BtreeLeave(p);
  sqlite3_free(sCheck.anRef);
  if( sCheck.mallocFailed ){
    sqlite3StrAccumReset(&sCheck.errMsg);
    *pnErr = sCheck.nErr+1;
    return 0;
  }
  *pnErr = sCheck.nErr;
  if( sCheck.nErr==0 ) sqlite3StrAccumReset(&sCheck.errMsg);
  return sqlite3StrAccumFinish(&sCheck.errMsg);
}
#endif /* SQLITE_OMIT_INTEGRITY_CHECK */

/*
** Return the full pathname of the underlying database file.
**
** The pager filename is invariant as long as the pager is
** open so it is safe to access without the BtShared mutex.
*/
const char *sqlite3BtreeGetFilename(Btree *p){
  assert( p->pBt->pPager!=0 );
  return sqlite3PagerFilename(p->pBt->pPager);
}

/*
** Return the pathname of the directory that contains the database file.
**
** The pager directory name is invariant as long as the pager is
** open so it is safe to access without the BtShared mutex.
*/
const char *sqlite3BtreeGetDirname(Btree *p){
  assert( p->pBt->pPager!=0 );
  return sqlite3PagerDirname(p->pBt->pPager);
}

/*
** Return the pathname of the journal file for this database. The return
** value of this routine is the same regardless of whether the journal file
** has been created or not.
**
** The pager journal filename is invariant as long as the pager is
** open so it is safe to access without the BtShared mutex.
*/
const char *sqlite3BtreeGetJournalname(Btree *p){
  assert( p->pBt->pPager!=0 );
  return sqlite3PagerJournalname(p->pBt->pPager);
}

#ifndef SQLITE_OMIT_VACUUM
/*
** Copy the complete content of pBtFrom into pBtTo.  A transaction
** must be active for both files.
**
** The size of file pTo may be reduced by this operation.
** If anything goes wrong, the transaction on pTo is rolled back. 
**
** If successful, CommitPhaseOne() may be called on pTo before returning. 
** The caller should finish committing the transaction on pTo by calling
** sqlite3BtreeCommit().
*/
static int btreeCopyFile(Btree *pTo, Btree *pFrom){
  int rc = SQLITE_OK;
  Pgno i;

  Pgno nFromPage;     /* Number of pages in pFrom */
  Pgno nToPage;       /* Number of pages in pTo */
  Pgno nNewPage;      /* Number of pages in pTo after the copy */

  Pgno iSkip;         /* Pending byte page in pTo */
  int nToPageSize;    /* Page size of pTo in bytes */
  int nFromPageSize;  /* Page size of pFrom in bytes */

  BtShared *pBtTo = pTo->pBt;
  BtShared *pBtFrom = pFrom->pBt;
  pBtTo->db = pTo->db;
  pBtFrom->db = pFrom->db;

  nToPageSize = pBtTo->pageSize;
  nFromPageSize = pBtFrom->pageSize;

  if( pTo->inTrans!=TRANS_WRITE || pFrom->inTrans!=TRANS_WRITE ){
    return SQLITE_ERROR;
  }
  if( pBtTo->pCursor ){
    return SQLITE_BUSY;
  }

  nToPage = pagerPagecount(pBtTo->pPager);
  nFromPage = pagerPagecount(pBtFrom->pPager);
  iSkip = PENDING_BYTE_PAGE(pBtTo);

  /* Variable nNewPage is the number of pages required to store the
  ** contents of pFrom using the current page-size of pTo.
  */
  nNewPage = ((i64)nFromPage * (i64)nFromPageSize + (i64)nToPageSize - 1) / 
      (i64)nToPageSize;

  for(i=1; rc==SQLITE_OK && (i<=nToPage || i<=nNewPage); i++){

    /* Journal the original page.
    **
    ** iSkip is the page number of the locking page (PENDING_BYTE_PAGE)
    ** in database *pTo (before the copy). This page is never written 
    ** into the journal file. Unless i==iSkip or the page was not
    ** present in pTo before the copy operation, journal page i from pTo.
    */
    if( i!=iSkip && i<=nToPage ){
      DbPage *pDbPage = 0;
      rc = sqlite3PagerGet(pBtTo->pPager, i, &pDbPage);
      if( rc==SQLITE_OK ){
        rc = sqlite3PagerWrite(pDbPage);
        if( rc==SQLITE_OK && i>nFromPage ){
          /* Yeah.  It seems wierd to call DontWrite() right after Write(). But
          ** that is because the names of those procedures do not exactly 
          ** represent what they do.  Write() really means "put this page in the
          ** rollback journal and mark it as dirty so that it will be written
          ** to the database file later."  DontWrite() undoes the second part of
          ** that and prevents the page from being written to the database. The
          ** page is still on the rollback journal, though.  And that is the 
          ** whole point of this block: to put pages on the rollback journal. 
          */
          sqlite3PagerDontWrite(pDbPage);
        }
        sqlite3PagerUnref(pDbPage);
      }
    }

    /* Overwrite the data in page i of the target database */
    if( rc==SQLITE_OK && i!=iSkip && i<=nNewPage ){

      DbPage *pToPage = 0;
      sqlite3_int64 iOff;

      rc = sqlite3PagerGet(pBtTo->pPager, i, &pToPage);
      if( rc==SQLITE_OK ){
        rc = sqlite3PagerWrite(pToPage);
      }

      for(
        iOff=(i-1)*nToPageSize; 
        rc==SQLITE_OK && iOff<i*nToPageSize; 
        iOff += nFromPageSize
      ){
        DbPage *pFromPage = 0;
        Pgno iFrom = (iOff/nFromPageSize)+1;

        if( iFrom==PENDING_BYTE_PAGE(pBtFrom) ){
          continue;
        }

        rc = sqlite3PagerGet(pBtFrom->pPager, iFrom, &pFromPage);
        if( rc==SQLITE_OK ){
          char *zTo = sqlite3PagerGetData(pToPage);
          char *zFrom = sqlite3PagerGetData(pFromPage);
          int nCopy;

          if( nFromPageSize>=nToPageSize ){
            zFrom += ((i-1)*nToPageSize - ((iFrom-1)*nFromPageSize));
            nCopy = nToPageSize;
          }else{
            zTo += (((iFrom-1)*nFromPageSize) - (i-1)*nToPageSize);
            nCopy = nFromPageSize;
          }

          memcpy(zTo, zFrom, nCopy);
	  sqlite3PagerUnref(pFromPage);
        }
      }

      if( pToPage ) sqlite3PagerUnref(pToPage);
    }
  }

  /* If things have worked so far, the database file may need to be 
  ** truncated. The complex part is that it may need to be truncated to
  ** a size that is not an integer multiple of nToPageSize - the current
  ** page size used by the pager associated with B-Tree pTo.
  **
  ** For example, say the page-size of pTo is 2048 bytes and the original 
  ** number of pages is 5 (10 KB file). If pFrom has a page size of 1024 
  ** bytes and 9 pages, then the file needs to be truncated to 9KB.
  */
  if( rc==SQLITE_OK ){
    if( nFromPageSize!=nToPageSize ){
      sqlite3_file *pFile = sqlite3PagerFile(pBtTo->pPager);
      i64 iSize = (i64)nFromPageSize * (i64)nFromPage;
      i64 iNow = (i64)((nToPage>nNewPage)?nToPage:nNewPage) * (i64)nToPageSize; 
      i64 iPending = ((i64)PENDING_BYTE_PAGE(pBtTo)-1) *(i64)nToPageSize;
  
      assert( iSize<=iNow );
  
      /* Commit phase one syncs the journal file associated with pTo 
      ** containing the original data. It does not sync the database file
      ** itself. After doing this it is safe to use OsTruncate() and other
      ** file APIs on the database file directly.
      */
      pBtTo->db = pTo->db;
      rc = sqlite3PagerCommitPhaseOne(pBtTo->pPager, 0, 0, 1);
      if( iSize<iNow && rc==SQLITE_OK ){
        rc = sqlite3OsTruncate(pFile, iSize);
      }
  
      /* The loop that copied data from database pFrom to pTo did not
      ** populate the locking page of database pTo. If the page-size of
      ** pFrom is smaller than that of pTo, this means some data will
      ** not have been copied. 
      **
      ** This block copies the missing data from database pFrom to pTo 
      ** using file APIs. This is safe because at this point we know that
      ** all of the original data from pTo has been synced into the 
      ** journal file. At this point it would be safe to do anything at
      ** all to the database file except truncate it to zero bytes.
      */
      if( rc==SQLITE_OK && nFromPageSize<nToPageSize && iSize>iPending){
        i64 iOff;
        for(
          iOff=iPending; 
          rc==SQLITE_OK && iOff<(iPending+nToPageSize); 
          iOff += nFromPageSize
        ){
          DbPage *pFromPage = 0;
          Pgno iFrom = (iOff/nFromPageSize)+1;
  
          if( iFrom==PENDING_BYTE_PAGE(pBtFrom) || iFrom>nFromPage ){
            continue;
          }
  
          rc = sqlite3PagerGet(pBtFrom->pPager, iFrom, &pFromPage);
          if( rc==SQLITE_OK ){
            char *zFrom = sqlite3PagerGetData(pFromPage);
  	  rc = sqlite3OsWrite(pFile, zFrom, nFromPageSize, iOff);
            sqlite3PagerUnref(pFromPage);
          }
        }
      }
  
      /* Sync the database file */
      if( rc==SQLITE_OK ){
        rc = sqlite3PagerSync(pBtTo->pPager);
      }
    }else{
      rc = sqlite3PagerTruncate(pBtTo->pPager, nNewPage);
    }
    if( rc==SQLITE_OK ){
      pBtTo->pageSizeFixed = 0;
    }
  }

  if( rc ){
    sqlite3BtreeRollback(pTo);
  }

  return rc;  
}
int sqlite3BtreeCopyFile(Btree *pTo, Btree *pFrom){
  int rc;
  sqlite3BtreeEnter(pTo);
  sqlite3BtreeEnter(pFrom);
  rc = btreeCopyFile(pTo, pFrom);
  sqlite3BtreeLeave(pFrom);
  sqlite3BtreeLeave(pTo);
  return rc;
}

#endif /* SQLITE_OMIT_VACUUM */

/*
** Return non-zero if a transaction is active.
*/
int sqlite3BtreeIsInTrans(Btree *p){
  assert( p==0 || sqlite3_mutex_held(p->db->mutex) );
  return (p && (p->inTrans==TRANS_WRITE));
}

/*
** Return non-zero if a statement transaction is active.
*/
int sqlite3BtreeIsInStmt(Btree *p){
  assert( sqlite3BtreeHoldsMutex(p) );
  return (p->pBt && p->pBt->inStmt);
}

/*
** Return non-zero if a read (or write) transaction is active.
*/
int sqlite3BtreeIsInReadTrans(Btree *p){
  assert( sqlite3_mutex_held(p->db->mutex) );
  return (p && (p->inTrans!=TRANS_NONE));
}

/*
** This function returns a pointer to a blob of memory associated with
** a single shared-btree. The memory is used by client code for its own
** purposes (for example, to store a high-level schema associated with 
** the shared-btree). The btree layer manages reference counting issues.
**
** The first time this is called on a shared-btree, nBytes bytes of memory
** are allocated, zeroed, and returned to the caller. For each subsequent 
** call the nBytes parameter is ignored and a pointer to the same blob
** of memory returned. 
**
** If the nBytes parameter is 0 and the blob of memory has not yet been
** allocated, a null pointer is returned. If the blob has already been
** allocated, it is returned as normal.
**
** Just before the shared-btree is closed, the function passed as the 
** xFree argument when the memory allocation was made is invoked on the 
** blob of allocated memory. This function should not call sqlite3_free()
** on the memory, the btree layer does that.
*/
void *sqlite3BtreeSchema(Btree *p, int nBytes, void(*xFree)(void *)){
  BtShared *pBt = p->pBt;
  sqlite3BtreeEnter(p);
  if( !pBt->pSchema && nBytes ){
    pBt->pSchema = sqlite3MallocZero(nBytes);
    pBt->xFreeSchema = xFree;
  }
  sqlite3BtreeLeave(p);
  return pBt->pSchema;
}

/*
** Return true if another user of the same shared btree as the argument
** handle holds an exclusive lock on the sqlite_master table.
*/
int sqlite3BtreeSchemaLocked(Btree *p){
  int rc;
  assert( sqlite3_mutex_held(p->db->mutex) );
  sqlite3BtreeEnter(p);
  rc = (queryTableLock(p, MASTER_ROOT, READ_LOCK)!=SQLITE_OK);
  sqlite3BtreeLeave(p);
  return rc;
}


#ifndef SQLITE_OMIT_SHARED_CACHE
/*
** Obtain a lock on the table whose root page is iTab.  The
** lock is a write lock if isWritelock is true or a read lock
** if it is false.
*/
int sqlite3BtreeLockTable(Btree *p, int iTab, u8 isWriteLock){
  int rc = SQLITE_OK;
  if( p->sharable ){
    u8 lockType = READ_LOCK + isWriteLock;
    assert( READ_LOCK+1==WRITE_LOCK );
    assert( isWriteLock==0 || isWriteLock==1 );
    sqlite3BtreeEnter(p);
    rc = queryTableLock(p, iTab, lockType);
    if( rc==SQLITE_OK ){
      rc = lockTable(p, iTab, lockType);
    }
    sqlite3BtreeLeave(p);
  }
  return rc;
}
#endif

#ifndef SQLITE_OMIT_INCRBLOB
/*
** Argument pCsr must be a cursor opened for writing on an 
** INTKEY table currently pointing at a valid table entry. 
** This function modifies the data stored as part of that entry.
** Only the data content may only be modified, it is not possible
** to change the length of the data stored.
*/
int sqlite3BtreePutData(BtCursor *pCsr, u32 offset, u32 amt, void *z){
  assert( cursorHoldsMutex(pCsr) );
  assert( sqlite3_mutex_held(pCsr->pBtree->db->mutex) );
  assert(pCsr->isIncrblobHandle);

  restoreCursorPosition(pCsr);
  assert( pCsr->eState!=CURSOR_REQUIRESEEK );
  if( pCsr->eState!=CURSOR_VALID ){
    return SQLITE_ABORT;
  }

  /* Check some preconditions: 
  **   (a) the cursor is open for writing,
  **   (b) there is no read-lock on the table being modified and
  **   (c) the cursor points at a valid row of an intKey table.
  */
  if( !pCsr->wrFlag ){
    return SQLITE_READONLY;
  }
  assert( !pCsr->pBt->readOnly 
          && pCsr->pBt->inTransaction==TRANS_WRITE );
  if( checkReadLocks(pCsr->pBtree, pCsr->pgnoRoot, pCsr, 0) ){
    return SQLITE_LOCKED; /* The table pCur points to has a read lock */
  }
  if( pCsr->eState==CURSOR_INVALID || !pCsr->pPage->intKey ){
    return SQLITE_ERROR;
  }

  return accessPayload(pCsr, offset, amt, (unsigned char *)z, 0, 1);
}

/* 
** Set a flag on this cursor to cache the locations of pages from the 
** overflow list for the current row. This is used by cursors opened
** for incremental blob IO only.
**
** This function sets a flag only. The actual page location cache
** (stored in BtCursor.aOverflow[]) is allocated and used by function
** accessPayload() (the worker function for sqlite3BtreeData() and
** sqlite3BtreePutData()).
*/
void sqlite3BtreeCacheOverflow(BtCursor *pCur){
  assert( cursorHoldsMutex(pCur) );
  assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
  assert(!pCur->isIncrblobHandle);
  assert(!pCur->aOverflow);
  pCur->isIncrblobHandle = 1;
}
#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/btree.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the sqlite B-Tree file
** subsystem.  See comments in the source code for a detailed description
** of what each interface routine does.
**
** @(#) $Id: btree.h,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#ifndef _BTREE_H_
#define _BTREE_H_

/* TODO: This definition is just included so other modules compile. It
** needs to be revisited.
*/
#define SQLITE_N_BTREE_META 10

/*
** If defined as non-zero, auto-vacuum is enabled by default. Otherwise
** it must be turned on for each database using "PRAGMA auto_vacuum = 1".
*/
#ifndef SQLITE_DEFAULT_AUTOVACUUM
  #define SQLITE_DEFAULT_AUTOVACUUM 0
#endif

#define BTREE_AUTOVACUUM_NONE 0        /* Do not do auto-vacuum */
#define BTREE_AUTOVACUUM_FULL 1        /* Do full auto-vacuum */
#define BTREE_AUTOVACUUM_INCR 2        /* Incremental vacuum */

/*
** Forward declarations of structure
*/
typedef struct Btree Btree;
typedef struct BtCursor BtCursor;
typedef struct BtShared BtShared;
typedef struct BtreeMutexArray BtreeMutexArray;

/*
** This structure records all of the Btrees that need to hold
** a mutex before we enter sqlite3VdbeExec().  The Btrees are
** are placed in aBtree[] in order of aBtree[]->pBt.  That way,
** we can always lock and unlock them all quickly.
*/
struct BtreeMutexArray {
  int nMutex;
  Btree *aBtree[SQLITE_MAX_ATTACHED+1];
};


int sqlite3BtreeOpen(
  const char *zFilename,   /* Name of database file to open */
  sqlite3 *db,             /* Associated database connection */
  Btree **,                /* Return open Btree* here */
  int flags,               /* Flags */
  int vfsFlags             /* Flags passed through to VFS open */
);

/* The flags parameter to sqlite3BtreeOpen can be the bitwise or of the
** following values.
**
** NOTE:  These values must match the corresponding PAGER_ values in
** pager.h.
*/
#define BTREE_OMIT_JOURNAL  1  /* Do not use journal.  No argument */
#define BTREE_NO_READLOCK   2  /* Omit readlocks on readonly files */
#define BTREE_MEMORY        4  /* In-memory DB.  No argument */
#define BTREE_READONLY      8  /* Open the database in read-only mode */
#define BTREE_READWRITE    16  /* Open for both reading and writing */
#define BTREE_CREATE       32  /* Create the database if it does not exist */

int sqlite3BtreeClose(Btree*);
int sqlite3BtreeSetCacheSize(Btree*,int);
int sqlite3BtreeSetSafetyLevel(Btree*,int,int);
int sqlite3BtreeSyncDisabled(Btree*);
int sqlite3BtreeSetPageSize(Btree*,int,int);
int sqlite3BtreeGetPageSize(Btree*);
int sqlite3BtreeMaxPageCount(Btree*,int);
int sqlite3BtreeGetReserve(Btree*);
int sqlite3BtreeSetAutoVacuum(Btree *, int);
int sqlite3BtreeGetAutoVacuum(Btree *);
int sqlite3BtreeBeginTrans(Btree*,int);
int sqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster);
int sqlite3BtreeCommitPhaseTwo(Btree*);
int sqlite3BtreeCommit(Btree*);
int sqlite3BtreeRollback(Btree*);
int sqlite3BtreeBeginStmt(Btree*);
int sqlite3BtreeCommitStmt(Btree*);
int sqlite3BtreeRollbackStmt(Btree*);
int sqlite3BtreeCreateTable(Btree*, int*, int flags);
int sqlite3BtreeIsInTrans(Btree*);
int sqlite3BtreeIsInStmt(Btree*);
int sqlite3BtreeIsInReadTrans(Btree*);
void *sqlite3BtreeSchema(Btree *, int, void(*)(void *));
int sqlite3BtreeSchemaLocked(Btree *);
int sqlite3BtreeLockTable(Btree *, int, u8);

const char *sqlite3BtreeGetFilename(Btree *);
const char *sqlite3BtreeGetDirname(Btree *);
const char *sqlite3BtreeGetJournalname(Btree *);
int sqlite3BtreeCopyFile(Btree *, Btree *);

int sqlite3BtreeIncrVacuum(Btree *);

/* The flags parameter to sqlite3BtreeCreateTable can be the bitwise OR
** of the following flags:
*/
#define BTREE_INTKEY     1    /* Table has only 64-bit signed integer keys */
#define BTREE_ZERODATA   2    /* Table has keys only - no data */
#define BTREE_LEAFDATA   4    /* Data stored in leaves only.  Implies INTKEY */

int sqlite3BtreeDropTable(Btree*, int, int*);
int sqlite3BtreeClearTable(Btree*, int);
int sqlite3BtreeGetMeta(Btree*, int idx, u32 *pValue);
int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value);
void sqlite3BtreeTripAllCursors(Btree*, int);

struct UnpackedRecord;  /* Forward declaration.  Definition in vdbeaux.c. */

int sqlite3BtreeCursor(
  Btree*,                              /* BTree containing table to open */
  int iTable,                          /* Index of root page */
  int wrFlag,                          /* 1 for writing.  0 for read-only */
  struct KeyInfo*,                     /* First argument to compare function */
  BtCursor *pCursor                    /* Space to write cursor structure */
);
int sqlite3BtreeCursorSize(void);

int sqlite3BtreeCloseCursor(BtCursor*);
int sqlite3BtreeMoveto(
  BtCursor*,
  const void *pKey,
  struct UnpackedRecord *pUnKey,
  i64 nKey,
  int bias,
  int *pRes
);
int sqlite3BtreeCursorHasMoved(BtCursor*, int*);
int sqlite3BtreeDelete(BtCursor*);
int sqlite3BtreeInsert(BtCursor*, const void *pKey, i64 nKey,
                                  const void *pData, int nData,
                                  int nZero, int bias);
int sqlite3BtreeFirst(BtCursor*, int *pRes);
int sqlite3BtreeLast(BtCursor*, int *pRes);
int sqlite3BtreeNext(BtCursor*, int *pRes);
int sqlite3BtreeEof(BtCursor*);
int sqlite3BtreeFlags(BtCursor*);
int sqlite3BtreePrevious(BtCursor*, int *pRes);
int sqlite3BtreeKeySize(BtCursor*, i64 *pSize);
int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*);
sqlite3 *sqlite3BtreeCursorDb(const BtCursor*);
const void *sqlite3BtreeKeyFetch(BtCursor*, int *pAmt);
const void *sqlite3BtreeDataFetch(BtCursor*, int *pAmt);
int sqlite3BtreeDataSize(BtCursor*, u32 *pSize);
int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*);

char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*);
struct Pager *sqlite3BtreePager(Btree*);

int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*);
void sqlite3BtreeCacheOverflow(BtCursor *);

#ifdef SQLITE_TEST
int sqlite3BtreeCursorInfo(BtCursor*, int*, int);
void sqlite3BtreeCursorList(Btree*);
#endif

/*
** If we are not using shared cache, then there is no need to
** use mutexes to access the BtShared structures.  So make the
** Enter and Leave procedures no-ops.
*/
#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE
  void sqlite3BtreeEnter(Btree*);
  void sqlite3BtreeLeave(Btree*);
#ifndef NDEBUG
  /* This routine is used inside assert() statements only. */
  int sqlite3BtreeHoldsMutex(Btree*);
#endif
  void sqlite3BtreeEnterCursor(BtCursor*);
  void sqlite3BtreeLeaveCursor(BtCursor*);
  void sqlite3BtreeEnterAll(sqlite3*);
  void sqlite3BtreeLeaveAll(sqlite3*);
#ifndef NDEBUG
  /* This routine is used inside assert() statements only. */
  int sqlite3BtreeHoldsAllMutexes(sqlite3*);
#endif
  void sqlite3BtreeMutexArrayEnter(BtreeMutexArray*);
  void sqlite3BtreeMutexArrayLeave(BtreeMutexArray*);
  void sqlite3BtreeMutexArrayInsert(BtreeMutexArray*, Btree*);
#else
# define sqlite3BtreeEnter(X)
# define sqlite3BtreeLeave(X)
#ifndef NDEBUG
  /* This routine is used inside assert() statements only. */
# define sqlite3BtreeHoldsMutex(X) 1
#endif
# define sqlite3BtreeEnterCursor(X)
# define sqlite3BtreeLeaveCursor(X)
# define sqlite3BtreeEnterAll(X)
# define sqlite3BtreeLeaveAll(X)
#ifndef NDEBUG
  /* This routine is used inside assert() statements only. */
# define sqlite3BtreeHoldsAllMutexes(X) 1
#endif
# define sqlite3BtreeMutexArrayEnter(X)
# define sqlite3BtreeMutexArrayLeave(X)
# define sqlite3BtreeMutexArrayInsert(X,Y)
#endif


#endif /* _BTREE_H_ */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/btreeInt.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
/*
** 2004 April 6
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btreeInt.h,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
**
** This file implements a external (disk-based) database using BTrees.
** For a detailed discussion of BTrees, refer to
**
**     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
**     "Sorting And Searching", pages 473-480. Addison-Wesley
**     Publishing Company, Reading, Massachusetts.
**
** The basic idea is that each page of the file contains N database
** entries and N+1 pointers to subpages.
**
**   ----------------------------------------------------------------
**   |  Ptr(0) | Key(0) | Ptr(1) | Key(1) | ... | Key(N-1) | Ptr(N) |
**   ----------------------------------------------------------------
**
** All of the keys on the page that Ptr(0) points to have values less
** than Key(0).  All of the keys on page Ptr(1) and its subpages have
** values greater than Key(0) and less than Key(1).  All of the keys
** on Ptr(N) and its subpages have values greater than Key(N-1).  And
** so forth.
**
** Finding a particular key requires reading O(log(M)) pages from the 
** disk where M is the number of entries in the tree.
**
** In this implementation, a single file can hold one or more separate 
** BTrees.  Each BTree is identified by the index of its root page.  The
** key and data for any entry are combined to form the "payload".  A
** fixed amount of payload can be carried directly on the database
** page.  If the payload is larger than the preset amount then surplus
** bytes are stored on overflow pages.  The payload for an entry
** and the preceding pointer are combined to form a "Cell".  Each 
** 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"
**     16       2     Page size in bytes.  
**     18       1     File format write version
**     19       1     File format read version
**     20       1     Bytes of unused space at the end of each page
**     21       1     Max embedded payload fraction
**     22       1     Min embedded payload fraction
**     23       1     Min leaf payload fraction
**     24       4     File change counter
**     28       4     Reserved for future use
**     32       4     First freelist page
**     36       4     Number of freelist pages in the file
**     40      60     15 4-byte meta values passed to higher layers
**
** All of the integer values are big-endian (most significant byte first).
**
** The file change counter is incremented when the database is changed
** This counter allows other processes to know when the file has changed
** and thus when they need to flush their cache.
**
** The max embedded payload fraction is the amount of the total usable
** space in a page that can be consumed by a single cell for standard
** B-tree (non-LEAFDATA) tables.  A value of 255 means 100%.  The default
** is to limit the maximum cell size so that at least 4 cells will fit
** on one page.  Thus the default max embedded payload fraction is 64.
**
** If the payload for a cell is larger than the max payload, then extra
** payload is spilled to overflow pages.  Once an overflow page is allocated,
** as many bytes as possible are moved into the overflow pages without letting
** the cell size drop below the min embedded payload fraction.
**
** The min leaf payload fraction is like the min embedded payload fraction
** except that it applies to leaf nodes in a LEAFDATA tree.  The maximum
** payload fraction for a LEAFDATA tree is always 100% (or 255) and it
** not specified in the header.
**
** Each btree pages is divided into three sections:  The header, the
** cell pointer array, and the cell content area.  Page 1 also has a 100-byte
** file header that occurs before the page header.
**
**      |----------------|
**      | file header    |   100 bytes.  Page 1 only.
**      |----------------|
**      | page header    |   8 bytes for leaves.  12 bytes for interior nodes
**      |----------------|
**      | cell pointer   |   |  2 bytes per cell.  Sorted order.
**      | array          |   |  Grows downward
**      |                |   v
**      |----------------|
**      | unallocated    |
**      | space          |
**      |----------------|   ^  Grows upwards
**      | cell content   |   |  Arbitrary order interspersed with freeblocks.
**      | area           |   |  and free space fragments.
**      |----------------|
**
** The page headers looks like this:
**
**   OFFSET   SIZE     DESCRIPTION
**      0       1      Flags. 1: intkey, 2: zerodata, 4: leafdata, 8: leaf
**      1       2      byte offset to the first freeblock
**      3       2      number of cells on this page
**      5       2      first byte of the cell content area
**      7       1      number of fragmented free bytes
**      8       4      Right child (the Ptr(N) value).  Omitted on leaves.
**
** The flags define the format of this btree page.  The leaf flag means that
** this page has no children.  The zerodata flag means that this page carries
** only keys and no data.  The intkey flag means that the key is a integer
** which is stored in the key size entry of the cell header rather than in
** the payload area.
**
** The cell pointer array begins on the first byte after the page header.
** The cell pointer array contains zero or more 2-byte numbers which are
** offsets from the beginning of the page to the cell content in the cell
** content area.  The cell pointers occur in sorted order.  The system strives
** to keep free space after the last cell pointer so that new cells can
** be easily added without having to defragment the page.
**
** Cell content is stored at the very end of the page and grows toward the
** beginning of the page.
**
** Unused space within the cell content area is collected into a linked list of
** freeblocks.  Each freeblock is at least 4 bytes in size.  The byte offset
** to the first freeblock is given in the header.  Freeblocks occur in
** increasing order.  Because a freeblock must be at least 4 bytes in size,
** any group of 3 or fewer unused bytes in the cell content area cannot
** exist on the freeblock chain.  A group of 3 or fewer free bytes is called
** a fragment.  The total number of bytes in all fragments is recorded.
** in the page header at offset 7.
**
**    SIZE    DESCRIPTION
**      2     Byte offset of the next freeblock
**      2     Bytes in this freeblock
**
** Cells are of variable length.  Cells are stored in the cell content area at
** the end of the page.  Pointers to the cells are in the cell pointer array
** that immediately follows the page header.  Cells is not necessarily
** contiguous or in order, but cell pointers are contiguous and in order.
**
** Cell content makes use of variable length integers.  A variable
** length integer is 1 to 9 bytes where the lower 7 bits of each 
** byte are used.  The integer consists of all bytes that have bit 8 set and
** the first byte with bit 8 clear.  The most significant byte of the integer
** appears first.  A variable-length integer may not be more than 9 bytes long.
** As a special case, all 8 bytes of the 9th byte are used as data.  This
** allows a 64-bit integer to be encoded in 9 bytes.
**
**    0x00                      becomes  0x00000000
**    0x7f                      becomes  0x0000007f
**    0x81 0x00                 becomes  0x00000080
**    0x82 0x00                 becomes  0x00000100
**    0x80 0x7f                 becomes  0x0000007f
**    0x8a 0x91 0xd1 0xac 0x78  becomes  0x12345678
**    0x81 0x81 0x81 0x81 0x01  becomes  0x10204081
**
** Variable length integers are used for rowids and to hold the number of
** bytes of key and data in a btree cell.
**
** The content of a cell looks like this:
**
**    SIZE    DESCRIPTION
**      4     Page number of the left child. Omitted if leaf flag is set.
**     var    Number of bytes of data. Omitted if the zerodata flag is set.
**     var    Number of bytes of key. Or the key itself if intkey flag is set.
**      *     Payload
**      4     First page of the overflow chain.  Omitted if no overflow
**
** Overflow pages form a linked list.  Each page except the last is completely
** filled with data (pagesize - 4 bytes).  The last page can have as little
** as 1 byte of data.
**
**    SIZE    DESCRIPTION
**      4     Page number of next overflow page
**      *     Data
**
** Freelist pages come in two subtypes: trunk pages and leaf pages.  The
** file header points to the first in a linked list of trunk page.  Each trunk
** page points to multiple leaf pages.  The content of a leaf page is
** unspecified.  A trunk page looks like this:
**
**    SIZE    DESCRIPTION
**      4     Page number of next trunk page
**      4     Number of leaf pointers on this page
**      *     zero or more pages numbers of leaves
*/
#include "sqliteInt.h"
#include "pager.h"
#include "btree.h"
#include "os.h"
#include <assert.h>

/* Round up a number to the next larger multiple of 8.  This is used
** to force 8-byte alignment on 64-bit architectures.
*/
#define ROUND8(x)   ((x+7)&~7)


/* The following value is the maximum cell size assuming a maximum page
** size give above.
*/
#define MX_CELL_SIZE(pBt)  (pBt->pageSize-8)

/* The maximum number of cells on a single page of the database.  This
** assumes a minimum cell size of 6 bytes  (4 bytes for the cell itself
** plus 2 bytes for the index to the cell in the page header).  Such
** small cells will be rare, but they are possible.
*/
#define MX_CELL(pBt) ((pBt->pageSize-8)/6)

/* Forward declarations */
typedef struct MemPage MemPage;
typedef struct BtLock BtLock;

/*
** This is a magic string that appears at the beginning of every
** SQLite database in order to identify the file as a real database.
**
** You can change this value at compile-time by specifying a
** -DSQLITE_FILE_HEADER="..." on the compiler command-line.  The
** header must be exactly 16 bytes including the zero-terminator so
** the string itself should be 15 characters long.  If you change
** the header, then your custom library will not be able to read 
** databases generated by the standard tools and the standard tools
** will not be able to read databases created by your custom library.
*/
#ifndef SQLITE_FILE_HEADER /* 123456789 123456 */
#  define SQLITE_FILE_HEADER "SQLite format 3"
#endif

/*
** Page type flags.  An ORed combination of these flags appear as the
** first byte of on-disk image of every BTree page.
*/
#define PTF_INTKEY    0x01
#define PTF_ZERODATA  0x02
#define PTF_LEAFDATA  0x04
#define PTF_LEAF      0x08

/*
** As each page of the file is loaded into memory, an instance of the following
** structure is appended and initialized to zero.  This structure stores
** information about the page that is decoded from the raw file page.
**
** The pParent field points back to the parent page.  This allows us to
** walk up the BTree from any leaf to the root.  Care must be taken to
** unref() the parent page pointer when this page is no longer referenced.
** The pageDestructor() routine handles that chore.
**
** Access to all fields of this structure is controlled by the mutex
** stored in MemPage.pBt->mutex.
*/
struct MemPage {
  u8 isInit;           /* True if previously initialized. MUST BE FIRST! */
  u8 idxShift;         /* True if Cell indices have changed */
  u8 nOverflow;        /* Number of overflow cell bodies in aCell[] */
  u8 intKey;           /* True if intkey flag is set */
  u8 leaf;             /* True if leaf flag is set */
  u8 hasData;          /* True if this page stores data */
  u8 hdrOffset;        /* 100 for page 1.  0 otherwise */
  u8 childPtrSize;     /* 0 if leaf==1.  4 if leaf==0 */
  u16 maxLocal;        /* Copy of BtShared.maxLocal or BtShared.maxLeaf */
  u16 minLocal;        /* Copy of BtShared.minLocal or BtShared.minLeaf */
  u16 cellOffset;      /* Index in aData of first cell pointer */
  u16 idxParent;       /* Index in parent of this node */
  u16 nFree;           /* Number of free bytes on the page */
  u16 nCell;           /* Number of cells on this page, local and ovfl */
  u16 maskPage;        /* Mask for page offset */
  struct _OvflCell {   /* Cells that will not fit on aData[] */
    u8 *pCell;          /* Pointers to the body of the overflow cell */
    u16 idx;            /* Insert this cell before idx-th non-overflow cell */
  } aOvfl[5];
  BtShared *pBt;       /* Pointer to BtShared that this page is part of */
  u8 *aData;           /* Pointer to disk image of the page data */
  DbPage *pDbPage;     /* Pager page handle */
  Pgno pgno;           /* Page number for this page */
  MemPage *pParent;    /* The parent of this page.  NULL for root */
};

/*
** The in-memory image of a disk page has the auxiliary information appended
** to the end.  EXTRA_SIZE is the number of bytes of space needed to hold
** that extra information.
*/
#define EXTRA_SIZE sizeof(MemPage)

/* A Btree handle
**
** 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
** cursors have to do go through this Btree to find their BtShared and
** they often do so without holding sqlite3.mutex.
*/
struct Btree {
  sqlite3 *db;       /* The database connection holding this btree */
  BtShared *pBt;     /* Sharable content of this btree */
  u8 inTrans;        /* TRANS_NONE, TRANS_READ or TRANS_WRITE */
  u8 sharable;       /* True if we can share pBt with another db */
  u8 locked;         /* True if db currently has pBt locked */
  int wantToLock;    /* Number of nested calls to sqlite3BtreeEnter() */
  Btree *pNext;      /* List of other sharable Btrees from the same db */
  Btree *pPrev;      /* Back pointer of the same list */
};

/*
** Btree.inTrans may take one of the following values.
**
** If the shared-data extension is enabled, there may be multiple users
** of the Btree structure. At most one of these may open a write transaction,
** but any number may have active read transactions.
*/
#define TRANS_NONE  0
#define TRANS_READ  1
#define TRANS_WRITE 2

/*
** An instance of this object represents a single database file.
** 
** A single database file can be in use as the same time by two
** or more database connections.  When two or more connections are
** sharing the same database file, each connection has it own
** private Btree object for the file and each of those Btrees points
** to this one BtShared object.  BtShared.nRef is the number of
** connections currently sharing this database file.
**
** Fields in this structure are accessed under the BtShared.mutex
** mutex, except for nRef and pNext which are accessed under the
** global SQLITE_MUTEX_STATIC_MASTER mutex.  The pPager field
** may not be modified once it is initially set as long as nRef>0.
** The pSchema field may be set once under BtShared.mutex and
** thereafter is unchanged as long as nRef>0.
*/
struct BtShared {
  Pager *pPager;        /* The page cache */
  sqlite3 *db;          /* Database connection currently using this Btree */
  BtCursor *pCursor;    /* A list of all open cursors */
  MemPage *pPage1;      /* First page of the database */
  u8 inStmt;            /* True if we are in a statement subtransaction */
  u8 readOnly;          /* True if the underlying file is readonly */
  u8 pageSizeFixed;     /* True if the page size can no longer be changed */
#ifndef SQLITE_OMIT_AUTOVACUUM
  u8 autoVacuum;        /* True if auto-vacuum is enabled */
  u8 incrVacuum;        /* True if incr-vacuum is enabled */
  Pgno nTrunc;          /* Non-zero if the db will be truncated (incr vacuum) */
#endif
  u16 pageSize;         /* Total number of bytes on a page */
  u16 usableSize;       /* Number of usable bytes on each page */
  int maxLocal;         /* Maximum local payload in non-LEAFDATA tables */
  int minLocal;         /* Minimum local payload in non-LEAFDATA tables */
  int maxLeaf;          /* Maximum local payload in a LEAFDATA table */
  int minLeaf;          /* Minimum local payload in a LEAFDATA table */
  u8 inTransaction;     /* Transaction state */
  int nTransaction;     /* Number of open transactions (read + write) */
  void *pSchema;        /* Pointer to space allocated by sqlite3BtreeSchema() */
  void (*xFreeSchema)(void*);  /* Destructor for BtShared.pSchema */
  sqlite3_mutex *mutex; /* Non-recursive mutex required to access this struct */
  BusyHandler busyHdr;  /* The busy handler for this btree */
#ifndef SQLITE_OMIT_SHARED_CACHE
  int nRef;             /* Number of references to this structure */
  BtShared *pNext;      /* Next on a list of sharable BtShared structs */
  BtLock *pLock;        /* List of locks held on this shared-btree struct */
  Btree *pExclusive;    /* Btree with an EXCLUSIVE lock on the whole db */
#endif
  u8 *pTmpSpace;        /* BtShared.pageSize bytes of space for tmp use */
};

/*
** An instance of the following structure is used to hold information
** about a cell.  The parseCellPtr() function fills in this structure
** based on information extract from the raw disk page.
*/
typedef struct CellInfo CellInfo;
struct CellInfo {
  u8 *pCell;     /* Pointer to the start of cell content */
  i64 nKey;      /* The key for INTKEY tables, or number of bytes in key */
  u32 nData;     /* Number of bytes of data */
  u32 nPayload;  /* Total amount of payload */
  u16 nHeader;   /* Size of the cell content header in bytes */
  u16 nLocal;    /* Amount of payload held locally */
  u16 iOverflow; /* Offset to overflow page number.  Zero if no overflow */
  u16 nSize;     /* Size of the cell content on the main b-tree page */
};

/*
** 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 {
  Btree *pBtree;            /* The Btree to which this cursor belongs */
  BtShared *pBt;            /* The BtShared this cursor points to */
  BtCursor *pNext, *pPrev;  /* Forms a linked list of all cursors */
  struct KeyInfo *pKeyInfo; /* Argument passed to comparison function */
  Pgno pgnoRoot;            /* The root page of this tree */
  MemPage *pPage;           /* Page that contains the entry */
  int idx;                  /* Index of the entry in pPage->aCell[] */
  CellInfo info;            /* A parse of the cell we are pointing at */
  u8 wrFlag;                /* True if writable */
  u8 atLast;                /* Cursor pointing to the last entry */
  u8 validNKey;             /* True if info.nKey is valid */
  u8 eState;                /* One of the CURSOR_XXX constants (see below) */
  void *pKey;      /* Saved key that was cursor's last known position */
  i64 nKey;        /* Size of pKey, or last integer key */
  int skip;        /* (skip<0) -> Prev() is a no-op. (skip>0) -> Next() is */
#ifndef SQLITE_OMIT_INCRBLOB
  u8 isIncrblobHandle;      /* True if this cursor is an incr. io handle */
  Pgno *aOverflow;          /* Cache of overflow page locations */
#endif
};

/*
** Potential values for BtCursor.eState.
**
** CURSOR_VALID:
**   Cursor points to a valid entry. getPayload() etc. may be called.
**
** CURSOR_INVALID:
**   Cursor does not point to a valid entry. This can happen (for example) 
**   because the table is empty or because BtreeCursorFirst() has not been
**   called.
**
** CURSOR_REQUIRESEEK:
**   The table that this cursor was opened on still exists, but has been 
**   modified since the cursor was last used. The cursor position is saved
**   in variables BtCursor.pKey and BtCursor.nKey. When a cursor is in 
**   this state, restoreCursorPosition() can be called to attempt to
**   seek the cursor to the saved position.
**
** CURSOR_FAULT:
**   A unrecoverable error (an I/O error or a malloc failure) has occurred
**   on a different connection that shares the BtShared cache with this
**   cursor.  The error has left the cache in an inconsistent state.
**   Do nothing else with this cursor.  Any attempt to use the cursor
**   should return the error code stored in BtCursor.skip
*/
#define CURSOR_INVALID           0
#define CURSOR_VALID             1
#define CURSOR_REQUIRESEEK       2
#define CURSOR_FAULT             3

/* The database page the PENDING_BYTE occupies. This page is never used.
** TODO: This macro is very similary to PAGER_MJ_PGNO() in pager.c. They
** should possibly be consolidated (presumably in pager.h).
**
** If disk I/O is omitted (meaning that the database is stored purely
** in memory) then there is no pending byte.
*/
#ifdef SQLITE_OMIT_DISKIO
# define PENDING_BYTE_PAGE(pBt)  0x7fffffff
#else
# define PENDING_BYTE_PAGE(pBt) ((PENDING_BYTE/(pBt)->pageSize)+1)
#endif

/*
** A linked list of the following structures is stored at BtShared.pLock.
** Locks are added (or upgraded from READ_LOCK to WRITE_LOCK) when a cursor 
** is opened on the table with root page BtShared.iTable. Locks are removed
** from this list when a transaction is committed or rolled back, or when
** a btree handle is closed.
*/
struct BtLock {
  Btree *pBtree;        /* Btree handle holding this lock */
  Pgno iTable;          /* Root page of table */
  u8 eLock;             /* READ_LOCK or WRITE_LOCK */
  BtLock *pNext;        /* Next in BtShared.pLock list */
};

/* Candidate values for BtLock.eLock */
#define READ_LOCK     1
#define WRITE_LOCK    2

/*
** These macros define the location of the pointer-map entry for a 
** database page. The first argument to each is the number of usable
** bytes on each page of the database (often 1024). The second is the
** page number to look up in the pointer map.
**
** PTRMAP_PAGENO returns the database page number of the pointer-map
** page that stores the required pointer. PTRMAP_PTROFFSET returns
** the offset of the requested map entry.
**
** If the pgno argument passed to PTRMAP_PAGENO is a pointer-map page,
** then pgno is returned. So (pgno==PTRMAP_PAGENO(pgsz, pgno)) can be
** used to test if pgno is a pointer-map page. PTRMAP_ISPAGE implements
** this test.
*/
#define PTRMAP_PAGENO(pBt, pgno) ptrmapPageno(pBt, pgno)
#define PTRMAP_PTROFFSET(pgptrmap, pgno) (5*(pgno-pgptrmap-1))
#define PTRMAP_ISPAGE(pBt, pgno) (PTRMAP_PAGENO((pBt),(pgno))==(pgno))

/*
** The pointer map is a lookup table that identifies the parent page for
** each child page in the database file.  The parent page is the page that
** contains a pointer to the child.  Every page in the database contains
** 0 or 1 parent pages.  (In this context 'database page' refers
** to any page that is not part of the pointer map itself.)  Each pointer map
** entry consists of a single byte 'type' and a 4 byte parent page number.
** The PTRMAP_XXX identifiers below are the valid types.
**
** The purpose of the pointer map is to facility moving pages from one
** position in the file to another as part of autovacuum.  When a page
** is moved, the pointer in its parent must be updated to point to the
** new location.  The pointer map is used to locate the parent page quickly.
**
** PTRMAP_ROOTPAGE: The database page is a root-page. The page-number is not
**                  used in this case.
**
** PTRMAP_FREEPAGE: The database page is an unused (free) page. The page-number 
**                  is not used in this case.
**
** PTRMAP_OVERFLOW1: The database page is the first page in a list of 
**                   overflow pages. The page number identifies the page that
**                   contains the cell with a pointer to this overflow page.
**
** PTRMAP_OVERFLOW2: The database page is the second or later page in a list of
**                   overflow pages. The page-number identifies the previous
**                   page in the overflow page list.
**
** PTRMAP_BTREE: The database page is a non-root btree page. The page number
**               identifies the parent page in the btree.
*/
#define PTRMAP_ROOTPAGE 1
#define PTRMAP_FREEPAGE 2
#define PTRMAP_OVERFLOW1 3
#define PTRMAP_OVERFLOW2 4
#define PTRMAP_BTREE 5

/* A bunch of assert() statements to check the transaction state variables
** of handle p (type Btree*) are internally consistent.
*/
#define btreeIntegrity(p) \
  assert( p->pBt->inTransaction!=TRANS_NONE || p->pBt->nTransaction==0 ); \
  assert( p->pBt->inTransaction>=p->inTrans ); 


/*
** The ISAUTOVACUUM macro is used within balance_nonroot() to determine
** if the database supports auto-vacuum or not. Because it is used
** within an expression that is an argument to another macro 
** (sqliteMallocRaw), it is not possible to use conditional compilation.
** So, this macro is defined instead.
*/
#ifndef SQLITE_OMIT_AUTOVACUUM
#define ISAUTOVACUUM (pBt->autoVacuum)
#else
#define ISAUTOVACUUM 0
#endif


/*
** This structure is passed around through all the sanity checking routines
** in order to keep track of some global state information.
*/
typedef struct IntegrityCk IntegrityCk;
struct IntegrityCk {
  BtShared *pBt;    /* The tree being checked out */
  Pager *pPager;    /* The associated pager.  Also accessible by pBt->pPager */
  int nPage;        /* Number of pages in the database */
  int *anRef;       /* Number of times each page is referenced */
  int mxErr;        /* Stop accumulating errors when this reaches zero */
  int nErr;         /* Number of messages written to zErrMsg so far */
  int mallocFailed; /* A memory allocation error has occurred */
  StrAccum errMsg;  /* Accumulate the error message text here */
};

/*
** Read or write a two- and four-byte big-endian integer values.
*/
#define get2byte(x)   ((x)[0]<<8 | (x)[1])
#define put2byte(p,v) ((p)[0] = (v)>>8, (p)[1] = (v))
#define get4byte sqlite3Get4byte
#define put4byte sqlite3Put4byte

/*
** Internal routines that should be accessed by the btree layer only.
*/
int sqlite3BtreeGetPage(BtShared*, Pgno, MemPage**, int);
int sqlite3BtreeInitPage(MemPage *pPage, MemPage *pParent);
void sqlite3BtreeParseCellPtr(MemPage*, u8*, CellInfo*);
void sqlite3BtreeParseCell(MemPage*, int, CellInfo*);
int sqlite3BtreeRestoreCursorPosition(BtCursor *pCur);
void sqlite3BtreeGetTempCursor(BtCursor *pCur, BtCursor *pTempCur);
void sqlite3BtreeReleaseTempCursor(BtCursor *pCur);
int sqlite3BtreeIsRootPage(MemPage *pPage);
void sqlite3BtreeMoveToParent(BtCursor *pCur);
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/build.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the SQLite parser
** when syntax rules are reduced.  The routines in this file handle the
** following kinds of SQL syntax:
**
**     CREATE TABLE
**     DROP TABLE
**     CREATE INDEX
**     DROP INDEX
**     creating ID lists
**     BEGIN TRANSACTION
**     COMMIT
**     ROLLBACK
**
** $Id: build.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** This routine is called when a new SQL statement is beginning to
** be parsed.  Initialize the pParse structure as needed.
*/
void sqlite3BeginParse(Parse *pParse, int explainFlag){
  pParse->explain = explainFlag;
  pParse->nVar = 0;
}

#ifndef SQLITE_OMIT_SHARED_CACHE
/*
** The TableLock structure is only used by the sqlite3TableLock() and
** codeTableLocks() functions.
*/
struct TableLock {
  int iDb;             /* The database containing the table to be locked */
  int iTab;            /* The root page of the table to be locked */
  u8 isWriteLock;      /* True for write lock.  False for a read lock */
  const char *zName;   /* Name of the table */
};

/*
** Record the fact that we want to lock a table at run-time.  
**
** The table to be locked has root page iTab and is found in database iDb.
** A read or a write lock can be taken depending on isWritelock.
**
** This routine just records the fact that the lock is desired.  The
** code to make the lock occur is generated by a later call to
** codeTableLocks() which occurs during sqlite3FinishCoding().
*/
void sqlite3TableLock(
  Parse *pParse,     /* Parsing context */
  int iDb,           /* Index of the database containing the table to lock */
  int iTab,          /* Root page number of the table to be locked */
  u8 isWriteLock,    /* True for a write lock */
  const char *zName  /* Name of the table to be locked */
){
  int i;
  int nBytes;
  TableLock *p;

  if( iDb<0 ){
    return;
  }

  for(i=0; i<pParse->nTableLock; i++){
    p = &pParse->aTableLock[i];
    if( p->iDb==iDb && p->iTab==iTab ){
      p->isWriteLock = (p->isWriteLock || isWriteLock);
      return;
    }
  }

  nBytes = sizeof(TableLock) * (pParse->nTableLock+1);
  pParse->aTableLock = 
      sqlite3DbReallocOrFree(pParse->db, pParse->aTableLock, nBytes);
  if( pParse->aTableLock ){
    p = &pParse->aTableLock[pParse->nTableLock++];
    p->iDb = iDb;
    p->iTab = iTab;
    p->isWriteLock = isWriteLock;
    p->zName = zName;
  }else{
    pParse->nTableLock = 0;
    pParse->db->mallocFailed = 1;
  }
}

/*
** Code an OP_TableLock instruction for each table locked by the
** statement (configured by calls to sqlite3TableLock()).
*/
static void codeTableLocks(Parse *pParse){
  int i;
  Vdbe *pVdbe; 

  if( 0==(pVdbe = sqlite3GetVdbe(pParse)) ){
    return;
  }

  for(i=0; i<pParse->nTableLock; i++){
    TableLock *p = &pParse->aTableLock[i];
    int p1 = p->iDb;
    sqlite3VdbeAddOp4(pVdbe, OP_TableLock, p1, p->iTab, p->isWriteLock,
                      p->zName, P4_STATIC);
  }
}
#else
  #define codeTableLocks(x)
#endif

/*
** This routine is called after a single SQL statement has been
** parsed and a VDBE program to execute that statement has been
** prepared.  This routine puts the finishing touches on the
** VDBE program and resets the pParse structure for the next
** parse.
**
** Note that if an error occurred, it might be the case that
** no VDBE code was generated.
*/
void sqlite3FinishCoding(Parse *pParse){
  sqlite3 *db;
  Vdbe *v;

  db = pParse->db;
  if( db->mallocFailed ) return;
  if( pParse->nested ) return;
  if( pParse->nErr ) return;

  /* Begin by generating some termination code at the end of the
  ** vdbe program
  */
  v = sqlite3GetVdbe(pParse);
  if( v ){
    sqlite3VdbeAddOp0(v, OP_Halt);

    /* The cookie mask contains one bit for each database file open.
    ** (Bit 0 is for main, bit 1 is for temp, and so forth.)  Bits are
    ** set for each database that is used.  Generate code to start a
    ** transaction on each used database and to verify the schema cookie
    ** on each used database.
    */
    if( pParse->cookieGoto>0 ){
      u32 mask;
      int iDb;
      sqlite3VdbeJumpHere(v, pParse->cookieGoto-1);
      for(iDb=0, mask=1; iDb<db->nDb; mask<<=1, iDb++){
        if( (mask & pParse->cookieMask)==0 ) continue;
        sqlite3VdbeUsesBtree(v, iDb);
        sqlite3VdbeAddOp2(v,OP_Transaction, iDb, (mask & pParse->writeMask)!=0);
        sqlite3VdbeAddOp2(v,OP_VerifyCookie, iDb, pParse->cookieValue[iDb]);
      }
#ifndef SQLITE_OMIT_VIRTUALTABLE
      {
        int i;
        for(i=0; i<pParse->nVtabLock; i++){
          char *vtab = (char *)pParse->apVtabLock[i]->pVtab;
          sqlite3VdbeAddOp4(v, OP_VBegin, 0, 0, 0, vtab, P4_VTAB);
        }
        pParse->nVtabLock = 0;
      }
#endif

      /* Once all the cookies have been verified and transactions opened, 
      ** obtain the required table-locks. This is a no-op unless the 
      ** shared-cache feature is enabled.
      */
      codeTableLocks(pParse);
      sqlite3VdbeAddOp2(v, OP_Goto, 0, pParse->cookieGoto);
    }

#ifndef SQLITE_OMIT_TRACE
    if( !db->init.busy ){
      /* Change the P4 argument of the first opcode (which will always be
      ** an OP_Trace) to be the complete text of the current SQL statement.
      */
      VdbeOp *pOp = sqlite3VdbeGetOp(v, 0);
      if( pOp && pOp->opcode==OP_Trace ){
        sqlite3VdbeChangeP4(v, 0, pParse->zSql, pParse->zTail-pParse->zSql);
      }
    }
#endif /* SQLITE_OMIT_TRACE */
  }


  /* Get the VDBE program ready for execution
  */
  if( v && pParse->nErr==0 && !db->mallocFailed ){
#ifdef SQLITE_DEBUG
    FILE *trace = (db->flags & SQLITE_VdbeTrace)!=0 ? stdout : 0;
    sqlite3VdbeTrace(v, trace);
#endif
    assert( pParse->disableColCache==0 );  /* Disables and re-enables match */
    sqlite3VdbeMakeReady(v, pParse->nVar, pParse->nMem+3,
                         pParse->nTab+3, pParse->explain);
    pParse->rc = SQLITE_DONE;
    pParse->colNamesSet = 0;
  }else if( pParse->rc==SQLITE_OK ){
    pParse->rc = SQLITE_ERROR;
  }
  pParse->nTab = 0;
  pParse->nMem = 0;
  pParse->nSet = 0;
  pParse->nVar = 0;
  pParse->cookieMask = 0;
  pParse->cookieGoto = 0;
}

/*
** Run the parser and code generator recursively in order to generate
** code for the SQL statement given onto the end of the pParse context
** currently under construction.  When the parser is run recursively
** this way, the final OP_Halt is not appended and other initialization
** and finalization steps are omitted because those are handling by the
** outermost parser.
**
** Not everything is nestable.  This facility is designed to permit
** INSERT, UPDATE, and DELETE operations against SQLITE_MASTER.  Use
** care if you decide to try to use this routine for some other purposes.
*/
void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){
  va_list ap;
  char *zSql;
  char *zErrMsg = 0;
  sqlite3 *db = pParse->db;
# define SAVE_SZ  (sizeof(Parse) - offsetof(Parse,nVar))
  char saveBuf[SAVE_SZ];

  if( pParse->nErr ) return;
  assert( pParse->nested<10 );  /* Nesting should only be of limited depth */
  va_start(ap, zFormat);
  zSql = sqlite3VMPrintf(db, zFormat, ap);
  va_end(ap);
  if( zSql==0 ){
    return;   /* A malloc must have failed */
  }
  pParse->nested++;
  memcpy(saveBuf, &pParse->nVar, SAVE_SZ);
  memset(&pParse->nVar, 0, SAVE_SZ);
  sqlite3RunParser(pParse, zSql, &zErrMsg);
  sqlite3DbFree(db, zErrMsg);
  sqlite3DbFree(db, zSql);
  memcpy(&pParse->nVar, saveBuf, SAVE_SZ);
  pParse->nested--;
}

/*
** Locate the in-memory structure that describes a particular database
** table given the name of that table and (optionally) the name of the
** database containing the table.  Return NULL if not found.
**
** If zDatabase is 0, all databases are searched for the table and the
** first matching table is returned.  (No checking for duplicate table
** names is done.)  The search order is TEMP first, then MAIN, then any
** auxiliary databases added using the ATTACH command.
**
** See also sqlite3LocateTable().
*/
Table *sqlite3FindTable(sqlite3 *db, const char *zName, const char *zDatabase){
  Table *p = 0;
  int i;
  int nName;
  assert( zName!=0 );
  nName = sqlite3Strlen(db, zName) + 1;
  for(i=OMIT_TEMPDB; i<db->nDb; i++){
    int j = (i<2) ? i^1 : i;   /* Search TEMP before MAIN */
    if( zDatabase!=0 && sqlite3StrICmp(zDatabase, db->aDb[j].zName) ) continue;
    p = sqlite3HashFind(&db->aDb[j].pSchema->tblHash, zName, nName);
    if( p ) break;
  }
  return p;
}

/*
** Locate the in-memory structure that describes a particular database
** table given the name of that table and (optionally) the name of the
** database containing the table.  Return NULL if not found.  Also leave an
** error message in pParse->zErrMsg.
**
** The difference between this routine and sqlite3FindTable() is that this
** routine leaves an error message in pParse->zErrMsg where
** sqlite3FindTable() does not.
*/
Table *sqlite3LocateTable(
  Parse *pParse,         /* context in which to report errors */
  int isView,            /* True if looking for a VIEW rather than a TABLE */
  const char *zName,     /* Name of the table we are looking for */
  const char *zDbase     /* Name of the database.  Might be NULL */
){
  Table *p;

  /* Read the database schema. If an error occurs, leave an error message
  ** and code in pParse and return NULL. */
  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
    return 0;
  }

  p = sqlite3FindTable(pParse->db, zName, zDbase);
  if( p==0 ){
    const char *zMsg = isView ? "no such view" : "no such table";
    if( zDbase ){
      sqlite3ErrorMsg(pParse, "%s: %s.%s", zMsg, zDbase, zName);
    }else{
      sqlite3ErrorMsg(pParse, "%s: %s", zMsg, zName);
    }
    pParse->checkSchema = 1;
  }
  return p;
}

/*
** Locate the in-memory structure that describes 
** a particular index given the name of that index
** and the name of the database that contains the index.
** Return NULL if not found.
**
** If zDatabase is 0, all databases are searched for the
** table and the first matching index is returned.  (No checking
** for duplicate index names is done.)  The search order is
** TEMP first, then MAIN, then any auxiliary databases added
** using the ATTACH command.
*/
Index *sqlite3FindIndex(sqlite3 *db, const char *zName, const char *zDb){
  Index *p = 0;
  int i;
  int nName = sqlite3Strlen(db, zName)+1;
  for(i=OMIT_TEMPDB; i<db->nDb; i++){
    int j = (i<2) ? i^1 : i;  /* Search TEMP before MAIN */
    Schema *pSchema = db->aDb[j].pSchema;
    if( zDb && sqlite3StrICmp(zDb, db->aDb[j].zName) ) continue;
    assert( pSchema || (j==1 && !db->aDb[1].pBt) );
    if( pSchema ){
      p = sqlite3HashFind(&pSchema->idxHash, zName, nName);
    }
    if( p ) break;
  }
  return p;
}

/*
** Reclaim the memory used by an index
*/
static void freeIndex(Index *p){
  sqlite3 *db = p->pTable->db;
  sqlite3DbFree(db, p->zColAff);
  sqlite3DbFree(db, p);
}

/*
** Remove the given index from the index hash table, and free
** its memory structures.
**
** The index is removed from the database hash tables but
** it is not unlinked from the Table that it indexes.
** Unlinking from the Table must be done by the calling function.
*/
static void sqliteDeleteIndex(Index *p){
  Index *pOld;
  const char *zName = p->zName;

  pOld = sqlite3HashInsert(&p->pSchema->idxHash, zName, strlen(zName)+1, 0);
  assert( pOld==0 || pOld==p );
  freeIndex(p);
}

/*
** For the index called zIdxName which is found in the database iDb,
** unlike that index from its Table then remove the index from
** the index hash table and free all memory structures associated
** with the index.
*/
void sqlite3UnlinkAndDeleteIndex(sqlite3 *db, int iDb, const char *zIdxName){
  Index *pIndex;
  int len;
  Hash *pHash = &db->aDb[iDb].pSchema->idxHash;

  len = sqlite3Strlen(db, zIdxName);
  pIndex = sqlite3HashInsert(pHash, zIdxName, len+1, 0);
  if( pIndex ){
    if( pIndex->pTable->pIndex==pIndex ){
      pIndex->pTable->pIndex = pIndex->pNext;
    }else{
      Index *p;
      for(p=pIndex->pTable->pIndex; p && p->pNext!=pIndex; p=p->pNext){}
      if( p && p->pNext==pIndex ){
        p->pNext = pIndex->pNext;
      }
    }
    freeIndex(pIndex);
  }
  db->flags |= SQLITE_InternChanges;
}

/*
** Erase all schema information from the in-memory hash tables of
** a single database.  This routine is called to reclaim memory
** before the database closes.  It is also called during a rollback
** if there were schema changes during the transaction or if a
** schema-cookie mismatch occurs.
**
** If iDb<=0 then reset the internal schema tables for all database
** files.  If iDb>=2 then reset the internal schema for only the
** single file indicated.
*/
void sqlite3ResetInternalSchema(sqlite3 *db, int iDb){
  int i, j;
  assert( iDb>=0 && iDb<db->nDb );

  if( iDb==0 ){
    sqlite3BtreeEnterAll(db);
  }
  for(i=iDb; i<db->nDb; i++){
    Db *pDb = &db->aDb[i];
    if( pDb->pSchema ){
      assert(i==1 || (pDb->pBt && sqlite3BtreeHoldsMutex(pDb->pBt)));
      sqlite3SchemaFree(pDb->pSchema);
    }
    if( iDb>0 ) return;
  }
  assert( iDb==0 );
  db->flags &= ~SQLITE_InternChanges;
  sqlite3BtreeLeaveAll(db);

  /* If one or more of the auxiliary database files has been closed,
  ** then remove them from the auxiliary database list.  We take the
  ** opportunity to do this here since we have just deleted all of the
  ** schema hash tables and therefore do not have to make any changes
  ** to any of those tables.
  */
  for(i=0; i<db->nDb; i++){
    struct Db *pDb = &db->aDb[i];
    if( pDb->pBt==0 ){
      if( pDb->pAux && pDb->xFreeAux ) pDb->xFreeAux(pDb->pAux);
      pDb->pAux = 0;
    }
  }
  for(i=j=2; i<db->nDb; i++){
    struct Db *pDb = &db->aDb[i];
    if( pDb->pBt==0 ){
      sqlite3DbFree(db, pDb->zName);
      pDb->zName = 0;
      continue;
    }
    if( j<i ){
      db->aDb[j] = db->aDb[i];
    }
    j++;
  }
  memset(&db->aDb[j], 0, (db->nDb-j)*sizeof(db->aDb[j]));
  db->nDb = j;
  if( db->nDb<=2 && db->aDb!=db->aDbStatic ){
    memcpy(db->aDbStatic, db->aDb, 2*sizeof(db->aDb[0]));
    sqlite3DbFree(db, db->aDb);
    db->aDb = db->aDbStatic;
  }
}

/*
** This routine is called when a commit occurs.
*/
void sqlite3CommitInternalChanges(sqlite3 *db){
  db->flags &= ~SQLITE_InternChanges;
}

/*
** Clear the column names from a table or view.
*/
static void sqliteResetColumnNames(Table *pTable){
  int i;
  Column *pCol;
  sqlite3 *db = pTable->db;
  assert( pTable!=0 );
  if( (pCol = pTable->aCol)!=0 ){
    for(i=0; i<pTable->nCol; i++, pCol++){
      sqlite3DbFree(db, pCol->zName);
      sqlite3ExprDelete(db, pCol->pDflt);
      sqlite3DbFree(db, pCol->zType);
      sqlite3DbFree(db, pCol->zColl);
    }
    sqlite3DbFree(db, pTable->aCol);
  }
  pTable->aCol = 0;
  pTable->nCol = 0;
}

/*
** Remove the memory data structures associated with the given
** Table.  No changes are made to disk by this routine.
**
** This routine just deletes the data structure.  It does not unlink
** the table data structure from the hash table.  Nor does it remove
** foreign keys from the sqlite.aFKey hash table.  But it does destroy
** memory structures of the indices and foreign keys associated with 
** the table.
*/
void sqlite3DeleteTable(Table *pTable){
  Index *pIndex, *pNext;
  FKey *pFKey, *pNextFKey;
  sqlite3 *db;

  if( pTable==0 ) return;
  db = pTable->db;

  /* Do not delete the table until the reference count reaches zero. */
  pTable->nRef--;
  if( pTable->nRef>0 ){
    return;
  }
  assert( pTable->nRef==0 );

  /* Delete all indices associated with this table
  */
  for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){
    pNext = pIndex->pNext;
    assert( pIndex->pSchema==pTable->pSchema );
    sqliteDeleteIndex(pIndex);
  }

#ifndef SQLITE_OMIT_FOREIGN_KEY
  /* Delete all foreign keys associated with this table.  The keys
  ** should have already been unlinked from the pSchema->aFKey hash table 
  */
  for(pFKey=pTable->pFKey; pFKey; pFKey=pNextFKey){
    pNextFKey = pFKey->pNextFrom;
    assert( sqlite3HashFind(&pTable->pSchema->aFKey,
                           pFKey->zTo, strlen(pFKey->zTo)+1)!=pFKey );
    sqlite3DbFree(db, pFKey);
  }
#endif

  /* Delete the Table structure itself.
  */
  sqliteResetColumnNames(pTable);
  sqlite3DbFree(db, pTable->zName);
  sqlite3DbFree(db, pTable->zColAff);
  sqlite3SelectDelete(db, pTable->pSelect);
#ifndef SQLITE_OMIT_CHECK
  sqlite3ExprDelete(db, pTable->pCheck);
#endif
  sqlite3VtabClear(pTable);
  sqlite3DbFree(db, pTable);
}

/*
** Unlink the given table from the hash tables and the delete the
** table structure with all its indices and foreign keys.
*/
void sqlite3UnlinkAndDeleteTable(sqlite3 *db, int iDb, const char *zTabName){
  Table *p;
  FKey *pF1, *pF2;
  Db *pDb;

  assert( db!=0 );
  assert( iDb>=0 && iDb<db->nDb );
  assert( zTabName && zTabName[0] );
  pDb = &db->aDb[iDb];
  p = sqlite3HashInsert(&pDb->pSchema->tblHash, zTabName, strlen(zTabName)+1,0);
  if( p ){
#ifndef SQLITE_OMIT_FOREIGN_KEY
    for(pF1=p->pFKey; pF1; pF1=pF1->pNextFrom){
      int nTo = strlen(pF1->zTo) + 1;
      pF2 = sqlite3HashFind(&pDb->pSchema->aFKey, pF1->zTo, nTo);
      if( pF2==pF1 ){
        sqlite3HashInsert(&pDb->pSchema->aFKey, pF1->zTo, nTo, pF1->pNextTo);
      }else{
        while( pF2 && pF2->pNextTo!=pF1 ){ pF2=pF2->pNextTo; }
        if( pF2 ){
          pF2->pNextTo = pF1->pNextTo;
        }
      }
    }
#endif
    sqlite3DeleteTable(p);
  }
  db->flags |= SQLITE_InternChanges;
}

/*
** Given a token, return a string that consists of the text of that
** token with any quotations removed.  Space to hold the returned string
** is obtained from sqliteMalloc() and must be freed by the calling
** function.
**
** Tokens are often just pointers into the original SQL text and so
** are not \000 terminated and are not persistent.  The returned string
** is \000 terminated and is persistent.
*/
char *sqlite3NameFromToken(sqlite3 *db, Token *pName){
  char *zName;
  if( pName ){
    zName = sqlite3DbStrNDup(db, (char*)pName->z, pName->n);
    sqlite3Dequote(zName);
  }else{
    zName = 0;
  }
  return zName;
}

/*
** Open the sqlite_master table stored in database number iDb for
** writing. The table is opened using cursor 0.
*/
void sqlite3OpenMasterTable(Parse *p, int iDb){
  Vdbe *v = sqlite3GetVdbe(p);
  sqlite3TableLock(p, iDb, MASTER_ROOT, 1, SCHEMA_TABLE(iDb));
  sqlite3VdbeAddOp2(v, OP_SetNumColumns, 0, 5);/* sqlite_master has 5 columns */
  sqlite3VdbeAddOp3(v, OP_OpenWrite, 0, MASTER_ROOT, iDb);
}

/*
** The token *pName contains the name of a database (either "main" or
** "temp" or the name of an attached db). This routine returns the
** index of the named database in db->aDb[], or -1 if the named db 
** does not exist.
*/
int sqlite3FindDb(sqlite3 *db, Token *pName){
  int i = -1;    /* Database number */
  int n;         /* Number of characters in the name */
  Db *pDb;       /* A database whose name space is being searched */
  char *zName;   /* Name we are searching for */

  zName = sqlite3NameFromToken(db, pName);
  if( zName ){
    n = strlen(zName);
    for(i=(db->nDb-1), pDb=&db->aDb[i]; i>=0; i--, pDb--){
      if( (!OMIT_TEMPDB || i!=1 ) && n==strlen(pDb->zName) && 
          0==sqlite3StrICmp(pDb->zName, zName) ){
        break;
      }
    }
    sqlite3DbFree(db, zName);
  }
  return i;
}

/* The table or view or trigger name is passed to this routine via tokens
** pName1 and pName2. If the table name was fully qualified, for example:
**
** CREATE TABLE xxx.yyy (...);
** 
** Then pName1 is set to "xxx" and pName2 "yyy". On the other hand if
** the table name is not fully qualified, i.e.:
**
** CREATE TABLE yyy(...);
**
** Then pName1 is set to "yyy" and pName2 is "".
**
** This routine sets the *ppUnqual pointer to point at the token (pName1 or
** pName2) that stores the unqualified table name.  The index of the
** database "xxx" is returned.
*/
int sqlite3TwoPartName(
  Parse *pParse,      /* Parsing and code generating context */
  Token *pName1,      /* The "xxx" in the name "xxx.yyy" or "xxx" */
  Token *pName2,      /* The "yyy" in the name "xxx.yyy" */
  Token **pUnqual     /* Write the unqualified object name here */
){
  int iDb;                    /* Database holding the object */
  sqlite3 *db = pParse->db;

  if( pName2 && pName2->n>0 ){
    assert( !db->init.busy );
    *pUnqual = pName2;
    iDb = sqlite3FindDb(db, pName1);
    if( iDb<0 ){
      sqlite3ErrorMsg(pParse, "unknown database %T", pName1);
      pParse->nErr++;
      return -1;
    }
  }else{
    assert( db->init.iDb==0 || db->init.busy );
    iDb = db->init.iDb;
    *pUnqual = pName1;
  }
  return iDb;
}

/*
** This routine is used to check if the UTF-8 string zName is a legal
** unqualified name for a new schema object (table, index, view or
** trigger). All names are legal except those that begin with the string
** "sqlite_" (in upper, lower or mixed case). This portion of the namespace
** is reserved for internal use.
*/
int sqlite3CheckObjectName(Parse *pParse, const char *zName){
  if( !pParse->db->init.busy && pParse->nested==0 
          && (pParse->db->flags & SQLITE_WriteSchema)==0
          && 0==sqlite3StrNICmp(zName, "sqlite_", 7) ){
    sqlite3ErrorMsg(pParse, "object name reserved for internal use: %s", zName);
    return SQLITE_ERROR;
  }
  return SQLITE_OK;
}

/*
** Begin constructing a new table representation in memory.  This is
** the first of several action routines that get called in response
** to a CREATE TABLE statement.  In particular, this routine is called
** after seeing tokens "CREATE" and "TABLE" and the table name. The isTemp
** flag is true if the table should be stored in the auxiliary database
** file instead of in the main database file.  This is normally the case
** when the "TEMP" or "TEMPORARY" keyword occurs in between
** CREATE and TABLE.
**
** The new table record is initialized and put in pParse->pNewTable.
** As more of the CREATE TABLE statement is parsed, additional action
** routines will be called to add more information to this record.
** At the end of the CREATE TABLE statement, the sqlite3EndTable() routine
** is called to complete the construction of the new table record.
*/
void sqlite3StartTable(
  Parse *pParse,   /* Parser context */
  Token *pName1,   /* First part of the name of the table or view */
  Token *pName2,   /* Second part of the name of the table or view */
  int isTemp,      /* True if this is a TEMP table */
  int isView,      /* True if this is a VIEW */
  int isVirtual,   /* True if this is a VIRTUAL table */
  int noErr        /* Do nothing if table already exists */
){
  Table *pTable;
  char *zName = 0; /* The name of the new table */
  sqlite3 *db = pParse->db;
  Vdbe *v;
  int iDb;         /* Database number to create the table in */
  Token *pName;    /* Unqualified name of the table to create */

  /* The table or view name to create is passed to this routine via tokens
  ** pName1 and pName2. If the table name was fully qualified, for example:
  **
  ** CREATE TABLE xxx.yyy (...);
  ** 
  ** Then pName1 is set to "xxx" and pName2 "yyy". On the other hand if
  ** the table name is not fully qualified, i.e.:
  **
  ** CREATE TABLE yyy(...);
  **
  ** Then pName1 is set to "yyy" and pName2 is "".
  **
  ** The call below sets the pName pointer to point at the token (pName1 or
  ** pName2) that stores the unqualified table name. The variable iDb is
  ** set to the index of the database that the table or view is to be
  ** created in.
  */
  iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName);
  if( iDb<0 ) return;
  if( !OMIT_TEMPDB && isTemp && iDb>1 ){
    /* If creating a temp table, the name may not be qualified */
    sqlite3ErrorMsg(pParse, "temporary table name must be unqualified");
    return;
  }
  if( !OMIT_TEMPDB && isTemp ) iDb = 1;

  pParse->sNameToken = *pName;
  zName = sqlite3NameFromToken(db, pName);
  if( zName==0 ) return;
  if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){
    goto begin_table_error;
  }
  if( db->init.iDb==1 ) isTemp = 1;
#ifndef SQLITE_OMIT_AUTHORIZATION
  assert( (isTemp & 1)==isTemp );
  {
    int code;
    char *zDb = db->aDb[iDb].zName;
    if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(isTemp), 0, zDb) ){
      goto begin_table_error;
    }
    if( isView ){
      if( !OMIT_TEMPDB && isTemp ){
        code = SQLITE_CREATE_TEMP_VIEW;
      }else{
        code = SQLITE_CREATE_VIEW;
      }
    }else{
      if( !OMIT_TEMPDB && isTemp ){
        code = SQLITE_CREATE_TEMP_TABLE;
      }else{
        code = SQLITE_CREATE_TABLE;
      }
    }
    if( !isVirtual && sqlite3AuthCheck(pParse, code, zName, 0, zDb) ){
      goto begin_table_error;
    }
  }
#endif

  /* Make sure the new table name does not collide with an existing
  ** index or table name in the same database.  Issue an error message if
  ** it does. The exception is if the statement being parsed was passed
  ** to an sqlite3_declare_vtab() call. In that case only the column names
  ** and types will be used, so there is no need to test for namespace
  ** collisions.
  */
  if( !IN_DECLARE_VTAB ){
    if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
      goto begin_table_error;
    }
    pTable = sqlite3FindTable(db, zName, db->aDb[iDb].zName);
    if( pTable ){
      if( !noErr ){
        sqlite3ErrorMsg(pParse, "table %T already exists", pName);
      }
      goto begin_table_error;
    }
    if( sqlite3FindIndex(db, zName, 0)!=0 && (iDb==0 || !db->init.busy) ){
      sqlite3ErrorMsg(pParse, "there is already an index named %s", zName);
      goto begin_table_error;
    }
  }

  pTable = sqlite3DbMallocZero(db, sizeof(Table));
  if( pTable==0 ){
    db->mallocFailed = 1;
    pParse->rc = SQLITE_NOMEM;
    pParse->nErr++;
    goto begin_table_error;
  }
  pTable->zName = zName;
  pTable->iPKey = -1;
  pTable->pSchema = db->aDb[iDb].pSchema;
  pTable->nRef = 1;
  pTable->db = db;
  if( pParse->pNewTable ) sqlite3DeleteTable(pParse->pNewTable);
  pParse->pNewTable = pTable;

  /* If this is the magic sqlite_sequence table used by autoincrement,
  ** then record a pointer to this table in the main database structure
  ** so that INSERT can find the table easily.
  */
#ifndef SQLITE_OMIT_AUTOINCREMENT
  if( !pParse->nested && strcmp(zName, "sqlite_sequence")==0 ){
    pTable->pSchema->pSeqTab = pTable;
  }
#endif

  /* Begin generating the code that will insert the table record into
  ** the SQLITE_MASTER table.  Note in particular that we must go ahead
  ** and allocate the record number for the table entry now.  Before any
  ** PRIMARY KEY or UNIQUE keywords are parsed.  Those keywords will cause
  ** indices to be created and the table record must come before the 
  ** indices.  Hence, the record number for the table must be allocated
  ** now.
  */
  if( !db->init.busy && (v = sqlite3GetVdbe(pParse))!=0 ){
    int j1;
    int fileFormat;
    int reg1, reg2, reg3;
    sqlite3BeginWriteOperation(pParse, 0, iDb);

#ifndef SQLITE_OMIT_VIRTUALTABLE
    if( isVirtual ){
      sqlite3VdbeAddOp0(v, OP_VBegin);
    }
#endif

    /* If the file format and encoding in the database have not been set, 
    ** set them now.
    */
    reg1 = pParse->regRowid = ++pParse->nMem;
    reg2 = pParse->regRoot = ++pParse->nMem;
    reg3 = ++pParse->nMem;
    sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, reg3, 1);   /* file_format */
    sqlite3VdbeUsesBtree(v, iDb);
    j1 = sqlite3VdbeAddOp1(v, OP_If, reg3);
    fileFormat = (db->flags & SQLITE_LegacyFileFmt)!=0 ?
                  1 : SQLITE_MAX_FILE_FORMAT;
    sqlite3VdbeAddOp2(v, OP_Integer, fileFormat, reg3);
    sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, 1, reg3);
    sqlite3VdbeAddOp2(v, OP_Integer, ENC(db), reg3);
    sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, 4, reg3);
    sqlite3VdbeJumpHere(v, j1);

    /* This just creates a place-holder record in the sqlite_master table.
    ** The record created does not contain anything yet.  It will be replaced
    ** by the real entry in code generated at sqlite3EndTable().
    **
    ** The rowid for the new entry is left on the top of the stack.
    ** The rowid value is needed by the code that sqlite3EndTable will
    ** generate.
    */
#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE)
    if( isView || isVirtual ){
      sqlite3VdbeAddOp2(v, OP_Integer, 0, reg2);
    }else
#endif
    {
      sqlite3VdbeAddOp2(v, OP_CreateTable, iDb, reg2);
    }
    sqlite3OpenMasterTable(pParse, iDb);
    sqlite3VdbeAddOp2(v, OP_NewRowid, 0, reg1);
    sqlite3VdbeAddOp2(v, OP_Null, 0, reg3);
    sqlite3VdbeAddOp3(v, OP_Insert, 0, reg3, reg1);
    sqlite3VdbeChangeP5(v, OPFLAG_APPEND);
    sqlite3VdbeAddOp0(v, OP_Close);
  }

  /* Normal (non-error) return. */
  return;

  /* If an error occurs, we jump here */
begin_table_error:
  sqlite3DbFree(db, zName);
  return;
}

/*
** This macro is used to compare two strings in a case-insensitive manner.
** It is slightly faster than calling sqlite3StrICmp() directly, but
** produces larger code.
**
** WARNING: This macro is not compatible with the strcmp() family. It
** returns true if the two strings are equal, otherwise false.
*/
#define STRICMP(x, y) (\
sqlite3UpperToLower[*(unsigned char *)(x)]==   \
sqlite3UpperToLower[*(unsigned char *)(y)]     \
&& sqlite3StrICmp((x)+1,(y)+1)==0 )

/*
** Add a new column to the table currently being constructed.
**
** The parser calls this routine once for each column declaration
** in a CREATE TABLE statement.  sqlite3StartTable() gets called
** first to get things going.  Then this routine is called for each
** column.
*/
void sqlite3AddColumn(Parse *pParse, Token *pName){
  Table *p;
  int i;
  char *z;
  Column *pCol;
  sqlite3 *db = pParse->db;
  if( (p = pParse->pNewTable)==0 ) return;
#if SQLITE_MAX_COLUMN
  if( p->nCol+1>db->aLimit[SQLITE_LIMIT_COLUMN] ){
    sqlite3ErrorMsg(pParse, "too many columns on %s", p->zName);
    return;
  }
#endif
  z = sqlite3NameFromToken(pParse->db, pName);
  if( z==0 ) return;
  for(i=0; i<p->nCol; i++){
    if( STRICMP(z, p->aCol[i].zName) ){
      sqlite3ErrorMsg(pParse, "duplicate column name: %s", z);
      sqlite3DbFree(db, z);
      return;
    }
  }
  if( (p->nCol & 0x7)==0 ){
    Column *aNew;
    aNew = sqlite3DbRealloc(pParse->db,p->aCol,(p->nCol+8)*sizeof(p->aCol[0]));
    if( aNew==0 ){
      sqlite3DbFree(db, z);
      return;
    }
    p->aCol = aNew;
  }
  pCol = &p->aCol[p->nCol];
  memset(pCol, 0, sizeof(p->aCol[0]));
  pCol->zName = z;
 
  /* If there is no type specified, columns have the default affinity
  ** 'NONE'. If there is a type specified, then sqlite3AddColumnType() will
  ** be called next to set pCol->affinity correctly.
  */
  pCol->affinity = SQLITE_AFF_NONE;
  p->nCol++;
}

/*
** This routine is called by the parser while in the middle of
** parsing a CREATE TABLE statement.  A "NOT NULL" constraint has
** been seen on a column.  This routine sets the notNull flag on
** the column currently under construction.
*/
void sqlite3AddNotNull(Parse *pParse, int onError){
  Table *p;
  int i;
  if( (p = pParse->pNewTable)==0 ) return;
  i = p->nCol-1;
  if( i>=0 ) p->aCol[i].notNull = onError;
}

/*
** Scan the column type name zType (length nType) and return the
** associated affinity type.
**
** This routine does a case-independent search of zType for the 
** substrings in the following table. If one of the substrings is
** found, the corresponding affinity is returned. If zType contains
** more than one of the substrings, entries toward the top of 
** the table take priority. For example, if zType is 'BLOBINT', 
** SQLITE_AFF_INTEGER is returned.
**
** Substring     | Affinity
** --------------------------------
** 'INT'         | SQLITE_AFF_INTEGER
** 'CHAR'        | SQLITE_AFF_TEXT
** 'CLOB'        | SQLITE_AFF_TEXT
** 'TEXT'        | SQLITE_AFF_TEXT
** 'BLOB'        | SQLITE_AFF_NONE
** 'REAL'        | SQLITE_AFF_REAL
** 'FLOA'        | SQLITE_AFF_REAL
** 'DOUB'        | SQLITE_AFF_REAL
**
** If none of the substrings in the above table are found,
** SQLITE_AFF_NUMERIC is returned.
*/
char sqlite3AffinityType(const Token *pType){
  u32 h = 0;
  char aff = SQLITE_AFF_NUMERIC;
  const unsigned char *zIn = pType->z;
  const unsigned char *zEnd = &pType->z[pType->n];

  while( zIn!=zEnd ){
    h = (h<<8) + sqlite3UpperToLower[*zIn];
    zIn++;
    if( h==(('c'<<24)+('h'<<16)+('a'<<8)+'r') ){             /* CHAR */
      aff = SQLITE_AFF_TEXT; 
    }else if( h==(('c'<<24)+('l'<<16)+('o'<<8)+'b') ){       /* CLOB */
      aff = SQLITE_AFF_TEXT;
    }else if( h==(('t'<<24)+('e'<<16)+('x'<<8)+'t') ){       /* TEXT */
      aff = SQLITE_AFF_TEXT;
    }else if( h==(('b'<<24)+('l'<<16)+('o'<<8)+'b')          /* BLOB */
        && (aff==SQLITE_AFF_NUMERIC || aff==SQLITE_AFF_REAL) ){
      aff = SQLITE_AFF_NONE;
#ifndef SQLITE_OMIT_FLOATING_POINT
    }else if( h==(('r'<<24)+('e'<<16)+('a'<<8)+'l')          /* REAL */
        && aff==SQLITE_AFF_NUMERIC ){
      aff = SQLITE_AFF_REAL;
    }else if( h==(('f'<<24)+('l'<<16)+('o'<<8)+'a')          /* FLOA */
        && aff==SQLITE_AFF_NUMERIC ){
      aff = SQLITE_AFF_REAL;
    }else if( h==(('d'<<24)+('o'<<16)+('u'<<8)+'b')          /* DOUB */
        && aff==SQLITE_AFF_NUMERIC ){
      aff = SQLITE_AFF_REAL;
#endif
    }else if( (h&0x00FFFFFF)==(('i'<<16)+('n'<<8)+'t') ){    /* INT */
      aff = SQLITE_AFF_INTEGER;
      break;
    }
  }

  return aff;
}

/*
** This routine is called by the parser while in the middle of
** parsing a CREATE TABLE statement.  The pFirst token is the first
** token in the sequence of tokens that describe the type of the
** column currently under construction.   pLast is the last token
** in the sequence.  Use this information to construct a string
** that contains the typename of the column and store that string
** in zType.
*/ 
void sqlite3AddColumnType(Parse *pParse, Token *pType){
  Table *p;
  int i;
  Column *pCol;
  sqlite3 *db;

  if( (p = pParse->pNewTable)==0 ) return;
  i = p->nCol-1;
  if( i<0 ) return;
  pCol = &p->aCol[i];
  db = pParse->db;
  sqlite3DbFree(db, pCol->zType);
  pCol->zType = sqlite3NameFromToken(db, pType);
  pCol->affinity = sqlite3AffinityType(pType);
}

/*
** The expression is the default value for the most recently added column
** of the table currently under construction.
**
** Default value expressions must be constant.  Raise an exception if this
** is not the case.
**
** This routine is called by the parser while in the middle of
** parsing a CREATE TABLE statement.
*/
void sqlite3AddDefaultValue(Parse *pParse, Expr *pExpr){
  Table *p;
  Column *pCol;
  sqlite3 *db = pParse->db;
  if( (p = pParse->pNewTable)!=0 ){
    pCol = &(p->aCol[p->nCol-1]);
    if( !sqlite3ExprIsConstantOrFunction(pExpr) ){
      sqlite3ErrorMsg(pParse, "default value of column [%s] is not constant",
          pCol->zName);
    }else{
      Expr *pCopy;
      sqlite3ExprDelete(db, pCol->pDflt);
      pCol->pDflt = pCopy = sqlite3ExprDup(db, pExpr);
      if( pCopy ){
        sqlite3TokenCopy(db, &pCopy->span, &pExpr->span);
      }
    }
  }
  sqlite3ExprDelete(db, pExpr);
}

/*
** Designate the PRIMARY KEY for the table.  pList is a list of names 
** of columns that form the primary key.  If pList is NULL, then the
** most recently added column of the table is the primary key.
**
** A table can have at most one primary key.  If the table already has
** a primary key (and this is the second primary key) then create an
** error.
**
** If the PRIMARY KEY is on a single column whose datatype is INTEGER,
** then we will try to use that column as the rowid.  Set the Table.iPKey
** field of the table under construction to be the index of the
** INTEGER PRIMARY KEY column.  Table.iPKey is set to -1 if there is
** no INTEGER PRIMARY KEY.
**
** If the key is not an INTEGER PRIMARY KEY, then create a unique
** index for the key.  No index is created for INTEGER PRIMARY KEYs.
*/
void sqlite3AddPrimaryKey(
  Parse *pParse,    /* Parsing context */
  ExprList *pList,  /* List of field names to be indexed */
  int onError,      /* What to do with a uniqueness conflict */
  int autoInc,      /* True if the AUTOINCREMENT keyword is present */
  int sortOrder     /* SQLITE_SO_ASC or SQLITE_SO_DESC */
){
  Table *pTab = pParse->pNewTable;
  char *zType = 0;
  int iCol = -1, i;
  if( pTab==0 || IN_DECLARE_VTAB ) goto primary_key_exit;
  if( pTab->hasPrimKey ){
    sqlite3ErrorMsg(pParse, 
      "table \"%s\" has more than one primary key", pTab->zName);
    goto primary_key_exit;
  }
  pTab->hasPrimKey = 1;
  if( pList==0 ){
    iCol = pTab->nCol - 1;
    pTab->aCol[iCol].isPrimKey = 1;
  }else{
    for(i=0; i<pList->nExpr; i++){
      for(iCol=0; iCol<pTab->nCol; iCol++){
        if( sqlite3StrICmp(pList->a[i].zName, pTab->aCol[iCol].zName)==0 ){
          break;
        }
      }
      if( iCol<pTab->nCol ){
        pTab->aCol[iCol].isPrimKey = 1;
      }
    }
    if( pList->nExpr>1 ) iCol = -1;
  }
  if( iCol>=0 && iCol<pTab->nCol ){
    zType = pTab->aCol[iCol].zType;
  }
  if( zType && sqlite3StrICmp(zType, "INTEGER")==0
        && sortOrder==SQLITE_SO_ASC ){
    pTab->iPKey = iCol;
    pTab->keyConf = onError;
    pTab->autoInc = autoInc;
  }else if( autoInc ){
#ifndef SQLITE_OMIT_AUTOINCREMENT
    sqlite3ErrorMsg(pParse, "AUTOINCREMENT is only allowed on an "
       "INTEGER PRIMARY KEY");
#endif
  }else{
    sqlite3CreateIndex(pParse, 0, 0, 0, pList, onError, 0, 0, sortOrder, 0);
    pList = 0;
  }

primary_key_exit:
  sqlite3ExprListDelete(pParse->db, pList);
  return;
}

/*
** Add a new CHECK constraint to the table currently under construction.
*/
void sqlite3AddCheckConstraint(
  Parse *pParse,    /* Parsing context */
  Expr *pCheckExpr  /* The check expression */
){
  sqlite3 *db = pParse->db;
#ifndef SQLITE_OMIT_CHECK
  Table *pTab = pParse->pNewTable;
  if( pTab && !IN_DECLARE_VTAB ){
    /* The CHECK expression must be duplicated so that tokens refer
    ** to malloced space and not the (ephemeral) text of the CREATE TABLE
    ** statement */
    pTab->pCheck = sqlite3ExprAnd(db, pTab->pCheck, 
                                  sqlite3ExprDup(db, pCheckExpr));
  }
#endif
  sqlite3ExprDelete(db, pCheckExpr);
}

/*
** Set the collation function of the most recently parsed table column
** to the CollSeq given.
*/
void sqlite3AddCollateType(Parse *pParse, Token *pToken){
  Table *p;
  int i;
  char *zColl;              /* Dequoted name of collation sequence */
  sqlite3 *db;

  if( (p = pParse->pNewTable)==0 ) return;
  i = p->nCol-1;
  db = pParse->db;
  zColl = sqlite3NameFromToken(db, pToken);
  if( !zColl ) return;

  if( sqlite3LocateCollSeq(pParse, zColl, -1) ){
    Index *pIdx;
    p->aCol[i].zColl = zColl;
  
    /* If the column is declared as "<name> PRIMARY KEY COLLATE <type>",
    ** then an index may have been created on this column before the
    ** collation type was added. Correct this if it is the case.
    */
    for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){
      assert( pIdx->nColumn==1 );
      if( pIdx->aiColumn[0]==i ){
        pIdx->azColl[0] = p->aCol[i].zColl;
      }
    }
  }else{
    sqlite3DbFree(db, zColl);
  }
}

/*
** This function returns the collation sequence for database native text
** encoding identified by the string zName, length nName.
**
** If the requested collation sequence is not available, or not available
** in the database native encoding, the collation factory is invoked to
** request it. If the collation factory does not supply such a sequence,
** and the sequence is available in another text encoding, then that is
** returned instead.
**
** If no versions of the requested collations sequence are available, or
** another error occurs, NULL is returned and an error message written into
** pParse.
**
** This routine is a wrapper around sqlite3FindCollSeq().  This routine
** invokes the collation factory if the named collation cannot be found
** and generates an error message.
*/
CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char *zName, int nName){
  sqlite3 *db = pParse->db;
  u8 enc = ENC(db);
  u8 initbusy = db->init.busy;
  CollSeq *pColl;

  pColl = sqlite3FindCollSeq(db, enc, zName, nName, initbusy);
  if( !initbusy && (!pColl || !pColl->xCmp) ){
    pColl = sqlite3GetCollSeq(db, pColl, zName, nName);
    if( !pColl ){
      if( nName<0 ){
        nName = sqlite3Strlen(db, zName);
      }
      sqlite3ErrorMsg(pParse, "no such collation sequence: %.*s", nName, zName);
      pColl = 0;
    }
  }

  return pColl;
}


/*
** Generate code that will increment the schema cookie.
**
** The schema cookie is used to determine when the schema for the
** database changes.  After each schema change, the cookie value
** changes.  When a process first reads the schema it records the
** cookie.  Thereafter, whenever it goes to access the database,
** it checks the cookie to make sure the schema has not changed
** since it was last read.
**
** This plan is not completely bullet-proof.  It is possible for
** the schema to change multiple times and for the cookie to be
** set back to prior value.  But schema changes are infrequent
** and the probability of hitting the same cookie value is only
** 1 chance in 2^32.  So we're safe enough.
*/
void sqlite3ChangeCookie(Parse *pParse, int iDb){
  int r1 = sqlite3GetTempReg(pParse);
  sqlite3 *db = pParse->db;
  Vdbe *v = pParse->pVdbe;
  sqlite3VdbeAddOp2(v, OP_Integer, db->aDb[iDb].pSchema->schema_cookie+1, r1);
  sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, 0, r1);
  sqlite3ReleaseTempReg(pParse, r1);
}

/*
** Measure the number of characters needed to output the given
** identifier.  The number returned includes any quotes used
** but does not include the null terminator.
**
** The estimate is conservative.  It might be larger that what is
** really needed.
*/
static int identLength(const char *z){
  int n;
  for(n=0; *z; n++, z++){
    if( *z=='"' ){ n++; }
  }
  return n + 2;
}

/*
** Write an identifier onto the end of the given string.  Add
** quote characters as needed.
*/
static void identPut(char *z, int *pIdx, char *zSignedIdent){
  unsigned char *zIdent = (unsigned char*)zSignedIdent;
  int i, j, needQuote;
  i = *pIdx;
  for(j=0; zIdent[j]; j++){
    if( !isalnum(zIdent[j]) && zIdent[j]!='_' ) break;
  }
  needQuote =  zIdent[j]!=0 || isdigit(zIdent[0])
                  || sqlite3KeywordCode(zIdent, j)!=TK_ID;
  if( needQuote ) z[i++] = '"';
  for(j=0; zIdent[j]; j++){
    z[i++] = zIdent[j];
    if( zIdent[j]=='"' ) z[i++] = '"';
  }
  if( needQuote ) z[i++] = '"';
  z[i] = 0;
  *pIdx = i;
}

/*
** Generate a CREATE TABLE statement appropriate for the given
** table.  Memory to hold the text of the statement is obtained
** from sqliteMalloc() and must be freed by the calling function.
*/
static char *createTableStmt(sqlite3 *db, Table *p, int isTemp){
  int i, k, n;
  char *zStmt;
  char *zSep, *zSep2, *zEnd, *z;
  Column *pCol;
  n = 0;
  for(pCol = p->aCol, i=0; i<p->nCol; i++, pCol++){
    n += identLength(pCol->zName);
    z = pCol->zType;
    if( z ){
      n += (strlen(z) + 1);
    }
  }
  n += identLength(p->zName);
  if( n<50 ){
    zSep = "";
    zSep2 = ",";
    zEnd = ")";
  }else{
    zSep = "\n  ";
    zSep2 = ",\n  ";
    zEnd = "\n)";
  }
  n += 35 + 6*p->nCol;
  zStmt = sqlite3Malloc( n );
  if( zStmt==0 ){
    db->mallocFailed = 1;
    return 0;
  }
  sqlite3_snprintf(n, zStmt,
                  !OMIT_TEMPDB&&isTemp ? "CREATE TEMP TABLE ":"CREATE TABLE ");
  k = strlen(zStmt);
  identPut(zStmt, &k, p->zName);
  zStmt[k++] = '(';
  for(pCol=p->aCol, i=0; i<p->nCol; i++, pCol++){
    sqlite3_snprintf(n-k, &zStmt[k], zSep);
    k += strlen(&zStmt[k]);
    zSep = zSep2;
    identPut(zStmt, &k, pCol->zName);
    if( (z = pCol->zType)!=0 ){
      zStmt[k++] = ' ';
      assert( strlen(z)+k+1<=n );
      sqlite3_snprintf(n-k, &zStmt[k], "%s", z);
      k += strlen(z);
    }
  }
  sqlite3_snprintf(n-k, &zStmt[k], "%s", zEnd);
  return zStmt;
}

/*
** This routine is called to report the final ")" that terminates
** a CREATE TABLE statement.
**
** The table structure that other action routines have been building
** is added to the internal hash tables, assuming no errors have
** occurred.
**
** An entry for the table is made in the master table on disk, unless
** this is a temporary table or db->init.busy==1.  When db->init.busy==1
** it means we are reading the sqlite_master table because we just
** connected to the database or because the sqlite_master table has
** recently changed, so the entry for this table already exists in
** the sqlite_master table.  We do not want to create it again.
**
** If the pSelect argument is not NULL, it means that this routine
** was called to create a table generated from a 
** "CREATE TABLE ... AS SELECT ..." statement.  The column names of
** the new table will match the result set of the SELECT.
*/
void sqlite3EndTable(
  Parse *pParse,          /* Parse context */
  Token *pCons,           /* The ',' token after the last column defn. */
  Token *pEnd,            /* The final ')' token in the CREATE TABLE */
  Select *pSelect         /* Select from a "CREATE ... AS SELECT" */
){
  Table *p;
  sqlite3 *db = pParse->db;
  int iDb;

  if( (pEnd==0 && pSelect==0) || pParse->nErr || db->mallocFailed ) {
    return;
  }
  p = pParse->pNewTable;
  if( p==0 ) return;

  assert( !db->init.busy || !pSelect );

  iDb = sqlite3SchemaToIndex(db, p->pSchema);

#ifndef SQLITE_OMIT_CHECK
  /* Resolve names in all CHECK constraint expressions.
  */
  if( p->pCheck ){
    SrcList sSrc;                   /* Fake SrcList for pParse->pNewTable */
    NameContext sNC;                /* Name context for pParse->pNewTable */

    memset(&sNC, 0, sizeof(sNC));
    memset(&sSrc, 0, sizeof(sSrc));
    sSrc.nSrc = 1;
    sSrc.a[0].zName = p->zName;
    sSrc.a[0].pTab = p;
    sSrc.a[0].iCursor = -1;
    sNC.pParse = pParse;
    sNC.pSrcList = &sSrc;
    sNC.isCheck = 1;
    if( sqlite3ExprResolveNames(&sNC, p->pCheck) ){
      return;
    }
  }
#endif /* !defined(SQLITE_OMIT_CHECK) */

  /* If the db->init.busy is 1 it means we are reading the SQL off the
  ** "sqlite_master" or "sqlite_temp_master" table on the disk.
  ** So do not write to the disk again.  Extract the root page number
  ** for the table from the db->init.newTnum field.  (The page number
  ** should have been put there by the sqliteOpenCb routine.)
  */
  if( db->init.busy ){
    p->tnum = db->init.newTnum;
  }

  /* If not initializing, then create a record for the new table
  ** in the SQLITE_MASTER table of the database.  The record number
  ** for the new table entry should already be on the stack.
  **
  ** If this is a TEMPORARY table, write the entry into the auxiliary
  ** file instead of into the main database file.
  */
  if( !db->init.busy ){
    int n;
    Vdbe *v;
    char *zType;    /* "view" or "table" */
    char *zType2;   /* "VIEW" or "TABLE" */
    char *zStmt;    /* Text of the CREATE TABLE or CREATE VIEW statement */

    v = sqlite3GetVdbe(pParse);
    if( v==0 ) return;

    sqlite3VdbeAddOp1(v, OP_Close, 0);

    /* Create the rootpage for the new table and push it onto the stack.
    ** A view has no rootpage, so just push a zero onto the stack for
    ** views.  Initialize zType at the same time.
    */
    if( p->pSelect==0 ){
      /* A regular table */
      zType = "table";
      zType2 = "TABLE";
#ifndef SQLITE_OMIT_VIEW
    }else{
      /* A view */
      zType = "view";
      zType2 = "VIEW";
#endif
    }

    /* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT
    ** statement to populate the new table. The root-page number for the
    ** new table is on the top of the vdbe stack.
    **
    ** Once the SELECT has been coded by sqlite3Select(), it is in a
    ** suitable state to query for the column names and types to be used
    ** by the new table.
    **
    ** A shared-cache write-lock is not required to write to the new table,
    ** as a schema-lock must have already been obtained to create it. Since
    ** a schema-lock excludes all other database users, the write-lock would
    ** be redundant.
    */
    if( pSelect ){
      SelectDest dest;
      Table *pSelTab;

      assert(pParse->nTab==0);
      sqlite3VdbeAddOp3(v, OP_OpenWrite, 1, pParse->regRoot, iDb);
      sqlite3VdbeChangeP5(v, 1);
      pParse->nTab = 2;
      sqlite3SelectDestInit(&dest, SRT_Table, 1);
      sqlite3Select(pParse, pSelect, &dest, 0, 0, 0);
      sqlite3VdbeAddOp1(v, OP_Close, 1);
      if( pParse->nErr==0 ){
        pSelTab = sqlite3ResultSetOfSelect(pParse, 0, pSelect);
        if( pSelTab==0 ) return;
        assert( p->aCol==0 );
        p->nCol = pSelTab->nCol;
        p->aCol = pSelTab->aCol;
        pSelTab->nCol = 0;
        pSelTab->aCol = 0;
        sqlite3DeleteTable(pSelTab);
      }
    }

    /* Compute the complete text of the CREATE statement */
    if( pSelect ){
      zStmt = createTableStmt(db, p, p->pSchema==db->aDb[1].pSchema);
    }else{
      n = pEnd->z - pParse->sNameToken.z + 1;
      zStmt = sqlite3MPrintf(db, 
          "CREATE %s %.*s", zType2, n, pParse->sNameToken.z
      );
    }

    /* A slot for the record has already been allocated in the 
    ** SQLITE_MASTER table.  We just need to update that slot with all
    ** the information we've collected.  The rowid for the preallocated
    ** slot is the 2nd item on the stack.  The top of the stack is the
    ** root page for the new table (or a 0 if this is a view).
    */
    sqlite3NestedParse(pParse,
      "UPDATE %Q.%s "
         "SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q "
       "WHERE rowid=#%d",
      db->aDb[iDb].zName, SCHEMA_TABLE(iDb),
      zType,
      p->zName,
      p->zName,
      pParse->regRoot,
      zStmt,
      pParse->regRowid
    );
    sqlite3DbFree(db, zStmt);
    sqlite3ChangeCookie(pParse, iDb);

#ifndef SQLITE_OMIT_AUTOINCREMENT
    /* Check to see if we need to create an sqlite_sequence table for
    ** keeping track of autoincrement keys.
    */
    if( p->autoInc ){
      Db *pDb = &db->aDb[iDb];
      if( pDb->pSchema->pSeqTab==0 ){
        sqlite3NestedParse(pParse,
          "CREATE TABLE %Q.sqlite_sequence(name,seq)",
          pDb->zName
        );
      }
    }
#endif

    /* Reparse everything to update our internal data structures */
    sqlite3VdbeAddOp4(v, OP_ParseSchema, iDb, 0, 0,
        sqlite3MPrintf(db, "tbl_name='%q'",p->zName), P4_DYNAMIC);
  }


  /* Add the table to the in-memory representation of the database.
  */
  if( db->init.busy && pParse->nErr==0 ){
    Table *pOld;
    FKey *pFKey; 
    Schema *pSchema = p->pSchema;
    pOld = sqlite3HashInsert(&pSchema->tblHash, p->zName, strlen(p->zName)+1,p);
    if( pOld ){
      assert( p==pOld );  /* Malloc must have failed inside HashInsert() */
      db->mallocFailed = 1;
      return;
    }
#ifndef SQLITE_OMIT_FOREIGN_KEY
    for(pFKey=p->pFKey; pFKey; pFKey=pFKey->pNextFrom){
      void *data;
      int nTo = strlen(pFKey->zTo) + 1;
      pFKey->pNextTo = sqlite3HashFind(&pSchema->aFKey, pFKey->zTo, nTo);
      data = sqlite3HashInsert(&pSchema->aFKey, pFKey->zTo, nTo, pFKey);
      if( data==(void *)pFKey ){
        db->mallocFailed = 1;
      }
    }
#endif
    pParse->pNewTable = 0;
    db->nTable++;
    db->flags |= SQLITE_InternChanges;

#ifndef SQLITE_OMIT_ALTERTABLE
    if( !p->pSelect ){
      const char *zName = (const char *)pParse->sNameToken.z;
      int nName;
      assert( !pSelect && pCons && pEnd );
      if( pCons->z==0 ){
        pCons = pEnd;
      }
      nName = (const char *)pCons->z - zName;
      p->addColOffset = 13 + sqlite3Utf8CharLen(zName, nName);
    }
#endif
  }
}

#ifndef SQLITE_OMIT_VIEW
/*
** The parser calls this routine in order to create a new VIEW
*/
void sqlite3CreateView(
  Parse *pParse,     /* The parsing context */
  Token *pBegin,     /* The CREATE token that begins the statement */
  Token *pName1,     /* The token that holds the name of the view */
  Token *pName2,     /* The token that holds the name of the view */
  Select *pSelect,   /* A SELECT statement that will become the new view */
  int isTemp,        /* TRUE for a TEMPORARY view */
  int noErr          /* Suppress error messages if VIEW already exists */
){
  Table *p;
  int n;
  const unsigned char *z;
  Token sEnd;
  DbFixer sFix;
  Token *pName;
  int iDb;
  sqlite3 *db = pParse->db;

  if( pParse->nVar>0 ){
    sqlite3ErrorMsg(pParse, "parameters are not allowed in views");
    sqlite3SelectDelete(db, pSelect);
    return;
  }
  sqlite3StartTable(pParse, pName1, pName2, isTemp, 1, 0, noErr);
  p = pParse->pNewTable;
  if( p==0 || pParse->nErr ){
    sqlite3SelectDelete(db, pSelect);
    return;
  }
  sqlite3TwoPartName(pParse, pName1, pName2, &pName);
  iDb = sqlite3SchemaToIndex(db, p->pSchema);
  if( sqlite3FixInit(&sFix, pParse, iDb, "view", pName)
    && sqlite3FixSelect(&sFix, pSelect)
  ){
    sqlite3SelectDelete(db, pSelect);
    return;
  }

  /* Make a copy of the entire SELECT statement that defines the view.
  ** This will force all the Expr.token.z values to be dynamically
  ** allocated rather than point to the input string - which means that
  ** they will persist after the current sqlite3_exec() call returns.
  */
  p->pSelect = sqlite3SelectDup(db, pSelect);
  sqlite3SelectDelete(db, pSelect);
  if( db->mallocFailed ){
    return;
  }
  if( !db->init.busy ){
    sqlite3ViewGetColumnNames(pParse, p);
  }

  /* Locate the end of the CREATE VIEW statement.  Make sEnd point to
  ** the end.
  */
  sEnd = pParse->sLastToken;
  if( sEnd.z[0]!=0 && sEnd.z[0]!=';' ){
    sEnd.z += sEnd.n;
  }
  sEnd.n = 0;
  n = sEnd.z - pBegin->z;
  z = (const unsigned char*)pBegin->z;
  while( n>0 && (z[n-1]==';' || isspace(z[n-1])) ){ n--; }
  sEnd.z = &z[n-1];
  sEnd.n = 1;

  /* Use sqlite3EndTable() to add the view to the SQLITE_MASTER table */
  sqlite3EndTable(pParse, 0, &sEnd, 0);
  return;
}
#endif /* SQLITE_OMIT_VIEW */

#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE)
/*
** The Table structure pTable is really a VIEW.  Fill in the names of
** the columns of the view in the pTable structure.  Return the number
** of errors.  If an error is seen leave an error message in pParse->zErrMsg.
*/
int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){
  Table *pSelTab;   /* A fake table from which we get the result set */
  Select *pSel;     /* Copy of the SELECT that implements the view */
  int nErr = 0;     /* Number of errors encountered */
  int n;            /* Temporarily holds the number of cursors assigned */
  sqlite3 *db = pParse->db;  /* Database connection for malloc errors */
  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*);

  assert( pTable );

#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( sqlite3VtabCallConnect(pParse, pTable) ){
    return SQLITE_ERROR;
  }
  if( IsVirtual(pTable) ) return 0;
#endif

#ifndef SQLITE_OMIT_VIEW
  /* A positive nCol means the columns names for this view are
  ** already known.
  */
  if( pTable->nCol>0 ) return 0;

  /* A negative nCol is a special marker meaning that we are currently
  ** trying to compute the column names.  If we enter this routine with
  ** a negative nCol, it means two or more views form a loop, like this:
  **
  **     CREATE VIEW one AS SELECT * FROM two;
  **     CREATE VIEW two AS SELECT * FROM one;
  **
  ** Actually, this error is caught previously and so the following test
  ** should always fail.  But we will leave it in place just to be safe.
  */
  if( pTable->nCol<0 ){
    sqlite3ErrorMsg(pParse, "view %s is circularly defined", pTable->zName);
    return 1;
  }
  assert( pTable->nCol>=0 );

  /* If we get this far, it means we need to compute the table names.
  ** Note that the call to sqlite3ResultSetOfSelect() will expand any
  ** "*" elements in the results set of the view and will assign cursors
  ** to the elements of the FROM clause.  But we do not want these changes
  ** to be permanent.  So the computation is done on a copy of the SELECT
  ** statement that defines the view.
  */
  assert( pTable->pSelect );
  pSel = sqlite3SelectDup(db, pTable->pSelect);
  if( pSel ){
    n = pParse->nTab;
    sqlite3SrcListAssignCursors(pParse, pSel->pSrc);
    pTable->nCol = -1;
#ifndef SQLITE_OMIT_AUTHORIZATION
    xAuth = db->xAuth;
    db->xAuth = 0;
    pSelTab = sqlite3ResultSetOfSelect(pParse, 0, pSel);
    db->xAuth = xAuth;
#else
    pSelTab = sqlite3ResultSetOfSelect(pParse, 0, pSel);
#endif
    pParse->nTab = n;
    if( pSelTab ){
      assert( pTable->aCol==0 );
      pTable->nCol = pSelTab->nCol;
      pTable->aCol = pSelTab->aCol;
      pSelTab->nCol = 0;
      pSelTab->aCol = 0;
      sqlite3DeleteTable(pSelTab);
      pTable->pSchema->flags |= DB_UnresetViews;
    }else{
      pTable->nCol = 0;
      nErr++;
    }
    sqlite3SelectDelete(db, pSel);
  } else {
    nErr++;
  }
#endif /* SQLITE_OMIT_VIEW */
  return nErr;  
}
#endif /* !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) */

#ifndef SQLITE_OMIT_VIEW
/*
** Clear the column names from every VIEW in database idx.
*/
static void sqliteViewResetAll(sqlite3 *db, int idx){
  HashElem *i;
  if( !DbHasProperty(db, idx, DB_UnresetViews) ) return;
  for(i=sqliteHashFirst(&db->aDb[idx].pSchema->tblHash); i;i=sqliteHashNext(i)){
    Table *pTab = sqliteHashData(i);
    if( pTab->pSelect ){
      sqliteResetColumnNames(pTab);
    }
  }
  DbClearProperty(db, idx, DB_UnresetViews);
}
#else
# define sqliteViewResetAll(A,B)
#endif /* SQLITE_OMIT_VIEW */

/*
** This function is called by the VDBE to adjust the internal schema
** used by SQLite when the btree layer moves a table root page. The
** root-page of a table or index in database iDb has changed from iFrom
** to iTo.
**
** Ticket #1728:  The symbol table might still contain information
** on tables and/or indices that are the process of being deleted.
** If you are unlucky, one of those deleted indices or tables might
** have the same rootpage number as the real table or index that is
** being moved.  So we cannot stop searching after the first match 
** because the first match might be for one of the deleted indices
** or tables and not the table/index that is actually being moved.
** We must continue looping until all tables and indices with
** rootpage==iFrom have been converted to have a rootpage of iTo
** in order to be certain that we got the right one.
*/
#ifndef SQLITE_OMIT_AUTOVACUUM
void sqlite3RootPageMoved(Db *pDb, int iFrom, int iTo){
  HashElem *pElem;
  Hash *pHash;

  pHash = &pDb->pSchema->tblHash;
  for(pElem=sqliteHashFirst(pHash); pElem; pElem=sqliteHashNext(pElem)){
    Table *pTab = sqliteHashData(pElem);
    if( pTab->tnum==iFrom ){
      pTab->tnum = iTo;
    }
  }
  pHash = &pDb->pSchema->idxHash;
  for(pElem=sqliteHashFirst(pHash); pElem; pElem=sqliteHashNext(pElem)){
    Index *pIdx = sqliteHashData(pElem);
    if( pIdx->tnum==iFrom ){
      pIdx->tnum = iTo;
    }
  }
}
#endif

/*
** Write code to erase the table with root-page iTable from database iDb.
** Also write code to modify the sqlite_master table and internal schema
** if a root-page of another table is moved by the btree-layer whilst
** erasing iTable (this can happen with an auto-vacuum database).
*/ 
static void destroyRootPage(Parse *pParse, int iTable, int iDb){
  Vdbe *v = sqlite3GetVdbe(pParse);
  int r1 = sqlite3GetTempReg(pParse);
  sqlite3VdbeAddOp3(v, OP_Destroy, iTable, r1, iDb);
#ifndef SQLITE_OMIT_AUTOVACUUM
  /* OP_Destroy stores an in integer r1. If this integer
  ** is non-zero, then it is the root page number of a table moved to
  ** location iTable. The following code modifies the sqlite_master table to
  ** reflect this.
  **
  ** The "#%d" in the SQL is a special constant that means whatever value
  ** is on the top of the stack.  See sqlite3RegisterExpr().
  */
  sqlite3NestedParse(pParse, 
     "UPDATE %Q.%s SET rootpage=%d WHERE #%d AND rootpage=#%d",
     pParse->db->aDb[iDb].zName, SCHEMA_TABLE(iDb), iTable, r1, r1);
#endif
  sqlite3ReleaseTempReg(pParse, r1);
}

/*
** Write VDBE code to erase table pTab and all associated indices on disk.
** Code to update the sqlite_master tables and internal schema definitions
** in case a root-page belonging to another table is moved by the btree layer
** is also added (this can happen with an auto-vacuum database).
*/
static void destroyTable(Parse *pParse, Table *pTab){
#ifdef SQLITE_OMIT_AUTOVACUUM
  Index *pIdx;
  int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
  destroyRootPage(pParse, pTab->tnum, iDb);
  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
    destroyRootPage(pParse, pIdx->tnum, iDb);
  }
#else
  /* If the database may be auto-vacuum capable (if SQLITE_OMIT_AUTOVACUUM
  ** is not defined), then it is important to call OP_Destroy on the
  ** table and index root-pages in order, starting with the numerically 
  ** largest root-page number. This guarantees that none of the root-pages
  ** to be destroyed is relocated by an earlier OP_Destroy. i.e. if the
  ** following were coded:
  **
  ** OP_Destroy 4 0
  ** ...
  ** OP_Destroy 5 0
  **
  ** and root page 5 happened to be the largest root-page number in the
  ** database, then root page 5 would be moved to page 4 by the 
  ** "OP_Destroy 4 0" opcode. The subsequent "OP_Destroy 5 0" would hit
  ** a free-list page.
  */
  int iTab = pTab->tnum;
  int iDestroyed = 0;

  while( 1 ){
    Index *pIdx;
    int iLargest = 0;

    if( iDestroyed==0 || iTab<iDestroyed ){
      iLargest = iTab;
    }
    for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
      int iIdx = pIdx->tnum;
      assert( pIdx->pSchema==pTab->pSchema );
      if( (iDestroyed==0 || (iIdx<iDestroyed)) && iIdx>iLargest ){
        iLargest = iIdx;
      }
    }
    if( iLargest==0 ){
      return;
    }else{
      int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
      destroyRootPage(pParse, iLargest, iDb);
      iDestroyed = iLargest;
    }
  }
#endif
}

/*
** This routine is called to do the work of a DROP TABLE statement.
** pName is the name of the table to be dropped.
*/
void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr){
  Table *pTab;
  Vdbe *v;
  sqlite3 *db = pParse->db;
  int iDb;

  if( pParse->nErr || db->mallocFailed ){
    goto exit_drop_table;
  }
  assert( pName->nSrc==1 );
  pTab = sqlite3LocateTable(pParse, isView, 
                            pName->a[0].zName, pName->a[0].zDatabase);

  if( pTab==0 ){
    if( noErr ){
      sqlite3ErrorClear(pParse);
    }
    goto exit_drop_table;
  }
  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
  assert( iDb>=0 && iDb<db->nDb );

  /* If pTab is a virtual table, call ViewGetColumnNames() to ensure
  ** it is initialized.
  */
  if( IsVirtual(pTab) && sqlite3ViewGetColumnNames(pParse, pTab) ){
    goto exit_drop_table;
  }
#ifndef SQLITE_OMIT_AUTHORIZATION
  {
    int code;
    const char *zTab = SCHEMA_TABLE(iDb);
    const char *zDb = db->aDb[iDb].zName;
    const char *zArg2 = 0;
    if( sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb)){
      goto exit_drop_table;
    }
    if( isView ){
      if( !OMIT_TEMPDB && iDb==1 ){
        code = SQLITE_DROP_TEMP_VIEW;
      }else{
        code = SQLITE_DROP_VIEW;
      }
#ifndef SQLITE_OMIT_VIRTUALTABLE
    }else if( IsVirtual(pTab) ){
      code = SQLITE_DROP_VTABLE;
      zArg2 = pTab->pMod->zName;
#endif
    }else{
      if( !OMIT_TEMPDB && iDb==1 ){
        code = SQLITE_DROP_TEMP_TABLE;
      }else{
        code = SQLITE_DROP_TABLE;
      }
    }
    if( sqlite3AuthCheck(pParse, code, pTab->zName, zArg2, zDb) ){
      goto exit_drop_table;
    }
    if( sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb) ){
      goto exit_drop_table;
    }
  }
#endif
  if( pTab->readOnly || pTab==db->aDb[iDb].pSchema->pSeqTab ){
    sqlite3ErrorMsg(pParse, "table %s may not be dropped", pTab->zName);
    goto exit_drop_table;
  }

#ifndef SQLITE_OMIT_VIEW
  /* Ensure DROP TABLE is not used on a view, and DROP VIEW is not used
  ** on a table.
  */
  if( isView && pTab->pSelect==0 ){
    sqlite3ErrorMsg(pParse, "use DROP TABLE to delete table %s", pTab->zName);
    goto exit_drop_table;
  }
  if( !isView && pTab->pSelect ){
    sqlite3ErrorMsg(pParse, "use DROP VIEW to delete view %s", pTab->zName);
    goto exit_drop_table;
  }
#endif

  /* Generate code to remove the table from the master table
  ** on disk.
  */
  v = sqlite3GetVdbe(pParse);
  if( v ){
    Trigger *pTrigger;
    Db *pDb = &db->aDb[iDb];
    sqlite3BeginWriteOperation(pParse, 1, iDb);

#ifndef SQLITE_OMIT_VIRTUALTABLE
    if( IsVirtual(pTab) ){
      Vdbe *v = sqlite3GetVdbe(pParse);
      if( v ){
        sqlite3VdbeAddOp0(v, OP_VBegin);
      }
    }
#endif

    /* Drop all triggers associated with the table being dropped. Code
    ** is generated to remove entries from sqlite_master and/or
    ** sqlite_temp_master if required.
    */
    pTrigger = pTab->pTrigger;
    while( pTrigger ){
      assert( pTrigger->pSchema==pTab->pSchema || 
          pTrigger->pSchema==db->aDb[1].pSchema );
      sqlite3DropTriggerPtr(pParse, pTrigger);
      pTrigger = pTrigger->pNext;
    }

#ifndef SQLITE_OMIT_AUTOINCREMENT
    /* Remove any entries of the sqlite_sequence table associated with
    ** the table being dropped. This is done before the table is dropped
    ** at the btree level, in case the sqlite_sequence table needs to
    ** move as a result of the drop (can happen in auto-vacuum mode).
    */
    if( pTab->autoInc ){
      sqlite3NestedParse(pParse,
        "DELETE FROM %s.sqlite_sequence WHERE name=%Q",
        pDb->zName, pTab->zName
      );
    }
#endif

    /* Drop all SQLITE_MASTER table and index entries that refer to the
    ** table. The program name loops through the master table and deletes
    ** every row that refers to a table of the same name as the one being
    ** dropped. Triggers are handled seperately because a trigger can be
    ** created in the temp database that refers to a table in another
    ** database.
    */
    sqlite3NestedParse(pParse, 
        "DELETE FROM %Q.%s WHERE tbl_name=%Q and type!='trigger'",
        pDb->zName, SCHEMA_TABLE(iDb), pTab->zName);

    /* Drop any statistics from the sqlite_stat1 table, if it exists */
    if( sqlite3FindTable(db, "sqlite_stat1", db->aDb[iDb].zName) ){
      sqlite3NestedParse(pParse,
        "DELETE FROM %Q.sqlite_stat1 WHERE tbl=%Q", pDb->zName, pTab->zName
      );
    }

    if( !isView && !IsVirtual(pTab) ){
      destroyTable(pParse, pTab);
    }

    /* Remove the table entry from SQLite's internal schema and modify
    ** the schema cookie.
    */
    if( IsVirtual(pTab) ){
      sqlite3VdbeAddOp4(v, OP_VDestroy, iDb, 0, 0, pTab->zName, 0);
    }
    sqlite3VdbeAddOp4(v, OP_DropTable, iDb, 0, 0, pTab->zName, 0);
    sqlite3ChangeCookie(pParse, iDb);
  }
  sqliteViewResetAll(db, iDb);

exit_drop_table:
  sqlite3SrcListDelete(db, pName);
}

/*
** This routine is called to create a new foreign key on the table
** currently under construction.  pFromCol determines which columns
** in the current table point to the foreign key.  If pFromCol==0 then
** connect the key to the last column inserted.  pTo is the name of
** the table referred to.  pToCol is a list of tables in the other
** pTo table that the foreign key points to.  flags contains all
** information about the conflict resolution algorithms specified
** in the ON DELETE, ON UPDATE and ON INSERT clauses.
**
** An FKey structure is created and added to the table currently
** under construction in the pParse->pNewTable field.  The new FKey
** is not linked into db->aFKey at this point - that does not happen
** until sqlite3EndTable().
**
** The foreign key is set for IMMEDIATE processing.  A subsequent call
** to sqlite3DeferForeignKey() might change this to DEFERRED.
*/
void sqlite3CreateForeignKey(
  Parse *pParse,       /* Parsing context */
  ExprList *pFromCol,  /* Columns in this table that point to other table */
  Token *pTo,          /* Name of the other table */
  ExprList *pToCol,    /* Columns in the other table */
  int flags            /* Conflict resolution algorithms. */
){
#ifndef SQLITE_OMIT_FOREIGN_KEY
  FKey *pFKey = 0;
  Table *p = pParse->pNewTable;
  int nByte;
  int i;
  int nCol;
  char *z;
  sqlite3 *db;

  assert( pTo!=0 );
  db = pParse->db;
  if( p==0 || pParse->nErr || IN_DECLARE_VTAB ) goto fk_end;
  if( pFromCol==0 ){
    int iCol = p->nCol-1;
    if( iCol<0 ) goto fk_end;
    if( pToCol && pToCol->nExpr!=1 ){
      sqlite3ErrorMsg(pParse, "foreign key on %s"
         " should reference only one column of table %T",
         p->aCol[iCol].zName, pTo);
      goto fk_end;
    }
    nCol = 1;
  }else if( pToCol && pToCol->nExpr!=pFromCol->nExpr ){
    sqlite3ErrorMsg(pParse,
        "number of columns in foreign key does not match the number of "
        "columns in the referenced table");
    goto fk_end;
  }else{
    nCol = pFromCol->nExpr;
  }
  nByte = sizeof(*pFKey) + nCol*sizeof(pFKey->aCol[0]) + pTo->n + 1;
  if( pToCol ){
    for(i=0; i<pToCol->nExpr; i++){
      nByte += strlen(pToCol->a[i].zName) + 1;
    }
  }
  pFKey = sqlite3DbMallocZero(db, nByte );
  if( pFKey==0 ){
    goto fk_end;
  }
  pFKey->pFrom = p;
  pFKey->pNextFrom = p->pFKey;
  z = (char*)&pFKey[1];
  pFKey->aCol = (struct sColMap*)z;
  z += sizeof(struct sColMap)*nCol;
  pFKey->zTo = z;
  memcpy(z, pTo->z, pTo->n);
  z[pTo->n] = 0;
  z += pTo->n+1;
  pFKey->pNextTo = 0;
  pFKey->nCol = nCol;
  if( pFromCol==0 ){
    pFKey->aCol[0].iFrom = p->nCol-1;
  }else{
    for(i=0; i<nCol; i++){
      int j;
      for(j=0; j<p->nCol; j++){
        if( sqlite3StrICmp(p->aCol[j].zName, pFromCol->a[i].zName)==0 ){
          pFKey->aCol[i].iFrom = j;
          break;
        }
      }
      if( j>=p->nCol ){
        sqlite3ErrorMsg(pParse, 
          "unknown column \"%s\" in foreign key definition", 
          pFromCol->a[i].zName);
        goto fk_end;
      }
    }
  }
  if( pToCol ){
    for(i=0; i<nCol; i++){
      int n = strlen(pToCol->a[i].zName);
      pFKey->aCol[i].zCol = z;
      memcpy(z, pToCol->a[i].zName, n);
      z[n] = 0;
      z += n+1;
    }
  }
  pFKey->isDeferred = 0;
  pFKey->deleteConf = flags & 0xff;
  pFKey->updateConf = (flags >> 8 ) & 0xff;
  pFKey->insertConf = (flags >> 16 ) & 0xff;

  /* Link the foreign key to the table as the last step.
  */
  p->pFKey = pFKey;
  pFKey = 0;

fk_end:
  sqlite3DbFree(db, pFKey);
#endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */
  sqlite3ExprListDelete(db, pFromCol);
  sqlite3ExprListDelete(db, pToCol);
}

/*
** This routine is called when an INITIALLY IMMEDIATE or INITIALLY DEFERRED
** clause is seen as part of a foreign key definition.  The isDeferred
** parameter is 1 for INITIALLY DEFERRED and 0 for INITIALLY IMMEDIATE.
** The behavior of the most recently created foreign key is adjusted
** accordingly.
*/
void sqlite3DeferForeignKey(Parse *pParse, int isDeferred){
#ifndef SQLITE_OMIT_FOREIGN_KEY
  Table *pTab;
  FKey *pFKey;
  if( (pTab = pParse->pNewTable)==0 || (pFKey = pTab->pFKey)==0 ) return;
  pFKey->isDeferred = isDeferred;
#endif
}

/*
** Generate code that will erase and refill index *pIdx.  This is
** used to initialize a newly created index or to recompute the
** content of an index in response to a REINDEX command.
**
** if memRootPage is not negative, it means that the index is newly
** created.  The register specified by memRootPage contains the
** root page number of the index.  If memRootPage is negative, then
** the index already exists and must be cleared before being refilled and
** the root page number of the index is taken from pIndex->tnum.
*/
static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){
  Table *pTab = pIndex->pTable;  /* The table that is indexed */
  int iTab = pParse->nTab;       /* Btree cursor used for pTab */
  int iIdx = pParse->nTab+1;     /* Btree cursor used for pIndex */
  int addr1;                     /* Address of top of loop */
  int tnum;                      /* Root page of index */
  Vdbe *v;                       /* Generate code into this virtual machine */
  KeyInfo *pKey;                 /* KeyInfo for index */
  int regIdxKey;                 /* Registers containing the index key */
  int regRecord;                 /* Register holding assemblied index record */
  sqlite3 *db = pParse->db;      /* The database connection */
  int iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);

#ifndef SQLITE_OMIT_AUTHORIZATION
  if( sqlite3AuthCheck(pParse, SQLITE_REINDEX, pIndex->zName, 0,
      db->aDb[iDb].zName ) ){
    return;
  }
#endif

  /* Require a write-lock on the table to perform this operation */
  sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName);

  v = sqlite3GetVdbe(pParse);
  if( v==0 ) return;
  if( memRootPage>=0 ){
    tnum = memRootPage;
  }else{
    tnum = pIndex->tnum;
    sqlite3VdbeAddOp2(v, OP_Clear, tnum, iDb);
  }
  pKey = sqlite3IndexKeyinfo(pParse, pIndex);
  sqlite3VdbeAddOp4(v, OP_OpenWrite, iIdx, tnum, iDb, 
                    (char *)pKey, P4_KEYINFO_HANDOFF);
  if( memRootPage>=0 ){
    sqlite3VdbeChangeP5(v, 1);
  }
  sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead);
  addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iTab, 0);
  regRecord = sqlite3GetTempReg(pParse);
  regIdxKey = sqlite3GenerateIndexKey(pParse, pIndex, iTab, regRecord, 1);
  if( pIndex->onError!=OE_None ){
    int j1, j2;
    int regRowid;

    regRowid = regIdxKey + pIndex->nColumn;
    j1 = sqlite3VdbeAddOp3(v, OP_IsNull, regIdxKey, 0, pIndex->nColumn);
    j2 = sqlite3VdbeAddOp4(v, OP_IsUnique, iIdx,
                           0, regRowid, SQLITE_INT_TO_PTR(regRecord), P4_INT32);
    sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CONSTRAINT, OE_Abort, 0,
                    "indexed columns are not unique", P4_STATIC);
    sqlite3VdbeJumpHere(v, j1);
    sqlite3VdbeJumpHere(v, j2);
  }
  sqlite3VdbeAddOp2(v, OP_IdxInsert, iIdx, regRecord);
  sqlite3ReleaseTempReg(pParse, regRecord);
  sqlite3VdbeAddOp2(v, OP_Next, iTab, addr1+1);
  sqlite3VdbeJumpHere(v, addr1);
  sqlite3VdbeAddOp1(v, OP_Close, iTab);
  sqlite3VdbeAddOp1(v, OP_Close, iIdx);
}

/*
** Create a new index for an SQL table.  pName1.pName2 is the name of the index 
** and pTblList is the name of the table that is to be indexed.  Both will 
** be NULL for a primary key or an index that is created to satisfy a
** UNIQUE constraint.  If pTable and pIndex are NULL, use pParse->pNewTable
** as the table to be indexed.  pParse->pNewTable is a table that is
** currently being constructed by a CREATE TABLE statement.
**
** pList is a list of columns to be indexed.  pList will be NULL if this
** is a primary key or unique-constraint on the most recent column added
** to the table currently under construction.  
*/
void sqlite3CreateIndex(
  Parse *pParse,     /* All information about this parse */
  Token *pName1,     /* First part of index name. May be NULL */
  Token *pName2,     /* Second part of index name. May be NULL */
  SrcList *pTblName, /* Table to index. Use pParse->pNewTable if 0 */
  ExprList *pList,   /* A list of columns to be indexed */
  int onError,       /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */
  Token *pStart,     /* The CREATE token that begins this statement */
  Token *pEnd,       /* The ")" that closes the CREATE INDEX statement */
  int sortOrder,     /* Sort order of primary key when pList==NULL */
  int ifNotExist     /* Omit error if index already exists */
){
  Table *pTab = 0;     /* Table to be indexed */
  Index *pIndex = 0;   /* The index to be created */
  char *zName = 0;     /* Name of the index */
  int nName;           /* Number of characters in zName */
  int i, j;
  Token nullId;        /* Fake token for an empty ID list */
  DbFixer sFix;        /* For assigning database names to pTable */
  int sortOrderMask;   /* 1 to honor DESC in index.  0 to ignore. */
  sqlite3 *db = pParse->db;
  Db *pDb;             /* The specific table containing the indexed database */
  int iDb;             /* Index of the database that is being written */
  Token *pName = 0;    /* Unqualified name of the index to create */
  struct ExprList_item *pListItem; /* For looping over pList */
  int nCol;
  int nExtra = 0;
  char *zExtra;

  if( pParse->nErr || db->mallocFailed || IN_DECLARE_VTAB ){
    goto exit_create_index;
  }

  /*
  ** Find the table that is to be indexed.  Return early if not found.
  */
  if( pTblName!=0 ){

    /* Use the two-part index name to determine the database 
    ** to search for the table. 'Fix' the table name to this db
    ** before looking up the table.
    */
    assert( pName1 && pName2 );
    iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName);
    if( iDb<0 ) goto exit_create_index;

#ifndef SQLITE_OMIT_TEMPDB
    /* If the index name was unqualified, check if the the table
    ** is a temp table. If so, set the database to 1. Do not do this
    ** if initialising a database schema.
    */
    if( !db->init.busy ){
      pTab = sqlite3SrcListLookup(pParse, pTblName);
      if( pName2 && pName2->n==0 && pTab && pTab->pSchema==db->aDb[1].pSchema ){
        iDb = 1;
      }
    }
#endif

    if( sqlite3FixInit(&sFix, pParse, iDb, "index", pName) &&
        sqlite3FixSrcList(&sFix, pTblName)
    ){
      /* Because the parser constructs pTblName from a single identifier,
      ** sqlite3FixSrcList can never fail. */
      assert(0);
    }
    pTab = sqlite3LocateTable(pParse, 0, pTblName->a[0].zName, 
        pTblName->a[0].zDatabase);
    if( !pTab ) goto exit_create_index;
    assert( db->aDb[iDb].pSchema==pTab->pSchema );
  }else{
    assert( pName==0 );
    pTab = pParse->pNewTable;
    if( !pTab ) goto exit_create_index;
    iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
  }
  pDb = &db->aDb[iDb];

  if( pTab==0 || pParse->nErr ) goto exit_create_index;
  if( pTab->readOnly ){
    sqlite3ErrorMsg(pParse, "table %s may not be indexed", pTab->zName);
    goto exit_create_index;
  }
#ifndef SQLITE_OMIT_VIEW
  if( pTab->pSelect ){
    sqlite3ErrorMsg(pParse, "views may not be indexed");
    goto exit_create_index;
  }
#endif
#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( IsVirtual(pTab) ){
    sqlite3ErrorMsg(pParse, "virtual tables may not be indexed");
    goto exit_create_index;
  }
#endif

  /*
  ** Find the name of the index.  Make sure there is not already another
  ** index or table with the same name.  
  **
  ** Exception:  If we are reading the names of permanent indices from the
  ** sqlite_master table (because some other process changed the schema) and
  ** one of the index names collides with the name of a temporary table or
  ** index, then we will continue to process this index.
  **
  ** If pName==0 it means that we are
  ** dealing with a primary key or UNIQUE constraint.  We have to invent our
  ** own name.
  */
  if( pName ){
    zName = sqlite3NameFromToken(db, pName);
    if( SQLITE_OK!=sqlite3ReadSchema(pParse) ) goto exit_create_index;
    if( zName==0 ) goto exit_create_index;
    if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){
      goto exit_create_index;
    }
    if( !db->init.busy ){
      if( SQLITE_OK!=sqlite3ReadSchema(pParse) ) goto exit_create_index;
      if( sqlite3FindTable(db, zName, 0)!=0 ){
        sqlite3ErrorMsg(pParse, "there is already a table named %s", zName);
        goto exit_create_index;
      }
    }
    if( sqlite3FindIndex(db, zName, pDb->zName)!=0 ){
      if( !ifNotExist ){
        sqlite3ErrorMsg(pParse, "index %s already exists", zName);
      }
      goto exit_create_index;
    }
  }else{
    int n;
    Index *pLoop;
    for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){}
    zName = sqlite3MPrintf(db, "sqlite_autoindex_%s_%d", pTab->zName, n);
    if( zName==0 ){
      goto exit_create_index;
    }
  }

  /* Check for authorization to create an index.
  */
#ifndef SQLITE_OMIT_AUTHORIZATION
  {
    const char *zDb = pDb->zName;
    if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iDb), 0, zDb) ){
      goto exit_create_index;
    }
    i = SQLITE_CREATE_INDEX;
    if( !OMIT_TEMPDB && iDb==1 ) i = SQLITE_CREATE_TEMP_INDEX;
    if( sqlite3AuthCheck(pParse, i, zName, pTab->zName, zDb) ){
      goto exit_create_index;
    }
  }
#endif

  /* If pList==0, it means this routine was called to make a primary
  ** key out of the last column added to the table under construction.
  ** So create a fake list to simulate this.
  */
  if( pList==0 ){
    nullId.z = (u8*)pTab->aCol[pTab->nCol-1].zName;
    nullId.n = strlen((char*)nullId.z);
    pList = sqlite3ExprListAppend(pParse, 0, 0, &nullId);
    if( pList==0 ) goto exit_create_index;
    pList->a[0].sortOrder = sortOrder;
  }

  /* Figure out how many bytes of space are required to store explicitly
  ** specified collation sequence names.
  */
  for(i=0; i<pList->nExpr; i++){
    Expr *pExpr = pList->a[i].pExpr;
    if( pExpr ){
      nExtra += (1 + strlen(pExpr->pColl->zName));
    }
  }

  /* 
  ** Allocate the index structure. 
  */
  nName = strlen(zName);
  nCol = pList->nExpr;
  pIndex = sqlite3DbMallocZero(db, 
      sizeof(Index) +              /* Index structure  */
      sizeof(int)*nCol +           /* Index.aiColumn   */
      sizeof(int)*(nCol+1) +       /* Index.aiRowEst   */
      sizeof(char *)*nCol +        /* Index.azColl     */
      sizeof(u8)*nCol +            /* Index.aSortOrder */
      nName + 1 +                  /* Index.zName      */
      nExtra                       /* Collation sequence names */
  );
  if( db->mallocFailed ){
    goto exit_create_index;
  }
  pIndex->azColl = (char**)(&pIndex[1]);
  pIndex->aiColumn = (int *)(&pIndex->azColl[nCol]);
  pIndex->aiRowEst = (unsigned *)(&pIndex->aiColumn[nCol]);
  pIndex->aSortOrder = (u8 *)(&pIndex->aiRowEst[nCol+1]);
  pIndex->zName = (char *)(&pIndex->aSortOrder[nCol]);
  zExtra = (char *)(&pIndex->zName[nName+1]);
  memcpy(pIndex->zName, zName, nName+1);
  pIndex->pTable = pTab;
  pIndex->nColumn = pList->nExpr;
  pIndex->onError = onError;
  pIndex->autoIndex = pName==0;
  pIndex->pSchema = db->aDb[iDb].pSchema;

  /* Check to see if we should honor DESC requests on index columns
  */
  if( pDb->pSchema->file_format>=4 ){
    sortOrderMask = -1;   /* Honor DESC */
  }else{
    sortOrderMask = 0;    /* Ignore DESC */
  }

  /* Scan the names of the columns of the table to be indexed and
  ** load the column indices into the Index structure.  Report an error
  ** if any column is not found.
  */
  for(i=0, pListItem=pList->a; i<pList->nExpr; i++, pListItem++){
    const char *zColName = pListItem->zName;
    Column *pTabCol;
    int requestedSortOrder;
    char *zColl;                   /* Collation sequence name */

    for(j=0, pTabCol=pTab->aCol; j<pTab->nCol; j++, pTabCol++){
      if( sqlite3StrICmp(zColName, pTabCol->zName)==0 ) break;
    }
    if( j>=pTab->nCol ){
      sqlite3ErrorMsg(pParse, "table %s has no column named %s",
        pTab->zName, zColName);
      goto exit_create_index;
    }
    /* TODO:  Add a test to make sure that the same column is not named
    ** more than once within the same index.  Only the first instance of
    ** the column will ever be used by the optimizer.  Note that using the
    ** same column more than once cannot be an error because that would 
    ** break backwards compatibility - it needs to be a warning.
    */
    pIndex->aiColumn[i] = j;
    if( pListItem->pExpr ){
      assert( pListItem->pExpr->pColl );
      zColl = zExtra;
      sqlite3_snprintf(nExtra, zExtra, "%s", pListItem->pExpr->pColl->zName);
      zExtra += (strlen(zColl) + 1);
    }else{
      zColl = pTab->aCol[j].zColl;
      if( !zColl ){
        zColl = db->pDfltColl->zName;
      }
    }
    if( !db->init.busy && !sqlite3LocateCollSeq(pParse, zColl, -1) ){
      goto exit_create_index;
    }
    pIndex->azColl[i] = zColl;
    requestedSortOrder = pListItem->sortOrder & sortOrderMask;
    pIndex->aSortOrder[i] = requestedSortOrder;
  }
  sqlite3DefaultRowEst(pIndex);

  if( pTab==pParse->pNewTable ){
    /* This routine has been called to create an automatic index as a
    ** result of a PRIMARY KEY or UNIQUE clause on a column definition, or
    ** a PRIMARY KEY or UNIQUE clause following the column definitions.
    ** i.e. one of:
    **
    ** CREATE TABLE t(x PRIMARY KEY, y);
    ** CREATE TABLE t(x, y, UNIQUE(x, y));
    **
    ** Either way, check to see if the table already has such an index. If
    ** so, don't bother creating this one. This only applies to
    ** automatically created indices. Users can do as they wish with
    ** explicit indices.
    */
    Index *pIdx;
    for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
      int k;
      assert( pIdx->onError!=OE_None );
      assert( pIdx->autoIndex );
      assert( pIndex->onError!=OE_None );

      if( pIdx->nColumn!=pIndex->nColumn ) continue;
      for(k=0; k<pIdx->nColumn; k++){
        const char *z1 = pIdx->azColl[k];
        const char *z2 = pIndex->azColl[k];
        if( pIdx->aiColumn[k]!=pIndex->aiColumn[k] ) break;
        if( pIdx->aSortOrder[k]!=pIndex->aSortOrder[k] ) break;
        if( z1!=z2 && sqlite3StrICmp(z1, z2) ) break;
      }
      if( k==pIdx->nColumn ){
        if( pIdx->onError!=pIndex->onError ){
          /* This constraint creates the same index as a previous
          ** constraint specified somewhere in the CREATE TABLE statement.
          ** However the ON CONFLICT clauses are different. If both this 
          ** constraint and the previous equivalent constraint have explicit
          ** ON CONFLICT clauses this is an error. Otherwise, use the
          ** explicitly specified behaviour for the index.
          */
          if( !(pIdx->onError==OE_Default || pIndex->onError==OE_Default) ){
            sqlite3ErrorMsg(pParse, 
                "conflicting ON CONFLICT clauses specified", 0);
          }
          if( pIdx->onError==OE_Default ){
            pIdx->onError = pIndex->onError;
          }
        }
        goto exit_create_index;
      }
    }
  }

  /* Link the new Index structure to its table and to the other
  ** in-memory database structures. 
  */
  if( db->init.busy ){
    Index *p;
    p = sqlite3HashInsert(&pIndex->pSchema->idxHash, 
                         pIndex->zName, strlen(pIndex->zName)+1, pIndex);
    if( p ){
      assert( p==pIndex );  /* Malloc must have failed */
      db->mallocFailed = 1;
      goto exit_create_index;
    }
    db->flags |= SQLITE_InternChanges;
    if( pTblName!=0 ){
      pIndex->tnum = db->init.newTnum;
    }
  }

  /* If the db->init.busy is 0 then create the index on disk.  This
  ** involves writing the index into the master table and filling in the
  ** index with the current table contents.
  **
  ** The db->init.busy is 0 when the user first enters a CREATE INDEX 
  ** command.  db->init.busy is 1 when a database is opened and 
  ** CREATE INDEX statements are read out of the master table.  In
  ** the latter case the index already exists on disk, which is why
  ** we don't want to recreate it.
  **
  ** If pTblName==0 it means this index is generated as a primary key
  ** or UNIQUE constraint of a CREATE TABLE statement.  Since the table
  ** has just been created, it contains no data and the index initialization
  ** step can be skipped.
  */
  else if( db->init.busy==0 ){
    Vdbe *v;
    char *zStmt;
    int iMem = ++pParse->nMem;

    v = sqlite3GetVdbe(pParse);
    if( v==0 ) goto exit_create_index;


    /* Create the rootpage for the index
    */
    sqlite3BeginWriteOperation(pParse, 1, iDb);
    sqlite3VdbeAddOp2(v, OP_CreateIndex, iDb, iMem);

    /* Gather the complete text of the CREATE INDEX statement into
    ** the zStmt variable
    */
    if( pStart && pEnd ){
      /* A named index with an explicit CREATE INDEX statement */
      zStmt = sqlite3MPrintf(db, "CREATE%s INDEX %.*s",
        onError==OE_None ? "" : " UNIQUE",
        pEnd->z - pName->z + 1,
        pName->z);
    }else{
      /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */
      /* zStmt = sqlite3MPrintf(""); */
      zStmt = 0;
    }

    /* Add an entry in sqlite_master for this index
    */
    sqlite3NestedParse(pParse, 
        "INSERT INTO %Q.%s VALUES('index',%Q,%Q,#%d,%Q);",
        db->aDb[iDb].zName, SCHEMA_TABLE(iDb),
        pIndex->zName,
        pTab->zName,
        iMem,
        zStmt
    );
    sqlite3DbFree(db, zStmt);

    /* Fill the index with data and reparse the schema. Code an OP_Expire
    ** to invalidate all pre-compiled statements.
    */
    if( pTblName ){
      sqlite3RefillIndex(pParse, pIndex, iMem);
      sqlite3ChangeCookie(pParse, iDb);
      sqlite3VdbeAddOp4(v, OP_ParseSchema, iDb, 0, 0,
         sqlite3MPrintf(db, "name='%q'", pIndex->zName), P4_DYNAMIC);
      sqlite3VdbeAddOp1(v, OP_Expire, 0);
    }
  }

  /* When adding an index to the list of indices for a table, make
  ** sure all indices labeled OE_Replace come after all those labeled
  ** OE_Ignore.  This is necessary for the correct operation of UPDATE
  ** and INSERT.
  */
  if( db->init.busy || pTblName==0 ){
    if( onError!=OE_Replace || pTab->pIndex==0
         || pTab->pIndex->onError==OE_Replace){
      pIndex->pNext = pTab->pIndex;
      pTab->pIndex = pIndex;
    }else{
      Index *pOther = pTab->pIndex;
      while( pOther->pNext && pOther->pNext->onError!=OE_Replace ){
        pOther = pOther->pNext;
      }
      pIndex->pNext = pOther->pNext;
      pOther->pNext = pIndex;
    }
    pIndex = 0;
  }

  /* Clean up before exiting */
exit_create_index:
  if( pIndex ){
    freeIndex(pIndex);
  }
  sqlite3ExprListDelete(db, pList);
  sqlite3SrcListDelete(db, pTblName);
  sqlite3DbFree(db, zName);
  return;
}

/*
** Generate code to make sure the file format number is at least minFormat.
** The generated code will increase the file format number if necessary.
*/
void sqlite3MinimumFileFormat(Parse *pParse, int iDb, int minFormat){
  Vdbe *v;
  v = sqlite3GetVdbe(pParse);
  if( v ){
    int r1 = sqlite3GetTempReg(pParse);
    int r2 = sqlite3GetTempReg(pParse);
    int j1;
    sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, r1, 1);
    sqlite3VdbeUsesBtree(v, iDb);
    sqlite3VdbeAddOp2(v, OP_Integer, minFormat, r2);
    j1 = sqlite3VdbeAddOp3(v, OP_Ge, r2, 0, r1);
    sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, 1, r2);
    sqlite3VdbeJumpHere(v, j1);
    sqlite3ReleaseTempReg(pParse, r1);
    sqlite3ReleaseTempReg(pParse, r2);
  }
}

/*
** Fill the Index.aiRowEst[] array with default information - information
** to be used when we have not run the ANALYZE command.
**
** aiRowEst[0] is suppose to contain the number of elements in the index.
** Since we do not know, guess 1 million.  aiRowEst[1] is an estimate of the
** number of rows in the table that match any particular value of the
** first column of the index.  aiRowEst[2] is an estimate of the number
** of rows that match any particular combiniation of the first 2 columns
** of the index.  And so forth.  It must always be the case that
*
**           aiRowEst[N]<=aiRowEst[N-1]
**           aiRowEst[N]>=1
**
** Apart from that, we have little to go on besides intuition as to
** how aiRowEst[] should be initialized.  The numbers generated here
** are based on typical values found in actual indices.
*/
void sqlite3DefaultRowEst(Index *pIdx){
  unsigned *a = pIdx->aiRowEst;
  int i;
  assert( a!=0 );
  a[0] = 1000000;
  for(i=pIdx->nColumn; i>=5; i--){
    a[i] = 5;
  }
  while( i>=1 ){
    a[i] = 11 - i;
    i--;
  }
  if( pIdx->onError!=OE_None ){
    a[pIdx->nColumn] = 1;
  }
}

/*
** This routine will drop an existing named index.  This routine
** implements the DROP INDEX statement.
*/
void sqlite3DropIndex(Parse *pParse, SrcList *pName, int ifExists){
  Index *pIndex;
  Vdbe *v;
  sqlite3 *db = pParse->db;
  int iDb;

  if( pParse->nErr || db->mallocFailed ){
    goto exit_drop_index;
  }
  assert( pName->nSrc==1 );
  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
    goto exit_drop_index;
  }
  pIndex = sqlite3FindIndex(db, pName->a[0].zName, pName->a[0].zDatabase);
  if( pIndex==0 ){
    if( !ifExists ){
      sqlite3ErrorMsg(pParse, "no such index: %S", pName, 0);
    }
    pParse->checkSchema = 1;
    goto exit_drop_index;
  }
  if( pIndex->autoIndex ){
    sqlite3ErrorMsg(pParse, "index associated with UNIQUE "
      "or PRIMARY KEY constraint cannot be dropped", 0);
    goto exit_drop_index;
  }
  iDb = sqlite3SchemaToIndex(db, pIndex->pSchema);
#ifndef SQLITE_OMIT_AUTHORIZATION
  {
    int code = SQLITE_DROP_INDEX;
    Table *pTab = pIndex->pTable;
    const char *zDb = db->aDb[iDb].zName;
    const char *zTab = SCHEMA_TABLE(iDb);
    if( sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){
      goto exit_drop_index;
    }
    if( !OMIT_TEMPDB && iDb ) code = SQLITE_DROP_TEMP_INDEX;
    if( sqlite3AuthCheck(pParse, code, pIndex->zName, pTab->zName, zDb) ){
      goto exit_drop_index;
    }
  }
#endif

  /* Generate code to remove the index and from the master table */
  v = sqlite3GetVdbe(pParse);
  if( v ){
    sqlite3BeginWriteOperation(pParse, 1, iDb);
    sqlite3NestedParse(pParse,
       "DELETE FROM %Q.%s WHERE name=%Q",
       db->aDb[iDb].zName, SCHEMA_TABLE(iDb),
       pIndex->zName
    );
    if( sqlite3FindTable(db, "sqlite_stat1", db->aDb[iDb].zName) ){
      sqlite3NestedParse(pParse,
        "DELETE FROM %Q.sqlite_stat1 WHERE idx=%Q",
        db->aDb[iDb].zName, pIndex->zName
      );
    }
    sqlite3ChangeCookie(pParse, iDb);
    destroyRootPage(pParse, pIndex->tnum, iDb);
    sqlite3VdbeAddOp4(v, OP_DropIndex, iDb, 0, 0, pIndex->zName, 0);
  }

exit_drop_index:
  sqlite3SrcListDelete(db, pName);
}

/*
** pArray is a pointer to an array of objects.  Each object in the
** array is szEntry bytes in size.  This routine allocates a new
** object on the end of the array.
**
** *pnEntry is the number of entries already in use.  *pnAlloc is
** the previously allocated size of the array.  initSize is the
** suggested initial array size allocation.
**
** The index of the new entry is returned in *pIdx.
**
** This routine returns a pointer to the array of objects.  This
** might be the same as the pArray parameter or it might be a different
** pointer if the array was resized.
*/
void *sqlite3ArrayAllocate(
  sqlite3 *db,      /* Connection to notify of malloc failures */
  void *pArray,     /* Array of objects.  Might be reallocated */
  int szEntry,      /* Size of each object in the array */
  int initSize,     /* Suggested initial allocation, in elements */
  int *pnEntry,     /* Number of objects currently in use */
  int *pnAlloc,     /* Current size of the allocation, in elements */
  int *pIdx         /* Write the index of a new slot here */
){
  char *z;
  if( *pnEntry >= *pnAlloc ){
    void *pNew;
    int newSize;
    newSize = (*pnAlloc)*2 + initSize;
    pNew = sqlite3DbRealloc(db, pArray, newSize*szEntry);
    if( pNew==0 ){
      *pIdx = -1;
      return pArray;
    }
    *pnAlloc = newSize;
    pArray = pNew;
  }
  z = (char*)pArray;
  memset(&z[*pnEntry * szEntry], 0, szEntry);
  *pIdx = *pnEntry;
  ++*pnEntry;
  return pArray;
}

/*
** Append a new element to the given IdList.  Create a new IdList if
** need be.
**
** A new IdList is returned, or NULL if malloc() fails.
*/
IdList *sqlite3IdListAppend(sqlite3 *db, IdList *pList, Token *pToken){
  int i;
  if( pList==0 ){
    pList = sqlite3DbMallocZero(db, sizeof(IdList) );
    if( pList==0 ) return 0;
    pList->nAlloc = 0;
  }
  pList->a = sqlite3ArrayAllocate(
      db,
      pList->a,
      sizeof(pList->a[0]),
      5,
      &pList->nId,
      &pList->nAlloc,
      &i
  );
  if( i<0 ){
    sqlite3IdListDelete(db, pList);
    return 0;
  }
  pList->a[i].zName = sqlite3NameFromToken(db, pToken);
  return pList;
}

/*
** Delete an IdList.
*/
void sqlite3IdListDelete(sqlite3 *db, IdList *pList){
  int i;
  if( pList==0 ) return;
  for(i=0; i<pList->nId; i++){
    sqlite3DbFree(db, pList->a[i].zName);
  }
  sqlite3DbFree(db, pList->a);
  sqlite3DbFree(db, pList);
}

/*
** Return the index in pList of the identifier named zId.  Return -1
** if not found.
*/
int sqlite3IdListIndex(IdList *pList, const char *zName){
  int i;
  if( pList==0 ) return -1;
  for(i=0; i<pList->nId; i++){
    if( sqlite3StrICmp(pList->a[i].zName, zName)==0 ) return i;
  }
  return -1;
}

/*
** Append a new table name to the given SrcList.  Create a new SrcList if
** need be.  A new entry is created in the SrcList even if pToken is NULL.
**
** A new SrcList is returned, or NULL if malloc() fails.
**
** If pDatabase is not null, it means that the table has an optional
** database name prefix.  Like this:  "database.table".  The pDatabase
** points to the table name and the pTable points to the database name.
** The SrcList.a[].zName field is filled with the table name which might
** come from pTable (if pDatabase is NULL) or from pDatabase.  
** SrcList.a[].zDatabase is filled with the database name from pTable,
** or with NULL if no database is specified.
**
** In other words, if call like this:
**
**         sqlite3SrcListAppend(D,A,B,0);
**
** Then B is a table name and the database name is unspecified.  If called
** like this:
**
**         sqlite3SrcListAppend(D,A,B,C);
**
** Then C is the table name and B is the database name.
*/
SrcList *sqlite3SrcListAppend(
  sqlite3 *db,        /* Connection to notify of malloc failures */
  SrcList *pList,     /* Append to this SrcList. NULL creates a new SrcList */
  Token *pTable,      /* Table to append */
  Token *pDatabase    /* Database of the table */
){
  struct SrcList_item *pItem;
  if( pList==0 ){
    pList = sqlite3DbMallocZero(db, sizeof(SrcList) );
    if( pList==0 ) return 0;
    pList->nAlloc = 1;
  }
  if( pList->nSrc>=pList->nAlloc ){
    SrcList *pNew;
    pList->nAlloc *= 2;
    pNew = sqlite3DbRealloc(db, pList,
               sizeof(*pList) + (pList->nAlloc-1)*sizeof(pList->a[0]) );
    if( pNew==0 ){
      sqlite3SrcListDelete(db, pList);
      return 0;
    }
    pList = pNew;
  }
  pItem = &pList->a[pList->nSrc];
  memset(pItem, 0, sizeof(pList->a[0]));
  if( pDatabase && pDatabase->z==0 ){
    pDatabase = 0;
  }
  if( pDatabase && pTable ){
    Token *pTemp = pDatabase;
    pDatabase = pTable;
    pTable = pTemp;
  }
  pItem->zName = sqlite3NameFromToken(db, pTable);
  pItem->zDatabase = sqlite3NameFromToken(db, pDatabase);
  pItem->iCursor = -1;
  pItem->isPopulated = 0;
  pList->nSrc++;
  return pList;
}

/*
** Assign cursors to all tables in a SrcList
*/
void sqlite3SrcListAssignCursors(Parse *pParse, SrcList *pList){
  int i;
  struct SrcList_item *pItem;
  assert(pList || pParse->db->mallocFailed );
  if( pList ){
    for(i=0, pItem=pList->a; i<pList->nSrc; i++, pItem++){
      if( pItem->iCursor>=0 ) break;
      pItem->iCursor = pParse->nTab++;
      if( pItem->pSelect ){
        sqlite3SrcListAssignCursors(pParse, pItem->pSelect->pSrc);
      }
    }
  }
}

/*
** Delete an entire SrcList including all its substructure.
*/
void sqlite3SrcListDelete(sqlite3 *db, SrcList *pList){
  int i;
  struct SrcList_item *pItem;
  if( pList==0 ) return;
  for(pItem=pList->a, i=0; i<pList->nSrc; i++, pItem++){
    sqlite3DbFree(db, pItem->zDatabase);
    sqlite3DbFree(db, pItem->zName);
    sqlite3DbFree(db, pItem->zAlias);
    sqlite3DeleteTable(pItem->pTab);
    sqlite3SelectDelete(db, pItem->pSelect);
    sqlite3ExprDelete(db, pItem->pOn);
    sqlite3IdListDelete(db, pItem->pUsing);
  }
  sqlite3DbFree(db, pList);
}

/*
** This routine is called by the parser to add a new term to the
** end of a growing FROM clause.  The "p" parameter is the part of
** the FROM clause that has already been constructed.  "p" is NULL
** if this is the first term of the FROM clause.  pTable and pDatabase
** are the name of the table and database named in the FROM clause term.
** pDatabase is NULL if the database name qualifier is missing - the
** usual case.  If the term has a alias, then pAlias points to the
** alias token.  If the term is a subquery, then pSubquery is the
** SELECT statement that the subquery encodes.  The pTable and
** pDatabase parameters are NULL for subqueries.  The pOn and pUsing
** parameters are the content of the ON and USING clauses.
**
** Return a new SrcList which encodes is the FROM with the new
** term added.
*/
SrcList *sqlite3SrcListAppendFromTerm(
  Parse *pParse,          /* Parsing context */
  SrcList *p,             /* The left part of the FROM clause already seen */
  Token *pTable,          /* Name of the table to add to the FROM clause */
  Token *pDatabase,       /* Name of the database containing pTable */
  Token *pAlias,          /* The right-hand side of the AS subexpression */
  Select *pSubquery,      /* A subquery used in place of a table name */
  Expr *pOn,              /* The ON clause of a join */
  IdList *pUsing          /* The USING clause of a join */
){
  struct SrcList_item *pItem;
  sqlite3 *db = pParse->db;
  p = sqlite3SrcListAppend(db, p, pTable, pDatabase);
  if( p==0 || p->nSrc==0 ){
    sqlite3ExprDelete(db, pOn);
    sqlite3IdListDelete(db, pUsing);
    sqlite3SelectDelete(db, pSubquery);
    return p;
  }
  pItem = &p->a[p->nSrc-1];
  if( pAlias && pAlias->n ){
    pItem->zAlias = sqlite3NameFromToken(db, pAlias);
  }
  pItem->pSelect = pSubquery;
  pItem->pOn = pOn;
  pItem->pUsing = pUsing;
  return p;
}

/*
** When building up a FROM clause in the parser, the join operator
** is initially attached to the left operand.  But the code generator
** expects the join operator to be on the right operand.  This routine
** Shifts all join operators from left to right for an entire FROM
** clause.
**
** Example: Suppose the join is like this:
**
**           A natural cross join B
**
** The operator is "natural cross join".  The A and B operands are stored
** in p->a[0] and p->a[1], respectively.  The parser initially stores the
** operator with A.  This routine shifts that operator over to B.
*/
void sqlite3SrcListShiftJoinType(SrcList *p){
  if( p && p->a ){
    int i;
    for(i=p->nSrc-1; i>0; i--){
      p->a[i].jointype = p->a[i-1].jointype;
    }
    p->a[0].jointype = 0;
  }
}

/*
** Begin a transaction
*/
void sqlite3BeginTransaction(Parse *pParse, int type){
  sqlite3 *db;
  Vdbe *v;
  int i;

  if( pParse==0 || (db=pParse->db)==0 || db->aDb[0].pBt==0 ) return;
  if( pParse->nErr || db->mallocFailed ) return;
  if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "BEGIN", 0, 0) ) return;

  v = sqlite3GetVdbe(pParse);
  if( !v ) return;
  if( type!=TK_DEFERRED ){
    for(i=0; i<db->nDb; i++){
      sqlite3VdbeAddOp2(v, OP_Transaction, i, (type==TK_EXCLUSIVE)+1);
      sqlite3VdbeUsesBtree(v, i);
    }
  }
  sqlite3VdbeAddOp2(v, OP_AutoCommit, 0, 0);
}

/*
** Commit a transaction
*/
void sqlite3CommitTransaction(Parse *pParse){
  sqlite3 *db;
  Vdbe *v;

  if( pParse==0 || (db=pParse->db)==0 || db->aDb[0].pBt==0 ) return;
  if( pParse->nErr || db->mallocFailed ) return;
  if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "COMMIT", 0, 0) ) return;

  v = sqlite3GetVdbe(pParse);
  if( v ){
    sqlite3VdbeAddOp2(v, OP_AutoCommit, 1, 0);
  }
}

/*
** Rollback a transaction
*/
void sqlite3RollbackTransaction(Parse *pParse){
  sqlite3 *db;
  Vdbe *v;

  if( pParse==0 || (db=pParse->db)==0 || db->aDb[0].pBt==0 ) return;
  if( pParse->nErr || db->mallocFailed ) return;
  if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "ROLLBACK", 0, 0) ) return;

  v = sqlite3GetVdbe(pParse);
  if( v ){
    sqlite3VdbeAddOp2(v, OP_AutoCommit, 1, 1);
  }
}

/*
** Make sure the TEMP database is open and available for use.  Return
** the number of errors.  Leave any error messages in the pParse structure.
*/
int sqlite3OpenTempDatabase(Parse *pParse){
  sqlite3 *db = pParse->db;
  if( db->aDb[1].pBt==0 && !pParse->explain ){
    int rc;
    static const int flags = 
          SQLITE_OPEN_READWRITE |
          SQLITE_OPEN_CREATE |
          SQLITE_OPEN_EXCLUSIVE |
          SQLITE_OPEN_DELETEONCLOSE |
          SQLITE_OPEN_TEMP_DB;

    rc = sqlite3BtreeFactory(db, 0, 0, SQLITE_DEFAULT_CACHE_SIZE, flags,
                                 &db->aDb[1].pBt);
    if( rc!=SQLITE_OK ){
      sqlite3ErrorMsg(pParse, "unable to open a temporary database "
        "file for storing temporary tables");
      pParse->rc = rc;
      return 1;
    }
    assert( (db->flags & SQLITE_InTrans)==0 || db->autoCommit );
    assert( db->aDb[1].pSchema );
    sqlite3PagerJournalMode(sqlite3BtreePager(db->aDb[1].pBt),
                            db->dfltJournalMode);
  }
  return 0;
}

/*
** Generate VDBE code that will verify the schema cookie and start
** a read-transaction for all named database files.
**
** It is important that all schema cookies be verified and all
** read transactions be started before anything else happens in
** the VDBE program.  But this routine can be called after much other
** code has been generated.  So here is what we do:
**
** The first time this routine is called, we code an OP_Goto that
** will jump to a subroutine at the end of the program.  Then we
** record every database that needs its schema verified in the
** pParse->cookieMask field.  Later, after all other code has been
** generated, the subroutine that does the cookie verifications and
** starts the transactions will be coded and the OP_Goto P2 value
** will be made to point to that subroutine.  The generation of the
** cookie verification subroutine code happens in sqlite3FinishCoding().
**
** If iDb<0 then code the OP_Goto only - don't set flag to verify the
** schema on any databases.  This can be used to position the OP_Goto
** early in the code, before we know if any database tables will be used.
*/
void sqlite3CodeVerifySchema(Parse *pParse, int iDb){
  sqlite3 *db;
  Vdbe *v;
  int mask;

  v = sqlite3GetVdbe(pParse);
  if( v==0 ) return;  /* This only happens if there was a prior error */
  db = pParse->db;
  if( pParse->cookieGoto==0 ){
    pParse->cookieGoto = sqlite3VdbeAddOp2(v, OP_Goto, 0, 0)+1;
  }
  if( iDb>=0 ){
    assert( iDb<db->nDb );
    assert( db->aDb[iDb].pBt!=0 || iDb==1 );
    assert( iDb<SQLITE_MAX_ATTACHED+2 );
    mask = 1<<iDb;
    if( (pParse->cookieMask & mask)==0 ){
      pParse->cookieMask |= mask;
      pParse->cookieValue[iDb] = db->aDb[iDb].pSchema->schema_cookie;
      if( !OMIT_TEMPDB && iDb==1 ){
        sqlite3OpenTempDatabase(pParse);
      }
    }
  }
}

/*
** Generate VDBE code that prepares for doing an operation that
** might change the database.
**
** This routine starts a new transaction if we are not already within
** a transaction.  If we are already within a transaction, then a checkpoint
** is set if the setStatement parameter is true.  A checkpoint should
** be set for operations that might fail (due to a constraint) part of
** the way through and which will need to undo some writes without having to
** rollback the whole transaction.  For operations where all constraints
** can be checked before any changes are made to the database, it is never
** necessary to undo a write and the checkpoint should not be set.
**
** Only database iDb and the temp database are made writable by this call.
** If iDb==0, then the main and temp databases are made writable.   If
** iDb==1 then only the temp database is made writable.  If iDb>1 then the
** specified auxiliary database and the temp database are made writable.
*/
void sqlite3BeginWriteOperation(Parse *pParse, int setStatement, int iDb){
  Vdbe *v = sqlite3GetVdbe(pParse);
  if( v==0 ) return;
  sqlite3CodeVerifySchema(pParse, iDb);
  pParse->writeMask |= 1<<iDb;
  if( setStatement && pParse->nested==0 ){
    sqlite3VdbeAddOp1(v, OP_Statement, iDb);
  }
  if( (OMIT_TEMPDB || iDb!=1) && pParse->db->aDb[1].pBt!=0 ){
    sqlite3BeginWriteOperation(pParse, setStatement, 1);
  }
}

/*
** Check to see if pIndex uses the collating sequence pColl.  Return
** true if it does and false if it does not.
*/
#ifndef SQLITE_OMIT_REINDEX
static int collationMatch(const char *zColl, Index *pIndex){
  int i;
  for(i=0; i<pIndex->nColumn; i++){
    const char *z = pIndex->azColl[i];
    if( z==zColl || (z && zColl && 0==sqlite3StrICmp(z, zColl)) ){
      return 1;
    }
  }
  return 0;
}
#endif

/*
** Recompute all indices of pTab that use the collating sequence pColl.
** If pColl==0 then recompute all indices of pTab.
*/
#ifndef SQLITE_OMIT_REINDEX
static void reindexTable(Parse *pParse, Table *pTab, char const *zColl){
  Index *pIndex;              /* An index associated with pTab */

  for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){
    if( zColl==0 || collationMatch(zColl, pIndex) ){
      int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
      sqlite3BeginWriteOperation(pParse, 0, iDb);
      sqlite3RefillIndex(pParse, pIndex, -1);
    }
  }
}
#endif

/*
** Recompute all indices of all tables in all databases where the
** indices use the collating sequence pColl.  If pColl==0 then recompute
** all indices everywhere.
*/
#ifndef SQLITE_OMIT_REINDEX
static void reindexDatabases(Parse *pParse, char const *zColl){
  Db *pDb;                    /* A single database */
  int iDb;                    /* The database index number */
  sqlite3 *db = pParse->db;   /* The database connection */
  HashElem *k;                /* For looping over tables in pDb */
  Table *pTab;                /* A table in the database */

  for(iDb=0, pDb=db->aDb; iDb<db->nDb; iDb++, pDb++){
    assert( pDb!=0 );
    for(k=sqliteHashFirst(&pDb->pSchema->tblHash);  k; k=sqliteHashNext(k)){
      pTab = (Table*)sqliteHashData(k);
      reindexTable(pParse, pTab, zColl);
    }
  }
}
#endif

/*
** Generate code for the REINDEX command.
**
**        REINDEX                            -- 1
**        REINDEX  <collation>               -- 2
**        REINDEX  ?<database>.?<tablename>  -- 3
**        REINDEX  ?<database>.?<indexname>  -- 4
**
** Form 1 causes all indices in all attached databases to be rebuilt.
** Form 2 rebuilds all indices in all databases that use the named
** collating function.  Forms 3 and 4 rebuild the named index or all
** indices associated with the named table.
*/
#ifndef SQLITE_OMIT_REINDEX
void sqlite3Reindex(Parse *pParse, Token *pName1, Token *pName2){
  CollSeq *pColl;             /* Collating sequence to be reindexed, or NULL */
  char *z;                    /* Name of a table or index */
  const char *zDb;            /* Name of the database */
  Table *pTab;                /* A table in the database */
  Index *pIndex;              /* An index associated with pTab */
  int iDb;                    /* The database index number */
  sqlite3 *db = pParse->db;   /* The database connection */
  Token *pObjName;            /* Name of the table or index to be reindexed */

  /* Read the database schema. If an error occurs, leave an error message
  ** and code in pParse and return NULL. */
  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
    return;
  }

  if( pName1==0 || pName1->z==0 ){
    reindexDatabases(pParse, 0);
    return;
  }else if( pName2==0 || pName2->z==0 ){
    char *zColl;
    assert( pName1->z );
    zColl = sqlite3NameFromToken(pParse->db, pName1);
    if( !zColl ) return;
    pColl = sqlite3FindCollSeq(db, ENC(db), zColl, -1, 0);
    if( pColl ){
      if( zColl ){
        reindexDatabases(pParse, zColl);
        sqlite3DbFree(db, zColl);
      }
      return;
    }
    sqlite3DbFree(db, zColl);
  }
  iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pObjName);
  if( iDb<0 ) return;
  z = sqlite3NameFromToken(db, pObjName);
  if( z==0 ) return;
  zDb = db->aDb[iDb].zName;
  pTab = sqlite3FindTable(db, z, zDb);
  if( pTab ){
    reindexTable(pParse, pTab, 0);
    sqlite3DbFree(db, z);
    return;
  }
  pIndex = sqlite3FindIndex(db, z, zDb);
  sqlite3DbFree(db, z);
  if( pIndex ){
    sqlite3BeginWriteOperation(pParse, 0, iDb);
    sqlite3RefillIndex(pParse, pIndex, -1);
    return;
  }
  sqlite3ErrorMsg(pParse, "unable to identify the object to be reindexed");
}
#endif

/*
** Return a dynamicly allocated KeyInfo structure that can be used
** with OP_OpenRead or OP_OpenWrite to access database index pIdx.
**
** If successful, a pointer to the new structure is returned. In this case
** the caller is responsible for calling sqlite3DbFree(db, ) on the returned 
** pointer. If an error occurs (out of memory or missing collation 
** sequence), NULL is returned and the state of pParse updated to reflect
** the error.
*/
KeyInfo *sqlite3IndexKeyinfo(Parse *pParse, Index *pIdx){
  int i;
  int nCol = pIdx->nColumn;
  int nBytes = sizeof(KeyInfo) + (nCol-1)*sizeof(CollSeq*) + nCol;
  sqlite3 *db = pParse->db;
  KeyInfo *pKey = (KeyInfo *)sqlite3DbMallocZero(db, nBytes);

  if( pKey ){
    pKey->db = pParse->db;
    pKey->aSortOrder = (u8 *)&(pKey->aColl[nCol]);
    assert( &pKey->aSortOrder[nCol]==&(((u8 *)pKey)[nBytes]) );
    for(i=0; i<nCol; i++){
      char *zColl = pIdx->azColl[i];
      assert( zColl );
      pKey->aColl[i] = sqlite3LocateCollSeq(pParse, zColl, -1);
      pKey->aSortOrder[i] = pIdx->aSortOrder[i];
    }
    pKey->nField = nCol;
  }

  if( pParse->nErr ){
    sqlite3DbFree(db, pKey);
    pKey = 0;
  }
  return pKey;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/callback.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
/*
** 2005 May 23 
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains functions used to access the internal hash tables
** of user defined functions and collation sequences.
**
** $Id: callback.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/

#include "sqliteInt.h"

/*
** Invoke the 'collation needed' callback to request a collation sequence
** in the database text encoding of name zName, length nName.
** If the collation sequence
*/
static void callCollNeeded(sqlite3 *db, const char *zName, int nName){
  assert( !db->xCollNeeded || !db->xCollNeeded16 );
  if( nName<0 ) nName = sqlite3Strlen(db, zName);
  if( db->xCollNeeded ){
    char *zExternal = sqlite3DbStrNDup(db, zName, nName);
    if( !zExternal ) return;
    db->xCollNeeded(db->pCollNeededArg, db, (int)ENC(db), zExternal);
    sqlite3DbFree(db, zExternal);
  }
#ifndef SQLITE_OMIT_UTF16
  if( db->xCollNeeded16 ){
    char const *zExternal;
    sqlite3_value *pTmp = sqlite3ValueNew(db);
    sqlite3ValueSetStr(pTmp, nName, zName, SQLITE_UTF8, SQLITE_STATIC);
    zExternal = sqlite3ValueText(pTmp, SQLITE_UTF16NATIVE);
    if( zExternal ){
      db->xCollNeeded16(db->pCollNeededArg, db, (int)ENC(db), zExternal);
    }
    sqlite3ValueFree(pTmp);
  }
#endif
}

/*
** This routine is called if the collation factory fails to deliver a
** collation function in the best encoding but there may be other versions
** of this collation function (for other text encodings) available. Use one
** of these instead if they exist. Avoid a UTF-8 <-> UTF-16 conversion if
** possible.
*/
static int synthCollSeq(sqlite3 *db, CollSeq *pColl){
  CollSeq *pColl2;
  char *z = pColl->zName;
  int n = strlen(z);
  int i;
  static const u8 aEnc[] = { SQLITE_UTF16BE, SQLITE_UTF16LE, SQLITE_UTF8 };
  for(i=0; i<3; i++){
    pColl2 = sqlite3FindCollSeq(db, aEnc[i], z, n, 0);
    if( pColl2->xCmp!=0 ){
      memcpy(pColl, pColl2, sizeof(CollSeq));
      pColl->xDel = 0;         /* Do not copy the destructor */
      return SQLITE_OK;
    }
  }
  return SQLITE_ERROR;
}

/*
** This function is responsible for invoking the collation factory callback
** or substituting a collation sequence of a different encoding when the
** requested collation sequence is not available in the database native
** encoding.
** 
** If it is not NULL, then pColl must point to the database native encoding 
** collation sequence with name zName, length nName.
**
** The return value is either the collation sequence to be used in database
** db for collation type name zName, length nName, or NULL, if no collation
** sequence can be found.
*/
CollSeq *sqlite3GetCollSeq(
  sqlite3* db, 
  CollSeq *pColl, 
  const char *zName, 
  int nName
){
  CollSeq *p;

  p = pColl;
  if( !p ){
    p = sqlite3FindCollSeq(db, ENC(db), zName, nName, 0);
  }
  if( !p || !p->xCmp ){
    /* No collation sequence of this type for this encoding is registered.
    ** Call the collation factory to see if it can supply us with one.
    */
    callCollNeeded(db, zName, nName);
    p = sqlite3FindCollSeq(db, ENC(db), zName, nName, 0);
  }
  if( p && !p->xCmp && synthCollSeq(db, p) ){
    p = 0;
  }
  assert( !p || p->xCmp );
  return p;
}

/*
** This routine is called on a collation sequence before it is used to
** check that it is defined. An undefined collation sequence exists when
** a database is loaded that contains references to collation sequences
** that have not been defined by sqlite3_create_collation() etc.
**
** If required, this routine calls the 'collation needed' callback to
** request a definition of the collating sequence. If this doesn't work, 
** an equivalent collating sequence that uses a text encoding different
** from the main database is substituted, if one is available.
*/
int sqlite3CheckCollSeq(Parse *pParse, CollSeq *pColl){
  if( pColl ){
    const char *zName = pColl->zName;
    CollSeq *p = sqlite3GetCollSeq(pParse->db, pColl, zName, -1);
    if( !p ){
      if( pParse->nErr==0 ){
        sqlite3ErrorMsg(pParse, "no such collation sequence: %s", zName);
      }
      pParse->nErr++;
      return SQLITE_ERROR;
    }
    assert( p==pColl );
  }
  return SQLITE_OK;
}



/*
** Locate and return an entry from the db.aCollSeq hash table. If the entry
** specified by zName and nName is not found and parameter 'create' is
** true, then create a new entry. Otherwise return NULL.
**
** Each pointer stored in the sqlite3.aCollSeq hash table contains an
** array of three CollSeq structures. The first is the collation sequence
** prefferred for UTF-8, the second UTF-16le, and the third UTF-16be.
**
** Stored immediately after the three collation sequences is a copy of
** the collation sequence name. A pointer to this string is stored in
** each collation sequence structure.
*/
static CollSeq *findCollSeqEntry(
  sqlite3 *db,
  const char *zName,
  int nName,
  int create
){
  CollSeq *pColl;
  if( nName<0 ) nName = sqlite3Strlen(db, zName);
  pColl = sqlite3HashFind(&db->aCollSeq, zName, nName);

  if( 0==pColl && create ){
    pColl = sqlite3DbMallocZero(db, 3*sizeof(*pColl) + nName + 1 );
    if( pColl ){
      CollSeq *pDel = 0;
      pColl[0].zName = (char*)&pColl[3];
      pColl[0].enc = SQLITE_UTF8;
      pColl[1].zName = (char*)&pColl[3];
      pColl[1].enc = SQLITE_UTF16LE;
      pColl[2].zName = (char*)&pColl[3];
      pColl[2].enc = SQLITE_UTF16BE;
      memcpy(pColl[0].zName, zName, nName);
      pColl[0].zName[nName] = 0;
      pDel = sqlite3HashInsert(&db->aCollSeq, pColl[0].zName, nName, pColl);

      /* If a malloc() failure occured in sqlite3HashInsert(), it will 
      ** return the pColl pointer to be deleted (because it wasn't added
      ** to the hash table).
      */
      assert( pDel==0 || pDel==pColl );
      if( pDel!=0 ){
        db->mallocFailed = 1;
        sqlite3DbFree(db, pDel);
        pColl = 0;
      }
    }
  }
  return pColl;
}

/*
** Parameter zName points to a UTF-8 encoded string nName bytes long.
** Return the CollSeq* pointer for the collation sequence named zName
** for the encoding 'enc' from the database 'db'.
**
** If the entry specified is not found and 'create' is true, then create a
** new entry.  Otherwise return NULL.
**
** A separate function sqlite3LocateCollSeq() is a wrapper around
** this routine.  sqlite3LocateCollSeq() invokes the collation factory
** if necessary and generates an error message if the collating sequence
** cannot be found.
*/
CollSeq *sqlite3FindCollSeq(
  sqlite3 *db,
  u8 enc,
  const char *zName,
  int nName,
  int create
){
  CollSeq *pColl;
  if( zName ){
    pColl = findCollSeqEntry(db, zName, nName, create);
  }else{
    pColl = db->pDfltColl;
  }
  assert( SQLITE_UTF8==1 && SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 );
  assert( enc>=SQLITE_UTF8 && enc<=SQLITE_UTF16BE );
  if( pColl ) pColl += enc-1;
  return pColl;
}

/*
** Locate a user function given a name, a number of arguments and a flag
** indicating whether the function prefers UTF-16 over UTF-8.  Return a
** pointer to the FuncDef structure that defines that function, or return
** NULL if the function does not exist.
**
** If the createFlag argument is true, then a new (blank) FuncDef
** structure is created and liked into the "db" structure if a
** no matching function previously existed.  When createFlag is true
** and the nArg parameter is -1, then only a function that accepts
** any number of arguments will be returned.
**
** If createFlag is false and nArg is -1, then the first valid
** function found is returned.  A function is valid if either xFunc
** or xStep is non-zero.
**
** If createFlag is false, then a function with the required name and
** number of arguments may be returned even if the eTextRep flag does not
** match that requested.
*/
FuncDef *sqlite3FindFunction(
  sqlite3 *db,       /* An open database */
  const char *zName, /* Name of the function.  Not null-terminated */
  int nName,         /* Number of characters in the name */
  int nArg,          /* Number of arguments.  -1 means any number */
  u8 enc,            /* Preferred text encoding */
  int createFlag     /* Create new entry if true and does not otherwise exist */
){
  FuncDef *p;         /* Iterator variable */
  FuncDef *pFirst;    /* First function with this name */
  FuncDef *pBest = 0; /* Best match found so far */
  int bestmatch = 0;  


  assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE );
  if( nArg<-1 ) nArg = -1;

  pFirst = (FuncDef*)sqlite3HashFind(&db->aFunc, zName, nName);
  for(p=pFirst; p; p=p->pNext){
    /* During the search for the best function definition, bestmatch is set
    ** as follows to indicate the quality of the match with the definition
    ** pointed to by pBest:
    **
    ** 0: pBest is NULL. No match has been found.
    ** 1: A variable arguments function that prefers UTF-8 when a UTF-16
    **    encoding is requested, or vice versa.
    ** 2: A variable arguments function that uses UTF-16BE when UTF-16LE is
    **    requested, or vice versa.
    ** 3: A variable arguments function using the same text encoding.
    ** 4: A function with the exact number of arguments requested that
    **    prefers UTF-8 when a UTF-16 encoding is requested, or vice versa.
    ** 5: A function with the exact number of arguments requested that
    **    prefers UTF-16LE when UTF-16BE is requested, or vice versa.
    ** 6: An exact match.
    **
    ** A larger value of 'matchqual' indicates a more desirable match.
    */
    if( p->nArg==-1 || p->nArg==nArg || nArg==-1 ){
      int match = 1;          /* Quality of this match */
      if( p->nArg==nArg || nArg==-1 ){
        match = 4;
      }
      if( enc==p->iPrefEnc ){
        match += 2;
      }
      else if( (enc==SQLITE_UTF16LE && p->iPrefEnc==SQLITE_UTF16BE) ||
               (enc==SQLITE_UTF16BE && p->iPrefEnc==SQLITE_UTF16LE) ){
        match += 1;
      }

      if( match>bestmatch ){
        pBest = p;
        bestmatch = match;
      }
    }
  }

  /* If the createFlag parameter is true, and the seach did not reveal an
  ** exact match for the name, number of arguments and encoding, then add a
  ** new entry to the hash table and return it.
  */
  if( createFlag && bestmatch<6 && 
      (pBest = sqlite3DbMallocZero(db, sizeof(*pBest)+nName))!=0 ){
    pBest->nArg = nArg;
    pBest->pNext = pFirst;
    pBest->iPrefEnc = enc;
    memcpy(pBest->zName, zName, nName);
    pBest->zName[nName] = 0;
    if( pBest==sqlite3HashInsert(&db->aFunc,pBest->zName,nName,(void*)pBest) ){
      db->mallocFailed = 1;
      sqlite3DbFree(db, pBest);
      return 0;
    }
  }

  if( pBest && (pBest->xStep || pBest->xFunc || createFlag) ){
    return pBest;
  }
  return 0;
}

/*
** Free all resources held by the schema structure. The void* argument points
** at a Schema struct. This function does not call sqlite3DbFree(db, ) on the 
** pointer itself, it just cleans up subsiduary resources (i.e. the contents
** of the schema hash tables).
**
** The Schema.cache_size variable is not cleared.
*/
void sqlite3SchemaFree(void *p){
  Hash temp1;
  Hash temp2;
  HashElem *pElem;
  Schema *pSchema = (Schema *)p;

  temp1 = pSchema->tblHash;
  temp2 = pSchema->trigHash;
  sqlite3HashInit(&pSchema->trigHash, SQLITE_HASH_STRING, 0);
  sqlite3HashClear(&pSchema->aFKey);
  sqlite3HashClear(&pSchema->idxHash);
  for(pElem=sqliteHashFirst(&temp2); pElem; pElem=sqliteHashNext(pElem)){
    sqlite3DeleteTrigger(0, (Trigger*)sqliteHashData(pElem));
  }
  sqlite3HashClear(&temp2);
  sqlite3HashInit(&pSchema->tblHash, SQLITE_HASH_STRING, 0);
  for(pElem=sqliteHashFirst(&temp1); pElem; pElem=sqliteHashNext(pElem)){
    Table *pTab = sqliteHashData(pElem);
    sqlite3DeleteTable(pTab);
  }
  sqlite3HashClear(&temp1);
  pSchema->pSeqTab = 0;
  pSchema->flags &= ~DB_SchemaLoaded;
}

/*
** Find and return the schema associated with a BTree.  Create
** a new one if necessary.
*/
Schema *sqlite3SchemaGet(sqlite3 *db, Btree *pBt){
  Schema * p;
  if( pBt ){
    p = (Schema *)sqlite3BtreeSchema(pBt, sizeof(Schema), sqlite3SchemaFree);
  }else{
    p = (Schema *)sqlite3MallocZero(sizeof(Schema));
  }
  if( !p ){
    db->mallocFailed = 1;
  }else if ( 0==p->file_format ){
    sqlite3HashInit(&p->tblHash, SQLITE_HASH_STRING, 0);
    sqlite3HashInit(&p->idxHash, SQLITE_HASH_STRING, 0);
    sqlite3HashInit(&p->trigHash, SQLITE_HASH_STRING, 0);
    sqlite3HashInit(&p->aFKey, SQLITE_HASH_STRING, 1);
    p->enc = SQLITE_UTF8;
  }
  return p;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/complete.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** An tokenizer for SQL
**
** This file contains C code that implements the sqlite3_complete() API.
** This code used to be part of the tokenizer.c source file.  But by
** separating it out, the code will be automatically omitted from
** static links that do not use it.
**
** $Id: complete.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"
#ifndef SQLITE_OMIT_COMPLETE

/*
** This is defined in tokenize.c.  We just have to import the definition.
*/
#ifndef SQLITE_AMALGAMATION
#ifdef SQLITE_ASCII
extern const char sqlite3IsAsciiIdChar[];
#define IdChar(C)  (((c=C)&0x80)!=0 || (c>0x1f && sqlite3IsAsciiIdChar[c-0x20]))
#endif
#ifdef SQLITE_EBCDIC
extern const char sqlite3IsEbcdicIdChar[];
#define IdChar(C)  (((c=C)>=0x42 && sqlite3IsEbcdicIdChar[c-0x40]))
#endif
#endif /* SQLITE_AMALGAMATION */


/*
** Token types used by the sqlite3_complete() routine.  See the header
** comments on that procedure for additional information.
*/
#define tkSEMI    0
#define tkWS      1
#define tkOTHER   2
#define tkEXPLAIN 3
#define tkCREATE  4
#define tkTEMP    5
#define tkTRIGGER 6
#define tkEND     7

/*
** Return TRUE if the given SQL string ends in a semicolon.
**
** Special handling is require for CREATE TRIGGER statements.
** Whenever the CREATE TRIGGER keywords are seen, the statement
** must end with ";END;".
**
** This implementation uses a state machine with 7 states:
**
**   (0) START     At the beginning or end of an SQL statement.  This routine
**                 returns 1 if it ends in the START state and 0 if it ends
**                 in any other state.
**
**   (1) NORMAL    We are in the middle of statement which ends with a single
**                 semicolon.
**
**   (2) EXPLAIN   The keyword EXPLAIN has been seen at the beginning of 
**                 a statement.
**
**   (3) CREATE    The keyword CREATE has been seen at the beginning of a
**                 statement, possibly preceeded by EXPLAIN and/or followed by
**                 TEMP or TEMPORARY
**
**   (4) TRIGGER   We are in the middle of a trigger definition that must be
**                 ended by a semicolon, the keyword END, and another semicolon.
**
**   (5) SEMI      We've seen the first semicolon in the ";END;" that occurs at
**                 the end of a trigger definition.
**
**   (6) END       We've seen the ";END" of the ";END;" that occurs at the end
**                 of a trigger difinition.
**
** Transitions between states above are determined by tokens extracted
** from the input.  The following tokens are significant:
**
**   (0) tkSEMI      A semicolon.
**   (1) tkWS        Whitespace
**   (2) tkOTHER     Any other SQL token.
**   (3) tkEXPLAIN   The "explain" keyword.
**   (4) tkCREATE    The "create" keyword.
**   (5) tkTEMP      The "temp" or "temporary" keyword.
**   (6) tkTRIGGER   The "trigger" keyword.
**   (7) tkEND       The "end" keyword.
**
** Whitespace never causes a state transition and is always ignored.
**
** If we compile with SQLITE_OMIT_TRIGGER, all of the computation needed
** to recognize the end of a trigger can be omitted.  All we have to do
** is look for a semicolon that is not part of an string or comment.
*/
int sqlite3_complete(const char *zSql){
  u8 state = 0;   /* Current state, using numbers defined in header comment */
  u8 token;       /* Value of the next token */

#ifndef SQLITE_OMIT_TRIGGER
  /* A complex statement machine used to detect the end of a CREATE TRIGGER
  ** statement.  This is the normal case.
  */
  static const u8 trans[7][8] = {
                     /* Token:                                                */
     /* State:       **  SEMI  WS  OTHER EXPLAIN  CREATE  TEMP  TRIGGER  END  */
     /* 0   START: */ {    0,  0,     1,      2,      3,    1,       1,   1,  },
     /* 1  NORMAL: */ {    0,  1,     1,      1,      1,    1,       1,   1,  },
     /* 2 EXPLAIN: */ {    0,  2,     1,      1,      3,    1,       1,   1,  },
     /* 3  CREATE: */ {    0,  3,     1,      1,      1,    3,       4,   1,  },
     /* 4 TRIGGER: */ {    5,  4,     4,      4,      4,    4,       4,   4,  },
     /* 5    SEMI: */ {    5,  5,     4,      4,      4,    4,       4,   6,  },
     /* 6     END: */ {    0,  6,     4,      4,      4,    4,       4,   4,  },
  };
#else
  /* If triggers are not suppored by this compile then the statement machine
  ** used to detect the end of a statement is much simplier
  */
  static const u8 trans[2][3] = {
                     /* Token:           */
     /* State:       **  SEMI  WS  OTHER */
     /* 0   START: */ {    0,  0,     1, },
     /* 1  NORMAL: */ {    0,  1,     1, },
  };
#endif /* SQLITE_OMIT_TRIGGER */

  while( *zSql ){
    switch( *zSql ){
      case ';': {  /* A semicolon */
        token = tkSEMI;
        break;
      }
      case ' ':
      case '\r':
      case '\t':
      case '\n':
      case '\f': {  /* White space is ignored */
        token = tkWS;
        break;
      }
      case '/': {   /* C-style comments */
        if( zSql[1]!='*' ){
          token = tkOTHER;
          break;
        }
        zSql += 2;
        while( zSql[0] && (zSql[0]!='*' || zSql[1]!='/') ){ zSql++; }
        if( zSql[0]==0 ) return 0;
        zSql++;
        token = tkWS;
        break;
      }
      case '-': {   /* SQL-style comments from "--" to end of line */
        if( zSql[1]!='-' ){
          token = tkOTHER;
          break;
        }
        while( *zSql && *zSql!='\n' ){ zSql++; }
        if( *zSql==0 ) return state==0;
        token = tkWS;
        break;
      }
      case '[': {   /* Microsoft-style identifiers in [...] */
        zSql++;
        while( *zSql && *zSql!=']' ){ zSql++; }
        if( *zSql==0 ) return 0;
        token = tkOTHER;
        break;
      }
      case '`':     /* Grave-accent quoted symbols used by MySQL */
      case '"':     /* single- and double-quoted strings */
      case '\'': {
        int c = *zSql;
        zSql++;
        while( *zSql && *zSql!=c ){ zSql++; }
        if( *zSql==0 ) return 0;
        token = tkOTHER;
        break;
      }
      default: {
        int c;
        if( IdChar((u8)*zSql) ){
          /* Keywords and unquoted identifiers */
          int nId;
          for(nId=1; IdChar(zSql[nId]); nId++){}
#ifdef SQLITE_OMIT_TRIGGER
          token = tkOTHER;
#else
          switch( *zSql ){
            case 'c': case 'C': {
              if( nId==6 && sqlite3StrNICmp(zSql, "create", 6)==0 ){
                token = tkCREATE;
              }else{
                token = tkOTHER;
              }
              break;
            }
            case 't': case 'T': {
              if( nId==7 && sqlite3StrNICmp(zSql, "trigger", 7)==0 ){
                token = tkTRIGGER;
              }else if( nId==4 && sqlite3StrNICmp(zSql, "temp", 4)==0 ){
                token = tkTEMP;
              }else if( nId==9 && sqlite3StrNICmp(zSql, "temporary", 9)==0 ){
                token = tkTEMP;
              }else{
                token = tkOTHER;
              }
              break;
            }
            case 'e':  case 'E': {
              if( nId==3 && sqlite3StrNICmp(zSql, "end", 3)==0 ){
                token = tkEND;
              }else
#ifndef SQLITE_OMIT_EXPLAIN
              if( nId==7 && sqlite3StrNICmp(zSql, "explain", 7)==0 ){
                token = tkEXPLAIN;
              }else
#endif
              {
                token = tkOTHER;
              }
              break;
            }
            default: {
              token = tkOTHER;
              break;
            }
          }
#endif /* SQLITE_OMIT_TRIGGER */
          zSql += nId-1;
        }else{
          /* Operators and special symbols */
          token = tkOTHER;
        }
        break;
      }
    }
    state = trans[state][token];
    zSql++;
  }
  return state==0;
}

#ifndef SQLITE_OMIT_UTF16
/*
** This routine is the same as the sqlite3_complete() routine described
** above, except that the parameter is required to be UTF-16 encoded, not
** UTF-8.
*/
int sqlite3_complete16(const void *zSql){
  sqlite3_value *pVal;
  char const *zSql8;
  int rc = SQLITE_NOMEM;

#ifndef SQLITE_OMIT_AUTOINIT
  rc = sqlite3_initialize();
  if( rc ) return rc;
#endif
  pVal = sqlite3ValueNew(0);
  sqlite3ValueSetStr(pVal, -1, zSql, SQLITE_UTF16NATIVE, SQLITE_STATIC);
  zSql8 = sqlite3ValueText(pVal, SQLITE_UTF8);
  if( zSql8 ){
    rc = sqlite3_complete(zSql8);
  }else{
    rc = SQLITE_NOMEM;
  }
  sqlite3ValueFree(pVal);
  return sqlite3ApiExit(0, rc);
}
#endif /* SQLITE_OMIT_UTF16 */
#endif /* SQLITE_OMIT_COMPLETE */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/date.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
/*
** 2003 October 31
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains the C functions that implement date and time
** functions for SQLite.  
**
** There is only one exported symbol in this file - the function
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $Id: date.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
**
** SQLite processes all times and dates as Julian Day numbers.  The
** dates and times are stored as the number of days since noon
** in Greenwich on November 24, 4714 B.C. according to the Gregorian
** calendar system. 
**
** 1970-01-01 00:00:00 is JD 2440587.5
** 2000-01-01 00:00:00 is JD 2451544.5
**
** This implemention requires years to be expressed as a 4-digit number
** which means that only dates between 0000-01-01 and 9999-12-31 can
** be represented, even though julian day numbers allow a much wider
** range of dates.
**
** The Gregorian calendar system is used for all dates and times,
** even those that predate the Gregorian calendar.  Historians usually
** use the Julian calendar for dates prior to 1582-10-15 and for some
** dates afterwards, depending on locale.  Beware of this difference.
**
** The conversion algorithms are implemented based on descriptions
** in the following text:
**
**      Jean Meeus
**      Astronomical Algorithms, 2nd Edition, 1998
**      ISBM 0-943396-61-1
**      Willmann-Bell, Inc
**      Richmond, Virginia (USA)
*/
#include "sqliteInt.h"
#include <ctype.h>
#include <stdlib.h>
#include <assert.h>
#include <time.h>

#ifndef SQLITE_OMIT_DATETIME_FUNCS

/*
** On recent Windows platforms, the localtime_s() function is available
** as part of the "Secure CRT". It is essentially equivalent to 
** localtime_r() available under most POSIX platforms, except that the 
** order of the parameters is reversed.
**
** See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx.
**
** If the user has not indicated to use localtime_r() or localtime_s()
** already, check for an MSVC build environment that provides 
** localtime_s().
*/
#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && \
     defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)
#define HAVE_LOCALTIME_S 1
#endif

/*
** A structure for holding a single date and time.
*/
typedef struct DateTime DateTime;
struct DateTime {
  sqlite3_int64 iJD; /* The julian day number times 86400000 */
  int Y, M, D;       /* Year, month, and day */
  int h, m;          /* Hour and minutes */
  int tz;            /* Timezone offset in minutes */
  double s;          /* Seconds */
  char validYMD;     /* True if Y,M,D are valid */
  char validHMS;     /* True if h,m,s are valid */
  char validJD;      /* True if iJD is valid */
  char validTZ;      /* True if tz is valid */
};


/*
** Convert zDate into one or more integers.  Additional arguments
** come in groups of 5 as follows:
**
**       N       number of digits in the integer
**       min     minimum allowed value of the integer
**       max     maximum allowed value of the integer
**       nextC   first character after the integer
**       pVal    where to write the integers value.
**
** Conversions continue until one with nextC==0 is encountered.
** The function returns the number of successful conversions.
*/
static int getDigits(const char *zDate, ...){
  va_list ap;
  int val;
  int N;
  int min;
  int max;
  int nextC;
  int *pVal;
  int cnt = 0;
  va_start(ap, zDate);
  do{
    N = va_arg(ap, int);
    min = va_arg(ap, int);
    max = va_arg(ap, int);
    nextC = va_arg(ap, int);
    pVal = va_arg(ap, int*);
    val = 0;
    while( N-- ){
      if( !isdigit(*(u8*)zDate) ){
        goto end_getDigits;
      }
      val = val*10 + *zDate - '0';
      zDate++;
    }
    if( val<min || val>max || (nextC!=0 && nextC!=*zDate) ){
      goto end_getDigits;
    }
    *pVal = val;
    zDate++;
    cnt++;
  }while( nextC );
end_getDigits:
  va_end(ap);
  return cnt;
}

/*
** Read text from z[] and convert into a floating point number.  Return
** the number of digits converted.
*/
#define getValue sqlite3AtoF

/*
** Parse a timezone extension on the end of a date-time.
** The extension is of the form:
**
**        (+/-)HH:MM
**
** Or the "zulu" notation:
**
**        Z
**
** If the parse is successful, write the number of minutes
** of change in p->tz and return 0.  If a parser error occurs,
** return non-zero.
**
** A missing specifier is not considered an error.
*/
static int parseTimezone(const char *zDate, DateTime *p){
  int sgn = 0;
  int nHr, nMn;
  int c;
  while( isspace(*(u8*)zDate) ){ zDate++; }
  p->tz = 0;
  c = *zDate;
  if( c=='-' ){
    sgn = -1;
  }else if( c=='+' ){
    sgn = +1;
  }else if( c=='Z' || c=='z' ){
    zDate++;
    goto zulu_time;
  }else{
    return c!=0;
  }
  zDate++;
  if( getDigits(zDate, 2, 0, 14, ':', &nHr, 2, 0, 59, 0, &nMn)!=2 ){
    return 1;
  }
  zDate += 5;
  p->tz = sgn*(nMn + nHr*60);
zulu_time:
  while( isspace(*(u8*)zDate) ){ zDate++; }
  return *zDate!=0;
}

/*
** Parse times of the form HH:MM or HH:MM:SS or HH:MM:SS.FFFF.
** The HH, MM, and SS must each be exactly 2 digits.  The
** fractional seconds FFFF can be one or more digits.
**
** Return 1 if there is a parsing error and 0 on success.
*/
static int parseHhMmSs(const char *zDate, DateTime *p){
  int h, m, s;
  double ms = 0.0;
  if( getDigits(zDate, 2, 0, 24, ':', &h, 2, 0, 59, 0, &m)!=2 ){
    return 1;
  }
  zDate += 5;
  if( *zDate==':' ){
    zDate++;
    if( getDigits(zDate, 2, 0, 59, 0, &s)!=1 ){
      return 1;
    }
    zDate += 2;
    if( *zDate=='.' && isdigit((u8)zDate[1]) ){
      double rScale = 1.0;
      zDate++;
      while( isdigit(*(u8*)zDate) ){
        ms = ms*10.0 + *zDate - '0';
        rScale *= 10.0;
        zDate++;
      }
      ms /= rScale;
    }
  }else{
    s = 0;
  }
  p->validJD = 0;
  p->validHMS = 1;
  p->h = h;
  p->m = m;
  p->s = s + ms;
  if( parseTimezone(zDate, p) ) return 1;
  p->validTZ = p->tz!=0;
  return 0;
}

/*
** Convert from YYYY-MM-DD HH:MM:SS to julian day.  We always assume
** that the YYYY-MM-DD is according to the Gregorian calendar.
**
** Reference:  Meeus page 61
*/
static void computeJD(DateTime *p){
  int Y, M, D, A, B, X1, X2;

  if( p->validJD ) return;
  if( p->validYMD ){
    Y = p->Y;
    M = p->M;
    D = p->D;
  }else{
    Y = 2000;  /* If no YMD specified, assume 2000-Jan-01 */
    M = 1;
    D = 1;
  }
  if( M<=2 ){
    Y--;
    M += 12;
  }
  A = Y/100;
  B = 2 - A + (A/4);
  X1 = 365.25*(Y+4716);
  X2 = 30.6001*(M+1);
  p->iJD = (X1 + X2 + D + B - 1524.5)*86400000;
  p->validJD = 1;
  if( p->validHMS ){
    p->iJD += p->h*3600000 + p->m*60000 + p->s*1000;
    if( p->validTZ ){
      p->iJD -= p->tz*60000;
      p->validYMD = 0;
      p->validHMS = 0;
      p->validTZ = 0;
    }
  }
}

/*
** Parse dates of the form
**
**     YYYY-MM-DD HH:MM:SS.FFF
**     YYYY-MM-DD HH:MM:SS
**     YYYY-MM-DD HH:MM
**     YYYY-MM-DD
**
** Write the result into the DateTime structure and return 0
** on success and 1 if the input string is not a well-formed
** date.
*/
static int parseYyyyMmDd(const char *zDate, DateTime *p){
  int Y, M, D, neg;

  if( zDate[0]=='-' ){
    zDate++;
    neg = 1;
  }else{
    neg = 0;
  }
  if( getDigits(zDate,4,0,9999,'-',&Y,2,1,12,'-',&M,2,1,31,0,&D)!=3 ){
    return 1;
  }
  zDate += 10;
  while( isspace(*(u8*)zDate) || 'T'==*(u8*)zDate ){ zDate++; }
  if( parseHhMmSs(zDate, p)==0 ){
    /* We got the time */
  }else if( *zDate==0 ){
    p->validHMS = 0;
  }else{
    return 1;
  }
  p->validJD = 0;
  p->validYMD = 1;
  p->Y = neg ? -Y : Y;
  p->M = M;
  p->D = D;
  if( p->validTZ ){
    computeJD(p);
  }
  return 0;
}

/*
** Set the time to the current time reported by the VFS
*/
static void setDateTimeToCurrent(sqlite3_context *context, DateTime *p){
  double r;
  sqlite3 *db = sqlite3_context_db_handle(context);
  sqlite3OsCurrentTime(db->pVfs, &r);
  p->iJD = (sqlite3_int64)(r*86400000.0 + 0.5);
  p->validJD = 1;
}

/*
** Attempt to parse the given string into a Julian Day Number.  Return
** the number of errors.
**
** The following are acceptable forms for the input string:
**
**      YYYY-MM-DD HH:MM:SS.FFF  +/-HH:MM
**      DDDD.DD 
**      now
**
** In the first form, the +/-HH:MM is always optional.  The fractional
** seconds extension (the ".FFF") is optional.  The seconds portion
** (":SS.FFF") is option.  The year and date can be omitted as long
** as there is a time string.  The time string can be omitted as long
** as there is a year and date.
*/
static int parseDateOrTime(
  sqlite3_context *context, 
  const char *zDate, 
  DateTime *p
){
  if( parseYyyyMmDd(zDate,p)==0 ){
    return 0;
  }else if( parseHhMmSs(zDate, p)==0 ){
    return 0;
  }else if( sqlite3StrICmp(zDate,"now")==0){
    setDateTimeToCurrent(context, p);
    return 0;
  }else if( sqlite3IsNumber(zDate, 0, SQLITE_UTF8) ){
    double r;
    getValue(zDate, &r);
    p->iJD = (sqlite3_int64)(r*86400000.0 + 0.5);
    p->validJD = 1;
    return 0;
  }
  return 1;
}

/*
** Compute the Year, Month, and Day from the julian day number.
*/
static void computeYMD(DateTime *p){
  int Z, A, B, C, D, E, X1;
  if( p->validYMD ) return;
  if( !p->validJD ){
    p->Y = 2000;
    p->M = 1;
    p->D = 1;
  }else{
    Z = (p->iJD + 43200000)/86400000;
    A = (Z - 1867216.25)/36524.25;
    A = Z + 1 + A - (A/4);
    B = A + 1524;
    C = (B - 122.1)/365.25;
    D = 365.25*C;
    E = (B-D)/30.6001;
    X1 = 30.6001*E;
    p->D = B - D - X1;
    p->M = E<14 ? E-1 : E-13;
    p->Y = p->M>2 ? C - 4716 : C - 4715;
  }
  p->validYMD = 1;
}

/*
** Compute the Hour, Minute, and Seconds from the julian day number.
*/
static void computeHMS(DateTime *p){
  int s;
  if( p->validHMS ) return;
  computeJD(p);
  s = (p->iJD + 43200000) % 86400000;
  p->s = s/1000.0;
  s = p->s;
  p->s -= s;
  p->h = s/3600;
  s -= p->h*3600;
  p->m = s/60;
  p->s += s - p->m*60;
  p->validHMS = 1;
}

/*
** Compute both YMD and HMS
*/
static void computeYMD_HMS(DateTime *p){
  computeYMD(p);
  computeHMS(p);
}

/*
** Clear the YMD and HMS and the TZ
*/
static void clearYMD_HMS_TZ(DateTime *p){
  p->validYMD = 0;
  p->validHMS = 0;
  p->validTZ = 0;
}

#ifndef SQLITE_OMIT_LOCALTIME
/*
** Compute the difference (in milliseconds)
** between localtime and UTC (a.k.a. GMT)
** for the time value p where p is in UTC.
*/
static int localtimeOffset(DateTime *p){
  DateTime x, y;
  time_t t;
  x = *p;
  computeYMD_HMS(&x);
  if( x.Y<1971 || x.Y>=2038 ){
    x.Y = 2000;
    x.M = 1;
    x.D = 1;
    x.h = 0;
    x.m = 0;
    x.s = 0.0;
  } else {
    int s = x.s + 0.5;
    x.s = s;
  }
  x.tz = 0;
  x.validJD = 0;
  computeJD(&x);
  t = x.iJD/1000 - 2440587.5*86400.0;
#ifdef HAVE_LOCALTIME_R
  {
    struct tm sLocal;
    localtime_r(&t, &sLocal);
    y.Y = sLocal.tm_year + 1900;
    y.M = sLocal.tm_mon + 1;
    y.D = sLocal.tm_mday;
    y.h = sLocal.tm_hour;
    y.m = sLocal.tm_min;
    y.s = sLocal.tm_sec;
  }
#elif defined(HAVE_LOCALTIME_S)
  {
    struct tm sLocal;
    localtime_s(&sLocal, &t);
    y.Y = sLocal.tm_year + 1900;
    y.M = sLocal.tm_mon + 1;
    y.D = sLocal.tm_mday;
    y.h = sLocal.tm_hour;
    y.m = sLocal.tm_min;
    y.s = sLocal.tm_sec;
  }
#else
  {
    struct tm *pTm;
    sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
    pTm = localtime(&t);
    y.Y = pTm->tm_year + 1900;
    y.M = pTm->tm_mon + 1;
    y.D = pTm->tm_mday;
    y.h = pTm->tm_hour;
    y.m = pTm->tm_min;
    y.s = pTm->tm_sec;
    sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
  }
#endif
  y.validYMD = 1;
  y.validHMS = 1;
  y.validJD = 0;
  y.validTZ = 0;
  computeJD(&y);
  return y.iJD - x.iJD;
}
#endif /* SQLITE_OMIT_LOCALTIME */

/*
** Process a modifier to a date-time stamp.  The modifiers are
** as follows:
**
**     NNN days
**     NNN hours
**     NNN minutes
**     NNN.NNNN seconds
**     NNN months
**     NNN years
**     start of month
**     start of year
**     start of week
**     start of day
**     weekday N
**     unixepoch
**     localtime
**     utc
**
** Return 0 on success and 1 if there is any kind of error.
*/
static int parseModifier(const char *zMod, DateTime *p){
  int rc = 1;
  int n;
  double r;
  char *z, zBuf[30];
  z = zBuf;
  for(n=0; n<sizeof(zBuf)-1 && zMod[n]; n++){
    z[n] = tolower(zMod[n]);
  }
  z[n] = 0;
  switch( z[0] ){
#ifndef SQLITE_OMIT_LOCALTIME
    case 'l': {
      /*    localtime
      **
      ** Assuming the current time value is UTC (a.k.a. GMT), shift it to
      ** show local time.
      */
      if( strcmp(z, "localtime")==0 ){
        computeJD(p);
        p->iJD += localtimeOffset(p);
        clearYMD_HMS_TZ(p);
        rc = 0;
      }
      break;
    }
#endif
    case 'u': {
      /*
      **    unixepoch
      **
      ** Treat the current value of p->iJD as the number of
      ** seconds since 1970.  Convert to a real julian day number.
      */
      if( strcmp(z, "unixepoch")==0 && p->validJD ){
        p->iJD = p->iJD/86400.0 + 2440587.5*86400000.0;
        clearYMD_HMS_TZ(p);
        rc = 0;
      }
#ifndef SQLITE_OMIT_LOCALTIME
      else if( strcmp(z, "utc")==0 ){
        double c1;
        computeJD(p);
        c1 = localtimeOffset(p);
        p->iJD -= c1;
        clearYMD_HMS_TZ(p);
        p->iJD += c1 - localtimeOffset(p);
        rc = 0;
      }
#endif
      break;
    }
    case 'w': {
      /*
      **    weekday N
      **
      ** Move the date to the same time on the next occurrence of
      ** weekday N where 0==Sunday, 1==Monday, and so forth.  If the
      ** date is already on the appropriate weekday, this is a no-op.
      */
      if( strncmp(z, "weekday ", 8)==0 && getValue(&z[8],&r)>0
                 && (n=r)==r && n>=0 && r<7 ){
        sqlite3_int64 Z;
        computeYMD_HMS(p);
        p->validTZ = 0;
        p->validJD = 0;
        computeJD(p);
        Z = ((p->iJD + 129600000)/86400000) % 7;
        if( Z>n ) Z -= 7;
        p->iJD += (n - Z)*86400000;
        clearYMD_HMS_TZ(p);
        rc = 0;
      }
      break;
    }
    case 's': {
      /*
      **    start of TTTTT
      **
      ** Move the date backwards to the beginning of the current day,
      ** or month or year.
      */
      if( strncmp(z, "start of ", 9)!=0 ) break;
      z += 9;
      computeYMD(p);
      p->validHMS = 1;
      p->h = p->m = 0;
      p->s = 0.0;
      p->validTZ = 0;
      p->validJD = 0;
      if( strcmp(z,"month")==0 ){
        p->D = 1;
        rc = 0;
      }else if( strcmp(z,"year")==0 ){
        computeYMD(p);
        p->M = 1;
        p->D = 1;
        rc = 0;
      }else if( strcmp(z,"day")==0 ){
        rc = 0;
      }
      break;
    }
    case '+':
    case '-':
    case '0':
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9': {
      n = getValue(z, &r);
      assert( n>=1 );
      if( z[n]==':' ){
        /* A modifier of the form (+|-)HH:MM:SS.FFF adds (or subtracts) the
        ** specified number of hours, minutes, seconds, and fractional seconds
        ** to the time.  The ".FFF" may be omitted.  The ":SS.FFF" may be
        ** omitted.
        */
        const char *z2 = z;
        DateTime tx;
        sqlite3_int64 day;
        if( !isdigit(*(u8*)z2) ) z2++;
        memset(&tx, 0, sizeof(tx));
        if( parseHhMmSs(z2, &tx) ) break;
        computeJD(&tx);
        tx.iJD -= 43200000;
        day = tx.iJD/86400000;
        tx.iJD -= day*86400000;
        if( z[0]=='-' ) tx.iJD = -tx.iJD;
        computeJD(p);
        clearYMD_HMS_TZ(p);
        p->iJD += tx.iJD;
        rc = 0;
        break;
      }
      z += n;
      while( isspace(*(u8*)z) ) z++;
      n = strlen(z);
      if( n>10 || n<3 ) break;
      if( z[n-1]=='s' ){ z[n-1] = 0; n--; }
      computeJD(p);
      rc = 0;
      if( n==3 && strcmp(z,"day")==0 ){
        p->iJD += r*86400000.0 + 0.5;
      }else if( n==4 && strcmp(z,"hour")==0 ){
        p->iJD += r*(86400000.0/24.0) + 0.5;
      }else if( n==6 && strcmp(z,"minute")==0 ){
        p->iJD += r*(86400000.0/(24.0*60.0)) + 0.5;
      }else if( n==6 && strcmp(z,"second")==0 ){
        p->iJD += r*(86400000.0/(24.0*60.0*60.0)) + 0.5;
      }else if( n==5 && strcmp(z,"month")==0 ){
        int x, y;
        computeYMD_HMS(p);
        p->M += r;
        x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12;
        p->Y += x;
        p->M -= x*12;
        p->validJD = 0;
        computeJD(p);
        y = r;
        if( y!=r ){
          p->iJD += (r - y)*30.0*86400000.0 + 0.5;
        }
      }else if( n==4 && strcmp(z,"year")==0 ){
        computeYMD_HMS(p);
        p->Y += r;
        p->validJD = 0;
        computeJD(p);
      }else{
        rc = 1;
      }
      clearYMD_HMS_TZ(p);
      break;
    }
    default: {
      break;
    }
  }
  return rc;
}

/*
** Process time function arguments.  argv[0] is a date-time stamp.
** argv[1] and following are modifiers.  Parse them all and write
** the resulting time into the DateTime structure p.  Return 0
** on success and 1 if there are any errors.
**
** If there are zero parameters (if even argv[0] is undefined)
** then assume a default value of "now" for argv[0].
*/
static int isDate(
  sqlite3_context *context, 
  int argc, 
  sqlite3_value **argv, 
  DateTime *p
){
  int i;
  const unsigned char *z;
  int eType;
  memset(p, 0, sizeof(*p));
  if( argc==0 ){
    setDateTimeToCurrent(context, p);
  }else if( (eType = sqlite3_value_type(argv[0]))==SQLITE_FLOAT
                   || eType==SQLITE_INTEGER ){
    p->iJD = sqlite3_value_double(argv[0])*86400000.0 + 0.5;
    p->validJD = 1;
  }else{
    z = sqlite3_value_text(argv[0]);
    if( !z || parseDateOrTime(context, (char*)z, p) ){
      return 1;
    }
  }
  for(i=1; i<argc; i++){
    if( (z = sqlite3_value_text(argv[i]))==0 || parseModifier((char*)z, p) ){
      return 1;
    }
  }
  return 0;
}


/*
** The following routines implement the various date and time functions
** of SQLite.
*/

/*
**    julianday( TIMESTRING, MOD, MOD, ...)
**
** Return the julian day number of the date specified in the arguments
*/
static void juliandayFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  DateTime x;
  if( isDate(context, argc, argv, &x)==0 ){
    computeJD(&x);
    sqlite3_result_double(context, x.iJD/86400000.0);
  }
}

/*
**    datetime( TIMESTRING, MOD, MOD, ...)
**
** Return YYYY-MM-DD HH:MM:SS
*/
static void datetimeFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  DateTime x;
  if( isDate(context, argc, argv, &x)==0 ){
    char zBuf[100];
    computeYMD_HMS(&x);
    sqlite3_snprintf(sizeof(zBuf), zBuf, "%04d-%02d-%02d %02d:%02d:%02d",
                     x.Y, x.M, x.D, x.h, x.m, (int)(x.s));
    sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
  }
}

/*
**    time( TIMESTRING, MOD, MOD, ...)
**
** Return HH:MM:SS
*/
static void timeFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  DateTime x;
  if( isDate(context, argc, argv, &x)==0 ){
    char zBuf[100];
    computeHMS(&x);
    sqlite3_snprintf(sizeof(zBuf), zBuf, "%02d:%02d:%02d", x.h, x.m, (int)x.s);
    sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
  }
}

/*
**    date( TIMESTRING, MOD, MOD, ...)
**
** Return YYYY-MM-DD
*/
static void dateFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  DateTime x;
  if( isDate(context, argc, argv, &x)==0 ){
    char zBuf[100];
    computeYMD(&x);
    sqlite3_snprintf(sizeof(zBuf), zBuf, "%04d-%02d-%02d", x.Y, x.M, x.D);
    sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
  }
}

/*
**    strftime( FORMAT, TIMESTRING, MOD, MOD, ...)
**
** Return a string described by FORMAT.  Conversions as follows:
**
**   %d  day of month
**   %f  ** fractional seconds  SS.SSS
**   %H  hour 00-24
**   %j  day of year 000-366
**   %J  ** Julian day number
**   %m  month 01-12
**   %M  minute 00-59
**   %s  seconds since 1970-01-01
**   %S  seconds 00-59
**   %w  day of week 0-6  sunday==0
**   %W  week of year 00-53
**   %Y  year 0000-9999
**   %%  %
*/
static void strftimeFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  DateTime x;
  u64 n;
  int i, j;
  char *z;
  sqlite3 *db;
  const char *zFmt = (const char*)sqlite3_value_text(argv[0]);
  char zBuf[100];
  if( zFmt==0 || isDate(context, argc-1, argv+1, &x) ) return;
  db = sqlite3_context_db_handle(context);
  for(i=0, n=1; zFmt[i]; i++, n++){
    if( zFmt[i]=='%' ){
      switch( zFmt[i+1] ){
        case 'd':
        case 'H':
        case 'm':
        case 'M':
        case 'S':
        case 'W':
          n++;
          /* fall thru */
        case 'w':
        case '%':
          break;
        case 'f':
          n += 8;
          break;
        case 'j':
          n += 3;
          break;
        case 'Y':
          n += 8;
          break;
        case 's':
        case 'J':
          n += 50;
          break;
        default:
          return;  /* ERROR.  return a NULL */
      }
      i++;
    }
  }
  if( n<sizeof(zBuf) ){
    z = zBuf;
  }else if( n>db->aLimit[SQLITE_LIMIT_LENGTH] ){
    sqlite3_result_error_toobig(context);
    return;
  }else{
    z = sqlite3DbMallocRaw(db, n);
    if( z==0 ){
      sqlite3_result_error_nomem(context);
      return;
    }
  }
  computeJD(&x);
  computeYMD_HMS(&x);
  for(i=j=0; zFmt[i]; i++){
    if( zFmt[i]!='%' ){
      z[j++] = zFmt[i];
    }else{
      i++;
      switch( zFmt[i] ){
        case 'd':  sqlite3_snprintf(3, &z[j],"%02d",x.D); j+=2; break;
        case 'f': {
          double s = x.s;
          if( s>59.999 ) s = 59.999;
          sqlite3_snprintf(7, &z[j],"%06.3f", s);
          j += strlen(&z[j]);
          break;
        }
        case 'H':  sqlite3_snprintf(3, &z[j],"%02d",x.h); j+=2; break;
        case 'W': /* Fall thru */
        case 'j': {
          int nDay;             /* Number of days since 1st day of year */
          DateTime y = x;
          y.validJD = 0;
          y.M = 1;
          y.D = 1;
          computeJD(&y);
          nDay = (x.iJD - y.iJD)/86400000.0 + 0.5;
          if( zFmt[i]=='W' ){
            int wd;   /* 0=Monday, 1=Tuesday, ... 6=Sunday */
            wd = ((x.iJD+43200000)/86400000) % 7;
            sqlite3_snprintf(3, &z[j],"%02d",(nDay+7-wd)/7);
            j += 2;
          }else{
            sqlite3_snprintf(4, &z[j],"%03d",nDay+1);
            j += 3;
          }
          break;
        }
        case 'J': {
          sqlite3_snprintf(20, &z[j],"%.16g",x.iJD/86400000.0);
          j+=strlen(&z[j]);
          break;
        }
        case 'm':  sqlite3_snprintf(3, &z[j],"%02d",x.M); j+=2; break;
        case 'M':  sqlite3_snprintf(3, &z[j],"%02d",x.m); j+=2; break;
        case 's': {
          sqlite3_snprintf(30,&z[j],"%d",
                           (int)(x.iJD/1000.0 - 210866760000.0));
          j += strlen(&z[j]);
          break;
        }
        case 'S':  sqlite3_snprintf(3,&z[j],"%02d",(int)x.s); j+=2; break;
        case 'w':  z[j++] = (((x.iJD+129600000)/86400000) % 7) + '0'; break;
        case 'Y':  sqlite3_snprintf(5,&z[j],"%04d",x.Y); j+=strlen(&z[j]);break;
        default:   z[j++] = '%'; break;
      }
    }
  }
  z[j] = 0;
  sqlite3_result_text(context, z, -1,
                      z==zBuf ? SQLITE_TRANSIENT : SQLITE_DYNAMIC);
}

/*
** current_time()
**
** This function returns the same value as time('now').
*/
static void ctimeFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  timeFunc(context, 0, 0);
}

/*
** current_date()
**
** This function returns the same value as date('now').
*/
static void cdateFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  dateFunc(context, 0, 0);
}

/*
** current_timestamp()
**
** This function returns the same value as datetime('now').
*/
static void ctimestampFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  datetimeFunc(context, 0, 0);
}
#endif /* !defined(SQLITE_OMIT_DATETIME_FUNCS) */

#ifdef SQLITE_OMIT_DATETIME_FUNCS
/*
** If the library is compiled to omit the full-scale date and time
** handling (to get a smaller binary), the following minimal version
** of the functions current_time(), current_date() and current_timestamp()
** are included instead. This is to support column declarations that
** include "DEFAULT CURRENT_TIME" etc.
**
** This function uses the C-library functions time(), gmtime()
** and strftime(). The format string to pass to strftime() is supplied
** as the user-data for the function.
*/
static void currentTimeFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  time_t t;
  char *zFormat = (char *)sqlite3_user_data(context);
  sqlite3 *db;
  double rT;
  char zBuf[20];

  db = sqlite3_context_db_handle(context);
  sqlite3OsCurrentTime(db->pVfs, &rT);
  t = 86400.0*(rT - 2440587.5) + 0.5;
#ifdef HAVE_GMTIME_R
  {
    struct tm sNow;
    gmtime_r(&t, &sNow);
    strftime(zBuf, 20, zFormat, &sNow);
  }
#else
  {
    struct tm *pTm;
    sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
    pTm = gmtime(&t);
    strftime(zBuf, 20, zFormat, pTm);
    sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
  }
#endif

  sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT);
}
#endif

/*
** This function registered all of the above C functions as SQL
** functions.  This should be the only routine in this file with
** external linkage.
*/
void sqlite3RegisterDateTimeFunctions(sqlite3 *db){
#ifndef SQLITE_OMIT_DATETIME_FUNCS
  static const struct {
     char *zName;
     int nArg;
     void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
  } aFuncs[] = {
    { "julianday", -1, juliandayFunc   },
    { "date",      -1, dateFunc        },
    { "time",      -1, timeFunc        },
    { "datetime",  -1, datetimeFunc    },
    { "strftime",  -1, strftimeFunc    },
    { "current_time",       0, ctimeFunc      },
    { "current_timestamp",  0, ctimestampFunc },
    { "current_date",       0, cdateFunc      },
  };
  int i;

  for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){
    sqlite3CreateFunc(db, aFuncs[i].zName, aFuncs[i].nArg,
        SQLITE_UTF8, 0, aFuncs[i].xFunc, 0, 0);
  }
#else
  static const struct {
     char *zName;
     char *zFormat;
  } aFuncs[] = {
    { "current_time", "%H:%M:%S" },
    { "current_date", "%Y-%m-%d" },
    { "current_timestamp", "%Y-%m-%d %H:%M:%S" }
  };
  int i;

  for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){
    sqlite3CreateFunc(db, aFuncs[i].zName, 0, SQLITE_UTF8, 
        aFuncs[i].zFormat, currentTimeFunc, 0, 0);
  }
#endif
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/delete.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** in order to generate code for DELETE FROM statements.
**
** $Id: delete.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** Look up every table that is named in pSrc.  If any table is not found,
** add an error message to pParse->zErrMsg and return NULL.  If all tables
** are found, return a pointer to the last table.
*/
Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){
  Table *pTab = 0;
  int i;
  struct SrcList_item *pItem;
  for(i=0, pItem=pSrc->a; i<pSrc->nSrc; i++, pItem++){
    pTab = sqlite3LocateTable(pParse, 0, pItem->zName, pItem->zDatabase);
    sqlite3DeleteTable(pItem->pTab);
    pItem->pTab = pTab;
    if( pTab ){
      pTab->nRef++;
    }
  }
  return pTab;
}

/*
** Check to make sure the given table is writable.  If it is not
** writable, generate an error message and return 1.  If it is
** writable return 0;
*/
int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){
  if( (pTab->readOnly && (pParse->db->flags & SQLITE_WriteSchema)==0
        && pParse->nested==0) 
#ifndef SQLITE_OMIT_VIRTUALTABLE
      || (pTab->pMod && pTab->pMod->pModule->xUpdate==0)
#endif
  ){
    sqlite3ErrorMsg(pParse, "table %s may not be modified", pTab->zName);
    return 1;
  }
#ifndef SQLITE_OMIT_VIEW
  if( !viewOk && pTab->pSelect ){
    sqlite3ErrorMsg(pParse,"cannot modify %s because it is a view",pTab->zName);
    return 1;
  }
#endif
  return 0;
}

/*
** Generate code that will open a table for reading.
*/
void sqlite3OpenTable(
  Parse *p,       /* Generate code into this VDBE */
  int iCur,       /* The cursor number of the table */
  int iDb,        /* The database index in sqlite3.aDb[] */
  Table *pTab,    /* The table to be opened */
  int opcode      /* OP_OpenRead or OP_OpenWrite */
){
  Vdbe *v;
  if( IsVirtual(pTab) ) return;
  v = sqlite3GetVdbe(p);
  assert( opcode==OP_OpenWrite || opcode==OP_OpenRead );
  sqlite3TableLock(p, iDb, pTab->tnum, (opcode==OP_OpenWrite), pTab->zName);
  sqlite3VdbeAddOp2(v, OP_SetNumColumns, 0, pTab->nCol);
  sqlite3VdbeAddOp3(v, opcode, iCur, pTab->tnum, iDb);
  VdbeComment((v, "%s", pTab->zName));
}


#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER)
/*
** Evaluate a view and store its result in an ephemeral table.  The
** pWhere argument is an optional WHERE clause that restricts the
** set of rows in the view that are to be added to the ephemeral table.
*/
void sqlite3MaterializeView(
  Parse *pParse,       /* Parsing context */
  Select *pView,       /* View definition */
  Expr *pWhere,        /* Optional WHERE clause to be added */
  int iCur             /* Cursor number for ephemerial table */
){
  SelectDest dest;
  Select *pDup;
  sqlite3 *db = pParse->db;

  pDup = sqlite3SelectDup(db, pView);
  if( pWhere ){
    SrcList *pFrom;
    
    pWhere = sqlite3ExprDup(db, pWhere);
    pFrom = sqlite3SrcListAppendFromTerm(pParse, 0, 0, 0, 0, pDup, 0, 0);
    pDup = sqlite3SelectNew(pParse, 0, pFrom, pWhere, 0, 0, 0, 0, 0, 0);
  }
  sqlite3SelectDestInit(&dest, SRT_EphemTab, iCur);
  sqlite3Select(pParse, pDup, &dest, 0, 0, 0);
  sqlite3SelectDelete(db, pDup);
}
#endif /* !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) */


/*
** Generate code for a DELETE FROM statement.
**
**     DELETE FROM table_wxyz WHERE a<5 AND b NOT NULL;
**                 \________/       \________________/
**                  pTabList              pWhere
*/
void sqlite3DeleteFrom(
  Parse *pParse,         /* The parser context */
  SrcList *pTabList,     /* The table from which we should delete things */
  Expr *pWhere           /* The WHERE clause.  May be null */
){
  Vdbe *v;               /* The virtual database engine */
  Table *pTab;           /* The table from which records will be deleted */
  const char *zDb;       /* Name of database holding pTab */
  int end, addr = 0;     /* A couple addresses of generated code */
  int i;                 /* Loop counter */
  WhereInfo *pWInfo;     /* Information about the WHERE clause */
  Index *pIdx;           /* For looping over indices of the table */
  int iCur;              /* VDBE Cursor number for pTab */
  sqlite3 *db;           /* Main database structure */
  AuthContext sContext;  /* Authorization context */
  int oldIdx = -1;       /* Cursor for the OLD table of AFTER triggers */
  NameContext sNC;       /* Name context to resolve expressions in */
  int iDb;               /* Database number */
  int memCnt = 0;        /* Memory cell used for change counting */

#ifndef SQLITE_OMIT_TRIGGER
  int isView;                  /* True if attempting to delete from a view */
  int triggers_exist = 0;      /* True if any triggers exist */
#endif
  int iBeginAfterTrigger;      /* Address of after trigger program */
  int iEndAfterTrigger;        /* Exit of after trigger program */
  int iBeginBeforeTrigger;     /* Address of before trigger program */
  int iEndBeforeTrigger;       /* Exit of before trigger program */
  u32 old_col_mask = 0;        /* Mask of OLD.* columns in use */

  sContext.pParse = 0;
  db = pParse->db;
  if( pParse->nErr || db->mallocFailed ){
    goto delete_from_cleanup;
  }
  assert( pTabList->nSrc==1 );

  /* Locate the table which we want to delete.  This table has to be
  ** put in an SrcList structure because some of the subroutines we
  ** will be calling are designed to work with multiple tables and expect
  ** an SrcList* parameter instead of just a Table* parameter.
  */
  pTab = sqlite3SrcListLookup(pParse, pTabList);
  if( pTab==0 )  goto delete_from_cleanup;

  /* Figure out if we have any triggers and if the table being
  ** deleted from is a view
  */
#ifndef SQLITE_OMIT_TRIGGER
  triggers_exist = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0);
  isView = pTab->pSelect!=0;
#else
# define triggers_exist 0
# define isView 0
#endif
#ifdef SQLITE_OMIT_VIEW
# undef isView
# define isView 0
#endif

  if( sqlite3IsReadOnly(pParse, pTab, triggers_exist) ){
    goto delete_from_cleanup;
  }
  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
  assert( iDb<db->nDb );
  zDb = db->aDb[iDb].zName;
  if( sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb) ){
    goto delete_from_cleanup;
  }

  /* If pTab is really a view, make sure it has been initialized.
  */
  if( sqlite3ViewGetColumnNames(pParse, pTab) ){
    goto delete_from_cleanup;
  }

  /* Allocate a cursor used to store the old.* data for a trigger.
  */
  if( triggers_exist ){ 
    oldIdx = pParse->nTab++;
  }

  /* Assign  cursor number to the table and all its indices.
  */
  assert( pTabList->nSrc==1 );
  iCur = pTabList->a[0].iCursor = pParse->nTab++;
  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
    pParse->nTab++;
  }

  /* Start the view context
  */
  if( isView ){
    sqlite3AuthContextPush(pParse, &sContext, pTab->zName);
  }

  /* Begin generating code.
  */
  v = sqlite3GetVdbe(pParse);
  if( v==0 ){
    goto delete_from_cleanup;
  }
  if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);
  sqlite3BeginWriteOperation(pParse, triggers_exist, iDb);

  if( triggers_exist ){
    int orconf = ((pParse->trigStack)?pParse->trigStack->orconf:OE_Default);
    int iGoto = sqlite3VdbeAddOp0(v, OP_Goto);
    addr = sqlite3VdbeMakeLabel(v);

    iBeginBeforeTrigger = sqlite3VdbeCurrentAddr(v);
    (void)sqlite3CodeRowTrigger(pParse, TK_DELETE, 0, TRIGGER_BEFORE, pTab,
        -1, oldIdx, orconf, addr, &old_col_mask, 0);
    iEndBeforeTrigger = sqlite3VdbeAddOp0(v, OP_Goto);

    iBeginAfterTrigger = sqlite3VdbeCurrentAddr(v);
    (void)sqlite3CodeRowTrigger(pParse, TK_DELETE, 0, TRIGGER_AFTER, pTab, -1,
        oldIdx, orconf, addr, &old_col_mask, 0);
    iEndAfterTrigger = sqlite3VdbeAddOp0(v, OP_Goto);

    sqlite3VdbeJumpHere(v, iGoto);
  }

  /* If we are trying to delete from a view, realize that view into
  ** a ephemeral table.
  */
  if( isView ){
    sqlite3MaterializeView(pParse, pTab->pSelect, pWhere, iCur);
  }

  /* Resolve the column names in the WHERE clause.
  */
  memset(&sNC, 0, sizeof(sNC));
  sNC.pParse = pParse;
  sNC.pSrcList = pTabList;
  if( sqlite3ExprResolveNames(&sNC, pWhere) ){
    goto delete_from_cleanup;
  }

  /* Initialize the counter of the number of rows deleted, if
  ** we are counting rows.
  */
  if( db->flags & SQLITE_CountRows ){
    memCnt = ++pParse->nMem;
    sqlite3VdbeAddOp2(v, OP_Integer, 0, memCnt);
  }

  /* Special case: A DELETE without a WHERE clause deletes everything.
  ** It is easier just to erase the whole table.  Note, however, that
  ** this means that the row change count will be incorrect.
  */
  if( pWhere==0 && !triggers_exist && !IsVirtual(pTab) ){
    if( db->flags & SQLITE_CountRows ){
      /* If counting rows deleted, just count the total number of
      ** entries in the table. */
      int addr2;
      if( !isView ){
        sqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenRead);
      }
      sqlite3VdbeAddOp2(v, OP_Rewind, iCur, sqlite3VdbeCurrentAddr(v)+2);
      addr2 = sqlite3VdbeAddOp2(v, OP_AddImm, memCnt, 1);
      sqlite3VdbeAddOp2(v, OP_Next, iCur, addr2);
      sqlite3VdbeAddOp1(v, OP_Close, iCur);
    }
    if( !isView ){
      sqlite3VdbeAddOp2(v, OP_Clear, pTab->tnum, iDb);
      if( !pParse->nested ){
        sqlite3VdbeChangeP4(v, -1, pTab->zName, P4_STATIC);
      }
      for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
        assert( pIdx->pSchema==pTab->pSchema );
        sqlite3VdbeAddOp2(v, OP_Clear, pIdx->tnum, iDb);
      }
    }
  } 
  /* The usual case: There is a WHERE clause so we have to scan through
  ** the table and pick which records to delete.
  */
  else{
    int iRowid = ++pParse->nMem;    /* Used for storing rowid values. */

    /* Begin the database scan
    */
    pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0);
    if( pWInfo==0 ) goto delete_from_cleanup;

    /* Remember the rowid of every item to be deleted.
    */
    sqlite3VdbeAddOp2(v, IsVirtual(pTab) ? OP_VRowid : OP_Rowid, iCur, iRowid);
    sqlite3VdbeAddOp1(v, OP_FifoWrite, iRowid);
    if( db->flags & SQLITE_CountRows ){
      sqlite3VdbeAddOp2(v, OP_AddImm, memCnt, 1);
    }

    /* End the database scan loop.
    */
    sqlite3WhereEnd(pWInfo);

    /* Open the pseudo-table used to store OLD if there are triggers.
    */
    if( triggers_exist ){
      sqlite3VdbeAddOp2(v, OP_SetNumColumns, 0, pTab->nCol);
      sqlite3VdbeAddOp1(v, OP_OpenPseudo, oldIdx);
    }

    /* Delete every item whose key was written to the list during the
    ** database scan.  We have to delete items after the scan is complete
    ** because deleting an item can change the scan order.
    */
    end = sqlite3VdbeMakeLabel(v);

    if( !isView ){
      /* Open cursors for the table we are deleting from and 
      ** all its indices.
      */
      sqlite3OpenTableAndIndices(pParse, pTab, iCur, OP_OpenWrite);
    }

    /* This is the beginning of the delete loop. If a trigger encounters
    ** an IGNORE constraint, it jumps back to here.
    */
    if( triggers_exist ){
      sqlite3VdbeResolveLabel(v, addr);
    }
    addr = sqlite3VdbeAddOp2(v, OP_FifoRead, iRowid, end);

    if( triggers_exist ){
      int iData = ++pParse->nMem;   /* For storing row data of OLD table */

      /* If the record is no longer present in the table, jump to the
      ** next iteration of the loop through the contents of the fifo.
      */
      sqlite3VdbeAddOp3(v, OP_NotExists, iCur, addr, iRowid);

      /* Populate the OLD.* pseudo-table */
      if( old_col_mask ){
        sqlite3VdbeAddOp2(v, OP_RowData, iCur, iData);
      }else{
        sqlite3VdbeAddOp2(v, OP_Null, 0, iData);
      }
      sqlite3VdbeAddOp3(v, OP_Insert, oldIdx, iData, iRowid);

      /* Jump back and run the BEFORE triggers */
      sqlite3VdbeAddOp2(v, OP_Goto, 0, iBeginBeforeTrigger);
      sqlite3VdbeJumpHere(v, iEndBeforeTrigger);
    }

    if( !isView ){
      /* Delete the row */
#ifndef SQLITE_OMIT_VIRTUALTABLE
      if( IsVirtual(pTab) ){
        const char *pVtab = (const char *)pTab->pVtab;
        sqlite3VtabMakeWritable(pParse, pTab);
        sqlite3VdbeAddOp4(v, OP_VUpdate, 0, 1, iRowid, pVtab, P4_VTAB);
      }else
#endif
      {
        sqlite3GenerateRowDelete(pParse, pTab, iCur, iRowid, pParse->nested==0);
      }
    }

    /* If there are row triggers, close all cursors then invoke
    ** the AFTER triggers
    */
    if( triggers_exist ){
      /* Jump back and run the AFTER triggers */
      sqlite3VdbeAddOp2(v, OP_Goto, 0, iBeginAfterTrigger);
      sqlite3VdbeJumpHere(v, iEndAfterTrigger);
    }

    /* End of the delete loop */
    sqlite3VdbeAddOp2(v, OP_Goto, 0, addr);
    sqlite3VdbeResolveLabel(v, end);

    /* Close the cursors after the loop if there are no row triggers */
    if( !isView  && !IsVirtual(pTab) ){
      for(i=1, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
        sqlite3VdbeAddOp2(v, OP_Close, iCur + i, pIdx->tnum);
      }
      sqlite3VdbeAddOp1(v, OP_Close, iCur);
    }
  }

  /*
  ** Return the number of rows that were deleted. If this routine is 
  ** generating code because of a call to sqlite3NestedParse(), do not
  ** invoke the callback function.
  */
  if( db->flags & SQLITE_CountRows && pParse->nested==0 && !pParse->trigStack ){
    sqlite3VdbeAddOp2(v, OP_ResultRow, memCnt, 1);
    sqlite3VdbeSetNumCols(v, 1);
    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows deleted", P4_STATIC);
  }

delete_from_cleanup:
  sqlite3AuthContextPop(&sContext);
  sqlite3SrcListDelete(db, pTabList);
  sqlite3ExprDelete(db, pWhere);
  return;
}

/*
** This routine generates VDBE code that causes a single row of a
** single table to be deleted.
**
** The VDBE must be in a particular state when this routine is called.
** These are the requirements:
**
**   1.  A read/write cursor pointing to pTab, the table containing the row
**       to be deleted, must be opened as cursor number "base".
**
**   2.  Read/write cursors for all indices of pTab must be open as
**       cursor number base+i for the i-th index.
**
**   3.  The record number of the row to be deleted must be stored in
**       memory cell iRowid.
**
** This routine pops the top of the stack to remove the record number
** and then generates code to remove both the table record and all index
** entries that point to that record.
*/
void sqlite3GenerateRowDelete(
  Parse *pParse,     /* Parsing context */
  Table *pTab,       /* Table containing the row to be deleted */
  int iCur,          /* Cursor number for the table */
  int iRowid,        /* Memory cell that contains the rowid to delete */
  int count          /* Increment the row change counter */
){
  int addr;
  Vdbe *v;

  v = pParse->pVdbe;
  addr = sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, iRowid);
  sqlite3GenerateRowIndexDelete(pParse, pTab, iCur, 0);
  sqlite3VdbeAddOp2(v, OP_Delete, iCur, (count?OPFLAG_NCHANGE:0));
  if( count ){
    sqlite3VdbeChangeP4(v, -1, pTab->zName, P4_STATIC);
  }
  sqlite3VdbeJumpHere(v, addr);
}

/*
** This routine generates VDBE code that causes the deletion of all
** index entries associated with a single row of a single table.
**
** The VDBE must be in a particular state when this routine is called.
** These are the requirements:
**
**   1.  A read/write cursor pointing to pTab, the table containing the row
**       to be deleted, must be opened as cursor number "iCur".
**
**   2.  Read/write cursors for all indices of pTab must be open as
**       cursor number iCur+i for the i-th index.
**
**   3.  The "iCur" cursor must be pointing to the row that is to be
**       deleted.
*/
void sqlite3GenerateRowIndexDelete(
  Parse *pParse,     /* Parsing and code generating context */
  Table *pTab,       /* Table containing the row to be deleted */
  int iCur,          /* Cursor number for the table */
  int *aRegIdx       /* Only delete if aRegIdx!=0 && aRegIdx[i]>0 */
){
  int i;
  Index *pIdx;
  int r1;

  for(i=1, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){
    if( aRegIdx!=0 && aRegIdx[i-1]==0 ) continue;
    r1 = sqlite3GenerateIndexKey(pParse, pIdx, iCur, 0, 0);
    sqlite3VdbeAddOp3(pParse->pVdbe, OP_IdxDelete, iCur+i, r1,pIdx->nColumn+1);
  }
}

/*
** Generate code that will assemble an index key and put it in register
** regOut.  The key with be for index pIdx which is an index on pTab.
** iCur is the index of a cursor open on the pTab table and pointing to
** the entry that needs indexing.
**
** Return a register number which is the first in a block of
** registers that holds the elements of the index key.  The
** block of registers has already been deallocated by the time
** this routine returns.
*/
int sqlite3GenerateIndexKey(
  Parse *pParse,     /* Parsing context */
  Index *pIdx,       /* The index for which to generate a key */
  int iCur,          /* Cursor number for the pIdx->pTable table */
  int regOut,        /* Write the new index key to this register */
  int doMakeRec      /* Run the OP_MakeRecord instruction if true */
){
  Vdbe *v = pParse->pVdbe;
  int j;
  Table *pTab = pIdx->pTable;
  int regBase;
  int nCol;

  nCol = pIdx->nColumn;
  regBase = sqlite3GetTempRange(pParse, nCol+1);
  sqlite3VdbeAddOp2(v, OP_Rowid, iCur, regBase+nCol);
  for(j=0; j<nCol; j++){
    int idx = pIdx->aiColumn[j];
    if( idx==pTab->iPKey ){
      sqlite3VdbeAddOp2(v, OP_SCopy, regBase+nCol, regBase+j);
    }else{
      sqlite3VdbeAddOp3(v, OP_Column, iCur, idx, regBase+j);
      sqlite3ColumnDefault(v, pTab, idx);
    }
  }
  if( doMakeRec ){
    sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol+1, regOut);
    sqlite3IndexAffinityStr(v, pIdx);
    sqlite3ExprCacheAffinityChange(pParse, regBase, nCol+1);
  }
  sqlite3ReleaseTempRange(pParse, regBase, nCol+1);
  return regBase;
}

/* Make sure "isView" gets undefined in case this file becomes part of
** the amalgamation - so that subsequent files do not see isView as a
** macro. */
#undef isView
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/expr.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite.
**
** $Id: expr.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** Return the 'affinity' of the expression pExpr if any.
**
** If pExpr is a column, a reference to a column via an 'AS' alias,
** or a sub-select with a column as the return value, then the 
** affinity of that column is returned. Otherwise, 0x00 is returned,
** indicating no affinity for the expression.
**
** i.e. the WHERE clause expresssions in the following statements all
** have an affinity:
**
** CREATE TABLE t1(a);
** SELECT * FROM t1 WHERE a;
** SELECT a AS b FROM t1 WHERE b;
** SELECT * FROM t1 WHERE (select a from t1);
*/
char sqlite3ExprAffinity(Expr *pExpr){
  int op = pExpr->op;
  if( op==TK_SELECT ){
    return sqlite3ExprAffinity(pExpr->pSelect->pEList->a[0].pExpr);
  }
#ifndef SQLITE_OMIT_CAST
  if( op==TK_CAST ){
    return sqlite3AffinityType(&pExpr->token);
  }
#endif
  return pExpr->affinity;
}

/*
** Set the collating sequence for expression pExpr to be the collating
** sequence named by pToken.   Return a pointer to the revised expression.
** The collating sequence is marked as "explicit" using the EP_ExpCollate
** flag.  An explicit collating sequence will override implicit
** collating sequences.
*/
Expr *sqlite3ExprSetColl(Parse *pParse, Expr *pExpr, Token *pName){
  char *zColl = 0;            /* Dequoted name of collation sequence */
  CollSeq *pColl;
  sqlite3 *db = pParse->db;
  zColl = sqlite3NameFromToken(db, pName);
  if( pExpr && zColl ){
    pColl = sqlite3LocateCollSeq(pParse, zColl, -1);
    if( pColl ){
      pExpr->pColl = pColl;
      pExpr->flags |= EP_ExpCollate;
    }
  }
  sqlite3DbFree(db, zColl);
  return pExpr;
}

/*
** Return the default collation sequence for the expression pExpr. If
** there is no default collation type, return 0.
*/
CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){
  CollSeq *pColl = 0;
  if( pExpr ){
    int op;
    pColl = pExpr->pColl;
    op = pExpr->op;
    if( (op==TK_CAST || op==TK_UPLUS) && !pColl ){
      return sqlite3ExprCollSeq(pParse, pExpr->pLeft);
    }
  }
  if( sqlite3CheckCollSeq(pParse, pColl) ){ 
    pColl = 0;
  }
  return pColl;
}

/*
** pExpr is an operand of a comparison operator.  aff2 is the
** type affinity of the other operand.  This routine returns the
** type affinity that should be used for the comparison operator.
*/
char sqlite3CompareAffinity(Expr *pExpr, char aff2){
  char aff1 = sqlite3ExprAffinity(pExpr);
  if( aff1 && aff2 ){
    /* Both sides of the comparison are columns. If one has numeric
    ** affinity, use that. Otherwise use no affinity.
    */
    if( sqlite3IsNumericAffinity(aff1) || sqlite3IsNumericAffinity(aff2) ){
      return SQLITE_AFF_NUMERIC;
    }else{
      return SQLITE_AFF_NONE;
    }
  }else if( !aff1 && !aff2 ){
    /* Neither side of the comparison is a column.  Compare the
    ** results directly.
    */
    return SQLITE_AFF_NONE;
  }else{
    /* One side is a column, the other is not. Use the columns affinity. */
    assert( aff1==0 || aff2==0 );
    return (aff1 + aff2);
  }
}

/*
** pExpr is a comparison operator.  Return the type affinity that should
** be applied to both operands prior to doing the comparison.
*/
static char comparisonAffinity(Expr *pExpr){
  char aff;
  assert( pExpr->op==TK_EQ || pExpr->op==TK_IN || pExpr->op==TK_LT ||
          pExpr->op==TK_GT || pExpr->op==TK_GE || pExpr->op==TK_LE ||
          pExpr->op==TK_NE );
  assert( pExpr->pLeft );
  aff = sqlite3ExprAffinity(pExpr->pLeft);
  if( pExpr->pRight ){
    aff = sqlite3CompareAffinity(pExpr->pRight, aff);
  }
  else if( pExpr->pSelect ){
    aff = sqlite3CompareAffinity(pExpr->pSelect->pEList->a[0].pExpr, aff);
  }
  else if( !aff ){
    aff = SQLITE_AFF_NONE;
  }
  return aff;
}

/*
** pExpr is a comparison expression, eg. '=', '<', IN(...) etc.
** idx_affinity is the affinity of an indexed column. Return true
** if the index with affinity idx_affinity may be used to implement
** the comparison in pExpr.
*/
int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity){
  char aff = comparisonAffinity(pExpr);
  switch( aff ){
    case SQLITE_AFF_NONE:
      return 1;
    case SQLITE_AFF_TEXT:
      return idx_affinity==SQLITE_AFF_TEXT;
    default:
      return sqlite3IsNumericAffinity(idx_affinity);
  }
}

/*
** Return the P5 value that should be used for a binary comparison
** opcode (OP_Eq, OP_Ge etc.) used to compare pExpr1 and pExpr2.
*/
static u8 binaryCompareP5(Expr *pExpr1, Expr *pExpr2, int jumpIfNull){
  u8 aff = (char)sqlite3ExprAffinity(pExpr2);
  aff = sqlite3CompareAffinity(pExpr1, aff) | jumpIfNull;
  return aff;
}

/*
** Return a pointer to the collation sequence that should be used by
** a binary comparison operator comparing pLeft and pRight.
**
** If the left hand expression has a collating sequence type, then it is
** used. Otherwise the collation sequence for the right hand expression
** is used, or the default (BINARY) if neither expression has a collating
** type.
**
** Argument pRight (but not pLeft) may be a null pointer. In this case,
** it is not considered.
*/
CollSeq *sqlite3BinaryCompareCollSeq(
  Parse *pParse, 
  Expr *pLeft, 
  Expr *pRight
){
  CollSeq *pColl;
  assert( pLeft );
  if( pLeft->flags & EP_ExpCollate ){
    assert( pLeft->pColl );
    pColl = pLeft->pColl;
  }else if( pRight && pRight->flags & EP_ExpCollate ){
    assert( pRight->pColl );
    pColl = pRight->pColl;
  }else{
    pColl = sqlite3ExprCollSeq(pParse, pLeft);
    if( !pColl ){
      pColl = sqlite3ExprCollSeq(pParse, pRight);
    }
  }
  return pColl;
}

/*
** Generate the operands for a comparison operation.  Before
** generating the code for each operand, set the EP_AnyAff
** flag on the expression so that it will be able to used a
** cached column value that has previously undergone an
** affinity change.
*/
static void codeCompareOperands(
  Parse *pParse,    /* Parsing and code generating context */
  Expr *pLeft,      /* The left operand */
  int *pRegLeft,    /* Register where left operand is stored */
  int *pFreeLeft,   /* Free this register when done */
  Expr *pRight,     /* The right operand */
  int *pRegRight,   /* Register where right operand is stored */
  int *pFreeRight   /* Write temp register for right operand there */
){
  while( pLeft->op==TK_UPLUS ) pLeft = pLeft->pLeft;
  pLeft->flags |= EP_AnyAff;
  *pRegLeft = sqlite3ExprCodeTemp(pParse, pLeft, pFreeLeft);
  while( pRight->op==TK_UPLUS ) pRight = pRight->pLeft;
  pRight->flags |= EP_AnyAff;
  *pRegRight = sqlite3ExprCodeTemp(pParse, pRight, pFreeRight);
}

/*
** Generate code for a comparison operator.
*/
static int codeCompare(
  Parse *pParse,    /* The parsing (and code generating) context */
  Expr *pLeft,      /* The left operand */
  Expr *pRight,     /* The right operand */
  int opcode,       /* The comparison opcode */
  int in1, int in2, /* Register holding operands */
  int dest,         /* Jump here if true.  */
  int jumpIfNull    /* If true, jump if either operand is NULL */
){
  int p5;
  int addr;
  CollSeq *p4;

  p4 = sqlite3BinaryCompareCollSeq(pParse, pLeft, pRight);
  p5 = binaryCompareP5(pLeft, pRight, jumpIfNull);
  addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1,
                           (void*)p4, P4_COLLSEQ);
  sqlite3VdbeChangeP5(pParse->pVdbe, p5);
  if( (p5 & SQLITE_AFF_MASK)!=SQLITE_AFF_NONE ){
    sqlite3ExprCacheAffinityChange(pParse, in1, 1);
    sqlite3ExprCacheAffinityChange(pParse, in2, 1);
  }
  return addr;
}

#if SQLITE_MAX_EXPR_DEPTH>0
/*
** Check that argument nHeight is less than or equal to the maximum
** expression depth allowed. If it is not, leave an error message in
** pParse.
*/
static int checkExprHeight(Parse *pParse, int nHeight){
  int rc = SQLITE_OK;
  int mxHeight = pParse->db->aLimit[SQLITE_LIMIT_EXPR_DEPTH];
  if( nHeight>mxHeight ){
    sqlite3ErrorMsg(pParse, 
       "Expression tree is too large (maximum depth %d)", mxHeight
    );
    rc = SQLITE_ERROR;
  }
  return rc;
}

/* The following three functions, heightOfExpr(), heightOfExprList()
** and heightOfSelect(), are used to determine the maximum height
** of any expression tree referenced by the structure passed as the
** first argument.
**
** If this maximum height is greater than the current value pointed
** to by pnHeight, the second parameter, then set *pnHeight to that
** value.
*/
static void heightOfExpr(Expr *p, int *pnHeight){
  if( p ){
    if( p->nHeight>*pnHeight ){
      *pnHeight = p->nHeight;
    }
  }
}
static void heightOfExprList(ExprList *p, int *pnHeight){
  if( p ){
    int i;
    for(i=0; i<p->nExpr; i++){
      heightOfExpr(p->a[i].pExpr, pnHeight);
    }
  }
}
static void heightOfSelect(Select *p, int *pnHeight){
  if( p ){
    heightOfExpr(p->pWhere, pnHeight);
    heightOfExpr(p->pHaving, pnHeight);
    heightOfExpr(p->pLimit, pnHeight);
    heightOfExpr(p->pOffset, pnHeight);
    heightOfExprList(p->pEList, pnHeight);
    heightOfExprList(p->pGroupBy, pnHeight);
    heightOfExprList(p->pOrderBy, pnHeight);
    heightOfSelect(p->pPrior, pnHeight);
  }
}

/*
** Set the Expr.nHeight variable in the structure passed as an 
** argument. An expression with no children, Expr.pList or 
** Expr.pSelect member has a height of 1. Any other expression
** has a height equal to the maximum height of any other 
** referenced Expr plus one.
*/
static void exprSetHeight(Expr *p){
  int nHeight = 0;
  heightOfExpr(p->pLeft, &nHeight);
  heightOfExpr(p->pRight, &nHeight);
  heightOfExprList(p->pList, &nHeight);
  heightOfSelect(p->pSelect, &nHeight);
  p->nHeight = nHeight + 1;
}

/*
** Set the Expr.nHeight variable using the exprSetHeight() function. If
** the height is greater than the maximum allowed expression depth,
** leave an error in pParse.
*/
void sqlite3ExprSetHeight(Parse *pParse, Expr *p){
  exprSetHeight(p);
  checkExprHeight(pParse, p->nHeight);
}

/*
** Return the maximum height of any expression tree referenced
** by the select statement passed as an argument.
*/
int sqlite3SelectExprHeight(Select *p){
  int nHeight = 0;
  heightOfSelect(p, &nHeight);
  return nHeight;
}
#else
  #define checkExprHeight(x,y)
  #define exprSetHeight(y)
#endif /* SQLITE_MAX_EXPR_DEPTH>0 */

/*
** Construct a new expression node and return a pointer to it.  Memory
** for this node is obtained from sqlite3_malloc().  The calling function
** is responsible for making sure the node eventually gets freed.
*/
Expr *sqlite3Expr(
  sqlite3 *db,            /* Handle for sqlite3DbMallocZero() (may be null) */
  int op,                 /* Expression opcode */
  Expr *pLeft,            /* Left operand */
  Expr *pRight,           /* Right operand */
  const Token *pToken     /* Argument token */
){
  Expr *pNew;
  pNew = sqlite3DbMallocZero(db, sizeof(Expr));
  if( pNew==0 ){
    /* When malloc fails, delete pLeft and pRight. Expressions passed to 
    ** this function must always be allocated with sqlite3Expr() for this 
    ** reason. 
    */
    sqlite3ExprDelete(db, pLeft);
    sqlite3ExprDelete(db, pRight);
    return 0;
  }
  pNew->op = op;
  pNew->pLeft = pLeft;
  pNew->pRight = pRight;
  pNew->iAgg = -1;
  pNew->span.z = (u8*)"";
  if( pToken ){
    assert( pToken->dyn==0 );
    pNew->span = pNew->token = *pToken;
  }else if( pLeft ){
    if( pRight ){
      if( pRight->span.dyn==0 && pLeft->span.dyn==0 ){
        sqlite3ExprSpan(pNew, &pLeft->span, &pRight->span);
      }
      if( pRight->flags & EP_ExpCollate ){
        pNew->flags |= EP_ExpCollate;
        pNew->pColl = pRight->pColl;
      }
    }
    if( pLeft->flags & EP_ExpCollate ){
      pNew->flags |= EP_ExpCollate;
      pNew->pColl = pLeft->pColl;
    }
  }

  exprSetHeight(pNew);
  return pNew;
}

/*
** Works like sqlite3Expr() except that it takes an extra Parse*
** argument and notifies the associated connection object if malloc fails.
*/
Expr *sqlite3PExpr(
  Parse *pParse,          /* Parsing context */
  int op,                 /* Expression opcode */
  Expr *pLeft,            /* Left operand */
  Expr *pRight,           /* Right operand */
  const Token *pToken     /* Argument token */
){
  Expr *p = sqlite3Expr(pParse->db, op, pLeft, pRight, pToken);
  if( p ){
    checkExprHeight(pParse, p->nHeight);
  }
  return p;
}

/*
** When doing a nested parse, you can include terms in an expression
** that look like this:   #1 #2 ...  These terms refer to registers
** in the virtual machine.  #N is the N-th register.
**
** This routine is called by the parser to deal with on of those terms.
** It immediately generates code to store the value in a memory location.
** The returns an expression that will code to extract the value from
** that memory location as needed.
*/
Expr *sqlite3RegisterExpr(Parse *pParse, Token *pToken){
  Vdbe *v = pParse->pVdbe;
  Expr *p;
  if( pParse->nested==0 ){
    sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", pToken);
    return sqlite3PExpr(pParse, TK_NULL, 0, 0, 0);
  }
  if( v==0 ) return 0;
  p = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, pToken);
  if( p==0 ){
    return 0;  /* Malloc failed */
  }
  p->iTable = atoi((char*)&pToken->z[1]);
  return p;
}

/*
** Join two expressions using an AND operator.  If either expression is
** NULL, then just return the other expression.
*/
Expr *sqlite3ExprAnd(sqlite3 *db, Expr *pLeft, Expr *pRight){
  if( pLeft==0 ){
    return pRight;
  }else if( pRight==0 ){
    return pLeft;
  }else{
    return sqlite3Expr(db, TK_AND, pLeft, pRight, 0);
  }
}

/*
** Set the Expr.span field of the given expression to span all
** text between the two given tokens.  Both tokens must be pointing
** at the same string.
*/
void sqlite3ExprSpan(Expr *pExpr, Token *pLeft, Token *pRight){
  assert( pRight!=0 );
  assert( pLeft!=0 );
  if( pExpr ){
    pExpr->span.z = pLeft->z;
    pExpr->span.n = pRight->n + (pRight->z - pLeft->z);
  }
}

/*
** Construct a new expression node for a function with multiple
** arguments.
*/
Expr *sqlite3ExprFunction(Parse *pParse, ExprList *pList, Token *pToken){
  Expr *pNew;
  sqlite3 *db = pParse->db;
  assert( pToken );
  pNew = sqlite3DbMallocZero(db, sizeof(Expr) );
  if( pNew==0 ){
    sqlite3ExprListDelete(db, pList); /* Avoid leaking memory when malloc fails */
    return 0;
  }
  pNew->op = TK_FUNCTION;
  pNew->pList = pList;
  assert( pToken->dyn==0 );
  pNew->token = *pToken;
  pNew->span = pNew->token;

  sqlite3ExprSetHeight(pParse, pNew);
  return pNew;
}

/*
** Assign a variable number to an expression that encodes a wildcard
** in the original SQL statement.  
**
** Wildcards consisting of a single "?" are assigned the next sequential
** variable number.
**
** Wildcards of the form "?nnn" are assigned the number "nnn".  We make
** sure "nnn" is not too be to avoid a denial of service attack when
** the SQL statement comes from an external source.
**
** Wildcards of the form ":aaa" or "$aaa" are assigned the same number
** as the previous instance of the same wildcard.  Or if this is the first
** instance of the wildcard, the next sequenial variable number is
** assigned.
*/
void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr){
  Token *pToken;
  sqlite3 *db = pParse->db;

  if( pExpr==0 ) return;
  pToken = &pExpr->token;
  assert( pToken->n>=1 );
  assert( pToken->z!=0 );
  assert( pToken->z[0]!=0 );
  if( pToken->n==1 ){
    /* Wildcard of the form "?".  Assign the next variable number */
    pExpr->iTable = ++pParse->nVar;
  }else if( pToken->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*)&pToken->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]);
    }
    if( i>pParse->nVar ){
      pParse->nVar = i;
    }
  }else{
    /* Wildcards of the form ":aaa" or "$aaa".  Reuse the same variable
    ** number as the prior appearance of the same name, or if the name
    ** has never appeared before, reuse the same variable number
    */
    int i, n;
    n = pToken->n;
    for(i=0; i<pParse->nVarExpr; i++){
      Expr *pE;
      if( (pE = pParse->apVarExpr[i])!=0
          && pE->token.n==n
          && memcmp(pE->token.z, pToken->z, 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])
            );
      }
      if( !db->mallocFailed ){
        assert( pParse->apVarExpr!=0 );
        pParse->apVarExpr[pParse->nVarExpr++] = pExpr;
      }
    }
  } 
  if( !pParse->nErr && pParse->nVar>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
    sqlite3ErrorMsg(pParse, "too many SQL variables");
  }
}

/*
** Recursively delete an expression tree.
*/
void sqlite3ExprDelete(sqlite3 *db, Expr *p){
  if( p==0 ) return;
  if( p->span.dyn ) sqlite3DbFree(db, (char*)p->span.z);
  if( p->token.dyn ) sqlite3DbFree(db, (char*)p->token.z);
  sqlite3ExprDelete(db, p->pLeft);
  sqlite3ExprDelete(db, p->pRight);
  sqlite3ExprListDelete(db, p->pList);
  sqlite3SelectDelete(db, p->pSelect);
  sqlite3DbFree(db, p);
}

/*
** The Expr.token field might be a string literal that is quoted.
** If so, remove the quotation marks.
*/
void sqlite3DequoteExpr(sqlite3 *db, Expr *p){
  if( ExprHasAnyProperty(p, EP_Dequoted) ){
    return;
  }
  ExprSetProperty(p, EP_Dequoted);
  if( p->token.dyn==0 ){
    sqlite3TokenCopy(db, &p->token, &p->token);
  }
  sqlite3Dequote((char*)p->token.z);
}


/*
** The following group of routines make deep copies of expressions,
** expression lists, ID lists, and select statements.  The copies can
** be deleted (by being passed to their respective ...Delete() routines)
** without effecting the originals.
**
** The expression list, ID, and source lists return by sqlite3ExprListDup(),
** sqlite3IdListDup(), and sqlite3SrcListDup() can not be further expanded 
** by subsequent calls to sqlite*ListAppend() routines.
**
** Any tables that the SrcList might point to are not duplicated.
*/
Expr *sqlite3ExprDup(sqlite3 *db, Expr *p){
  Expr *pNew;
  if( p==0 ) return 0;
  pNew = sqlite3DbMallocRaw(db, sizeof(*p) );
  if( pNew==0 ) return 0;
  memcpy(pNew, p, sizeof(*pNew));
  if( p->token.z!=0 ){
    pNew->token.z = (u8*)sqlite3DbStrNDup(db, (char*)p->token.z, p->token.n);
    pNew->token.dyn = 1;
  }else{
    assert( pNew->token.z==0 );
  }
  pNew->span.z = 0;
  pNew->pLeft = sqlite3ExprDup(db, p->pLeft);
  pNew->pRight = sqlite3ExprDup(db, p->pRight);
  pNew->pList = sqlite3ExprListDup(db, p->pList);
  pNew->pSelect = sqlite3SelectDup(db, p->pSelect);
  return pNew;
}
void sqlite3TokenCopy(sqlite3 *db, Token *pTo, Token *pFrom){
  if( pTo->dyn ) sqlite3DbFree(db, (char*)pTo->z);
  if( pFrom->z ){
    pTo->n = pFrom->n;
    pTo->z = (u8*)sqlite3DbStrNDup(db, (char*)pFrom->z, pFrom->n);
    pTo->dyn = 1;
  }else{
    pTo->z = 0;
  }
}
ExprList *sqlite3ExprListDup(sqlite3 *db, ExprList *p){
  ExprList *pNew;
  struct ExprList_item *pItem, *pOldItem;
  int i;
  if( p==0 ) return 0;
  pNew = sqlite3DbMallocRaw(db, sizeof(*pNew) );
  if( pNew==0 ) return 0;
  pNew->iECursor = 0;
  pNew->nExpr = pNew->nAlloc = p->nExpr;
  pNew->a = pItem = sqlite3DbMallocRaw(db,  p->nExpr*sizeof(p->a[0]) );
  if( pItem==0 ){
    sqlite3DbFree(db, pNew);
    return 0;
  } 
  pOldItem = p->a;
  for(i=0; i<p->nExpr; i++, pItem++, pOldItem++){
    Expr *pNewExpr, *pOldExpr;
    pItem->pExpr = pNewExpr = sqlite3ExprDup(db, pOldExpr = pOldItem->pExpr);
    if( pOldExpr->span.z!=0 && pNewExpr ){
      /* Always make a copy of the span for top-level expressions in the
      ** expression list.  The logic in SELECT processing that determines
      ** the names of columns in the result set needs this information */
      sqlite3TokenCopy(db, &pNewExpr->span, &pOldExpr->span);
    }
    assert( pNewExpr==0 || pNewExpr->span.z!=0 
            || pOldExpr->span.z==0
            || db->mallocFailed );
    pItem->zName = sqlite3DbStrDup(db, pOldItem->zName);
    pItem->sortOrder = pOldItem->sortOrder;
    pItem->isAgg = pOldItem->isAgg;
    pItem->done = 0;
  }
  return pNew;
}

/*
** If cursors, triggers, views and subqueries are all omitted from
** the build, then none of the following routines, except for 
** sqlite3SelectDup(), can be called. sqlite3SelectDup() is sometimes
** called with a NULL argument.
*/
#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER) \
 || !defined(SQLITE_OMIT_SUBQUERY)
SrcList *sqlite3SrcListDup(sqlite3 *db, SrcList *p){
  SrcList *pNew;
  int i;
  int nByte;
  if( p==0 ) return 0;
  nByte = sizeof(*p) + (p->nSrc>0 ? sizeof(p->a[0]) * (p->nSrc-1) : 0);
  pNew = sqlite3DbMallocRaw(db, nByte );
  if( pNew==0 ) return 0;
  pNew->nSrc = pNew->nAlloc = p->nSrc;
  for(i=0; i<p->nSrc; i++){
    struct SrcList_item *pNewItem = &pNew->a[i];
    struct SrcList_item *pOldItem = &p->a[i];
    Table *pTab;
    pNewItem->zDatabase = sqlite3DbStrDup(db, pOldItem->zDatabase);
    pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName);
    pNewItem->zAlias = sqlite3DbStrDup(db, pOldItem->zAlias);
    pNewItem->jointype = pOldItem->jointype;
    pNewItem->iCursor = pOldItem->iCursor;
    pNewItem->isPopulated = pOldItem->isPopulated;
    pTab = pNewItem->pTab = pOldItem->pTab;
    if( pTab ){
      pTab->nRef++;
    }
    pNewItem->pSelect = sqlite3SelectDup(db, pOldItem->pSelect);
    pNewItem->pOn = sqlite3ExprDup(db, pOldItem->pOn);
    pNewItem->pUsing = sqlite3IdListDup(db, pOldItem->pUsing);
    pNewItem->colUsed = pOldItem->colUsed;
  }
  return pNew;
}
IdList *sqlite3IdListDup(sqlite3 *db, IdList *p){
  IdList *pNew;
  int i;
  if( p==0 ) return 0;
  pNew = sqlite3DbMallocRaw(db, sizeof(*pNew) );
  if( pNew==0 ) return 0;
  pNew->nId = pNew->nAlloc = p->nId;
  pNew->a = sqlite3DbMallocRaw(db, p->nId*sizeof(p->a[0]) );
  if( pNew->a==0 ){
    sqlite3DbFree(db, pNew);
    return 0;
  }
  for(i=0; i<p->nId; i++){
    struct IdList_item *pNewItem = &pNew->a[i];
    struct IdList_item *pOldItem = &p->a[i];
    pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName);
    pNewItem->idx = pOldItem->idx;
  }
  return pNew;
}
Select *sqlite3SelectDup(sqlite3 *db, Select *p){
  Select *pNew;
  if( p==0 ) return 0;
  pNew = sqlite3DbMallocRaw(db, sizeof(*p) );
  if( pNew==0 ) return 0;
  pNew->isDistinct = p->isDistinct;
  pNew->pEList = sqlite3ExprListDup(db, p->pEList);
  pNew->pSrc = sqlite3SrcListDup(db, p->pSrc);
  pNew->pWhere = sqlite3ExprDup(db, p->pWhere);
  pNew->pGroupBy = sqlite3ExprListDup(db, p->pGroupBy);
  pNew->pHaving = sqlite3ExprDup(db, p->pHaving);
  pNew->pOrderBy = sqlite3ExprListDup(db, p->pOrderBy);
  pNew->op = p->op;
  pNew->pPrior = sqlite3SelectDup(db, p->pPrior);
  pNew->pLimit = sqlite3ExprDup(db, p->pLimit);
  pNew->pOffset = sqlite3ExprDup(db, p->pOffset);
  pNew->iLimit = 0;
  pNew->iOffset = 0;
  pNew->isResolved = p->isResolved;
  pNew->isAgg = p->isAgg;
  pNew->usesEphm = 0;
  pNew->disallowOrderBy = 0;
  pNew->pRightmost = 0;
  pNew->addrOpenEphm[0] = -1;
  pNew->addrOpenEphm[1] = -1;
  pNew->addrOpenEphm[2] = -1;
  return pNew;
}
#else
Select *sqlite3SelectDup(sqlite3 *db, Select *p){
  assert( p==0 );
  return 0;
}
#endif


/*
** Add a new element to the end of an expression list.  If pList is
** initially NULL, then create a new expression list.
*/
ExprList *sqlite3ExprListAppend(
  Parse *pParse,          /* Parsing context */
  ExprList *pList,        /* List to which to append. Might be NULL */
  Expr *pExpr,            /* Expression to be appended */
  Token *pName            /* AS keyword for the expression */
){
  sqlite3 *db = pParse->db;
  if( pList==0 ){
    pList = sqlite3DbMallocZero(db, sizeof(ExprList) );
    if( pList==0 ){
      goto no_mem;
    }
    assert( pList->nAlloc==0 );
  }
  if( pList->nAlloc<=pList->nExpr ){
    struct ExprList_item *a;
    int n = pList->nAlloc*2 + 4;
    a = sqlite3DbRealloc(db, pList->a, n*sizeof(pList->a[0]));
    if( a==0 ){
      goto no_mem;
    }
    pList->a = a;
    pList->nAlloc = n;
  }
  assert( pList->a!=0 );
  if( pExpr || pName ){
    struct ExprList_item *pItem = &pList->a[pList->nExpr++];
    memset(pItem, 0, sizeof(*pItem));
    pItem->zName = sqlite3NameFromToken(db, pName);
    pItem->pExpr = pExpr;
  }
  return pList;

no_mem:     
  /* Avoid leaking memory if malloc has failed. */
  sqlite3ExprDelete(db, pExpr);
  sqlite3ExprListDelete(db, pList);
  return 0;
}

/*
** If the expression list pEList contains more than iLimit elements,
** leave an error message in pParse.
*/
void sqlite3ExprListCheckLength(
  Parse *pParse,
  ExprList *pEList,
  const char *zObject
){
  int mx = pParse->db->aLimit[SQLITE_LIMIT_COLUMN];
  testcase( pEList && pEList->nExpr==mx );
  testcase( pEList && pEList->nExpr==mx+1 );
  if( pEList && pEList->nExpr>mx ){
    sqlite3ErrorMsg(pParse, "too many columns in %s", zObject);
  }
}

/*
** Delete an entire expression list.
*/
void sqlite3ExprListDelete(sqlite3 *db, ExprList *pList){
  int i;
  struct ExprList_item *pItem;
  if( pList==0 ) return;
  assert( pList->a!=0 || (pList->nExpr==0 && pList->nAlloc==0) );
  assert( pList->nExpr<=pList->nAlloc );
  for(pItem=pList->a, i=0; i<pList->nExpr; i++, pItem++){
    sqlite3ExprDelete(db, pItem->pExpr);
    sqlite3DbFree(db, pItem->zName);
  }
  sqlite3DbFree(db, pList->a);
  sqlite3DbFree(db, pList);
}

/*
** Walk an expression tree.  Call xFunc for each node visited.  xFunc
** is called on the node before xFunc is called on the nodes children.
**
** The return value from xFunc determines whether the tree walk continues.
** 0 means continue walking the tree.  1 means do not walk children
** of the current node but continue with siblings.  2 means abandon
** the tree walk completely.
**
** The return value from this routine is 1 to abandon the tree walk
** and 0 to continue.
**
** NOTICE:  This routine does *not* descend into subqueries.
*/
static int walkExprList(ExprList *, int (*)(void *, Expr*), void *);
static int walkExprTree(Expr *pExpr, int (*xFunc)(void*,Expr*), void *pArg){
  int rc;
  if( pExpr==0 ) return 0;
  rc = (*xFunc)(pArg, pExpr);
  if( rc==0 ){
    if( walkExprTree(pExpr->pLeft, xFunc, pArg) ) return 1;
    if( walkExprTree(pExpr->pRight, xFunc, pArg) ) return 1;
    if( walkExprList(pExpr->pList, xFunc, pArg) ) return 1;
  }
  return rc>1;
}

/*
** Call walkExprTree() for every expression in list p.
*/
static int walkExprList(ExprList *p, int (*xFunc)(void *, Expr*), void *pArg){
  int i;
  struct ExprList_item *pItem;
  if( !p ) return 0;
  for(i=p->nExpr, pItem=p->a; i>0; i--, pItem++){
    if( walkExprTree(pItem->pExpr, xFunc, pArg) ) return 1;
  }
  return 0;
}

/*
** Call walkExprTree() for every expression in Select p, not including
** expressions that are part of sub-selects in any FROM clause or the LIMIT
** or OFFSET expressions..
*/
static int walkSelectExpr(Select *p, int (*xFunc)(void *, Expr*), void *pArg){
  walkExprList(p->pEList, xFunc, pArg);
  walkExprTree(p->pWhere, xFunc, pArg);
  walkExprList(p->pGroupBy, xFunc, pArg);
  walkExprTree(p->pHaving, xFunc, pArg);
  walkExprList(p->pOrderBy, xFunc, pArg);
  if( p->pPrior ){
    walkSelectExpr(p->pPrior, xFunc, pArg);
  }
  return 0;
}


/*
** This routine is designed as an xFunc for walkExprTree().
**
** pArg is really a pointer to an integer.  If we can tell by looking
** at pExpr that the expression that contains pExpr is not a constant
** expression, then set *pArg to 0 and return 2 to abandon the tree walk.
** If pExpr does does not disqualify the expression from being a constant
** then do nothing.
**
** After walking the whole tree, if no nodes are found that disqualify
** the expression as constant, then we assume the whole expression
** is constant.  See sqlite3ExprIsConstant() for additional information.
*/
static int exprNodeIsConstant(void *pArg, Expr *pExpr){
  int *pN = (int*)pArg;

  /* If *pArg is 3 then any term of the expression that comes from
  ** the ON or USING clauses of a join disqualifies the expression
  ** from being considered constant. */
  if( (*pN)==3 && ExprHasAnyProperty(pExpr, EP_FromJoin) ){
    *pN = 0;
    return 2;
  }

  switch( pExpr->op ){
    /* Consider functions to be constant if all their arguments are constant
    ** and *pArg==2 */
    case TK_FUNCTION:
      if( (*pN)==2 ) return 0;
      /* Fall through */
    case TK_ID:
    case TK_COLUMN:
    case TK_DOT:
    case TK_AGG_FUNCTION:
    case TK_AGG_COLUMN:
#ifndef SQLITE_OMIT_SUBQUERY
    case TK_SELECT:
    case TK_EXISTS:
      testcase( pExpr->op==TK_SELECT );
      testcase( pExpr->op==TK_EXISTS );
#endif
      testcase( pExpr->op==TK_ID );
      testcase( pExpr->op==TK_COLUMN );
      testcase( pExpr->op==TK_DOT );
      testcase( pExpr->op==TK_AGG_FUNCTION );
      testcase( pExpr->op==TK_AGG_COLUMN );
      *pN = 0;
      return 2;
    case TK_IN:
      if( pExpr->pSelect ){
        *pN = 0;
        return 2;
      }
    default:
      return 0;
  }
}

/*
** Walk an expression tree.  Return 1 if the expression is constant
** and 0 if it involves variables or function calls.
**
** For the purposes of this function, a double-quoted string (ex: "abc")
** is considered a variable but a single-quoted string (ex: 'abc') is
** a constant.
*/
int sqlite3ExprIsConstant(Expr *p){
  int isConst = 1;
  walkExprTree(p, exprNodeIsConstant, &isConst);
  return isConst;
}

/*
** Walk an expression tree.  Return 1 if the expression is constant
** that does no originate from the ON or USING clauses of a join.
** Return 0 if it involves variables or function calls or terms from
** an ON or USING clause.
*/
int sqlite3ExprIsConstantNotJoin(Expr *p){
  int isConst = 3;
  walkExprTree(p, exprNodeIsConstant, &isConst);
  return isConst!=0;
}

/*
** Walk an expression tree.  Return 1 if the expression is constant
** or a function call with constant arguments.  Return and 0 if there
** are any variables.
**
** For the purposes of this function, a double-quoted string (ex: "abc")
** is considered a variable but a single-quoted string (ex: 'abc') is
** a constant.
*/
int sqlite3ExprIsConstantOrFunction(Expr *p){
  int isConst = 2;
  walkExprTree(p, exprNodeIsConstant, &isConst);
  return isConst!=0;
}

/*
** If the expression p codes a constant integer that is small enough
** to fit in a 32-bit integer, return 1 and put the value of the integer
** in *pValue.  If the expression is not an integer or if it is too big
** to fit in a signed 32-bit integer, return 0 and leave *pValue unchanged.
*/
int sqlite3ExprIsInteger(Expr *p, int *pValue){
  int rc = 0;
  if( p->flags & EP_IntValue ){
    *pValue = p->iTable;
    return 1;
  }
  switch( p->op ){
    case TK_INTEGER: {
      rc = sqlite3GetInt32((char*)p->token.z, pValue);
      break;
    }
    case TK_UPLUS: {
      rc = sqlite3ExprIsInteger(p->pLeft, pValue);
      break;
    }
    case TK_UMINUS: {
      int v;
      if( sqlite3ExprIsInteger(p->pLeft, &v) ){
        *pValue = -v;
        rc = 1;
      }
      break;
    }
    default: break;
  }
  if( rc ){
    p->op = TK_INTEGER;
    p->flags |= EP_IntValue;
    p->iTable = *pValue;
  }
  return rc;
}

/*
** Return TRUE if the given string is a row-id column name.
*/
int sqlite3IsRowid(const char *z){
  if( sqlite3StrICmp(z, "_ROWID_")==0 ) return 1;
  if( sqlite3StrICmp(z, "ROWID")==0 ) return 1;
  if( sqlite3StrICmp(z, "OID")==0 ) return 1;
  return 0;
}

/*
** Given the name of a column of the form X.Y.Z or Y.Z or just Z, look up
** that name in the set of source tables in pSrcList and make the pExpr 
** expression node refer back to that source column.  The following changes
** are made to pExpr:
**
**    pExpr->iDb           Set the index in db->aDb[] of the database holding
**                         the table.
**    pExpr->iTable        Set to the cursor number for the table obtained
**                         from pSrcList.
**    pExpr->iColumn       Set to the column number within the table.
**    pExpr->op            Set to TK_COLUMN.
**    pExpr->pLeft         Any expression this points to is deleted
**    pExpr->pRight        Any expression this points to is deleted.
**
** The pDbToken is the name of the database (the "X").  This value may be
** NULL meaning that name is of the form Y.Z or Z.  Any available database
** can be used.  The pTableToken is the name of the table (the "Y").  This
** value can be NULL if pDbToken is also NULL.  If pTableToken is NULL it
** means that the form of the name is Z and that columns from any table
** can be used.
**
** If the name cannot be resolved unambiguously, leave an error message
** in pParse and return non-zero.  Return zero on success.
*/
static int lookupName(
  Parse *pParse,       /* The parsing context */
  Token *pDbToken,     /* Name of the database containing table, or NULL */
  Token *pTableToken,  /* Name of table containing column, or NULL */
  Token *pColumnToken, /* Name of the column. */
  NameContext *pNC,    /* The name context used to resolve the name */
  Expr *pExpr          /* Make this EXPR node point to the selected column */
){
  char *zDb = 0;       /* Name of the database.  The "X" in X.Y.Z */
  char *zTab = 0;      /* Name of the table.  The "Y" in X.Y.Z or Y.Z */
  char *zCol = 0;      /* Name of the column.  The "Z" */
  int i, j;            /* Loop counters */
  int cnt = 0;         /* Number of matching column names */
  int cntTab = 0;      /* Number of matching table names */
  sqlite3 *db = pParse->db;  /* The database */
  struct SrcList_item *pItem;       /* Use for looping over pSrcList items */
  struct SrcList_item *pMatch = 0;  /* The matching pSrcList item */
  NameContext *pTopNC = pNC;        /* First namecontext in the list */
  Schema *pSchema = 0;              /* Schema of the expression */

  assert( pColumnToken && pColumnToken->z ); /* The Z in X.Y.Z cannot be NULL */
  zDb = sqlite3NameFromToken(db, pDbToken);
  zTab = sqlite3NameFromToken(db, pTableToken);
  zCol = sqlite3NameFromToken(db, pColumnToken);
  if( db->mallocFailed ){
    goto lookupname_end;
  }

  pExpr->iTable = -1;
  while( pNC && cnt==0 ){
    ExprList *pEList;
    SrcList *pSrcList = pNC->pSrcList;

    if( pSrcList ){
      for(i=0, pItem=pSrcList->a; i<pSrcList->nSrc; i++, pItem++){
        Table *pTab;
        int iDb;
        Column *pCol;
  
        pTab = pItem->pTab;
        assert( pTab!=0 );
        iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
        assert( pTab->nCol>0 );
        if( zTab ){
          if( pItem->zAlias ){
            char *zTabName = pItem->zAlias;
            if( sqlite3StrICmp(zTabName, zTab)!=0 ) continue;
          }else{
            char *zTabName = pTab->zName;
            if( zTabName==0 || sqlite3StrICmp(zTabName, zTab)!=0 ) continue;
            if( zDb!=0 && sqlite3StrICmp(db->aDb[iDb].zName, zDb)!=0 ){
              continue;
            }
          }
        }
        if( 0==(cntTab++) ){
          pExpr->iTable = pItem->iCursor;
          pSchema = pTab->pSchema;
          pMatch = pItem;
        }
        for(j=0, pCol=pTab->aCol; j<pTab->nCol; j++, pCol++){
          if( sqlite3StrICmp(pCol->zName, zCol)==0 ){
            const char *zColl = pTab->aCol[j].zColl;
            IdList *pUsing;
            cnt++;
            pExpr->iTable = pItem->iCursor;
            pMatch = pItem;
            pSchema = pTab->pSchema;
            /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */
            pExpr->iColumn = j==pTab->iPKey ? -1 : j;
            pExpr->affinity = pTab->aCol[j].affinity;
            if( (pExpr->flags & EP_ExpCollate)==0 ){
              pExpr->pColl = sqlite3FindCollSeq(db, ENC(db), zColl,-1, 0);
            }
            if( i<pSrcList->nSrc-1 ){
              if( pItem[1].jointype & JT_NATURAL ){
                /* If this match occurred in the left table of a natural join,
                ** then skip the right table to avoid a duplicate match */
                pItem++;
                i++;
              }else if( (pUsing = pItem[1].pUsing)!=0 ){
                /* If this match occurs on a column that is in the USING clause
                ** of a join, skip the search of the right table of the join
                ** to avoid a duplicate match there. */
                int k;
                for(k=0; k<pUsing->nId; k++){
                  if( sqlite3StrICmp(pUsing->a[k].zName, zCol)==0 ){
                    pItem++;
                    i++;
                    break;
                  }
                }
              }
            }
            break;
          }
        }
      }
    }

#ifndef SQLITE_OMIT_TRIGGER
    /* If we have not already resolved the name, then maybe 
    ** it is a new.* or old.* trigger argument reference
    */
    if( zDb==0 && zTab!=0 && cnt==0 && pParse->trigStack!=0 ){
      TriggerStack *pTriggerStack = pParse->trigStack;
      Table *pTab = 0;
      u32 *piColMask;
      if( pTriggerStack->newIdx != -1 && sqlite3StrICmp("new", zTab) == 0 ){
        pExpr->iTable = pTriggerStack->newIdx;
        assert( pTriggerStack->pTab );
        pTab = pTriggerStack->pTab;
        piColMask = &(pTriggerStack->newColMask);
      }else if( pTriggerStack->oldIdx != -1 && sqlite3StrICmp("old", zTab)==0 ){
        pExpr->iTable = pTriggerStack->oldIdx;
        assert( pTriggerStack->pTab );
        pTab = pTriggerStack->pTab;
        piColMask = &(pTriggerStack->oldColMask);
      }

      if( pTab ){ 
        int iCol;
        Column *pCol = pTab->aCol;

        pSchema = pTab->pSchema;
        cntTab++;
        for(iCol=0; iCol < pTab->nCol; iCol++, pCol++) {
          if( sqlite3StrICmp(pCol->zName, zCol)==0 ){
            const char *zColl = pTab->aCol[iCol].zColl;
            cnt++;
            pExpr->iColumn = iCol==pTab->iPKey ? -1 : iCol;
            pExpr->affinity = pTab->aCol[iCol].affinity;
            if( (pExpr->flags & EP_ExpCollate)==0 ){
              pExpr->pColl = sqlite3FindCollSeq(db, ENC(db), zColl,-1, 0);
            }
            pExpr->pTab = pTab;
            if( iCol>=0 ){
              testcase( iCol==31 );
              testcase( iCol==32 );
              *piColMask |= ((u32)1<<iCol) | (iCol>=32?0xffffffff:0);
            }
            break;
          }
        }
      }
    }
#endif /* !defined(SQLITE_OMIT_TRIGGER) */

    /*
    ** Perhaps the name is a reference to the ROWID
    */
    if( cnt==0 && cntTab==1 && sqlite3IsRowid(zCol) ){
      cnt = 1;
      pExpr->iColumn = -1;
      pExpr->affinity = SQLITE_AFF_INTEGER;
    }

    /*
    ** If the input is of the form Z (not Y.Z or X.Y.Z) then the name Z
    ** might refer to an result-set alias.  This happens, for example, when
    ** we are resolving names in the WHERE clause of the following command:
    **
    **     SELECT a+b AS x FROM table WHERE x<10;
    **
    ** In cases like this, replace pExpr with a copy of the expression that
    ** forms the result set entry ("a+b" in the example) and return immediately.
    ** Note that the expression in the result set should have already been
    ** resolved by the time the WHERE clause is resolved.
    */
    if( cnt==0 && (pEList = pNC->pEList)!=0 && zTab==0 ){
      for(j=0; j<pEList->nExpr; j++){
        char *zAs = pEList->a[j].zName;
        if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){
          Expr *pDup, *pOrig;
          assert( pExpr->pLeft==0 && pExpr->pRight==0 );
          assert( pExpr->pList==0 );
          assert( pExpr->pSelect==0 );
          pOrig = pEList->a[j].pExpr;
          if( !pNC->allowAgg && ExprHasProperty(pOrig, EP_Agg) ){
            sqlite3ErrorMsg(pParse, "misuse of aliased aggregate %s", zAs);
            sqlite3DbFree(db, zCol);
            return 2;
          }
          pDup = sqlite3ExprDup(db, pOrig);
          if( pExpr->flags & EP_ExpCollate ){
            pDup->pColl = pExpr->pColl;
            pDup->flags |= EP_ExpCollate;
          }
          if( pExpr->span.dyn ) sqlite3DbFree(db, (char*)pExpr->span.z);
          if( pExpr->token.dyn ) sqlite3DbFree(db, (char*)pExpr->token.z);
          memcpy(pExpr, pDup, sizeof(*pExpr));
          sqlite3DbFree(db, pDup);
          cnt = 1;
          pMatch = 0;
          assert( zTab==0 && zDb==0 );
          goto lookupname_end_2;
        }
      } 
    }

    /* Advance to the next name context.  The loop will exit when either
    ** we have a match (cnt>0) or when we run out of name contexts.
    */
    if( cnt==0 ){
      pNC = pNC->pNext;
    }
  }

  /*
  ** If X and Y are NULL (in other words if only the column name Z is
  ** supplied) and the value of Z is enclosed in double-quotes, then
  ** Z is a string literal if it doesn't match any column names.  In that
  ** case, we need to return right away and not make any changes to
  ** pExpr.
  **
  ** Because no reference was made to outer contexts, the pNC->nRef
  ** fields are not changed in any context.
  */
  if( cnt==0 && zTab==0 && pColumnToken->z[0]=='"' ){
    sqlite3DbFree(db, zCol);
    return 0;
  }

  /*
  ** cnt==0 means there was not match.  cnt>1 means there were two or
  ** more matches.  Either way, we have an error.
  */
  if( cnt!=1 ){
    const char *zErr;
    zErr = cnt==0 ? "no such column" : "ambiguous column name";
    if( zDb ){
      sqlite3ErrorMsg(pParse, "%s: %s.%s.%s", zErr, zDb, zTab, zCol);
    }else if( zTab ){
      sqlite3ErrorMsg(pParse, "%s: %s.%s", zErr, zTab, zCol);
    }else{
      sqlite3ErrorMsg(pParse, "%s: %s", zErr, zCol);
    }
    pTopNC->nErr++;
  }

  /* If a column from a table in pSrcList is referenced, then record
  ** this fact in the pSrcList.a[].colUsed bitmask.  Column 0 causes
  ** bit 0 to be set.  Column 1 sets bit 1.  And so forth.  If the
  ** column number is greater than the number of bits in the bitmask
  ** then set the high-order bit of the bitmask.
  */
  if( pExpr->iColumn>=0 && pMatch!=0 ){
    int n = pExpr->iColumn;
    testcase( n==sizeof(Bitmask)*8-1 );
    if( n>=sizeof(Bitmask)*8 ){
      n = sizeof(Bitmask)*8-1;
    }
    assert( pMatch->iCursor==pExpr->iTable );
    pMatch->colUsed |= ((Bitmask)1)<<n;
  }

lookupname_end:
  /* Clean up and return
  */
  sqlite3DbFree(db, zDb);
  sqlite3DbFree(db, zTab);
  sqlite3ExprDelete(db, pExpr->pLeft);
  pExpr->pLeft = 0;
  sqlite3ExprDelete(db, pExpr->pRight);
  pExpr->pRight = 0;
  pExpr->op = TK_COLUMN;
lookupname_end_2:
  sqlite3DbFree(db, zCol);
  if( cnt==1 ){
    assert( pNC!=0 );
    sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList);
    if( pMatch && !pMatch->pSelect ){
      pExpr->pTab = pMatch->pTab;
    }
    /* Increment the nRef value on all name contexts from TopNC up to
    ** the point where the name matched. */
    for(;;){
      assert( pTopNC!=0 );
      pTopNC->nRef++;
      if( pTopNC==pNC ) break;
      pTopNC = pTopNC->pNext;
    }
    return 0;
  } else {
    return 1;
  }
}

/*
** This routine is designed as an xFunc for walkExprTree().
**
** 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.
**
** This routine also does error checking and name resolution for
** function names.  The operator for aggregate functions is changed
** to TK_AGG_FUNCTION.
*/
static int nameResolverStep(void *pArg, Expr *pExpr){
  NameContext *pNC = (NameContext*)pArg;
  Parse *pParse;

  if( pExpr==0 ) return 1;
  assert( pNC!=0 );
  pParse = pNC->pParse;

  if( ExprHasAnyProperty(pExpr, EP_Resolved) ) return 1;
  ExprSetProperty(pExpr, EP_Resolved);
#ifndef NDEBUG
  if( pNC->pSrcList && pNC->pSrcList->nAlloc>0 ){
    SrcList *pSrcList = pNC->pSrcList;
    int i;
    for(i=0; i<pNC->pSrcList->nSrc; i++){
      assert( pSrcList->a[i].iCursor>=0 && pSrcList->a[i].iCursor<pParse->nTab);
    }
  }
#endif
  switch( pExpr->op ){
    /* Double-quoted strings (ex: "abc") are used as identifiers if
    ** possible.  Otherwise they remain as strings.  Single-quoted
    ** strings (ex: 'abc') are always string literals.
    */
    case TK_STRING: {
      if( pExpr->token.z[0]=='\'' ) break;
      /* Fall thru into the TK_ID case if this is a double-quoted string */
    }
    /* A lone identifier is the name of a column.
    */
    case TK_ID: {
      lookupName(pParse, 0, 0, &pExpr->token, pNC, pExpr);
      return 1;
    }
  
    /* A table name and column name:     ID.ID
    ** Or a database, table and column:  ID.ID.ID
    */
    case TK_DOT: {
      Token *pColumn;
      Token *pTable;
      Token *pDb;
      Expr *pRight;

      /* if( pSrcList==0 ) break; */
      pRight = pExpr->pRight;
      if( pRight->op==TK_ID ){
        pDb = 0;
        pTable = &pExpr->pLeft->token;
        pColumn = &pRight->token;
      }else{
        assert( pRight->op==TK_DOT );
        pDb = &pExpr->pLeft->token;
        pTable = &pRight->pLeft->token;
        pColumn = &pRight->pRight->token;
      }
      lookupName(pParse, pDb, pTable, pColumn, pNC, pExpr);
      return 1;
    }

    /* Resolve function names
    */
    case TK_CONST_FUNC:
    case TK_FUNCTION: {
      ExprList *pList = pExpr->pList;    /* The argument list */
      int n = pList ? pList->nExpr : 0;  /* Number of arguments */
      int no_such_func = 0;       /* True if no such function exists */
      int wrong_num_args = 0;     /* True if wrong number of arguments */
      int is_agg = 0;             /* True if is an aggregate function */
      int i;
      int auth;                   /* Authorization to use the function */
      int nId;                    /* Number of characters in function name */
      const char *zId;            /* The function name. */
      FuncDef *pDef;              /* Information about the function */
      int enc = ENC(pParse->db);  /* The database encoding */

      zId = (char*)pExpr->token.z;
      nId = pExpr->token.n;
      pDef = sqlite3FindFunction(pParse->db, zId, nId, n, enc, 0);
      if( pDef==0 ){
        pDef = sqlite3FindFunction(pParse->db, zId, nId, -1, enc, 0);
        if( pDef==0 ){
          no_such_func = 1;
        }else{
          wrong_num_args = 1;
        }
      }else{
        is_agg = pDef->xFunc==0;
      }
#ifndef SQLITE_OMIT_AUTHORIZATION
      if( pDef ){
        auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0, pDef->zName, 0);
        if( auth!=SQLITE_OK ){
          if( auth==SQLITE_DENY ){
            sqlite3ErrorMsg(pParse, "not authorized to use function: %s",
                                    pDef->zName);
            pNC->nErr++;
          }
          pExpr->op = TK_NULL;
          return 1;
        }
      }
#endif
      if( is_agg && !pNC->allowAgg ){
        sqlite3ErrorMsg(pParse, "misuse of aggregate function %.*s()", nId,zId);
        pNC->nErr++;
        is_agg = 0;
      }else if( no_such_func ){
        sqlite3ErrorMsg(pParse, "no such function: %.*s", nId, zId);
        pNC->nErr++;
      }else if( wrong_num_args ){
        sqlite3ErrorMsg(pParse,"wrong number of arguments to function %.*s()",
             nId, zId);
        pNC->nErr++;
      }
      if( is_agg ){
        pExpr->op = TK_AGG_FUNCTION;
        pNC->hasAgg = 1;
      }
      if( is_agg ) pNC->allowAgg = 0;
      for(i=0; pNC->nErr==0 && i<n; i++){
        walkExprTree(pList->a[i].pExpr, nameResolverStep, pNC);
      }
      if( is_agg ) pNC->allowAgg = 1;
      /* FIX ME:  Compute pExpr->affinity based on the expected return
      ** type of the function 
      */
      return is_agg;
    }
#ifndef SQLITE_OMIT_SUBQUERY
    case TK_SELECT:
    case TK_EXISTS:
#endif
    case TK_IN: {
      if( pExpr->pSelect ){
        int nRef = pNC->nRef;
#ifndef SQLITE_OMIT_CHECK
        if( pNC->isCheck ){
          sqlite3ErrorMsg(pParse,"subqueries prohibited in CHECK constraints");
        }
#endif
        sqlite3SelectResolve(pParse, pExpr->pSelect, pNC);
        assert( pNC->nRef>=nRef );
        if( nRef!=pNC->nRef ){
          ExprSetProperty(pExpr, EP_VarSelect);
        }
      }
      break;
    }
#ifndef SQLITE_OMIT_CHECK
    case TK_VARIABLE: {
      if( pNC->isCheck ){
        sqlite3ErrorMsg(pParse,"parameters prohibited in CHECK constraints");
      }
      break;
    }
#endif
  }
  return 0;
}

/*
** This routine walks an expression tree and resolves references to
** table columns.  Nodes of the form ID.ID or ID resolve into an
** index to the table in the table list and a column offset.  The 
** Expr.opcode for such nodes is changed to TK_COLUMN.  The Expr.iTable
** value is changed to the index of the referenced table in pTabList
** plus the "base" value.  The base value will ultimately become the
** VDBE cursor number for a cursor that is pointing into the referenced
** table.  The Expr.iColumn value is changed to the index of the column 
** of the referenced table.  The Expr.iColumn value for the special
** ROWID column is -1.  Any INTEGER PRIMARY KEY column is tried as an
** alias for ROWID.
**
** Also resolve function names and check the functions for proper
** usage.  Make sure all function names are recognized and all functions
** have the correct number of arguments.  Leave an error message
** in pParse->zErrMsg if anything is amiss.  Return the number of errors.
**
** If the expression contains aggregate functions then set the EP_Agg
** property on the expression.
*/
int sqlite3ExprResolveNames( 
  NameContext *pNC,       /* Namespace to resolve expressions in. */
  Expr *pExpr             /* The expression to be analyzed. */
){
  int savedHasAgg;

  if( pExpr==0 ) return 0;
#if SQLITE_MAX_EXPR_DEPTH>0
  {
    if( checkExprHeight(pNC->pParse, pExpr->nHeight + pNC->pParse->nHeight) ){
      return 1;
    }
    pNC->pParse->nHeight += pExpr->nHeight;
  }
#endif
  savedHasAgg = pNC->hasAgg;
  pNC->hasAgg = 0;
  walkExprTree(pExpr, nameResolverStep, pNC);
#if SQLITE_MAX_EXPR_DEPTH>0
  pNC->pParse->nHeight -= pExpr->nHeight;
#endif
  if( pNC->nErr>0 ){
    ExprSetProperty(pExpr, EP_Error);
  }
  if( pNC->hasAgg ){
    ExprSetProperty(pExpr, EP_Agg);
  }else if( savedHasAgg ){
    pNC->hasAgg = 1;
  }
  return ExprHasProperty(pExpr, EP_Error);
}

/*
** A pointer instance of this structure is used to pass information
** through walkExprTree into codeSubqueryStep().
*/
typedef struct QueryCoder QueryCoder;
struct QueryCoder {
  Parse *pParse;       /* The parsing context */
  NameContext *pNC;    /* Namespace of first enclosing query */
};

#ifdef SQLITE_TEST
  int sqlite3_enable_in_opt = 1;
#else
  #define sqlite3_enable_in_opt 1
#endif

/*
** Return true if the IN operator optimization is enabled and
** the SELECT statement p exists and is of the
** simple form:
**
**     SELECT <column> FROM <table>
**
** If this is the case, it may be possible to use an existing table
** or index instead of generating an epheremal table.
*/
#ifndef SQLITE_OMIT_SUBQUERY
static int isCandidateForInOpt(Select *p){
  SrcList *pSrc;
  ExprList *pEList;
  Table *pTab;
  if( !sqlite3_enable_in_opt ) return 0; /* IN optimization must be enabled */
  if( p==0 ) return 0;                   /* right-hand side of IN is SELECT */
  if( p->pPrior ) return 0;              /* Not a compound SELECT */
  if( p->isDistinct ) return 0;          /* No DISTINCT keyword */
  if( p->isAgg ) return 0;               /* Contains no aggregate functions */
  if( p->pGroupBy ) return 0;            /* Has no GROUP BY clause */
  if( p->pLimit ) return 0;              /* Has no LIMIT clause */
  if( p->pOffset ) return 0;
  if( p->pWhere ) return 0;              /* Has no WHERE clause */
  pSrc = p->pSrc;
  if( pSrc==0 ) return 0;                /* A single table in the FROM clause */
  if( pSrc->nSrc!=1 ) return 0;
  if( pSrc->a[0].pSelect ) return 0;     /* FROM clause is not a subquery */
  pTab = pSrc->a[0].pTab;
  if( pTab==0 ) return 0;
  if( pTab->pSelect ) return 0;          /* FROM clause is not a view */
  if( IsVirtual(pTab) ) return 0;        /* FROM clause not a virtual table */
  pEList = p->pEList;
  if( pEList->nExpr!=1 ) return 0;       /* One column in the result set */
  if( pEList->a[0].pExpr->op!=TK_COLUMN ) return 0; /* Result is a column */
  return 1;
}
#endif /* SQLITE_OMIT_SUBQUERY */

/*
** This function is used by the implementation of the IN (...) operator.
** It's job is to find or create a b-tree structure that may be used
** either to test for membership of the (...) set or to iterate through
** its members, skipping duplicates.
**
** The cursor opened on the structure (database table, database index 
** or ephermal table) is stored in pX->iTable before this function returns.
** The returned value indicates the structure type, as follows:
**
**   IN_INDEX_ROWID - The cursor was opened on a database table.
**   IN_INDEX_INDEX - The cursor was opened on a database index.
**   IN_INDEX_EPH -   The cursor was opened on a specially created and
**                    populated epheremal table.
**
** An existing structure may only be used if the SELECT is of the simple
** form:
**
**     SELECT <column> FROM <table>
**
** If prNotFound parameter is 0, then the structure will be used to iterate
** through the set members, skipping any duplicates. In this case an
** epheremal table must be used unless the selected <column> is guaranteed
** to be unique - either because it is an INTEGER PRIMARY KEY or it
** is unique by virtue of a constraint or implicit index.
**
** If the prNotFound parameter is not 0, then the structure will be used 
** for fast set membership tests. In this case an epheremal table must 
** be used unless <column> is an INTEGER PRIMARY KEY or an index can 
** be found with <column> as its left-most column.
**
** When the structure is being used for set membership tests, the user
** needs to know whether or not the structure contains an SQL NULL 
** value in order to correctly evaluate expressions like "X IN (Y, Z)".
** If there is a chance that the structure may contain a NULL value at
** runtime, then a register is allocated and the register number written
** to *prNotFound. If there is no chance that the structure contains a
** NULL value, then *prNotFound is left unchanged.
**
** If a register is allocated and its location stored in *prNotFound, then
** its initial value is NULL. If the structure does not remain constant
** for the duration of the query (i.e. the set is a correlated sub-select), 
** the value of the allocated register is reset to NULL each time the 
** structure is repopulated. This allows the caller to use vdbe code 
** equivalent to the following:
**
**   if( register==NULL ){
**     has_null = <test if data structure contains null>
**     register = 1
**   }
**
** in order to avoid running the <test if data structure contains null>
** test more often than is necessary.
*/
#ifndef SQLITE_OMIT_SUBQUERY
int sqlite3FindInIndex(Parse *pParse, Expr *pX, int *prNotFound){
  Select *p;
  int eType = 0;
  int iTab = pParse->nTab++;
  int mustBeUnique = !prNotFound;

  /* The follwing if(...) expression is true if the SELECT is of the 
  ** simple form:
  **
  **     SELECT <column> FROM <table>
  **
  ** If this is the case, it may be possible to use an existing table
  ** or index instead of generating an epheremal table.
  */
  p = pX->pSelect;
  if( isCandidateForInOpt(p) ){
    sqlite3 *db = pParse->db;
    Index *pIdx;
    Expr *pExpr = p->pEList->a[0].pExpr;
    int iCol = pExpr->iColumn;
    Vdbe *v = sqlite3GetVdbe(pParse);

    /* This function is only called from two places. In both cases the vdbe
    ** has already been allocated. So assume sqlite3GetVdbe() is always
    ** successful here.
    */
    assert(v);
    if( iCol<0 ){
      int iMem = ++pParse->nMem;
      int iAddr;
      Table *pTab = p->pSrc->a[0].pTab;
      int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
      sqlite3VdbeUsesBtree(v, iDb);

      iAddr = sqlite3VdbeAddOp1(v, OP_If, iMem);
      sqlite3VdbeAddOp2(v, OP_Integer, 1, iMem);

      sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead);
      eType = IN_INDEX_ROWID;

      sqlite3VdbeJumpHere(v, iAddr);
    }else{
      /* The collation sequence used by the comparison. If an index is to 
      ** be used in place of a temp-table, it must be ordered according
      ** to this collation sequence.
      */
      CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pExpr);

      /* Check that the affinity that will be used to perform the 
      ** comparison is the same as the affinity of the column. If
      ** it is not, it is not possible to use any index.
      */
      Table *pTab = p->pSrc->a[0].pTab;
      char aff = comparisonAffinity(pX);
      int affinity_ok = (pTab->aCol[iCol].affinity==aff||aff==SQLITE_AFF_NONE);

      for(pIdx=pTab->pIndex; pIdx && eType==0 && affinity_ok; pIdx=pIdx->pNext){
        if( (pIdx->aiColumn[0]==iCol)
         && (pReq==sqlite3FindCollSeq(db, ENC(db), pIdx->azColl[0], -1, 0))
         && (!mustBeUnique || (pIdx->nColumn==1 && pIdx->onError!=OE_None))
        ){
          int iDb;
          int iMem = ++pParse->nMem;
          int iAddr;
          char *pKey;
  
          pKey = (char *)sqlite3IndexKeyinfo(pParse, pIdx);
          iDb = sqlite3SchemaToIndex(db, pIdx->pSchema);
          sqlite3VdbeUsesBtree(v, iDb);

          iAddr = sqlite3VdbeAddOp1(v, OP_If, iMem);
          sqlite3VdbeAddOp2(v, OP_Integer, 1, iMem);
  
          sqlite3VdbeAddOp2(v, OP_SetNumColumns, 0, pIdx->nColumn);
          sqlite3VdbeAddOp4(v, OP_OpenRead, iTab, pIdx->tnum, iDb,
                               pKey,P4_KEYINFO_HANDOFF);
          VdbeComment((v, "%s", pIdx->zName));
          eType = IN_INDEX_INDEX;

          sqlite3VdbeJumpHere(v, iAddr);
          if( prNotFound && !pTab->aCol[iCol].notNull ){
            *prNotFound = ++pParse->nMem;
          }
        }
      }
    }
  }

  if( eType==0 ){
    int rMayHaveNull = 0;
    if( prNotFound ){
      *prNotFound = rMayHaveNull = ++pParse->nMem;
    }
    sqlite3CodeSubselect(pParse, pX, rMayHaveNull);
    eType = IN_INDEX_EPH;
  }else{
    pX->iTable = iTab;
  }
  return eType;
}
#endif

/*
** Generate code for scalar subqueries used as an expression
** and IN operators.  Examples:
**
**     (SELECT a FROM b)          -- subquery
**     EXISTS (SELECT a FROM b)   -- EXISTS subquery
**     x IN (4,5,11)              -- IN operator with list on right-hand side
**     x IN (SELECT a FROM b)     -- IN operator with subquery on the right
**
** The pExpr parameter describes the expression that contains the IN
** operator or subquery.
*/
#ifndef SQLITE_OMIT_SUBQUERY
void sqlite3CodeSubselect(Parse *pParse, Expr *pExpr, int rMayHaveNull){
  int testAddr = 0;                       /* One-time test address */
  Vdbe *v = sqlite3GetVdbe(pParse);
  if( v==0 ) return;


  /* 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
  **    *  We are inside a trigger
  **
  ** If all of the above are false, then we can run this code just once
  ** save the results, and reuse the same result on subsequent invocations.
  */
  if( !ExprHasAnyProperty(pExpr, EP_VarSelect) && !pParse->trigStack ){
    int mem = ++pParse->nMem;
    sqlite3VdbeAddOp1(v, OP_If, mem);
    testAddr = sqlite3VdbeAddOp2(v, OP_Integer, 1, mem);
    assert( testAddr>0 || pParse->db->mallocFailed );
  }

  switch( pExpr->op ){
    case TK_IN: {
      char affinity;
      KeyInfo keyInfo;
      int addr;        /* Address of OP_OpenEphemeral instruction */

      if( rMayHaveNull ){
        sqlite3VdbeAddOp2(v, OP_Null, 0, rMayHaveNull);
      }

      affinity = sqlite3ExprAffinity(pExpr->pLeft);

      /* Whether this is an 'x IN(SELECT...)' or an 'x IN(<exprlist>)'
      ** expression it is handled the same way. A virtual table is 
      ** filled with single-field index keys representing the results
      ** from the SELECT or the <exprlist>.
      **
      ** If the 'x' expression is a column value, or the SELECT...
      ** statement returns a column value, then the affinity of that
      ** column is used to build the index keys. If both 'x' and the
      ** SELECT... statement are columns, then numeric affinity is used
      ** if either column has NUMERIC or INTEGER affinity. If neither
      ** 'x' nor the SELECT... statement are columns, then numeric affinity
      ** is used.
      */
      pExpr->iTable = pParse->nTab++;
      addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pExpr->iTable, 1);
      memset(&keyInfo, 0, sizeof(keyInfo));
      keyInfo.nField = 1;

      if( pExpr->pSelect ){
        /* Case 1:     expr IN (SELECT ...)
        **
        ** Generate code to write the results of the select into the temporary
        ** table allocated and opened above.
        */
        SelectDest dest;
        ExprList *pEList;

        sqlite3SelectDestInit(&dest, SRT_Set, pExpr->iTable);
        dest.affinity = (int)affinity;
        assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable );
        if( sqlite3Select(pParse, pExpr->pSelect, &dest, 0, 0, 0) ){
          return;
        }
        pEList = pExpr->pSelect->pEList;
        if( pEList && pEList->nExpr>0 ){ 
          keyInfo.aColl[0] = sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft,
              pEList->a[0].pExpr);
        }
      }else if( pExpr->pList ){
        /* Case 2:     expr IN (exprlist)
        **
        ** For each expression, build an index key from the evaluation and
        ** store it in the temporary table. If <expr> is a column, then use
        ** that columns affinity when building index keys. If <expr> is not
        ** a column, use numeric affinity.
        */
        int i;
        ExprList *pList = pExpr->pList;
        struct ExprList_item *pItem;
        int r1, r2, r3;

        if( !affinity ){
          affinity = SQLITE_AFF_NONE;
        }
        keyInfo.aColl[0] = pExpr->pLeft->pColl;

        /* Loop through each expression in <exprlist>. */
        r1 = sqlite3GetTempReg(pParse);
        r2 = sqlite3GetTempReg(pParse);
        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 */
          pParse->disableColCache++;
          r3 = sqlite3ExprCodeTarget(pParse, pE2, r1);
          assert( pParse->disableColCache>0 );
          pParse->disableColCache--;
          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);
      }
      sqlite3VdbeChangeP4(v, addr, (void *)&keyInfo, P4_KEYINFO);
      break;
    }

    case TK_EXISTS:
    case TK_SELECT: {
      /* This has to be a scalar SELECT.  Generate code to put the
      ** value of this select in a memory cell and record the number
      ** of the memory cell in iColumn.
      */
      static const Token one = { (u8*)"1", 0, 1 };
      Select *pSel;
      SelectDest dest;

      pSel = pExpr->pSelect;
      sqlite3SelectDestInit(&dest, 0, ++pParse->nMem);
      if( pExpr->op==TK_SELECT ){
        dest.eDest = SRT_Mem;
        sqlite3VdbeAddOp2(v, OP_Null, 0, dest.iParm);
        VdbeComment((v, "Init subquery result"));
      }else{
        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, 0, 0, 0) ){
        return;
      }
      pExpr->iColumn = dest.iParm;
      break;
    }
  }

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

  return;
}
#endif /* SQLITE_OMIT_SUBQUERY */

/*
** Duplicate an 8-byte value
*/
static char *dup8bytes(Vdbe *v, const char *in){
  char *out = sqlite3DbMallocRaw(sqlite3VdbeDb(v), 8);
  if( out ){
    memcpy(out, in, 8);
  }
  return out;
}

/*
** Generate an instruction that will put the floating point
** value described by z[0..n-1] into register iMem.
**
** The z[] string will probably not be zero-terminated.  But the 
** z[n] character is guaranteed to be something that does not look
** like the continuation of the number.
*/
static void codeReal(Vdbe *v, const char *z, int n, int negateFlag, int iMem){
  assert( z || v==0 || sqlite3VdbeDb(v)->mallocFailed );
  if( z ){
    double value;
    char *zV;
    assert( !isdigit(z[n]) );
    sqlite3AtoF(z, &value);
    if( sqlite3IsNaN(value) ){
      sqlite3VdbeAddOp2(v, OP_Null, 0, iMem);
    }else{
      if( negateFlag ) value = -value;
      zV = dup8bytes(v, (char*)&value);
      sqlite3VdbeAddOp4(v, OP_Real, 0, iMem, 0, zV, P4_REAL);
    }
  }
}


/*
** Generate an instruction that will put the integer describe by
** text z[0..n-1] into register iMem.
**
** The z[] string will probably not be zero-terminated.  But the 
** z[n] character is guaranteed to be something that does not look
** like the continuation of the number.
*/
static void codeInteger(Vdbe *v, Expr *pExpr, int negFlag, int iMem){
  const char *z;
  if( pExpr->flags & EP_IntValue ){
    int i = pExpr->iTable;
    if( negFlag ) i = -i;
    sqlite3VdbeAddOp2(v, OP_Integer, i, iMem);
  }else if( (z = (char*)pExpr->token.z)!=0 ){
    int i;
    int n = pExpr->token.n;
    assert( !isdigit(z[n]) );
    if( sqlite3GetInt32(z, &i) ){
      if( negFlag ) i = -i;
      sqlite3VdbeAddOp2(v, OP_Integer, i, iMem);
    }else if( sqlite3FitsIn64Bits(z, negFlag) ){
      i64 value;
      char *zV;
      sqlite3Atoi64(z, &value);
      if( negFlag ) value = -value;
      zV = dup8bytes(v, (char*)&value);
      sqlite3VdbeAddOp4(v, OP_Int64, 0, iMem, 0, zV, P4_INT64);
    }else{
      codeReal(v, z, n, negFlag, iMem);
    }
  }
}


/*
** Generate code that will extract the iColumn-th column from
** table pTab and store the column value in a register.  An effort
** is made to store the column value in register iReg, but this is
** not guaranteed.  The location of the column value is returned.
**
** There must be an open cursor to pTab in iTable when this routine
** is called.  If iColumn<0 then code is generated that extracts the rowid.
**
** This routine might attempt to reuse the value of the column that
** has already been loaded into a register.  The value will always
** be used if it has not undergone any affinity changes.  But if
** an affinity change has occurred, then the cached value will only be
** used if allowAffChng is true.
*/
int sqlite3ExprCodeGetColumn(
  Parse *pParse,   /* Parsing and code generating context */
  Table *pTab,     /* Description of the table we are reading from */
  int iColumn,     /* Index of the table column */
  int iTable,      /* The cursor pointing to the table */
  int iReg,        /* Store results here */
  int allowAffChng /* True if prior affinity changes are OK */
){
  Vdbe *v = pParse->pVdbe;
  int i;
  struct yColCache *p;

  for(i=0, p=pParse->aColCache; i<pParse->nColCache; i++, p++){
    if( p->iTable==iTable && p->iColumn==iColumn
           && (!p->affChange || allowAffChng) ){
#if 0
      sqlite3VdbeAddOp0(v, OP_Noop);
      VdbeComment((v, "OPT: tab%d.col%d -> r%d", iTable, iColumn, p->iReg));
#endif
      return p->iReg;
    }
  }  
  assert( v!=0 );
  if( iColumn<0 ){
    int op = (pTab && IsVirtual(pTab)) ? OP_VRowid : OP_Rowid;
    sqlite3VdbeAddOp2(v, op, iTable, iReg);
  }else if( pTab==0 ){
    sqlite3VdbeAddOp3(v, OP_Column, iTable, iColumn, iReg);
  }else{
    int op = IsVirtual(pTab) ? OP_VColumn : OP_Column;
    sqlite3VdbeAddOp3(v, op, iTable, iColumn, iReg);
    sqlite3ColumnDefault(v, pTab, iColumn);
#ifndef SQLITE_OMIT_FLOATING_POINT
    if( pTab->aCol[iColumn].affinity==SQLITE_AFF_REAL ){
      sqlite3VdbeAddOp1(v, OP_RealAffinity, iReg);
    }
#endif
  }
  if( pParse->disableColCache==0 ){
    i = pParse->iColCache;
    p = &pParse->aColCache[i];
    p->iTable = iTable;
    p->iColumn = iColumn;
    p->iReg = iReg;
    p->affChange = 0;
    i++;
    if( i>=ArraySize(pParse->aColCache) ) i = 0;
    if( i>pParse->nColCache ) pParse->nColCache = i;
    pParse->iColCache = i;
  }
  return iReg;
}

/*
** Clear all column cache entries associated with the vdbe
** cursor with cursor number iTable.
*/
void sqlite3ExprClearColumnCache(Parse *pParse, int iTable){
  if( iTable<0 ){
    pParse->nColCache = 0;
    pParse->iColCache = 0;
  }else{
    int i;
    for(i=0; i<pParse->nColCache; i++){
      if( pParse->aColCache[i].iTable==iTable ){
        testcase( i==pParse->nColCache-1 );
        pParse->aColCache[i] = pParse->aColCache[--pParse->nColCache];
        pParse->iColCache = pParse->nColCache;
      }
    }
  }
}

/*
** Record the fact that an affinity change has occurred on iCount
** registers starting with iStart.
*/
void sqlite3ExprCacheAffinityChange(Parse *pParse, int iStart, int iCount){
  int iEnd = iStart + iCount - 1;
  int i;
  for(i=0; i<pParse->nColCache; i++){
    int r = pParse->aColCache[i].iReg;
    if( r>=iStart && r<=iEnd ){
      pParse->aColCache[i].affChange = 1;
    }
  }
}

/*
** Generate code to move content from registers iFrom...iFrom+nReg-1
** over to iTo..iTo+nReg-1. Keep the column cache up-to-date.
*/
void sqlite3ExprCodeMove(Parse *pParse, int iFrom, int iTo, int nReg){
  int i;
  if( iFrom==iTo ) return;
  sqlite3VdbeAddOp3(pParse->pVdbe, OP_Move, iFrom, iTo, nReg);
  for(i=0; i<pParse->nColCache; i++){
    int x = pParse->aColCache[i].iReg;
    if( x>=iFrom && x<iFrom+nReg ){
      pParse->aColCache[i].iReg += iTo-iFrom;
    }
  }
}

/*
** Generate code to copy content from registers iFrom...iFrom+nReg-1
** over to iTo..iTo+nReg-1.
*/
void sqlite3ExprCodeCopy(Parse *pParse, int iFrom, int iTo, int nReg){
  int i;
  if( iFrom==iTo ) return;
  for(i=0; i<nReg; i++){
    sqlite3VdbeAddOp2(pParse->pVdbe, OP_Copy, iFrom+i, iTo+i);
  }
}

/*
** Return true if any register in the range iFrom..iTo (inclusive)
** is used as part of the column cache.
*/
static int usedAsColumnCache(Parse *pParse, int iFrom, int iTo){
  int i;
  for(i=0; i<pParse->nColCache; i++){
    int r = pParse->aColCache[i].iReg;
    if( r>=iFrom && r<=iTo ) return 1;
  }
  return 0;
}

/*
** Theres is a value in register iCurrent.  We ultimately want
** the value to be in register iTarget.  It might be that
** iCurrent and iTarget are the same register.
**
** We are going to modify the value, so we need to make sure it
** is not a cached register.  If iCurrent is a cached register,
** then try to move the value over to iTarget.  If iTarget is a
** cached register, then clear the corresponding cache line.
**
** Return the register that the value ends up in.
*/
int sqlite3ExprWritableRegister(Parse *pParse, int iCurrent, int iTarget){
  int i;
  assert( pParse->pVdbe!=0 );
  if( !usedAsColumnCache(pParse, iCurrent, iCurrent) ){
    return iCurrent;
  }
  if( iCurrent!=iTarget ){
    sqlite3VdbeAddOp2(pParse->pVdbe, OP_SCopy, iCurrent, iTarget);
  }
  for(i=0; i<pParse->nColCache; i++){
    if( pParse->aColCache[i].iReg==iTarget ){
      pParse->aColCache[i] = pParse->aColCache[--pParse->nColCache];
      pParse->iColCache = pParse->nColCache;
    }
  }
  return iTarget;
}

/*
** If the last instruction coded is an ephemeral copy of any of
** the registers in the nReg registers beginning with iReg, then
** convert the last instruction from OP_SCopy to OP_Copy.
*/
void sqlite3ExprHardCopy(Parse *pParse, int iReg, int nReg){
  int addr;
  VdbeOp *pOp;
  Vdbe *v;

  v = pParse->pVdbe;
  addr = sqlite3VdbeCurrentAddr(v);
  pOp = sqlite3VdbeGetOp(v, addr-1);
  assert( pOp || pParse->db->mallocFailed );
  if( pOp && pOp->opcode==OP_SCopy && pOp->p1>=iReg && pOp->p1<iReg+nReg ){
    pOp->opcode = OP_Copy;
  }
}

/*
** Generate code into the current Vdbe to evaluate the given
** expression.  Attempt to store the results in register "target".
** Return the register where results are stored.
**
** With this routine, there is no guaranteed that results will
** be stored in target.  The result might be stored in some other
** register if it is convenient to do so.  The calling function
** must check the return code and move the results to the desired
** register.
*/
int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
  Vdbe *v = pParse->pVdbe;  /* The VM under construction */
  int op;                   /* The opcode being coded */
  int inReg = target;       /* Results stored in register inReg */
  int regFree1 = 0;         /* If non-zero free this temporary register */
  int regFree2 = 0;         /* If non-zero free this temporary register */
  int r1, r2, r3, r4;       /* Various register numbers */

  assert( v!=0 || pParse->db->mallocFailed );
  assert( target>0 && target<=pParse->nMem );
  if( v==0 ) return 0;

  if( pExpr==0 ){
    op = TK_NULL;
  }else{
    op = pExpr->op;
  }
  switch( op ){
    case TK_AGG_COLUMN: {
      AggInfo *pAggInfo = pExpr->pAggInfo;
      struct AggInfo_col *pCol = &pAggInfo->aCol[pExpr->iAgg];
      if( !pAggInfo->directMode ){
        assert( pCol->iMem>0 );
        inReg = pCol->iMem;
        break;
      }else if( pAggInfo->useSortingIdx ){
        sqlite3VdbeAddOp3(v, OP_Column, pAggInfo->sortingIdx,
                              pCol->iSorterColumn, target);
        break;
      }
      /* Otherwise, fall thru into the TK_COLUMN case */
    }
    case TK_COLUMN: {
      if( pExpr->iTable<0 ){
        /* This only happens when coding check constraints */
        assert( pParse->ckBase>0 );
        inReg = pExpr->iColumn + pParse->ckBase;
      }else{
        testcase( (pExpr->flags & EP_AnyAff)!=0 );
        inReg = sqlite3ExprCodeGetColumn(pParse, pExpr->pTab,
                                 pExpr->iColumn, pExpr->iTable, target,
                                 pExpr->flags & EP_AnyAff);
      }
      break;
    }
    case TK_INTEGER: {
      codeInteger(v, pExpr, 0, target);
      break;
    }
    case TK_FLOAT: {
      codeReal(v, (char*)pExpr->token.z, pExpr->token.n, 0, target);
      break;
    }
    case TK_STRING: {
      sqlite3DequoteExpr(pParse->db, pExpr);
      sqlite3VdbeAddOp4(v,OP_String8, 0, target, 0,
                        (char*)pExpr->token.z, pExpr->token.n);
      break;
    }
    case TK_NULL: {
      sqlite3VdbeAddOp2(v, OP_Null, 0, target);
      break;
    }
#ifndef SQLITE_OMIT_BLOB_LITERAL
    case TK_BLOB: {
      int n;
      const char *z;
      char *zBlob;
      assert( pExpr->token.n>=3 );
      assert( pExpr->token.z[0]=='x' || pExpr->token.z[0]=='X' );
      assert( pExpr->token.z[1]=='\'' );
      assert( pExpr->token.z[pExpr->token.n-1]=='\'' );
      n = pExpr->token.n - 3;
      z = (char*)pExpr->token.z + 2;
      zBlob = sqlite3HexToBlob(sqlite3VdbeDb(v), z, n);
      sqlite3VdbeAddOp4(v, OP_Blob, n/2, target, 0, zBlob, P4_DYNAMIC);
      break;
    }
#endif
    case TK_VARIABLE: {
      sqlite3VdbeAddOp2(v, OP_Variable, pExpr->iTable, target);
      if( pExpr->token.n>1 ){
        sqlite3VdbeChangeP4(v, -1, (char*)pExpr->token.z, pExpr->token.n);
      }
      break;
    }
    case TK_REGISTER: {
      inReg = pExpr->iTable;
      break;
    }
#ifndef SQLITE_OMIT_CAST
    case TK_CAST: {
      /* Expressions of the form:   CAST(pLeft AS token) */
      int aff, to_op;
      inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
      aff = sqlite3AffinityType(&pExpr->token);
      to_op = aff - SQLITE_AFF_TEXT + OP_ToText;
      assert( to_op==OP_ToText    || aff!=SQLITE_AFF_TEXT    );
      assert( to_op==OP_ToBlob    || aff!=SQLITE_AFF_NONE    );
      assert( to_op==OP_ToNumeric || aff!=SQLITE_AFF_NUMERIC );
      assert( to_op==OP_ToInt     || aff!=SQLITE_AFF_INTEGER );
      assert( to_op==OP_ToReal    || aff!=SQLITE_AFF_REAL    );
      testcase( to_op==OP_ToText );
      testcase( to_op==OP_ToBlob );
      testcase( to_op==OP_ToNumeric );
      testcase( to_op==OP_ToInt );
      testcase( to_op==OP_ToReal );
      sqlite3VdbeAddOp1(v, to_op, inReg);
      testcase( usedAsColumnCache(pParse, inReg, inReg) );
      sqlite3ExprCacheAffinityChange(pParse, inReg, 1);
      break;
    }
#endif /* SQLITE_OMIT_CAST */
    case TK_LT:
    case TK_LE:
    case TK_GT:
    case TK_GE:
    case TK_NE:
    case TK_EQ: {
      assert( TK_LT==OP_Lt );
      assert( TK_LE==OP_Le );
      assert( TK_GT==OP_Gt );
      assert( TK_GE==OP_Ge );
      assert( TK_EQ==OP_Eq );
      assert( TK_NE==OP_Ne );
      testcase( op==TK_LT );
      testcase( op==TK_LE );
      testcase( op==TK_GT );
      testcase( op==TK_GE );
      testcase( op==TK_EQ );
      testcase( op==TK_NE );
      codeCompareOperands(pParse, pExpr->pLeft, &r1, &regFree1,
                                  pExpr->pRight, &r2, &regFree2);
      codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op,
                  r1, r2, inReg, SQLITE_STOREP2);
      testcase( regFree1==0 );
      testcase( regFree2==0 );
      break;
    }
    case TK_AND:
    case TK_OR:
    case TK_PLUS:
    case TK_STAR:
    case TK_MINUS:
    case TK_REM:
    case TK_BITAND:
    case TK_BITOR:
    case TK_SLASH:
    case TK_LSHIFT:
    case TK_RSHIFT: 
    case TK_CONCAT: {
      assert( TK_AND==OP_And );
      assert( TK_OR==OP_Or );
      assert( TK_PLUS==OP_Add );
      assert( TK_MINUS==OP_Subtract );
      assert( TK_REM==OP_Remainder );
      assert( TK_BITAND==OP_BitAnd );
      assert( TK_BITOR==OP_BitOr );
      assert( TK_SLASH==OP_Divide );
      assert( TK_LSHIFT==OP_ShiftLeft );
      assert( TK_RSHIFT==OP_ShiftRight );
      assert( TK_CONCAT==OP_Concat );
      testcase( op==TK_AND );
      testcase( op==TK_OR );
      testcase( op==TK_PLUS );
      testcase( op==TK_MINUS );
      testcase( op==TK_REM );
      testcase( op==TK_BITAND );
      testcase( op==TK_BITOR );
      testcase( op==TK_SLASH );
      testcase( op==TK_LSHIFT );
      testcase( op==TK_RSHIFT );
      testcase( op==TK_CONCAT );
      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
      r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, &regFree2);
      sqlite3VdbeAddOp3(v, op, r2, r1, target);
      testcase( regFree1==0 );
      testcase( regFree2==0 );
      break;
    }
    case TK_UMINUS: {
      Expr *pLeft = pExpr->pLeft;
      assert( pLeft );
      if( pLeft->op==TK_FLOAT || pLeft->op==TK_INTEGER ){
        if( pLeft->op==TK_FLOAT ){
          codeReal(v, (char*)pLeft->token.z, pLeft->token.n, 1, target);
        }else{
          codeInteger(v, pLeft, 1, target);
        }
      }else{
        regFree1 = r1 = sqlite3GetTempReg(pParse);
        sqlite3VdbeAddOp2(v, OP_Integer, 0, r1);
        r2 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree2);
        sqlite3VdbeAddOp3(v, OP_Subtract, r2, r1, target);
        testcase( regFree2==0 );
      }
      inReg = target;
      break;
    }
    case TK_BITNOT:
    case TK_NOT: {
      assert( TK_BITNOT==OP_BitNot );
      assert( TK_NOT==OP_Not );
      testcase( op==TK_BITNOT );
      testcase( op==TK_NOT );
      inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
      testcase( inReg==target );
      testcase( usedAsColumnCache(pParse, inReg, inReg) );
      inReg = sqlite3ExprWritableRegister(pParse, inReg, target);
      sqlite3VdbeAddOp1(v, op, inReg);
      break;
    }
    case TK_ISNULL:
    case TK_NOTNULL: {
      int addr;
      assert( TK_ISNULL==OP_IsNull );
      assert( TK_NOTNULL==OP_NotNull );
      testcase( op==TK_ISNULL );
      testcase( op==TK_NOTNULL );
      sqlite3VdbeAddOp2(v, OP_Integer, 1, target);
      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
      testcase( regFree1==0 );
      addr = sqlite3VdbeAddOp1(v, op, r1);
      sqlite3VdbeAddOp2(v, OP_AddImm, target, -1);
      sqlite3VdbeJumpHere(v, addr);
      break;
    }
    case TK_AGG_FUNCTION: {
      AggInfo *pInfo = pExpr->pAggInfo;
      if( pInfo==0 ){
        sqlite3ErrorMsg(pParse, "misuse of aggregate: %T",
            &pExpr->span);
      }else{
        inReg = pInfo->aFunc[pExpr->iAgg].iMem;
      }
      break;
    }
    case TK_CONST_FUNC:
    case TK_FUNCTION: {
      ExprList *pList = pExpr->pList;
      int nExpr = pList ? pList->nExpr : 0;
      FuncDef *pDef;
      int nId;
      const char *zId;
      int constMask = 0;
      int i;
      sqlite3 *db = pParse->db;
      u8 enc = ENC(db);
      CollSeq *pColl = 0;

      testcase( op==TK_CONST_FUNC );
      testcase( op==TK_FUNCTION );
      zId = (char*)pExpr->token.z;
      nId = pExpr->token.n;
      pDef = sqlite3FindFunction(pParse->db, zId, nId, nExpr, enc, 0);
      assert( pDef!=0 );
      if( pList ){
        nExpr = pList->nExpr;
        r1 = sqlite3GetTempRange(pParse, nExpr);
        sqlite3ExprCodeExprList(pParse, pList, r1, 1);
      }else{
        nExpr = r1 = 0;
      }
#ifndef SQLITE_OMIT_VIRTUALTABLE
      /* Possibly overload the function if the first argument is
      ** a virtual table column.
      **
      ** For infix functions (LIKE, GLOB, REGEXP, and MATCH) use the
      ** second argument, not the first, as the argument to test to
      ** see if it is a column in a virtual table.  This is done because
      ** the left operand of infix functions (the operand we want to
      ** control overloading) ends up as the second argument to the
      ** function.  The expression "A glob B" is equivalent to 
      ** "glob(B,A).  We want to use the A in "A glob B" to test
      ** for function overloading.  But we use the B term in "glob(B,A)".
      */
      if( nExpr>=2 && (pExpr->flags & EP_InfixFunc) ){
        pDef = sqlite3VtabOverloadFunction(db, pDef, nExpr, pList->a[1].pExpr);
      }else if( nExpr>0 ){
        pDef = sqlite3VtabOverloadFunction(db, pDef, nExpr, pList->a[0].pExpr);
      }
#endif
      for(i=0; i<nExpr && i<32; i++){
        if( sqlite3ExprIsConstant(pList->a[i].pExpr) ){
          constMask |= (1<<i);
        }
        if( pDef->needCollSeq && !pColl ){
          pColl = sqlite3ExprCollSeq(pParse, pList->a[i].pExpr);
        }
      }
      if( pDef->needCollSeq ){
        if( !pColl ) pColl = pParse->db->pDfltColl; 
        sqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ);
      }
      sqlite3VdbeAddOp4(v, OP_Function, constMask, r1, target,
                        (char*)pDef, P4_FUNCDEF);
      sqlite3VdbeChangeP5(v, nExpr);
      if( nExpr ){
        sqlite3ReleaseTempRange(pParse, r1, nExpr);
      }
      sqlite3ExprCacheAffinityChange(pParse, r1, nExpr);
      break;
    }
#ifndef SQLITE_OMIT_SUBQUERY
    case TK_EXISTS:
    case TK_SELECT: {
      testcase( op==TK_EXISTS );
      testcase( op==TK_SELECT );
      if( pExpr->iColumn==0 ){
        sqlite3CodeSubselect(pParse, pExpr, 0);
      }
      inReg = pExpr->iColumn;
      break;
    }
    case TK_IN: {
      int rNotFound = 0;
      int rMayHaveNull = 0;
      int j2, j3, j4, j5;
      char affinity;
      int eType;

      VdbeNoopComment((v, "begin IN expr r%d", target));
      eType = sqlite3FindInIndex(pParse, pExpr, &rMayHaveNull);
      if( rMayHaveNull ){
        rNotFound = ++pParse->nMem;
      }

      /* Figure out the affinity to use to create a key from the results
      ** of the expression. affinityStr stores a static string suitable for
      ** P4 of OP_MakeRecord.
      */
      affinity = comparisonAffinity(pExpr);


      /* Code the <expr> from "<expr> IN (...)". The temporary table
      ** pExpr->iTable contains the values that make up the (...) set.
      */
      pParse->disableColCache++;
      sqlite3ExprCode(pParse, pExpr->pLeft, target);
      pParse->disableColCache--;
      j2 = sqlite3VdbeAddOp1(v, OP_IsNull, target);
      if( eType==IN_INDEX_ROWID ){
        j3 = sqlite3VdbeAddOp1(v, OP_MustBeInt, target);
        j4 = sqlite3VdbeAddOp3(v, OP_NotExists, pExpr->iTable, 0, target);
        sqlite3VdbeAddOp2(v, OP_Integer, 1, target);
        j5 = sqlite3VdbeAddOp0(v, OP_Goto);
        sqlite3VdbeJumpHere(v, j3);
        sqlite3VdbeJumpHere(v, j4);
        sqlite3VdbeAddOp2(v, OP_Integer, 0, target);
      }else{
        r2 = regFree2 = sqlite3GetTempReg(pParse);

        /* Create a record and test for set membership. If the set contains
        ** the value, then jump to the end of the test code. The target
        ** register still contains the true (1) value written to it earlier.
        */
        sqlite3VdbeAddOp4(v, OP_MakeRecord, target, 1, r2, &affinity, 1);
        sqlite3VdbeAddOp2(v, OP_Integer, 1, target);
        j5 = sqlite3VdbeAddOp3(v, OP_Found, pExpr->iTable, 0, r2);

        /* If the set membership test fails, then the result of the 
        ** "x IN (...)" expression must be either 0 or NULL. If the set
        ** contains no NULL values, then the result is 0. If the set 
        ** contains one or more NULL values, then the result of the
        ** expression is also NULL.
        */
        if( rNotFound==0 ){
          /* This branch runs if it is known at compile time (now) that 
          ** the set contains no NULL values. This happens as the result
          ** of a "NOT NULL" constraint in the database schema. No need
          ** to test the data structure at runtime in this case.
          */
          sqlite3VdbeAddOp2(v, OP_Integer, 0, target);
        }else{
          /* This block populates the rNotFound register with either NULL
          ** or 0 (an integer value). If the data structure contains one
          ** or more NULLs, then set rNotFound to NULL. Otherwise, set it
          ** to 0. If register rMayHaveNull is already set to some value
          ** other than NULL, then the test has already been run and 
          ** rNotFound is already populated.
          */
          static const char nullRecord[] = { 0x02, 0x00 };
          j3 = sqlite3VdbeAddOp1(v, OP_NotNull, rMayHaveNull);
          sqlite3VdbeAddOp2(v, OP_Null, 0, rNotFound);
          sqlite3VdbeAddOp4(v, OP_Blob, 2, rMayHaveNull, 0, 
                             nullRecord, P4_STATIC);
          j4 = sqlite3VdbeAddOp3(v, OP_Found, pExpr->iTable, 0, rMayHaveNull);
          sqlite3VdbeAddOp2(v, OP_Integer, 0, rNotFound);
          sqlite3VdbeJumpHere(v, j4);
          sqlite3VdbeJumpHere(v, j3);

          /* Copy the value of register rNotFound (which is either NULL or 0)
	  ** into the target register. This will be the result of the
          ** expression.
          */
          sqlite3VdbeAddOp2(v, OP_Copy, rNotFound, target);
        }
      }
      sqlite3VdbeJumpHere(v, j2);
      sqlite3VdbeJumpHere(v, j5);
      VdbeComment((v, "end IN expr r%d", target));
      break;
    }
#endif
    /*
    **    x BETWEEN y AND z
    **
    ** This is equivalent to
    **
    **    x>=y AND x<=z
    **
    ** X is stored in pExpr->pLeft.
    ** Y is stored in pExpr->pList->a[0].pExpr.
    ** Z is stored in pExpr->pList->a[1].pExpr.
    */
    case TK_BETWEEN: {
      Expr *pLeft = pExpr->pLeft;
      struct ExprList_item *pLItem = pExpr->pList->a;
      Expr *pRight = pLItem->pExpr;

      codeCompareOperands(pParse, pLeft, &r1, &regFree1,
                                  pRight, &r2, &regFree2);
      testcase( regFree1==0 );
      testcase( regFree2==0 );
      r3 = sqlite3GetTempReg(pParse);
      r4 = sqlite3GetTempReg(pParse);
      codeCompare(pParse, pLeft, pRight, OP_Ge,
                  r1, r2, r3, SQLITE_STOREP2);
      pLItem++;
      pRight = pLItem->pExpr;
      sqlite3ReleaseTempReg(pParse, regFree2);
      r2 = sqlite3ExprCodeTemp(pParse, pRight, &regFree2);
      testcase( regFree2==0 );
      codeCompare(pParse, pLeft, pRight, OP_Le, r1, r2, r4, SQLITE_STOREP2);
      sqlite3VdbeAddOp3(v, OP_And, r3, r4, target);
      sqlite3ReleaseTempReg(pParse, r3);
      sqlite3ReleaseTempReg(pParse, r4);
      break;
    }
    case TK_UPLUS: {
      inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target);
      break;
    }

    /*
    ** Form A:
    **   CASE x WHEN e1 THEN r1 WHEN e2 THEN r2 ... WHEN eN THEN rN ELSE y END
    **
    ** Form B:
    **   CASE WHEN e1 THEN r1 WHEN e2 THEN r2 ... WHEN eN THEN rN ELSE y END
    **
    ** Form A is can be transformed into the equivalent form B as follows:
    **   CASE WHEN x=e1 THEN r1 WHEN x=e2 THEN r2 ...
    **        WHEN x=eN THEN rN ELSE y END
    **
    ** X (if it exists) is in pExpr->pLeft.
    ** Y is in pExpr->pRight.  The Y is also optional.  If there is no
    ** ELSE clause and no other term matches, then the result of the
    ** exprssion is NULL.
    ** Ei is in pExpr->pList->a[i*2] and Ri is pExpr->pList->a[i*2+1].
    **
    ** The result of the expression is the Ri for the first matching Ei,
    ** or if there is no matching Ei, the ELSE term Y, or if there is
    ** no ELSE term, NULL.
    */
    case TK_CASE: {
      int endLabel;                     /* GOTO label for end of CASE stmt */
      int nextCase;                     /* GOTO label for next WHEN clause */
      int nExpr;                        /* 2x number of WHEN terms */
      int i;                            /* Loop counter */
      ExprList *pEList;                 /* List of WHEN terms */
      struct ExprList_item *aListelem;  /* Array of WHEN terms */
      Expr opCompare;                   /* The X==Ei expression */
      Expr cacheX;                      /* Cached expression X */
      Expr *pX;                         /* The X expression */
      Expr *pTest;                      /* X==Ei (form A) or just Ei (form B) */

      assert(pExpr->pList);
      assert((pExpr->pList->nExpr % 2) == 0);
      assert(pExpr->pList->nExpr > 0);
      pEList = pExpr->pList;
      aListelem = pEList->a;
      nExpr = pEList->nExpr;
      endLabel = sqlite3VdbeMakeLabel(v);
      if( (pX = pExpr->pLeft)!=0 ){
        cacheX = *pX;
        testcase( pX->op==TK_COLUMN || pX->op==TK_REGISTER );
        cacheX.iTable = sqlite3ExprCodeTemp(pParse, pX, &regFree1);
        testcase( regFree1==0 );
        cacheX.op = TK_REGISTER;
        cacheX.iColumn = 0;
        opCompare.op = TK_EQ;
        opCompare.pLeft = &cacheX;
        pTest = &opCompare;
      }
      pParse->disableColCache++;
      for(i=0; i<nExpr; i=i+2){
        if( pX ){
          opCompare.pRight = aListelem[i].pExpr;
        }else{
          pTest = aListelem[i].pExpr;
        }
        nextCase = sqlite3VdbeMakeLabel(v);
        testcase( pTest->op==TK_COLUMN || pTest->op==TK_REGISTER );
        sqlite3ExprIfFalse(pParse, pTest, nextCase, SQLITE_JUMPIFNULL);
        testcase( aListelem[i+1].pExpr->op==TK_COLUMN );
        testcase( aListelem[i+1].pExpr->op==TK_REGISTER );
        sqlite3ExprCode(pParse, aListelem[i+1].pExpr, target);
        sqlite3VdbeAddOp2(v, OP_Goto, 0, endLabel);
        sqlite3VdbeResolveLabel(v, nextCase);
      }
      if( pExpr->pRight ){
        sqlite3ExprCode(pParse, pExpr->pRight, target);
      }else{
        sqlite3VdbeAddOp2(v, OP_Null, 0, target);
      }
      sqlite3VdbeResolveLabel(v, endLabel);
      assert( pParse->disableColCache>0 );
      pParse->disableColCache--;
      break;
    }
#ifndef SQLITE_OMIT_TRIGGER
    case TK_RAISE: {
      if( !pParse->trigStack ){
        sqlite3ErrorMsg(pParse,
                       "RAISE() may only be used within a trigger-program");
        return 0;
      }
      if( pExpr->iColumn!=OE_Ignore ){
         assert( pExpr->iColumn==OE_Rollback ||
                 pExpr->iColumn == OE_Abort ||
                 pExpr->iColumn == OE_Fail );
         sqlite3DequoteExpr(pParse->db, pExpr);
         sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CONSTRAINT, pExpr->iColumn, 0,
                        (char*)pExpr->token.z, pExpr->token.n);
      } else {
         assert( pExpr->iColumn == OE_Ignore );
         sqlite3VdbeAddOp2(v, OP_ContextPop, 0, 0);
         sqlite3VdbeAddOp2(v, OP_Goto, 0, pParse->trigStack->ignoreJump);
         VdbeComment((v, "raise(IGNORE)"));
      }
      break;
    }
#endif
  }
  sqlite3ReleaseTempReg(pParse, regFree1);
  sqlite3ReleaseTempReg(pParse, regFree2);
  return inReg;
}

/*
** Generate code to evaluate an expression and store the results
** into a register.  Return the register number where the results
** are stored.
**
** If the register is a temporary register that can be deallocated,
** then write its number into *pReg.  If the result register is not
** a temporary, then set *pReg to zero.
*/
int sqlite3ExprCodeTemp(Parse *pParse, Expr *pExpr, int *pReg){
  int r1 = sqlite3GetTempReg(pParse);
  int r2 = sqlite3ExprCodeTarget(pParse, pExpr, r1);
  if( r2==r1 ){
    *pReg = r1;
  }else{
    sqlite3ReleaseTempReg(pParse, r1);
    *pReg = 0;
  }
  return r2;
}

/*
** Generate code that will evaluate expression pExpr and store the
** results in register target.  The results are guaranteed to appear
** in register target.
*/
int sqlite3ExprCode(Parse *pParse, Expr *pExpr, int target){
  int inReg;

  assert( target>0 && target<=pParse->nMem );
  inReg = sqlite3ExprCodeTarget(pParse, pExpr, target);
  assert( pParse->pVdbe || pParse->db->mallocFailed );
  if( inReg!=target && pParse->pVdbe ){
    sqlite3VdbeAddOp2(pParse->pVdbe, OP_SCopy, inReg, target);
  }
  return target;
}

/*
** Generate code that evalutes the given expression and puts the result
** in register target.
**
** Also make a copy of the expression results into another "cache" register
** and modify the expression so that the next time it is evaluated,
** the result is a copy of the cache register.
**
** This routine is used for expressions that are used multiple 
** times.  They are evaluated once and the results of the expression
** are reused.
*/
int sqlite3ExprCodeAndCache(Parse *pParse, Expr *pExpr, int target){
  Vdbe *v = pParse->pVdbe;
  int inReg;
  inReg = sqlite3ExprCode(pParse, pExpr, target);
  assert( target>0 );
  if( pExpr->op!=TK_REGISTER ){  
    int iMem;
    iMem = ++pParse->nMem;
    sqlite3VdbeAddOp2(v, OP_Copy, inReg, iMem);
    pExpr->iTable = iMem;
    pExpr->iColumn = pExpr->op;
    pExpr->op = TK_REGISTER;
  }
  return inReg;
}

/*
** Return TRUE if pExpr is an constant expression that is appropriate
** for factoring out of a loop.  Appropriate expressions are:
**
**    *  Any expression that evaluates to two or more opcodes.
**
**    *  Any OP_Integer, OP_Real, OP_String, OP_Blob, OP_Null, 
**       or OP_Variable that does not need to be placed in a 
**       specific register.
**
** There is no point in factoring out single-instruction constant
** expressions that need to be placed in a particular register.  
** We could factor them out, but then we would end up adding an
** OP_SCopy instruction to move the value into the correct register
** later.  We might as well just use the original instruction and
** avoid the OP_SCopy.
*/
static int isAppropriateForFactoring(Expr *p){
  if( !sqlite3ExprIsConstantNotJoin(p) ){
    return 0;  /* Only constant expressions are appropriate for factoring */
  }
  if( (p->flags & EP_FixedDest)==0 ){
    return 1;  /* Any constant without a fixed destination is appropriate */
  }
  while( p->op==TK_UPLUS ) p = p->pLeft;
  switch( p->op ){
#ifndef SQLITE_OMIT_BLOB_LITERAL
    case TK_BLOB:
#endif
    case TK_VARIABLE:
    case TK_INTEGER:
    case TK_FLOAT:
    case TK_NULL:
    case TK_STRING: {
      testcase( p->op==TK_BLOB );
      testcase( p->op==TK_VARIABLE );
      testcase( p->op==TK_INTEGER );
      testcase( p->op==TK_FLOAT );
      testcase( p->op==TK_NULL );
      testcase( p->op==TK_STRING );
      /* Single-instruction constants with a fixed destination are
      ** better done in-line.  If we factor them, they will just end
      ** up generating an OP_SCopy to move the value to the destination
      ** register. */
      return 0;
    }
    case TK_UMINUS: {
       if( p->pLeft->op==TK_FLOAT || p->pLeft->op==TK_INTEGER ){
         return 0;
       }
       break;
    }
    default: {
      break;
    }
  }
  return 1;
}

/*
** If pExpr is a constant expression that is appropriate for
** factoring out of a loop, then evaluate the expression
** into a register and convert the expression into a TK_REGISTER
** expression.
*/
static int evalConstExpr(void *pArg, Expr *pExpr){
  Parse *pParse = (Parse*)pArg;
  switch( pExpr->op ){
    case TK_REGISTER: {
      return 1;
    }
    case TK_FUNCTION:
    case TK_AGG_FUNCTION:
    case TK_CONST_FUNC: {
      /* The arguments to a function have a fixed destination.
      ** Mark them this way to avoid generated unneeded OP_SCopy
      ** instructions. 
      */
      ExprList *pList = pExpr->pList;
      if( pList ){
        int i = pList->nExpr;
        struct ExprList_item *pItem = pList->a;
        for(; i>0; i--, pItem++){
          if( pItem->pExpr ) pItem->pExpr->flags |= EP_FixedDest;
        }
      }
      break;
    }
  }
  if( isAppropriateForFactoring(pExpr) ){
    int r1 = ++pParse->nMem;
    int r2;
    r2 = sqlite3ExprCodeTarget(pParse, pExpr, r1);
    if( r1!=r2 ) sqlite3ReleaseTempReg(pParse, r1);
    pExpr->iColumn = pExpr->op;
    pExpr->op = TK_REGISTER;
    pExpr->iTable = r2;
    return 1;
  }
  return 0;
}

/*
** Preevaluate constant subexpressions within pExpr and store the
** results in registers.  Modify pExpr so that the constant subexpresions
** are TK_REGISTER opcodes that refer to the precomputed values.
*/
void sqlite3ExprCodeConstants(Parse *pParse, Expr *pExpr){
   walkExprTree(pExpr, evalConstExpr, pParse);
}


/*
** Generate code that pushes the value of every element of the given
** expression list into a sequence of registers beginning at target.
**
** Return the number of elements evaluated.
*/
int sqlite3ExprCodeExprList(
  Parse *pParse,     /* Parsing context */
  ExprList *pList,   /* The expression list to be coded */
  int target,        /* Where to write results */
  int doHardCopy     /* Call sqlite3ExprHardCopy on each element if true */
){
  struct ExprList_item *pItem;
  int i, n;
  assert( pList!=0 || pParse->db->mallocFailed );
  if( pList==0 ){
    return 0;
  }
  assert( target>0 );
  n = pList->nExpr;
  for(pItem=pList->a, i=0; i<n; i++, pItem++){
    sqlite3ExprCode(pParse, pItem->pExpr, target+i);
    if( doHardCopy ) sqlite3ExprHardCopy(pParse, target, n);
  }
  return n;
}

/*
** Generate code for a boolean expression such that a jump is made
** to the label "dest" if the expression is true but execution
** continues straight thru if the expression is false.
**
** If the expression evaluates to NULL (neither true nor false), then
** take the jump if the jumpIfNull flag is SQLITE_JUMPIFNULL.
**
** This code depends on the fact that certain token values (ex: TK_EQ)
** are the same as opcode values (ex: OP_Eq) that implement the corresponding
** operation.  Special comments in vdbe.c and the mkopcodeh.awk script in
** the make process cause these values to align.  Assert()s in the code
** below verify that the numbers are aligned correctly.
*/
void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){
  Vdbe *v = pParse->pVdbe;
  int op = 0;
  int regFree1 = 0;
  int regFree2 = 0;
  int r1, r2;

  assert( jumpIfNull==SQLITE_JUMPIFNULL || jumpIfNull==0 );
  if( v==0 || pExpr==0 ) return;
  op = pExpr->op;
  switch( op ){
    case TK_AND: {
      int d2 = sqlite3VdbeMakeLabel(v);
      testcase( jumpIfNull==0 );
      testcase( pParse->disableColCache==0 );
      sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2,jumpIfNull^SQLITE_JUMPIFNULL);
      pParse->disableColCache++;
      sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
      assert( pParse->disableColCache>0 );
      pParse->disableColCache--;
      sqlite3VdbeResolveLabel(v, d2);
      break;
    }
    case TK_OR: {
      testcase( jumpIfNull==0 );
      testcase( pParse->disableColCache==0 );
      sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
      pParse->disableColCache++;
      sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull);
      assert( pParse->disableColCache>0 );
      pParse->disableColCache--;
      break;
    }
    case TK_NOT: {
      testcase( jumpIfNull==0 );
      sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
      break;
    }
    case TK_LT:
    case TK_LE:
    case TK_GT:
    case TK_GE:
    case TK_NE:
    case TK_EQ: {
      assert( TK_LT==OP_Lt );
      assert( TK_LE==OP_Le );
      assert( TK_GT==OP_Gt );
      assert( TK_GE==OP_Ge );
      assert( TK_EQ==OP_Eq );
      assert( TK_NE==OP_Ne );
      testcase( op==TK_LT );
      testcase( op==TK_LE );
      testcase( op==TK_GT );
      testcase( op==TK_GE );
      testcase( op==TK_EQ );
      testcase( op==TK_NE );
      testcase( jumpIfNull==0 );
      codeCompareOperands(pParse, pExpr->pLeft, &r1, &regFree1,
                                  pExpr->pRight, &r2, &regFree2);
      codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op,
                  r1, r2, dest, jumpIfNull);
      testcase( regFree1==0 );
      testcase( regFree2==0 );
      break;
    }
    case TK_ISNULL:
    case TK_NOTNULL: {
      assert( TK_ISNULL==OP_IsNull );
      assert( TK_NOTNULL==OP_NotNull );
      testcase( op==TK_ISNULL );
      testcase( op==TK_NOTNULL );
      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
      sqlite3VdbeAddOp2(v, op, r1, dest);
      testcase( regFree1==0 );
      break;
    }
    case TK_BETWEEN: {
      /*    x BETWEEN y AND z
      **
      ** Is equivalent to 
      **
      **    x>=y AND x<=z
      **
      ** Code it as such, taking care to do the common subexpression
      ** elementation of x.
      */
      Expr exprAnd;
      Expr compLeft;
      Expr compRight;
      Expr exprX;

      exprX = *pExpr->pLeft;
      exprAnd.op = TK_AND;
      exprAnd.pLeft = &compLeft;
      exprAnd.pRight = &compRight;
      compLeft.op = TK_GE;
      compLeft.pLeft = &exprX;
      compLeft.pRight = pExpr->pList->a[0].pExpr;
      compRight.op = TK_LE;
      compRight.pLeft = &exprX;
      compRight.pRight = pExpr->pList->a[1].pExpr;
      exprX.iTable = sqlite3ExprCodeTemp(pParse, &exprX, &regFree1);
      testcase( regFree1==0 );
      exprX.op = TK_REGISTER;
      testcase( jumpIfNull==0 );
      sqlite3ExprIfTrue(pParse, &exprAnd, dest, jumpIfNull);
      break;
    }
    default: {
      r1 = sqlite3ExprCodeTemp(pParse, pExpr, &regFree1);
      sqlite3VdbeAddOp3(v, OP_If, r1, dest, jumpIfNull!=0);
      testcase( regFree1==0 );
      testcase( jumpIfNull==0 );
      break;
    }
  }
  sqlite3ReleaseTempReg(pParse, regFree1);
  sqlite3ReleaseTempReg(pParse, regFree2);  
}

/*
** Generate code for a boolean expression such that a jump is made
** to the label "dest" if the expression is false but execution
** continues straight thru if the expression is true.
**
** If the expression evaluates to NULL (neither true nor false) then
** jump if jumpIfNull is SQLITE_JUMPIFNULL or fall through if jumpIfNull
** is 0.
*/
void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){
  Vdbe *v = pParse->pVdbe;
  int op = 0;
  int regFree1 = 0;
  int regFree2 = 0;
  int r1, r2;

  assert( jumpIfNull==SQLITE_JUMPIFNULL || jumpIfNull==0 );
  if( v==0 || pExpr==0 ) return;

  /* The value of pExpr->op and op are related as follows:
  **
  **       pExpr->op            op
  **       ---------          ----------
  **       TK_ISNULL          OP_NotNull
  **       TK_NOTNULL         OP_IsNull
  **       TK_NE              OP_Eq
  **       TK_EQ              OP_Ne
  **       TK_GT              OP_Le
  **       TK_LE              OP_Gt
  **       TK_GE              OP_Lt
  **       TK_LT              OP_Ge
  **
  ** For other values of pExpr->op, op is undefined and unused.
  ** The value of TK_ and OP_ constants are arranged such that we
  ** can compute the mapping above using the following expression.
  ** Assert()s verify that the computation is correct.
  */
  op = ((pExpr->op+(TK_ISNULL&1))^1)-(TK_ISNULL&1);

  /* Verify correct alignment of TK_ and OP_ constants
  */
  assert( pExpr->op!=TK_ISNULL || op==OP_NotNull );
  assert( pExpr->op!=TK_NOTNULL || op==OP_IsNull );
  assert( pExpr->op!=TK_NE || op==OP_Eq );
  assert( pExpr->op!=TK_EQ || op==OP_Ne );
  assert( pExpr->op!=TK_LT || op==OP_Ge );
  assert( pExpr->op!=TK_LE || op==OP_Gt );
  assert( pExpr->op!=TK_GT || op==OP_Le );
  assert( pExpr->op!=TK_GE || op==OP_Lt );

  switch( pExpr->op ){
    case TK_AND: {
      testcase( jumpIfNull==0 );
      testcase( pParse->disableColCache==0 );
      sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull);
      pParse->disableColCache++;
      sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
      assert( pParse->disableColCache>0 );
      pParse->disableColCache--;
      break;
    }
    case TK_OR: {
      int d2 = sqlite3VdbeMakeLabel(v);
      testcase( jumpIfNull==0 );
      testcase( pParse->disableColCache==0 );
      sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2, jumpIfNull^SQLITE_JUMPIFNULL);
      pParse->disableColCache++;
      sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull);
      assert( pParse->disableColCache>0 );
      pParse->disableColCache--;
      sqlite3VdbeResolveLabel(v, d2);
      break;
    }
    case TK_NOT: {
      sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull);
      break;
    }
    case TK_LT:
    case TK_LE:
    case TK_GT:
    case TK_GE:
    case TK_NE:
    case TK_EQ: {
      testcase( op==TK_LT );
      testcase( op==TK_LE );
      testcase( op==TK_GT );
      testcase( op==TK_GE );
      testcase( op==TK_EQ );
      testcase( op==TK_NE );
      testcase( jumpIfNull==0 );
      codeCompareOperands(pParse, pExpr->pLeft, &r1, &regFree1,
                                  pExpr->pRight, &r2, &regFree2);
      codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op,
                  r1, r2, dest, jumpIfNull);
      testcase( regFree1==0 );
      testcase( regFree2==0 );
      break;
    }
    case TK_ISNULL:
    case TK_NOTNULL: {
      testcase( op==TK_ISNULL );
      testcase( op==TK_NOTNULL );
      r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
      sqlite3VdbeAddOp2(v, op, r1, dest);
      testcase( regFree1==0 );
      break;
    }
    case TK_BETWEEN: {
      /*    x BETWEEN y AND z
      **
      ** Is equivalent to 
      **
      **    x>=y AND x<=z
      **
      ** Code it as such, taking care to do the common subexpression
      ** elementation of x.
      */
      Expr exprAnd;
      Expr compLeft;
      Expr compRight;
      Expr exprX;

      exprX = *pExpr->pLeft;
      exprAnd.op = TK_AND;
      exprAnd.pLeft = &compLeft;
      exprAnd.pRight = &compRight;
      compLeft.op = TK_GE;
      compLeft.pLeft = &exprX;
      compLeft.pRight = pExpr->pList->a[0].pExpr;
      compRight.op = TK_LE;
      compRight.pLeft = &exprX;
      compRight.pRight = pExpr->pList->a[1].pExpr;
      exprX.iTable = sqlite3ExprCodeTemp(pParse, &exprX, &regFree1);
      testcase( regFree1==0 );
      exprX.op = TK_REGISTER;
      testcase( jumpIfNull==0 );
      sqlite3ExprIfFalse(pParse, &exprAnd, dest, jumpIfNull);
      break;
    }
    default: {
      r1 = sqlite3ExprCodeTemp(pParse, pExpr, &regFree1);
      sqlite3VdbeAddOp3(v, OP_IfNot, r1, dest, jumpIfNull!=0);
      testcase( regFree1==0 );
      testcase( jumpIfNull==0 );
      break;
    }
  }
  sqlite3ReleaseTempReg(pParse, regFree1);
  sqlite3ReleaseTempReg(pParse, regFree2);
}

/*
** Do a deep comparison of two expression trees.  Return TRUE (non-zero)
** if they are identical and return FALSE if they differ in any way.
**
** Sometimes this routine will return FALSE even if the two expressions
** really are equivalent.  If we cannot prove that the expressions are
** identical, we return FALSE just to be safe.  So if this routine
** returns false, then you do not really know for certain if the two
** expressions are the same.  But if you get a TRUE return, then you
** can be sure the expressions are the same.  In the places where
** this routine is used, it does not hurt to get an extra FALSE - that
** just might result in some slightly slower code.  But returning
** an incorrect TRUE could lead to a malfunction.
*/
int sqlite3ExprCompare(Expr *pA, Expr *pB){
  int i;
  if( pA==0||pB==0 ){
    return pB==pA;
  }
  if( pA->op!=pB->op ) return 0;
  if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 0;
  if( !sqlite3ExprCompare(pA->pLeft, pB->pLeft) ) return 0;
  if( !sqlite3ExprCompare(pA->pRight, pB->pRight) ) return 0;
  if( pA->pList ){
    if( pB->pList==0 ) return 0;
    if( pA->pList->nExpr!=pB->pList->nExpr ) return 0;
    for(i=0; i<pA->pList->nExpr; i++){
      if( !sqlite3ExprCompare(pA->pList->a[i].pExpr, pB->pList->a[i].pExpr) ){
        return 0;
      }
    }
  }else if( pB->pList ){
    return 0;
  }
  if( pA->pSelect || pB->pSelect ) return 0;
  if( pA->iTable!=pB->iTable || pA->iColumn!=pB->iColumn ) return 0;
  if( pA->op!=TK_COLUMN && pA->token.z ){
    if( pB->token.z==0 ) return 0;
    if( pB->token.n!=pA->token.n ) return 0;
    if( sqlite3StrNICmp((char*)pA->token.z,(char*)pB->token.z,pB->token.n)!=0 ){
      return 0;
    }
  }
  return 1;
}


/*
** Add a new element to the pAggInfo->aCol[] array.  Return the index of
** the new element.  Return a negative number if malloc fails.
*/
static int addAggInfoColumn(sqlite3 *db, AggInfo *pInfo){
  int i;
  pInfo->aCol = sqlite3ArrayAllocate(
       db,
       pInfo->aCol,
       sizeof(pInfo->aCol[0]),
       3,
       &pInfo->nColumn,
       &pInfo->nColumnAlloc,
       &i
  );
  return i;
}    

/*
** Add a new element to the pAggInfo->aFunc[] array.  Return the index of
** the new element.  Return a negative number if malloc fails.
*/
static int addAggInfoFunc(sqlite3 *db, AggInfo *pInfo){
  int i;
  pInfo->aFunc = sqlite3ArrayAllocate(
       db, 
       pInfo->aFunc,
       sizeof(pInfo->aFunc[0]),
       3,
       &pInfo->nFunc,
       &pInfo->nFuncAlloc,
       &i
  );
  return i;
}    

/*
** This is an xFunc for walkExprTree() used to implement 
** sqlite3ExprAnalyzeAggregates().  See sqlite3ExprAnalyzeAggregates
** for additional information.
**
** This routine analyzes the aggregate function at pExpr.
*/
static int analyzeAggregate(void *pArg, Expr *pExpr){
  int i;
  NameContext *pNC = (NameContext *)pArg;
  Parse *pParse = pNC->pParse;
  SrcList *pSrcList = pNC->pSrcList;
  AggInfo *pAggInfo = pNC->pAggInfo;

  switch( pExpr->op ){
    case TK_AGG_COLUMN:
    case TK_COLUMN: {
      /* Check to see if the column is in one of the tables in the FROM
      ** clause of the aggregate query */
      if( pSrcList ){
        struct SrcList_item *pItem = pSrcList->a;
        for(i=0; i<pSrcList->nSrc; i++, pItem++){
          struct AggInfo_col *pCol;
          if( pExpr->iTable==pItem->iCursor ){
            /* If we reach this point, it means that pExpr refers to a table
            ** that is in the FROM clause of the aggregate query.  
            **
            ** Make an entry for the column in pAggInfo->aCol[] if there
            ** is not an entry there already.
            */
            int k;
            pCol = pAggInfo->aCol;
            for(k=0; k<pAggInfo->nColumn; k++, pCol++){
              if( pCol->iTable==pExpr->iTable &&
                  pCol->iColumn==pExpr->iColumn ){
                break;
              }
            }
            if( (k>=pAggInfo->nColumn)
             && (k = addAggInfoColumn(pParse->db, pAggInfo))>=0 
            ){
              pCol = &pAggInfo->aCol[k];
              pCol->pTab = pExpr->pTab;
              pCol->iTable = pExpr->iTable;
              pCol->iColumn = pExpr->iColumn;
              pCol->iMem = ++pParse->nMem;
              pCol->iSorterColumn = -1;
              pCol->pExpr = pExpr;
              if( pAggInfo->pGroupBy ){
                int j, n;
                ExprList *pGB = pAggInfo->pGroupBy;
                struct ExprList_item *pTerm = pGB->a;
                n = pGB->nExpr;
                for(j=0; j<n; j++, pTerm++){
                  Expr *pE = pTerm->pExpr;
                  if( pE->op==TK_COLUMN && pE->iTable==pExpr->iTable &&
                      pE->iColumn==pExpr->iColumn ){
                    pCol->iSorterColumn = j;
                    break;
                  }
                }
              }
              if( pCol->iSorterColumn<0 ){
                pCol->iSorterColumn = pAggInfo->nSortingColumn++;
              }
            }
            /* There is now an entry for pExpr in pAggInfo->aCol[] (either
            ** because it was there before or because we just created it).
            ** Convert the pExpr to be a TK_AGG_COLUMN referring to that
            ** pAggInfo->aCol[] entry.
            */
            pExpr->pAggInfo = pAggInfo;
            pExpr->op = TK_AGG_COLUMN;
            pExpr->iAgg = k;
            break;
          } /* endif pExpr->iTable==pItem->iCursor */
        } /* end loop over pSrcList */
      }
      return 1;
    }
    case TK_AGG_FUNCTION: {
      /* The pNC->nDepth==0 test causes aggregate functions in subqueries
      ** to be ignored */
      if( pNC->nDepth==0 ){
        /* Check to see if pExpr is a duplicate of another aggregate 
        ** function that is already in the pAggInfo structure
        */
        struct AggInfo_func *pItem = pAggInfo->aFunc;
        for(i=0; i<pAggInfo->nFunc; i++, pItem++){
          if( sqlite3ExprCompare(pItem->pExpr, pExpr) ){
            break;
          }
        }
        if( i>=pAggInfo->nFunc ){
          /* pExpr is original.  Make a new entry in pAggInfo->aFunc[]
          */
          u8 enc = ENC(pParse->db);
          i = addAggInfoFunc(pParse->db, pAggInfo);
          if( i>=0 ){
            pItem = &pAggInfo->aFunc[i];
            pItem->pExpr = pExpr;
            pItem->iMem = ++pParse->nMem;
            pItem->pFunc = sqlite3FindFunction(pParse->db,
                   (char*)pExpr->token.z, pExpr->token.n,
                   pExpr->pList ? pExpr->pList->nExpr : 0, enc, 0);
            if( pExpr->flags & EP_Distinct ){
              pItem->iDistinct = pParse->nTab++;
            }else{
              pItem->iDistinct = -1;
            }
          }
        }
        /* Make pExpr point to the appropriate pAggInfo->aFunc[] entry
        */
        pExpr->iAgg = i;
        pExpr->pAggInfo = pAggInfo;
        return 1;
      }
    }
  }

  /* Recursively walk subqueries looking for TK_COLUMN nodes that need
  ** to be changed to TK_AGG_COLUMN.  But increment nDepth so that
  ** TK_AGG_FUNCTION nodes in subqueries will be unchanged.
  */
  if( pExpr->pSelect ){
    pNC->nDepth++;
    walkSelectExpr(pExpr->pSelect, analyzeAggregate, pNC);
    pNC->nDepth--;
  }
  return 0;
}

/*
** Analyze the given expression looking for aggregate functions and
** for variables that need to be added to the pParse->aAgg[] array.
** Make additional entries to the pParse->aAgg[] array as necessary.
**
** This routine should only be called after the expression has been
** analyzed by sqlite3ExprResolveNames().
*/
void sqlite3ExprAnalyzeAggregates(NameContext *pNC, Expr *pExpr){
  walkExprTree(pExpr, analyzeAggregate, pNC);
}

/*
** Call sqlite3ExprAnalyzeAggregates() for every expression in an
** expression list.  Return the number of errors.
**
** If an error is found, the analysis is cut short.
*/
void sqlite3ExprAnalyzeAggList(NameContext *pNC, ExprList *pList){
  struct ExprList_item *pItem;
  int i;
  if( pList ){
    for(pItem=pList->a, i=0; i<pList->nExpr; i++, pItem++){
      sqlite3ExprAnalyzeAggregates(pNC, pItem->pExpr);
    }
  }
}

/*
** Allocate or deallocate temporary use registers during code generation.
*/
int sqlite3GetTempReg(Parse *pParse){
  if( pParse->nTempReg==0 ){
    return ++pParse->nMem;
  }
  return pParse->aTempReg[--pParse->nTempReg];
}
void sqlite3ReleaseTempReg(Parse *pParse, int iReg){
  if( iReg && pParse->nTempReg<ArraySize(pParse->aTempReg) ){
    sqlite3ExprWritableRegister(pParse, iReg, iReg);
    pParse->aTempReg[pParse->nTempReg++] = iReg;
  }
}

/*
** Allocate or deallocate a block of nReg consecutive registers
*/
int sqlite3GetTempRange(Parse *pParse, int nReg){
  int i, n;
  i = pParse->iRangeReg;
  n = pParse->nRangeReg;
  if( nReg<=n && !usedAsColumnCache(pParse, i, i+n-1) ){
    pParse->iRangeReg += nReg;
    pParse->nRangeReg -= nReg;
  }else{
    i = pParse->nMem+1;
    pParse->nMem += nReg;
  }
  return i;
}
void sqlite3ReleaseTempRange(Parse *pParse, int iReg, int nReg){
  if( nReg>pParse->nRangeReg ){
    pParse->nRangeReg = nReg;
    pParse->iRangeReg = iReg;
  }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/fault.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
** 2008 Jan 22
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** $Id: fault.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/

/*
** This file contains code to support the concept of "benign" 
** malloc failures (when the xMalloc() or xRealloc() method of the
** sqlite3_mem_methods structure fails to allocate a block of memory
** and returns 0). 
**
** Most malloc failures are non-benign. After they occur, SQLite
** abandons the current operation and returns an error code (usually
** SQLITE_NOMEM) to the user. However, sometimes a fault is not necessarily
** fatal. For example, if a malloc fails while resizing a hash table, this 
** is completely recoverable simply by not carrying out the resize. The 
** hash table will continue to function normally.  So a malloc failure 
** during a hash table resize is a benign fault.
*/

#include "sqliteInt.h"

#ifndef SQLITE_OMIT_BUILTIN_TEST

/*
** Global variables.
*/
static struct BenignMallocHooks {
  void (*xBenignBegin)(void);
  void (*xBenignEnd)(void);
} hooks;

/*
** Register hooks to call when sqlite3BeginBenignMalloc() and
** sqlite3EndBenignMalloc() are called, respectively.
*/
void sqlite3BenignMallocHooks(
  void (*xBenignBegin)(void),
  void (*xBenignEnd)(void)
){
  hooks.xBenignBegin = xBenignBegin;
  hooks.xBenignEnd = xBenignEnd;
}

/*
** This (sqlite3EndBenignMalloc()) is called by SQLite code to indicate that
** subsequent malloc failures are benign. A call to sqlite3EndBenignMalloc()
** indicates that subsequent malloc failures are non-benign.
*/
void sqlite3BeginBenignMalloc(void){
  if( hooks.xBenignBegin ){
    hooks.xBenignBegin();
  }
}
void sqlite3EndBenignMalloc(void){
  if( hooks.xBenignEnd ){
    hooks.xBenignEnd();
  }
}

#endif   /* #ifndef SQLITE_OMIT_BUILTIN_TEST */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































Deleted SQLite.Interop/splitsource/fts3.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
/*
** 2006 Oct 10
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This is an SQLite module implementing full-text search.
*/

/*
** The code in this file is only compiled if:
**
**     * The FTS3 module is being built as an extension
**       (in which case SQLITE_CORE is not defined), or
**
**     * The FTS3 module is being built into the core of
**       SQLite (in which case SQLITE_ENABLE_FTS3 is defined).
*/

/* TODO(shess) Consider exporting this comment to an HTML file or the
** wiki.
*/
/* The full-text index is stored in a series of b+tree (-like)
** structures called segments which map terms to doclists.  The
** structures are like b+trees in layout, but are constructed from the
** bottom up in optimal fashion and are not updatable.  Since trees
** are built from the bottom up, things will be described from the
** bottom up.
**
**
**** Varints ****
** The basic unit of encoding is a variable-length integer called a
** varint.  We encode variable-length integers in little-endian order
** using seven bits * per byte as follows:
**
** KEY:
**         A = 0xxxxxxx    7 bits of data and one flag bit
**         B = 1xxxxxxx    7 bits of data and one flag bit
**
**  7 bits - A
** 14 bits - BA
** 21 bits - BBA
** and so on.
**
** This is identical to how sqlite encodes varints (see util.c).
**
**
**** Document lists ****
** A doclist (document list) holds a docid-sorted list of hits for a
** given term.  Doclists hold docids, and can optionally associate
** token positions and offsets with docids.
**
** A DL_POSITIONS_OFFSETS doclist is stored like this:
**
** array {
**   varint docid;
**   array {                (position list for column 0)
**     varint position;     (delta from previous position plus POS_BASE)
**     varint startOffset;  (delta from previous startOffset)
**     varint endOffset;    (delta from startOffset)
**   }
**   array {
**     varint POS_COLUMN;   (marks start of position list for new column)
**     varint column;       (index of new column)
**     array {
**       varint position;   (delta from previous position plus POS_BASE)
**       varint startOffset;(delta from previous startOffset)
**       varint endOffset;  (delta from startOffset)
**     }
**   }
**   varint POS_END;        (marks end of positions for this document.
** }
**
** Here, array { X } means zero or more occurrences of X, adjacent in
** memory.  A "position" is an index of a token in the token stream
** generated by the tokenizer, while an "offset" is a byte offset,
** both based at 0.  Note that POS_END and POS_COLUMN occur in the
** same logical place as the position element, and act as sentinals
** ending a position list array.
**
** A DL_POSITIONS doclist omits the startOffset and endOffset
** information.  A DL_DOCIDS doclist omits both the position and
** offset information, becoming an array of varint-encoded docids.
**
** On-disk data is stored as type DL_DEFAULT, so we don't serialize
** the type.  Due to how deletion is implemented in the segmentation
** system, on-disk doclists MUST store at least positions.
**
**
**** Segment leaf nodes ****
** Segment leaf nodes store terms and doclists, ordered by term.  Leaf
** nodes are written using LeafWriter, and read using LeafReader (to
** iterate through a single leaf node's data) and LeavesReader (to
** iterate through a segment's entire leaf layer).  Leaf nodes have
** the format:
**
** varint iHeight;             (height from leaf level, always 0)
** varint nTerm;               (length of first term)
** char pTerm[nTerm];          (content of first term)
** varint nDoclist;            (length of term's associated doclist)
** char pDoclist[nDoclist];    (content of doclist)
** array {
**                             (further terms are delta-encoded)
**   varint nPrefix;           (length of prefix shared with previous term)
**   varint nSuffix;           (length of unshared suffix)
**   char pTermSuffix[nSuffix];(unshared suffix of next term)
**   varint nDoclist;          (length of term's associated doclist)
**   char pDoclist[nDoclist];  (content of doclist)
** }
**
** Here, array { X } means zero or more occurrences of X, adjacent in
** memory.
**
** Leaf nodes are broken into blocks which are stored contiguously in
** the %_segments table in sorted order.  This means that when the end
** of a node is reached, the next term is in the node with the next
** greater node id.
**
** New data is spilled to a new leaf node when the current node
** exceeds LEAF_MAX bytes (default 2048).  New data which itself is
** larger than STANDALONE_MIN (default 1024) is placed in a standalone
** node (a leaf node with a single term and doclist).  The goal of
** these settings is to pack together groups of small doclists while
** making it efficient to directly access large doclists.  The
** assumption is that large doclists represent terms which are more
** likely to be query targets.
**
** TODO(shess) It may be useful for blocking decisions to be more
** dynamic.  For instance, it may make more sense to have a 2.5k leaf
** node rather than splitting into 2k and .5k nodes.  My intuition is
** that this might extend through 2x or 4x the pagesize.
**
**
**** Segment interior nodes ****
** Segment interior nodes store blockids for subtree nodes and terms
** to describe what data is stored by the each subtree.  Interior
** nodes are written using InteriorWriter, and read using
** InteriorReader.  InteriorWriters are created as needed when
** SegmentWriter creates new leaf nodes, or when an interior node
** itself grows too big and must be split.  The format of interior
** nodes:
**
** varint iHeight;           (height from leaf level, always >0)
** varint iBlockid;          (block id of node's leftmost subtree)
** optional {
**   varint nTerm;           (length of first term)
**   char pTerm[nTerm];      (content of first term)
**   array {
**                                (further terms are delta-encoded)
**     varint nPrefix;            (length of shared prefix with previous term)
**     varint nSuffix;            (length of unshared suffix)
**     char pTermSuffix[nSuffix]; (unshared suffix of next term)
**   }
** }
**
** Here, optional { X } means an optional element, while array { X }
** means zero or more occurrences of X, adjacent in memory.
**
** An interior node encodes n terms separating n+1 subtrees.  The
** subtree blocks are contiguous, so only the first subtree's blockid
** is encoded.  The subtree at iBlockid will contain all terms less
** than the first term encoded (or all terms if no term is encoded).
** Otherwise, for terms greater than or equal to pTerm[i] but less
** than pTerm[i+1], the subtree for that term will be rooted at
** iBlockid+i.  Interior nodes only store enough term data to
** distinguish adjacent children (if the rightmost term of the left
** child is "something", and the leftmost term of the right child is
** "wicked", only "w" is stored).
**
** New data is spilled to a new interior node at the same height when
** the current node exceeds INTERIOR_MAX bytes (default 2048).
** INTERIOR_MIN_TERMS (default 7) keeps large terms from monopolizing
** interior nodes and making the tree too skinny.  The interior nodes
** at a given height are naturally tracked by interior nodes at
** height+1, and so on.
**
**
**** Segment directory ****
** The segment directory in table %_segdir stores meta-information for
** merging and deleting segments, and also the root node of the
** segment's tree.
**
** The root node is the top node of the segment's tree after encoding
** the entire segment, restricted to ROOT_MAX bytes (default 1024).
** This could be either a leaf node or an interior node.  If the top
** node requires more than ROOT_MAX bytes, it is flushed to %_segments
** and a new root interior node is generated (which should always fit
** within ROOT_MAX because it only needs space for 2 varints, the
** height and the blockid of the previous root).
**
** The meta-information in the segment directory is:
**   level               - segment level (see below)
**   idx                 - index within level
**                       - (level,idx uniquely identify a segment)
**   start_block         - first leaf node
**   leaves_end_block    - last leaf node
**   end_block           - last block (including interior nodes)
**   root                - contents of root node
**
** If the root node is a leaf node, then start_block,
** leaves_end_block, and end_block are all 0.
**
**
**** Segment merging ****
** To amortize update costs, segments are groups into levels and
** merged in matches.  Each increase in level represents exponentially
** more documents.
**
** New documents (actually, document updates) are tokenized and
** written individually (using LeafWriter) to a level 0 segment, with
** incrementing idx.  When idx reaches MERGE_COUNT (default 16), all
** level 0 segments are merged into a single level 1 segment.  Level 1
** is populated like level 0, and eventually MERGE_COUNT level 1
** segments are merged to a single level 2 segment (representing
** MERGE_COUNT^2 updates), and so on.
**
** A segment merge traverses all segments at a given level in
** parallel, performing a straightforward sorted merge.  Since segment
** leaf nodes are written in to the %_segments table in order, this
** merge traverses the underlying sqlite disk structures efficiently.
** After the merge, all segment blocks from the merged level are
** deleted.
**
** MERGE_COUNT controls how often we merge segments.  16 seems to be
** somewhat of a sweet spot for insertion performance.  32 and 64 show
** very similar performance numbers to 16 on insertion, though they're
** a tiny bit slower (perhaps due to more overhead in merge-time
** sorting).  8 is about 20% slower than 16, 4 about 50% slower than
** 16, 2 about 66% slower than 16.
**
** At query time, high MERGE_COUNT increases the number of segments
** which need to be scanned and merged.  For instance, with 100k docs
** inserted:
**
**    MERGE_COUNT   segments
**       16           25
**        8           12
**        4           10
**        2            6
**
** This appears to have only a moderate impact on queries for very
** frequent terms (which are somewhat dominated by segment merge
** costs), and infrequent and non-existent terms still seem to be fast
** even with many segments.
**
** TODO(shess) That said, it would be nice to have a better query-side
** argument for MERGE_COUNT of 16.  Also, it is possible/likely that
** optimizations to things like doclist merging will swing the sweet
** spot around.
**
**
**
**** Handling of deletions and updates ****
** Since we're using a segmented structure, with no docid-oriented
** index into the term index, we clearly cannot simply update the term
** index when a document is deleted or updated.  For deletions, we
** write an empty doclist (varint(docid) varint(POS_END)), for updates
** we simply write the new doclist.  Segment merges overwrite older
** data for a particular docid with newer data, so deletes or updates
** will eventually overtake the earlier data and knock it out.  The
** query logic likewise merges doclists so that newer data knocks out
** older data.
**
** TODO(shess) Provide a VACUUM type operation to clear out all
** deletions and duplications.  This would basically be a forced merge
** into a single segment.
*/

#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)

#if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_CORE)
# define SQLITE_CORE 1
#endif

#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

#include "fts3.h"
#include "fts3_hash.h"
#include "fts3_tokenizer.h"
#ifndef SQLITE_CORE 
# include "sqlite3ext.h"
  SQLITE_EXTENSION_INIT1
#endif


/* TODO(shess) MAN, this thing needs some refactoring.  At minimum, it
** would be nice to order the file better, perhaps something along the
** lines of:
**
**  - utility functions
**  - table setup functions
**  - table update functions
**  - table query functions
**
** Put the query functions last because they're likely to reference
** typedefs or functions from the table update section.
*/

#if 0
# define FTSTRACE(A)  printf A; fflush(stdout)
#else
# define FTSTRACE(A)
#endif

/*
** Default span for NEAR operators.
*/
#define SQLITE_FTS3_DEFAULT_NEAR_PARAM 10

/* It is not safe to call isspace(), tolower(), or isalnum() on
** hi-bit-set characters.  This is the same solution used in the
** tokenizer.
*/
/* TODO(shess) The snippet-generation code should be using the
** tokenizer-generated tokens rather than doing its own local
** tokenization.
*/
/* TODO(shess) Is __isascii() a portable version of (c&0x80)==0? */
static int safe_isspace(char c){
  return (c&0x80)==0 ? isspace(c) : 0;
}
static int safe_tolower(char c){
  return (c&0x80)==0 ? tolower(c) : c;
}
static int safe_isalnum(char c){
  return (c&0x80)==0 ? isalnum(c) : 0;
}

typedef enum DocListType {
  DL_DOCIDS,              /* docids only */
  DL_POSITIONS,           /* docids + positions */
  DL_POSITIONS_OFFSETS    /* docids + positions + offsets */
} DocListType;

/*
** By default, only positions and not offsets are stored in the doclists.
** To change this so that offsets are stored too, compile with
**
**          -DDL_DEFAULT=DL_POSITIONS_OFFSETS
**
** If DL_DEFAULT is set to DL_DOCIDS, your table can only be inserted
** into (no deletes or updates).
*/
#ifndef DL_DEFAULT
# define DL_DEFAULT DL_POSITIONS
#endif

enum {
  POS_END = 0,        /* end of this position list */
  POS_COLUMN,         /* followed by new column number */
  POS_BASE
};

/* MERGE_COUNT controls how often we merge segments (see comment at
** top of file).
*/
#define MERGE_COUNT 16

/* utility functions */

/* CLEAR() and SCRAMBLE() abstract memset() on a pointer to a single
** record to prevent errors of the form:
**
** my_function(SomeType *b){
**   memset(b, '\0', sizeof(b));  // sizeof(b)!=sizeof(*b)
** }
*/
/* TODO(shess) Obvious candidates for a header file. */
#define CLEAR(b) memset(b, '\0', sizeof(*(b)))

#ifndef NDEBUG
#  define SCRAMBLE(b) memset(b, 0x55, sizeof(*(b)))
#else
#  define SCRAMBLE(b)
#endif

/* We may need up to VARINT_MAX bytes to store an encoded 64-bit integer. */
#define VARINT_MAX 10

/* Write a 64-bit variable-length integer to memory starting at p[0].
 * The length of data written will be between 1 and VARINT_MAX bytes.
 * The number of bytes written is returned. */
static int fts3PutVarint(char *p, sqlite_int64 v){
  unsigned char *q = (unsigned char *) p;
  sqlite_uint64 vu = v;
  do{
    *q++ = (unsigned char) ((vu & 0x7f) | 0x80);
    vu >>= 7;
  }while( vu!=0 );
  q[-1] &= 0x7f;  /* turn off high bit in final byte */
  assert( q - (unsigned char *)p <= VARINT_MAX );
  return (int) (q - (unsigned char *)p);
}

/* Read a 64-bit variable-length integer from memory starting at p[0].
 * Return the number of bytes read, or 0 on error.
 * The value is stored in *v. */
static int fts3GetVarint(const char *p, sqlite_int64 *v){
  const unsigned char *q = (const unsigned char *) p;
  sqlite_uint64 x = 0, y = 1;
  while( (*q & 0x80) == 0x80 ){
    x += y * (*q++ & 0x7f);
    y <<= 7;
    if( q - (unsigned char *)p >= VARINT_MAX ){  /* bad data */
      assert( 0 );
      return 0;
    }
  }
  x += y * (*q++);
  *v = (sqlite_int64) x;
  return (int) (q - (unsigned char *)p);
}

static int fts3GetVarint32(const char *p, int *pi){
 sqlite_int64 i;
 int ret = fts3GetVarint(p, &i);
 *pi = (int) i;
 assert( *pi==i );
 return ret;
}

/*******************************************************************/
/* DataBuffer is used to collect data into a buffer in piecemeal
** fashion.  It implements the usual distinction between amount of
** data currently stored (nData) and buffer capacity (nCapacity).
**
** dataBufferInit - create a buffer with given initial capacity.
** dataBufferReset - forget buffer's data, retaining capacity.
** dataBufferDestroy - free buffer's data.
** dataBufferSwap - swap contents of two buffers.
** dataBufferExpand - expand capacity without adding data.
** dataBufferAppend - append data.
** dataBufferAppend2 - append two pieces of data at once.
** dataBufferReplace - replace buffer's data.
*/
typedef struct DataBuffer {
  char *pData;          /* Pointer to malloc'ed buffer. */
  int nCapacity;        /* Size of pData buffer. */
  int nData;            /* End of data loaded into pData. */
} DataBuffer;

static void dataBufferInit(DataBuffer *pBuffer, int nCapacity){
  assert( nCapacity>=0 );
  pBuffer->nData = 0;
  pBuffer->nCapacity = nCapacity;
  pBuffer->pData = nCapacity==0 ? NULL : sqlite3_malloc(nCapacity);
}
static void dataBufferReset(DataBuffer *pBuffer){
  pBuffer->nData = 0;
}
static void dataBufferDestroy(DataBuffer *pBuffer){
  if( pBuffer->pData!=NULL ) sqlite3_free(pBuffer->pData);
  SCRAMBLE(pBuffer);
}
static void dataBufferSwap(DataBuffer *pBuffer1, DataBuffer *pBuffer2){
  DataBuffer tmp = *pBuffer1;
  *pBuffer1 = *pBuffer2;
  *pBuffer2 = tmp;
}
static void dataBufferExpand(DataBuffer *pBuffer, int nAddCapacity){
  assert( nAddCapacity>0 );
  /* TODO(shess) Consider expanding more aggressively.  Note that the
  ** underlying malloc implementation may take care of such things for
  ** us already.
  */
  if( pBuffer->nData+nAddCapacity>pBuffer->nCapacity ){
    pBuffer->nCapacity = pBuffer->nData+nAddCapacity;
    pBuffer->pData = sqlite3_realloc(pBuffer->pData, pBuffer->nCapacity);
  }
}
static void dataBufferAppend(DataBuffer *pBuffer,
                             const char *pSource, int nSource){
  assert( nSource>0 && pSource!=NULL );
  dataBufferExpand(pBuffer, nSource);
  memcpy(pBuffer->pData+pBuffer->nData, pSource, nSource);
  pBuffer->nData += nSource;
}
static void dataBufferAppend2(DataBuffer *pBuffer,
                              const char *pSource1, int nSource1,
                              const char *pSource2, int nSource2){
  assert( nSource1>0 && pSource1!=NULL );
  assert( nSource2>0 && pSource2!=NULL );
  dataBufferExpand(pBuffer, nSource1+nSource2);
  memcpy(pBuffer->pData+pBuffer->nData, pSource1, nSource1);
  memcpy(pBuffer->pData+pBuffer->nData+nSource1, pSource2, nSource2);
  pBuffer->nData += nSource1+nSource2;
}
static void dataBufferReplace(DataBuffer *pBuffer,
                              const char *pSource, int nSource){
  dataBufferReset(pBuffer);
  dataBufferAppend(pBuffer, pSource, nSource);
}

/* StringBuffer is a null-terminated version of DataBuffer. */
typedef struct StringBuffer {
  DataBuffer b;            /* Includes null terminator. */
} StringBuffer;

static void initStringBuffer(StringBuffer *sb){
  dataBufferInit(&sb->b, 100);
  dataBufferReplace(&sb->b, "", 1);
}
static int stringBufferLength(StringBuffer *sb){
  return sb->b.nData-1;
}
static char *stringBufferData(StringBuffer *sb){
  return sb->b.pData;
}
static void stringBufferDestroy(StringBuffer *sb){
  dataBufferDestroy(&sb->b);
}

static void nappend(StringBuffer *sb, const char *zFrom, int nFrom){
  assert( sb->b.nData>0 );
  if( nFrom>0 ){
    sb->b.nData--;
    dataBufferAppend2(&sb->b, zFrom, nFrom, "", 1);
  }
}
static void append(StringBuffer *sb, const char *zFrom){
  nappend(sb, zFrom, strlen(zFrom));
}

/* Append a list of strings separated by commas. */
static void appendList(StringBuffer *sb, int nString, char **azString){
  int i;
  for(i=0; i<nString; ++i){
    if( i>0 ) append(sb, ", ");
    append(sb, azString[i]);
  }
}

static int endsInWhiteSpace(StringBuffer *p){
  return stringBufferLength(p)>0 &&
    safe_isspace(stringBufferData(p)[stringBufferLength(p)-1]);
}

/* If the StringBuffer ends in something other than white space, add a
** single space character to the end.
*/
static void appendWhiteSpace(StringBuffer *p){
  if( stringBufferLength(p)==0 ) return;
  if( !endsInWhiteSpace(p) ) append(p, " ");
}

/* Remove white space from the end of the StringBuffer */
static void trimWhiteSpace(StringBuffer *p){
  while( endsInWhiteSpace(p) ){
    p->b.pData[--p->b.nData-1] = '\0';
  }
}

/*******************************************************************/
/* DLReader is used to read document elements from a doclist.  The
** current docid is cached, so dlrDocid() is fast.  DLReader does not
** own the doclist buffer.
**
** dlrAtEnd - true if there's no more data to read.
** dlrDocid - docid of current document.
** dlrDocData - doclist data for current document (including docid).
** dlrDocDataBytes - length of same.
** dlrAllDataBytes - length of all remaining data.
** dlrPosData - position data for current document.
** dlrPosDataLen - length of pos data for current document (incl POS_END).
** dlrStep - step to current document.
** dlrInit - initial for doclist of given type against given data.
** dlrDestroy - clean up.
**
** Expected usage is something like:
**
**   DLReader reader;
**   dlrInit(&reader, pData, nData);
**   while( !dlrAtEnd(&reader) ){
**     // calls to dlrDocid() and kin.
**     dlrStep(&reader);
**   }
**   dlrDestroy(&reader);
*/
typedef struct DLReader {
  DocListType iType;
  const char *pData;
  int nData;

  sqlite_int64 iDocid;
  int nElement;
} DLReader;

static int dlrAtEnd(DLReader *pReader){
  assert( pReader->nData>=0 );
  return pReader->nData==0;
}
static sqlite_int64 dlrDocid(DLReader *pReader){
  assert( !dlrAtEnd(pReader) );
  return pReader->iDocid;
}
static const char *dlrDocData(DLReader *pReader){
  assert( !dlrAtEnd(pReader) );
  return pReader->pData;
}
static int dlrDocDataBytes(DLReader *pReader){
  assert( !dlrAtEnd(pReader) );
  return pReader->nElement;
}
static int dlrAllDataBytes(DLReader *pReader){
  assert( !dlrAtEnd(pReader) );
  return pReader->nData;
}
/* TODO(shess) Consider adding a field to track iDocid varint length
** to make these two functions faster.  This might matter (a tiny bit)
** for queries.
*/
static const char *dlrPosData(DLReader *pReader){
  sqlite_int64 iDummy;
  int n = fts3GetVarint(pReader->pData, &iDummy);
  assert( !dlrAtEnd(pReader) );
  return pReader->pData+n;
}
static int dlrPosDataLen(DLReader *pReader){
  sqlite_int64 iDummy;
  int n = fts3GetVarint(pReader->pData, &iDummy);
  assert( !dlrAtEnd(pReader) );
  return pReader->nElement-n;
}
static void dlrStep(DLReader *pReader){
  assert( !dlrAtEnd(pReader) );

  /* Skip past current doclist element. */
  assert( pReader->nElement<=pReader->nData );
  pReader->pData += pReader->nElement;
  pReader->nData -= pReader->nElement;

  /* If there is more data, read the next doclist element. */
  if( pReader->nData!=0 ){
    sqlite_int64 iDocidDelta;
    int iDummy, n = fts3GetVarint(pReader->pData, &iDocidDelta);
    pReader->iDocid += iDocidDelta;
    if( pReader->iType>=DL_POSITIONS ){
      assert( n<pReader->nData );
      while( 1 ){
        n += fts3GetVarint32(pReader->pData+n, &iDummy);
        assert( n<=pReader->nData );
        if( iDummy==POS_END ) break;
        if( iDummy==POS_COLUMN ){
          n += fts3GetVarint32(pReader->pData+n, &iDummy);
          assert( n<pReader->nData );
        }else if( pReader->iType==DL_POSITIONS_OFFSETS ){
          n += fts3GetVarint32(pReader->pData+n, &iDummy);
          n += fts3GetVarint32(pReader->pData+n, &iDummy);
          assert( n<pReader->nData );
        }
      }
    }
    pReader->nElement = n;
    assert( pReader->nElement<=pReader->nData );
  }
}
static void dlrInit(DLReader *pReader, DocListType iType,
                    const char *pData, int nData){
  assert( pData!=NULL && nData!=0 );
  pReader->iType = iType;
  pReader->pData = pData;
  pReader->nData = nData;
  pReader->nElement = 0;
  pReader->iDocid = 0;

  /* Load the first element's data.  There must be a first element. */
  dlrStep(pReader);
}
static void dlrDestroy(DLReader *pReader){
  SCRAMBLE(pReader);
}

#ifndef NDEBUG
/* Verify that the doclist can be validly decoded.  Also returns the
** last docid found because it is convenient in other assertions for
** DLWriter.
*/
static void docListValidate(DocListType iType, const char *pData, int nData,
                            sqlite_int64 *pLastDocid){
  sqlite_int64 iPrevDocid = 0;
  assert( nData>0 );
  assert( pData!=0 );
  assert( pData+nData>pData );
  while( nData!=0 ){
    sqlite_int64 iDocidDelta;
    int n = fts3GetVarint(pData, &iDocidDelta);
    iPrevDocid += iDocidDelta;
    if( iType>DL_DOCIDS ){
      int iDummy;
      while( 1 ){
        n += fts3GetVarint32(pData+n, &iDummy);
        if( iDummy==POS_END ) break;
        if( iDummy==POS_COLUMN ){
          n += fts3GetVarint32(pData+n, &iDummy);
        }else if( iType>DL_POSITIONS ){
          n += fts3GetVarint32(pData+n, &iDummy);
          n += fts3GetVarint32(pData+n, &iDummy);
        }
        assert( n<=nData );
      }
    }
    assert( n<=nData );
    pData += n;
    nData -= n;
  }
  if( pLastDocid ) *pLastDocid = iPrevDocid;
}
#define ASSERT_VALID_DOCLIST(i, p, n, o) docListValidate(i, p, n, o)
#else
#define ASSERT_VALID_DOCLIST(i, p, n, o) assert( 1 )
#endif

/*******************************************************************/
/* DLWriter is used to write doclist data to a DataBuffer.  DLWriter
** always appends to the buffer and does not own it.
**
** dlwInit - initialize to write a given type doclistto a buffer.
** dlwDestroy - clear the writer's memory.  Does not free buffer.
** dlwAppend - append raw doclist data to buffer.
** dlwCopy - copy next doclist from reader to writer.
** dlwAdd - construct doclist element and append to buffer.
**    Only apply dlwAdd() to DL_DOCIDS doclists (else use PLWriter).
*/
typedef struct DLWriter {
  DocListType iType;
  DataBuffer *b;
  sqlite_int64 iPrevDocid;
#ifndef NDEBUG
  int has_iPrevDocid;
#endif
} DLWriter;

static void dlwInit(DLWriter *pWriter, DocListType iType, DataBuffer *b){
  pWriter->b = b;
  pWriter->iType = iType;
  pWriter->iPrevDocid = 0;
#ifndef NDEBUG
  pWriter->has_iPrevDocid = 0;
#endif
}
static void dlwDestroy(DLWriter *pWriter){
  SCRAMBLE(pWriter);
}
/* iFirstDocid is the first docid in the doclist in pData.  It is
** needed because pData may point within a larger doclist, in which
** case the first item would be delta-encoded.
**
** iLastDocid is the final docid in the doclist in pData.  It is
** needed to create the new iPrevDocid for future delta-encoding.  The
** code could decode the passed doclist to recreate iLastDocid, but
** the only current user (docListMerge) already has decoded this
** information.
*/
/* TODO(shess) This has become just a helper for docListMerge.
** Consider a refactor to make this cleaner.
*/
static void dlwAppend(DLWriter *pWriter,
                      const char *pData, int nData,
                      sqlite_int64 iFirstDocid, sqlite_int64 iLastDocid){
  sqlite_int64 iDocid = 0;
  char c[VARINT_MAX];
  int nFirstOld, nFirstNew;     /* Old and new varint len of first docid. */
#ifndef NDEBUG
  sqlite_int64 iLastDocidDelta;
#endif

  /* Recode the initial docid as delta from iPrevDocid. */
  nFirstOld = fts3GetVarint(pData, &iDocid);
  assert( nFirstOld<nData || (nFirstOld==nData && pWriter->iType==DL_DOCIDS) );
  nFirstNew = fts3PutVarint(c, iFirstDocid-pWriter->iPrevDocid);

  /* Verify that the incoming doclist is valid AND that it ends with
  ** the expected docid.  This is essential because we'll trust this
  ** docid in future delta-encoding.
  */
  ASSERT_VALID_DOCLIST(pWriter->iType, pData, nData, &iLastDocidDelta);
  assert( iLastDocid==iFirstDocid-iDocid+iLastDocidDelta );

  /* Append recoded initial docid and everything else.  Rest of docids
  ** should have been delta-encoded from previous initial docid.
  */
  if( nFirstOld<nData ){
    dataBufferAppend2(pWriter->b, c, nFirstNew,
                      pData+nFirstOld, nData-nFirstOld);
  }else{
    dataBufferAppend(pWriter->b, c, nFirstNew);
  }
  pWriter->iPrevDocid = iLastDocid;
}
static void dlwCopy(DLWriter *pWriter, DLReader *pReader){
  dlwAppend(pWriter, dlrDocData(pReader), dlrDocDataBytes(pReader),
            dlrDocid(pReader), dlrDocid(pReader));
}
static void dlwAdd(DLWriter *pWriter, sqlite_int64 iDocid){
  char c[VARINT_MAX];
  int n = fts3PutVarint(c, iDocid-pWriter->iPrevDocid);

  /* Docids must ascend. */
  assert( !pWriter->has_iPrevDocid || iDocid>pWriter->iPrevDocid );
  assert( pWriter->iType==DL_DOCIDS );

  dataBufferAppend(pWriter->b, c, n);
  pWriter->iPrevDocid = iDocid;
#ifndef NDEBUG
  pWriter->has_iPrevDocid = 1;
#endif
}

/*******************************************************************/
/* PLReader is used to read data from a document's position list.  As
** the caller steps through the list, data is cached so that varints
** only need to be decoded once.
**
** plrInit, plrDestroy - create/destroy a reader.
** plrColumn, plrPosition, plrStartOffset, plrEndOffset - accessors
** plrAtEnd - at end of stream, only call plrDestroy once true.
** plrStep - step to the next element.
*/
typedef struct PLReader {
  /* These refer to the next position's data.  nData will reach 0 when
  ** reading the last position, so plrStep() signals EOF by setting
  ** pData to NULL.
  */
  const char *pData;
  int nData;

  DocListType iType;
  int iColumn;         /* the last column read */
  int iPosition;       /* the last position read */
  int iStartOffset;    /* the last start offset read */
  int iEndOffset;      /* the last end offset read */
} PLReader;

static int plrAtEnd(PLReader *pReader){
  return pReader->pData==NULL;
}
static int plrColumn(PLReader *pReader){
  assert( !plrAtEnd(pReader) );
  return pReader->iColumn;
}
static int plrPosition(PLReader *pReader){
  assert( !plrAtEnd(pReader) );
  return pReader->iPosition;
}
static int plrStartOffset(PLReader *pReader){
  assert( !plrAtEnd(pReader) );
  return pReader->iStartOffset;
}
static int plrEndOffset(PLReader *pReader){
  assert( !plrAtEnd(pReader) );
  return pReader->iEndOffset;
}
static void plrStep(PLReader *pReader){
  int i, n;

  assert( !plrAtEnd(pReader) );

  if( pReader->nData==0 ){
    pReader->pData = NULL;
    return;
  }

  n = fts3GetVarint32(pReader->pData, &i);
  if( i==POS_COLUMN ){
    n += fts3GetVarint32(pReader->pData+n, &pReader->iColumn);
    pReader->iPosition = 0;
    pReader->iStartOffset = 0;
    n += fts3GetVarint32(pReader->pData+n, &i);
  }
  /* Should never see adjacent column changes. */
  assert( i!=POS_COLUMN );

  if( i==POS_END ){
    pReader->nData = 0;
    pReader->pData = NULL;
    return;
  }

  pReader->iPosition += i-POS_BASE;
  if( pReader->iType==DL_POSITIONS_OFFSETS ){
    n += fts3GetVarint32(pReader->pData+n, &i);
    pReader->iStartOffset += i;
    n += fts3GetVarint32(pReader->pData+n, &i);
    pReader->iEndOffset = pReader->iStartOffset+i;
  }
  assert( n<=pReader->nData );
  pReader->pData += n;
  pReader->nData -= n;
}

static void plrInit(PLReader *pReader, DLReader *pDLReader){
  pReader->pData = dlrPosData(pDLReader);
  pReader->nData = dlrPosDataLen(pDLReader);
  pReader->iType = pDLReader->iType;
  pReader->iColumn = 0;
  pReader->iPosition = 0;
  pReader->iStartOffset = 0;
  pReader->iEndOffset = 0;
  plrStep(pReader);
}
static void plrDestroy(PLReader *pReader){
  SCRAMBLE(pReader);
}

/*******************************************************************/
/* PLWriter is used in constructing a document's position list.  As a
** convenience, if iType is DL_DOCIDS, PLWriter becomes a no-op.
** PLWriter writes to the associated DLWriter's buffer.
**
** plwInit - init for writing a document's poslist.
** plwDestroy - clear a writer.
** plwAdd - append position and offset information.
** plwCopy - copy next position's data from reader to writer.
** plwTerminate - add any necessary doclist terminator.
**
** Calling plwAdd() after plwTerminate() may result in a corrupt
** doclist.
*/
/* TODO(shess) Until we've written the second item, we can cache the
** first item's information.  Then we'd have three states:
**
** - initialized with docid, no positions.
** - docid and one position.
** - docid and multiple positions.
**
** Only the last state needs to actually write to dlw->b, which would
** be an improvement in the DLCollector case.
*/
typedef struct PLWriter {
  DLWriter *dlw;

  int iColumn;    /* the last column written */
  int iPos;       /* the last position written */
  int iOffset;    /* the last start offset written */
} PLWriter;

/* TODO(shess) In the case where the parent is reading these values
** from a PLReader, we could optimize to a copy if that PLReader has
** the same type as pWriter.
*/
static void plwAdd(PLWriter *pWriter, int iColumn, int iPos,
                   int iStartOffset, int iEndOffset){
  /* Worst-case space for POS_COLUMN, iColumn, iPosDelta,
  ** iStartOffsetDelta, and iEndOffsetDelta.
  */
  char c[5*VARINT_MAX];
  int n = 0;

  /* Ban plwAdd() after plwTerminate(). */
  assert( pWriter->iPos!=-1 );

  if( pWriter->dlw->iType==DL_DOCIDS ) return;

  if( iColumn!=pWriter->iColumn ){
    n += fts3PutVarint(c+n, POS_COLUMN);
    n += fts3PutVarint(c+n, iColumn);
    pWriter->iColumn = iColumn;
    pWriter->iPos = 0;
    pWriter->iOffset = 0;
  }
  assert( iPos>=pWriter->iPos );
  n += fts3PutVarint(c+n, POS_BASE+(iPos-pWriter->iPos));
  pWriter->iPos = iPos;
  if( pWriter->dlw->iType==DL_POSITIONS_OFFSETS ){
    assert( iStartOffset>=pWriter->iOffset );
    n += fts3PutVarint(c+n, iStartOffset-pWriter->iOffset);
    pWriter->iOffset = iStartOffset;
    assert( iEndOffset>=iStartOffset );
    n += fts3PutVarint(c+n, iEndOffset-iStartOffset);
  }
  dataBufferAppend(pWriter->dlw->b, c, n);
}
static void plwCopy(PLWriter *pWriter, PLReader *pReader){
  plwAdd(pWriter, plrColumn(pReader), plrPosition(pReader),
         plrStartOffset(pReader), plrEndOffset(pReader));
}
static void plwInit(PLWriter *pWriter, DLWriter *dlw, sqlite_int64 iDocid){
  char c[VARINT_MAX];
  int n;

  pWriter->dlw = dlw;

  /* Docids must ascend. */
  assert( !pWriter->dlw->has_iPrevDocid || iDocid>pWriter->dlw->iPrevDocid );
  n = fts3PutVarint(c, iDocid-pWriter->dlw->iPrevDocid);
  dataBufferAppend(pWriter->dlw->b, c, n);
  pWriter->dlw->iPrevDocid = iDocid;
#ifndef NDEBUG
  pWriter->dlw->has_iPrevDocid = 1;
#endif

  pWriter->iColumn = 0;
  pWriter->iPos = 0;
  pWriter->iOffset = 0;
}
/* TODO(shess) Should plwDestroy() also terminate the doclist?  But
** then plwDestroy() would no longer be just a destructor, it would
** also be doing work, which isn't consistent with the overall idiom.
** Another option would be for plwAdd() to always append any necessary
** terminator, so that the output is always correct.  But that would
** add incremental work to the common case with the only benefit being
** API elegance.  Punt for now.
*/
static void plwTerminate(PLWriter *pWriter){
  if( pWriter->dlw->iType>DL_DOCIDS ){
    char c[VARINT_MAX];
    int n = fts3PutVarint(c, POS_END);
    dataBufferAppend(pWriter->dlw->b, c, n);
  }
#ifndef NDEBUG
  /* Mark as terminated for assert in plwAdd(). */
  pWriter->iPos = -1;
#endif
}
static void plwDestroy(PLWriter *pWriter){
  SCRAMBLE(pWriter);
}

/*******************************************************************/
/* DLCollector wraps PLWriter and DLWriter to provide a
** dynamically-allocated doclist area to use during tokenization.
**
** dlcNew - malloc up and initialize a collector.
** dlcDelete - destroy a collector and all contained items.
** dlcAddPos - append position and offset information.
** dlcAddDoclist - add the collected doclist to the given buffer.
** dlcNext - terminate the current document and open another.
*/
typedef struct DLCollector {
  DataBuffer b;
  DLWriter dlw;
  PLWriter plw;
} DLCollector;

/* TODO(shess) This could also be done by calling plwTerminate() and
** dataBufferAppend().  I tried that, expecting nominal performance
** differences, but it seemed to pretty reliably be worth 1% to code
** it this way.  I suspect it is the incremental malloc overhead (some
** percentage of the plwTerminate() calls will cause a realloc), so
** this might be worth revisiting if the DataBuffer implementation
** changes.
*/
static void dlcAddDoclist(DLCollector *pCollector, DataBuffer *b){
  if( pCollector->dlw.iType>DL_DOCIDS ){
    char c[VARINT_MAX];
    int n = fts3PutVarint(c, POS_END);
    dataBufferAppend2(b, pCollector->b.pData, pCollector->b.nData, c, n);
  }else{
    dataBufferAppend(b, pCollector->b.pData, pCollector->b.nData);
  }
}
static void dlcNext(DLCollector *pCollector, sqlite_int64 iDocid){
  plwTerminate(&pCollector->plw);
  plwDestroy(&pCollector->plw);
  plwInit(&pCollector->plw, &pCollector->dlw, iDocid);
}
static void dlcAddPos(DLCollector *pCollector, int iColumn, int iPos,
                      int iStartOffset, int iEndOffset){
  plwAdd(&pCollector->plw, iColumn, iPos, iStartOffset, iEndOffset);
}

static DLCollector *dlcNew(sqlite_int64 iDocid, DocListType iType){
  DLCollector *pCollector = sqlite3_malloc(sizeof(DLCollector));
  dataBufferInit(&pCollector->b, 0);
  dlwInit(&pCollector->dlw, iType, &pCollector->b);
  plwInit(&pCollector->plw, &pCollector->dlw, iDocid);
  return pCollector;
}
static void dlcDelete(DLCollector *pCollector){
  plwDestroy(&pCollector->plw);
  dlwDestroy(&pCollector->dlw);
  dataBufferDestroy(&pCollector->b);
  SCRAMBLE(pCollector);
  sqlite3_free(pCollector);
}


/* Copy the doclist data of iType in pData/nData into *out, trimming
** unnecessary data as we go.  Only columns matching iColumn are
** copied, all columns copied if iColumn is -1.  Elements with no
** matching columns are dropped.  The output is an iOutType doclist.
*/
/* NOTE(shess) This code is only valid after all doclists are merged.
** If this is run before merges, then doclist items which represent
** deletion will be trimmed, and will thus not effect a deletion
** during the merge.
*/
static void docListTrim(DocListType iType, const char *pData, int nData,
                        int iColumn, DocListType iOutType, DataBuffer *out){
  DLReader dlReader;
  DLWriter dlWriter;

  assert( iOutType<=iType );

  dlrInit(&dlReader, iType, pData, nData);
  dlwInit(&dlWriter, iOutType, out);

  while( !dlrAtEnd(&dlReader) ){
    PLReader plReader;
    PLWriter plWriter;
    int match = 0;

    plrInit(&plReader, &dlReader);

    while( !plrAtEnd(&plReader) ){
      if( iColumn==-1 || plrColumn(&plReader)==iColumn ){
        if( !match ){
          plwInit(&plWriter, &dlWriter, dlrDocid(&dlReader));
          match = 1;
        }
        plwAdd(&plWriter, plrColumn(&plReader), plrPosition(&plReader),
               plrStartOffset(&plReader), plrEndOffset(&plReader));
      }
      plrStep(&plReader);
    }
    if( match ){
      plwTerminate(&plWriter);
      plwDestroy(&plWriter);
    }

    plrDestroy(&plReader);
    dlrStep(&dlReader);
  }
  dlwDestroy(&dlWriter);
  dlrDestroy(&dlReader);
}

/* Used by docListMerge() to keep doclists in the ascending order by
** docid, then ascending order by age (so the newest comes first).
*/
typedef struct OrderedDLReader {
  DLReader *pReader;

  /* TODO(shess) If we assume that docListMerge pReaders is ordered by
  ** age (which we do), then we could use pReader comparisons to break
  ** ties.
  */
  int idx;
} OrderedDLReader;

/* Order eof to end, then by docid asc, idx desc. */
static int orderedDLReaderCmp(OrderedDLReader *r1, OrderedDLReader *r2){
  if( dlrAtEnd(r1->pReader) ){
    if( dlrAtEnd(r2->pReader) ) return 0;  /* Both atEnd(). */
    return 1;                              /* Only r1 atEnd(). */
  }
  if( dlrAtEnd(r2->pReader) ) return -1;   /* Only r2 atEnd(). */

  if( dlrDocid(r1->pReader)<dlrDocid(r2->pReader) ) return -1;
  if( dlrDocid(r1->pReader)>dlrDocid(r2->pReader) ) return 1;

  /* Descending on idx. */
  return r2->idx-r1->idx;
}

/* Bubble p[0] to appropriate place in p[1..n-1].  Assumes that
** p[1..n-1] is already sorted.
*/
/* TODO(shess) Is this frequent enough to warrant a binary search?
** Before implementing that, instrument the code to check.  In most
** current usage, I expect that p[0] will be less than p[1] a very
** high proportion of the time.
*/
static void orderedDLReaderReorder(OrderedDLReader *p, int n){
  while( n>1 && orderedDLReaderCmp(p, p+1)>0 ){
    OrderedDLReader tmp = p[0];
    p[0] = p[1];
    p[1] = tmp;
    n--;
    p++;
  }
}

/* Given an array of doclist readers, merge their doclist elements
** into out in sorted order (by docid), dropping elements from older
** readers when there is a duplicate docid.  pReaders is assumed to be
** ordered by age, oldest first.
*/
/* TODO(shess) nReaders must be <= MERGE_COUNT.  This should probably
** be fixed.
*/
static void docListMerge(DataBuffer *out,
                         DLReader *pReaders, int nReaders){
  OrderedDLReader readers[MERGE_COUNT];
  DLWriter writer;
  int i, n;
  const char *pStart = 0;
  int nStart = 0;
  sqlite_int64 iFirstDocid = 0, iLastDocid = 0;

  assert( nReaders>0 );
  if( nReaders==1 ){
    dataBufferAppend(out, dlrDocData(pReaders), dlrAllDataBytes(pReaders));
    return;
  }

  assert( nReaders<=MERGE_COUNT );
  n = 0;
  for(i=0; i<nReaders; i++){
    assert( pReaders[i].iType==pReaders[0].iType );
    readers[i].pReader = pReaders+i;
    readers[i].idx = i;
    n += dlrAllDataBytes(&pReaders[i]);
  }
  /* Conservatively size output to sum of inputs.  Output should end
  ** up strictly smaller than input.
  */
  dataBufferExpand(out, n);

  /* Get the readers into sorted order. */
  while( i-->0 ){
    orderedDLReaderReorder(readers+i, nReaders-i);
  }

  dlwInit(&writer, pReaders[0].iType, out);
  while( !dlrAtEnd(readers[0].pReader) ){
    sqlite_int64 iDocid = dlrDocid(readers[0].pReader);

    /* If this is a continuation of the current buffer to copy, extend
    ** that buffer.  memcpy() seems to be more efficient if it has a
    ** lots of data to copy.
    */
    if( dlrDocData(readers[0].pReader)==pStart+nStart ){
      nStart += dlrDocDataBytes(readers[0].pReader);
    }else{
      if( pStart!=0 ){
        dlwAppend(&writer, pStart, nStart, iFirstDocid, iLastDocid);
      }
      pStart = dlrDocData(readers[0].pReader);
      nStart = dlrDocDataBytes(readers[0].pReader);
      iFirstDocid = iDocid;
    }
    iLastDocid = iDocid;
    dlrStep(readers[0].pReader);

    /* Drop all of the older elements with the same docid. */
    for(i=1; i<nReaders &&
             !dlrAtEnd(readers[i].pReader) &&
             dlrDocid(readers[i].pReader)==iDocid; i++){
      dlrStep(readers[i].pReader);
    }

    /* Get the readers back into order. */
    while( i-->0 ){
      orderedDLReaderReorder(readers+i, nReaders-i);
    }
  }

  /* Copy over any remaining elements. */
  if( nStart>0 ) dlwAppend(&writer, pStart, nStart, iFirstDocid, iLastDocid);
  dlwDestroy(&writer);
}

/* Helper function for posListUnion().  Compares the current position
** between left and right, returning as standard C idiom of <0 if
** left<right, >0 if left>right, and 0 if left==right.  "End" always
** compares greater.
*/
static int posListCmp(PLReader *pLeft, PLReader *pRight){
  assert( pLeft->iType==pRight->iType );
  if( pLeft->iType==DL_DOCIDS ) return 0;

  if( plrAtEnd(pLeft) ) return plrAtEnd(pRight) ? 0 : 1;
  if( plrAtEnd(pRight) ) return -1;

  if( plrColumn(pLeft)<plrColumn(pRight) ) return -1;
  if( plrColumn(pLeft)>plrColumn(pRight) ) return 1;

  if( plrPosition(pLeft)<plrPosition(pRight) ) return -1;
  if( plrPosition(pLeft)>plrPosition(pRight) ) return 1;
  if( pLeft->iType==DL_POSITIONS ) return 0;

  if( plrStartOffset(pLeft)<plrStartOffset(pRight) ) return -1;
  if( plrStartOffset(pLeft)>plrStartOffset(pRight) ) return 1;

  if( plrEndOffset(pLeft)<plrEndOffset(pRight) ) return -1;
  if( plrEndOffset(pLeft)>plrEndOffset(pRight) ) return 1;

  return 0;
}

/* Write the union of position lists in pLeft and pRight to pOut.
** "Union" in this case meaning "All unique position tuples".  Should
** work with any doclist type, though both inputs and the output
** should be the same type.
*/
static void posListUnion(DLReader *pLeft, DLReader *pRight, DLWriter *pOut){
  PLReader left, right;
  PLWriter writer;

  assert( dlrDocid(pLeft)==dlrDocid(pRight) );
  assert( pLeft->iType==pRight->iType );
  assert( pLeft->iType==pOut->iType );

  plrInit(&left, pLeft);
  plrInit(&right, pRight);
  plwInit(&writer, pOut, dlrDocid(pLeft));

  while( !plrAtEnd(&left) || !plrAtEnd(&right) ){
    int c = posListCmp(&left, &right);
    if( c<0 ){
      plwCopy(&writer, &left);
      plrStep(&left);
    }else if( c>0 ){
      plwCopy(&writer, &right);
      plrStep(&right);
    }else{
      plwCopy(&writer, &left);
      plrStep(&left);
      plrStep(&right);
    }
  }

  plwTerminate(&writer);
  plwDestroy(&writer);
  plrDestroy(&left);
  plrDestroy(&right);
}

/* Write the union of doclists in pLeft and pRight to pOut.  For
** docids in common between the inputs, the union of the position
** lists is written.  Inputs and outputs are always type DL_DEFAULT.
*/
static void docListUnion(
  const char *pLeft, int nLeft,
  const char *pRight, int nRight,
  DataBuffer *pOut      /* Write the combined doclist here */
){
  DLReader left, right;
  DLWriter writer;

  if( nLeft==0 ){
    if( nRight!=0) dataBufferAppend(pOut, pRight, nRight);
    return;
  }
  if( nRight==0 ){
    dataBufferAppend(pOut, pLeft, nLeft);
    return;
  }

  dlrInit(&left, DL_DEFAULT, pLeft, nLeft);
  dlrInit(&right, DL_DEFAULT, pRight, nRight);
  dlwInit(&writer, DL_DEFAULT, pOut);

  while( !dlrAtEnd(&left) || !dlrAtEnd(&right) ){
    if( dlrAtEnd(&right) ){
      dlwCopy(&writer, &left);
      dlrStep(&left);
    }else if( dlrAtEnd(&left) ){
      dlwCopy(&writer, &right);
      dlrStep(&right);
    }else if( dlrDocid(&left)<dlrDocid(&right) ){
      dlwCopy(&writer, &left);
      dlrStep(&left);
    }else if( dlrDocid(&left)>dlrDocid(&right) ){
      dlwCopy(&writer, &right);
      dlrStep(&right);
    }else{
      posListUnion(&left, &right, &writer);
      dlrStep(&left);
      dlrStep(&right);
    }
  }

  dlrDestroy(&left);
  dlrDestroy(&right);
  dlwDestroy(&writer);
}

/* 
** This function is used as part of the implementation of phrase and
** NEAR matching.
**
** pLeft and pRight are DLReaders positioned to the same docid in
** lists of type DL_POSITION. This function writes an entry to the
** DLWriter pOut for each position in pRight that is less than
** (nNear+1) greater (but not equal to or smaller) than a position 
** in pLeft. For example, if nNear is 0, and the positions contained
** by pLeft and pRight are:
**
**    pLeft:  5 10 15 20
**    pRight: 6  9 17 21
**
** then the docid is added to pOut. If pOut is of type DL_POSITIONS,
** then a positionids "6" and "21" are also added to pOut.
**
** If boolean argument isSaveLeft is true, then positionids are copied
** from pLeft instead of pRight. In the example above, the positions "5"
** and "20" would be added instead of "6" and "21".
*/
static void posListPhraseMerge(
  DLReader *pLeft, 
  DLReader *pRight,
  int nNear,
  int isSaveLeft,
  DLWriter *pOut
){
  PLReader left, right;
  PLWriter writer;
  int match = 0;

  assert( dlrDocid(pLeft)==dlrDocid(pRight) );
  assert( pOut->iType!=DL_POSITIONS_OFFSETS );

  plrInit(&left, pLeft);
  plrInit(&right, pRight);

  while( !plrAtEnd(&left) && !plrAtEnd(&right) ){
    if( plrColumn(&left)<plrColumn(&right) ){
      plrStep(&left);
    }else if( plrColumn(&left)>plrColumn(&right) ){
      plrStep(&right);
    }else if( plrPosition(&left)>=plrPosition(&right) ){
      plrStep(&right);
    }else{
      if( (plrPosition(&right)-plrPosition(&left))<=(nNear+1) ){
        if( !match ){
          plwInit(&writer, pOut, dlrDocid(pLeft));
          match = 1;
        }
        if( !isSaveLeft ){
          plwAdd(&writer, plrColumn(&right), plrPosition(&right), 0, 0);
        }else{
          plwAdd(&writer, plrColumn(&left), plrPosition(&left), 0, 0);
        }
        plrStep(&right);
      }else{
        plrStep(&left);
      }
    }
  }

  if( match ){
    plwTerminate(&writer);
    plwDestroy(&writer);
  }

  plrDestroy(&left);
  plrDestroy(&right);
}

/*
** Compare the values pointed to by the PLReaders passed as arguments. 
** Return -1 if the value pointed to by pLeft is considered less than
** the value pointed to by pRight, +1 if it is considered greater
** than it, or 0 if it is equal. i.e.
**
**     (*pLeft - *pRight)
**
** A PLReader that is in the EOF condition is considered greater than
** any other. If neither argument is in EOF state, the return value of
** plrColumn() is used. If the plrColumn() values are equal, the
** comparison is on the basis of plrPosition().
*/
static int plrCompare(PLReader *pLeft, PLReader *pRight){
  assert(!plrAtEnd(pLeft) || !plrAtEnd(pRight));

  if( plrAtEnd(pRight) || plrAtEnd(pLeft) ){
    return (plrAtEnd(pRight) ? -1 : 1);
  }
  if( plrColumn(pLeft)!=plrColumn(pRight) ){
    return ((plrColumn(pLeft)<plrColumn(pRight)) ? -1 : 1);
  }
  if( plrPosition(pLeft)!=plrPosition(pRight) ){
    return ((plrPosition(pLeft)<plrPosition(pRight)) ? -1 : 1);
  }
  return 0;
}

/* We have two doclists with positions:  pLeft and pRight. Depending
** on the value of the nNear parameter, perform either a phrase
** intersection (if nNear==0) or a NEAR intersection (if nNear>0)
** and write the results into pOut.
**
** A phrase intersection means that two documents only match
** if pLeft.iPos+1==pRight.iPos.
**
** A NEAR intersection means that two documents only match if 
** (abs(pLeft.iPos-pRight.iPos)<nNear).
**
** If a NEAR intersection is requested, then the nPhrase argument should
** be passed the number of tokens in the two operands to the NEAR operator
** combined. For example:
**
**       Query syntax               nPhrase
**      ------------------------------------
**       "A B C" NEAR "D E"         5
**       A NEAR B                   2
**
** iType controls the type of data written to pOut.  If iType is
** DL_POSITIONS, the positions are those from pRight.
*/
static void docListPhraseMerge(
  const char *pLeft, int nLeft,
  const char *pRight, int nRight,
  int nNear,            /* 0 for a phrase merge, non-zero for a NEAR merge */
  int nPhrase,          /* Number of tokens in left+right operands to NEAR */
  DocListType iType,    /* Type of doclist to write to pOut */
  DataBuffer *pOut      /* Write the combined doclist here */
){
  DLReader left, right;
  DLWriter writer;

  if( nLeft==0 || nRight==0 ) return;

  assert( iType!=DL_POSITIONS_OFFSETS );

  dlrInit(&left, DL_POSITIONS, pLeft, nLeft);
  dlrInit(&right, DL_POSITIONS, pRight, nRight);
  dlwInit(&writer, iType, pOut);

  while( !dlrAtEnd(&left) && !dlrAtEnd(&right) ){
    if( dlrDocid(&left)<dlrDocid(&right) ){
      dlrStep(&left);
    }else if( dlrDocid(&right)<dlrDocid(&left) ){
      dlrStep(&right);
    }else{
      if( nNear==0 ){
        posListPhraseMerge(&left, &right, 0, 0, &writer);
      }else{
        /* This case occurs when two terms (simple terms or phrases) are
         * connected by a NEAR operator, span (nNear+1). i.e.
         *
         *     '"terrible company" NEAR widget'
         */
        DataBuffer one = {0, 0, 0};
        DataBuffer two = {0, 0, 0};

        DLWriter dlwriter2;
        DLReader dr1 = {0, 0, 0, 0, 0}; 
        DLReader dr2 = {0, 0, 0, 0, 0};

        dlwInit(&dlwriter2, iType, &one);
        posListPhraseMerge(&right, &left, nNear-3+nPhrase, 1, &dlwriter2);
        dlwInit(&dlwriter2, iType, &two);
        posListPhraseMerge(&left, &right, nNear-1, 0, &dlwriter2);

        if( one.nData) dlrInit(&dr1, iType, one.pData, one.nData);
        if( two.nData) dlrInit(&dr2, iType, two.pData, two.nData);

        if( !dlrAtEnd(&dr1) || !dlrAtEnd(&dr2) ){
          PLReader pr1 = {0};
          PLReader pr2 = {0};

          PLWriter plwriter;
          plwInit(&plwriter, &writer, dlrDocid(dlrAtEnd(&dr1)?&dr2:&dr1));

          if( one.nData ) plrInit(&pr1, &dr1);
          if( two.nData ) plrInit(&pr2, &dr2);
          while( !plrAtEnd(&pr1) || !plrAtEnd(&pr2) ){
            int iCompare = plrCompare(&pr1, &pr2);
            switch( iCompare ){
              case -1:
                plwCopy(&plwriter, &pr1);
                plrStep(&pr1);
                break;
              case 1:
                plwCopy(&plwriter, &pr2);
                plrStep(&pr2);
                break;
              case 0:
                plwCopy(&plwriter, &pr1);
                plrStep(&pr1);
                plrStep(&pr2);
                break;
            }
          }
          plwTerminate(&plwriter);
        }
        dataBufferDestroy(&one);
        dataBufferDestroy(&two);
      }
      dlrStep(&left);
      dlrStep(&right);
    }
  }

  dlrDestroy(&left);
  dlrDestroy(&right);
  dlwDestroy(&writer);
}

/* We have two DL_DOCIDS doclists:  pLeft and pRight.
** Write the intersection of these two doclists into pOut as a
** DL_DOCIDS doclist.
*/
static void docListAndMerge(
  const char *pLeft, int nLeft,
  const char *pRight, int nRight,
  DataBuffer *pOut      /* Write the combined doclist here */
){
  DLReader left, right;
  DLWriter writer;

  if( nLeft==0 || nRight==0 ) return;

  dlrInit(&left, DL_DOCIDS, pLeft, nLeft);
  dlrInit(&right, DL_DOCIDS, pRight, nRight);
  dlwInit(&writer, DL_DOCIDS, pOut);

  while( !dlrAtEnd(&left) && !dlrAtEnd(&right) ){
    if( dlrDocid(&left)<dlrDocid(&right) ){
      dlrStep(&left);
    }else if( dlrDocid(&right)<dlrDocid(&left) ){
      dlrStep(&right);
    }else{
      dlwAdd(&writer, dlrDocid(&left));
      dlrStep(&left);
      dlrStep(&right);
    }
  }

  dlrDestroy(&left);
  dlrDestroy(&right);
  dlwDestroy(&writer);
}

/* We have two DL_DOCIDS doclists:  pLeft and pRight.
** Write the union of these two doclists into pOut as a
** DL_DOCIDS doclist.
*/
static void docListOrMerge(
  const char *pLeft, int nLeft,
  const char *pRight, int nRight,
  DataBuffer *pOut      /* Write the combined doclist here */
){
  DLReader left, right;
  DLWriter writer;

  if( nLeft==0 ){
    if( nRight!=0 ) dataBufferAppend(pOut, pRight, nRight);
    return;
  }
  if( nRight==0 ){
    dataBufferAppend(pOut, pLeft, nLeft);
    return;
  }

  dlrInit(&left, DL_DOCIDS, pLeft, nLeft);
  dlrInit(&right, DL_DOCIDS, pRight, nRight);
  dlwInit(&writer, DL_DOCIDS, pOut);

  while( !dlrAtEnd(&left) || !dlrAtEnd(&right) ){
    if( dlrAtEnd(&right) ){
      dlwAdd(&writer, dlrDocid(&left));
      dlrStep(&left);
    }else if( dlrAtEnd(&left) ){
      dlwAdd(&writer, dlrDocid(&right));
      dlrStep(&right);
    }else if( dlrDocid(&left)<dlrDocid(&right) ){
      dlwAdd(&writer, dlrDocid(&left));
      dlrStep(&left);
    }else if( dlrDocid(&right)<dlrDocid(&left) ){
      dlwAdd(&writer, dlrDocid(&right));
      dlrStep(&right);
    }else{
      dlwAdd(&writer, dlrDocid(&left));
      dlrStep(&left);
      dlrStep(&right);
    }
  }

  dlrDestroy(&left);
  dlrDestroy(&right);
  dlwDestroy(&writer);
}

/* We have two DL_DOCIDS doclists:  pLeft and pRight.
** Write into pOut as DL_DOCIDS doclist containing all documents that
** occur in pLeft but not in pRight.
*/
static void docListExceptMerge(
  const char *pLeft, int nLeft,
  const char *pRight, int nRight,
  DataBuffer *pOut      /* Write the combined doclist here */
){
  DLReader left, right;
  DLWriter writer;

  if( nLeft==0 ) return;
  if( nRight==0 ){
    dataBufferAppend(pOut, pLeft, nLeft);
    return;
  }

  dlrInit(&left, DL_DOCIDS, pLeft, nLeft);
  dlrInit(&right, DL_DOCIDS, pRight, nRight);
  dlwInit(&writer, DL_DOCIDS, pOut);

  while( !dlrAtEnd(&left) ){
    while( !dlrAtEnd(&right) && dlrDocid(&right)<dlrDocid(&left) ){
      dlrStep(&right);
    }
    if( dlrAtEnd(&right) || dlrDocid(&left)<dlrDocid(&right) ){
      dlwAdd(&writer, dlrDocid(&left));
    }
    dlrStep(&left);
  }

  dlrDestroy(&left);
  dlrDestroy(&right);
  dlwDestroy(&writer);
}

static char *string_dup_n(const char *s, int n){
  char *str = sqlite3_malloc(n + 1);
  memcpy(str, s, n);
  str[n] = '\0';
  return str;
}

/* Duplicate a string; the caller must free() the returned string.
 * (We don't use strdup() since it is not part of the standard C library and
 * may not be available everywhere.) */
static char *string_dup(const char *s){
  return string_dup_n(s, strlen(s));
}

/* Format a string, replacing each occurrence of the % character with
 * zDb.zName.  This may be more convenient than sqlite_mprintf()
 * when one string is used repeatedly in a format string.
 * The caller must free() the returned string. */
static char *string_format(const char *zFormat,
                           const char *zDb, const char *zName){
  const char *p;
  size_t len = 0;
  size_t nDb = strlen(zDb);
  size_t nName = strlen(zName);
  size_t nFullTableName = nDb+1+nName;
  char *result;
  char *r;

  /* first compute length needed */
  for(p = zFormat ; *p ; ++p){
    len += (*p=='%' ? nFullTableName : 1);
  }
  len += 1;  /* for null terminator */

  r = result = sqlite3_malloc(len);
  for(p = zFormat; *p; ++p){
    if( *p=='%' ){
      memcpy(r, zDb, nDb);
      r += nDb;
      *r++ = '.';
      memcpy(r, zName, nName);
      r += nName;
    } else {
      *r++ = *p;
    }
  }
  *r++ = '\0';
  assert( r == result + len );
  return result;
}

static int sql_exec(sqlite3 *db, const char *zDb, const char *zName,
                    const char *zFormat){
  char *zCommand = string_format(zFormat, zDb, zName);
  int rc;
  FTSTRACE(("FTS3 sql: %s\n", zCommand));
  rc = sqlite3_exec(db, zCommand, NULL, 0, NULL);
  sqlite3_free(zCommand);
  return rc;
}

static int sql_prepare(sqlite3 *db, const char *zDb, const char *zName,
                       sqlite3_stmt **ppStmt, const char *zFormat){
  char *zCommand = string_format(zFormat, zDb, zName);
  int rc;
  FTSTRACE(("FTS3 prepare: %s\n", zCommand));
  rc = sqlite3_prepare_v2(db, zCommand, -1, ppStmt, NULL);
  sqlite3_free(zCommand);
  return rc;
}

/* end utility functions */

/* Forward reference */
typedef struct fulltext_vtab fulltext_vtab;

/* A single term in a query is represented by an instances of
** the following structure. Each word which may match against
** document content is a term. Operators, like NEAR or OR, are
** not terms. Query terms are organized as a flat list stored
** in the Query.pTerms array.
**
** If the QueryTerm.nPhrase variable is non-zero, then the QueryTerm
** is the first in a contiguous string of terms that are either part
** of the same phrase, or connected by the NEAR operator.
**
** If the QueryTerm.nNear variable is non-zero, then the token is followed 
** by a NEAR operator with span set to (nNear-1). For example, the 
** following query:
**
** The QueryTerm.iPhrase variable stores the index of the token within
** its phrase, indexed starting at 1, or 1 if the token is not part 
** of any phrase.
**
** For example, the data structure used to represent the following query:
**
**     ... MATCH 'sqlite NEAR/5 google NEAR/2 "search engine"'
**
** is:
**
**     {nPhrase=4, iPhrase=1, nNear=6, pTerm="sqlite"},
**     {nPhrase=0, iPhrase=1, nNear=3, pTerm="google"},
**     {nPhrase=0, iPhrase=1, nNear=0, pTerm="search"},
**     {nPhrase=0, iPhrase=2, nNear=0, pTerm="engine"},
**
** compiling the FTS3 syntax to Query structures is done by the parseQuery()
** function.
*/
typedef struct QueryTerm {
  short int nPhrase; /* How many following terms are part of the same phrase */
  short int iPhrase; /* This is the i-th term of a phrase. */
  short int iColumn; /* Column of the index that must match this term */
  signed char nNear; /* term followed by a NEAR operator with span=(nNear-1) */
  signed char isOr;  /* this term is preceded by "OR" */
  signed char isNot; /* this term is preceded by "-" */
  signed char isPrefix; /* this term is followed by "*" */
  char *pTerm;       /* text of the term.  '\000' terminated.  malloced */
  int nTerm;         /* Number of bytes in pTerm[] */
} QueryTerm;


/* A query string is parsed into a Query structure.
 *
 * We could, in theory, allow query strings to be complicated
 * nested expressions with precedence determined by parentheses.
 * But none of the major search engines do this.  (Perhaps the
 * feeling is that an parenthesized expression is two complex of
 * an idea for the average user to grasp.)  Taking our lead from
 * the major search engines, we will allow queries to be a list
 * of terms (with an implied AND operator) or phrases in double-quotes,
 * with a single optional "-" before each non-phrase term to designate
 * negation and an optional OR connector.
 *
 * OR binds more tightly than the implied AND, which is what the
 * major search engines seem to do.  So, for example:
 * 
 *    [one two OR three]     ==>    one AND (two OR three)
 *    [one OR two three]     ==>    (one OR two) AND three
 *
 * A "-" before a term matches all entries that lack that term.
 * The "-" must occur immediately before the term with in intervening
 * space.  This is how the search engines do it.
 *
 * A NOT term cannot be the right-hand operand of an OR.  If this
 * occurs in the query string, the NOT is ignored:
 *
 *    [one OR -two]          ==>    one OR two
 *
 */
typedef struct Query {
  fulltext_vtab *pFts;  /* The full text index */
  int nTerms;           /* Number of terms in the query */
  QueryTerm *pTerms;    /* Array of terms.  Space obtained from malloc() */
  int nextIsOr;         /* Set the isOr flag on the next inserted term */
  int nextIsNear;       /* Set the isOr flag on the next inserted term */
  int nextColumn;       /* Next word parsed must be in this column */
  int dfltColumn;       /* The default column */
} Query;


/*
** An instance of the following structure keeps track of generated
** matching-word offset information and snippets.
*/
typedef struct Snippet {
  int nMatch;     /* Total number of matches */
  int nAlloc;     /* Space allocated for aMatch[] */
  struct snippetMatch { /* One entry for each matching term */
    char snStatus;       /* Status flag for use while constructing snippets */
    short int iCol;      /* The column that contains the match */
    short int iTerm;     /* The index in Query.pTerms[] of the matching term */
    int iToken;          /* The index of the matching document token */
    short int nByte;     /* Number of bytes in the term */
    int iStart;          /* The offset to the first character of the term */
  } *aMatch;      /* Points to space obtained from malloc */
  char *zOffset;  /* Text rendering of aMatch[] */
  int nOffset;    /* strlen(zOffset) */
  char *zSnippet; /* Snippet text */
  int nSnippet;   /* strlen(zSnippet) */
} Snippet;


typedef enum QueryType {
  QUERY_GENERIC,   /* table scan */
  QUERY_DOCID,     /* lookup by docid */
  QUERY_FULLTEXT   /* QUERY_FULLTEXT + [i] is a full-text search for column i*/
} QueryType;

typedef enum fulltext_statement {
  CONTENT_INSERT_STMT,
  CONTENT_SELECT_STMT,
  CONTENT_UPDATE_STMT,
  CONTENT_DELETE_STMT,
  CONTENT_EXISTS_STMT,

  BLOCK_INSERT_STMT,
  BLOCK_SELECT_STMT,
  BLOCK_DELETE_STMT,
  BLOCK_DELETE_ALL_STMT,

  SEGDIR_MAX_INDEX_STMT,
  SEGDIR_SET_STMT,
  SEGDIR_SELECT_LEVEL_STMT,
  SEGDIR_SPAN_STMT,
  SEGDIR_DELETE_STMT,
  SEGDIR_SELECT_SEGMENT_STMT,
  SEGDIR_SELECT_ALL_STMT,
  SEGDIR_DELETE_ALL_STMT,
  SEGDIR_COUNT_STMT,

  MAX_STMT                     /* Always at end! */
} fulltext_statement;

/* These must exactly match the enum above. */
/* TODO(shess): Is there some risk that a statement will be used in two
** cursors at once, e.g.  if a query joins a virtual table to itself?
** If so perhaps we should move some of these to the cursor object.
*/
static const char *const fulltext_zStatement[MAX_STMT] = {
  /* CONTENT_INSERT */ NULL,  /* generated in contentInsertStatement() */
  /* CONTENT_SELECT */ NULL,  /* generated in contentSelectStatement() */
  /* CONTENT_UPDATE */ NULL,  /* generated in contentUpdateStatement() */
  /* CONTENT_DELETE */ "delete from %_content where docid = ?",
  /* CONTENT_EXISTS */ "select docid from %_content limit 1",

  /* BLOCK_INSERT */
  "insert into %_segments (blockid, block) values (null, ?)",
  /* BLOCK_SELECT */ "select block from %_segments where blockid = ?",
  /* BLOCK_DELETE */ "delete from %_segments where blockid between ? and ?",
  /* BLOCK_DELETE_ALL */ "delete from %_segments",

  /* SEGDIR_MAX_INDEX */ "select max(idx) from %_segdir where level = ?",
  /* SEGDIR_SET */ "insert into %_segdir values (?, ?, ?, ?, ?, ?)",
  /* SEGDIR_SELECT_LEVEL */
  "select start_block, leaves_end_block, root from %_segdir "
  " where level = ? order by idx",
  /* SEGDIR_SPAN */
  "select min(start_block), max(end_block) from %_segdir "
  " where level = ? and start_block <> 0",
  /* SEGDIR_DELETE */ "delete from %_segdir where level = ?",

  /* NOTE(shess): The first three results of the following two
  ** statements must match.
  */
  /* SEGDIR_SELECT_SEGMENT */
  "select start_block, leaves_end_block, root from %_segdir "
  " where level = ? and idx = ?",
  /* SEGDIR_SELECT_ALL */
  "select start_block, leaves_end_block, root from %_segdir "
  " order by level desc, idx asc",
  /* SEGDIR_DELETE_ALL */ "delete from %_segdir",
  /* SEGDIR_COUNT */ "select count(*), ifnull(max(level),0) from %_segdir",
};

/*
** A connection to a fulltext index is an instance of the following
** structure.  The xCreate and xConnect methods create an instance
** of this structure and xDestroy and xDisconnect free that instance.
** All other methods receive a pointer to the structure as one of their
** arguments.
*/
struct fulltext_vtab {
  sqlite3_vtab base;               /* Base class used by SQLite core */
  sqlite3 *db;                     /* The database connection */
  const char *zDb;                 /* logical database name */
  const char *zName;               /* virtual table name */
  int nColumn;                     /* number of columns in virtual table */
  char **azColumn;                 /* column names.  malloced */
  char **azContentColumn;          /* column names in content table; malloced */
  sqlite3_tokenizer *pTokenizer;   /* tokenizer for inserts and queries */

  /* Precompiled statements which we keep as long as the table is
  ** open.
  */
  sqlite3_stmt *pFulltextStatements[MAX_STMT];

  /* Precompiled statements used for segment merges.  We run a
  ** separate select across the leaf level of each tree being merged.
  */
  sqlite3_stmt *pLeafSelectStmts[MERGE_COUNT];
  /* The statement used to prepare pLeafSelectStmts. */
#define LEAF_SELECT \
  "select block from %_segments where blockid between ? and ? order by blockid"

  /* These buffer pending index updates during transactions.
  ** nPendingData estimates the memory size of the pending data.  It
  ** doesn't include the hash-bucket overhead, nor any malloc
  ** overhead.  When nPendingData exceeds kPendingThreshold, the
  ** buffer is flushed even before the transaction closes.
  ** pendingTerms stores the data, and is only valid when nPendingData
  ** is >=0 (nPendingData<0 means pendingTerms has not been
  ** initialized).  iPrevDocid is the last docid written, used to make
  ** certain we're inserting in sorted order.
  */
  int nPendingData;
#define kPendingThreshold (1*1024*1024)
  sqlite_int64 iPrevDocid;
  fts3Hash pendingTerms;
};

/*
** When the core wants to do a query, it create a cursor using a
** call to xOpen.  This structure is an instance of a cursor.  It
** is destroyed by xClose.
*/
typedef struct fulltext_cursor {
  sqlite3_vtab_cursor base;        /* Base class used by SQLite core */
  QueryType iCursorType;           /* Copy of sqlite3_index_info.idxNum */
  sqlite3_stmt *pStmt;             /* Prepared statement in use by the cursor */
  int eof;                         /* True if at End Of Results */
  Query q;                         /* Parsed query string */
  Snippet snippet;                 /* Cached snippet for the current row */
  int iColumn;                     /* Column being searched */
  DataBuffer result;               /* Doclist results from fulltextQuery */
  DLReader reader;                 /* Result reader if result not empty */
} fulltext_cursor;

static struct fulltext_vtab *cursor_vtab(fulltext_cursor *c){
  return (fulltext_vtab *) c->base.pVtab;
}

static const sqlite3_module fts3Module;   /* forward declaration */

/* Return a dynamically generated statement of the form
 *   insert into %_content (docid, ...) values (?, ...)
 */
static const char *contentInsertStatement(fulltext_vtab *v){
  StringBuffer sb;
  int i;

  initStringBuffer(&sb);
  append(&sb, "insert into %_content (docid, ");
  appendList(&sb, v->nColumn, v->azContentColumn);
  append(&sb, ") values (?");
  for(i=0; i<v->nColumn; ++i)
    append(&sb, ", ?");
  append(&sb, ")");
  return stringBufferData(&sb);
}

/* Return a dynamically generated statement of the form
 *   select <content columns> from %_content where docid = ?
 */
static const char *contentSelectStatement(fulltext_vtab *v){
  StringBuffer sb;
  initStringBuffer(&sb);
  append(&sb, "SELECT ");
  appendList(&sb, v->nColumn, v->azContentColumn);
  append(&sb, " FROM %_content WHERE docid = ?");
  return stringBufferData(&sb);
}

/* Return a dynamically generated statement of the form
 *   update %_content set [col_0] = ?, [col_1] = ?, ...
 *                    where docid = ?
 */
static const char *contentUpdateStatement(fulltext_vtab *v){
  StringBuffer sb;
  int i;

  initStringBuffer(&sb);
  append(&sb, "update %_content set ");
  for(i=0; i<v->nColumn; ++i) {
    if( i>0 ){
      append(&sb, ", ");
    }
    append(&sb, v->azContentColumn[i]);
    append(&sb, " = ?");
  }
  append(&sb, " where docid = ?");
  return stringBufferData(&sb);
}

/* Puts a freshly-prepared statement determined by iStmt in *ppStmt.
** If the indicated statement has never been prepared, it is prepared
** and cached, otherwise the cached version is reset.
*/
static int sql_get_statement(fulltext_vtab *v, fulltext_statement iStmt,
                             sqlite3_stmt **ppStmt){
  assert( iStmt<MAX_STMT );
  if( v->pFulltextStatements[iStmt]==NULL ){
    const char *zStmt;
    int rc;
    switch( iStmt ){
      case CONTENT_INSERT_STMT:
        zStmt = contentInsertStatement(v); break;
      case CONTENT_SELECT_STMT:
        zStmt = contentSelectStatement(v); break;
      case CONTENT_UPDATE_STMT:
        zStmt = contentUpdateStatement(v); break;
      default:
        zStmt = fulltext_zStatement[iStmt];
    }
    rc = sql_prepare(v->db, v->zDb, v->zName, &v->pFulltextStatements[iStmt],
                         zStmt);
    if( zStmt != fulltext_zStatement[iStmt]) sqlite3_free((void *) zStmt);
    if( rc!=SQLITE_OK ) return rc;
  } else {
    int rc = sqlite3_reset(v->pFulltextStatements[iStmt]);
    if( rc!=SQLITE_OK ) return rc;
  }

  *ppStmt = v->pFulltextStatements[iStmt];
  return SQLITE_OK;
}

/* Like sqlite3_step(), but convert SQLITE_DONE to SQLITE_OK and
** SQLITE_ROW to SQLITE_ERROR.  Useful for statements like UPDATE,
** where we expect no results.
*/
static int sql_single_step(sqlite3_stmt *s){
  int rc = sqlite3_step(s);
  return (rc==SQLITE_DONE) ? SQLITE_OK : rc;
}

/* Like sql_get_statement(), but for special replicated LEAF_SELECT
** statements.  idx -1 is a special case for an uncached version of
** the statement (used in the optimize implementation).
*/
/* TODO(shess) Write version for generic statements and then share
** that between the cached-statement functions.
*/
static int sql_get_leaf_statement(fulltext_vtab *v, int idx,
                                  sqlite3_stmt **ppStmt){
  assert( idx>=-1 && idx<MERGE_COUNT );
  if( idx==-1 ){
    return sql_prepare(v->db, v->zDb, v->zName, ppStmt, LEAF_SELECT);
  }else if( v->pLeafSelectStmts[idx]==NULL ){
    int rc = sql_prepare(v->db, v->zDb, v->zName, &v->pLeafSelectStmts[idx],
                         LEAF_SELECT);
    if( rc!=SQLITE_OK ) return rc;
  }else{
    int rc = sqlite3_reset(v->pLeafSelectStmts[idx]);
    if( rc!=SQLITE_OK ) return rc;
  }

  *ppStmt = v->pLeafSelectStmts[idx];
  return SQLITE_OK;
}

/* insert into %_content (docid, ...) values ([docid], [pValues])
** If the docid contains SQL NULL, then a unique docid will be
** generated.
*/
static int content_insert(fulltext_vtab *v, sqlite3_value *docid,
                          sqlite3_value **pValues){
  sqlite3_stmt *s;
  int i;
  int rc = sql_get_statement(v, CONTENT_INSERT_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_value(s, 1, docid);
  if( rc!=SQLITE_OK ) return rc;

  for(i=0; i<v->nColumn; ++i){
    rc = sqlite3_bind_value(s, 2+i, pValues[i]);
    if( rc!=SQLITE_OK ) return rc;
  }

  return sql_single_step(s);
}

/* update %_content set col0 = pValues[0], col1 = pValues[1], ...
 *                  where docid = [iDocid] */
static int content_update(fulltext_vtab *v, sqlite3_value **pValues,
                          sqlite_int64 iDocid){
  sqlite3_stmt *s;
  int i;
  int rc = sql_get_statement(v, CONTENT_UPDATE_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  for(i=0; i<v->nColumn; ++i){
    rc = sqlite3_bind_value(s, 1+i, pValues[i]);
    if( rc!=SQLITE_OK ) return rc;
  }

  rc = sqlite3_bind_int64(s, 1+v->nColumn, iDocid);
  if( rc!=SQLITE_OK ) return rc;

  return sql_single_step(s);
}

static void freeStringArray(int nString, const char **pString){
  int i;

  for (i=0 ; i < nString ; ++i) {
    if( pString[i]!=NULL ) sqlite3_free((void *) pString[i]);
  }
  sqlite3_free((void *) pString);
}

/* select * from %_content where docid = [iDocid]
 * The caller must delete the returned array and all strings in it.
 * null fields will be NULL in the returned array.
 *
 * TODO: Perhaps we should return pointer/length strings here for consistency
 * with other code which uses pointer/length. */
static int content_select(fulltext_vtab *v, sqlite_int64 iDocid,
                          const char ***pValues){
  sqlite3_stmt *s;
  const char **values;
  int i;
  int rc;

  *pValues = NULL;

  rc = sql_get_statement(v, CONTENT_SELECT_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 1, iDocid);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_step(s);
  if( rc!=SQLITE_ROW ) return rc;

  values = (const char **) sqlite3_malloc(v->nColumn * sizeof(const char *));
  for(i=0; i<v->nColumn; ++i){
    if( sqlite3_column_type(s, i)==SQLITE_NULL ){
      values[i] = NULL;
    }else{
      values[i] = string_dup((char*)sqlite3_column_text(s, i));
    }
  }

  /* We expect only one row.  We must execute another sqlite3_step()
   * to complete the iteration; otherwise the table will remain locked. */
  rc = sqlite3_step(s);
  if( rc==SQLITE_DONE ){
    *pValues = values;
    return SQLITE_OK;
  }

  freeStringArray(v->nColumn, values);
  return rc;
}

/* delete from %_content where docid = [iDocid ] */
static int content_delete(fulltext_vtab *v, sqlite_int64 iDocid){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, CONTENT_DELETE_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 1, iDocid);
  if( rc!=SQLITE_OK ) return rc;

  return sql_single_step(s);
}

/* Returns SQLITE_ROW if any rows exist in %_content, SQLITE_DONE if
** no rows exist, and any error in case of failure.
*/
static int content_exists(fulltext_vtab *v){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, CONTENT_EXISTS_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_step(s);
  if( rc!=SQLITE_ROW ) return rc;

  /* We expect only one row.  We must execute another sqlite3_step()
   * to complete the iteration; otherwise the table will remain locked. */
  rc = sqlite3_step(s);
  if( rc==SQLITE_DONE ) return SQLITE_ROW;
  if( rc==SQLITE_ROW ) return SQLITE_ERROR;
  return rc;
}

/* insert into %_segments values ([pData])
**   returns assigned blockid in *piBlockid
*/
static int block_insert(fulltext_vtab *v, const char *pData, int nData,
                        sqlite_int64 *piBlockid){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, BLOCK_INSERT_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_blob(s, 1, pData, nData, SQLITE_STATIC);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_step(s);
  if( rc==SQLITE_ROW ) return SQLITE_ERROR;
  if( rc!=SQLITE_DONE ) return rc;

  /* blockid column is an alias for rowid. */
  *piBlockid = sqlite3_last_insert_rowid(v->db);
  return SQLITE_OK;
}

/* delete from %_segments
**   where blockid between [iStartBlockid] and [iEndBlockid]
**
** Deletes the range of blocks, inclusive, used to delete the blocks
** which form a segment.
*/
static int block_delete(fulltext_vtab *v,
                        sqlite_int64 iStartBlockid, sqlite_int64 iEndBlockid){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, BLOCK_DELETE_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 1, iStartBlockid);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 2, iEndBlockid);
  if( rc!=SQLITE_OK ) return rc;

  return sql_single_step(s);
}

/* Returns SQLITE_ROW with *pidx set to the maximum segment idx found
** at iLevel.  Returns SQLITE_DONE if there are no segments at
** iLevel.  Otherwise returns an error.
*/
static int segdir_max_index(fulltext_vtab *v, int iLevel, int *pidx){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, SEGDIR_MAX_INDEX_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int(s, 1, iLevel);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_step(s);
  /* Should always get at least one row due to how max() works. */
  if( rc==SQLITE_DONE ) return SQLITE_DONE;
  if( rc!=SQLITE_ROW ) return rc;

  /* NULL means that there were no inputs to max(). */
  if( SQLITE_NULL==sqlite3_column_type(s, 0) ){
    rc = sqlite3_step(s);
    if( rc==SQLITE_ROW ) return SQLITE_ERROR;
    return rc;
  }

  *pidx = sqlite3_column_int(s, 0);

  /* We expect only one row.  We must execute another sqlite3_step()
   * to complete the iteration; otherwise the table will remain locked. */
  rc = sqlite3_step(s);
  if( rc==SQLITE_ROW ) return SQLITE_ERROR;
  if( rc!=SQLITE_DONE ) return rc;
  return SQLITE_ROW;
}

/* insert into %_segdir values (
**   [iLevel], [idx],
**   [iStartBlockid], [iLeavesEndBlockid], [iEndBlockid],
**   [pRootData]
** )
*/
static int segdir_set(fulltext_vtab *v, int iLevel, int idx,
                      sqlite_int64 iStartBlockid,
                      sqlite_int64 iLeavesEndBlockid,
                      sqlite_int64 iEndBlockid,
                      const char *pRootData, int nRootData){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, SEGDIR_SET_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int(s, 1, iLevel);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int(s, 2, idx);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 3, iStartBlockid);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 4, iLeavesEndBlockid);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 5, iEndBlockid);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_blob(s, 6, pRootData, nRootData, SQLITE_STATIC);
  if( rc!=SQLITE_OK ) return rc;

  return sql_single_step(s);
}

/* Queries %_segdir for the block span of the segments in level
** iLevel.  Returns SQLITE_DONE if there are no blocks for iLevel,
** SQLITE_ROW if there are blocks, else an error.
*/
static int segdir_span(fulltext_vtab *v, int iLevel,
                       sqlite_int64 *piStartBlockid,
                       sqlite_int64 *piEndBlockid){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, SEGDIR_SPAN_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int(s, 1, iLevel);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_step(s);
  if( rc==SQLITE_DONE ) return SQLITE_DONE;  /* Should never happen */
  if( rc!=SQLITE_ROW ) return rc;

  /* This happens if all segments at this level are entirely inline. */
  if( SQLITE_NULL==sqlite3_column_type(s, 0) ){
    /* We expect only one row.  We must execute another sqlite3_step()
     * to complete the iteration; otherwise the table will remain locked. */
    int rc2 = sqlite3_step(s);
    if( rc2==SQLITE_ROW ) return SQLITE_ERROR;
    return rc2;
  }

  *piStartBlockid = sqlite3_column_int64(s, 0);
  *piEndBlockid = sqlite3_column_int64(s, 1);

  /* We expect only one row.  We must execute another sqlite3_step()
   * to complete the iteration; otherwise the table will remain locked. */
  rc = sqlite3_step(s);
  if( rc==SQLITE_ROW ) return SQLITE_ERROR;
  if( rc!=SQLITE_DONE ) return rc;
  return SQLITE_ROW;
}

/* Delete the segment blocks and segment directory records for all
** segments at iLevel.
*/
static int segdir_delete(fulltext_vtab *v, int iLevel){
  sqlite3_stmt *s;
  sqlite_int64 iStartBlockid, iEndBlockid;
  int rc = segdir_span(v, iLevel, &iStartBlockid, &iEndBlockid);
  if( rc!=SQLITE_ROW && rc!=SQLITE_DONE ) return rc;

  if( rc==SQLITE_ROW ){
    rc = block_delete(v, iStartBlockid, iEndBlockid);
    if( rc!=SQLITE_OK ) return rc;
  }

  /* Delete the segment directory itself. */
  rc = sql_get_statement(v, SEGDIR_DELETE_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 1, iLevel);
  if( rc!=SQLITE_OK ) return rc;

  return sql_single_step(s);
}

/* Delete entire fts index, SQLITE_OK on success, relevant error on
** failure.
*/
static int segdir_delete_all(fulltext_vtab *v){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, SEGDIR_DELETE_ALL_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sql_single_step(s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sql_get_statement(v, BLOCK_DELETE_ALL_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  return sql_single_step(s);
}

/* Returns SQLITE_OK with *pnSegments set to the number of entries in
** %_segdir and *piMaxLevel set to the highest level which has a
** segment.  Otherwise returns the SQLite error which caused failure.
*/
static int segdir_count(fulltext_vtab *v, int *pnSegments, int *piMaxLevel){
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, SEGDIR_COUNT_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_step(s);
  /* TODO(shess): This case should not be possible?  Should stronger
  ** measures be taken if it happens?
  */
  if( rc==SQLITE_DONE ){
    *pnSegments = 0;
    *piMaxLevel = 0;
    return SQLITE_OK;
  }
  if( rc!=SQLITE_ROW ) return rc;

  *pnSegments = sqlite3_column_int(s, 0);
  *piMaxLevel = sqlite3_column_int(s, 1);

  /* We expect only one row.  We must execute another sqlite3_step()
   * to complete the iteration; otherwise the table will remain locked. */
  rc = sqlite3_step(s);
  if( rc==SQLITE_DONE ) return SQLITE_OK;
  if( rc==SQLITE_ROW ) return SQLITE_ERROR;
  return rc;
}

/* TODO(shess) clearPendingTerms() is far down the file because
** writeZeroSegment() is far down the file because LeafWriter is far
** down the file.  Consider refactoring the code to move the non-vtab
** code above the vtab code so that we don't need this forward
** reference.
*/
static int clearPendingTerms(fulltext_vtab *v);

/*
** Free the memory used to contain a fulltext_vtab structure.
*/
static void fulltext_vtab_destroy(fulltext_vtab *v){
  int iStmt, i;

  FTSTRACE(("FTS3 Destroy %p\n", v));
  for( iStmt=0; iStmt<MAX_STMT; iStmt++ ){
    if( v->pFulltextStatements[iStmt]!=NULL ){
      sqlite3_finalize(v->pFulltextStatements[iStmt]);
      v->pFulltextStatements[iStmt] = NULL;
    }
  }

  for( i=0; i<MERGE_COUNT; i++ ){
    if( v->pLeafSelectStmts[i]!=NULL ){
      sqlite3_finalize(v->pLeafSelectStmts[i]);
      v->pLeafSelectStmts[i] = NULL;
    }
  }

  if( v->pTokenizer!=NULL ){
    v->pTokenizer->pModule->xDestroy(v->pTokenizer);
    v->pTokenizer = NULL;
  }

  clearPendingTerms(v);

  sqlite3_free(v->azColumn);
  for(i = 0; i < v->nColumn; ++i) {
    sqlite3_free(v->azContentColumn[i]);
  }
  sqlite3_free(v->azContentColumn);
  sqlite3_free(v);
}

/*
** Token types for parsing the arguments to xConnect or xCreate.
*/
#define TOKEN_EOF         0    /* End of file */
#define TOKEN_SPACE       1    /* Any kind of whitespace */
#define TOKEN_ID          2    /* An identifier */
#define TOKEN_STRING      3    /* A string literal */
#define TOKEN_PUNCT       4    /* A single punctuation character */

/*
** If X is a character that can be used in an identifier then
** ftsIdChar(X) will be true.  Otherwise it is false.
**
** For ASCII, any character with the high-order bit set is
** allowed in an identifier.  For 7-bit characters, 
** isFtsIdChar[X] must be 1.
**
** Ticket #1066.  the SQL standard does not allow '$' in the
** middle of identfiers.  But many SQL implementations do. 
** SQLite will allow '$' in identifiers for compatibility.
** But the feature is undocumented.
*/
static const char isFtsIdChar[] = {
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
    0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* 2x */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  /* 3x */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 4x */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,  /* 5x */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 6x */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,  /* 7x */
};
#define ftsIdChar(C)  (((c=C)&0x80)!=0 || (c>0x1f && isFtsIdChar[c-0x20]))


/*
** Return the length of the token that begins at z[0]. 
** Store the token type in *tokenType before returning.
*/
static int ftsGetToken(const char *z, int *tokenType){
  int i, c;
  switch( *z ){
    case 0: {
      *tokenType = TOKEN_EOF;
      return 0;
    }
    case ' ': case '\t': case '\n': case '\f': case '\r': {
      for(i=1; safe_isspace(z[i]); i++){}
      *tokenType = TOKEN_SPACE;
      return i;
    }
    case '`':
    case '\'':
    case '"': {
      int delim = z[0];
      for(i=1; (c=z[i])!=0; i++){
        if( c==delim ){
          if( z[i+1]==delim ){
            i++;
          }else{
            break;
          }
        }
      }
      *tokenType = TOKEN_STRING;
      return i + (c!=0);
    }
    case '[': {
      for(i=1, c=z[0]; c!=']' && (c=z[i])!=0; i++){}
      *tokenType = TOKEN_ID;
      return i;
    }
    default: {
      if( !ftsIdChar(*z) ){
        break;
      }
      for(i=1; ftsIdChar(z[i]); i++){}
      *tokenType = TOKEN_ID;
      return i;
    }
  }
  *tokenType = TOKEN_PUNCT;
  return 1;
}

/*
** A token extracted from a string is an instance of the following
** structure.
*/
typedef struct FtsToken {
  const char *z;       /* Pointer to token text.  Not '\000' terminated */
  short int n;         /* Length of the token text in bytes. */
} FtsToken;

/*
** Given a input string (which is really one of the argv[] parameters
** passed into xConnect or xCreate) split the string up into tokens.
** Return an array of pointers to '\000' terminated strings, one string
** for each non-whitespace token.
**
** The returned array is terminated by a single NULL pointer.
**
** Space to hold the returned array is obtained from a single
** malloc and should be freed by passing the return value to free().
** The individual strings within the token list are all a part of
** the single memory allocation and will all be freed at once.
*/
static char **tokenizeString(const char *z, int *pnToken){
  int nToken = 0;
  FtsToken *aToken = sqlite3_malloc( strlen(z) * sizeof(aToken[0]) );
  int n = 1;
  int e, i;
  int totalSize = 0;
  char **azToken;
  char *zCopy;
  while( n>0 ){
    n = ftsGetToken(z, &e);
    if( e!=TOKEN_SPACE ){
      aToken[nToken].z = z;
      aToken[nToken].n = n;
      nToken++;
      totalSize += n+1;
    }
    z += n;
  }
  azToken = (char**)sqlite3_malloc( nToken*sizeof(char*) + totalSize );
  zCopy = (char*)&azToken[nToken];
  nToken--;
  for(i=0; i<nToken; i++){
    azToken[i] = zCopy;
    n = aToken[i].n;
    memcpy(zCopy, aToken[i].z, n);
    zCopy[n] = 0;
    zCopy += n+1;
  }
  azToken[nToken] = 0;
  sqlite3_free(aToken);
  *pnToken = nToken;
  return azToken;
}

/*
** Convert an SQL-style quoted string into a normal string by removing
** the quote characters.  The conversion is done in-place.  If the
** input does not begin with a quote character, then this routine
** is a no-op.
**
** Examples:
**
**     "abc"   becomes   abc
**     'xyz'   becomes   xyz
**     [pqr]   becomes   pqr
**     `mno`   becomes   mno
*/
static void dequoteString(char *z){
  int quote;
  int i, j;
  if( z==0 ) return;
  quote = z[0];
  switch( quote ){
    case '\'':  break;
    case '"':   break;
    case '`':   break;                /* For MySQL compatibility */
    case '[':   quote = ']';  break;  /* For MS SqlServer compatibility */
    default:    return;
  }
  for(i=1, j=0; z[i]; i++){
    if( z[i]==quote ){
      if( z[i+1]==quote ){
        z[j++] = quote;
        i++;
      }else{
        z[j++] = 0;
        break;
      }
    }else{
      z[j++] = z[i];
    }
  }
}

/*
** The input azIn is a NULL-terminated list of tokens.  Remove the first
** token and all punctuation tokens.  Remove the quotes from
** around string literal tokens.
**
** Example:
**
**     input:      tokenize chinese ( 'simplifed' , 'mixed' )
**     output:     chinese simplifed mixed
**
** Another example:
**
**     input:      delimiters ( '[' , ']' , '...' )
**     output:     [ ] ...
*/
static void tokenListToIdList(char **azIn){
  int i, j;
  if( azIn ){
    for(i=0, j=-1; azIn[i]; i++){
      if( safe_isalnum(azIn[i][0]) || azIn[i][1] ){
        dequoteString(azIn[i]);
        if( j>=0 ){
          azIn[j] = azIn[i];
        }
        j++;
      }
    }
    azIn[j] = 0;
  }
}


/*
** Find the first alphanumeric token in the string zIn.  Null-terminate
** this token.  Remove any quotation marks.  And return a pointer to
** the result.
*/
static char *firstToken(char *zIn, char **pzTail){
  int n, ttype;
  while(1){
    n = ftsGetToken(zIn, &ttype);
    if( ttype==TOKEN_SPACE ){
      zIn += n;
    }else if( ttype==TOKEN_EOF ){
      *pzTail = zIn;
      return 0;
    }else{
      zIn[n] = 0;
      *pzTail = &zIn[1];
      dequoteString(zIn);
      return zIn;
    }
  }
  /*NOTREACHED*/
}

/* Return true if...
**
**   *  s begins with the string t, ignoring case
**   *  s is longer than t
**   *  The first character of s beyond t is not a alphanumeric
** 
** Ignore leading space in *s.
**
** To put it another way, return true if the first token of
** s[] is t[].
*/
static int startsWith(const char *s, const char *t){
  while( safe_isspace(*s) ){ s++; }
  while( *t ){
    if( safe_tolower(*s++)!=safe_tolower(*t++) ) return 0;
  }
  return *s!='_' && !safe_isalnum(*s);
}

/*
** An instance of this structure defines the "spec" of a
** full text index.  This structure is populated by parseSpec
** and use by fulltextConnect and fulltextCreate.
*/
typedef struct TableSpec {
  const char *zDb;         /* Logical database name */
  const char *zName;       /* Name of the full-text index */
  int nColumn;             /* Number of columns to be indexed */
  char **azColumn;         /* Original names of columns to be indexed */
  char **azContentColumn;  /* Column names for %_content */
  char **azTokenizer;      /* Name of tokenizer and its arguments */
} TableSpec;

/*
** Reclaim all of the memory used by a TableSpec
*/
static void clearTableSpec(TableSpec *p) {
  sqlite3_free(p->azColumn);
  sqlite3_free(p->azContentColumn);
  sqlite3_free(p->azTokenizer);
}

/* Parse a CREATE VIRTUAL TABLE statement, which looks like this:
 *
 * CREATE VIRTUAL TABLE email
 *        USING fts3(subject, body, tokenize mytokenizer(myarg))
 *
 * We return parsed information in a TableSpec structure.
 * 
 */
static int parseSpec(TableSpec *pSpec, int argc, const char *const*argv,
                     char**pzErr){
  int i, n;
  char *z, *zDummy;
  char **azArg;
  const char *zTokenizer = 0;    /* argv[] entry describing the tokenizer */

  assert( argc>=3 );
  /* Current interface:
  ** argv[0] - module name
  ** argv[1] - database name
  ** argv[2] - table name
  ** argv[3..] - columns, optionally followed by tokenizer specification
  **             and snippet delimiters specification.
  */

  /* Make a copy of the complete argv[][] array in a single allocation.
  ** The argv[][] array is read-only and transient.  We can write to the
  ** copy in order to modify things and the copy is persistent.
  */
  CLEAR(pSpec);
  for(i=n=0; i<argc; i++){
    n += strlen(argv[i]) + 1;
  }
  azArg = sqlite3_malloc( sizeof(char*)*argc + n );
  if( azArg==0 ){
    return SQLITE_NOMEM;
  }
  z = (char*)&azArg[argc];
  for(i=0; i<argc; i++){
    azArg[i] = z;
    strcpy(z, argv[i]);
    z += strlen(z)+1;
  }

  /* Identify the column names and the tokenizer and delimiter arguments
  ** in the argv[][] array.
  */
  pSpec->zDb = azArg[1];
  pSpec->zName = azArg[2];
  pSpec->nColumn = 0;
  pSpec->azColumn = azArg;
  zTokenizer = "tokenize simple";
  for(i=3; i<argc; ++i){
    if( startsWith(azArg[i],"tokenize") ){
      zTokenizer = azArg[i];
    }else{
      z = azArg[pSpec->nColumn] = firstToken(azArg[i], &zDummy);
      pSpec->nColumn++;
    }
  }
  if( pSpec->nColumn==0 ){
    azArg[0] = "content";
    pSpec->nColumn = 1;
  }

  /*
  ** Construct the list of content column names.
  **
  ** Each content column name will be of the form cNNAAAA
  ** where NN is the column number and AAAA is the sanitized
  ** column name.  "sanitized" means that special characters are
  ** converted to "_".  The cNN prefix guarantees that all column
  ** names are unique.
  **
  ** The AAAA suffix is not strictly necessary.  It is included
  ** for the convenience of people who might examine the generated
  ** %_content table and wonder what the columns are used for.
  */
  pSpec->azContentColumn = sqlite3_malloc( pSpec->nColumn * sizeof(char *) );
  if( pSpec->azContentColumn==0 ){
    clearTableSpec(pSpec);
    return SQLITE_NOMEM;
  }
  for(i=0; i<pSpec->nColumn; i++){
    char *p;
    pSpec->azContentColumn[i] = sqlite3_mprintf("c%d%s", i, azArg[i]);
    for (p = pSpec->azContentColumn[i]; *p ; ++p) {
      if( !safe_isalnum(*p) ) *p = '_';
    }
  }

  /*
  ** Parse the tokenizer specification string.
  */
  pSpec->azTokenizer = tokenizeString(zTokenizer, &n);
  tokenListToIdList(pSpec->azTokenizer);

  return SQLITE_OK;
}

/*
** Generate a CREATE TABLE statement that describes the schema of
** the virtual table.  Return a pointer to this schema string.
**
** Space is obtained from sqlite3_mprintf() and should be freed
** using sqlite3_free().
*/
static char *fulltextSchema(
  int nColumn,                  /* Number of columns */
  const char *const* azColumn,  /* List of columns */
  const char *zTableName        /* Name of the table */
){
  int i;
  char *zSchema, *zNext;
  const char *zSep = "(";
  zSchema = sqlite3_mprintf("CREATE TABLE x");
  for(i=0; i<nColumn; i++){
    zNext = sqlite3_mprintf("%s%s%Q", zSchema, zSep, azColumn[i]);
    sqlite3_free(zSchema);
    zSchema = zNext;
    zSep = ",";
  }
  zNext = sqlite3_mprintf("%s,%Q HIDDEN", zSchema, zTableName);
  sqlite3_free(zSchema);
  zSchema = zNext;
  zNext = sqlite3_mprintf("%s,docid HIDDEN)", zSchema);
  sqlite3_free(zSchema);
  return zNext;
}

/*
** Build a new sqlite3_vtab structure that will describe the
** fulltext index defined by spec.
*/
static int constructVtab(
  sqlite3 *db,              /* The SQLite database connection */
  fts3Hash *pHash,          /* Hash table containing tokenizers */
  TableSpec *spec,          /* Parsed spec information from parseSpec() */
  sqlite3_vtab **ppVTab,    /* Write the resulting vtab structure here */
  char **pzErr              /* Write any error message here */
){
  int rc;
  int n;
  fulltext_vtab *v = 0;
  const sqlite3_tokenizer_module *m = NULL;
  char *schema;

  char const *zTok;         /* Name of tokenizer to use for this fts table */
  int nTok;                 /* Length of zTok, including nul terminator */

  v = (fulltext_vtab *) sqlite3_malloc(sizeof(fulltext_vtab));
  if( v==0 ) return SQLITE_NOMEM;
  CLEAR(v);
  /* sqlite will initialize v->base */
  v->db = db;
  v->zDb = spec->zDb;       /* Freed when azColumn is freed */
  v->zName = spec->zName;   /* Freed when azColumn is freed */
  v->nColumn = spec->nColumn;
  v->azContentColumn = spec->azContentColumn;
  spec->azContentColumn = 0;
  v->azColumn = spec->azColumn;
  spec->azColumn = 0;

  if( spec->azTokenizer==0 ){
    return SQLITE_NOMEM;
  }

  zTok = spec->azTokenizer[0]; 
  if( !zTok ){
    zTok = "simple";
  }
  nTok = strlen(zTok)+1;

  m = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash, zTok, nTok);
  if( !m ){
    *pzErr = sqlite3_mprintf("unknown tokenizer: %s", spec->azTokenizer[0]);
    rc = SQLITE_ERROR;
    goto err;
  }

  for(n=0; spec->azTokenizer[n]; n++){}
  if( n ){
    rc = m->xCreate(n-1, (const char*const*)&spec->azTokenizer[1],
                    &v->pTokenizer);
  }else{
    rc = m->xCreate(0, 0, &v->pTokenizer);
  }
  if( rc!=SQLITE_OK ) goto err;
  v->pTokenizer->pModule = m;

  /* TODO: verify the existence of backing tables foo_content, foo_term */

  schema = fulltextSchema(v->nColumn, (const char*const*)v->azColumn,
                          spec->zName);
  rc = sqlite3_declare_vtab(db, schema);
  sqlite3_free(schema);
  if( rc!=SQLITE_OK ) goto err;

  memset(v->pFulltextStatements, 0, sizeof(v->pFulltextStatements));

  /* Indicate that the buffer is not live. */
  v->nPendingData = -1;

  *ppVTab = &v->base;
  FTSTRACE(("FTS3 Connect %p\n", v));

  return rc;

err:
  fulltext_vtab_destroy(v);
  return rc;
}

static int fulltextConnect(
  sqlite3 *db,
  void *pAux,
  int argc, const char *const*argv,
  sqlite3_vtab **ppVTab,
  char **pzErr
){
  TableSpec spec;
  int rc = parseSpec(&spec, argc, argv, pzErr);
  if( rc!=SQLITE_OK ) return rc;

  rc = constructVtab(db, (fts3Hash *)pAux, &spec, ppVTab, pzErr);
  clearTableSpec(&spec);
  return rc;
}

/* The %_content table holds the text of each document, with
** the docid column exposed as the SQLite rowid for the table.
*/
/* TODO(shess) This comment needs elaboration to match the updated
** code.  Work it into the top-of-file comment at that time.
*/
static int fulltextCreate(sqlite3 *db, void *pAux,
                          int argc, const char * const *argv,
                          sqlite3_vtab **ppVTab, char **pzErr){
  int rc;
  TableSpec spec;
  StringBuffer schema;
  FTSTRACE(("FTS3 Create\n"));

  rc = parseSpec(&spec, argc, argv, pzErr);
  if( rc!=SQLITE_OK ) return rc;

  initStringBuffer(&schema);
  append(&schema, "CREATE TABLE %_content(");
  append(&schema, "  docid INTEGER PRIMARY KEY,");
  appendList(&schema, spec.nColumn, spec.azContentColumn);
  append(&schema, ")");
  rc = sql_exec(db, spec.zDb, spec.zName, stringBufferData(&schema));
  stringBufferDestroy(&schema);
  if( rc!=SQLITE_OK ) goto out;

  rc = sql_exec(db, spec.zDb, spec.zName,
                "create table %_segments("
                "  blockid INTEGER PRIMARY KEY,"
                "  block blob"
                ");"
                );
  if( rc!=SQLITE_OK ) goto out;

  rc = sql_exec(db, spec.zDb, spec.zName,
                "create table %_segdir("
                "  level integer,"
                "  idx integer,"
                "  start_block integer,"
                "  leaves_end_block integer,"
                "  end_block integer,"
                "  root blob,"
                "  primary key(level, idx)"
                ");");
  if( rc!=SQLITE_OK ) goto out;

  rc = constructVtab(db, (fts3Hash *)pAux, &spec, ppVTab, pzErr);

out:
  clearTableSpec(&spec);
  return rc;
}

/* Decide how to handle an SQL query. */
static int fulltextBestIndex(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){
  fulltext_vtab *v = (fulltext_vtab *)pVTab;
  int i;
  FTSTRACE(("FTS3 BestIndex\n"));

  for(i=0; i<pInfo->nConstraint; ++i){
    const struct sqlite3_index_constraint *pConstraint;
    pConstraint = &pInfo->aConstraint[i];
    if( pConstraint->usable ) {
      if( (pConstraint->iColumn==-1 || pConstraint->iColumn==v->nColumn+1) &&
          pConstraint->op==SQLITE_INDEX_CONSTRAINT_EQ ){
        pInfo->idxNum = QUERY_DOCID;      /* lookup by docid */
        FTSTRACE(("FTS3 QUERY_DOCID\n"));
      } else if( pConstraint->iColumn>=0 && pConstraint->iColumn<=v->nColumn &&
                 pConstraint->op==SQLITE_INDEX_CONSTRAINT_MATCH ){
        /* full-text search */
        pInfo->idxNum = QUERY_FULLTEXT + pConstraint->iColumn;
        FTSTRACE(("FTS3 QUERY_FULLTEXT %d\n", pConstraint->iColumn));
      } else continue;

      pInfo->aConstraintUsage[i].argvIndex = 1;
      pInfo->aConstraintUsage[i].omit = 1;

      /* An arbitrary value for now.
       * TODO: Perhaps docid matches should be considered cheaper than
       * full-text searches. */
      pInfo->estimatedCost = 1.0;   

      return SQLITE_OK;
    }
  }
  pInfo->idxNum = QUERY_GENERIC;
  return SQLITE_OK;
}

static int fulltextDisconnect(sqlite3_vtab *pVTab){
  FTSTRACE(("FTS3 Disconnect %p\n", pVTab));
  fulltext_vtab_destroy((fulltext_vtab *)pVTab);
  return SQLITE_OK;
}

static int fulltextDestroy(sqlite3_vtab *pVTab){
  fulltext_vtab *v = (fulltext_vtab *)pVTab;
  int rc;

  FTSTRACE(("FTS3 Destroy %p\n", pVTab));
  rc = sql_exec(v->db, v->zDb, v->zName,
                "drop table if exists %_content;"
                "drop table if exists %_segments;"
                "drop table if exists %_segdir;"
                );
  if( rc!=SQLITE_OK ) return rc;

  fulltext_vtab_destroy((fulltext_vtab *)pVTab);
  return SQLITE_OK;
}

static int fulltextOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){
  fulltext_cursor *c;

  c = (fulltext_cursor *) sqlite3_malloc(sizeof(fulltext_cursor));
  if( c ){
    memset(c, 0, sizeof(fulltext_cursor));
    /* sqlite will initialize c->base */
    *ppCursor = &c->base;
    FTSTRACE(("FTS3 Open %p: %p\n", pVTab, c));
    return SQLITE_OK;
  }else{
    return SQLITE_NOMEM;
  }
}


/* Free all of the dynamically allocated memory held by *q
*/
static void queryClear(Query *q){
  int i;
  for(i = 0; i < q->nTerms; ++i){
    sqlite3_free(q->pTerms[i].pTerm);
  }
  sqlite3_free(q->pTerms);
  CLEAR(q);
}

/* Free all of the dynamically allocated memory held by the
** Snippet
*/
static void snippetClear(Snippet *p){
  sqlite3_free(p->aMatch);
  sqlite3_free(p->zOffset);
  sqlite3_free(p->zSnippet);
  CLEAR(p);
}
/*
** Append a single entry to the p->aMatch[] log.
*/
static void snippetAppendMatch(
  Snippet *p,               /* Append the entry to this snippet */
  int iCol, int iTerm,      /* The column and query term */
  int iToken,               /* Matching token in document */
  int iStart, int nByte     /* Offset and size of the match */
){
  int i;
  struct snippetMatch *pMatch;
  if( p->nMatch+1>=p->nAlloc ){
    p->nAlloc = p->nAlloc*2 + 10;
    p->aMatch = sqlite3_realloc(p->aMatch, p->nAlloc*sizeof(p->aMatch[0]) );
    if( p->aMatch==0 ){
      p->nMatch = 0;
      p->nAlloc = 0;
      return;
    }
  }
  i = p->nMatch++;
  pMatch = &p->aMatch[i];
  pMatch->iCol = iCol;
  pMatch->iTerm = iTerm;
  pMatch->iToken = iToken;
  pMatch->iStart = iStart;
  pMatch->nByte = nByte;
}

/*
** Sizing information for the circular buffer used in snippetOffsetsOfColumn()
*/
#define FTS3_ROTOR_SZ   (32)
#define FTS3_ROTOR_MASK (FTS3_ROTOR_SZ-1)

/*
** Add entries to pSnippet->aMatch[] for every match that occurs against
** document zDoc[0..nDoc-1] which is stored in column iColumn.
*/
static void snippetOffsetsOfColumn(
  Query *pQuery,
  Snippet *pSnippet,
  int iColumn,
  const char *zDoc,
  int nDoc
){
  const sqlite3_tokenizer_module *pTModule;  /* The tokenizer module */
  sqlite3_tokenizer *pTokenizer;             /* The specific tokenizer */
  sqlite3_tokenizer_cursor *pTCursor;        /* Tokenizer cursor */
  fulltext_vtab *pVtab;                /* The full text index */
  int nColumn;                         /* Number of columns in the index */
  const QueryTerm *aTerm;              /* Query string terms */
  int nTerm;                           /* Number of query string terms */  
  int i, j;                            /* Loop counters */
  int rc;                              /* Return code */
  unsigned int match, prevMatch;       /* Phrase search bitmasks */
  const char *zToken;                  /* Next token from the tokenizer */
  int nToken;                          /* Size of zToken */
  int iBegin, iEnd, iPos;              /* Offsets of beginning and end */

  /* The following variables keep a circular buffer of the last
  ** few tokens */
  unsigned int iRotor = 0;             /* Index of current token */
  int iRotorBegin[FTS3_ROTOR_SZ];      /* Beginning offset of token */
  int iRotorLen[FTS3_ROTOR_SZ];        /* Length of token */

  pVtab = pQuery->pFts;
  nColumn = pVtab->nColumn;
  pTokenizer = pVtab->pTokenizer;
  pTModule = pTokenizer->pModule;
  rc = pTModule->xOpen(pTokenizer, zDoc, nDoc, &pTCursor);
  if( rc ) return;
  pTCursor->pTokenizer = pTokenizer;
  aTerm = pQuery->pTerms;
  nTerm = pQuery->nTerms;
  if( nTerm>=FTS3_ROTOR_SZ ){
    nTerm = FTS3_ROTOR_SZ - 1;
  }
  prevMatch = 0;
  while(1){
    rc = pTModule->xNext(pTCursor, &zToken, &nToken, &iBegin, &iEnd, &iPos);
    if( rc ) break;
    iRotorBegin[iRotor&FTS3_ROTOR_MASK] = iBegin;
    iRotorLen[iRotor&FTS3_ROTOR_MASK] = iEnd-iBegin;
    match = 0;
    for(i=0; i<nTerm; i++){
      int iCol;
      iCol = aTerm[i].iColumn;
      if( iCol>=0 && iCol<nColumn && iCol!=iColumn ) continue;
      if( aTerm[i].nTerm>nToken ) continue;
      if( !aTerm[i].isPrefix && aTerm[i].nTerm<nToken ) continue;
      assert( aTerm[i].nTerm<=nToken );
      if( memcmp(aTerm[i].pTerm, zToken, aTerm[i].nTerm) ) continue;
      if( aTerm[i].iPhrase>1 && (prevMatch & (1<<i))==0 ) continue;
      match |= 1<<i;
      if( i==nTerm-1 || aTerm[i+1].iPhrase==1 ){
        for(j=aTerm[i].iPhrase-1; j>=0; j--){
          int k = (iRotor-j) & FTS3_ROTOR_MASK;
          snippetAppendMatch(pSnippet, iColumn, i-j, iPos-j,
                iRotorBegin[k], iRotorLen[k]);
        }
      }
    }
    prevMatch = match<<1;
    iRotor++;
  }
  pTModule->xClose(pTCursor);  
}

/*
** Remove entries from the pSnippet structure to account for the NEAR
** operator. When this is called, pSnippet contains the list of token 
** offsets produced by treating all NEAR operators as AND operators.
** This function removes any entries that should not be present after
** accounting for the NEAR restriction. For example, if the queried
** document is:
**
**     "A B C D E A"
**
** and the query is:
** 
**     A NEAR/0 E
**
** then when this function is called the Snippet contains token offsets
** 0, 4 and 5. This function removes the "0" entry (because the first A
** is not near enough to an E).
*/
static void trimSnippetOffsetsForNear(Query *pQuery, Snippet *pSnippet){
  int ii;
  int iDir = 1;

  while(iDir>-2) {
    assert( iDir==1 || iDir==-1 );
    for(ii=0; ii<pSnippet->nMatch; ii++){
      int jj;
      int nNear;
      struct snippetMatch *pMatch = &pSnippet->aMatch[ii];
      QueryTerm *pQueryTerm = &pQuery->pTerms[pMatch->iTerm];

      if( (pMatch->iTerm+iDir)<0 
       || (pMatch->iTerm+iDir)>=pQuery->nTerms
      ){
        continue;
      }
     
      nNear = pQueryTerm->nNear;
      if( iDir<0 ){
        nNear = pQueryTerm[-1].nNear;
      }
  
      if( pMatch->iTerm>=0 && nNear ){
        int isOk = 0;
        int iNextTerm = pMatch->iTerm+iDir;
        int iPrevTerm = iNextTerm;

        int iEndToken;
        int iStartToken;

        if( iDir<0 ){
          int nPhrase = 1;
          iStartToken = pMatch->iToken;
          while( (pMatch->iTerm+nPhrase)<pQuery->nTerms 
              && pQuery->pTerms[pMatch->iTerm+nPhrase].iPhrase>1 
          ){
            nPhrase++;
          }
          iEndToken = iStartToken + nPhrase - 1;
        }else{
          iEndToken   = pMatch->iToken;
          iStartToken = pMatch->iToken+1-pQueryTerm->iPhrase;
        }

        while( pQuery->pTerms[iNextTerm].iPhrase>1 ){
          iNextTerm--;
        }
        while( (iPrevTerm+1)<pQuery->nTerms && 
               pQuery->pTerms[iPrevTerm+1].iPhrase>1 
        ){
          iPrevTerm++;
        }
  
        for(jj=0; isOk==0 && jj<pSnippet->nMatch; jj++){
          struct snippetMatch *p = &pSnippet->aMatch[jj];
          if( p->iCol==pMatch->iCol && ((
               p->iTerm==iNextTerm && 
               p->iToken>iEndToken && 
               p->iToken<=iEndToken+nNear
          ) || (
               p->iTerm==iPrevTerm && 
               p->iToken<iStartToken && 
               p->iToken>=iStartToken-nNear
          ))){
            isOk = 1;
          }
        }
        if( !isOk ){
          for(jj=1-pQueryTerm->iPhrase; jj<=0; jj++){
            pMatch[jj].iTerm = -1;
          }
          ii = -1;
          iDir = 1;
        }
      }
    }
    iDir -= 2;
  }
}

/*
** Compute all offsets for the current row of the query.  
** If the offsets have already been computed, this routine is a no-op.
*/
static void snippetAllOffsets(fulltext_cursor *p){
  int nColumn;
  int iColumn, i;
  int iFirst, iLast;
  fulltext_vtab *pFts;

  if( p->snippet.nMatch ) return;
  if( p->q.nTerms==0 ) return;
  pFts = p->q.pFts;
  nColumn = pFts->nColumn;
  iColumn = (p->iCursorType - QUERY_FULLTEXT);
  if( iColumn<0 || iColumn>=nColumn ){
    iFirst = 0;
    iLast = nColumn-1;
  }else{
    iFirst = iColumn;
    iLast = iColumn;
  }
  for(i=iFirst; i<=iLast; i++){
    const char *zDoc;
    int nDoc;
    zDoc = (const char*)sqlite3_column_text(p->pStmt, i+1);
    nDoc = sqlite3_column_bytes(p->pStmt, i+1);
    snippetOffsetsOfColumn(&p->q, &p->snippet, i, zDoc, nDoc);
  }

  trimSnippetOffsetsForNear(&p->q, &p->snippet);
}

/*
** Convert the information in the aMatch[] array of the snippet
** into the string zOffset[0..nOffset-1].
*/
static void snippetOffsetText(Snippet *p){
  int i;
  int cnt = 0;
  StringBuffer sb;
  char zBuf[200];
  if( p->zOffset ) return;
  initStringBuffer(&sb);
  for(i=0; i<p->nMatch; i++){
    struct snippetMatch *pMatch = &p->aMatch[i];
    if( pMatch->iTerm>=0 ){
      /* If snippetMatch.iTerm is less than 0, then the match was 
      ** discarded as part of processing the NEAR operator (see the 
      ** trimSnippetOffsetsForNear() function for details). Ignore 
      ** it in this case
      */
      zBuf[0] = ' ';
      sqlite3_snprintf(sizeof(zBuf)-1, &zBuf[cnt>0], "%d %d %d %d",
          pMatch->iCol, pMatch->iTerm, pMatch->iStart, pMatch->nByte);
      append(&sb, zBuf);
      cnt++;
    }
  }
  p->zOffset = stringBufferData(&sb);
  p->nOffset = stringBufferLength(&sb);
}

/*
** zDoc[0..nDoc-1] is phrase of text.  aMatch[0..nMatch-1] are a set
** of matching words some of which might be in zDoc.  zDoc is column
** number iCol.
**
** iBreak is suggested spot in zDoc where we could begin or end an
** excerpt.  Return a value similar to iBreak but possibly adjusted
** to be a little left or right so that the break point is better.
*/
static int wordBoundary(
  int iBreak,                   /* The suggested break point */
  const char *zDoc,             /* Document text */
  int nDoc,                     /* Number of bytes in zDoc[] */
  struct snippetMatch *aMatch,  /* Matching words */
  int nMatch,                   /* Number of entries in aMatch[] */
  int iCol                      /* The column number for zDoc[] */
){
  int i;
  if( iBreak<=10 ){
    return 0;
  }
  if( iBreak>=nDoc-10 ){
    return nDoc;
  }
  for(i=0; i<nMatch && aMatch[i].iCol<iCol; i++){}
  while( i<nMatch && aMatch[i].iStart+aMatch[i].nByte<iBreak ){ i++; }
  if( i<nMatch ){
    if( aMatch[i].iStart<iBreak+10 ){
      return aMatch[i].iStart;
    }
    if( i>0 && aMatch[i-1].iStart+aMatch[i-1].nByte>=iBreak ){
      return aMatch[i-1].iStart;
    }
  }
  for(i=1; i<=10; i++){
    if( safe_isspace(zDoc[iBreak-i]) ){
      return iBreak - i + 1;
    }
    if( safe_isspace(zDoc[iBreak+i]) ){
      return iBreak + i + 1;
    }
  }
  return iBreak;
}



/*
** Allowed values for Snippet.aMatch[].snStatus
*/
#define SNIPPET_IGNORE  0   /* It is ok to omit this match from the snippet */
#define SNIPPET_DESIRED 1   /* We want to include this match in the snippet */

/*
** Generate the text of a snippet.
*/
static void snippetText(
  fulltext_cursor *pCursor,   /* The cursor we need the snippet for */
  const char *zStartMark,     /* Markup to appear before each match */
  const char *zEndMark,       /* Markup to appear after each match */
  const char *zEllipsis       /* Ellipsis mark */
){
  int i, j;
  struct snippetMatch *aMatch;
  int nMatch;
  int nDesired;
  StringBuffer sb;
  int tailCol;
  int tailOffset;
  int iCol;
  int nDoc;
  const char *zDoc;
  int iStart, iEnd;
  int tailEllipsis = 0;
  int iMatch;
  

  sqlite3_free(pCursor->snippet.zSnippet);
  pCursor->snippet.zSnippet = 0;
  aMatch = pCursor->snippet.aMatch;
  nMatch = pCursor->snippet.nMatch;
  initStringBuffer(&sb);

  for(i=0; i<nMatch; i++){
    aMatch[i].snStatus = SNIPPET_IGNORE;
  }
  nDesired = 0;
  for(i=0; i<pCursor->q.nTerms; i++){
    for(j=0; j<nMatch; j++){
      if( aMatch[j].iTerm==i ){
        aMatch[j].snStatus = SNIPPET_DESIRED;
        nDesired++;
        break;
      }
    }
  }

  iMatch = 0;
  tailCol = -1;
  tailOffset = 0;
  for(i=0; i<nMatch && nDesired>0; i++){
    if( aMatch[i].snStatus!=SNIPPET_DESIRED ) continue;
    nDesired--;
    iCol = aMatch[i].iCol;
    zDoc = (const char*)sqlite3_column_text(pCursor->pStmt, iCol+1);
    nDoc = sqlite3_column_bytes(pCursor->pStmt, iCol+1);
    iStart = aMatch[i].iStart - 40;
    iStart = wordBoundary(iStart, zDoc, nDoc, aMatch, nMatch, iCol);
    if( iStart<=10 ){
      iStart = 0;
    }
    if( iCol==tailCol && iStart<=tailOffset+20 ){
      iStart = tailOffset;
    }
    if( (iCol!=tailCol && tailCol>=0) || iStart!=tailOffset ){
      trimWhiteSpace(&sb);
      appendWhiteSpace(&sb);
      append(&sb, zEllipsis);
      appendWhiteSpace(&sb);
    }
    iEnd = aMatch[i].iStart + aMatch[i].nByte + 40;
    iEnd = wordBoundary(iEnd, zDoc, nDoc, aMatch, nMatch, iCol);
    if( iEnd>=nDoc-10 ){
      iEnd = nDoc;
      tailEllipsis = 0;
    }else{
      tailEllipsis = 1;
    }
    while( iMatch<nMatch && aMatch[iMatch].iCol<iCol ){ iMatch++; }
    while( iStart<iEnd ){
      while( iMatch<nMatch && aMatch[iMatch].iStart<iStart
             && aMatch[iMatch].iCol<=iCol ){
        iMatch++;
      }
      if( iMatch<nMatch && aMatch[iMatch].iStart<iEnd
             && aMatch[iMatch].iCol==iCol ){
        nappend(&sb, &zDoc[iStart], aMatch[iMatch].iStart - iStart);
        iStart = aMatch[iMatch].iStart;
        append(&sb, zStartMark);
        nappend(&sb, &zDoc[iStart], aMatch[iMatch].nByte);
        append(&sb, zEndMark);
        iStart += aMatch[iMatch].nByte;
        for(j=iMatch+1; j<nMatch; j++){
          if( aMatch[j].iTerm==aMatch[iMatch].iTerm
              && aMatch[j].snStatus==SNIPPET_DESIRED ){
            nDesired--;
            aMatch[j].snStatus = SNIPPET_IGNORE;
          }
        }
      }else{
        nappend(&sb, &zDoc[iStart], iEnd - iStart);
        iStart = iEnd;
      }
    }
    tailCol = iCol;
    tailOffset = iEnd;
  }
  trimWhiteSpace(&sb);
  if( tailEllipsis ){
    appendWhiteSpace(&sb);
    append(&sb, zEllipsis);
  }
  pCursor->snippet.zSnippet = stringBufferData(&sb);
  pCursor->snippet.nSnippet = stringBufferLength(&sb);
}


/*
** Close the cursor.  For additional information see the documentation
** on the xClose method of the virtual table interface.
*/
static int fulltextClose(sqlite3_vtab_cursor *pCursor){
  fulltext_cursor *c = (fulltext_cursor *) pCursor;
  FTSTRACE(("FTS3 Close %p\n", c));
  sqlite3_finalize(c->pStmt);
  queryClear(&c->q);
  snippetClear(&c->snippet);
  if( c->result.nData!=0 ) dlrDestroy(&c->reader);
  dataBufferDestroy(&c->result);
  sqlite3_free(c);
  return SQLITE_OK;
}

static int fulltextNext(sqlite3_vtab_cursor *pCursor){
  fulltext_cursor *c = (fulltext_cursor *) pCursor;
  int rc;

  FTSTRACE(("FTS3 Next %p\n", pCursor));
  snippetClear(&c->snippet);
  if( c->iCursorType < QUERY_FULLTEXT ){
    /* TODO(shess) Handle SQLITE_SCHEMA AND SQLITE_BUSY. */
    rc = sqlite3_step(c->pStmt);
    switch( rc ){
      case SQLITE_ROW:
        c->eof = 0;
        return SQLITE_OK;
      case SQLITE_DONE:
        c->eof = 1;
        return SQLITE_OK;
      default:
        c->eof = 1;
        return rc;
    }
  } else {  /* full-text query */
    rc = sqlite3_reset(c->pStmt);
    if( rc!=SQLITE_OK ) return rc;

    if( c->result.nData==0 || dlrAtEnd(&c->reader) ){
      c->eof = 1;
      return SQLITE_OK;
    }
    rc = sqlite3_bind_int64(c->pStmt, 1, dlrDocid(&c->reader));
    dlrStep(&c->reader);
    if( rc!=SQLITE_OK ) return rc;
    /* TODO(shess) Handle SQLITE_SCHEMA AND SQLITE_BUSY. */
    rc = sqlite3_step(c->pStmt);
    if( rc==SQLITE_ROW ){   /* the case we expect */
      c->eof = 0;
      return SQLITE_OK;
    }
    /* an error occurred; abort */
    return rc==SQLITE_DONE ? SQLITE_ERROR : rc;
  }
}


/* TODO(shess) If we pushed LeafReader to the top of the file, or to
** another file, term_select() could be pushed above
** docListOfTerm().
*/
static int termSelect(fulltext_vtab *v, int iColumn,
                      const char *pTerm, int nTerm, int isPrefix,
                      DocListType iType, DataBuffer *out);

/* Return a DocList corresponding to the query term *pTerm.  If *pTerm
** is the first term of a phrase query, go ahead and evaluate the phrase
** query and return the doclist for the entire phrase query.
**
** The resulting DL_DOCIDS doclist is stored in pResult, which is
** overwritten.
*/
static int docListOfTerm(
  fulltext_vtab *v,    /* The full text index */
  int iColumn,         /* column to restrict to.  No restriction if >=nColumn */
  QueryTerm *pQTerm,   /* Term we are looking for, or 1st term of a phrase */
  DataBuffer *pResult  /* Write the result here */
){
  DataBuffer left, right, new;
  int i, rc;

  /* No phrase search if no position info. */
  assert( pQTerm->nPhrase==0 || DL_DEFAULT!=DL_DOCIDS );

  /* This code should never be called with buffered updates. */
  assert( v->nPendingData<0 );

  dataBufferInit(&left, 0);
  rc = termSelect(v, iColumn, pQTerm->pTerm, pQTerm->nTerm, pQTerm->isPrefix,
                  (0<pQTerm->nPhrase ? DL_POSITIONS : DL_DOCIDS), &left);
  if( rc ) return rc;
  for(i=1; i<=pQTerm->nPhrase && left.nData>0; i++){
    /* If this token is connected to the next by a NEAR operator, and
    ** the next token is the start of a phrase, then set nPhraseRight
    ** to the number of tokens in the phrase. Otherwise leave it at 1.
    */
    int nPhraseRight = 1;
    while( (i+nPhraseRight)<=pQTerm->nPhrase 
        && pQTerm[i+nPhraseRight].nNear==0 
    ){
      nPhraseRight++;
    }

    dataBufferInit(&right, 0);
    rc = termSelect(v, iColumn, pQTerm[i].pTerm, pQTerm[i].nTerm,
                    pQTerm[i].isPrefix, DL_POSITIONS, &right);
    if( rc ){
      dataBufferDestroy(&left);
      return rc;
    }
    dataBufferInit(&new, 0);
    docListPhraseMerge(left.pData, left.nData, right.pData, right.nData,
                       pQTerm[i-1].nNear, pQTerm[i-1].iPhrase + nPhraseRight,
                       ((i<pQTerm->nPhrase) ? DL_POSITIONS : DL_DOCIDS),
                       &new);
    dataBufferDestroy(&left);
    dataBufferDestroy(&right);
    left = new;
  }
  *pResult = left;
  return SQLITE_OK;
}

/* Add a new term pTerm[0..nTerm-1] to the query *q.
*/
static void queryAdd(Query *q, const char *pTerm, int nTerm){
  QueryTerm *t;
  ++q->nTerms;
  q->pTerms = sqlite3_realloc(q->pTerms, q->nTerms * sizeof(q->pTerms[0]));
  if( q->pTerms==0 ){
    q->nTerms = 0;
    return;
  }
  t = &q->pTerms[q->nTerms - 1];
  CLEAR(t);
  t->pTerm = sqlite3_malloc(nTerm+1);
  memcpy(t->pTerm, pTerm, nTerm);
  t->pTerm[nTerm] = 0;
  t->nTerm = nTerm;
  t->isOr = q->nextIsOr;
  t->isPrefix = 0;
  q->nextIsOr = 0;
  t->iColumn = q->nextColumn;
  q->nextColumn = q->dfltColumn;
}

/*
** Check to see if the string zToken[0...nToken-1] matches any
** column name in the virtual table.   If it does,
** return the zero-indexed column number.  If not, return -1.
*/
static int checkColumnSpecifier(
  fulltext_vtab *pVtab,    /* The virtual table */
  const char *zToken,      /* Text of the token */
  int nToken               /* Number of characters in the token */
){
  int i;
  for(i=0; i<pVtab->nColumn; i++){
    if( memcmp(pVtab->azColumn[i], zToken, nToken)==0
        && pVtab->azColumn[i][nToken]==0 ){
      return i;
    }
  }
  return -1;
}

/*
** Parse the text at pSegment[0..nSegment-1].  Add additional terms
** to the query being assemblied in pQuery.
**
** inPhrase is true if pSegment[0..nSegement-1] is contained within
** double-quotes.  If inPhrase is true, then the first term
** is marked with the number of terms in the phrase less one and
** OR and "-" syntax is ignored.  If inPhrase is false, then every
** term found is marked with nPhrase=0 and OR and "-" syntax is significant.
*/
static int tokenizeSegment(
  sqlite3_tokenizer *pTokenizer,          /* The tokenizer to use */
  const char *pSegment, int nSegment,     /* Query expression being parsed */
  int inPhrase,                           /* True if within "..." */
  Query *pQuery                           /* Append results here */
){
  const sqlite3_tokenizer_module *pModule = pTokenizer->pModule;
  sqlite3_tokenizer_cursor *pCursor;
  int firstIndex = pQuery->nTerms;
  int iCol;
  int nTerm = 1;
  
  int rc = pModule->xOpen(pTokenizer, pSegment, nSegment, &pCursor);
  if( rc!=SQLITE_OK ) return rc;
  pCursor->pTokenizer = pTokenizer;

  while( 1 ){
    const char *pToken;
    int nToken, iBegin, iEnd, iPos;

    rc = pModule->xNext(pCursor,
                        &pToken, &nToken,
                        &iBegin, &iEnd, &iPos);
    if( rc!=SQLITE_OK ) break;
    if( !inPhrase &&
        pSegment[iEnd]==':' &&
         (iCol = checkColumnSpecifier(pQuery->pFts, pToken, nToken))>=0 ){
      pQuery->nextColumn = iCol;
      continue;
    }
    if( !inPhrase && pQuery->nTerms>0 && nToken==2 
     && pSegment[iBegin+0]=='O'
     && pSegment[iBegin+1]=='R' 
    ){
      pQuery->nextIsOr = 1;
      continue;
    }
    if( !inPhrase && pQuery->nTerms>0 && !pQuery->nextIsOr && nToken==4 
      && pSegment[iBegin+0]=='N' 
      && pSegment[iBegin+1]=='E' 
      && pSegment[iBegin+2]=='A' 
      && pSegment[iBegin+3]=='R' 
    ){
      QueryTerm *pTerm = &pQuery->pTerms[pQuery->nTerms-1];
      if( (iBegin+6)<nSegment 
       && pSegment[iBegin+4] == '/'
       && pSegment[iBegin+5]>='0' && pSegment[iBegin+5]<='9'
      ){
        pTerm->nNear = (pSegment[iBegin+5] - '0');
        nToken += 2;
        if( pSegment[iBegin+6]>='0' && pSegment[iBegin+6]<=9 ){
          pTerm->nNear = pTerm->nNear * 10 + (pSegment[iBegin+6] - '0');
          iEnd++;
        }
        pModule->xNext(pCursor, &pToken, &nToken, &iBegin, &iEnd, &iPos);
      } else {
        pTerm->nNear = SQLITE_FTS3_DEFAULT_NEAR_PARAM;
      }
      pTerm->nNear++;
      continue;
    }

    queryAdd(pQuery, pToken, nToken);
    if( !inPhrase && iBegin>0 && pSegment[iBegin-1]=='-' ){
      pQuery->pTerms[pQuery->nTerms-1].isNot = 1;
    }
    if( iEnd<nSegment && pSegment[iEnd]=='*' ){
      pQuery->pTerms[pQuery->nTerms-1].isPrefix = 1;
    }
    pQuery->pTerms[pQuery->nTerms-1].iPhrase = nTerm;
    if( inPhrase ){
      nTerm++;
    }
  }

  if( inPhrase && pQuery->nTerms>firstIndex ){
    pQuery->pTerms[firstIndex].nPhrase = pQuery->nTerms - firstIndex - 1;
  }

  return pModule->xClose(pCursor);
}

/* Parse a query string, yielding a Query object pQuery.
**
** The calling function will need to queryClear() to clean up
** the dynamically allocated memory held by pQuery.
*/
static int parseQuery(
  fulltext_vtab *v,        /* The fulltext index */
  const char *zInput,      /* Input text of the query string */
  int nInput,              /* Size of the input text */
  int dfltColumn,          /* Default column of the index to match against */
  Query *pQuery            /* Write the parse results here. */
){
  int iInput, inPhrase = 0;
  int ii;
  QueryTerm *aTerm;

  if( zInput==0 ) nInput = 0;
  if( nInput<0 ) nInput = strlen(zInput);
  pQuery->nTerms = 0;
  pQuery->pTerms = NULL;
  pQuery->nextIsOr = 0;
  pQuery->nextColumn = dfltColumn;
  pQuery->dfltColumn = dfltColumn;
  pQuery->pFts = v;

  for(iInput=0; iInput<nInput; ++iInput){
    int i;
    for(i=iInput; i<nInput && zInput[i]!='"'; ++i){}
    if( i>iInput ){
      tokenizeSegment(v->pTokenizer, zInput+iInput, i-iInput, inPhrase,
                       pQuery);
    }
    iInput = i;
    if( i<nInput ){
      assert( zInput[i]=='"' );
      inPhrase = !inPhrase;
    }
  }

  if( inPhrase ){
    /* unmatched quote */
    queryClear(pQuery);
    return SQLITE_ERROR;
  }

  /* Modify the values of the QueryTerm.nPhrase variables to account for
  ** the NEAR operator. For the purposes of QueryTerm.nPhrase, phrases
  ** and tokens connected by the NEAR operator are handled as a single
  ** phrase. See comments above the QueryTerm structure for details.
  */
  aTerm = pQuery->pTerms;
  for(ii=0; ii<pQuery->nTerms; ii++){
    if( aTerm[ii].nNear || aTerm[ii].nPhrase ){
      while (aTerm[ii+aTerm[ii].nPhrase].nNear) {
        aTerm[ii].nPhrase += (1 + aTerm[ii+aTerm[ii].nPhrase+1].nPhrase);
      }
    }
  }

  return SQLITE_OK;
}

/* TODO(shess) Refactor the code to remove this forward decl. */
static int flushPendingTerms(fulltext_vtab *v);

/* Perform a full-text query using the search expression in
** zInput[0..nInput-1].  Return a list of matching documents
** in pResult.
**
** Queries must match column iColumn.  Or if iColumn>=nColumn
** they are allowed to match against any column.
*/
static int fulltextQuery(
  fulltext_vtab *v,      /* The full text index */
  int iColumn,           /* Match against this column by default */
  const char *zInput,    /* The query string */
  int nInput,            /* Number of bytes in zInput[] */
  DataBuffer *pResult,   /* Write the result doclist here */
  Query *pQuery          /* Put parsed query string here */
){
  int i, iNext, rc;
  DataBuffer left, right, or, new;
  int nNot = 0;
  QueryTerm *aTerm;

  /* TODO(shess) Instead of flushing pendingTerms, we could query for
  ** the relevant term and merge the doclist into what we receive from
  ** the database.  Wait and see if this is a common issue, first.
  **
  ** A good reason not to flush is to not generate update-related
  ** error codes from here.
  */

  /* Flush any buffered updates before executing the query. */
  rc = flushPendingTerms(v);
  if( rc!=SQLITE_OK ) return rc;

  /* TODO(shess) I think that the queryClear() calls below are not
  ** necessary, because fulltextClose() already clears the query.
  */
  rc = parseQuery(v, zInput, nInput, iColumn, pQuery);
  if( rc!=SQLITE_OK ) return rc;

  /* Empty or NULL queries return no results. */
  if( pQuery->nTerms==0 ){
    dataBufferInit(pResult, 0);
    return SQLITE_OK;
  }

  /* Merge AND terms. */
  /* TODO(shess) I think we can early-exit if( i>nNot && left.nData==0 ). */
  aTerm = pQuery->pTerms;
  for(i = 0; i<pQuery->nTerms; i=iNext){
    if( aTerm[i].isNot ){
      /* Handle all NOT terms in a separate pass */
      nNot++;
      iNext = i + aTerm[i].nPhrase+1;
      continue;
    }
    iNext = i + aTerm[i].nPhrase + 1;
    rc = docListOfTerm(v, aTerm[i].iColumn, &aTerm[i], &right);
    if( rc ){
      if( i!=nNot ) dataBufferDestroy(&left);
      queryClear(pQuery);
      return rc;
    }
    while( iNext<pQuery->nTerms && aTerm[iNext].isOr ){
      rc = docListOfTerm(v, aTerm[iNext].iColumn, &aTerm[iNext], &or);
      iNext += aTerm[iNext].nPhrase + 1;
      if( rc ){
        if( i!=nNot ) dataBufferDestroy(&left);
        dataBufferDestroy(&right);
        queryClear(pQuery);
        return rc;
      }
      dataBufferInit(&new, 0);
      docListOrMerge(right.pData, right.nData, or.pData, or.nData, &new);
      dataBufferDestroy(&right);
      dataBufferDestroy(&or);
      right = new;
    }
    if( i==nNot ){           /* first term processed. */
      left = right;
    }else{
      dataBufferInit(&new, 0);
      docListAndMerge(left.pData, left.nData, right.pData, right.nData, &new);
      dataBufferDestroy(&right);
      dataBufferDestroy(&left);
      left = new;
    }
  }

  if( nNot==pQuery->nTerms ){
    /* We do not yet know how to handle a query of only NOT terms */
    return SQLITE_ERROR;
  }

  /* Do the EXCEPT terms */
  for(i=0; i<pQuery->nTerms;  i += aTerm[i].nPhrase + 1){
    if( !aTerm[i].isNot ) continue;
    rc = docListOfTerm(v, aTerm[i].iColumn, &aTerm[i], &right);
    if( rc ){
      queryClear(pQuery);
      dataBufferDestroy(&left);
      return rc;
    }
    dataBufferInit(&new, 0);
    docListExceptMerge(left.pData, left.nData, right.pData, right.nData, &new);
    dataBufferDestroy(&right);
    dataBufferDestroy(&left);
    left = new;
  }

  *pResult = left;
  return rc;
}

/*
** This is the xFilter interface for the virtual table.  See
** the virtual table xFilter method documentation for additional
** information.
**
** If idxNum==QUERY_GENERIC then do a full table scan against
** the %_content table.
**
** If idxNum==QUERY_DOCID then do a docid lookup for a single entry
** in the %_content table.
**
** If idxNum>=QUERY_FULLTEXT then use the full text index.  The
** column on the left-hand side of the MATCH operator is column
** number idxNum-QUERY_FULLTEXT, 0 indexed.  argv[0] is the right-hand
** side of the MATCH operator.
*/
/* TODO(shess) Upgrade the cursor initialization and destruction to
** account for fulltextFilter() being called multiple times on the
** same cursor.  The current solution is very fragile.  Apply fix to
** fts3 as appropriate.
*/
static int fulltextFilter(
  sqlite3_vtab_cursor *pCursor,     /* The cursor used for this query */
  int idxNum, const char *idxStr,   /* Which indexing scheme to use */
  int argc, sqlite3_value **argv    /* Arguments for the indexing scheme */
){
  fulltext_cursor *c = (fulltext_cursor *) pCursor;
  fulltext_vtab *v = cursor_vtab(c);
  int rc;

  FTSTRACE(("FTS3 Filter %p\n",pCursor));

  /* If the cursor has a statement that was not prepared according to
  ** idxNum, clear it.  I believe all calls to fulltextFilter with a
  ** given cursor will have the same idxNum , but in this case it's
  ** easy to be safe.
  */
  if( c->pStmt && c->iCursorType!=idxNum ){
    sqlite3_finalize(c->pStmt);
    c->pStmt = NULL;
  }

  /* Get a fresh statement appropriate to idxNum. */
  /* TODO(shess): Add a prepared-statement cache in the vt structure.
  ** The cache must handle multiple open cursors.  Easier to cache the
  ** statement variants at the vt to reduce malloc/realloc/free here.
  ** Or we could have a StringBuffer variant which allowed stack
  ** construction for small values.
  */
  if( !c->pStmt ){
    StringBuffer sb;
    initStringBuffer(&sb);
    append(&sb, "SELECT docid, ");
    appendList(&sb, v->nColumn, v->azContentColumn);
    append(&sb, " FROM %_content");
    if( idxNum!=QUERY_GENERIC ) append(&sb, " WHERE docid = ?");
    rc = sql_prepare(v->db, v->zDb, v->zName, &c->pStmt,
                     stringBufferData(&sb));
    stringBufferDestroy(&sb);
    if( rc!=SQLITE_OK ) return rc;
    c->iCursorType = idxNum;
  }else{
    sqlite3_reset(c->pStmt);
    assert( c->iCursorType==idxNum );
  }

  switch( idxNum ){
    case QUERY_GENERIC:
      break;

    case QUERY_DOCID:
      rc = sqlite3_bind_int64(c->pStmt, 1, sqlite3_value_int64(argv[0]));
      if( rc!=SQLITE_OK ) return rc;
      break;

    default:   /* full-text search */
    {
      const char *zQuery = (const char *)sqlite3_value_text(argv[0]);
      assert( idxNum<=QUERY_FULLTEXT+v->nColumn);
      assert( argc==1 );
      queryClear(&c->q);
      if( c->result.nData!=0 ){
        /* This case happens if the same cursor is used repeatedly. */
        dlrDestroy(&c->reader);
        dataBufferReset(&c->result);
      }else{
        dataBufferInit(&c->result, 0);
      }
      rc = fulltextQuery(v, idxNum-QUERY_FULLTEXT, zQuery, -1, &c->result, &c->q);
      if( rc!=SQLITE_OK ) return rc;
      if( c->result.nData!=0 ){
        dlrInit(&c->reader, DL_DOCIDS, c->result.pData, c->result.nData);
      }
      break;
    }
  }

  return fulltextNext(pCursor);
}

/* This is the xEof method of the virtual table.  The SQLite core
** calls this routine to find out if it has reached the end of
** a query's results set.
*/
static int fulltextEof(sqlite3_vtab_cursor *pCursor){
  fulltext_cursor *c = (fulltext_cursor *) pCursor;
  return c->eof;
}

/* This is the xColumn method of the virtual table.  The SQLite
** core calls this method during a query when it needs the value
** of a column from the virtual table.  This method needs to use
** one of the sqlite3_result_*() routines to store the requested
** value back in the pContext.
*/
static int fulltextColumn(sqlite3_vtab_cursor *pCursor,
                          sqlite3_context *pContext, int idxCol){
  fulltext_cursor *c = (fulltext_cursor *) pCursor;
  fulltext_vtab *v = cursor_vtab(c);

  if( idxCol<v->nColumn ){
    sqlite3_value *pVal = sqlite3_column_value(c->pStmt, idxCol+1);
    sqlite3_result_value(pContext, pVal);
  }else if( idxCol==v->nColumn ){
    /* The extra column whose name is the same as the table.
    ** Return a blob which is a pointer to the cursor
    */
    sqlite3_result_blob(pContext, &c, sizeof(c), SQLITE_TRANSIENT);
  }else if( idxCol==v->nColumn+1 ){
    /* The docid column, which is an alias for rowid. */
    sqlite3_value *pVal = sqlite3_column_value(c->pStmt, 0);
    sqlite3_result_value(pContext, pVal);
  }
  return SQLITE_OK;
}

/* This is the xRowid method.  The SQLite core calls this routine to
** retrieve the rowid for the current row of the result set.  fts3
** exposes %_content.docid as the rowid for the virtual table.  The
** rowid should be written to *pRowid.
*/
static int fulltextRowid(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){
  fulltext_cursor *c = (fulltext_cursor *) pCursor;

  *pRowid = sqlite3_column_int64(c->pStmt, 0);
  return SQLITE_OK;
}

/* Add all terms in [zText] to pendingTerms table.  If [iColumn] > 0,
** we also store positions and offsets in the hash table using that
** column number.
*/
static int buildTerms(fulltext_vtab *v, sqlite_int64 iDocid,
                      const char *zText, int iColumn){
  sqlite3_tokenizer *pTokenizer = v->pTokenizer;
  sqlite3_tokenizer_cursor *pCursor;
  const char *pToken;
  int nTokenBytes;
  int iStartOffset, iEndOffset, iPosition;
  int rc;

  rc = pTokenizer->pModule->xOpen(pTokenizer, zText, -1, &pCursor);
  if( rc!=SQLITE_OK ) return rc;

  pCursor->pTokenizer = pTokenizer;
  while( SQLITE_OK==(rc=pTokenizer->pModule->xNext(pCursor,
                                                   &pToken, &nTokenBytes,
                                                   &iStartOffset, &iEndOffset,
                                                   &iPosition)) ){
    DLCollector *p;
    int nData;                   /* Size of doclist before our update. */

    /* Positions can't be negative; we use -1 as a terminator
     * internally.  Token can't be NULL or empty. */
    if( iPosition<0 || pToken == NULL || nTokenBytes == 0 ){
      rc = SQLITE_ERROR;
      break;
    }

    p = fts3HashFind(&v->pendingTerms, pToken, nTokenBytes);
    if( p==NULL ){
      nData = 0;
      p = dlcNew(iDocid, DL_DEFAULT);
      fts3HashInsert(&v->pendingTerms, pToken, nTokenBytes, p);

      /* Overhead for our hash table entry, the key, and the value. */
      v->nPendingData += sizeof(struct fts3HashElem)+sizeof(*p)+nTokenBytes;
    }else{
      nData = p->b.nData;
      if( p->dlw.iPrevDocid!=iDocid ) dlcNext(p, iDocid);
    }
    if( iColumn>=0 ){
      dlcAddPos(p, iColumn, iPosition, iStartOffset, iEndOffset);
    }

    /* Accumulate data added by dlcNew or dlcNext, and dlcAddPos. */
    v->nPendingData += p->b.nData-nData;
  }

  /* TODO(shess) Check return?  Should this be able to cause errors at
  ** this point?  Actually, same question about sqlite3_finalize(),
  ** though one could argue that failure there means that the data is
  ** not durable.  *ponder*
  */
  pTokenizer->pModule->xClose(pCursor);
  if( SQLITE_DONE == rc ) return SQLITE_OK;
  return rc;
}

/* Add doclists for all terms in [pValues] to pendingTerms table. */
static int insertTerms(fulltext_vtab *v, sqlite_int64 iDocid,
                       sqlite3_value **pValues){
  int i;
  for(i = 0; i < v->nColumn ; ++i){
    char *zText = (char*)sqlite3_value_text(pValues[i]);
    int rc = buildTerms(v, iDocid, zText, i);
    if( rc!=SQLITE_OK ) return rc;
  }
  return SQLITE_OK;
}

/* Add empty doclists for all terms in the given row's content to
** pendingTerms.
*/
static int deleteTerms(fulltext_vtab *v, sqlite_int64 iDocid){
  const char **pValues;
  int i, rc;

  /* TODO(shess) Should we allow such tables at all? */
  if( DL_DEFAULT==DL_DOCIDS ) return SQLITE_ERROR;

  rc = content_select(v, iDocid, &pValues);
  if( rc!=SQLITE_OK ) return rc;

  for(i = 0 ; i < v->nColumn; ++i) {
    rc = buildTerms(v, iDocid, pValues[i], -1);
    if( rc!=SQLITE_OK ) break;
  }

  freeStringArray(v->nColumn, pValues);
  return SQLITE_OK;
}

/* TODO(shess) Refactor the code to remove this forward decl. */
static int initPendingTerms(fulltext_vtab *v, sqlite_int64 iDocid);

/* Insert a row into the %_content table; set *piDocid to be the ID of the
** new row.  Add doclists for terms to pendingTerms.
*/
static int index_insert(fulltext_vtab *v, sqlite3_value *pRequestDocid,
                        sqlite3_value **pValues, sqlite_int64 *piDocid){
  int rc;

  rc = content_insert(v, pRequestDocid, pValues);  /* execute an SQL INSERT */
  if( rc!=SQLITE_OK ) return rc;

  /* docid column is an alias for rowid. */
  *piDocid = sqlite3_last_insert_rowid(v->db);
  rc = initPendingTerms(v, *piDocid);
  if( rc!=SQLITE_OK ) return rc;

  return insertTerms(v, *piDocid, pValues);
}

/* Delete a row from the %_content table; add empty doclists for terms
** to pendingTerms.
*/
static int index_delete(fulltext_vtab *v, sqlite_int64 iRow){
  int rc = initPendingTerms(v, iRow);
  if( rc!=SQLITE_OK ) return rc;

  rc = deleteTerms(v, iRow);
  if( rc!=SQLITE_OK ) return rc;

  return content_delete(v, iRow);  /* execute an SQL DELETE */
}

/* Update a row in the %_content table; add delete doclists to
** pendingTerms for old terms not in the new data, add insert doclists
** to pendingTerms for terms in the new data.
*/
static int index_update(fulltext_vtab *v, sqlite_int64 iRow,
                        sqlite3_value **pValues){
  int rc = initPendingTerms(v, iRow);
  if( rc!=SQLITE_OK ) return rc;

  /* Generate an empty doclist for each term that previously appeared in this
   * row. */
  rc = deleteTerms(v, iRow);
  if( rc!=SQLITE_OK ) return rc;

  rc = content_update(v, pValues, iRow);  /* execute an SQL UPDATE */
  if( rc!=SQLITE_OK ) return rc;

  /* Now add positions for terms which appear in the updated row. */
  return insertTerms(v, iRow, pValues);
}

/*******************************************************************/
/* InteriorWriter is used to collect terms and block references into
** interior nodes in %_segments.  See commentary at top of file for
** format.
*/

/* How large interior nodes can grow. */
#define INTERIOR_MAX 2048

/* Minimum number of terms per interior node (except the root). This
** prevents large terms from making the tree too skinny - must be >0
** so that the tree always makes progress.  Note that the min tree
** fanout will be INTERIOR_MIN_TERMS+1.
*/
#define INTERIOR_MIN_TERMS 7
#if INTERIOR_MIN_TERMS<1
# error INTERIOR_MIN_TERMS must be greater than 0.
#endif

/* ROOT_MAX controls how much data is stored inline in the segment
** directory.
*/
/* TODO(shess) Push ROOT_MAX down to whoever is writing things.  It's
** only here so that interiorWriterRootInfo() and leafWriterRootInfo()
** can both see it, but if the caller passed it in, we wouldn't even
** need a define.
*/
#define ROOT_MAX 1024
#if ROOT_MAX<VARINT_MAX*2
# error ROOT_MAX must have enough space for a header.
#endif

/* InteriorBlock stores a linked-list of interior blocks while a lower
** layer is being constructed.
*/
typedef struct InteriorBlock {
  DataBuffer term;           /* Leftmost term in block's subtree. */
  DataBuffer data;           /* Accumulated data for the block. */
  struct InteriorBlock *next;
} InteriorBlock;

static InteriorBlock *interiorBlockNew(int iHeight, sqlite_int64 iChildBlock,
                                       const char *pTerm, int nTerm){
  InteriorBlock *block = sqlite3_malloc(sizeof(InteriorBlock));
  char c[VARINT_MAX+VARINT_MAX];
  int n;

  if( block ){
    memset(block, 0, sizeof(*block));
    dataBufferInit(&block->term, 0);
    dataBufferReplace(&block->term, pTerm, nTerm);

    n = fts3PutVarint(c, iHeight);
    n += fts3PutVarint(c+n, iChildBlock);
    dataBufferInit(&block->data, INTERIOR_MAX);
    dataBufferReplace(&block->data, c, n);
  }
  return block;
}

#ifndef NDEBUG
/* Verify that the data is readable as an interior node. */
static void interiorBlockValidate(InteriorBlock *pBlock){
  const char *pData = pBlock->data.pData;
  int nData = pBlock->data.nData;
  int n, iDummy;
  sqlite_int64 iBlockid;

  assert( nData>0 );
  assert( pData!=0 );
  assert( pData+nData>pData );

  /* Must lead with height of node as a varint(n), n>0 */
  n = fts3GetVarint32(pData, &iDummy);
  assert( n>0 );
  assert( iDummy>0 );
  assert( n<nData );
  pData += n;
  nData -= n;

  /* Must contain iBlockid. */
  n = fts3GetVarint(pData, &iBlockid);
  assert( n>0 );
  assert( n<=nData );
  pData += n;
  nData -= n;

  /* Zero or more terms of positive length */
  if( nData!=0 ){
    /* First term is not delta-encoded. */
    n = fts3GetVarint32(pData, &iDummy);
    assert( n>0 );
    assert( iDummy>0 );
    assert( n+iDummy>0);
    assert( n+iDummy<=nData );
    pData += n+iDummy;
    nData -= n+iDummy;

    /* Following terms delta-encoded. */
    while( nData!=0 ){
      /* Length of shared prefix. */
      n = fts3GetVarint32(pData, &iDummy);
      assert( n>0 );
      assert( iDummy>=0 );
      assert( n<nData );
      pData += n;
      nData -= n;

      /* Length and data of distinct suffix. */
      n = fts3GetVarint32(pData, &iDummy);
      assert( n>0 );
      assert( iDummy>0 );
      assert( n+iDummy>0);
      assert( n+iDummy<=nData );
      pData += n+iDummy;
      nData -= n+iDummy;
    }
  }
}
#define ASSERT_VALID_INTERIOR_BLOCK(x) interiorBlockValidate(x)
#else
#define ASSERT_VALID_INTERIOR_BLOCK(x) assert( 1 )
#endif

typedef struct InteriorWriter {
  int iHeight;                   /* from 0 at leaves. */
  InteriorBlock *first, *last;
  struct InteriorWriter *parentWriter;

  DataBuffer term;               /* Last term written to block "last". */
  sqlite_int64 iOpeningChildBlock; /* First child block in block "last". */
#ifndef NDEBUG
  sqlite_int64 iLastChildBlock;  /* for consistency checks. */
#endif
} InteriorWriter;

/* Initialize an interior node where pTerm[nTerm] marks the leftmost
** term in the tree.  iChildBlock is the leftmost child block at the
** next level down the tree.
*/
static void interiorWriterInit(int iHeight, const char *pTerm, int nTerm,
                               sqlite_int64 iChildBlock,
                               InteriorWriter *pWriter){
  InteriorBlock *block;
  assert( iHeight>0 );
  CLEAR(pWriter);

  pWriter->iHeight = iHeight;
  pWriter->iOpeningChildBlock = iChildBlock;
#ifndef NDEBUG
  pWriter->iLastChildBlock = iChildBlock;
#endif
  block = interiorBlockNew(iHeight, iChildBlock, pTerm, nTerm);
  pWriter->last = pWriter->first = block;
  ASSERT_VALID_INTERIOR_BLOCK(pWriter->last);
  dataBufferInit(&pWriter->term, 0);
}

/* Append the child node rooted at iChildBlock to the interior node,
** with pTerm[nTerm] as the leftmost term in iChildBlock's subtree.
*/
static void interiorWriterAppend(InteriorWriter *pWriter,
                                 const char *pTerm, int nTerm,
                                 sqlite_int64 iChildBlock){
  char c[VARINT_MAX+VARINT_MAX];
  int n, nPrefix = 0;

  ASSERT_VALID_INTERIOR_BLOCK(pWriter->last);

  /* The first term written into an interior node is actually
  ** associated with the second child added (the first child was added
  ** in interiorWriterInit, or in the if clause at the bottom of this
  ** function).  That term gets encoded straight up, with nPrefix left
  ** at 0.
  */
  if( pWriter->term.nData==0 ){
    n = fts3PutVarint(c, nTerm);
  }else{
    while( nPrefix<pWriter->term.nData &&
           pTerm[nPrefix]==pWriter->term.pData[nPrefix] ){
      nPrefix++;
    }

    n = fts3PutVarint(c, nPrefix);
    n += fts3PutVarint(c+n, nTerm-nPrefix);
  }

#ifndef NDEBUG
  pWriter->iLastChildBlock++;
#endif
  assert( pWriter->iLastChildBlock==iChildBlock );

  /* Overflow to a new block if the new term makes the current block
  ** too big, and the current block already has enough terms.
  */
  if( pWriter->last->data.nData+n+nTerm-nPrefix>INTERIOR_MAX &&
      iChildBlock-pWriter->iOpeningChildBlock>INTERIOR_MIN_TERMS ){
    pWriter->last->next = interiorBlockNew(pWriter->iHeight, iChildBlock,
                                           pTerm, nTerm);
    pWriter->last = pWriter->last->next;
    pWriter->iOpeningChildBlock = iChildBlock;
    dataBufferReset(&pWriter->term);
  }else{
    dataBufferAppend2(&pWriter->last->data, c, n,
                      pTerm+nPrefix, nTerm-nPrefix);
    dataBufferReplace(&pWriter->term, pTerm, nTerm);
  }
  ASSERT_VALID_INTERIOR_BLOCK(pWriter->last);
}

/* Free the space used by pWriter, including the linked-list of
** InteriorBlocks, and parentWriter, if present.
*/
static int interiorWriterDestroy(InteriorWriter *pWriter){
  InteriorBlock *block = pWriter->first;

  while( block!=NULL ){
    InteriorBlock *b = block;
    block = block->next;
    dataBufferDestroy(&b->term);
    dataBufferDestroy(&b->data);
    sqlite3_free(b);
  }
  if( pWriter->parentWriter!=NULL ){
    interiorWriterDestroy(pWriter->parentWriter);
    sqlite3_free(pWriter->parentWriter);
  }
  dataBufferDestroy(&pWriter->term);
  SCRAMBLE(pWriter);
  return SQLITE_OK;
}

/* If pWriter can fit entirely in ROOT_MAX, return it as the root info
** directly, leaving *piEndBlockid unchanged.  Otherwise, flush
** pWriter to %_segments, building a new layer of interior nodes, and
** recursively ask for their root into.
*/
static int interiorWriterRootInfo(fulltext_vtab *v, InteriorWriter *pWriter,
                                  char **ppRootInfo, int *pnRootInfo,
                                  sqlite_int64 *piEndBlockid){
  InteriorBlock *block = pWriter->first;
  sqlite_int64 iBlockid = 0;
  int rc;

  /* If we can fit the segment inline */
  if( block==pWriter->last && block->data.nData<ROOT_MAX ){
    *ppRootInfo = block->data.pData;
    *pnRootInfo = block->data.nData;
    return SQLITE_OK;
  }

  /* Flush the first block to %_segments, and create a new level of
  ** interior node.
  */
  ASSERT_VALID_INTERIOR_BLOCK(block);
  rc = block_insert(v, block->data.pData, block->data.nData, &iBlockid);
  if( rc!=SQLITE_OK ) return rc;
  *piEndBlockid = iBlockid;

  pWriter->parentWriter = sqlite3_malloc(sizeof(*pWriter->parentWriter));
  interiorWriterInit(pWriter->iHeight+1,
                     block->term.pData, block->term.nData,
                     iBlockid, pWriter->parentWriter);

  /* Flush additional blocks and append to the higher interior
  ** node.
  */
  for(block=block->next; block!=NULL; block=block->next){
    ASSERT_VALID_INTERIOR_BLOCK(block);
    rc = block_insert(v, block->data.pData, block->data.nData, &iBlockid);
    if( rc!=SQLITE_OK ) return rc;
    *piEndBlockid = iBlockid;

    interiorWriterAppend(pWriter->parentWriter,
                         block->term.pData, block->term.nData, iBlockid);
  }

  /* Parent node gets the chance to be the root. */
  return interiorWriterRootInfo(v, pWriter->parentWriter,
                                ppRootInfo, pnRootInfo, piEndBlockid);
}

/****************************************************************/
/* InteriorReader is used to read off the data from an interior node
** (see comment at top of file for the format).
*/
typedef struct InteriorReader {
  const char *pData;
  int nData;

  DataBuffer term;          /* previous term, for decoding term delta. */

  sqlite_int64 iBlockid;
} InteriorReader;

static void interiorReaderDestroy(InteriorReader *pReader){
  dataBufferDestroy(&pReader->term);
  SCRAMBLE(pReader);
}

/* TODO(shess) The assertions are great, but what if we're in NDEBUG
** and the blob is empty or otherwise contains suspect data?
*/
static void interiorReaderInit(const char *pData, int nData,
                               InteriorReader *pReader){
  int n, nTerm;

  /* Require at least the leading flag byte */
  assert( nData>0 );
  assert( pData[0]!='\0' );

  CLEAR(pReader);

  /* Decode the base blockid, and set the cursor to the first term. */
  n = fts3GetVarint(pData+1, &pReader->iBlockid);
  assert( 1+n<=nData );
  pReader->pData = pData+1+n;
  pReader->nData = nData-(1+n);

  /* A single-child interior node (such as when a leaf node was too
  ** large for the segment directory) won't have any terms.
  ** Otherwise, decode the first term.
  */
  if( pReader->nData==0 ){
    dataBufferInit(&pReader->term, 0);
  }else{
    n = fts3GetVarint32(pReader->pData, &nTerm);
    dataBufferInit(&pReader->term, nTerm);
    dataBufferReplace(&pReader->term, pReader->pData+n, nTerm);
    assert( n+nTerm<=pReader->nData );
    pReader->pData += n+nTerm;
    pReader->nData -= n+nTerm;
  }
}

static int interiorReaderAtEnd(InteriorReader *pReader){
  return pReader->term.nData==0;
}

static sqlite_int64 interiorReaderCurrentBlockid(InteriorReader *pReader){
  return pReader->iBlockid;
}

static int interiorReaderTermBytes(InteriorReader *pReader){
  assert( !interiorReaderAtEnd(pReader) );
  return pReader->term.nData;
}
static const char *interiorReaderTerm(InteriorReader *pReader){
  assert( !interiorReaderAtEnd(pReader) );
  return pReader->term.pData;
}

/* Step forward to the next term in the node. */
static void interiorReaderStep(InteriorReader *pReader){
  assert( !interiorReaderAtEnd(pReader) );

  /* If the last term has been read, signal eof, else construct the
  ** next term.
  */
  if( pReader->nData==0 ){
    dataBufferReset(&pReader->term);
  }else{
    int n, nPrefix, nSuffix;

    n = fts3GetVarint32(pReader->pData, &nPrefix);
    n += fts3GetVarint32(pReader->pData+n, &nSuffix);

    /* Truncate the current term and append suffix data. */
    pReader->term.nData = nPrefix;
    dataBufferAppend(&pReader->term, pReader->pData+n, nSuffix);

    assert( n+nSuffix<=pReader->nData );
    pReader->pData += n+nSuffix;
    pReader->nData -= n+nSuffix;
  }
  pReader->iBlockid++;
}

/* Compare the current term to pTerm[nTerm], returning strcmp-style
** results.  If isPrefix, equality means equal through nTerm bytes.
*/
static int interiorReaderTermCmp(InteriorReader *pReader,
                                 const char *pTerm, int nTerm, int isPrefix){
  const char *pReaderTerm = interiorReaderTerm(pReader);
  int nReaderTerm = interiorReaderTermBytes(pReader);
  int c, n = nReaderTerm<nTerm ? nReaderTerm : nTerm;

  if( n==0 ){
    if( nReaderTerm>0 ) return -1;
    if( nTerm>0 ) return 1;
    return 0;
  }

  c = memcmp(pReaderTerm, pTerm, n);
  if( c!=0 ) return c;
  if( isPrefix && n==nTerm ) return 0;
  return nReaderTerm - nTerm;
}

/****************************************************************/
/* LeafWriter is used to collect terms and associated doclist data
** into leaf blocks in %_segments (see top of file for format info).
** Expected usage is:
**
** LeafWriter writer;
** leafWriterInit(0, 0, &writer);
** while( sorted_terms_left_to_process ){
**   // data is doclist data for that term.
**   rc = leafWriterStep(v, &writer, pTerm, nTerm, pData, nData);
**   if( rc!=SQLITE_OK ) goto err;
** }
** rc = leafWriterFinalize(v, &writer);
**err:
** leafWriterDestroy(&writer);
** return rc;
**
** leafWriterStep() may write a collected leaf out to %_segments.
** leafWriterFinalize() finishes writing any buffered data and stores
** a root node in %_segdir.  leafWriterDestroy() frees all buffers and
** InteriorWriters allocated as part of writing this segment.
**
** TODO(shess) Document leafWriterStepMerge().
*/

/* Put terms with data this big in their own block. */
#define STANDALONE_MIN 1024

/* Keep leaf blocks below this size. */
#define LEAF_MAX 2048

typedef struct LeafWriter {
  int iLevel;
  int idx;
  sqlite_int64 iStartBlockid;     /* needed to create the root info */
  sqlite_int64 iEndBlockid;       /* when we're done writing. */

  DataBuffer term;                /* previous encoded term */
  DataBuffer data;                /* encoding buffer */

  /* bytes of first term in the current node which distinguishes that
  ** term from the last term of the previous node.
  */
  int nTermDistinct;

  InteriorWriter parentWriter;    /* if we overflow */
  int has_parent;
} LeafWriter;

static void leafWriterInit(int iLevel, int idx, LeafWriter *pWriter){
  CLEAR(pWriter);
  pWriter->iLevel = iLevel;
  pWriter->idx = idx;

  dataBufferInit(&pWriter->term, 32);

  /* Start out with a reasonably sized block, though it can grow. */
  dataBufferInit(&pWriter->data, LEAF_MAX);
}

#ifndef NDEBUG
/* Verify that the data is readable as a leaf node. */
static void leafNodeValidate(const char *pData, int nData){
  int n, iDummy;

  if( nData==0 ) return;
  assert( nData>0 );
  assert( pData!=0 );
  assert( pData+nData>pData );

  /* Must lead with a varint(0) */
  n = fts3GetVarint32(pData, &iDummy);
  assert( iDummy==0 );
  assert( n>0 );
  assert( n<nData );
  pData += n;
  nData -= n;

  /* Leading term length and data must fit in buffer. */
  n = fts3GetVarint32(pData, &iDummy);
  assert( n>0 );
  assert( iDummy>0 );
  assert( n+iDummy>0 );
  assert( n+iDummy<nData );
  pData += n+iDummy;
  nData -= n+iDummy;

  /* Leading term's doclist length and data must fit. */
  n = fts3GetVarint32(pData, &iDummy);
  assert( n>0 );
  assert( iDummy>0 );
  assert( n+iDummy>0 );
  assert( n+iDummy<=nData );
  ASSERT_VALID_DOCLIST(DL_DEFAULT, pData+n, iDummy, NULL);
  pData += n+iDummy;
  nData -= n+iDummy;

  /* Verify that trailing terms and doclists also are readable. */
  while( nData!=0 ){
    n = fts3GetVarint32(pData, &iDummy);
    assert( n>0 );
    assert( iDummy>=0 );
    assert( n<nData );
    pData += n;
    nData -= n;
    n = fts3GetVarint32(pData, &iDummy);
    assert( n>0 );
    assert( iDummy>0 );
    assert( n+iDummy>0 );
    assert( n+iDummy<nData );
    pData += n+iDummy;
    nData -= n+iDummy;

    n = fts3GetVarint32(pData, &iDummy);
    assert( n>0 );
    assert( iDummy>0 );
    assert( n+iDummy>0 );
    assert( n+iDummy<=nData );
    ASSERT_VALID_DOCLIST(DL_DEFAULT, pData+n, iDummy, NULL);
    pData += n+iDummy;
    nData -= n+iDummy;
  }
}
#define ASSERT_VALID_LEAF_NODE(p, n) leafNodeValidate(p, n)
#else
#define ASSERT_VALID_LEAF_NODE(p, n) assert( 1 )
#endif

/* Flush the current leaf node to %_segments, and adding the resulting
** blockid and the starting term to the interior node which will
** contain it.
*/
static int leafWriterInternalFlush(fulltext_vtab *v, LeafWriter *pWriter,
                                   int iData, int nData){
  sqlite_int64 iBlockid = 0;
  const char *pStartingTerm;
  int nStartingTerm, rc, n;

  /* Must have the leading varint(0) flag, plus at least some
  ** valid-looking data.
  */
  assert( nData>2 );
  assert( iData>=0 );
  assert( iData+nData<=pWriter->data.nData );
  ASSERT_VALID_LEAF_NODE(pWriter->data.pData+iData, nData);

  rc = block_insert(v, pWriter->data.pData+iData, nData, &iBlockid);
  if( rc!=SQLITE_OK ) return rc;
  assert( iBlockid!=0 );

  /* Reconstruct the first term in the leaf for purposes of building
  ** the interior node.
  */
  n = fts3GetVarint32(pWriter->data.pData+iData+1, &nStartingTerm);
  pStartingTerm = pWriter->data.pData+iData+1+n;
  assert( pWriter->data.nData>iData+1+n+nStartingTerm );
  assert( pWriter->nTermDistinct>0 );
  assert( pWriter->nTermDistinct<=nStartingTerm );
  nStartingTerm = pWriter->nTermDistinct;

  if( pWriter->has_parent ){
    interiorWriterAppend(&pWriter->parentWriter,
                         pStartingTerm, nStartingTerm, iBlockid);
  }else{
    interiorWriterInit(1, pStartingTerm, nStartingTerm, iBlockid,
                       &pWriter->parentWriter);
    pWriter->has_parent = 1;
  }

  /* Track the span of this segment's leaf nodes. */
  if( pWriter->iEndBlockid==0 ){
    pWriter->iEndBlockid = pWriter->iStartBlockid = iBlockid;
  }else{
    pWriter->iEndBlockid++;
    assert( iBlockid==pWriter->iEndBlockid );
  }

  return SQLITE_OK;
}
static int leafWriterFlush(fulltext_vtab *v, LeafWriter *pWriter){
  int rc = leafWriterInternalFlush(v, pWriter, 0, pWriter->data.nData);
  if( rc!=SQLITE_OK ) return rc;

  /* Re-initialize the output buffer. */
  dataBufferReset(&pWriter->data);

  return SQLITE_OK;
}

/* Fetch the root info for the segment.  If the entire leaf fits
** within ROOT_MAX, then it will be returned directly, otherwise it
** will be flushed and the root info will be returned from the
** interior node.  *piEndBlockid is set to the blockid of the last
** interior or leaf node written to disk (0 if none are written at
** all).
*/
static int leafWriterRootInfo(fulltext_vtab *v, LeafWriter *pWriter,
                              char **ppRootInfo, int *pnRootInfo,
                              sqlite_int64 *piEndBlockid){
  /* we can fit the segment entirely inline */
  if( !pWriter->has_parent && pWriter->data.nData<ROOT_MAX ){
    *ppRootInfo = pWriter->data.pData;
    *pnRootInfo = pWriter->data.nData;
    *piEndBlockid = 0;
    return SQLITE_OK;
  }

  /* Flush remaining leaf data. */
  if( pWriter->data.nData>0 ){
    int rc = leafWriterFlush(v, pWriter);
    if( rc!=SQLITE_OK ) return rc;
  }

  /* We must have flushed a leaf at some point. */
  assert( pWriter->has_parent );

  /* Tenatively set the end leaf blockid as the end blockid.  If the
  ** interior node can be returned inline, this will be the final
  ** blockid, otherwise it will be overwritten by
  ** interiorWriterRootInfo().
  */
  *piEndBlockid = pWriter->iEndBlockid;

  return interiorWriterRootInfo(v, &pWriter->parentWriter,
                                ppRootInfo, pnRootInfo, piEndBlockid);
}

/* Collect the rootInfo data and store it into the segment directory.
** This has the effect of flushing the segment's leaf data to
** %_segments, and also flushing any interior nodes to %_segments.
*/
static int leafWriterFinalize(fulltext_vtab *v, LeafWriter *pWriter){
  sqlite_int64 iEndBlockid;
  char *pRootInfo;
  int rc, nRootInfo;

  rc = leafWriterRootInfo(v, pWriter, &pRootInfo, &nRootInfo, &iEndBlockid);
  if( rc!=SQLITE_OK ) return rc;

  /* Don't bother storing an entirely empty segment. */
  if( iEndBlockid==0 && nRootInfo==0 ) return SQLITE_OK;

  return segdir_set(v, pWriter->iLevel, pWriter->idx,
                    pWriter->iStartBlockid, pWriter->iEndBlockid,
                    iEndBlockid, pRootInfo, nRootInfo);
}

static void leafWriterDestroy(LeafWriter *pWriter){
  if( pWriter->has_parent ) interiorWriterDestroy(&pWriter->parentWriter);
  dataBufferDestroy(&pWriter->term);
  dataBufferDestroy(&pWriter->data);
}

/* Encode a term into the leafWriter, delta-encoding as appropriate.
** Returns the length of the new term which distinguishes it from the
** previous term, which can be used to set nTermDistinct when a node
** boundary is crossed.
*/
static int leafWriterEncodeTerm(LeafWriter *pWriter,
                                const char *pTerm, int nTerm){
  char c[VARINT_MAX+VARINT_MAX];
  int n, nPrefix = 0;

  assert( nTerm>0 );
  while( nPrefix<pWriter->term.nData &&
         pTerm[nPrefix]==pWriter->term.pData[nPrefix] ){
    nPrefix++;
    /* Failing this implies that the terms weren't in order. */
    assert( nPrefix<nTerm );
  }

  if( pWriter->data.nData==0 ){
    /* Encode the node header and leading term as:
    **  varint(0)
    **  varint(nTerm)
    **  char pTerm[nTerm]
    */
    n = fts3PutVarint(c, '\0');
    n += fts3PutVarint(c+n, nTerm);
    dataBufferAppend2(&pWriter->data, c, n, pTerm, nTerm);
  }else{
    /* Delta-encode the term as:
    **  varint(nPrefix)
    **  varint(nSuffix)
    **  char pTermSuffix[nSuffix]
    */
    n = fts3PutVarint(c, nPrefix);
    n += fts3PutVarint(c+n, nTerm-nPrefix);
    dataBufferAppend2(&pWriter->data, c, n, pTerm+nPrefix, nTerm-nPrefix);
  }
  dataBufferReplace(&pWriter->term, pTerm, nTerm);

  return nPrefix+1;
}

/* Used to avoid a memmove when a large amount of doclist data is in
** the buffer.  This constructs a node and term header before
** iDoclistData and flushes the resulting complete node using
** leafWriterInternalFlush().
*/
static int leafWriterInlineFlush(fulltext_vtab *v, LeafWriter *pWriter,
                                 const char *pTerm, int nTerm,
                                 int iDoclistData){
  char c[VARINT_MAX+VARINT_MAX];
  int iData, n = fts3PutVarint(c, 0);
  n += fts3PutVarint(c+n, nTerm);

  /* There should always be room for the header.  Even if pTerm shared
  ** a substantial prefix with the previous term, the entire prefix
  ** could be constructed from earlier data in the doclist, so there
  ** should be room.
  */
  assert( iDoclistData>=n+nTerm );

  iData = iDoclistData-(n+nTerm);
  memcpy(pWriter->data.pData+iData, c, n);
  memcpy(pWriter->data.pData+iData+n, pTerm, nTerm);

  return leafWriterInternalFlush(v, pWriter, iData, pWriter->data.nData-iData);
}

/* Push pTerm[nTerm] along with the doclist data to the leaf layer of
** %_segments.
*/
static int leafWriterStepMerge(fulltext_vtab *v, LeafWriter *pWriter,
                               const char *pTerm, int nTerm,
                               DLReader *pReaders, int nReaders){
  char c[VARINT_MAX+VARINT_MAX];
  int iTermData = pWriter->data.nData, iDoclistData;
  int i, nData, n, nActualData, nActual, rc, nTermDistinct;

  ASSERT_VALID_LEAF_NODE(pWriter->data.pData, pWriter->data.nData);
  nTermDistinct = leafWriterEncodeTerm(pWriter, pTerm, nTerm);

  /* Remember nTermDistinct if opening a new node. */
  if( iTermData==0 ) pWriter->nTermDistinct = nTermDistinct;

  iDoclistData = pWriter->data.nData;

  /* Estimate the length of the merged doclist so we can leave space
  ** to encode it.
  */
  for(i=0, nData=0; i<nReaders; i++){
    nData += dlrAllDataBytes(&pReaders[i]);
  }
  n = fts3PutVarint(c, nData);
  dataBufferAppend(&pWriter->data, c, n);

  docListMerge(&pWriter->data, pReaders, nReaders);
  ASSERT_VALID_DOCLIST(DL_DEFAULT,
                       pWriter->data.pData+iDoclistData+n,
                       pWriter->data.nData-iDoclistData-n, NULL);

  /* The actual amount of doclist data at this point could be smaller
  ** than the length we encoded.  Additionally, the space required to
  ** encode this length could be smaller.  For small doclists, this is
  ** not a big deal, we can just use memmove() to adjust things.
  */
  nActualData = pWriter->data.nData-(iDoclistData+n);
  nActual = fts3PutVarint(c, nActualData);
  assert( nActualData<=nData );
  assert( nActual<=n );

  /* If the new doclist is big enough for force a standalone leaf
  ** node, we can immediately flush it inline without doing the
  ** memmove().
  */
  /* TODO(shess) This test matches leafWriterStep(), which does this
  ** test before it knows the cost to varint-encode the term and
  ** doclist lengths.  At some point, change to
  ** pWriter->data.nData-iTermData>STANDALONE_MIN.
  */
  if( nTerm+nActualData>STANDALONE_MIN ){
    /* Push leaf node from before this term. */
    if( iTermData>0 ){
      rc = leafWriterInternalFlush(v, pWriter, 0, iTermData);
      if( rc!=SQLITE_OK ) return rc;

      pWriter->nTermDistinct = nTermDistinct;
    }

    /* Fix the encoded doclist length. */
    iDoclistData += n - nActual;
    memcpy(pWriter->data.pData+iDoclistData, c, nActual);

    /* Push the standalone leaf node. */
    rc = leafWriterInlineFlush(v, pWriter, pTerm, nTerm, iDoclistData);
    if( rc!=SQLITE_OK ) return rc;

    /* Leave the node empty. */
    dataBufferReset(&pWriter->data);

    return rc;
  }

  /* At this point, we know that the doclist was small, so do the
  ** memmove if indicated.
  */
  if( nActual<n ){
    memmove(pWriter->data.pData+iDoclistData+nActual,
            pWriter->data.pData+iDoclistData+n,
            pWriter->data.nData-(iDoclistData+n));
    pWriter->data.nData -= n-nActual;
  }

  /* Replace written length with actual length. */
  memcpy(pWriter->data.pData+iDoclistData, c, nActual);

  /* If the node is too large, break things up. */
  /* TODO(shess) This test matches leafWriterStep(), which does this
  ** test before it knows the cost to varint-encode the term and
  ** doclist lengths.  At some point, change to
  ** pWriter->data.nData>LEAF_MAX.
  */
  if( iTermData+nTerm+nActualData>LEAF_MAX ){
    /* Flush out the leading data as a node */
    rc = leafWriterInternalFlush(v, pWriter, 0, iTermData);
    if( rc!=SQLITE_OK ) return rc;

    pWriter->nTermDistinct = nTermDistinct;

    /* Rebuild header using the current term */
    n = fts3PutVarint(pWriter->data.pData, 0);
    n += fts3PutVarint(pWriter->data.pData+n, nTerm);
    memcpy(pWriter->data.pData+n, pTerm, nTerm);
    n += nTerm;

    /* There should always be room, because the previous encoding
    ** included all data necessary to construct the term.
    */
    assert( n<iDoclistData );
    /* So long as STANDALONE_MIN is half or less of LEAF_MAX, the
    ** following memcpy() is safe (as opposed to needing a memmove).
    */
    assert( 2*STANDALONE_MIN<=LEAF_MAX );
    assert( n+pWriter->data.nData-iDoclistData<iDoclistData );
    memcpy(pWriter->data.pData+n,
           pWriter->data.pData+iDoclistData,
           pWriter->data.nData-iDoclistData);
    pWriter->data.nData -= iDoclistData-n;
  }
  ASSERT_VALID_LEAF_NODE(pWriter->data.pData, pWriter->data.nData);

  return SQLITE_OK;
}

/* Push pTerm[nTerm] along with the doclist data to the leaf layer of
** %_segments.
*/
/* TODO(shess) Revise writeZeroSegment() so that doclists are
** constructed directly in pWriter->data.
*/
static int leafWriterStep(fulltext_vtab *v, LeafWriter *pWriter,
                          const char *pTerm, int nTerm,
                          const char *pData, int nData){
  int rc;
  DLReader reader;

  dlrInit(&reader, DL_DEFAULT, pData, nData);
  rc = leafWriterStepMerge(v, pWriter, pTerm, nTerm, &reader, 1);
  dlrDestroy(&reader);

  return rc;
}


/****************************************************************/
/* LeafReader is used to iterate over an individual leaf node. */
typedef struct LeafReader {
  DataBuffer term;          /* copy of current term. */

  const char *pData;        /* data for current term. */
  int nData;
} LeafReader;

static void leafReaderDestroy(LeafReader *pReader){
  dataBufferDestroy(&pReader->term);
  SCRAMBLE(pReader);
}

static int leafReaderAtEnd(LeafReader *pReader){
  return pReader->nData<=0;
}

/* Access the current term. */
static int leafReaderTermBytes(LeafReader *pReader){
  return pReader->term.nData;
}
static const char *leafReaderTerm(LeafReader *pReader){
  assert( pReader->term.nData>0 );
  return pReader->term.pData;
}

/* Access the doclist data for the current term. */
static int leafReaderDataBytes(LeafReader *pReader){
  int nData;
  assert( pReader->term.nData>0 );
  fts3GetVarint32(pReader->pData, &nData);
  return nData;
}
static const char *leafReaderData(LeafReader *pReader){
  int n, nData;
  assert( pReader->term.nData>0 );
  n = fts3GetVarint32(pReader->pData, &nData);
  return pReader->pData+n;
}

static void leafReaderInit(const char *pData, int nData,
                           LeafReader *pReader){
  int nTerm, n;

  assert( nData>0 );
  assert( pData[0]=='\0' );

  CLEAR(pReader);

  /* Read the first term, skipping the header byte. */
  n = fts3GetVarint32(pData+1, &nTerm);
  dataBufferInit(&pReader->term, nTerm);
  dataBufferReplace(&pReader->term, pData+1+n, nTerm);

  /* Position after the first term. */
  assert( 1+n+nTerm<nData );
  pReader->pData = pData+1+n+nTerm;
  pReader->nData = nData-1-n-nTerm;
}

/* Step the reader forward to the next term. */
static void leafReaderStep(LeafReader *pReader){
  int n, nData, nPrefix, nSuffix;
  assert( !leafReaderAtEnd(pReader) );

  /* Skip previous entry's data block. */
  n = fts3GetVarint32(pReader->pData, &nData);
  assert( n+nData<=pReader->nData );
  pReader->pData += n+nData;
  pReader->nData -= n+nData;

  if( !leafReaderAtEnd(pReader) ){
    /* Construct the new term using a prefix from the old term plus a
    ** suffix from the leaf data.
    */
    n = fts3GetVarint32(pReader->pData, &nPrefix);
    n += fts3GetVarint32(pReader->pData+n, &nSuffix);
    assert( n+nSuffix<pReader->nData );
    pReader->term.nData = nPrefix;
    dataBufferAppend(&pReader->term, pReader->pData+n, nSuffix);

    pReader->pData += n+nSuffix;
    pReader->nData -= n+nSuffix;
  }
}

/* strcmp-style comparison of pReader's current term against pTerm.
** If isPrefix, equality means equal through nTerm bytes.
*/
static int leafReaderTermCmp(LeafReader *pReader,
                             const char *pTerm, int nTerm, int isPrefix){
  int c, n = pReader->term.nData<nTerm ? pReader->term.nData : nTerm;
  if( n==0 ){
    if( pReader->term.nData>0 ) return -1;
    if(nTerm>0 ) return 1;
    return 0;
  }

  c = memcmp(pReader->term.pData, pTerm, n);
  if( c!=0 ) return c;
  if( isPrefix && n==nTerm ) return 0;
  return pReader->term.nData - nTerm;
}


/****************************************************************/
/* LeavesReader wraps LeafReader to allow iterating over the entire
** leaf layer of the tree.
*/
typedef struct LeavesReader {
  int idx;                  /* Index within the segment. */

  sqlite3_stmt *pStmt;      /* Statement we're streaming leaves from. */
  int eof;                  /* we've seen SQLITE_DONE from pStmt. */

  LeafReader leafReader;    /* reader for the current leaf. */
  DataBuffer rootData;      /* root data for inline. */
} LeavesReader;

/* Access the current term. */
static int leavesReaderTermBytes(LeavesReader *pReader){
  assert( !pReader->eof );
  return leafReaderTermBytes(&pReader->leafReader);
}
static const char *leavesReaderTerm(LeavesReader *pReader){
  assert( !pReader->eof );
  return leafReaderTerm(&pReader->leafReader);
}

/* Access the doclist data for the current term. */
static int leavesReaderDataBytes(LeavesReader *pReader){
  assert( !pReader->eof );
  return leafReaderDataBytes(&pReader->leafReader);
}
static const char *leavesReaderData(LeavesReader *pReader){
  assert( !pReader->eof );
  return leafReaderData(&pReader->leafReader);
}

static int leavesReaderAtEnd(LeavesReader *pReader){
  return pReader->eof;
}

/* loadSegmentLeaves() may not read all the way to SQLITE_DONE, thus
** leaving the statement handle open, which locks the table.
*/
/* TODO(shess) This "solution" is not satisfactory.  Really, there
** should be check-in function for all statement handles which
** arranges to call sqlite3_reset().  This most likely will require
** modification to control flow all over the place, though, so for now
** just punt.
**
** Note the the current system assumes that segment merges will run to
** completion, which is why this particular probably hasn't arisen in
** this case.  Probably a brittle assumption.
*/
static int leavesReaderReset(LeavesReader *pReader){
  return sqlite3_reset(pReader->pStmt);
}

static void leavesReaderDestroy(LeavesReader *pReader){
  /* If idx is -1, that means we're using a non-cached statement
  ** handle in the optimize() case, so we need to release it.
  */
  if( pReader->pStmt!=NULL && pReader->idx==-1 ){
    sqlite3_finalize(pReader->pStmt);
  }
  leafReaderDestroy(&pReader->leafReader);
  dataBufferDestroy(&pReader->rootData);
  SCRAMBLE(pReader);
}

/* Initialize pReader with the given root data (if iStartBlockid==0
** the leaf data was entirely contained in the root), or from the
** stream of blocks between iStartBlockid and iEndBlockid, inclusive.
*/
static int leavesReaderInit(fulltext_vtab *v,
                            int idx,
                            sqlite_int64 iStartBlockid,
                            sqlite_int64 iEndBlockid,
                            const char *pRootData, int nRootData,
                            LeavesReader *pReader){
  CLEAR(pReader);
  pReader->idx = idx;

  dataBufferInit(&pReader->rootData, 0);
  if( iStartBlockid==0 ){
    /* Entire leaf level fit in root data. */
    dataBufferReplace(&pReader->rootData, pRootData, nRootData);
    leafReaderInit(pReader->rootData.pData, pReader->rootData.nData,
                   &pReader->leafReader);
  }else{
    sqlite3_stmt *s;
    int rc = sql_get_leaf_statement(v, idx, &s);
    if( rc!=SQLITE_OK ) return rc;

    rc = sqlite3_bind_int64(s, 1, iStartBlockid);
    if( rc!=SQLITE_OK ) return rc;

    rc = sqlite3_bind_int64(s, 2, iEndBlockid);
    if( rc!=SQLITE_OK ) return rc;

    rc = sqlite3_step(s);
    if( rc==SQLITE_DONE ){
      pReader->eof = 1;
      return SQLITE_OK;
    }
    if( rc!=SQLITE_ROW ) return rc;

    pReader->pStmt = s;
    leafReaderInit(sqlite3_column_blob(pReader->pStmt, 0),
                   sqlite3_column_bytes(pReader->pStmt, 0),
                   &pReader->leafReader);
  }
  return SQLITE_OK;
}

/* Step the current leaf forward to the next term.  If we reach the
** end of the current leaf, step forward to the next leaf block.
*/
static int leavesReaderStep(fulltext_vtab *v, LeavesReader *pReader){
  assert( !leavesReaderAtEnd(pReader) );
  leafReaderStep(&pReader->leafReader);

  if( leafReaderAtEnd(&pReader->leafReader) ){
    int rc;
    if( pReader->rootData.pData ){
      pReader->eof = 1;
      return SQLITE_OK;
    }
    rc = sqlite3_step(pReader->pStmt);
    if( rc!=SQLITE_ROW ){
      pReader->eof = 1;
      return rc==SQLITE_DONE ? SQLITE_OK : rc;
    }
    leafReaderDestroy(&pReader->leafReader);
    leafReaderInit(sqlite3_column_blob(pReader->pStmt, 0),
                   sqlite3_column_bytes(pReader->pStmt, 0),
                   &pReader->leafReader);
  }
  return SQLITE_OK;
}

/* Order LeavesReaders by their term, ignoring idx.  Readers at eof
** always sort to the end.
*/
static int leavesReaderTermCmp(LeavesReader *lr1, LeavesReader *lr2){
  if( leavesReaderAtEnd(lr1) ){
    if( leavesReaderAtEnd(lr2) ) return 0;
    return 1;
  }
  if( leavesReaderAtEnd(lr2) ) return -1;

  return leafReaderTermCmp(&lr1->leafReader,
                           leavesReaderTerm(lr2), leavesReaderTermBytes(lr2),
                           0);
}

/* Similar to leavesReaderTermCmp(), with additional ordering by idx
** so that older segments sort before newer segments.
*/
static int leavesReaderCmp(LeavesReader *lr1, LeavesReader *lr2){
  int c = leavesReaderTermCmp(lr1, lr2);
  if( c!=0 ) return c;
  return lr1->idx-lr2->idx;
}

/* Assume that pLr[1]..pLr[nLr] are sorted.  Bubble pLr[0] into its
** sorted position.
*/
static void leavesReaderReorder(LeavesReader *pLr, int nLr){
  while( nLr>1 && leavesReaderCmp(pLr, pLr+1)>0 ){
    LeavesReader tmp = pLr[0];
    pLr[0] = pLr[1];
    pLr[1] = tmp;
    nLr--;
    pLr++;
  }
}

/* Initializes pReaders with the segments from level iLevel, returning
** the number of segments in *piReaders.  Leaves pReaders in sorted
** order.
*/
static int leavesReadersInit(fulltext_vtab *v, int iLevel,
                             LeavesReader *pReaders, int *piReaders){
  sqlite3_stmt *s;
  int i, rc = sql_get_statement(v, SEGDIR_SELECT_LEVEL_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int(s, 1, iLevel);
  if( rc!=SQLITE_OK ) return rc;

  i = 0;
  while( (rc = sqlite3_step(s))==SQLITE_ROW ){
    sqlite_int64 iStart = sqlite3_column_int64(s, 0);
    sqlite_int64 iEnd = sqlite3_column_int64(s, 1);
    const char *pRootData = sqlite3_column_blob(s, 2);
    int nRootData = sqlite3_column_bytes(s, 2);

    assert( i<MERGE_COUNT );
    rc = leavesReaderInit(v, i, iStart, iEnd, pRootData, nRootData,
                          &pReaders[i]);
    if( rc!=SQLITE_OK ) break;

    i++;
  }
  if( rc!=SQLITE_DONE ){
    while( i-->0 ){
      leavesReaderDestroy(&pReaders[i]);
    }
    return rc;
  }

  *piReaders = i;

  /* Leave our results sorted by term, then age. */
  while( i-- ){
    leavesReaderReorder(pReaders+i, *piReaders-i);
  }
  return SQLITE_OK;
}

/* Merge doclists from pReaders[nReaders] into a single doclist, which
** is written to pWriter.  Assumes pReaders is ordered oldest to
** newest.
*/
/* TODO(shess) Consider putting this inline in segmentMerge(). */
static int leavesReadersMerge(fulltext_vtab *v,
                              LeavesReader *pReaders, int nReaders,
                              LeafWriter *pWriter){
  DLReader dlReaders[MERGE_COUNT];
  const char *pTerm = leavesReaderTerm(pReaders);
  int i, nTerm = leavesReaderTermBytes(pReaders);

  assert( nReaders<=MERGE_COUNT );

  for(i=0; i<nReaders; i++){
    dlrInit(&dlReaders[i], DL_DEFAULT,
            leavesReaderData(pReaders+i),
            leavesReaderDataBytes(pReaders+i));
  }

  return leafWriterStepMerge(v, pWriter, pTerm, nTerm, dlReaders, nReaders);
}

/* Forward ref due to mutual recursion with segdirNextIndex(). */
static int segmentMerge(fulltext_vtab *v, int iLevel);

/* Put the next available index at iLevel into *pidx.  If iLevel
** already has MERGE_COUNT segments, they are merged to a higher
** level to make room.
*/
static int segdirNextIndex(fulltext_vtab *v, int iLevel, int *pidx){
  int rc = segdir_max_index(v, iLevel, pidx);
  if( rc==SQLITE_DONE ){              /* No segments at iLevel. */
    *pidx = 0;
  }else if( rc==SQLITE_ROW ){
    if( *pidx==(MERGE_COUNT-1) ){
      rc = segmentMerge(v, iLevel);
      if( rc!=SQLITE_OK ) return rc;
      *pidx = 0;
    }else{
      (*pidx)++;
    }
  }else{
    return rc;
  }
  return SQLITE_OK;
}

/* Merge MERGE_COUNT segments at iLevel into a new segment at
** iLevel+1.  If iLevel+1 is already full of segments, those will be
** merged to make room.
*/
static int segmentMerge(fulltext_vtab *v, int iLevel){
  LeafWriter writer;
  LeavesReader lrs[MERGE_COUNT];
  int i, rc, idx = 0;

  /* Determine the next available segment index at the next level,
  ** merging as necessary.
  */
  rc = segdirNextIndex(v, iLevel+1, &idx);
  if( rc!=SQLITE_OK ) return rc;

  /* TODO(shess) This assumes that we'll always see exactly
  ** MERGE_COUNT segments to merge at a given level.  That will be
  ** broken if we allow the developer to request preemptive or
  ** deferred merging.
  */
  memset(&lrs, '\0', sizeof(lrs));
  rc = leavesReadersInit(v, iLevel, lrs, &i);
  if( rc!=SQLITE_OK ) return rc;
  assert( i==MERGE_COUNT );

  leafWriterInit(iLevel+1, idx, &writer);

  /* Since leavesReaderReorder() pushes readers at eof to the end,
  ** when the first reader is empty, all will be empty.
  */
  while( !leavesReaderAtEnd(lrs) ){
    /* Figure out how many readers share their next term. */
    for(i=1; i<MERGE_COUNT && !leavesReaderAtEnd(lrs+i); i++){
      if( 0!=leavesReaderTermCmp(lrs, lrs+i) ) break;
    }

    rc = leavesReadersMerge(v, lrs, i, &writer);
    if( rc!=SQLITE_OK ) goto err;

    /* Step forward those that were merged. */
    while( i-->0 ){
      rc = leavesReaderStep(v, lrs+i);
      if( rc!=SQLITE_OK ) goto err;

      /* Reorder by term, then by age. */
      leavesReaderReorder(lrs+i, MERGE_COUNT-i);
    }
  }

  for(i=0; i<MERGE_COUNT; i++){
    leavesReaderDestroy(&lrs[i]);
  }

  rc = leafWriterFinalize(v, &writer);
  leafWriterDestroy(&writer);
  if( rc!=SQLITE_OK ) return rc;

  /* Delete the merged segment data. */
  return segdir_delete(v, iLevel);

 err:
  for(i=0; i<MERGE_COUNT; i++){
    leavesReaderDestroy(&lrs[i]);
  }
  leafWriterDestroy(&writer);
  return rc;
}

/* Accumulate the union of *acc and *pData into *acc. */
static void docListAccumulateUnion(DataBuffer *acc,
                                   const char *pData, int nData) {
  DataBuffer tmp = *acc;
  dataBufferInit(acc, tmp.nData+nData);
  docListUnion(tmp.pData, tmp.nData, pData, nData, acc);
  dataBufferDestroy(&tmp);
}

/* TODO(shess) It might be interesting to explore different merge
** strategies, here.  For instance, since this is a sorted merge, we
** could easily merge many doclists in parallel.  With some
** comprehension of the storage format, we could merge all of the
** doclists within a leaf node directly from the leaf node's storage.
** It may be worthwhile to merge smaller doclists before larger
** doclists, since they can be traversed more quickly - but the
** results may have less overlap, making them more expensive in a
** different way.
*/

/* Scan pReader for pTerm/nTerm, and merge the term's doclist over
** *out (any doclists with duplicate docids overwrite those in *out).
** Internal function for loadSegmentLeaf().
*/
static int loadSegmentLeavesInt(fulltext_vtab *v, LeavesReader *pReader,
                                const char *pTerm, int nTerm, int isPrefix,
                                DataBuffer *out){
  /* doclist data is accumulated into pBuffers similar to how one does
  ** increment in binary arithmetic.  If index 0 is empty, the data is
  ** stored there.  If there is data there, it is merged and the
  ** results carried into position 1, with further merge-and-carry
  ** until an empty position is found.
  */
  DataBuffer *pBuffers = NULL;
  int nBuffers = 0, nMaxBuffers = 0, rc;

  assert( nTerm>0 );

  for(rc=SQLITE_OK; rc==SQLITE_OK && !leavesReaderAtEnd(pReader);
      rc=leavesReaderStep(v, pReader)){
    /* TODO(shess) Really want leavesReaderTermCmp(), but that name is
    ** already taken to compare the terms of two LeavesReaders.  Think
    ** on a better name.  [Meanwhile, break encapsulation rather than
    ** use a confusing name.]
    */
    int c = leafReaderTermCmp(&pReader->leafReader, pTerm, nTerm, isPrefix);
    if( c>0 ) break;      /* Past any possible matches. */
    if( c==0 ){
      const char *pData = leavesReaderData(pReader);
      int iBuffer, nData = leavesReaderDataBytes(pReader);

      /* Find the first empty buffer. */
      for(iBuffer=0; iBuffer<nBuffers; ++iBuffer){
        if( 0==pBuffers[iBuffer].nData ) break;
      }

      /* Out of buffers, add an empty one. */
      if( iBuffer==nBuffers ){
        if( nBuffers==nMaxBuffers ){
          DataBuffer *p;
          nMaxBuffers += 20;

          /* Manual realloc so we can handle NULL appropriately. */
          p = sqlite3_malloc(nMaxBuffers*sizeof(*pBuffers));
          if( p==NULL ){
            rc = SQLITE_NOMEM;
            break;
          }

          if( nBuffers>0 ){
            assert(pBuffers!=NULL);
            memcpy(p, pBuffers, nBuffers*sizeof(*pBuffers));
            sqlite3_free(pBuffers);
          }
          pBuffers = p;
        }
        dataBufferInit(&(pBuffers[nBuffers]), 0);
        nBuffers++;
      }

      /* At this point, must have an empty at iBuffer. */
      assert(iBuffer<nBuffers && pBuffers[iBuffer].nData==0);

      /* If empty was first buffer, no need for merge logic. */
      if( iBuffer==0 ){
        dataBufferReplace(&(pBuffers[0]), pData, nData);
      }else{
        /* pAcc is the empty buffer the merged data will end up in. */
        DataBuffer *pAcc = &(pBuffers[iBuffer]);
        DataBuffer *p = &(pBuffers[0]);

        /* Handle position 0 specially to avoid need to prime pAcc
        ** with pData/nData.
        */
        dataBufferSwap(p, pAcc);
        docListAccumulateUnion(pAcc, pData, nData);

        /* Accumulate remaining doclists into pAcc. */
        for(++p; p<pAcc; ++p){
          docListAccumulateUnion(pAcc, p->pData, p->nData);

          /* dataBufferReset() could allow a large doclist to blow up
          ** our memory requirements.
          */
          if( p->nCapacity<1024 ){
            dataBufferReset(p);
          }else{
            dataBufferDestroy(p);
            dataBufferInit(p, 0);
          }
        }
      }
    }
  }

  /* Union all the doclists together into *out. */
  /* TODO(shess) What if *out is big?  Sigh. */
  if( rc==SQLITE_OK && nBuffers>0 ){
    int iBuffer;
    for(iBuffer=0; iBuffer<nBuffers; ++iBuffer){
      if( pBuffers[iBuffer].nData>0 ){
        if( out->nData==0 ){
          dataBufferSwap(out, &(pBuffers[iBuffer]));
        }else{
          docListAccumulateUnion(out, pBuffers[iBuffer].pData,
                                 pBuffers[iBuffer].nData);
        }
      }
    }
  }

  while( nBuffers-- ){
    dataBufferDestroy(&(pBuffers[nBuffers]));
  }
  if( pBuffers!=NULL ) sqlite3_free(pBuffers);

  return rc;
}

/* Call loadSegmentLeavesInt() with pData/nData as input. */
static int loadSegmentLeaf(fulltext_vtab *v, const char *pData, int nData,
                           const char *pTerm, int nTerm, int isPrefix,
                           DataBuffer *out){
  LeavesReader reader;
  int rc;

  assert( nData>1 );
  assert( *pData=='\0' );
  rc = leavesReaderInit(v, 0, 0, 0, pData, nData, &reader);
  if( rc!=SQLITE_OK ) return rc;

  rc = loadSegmentLeavesInt(v, &reader, pTerm, nTerm, isPrefix, out);
  leavesReaderReset(&reader);
  leavesReaderDestroy(&reader);
  return rc;
}

/* Call loadSegmentLeavesInt() with the leaf nodes from iStartLeaf to
** iEndLeaf (inclusive) as input, and merge the resulting doclist into
** out.
*/
static int loadSegmentLeaves(fulltext_vtab *v,
                             sqlite_int64 iStartLeaf, sqlite_int64 iEndLeaf,
                             const char *pTerm, int nTerm, int isPrefix,
                             DataBuffer *out){
  int rc;
  LeavesReader reader;

  assert( iStartLeaf<=iEndLeaf );
  rc = leavesReaderInit(v, 0, iStartLeaf, iEndLeaf, NULL, 0, &reader);
  if( rc!=SQLITE_OK ) return rc;

  rc = loadSegmentLeavesInt(v, &reader, pTerm, nTerm, isPrefix, out);
  leavesReaderReset(&reader);
  leavesReaderDestroy(&reader);
  return rc;
}

/* Taking pData/nData as an interior node, find the sequence of child
** nodes which could include pTerm/nTerm/isPrefix.  Note that the
** interior node terms logically come between the blocks, so there is
** one more blockid than there are terms (that block contains terms >=
** the last interior-node term).
*/
/* TODO(shess) The calling code may already know that the end child is
** not worth calculating, because the end may be in a later sibling
** node.  Consider whether breaking symmetry is worthwhile.  I suspect
** it is not worthwhile.
*/
static void getChildrenContaining(const char *pData, int nData,
                                  const char *pTerm, int nTerm, int isPrefix,
                                  sqlite_int64 *piStartChild,
                                  sqlite_int64 *piEndChild){
  InteriorReader reader;

  assert( nData>1 );
  assert( *pData!='\0' );
  interiorReaderInit(pData, nData, &reader);

  /* Scan for the first child which could contain pTerm/nTerm. */
  while( !interiorReaderAtEnd(&reader) ){
    if( interiorReaderTermCmp(&reader, pTerm, nTerm, 0)>0 ) break;
    interiorReaderStep(&reader);
  }
  *piStartChild = interiorReaderCurrentBlockid(&reader);

  /* Keep scanning to find a term greater than our term, using prefix
  ** comparison if indicated.  If isPrefix is false, this will be the
  ** same blockid as the starting block.
  */
  while( !interiorReaderAtEnd(&reader) ){
    if( interiorReaderTermCmp(&reader, pTerm, nTerm, isPrefix)>0 ) break;
    interiorReaderStep(&reader);
  }
  *piEndChild = interiorReaderCurrentBlockid(&reader);

  interiorReaderDestroy(&reader);

  /* Children must ascend, and if !prefix, both must be the same. */
  assert( *piEndChild>=*piStartChild );
  assert( isPrefix || *piStartChild==*piEndChild );
}

/* Read block at iBlockid and pass it with other params to
** getChildrenContaining().
*/
static int loadAndGetChildrenContaining(
  fulltext_vtab *v,
  sqlite_int64 iBlockid,
  const char *pTerm, int nTerm, int isPrefix,
  sqlite_int64 *piStartChild, sqlite_int64 *piEndChild
){
  sqlite3_stmt *s = NULL;
  int rc;

  assert( iBlockid!=0 );
  assert( pTerm!=NULL );
  assert( nTerm!=0 );        /* TODO(shess) Why not allow this? */
  assert( piStartChild!=NULL );
  assert( piEndChild!=NULL );

  rc = sql_get_statement(v, BLOCK_SELECT_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_bind_int64(s, 1, iBlockid);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3_step(s);
  if( rc==SQLITE_DONE ) return SQLITE_ERROR;
  if( rc!=SQLITE_ROW ) return rc;

  getChildrenContaining(sqlite3_column_blob(s, 0), sqlite3_column_bytes(s, 0),
                        pTerm, nTerm, isPrefix, piStartChild, piEndChild);

  /* We expect only one row.  We must execute another sqlite3_step()
   * to complete the iteration; otherwise the table will remain
   * locked. */
  rc = sqlite3_step(s);
  if( rc==SQLITE_ROW ) return SQLITE_ERROR;
  if( rc!=SQLITE_DONE ) return rc;

  return SQLITE_OK;
}

/* Traverse the tree represented by pData[nData] looking for
** pTerm[nTerm], placing its doclist into *out.  This is internal to
** loadSegment() to make error-handling cleaner.
*/
static int loadSegmentInt(fulltext_vtab *v, const char *pData, int nData,
                          sqlite_int64 iLeavesEnd,
                          const char *pTerm, int nTerm, int isPrefix,
                          DataBuffer *out){
  /* Special case where root is a leaf. */
  if( *pData=='\0' ){
    return loadSegmentLeaf(v, pData, nData, pTerm, nTerm, isPrefix, out);
  }else{
    int rc;
    sqlite_int64 iStartChild, iEndChild;

    /* Process pData as an interior node, then loop down the tree
    ** until we find the set of leaf nodes to scan for the term.
    */
    getChildrenContaining(pData, nData, pTerm, nTerm, isPrefix,
                          &iStartChild, &iEndChild);
    while( iStartChild>iLeavesEnd ){
      sqlite_int64 iNextStart, iNextEnd;
      rc = loadAndGetChildrenContaining(v, iStartChild, pTerm, nTerm, isPrefix,
                                        &iNextStart, &iNextEnd);
      if( rc!=SQLITE_OK ) return rc;

      /* If we've branched, follow the end branch, too. */
      if( iStartChild!=iEndChild ){
        sqlite_int64 iDummy;
        rc = loadAndGetChildrenContaining(v, iEndChild, pTerm, nTerm, isPrefix,
                                          &iDummy, &iNextEnd);
        if( rc!=SQLITE_OK ) return rc;
      }

      assert( iNextStart<=iNextEnd );
      iStartChild = iNextStart;
      iEndChild = iNextEnd;
    }
    assert( iStartChild<=iLeavesEnd );
    assert( iEndChild<=iLeavesEnd );

    /* Scan through the leaf segments for doclists. */
    return loadSegmentLeaves(v, iStartChild, iEndChild,
                             pTerm, nTerm, isPrefix, out);
  }
}

/* Call loadSegmentInt() to collect the doclist for pTerm/nTerm, then
** merge its doclist over *out (any duplicate doclists read from the
** segment rooted at pData will overwrite those in *out).
*/
/* TODO(shess) Consider changing this to determine the depth of the
** leaves using either the first characters of interior nodes (when
** ==1, we're one level above the leaves), or the first character of
** the root (which will describe the height of the tree directly).
** Either feels somewhat tricky to me.
*/
/* TODO(shess) The current merge is likely to be slow for large
** doclists (though it should process from newest/smallest to
** oldest/largest, so it may not be that bad).  It might be useful to
** modify things to allow for N-way merging.  This could either be
** within a segment, with pairwise merges across segments, or across
** all segments at once.
*/
static int loadSegment(fulltext_vtab *v, const char *pData, int nData,
                       sqlite_int64 iLeavesEnd,
                       const char *pTerm, int nTerm, int isPrefix,
                       DataBuffer *out){
  DataBuffer result;
  int rc;

  assert( nData>1 );

  /* This code should never be called with buffered updates. */
  assert( v->nPendingData<0 );

  dataBufferInit(&result, 0);
  rc = loadSegmentInt(v, pData, nData, iLeavesEnd,
                      pTerm, nTerm, isPrefix, &result);
  if( rc==SQLITE_OK && result.nData>0 ){
    if( out->nData==0 ){
      DataBuffer tmp = *out;
      *out = result;
      result = tmp;
    }else{
      DataBuffer merged;
      DLReader readers[2];

      dlrInit(&readers[0], DL_DEFAULT, out->pData, out->nData);
      dlrInit(&readers[1], DL_DEFAULT, result.pData, result.nData);
      dataBufferInit(&merged, out->nData+result.nData);
      docListMerge(&merged, readers, 2);
      dataBufferDestroy(out);
      *out = merged;
      dlrDestroy(&readers[0]);
      dlrDestroy(&readers[1]);
    }
  }
  dataBufferDestroy(&result);
  return rc;
}

/* Scan the database and merge together the posting lists for the term
** into *out.
*/
static int termSelect(fulltext_vtab *v, int iColumn,
                      const char *pTerm, int nTerm, int isPrefix,
                      DocListType iType, DataBuffer *out){
  DataBuffer doclist;
  sqlite3_stmt *s;
  int rc = sql_get_statement(v, SEGDIR_SELECT_ALL_STMT, &s);
  if( rc!=SQLITE_OK ) return rc;

  /* This code should never be called with buffered updates. */
  assert( v->nPendingData<0 );

  dataBufferInit(&doclist, 0);

  /* Traverse the segments from oldest to newest so that newer doclist
  ** elements for given docids overwrite older elements.
  */
  while( (rc = sqlite3_step(s))==SQLITE_ROW ){
    const char *pData = sqlite3_column_blob(s, 2);
    const int nData = sqlite3_column_bytes(s, 2);
    const sqlite_int64 iLeavesEnd = sqlite3_column_int64(s, 1);
    rc = loadSegment(v, pData, nData, iLeavesEnd, pTerm, nTerm, isPrefix,
                     &doclist);
    if( rc!=SQLITE_OK ) goto err;
  }
  if( rc==SQLITE_DONE ){
    if( doclist.nData!=0 ){
      /* TODO(shess) The old term_select_all() code applied the column
      ** restrict as we merged segments, leading to smaller buffers.
      ** This is probably worthwhile to bring back, once the new storage
      ** system is checked in.
      */
      if( iColumn==v->nColumn) iColumn = -1;
      docListTrim(DL_DEFAULT, doclist.pData, doclist.nData,
                  iColumn, iType, out);
    }
    rc = SQLITE_OK;
  }

 err:
  dataBufferDestroy(&doclist);
  return rc;
}

/****************************************************************/
/* Used to hold hashtable data for sorting. */
typedef struct TermData {
  const char *pTerm;
  int nTerm;
  DLCollector *pCollector;
} TermData;

/* Orders TermData elements in strcmp fashion ( <0 for less-than, 0
** for equal, >0 for greater-than).
*/
static int termDataCmp(const void *av, const void *bv){
  const TermData *a = (const TermData *)av;
  const TermData *b = (const TermData *)bv;
  int n = a->nTerm<b->nTerm ? a->nTerm : b->nTerm;
  int c = memcmp(a->pTerm, b->pTerm, n);
  if( c!=0 ) return c;
  return a->nTerm-b->nTerm;
}

/* Order pTerms data by term, then write a new level 0 segment using
** LeafWriter.
*/
static int writeZeroSegment(fulltext_vtab *v, fts3Hash *pTerms){
  fts3HashElem *e;
  int idx, rc, i, n;
  TermData *pData;
  LeafWriter writer;
  DataBuffer dl;

  /* Determine the next index at level 0, merging as necessary. */
  rc = segdirNextIndex(v, 0, &idx);
  if( rc!=SQLITE_OK ) return rc;

  n = fts3HashCount(pTerms);
  pData = sqlite3_malloc(n*sizeof(TermData));

  for(i = 0, e = fts3HashFirst(pTerms); e; i++, e = fts3HashNext(e)){
    assert( i<n );
    pData[i].pTerm = fts3HashKey(e);
    pData[i].nTerm = fts3HashKeysize(e);
    pData[i].pCollector = fts3HashData(e);
  }
  assert( i==n );

  /* TODO(shess) Should we allow user-defined collation sequences,
  ** here?  I think we only need that once we support prefix searches.
  */
  if( n>1 ) qsort(pData, n, sizeof(*pData), termDataCmp);

  /* TODO(shess) Refactor so that we can write directly to the segment
  ** DataBuffer, as happens for segment merges.
  */
  leafWriterInit(0, idx, &writer);
  dataBufferInit(&dl, 0);
  for(i=0; i<n; i++){
    dataBufferReset(&dl);
    dlcAddDoclist(pData[i].pCollector, &dl);
    rc = leafWriterStep(v, &writer,
                        pData[i].pTerm, pData[i].nTerm, dl.pData, dl.nData);
    if( rc!=SQLITE_OK ) goto err;
  }
  rc = leafWriterFinalize(v, &writer);

 err:
  dataBufferDestroy(&dl);
  sqlite3_free(pData);
  leafWriterDestroy(&writer);
  return rc;
}

/* If pendingTerms has data, free it. */
static int clearPendingTerms(fulltext_vtab *v){
  if( v->nPendingData>=0 ){
    fts3HashElem *e;
    for(e=fts3HashFirst(&v->pendingTerms); e; e=fts3HashNext(e)){
      dlcDelete(fts3HashData(e));
    }
    fts3HashClear(&v->pendingTerms);
    v->nPendingData = -1;
  }
  return SQLITE_OK;
}

/* If pendingTerms has data, flush it to a level-zero segment, and
** free it.
*/
static int flushPendingTerms(fulltext_vtab *v){
  if( v->nPendingData>=0 ){
    int rc = writeZeroSegment(v, &v->pendingTerms);
    if( rc==SQLITE_OK ) clearPendingTerms(v);
    return rc;
  }
  return SQLITE_OK;
}

/* If pendingTerms is "too big", or docid is out of order, flush it.
** Regardless, be certain that pendingTerms is initialized for use.
*/
static int initPendingTerms(fulltext_vtab *v, sqlite_int64 iDocid){
  /* TODO(shess) Explore whether partially flushing the buffer on
  ** forced-flush would provide better performance.  I suspect that if
  ** we ordered the doclists by size and flushed the largest until the
  ** buffer was half empty, that would let the less frequent terms
  ** generate longer doclists.
  */
  if( iDocid<=v->iPrevDocid || v->nPendingData>kPendingThreshold ){
    int rc = flushPendingTerms(v);
    if( rc!=SQLITE_OK ) return rc;
  }
  if( v->nPendingData<0 ){
    fts3HashInit(&v->pendingTerms, FTS3_HASH_STRING, 1);
    v->nPendingData = 0;
  }
  v->iPrevDocid = iDocid;
  return SQLITE_OK;
}

/* This function implements the xUpdate callback; it is the top-level entry
 * point for inserting, deleting or updating a row in a full-text table. */
static int fulltextUpdate(sqlite3_vtab *pVtab, int nArg, sqlite3_value **ppArg,
                          sqlite_int64 *pRowid){
  fulltext_vtab *v = (fulltext_vtab *) pVtab;
  int rc;

  FTSTRACE(("FTS3 Update %p\n", pVtab));

  if( nArg<2 ){
    rc = index_delete(v, sqlite3_value_int64(ppArg[0]));
    if( rc==SQLITE_OK ){
      /* If we just deleted the last row in the table, clear out the
      ** index data.
      */
      rc = content_exists(v);
      if( rc==SQLITE_ROW ){
        rc = SQLITE_OK;
      }else if( rc==SQLITE_DONE ){
        /* Clear the pending terms so we don't flush a useless level-0
        ** segment when the transaction closes.
        */
        rc = clearPendingTerms(v);
        if( rc==SQLITE_OK ){
          rc = segdir_delete_all(v);
        }
      }
    }
  } else if( sqlite3_value_type(ppArg[0]) != SQLITE_NULL ){
    /* An update:
     * ppArg[0] = old rowid
     * ppArg[1] = new rowid
     * ppArg[2..2+v->nColumn-1] = values
     * ppArg[2+v->nColumn] = value for magic column (we ignore this)
     * ppArg[2+v->nColumn+1] = value for docid
     */
    sqlite_int64 rowid = sqlite3_value_int64(ppArg[0]);
    if( sqlite3_value_type(ppArg[1]) != SQLITE_INTEGER ||
        sqlite3_value_int64(ppArg[1]) != rowid ){
      rc = SQLITE_ERROR;  /* we don't allow changing the rowid */
    }else if( sqlite3_value_type(ppArg[2+v->nColumn+1]) != SQLITE_INTEGER ||
              sqlite3_value_int64(ppArg[2+v->nColumn+1]) != rowid ){
      rc = SQLITE_ERROR;  /* we don't allow changing the docid */
    }else{
      assert( nArg==2+v->nColumn+2);
      rc = index_update(v, rowid, &ppArg[2]);
    }
  } else {
    /* An insert:
     * ppArg[1] = requested rowid
     * ppArg[2..2+v->nColumn-1] = values
     * ppArg[2+v->nColumn] = value for magic column (we ignore this)
     * ppArg[2+v->nColumn+1] = value for docid
     */
    sqlite3_value *pRequestDocid = ppArg[2+v->nColumn+1];
    assert( nArg==2+v->nColumn+2);
    if( SQLITE_NULL != sqlite3_value_type(pRequestDocid) &&
        SQLITE_NULL != sqlite3_value_type(ppArg[1]) ){
      /* TODO(shess) Consider allowing this to work if the values are
      ** identical.  I'm inclined to discourage that usage, though,
      ** given that both rowid and docid are special columns.  Better
      ** would be to define one or the other as the default winner,
      ** but should it be fts3-centric (docid) or SQLite-centric
      ** (rowid)?
      */
      rc = SQLITE_ERROR;
    }else{
      if( SQLITE_NULL == sqlite3_value_type(pRequestDocid) ){
        pRequestDocid = ppArg[1];
      }
      rc = index_insert(v, pRequestDocid, &ppArg[2], pRowid);
    }
  }

  return rc;
}

static int fulltextSync(sqlite3_vtab *pVtab){
  FTSTRACE(("FTS3 xSync()\n"));
  return flushPendingTerms((fulltext_vtab *)pVtab);
}

static int fulltextBegin(sqlite3_vtab *pVtab){
  fulltext_vtab *v = (fulltext_vtab *) pVtab;
  FTSTRACE(("FTS3 xBegin()\n"));

  /* Any buffered updates should have been cleared by the previous
  ** transaction.
  */
  assert( v->nPendingData<0 );
  return clearPendingTerms(v);
}

static int fulltextCommit(sqlite3_vtab *pVtab){
  fulltext_vtab *v = (fulltext_vtab *) pVtab;
  FTSTRACE(("FTS3 xCommit()\n"));

  /* Buffered updates should have been cleared by fulltextSync(). */
  assert( v->nPendingData<0 );
  return clearPendingTerms(v);
}

static int fulltextRollback(sqlite3_vtab *pVtab){
  FTSTRACE(("FTS3 xRollback()\n"));
  return clearPendingTerms((fulltext_vtab *)pVtab);
}

/*
** Implementation of the snippet() function for FTS3
*/
static void snippetFunc(
  sqlite3_context *pContext,
  int argc,
  sqlite3_value **argv
){
  fulltext_cursor *pCursor;
  if( argc<1 ) return;
  if( sqlite3_value_type(argv[0])!=SQLITE_BLOB ||
      sqlite3_value_bytes(argv[0])!=sizeof(pCursor) ){
    sqlite3_result_error(pContext, "illegal first argument to html_snippet",-1);
  }else{
    const char *zStart = "<b>";
    const char *zEnd = "</b>";
    const char *zEllipsis = "<b>...</b>";
    memcpy(&pCursor, sqlite3_value_blob(argv[0]), sizeof(pCursor));
    if( argc>=2 ){
      zStart = (const char*)sqlite3_value_text(argv[1]);
      if( argc>=3 ){
        zEnd = (const char*)sqlite3_value_text(argv[2]);
        if( argc>=4 ){
          zEllipsis = (const char*)sqlite3_value_text(argv[3]);
        }
      }
    }
    snippetAllOffsets(pCursor);
    snippetText(pCursor, zStart, zEnd, zEllipsis);
    sqlite3_result_text(pContext, pCursor->snippet.zSnippet,
                        pCursor->snippet.nSnippet, SQLITE_STATIC);
  }
}

/*
** Implementation of the offsets() function for FTS3
*/
static void snippetOffsetsFunc(
  sqlite3_context *pContext,
  int argc,
  sqlite3_value **argv
){
  fulltext_cursor *pCursor;
  if( argc<1 ) return;
  if( sqlite3_value_type(argv[0])!=SQLITE_BLOB ||
      sqlite3_value_bytes(argv[0])!=sizeof(pCursor) ){
    sqlite3_result_error(pContext, "illegal first argument to offsets",-1);
  }else{
    memcpy(&pCursor, sqlite3_value_blob(argv[0]), sizeof(pCursor));
    snippetAllOffsets(pCursor);
    snippetOffsetText(&pCursor->snippet);
    sqlite3_result_text(pContext,
                        pCursor->snippet.zOffset, pCursor->snippet.nOffset,
                        SQLITE_STATIC);
  }
}

/* OptLeavesReader is nearly identical to LeavesReader, except that
** where LeavesReader is geared towards the merging of complete
** segment levels (with exactly MERGE_COUNT segments), OptLeavesReader
** is geared towards implementation of the optimize() function, and
** can merge all segments simultaneously.  This version may be
** somewhat less efficient than LeavesReader because it merges into an
** accumulator rather than doing an N-way merge, but since segment
** size grows exponentially (so segment count logrithmically) this is
** probably not an immediate problem.
*/
/* TODO(shess): Prove that assertion, or extend the merge code to
** merge tree fashion (like the prefix-searching code does).
*/
/* TODO(shess): OptLeavesReader and LeavesReader could probably be
** merged with little or no loss of performance for LeavesReader.  The
** merged code would need to handle >MERGE_COUNT segments, and would
** also need to be able to optionally optimize away deletes.
*/
typedef struct OptLeavesReader {
  /* Segment number, to order readers by age. */
  int segment;
  LeavesReader reader;
} OptLeavesReader;

static int optLeavesReaderAtEnd(OptLeavesReader *pReader){
  return leavesReaderAtEnd(&pReader->reader);
}
static int optLeavesReaderTermBytes(OptLeavesReader *pReader){
  return leavesReaderTermBytes(&pReader->reader);
}
static const char *optLeavesReaderData(OptLeavesReader *pReader){
  return leavesReaderData(&pReader->reader);
}
static int optLeavesReaderDataBytes(OptLeavesReader *pReader){
  return leavesReaderDataBytes(&pReader->reader);
}
static const char *optLeavesReaderTerm(OptLeavesReader *pReader){
  return leavesReaderTerm(&pReader->reader);
}
static int optLeavesReaderStep(fulltext_vtab *v, OptLeavesReader *pReader){
  return leavesReaderStep(v, &pReader->reader);
}
static int optLeavesReaderTermCmp(OptLeavesReader *lr1, OptLeavesReader *lr2){
  return leavesReaderTermCmp(&lr1->reader, &lr2->reader);
}
/* Order by term ascending, segment ascending (oldest to newest), with
** exhausted readers to the end.
*/
static int optLeavesReaderCmp(OptLeavesReader *lr1, OptLeavesReader *lr2){
  int c = optLeavesReaderTermCmp(lr1, lr2);
  if( c!=0 ) return c;
  return lr1->segment-lr2->segment;
}
/* Bubble pLr[0] to appropriate place in pLr[1..nLr-1].  Assumes that
** pLr[1..nLr-1] is already sorted.
*/
static void optLeavesReaderReorder(OptLeavesReader *pLr, int nLr){
  while( nLr>1 && optLeavesReaderCmp(pLr, pLr+1)>0 ){
    OptLeavesReader tmp = pLr[0];
    pLr[0] = pLr[1];
    pLr[1] = tmp;
    nLr--;
    pLr++;
  }
}

/* optimize() helper function.  Put the readers in order and iterate
** through them, merging doclists for matching terms into pWriter.
** Returns SQLITE_OK on success, or the SQLite error code which
** prevented success.
*/
static int optimizeInternal(fulltext_vtab *v,
                            OptLeavesReader *readers, int nReaders,
                            LeafWriter *pWriter){
  int i, rc = SQLITE_OK;
  DataBuffer doclist, merged, tmp;

  /* Order the readers. */
  i = nReaders;
  while( i-- > 0 ){
    optLeavesReaderReorder(&readers[i], nReaders-i);
  }

  dataBufferInit(&doclist, LEAF_MAX);
  dataBufferInit(&merged, LEAF_MAX);

  /* Exhausted readers bubble to the end, so when the first reader is
  ** at eof, all are at eof.
  */
  while( !optLeavesReaderAtEnd(&readers[0]) ){

    /* Figure out how many readers share the next term. */
    for(i=1; i<nReaders && !optLeavesReaderAtEnd(&readers[i]); i++){
      if( 0!=optLeavesReaderTermCmp(&readers[0], &readers[i]) ) break;
    }

    /* Special-case for no merge. */
    if( i==1 ){
      /* Trim deletions from the doclist. */
      dataBufferReset(&merged);
      docListTrim(DL_DEFAULT,
                  optLeavesReaderData(&readers[0]),
                  optLeavesReaderDataBytes(&readers[0]),
                  -1, DL_DEFAULT, &merged);
    }else{
      DLReader dlReaders[MERGE_COUNT];
      int iReader, nReaders;

      /* Prime the pipeline with the first reader's doclist.  After
      ** one pass index 0 will reference the accumulated doclist.
      */
      dlrInit(&dlReaders[0], DL_DEFAULT,
              optLeavesReaderData(&readers[0]),
              optLeavesReaderDataBytes(&readers[0]));
      iReader = 1;

      assert( iReader<i );  /* Must execute the loop at least once. */
      while( iReader<i ){
        /* Merge 16 inputs per pass. */
        for( nReaders=1; iReader<i && nReaders<MERGE_COUNT;
             iReader++, nReaders++ ){
          dlrInit(&dlReaders[nReaders], DL_DEFAULT,
                  optLeavesReaderData(&readers[iReader]),
                  optLeavesReaderDataBytes(&readers[iReader]));
        }

        /* Merge doclists and swap result into accumulator. */
        dataBufferReset(&merged);
        docListMerge(&merged, dlReaders, nReaders);
        tmp = merged;
        merged = doclist;
        doclist = tmp;

        while( nReaders-- > 0 ){
          dlrDestroy(&dlReaders[nReaders]);
        }

        /* Accumulated doclist to reader 0 for next pass. */
        dlrInit(&dlReaders[0], DL_DEFAULT, doclist.pData, doclist.nData);
      }

      /* Destroy reader that was left in the pipeline. */
      dlrDestroy(&dlReaders[0]);

      /* Trim deletions from the doclist. */
      dataBufferReset(&merged);
      docListTrim(DL_DEFAULT, doclist.pData, doclist.nData,
                  -1, DL_DEFAULT, &merged);
    }

    /* Only pass doclists with hits (skip if all hits deleted). */
    if( merged.nData>0 ){
      rc = leafWriterStep(v, pWriter,
                          optLeavesReaderTerm(&readers[0]),
                          optLeavesReaderTermBytes(&readers[0]),
                          merged.pData, merged.nData);
      if( rc!=SQLITE_OK ) goto err;
    }

    /* Step merged readers to next term and reorder. */
    while( i-- > 0 ){
      rc = optLeavesReaderStep(v, &readers[i]);
      if( rc!=SQLITE_OK ) goto err;

      optLeavesReaderReorder(&readers[i], nReaders-i);
    }
  }

 err:
  dataBufferDestroy(&doclist);
  dataBufferDestroy(&merged);
  return rc;
}

/* Implement optimize() function for FTS3.  optimize(t) merges all
** segments in the fts index into a single segment.  't' is the magic
** table-named column.
*/
static void optimizeFunc(sqlite3_context *pContext,
                         int argc, sqlite3_value **argv){
  fulltext_cursor *pCursor;
  if( argc>1 ){
    sqlite3_result_error(pContext, "excess arguments to optimize()",-1);
  }else if( sqlite3_value_type(argv[0])!=SQLITE_BLOB ||
            sqlite3_value_bytes(argv[0])!=sizeof(pCursor) ){
    sqlite3_result_error(pContext, "illegal first argument to optimize",-1);
  }else{
    fulltext_vtab *v;
    int i, rc, iMaxLevel;
    OptLeavesReader *readers;
    int nReaders;
    LeafWriter writer;
    sqlite3_stmt *s;

    memcpy(&pCursor, sqlite3_value_blob(argv[0]), sizeof(pCursor));
    v = cursor_vtab(pCursor);

    /* Flush any buffered updates before optimizing. */
    rc = flushPendingTerms(v);
    if( rc!=SQLITE_OK ) goto err;

    rc = segdir_count(v, &nReaders, &iMaxLevel);
    if( rc!=SQLITE_OK ) goto err;
    if( nReaders==0 || nReaders==1 ){
      sqlite3_result_text(pContext, "Index already optimal", -1,
                          SQLITE_STATIC);
      return;
    }

    rc = sql_get_statement(v, SEGDIR_SELECT_ALL_STMT, &s);
    if( rc!=SQLITE_OK ) goto err;

    readers = sqlite3_malloc(nReaders*sizeof(readers[0]));
    if( readers==NULL ) goto err;

    /* Note that there will already be a segment at this position
    ** until we call segdir_delete() on iMaxLevel.
    */
    leafWriterInit(iMaxLevel, 0, &writer);

    i = 0;
    while( (rc = sqlite3_step(s))==SQLITE_ROW ){
      sqlite_int64 iStart = sqlite3_column_int64(s, 0);
      sqlite_int64 iEnd = sqlite3_column_int64(s, 1);
      const char *pRootData = sqlite3_column_blob(s, 2);
      int nRootData = sqlite3_column_bytes(s, 2);

      assert( i<nReaders );
      rc = leavesReaderInit(v, -1, iStart, iEnd, pRootData, nRootData,
                            &readers[i].reader);
      if( rc!=SQLITE_OK ) break;

      readers[i].segment = i;
      i++;
    }

    /* If we managed to succesfully read them all, optimize them. */
    if( rc==SQLITE_DONE ){
      assert( i==nReaders );
      rc = optimizeInternal(v, readers, nReaders, &writer);
    }

    while( i-- > 0 ){
      leavesReaderDestroy(&readers[i].reader);
    }
    sqlite3_free(readers);

    /* If we've successfully gotten to here, delete the old segments
    ** and flush the interior structure of the new segment.
    */
    if( rc==SQLITE_OK ){
      for( i=0; i<=iMaxLevel; i++ ){
        rc = segdir_delete(v, i);
        if( rc!=SQLITE_OK ) break;
      }

      if( rc==SQLITE_OK ) rc = leafWriterFinalize(v, &writer);
    }

    leafWriterDestroy(&writer);

    if( rc!=SQLITE_OK ) goto err;

    sqlite3_result_text(pContext, "Index optimized", -1, SQLITE_STATIC);
    return;

    /* TODO(shess): Error-handling needs to be improved along the
    ** lines of the dump_ functions.
    */
 err:
    {
      char buf[512];
      sqlite3_snprintf(sizeof(buf), buf, "Error in optimize: %s",
                       sqlite3_errmsg(sqlite3_context_db_handle(pContext)));
      sqlite3_result_error(pContext, buf, -1);
    }
  }
}

#ifdef SQLITE_TEST
/* Generate an error of the form "<prefix>: <msg>".  If msg is NULL,
** pull the error from the context's db handle.
*/
static void generateError(sqlite3_context *pContext,
                          const char *prefix, const char *msg){
  char buf[512];
  if( msg==NULL ) msg = sqlite3_errmsg(sqlite3_context_db_handle(pContext));
  sqlite3_snprintf(sizeof(buf), buf, "%s: %s", prefix, msg);
  sqlite3_result_error(pContext, buf, -1);
}

/* Helper function to collect the set of terms in the segment into
** pTerms.  The segment is defined by the leaf nodes between
** iStartBlockid and iEndBlockid, inclusive, or by the contents of
** pRootData if iStartBlockid is 0 (in which case the entire segment
** fit in a leaf).
*/
static int collectSegmentTerms(fulltext_vtab *v, sqlite3_stmt *s,
                               fts3Hash *pTerms){
  const sqlite_int64 iStartBlockid = sqlite3_column_int64(s, 0);
  const sqlite_int64 iEndBlockid = sqlite3_column_int64(s, 1);
  const char *pRootData = sqlite3_column_blob(s, 2);
  const int nRootData = sqlite3_column_bytes(s, 2);
  LeavesReader reader;
  int rc = leavesReaderInit(v, 0, iStartBlockid, iEndBlockid,
                            pRootData, nRootData, &reader);
  if( rc!=SQLITE_OK ) return rc;

  while( rc==SQLITE_OK && !leavesReaderAtEnd(&reader) ){
    const char *pTerm = leavesReaderTerm(&reader);
    const int nTerm = leavesReaderTermBytes(&reader);
    void *oldValue = sqlite3Fts3HashFind(pTerms, pTerm, nTerm);
    void *newValue = (void *)((char *)oldValue+1);

    /* From the comment before sqlite3Fts3HashInsert in fts3_hash.c,
    ** the data value passed is returned in case of malloc failure.
    */
    if( newValue==sqlite3Fts3HashInsert(pTerms, pTerm, nTerm, newValue) ){
      rc = SQLITE_NOMEM;
    }else{
      rc = leavesReaderStep(v, &reader);
    }
  }

  leavesReaderDestroy(&reader);
  return rc;
}

/* Helper function to build the result string for dump_terms(). */
static int generateTermsResult(sqlite3_context *pContext, fts3Hash *pTerms){
  int iTerm, nTerms, nResultBytes, iByte;
  char *result;
  TermData *pData;
  fts3HashElem *e;

  /* Iterate pTerms to generate an array of terms in pData for
  ** sorting.
  */
  nTerms = fts3HashCount(pTerms);
  assert( nTerms>0 );
  pData = sqlite3_malloc(nTerms*sizeof(TermData));
  if( pData==NULL ) return SQLITE_NOMEM;

  nResultBytes = 0;
  for(iTerm = 0, e = fts3HashFirst(pTerms); e; iTerm++, e = fts3HashNext(e)){
    nResultBytes += fts3HashKeysize(e)+1;   /* Term plus trailing space */
    assert( iTerm<nTerms );
    pData[iTerm].pTerm = fts3HashKey(e);
    pData[iTerm].nTerm = fts3HashKeysize(e);
    pData[iTerm].pCollector = fts3HashData(e);  /* unused */
  }
  assert( iTerm==nTerms );

  assert( nResultBytes>0 );   /* nTerms>0, nResultsBytes must be, too. */
  result = sqlite3_malloc(nResultBytes);
  if( result==NULL ){
    sqlite3_free(pData);
    return SQLITE_NOMEM;
  }

  if( nTerms>1 ) qsort(pData, nTerms, sizeof(*pData), termDataCmp);

  /* Read the terms in order to build the result. */
  iByte = 0;
  for(iTerm=0; iTerm<nTerms; ++iTerm){
    memcpy(result+iByte, pData[iTerm].pTerm, pData[iTerm].nTerm);
    iByte += pData[iTerm].nTerm;
    result[iByte++] = ' ';
  }
  assert( iByte==nResultBytes );
  assert( result[nResultBytes-1]==' ' );
  result[nResultBytes-1] = '\0';

  /* Passes away ownership of result. */
  sqlite3_result_text(pContext, result, nResultBytes-1, sqlite3_free);
  sqlite3_free(pData);
  return SQLITE_OK;
}

/* Implements dump_terms() for use in inspecting the fts3 index from
** tests.  TEXT result containing the ordered list of terms joined by
** spaces.  dump_terms(t, level, idx) dumps the terms for the segment
** specified by level, idx (in %_segdir), while dump_terms(t) dumps
** all terms in the index.  In both cases t is the fts table's magic
** table-named column.
*/
static void dumpTermsFunc(
  sqlite3_context *pContext,
  int argc, sqlite3_value **argv
){
  fulltext_cursor *pCursor;
  if( argc!=3 && argc!=1 ){
    generateError(pContext, "dump_terms", "incorrect arguments");
  }else if( sqlite3_value_type(argv[0])!=SQLITE_BLOB ||
            sqlite3_value_bytes(argv[0])!=sizeof(pCursor) ){
    generateError(pContext, "dump_terms", "illegal first argument");
  }else{
    fulltext_vtab *v;
    fts3Hash terms;
    sqlite3_stmt *s = NULL;
    int rc;

    memcpy(&pCursor, sqlite3_value_blob(argv[0]), sizeof(pCursor));
    v = cursor_vtab(pCursor);

    /* If passed only the cursor column, get all segments.  Otherwise
    ** get the segment described by the following two arguments.
    */
    if( argc==1 ){
      rc = sql_get_statement(v, SEGDIR_SELECT_ALL_STMT, &s);
    }else{
      rc = sql_get_statement(v, SEGDIR_SELECT_SEGMENT_STMT, &s);
      if( rc==SQLITE_OK ){
        rc = sqlite3_bind_int(s, 1, sqlite3_value_int(argv[1]));
        if( rc==SQLITE_OK ){
          rc = sqlite3_bind_int(s, 2, sqlite3_value_int(argv[2]));
        }
      }
    }

    if( rc!=SQLITE_OK ){
      generateError(pContext, "dump_terms", NULL);
      return;
    }

    /* Collect the terms for each segment. */
    sqlite3Fts3HashInit(&terms, FTS3_HASH_STRING, 1);
    while( (rc = sqlite3_step(s))==SQLITE_ROW ){
      rc = collectSegmentTerms(v, s, &terms);
      if( rc!=SQLITE_OK ) break;
    }

    if( rc!=SQLITE_DONE ){
      sqlite3_reset(s);
      generateError(pContext, "dump_terms", NULL);
    }else{
      const int nTerms = fts3HashCount(&terms);
      if( nTerms>0 ){
        rc = generateTermsResult(pContext, &terms);
        if( rc==SQLITE_NOMEM ){
          generateError(pContext, "dump_terms", "out of memory");
        }else{
          assert( rc==SQLITE_OK );
        }
      }else if( argc==3 ){
        /* The specific segment asked for could not be found. */
        generateError(pContext, "dump_terms", "segment not found");
      }else{
        /* No segments found. */
        /* TODO(shess): It should be impossible to reach this.  This
        ** case can only happen for an empty table, in which case
        ** SQLite has no rows to call this function on.
        */
        sqlite3_result_null(pContext);
      }
    }
    sqlite3Fts3HashClear(&terms);
  }
}

/* Expand the DL_DEFAULT doclist in pData into a text result in
** pContext.
*/
static void createDoclistResult(sqlite3_context *pContext,
                                const char *pData, int nData){
  DataBuffer dump;
  DLReader dlReader;

  assert( pData!=NULL && nData>0 );

  dataBufferInit(&dump, 0);
  dlrInit(&dlReader, DL_DEFAULT, pData, nData);
  for( ; !dlrAtEnd(&dlReader); dlrStep(&dlReader) ){
    char buf[256];
    PLReader plReader;

    plrInit(&plReader, &dlReader);
    if( DL_DEFAULT==DL_DOCIDS || plrAtEnd(&plReader) ){
      sqlite3_snprintf(sizeof(buf), buf, "[%lld] ", dlrDocid(&dlReader));
      dataBufferAppend(&dump, buf, strlen(buf));
    }else{
      int iColumn = plrColumn(&plReader);

      sqlite3_snprintf(sizeof(buf), buf, "[%lld %d[",
                       dlrDocid(&dlReader), iColumn);
      dataBufferAppend(&dump, buf, strlen(buf));

      for( ; !plrAtEnd(&plReader); plrStep(&plReader) ){
        if( plrColumn(&plReader)!=iColumn ){
          iColumn = plrColumn(&plReader);
          sqlite3_snprintf(sizeof(buf), buf, "] %d[", iColumn);
          assert( dump.nData>0 );
          dump.nData--;                     /* Overwrite trailing space. */
          assert( dump.pData[dump.nData]==' ');
          dataBufferAppend(&dump, buf, strlen(buf));
        }
        if( DL_DEFAULT==DL_POSITIONS_OFFSETS ){
          sqlite3_snprintf(sizeof(buf), buf, "%d,%d,%d ",
                           plrPosition(&plReader),
                           plrStartOffset(&plReader), plrEndOffset(&plReader));
        }else if( DL_DEFAULT==DL_POSITIONS ){
          sqlite3_snprintf(sizeof(buf), buf, "%d ", plrPosition(&plReader));
        }else{
          assert( NULL=="Unhandled DL_DEFAULT value");
        }
        dataBufferAppend(&dump, buf, strlen(buf));
      }
      plrDestroy(&plReader);

      assert( dump.nData>0 );
      dump.nData--;                     /* Overwrite trailing space. */
      assert( dump.pData[dump.nData]==' ');
      dataBufferAppend(&dump, "]] ", 3);
    }
  }
  dlrDestroy(&dlReader);

  assert( dump.nData>0 );
  dump.nData--;                     /* Overwrite trailing space. */
  assert( dump.pData[dump.nData]==' ');
  dump.pData[dump.nData] = '\0';
  assert( dump.nData>0 );

  /* Passes ownership of dump's buffer to pContext. */
  sqlite3_result_text(pContext, dump.pData, dump.nData, sqlite3_free);
  dump.pData = NULL;
  dump.nData = dump.nCapacity = 0;
}

/* Implements dump_doclist() for use in inspecting the fts3 index from
** tests.  TEXT result containing a string representation of the
** doclist for the indicated term.  dump_doclist(t, term, level, idx)
** dumps the doclist for term from the segment specified by level, idx
** (in %_segdir), while dump_doclist(t, term) dumps the logical
** doclist for the term across all segments.  The per-segment doclist
** can contain deletions, while the full-index doclist will not
** (deletions are omitted).
**
** Result formats differ with the setting of DL_DEFAULTS.  Examples:
**
** DL_DOCIDS: [1] [3] [7]
** DL_POSITIONS: [1 0[0 4] 1[17]] [3 1[5]]
** DL_POSITIONS_OFFSETS: [1 0[0,0,3 4,23,26] 1[17,102,105]] [3 1[5,20,23]]
**
** In each case the number after the outer '[' is the docid.  In the
** latter two cases, the number before the inner '[' is the column
** associated with the values within.  For DL_POSITIONS the numbers
** within are the positions, for DL_POSITIONS_OFFSETS they are the
** position, the start offset, and the end offset.
*/
static void dumpDoclistFunc(
  sqlite3_context *pContext,
  int argc, sqlite3_value **argv
){
  fulltext_cursor *pCursor;
  if( argc!=2 && argc!=4 ){
    generateError(pContext, "dump_doclist", "incorrect arguments");
  }else if( sqlite3_value_type(argv[0])!=SQLITE_BLOB ||
            sqlite3_value_bytes(argv[0])!=sizeof(pCursor) ){
    generateError(pContext, "dump_doclist", "illegal first argument");
  }else if( sqlite3_value_text(argv[1])==NULL ||
            sqlite3_value_text(argv[1])[0]=='\0' ){
    generateError(pContext, "dump_doclist", "empty second argument");
  }else{
    const char *pTerm = (const char *)sqlite3_value_text(argv[1]);
    const int nTerm = strlen(pTerm);
    fulltext_vtab *v;
    int rc;
    DataBuffer doclist;

    memcpy(&pCursor, sqlite3_value_blob(argv[0]), sizeof(pCursor));
    v = cursor_vtab(pCursor);

    dataBufferInit(&doclist, 0);

    /* termSelect() yields the same logical doclist that queries are
    ** run against.
    */
    if( argc==2 ){
      rc = termSelect(v, v->nColumn, pTerm, nTerm, 0, DL_DEFAULT, &doclist);
    }else{
      sqlite3_stmt *s = NULL;

      /* Get our specific segment's information. */
      rc = sql_get_statement(v, SEGDIR_SELECT_SEGMENT_STMT, &s);
      if( rc==SQLITE_OK ){
        rc = sqlite3_bind_int(s, 1, sqlite3_value_int(argv[2]));
        if( rc==SQLITE_OK ){
          rc = sqlite3_bind_int(s, 2, sqlite3_value_int(argv[3]));
        }
      }

      if( rc==SQLITE_OK ){
        rc = sqlite3_step(s);

        if( rc==SQLITE_DONE ){
          dataBufferDestroy(&doclist);
          generateError(pContext, "dump_doclist", "segment not found");
          return;
        }

        /* Found a segment, load it into doclist. */
        if( rc==SQLITE_ROW ){
          const sqlite_int64 iLeavesEnd = sqlite3_column_int64(s, 1);
          const char *pData = sqlite3_column_blob(s, 2);
          const int nData = sqlite3_column_bytes(s, 2);

          /* loadSegment() is used by termSelect() to load each
          ** segment's data.
          */
          rc = loadSegment(v, pData, nData, iLeavesEnd, pTerm, nTerm, 0,
                           &doclist);
          if( rc==SQLITE_OK ){
            rc = sqlite3_step(s);

            /* Should not have more than one matching segment. */
            if( rc!=SQLITE_DONE ){
              sqlite3_reset(s);
              dataBufferDestroy(&doclist);
              generateError(pContext, "dump_doclist", "invalid segdir");
              return;
            }
            rc = SQLITE_OK;
          }
        }
      }

      sqlite3_reset(s);
    }

    if( rc==SQLITE_OK ){
      if( doclist.nData>0 ){
        createDoclistResult(pContext, doclist.pData, doclist.nData);
      }else{
        /* TODO(shess): This can happen if the term is not present, or
        ** if all instances of the term have been deleted and this is
        ** an all-index dump.  It may be interesting to distinguish
        ** these cases.
        */
        sqlite3_result_text(pContext, "", 0, SQLITE_STATIC);
      }
    }else if( rc==SQLITE_NOMEM ){
      /* Handle out-of-memory cases specially because if they are
      ** generated in fts3 code they may not be reflected in the db
      ** handle.
      */
      /* TODO(shess): Handle this more comprehensively.
      ** sqlite3ErrStr() has what I need, but is internal.
      */
      generateError(pContext, "dump_doclist", "out of memory");
    }else{
      generateError(pContext, "dump_doclist", NULL);
    }

    dataBufferDestroy(&doclist);
  }
}
#endif

/*
** This routine implements the xFindFunction method for the FTS3
** virtual table.
*/
static int fulltextFindFunction(
  sqlite3_vtab *pVtab,
  int nArg,
  const char *zName,
  void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),
  void **ppArg
){
  if( strcmp(zName,"snippet")==0 ){
    *pxFunc = snippetFunc;
    return 1;
  }else if( strcmp(zName,"offsets")==0 ){
    *pxFunc = snippetOffsetsFunc;
    return 1;
  }else if( strcmp(zName,"optimize")==0 ){
    *pxFunc = optimizeFunc;
    return 1;
#ifdef SQLITE_TEST
    /* NOTE(shess): These functions are present only for testing
    ** purposes.  No particular effort is made to optimize their
    ** execution or how they build their results.
    */
  }else if( strcmp(zName,"dump_terms")==0 ){
    /* fprintf(stderr, "Found dump_terms\n"); */
    *pxFunc = dumpTermsFunc;
    return 1;
  }else if( strcmp(zName,"dump_doclist")==0 ){
    /* fprintf(stderr, "Found dump_doclist\n"); */
    *pxFunc = dumpDoclistFunc;
    return 1;
#endif
  }
  return 0;
}

/*
** Rename an fts3 table.
*/
static int fulltextRename(
  sqlite3_vtab *pVtab,
  const char *zName
){
  fulltext_vtab *p = (fulltext_vtab *)pVtab;
  int rc = SQLITE_NOMEM;
  char *zSql = sqlite3_mprintf(
    "ALTER TABLE %Q.'%q_content'  RENAME TO '%q_content';"
    "ALTER TABLE %Q.'%q_segments' RENAME TO '%q_segments';"
    "ALTER TABLE %Q.'%q_segdir'   RENAME TO '%q_segdir';"
    , p->zDb, p->zName, zName 
    , p->zDb, p->zName, zName 
    , p->zDb, p->zName, zName
  );
  if( zSql ){
    rc = sqlite3_exec(p->db, zSql, 0, 0, 0);
    sqlite3_free(zSql);
  }
  return rc;
}

static const sqlite3_module fts3Module = {
  /* iVersion      */ 0,
  /* xCreate       */ fulltextCreate,
  /* xConnect      */ fulltextConnect,
  /* xBestIndex    */ fulltextBestIndex,
  /* xDisconnect   */ fulltextDisconnect,
  /* xDestroy      */ fulltextDestroy,
  /* xOpen         */ fulltextOpen,
  /* xClose        */ fulltextClose,
  /* xFilter       */ fulltextFilter,
  /* xNext         */ fulltextNext,
  /* xEof          */ fulltextEof,
  /* xColumn       */ fulltextColumn,
  /* xRowid        */ fulltextRowid,
  /* xUpdate       */ fulltextUpdate,
  /* xBegin        */ fulltextBegin,
  /* xSync         */ fulltextSync,
  /* xCommit       */ fulltextCommit,
  /* xRollback     */ fulltextRollback,
  /* xFindFunction */ fulltextFindFunction,
  /* xRename */       fulltextRename,
};

static void hashDestroy(void *p){
  fts3Hash *pHash = (fts3Hash *)p;
  sqlite3Fts3HashClear(pHash);
  sqlite3_free(pHash);
}

/*
** The fts3 built-in tokenizers - "simple" and "porter" - are implemented
** in files fts3_tokenizer1.c and fts3_porter.c respectively. The following
** two forward declarations are for functions declared in these files
** used to retrieve the respective implementations.
**
** Calling sqlite3Fts3SimpleTokenizerModule() sets the value pointed
** to by the argument to point a the "simple" tokenizer implementation.
** Function ...PorterTokenizerModule() sets *pModule to point to the
** porter tokenizer/stemmer implementation.
*/
void sqlite3Fts3SimpleTokenizerModule(sqlite3_tokenizer_module const**ppModule);
void sqlite3Fts3PorterTokenizerModule(sqlite3_tokenizer_module const**ppModule);
void sqlite3Fts3IcuTokenizerModule(sqlite3_tokenizer_module const**ppModule);

int sqlite3Fts3InitHashTable(sqlite3 *, fts3Hash *, const char *);

/*
** Initialise the fts3 extension. If this extension is built as part
** of the sqlite library, then this function is called directly by
** SQLite. If fts3 is built as a dynamically loadable extension, this
** function is called by the sqlite3_extension_init() entry point.
*/
int sqlite3Fts3Init(sqlite3 *db){
  int rc = SQLITE_OK;
  fts3Hash *pHash = 0;
  const sqlite3_tokenizer_module *pSimple = 0;
  const sqlite3_tokenizer_module *pPorter = 0;
  const sqlite3_tokenizer_module *pIcu = 0;

  sqlite3Fts3SimpleTokenizerModule(&pSimple);
  sqlite3Fts3PorterTokenizerModule(&pPorter);
#ifdef SQLITE_ENABLE_ICU
  sqlite3Fts3IcuTokenizerModule(&pIcu);
#endif

  /* Allocate and initialise the hash-table used to store tokenizers. */
  pHash = sqlite3_malloc(sizeof(fts3Hash));
  if( !pHash ){
    rc = SQLITE_NOMEM;
  }else{
    sqlite3Fts3HashInit(pHash, FTS3_HASH_STRING, 1);
  }

  /* Load the built-in tokenizers into the hash table */
  if( rc==SQLITE_OK ){
    if( sqlite3Fts3HashInsert(pHash, "simple", 7, (void *)pSimple)
     || sqlite3Fts3HashInsert(pHash, "porter", 7, (void *)pPorter) 
     || (pIcu && sqlite3Fts3HashInsert(pHash, "icu", 4, (void *)pIcu))
    ){
      rc = SQLITE_NOMEM;
    }
  }

  /* Create the virtual table wrapper around the hash-table and overload 
  ** the two scalar functions. If this is successful, register the
  ** module with sqlite.
  */
  if( SQLITE_OK==rc 
   && SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, "fts3_tokenizer"))
   && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1))
   && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", -1))
   && SQLITE_OK==(rc = sqlite3_overload_function(db, "optimize", -1))
#ifdef SQLITE_TEST
   && SQLITE_OK==(rc = sqlite3_overload_function(db, "dump_terms", -1))
   && SQLITE_OK==(rc = sqlite3_overload_function(db, "dump_doclist", -1))
#endif
  ){
    return sqlite3_create_module_v2(
        db, "fts3", &fts3Module, (void *)pHash, hashDestroy
    );
  }

  /* An error has occured. Delete the hash table and return the error code. */
  assert( rc!=SQLITE_OK );
  if( pHash ){
    sqlite3Fts3HashClear(pHash);
    sqlite3_free(pHash);
  }
  return rc;
}

#if !SQLITE_CORE
int sqlite3_extension_init(
  sqlite3 *db, 
  char **pzErrMsg,
  const sqlite3_api_routines *pApi
){
  SQLITE_EXTENSION_INIT2(pApi)
  return sqlite3Fts3Init(db);
}
#endif

#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/fts3.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
** 2006 Oct 10
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This header file is used by programs that want to link against the
** FTS3 library.  All it does is declare the sqlite3Fts3Init() interface.
*/
#include "sqlite3.h"

#ifdef __cplusplus
extern "C" {
#endif  /* __cplusplus */

int sqlite3Fts3Init(sqlite3 *db);

#ifdef __cplusplus
}  /* extern "C" */
#endif  /* __cplusplus */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































Deleted SQLite.Interop/splitsource/fts3_hash.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
/*
** 2001 September 22
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This is the implementation of generic hash-tables used in SQLite.
** We've modified it slightly to serve as a standalone hash table
** implementation for the full-text indexing module.
*/

/*
** The code in this file is only compiled if:
**
**     * The FTS3 module is being built as an extension
**       (in which case SQLITE_CORE is not defined), or
**
**     * The FTS3 module is being built into the core of
**       SQLite (in which case SQLITE_ENABLE_FTS3 is defined).
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)

#include <assert.h>
#include <stdlib.h>
#include <string.h>

#include "sqlite3.h"
#include "fts3_hash.h"

/*
** Malloc and Free functions
*/
static void *fts3HashMalloc(int n){
  void *p = sqlite3_malloc(n);
  if( p ){
    memset(p, 0, n);
  }
  return p;
}
static void fts3HashFree(void *p){
  sqlite3_free(p);
}

/* Turn bulk memory into a hash table object by initializing the
** fields of the Hash structure.
**
** "pNew" is a pointer to the hash table that is to be initialized.
** keyClass is one of the constants 
** FTS3_HASH_BINARY or FTS3_HASH_STRING.  The value of keyClass 
** determines what kind of key the hash table will use.  "copyKey" is
** true if the hash table should make its own private copy of keys and
** false if it should just use the supplied pointer.
*/
void sqlite3Fts3HashInit(fts3Hash *pNew, int keyClass, int copyKey){
  assert( pNew!=0 );
  assert( keyClass>=FTS3_HASH_STRING && keyClass<=FTS3_HASH_BINARY );
  pNew->keyClass = keyClass;
  pNew->copyKey = copyKey;
  pNew->first = 0;
  pNew->count = 0;
  pNew->htsize = 0;
  pNew->ht = 0;
}

/* Remove all entries from a hash table.  Reclaim all memory.
** Call this routine to delete a hash table or to reset a hash table
** to the empty state.
*/
void sqlite3Fts3HashClear(fts3Hash *pH){
  fts3HashElem *elem;         /* For looping over all elements of the table */

  assert( pH!=0 );
  elem = pH->first;
  pH->first = 0;
  fts3HashFree(pH->ht);
  pH->ht = 0;
  pH->htsize = 0;
  while( elem ){
    fts3HashElem *next_elem = elem->next;
    if( pH->copyKey && elem->pKey ){
      fts3HashFree(elem->pKey);
    }
    fts3HashFree(elem);
    elem = next_elem;
  }
  pH->count = 0;
}

/*
** Hash and comparison functions when the mode is FTS3_HASH_STRING
*/
static int fts3StrHash(const void *pKey, int nKey){
  const char *z = (const char *)pKey;
  int h = 0;
  if( nKey<=0 ) nKey = (int) strlen(z);
  while( nKey > 0  ){
    h = (h<<3) ^ h ^ *z++;
    nKey--;
  }
  return h & 0x7fffffff;
}
static int fts3StrCompare(const void *pKey1, int n1, const void *pKey2, int n2){
  if( n1!=n2 ) return 1;
  return strncmp((const char*)pKey1,(const char*)pKey2,n1);
}

/*
** Hash and comparison functions when the mode is FTS3_HASH_BINARY
*/
static int fts3BinHash(const void *pKey, int nKey){
  int h = 0;
  const char *z = (const char *)pKey;
  while( nKey-- > 0 ){
    h = (h<<3) ^ h ^ *(z++);
  }
  return h & 0x7fffffff;
}
static int fts3BinCompare(const void *pKey1, int n1, const void *pKey2, int n2){
  if( n1!=n2 ) return 1;
  return memcmp(pKey1,pKey2,n1);
}

/*
** Return a pointer to the appropriate hash function given the key class.
**
** The C syntax in this function definition may be unfamilar to some 
** programmers, so we provide the following additional explanation:
**
** The name of the function is "ftsHashFunction".  The function takes a
** single parameter "keyClass".  The return value of ftsHashFunction()
** is a pointer to another function.  Specifically, the return value
** of ftsHashFunction() is a pointer to a function that takes two parameters
** with types "const void*" and "int" and returns an "int".
*/
static int (*ftsHashFunction(int keyClass))(const void*,int){
  if( keyClass==FTS3_HASH_STRING ){
    return &fts3StrHash;
  }else{
    assert( keyClass==FTS3_HASH_BINARY );
    return &fts3BinHash;
  }
}

/*
** Return a pointer to the appropriate hash function given the key class.
**
** For help in interpreted the obscure C code in the function definition,
** see the header comment on the previous function.
*/
static int (*ftsCompareFunction(int keyClass))(const void*,int,const void*,int){
  if( keyClass==FTS3_HASH_STRING ){
    return &fts3StrCompare;
  }else{
    assert( keyClass==FTS3_HASH_BINARY );
    return &fts3BinCompare;
  }
}

/* Link an element into the hash table
*/
static void fts3HashInsertElement(
  fts3Hash *pH,            /* The complete hash table */
  struct _fts3ht *pEntry,  /* The entry into which pNew is inserted */
  fts3HashElem *pNew       /* The element to be inserted */
){
  fts3HashElem *pHead;     /* First element already in pEntry */
  pHead = pEntry->chain;
  if( pHead ){
    pNew->next = pHead;
    pNew->prev = pHead->prev;
    if( pHead->prev ){ pHead->prev->next = pNew; }
    else             { pH->first = pNew; }
    pHead->prev = pNew;
  }else{
    pNew->next = pH->first;
    if( pH->first ){ pH->first->prev = pNew; }
    pNew->prev = 0;
    pH->first = pNew;
  }
  pEntry->count++;
  pEntry->chain = pNew;
}


/* Resize the hash table so that it cantains "new_size" buckets.
** "new_size" must be a power of 2.  The hash table might fail 
** to resize if sqliteMalloc() fails.
*/
static void fts3Rehash(fts3Hash *pH, int new_size){
  struct _fts3ht *new_ht;          /* The new hash table */
  fts3HashElem *elem, *next_elem;  /* For looping over existing elements */
  int (*xHash)(const void*,int);   /* The hash function */

  assert( (new_size & (new_size-1))==0 );
  new_ht = (struct _fts3ht *)fts3HashMalloc( new_size*sizeof(struct _fts3ht) );
  if( new_ht==0 ) return;
  fts3HashFree(pH->ht);
  pH->ht = new_ht;
  pH->htsize = new_size;
  xHash = ftsHashFunction(pH->keyClass);
  for(elem=pH->first, pH->first=0; elem; elem = next_elem){
    int h = (*xHash)(elem->pKey, elem->nKey) & (new_size-1);
    next_elem = elem->next;
    fts3HashInsertElement(pH, &new_ht[h], elem);
  }
}

/* This function (for internal use only) locates an element in an
** hash table that matches the given key.  The hash for this key has
** already been computed and is passed as the 4th parameter.
*/
static fts3HashElem *fts3FindElementByHash(
  const fts3Hash *pH, /* The pH to be searched */
  const void *pKey,   /* The key we are searching for */
  int nKey,
  int h               /* The hash for this key. */
){
  fts3HashElem *elem;            /* Used to loop thru the element list */
  int count;                     /* Number of elements left to test */
  int (*xCompare)(const void*,int,const void*,int);  /* comparison function */

  if( pH->ht ){
    struct _fts3ht *pEntry = &pH->ht[h];
    elem = pEntry->chain;
    count = pEntry->count;
    xCompare = ftsCompareFunction(pH->keyClass);
    while( count-- && elem ){
      if( (*xCompare)(elem->pKey,elem->nKey,pKey,nKey)==0 ){ 
        return elem;
      }
      elem = elem->next;
    }
  }
  return 0;
}

/* Remove a single entry from the hash table given a pointer to that
** element and a hash on the element's key.
*/
static void fts3RemoveElementByHash(
  fts3Hash *pH,         /* The pH containing "elem" */
  fts3HashElem* elem,   /* The element to be removed from the pH */
  int h                 /* Hash value for the element */
){
  struct _fts3ht *pEntry;
  if( elem->prev ){
    elem->prev->next = elem->next; 
  }else{
    pH->first = elem->next;
  }
  if( elem->next ){
    elem->next->prev = elem->prev;
  }
  pEntry = &pH->ht[h];
  if( pEntry->chain==elem ){
    pEntry->chain = elem->next;
  }
  pEntry->count--;
  if( pEntry->count<=0 ){
    pEntry->chain = 0;
  }
  if( pH->copyKey && elem->pKey ){
    fts3HashFree(elem->pKey);
  }
  fts3HashFree( elem );
  pH->count--;
  if( pH->count<=0 ){
    assert( pH->first==0 );
    assert( pH->count==0 );
    fts3HashClear(pH);
  }
}

/* Attempt to locate an element of the hash table pH with a key
** that matches pKey,nKey.  Return the data for this element if it is
** found, or NULL if there is no match.
*/
void *sqlite3Fts3HashFind(const fts3Hash *pH, const void *pKey, int nKey){
  int h;                 /* A hash on key */
  fts3HashElem *elem;    /* The element that matches key */
  int (*xHash)(const void*,int);  /* The hash function */

  if( pH==0 || pH->ht==0 ) return 0;
  xHash = ftsHashFunction(pH->keyClass);
  assert( xHash!=0 );
  h = (*xHash)(pKey,nKey);
  assert( (pH->htsize & (pH->htsize-1))==0 );
  elem = fts3FindElementByHash(pH,pKey,nKey, h & (pH->htsize-1));
  return elem ? elem->data : 0;
}

/* Insert an element into the hash table pH.  The key is pKey,nKey
** and the data is "data".
**
** If no element exists with a matching key, then a new
** element is created.  A copy of the key is made if the copyKey
** flag is set.  NULL is returned.
**
** If another element already exists with the same key, then the
** new data replaces the old data and the old data is returned.
** The key is not copied in this instance.  If a malloc fails, then
** the new data is returned and the hash table is unchanged.
**
** If the "data" parameter to this function is NULL, then the
** element corresponding to "key" is removed from the hash table.
*/
void *sqlite3Fts3HashInsert(
  fts3Hash *pH,        /* The hash table to insert into */
  const void *pKey,    /* The key */
  int nKey,            /* Number of bytes in the key */
  void *data           /* The data */
){
  int hraw;                 /* Raw hash value of the key */
  int h;                    /* the hash of the key modulo hash table size */
  fts3HashElem *elem;       /* Used to loop thru the element list */
  fts3HashElem *new_elem;   /* New element added to the pH */
  int (*xHash)(const void*,int);  /* The hash function */

  assert( pH!=0 );
  xHash = ftsHashFunction(pH->keyClass);
  assert( xHash!=0 );
  hraw = (*xHash)(pKey, nKey);
  assert( (pH->htsize & (pH->htsize-1))==0 );
  h = hraw & (pH->htsize-1);
  elem = fts3FindElementByHash(pH,pKey,nKey,h);
  if( elem ){
    void *old_data = elem->data;
    if( data==0 ){
      fts3RemoveElementByHash(pH,elem,h);
    }else{
      elem->data = data;
    }
    return old_data;
  }
  if( data==0 ) return 0;
  new_elem = (fts3HashElem*)fts3HashMalloc( sizeof(fts3HashElem) );
  if( new_elem==0 ) return data;
  if( pH->copyKey && pKey!=0 ){
    new_elem->pKey = fts3HashMalloc( nKey );
    if( new_elem->pKey==0 ){
      fts3HashFree(new_elem);
      return data;
    }
    memcpy((void*)new_elem->pKey, pKey, nKey);
  }else{
    new_elem->pKey = (void*)pKey;
  }
  new_elem->nKey = nKey;
  pH->count++;
  if( pH->htsize==0 ){
    fts3Rehash(pH,8);
    if( pH->htsize==0 ){
      pH->count = 0;
      fts3HashFree(new_elem);
      return data;
    }
  }
  if( pH->count > pH->htsize ){
    fts3Rehash(pH,pH->htsize*2);
  }
  assert( pH->htsize>0 );
  assert( (pH->htsize & (pH->htsize-1))==0 );
  h = hraw & (pH->htsize-1);
  fts3HashInsertElement(pH, &pH->ht[h], new_elem);
  new_elem->data = data;
  return 0;
}

#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/fts3_hash.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
** 2001 September 22
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This is the header file for the generic hash-table implemenation
** used in SQLite.  We've modified it slightly to serve as a standalone
** hash table implementation for the full-text indexing module.
**
*/
#ifndef _FTS3_HASH_H_
#define _FTS3_HASH_H_

/* Forward declarations of structures. */
typedef struct fts3Hash fts3Hash;
typedef struct fts3HashElem fts3HashElem;

/* A complete hash table is an instance of the following structure.
** The internals of this structure are intended to be opaque -- client
** code should not attempt to access or modify the fields of this structure
** directly.  Change this structure only by using the routines below.
** However, many of the "procedures" and "functions" for modifying and
** accessing this structure are really macros, so we can't really make
** this structure opaque.
*/
struct fts3Hash {
  char keyClass;          /* HASH_INT, _POINTER, _STRING, _BINARY */
  char copyKey;           /* True if copy of key made on insert */
  int count;              /* Number of entries in this table */
  fts3HashElem *first;    /* The first element of the array */
  int htsize;             /* Number of buckets in the hash table */
  struct _fts3ht {        /* the hash table */
    int count;               /* Number of entries with this hash */
    fts3HashElem *chain;     /* Pointer to first entry with this hash */
  } *ht;
};

/* Each element in the hash table is an instance of the following 
** structure.  All elements are stored on a single doubly-linked list.
**
** Again, this structure is intended to be opaque, but it can't really
** be opaque because it is used by macros.
*/
struct fts3HashElem {
  fts3HashElem *next, *prev; /* Next and previous elements in the table */
  void *data;                /* Data associated with this element */
  void *pKey; int nKey;      /* Key associated with this element */
};

/*
** There are 2 different modes of operation for a hash table:
**
**   FTS3_HASH_STRING        pKey points to a string that is nKey bytes long
**                           (including the null-terminator, if any).  Case
**                           is respected in comparisons.
**
**   FTS3_HASH_BINARY        pKey points to binary data nKey bytes long. 
**                           memcmp() is used to compare keys.
**
** A copy of the key is made if the copyKey parameter to fts3HashInit is 1.  
*/
#define FTS3_HASH_STRING    1
#define FTS3_HASH_BINARY    2

/*
** Access routines.  To delete, insert a NULL pointer.
*/
void sqlite3Fts3HashInit(fts3Hash*, int keytype, int copyKey);
void *sqlite3Fts3HashInsert(fts3Hash*, const void *pKey, int nKey, void *pData);
void *sqlite3Fts3HashFind(const fts3Hash*, const void *pKey, int nKey);
void sqlite3Fts3HashClear(fts3Hash*);

/*
** Shorthand for the functions above
*/
#define fts3HashInit   sqlite3Fts3HashInit
#define fts3HashInsert sqlite3Fts3HashInsert
#define fts3HashFind   sqlite3Fts3HashFind
#define fts3HashClear  sqlite3Fts3HashClear

/*
** Macros for looping over all elements of a hash table.  The idiom is
** like this:
**
**   fts3Hash h;
**   fts3HashElem *p;
**   ...
**   for(p=fts3HashFirst(&h); p; p=fts3HashNext(p)){
**     SomeStructure *pData = fts3HashData(p);
**     // do something with pData
**   }
*/
#define fts3HashFirst(H)  ((H)->first)
#define fts3HashNext(E)   ((E)->next)
#define fts3HashData(E)   ((E)->data)
#define fts3HashKey(E)    ((E)->pKey)
#define fts3HashKeysize(E) ((E)->nKey)

/*
** Number of entries in a hash table
*/
#define fts3HashCount(H)  ((H)->count)

#endif /* _FTS3_HASH_H_ */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































































































Deleted SQLite.Interop/splitsource/fts3_icu.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
/*
** 2007 June 22
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file implements a tokenizer for fts3 based on the ICU library.
** 
** $Id: fts3_icu.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/

#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)
#ifdef SQLITE_ENABLE_ICU

#include <assert.h>
#include <string.h>
#include "fts3_tokenizer.h"

#include <unicode/ubrk.h>
#include <unicode/ucol.h>
#include <unicode/ustring.h>
#include <unicode/utf16.h>

typedef struct IcuTokenizer IcuTokenizer;
typedef struct IcuCursor IcuCursor;

struct IcuTokenizer {
  sqlite3_tokenizer base;
  char *zLocale;
};

struct IcuCursor {
  sqlite3_tokenizer_cursor base;

  UBreakIterator *pIter;      /* ICU break-iterator object */
  int nChar;                  /* Number of UChar elements in pInput */
  UChar *aChar;               /* Copy of input using utf-16 encoding */
  int *aOffset;               /* Offsets of each character in utf-8 input */

  int nBuffer;
  char *zBuffer;

  int iToken;
};

/*
** Create a new tokenizer instance.
*/
static int icuCreate(
  int argc,                            /* Number of entries in argv[] */
  const char * const *argv,            /* Tokenizer creation arguments */
  sqlite3_tokenizer **ppTokenizer      /* OUT: Created tokenizer */
){
  IcuTokenizer *p;
  int n = 0;

  if( argc>0 ){
    n = strlen(argv[0])+1;
  }
  p = (IcuTokenizer *)sqlite3_malloc(sizeof(IcuTokenizer)+n);
  if( !p ){
    return SQLITE_NOMEM;
  }
  memset(p, 0, sizeof(IcuTokenizer));

  if( n ){
    p->zLocale = (char *)&p[1];
    memcpy(p->zLocale, argv[0], n);
  }

  *ppTokenizer = (sqlite3_tokenizer *)p;

  return SQLITE_OK;
}

/*
** Destroy a tokenizer
*/
static int icuDestroy(sqlite3_tokenizer *pTokenizer){
  IcuTokenizer *p = (IcuTokenizer *)pTokenizer;
  sqlite3_free(p);
  return SQLITE_OK;
}

/*
** Prepare to begin tokenizing a particular string.  The input
** string to be tokenized is pInput[0..nBytes-1].  A cursor
** used to incrementally tokenize this string is returned in 
** *ppCursor.
*/
static int icuOpen(
  sqlite3_tokenizer *pTokenizer,         /* The tokenizer */
  const char *zInput,                    /* Input string */
  int nInput,                            /* Length of zInput in bytes */
  sqlite3_tokenizer_cursor **ppCursor    /* OUT: Tokenization cursor */
){
  IcuTokenizer *p = (IcuTokenizer *)pTokenizer;
  IcuCursor *pCsr;

  const int32_t opt = U_FOLD_CASE_DEFAULT;
  UErrorCode status = U_ZERO_ERROR;
  int nChar;

  UChar32 c;
  int iInput = 0;
  int iOut = 0;

  *ppCursor = 0;

  if( -1 == nInput ) nInput = strlen(nInput);
  nChar = nInput+1;
  pCsr = (IcuCursor *)sqlite3_malloc(
      sizeof(IcuCursor) +                /* IcuCursor */
      nChar * sizeof(UChar) +            /* IcuCursor.aChar[] */
      (nChar+1) * sizeof(int)            /* IcuCursor.aOffset[] */
  );
  if( !pCsr ){
    return SQLITE_NOMEM;
  }
  memset(pCsr, 0, sizeof(IcuCursor));
  pCsr->aChar = (UChar *)&pCsr[1];
  pCsr->aOffset = (int *)&pCsr->aChar[nChar];

  pCsr->aOffset[iOut] = iInput;
  U8_NEXT(zInput, iInput, nInput, c); 
  while( c>0 ){
    int isError = 0;
    c = u_foldCase(c, opt);
    U16_APPEND(pCsr->aChar, iOut, nChar, c, isError);
    if( isError ){
      sqlite3_free(pCsr);
      return SQLITE_ERROR;
    }
    pCsr->aOffset[iOut] = iInput;

    if( iInput<nInput ){
      U8_NEXT(zInput, iInput, nInput, c);
    }else{
      c = 0;
    }
  }

  pCsr->pIter = ubrk_open(UBRK_WORD, p->zLocale, pCsr->aChar, iOut, &status);
  if( !U_SUCCESS(status) ){
    sqlite3_free(pCsr);
    return SQLITE_ERROR;
  }
  pCsr->nChar = iOut;

  ubrk_first(pCsr->pIter);
  *ppCursor = (sqlite3_tokenizer_cursor *)pCsr;
  return SQLITE_OK;
}

/*
** Close a tokenization cursor previously opened by a call to icuOpen().
*/
static int icuClose(sqlite3_tokenizer_cursor *pCursor){
  IcuCursor *pCsr = (IcuCursor *)pCursor;
  ubrk_close(pCsr->pIter);
  sqlite3_free(pCsr->zBuffer);
  sqlite3_free(pCsr);
  return SQLITE_OK;
}

/*
** Extract the next token from a tokenization cursor.
*/
static int icuNext(
  sqlite3_tokenizer_cursor *pCursor,  /* Cursor returned by simpleOpen */
  const char **ppToken,               /* OUT: *ppToken is the token text */
  int *pnBytes,                       /* OUT: Number of bytes in token */
  int *piStartOffset,                 /* OUT: Starting offset of token */
  int *piEndOffset,                   /* OUT: Ending offset of token */
  int *piPosition                     /* OUT: Position integer of token */
){
  IcuCursor *pCsr = (IcuCursor *)pCursor;

  int iStart = 0;
  int iEnd = 0;
  int nByte = 0;

  while( iStart==iEnd ){
    UChar32 c;

    iStart = ubrk_current(pCsr->pIter);
    iEnd = ubrk_next(pCsr->pIter);
    if( iEnd==UBRK_DONE ){
      return SQLITE_DONE;
    }

    while( iStart<iEnd ){
      int iWhite = iStart;
      U8_NEXT(pCsr->aChar, iWhite, pCsr->nChar, c);
      if( u_isspace(c) ){
        iStart = iWhite;
      }else{
        break;
      }
    }
    assert(iStart<=iEnd);
  }

  do {
    UErrorCode status = U_ZERO_ERROR;
    if( nByte ){
      char *zNew = sqlite3_realloc(pCsr->zBuffer, nByte);
      if( !zNew ){
        return SQLITE_NOMEM;
      }
      pCsr->zBuffer = zNew;
      pCsr->nBuffer = nByte;
    }

    u_strToUTF8(
        pCsr->zBuffer, pCsr->nBuffer, &nByte,    /* Output vars */
        &pCsr->aChar[iStart], iEnd-iStart,       /* Input vars */
        &status                                  /* Output success/failure */
    );
  } while( nByte>pCsr->nBuffer );

  *ppToken = pCsr->zBuffer;
  *pnBytes = nByte;
  *piStartOffset = pCsr->aOffset[iStart];
  *piEndOffset = pCsr->aOffset[iEnd];
  *piPosition = pCsr->iToken++;

  return SQLITE_OK;
}

/*
** The set of routines that implement the simple tokenizer
*/
static const sqlite3_tokenizer_module icuTokenizerModule = {
  0,                           /* iVersion */
  icuCreate,                   /* xCreate  */
  icuDestroy,                  /* xCreate  */
  icuOpen,                     /* xOpen    */
  icuClose,                    /* xClose   */
  icuNext,                     /* xNext    */
};

/*
** Set *ppModule to point at the implementation of the ICU tokenizer.
*/
void sqlite3Fts3IcuTokenizerModule(
  sqlite3_tokenizer_module const**ppModule
){
  *ppModule = &icuTokenizerModule;
}

#endif /* defined(SQLITE_ENABLE_ICU) */
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/fts3_porter.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
/*
** 2006 September 30
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Implementation of the full-text-search tokenizer that implements
** a Porter stemmer.
*/

/*
** The code in this file is only compiled if:
**
**     * The FTS3 module is being built as an extension
**       (in which case SQLITE_CORE is not defined), or
**
**     * The FTS3 module is being built into the core of
**       SQLite (in which case SQLITE_ENABLE_FTS3 is defined).
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)


#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

#include "fts3_tokenizer.h"

/*
** Class derived from sqlite3_tokenizer
*/
typedef struct porter_tokenizer {
  sqlite3_tokenizer base;      /* Base class */
} porter_tokenizer;

/*
** Class derived from sqlit3_tokenizer_cursor
*/
typedef struct porter_tokenizer_cursor {
  sqlite3_tokenizer_cursor base;
  const char *zInput;          /* input we are tokenizing */
  int nInput;                  /* size of the input */
  int iOffset;                 /* current position in zInput */
  int iToken;                  /* index of next token to be returned */
  char *zToken;                /* storage for current token */
  int nAllocated;              /* space allocated to zToken buffer */
} porter_tokenizer_cursor;


/* Forward declaration */
static const sqlite3_tokenizer_module porterTokenizerModule;


/*
** Create a new tokenizer instance.
*/
static int porterCreate(
  int argc, const char * const *argv,
  sqlite3_tokenizer **ppTokenizer
){
  porter_tokenizer *t;
  t = (porter_tokenizer *) sqlite3_malloc(sizeof(*t));
  if( t==NULL ) return SQLITE_NOMEM;
  memset(t, 0, sizeof(*t));
  *ppTokenizer = &t->base;
  return SQLITE_OK;
}

/*
** Destroy a tokenizer
*/
static int porterDestroy(sqlite3_tokenizer *pTokenizer){
  sqlite3_free(pTokenizer);
  return SQLITE_OK;
}

/*
** Prepare to begin tokenizing a particular string.  The input
** string to be tokenized is zInput[0..nInput-1].  A cursor
** used to incrementally tokenize this string is returned in 
** *ppCursor.
*/
static int porterOpen(
  sqlite3_tokenizer *pTokenizer,         /* The tokenizer */
  const char *zInput, int nInput,        /* String to be tokenized */
  sqlite3_tokenizer_cursor **ppCursor    /* OUT: Tokenization cursor */
){
  porter_tokenizer_cursor *c;

  c = (porter_tokenizer_cursor *) sqlite3_malloc(sizeof(*c));
  if( c==NULL ) return SQLITE_NOMEM;

  c->zInput = zInput;
  if( zInput==0 ){
    c->nInput = 0;
  }else if( nInput<0 ){
    c->nInput = (int)strlen(zInput);
  }else{
    c->nInput = nInput;
  }
  c->iOffset = 0;                 /* start tokenizing at the beginning */
  c->iToken = 0;
  c->zToken = NULL;               /* no space allocated, yet. */
  c->nAllocated = 0;

  *ppCursor = &c->base;
  return SQLITE_OK;
}

/*
** Close a tokenization cursor previously opened by a call to
** porterOpen() above.
*/
static int porterClose(sqlite3_tokenizer_cursor *pCursor){
  porter_tokenizer_cursor *c = (porter_tokenizer_cursor *) pCursor;
  sqlite3_free(c->zToken);
  sqlite3_free(c);
  return SQLITE_OK;
}
/*
** Vowel or consonant
*/
static const char cType[] = {
   0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0,
   1, 1, 1, 2, 1
};

/*
** isConsonant() and isVowel() determine if their first character in
** the string they point to is a consonant or a vowel, according
** to Porter ruls.  
**
** A consonate is any letter other than 'a', 'e', 'i', 'o', or 'u'.
** 'Y' is a consonant unless it follows another consonant,
** in which case it is a vowel.
**
** In these routine, the letters are in reverse order.  So the 'y' rule
** is that 'y' is a consonant unless it is followed by another
** consonent.
*/
static int isVowel(const char*);
static int isConsonant(const char *z){
  int j;
  char x = *z;
  if( x==0 ) return 0;
  assert( x>='a' && x<='z' );
  j = cType[x-'a'];
  if( j<2 ) return j;
  return z[1]==0 || isVowel(z + 1);
}
static int isVowel(const char *z){
  int j;
  char x = *z;
  if( x==0 ) return 0;
  assert( x>='a' && x<='z' );
  j = cType[x-'a'];
  if( j<2 ) return 1-j;
  return isConsonant(z + 1);
}

/*
** Let any sequence of one or more vowels be represented by V and let
** C be sequence of one or more consonants.  Then every word can be
** represented as:
**
**           [C] (VC){m} [V]
**
** In prose:  A word is an optional consonant followed by zero or
** vowel-consonant pairs followed by an optional vowel.  "m" is the
** number of vowel consonant pairs.  This routine computes the value
** of m for the first i bytes of a word.
**
** Return true if the m-value for z is 1 or more.  In other words,
** return true if z contains at least one vowel that is followed
** by a consonant.
**
** In this routine z[] is in reverse order.  So we are really looking
** for an instance of of a consonant followed by a vowel.
*/
static int m_gt_0(const char *z){
  while( isVowel(z) ){ z++; }
  if( *z==0 ) return 0;
  while( isConsonant(z) ){ z++; }
  return *z!=0;
}

/* Like mgt0 above except we are looking for a value of m which is
** exactly 1
*/
static int m_eq_1(const char *z){
  while( isVowel(z) ){ z++; }
  if( *z==0 ) return 0;
  while( isConsonant(z) ){ z++; }
  if( *z==0 ) return 0;
  while( isVowel(z) ){ z++; }
  if( *z==0 ) return 1;
  while( isConsonant(z) ){ z++; }
  return *z==0;
}

/* Like mgt0 above except we are looking for a value of m>1 instead
** or m>0
*/
static int m_gt_1(const char *z){
  while( isVowel(z) ){ z++; }
  if( *z==0 ) return 0;
  while( isConsonant(z) ){ z++; }
  if( *z==0 ) return 0;
  while( isVowel(z) ){ z++; }
  if( *z==0 ) return 0;
  while( isConsonant(z) ){ z++; }
  return *z!=0;
}

/*
** Return TRUE if there is a vowel anywhere within z[0..n-1]
*/
static int hasVowel(const char *z){
  while( isConsonant(z) ){ z++; }
  return *z!=0;
}

/*
** Return TRUE if the word ends in a double consonant.
**
** The text is reversed here. So we are really looking at
** the first two characters of z[].
*/
static int doubleConsonant(const char *z){
  return isConsonant(z) && z[0]==z[1] && isConsonant(z+1);
}

/*
** Return TRUE if the word ends with three letters which
** are consonant-vowel-consonent and where the final consonant
** is not 'w', 'x', or 'y'.
**
** The word is reversed here.  So we are really checking the
** first three letters and the first one cannot be in [wxy].
*/
static int star_oh(const char *z){
  return
    z[0]!=0 && isConsonant(z) &&
    z[0]!='w' && z[0]!='x' && z[0]!='y' &&
    z[1]!=0 && isVowel(z+1) &&
    z[2]!=0 && isConsonant(z+2);
}

/*
** If the word ends with zFrom and xCond() is true for the stem
** of the word that preceeds the zFrom ending, then change the 
** ending to zTo.
**
** The input word *pz and zFrom are both in reverse order.  zTo
** is in normal order. 
**
** Return TRUE if zFrom matches.  Return FALSE if zFrom does not
** match.  Not that TRUE is returned even if xCond() fails and
** no substitution occurs.
*/
static int stem(
  char **pz,             /* The word being stemmed (Reversed) */
  const char *zFrom,     /* If the ending matches this... (Reversed) */
  const char *zTo,       /* ... change the ending to this (not reversed) */
  int (*xCond)(const char*)   /* Condition that must be true */
){
  char *z = *pz;
  while( *zFrom && *zFrom==*z ){ z++; zFrom++; }
  if( *zFrom!=0 ) return 0;
  if( xCond && !xCond(z) ) return 1;
  while( *zTo ){
    *(--z) = *(zTo++);
  }
  *pz = z;
  return 1;
}

/*
** This is the fallback stemmer used when the porter stemmer is
** inappropriate.  The input word is copied into the output with
** US-ASCII case folding.  If the input word is too long (more
** than 20 bytes if it contains no digits or more than 6 bytes if
** it contains digits) then word is truncated to 20 or 6 bytes
** by taking 10 or 3 bytes from the beginning and end.
*/
static void copy_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){
  int i, mx, j;
  int hasDigit = 0;
  for(i=0; i<nIn; i++){
    int c = zIn[i];
    if( c>='A' && c<='Z' ){
      zOut[i] = c - 'A' + 'a';
    }else{
      if( c>='0' && c<='9' ) hasDigit = 1;
      zOut[i] = c;
    }
  }
  mx = hasDigit ? 3 : 10;
  if( nIn>mx*2 ){
    for(j=mx, i=nIn-mx; i<nIn; i++, j++){
      zOut[j] = zOut[i];
    }
    i = j;
  }
  zOut[i] = 0;
  *pnOut = i;
}


/*
** Stem the input word zIn[0..nIn-1].  Store the output in zOut.
** zOut is at least big enough to hold nIn bytes.  Write the actual
** size of the output word (exclusive of the '\0' terminator) into *pnOut.
**
** Any upper-case characters in the US-ASCII character set ([A-Z])
** are converted to lower case.  Upper-case UTF characters are
** unchanged.
**
** Words that are longer than about 20 bytes are stemmed by retaining
** a few bytes from the beginning and the end of the word.  If the
** word contains digits, 3 bytes are taken from the beginning and
** 3 bytes from the end.  For long words without digits, 10 bytes
** are taken from each end.  US-ASCII case folding still applies.
** 
** If the input word contains not digits but does characters not 
** in [a-zA-Z] then no stemming is attempted and this routine just 
** copies the input into the input into the output with US-ASCII
** case folding.
**
** Stemming never increases the length of the word.  So there is
** no chance of overflowing the zOut buffer.
*/
static void porter_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){
  int i, j, c;
  char zReverse[28];
  char *z, *z2;
  if( nIn<3 || nIn>=sizeof(zReverse)-7 ){
    /* The word is too big or too small for the porter stemmer.
    ** Fallback to the copy stemmer */
    copy_stemmer(zIn, nIn, zOut, pnOut);
    return;
  }
  for(i=0, j=sizeof(zReverse)-6; i<nIn; i++, j--){
    c = zIn[i];
    if( c>='A' && c<='Z' ){
      zReverse[j] = c + 'a' - 'A';
    }else if( c>='a' && c<='z' ){
      zReverse[j] = c;
    }else{
      /* The use of a character not in [a-zA-Z] means that we fallback
      ** to the copy stemmer */
      copy_stemmer(zIn, nIn, zOut, pnOut);
      return;
    }
  }
  memset(&zReverse[sizeof(zReverse)-5], 0, 5);
  z = &zReverse[j+1];


  /* Step 1a */
  if( z[0]=='s' ){
    if(
     !stem(&z, "sess", "ss", 0) &&
     !stem(&z, "sei", "i", 0)  &&
     !stem(&z, "ss", "ss", 0)
    ){
      z++;
    }
  }

  /* Step 1b */  
  z2 = z;
  if( stem(&z, "dee", "ee", m_gt_0) ){
    /* Do nothing.  The work was all in the test */
  }else if( 
     (stem(&z, "gni", "", hasVowel) || stem(&z, "de", "", hasVowel))
      && z!=z2
  ){
     if( stem(&z, "ta", "ate", 0) ||
         stem(&z, "lb", "ble", 0) ||
         stem(&z, "zi", "ize", 0) ){
       /* Do nothing.  The work was all in the test */
     }else if( doubleConsonant(z) && (*z!='l' && *z!='s' && *z!='z') ){
       z++;
     }else if( m_eq_1(z) && star_oh(z) ){
       *(--z) = 'e';
     }
  }

  /* Step 1c */
  if( z[0]=='y' && hasVowel(z+1) ){
    z[0] = 'i';
  }

  /* Step 2 */
  switch( z[1] ){
   case 'a':
     stem(&z, "lanoita", "ate", m_gt_0) ||
     stem(&z, "lanoit", "tion", m_gt_0);
     break;
   case 'c':
     stem(&z, "icne", "ence", m_gt_0) ||
     stem(&z, "icna", "ance", m_gt_0);
     break;
   case 'e':
     stem(&z, "rezi", "ize", m_gt_0);
     break;
   case 'g':
     stem(&z, "igol", "log", m_gt_0);
     break;
   case 'l':
     stem(&z, "ilb", "ble", m_gt_0) ||
     stem(&z, "illa", "al", m_gt_0) ||
     stem(&z, "iltne", "ent", m_gt_0) ||
     stem(&z, "ile", "e", m_gt_0) ||
     stem(&z, "ilsuo", "ous", m_gt_0);
     break;
   case 'o':
     stem(&z, "noitazi", "ize", m_gt_0) ||
     stem(&z, "noita", "ate", m_gt_0) ||
     stem(&z, "rota", "ate", m_gt_0);
     break;
   case 's':
     stem(&z, "msila", "al", m_gt_0) ||
     stem(&z, "ssenevi", "ive", m_gt_0) ||
     stem(&z, "ssenluf", "ful", m_gt_0) ||
     stem(&z, "ssensuo", "ous", m_gt_0);
     break;
   case 't':
     stem(&z, "itila", "al", m_gt_0) ||
     stem(&z, "itivi", "ive", m_gt_0) ||
     stem(&z, "itilib", "ble", m_gt_0);
     break;
  }

  /* Step 3 */
  switch( z[0] ){
   case 'e':
     stem(&z, "etaci", "ic", m_gt_0) ||
     stem(&z, "evita", "", m_gt_0)   ||
     stem(&z, "ezila", "al", m_gt_0);
     break;
   case 'i':
     stem(&z, "itici", "ic", m_gt_0);
     break;
   case 'l':
     stem(&z, "laci", "ic", m_gt_0) ||
     stem(&z, "luf", "", m_gt_0);
     break;
   case 's':
     stem(&z, "ssen", "", m_gt_0);
     break;
  }

  /* Step 4 */
  switch( z[1] ){
   case 'a':
     if( z[0]=='l' && m_gt_1(z+2) ){
       z += 2;
     }
     break;
   case 'c':
     if( z[0]=='e' && z[2]=='n' && (z[3]=='a' || z[3]=='e')  && m_gt_1(z+4)  ){
       z += 4;
     }
     break;
   case 'e':
     if( z[0]=='r' && m_gt_1(z+2) ){
       z += 2;
     }
     break;
   case 'i':
     if( z[0]=='c' && m_gt_1(z+2) ){
       z += 2;
     }
     break;
   case 'l':
     if( z[0]=='e' && z[2]=='b' && (z[3]=='a' || z[3]=='i') && m_gt_1(z+4) ){
       z += 4;
     }
     break;
   case 'n':
     if( z[0]=='t' ){
       if( z[2]=='a' ){
         if( m_gt_1(z+3) ){
           z += 3;
         }
       }else if( z[2]=='e' ){
         stem(&z, "tneme", "", m_gt_1) ||
         stem(&z, "tnem", "", m_gt_1) ||
         stem(&z, "tne", "", m_gt_1);
       }
     }
     break;
   case 'o':
     if( z[0]=='u' ){
       if( m_gt_1(z+2) ){
         z += 2;
       }
     }else if( z[3]=='s' || z[3]=='t' ){
       stem(&z, "noi", "", m_gt_1);
     }
     break;
   case 's':
     if( z[0]=='m' && z[2]=='i' && m_gt_1(z+3) ){
       z += 3;
     }
     break;
   case 't':
     stem(&z, "eta", "", m_gt_1) ||
     stem(&z, "iti", "", m_gt_1);
     break;
   case 'u':
     if( z[0]=='s' && z[2]=='o' && m_gt_1(z+3) ){
       z += 3;
     }
     break;
   case 'v':
   case 'z':
     if( z[0]=='e' && z[2]=='i' && m_gt_1(z+3) ){
       z += 3;
     }
     break;
  }

  /* Step 5a */
  if( z[0]=='e' ){
    if( m_gt_1(z+1) ){
      z++;
    }else if( m_eq_1(z+1) && !star_oh(z+1) ){
      z++;
    }
  }

  /* Step 5b */
  if( m_gt_1(z) && z[0]=='l' && z[1]=='l' ){
    z++;
  }

  /* z[] is now the stemmed word in reverse order.  Flip it back
  ** around into forward order and return.
  */
  *pnOut = i = strlen(z);
  zOut[i] = 0;
  while( *z ){
    zOut[--i] = *(z++);
  }
}

/*
** Characters that can be part of a token.  We assume any character
** whose value is greater than 0x80 (any UTF character) can be
** part of a token.  In other words, delimiters all must have
** values of 0x7f or lower.
*/
static const char porterIdChar[] = {
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  /* 3x */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 4x */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,  /* 5x */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 6x */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,  /* 7x */
};
#define isDelim(C) (((ch=C)&0x80)==0 && (ch<0x30 || !porterIdChar[ch-0x30]))

/*
** Extract the next token from a tokenization cursor.  The cursor must
** have been opened by a prior call to porterOpen().
*/
static int porterNext(
  sqlite3_tokenizer_cursor *pCursor,  /* Cursor returned by porterOpen */
  const char **pzToken,               /* OUT: *pzToken is the token text */
  int *pnBytes,                       /* OUT: Number of bytes in token */
  int *piStartOffset,                 /* OUT: Starting offset of token */
  int *piEndOffset,                   /* OUT: Ending offset of token */
  int *piPosition                     /* OUT: Position integer of token */
){
  porter_tokenizer_cursor *c = (porter_tokenizer_cursor *) pCursor;
  const char *z = c->zInput;

  while( c->iOffset<c->nInput ){
    int iStartOffset, ch;

    /* Scan past delimiter characters */
    while( c->iOffset<c->nInput && isDelim(z[c->iOffset]) ){
      c->iOffset++;
    }

    /* Count non-delimiter characters. */
    iStartOffset = c->iOffset;
    while( c->iOffset<c->nInput && !isDelim(z[c->iOffset]) ){
      c->iOffset++;
    }

    if( c->iOffset>iStartOffset ){
      int n = c->iOffset-iStartOffset;
      if( n>c->nAllocated ){
        c->nAllocated = n+20;
        c->zToken = sqlite3_realloc(c->zToken, c->nAllocated);
        if( c->zToken==NULL ) return SQLITE_NOMEM;
      }
      porter_stemmer(&z[iStartOffset], n, c->zToken, pnBytes);
      *pzToken = c->zToken;
      *piStartOffset = iStartOffset;
      *piEndOffset = c->iOffset;
      *piPosition = c->iToken++;
      return SQLITE_OK;
    }
  }
  return SQLITE_DONE;
}

/*
** The set of routines that implement the porter-stemmer tokenizer
*/
static const sqlite3_tokenizer_module porterTokenizerModule = {
  0,
  porterCreate,
  porterDestroy,
  porterOpen,
  porterClose,
  porterNext,
};

/*
** Allocate a new porter tokenizer.  Return a pointer to the new
** tokenizer in *ppModule
*/
void sqlite3Fts3PorterTokenizerModule(
  sqlite3_tokenizer_module const**ppModule
){
  *ppModule = &porterTokenizerModule;
}

#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/fts3_tokenizer.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
/*
** 2007 June 22
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This is part of an SQLite module implementing full-text search.
** This particular file implements the generic tokenizer interface.
*/

/*
** The code in this file is only compiled if:
**
**     * The FTS3 module is being built as an extension
**       (in which case SQLITE_CORE is not defined), or
**
**     * The FTS3 module is being built into the core of
**       SQLite (in which case SQLITE_ENABLE_FTS3 is defined).
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)

#include "sqlite3ext.h"
#ifndef SQLITE_CORE
  SQLITE_EXTENSION_INIT1
#endif

#include "fts3_hash.h"
#include "fts3_tokenizer.h"
#include <assert.h>

/*
** Implementation of the SQL scalar function for accessing the underlying 
** hash table. This function may be called as follows:
**
**   SELECT <function-name>(<key-name>);
**   SELECT <function-name>(<key-name>, <pointer>);
**
** where <function-name> is the name passed as the second argument
** to the sqlite3Fts3InitHashTable() function (e.g. 'fts3_tokenizer').
**
** If the <pointer> argument is specified, it must be a blob value
** containing a pointer to be stored as the hash data corresponding
** to the string <key-name>. If <pointer> is not specified, then
** the string <key-name> must already exist in the has table. Otherwise,
** an error is returned.
**
** Whether or not the <pointer> argument is specified, the value returned
** is a blob containing the pointer stored as the hash data corresponding
** to string <key-name> (after the hash-table is updated, if applicable).
*/
static void scalarFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  fts3Hash *pHash;
  void *pPtr = 0;
  const unsigned char *zName;
  int nName;

  assert( argc==1 || argc==2 );

  pHash = (fts3Hash *)sqlite3_user_data(context);

  zName = sqlite3_value_text(argv[0]);
  nName = sqlite3_value_bytes(argv[0])+1;

  if( argc==2 ){
    void *pOld;
    int n = sqlite3_value_bytes(argv[1]);
    if( n!=sizeof(pPtr) ){
      sqlite3_result_error(context, "argument type mismatch", -1);
      return;
    }
    pPtr = *(void **)sqlite3_value_blob(argv[1]);
    pOld = sqlite3Fts3HashInsert(pHash, (void *)zName, nName, pPtr);
    if( pOld==pPtr ){
      sqlite3_result_error(context, "out of memory", -1);
      return;
    }
  }else{
    pPtr = sqlite3Fts3HashFind(pHash, zName, nName);
    if( !pPtr ){
      char *zErr = sqlite3_mprintf("unknown tokenizer: %s", zName);
      sqlite3_result_error(context, zErr, -1);
      sqlite3_free(zErr);
      return;
    }
  }

  sqlite3_result_blob(context, (void *)&pPtr, sizeof(pPtr), SQLITE_TRANSIENT);
}

#ifdef SQLITE_TEST

#include <tcl.h>
#include <string.h>

/*
** Implementation of a special SQL scalar function for testing tokenizers 
** designed to be used in concert with the Tcl testing framework. This
** function must be called with two arguments:
**
**   SELECT <function-name>(<key-name>, <input-string>);
**   SELECT <function-name>(<key-name>, <pointer>);
**
** where <function-name> is the name passed as the second argument
** to the sqlite3Fts3InitHashTable() function (e.g. 'fts3_tokenizer')
** concatenated with the string '_test' (e.g. 'fts3_tokenizer_test').
**
** The return value is a string that may be interpreted as a Tcl
** list. For each token in the <input-string>, three elements are
** added to the returned list. The first is the token position, the 
** second is the token text (folded, stemmed, etc.) and the third is the
** substring of <input-string> associated with the token. For example, 
** using the built-in "simple" tokenizer:
**
**   SELECT fts_tokenizer_test('simple', 'I don't see how');
**
** will return the string:
**
**   "{0 i I 1 dont don't 2 see see 3 how how}"
**   
*/
static void testFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  fts3Hash *pHash;
  sqlite3_tokenizer_module *p;
  sqlite3_tokenizer *pTokenizer = 0;
  sqlite3_tokenizer_cursor *pCsr = 0;

  const char *zErr = 0;

  const char *zName;
  int nName;
  const char *zInput;
  int nInput;

  const char *zArg = 0;

  const char *zToken;
  int nToken;
  int iStart;
  int iEnd;
  int iPos;

  Tcl_Obj *pRet;

  assert( argc==2 || argc==3 );

  nName = sqlite3_value_bytes(argv[0]);
  zName = (const char *)sqlite3_value_text(argv[0]);
  nInput = sqlite3_value_bytes(argv[argc-1]);
  zInput = (const char *)sqlite3_value_text(argv[argc-1]);

  if( argc==3 ){
    zArg = (const char *)sqlite3_value_text(argv[1]);
  }

  pHash = (fts3Hash *)sqlite3_user_data(context);
  p = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash, zName, nName+1);

  if( !p ){
    char *zErr = sqlite3_mprintf("unknown tokenizer: %s", zName);
    sqlite3_result_error(context, zErr, -1);
    sqlite3_free(zErr);
    return;
  }

  pRet = Tcl_NewObj();
  Tcl_IncrRefCount(pRet);

  if( SQLITE_OK!=p->xCreate(zArg ? 1 : 0, &zArg, &pTokenizer) ){
    zErr = "error in xCreate()";
    goto finish;
  }
  pTokenizer->pModule = p;
  if( SQLITE_OK!=p->xOpen(pTokenizer, zInput, nInput, &pCsr) ){
    zErr = "error in xOpen()";
    goto finish;
  }
  pCsr->pTokenizer = pTokenizer;

  while( SQLITE_OK==p->xNext(pCsr, &zToken, &nToken, &iStart, &iEnd, &iPos) ){
    Tcl_ListObjAppendElement(0, pRet, Tcl_NewIntObj(iPos));
    Tcl_ListObjAppendElement(0, pRet, Tcl_NewStringObj(zToken, nToken));
    zToken = &zInput[iStart];
    nToken = iEnd-iStart;
    Tcl_ListObjAppendElement(0, pRet, Tcl_NewStringObj(zToken, nToken));
  }

  if( SQLITE_OK!=p->xClose(pCsr) ){
    zErr = "error in xClose()";
    goto finish;
  }
  if( SQLITE_OK!=p->xDestroy(pTokenizer) ){
    zErr = "error in xDestroy()";
    goto finish;
  }

finish:
  if( zErr ){
    sqlite3_result_error(context, zErr, -1);
  }else{
    sqlite3_result_text(context, Tcl_GetString(pRet), -1, SQLITE_TRANSIENT);
  }
  Tcl_DecrRefCount(pRet);
}

static
int registerTokenizer(
  sqlite3 *db, 
  char *zName, 
  const sqlite3_tokenizer_module *p
){
  int rc;
  sqlite3_stmt *pStmt;
  const char zSql[] = "SELECT fts3_tokenizer(?, ?)";

  rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
  if( rc!=SQLITE_OK ){
    return rc;
  }

  sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC);
  sqlite3_bind_blob(pStmt, 2, &p, sizeof(p), SQLITE_STATIC);
  sqlite3_step(pStmt);

  return sqlite3_finalize(pStmt);
}

static
int queryTokenizer(
  sqlite3 *db, 
  char *zName,  
  const sqlite3_tokenizer_module **pp
){
  int rc;
  sqlite3_stmt *pStmt;
  const char zSql[] = "SELECT fts3_tokenizer(?)";

  *pp = 0;
  rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
  if( rc!=SQLITE_OK ){
    return rc;
  }

  sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC);
  if( SQLITE_ROW==sqlite3_step(pStmt) ){
    if( sqlite3_column_type(pStmt, 0)==SQLITE_BLOB ){
      memcpy(pp, sqlite3_column_blob(pStmt, 0), sizeof(*pp));
    }
  }

  return sqlite3_finalize(pStmt);
}

void sqlite3Fts3SimpleTokenizerModule(sqlite3_tokenizer_module const**ppModule);

/*
** Implementation of the scalar function fts3_tokenizer_internal_test().
** This function is used for testing only, it is not included in the
** build unless SQLITE_TEST is defined.
**
** The purpose of this is to test that the fts3_tokenizer() function
** can be used as designed by the C-code in the queryTokenizer and
** registerTokenizer() functions above. These two functions are repeated
** in the README.tokenizer file as an example, so it is important to
** test them.
**
** To run the tests, evaluate the fts3_tokenizer_internal_test() scalar
** function with no arguments. An assert() will fail if a problem is
** detected. i.e.:
**
**     SELECT fts3_tokenizer_internal_test();
**
*/
static void intTestFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  int rc;
  const sqlite3_tokenizer_module *p1;
  const sqlite3_tokenizer_module *p2;
  sqlite3 *db = (sqlite3 *)sqlite3_user_data(context);

  /* Test the query function */
  sqlite3Fts3SimpleTokenizerModule(&p1);
  rc = queryTokenizer(db, "simple", &p2);
  assert( rc==SQLITE_OK );
  assert( p1==p2 );
  rc = queryTokenizer(db, "nosuchtokenizer", &p2);
  assert( rc==SQLITE_ERROR );
  assert( p2==0 );
  assert( 0==strcmp(sqlite3_errmsg(db), "unknown tokenizer: nosuchtokenizer") );

  /* Test the storage function */
  rc = registerTokenizer(db, "nosuchtokenizer", p1);
  assert( rc==SQLITE_OK );
  rc = queryTokenizer(db, "nosuchtokenizer", &p2);
  assert( rc==SQLITE_OK );
  assert( p2==p1 );

  sqlite3_result_text(context, "ok", -1, SQLITE_STATIC);
}

#endif

/*
** Set up SQL objects in database db used to access the contents of
** the hash table pointed to by argument pHash. The hash table must
** been initialised to use string keys, and to take a private copy 
** of the key when a value is inserted. i.e. by a call similar to:
**
**    sqlite3Fts3HashInit(pHash, FTS3_HASH_STRING, 1);
**
** This function adds a scalar function (see header comment above
** scalarFunc() in this file for details) and, if ENABLE_TABLE is
** defined at compilation time, a temporary virtual table (see header 
** comment above struct HashTableVtab) to the database schema. Both 
** provide read/write access to the contents of *pHash.
**
** The third argument to this function, zName, is used as the name
** of both the scalar and, if created, the virtual table.
*/
int sqlite3Fts3InitHashTable(
  sqlite3 *db, 
  fts3Hash *pHash, 
  const char *zName
){
  int rc = SQLITE_OK;
  void *p = (void *)pHash;
  const int any = SQLITE_ANY;
  char *zTest = 0;
  char *zTest2 = 0;

#ifdef SQLITE_TEST
  void *pdb = (void *)db;
  zTest = sqlite3_mprintf("%s_test", zName);
  zTest2 = sqlite3_mprintf("%s_internal_test", zName);
  if( !zTest || !zTest2 ){
    rc = SQLITE_NOMEM;
  }
#endif

  if( rc!=SQLITE_OK
   || (rc = sqlite3_create_function(db, zName, 1, any, p, scalarFunc, 0, 0))
   || (rc = sqlite3_create_function(db, zName, 2, any, p, scalarFunc, 0, 0))
#ifdef SQLITE_TEST
   || (rc = sqlite3_create_function(db, zTest, 2, any, p, testFunc, 0, 0))
   || (rc = sqlite3_create_function(db, zTest, 3, any, p, testFunc, 0, 0))
   || (rc = sqlite3_create_function(db, zTest2, 0, any, pdb, intTestFunc, 0, 0))
#endif
  );

  sqlite3_free(zTest);
  sqlite3_free(zTest2);
  return rc;
}

#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/fts3_tokenizer.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
** 2006 July 10
**
** The author disclaims copyright to this source code.
**
*************************************************************************
** Defines the interface to tokenizers used by fulltext-search.  There
** are three basic components:
**
** sqlite3_tokenizer_module is a singleton defining the tokenizer
** interface functions.  This is essentially the class structure for
** tokenizers.
**
** sqlite3_tokenizer is used to define a particular tokenizer, perhaps
** including customization information defined at creation time.
**
** sqlite3_tokenizer_cursor is generated by a tokenizer to generate
** tokens from a particular input.
*/
#ifndef _FTS3_TOKENIZER_H_
#define _FTS3_TOKENIZER_H_

/* TODO(shess) Only used for SQLITE_OK and SQLITE_DONE at this time.
** If tokenizers are to be allowed to call sqlite3_*() functions, then
** we will need a way to register the API consistently.
*/
#include "sqlite3.h"

/*
** Structures used by the tokenizer interface. When a new tokenizer
** implementation is registered, the caller provides a pointer to
** an sqlite3_tokenizer_module containing pointers to the callback
** functions that make up an implementation.
**
** When an fts3 table is created, it passes any arguments passed to
** the tokenizer clause of the CREATE VIRTUAL TABLE statement to the
** sqlite3_tokenizer_module.xCreate() function of the requested tokenizer
** implementation. The xCreate() function in turn returns an 
** sqlite3_tokenizer structure representing the specific tokenizer to
** be used for the fts3 table (customized by the tokenizer clause arguments).
**
** To tokenize an input buffer, the sqlite3_tokenizer_module.xOpen()
** method is called. It returns an sqlite3_tokenizer_cursor object
** that may be used to tokenize a specific input buffer based on
** the tokenization rules supplied by a specific sqlite3_tokenizer
** object.
*/
typedef struct sqlite3_tokenizer_module sqlite3_tokenizer_module;
typedef struct sqlite3_tokenizer sqlite3_tokenizer;
typedef struct sqlite3_tokenizer_cursor sqlite3_tokenizer_cursor;

struct sqlite3_tokenizer_module {

  /*
  ** Structure version. Should always be set to 0.
  */
  int iVersion;

  /*
  ** Create a new tokenizer. The values in the argv[] array are the
  ** arguments passed to the "tokenizer" clause of the CREATE VIRTUAL
  ** TABLE statement that created the fts3 table. For example, if
  ** the following SQL is executed:
  **
  **   CREATE .. USING fts3( ... , tokenizer <tokenizer-name> arg1 arg2)
  **
  ** then argc is set to 2, and the argv[] array contains pointers
  ** to the strings "arg1" and "arg2".
  **
  ** This method should return either SQLITE_OK (0), or an SQLite error 
  ** code. If SQLITE_OK is returned, then *ppTokenizer should be set
  ** to point at the newly created tokenizer structure. The generic
  ** sqlite3_tokenizer.pModule variable should not be initialised by
  ** this callback. The caller will do so.
  */
  int (*xCreate)(
    int argc,                           /* Size of argv array */
    const char *const*argv,             /* Tokenizer argument strings */
    sqlite3_tokenizer **ppTokenizer     /* OUT: Created tokenizer */
  );

  /*
  ** Destroy an existing tokenizer. The fts3 module calls this method
  ** exactly once for each successful call to xCreate().
  */
  int (*xDestroy)(sqlite3_tokenizer *pTokenizer);

  /*
  ** Create a tokenizer cursor to tokenize an input buffer. The caller
  ** is responsible for ensuring that the input buffer remains valid
  ** until the cursor is closed (using the xClose() method). 
  */
  int (*xOpen)(
    sqlite3_tokenizer *pTokenizer,       /* Tokenizer object */
    const char *pInput, int nBytes,      /* Input buffer */
    sqlite3_tokenizer_cursor **ppCursor  /* OUT: Created tokenizer cursor */
  );

  /*
  ** Destroy an existing tokenizer cursor. The fts3 module calls this 
  ** method exactly once for each successful call to xOpen().
  */
  int (*xClose)(sqlite3_tokenizer_cursor *pCursor);

  /*
  ** Retrieve the next token from the tokenizer cursor pCursor. This
  ** method should either return SQLITE_OK and set the values of the
  ** "OUT" variables identified below, or SQLITE_DONE to indicate that
  ** the end of the buffer has been reached, or an SQLite error code.
  **
  ** *ppToken should be set to point at a buffer containing the 
  ** normalized version of the token (i.e. after any case-folding and/or
  ** stemming has been performed). *pnBytes should be set to the length
  ** of this buffer in bytes. The input text that generated the token is
  ** identified by the byte offsets returned in *piStartOffset and
  ** *piEndOffset.
  **
  ** The buffer *ppToken is set to point at is managed by the tokenizer
  ** implementation. It is only required to be valid until the next call
  ** to xNext() or xClose(). 
  */
  /* TODO(shess) current implementation requires pInput to be
  ** nul-terminated.  This should either be fixed, or pInput/nBytes
  ** should be converted to zInput.
  */
  int (*xNext)(
    sqlite3_tokenizer_cursor *pCursor,   /* Tokenizer cursor */
    const char **ppToken, int *pnBytes,  /* OUT: Normalized text for token */
    int *piStartOffset,  /* OUT: Byte offset of token in input buffer */
    int *piEndOffset,    /* OUT: Byte offset of end of token in input buffer */
    int *piPosition      /* OUT: Number of tokens returned before this one */
  );
};

struct sqlite3_tokenizer {
  const sqlite3_tokenizer_module *pModule;  /* The module for this tokenizer */
  /* Tokenizer implementations will typically add additional fields */
};

struct sqlite3_tokenizer_cursor {
  sqlite3_tokenizer *pTokenizer;       /* Tokenizer for this cursor. */
  /* Tokenizer implementations will typically add additional fields */
};

#endif /* _FTS3_TOKENIZER_H_ */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































Deleted SQLite.Interop/splitsource/fts3_tokenizer1.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
/*
** 2006 Oct 10
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** Implementation of the "simple" full-text-search tokenizer.
*/

/*
** The code in this file is only compiled if:
**
**     * The FTS3 module is being built as an extension
**       (in which case SQLITE_CORE is not defined), or
**
**     * The FTS3 module is being built into the core of
**       SQLite (in which case SQLITE_ENABLE_FTS3 is defined).
*/
#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3)


#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>

#include "fts3_tokenizer.h"

typedef struct simple_tokenizer {
  sqlite3_tokenizer base;
  char delim[128];             /* flag ASCII delimiters */
} simple_tokenizer;

typedef struct simple_tokenizer_cursor {
  sqlite3_tokenizer_cursor base;
  const char *pInput;          /* input we are tokenizing */
  int nBytes;                  /* size of the input */
  int iOffset;                 /* current position in pInput */
  int iToken;                  /* index of next token to be returned */
  char *pToken;                /* storage for current token */
  int nTokenAllocated;         /* space allocated to zToken buffer */
} simple_tokenizer_cursor;


/* Forward declaration */
static const sqlite3_tokenizer_module simpleTokenizerModule;

static int simpleDelim(simple_tokenizer *t, unsigned char c){
  return c<0x80 && t->delim[c];
}

/*
** Create a new tokenizer instance.
*/
static int simpleCreate(
  int argc, const char * const *argv,
  sqlite3_tokenizer **ppTokenizer
){
  simple_tokenizer *t;

  t = (simple_tokenizer *) sqlite3_malloc(sizeof(*t));
  if( t==NULL ) return SQLITE_NOMEM;
  memset(t, 0, sizeof(*t));

  /* TODO(shess) Delimiters need to remain the same from run to run,
  ** else we need to reindex.  One solution would be a meta-table to
  ** track such information in the database, then we'd only want this
  ** information on the initial create.
  */
  if( argc>1 ){
    int i, n = strlen(argv[1]);
    for(i=0; i<n; i++){
      unsigned char ch = argv[1][i];
      /* We explicitly don't support UTF-8 delimiters for now. */
      if( ch>=0x80 ){
        sqlite3_free(t);
        return SQLITE_ERROR;
      }
      t->delim[ch] = 1;
    }
  } else {
    /* Mark non-alphanumeric ASCII characters as delimiters */
    int i;
    for(i=1; i<0x80; i++){
      t->delim[i] = !isalnum(i);
    }
  }

  *ppTokenizer = &t->base;
  return SQLITE_OK;
}

/*
** Destroy a tokenizer
*/
static int simpleDestroy(sqlite3_tokenizer *pTokenizer){
  sqlite3_free(pTokenizer);
  return SQLITE_OK;
}

/*
** Prepare to begin tokenizing a particular string.  The input
** string to be tokenized is pInput[0..nBytes-1].  A cursor
** used to incrementally tokenize this string is returned in 
** *ppCursor.
*/
static int simpleOpen(
  sqlite3_tokenizer *pTokenizer,         /* The tokenizer */
  const char *pInput, int nBytes,        /* String to be tokenized */
  sqlite3_tokenizer_cursor **ppCursor    /* OUT: Tokenization cursor */
){
  simple_tokenizer_cursor *c;

  c = (simple_tokenizer_cursor *) sqlite3_malloc(sizeof(*c));
  if( c==NULL ) return SQLITE_NOMEM;

  c->pInput = pInput;
  if( pInput==0 ){
    c->nBytes = 0;
  }else if( nBytes<0 ){
    c->nBytes = (int)strlen(pInput);
  }else{
    c->nBytes = nBytes;
  }
  c->iOffset = 0;                 /* start tokenizing at the beginning */
  c->iToken = 0;
  c->pToken = NULL;               /* no space allocated, yet. */
  c->nTokenAllocated = 0;

  *ppCursor = &c->base;
  return SQLITE_OK;
}

/*
** Close a tokenization cursor previously opened by a call to
** simpleOpen() above.
*/
static int simpleClose(sqlite3_tokenizer_cursor *pCursor){
  simple_tokenizer_cursor *c = (simple_tokenizer_cursor *) pCursor;
  sqlite3_free(c->pToken);
  sqlite3_free(c);
  return SQLITE_OK;
}

/*
** Extract the next token from a tokenization cursor.  The cursor must
** have been opened by a prior call to simpleOpen().
*/
static int simpleNext(
  sqlite3_tokenizer_cursor *pCursor,  /* Cursor returned by simpleOpen */
  const char **ppToken,               /* OUT: *ppToken is the token text */
  int *pnBytes,                       /* OUT: Number of bytes in token */
  int *piStartOffset,                 /* OUT: Starting offset of token */
  int *piEndOffset,                   /* OUT: Ending offset of token */
  int *piPosition                     /* OUT: Position integer of token */
){
  simple_tokenizer_cursor *c = (simple_tokenizer_cursor *) pCursor;
  simple_tokenizer *t = (simple_tokenizer *) pCursor->pTokenizer;
  unsigned char *p = (unsigned char *)c->pInput;

  while( c->iOffset<c->nBytes ){
    int iStartOffset;

    /* Scan past delimiter characters */
    while( c->iOffset<c->nBytes && simpleDelim(t, p[c->iOffset]) ){
      c->iOffset++;
    }

    /* Count non-delimiter characters. */
    iStartOffset = c->iOffset;
    while( c->iOffset<c->nBytes && !simpleDelim(t, p[c->iOffset]) ){
      c->iOffset++;
    }

    if( c->iOffset>iStartOffset ){
      int i, n = c->iOffset-iStartOffset;
      if( n>c->nTokenAllocated ){
        c->nTokenAllocated = n+20;
        c->pToken = sqlite3_realloc(c->pToken, c->nTokenAllocated);
        if( c->pToken==NULL ) return SQLITE_NOMEM;
      }
      for(i=0; i<n; i++){
        /* TODO(shess) This needs expansion to handle UTF-8
        ** case-insensitivity.
        */
        unsigned char ch = p[iStartOffset+i];
        c->pToken[i] = ch<0x80 ? tolower(ch) : ch;
      }
      *ppToken = c->pToken;
      *pnBytes = n;
      *piStartOffset = iStartOffset;
      *piEndOffset = c->iOffset;
      *piPosition = c->iToken++;

      return SQLITE_OK;
    }
  }
  return SQLITE_DONE;
}

/*
** The set of routines that implement the simple tokenizer
*/
static const sqlite3_tokenizer_module simpleTokenizerModule = {
  0,
  simpleCreate,
  simpleDestroy,
  simpleOpen,
  simpleClose,
  simpleNext,
};

/*
** Allocate a new simple tokenizer.  Return a pointer to the new
** tokenizer in *ppModule
*/
void sqlite3Fts3SimpleTokenizerModule(
  sqlite3_tokenizer_module const**ppModule
){
  *ppModule = &simpleTokenizerModule;
}

#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/func.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
/*
** 2002 February 23
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains the C functions that implement various SQL
** functions of SQLite.  
**
** There is only one exported symbol in this file - the function
** sqliteRegisterBuildinFunctions() found at the bottom of the file.
** All other code has file scope.
**
** $Id: func.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
#include <stdlib.h>
#include <assert.h>
#include "vdbeInt.h"


/*
** Return the collating function associated with a function.
*/
static CollSeq *sqlite3GetFuncCollSeq(sqlite3_context *context){
  return context->pColl;
}

/*
** Implementation of the non-aggregate min() and max() functions
*/
static void minmaxFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  int i;
  int mask;    /* 0 for min() or 0xffffffff for max() */
  int iBest;
  CollSeq *pColl;

  if( argc==0 ) return;
  mask = sqlite3_user_data(context)==0 ? 0 : -1;
  pColl = sqlite3GetFuncCollSeq(context);
  assert( pColl );
  assert( mask==-1 || mask==0 );
  iBest = 0;
  if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
  for(i=1; i<argc; i++){
    if( sqlite3_value_type(argv[i])==SQLITE_NULL ) return;
    if( (sqlite3MemCompare(argv[iBest], argv[i], pColl)^mask)>=0 ){
      iBest = i;
    }
  }
  sqlite3_result_value(context, argv[iBest]);
}

/*
** Return the type of the argument.
*/
static void typeofFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  const char *z = 0;
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_NULL:    z = "null";    break;
    case SQLITE_INTEGER: z = "integer"; break;
    case SQLITE_TEXT:    z = "text";    break;
    case SQLITE_FLOAT:   z = "real";    break;
    case SQLITE_BLOB:    z = "blob";    break;
  }
  sqlite3_result_text(context, z, -1, SQLITE_STATIC);
}


/*
** Implementation of the length() function
*/
static void lengthFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  int len;

  assert( argc==1 );
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_BLOB:
    case SQLITE_INTEGER:
    case SQLITE_FLOAT: {
      sqlite3_result_int(context, sqlite3_value_bytes(argv[0]));
      break;
    }
    case SQLITE_TEXT: {
      const unsigned char *z = sqlite3_value_text(argv[0]);
      if( z==0 ) return;
      len = 0;
      while( *z ){
        len++;
        SQLITE_SKIP_UTF8(z);
      }
      sqlite3_result_int(context, len);
      break;
    }
    default: {
      sqlite3_result_null(context);
      break;
    }
  }
}

/*
** Implementation of the abs() function
*/
static void absFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  assert( argc==1 );
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_INTEGER: {
      i64 iVal = sqlite3_value_int64(argv[0]);
      if( iVal<0 ){
        if( (iVal<<1)==0 ){
          sqlite3_result_error(context, "integer overflow", -1);
          return;
        }
        iVal = -iVal;
      } 
      sqlite3_result_int64(context, iVal);
      break;
    }
    case SQLITE_NULL: {
      sqlite3_result_null(context);
      break;
    }
    default: {
      double rVal = sqlite3_value_double(argv[0]);
      if( rVal<0 ) rVal = -rVal;
      sqlite3_result_double(context, rVal);
      break;
    }
  }
}

/*
** Implementation of the substr() function.
**
** substr(x,p1,p2)  returns p2 characters of x[] beginning with p1.
** p1 is 1-indexed.  So substr(x,1,1) returns the first character
** of x.  If x is text, then we actually count UTF-8 characters.
** If x is a blob, then we count bytes.
**
** If p1 is negative, then we begin abs(p1) from the end of x[].
*/
static void substrFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  const unsigned char *z;
  const unsigned char *z2;
  int len;
  int p0type;
  i64 p1, p2;

  assert( argc==3 || argc==2 );
  p0type = sqlite3_value_type(argv[0]);
  if( p0type==SQLITE_BLOB ){
    len = sqlite3_value_bytes(argv[0]);
    z = sqlite3_value_blob(argv[0]);
    if( z==0 ) return;
    assert( len==sqlite3_value_bytes(argv[0]) );
  }else{
    z = sqlite3_value_text(argv[0]);
    if( z==0 ) return;
    len = 0;
    for(z2=z; *z2; len++){
      SQLITE_SKIP_UTF8(z2);
    }
  }
  p1 = sqlite3_value_int(argv[1]);
  if( argc==3 ){
    p2 = sqlite3_value_int(argv[2]);
  }else{
    p2 = sqlite3_context_db_handle(context)->aLimit[SQLITE_LIMIT_LENGTH];
  }
  if( p1<0 ){
    p1 += len;
    if( p1<0 ){
      p2 += p1;
      p1 = 0;
    }
  }else if( p1>0 ){
    p1--;
  }
  if( p1+p2>len ){
    p2 = len-p1;
  }
  if( p0type!=SQLITE_BLOB ){
    while( *z && p1 ){
      SQLITE_SKIP_UTF8(z);
      p1--;
    }
    for(z2=z; *z2 && p2; p2--){
      SQLITE_SKIP_UTF8(z2);
    }
    sqlite3_result_text(context, (char*)z, z2-z, SQLITE_TRANSIENT);
  }else{
    if( p2<0 ) p2 = 0;
    sqlite3_result_blob(context, (char*)&z[p1], p2, SQLITE_TRANSIENT);
  }
}

/*
** Implementation of the round() function
*/
static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  int n = 0;
  double r;
  char zBuf[500];  /* larger than the %f representation of the largest double */
  assert( argc==1 || argc==2 );
  if( argc==2 ){
    if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return;
    n = sqlite3_value_int(argv[1]);
    if( n>30 ) n = 30;
    if( n<0 ) n = 0;
  }
  if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
  r = sqlite3_value_double(argv[0]);
  sqlite3_snprintf(sizeof(zBuf),zBuf,"%.*f",n,r);
  sqlite3AtoF(zBuf, &r);
  sqlite3_result_double(context, r);
}

/*
** Allocate nByte bytes of space using sqlite3_malloc(). If the
** allocation fails, call sqlite3_result_error_nomem() to notify
** the database handle that malloc() has failed.
*/
static void *contextMalloc(sqlite3_context *context, i64 nByte){
  char *z;
  if( nByte>sqlite3_context_db_handle(context)->aLimit[SQLITE_LIMIT_LENGTH] ){
    sqlite3_result_error_toobig(context);
    z = 0;
  }else{
    z = sqlite3Malloc(nByte);
    if( !z && nByte>0 ){
      sqlite3_result_error_nomem(context);
    }
  }
  return z;
}

/*
** Implementation of the upper() and lower() SQL functions.
*/
static void upperFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  char *z1;
  const char *z2;
  int i, n;
  if( argc<1 || SQLITE_NULL==sqlite3_value_type(argv[0]) ) return;
  z2 = (char*)sqlite3_value_text(argv[0]);
  n = sqlite3_value_bytes(argv[0]);
  /* Verify that the call to _bytes() does not invalidate the _text() pointer */
  assert( z2==(char*)sqlite3_value_text(argv[0]) );
  if( z2 ){
    z1 = contextMalloc(context, ((i64)n)+1);
    if( z1 ){
      memcpy(z1, z2, n+1);
      for(i=0; z1[i]; i++){
        z1[i] = toupper(z1[i]);
      }
      sqlite3_result_text(context, z1, -1, sqlite3_free);
    }
  }
}
static void lowerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  char *z1;
  const char *z2;
  int i, n;
  if( argc<1 || SQLITE_NULL==sqlite3_value_type(argv[0]) ) return;
  z2 = (char*)sqlite3_value_text(argv[0]);
  n = sqlite3_value_bytes(argv[0]);
  /* Verify that the call to _bytes() does not invalidate the _text() pointer */
  assert( z2==(char*)sqlite3_value_text(argv[0]) );
  if( z2 ){
    z1 = contextMalloc(context, ((i64)n)+1);
    if( z1 ){
      memcpy(z1, z2, n+1);
      for(i=0; z1[i]; i++){
        z1[i] = tolower(z1[i]);
      }
      sqlite3_result_text(context, z1, -1, sqlite3_free);
    }
  }
}

/*
** Implementation of the IFNULL(), NVL(), and COALESCE() functions.  
** All three do the same thing.  They return the first non-NULL
** argument.
*/
static void ifnullFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  int i;
  for(i=0; i<argc; i++){
    if( SQLITE_NULL!=sqlite3_value_type(argv[i]) ){
      sqlite3_result_value(context, argv[i]);
      break;
    }
  }
}

/*
** Implementation of random().  Return a random integer.  
*/
static void randomFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  sqlite_int64 r;
  sqlite3_randomness(sizeof(r), &r);
  if( (r<<1)==0 ) r = 0;  /* Prevent 0x8000.... as the result so that we */
                          /* can always do abs() of the result */
  sqlite3_result_int64(context, r);
}

/*
** Implementation of randomblob(N).  Return a random blob
** that is N bytes long.
*/
static void randomBlob(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  int n;
  unsigned char *p;
  assert( argc==1 );
  n = sqlite3_value_int(argv[0]);
  if( n<1 ){
    n = 1;
  }
  p = contextMalloc(context, n);
  if( p ){
    sqlite3_randomness(n, p);
    sqlite3_result_blob(context, (char*)p, n, sqlite3_free);
  }
}

/*
** Implementation of the last_insert_rowid() SQL function.  The return
** value is the same as the sqlite3_last_insert_rowid() API function.
*/
static void last_insert_rowid(
  sqlite3_context *context, 
  int arg, 
  sqlite3_value **argv
){
  sqlite3 *db = sqlite3_context_db_handle(context);
  sqlite3_result_int64(context, sqlite3_last_insert_rowid(db));
}

/*
** Implementation of the changes() SQL function.  The return value is the
** same as the sqlite3_changes() API function.
*/
static void changes(
  sqlite3_context *context,
  int arg,
  sqlite3_value **argv
){
  sqlite3 *db = sqlite3_context_db_handle(context);
  sqlite3_result_int(context, sqlite3_changes(db));
}

/*
** Implementation of the total_changes() SQL function.  The return value is
** the same as the sqlite3_total_changes() API function.
*/
static void total_changes(
  sqlite3_context *context,
  int arg,
  sqlite3_value **argv
){
  sqlite3 *db = sqlite3_context_db_handle(context);
  sqlite3_result_int(context, sqlite3_total_changes(db));
}

/*
** A structure defining how to do GLOB-style comparisons.
*/
struct compareInfo {
  u8 matchAll;
  u8 matchOne;
  u8 matchSet;
  u8 noCase;
};

/*
** For LIKE and GLOB matching on EBCDIC machines, assume that every
** character is exactly one byte in size.  Also, all characters are
** able to participate in upper-case-to-lower-case mappings in EBCDIC
** whereas only characters less than 0x80 do in ASCII.
*/
#if defined(SQLITE_EBCDIC)
# define sqlite3Utf8Read(A,B,C)  (*(A++))
# define GlogUpperToLower(A)     A = sqlite3UpperToLower[A]
#else
# define GlogUpperToLower(A)     if( A<0x80 ){ A = sqlite3UpperToLower[A]; }
#endif

static const struct compareInfo globInfo = { '*', '?', '[', 0 };
/* The correct SQL-92 behavior is for the LIKE operator to ignore
** case.  Thus  'a' LIKE 'A' would be true. */
static const struct compareInfo likeInfoNorm = { '%', '_',   0, 1 };
/* If SQLITE_CASE_SENSITIVE_LIKE is defined, then the LIKE operator
** is case sensitive causing 'a' LIKE 'A' to be false */
static const struct compareInfo likeInfoAlt = { '%', '_',   0, 0 };

/*
** Compare two UTF-8 strings for equality where the first string can
** potentially be a "glob" expression.  Return true (1) if they
** are the same and false (0) if they are different.
**
** Globbing rules:
**
**      '*'       Matches any sequence of zero or more characters.
**
**      '?'       Matches exactly one character.
**
**     [...]      Matches one character from the enclosed list of
**                characters.
**
**     [^...]     Matches one character not in the enclosed list.
**
** With the [...] and [^...] matching, a ']' character can be included
** in the list by making it the first character after '[' or '^'.  A
** range of characters can be specified using '-'.  Example:
** "[a-z]" matches any single lower-case letter.  To match a '-', make
** it the last character in the list.
**
** This routine is usually quick, but can be N**2 in the worst case.
**
** Hints: to match '*' or '?', put them in "[]".  Like this:
**
**         abc[*]xyz        Matches "abc*xyz" only
*/
static int patternCompare(
  const u8 *zPattern,              /* The glob pattern */
  const u8 *zString,               /* The string to compare against the glob */
  const struct compareInfo *pInfo, /* Information about how to do the compare */
  const int esc                    /* The escape character */
){
  int c, c2;
  int invert;
  int seen;
  u8 matchOne = pInfo->matchOne;
  u8 matchAll = pInfo->matchAll;
  u8 matchSet = pInfo->matchSet;
  u8 noCase = pInfo->noCase; 
  int prevEscape = 0;     /* True if the previous character was 'escape' */

  while( (c = sqlite3Utf8Read(zPattern,0,&zPattern))!=0 ){
    if( !prevEscape && c==matchAll ){
      while( (c=sqlite3Utf8Read(zPattern,0,&zPattern)) == matchAll
               || c == matchOne ){
        if( c==matchOne && sqlite3Utf8Read(zString, 0, &zString)==0 ){
          return 0;
        }
      }
      if( c==0 ){
        return 1;
      }else if( c==esc ){
        c = sqlite3Utf8Read(zPattern, 0, &zPattern);
        if( c==0 ){
          return 0;
        }
      }else if( c==matchSet ){
        assert( esc==0 );         /* This is GLOB, not LIKE */
        assert( matchSet<0x80 );  /* '[' is a single-byte character */
        while( *zString && patternCompare(&zPattern[-1],zString,pInfo,esc)==0 ){
          SQLITE_SKIP_UTF8(zString);
        }
        return *zString!=0;
      }
      while( (c2 = sqlite3Utf8Read(zString,0,&zString))!=0 ){
        if( noCase ){
          GlogUpperToLower(c2);
          GlogUpperToLower(c);
          while( c2 != 0 && c2 != c ){
            c2 = sqlite3Utf8Read(zString, 0, &zString);
            GlogUpperToLower(c2);
          }
        }else{
          while( c2 != 0 && c2 != c ){
            c2 = sqlite3Utf8Read(zString, 0, &zString);
          }
        }
        if( c2==0 ) return 0;
        if( patternCompare(zPattern,zString,pInfo,esc) ) return 1;
      }
      return 0;
    }else if( !prevEscape && c==matchOne ){
      if( sqlite3Utf8Read(zString, 0, &zString)==0 ){
        return 0;
      }
    }else if( c==matchSet ){
      int prior_c = 0;
      assert( esc==0 );    /* This only occurs for GLOB, not LIKE */
      seen = 0;
      invert = 0;
      c = sqlite3Utf8Read(zString, 0, &zString);
      if( c==0 ) return 0;
      c2 = sqlite3Utf8Read(zPattern, 0, &zPattern);
      if( c2=='^' ){
        invert = 1;
        c2 = sqlite3Utf8Read(zPattern, 0, &zPattern);
      }
      if( c2==']' ){
        if( c==']' ) seen = 1;
        c2 = sqlite3Utf8Read(zPattern, 0, &zPattern);
      }
      while( c2 && c2!=']' ){
        if( c2=='-' && zPattern[0]!=']' && zPattern[0]!=0 && prior_c>0 ){
          c2 = sqlite3Utf8Read(zPattern, 0, &zPattern);
          if( c>=prior_c && c<=c2 ) seen = 1;
          prior_c = 0;
        }else{
          if( c==c2 ){
            seen = 1;
          }
          prior_c = c2;
        }
        c2 = sqlite3Utf8Read(zPattern, 0, &zPattern);
      }
      if( c2==0 || (seen ^ invert)==0 ){
        return 0;
      }
    }else if( esc==c && !prevEscape ){
      prevEscape = 1;
    }else{
      c2 = sqlite3Utf8Read(zString, 0, &zString);
      if( noCase ){
        GlogUpperToLower(c);
        GlogUpperToLower(c2);
      }
      if( c!=c2 ){
        return 0;
      }
      prevEscape = 0;
    }
  }
  return *zString==0;
}

/*
** Count the number of times that the LIKE operator (or GLOB which is
** just a variation of LIKE) gets called.  This is used for testing
** only.
*/
#ifdef SQLITE_TEST
int sqlite3_like_count = 0;
#endif


/*
** Implementation of the like() SQL function.  This function implements
** the build-in LIKE operator.  The first argument to the function is the
** pattern and the second argument is the string.  So, the SQL statements:
**
**       A LIKE B
**
** is implemented as like(B,A).
**
** This same function (with a different compareInfo structure) computes
** the GLOB operator.
*/
static void likeFunc(
  sqlite3_context *context, 
  int argc, 
  sqlite3_value **argv
){
  const unsigned char *zA, *zB;
  int escape = 0;
  sqlite3 *db = sqlite3_context_db_handle(context);

  zB = sqlite3_value_text(argv[0]);
  zA = sqlite3_value_text(argv[1]);

  /* Limit the length of the LIKE or GLOB pattern to avoid problems
  ** of deep recursion and N*N behavior in patternCompare().
  */
  if( sqlite3_value_bytes(argv[0]) >
        db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] ){
    sqlite3_result_error(context, "LIKE or GLOB pattern too complex", -1);
    return;
  }
  assert( zB==sqlite3_value_text(argv[0]) );  /* Encoding did not change */

  if( argc==3 ){
    /* The escape character string must consist of a single UTF-8 character.
    ** Otherwise, return an error.
    */
    const unsigned char *zEsc = sqlite3_value_text(argv[2]);
    if( zEsc==0 ) return;
    if( sqlite3Utf8CharLen((char*)zEsc, -1)!=1 ){
      sqlite3_result_error(context, 
          "ESCAPE expression must be a single character", -1);
      return;
    }
    escape = sqlite3Utf8Read(zEsc, 0, &zEsc);
  }
  if( zA && zB ){
    struct compareInfo *pInfo = sqlite3_user_data(context);
#ifdef SQLITE_TEST
    sqlite3_like_count++;
#endif
    
    sqlite3_result_int(context, patternCompare(zB, zA, pInfo, escape));
  }
}

/*
** Implementation of the NULLIF(x,y) function.  The result is the first
** argument if the arguments are different.  The result is NULL if the
** arguments are equal to each other.
*/
static void nullifFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  CollSeq *pColl = sqlite3GetFuncCollSeq(context);
  if( sqlite3MemCompare(argv[0], argv[1], pColl)!=0 ){
    sqlite3_result_value(context, argv[0]);
  }
}

/*
** Implementation of the VERSION(*) function.  The result is the version
** of the SQLite library that is running.
*/
static void versionFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  sqlite3_result_text(context, sqlite3_version, -1, SQLITE_STATIC);
}

/* Array for converting from half-bytes (nybbles) into ASCII hex
** digits. */
static const char hexdigits[] = {
  '0', '1', '2', '3', '4', '5', '6', '7',
  '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' 
};

/*
** EXPERIMENTAL - This is not an official function.  The interface may
** change.  This function may disappear.  Do not write code that depends
** on this function.
**
** Implementation of the QUOTE() function.  This function takes a single
** argument.  If the argument is numeric, the return value is the same as
** the argument.  If the argument is NULL, the return value is the string
** "NULL".  Otherwise, the argument is enclosed in single quotes with
** single-quote escapes.
*/
static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  if( argc<1 ) return;
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_NULL: {
      sqlite3_result_text(context, "NULL", 4, SQLITE_STATIC);
      break;
    }
    case SQLITE_INTEGER:
    case SQLITE_FLOAT: {
      sqlite3_result_value(context, argv[0]);
      break;
    }
    case SQLITE_BLOB: {
      char *zText = 0;
      char const *zBlob = sqlite3_value_blob(argv[0]);
      int nBlob = sqlite3_value_bytes(argv[0]);
      assert( zBlob==sqlite3_value_blob(argv[0]) ); /* No encoding change */
      zText = (char *)contextMalloc(context, (2*(i64)nBlob)+4); 
      if( zText ){
        int i;
        for(i=0; i<nBlob; i++){
          zText[(i*2)+2] = hexdigits[(zBlob[i]>>4)&0x0F];
          zText[(i*2)+3] = hexdigits[(zBlob[i])&0x0F];
        }
        zText[(nBlob*2)+2] = '\'';
        zText[(nBlob*2)+3] = '\0';
        zText[0] = 'X';
        zText[1] = '\'';
        sqlite3_result_text(context, zText, -1, SQLITE_TRANSIENT);
        sqlite3_free(zText);
      }
      break;
    }
    case SQLITE_TEXT: {
      int i,j;
      u64 n;
      const unsigned char *zArg = sqlite3_value_text(argv[0]);
      char *z;

      if( zArg==0 ) return;
      for(i=0, n=0; zArg[i]; i++){ if( zArg[i]=='\'' ) n++; }
      z = contextMalloc(context, ((i64)i)+((i64)n)+3);
      if( z ){
        z[0] = '\'';
        for(i=0, j=1; zArg[i]; i++){
          z[j++] = zArg[i];
          if( zArg[i]=='\'' ){
            z[j++] = '\'';
          }
        }
        z[j++] = '\'';
        z[j] = 0;
        sqlite3_result_text(context, z, j, sqlite3_free);
      }
    }
  }
}

/*
** The hex() function.  Interpret the argument as a blob.  Return
** a hexadecimal rendering as text.
*/
static void hexFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  int i, n;
  const unsigned char *pBlob;
  char *zHex, *z;
  assert( argc==1 );
  pBlob = sqlite3_value_blob(argv[0]);
  n = sqlite3_value_bytes(argv[0]);
  assert( pBlob==sqlite3_value_blob(argv[0]) );  /* No encoding change */
  z = zHex = contextMalloc(context, ((i64)n)*2 + 1);
  if( zHex ){
    for(i=0; i<n; i++, pBlob++){
      unsigned char c = *pBlob;
      *(z++) = hexdigits[(c>>4)&0xf];
      *(z++) = hexdigits[c&0xf];
    }
    *z = 0;
    sqlite3_result_text(context, zHex, n*2, sqlite3_free);
  }
}

/*
** The zeroblob(N) function returns a zero-filled blob of size N bytes.
*/
static void zeroblobFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  i64 n;
  assert( argc==1 );
  n = sqlite3_value_int64(argv[0]);
  if( n>SQLITE_MAX_LENGTH ){
    sqlite3_result_error_toobig(context);
  }else{
    sqlite3_result_zeroblob(context, n);
  }
}

/*
** The replace() function.  Three arguments are all strings: call
** them A, B, and C. The result is also a string which is derived
** from A by replacing every occurance of B with C.  The match
** must be exact.  Collating sequences are not used.
*/
static void replaceFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  const unsigned char *zStr;        /* The input string A */
  const unsigned char *zPattern;    /* The pattern string B */
  const unsigned char *zRep;        /* The replacement string C */
  unsigned char *zOut;              /* The output */
  int nStr;                /* Size of zStr */
  int nPattern;            /* Size of zPattern */
  int nRep;                /* Size of zRep */
  i64 nOut;                /* Maximum size of zOut */
  int loopLimit;           /* Last zStr[] that might match zPattern[] */
  int i, j;                /* Loop counters */

  assert( argc==3 );
  zStr = sqlite3_value_text(argv[0]);
  if( zStr==0 ) return;
  nStr = sqlite3_value_bytes(argv[0]);
  assert( zStr==sqlite3_value_text(argv[0]) );  /* No encoding change */
  zPattern = sqlite3_value_text(argv[1]);
  if( zPattern==0 || zPattern[0]==0 ) return;
  nPattern = sqlite3_value_bytes(argv[1]);
  assert( zPattern==sqlite3_value_text(argv[1]) );  /* No encoding change */
  zRep = sqlite3_value_text(argv[2]);
  if( zRep==0 ) return;
  nRep = sqlite3_value_bytes(argv[2]);
  assert( zRep==sqlite3_value_text(argv[2]) );
  nOut = nStr + 1;
  assert( nOut<SQLITE_MAX_LENGTH );
  zOut = contextMalloc(context, (i64)nOut);
  if( zOut==0 ){
    return;
  }
  loopLimit = nStr - nPattern;  
  for(i=j=0; i<=loopLimit; i++){
    if( zStr[i]!=zPattern[0] || memcmp(&zStr[i], zPattern, nPattern) ){
      zOut[j++] = zStr[i];
    }else{
      u8 *zOld;
      sqlite3 *db = sqlite3_context_db_handle(context);
      nOut += nRep - nPattern;
      if( nOut>=db->aLimit[SQLITE_LIMIT_LENGTH] ){
        sqlite3_result_error_toobig(context);
        sqlite3DbFree(db, zOut);
        return;
      }
      zOld = zOut;
      zOut = sqlite3_realloc(zOut, (int)nOut);
      if( zOut==0 ){
        sqlite3_result_error_nomem(context);
        sqlite3DbFree(db, zOld);
        return;
      }
      memcpy(&zOut[j], zRep, nRep);
      j += nRep;
      i += nPattern-1;
    }
  }
  assert( j+nStr-i+1==nOut );
  memcpy(&zOut[j], &zStr[i], nStr-i);
  j += nStr - i;
  assert( j<=nOut );
  zOut[j] = 0;
  sqlite3_result_text(context, (char*)zOut, j, sqlite3_free);
}

/*
** Implementation of the TRIM(), LTRIM(), and RTRIM() functions.
** The userdata is 0x1 for left trim, 0x2 for right trim, 0x3 for both.
*/
static void trimFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  const unsigned char *zIn;         /* Input string */
  const unsigned char *zCharSet;    /* Set of characters to trim */
  int nIn;                          /* Number of bytes in input */
  int flags;                        /* 1: trimleft  2: trimright  3: trim */
  int i;                            /* Loop counter */
  unsigned char *aLen;              /* Length of each character in zCharSet */
  unsigned char **azChar;           /* Individual characters in zCharSet */
  int nChar;                        /* Number of characters in zCharSet */

  if( sqlite3_value_type(argv[0])==SQLITE_NULL ){
    return;
  }
  zIn = sqlite3_value_text(argv[0]);
  if( zIn==0 ) return;
  nIn = sqlite3_value_bytes(argv[0]);
  assert( zIn==sqlite3_value_text(argv[0]) );
  if( argc==1 ){
    static const unsigned char lenOne[] = { 1 };
    static const unsigned char *azOne[] = { (u8*)" " };
    nChar = 1;
    aLen = (u8*)lenOne;
    azChar = (unsigned char **)azOne;
    zCharSet = 0;
  }else if( (zCharSet = sqlite3_value_text(argv[1]))==0 ){
    return;
  }else{
    const unsigned char *z;
    for(z=zCharSet, nChar=0; *z; nChar++){
      SQLITE_SKIP_UTF8(z);
    }
    if( nChar>0 ){
      azChar = contextMalloc(context, ((i64)nChar)*(sizeof(char*)+1));
      if( azChar==0 ){
        return;
      }
      aLen = (unsigned char*)&azChar[nChar];
      for(z=zCharSet, nChar=0; *z; nChar++){
        azChar[nChar] = (unsigned char *)z;
        SQLITE_SKIP_UTF8(z);
        aLen[nChar] = z - azChar[nChar];
      }
    }
  }
  if( nChar>0 ){
    flags = SQLITE_PTR_TO_INT(sqlite3_user_data(context));
    if( flags & 1 ){
      while( nIn>0 ){
        int len;
        for(i=0; i<nChar; i++){
          len = aLen[i];
          if( memcmp(zIn, azChar[i], len)==0 ) break;
        }
        if( i>=nChar ) break;
        zIn += len;
        nIn -= len;
      }
    }
    if( flags & 2 ){
      while( nIn>0 ){
        int len;
        for(i=0; i<nChar; i++){
          len = aLen[i];
          if( len<=nIn && memcmp(&zIn[nIn-len],azChar[i],len)==0 ) break;
        }
        if( i>=nChar ) break;
        nIn -= len;
      }
    }
    if( zCharSet ){
      sqlite3_free(azChar);
    }
  }
  sqlite3_result_text(context, (char*)zIn, nIn, SQLITE_TRANSIENT);
}

#ifdef SQLITE_SOUNDEX
/*
** Compute the soundex encoding of a word.
*/
static void soundexFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  char zResult[8];
  const u8 *zIn;
  int i, j;
  static const unsigned char iCode[] = {
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5, 5, 0,
    1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0,
    0, 0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5, 5, 0,
    1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0,
  };
  assert( argc==1 );
  zIn = (u8*)sqlite3_value_text(argv[0]);
  if( zIn==0 ) zIn = (u8*)"";
  for(i=0; zIn[i] && !isalpha(zIn[i]); i++){}
  if( zIn[i] ){
    u8 prevcode = iCode[zIn[i]&0x7f];
    zResult[0] = toupper(zIn[i]);
    for(j=1; j<4 && zIn[i]; i++){
      int code = iCode[zIn[i]&0x7f];
      if( code>0 ){
        if( code!=prevcode ){
          prevcode = code;
          zResult[j++] = code + '0';
        }
      }else{
        prevcode = 0;
      }
    }
    while( j<4 ){
      zResult[j++] = '0';
    }
    zResult[j] = 0;
    sqlite3_result_text(context, zResult, 4, SQLITE_TRANSIENT);
  }else{
    sqlite3_result_text(context, "?000", 4, SQLITE_STATIC);
  }
}
#endif

#ifndef SQLITE_OMIT_LOAD_EXTENSION
/*
** A function that loads a shared-library extension then returns NULL.
*/
static void loadExt(sqlite3_context *context, int argc, sqlite3_value **argv){
  const char *zFile = (const char *)sqlite3_value_text(argv[0]);
  const char *zProc;
  sqlite3 *db = sqlite3_context_db_handle(context);
  char *zErrMsg = 0;

  if( argc==2 ){
    zProc = (const char *)sqlite3_value_text(argv[1]);
  }else{
    zProc = 0;
  }
  if( zFile && sqlite3_load_extension(db, zFile, zProc, &zErrMsg) ){
    sqlite3_result_error(context, zErrMsg, -1);
    sqlite3_free(zErrMsg);
  }
}
#endif


/*
** An instance of the following structure holds the context of a
** sum() or avg() aggregate computation.
*/
typedef struct SumCtx SumCtx;
struct SumCtx {
  double rSum;      /* Floating point sum */
  i64 iSum;         /* Integer sum */   
  i64 cnt;          /* Number of elements summed */
  u8 overflow;      /* True if integer overflow seen */
  u8 approx;        /* True if non-integer value was input to the sum */
};

/*
** Routines used to compute the sum, average, and total.
**
** The SUM() function follows the (broken) SQL standard which means
** that it returns NULL if it sums over no inputs.  TOTAL returns
** 0.0 in that case.  In addition, TOTAL always returns a float where
** SUM might return an integer if it never encounters a floating point
** value.  TOTAL never fails, but SUM might through an exception if
** it overflows an integer.
*/
static void sumStep(sqlite3_context *context, int argc, sqlite3_value **argv){
  SumCtx *p;
  int type;
  assert( argc==1 );
  p = sqlite3_aggregate_context(context, sizeof(*p));
  type = sqlite3_value_numeric_type(argv[0]);
  if( p && type!=SQLITE_NULL ){
    p->cnt++;
    if( type==SQLITE_INTEGER ){
      i64 v = sqlite3_value_int64(argv[0]);
      p->rSum += v;
      if( (p->approx|p->overflow)==0 ){
        i64 iNewSum = p->iSum + v;
        int s1 = p->iSum >> (sizeof(i64)*8-1);
        int s2 = v       >> (sizeof(i64)*8-1);
        int s3 = iNewSum >> (sizeof(i64)*8-1);
        p->overflow = (s1&s2&~s3) | (~s1&~s2&s3);
        p->iSum = iNewSum;
      }
    }else{
      p->rSum += sqlite3_value_double(argv[0]);
      p->approx = 1;
    }
  }
}
static void sumFinalize(sqlite3_context *context){
  SumCtx *p;
  p = sqlite3_aggregate_context(context, 0);
  if( p && p->cnt>0 ){
    if( p->overflow ){
      sqlite3_result_error(context,"integer overflow",-1);
    }else if( p->approx ){
      sqlite3_result_double(context, p->rSum);
    }else{
      sqlite3_result_int64(context, p->iSum);
    }
  }
}
static void avgFinalize(sqlite3_context *context){
  SumCtx *p;
  p = sqlite3_aggregate_context(context, 0);
  if( p && p->cnt>0 ){
    sqlite3_result_double(context, p->rSum/(double)p->cnt);
  }
}
static void totalFinalize(sqlite3_context *context){
  SumCtx *p;
  p = sqlite3_aggregate_context(context, 0);
  sqlite3_result_double(context, p ? p->rSum : 0.0);
}

/*
** The following structure keeps track of state information for the
** count() aggregate function.
*/
typedef struct CountCtx CountCtx;
struct CountCtx {
  i64 n;
};

/*
** Routines to implement the count() aggregate function.
*/
static void countStep(sqlite3_context *context, int argc, sqlite3_value **argv){
  CountCtx *p;
  p = sqlite3_aggregate_context(context, sizeof(*p));
  if( (argc==0 || SQLITE_NULL!=sqlite3_value_type(argv[0])) && p ){
    p->n++;
  }
}   
static void countFinalize(sqlite3_context *context){
  CountCtx *p;
  p = sqlite3_aggregate_context(context, 0);
  sqlite3_result_int64(context, p ? p->n : 0);
}

/*
** Routines to implement min() and max() aggregate functions.
*/
static void minmaxStep(sqlite3_context *context, int argc, sqlite3_value **argv){
  Mem *pArg  = (Mem *)argv[0];
  Mem *pBest;

  if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
  pBest = (Mem *)sqlite3_aggregate_context(context, sizeof(*pBest));
  if( !pBest ) return;

  if( pBest->flags ){
    int max;
    int cmp;
    CollSeq *pColl = sqlite3GetFuncCollSeq(context);
    /* This step function is used for both the min() and max() aggregates,
    ** the only difference between the two being that the sense of the
    ** comparison is inverted. For the max() aggregate, the
    ** sqlite3_user_data() function returns (void *)-1. For min() it
    ** returns (void *)db, where db is the sqlite3* database pointer.
    ** Therefore the next statement sets variable 'max' to 1 for the max()
    ** aggregate, or 0 for min().
    */
    max = sqlite3_user_data(context)!=0;
    cmp = sqlite3MemCompare(pBest, pArg, pColl);
    if( (max && cmp<0) || (!max && cmp>0) ){
      sqlite3VdbeMemCopy(pBest, pArg);
    }
  }else{
    sqlite3VdbeMemCopy(pBest, pArg);
  }
}
static void minMaxFinalize(sqlite3_context *context){
  sqlite3_value *pRes;
  pRes = (sqlite3_value *)sqlite3_aggregate_context(context, 0);
  if( pRes ){
    if( pRes->flags ){
      sqlite3_result_value(context, pRes);
    }
    sqlite3VdbeMemRelease(pRes);
  }
}

/*
** group_concat(EXPR, ?SEPARATOR?)
*/
static void groupConcatStep(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  const char *zVal;
  StrAccum *pAccum;
  const char *zSep;
  int nVal, nSep, i;
  if( argc==0 || sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
  pAccum = (StrAccum*)sqlite3_aggregate_context(context, sizeof(*pAccum));

  if( pAccum ){
    sqlite3 *db = sqlite3_context_db_handle(context);
    pAccum->useMalloc = 1;
    pAccum->mxAlloc = db->aLimit[SQLITE_LIMIT_LENGTH];
    if( pAccum->nChar ){
      if( argc>1 ){
        zSep = (char*)sqlite3_value_text(argv[argc-1]);
        nSep = sqlite3_value_bytes(argv[argc-1]);
      }else{
        zSep = ",";
        nSep = 1;
      }
      sqlite3StrAccumAppend(pAccum, zSep, nSep);
    }
    i = 0;
    do{
      zVal = (char*)sqlite3_value_text(argv[i]);
      nVal = sqlite3_value_bytes(argv[i]);
      sqlite3StrAccumAppend(pAccum, zVal, nVal);
      i++;
    }while( i<argc-1 );
  }
}
static void groupConcatFinalize(sqlite3_context *context){
  StrAccum *pAccum;
  pAccum = sqlite3_aggregate_context(context, 0);
  if( pAccum ){
    if( pAccum->tooBig ){
      sqlite3_result_error_toobig(context);
    }else if( pAccum->mallocFailed ){
      sqlite3_result_error_nomem(context);
    }else{    
      sqlite3_result_text(context, sqlite3StrAccumFinish(pAccum), -1, 
                          sqlite3_free);
    }
  }
}

/*
** This function registered all of the above C functions as SQL
** functions.  This should be the only routine in this file with
** external linkage.
*/
void sqlite3RegisterBuiltinFunctions(sqlite3 *db){
  static const struct {
     char *zName;
     signed char nArg;
     u8 argType;           /* 1: 0, 2: 1, 3: 2,...  N:  N-1. */
     u8 eTextRep;          /* 1: UTF-16.  0: UTF-8 */
     u8 needCollSeq;
     void (*xFunc)(sqlite3_context*,int,sqlite3_value **);
  } aFuncs[] = {
    { "min",               -1, 0, SQLITE_UTF8,    1, minmaxFunc },
    { "min",                0, 0, SQLITE_UTF8,    1, 0          },
    { "max",               -1, 1, SQLITE_UTF8,    1, minmaxFunc },
    { "max",                0, 1, SQLITE_UTF8,    1, 0          },
    { "typeof",             1, 0, SQLITE_UTF8,    0, typeofFunc },
    { "length",             1, 0, SQLITE_UTF8,    0, lengthFunc },
    { "substr",             2, 0, SQLITE_UTF8,    0, substrFunc },
    { "substr",             3, 0, SQLITE_UTF8,    0, substrFunc },
    { "abs",                1, 0, SQLITE_UTF8,    0, absFunc    },
    { "round",              1, 0, SQLITE_UTF8,    0, roundFunc  },
    { "round",              2, 0, SQLITE_UTF8,    0, roundFunc  },
    { "upper",              1, 0, SQLITE_UTF8,    0, upperFunc  },
    { "lower",              1, 0, SQLITE_UTF8,    0, lowerFunc  },
    { "coalesce",          -1, 0, SQLITE_UTF8,    0, ifnullFunc },
    { "coalesce",           0, 0, SQLITE_UTF8,    0, 0          },
    { "coalesce",           1, 0, SQLITE_UTF8,    0, 0          },
    { "hex",                1, 0, SQLITE_UTF8,    0, hexFunc    },
    { "ifnull",             2, 0, SQLITE_UTF8,    1, ifnullFunc },
    { "random",            -1, 0, SQLITE_UTF8,    0, randomFunc },
    { "randomblob",         1, 0, SQLITE_UTF8,    0, randomBlob },
    { "nullif",             2, 0, SQLITE_UTF8,    1, nullifFunc },
    { "sqlite_version",     0, 0, SQLITE_UTF8,    0, versionFunc},
    { "quote",              1, 0, SQLITE_UTF8,    0, quoteFunc  },
    { "last_insert_rowid",  0, 0, SQLITE_UTF8, 0, last_insert_rowid },
    { "changes",            0, 0, SQLITE_UTF8, 0, changes           },
    { "total_changes",      0, 0, SQLITE_UTF8, 0, total_changes     },
    { "replace",            3, 0, SQLITE_UTF8,    0, replaceFunc       },
    { "ltrim",              1, 1, SQLITE_UTF8,    0, trimFunc          },
    { "ltrim",              2, 1, SQLITE_UTF8,    0, trimFunc          },
    { "rtrim",              1, 2, SQLITE_UTF8,    0, trimFunc          },
    { "rtrim",              2, 2, SQLITE_UTF8,    0, trimFunc          },
    { "trim",               1, 3, SQLITE_UTF8,    0, trimFunc          },
    { "trim",               2, 3, SQLITE_UTF8,    0, trimFunc          },
    { "zeroblob",           1, 0, SQLITE_UTF8,    0, zeroblobFunc      },
#ifdef SQLITE_SOUNDEX
    { "soundex",            1, 0, SQLITE_UTF8,    0, soundexFunc},
#endif
#ifndef SQLITE_OMIT_LOAD_EXTENSION
    { "load_extension",     1, 0, SQLITE_UTF8, 0, loadExt },
    { "load_extension",     2, 0, SQLITE_UTF8, 0, loadExt },
#endif
  };
  static const struct {
    char *zName;
    signed char nArg;
    u8 argType;
    u8 needCollSeq;
    void (*xStep)(sqlite3_context*,int,sqlite3_value**);
    void (*xFinalize)(sqlite3_context*);
  } aAggs[] = {
    { "min",    1, 0, 1, minmaxStep,   minMaxFinalize },
    { "max",    1, 1, 1, minmaxStep,   minMaxFinalize },
    { "sum",    1, 0, 0, sumStep,      sumFinalize    },
    { "total",  1, 0, 0, sumStep,      totalFinalize    },
    { "avg",    1, 0, 0, sumStep,      avgFinalize    },
    { "count",  0, 0, 0, countStep,    countFinalize  },
    { "count",  1, 0, 0, countStep,    countFinalize  },
    { "group_concat", -1, 0, 0, groupConcatStep, groupConcatFinalize },
  };
  int i;

  for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){
    void *pArg;
    u8 argType = aFuncs[i].argType;
    pArg = SQLITE_INT_TO_PTR(argType);
    sqlite3CreateFunc(db, aFuncs[i].zName, aFuncs[i].nArg,
        aFuncs[i].eTextRep, pArg, aFuncs[i].xFunc, 0, 0);
    if( aFuncs[i].needCollSeq ){
      FuncDef *pFunc = sqlite3FindFunction(db, aFuncs[i].zName, 
          strlen(aFuncs[i].zName), aFuncs[i].nArg, aFuncs[i].eTextRep, 0);
      if( pFunc && aFuncs[i].needCollSeq ){
        pFunc->needCollSeq = 1;
      }
    }
  }
#ifndef SQLITE_OMIT_ALTERTABLE
  sqlite3AlterFunctions(db);
#endif
#ifndef SQLITE_OMIT_PARSER
  sqlite3AttachFunctions(db);
#endif
  for(i=0; i<sizeof(aAggs)/sizeof(aAggs[0]); i++){
    void *pArg = SQLITE_INT_TO_PTR(aAggs[i].argType);
    sqlite3CreateFunc(db, aAggs[i].zName, aAggs[i].nArg, SQLITE_UTF8, 
        pArg, 0, aAggs[i].xStep, aAggs[i].xFinalize);
    if( aAggs[i].needCollSeq ){
      FuncDef *pFunc = sqlite3FindFunction( db, aAggs[i].zName,
          strlen(aAggs[i].zName), aAggs[i].nArg, SQLITE_UTF8, 0);
      if( pFunc && aAggs[i].needCollSeq ){
        pFunc->needCollSeq = 1;
      }
    }
  }
  sqlite3RegisterDateTimeFunctions(db);
  if( !db->mallocFailed ){
    int rc = sqlite3_overload_function(db, "MATCH", 2);
    assert( rc==SQLITE_NOMEM || rc==SQLITE_OK );
    if( rc==SQLITE_NOMEM ){
      db->mallocFailed = 1;
    }
  }
#ifdef SQLITE_SSE
  (void)sqlite3SseFunctions(db);
#endif
#ifdef SQLITE_CASE_SENSITIVE_LIKE
  sqlite3RegisterLikeFunctions(db, 1);
#else
  sqlite3RegisterLikeFunctions(db, 0);
#endif
}

/*
** Set the LIKEOPT flag on the 2-argument function with the given name.
*/
static void setLikeOptFlag(sqlite3 *db, const char *zName, int flagVal){
  FuncDef *pDef;
  pDef = sqlite3FindFunction(db, zName, strlen(zName), 2, SQLITE_UTF8, 0);
  if( pDef ){
    pDef->flags = flagVal;
  }
}

/*
** Register the built-in LIKE and GLOB functions.  The caseSensitive
** parameter determines whether or not the LIKE operator is case
** sensitive.  GLOB is always case sensitive.
*/
void sqlite3RegisterLikeFunctions(sqlite3 *db, int caseSensitive){
  struct compareInfo *pInfo;
  if( caseSensitive ){
    pInfo = (struct compareInfo*)&likeInfoAlt;
  }else{
    pInfo = (struct compareInfo*)&likeInfoNorm;
  }
  sqlite3CreateFunc(db, "like", 2, SQLITE_UTF8, pInfo, likeFunc, 0, 0);
  sqlite3CreateFunc(db, "like", 3, SQLITE_UTF8, pInfo, likeFunc, 0, 0);
  sqlite3CreateFunc(db, "glob", 2, SQLITE_UTF8, 
      (struct compareInfo*)&globInfo, likeFunc, 0,0);
  setLikeOptFlag(db, "glob", SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE);
  setLikeOptFlag(db, "like", 
      caseSensitive ? (SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE) : SQLITE_FUNC_LIKE);
}

/*
** pExpr points to an expression which implements a function.  If
** it is appropriate to apply the LIKE optimization to that function
** then set aWc[0] through aWc[2] to the wildcard characters and
** return TRUE.  If the function is not a LIKE-style function then
** return FALSE.
*/
int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocase, char *aWc){
  FuncDef *pDef;
  if( pExpr->op!=TK_FUNCTION || !pExpr->pList ){
    return 0;
  }
  if( pExpr->pList->nExpr!=2 ){
    return 0;
  }
  pDef = sqlite3FindFunction(db, (char*)pExpr->token.z, pExpr->token.n, 2,
                             SQLITE_UTF8, 0);
  if( pDef==0 || (pDef->flags & SQLITE_FUNC_LIKE)==0 ){
    return 0;
  }

  /* The memcpy() statement assumes that the wildcard characters are
  ** the first three statements in the compareInfo structure.  The
  ** asserts() that follow verify that assumption
  */
  memcpy(aWc, pDef->pUserData, 3);
  assert( (char*)&likeInfoAlt == (char*)&likeInfoAlt.matchAll );
  assert( &((char*)&likeInfoAlt)[1] == (char*)&likeInfoAlt.matchOne );
  assert( &((char*)&likeInfoAlt)[2] == (char*)&likeInfoAlt.matchSet );
  *pIsNocase = (pDef->flags & SQLITE_FUNC_CASE)==0;
  return 1;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/global.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
** 2008 June 13
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains definitions of global variables and contants.
**
** $Id: global.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"


/* An array to map all upper-case characters into their corresponding
** lower-case character. 
**
** SQLite only considers US-ASCII (or EBCDIC) characters.  We do not
** handle case conversions for the UTF character set since the tables
** involved are nearly as big or bigger than SQLite itself.
*/
const unsigned char sqlite3UpperToLower[] = {
#ifdef SQLITE_ASCII
      0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17,
     18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
     36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
     54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 97, 98, 99,100,101,102,103,
    104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,
    122, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,
    108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,
    126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
    144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,
    162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,
    180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,
    198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,
    216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,
    234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,
    252,253,254,255
#endif
#ifdef SQLITE_EBCDIC
      0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, /* 0x */
     16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, /* 1x */
     32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, /* 2x */
     48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, /* 3x */
     64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, /* 4x */
     80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, /* 5x */
     96, 97, 66, 67, 68, 69, 70, 71, 72, 73,106,107,108,109,110,111, /* 6x */
    112, 81, 82, 83, 84, 85, 86, 87, 88, 89,122,123,124,125,126,127, /* 7x */
    128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, /* 8x */
    144,145,146,147,148,149,150,151,152,153,154,155,156,157,156,159, /* 9x */
    160,161,162,163,164,165,166,167,168,169,170,171,140,141,142,175, /* Ax */
    176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, /* Bx */
    192,129,130,131,132,133,134,135,136,137,202,203,204,205,206,207, /* Cx */
    208,145,146,147,148,149,150,151,152,153,218,219,220,221,222,223, /* Dx */
    224,225,162,163,164,165,166,167,168,169,232,203,204,205,206,207, /* Ex */
    239,240,241,242,243,244,245,246,247,248,249,219,220,221,222,255, /* Fx */
#endif
};

/*
** The following singleton contains the global configuration for
** the SQLite library.
*/
struct Sqlite3Config sqlite3Config = {
   1,                /* bMemstat */
   1,                /* bCoreMutex */
   1,                /* bFullMutex */
   0x7ffffffe,       /* mxStrlen */
   100,              /* szLookaside */
   500,              /* nLookaside */
   /* Other fields all default to zero */
};
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































Deleted SQLite.Interop/splitsource/hash.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
/*
** 2001 September 22
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This is the implementation of generic hash-tables
** used in SQLite.
**
** $Id: hash.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <assert.h>

/* Turn bulk memory into a hash table object by initializing the
** fields of the Hash structure.
**
** "pNew" is a pointer to the hash table that is to be initialized.
** keyClass is one of the constants SQLITE_HASH_INT, SQLITE_HASH_POINTER,
** SQLITE_HASH_BINARY, or SQLITE_HASH_STRING.  The value of keyClass 
** determines what kind of key the hash table will use.  "copyKey" is
** true if the hash table should make its own private copy of keys and
** false if it should just use the supplied pointer.  CopyKey only makes
** sense for SQLITE_HASH_STRING and SQLITE_HASH_BINARY and is ignored
** for other key classes.
*/
void sqlite3HashInit(Hash *pNew, int keyClass, int copyKey){
  assert( pNew!=0 );
  assert( keyClass>=SQLITE_HASH_STRING && keyClass<=SQLITE_HASH_BINARY );
  pNew->keyClass = keyClass;
#if 0
  if( keyClass==SQLITE_HASH_POINTER || keyClass==SQLITE_HASH_INT ) copyKey = 0;
#endif
  pNew->copyKey = copyKey;
  pNew->first = 0;
  pNew->count = 0;
  pNew->htsize = 0;
  pNew->ht = 0;
}

/* Remove all entries from a hash table.  Reclaim all memory.
** Call this routine to delete a hash table or to reset a hash table
** to the empty state.
*/
void sqlite3HashClear(Hash *pH){
  HashElem *elem;         /* For looping over all elements of the table */

  assert( pH!=0 );
  elem = pH->first;
  pH->first = 0;
  sqlite3_free(pH->ht);
  pH->ht = 0;
  pH->htsize = 0;
  while( elem ){
    HashElem *next_elem = elem->next;
    if( pH->copyKey && elem->pKey ){
      sqlite3_free(elem->pKey);
    }
    sqlite3_free(elem);
    elem = next_elem;
  }
  pH->count = 0;
}

#if 0 /* NOT USED */
/*
** Hash and comparison functions when the mode is SQLITE_HASH_INT
*/
static int intHash(const void *pKey, int nKey){
  return nKey ^ (nKey<<8) ^ (nKey>>8);
}
static int intCompare(const void *pKey1, int n1, const void *pKey2, int n2){
  return n2 - n1;
}
#endif

#if 0 /* NOT USED */
/*
** Hash and comparison functions when the mode is SQLITE_HASH_POINTER
*/
static int ptrHash(const void *pKey, int nKey){
  uptr x = Addr(pKey);
  return x ^ (x<<8) ^ (x>>8);
}
static int ptrCompare(const void *pKey1, int n1, const void *pKey2, int n2){
  if( pKey1==pKey2 ) return 0;
  if( pKey1<pKey2 ) return -1;
  return 1;
}
#endif

/*
** Hash and comparison functions when the mode is SQLITE_HASH_STRING
*/
static int strHash(const void *pKey, int nKey){
  const char *z = (const char *)pKey;
  int h = 0;
  if( nKey<=0 ) nKey = strlen(z);
  while( nKey > 0  ){
    h = (h<<3) ^ h ^ sqlite3UpperToLower[(unsigned char)*z++];
    nKey--;
  }
  return h & 0x7fffffff;
}
static int strCompare(const void *pKey1, int n1, const void *pKey2, int n2){
  if( n1!=n2 ) return 1;
  return sqlite3StrNICmp((const char*)pKey1,(const char*)pKey2,n1);
}

/*
** Hash and comparison functions when the mode is SQLITE_HASH_BINARY
*/
static int binHash(const void *pKey, int nKey){
  int h = 0;
  const char *z = (const char *)pKey;
  while( nKey-- > 0 ){
    h = (h<<3) ^ h ^ *(z++);
  }
  return h & 0x7fffffff;
}
static int binCompare(const void *pKey1, int n1, const void *pKey2, int n2){
  if( n1!=n2 ) return 1;
  return memcmp(pKey1,pKey2,n1);
}

/*
** Return a pointer to the appropriate hash function given the key class.
**
** The C syntax in this function definition may be unfamilar to some 
** programmers, so we provide the following additional explanation:
**
** The name of the function is "hashFunction".  The function takes a
** single parameter "keyClass".  The return value of hashFunction()
** is a pointer to another function.  Specifically, the return value
** of hashFunction() is a pointer to a function that takes two parameters
** with types "const void*" and "int" and returns an "int".
*/
static int (*hashFunction(int keyClass))(const void*,int){
#if 0  /* HASH_INT and HASH_POINTER are never used */
  switch( keyClass ){
    case SQLITE_HASH_INT:     return &intHash;
    case SQLITE_HASH_POINTER: return &ptrHash;
    case SQLITE_HASH_STRING:  return &strHash;
    case SQLITE_HASH_BINARY:  return &binHash;;
    default: break;
  }
  return 0;
#else
  if( keyClass==SQLITE_HASH_STRING ){
    return &strHash;
  }else{
    assert( keyClass==SQLITE_HASH_BINARY );
    return &binHash;
  }
#endif
}

/*
** Return a pointer to the appropriate hash function given the key class.
**
** For help in interpreted the obscure C code in the function definition,
** see the header comment on the previous function.
*/
static int (*compareFunction(int keyClass))(const void*,int,const void*,int){
#if 0 /* HASH_INT and HASH_POINTER are never used */
  switch( keyClass ){
    case SQLITE_HASH_INT:     return &intCompare;
    case SQLITE_HASH_POINTER: return &ptrCompare;
    case SQLITE_HASH_STRING:  return &strCompare;
    case SQLITE_HASH_BINARY:  return &binCompare;
    default: break;
  }
  return 0;
#else
  if( keyClass==SQLITE_HASH_STRING ){
    return &strCompare;
  }else{
    assert( keyClass==SQLITE_HASH_BINARY );
    return &binCompare;
  }
#endif
}

/* Link an element into the hash table
*/
static void insertElement(
  Hash *pH,              /* The complete hash table */
  struct _ht *pEntry,    /* The entry into which pNew is inserted */
  HashElem *pNew         /* The element to be inserted */
){
  HashElem *pHead;       /* First element already in pEntry */
  pHead = pEntry->chain;
  if( pHead ){
    pNew->next = pHead;
    pNew->prev = pHead->prev;
    if( pHead->prev ){ pHead->prev->next = pNew; }
    else             { pH->first = pNew; }
    pHead->prev = pNew;
  }else{
    pNew->next = pH->first;
    if( pH->first ){ pH->first->prev = pNew; }
    pNew->prev = 0;
    pH->first = pNew;
  }
  pEntry->count++;
  pEntry->chain = pNew;
}


/* Resize the hash table so that it cantains "new_size" buckets.
** "new_size" must be a power of 2.  The hash table might fail 
** to resize if sqlite3_malloc() fails.
*/
static void rehash(Hash *pH, int new_size){
  struct _ht *new_ht;            /* The new hash table */
  HashElem *elem, *next_elem;    /* For looping over existing elements */
  int (*xHash)(const void*,int); /* The hash function */

#ifdef SQLITE_MALLOC_SOFT_LIMIT
  if( new_size*sizeof(struct _ht)>SQLITE_MALLOC_SOFT_LIMIT ){
    new_size = SQLITE_MALLOC_SOFT_LIMIT/sizeof(struct _ht);
  }
  if( new_size==pH->htsize ) return;
#endif

  /* There is a call to sqlite3_malloc() inside rehash(). If there is
  ** already an allocation at pH->ht, then if this malloc() fails it
  ** is benign (since failing to resize a hash table is a performance
  ** hit only, not a fatal error).
  */
  if( pH->htsize>0 ) sqlite3BeginBenignMalloc();
  new_ht = (struct _ht *)sqlite3MallocZero( new_size*sizeof(struct _ht) );
  if( pH->htsize>0 ) sqlite3EndBenignMalloc();

  if( new_ht==0 ) return;
  sqlite3_free(pH->ht);
  pH->ht = new_ht;
  pH->htsize = new_size;
  xHash = hashFunction(pH->keyClass);
  for(elem=pH->first, pH->first=0; elem; elem = next_elem){
    int h = (*xHash)(elem->pKey, elem->nKey) & (new_size-1);
    next_elem = elem->next;
    insertElement(pH, &new_ht[h], elem);
  }
}

/* This function (for internal use only) locates an element in an
** hash table that matches the given key.  The hash for this key has
** already been computed and is passed as the 4th parameter.
*/
static HashElem *findElementGivenHash(
  const Hash *pH,     /* The pH to be searched */
  const void *pKey,   /* The key we are searching for */
  int nKey,
  int h               /* The hash for this key. */
){
  HashElem *elem;                /* Used to loop thru the element list */
  int count;                     /* Number of elements left to test */
  int (*xCompare)(const void*,int,const void*,int);  /* comparison function */

  if( pH->ht ){
    struct _ht *pEntry = &pH->ht[h];
    elem = pEntry->chain;
    count = pEntry->count;
    xCompare = compareFunction(pH->keyClass);
    while( count-- && elem ){
      if( (*xCompare)(elem->pKey,elem->nKey,pKey,nKey)==0 ){ 
        return elem;
      }
      elem = elem->next;
    }
  }
  return 0;
}

/* Remove a single entry from the hash table given a pointer to that
** element and a hash on the element's key.
*/
static void removeElementGivenHash(
  Hash *pH,         /* The pH containing "elem" */
  HashElem* elem,   /* The element to be removed from the pH */
  int h             /* Hash value for the element */
){
  struct _ht *pEntry;
  if( elem->prev ){
    elem->prev->next = elem->next; 
  }else{
    pH->first = elem->next;
  }
  if( elem->next ){
    elem->next->prev = elem->prev;
  }
  pEntry = &pH->ht[h];
  if( pEntry->chain==elem ){
    pEntry->chain = elem->next;
  }
  pEntry->count--;
  if( pEntry->count<=0 ){
    pEntry->chain = 0;
  }
  if( pH->copyKey ){
    sqlite3_free(elem->pKey);
  }
  sqlite3_free( elem );
  pH->count--;
  if( pH->count<=0 ){
    assert( pH->first==0 );
    assert( pH->count==0 );
    sqlite3HashClear(pH);
  }
}

/* Attempt to locate an element of the hash table pH with a key
** that matches pKey,nKey.  Return a pointer to the corresponding 
** HashElem structure for this element if it is found, or NULL
** otherwise.
*/
HashElem *sqlite3HashFindElem(const Hash *pH, const void *pKey, int nKey){
  int h;             /* A hash on key */
  HashElem *elem;    /* The element that matches key */
  int (*xHash)(const void*,int);  /* The hash function */

  if( pH==0 || pH->ht==0 ) return 0;
  xHash = hashFunction(pH->keyClass);
  assert( xHash!=0 );
  h = (*xHash)(pKey,nKey);
  elem = findElementGivenHash(pH,pKey,nKey, h % pH->htsize);
  return elem;
}

/* Attempt to locate an element of the hash table pH with a key
** that matches pKey,nKey.  Return the data for this element if it is
** found, or NULL if there is no match.
*/
void *sqlite3HashFind(const Hash *pH, const void *pKey, int nKey){
  HashElem *elem;    /* The element that matches key */
  elem = sqlite3HashFindElem(pH, pKey, nKey);
  return elem ? elem->data : 0;
}

/* Insert an element into the hash table pH.  The key is pKey,nKey
** and the data is "data".
**
** If no element exists with a matching key, then a new
** element is created.  A copy of the key is made if the copyKey
** flag is set.  NULL is returned.
**
** If another element already exists with the same key, then the
** new data replaces the old data and the old data is returned.
** The key is not copied in this instance.  If a malloc fails, then
** the new data is returned and the hash table is unchanged.
**
** If the "data" parameter to this function is NULL, then the
** element corresponding to "key" is removed from the hash table.
*/
void *sqlite3HashInsert(Hash *pH, const void *pKey, int nKey, void *data){
  int hraw;             /* Raw hash value of the key */
  int h;                /* the hash of the key modulo hash table size */
  HashElem *elem;       /* Used to loop thru the element list */
  HashElem *new_elem;   /* New element added to the pH */
  int (*xHash)(const void*,int);  /* The hash function */

  assert( pH!=0 );
  xHash = hashFunction(pH->keyClass);
  assert( xHash!=0 );
  hraw = (*xHash)(pKey, nKey);
  if( pH->htsize ){
    h = hraw % pH->htsize;
    elem = findElementGivenHash(pH,pKey,nKey,h);
    if( elem ){
      void *old_data = elem->data;
      if( data==0 ){
        removeElementGivenHash(pH,elem,h);
      }else{
        elem->data = data;
        if( !pH->copyKey ){
          elem->pKey = (void *)pKey;
        }
        assert(nKey==elem->nKey);
      }
      return old_data;
    }
  }
  if( data==0 ) return 0;
  new_elem = (HashElem*)sqlite3Malloc( sizeof(HashElem) );
  if( new_elem==0 ) return data;
  if( pH->copyKey && pKey!=0 ){
    new_elem->pKey = sqlite3Malloc( nKey );
    if( new_elem->pKey==0 ){
      sqlite3_free(new_elem);
      return data;
    }
    memcpy((void*)new_elem->pKey, pKey, nKey);
  }else{
    new_elem->pKey = (void*)pKey;
  }
  new_elem->nKey = nKey;
  pH->count++;
  if( pH->htsize==0 ){
    rehash(pH, 128/sizeof(pH->ht[0]));
    if( pH->htsize==0 ){
      pH->count = 0;
      if( pH->copyKey ){
        sqlite3_free(new_elem->pKey);
      }
      sqlite3_free(new_elem);
      return data;
    }
  }
  if( pH->count > pH->htsize ){
    rehash(pH,pH->htsize*2);
  }
  assert( pH->htsize>0 );
  h = hraw % pH->htsize;
  insertElement(pH, &pH->ht[h], new_elem);
  new_elem->data = data;
  return 0;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/hash.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
** 2001 September 22
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This is the header file for the generic hash-table implemenation
** used in SQLite.
**
** $Id: hash.h,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#ifndef _SQLITE_HASH_H_
#define _SQLITE_HASH_H_

/* Forward declarations of structures. */
typedef struct Hash Hash;
typedef struct HashElem HashElem;

/* A complete hash table is an instance of the following structure.
** The internals of this structure are intended to be opaque -- client
** code should not attempt to access or modify the fields of this structure
** directly.  Change this structure only by using the routines below.
** However, many of the "procedures" and "functions" for modifying and
** accessing this structure are really macros, so we can't really make
** this structure opaque.
*/
struct Hash {
  char keyClass;          /* SQLITE_HASH_INT, _POINTER, _STRING, _BINARY */
  char copyKey;           /* True if copy of key made on insert */
  int count;              /* Number of entries in this table */
  int htsize;             /* Number of buckets in the hash table */
  HashElem *first;        /* The first element of the array */
  struct _ht {            /* the hash table */
    int count;               /* Number of entries with this hash */
    HashElem *chain;         /* Pointer to first entry with this hash */
  } *ht;
};

/* Each element in the hash table is an instance of the following 
** structure.  All elements are stored on a single doubly-linked list.
**
** Again, this structure is intended to be opaque, but it can't really
** be opaque because it is used by macros.
*/
struct HashElem {
  HashElem *next, *prev;   /* Next and previous elements in the table */
  void *data;              /* Data associated with this element */
  void *pKey; int nKey;    /* Key associated with this element */
};

/*
** There are 4 different modes of operation for a hash table:
**
**   SQLITE_HASH_INT         nKey is used as the key and pKey is ignored.
**
**   SQLITE_HASH_POINTER     pKey is used as the key and nKey is ignored.
**
**   SQLITE_HASH_STRING      pKey points to a string that is nKey bytes long
**                           (including the null-terminator, if any).  Case
**                           is ignored in comparisons.
**
**   SQLITE_HASH_BINARY      pKey points to binary data nKey bytes long. 
**                           memcmp() is used to compare keys.
**
** A copy of the key is made for SQLITE_HASH_STRING and SQLITE_HASH_BINARY
** if the copyKey parameter to HashInit is 1.  
*/
/* #define SQLITE_HASH_INT       1 // NOT USED */
/* #define SQLITE_HASH_POINTER   2 // NOT USED */
#define SQLITE_HASH_STRING    3
#define SQLITE_HASH_BINARY    4

/*
** Access routines.  To delete, insert a NULL pointer.
*/
void sqlite3HashInit(Hash*, int keytype, int copyKey);
void *sqlite3HashInsert(Hash*, const void *pKey, int nKey, void *pData);
void *sqlite3HashFind(const Hash*, const void *pKey, int nKey);
HashElem *sqlite3HashFindElem(const Hash*, const void *pKey, int nKey);
void sqlite3HashClear(Hash*);

/*
** Macros for looping over all elements of a hash table.  The idiom is
** like this:
**
**   Hash h;
**   HashElem *p;
**   ...
**   for(p=sqliteHashFirst(&h); p; p=sqliteHashNext(p)){
**     SomeStructure *pData = sqliteHashData(p);
**     // do something with pData
**   }
*/
#define sqliteHashFirst(H)  ((H)->first)
#define sqliteHashNext(E)   ((E)->next)
#define sqliteHashData(E)   ((E)->data)
#define sqliteHashKey(E)    ((E)->pKey)
#define sqliteHashKeysize(E) ((E)->nKey)

/*
** Number of entries in a hash table
*/
#define sqliteHashCount(H)  ((H)->count)

#endif /* _SQLITE_HASH_H_ */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































































































Deleted SQLite.Interop/splitsource/hwtime.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
** 2008 May 27
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains inline asm code for retrieving "high-performance"
** counters for x86 class CPUs.
**
** $Id: hwtime.h,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#ifndef _HWTIME_H_
#define _HWTIME_H_

/*
** The following routine only works on pentium-class (or newer) processors.
** It uses the RDTSC opcode to read the cycle count value out of the
** processor and returns that value.  This can be used for high-res
** profiling.
*/
#if (defined(__GNUC__) || defined(_MSC_VER)) && \
      (defined(i386) || defined(__i386__) || defined(_M_IX86))

  #if defined(__GNUC__)

  __inline__ sqlite_uint64 sqlite3Hwtime(void){
     unsigned int lo, hi;
     __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
     return (sqlite_uint64)hi << 32 | lo;
  }

  #elif defined(_MSC_VER)

  __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){
     __asm {
        rdtsc
        ret       ; return value at EDX:EAX
     }
  }

  #endif

#elif (defined(__GNUC__) && defined(__x86_64__))

  __inline__ sqlite_uint64 sqlite3Hwtime(void){
      unsigned long val;
      __asm__ __volatile__ ("rdtsc" : "=A" (val));
      return val;
  }
 
#elif (defined(__GNUC__) && defined(__ppc__))

  __inline__ sqlite_uint64 sqlite3Hwtime(void){
      unsigned long long retval;
      unsigned long junk;
      __asm__ __volatile__ ("\n\
          1:      mftbu   %1\n\
                  mftb    %L0\n\
                  mftbu   %0\n\
                  cmpw    %0,%1\n\
                  bne     1b"
                  : "=r" (retval), "=r" (junk));
      return retval;
  }

#else

  #error Need implementation of sqlite3Hwtime() for your platform.

  /*
  ** To compile without implementing sqlite3Hwtime() for your platform,
  ** you can remove the above #error and use the following
  ** stub function.  You will lose timing support for many
  ** of the debugging and testing utilities, but it should at
  ** least compile and run.
  */
  sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); }

#endif

#endif /* !defined(_HWTIME_H_) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































Deleted SQLite.Interop/splitsource/insert.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite.
**
** $Id: insert.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** Set P4 of the most recently inserted opcode to a column affinity
** string for index pIdx. A column affinity string has one character
** for each column in the table, according to the affinity of the column:
**
**  Character      Column affinity
**  ------------------------------
**  'a'            TEXT
**  'b'            NONE
**  'c'            NUMERIC
**  'd'            INTEGER
**  'e'            REAL
**
** An extra 'b' is appended to the end of the string to cover the
** rowid that appears as the last column in every index.
*/
void sqlite3IndexAffinityStr(Vdbe *v, Index *pIdx){
  if( !pIdx->zColAff ){
    /* The first time a column affinity string for a particular index is
    ** required, it is allocated and populated here. It is then stored as
    ** a member of the Index structure for subsequent use.
    **
    ** The column affinity string will eventually be deleted by
    ** sqliteDeleteIndex() when the Index structure itself is cleaned
    ** up.
    */
    int n;
    Table *pTab = pIdx->pTable;
    sqlite3 *db = sqlite3VdbeDb(v);
    pIdx->zColAff = (char *)sqlite3Malloc(pIdx->nColumn+2);
    if( !pIdx->zColAff ){
      db->mallocFailed = 1;
      return;
    }
    for(n=0; n<pIdx->nColumn; n++){
      pIdx->zColAff[n] = pTab->aCol[pIdx->aiColumn[n]].affinity;
    }
    pIdx->zColAff[n++] = SQLITE_AFF_NONE;
    pIdx->zColAff[n] = 0;
  }
 
  sqlite3VdbeChangeP4(v, -1, pIdx->zColAff, 0);
}

/*
** Set P4 of the most recently inserted opcode to a column affinity
** string for table pTab. A column affinity string has one character
** for each column indexed by the index, according to the affinity of the
** column:
**
**  Character      Column affinity
**  ------------------------------
**  'a'            TEXT
**  'b'            NONE
**  'c'            NUMERIC
**  'd'            INTEGER
**  'e'            REAL
*/
void sqlite3TableAffinityStr(Vdbe *v, Table *pTab){
  /* The first time a column affinity string for a particular table
  ** is required, it is allocated and populated here. It is then 
  ** stored as a member of the Table structure for subsequent use.
  **
  ** The column affinity string will eventually be deleted by
  ** sqlite3DeleteTable() when the Table structure itself is cleaned up.
  */
  if( !pTab->zColAff ){
    char *zColAff;
    int i;
    sqlite3 *db = sqlite3VdbeDb(v);

    zColAff = (char *)sqlite3Malloc(pTab->nCol+1);
    if( !zColAff ){
      db->mallocFailed = 1;
      return;
    }

    for(i=0; i<pTab->nCol; i++){
      zColAff[i] = pTab->aCol[i].affinity;
    }
    zColAff[pTab->nCol] = '\0';

    pTab->zColAff = zColAff;
  }

  sqlite3VdbeChangeP4(v, -1, pTab->zColAff, 0);
}

/*
** Return non-zero if the table pTab in database iDb or any of its indices
** have been opened at any point in the VDBE program beginning at location
** iStartAddr throught the end of the program.  This is used to see if 
** a statement of the form  "INSERT INTO <iDb, pTab> SELECT ..." can 
** run without using temporary table for the results of the SELECT. 
*/
static int readsTable(Vdbe *v, int iStartAddr, int iDb, Table *pTab){
  int i;
  int iEnd = sqlite3VdbeCurrentAddr(v);
  for(i=iStartAddr; i<iEnd; i++){
    VdbeOp *pOp = sqlite3VdbeGetOp(v, i);
    assert( pOp!=0 );
    if( pOp->opcode==OP_OpenRead && pOp->p3==iDb ){
      Index *pIndex;
      int tnum = pOp->p2;
      if( tnum==pTab->tnum ){
        return 1;
      }
      for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){
        if( tnum==pIndex->tnum ){
          return 1;
        }
      }
    }
#ifndef SQLITE_OMIT_VIRTUALTABLE
    if( pOp->opcode==OP_VOpen && pOp->p4.pVtab==pTab->pVtab ){
      assert( pOp->p4.pVtab!=0 );
      assert( pOp->p4type==P4_VTAB );
      return 1;
    }
#endif
  }
  return 0;
}

#ifndef SQLITE_OMIT_AUTOINCREMENT
/*
** Write out code to initialize the autoincrement logic.  This code
** looks up the current autoincrement value in the sqlite_sequence
** table and stores that value in a register.  Code generated by
** autoIncStep() will keep that register holding the largest
** rowid value.  Code generated by autoIncEnd() will write the new
** largest value of the counter back into the sqlite_sequence table.
**
** This routine returns the index of the mem[] cell that contains
** the maximum rowid counter.
**
** Three consecutive registers are allocated by this routine.  The
** first two hold the name of the target table and the maximum rowid 
** inserted into the target table, respectively.
** The third holds the rowid in sqlite_sequence where we will
** write back the revised maximum rowid.  This routine returns the
** index of the second of these three registers.
*/
static int autoIncBegin(
  Parse *pParse,      /* Parsing context */
  int iDb,            /* Index of the database holding pTab */
  Table *pTab         /* The table we are writing to */
){
  int memId = 0;      /* Register holding maximum rowid */
  if( pTab->autoInc ){
    Vdbe *v = pParse->pVdbe;
    Db *pDb = &pParse->db->aDb[iDb];
    int iCur = pParse->nTab;
    int addr;               /* Address of the top of the loop */
    assert( v );
    pParse->nMem++;         /* Holds name of table */
    memId = ++pParse->nMem;
    pParse->nMem++;
    sqlite3OpenTable(pParse, iCur, iDb, pDb->pSchema->pSeqTab, OP_OpenRead);
    addr = sqlite3VdbeCurrentAddr(v);
    sqlite3VdbeAddOp4(v, OP_String8, 0, memId-1, 0, pTab->zName, 0);
    sqlite3VdbeAddOp2(v, OP_Rewind, iCur, addr+9);
    sqlite3VdbeAddOp3(v, OP_Column, iCur, 0, memId);
    sqlite3VdbeAddOp3(v, OP_Ne, memId-1, addr+7, memId);
    sqlite3VdbeChangeP5(v, SQLITE_JUMPIFNULL);
    sqlite3VdbeAddOp2(v, OP_Rowid, iCur, memId+1);
    sqlite3VdbeAddOp3(v, OP_Column, iCur, 1, memId);
    sqlite3VdbeAddOp2(v, OP_Goto, 0, addr+9);
    sqlite3VdbeAddOp2(v, OP_Next, iCur, addr+2);
    sqlite3VdbeAddOp2(v, OP_Integer, 0, memId);
    sqlite3VdbeAddOp2(v, OP_Close, iCur, 0);
  }
  return memId;
}

/*
** Update the maximum rowid for an autoincrement calculation.
**
** This routine should be called when the top of the stack holds a
** new rowid that is about to be inserted.  If that new rowid is
** larger than the maximum rowid in the memId memory cell, then the
** memory cell is updated.  The stack is unchanged.
*/
static void autoIncStep(Parse *pParse, int memId, int regRowid){
  if( memId>0 ){
    sqlite3VdbeAddOp2(pParse->pVdbe, OP_MemMax, memId, regRowid);
  }
}

/*
** After doing one or more inserts, the maximum rowid is stored
** in reg[memId].  Generate code to write this value back into the
** the sqlite_sequence table.
*/
static void autoIncEnd(
  Parse *pParse,     /* The parsing context */
  int iDb,           /* Index of the database holding pTab */
  Table *pTab,       /* Table we are inserting into */
  int memId          /* Memory cell holding the maximum rowid */
){
  if( pTab->autoInc ){
    int iCur = pParse->nTab;
    Vdbe *v = pParse->pVdbe;
    Db *pDb = &pParse->db->aDb[iDb];
    int j1;
    int iRec = ++pParse->nMem;    /* Memory cell used for record */

    assert( v );
    sqlite3OpenTable(pParse, iCur, iDb, pDb->pSchema->pSeqTab, OP_OpenWrite);
    j1 = sqlite3VdbeAddOp1(v, OP_NotNull, memId+1);
    sqlite3VdbeAddOp2(v, OP_NewRowid, iCur, memId+1);
    sqlite3VdbeJumpHere(v, j1);
    sqlite3VdbeAddOp3(v, OP_MakeRecord, memId-1, 2, iRec);
    sqlite3VdbeAddOp3(v, OP_Insert, iCur, iRec, memId+1);
    sqlite3VdbeChangeP5(v, OPFLAG_APPEND);
    sqlite3VdbeAddOp1(v, OP_Close, iCur);
  }
}
#else
/*
** If SQLITE_OMIT_AUTOINCREMENT is defined, then the three routines
** above are all no-ops
*/
# define autoIncBegin(A,B,C) (0)
# define autoIncStep(A,B,C)
# define autoIncEnd(A,B,C,D)
#endif /* SQLITE_OMIT_AUTOINCREMENT */


/* Forward declaration */
static int xferOptimization(
  Parse *pParse,        /* Parser context */
  Table *pDest,         /* The table we are inserting into */
  Select *pSelect,      /* A SELECT statement to use as the data source */
  int onError,          /* How to handle constraint errors */
  int iDbDest           /* The database of pDest */
);

/*
** This routine is call to handle SQL of the following forms:
**
**    insert into TABLE (IDLIST) values(EXPRLIST)
**    insert into TABLE (IDLIST) select
**
** The IDLIST following the table name is always optional.  If omitted,
** then a list of all columns for the table is substituted.  The IDLIST
** appears in the pColumn parameter.  pColumn is NULL if IDLIST is omitted.
**
** The pList parameter holds EXPRLIST in the first form of the INSERT
** statement above, and pSelect is NULL.  For the second form, pList is
** NULL and pSelect is a pointer to the select statement used to generate
** data for the insert.
**
** The code generated follows one of four templates.  For a simple
** select with data coming from a VALUES clause, the code executes
** once straight down through.  Pseudo-code follows (we call this
** the "1st template"):
**
**         open write cursor to <table> and its indices
**         puts VALUES clause expressions onto the stack
**         write the resulting record into <table>
**         cleanup
**
** The three remaining templates assume the statement is of the form
**
**   INSERT INTO <table> SELECT ...
**
** If the SELECT clause is of the restricted form "SELECT * FROM <table2>" -
** in other words if the SELECT pulls all columns from a single table
** and there is no WHERE or LIMIT or GROUP BY or ORDER BY clauses, and
** if <table2> and <table1> are distinct tables but have identical
** schemas, including all the same indices, then a special optimization
** is invoked that copies raw records from <table2> over to <table1>.
** See the xferOptimization() function for the implementation of this
** template.  This is the 2nd template.
**
**         open a write cursor to <table>
**         open read cursor on <table2>
**         transfer all records in <table2> over to <table>
**         close cursors
**         foreach index on <table>
**           open a write cursor on the <table> index
**           open a read cursor on the corresponding <table2> index
**           transfer all records from the read to the write cursors
**           close cursors
**         end foreach
**
** The 3rd template is for when the second template does not apply
** and the SELECT clause does not read from <table> at any time.
** The generated code follows this template:
**
**         EOF <- 0
**         X <- A
**         goto B
**      A: setup for the SELECT
**         loop over the rows in the SELECT
**           load values into registers R..R+n
**           yield X
**         end loop
**         cleanup after the SELECT
**         EOF <- 1
**         yield X
**         goto A
**      B: open write cursor to <table> and its indices
**      C: yield X
**         if EOF goto D
**         insert the select result into <table> from R..R+n
**         goto C
**      D: cleanup
**
** The 4th template is used if the insert statement takes its
** values from a SELECT but the data is being inserted into a table
** that is also read as part of the SELECT.  In the third form,
** we have to use a intermediate table to store the results of
** the select.  The template is like this:
**
**         EOF <- 0
**         X <- A
**         goto B
**      A: setup for the SELECT
**         loop over the tables in the SELECT
**           load value into register R..R+n
**           yield X
**         end loop
**         cleanup after the SELECT
**         EOF <- 1
**         yield X
**         halt-error
**      B: open temp table
**      L: yield X
**         if EOF goto M
**         insert row from R..R+n into temp table
**         goto L
**      M: open write cursor to <table> and its indices
**         rewind temp table
**      C: loop over rows of intermediate table
**           transfer values form intermediate table into <table>
**         end loop
**      D: cleanup
*/
void sqlite3Insert(
  Parse *pParse,        /* Parser context */
  SrcList *pTabList,    /* Name of table into which we are inserting */
  ExprList *pList,      /* List of values to be inserted */
  Select *pSelect,      /* A SELECT statement to use as the data source */
  IdList *pColumn,      /* Column names corresponding to IDLIST. */
  int onError           /* How to handle constraint errors */
){
  sqlite3 *db;          /* The main database structure */
  Table *pTab;          /* The table to insert into.  aka TABLE */
  char *zTab;           /* Name of the table into which we are inserting */
  const char *zDb;      /* Name of the database holding this table */
  int i, j, idx;        /* Loop counters */
  Vdbe *v;              /* Generate code into this virtual machine */
  Index *pIdx;          /* For looping over indices of the table */
  int nColumn;          /* Number of columns in the data */
  int nHidden = 0;      /* Number of hidden columns if TABLE is virtual */
  int baseCur = 0;      /* VDBE Cursor number for pTab */
  int keyColumn = -1;   /* Column that is the INTEGER PRIMARY KEY */
  int endOfLoop;        /* Label for the end of the insertion loop */
  int useTempTable = 0; /* Store SELECT results in intermediate table */
  int srcTab = 0;       /* Data comes from this temporary cursor if >=0 */
  int addrInsTop = 0;   /* Jump to label "D" */
  int addrCont = 0;     /* Top of insert loop. Label "C" in templates 3 and 4 */
  int addrSelect = 0;   /* Address of coroutine that implements the SELECT */
  SelectDest dest;      /* Destination for SELECT on rhs of INSERT */
  int newIdx = -1;      /* Cursor for the NEW pseudo-table */
  int iDb;              /* Index of database holding TABLE */
  Db *pDb;              /* The database containing table being inserted into */
  int appendFlag = 0;   /* True if the insert is likely to be an append */

  /* Register allocations */
  int regFromSelect;    /* Base register for data coming from SELECT */
  int regAutoinc = 0;   /* Register holding the AUTOINCREMENT counter */
  int regRowCount = 0;  /* Memory cell used for the row counter */
  int regIns;           /* Block of regs holding rowid+data being inserted */
  int regRowid;         /* registers holding insert rowid */
  int regData;          /* register holding first column to insert */
  int regRecord;        /* Holds the assemblied row record */
  int regEof;           /* Register recording end of SELECT data */
  int *aRegIdx = 0;     /* One register allocated to each index */


#ifndef SQLITE_OMIT_TRIGGER
  int isView;                 /* True if attempting to insert into a view */
  int triggers_exist = 0;     /* True if there are FOR EACH ROW triggers */
#endif

  db = pParse->db;
  if( pParse->nErr || db->mallocFailed ){
    goto insert_cleanup;
  }

  /* Locate the table into which we will be inserting new information.
  */
  assert( pTabList->nSrc==1 );
  zTab = pTabList->a[0].zName;
  if( zTab==0 ) goto insert_cleanup;
  pTab = sqlite3SrcListLookup(pParse, pTabList);
  if( pTab==0 ){
    goto insert_cleanup;
  }
  iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
  assert( iDb<db->nDb );
  pDb = &db->aDb[iDb];
  zDb = pDb->zName;
  if( sqlite3AuthCheck(pParse, SQLITE_INSERT, pTab->zName, 0, zDb) ){
    goto insert_cleanup;
  }

  /* Figure out if we have any triggers and if the table being
  ** inserted into is a view
  */
#ifndef SQLITE_OMIT_TRIGGER
  triggers_exist = sqlite3TriggersExist(pParse, pTab, TK_INSERT, 0);
  isView = pTab->pSelect!=0;
#else
# define triggers_exist 0
# define isView 0
#endif
#ifdef SQLITE_OMIT_VIEW
# undef isView
# define isView 0
#endif

  /* Ensure that:
  *  (a) the table is not read-only, 
  *  (b) that if it is a view then ON INSERT triggers exist
  */
  if( sqlite3IsReadOnly(pParse, pTab, triggers_exist) ){
    goto insert_cleanup;
  }
  assert( pTab!=0 );

  /* If pTab is really a view, make sure it has been initialized.
  ** ViewGetColumnNames() is a no-op if pTab is not a view (or virtual 
  ** module table).
  */
  if( sqlite3ViewGetColumnNames(pParse, pTab) ){
    goto insert_cleanup;
  }

  /* Allocate a VDBE
  */
  v = sqlite3GetVdbe(pParse);
  if( v==0 ) goto insert_cleanup;
  if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);
  sqlite3BeginWriteOperation(pParse, pSelect || triggers_exist, iDb);

  /* if there are row triggers, allocate a temp table for new.* references. */
  if( triggers_exist ){
    newIdx = pParse->nTab++;
  }

#ifndef SQLITE_OMIT_XFER_OPT
  /* If the statement is of the form
  **
  **       INSERT INTO <table1> SELECT * FROM <table2>;
  **
  ** Then special optimizations can be applied that make the transfer
  ** very fast and which reduce fragmentation of indices.
  **
  ** This is the 2nd template.
  */
  if( pColumn==0 && xferOptimization(pParse, pTab, pSelect, onError, iDb) ){
    assert( !triggers_exist );
    assert( pList==0 );
    goto insert_cleanup;
  }
#endif /* SQLITE_OMIT_XFER_OPT */

  /* If this is an AUTOINCREMENT table, look up the sequence number in the
  ** sqlite_sequence table and store it in memory cell regAutoinc.
  */
  regAutoinc = autoIncBegin(pParse, iDb, pTab);

  /* Figure out how many columns of data are supplied.  If the data
  ** is coming from a SELECT statement, then generate a co-routine that
  ** produces a single row of the SELECT on each invocation.  The
  ** co-routine is the common header to the 3rd and 4th templates.
  */
  if( pSelect ){
    /* Data is coming from a SELECT.  Generate code to implement that SELECT
    ** as a co-routine.  The code is common to both the 3rd and 4th
    ** templates:
    **
    **         EOF <- 0
    **         X <- A
    **         goto B
    **      A: setup for the SELECT
    **         loop over the tables in the SELECT
    **           load value into register R..R+n
    **           yield X
    **         end loop
    **         cleanup after the SELECT
    **         EOF <- 1
    **         yield X
    **         halt-error
    **
    ** On each invocation of the co-routine, it puts a single row of the
    ** SELECT result into registers dest.iMem...dest.iMem+dest.nMem-1.
    ** (These output registers are allocated by sqlite3Select().)  When
    ** the SELECT completes, it sets the EOF flag stored in regEof.
    */
    int rc, j1;

    regEof = ++pParse->nMem;
    sqlite3VdbeAddOp2(v, OP_Integer, 0, regEof);      /* EOF <- 0 */
    VdbeComment((v, "SELECT eof flag"));
    sqlite3SelectDestInit(&dest, SRT_Coroutine, ++pParse->nMem);
    addrSelect = sqlite3VdbeCurrentAddr(v)+2;
    sqlite3VdbeAddOp2(v, OP_Integer, addrSelect-1, dest.iParm);
    j1 = sqlite3VdbeAddOp2(v, OP_Goto, 0, 0);
    VdbeComment((v, "Jump over SELECT coroutine"));

    /* Resolve the expressions in the SELECT statement and execute it. */
    rc = sqlite3Select(pParse, pSelect, &dest, 0, 0, 0);
    if( rc || pParse->nErr || db->mallocFailed ){
      goto insert_cleanup;
    }
    sqlite3VdbeAddOp2(v, OP_Integer, 1, regEof);         /* EOF <- 1 */
    sqlite3VdbeAddOp1(v, OP_Yield, dest.iParm);   /* yield X */
    sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_INTERNAL, OE_Abort);
    VdbeComment((v, "End of SELECT coroutine"));
    sqlite3VdbeJumpHere(v, j1);                          /* label B: */

    regFromSelect = dest.iMem;
    assert( pSelect->pEList );
    nColumn = pSelect->pEList->nExpr;
    assert( dest.nMem==nColumn );

    /* Set useTempTable to TRUE if the result of the SELECT statement
    ** should be written into a temporary table (template 4).  Set to
    ** FALSE if each* row of the SELECT can be written directly into
    ** the destination table (template 3).
    **
    ** A temp table must be used if the table being updated is also one
    ** of the tables being read by the SELECT statement.  Also use a 
    ** temp table in the case of row triggers.
    */
    if( triggers_exist || readsTable(v, addrSelect, iDb, pTab) ){
      useTempTable = 1;
    }

    if( useTempTable ){
      /* Invoke the coroutine to extract information from the SELECT
      ** and add it to a transient table srcTab.  The code generated
      ** here is from the 4th template:
      **
      **      B: open temp table
      **      L: yield X
      **         if EOF goto M
      **         insert row from R..R+n into temp table
      **         goto L
      **      M: ...
      */
      int regRec;      /* Register to hold packed record */
      int regRowid;    /* Register to hold temp table ROWID */
      int addrTop;     /* Label "L" */
      int addrIf;      /* Address of jump to M */

      srcTab = pParse->nTab++;
      regRec = sqlite3GetTempReg(pParse);
      regRowid = sqlite3GetTempReg(pParse);
      sqlite3VdbeAddOp2(v, OP_OpenEphemeral, srcTab, nColumn);
      addrTop = sqlite3VdbeAddOp1(v, OP_Yield, dest.iParm);
      addrIf = sqlite3VdbeAddOp1(v, OP_If, regEof);
      sqlite3VdbeAddOp3(v, OP_MakeRecord, regFromSelect, nColumn, regRec);
      sqlite3VdbeAddOp2(v, OP_NewRowid, srcTab, regRowid);
      sqlite3VdbeAddOp3(v, OP_Insert, srcTab, regRec, regRowid);
      sqlite3VdbeAddOp2(v, OP_Goto, 0, addrTop);
      sqlite3VdbeJumpHere(v, addrIf);
      sqlite3ReleaseTempReg(pParse, regRec);
      sqlite3ReleaseTempReg(pParse, regRowid);
    }
  }else{
    /* This is the case if the data for the INSERT is coming from a VALUES
    ** clause
    */
    NameContext sNC;
    memset(&sNC, 0, sizeof(sNC));
    sNC.pParse = pParse;
    srcTab = -1;
    assert( useTempTable==0 );
    nColumn = pList ? pList->nExpr : 0;
    for(i=0; i<nColumn; i++){
      if( sqlite3ExprResolveNames(&sNC, pList->a[i].pExpr) ){
        goto insert_cleanup;
      }
    }
  }

  /* Make sure the number of columns in the source data matches the number
  ** of columns to be inserted into the table.
  */
  if( IsVirtual(pTab) ){
    for(i=0; i<pTab->nCol; i++){
      nHidden += (IsHiddenColumn(&pTab->aCol[i]) ? 1 : 0);
    }
  }
  if( pColumn==0 && nColumn && nColumn!=(pTab->nCol-nHidden) ){
    sqlite3ErrorMsg(pParse, 
       "table %S has %d columns but %d values were supplied",
       pTabList, 0, pTab->nCol, nColumn);
    goto insert_cleanup;
  }
  if( pColumn!=0 && nColumn!=pColumn->nId ){
    sqlite3ErrorMsg(pParse, "%d values for %d columns", nColumn, pColumn->nId);
    goto insert_cleanup;
  }

  /* If the INSERT statement included an IDLIST term, then make sure
  ** all elements of the IDLIST really are columns of the table and 
  ** remember the column indices.
  **
  ** If the table has an INTEGER PRIMARY KEY column and that column
  ** is named in the IDLIST, then record in the keyColumn variable
  ** the index into IDLIST of the primary key column.  keyColumn is
  ** the index of the primary key as it appears in IDLIST, not as
  ** is appears in the original table.  (The index of the primary
  ** key in the original table is pTab->iPKey.)
  */
  if( pColumn ){
    for(i=0; i<pColumn->nId; i++){
      pColumn->a[i].idx = -1;
    }
    for(i=0; i<pColumn->nId; i++){
      for(j=0; j<pTab->nCol; j++){
        if( sqlite3StrICmp(pColumn->a[i].zName, pTab->aCol[j].zName)==0 ){
          pColumn->a[i].idx = j;
          if( j==pTab->iPKey ){
            keyColumn = i;
          }
          break;
        }
      }
      if( j>=pTab->nCol ){
        if( sqlite3IsRowid(pColumn->a[i].zName) ){
          keyColumn = i;
        }else{
          sqlite3ErrorMsg(pParse, "table %S has no column named %s",
              pTabList, 0, pColumn->a[i].zName);
          pParse->nErr++;
          goto insert_cleanup;
        }
      }
    }
  }

  /* If there is no IDLIST term but the table has an integer primary
  ** key, the set the keyColumn variable to the primary key column index
  ** in the original table definition.
  */
  if( pColumn==0 && nColumn>0 ){
    keyColumn = pTab->iPKey;
  }

  /* Open the temp table for FOR EACH ROW triggers
  */
  if( triggers_exist ){
    sqlite3VdbeAddOp2(v, OP_SetNumColumns, 0, pTab->nCol);
    sqlite3VdbeAddOp2(v, OP_OpenPseudo, newIdx, 0);
  }
    
  /* Initialize the count of rows to be inserted
  */
  if( db->flags & SQLITE_CountRows ){
    regRowCount = ++pParse->nMem;
    sqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount);
  }

  /* If this is not a view, open the table and and all indices */
  if( !isView ){
    int nIdx;
    int i;

    baseCur = pParse->nTab;
    nIdx = sqlite3OpenTableAndIndices(pParse, pTab, baseCur, OP_OpenWrite);
    aRegIdx = sqlite3DbMallocRaw(db, sizeof(int)*(nIdx+1));
    if( aRegIdx==0 ){
      goto insert_cleanup;
    }
    for(i=0; i<nIdx; i++){
      aRegIdx[i] = ++pParse->nMem;
    }
  }

  /* This is the top of the main insertion loop */
  if( useTempTable ){
    /* This block codes the top of loop only.  The complete loop is the
    ** following pseudocode (template 4):
    **
    **         rewind temp table
    **      C: loop over rows of intermediate table
    **           transfer values form intermediate table into <table>
    **         end loop
    **      D: ...
    */
    addrInsTop = sqlite3VdbeAddOp1(v, OP_Rewind, srcTab);
    addrCont = sqlite3VdbeCurrentAddr(v);
  }else if( pSelect ){
    /* This block codes the top of loop only.  The complete loop is the
    ** following pseudocode (template 3):
    **
    **      C: yield X
    **         if EOF goto D
    **         insert the select result into <table> from R..R+n
    **         goto C
    **      D: ...
    */
    addrCont = sqlite3VdbeAddOp1(v, OP_Yield, dest.iParm);
    addrInsTop = sqlite3VdbeAddOp1(v, OP_If, regEof);
  }

  /* Allocate registers for holding the rowid of the new row,
  ** the content of the new row, and the assemblied row record.
  */
  regRecord = ++pParse->nMem;
  regRowid = regIns = pParse->nMem+1;
  pParse->nMem += pTab->nCol + 1;
  if( IsVirtual(pTab) ){
    regRowid++;
    pParse->nMem++;
  }
  regData = regRowid+1;

  /* Run the BEFORE and INSTEAD OF triggers, if there are any
  */
  endOfLoop = sqlite3VdbeMakeLabel(v);
  if( triggers_exist & TRIGGER_BEFORE ){
    int regRowid;
    int regCols;
    int regRec;

    /* build the NEW.* reference row.  Note that if there is an INTEGER
    ** PRIMARY KEY into which a NULL is being inserted, that NULL will be
    ** translated into a unique ID for the row.  But on a BEFORE trigger,
    ** we do not know what the unique ID will be (because the insert has
    ** not happened yet) so we substitute a rowid of -1
    */
    regRowid = sqlite3GetTempReg(pParse);
    if( keyColumn<0 ){
      sqlite3VdbeAddOp2(v, OP_Integer, -1, regRowid);
    }else if( useTempTable ){
      sqlite3VdbeAddOp3(v, OP_Column, srcTab, keyColumn, regRowid);
    }else{
      int j1;
      assert( pSelect==0 );  /* Otherwise useTempTable is true */
      sqlite3ExprCode(pParse, pList->a[keyColumn].pExpr, regRowid);
      j1 = sqlite3VdbeAddOp1(v, OP_NotNull, regRowid);
      sqlite3VdbeAddOp2(v, OP_Integer, -1, regRowid);
      sqlite3VdbeJumpHere(v, j1);
      sqlite3VdbeAddOp1(v, OP_MustBeInt, regRowid);
    }

    /* Cannot have triggers on a virtual table. If it were possible,
    ** this block would have to account for hidden column.
    */
    assert(!IsVirtual(pTab));

    /* Create the new column data
    */
    regCols = sqlite3GetTempRange(pParse, pTab->nCol);
    for(i=0; i<pTab->nCol; i++){
      if( pColumn==0 ){
        j = i;
      }else{
        for(j=0; j<pColumn->nId; j++){
          if( pColumn->a[j].idx==i ) break;
        }
      }
      if( pColumn && j>=pColumn->nId ){
        sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regCols+i);
      }else if( useTempTable ){
        sqlite3VdbeAddOp3(v, OP_Column, srcTab, j, regCols+i); 
      }else{
        assert( pSelect==0 ); /* Otherwise useTempTable is true */
        sqlite3ExprCodeAndCache(pParse, pList->a[j].pExpr, regCols+i);
      }
    }
    regRec = sqlite3GetTempReg(pParse);
    sqlite3VdbeAddOp3(v, OP_MakeRecord, regCols, pTab->nCol, regRec);

    /* If this is an INSERT on a view with an INSTEAD OF INSERT trigger,
    ** do not attempt any conversions before assembling the record.
    ** If this is a real table, attempt conversions as required by the
    ** table column affinities.
    */
    if( !isView ){
      sqlite3TableAffinityStr(v, pTab);
    }
    sqlite3VdbeAddOp3(v, OP_Insert, newIdx, regRec, regRowid);
    sqlite3ReleaseTempReg(pParse, regRec);
    sqlite3ReleaseTempReg(pParse, regRowid);
    sqlite3ReleaseTempRange(pParse, regCols, pTab->nCol);

    /* Fire BEFORE or INSTEAD OF triggers */
    if( sqlite3CodeRowTrigger(pParse, TK_INSERT, 0, TRIGGER_BEFORE, pTab, 
        newIdx, -1, onError, endOfLoop, 0, 0) ){
      goto insert_cleanup;
    }
  }

  /* Push the record number for the new entry onto the stack.  The
  ** record number is a randomly generate integer created by NewRowid
  ** except when the table has an INTEGER PRIMARY KEY column, in which
  ** case the record number is the same as that column. 
  */
  if( !isView ){
    if( IsVirtual(pTab) ){
      /* The row that the VUpdate opcode will delete: none */
      sqlite3VdbeAddOp2(v, OP_Null, 0, regIns);
    }
    if( keyColumn>=0 ){
      if( useTempTable ){
        sqlite3VdbeAddOp3(v, OP_Column, srcTab, keyColumn, regRowid);
      }else if( pSelect ){
        sqlite3VdbeAddOp2(v, OP_SCopy, regFromSelect+keyColumn, regRowid);
      }else{
        VdbeOp *pOp;
        sqlite3ExprCode(pParse, pList->a[keyColumn].pExpr, regRowid);
        pOp = sqlite3VdbeGetOp(v, sqlite3VdbeCurrentAddr(v) - 1);
        if( pOp && pOp->opcode==OP_Null && !IsVirtual(pTab) ){
          appendFlag = 1;
          pOp->opcode = OP_NewRowid;
          pOp->p1 = baseCur;
          pOp->p2 = regRowid;
          pOp->p3 = regAutoinc;
        }
      }
      /* If the PRIMARY KEY expression is NULL, then use OP_NewRowid
      ** to generate a unique primary key value.
      */
      if( !appendFlag ){
        int j1;
        if( !IsVirtual(pTab) ){
          j1 = sqlite3VdbeAddOp1(v, OP_NotNull, regRowid);
          sqlite3VdbeAddOp3(v, OP_NewRowid, baseCur, regRowid, regAutoinc);
          sqlite3VdbeJumpHere(v, j1);
        }else{
          j1 = sqlite3VdbeCurrentAddr(v);
          sqlite3VdbeAddOp2(v, OP_IsNull, regRowid, j1+2);
        }
        sqlite3VdbeAddOp1(v, OP_MustBeInt, regRowid);
      }
    }else if( IsVirtual(pTab) ){
      sqlite3VdbeAddOp2(v, OP_Null, 0, regRowid);
    }else{
      sqlite3VdbeAddOp3(v, OP_NewRowid, baseCur, regRowid, regAutoinc);
      appendFlag = 1;
    }
    autoIncStep(pParse, regAutoinc, regRowid);

    /* Push onto the stack, data for all columns of the new entry, beginning
    ** with the first column.
    */
    nHidden = 0;
    for(i=0; i<pTab->nCol; i++){
      int iRegStore = regRowid+1+i;
      if( i==pTab->iPKey ){
        /* The value of the INTEGER PRIMARY KEY column is always a NULL.
        ** Whenever this column is read, the record number will be substituted
        ** in its place.  So will fill this column with a NULL to avoid
        ** taking up data space with information that will never be used. */
        sqlite3VdbeAddOp2(v, OP_Null, 0, iRegStore);
        continue;
      }
      if( pColumn==0 ){
        if( IsHiddenColumn(&pTab->aCol[i]) ){
          assert( IsVirtual(pTab) );
          j = -1;
          nHidden++;
        }else{
          j = i - nHidden;
        }
      }else{
        for(j=0; j<pColumn->nId; j++){
          if( pColumn->a[j].idx==i ) break;
        }
      }
      if( j<0 || nColumn==0 || (pColumn && j>=pColumn->nId) ){
        sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, iRegStore);
      }else if( useTempTable ){
        sqlite3VdbeAddOp3(v, OP_Column, srcTab, j, iRegStore); 
      }else if( pSelect ){
        sqlite3VdbeAddOp2(v, OP_SCopy, regFromSelect+j, iRegStore);
      }else{
        sqlite3ExprCode(pParse, pList->a[j].pExpr, iRegStore);
      }
    }

    /* Generate code to check constraints and generate index keys and
    ** do the insertion.
    */
#ifndef SQLITE_OMIT_VIRTUALTABLE
    if( IsVirtual(pTab) ){
      sqlite3VtabMakeWritable(pParse, pTab);
      sqlite3VdbeAddOp4(v, OP_VUpdate, 1, pTab->nCol+2, regIns,
                     (const char*)pTab->pVtab, P4_VTAB);
    }else
#endif
    {
      sqlite3GenerateConstraintChecks(
          pParse,
          pTab,
          baseCur,
          regIns,
          aRegIdx,
          keyColumn>=0,
          0,
          onError,
          endOfLoop
      );
      sqlite3CompleteInsertion(
          pParse,
          pTab,
          baseCur,
          regIns,
          aRegIdx,
          0,
          0,
          (triggers_exist & TRIGGER_AFTER)!=0 ? newIdx : -1,
          appendFlag
       );
    }
  }

  /* Update the count of rows that are inserted
  */
  if( (db->flags & SQLITE_CountRows)!=0 ){
    sqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1);
  }

  if( triggers_exist ){
    /* Code AFTER triggers */
    if( sqlite3CodeRowTrigger(pParse, TK_INSERT, 0, TRIGGER_AFTER, pTab,
          newIdx, -1, onError, endOfLoop, 0, 0) ){
      goto insert_cleanup;
    }
  }

  /* The bottom of the main insertion loop, if the data source
  ** is a SELECT statement.
  */
  sqlite3VdbeResolveLabel(v, endOfLoop);
  if( useTempTable ){
    sqlite3VdbeAddOp2(v, OP_Next, srcTab, addrCont);
    sqlite3VdbeJumpHere(v, addrInsTop);
    sqlite3VdbeAddOp1(v, OP_Close, srcTab);
  }else if( pSelect ){
    sqlite3VdbeAddOp2(v, OP_Goto, 0, addrCont);
    sqlite3VdbeJumpHere(v, addrInsTop);
  }

  if( !IsVirtual(pTab) && !isView ){
    /* Close all tables opened */
    sqlite3VdbeAddOp1(v, OP_Close, baseCur);
    for(idx=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, idx++){
      sqlite3VdbeAddOp1(v, OP_Close, idx+baseCur);
    }
  }

  /* Update the sqlite_sequence table by storing the content of the
  ** counter value in memory regAutoinc back into the sqlite_sequence
  ** table.
  */
  autoIncEnd(pParse, iDb, pTab, regAutoinc);

  /*
  ** Return the number of rows inserted. If this routine is 
  ** generating code because of a call to sqlite3NestedParse(), do not
  ** invoke the callback function.
  */
  if( db->flags & SQLITE_CountRows && pParse->nested==0 && !pParse->trigStack ){
    sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1);
    sqlite3VdbeSetNumCols(v, 1);
    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows inserted", P4_STATIC);
  }

insert_cleanup:
  sqlite3SrcListDelete(db, pTabList);
  sqlite3ExprListDelete(db, pList);
  sqlite3SelectDelete(db, pSelect);
  sqlite3IdListDelete(db, pColumn);
  sqlite3DbFree(db, aRegIdx);
}

/*
** Generate code to do constraint checks prior to an INSERT or an UPDATE.
**
** The input is a range of consecutive registers as follows:
**
**    1.  The rowid of the row to be updated before the update.  This
**        value is omitted unless we are doing an UPDATE that involves a
**        change to the record number or writing to a virtual table.
**
**    2.  The rowid of the row after the update.
**
**    3.  The data in the first column of the entry after the update.
**
**    i.  Data from middle columns...
**
**    N.  The data in the last column of the entry after the update.
**
** The regRowid parameter is the index of the register containing (2).
**
** The old rowid shown as entry (1) above is omitted unless both isUpdate
** and rowidChng are 1.  isUpdate is true for UPDATEs and false for
** INSERTs.  RowidChng means that the new rowid is explicitly specified by
** the update or insert statement.  If rowidChng is false, it means that
** the rowid is computed automatically in an insert or that the rowid value
** is not modified by the update.
**
** The code generated by this routine store new index entries into
** registers identified by aRegIdx[].  No index entry is created for
** indices where aRegIdx[i]==0.  The order of indices in aRegIdx[] is
** the same as the order of indices on the linked list of indices
** attached to the table.
**
** This routine also generates code to check constraints.  NOT NULL,
** CHECK, and UNIQUE constraints are all checked.  If a constraint fails,
** then the appropriate action is performed.  There are five possible
** actions: ROLLBACK, ABORT, FAIL, REPLACE, and IGNORE.
**
**  Constraint type  Action       What Happens
**  ---------------  ----------   ----------------------------------------
**  any              ROLLBACK     The current transaction is rolled back and
**                                sqlite3_exec() returns immediately with a
**                                return code of SQLITE_CONSTRAINT.
**
**  any              ABORT        Back out changes from the current command
**                                only (do not do a complete rollback) then
**                                cause sqlite3_exec() to return immediately
**                                with SQLITE_CONSTRAINT.
**
**  any              FAIL         Sqlite_exec() returns immediately with a
**                                return code of SQLITE_CONSTRAINT.  The
**                                transaction is not rolled back and any
**                                prior changes are retained.
**
**  any              IGNORE       The record number and data is popped from
**                                the stack and there is an immediate jump
**                                to label ignoreDest.
**
**  NOT NULL         REPLACE      The NULL value is replace by the default
**                                value for that column.  If the default value
**                                is NULL, the action is the same as ABORT.
**
**  UNIQUE           REPLACE      The other row that conflicts with the row
**                                being inserted is removed.
**
**  CHECK            REPLACE      Illegal.  The results in an exception.
**
** Which action to take is determined by the overrideError parameter.
** Or if overrideError==OE_Default, then the pParse->onError parameter
** is used.  Or if pParse->onError==OE_Default then the onError value
** for the constraint is used.
**
** The calling routine must open a read/write cursor for pTab with
** cursor number "baseCur".  All indices of pTab must also have open
** read/write cursors with cursor number baseCur+i for the i-th cursor.
** Except, if there is no possibility of a REPLACE action then
** cursors do not need to be open for indices where aRegIdx[i]==0.
*/
void sqlite3GenerateConstraintChecks(
  Parse *pParse,      /* The parser context */
  Table *pTab,        /* the table into which we are inserting */
  int baseCur,        /* Index of a read/write cursor pointing at pTab */
  int regRowid,       /* Index of the range of input registers */
  int *aRegIdx,       /* Register used by each index.  0 for unused indices */
  int rowidChng,      /* True if the rowid might collide with existing entry */
  int isUpdate,       /* True for UPDATE, False for INSERT */
  int overrideError,  /* Override onError to this if not OE_Default */
  int ignoreDest      /* Jump to this label on an OE_Ignore resolution */
){
  int i;
  Vdbe *v;
  int nCol;
  int onError;
  int j1, j2, j3;     /* Addresses of jump instructions */
  int regData;        /* Register containing first data column */
  int iCur;
  Index *pIdx;
  int seenReplace = 0;
  int hasTwoRowids = (isUpdate && rowidChng);

  v = sqlite3GetVdbe(pParse);
  assert( v!=0 );
  assert( pTab->pSelect==0 );  /* This table is not a VIEW */
  nCol = pTab->nCol;
  regData = regRowid + 1;


  /* Test all NOT NULL constraints.
  */
  for(i=0; i<nCol; i++){
    if( i==pTab->iPKey ){
      continue;
    }
    onError = pTab->aCol[i].notNull;
    if( onError==OE_None ) continue;
    if( overrideError!=OE_Default ){
      onError = overrideError;
    }else if( onError==OE_Default ){
      onError = OE_Abort;
    }
    if( onError==OE_Replace && pTab->aCol[i].pDflt==0 ){
      onError = OE_Abort;
    }
    j1 = sqlite3VdbeAddOp1(v, OP_NotNull, regData+i);
    assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail
        || onError==OE_Ignore || onError==OE_Replace );
    switch( onError ){
      case OE_Rollback:
      case OE_Abort:
      case OE_Fail: {
        char *zMsg;
        sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_CONSTRAINT, onError);
        zMsg = sqlite3MPrintf(pParse->db, "%s.%s may not be NULL",
                              pTab->zName, pTab->aCol[i].zName);
        sqlite3VdbeChangeP4(v, -1, zMsg, P4_DYNAMIC);
        break;
      }
      case OE_Ignore: {
        sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest);
        break;
      }
      case OE_Replace: {
        sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regData+i);
        break;
      }
    }
    sqlite3VdbeJumpHere(v, j1);
  }

  /* Test all CHECK constraints
  */
#ifndef SQLITE_OMIT_CHECK
  if( pTab->pCheck && (pParse->db->flags & SQLITE_IgnoreChecks)==0 ){
    int allOk = sqlite3VdbeMakeLabel(v);
    pParse->ckBase = regData;
    sqlite3ExprIfTrue(pParse, pTab->pCheck, allOk, SQLITE_JUMPIFNULL);
    onError = overrideError!=OE_Default ? overrideError : OE_Abort;
    if( onError==OE_Ignore ){
      sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest);
    }else{
      sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_CONSTRAINT, onError);
    }
    sqlite3VdbeResolveLabel(v, allOk);
  }
#endif /* !defined(SQLITE_OMIT_CHECK) */

  /* If we have an INTEGER PRIMARY KEY, make sure the primary key
  ** of the new record does not previously exist.  Except, if this
  ** is an UPDATE and the primary key is not changing, that is OK.
  */
  if( rowidChng ){
    onError = pTab->keyConf;
    if( overrideError!=OE_Default ){
      onError = overrideError;
    }else if( onError==OE_Default ){
      onError = OE_Abort;
    }
    
    if( onError!=OE_Replace || pTab->pIndex ){
      if( isUpdate ){
        j2 = sqlite3VdbeAddOp3(v, OP_Eq, regRowid, 0, regRowid-1);
      }
      j3 = sqlite3VdbeAddOp3(v, OP_NotExists, baseCur, 0, regRowid);
      switch( onError ){
        default: {
          onError = OE_Abort;
          /* Fall thru into the next case */
        }
        case OE_Rollback:
        case OE_Abort:
        case OE_Fail: {
          sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CONSTRAINT, onError, 0,
                           "PRIMARY KEY must be unique", P4_STATIC);
          break;
        }
        case OE_Replace: {
          sqlite3GenerateRowIndexDelete(pParse, pTab, baseCur, 0);
          seenReplace = 1;
          break;
        }
        case OE_Ignore: {
          assert( seenReplace==0 );
          sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest);
          break;
        }
      }
      sqlite3VdbeJumpHere(v, j3);
      if( isUpdate ){
        sqlite3VdbeJumpHere(v, j2);
      }
    }
  }

  /* Test all UNIQUE constraints by creating entries for each UNIQUE
  ** index and making sure that duplicate entries do not already exist.
  ** Add the new records to the indices as we go.
  */
  for(iCur=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, iCur++){
    int regIdx;
    int regR;

    if( aRegIdx[iCur]==0 ) continue;  /* Skip unused indices */

    /* Create a key for accessing the index entry */
    regIdx = sqlite3GetTempRange(pParse, pIdx->nColumn+1);
    for(i=0; i<pIdx->nColumn; i++){
      int idx = pIdx->aiColumn[i];
      if( idx==pTab->iPKey ){
        sqlite3VdbeAddOp2(v, OP_SCopy, regRowid, regIdx+i);
      }else{
        sqlite3VdbeAddOp2(v, OP_SCopy, regData+idx, regIdx+i);
      }
    }
    sqlite3VdbeAddOp2(v, OP_SCopy, regRowid, regIdx+i);
    sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn+1, aRegIdx[iCur]);
    sqlite3IndexAffinityStr(v, pIdx);
    sqlite3ExprCacheAffinityChange(pParse, regIdx, pIdx->nColumn+1);
    sqlite3ReleaseTempRange(pParse, regIdx, pIdx->nColumn+1);

    /* Find out what action to take in case there is an indexing conflict */
    onError = pIdx->onError;
    if( onError==OE_None ) continue;  /* pIdx is not a UNIQUE index */
    if( overrideError!=OE_Default ){
      onError = overrideError;
    }else if( onError==OE_Default ){
      onError = OE_Abort;
    }
    if( seenReplace ){
      if( onError==OE_Ignore ) onError = OE_Replace;
      else if( onError==OE_Fail ) onError = OE_Abort;
    }
    

    /* Check to see if the new index entry will be unique */
    j2 = sqlite3VdbeAddOp3(v, OP_IsNull, regIdx, 0, pIdx->nColumn);
    regR = sqlite3GetTempReg(pParse);
    sqlite3VdbeAddOp2(v, OP_SCopy, regRowid-hasTwoRowids, regR);
    j3 = sqlite3VdbeAddOp4(v, OP_IsUnique, baseCur+iCur+1, 0,
                           regR, SQLITE_INT_TO_PTR(aRegIdx[iCur]),
                           P4_INT32);

    /* Generate code that executes if the new index entry is not unique */
    assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail
        || onError==OE_Ignore || onError==OE_Replace );
    switch( onError ){
      case OE_Rollback:
      case OE_Abort:
      case OE_Fail: {
        int j, n1, n2;
        char zErrMsg[200];
        sqlite3_snprintf(sizeof(zErrMsg), zErrMsg,
                         pIdx->nColumn>1 ? "columns " : "column ");
        n1 = strlen(zErrMsg);
        for(j=0; j<pIdx->nColumn && n1<sizeof(zErrMsg)-30; j++){
          char *zCol = pTab->aCol[pIdx->aiColumn[j]].zName;
          n2 = strlen(zCol);
          if( j>0 ){
            sqlite3_snprintf(sizeof(zErrMsg)-n1, &zErrMsg[n1], ", ");
            n1 += 2;
          }
          if( n1+n2>sizeof(zErrMsg)-30 ){
            sqlite3_snprintf(sizeof(zErrMsg)-n1, &zErrMsg[n1], "...");
            n1 += 3;
            break;
          }else{
            sqlite3_snprintf(sizeof(zErrMsg)-n1, &zErrMsg[n1], "%s", zCol);
            n1 += n2;
          }
        }
        sqlite3_snprintf(sizeof(zErrMsg)-n1, &zErrMsg[n1], 
            pIdx->nColumn>1 ? " are not unique" : " is not unique");
        sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CONSTRAINT, onError, 0, zErrMsg,0);
        break;
      }
      case OE_Ignore: {
        assert( seenReplace==0 );
        sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest);
        break;
      }
      case OE_Replace: {
        sqlite3GenerateRowDelete(pParse, pTab, baseCur, regR, 0);
        seenReplace = 1;
        break;
      }
    }
    sqlite3VdbeJumpHere(v, j2);
    sqlite3VdbeJumpHere(v, j3);
    sqlite3ReleaseTempReg(pParse, regR);
  }
}

/*
** This routine generates code to finish the INSERT or UPDATE operation
** that was started by a prior call to sqlite3GenerateConstraintChecks.
** A consecutive range of registers starting at regRowid contains the
** rowid and the content to be inserted.
**
** The arguments to this routine should be the same as the first six
** arguments to sqlite3GenerateConstraintChecks.
*/
void sqlite3CompleteInsertion(
  Parse *pParse,      /* The parser context */
  Table *pTab,        /* the table into which we are inserting */
  int baseCur,        /* Index of a read/write cursor pointing at pTab */
  int regRowid,       /* Range of content */
  int *aRegIdx,       /* Register used by each index.  0 for unused indices */
  int rowidChng,      /* True if the record number will change */
  int isUpdate,       /* True for UPDATE, False for INSERT */
  int newIdx,         /* Index of NEW table for triggers.  -1 if none */
  int appendBias      /* True if this is likely to be an append */
){
  int i;
  Vdbe *v;
  int nIdx;
  Index *pIdx;
  int pik_flags;
  int regData;
  int regRec;

  v = sqlite3GetVdbe(pParse);
  assert( v!=0 );
  assert( pTab->pSelect==0 );  /* This table is not a VIEW */
  for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){}
  for(i=nIdx-1; i>=0; i--){
    if( aRegIdx[i]==0 ) continue;
    sqlite3VdbeAddOp2(v, OP_IdxInsert, baseCur+i+1, aRegIdx[i]);
  }
  regData = regRowid + 1;
  regRec = sqlite3GetTempReg(pParse);
  sqlite3VdbeAddOp3(v, OP_MakeRecord, regData, pTab->nCol, regRec);
  sqlite3TableAffinityStr(v, pTab);
  sqlite3ExprCacheAffinityChange(pParse, regData, pTab->nCol);
#ifndef SQLITE_OMIT_TRIGGER
  if( newIdx>=0 ){
    sqlite3VdbeAddOp3(v, OP_Insert, newIdx, regRec, regRowid);
  }
#endif
  if( pParse->nested ){
    pik_flags = 0;
  }else{
    pik_flags = OPFLAG_NCHANGE;
    pik_flags |= (isUpdate?OPFLAG_ISUPDATE:OPFLAG_LASTROWID);
  }
  if( appendBias ){
    pik_flags |= OPFLAG_APPEND;
  }
  sqlite3VdbeAddOp3(v, OP_Insert, baseCur, regRec, regRowid);
  if( !pParse->nested ){
    sqlite3VdbeChangeP4(v, -1, pTab->zName, P4_STATIC);
  }
  sqlite3VdbeChangeP5(v, pik_flags);
}

/*
** Generate code that will open cursors for a table and for all
** indices of that table.  The "baseCur" parameter is the cursor number used
** for the table.  Indices are opened on subsequent cursors.
**
** Return the number of indices on the table.
*/
int sqlite3OpenTableAndIndices(
  Parse *pParse,   /* Parsing context */
  Table *pTab,     /* Table to be opened */
  int baseCur,        /* Cursor number assigned to the table */
  int op           /* OP_OpenRead or OP_OpenWrite */
){
  int i;
  int iDb;
  Index *pIdx;
  Vdbe *v;

  if( IsVirtual(pTab) ) return 0;
  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
  v = sqlite3GetVdbe(pParse);
  assert( v!=0 );
  sqlite3OpenTable(pParse, baseCur, iDb, pTab, op);
  for(i=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
    KeyInfo *pKey = sqlite3IndexKeyinfo(pParse, pIdx);
    assert( pIdx->pSchema==pTab->pSchema );
    sqlite3VdbeAddOp4(v, op, i+baseCur, pIdx->tnum, iDb,
                      (char*)pKey, P4_KEYINFO_HANDOFF);
    VdbeComment((v, "%s", pIdx->zName));
  }
  if( pParse->nTab<=baseCur+i ){
    pParse->nTab = baseCur+i;
  }
  return i-1;
}


#ifdef SQLITE_TEST
/*
** The following global variable is incremented whenever the
** transfer optimization is used.  This is used for testing
** purposes only - to make sure the transfer optimization really
** is happening when it is suppose to.
*/
int sqlite3_xferopt_count;
#endif /* SQLITE_TEST */


#ifndef SQLITE_OMIT_XFER_OPT
/*
** Check to collation names to see if they are compatible.
*/
static int xferCompatibleCollation(const char *z1, const char *z2){
  if( z1==0 ){
    return z2==0;
  }
  if( z2==0 ){
    return 0;
  }
  return sqlite3StrICmp(z1, z2)==0;
}


/*
** Check to see if index pSrc is compatible as a source of data
** for index pDest in an insert transfer optimization.  The rules
** for a compatible index:
**
**    *   The index is over the same set of columns
**    *   The same DESC and ASC markings occurs on all columns
**    *   The same onError processing (OE_Abort, OE_Ignore, etc)
**    *   The same collating sequence on each column
*/
static int xferCompatibleIndex(Index *pDest, Index *pSrc){
  int i;
  assert( pDest && pSrc );
  assert( pDest->pTable!=pSrc->pTable );
  if( pDest->nColumn!=pSrc->nColumn ){
    return 0;   /* Different number of columns */
  }
  if( pDest->onError!=pSrc->onError ){
    return 0;   /* Different conflict resolution strategies */
  }
  for(i=0; i<pSrc->nColumn; i++){
    if( pSrc->aiColumn[i]!=pDest->aiColumn[i] ){
      return 0;   /* Different columns indexed */
    }
    if( pSrc->aSortOrder[i]!=pDest->aSortOrder[i] ){
      return 0;   /* Different sort orders */
    }
    if( pSrc->azColl[i]!=pDest->azColl[i] ){
      return 0;   /* Different collating sequences */
    }
  }

  /* If no test above fails then the indices must be compatible */
  return 1;
}

/*
** Attempt the transfer optimization on INSERTs of the form
**
**     INSERT INTO tab1 SELECT * FROM tab2;
**
** This optimization is only attempted if
**
**    (1)  tab1 and tab2 have identical schemas including all the
**         same indices and constraints
**
**    (2)  tab1 and tab2 are different tables
**
**    (3)  There must be no triggers on tab1
**
**    (4)  The result set of the SELECT statement is "*"
**
**    (5)  The SELECT statement has no WHERE, HAVING, ORDER BY, GROUP BY,
**         or LIMIT clause.
**
**    (6)  The SELECT statement is a simple (not a compound) select that
**         contains only tab2 in its FROM clause
**
** This method for implementing the INSERT transfers raw records from
** tab2 over to tab1.  The columns are not decoded.  Raw records from
** the indices of tab2 are transfered to tab1 as well.  In so doing,
** the resulting tab1 has much less fragmentation.
**
** This routine returns TRUE if the optimization is attempted.  If any
** of the conditions above fail so that the optimization should not
** be attempted, then this routine returns FALSE.
*/
static int xferOptimization(
  Parse *pParse,        /* Parser context */
  Table *pDest,         /* The table we are inserting into */
  Select *pSelect,      /* A SELECT statement to use as the data source */
  int onError,          /* How to handle constraint errors */
  int iDbDest           /* The database of pDest */
){
  ExprList *pEList;                /* The result set of the SELECT */
  Table *pSrc;                     /* The table in the FROM clause of SELECT */
  Index *pSrcIdx, *pDestIdx;       /* Source and destination indices */
  struct SrcList_item *pItem;      /* An element of pSelect->pSrc */
  int i;                           /* Loop counter */
  int iDbSrc;                      /* The database of pSrc */
  int iSrc, iDest;                 /* Cursors from source and destination */
  int addr1, addr2;                /* Loop addresses */
  int emptyDestTest;               /* Address of test for empty pDest */
  int emptySrcTest;                /* Address of test for empty pSrc */
  Vdbe *v;                         /* The VDBE we are building */
  KeyInfo *pKey;                   /* Key information for an index */
  int regAutoinc;                  /* Memory register used by AUTOINC */
  int destHasUniqueIdx = 0;        /* True if pDest has a UNIQUE index */
  int regData, regRowid;           /* Registers holding data and rowid */

  if( pSelect==0 ){
    return 0;   /* Must be of the form  INSERT INTO ... SELECT ... */
  }
  if( pDest->pTrigger ){
    return 0;   /* tab1 must not have triggers */
  }
#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( pDest->isVirtual ){
    return 0;   /* tab1 must not be a virtual table */
  }
#endif
  if( onError==OE_Default ){
    onError = OE_Abort;
  }
  if( onError!=OE_Abort && onError!=OE_Rollback ){
    return 0;   /* Cannot do OR REPLACE or OR IGNORE or OR FAIL */
  }
  assert(pSelect->pSrc);   /* allocated even if there is no FROM clause */
  if( pSelect->pSrc->nSrc!=1 ){
    return 0;   /* FROM clause must have exactly one term */
  }
  if( pSelect->pSrc->a[0].pSelect ){
    return 0;   /* FROM clause cannot contain a subquery */
  }
  if( pSelect->pWhere ){
    return 0;   /* SELECT may not have a WHERE clause */
  }
  if( pSelect->pOrderBy ){
    return 0;   /* SELECT may not have an ORDER BY clause */
  }
  /* Do not need to test for a HAVING clause.  If HAVING is present but
  ** there is no ORDER BY, we will get an error. */
  if( pSelect->pGroupBy ){
    return 0;   /* SELECT may not have a GROUP BY clause */
  }
  if( pSelect->pLimit ){
    return 0;   /* SELECT may not have a LIMIT clause */
  }
  assert( pSelect->pOffset==0 );  /* Must be so if pLimit==0 */
  if( pSelect->pPrior ){
    return 0;   /* SELECT may not be a compound query */
  }
  if( pSelect->isDistinct ){
    return 0;   /* SELECT may not be DISTINCT */
  }
  pEList = pSelect->pEList;
  assert( pEList!=0 );
  if( pEList->nExpr!=1 ){
    return 0;   /* The result set must have exactly one column */
  }
  assert( pEList->a[0].pExpr );
  if( pEList->a[0].pExpr->op!=TK_ALL ){
    return 0;   /* The result set must be the special operator "*" */
  }

  /* At this point we have established that the statement is of the
  ** correct syntactic form to participate in this optimization.  Now
  ** we have to check the semantics.
  */
  pItem = pSelect->pSrc->a;
  pSrc = sqlite3LocateTable(pParse, 0, pItem->zName, pItem->zDatabase);
  if( pSrc==0 ){
    return 0;   /* FROM clause does not contain a real table */
  }
  if( pSrc==pDest ){
    return 0;   /* tab1 and tab2 may not be the same table */
  }
#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( pSrc->isVirtual ){
    return 0;   /* tab2 must not be a virtual table */
  }
#endif
  if( pSrc->pSelect ){
    return 0;   /* tab2 may not be a view */
  }
  if( pDest->nCol!=pSrc->nCol ){
    return 0;   /* Number of columns must be the same in tab1 and tab2 */
  }
  if( pDest->iPKey!=pSrc->iPKey ){
    return 0;   /* Both tables must have the same INTEGER PRIMARY KEY */
  }
  for(i=0; i<pDest->nCol; i++){
    if( pDest->aCol[i].affinity!=pSrc->aCol[i].affinity ){
      return 0;    /* Affinity must be the same on all columns */
    }
    if( !xferCompatibleCollation(pDest->aCol[i].zColl, pSrc->aCol[i].zColl) ){
      return 0;    /* Collating sequence must be the same on all columns */
    }
    if( pDest->aCol[i].notNull && !pSrc->aCol[i].notNull ){
      return 0;    /* tab2 must be NOT NULL if tab1 is */
    }
  }
  for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){
    if( pDestIdx->onError!=OE_None ){
      destHasUniqueIdx = 1;
    }
    for(pSrcIdx=pSrc->pIndex; pSrcIdx; pSrcIdx=pSrcIdx->pNext){
      if( xferCompatibleIndex(pDestIdx, pSrcIdx) ) break;
    }
    if( pSrcIdx==0 ){
      return 0;    /* pDestIdx has no corresponding index in pSrc */
    }
  }
#ifndef SQLITE_OMIT_CHECK
  if( pDest->pCheck && !sqlite3ExprCompare(pSrc->pCheck, pDest->pCheck) ){
    return 0;   /* Tables have different CHECK constraints.  Ticket #2252 */
  }
#endif

  /* If we get this far, it means either:
  **
  **    *   We can always do the transfer if the table contains an
  **        an integer primary key
  **
  **    *   We can conditionally do the transfer if the destination
  **        table is empty.
  */
#ifdef SQLITE_TEST
  sqlite3_xferopt_count++;
#endif
  iDbSrc = sqlite3SchemaToIndex(pParse->db, pSrc->pSchema);
  v = sqlite3GetVdbe(pParse);
  sqlite3CodeVerifySchema(pParse, iDbSrc);
  iSrc = pParse->nTab++;
  iDest = pParse->nTab++;
  regAutoinc = autoIncBegin(pParse, iDbDest, pDest);
  sqlite3OpenTable(pParse, iDest, iDbDest, pDest, OP_OpenWrite);
  if( (pDest->iPKey<0 && pDest->pIndex!=0) || destHasUniqueIdx ){
    /* If tables do not have an INTEGER PRIMARY KEY and there
    ** are indices to be copied and the destination is not empty,
    ** we have to disallow the transfer optimization because the
    ** the rowids might change which will mess up indexing.
    **
    ** Or if the destination has a UNIQUE index and is not empty,
    ** we also disallow the transfer optimization because we cannot
    ** insure that all entries in the union of DEST and SRC will be
    ** unique.
    */
    addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iDest, 0);
    emptyDestTest = sqlite3VdbeAddOp2(v, OP_Goto, 0, 0);
    sqlite3VdbeJumpHere(v, addr1);
  }else{
    emptyDestTest = 0;
  }
  sqlite3OpenTable(pParse, iSrc, iDbSrc, pSrc, OP_OpenRead);
  emptySrcTest = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0);
  regData = sqlite3GetTempReg(pParse);
  regRowid = sqlite3GetTempReg(pParse);
  if( pDest->iPKey>=0 ){
    addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
    addr2 = sqlite3VdbeAddOp3(v, OP_NotExists, iDest, 0, regRowid);
    sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CONSTRAINT, onError, 0,
                      "PRIMARY KEY must be unique", P4_STATIC);
    sqlite3VdbeJumpHere(v, addr2);
    autoIncStep(pParse, regAutoinc, regRowid);
  }else if( pDest->pIndex==0 ){
    addr1 = sqlite3VdbeAddOp2(v, OP_NewRowid, iDest, regRowid);
  }else{
    addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid);
    assert( pDest->autoInc==0 );
  }
  sqlite3VdbeAddOp2(v, OP_RowData, iSrc, regData);
  sqlite3VdbeAddOp3(v, OP_Insert, iDest, regData, regRowid);
  sqlite3VdbeChangeP5(v, OPFLAG_NCHANGE|OPFLAG_LASTROWID|OPFLAG_APPEND);
  sqlite3VdbeChangeP4(v, -1, pDest->zName, 0);
  sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1);
  autoIncEnd(pParse, iDbDest, pDest, regAutoinc);
  for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){
    for(pSrcIdx=pSrc->pIndex; pSrcIdx; pSrcIdx=pSrcIdx->pNext){
      if( xferCompatibleIndex(pDestIdx, pSrcIdx) ) break;
    }
    assert( pSrcIdx );
    sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
    sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
    pKey = sqlite3IndexKeyinfo(pParse, pSrcIdx);
    sqlite3VdbeAddOp4(v, OP_OpenRead, iSrc, pSrcIdx->tnum, iDbSrc,
                      (char*)pKey, P4_KEYINFO_HANDOFF);
    VdbeComment((v, "%s", pSrcIdx->zName));
    pKey = sqlite3IndexKeyinfo(pParse, pDestIdx);
    sqlite3VdbeAddOp4(v, OP_OpenWrite, iDest, pDestIdx->tnum, iDbDest,
                      (char*)pKey, P4_KEYINFO_HANDOFF);
    VdbeComment((v, "%s", pDestIdx->zName));
    addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0);
    sqlite3VdbeAddOp2(v, OP_RowKey, iSrc, regData);
    sqlite3VdbeAddOp3(v, OP_IdxInsert, iDest, regData, 1);
    sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1);
    sqlite3VdbeJumpHere(v, addr1);
  }
  sqlite3VdbeJumpHere(v, emptySrcTest);
  sqlite3ReleaseTempReg(pParse, regRowid);
  sqlite3ReleaseTempReg(pParse, regData);
  sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0);
  sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
  if( emptyDestTest ){
    sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_OK, 0);
    sqlite3VdbeJumpHere(v, emptyDestTest);
    sqlite3VdbeAddOp2(v, OP_Close, iDest, 0);
    return 0;
  }else{
    return 1;
  }
}
#endif /* SQLITE_OMIT_XFER_OPT */

/* Make sure "isView" gets undefined in case this file becomes part of
** the amalgamation - so that subsequent files do not see isView as a
** macro. */
#undef isView
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/journal.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
/*
** 2007 August 22
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** @(#) $Id: journal.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/

#ifdef SQLITE_ENABLE_ATOMIC_WRITE

/*
** This file implements a special kind of sqlite3_file object used
** by SQLite to create journal files if the atomic-write optimization
** is enabled.
**
** The distinctive characteristic of this sqlite3_file is that the
** actual on disk file is created lazily. When the file is created,
** the caller specifies a buffer size for an in-memory buffer to
** be used to service read() and write() requests. The actual file
** on disk is not created or populated until either:
**
**   1) The in-memory representation grows too large for the allocated 
**      buffer, or
**   2) The xSync() method is called.
*/

#include "sqliteInt.h"


/*
** A JournalFile object is a subclass of sqlite3_file used by
** as an open file handle for journal files.
*/
struct JournalFile {
  sqlite3_io_methods *pMethod;    /* I/O methods on journal files */
  int nBuf;                       /* Size of zBuf[] in bytes */
  char *zBuf;                     /* Space to buffer journal writes */
  int iSize;                      /* Amount of zBuf[] currently used */
  int flags;                      /* xOpen flags */
  sqlite3_vfs *pVfs;              /* The "real" underlying VFS */
  sqlite3_file *pReal;            /* The "real" underlying file descriptor */
  const char *zJournal;           /* Name of the journal file */
};
typedef struct JournalFile JournalFile;

/*
** If it does not already exists, create and populate the on-disk file 
** for JournalFile p.
*/
static int createFile(JournalFile *p){
  int rc = SQLITE_OK;
  if( !p->pReal ){
    sqlite3_file *pReal = (sqlite3_file *)&p[1];
    rc = sqlite3OsOpen(p->pVfs, p->zJournal, pReal, p->flags, 0);
    if( rc==SQLITE_OK ){
      p->pReal = pReal;
      if( p->iSize>0 ){
        assert(p->iSize<=p->nBuf);
        rc = sqlite3OsWrite(p->pReal, p->zBuf, p->iSize, 0);
      }
    }
  }
  return rc;
}

/*
** Close the file.
*/
static int jrnlClose(sqlite3_file *pJfd){
  JournalFile *p = (JournalFile *)pJfd;
  if( p->pReal ){
    sqlite3OsClose(p->pReal);
  }
  sqlite3_free(p->zBuf);
  return SQLITE_OK;
}

/*
** Read data from the file.
*/
static int jrnlRead(
  sqlite3_file *pJfd,    /* The journal file from which to read */
  void *zBuf,            /* Put the results here */
  int iAmt,              /* Number of bytes to read */
  sqlite_int64 iOfst     /* Begin reading at this offset */
){
  int rc = SQLITE_OK;
  JournalFile *p = (JournalFile *)pJfd;
  if( p->pReal ){
    rc = sqlite3OsRead(p->pReal, zBuf, iAmt, iOfst);
  }else{
    assert( iAmt+iOfst<=p->iSize );
    memcpy(zBuf, &p->zBuf[iOfst], iAmt);
  }
  return rc;
}

/*
** Write data to the file.
*/
static int jrnlWrite(
  sqlite3_file *pJfd,    /* The journal file into which to write */
  const void *zBuf,      /* Take data to be written from here */
  int iAmt,              /* Number of bytes to write */
  sqlite_int64 iOfst     /* Begin writing at this offset into the file */
){
  int rc = SQLITE_OK;
  JournalFile *p = (JournalFile *)pJfd;
  if( !p->pReal && (iOfst+iAmt)>p->nBuf ){
    rc = createFile(p);
  }
  if( rc==SQLITE_OK ){
    if( p->pReal ){
      rc = sqlite3OsWrite(p->pReal, zBuf, iAmt, iOfst);
    }else{
      memcpy(&p->zBuf[iOfst], zBuf, iAmt);
      if( p->iSize<(iOfst+iAmt) ){
        p->iSize = (iOfst+iAmt);
      }
    }
  }
  return rc;
}

/*
** Truncate the file.
*/
static int jrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){
  int rc = SQLITE_OK;
  JournalFile *p = (JournalFile *)pJfd;
  if( p->pReal ){
    rc = sqlite3OsTruncate(p->pReal, size);
  }else if( size<p->iSize ){
    p->iSize = size;
  }
  return rc;
}

/*
** Sync the file.
*/
static int jrnlSync(sqlite3_file *pJfd, int flags){
  int rc;
  JournalFile *p = (JournalFile *)pJfd;
  if( p->pReal ){
    rc = sqlite3OsSync(p->pReal, flags);
  }else{
    rc = SQLITE_OK;
  }
  return rc;
}

/*
** Query the size of the file in bytes.
*/
static int jrnlFileSize(sqlite3_file *pJfd, sqlite_int64 *pSize){
  int rc = SQLITE_OK;
  JournalFile *p = (JournalFile *)pJfd;
  if( p->pReal ){
    rc = sqlite3OsFileSize(p->pReal, pSize);
  }else{
    *pSize = (sqlite_int64) p->iSize;
  }
  return rc;
}

/*
** Table of methods for JournalFile sqlite3_file object.
*/
static struct sqlite3_io_methods JournalFileMethods = {
  1,             /* iVersion */
  jrnlClose,     /* xClose */
  jrnlRead,      /* xRead */
  jrnlWrite,     /* xWrite */
  jrnlTruncate,  /* xTruncate */
  jrnlSync,      /* xSync */
  jrnlFileSize,  /* xFileSize */
  0,             /* xLock */
  0,             /* xUnlock */
  0,             /* xCheckReservedLock */
  0,             /* xFileControl */
  0,             /* xSectorSize */
  0              /* xDeviceCharacteristics */
};

/* 
** Open a journal file.
*/
int sqlite3JournalOpen(
  sqlite3_vfs *pVfs,         /* The VFS to use for actual file I/O */
  const char *zName,         /* Name of the journal file */
  sqlite3_file *pJfd,        /* Preallocated, blank file handle */
  int flags,                 /* Opening flags */
  int nBuf                   /* Bytes buffered before opening the file */
){
  JournalFile *p = (JournalFile *)pJfd;
  memset(p, 0, sqlite3JournalSize(pVfs));
  if( nBuf>0 ){
    p->zBuf = sqlite3MallocZero(nBuf);
    if( !p->zBuf ){
      return SQLITE_NOMEM;
    }
  }else{
    return sqlite3OsOpen(pVfs, zName, pJfd, flags, 0);
  }
  p->pMethod = &JournalFileMethods;
  p->nBuf = nBuf;
  p->flags = flags;
  p->zJournal = zName;
  p->pVfs = pVfs;
  return SQLITE_OK;
}

/*
** If the argument p points to a JournalFile structure, and the underlying
** file has not yet been created, create it now.
*/
int sqlite3JournalCreate(sqlite3_file *p){
  if( p->pMethods!=&JournalFileMethods ){
    return SQLITE_OK;
  }
  return createFile((JournalFile *)p);
}

/* 
** Return the number of bytes required to store a JournalFile that uses vfs
** pVfs to create the underlying on-disk files.
*/
int sqlite3JournalSize(sqlite3_vfs *pVfs){
  return (pVfs->szOsFile+sizeof(JournalFile));
}
#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/keywordhash.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/***** This file contains automatically generated code ******
**
** The code in this file has been automatically generated by
**
**     $Header: /cvsroot/sqlite-dotnet2/SQLite.NET/SQLite.Interop/splitsource/keywordhash.h,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
**
** The code in this file implements a function that determines whether
** or not a given identifier is really an SQL keyword.  The same thing
** might be implemented more directly using a hand-written hash table.
** But by using this automatically generated code, the size of the code
** is substantially reduced.  This is important for embedded applications
** on platforms with limited memory.
*/
/* Hash score: 165 */
static int keywordCode(const char *z, int n){
  /* zText[] encodes 775 bytes of keywords in 526 bytes */
  static const char zText[526] =
    "BEFOREIGNOREGEXPLAINSTEADDESCAPEACHECKEYCONSTRAINTERSECTABLEFT"
    "HENDATABASELECTRANSACTIONATURALTERAISELSEXCEPTRIGGEREFERENCES"
    "UNIQUERYATTACHAVINGROUPDATEMPORARYBEGINNEREINDEXCLUSIVEXISTSBETWEEN"
    "OTNULLIKECASCADEFERRABLECASECOLLATECREATECURRENT_DATEDELETEDETACH"
    "IMMEDIATEJOINSERTMATCHPLANALYZEPRAGMABORTVALUESVIRTUALIMITWHEN"
    "WHERENAMEAFTEREPLACEANDEFAULTAUTOINCREMENTCASTCOLUMNCOMMITCONFLICT"
    "CROSSCURRENT_TIMESTAMPRIMARYDEFERREDISTINCTDROPFAILFROMFULLGLOB"
    "YIFINTOFFSETISNULLORDERESTRICTOUTERIGHTROLLBACKROWUNIONUSINGVACUUM"
    "VIEWINITIALLY";
  static const unsigned char aHash[127] = {
      63,  92, 109,  61,   0,  38,   0,   0,  69,   0,  64,   0,   0,
     102,   4,  65,   7,   0, 108,  72, 103,  99,   0,  22,   0,   0,
     113,   0, 111, 106,   0,  18,  80,   0,   1,   0,   0,  56,  57,
       0,  55,  11,   0,  33,  77,  89,   0, 110,  88,   0,   0,  45,
       0,  90,  54,   0,  20,   0, 114,  34,  19,   0,  10,  97,  28,
      83,   0,   0, 116,  93,  47, 115,  41,  12,  44,   0,  78,   0,
      87,  29,   0,  86,   0,   0,   0,  82,  79,  84,  75,  96,   6,
      14,  95,   0,  68,   0,  21,  76,  98,  27,   0, 112,  67, 104,
      49,  40,  71,   0,   0,  81, 100,   0, 107,   0,  15,   0,   0,
      24,   0,  73,  42,  50,   0,  16,  48,   0,  37,
  };
  static const unsigned char aNext[116] = {
       0,   0,   0,   0,   0,   0,   0,   0,   0,   9,   0,   0,   0,
       0,   0,   0,   0,   5,   0,   0,   0,   0,   0,   0,   0,   0,
       0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  32,   0,   0,
      17,   0,   0,   0,  36,  39,   0,   0,  25,   0,   0,  31,   0,
       0,   0,  43,  52,   0,   0,   0,  53,   0,   0,   0,   0,   0,
       0,   0,   0,   0,  51,   0,   0,   0,   0,  26,   0,   8,  46,
       2,   0,   0,   0,   0,   0,   0,   0,   3,  58,  66,   0,  13,
       0,  91,  85,   0,  94,   0,  74,   0,   0,  62,   0,  35, 101,
       0,   0, 105,  23,  30,  60,  70,   0,   0,  59,   0,   0,
  };
  static const unsigned char aLen[116] = {
       6,   7,   3,   6,   6,   7,   7,   3,   4,   6,   4,   5,   3,
      10,   9,   5,   4,   4,   3,   8,   2,   6,  11,   2,   7,   5,
       5,   4,   6,   7,  10,   6,   5,   6,   6,   5,   6,   4,   9,
       2,   5,   5,   7,   5,   9,   6,   7,   7,   3,   4,   4,   7,
       3,  10,   4,   7,   6,  12,   6,   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,   4,   6,   2,   3,   6,
       5,   8,   5,   5,   8,   3,   5,   5,   6,   4,   9,   3,
  };
  static const unsigned short int aOffset[116] = {
       0,   2,   2,   6,  10,  13,  18,  23,  25,  26,  31,  33,  37,
      40,  47,  55,  58,  61,  63,  65,  70,  71,  76,  85,  86,  91,
      95,  99, 102, 107, 113, 123, 126, 131, 136, 141, 144, 148, 148,
     152, 157, 160, 164, 166, 169, 177, 183, 189, 189, 192, 195, 199,
     200, 204, 214, 218, 225, 231, 243, 249, 255, 264, 266, 272, 277,
     279, 286, 291, 296, 302, 308, 313, 317, 320, 326, 330, 337, 339,
     346, 348, 350, 359, 363, 369, 375, 383, 388, 388, 404, 411, 418,
     419, 426, 430, 434, 438, 442, 445, 447, 449, 452, 452, 455, 458,
     464, 468, 476, 480, 485, 493, 496, 501, 506, 512, 516, 521,
  };
  static const unsigned char aCode[116] = {
    TK_BEFORE,     TK_FOREIGN,    TK_FOR,        TK_IGNORE,     TK_LIKE_KW,    
    TK_EXPLAIN,    TK_INSTEAD,    TK_ADD,        TK_DESC,       TK_ESCAPE,     
    TK_EACH,       TK_CHECK,      TK_KEY,        TK_CONSTRAINT, TK_INTERSECT,  
    TK_TABLE,      TK_JOIN_KW,    TK_THEN,       TK_END,        TK_DATABASE,   
    TK_AS,         TK_SELECT,     TK_TRANSACTION,TK_ON,         TK_JOIN_KW,    
    TK_ALTER,      TK_RAISE,      TK_ELSE,       TK_EXCEPT,     TK_TRIGGER,    
    TK_REFERENCES, TK_UNIQUE,     TK_QUERY,      TK_ATTACH,     TK_HAVING,     
    TK_GROUP,      TK_UPDATE,     TK_TEMP,       TK_TEMP,       TK_OR,         
    TK_BEGIN,      TK_JOIN_KW,    TK_REINDEX,    TK_INDEX,      TK_EXCLUSIVE,  
    TK_EXISTS,     TK_BETWEEN,    TK_NOTNULL,    TK_NOT,        TK_NULL,       
    TK_LIKE_KW,    TK_CASCADE,    TK_ASC,        TK_DEFERRABLE, TK_CASE,       
    TK_COLLATE,    TK_CREATE,     TK_CTIME_KW,   TK_DELETE,     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,    TK_CTIME_KW,   TK_CTIME_KW,   TK_PRIMARY,    TK_DEFERRED,   
    TK_DISTINCT,   TK_IS,         TK_DROP,       TK_FAIL,       TK_FROM,       
    TK_JOIN_KW,    TK_LIKE_KW,    TK_BY,         TK_IF,         TK_INTO,       
    TK_OFFSET,     TK_OF,         TK_SET,        TK_ISNULL,     TK_ORDER,      
    TK_RESTRICT,   TK_JOIN_KW,    TK_JOIN_KW,    TK_ROLLBACK,   TK_ROW,        
    TK_UNION,      TK_USING,      TK_VACUUM,     TK_VIEW,       TK_INITIALLY,  
    TK_ALL,        
  };
  int h, i;
  if( n<2 ) return TK_ID;
  h = ((charMap(z[0])*4) ^
      (charMap(z[n-1])*3) ^
      n) % 127;
  for(i=((int)aHash[h])-1; i>=0; i=((int)aNext[i])-1){
    if( aLen[i]==n && sqlite3StrNICmp(&zText[aOffset[i]],z,n)==0 ){
      return aCode[i];
    }
  }
  return TK_ID;
}
int sqlite3KeywordCode(const unsigned char *z, int n){
  return keywordCode((char*)z, n);
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































Deleted SQLite.Interop/splitsource/legacy.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Main file for the SQLite library.  The routines in this file
** implement the programmer interface to the library.  Routines in
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: legacy.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/

#include "sqliteInt.h"
#include <ctype.h>

/*
** Execute SQL code.  Return one of the SQLITE_ success/failure
** codes.  Also write an error message into memory obtained from
** malloc() and make *pzErrMsg point to that message.
**
** If the SQL is a query, then for each row in the query result
** the xCallback() function is called.  pArg becomes the first
** argument to xCallback().  If xCallback=NULL then no callback
** is invoked, even for queries.
*/
int sqlite3_exec(
  sqlite3 *db,                /* The database on which the SQL executes */
  const char *zSql,           /* The SQL to be executed */
  sqlite3_callback xCallback, /* Invoke this callback routine */
  void *pArg,                 /* First argument to xCallback() */
  char **pzErrMsg             /* Write error messages here */
){
  int rc = SQLITE_OK;
  const char *zLeftover;
  sqlite3_stmt *pStmt = 0;
  char **azCols = 0;

  int nRetry = 0;
  int nCallback;

  if( zSql==0 ) zSql = "";

  sqlite3_mutex_enter(db->mutex);
  sqlite3Error(db, SQLITE_OK, 0);
  while( (rc==SQLITE_OK || (rc==SQLITE_SCHEMA && (++nRetry)<2)) && zSql[0] ){
    int nCol;
    char **azVals = 0;

    pStmt = 0;
    rc = sqlite3_prepare(db, zSql, -1, &pStmt, &zLeftover);
    assert( rc==SQLITE_OK || pStmt==0 );
    if( rc!=SQLITE_OK ){
      continue;
    }
    if( !pStmt ){
      /* this happens for a comment or white-space */
      zSql = zLeftover;
      continue;
    }

    nCallback = 0;
    nCol = sqlite3_column_count(pStmt);

    while( 1 ){
      int i;
      rc = sqlite3_step(pStmt);

      /* Invoke the callback function if required */
      if( xCallback && (SQLITE_ROW==rc || 
          (SQLITE_DONE==rc && !nCallback && db->flags&SQLITE_NullCallback)) ){
        if( 0==nCallback ){
          if( azCols==0 ){
            azCols = sqlite3DbMallocZero(db, 2*nCol*sizeof(const char*) + 1);
            if( azCols==0 ){
              goto exec_out;
            }
          }
          for(i=0; i<nCol; i++){
            azCols[i] = (char *)sqlite3_column_name(pStmt, i);
            /* sqlite3VdbeSetColName() installs column names as UTF8
            ** strings so there is no way for sqlite3_column_name() to fail. */
            assert( azCols[i]!=0 );
          }
          nCallback++;
        }
        if( rc==SQLITE_ROW ){
          azVals = &azCols[nCol];
          for(i=0; i<nCol; i++){
            azVals[i] = (char *)sqlite3_column_text(pStmt, i);
            if( !azVals[i] && sqlite3_column_type(pStmt, i)!=SQLITE_NULL ){
              db->mallocFailed = 1;
              goto exec_out;
            }
          }
        }
        if( xCallback(pArg, nCol, azVals, azCols) ){
          rc = SQLITE_ABORT;
          sqlite3_finalize(pStmt);
          pStmt = 0;
          sqlite3Error(db, SQLITE_ABORT, 0);
          goto exec_out;
        }
      }

      if( rc!=SQLITE_ROW ){
        rc = sqlite3_finalize(pStmt);
        pStmt = 0;
        if( rc!=SQLITE_SCHEMA ){
          nRetry = 0;
          zSql = zLeftover;
          while( isspace((unsigned char)zSql[0]) ) zSql++;
        }
        break;
      }
    }

    sqlite3DbFree(db, azCols);
    azCols = 0;
  }

exec_out:
  if( pStmt ) sqlite3_finalize(pStmt);
  sqlite3DbFree(db, azCols);

  rc = sqlite3ApiExit(db, rc);
  if( rc!=SQLITE_OK && rc==sqlite3_errcode(db) && pzErrMsg ){
    int nErrMsg = 1 + strlen(sqlite3_errmsg(db));
    *pzErrMsg = sqlite3Malloc(nErrMsg);
    if( *pzErrMsg ){
      memcpy(*pzErrMsg, sqlite3_errmsg(db), nErrMsg);
    }
  }else if( pzErrMsg ){
    *pzErrMsg = 0;
  }

  assert( (rc&db->errMask)==rc );
  sqlite3_mutex_leave(db->mutex);
  return rc;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































































Deleted SQLite.Interop/splitsource/loadext.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
/*
** 2006 June 7
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to dynamically load extensions into
** the SQLite library.
**
** $Id: loadext.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/

#ifndef SQLITE_CORE
  #define SQLITE_CORE 1  /* Disable the API redefinition in sqlite3ext.h */
#endif
#include "sqlite3ext.h"
#include "sqliteInt.h"
#include <string.h>
#include <ctype.h>

#ifndef SQLITE_OMIT_LOAD_EXTENSION

/*
** Some API routines are omitted when various features are
** excluded from a build of SQLite.  Substitute a NULL pointer
** for any missing APIs.
*/
#ifndef SQLITE_ENABLE_COLUMN_METADATA
# define sqlite3_column_database_name   0
# define sqlite3_column_database_name16 0
# define sqlite3_column_table_name      0
# define sqlite3_column_table_name16    0
# define sqlite3_column_origin_name     0
# define sqlite3_column_origin_name16   0
# define sqlite3_table_column_metadata  0
#endif

#ifdef SQLITE_OMIT_AUTHORIZATION
# define sqlite3_set_authorizer         0
#endif

#ifdef SQLITE_OMIT_UTF16
# define sqlite3_bind_text16            0
# define sqlite3_collation_needed16     0
# define sqlite3_column_decltype16      0
# define sqlite3_column_name16          0
# define sqlite3_column_text16          0
# define sqlite3_complete16             0
# define sqlite3_create_collation16     0
# define sqlite3_create_function16      0
# define sqlite3_errmsg16               0
# define sqlite3_open16                 0
# define sqlite3_prepare16              0
# define sqlite3_prepare16_v2           0
# define sqlite3_result_error16         0
# define sqlite3_result_text16          0
# define sqlite3_result_text16be        0
# define sqlite3_result_text16le        0
# define sqlite3_value_text16           0
# define sqlite3_value_text16be         0
# define sqlite3_value_text16le         0
# define sqlite3_column_database_name16 0
# define sqlite3_column_table_name16    0
# define sqlite3_column_origin_name16   0
#endif

#ifdef SQLITE_OMIT_COMPLETE
# define sqlite3_complete 0
# define sqlite3_complete16 0
#endif

#ifdef SQLITE_OMIT_PROGRESS_CALLBACK
# define sqlite3_progress_handler 0
#endif

#ifdef SQLITE_OMIT_VIRTUALTABLE
# define sqlite3_create_module 0
# define sqlite3_create_module_v2 0
# define sqlite3_declare_vtab 0
#endif

#ifdef SQLITE_OMIT_SHARED_CACHE
# define sqlite3_enable_shared_cache 0
#endif

#ifdef SQLITE_OMIT_TRACE
# define sqlite3_profile       0
# define sqlite3_trace         0
#endif

#ifdef SQLITE_OMIT_GET_TABLE
# define sqlite3_free_table    0
# define sqlite3_get_table     0
#endif

#ifdef SQLITE_OMIT_INCRBLOB
#define sqlite3_bind_zeroblob  0
#define sqlite3_blob_bytes     0
#define sqlite3_blob_close     0
#define sqlite3_blob_open      0
#define sqlite3_blob_read      0
#define sqlite3_blob_write     0
#endif

/*
** The following structure contains pointers to all SQLite API routines.
** A pointer to this structure is passed into extensions when they are
** loaded so that the extension can make calls back into the SQLite
** library.
**
** When adding new APIs, add them to the bottom of this structure
** in order to preserve backwards compatibility.
**
** Extensions that use newer APIs should first call the
** sqlite3_libversion_number() to make sure that the API they
** intend to use is supported by the library.  Extensions should
** also check to make sure that the pointer to the function is
** not NULL before calling it.
*/
static const sqlite3_api_routines sqlite3Apis = {
  sqlite3_aggregate_context,
  sqlite3_aggregate_count,
  sqlite3_bind_blob,
  sqlite3_bind_double,
  sqlite3_bind_int,
  sqlite3_bind_int64,
  sqlite3_bind_null,
  sqlite3_bind_parameter_count,
  sqlite3_bind_parameter_index,
  sqlite3_bind_parameter_name,
  sqlite3_bind_text,
  sqlite3_bind_text16,
  sqlite3_bind_value,
  sqlite3_busy_handler,
  sqlite3_busy_timeout,
  sqlite3_changes,
  sqlite3_close,
  sqlite3_collation_needed,
  sqlite3_collation_needed16,
  sqlite3_column_blob,
  sqlite3_column_bytes,
  sqlite3_column_bytes16,
  sqlite3_column_count,
  sqlite3_column_database_name,
  sqlite3_column_database_name16,
  sqlite3_column_decltype,
  sqlite3_column_decltype16,
  sqlite3_column_double,
  sqlite3_column_int,
  sqlite3_column_int64,
  sqlite3_column_name,
  sqlite3_column_name16,
  sqlite3_column_origin_name,
  sqlite3_column_origin_name16,
  sqlite3_column_table_name,
  sqlite3_column_table_name16,
  sqlite3_column_text,
  sqlite3_column_text16,
  sqlite3_column_type,
  sqlite3_column_value,
  sqlite3_commit_hook,
  sqlite3_complete,
  sqlite3_complete16,
  sqlite3_create_collation,
  sqlite3_create_collation16,
  sqlite3_create_function,
  sqlite3_create_function16,
  sqlite3_create_module,
  sqlite3_data_count,
  sqlite3_db_handle,
  sqlite3_declare_vtab,
  sqlite3_enable_shared_cache,
  sqlite3_errcode,
  sqlite3_errmsg,
  sqlite3_errmsg16,
  sqlite3_exec,
  sqlite3_expired,
  sqlite3_finalize,
  sqlite3_free,
  sqlite3_free_table,
  sqlite3_get_autocommit,
  sqlite3_get_auxdata,
  sqlite3_get_table,
  0,     /* Was sqlite3_global_recover(), but that function is deprecated */
  sqlite3_interrupt,
  sqlite3_last_insert_rowid,
  sqlite3_libversion,
  sqlite3_libversion_number,
  sqlite3_malloc,
  sqlite3_mprintf,
  sqlite3_open,
  sqlite3_open16,
  sqlite3_prepare,
  sqlite3_prepare16,
  sqlite3_profile,
  sqlite3_progress_handler,
  sqlite3_realloc,
  sqlite3_reset,
  sqlite3_result_blob,
  sqlite3_result_double,
  sqlite3_result_error,
  sqlite3_result_error16,
  sqlite3_result_int,
  sqlite3_result_int64,
  sqlite3_result_null,
  sqlite3_result_text,
  sqlite3_result_text16,
  sqlite3_result_text16be,
  sqlite3_result_text16le,
  sqlite3_result_value,
  sqlite3_rollback_hook,
  sqlite3_set_authorizer,
  sqlite3_set_auxdata,
  sqlite3_snprintf,
  sqlite3_step,
  sqlite3_table_column_metadata,
  sqlite3_thread_cleanup,
  sqlite3_total_changes,
  sqlite3_trace,
  sqlite3_transfer_bindings,
  sqlite3_update_hook,
  sqlite3_user_data,
  sqlite3_value_blob,
  sqlite3_value_bytes,
  sqlite3_value_bytes16,
  sqlite3_value_double,
  sqlite3_value_int,
  sqlite3_value_int64,
  sqlite3_value_numeric_type,
  sqlite3_value_text,
  sqlite3_value_text16,
  sqlite3_value_text16be,
  sqlite3_value_text16le,
  sqlite3_value_type,
  sqlite3_vmprintf,
  /*
  ** The original API set ends here.  All extensions can call any
  ** of the APIs above provided that the pointer is not NULL.  But
  ** before calling APIs that follow, extension should check the
  ** sqlite3_libversion_number() to make sure they are dealing with
  ** a library that is new enough to support that API.
  *************************************************************************
  */
  sqlite3_overload_function,

  /*
  ** Added after 3.3.13
  */
  sqlite3_prepare_v2,
  sqlite3_prepare16_v2,
  sqlite3_clear_bindings,

  /*
  ** Added for 3.4.1
  */
  sqlite3_create_module_v2,

  /*
  ** Added for 3.5.0
  */
  sqlite3_bind_zeroblob,
  sqlite3_blob_bytes,
  sqlite3_blob_close,
  sqlite3_blob_open,
  sqlite3_blob_read,
  sqlite3_blob_write,
  sqlite3_create_collation_v2,
  sqlite3_file_control,
  sqlite3_memory_highwater,
  sqlite3_memory_used,
#ifdef SQLITE_MUTEX_NOOP
  0, 
  0, 
  0,
  0,
  0,
#else
  sqlite3_mutex_alloc,
  sqlite3_mutex_enter,
  sqlite3_mutex_free,
  sqlite3_mutex_leave,
  sqlite3_mutex_try,
#endif
  sqlite3_open_v2,
  sqlite3_release_memory,
  sqlite3_result_error_nomem,
  sqlite3_result_error_toobig,
  sqlite3_sleep,
  sqlite3_soft_heap_limit,
  sqlite3_vfs_find,
  sqlite3_vfs_register,
  sqlite3_vfs_unregister,

  /*
  ** Added for 3.5.8
  */
  sqlite3_threadsafe,
  sqlite3_result_zeroblob,
  sqlite3_result_error_code,
  sqlite3_test_control,
  sqlite3_randomness,
  sqlite3_context_db_handle,

  /*
  ** Added for 3.6.0
  */
  sqlite3_extended_result_codes,
  sqlite3_limit,
  sqlite3_next_stmt,
  sqlite3_sql,
  sqlite3_status,
};

/*
** Attempt to load an SQLite extension library contained in the file
** zFile.  The entry point is zProc.  zProc may be 0 in which case a
** default entry point name (sqlite3_extension_init) is used.  Use
** of the default name is recommended.
**
** Return SQLITE_OK on success and SQLITE_ERROR if something goes wrong.
**
** If an error occurs and pzErrMsg is not 0, then fill *pzErrMsg with 
** error message text.  The calling function should free this memory
** by calling sqlite3DbFree(db, ).
*/
static int sqlite3LoadExtension(
  sqlite3 *db,          /* Load the extension into this database connection */
  const char *zFile,    /* Name of the shared library containing extension */
  const char *zProc,    /* Entry point.  Use "sqlite3_extension_init" if 0 */
  char **pzErrMsg       /* Put error message here if not 0 */
){
  sqlite3_vfs *pVfs = db->pVfs;
  void *handle;
  int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*);
  char *zErrmsg = 0;
  void **aHandle;

  /* Ticket #1863.  To avoid a creating security problems for older
  ** applications that relink against newer versions of SQLite, the
  ** ability to run load_extension is turned off by default.  One
  ** must call sqlite3_enable_load_extension() to turn on extension
  ** loading.  Otherwise you get the following error.
  */
  if( (db->flags & SQLITE_LoadExtension)==0 ){
    if( pzErrMsg ){
      *pzErrMsg = sqlite3_mprintf("not authorized");
    }
    return SQLITE_ERROR;
  }

  if( zProc==0 ){
    zProc = "sqlite3_extension_init";
  }

  handle = sqlite3OsDlOpen(pVfs, zFile);
  if( handle==0 ){
    if( pzErrMsg ){
      char zErr[256];
      zErr[sizeof(zErr)-1] = '\0';
      sqlite3_snprintf(sizeof(zErr)-1, zErr, 
          "unable to open shared library [%s]", zFile);
      sqlite3OsDlError(pVfs, sizeof(zErr)-1, zErr);
      *pzErrMsg = sqlite3DbStrDup(0, zErr);
    }
    return SQLITE_ERROR;
  }
  xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*))
                   sqlite3OsDlSym(pVfs, handle, zProc);
  if( xInit==0 ){
    if( pzErrMsg ){
      char zErr[256];
      zErr[sizeof(zErr)-1] = '\0';
      sqlite3_snprintf(sizeof(zErr)-1, zErr,
          "no entry point [%s] in shared library [%s]", zProc,zFile);
      sqlite3OsDlError(pVfs, sizeof(zErr)-1, zErr);
      *pzErrMsg = sqlite3DbStrDup(0, zErr);
      sqlite3OsDlClose(pVfs, handle);
    }
    return SQLITE_ERROR;
  }else if( xInit(db, &zErrmsg, &sqlite3Apis) ){
    if( pzErrMsg ){
      *pzErrMsg = sqlite3_mprintf("error during initialization: %s", zErrmsg);
    }
    sqlite3_free(zErrmsg);
    sqlite3OsDlClose(pVfs, handle);
    return SQLITE_ERROR;
  }

  /* Append the new shared library handle to the db->aExtension array. */
  aHandle = sqlite3DbMallocZero(db, sizeof(handle)*(db->nExtension+1));
  if( aHandle==0 ){
    return SQLITE_NOMEM;
  }
  if( db->nExtension>0 ){
    memcpy(aHandle, db->aExtension, sizeof(handle)*db->nExtension);
  }
  sqlite3DbFree(db, db->aExtension);
  db->aExtension = aHandle;

  db->aExtension[db->nExtension++] = handle;
  return SQLITE_OK;
}
int sqlite3_load_extension(
  sqlite3 *db,          /* Load the extension into this database connection */
  const char *zFile,    /* Name of the shared library containing extension */
  const char *zProc,    /* Entry point.  Use "sqlite3_extension_init" if 0 */
  char **pzErrMsg       /* Put error message here if not 0 */
){
  int rc;
  sqlite3_mutex_enter(db->mutex);
  rc = sqlite3LoadExtension(db, zFile, zProc, pzErrMsg);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

/*
** Call this routine when the database connection is closing in order
** to clean up loaded extensions
*/
void sqlite3CloseExtensions(sqlite3 *db){
  int i;
  assert( sqlite3_mutex_held(db->mutex) );
  for(i=0; i<db->nExtension; i++){
    sqlite3OsDlClose(db->pVfs, db->aExtension[i]);
  }
  sqlite3DbFree(db, db->aExtension);
}

/*
** Enable or disable extension loading.  Extension loading is disabled by
** default so as not to open security holes in older applications.
*/
int sqlite3_enable_load_extension(sqlite3 *db, int onoff){
  sqlite3_mutex_enter(db->mutex);
  if( onoff ){
    db->flags |= SQLITE_LoadExtension;
  }else{
    db->flags &= ~SQLITE_LoadExtension;
  }
  sqlite3_mutex_leave(db->mutex);
  return SQLITE_OK;
}

#endif /* SQLITE_OMIT_LOAD_EXTENSION */

/*
** The auto-extension code added regardless of whether or not extension
** loading is supported.  We need a dummy sqlite3Apis pointer for that
** code if regular extension loading is not available.  This is that
** dummy pointer.
*/
#ifdef SQLITE_OMIT_LOAD_EXTENSION
static const sqlite3_api_routines sqlite3Apis = { 0 };
#endif


/*
** The following object holds the list of automatically loaded
** extensions.
**
** This list is shared across threads.  The SQLITE_MUTEX_STATIC_MASTER
** mutex must be held while accessing this list.
*/
static struct {
  int nExt;        /* Number of entries in aExt[] */          
  void **aExt;     /* Pointers to the extension init functions */
} autoext = { 0, 0 };


/*
** Register a statically linked extension that is automatically
** loaded by every new database connection.
*/
int sqlite3_auto_extension(void *xInit){
  int rc = SQLITE_OK;
#ifndef SQLITE_OMIT_AUTOINIT
  rc = sqlite3_initialize();
  if( rc ){
    return rc;
  }else
#endif
  {
    int i;
#ifndef SQLITE_MUTEX_NOOP
    sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
#endif
    sqlite3_mutex_enter(mutex);
    for(i=0; i<autoext.nExt; i++){
      if( autoext.aExt[i]==xInit ) break;
    }
    if( i==autoext.nExt ){
      int nByte = (autoext.nExt+1)*sizeof(autoext.aExt[0]);
      void **aNew;
      aNew = sqlite3_realloc(autoext.aExt, nByte);
      if( aNew==0 ){
        rc = SQLITE_NOMEM;
      }else{
        autoext.aExt = aNew;
        autoext.aExt[autoext.nExt] = xInit;
        autoext.nExt++;
      }
    }
    sqlite3_mutex_leave(mutex);
    assert( (rc&0xff)==rc );
    return rc;
  }
}

/*
** Reset the automatic extension loading mechanism.
*/
void sqlite3_reset_auto_extension(void){
#ifndef SQLITE_OMIT_AUTOINIT
  if( sqlite3_initialize()==SQLITE_OK )
#endif
  {
#ifndef SQLITE_MUTEX_NOOP
    sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
#endif
    sqlite3_mutex_enter(mutex);
    sqlite3_free(autoext.aExt);
    autoext.aExt = 0;
    autoext.nExt = 0;
    sqlite3_mutex_leave(mutex);
  }
}

/*
** Load all automatic extensions.
*/
int sqlite3AutoLoadExtensions(sqlite3 *db){
  int i;
  int go = 1;
  int rc = SQLITE_OK;
  int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*);

  if( autoext.nExt==0 ){
    /* Common case: early out without every having to acquire a mutex */
    return SQLITE_OK;
  }
  for(i=0; go; i++){
    char *zErrmsg = 0;
#ifndef SQLITE_MUTEX_NOOP
    sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
#endif
    sqlite3_mutex_enter(mutex);
    if( i>=autoext.nExt ){
      xInit = 0;
      go = 0;
    }else{
      xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*))
              autoext.aExt[i];
    }
    sqlite3_mutex_leave(mutex);
    if( xInit && xInit(db, &zErrmsg, &sqlite3Apis) ){
      sqlite3Error(db, SQLITE_ERROR,
            "automatic extension loading failed: %s", zErrmsg);
      go = 0;
      rc = SQLITE_ERROR;
      sqlite3_free(zErrmsg);
    }
  }
  return rc;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/main.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Main file for the SQLite library.  The routines in this file
** implement the programmer interface to the library.  Routines in
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

#ifdef SQLITE_ENABLE_FTS3
# include "fts3.h"
#endif
#ifdef SQLITE_ENABLE_RTREE
# include "rtree.h"
#endif

/*
** The version of the library
*/
const char sqlite3_version[] = SQLITE_VERSION;
const char *sqlite3_libversion(void){ return sqlite3_version; }
int sqlite3_libversion_number(void){ return SQLITE_VERSION_NUMBER; }
int sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; }

#if !defined(SQLITE_OMIT_TRACE) && defined(SQLITE_ENABLE_IOTRACE)
/*
** If the following function pointer is not NULL and if
** SQLITE_ENABLE_IOTRACE is enabled, then messages describing
** I/O active are written using this function.  These messages
** are intended for debugging activity only.
*/
void (*sqlite3IoTrace)(const char*, ...) = 0;
#endif

/*
** If the following global variable points to a string which is the
** name of a directory, then that directory will be used to store
** temporary files.
**
** See also the "PRAGMA temp_store_directory" SQL command.
*/
char *sqlite3_temp_directory = 0;

/*
** Initialize SQLite.  
**
** This routine must be called to initialize the memory allocation,
** VFS, and mutex subsystesms prior to doing any serious work with
** SQLite.  But as long as you do not compile with SQLITE_OMIT_AUTOINIT
** this routine will be called automatically by key routines such as
** sqlite3_open().  
**
** This routine is a no-op except on its very first call for the process,
** or for the first call after a call to sqlite3_shutdown.
*/
int sqlite3_initialize(void){
  static int inProgress = 0;
  int rc;

  /* If SQLite is already initialized, this call is a no-op. */
  if( sqlite3Config.isInit ) return SQLITE_OK;

  /* Make sure the mutex system is initialized. */
  rc = sqlite3MutexInit();

  if( rc==SQLITE_OK ){

    /* Initialize the malloc() system and the recursive pInitMutex mutex.
    ** This operation is protected by the STATIC_MASTER mutex.
    */
    sqlite3_mutex *pMaster = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
    sqlite3_mutex_enter(pMaster);
    if( !sqlite3Config.isMallocInit ){
      rc = sqlite3MallocInit();
    }
    if( rc==SQLITE_OK ){
      sqlite3Config.isMallocInit = 1;
      if( !sqlite3Config.pInitMutex ){
        sqlite3Config.pInitMutex = sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE);
        if( sqlite3Config.bCoreMutex && !sqlite3Config.pInitMutex ){
          rc = SQLITE_NOMEM;
        }
      }
    }
    sqlite3_mutex_leave(pMaster);
    if( rc!=SQLITE_OK ){
      return rc;
    }

    /* Enter the recursive pInitMutex mutex. After doing so, if the
    ** sqlite3Config.isInit flag is true, then some other thread has
    ** finished doing the initialization. If the inProgress flag is
    ** true, then this function is being called recursively from within
    ** the sqlite3_os_init() call below. In either case, exit early.
    */
    sqlite3_mutex_enter(sqlite3Config.pInitMutex);
    if( sqlite3Config.isInit || inProgress ){
      sqlite3_mutex_leave(sqlite3Config.pInitMutex);
      return SQLITE_OK;
    }
    sqlite3StatusReset();
    inProgress = 1;
    rc = sqlite3_os_init();
    inProgress = 0;
    sqlite3Config.isInit = (rc==SQLITE_OK ? 1 : 0);
    sqlite3_mutex_leave(sqlite3Config.pInitMutex);
  }

  /* Check NaN support. */
#ifndef NDEBUG
  /* This section of code's only "output" is via assert() statements. */
  if ( rc==SQLITE_OK ){
    u64 x = (((u64)1)<<63)-1;
    double y;
    assert(sizeof(x)==8);
    assert(sizeof(x)==sizeof(y));
    memcpy(&y, &x, 8);
    assert( sqlite3IsNaN(y) );
  }
#endif

  return rc;
}

/*
** Undo the effects of sqlite3_initialize().  Must not be called while
** there are outstanding database connections or memory allocations or
** while any part of SQLite is otherwise in use in any thread.  This
** routine is not threadsafe.  Not by a long shot.
*/
int sqlite3_shutdown(void){
  sqlite3_mutex_free(sqlite3Config.pInitMutex);
  sqlite3Config.pInitMutex = 0;
  sqlite3Config.isMallocInit = 0;
  if( sqlite3Config.isInit ){
    sqlite3_os_end();
  }
  if( sqlite3Config.m.xShutdown ){
    sqlite3MallocEnd();
  }
  if( sqlite3Config.mutex.xMutexEnd ){
    sqlite3MutexEnd();
  }
  sqlite3Config.isInit = 0;
  return SQLITE_OK;
}

/*
** This API allows applications to modify the global configuration of
** the SQLite library at run-time.
**
** This routine should only be called when there are no outstanding
** database connections or memory allocations.  This routine is not
** threadsafe.  Failure to heed these warnings can lead to unpredictable
** behavior.
*/
int sqlite3_config(int op, ...){
  va_list ap;
  int rc = SQLITE_OK;

  /* sqlite3_config() shall return SQLITE_MISUSE if it is invoked while
  ** the SQLite library is in use. */
  if( sqlite3Config.isInit ) return SQLITE_MISUSE;

  va_start(ap, op);
  switch( op ){
    case SQLITE_CONFIG_SINGLETHREAD: {
      /* Disable all mutexing */
      sqlite3Config.bCoreMutex = 0;
      sqlite3Config.bFullMutex = 0;
      break;
    }
    case SQLITE_CONFIG_MULTITHREAD: {
      /* Disable mutexing of database connections */
      /* Enable mutexing of core data structures */
      sqlite3Config.bCoreMutex = 1;
      sqlite3Config.bFullMutex = 0;
      break;
    }
    case SQLITE_CONFIG_SERIALIZED: {
      /* Enable all mutexing */
      sqlite3Config.bCoreMutex = 1;
      sqlite3Config.bFullMutex = 1;
      break;
    }
    case SQLITE_CONFIG_MALLOC: {
      /* Specify an alternative malloc implementation */
      sqlite3Config.m = *va_arg(ap, sqlite3_mem_methods*);
      break;
    }
    case SQLITE_CONFIG_GETMALLOC: {
      /* Retrieve the current malloc() implementation */
      if( sqlite3Config.m.xMalloc==0 ) sqlite3MemSetDefault();
      *va_arg(ap, sqlite3_mem_methods*) = sqlite3Config.m;
      break;
    }
    case SQLITE_CONFIG_MUTEX: {
      /* Specify an alternative mutex implementation */
      sqlite3Config.mutex = *va_arg(ap, sqlite3_mutex_methods*);
      break;
    }
    case SQLITE_CONFIG_GETMUTEX: {
      /* Retrieve the current mutex implementation */
      *va_arg(ap, sqlite3_mutex_methods*) = sqlite3Config.mutex;
      break;
    }
    case SQLITE_CONFIG_MEMSTATUS: {
      /* Enable or disable the malloc status collection */
      sqlite3Config.bMemstat = va_arg(ap, int);
      break;
    }
    case SQLITE_CONFIG_SCRATCH: {
      /* Designate a buffer for scratch memory space */
      sqlite3Config.pScratch = va_arg(ap, void*);
      sqlite3Config.szScratch = va_arg(ap, int);
      sqlite3Config.nScratch = va_arg(ap, int);
      break;
    }
    case SQLITE_CONFIG_PAGECACHE: {
      /* Designate a buffer for scratch memory space */
      sqlite3Config.pPage = va_arg(ap, void*);
      sqlite3Config.szPage = va_arg(ap, int);
      sqlite3Config.nPage = va_arg(ap, int);
      break;
    }

#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
    case SQLITE_CONFIG_HEAP: {
      /* Designate a buffer for heap memory space */
      sqlite3Config.pHeap = va_arg(ap, void*);
      sqlite3Config.nHeap = va_arg(ap, int);
      sqlite3Config.mnReq = va_arg(ap, int);

      if( sqlite3Config.pHeap==0 ){
        /* If the heap pointer is NULL, then restore the malloc implementation
        ** back to NULL pointers too.  This will cause the malloc to go
        ** back to its default implementation when sqlite3_initialize() is
        ** run.
        */
        memset(&sqlite3Config.m, 0, sizeof(sqlite3Config.m));
      }else{
        /* The heap pointer is not NULL, then install one of the
        ** mem5.c/mem3.c methods. If neither ENABLE_MEMSYS3 nor
        ** ENABLE_MEMSYS5 is defined, return an error.
        ** the default case and return an error.
        */
#ifdef SQLITE_ENABLE_MEMSYS3
        sqlite3Config.m = *sqlite3MemGetMemsys3();
#endif
#ifdef SQLITE_ENABLE_MEMSYS5
        sqlite3Config.m = *sqlite3MemGetMemsys5();
#endif
      }
      break;
    }
#endif

#if defined(SQLITE_ENABLE_MEMSYS6)
    case SQLITE_CONFIG_CHUNKALLOC: {
      sqlite3Config.nSmall = va_arg(ap, int);
      sqlite3Config.m = *sqlite3MemGetMemsys6();
      break;
    }
#endif

    case SQLITE_CONFIG_LOOKASIDE: {
      sqlite3Config.szLookaside = va_arg(ap, int);
      sqlite3Config.nLookaside = va_arg(ap, int);
      break;
    }

    default: {
      rc = SQLITE_ERROR;
      break;
    }
  }
  va_end(ap);
  return rc;
}

/*
** Set up the lookaside buffers for a database connection.
** Return SQLITE_OK on success.  
** If lookaside is already active, return SQLITE_BUSY.
**
** The sz parameter is the number of bytes in each lookaside slot.
** The cnt parameter is the number of slots.  If pStart is NULL the
** space for the lookaside memory is obtained from sqlite3_malloc().
** If pStart is not NULL then it is sz*cnt bytes of memory to use for
** the lookaside memory.
*/
static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){
  void *pStart;
  if( db->lookaside.nOut ){
    return SQLITE_BUSY;
  }
  if( sz<0 ) sz = 0;
  if( cnt<0 ) cnt = 0;
  sz = (sz+7)&~7;
  if( pBuf==0 ){
    sqlite3BeginBenignMalloc();
    pStart = sqlite3Malloc( sz*cnt );
    sqlite3EndBenignMalloc();
  }else{
    pStart = pBuf;
  }
  if( db->lookaside.bMalloced ){
    sqlite3_free(db->lookaside.pStart);
  }
  db->lookaside.pStart = pStart;
  db->lookaside.pFree = 0;
  db->lookaside.sz = sz;
  db->lookaside.bMalloced = pBuf==0;
  if( pStart ){
    int i;
    LookasideSlot *p;
    p = (LookasideSlot*)pStart;
    for(i=cnt-1; i>=0; i--){
      p->pNext = db->lookaside.pFree;
      db->lookaside.pFree = p;
      p = (LookasideSlot*)&((u8*)p)[sz];
    }
    db->lookaside.pEnd = p;
    db->lookaside.bEnabled = 1;
  }else{
    db->lookaside.pEnd = 0;
    db->lookaside.bEnabled = 0;
  }
  return SQLITE_OK;
}

/*
** Configuration settings for an individual database connection
*/
int sqlite3_db_config(sqlite3 *db, int op, ...){
  va_list ap;
  int rc;
  va_start(ap, op);
  switch( op ){
    case SQLITE_DBCONFIG_LOOKASIDE: {
      void *pBuf = va_arg(ap, void*);
      int sz = va_arg(ap, int);
      int cnt = va_arg(ap, int);
      rc = setupLookaside(db, pBuf, sz, cnt);
      break;
    }
    default: {
      rc = SQLITE_ERROR;
      break;
    }
  }
  va_end(ap);
  return rc;
}

/*
** Routine needed to support the testcase() macro.
*/
#ifdef SQLITE_COVERAGE_TEST
void sqlite3Coverage(int x){
  static int dummy = 0;
  dummy += x;
}
#endif


/*
** Return true if the buffer z[0..n-1] contains all spaces.
*/
static int allSpaces(const char *z, int n){
  while( n>0 && z[n-1]==' ' ){ n--; }
  return n==0;
}

/*
** This is the default collating function named "BINARY" which is always
** available.
**
** If the padFlag argument is not NULL then space padding at the end
** of strings is ignored.  This implements the RTRIM collation.
*/
static int binCollFunc(
  void *padFlag,
  int nKey1, const void *pKey1,
  int nKey2, const void *pKey2
){
  int rc, n;
  n = nKey1<nKey2 ? nKey1 : nKey2;
  rc = memcmp(pKey1, pKey2, n);
  if( rc==0 ){
    if( padFlag
     && allSpaces(((char*)pKey1)+n, nKey1-n)
     && allSpaces(((char*)pKey2)+n, nKey2-n)
    ){
      /* Leave rc unchanged at 0 */
    }else{
      rc = nKey1 - nKey2;
    }
  }
  return rc;
}

/*
** Another built-in collating sequence: NOCASE. 
**
** This collating sequence is intended to be used for "case independant
** comparison". SQLite's knowledge of upper and lower case equivalents
** extends only to the 26 characters used in the English language.
**
** At the moment there is only a UTF-8 implementation.
*/
static int nocaseCollatingFunc(
  void *NotUsed,
  int nKey1, const void *pKey1,
  int nKey2, const void *pKey2
){
  int r = sqlite3StrNICmp(
      (const char *)pKey1, (const char *)pKey2, (nKey1<nKey2)?nKey1:nKey2);
  if( 0==r ){
    r = nKey1-nKey2;
  }
  return r;
}

/*
** Return the ROWID of the most recent insert
*/
sqlite_int64 sqlite3_last_insert_rowid(sqlite3 *db){
  return db->lastRowid;
}

/*
** Return the number of changes in the most recent call to sqlite3_exec().
*/
int sqlite3_changes(sqlite3 *db){
  return db->nChange;
}

/*
** Return the number of changes since the database handle was opened.
*/
int sqlite3_total_changes(sqlite3 *db){
  return db->nTotalChange;
}

/*
** Close an existing SQLite database
*/
int sqlite3_close(sqlite3 *db){
  HashElem *i;
  int j;

  if( !db ){
    return SQLITE_OK;
  }
  if( !sqlite3SafetyCheckSickOrOk(db) ){
    return SQLITE_MISUSE;
  }
  sqlite3_mutex_enter(db->mutex);

#ifdef SQLITE_SSE
  {
    extern void sqlite3SseCleanup(sqlite3*);
    sqlite3SseCleanup(db);
  }
#endif 

  sqlite3ResetInternalSchema(db, 0);

  /* If a transaction is open, the ResetInternalSchema() call above
  ** will not have called the xDisconnect() method on any virtual
  ** tables in the db->aVTrans[] array. The following sqlite3VtabRollback()
  ** call will do so. We need to do this before the check for active
  ** SQL statements below, as the v-table implementation may be storing
  ** some prepared statements internally.
  */
  sqlite3VtabRollback(db);

  /* If there are any outstanding VMs, return SQLITE_BUSY. */
  if( db->pVdbe ){
    sqlite3Error(db, SQLITE_BUSY, 
        "Unable to close due to unfinalised statements");
    sqlite3_mutex_leave(db->mutex);
    return SQLITE_BUSY;
  }
  assert( sqlite3SafetyCheckSickOrOk(db) );

  for(j=0; j<db->nDb; j++){
    struct Db *pDb = &db->aDb[j];
    if( pDb->pBt ){
      sqlite3BtreeClose(pDb->pBt);
      pDb->pBt = 0;
      if( j!=1 ){
        pDb->pSchema = 0;
      }
    }
  }
  sqlite3ResetInternalSchema(db, 0);
  assert( db->nDb<=2 );
  assert( db->aDb==db->aDbStatic );
  for(i=sqliteHashFirst(&db->aFunc); i; i=sqliteHashNext(i)){
    FuncDef *pFunc, *pNext;
    for(pFunc = (FuncDef*)sqliteHashData(i); pFunc; pFunc=pNext){
      pNext = pFunc->pNext;
      sqlite3DbFree(db, pFunc);
    }
  }

  for(i=sqliteHashFirst(&db->aCollSeq); i; i=sqliteHashNext(i)){
    CollSeq *pColl = (CollSeq *)sqliteHashData(i);
    /* Invoke any destructors registered for collation sequence user data. */
    for(j=0; j<3; j++){
      if( pColl[j].xDel ){
        pColl[j].xDel(pColl[j].pUser);
      }
    }
    sqlite3DbFree(db, pColl);
  }
  sqlite3HashClear(&db->aCollSeq);
#ifndef SQLITE_OMIT_VIRTUALTABLE
  for(i=sqliteHashFirst(&db->aModule); i; i=sqliteHashNext(i)){
    Module *pMod = (Module *)sqliteHashData(i);
    if( pMod->xDestroy ){
      pMod->xDestroy(pMod->pAux);
    }
    sqlite3DbFree(db, pMod);
  }
  sqlite3HashClear(&db->aModule);
#endif

  sqlite3HashClear(&db->aFunc);
  sqlite3Error(db, SQLITE_OK, 0); /* Deallocates any cached error strings. */
  if( db->pErr ){
    sqlite3ValueFree(db->pErr);
  }
  sqlite3CloseExtensions(db);

  db->magic = SQLITE_MAGIC_ERROR;

  /* The temp-database schema is allocated differently from the other schema
  ** objects (using sqliteMalloc() directly, instead of sqlite3BtreeSchema()).
  ** So it needs to be freed here. Todo: Why not roll the temp schema into
  ** the same sqliteMalloc() as the one that allocates the database 
  ** structure?
  */
  sqlite3DbFree(db, db->aDb[1].pSchema);
  sqlite3_mutex_leave(db->mutex);
  db->magic = SQLITE_MAGIC_CLOSED;
  sqlite3_mutex_free(db->mutex);
  if( db->lookaside.bMalloced ){
    sqlite3_free(db->lookaside.pStart);
  }
  sqlite3_free(db);
  return SQLITE_OK;
}

/*
** Rollback all database files.
*/
void sqlite3RollbackAll(sqlite3 *db){
  int i;
  int inTrans = 0;
  assert( sqlite3_mutex_held(db->mutex) );
  sqlite3BeginBenignMalloc();
  for(i=0; i<db->nDb; i++){
    if( db->aDb[i].pBt ){
      if( sqlite3BtreeIsInTrans(db->aDb[i].pBt) ){
        inTrans = 1;
      }
      sqlite3BtreeRollback(db->aDb[i].pBt);
      db->aDb[i].inTrans = 0;
    }
  }
  sqlite3VtabRollback(db);
  sqlite3EndBenignMalloc();

  if( db->flags&SQLITE_InternChanges ){
    sqlite3ExpirePreparedStatements(db);
    sqlite3ResetInternalSchema(db, 0);
  }

  /* If one has been configured, invoke the rollback-hook callback */
  if( db->xRollbackCallback && (inTrans || !db->autoCommit) ){
    db->xRollbackCallback(db->pRollbackArg);
  }
}

/*
** Return a static string that describes the kind of error specified in the
** argument.
*/
const char *sqlite3ErrStr(int rc){
  const char *z;
  switch( rc & 0xff ){
    case SQLITE_ROW:
    case SQLITE_DONE:
    case SQLITE_OK:         z = "not an error";                          break;
    case SQLITE_ERROR:      z = "SQL logic error or missing database";   break;
    case SQLITE_PERM:       z = "access permission denied";              break;
    case SQLITE_ABORT:      z = "callback requested query abort";        break;
    case SQLITE_BUSY:       z = "database is locked";                    break;
    case SQLITE_LOCKED:     z = "database table is locked";              break;
    case SQLITE_NOMEM:      z = "out of memory";                         break;
    case SQLITE_READONLY:   z = "attempt to write a readonly database";  break;
    case SQLITE_INTERRUPT:  z = "interrupted";                           break;
    case SQLITE_IOERR:      z = "disk I/O error";                        break;
    case SQLITE_CORRUPT:    z = "database disk image is malformed";      break;
    case SQLITE_FULL:       z = "database or disk is full";              break;
    case SQLITE_CANTOPEN:   z = "unable to open database file";          break;
    case SQLITE_EMPTY:      z = "table contains no data";                break;
    case SQLITE_SCHEMA:     z = "database schema has changed";           break;
    case SQLITE_TOOBIG:     z = "String or BLOB exceeded size limit";    break;
    case SQLITE_CONSTRAINT: z = "constraint failed";                     break;
    case SQLITE_MISMATCH:   z = "datatype mismatch";                     break;
    case SQLITE_MISUSE:     z = "library routine called out of sequence";break;
    case SQLITE_NOLFS:      z = "large file support is disabled";        break;
    case SQLITE_AUTH:       z = "authorization denied";                  break;
    case SQLITE_FORMAT:     z = "auxiliary database format error";       break;
    case SQLITE_RANGE:      z = "bind or column index out of range";     break;
    case SQLITE_NOTADB:     z = "file is encrypted or is not a database";break;
    default:                z = "unknown error";                         break;
  }
  return z;
}

/*
** This routine implements a busy callback that sleeps and tries
** again until a timeout value is reached.  The timeout value is
** an integer number of milliseconds passed in as the first
** argument.
*/
static int sqliteDefaultBusyCallback(
 void *ptr,               /* Database connection */
 int count                /* Number of times table has been busy */
){
#if SQLITE_OS_WIN || (defined(HAVE_USLEEP) && HAVE_USLEEP)
  static const u8 delays[] =
     { 1, 2, 5, 10, 15, 20, 25, 25,  25,  50,  50, 100 };
  static const u8 totals[] =
     { 0, 1, 3,  8, 18, 33, 53, 78, 103, 128, 178, 228 };
# define NDELAY (sizeof(delays)/sizeof(delays[0]))
  sqlite3 *db = (sqlite3 *)ptr;
  int timeout = db->busyTimeout;
  int delay, prior;

  assert( count>=0 );
  if( count < NDELAY ){
    delay = delays[count];
    prior = totals[count];
  }else{
    delay = delays[NDELAY-1];
    prior = totals[NDELAY-1] + delay*(count-(NDELAY-1));
  }
  if( prior + delay > timeout ){
    delay = timeout - prior;
    if( delay<=0 ) return 0;
  }
  sqlite3OsSleep(db->pVfs, delay*1000);
  return 1;
#else
  sqlite3 *db = (sqlite3 *)ptr;
  int timeout = ((sqlite3 *)ptr)->busyTimeout;
  if( (count+1)*1000 > timeout ){
    return 0;
  }
  sqlite3OsSleep(db->pVfs, 1000000);
  return 1;
#endif
}

/*
** Invoke the given busy handler.
**
** This routine is called when an operation failed with a lock.
** If this routine returns non-zero, the lock is retried.  If it
** returns 0, the operation aborts with an SQLITE_BUSY error.
*/
int sqlite3InvokeBusyHandler(BusyHandler *p){
  int rc;
  if( NEVER(p==0) || p->xFunc==0 || p->nBusy<0 ) return 0;
  rc = p->xFunc(p->pArg, p->nBusy);
  if( rc==0 ){
    p->nBusy = -1;
  }else{
    p->nBusy++;
  }
  return rc; 
}

/*
** This routine sets the busy callback for an Sqlite database to the
** given callback function with the given argument.
*/
int sqlite3_busy_handler(
  sqlite3 *db,
  int (*xBusy)(void*,int),
  void *pArg
){
  sqlite3_mutex_enter(db->mutex);
  db->busyHandler.xFunc = xBusy;
  db->busyHandler.pArg = pArg;
  db->busyHandler.nBusy = 0;
  sqlite3_mutex_leave(db->mutex);
  return SQLITE_OK;
}

#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
/*
** This routine sets the progress callback for an Sqlite database to the
** given callback function with the given argument. The progress callback will
** be invoked every nOps opcodes.
*/
void sqlite3_progress_handler(
  sqlite3 *db, 
  int nOps,
  int (*xProgress)(void*), 
  void *pArg
){
  sqlite3_mutex_enter(db->mutex);
  if( nOps>0 ){
    db->xProgress = xProgress;
    db->nProgressOps = nOps;
    db->pProgressArg = pArg;
  }else{
    db->xProgress = 0;
    db->nProgressOps = 0;
    db->pProgressArg = 0;
  }
  sqlite3_mutex_leave(db->mutex);
}
#endif


/*
** This routine installs a default busy handler that waits for the
** specified number of milliseconds before returning 0.
*/
int sqlite3_busy_timeout(sqlite3 *db, int ms){
  if( ms>0 ){
    db->busyTimeout = ms;
    sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)db);
  }else{
    sqlite3_busy_handler(db, 0, 0);
  }
  return SQLITE_OK;
}

/*
** Cause any pending operation to stop at its earliest opportunity.
*/
void sqlite3_interrupt(sqlite3 *db){
  db->u1.isInterrupted = 1;
}


/*
** This function is exactly the same as sqlite3_create_function(), except
** that it is designed to be called by internal code. The difference is
** that if a malloc() fails in sqlite3_create_function(), an error code
** is returned and the mallocFailed flag cleared. 
*/
int sqlite3CreateFunc(
  sqlite3 *db,
  const char *zFunctionName,
  int nArg,
  int enc,
  void *pUserData,
  void (*xFunc)(sqlite3_context*,int,sqlite3_value **),
  void (*xStep)(sqlite3_context*,int,sqlite3_value **),
  void (*xFinal)(sqlite3_context*)
){
  FuncDef *p;
  int nName;

  assert( sqlite3_mutex_held(db->mutex) );
  if( zFunctionName==0 ||
      (xFunc && (xFinal || xStep)) || 
      (!xFunc && (xFinal && !xStep)) ||
      (!xFunc && (!xFinal && xStep)) ||
      (nArg<-1 || nArg>SQLITE_MAX_FUNCTION_ARG) ||
      (255<(nName = sqlite3Strlen(db, zFunctionName))) ){
    sqlite3Error(db, SQLITE_ERROR, "bad parameters");
    return SQLITE_ERROR;
  }
  
#ifndef SQLITE_OMIT_UTF16
  /* If SQLITE_UTF16 is specified as the encoding type, transform this
  ** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the
  ** SQLITE_UTF16NATIVE macro. SQLITE_UTF16 is not used internally.
  **
  ** If SQLITE_ANY is specified, add three versions of the function
  ** to the hash table.
  */
  if( enc==SQLITE_UTF16 ){
    enc = SQLITE_UTF16NATIVE;
  }else if( enc==SQLITE_ANY ){
    int rc;
    rc = sqlite3CreateFunc(db, zFunctionName, nArg, SQLITE_UTF8,
         pUserData, xFunc, xStep, xFinal);
    if( rc==SQLITE_OK ){
      rc = sqlite3CreateFunc(db, zFunctionName, nArg, SQLITE_UTF16LE,
          pUserData, xFunc, xStep, xFinal);
    }
    if( rc!=SQLITE_OK ){
      return rc;
    }
    enc = SQLITE_UTF16BE;
  }
#else
  enc = SQLITE_UTF8;
#endif
  
  /* Check if an existing function is being overridden or deleted. If so,
  ** and there are active VMs, then return SQLITE_BUSY. If a function
  ** is being overridden/deleted but there are no active VMs, allow the
  ** operation to continue but invalidate all precompiled statements.
  */
  p = sqlite3FindFunction(db, zFunctionName, nName, nArg, enc, 0);
  if( p && p->iPrefEnc==enc && p->nArg==nArg ){
    if( db->activeVdbeCnt ){
      sqlite3Error(db, SQLITE_BUSY, 
        "Unable to delete/modify user-function due to active statements");
      assert( !db->mallocFailed );
      return SQLITE_BUSY;
    }else{
      sqlite3ExpirePreparedStatements(db);
    }
  }

  p = sqlite3FindFunction(db, zFunctionName, nName, nArg, enc, 1);
  assert(p || db->mallocFailed);
  if( !p ){
    return SQLITE_NOMEM;
  }
  p->flags = 0;
  p->xFunc = xFunc;
  p->xStep = xStep;
  p->xFinalize = xFinal;
  p->pUserData = pUserData;
  p->nArg = nArg;
  return SQLITE_OK;
}

/*
** Create new user functions.
*/
int sqlite3_create_function(
  sqlite3 *db,
  const char *zFunctionName,
  int nArg,
  int enc,
  void *p,
  void (*xFunc)(sqlite3_context*,int,sqlite3_value **),
  void (*xStep)(sqlite3_context*,int,sqlite3_value **),
  void (*xFinal)(sqlite3_context*)
){
  int rc;
  sqlite3_mutex_enter(db->mutex);
  rc = sqlite3CreateFunc(db, zFunctionName, nArg, enc, p, xFunc, xStep, xFinal);
  rc = sqlite3ApiExit(db, rc);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

#ifndef SQLITE_OMIT_UTF16
int sqlite3_create_function16(
  sqlite3 *db,
  const void *zFunctionName,
  int nArg,
  int eTextRep,
  void *p,
  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
  void (*xFinal)(sqlite3_context*)
){
  int rc;
  char *zFunc8;
  sqlite3_mutex_enter(db->mutex);
  assert( !db->mallocFailed );
  zFunc8 = sqlite3Utf16to8(db, zFunctionName, -1);
  rc = sqlite3CreateFunc(db, zFunc8, nArg, eTextRep, p, xFunc, xStep, xFinal);
  sqlite3DbFree(db, zFunc8);
  rc = sqlite3ApiExit(db, rc);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}
#endif


/*
** Declare that a function has been overloaded by a virtual table.
**
** If the function already exists as a regular global function, then
** this routine is a no-op.  If the function does not exist, then create
** a new one that always throws a run-time error.  
**
** When virtual tables intend to provide an overloaded function, they
** should call this routine to make sure the global function exists.
** A global function must exist in order for name resolution to work
** properly.
*/
int sqlite3_overload_function(
  sqlite3 *db,
  const char *zName,
  int nArg
){
  int nName = sqlite3Strlen(db, zName);
  int rc;
  sqlite3_mutex_enter(db->mutex);
  if( sqlite3FindFunction(db, zName, nName, nArg, SQLITE_UTF8, 0)==0 ){
    sqlite3CreateFunc(db, zName, nArg, SQLITE_UTF8,
                      0, sqlite3InvalidFunction, 0, 0);
  }
  rc = sqlite3ApiExit(db, SQLITE_OK);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

#ifndef SQLITE_OMIT_TRACE
/*
** Register a trace function.  The pArg from the previously registered trace
** is returned.  
**
** A NULL trace function means that no tracing is executes.  A non-NULL
** trace is a pointer to a function that is invoked at the start of each
** SQL statement.
*/
void *sqlite3_trace(sqlite3 *db, void (*xTrace)(void*,const char*), void *pArg){
  void *pOld;
  sqlite3_mutex_enter(db->mutex);
  pOld = db->pTraceArg;
  db->xTrace = xTrace;
  db->pTraceArg = pArg;
  sqlite3_mutex_leave(db->mutex);
  return pOld;
}
/*
** Register a profile function.  The pArg from the previously registered 
** profile function is returned.  
**
** A NULL profile function means that no profiling is executes.  A non-NULL
** profile is a pointer to a function that is invoked at the conclusion of
** each SQL statement that is run.
*/
void *sqlite3_profile(
  sqlite3 *db,
  void (*xProfile)(void*,const char*,sqlite_uint64),
  void *pArg
){
  void *pOld;
  sqlite3_mutex_enter(db->mutex);
  pOld = db->pProfileArg;
  db->xProfile = xProfile;
  db->pProfileArg = pArg;
  sqlite3_mutex_leave(db->mutex);
  return pOld;
}
#endif /* SQLITE_OMIT_TRACE */

/*** EXPERIMENTAL ***
**
** Register a function to be invoked when a transaction comments.
** If the invoked function returns non-zero, then the commit becomes a
** rollback.
*/
void *sqlite3_commit_hook(
  sqlite3 *db,              /* Attach the hook to this database */
  int (*xCallback)(void*),  /* Function to invoke on each commit */
  void *pArg                /* Argument to the function */
){
  void *pOld;
  sqlite3_mutex_enter(db->mutex);
  pOld = db->pCommitArg;
  db->xCommitCallback = xCallback;
  db->pCommitArg = pArg;
  sqlite3_mutex_leave(db->mutex);
  return pOld;
}

/*
** Register a callback to be invoked each time a row is updated,
** inserted or deleted using this database connection.
*/
void *sqlite3_update_hook(
  sqlite3 *db,              /* Attach the hook to this database */
  void (*xCallback)(void*,int,char const *,char const *,sqlite_int64),
  void *pArg                /* Argument to the function */
){
  void *pRet;
  sqlite3_mutex_enter(db->mutex);
  pRet = db->pUpdateArg;
  db->xUpdateCallback = xCallback;
  db->pUpdateArg = pArg;
  sqlite3_mutex_leave(db->mutex);
  return pRet;
}

/*
** Register a callback to be invoked each time a transaction is rolled
** back by this database connection.
*/
void *sqlite3_rollback_hook(
  sqlite3 *db,              /* Attach the hook to this database */
  void (*xCallback)(void*), /* Callback function */
  void *pArg                /* Argument to the function */
){
  void *pRet;
  sqlite3_mutex_enter(db->mutex);
  pRet = db->pRollbackArg;
  db->xRollbackCallback = xCallback;
  db->pRollbackArg = pArg;
  sqlite3_mutex_leave(db->mutex);
  return pRet;
}

/*
** This routine is called to create a connection to a database BTree
** driver.  If zFilename is the name of a file, then that file is
** opened and used.  If zFilename is the magic name ":memory:" then
** the database is stored in memory (and is thus forgotten as soon as
** the connection is closed.)  If zFilename is NULL then the database
** is a "virtual" database for transient use only and is deleted as
** soon as the connection is closed.
**
** A virtual database can be either a disk file (that is automatically
** deleted when the file is closed) or it an be held entirely in memory,
** depending on the values of the SQLITE_TEMP_STORE compile-time macro and the
** db->temp_store variable, according to the following chart:
**
**   SQLITE_TEMP_STORE     db->temp_store     Location of temporary database
**   -----------------     --------------     ------------------------------
**   0                     any                file
**   1                     1                  file
**   1                     2                  memory
**   1                     0                  file
**   2                     1                  file
**   2                     2                  memory
**   2                     0                  memory
**   3                     any                memory
*/
int sqlite3BtreeFactory(
  const sqlite3 *db,        /* Main database when opening aux otherwise 0 */
  const char *zFilename,    /* Name of the file containing the BTree database */
  int omitJournal,          /* if TRUE then do not journal this file */
  int nCache,               /* How many pages in the page cache */
  int vfsFlags,             /* Flags passed through to vfsOpen */
  Btree **ppBtree           /* Pointer to new Btree object written here */
){
  int btFlags = 0;
  int rc;
  
  assert( sqlite3_mutex_held(db->mutex) );
  assert( ppBtree != 0);
  if( omitJournal ){
    btFlags |= BTREE_OMIT_JOURNAL;
  }
  if( db->flags & SQLITE_NoReadlock ){
    btFlags |= BTREE_NO_READLOCK;
  }
  if( zFilename==0 ){
#if SQLITE_TEMP_STORE==0
    /* Do nothing */
#endif
#ifndef SQLITE_OMIT_MEMORYDB
#if SQLITE_TEMP_STORE==1
    if( db->temp_store==2 ) zFilename = ":memory:";
#endif
#if SQLITE_TEMP_STORE==2
    if( db->temp_store!=1 ) zFilename = ":memory:";
#endif
#if SQLITE_TEMP_STORE==3
    zFilename = ":memory:";
#endif
#endif /* SQLITE_OMIT_MEMORYDB */
  }

  if( (vfsFlags & SQLITE_OPEN_MAIN_DB)!=0 && (zFilename==0 || *zFilename==0) ){
    vfsFlags = (vfsFlags & ~SQLITE_OPEN_MAIN_DB) | SQLITE_OPEN_TEMP_DB;
  }
  rc = sqlite3BtreeOpen(zFilename, (sqlite3 *)db, ppBtree, btFlags, vfsFlags);

  /* If the B-Tree was successfully opened, set the pager-cache size to the
  ** default value. Except, if the call to BtreeOpen() returned a handle
  ** open on an existing shared pager-cache, do not change the pager-cache 
  ** size.
  */
  if( rc==SQLITE_OK && 0==sqlite3BtreeSchema(*ppBtree, 0, 0) ){
    sqlite3BtreeSetCacheSize(*ppBtree, nCache);
  }
  return rc;
}

/*
** Return UTF-8 encoded English language explanation of the most recent
** error.
*/
const char *sqlite3_errmsg(sqlite3 *db){
  const char *z;
  if( !db ){
    return sqlite3ErrStr(SQLITE_NOMEM);
  }
  if( !sqlite3SafetyCheckSickOrOk(db) ){
    return sqlite3ErrStr(SQLITE_MISUSE);
  }
  sqlite3_mutex_enter(db->mutex);
  assert( !db->mallocFailed );
  z = (char*)sqlite3_value_text(db->pErr);
  assert( !db->mallocFailed );
  if( z==0 ){
    z = sqlite3ErrStr(db->errCode);
  }
  sqlite3_mutex_leave(db->mutex);
  return z;
}

#ifndef SQLITE_OMIT_UTF16
/*
** Return UTF-16 encoded English language explanation of the most recent
** error.
*/
const void *sqlite3_errmsg16(sqlite3 *db){
  /* Because all the characters in the string are in the unicode
  ** range 0x00-0xFF, if we pad the big-endian string with a 
  ** zero byte, we can obtain the little-endian string with
  ** &big_endian[1].
  */
  static const char outOfMemBe[] = {
    0, 'o', 0, 'u', 0, 't', 0, ' ', 
    0, 'o', 0, 'f', 0, ' ', 
    0, 'm', 0, 'e', 0, 'm', 0, 'o', 0, 'r', 0, 'y', 0, 0, 0
  };
  static const char misuseBe [] = {
    0, 'l', 0, 'i', 0, 'b', 0, 'r', 0, 'a', 0, 'r', 0, 'y', 0, ' ', 
    0, 'r', 0, 'o', 0, 'u', 0, 't', 0, 'i', 0, 'n', 0, 'e', 0, ' ', 
    0, 'c', 0, 'a', 0, 'l', 0, 'l', 0, 'e', 0, 'd', 0, ' ', 
    0, 'o', 0, 'u', 0, 't', 0, ' ', 
    0, 'o', 0, 'f', 0, ' ', 
    0, 's', 0, 'e', 0, 'q', 0, 'u', 0, 'e', 0, 'n', 0, 'c', 0, 'e', 0, 0, 0
  };

  const void *z;
  if( !db ){
    return (void *)(&outOfMemBe[SQLITE_UTF16NATIVE==SQLITE_UTF16LE?1:0]);
  }
  if( !sqlite3SafetyCheckSickOrOk(db) ){
    return (void *)(&misuseBe[SQLITE_UTF16NATIVE==SQLITE_UTF16LE?1:0]);
  }
  sqlite3_mutex_enter(db->mutex);
  assert( !db->mallocFailed );
  z = sqlite3_value_text16(db->pErr);
  if( z==0 ){
    sqlite3ValueSetStr(db->pErr, -1, sqlite3ErrStr(db->errCode),
         SQLITE_UTF8, SQLITE_STATIC);
    z = sqlite3_value_text16(db->pErr);
  }
  /* A malloc() may have failed within the call to sqlite3_value_text16()
  ** above. If this is the case, then the db->mallocFailed flag needs to
  ** be cleared before returning. Do this directly, instead of via
  ** sqlite3ApiExit(), to avoid setting the database handle error message.
  */
  db->mallocFailed = 0;
  sqlite3_mutex_leave(db->mutex);
  return z;
}
#endif /* SQLITE_OMIT_UTF16 */

/*
** Return the most recent error code generated by an SQLite routine. If NULL is
** passed to this function, we assume a malloc() failed during sqlite3_open().
*/
int sqlite3_errcode(sqlite3 *db){
  if( db && !sqlite3SafetyCheckSickOrOk(db) ){
    return SQLITE_MISUSE;
  }
  if( !db || db->mallocFailed ){
    return SQLITE_NOMEM;
  }
  return db->errCode & db->errMask;
}

/*
** Create a new collating function for database "db".  The name is zName
** and the encoding is enc.
*/
static int createCollation(
  sqlite3* db, 
  const char *zName, 
  int enc, 
  void* pCtx,
  int(*xCompare)(void*,int,const void*,int,const void*),
  void(*xDel)(void*)
){
  CollSeq *pColl;
  int enc2;
  int nName;
  
  assert( sqlite3_mutex_held(db->mutex) );

  /* If SQLITE_UTF16 is specified as the encoding type, transform this
  ** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the
  ** SQLITE_UTF16NATIVE macro. SQLITE_UTF16 is not used internally.
  */
  enc2 = enc & ~SQLITE_UTF16_ALIGNED;
  if( enc2==SQLITE_UTF16 ){
    enc2 = SQLITE_UTF16NATIVE;
  }
  if( (enc2&~3)!=0 ){
    return SQLITE_MISUSE;
  }

  /* Check if this call is removing or replacing an existing collation 
  ** sequence. If so, and there are active VMs, return busy. If there
  ** are no active VMs, invalidate any pre-compiled statements.
  */
  nName = sqlite3Strlen(db, zName);
  pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, nName, 0);
  if( pColl && pColl->xCmp ){
    if( db->activeVdbeCnt ){
      sqlite3Error(db, SQLITE_BUSY, 
        "Unable to delete/modify collation sequence due to active statements");
      return SQLITE_BUSY;
    }
    sqlite3ExpirePreparedStatements(db);

    /* If collation sequence pColl was created directly by a call to
    ** sqlite3_create_collation, and not generated by synthCollSeq(),
    ** then any copies made by synthCollSeq() need to be invalidated.
    ** Also, collation destructor - CollSeq.xDel() - function may need
    ** to be called.
    */ 
    if( (pColl->enc & ~SQLITE_UTF16_ALIGNED)==enc2 ){
      CollSeq *aColl = sqlite3HashFind(&db->aCollSeq, zName, nName);
      int j;
      for(j=0; j<3; j++){
        CollSeq *p = &aColl[j];
        if( p->enc==pColl->enc ){
          if( p->xDel ){
            p->xDel(p->pUser);
          }
          p->xCmp = 0;
        }
      }
    }
  }

  pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, nName, 1);
  if( pColl ){
    pColl->xCmp = xCompare;
    pColl->pUser = pCtx;
    pColl->xDel = xDel;
    pColl->enc = enc2 | (enc & SQLITE_UTF16_ALIGNED);
  }
  sqlite3Error(db, SQLITE_OK, 0);
  return SQLITE_OK;
}


/*
** This array defines hard upper bounds on limit values.  The
** initializer must be kept in sync with the SQLITE_LIMIT_*
** #defines in sqlite3.h.
*/
static const int aHardLimit[] = {
  SQLITE_MAX_LENGTH,
  SQLITE_MAX_SQL_LENGTH,
  SQLITE_MAX_COLUMN,
  SQLITE_MAX_EXPR_DEPTH,
  SQLITE_MAX_COMPOUND_SELECT,
  SQLITE_MAX_VDBE_OP,
  SQLITE_MAX_FUNCTION_ARG,
  SQLITE_MAX_ATTACHED,
  SQLITE_MAX_LIKE_PATTERN_LENGTH,
  SQLITE_MAX_VARIABLE_NUMBER,
};

/*
** Make sure the hard limits are set to reasonable values
*/
#if SQLITE_MAX_LENGTH<100
# error SQLITE_MAX_LENGTH must be at least 100
#endif
#if SQLITE_MAX_SQL_LENGTH<100
# error SQLITE_MAX_SQL_LENGTH must be at least 100
#endif
#if SQLITE_MAX_SQL_LENGTH>SQLITE_MAX_LENGTH
# error SQLITE_MAX_SQL_LENGTH must not be greater than SQLITE_MAX_LENGTH
#endif
#if SQLITE_MAX_COMPOUND_SELECT<2
# error SQLITE_MAX_COMPOUND_SELECT must be at least 2
#endif
#if SQLITE_MAX_VDBE_OP<40
# error SQLITE_MAX_VDBE_OP must be at least 40
#endif
#if SQLITE_MAX_FUNCTION_ARG<0 || SQLITE_MAX_FUNCTION_ARG>127
# error SQLITE_MAX_FUNCTION_ARG must be between 0 and 127
#endif
#if SQLITE_MAX_ATTACH<0 || SQLITE_MAX_ATTACH>30
# error SQLITE_MAX_ATTACH 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


/*
** Change the value of a limit.  Report the old value.
** If an invalid limit index is supplied, report -1.
** Make no changes but still report the old value if the
** new limit is negative.
**
** A new lower limit does not shrink existing constructs.
** It merely prevents new constructs that exceed the limit
** from forming.
*/
int sqlite3_limit(sqlite3 *db, int limitId, int newLimit){
  int oldLimit;
  if( limitId<0 || limitId>=SQLITE_N_LIMIT ){
    return -1;
  }
  oldLimit = db->aLimit[limitId];
  if( newLimit>=0 ){
    if( newLimit>aHardLimit[limitId] ){
      newLimit = aHardLimit[limitId];
    }
    db->aLimit[limitId] = newLimit;
  }
  return oldLimit;
}

/*
** This routine does the work of opening a database on behalf of
** sqlite3_open() and sqlite3_open16(). The database filename "zFilename"  
** is UTF-8 encoded.
*/
static int openDatabase(
  const char *zFilename, /* Database filename UTF-8 encoded */
  sqlite3 **ppDb,        /* OUT: Returned database handle */
  unsigned flags,        /* Operational flags */
  const char *zVfs       /* Name of the VFS to use */
){
  sqlite3 *db;
  int rc;
  CollSeq *pColl;
  int isThreadsafe = 1;

#ifndef SQLITE_OMIT_AUTOINIT
  rc = sqlite3_initialize();
  if( rc ) return rc;
#endif

  if( flags&SQLITE_OPEN_NOMUTEX ){
    isThreadsafe = 0;
  }

  /* Remove harmful bits from the flags parameter */
  flags &=  ~( SQLITE_OPEN_DELETEONCLOSE |
               SQLITE_OPEN_MAIN_DB |
               SQLITE_OPEN_TEMP_DB | 
               SQLITE_OPEN_TRANSIENT_DB | 
               SQLITE_OPEN_MAIN_JOURNAL | 
               SQLITE_OPEN_TEMP_JOURNAL | 
               SQLITE_OPEN_SUBJOURNAL | 
               SQLITE_OPEN_MASTER_JOURNAL |
               SQLITE_OPEN_NOMUTEX
             );

  /* Allocate the sqlite data structure */
  db = sqlite3MallocZero( sizeof(sqlite3) );
  if( db==0 ) goto opendb_out;
  if( sqlite3Config.bFullMutex && isThreadsafe ){
    db->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE);
    if( db->mutex==0 ){
      sqlite3_free(db);
      db = 0;
      goto opendb_out;
    }
  }
  sqlite3_mutex_enter(db->mutex);
  db->errMask = 0xff;
  db->priorNewRowid = 0;
  db->nDb = 2;
  db->magic = SQLITE_MAGIC_BUSY;
  db->aDb = db->aDbStatic;

  assert( sizeof(db->aLimit)==sizeof(aHardLimit) );
  memcpy(db->aLimit, aHardLimit, sizeof(db->aLimit));
  db->autoCommit = 1;
  db->nextAutovac = -1;
  db->nextPagesize = 0;
  db->flags |= SQLITE_ShortColNames
#if SQLITE_DEFAULT_FILE_FORMAT<4
                 | SQLITE_LegacyFileFmt
#endif
#ifdef SQLITE_ENABLE_LOAD_EXTENSION
                 | SQLITE_LoadExtension
#endif
      ;
  sqlite3HashInit(&db->aFunc, SQLITE_HASH_STRING, 0);
  sqlite3HashInit(&db->aCollSeq, SQLITE_HASH_STRING, 0);
#ifndef SQLITE_OMIT_VIRTUALTABLE
  sqlite3HashInit(&db->aModule, SQLITE_HASH_STRING, 0);
#endif

  db->pVfs = sqlite3_vfs_find(zVfs);
  if( !db->pVfs ){
    rc = SQLITE_ERROR;
    db->magic = SQLITE_MAGIC_SICK;
    sqlite3Error(db, rc, "no such vfs: %s", zVfs);
    goto opendb_out;
  }

  /* Add the default collation sequence BINARY. BINARY works for both UTF-8
  ** and UTF-16, so add a version for each to avoid any unnecessary
  ** conversions. The only error that can occur here is a malloc() failure.
  */
  createCollation(db, "BINARY", SQLITE_UTF8, 0, binCollFunc, 0);
  createCollation(db, "BINARY", SQLITE_UTF16BE, 0, binCollFunc, 0);
  createCollation(db, "BINARY", SQLITE_UTF16LE, 0, binCollFunc, 0);
  createCollation(db, "RTRIM", SQLITE_UTF8, (void*)1, binCollFunc, 0);
  if( db->mallocFailed ){
    db->magic = SQLITE_MAGIC_SICK;
    goto opendb_out;
  }
  db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "BINARY", 6, 0);
  assert( db->pDfltColl!=0 );

  /* Also add a UTF-8 case-insensitive collation sequence. */
  createCollation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc, 0);

  /* Set flags on the built-in collating sequences */
  db->pDfltColl->type = SQLITE_COLL_BINARY;
  pColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "NOCASE", 6, 0);
  if( pColl ){
    pColl->type = SQLITE_COLL_NOCASE;
  }

  /* Open the backend database driver */
  db->openFlags = flags;
  rc = sqlite3BtreeFactory(db, zFilename, 0, SQLITE_DEFAULT_CACHE_SIZE, 
                           flags | SQLITE_OPEN_MAIN_DB,
                           &db->aDb[0].pBt);
  if( rc!=SQLITE_OK ){
    sqlite3Error(db, rc, 0);
    db->magic = SQLITE_MAGIC_SICK;
    goto opendb_out;
  }
  db->aDb[0].pSchema = sqlite3SchemaGet(db, db->aDb[0].pBt);
  db->aDb[1].pSchema = sqlite3SchemaGet(db, 0);


  /* The default safety_level for the main database is 'full'; for the temp
  ** database it is 'NONE'. This matches the pager layer defaults.  
  */
  db->aDb[0].zName = "main";
  db->aDb[0].safety_level = 3;
#ifndef SQLITE_OMIT_TEMPDB
  db->aDb[1].zName = "temp";
  db->aDb[1].safety_level = 1;
#endif

  db->magic = SQLITE_MAGIC_OPEN;
  if( db->mallocFailed ){
    goto opendb_out;
  }

  /* Register all built-in functions, but do not attempt to read the
  ** database schema yet. This is delayed until the first time the database
  ** is accessed.
  */
  sqlite3Error(db, SQLITE_OK, 0);
  sqlite3RegisterBuiltinFunctions(db);

  /* Load automatic extensions - extensions that have been registered
  ** using the sqlite3_automatic_extension() API.
  */
  (void)sqlite3AutoLoadExtensions(db);
  if( sqlite3_errcode(db)!=SQLITE_OK ){
    goto opendb_out;
  }

#ifdef SQLITE_ENABLE_FTS1
  if( !db->mallocFailed ){
    extern int sqlite3Fts1Init(sqlite3*);
    rc = sqlite3Fts1Init(db);
  }
#endif

#ifdef SQLITE_ENABLE_FTS2
  if( !db->mallocFailed && rc==SQLITE_OK ){
    extern int sqlite3Fts2Init(sqlite3*);
    rc = sqlite3Fts2Init(db);
  }
#endif

#ifdef SQLITE_ENABLE_FTS3
  if( !db->mallocFailed && rc==SQLITE_OK ){
    rc = sqlite3Fts3Init(db);
  }
#endif

#ifdef SQLITE_ENABLE_ICU
  if( !db->mallocFailed && rc==SQLITE_OK ){
    extern int sqlite3IcuInit(sqlite3*);
    rc = sqlite3IcuInit(db);
  }
#endif

#ifdef SQLITE_ENABLE_RTREE
  if( !db->mallocFailed && rc==SQLITE_OK){
    rc = sqlite3RtreeInit(db);
  }
#endif

  sqlite3Error(db, rc, 0);

  /* -DSQLITE_DEFAULT_LOCKING_MODE=1 makes EXCLUSIVE the default locking
  ** mode.  -DSQLITE_DEFAULT_LOCKING_MODE=0 make NORMAL the default locking
  ** mode.  Doing nothing at all also makes NORMAL the default.
  */
#ifdef SQLITE_DEFAULT_LOCKING_MODE
  db->dfltLockMode = SQLITE_DEFAULT_LOCKING_MODE;
  sqlite3PagerLockingMode(sqlite3BtreePager(db->aDb[0].pBt),
                          SQLITE_DEFAULT_LOCKING_MODE);
#endif

  /* Enable the lookaside-malloc subsystem */
  setupLookaside(db, 0, sqlite3Config.szLookaside, sqlite3Config.nLookaside);

opendb_out:
  if( db ){
    assert( db->mutex!=0 || isThreadsafe==0 || sqlite3Config.bFullMutex==0 );
    sqlite3_mutex_leave(db->mutex);
  }
  if( SQLITE_NOMEM==(rc = sqlite3_errcode(db)) ){
    sqlite3_close(db);
    db = 0;
  }
  *ppDb = db;
  return sqlite3ApiExit(0, rc);
}

/*
** Open a new database handle.
*/
int sqlite3_open(
  const char *zFilename, 
  sqlite3 **ppDb 
){
  return openDatabase(zFilename, ppDb,
                      SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0);
}
int sqlite3_open_v2(
  const char *filename,   /* Database filename (UTF-8) */
  sqlite3 **ppDb,         /* OUT: SQLite db handle */
  int flags,              /* Flags */
  const char *zVfs        /* Name of VFS module to use */
){
  return openDatabase(filename, ppDb, flags, zVfs);
}

#ifndef SQLITE_OMIT_UTF16
/*
** Open a new database handle.
*/
int sqlite3_open16(
  const void *zFilename, 
  sqlite3 **ppDb
){
  char const *zFilename8;   /* zFilename encoded in UTF-8 instead of UTF-16 */
  sqlite3_value *pVal;
  int rc;

  assert( zFilename );
  assert( ppDb );
  *ppDb = 0;
#ifndef SQLITE_OMIT_AUTOINIT
  rc = sqlite3_initialize();
  if( rc ) return rc;
#endif
  pVal = sqlite3ValueNew(0);
  sqlite3ValueSetStr(pVal, -1, zFilename, SQLITE_UTF16NATIVE, SQLITE_STATIC);
  zFilename8 = sqlite3ValueText(pVal, SQLITE_UTF8);
  if( zFilename8 ){
    rc = openDatabase(zFilename8, ppDb,
                      SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0);
    assert( *ppDb || rc==SQLITE_NOMEM );
    if( rc==SQLITE_OK && !DbHasProperty(*ppDb, 0, DB_SchemaLoaded) ){
      ENC(*ppDb) = SQLITE_UTF16NATIVE;
    }
  }else{
    rc = SQLITE_NOMEM;
  }
  sqlite3ValueFree(pVal);

  return sqlite3ApiExit(0, rc);
}
#endif /* SQLITE_OMIT_UTF16 */

/*
** Register a new collation sequence with the database handle db.
*/
int sqlite3_create_collation(
  sqlite3* db, 
  const char *zName, 
  int enc, 
  void* pCtx,
  int(*xCompare)(void*,int,const void*,int,const void*)
){
  int rc;
  sqlite3_mutex_enter(db->mutex);
  assert( !db->mallocFailed );
  rc = createCollation(db, zName, enc, pCtx, xCompare, 0);
  rc = sqlite3ApiExit(db, rc);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

/*
** Register a new collation sequence with the database handle db.
*/
int sqlite3_create_collation_v2(
  sqlite3* db, 
  const char *zName, 
  int enc, 
  void* pCtx,
  int(*xCompare)(void*,int,const void*,int,const void*),
  void(*xDel)(void*)
){
  int rc;
  sqlite3_mutex_enter(db->mutex);
  assert( !db->mallocFailed );
  rc = createCollation(db, zName, enc, pCtx, xCompare, xDel);
  rc = sqlite3ApiExit(db, rc);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

#ifndef SQLITE_OMIT_UTF16
/*
** Register a new collation sequence with the database handle db.
*/
int sqlite3_create_collation16(
  sqlite3* db, 
  const void *zName,
  int enc, 
  void* pCtx,
  int(*xCompare)(void*,int,const void*,int,const void*)
){
  int rc = SQLITE_OK;
  char *zName8;
  sqlite3_mutex_enter(db->mutex);
  assert( !db->mallocFailed );
  zName8 = sqlite3Utf16to8(db, zName, -1);
  if( zName8 ){
    rc = createCollation(db, zName8, enc, pCtx, xCompare, 0);
    sqlite3DbFree(db, zName8);
  }
  rc = sqlite3ApiExit(db, rc);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}
#endif /* SQLITE_OMIT_UTF16 */

/*
** Register a collation sequence factory callback with the database handle
** db. Replace any previously installed collation sequence factory.
*/
int sqlite3_collation_needed(
  sqlite3 *db, 
  void *pCollNeededArg, 
  void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*)
){
  sqlite3_mutex_enter(db->mutex);
  db->xCollNeeded = xCollNeeded;
  db->xCollNeeded16 = 0;
  db->pCollNeededArg = pCollNeededArg;
  sqlite3_mutex_leave(db->mutex);
  return SQLITE_OK;
}

#ifndef SQLITE_OMIT_UTF16
/*
** Register a collation sequence factory callback with the database handle
** db. Replace any previously installed collation sequence factory.
*/
int sqlite3_collation_needed16(
  sqlite3 *db, 
  void *pCollNeededArg, 
  void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*)
){
  sqlite3_mutex_enter(db->mutex);
  db->xCollNeeded = 0;
  db->xCollNeeded16 = xCollNeeded16;
  db->pCollNeededArg = pCollNeededArg;
  sqlite3_mutex_leave(db->mutex);
  return SQLITE_OK;
}
#endif /* SQLITE_OMIT_UTF16 */

#ifndef SQLITE_OMIT_GLOBALRECOVER
/*
** This function is now an anachronism. It used to be used to recover from a
** malloc() failure, but SQLite now does this automatically.
*/
int sqlite3_global_recover(void){
  return SQLITE_OK;
}
#endif

/*
** Test to see whether or not the database connection is in autocommit
** mode.  Return TRUE if it is and FALSE if not.  Autocommit mode is on
** by default.  Autocommit is disabled by a BEGIN statement and reenabled
** by the next COMMIT or ROLLBACK.
**
******* THIS IS AN EXPERIMENTAL API AND IS SUBJECT TO CHANGE ******
*/
int sqlite3_get_autocommit(sqlite3 *db){
  return db->autoCommit;
}

#ifdef SQLITE_DEBUG
/*
** The following routine is subtituted for constant SQLITE_CORRUPT in
** debugging builds.  This provides a way to set a breakpoint for when
** corruption is first detected.
*/
int sqlite3Corrupt(void){
  return SQLITE_CORRUPT;
}
#endif

/*
** This is a convenience routine that makes sure that all thread-specific
** data for this thread has been deallocated.
**
** SQLite no longer uses thread-specific data so this routine is now a
** no-op.  It is retained for historical compatibility.
*/
void sqlite3_thread_cleanup(void){
}

/*
** Return meta information about a specific column of a database table.
** See comment in sqlite3.h (sqlite.h.in) for details.
*/
#ifdef SQLITE_ENABLE_COLUMN_METADATA
int sqlite3_table_column_metadata(
  sqlite3 *db,                /* Connection handle */
  const char *zDbName,        /* Database name or NULL */
  const char *zTableName,     /* Table name */
  const char *zColumnName,    /* Column name */
  char const **pzDataType,    /* OUTPUT: Declared data type */
  char const **pzCollSeq,     /* OUTPUT: Collation sequence name */
  int *pNotNull,              /* OUTPUT: True if NOT NULL constraint exists */
  int *pPrimaryKey,           /* OUTPUT: True if column part of PK */
  int *pAutoinc               /* OUTPUT: True if column is auto-increment */
){
  int rc;
  char *zErrMsg = 0;
  Table *pTab = 0;
  Column *pCol = 0;
  int iCol;

  char const *zDataType = 0;
  char const *zCollSeq = 0;
  int notnull = 0;
  int primarykey = 0;
  int autoinc = 0;

  /* Ensure the database schema has been loaded */
  sqlite3_mutex_enter(db->mutex);
  (void)sqlite3SafetyOn(db);
  sqlite3BtreeEnterAll(db);
  rc = sqlite3Init(db, &zErrMsg);
  sqlite3BtreeLeaveAll(db);
  if( SQLITE_OK!=rc ){
    goto error_out;
  }

  /* Locate the table in question */
  pTab = sqlite3FindTable(db, zTableName, zDbName);
  if( !pTab || pTab->pSelect ){
    pTab = 0;
    goto error_out;
  }

  /* Find the column for which info is requested */
  if( sqlite3IsRowid(zColumnName) ){
    iCol = pTab->iPKey;
    if( iCol>=0 ){
      pCol = &pTab->aCol[iCol];
    }
  }else{
    for(iCol=0; iCol<pTab->nCol; iCol++){
      pCol = &pTab->aCol[iCol];
      if( 0==sqlite3StrICmp(pCol->zName, zColumnName) ){
        break;
      }
    }
    if( iCol==pTab->nCol ){
      pTab = 0;
      goto error_out;
    }
  }

  /* The following block stores the meta information that will be returned
  ** to the caller in local variables zDataType, zCollSeq, notnull, primarykey
  ** and autoinc. At this point there are two possibilities:
  ** 
  **     1. The specified column name was rowid", "oid" or "_rowid_" 
  **        and there is no explicitly declared IPK column. 
  **
  **     2. The table is not a view and the column name identified an 
  **        explicitly declared column. Copy meta information from *pCol.
  */ 
  if( pCol ){
    zDataType = pCol->zType;
    zCollSeq = pCol->zColl;
    notnull = pCol->notNull!=0;
    primarykey  = pCol->isPrimKey!=0;
    autoinc = pTab->iPKey==iCol && pTab->autoInc;
  }else{
    zDataType = "INTEGER";
    primarykey = 1;
  }
  if( !zCollSeq ){
    zCollSeq = "BINARY";
  }

error_out:
  (void)sqlite3SafetyOff(db);

  /* Whether the function call succeeded or failed, set the output parameters
  ** to whatever their local counterparts contain. If an error did occur,
  ** this has the effect of zeroing all output parameters.
  */
  if( pzDataType ) *pzDataType = zDataType;
  if( pzCollSeq ) *pzCollSeq = zCollSeq;
  if( pNotNull ) *pNotNull = notnull;
  if( pPrimaryKey ) *pPrimaryKey = primarykey;
  if( pAutoinc ) *pAutoinc = autoinc;

  if( SQLITE_OK==rc && !pTab ){
    sqlite3DbFree(db, zErrMsg);
    zErrMsg = sqlite3MPrintf(db, "no such table column: %s.%s", zTableName,
        zColumnName);
    rc = SQLITE_ERROR;
  }
  sqlite3Error(db, rc, (zErrMsg?"%s":0), zErrMsg);
  sqlite3DbFree(db, zErrMsg);
  rc = sqlite3ApiExit(db, rc);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}
#endif

/*
** Sleep for a little while.  Return the amount of time slept.
*/
int sqlite3_sleep(int ms){
  sqlite3_vfs *pVfs;
  int rc;
  pVfs = sqlite3_vfs_find(0);
  if( pVfs==0 ) return 0;

  /* This function works in milliseconds, but the underlying OsSleep() 
  ** API uses microseconds. Hence the 1000's.
  */
  rc = (sqlite3OsSleep(pVfs, 1000*ms)/1000);
  return rc;
}

/*
** Enable or disable the extended result codes.
*/
int sqlite3_extended_result_codes(sqlite3 *db, int onoff){
  sqlite3_mutex_enter(db->mutex);
  db->errMask = onoff ? 0xffffffff : 0xff;
  sqlite3_mutex_leave(db->mutex);
  return SQLITE_OK;
}

/*
** Invoke the xFileControl method on a particular database.
*/
int sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, void *pArg){
  int rc = SQLITE_ERROR;
  int iDb;
  sqlite3_mutex_enter(db->mutex);
  if( zDbName==0 ){
    iDb = 0;
  }else{
    for(iDb=0; iDb<db->nDb; iDb++){
      if( strcmp(db->aDb[iDb].zName, zDbName)==0 ) break;
    }
  }
  if( iDb<db->nDb ){
    Btree *pBtree = db->aDb[iDb].pBt;
    if( pBtree ){
      Pager *pPager;
      sqlite3_file *fd;
      sqlite3BtreeEnter(pBtree);
      pPager = sqlite3BtreePager(pBtree);
      assert( pPager!=0 );
      fd = sqlite3PagerFile(pPager);
      assert( fd!=0 );
      if( fd->pMethods ){
        rc = sqlite3OsFileControl(fd, op, pArg);
      }
      sqlite3BtreeLeave(pBtree);
    }
  }
  sqlite3_mutex_leave(db->mutex);
  return rc;   
}

/*
** Interface to the testing logic.
*/
int sqlite3_test_control(int op, ...){
  int rc = 0;
#ifndef SQLITE_OMIT_BUILTIN_TEST
  va_list ap;
  va_start(ap, op);
  switch( op ){

    /*
    ** Save the current state of the PRNG.
    */
    case SQLITE_TESTCTRL_PRNG_SAVE: {
      sqlite3PrngSaveState();
      break;
    }

    /*
    ** Restore the state of the PRNG to the last state saved using
    ** PRNG_SAVE.  If PRNG_SAVE has never before been called, then
    ** this verb acts like PRNG_RESET.
    */
    case SQLITE_TESTCTRL_PRNG_RESTORE: {
      sqlite3PrngRestoreState();
      break;
    }

    /*
    ** Reset the PRNG back to its uninitialized state.  The next call
    ** to sqlite3_randomness() will reseed the PRNG using a single call
    ** to the xRandomness method of the default VFS.
    */
    case SQLITE_TESTCTRL_PRNG_RESET: {
      sqlite3PrngResetState();
      break;
    }

    /*
    **  sqlite3_test_control(BITVEC_TEST, size, program)
    **
    ** Run a test against a Bitvec object of size.  The program argument
    ** is an array of integers that defines the test.  Return -1 on a
    ** memory allocation error, 0 on success, or non-zero for an error.
    ** See the sqlite3BitvecBuiltinTest() for additional information.
    */
    case SQLITE_TESTCTRL_BITVEC_TEST: {
      int sz = va_arg(ap, int);
      int *aProg = va_arg(ap, int*);
      rc = sqlite3BitvecBuiltinTest(sz, aProg);
      break;
    }

    /*
    **  sqlite3_test_control(BENIGN_MALLOC_HOOKS, xBegin, xEnd)
    **
    ** Register hooks to call to indicate which malloc() failures 
    ** are benign.
    */
    case SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS: {
      typedef void (*void_function)(void);
      void_function xBenignBegin;
      void_function xBenignEnd;
      xBenignBegin = va_arg(ap, void_function);
      xBenignEnd = va_arg(ap, void_function);
      sqlite3BenignMallocHooks(xBenignBegin, xBenignEnd);
      break;
    }
  }
  va_end(ap);
#endif /* SQLITE_OMIT_BUILTIN_TEST */
  return rc;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/malloc.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** Memory allocation functions used throughout sqlite.
**
** $Id: malloc.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
#include <ctype.h>

/*
** This routine runs when the memory allocator sees that the
** total memory allocation is about to exceed the soft heap
** limit.
*/
static void softHeapLimitEnforcer(
  void *NotUsed, 
  sqlite3_int64 inUse,
  int allocSize
){
  sqlite3_release_memory(allocSize);
}

/*
** Set the soft heap-size limit for the library. Passing a zero or 
** negative value indicates no limit.
*/
void sqlite3_soft_heap_limit(int n){
  sqlite3_uint64 iLimit;
  int overage;
  if( n<0 ){
    iLimit = 0;
  }else{
    iLimit = n;
  }
  sqlite3_initialize();
  if( iLimit>0 ){
    sqlite3_memory_alarm(softHeapLimitEnforcer, 0, iLimit);
  }else{
    sqlite3_memory_alarm(0, 0, 0);
  }
  overage = sqlite3_memory_used() - n;
  if( overage>0 ){
    sqlite3_release_memory(overage);
  }
}

/*
** 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.
*/
int sqlite3_release_memory(int n){
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  int nRet = sqlite3VdbeReleaseMemory(n);
  nRet += sqlite3PagerReleaseMemory(n-nRet);
  return nRet;
#else
  return SQLITE_OK;
#endif
}

/*
** State information local to the memory allocation subsystem.
*/
static struct {
  sqlite3_mutex *mutex;         /* Mutex to serialize access */

  /*
  ** The alarm callback and its arguments.  The mem0.mutex lock will
  ** be held while the callback is running.  Recursive calls into
  ** the memory subsystem are allowed, but no new callbacks will be
  ** issued.  The alarmBusy variable is set to prevent recursive
  ** callbacks.
  */
  sqlite3_int64 alarmThreshold;
  void (*alarmCallback)(void*, sqlite3_int64,int);
  void *alarmArg;
  int alarmBusy;

  /*
  ** Pointers to the end of sqlite3Config.pScratch and
  ** sqlite3Config.pPage to a block of memory that records
  ** which pages are available.
  */
  u32 *aScratchFree;
  u32 *aPageFree;

  /* Number of free pages for scratch and page-cache memory */
  u32 nScratchFree;
  u32 nPageFree;
} mem0;

/*
** Initialize the memory allocation subsystem.
*/
int sqlite3MallocInit(void){
  if( sqlite3Config.m.xMalloc==0 ){
    sqlite3MemSetDefault();
  }
  memset(&mem0, 0, sizeof(mem0));
  if( sqlite3Config.bCoreMutex ){
    mem0.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
  }
  if( sqlite3Config.pScratch && sqlite3Config.szScratch>=100
      && sqlite3Config.nScratch>=0 ){
    int i;
    sqlite3Config.szScratch -= 4;
    mem0.aScratchFree = (u32*)&((char*)sqlite3Config.pScratch)
                  [sqlite3Config.szScratch*sqlite3Config.nScratch];
    for(i=0; i<sqlite3Config.nScratch; i++){ mem0.aScratchFree[i] = i; }
    mem0.nScratchFree = sqlite3Config.nScratch;
  }else{
    sqlite3Config.pScratch = 0;
    sqlite3Config.szScratch = 0;
  }
  if( sqlite3Config.pPage && sqlite3Config.szPage>=512
      && sqlite3Config.nPage>=1 ){
    int i;
    int overhead;
    int sz = sqlite3Config.szPage;
    int n = sqlite3Config.nPage;
    overhead = (4*n + sz - 1)/sz;
    sqlite3Config.nPage -= overhead;
    mem0.aPageFree = (u32*)&((char*)sqlite3Config.pPage)
                  [sqlite3Config.szPage*sqlite3Config.nPage];
    for(i=0; i<sqlite3Config.nPage; i++){ mem0.aPageFree[i] = i; }
    mem0.nPageFree = sqlite3Config.nPage;
  }else{
    sqlite3Config.pPage = 0;
    sqlite3Config.szPage = 0;
  }
  return sqlite3Config.m.xInit(sqlite3Config.m.pAppData);
}

/*
** Deinitialize the memory allocation subsystem.
*/
void sqlite3MallocEnd(void){
  sqlite3Config.m.xShutdown(sqlite3Config.m.pAppData);
  memset(&mem0, 0, sizeof(mem0));
}

/*
** Return the amount of memory currently checked out.
*/
sqlite3_int64 sqlite3_memory_used(void){
  int n, mx;
  sqlite3_int64 res;
  sqlite3_status(SQLITE_STATUS_MEMORY_USED, &n, &mx, 0);
  res = (sqlite3_int64)n;  /* Work around bug in Borland C. Ticket #3216 */
  return res;
}

/*
** Return the maximum amount of memory that has ever been
** checked out since either the beginning of this process
** or since the most recent reset.
*/
sqlite3_int64 sqlite3_memory_highwater(int resetFlag){
  int n, mx;
  sqlite3_int64 res;
  sqlite3_status(SQLITE_STATUS_MEMORY_USED, &n, &mx, resetFlag);
  res = (sqlite3_int64)mx;  /* Work around bug in Borland C. Ticket #3216 */
  return res;
}

/*
** Change the alarm callback
*/
int sqlite3_memory_alarm(
  void(*xCallback)(void *pArg, sqlite3_int64 used,int N),
  void *pArg,
  sqlite3_int64 iThreshold
){
  sqlite3_mutex_enter(mem0.mutex);
  mem0.alarmCallback = xCallback;
  mem0.alarmArg = pArg;
  mem0.alarmThreshold = iThreshold;
  sqlite3_mutex_leave(mem0.mutex);
  return SQLITE_OK;
}

/*
** Trigger the alarm 
*/
static void sqlite3MallocAlarm(int nByte){
  void (*xCallback)(void*,sqlite3_int64,int);
  sqlite3_int64 nowUsed;
  void *pArg;
  if( mem0.alarmCallback==0 || mem0.alarmBusy  ) return;
  mem0.alarmBusy = 1;
  xCallback = mem0.alarmCallback;
  nowUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);
  pArg = mem0.alarmArg;
  sqlite3_mutex_leave(mem0.mutex);
  xCallback(pArg, nowUsed, nByte);
  sqlite3_mutex_enter(mem0.mutex);
  mem0.alarmBusy = 0;
}

/*
** Do a memory allocation with statistics and alarms.  Assume the
** lock is already held.
*/
static int mallocWithAlarm(int n, void **pp){
  int nFull;
  void *p;
  assert( sqlite3_mutex_held(mem0.mutex) );
  nFull = sqlite3Config.m.xRoundup(n);
  sqlite3StatusSet(SQLITE_STATUS_MALLOC_SIZE, n);
  if( mem0.alarmCallback!=0 ){
    int nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);
    if( nUsed+nFull >= mem0.alarmThreshold ){
      sqlite3MallocAlarm(nFull);
    }
  }
  p = sqlite3Config.m.xMalloc(nFull);
  if( p==0 && mem0.alarmCallback ){
    sqlite3MallocAlarm(nFull);
    p = sqlite3Config.m.xMalloc(nFull);
  }
  if( p ){
    nFull = sqlite3MallocSize(p);
    sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, nFull);
  }
  *pp = p;
  return nFull;
}

/*
** Allocate memory.  This routine is like sqlite3_malloc() except that it
** assumes the memory subsystem has already been initialized.
*/
void *sqlite3Malloc(int n){
  void *p;
  if( n<=0 ){
    p = 0;
  }else if( sqlite3Config.bMemstat ){
    sqlite3_mutex_enter(mem0.mutex);
    mallocWithAlarm(n, &p);
    sqlite3_mutex_leave(mem0.mutex);
  }else{
    p = sqlite3Config.m.xMalloc(n);
  }
  return p;
}

/*
** This version of the memory allocation is for use by the application.
** First make sure the memory subsystem is initialized, then do the
** allocation.
*/
void *sqlite3_malloc(int n){
#ifndef SQLITE_OMIT_AUTOINIT
  if( sqlite3_initialize() ) return 0;
#endif
  return sqlite3Malloc(n);
}

/*
** Each thread may only have a single outstanding allocation from
** xScratchMalloc().  We verify this constraint in the single-threaded
** case by setting scratchAllocOut to 1 when an allocation
** is outstanding clearing it when the allocation is freed.
*/
#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
static int scratchAllocOut = 0;
#endif


/*
** Allocate memory that is to be used and released right away.
** This routine is similar to alloca() in that it is not intended
** for situations where the memory might be held long-term.  This
** routine is intended to get memory to old large transient data
** structures that would not normally fit on the stack of an
** embedded processor.
*/
void *sqlite3ScratchMalloc(int n){
  void *p;
  assert( n>0 );

#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
  /* Verify that no more than one scratch allocation per thread
  ** is outstanding at one time.  (This is only checked in the
  ** single-threaded case since checking in the multi-threaded case
  ** would be much more complicated.) */
  assert( scratchAllocOut==0 );
#endif

  if( sqlite3Config.szScratch<n ){
    goto scratch_overflow;
  }else{  
    sqlite3_mutex_enter(mem0.mutex);
    if( mem0.nScratchFree==0 ){
      sqlite3_mutex_leave(mem0.mutex);
      goto scratch_overflow;
    }else{
      int i;
      i = mem0.aScratchFree[--mem0.nScratchFree];
      sqlite3_mutex_leave(mem0.mutex);
      i *= sqlite3Config.szScratch;
      sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_USED, 1);
      sqlite3StatusSet(SQLITE_STATUS_SCRATCH_SIZE, n);
      p = (void*)&((char*)sqlite3Config.pScratch)[i];
    }
  }
#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
  scratchAllocOut = p!=0;
#endif

  return p;

scratch_overflow:
  if( sqlite3Config.bMemstat ){
    sqlite3_mutex_enter(mem0.mutex);
    sqlite3StatusSet(SQLITE_STATUS_SCRATCH_SIZE, n);
    n = mallocWithAlarm(n, &p);
    if( p ) sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_OVERFLOW, n);
    sqlite3_mutex_leave(mem0.mutex);
  }else{
    p = sqlite3Config.m.xMalloc(n);
  }
#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
  scratchAllocOut = p!=0;
#endif
  return p;    
}
void sqlite3ScratchFree(void *p){
  if( p ){

#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
    /* Verify that no more than one scratch allocation per thread
    ** is outstanding at one time.  (This is only checked in the
    ** single-threaded case since checking in the multi-threaded case
    ** would be much more complicated.) */
    assert( scratchAllocOut==1 );
    scratchAllocOut = 0;
#endif

    if( sqlite3Config.pScratch==0
           || p<sqlite3Config.pScratch
           || p>=(void*)mem0.aScratchFree ){
      if( sqlite3Config.bMemstat ){
        int iSize = sqlite3MallocSize(p);
        sqlite3_mutex_enter(mem0.mutex);
        sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_OVERFLOW, -iSize);
        sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, -iSize);
        sqlite3Config.m.xFree(p);
        sqlite3_mutex_leave(mem0.mutex);
      }else{
        sqlite3Config.m.xFree(p);
      }
    }else{
      int i;
      i = (u8 *)p - (u8 *)sqlite3Config.pScratch;
      i /= sqlite3Config.szScratch;
      assert( i>=0 && i<sqlite3Config.nScratch );
      sqlite3_mutex_enter(mem0.mutex);
      assert( mem0.nScratchFree<sqlite3Config.nScratch );
      mem0.aScratchFree[mem0.nScratchFree++] = i;
      sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_USED, -1);
      sqlite3_mutex_leave(mem0.mutex);
    }
  }
}

/*
** Allocate memory to be used by the page cache.  Make use of the
** memory buffer provided by SQLITE_CONFIG_PAGECACHE if there is one
** and that memory is of the right size and is not completely
** consumed.  Otherwise, failover to sqlite3Malloc().
*/
void *sqlite3PageMalloc(int n){
  void *p;
  assert( n>0 );
  assert( (n & (n-1))==0 );
  assert( n>=512 && n<=32768 );

  if( sqlite3Config.szPage<n ){
    goto page_overflow;
  }else{  
    sqlite3_mutex_enter(mem0.mutex);
    if( mem0.nPageFree==0 ){
      sqlite3_mutex_leave(mem0.mutex);
      goto page_overflow;
    }else{
      int i;
      i = mem0.aPageFree[--mem0.nPageFree];
      sqlite3_mutex_leave(mem0.mutex);
      i *= sqlite3Config.szPage;
      sqlite3StatusSet(SQLITE_STATUS_PAGECACHE_SIZE, n);
      sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_USED, 1);
      p = (void*)&((char*)sqlite3Config.pPage)[i];
    }
  }
  return p;

page_overflow:
  if( sqlite3Config.bMemstat ){
    sqlite3_mutex_enter(mem0.mutex);
    sqlite3StatusSet(SQLITE_STATUS_PAGECACHE_SIZE, n);
    n = mallocWithAlarm(n, &p);
    if( p ) sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, n);
    sqlite3_mutex_leave(mem0.mutex);
  }else{
    p = sqlite3Config.m.xMalloc(n);
  }
  return p;    
}
void sqlite3PageFree(void *p){
  if( p ){
    if( sqlite3Config.pPage==0
           || p<sqlite3Config.pPage
           || p>=(void*)mem0.aPageFree ){
      /* In this case, the page allocation was obtained from a regular 
      ** call to sqlite3_mem_methods.xMalloc() (a page-cache-memory 
      ** "overflow"). Free the block with sqlite3_mem_methods.xFree().
      */
      if( sqlite3Config.bMemstat ){
        int iSize = sqlite3MallocSize(p);
        sqlite3_mutex_enter(mem0.mutex);
        sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, -iSize);
        sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, -iSize);
        sqlite3Config.m.xFree(p);
        sqlite3_mutex_leave(mem0.mutex);
      }else{
        sqlite3Config.m.xFree(p);
      }
    }else{
      /* The page allocation was allocated from the sqlite3Config.pPage
      ** buffer. In this case all that is add the index of the page in
      ** the sqlite3Config.pPage array to the set of free indexes stored
      ** in the mem0.aPageFree[] array.
      */
      int i;
      i = (u8 *)p - (u8 *)sqlite3Config.pPage;
      i /= sqlite3Config.szPage;
      assert( i>=0 && i<sqlite3Config.nPage );
      sqlite3_mutex_enter(mem0.mutex);
      assert( mem0.nPageFree<sqlite3Config.nPage );
      mem0.aPageFree[mem0.nPageFree++] = i;
      sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_USED, -1);
      sqlite3_mutex_leave(mem0.mutex);
#if !defined(NDEBUG) && 0
      /* Assert that a duplicate was not just inserted into aPageFree[]. */
      for(i=0; i<mem0.nPageFree-1; i++){
        assert( mem0.aPageFree[i]!=mem0.aPageFree[mem0.nPageFree-1] );
      }
#endif
    }
  }
}

/*
** TRUE if p is a lookaside memory allocation from db
*/
static int isLookaside(sqlite3 *db, void *p){
  return db && p && p>=db->lookaside.pStart && p<db->lookaside.pEnd;
}

/*
** Return the size of a memory allocation previously obtained from
** sqlite3Malloc() or sqlite3_malloc().
*/
int sqlite3MallocSize(void *p){
  return sqlite3Config.m.xSize(p);
}
int sqlite3DbMallocSize(sqlite3 *db, void *p){
  if( isLookaside(db, p) ){
    return db->lookaside.sz;
  }else{
    return sqlite3Config.m.xSize(p);
  }
}

/*
** Free memory previously obtained from sqlite3Malloc().
*/
void sqlite3_free(void *p){
  if( p==0 ) return;
  if( sqlite3Config.bMemstat ){
    sqlite3_mutex_enter(mem0.mutex);
    sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, -sqlite3MallocSize(p));
    sqlite3Config.m.xFree(p);
    sqlite3_mutex_leave(mem0.mutex);
  }else{
    sqlite3Config.m.xFree(p);
  }
}

/*
** Free memory that might be associated with a particular database
** connection.
*/
void sqlite3DbFree(sqlite3 *db, void *p){
  if( isLookaside(db, p) ){
    LookasideSlot *pBuf = (LookasideSlot*)p;
    pBuf->pNext = db->lookaside.pFree;
    db->lookaside.pFree = pBuf;
    db->lookaside.nOut--;
  }else{
    sqlite3_free(p);
  }
}

/*
** Change the size of an existing memory allocation
*/
void *sqlite3Realloc(void *pOld, int nBytes){
  int nOld, nNew;
  void *pNew;
  if( pOld==0 ){
    return sqlite3Malloc(nBytes);
  }
  if( nBytes<=0 ){
    sqlite3_free(pOld);
    return 0;
  }
  nOld = sqlite3MallocSize(pOld);
  if( sqlite3Config.bMemstat ){
    sqlite3_mutex_enter(mem0.mutex);
    sqlite3StatusSet(SQLITE_STATUS_MALLOC_SIZE, nBytes);
    nNew = sqlite3Config.m.xRoundup(nBytes);
    if( nOld==nNew ){
      pNew = pOld;
    }else{
      if( sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED)+nNew-nOld >= 
            mem0.alarmThreshold ){
        sqlite3MallocAlarm(nNew-nOld);
      }
      pNew = sqlite3Config.m.xRealloc(pOld, nNew);
      if( pNew==0 && mem0.alarmCallback ){
        sqlite3MallocAlarm(nBytes);
        pNew = sqlite3Config.m.xRealloc(pOld, nNew);
      }
      if( pNew ){
        nNew = sqlite3MallocSize(pNew);
        sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, nNew-nOld);
      }
    }
    sqlite3_mutex_leave(mem0.mutex);
  }else{
    pNew = sqlite3Config.m.xRealloc(pOld, nBytes);
  }
  return pNew;
}

/*
** The public interface to sqlite3Realloc.  Make sure that the memory
** subsystem is initialized prior to invoking sqliteRealloc.
*/
void *sqlite3_realloc(void *pOld, int n){
#ifndef SQLITE_OMIT_AUTOINIT
  if( sqlite3_initialize() ) return 0;
#endif
  return sqlite3Realloc(pOld, n);
}


/*
** Allocate and zero memory.
*/ 
void *sqlite3MallocZero(int n){
  void *p = sqlite3Malloc(n);
  if( p ){
    memset(p, 0, n);
  }
  return p;
}

/*
** Allocate and zero memory.  If the allocation fails, make
** the mallocFailed flag in the connection pointer.
*/
void *sqlite3DbMallocZero(sqlite3 *db, int n){
  void *p = sqlite3DbMallocRaw(db, n);
  if( p ){
    memset(p, 0, n);
  }
  return p;
}

/*
** Allocate and zero memory.  If the allocation fails, make
** the mallocFailed flag in the connection pointer.
*/
void *sqlite3DbMallocRaw(sqlite3 *db, int n){
  void *p;
  if( db ){
    LookasideSlot *pBuf;
    if( db->mallocFailed ){
      return 0;
    }
    if( db->lookaside.bEnabled && n<=db->lookaside.sz
         && (pBuf = db->lookaside.pFree)!=0 ){
      db->lookaside.pFree = pBuf->pNext;
      db->lookaside.nOut++;
      if( db->lookaside.nOut>db->lookaside.mxOut ){
        db->lookaside.mxOut = db->lookaside.nOut;
      }
      return (void*)pBuf;
    }
  }
  p = sqlite3Malloc(n);
  if( !p && db ){
    db->mallocFailed = 1;
  }
  return p;
}

/*
** Resize the block of memory pointed to by p to n bytes. If the
** resize fails, set the mallocFailed flag in the connection object.
*/
void *sqlite3DbRealloc(sqlite3 *db, void *p, int n){
  void *pNew = 0;
  if( db->mallocFailed==0 ){
    if( p==0 ){
      return sqlite3DbMallocRaw(db, n);
    }
    if( isLookaside(db, p) ){
      if( n<=db->lookaside.sz ){
        return p;
      }
      pNew = sqlite3DbMallocRaw(db, n);
      if( pNew ){
        memcpy(pNew, p, db->lookaside.sz);
        sqlite3DbFree(db, p);
      }
    }else{
      pNew = sqlite3_realloc(p, n);
      if( !pNew ){
        db->mallocFailed = 1;
      }
    }
  }
  return pNew;
}

/*
** Attempt to reallocate p.  If the reallocation fails, then free p
** and set the mallocFailed flag in the database connection.
*/
void *sqlite3DbReallocOrFree(sqlite3 *db, void *p, int n){
  void *pNew;
  pNew = sqlite3DbRealloc(db, p, n);
  if( !pNew ){
    sqlite3DbFree(db, p);
  }
  return pNew;
}

/*
** Make a copy of a string in memory obtained from sqliteMalloc(). These 
** functions call sqlite3MallocRaw() directly instead of sqliteMalloc(). This
** is because when memory debugging is turned on, these two functions are 
** called via macros that record the current file and line number in the
** ThreadData structure.
*/
char *sqlite3DbStrDup(sqlite3 *db, const char *z){
  char *zNew;
  size_t n;
  if( z==0 ){
    return 0;
  }
  n = strlen(z)+1;
  assert( (n&0x7fffffff)==n );
  zNew = sqlite3DbMallocRaw(db, (int)n);
  if( zNew ){
    memcpy(zNew, z, n);
  }
  return zNew;
}
char *sqlite3DbStrNDup(sqlite3 *db, const char *z, int n){
  char *zNew;
  if( z==0 ){
    return 0;
  }
  assert( (n&0x7fffffff)==n );
  zNew = sqlite3DbMallocRaw(db, n+1);
  if( zNew ){
    memcpy(zNew, z, n);
    zNew[n] = 0;
  }
  return zNew;
}

/*
** Create a string from the zFromat argument and the va_list that follows.
** Store the string in memory obtained from sqliteMalloc() and make *pz
** point to that string.
*/
void sqlite3SetString(char **pz, sqlite3 *db, const char *zFormat, ...){
  va_list ap;
  char *z;

  va_start(ap, zFormat);
  z = sqlite3VMPrintf(db, zFormat, ap);
  va_end(ap);
  sqlite3DbFree(db, *pz);
  *pz = z;
}


/*
** This function must be called before exiting any API function (i.e. 
** returning control to the user) that has called sqlite3_malloc or
** sqlite3_realloc.
**
** The returned value is normally a copy of the second argument to this
** function. However, if a malloc() failure has occured since the previous
** invocation SQLITE_NOMEM is returned instead. 
**
** If the first argument, db, is not NULL and a malloc() error has occured,
** then the connection error-code (the value returned by sqlite3_errcode())
** is set to SQLITE_NOMEM.
*/
int sqlite3ApiExit(sqlite3* db, int rc){
  /* If the db handle is not NULL, then we must hold the connection handle
  ** mutex here. Otherwise the read (and possible write) of db->mallocFailed 
  ** is unsafe, as is the call to sqlite3Error().
  */
  assert( !db || sqlite3_mutex_held(db->mutex) );
  if( db && db->mallocFailed ){
    sqlite3Error(db, SQLITE_NOMEM, 0);
    db->mallocFailed = 0;
    rc = SQLITE_NOMEM;
  }
  return rc & (db ? db->errMask : 0xff);
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/mem1.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*
** 2007 August 14
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains low-level memory allocation drivers for when
** SQLite will use the standard C-library malloc/realloc/free interface
** to obtain the memory it needs.
**
** This file contains implementations of the low-level memory allocation
** routines specified in the sqlite3_mem_methods object.
**
** $Id: mem1.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** This version of the memory allocator is the default.  It is
** used when no other memory allocator is specified using compile-time
** macros.
*/
#ifdef SQLITE_SYSTEM_MALLOC

/*
** Like malloc(), but remember the size of the allocation
** so that we can find it later using sqlite3MemSize().
**
** For this low-level routine, we are guaranteed that nByte>0 because
** cases of nByte<=0 will be intercepted and dealt with by higher level
** routines.
*/
static void *sqlite3MemMalloc(int nByte){
  sqlite3_int64 *p;
  assert( nByte>0 );
  nByte = (nByte+7)&~7;
  p = malloc( nByte+8 );
  if( p ){
    p[0] = nByte;
    p++;
  }
  return (void *)p;
}

/*
** Like free() but works for allocations obtained from sqlite3MemMalloc()
** or sqlite3MemRealloc().
**
** For this low-level routine, we already know that pPrior!=0 since
** cases where pPrior==0 will have been intecepted and dealt with
** by higher-level routines.
*/
static void sqlite3MemFree(void *pPrior){
  sqlite3_int64 *p = (sqlite3_int64*)pPrior;
  assert( pPrior!=0 );
  p--;
  free(p);
}

/*
** Like realloc().  Resize an allocation previously obtained from
** sqlite3MemMalloc().
**
** For this low-level interface, we know that pPrior!=0.  Cases where
** pPrior==0 while have been intercepted by higher-level routine and
** redirected to xMalloc.  Similarly, we know that nByte>0 becauses
** cases where nByte<=0 will have been intercepted by higher-level
** routines and redirected to xFree.
*/
static void *sqlite3MemRealloc(void *pPrior, int nByte){
  sqlite3_int64 *p = (sqlite3_int64*)pPrior;
  assert( pPrior!=0 && nByte>0 );
  nByte = (nByte+7)&~7;
  p = (sqlite3_int64*)pPrior;
  p--;
  p = realloc(p, nByte+8 );
  if( p ){
    p[0] = nByte;
    p++;
  }
  return (void*)p;
}

/*
** Report the allocated size of a prior return from xMalloc()
** or xRealloc().
*/
static int sqlite3MemSize(void *pPrior){
  sqlite3_int64 *p;
  if( pPrior==0 ) return 0;
  p = (sqlite3_int64*)pPrior;
  p--;
  return p[0];
}

/*
** Round up a request size to the next valid allocation size.
*/
static int sqlite3MemRoundup(int n){
  return (n+7) & ~7;
}

/*
** Initialize this module.
*/
static int sqlite3MemInit(void *NotUsed){
  return SQLITE_OK;
}

/*
** Deinitialize this module.
*/
static void sqlite3MemShutdown(void *NotUsed){
  return;
}

const sqlite3_mem_methods *sqlite3MemGetDefault(void){
  static const sqlite3_mem_methods defaultMethods = {
     sqlite3MemMalloc,
     sqlite3MemFree,
     sqlite3MemRealloc,
     sqlite3MemSize,
     sqlite3MemRoundup,
     sqlite3MemInit,
     sqlite3MemShutdown,
     0
  };
  return &defaultMethods;
}

/*
** This routine is the only routine in this file with external linkage.
**
** Populate the low-level memory allocation function pointers in
** sqlite3Config.m with pointers to the routines in this file.
*/
void sqlite3MemSetDefault(void){
  sqlite3_config(SQLITE_CONFIG_MALLOC, sqlite3MemGetDefault());
}

#endif /* SQLITE_SYSTEM_MALLOC */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































Deleted SQLite.Interop/splitsource/mem2.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
/*
** 2007 August 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains low-level memory allocation drivers for when
** SQLite will use the standard C-library malloc/realloc/free interface
** to obtain the memory it needs while adding lots of additional debugging
** information to each allocation in order to help detect and fix memory
** leaks and memory usage errors.
**
** This file contains implementations of the low-level memory allocation
** routines specified in the sqlite3_mem_methods object.
**
** $Id: mem2.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** This version of the memory allocator is used only if the
** SQLITE_MEMDEBUG macro is defined
*/
#ifdef SQLITE_MEMDEBUG

/*
** The backtrace functionality is only available with GLIBC
*/
#ifdef __GLIBC__
  extern int backtrace(void**,int);
  extern void backtrace_symbols_fd(void*const*,int,int);
#else
# define backtrace(A,B) 0
# define backtrace_symbols_fd(A,B,C)
#endif
#include <stdio.h>

/*
** Each memory allocation looks like this:
**
**  ------------------------------------------------------------------------
**  | Title |  backtrace pointers |  MemBlockHdr |  allocation |  EndGuard |
**  ------------------------------------------------------------------------
**
** The application code sees only a pointer to the allocation.  We have
** to back up from the allocation pointer to find the MemBlockHdr.  The
** MemBlockHdr tells us the size of the allocation and the number of
** backtrace pointers.  There is also a guard word at the end of the
** MemBlockHdr.
*/
struct MemBlockHdr {
  i64 iSize;                          /* Size of this allocation */
  struct MemBlockHdr *pNext, *pPrev;  /* Linked list of all unfreed memory */
  char nBacktrace;                    /* Number of backtraces on this alloc */
  char nBacktraceSlots;               /* Available backtrace slots */
  short nTitle;                       /* Bytes of title; includes '\0' */
  int iForeGuard;                     /* Guard word for sanity */
};

/*
** Guard words
*/
#define FOREGUARD 0x80F5E153
#define REARGUARD 0xE4676B53

/*
** Number of malloc size increments to track.
*/
#define NCSIZE  1000

/*
** All of the static variables used by this module are collected
** into a single structure named "mem".  This is to keep the
** static variables organized and to reduce namespace pollution
** when this module is combined with other in the amalgamation.
*/
static struct {
  
  /*
  ** Mutex to control access to the memory allocation subsystem.
  */
  sqlite3_mutex *mutex;

  /*
  ** Head and tail of a linked list of all outstanding allocations
  */
  struct MemBlockHdr *pFirst;
  struct MemBlockHdr *pLast;
  
  /*
  ** The number of levels of backtrace to save in new allocations.
  */
  int nBacktrace;
  void (*xBacktrace)(int, int, void **);

  /*
  ** Title text to insert in front of each block
  */
  int nTitle;        /* Bytes of zTitle to save.  Includes '\0' and padding */
  char zTitle[100];  /* The title text */

  /* 
  ** sqlite3MallocDisallow() increments the following counter.
  ** sqlite3MallocAllow() decrements it.
  */
  int disallow; /* Do not allow memory allocation */

  /*
  ** Gather statistics on the sizes of memory allocations.
  ** nAlloc[i] is the number of allocation attempts of i*8
  ** bytes.  i==NCSIZE is the number of allocation attempts for
  ** sizes more than NCSIZE*8 bytes.
  */
  int nAlloc[NCSIZE];      /* Total number of allocations */
  int nCurrent[NCSIZE];    /* Current number of allocations */
  int mxCurrent[NCSIZE];   /* Highwater mark for nCurrent */

} mem;


/*
** Adjust memory usage statistics
*/
static void adjustStats(int iSize, int increment){
  int i = ((iSize+7)&~7)/8;
  if( i>NCSIZE-1 ){
    i = NCSIZE - 1;
  }
  if( increment>0 ){
    mem.nAlloc[i]++;
    mem.nCurrent[i]++;
    if( mem.nCurrent[i]>mem.mxCurrent[i] ){
      mem.mxCurrent[i] = mem.nCurrent[i];
    }
  }else{
    mem.nCurrent[i]--;
    assert( mem.nCurrent[i]>=0 );
  }
}

/*
** Given an allocation, find the MemBlockHdr for that allocation.
**
** This routine checks the guards at either end of the allocation and
** if they are incorrect it asserts.
*/
static struct MemBlockHdr *sqlite3MemsysGetHeader(void *pAllocation){
  struct MemBlockHdr *p;
  int *pInt;
  u8 *pU8;
  int nReserve;

  p = (struct MemBlockHdr*)pAllocation;
  p--;
  assert( p->iForeGuard==FOREGUARD );
  nReserve = (p->iSize+7)&~7;
  pInt = (int*)pAllocation;
  pU8 = (u8*)pAllocation;
  assert( pInt[nReserve/sizeof(int)]==REARGUARD );
  assert( (nReserve-0)<=p->iSize || pU8[nReserve-1]==0x65 );
  assert( (nReserve-1)<=p->iSize || pU8[nReserve-2]==0x65 );
  assert( (nReserve-2)<=p->iSize || pU8[nReserve-3]==0x65 );
  return p;
}

/*
** Return the number of bytes currently allocated at address p.
*/
static int sqlite3MemSize(void *p){
  struct MemBlockHdr *pHdr;
  if( !p ){
    return 0;
  }
  pHdr = sqlite3MemsysGetHeader(p);
  return pHdr->iSize;
}

/*
** Initialize the memory allocation subsystem.
*/
static int sqlite3MemInit(void *NotUsed){
  if( !sqlite3Config.bMemstat ){
    /* If memory status is enabled, then the malloc.c wrapper will already
    ** hold the STATIC_MEM mutex when the routines here are invoked. */
    mem.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
  }
  return SQLITE_OK;
}

/*
** Deinitialize the memory allocation subsystem.
*/
static void sqlite3MemShutdown(void *NotUsed){
  mem.mutex = 0;
}

/*
** Round up a request size to the next valid allocation size.
*/
static int sqlite3MemRoundup(int n){
  return (n+7) & ~7;
}

/*
** Allocate nByte bytes of memory.
*/
static void *sqlite3MemMalloc(int nByte){
  struct MemBlockHdr *pHdr;
  void **pBt;
  char *z;
  int *pInt;
  void *p = 0;
  int totalSize;
  int nReserve;
  sqlite3_mutex_enter(mem.mutex);
  assert( mem.disallow==0 );
  nReserve = (nByte+7)&~7;
  totalSize = nReserve + sizeof(*pHdr) + sizeof(int) +
               mem.nBacktrace*sizeof(void*) + mem.nTitle;
  p = malloc(totalSize);
  if( p ){
    z = p;
    pBt = (void**)&z[mem.nTitle];
    pHdr = (struct MemBlockHdr*)&pBt[mem.nBacktrace];
    pHdr->pNext = 0;
    pHdr->pPrev = mem.pLast;
    if( mem.pLast ){
      mem.pLast->pNext = pHdr;
    }else{
      mem.pFirst = pHdr;
    }
    mem.pLast = pHdr;
    pHdr->iForeGuard = FOREGUARD;
    pHdr->nBacktraceSlots = mem.nBacktrace;
    pHdr->nTitle = mem.nTitle;
    if( mem.nBacktrace ){
      void *aAddr[40];
      pHdr->nBacktrace = backtrace(aAddr, mem.nBacktrace+1)-1;
      memcpy(pBt, &aAddr[1], pHdr->nBacktrace*sizeof(void*));
      if( mem.xBacktrace ){
        mem.xBacktrace(nByte, pHdr->nBacktrace-1, &aAddr[1]);
      }
    }else{
      pHdr->nBacktrace = 0;
    }
    if( mem.nTitle ){
      memcpy(z, mem.zTitle, mem.nTitle);
    }
    pHdr->iSize = nByte;
    adjustStats(nByte, +1);
    pInt = (int*)&pHdr[1];
    pInt[nReserve/sizeof(int)] = REARGUARD;
    memset(pInt, 0x65, nReserve);
    p = (void*)pInt;
  }
  sqlite3_mutex_leave(mem.mutex);
  return p; 
}

/*
** Free memory.
*/
static void sqlite3MemFree(void *pPrior){
  struct MemBlockHdr *pHdr;
  void **pBt;
  char *z;
  assert( sqlite3Config.bMemstat || mem.mutex!=0 );
  pHdr = sqlite3MemsysGetHeader(pPrior);
  pBt = (void**)pHdr;
  pBt -= pHdr->nBacktraceSlots;
  sqlite3_mutex_enter(mem.mutex);
  if( pHdr->pPrev ){
    assert( pHdr->pPrev->pNext==pHdr );
    pHdr->pPrev->pNext = pHdr->pNext;
  }else{
    assert( mem.pFirst==pHdr );
    mem.pFirst = pHdr->pNext;
  }
  if( pHdr->pNext ){
    assert( pHdr->pNext->pPrev==pHdr );
    pHdr->pNext->pPrev = pHdr->pPrev;
  }else{
    assert( mem.pLast==pHdr );
    mem.pLast = pHdr->pPrev;
  }
  z = (char*)pBt;
  z -= pHdr->nTitle;
  adjustStats(pHdr->iSize, -1);
  memset(z, 0x2b, sizeof(void*)*pHdr->nBacktraceSlots + sizeof(*pHdr) +
                  pHdr->iSize + sizeof(int) + pHdr->nTitle);
  free(z);
  sqlite3_mutex_leave(mem.mutex);  
}

/*
** Change the size of an existing memory allocation.
**
** For this debugging implementation, we *always* make a copy of the
** allocation into a new place in memory.  In this way, if the 
** higher level code is using pointer to the old allocation, it is 
** much more likely to break and we are much more liking to find
** the error.
*/
static void *sqlite3MemRealloc(void *pPrior, int nByte){
  struct MemBlockHdr *pOldHdr;
  void *pNew;
  assert( mem.disallow==0 );
  pOldHdr = sqlite3MemsysGetHeader(pPrior);
  pNew = sqlite3MemMalloc(nByte);
  if( pNew ){
    memcpy(pNew, pPrior, nByte<pOldHdr->iSize ? nByte : pOldHdr->iSize);
    if( nByte>pOldHdr->iSize ){
      memset(&((char*)pNew)[pOldHdr->iSize], 0x2b, nByte - pOldHdr->iSize);
    }
    sqlite3MemFree(pPrior);
  }
  return pNew;
}


const sqlite3_mem_methods *sqlite3MemGetDefault(void){
  static const sqlite3_mem_methods defaultMethods = {
     sqlite3MemMalloc,
     sqlite3MemFree,
     sqlite3MemRealloc,
     sqlite3MemSize,
     sqlite3MemRoundup,
     sqlite3MemInit,
     sqlite3MemShutdown,
     0
  };
  return &defaultMethods;
}

/*
** Populate the low-level memory allocation function pointers in
** sqlite3Config.m with pointers to the routines in this file.
*/
void sqlite3MemSetDefault(void){
  sqlite3_config(SQLITE_CONFIG_MALLOC, sqlite3MemGetDefault());
}

/*
** Set the number of backtrace levels kept for each allocation.
** A value of zero turns off backtracing.  The number is always rounded
** up to a multiple of 2.
*/
void sqlite3MemdebugBacktrace(int depth){
  if( depth<0 ){ depth = 0; }
  if( depth>20 ){ depth = 20; }
  depth = (depth+1)&0xfe;
  mem.nBacktrace = depth;
}

void sqlite3MemdebugBacktraceCallback(void (*xBacktrace)(int, int, void **)){
  mem.xBacktrace = xBacktrace;
}

/*
** Set the title string for subsequent allocations.
*/
void sqlite3MemdebugSettitle(const char *zTitle){
  int n = strlen(zTitle) + 1;
  sqlite3_mutex_enter(mem.mutex);
  if( n>=sizeof(mem.zTitle) ) n = sizeof(mem.zTitle)-1;
  memcpy(mem.zTitle, zTitle, n);
  mem.zTitle[n] = 0;
  mem.nTitle = (n+7)&~7;
  sqlite3_mutex_leave(mem.mutex);
}

void sqlite3MemdebugSync(){
  struct MemBlockHdr *pHdr;
  for(pHdr=mem.pFirst; pHdr; pHdr=pHdr->pNext){
    void **pBt = (void**)pHdr;
    pBt -= pHdr->nBacktraceSlots;
    mem.xBacktrace(pHdr->iSize, pHdr->nBacktrace-1, &pBt[1]);
  }
}

/*
** Open the file indicated and write a log of all unfreed memory 
** allocations into that log.
*/
void sqlite3MemdebugDump(const char *zFilename){
  FILE *out;
  struct MemBlockHdr *pHdr;
  void **pBt;
  int i;
  out = fopen(zFilename, "w");
  if( out==0 ){
    fprintf(stderr, "** Unable to output memory debug output log: %s **\n",
                    zFilename);
    return;
  }
  for(pHdr=mem.pFirst; pHdr; pHdr=pHdr->pNext){
    char *z = (char*)pHdr;
    z -= pHdr->nBacktraceSlots*sizeof(void*) + pHdr->nTitle;
    fprintf(out, "**** %lld bytes at %p from %s ****\n", 
            pHdr->iSize, &pHdr[1], pHdr->nTitle ? z : "???");
    if( pHdr->nBacktrace ){
      fflush(out);
      pBt = (void**)pHdr;
      pBt -= pHdr->nBacktraceSlots;
      backtrace_symbols_fd(pBt, pHdr->nBacktrace, fileno(out));
      fprintf(out, "\n");
    }
  }
  fprintf(out, "COUNTS:\n");
  for(i=0; i<NCSIZE-1; i++){
    if( mem.nAlloc[i] ){
      fprintf(out, "   %5d: %10d %10d %10d\n", 
            i*8, mem.nAlloc[i], mem.nCurrent[i], mem.mxCurrent[i]);
    }
  }
  if( mem.nAlloc[NCSIZE-1] ){
    fprintf(out, "   %5d: %10d %10d %10d\n",
             NCSIZE*8-8, mem.nAlloc[NCSIZE-1],
             mem.nCurrent[NCSIZE-1], mem.mxCurrent[NCSIZE-1]);
  }
  fclose(out);
}

/*
** Return the number of times sqlite3MemMalloc() has been called.
*/
int sqlite3MemdebugMallocCount(){
  int i;
  int nTotal = 0;
  for(i=0; i<NCSIZE; i++){
    nTotal += mem.nAlloc[i];
  }
  return nTotal;
}


#endif /* SQLITE_MEMDEBUG */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/mem3.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
/*
** 2007 October 14
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains the C functions that implement a memory
** allocation subsystem for use by SQLite. 
**
** This version of the memory allocation subsystem omits all
** use of malloc(). The SQLite user supplies a block of memory
** before calling sqlite3_initialize() from which allocations
** are made and returned by the xMalloc() and xRealloc() 
** implementations. Once sqlite3_initialize() has been called,
** the amount of memory available to SQLite is fixed and cannot
** be changed.
**
** This version of the memory allocation subsystem is included
** in the build only if SQLITE_ENABLE_MEMSYS3 is defined.
**
** $Id: mem3.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** This version of the memory allocator is only built into the library
** SQLITE_ENABLE_MEMSYS3 is defined. Defining this symbol does not
** mean that the library will use a memory-pool by default, just that
** it is available. The mempool allocator is activated by calling
** sqlite3_config().
*/
#ifdef SQLITE_ENABLE_MEMSYS3

/*
** Maximum size (in Mem3Blocks) of a "small" chunk.
*/
#define MX_SMALL 10


/*
** Number of freelist hash slots
*/
#define N_HASH  61

/*
** A memory allocation (also called a "chunk") consists of two or 
** more blocks where each block is 8 bytes.  The first 8 bytes are 
** a header that is not returned to the user.
**
** A chunk is two or more blocks that is either checked out or
** free.  The first block has format u.hdr.  u.hdr.size4x is 4 times the
** size of the allocation in blocks if the allocation is free.
** The u.hdr.size4x&1 bit is true if the chunk is checked out and
** false if the chunk is on the freelist.  The u.hdr.size4x&2 bit
** is true if the previous chunk is checked out and false if the
** previous chunk is free.  The u.hdr.prevSize field is the size of
** the previous chunk in blocks if the previous chunk is on the
** freelist. If the previous chunk is checked out, then
** u.hdr.prevSize can be part of the data for that chunk and should
** not be read or written.
**
** We often identify a chunk by its index in mem3.aPool[].  When
** this is done, the chunk index refers to the second block of
** the chunk.  In this way, the first chunk has an index of 1.
** A chunk index of 0 means "no such chunk" and is the equivalent
** of a NULL pointer.
**
** The second block of free chunks is of the form u.list.  The
** two fields form a double-linked list of chunks of related sizes.
** Pointers to the head of the list are stored in mem3.aiSmall[] 
** for smaller chunks and mem3.aiHash[] for larger chunks.
**
** The second block of a chunk is user data if the chunk is checked 
** out.  If a chunk is checked out, the user data may extend into
** the u.hdr.prevSize value of the following chunk.
*/
typedef struct Mem3Block Mem3Block;
struct Mem3Block {
  union {
    struct {
      u32 prevSize;   /* Size of previous chunk in Mem3Block elements */
      u32 size4x;     /* 4x the size of current chunk in Mem3Block elements */
    } hdr;
    struct {
      u32 next;       /* Index in mem3.aPool[] of next free chunk */
      u32 prev;       /* Index in mem3.aPool[] of previous free chunk */
    } list;
  } u;
};

/*
** All of the static variables used by this module are collected
** into a single structure named "mem3".  This is to keep the
** static variables organized and to reduce namespace pollution
** when this module is combined with other in the amalgamation.
*/
static struct {
  /*
  ** True if we are evaluating an out-of-memory callback.
  */
  int alarmBusy;
  
  /*
  ** Mutex to control access to the memory allocation subsystem.
  */
  sqlite3_mutex *mutex;
  
  /*
  ** The minimum amount of free space that we have seen.
  */
  u32 mnMaster;

  /*
  ** iMaster is the index of the master chunk.  Most new allocations
  ** occur off of this chunk.  szMaster is the size (in Mem3Blocks)
  ** of the current master.  iMaster is 0 if there is not master chunk.
  ** The master chunk is not in either the aiHash[] or aiSmall[].
  */
  u32 iMaster;
  u32 szMaster;

  /*
  ** Array of lists of free blocks according to the block size 
  ** for smaller chunks, or a hash on the block size for larger
  ** chunks.
  */
  u32 aiSmall[MX_SMALL-1];   /* For sizes 2 through MX_SMALL, inclusive */
  u32 aiHash[N_HASH];        /* For sizes MX_SMALL+1 and larger */

  /*
  ** Memory available for allocation. nPool is the size of the array
  ** (in Mem3Blocks) pointed to by aPool less 2.
  */
  u32 nPool;
  Mem3Block *aPool;
} mem3;

/*
** Unlink the chunk at mem3.aPool[i] from list it is currently
** on.  *pRoot is the list that i is a member of.
*/
static void memsys3UnlinkFromList(u32 i, u32 *pRoot){
  u32 next = mem3.aPool[i].u.list.next;
  u32 prev = mem3.aPool[i].u.list.prev;
  assert( sqlite3_mutex_held(mem3.mutex) );
  if( prev==0 ){
    *pRoot = next;
  }else{
    mem3.aPool[prev].u.list.next = next;
  }
  if( next ){
    mem3.aPool[next].u.list.prev = prev;
  }
  mem3.aPool[i].u.list.next = 0;
  mem3.aPool[i].u.list.prev = 0;
}

/*
** Unlink the chunk at index i from 
** whatever list is currently a member of.
*/
static void memsys3Unlink(u32 i){
  u32 size, hash;
  assert( sqlite3_mutex_held(mem3.mutex) );
  assert( (mem3.aPool[i-1].u.hdr.size4x & 1)==0 );
  assert( i>=1 );
  size = mem3.aPool[i-1].u.hdr.size4x/4;
  assert( size==mem3.aPool[i+size-1].u.hdr.prevSize );
  assert( size>=2 );
  if( size <= MX_SMALL ){
    memsys3UnlinkFromList(i, &mem3.aiSmall[size-2]);
  }else{
    hash = size % N_HASH;
    memsys3UnlinkFromList(i, &mem3.aiHash[hash]);
  }
}

/*
** Link the chunk at mem3.aPool[i] so that is on the list rooted
** at *pRoot.
*/
static void memsys3LinkIntoList(u32 i, u32 *pRoot){
  assert( sqlite3_mutex_held(mem3.mutex) );
  mem3.aPool[i].u.list.next = *pRoot;
  mem3.aPool[i].u.list.prev = 0;
  if( *pRoot ){
    mem3.aPool[*pRoot].u.list.prev = i;
  }
  *pRoot = i;
}

/*
** Link the chunk at index i into either the appropriate
** small chunk list, or into the large chunk hash table.
*/
static void memsys3Link(u32 i){
  u32 size, hash;
  assert( sqlite3_mutex_held(mem3.mutex) );
  assert( i>=1 );
  assert( (mem3.aPool[i-1].u.hdr.size4x & 1)==0 );
  size = mem3.aPool[i-1].u.hdr.size4x/4;
  assert( size==mem3.aPool[i+size-1].u.hdr.prevSize );
  assert( size>=2 );
  if( size <= MX_SMALL ){
    memsys3LinkIntoList(i, &mem3.aiSmall[size-2]);
  }else{
    hash = size % N_HASH;
    memsys3LinkIntoList(i, &mem3.aiHash[hash]);
  }
}

/*
** If the STATIC_MEM mutex is not already held, obtain it now. The mutex
** will already be held (obtained by code in malloc.c) if
** sqlite3Config.bMemStat is true.
*/
static void memsys3Enter(void){
  if( sqlite3Config.bMemstat==0 && mem3.mutex==0 ){
    mem3.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
  }
  sqlite3_mutex_enter(mem3.mutex);
}
static void memsys3Leave(void){
  sqlite3_mutex_leave(mem3.mutex);
}

/*
** Called when we are unable to satisfy an allocation of nBytes.
*/
static void memsys3OutOfMemory(int nByte){
  if( !mem3.alarmBusy ){
    mem3.alarmBusy = 1;
    assert( sqlite3_mutex_held(mem3.mutex) );
    sqlite3_mutex_leave(mem3.mutex);
    sqlite3_release_memory(nByte);
    sqlite3_mutex_enter(mem3.mutex);
    mem3.alarmBusy = 0;
  }
}


/*
** Chunk i is a free chunk that has been unlinked.  Adjust its 
** size parameters for check-out and return a pointer to the 
** user portion of the chunk.
*/
static void *memsys3Checkout(u32 i, int nBlock){
  u32 x;
  assert( sqlite3_mutex_held(mem3.mutex) );
  assert( i>=1 );
  assert( mem3.aPool[i-1].u.hdr.size4x/4==nBlock );
  assert( mem3.aPool[i+nBlock-1].u.hdr.prevSize==nBlock );
  x = mem3.aPool[i-1].u.hdr.size4x;
  mem3.aPool[i-1].u.hdr.size4x = nBlock*4 | 1 | (x&2);
  mem3.aPool[i+nBlock-1].u.hdr.prevSize = nBlock;
  mem3.aPool[i+nBlock-1].u.hdr.size4x |= 2;
  return &mem3.aPool[i];
}

/*
** Carve a piece off of the end of the mem3.iMaster free chunk.
** Return a pointer to the new allocation.  Or, if the master chunk
** is not large enough, return 0.
*/
static void *memsys3FromMaster(int nBlock){
  assert( sqlite3_mutex_held(mem3.mutex) );
  assert( mem3.szMaster>=nBlock );
  if( nBlock>=mem3.szMaster-1 ){
    /* Use the entire master */
    void *p = memsys3Checkout(mem3.iMaster, mem3.szMaster);
    mem3.iMaster = 0;
    mem3.szMaster = 0;
    mem3.mnMaster = 0;
    return p;
  }else{
    /* Split the master block.  Return the tail. */
    u32 newi, x;
    newi = mem3.iMaster + mem3.szMaster - nBlock;
    assert( newi > mem3.iMaster+1 );
    mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = nBlock;
    mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x |= 2;
    mem3.aPool[newi-1].u.hdr.size4x = nBlock*4 + 1;
    mem3.szMaster -= nBlock;
    mem3.aPool[newi-1].u.hdr.prevSize = mem3.szMaster;
    x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2;
    mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x;
    if( mem3.szMaster < mem3.mnMaster ){
      mem3.mnMaster = mem3.szMaster;
    }
    return (void*)&mem3.aPool[newi];
  }
}

/*
** *pRoot is the head of a list of free chunks of the same size
** or same size hash.  In other words, *pRoot is an entry in either
** mem3.aiSmall[] or mem3.aiHash[].  
**
** This routine examines all entries on the given list and tries
** to coalesce each entries with adjacent free chunks.  
**
** If it sees a chunk that is larger than mem3.iMaster, it replaces 
** the current mem3.iMaster with the new larger chunk.  In order for
** this mem3.iMaster replacement to work, the master chunk must be
** linked into the hash tables.  That is not the normal state of
** affairs, of course.  The calling routine must link the master
** chunk before invoking this routine, then must unlink the (possibly
** changed) master chunk once this routine has finished.
*/
static void memsys3Merge(u32 *pRoot){
  u32 iNext, prev, size, i, x;

  assert( sqlite3_mutex_held(mem3.mutex) );
  for(i=*pRoot; i>0; i=iNext){
    iNext = mem3.aPool[i].u.list.next;
    size = mem3.aPool[i-1].u.hdr.size4x;
    assert( (size&1)==0 );
    if( (size&2)==0 ){
      memsys3UnlinkFromList(i, pRoot);
      assert( i > mem3.aPool[i-1].u.hdr.prevSize );
      prev = i - mem3.aPool[i-1].u.hdr.prevSize;
      if( prev==iNext ){
        iNext = mem3.aPool[prev].u.list.next;
      }
      memsys3Unlink(prev);
      size = i + size/4 - prev;
      x = mem3.aPool[prev-1].u.hdr.size4x & 2;
      mem3.aPool[prev-1].u.hdr.size4x = size*4 | x;
      mem3.aPool[prev+size-1].u.hdr.prevSize = size;
      memsys3Link(prev);
      i = prev;
    }else{
      size /= 4;
    }
    if( size>mem3.szMaster ){
      mem3.iMaster = i;
      mem3.szMaster = size;
    }
  }
}

/*
** Return a block of memory of at least nBytes in size.
** Return NULL if unable.
**
** This function assumes that the necessary mutexes, if any, are
** already held by the caller. Hence "Unsafe".
*/
static void *memsys3MallocUnsafe(int nByte){
  u32 i;
  int nBlock;
  int toFree;

  assert( sqlite3_mutex_held(mem3.mutex) );
  assert( sizeof(Mem3Block)==8 );
  if( nByte<=12 ){
    nBlock = 2;
  }else{
    nBlock = (nByte + 11)/8;
  }
  assert( nBlock>=2 );

  /* STEP 1:
  ** Look for an entry of the correct size in either the small
  ** chunk table or in the large chunk hash table.  This is
  ** successful most of the time (about 9 times out of 10).
  */
  if( nBlock <= MX_SMALL ){
    i = mem3.aiSmall[nBlock-2];
    if( i>0 ){
      memsys3UnlinkFromList(i, &mem3.aiSmall[nBlock-2]);
      return memsys3Checkout(i, nBlock);
    }
  }else{
    int hash = nBlock % N_HASH;
    for(i=mem3.aiHash[hash]; i>0; i=mem3.aPool[i].u.list.next){
      if( mem3.aPool[i-1].u.hdr.size4x/4==nBlock ){
        memsys3UnlinkFromList(i, &mem3.aiHash[hash]);
        return memsys3Checkout(i, nBlock);
      }
    }
  }

  /* STEP 2:
  ** Try to satisfy the allocation by carving a piece off of the end
  ** of the master chunk.  This step usually works if step 1 fails.
  */
  if( mem3.szMaster>=nBlock ){
    return memsys3FromMaster(nBlock);
  }


  /* STEP 3:  
  ** Loop through the entire memory pool.  Coalesce adjacent free
  ** chunks.  Recompute the master chunk as the largest free chunk.
  ** Then try again to satisfy the allocation by carving a piece off
  ** of the end of the master chunk.  This step happens very
  ** rarely (we hope!)
  */
  for(toFree=nBlock*16; toFree<(mem3.nPool*16); toFree *= 2){
    memsys3OutOfMemory(toFree);
    if( mem3.iMaster ){
      memsys3Link(mem3.iMaster);
      mem3.iMaster = 0;
      mem3.szMaster = 0;
    }
    for(i=0; i<N_HASH; i++){
      memsys3Merge(&mem3.aiHash[i]);
    }
    for(i=0; i<MX_SMALL-1; i++){
      memsys3Merge(&mem3.aiSmall[i]);
    }
    if( mem3.szMaster ){
      memsys3Unlink(mem3.iMaster);
      if( mem3.szMaster>=nBlock ){
        return memsys3FromMaster(nBlock);
      }
    }
  }

  /* If none of the above worked, then we fail. */
  return 0;
}

/*
** Free an outstanding memory allocation.
**
** This function assumes that the necessary mutexes, if any, are
** already held by the caller. Hence "Unsafe".
*/
void memsys3FreeUnsafe(void *pOld){
  Mem3Block *p = (Mem3Block*)pOld;
  int i;
  u32 size, x;
  assert( sqlite3_mutex_held(mem3.mutex) );
  assert( p>mem3.aPool && p<&mem3.aPool[mem3.nPool] );
  i = p - mem3.aPool;
  assert( (mem3.aPool[i-1].u.hdr.size4x&1)==1 );
  size = mem3.aPool[i-1].u.hdr.size4x/4;
  assert( i+size<=mem3.nPool+1 );
  mem3.aPool[i-1].u.hdr.size4x &= ~1;
  mem3.aPool[i+size-1].u.hdr.prevSize = size;
  mem3.aPool[i+size-1].u.hdr.size4x &= ~2;
  memsys3Link(i);

  /* Try to expand the master using the newly freed chunk */
  if( mem3.iMaster ){
    while( (mem3.aPool[mem3.iMaster-1].u.hdr.size4x&2)==0 ){
      size = mem3.aPool[mem3.iMaster-1].u.hdr.prevSize;
      mem3.iMaster -= size;
      mem3.szMaster += size;
      memsys3Unlink(mem3.iMaster);
      x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2;
      mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x;
      mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = mem3.szMaster;
    }
    x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2;
    while( (mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x&1)==0 ){
      memsys3Unlink(mem3.iMaster+mem3.szMaster);
      mem3.szMaster += mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x/4;
      mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x;
      mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = mem3.szMaster;
    }
  }
}

/*
** Return the size of an outstanding allocation, in bytes.  The
** size returned omits the 8-byte header overhead.  This only
** works for chunks that are currently checked out.
*/
static int memsys3Size(void *p){
  Mem3Block *pBlock;
  if( p==0 ) return 0;
  pBlock = (Mem3Block*)p;
  assert( (pBlock[-1].u.hdr.size4x&1)!=0 );
  return (pBlock[-1].u.hdr.size4x&~3)*2 - 4;
}

/*
** Round up a request size to the next valid allocation size.
*/
static int memsys3Roundup(int n){
  if( n<=12 ){
    return 12;
  }else{
    return ((n+11)&~7) - 4;
  }
}

/*
** Allocate nBytes of memory.
*/
static void *memsys3Malloc(int nBytes){
  sqlite3_int64 *p;
  assert( nBytes>0 );          /* malloc.c filters out 0 byte requests */
  memsys3Enter();
  p = memsys3MallocUnsafe(nBytes);
  memsys3Leave();
  return (void*)p; 
}

/*
** Free memory.
*/
void memsys3Free(void *pPrior){
  assert( pPrior );
  memsys3Enter();
  memsys3FreeUnsafe(pPrior);
  memsys3Leave();
}

/*
** Change the size of an existing memory allocation
*/
void *memsys3Realloc(void *pPrior, int nBytes){
  int nOld;
  void *p;
  if( pPrior==0 ){
    return sqlite3_malloc(nBytes);
  }
  if( nBytes<=0 ){
    sqlite3_free(pPrior);
    return 0;
  }
  nOld = memsys3Size(pPrior);
  if( nBytes<=nOld && nBytes>=nOld-128 ){
    return pPrior;
  }
  memsys3Enter();
  p = memsys3MallocUnsafe(nBytes);
  if( p ){
    if( nOld<nBytes ){
      memcpy(p, pPrior, nOld);
    }else{
      memcpy(p, pPrior, nBytes);
    }
    memsys3FreeUnsafe(pPrior);
  }
  memsys3Leave();
  return p;
}

/*
** Initialize this module.
*/
static int memsys3Init(void *NotUsed){
  if( !sqlite3Config.pHeap ){
    return SQLITE_ERROR;
  }

  /* Store a pointer to the memory block in global structure mem3. */
  assert( sizeof(Mem3Block)==8 );
  mem3.aPool = (Mem3Block *)sqlite3Config.pHeap;
  mem3.nPool = (sqlite3Config.nHeap / sizeof(Mem3Block)) - 2;

  /* Initialize the master block. */
  mem3.szMaster = mem3.nPool;
  mem3.mnMaster = mem3.szMaster;
  mem3.iMaster = 1;
  mem3.aPool[0].u.hdr.size4x = (mem3.szMaster<<2) + 2;
  mem3.aPool[mem3.nPool].u.hdr.prevSize = mem3.nPool;
  mem3.aPool[mem3.nPool].u.hdr.size4x = 1;

  return SQLITE_OK;
}

/*
** Deinitialize this module.
*/
static void memsys3Shutdown(void *NotUsed){
  return;
}



/*
** Open the file indicated and write a log of all unfreed memory 
** allocations into that log.
*/
#ifdef SQLITE_DEBUG
void sqlite3Memsys3Dump(const char *zFilename){
  FILE *out;
  int i, j;
  u32 size;
  if( zFilename==0 || zFilename[0]==0 ){
    out = stdout;
  }else{
    out = fopen(zFilename, "w");
    if( out==0 ){
      fprintf(stderr, "** Unable to output memory debug output log: %s **\n",
                      zFilename);
      return;
    }
  }
  memsys3Enter();
  fprintf(out, "CHUNKS:\n");
  for(i=1; i<=mem3.nPool; i+=size/4){
    size = mem3.aPool[i-1].u.hdr.size4x;
    if( size/4<=1 ){
      fprintf(out, "%p size error\n", &mem3.aPool[i]);
      assert( 0 );
      break;
    }
    if( (size&1)==0 && mem3.aPool[i+size/4-1].u.hdr.prevSize!=size/4 ){
      fprintf(out, "%p tail size does not match\n", &mem3.aPool[i]);
      assert( 0 );
      break;
    }
    if( ((mem3.aPool[i+size/4-1].u.hdr.size4x&2)>>1)!=(size&1) ){
      fprintf(out, "%p tail checkout bit is incorrect\n", &mem3.aPool[i]);
      assert( 0 );
      break;
    }
    if( size&1 ){
      fprintf(out, "%p %6d bytes checked out\n", &mem3.aPool[i], (size/4)*8-8);
    }else{
      fprintf(out, "%p %6d bytes free%s\n", &mem3.aPool[i], (size/4)*8-8,
                  i==mem3.iMaster ? " **master**" : "");
    }
  }
  for(i=0; i<MX_SMALL-1; i++){
    if( mem3.aiSmall[i]==0 ) continue;
    fprintf(out, "small(%2d):", i);
    for(j = mem3.aiSmall[i]; j>0; j=mem3.aPool[j].u.list.next){
      fprintf(out, " %p(%d)", &mem3.aPool[j],
              (mem3.aPool[j-1].u.hdr.size4x/4)*8-8);
    }
    fprintf(out, "\n"); 
  }
  for(i=0; i<N_HASH; i++){
    if( mem3.aiHash[i]==0 ) continue;
    fprintf(out, "hash(%2d):", i);
    for(j = mem3.aiHash[i]; j>0; j=mem3.aPool[j].u.list.next){
      fprintf(out, " %p(%d)", &mem3.aPool[j],
              (mem3.aPool[j-1].u.hdr.size4x/4)*8-8);
    }
    fprintf(out, "\n"); 
  }
  fprintf(out, "master=%d\n", mem3.iMaster);
  fprintf(out, "nowUsed=%d\n", mem3.nPool*8 - mem3.szMaster*8);
  fprintf(out, "mxUsed=%d\n", mem3.nPool*8 - mem3.mnMaster*8);
  sqlite3_mutex_leave(mem3.mutex);
  if( out==stdout ){
    fflush(stdout);
  }else{
    fclose(out);
  }
}
#endif

/*
** This routine is the only routine in this file with external 
** linkage.
**
** Populate the low-level memory allocation function pointers in
** sqlite3Config.m with pointers to the routines in this file. The
** arguments specify the block of memory to manage.
**
** This routine is only called by sqlite3_config(), and therefore
** is not required to be threadsafe (it is not).
*/
const sqlite3_mem_methods *sqlite3MemGetMemsys3(void){
  static const sqlite3_mem_methods mempoolMethods = {
     memsys3Malloc,
     memsys3Free,
     memsys3Realloc,
     memsys3Size,
     memsys3Roundup,
     memsys3Init,
     memsys3Shutdown,
     0
  };
  return &mempoolMethods;
}

#endif /* SQLITE_ENABLE_MEMSYS3 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/mem4.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
/*
** 2007 August 14
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains the C functions that implement a memory
** allocation subsystem for use by SQLite.  
**
** $Id: mem4.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** This version of the memory allocator attempts to obtain memory
** from mmap() if the size of the allocation is close to the size
** of a virtual memory page.  If the size of the allocation is different
** from the virtual memory page size, then ordinary malloc() is used.
** Ordinary malloc is also used if space allocated to mmap() is
** exhausted.
**
** Enable this memory allocation by compiling with -DSQLITE_MMAP_HEAP_SIZE=nnn
** where nnn is the maximum number of bytes of mmap-ed memory you want 
** to support.   This module may choose to use less memory than requested.
**
*/
#ifdef SQLITE_MMAP_HEAP_SIZE

/*
** This is a test version of the memory allocator that attempts to
** use mmap() and madvise() for allocations and frees of approximately
** the virtual memory page size.
*/
#include <sys/types.h>
#include <sys/mman.h>
#include <errno.h>
#include <unistd.h>


/*
** All of the static variables used by this module are collected
** into a single structure named "mem".  This is to keep the
** static variables organized and to reduce namespace pollution
** when this module is combined with other in the amalgamation.
*/
static struct {
  /*
  ** The alarm callback and its arguments.  The mem.mutex lock will
  ** be held while the callback is running.  Recursive calls into
  ** the memory subsystem are allowed, but no new callbacks will be
  ** issued.  The alarmBusy variable is set to prevent recursive
  ** callbacks.
  */
  sqlite3_int64 alarmThreshold;
  void (*alarmCallback)(void*, sqlite3_int64,int);
  void *alarmArg;
  int alarmBusy;
  
  /*
  ** Mutex to control access to the memory allocation subsystem.
  */
  sqlite3_mutex *mutex;
  
  /*
  ** Current allocation and high-water mark.
  */
  sqlite3_int64 nowUsed;
  sqlite3_int64 mxUsed;

  /*
  ** Current allocation and high-water marks for mmap allocated memory.
  */
  sqlite3_int64 nowUsedMMap;
  sqlite3_int64 mxUsedMMap;

  /*
  ** Size of a single mmap page.  Obtained from sysconf().
  */
  int szPage;
  int mnPage;

  /*
  ** The number of available mmap pages.
  */
  int nPage;

  /*
  ** Index of the first free page.  0 means no pages have been freed.
  */
  int firstFree;

  /* First unused page on the top of the heap.
  */
  int firstUnused;

  /*
  ** Bulk memory obtained from from mmap().
  */
  char *mmapHeap;   /* first byte of the heap */ 

} mem;


/*
** Enter the mutex mem.mutex. Allocate it if it is not already allocated.
** The mmap() region is initialized the first time this routine is called.
*/
static void memsys4Enter(void){
  if( mem.mutex==0 ){
    mem.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
  }
  sqlite3_mutex_enter(mem.mutex);
}

/*
** Attempt to free memory to the mmap heap.  This only works if
** the pointer p is within the range of memory addresses that
** comprise the mmap heap.  Return 1 if the memory was freed
** successfully.  Return 0 if the pointer is out of range.
*/
static int mmapFree(void *p){
  char *z;
  int idx, *a;
  if( mem.mmapHeap==MAP_FAILED || mem.nPage==0 ){
    return 0;
  }
  z = (char*)p;
  idx = (z - mem.mmapHeap)/mem.szPage;
  if( idx<1 || idx>=mem.nPage ){
    return 0;
  }
  a = (int*)mem.mmapHeap;
  a[idx] = a[mem.firstFree];
  mem.firstFree = idx;
  mem.nowUsedMMap -= mem.szPage;
  madvise(p, mem.szPage, MADV_DONTNEED);
  return 1;
}

/*
** Attempt to allocate nBytes from the mmap heap.  Return a pointer
** to the allocated page.  Or, return NULL if the allocation fails.
** 
** The allocation will fail if nBytes is not the right size.
** Or, the allocation will fail if the mmap heap has been exhausted.
*/
static void *mmapAlloc(int nBytes){
  int idx = 0;
  if( nBytes>mem.szPage || nBytes<mem.mnPage ){
    return 0;
  }
  if( mem.nPage==0 ){
    mem.szPage = sysconf(_SC_PAGE_SIZE);
    mem.mnPage = mem.szPage - mem.szPage/10;
    mem.nPage = SQLITE_MMAP_HEAP_SIZE/mem.szPage;
    if( mem.nPage * sizeof(int) > mem.szPage ){
      mem.nPage = mem.szPage/sizeof(int);
    }
    mem.mmapHeap =  mmap(0, mem.szPage*mem.nPage, PROT_WRITE|PROT_READ,
                         MAP_ANONYMOUS|MAP_SHARED, -1, 0);
    if( mem.mmapHeap==MAP_FAILED ){
      mem.firstUnused = errno;
    }else{
      mem.firstUnused = 1;
      mem.nowUsedMMap = mem.szPage;
    }
  }
  if( mem.mmapHeap==MAP_FAILED ){
    return 0;
  }
  if( mem.firstFree ){
    int idx = mem.firstFree;
    int *a = (int*)mem.mmapHeap;
    mem.firstFree = a[idx];
  }else if( mem.firstUnused<mem.nPage ){
    idx = mem.firstUnused++;
  }
  if( idx ){
    mem.nowUsedMMap += mem.szPage;
    if( mem.nowUsedMMap>mem.mxUsedMMap ){
      mem.mxUsedMMap = mem.nowUsedMMap;
    }
    return (void*)&mem.mmapHeap[idx*mem.szPage];
  }else{
    return 0;
  }
}

/*
** Release the mmap-ed memory region if it is currently allocated and
** is not in use.
*/
static void mmapUnmap(void){
  if( mem.mmapHeap==MAP_FAILED ) return;
  if( mem.nPage==0 ) return;
  if( mem.nowUsedMMap>mem.szPage ) return;
  munmap(mem.mmapHeap, mem.nPage*mem.szPage);
  mem.nowUsedMMap = 0;
  mem.nPage = 0;
}
    

/*
** Return the amount of memory currently checked out.
*/
sqlite3_int64 sqlite3_memory_used(void){
  sqlite3_int64 n;
  memsys4Enter();
  n = mem.nowUsed + mem.nowUsedMMap;
  sqlite3_mutex_leave(mem.mutex);  
  return n;
}

/*
** Return the maximum amount of memory that has ever been
** checked out since either the beginning of this process
** or since the most recent reset.
*/
sqlite3_int64 sqlite3_memory_highwater(int resetFlag){
  sqlite3_int64 n;
  memsys4Enter();
  n = mem.mxUsed + mem.mxUsedMMap;
  if( resetFlag ){
    mem.mxUsed = mem.nowUsed;
    mem.mxUsedMMap = mem.nowUsedMMap;
  }
  sqlite3_mutex_leave(mem.mutex);  
  return n;
}

/*
** Change the alarm callback
*/
int sqlite3_memory_alarm(
  void(*xCallback)(void *pArg, sqlite3_int64 used,int N),
  void *pArg,
  sqlite3_int64 iThreshold
){
  memsys4Enter();
  mem.alarmCallback = xCallback;
  mem.alarmArg = pArg;
  mem.alarmThreshold = iThreshold;
  sqlite3_mutex_leave(mem.mutex);
  return SQLITE_OK;
}

/*
** Trigger the alarm 
*/
static void sqlite3MemsysAlarm(int nByte){
  void (*xCallback)(void*,sqlite3_int64,int);
  sqlite3_int64 nowUsed;
  void *pArg;
  if( mem.alarmCallback==0 || mem.alarmBusy  ) return;
  mem.alarmBusy = 1;
  xCallback = mem.alarmCallback;
  nowUsed = mem.nowUsed;
  pArg = mem.alarmArg;
  sqlite3_mutex_leave(mem.mutex);
  xCallback(pArg, nowUsed, nByte);
  sqlite3_mutex_enter(mem.mutex);
  mem.alarmBusy = 0;
}

/*
** Allocate nBytes of memory
*/
static void *memsys4Malloc(int nBytes){
  sqlite3_int64 *p = 0;
  if( mem.alarmCallback!=0
         && mem.nowUsed+mem.nowUsedMMap+nBytes>=mem.alarmThreshold ){
    sqlite3MemsysAlarm(nBytes);
  }
  if( (p = mmapAlloc(nBytes))==0 ){
    p = malloc(nBytes+8);
    if( p==0 ){
      sqlite3MemsysAlarm(nBytes);
      p = malloc(nBytes+8);
    }
    if( p ){
      p[0] = nBytes;
      p++;
      mem.nowUsed += nBytes;
      if( mem.nowUsed>mem.mxUsed ){
        mem.mxUsed = mem.nowUsed;
      }
    }
  }
  return (void*)p; 
}

/*
** Return the size of a memory allocation
*/
static int memsys4Size(void *pPrior){
  char *z = (char*)pPrior;
  int idx = mem.nPage ? (z - mem.mmapHeap)/mem.szPage : 0;
  int nByte;
  if( idx>=1 && idx<mem.nPage ){
    nByte = mem.szPage;
  }else{
    sqlite3_int64 *p = pPrior;
    p--;
    nByte = (int)*p;
  }
  return nByte;
}

/*
** Free memory.
*/
static void memsys4Free(void *pPrior){
  sqlite3_int64 *p;
  int nByte;
  if( mmapFree(pPrior)==0 ){
    p = pPrior;
    p--;
    nByte = (int)*p;
    mem.nowUsed -= nByte;
    free(p);
    if( mem.nowUsed==0 ){
      mmapUnmap();
    }      
  }
}

/*
** Allocate nBytes of memory
*/
void *sqlite3_malloc(int nBytes){
  sqlite3_int64 *p = 0;
  if( nBytes>0 ){
    memsys4Enter();
    p = memsys4Malloc(nBytes);
    sqlite3_mutex_leave(mem.mutex);
  }
  return (void*)p; 
}

/*
** Free memory.
*/
void sqlite3_free(void *pPrior){
  if( pPrior==0 ){
    return;
  }
  assert( mem.mutex!=0 );
  sqlite3_mutex_enter(mem.mutex);
  memsys4Free(pPrior);
  sqlite3_mutex_leave(mem.mutex);  
}



/*
** Change the size of an existing memory allocation
*/
void *sqlite3_realloc(void *pPrior, int nBytes){
  int nOld;
  sqlite3_int64 *p;
  if( pPrior==0 ){
    return sqlite3_malloc(nBytes);
  }
  if( nBytes<=0 ){
    sqlite3_free(pPrior);
    return 0;
  }
  nOld = memsys4Size(pPrior);
  if( nBytes<=nOld && nBytes>=nOld-128 ){
    return pPrior;
  }
  assert( mem.mutex!=0 );
  sqlite3_mutex_enter(mem.mutex);
  p = memsys4Malloc(nBytes);
  if( p ){
    if( nOld<nBytes ){
      memcpy(p, pPrior, nOld);
    }else{
      memcpy(p, pPrior, nBytes);
    }
    memsys4Free(pPrior);
  }
  assert( mem.mutex!=0 );
  sqlite3_mutex_leave(mem.mutex);
  return (void*)p;
}

#endif /* SQLITE_MMAP_HEAP_SIZE */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/mem5.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
/*
** 2007 October 14
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains the C functions that implement a memory
** allocation subsystem for use by SQLite. 
**
** This version of the memory allocation subsystem omits all
** use of malloc(). The SQLite user supplies a block of memory
** before calling sqlite3_initialize() from which allocations
** are made and returned by the xMalloc() and xRealloc() 
** implementations. Once sqlite3_initialize() has been called,
** the amount of memory available to SQLite is fixed and cannot
** be changed.
**
** This version of the memory allocation subsystem is included
** in the build only if SQLITE_ENABLE_MEMSYS5 is defined.
**
** $Id: mem5.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** This version of the memory allocator is used only when 
** SQLITE_POW2_MEMORY_SIZE is defined.
*/
#ifdef SQLITE_ENABLE_MEMSYS5

/*
** Log2 of the minimum size of an allocation.  For example, if
** 4 then all allocations will be rounded up to at least 16 bytes.
** If 5 then all allocations will be rounded up to at least 32 bytes.
*/
#ifndef SQLITE_POW2_LOGMIN
# define SQLITE_POW2_LOGMIN 6
#endif

/*
** Log2 of the maximum size of an allocation.
*/
#ifndef SQLITE_POW2_LOGMAX
# define SQLITE_POW2_LOGMAX 20
#endif
#define POW2_MAX (((unsigned int)1)<<SQLITE_POW2_LOGMAX)

/*
** Number of distinct allocation sizes.
*/
#define NSIZE (SQLITE_POW2_LOGMAX - SQLITE_POW2_LOGMIN + 1)

/*
** A minimum allocation is an instance of the following structure.
** Larger allocations are an array of these structures where the
** size of the array is a power of 2.
*/
typedef struct Mem5Link Mem5Link;
struct Mem5Link {
  int next;       /* Index of next free chunk */
  int prev;       /* Index of previous free chunk */
};

/*
** Maximum size of any allocation is ((1<<LOGMAX)*mem5.nAtom). Since
** mem5.nAtom is always at least 8, this is not really a practical
** limitation.
*/
#define LOGMAX 30

/*
** Masks used for mem5.aCtrl[] elements.
*/
#define CTRL_LOGSIZE  0x1f    /* Log2 Size of this block relative to POW2_MIN */
#define CTRL_FREE     0x20    /* True if not checked out */

/*
** All of the static variables used by this module are collected
** into a single structure named "mem5".  This is to keep the
** static variables organized and to reduce namespace pollution
** when this module is combined with other in the amalgamation.
*/
static struct {
  /*
  ** The alarm callback and its arguments.  The mem5.mutex lock will
  ** be held while the callback is running.  Recursive calls into
  ** the memory subsystem are allowed, but no new callbacks will be
  ** issued.  The alarmBusy variable is set to prevent recursive
  ** callbacks.
  */
  sqlite3_int64 alarmThreshold;
  void (*alarmCallback)(void*, sqlite3_int64,int);
  void *alarmArg;
  int alarmBusy;
  
  /*
  ** Mutex to control access to the memory allocation subsystem.
  */
  sqlite3_mutex *mutex;

  /*
  ** Performance statistics
  */
  u64 nAlloc;         /* Total number of calls to malloc */
  u64 totalAlloc;     /* Total of all malloc calls - includes internal frag */
  u64 totalExcess;    /* Total internal fragmentation */
  u32 currentOut;     /* Current checkout, including internal fragmentation */
  u32 currentCount;   /* Current number of distinct checkouts */
  u32 maxOut;         /* Maximum instantaneous currentOut */
  u32 maxCount;       /* Maximum instantaneous currentCount */
  u32 maxRequest;     /* Largest allocation (exclusive of internal frag) */
  
  /*
  ** Lists of free blocks of various sizes.
  */
  int aiFreelist[LOGMAX+1];

  /*
  ** Space for tracking which blocks are checked out and the size
  ** of each block.  One byte per block.
  */
  u8 *aCtrl;

  /*
  ** Memory available for allocation
  */
  int nAtom;       /* Smallest possible allocation in bytes */
  int nBlock;      /* Number of nAtom sized blocks in zPool */
  u8 *zPool;
} mem5;

#define MEM5LINK(idx) ((Mem5Link *)(&mem5.zPool[(idx)*mem5.nAtom]))

/*
** Unlink the chunk at mem5.aPool[i] from list it is currently
** on.  It should be found on mem5.aiFreelist[iLogsize].
*/
static void memsys5Unlink(int i, int iLogsize){
  int next, prev;
  assert( i>=0 && i<mem5.nBlock );
  assert( iLogsize>=0 && iLogsize<=LOGMAX );
  assert( (mem5.aCtrl[i] & CTRL_LOGSIZE)==iLogsize );

  next = MEM5LINK(i)->next;
  prev = MEM5LINK(i)->prev;
  if( prev<0 ){
    mem5.aiFreelist[iLogsize] = next;
  }else{
    MEM5LINK(prev)->next = next;
  }
  if( next>=0 ){
    MEM5LINK(next)->prev = prev;
  }
}

/*
** Link the chunk at mem5.aPool[i] so that is on the iLogsize
** free list.
*/
static void memsys5Link(int i, int iLogsize){
  int x;
  assert( sqlite3_mutex_held(mem5.mutex) );
  assert( i>=0 && i<mem5.nBlock );
  assert( iLogsize>=0 && iLogsize<=LOGMAX );
  assert( (mem5.aCtrl[i] & CTRL_LOGSIZE)==iLogsize );

  x = MEM5LINK(i)->next = mem5.aiFreelist[iLogsize];
  MEM5LINK(i)->prev = -1;
  if( x>=0 ){
    assert( x<mem5.nBlock );
    MEM5LINK(x)->prev = i;
  }
  mem5.aiFreelist[iLogsize] = i;
}

/*
** If the STATIC_MEM mutex is not already held, obtain it now. The mutex
** will already be held (obtained by code in malloc.c) if
** sqlite3Config.bMemStat is true.
*/
static void memsys5Enter(void){
  if( sqlite3Config.bMemstat==0 && mem5.mutex==0 ){
    mem5.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
  }
  sqlite3_mutex_enter(mem5.mutex);
}
static void memsys5Leave(void){
  sqlite3_mutex_leave(mem5.mutex);
}

/*
** Return the size of an outstanding allocation, in bytes.  The
** size returned omits the 8-byte header overhead.  This only
** works for chunks that are currently checked out.
*/
static int memsys5Size(void *p){
  int iSize = 0;
  if( p ){
    int i = ((u8 *)p-mem5.zPool)/mem5.nAtom;
    assert( i>=0 && i<mem5.nBlock );
    iSize = mem5.nAtom * (1 << (mem5.aCtrl[i]&CTRL_LOGSIZE));
  }
  return iSize;
}

/*
** Find the first entry on the freelist iLogsize.  Unlink that
** entry and return its index. 
*/
static int memsys5UnlinkFirst(int iLogsize){
  int i;
  int iFirst;

  assert( iLogsize>=0 && iLogsize<=LOGMAX );
  i = iFirst = mem5.aiFreelist[iLogsize];
  assert( iFirst>=0 );
  while( i>0 ){
    if( i<iFirst ) iFirst = i;
    i = MEM5LINK(i)->next;
  }
  memsys5Unlink(iFirst, iLogsize);
  return iFirst;
}

/*
** Return a block of memory of at least nBytes in size.
** Return NULL if unable.
*/
static void *memsys5MallocUnsafe(int nByte){
  int i;           /* Index of a mem5.aPool[] slot */
  int iBin;        /* Index into mem5.aiFreelist[] */
  int iFullSz;     /* Size of allocation rounded up to power of 2 */
  int iLogsize;    /* Log2 of iFullSz/POW2_MIN */

  /* Keep track of the maximum allocation request.  Even unfulfilled
  ** requests are counted */
  if( nByte>mem5.maxRequest ){
    mem5.maxRequest = nByte;
  }

  /* Round nByte up to the next valid power of two */
  if( nByte>POW2_MAX ) return 0;
  for(iFullSz=mem5.nAtom, iLogsize=0; iFullSz<nByte; iFullSz *= 2, iLogsize++){}

  /* Make sure mem5.aiFreelist[iLogsize] contains at least one free
  ** block.  If not, then split a block of the next larger power of
  ** two in order to create a new free block of size iLogsize.
  */
  for(iBin=iLogsize; mem5.aiFreelist[iBin]<0 && iBin<=LOGMAX; iBin++){}
  if( iBin>LOGMAX ) return 0;
  i = memsys5UnlinkFirst(iBin);
  while( iBin>iLogsize ){
    int newSize;

    iBin--;
    newSize = 1 << iBin;
    mem5.aCtrl[i+newSize] = CTRL_FREE | iBin;
    memsys5Link(i+newSize, iBin);
  }
  mem5.aCtrl[i] = iLogsize;

  /* Update allocator performance statistics. */
  mem5.nAlloc++;
  mem5.totalAlloc += iFullSz;
  mem5.totalExcess += iFullSz - nByte;
  mem5.currentCount++;
  mem5.currentOut += iFullSz;
  if( mem5.maxCount<mem5.currentCount ) mem5.maxCount = mem5.currentCount;
  if( mem5.maxOut<mem5.currentOut ) mem5.maxOut = mem5.currentOut;

  /* Return a pointer to the allocated memory. */
  return (void*)&mem5.zPool[i*mem5.nAtom];
}

/*
** Free an outstanding memory allocation.
*/
static void memsys5FreeUnsafe(void *pOld){
  u32 size, iLogsize;
  int iBlock;             

  /* Set iBlock to the index of the block pointed to by pOld in 
  ** the array of mem5.nAtom byte blocks pointed to by mem5.zPool.
  */
  iBlock = ((u8 *)pOld-mem5.zPool)/mem5.nAtom;

  /* Check that the pointer pOld points to a valid, non-free block. */
  assert( iBlock>=0 && iBlock<mem5.nBlock );
  assert( ((u8 *)pOld-mem5.zPool)%mem5.nAtom==0 );
  assert( (mem5.aCtrl[iBlock] & CTRL_FREE)==0 );

  iLogsize = mem5.aCtrl[iBlock] & CTRL_LOGSIZE;
  size = 1<<iLogsize;
  assert( iBlock+size-1<mem5.nBlock );

  mem5.aCtrl[iBlock] |= CTRL_FREE;
  mem5.aCtrl[iBlock+size-1] |= CTRL_FREE;
  assert( mem5.currentCount>0 );
  assert( mem5.currentOut>=0 );
  mem5.currentCount--;
  mem5.currentOut -= size*mem5.nAtom;
  assert( mem5.currentOut>0 || mem5.currentCount==0 );
  assert( mem5.currentCount>0 || mem5.currentOut==0 );

  mem5.aCtrl[iBlock] = CTRL_FREE | iLogsize;
  while( iLogsize<LOGMAX ){
    int iBuddy;
    if( (iBlock>>iLogsize) & 1 ){
      iBuddy = iBlock - size;
    }else{
      iBuddy = iBlock + size;
    }
    assert( iBuddy>=0 );
    if( (iBuddy+(1<<iLogsize))>mem5.nBlock ) break;
    if( mem5.aCtrl[iBuddy]!=(CTRL_FREE | iLogsize) ) break;
    memsys5Unlink(iBuddy, iLogsize);
    iLogsize++;
    if( iBuddy<iBlock ){
      mem5.aCtrl[iBuddy] = CTRL_FREE | iLogsize;
      mem5.aCtrl[iBlock] = 0;
      iBlock = iBuddy;
    }else{
      mem5.aCtrl[iBlock] = CTRL_FREE | iLogsize;
      mem5.aCtrl[iBuddy] = 0;
    }
    size *= 2;
  }
  memsys5Link(iBlock, iLogsize);
}

/*
** Allocate nBytes of memory
*/
static void *memsys5Malloc(int nBytes){
  sqlite3_int64 *p = 0;
  if( nBytes>0 ){
    memsys5Enter();
    p = memsys5MallocUnsafe(nBytes);
    memsys5Leave();
  }
  return (void*)p; 
}

/*
** Free memory.
*/
static void memsys5Free(void *pPrior){
  if( pPrior==0 ){
assert(0);
    return;
  }
  memsys5Enter();
  memsys5FreeUnsafe(pPrior);
  memsys5Leave();  
}

/*
** Change the size of an existing memory allocation
*/
static void *memsys5Realloc(void *pPrior, int nBytes){
  int nOld;
  void *p;
  if( pPrior==0 ){
    return memsys5Malloc(nBytes);
  }
  if( nBytes<=0 ){
    memsys5Free(pPrior);
    return 0;
  }
  nOld = memsys5Size(pPrior);
  if( nBytes<=nOld ){
    return pPrior;
  }
  memsys5Enter();
  p = memsys5MallocUnsafe(nBytes);
  if( p ){
    memcpy(p, pPrior, nOld);
    memsys5FreeUnsafe(pPrior);
  }
  memsys5Leave();
  return p;
}

/*
** Round up a request size to the next valid allocation size.
*/
static int memsys5Roundup(int n){
  int iFullSz;
  for(iFullSz=mem5.nAtom; iFullSz<n; iFullSz *= 2);
  return iFullSz;
}

static int memsys5Log(int iValue){
  int iLog;
  for(iLog=0; (1<<iLog)<iValue; iLog++);
  return iLog;
}

/*
** Initialize this module.
*/
static int memsys5Init(void *NotUsed){
  int ii;
  int nByte = sqlite3Config.nHeap;
  u8 *zByte = (u8 *)sqlite3Config.pHeap;
  int nMinLog;                 /* Log of minimum allocation size in bytes*/
  int iOffset;

  if( !zByte ){
    return SQLITE_ERROR;
  }

  nMinLog = memsys5Log(sqlite3Config.mnReq);
  mem5.nAtom = (1<<nMinLog);
  while( sizeof(Mem5Link)>mem5.nAtom ){
    mem5.nAtom = mem5.nAtom << 1;
  }

  mem5.nBlock = (nByte / (mem5.nAtom+sizeof(u8)));
  mem5.zPool = zByte;
  mem5.aCtrl = (u8 *)&mem5.zPool[mem5.nBlock*mem5.nAtom];

  for(ii=0; ii<=LOGMAX; ii++){
    mem5.aiFreelist[ii] = -1;
  }

  iOffset = 0;
  for(ii=LOGMAX; ii>=0; ii--){
    int nAlloc = (1<<ii);
    if( (iOffset+nAlloc)<=mem5.nBlock ){
      mem5.aCtrl[iOffset] = ii | CTRL_FREE;
      memsys5Link(iOffset, ii);
      iOffset += nAlloc;
    }
    assert((iOffset+nAlloc)>mem5.nBlock);
  }

  return SQLITE_OK;
}

/*
** Deinitialize this module.
*/
static void memsys5Shutdown(void *NotUsed){
  return;
}

/*
** Open the file indicated and write a log of all unfreed memory 
** allocations into that log.
*/
void sqlite3Memsys5Dump(const char *zFilename){
#ifdef SQLITE_DEBUG
  FILE *out;
  int i, j, n;
  int nMinLog;

  if( zFilename==0 || zFilename[0]==0 ){
    out = stdout;
  }else{
    out = fopen(zFilename, "w");
    if( out==0 ){
      fprintf(stderr, "** Unable to output memory debug output log: %s **\n",
                      zFilename);
      return;
    }
  }
  memsys5Enter();
  nMinLog = memsys5Log(mem5.nAtom);
  for(i=0; i<=LOGMAX && i+nMinLog<32; i++){
    for(n=0, j=mem5.aiFreelist[i]; j>=0; j = MEM5LINK(j)->next, n++){}
    fprintf(out, "freelist items of size %d: %d\n", mem5.nAtom << i, n);
  }
  fprintf(out, "mem5.nAlloc       = %llu\n", mem5.nAlloc);
  fprintf(out, "mem5.totalAlloc   = %llu\n", mem5.totalAlloc);
  fprintf(out, "mem5.totalExcess  = %llu\n", mem5.totalExcess);
  fprintf(out, "mem5.currentOut   = %u\n", mem5.currentOut);
  fprintf(out, "mem5.currentCount = %u\n", mem5.currentCount);
  fprintf(out, "mem5.maxOut       = %u\n", mem5.maxOut);
  fprintf(out, "mem5.maxCount     = %u\n", mem5.maxCount);
  fprintf(out, "mem5.maxRequest   = %u\n", mem5.maxRequest);
  memsys5Leave();
  if( out==stdout ){
    fflush(stdout);
  }else{
    fclose(out);
  }
#endif
}

/*
** This routine is the only routine in this file with external 
** linkage. It returns a pointer to a static sqlite3_mem_methods
** struct populated with the memsys5 methods.
*/
const sqlite3_mem_methods *sqlite3MemGetMemsys5(void){
  static const sqlite3_mem_methods memsys5Methods = {
     memsys5Malloc,
     memsys5Free,
     memsys5Realloc,
     memsys5Size,
     memsys5Roundup,
     memsys5Init,
     memsys5Shutdown,
     0
  };
  return &memsys5Methods;
}

#endif /* SQLITE_ENABLE_MEMSYS5 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/mem6.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
/*
** 2008 July 24
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains an alternative memory allocation system for SQLite.
** This system is implemented as a wrapper around the system provided
** by the operating system - vanilla malloc(), realloc() and free().
**
** This system differentiates between requests for "small" allocations 
** (by default those of 128 bytes or less) and "large" allocations (all
** others). The 256 byte threshhold is configurable at runtime.
**
** All requests for large allocations are passed through to the 
** default system.
**
** Requests for small allocations are met by allocating space within
** one or more larger "chunks" of memory obtained from the default
** memory allocation system. Chunks of memory are usually 64KB or 
** larger. The algorithm used to manage space within each chunk is
** the same as that used by mem5.c. 
**
** This strategy is designed to prevent the default memory allocation
** system (usually the system malloc) from suffering from heap 
** fragmentation. On some systems, heap fragmentation can cause a 
** significant real-time slowdown.
**
** $Id: mem6.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/

#ifdef SQLITE_ENABLE_MEMSYS6

#include "sqliteInt.h"

/*
** Maximum size of any "small" allocation is ((1<<LOGMAX)*Mem6Chunk.nAtom).
** Mem6Chunk.nAtom is always at least 8, so this is not a practical
** limitation
*/
#define LOGMAX 30

/*
** Default value for the "small" allocation size threshold.
*/
#define SMALL_MALLOC_DEFAULT_THRESHOLD 256

/*
** Minimum size for a memory chunk.
*/
#define MIN_CHUNKSIZE (1<<16)

#define LOG2_MINALLOC 4


typedef struct Mem6Chunk Mem6Chunk;
typedef struct Mem6Link Mem6Link;

/*
** A minimum allocation is an instance of the following structure.
** Larger allocations are an array of these structures where the
** size of the array is a power of 2.
*/
struct Mem6Link {
  int next;       /* Index of next free chunk */
  int prev;       /* Index of previous free chunk */
};

/*
** Masks used for mem5.aCtrl[] elements.
*/
#define CTRL_LOGSIZE  0x1f    /* Log2 Size of this block relative to POW2_MIN */
#define CTRL_FREE     0x20    /* True if not checked out */

struct Mem6Chunk {
  Mem6Chunk *pNext;

  /*
  ** Lists of free blocks of various sizes.
  */
  int aiFreelist[LOGMAX+1];

  int nCheckedOut; /* Number of currently outstanding allocations */

  /*
  ** Space for tracking which blocks are checked out and the size
  ** of each block. One byte per block.
  */
  u8 *aCtrl;

  /*
  ** Memory available for allocation
  */
  int nAtom;       /* Smallest possible allocation in bytes */
  int nBlock;      /* Number of nAtom sized blocks in zPool */
  u8 *zPool;       /* Pointer to memory chunk from which allocations are made */
};

#define MEM6LINK(idx) ((Mem6Link *)(&pChunk->zPool[(idx)*pChunk->nAtom]))

struct Mem6Global {
  int nMinAlloc;                  /* Minimum allowed allocation size */
  int nThreshold;                 /* Allocs larger than this go to malloc() */
  int nLogThreshold;              /* log2 of (nThreshold/nMinAlloc) */
  sqlite3_mutex *mutex;
  Mem6Chunk *pChunk;              /* Singly linked list of all memory chunks */
} mem6;

/*
** Unlink the chunk at pChunk->aPool[i] from list it is currently
** on.  It should be found on pChunk->aiFreelist[iLogsize].
*/
static void memsys6Unlink(Mem6Chunk *pChunk, int i, int iLogsize){
  int next, prev;
  assert( i>=0 && i<pChunk->nBlock );
  assert( iLogsize>=0 && iLogsize<=mem6.nLogThreshold );
  assert( (pChunk->aCtrl[i] & CTRL_LOGSIZE)==iLogsize );

  next = MEM6LINK(i)->next;
  prev = MEM6LINK(i)->prev;
  if( prev<0 ){
    pChunk->aiFreelist[iLogsize] = next;
  }else{
    MEM6LINK(prev)->next = next;
  }
  if( next>=0 ){
    MEM6LINK(next)->prev = prev;
  }
}

/*
** Link the chunk at mem5.aPool[i] so that is on the iLogsize
** free list.
*/
static void memsys6Link(Mem6Chunk *pChunk, int i, int iLogsize){
  int x;
  assert( i>=0 && i<pChunk->nBlock );
  assert( iLogsize>=0 && iLogsize<=mem6.nLogThreshold );
  assert( (pChunk->aCtrl[i] & CTRL_LOGSIZE)==iLogsize );

  x = MEM6LINK(i)->next = pChunk->aiFreelist[iLogsize];
  MEM6LINK(i)->prev = -1;
  if( x>=0 ){
    assert( x<pChunk->nBlock );
    MEM6LINK(x)->prev = i;
  }
  pChunk->aiFreelist[iLogsize] = i;
}


/*
** Find the first entry on the freelist iLogsize.  Unlink that
** entry and return its index. 
*/
static int memsys6UnlinkFirst(Mem6Chunk *pChunk, int iLogsize){
  int i;
  int iFirst;

  assert( iLogsize>=0 && iLogsize<=mem6.nLogThreshold );
  i = iFirst = pChunk->aiFreelist[iLogsize];
  assert( iFirst>=0 );
  memsys6Unlink(pChunk, iFirst, iLogsize);
  return iFirst;
}

static int roundupLog2(int n){
  static const char LogTable256[256] = {
    0,                                                    /* 1 */
    1,                                                    /* 2 */
    2, 2,                                                 /* 3..4 */
    3, 3, 3, 3,                                           /* 5..8 */
    4, 4, 4, 4, 4, 4, 4, 4,                               /* 9..16 */
    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,       /* 17..32 */
    6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
    6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,       /* 33..64 */
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,       /* 65..128 */
    8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
    8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
    8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
    8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
    8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
    8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
    8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
    8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,       /* 129..256 */
  };

  assert(n<=(1<<16) && n>0);
  if( n<=256 ) return LogTable256[n-1];
  return LogTable256[(n>>8) - ((n&0xFF)?0:1)] + 8;
}

/*
** Allocate and return a block of (pChunk->nAtom << iLogsize) bytes from chunk
** pChunk. If the allocation request cannot be satisfied, return 0.
*/
static void *chunkMalloc(Mem6Chunk *pChunk, int iLogsize){
  int i;           /* Index of a mem5.aPool[] slot */
  int iBin;        /* Index into mem5.aiFreelist[] */

  /* Make sure mem5.aiFreelist[iLogsize] contains at least one free
  ** block.  If not, then split a block of the next larger power of
  ** two in order to create a new free block of size iLogsize.
  */
  for(iBin=iLogsize; pChunk->aiFreelist[iBin]<0 && iBin<=mem6.nLogThreshold; iBin++){}
  if( iBin>mem6.nLogThreshold ) return 0;
  i = memsys6UnlinkFirst(pChunk, iBin);
  while( iBin>iLogsize ){
    int newSize;
    iBin--;
    newSize = 1 << iBin;
    pChunk->aCtrl[i+newSize] = CTRL_FREE | iBin;
    memsys6Link(pChunk, i+newSize, iBin);
  }
  pChunk->aCtrl[i] = iLogsize;

  /* Return a pointer to the allocated memory. */
  pChunk->nCheckedOut++;
  return (void*)&pChunk->zPool[i*pChunk->nAtom];
}

/*
** Free the allocation pointed to by p, which is guaranteed to be non-zero
** and a part of chunk object pChunk.
*/
static void chunkFree(Mem6Chunk *pChunk, void *pOld){
  u32 size, iLogsize;
  int iBlock;             

  /* Set iBlock to the index of the block pointed to by pOld in 
  ** the array of pChunk->nAtom byte blocks pointed to by pChunk->zPool.
  */
  iBlock = ((u8 *)pOld-pChunk->zPool)/pChunk->nAtom;

  /* Check that the pointer pOld points to a valid, non-free block. */
  assert( iBlock>=0 && iBlock<pChunk->nBlock );
  assert( ((u8 *)pOld-pChunk->zPool)%pChunk->nAtom==0 );
  assert( (pChunk->aCtrl[iBlock] & CTRL_FREE)==0 );

  iLogsize = pChunk->aCtrl[iBlock] & CTRL_LOGSIZE;
  size = 1<<iLogsize;
  assert( iBlock+size-1<pChunk->nBlock );

  pChunk->aCtrl[iBlock] |= CTRL_FREE;
  pChunk->aCtrl[iBlock+size-1] |= CTRL_FREE;

  pChunk->aCtrl[iBlock] = CTRL_FREE | iLogsize;
  while( iLogsize<mem6.nLogThreshold ){
    int iBuddy;
    if( (iBlock>>iLogsize) & 1 ){
      iBuddy = iBlock - size;
    }else{
      iBuddy = iBlock + size;
    }
    assert( iBuddy>=0 );
    if( (iBuddy+(1<<iLogsize))>pChunk->nBlock ) break;
    if( pChunk->aCtrl[iBuddy]!=(CTRL_FREE | iLogsize) ) break;
    memsys6Unlink(pChunk, iBuddy, iLogsize);
    iLogsize++;
    if( iBuddy<iBlock ){
      pChunk->aCtrl[iBuddy] = CTRL_FREE | iLogsize;
      pChunk->aCtrl[iBlock] = 0;
      iBlock = iBuddy;
    }else{
      pChunk->aCtrl[iBlock] = CTRL_FREE | iLogsize;
      pChunk->aCtrl[iBuddy] = 0;
    }
    size *= 2;
  }
  pChunk->nCheckedOut--;
  memsys6Link(pChunk, iBlock, iLogsize);
}

/*
** Return the actual size of the block pointed to by p, which is guaranteed
** to have been allocated from chunk pChunk.
*/
static int chunkSize(Mem6Chunk *pChunk, void *p){
  int iSize = 0;
  if( p ){
    int i = ((u8 *)p-pChunk->zPool)/pChunk->nAtom;
    assert( i>=0 && i<pChunk->nBlock );
    iSize = pChunk->nAtom * (1 << (pChunk->aCtrl[i]&CTRL_LOGSIZE));
  }
  return iSize;
}

/*
** Return true if there are currently no outstanding allocations.
*/
static int chunkIsEmpty(Mem6Chunk *pChunk){
  return (pChunk->nCheckedOut==0);
}

/*
** Initialize the buffer zChunk, which is nChunk bytes in size, as
** an Mem6Chunk object. Return a copy of the zChunk pointer.
*/
static Mem6Chunk *chunkInit(u8 *zChunk, int nChunk, int nMinAlloc){
  int ii;
  int iOffset;
  Mem6Chunk *pChunk = (Mem6Chunk *)zChunk;

  assert( nChunk>sizeof(Mem6Chunk) );
  assert( nMinAlloc>sizeof(Mem6Link) );

  memset(pChunk, 0, sizeof(Mem6Chunk));
  pChunk->nAtom = nMinAlloc;
  pChunk->nBlock = ((nChunk-sizeof(Mem6Chunk)) / (pChunk->nAtom+sizeof(u8)));

  pChunk->zPool = (u8 *)&pChunk[1];
  pChunk->aCtrl = &pChunk->zPool[pChunk->nBlock*pChunk->nAtom];

  for(ii=0; ii<=mem6.nLogThreshold; ii++){
    pChunk->aiFreelist[ii] = -1;
  }

  iOffset = 0;
  for(ii=mem6.nLogThreshold; ii>=0; ii--){
    int nAlloc = (1<<ii);
    while( (iOffset+nAlloc)<=pChunk->nBlock ){
      pChunk->aCtrl[iOffset] = ii | CTRL_FREE;
      memsys6Link(pChunk, iOffset, ii);
      iOffset += nAlloc;
    }
  }

  return pChunk;
}


static void mem6Enter(void){
  sqlite3_mutex_enter(mem6.mutex);
}

static void mem6Leave(void){
  sqlite3_mutex_leave(mem6.mutex);
}

/*
** Based on the number and size of the currently allocated chunks, return
** the size of the next chunk to allocate, in bytes.
*/
static int nextChunkSize(void){
  int iTotal = MIN_CHUNKSIZE;
  Mem6Chunk *p;
  for(p=mem6.pChunk; p; p=p->pNext){
    iTotal = iTotal*2;
  }
  return iTotal;
}

static void freeChunk(Mem6Chunk *pChunk){
  Mem6Chunk **pp = &mem6.pChunk;
  for( pp=&mem6.pChunk; *pp!=pChunk; pp = &(*pp)->pNext );
  *pp = (*pp)->pNext;
  free(pChunk);
}

static void *memsys6Malloc(int nByte){
  Mem6Chunk *pChunk;
  void *p = 0;
  int nTotal = nByte+8;
  int iOffset = 0;

  if( nTotal>mem6.nThreshold ){
    p = malloc(nTotal);
  }else{
    int iLogsize = 0;
    if( nTotal>(1<<LOG2_MINALLOC) ){
      iLogsize = roundupLog2(nTotal) - LOG2_MINALLOC;
    }
    mem6Enter();
    for(pChunk=mem6.pChunk; pChunk; pChunk=pChunk->pNext){
      p = chunkMalloc(pChunk, iLogsize);
      if( p ){
        break;
      }
    }
    if( !p ){
      int iSize = nextChunkSize();
      p = malloc(iSize);
      if( p ){
        pChunk = chunkInit((u8 *)p, iSize, mem6.nMinAlloc);
        pChunk->pNext = mem6.pChunk;
        mem6.pChunk = pChunk;
        p = chunkMalloc(pChunk, iLogsize);
        assert(p);
      }
    }
    iOffset = ((u8*)p - (u8*)pChunk);
    mem6Leave();
  }

  if( !p ){
    return 0;
  }
  ((u32 *)p)[0] = iOffset;
  ((u32 *)p)[1] = nByte;
  return &((u32 *)p)[2];
}

static int memsys6Size(void *pPrior){
  if( pPrior==0 ) return 0;
  return ((u32*)pPrior)[-1];
}

static void memsys6Free(void *pPrior){
  int iSlot;
  void *p = &((u32 *)pPrior)[-2];
  iSlot = ((u32 *)p)[0];
  if( iSlot ){
    Mem6Chunk *pChunk;
    mem6Enter();
    pChunk = (Mem6Chunk *)(&((u8 *)p)[-1 * iSlot]);
    chunkFree(pChunk, p);
    if( chunkIsEmpty(pChunk) ){
      freeChunk(pChunk);
    }
    mem6Leave();
  }else{
    free(p);
  }
}

static void *memsys6Realloc(void *p, int nByte){
  void *p2;

  if( p && nByte<=memsys6Size(p) ){
    p2 = p;
  }else{
    p2 = memsys6Malloc(nByte);
    if( p && p2 ){
      memcpy(p2, p, memsys6Size(p));
      memsys6Free(p);
    }
  }

  return p2;
}

static int memsys6Roundup(int n){
  if( n>mem6.nThreshold ){
    return n;
  }else{
    return (1<<roundupLog2(n));
  }
}

static int memsys6Init(void *pCtx){
  u8 bMemstat = sqlite3Config.bMemstat;
  mem6.nMinAlloc = (1 << LOG2_MINALLOC);
  mem6.pChunk = 0;
  mem6.nThreshold = sqlite3Config.nSmall;
  if( mem6.nThreshold<=0 ){
    mem6.nThreshold = SMALL_MALLOC_DEFAULT_THRESHOLD;
  }
  mem6.nLogThreshold = roundupLog2(mem6.nThreshold) - LOG2_MINALLOC;
  if( !bMemstat ){
    mem6.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
  }
  return SQLITE_OK;
}

static void memsys6Shutdown(void *pCtx){
  memset(&mem6, 0, sizeof(mem6));
}

/*
** This routine is the only routine in this file with external 
** linkage. It returns a pointer to a static sqlite3_mem_methods
** struct populated with the memsys6 methods.
*/
const sqlite3_mem_methods *sqlite3MemGetMemsys6(void){
  static const sqlite3_mem_methods memsys6Methods = {
     memsys6Malloc,
     memsys6Free,
     memsys6Realloc,
     memsys6Size,
     memsys6Roundup,
     memsys6Init,
     memsys6Shutdown,
     0
  };
  return &memsys6Methods;
}

#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/mutex.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
/*
** 2007 August 14
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains the C functions that implement mutexes.
**
** The implementation in this file does not provide any mutual
** exclusion and is thus suitable for use only in applications
** that use SQLite in a single thread.  But this implementation
** does do a lot of error checking on mutexes to make sure they
** are called correctly and at appropriate times.  Hence, this
** implementation is suitable for testing.
** debugging purposes
**
** $Id: mutex.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"

#ifndef SQLITE_MUTEX_NOOP
/*
** Initialize the mutex system.
*/
int sqlite3MutexInit(void){ 
  int rc = SQLITE_OK;
  if( sqlite3Config.bCoreMutex ){
    if( !sqlite3Config.mutex.xMutexAlloc ){
      /* If the xMutexAlloc method has not been set, then the user did not
      ** install a mutex implementation via sqlite3_config() prior to 
      ** sqlite3_initialize() being called. This block copies pointers to
      ** the default implementation into the sqlite3Config structure.
      **
      ** The danger is that although sqlite3_config() is not a threadsafe
      ** API, sqlite3_initialize() is, and so multiple threads may be
      ** attempting to run this function simultaneously. To guard write
      ** access to the sqlite3Config structure, the 'MASTER' static mutex
      ** is obtained before modifying it.
      */
      sqlite3_mutex_methods *p = sqlite3DefaultMutex();
      sqlite3_mutex *pMaster = 0;
  
      rc = p->xMutexInit();
      if( rc==SQLITE_OK ){
        pMaster = p->xMutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
        assert(pMaster);
        p->xMutexEnter(pMaster);
        assert( sqlite3Config.mutex.xMutexAlloc==0 
             || sqlite3Config.mutex.xMutexAlloc==p->xMutexAlloc
        );
        if( !sqlite3Config.mutex.xMutexAlloc ){
          sqlite3Config.mutex = *p;
        }
        p->xMutexLeave(pMaster);
      }
    }else{
      rc = sqlite3Config.mutex.xMutexInit();
    }
  }

  return rc;
}

/*
** Shutdown the mutex system. This call frees resources allocated by
** sqlite3MutexInit().
*/
int sqlite3MutexEnd(void){
  int rc = SQLITE_OK;
  rc = sqlite3Config.mutex.xMutexEnd();
  return rc;
}

/*
** Retrieve a pointer to a static mutex or allocate a new dynamic one.
*/
sqlite3_mutex *sqlite3_mutex_alloc(int id){
#ifndef SQLITE_OMIT_AUTOINIT
  if( sqlite3_initialize() ) return 0;
#endif
  return sqlite3Config.mutex.xMutexAlloc(id);
}

sqlite3_mutex *sqlite3MutexAlloc(int id){
  if( !sqlite3Config.bCoreMutex ){
    return 0;
  }
  return sqlite3Config.mutex.xMutexAlloc(id);
}

/*
** Free a dynamic mutex.
*/
void sqlite3_mutex_free(sqlite3_mutex *p){
  if( p ){
    sqlite3Config.mutex.xMutexFree(p);
  }
}

/*
** Obtain the mutex p. If some other thread already has the mutex, block
** until it can be obtained.
*/
void sqlite3_mutex_enter(sqlite3_mutex *p){
  if( p ){
    sqlite3Config.mutex.xMutexEnter(p);
  }
}

/*
** Obtain the mutex p. If successful, return SQLITE_OK. Otherwise, if another
** thread holds the mutex and it cannot be obtained, return SQLITE_BUSY.
*/
int sqlite3_mutex_try(sqlite3_mutex *p){
  int rc = SQLITE_OK;
  if( p ){
    return sqlite3Config.mutex.xMutexTry(p);
  }
  return rc;
}

/*
** The sqlite3_mutex_leave() routine exits a mutex that was previously
** entered by the same thread.  The behavior is undefined if the mutex 
** is not currently entered. If a NULL pointer is passed as an argument
** this function is a no-op.
*/
void sqlite3_mutex_leave(sqlite3_mutex *p){
  if( p ){
    sqlite3Config.mutex.xMutexLeave(p);
  }
}

#ifndef NDEBUG
/*
** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are
** intended for use inside assert() statements.
*/
int sqlite3_mutex_held(sqlite3_mutex *p){
  return p==0 || sqlite3Config.mutex.xMutexHeld(p);
}
int sqlite3_mutex_notheld(sqlite3_mutex *p){
  return p==0 || sqlite3Config.mutex.xMutexNotheld(p);
}
#endif

#endif

#ifdef SQLITE_MUTEX_NOOP_DEBUG
/*
** In this implementation, mutexes do not provide any mutual exclusion.
** But the error checking is provided.  This implementation is useful
** for test purposes.
*/

/*
** The mutex object
*/
struct sqlite3_mutex {
  int id;     /* The mutex type */
  int cnt;    /* Number of entries without a matching leave */
};

/*
** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are
** intended for use inside assert() statements.
*/
static int noopMutexHeld(sqlite3_mutex *p){
  return p==0 || p->cnt>0;
}
static int noopMutexNotheld(sqlite3_mutex *p){
  return p==0 || p->cnt==0;
}

/*
** Initialize and deinitialize the mutex subsystem.
*/
static int noopMutexInit(void){ return SQLITE_OK; }
static int noopMutexEnd(void){ return SQLITE_OK; }

/*
** The sqlite3_mutex_alloc() routine allocates a new
** mutex and returns a pointer to it.  If it returns NULL
** that means that a mutex could not be allocated. 
*/
static sqlite3_mutex *noopMutexAlloc(int id){
  static sqlite3_mutex aStatic[6];
  sqlite3_mutex *pNew = 0;
  switch( id ){
    case SQLITE_MUTEX_FAST:
    case SQLITE_MUTEX_RECURSIVE: {
      pNew = sqlite3Malloc(sizeof(*pNew));
      if( pNew ){
        pNew->id = id;
        pNew->cnt = 0;
      }
      break;
    }
    default: {
      assert( id-2 >= 0 );
      assert( id-2 < sizeof(aStatic)/sizeof(aStatic[0]) );
      pNew = &aStatic[id-2];
      pNew->id = id;
      break;
    }
  }
  return pNew;
}

/*
** This routine deallocates a previously allocated mutex.
*/
static void noopMutexFree(sqlite3_mutex *p){
  assert( p->cnt==0 );
  assert( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE );
  sqlite3_free(p);
}

/*
** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
** to enter a mutex.  If another thread is already within the mutex,
** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
** SQLITE_BUSY.  The sqlite3_mutex_try() interface returns SQLITE_OK
** upon successful entry.  Mutexes created using SQLITE_MUTEX_RECURSIVE can
** be entered multiple times by the same thread.  In such cases the,
** mutex must be exited an equal number of times before another thread
** can enter.  If the same thread tries to enter any other kind of mutex
** more than once, the behavior is undefined.
*/
static void noopMutexEnter(sqlite3_mutex *p){
  assert( p->id==SQLITE_MUTEX_RECURSIVE || noopMutexNotheld(p) );
  p->cnt++;
}
static int noopMutexTry(sqlite3_mutex *p){
  assert( p->id==SQLITE_MUTEX_RECURSIVE || noopMutexNotheld(p) );
  p->cnt++;
  return SQLITE_OK;
}

/*
** The sqlite3_mutex_leave() routine exits a mutex that was
** previously entered by the same thread.  The behavior
** is undefined if the mutex is not currently entered or
** is not currently allocated.  SQLite will never do either.
*/
static void noopMutexLeave(sqlite3_mutex *p){
  assert( noopMutexHeld(p) );
  p->cnt--;
  assert( p->id==SQLITE_MUTEX_RECURSIVE || noopMutexNotheld(p) );
}

sqlite3_mutex_methods *sqlite3DefaultMutex(void){
  static sqlite3_mutex_methods sMutex = {
    noopMutexInit,
    noopMutexEnd,
    noopMutexAlloc,
    noopMutexFree,
    noopMutexEnter,
    noopMutexTry,
    noopMutexLeave,

    noopMutexHeld,
    noopMutexNotheld
  };

  return &sMutex;
}
#endif /* SQLITE_MUTEX_NOOP_DEBUG */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/mutex.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
** 2007 August 28
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains the common header for all mutex implementations.
** The sqliteInt.h header #includes this file so that it is available
** to all source files.  We break it out in an effort to keep the code
** better organized.
**
** NOTE:  source files should *not* #include this header file directly.
** Source files should #include the sqliteInt.h file and let that file
** include this one indirectly.
**
** $Id: mutex.h,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/


#ifdef SQLITE_MUTEX_APPDEF
/*
** If SQLITE_MUTEX_APPDEF is defined, then this whole module is
** omitted and equivalent functionality must be provided by the
** application that links against the SQLite library.
*/
#else
/*
** Figure out what version of the code to use.  The choices are
**
**   SQLITE_MUTEX_NOOP         For single-threaded applications that
**                             do not desire error checking.
**
**   SQLITE_MUTEX_NOOP_DEBUG   For single-threaded applications with
**                             error checking to help verify that mutexes
**                             are being used correctly even though they
**                             are not needed.  Used when SQLITE_DEBUG is
**                             defined on single-threaded builds.
**
**   SQLITE_MUTEX_PTHREADS     For multi-threaded applications on Unix.
**
**   SQLITE_MUTEX_W32          For multi-threaded applications on Win32.
**
**   SQLITE_MUTEX_OS2          For multi-threaded applications on OS/2.
*/
#define SQLITE_MUTEX_NOOP 1   /* The default */
#if defined(SQLITE_DEBUG) && !SQLITE_THREADSAFE
# undef SQLITE_MUTEX_NOOP
# define SQLITE_MUTEX_NOOP_DEBUG
#endif
#if defined(SQLITE_MUTEX_NOOP) && SQLITE_THREADSAFE && SQLITE_OS_UNIX
# undef SQLITE_MUTEX_NOOP
# define SQLITE_MUTEX_PTHREADS
#endif
#if defined(SQLITE_MUTEX_NOOP) && SQLITE_THREADSAFE && SQLITE_OS_WIN
# undef SQLITE_MUTEX_NOOP
# define SQLITE_MUTEX_W32
#endif
#if defined(SQLITE_MUTEX_NOOP) && SQLITE_THREADSAFE && SQLITE_OS_OS2
# undef SQLITE_MUTEX_NOOP
# define SQLITE_MUTEX_OS2
#endif

#ifdef SQLITE_MUTEX_NOOP
/*
** If this is a no-op implementation, implement everything as macros.
*/
#define sqlite3_mutex_alloc(X)    ((sqlite3_mutex*)8)
#define sqlite3_mutex_free(X)
#define sqlite3_mutex_enter(X)
#define sqlite3_mutex_try(X)      SQLITE_OK
#define sqlite3_mutex_leave(X)
#define sqlite3_mutex_held(X)     1
#define sqlite3_mutex_notheld(X)  1
#define sqlite3MutexAlloc(X)      ((sqlite3_mutex*)8)
#define sqlite3MutexInit()        SQLITE_OK
#define sqlite3MutexEnd()
#endif

#endif /* SQLITE_MUTEX_APPDEF */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































Deleted SQLite.Interop/splitsource/mutex_os2.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
/*
** 2007 August 28
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains the C functions that implement mutexes for OS/2
**
** $Id: mutex_os2.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** The code in this file is only used if SQLITE_MUTEX_OS2 is defined.
** See the mutex.h file for details.
*/
#ifdef SQLITE_MUTEX_OS2

/********************** OS/2 Mutex Implementation **********************
**
** This implementation of mutexes is built using the OS/2 API.
*/

/*
** The mutex object
** Each recursive mutex is an instance of the following structure.
*/
struct sqlite3_mutex {
  HMTX mutex;       /* Mutex controlling the lock */
  int  id;          /* Mutex type */
  int  nRef;        /* Number of references */
  TID  owner;       /* Thread holding this mutex */
};

#define OS2_MUTEX_INITIALIZER   0,0,0,0

/*
** Initialize and deinitialize the mutex subsystem.
*/
static int os2MutexInit(void){ return SQLITE_OK; }
static int os2MutexEnd(void){ return SQLITE_OK; }

/*
** The sqlite3_mutex_alloc() routine allocates a new
** mutex and returns a pointer to it.  If it returns NULL
** that means that a mutex could not be allocated. 
** SQLite will unwind its stack and return an error.  The argument
** to sqlite3_mutex_alloc() is one of these integer constants:
**
** <ul>
** <li>  SQLITE_MUTEX_FAST               0
** <li>  SQLITE_MUTEX_RECURSIVE          1
** <li>  SQLITE_MUTEX_STATIC_MASTER      2
** <li>  SQLITE_MUTEX_STATIC_MEM         3
** <li>  SQLITE_MUTEX_STATIC_PRNG        4
** </ul>
**
** The first two constants cause sqlite3_mutex_alloc() to create
** a new mutex.  The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
** The mutex implementation does not need to make a distinction
** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
** not want to.  But SQLite will only request a recursive mutex in
** cases where it really needs one.  If a faster non-recursive mutex
** implementation is available on the host platform, the mutex subsystem
** might return such a mutex in response to SQLITE_MUTEX_FAST.
**
** The other allowed parameters to sqlite3_mutex_alloc() each return
** a pointer to a static preexisting mutex.  Three static mutexes are
** used by the current version of SQLite.  Future versions of SQLite
** may add additional static mutexes.  Static mutexes are for internal
** use by SQLite only.  Applications that use SQLite mutexes should
** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
** SQLITE_MUTEX_RECURSIVE.
**
** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
** returns a different mutex on every call.  But for the static
** mutex types, the same mutex is returned on every call that has
** the same type number.
*/
static sqlite3_mutex *os2MutexAlloc(int iType){
  sqlite3_mutex *p = NULL;
  switch( iType ){
    case SQLITE_MUTEX_FAST:
    case SQLITE_MUTEX_RECURSIVE: {
      p = sqlite3MallocZero( sizeof(*p) );
      if( p ){
        p->id = iType;
        if( DosCreateMutexSem( 0, &p->mutex, 0, FALSE ) != NO_ERROR ){
          sqlite3_free( p );
          p = NULL;
        }
      }
      break;
    }
    default: {
      static volatile int isInit = 0;
      static sqlite3_mutex staticMutexes[] = {
        { OS2_MUTEX_INITIALIZER, },
        { OS2_MUTEX_INITIALIZER, },
        { OS2_MUTEX_INITIALIZER, },
        { OS2_MUTEX_INITIALIZER, },
        { OS2_MUTEX_INITIALIZER, },
        { OS2_MUTEX_INITIALIZER, },
      };
      if ( !isInit ){
        APIRET rc;
        PTIB ptib;
        PPIB ppib;
        HMTX mutex;
        char name[32];
        DosGetInfoBlocks( &ptib, &ppib );
        sqlite3_snprintf( sizeof(name), name, "\\SEM32\\SQLITE%04x",
                          ppib->pib_ulpid );
        while( !isInit ){
          mutex = 0;
          rc = DosCreateMutexSem( name, &mutex, 0, FALSE);
          if( rc == NO_ERROR ){
            int i;
            if( !isInit ){
              for( i = 0; i < sizeof(staticMutexes)/sizeof(staticMutexes[0]); i++ ){
                DosCreateMutexSem( 0, &staticMutexes[i].mutex, 0, FALSE );
              }
              isInit = 1;
            }
            DosCloseMutexSem( mutex );
          }else if( rc == ERROR_DUPLICATE_NAME ){
            DosSleep( 1 );
          }else{
            return p;
          }
        }
      }
      assert( iType-2 >= 0 );
      assert( iType-2 < sizeof(staticMutexes)/sizeof(staticMutexes[0]) );
      p = &staticMutexes[iType-2];
      p->id = iType;
      break;
    }
  }
  return p;
}


/*
** This routine deallocates a previously allocated mutex.
** SQLite is careful to deallocate every mutex that it allocates.
*/
static void os2MutexFree(sqlite3_mutex *p){
  if( p==0 ) return;
  assert( p->nRef==0 );
  assert( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE );
  DosCloseMutexSem( p->mutex );
  sqlite3_free( p );
}

/*
** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
** to enter a mutex.  If another thread is already within the mutex,
** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
** SQLITE_BUSY.  The sqlite3_mutex_try() interface returns SQLITE_OK
** upon successful entry.  Mutexes created using SQLITE_MUTEX_RECURSIVE can
** be entered multiple times by the same thread.  In such cases the,
** mutex must be exited an equal number of times before another thread
** can enter.  If the same thread tries to enter any other kind of mutex
** more than once, the behavior is undefined.
*/
static void os2MutexEnter(sqlite3_mutex *p){
  TID tid;
  PID holder1;
  ULONG holder2;
  if( p==0 ) return;
  assert( p->id==SQLITE_MUTEX_RECURSIVE || os2MutexNotheld(p) );
  DosRequestMutexSem(p->mutex, SEM_INDEFINITE_WAIT);
  DosQueryMutexSem(p->mutex, &holder1, &tid, &holder2);
  p->owner = tid;
  p->nRef++;
}
static int os2MutexTry(sqlite3_mutex *p){
  int rc;
  TID tid;
  PID holder1;
  ULONG holder2;
  if( p==0 ) return SQLITE_OK;
  assert( p->id==SQLITE_MUTEX_RECURSIVE || os2MutexNotheld(p) );
  if( DosRequestMutexSem(p->mutex, SEM_IMMEDIATE_RETURN) == NO_ERROR) {
    DosQueryMutexSem(p->mutex, &holder1, &tid, &holder2);
    p->owner = tid;
    p->nRef++;
    rc = SQLITE_OK;
  } else {
    rc = SQLITE_BUSY;
  }

  return rc;
}

/*
** The sqlite3_mutex_leave() routine exits a mutex that was
** previously entered by the same thread.  The behavior
** is undefined if the mutex is not currently entered or
** is not currently allocated.  SQLite will never do either.
*/
static void os2MutexLeave(sqlite3_mutex *p){
  TID tid;
  PID holder1;
  ULONG holder2;
  if( p==0 ) return;
  assert( p->nRef>0 );
  DosQueryMutexSem(p->mutex, &holder1, &tid, &holder2);
  assert( p->owner==tid );
  p->nRef--;
  assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );
  DosReleaseMutexSem(p->mutex);
}

#ifdef SQLITE_DEBUG
/*
** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are
** intended for use inside assert() statements.
*/
static int os2MutexHeld(sqlite3_mutex *p){
  TID tid;
  PID pid;
  ULONG ulCount;
  PTIB ptib;
  if( p!=0 ) {
    DosQueryMutexSem(p->mutex, &pid, &tid, &ulCount);
  } else {
    DosGetInfoBlocks(&ptib, NULL);
    tid = ptib->tib_ptib2->tib2_ultid;
  }
  return p==0 || (p->nRef!=0 && p->owner==tid);
}
static int os2MutexNotheld(sqlite3_mutex *p){
  TID tid;
  PID pid;
  ULONG ulCount;
  PTIB ptib;
  if( p!= 0 ) {
    DosQueryMutexSem(p->mutex, &pid, &tid, &ulCount);
  } else {
    DosGetInfoBlocks(&ptib, NULL);
    tid = ptib->tib_ptib2->tib2_ultid;
  }
  return p==0 || p->nRef==0 || p->owner!=tid;
}
#endif

sqlite3_mutex_methods *sqlite3DefaultMutex(void){
  static sqlite3_mutex_methods sMutex = {
    os2MutexInit,
    os2MutexEnd,
    os2MutexAlloc,
    os2MutexFree,
    os2MutexEnter,
    os2MutexTry,
    os2MutexLeave,
#ifdef SQLITE_DEBUG
    os2MutexHeld,
    os2MutexNotheld
#endif
  };

  return &sMutex;
}
#endif /* SQLITE_MUTEX_OS2 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/mutex_unix.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
/*
** 2007 August 28
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains the C functions that implement mutexes for pthreads
**
** $Id: mutex_unix.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** The code in this file is only used if we are compiling threadsafe
** under unix with pthreads.
**
** Note that this implementation requires a version of pthreads that
** supports recursive mutexes.
*/
#ifdef SQLITE_MUTEX_PTHREADS

#include <pthread.h>


/*
** Each recursive mutex is an instance of the following structure.
*/
struct sqlite3_mutex {
  pthread_mutex_t mutex;     /* Mutex controlling the lock */
  int id;                    /* Mutex type */
  int nRef;                  /* Number of entrances */
  pthread_t owner;           /* Thread that is within this mutex */
#ifdef SQLITE_DEBUG
  int trace;                 /* True to trace changes */
#endif
};
#ifdef SQLITE_DEBUG
#define SQLITE3_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER, 0, 0, (pthread_t)0, 0 }
#else
#define SQLITE3_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER, 0, 0, (pthread_t)0 }
#endif

/*
** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are
** intended for use only inside assert() statements.  On some platforms,
** there might be race conditions that can cause these routines to
** deliver incorrect results.  In particular, if pthread_equal() is
** not an atomic operation, then these routines might delivery
** incorrect results.  On most platforms, pthread_equal() is a 
** comparison of two integers and is therefore atomic.  But we are
** told that HPUX is not such a platform.  If so, then these routines
** will not always work correctly on HPUX.
**
** On those platforms where pthread_equal() is not atomic, SQLite
** should be compiled without -DSQLITE_DEBUG and with -DNDEBUG to
** make sure no assert() statements are evaluated and hence these
** routines are never called.
*/
#ifndef NDEBUG
static int pthreadMutexHeld(sqlite3_mutex *p){
  return (p->nRef!=0 && pthread_equal(p->owner, pthread_self()));
}
static int pthreadMutexNotheld(sqlite3_mutex *p){
  return p->nRef==0 || pthread_equal(p->owner, pthread_self())==0;
}
#endif

/*
** Initialize and deinitialize the mutex subsystem.
*/
static int pthreadMutexInit(void){ return SQLITE_OK; }
static int pthreadMutexEnd(void){ return SQLITE_OK; }

/*
** The sqlite3_mutex_alloc() routine allocates a new
** mutex and returns a pointer to it.  If it returns NULL
** that means that a mutex could not be allocated.  SQLite
** will unwind its stack and return an error.  The argument
** to sqlite3_mutex_alloc() is one of these integer constants:
**
** <ul>
** <li>  SQLITE_MUTEX_FAST
** <li>  SQLITE_MUTEX_RECURSIVE
** <li>  SQLITE_MUTEX_STATIC_MASTER
** <li>  SQLITE_MUTEX_STATIC_MEM
** <li>  SQLITE_MUTEX_STATIC_MEM2
** <li>  SQLITE_MUTEX_STATIC_PRNG
** <li>  SQLITE_MUTEX_STATIC_LRU
** </ul>
**
** The first two constants cause sqlite3_mutex_alloc() to create
** a new mutex.  The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
** The mutex implementation does not need to make a distinction
** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
** not want to.  But SQLite will only request a recursive mutex in
** cases where it really needs one.  If a faster non-recursive mutex
** implementation is available on the host platform, the mutex subsystem
** might return such a mutex in response to SQLITE_MUTEX_FAST.
**
** The other allowed parameters to sqlite3_mutex_alloc() each return
** a pointer to a static preexisting mutex.  Three static mutexes are
** used by the current version of SQLite.  Future versions of SQLite
** may add additional static mutexes.  Static mutexes are for internal
** use by SQLite only.  Applications that use SQLite mutexes should
** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
** SQLITE_MUTEX_RECURSIVE.
**
** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
** returns a different mutex on every call.  But for the static 
** mutex types, the same mutex is returned on every call that has
** the same type number.
*/
static sqlite3_mutex *pthreadMutexAlloc(int iType){
  static sqlite3_mutex staticMutexes[] = {
    SQLITE3_MUTEX_INITIALIZER,
    SQLITE3_MUTEX_INITIALIZER,
    SQLITE3_MUTEX_INITIALIZER,
    SQLITE3_MUTEX_INITIALIZER,
    SQLITE3_MUTEX_INITIALIZER,
    SQLITE3_MUTEX_INITIALIZER
  };
  sqlite3_mutex *p;
  switch( iType ){
    case SQLITE_MUTEX_RECURSIVE: {
      p = sqlite3MallocZero( sizeof(*p) );
      if( p ){
#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
        /* If recursive mutexes are not available, we will have to
        ** build our own.  See below. */
        pthread_mutex_init(&p->mutex, 0);
#else
        /* Use a recursive mutex if it is available */
        pthread_mutexattr_t recursiveAttr;
        pthread_mutexattr_init(&recursiveAttr);
        pthread_mutexattr_settype(&recursiveAttr, PTHREAD_MUTEX_RECURSIVE);
        pthread_mutex_init(&p->mutex, &recursiveAttr);
        pthread_mutexattr_destroy(&recursiveAttr);
#endif
        p->id = iType;
      }
      break;
    }
    case SQLITE_MUTEX_FAST: {
      p = sqlite3MallocZero( sizeof(*p) );
      if( p ){
        p->id = iType;
        pthread_mutex_init(&p->mutex, 0);
      }
      break;
    }
    default: {
      assert( iType-2 >= 0 );
      assert( iType-2 < sizeof(staticMutexes)/sizeof(staticMutexes[0]) );
      p = &staticMutexes[iType-2];
      p->id = iType;
      break;
    }
  }
  return p;
}


/*
** This routine deallocates a previously
** allocated mutex.  SQLite is careful to deallocate every
** mutex that it allocates.
*/
static void pthreadMutexFree(sqlite3_mutex *p){
  assert( p->nRef==0 );
  assert( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE );
  pthread_mutex_destroy(&p->mutex);
  sqlite3_free(p);
}

/*
** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
** to enter a mutex.  If another thread is already within the mutex,
** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
** SQLITE_BUSY.  The sqlite3_mutex_try() interface returns SQLITE_OK
** upon successful entry.  Mutexes created using SQLITE_MUTEX_RECURSIVE can
** be entered multiple times by the same thread.  In such cases the,
** mutex must be exited an equal number of times before another thread
** can enter.  If the same thread tries to enter any other kind of mutex
** more than once, the behavior is undefined.
*/
static void pthreadMutexEnter(sqlite3_mutex *p){
  assert( p->id==SQLITE_MUTEX_RECURSIVE || pthreadMutexNotheld(p) );

#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
  /* If recursive mutexes are not available, then we have to grow
  ** our own.  This implementation assumes that pthread_equal()
  ** is atomic - that it cannot be deceived into thinking self
  ** and p->owner are equal if p->owner changes between two values
  ** that are not equal to self while the comparison is taking place.
  ** This implementation also assumes a coherent cache - that 
  ** separate processes cannot read different values from the same
  ** address at the same time.  If either of these two conditions
  ** are not met, then the mutexes will fail and problems will result.
  */
  {
    pthread_t self = pthread_self();
    if( p->nRef>0 && pthread_equal(p->owner, self) ){
      p->nRef++;
    }else{
      pthread_mutex_lock(&p->mutex);
      assert( p->nRef==0 );
      p->owner = self;
      p->nRef = 1;
    }
  }
#else
  /* Use the built-in recursive mutexes if they are available.
  */
  pthread_mutex_lock(&p->mutex);
  p->owner = pthread_self();
  p->nRef++;
#endif

#ifdef SQLITE_DEBUG
  if( p->trace ){
    printf("enter mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef);
  }
#endif
}
static int pthreadMutexTry(sqlite3_mutex *p){
  int rc;
  assert( p->id==SQLITE_MUTEX_RECURSIVE || pthreadMutexNotheld(p) );

#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
  /* If recursive mutexes are not available, then we have to grow
  ** our own.  This implementation assumes that pthread_equal()
  ** is atomic - that it cannot be deceived into thinking self
  ** and p->owner are equal if p->owner changes between two values
  ** that are not equal to self while the comparison is taking place.
  ** This implementation also assumes a coherent cache - that 
  ** separate processes cannot read different values from the same
  ** address at the same time.  If either of these two conditions
  ** are not met, then the mutexes will fail and problems will result.
  */
  {
    pthread_t self = pthread_self();
    if( p->nRef>0 && pthread_equal(p->owner, self) ){
      p->nRef++;
      rc = SQLITE_OK;
    }else if( pthread_mutex_trylock(&p->mutex)==0 ){
      assert( p->nRef==0 );
      p->owner = self;
      p->nRef = 1;
      rc = SQLITE_OK;
    }else{
      rc = SQLITE_BUSY;
    }
  }
#else
  /* Use the built-in recursive mutexes if they are available.
  */
  if( pthread_mutex_trylock(&p->mutex)==0 ){
    p->owner = pthread_self();
    p->nRef++;
    rc = SQLITE_OK;
  }else{
    rc = SQLITE_BUSY;
  }
#endif

#ifdef SQLITE_DEBUG
  if( rc==SQLITE_OK && p->trace ){
    printf("enter mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef);
  }
#endif
  return rc;
}

/*
** The sqlite3_mutex_leave() routine exits a mutex that was
** previously entered by the same thread.  The behavior
** is undefined if the mutex is not currently entered or
** is not currently allocated.  SQLite will never do either.
*/
static void pthreadMutexLeave(sqlite3_mutex *p){
  assert( pthreadMutexHeld(p) );
  p->nRef--;
  assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );

#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX
  if( p->nRef==0 ){
    pthread_mutex_unlock(&p->mutex);
  }
#else
  pthread_mutex_unlock(&p->mutex);
#endif

#ifdef SQLITE_DEBUG
  if( p->trace ){
    printf("leave mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef);
  }
#endif
}

sqlite3_mutex_methods *sqlite3DefaultMutex(void){
  static sqlite3_mutex_methods sMutex = {
    pthreadMutexInit,
    pthreadMutexEnd,
    pthreadMutexAlloc,
    pthreadMutexFree,
    pthreadMutexEnter,
    pthreadMutexTry,
    pthreadMutexLeave,
#ifdef SQLITE_DEBUG
    pthreadMutexHeld,
    pthreadMutexNotheld
#endif
  };

  return &sMutex;
}

#endif /* SQLITE_MUTEX_PTHREAD */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/mutex_w32.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
/*
** 2007 August 14
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains the C functions that implement mutexes for win32
**
** $Id: mutex_w32.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** The code in this file is only used if we are compiling multithreaded
** on a win32 system.
*/
#ifdef SQLITE_MUTEX_W32

/*
** Each recursive mutex is an instance of the following structure.
*/
struct sqlite3_mutex {
  CRITICAL_SECTION mutex;    /* Mutex controlling the lock */
  int id;                    /* Mutex type */
  int nRef;                  /* Number of enterances */
  DWORD owner;               /* Thread holding this mutex */
};

/*
** Return true (non-zero) if we are running under WinNT, Win2K, WinXP,
** or WinCE.  Return false (zero) for Win95, Win98, or WinME.
**
** Here is an interesting observation:  Win95, Win98, and WinME lack
** the LockFileEx() API.  But we can still statically link against that
** API as long as we don't call it win running Win95/98/ME.  A call to
** this routine is used to determine if the host is Win95/98/ME or
** WinNT/2K/XP so that we will know whether or not we can safely call
** the LockFileEx() API.
*/
#if SQLITE_OS_WINCE
# define mutexIsNT()  (1)
#else
  static int mutexIsNT(void){
    static int osType = 0;
    if( osType==0 ){
      OSVERSIONINFO sInfo;
      sInfo.dwOSVersionInfoSize = sizeof(sInfo);
      GetVersionEx(&sInfo);
      osType = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT ? 2 : 1;
    }
    return osType==2;
  }
#endif /* SQLITE_OS_WINCE */


#ifdef SQLITE_DEBUG
/*
** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are
** intended for use only inside assert() statements.
*/
static int winMutexHeld(sqlite3_mutex *p){
  return p->nRef!=0 && p->owner==GetCurrentThreadId();
}
static int winMutexNotheld(sqlite3_mutex *p){
  return p->nRef==0 || p->owner!=GetCurrentThreadId();
}
#endif


/*
** Initialize and deinitialize the mutex subsystem.
*/
static int winMutexInit(void){ return SQLITE_OK; }
static int winMutexEnd(void){ return SQLITE_OK; }

/*
** The sqlite3_mutex_alloc() routine allocates a new
** mutex and returns a pointer to it.  If it returns NULL
** that means that a mutex could not be allocated.  SQLite
** will unwind its stack and return an error.  The argument
** to sqlite3_mutex_alloc() is one of these integer constants:
**
** <ul>
** <li>  SQLITE_MUTEX_FAST               0
** <li>  SQLITE_MUTEX_RECURSIVE          1
** <li>  SQLITE_MUTEX_STATIC_MASTER      2
** <li>  SQLITE_MUTEX_STATIC_MEM         3
** <li>  SQLITE_MUTEX_STATIC_PRNG        4
** </ul>
**
** The first two constants cause sqlite3_mutex_alloc() to create
** a new mutex.  The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
** The mutex implementation does not need to make a distinction
** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
** not want to.  But SQLite will only request a recursive mutex in
** cases where it really needs one.  If a faster non-recursive mutex
** implementation is available on the host platform, the mutex subsystem
** might return such a mutex in response to SQLITE_MUTEX_FAST.
**
** The other allowed parameters to sqlite3_mutex_alloc() each return
** a pointer to a static preexisting mutex.  Three static mutexes are
** used by the current version of SQLite.  Future versions of SQLite
** may add additional static mutexes.  Static mutexes are for internal
** use by SQLite only.  Applications that use SQLite mutexes should
** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
** SQLITE_MUTEX_RECURSIVE.
**
** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
** returns a different mutex on every call.  But for the static 
** mutex types, the same mutex is returned on every call that has
** the same type number.
*/
static sqlite3_mutex *winMutexAlloc(int iType){
  sqlite3_mutex *p;

  switch( iType ){
    case SQLITE_MUTEX_FAST:
    case SQLITE_MUTEX_RECURSIVE: {
      p = sqlite3MallocZero( sizeof(*p) );
      if( p ){
        p->id = iType;
        InitializeCriticalSection(&p->mutex);
      }
      break;
    }
    default: {
      static sqlite3_mutex staticMutexes[6];
      static int isInit = 0;
      while( !isInit ){
        static long lock = 0;
        if( InterlockedIncrement(&lock)==1 ){
          int i;
          for(i=0; i<sizeof(staticMutexes)/sizeof(staticMutexes[0]); i++){
            InitializeCriticalSection(&staticMutexes[i].mutex);
          }
          isInit = 1;
        }else{
          Sleep(1);
        }
      }
      assert( iType-2 >= 0 );
      assert( iType-2 < sizeof(staticMutexes)/sizeof(staticMutexes[0]) );
      p = &staticMutexes[iType-2];
      p->id = iType;
      break;
    }
  }
  return p;
}


/*
** This routine deallocates a previously
** allocated mutex.  SQLite is careful to deallocate every
** mutex that it allocates.
*/
static void winMutexFree(sqlite3_mutex *p){
  assert( p );
  assert( p->nRef==0 );
  assert( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE );
  DeleteCriticalSection(&p->mutex);
  sqlite3_free(p);
}

/*
** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
** to enter a mutex.  If another thread is already within the mutex,
** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
** SQLITE_BUSY.  The sqlite3_mutex_try() interface returns SQLITE_OK
** upon successful entry.  Mutexes created using SQLITE_MUTEX_RECURSIVE can
** be entered multiple times by the same thread.  In such cases the,
** mutex must be exited an equal number of times before another thread
** can enter.  If the same thread tries to enter any other kind of mutex
** more than once, the behavior is undefined.
*/
static void winMutexEnter(sqlite3_mutex *p){
  assert( p->id==SQLITE_MUTEX_RECURSIVE || winMutexNotheld(p) );
  EnterCriticalSection(&p->mutex);
  p->owner = GetCurrentThreadId(); 
  p->nRef++;
}
static int winMutexTry(sqlite3_mutex *p){
  int rc = SQLITE_BUSY;
  assert( p->id==SQLITE_MUTEX_RECURSIVE || winMutexNotheld(p) );
  /*
  ** The sqlite3_mutex_try() routine is very rarely used, and when it
  ** is used it is merely an optimization.  So it is OK for it to always
  ** fail.  
  **
  ** The TryEnterCriticalSection() interface is only available on WinNT.
  ** And some windows compilers complain if you try to use it without
  ** first doing some #defines that prevent SQLite from building on Win98.
  ** For that reason, we will omit this optimization for now.  See
  ** ticket #2685.
  */
#if 0
  if( mutexIsNT() && TryEnterCriticalSection(&p->mutex) ){
    p->owner = GetCurrentThreadId();
    p->nRef++;
    rc = SQLITE_OK;
  }
#endif
  return rc;
}

/*
** The sqlite3_mutex_leave() routine exits a mutex that was
** previously entered by the same thread.  The behavior
** is undefined if the mutex is not currently entered or
** is not currently allocated.  SQLite will never do either.
*/
static void winMutexLeave(sqlite3_mutex *p){
  assert( p->nRef>0 );
  assert( p->owner==GetCurrentThreadId() );
  p->nRef--;
  assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE );
  LeaveCriticalSection(&p->mutex);
}

sqlite3_mutex_methods *sqlite3DefaultMutex(void){
  static sqlite3_mutex_methods sMutex = {
    winMutexInit,
    winMutexEnd,
    winMutexAlloc,
    winMutexFree,
    winMutexEnter,
    winMutexTry,
    winMutexLeave,
#ifdef SQLITE_DEBUG
    winMutexHeld,
    winMutexNotheld
#endif
  };

  return &sMutex;
}
#endif /* SQLITE_MUTEX_W32 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/opcodes.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/* 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)
const char *sqlite3OpcodeName(int i){
 static const char *const azName[] = { "?",
     /*   1 */ "VNext",
     /*   2 */ "Affinity",
     /*   3 */ "Column",
     /*   4 */ "SetCookie",
     /*   5 */ "Sequence",
     /*   6 */ "MoveGt",
     /*   7 */ "RowKey",
     /*   8 */ "SCopy",
     /*   9 */ "OpenWrite",
     /*  10 */ "If",
     /*  11 */ "VRowid",
     /*  12 */ "CollSeq",
     /*  13 */ "OpenRead",
     /*  14 */ "Expire",
     /*  15 */ "AutoCommit",
     /*  16 */ "Not",
     /*  17 */ "Pagecount",
     /*  18 */ "IntegrityCk",
     /*  19 */ "Sort",
     /*  20 */ "Copy",
     /*  21 */ "Trace",
     /*  22 */ "Function",
     /*  23 */ "IfNeg",
     /*  24 */ "Noop",
     /*  25 */ "Return",
     /*  26 */ "NewRowid",
     /*  27 */ "Variable",
     /*  28 */ "String",
     /*  29 */ "RealAffinity",
     /*  30 */ "VRename",
     /*  31 */ "ParseSchema",
     /*  32 */ "VOpen",
     /*  33 */ "Close",
     /*  34 */ "CreateIndex",
     /*  35 */ "IsUnique",
     /*  36 */ "NotFound",
     /*  37 */ "Int64",
     /*  38 */ "MustBeInt",
     /*  39 */ "Halt",
     /*  40 */ "Rowid",
     /*  41 */ "IdxLT",
     /*  42 */ "AddImm",
     /*  43 */ "Statement",
     /*  44 */ "RowData",
     /*  45 */ "MemMax",
     /*  46 */ "NotExists",
     /*  47 */ "Gosub",
     /*  48 */ "Integer",
     /*  49 */ "Prev",
     /*  50 */ "VColumn",
     /*  51 */ "CreateTable",
     /*  52 */ "Last",
     /*  53 */ "IncrVacuum",
     /*  54 */ "IdxRowid",
     /*  55 */ "ResetCount",
     /*  56 */ "FifoWrite",
     /*  57 */ "ContextPush",
     /*  58 */ "Yield",
     /*  59 */ "DropTrigger",
     /*  60 */ "Or",
     /*  61 */ "And",
     /*  62 */ "DropIndex",
     /*  63 */ "IdxGE",
     /*  64 */ "IdxDelete",
     /*  65 */ "IsNull",
     /*  66 */ "NotNull",
     /*  67 */ "Ne",
     /*  68 */ "Eq",
     /*  69 */ "Gt",
     /*  70 */ "Le",
     /*  71 */ "Lt",
     /*  72 */ "Ge",
     /*  73 */ "Vacuum",
     /*  74 */ "BitAnd",
     /*  75 */ "BitOr",
     /*  76 */ "ShiftLeft",
     /*  77 */ "ShiftRight",
     /*  78 */ "Add",
     /*  79 */ "Subtract",
     /*  80 */ "Multiply",
     /*  81 */ "Divide",
     /*  82 */ "Remainder",
     /*  83 */ "Concat",
     /*  84 */ "MoveLe",
     /*  85 */ "IfNot",
     /*  86 */ "DropTable",
     /*  87 */ "BitNot",
     /*  88 */ "String8",
     /*  89 */ "MakeRecord",
     /*  90 */ "ResultRow",
     /*  91 */ "Delete",
     /*  92 */ "AggFinal",
     /*  93 */ "Compare",
     /*  94 */ "Goto",
     /*  95 */ "TableLock",
     /*  96 */ "FifoRead",
     /*  97 */ "Clear",
     /*  98 */ "MoveLt",
     /*  99 */ "VerifyCookie",
     /* 100 */ "AggStep",
     /* 101 */ "SetNumColumns",
     /* 102 */ "Transaction",
     /* 103 */ "VFilter",
     /* 104 */ "VDestroy",
     /* 105 */ "ContextPop",
     /* 106 */ "Next",
     /* 107 */ "IdxInsert",
     /* 108 */ "Insert",
     /* 109 */ "Destroy",
     /* 110 */ "ReadCookie",
     /* 111 */ "ForceInt",
     /* 112 */ "LoadAnalysis",
     /* 113 */ "Explain",
     /* 114 */ "OpenPseudo",
     /* 115 */ "OpenEphemeral",
     /* 116 */ "Null",
     /* 117 */ "Move",
     /* 118 */ "Blob",
     /* 119 */ "Rewind",
     /* 120 */ "MoveGe",
     /* 121 */ "VBegin",
     /* 122 */ "VUpdate",
     /* 123 */ "IfZero",
     /* 124 */ "VCreate",
     /* 125 */ "Real",
     /* 126 */ "Found",
     /* 127 */ "IfPos",
     /* 128 */ "NullRow",
     /* 129 */ "Jump",
     /* 130 */ "Permutation",
     /* 131 */ "NotUsed_131",
     /* 132 */ "NotUsed_132",
     /* 133 */ "NotUsed_133",
     /* 134 */ "NotUsed_134",
     /* 135 */ "NotUsed_135",
     /* 136 */ "NotUsed_136",
     /* 137 */ "NotUsed_137",
     /* 138 */ "ToText",
     /* 139 */ "ToBlob",
     /* 140 */ "ToNumeric",
     /* 141 */ "ToInt",
     /* 142 */ "ToReal",
  };
  return azName[i];
}
#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































Deleted SQLite.Interop/splitsource/opcodes.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
/* 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_Real                               125   /* same as TK_FLOAT    */
#define OP_Sequence                             5
#define OP_MoveGt                               6
#define OP_Ge                                  72   /* same as TK_GE       */
#define OP_RowKey                               7
#define OP_SCopy                                8
#define OP_Eq                                  68   /* same as TK_EQ       */
#define OP_OpenWrite                            9
#define OP_NotNull                             66   /* same as TK_NOTNULL  */
#define OP_If                                  10
#define OP_ToInt                              141   /* same as TK_TO_INT   */
#define OP_String8                             88   /* same as TK_STRING   */
#define OP_VRowid                              11
#define OP_CollSeq                             12
#define OP_OpenRead                            13
#define OP_Expire                              14
#define OP_AutoCommit                          15
#define OP_Gt                                  69   /* same as TK_GT       */
#define OP_Pagecount                           17
#define OP_IntegrityCk                         18
#define OP_Sort                                19
#define OP_Copy                                20
#define OP_Trace                               21
#define OP_Function                            22
#define OP_IfNeg                               23
#define OP_And                                 61   /* same as TK_AND      */
#define OP_Subtract                            79   /* same as TK_MINUS    */
#define OP_Noop                                24
#define OP_Return                              25
#define OP_Remainder                           82   /* same as TK_REM      */
#define OP_NewRowid                            26
#define OP_Multiply                            80   /* same as TK_STAR     */
#define OP_Variable                            27
#define OP_String                              28
#define OP_RealAffinity                        29
#define OP_VRename                             30
#define OP_ParseSchema                         31
#define OP_VOpen                               32
#define OP_Close                               33
#define OP_CreateIndex                         34
#define OP_IsUnique                            35
#define OP_NotFound                            36
#define OP_Int64                               37
#define OP_MustBeInt                           38
#define OP_Halt                                39
#define OP_Rowid                               40
#define OP_IdxLT                               41
#define OP_AddImm                              42
#define OP_Statement                           43
#define OP_RowData                             44
#define OP_MemMax                              45
#define OP_Or                                  60   /* same as TK_OR       */
#define OP_NotExists                           46
#define OP_Gosub                               47
#define OP_Divide                              81   /* same as TK_SLASH    */
#define OP_Integer                             48
#define OP_ToNumeric                          140   /* same as TK_TO_NUMERIC*/
#define OP_Prev                                49
#define OP_Concat                              83   /* same as TK_CONCAT   */
#define OP_BitAnd                              74   /* same as TK_BITAND   */
#define OP_VColumn                             50
#define OP_CreateTable                         51
#define OP_Last                                52
#define OP_IsNull                              65   /* same as TK_ISNULL   */
#define OP_IncrVacuum                          53
#define OP_IdxRowid                            54
#define OP_ShiftRight                          77   /* same as TK_RSHIFT   */
#define OP_ResetCount                          55
#define OP_FifoWrite                           56
#define OP_ContextPush                         57
#define OP_Yield                               58
#define OP_DropTrigger                         59
#define OP_DropIndex                           62
#define OP_IdxGE                               63
#define OP_IdxDelete                           64
#define OP_Vacuum                              73
#define OP_MoveLe                              84
#define OP_IfNot                               85
#define OP_DropTable                           86
#define OP_MakeRecord                          89
#define OP_ToBlob                             139   /* same as TK_TO_BLOB  */
#define OP_ResultRow                           90
#define OP_Delete                              91
#define OP_AggFinal                            92
#define OP_Compare                             93
#define OP_ShiftLeft                           76   /* same as TK_LSHIFT   */
#define OP_Goto                                94
#define OP_TableLock                           95
#define OP_FifoRead                            96
#define OP_Clear                               97
#define OP_MoveLt                              98
#define OP_Le                                  70   /* same as TK_LE       */
#define OP_VerifyCookie                        99
#define OP_AggStep                            100
#define OP_ToText                             138   /* same as TK_TO_TEXT  */
#define OP_Not                                 16   /* same as TK_NOT      */
#define OP_ToReal                             142   /* same as TK_TO_REAL  */
#define OP_SetNumColumns                      101
#define OP_Transaction                        102
#define OP_VFilter                            103
#define OP_Ne                                  67   /* same as TK_NE       */
#define OP_VDestroy                           104
#define OP_ContextPop                         105
#define OP_BitOr                               75   /* same as TK_BITOR    */
#define OP_Next                               106
#define OP_IdxInsert                          107
#define OP_Lt                                  71   /* same as TK_LT       */
#define OP_Insert                             108
#define OP_Destroy                            109
#define OP_ReadCookie                         110
#define OP_ForceInt                           111
#define OP_LoadAnalysis                       112
#define OP_Explain                            113
#define OP_OpenPseudo                         114
#define OP_OpenEphemeral                      115
#define OP_Null                               116
#define OP_Move                               117
#define OP_Blob                               118
#define OP_Add                                 78   /* same as TK_PLUS     */
#define OP_Rewind                             119
#define OP_MoveGe                             120
#define OP_VBegin                             121
#define OP_VUpdate                            122
#define OP_IfZero                             123
#define OP_BitNot                              87   /* same as TK_BITNOT   */
#define OP_VCreate                            124
#define OP_Found                              126
#define OP_IfPos                              127
#define OP_NullRow                            128
#define OP_Jump                               129
#define OP_Permutation                        130

/* The following opcode values are never used */
#define OP_NotUsed_131                        131
#define OP_NotUsed_132                        132
#define OP_NotUsed_133                        133
#define OP_NotUsed_134                        134
#define OP_NotUsed_135                        135
#define OP_NotUsed_136                        136
#define OP_NotUsed_137                        137


/* Properties such as "out2" or "jump" that are specified in
** comments following the "case" for each opcode in the vdbe.c
** are encoded into bitvectors as follows:
*/
#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, 0x02, 0x11, 0x00,\
/*   8 */ 0x00, 0x00, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00,\
/*  16 */ 0x04, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05,\
/*  24 */ 0x00, 0x04, 0x02, 0x02, 0x02, 0x04, 0x00, 0x00,\
/*  32 */ 0x00, 0x00, 0x02, 0x11, 0x11, 0x02, 0x05, 0x00,\
/*  40 */ 0x02, 0x11, 0x04, 0x00, 0x00, 0x0c, 0x11, 0x01,\
/*  48 */ 0x02, 0x01, 0x00, 0x02, 0x01, 0x01, 0x02, 0x00,\
/*  56 */ 0x04, 0x00, 0x00, 0x00, 0x2c, 0x2c, 0x00, 0x11,\
/*  64 */ 0x00, 0x05, 0x05, 0x15, 0x15, 0x15, 0x15, 0x15,\
/*  72 */ 0x15, 0x00, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,\
/*  80 */ 0x2c, 0x2c, 0x2c, 0x2c, 0x11, 0x05, 0x00, 0x04,\
/*  88 */ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,\
/*  96 */ 0x01, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x01,\
/* 104 */ 0x00, 0x00, 0x01, 0x08, 0x00, 0x02, 0x02, 0x05,\
/* 112 */ 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x01,\
/* 120 */ 0x11, 0x00, 0x00, 0x05, 0x00, 0x02, 0x11, 0x05,\
/* 128 */ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
/* 136 */ 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04,}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































































Deleted SQLite.Interop/splitsource/os.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
/*
** 2005 November 29
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains OS interface code that is common to all
** architectures.
**
** $Id: os.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#define _SQLITE_OS_C_ 1
#include "sqliteInt.h"
#undef _SQLITE_OS_C_

/*
** The default SQLite sqlite3_vfs implementations do not allocate
** memory (actually, os_unix.c allocates a small amount of memory
** from within OsOpen()), but some third-party implementations may.
** So we test the effects of a malloc() failing and the sqlite3OsXXX()
** function returning SQLITE_IOERR_NOMEM using the DO_OS_MALLOC_TEST macro.
**
** The following functions are instrumented for malloc() failure 
** testing:
**
**     sqlite3OsOpen()
**     sqlite3OsRead()
**     sqlite3OsWrite()
**     sqlite3OsSync()
**     sqlite3OsLock()
**
*/
#if defined(SQLITE_TEST) && (SQLITE_OS_WIN==0) && 0
  #define DO_OS_MALLOC_TEST if (1) {            \
    void *pTstAlloc = sqlite3Malloc(10);       \
    if (!pTstAlloc) return SQLITE_IOERR_NOMEM;  \
    sqlite3_free(pTstAlloc);                    \
  }
#else
  #define DO_OS_MALLOC_TEST
#endif

/*
** The following routines are convenience wrappers around methods
** of the sqlite3_file object.  This is mostly just syntactic sugar. All
** of this would be completely automatic if SQLite were coded using
** C++ instead of plain old C.
*/
int sqlite3OsClose(sqlite3_file *pId){
  int rc = SQLITE_OK;
  if( pId->pMethods ){
    rc = pId->pMethods->xClose(pId);
    pId->pMethods = 0;
  }
  return rc;
}
int sqlite3OsRead(sqlite3_file *id, void *pBuf, int amt, i64 offset){
  DO_OS_MALLOC_TEST;
  return id->pMethods->xRead(id, pBuf, amt, offset);
}
int sqlite3OsWrite(sqlite3_file *id, const void *pBuf, int amt, i64 offset){
  DO_OS_MALLOC_TEST;
  return id->pMethods->xWrite(id, pBuf, amt, offset);
}
int sqlite3OsTruncate(sqlite3_file *id, i64 size){
  return id->pMethods->xTruncate(id, size);
}
int sqlite3OsSync(sqlite3_file *id, int flags){
  DO_OS_MALLOC_TEST;
  return id->pMethods->xSync(id, flags);
}
int sqlite3OsFileSize(sqlite3_file *id, i64 *pSize){
  DO_OS_MALLOC_TEST;
  return id->pMethods->xFileSize(id, pSize);
}
int sqlite3OsLock(sqlite3_file *id, int lockType){
  DO_OS_MALLOC_TEST;
  return id->pMethods->xLock(id, lockType);
}
int sqlite3OsUnlock(sqlite3_file *id, int lockType){
  return id->pMethods->xUnlock(id, lockType);
}
int sqlite3OsCheckReservedLock(sqlite3_file *id, int *pResOut){
  DO_OS_MALLOC_TEST;
  return id->pMethods->xCheckReservedLock(id, pResOut);
}
int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){
  return id->pMethods->xFileControl(id, op, pArg);
}
int sqlite3OsSectorSize(sqlite3_file *id){
  int (*xSectorSize)(sqlite3_file*) = id->pMethods->xSectorSize;
  return (xSectorSize ? xSectorSize(id) : SQLITE_DEFAULT_SECTOR_SIZE);
}
int sqlite3OsDeviceCharacteristics(sqlite3_file *id){
  return id->pMethods->xDeviceCharacteristics(id);
}

/*
** The next group of routines are convenience wrappers around the
** VFS methods.
*/
int sqlite3OsOpen(
  sqlite3_vfs *pVfs, 
  const char *zPath, 
  sqlite3_file *pFile, 
  int flags, 
  int *pFlagsOut
){
  DO_OS_MALLOC_TEST;
  return pVfs->xOpen(pVfs, zPath, pFile, flags, pFlagsOut);
}
int sqlite3OsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
  return pVfs->xDelete(pVfs, zPath, dirSync);
}
int sqlite3OsAccess(
  sqlite3_vfs *pVfs, 
  const char *zPath, 
  int flags, 
  int *pResOut
){
  DO_OS_MALLOC_TEST;
  return pVfs->xAccess(pVfs, zPath, flags, pResOut);
}
int sqlite3OsFullPathname(
  sqlite3_vfs *pVfs, 
  const char *zPath, 
  int nPathOut, 
  char *zPathOut
){
  return pVfs->xFullPathname(pVfs, zPath, nPathOut, zPathOut);
}
#ifndef SQLITE_OMIT_LOAD_EXTENSION
void *sqlite3OsDlOpen(sqlite3_vfs *pVfs, const char *zPath){
  return pVfs->xDlOpen(pVfs, zPath);
}
void sqlite3OsDlError(sqlite3_vfs *pVfs, int nByte, char *zBufOut){
  pVfs->xDlError(pVfs, nByte, zBufOut);
}
void *sqlite3OsDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol){
  return pVfs->xDlSym(pVfs, pHandle, zSymbol);
}
void sqlite3OsDlClose(sqlite3_vfs *pVfs, void *pHandle){
  pVfs->xDlClose(pVfs, pHandle);
}
#endif /* SQLITE_OMIT_LOAD_EXTENSION */
int sqlite3OsRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){
  return pVfs->xRandomness(pVfs, nByte, zBufOut);
}
int sqlite3OsSleep(sqlite3_vfs *pVfs, int nMicro){
  return pVfs->xSleep(pVfs, nMicro);
}
int sqlite3OsCurrentTime(sqlite3_vfs *pVfs, double *pTimeOut){
  return pVfs->xCurrentTime(pVfs, pTimeOut);
}

int sqlite3OsOpenMalloc(
  sqlite3_vfs *pVfs, 
  const char *zFile, 
  sqlite3_file **ppFile, 
  int flags,
  int *pOutFlags
){
  int rc = SQLITE_NOMEM;
  sqlite3_file *pFile;
  pFile = (sqlite3_file *)sqlite3Malloc(pVfs->szOsFile);
  if( pFile ){
    rc = sqlite3OsOpen(pVfs, zFile, pFile, flags, pOutFlags);
    if( rc!=SQLITE_OK ){
      sqlite3_free(pFile);
    }else{
      *ppFile = pFile;
    }
  }
  return rc;
}
int sqlite3OsCloseFree(sqlite3_file *pFile){
  int rc = SQLITE_OK;
  assert( pFile );
  rc = sqlite3OsClose(pFile);
  sqlite3_free(pFile);
  return rc;
}

/*
** The list of all registered VFS implementations.
*/
static sqlite3_vfs *vfsList = 0;

/*
** Locate a VFS by name.  If no name is given, simply return the
** first VFS on the list.
*/
sqlite3_vfs *sqlite3_vfs_find(const char *zVfs){
  sqlite3_vfs *pVfs = 0;
#ifndef SQLITE_MUTEX_NOOP
  sqlite3_mutex *mutex;
#endif
#ifndef SQLITE_OMIT_AUTOINIT
  int rc = sqlite3_initialize();
  if( rc ) return 0;
#endif
#ifndef SQLITE_MUTEX_NOOP
  mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
#endif
  sqlite3_mutex_enter(mutex);
  for(pVfs = vfsList; pVfs; pVfs=pVfs->pNext){
    if( zVfs==0 ) break;
    if( strcmp(zVfs, pVfs->zName)==0 ) break;
  }
  sqlite3_mutex_leave(mutex);
  return pVfs;
}

/*
** Unlink a VFS from the linked list
*/
static void vfsUnlink(sqlite3_vfs *pVfs){
  assert( sqlite3_mutex_held(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)) );
  if( pVfs==0 ){
    /* No-op */
  }else if( vfsList==pVfs ){
    vfsList = pVfs->pNext;
  }else if( vfsList ){
    sqlite3_vfs *p = vfsList;
    while( p->pNext && p->pNext!=pVfs ){
      p = p->pNext;
    }
    if( p->pNext==pVfs ){
      p->pNext = pVfs->pNext;
    }
  }
}

/*
** Register a VFS with the system.  It is harmless to register the same
** VFS multiple times.  The new VFS becomes the default if makeDflt is
** true.
*/
int sqlite3_vfs_register(sqlite3_vfs *pVfs, int makeDflt){
  sqlite3_mutex *mutex = 0;
#ifndef SQLITE_OMIT_AUTOINIT
  int rc = sqlite3_initialize();
  if( rc ) return rc;
#endif
  mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
  sqlite3_mutex_enter(mutex);
  vfsUnlink(pVfs);
  if( makeDflt || vfsList==0 ){
    pVfs->pNext = vfsList;
    vfsList = pVfs;
  }else{
    pVfs->pNext = vfsList->pNext;
    vfsList->pNext = pVfs;
  }
  assert(vfsList);
  sqlite3_mutex_leave(mutex);
  return SQLITE_OK;
}

/*
** Unregister a VFS so that it is no longer accessible.
*/
int sqlite3_vfs_unregister(sqlite3_vfs *pVfs){
#ifndef SQLITE_MUTEX_NOOP
  sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);
#endif
  sqlite3_mutex_enter(mutex);
  vfsUnlink(pVfs);
  sqlite3_mutex_leave(mutex);
  return SQLITE_OK;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/os.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
/*
** 2001 September 16
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This header file (together with is companion C source-code file
** "os.c") attempt to abstract the underlying operating system so that
** the SQLite library will work on both POSIX and windows systems.
**
** This header file is #include-ed by sqliteInt.h and thus ends up
** being included by every source file.
**
** $Id: os.h,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#ifndef _SQLITE_OS_H_
#define _SQLITE_OS_H_

/*
** Figure out if we are dealing with Unix, Windows, or some other
** operating system.  After the following block of preprocess macros,
** all of SQLITE_OS_UNIX, SQLITE_OS_WIN, SQLITE_OS_OS2, and SQLITE_OS_OTHER 
** will defined to either 1 or 0.  One of the four will be 1.  The other 
** three will be 0.
*/
#if defined(SQLITE_OS_OTHER)
# if SQLITE_OS_OTHER==1
#   undef SQLITE_OS_UNIX
#   define SQLITE_OS_UNIX 0
#   undef SQLITE_OS_WIN
#   define SQLITE_OS_WIN 0
#   undef SQLITE_OS_OS2
#   define SQLITE_OS_OS2 0
# else
#   undef SQLITE_OS_OTHER
# endif
#endif
#if !defined(SQLITE_OS_UNIX) && !defined(SQLITE_OS_OTHER)
# define SQLITE_OS_OTHER 0
# ifndef SQLITE_OS_WIN
#   if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__)
#     define SQLITE_OS_WIN 1
#     define SQLITE_OS_UNIX 0
#     define SQLITE_OS_OS2 0
#   elif defined(__EMX__) || defined(_OS2) || defined(OS2) || defined(_OS2_) || defined(__OS2__)
#     define SQLITE_OS_WIN 0
#     define SQLITE_OS_UNIX 0
#     define SQLITE_OS_OS2 1
#   else
#     define SQLITE_OS_WIN 0
#     define SQLITE_OS_UNIX 1
#     define SQLITE_OS_OS2 0
#  endif
# else
#  define SQLITE_OS_UNIX 0
#  define SQLITE_OS_OS2 0
# endif
#else
# ifndef SQLITE_OS_WIN
#  define SQLITE_OS_WIN 0
# endif
#endif

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


/*
** Define the maximum size of a temporary filename
*/
#if SQLITE_OS_WIN
# include <windows.h>
# define SQLITE_TEMPNAME_SIZE (MAX_PATH+50)
#elif SQLITE_OS_OS2
# if (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ >= 3) && defined(OS2_HIGH_MEMORY)
#  include <os2safe.h> /* has to be included before os2.h for linking to work */
# endif
# define INCL_DOSDATETIME
# define INCL_DOSFILEMGR
# define INCL_DOSERRORS
# define INCL_DOSMISC
# define INCL_DOSPROCESS
# define INCL_DOSMODULEMGR
# define INCL_DOSSEMAPHORES
# include <os2.h>
# include <uconv.h>
# define SQLITE_TEMPNAME_SIZE (CCHMAXPATHCOMP)
#else
# define SQLITE_TEMPNAME_SIZE 200
#endif

/* If the SET_FULLSYNC macro is not defined above, then make it
** a no-op
*/
#ifndef SET_FULLSYNC
# define SET_FULLSYNC(x,y)
#endif

/*
** The default size of a disk sector
*/
#ifndef SQLITE_DEFAULT_SECTOR_SIZE
# define SQLITE_DEFAULT_SECTOR_SIZE 512
#endif

/*
** Temporary files are named starting with this prefix followed by 16 random
** alphanumeric characters, and no file extension. They are stored in the
** OS's standard temporary file directory, and are deleted prior to exit.
** If sqlite is being embedded in another program, you may wish to change the
** prefix to reflect your program's name, so that if your program exits
** prematurely, old temporary files can be easily identified. This can be done
** using -DSQLITE_TEMP_FILE_PREFIX=myprefix_ on the compiler command line.
**
** 2006-10-31:  The default prefix used to be "sqlite_".  But then
** Mcafee started using SQLite in their anti-virus product and it
** started putting files with the "sqlite" name in the c:/temp folder.
** This annoyed many windows users.  Those users would then do a 
** Google search for "sqlite", find the telephone numbers of the
** developers and call to wake them up at night and complain.
** For this reason, the default name prefix is changed to be "sqlite" 
** spelled backwards.  So the temp files are still identified, but
** anybody smart enough to figure out the code is also likely smart
** enough to know that calling the developer will not help get rid
** of the file.
*/
#ifndef SQLITE_TEMP_FILE_PREFIX
# define SQLITE_TEMP_FILE_PREFIX "etilqs_"
#endif

/*
** The following values may be passed as the second argument to
** sqlite3OsLock(). The various locks exhibit the following semantics:
**
** SHARED:    Any number of processes may hold a SHARED lock simultaneously.
** RESERVED:  A single process may hold a RESERVED lock on a file at
**            any time. Other processes may hold and obtain new SHARED locks.
** PENDING:   A single process may hold a PENDING lock on a file at
**            any one time. Existing SHARED locks may persist, but no new
**            SHARED locks may be obtained by other processes.
** EXCLUSIVE: An EXCLUSIVE lock precludes all other locks.
**
** PENDING_LOCK may not be passed directly to sqlite3OsLock(). Instead, a
** process that requests an EXCLUSIVE lock may actually obtain a PENDING
** lock. This can be upgraded to an EXCLUSIVE lock by a subsequent call to
** sqlite3OsLock().
*/
#define NO_LOCK         0
#define SHARED_LOCK     1
#define RESERVED_LOCK   2
#define PENDING_LOCK    3
#define EXCLUSIVE_LOCK  4

/*
** File Locking Notes:  (Mostly about windows but also some info for Unix)
**
** We cannot use LockFileEx() or UnlockFileEx() on Win95/98/ME because
** those functions are not available.  So we use only LockFile() and
** UnlockFile().
**
** LockFile() prevents not just writing but also reading by other processes.
** A SHARED_LOCK is obtained by locking a single randomly-chosen 
** byte out of a specific range of bytes. The lock byte is obtained at 
** random so two separate readers can probably access the file at the 
** same time, unless they are unlucky and choose the same lock byte.
** An EXCLUSIVE_LOCK is obtained by locking all bytes in the range.
** There can only be one writer.  A RESERVED_LOCK is obtained by locking
** a single byte of the file that is designated as the reserved lock byte.
** A PENDING_LOCK is obtained by locking a designated byte different from
** the RESERVED_LOCK byte.
**
** On WinNT/2K/XP systems, LockFileEx() and UnlockFileEx() are available,
** which means we can use reader/writer locks.  When reader/writer locks
** are used, the lock is placed on the same range of bytes that is used
** for probabilistic locking in Win95/98/ME.  Hence, the locking scheme
** will support two or more Win95 readers or two or more WinNT readers.
** But a single Win95 reader will lock out all WinNT readers and a single
** WinNT reader will lock out all other Win95 readers.
**
** The following #defines specify the range of bytes used for locking.
** SHARED_SIZE is the number of bytes available in the pool from which
** a random byte is selected for a shared lock.  The pool of bytes for
** shared locks begins at SHARED_FIRST. 
**
** These #defines are available in sqlite_aux.h so that adaptors for
** connecting SQLite to other operating systems can use the same byte
** ranges for locking.  In particular, the same locking strategy and
** byte ranges are used for Unix.  This leaves open the possiblity of having
** clients on win95, winNT, and unix all talking to the same shared file
** and all locking correctly.  To do so would require that samba (or whatever
** tool is being used for file sharing) implements locks correctly between
** windows and unix.  I'm guessing that isn't likely to happen, but by
** using the same locking range we are at least open to the possibility.
**
** Locking in windows is manditory.  For this reason, we cannot store
** actual data in the bytes used for locking.  The pager never allocates
** the pages involved in locking therefore.  SHARED_SIZE is selected so
** that all locks will fit on a single page even at the minimum page size.
** PENDING_BYTE defines the beginning of the locks.  By default PENDING_BYTE
** is set high so that we don't have to allocate an unused page except
** for very large databases.  But one should test the page skipping logic 
** by setting PENDING_BYTE low and running the entire regression suite.
**
** Changing the value of PENDING_BYTE results in a subtly incompatible
** file format.  Depending on how it is changed, you might not notice
** the incompatibility right away, even running a full regression test.
** The default location of PENDING_BYTE is the first byte past the
** 1GB boundary.
**
*/
#ifndef SQLITE_TEST
#define PENDING_BYTE      0x40000000  /* First byte past the 1GB boundary */
#else
extern unsigned int sqlite3_pending_byte;
#define PENDING_BYTE sqlite3_pending_byte
#endif

#define RESERVED_BYTE     (PENDING_BYTE+1)
#define SHARED_FIRST      (PENDING_BYTE+2)
#define SHARED_SIZE       510

/* 
** Functions for accessing sqlite3_file methods 
*/
int sqlite3OsClose(sqlite3_file*);
int sqlite3OsRead(sqlite3_file*, void*, int amt, i64 offset);
int sqlite3OsWrite(sqlite3_file*, const void*, int amt, i64 offset);
int sqlite3OsTruncate(sqlite3_file*, i64 size);
int sqlite3OsSync(sqlite3_file*, int);
int sqlite3OsFileSize(sqlite3_file*, i64 *pSize);
int sqlite3OsLock(sqlite3_file*, int);
int sqlite3OsUnlock(sqlite3_file*, int);
int sqlite3OsCheckReservedLock(sqlite3_file *id, int *pResOut);
int sqlite3OsFileControl(sqlite3_file*,int,void*);
int sqlite3OsSectorSize(sqlite3_file *id);
int sqlite3OsDeviceCharacteristics(sqlite3_file *id);

/* 
** Functions for accessing sqlite3_vfs methods 
*/
int sqlite3OsOpen(sqlite3_vfs *, const char *, sqlite3_file*, int, int *);
int sqlite3OsDelete(sqlite3_vfs *, const char *, int);
int sqlite3OsAccess(sqlite3_vfs *, const char *, int, int *pResOut);
int sqlite3OsFullPathname(sqlite3_vfs *, const char *, int, char *);
#ifndef SQLITE_OMIT_LOAD_EXTENSION
void *sqlite3OsDlOpen(sqlite3_vfs *, const char *);
void sqlite3OsDlError(sqlite3_vfs *, int, char *);
void *sqlite3OsDlSym(sqlite3_vfs *, void *, const char *);
void sqlite3OsDlClose(sqlite3_vfs *, void *);
#endif /* SQLITE_OMIT_LOAD_EXTENSION */
int sqlite3OsRandomness(sqlite3_vfs *, int, char *);
int sqlite3OsSleep(sqlite3_vfs *, int);
int sqlite3OsCurrentTime(sqlite3_vfs *, double*);

/*
** Convenience functions for opening and closing files using 
** sqlite3_malloc() to obtain space for the file-handle structure.
*/
int sqlite3OsOpenMalloc(sqlite3_vfs *, const char *, sqlite3_file **, int,int*);
int sqlite3OsCloseFree(sqlite3_file *);

#endif /* _SQLITE_OS_H_ */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/os_common.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
** 2004 May 22
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains macros and a little bit of code that is common to
** all of the platform-specific files (os_*.c) and is #included into those
** files.
**
** This file should be #included by the os_*.c files only.  It is not a
** general purpose header file.
**
** $Id: os_common.h,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/
#ifndef _OS_COMMON_H_
#define _OS_COMMON_H_

/*
** At least two bugs have slipped in because we changed the MEMORY_DEBUG
** macro to SQLITE_DEBUG and some older makefiles have not yet made the
** switch.  The following code should catch this problem at compile-time.
*/
#ifdef MEMORY_DEBUG
# error "The MEMORY_DEBUG macro is obsolete.  Use SQLITE_DEBUG instead."
#endif


/*
 * When testing, this global variable stores the location of the
 * pending-byte in the database file.
 */
#ifdef SQLITE_TEST
unsigned int sqlite3_pending_byte = 0x40000000;
#endif

#ifdef SQLITE_DEBUG
int sqlite3OSTrace = 0;
#define OSTRACE1(X)         if( sqlite3OSTrace ) sqlite3DebugPrintf(X)
#define OSTRACE2(X,Y)       if( sqlite3OSTrace ) sqlite3DebugPrintf(X,Y)
#define OSTRACE3(X,Y,Z)     if( sqlite3OSTrace ) sqlite3DebugPrintf(X,Y,Z)
#define OSTRACE4(X,Y,Z,A)   if( sqlite3OSTrace ) sqlite3DebugPrintf(X,Y,Z,A)
#define OSTRACE5(X,Y,Z,A,B) if( sqlite3OSTrace ) sqlite3DebugPrintf(X,Y,Z,A,B)
#define OSTRACE6(X,Y,Z,A,B,C) \
    if(sqlite3OSTrace) sqlite3DebugPrintf(X,Y,Z,A,B,C)
#define OSTRACE7(X,Y,Z,A,B,C,D) \
    if(sqlite3OSTrace) sqlite3DebugPrintf(X,Y,Z,A,B,C,D)
#else
#define OSTRACE1(X)
#define OSTRACE2(X,Y)
#define OSTRACE3(X,Y,Z)
#define OSTRACE4(X,Y,Z,A)
#define OSTRACE5(X,Y,Z,A,B)
#define OSTRACE6(X,Y,Z,A,B,C)
#define OSTRACE7(X,Y,Z,A,B,C,D)
#endif

/*
** Macros for performance tracing.  Normally turned off.  Only works
** on i486 hardware.
*/
#ifdef SQLITE_PERFORMANCE_TRACE

/* 
** hwtime.h contains inline assembler code for implementing 
** high-performance timing routines.
*/
#include "hwtime.h"

static sqlite_uint64 g_start;
static sqlite_uint64 g_elapsed;
#define TIMER_START       g_start=sqlite3Hwtime()
#define TIMER_END         g_elapsed=sqlite3Hwtime()-g_start
#define TIMER_ELAPSED     g_elapsed
#else
#define TIMER_START
#define TIMER_END
#define TIMER_ELAPSED     ((sqlite_uint64)0)
#endif

/*
** If we compile with the SQLITE_TEST macro set, then the following block
** of code will give us the ability to simulate a disk I/O error.  This
** is used for testing the I/O recovery logic.
*/
#ifdef SQLITE_TEST
int sqlite3_io_error_hit = 0;            /* Total number of I/O Errors */
int sqlite3_io_error_hardhit = 0;        /* Number of non-benign errors */
int sqlite3_io_error_pending = 0;        /* Count down to first I/O error */
int sqlite3_io_error_persist = 0;        /* True if I/O errors persist */
int sqlite3_io_error_benign = 0;         /* True if errors are benign */
int sqlite3_diskfull_pending = 0;
int sqlite3_diskfull = 0;
#define SimulateIOErrorBenign(X) sqlite3_io_error_benign=(X)
#define SimulateIOError(CODE)  \
  if( (sqlite3_io_error_persist && sqlite3_io_error_hit) \
       || sqlite3_io_error_pending-- == 1 )  \
              { local_ioerr(); CODE; }
static void local_ioerr(){
  IOTRACE(("IOERR\n"));
  sqlite3_io_error_hit++;
  if( !sqlite3_io_error_benign ) sqlite3_io_error_hardhit++;
}
#define SimulateDiskfullError(CODE) \
   if( sqlite3_diskfull_pending ){ \
     if( sqlite3_diskfull_pending == 1 ){ \
       local_ioerr(); \
       sqlite3_diskfull = 1; \
       sqlite3_io_error_hit = 1; \
       CODE; \
     }else{ \
       sqlite3_diskfull_pending--; \
     } \
   }
#else
#define SimulateIOErrorBenign(X)
#define SimulateIOError(A)
#define SimulateDiskfullError(A)
#endif

/*
** When testing, keep a count of the number of open files.
*/
#ifdef SQLITE_TEST
int sqlite3_open_file_count = 0;
#define OpenCounter(X)  sqlite3_open_file_count+=(X)
#else
#define OpenCounter(X)
#endif

#endif /* !defined(_OS_COMMON_H_) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































Deleted SQLite.Interop/splitsource/os_os2.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
/*
** 2006 Feb 14
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains code that is specific to OS/2.
**
** $Id: os_os2.c,v 1.1 2008/08/06 21:48:06 rmsimpson Exp $
*/

#include "sqliteInt.h"

#if SQLITE_OS_OS2

/*
** A Note About Memory Allocation:
**
** This driver uses malloc()/free() directly rather than going through
** the SQLite-wrappers sqlite3_malloc()/sqlite3_free().  Those wrappers
** are designed for use on embedded systems where memory is scarce and
** malloc failures happen frequently.  OS/2 does not typically run on
** embedded systems, and when it does the developers normally have bigger
** problems to worry about than running out of memory.  So there is not
** a compelling need to use the wrappers.
**
** But there is a good reason to not use the wrappers.  If we use the
** wrappers then we will get simulated malloc() failures within this
** driver.  And that causes all kinds of problems for our tests.  We
** could enhance SQLite to deal with simulated malloc failures within
** the OS driver, but the code to deal with those failure would not
** be exercised on Linux (which does not need to malloc() in the driver)
** and so we would have difficulty writing coverage tests for that
** code.  Better to leave the code out, we think.
**
** The point of this discussion is as follows:  When creating a new
** OS layer for an embedded system, if you use this file as an example,
** avoid the use of malloc()/free().  Those routines work ok on OS/2
** desktops but not so well in embedded systems.
*/

/*
** Macros used to determine whether or not to use threads.
*/
#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE
# define SQLITE_OS2_THREADS 1
#endif

/*
** Include code that is common to all os_*.c files
*/
#include "os_common.h"

/*
** The os2File structure is subclass of sqlite3_file specific for the OS/2
** protability layer.
*/
typedef struct os2File os2File;
struct os2File {
  const sqlite3_io_methods *pMethod;  /* Always the first entry */
  HFILE h;                  /* Handle for accessing the file */
  char* pathToDel;          /* Name of file to delete on close, NULL if not */
  unsigned char locktype;   /* Type of lock currently held on this file */
};

#define LOCK_TIMEOUT 10L /* the default locking timeout */

/*****************************************************************************
** The next group of routines implement the I/O methods specified
** by the sqlite3_io_methods object.
******************************************************************************/

/*
** Close a file.
*/
static int os2Close( sqlite3_file *id ){
  APIRET rc = NO_ERROR;
  os2File *pFile;
  if( id && (pFile = (os2File*)id) != 0 ){
    OSTRACE2( "CLOSE %d\n", pFile->h );
    rc = DosClose( pFile->h );
    pFile->locktype = NO_LOCK;
    if( pFile->pathToDel != NULL ){
      rc = DosForceDelete( (PSZ)pFile->pathToDel );
      free( pFile->pathToDel );
      pFile->pathToDel = NULL;
    }
    id = 0;
    OpenCounter( -1 );
  }

  return rc == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;
}

/*
** Read data from a file into a buffer.  Return SQLITE_OK if all
** bytes were read successfully and SQLITE_IOERR if anything goes
** wrong.
*/
static int os2Read(
  sqlite3_file *id,               /* File to read from */
  void *pBuf,                     /* Write content into this buffer */
  int amt,                        /* Number of bytes to read */
  sqlite3_int64 offset            /* Begin reading at this offset */
){
  ULONG fileLocation = 0L;
  ULONG got;
  os2File *pFile = (os2File*)id;
  assert( id!=0 );
  SimulateIOError( return SQLITE_IOERR_READ );
  OSTRACE3( "READ %d lock=%d\n", pFile->h, pFile->locktype );
  if( DosSetFilePtr(pFile->h, offset, FILE_BEGIN, &fileLocation) != NO_ERROR ){
    return SQLITE_IOERR;
  }
  if( DosRead( pFile->h, pBuf, amt, &got ) != NO_ERROR ){
    return SQLITE_IOERR_READ;
  }
  if( got == (ULONG)amt )
    return SQLITE_OK;
  else {
    memset(&((char*)pBuf)[got], 0, amt-got);
    return SQLITE_IOERR_SHORT_READ;
  }
}

/*
** Write data from a buffer into a file.  Return SQLITE_OK on success
** or some other error code on failure.
*/
static int os2Write(
  sqlite3_file *id,               /* File to write into */
  const void *pBuf,               /* The bytes to be written */
  int amt,                        /* Number of bytes to write */
  sqlite3_int64 offset            /* Offset into the file to begin writing at */
){
  ULONG fileLocation = 0L;
  APIRET rc = NO_ERROR;
  ULONG wrote;
  os2File *pFile = (os2File*)id;
  assert( id!=0 );
  SimulateIOError( return SQLITE_IOERR_WRITE );
  SimulateDiskfullError( return SQLITE_FULL );
  OSTRACE3( "WRITE %d lock=%d\n", pFile->h, pFile->locktype );
  if( DosSetFilePtr(pFile->h, offset, FILE_BEGIN, &fileLocation) != NO_ERROR ){
    return SQLITE_IOERR;
  }
  assert( amt>0 );
  while( amt > 0 &&
         ( rc = DosWrite( pFile->h, (PVOID)pBuf, amt, &wrote ) ) == NO_ERROR &&
         wrote > 0
  ){
    amt -= wrote;
    pBuf = &((char*)pBuf)[wrote];
  }

  return ( rc != NO_ERROR || amt > (int)wrote ) ? SQLITE_FULL : SQLITE_OK;
}

/*
** Truncate an open file to a specified size
*/
static int os2Truncate( sqlite3_file *id, i64 nByte ){
  APIRET rc = NO_ERROR;
  os2File *pFile = (os2File*)id;
  OSTRACE3( "TRUNCATE %d %lld\n", pFile->h, nByte );
  SimulateIOError( return SQLITE_IOERR_TRUNCATE );
  rc = DosSetFileSize( pFile->h, nByte );
  return rc == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;
}

#ifdef SQLITE_TEST
/*
** Count the number of fullsyncs and normal syncs.  This is used to test
** that syncs and fullsyncs are occuring at the right times.
*/
int sqlite3_sync_count = 0;
int sqlite3_fullsync_count = 0;
#endif

/*
** Make sure all writes to a particular file are committed to disk.
*/
static int os2Sync( sqlite3_file *id, int flags ){
  os2File *pFile = (os2File*)id;
  OSTRACE3( "SYNC %d lock=%d\n", pFile->h, pFile->locktype );
#ifdef SQLITE_TEST
  if( flags & SQLITE_SYNC_FULL){
    sqlite3_fullsync_count++;
  }
  sqlite3_sync_count++;
#endif
  return DosResetBuffer( pFile->h ) == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;
}

/*
** Determine the current size of a file in bytes
*/
static int os2FileSize( sqlite3_file *id, sqlite3_int64 *pSize ){
  APIRET rc = NO_ERROR;
  FILESTATUS3 fsts3FileInfo;
  memset(&fsts3FileInfo, 0, sizeof(fsts3FileInfo));
  assert( id!=0 );
  SimulateIOError( return SQLITE_IOERR );
  rc = DosQueryFileInfo( ((os2File*)id)->h, FIL_STANDARD, &fsts3FileInfo, sizeof(FILESTATUS3) );
  if( rc == NO_ERROR ){
    *pSize = fsts3FileInfo.cbFile;
    return SQLITE_OK;
  }else{
    return SQLITE_IOERR;
  }
}

/*
** Acquire a reader lock.
*/
static int getReadLock( os2File *pFile ){
  FILELOCK  LockArea,
            UnlockArea;
  APIRET res;
  memset(&LockArea, 0, sizeof(LockArea));
  memset(&UnlockArea, 0, sizeof(UnlockArea));
  LockArea.lOffset = SHARED_FIRST;
  LockArea.lRange = SHARED_SIZE;
  UnlockArea.lOffset = 0L;
  UnlockArea.lRange = 0L;
  res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 1L );
  OSTRACE3( "GETREADLOCK %d res=%d\n", pFile->h, res );
  return res;
}

/*
** Undo a readlock
*/
static int unlockReadLock( os2File *id ){
  FILELOCK  LockArea,
            UnlockArea;
  APIRET res;
  memset(&LockArea, 0, sizeof(LockArea));
  memset(&UnlockArea, 0, sizeof(UnlockArea));
  LockArea.lOffset = 0L;
  LockArea.lRange = 0L;
  UnlockArea.lOffset = SHARED_FIRST;
  UnlockArea.lRange = SHARED_SIZE;
  res = DosSetFileLocks( id->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 1L );
  OSTRACE3( "UNLOCK-READLOCK file handle=%d res=%d?\n", id->h, res );
  return res;
}

/*
** Lock the file with the lock specified by parameter locktype - one
** of the following:
**
**     (1) SHARED_LOCK
**     (2) RESERVED_LOCK
**     (3) PENDING_LOCK
**     (4) EXCLUSIVE_LOCK
**
** Sometimes when requesting one lock state, additional lock states
** are inserted in between.  The locking might fail on one of the later
** transitions leaving the lock state different from what it started but
** still short of its goal.  The following chart shows the allowed
** transitions and the inserted intermediate states:
**
**    UNLOCKED -> SHARED
**    SHARED -> RESERVED
**    SHARED -> (PENDING) -> EXCLUSIVE
**    RESERVED -> (PENDING) -> EXCLUSIVE
**    PENDING -> EXCLUSIVE
**
** This routine will only increase a lock.  The os2Unlock() routine
** erases all locks at once and returns us immediately to locking level 0.
** It is not possible to lower the locking level one step at a time.  You
** must go straight to locking level 0.
*/
static int os2Lock( sqlite3_file *id, int locktype ){
  int rc = SQLITE_OK;       /* Return code from subroutines */
  APIRET res = NO_ERROR;    /* Result of an OS/2 lock call */
  int newLocktype;       /* Set pFile->locktype to this value before exiting */
  int gotPendingLock = 0;/* True if we acquired a PENDING lock this time */
  FILELOCK  LockArea,
            UnlockArea;
  os2File *pFile = (os2File*)id;
  memset(&LockArea, 0, sizeof(LockArea));
  memset(&UnlockArea, 0, sizeof(UnlockArea));
  assert( pFile!=0 );
  OSTRACE4( "LOCK %d %d was %d\n", pFile->h, locktype, pFile->locktype );

  /* If there is already a lock of this type or more restrictive on the
  ** os2File, do nothing. Don't use the end_lock: exit path, as
  ** sqlite3_mutex_enter() hasn't been called yet.
  */
  if( pFile->locktype>=locktype ){
    OSTRACE3( "LOCK %d %d ok (already held)\n", pFile->h, locktype );
    return SQLITE_OK;
  }

  /* Make sure the locking sequence is correct
  */
  assert( pFile->locktype!=NO_LOCK || locktype==SHARED_LOCK );
  assert( locktype!=PENDING_LOCK );
  assert( locktype!=RESERVED_LOCK || pFile->locktype==SHARED_LOCK );

  /* Lock the PENDING_LOCK byte if we need to acquire a PENDING lock or
  ** a SHARED lock.  If we are acquiring a SHARED lock, the acquisition of
  ** the PENDING_LOCK byte is temporary.
  */
  newLocktype = pFile->locktype;
  if( pFile->locktype==NO_LOCK
      || (locktype==EXCLUSIVE_LOCK && pFile->locktype==RESERVED_LOCK)
  ){
    LockArea.lOffset = PENDING_BYTE;
    LockArea.lRange = 1L;
    UnlockArea.lOffset = 0L;
    UnlockArea.lRange = 0L;

    /* wait longer than LOCK_TIMEOUT here not to have to try multiple times */
    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, 100L, 0L );
    if( res == NO_ERROR ){
      gotPendingLock = 1;
      OSTRACE3( "LOCK %d pending lock boolean set.  res=%d\n", pFile->h, res );
    }
  }

  /* Acquire a shared lock
  */
  if( locktype==SHARED_LOCK && res == NO_ERROR ){
    assert( pFile->locktype==NO_LOCK );
    res = getReadLock(pFile);
    if( res == NO_ERROR ){
      newLocktype = SHARED_LOCK;
    }
    OSTRACE3( "LOCK %d acquire shared lock. res=%d\n", pFile->h, res );
  }

  /* Acquire a RESERVED lock
  */
  if( locktype==RESERVED_LOCK && res == NO_ERROR ){
    assert( pFile->locktype==SHARED_LOCK );
    LockArea.lOffset = RESERVED_BYTE;
    LockArea.lRange = 1L;
    UnlockArea.lOffset = 0L;
    UnlockArea.lRange = 0L;
    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
    if( res == NO_ERROR ){
      newLocktype = RESERVED_LOCK;
    }
    OSTRACE3( "LOCK %d acquire reserved lock. res=%d\n", pFile->h, res );
  }

  /* Acquire a PENDING lock
  */
  if( locktype==EXCLUSIVE_LOCK && res == NO_ERROR ){
    newLocktype = PENDING_LOCK;
    gotPendingLock = 0;
    OSTRACE2( "LOCK %d acquire pending lock. pending lock boolean unset.\n", pFile->h );
  }

  /* Acquire an EXCLUSIVE lock
  */
  if( locktype==EXCLUSIVE_LOCK && res == NO_ERROR ){
    assert( pFile->locktype>=SHARED_LOCK );
    res = unlockReadLock(pFile);
    OSTRACE2( "unreadlock = %d\n", res );
    LockArea.lOffset = SHARED_FIRST;
    LockArea.lRange = SHARED_SIZE;
    UnlockArea.lOffset = 0L;
    UnlockArea.lRange = 0L;
    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
    if( res == NO_ERROR ){
      newLocktype = EXCLUSIVE_LOCK;
    }else{
      OSTRACE2( "OS/2 error-code = %d\n", res );
      getReadLock(pFile);
    }
    OSTRACE3( "LOCK %d acquire exclusive lock.  res=%d\n", pFile->h, res );
  }

  /* If we are holding a PENDING lock that ought to be released, then
  ** release it now.
  */
  if( gotPendingLock && locktype==SHARED_LOCK ){
    int r;
    LockArea.lOffset = 0L;
    LockArea.lRange = 0L;
    UnlockArea.lOffset = PENDING_BYTE;
    UnlockArea.lRange = 1L;
    r = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
    OSTRACE3( "LOCK %d unlocking pending/is shared. r=%d\n", pFile->h, r );
  }

  /* Update the state of the lock has held in the file descriptor then
  ** return the appropriate result code.
  */
  if( res == NO_ERROR ){
    rc = SQLITE_OK;
  }else{
    OSTRACE4( "LOCK FAILED %d trying for %d but got %d\n", pFile->h,
              locktype, newLocktype );
    rc = SQLITE_BUSY;
  }
  pFile->locktype = newLocktype;
  OSTRACE3( "LOCK %d now %d\n", pFile->h, pFile->locktype );
  return rc;
}

/*
** This routine checks if there is a RESERVED lock held on the specified
** file by this or any other process. If such a lock is held, return
** non-zero, otherwise zero.
*/
static int os2CheckReservedLock( sqlite3_file *id, int *pOut ){
  int r = 0;
  os2File *pFile = (os2File*)id;
  assert( pFile!=0 );
  if( pFile->locktype>=RESERVED_LOCK ){
    r = 1;
    OSTRACE3( "TEST WR-LOCK %d %d (local)\n", pFile->h, r );
  }else{
    FILELOCK  LockArea,
              UnlockArea;
    APIRET rc = NO_ERROR;
    memset(&LockArea, 0, sizeof(LockArea));
    memset(&UnlockArea, 0, sizeof(UnlockArea));
    LockArea.lOffset = RESERVED_BYTE;
    LockArea.lRange = 1L;
    UnlockArea.lOffset = 0L;
    UnlockArea.lRange = 0L;
    rc = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
    OSTRACE3( "TEST WR-LOCK %d lock reserved byte rc=%d\n", pFile->h, rc );
    if( rc == NO_ERROR ){
      APIRET rcu = NO_ERROR; /* return code for unlocking */
      LockArea.lOffset = 0L;
      LockArea.lRange = 0L;
      UnlockArea.lOffset = RESERVED_BYTE;
      UnlockArea.lRange = 1L;
      rcu = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
      OSTRACE3( "TEST WR-LOCK %d unlock reserved byte r=%d\n", pFile->h, rcu );
    }
    r = !(rc == NO_ERROR);
    OSTRACE3( "TEST WR-LOCK %d %d (remote)\n", pFile->h, r );
  }
  *pOut = r;
  return SQLITE_OK;
}

/*
** Lower the locking level on file descriptor id to locktype.  locktype
** must be either NO_LOCK or SHARED_LOCK.
**
** If the locking level of the file descriptor is already at or below
** the requested locking level, this routine is a no-op.
**
** It is not possible for this routine to fail if the second argument
** is NO_LOCK.  If the second argument is SHARED_LOCK then this routine
** might return SQLITE_IOERR;
*/
static int os2Unlock( sqlite3_file *id, int locktype ){
  int type;
  os2File *pFile = (os2File*)id;
  APIRET rc = SQLITE_OK;
  APIRET res = NO_ERROR;
  FILELOCK  LockArea,
            UnlockArea;
  memset(&LockArea, 0, sizeof(LockArea));
  memset(&UnlockArea, 0, sizeof(UnlockArea));
  assert( pFile!=0 );
  assert( locktype<=SHARED_LOCK );
  OSTRACE4( "UNLOCK %d to %d was %d\n", pFile->h, locktype, pFile->locktype );
  type = pFile->locktype;
  if( type>=EXCLUSIVE_LOCK ){
    LockArea.lOffset = 0L;
    LockArea.lRange = 0L;
    UnlockArea.lOffset = SHARED_FIRST;
    UnlockArea.lRange = SHARED_SIZE;
    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
    OSTRACE3( "UNLOCK %d exclusive lock res=%d\n", pFile->h, res );
    if( locktype==SHARED_LOCK && getReadLock(pFile) != NO_ERROR ){
      /* This should never happen.  We should always be able to
      ** reacquire the read lock */
      OSTRACE3( "UNLOCK %d to %d getReadLock() failed\n", pFile->h, locktype );
      rc = SQLITE_IOERR_UNLOCK;
    }
  }
  if( type>=RESERVED_LOCK ){
    LockArea.lOffset = 0L;
    LockArea.lRange = 0L;
    UnlockArea.lOffset = RESERVED_BYTE;
    UnlockArea.lRange = 1L;
    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
    OSTRACE3( "UNLOCK %d reserved res=%d\n", pFile->h, res );
  }
  if( locktype==NO_LOCK && type>=SHARED_LOCK ){
    res = unlockReadLock(pFile);
    OSTRACE5( "UNLOCK %d is %d want %d res=%d\n", pFile->h, type, locktype, res );
  }
  if( type>=PENDING_LOCK ){
    LockArea.lOffset = 0L;
    LockArea.lRange = 0L;
    UnlockArea.lOffset = PENDING_BYTE;
    UnlockArea.lRange = 1L;
    res = DosSetFileLocks( pFile->h, &UnlockArea, &LockArea, LOCK_TIMEOUT, 0L );
    OSTRACE3( "UNLOCK %d pending res=%d\n", pFile->h, res );
  }
  pFile->locktype = locktype;
  OSTRACE3( "UNLOCK %d now %d\n", pFile->h, pFile->locktype );
  return rc;
}

/*
** Control and query of the open file handle.
*/
static int os2FileControl(sqlite3_file *id, int op, void *pArg){
  switch( op ){
    case SQLITE_FCNTL_LOCKSTATE: {
      *(int*)pArg = ((os2File*)id)->locktype;
      OSTRACE3( "FCNTL_LOCKSTATE %d lock=%d\n", ((os2File*)id)->h, ((os2File*)id)->locktype );
      return SQLITE_OK;
    }
  }
  return SQLITE_ERROR;
}

/*
** Return the sector size in bytes of the underlying block device for
** the specified file. This is almost always 512 bytes, but may be
** larger for some devices.
**
** SQLite code assumes this function cannot fail. It also assumes that
** if two files are created in the same file-system directory (i.e.
** a database and its journal file) that the sector size will be the
** same for both.
*/
static int os2SectorSize(sqlite3_file *id){
  return SQLITE_DEFAULT_SECTOR_SIZE;
}

/*
** Return a vector of device characteristics.
*/
static int os2DeviceCharacteristics(sqlite3_file *id){
  return 0;
}


/*
** Character set conversion objects used by conversion routines.
*/
static UconvObject ucUtf8 = NULL; /* convert between UTF-8 and UCS-2 */
static UconvObject uclCp = NULL;  /* convert between local codepage and UCS-2 */

/*
** Helper function to initialize the conversion objects from and to UTF-8.
*/
static void initUconvObjects( void ){
  if( UniCreateUconvObject( UTF_8, &ucUtf8 ) != ULS_SUCCESS )
    ucUtf8 = NULL;
  if ( UniCreateUconvObject( (UniChar *)L"@path=yes", &uclCp ) != ULS_SUCCESS )
    uclCp = NULL;
}

/*
** Helper function to free the conversion objects from and to UTF-8.
*/
static void freeUconvObjects( void ){
  if ( ucUtf8 )
    UniFreeUconvObject( ucUtf8 );
  if ( uclCp )
    UniFreeUconvObject( uclCp );
  ucUtf8 = NULL;
  uclCp = NULL;
}

/*
** Helper function to convert UTF-8 filenames to local OS/2 codepage.
** The two-step process: first convert the incoming UTF-8 string
** into UCS-2 and then from UCS-2 to the current codepage.
** The returned char pointer has to be freed.
*/
static char *convertUtf8PathToCp( const char *in ){
  UniChar tempPath[CCHMAXPATH];
  char *out = (char *)calloc( CCHMAXPATH, 1 );

  if( !out )
    return NULL;

  if( !ucUtf8 || !uclCp )
    initUconvObjects();

  /* determine string for the conversion of UTF-8 which is CP1208 */
  if( UniStrToUcs( ucUtf8, tempPath, (char *)in, CCHMAXPATH ) != ULS_SUCCESS )
    return out; /* if conversion fails, return the empty string */

  /* conversion for current codepage which can be used for paths */
  UniStrFromUcs( uclCp, out, tempPath, CCHMAXPATH );

  return out;
}

/*
** Helper function to convert filenames from local codepage to UTF-8.
** The two-step process: first convert the incoming codepage-specific
** string into UCS-2 and then from UCS-2 to the codepage of UTF-8.
** The returned char pointer has to be freed.
**
** This function is non-static to be able to use this in shell.c and
** similar applications that take command line arguments.
*/
char *convertCpPathToUtf8( const char *in ){
  UniChar tempPath[CCHMAXPATH];
  char *out = (char *)calloc( CCHMAXPATH, 1 );

  if( !out )
    return NULL;

  if( !ucUtf8 || !uclCp )
    initUconvObjects();

  /* conversion for current codepage which can be used for paths */
  if( UniStrToUcs( uclCp, tempPath, (char *)in, CCHMAXPATH ) != ULS_SUCCESS )
    return out; /* if conversion fails, return the empty string */

  /* determine string for the conversion of UTF-8 which is CP1208 */
  UniStrFromUcs( ucUtf8, out, tempPath, CCHMAXPATH );

  return out;
}

/*
** This vector defines all the methods that can operate on an
** sqlite3_file for os2.
*/
static const sqlite3_io_methods os2IoMethod = {
  1,                        /* iVersion */
  os2Close,
  os2Read,
  os2Write,
  os2Truncate,
  os2Sync,
  os2FileSize,
  os2Lock,
  os2Unlock,
  os2CheckReservedLock,
  os2FileControl,
  os2SectorSize,
  os2DeviceCharacteristics
};

/***************************************************************************
** Here ends the I/O methods that form the sqlite3_io_methods object.
**
** The next block of code implements the VFS methods.
****************************************************************************/

/*
** Create a temporary file name in zBuf.  zBuf must be big enough to
** hold at pVfs->mxPathname characters.
*/
static int getTempname(int nBuf, char *zBuf ){
  static const unsigned char zChars[] =
    "abcdefghijklmnopqrstuvwxyz"
    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    "0123456789";
  int i, j;
  char zTempPathBuf[3];
  PSZ zTempPath = (PSZ)&zTempPathBuf;
  if( sqlite3_temp_directory ){
    zTempPath = sqlite3_temp_directory;
  }else{
    if( DosScanEnv( (PSZ)"TEMP", &zTempPath ) ){
      if( DosScanEnv( (PSZ)"TMP", &zTempPath ) ){
        if( DosScanEnv( (PSZ)"TMPDIR", &zTempPath ) ){
           ULONG ulDriveNum = 0, ulDriveMap = 0;
           DosQueryCurrentDisk( &ulDriveNum, &ulDriveMap );
           sprintf( (char*)zTempPath, "%c:", (char)( 'A' + ulDriveNum - 1 ) );
        }
      }
    }
  }
  /* Strip off a trailing slashes or backslashes, otherwise we would get *
   * multiple (back)slashes which causes DosOpen() to fail.              *
   * Trailing spaces are not allowed, either.                            */
  j = strlen(zTempPath);
  while( j > 0 && ( zTempPath[j-1] == '\\' || zTempPath[j-1] == '/'
                    || zTempPath[j-1] == ' ' ) ){
    j--;
  }
  zTempPath[j] = '\0';
  if( !sqlite3_temp_directory ){
    char *zTempPathUTF = convertCpPathToUtf8( zTempPath );
    sqlite3_snprintf( nBuf-30, zBuf,
                      "%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPathUTF );
    free( zTempPathUTF );
  }else{
    sqlite3_snprintf( nBuf-30, zBuf,
                      "%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPath );
  }
  j = strlen( zBuf );
  sqlite3_randomness( 20, &zBuf[j] );
  for( i = 0; i < 20; i++, j++ ){
    zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
  }
  zBuf[j] = 0;
  OSTRACE2( "TEMP FILENAME: %s\n", zBuf );
  return SQLITE_OK;
}


/*
** Turn a relative pathname into a full pathname.  Write the full
** pathname into zFull[].  zFull[] will be at least pVfs->mxPathname
** bytes in size.
*/
static int os2FullPathname(
  sqlite3_vfs *pVfs,          /* Pointer to vfs object */
  const char *zRelative,      /* Possibly relative input path */
  int nFull,                  /* Size of output buffer in bytes */
  char *zFull                 /* Output buffer */
){
  char *zRelativeCp = convertUtf8PathToCp( zRelative );
  char zFullCp[CCHMAXPATH] = "\0";
  char *zFullUTF;
  APIRET rc = DosQueryPathInfo( zRelativeCp, FIL_QUERYFULLNAME, zFullCp,
                                CCHMAXPATH );
  free( zRelativeCp );
  zFullUTF = convertCpPathToUtf8( zFullCp );
  sqlite3_snprintf( nFull, zFull, zFullUTF );
  free( zFullUTF );
  return rc == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;
}


/*
** Open a file.
*/
static int os2Open(
  sqlite3_vfs *pVfs,            /* Not used */
  const char *zName,            /* Name of the file */
  sqlite3_file *id,             /* Write the SQLite file handle here */
  int flags,                    /* Open mode flags */
  int *pOutFlags                /* Status return flags */
){
  HFILE h;
  ULONG ulFileAttribute = 0;
  ULONG ulOpenFlags = 0;
  ULONG ulOpenMode = 0;
  os2File *pFile = (os2File*)id;
  APIRET rc = NO_ERROR;
  ULONG ulAction;
  char *zNameCp;
  char zTmpname[CCHMAXPATH+1];    /* Buffer to hold name of temp file */

  /* If the second argument to this function is NULL, generate a 
  ** temporary file name to use 
  */
  if( !zName ){
    int rc = getTempname(CCHMAXPATH+1, zTmpname);
    if( rc!=SQLITE_OK ){
      return rc;
    }
    zName = zTmpname;
  }


  memset( pFile, 0, sizeof(*pFile) );

  OSTRACE2( "OPEN want %d\n", flags );

  /*ulOpenMode = flags & SQLITE_OPEN_READWRITE ? OPEN_ACCESS_READWRITE : OPEN_ACCESS_READONLY;*/
  if( flags & SQLITE_OPEN_READWRITE ){
    ulOpenMode |= OPEN_ACCESS_READWRITE;
    OSTRACE1( "OPEN read/write\n" );
  }else{
    ulOpenMode |= OPEN_ACCESS_READONLY;
    OSTRACE1( "OPEN read only\n" );
  }

  /*ulOpenFlags = flags & SQLITE_OPEN_CREATE ? OPEN_ACTION_CREATE_IF_NEW : OPEN_ACTION_FAIL_IF_NEW;*/
  if( flags & SQLITE_OPEN_CREATE ){
    ulOpenFlags |= OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
    OSTRACE1( "OPEN open new/create\n" );
  }else{
    ulOpenFlags |= OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW;
    OSTRACE1( "OPEN open existing\n" );
  }

  /*ulOpenMode |= flags & SQLITE_OPEN_MAIN_DB ? OPEN_SHARE_DENYNONE : OPEN_SHARE_DENYWRITE;*/
  if( flags & SQLITE_OPEN_MAIN_DB ){
    ulOpenMode |= OPEN_SHARE_DENYNONE;
    OSTRACE1( "OPEN share read/write\n" );
  }else{
    ulOpenMode |= OPEN_SHARE_DENYWRITE;
    OSTRACE1( "OPEN share read only\n" );
  }

  if( flags & (SQLITE_OPEN_TEMP_DB | SQLITE_OPEN_TEMP_JOURNAL
               | SQLITE_OPEN_SUBJOURNAL) ){
    char pathUtf8[CCHMAXPATH];
#ifdef NDEBUG /* when debugging we want to make sure it is deleted */
    ulFileAttribute = FILE_HIDDEN;
#endif
    ulFileAttribute = FILE_NORMAL;
    os2FullPathname( pVfs, zName, CCHMAXPATH, pathUtf8 );
    pFile->pathToDel = convertUtf8PathToCp( pathUtf8 );
    OSTRACE1( "OPEN hidden/delete on close file attributes\n" );
  }else{
    ulFileAttribute = FILE_ARCHIVED | FILE_NORMAL;
    pFile->pathToDel = NULL;
    OSTRACE1( "OPEN normal file attribute\n" );
  }

  /* always open in random access mode for possibly better speed */
  ulOpenMode |= OPEN_FLAGS_RANDOM;
  ulOpenMode |= OPEN_FLAGS_FAIL_ON_ERROR;
  ulOpenMode |= OPEN_FLAGS_NOINHERIT;

  zNameCp = convertUtf8PathToCp( zName );
  rc = DosOpen( (PSZ)zNameCp,
                &h,
                &ulAction,
                0L,
                ulFileAttribute,
                ulOpenFlags,
                ulOpenMode,
                (PEAOP2)NULL );
  free( zNameCp );
  if( rc != NO_ERROR ){
    OSTRACE7( "OPEN Invalid handle rc=%d: zName=%s, ulAction=%#lx, ulAttr=%#lx, ulFlags=%#lx, ulMode=%#lx\n",
              rc, zName, ulAction, ulFileAttribute, ulOpenFlags, ulOpenMode );
    if( pFile->pathToDel )
      free( pFile->pathToDel );
    pFile->pathToDel = NULL;
    if( flags & SQLITE_OPEN_READWRITE ){
      OSTRACE2( "OPEN %d Invalid handle\n", ((flags | SQLITE_OPEN_READONLY) & ~SQLITE_OPEN_READWRITE) );
      return os2Open( pVfs, zName, id,
                      ((flags | SQLITE_OPEN_READONLY) & ~SQLITE_OPEN_READWRITE),
                      pOutFlags );
    }else{
      return SQLITE_CANTOPEN;
    }
  }

  if( pOutFlags ){
    *pOutFlags = flags & SQLITE_OPEN_READWRITE ? SQLITE_OPEN_READWRITE : SQLITE_OPEN_READONLY;
  }

  pFile->pMethod = &os2IoMethod;
  pFile->h = h;
  OpenCounter(+1);
  OSTRACE3( "OPEN %d pOutFlags=%d\n", pFile->h, pOutFlags );
  return SQLITE_OK;
}

/*
** Delete the named file.
*/
static int os2Delete(
  sqlite3_vfs *pVfs,                     /* Not used on os2 */
  const char *zFilename,                 /* Name of file to delete */
  int syncDir                            /* Not used on os2 */
){
  APIRET rc = NO_ERROR;
  char *zFilenameCp = convertUtf8PathToCp( zFilename );
  SimulateIOError( return SQLITE_IOERR_DELETE );
  rc = DosDelete( (PSZ)zFilenameCp );
  free( zFilenameCp );
  OSTRACE2( "DELETE \"%s\"\n", zFilename );
  return rc == NO_ERROR ? SQLITE_OK : SQLITE_IOERR;
}

/*
** Check the existance and status of a file.
*/
static int os2Access(
  sqlite3_vfs *pVfs,        /* Not used on os2 */
  const char *zFilename,    /* Name of file to check */
  int flags,                /* Type of test to make on this file */
  int *pOut                 /* Write results here */
){
  FILESTATUS3 fsts3ConfigInfo;
  APIRET rc = NO_ERROR;
  char *zFilenameCp = convertUtf8PathToCp( zFilename );

  memset( &fsts3ConfigInfo, 0, sizeof(fsts3ConfigInfo) );
  rc = DosQueryPathInfo( (PSZ)zFilenameCp, FIL_STANDARD,
                         &fsts3ConfigInfo, sizeof(FILESTATUS3) );
  free( zFilenameCp );
  OSTRACE4( "ACCESS fsts3ConfigInfo.attrFile=%d flags=%d rc=%d\n",
            fsts3ConfigInfo.attrFile, flags, rc );
  switch( flags ){
    case SQLITE_ACCESS_READ:
    case SQLITE_ACCESS_EXISTS:
      rc = (rc == NO_ERROR);
      OSTRACE3( "ACCESS %s access of read and exists  rc=%d\n", zFilename, rc );
      break;
    case SQLITE_ACCESS_READWRITE:
      rc = (rc == NO_ERROR) && ( (fsts3ConfigInfo.attrFile & FILE_READONLY) == 0 );
      OSTRACE3( "ACCESS %s access of read/write  rc=%d\n", zFilename, rc );
      break;
    default:
      assert( !"Invalid flags argument" );
  }
  *pOut = rc;
  return SQLITE_OK;
}


#ifndef SQLITE_OMIT_LOAD_EXTENSION
/*
** Interfaces for opening a shared library, finding entry points
** within the shared library, and closing the shared library.
*/
/*
** Interfaces for opening a shared library, finding entry points
** within the shared library, and closing the shared library.
*/
static void *os2DlOpen(sqlite3_vfs *pVfs, const char *zFilename){
  UCHAR loadErr[256];
  HMODULE hmod;
  APIRET rc;
  char *zFilenameCp = convertUtf8PathToCp(zFilename);
  rc = DosLoadModule((PSZ)loadErr, sizeof(loadErr), zFilenameCp, &hmod);
  free(zFilenameCp);
  return rc != NO_ERROR ? 0 : (void*)hmod;
}
/*
** A no-op since the error code is returned on the DosLoadModule call.
** os2Dlopen returns zero if DosLoadModule is not successful.
*/
static void os2DlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){
/* no-op */
}
static void *os2DlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol){
  PFN pfn;
  APIRET rc;
  rc = DosQueryProcAddr((HMODULE)pHandle, 0L, zSymbol, &pfn);
  if( rc != NO_ERROR ){
    /* if the symbol itself was not found, search again for the same
     * symbol with an extra underscore, that might be needed depending
     * on the calling convention */
    char _zSymbol[256] = "_";
    strncat(_zSymbol, zSymbol, 255);
    rc = DosQueryProcAddr((HMODULE)pHandle, 0L, _zSymbol, &pfn);
  }
  return rc != NO_ERROR ? 0 : (void*)pfn;
}
static void os2DlClose(sqlite3_vfs *pVfs, void *pHandle){
  DosFreeModule((HMODULE)pHandle);
}
#else /* if SQLITE_OMIT_LOAD_EXTENSION is defined: */
  #define os2DlOpen 0
  #define os2DlError 0
  #define os2DlSym 0
  #define os2DlClose 0
#endif


/*
** Write up to nBuf bytes of randomness into zBuf.
*/
static int os2Randomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf ){
  ULONG sizeofULong = sizeof(ULONG);
  int n = 0;
  if( sizeof(DATETIME) <= nBuf - n ){
    DATETIME x;
    DosGetDateTime(&x);
    memcpy(&zBuf[n], &x, sizeof(x));
    n += sizeof(x);
  }

  if( sizeofULong <= nBuf - n ){
    PPIB ppib;
    DosGetInfoBlocks(NULL, &ppib);
    memcpy(&zBuf[n], &ppib->pib_ulpid, sizeofULong);
    n += sizeofULong;
  }

  if( sizeofULong <= nBuf - n ){
    PTIB ptib;
    DosGetInfoBlocks(&ptib, NULL);
    memcpy(&zBuf[n], &ptib->tib_ptib2->tib2_ultid, sizeofULong);
    n += sizeofULong;
  }

  /* if we still haven't filled the buffer yet the following will */
  /* grab everything once instead of making several calls for a single item */
  if( sizeofULong <= nBuf - n ){
    ULONG ulSysInfo[QSV_MAX];
    DosQuerySysInfo(1L, QSV_MAX, ulSysInfo, sizeofULong * QSV_MAX);

    memcpy(&zBuf[n], &ulSysInfo[QSV_MS_COUNT - 1], sizeofULong);
    n += sizeofULong;

    if( sizeofULong <= nBuf - n ){
      memcpy(&zBuf[n], &ulSysInfo[QSV_TIMER_INTERVAL - 1], sizeofULong);
      n += sizeofULong;
    }
    if( sizeofULong <= nBuf - n ){
      memcpy(&zBuf[n], &ulSysInfo[QSV_TIME_LOW - 1], sizeofULong);
      n += sizeofULong;
    }
    if( sizeofULong <= nBuf - n ){
      memcpy(&zBuf[n], &ulSysInfo[QSV_TIME_HIGH - 1], sizeofULong);
      n += sizeofULong;
    }
    if( sizeofULong <= nBuf - n ){
      memcpy(&zBuf[n], &ulSysInfo[QSV_TOTAVAILMEM - 1], sizeofULong);
      n += sizeofULong;
    }
  }

  return n;
}

/*
** Sleep for a little while.  Return the amount of time slept.
** The argument is the number of microseconds we want to sleep.
** The return value is the number of microseconds of sleep actually
** requested from the underlying operating system, a number which
** might be greater than or equal to the argument, but not less
** than the argument.
*/
static int os2Sleep( sqlite3_vfs *pVfs, int microsec ){
  DosSleep( (microsec/1000) );
  return microsec;
}

/*
** The following variable, if set to a non-zero value, becomes the result
** returned from sqlite3OsCurrentTime().  This is used for testing.
*/
#ifdef SQLITE_TEST
int sqlite3_current_time = 0;
#endif

/*
** Find the current time (in Universal Coordinated Time).  Write the
** current time and date as a Julian Day number into *prNow and
** return 0.  Return 1 if the time and date cannot be found.
*/
int os2CurrentTime( sqlite3_vfs *pVfs, double *prNow ){
  double now;
  SHORT minute; /* needs to be able to cope with negative timezone offset */
  USHORT second, hour,
         day, month, year;
  DATETIME dt;
  DosGetDateTime( &dt );
  second = (USHORT)dt.seconds;
  minute = (SHORT)dt.minutes + dt.timezone;
  hour = (USHORT)dt.hours;
  day = (USHORT)dt.day;
  month = (USHORT)dt.month;
  year = (USHORT)dt.year;

  /* Calculations from http://www.astro.keele.ac.uk/~rno/Astronomy/hjd.html
     http://www.astro.keele.ac.uk/~rno/Astronomy/hjd-0.1.c */
  /* Calculate the Julian days */
  now = day - 32076 +
    1461*(year + 4800 + (month - 14)/12)/4 +
    367*(month - 2 - (month - 14)/12*12)/12 -
    3*((year + 4900 + (month - 14)/12)/100)/4;

  /* Add the fractional hours, mins and seconds */
  now += (hour + 12.0)/24.0;
  now += minute/1440.0;
  now += second/86400.0;
  *prNow = now;
#ifdef SQLITE_TEST
  if( sqlite3_current_time ){
    *prNow = sqlite3_current_time/86400.0 + 2440587.5;
  }
#endif
  return 0;
}

static int os2GetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
  return 0;
}

/*
** Initialize and deinitialize the operating system interface.
*/
int sqlite3_os_init(void){
  static sqlite3_vfs os2Vfs = {
    1,                 /* iVersion */
    sizeof(os2File),   /* szOsFile */
    CCHMAXPATH,        /* mxPathname */
    0,                 /* pNext */
    "os2",             /* zName */
    0,                 /* pAppData */

    os2Open,           /* xOpen */
    os2Delete,         /* xDelete */
    os2Access,         /* xAccess */
    os2FullPathname,   /* xFullPathname */
    os2DlOpen,         /* xDlOpen */
    os2DlError,        /* xDlError */
    os2DlSym,          /* xDlSym */
    os2DlClose,        /* xDlClose */
    os2Randomness,     /* xRandomness */
    os2Sleep,          /* xSleep */
    os2CurrentTime,    /* xCurrentTime */
    os2GetLastError    /* xGetLastError */
  };
  sqlite3_vfs_register(&os2Vfs, 1);
  initUconvObjects();
  return SQLITE_OK;
}
int sqlite3_os_end(void){
  freeUconvObjects();
  return SQLITE_OK;
}

#endif /* SQLITE_OS_OS2 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/os_unix.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
/*
** 2004 May 22
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains code that is specific to Unix systems.
**
** $Id: os_unix.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "sqliteInt.h"
#if SQLITE_OS_UNIX              /* This file is used on unix only */

/*
** If SQLITE_ENABLE_LOCKING_STYLE is defined, then several different 
** locking implementations are provided:
**
**   * POSIX locking (the default),
**   * No locking,
**   * Dot-file locking,
**   * flock() locking,
**   * AFP locking (OSX only).
*/
/* #define SQLITE_ENABLE_LOCKING_STYLE 0 */

/*
** These #defines should enable >2GB file support on Posix if the
** underlying operating system supports it.  If the OS lacks
** large file support, these should be no-ops.
**
** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch
** on the compiler command line.  This is necessary if you are compiling
** on a recent machine (ex: RedHat 7.2) but you want your code to work
** on an older machine (ex: RedHat 6.0).  If you compile on RedHat 7.2
** without this option, LFS is enable.  But LFS does not exist in the kernel
** in RedHat 6.0, so the code won't work.  Hence, for maximum binary
** portability you should omit LFS.
*/
#ifndef SQLITE_DISABLE_LFS
# define _LARGE_FILE       1
# ifndef _FILE_OFFSET_BITS
#   define _FILE_OFFSET_BITS 64
# endif
# define _LARGEFILE_SOURCE 1
#endif

/*
** standard include files.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
#include <errno.h>

#ifdef SQLITE_ENABLE_LOCKING_STYLE
#include <sys/ioctl.h>
#include <sys/param.h>
#include <sys/mount.h>
#endif /* SQLITE_ENABLE_LOCKING_STYLE */

/*
** If we are to be thread-safe, include the pthreads header and define
** the SQLITE_UNIX_THREADS macro.
*/
#if SQLITE_THREADSAFE
# include <pthread.h>
# define SQLITE_UNIX_THREADS 1
#endif

/*
** Default permissions when creating a new file
*/
#ifndef SQLITE_DEFAULT_FILE_PERMISSIONS
# define SQLITE_DEFAULT_FILE_PERMISSIONS 0644
#endif

/*
** Maximum supported path-length.
*/
#define MAX_PATHNAME 512


/*
** The unixFile structure is subclass of sqlite3_file specific for the unix
** protability layer.
*/
typedef struct unixFile unixFile;
struct unixFile {
  sqlite3_io_methods const *pMethod;  /* Always the first entry */
#ifdef SQLITE_TEST
  /* In test mode, increase the size of this structure a bit so that 
  ** it is larger than the struct CrashFile defined in test6.c.
  */
  char aPadding[32];
#endif
  struct openCnt *pOpen;    /* Info about all open fd's on this inode */
  struct lockInfo *pLock;   /* Info about locks on this inode */
#ifdef SQLITE_ENABLE_LOCKING_STYLE
  void *lockingContext;     /* Locking style specific state */
#endif
  int h;                    /* The file descriptor */
  unsigned char locktype;   /* The type of lock held on this fd */
  int dirfd;                /* File descriptor for the directory */
#if SQLITE_THREADSAFE
  pthread_t tid;            /* The thread that "owns" this unixFile */
#endif
};

/*
** Include code that is common to all os_*.c files
*/
#include "os_common.h"

/*
** Define various macros that are missing from some systems.
*/
#ifndef O_LARGEFILE
# define O_LARGEFILE 0
#endif
#ifdef SQLITE_DISABLE_LFS
# undef O_LARGEFILE
# define O_LARGEFILE 0
#endif
#ifndef O_NOFOLLOW
# define O_NOFOLLOW 0
#endif
#ifndef O_BINARY
# define O_BINARY 0
#endif

/*
** The DJGPP compiler environment looks mostly like Unix, but it
** lacks the fcntl() system call.  So redefine fcntl() to be something
** that always succeeds.  This means that locking does not occur under
** DJGPP.  But it is DOS - what did you expect?
*/
#ifdef __DJGPP__
# define fcntl(A,B,C) 0
#endif

/*
** The threadid macro resolves to the thread-id or to 0.  Used for
** testing and debugging only.
*/
#if SQLITE_THREADSAFE
#define threadid pthread_self()
#else
#define threadid 0
#endif

/*
** Set or check the unixFile.tid field.  This field is set when an unixFile
** is first opened.  All subsequent uses of the unixFile verify that the
** same thread is operating on the unixFile.  Some operating systems do
** not allow locks to be overridden by other threads and that restriction
** means that sqlite3* database handles cannot be moved from one thread
** to another.  This logic makes sure a user does not try to do that
** by mistake.
**
** Version 3.3.1 (2006-01-15):  unixFile can be moved from one thread to
** another as long as we are running on a system that supports threads
** overriding each others locks (which now the most common behavior)
** or if no locks are held.  But the unixFile.pLock field needs to be
** recomputed because its key includes the thread-id.  See the 
** transferOwnership() function below for additional information
*/
#if SQLITE_THREADSAFE
# define SET_THREADID(X)   (X)->tid = pthread_self()
# define CHECK_THREADID(X) (threadsOverrideEachOthersLocks==0 && \
                            !pthread_equal((X)->tid, pthread_self()))
#else
# define SET_THREADID(X)
# define CHECK_THREADID(X) 0
#endif

/*
** Here is the dirt on POSIX advisory locks:  ANSI STD 1003.1 (1996)
** section 6.5.2.2 lines 483 through 490 specify that when a process
** sets or clears a lock, that operation overrides any prior locks set
** by the same process.  It does not explicitly say so, but this implies
** that it overrides locks set by the same process using a different
** file descriptor.  Consider this test case:
**       int fd2 = open("./file2", O_RDWR|O_CREAT, 0644);
**
** Suppose ./file1 and ./file2 are really the same file (because
** one is a hard or symbolic link to the other) then if you set
** an exclusive lock on fd1, then try to get an exclusive lock
** on fd2, it works.  I would have expected the second lock to
** fail since there was already a lock on the file due to fd1.
** But not so.  Since both locks came from the same process, the
** second overrides the first, even though they were on different
** file descriptors opened on different file names.
**
** Bummer.  If you ask me, this is broken.  Badly broken.  It means
** that we cannot use POSIX locks to synchronize file access among
** competing threads of the same process.  POSIX locks will work fine
** to synchronize access for threads in separate processes, but not
** threads within the same process.
**
** To work around the problem, SQLite has to manage file locks internally
** on its own.  Whenever a new database is opened, we have to find the
** specific inode of the database file (the inode is determined by the
** st_dev and st_ino fields of the stat structure that fstat() fills in)
** and check for locks already existing on that inode.  When locks are
** created or removed, we have to look at our own internal record of the
** locks to see if another thread has previously set a lock on that same
** inode.
**
** The sqlite3_file structure for POSIX is no longer just an integer file
** descriptor.  It is now a structure that holds the integer file
** descriptor and a pointer to a structure that describes the internal
** locks on the corresponding inode.  There is one locking structure
** per inode, so if the same inode is opened twice, both unixFile structures
** point to the same locking structure.  The locking structure keeps
** a reference count (so we will know when to delete it) and a "cnt"
** field that tells us its internal lock status.  cnt==0 means the
** file is unlocked.  cnt==-1 means the file has an exclusive lock.
** cnt>0 means there are cnt shared locks on the file.
**
** Any attempt to lock or unlock a file first checks the locking
** structure.  The fcntl() system call is only invoked to set a 
** POSIX lock if the internal lock structure transitions between
** a locked and an unlocked state.
**
** 2004-Jan-11:
** More recent discoveries about POSIX advisory locks.  (The more
** I discover, the more I realize the a POSIX advisory locks are
** an abomination.)
**
** If you close a file descriptor that points to a file that has locks,
** all locks on that file that are owned by the current process are
** released.  To work around this problem, each unixFile structure contains
** a pointer to an openCnt structure.  There is one openCnt structure
** per open inode, which means that multiple unixFile can point to a single
** openCnt.  When an attempt is made to close an unixFile, if there are
** other unixFile open on the same inode that are holding locks, the call
** to close() the file descriptor is deferred until all of the locks clear.
** The openCnt structure keeps a list of file descriptors that need to
** be closed and that list is walked (and cleared) when the last lock
** clears.
**
** First, under Linux threads, because each thread has a separate
** process ID, lock operations in one thread do not override locks
** to the same file in other threads.  Linux threads behave like
** separate processes in this respect.  But, if you close a file
** descriptor in linux threads, all locks are cleared, even locks
** on other threads and even though the other threads have different
** process IDs.  Linux threads is inconsistent in this respect.
** (I'm beginning to think that linux threads is an abomination too.)
** The consequence of this all is that the hash table for the lockInfo
** structure has to include the process id as part of its key because
** locks in different threads are treated as distinct.  But the 
** openCnt structure should not include the process id in its
** key because close() clears lock on all threads, not just the current
** thread.  Were it not for this goofiness in linux threads, we could
** combine the lockInfo and openCnt structures into a single structure.
**
** 2004-Jun-28:
** On some versions of linux, threads can override each others locks.
** On others not.  Sometimes you can change the behavior on the same
** system by setting the LD_ASSUME_KERNEL environment variable.  The
** POSIX standard is silent as to which behavior is correct, as far
** as I can tell, so other versions of unix might show the same
** inconsistency.  There is no little doubt in my mind that posix
** advisory locks and linux threads are profoundly broken.
**
** To work around the inconsistencies, we have to test at runtime 
** whether or not threads can override each others locks.  This test
** is run once, the first time any lock is attempted.  A static 
** variable is set to record the results of this test for future
** use.
*/

/*
** An instance of the following structure serves as the key used
** to locate a particular lockInfo structure given its inode.
**
** If threads cannot override each others locks, then we set the
** lockKey.tid field to the thread ID.  If threads can override
** each others locks then tid is always set to zero.  tid is omitted
** if we compile without threading support.
*/
struct lockKey {
  dev_t dev;       /* Device number */
  ino_t ino;       /* Inode number */
#if SQLITE_THREADSAFE
  pthread_t tid;   /* Thread ID or zero if threads can override each other */
#endif
};

/*
** An instance of the following structure is allocated for each open
** inode on each thread with a different process ID.  (Threads have
** different process IDs on linux, but not on most other unixes.)
**
** A single inode can have multiple file descriptors, so each unixFile
** structure contains a pointer to an instance of this object and this
** object keeps a count of the number of unixFile pointing to it.
*/
struct lockInfo {
  struct lockKey key;  /* The lookup key */
  int cnt;             /* Number of SHARED locks held */
  int locktype;        /* One of SHARED_LOCK, RESERVED_LOCK etc. */
  int nRef;            /* Number of pointers to this structure */
  struct lockInfo *pNext, *pPrev;   /* List of all lockInfo objects */
};

/*
** An instance of the following structure serves as the key used
** to locate a particular openCnt structure given its inode.  This
** is the same as the lockKey except that the thread ID is omitted.
*/
struct openKey {
  dev_t dev;   /* Device number */
  ino_t ino;   /* Inode number */
};

/*
** An instance of the following structure is allocated for each open
** inode.  This structure keeps track of the number of locks on that
** inode.  If a close is attempted against an inode that is holding
** locks, the close is deferred until all locks clear by adding the
** file descriptor to be closed to the pending list.
*/
struct openCnt {
  struct openKey key;   /* The lookup key */
  int nRef;             /* Number of pointers to this structure */
  int nLock;            /* Number of outstanding locks */
  int nPending;         /* Number of pending close() operations */
  int *aPending;        /* Malloced space holding fd's awaiting a close() */
  struct openCnt *pNext, *pPrev;   /* List of all openCnt objects */
};

/*
** List of all lockInfo and openCnt objects.  This used to be a hash
** table.  But the number of objects is rarely more than a dozen and
** never exceeds a few thousand.  And lookup is not on a critical
** path oo a simple linked list will suffice.
*/
static struct lockInfo *lockList = 0;
static struct openCnt *openList = 0;

/*
** The locking styles are associated with the different file locking
** capabilities supported by different file systems.  
**
** POSIX locking style fully supports shared and exclusive byte-range locks 
** AFP locking only supports exclusive byte-range locks
** FLOCK only supports a single file-global exclusive lock
** DOTLOCK isn't a true locking style, it refers to the use of a special
**   file named the same as the database file with a '.lock' extension, this
**   can be used on file systems that do not offer any reliable file locking
** NO locking means that no locking will be attempted, this is only used for
**   read-only file systems currently
** UNSUPPORTED means that no locking will be attempted, this is only used for
**   file systems that are known to be unsupported
*/
#define LOCKING_STYLE_POSIX        1
#define LOCKING_STYLE_NONE         2
#define LOCKING_STYLE_DOTFILE      3
#define LOCKING_STYLE_FLOCK        4
#define LOCKING_STYLE_AFP          5

/*
** Helper functions to obtain and relinquish the global mutex.
*/
static void enterMutex(){
  sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
}
static void leaveMutex(){
  sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER));
}

#if SQLITE_THREADSAFE
/*
** This variable records whether or not threads can override each others
** locks.
**
**    0:  No.  Threads cannot override each others locks.
**    1:  Yes.  Threads can override each others locks.
**   -1:  We don't know yet.
**
** On some systems, we know at compile-time if threads can override each
** others locks.  On those systems, the SQLITE_THREAD_OVERRIDE_LOCK macro
** will be set appropriately.  On other systems, we have to check at
** runtime.  On these latter systems, SQLTIE_THREAD_OVERRIDE_LOCK is
** undefined.
**
** This variable normally has file scope only.  But during testing, we make
** it a global so that the test code can change its value in order to verify
** that the right stuff happens in either case.
*/
#ifndef SQLITE_THREAD_OVERRIDE_LOCK
# define SQLITE_THREAD_OVERRIDE_LOCK -1
#endif
#ifdef SQLITE_TEST
int threadsOverrideEachOthersLocks = SQLITE_THREAD_OVERRIDE_LOCK;
#else
static int threadsOverrideEachOthersLocks = SQLITE_THREAD_OVERRIDE_LOCK;
#endif

/*
** This structure holds information passed into individual test
** threads by the testThreadLockingBehavior() routine.
*/
struct threadTestData {
  int fd;                /* File to be locked */
  struct flock lock;     /* The locking operation */
  int result;            /* Result of the locking operation */
};

#ifdef SQLITE_LOCK_TRACE
/*
** Print out information about all locking operations.
**
** This routine is used for troubleshooting locks on multithreaded
** platforms.  Enable by compiling with the -DSQLITE_LOCK_TRACE
** command-line option on the compiler.  This code is normally
** turned off.
*/
static int lockTrace(int fd, int op, struct flock *p){
  char *zOpName, *zType;
  int s;
  int savedErrno;
  if( op==F_GETLK ){
    zOpName = "GETLK";
  }else if( op==F_SETLK ){
    zOpName = "SETLK";
  }else{
    s = fcntl(fd, op, p);
    sqlite3DebugPrintf("fcntl unknown %d %d %d\n", fd, op, s);
    return s;
  }
  if( p->l_type==F_RDLCK ){
    zType = "RDLCK";
  }else if( p->l_type==F_WRLCK ){
    zType = "WRLCK";
  }else if( p->l_type==F_UNLCK ){
    zType = "UNLCK";
  }else{
    assert( 0 );
  }
  assert( p->l_whence==SEEK_SET );
  s = fcntl(fd, op, p);
  savedErrno = errno;
  sqlite3DebugPrintf("fcntl %d %d %s %s %d %d %d %d\n",
     threadid, fd, zOpName, zType, (int)p->l_start, (int)p->l_len,
     (int)p->l_pid, s);
  if( s==(-1) && op==F_SETLK && (p->l_type==F_RDLCK || p->l_type==F_WRLCK) ){
    struct flock l2;
    l2 = *p;
    fcntl(fd, F_GETLK, &l2);
    if( l2.l_type==F_RDLCK ){
      zType = "RDLCK";
    }else if( l2.l_type==F_WRLCK ){
      zType = "WRLCK";
    }else if( l2.l_type==F_UNLCK ){
      zType = "UNLCK";
    }else{
      assert( 0 );
    }
    sqlite3DebugPrintf("fcntl-failure-reason: %s %d %d %d\n",
       zType, (int)l2.l_start, (int)l2.l_len, (int)l2.l_pid);
  }
  errno = savedErrno;
  return s;
}
#define fcntl lockTrace
#endif /* SQLITE_LOCK_TRACE */

/*
** The testThreadLockingBehavior() routine launches two separate
** threads on this routine.  This routine attempts to lock a file
** descriptor then returns.  The success or failure of that attempt
** allows the testThreadLockingBehavior() procedure to determine
** whether or not threads can override each others locks.
*/
static void *threadLockingTest(void *pArg){
  struct threadTestData *pData = (struct threadTestData*)pArg;
  pData->result = fcntl(pData->fd, F_SETLK, &pData->lock);
  return pArg;
}

/*
** This procedure attempts to determine whether or not threads
** can override each others locks then sets the 
** threadsOverrideEachOthersLocks variable appropriately.
*/
static void testThreadLockingBehavior(int fd_orig){
  int fd;
  struct threadTestData d[2];
  pthread_t t[2];

  fd = dup(fd_orig);
  if( fd<0 ) return;
  memset(d, 0, sizeof(d));
  d[0].fd = fd;
  d[0].lock.l_type = F_RDLCK;
  d[0].lock.l_len = 1;
  d[0].lock.l_start = 0;
  d[0].lock.l_whence = SEEK_SET;
  d[1] = d[0];
  d[1].lock.l_type = F_WRLCK;
  pthread_create(&t[0], 0, threadLockingTest, &d[0]);
  pthread_create(&t[1], 0, threadLockingTest, &d[1]);
  pthread_join(t[0], 0);
  pthread_join(t[1], 0);
  close(fd);
  threadsOverrideEachOthersLocks =  d[0].result==0 && d[1].result==0;
}
#endif /* SQLITE_THREADSAFE */

/*
** Release a lockInfo structure previously allocated by findLockInfo().
*/
static void releaseLockInfo(struct lockInfo *pLock){
  if( pLock ){
    pLock->nRef--;
    if( pLock->nRef==0 ){
      if( pLock->pPrev ){
        assert( pLock->pPrev->pNext==pLock );
        pLock->pPrev->pNext = pLock->pNext;
      }else{
        assert( lockList==pLock );
        lockList = pLock->pNext;
      }
      if( pLock->pNext ){
        assert( pLock->pNext->pPrev==pLock );
        pLock->pNext->pPrev = pLock->pPrev;
      }
      sqlite3_free(pLock);
    }
  }
}

/*
** Release a openCnt structure previously allocated by findLockInfo().
*/
static void releaseOpenCnt(struct openCnt *pOpen){
  if( pOpen ){
    pOpen->nRef--;
    if( pOpen->nRef==0 ){
      if( pOpen->pPrev ){
        assert( pOpen->pPrev->pNext==pOpen );
        pOpen->pPrev->pNext = pOpen->pNext;
      }else{
        assert( openList==pOpen );
        openList = pOpen->pNext;
      }
      if( pOpen->pNext ){
        assert( pOpen->pNext->pPrev==pOpen );
        pOpen->pNext->pPrev = pOpen->pPrev;
      }
      sqlite3_free(pOpen->aPending);
      sqlite3_free(pOpen);
    }
  }
}

#ifdef SQLITE_ENABLE_LOCKING_STYLE
/*
** Tests a byte-range locking query to see if byte range locks are 
** supported, if not we fall back to dotlockLockingStyle.
*/
static int testLockingStyle(int fd){
  struct flock lockInfo;

  /* Test byte-range lock using fcntl(). If the call succeeds, 
  ** assume that the file-system supports POSIX style locks. 
  */
  lockInfo.l_len = 1;
  lockInfo.l_start = 0;
  lockInfo.l_whence = SEEK_SET;
  lockInfo.l_type = F_RDLCK;
  if( fcntl(fd, F_GETLK, &lockInfo)!=-1 ) {
    return LOCKING_STYLE_POSIX;
  }
  
  /* Testing for flock() can give false positives.  So if if the above 
  ** test fails, then we fall back to using dot-file style locking.
  */  
  return LOCKING_STYLE_DOTFILE;
}
#endif

/* 
** If SQLITE_ENABLE_LOCKING_STYLE is defined, this function Examines the 
** f_fstypename entry in the statfs structure as returned by stat() for 
** the file system hosting the database file and selects  the appropriate
** locking style based on its value.  These values and assignments are 
** based on Darwin/OSX behavior and have not been thoroughly tested on 
** other systems.
**
** If SQLITE_ENABLE_LOCKING_STYLE is not defined, this function always
** returns LOCKING_STYLE_POSIX.
*/
static int detectLockingStyle(
  sqlite3_vfs *pVfs,
  const char *filePath, 
  int fd
){
#ifdef SQLITE_ENABLE_LOCKING_STYLE
  struct Mapping {
    const char *zFilesystem;
    int eLockingStyle;
  } aMap[] = {
    { "hfs",    LOCKING_STYLE_POSIX },
    { "ufs",    LOCKING_STYLE_POSIX },
    { "afpfs",  LOCKING_STYLE_AFP },
    { "smbfs",  LOCKING_STYLE_FLOCK },
    { "msdos",  LOCKING_STYLE_DOTFILE },
    { "webdav", LOCKING_STYLE_NONE },
    { 0, 0 }
  };
  int i;
  struct statfs fsInfo;

  if( !filePath ){
    return LOCKING_STYLE_NONE;
  }
  if( pVfs->pAppData ){
    return (int)pVfs->pAppData;
  }

  if( statfs(filePath, &fsInfo) != -1 ){
    if( fsInfo.f_flags & MNT_RDONLY ){
      return LOCKING_STYLE_NONE;
    }
    for(i=0; aMap[i].zFilesystem; i++){
      if( strcmp(fsInfo.f_fstypename, aMap[i].zFilesystem)==0 ){
        return aMap[i].eLockingStyle;
      }
    }
  }

  /* Default case. Handles, amongst others, "nfs". */
  return testLockingStyle(fd);  
#endif
  return LOCKING_STYLE_POSIX;
}

/*
** Given a file descriptor, locate lockInfo and openCnt structures that
** describes that file descriptor.  Create new ones if necessary.  The
** return values might be uninitialized if an error occurs.
**
** Return an appropriate error code.
*/
static int findLockInfo(
  int fd,                      /* The file descriptor used in the key */
  struct lockInfo **ppLock,    /* Return the lockInfo structure here */
  struct openCnt **ppOpen      /* Return the openCnt structure here */
){
  int rc;
  struct lockKey key1;
  struct openKey key2;
  struct stat statbuf;
  struct lockInfo *pLock;
  struct openCnt *pOpen;
  rc = fstat(fd, &statbuf);
  if( rc!=0 ){
#ifdef EOVERFLOW
    if( errno==EOVERFLOW ) return SQLITE_NOLFS;
#endif
    return SQLITE_IOERR;
  }

  /* On OS X on an msdos filesystem, the inode number is reported
  ** incorrectly for zero-size files.  See ticket #3260.  To work
  ** around this problem (we consider it a bug in OS X, not SQLite)
  ** we always increase the file size to 1 by writing a single byte
  ** prior to accessing the inode number.  The one byte written is
  ** an ASCII 'S' character which also happens to be the first byte
  ** in the header of every SQLite database.  In this way, if there
  ** is a race condition such that another thread has already populated
  ** the first page of the database, no damage is done.
  */
  if( statbuf.st_size==0 ){
    write(fd, "S", 1);
    rc = fstat(fd, &statbuf);
    if( rc!=0 ){
      return SQLITE_IOERR;
    }
  }

  memset(&key1, 0, sizeof(key1));
  key1.dev = statbuf.st_dev;
  key1.ino = statbuf.st_ino;
#if SQLITE_THREADSAFE
  if( threadsOverrideEachOthersLocks<0 ){
    testThreadLockingBehavior(fd);
  }
  key1.tid = threadsOverrideEachOthersLocks ? 0 : pthread_self();
#endif
  memset(&key2, 0, sizeof(key2));
  key2.dev = statbuf.st_dev;
  key2.ino = statbuf.st_ino;
  pLock = lockList;
  while( pLock && memcmp(&key1, &pLock->key, sizeof(key1)) ){
    pLock = pLock->pNext;
  }
  if( pLock==0 ){
    pLock = sqlite3_malloc( sizeof(*pLock) );
    if( pLock==0 ){
      rc = SQLITE_NOMEM;
      goto exit_findlockinfo;
    }
    pLock->key = key1;
    pLock->nRef = 1;
    pLock->cnt = 0;
    pLock->locktype = 0;
    pLock->pNext = lockList;
    pLock->pPrev = 0;
    if( lockList ) lockList->pPrev = pLock;
    lockList = pLock;
  }else{
    pLock->nRef++;
  }
  *ppLock = pLock;
  if( ppOpen!=0 ){
    pOpen = openList;
    while( pOpen && memcmp(&key2, &pOpen->key, sizeof(key2)) ){
      pOpen = pOpen->pNext;
    }
    if( pOpen==0 ){
      pOpen = sqlite3_malloc( sizeof(*pOpen) );
      if( pOpen==0 ){
        releaseLockInfo(pLock);
        rc = SQLITE_NOMEM;
        goto exit_findlockinfo;
      }
      pOpen->key = key2;
      pOpen->nRef = 1;
      pOpen->nLock = 0;
      pOpen->nPending = 0;
      pOpen->aPending = 0;
      pOpen->pNext = openList;
      pOpen->pPrev = 0;
      if( openList ) openList->pPrev = pOpen;
      openList = pOpen;
    }else{
      pOpen->nRef++;
    }
    *ppOpen = pOpen;
  }

exit_findlockinfo:
  return rc;
}

#ifdef SQLITE_DEBUG
/*
** Helper function for printing out trace information from debugging
** binaries. This returns the string represetation of the supplied
** integer lock-type.
*/
static const char *locktypeName(int locktype){
  switch( locktype ){
  case NO_LOCK: return "NONE";
  case SHARED_LOCK: return "SHARED";
  case RESERVED_LOCK: return "RESERVED";
  case PENDING_LOCK: return "PENDING";
  case EXCLUSIVE_LOCK: return "EXCLUSIVE";
  }
  return "ERROR";
}
#endif

/*
** If we are currently in a different thread than the thread that the
** unixFile argument belongs to, then transfer ownership of the unixFile
** over to the current thread.
**
** A unixFile is only owned by a thread on systems where one thread is
** unable to override locks created by a different thread.  RedHat9 is
** an example of such a system.
**
** Ownership transfer is only allowed if the unixFile is currently unlocked.
** If the unixFile is locked and an ownership is wrong, then return
** SQLITE_MISUSE.  SQLITE_OK is returned if everything works.
*/
#if SQLITE_THREADSAFE
static int transferOwnership(unixFile *pFile){
  int rc;
  pthread_t hSelf;
  if( threadsOverrideEachOthersLocks ){
    /* Ownership transfers not needed on this system */
    return SQLITE_OK;
  }
  hSelf = pthread_self();
  if( pthread_equal(pFile->tid, hSelf) ){
    /* We are still in the same thread */
    OSTRACE1("No-transfer, same thread\n");
    return SQLITE_OK;
  }
  if( pFile->locktype!=NO_LOCK ){
    /* We cannot change ownership while we are holding a lock! */
    return SQLITE_MISUSE;
  }
  OSTRACE4("Transfer ownership of %d from %d to %d\n",
            pFile->h, pFile->tid, hSelf);
  pFile->tid = hSelf;
  if (pFile->pLock != NULL) {
    releaseLockInfo(pFile->pLock);
    rc = findLockInfo(pFile->h, &pFile->pLock, 0);
    OSTRACE5("LOCK    %d is now %s(%s,%d)\n", pFile->h,
           locktypeName(pFile->locktype),
           locktypeName(pFile->pLock->locktype), pFile->pLock->cnt);
    return rc;
  } else {
    return SQLITE_OK;
  }
}
#else
  /* On single-threaded builds, ownership transfer is a no-op */
# define transferOwnership(X) SQLITE_OK
#endif

/*
** Seek to the offset passed as the second argument, then read cnt 
** bytes into pBuf. Return the number of bytes actually read.
**
** NB:  If you define USE_PREAD or USE_PREAD64, then it might also
** be necessary to define _XOPEN_SOURCE to be 500.  This varies from
** one system to another.  Since SQLite does not define USE_PREAD
** any any form by default, we will not attempt to define _XOPEN_SOURCE.
** See tickets #2741 and #2681.
*/
static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){
  int got;
  i64 newOffset;
  TIMER_START;
#if defined(USE_PREAD)
  got = pread(id->h, pBuf, cnt, offset);
  SimulateIOError( got = -1 );
#elif defined(USE_PREAD64)
  got = pread64(id->h, pBuf, cnt, offset);
  SimulateIOError( got = -1 );
#else
  newOffset = lseek(id->h, offset, SEEK_SET);
  SimulateIOError( newOffset-- );
  if( newOffset!=offset ){
    return -1;
  }
  got = read(id->h, pBuf, cnt);
#endif
  TIMER_END;
  OSTRACE5("READ    %-3d %5d %7lld %llu\n", id->h, got, offset, TIMER_ELAPSED);
  return got;
}

/*
** Read data from a file into a buffer.  Return SQLITE_OK if all
** bytes were read successfully and SQLITE_IOERR if anything goes
** wrong.
*/
static int unixRead(
  sqlite3_file *id, 
  void *pBuf, 
  int amt,
  sqlite3_int64 offset
){
  int got;
  assert( id );
  got = seekAndRead((unixFile*)id, offset, pBuf, amt);
  if( got==amt ){
    return SQLITE_OK;
  }else if( got<0 ){
    return SQLITE_IOERR_READ;
  }else{
    memset(&((char*)pBuf)[got], 0, amt-got);
    return SQLITE_IOERR_SHORT_READ;
  }
}

/*
** Seek to the offset in id->offset then read cnt bytes into pBuf.
** Return the number of bytes actually read.  Update the offset.
*/
static int seekAndWrite(unixFile *id, i64 offset, const void *pBuf, int cnt){
  int got;
  i64 newOffset;
  TIMER_START;
#if defined(USE_PREAD)
  got = pwrite(id->h, pBuf, cnt, offset);
#elif defined(USE_PREAD64)
  got = pwrite64(id->h, pBuf, cnt, offset);
#else
  newOffset = lseek(id->h, offset, SEEK_SET);
  if( newOffset!=offset ){
    return -1;
  }
  got = write(id->h, pBuf, cnt);
#endif
  TIMER_END;
  OSTRACE5("WRITE   %-3d %5d %7lld %llu\n", id->h, got, offset, TIMER_ELAPSED);
  return got;
}


/*
** Write data from a buffer into a file.  Return SQLITE_OK on success
** or some other error code on failure.
*/
static int unixWrite(
  sqlite3_file *id, 
  const void *pBuf, 
  int amt,
  sqlite3_int64 offset 
){
  int wrote = 0;
  assert( id );
  assert( amt>0 );
  while( amt>0 && (wrote = seekAndWrite((unixFile*)id, offset, pBuf, amt))>0 ){
    amt -= wrote;
    offset += wrote;
    pBuf = &((char*)pBuf)[wrote];
  }
  SimulateIOError(( wrote=(-1), amt=1 ));
  SimulateDiskfullError(( wrote=0, amt=1 ));
  if( amt>0 ){
    if( wrote<0 ){
      return SQLITE_IOERR_WRITE;
    }else{
      return SQLITE_FULL;
    }
  }
  return SQLITE_OK;
}

#ifdef SQLITE_TEST
/*
** Count the number of fullsyncs and normal syncs.  This is used to test
** that syncs and fullsyncs are occuring at the right times.
*/
int sqlite3_sync_count = 0;
int sqlite3_fullsync_count = 0;
#endif

/*
** Use the fdatasync() API only if the HAVE_FDATASYNC macro is defined.
** Otherwise use fsync() in its place.
*/
#ifndef HAVE_FDATASYNC
# define fdatasync fsync
#endif

/*
** Define HAVE_FULLFSYNC to 0 or 1 depending on whether or not
** the F_FULLFSYNC macro is defined.  F_FULLFSYNC is currently
** only available on Mac OS X.  But that could change.
*/
#ifdef F_FULLFSYNC
# define HAVE_FULLFSYNC 1
#else
# define HAVE_FULLFSYNC 0
#endif


/*
** The fsync() system call does not work as advertised on many
** unix systems.  The following procedure is an attempt to make
** it work better.
**
** The SQLITE_NO_SYNC macro disables all fsync()s.  This is useful
** for testing when we want to run through the test suite quickly.
** You are strongly advised *not* to deploy with SQLITE_NO_SYNC
** enabled, however, since with SQLITE_NO_SYNC enabled, an OS crash
** or power failure will likely corrupt the database file.
*/
static int full_fsync(int fd, int fullSync, int dataOnly){
  int rc;

  /* Record the number of times that we do a normal fsync() and 
  ** FULLSYNC.  This is used during testing to verify that this procedure
  ** gets called with the correct arguments.
  */
#ifdef SQLITE_TEST
  if( fullSync ) sqlite3_fullsync_count++;
  sqlite3_sync_count++;
#endif

  /* If we compiled with the SQLITE_NO_SYNC flag, then syncing is a
  ** no-op
  */
#ifdef SQLITE_NO_SYNC
  rc = SQLITE_OK;
#else

#if HAVE_FULLFSYNC
  if( fullSync ){
    rc = fcntl(fd, F_FULLFSYNC, 0);
  }else{
    rc = 1;
  }
  /* If the FULLFSYNC failed, fall back to attempting an fsync().
   * It shouldn't be possible for fullfsync to fail on the local 
   * file system (on OSX), so failure indicates that FULLFSYNC
   * isn't supported for this file system. So, attempt an fsync 
   * and (for now) ignore the overhead of a superfluous fcntl call.  
   * It'd be better to detect fullfsync support once and avoid 
   * the fcntl call every time sync is called.
   */
  if( rc ) rc = fsync(fd);

#else 
  if( dataOnly ){
    rc = fdatasync(fd);
  }else{
    rc = fsync(fd);
  }
#endif /* HAVE_FULLFSYNC */
#endif /* defined(SQLITE_NO_SYNC) */

  return rc;
}

/*
** Make sure all writes to a particular file are committed to disk.
**
** If dataOnly==0 then both the file itself and its metadata (file
** size, access time, etc) are synced.  If dataOnly!=0 then only the
** file data is synced.
**
** Under Unix, also make sure that the directory entry for the file
** has been created by fsync-ing the directory that contains the file.
** If we do not do this and we encounter a power failure, the directory
** entry for the journal might not exist after we reboot.  The next
** SQLite to access the file will not know that the journal exists (because
** the directory entry for the journal was never created) and the transaction
** will not roll back - possibly leading to database corruption.
*/
static int unixSync(sqlite3_file *id, int flags){
  int rc;
  unixFile *pFile = (unixFile*)id;

  int isDataOnly = (flags&SQLITE_SYNC_DATAONLY);
  int isFullsync = (flags&0x0F)==SQLITE_SYNC_FULL;

  /* Check that one of SQLITE_SYNC_NORMAL or FULL was passed */
  assert((flags&0x0F)==SQLITE_SYNC_NORMAL
      || (flags&0x0F)==SQLITE_SYNC_FULL
  );

  assert( pFile );
  OSTRACE2("SYNC    %-3d\n", pFile->h);
  rc = full_fsync(pFile->h, isFullsync, isDataOnly);
  SimulateIOError( rc=1 );
  if( rc ){
    return SQLITE_IOERR_FSYNC;
  }
  if( pFile->dirfd>=0 ){
    OSTRACE4("DIRSYNC %-3d (have_fullfsync=%d fullsync=%d)\n", pFile->dirfd,
            HAVE_FULLFSYNC, isFullsync);
#ifndef SQLITE_DISABLE_DIRSYNC
    /* The directory sync is only attempted if full_fsync is
    ** turned off or unavailable.  If a full_fsync occurred above,
    ** then the directory sync is superfluous.
    */
    if( (!HAVE_FULLFSYNC || !isFullsync) && full_fsync(pFile->dirfd,0,0) ){
       /*
       ** We have received multiple reports of fsync() returning
       ** errors when applied to directories on certain file systems.
       ** A failed directory sync is not a big deal.  So it seems
       ** better to ignore the error.  Ticket #1657
       */
       /* return SQLITE_IOERR; */
    }
#endif
    close(pFile->dirfd);  /* Only need to sync once, so close the directory */
    pFile->dirfd = -1;    /* when we are done. */
  }
  return SQLITE_OK;
}

/*
** Truncate an open file to a specified size
*/
static int unixTruncate(sqlite3_file *id, i64 nByte){
  int rc;
  assert( id );
  SimulateIOError( return SQLITE_IOERR_TRUNCATE );
  rc = ftruncate(((unixFile*)id)->h, (off_t)nByte);
  if( rc ){
    return SQLITE_IOERR_TRUNCATE;
  }else{
    return SQLITE_OK;
  }
}

/*
** Determine the current size of a file in bytes
*/
static int unixFileSize(sqlite3_file *id, i64 *pSize){
  int rc;
  struct stat buf;
  assert( id );
  rc = fstat(((unixFile*)id)->h, &buf);
  SimulateIOError( rc=1 );
  if( rc!=0 ){
    return SQLITE_IOERR_FSTAT;
  }
  *pSize = buf.st_size;

  /* When opening a zero-size database, the findLockInfo() procedure
  ** writes a single byte into that file in order to work around a bug
  ** in the OS-X msdos filesystem.  In order to avoid problems with upper
  ** layers, we need to report this file size as zero even though it is
  ** really 1.   Ticket #3260.
  */
  if( *pSize==1 ) *pSize = 0;


  return SQLITE_OK;
}

/*
** This routine checks if there is a RESERVED lock held on the specified
** file by this or any other process. If such a lock is held, return
** non-zero.  If the file is unlocked or holds only SHARED locks, then
** return zero.
*/
static int unixCheckReservedLock(sqlite3_file *id, int *pResOut){
  int r = 0;
  unixFile *pFile = (unixFile*)id;

  SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; );

  assert( pFile );
  enterMutex(); /* Because pFile->pLock is shared across threads */

  /* Check if a thread in this process holds such a lock */
  if( pFile->pLock->locktype>SHARED_LOCK ){
    r = 1;
  }

  /* Otherwise see if some other process holds it.
  */
  if( !r ){
    struct flock lock;
    lock.l_whence = SEEK_SET;
    lock.l_start = RESERVED_BYTE;
    lock.l_len = 1;
    lock.l_type = F_WRLCK;
    fcntl(pFile->h, F_GETLK, &lock);
    if( lock.l_type!=F_UNLCK ){
      r = 1;
    }
  }
  
  leaveMutex();
  OSTRACE3("TEST WR-LOCK %d %d\n", pFile->h, r);

  *pResOut = r;
  return SQLITE_OK;
}

/*
** Lock the file with the lock specified by parameter locktype - one
** of the following:
**
**     (1) SHARED_LOCK
**     (2) RESERVED_LOCK
**     (3) PENDING_LOCK
**     (4) EXCLUSIVE_LOCK
**
** Sometimes when requesting one lock state, additional lock states
** are inserted in between.  The locking might fail on one of the later
** transitions leaving the lock state different from what it started but
** still short of its goal.  The following chart shows the allowed
** transitions and the inserted intermediate states:
**
**    UNLOCKED -> SHARED
**    SHARED -> RESERVED
**    SHARED -> (PENDING) -> EXCLUSIVE
**    RESERVED -> (PENDING) -> EXCLUSIVE
**    PENDING -> EXCLUSIVE
**
** This routine will only increase a lock.  Use the sqlite3OsUnlock()
** routine to lower a locking level.
*/
static int unixLock(sqlite3_file *id, int locktype){
  /* The following describes the implementation of the various locks and
  ** lock transitions in terms of the POSIX advisory shared and exclusive
  ** lock primitives (called read-locks and write-locks below, to avoid
  ** confusion with SQLite lock names). The algorithms are complicated
  ** slightly in order to be compatible with windows systems simultaneously
  ** accessing the same database file, in case that is ever required.
  **
  ** Symbols defined in os.h indentify the 'pending byte' and the 'reserved
  ** byte', each single bytes at well known offsets, and the 'shared byte
  ** range', a range of 510 bytes at a well known offset.
  **
  ** To obtain a SHARED lock, a read-lock is obtained on the 'pending
  ** byte'.  If this is successful, a random byte from the 'shared byte
  ** range' is read-locked and the lock on the 'pending byte' released.
  **
  ** A process may only obtain a RESERVED lock after it has a SHARED lock.
  ** A RESERVED lock is implemented by grabbing a write-lock on the
  ** 'reserved byte'. 
  **
  ** A process may only obtain a PENDING lock after it has obtained a
  ** SHARED lock. A PENDING lock is implemented by obtaining a write-lock
  ** on the 'pending byte'. This ensures that no new SHARED locks can be
  ** obtained, but existing SHARED locks are allowed to persist. A process
  ** does not have to obtain a RESERVED lock on the way to a PENDING lock.
  ** This property is used by the algorithm for rolling back a journal file
  ** after a crash.
  **
  ** An EXCLUSIVE lock, obtained after a PENDING lock is held, is
  ** implemented by obtaining a write-lock on the entire 'shared byte
  ** range'. Since all other locks require a read-lock on one of the bytes
  ** within this range, this ensures that no other locks are held on the
  ** database. 
  **
  ** The reason a single byte cannot be used instead of the 'shared byte
  ** range' is that some versions of windows do not support read-locks. By
  ** locking a random byte from a range, concurrent SHARED locks may exist
  ** even if the locking primitive used is always a write-lock.
  */
  int rc = SQLITE_OK;
  unixFile *pFile = (unixFile*)id;
  struct lockInfo *pLock = pFile->pLock;
  struct flock lock;
  int s;

  assert( pFile );
  OSTRACE7("LOCK    %d %s was %s(%s,%d) pid=%d\n", pFile->h,
      locktypeName(locktype), locktypeName(pFile->locktype),
      locktypeName(pLock->locktype), pLock->cnt , getpid());

  /* If there is already a lock of this type or more restrictive on the
  ** unixFile, do nothing. Don't use the end_lock: exit path, as
  ** enterMutex() hasn't been called yet.
  */
  if( pFile->locktype>=locktype ){
    OSTRACE3("LOCK    %d %s ok (already held)\n", pFile->h,
            locktypeName(locktype));
    return SQLITE_OK;
  }

  /* Make sure the locking sequence is correct
  */
  assert( pFile->locktype!=NO_LOCK || locktype==SHARED_LOCK );
  assert( locktype!=PENDING_LOCK );
  assert( locktype!=RESERVED_LOCK || pFile->locktype==SHARED_LOCK );

  /* This mutex is needed because pFile->pLock is shared across threads
  */
  enterMutex();

  /* Make sure the current thread owns the pFile.
  */
  rc = transferOwnership(pFile);
  if( rc!=SQLITE_OK ){
    leaveMutex();
    return rc;
  }
  pLock = pFile->pLock;

  /* If some thread using this PID has a lock via a different unixFile*
  ** handle that precludes the requested lock, return BUSY.
  */
  if( (pFile->locktype!=pLock->locktype && 
          (pLock->locktype>=PENDING_LOCK || locktype>SHARED_LOCK))
  ){
    rc = SQLITE_BUSY;
    goto end_lock;
  }

  /* If a SHARED lock is requested, and some thread using this PID already
  ** has a SHARED or RESERVED lock, then increment reference counts and
  ** return SQLITE_OK.
  */
  if( locktype==SHARED_LOCK && 
      (pLock->locktype==SHARED_LOCK || pLock->locktype==RESERVED_LOCK) ){
    assert( locktype==SHARED_LOCK );
    assert( pFile->locktype==0 );
    assert( pLock->cnt>0 );
    pFile->locktype = SHARED_LOCK;
    pLock->cnt++;
    pFile->pOpen->nLock++;
    goto end_lock;
  }

  lock.l_len = 1L;

  lock.l_whence = SEEK_SET;

  /* A PENDING lock is needed before acquiring a SHARED lock and before
  ** acquiring an EXCLUSIVE lock.  For the SHARED lock, the PENDING will
  ** be released.
  */
  if( locktype==SHARED_LOCK 
      || (locktype==EXCLUSIVE_LOCK && pFile->locktype<PENDING_LOCK)
  ){
    lock.l_type = (locktype==SHARED_LOCK?F_RDLCK:F_WRLCK);
    lock.l_start = PENDING_BYTE;
    s = fcntl(pFile->h, F_SETLK, &lock);
    if( s==(-1) ){
      rc = (errno==EINVAL) ? SQLITE_NOLFS : SQLITE_BUSY;
      goto end_lock;
    }
  }


  /* If control gets to this point, then actually go ahead and make
  ** operating system calls for the specified lock.
  */
  if( locktype==SHARED_LOCK ){
    assert( pLock->cnt==0 );
    assert( pLock->locktype==0 );

    /* Now get the read-lock */
    lock.l_start = SHARED_FIRST;
    lock.l_len = SHARED_SIZE;
    s = fcntl(pFile->h, F_SETLK, &lock);

    /* Drop the temporary PENDING lock */
    lock.l_start = PENDING_BYTE;
    lock.l_len = 1L;
    lock.l_type = F_UNLCK;
    if( fcntl(pFile->h, F_SETLK, &lock)!=0 ){
      rc = SQLITE_IOERR_UNLOCK;  /* This should never happen */
      goto end_lock;
    }
    if( s==(-1) ){
      rc = (errno==EINVAL) ? SQLITE_NOLFS : SQLITE_BUSY;
    }else{
      pFile->locktype = SHARED_LOCK;
      pFile->pOpen->nLock++;
      pLock->cnt = 1;
    }
  }else if( locktype==EXCLUSIVE_LOCK && pLock->cnt>1 ){
    /* We are trying for an exclusive lock but another thread in this
    ** same process is still holding a shared lock. */
    rc = SQLITE_BUSY;
  }else{
    /* The request was for a RESERVED or EXCLUSIVE lock.  It is
    ** assumed that there is a SHARED or greater lock on the file
    ** already.
    */
    assert( 0!=pFile->locktype );
    lock.l_type = F_WRLCK;
    switch( locktype ){
      case RESERVED_LOCK:
        lock.l_start = RESERVED_BYTE;
        break;
      case EXCLUSIVE_LOCK:
        lock.l_start = SHARED_FIRST;
        lock.l_len = SHARED_SIZE;
        break;
      default:
        assert(0);
    }
    s = fcntl(pFile->h, F_SETLK, &lock);
    if( s==(-1) ){
      rc = (errno==EINVAL) ? SQLITE_NOLFS : SQLITE_BUSY;
    }
  }
  
  if( rc==SQLITE_OK ){
    pFile->locktype = locktype;
    pLock->locktype = locktype;
  }else if( locktype==EXCLUSIVE_LOCK ){
    pFile->locktype = PENDING_LOCK;
    pLock->locktype = PENDING_LOCK;
  }

end_lock:
  leaveMutex();
  OSTRACE4("LOCK    %d %s %s\n", pFile->h, locktypeName(locktype), 
      rc==SQLITE_OK ? "ok" : "failed");
  return rc;
}

/*
** Lower the locking level on file descriptor pFile to locktype.  locktype
** must be either NO_LOCK or SHARED_LOCK.
**
** If the locking level of the file descriptor is already at or below
** the requested locking level, this routine is a no-op.
*/
static int unixUnlock(sqlite3_file *id, int locktype){
  struct lockInfo *pLock;
  struct flock lock;
  int rc = SQLITE_OK;
  unixFile *pFile = (unixFile*)id;
  int h;

  assert( pFile );
  OSTRACE7("UNLOCK  %d %d was %d(%d,%d) pid=%d\n", pFile->h, locktype,
      pFile->locktype, pFile->pLock->locktype, pFile->pLock->cnt, getpid());

  assert( locktype<=SHARED_LOCK );
  if( pFile->locktype<=locktype ){
    return SQLITE_OK;
  }
  if( CHECK_THREADID(pFile) ){
    return SQLITE_MISUSE;
  }
  enterMutex();
  h = pFile->h;
  pLock = pFile->pLock;
  assert( pLock->cnt!=0 );
  if( pFile->locktype>SHARED_LOCK ){
    assert( pLock->locktype==pFile->locktype );
    SimulateIOErrorBenign(1);
    SimulateIOError( h=(-1) )
    SimulateIOErrorBenign(0);
    if( locktype==SHARED_LOCK ){
      lock.l_type = F_RDLCK;
      lock.l_whence = SEEK_SET;
      lock.l_start = SHARED_FIRST;
      lock.l_len = SHARED_SIZE;
      if( fcntl(h, F_SETLK, &lock)==(-1) ){
        rc = SQLITE_IOERR_RDLOCK;
      }
    }
    lock.l_type = F_UNLCK;
    lock.l_whence = SEEK_SET;
    lock.l_start = PENDING_BYTE;
    lock.l_len = 2L;  assert( PENDING_BYTE+1==RESERVED_BYTE );
    if( fcntl(h, F_SETLK, &lock)!=(-1) ){
      pLock->locktype = SHARED_LOCK;
    }else{
      rc = SQLITE_IOERR_UNLOCK;
    }
  }
  if( locktype==NO_LOCK ){
    struct openCnt *pOpen;

    /* Decrement the shared lock counter.  Release the lock using an
    ** OS call only when all threads in this same process have released
    ** the lock.
    */
    pLock->cnt--;
    if( pLock->cnt==0 ){
      lock.l_type = F_UNLCK;
      lock.l_whence = SEEK_SET;
      lock.l_start = lock.l_len = 0L;
      SimulateIOErrorBenign(1);
      SimulateIOError( h=(-1) )
      SimulateIOErrorBenign(0);
      if( fcntl(h, F_SETLK, &lock)!=(-1) ){
        pLock->locktype = NO_LOCK;
      }else{
        rc = SQLITE_IOERR_UNLOCK;
        pLock->cnt = 1;
      }
    }

    /* Decrement the count of locks against this same file.  When the
    ** count reaches zero, close any other file descriptors whose close
    ** was deferred because of outstanding locks.
    */
    if( rc==SQLITE_OK ){
      pOpen = pFile->pOpen;
      pOpen->nLock--;
      assert( pOpen->nLock>=0 );
      if( pOpen->nLock==0 && pOpen->nPending>0 ){
        int i;
        for(i=0; i<pOpen->nPending; i++){
          close(pOpen->aPending[i]);
        }
        sqlite3_free(pOpen->aPending);
        pOpen->nPending = 0;
        pOpen->aPending = 0;
      }
    }
  }
  leaveMutex();
  if( rc==SQLITE_OK ) pFile->locktype = locktype;
  return rc;
}

/*
** This function performs the parts of the "close file" operation 
** common to all locking schemes. It closes the directory and file
** handles, if they are valid, and sets all fields of the unixFile
** structure to 0.
*/
static int closeUnixFile(sqlite3_file *id){
  unixFile *pFile = (unixFile*)id;
  if( pFile ){
    if( pFile->dirfd>=0 ){
      close(pFile->dirfd);
    }
    if( pFile->h>=0 ){
      close(pFile->h);
    }
    OSTRACE2("CLOSE   %-3d\n", pFile->h);
    OpenCounter(-1);
    memset(pFile, 0, sizeof(unixFile));
  }
  return SQLITE_OK;
}

/*
** Close a file.
*/
static int unixClose(sqlite3_file *id){
  if( id ){
    unixFile *pFile = (unixFile *)id;
    unixUnlock(id, NO_LOCK);
    enterMutex();
    if( pFile->pOpen && pFile->pOpen->nLock ){
      /* If there are outstanding locks, do not actually close the file just
      ** yet because that would clear those locks.  Instead, add the file
      ** descriptor to pOpen->aPending.  It will be automatically closed when
      ** the last lock is cleared.
      */
      int *aNew;
      struct openCnt *pOpen = pFile->pOpen;
      aNew = sqlite3_realloc(pOpen->aPending, (pOpen->nPending+1)*sizeof(int) );
      if( aNew==0 ){
        /* If a malloc fails, just leak the file descriptor */
      }else{
        pOpen->aPending = aNew;
        pOpen->aPending[pOpen->nPending] = pFile->h;
        pOpen->nPending++;
        pFile->h = -1;
      }
    }
    releaseLockInfo(pFile->pLock);
    releaseOpenCnt(pFile->pOpen);
    closeUnixFile(id);
    leaveMutex();
  }
  return SQLITE_OK;
}


#ifdef SQLITE_ENABLE_LOCKING_STYLE
#pragma mark AFP Support

/*
 ** The afpLockingContext structure contains all afp lock specific state
 */
typedef struct afpLockingContext afpLockingContext;
struct afpLockingContext {
  unsigned long long sharedLockByte;
  const char *filePath;
};

struct ByteRangeLockPB2
{
  unsigned long long offset;        /* offset to first byte to lock */
  unsigned long long length;        /* nbr of bytes to lock */
  unsigned long long retRangeStart; /* nbr of 1st byte locked if successful */
  unsigned char unLockFlag;         /* 1 = unlock, 0 = lock */
  unsigned char startEndFlag;       /* 1=rel to end of fork, 0=rel to start */
  int fd;                           /* file desc to assoc this lock with */
};

#define afpfsByteRangeLock2FSCTL        _IOWR('z', 23, struct ByteRangeLockPB2)

/* 
** Return 0 on success, 1 on failure.  To match the behavior of the 
** normal posix file locking (used in unixLock for example), we should 
** provide 'richer' return codes - specifically to differentiate between
** 'file busy' and 'file system error' results.
*/
static int _AFPFSSetLock(
  const char *path, 
  int fd, 
  unsigned long long offset, 
  unsigned long long length, 
  int setLockFlag
){
  struct ByteRangeLockPB2       pb;
  int                     err;
  
  pb.unLockFlag = setLockFlag ? 0 : 1;
  pb.startEndFlag = 0;
  pb.offset = offset;
  pb.length = length; 
  pb.fd = fd;
  OSTRACE5("AFPLOCK setting lock %s for %d in range %llx:%llx\n", 
    (setLockFlag?"ON":"OFF"), fd, offset, length);
  err = fsctl(path, afpfsByteRangeLock2FSCTL, &pb, 0);
  if ( err==-1 ) {
    OSTRACE4("AFPLOCK failed to fsctl() '%s' %d %s\n", path, errno, 
      strerror(errno));
    return 1; /* error */
  } else {
    return 0;
  }
}

/*
 ** This routine checks if there is a RESERVED lock held on the specified
 ** file by this or any other process. If such a lock is held, return
 ** non-zero.  If the file is unlocked or holds only SHARED locks, then
 ** return zero.
 */
static int afpCheckReservedLock(sqlite3_file *id, int *pResOut){
  int r = 0;
  unixFile *pFile = (unixFile*)id;
  
  assert( pFile ); 
  afpLockingContext *context = (afpLockingContext *) pFile->lockingContext;
  
  /* Check if a thread in this process holds such a lock */
  if( pFile->locktype>SHARED_LOCK ){
    r = 1;
  }
  
  /* Otherwise see if some other process holds it.
   */
  if ( !r ) {
    /* lock the byte */
    int failed = _AFPFSSetLock(context->filePath, pFile->h, RESERVED_BYTE, 1,1);  
    if (failed) {
      /* if we failed to get the lock then someone else must have it */
      r = 1;
    } else {
      /* if we succeeded in taking the reserved lock, unlock it to restore
      ** the original state */
      _AFPFSSetLock(context->filePath, pFile->h, RESERVED_BYTE, 1, 0);
    }
  }
  OSTRACE3("TEST WR-LOCK %d %d\n", pFile->h, r);
  
  *pResOut = r;
  return SQLITE_OK;
}

/* AFP-style locking following the behavior of unixLock, see the unixLock 
** function comments for details of lock management. */
static int afpLock(sqlite3_file *id, int locktype){
  int rc = SQLITE_OK;
  unixFile *pFile = (unixFile*)id;
  afpLockingContext *context = (afpLockingContext *) pFile->lockingContext;
  
  assert( pFile );
  OSTRACE5("LOCK    %d %s was %s pid=%d\n", pFile->h,
         locktypeName(locktype), locktypeName(pFile->locktype), getpid());

  /* If there is already a lock of this type or more restrictive on the
  ** unixFile, do nothing. Don't use the afp_end_lock: exit path, as
  ** enterMutex() hasn't been called yet.
  */
  if( pFile->locktype>=locktype ){
    OSTRACE3("LOCK    %d %s ok (already held)\n", pFile->h,
           locktypeName(locktype));
    return SQLITE_OK;
  }

  /* Make sure the locking sequence is correct
  */
  assert( pFile->locktype!=NO_LOCK || locktype==SHARED_LOCK );
  assert( locktype!=PENDING_LOCK );
  assert( locktype!=RESERVED_LOCK || pFile->locktype==SHARED_LOCK );
  
  /* This mutex is needed because pFile->pLock is shared across threads
  */
  enterMutex();

  /* Make sure the current thread owns the pFile.
  */
  rc = transferOwnership(pFile);
  if( rc!=SQLITE_OK ){
    leaveMutex();
    return rc;
  }
    
  /* A PENDING lock is needed before acquiring a SHARED lock and before
  ** acquiring an EXCLUSIVE lock.  For the SHARED lock, the PENDING will
  ** be released.
  */
  if( locktype==SHARED_LOCK 
      || (locktype==EXCLUSIVE_LOCK && pFile->locktype<PENDING_LOCK)
  ){
    int failed;
    failed = _AFPFSSetLock(context->filePath, pFile->h, PENDING_BYTE, 1, 1);
    if (failed) {
      rc = SQLITE_BUSY;
      goto afp_end_lock;
    }
  }
  
  /* 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, failed;
    
    /* Now get the read-lock */
    /* note that the quality of the randomness doesn't matter that much */
    lk = random(); 
    context->sharedLockByte = (lk & 0x7fffffff)%(SHARED_SIZE - 1);
    failed = _AFPFSSetLock(context->filePath, pFile->h, 
      SHARED_FIRST+context->sharedLockByte, 1, 1);
    
    /* Drop the temporary PENDING lock */
    if (_AFPFSSetLock(context->filePath, pFile->h, PENDING_BYTE, 1, 0)) {
      rc = SQLITE_IOERR_UNLOCK;  /* This should never happen */
      goto afp_end_lock;
    }
    
    if( failed ){
      rc = SQLITE_BUSY;
    } else {
      pFile->locktype = SHARED_LOCK;
    }
  }else{
    /* The request was for a RESERVED or EXCLUSIVE lock.  It is
    ** assumed that there is a SHARED or greater lock on the file
    ** already.
    */
    int failed = 0;
    assert( 0!=pFile->locktype );
    if (locktype >= RESERVED_LOCK && pFile->locktype < RESERVED_LOCK) {
        /* Acquire a RESERVED lock */
        failed = _AFPFSSetLock(context->filePath, pFile->h, RESERVED_BYTE, 1,1);
    }
    if (!failed && locktype == EXCLUSIVE_LOCK) {
      /* Acquire an EXCLUSIVE lock */
        
      /* Remove the shared lock before trying the range.  we'll need to 
      ** reestablish the shared lock if we can't get the  afpUnlock
      */
      if (!_AFPFSSetLock(context->filePath, pFile->h, SHARED_FIRST +
                         context->sharedLockByte, 1, 0)) {
        /* now attemmpt to get the exclusive lock range */
        failed = _AFPFSSetLock(context->filePath, pFile->h, SHARED_FIRST, 
                               SHARED_SIZE, 1);
        if (failed && _AFPFSSetLock(context->filePath, pFile->h, SHARED_FIRST +
                                    context->sharedLockByte, 1, 1)) {
          rc = SQLITE_IOERR_RDLOCK; /* this should never happen */
        }
      } else {
        /* */
        rc = SQLITE_IOERR_UNLOCK; /* this should never happen */
      }
    }
    if( failed && rc == SQLITE_OK){
      rc = SQLITE_BUSY;
    }
  }
  
  if( rc==SQLITE_OK ){
    pFile->locktype = locktype;
  }else if( locktype==EXCLUSIVE_LOCK ){
    pFile->locktype = PENDING_LOCK;
  }
  
afp_end_lock:
  leaveMutex();
  OSTRACE4("LOCK    %d %s %s\n", pFile->h, locktypeName(locktype), 
         rc==SQLITE_OK ? "ok" : "failed");
  return rc;
}

/*
** Lower the locking level on file descriptor pFile to locktype.  locktype
** must be either NO_LOCK or SHARED_LOCK.
**
** If the locking level of the file descriptor is already at or below
** the requested locking level, this routine is a no-op.
*/
static int afpUnlock(sqlite3_file *id, int locktype) {
  int rc = SQLITE_OK;
  unixFile *pFile = (unixFile*)id;
  afpLockingContext *context = (afpLockingContext *) pFile->lockingContext;

  assert( pFile );
  OSTRACE5("UNLOCK  %d %d was %d pid=%d\n", pFile->h, locktype,
         pFile->locktype, getpid());
  
  assert( locktype<=SHARED_LOCK );
  if( pFile->locktype<=locktype ){
    return SQLITE_OK;
  }
  if( CHECK_THREADID(pFile) ){
    return SQLITE_MISUSE;
  }
  enterMutex();
  if( pFile->locktype>SHARED_LOCK ){
    if( locktype==SHARED_LOCK ){
      int failed = 0;

      /* unlock the exclusive range - then re-establish the shared lock */
      if (pFile->locktype==EXCLUSIVE_LOCK) {
        failed = _AFPFSSetLock(context->filePath, pFile->h, SHARED_FIRST, 
                                 SHARED_SIZE, 0);
        if (!failed) {
          /* successfully removed the exclusive lock */
          if (_AFPFSSetLock(context->filePath, pFile->h, SHARED_FIRST+
                            context->sharedLockByte, 1, 1)) {
            /* failed to re-establish our shared lock */
            rc = SQLITE_IOERR_RDLOCK; /* This should never happen */
          }
        } else {
          /* This should never happen - failed to unlock the exclusive range */
          rc = SQLITE_IOERR_UNLOCK;
        } 
      }
    }
    if (rc == SQLITE_OK && pFile->locktype>=PENDING_LOCK) {
      if (_AFPFSSetLock(context->filePath, pFile->h, PENDING_BYTE, 1, 0)){
        /* failed to release the pending lock */
        rc = SQLITE_IOERR_UNLOCK; /* This should never happen */
      }
    } 
    if (rc == SQLITE_OK && pFile->locktype>=RESERVED_LOCK) {
      if (_AFPFSSetLock(context->filePath, pFile->h, RESERVED_BYTE, 1, 0)) {
        /* failed to release the reserved lock */
        rc = SQLITE_IOERR_UNLOCK;  /* This should never happen */
      }
    } 
  }
  if( locktype==NO_LOCK ){
    int failed = _AFPFSSetLock(context->filePath, pFile->h, 
                               SHARED_FIRST + context->sharedLockByte, 1, 0);
    if (failed) {
      rc = SQLITE_IOERR_UNLOCK;  /* This should never happen */
    }
  }
  if (rc == SQLITE_OK)
    pFile->locktype = locktype;
  leaveMutex();
  return rc;
}

/*
** Close a file & cleanup AFP specific locking context 
*/
static int afpClose(sqlite3_file *id) {
  if( id ){
    unixFile *pFile = (unixFile*)id;
    afpUnlock(id, NO_LOCK);
    sqlite3_free(pFile->lockingContext);
  }
  return closeUnixFile(id);
}


#pragma mark flock() style locking

/*
** The flockLockingContext is not used
*/
typedef void flockLockingContext;

static int flockCheckReservedLock(sqlite3_file *id, int *pResOut){
  int r = 1;
  unixFile *pFile = (unixFile*)id;
  
  if (pFile->locktype != RESERVED_LOCK) {
    /* attempt to get the lock */
    int rc = flock(pFile->h, LOCK_EX | LOCK_NB);
    if (!rc) {
      /* got the lock, unlock it */
      flock(pFile->h, LOCK_UN);
      r = 0;  /* no one has it reserved */
    }
  }

  *pResOut = r;
  return SQLITE_OK;
}

static int flockLock(sqlite3_file *id, int locktype) {
  unixFile *pFile = (unixFile*)id;
  
  /* if we already have a lock, it is exclusive.  
  ** Just adjust level and punt on outta here. */
  if (pFile->locktype > NO_LOCK) {
    pFile->locktype = locktype;
    return SQLITE_OK;
  }
  
  /* grab an exclusive lock */
  int rc = flock(pFile->h, LOCK_EX | LOCK_NB);
  if (rc) {
    /* didn't get, must be busy */
    return SQLITE_BUSY;
  } else {
    /* got it, set the type and return ok */
    pFile->locktype = locktype;
    return SQLITE_OK;
  }
}

static int flockUnlock(sqlite3_file *id, int locktype) {
  unixFile *pFile = (unixFile*)id;
  
  assert( locktype<=SHARED_LOCK );
  
  /* no-op if possible */
  if( pFile->locktype==locktype ){
    return SQLITE_OK;
  }
  
  /* shared can just be set because we always have an exclusive */
  if (locktype==SHARED_LOCK) {
    pFile->locktype = locktype;
    return SQLITE_OK;
  }
  
  /* no, really, unlock. */
  int rc = flock(pFile->h, LOCK_UN);
  if (rc)
    return SQLITE_IOERR_UNLOCK;
  else {
    pFile->locktype = NO_LOCK;
    return SQLITE_OK;
  }
}

/*
** Close a file.
*/
static int flockClose(sqlite3_file *id) {
  if( id ){
    flockUnlock(id, NO_LOCK);
  }
  return closeUnixFile(id);
}

#pragma mark Old-School .lock file based locking

static int dotlockCheckReservedLock(sqlite3_file *id, int *pResOut) {
  int r = 1;
  unixFile *pFile = (unixFile*)id;
  char *zLockFile = (char *)pFile->lockingContext;

  if (pFile->locktype != RESERVED_LOCK) {
    struct stat statBuf;
    if (lstat(zLockFile, &statBuf) != 0){
      /* file does not exist, we could have it if we want it */
      r = 0;
    }
  }

  *pResOut = r;
  return SQLITE_OK;
}

static int dotlockLock(sqlite3_file *id, int locktype) {
  unixFile *pFile = (unixFile*)id;
  int fd;
  char *zLockFile = (char *)pFile->lockingContext;

  /* if we already have a lock, it is exclusive.  
  ** Just adjust level and punt on outta here. */
  if (pFile->locktype > NO_LOCK) {
    pFile->locktype = locktype;
    
    /* Always update the timestamp on the old file */
    utimes(zLockFile, NULL);
    return SQLITE_OK;
  }
  
  /* check to see if lock file already exists */
  struct stat statBuf;
  if (lstat(zLockFile,&statBuf) == 0){
    return SQLITE_BUSY; /* it does, busy */
  }
  
  /* grab an exclusive lock */
  fd = open(zLockFile,O_RDONLY|O_CREAT|O_EXCL,0600);
  if( fd<0 ){
    /* failed to open/create the file, someone else may have stolen the lock */
    return SQLITE_BUSY; 
  }
  close(fd);
  
  /* got it, set the type and return ok */
  pFile->locktype = locktype;
  return SQLITE_OK;
}

static int dotlockUnlock(sqlite3_file *id, int locktype) {
  unixFile *pFile = (unixFile*)id;
  char *zLockFile = (char *)pFile->lockingContext;

  assert( locktype<=SHARED_LOCK );
  
  /* no-op if possible */
  if( pFile->locktype==locktype ){
    return SQLITE_OK;
  }
  
  /* shared can just be set because we always have an exclusive */
  if (locktype==SHARED_LOCK) {
    pFile->locktype = locktype;
    return SQLITE_OK;
  }
  
  /* no, really, unlock. */
  unlink(zLockFile);
  pFile->locktype = NO_LOCK;
  return SQLITE_OK;
}

/*
 ** Close a file.
 */
static int dotlockClose(sqlite3_file *id) {
  if( id ){
    unixFile *pFile = (unixFile*)id;
    dotlockUnlock(id, NO_LOCK);
    sqlite3_free(pFile->lockingContext);
  }
  return closeUnixFile(id);
}


#endif /* SQLITE_ENABLE_LOCKING_STYLE */

/*
** The nolockLockingContext is void
*/
typedef void nolockLockingContext;

static int nolockCheckReservedLock(sqlite3_file *id, int *pResOut) {
  *pResOut = 0;
  return SQLITE_OK;
}

static int nolockLock(sqlite3_file *id, int locktype) {
  return SQLITE_OK;
}

static int nolockUnlock(sqlite3_file *id, int locktype) {
  return SQLITE_OK;
}

/*
** Close a file.
*/
static int nolockClose(sqlite3_file *id) {
  return closeUnixFile(id);
}


/*
** Information and control of an open file handle.
*/
static int unixFileControl(sqlite3_file *id, int op, void *pArg){
  switch( op ){
    case SQLITE_FCNTL_LOCKSTATE: {
      *(int*)pArg = ((unixFile*)id)->locktype;
      return SQLITE_OK;
    }
  }
  return SQLITE_ERROR;
}

/*
** Return the sector size in bytes of the underlying block device for
** the specified file. This is almost always 512 bytes, but may be
** larger for some devices.
**
** SQLite code assumes this function cannot fail. It also assumes that
** if two files are created in the same file-system directory (i.e.
** a database and its journal file) that the sector size will be the
** same for both.
*/
static int unixSectorSize(sqlite3_file *id){
  return SQLITE_DEFAULT_SECTOR_SIZE;
}

/*
** Return the device characteristics for the file. This is always 0.
*/
static int unixDeviceCharacteristics(sqlite3_file *id){
  return 0;
}

/*
** Initialize the contents of the unixFile structure pointed to by pId.
**
** When locking extensions are enabled, the filepath and locking style 
** are needed to determine the unixFile pMethod to use for locking operations.
** The locking-style specific lockingContext data structure is created 
** and assigned here also.
*/
static int fillInUnixFile(
  sqlite3_vfs *pVfs,      /* Pointer to vfs object */
  int h,                  /* Open file descriptor of file being opened */
  int dirfd,              /* Directory file descriptor */
  sqlite3_file *pId,      /* Write to the unixFile structure here */
  const char *zFilename,  /* Name of the file being opened */
  int noLock              /* Omit locking if true */
){
  int eLockingStyle;
  unixFile *pNew = (unixFile *)pId;
  int rc = SQLITE_OK;

  /* Macro to define the static contents of an sqlite3_io_methods 
  ** structure for a unix backend file. Different locking methods
  ** require different functions for the xClose, xLock, xUnlock and
  ** xCheckReservedLock methods.
  */
  #define IOMETHODS(xClose, xLock, xUnlock, xCheckReservedLock) {    \
    1,                          /* iVersion */                           \
    xClose,                     /* xClose */                             \
    unixRead,                   /* xRead */                              \
    unixWrite,                  /* xWrite */                             \
    unixTruncate,               /* xTruncate */                          \
    unixSync,                   /* xSync */                              \
    unixFileSize,               /* xFileSize */                          \
    xLock,                      /* xLock */                              \
    xUnlock,                    /* xUnlock */                            \
    xCheckReservedLock,         /* xCheckReservedLock */                 \
    unixFileControl,            /* xFileControl */                       \
    unixSectorSize,             /* xSectorSize */                        \
    unixDeviceCharacteristics   /* xDeviceCapabilities */                \
  }
  static sqlite3_io_methods aIoMethod[] = {
    IOMETHODS(unixClose, unixLock, unixUnlock, unixCheckReservedLock) 
   ,IOMETHODS(nolockClose, nolockLock, nolockUnlock, nolockCheckReservedLock)
#ifdef SQLITE_ENABLE_LOCKING_STYLE
   ,IOMETHODS(dotlockClose, dotlockLock, dotlockUnlock,dotlockCheckReservedLock)
   ,IOMETHODS(flockClose, flockLock, flockUnlock, flockCheckReservedLock)
   ,IOMETHODS(afpClose, afpLock, afpUnlock, afpCheckReservedLock)
#endif
  };
  /* The order of the IOMETHODS macros above is important.  It must be the
  ** same order as the LOCKING_STYLE numbers
  */
  assert(LOCKING_STYLE_POSIX==1);
  assert(LOCKING_STYLE_NONE==2);
  assert(LOCKING_STYLE_DOTFILE==3);
  assert(LOCKING_STYLE_FLOCK==4);
  assert(LOCKING_STYLE_AFP==5);

  assert( pNew->pLock==NULL );
  assert( pNew->pOpen==NULL );

  OSTRACE3("OPEN    %-3d %s\n", h, zFilename);    
  pNew->h = h;
  pNew->dirfd = dirfd;
  SET_THREADID(pNew);

  if( noLock ){
    eLockingStyle = LOCKING_STYLE_NONE;
  }else{
    eLockingStyle = detectLockingStyle(pVfs, zFilename, h);
  }

  switch( eLockingStyle ){

    case LOCKING_STYLE_POSIX: {
      enterMutex();
      rc = findLockInfo(h, &pNew->pLock, &pNew->pOpen);
      leaveMutex();
      break;
    }

#ifdef SQLITE_ENABLE_LOCKING_STYLE
    case LOCKING_STYLE_AFP: {
      /* AFP locking uses the file path so it needs to be included in
      ** the afpLockingContext.
      */
      afpLockingContext *pCtx;
      pNew->lockingContext = pCtx = sqlite3_malloc( sizeof(*pCtx) );
      if( pCtx==0 ){
        rc = SQLITE_NOMEM;
      }else{
        /* NB: zFilename exists and remains valid until the file is closed
        ** according to requirement F11141.  So we do not need to make a
        ** copy of the filename. */
        pCtx->filePath = zFilename;
        srandomdev();
      }
      break;
    }

    case LOCKING_STYLE_DOTFILE: {
      /* Dotfile locking uses the file path so it needs to be included in
      ** the dotlockLockingContext 
      */
      char *zLockFile;
      int nFilename;
      nFilename = strlen(zFilename) + 6;
      zLockFile = (char *)sqlite3_malloc(nFilename);
      if( zLockFile==0 ){
        rc = SQLITE_NOMEM;
      }else{
        sqlite3_snprintf(nFilename, zLockFile, "%s.lock", zFilename);
      }
      pNew->lockingContext = zLockFile;
      break;
    }

    case LOCKING_STYLE_FLOCK: 
    case LOCKING_STYLE_NONE: 
      break;
#endif
  }

  if( rc!=SQLITE_OK ){
    if( dirfd>=0 ) close(dirfd);
    close(h);
  }else{
    pNew->pMethod = &aIoMethod[eLockingStyle-1];
    OpenCounter(+1);
  }
  return rc;
}

/*
** Open a file descriptor to the directory containing file zFilename.
** If successful, *pFd is set to the opened file descriptor and
** SQLITE_OK is returned. If an error occurs, either SQLITE_NOMEM
** or SQLITE_CANTOPEN is returned and *pFd is set to an undefined
** value.
**
** If SQLITE_OK is returned, the caller is responsible for closing
** the file descriptor *pFd using close().
*/
static int openDirectory(const char *zFilename, int *pFd){
  int ii;
  int fd = -1;
  char zDirname[MAX_PATHNAME+1];

  sqlite3_snprintf(MAX_PATHNAME, zDirname, "%s", zFilename);
  for(ii=strlen(zDirname); ii>=0 && zDirname[ii]!='/'; ii--);
  if( ii>0 ){
    zDirname[ii] = '\0';
    fd = open(zDirname, O_RDONLY|O_BINARY, 0);
    if( fd>=0 ){
#ifdef FD_CLOEXEC
      fcntl(fd, F_SETFD, fcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
#endif
      OSTRACE3("OPENDIR %-3d %s\n", fd, zDirname);
    }
  }
  *pFd = fd;
  return (fd>=0?SQLITE_OK:SQLITE_CANTOPEN);
}

/*
** Create a temporary file name in zBuf.  zBuf must be allocated
** by the calling process and must be big enough to hold at least
** pVfs->mxPathname bytes.
*/
static int getTempname(int nBuf, char *zBuf){
  static const char *azDirs[] = {
     0,
     "/var/tmp",
     "/usr/tmp",
     "/tmp",
     ".",
  };
  static const unsigned char zChars[] =
    "abcdefghijklmnopqrstuvwxyz"
    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    "0123456789";
  int i, j;
  struct stat buf;
  const char *zDir = ".";

  /* It's odd to simulate an io-error here, but really this is just
  ** using the io-error infrastructure to test that SQLite handles this
  ** function failing. 
  */
  SimulateIOError( return SQLITE_IOERR );

  azDirs[0] = sqlite3_temp_directory;
  for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){
    if( azDirs[i]==0 ) continue;
    if( stat(azDirs[i], &buf) ) continue;
    if( !S_ISDIR(buf.st_mode) ) continue;
    if( access(azDirs[i], 07) ) continue;
    zDir = azDirs[i];
    break;
  }

  /* Check that the output buffer is large enough for the temporary file 
  ** name. If it is not, return SQLITE_ERROR.
  */
  if( (strlen(zDir) + strlen(SQLITE_TEMP_FILE_PREFIX) + 17) >= nBuf ){
    return SQLITE_ERROR;
  }

  do{
    sqlite3_snprintf(nBuf-17, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX, zDir);
    j = strlen(zBuf);
    sqlite3_randomness(15, &zBuf[j]);
    for(i=0; i<15; i++, j++){
      zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
    }
    zBuf[j] = 0;
  }while( access(zBuf,0)==0 );
  return SQLITE_OK;
}


/*
** Open the file zPath.
** 
** Previously, the SQLite OS layer used three functions in place of this
** one:
**
**     sqlite3OsOpenReadWrite();
**     sqlite3OsOpenReadOnly();
**     sqlite3OsOpenExclusive();
**
** These calls correspond to the following combinations of flags:
**
**     ReadWrite() ->     (READWRITE | CREATE)
**     ReadOnly()  ->     (READONLY) 
**     OpenExclusive() -> (READWRITE | CREATE | EXCLUSIVE)
**
** The old OpenExclusive() accepted a boolean argument - "delFlag". If
** true, the file was configured to be automatically deleted when the
** file handle closed. To achieve the same effect using this new 
** interface, add the DELETEONCLOSE flag to those specified above for 
** OpenExclusive().
*/
static int unixOpen(
  sqlite3_vfs *pVfs, 
  const char *zPath, 
  sqlite3_file *pFile,
  int flags,
  int *pOutFlags
){
  int fd = 0;                    /* File descriptor returned by open() */
  int dirfd = -1;                /* Directory file descriptor */
  int oflags = 0;                /* Flags to pass to open() */
  int eType = flags&0xFFFFFF00;  /* Type of file to open */
  int noLock;                    /* True to omit locking primitives */

  int isExclusive  = (flags & SQLITE_OPEN_EXCLUSIVE);
  int isDelete     = (flags & SQLITE_OPEN_DELETEONCLOSE);
  int isCreate     = (flags & SQLITE_OPEN_CREATE);
  int isReadonly   = (flags & SQLITE_OPEN_READONLY);
  int isReadWrite  = (flags & SQLITE_OPEN_READWRITE);

  /* If creating a master or main-file journal, this function will open
  ** a file-descriptor on the directory too. The first time unixSync()
  ** is called the directory file descriptor will be fsync()ed and close()d.
  */
  int isOpenDirectory = (isCreate && 
      (eType==SQLITE_OPEN_MASTER_JOURNAL || eType==SQLITE_OPEN_MAIN_JOURNAL)
  );

  /* If argument zPath is a NULL pointer, this function is required to open
  ** a temporary file. Use this buffer to store the file name in.
  */
  char zTmpname[MAX_PATHNAME+1];
  const char *zName = zPath;

  /* Check the following statements are true: 
  **
  **   (a) Exactly one of the READWRITE and READONLY flags must be set, and 
  **   (b) if CREATE is set, then READWRITE must also be set, and
  **   (c) if EXCLUSIVE is set, then CREATE must also be set.
  **   (d) if DELETEONCLOSE is set, then CREATE must also be set.
  */
  assert((isReadonly==0 || isReadWrite==0) && (isReadWrite || isReadonly));
  assert(isCreate==0 || isReadWrite);
  assert(isExclusive==0 || isCreate);
  assert(isDelete==0 || isCreate);

  /* The main DB, main journal, and master journal are never automatically
  ** deleted
  */
  assert( eType!=SQLITE_OPEN_MAIN_DB || !isDelete );
  assert( eType!=SQLITE_OPEN_MAIN_JOURNAL || !isDelete );
  assert( eType!=SQLITE_OPEN_MASTER_JOURNAL || !isDelete );

  /* Assert that the upper layer has set one of the "file-type" flags. */
  assert( eType==SQLITE_OPEN_MAIN_DB      || eType==SQLITE_OPEN_TEMP_DB 
       || eType==SQLITE_OPEN_MAIN_JOURNAL || eType==SQLITE_OPEN_TEMP_JOURNAL 
       || eType==SQLITE_OPEN_SUBJOURNAL   || eType==SQLITE_OPEN_MASTER_JOURNAL 
       || eType==SQLITE_OPEN_TRANSIENT_DB
  );

  memset(pFile, 0, sizeof(unixFile));

  if( !zName ){
    int rc;
    assert(isDelete && !isOpenDirectory);
    rc = getTempname(MAX_PATHNAME+1, zTmpname);
    if( rc!=SQLITE_OK ){
      return rc;
    }
    zName = zTmpname;
  }

  if( isReadonly )  oflags |= O_RDONLY;
  if( isReadWrite ) oflags |= O_RDWR;
  if( isCreate )    oflags |= O_CREAT;
  if( isExclusive ) oflags |= (O_EXCL|O_NOFOLLOW);
  oflags |= (O_LARGEFILE|O_BINARY);

  fd = open(zName, oflags, isDelete?0600:SQLITE_DEFAULT_FILE_PERMISSIONS);
  if( fd<0 && errno!=EISDIR && isReadWrite && !isExclusive ){
    /* Failed to open the file for read/write access. Try read-only. */
    flags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);
    flags |= SQLITE_OPEN_READONLY;
    return unixOpen(pVfs, zPath, pFile, flags, pOutFlags);
  }
  if( fd<0 ){
    return SQLITE_CANTOPEN;
  }
  if( isDelete ){
    unlink(zName);
  }
  if( pOutFlags ){
    *pOutFlags = flags;
  }

  assert(fd!=0);
  if( isOpenDirectory ){
    int rc = openDirectory(zPath, &dirfd);
    if( rc!=SQLITE_OK ){
      close(fd);
      return rc;
    }
  }

#ifdef FD_CLOEXEC
  fcntl(fd, F_SETFD, fcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
#endif

  noLock = eType!=SQLITE_OPEN_MAIN_DB;
  return fillInUnixFile(pVfs, fd, dirfd, pFile, zPath, noLock);
}

/*
** Delete the file at zPath. If the dirSync argument is true, fsync()
** the directory after deleting the file.
*/
static int unixDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
  int rc = SQLITE_OK;
  SimulateIOError(return SQLITE_IOERR_DELETE);
  unlink(zPath);
  if( dirSync ){
    int fd;
    rc = openDirectory(zPath, &fd);
    if( rc==SQLITE_OK ){
      if( fsync(fd) ){
        rc = SQLITE_IOERR_DIR_FSYNC;
      }
      close(fd);
    }
  }
  return rc;
}

/*
** Test the existance of or access permissions of file zPath. The
** test performed depends on the value of flags:
**
**     SQLITE_ACCESS_EXISTS: Return 1 if the file exists
**     SQLITE_ACCESS_READWRITE: Return 1 if the file is read and writable.
**     SQLITE_ACCESS_READONLY: Return 1 if the file is readable.
**
** Otherwise return 0.
*/
static int unixAccess(
  sqlite3_vfs *pVfs, 
  const char *zPath, 
  int flags, 
  int *pResOut
){
  int amode = 0;
  SimulateIOError( return SQLITE_IOERR_ACCESS; );
  switch( flags ){
    case SQLITE_ACCESS_EXISTS:
      amode = F_OK;
      break;
    case SQLITE_ACCESS_READWRITE:
      amode = W_OK|R_OK;
      break;
    case SQLITE_ACCESS_READ:
      amode = R_OK;
      break;

    default:
      assert(!"Invalid flags argument");
  }
  *pResOut = (access(zPath, amode)==0);
  return SQLITE_OK;
}


/*
** Turn a relative pathname into a full pathname. The relative path
** is stored as a nul-terminated string in the buffer pointed to by
** zPath. 
**
** zOut points to a buffer of at least sqlite3_vfs.mxPathname bytes 
** (in this case, MAX_PATHNAME bytes). The full-path is written to
** this buffer before returning.
*/
static int unixFullPathname(
  sqlite3_vfs *pVfs,            /* Pointer to vfs object */
  const char *zPath,            /* Possibly relative input path */
  int nOut,                     /* Size of output buffer in bytes */
  char *zOut                    /* Output buffer */
){

  /* It's odd to simulate an io-error here, but really this is just
  ** using the io-error infrastructure to test that SQLite handles this
  ** function failing. This function could fail if, for example, the
  ** current working directly has been unlinked.
  */
  SimulateIOError( return SQLITE_ERROR );

  assert( pVfs->mxPathname==MAX_PATHNAME );
  zOut[nOut-1] = '\0';
  if( zPath[0]=='/' ){
    sqlite3_snprintf(nOut, zOut, "%s", zPath);
  }else{
    int nCwd;
    if( getcwd(zOut, nOut-1)==0 ){
      return SQLITE_CANTOPEN;
    }
    nCwd = strlen(zOut);
    sqlite3_snprintf(nOut-nCwd, &zOut[nCwd], "/%s", zPath);
  }
  return SQLITE_OK;

#if 0
  /*
  ** Remove "/./" path elements and convert "/A/./" path elements
  ** to just "/".
  */
  if( zFull ){
    int i, j;
    for(i=j=0; zFull[i]; i++){
      if( zFull[i]=='/' ){
        if( zFull[i+1]=='/' ) continue;
        if( zFull[i+1]=='.' && zFull[i+2]=='/' ){
          i += 1;
          continue;
        }
        if( zFull[i+1]=='.' && zFull[i+2]=='.' && zFull[i+3]=='/' ){
          while( j>0 && zFull[j-1]!='/' ){ j--; }
          i += 3;
          continue;
        }
      }
      zFull[j++] = zFull[i];
    }
    zFull[j] = 0;
  }
#endif
}


#ifndef SQLITE_OMIT_LOAD_EXTENSION
/*
** Interfaces for opening a shared library, finding entry points
** within the shared library, and closing the shared library.
*/
#include <dlfcn.h>
static void *unixDlOpen(sqlite3_vfs *pVfs, const char *zFilename){
  return dlopen(zFilename, RTLD_NOW | RTLD_GLOBAL);
}

/*
** SQLite calls this function immediately after a call to unixDlSym() or
** unixDlOpen() fails (returns a null pointer). If a more detailed error
** message is available, it is written to zBufOut. If no error message
** is available, zBufOut is left unmodified and SQLite uses a default
** error message.
*/
static void unixDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){
  char *zErr;
  enterMutex();
  zErr = dlerror();
  if( zErr ){
    sqlite3_snprintf(nBuf, zBufOut, "%s", zErr);
  }
  leaveMutex();
}
static void *unixDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol){
  return dlsym(pHandle, zSymbol);
}
static void unixDlClose(sqlite3_vfs *pVfs, void *pHandle){
  dlclose(pHandle);
}
#else /* if SQLITE_OMIT_LOAD_EXTENSION is defined: */
  #define unixDlOpen  0
  #define unixDlError 0
  #define unixDlSym   0
  #define unixDlClose 0
#endif

/*
** Write nBuf bytes of random data to the supplied buffer zBuf.
*/
static int unixRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){

  assert(nBuf>=(sizeof(time_t)+sizeof(int)));

  /* We have to initialize zBuf to prevent valgrind from reporting
  ** errors.  The reports issued by valgrind are incorrect - we would
  ** prefer that the randomness be increased by making use of the
  ** uninitialized space in zBuf - but valgrind errors tend to worry
  ** some users.  Rather than argue, it seems easier just to initialize
  ** the whole array and silence valgrind, even if that means less randomness
  ** in the random seed.
  **
  ** When testing, initializing zBuf[] to zero is all we do.  That means
  ** that we always use the same random number sequence.  This makes the
  ** tests repeatable.
  */
  memset(zBuf, 0, nBuf);
#if !defined(SQLITE_TEST)
  {
    int pid, fd;
    fd = open("/dev/urandom", O_RDONLY);
    if( fd<0 ){
      time_t t;
      time(&t);
      memcpy(zBuf, &t, sizeof(t));
      pid = getpid();
      memcpy(&zBuf[sizeof(t)], &pid, sizeof(pid));
    }else{
      read(fd, zBuf, nBuf);
      close(fd);
    }
  }
#endif
  return SQLITE_OK;
}


/*
** Sleep for a little while.  Return the amount of time slept.
** The argument is the number of microseconds we want to sleep.
** The return value is the number of microseconds of sleep actually
** requested from the underlying operating system, a number which
** might be greater than or equal to the argument, but not less
** than the argument.
*/
static int unixSleep(sqlite3_vfs *pVfs, int microseconds){
#if defined(HAVE_USLEEP) && HAVE_USLEEP
  usleep(microseconds);
  return microseconds;
#else
  int seconds = (microseconds+999999)/1000000;
  sleep(seconds);
  return seconds*1000000;
#endif
}

/*
** The following variable, if set to a non-zero value, becomes the result
** returned from sqlite3OsCurrentTime().  This is used for testing.
*/
#ifdef SQLITE_TEST
int sqlite3_current_time = 0;
#endif

/*
** Find the current time (in Universal Coordinated Time).  Write the
** current time and date as a Julian Day number into *prNow and
** return 0.  Return 1 if the time and date cannot be found.
*/
static int unixCurrentTime(sqlite3_vfs *pVfs, double *prNow){
#ifdef NO_GETTOD
  time_t t;
  time(&t);
  *prNow = t/86400.0 + 2440587.5;
#else
  struct timeval sNow;
  gettimeofday(&sNow, 0);
  *prNow = 2440587.5 + sNow.tv_sec/86400.0 + sNow.tv_usec/86400000000.0;
#endif
#ifdef SQLITE_TEST
  if( sqlite3_current_time ){
    *prNow = sqlite3_current_time/86400.0 + 2440587.5;
  }
#endif
  return 0;
}

static int unixGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
  return 0;
}

/*
** Initialize the operating system interface.
*/
int sqlite3_os_init(void){ 
  /* Macro to define the static contents of an sqlite3_vfs structure for
  ** the unix backend. The two parameters are the values to use for
  ** the sqlite3_vfs.zName and sqlite3_vfs.pAppData fields, respectively.
  ** 
  */
  #define UNIXVFS(zVfsName, pVfsAppData) {                  \
    1,                    /* iVersion */                    \
    sizeof(unixFile),     /* szOsFile */                    \
    MAX_PATHNAME,         /* mxPathname */                  \
    0,                    /* pNext */                       \
    zVfsName,             /* zName */                       \
    (void *)pVfsAppData,  /* pAppData */                    \
    unixOpen,             /* xOpen */                       \
    unixDelete,           /* xDelete */                     \
    unixAccess,           /* xAccess */                     \
    unixFullPathname,     /* xFullPathname */               \
    unixDlOpen,           /* xDlOpen */                     \
    unixDlError,          /* xDlError */                    \
    unixDlSym,            /* xDlSym */                      \
    unixDlClose,          /* xDlClose */                    \
    unixRandomness,       /* xRandomness */                 \
    unixSleep,            /* xSleep */                      \
    unixCurrentTime,      /* xCurrentTime */                \
    unixGetLastError      /* xGetLastError */               \
  }

  static sqlite3_vfs unixVfs = UNIXVFS("unix", 0);
#ifdef SQLITE_ENABLE_LOCKING_STYLE
#if 0
  int i;
  static sqlite3_vfs aVfs[] = {
    UNIXVFS("unix-posix",   LOCKING_STYLE_POSIX), 
    UNIXVFS("unix-afp",     LOCKING_STYLE_AFP), 
    UNIXVFS("unix-flock",   LOCKING_STYLE_FLOCK), 
    UNIXVFS("unix-dotfile", LOCKING_STYLE_DOTFILE), 
    UNIXVFS("unix-none",    LOCKING_STYLE_NONE)
  };
  for(i=0; i<(sizeof(aVfs)/sizeof(sqlite3_vfs)); i++){
    sqlite3_vfs_register(&aVfs[i], 0);
  }
#endif
#endif
  sqlite3_vfs_register(&unixVfs, 1);
  return SQLITE_OK; 
}

/*
** Shutdown the operating system interface. This is a no-op for unix.
*/
int sqlite3_os_end(void){ 
  return SQLITE_OK; 
}
 
#endif /* SQLITE_OS_UNIX */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/os_win.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
/*
** 2004 May 22
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains code that is specific to windows.
**
** $Id: os_win.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "sqliteInt.h"
#if SQLITE_OS_WIN               /* This file is used for windows only */


/*
** A Note About Memory Allocation:
**
** This driver uses malloc()/free() directly rather than going through
** the SQLite-wrappers sqlite3_malloc()/sqlite3_free().  Those wrappers
** are designed for use on embedded systems where memory is scarce and
** malloc failures happen frequently.  Win32 does not typically run on
** embedded systems, and when it does the developers normally have bigger
** problems to worry about than running out of memory.  So there is not
** a compelling need to use the wrappers.
**
** But there is a good reason to not use the wrappers.  If we use the
** wrappers then we will get simulated malloc() failures within this
** driver.  And that causes all kinds of problems for our tests.  We
** could enhance SQLite to deal with simulated malloc failures within
** the OS driver, but the code to deal with those failure would not
** be exercised on Linux (which does not need to malloc() in the driver)
** and so we would have difficulty writing coverage tests for that
** code.  Better to leave the code out, we think.
**
** The point of this discussion is as follows:  When creating a new
** OS layer for an embedded system, if you use this file as an example,
** avoid the use of malloc()/free().  Those routines work ok on windows
** desktops but not so well in embedded systems.
*/

#include <winbase.h>

#ifdef __CYGWIN__
# include <sys/cygwin.h>
#endif

/*
** Macros used to determine whether or not to use threads.
*/
#if defined(THREADSAFE) && THREADSAFE
# define SQLITE_W32_THREADS 1
#endif

/*
** Include code that is common to all os_*.c files
*/
#include "os_common.h"

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

/*
** WinCE lacks native support for file locking so we have to fake it
** with some code of our own.
*/
#if SQLITE_OS_WINCE
typedef struct winceLock {
  int nReaders;       /* Number of reader locks obtained */
  BOOL bPending;      /* Indicates a pending lock has been obtained */
  BOOL bReserved;     /* Indicates a reserved lock has been obtained */
  BOOL bExclusive;    /* Indicates an exclusive lock has been obtained */
} winceLock;
#endif

/*
** The winFile structure is a subclass of sqlite3_file* specific to the win32
** portability layer.
*/
typedef struct winFile winFile;
struct winFile {
  const sqlite3_io_methods *pMethod;/* Must be first */
  HANDLE h;               /* Handle for accessing the file */
  unsigned char locktype; /* Type of lock currently held on this file */
  short sharedLockByte;   /* Randomly chosen byte used as a shared lock */
#if SQLITE_OS_WINCE
  WCHAR *zDeleteOnClose;  /* Name of file to delete when closing */
  HANDLE hMutex;          /* Mutex used to control access to shared lock */  
  HANDLE hShared;         /* Shared memory segment used for locking */
  winceLock local;        /* Locks obtained by this instance of winFile */
  winceLock *shared;      /* Global shared lock memory for the file  */
#endif
};


/*
** The following variable is (normally) set once and never changes
** thereafter.  It records whether the operating system is Win95
** or WinNT.
**
** 0:   Operating system unknown.
** 1:   Operating system is Win95.
** 2:   Operating system is WinNT.
**
** In order to facilitate testing on a WinNT system, the test fixture
** can manually set this value to 1 to emulate Win98 behavior.
*/
#ifdef SQLITE_TEST
int sqlite3_os_type = 0;
#else
static int sqlite3_os_type = 0;
#endif

/*
** Return true (non-zero) if we are running under WinNT, Win2K, WinXP,
** or WinCE.  Return false (zero) for Win95, Win98, or WinME.
**
** Here is an interesting observation:  Win95, Win98, and WinME lack
** the LockFileEx() API.  But we can still statically link against that
** API as long as we don't call it win running Win95/98/ME.  A call to
** this routine is used to determine if the host is Win95/98/ME or
** WinNT/2K/XP so that we will know whether or not we can safely call
** the LockFileEx() API.
*/
#if SQLITE_OS_WINCE
# define isNT()  (1)
#else
  static int isNT(void){
    if( sqlite3_os_type==0 ){
      OSVERSIONINFO sInfo;
      sInfo.dwOSVersionInfoSize = sizeof(sInfo);
      GetVersionEx(&sInfo);
      sqlite3_os_type = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT ? 2 : 1;
    }
    return sqlite3_os_type==2;
  }
#endif /* SQLITE_OS_WINCE */

/*
** Convert a UTF-8 string to microsoft unicode (UTF-16?). 
**
** Space to hold the returned string is obtained from malloc.
*/
static WCHAR *utf8ToUnicode(const char *zFilename){
  int nChar;
  WCHAR *zWideFilename;

  nChar = MultiByteToWideChar(CP_UTF8, 0, zFilename, -1, NULL, 0);
  zWideFilename = malloc( nChar*sizeof(zWideFilename[0]) );
  if( zWideFilename==0 ){
    return 0;
  }
  nChar = MultiByteToWideChar(CP_UTF8, 0, zFilename, -1, zWideFilename, nChar);
  if( nChar==0 ){
    free(zWideFilename);
    zWideFilename = 0;
  }
  return zWideFilename;
}

/*
** Convert microsoft unicode to UTF-8.  Space to hold the returned string is
** obtained from malloc().
*/
static char *unicodeToUtf8(const WCHAR *zWideFilename){
  int nByte;
  char *zFilename;

  nByte = WideCharToMultiByte(CP_UTF8, 0, zWideFilename, -1, 0, 0, 0, 0);
  zFilename = malloc( nByte );
  if( zFilename==0 ){
    return 0;
  }
  nByte = WideCharToMultiByte(CP_UTF8, 0, zWideFilename, -1, zFilename, nByte,
                              0, 0);
  if( nByte == 0 ){
    free(zFilename);
    zFilename = 0;
  }
  return zFilename;
}

/*
** Convert an ansi string to microsoft unicode, based on the
** current codepage settings for file apis.
** 
** Space to hold the returned string is obtained
** from malloc.
*/
static WCHAR *mbcsToUnicode(const char *zFilename){
  int nByte;
  WCHAR *zMbcsFilename;
  int codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP;

  nByte = MultiByteToWideChar(codepage, 0, zFilename, -1, NULL,0)*sizeof(WCHAR);
  zMbcsFilename = malloc( nByte*sizeof(zMbcsFilename[0]) );
  if( zMbcsFilename==0 ){
    return 0;
  }
  nByte = MultiByteToWideChar(codepage, 0, zFilename, -1, zMbcsFilename, nByte);
  if( nByte==0 ){
    free(zMbcsFilename);
    zMbcsFilename = 0;
  }
  return zMbcsFilename;
}

/*
** Convert microsoft unicode to multibyte character string, based on the
** user's Ansi codepage.
**
** Space to hold the returned string is obtained from
** malloc().
*/
static char *unicodeToMbcs(const WCHAR *zWideFilename){
  int nByte;
  char *zFilename;
  int codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP;

  nByte = WideCharToMultiByte(codepage, 0, zWideFilename, -1, 0, 0, 0, 0);
  zFilename = malloc( nByte );
  if( zFilename==0 ){
    return 0;
  }
  nByte = WideCharToMultiByte(codepage, 0, zWideFilename, -1, zFilename, nByte,
                              0, 0);
  if( nByte == 0 ){
    free(zFilename);
    zFilename = 0;
  }
  return zFilename;
}

/*
** Convert multibyte character string to UTF-8.  Space to hold the
** returned string is obtained from malloc().
*/
static char *mbcsToUtf8(const char *zFilename){
  char *zFilenameUtf8;
  WCHAR *zTmpWide;

  zTmpWide = mbcsToUnicode(zFilename);
  if( zTmpWide==0 ){
    return 0;
  }
  zFilenameUtf8 = unicodeToUtf8(zTmpWide);
  free(zTmpWide);
  return zFilenameUtf8;
}

/*
** Convert UTF-8 to multibyte character string.  Space to hold the 
** returned string is obtained from malloc().
*/
static char *utf8ToMbcs(const char *zFilename){
  char *zFilenameMbcs;
  WCHAR *zTmpWide;

  zTmpWide = utf8ToUnicode(zFilename);
  if( zTmpWide==0 ){
    return 0;
  }
  zFilenameMbcs = unicodeToMbcs(zTmpWide);
  free(zTmpWide);
  return zFilenameMbcs;
}

#if SQLITE_OS_WINCE
/*************************************************************************
** This section contains code for WinCE only.
*/
/*
** WindowsCE does not have a localtime() function.  So create a
** substitute.
*/
#include <time.h>
struct tm *__cdecl localtime(const time_t *t)
{
  static struct tm y;
  FILETIME uTm, lTm;
  SYSTEMTIME pTm;
  sqlite3_int64 t64;
  t64 = *t;
  t64 = (t64 + 11644473600)*10000000;
  uTm.dwLowDateTime = t64 & 0xFFFFFFFF;
  uTm.dwHighDateTime= t64 >> 32;
  FileTimeToLocalFileTime(&uTm,&lTm);
  FileTimeToSystemTime(&lTm,&pTm);
  y.tm_year = pTm.wYear - 1900;
  y.tm_mon = pTm.wMonth - 1;
  y.tm_wday = pTm.wDayOfWeek;
  y.tm_mday = pTm.wDay;
  y.tm_hour = pTm.wHour;
  y.tm_min = pTm.wMinute;
  y.tm_sec = pTm.wSecond;
  return &y;
}

/* This will never be called, but defined to make the code compile */
#define GetTempPathA(a,b)

#define LockFile(a,b,c,d,e)       winceLockFile(&a, b, c, d, e)
#define UnlockFile(a,b,c,d,e)     winceUnlockFile(&a, b, c, d, e)
#define LockFileEx(a,b,c,d,e,f)   winceLockFileEx(&a, b, c, d, e, f)

#define HANDLE_TO_WINFILE(a) (winFile*)&((char*)a)[-offsetof(winFile,h)]

/*
** Acquire a lock on the handle h
*/
static void winceMutexAcquire(HANDLE h){
   DWORD dwErr;
   do {
     dwErr = WaitForSingleObject(h, INFINITE);
   } while (dwErr != WAIT_OBJECT_0 && dwErr != WAIT_ABANDONED);
}
/*
** Release a lock acquired by winceMutexAcquire()
*/
#define winceMutexRelease(h) ReleaseMutex(h)

/*
** Create the mutex and shared memory used for locking in the file
** descriptor pFile
*/
static BOOL winceCreateLock(const char *zFilename, winFile *pFile){
  WCHAR *zTok;
  WCHAR *zName = utf8ToUnicode(zFilename);
  BOOL bInit = TRUE;

  /* Initialize the local lockdata */
  ZeroMemory(&pFile->local, sizeof(pFile->local));

  /* Replace the backslashes from the filename and lowercase it
  ** to derive a mutex name. */
  zTok = CharLowerW(zName);
  for (;*zTok;zTok++){
    if (*zTok == '\\') *zTok = '_';
  }

  /* Create/open the named mutex */
  pFile->hMutex = CreateMutexW(NULL, FALSE, zName);
  if (!pFile->hMutex){
    free(zName);
    return FALSE;
  }

  /* Acquire the mutex before continuing */
  winceMutexAcquire(pFile->hMutex);
  
  /* Since the names of named mutexes, semaphores, file mappings etc are 
  ** case-sensitive, take advantage of that by uppercasing the mutex name
  ** and using that as the shared filemapping name.
  */
  CharUpperW(zName);
  pFile->hShared = CreateFileMappingW(INVALID_HANDLE_VALUE, NULL,
                                       PAGE_READWRITE, 0, sizeof(winceLock),
                                       zName);  

  /* Set a flag that indicates we're the first to create the memory so it 
  ** must be zero-initialized */
  if (GetLastError() == ERROR_ALREADY_EXISTS){
    bInit = FALSE;
  }

  free(zName);

  /* If we succeeded in making the shared memory handle, map it. */
  if (pFile->hShared){
    pFile->shared = (winceLock*)MapViewOfFile(pFile->hShared, 
             FILE_MAP_READ|FILE_MAP_WRITE, 0, 0, sizeof(winceLock));
    /* If mapping failed, close the shared memory handle and erase it */
    if (!pFile->shared){
      CloseHandle(pFile->hShared);
      pFile->hShared = NULL;
    }
  }

  /* If shared memory could not be created, then close the mutex and fail */
  if (pFile->hShared == NULL){
    winceMutexRelease(pFile->hMutex);
    CloseHandle(pFile->hMutex);
    pFile->hMutex = NULL;
    return FALSE;
  }
  
  /* Initialize the shared memory if we're supposed to */
  if (bInit) {
    ZeroMemory(pFile->shared, sizeof(winceLock));
  }

  winceMutexRelease(pFile->hMutex);
  return TRUE;
}

/*
** Destroy the part of winFile that deals with wince locks
*/
static void winceDestroyLock(winFile *pFile){
  if (pFile->hMutex){
    /* Acquire the mutex */
    winceMutexAcquire(pFile->hMutex);

    /* The following blocks should probably assert in debug mode, but they
       are to cleanup in case any locks remained open */
    if (pFile->local.nReaders){
      pFile->shared->nReaders --;
    }
    if (pFile->local.bReserved){
      pFile->shared->bReserved = FALSE;
    }
    if (pFile->local.bPending){
      pFile->shared->bPending = FALSE;
    }
    if (pFile->local.bExclusive){
      pFile->shared->bExclusive = FALSE;
    }

    /* De-reference and close our copy of the shared memory handle */
    UnmapViewOfFile(pFile->shared);
    CloseHandle(pFile->hShared);

    /* Done with the mutex */
    winceMutexRelease(pFile->hMutex);    
    CloseHandle(pFile->hMutex);
    pFile->hMutex = NULL;
  }
}

/* 
** An implementation of the LockFile() API of windows for wince
*/
static BOOL winceLockFile(
  HANDLE *phFile,
  DWORD dwFileOffsetLow,
  DWORD dwFileOffsetHigh,
  DWORD nNumberOfBytesToLockLow,
  DWORD nNumberOfBytesToLockHigh
){
  winFile *pFile = HANDLE_TO_WINFILE(phFile);
  BOOL bReturn = FALSE;

  if (!pFile->hMutex) return TRUE;
  winceMutexAcquire(pFile->hMutex);

  /* Wanting an exclusive lock? */
  if (dwFileOffsetLow == SHARED_FIRST
       && nNumberOfBytesToLockLow == SHARED_SIZE){
    if (pFile->shared->nReaders == 0 && pFile->shared->bExclusive == 0){
       pFile->shared->bExclusive = TRUE;
       pFile->local.bExclusive = TRUE;
       bReturn = TRUE;
    }
  }

  /* Want a read-only lock? */
  else if ((dwFileOffsetLow >= SHARED_FIRST &&
            dwFileOffsetLow < SHARED_FIRST + SHARED_SIZE) &&
            nNumberOfBytesToLockLow == 1){
    if (pFile->shared->bExclusive == 0){
      pFile->local.nReaders ++;
      if (pFile->local.nReaders == 1){
        pFile->shared->nReaders ++;
      }
      bReturn = TRUE;
    }
  }

  /* Want a pending lock? */
  else if (dwFileOffsetLow == PENDING_BYTE && nNumberOfBytesToLockLow == 1){
    /* If no pending lock has been acquired, then acquire it */
    if (pFile->shared->bPending == 0) {
      pFile->shared->bPending = TRUE;
      pFile->local.bPending = TRUE;
      bReturn = TRUE;
    }
  }
  /* Want a reserved lock? */
  else if (dwFileOffsetLow == RESERVED_BYTE && nNumberOfBytesToLockLow == 1){
    if (pFile->shared->bReserved == 0) {
      pFile->shared->bReserved = TRUE;
      pFile->local.bReserved = TRUE;
      bReturn = TRUE;
    }
  }

  winceMutexRelease(pFile->hMutex);
  return bReturn;
}

/*
** An implementation of the UnlockFile API of windows for wince
*/
static BOOL winceUnlockFile(
  HANDLE *phFile,
  DWORD dwFileOffsetLow,
  DWORD dwFileOffsetHigh,
  DWORD nNumberOfBytesToUnlockLow,
  DWORD nNumberOfBytesToUnlockHigh
){
  winFile *pFile = HANDLE_TO_WINFILE(phFile);
  BOOL bReturn = FALSE;

  if (!pFile->hMutex) return TRUE;
  winceMutexAcquire(pFile->hMutex);

  /* Releasing a reader lock or an exclusive lock */
  if (dwFileOffsetLow >= SHARED_FIRST &&
       dwFileOffsetLow < SHARED_FIRST + SHARED_SIZE){
    /* Did we have an exclusive lock? */
    if (pFile->local.bExclusive){
      pFile->local.bExclusive = FALSE;
      pFile->shared->bExclusive = FALSE;
      bReturn = TRUE;
    }

    /* Did we just have a reader lock? */
    else if (pFile->local.nReaders){
      pFile->local.nReaders --;
      if (pFile->local.nReaders == 0)
      {
        pFile->shared->nReaders --;
      }
      bReturn = TRUE;
    }
  }

  /* Releasing a pending lock */
  else if (dwFileOffsetLow == PENDING_BYTE && nNumberOfBytesToUnlockLow == 1){
    if (pFile->local.bPending){
      pFile->local.bPending = FALSE;
      pFile->shared->bPending = FALSE;
      bReturn = TRUE;
    }
  }
  /* Releasing a reserved lock */
  else if (dwFileOffsetLow == RESERVED_BYTE && nNumberOfBytesToUnlockLow == 1){
    if (pFile->local.bReserved) {
      pFile->local.bReserved = FALSE;
      pFile->shared->bReserved = FALSE;
      bReturn = TRUE;
    }
  }

  winceMutexRelease(pFile->hMutex);
  return bReturn;
}

/*
** An implementation of the LockFileEx() API of windows for wince
*/
static BOOL winceLockFileEx(
  HANDLE *phFile,
  DWORD dwFlags,
  DWORD dwReserved,
  DWORD nNumberOfBytesToLockLow,
  DWORD nNumberOfBytesToLockHigh,
  LPOVERLAPPED lpOverlapped
){
  /* If the caller wants a shared read lock, forward this call
  ** to winceLockFile */
  if (lpOverlapped->Offset == SHARED_FIRST &&
      dwFlags == 1 &&
      nNumberOfBytesToLockLow == SHARED_SIZE){
    return winceLockFile(phFile, SHARED_FIRST, 0, 1, 0);
  }
  return FALSE;
}
/*
** End of the special code for wince
*****************************************************************************/
#endif /* SQLITE_OS_WINCE */

/*****************************************************************************
** The next group of routines implement the I/O methods specified
** by the sqlite3_io_methods object.
******************************************************************************/

/*
** Close a file.
**
** It is reported that an attempt to close a handle might sometimes
** fail.  This is a very unreasonable result, but windows is notorious
** for being unreasonable so I do not doubt that it might happen.  If
** the close fails, we pause for 100 milliseconds and try again.  As
** many as MX_CLOSE_ATTEMPT attempts to close the handle are made before
** giving up and returning an error.
*/
#define MX_CLOSE_ATTEMPT 3
static int winClose(sqlite3_file *id){
  int rc, cnt = 0;
  winFile *pFile = (winFile*)id;
  OSTRACE2("CLOSE %d\n", pFile->h);
  do{
    rc = CloseHandle(pFile->h);
  }while( rc==0 && cnt++ < MX_CLOSE_ATTEMPT && (Sleep(100), 1) );
#if SQLITE_OS_WINCE
#define WINCE_DELETION_ATTEMPTS 3
  winceDestroyLock(pFile);
  if( pFile->zDeleteOnClose ){
    int cnt = 0;
    while(
           DeleteFileW(pFile->zDeleteOnClose)==0
        && GetFileAttributesW(pFile->zDeleteOnClose)!=0xffffffff 
        && cnt++ < WINCE_DELETION_ATTEMPTS
    ){
       Sleep(100);  /* Wait a little before trying again */
    }
    free(pFile->zDeleteOnClose);
  }
#endif
  OpenCounter(-1);
  return rc ? SQLITE_OK : SQLITE_IOERR;
}

/*
** Some microsoft compilers lack this definition.
*/
#ifndef INVALID_SET_FILE_POINTER
# define INVALID_SET_FILE_POINTER ((DWORD)-1)
#endif

/*
** Read data from a file into a buffer.  Return SQLITE_OK if all
** bytes were read successfully and SQLITE_IOERR if anything goes
** wrong.
*/
static int winRead(
  sqlite3_file *id,          /* File to read from */
  void *pBuf,                /* Write content into this buffer */
  int amt,                   /* Number of bytes to read */
  sqlite3_int64 offset       /* Begin reading at this offset */
){
  LONG upperBits = (offset>>32) & 0x7fffffff;
  LONG lowerBits = offset & 0xffffffff;
  DWORD rc;
  DWORD got;
  winFile *pFile = (winFile*)id;
  assert( id!=0 );
  SimulateIOError(return SQLITE_IOERR_READ);
  OSTRACE3("READ %d lock=%d\n", pFile->h, pFile->locktype);
  rc = SetFilePointer(pFile->h, lowerBits, &upperBits, FILE_BEGIN);
  if( rc==INVALID_SET_FILE_POINTER && GetLastError()!=NO_ERROR ){
    return SQLITE_FULL;
  }
  if( !ReadFile(pFile->h, pBuf, amt, &got, 0) ){
    return SQLITE_IOERR_READ;
  }
  if( got==(DWORD)amt ){
    return SQLITE_OK;
  }else{
    memset(&((char*)pBuf)[got], 0, amt-got);
    return SQLITE_IOERR_SHORT_READ;
  }
}

/*
** Write data from a buffer into a file.  Return SQLITE_OK on success
** or some other error code on failure.
*/
static int winWrite(
  sqlite3_file *id,         /* File to write into */
  const void *pBuf,         /* The bytes to be written */
  int amt,                  /* Number of bytes to write */
  sqlite3_int64 offset      /* Offset into the file to begin writing at */
){
  LONG upperBits = (offset>>32) & 0x7fffffff;
  LONG lowerBits = offset & 0xffffffff;
  DWORD rc;
  DWORD wrote;
  winFile *pFile = (winFile*)id;
  assert( id!=0 );
  SimulateIOError(return SQLITE_IOERR_WRITE);
  SimulateDiskfullError(return SQLITE_FULL);
  OSTRACE3("WRITE %d lock=%d\n", pFile->h, pFile->locktype);
  rc = SetFilePointer(pFile->h, lowerBits, &upperBits, FILE_BEGIN);
  if( rc==INVALID_SET_FILE_POINTER && GetLastError()!=NO_ERROR ){
    return SQLITE_FULL;
  }
  assert( amt>0 );
  while(
     amt>0
     && (rc = WriteFile(pFile->h, pBuf, amt, &wrote, 0))!=0
     && wrote>0
  ){
    amt -= wrote;
    pBuf = &((char*)pBuf)[wrote];
  }
  if( !rc || amt>(int)wrote ){
    return SQLITE_FULL;
  }
  return SQLITE_OK;
}

/*
** Truncate an open file to a specified size
*/
static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){
  LONG upperBits = (nByte>>32) & 0x7fffffff;
  LONG lowerBits = nByte & 0xffffffff;
  winFile *pFile = (winFile*)id;
  OSTRACE3("TRUNCATE %d %lld\n", pFile->h, nByte);
  SimulateIOError(return SQLITE_IOERR_TRUNCATE);
  SetFilePointer(pFile->h, lowerBits, &upperBits, FILE_BEGIN);
  SetEndOfFile(pFile->h);
  return SQLITE_OK;
}

#ifdef SQLITE_TEST
/*
** Count the number of fullsyncs and normal syncs.  This is used to test
** that syncs and fullsyncs are occuring at the right times.
*/
int sqlite3_sync_count = 0;
int sqlite3_fullsync_count = 0;
#endif

/*
** Make sure all writes to a particular file are committed to disk.
*/
static int winSync(sqlite3_file *id, int flags){
  winFile *pFile = (winFile*)id;
  OSTRACE3("SYNC %d lock=%d\n", pFile->h, pFile->locktype);
#ifdef SQLITE_TEST
  if( flags & SQLITE_SYNC_FULL ){
    sqlite3_fullsync_count++;
  }
  sqlite3_sync_count++;
#endif
  if( FlushFileBuffers(pFile->h) ){
    return SQLITE_OK;
  }else{
    return SQLITE_IOERR;
  }
}

/*
** Determine the current size of a file in bytes
*/
static int winFileSize(sqlite3_file *id, sqlite3_int64 *pSize){
  winFile *pFile = (winFile*)id;
  DWORD upperBits, lowerBits;
  SimulateIOError(return SQLITE_IOERR_FSTAT);
  lowerBits = GetFileSize(pFile->h, &upperBits);
  *pSize = (((sqlite3_int64)upperBits)<<32) + lowerBits;
  return SQLITE_OK;
}

/*
** LOCKFILE_FAIL_IMMEDIATELY is undefined on some Windows systems.
*/
#ifndef LOCKFILE_FAIL_IMMEDIATELY
# define LOCKFILE_FAIL_IMMEDIATELY 1
#endif

/*
** Acquire a reader lock.
** Different API routines are called depending on whether or not this
** is Win95 or WinNT.
*/
static int getReadLock(winFile *pFile){
  int res;
  if( isNT() ){
    OVERLAPPED ovlp;
    ovlp.Offset = SHARED_FIRST;
    ovlp.OffsetHigh = 0;
    ovlp.hEvent = 0;
    res = LockFileEx(pFile->h, LOCKFILE_FAIL_IMMEDIATELY,
                     0, SHARED_SIZE, 0, &ovlp);
  }else{
    int lk;
    sqlite3_randomness(sizeof(lk), &lk);
    pFile->sharedLockByte = (lk & 0x7fffffff)%(SHARED_SIZE - 1);
    res = LockFile(pFile->h, SHARED_FIRST+pFile->sharedLockByte, 0, 1, 0);
  }
  return res;
}

/*
** Undo a readlock
*/
static int unlockReadLock(winFile *pFile){
  int res;
  if( isNT() ){
    res = UnlockFile(pFile->h, SHARED_FIRST, 0, SHARED_SIZE, 0);
  }else{
    res = UnlockFile(pFile->h, SHARED_FIRST + pFile->sharedLockByte, 0, 1, 0);
  }
  return res;
}

/*
** Lock the file with the lock specified by parameter locktype - one
** of the following:
**
**     (1) SHARED_LOCK
**     (2) RESERVED_LOCK
**     (3) PENDING_LOCK
**     (4) EXCLUSIVE_LOCK
**
** Sometimes when requesting one lock state, additional lock states
** are inserted in between.  The locking might fail on one of the later
** transitions leaving the lock state different from what it started but
** still short of its goal.  The following chart shows the allowed
** transitions and the inserted intermediate states:
**
**    UNLOCKED -> SHARED
**    SHARED -> RESERVED
**    SHARED -> (PENDING) -> EXCLUSIVE
**    RESERVED -> (PENDING) -> EXCLUSIVE
**    PENDING -> EXCLUSIVE
**
** This routine will only increase a lock.  The winUnlock() routine
** erases all locks at once and returns us immediately to locking level 0.
** It is not possible to lower the locking level one step at a time.  You
** must go straight to locking level 0.
*/
static int winLock(sqlite3_file *id, int locktype){
  int rc = SQLITE_OK;    /* Return code from subroutines */
  int res = 1;           /* Result of a windows lock call */
  int newLocktype;       /* Set pFile->locktype to this value before exiting */
  int gotPendingLock = 0;/* True if we acquired a PENDING lock this time */
  winFile *pFile = (winFile*)id;

  assert( pFile!=0 );
  OSTRACE5("LOCK %d %d was %d(%d)\n",
          pFile->h, locktype, pFile->locktype, pFile->sharedLockByte);

  /* If there is already a lock of this type or more restrictive on the
  ** OsFile, do nothing. Don't use the end_lock: exit path, as
  ** sqlite3OsEnterMutex() hasn't been called yet.
  */
  if( pFile->locktype>=locktype ){
    return SQLITE_OK;
  }

  /* Make sure the locking sequence is correct
  */
  assert( pFile->locktype!=NO_LOCK || locktype==SHARED_LOCK );
  assert( locktype!=PENDING_LOCK );
  assert( locktype!=RESERVED_LOCK || pFile->locktype==SHARED_LOCK );

  /* Lock the PENDING_LOCK byte if we need to acquire a PENDING lock or
  ** a SHARED lock.  If we are acquiring a SHARED lock, the acquisition of
  ** the PENDING_LOCK byte is temporary.
  */
  newLocktype = pFile->locktype;
  if( pFile->locktype==NO_LOCK
   || (locktype==EXCLUSIVE_LOCK && pFile->locktype==RESERVED_LOCK)
  ){
    int cnt = 3;
    while( cnt-->0 && (res = LockFile(pFile->h, PENDING_BYTE, 0, 1, 0))==0 ){
      /* Try 3 times to get the pending lock.  The pending lock might be
      ** held by another reader process who will release it momentarily.
      */
      OSTRACE2("could not get a PENDING lock. cnt=%d\n", cnt);
      Sleep(1);
    }
    gotPendingLock = res;
  }

  /* Acquire a shared lock
  */
  if( locktype==SHARED_LOCK && res ){
    assert( pFile->locktype==NO_LOCK );
    res = getReadLock(pFile);
    if( res ){
      newLocktype = SHARED_LOCK;
    }
  }

  /* Acquire a RESERVED lock
  */
  if( locktype==RESERVED_LOCK && res ){
    assert( pFile->locktype==SHARED_LOCK );
    res = LockFile(pFile->h, RESERVED_BYTE, 0, 1, 0);
    if( res ){
      newLocktype = RESERVED_LOCK;
    }
  }

  /* Acquire a PENDING lock
  */
  if( locktype==EXCLUSIVE_LOCK && res ){
    newLocktype = PENDING_LOCK;
    gotPendingLock = 0;
  }

  /* Acquire an EXCLUSIVE lock
  */
  if( locktype==EXCLUSIVE_LOCK && res ){
    assert( pFile->locktype>=SHARED_LOCK );
    res = unlockReadLock(pFile);
    OSTRACE2("unreadlock = %d\n", res);
    res = LockFile(pFile->h, SHARED_FIRST, 0, SHARED_SIZE, 0);
    if( res ){
      newLocktype = EXCLUSIVE_LOCK;
    }else{
      OSTRACE2("error-code = %d\n", GetLastError());
      getReadLock(pFile);
    }
  }

  /* If we are holding a PENDING lock that ought to be released, then
  ** release it now.
  */
  if( gotPendingLock && locktype==SHARED_LOCK ){
    UnlockFile(pFile->h, PENDING_BYTE, 0, 1, 0);
  }

  /* Update the state of the lock has held in the file descriptor then
  ** return the appropriate result code.
  */
  if( res ){
    rc = SQLITE_OK;
  }else{
    OSTRACE4("LOCK FAILED %d trying for %d but got %d\n", pFile->h,
           locktype, newLocktype);
    rc = SQLITE_BUSY;
  }
  pFile->locktype = newLocktype;
  return rc;
}

/*
** This routine checks if there is a RESERVED lock held on the specified
** file by this or any other process. If such a lock is held, return
** non-zero, otherwise zero.
*/
static int winCheckReservedLock(sqlite3_file *id, int *pResOut){
  int rc;
  winFile *pFile = (winFile*)id;
  assert( pFile!=0 );
  if( pFile->locktype>=RESERVED_LOCK ){
    rc = 1;
    OSTRACE3("TEST WR-LOCK %d %d (local)\n", pFile->h, rc);
  }else{
    rc = LockFile(pFile->h, RESERVED_BYTE, 0, 1, 0);
    if( rc ){
      UnlockFile(pFile->h, RESERVED_BYTE, 0, 1, 0);
    }
    rc = !rc;
    OSTRACE3("TEST WR-LOCK %d %d (remote)\n", pFile->h, rc);
  }
  *pResOut = rc;
  return SQLITE_OK;
}

/*
** Lower the locking level on file descriptor id to locktype.  locktype
** must be either NO_LOCK or SHARED_LOCK.
**
** If the locking level of the file descriptor is already at or below
** the requested locking level, this routine is a no-op.
**
** It is not possible for this routine to fail if the second argument
** is NO_LOCK.  If the second argument is SHARED_LOCK then this routine
** might return SQLITE_IOERR;
*/
static int winUnlock(sqlite3_file *id, int locktype){
  int type;
  winFile *pFile = (winFile*)id;
  int rc = SQLITE_OK;
  assert( pFile!=0 );
  assert( locktype<=SHARED_LOCK );
  OSTRACE5("UNLOCK %d to %d was %d(%d)\n", pFile->h, locktype,
          pFile->locktype, pFile->sharedLockByte);
  type = pFile->locktype;
  if( type>=EXCLUSIVE_LOCK ){
    UnlockFile(pFile->h, SHARED_FIRST, 0, SHARED_SIZE, 0);
    if( locktype==SHARED_LOCK && !getReadLock(pFile) ){
      /* This should never happen.  We should always be able to
      ** reacquire the read lock */
      rc = SQLITE_IOERR_UNLOCK;
    }
  }
  if( type>=RESERVED_LOCK ){
    UnlockFile(pFile->h, RESERVED_BYTE, 0, 1, 0);
  }
  if( locktype==NO_LOCK && type>=SHARED_LOCK ){
    unlockReadLock(pFile);
  }
  if( type>=PENDING_LOCK ){
    UnlockFile(pFile->h, PENDING_BYTE, 0, 1, 0);
  }
  pFile->locktype = locktype;
  return rc;
}

/*
** Control and query of the open file handle.
*/
static int winFileControl(sqlite3_file *id, int op, void *pArg){
  switch( op ){
    case SQLITE_FCNTL_LOCKSTATE: {
      *(int*)pArg = ((winFile*)id)->locktype;
      return SQLITE_OK;
    }
  }
  return SQLITE_ERROR;
}

/*
** Return the sector size in bytes of the underlying block device for
** the specified file. This is almost always 512 bytes, but may be
** larger for some devices.
**
** SQLite code assumes this function cannot fail. It also assumes that
** if two files are created in the same file-system directory (i.e.
** a database and its journal file) that the sector size will be the
** same for both.
*/
static int winSectorSize(sqlite3_file *id){
  return SQLITE_DEFAULT_SECTOR_SIZE;
}

/*
** Return a vector of device characteristics.
*/
static int winDeviceCharacteristics(sqlite3_file *id){
  return 0;
}

/*
** This vector defines all the methods that can operate on an
** sqlite3_file for win32.
*/
static const sqlite3_io_methods winIoMethod = {
  1,                        /* iVersion */
  winClose,
  winRead,
  winWrite,
  winTruncate,
  winSync,
  winFileSize,
  winLock,
  winUnlock,
  winCheckReservedLock,
  winFileControl,
  winSectorSize,
  winDeviceCharacteristics
};

/***************************************************************************
** Here ends the I/O methods that form the sqlite3_io_methods object.
**
** The next block of code implements the VFS methods.
****************************************************************************/

/*
** Convert a UTF-8 filename into whatever form the underlying
** operating system wants filenames in.  Space to hold the result
** is obtained from malloc and must be freed by the calling
** function.
*/
static void *convertUtf8Filename(const char *zFilename){
  void *zConverted = 0;
  if( isNT() ){
    zConverted = utf8ToUnicode(zFilename);
  }else{
    zConverted = utf8ToMbcs(zFilename);
  }
  /* caller will handle out of memory */
  return zConverted;
}

/*
** Create a temporary file name in zBuf.  zBuf must be big enough to
** hold at pVfs->mxPathname characters.
*/
static int getTempname(int nBuf, char *zBuf){
  static char zChars[] =
    "abcdefghijklmnopqrstuvwxyz"
    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    "0123456789";
  size_t i, j;
  char zTempPath[MAX_PATH+1];
  if( sqlite3_temp_directory ){
    sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", sqlite3_temp_directory);
  }else if( isNT() ){
    char *zMulti;
    WCHAR zWidePath[MAX_PATH];
    GetTempPathW(MAX_PATH-30, zWidePath);
    zMulti = unicodeToUtf8(zWidePath);
    if( zMulti ){
      sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zMulti);
      free(zMulti);
    }else{
      return SQLITE_NOMEM;
    }
  }else{
    char *zUtf8;
    char zMbcsPath[MAX_PATH];
    GetTempPathA(MAX_PATH-30, zMbcsPath);
    zUtf8 = mbcsToUtf8(zMbcsPath);
    if( zUtf8 ){
      sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zUtf8);
      free(zUtf8);
    }else{
      return SQLITE_NOMEM;
    }
  }
  for(i=strlen(zTempPath); i>0 && zTempPath[i-1]=='\\'; i--){}
  zTempPath[i] = 0;
  sqlite3_snprintf(nBuf-30, zBuf,
                   "%s\\"SQLITE_TEMP_FILE_PREFIX, zTempPath);
  j = strlen(zBuf);
  sqlite3_randomness(20, &zBuf[j]);
  for(i=0; i<20; i++, j++){
    zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ];
  }
  zBuf[j] = 0;
  OSTRACE2("TEMP FILENAME: %s\n", zBuf);
  return SQLITE_OK; 
}

/*
** 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(
  sqlite3_vfs *pVfs,        /* Not used */
  const char *zName,        /* Name of the file (UTF-8) */
  sqlite3_file *id,         /* Write the SQLite file handle here */
  int flags,                /* Open mode flags */
  int *pOutFlags            /* Status return flags */
){
  HANDLE h;
  DWORD dwDesiredAccess;
  DWORD dwShareMode;
  DWORD dwCreationDisposition;
  DWORD dwFlagsAndAttributes = 0;
  int isTemp;
  winFile *pFile = (winFile*)id;
  void *zConverted;                 /* Filename in OS encoding */
  const char *zUtf8Name = zName;    /* Filename in UTF-8 encoding */
  char zTmpname[MAX_PATH+1];        /* Buffer used to create temp filename */

  /* If the second argument to this function is NULL, generate a 
  ** temporary file name to use 
  */
  if( !zUtf8Name ){
    int rc = getTempname(MAX_PATH+1, zTmpname);
    if( rc!=SQLITE_OK ){
      return rc;
    }
    zUtf8Name = zTmpname;
  }

  /* Convert the filename to the system encoding. */
  zConverted = convertUtf8Filename(zUtf8Name);
  if( zConverted==0 ){
    return SQLITE_NOMEM;
  }

  if( flags & SQLITE_OPEN_READWRITE ){
    dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
  }else{
    dwDesiredAccess = GENERIC_READ;
  }
  if( flags & SQLITE_OPEN_CREATE ){
    dwCreationDisposition = OPEN_ALWAYS;
  }else{
    dwCreationDisposition = OPEN_EXISTING;
  }
  if( flags & SQLITE_OPEN_MAIN_DB ){
    dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
  }else{
    dwShareMode = 0;
  }
  if( flags & SQLITE_OPEN_DELETEONCLOSE ){
#if SQLITE_OS_WINCE
    dwFlagsAndAttributes = FILE_ATTRIBUTE_HIDDEN;
#else
    dwFlagsAndAttributes = FILE_ATTRIBUTE_TEMPORARY
                               | FILE_ATTRIBUTE_HIDDEN
                               | FILE_FLAG_DELETE_ON_CLOSE;
#endif
    isTemp = 1;
  }else{
    dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL;
    isTemp = 0;
  }
  /* Reports from the internet are that performance is always
  ** better if FILE_FLAG_RANDOM_ACCESS is used.  Ticket #2699. */
  dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS;
  if( isNT() ){
    h = CreateFileW((WCHAR*)zConverted,
       dwDesiredAccess,
       dwShareMode,
       NULL,
       dwCreationDisposition,
       dwFlagsAndAttributes,
       NULL
    );
  }else{
    h = CreateFileA((char*)zConverted,
       dwDesiredAccess,
       dwShareMode,
       NULL,
       dwCreationDisposition,
       dwFlagsAndAttributes,
       NULL
    );
  }
  if( h==INVALID_HANDLE_VALUE ){
    free(zConverted);
    if( flags & SQLITE_OPEN_READWRITE ){
      return winOpen(0, zName, id, 
             ((flags|SQLITE_OPEN_READONLY)&~SQLITE_OPEN_READWRITE), pOutFlags);
    }else{
      return SQLITE_CANTOPEN;
    }
  }
  if( pOutFlags ){
    if( flags & SQLITE_OPEN_READWRITE ){
      *pOutFlags = SQLITE_OPEN_READWRITE;
    }else{
      *pOutFlags = SQLITE_OPEN_READONLY;
    }
  }
  memset(pFile, 0, sizeof(*pFile));
  pFile->pMethod = &winIoMethod;
  pFile->h = h;
#if SQLITE_OS_WINCE
  if( (flags & (SQLITE_OPEN_READWRITE|SQLITE_OPEN_MAIN_DB)) ==
               (SQLITE_OPEN_READWRITE|SQLITE_OPEN_MAIN_DB)
       && !winceCreateLock(zName, pFile)
  ){
    CloseHandle(h);
    free(zConverted);
    return SQLITE_CANTOPEN;
  }
  if( isTemp ){
    pFile->zDeleteOnClose = zConverted;
  }else
#endif
  {
    free(zConverted);
  }
  OpenCounter(+1);
  return SQLITE_OK;
}

/*
** Delete the named file.
**
** Note that windows does not allow a file to be deleted if some other
** process has it open.  Sometimes a virus scanner or indexing program
** will open a journal file shortly after it is created in order to do
** whatever it does.  While this other process is holding the
** file open, we will be unable to delete it.  To work around this
** problem, we delay 100 milliseconds and try to delete again.  Up
** to MX_DELETION_ATTEMPTs deletion attempts are run before giving
** up and returning an error.
*/
#define MX_DELETION_ATTEMPTS 5
static int winDelete(
  sqlite3_vfs *pVfs,          /* Not used on win32 */
  const char *zFilename,      /* Name of file to delete */
  int syncDir                 /* Not used on win32 */
){
  int cnt = 0;
  int rc;
  DWORD error;
  void *zConverted = convertUtf8Filename(zFilename);
  if( zConverted==0 ){
    return SQLITE_NOMEM;
  }
  SimulateIOError(return SQLITE_IOERR_DELETE);
  if( isNT() ){
    do{
      DeleteFileW(zConverted);
    }while(   (   ((rc = GetFileAttributesW(zConverted)) != INVALID_FILE_ATTRIBUTES)
               || ((error = GetLastError()) == ERROR_ACCESS_DENIED))
           && (cnt++ < MX_DELETION_ATTEMPTS)
           && (Sleep(100), 1) );
  }else{
    do{
      DeleteFileA(zConverted);
    }while(   (   ((rc = GetFileAttributesA(zConverted)) != INVALID_FILE_ATTRIBUTES)
               || ((error = GetLastError()) == ERROR_ACCESS_DENIED))
           && (cnt++ < MX_DELETION_ATTEMPTS)
           && (Sleep(100), 1) );
  }
  free(zConverted);
  OSTRACE2("DELETE \"%s\"\n", zFilename);
  return (   (rc==INVALID_FILE_ATTRIBUTES) 
          && (error == ERROR_FILE_NOT_FOUND)) ? SQLITE_OK : SQLITE_IOERR_DELETE;
}

/*
** Check the existance and status of a file.
*/
static int winAccess(
  sqlite3_vfs *pVfs,         /* Not used on win32 */
  const char *zFilename,     /* Name of file to check */
  int flags,                 /* Type of test to make on this file */
  int *pResOut               /* OUT: Result */
){
  DWORD attr;
  int rc;
  void *zConverted = convertUtf8Filename(zFilename);
  if( zConverted==0 ){
    return SQLITE_NOMEM;
  }
  if( isNT() ){
    attr = GetFileAttributesW((WCHAR*)zConverted);
  }else{
    attr = GetFileAttributesA((char*)zConverted);
  }
  free(zConverted);
  switch( flags ){
    case SQLITE_ACCESS_READ:
    case SQLITE_ACCESS_EXISTS:
      rc = attr!=INVALID_FILE_ATTRIBUTES;
      break;
    case SQLITE_ACCESS_READWRITE:
      rc = (attr & FILE_ATTRIBUTE_READONLY)==0;
      break;
    default:
      assert(!"Invalid flags argument");
  }
  *pResOut = rc;
  return SQLITE_OK;
}


/*
** Turn a relative pathname into a full pathname.  Write the full
** pathname into zOut[].  zOut[] will be at least pVfs->mxPathname
** bytes in size.
*/
static int winFullPathname(
  sqlite3_vfs *pVfs,            /* Pointer to vfs object */
  const char *zRelative,        /* Possibly relative input path */
  int nFull,                    /* Size of output buffer in bytes */
  char *zFull                   /* Output buffer */
){

#if defined(__CYGWIN__)
  cygwin_conv_to_full_win32_path(zRelative, zFull);
  return SQLITE_OK;
#endif

#if SQLITE_OS_WINCE
  /* WinCE has no concept of a relative pathname, or so I am told. */
  sqlite3_snprintf(pVfs->mxPathname, zFull, "%s", zRelative);
  return SQLITE_OK;
#endif

#if !SQLITE_OS_WINCE && !defined(__CYGWIN__)
  int nByte;
  void *zConverted;
  char *zOut;
  zConverted = convertUtf8Filename(zRelative);
  if( isNT() ){
    WCHAR *zTemp;
    nByte = GetFullPathNameW((WCHAR*)zConverted, 0, 0, 0) + 3;
    zTemp = malloc( nByte*sizeof(zTemp[0]) );
    if( zTemp==0 ){
      free(zConverted);
      return SQLITE_NOMEM;
    }
    GetFullPathNameW((WCHAR*)zConverted, nByte, zTemp, 0);
    free(zConverted);
    zOut = unicodeToUtf8(zTemp);
    free(zTemp);
  }else{
    char *zTemp;
    nByte = GetFullPathNameA((char*)zConverted, 0, 0, 0) + 3;
    zTemp = malloc( nByte*sizeof(zTemp[0]) );
    if( zTemp==0 ){
      free(zConverted);
      return SQLITE_NOMEM;
    }
    GetFullPathNameA((char*)zConverted, nByte, zTemp, 0);
    free(zConverted);
    zOut = mbcsToUtf8(zTemp);
    free(zTemp);
  }
  if( zOut ){
    sqlite3_snprintf(pVfs->mxPathname, zFull, "%s", zOut);
    free(zOut);
    return SQLITE_OK;
  }else{
    return SQLITE_NOMEM;
  }
#endif
}

#ifndef SQLITE_OMIT_LOAD_EXTENSION
/*
** Interfaces for opening a shared library, finding entry points
** within the shared library, and closing the shared library.
*/
/*
** Interfaces for opening a shared library, finding entry points
** within the shared library, and closing the shared library.
*/
static void *winDlOpen(sqlite3_vfs *pVfs, const char *zFilename){
  HANDLE h;
  void *zConverted = convertUtf8Filename(zFilename);
  if( zConverted==0 ){
    return 0;
  }
  if( isNT() ){
    h = LoadLibraryW((WCHAR*)zConverted);
  }else{
    h = LoadLibraryA((char*)zConverted);
  }
  free(zConverted);
  return (void*)h;
}
static void winDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){
  getLastErrorMsg(nBuf, zBufOut);
}
void *winDlSym(sqlite3_vfs *pVfs, void *pHandle, const char *zSymbol){
#if SQLITE_OS_WINCE
  /* The GetProcAddressA() routine is only available on wince. */
  return GetProcAddressA((HANDLE)pHandle, zSymbol);
#else
  /* All other windows platforms expect GetProcAddress() to take
  ** an Ansi string regardless of the _UNICODE setting */
  return GetProcAddress((HANDLE)pHandle, zSymbol);
#endif
}
void winDlClose(sqlite3_vfs *pVfs, void *pHandle){
  FreeLibrary((HANDLE)pHandle);
}
#else /* if SQLITE_OMIT_LOAD_EXTENSION is defined: */
  #define winDlOpen  0
  #define winDlError 0
  #define winDlSym   0
  #define winDlClose 0
#endif


/*
** Write up to nBuf bytes of randomness into zBuf.
*/
static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
  int n = 0;
  if( sizeof(SYSTEMTIME)<=nBuf-n ){
    SYSTEMTIME x;
    GetSystemTime(&x);
    memcpy(&zBuf[n], &x, sizeof(x));
    n += sizeof(x);
  }
  if( sizeof(DWORD)<=nBuf-n ){
    DWORD pid = GetCurrentProcessId();
    memcpy(&zBuf[n], &pid, sizeof(pid));
    n += sizeof(pid);
  }
  if( sizeof(DWORD)<=nBuf-n ){
    DWORD cnt = GetTickCount();
    memcpy(&zBuf[n], &cnt, sizeof(cnt));
    n += sizeof(cnt);
  }
  if( sizeof(LARGE_INTEGER)<=nBuf-n ){
    LARGE_INTEGER i;
    QueryPerformanceCounter(&i);
    memcpy(&zBuf[n], &i, sizeof(i));
    n += sizeof(i);
  }
  return n;
}


/*
** Sleep for a little while.  Return the amount of time slept.
*/
static int winSleep(sqlite3_vfs *pVfs, int microsec){
  Sleep((microsec+999)/1000);
  return ((microsec+999)/1000)*1000;
}

/*
** The following variable, if set to a non-zero value, becomes the result
** returned from sqlite3OsCurrentTime().  This is used for testing.
*/
#ifdef SQLITE_TEST
int sqlite3_current_time = 0;
#endif

/*
** Find the current time (in Universal Coordinated Time).  Write the
** current time and date as a Julian Day number into *prNow and
** return 0.  Return 1 if the time and date cannot be found.
*/
int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){
  FILETIME ft;
  /* FILETIME structure is a 64-bit value representing the number of 
     100-nanosecond intervals since January 1, 1601 (= JD 2305813.5). 
  */
  double now;
#if SQLITE_OS_WINCE
  SYSTEMTIME time;
  GetSystemTime(&time);
  /* if SystemTimeToFileTime() fails, it returns zero. */
  if (!SystemTimeToFileTime(&time,&ft)){
    return 1;
  }
#else
  GetSystemTimeAsFileTime( &ft );
#endif
  now = ((double)ft.dwHighDateTime) * 4294967296.0; 
  *prNow = (now + ft.dwLowDateTime)/864000000000.0 + 2305813.5;
#ifdef SQLITE_TEST
  if( sqlite3_current_time ){
    *prNow = sqlite3_current_time/86400.0 + 2440587.5;
  }
#endif
  return 0;
}

/*
** The idea is that this function works like a combination of
** GetLastError() and FormatMessage() on windows (or errno and
** strerror_r() on unix). After an error is returned by an OS
** function, SQLite calls this function with zBuf pointing to
** a buffer of nBuf bytes. The OS layer should populate the
** buffer with a nul-terminated UTF-8 encoded error message
** describing the last IO error to have occured within the calling
** thread.
**
** If the error message is too large for the supplied buffer,
** it should be truncated. The return value of xGetLastError
** is zero if the error message fits in the buffer, or non-zero
** otherwise (if the message was truncated). If non-zero is returned,
** then it is not necessary to include the nul-terminator character
** in the output buffer.
**
** Not supplying an error message will have no adverse effect
** on SQLite. It is fine to have an implementation that never
** returns an error message:
**
**   int xGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
**     assert(zBuf[0]=='\0');
**     return 0;
**   }
**
** However if an error message is supplied, it will be incorporated
** by sqlite into the error message available to the user using
** sqlite3_errmsg(), possibly making IO errors easier to debug.
*/
static int winGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
  return getLastErrorMsg(nBuf, zBuf);
}

/*
** Initialize and deinitialize the operating system interface.
*/
int sqlite3_os_init(void){
  static sqlite3_vfs winVfs = {
    1,                 /* iVersion */
    sizeof(winFile),   /* szOsFile */
    MAX_PATH,          /* mxPathname */
    0,                 /* pNext */
    "win32",           /* zName */
    0,                 /* pAppData */
 
    winOpen,           /* xOpen */
    winDelete,         /* xDelete */
    winAccess,         /* xAccess */
    winFullPathname,   /* xFullPathname */
    winDlOpen,         /* xDlOpen */
    winDlError,        /* xDlError */
    winDlSym,          /* xDlSym */
    winDlClose,        /* xDlClose */
    winRandomness,     /* xRandomness */
    winSleep,          /* xSleep */
    winCurrentTime,    /* xCurrentTime */
    winGetLastError    /* xGetLastError */
  };
  sqlite3_vfs_register(&winVfs, 1);
  return SQLITE_OK; 
}
int sqlite3_os_end(void){ 
  return SQLITE_OK;
}

#endif /* SQLITE_OS_WIN */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/pager.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This is the implementation of the page cache subsystem or "pager".
** 
** The pager is used to access a database disk file.  It implements
** atomic commit and rollback through the use of a journal file that
** is separate from the database file.  The pager also implements file
** locking to prevent two processes from writing the same database
** file simultaneously, or one process from reading the database while
** another is writing.
**
** @(#) $Id: pager.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
#include <assert.h>
#include <string.h>

/*
** Macros for troubleshooting.  Normally turned off
*/
#if 0
#define sqlite3DebugPrintf printf
#define PAGERTRACE1(X)       sqlite3DebugPrintf(X)
#define PAGERTRACE2(X,Y)     sqlite3DebugPrintf(X,Y)
#define PAGERTRACE3(X,Y,Z)   sqlite3DebugPrintf(X,Y,Z)
#define PAGERTRACE4(X,Y,Z,W) sqlite3DebugPrintf(X,Y,Z,W)
#define PAGERTRACE5(X,Y,Z,W,V) sqlite3DebugPrintf(X,Y,Z,W,V)
#else
#define PAGERTRACE1(X)
#define PAGERTRACE2(X,Y)
#define PAGERTRACE3(X,Y,Z)
#define PAGERTRACE4(X,Y,Z,W)
#define PAGERTRACE5(X,Y,Z,W,V)
#endif

/*
** The following two macros are used within the PAGERTRACEX() macros above
** to print out file-descriptors. 
**
** PAGERID() takes a pointer to a Pager struct as its argument. The
** associated file-descriptor is returned. FILEHANDLEID() takes an sqlite3_file
** struct as its argument.
*/
#define PAGERID(p) ((int)(p->fd))
#define FILEHANDLEID(fd) ((int)fd)

/*
** The page cache as a whole is always in one of the following
** states:
**
**   PAGER_UNLOCK        The page cache is not currently reading or 
**                       writing the database file.  There is no
**                       data held in memory.  This is the initial
**                       state.
**
**   PAGER_SHARED        The page cache is reading the database.
**                       Writing is not permitted.  There can be
**                       multiple readers accessing the same database
**                       file at the same time.
**
**   PAGER_RESERVED      This process has reserved the database for writing
**                       but has not yet made any changes.  Only one process
**                       at a time can reserve the database.  The original
**                       database file has not been modified so other
**                       processes may still be reading the on-disk
**                       database file.
**
**   PAGER_EXCLUSIVE     The page cache is writing the database.
**                       Access is exclusive.  No other processes or
**                       threads can be reading or writing while one
**                       process is writing.
**
**   PAGER_SYNCED        The pager moves to this state from PAGER_EXCLUSIVE
**                       after all dirty pages have been written to the
**                       database file and the file has been synced to
**                       disk. All that remains to do is to remove or
**                       truncate the journal file and the transaction 
**                       will be committed.
**
** The page cache comes up in PAGER_UNLOCK.  The first time a
** sqlite3PagerGet() occurs, the state transitions to PAGER_SHARED.
** After all pages have been released using sqlite_page_unref(),
** the state transitions back to PAGER_UNLOCK.  The first time
** that sqlite3PagerWrite() is called, the state transitions to
** PAGER_RESERVED.  (Note that sqlite3PagerWrite() can only be
** called on an outstanding page which means that the pager must
** be in PAGER_SHARED before it transitions to PAGER_RESERVED.)
** PAGER_RESERVED means that there is an open rollback journal.
** The transition to PAGER_EXCLUSIVE occurs before any changes
** are made to the database file, though writes to the rollback
** journal occurs with just PAGER_RESERVED.  After an sqlite3PagerRollback()
** or sqlite3PagerCommitPhaseTwo(), the state can go back to PAGER_SHARED,
** or it can stay at PAGER_EXCLUSIVE if we are in exclusive access mode.
*/
#define PAGER_UNLOCK      0
#define PAGER_SHARED      1   /* same as SHARED_LOCK */
#define PAGER_RESERVED    2   /* same as RESERVED_LOCK */
#define PAGER_EXCLUSIVE   4   /* same as EXCLUSIVE_LOCK */
#define PAGER_SYNCED      5

/*
** If the SQLITE_BUSY_RESERVED_LOCK macro is set to true at compile-time,
** then failed attempts to get a reserved lock will invoke the busy callback.
** This is off by default.  To see why, consider the following scenario:
** 
** Suppose thread A already has a shared lock and wants a reserved lock.
** Thread B already has a reserved lock and wants an exclusive lock.  If
** both threads are using their busy callbacks, it might be a long time
** be for one of the threads give up and allows the other to proceed.
** But if the thread trying to get the reserved lock gives up quickly
** (if it never invokes its busy callback) then the contention will be
** resolved quickly.
*/
#ifndef SQLITE_BUSY_RESERVED_LOCK
# define SQLITE_BUSY_RESERVED_LOCK 0
#endif

/*
** This macro rounds values up so that if the value is an address it
** is guaranteed to be an address that is aligned to an 8-byte boundary.
*/
#define FORCE_ALIGNMENT(X)   (((X)+7)&~7)

typedef struct PgHdr PgHdr;

/*
** Each pager stores all currently unreferenced pages in a list sorted
** in least-recently-used (LRU) order (i.e. the first item on the list has 
** not been referenced in a long time, the last item has been recently
** used). An instance of this structure is included as part of each
** pager structure for this purpose (variable Pager.lru).
**
** Additionally, if memory-management is enabled, all unreferenced pages 
** are stored in a global LRU list (global variable sqlite3LruPageList).
**
** In both cases, the PagerLruList.pFirstSynced variable points to
** the first page in the corresponding list that does not require an
** fsync() operation before its memory can be reclaimed. If no such
** page exists, PagerLruList.pFirstSynced is set to NULL.
*/
typedef struct PagerLruList PagerLruList;
struct PagerLruList {
  PgHdr *pFirst;         /* First page in LRU list */
  PgHdr *pLast;          /* Last page in LRU list (the most recently used) */
  PgHdr *pFirstSynced;   /* First page in list with PgHdr.needSync==0 */
};

/*
** The following structure contains the next and previous pointers used
** to link a PgHdr structure into a PagerLruList linked list. 
*/
typedef struct PagerLruLink PagerLruLink;
struct PagerLruLink {
  PgHdr *pNext;
  PgHdr *pPrev;
};

/*
** Each in-memory image of a page begins with the following header.
** This header is only visible to this pager module.  The client
** code that calls pager sees only the data that follows the header.
**
** Client code should call sqlite3PagerWrite() on a page prior to making
** any modifications to that page.  The first time sqlite3PagerWrite()
** is called, the original page contents are written into the rollback
** journal and PgHdr.inJournal and PgHdr.needSync are set.  Later, once
** the journal page has made it onto the disk surface, PgHdr.needSync
** is cleared.  The modified page cannot be written back into the original
** database file until the journal pages has been synced to disk and the
** PgHdr.needSync has been cleared.
**
** The PgHdr.dirty flag is set when sqlite3PagerWrite() is called and
** is cleared again when the page content is written back to the original
** database file.
**
** Details of important structure elements:
**
** needSync
**
**     If this is true, this means that it is not safe to write the page
**     content to the database because the original content needed
**     for rollback has not by synced to the main rollback journal.
**     The original content may have been written to the rollback journal
**     but it has not yet been synced.  So we cannot write to the database
**     file because power failure might cause the page in the journal file
**     to never reach the disk.  It is as if the write to the journal file
**     does not occur until the journal file is synced.
**     
**     This flag is false if the page content exactly matches what
**     currently exists in the database file.  The needSync flag is also
**     false if the original content has been written to the main rollback
**     journal and synced.  If the page represents a new page that has
**     been added onto the end of the database during the current
**     transaction, the needSync flag is true until the original database
**     size in the journal header has been synced to disk.
**
** inJournal
**
**     This is true if the original page has been written into the main
**     rollback journal.  This is always false for new pages added to
**     the end of the database file during the current transaction.
**     And this flag says nothing about whether or not the journal
**     has been synced to disk.  For pages that are in the original
**     database file, the following expression should always be true:
**
**       inJournal = sqlite3BitvecTest(pPager->pInJournal, pgno)
**
**     The pPager->pInJournal object is only valid for the original
**     pages of the database, not new pages that are added to the end
**     of the database, so obviously the above expression cannot be
**     valid for new pages.  For new pages inJournal is always 0.
**
** dirty
**
**     When true, this means that the content of the page has been
**     modified and needs to be written back to the database file.
**     If false, it means that either the content of the page is
**     unchanged or else the content is unimportant and we do not
**     care whether or not it is preserved.
**
** alwaysRollback
**
**     This means that the sqlite3PagerDontRollback() API should be
**     ignored for this page.  The DontRollback() API attempts to say
**     that the content of the page on disk is unimportant (it is an
**     unused page on the freelist) so that it is unnecessary to 
**     rollback changes to this page because the content of the page
**     can change without changing the meaning of the database.  This
**     flag overrides any DontRollback() attempt.  This flag is set
**     when a page that originally contained valid data is added to
**     the freelist.  Later in the same transaction, this page might
**     be pulled from the freelist and reused for something different
**     and at that point the DontRollback() API will be called because
**     pages taken from the freelist do not need to be protected by
**     the rollback journal.  But this flag says that the page was
**     not originally part of the freelist so that it still needs to
**     be rolled back in spite of any subsequent DontRollback() calls.
**
** needRead 
**
**     This flag means (when true) that the content of the page has
**     not yet been loaded from disk.  The in-memory content is just
**     garbage.  (Actually, we zero the content, but you should not
**     make any assumptions about the content nevertheless.)  If the
**     content is needed in the future, it should be read from the
**     original database file.
*/
struct PgHdr {
  Pager *pPager;                 /* The pager to which this page belongs */
  Pgno pgno;                     /* The page number for this page */
  PgHdr *pNextHash, *pPrevHash;  /* Hash collision chain for PgHdr.pgno */
  PagerLruLink free;             /* Next and previous free pages */
  PgHdr *pNextAll;               /* A list of all pages */
  u8 inJournal;                  /* TRUE if has been written to journal */
  u8 dirty;                      /* TRUE if we need to write back changes */
  u8 needSync;                   /* Sync journal before writing this page */
  u8 alwaysRollback;             /* Disable DontRollback() for this page */
  u8 needRead;                   /* Read content if PagerWrite() is called */
  short int nRef;                /* Number of users of this page */
  PgHdr *pDirty, *pPrevDirty;    /* Dirty pages */
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  PgHdr *pPrevAll;               /* A list of all pages */
  PagerLruLink gfree;            /* Global list of nRef==0 pages */
#endif
#ifdef SQLITE_CHECK_PAGES
  u32 pageHash;
#endif
  void *pData;                   /* Page data */
  /* Pager.nExtra bytes of local data appended to this header */
};

/*
** For an in-memory only database, some extra information is recorded about
** each page so that changes can be rolled back.  (Journal files are not
** used for in-memory databases.)  The following information is added to
** the end of every EXTRA block for in-memory databases.
**
** This information could have been added directly to the PgHdr structure.
** But then it would take up an extra 8 bytes of storage on every PgHdr
** even for disk-based databases.  Splitting it out saves 8 bytes.  This
** is only a savings of 0.8% but those percentages add up.
*/
typedef struct PgHistory PgHistory;
struct PgHistory {
  u8 *pOrig;     /* Original page text.  Restore to this on a full rollback */
  u8 *pStmt;     /* Text as it was at the beginning of the current statement */
  PgHdr *pNextStmt, *pPrevStmt;  /* List of pages in the statement journal */
  u8 inStmt;                     /* TRUE if in the statement subjournal */
};

/*
** A macro used for invoking the codec if there is one
*/
#ifdef SQLITE_HAS_CODEC
# define CODEC1(P,D,N,X) if( P->xCodec!=0 ){ P->xCodec(P->pCodecArg,D,N,X); }
# define CODEC2(P,D,N,X) ((char*)(P->xCodec!=0?P->xCodec(P->pCodecArg,D,N,X):D))
#else
# define CODEC1(P,D,N,X) /* NO-OP */
# define CODEC2(P,D,N,X) ((char*)D)
#endif

/*
** Convert a pointer to a PgHdr into a pointer to its data
** and back again.
*/
#define PGHDR_TO_DATA(P)    ((P)->pData)
#define PGHDR_TO_EXTRA(G,P) ((void*)&((G)[1]))
#define PGHDR_TO_HIST(P,PGR)  \
            ((PgHistory*)&((char*)(&(P)[1]))[(PGR)->nExtra])

/*
** A open page cache is an instance of the following structure.
**
** Pager.errCode may be set to SQLITE_IOERR, SQLITE_CORRUPT, or
** or SQLITE_FULL. Once one of the first three errors occurs, it persists
** and is returned as the result of every major pager API call.  The
** SQLITE_FULL return code is slightly different. It persists only until the
** next successful rollback is performed on the pager cache. Also,
** SQLITE_FULL does not affect the sqlite3PagerGet() and sqlite3PagerLookup()
** APIs, they may still be used successfully.
*/
struct Pager {
  sqlite3_vfs *pVfs;          /* OS functions to use for IO */
  u8 journalOpen;             /* True if journal file descriptors is valid */
  u8 journalStarted;          /* True if header of journal is synced */
  u8 useJournal;              /* Use a rollback journal on this file */
  u8 noReadlock;              /* Do not bother to obtain readlocks */
  u8 stmtOpen;                /* True if the statement subjournal is open */
  u8 stmtInUse;               /* True we are in a statement subtransaction */
  u8 stmtAutoopen;            /* Open stmt journal when main journal is opened*/
  u8 noSync;                  /* Do not sync the journal if true */
  u8 fullSync;                /* Do extra syncs of the journal for robustness */
  u8 sync_flags;              /* One of SYNC_NORMAL or SYNC_FULL */
  u8 state;                   /* PAGER_UNLOCK, _SHARED, _RESERVED, etc. */
  u8 tempFile;                /* zFilename is a temporary file */
  u8 readOnly;                /* True for a read-only database */
  u8 needSync;                /* True if an fsync() is needed on the journal */
  u8 dirtyCache;              /* True if cached pages have changed */
  u8 alwaysRollback;          /* Disable DontRollback() for all pages */
  u8 memDb;                   /* True to inhibit all file I/O */
  u8 setMaster;               /* True if a m-j name has been written to jrnl */
  u8 doNotSync;               /* Boolean. While true, do not spill the cache */
  u8 exclusiveMode;           /* Boolean. True if locking_mode==EXCLUSIVE */
  u8 journalMode;             /* On of the PAGER_JOURNALMODE_* values */
  u8 dbModified;              /* True if there are any changes to the Db */
  u8 changeCountDone;         /* Set after incrementing the change-counter */
  u32 vfsFlags;               /* Flags for sqlite3_vfs.xOpen() */
  int errCode;                /* One of several kinds of errors */
  int dbSize;                 /* Number of pages in the file */
  int origDbSize;             /* dbSize before the current change */
  int stmtSize;               /* Size of database (in pages) at stmt_begin() */
  int nRec;                   /* Number of pages written to the journal */
  u32 cksumInit;              /* Quasi-random value added to every checksum */
  int stmtNRec;               /* Number of records in stmt subjournal */
  int nExtra;                 /* Add this many bytes to each in-memory page */
  int pageSize;               /* Number of bytes in a page */
  int nPage;                  /* Total number of in-memory pages */
  int nRef;                   /* Number of in-memory pages with PgHdr.nRef>0 */
  int mxPage;                 /* Maximum number of pages to hold in cache */
  Pgno mxPgno;                /* Maximum allowed size of the database */
  Bitvec *pInJournal;         /* One bit for each page in the database file */
  Bitvec *pInStmt;            /* One bit for each page in the database */
  char *zFilename;            /* Name of the database file */
  char *zJournal;             /* Name of the journal file */
  char *zDirectory;           /* Directory hold database and journal files */
  sqlite3_file *fd, *jfd;     /* File descriptors for database and journal */
  sqlite3_file *stfd;         /* File descriptor for the statement subjournal*/
  BusyHandler *pBusyHandler;  /* Pointer to sqlite.busyHandler */
  PagerLruList lru;           /* LRU list of free pages */
  PgHdr *pAll;                /* List of all pages */
  PgHdr *pStmt;               /* List of pages in the statement subjournal */
  PgHdr *pDirty;              /* List of all dirty pages */
  i64 journalOff;             /* Current byte offset in the journal file */
  i64 journalHdr;             /* Byte offset to previous journal header */
  i64 stmtHdrOff;             /* First journal header written this statement */
  i64 stmtCksum;              /* cksumInit when statement was started */
  i64 stmtJSize;              /* Size of journal at stmt_begin() */
  int sectorSize;             /* Assumed sector size during rollback */
#ifdef SQLITE_TEST
  int nHit, nMiss;            /* Cache hits and missing */
  int nRead, nWrite;          /* Database pages read/written */
#endif
  void (*xDestructor)(DbPage*,int); /* Call this routine when freeing pages */
  void (*xReiniter)(DbPage*,int);   /* Call this routine when reloading pages */
#ifdef SQLITE_HAS_CODEC
  void *(*xCodec)(void*,void*,Pgno,int); /* Routine for en/decoding data */
  void *pCodecArg;            /* First argument to xCodec() */
#endif
  int nHash;                  /* Size of the pager hash table */
  PgHdr **aHash;              /* Hash table to map page number to PgHdr */
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  Pager *pNext;               /* Doubly linked list of pagers on which */
  Pager *pPrev;               /* sqlite3_release_memory() will work */
  volatile int iInUseMM;      /* Non-zero if unavailable to MM */
  volatile int iInUseDB;      /* Non-zero if in sqlite3_release_memory() */
#endif
  char *pTmpSpace;            /* Pager.pageSize bytes of space for tmp use */
  char dbFileVers[16];        /* Changes whenever database file changes */
  i64 journalSizeLimit;       /* Size limit for persistent journal files */
};

/*
** The following global variables hold counters used for
** testing purposes only.  These variables do not exist in
** a non-testing build.  These variables are not thread-safe.
*/
#ifdef SQLITE_TEST
int sqlite3_pager_readdb_count = 0;    /* Number of full pages read from DB */
int sqlite3_pager_writedb_count = 0;   /* Number of full pages written to DB */
int sqlite3_pager_writej_count = 0;    /* Number of pages written to journal */
int sqlite3_pager_pgfree_count = 0;    /* Number of cache pages freed */
# define PAGER_INCR(v)  v++
#else
# define PAGER_INCR(v)
#endif

/*
** The following variable points to the head of a double-linked list
** of all pagers that are eligible for page stealing by the
** sqlite3_release_memory() interface.  Access to this list is
** protected by the SQLITE_MUTEX_STATIC_MEM2 mutex.
*/
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
static Pager *sqlite3PagerList = 0;
static PagerLruList sqlite3LruPageList = {0, 0, 0};
#endif


/*
** Journal files begin with the following magic string.  The data
** was obtained from /dev/random.  It is used only as a sanity check.
**
** Since version 2.8.0, the journal format contains additional sanity
** checking information.  If the power fails while the journal is begin
** written, semi-random garbage data might appear in the journal
** file after power is restored.  If an attempt is then made
** to roll the journal back, the database could be corrupted.  The additional
** sanity checking data is an attempt to discover the garbage in the
** journal and ignore it.
**
** The sanity checking information for the new journal format consists
** of a 32-bit checksum on each page of data.  The checksum covers both
** the page number and the pPager->pageSize bytes of data for the page.
** This cksum is initialized to a 32-bit random value that appears in the
** journal file right after the header.  The random initializer is important,
** because garbage data that appears at the end of a journal is likely
** data that was once in other files that have now been deleted.  If the
** garbage data came from an obsolete journal file, the checksums might
** be correct.  But by initializing the checksum to random value which
** is different for every journal, we minimize that risk.
*/
static const unsigned char aJournalMagic[] = {
  0xd9, 0xd5, 0x05, 0xf9, 0x20, 0xa1, 0x63, 0xd7,
};

/*
** The size of the header and of each page in the journal is determined
** by the following macros.
*/
#define JOURNAL_PG_SZ(pPager)  ((pPager->pageSize) + 8)

/*
** The journal header size for this pager. In the future, this could be
** set to some value read from the disk controller. The important
** characteristic is that it is the same size as a disk sector.
*/
#define JOURNAL_HDR_SZ(pPager) (pPager->sectorSize)

/*
** The macro MEMDB is true if we are dealing with an in-memory database.
** We do this as a macro so that if the SQLITE_OMIT_MEMORYDB macro is set,
** the value of MEMDB will be a constant and the compiler will optimize
** out code that would never execute.
*/
#ifdef SQLITE_OMIT_MEMORYDB
# define MEMDB 0
#else
# define MEMDB pPager->memDb
#endif

/*
** Page number PAGER_MJ_PGNO is never used in an SQLite database (it is
** reserved for working around a windows/posix incompatibility). It is
** used in the journal to signify that the remainder of the journal file 
** is devoted to storing a master journal name - there are no more pages to
** roll back. See comments for function writeMasterJournal() for details.
*/
/* #define PAGER_MJ_PGNO(x) (PENDING_BYTE/((x)->pageSize)) */
#define PAGER_MJ_PGNO(x) ((PENDING_BYTE/((x)->pageSize))+1)

/*
** The maximum legal page number is (2^31 - 1).
*/
#define PAGER_MAX_PGNO 2147483647

/*
** The pagerEnter() and pagerLeave() routines acquire and release
** a mutex on each pager.  The mutex is recursive.
**
** This is a special-purpose mutex.  It only provides mutual exclusion
** between the Btree and the Memory Management sqlite3_release_memory()
** function.  It does not prevent, for example, two Btrees from accessing
** the same pager at the same time.  Other general-purpose mutexes in
** the btree layer handle that chore.
*/
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  static void pagerEnter(Pager *p){
    p->iInUseDB++;
    if( p->iInUseMM && p->iInUseDB==1 ){
#ifndef SQLITE_MUTEX_NOOP
      sqlite3_mutex *mutex;
      mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM2);
#endif
      p->iInUseDB = 0;
      sqlite3_mutex_enter(mutex);
      p->iInUseDB = 1;
      sqlite3_mutex_leave(mutex);
    }
    assert( p->iInUseMM==0 );
  }
  static void pagerLeave(Pager *p){
    p->iInUseDB--;
    assert( p->iInUseDB>=0 );
  }
#else
# define pagerEnter(X)
# define pagerLeave(X)
#endif

/*
** Add page pPg to the end of the linked list managed by structure
** pList (pPg becomes the last entry in the list - the most recently 
** used). Argument pLink should point to either pPg->free or pPg->gfree,
** depending on whether pPg is being added to the pager-specific or
** global LRU list.
*/
static void listAdd(PagerLruList *pList, PagerLruLink *pLink, PgHdr *pPg){
  pLink->pNext = 0;
  pLink->pPrev = pList->pLast;

#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  assert(pLink==&pPg->free || pLink==&pPg->gfree);
  assert(pLink==&pPg->gfree || pList!=&sqlite3LruPageList);
#endif

  if( pList->pLast ){
    int iOff = (char *)pLink - (char *)pPg;
    PagerLruLink *pLastLink = (PagerLruLink *)(&((u8 *)pList->pLast)[iOff]);
    pLastLink->pNext = pPg;
  }else{
    assert(!pList->pFirst);
    pList->pFirst = pPg;
  }

  pList->pLast = pPg;
  if( !pList->pFirstSynced && pPg->needSync==0 ){
    pList->pFirstSynced = pPg;
  }
}

/*
** Remove pPg from the list managed by the structure pointed to by pList.
**
** Argument pLink should point to either pPg->free or pPg->gfree, depending 
** on whether pPg is being added to the pager-specific or global LRU list.
*/
static void listRemove(PagerLruList *pList, PagerLruLink *pLink, PgHdr *pPg){
  int iOff = (char *)pLink - (char *)pPg;

#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  assert(pLink==&pPg->free || pLink==&pPg->gfree);
  assert(pLink==&pPg->gfree || pList!=&sqlite3LruPageList);
#endif

  if( pPg==pList->pFirst ){
    pList->pFirst = pLink->pNext;
  }
  if( pPg==pList->pLast ){
    pList->pLast = pLink->pPrev;
  }
  if( pLink->pPrev ){
    PagerLruLink *pPrevLink = (PagerLruLink *)(&((u8 *)pLink->pPrev)[iOff]);
    pPrevLink->pNext = pLink->pNext;
  }
  if( pLink->pNext ){
    PagerLruLink *pNextLink = (PagerLruLink *)(&((u8 *)pLink->pNext)[iOff]);
    pNextLink->pPrev = pLink->pPrev;
  }
  if( pPg==pList->pFirstSynced ){
    PgHdr *p = pLink->pNext;
    while( p && p->needSync ){
      PagerLruLink *pL = (PagerLruLink *)(&((u8 *)p)[iOff]);
      p = pL->pNext;
    }
    pList->pFirstSynced = p;
  }

  pLink->pNext = pLink->pPrev = 0;
}

/* 
** Add page pPg to the list of free pages for the pager. If 
** memory-management is enabled, also add the page to the global 
** list of free pages.
*/
static void lruListAdd(PgHdr *pPg){
  listAdd(&pPg->pPager->lru, &pPg->free, pPg);
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  if( !pPg->pPager->memDb ){
    sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU));
    listAdd(&sqlite3LruPageList, &pPg->gfree, pPg);
    sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU));
  }
#endif
}

/* 
** Remove page pPg from the list of free pages for the associated pager.
** If memory-management is enabled, also remove pPg from the global list
** of free pages.
*/
static void lruListRemove(PgHdr *pPg){
  listRemove(&pPg->pPager->lru, &pPg->free, pPg);
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  if( !pPg->pPager->memDb ){
    sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU));
    listRemove(&sqlite3LruPageList, &pPg->gfree, pPg);
    sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU));
  }
#endif
}

/* 
** This function is called just after the needSync flag has been cleared
** from all pages managed by pPager (usually because the journal file
** has just been synced). It updates the pPager->lru.pFirstSynced variable
** and, if memory-management is enabled, the sqlite3LruPageList.pFirstSynced
** variable also.
*/
static void lruListSetFirstSynced(Pager *pPager){
  pPager->lru.pFirstSynced = pPager->lru.pFirst;
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  if( !pPager->memDb ){
    PgHdr *p;
    sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU));
    for(p=sqlite3LruPageList.pFirst; p && p->needSync; p=p->gfree.pNext);
    assert(p==pPager->lru.pFirstSynced || p==sqlite3LruPageList.pFirstSynced);
    sqlite3LruPageList.pFirstSynced = p;
    sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU));
  }
#endif
}

/*
** Return true if page *pPg has already been written to the statement
** journal (or statement snapshot has been created, if *pPg is part
** of an in-memory database).
*/
static int pageInStatement(PgHdr *pPg){
  Pager *pPager = pPg->pPager;
  if( MEMDB ){
    return PGHDR_TO_HIST(pPg, pPager)->inStmt;
  }else{
    return sqlite3BitvecTest(pPager->pInStmt, pPg->pgno);
  }
}

/*
** Change the size of the pager hash table to N.  N must be a power
** of two.
*/
static void pager_resize_hash_table(Pager *pPager, int N){
  PgHdr **aHash, *pPg;
  assert( N>0 && (N&(N-1))==0 );
#ifdef SQLITE_MALLOC_SOFT_LIMIT
  if( N*sizeof(aHash[0])>SQLITE_MALLOC_SOFT_LIMIT ){
    N = SQLITE_MALLOC_SOFT_LIMIT/sizeof(aHash[0]);
  }
  if( N==pPager->nHash ) return;
#endif
  pagerLeave(pPager);
  if( pPager->aHash!=0 ) sqlite3BeginBenignMalloc();
  aHash = sqlite3MallocZero( sizeof(aHash[0])*N );
  if( pPager->aHash!=0 ) sqlite3EndBenignMalloc();
  pagerEnter(pPager);
  if( aHash==0 ){
    /* Failure to rehash is not an error.  It is only a performance hit. */
    return;
  }
  sqlite3_free(pPager->aHash);
  pPager->nHash = N;
  pPager->aHash = aHash;
  for(pPg=pPager->pAll; pPg; pPg=pPg->pNextAll){
    int h;
    if( pPg->pgno==0 ){
      assert( pPg->pNextHash==0 && pPg->pPrevHash==0 );
      continue;
    }
    h = pPg->pgno & (N-1);
    pPg->pNextHash = aHash[h];
    if( aHash[h] ){
      aHash[h]->pPrevHash = pPg;
    }
    aHash[h] = pPg;
    pPg->pPrevHash = 0;
  }
}

/*
** Read a 32-bit integer from the given file descriptor.  Store the integer
** that is read in *pRes.  Return SQLITE_OK if everything worked, or an
** error code is something goes wrong.
**
** All values are stored on disk as big-endian.
*/
static int read32bits(sqlite3_file *fd, i64 offset, u32 *pRes){
  unsigned char ac[4];
  int rc = sqlite3OsRead(fd, ac, sizeof(ac), offset);
  if( rc==SQLITE_OK ){
    *pRes = sqlite3Get4byte(ac);
  }
  return rc;
}

/*
** Write a 32-bit integer into a string buffer in big-endian byte order.
*/
#define put32bits(A,B)  sqlite3Put4byte((u8*)A,B)

/*
** Write a 32-bit integer into the given file descriptor.  Return SQLITE_OK
** on success or an error code is something goes wrong.
*/
static int write32bits(sqlite3_file *fd, i64 offset, u32 val){
  char ac[4];
  put32bits(ac, val);
  return sqlite3OsWrite(fd, ac, 4, offset);
}

/*
** If file pFd is open, call sqlite3OsUnlock() on it.
*/
static int osUnlock(sqlite3_file *pFd, int eLock){
  if( !pFd->pMethods ){
    return SQLITE_OK;
  }
  return sqlite3OsUnlock(pFd, eLock);
}

/*
** This function determines whether or not the atomic-write optimization
** can be used with this pager. The optimization can be used if:
**
**  (a) the value returned by OsDeviceCharacteristics() indicates that
**      a database page may be written atomically, and
**  (b) the value returned by OsSectorSize() is less than or equal
**      to the page size.
**
** If the optimization cannot be used, 0 is returned. If it can be used,
** then the value returned is the size of the journal file when it
** contains rollback data for exactly one page.
*/
#ifdef SQLITE_ENABLE_ATOMIC_WRITE
static int jrnlBufferSize(Pager *pPager){
  int dc;           /* Device characteristics */
  int nSector;      /* Sector size */
  int szPage;        /* Page size */
  sqlite3_file *fd = pPager->fd;

  if( fd->pMethods ){
    dc = sqlite3OsDeviceCharacteristics(fd);
    nSector = sqlite3OsSectorSize(fd);
    szPage = pPager->pageSize;
  }

  assert(SQLITE_IOCAP_ATOMIC512==(512>>8));
  assert(SQLITE_IOCAP_ATOMIC64K==(65536>>8));

  if( !fd->pMethods || 
       (dc & (SQLITE_IOCAP_ATOMIC|(szPage>>8)) && nSector<=szPage) ){
    return JOURNAL_HDR_SZ(pPager) + JOURNAL_PG_SZ(pPager);
  }
  return 0;
}
#endif

/*
** This function should be called when an error occurs within the pager
** code. The first argument is a pointer to the pager structure, the
** second the error-code about to be returned by a pager API function. 
** The value returned is a copy of the second argument to this function. 
**
** If the second argument is SQLITE_IOERR, SQLITE_CORRUPT, or SQLITE_FULL
** the error becomes persistent. Until the persisten error is cleared,
** subsequent API calls on this Pager will immediately return the same 
** error code.
**
** A persistent error indicates that the contents of the pager-cache 
** cannot be trusted. This state can be cleared by completely discarding 
** the contents of the pager-cache. If a transaction was active when
** the persistent error occured, then the rollback journal may need
** to be replayed.
*/
static void pager_unlock(Pager *pPager);
static int pager_error(Pager *pPager, int rc){
  int rc2 = rc & 0xff;
  assert(
       pPager->errCode==SQLITE_FULL ||
       pPager->errCode==SQLITE_OK ||
       (pPager->errCode & 0xff)==SQLITE_IOERR
  );
  if(
    rc2==SQLITE_FULL ||
    rc2==SQLITE_IOERR ||
    rc2==SQLITE_CORRUPT
  ){
    pPager->errCode = rc;
    if( pPager->state==PAGER_UNLOCK && pPager->nRef==0 ){
      /* If the pager is already unlocked, call pager_unlock() now to
      ** clear the error state and ensure that the pager-cache is 
      ** completely empty.
      */
      pager_unlock(pPager);
    }
  }
  return rc;
}

/*
** If SQLITE_CHECK_PAGES is defined then we do some sanity checking
** on the cache using a hash function.  This is used for testing
** and debugging only.
*/
#ifdef SQLITE_CHECK_PAGES
/*
** Return a 32-bit hash of the page data for pPage.
*/
static u32 pager_datahash(int nByte, unsigned char *pData){
  u32 hash = 0;
  int i;
  for(i=0; i<nByte; i++){
    hash = (hash*1039) + pData[i];
  }
  return hash;
}
static u32 pager_pagehash(PgHdr *pPage){
  return pager_datahash(pPage->pPager->pageSize, 
                        (unsigned char *)PGHDR_TO_DATA(pPage));
}

/*
** The CHECK_PAGE macro takes a PgHdr* as an argument. If SQLITE_CHECK_PAGES
** is defined, and NDEBUG is not defined, an assert() statement checks
** that the page is either dirty or still matches the calculated page-hash.
*/
#define CHECK_PAGE(x) checkPage(x)
static void checkPage(PgHdr *pPg){
  Pager *pPager = pPg->pPager;
  assert( !pPg->pageHash || pPager->errCode || MEMDB || pPg->dirty || 
      pPg->pageHash==pager_pagehash(pPg) );
}

#else
#define pager_datahash(X,Y)  0
#define pager_pagehash(X)  0
#define CHECK_PAGE(x)
#endif

/*
** When this is called the journal file for pager pPager must be open.
** The master journal file name is read from the end of the file and 
** written into memory supplied by the caller. 
**
** zMaster must point to a buffer of at least nMaster bytes allocated by
** the caller. This should be sqlite3_vfs.mxPathname+1 (to ensure there is
** enough space to write the master journal name). If the master journal
** name in the journal is longer than nMaster bytes (including a
** nul-terminator), then this is handled as if no master journal name
** were present in the journal.
**
** If no master journal file name is present zMaster[0] is set to 0 and
** SQLITE_OK returned.
*/
static int readMasterJournal(sqlite3_file *pJrnl, char *zMaster, int nMaster){
  int rc;
  u32 len;
  i64 szJ;
  u32 cksum;
  u32 u;                   /* Unsigned loop counter */
  unsigned char aMagic[8]; /* A buffer to hold the magic header */

  zMaster[0] = '\0';

  rc = sqlite3OsFileSize(pJrnl, &szJ);
  if( rc!=SQLITE_OK || szJ<16 ) return rc;

  rc = read32bits(pJrnl, szJ-16, &len);
  if( rc!=SQLITE_OK ) return rc;

  if( len>=nMaster ){
    return SQLITE_OK;
  }

  rc = read32bits(pJrnl, szJ-12, &cksum);
  if( rc!=SQLITE_OK ) return rc;

  rc = sqlite3OsRead(pJrnl, aMagic, 8, szJ-8);
  if( rc!=SQLITE_OK || memcmp(aMagic, aJournalMagic, 8) ) return rc;

  rc = sqlite3OsRead(pJrnl, zMaster, len, szJ-16-len);
  if( rc!=SQLITE_OK ){
    return rc;
  }
  zMaster[len] = '\0';

  /* See if the checksum matches the master journal name */
  for(u=0; u<len; u++){
    cksum -= zMaster[u];
   }
  if( cksum ){
    /* If the checksum doesn't add up, then one or more of the disk sectors
    ** containing the master journal filename is corrupted. This means
    ** definitely roll back, so just return SQLITE_OK and report a (nul)
    ** master-journal filename.
    */
    zMaster[0] = '\0';
  }
   
  return SQLITE_OK;
}

/*
** Seek the journal file descriptor to the next sector boundary where a
** journal header may be read or written. Pager.journalOff is updated with
** the new seek offset.
**
** i.e for a sector size of 512:
**
** Input Offset              Output Offset
** ---------------------------------------
** 0                         0
** 512                       512
** 100                       512
** 2000                      2048
** 
*/
static void seekJournalHdr(Pager *pPager){
  i64 offset = 0;
  i64 c = pPager->journalOff;
  if( c ){
    offset = ((c-1)/JOURNAL_HDR_SZ(pPager) + 1) * JOURNAL_HDR_SZ(pPager);
  }
  assert( offset%JOURNAL_HDR_SZ(pPager)==0 );
  assert( offset>=c );
  assert( (offset-c)<JOURNAL_HDR_SZ(pPager) );
  pPager->journalOff = offset;
}

/*
** Write zeros over the header of the journal file.  This has the
** effect of invalidating the journal file and committing the
** transaction.
*/
static int zeroJournalHdr(Pager *pPager, int doTruncate){
  int rc = SQLITE_OK;
  static const char zeroHdr[28];

  if( pPager->journalOff ){
    i64 iLimit = pPager->journalSizeLimit;

    IOTRACE(("JZEROHDR %p\n", pPager))
    if( doTruncate || iLimit==0 ){
      rc = sqlite3OsTruncate(pPager->jfd, 0);
    }else{
      rc = sqlite3OsWrite(pPager->jfd, zeroHdr, sizeof(zeroHdr), 0);
    }
    if( rc==SQLITE_OK && !pPager->noSync ){
      rc = sqlite3OsSync(pPager->jfd, SQLITE_SYNC_DATAONLY|pPager->sync_flags);
    }

    /* At this point the transaction is committed but the write lock 
    ** is still held on the file. If there is a size limit configured for 
    ** the persistent journal and the journal file currently consumes more
    ** space than that limit allows for, truncate it now. There is no need
    ** to sync the file following this operation.
    */
    if( rc==SQLITE_OK && iLimit>0 ){
      i64 sz;
      rc = sqlite3OsFileSize(pPager->jfd, &sz);
      if( rc==SQLITE_OK && sz>iLimit ){
        rc = sqlite3OsTruncate(pPager->jfd, iLimit);
      }
    }
  }
  return rc;
}

/*
** The journal file must be open when this routine is called. A journal
** header (JOURNAL_HDR_SZ bytes) is written into the journal file at the
** current location.
**
** The format for the journal header is as follows:
** - 8 bytes: Magic identifying journal format.
** - 4 bytes: Number of records in journal, or -1 no-sync mode is on.
** - 4 bytes: Random number used for page hash.
** - 4 bytes: Initial database page count.
** - 4 bytes: Sector size used by the process that wrote this journal.
** - 4 bytes: Database page size.
** 
** Followed by (JOURNAL_HDR_SZ - 28) bytes of unused space.
*/
static int writeJournalHdr(Pager *pPager){
  int rc = SQLITE_OK;
  char *zHeader = pPager->pTmpSpace;
  int nHeader = pPager->pageSize;
  int nWrite;

  if( nHeader>JOURNAL_HDR_SZ(pPager) ){
    nHeader = JOURNAL_HDR_SZ(pPager);
  }

  if( pPager->stmtHdrOff==0 ){
    pPager->stmtHdrOff = pPager->journalOff;
  }

  seekJournalHdr(pPager);
  pPager->journalHdr = pPager->journalOff;

  memcpy(zHeader, aJournalMagic, sizeof(aJournalMagic));

  /* 
  ** Write the nRec Field - the number of page records that follow this
  ** journal header. Normally, zero is written to this value at this time.
  ** After the records are added to the journal (and the journal synced, 
  ** if in full-sync mode), the zero is overwritten with the true number
  ** of records (see syncJournal()).
  **
  ** A faster alternative is to write 0xFFFFFFFF to the nRec field. When
  ** reading the journal this value tells SQLite to assume that the
  ** rest of the journal file contains valid page records. This assumption
  ** is dangerous, as if a failure occured whilst writing to the journal
  ** file it may contain some garbage data. There are two scenarios
  ** where this risk can be ignored:
  **
  **   * When the pager is in no-sync mode. Corruption can follow a
  **     power failure in this case anyway.
  **
  **   * When the SQLITE_IOCAP_SAFE_APPEND flag is set. This guarantees
  **     that garbage data is never appended to the journal file.
  */
  assert(pPager->fd->pMethods||pPager->noSync);
  if( (pPager->noSync) 
   || (sqlite3OsDeviceCharacteristics(pPager->fd)&SQLITE_IOCAP_SAFE_APPEND) 
  ){
    put32bits(&zHeader[sizeof(aJournalMagic)], 0xffffffff);
  }else{
    put32bits(&zHeader[sizeof(aJournalMagic)], 0);
  }

  /* The random check-hash initialiser */ 
  sqlite3_randomness(sizeof(pPager->cksumInit), &pPager->cksumInit);
  put32bits(&zHeader[sizeof(aJournalMagic)+4], pPager->cksumInit);
  /* The initial database size */
  put32bits(&zHeader[sizeof(aJournalMagic)+8], pPager->dbSize);
  /* The assumed sector size for this process */
  put32bits(&zHeader[sizeof(aJournalMagic)+12], pPager->sectorSize);
  if( pPager->journalHdr==0 ){
    /* The page size */
    put32bits(&zHeader[sizeof(aJournalMagic)+16], pPager->pageSize);
  }

  for(nWrite=0; rc==SQLITE_OK&&nWrite<JOURNAL_HDR_SZ(pPager); nWrite+=nHeader){
    IOTRACE(("JHDR %p %lld %d\n", pPager, pPager->journalHdr, nHeader))
    rc = sqlite3OsWrite(pPager->jfd, zHeader, nHeader, pPager->journalOff);
    pPager->journalOff += nHeader;
  }

  return rc;
}

/*
** The journal file must be open when this is called. A journal header file
** (JOURNAL_HDR_SZ bytes) is read from the current location in the journal
** file. See comments above function writeJournalHdr() for a description of
** the journal header format.
**
** If the header is read successfully, *nRec is set to the number of
** page records following this header and *dbSize is set to the size of the
** database before the transaction began, in pages. Also, pPager->cksumInit
** is set to the value read from the journal header. SQLITE_OK is returned
** in this case.
**
** If the journal header file appears to be corrupted, SQLITE_DONE is
** returned and *nRec and *dbSize are not set.  If JOURNAL_HDR_SZ bytes
** cannot be read from the journal file an error code is returned.
*/
static int readJournalHdr(
  Pager *pPager, 
  i64 journalSize,
  u32 *pNRec, 
  u32 *pDbSize
){
  int rc;
  unsigned char aMagic[8]; /* A buffer to hold the magic header */
  i64 jrnlOff;
  int iPageSize;

  seekJournalHdr(pPager);
  if( pPager->journalOff+JOURNAL_HDR_SZ(pPager) > journalSize ){
    return SQLITE_DONE;
  }
  jrnlOff = pPager->journalOff;

  rc = sqlite3OsRead(pPager->jfd, aMagic, sizeof(aMagic), jrnlOff);
  if( rc ) return rc;
  jrnlOff += sizeof(aMagic);

  if( memcmp(aMagic, aJournalMagic, sizeof(aMagic))!=0 ){
    return SQLITE_DONE;
  }

  rc = read32bits(pPager->jfd, jrnlOff, pNRec);
  if( rc ) return rc;

  rc = read32bits(pPager->jfd, jrnlOff+4, &pPager->cksumInit);
  if( rc ) return rc;

  rc = read32bits(pPager->jfd, jrnlOff+8, pDbSize);
  if( rc ) return rc;

  rc = read32bits(pPager->jfd, jrnlOff+16, (u32 *)&iPageSize);
  if( rc==SQLITE_OK 
   && iPageSize>=512 
   && iPageSize<=SQLITE_MAX_PAGE_SIZE 
   && ((iPageSize-1)&iPageSize)==0 
  ){
    u16 pagesize = iPageSize;
    rc = sqlite3PagerSetPagesize(pPager, &pagesize);
  }
  if( rc ) return rc;

  /* Update the assumed sector-size to match the value used by 
  ** the process that created this journal. If this journal was
  ** created by a process other than this one, then this routine
  ** is being called from within pager_playback(). The local value
  ** of Pager.sectorSize is restored at the end of that routine.
  */
  rc = read32bits(pPager->jfd, jrnlOff+12, (u32 *)&pPager->sectorSize);
  if( rc ) return rc;

  pPager->journalOff += JOURNAL_HDR_SZ(pPager);
  return SQLITE_OK;
}


/*
** Write the supplied master journal name into the journal file for pager
** pPager at the current location. The master journal name must be the last
** thing written to a journal file. If the pager is in full-sync mode, the
** journal file descriptor is advanced to the next sector boundary before
** anything is written. The format is:
**
** + 4 bytes: PAGER_MJ_PGNO.
** + N bytes: length of master journal name.
** + 4 bytes: N
** + 4 bytes: Master journal name checksum.
** + 8 bytes: aJournalMagic[].
**
** The master journal page checksum is the sum of the bytes in the master
** journal name.
**
** If zMaster is a NULL pointer (occurs for a single database transaction), 
** this call is a no-op.
*/
static int writeMasterJournal(Pager *pPager, const char *zMaster){
  int rc;
  int len; 
  int i; 
  i64 jrnlOff;
  i64 jrnlSize;
  u32 cksum = 0;
  char zBuf[sizeof(aJournalMagic)+2*4];

  if( !zMaster || pPager->setMaster) return SQLITE_OK;
  pPager->setMaster = 1;

  len = strlen(zMaster);
  for(i=0; i<len; i++){
    cksum += zMaster[i];
  }

  /* If in full-sync mode, advance to the next disk sector before writing
  ** the master journal name. This is in case the previous page written to
  ** the journal has already been synced.
  */
  if( pPager->fullSync ){
    seekJournalHdr(pPager);
  }
  jrnlOff = pPager->journalOff;
  pPager->journalOff += (len+20);

  rc = write32bits(pPager->jfd, jrnlOff, PAGER_MJ_PGNO(pPager));
  if( rc!=SQLITE_OK ) return rc;
  jrnlOff += 4;

  rc = sqlite3OsWrite(pPager->jfd, zMaster, len, jrnlOff);
  if( rc!=SQLITE_OK ) return rc;
  jrnlOff += len;

  put32bits(zBuf, len);
  put32bits(&zBuf[4], cksum);
  memcpy(&zBuf[8], aJournalMagic, sizeof(aJournalMagic));
  rc = sqlite3OsWrite(pPager->jfd, zBuf, 8+sizeof(aJournalMagic), jrnlOff);
  jrnlOff += 8+sizeof(aJournalMagic);
  pPager->needSync = !pPager->noSync;

  /* If the pager is in peristent-journal mode, then the physical 
  ** journal-file may extend past the end of the master-journal name
  ** and 8 bytes of magic data just written to the file. This is 
  ** dangerous because the code to rollback a hot-journal file
  ** will not be able to find the master-journal name to determine 
  ** whether or not the journal is hot. 
  **
  ** Easiest thing to do in this scenario is to truncate the journal 
  ** file to the required size.
  */ 
  if( (rc==SQLITE_OK)
   && (rc = sqlite3OsFileSize(pPager->jfd, &jrnlSize))==SQLITE_OK
   && jrnlSize>jrnlOff
  ){
    rc = sqlite3OsTruncate(pPager->jfd, jrnlOff);
  }
  return rc;
}

/*
** Add or remove a page from the list of all pages that are in the
** statement journal.
**
** The Pager keeps a separate list of pages that are currently in
** the statement journal.  This helps the sqlite3PagerStmtCommit()
** routine run MUCH faster for the common case where there are many
** pages in memory but only a few are in the statement journal.
*/
static void page_add_to_stmt_list(PgHdr *pPg){
  Pager *pPager = pPg->pPager;
  PgHistory *pHist = PGHDR_TO_HIST(pPg, pPager);
  assert( MEMDB );
  if( !pHist->inStmt ){
    assert( pHist->pPrevStmt==0 && pHist->pNextStmt==0 );
    if( pPager->pStmt ){
      PGHDR_TO_HIST(pPager->pStmt, pPager)->pPrevStmt = pPg;
    }
    pHist->pNextStmt = pPager->pStmt;
    pPager->pStmt = pPg;
    pHist->inStmt = 1;
  }
}

/*
** Find a page in the hash table given its page number.  Return
** a pointer to the page or NULL if not found.
*/
static PgHdr *pager_lookup(Pager *pPager, Pgno pgno){
  PgHdr *p;
  if( pPager->aHash==0 ) return 0;
  p = pPager->aHash[pgno & (pPager->nHash-1)];
  while( p && p->pgno!=pgno ){
    p = p->pNextHash;
  }
  return p;
}

/*
** Clear the in-memory cache.  This routine
** sets the state of the pager back to what it was when it was first
** opened.  Any outstanding pages are invalidated and subsequent attempts
** to access those pages will likely result in a coredump.
*/
static void pager_reset(Pager *pPager){
  PgHdr *pPg, *pNext;
  if( pPager->errCode ) return;
  for(pPg=pPager->pAll; pPg; pPg=pNext){
    IOTRACE(("PGFREE %p %d\n", pPager, pPg->pgno));
    PAGER_INCR(sqlite3_pager_pgfree_count);
    pNext = pPg->pNextAll;
    lruListRemove(pPg);
    sqlite3PageFree(pPg->pData);
    sqlite3_free(pPg);
  }
  assert(pPager->lru.pFirst==0);
  assert(pPager->lru.pFirstSynced==0);
  assert(pPager->lru.pLast==0);
  pPager->pStmt = 0;
  pPager->pAll = 0;
  pPager->pDirty = 0;
  pPager->nHash = 0;
  sqlite3_free(pPager->aHash);
  pPager->nPage = 0;
  pPager->aHash = 0;
  pPager->nRef = 0;
}

/*
** Unlock the database file. 
**
** If the pager is currently in error state, discard the contents of 
** the cache and reset the Pager structure internal state. If there is
** an open journal-file, then the next time a shared-lock is obtained
** on the pager file (by this or any other process), it will be
** treated as a hot-journal and rolled back.
*/
static void pager_unlock(Pager *pPager){
  if( !pPager->exclusiveMode ){
    if( !MEMDB ){
      int rc = osUnlock(pPager->fd, NO_LOCK);
      if( rc ) pPager->errCode = rc;
      pPager->dbSize = -1;
      IOTRACE(("UNLOCK %p\n", pPager))

      /* Always close the journal file when dropping the database lock.
      ** Otherwise, another connection with journal_mode=delete might
      ** delete the file out from under us.
      */
      if( pPager->journalOpen ){
        sqlite3OsClose(pPager->jfd);
        pPager->journalOpen = 0;
        sqlite3BitvecDestroy(pPager->pInJournal);
        pPager->pInJournal = 0;
      }

      /* If Pager.errCode is set, the contents of the pager cache cannot be
      ** trusted. Now that the pager file is unlocked, the contents of the
      ** cache can be discarded and the error code safely cleared.
      */
      if( pPager->errCode ){
        if( rc==SQLITE_OK ) pPager->errCode = SQLITE_OK;
        pager_reset(pPager);
        if( pPager->stmtOpen ){
          sqlite3OsClose(pPager->stfd);
          sqlite3BitvecDestroy(pPager->pInStmt);
          pPager->pInStmt = 0;
        }
        pPager->stmtOpen = 0;
        pPager->stmtInUse = 0;
        pPager->journalOff = 0;
        pPager->journalStarted = 0;
        pPager->stmtAutoopen = 0;
        pPager->origDbSize = 0;
      }
    }

    if( !MEMDB || pPager->errCode==SQLITE_OK ){
      pPager->state = PAGER_UNLOCK;
      pPager->changeCountDone = 0;
    }
  }
}

/*
** Execute a rollback if a transaction is active and unlock the 
** database file. If the pager has already entered the error state, 
** do not attempt the rollback.
*/
static void pagerUnlockAndRollback(Pager *p){
  /* assert( p->state>=PAGER_RESERVED || p->journalOpen==0 ); */
  if( p->errCode==SQLITE_OK && p->state>=PAGER_RESERVED ){
    sqlite3BeginBenignMalloc();
    sqlite3PagerRollback(p);
    sqlite3EndBenignMalloc();
  }
  pager_unlock(p);
#if 0
  assert( p->errCode || !p->journalOpen || (p->exclusiveMode&&!p->journalOff) );
  assert( p->errCode || !p->stmtOpen || p->exclusiveMode );
#endif
}

/*
** This routine ends a transaction.  A transaction is ended by either
** a COMMIT or a ROLLBACK.
**
** When this routine is called, the pager has the journal file open and
** a RESERVED or EXCLUSIVE lock on the database.  This routine will release
** the database lock and acquires a SHARED lock in its place if that is
** the appropriate thing to do.  Release locks usually is appropriate,
** unless we are in exclusive access mode or unless this is a 
** COMMIT AND BEGIN or ROLLBACK AND BEGIN operation.
**
** The journal file is either deleted or truncated.
**
** TODO: Consider keeping the journal file open for temporary databases.
** This might give a performance improvement on windows where opening
** a file is an expensive operation.
*/
static int pager_end_transaction(Pager *pPager, int hasMaster){
  PgHdr *pPg;
  int rc = SQLITE_OK;
  int rc2 = SQLITE_OK;
  assert( !MEMDB );
  if( pPager->state<PAGER_RESERVED ){
    return SQLITE_OK;
  }
  sqlite3PagerStmtCommit(pPager);
  if( pPager->stmtOpen && !pPager->exclusiveMode ){
    sqlite3OsClose(pPager->stfd);
    pPager->stmtOpen = 0;
  }
  if( pPager->journalOpen ){
    if( pPager->exclusiveMode 
     || pPager->journalMode==PAGER_JOURNALMODE_PERSIST
    ){
      rc = zeroJournalHdr(pPager, hasMaster);
      pager_error(pPager, rc);
      pPager->journalOff = 0;
      pPager->journalStarted = 0;
    }else{
      sqlite3OsClose(pPager->jfd);
      pPager->journalOpen = 0;
      if( rc==SQLITE_OK && !pPager->tempFile ){
        rc = sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0);
      }
    }
    sqlite3BitvecDestroy(pPager->pInJournal);
    pPager->pInJournal = 0;
    for(pPg=pPager->pAll; pPg; pPg=pPg->pNextAll){
      pPg->inJournal = 0;
      pPg->dirty = 0;
      pPg->needSync = 0;
      pPg->alwaysRollback = 0;
#ifdef SQLITE_CHECK_PAGES
      pPg->pageHash = pager_pagehash(pPg);
#endif
    }
    pPager->pDirty = 0;
    pPager->dirtyCache = 0;
    pPager->nRec = 0;
  }else{
    assert( pPager->pInJournal==0 );
  }

  if( !pPager->exclusiveMode ){
    rc2 = osUnlock(pPager->fd, SHARED_LOCK);
    pPager->state = PAGER_SHARED;
  }else if( pPager->state==PAGER_SYNCED ){
    pPager->state = PAGER_EXCLUSIVE;
  }
  pPager->origDbSize = 0;
  pPager->setMaster = 0;
  pPager->needSync = 0;
  lruListSetFirstSynced(pPager);
  pPager->dbSize = -1;
  pPager->dbModified = 0;

  return (rc==SQLITE_OK?rc2:rc);
}

/*
** Compute and return a checksum for the page of data.
**
** This is not a real checksum.  It is really just the sum of the 
** random initial value and the page number.  We experimented with
** a checksum of the entire data, but that was found to be too slow.
**
** Note that the page number is stored at the beginning of data and
** the checksum is stored at the end.  This is important.  If journal
** corruption occurs due to a power failure, the most likely scenario
** is that one end or the other of the record will be changed.  It is
** much less likely that the two ends of the journal record will be
** correct and the middle be corrupt.  Thus, this "checksum" scheme,
** though fast and simple, catches the mostly likely kind of corruption.
**
** FIX ME:  Consider adding every 200th (or so) byte of the data to the
** checksum.  That way if a single page spans 3 or more disk sectors and
** only the middle sector is corrupt, we will still have a reasonable
** chance of failing the checksum and thus detecting the problem.
*/
static u32 pager_cksum(Pager *pPager, const u8 *aData){
  u32 cksum = pPager->cksumInit;
  int i = pPager->pageSize-200;
  while( i>0 ){
    cksum += aData[i];
    i -= 200;
  }
  return cksum;
}

/* Forward declaration */
static void makeClean(PgHdr*);

/*
** Read a single page from the journal file opened on file descriptor
** jfd.  Playback this one page.
**
** If useCksum==0 it means this journal does not use checksums.  Checksums
** are not used in statement journals because statement journals do not
** need to survive power failures.
*/
static int pager_playback_one_page(
  Pager *pPager, 
  sqlite3_file *jfd,
  i64 offset,
  int useCksum
){
  int rc;
  PgHdr *pPg;                   /* An existing page in the cache */
  Pgno pgno;                    /* The page number of a page in journal */
  u32 cksum;                    /* Checksum used for sanity checking */
  u8 *aData = (u8 *)pPager->pTmpSpace;   /* Temp storage for a page */

  /* useCksum should be true for the main journal and false for
  ** statement journals.  Verify that this is always the case
  */
  assert( jfd == (useCksum ? pPager->jfd : pPager->stfd) );
  assert( aData );

  rc = read32bits(jfd, offset, &pgno);
  if( rc!=SQLITE_OK ) return rc;
  rc = sqlite3OsRead(jfd, aData, pPager->pageSize, offset+4);
  if( rc!=SQLITE_OK ) return rc;
  pPager->journalOff += pPager->pageSize + 4;

  /* Sanity checking on the page.  This is more important that I originally
  ** thought.  If a power failure occurs while the journal is being written,
  ** it could cause invalid data to be written into the journal.  We need to
  ** detect this invalid data (with high probability) and ignore it.
  */
  if( pgno==0 || pgno==PAGER_MJ_PGNO(pPager) ){
    return SQLITE_DONE;
  }
  if( pgno>(unsigned)pPager->dbSize ){
    return SQLITE_OK;
  }
  if( useCksum ){
    rc = read32bits(jfd, offset+pPager->pageSize+4, &cksum);
    if( rc ) return rc;
    pPager->journalOff += 4;
    if( pager_cksum(pPager, aData)!=cksum ){
      return SQLITE_DONE;
    }
  }

  assert( pPager->state==PAGER_RESERVED || pPager->state>=PAGER_EXCLUSIVE );

  /* If the pager is in RESERVED state, then there must be a copy of this
  ** page in the pager cache. In this case just update the pager cache,
  ** not the database file. The page is left marked dirty in this case.
  **
  ** An exception to the above rule: If the database is in no-sync mode
  ** and a page is moved during an incremental vacuum then the page may
  ** not be in the pager cache. Later: if a malloc() or IO error occurs
  ** during a Movepage() call, then the page may not be in the cache
  ** either. So the condition described in the above paragraph is not
  ** assert()able.
  **
  ** If in EXCLUSIVE state, then we update the pager cache if it exists
  ** and the main file. The page is then marked not dirty.
  **
  ** Ticket #1171:  The statement journal might contain page content that is
  ** different from the page content at the start of the transaction.
  ** This occurs when a page is changed prior to the start of a statement
  ** then changed again within the statement.  When rolling back such a
  ** statement we must not write to the original database unless we know
  ** for certain that original page contents are synced into the main rollback
  ** journal.  Otherwise, a power loss might leave modified data in the
  ** database file without an entry in the rollback journal that can
  ** restore the database to its original form.  Two conditions must be
  ** met before writing to the database files. (1) the database must be
  ** locked.  (2) we know that the original page content is fully synced
  ** in the main journal either because the page is not in cache or else
  ** the page is marked as needSync==0.
  **
  ** 2008-04-14:  When attempting to vacuum a corrupt database file, it
  ** is possible to fail a statement on a database that does not yet exist.
  ** Do not attempt to write if database file has never been opened.
  */
  pPg = pager_lookup(pPager, pgno);
  PAGERTRACE4("PLAYBACK %d page %d hash(%08x)\n",
               PAGERID(pPager), pgno, pager_datahash(pPager->pageSize, aData));
  if( pPager->state>=PAGER_EXCLUSIVE && (pPg==0 || pPg->needSync==0)
        && pPager->fd->pMethods ){
    i64 offset = (pgno-1)*(i64)pPager->pageSize;
    rc = sqlite3OsWrite(pPager->fd, aData, pPager->pageSize, offset);
    if( pPg ){
      makeClean(pPg);
    }
  }
  if( pPg ){
    /* No page should ever be explicitly rolled back that is in use, except
    ** for page 1 which is held in use in order to keep the lock on the
    ** database active. However such a page may be rolled back as a result
    ** of an internal error resulting in an automatic call to
    ** sqlite3PagerRollback().
    */
    void *pData;
    /* assert( pPg->nRef==0 || pPg->pgno==1 ); */
    pData = PGHDR_TO_DATA(pPg);
    memcpy(pData, aData, pPager->pageSize);
    if( pPager->xReiniter ){
      pPager->xReiniter(pPg, pPager->pageSize);
    }
#ifdef SQLITE_CHECK_PAGES
    pPg->pageHash = pager_pagehash(pPg);
#endif
    /* If this was page 1, then restore the value of Pager.dbFileVers.
    ** Do this before any decoding. */
    if( pgno==1 ){
      memcpy(&pPager->dbFileVers, &((u8*)pData)[24],sizeof(pPager->dbFileVers));
    }

    /* Decode the page just read from disk */
    CODEC1(pPager, pData, pPg->pgno, 3);
  }
  return rc;
}

/*
** Parameter zMaster is the name of a master journal file. A single journal
** file that referred to the master journal file has just been rolled back.
** This routine checks if it is possible to delete the master journal file,
** and does so if it is.
**
** Argument zMaster may point to Pager.pTmpSpace. So that buffer is not 
** available for use within this function.
**
**
** The master journal file contains the names of all child journals.
** To tell if a master journal can be deleted, check to each of the
** children.  If all children are either missing or do not refer to
** a different master journal, then this master journal can be deleted.
*/
static int pager_delmaster(Pager *pPager, const char *zMaster){
  sqlite3_vfs *pVfs = pPager->pVfs;
  int rc;
  int master_open = 0;
  sqlite3_file *pMaster;
  sqlite3_file *pJournal;
  char *zMasterJournal = 0; /* Contents of master journal file */
  i64 nMasterJournal;       /* Size of master journal file */

  /* Open the master journal file exclusively in case some other process
  ** is running this routine also. Not that it makes too much difference.
  */
  pMaster = (sqlite3_file *)sqlite3Malloc(pVfs->szOsFile * 2);
  pJournal = (sqlite3_file *)(((u8 *)pMaster) + pVfs->szOsFile);
  if( !pMaster ){
    rc = SQLITE_NOMEM;
  }else{
    int flags = (SQLITE_OPEN_READONLY|SQLITE_OPEN_MASTER_JOURNAL);
    rc = sqlite3OsOpen(pVfs, zMaster, pMaster, flags, 0);
  }
  if( rc!=SQLITE_OK ) goto delmaster_out;
  master_open = 1;

  rc = sqlite3OsFileSize(pMaster, &nMasterJournal);
  if( rc!=SQLITE_OK ) goto delmaster_out;

  if( nMasterJournal>0 ){
    char *zJournal;
    char *zMasterPtr = 0;
    int nMasterPtr = pPager->pVfs->mxPathname+1;

    /* Load the entire master journal file into space obtained from
    ** sqlite3_malloc() and pointed to by zMasterJournal. 
    */
    zMasterJournal = (char *)sqlite3Malloc(nMasterJournal + nMasterPtr);
    if( !zMasterJournal ){
      rc = SQLITE_NOMEM;
      goto delmaster_out;
    }
    zMasterPtr = &zMasterJournal[nMasterJournal];
    rc = sqlite3OsRead(pMaster, zMasterJournal, nMasterJournal, 0);
    if( rc!=SQLITE_OK ) goto delmaster_out;

    zJournal = zMasterJournal;
    while( (zJournal-zMasterJournal)<nMasterJournal ){
      int exists;
      rc = sqlite3OsAccess(pVfs, zJournal, SQLITE_ACCESS_EXISTS, &exists);
      if( rc!=SQLITE_OK ){
        goto delmaster_out;
      }
      if( exists ){
        /* One of the journals pointed to by the master journal exists.
        ** Open it and check if it points at the master journal. If
        ** so, return without deleting the master journal file.
        */
        int c;
        int flags = (SQLITE_OPEN_READONLY|SQLITE_OPEN_MAIN_JOURNAL);
        rc = sqlite3OsOpen(pVfs, zJournal, pJournal, flags, 0);
        if( rc!=SQLITE_OK ){
          goto delmaster_out;
        }

        rc = readMasterJournal(pJournal, zMasterPtr, nMasterPtr);
        sqlite3OsClose(pJournal);
        if( rc!=SQLITE_OK ){
          goto delmaster_out;
        }

        c = zMasterPtr[0]!=0 && strcmp(zMasterPtr, zMaster)==0;
        if( c ){
          /* We have a match. Do not delete the master journal file. */
          goto delmaster_out;
        }
      }
      zJournal += (strlen(zJournal)+1);
    }
  }
  
  rc = sqlite3OsDelete(pVfs, zMaster, 0);

delmaster_out:
  if( zMasterJournal ){
    sqlite3_free(zMasterJournal);
  }  
  if( master_open ){
    sqlite3OsClose(pMaster);
  }
  sqlite3_free(pMaster);
  return rc;
}


static void pager_truncate_cache(Pager *pPager);

/*
** Truncate the main file of the given pager to the number of pages
** indicated. Also truncate the cached representation of the file.
**
** Might might be the case that the file on disk is smaller than nPage.
** This can happen, for example, if we are in the middle of a transaction
** which has extended the file size and the new pages are still all held
** in cache, then an INSERT or UPDATE does a statement rollback.  Some
** operating system implementations can get confused if you try to
** truncate a file to some size that is larger than it currently is,
** so detect this case and write a single zero byte to the end of the new
** file instead.
*/
static int pager_truncate(Pager *pPager, int nPage){
  int rc = SQLITE_OK;
  if( pPager->state>=PAGER_EXCLUSIVE && pPager->fd->pMethods ){
    i64 currentSize, newSize;
    rc = sqlite3OsFileSize(pPager->fd, &currentSize);
    newSize = pPager->pageSize*(i64)nPage;
    if( rc==SQLITE_OK && currentSize!=newSize ){
      if( currentSize>newSize ){
        rc = sqlite3OsTruncate(pPager->fd, newSize);
      }else{
        rc = sqlite3OsWrite(pPager->fd, "", 1, newSize-1);
      }
    }
  }
  if( rc==SQLITE_OK ){
    pPager->dbSize = nPage;
    pager_truncate_cache(pPager);
  }
  return rc;
}

/*
** Set the sectorSize for the given pager.
**
** The sector size is at least as big as the sector size reported
** by sqlite3OsSectorSize().  The minimum sector size is 512.
*/
static void setSectorSize(Pager *pPager){
  assert(pPager->fd->pMethods||pPager->tempFile);
  if( !pPager->tempFile ){
    /* Sector size doesn't matter for temporary files. Also, the file
    ** may not have been opened yet, in whcih case the OsSectorSize()
    ** call will segfault.
    */
    pPager->sectorSize = sqlite3OsSectorSize(pPager->fd);
  }
  if( pPager->sectorSize<512 ){
    pPager->sectorSize = 512;
  }
}

/*
** Playback the journal and thus restore the database file to
** the state it was in before we started making changes.  
**
** The journal file format is as follows: 
**
**  (1)  8 byte prefix.  A copy of aJournalMagic[].
**  (2)  4 byte big-endian integer which is the number of valid page records
**       in the journal.  If this value is 0xffffffff, then compute the
**       number of page records from the journal size.
**  (3)  4 byte big-endian integer which is the initial value for the 
**       sanity checksum.
**  (4)  4 byte integer which is the number of pages to truncate the
**       database to during a rollback.
**  (5)  4 byte big-endian integer which is the sector size.  The header
**       is this many bytes in size.
**  (6)  4 byte big-endian integer which is the page case.
**  (7)  4 byte integer which is the number of bytes in the master journal
**       name.  The value may be zero (indicate that there is no master
**       journal.)
**  (8)  N bytes of the master journal name.  The name will be nul-terminated
**       and might be shorter than the value read from (5).  If the first byte
**       of the name is \000 then there is no master journal.  The master
**       journal name is stored in UTF-8.
**  (9)  Zero or more pages instances, each as follows:
**        +  4 byte page number.
**        +  pPager->pageSize bytes of data.
**        +  4 byte checksum
**
** When we speak of the journal header, we mean the first 8 items above.
** Each entry in the journal is an instance of the 9th item.
**
** Call the value from the second bullet "nRec".  nRec is the number of
** valid page entries in the journal.  In most cases, you can compute the
** value of nRec from the size of the journal file.  But if a power
** failure occurred while the journal was being written, it could be the
** case that the size of the journal file had already been increased but
** the extra entries had not yet made it safely to disk.  In such a case,
** the value of nRec computed from the file size would be too large.  For
** that reason, we always use the nRec value in the header.
**
** If the nRec value is 0xffffffff it means that nRec should be computed
** from the file size.  This value is used when the user selects the
** no-sync option for the journal.  A power failure could lead to corruption
** in this case.  But for things like temporary table (which will be
** deleted when the power is restored) we don't care.  
**
** If the file opened as the journal file is not a well-formed
** journal file then all pages up to the first corrupted page are rolled
** back (or no pages if the journal header is corrupted). The journal file
** is then deleted and SQLITE_OK returned, just as if no corruption had
** been encountered.
**
** If an I/O or malloc() error occurs, the journal-file is not deleted
** and an error code is returned.
*/
static int pager_playback(Pager *pPager, int isHot){
  sqlite3_vfs *pVfs = pPager->pVfs;
  i64 szJ;                 /* Size of the journal file in bytes */
  u32 nRec;                /* Number of Records in the journal */
  u32 u;                   /* Unsigned loop counter */
  Pgno mxPg = 0;           /* Size of the original file in pages */
  int rc;                  /* Result code of a subroutine */
  int res = 1;             /* Value returned by sqlite3OsAccess() */
  char *zMaster = 0;       /* Name of master journal file if any */

  /* Figure out how many records are in the journal.  Abort early if
  ** the journal is empty.
  */
  assert( pPager->journalOpen );
  rc = sqlite3OsFileSize(pPager->jfd, &szJ);
  if( rc!=SQLITE_OK || szJ==0 ){
    goto end_playback;
  }

  /* Read the master journal name from the journal, if it is present.
  ** If a master journal file name is specified, but the file is not
  ** present on disk, then the journal is not hot and does not need to be
  ** played back.
  */
  zMaster = pPager->pTmpSpace;
  rc = readMasterJournal(pPager->jfd, zMaster, pPager->pVfs->mxPathname+1);
  if( rc==SQLITE_OK && zMaster[0] ){
    rc = sqlite3OsAccess(pVfs, zMaster, SQLITE_ACCESS_EXISTS, &res);
  }
  zMaster = 0;
  if( rc!=SQLITE_OK || !res ){
    goto end_playback;
  }
  pPager->journalOff = 0;

  /* This loop terminates either when the readJournalHdr() call returns
  ** SQLITE_DONE or an IO error occurs. */
  while( 1 ){

    /* Read the next journal header from the journal file.  If there are
    ** not enough bytes left in the journal file for a complete header, or
    ** it is corrupted, then a process must of failed while writing it.
    ** This indicates nothing more needs to be rolled back.
    */
    rc = readJournalHdr(pPager, szJ, &nRec, &mxPg);
    if( rc!=SQLITE_OK ){ 
      if( rc==SQLITE_DONE ){
        rc = SQLITE_OK;
      }
      goto end_playback;
    }

    /* If nRec is 0xffffffff, then this journal was created by a process
    ** working in no-sync mode. This means that the rest of the journal
    ** file consists of pages, there are no more journal headers. Compute
    ** the value of nRec based on this assumption.
    */
    if( nRec==0xffffffff ){
      assert( pPager->journalOff==JOURNAL_HDR_SZ(pPager) );
      nRec = (szJ - JOURNAL_HDR_SZ(pPager))/JOURNAL_PG_SZ(pPager);
    }

    /* If nRec is 0 and this rollback is of a transaction created by this
    ** process and if this is the final header in the journal, then it means
    ** that this part of the journal was being filled but has not yet been
    ** synced to disk.  Compute the number of pages based on the remaining
    ** size of the file.
    **
    ** The third term of the test was added to fix ticket #2565.
    */
    if( nRec==0 && !isHot &&
        pPager->journalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff ){
      nRec = (szJ - pPager->journalOff) / JOURNAL_PG_SZ(pPager);
    }

    /* If this is the first header read from the journal, truncate the
    ** database file back to its original size.
    */
    if( pPager->journalOff==JOURNAL_HDR_SZ(pPager) ){
      rc = pager_truncate(pPager, mxPg);
      if( rc!=SQLITE_OK ){
        goto end_playback;
      }
    }

    /* Copy original pages out of the journal and back into the database file.
    */
    for(u=0; u<nRec; u++){
      rc = pager_playback_one_page(pPager, pPager->jfd, pPager->journalOff, 1);
      if( rc!=SQLITE_OK ){
        if( rc==SQLITE_DONE ){
          rc = SQLITE_OK;
          pPager->journalOff = szJ;
          break;
        }else{
          goto end_playback;
        }
      }
    }
  }
  /*NOTREACHED*/
  assert( 0 );

end_playback:
  if( rc==SQLITE_OK ){
    zMaster = pPager->pTmpSpace;
    rc = readMasterJournal(pPager->jfd, zMaster, pPager->pVfs->mxPathname+1);
  }
  if( rc==SQLITE_OK ){
    rc = pager_end_transaction(pPager, zMaster[0]!='\0');
  }
  if( rc==SQLITE_OK && zMaster[0] ){
    /* If there was a master journal and this routine will return success,
    ** see if it is possible to delete the master journal.
    */
    rc = pager_delmaster(pPager, zMaster);
  }

  /* The Pager.sectorSize variable may have been updated while rolling
  ** back a journal created by a process with a different sector size
  ** value. Reset it to the correct value for this process.
  */
  setSectorSize(pPager);
  return rc;
}

/*
** Playback the statement journal.
**
** This is similar to playing back the transaction journal but with
** a few extra twists.
**
**    (1)  The number of pages in the database file at the start of
**         the statement is stored in pPager->stmtSize, not in the
**         journal file itself.
**
**    (2)  In addition to playing back the statement journal, also
**         playback all pages of the transaction journal beginning
**         at offset pPager->stmtJSize.
*/
static int pager_stmt_playback(Pager *pPager){
  i64 szJ;                 /* Size of the full journal */
  i64 hdrOff;
  int nRec;                /* Number of Records */
  int i;                   /* Loop counter */
  int rc;

  szJ = pPager->journalOff;

  /* Set hdrOff to be the offset just after the end of the last journal
  ** page written before the first journal-header for this statement
  ** transaction was written, or the end of the file if no journal
  ** header was written.
  */
  hdrOff = pPager->stmtHdrOff;
  assert( pPager->fullSync || !hdrOff );
  if( !hdrOff ){
    hdrOff = szJ;
  }
  
  /* Truncate the database back to its original size.
  */
  rc = pager_truncate(pPager, pPager->stmtSize);
  assert( pPager->state>=PAGER_SHARED );

  /* Figure out how many records are in the statement journal.
  */
  assert( pPager->stmtInUse && pPager->journalOpen );
  nRec = pPager->stmtNRec;
  
  /* Copy original pages out of the statement journal and back into the
  ** database file.  Note that the statement journal omits checksums from
  ** each record since power-failure recovery is not important to statement
  ** journals.
  */
  for(i=0; i<nRec; i++){
    i64 offset = i*(4+pPager->pageSize);
    rc = pager_playback_one_page(pPager, pPager->stfd, offset, 0);
    assert( rc!=SQLITE_DONE );
    if( rc!=SQLITE_OK ) goto end_stmt_playback;
  }

  /* Now roll some pages back from the transaction journal. Pager.stmtJSize
  ** was the size of the journal file when this statement was started, so
  ** everything after that needs to be rolled back, either into the
  ** database, the memory cache, or both.
  **
  ** If it is not zero, then Pager.stmtHdrOff is the offset to the start
  ** of the first journal header written during this statement transaction.
  */
  pPager->journalOff = pPager->stmtJSize;
  pPager->cksumInit = pPager->stmtCksum;
  while( pPager->journalOff < hdrOff ){
    rc = pager_playback_one_page(pPager, pPager->jfd, pPager->journalOff, 1);
    assert( rc!=SQLITE_DONE );
    if( rc!=SQLITE_OK ) goto end_stmt_playback;
  }

  while( pPager->journalOff < szJ ){
    u32 nJRec;         /* Number of Journal Records */
    u32 dummy;
    rc = readJournalHdr(pPager, szJ, &nJRec, &dummy);
    if( rc!=SQLITE_OK ){
      assert( rc!=SQLITE_DONE );
      goto end_stmt_playback;
    }
    if( nJRec==0 ){
      nJRec = (szJ - pPager->journalOff) / (pPager->pageSize+8);
    }
    for(i=nJRec-1; i>=0 && pPager->journalOff < szJ; i--){
      rc = pager_playback_one_page(pPager, pPager->jfd, pPager->journalOff, 1);
      assert( rc!=SQLITE_DONE );
      if( rc!=SQLITE_OK ) goto end_stmt_playback;
    }
  }

  pPager->journalOff = szJ;
  
end_stmt_playback:
  if( rc==SQLITE_OK) {
    pPager->journalOff = szJ;
    /* pager_reload_cache(pPager); */
  }
  return rc;
}

/*
** Change the maximum number of in-memory pages that are allowed.
*/
void sqlite3PagerSetCachesize(Pager *pPager, int mxPage){
  if( mxPage>10 ){
    pPager->mxPage = mxPage;
  }else{
    pPager->mxPage = 10;
  }
}

/*
** Adjust the robustness of the database to damage due to OS crashes
** or power failures by changing the number of syncs()s when writing
** the rollback journal.  There are three levels:
**
**    OFF       sqlite3OsSync() is never called.  This is the default
**              for temporary and transient files.
**
**    NORMAL    The journal is synced once before writes begin on the
**              database.  This is normally adequate protection, but
**              it is theoretically possible, though very unlikely,
**              that an inopertune power failure could leave the journal
**              in a state which would cause damage to the database
**              when it is rolled back.
**
**    FULL      The journal is synced twice before writes begin on the
**              database (with some additional information - the nRec field
**              of the journal header - being written in between the two
**              syncs).  If we assume that writing a
**              single disk sector is atomic, then this mode provides
**              assurance that the journal will not be corrupted to the
**              point of causing damage to the database during rollback.
**
** Numeric values associated with these states are OFF==1, NORMAL=2,
** and FULL=3.
*/
#ifndef SQLITE_OMIT_PAGER_PRAGMAS
void sqlite3PagerSetSafetyLevel(Pager *pPager, int level, int full_fsync){
  pPager->noSync =  level==1 || pPager->tempFile;
  pPager->fullSync = level==3 && !pPager->tempFile;
  pPager->sync_flags = (full_fsync?SQLITE_SYNC_FULL:SQLITE_SYNC_NORMAL);
  if( pPager->noSync ) pPager->needSync = 0;
}
#endif

/*
** The following global variable is incremented whenever the library
** attempts to open a temporary file.  This information is used for
** testing and analysis only.  
*/
#ifdef SQLITE_TEST
int sqlite3_opentemp_count = 0;
#endif

/*
** Open a temporary file. 
**
** Write the file descriptor into *fd.  Return SQLITE_OK on success or some
** other error code if we fail. The OS will automatically delete the temporary
** file when it is closed.
*/
static int sqlite3PagerOpentemp(
  Pager *pPager,        /* The pager object */
  sqlite3_file *pFile,  /* Write the file descriptor here */
  int vfsFlags          /* Flags passed through to the VFS */
){
  int rc;

#ifdef SQLITE_TEST
  sqlite3_opentemp_count++;  /* Used for testing and analysis only */
#endif

  vfsFlags |=  SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE |
            SQLITE_OPEN_EXCLUSIVE | SQLITE_OPEN_DELETEONCLOSE;
  rc = sqlite3OsOpen(pPager->pVfs, 0, pFile, vfsFlags, 0);
  assert( rc!=SQLITE_OK || pFile->pMethods );
  return rc;
}

/*
** Create a new page cache and put a pointer to the page cache in *ppPager.
** The file to be cached need not exist.  The file is not locked until
** the first call to sqlite3PagerGet() and is only held open until the
** last page is released using sqlite3PagerUnref().
**
** If zFilename is NULL then a randomly-named temporary file is created
** and used as the file to be cached.  The file will be deleted
** automatically when it is closed.
**
** If zFilename is ":memory:" then all information is held in cache.
** It is never written to disk.  This can be used to implement an
** in-memory database.
*/
int sqlite3PagerOpen(
  sqlite3_vfs *pVfs,       /* The virtual file system to use */
  Pager **ppPager,         /* Return the Pager structure here */
  const char *zFilename,   /* Name of the database file to open */
  int nExtra,              /* Extra bytes append to each in-memory page */
  int flags,               /* flags controlling this file */
  int vfsFlags             /* flags passed through to sqlite3_vfs.xOpen() */
){
  u8 *pPtr;
  Pager *pPager = 0;
  int rc = SQLITE_OK;
  int i;
  int tempFile = 0;
  int memDb = 0;
  int readOnly = 0;
  int useJournal = (flags & PAGER_OMIT_JOURNAL)==0;
  int noReadlock = (flags & PAGER_NO_READLOCK)!=0;
  int journalFileSize = sqlite3JournalSize(pVfs);
  int szPageDflt = SQLITE_DEFAULT_PAGE_SIZE;
  char *zPathname = 0;
  int nPathname = 0;

  /* The default return is a NULL pointer */
  *ppPager = 0;

  /* Compute and store the full pathname in an allocated buffer pointed
  ** to by zPathname, length nPathname. Or, if this is a temporary file,
  ** leave both nPathname and zPathname set to 0.
  */
  if( zFilename && zFilename[0] ){
    nPathname = pVfs->mxPathname+1;
    zPathname = sqlite3Malloc(nPathname*2);
    if( zPathname==0 ){
      return SQLITE_NOMEM;
    }
#ifndef SQLITE_OMIT_MEMORYDB
    if( strcmp(zFilename,":memory:")==0 ){
      memDb = 1;
      zPathname[0] = 0;
    }else
#endif
    {
      rc = sqlite3OsFullPathname(pVfs, zFilename, nPathname, zPathname);
    }
    if( rc!=SQLITE_OK ){
      sqlite3_free(zPathname);
      return rc;
    }
    nPathname = strlen(zPathname);
  }

  /* Allocate memory for the pager structure */
  pPager = sqlite3MallocZero(
    sizeof(*pPager) +           /* Pager structure */
    journalFileSize +           /* The journal file structure */ 
    pVfs->szOsFile * 3 +        /* The main db and two journal files */ 
    3*nPathname + 40            /* zFilename, zDirectory, zJournal */
  );
  if( !pPager ){
    sqlite3_free(zPathname);
    return SQLITE_NOMEM;
  }
  pPtr = (u8 *)&pPager[1];
  pPager->vfsFlags = vfsFlags;
  pPager->fd = (sqlite3_file*)&pPtr[pVfs->szOsFile*0];
  pPager->stfd = (sqlite3_file*)&pPtr[pVfs->szOsFile*1];
  pPager->jfd = (sqlite3_file*)&pPtr[pVfs->szOsFile*2];
  pPager->zFilename = (char*)&pPtr[pVfs->szOsFile*2+journalFileSize];
  pPager->zDirectory = &pPager->zFilename[nPathname+1];
  pPager->zJournal = &pPager->zDirectory[nPathname+1];
  pPager->pVfs = pVfs;
  if( zPathname ){
    memcpy(pPager->zFilename, zPathname, nPathname+1);
    sqlite3_free(zPathname);
  }

  /* Open the pager file.
  */
  if( zFilename && zFilename[0] && !memDb ){
    if( nPathname>(pVfs->mxPathname - sizeof("-journal")) ){
      rc = SQLITE_CANTOPEN;
    }else{
      int fout = 0;
      rc = sqlite3OsOpen(pVfs, pPager->zFilename, pPager->fd,
                         pPager->vfsFlags, &fout);
      readOnly = (fout&SQLITE_OPEN_READONLY);

      /* If the file was successfully opened for read/write access,
      ** choose a default page size in case we have to create the
      ** database file. The default page size is the maximum of:
      **
      **    + SQLITE_DEFAULT_PAGE_SIZE,
      **    + The value returned by sqlite3OsSectorSize()
      **    + The largest page size that can be written atomically.
      */
      if( rc==SQLITE_OK && !readOnly ){
        int iSectorSize = sqlite3OsSectorSize(pPager->fd);
        if( szPageDflt<iSectorSize ){
          szPageDflt = iSectorSize;
        }
#ifdef SQLITE_ENABLE_ATOMIC_WRITE
        {
          int iDc = sqlite3OsDeviceCharacteristics(pPager->fd);
          int ii;
          assert(SQLITE_IOCAP_ATOMIC512==(512>>8));
          assert(SQLITE_IOCAP_ATOMIC64K==(65536>>8));
          assert(SQLITE_MAX_DEFAULT_PAGE_SIZE<=65536);
          for(ii=szPageDflt; ii<=SQLITE_MAX_DEFAULT_PAGE_SIZE; ii=ii*2){
            if( iDc&(SQLITE_IOCAP_ATOMIC|(ii>>8)) ) szPageDflt = ii;
          }
        }
#endif
        if( szPageDflt>SQLITE_MAX_DEFAULT_PAGE_SIZE ){
          szPageDflt = SQLITE_MAX_DEFAULT_PAGE_SIZE;
        }
      }
    }
  }else if( !memDb ){
    /* If a temporary file is requested, it is not opened immediately.
    ** In this case we accept the default page size and delay actually
    ** opening the file until the first call to OsWrite().
    */ 
    tempFile = 1;
    pPager->state = PAGER_EXCLUSIVE;
  }

  if( pPager && rc==SQLITE_OK ){
    pPager->pTmpSpace = sqlite3PageMalloc(szPageDflt);
  }

  /* If an error occured in either of the blocks above.
  ** Free the Pager structure and close the file.
  ** Since the pager is not allocated there is no need to set 
  ** any Pager.errMask variables.
  */
  if( !pPager || !pPager->pTmpSpace ){
    sqlite3OsClose(pPager->fd);
    sqlite3_free(pPager);
    return ((rc==SQLITE_OK)?SQLITE_NOMEM:rc);
  }

  PAGERTRACE3("OPEN %d %s\n", FILEHANDLEID(pPager->fd), pPager->zFilename);
  IOTRACE(("OPEN %p %s\n", pPager, pPager->zFilename))

  /* Fill in Pager.zDirectory[] */
  memcpy(pPager->zDirectory, pPager->zFilename, nPathname+1);
  for(i=strlen(pPager->zDirectory); i>0 && pPager->zDirectory[i-1]!='/'; i--){}
  if( i>0 ) pPager->zDirectory[i-1] = 0;

  /* Fill in Pager.zJournal[] */
  if( zPathname ){
    memcpy(pPager->zJournal, pPager->zFilename, nPathname);
    memcpy(&pPager->zJournal[nPathname], "-journal", 9);
  }else{
    pPager->zJournal = 0;
  }

  /* pPager->journalOpen = 0; */
  pPager->useJournal = useJournal && !memDb;
  pPager->noReadlock = noReadlock && readOnly;
  /* pPager->stmtOpen = 0; */
  /* pPager->stmtInUse = 0; */
  /* pPager->nRef = 0; */
  pPager->dbSize = memDb-1;
  pPager->pageSize = szPageDflt;
  /* pPager->stmtSize = 0; */
  /* pPager->stmtJSize = 0; */
  /* pPager->nPage = 0; */
  pPager->mxPage = 100;
  pPager->mxPgno = SQLITE_MAX_PAGE_COUNT;
  /* pPager->state = PAGER_UNLOCK; */
  assert( pPager->state == (tempFile ? PAGER_EXCLUSIVE : PAGER_UNLOCK) );
  /* pPager->errMask = 0; */
  pPager->tempFile = tempFile;
  assert( tempFile==PAGER_LOCKINGMODE_NORMAL 
          || tempFile==PAGER_LOCKINGMODE_EXCLUSIVE );
  assert( PAGER_LOCKINGMODE_EXCLUSIVE==1 );
  pPager->exclusiveMode = tempFile; 
  pPager->memDb = memDb;
  pPager->readOnly = readOnly;
  /* pPager->needSync = 0; */
  pPager->noSync = pPager->tempFile || !useJournal;
  pPager->fullSync = (pPager->noSync?0:1);
  pPager->sync_flags = SQLITE_SYNC_NORMAL;
  /* pPager->pFirst = 0; */
  /* pPager->pFirstSynced = 0; */
  /* pPager->pLast = 0; */
  pPager->nExtra = FORCE_ALIGNMENT(nExtra);
  pPager->journalSizeLimit = SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT;
  assert(pPager->fd->pMethods||memDb||tempFile);
  if( !memDb ){
    setSectorSize(pPager);
  }
  /* pPager->pBusyHandler = 0; */
  /* memset(pPager->aHash, 0, sizeof(pPager->aHash)); */
  *ppPager = pPager;
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  pPager->iInUseMM = 0;
  pPager->iInUseDB = 0;
  if( !memDb ){
#ifndef SQLITE_MUTEX_NOOP
    sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM2);
#endif
    sqlite3_mutex_enter(mutex);
    pPager->pNext = sqlite3PagerList;
    if( sqlite3PagerList ){
      assert( sqlite3PagerList->pPrev==0 );
      sqlite3PagerList->pPrev = pPager;
    }
    pPager->pPrev = 0;
    sqlite3PagerList = pPager;
    sqlite3_mutex_leave(mutex);
  }
#endif
  return SQLITE_OK;
}

/*
** Set the busy handler function.
*/
void sqlite3PagerSetBusyhandler(Pager *pPager, BusyHandler *pBusyHandler){
  pPager->pBusyHandler = pBusyHandler;
}

/*
** Set the destructor for this pager.  If not NULL, the destructor is called
** when the reference count on each page reaches zero.  The destructor can
** be used to clean up information in the extra segment appended to each page.
**
** The destructor is not called as a result sqlite3PagerClose().  
** Destructors are only called by sqlite3PagerUnref().
*/
void sqlite3PagerSetDestructor(Pager *pPager, void (*xDesc)(DbPage*,int)){
  pPager->xDestructor = xDesc;
}

/*
** Set the reinitializer for this pager.  If not NULL, the reinitializer
** is called when the content of a page in cache is restored to its original
** value as a result of a rollback.  The callback gives higher-level code
** an opportunity to restore the EXTRA section to agree with the restored
** page data.
*/
void sqlite3PagerSetReiniter(Pager *pPager, void (*xReinit)(DbPage*,int)){
  pPager->xReiniter = xReinit;
}

/*
** Set the page size to *pPageSize. If the suggest new page size is
** inappropriate, then an alternative page size is set to that
** value before returning.
*/
int sqlite3PagerSetPagesize(Pager *pPager, u16 *pPageSize){
  int rc = SQLITE_OK;
  u16 pageSize = *pPageSize;
  assert( pageSize==0 || (pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE) );
  if( pageSize && pageSize!=pPager->pageSize 
   && !pPager->memDb && pPager->nRef==0 
  ){
    char *pNew = (char *)sqlite3PageMalloc(pageSize);
    if( !pNew ){
      rc = SQLITE_NOMEM;
    }else{
      pagerEnter(pPager);
      pager_reset(pPager);
      pPager->pageSize = pageSize;
      setSectorSize(pPager);
      sqlite3PageFree(pPager->pTmpSpace);
      pPager->pTmpSpace = pNew;
      pagerLeave(pPager);
    }
  }
  *pPageSize = pPager->pageSize;
  return rc;
}

/*
** Return a pointer to the "temporary page" buffer held internally
** by the pager.  This is a buffer that is big enough to hold the
** entire content of a database page.  This buffer is used internally
** during rollback and will be overwritten whenever a rollback
** occurs.  But other modules are free to use it too, as long as
** no rollbacks are happening.
*/
void *sqlite3PagerTempSpace(Pager *pPager){
  return pPager->pTmpSpace;
}

/*
** Attempt to set the maximum database page count if mxPage is positive. 
** Make no changes if mxPage is zero or negative.  And never reduce the
** maximum page count below the current size of the database.
**
** Regardless of mxPage, return the current maximum page count.
*/
int sqlite3PagerMaxPageCount(Pager *pPager, int mxPage){
  if( mxPage>0 ){
    pPager->mxPgno = mxPage;
  }
  sqlite3PagerPagecount(pPager, 0);
  return pPager->mxPgno;
}

/*
** The following set of routines are used to disable the simulated
** I/O error mechanism.  These routines are used to avoid simulated
** errors in places where we do not care about errors.
**
** Unless -DSQLITE_TEST=1 is used, these routines are all no-ops
** and generate no code.
*/
#ifdef SQLITE_TEST
extern int sqlite3_io_error_pending;
extern int sqlite3_io_error_hit;
static int saved_cnt;
void disable_simulated_io_errors(void){
  saved_cnt = sqlite3_io_error_pending;
  sqlite3_io_error_pending = -1;
}
void enable_simulated_io_errors(void){
  sqlite3_io_error_pending = saved_cnt;
}
#else
# define disable_simulated_io_errors()
# define enable_simulated_io_errors()
#endif

/*
** Read the first N bytes from the beginning of the file into memory
** that pDest points to. 
**
** No error checking is done. The rational for this is that this function 
** may be called even if the file does not exist or contain a header. In 
** these cases sqlite3OsRead() will return an error, to which the correct 
** response is to zero the memory at pDest and continue.  A real IO error 
** will presumably recur and be picked up later (Todo: Think about this).
*/
int sqlite3PagerReadFileheader(Pager *pPager, int N, unsigned char *pDest){
  int rc = SQLITE_OK;
  memset(pDest, 0, N);
  assert(MEMDB||pPager->fd->pMethods||pPager->tempFile);
  if( pPager->fd->pMethods ){
    IOTRACE(("DBHDR %p 0 %d\n", pPager, N))
    rc = sqlite3OsRead(pPager->fd, pDest, N, 0);
    if( rc==SQLITE_IOERR_SHORT_READ ){
      rc = SQLITE_OK;
    }
  }
  return rc;
}

/*
** Return the total number of pages in the disk file associated with
** pPager. 
**
** If the PENDING_BYTE lies on the page directly after the end of the
** file, then consider this page part of the file too. For example, if
** PENDING_BYTE is byte 4096 (the first byte of page 5) and the size of the
** file is 4096 bytes, 5 is returned instead of 4.
*/
int sqlite3PagerPagecount(Pager *pPager, int *pnPage){
  i64 n = 0;
  int rc;
  assert( pPager!=0 );
  if( pPager->errCode ){
    return pPager->errCode;
  }
  if( pPager->dbSize>=0 ){
    n = pPager->dbSize;
  } else {
    assert(pPager->fd->pMethods||pPager->tempFile);
    if( (pPager->fd->pMethods)
     && (rc = sqlite3OsFileSize(pPager->fd, &n))!=SQLITE_OK ){
      pPager->nRef++;
      pager_error(pPager, rc);
      pPager->nRef--;
      return rc;
    }
    if( n>0 && n<pPager->pageSize ){
      n = 1;
    }else{
      n /= pPager->pageSize;
    }
    if( pPager->state!=PAGER_UNLOCK ){
      pPager->dbSize = n;
    }
  }
  if( n==(PENDING_BYTE/pPager->pageSize) ){
    n++;
  }
  if( n>pPager->mxPgno ){
    pPager->mxPgno = n;
  }
  if( pnPage ){
    *pnPage = n;
  }
  return SQLITE_OK;
}


#ifndef SQLITE_OMIT_MEMORYDB
/*
** Clear a PgHistory block
*/
static void clearHistory(PgHistory *pHist){
  sqlite3PageFree(pHist->pOrig);
  sqlite3PageFree(pHist->pStmt);
  pHist->pOrig = 0;
  pHist->pStmt = 0;
}
#else
#define clearHistory(x)
#endif

/*
** Forward declaration
*/
static int syncJournal(Pager*);

/*
** Unlink pPg from its hash chain. Also set the page number to 0 to indicate
** that the page is not part of any hash chain. This is required because the
** sqlite3PagerMovepage() routine can leave a page in the 
** pNextFree/pPrevFree list that is not a part of any hash-chain.
*/
static void unlinkHashChain(Pager *pPager, PgHdr *pPg){
  if( pPg->pgno==0 ){
    assert( pPg->pNextHash==0 && pPg->pPrevHash==0 );
    return;
  }
  if( pPg->pNextHash ){
    pPg->pNextHash->pPrevHash = pPg->pPrevHash;
  }
  if( pPg->pPrevHash ){
    assert( pPager->aHash[pPg->pgno & (pPager->nHash-1)]!=pPg );
    pPg->pPrevHash->pNextHash = pPg->pNextHash;
  }else{
    int h = pPg->pgno & (pPager->nHash-1);
    pPager->aHash[h] = pPg->pNextHash;
  }
  if( MEMDB ){
    clearHistory(PGHDR_TO_HIST(pPg, pPager));
  }
  pPg->pgno = 0;
  pPg->pNextHash = pPg->pPrevHash = 0;
}

/*
** Unlink a page from the free list (the list of all pages where nRef==0)
** and from its hash collision chain.
*/
static void unlinkPage(PgHdr *pPg){
  Pager *pPager = pPg->pPager;

  /* Unlink from free page list */
  lruListRemove(pPg);

  /* Unlink from the pgno hash table */
  unlinkHashChain(pPager, pPg);
}

/*
** This routine is used to truncate the cache when a database
** is truncated.  Drop from the cache all pages whose pgno is
** larger than pPager->dbSize and is unreferenced.
**
** Referenced pages larger than pPager->dbSize are zeroed.
**
** Actually, at the point this routine is called, it would be
** an error to have a referenced page.  But rather than delete
** that page and guarantee a subsequent segfault, it seems better
** to zero it and hope that we error out sanely.
*/
static void pager_truncate_cache(Pager *pPager){
  PgHdr *pPg;
  PgHdr **ppPg;
  int dbSize = pPager->dbSize;

  ppPg = &pPager->pAll;
  while( (pPg = *ppPg)!=0 ){
    if( pPg->pgno<=dbSize ){
      ppPg = &pPg->pNextAll;
    }else if( pPg->nRef>0 ){
      memset(PGHDR_TO_DATA(pPg), 0, pPager->pageSize);
      ppPg = &pPg->pNextAll;
    }else{
      *ppPg = pPg->pNextAll;
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
      if( *ppPg ){
        (*ppPg)->pPrevAll = pPg->pPrevAll;
      }
#endif
      IOTRACE(("PGFREE %p %d\n", pPager, pPg->pgno));
      PAGER_INCR(sqlite3_pager_pgfree_count);
      unlinkPage(pPg);
      makeClean(pPg);
      sqlite3PageFree(pPg->pData);
      sqlite3_free(pPg);
      pPager->nPage--;
    }
  }
}

/*
** Try to obtain a lock on a file.  Invoke the busy callback if the lock
** is currently not available.  Repeat until the busy callback returns
** false or until the lock succeeds.
**
** Return SQLITE_OK on success and an error code if we cannot obtain
** the lock.
*/
static int pager_wait_on_lock(Pager *pPager, int locktype){
  int rc;

  /* The OS lock values must be the same as the Pager lock values */
  assert( PAGER_SHARED==SHARED_LOCK );
  assert( PAGER_RESERVED==RESERVED_LOCK );
  assert( PAGER_EXCLUSIVE==EXCLUSIVE_LOCK );

  /* If the file is currently unlocked then the size must be unknown */
  assert( pPager->state>=PAGER_SHARED || pPager->dbSize<0 || MEMDB );

  if( pPager->state>=locktype ){
    rc = SQLITE_OK;
  }else{
    if( pPager->pBusyHandler ) pPager->pBusyHandler->nBusy = 0;
    do {
      rc = sqlite3OsLock(pPager->fd, locktype);
    }while( rc==SQLITE_BUSY && sqlite3InvokeBusyHandler(pPager->pBusyHandler) );
    if( rc==SQLITE_OK ){
      pPager->state = locktype;
      IOTRACE(("LOCK %p %d\n", pPager, locktype))
    }
  }
  return rc;
}

/*
** Truncate the file to the number of pages specified.
*/
int sqlite3PagerTruncate(Pager *pPager, Pgno nPage){
  int rc;
  assert( pPager->state>=PAGER_SHARED || MEMDB );
  sqlite3PagerPagecount(pPager, 0);
  if( pPager->errCode ){
    rc = pPager->errCode;
    return rc;
  }
  if( nPage>=(unsigned)pPager->dbSize ){
    return SQLITE_OK;
  }
  if( MEMDB ){
    pPager->dbSize = nPage;
    pager_truncate_cache(pPager);
    return SQLITE_OK;
  }
  pagerEnter(pPager);
  rc = syncJournal(pPager);
  pagerLeave(pPager);
  if( rc!=SQLITE_OK ){
    return rc;
  }

  /* Get an exclusive lock on the database before truncating. */
  pagerEnter(pPager);
  rc = pager_wait_on_lock(pPager, EXCLUSIVE_LOCK);
  pagerLeave(pPager);
  if( rc!=SQLITE_OK ){
    return rc;
  }

  rc = pager_truncate(pPager, nPage);
  return rc;
}

/*
** Shutdown the page cache.  Free all memory and close all files.
**
** If a transaction was in progress when this routine is called, that
** transaction is rolled back.  All outstanding pages are invalidated
** and their memory is freed.  Any attempt to use a page associated
** with this page cache after this function returns will likely
** result in a coredump.
**
** This function always succeeds. If a transaction is active an attempt
** is made to roll it back. If an error occurs during the rollback 
** a hot journal may be left in the filesystem but no error is returned
** to the caller.
*/
int sqlite3PagerClose(Pager *pPager){
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  if( !MEMDB ){
#ifndef SQLITE_MUTEX_NOOP
    sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM2);
#endif
    sqlite3_mutex_enter(mutex);
    if( pPager->pPrev ){
      pPager->pPrev->pNext = pPager->pNext;
    }else{
      sqlite3PagerList = pPager->pNext;
    }
    if( pPager->pNext ){
      pPager->pNext->pPrev = pPager->pPrev;
    }
    sqlite3_mutex_leave(mutex);
  }
#endif

  disable_simulated_io_errors();
  sqlite3BeginBenignMalloc();
  pPager->errCode = 0;
  pPager->exclusiveMode = 0;
  pager_reset(pPager);
  pagerUnlockAndRollback(pPager);
  enable_simulated_io_errors();
  sqlite3EndBenignMalloc();
  PAGERTRACE2("CLOSE %d\n", PAGERID(pPager));
  IOTRACE(("CLOSE %p\n", pPager))
  if( pPager->journalOpen ){
    sqlite3OsClose(pPager->jfd);
  }
  sqlite3BitvecDestroy(pPager->pInJournal);
  if( pPager->stmtOpen ){
    sqlite3OsClose(pPager->stfd);
  }
  sqlite3OsClose(pPager->fd);
  /* Temp files are automatically deleted by the OS
  ** if( pPager->tempFile ){
  **   sqlite3OsDelete(pPager->zFilename);
  ** }
  */

  sqlite3_free(pPager->aHash);
  sqlite3PageFree(pPager->pTmpSpace);
  sqlite3_free(pPager);
  return SQLITE_OK;
}

#if !defined(NDEBUG) || defined(SQLITE_TEST)
/*
** Return the page number for the given page data.
*/
Pgno sqlite3PagerPagenumber(DbPage *p){
  return p->pgno;
}
#endif

/*
** The page_ref() function increments the reference count for a page.
** If the page is currently on the freelist (the reference count is zero) then
** remove it from the freelist.
**
** For non-test systems, page_ref() is a macro that calls _page_ref()
** online of the reference count is zero.  For test systems, page_ref()
** is a real function so that we can set breakpoints and trace it.
*/
static void _page_ref(PgHdr *pPg){
  if( pPg->nRef==0 ){
    /* The page is currently on the freelist.  Remove it. */
    lruListRemove(pPg);
    pPg->pPager->nRef++;
  }
  pPg->nRef++;
}
#ifdef SQLITE_DEBUG
  static void page_ref(PgHdr *pPg){
    if( pPg->nRef==0 ){
      _page_ref(pPg);
    }else{
      pPg->nRef++;
    }
  }
#else
# define page_ref(P)   ((P)->nRef==0?_page_ref(P):(void)(P)->nRef++)
#endif

/*
** Increment the reference count for a page.  The input pointer is
** a reference to the page data.
*/
int sqlite3PagerRef(DbPage *pPg){
  pagerEnter(pPg->pPager);
  page_ref(pPg);
  pagerLeave(pPg->pPager);
  return SQLITE_OK;
}

/*
** Sync the journal.  In other words, make sure all the pages that have
** been written to the journal have actually reached the surface of the
** disk.  It is not safe to modify the original database file until after
** the journal has been synced.  If the original database is modified before
** the journal is synced and a power failure occurs, the unsynced journal
** data would be lost and we would be unable to completely rollback the
** database changes.  Database corruption would occur.
** 
** This routine also updates the nRec field in the header of the journal.
** (See comments on the pager_playback() routine for additional information.)
** If the sync mode is FULL, two syncs will occur.  First the whole journal
** is synced, then the nRec field is updated, then a second sync occurs.
**
** For temporary databases, we do not care if we are able to rollback
** after a power failure, so no sync occurs.
**
** If the IOCAP_SEQUENTIAL flag is set for the persistent media on which
** the database is stored, then OsSync() is never called on the journal
** file. In this case all that is required is to update the nRec field in
** the journal header.
**
** This routine clears the needSync field of every page current held in
** memory.
*/
static int syncJournal(Pager *pPager){
  PgHdr *pPg;
  int rc = SQLITE_OK;

  /* Sync the journal before modifying the main database
  ** (assuming there is a journal and it needs to be synced.)
  */
  if( pPager->needSync ){
    if( !pPager->tempFile ){
      int iDc = sqlite3OsDeviceCharacteristics(pPager->fd);
      assert( pPager->journalOpen );

      if( 0==(iDc&SQLITE_IOCAP_SAFE_APPEND) ){
        /* Write the nRec value into the journal file header. If in
        ** full-synchronous mode, sync the journal first. This ensures that
        ** all data has really hit the disk before nRec is updated to mark
        ** it as a candidate for rollback.
        **
        ** This is not required if the persistent media supports the
        ** SAFE_APPEND property. Because in this case it is not possible 
        ** for garbage data to be appended to the file, the nRec field
        ** is populated with 0xFFFFFFFF when the journal header is written
        ** and never needs to be updated.
        */
        i64 jrnlOff;
        if( pPager->fullSync && 0==(iDc&SQLITE_IOCAP_SEQUENTIAL) ){
          PAGERTRACE2("SYNC journal of %d\n", PAGERID(pPager));
          IOTRACE(("JSYNC %p\n", pPager))
          rc = sqlite3OsSync(pPager->jfd, pPager->sync_flags);
          if( rc!=0 ) return rc;
        }

        jrnlOff = pPager->journalHdr + sizeof(aJournalMagic);
        IOTRACE(("JHDR %p %lld %d\n", pPager, jrnlOff, 4));
        rc = write32bits(pPager->jfd, jrnlOff, pPager->nRec);
        if( rc ) return rc;
      }
      if( 0==(iDc&SQLITE_IOCAP_SEQUENTIAL) ){
        PAGERTRACE2("SYNC journal of %d\n", PAGERID(pPager));
        IOTRACE(("JSYNC %p\n", pPager))
        rc = sqlite3OsSync(pPager->jfd, pPager->sync_flags| 
          (pPager->sync_flags==SQLITE_SYNC_FULL?SQLITE_SYNC_DATAONLY:0)
        );
        if( rc!=0 ) return rc;
      }
      pPager->journalStarted = 1;
    }
    pPager->needSync = 0;

    /* Erase the needSync flag from every page.
    */
    for(pPg=pPager->pAll; pPg; pPg=pPg->pNextAll){
      pPg->needSync = 0;
    }
    lruListSetFirstSynced(pPager);
  }

#ifndef NDEBUG
  /* If the Pager.needSync flag is clear then the PgHdr.needSync
  ** flag must also be clear for all pages.  Verify that this
  ** invariant is true.
  */
  else{
    for(pPg=pPager->pAll; pPg; pPg=pPg->pNextAll){
      assert( pPg->needSync==0 );
    }
    assert( pPager->lru.pFirstSynced==pPager->lru.pFirst );
  }
#endif

  return rc;
}

/*
** Merge two lists of pages connected by pDirty and in pgno order.
** Do not both fixing the pPrevDirty pointers.
*/
static PgHdr *merge_pagelist(PgHdr *pA, PgHdr *pB){
  PgHdr result, *pTail;
  pTail = &result;
  while( pA && pB ){
    if( pA->pgno<pB->pgno ){
      pTail->pDirty = pA;
      pTail = pA;
      pA = pA->pDirty;
    }else{
      pTail->pDirty = pB;
      pTail = pB;
      pB = pB->pDirty;
    }
  }
  if( pA ){
    pTail->pDirty = pA;
  }else if( pB ){
    pTail->pDirty = pB;
  }else{
    pTail->pDirty = 0;
  }
  return result.pDirty;
}

/*
** Sort the list of pages in accending order by pgno.  Pages are
** connected by pDirty pointers.  The pPrevDirty pointers are
** corrupted by this sort.
*/
#define N_SORT_BUCKET_ALLOC 25
#define N_SORT_BUCKET       25
#ifdef SQLITE_TEST
  int sqlite3_pager_n_sort_bucket = 0;
  #undef N_SORT_BUCKET
  #define N_SORT_BUCKET \
   (sqlite3_pager_n_sort_bucket?sqlite3_pager_n_sort_bucket:N_SORT_BUCKET_ALLOC)
#endif
static PgHdr *sort_pagelist(PgHdr *pIn){
  PgHdr *a[N_SORT_BUCKET_ALLOC], *p;
  int i;
  memset(a, 0, sizeof(a));
  while( pIn ){
    p = pIn;
    pIn = p->pDirty;
    p->pDirty = 0;
    for(i=0; i<N_SORT_BUCKET-1; i++){
      if( a[i]==0 ){
        a[i] = p;
        break;
      }else{
        p = merge_pagelist(a[i], p);
        a[i] = 0;
      }
    }
    if( i==N_SORT_BUCKET-1 ){
      /* Coverage: To get here, there need to be 2^(N_SORT_BUCKET) 
      ** elements in the input list. This is possible, but impractical.
      ** Testing this line is the point of global variable
      ** sqlite3_pager_n_sort_bucket.
      */
      a[i] = merge_pagelist(a[i], p);
    }
  }
  p = a[0];
  for(i=1; i<N_SORT_BUCKET; i++){
    p = merge_pagelist(p, a[i]);
  }
  return p;
}

/*
** Given a list of pages (connected by the PgHdr.pDirty pointer) write
** every one of those pages out to the database file and mark them all
** as clean.
*/
static int pager_write_pagelist(PgHdr *pList){
  Pager *pPager;
  PgHdr *p;
  int rc;

  if( pList==0 ) return SQLITE_OK;
  pPager = pList->pPager;

  /* At this point there may be either a RESERVED or EXCLUSIVE lock on the
  ** database file. If there is already an EXCLUSIVE lock, the following
  ** calls to sqlite3OsLock() are no-ops.
  **
  ** Moving the lock from RESERVED to EXCLUSIVE actually involves going
  ** through an intermediate state PENDING.   A PENDING lock prevents new
  ** readers from attaching to the database but is unsufficient for us to
  ** write.  The idea of a PENDING lock is to prevent new readers from
  ** coming in while we wait for existing readers to clear.
  **
  ** While the pager is in the RESERVED state, the original database file
  ** is unchanged and we can rollback without having to playback the
  ** journal into the original database file.  Once we transition to
  ** EXCLUSIVE, it means the database file has been changed and any rollback
  ** will require a journal playback.
  */
  rc = pager_wait_on_lock(pPager, EXCLUSIVE_LOCK);
  if( rc!=SQLITE_OK ){
    return rc;
  }

  pList = sort_pagelist(pList);
  for(p=pList; p; p=p->pDirty){
    assert( p->dirty );
    p->dirty = 0;
  }
  while( pList ){

    /* If the file has not yet been opened, open it now. */
    if( !pPager->fd->pMethods ){
      assert(pPager->tempFile);
      rc = sqlite3PagerOpentemp(pPager, pPager->fd, pPager->vfsFlags);
      if( rc ) return rc;
    }

    /* If there are dirty pages in the page cache with page numbers greater
    ** than Pager.dbSize, this means sqlite3PagerTruncate() was called to
    ** make the file smaller (presumably by auto-vacuum code). Do not write
    ** any such pages to the file.
    */
    if( pList->pgno<=pPager->dbSize ){
      i64 offset = (pList->pgno-1)*(i64)pPager->pageSize;
      char *pData = CODEC2(pPager, PGHDR_TO_DATA(pList), pList->pgno, 6);
      PAGERTRACE4("STORE %d page %d hash(%08x)\n",
                   PAGERID(pPager), pList->pgno, pager_pagehash(pList));
      IOTRACE(("PGOUT %p %d\n", pPager, pList->pgno));
      rc = sqlite3OsWrite(pPager->fd, pData, pPager->pageSize, offset);
      PAGER_INCR(sqlite3_pager_writedb_count);
      PAGER_INCR(pPager->nWrite);
      if( pList->pgno==1 ){
        memcpy(&pPager->dbFileVers, &pData[24], sizeof(pPager->dbFileVers));
      }
    }
#ifndef NDEBUG
    else{
      PAGERTRACE3("NOSTORE %d page %d\n", PAGERID(pPager), pList->pgno);
    }
#endif
    if( rc ) return rc;
#ifdef SQLITE_CHECK_PAGES
    pList->pageHash = pager_pagehash(pList);
#endif
    pList = pList->pDirty;
  }
  return SQLITE_OK;
}

/*
** Collect every dirty page into a dirty list and
** return a pointer to the head of that list.  All pages are
** collected even if they are still in use.
*/
static PgHdr *pager_get_all_dirty_pages(Pager *pPager){

#ifndef NDEBUG
  /* Verify the sanity of the dirty list when we are running
  ** in debugging mode.  This is expensive, so do not
  ** do this on a normal build. */
  int n1 = 0;
  int n2 = 0;
  PgHdr *p;
  for(p=pPager->pAll; p; p=p->pNextAll){ if( p->dirty ) n1++; }
  for(p=pPager->pDirty; p; p=p->pDirty){ n2++; }
  assert( n1==n2 );
#endif

  return pPager->pDirty;
}

/*
** Return 1 if there is a hot journal on the given pager.
** A hot journal is one that needs to be played back.
**
** If the current size of the database file is 0 but a journal file
** exists, that is probably an old journal left over from a prior
** database with the same name.  Just delete the journal.
**
** Return negative if unable to determine the status of the journal.
**
** This routine does not open the journal file to examine its
** content.  Hence, the journal might contain the name of a master
** journal file that has been deleted, and hence not be hot.  Or
** the header of the journal might be zeroed out.  This routine
** does not discover these cases of a non-hot journal - if the
** journal file exists and is not empty this routine assumes it
** is hot.  The pager_playback() routine will discover that the
** journal file is not really hot and will no-op.
*/
static int hasHotJournal(Pager *pPager, int *pExists){
  sqlite3_vfs *pVfs = pPager->pVfs;
  int rc = SQLITE_OK;
  *pExists = 0;
  if( pPager->useJournal && pPager->fd->pMethods ){
    int exists;
    int locked;

    rc = sqlite3OsAccess(pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &exists);
    if( rc==SQLITE_OK && exists ){
      rc = sqlite3OsCheckReservedLock(pPager->fd, &locked);
    }

    if( rc==SQLITE_OK && exists && !locked ){
      int nPage;
      rc = sqlite3PagerPagecount(pPager, &nPage);
      if( rc==SQLITE_OK ){
        if( nPage==0 ){
          sqlite3OsDelete(pVfs, pPager->zJournal, 0);
        }else{
          *pExists = 1;
        }
      }
    }
  }

  return rc;
}

/*
** Try to find a page in the cache that can be recycled. 
**
** This routine may return SQLITE_IOERR, SQLITE_FULL or SQLITE_OK. It 
** does not set the pPager->errCode variable.
*/
static int pager_recycle(Pager *pPager, PgHdr **ppPg){
  PgHdr *pPg;
  *ppPg = 0;

  /* It is illegal to call this function unless the pager object
  ** pointed to by pPager has at least one free page (page with nRef==0).
  */ 
  assert(!MEMDB);
  assert(pPager->lru.pFirst);

  /* Find a page to recycle.  Try to locate a page that does not
  ** require us to do an fsync() on the journal.
  */
  pPg = pPager->lru.pFirstSynced;

  /* If we could not find a page that does not require an fsync()
  ** on the journal file then fsync the journal file.  This is a
  ** very slow operation, so we work hard to avoid it.  But sometimes
  ** it can't be helped.
  */
  if( pPg==0 && pPager->lru.pFirst ){
    if( !pPager->errCode ){
      int iDc = sqlite3OsDeviceCharacteristics(pPager->fd);
      int rc = syncJournal(pPager);
      if( rc!=0 ){
        return rc;
      }
      if( pPager->fullSync && 0==(iDc&SQLITE_IOCAP_SAFE_APPEND) ){
        /* If in full-sync mode, write a new journal header into the
        ** journal file. This is done to avoid ever modifying a journal
        ** header that is involved in the rollback of pages that have
        ** already been written to the database (in case the header is
        ** trashed when the nRec field is updated).
        */
        pPager->nRec = 0;
        assert( pPager->journalOff > 0 );
        assert( pPager->doNotSync==0 );
        rc = writeJournalHdr(pPager);
        if( rc!=0 ){
          return rc;
        }
      }
    }
    pPg = pPager->lru.pFirst;
  }

  assert( pPg->nRef==0 );

  /* Write the page to the database file if it is dirty.
  */
  if( pPg->dirty && !pPager->errCode ){
    int rc;
    assert( pPg->needSync==0 );
    makeClean(pPg);
    pPg->dirty = 1;
    pPg->pDirty = 0;
    rc = pager_write_pagelist( pPg );
    pPg->dirty = 0;
    if( rc!=SQLITE_OK ){
      return rc;
    }
  }
  assert( pPg->dirty==0 || pPager->errCode );

  /* If the page we are recycling is marked as alwaysRollback, then
  ** set the global alwaysRollback flag, thus disabling the
  ** sqlite3PagerDontRollback() optimization for the rest of this transaction.
  ** It is necessary to do this because the page marked alwaysRollback
  ** might be reloaded at a later time but at that point we won't remember
  ** that is was marked alwaysRollback.  This means that all pages must
  ** be marked as alwaysRollback from here on out.
  */
  if( pPg->alwaysRollback ){
    IOTRACE(("ALWAYS_ROLLBACK %p\n", pPager))
    pPager->alwaysRollback = 1;
  }

  /* Unlink the old page from the free list and the hash table
  */
  unlinkPage(pPg);
  assert( pPg->pgno==0 );

  *ppPg = pPg;
  return SQLITE_OK;
}

#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
/*
** This function is called to free superfluous dynamically allocated memory
** held by the pager system. Memory in use by any SQLite pager allocated
** by the current thread may be sqlite3_free()ed.
**
** nReq is the number of bytes of memory required. Once this much has
** been released, the function returns. The return value is the total number 
** of bytes of memory released.
*/
int sqlite3PagerReleaseMemory(int nReq){
  int nReleased = 0;          /* Bytes of memory released so far */
  Pager *pPager;              /* For looping over pagers */
  BusyHandler *savedBusy;     /* Saved copy of the busy handler */
  int rc = SQLITE_OK;

  /* Acquire the memory-management mutex
  */
#ifndef SQLITE_MUTEX_NOOP
  sqlite3_mutex *mutex;       /* The MEM2 mutex */
  mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM2);
#endif
  sqlite3_mutex_enter(mutex);

  /* Signal all database connections that memory management wants
  ** to have access to the pagers.
  */
  for(pPager=sqlite3PagerList; pPager; pPager=pPager->pNext){
     pPager->iInUseMM = 1;
  }

  while( rc==SQLITE_OK && (nReq<0 || nReleased<nReq) ){
    PgHdr *pPg;
    PgHdr *pRecycled;
 
    /* Try to find a page to recycle that does not require a sync(). If
    ** this is not possible, find one that does require a sync().
    */
    sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU));
    pPg = sqlite3LruPageList.pFirstSynced;
    while( pPg && (pPg->needSync || pPg->pPager->iInUseDB) ){
      pPg = pPg->gfree.pNext;
    }
    if( !pPg ){
      pPg = sqlite3LruPageList.pFirst;
      while( pPg && pPg->pPager->iInUseDB ){
        pPg = pPg->gfree.pNext;
      }
    }
    sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU));

    /* If pPg==0, then the block above has failed to find a page to
    ** recycle. In this case return early - no further memory will
    ** be released.
    */
    if( !pPg ) break;

    pPager = pPg->pPager;
    assert(!pPg->needSync || pPg==pPager->lru.pFirst);
    assert(pPg->needSync || pPg==pPager->lru.pFirstSynced);
  
    savedBusy = pPager->pBusyHandler;
    pPager->pBusyHandler = 0;
    rc = pager_recycle(pPager, &pRecycled);
    pPager->pBusyHandler = savedBusy;
    assert(pRecycled==pPg || rc!=SQLITE_OK);
    if( rc==SQLITE_OK ){
      /* We've found a page to free. At this point the page has been 
      ** removed from the page hash-table, free-list and synced-list 
      ** (pFirstSynced). It is still in the all pages (pAll) list. 
      ** Remove it from this list before freeing.
      **
      ** Todo: Check the Pager.pStmt list to make sure this is Ok. It 
      ** probably is though.
      */
      PgHdr *pTmp;
      assert( pPg );
      if( pPg==pPager->pAll ){
         assert(pPg->pPrevAll==0);
         assert(pPg->pNextAll==0 || pPg->pNextAll->pPrevAll==pPg);
         pPager->pAll = pPg->pNextAll;
         if( pPager->pAll ){
           pPager->pAll->pPrevAll = 0;
         }
      }else{
         assert(pPg->pPrevAll);
         assert(pPg->pPrevAll->pNextAll==pPg);
         pTmp = pPg->pPrevAll;
         pTmp->pNextAll = pPg->pNextAll;
         if( pTmp->pNextAll ){
           pTmp->pNextAll->pPrevAll = pTmp;
         }
      }
      nReleased += (
          sizeof(*pPg) + pPager->pageSize
          + sizeof(u32) + pPager->nExtra
          + MEMDB*sizeof(PgHistory) 
      );
      IOTRACE(("PGFREE %p %d *\n", pPager, pPg->pgno));
      PAGER_INCR(sqlite3_pager_pgfree_count);
      sqlite3PageFree(pPg->pData);
      sqlite3_free(pPg);
      pPager->nPage--;
    }else{
      /* An error occured whilst writing to the database file or 
      ** journal in pager_recycle(). The error is not returned to the 
      ** caller of this function. Instead, set the Pager.errCode variable.
      ** The error will be returned to the user (or users, in the case 
      ** of a shared pager cache) of the pager for which the error occured.
      */
      assert(
          (rc&0xff)==SQLITE_IOERR ||
          rc==SQLITE_FULL ||
          rc==SQLITE_BUSY
      );
      assert( pPager->state>=PAGER_RESERVED );
      pager_error(pPager, rc);
    }
  }

  /* Clear the memory management flags and release the mutex
  */
  for(pPager=sqlite3PagerList; pPager; pPager=pPager->pNext){
     pPager->iInUseMM = 0;
  }
  sqlite3_mutex_leave(mutex);

  /* Return the number of bytes released
  */
  return nReleased;
}
#endif /* SQLITE_ENABLE_MEMORY_MANAGEMENT */

/*
** Read the content of page pPg out of the database file.
*/
static int readDbPage(Pager *pPager, PgHdr *pPg, Pgno pgno){
  int rc;
  i64 offset;
  assert( MEMDB==0 );
  assert(pPager->fd->pMethods||pPager->tempFile);
  if( !pPager->fd->pMethods ){
    return SQLITE_IOERR_SHORT_READ;
  }
  offset = (pgno-1)*(i64)pPager->pageSize;
  rc = sqlite3OsRead(pPager->fd, PGHDR_TO_DATA(pPg), pPager->pageSize, offset);
  PAGER_INCR(sqlite3_pager_readdb_count);
  PAGER_INCR(pPager->nRead);
  IOTRACE(("PGIN %p %d\n", pPager, pgno));
  if( pgno==1 ){
    memcpy(&pPager->dbFileVers, &((u8*)PGHDR_TO_DATA(pPg))[24],
                                              sizeof(pPager->dbFileVers));
  }
  CODEC1(pPager, PGHDR_TO_DATA(pPg), pPg->pgno, 3);
  PAGERTRACE4("FETCH %d page %d hash(%08x)\n",
               PAGERID(pPager), pPg->pgno, pager_pagehash(pPg));
  return rc;
}


/*
** This function is called to obtain the shared lock required before
** data may be read from the pager cache. If the shared lock has already
** been obtained, this function is a no-op.
**
** Immediately after obtaining the shared lock (if required), this function
** checks for a hot-journal file. If one is found, an emergency rollback
** is performed immediately.
*/
static int pagerSharedLock(Pager *pPager){
  int rc = SQLITE_OK;
  int isErrorReset = 0;

  /* If this database is opened for exclusive access, has no outstanding 
  ** page references and is in an error-state, now is the chance to clear
  ** the error. Discard the contents of the pager-cache and treat any
  ** open journal file as a hot-journal.
  */
  if( !MEMDB && pPager->exclusiveMode && pPager->nRef==0 && pPager->errCode ){
    if( pPager->journalOpen ){
      isErrorReset = 1;
    }
    pPager->errCode = SQLITE_OK;
    pager_reset(pPager);
  }

  /* If the pager is still in an error state, do not proceed. The error 
  ** state will be cleared at some point in the future when all page 
  ** references are dropped and the cache can be discarded.
  */
  if( pPager->errCode && pPager->errCode!=SQLITE_FULL ){
    return pPager->errCode;
  }

  if( pPager->state==PAGER_UNLOCK || isErrorReset ){
    sqlite3_vfs *pVfs = pPager->pVfs;
    if( !MEMDB ){
      int isHotJournal;
      assert( pPager->nRef==0 );
      if( !pPager->noReadlock ){
        rc = pager_wait_on_lock(pPager, SHARED_LOCK);
        if( rc!=SQLITE_OK ){
          assert( pPager->state==PAGER_UNLOCK );
          return pager_error(pPager, rc);
        }
        assert( pPager->state>=SHARED_LOCK );
      }
  
      /* If a journal file exists, and there is no RESERVED lock on the
      ** database file, then it either needs to be played back or deleted.
      */
      if( !isErrorReset ){
        rc = hasHotJournal(pPager, &isHotJournal);
        if( rc!=SQLITE_OK ){
          goto failed;
        }
      }
      if( isErrorReset || isHotJournal ){
        /* Get an EXCLUSIVE lock on the database file. At this point it is
        ** important that a RESERVED lock is not obtained on the way to the
        ** EXCLUSIVE lock. If it were, another process might open the
        ** database file, detect the RESERVED lock, and conclude that the
        ** database is safe to read while this process is still rolling it 
        ** back.
        ** 
        ** Because the intermediate RESERVED lock is not requested, the
        ** second process will get to this point in the code and fail to
        ** obtain its own EXCLUSIVE lock on the database file.
        */
        if( pPager->state<EXCLUSIVE_LOCK ){
          rc = sqlite3OsLock(pPager->fd, EXCLUSIVE_LOCK);
          if( rc!=SQLITE_OK ){
            rc = pager_error(pPager, rc);
            goto failed;
          }
          pPager->state = PAGER_EXCLUSIVE;
        }
 
        /* Open the journal for read/write access. This is because in 
        ** exclusive-access mode the file descriptor will be kept open and
        ** possibly used for a transaction later on. On some systems, the
        ** OsTruncate() call used in exclusive-access mode also requires
        ** a read/write file handle.
        */
        if( !isErrorReset && pPager->journalOpen==0 ){
          int res;
          rc = sqlite3OsAccess(pVfs,pPager->zJournal,SQLITE_ACCESS_EXISTS,&res);
          if( rc==SQLITE_OK ){
            if( res ){
              int fout = 0;
              int f = SQLITE_OPEN_READWRITE|SQLITE_OPEN_MAIN_JOURNAL;
              assert( !pPager->tempFile );
              rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &fout);
              assert( rc!=SQLITE_OK || pPager->jfd->pMethods );
              if( fout&SQLITE_OPEN_READONLY ){
                rc = SQLITE_BUSY;
                sqlite3OsClose(pPager->jfd);
              }
            }else{
              /* If the journal does not exist, that means some other process
              ** has already rolled it back */
              rc = SQLITE_BUSY;
            }
          }
        }
        if( rc!=SQLITE_OK ){
          if( rc!=SQLITE_NOMEM && rc!=SQLITE_IOERR_UNLOCK 
           && rc!=SQLITE_IOERR_NOMEM 
          ){
            rc = SQLITE_BUSY;
          }
          goto failed;
        }
        pPager->journalOpen = 1;
        pPager->journalStarted = 0;
        pPager->journalOff = 0;
        pPager->setMaster = 0;
        pPager->journalHdr = 0;
 
        /* Playback and delete the journal.  Drop the database write
        ** lock and reacquire the read lock.
        */
        rc = pager_playback(pPager, 1);
        if( rc!=SQLITE_OK ){
          rc = pager_error(pPager, rc);
          goto failed;
        }
        assert(pPager->state==PAGER_SHARED || 
            (pPager->exclusiveMode && pPager->state>PAGER_SHARED)
        );
      }

      if( pPager->pAll ){
        /* The shared-lock has just been acquired on the database file
        ** and there are already pages in the cache (from a previous
        ** read or write transaction).  Check to see if the database
        ** has been modified.  If the database has changed, flush the
        ** cache.
        **
        ** Database changes is detected by looking at 15 bytes beginning
        ** at offset 24 into the file.  The first 4 of these 16 bytes are
        ** a 32-bit counter that is incremented with each change.  The
        ** other bytes change randomly with each file change when
        ** a codec is in use.
        ** 
        ** There is a vanishingly small chance that a change will not be 
        ** detected.  The chance of an undetected change is so small that
        ** it can be neglected.
        */
        char dbFileVers[sizeof(pPager->dbFileVers)];
        sqlite3PagerPagecount(pPager, 0);

        if( pPager->errCode ){
          rc = pPager->errCode;
          goto failed;
        }

        if( pPager->dbSize>0 ){
          IOTRACE(("CKVERS %p %d\n", pPager, sizeof(dbFileVers)));
          rc = sqlite3OsRead(pPager->fd, &dbFileVers, sizeof(dbFileVers), 24);
          if( rc!=SQLITE_OK ){
            goto failed;
          }
        }else{
          memset(dbFileVers, 0, sizeof(dbFileVers));
        }

        if( memcmp(pPager->dbFileVers, dbFileVers, sizeof(dbFileVers))!=0 ){
          pager_reset(pPager);
        }
      }
    }
    assert( pPager->exclusiveMode || pPager->state<=PAGER_SHARED );
    if( pPager->state==PAGER_UNLOCK ){
      pPager->state = PAGER_SHARED;
    }
  }

 failed:
  if( rc!=SQLITE_OK ){
    /* pager_unlock() is a no-op for exclusive mode and in-memory databases. */
    pager_unlock(pPager);
  }
  return rc;
}

/*
** Allocate a PgHdr object.   Either create a new one or reuse
** an existing one that is not otherwise in use.
**
** A new PgHdr structure is created if any of the following are
** true:
**
**     (1)  We have not exceeded our maximum allocated cache size
**          as set by the "PRAGMA cache_size" command.
**
**     (2)  There are no unused PgHdr objects available at this time.
**
**     (3)  This is an in-memory database.
**
**     (4)  There are no PgHdr objects that do not require a journal
**          file sync and a sync of the journal file is currently
**          prohibited.
**
** Otherwise, reuse an existing PgHdr.  In other words, reuse an
** existing PgHdr if all of the following are true:
**
**     (1)  We have reached or exceeded the maximum cache size
**          allowed by "PRAGMA cache_size".
**
**     (2)  There is a PgHdr available with PgHdr->nRef==0
**
**     (3)  We are not in an in-memory database
**
**     (4)  Either there is an available PgHdr that does not need
**          to be synced to disk or else disk syncing is currently
**          allowed.
*/
static int pagerAllocatePage(Pager *pPager, PgHdr **ppPg){
  int rc = SQLITE_OK;
  PgHdr *pPg;
  int nByteHdr;

  /* Create a new PgHdr if any of the four conditions defined 
  ** above are met: */
  if( pPager->nPage<pPager->mxPage
   || pPager->lru.pFirst==0 
   || MEMDB
   || (pPager->lru.pFirstSynced==0 && pPager->doNotSync)
  ){
    void *pData;
    if( pPager->nPage>=pPager->nHash ){
      pager_resize_hash_table(pPager,
         pPager->nHash<256 ? 256 : pPager->nHash*2);
      if( pPager->nHash==0 ){
        rc = SQLITE_NOMEM;
        goto pager_allocate_out;
      }
    }
    pagerLeave(pPager);
    nByteHdr = sizeof(*pPg) + sizeof(u32) + pPager->nExtra
              + MEMDB*sizeof(PgHistory);
    pPg = sqlite3Malloc( nByteHdr );
    if( pPg ){
      pData = sqlite3PageMalloc( pPager->pageSize );
      if( pData==0 ){
        sqlite3_free(pPg);
        pPg = 0;
      }
    }
    pagerEnter(pPager);
    if( pPg==0 ){
      rc = SQLITE_NOMEM;
      goto pager_allocate_out;
    }
    memset(pPg, 0, nByteHdr);
    pPg->pData = pData;
    pPg->pPager = pPager;
    pPg->pNextAll = pPager->pAll;
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
    if( pPg->pNextAll ){
      pPg->pNextAll->pPrevAll = pPg;
    }
#endif
    pPager->pAll = pPg;
    pPager->nPage++;
  }else{
    /* Recycle an existing page with a zero ref-count. */
    rc = pager_recycle(pPager, &pPg);
    if( rc==SQLITE_BUSY ){
      rc = SQLITE_IOERR_BLOCKED;
    }
    if( rc!=SQLITE_OK ){
      goto pager_allocate_out;
    }
    assert( pPager->state>=SHARED_LOCK );
    assert(pPg);
  }
  *ppPg = pPg;

pager_allocate_out:
  return rc;
}

/*
** Make sure we have the content for a page.  If the page was
** previously acquired with noContent==1, then the content was
** just initialized to zeros instead of being read from disk.
** But now we need the real data off of disk.  So make sure we
** have it.  Read it in if we do not have it already.
*/
static int pager_get_content(PgHdr *pPg){
  if( pPg->needRead ){
    int rc = readDbPage(pPg->pPager, pPg, pPg->pgno);
    if( rc==SQLITE_OK ){
      pPg->needRead = 0;
    }else{
      return rc;
    }
  }
  return SQLITE_OK;
}

/*
** Acquire a page.
**
** A read lock on the disk file is obtained when the first page is acquired. 
** This read lock is dropped when the last page is released.
**
** This routine works for any page number greater than 0.  If the database
** file is smaller than the requested page, then no actual disk
** read occurs and the memory image of the page is initialized to
** all zeros.  The extra data appended to a page is always initialized
** to zeros the first time a page is loaded into memory.
**
** The acquisition might fail for several reasons.  In all cases,
** an appropriate error code is returned and *ppPage is set to NULL.
**
** See also sqlite3PagerLookup().  Both this routine and Lookup() attempt
** to find a page in the in-memory cache first.  If the page is not already
** in memory, this routine goes to disk to read it in whereas Lookup()
** just returns 0.  This routine acquires a read-lock the first time it
** has to go to disk, and could also playback an old journal if necessary.
** Since Lookup() never goes to disk, it never has to deal with locks
** or journal files.
**
** If noContent is false, the page contents are actually read from disk.
** If noContent is true, it means that we do not care about the contents
** of the page at this time, so do not do a disk read.  Just fill in the
** page content with zeros.  But mark the fact that we have not read the
** content by setting the PgHdr.needRead flag.  Later on, if 
** sqlite3PagerWrite() is called on this page or if this routine is
** called again with noContent==0, that means that the content is needed
** and the disk read should occur at that point.
*/
static int pagerAcquire(
  Pager *pPager,      /* The pager open on the database file */
  Pgno pgno,          /* Page number to fetch */
  DbPage **ppPage,    /* Write a pointer to the page here */
  int noContent       /* Do not bother reading content from disk if true */
){
  PgHdr *pPg;
  int rc;

  assert( pPager->state==PAGER_UNLOCK || pPager->nRef>0 || pgno==1 );

  /* The maximum page number is 2^31. Return SQLITE_CORRUPT if a page
  ** number greater than this, or zero, is requested.
  */
  if( pgno>PAGER_MAX_PGNO || pgno==0 || pgno==PAGER_MJ_PGNO(pPager) ){
    return SQLITE_CORRUPT_BKPT;
  }

  /* Make sure we have not hit any critical errors.
  */ 
  assert( pPager!=0 );
  *ppPage = 0;

  /* If this is the first page accessed, then get a SHARED lock
  ** on the database file. pagerSharedLock() is a no-op if 
  ** a database lock is already held.
  */
  rc = pagerSharedLock(pPager);
  if( rc!=SQLITE_OK ){
    return rc;
  }
  assert( pPager->state!=PAGER_UNLOCK );

  pPg = pager_lookup(pPager, pgno);
  if( pPg==0 ){
    /* The requested page is not in the page cache. */
    int nMax;
    int h;
    PAGER_INCR(pPager->nMiss);
    rc = pagerAllocatePage(pPager, &pPg);
    if( rc!=SQLITE_OK ){
      return rc;
    }

    pPg->pgno = pgno;
    assert( !MEMDB || pgno>pPager->stmtSize );
    pPg->inJournal = sqlite3BitvecTest(pPager->pInJournal, pgno);
    pPg->needSync = 0;

    makeClean(pPg);
    pPg->nRef = 1;

    pPager->nRef++;
    if( pPager->nExtra>0 ){
      memset(PGHDR_TO_EXTRA(pPg, pPager), 0, pPager->nExtra);
    }
    rc = sqlite3PagerPagecount(pPager, &nMax);
    if( rc!=SQLITE_OK ){
      sqlite3PagerUnref(pPg);
      return rc;
    }

    /* Populate the page with data, either by reading from the database
    ** file, or by setting the entire page to zero.
    */
    if( nMax<(int)pgno || MEMDB || (noContent && !pPager->alwaysRollback) ){
      if( pgno>pPager->mxPgno ){
        sqlite3PagerUnref(pPg);
        return SQLITE_FULL;
      }
      memset(PGHDR_TO_DATA(pPg), 0, pPager->pageSize);
      pPg->needRead = noContent && !pPager->alwaysRollback;
      IOTRACE(("ZERO %p %d\n", pPager, pgno));
    }else{
      rc = readDbPage(pPager, pPg, pgno);
      if( rc!=SQLITE_OK && rc!=SQLITE_IOERR_SHORT_READ ){
        pPg->pgno = 0;
        sqlite3PagerUnref(pPg);
        return rc;
      }
      pPg->needRead = 0;
    }

    /* Link the page into the page hash table */
    h = pgno & (pPager->nHash-1);
    assert( pgno!=0 );
    pPg->pNextHash = pPager->aHash[h];
    pPager->aHash[h] = pPg;
    if( pPg->pNextHash ){
      assert( pPg->pNextHash->pPrevHash==0 );
      pPg->pNextHash->pPrevHash = pPg;
    }

#ifdef SQLITE_CHECK_PAGES
    pPg->pageHash = pager_pagehash(pPg);
#endif
  }else{
    /* The requested page is in the page cache. */
    assert(pPager->nRef>0 || pgno==1);
    PAGER_INCR(pPager->nHit);
    if( !noContent ){
      rc = pager_get_content(pPg);
      if( rc ){
        return rc;
      }
    }
    page_ref(pPg);
  }
  *ppPage = pPg;
  return SQLITE_OK;
}
int sqlite3PagerAcquire(
  Pager *pPager,      /* The pager open on the database file */
  Pgno pgno,          /* Page number to fetch */
  DbPage **ppPage,    /* Write a pointer to the page here */
  int noContent       /* Do not bother reading content from disk if true */
){
  int rc;
  pagerEnter(pPager);
  rc = pagerAcquire(pPager, pgno, ppPage, noContent);
  pagerLeave(pPager);
  return rc;
}


/*
** Acquire a page if it is already in the in-memory cache.  Do
** not read the page from disk.  Return a pointer to the page,
** or 0 if the page is not in cache.
**
** See also sqlite3PagerGet().  The difference between this routine
** and sqlite3PagerGet() is that _get() will go to the disk and read
** in the page if the page is not already in cache.  This routine
** returns NULL if the page is not in cache or if a disk I/O error 
** has ever happened.
*/
DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){
  PgHdr *pPg = 0;

  assert( pPager!=0 );
  assert( pgno!=0 );

  pagerEnter(pPager);
  if( pPager->state==PAGER_UNLOCK ){
    assert( !pPager->pAll || pPager->exclusiveMode );
  }else if( pPager->errCode && pPager->errCode!=SQLITE_FULL ){
    /* Do nothing */
  }else if( (pPg = pager_lookup(pPager, pgno))!=0 ){
    page_ref(pPg);
  }
  pagerLeave(pPager);
  return pPg;
}

/*
** Release a page.
**
** If the number of references to the page drop to zero, then the
** page is added to the LRU list.  When all references to all pages
** are released, a rollback occurs and the lock on the database is
** removed.
*/
int sqlite3PagerUnref(DbPage *pPg){
  Pager *pPager;

  if( pPg==0 ) return SQLITE_OK;
  pPager = pPg->pPager;

  /* Decrement the reference count for this page
  */
  assert( pPg->nRef>0 );
  pagerEnter(pPg->pPager);
  pPg->nRef--;

  CHECK_PAGE(pPg);

  /* When the number of references to a page reach 0, call the
  ** destructor and add the page to the freelist.
  */
  if( pPg->nRef==0 ){

    lruListAdd(pPg);
    if( pPager->xDestructor ){
      pPager->xDestructor(pPg, pPager->pageSize);
    }
  
    /* When all pages reach the freelist, drop the read lock from
    ** the database file.
    */
    pPager->nRef--;
    assert( pPager->nRef>=0 );
    if( pPager->nRef==0 && (!pPager->exclusiveMode || pPager->journalOff>0) ){
      pagerUnlockAndRollback(pPager);
    }
  }
  pagerLeave(pPager);
  return SQLITE_OK;
}

/*
** Create a journal file for pPager.  There should already be a RESERVED
** or EXCLUSIVE lock on the database file when this routine is called.
**
** Return SQLITE_OK if everything.  Return an error code and release the
** write lock if anything goes wrong.
*/
static int pager_open_journal(Pager *pPager){
  sqlite3_vfs *pVfs = pPager->pVfs;
  int flags = (SQLITE_OPEN_READWRITE|SQLITE_OPEN_EXCLUSIVE|SQLITE_OPEN_CREATE);

  int rc;
  assert( !MEMDB );
  assert( pPager->state>=PAGER_RESERVED );
  assert( pPager->useJournal );
  assert( pPager->pInJournal==0 );
  sqlite3PagerPagecount(pPager, 0);
  pagerLeave(pPager);
  pPager->pInJournal = sqlite3BitvecCreate(pPager->dbSize);
  pagerEnter(pPager);
  if( pPager->pInJournal==0 ){
    rc = SQLITE_NOMEM;
    goto failed_to_open_journal;
  }

  if( pPager->journalOpen==0 ){
    if( pPager->tempFile ){
      flags |= (SQLITE_OPEN_DELETEONCLOSE|SQLITE_OPEN_TEMP_JOURNAL);
    }else{
      flags |= (SQLITE_OPEN_MAIN_JOURNAL);
    }
#ifdef SQLITE_ENABLE_ATOMIC_WRITE
    rc = sqlite3JournalOpen(
        pVfs, pPager->zJournal, pPager->jfd, flags, jrnlBufferSize(pPager)
    );
#else
    rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, flags, 0);
#endif
    assert( rc!=SQLITE_OK || pPager->jfd->pMethods );
    pPager->journalOff = 0;
    pPager->setMaster = 0;
    pPager->journalHdr = 0;
    if( rc!=SQLITE_OK ){
      if( rc==SQLITE_NOMEM ){
        sqlite3OsDelete(pVfs, pPager->zJournal, 0);
      }
      goto failed_to_open_journal;
    }
  }
  pPager->journalOpen = 1;
  pPager->journalStarted = 0;
  pPager->needSync = 0;
  pPager->alwaysRollback = 0;
  pPager->nRec = 0;
  if( pPager->errCode ){
    rc = pPager->errCode;
    goto failed_to_open_journal;
  }
  pPager->origDbSize = pPager->dbSize;

  rc = writeJournalHdr(pPager);

  if( pPager->stmtAutoopen && rc==SQLITE_OK ){
    rc = sqlite3PagerStmtBegin(pPager);
  }
  if( rc!=SQLITE_OK && rc!=SQLITE_NOMEM && rc!=SQLITE_IOERR_NOMEM ){
    rc = pager_end_transaction(pPager, 0);
    if( rc==SQLITE_OK ){
      rc = SQLITE_FULL;
    }
  }
  return rc;

failed_to_open_journal:
  sqlite3BitvecDestroy(pPager->pInJournal);
  pPager->pInJournal = 0;
  return rc;
}

/*
** Acquire a write-lock on the database.  The lock is removed when
** the any of the following happen:
**
**   *  sqlite3PagerCommitPhaseTwo() is called.
**   *  sqlite3PagerRollback() is called.
**   *  sqlite3PagerClose() is called.
**   *  sqlite3PagerUnref() is called to on every outstanding page.
**
** The first parameter to this routine is a pointer to any open page of the
** database file.  Nothing changes about the page - it is used merely to
** acquire a pointer to the Pager structure and as proof that there is
** already a read-lock on the database.
**
** The second parameter indicates how much space in bytes to reserve for a
** master journal file-name at the start of the journal when it is created.
**
** A journal file is opened if this is not a temporary file.  For temporary
** files, the opening of the journal file is deferred until there is an
** actual need to write to the journal.
**
** If the database is already reserved for writing, this routine is a no-op.
**
** If exFlag is true, go ahead and get an EXCLUSIVE lock on the file
** immediately instead of waiting until we try to flush the cache.  The
** exFlag is ignored if a transaction is already active.
*/
int sqlite3PagerBegin(DbPage *pPg, int exFlag){
  Pager *pPager = pPg->pPager;
  int rc = SQLITE_OK;
  pagerEnter(pPager);
  assert( pPg->nRef>0 );
  assert( pPager->state!=PAGER_UNLOCK );
  if( pPager->state==PAGER_SHARED ){
    assert( pPager->pInJournal==0 );
    if( MEMDB ){
      pPager->state = PAGER_EXCLUSIVE;
      pPager->origDbSize = pPager->dbSize;
    }else{
      rc = sqlite3OsLock(pPager->fd, RESERVED_LOCK);
      if( rc==SQLITE_OK ){
        pPager->state = PAGER_RESERVED;
        if( exFlag ){
          rc = pager_wait_on_lock(pPager, EXCLUSIVE_LOCK);
        }
      }
      if( rc!=SQLITE_OK ){
        pagerLeave(pPager);
        return rc;
      }
      pPager->dirtyCache = 0;
      PAGERTRACE2("TRANSACTION %d\n", PAGERID(pPager));
      if( pPager->useJournal && !pPager->tempFile
             && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){
        rc = pager_open_journal(pPager);
      }
    }
  }else if( pPager->journalOpen && pPager->journalOff==0 ){
    /* This happens when the pager was in exclusive-access mode the last
    ** time a (read or write) transaction was successfully concluded
    ** by this connection. Instead of deleting the journal file it was 
    ** kept open and either was truncated to 0 bytes or its header was
    ** overwritten with zeros.
    */
    assert( pPager->nRec==0 );
    assert( pPager->origDbSize==0 );
    assert( pPager->pInJournal==0 );
    sqlite3PagerPagecount(pPager, 0);
    pagerLeave(pPager);
    pPager->pInJournal = sqlite3BitvecCreate( pPager->dbSize );
    pagerEnter(pPager);
    if( !pPager->pInJournal ){
      rc = SQLITE_NOMEM;
    }else{
      pPager->origDbSize = pPager->dbSize;
      rc = writeJournalHdr(pPager);
    }
  }
  assert( !pPager->journalOpen || pPager->journalOff>0 || rc!=SQLITE_OK );
  pagerLeave(pPager);
  return rc;
}

/*
** Make a page dirty.  Set its dirty flag and add it to the dirty
** page list.
*/
static void makeDirty(PgHdr *pPg){
  if( pPg->dirty==0 ){
    Pager *pPager = pPg->pPager;
    pPg->dirty = 1;
    pPg->pDirty = pPager->pDirty;
    if( pPager->pDirty ){
      pPager->pDirty->pPrevDirty = pPg;
    }
    pPg->pPrevDirty = 0;
    pPager->pDirty = pPg;
  }
}

/*
** Make a page clean.  Clear its dirty bit and remove it from the
** dirty page list.
*/
static void makeClean(PgHdr *pPg){
  if( pPg->dirty ){
    pPg->dirty = 0;
    if( pPg->pDirty ){
      assert( pPg->pDirty->pPrevDirty==pPg );
      pPg->pDirty->pPrevDirty = pPg->pPrevDirty;
    }
    if( pPg->pPrevDirty ){
      assert( pPg->pPrevDirty->pDirty==pPg );
      pPg->pPrevDirty->pDirty = pPg->pDirty;
    }else{
      assert( pPg->pPager->pDirty==pPg );
      pPg->pPager->pDirty = pPg->pDirty;
    }
  }
}


/*
** Mark a data page as writeable.  The page is written into the journal 
** if it is not there already.  This routine must be called before making
** changes to a page.
**
** The first time this routine is called, the pager creates a new
** journal and acquires a RESERVED lock on the database.  If the RESERVED
** lock could not be acquired, this routine returns SQLITE_BUSY.  The
** calling routine must check for that return value and be careful not to
** change any page data until this routine returns SQLITE_OK.
**
** If the journal file could not be written because the disk is full,
** then this routine returns SQLITE_FULL and does an immediate rollback.
** All subsequent write attempts also return SQLITE_FULL until there
** is a call to sqlite3PagerCommit() or sqlite3PagerRollback() to
** reset.
*/
static int pager_write(PgHdr *pPg){
  void *pData = PGHDR_TO_DATA(pPg);
  Pager *pPager = pPg->pPager;
  int rc = SQLITE_OK;

  /* Check for errors
  */
  if( pPager->errCode ){ 
    return pPager->errCode;
  }
  if( pPager->readOnly ){
    return SQLITE_PERM;
  }

  assert( !pPager->setMaster );

  CHECK_PAGE(pPg);

  /* If this page was previously acquired with noContent==1, that means
  ** we didn't really read in the content of the page.  This can happen
  ** (for example) when the page is being moved to the freelist.  But
  ** now we are (perhaps) moving the page off of the freelist for
  ** reuse and we need to know its original content so that content
  ** can be stored in the rollback journal.  So do the read at this
  ** time.
  */
  rc = pager_get_content(pPg);
  if( rc ){
    return rc;
  }

  /* Mark the page as dirty.  If the page has already been written
  ** to the journal then we can return right away.
  */
  makeDirty(pPg);
  if( pPg->inJournal && (pageInStatement(pPg) || pPager->stmtInUse==0) ){
    pPager->dirtyCache = 1;
    pPager->dbModified = 1;
  }else{

    /* If we get this far, it means that the page needs to be
    ** written to the transaction journal or the ckeckpoint journal
    ** or both.
    **
    ** First check to see that the transaction journal exists and
    ** create it if it does not.
    */
    assert( pPager->state!=PAGER_UNLOCK );
    rc = sqlite3PagerBegin(pPg, 0);
    if( rc!=SQLITE_OK ){
      return rc;
    }
    assert( pPager->state>=PAGER_RESERVED );
    if( !pPager->journalOpen && pPager->useJournal
          && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){
      rc = pager_open_journal(pPager);
      if( rc!=SQLITE_OK ) return rc;
    }
    pPager->dirtyCache = 1;
    pPager->dbModified = 1;
  
    /* The transaction journal now exists and we have a RESERVED or an
    ** EXCLUSIVE lock on the main database file.  Write the current page to
    ** the transaction journal if it is not there already.
    */
    if( !pPg->inJournal && (pPager->journalOpen || MEMDB) ){
      if( (int)pPg->pgno <= pPager->origDbSize ){
        if( MEMDB ){
          PgHistory *pHist = PGHDR_TO_HIST(pPg, pPager);
          PAGERTRACE3("JOURNAL %d page %d\n", PAGERID(pPager), pPg->pgno);
          assert( pHist->pOrig==0 );
          pHist->pOrig = sqlite3PageMalloc( pPager->pageSize );
          if( !pHist->pOrig ){
            return SQLITE_NOMEM;
          }
          memcpy(pHist->pOrig, PGHDR_TO_DATA(pPg), pPager->pageSize);
        }else{
          u32 cksum;
          char *pData2;

          /* We should never write to the journal file the page that
          ** contains the database locks.  The following assert verifies
          ** that we do not. */
          assert( pPg->pgno!=PAGER_MJ_PGNO(pPager) );
          pData2 = CODEC2(pPager, pData, pPg->pgno, 7);
          cksum = pager_cksum(pPager, (u8*)pData2);
          rc = write32bits(pPager->jfd, pPager->journalOff, pPg->pgno);
          if( rc==SQLITE_OK ){
            rc = sqlite3OsWrite(pPager->jfd, pData2, pPager->pageSize,
                                pPager->journalOff + 4);
            pPager->journalOff += pPager->pageSize+4;
          }
          if( rc==SQLITE_OK ){
            rc = write32bits(pPager->jfd, pPager->journalOff, cksum);
            pPager->journalOff += 4;
          }
          IOTRACE(("JOUT %p %d %lld %d\n", pPager, pPg->pgno, 
                   pPager->journalOff, pPager->pageSize));
          PAGER_INCR(sqlite3_pager_writej_count);
          PAGERTRACE5("JOURNAL %d page %d needSync=%d hash(%08x)\n",
               PAGERID(pPager), pPg->pgno, pPg->needSync, pager_pagehash(pPg));

          /* An error has occured writing to the journal file. The 
          ** transaction will be rolled back by the layer above.
          */
          if( rc!=SQLITE_OK ){
            return rc;
          }

          pPager->nRec++;
          assert( pPager->pInJournal!=0 );
          sqlite3BitvecSet(pPager->pInJournal, pPg->pgno);
          pPg->needSync = !pPager->noSync;
          if( pPager->stmtInUse ){
            sqlite3BitvecSet(pPager->pInStmt, pPg->pgno);
          }
        }
      }else{
        pPg->needSync = !pPager->journalStarted && !pPager->noSync;
        PAGERTRACE4("APPEND %d page %d needSync=%d\n",
                PAGERID(pPager), pPg->pgno, pPg->needSync);
      }
      if( pPg->needSync ){
        pPager->needSync = 1;
      }
      pPg->inJournal = 1;
    }
  
    /* If the statement journal is open and the page is not in it,
    ** then write the current page to the statement journal.  Note that
    ** the statement journal format differs from the standard journal format
    ** in that it omits the checksums and the header.
    */
    if( pPager->stmtInUse 
     && !pageInStatement(pPg) 
     && (int)pPg->pgno<=pPager->stmtSize 
    ){
      assert( pPg->inJournal || (int)pPg->pgno>pPager->origDbSize );
      if( MEMDB ){
        PgHistory *pHist = PGHDR_TO_HIST(pPg, pPager);
        assert( pHist->pStmt==0 );
        pHist->pStmt = sqlite3PageMalloc( pPager->pageSize );
        if( pHist->pStmt ){
          memcpy(pHist->pStmt, PGHDR_TO_DATA(pPg), pPager->pageSize);
        }
        PAGERTRACE3("STMT-JOURNAL %d page %d\n", PAGERID(pPager), pPg->pgno);
        page_add_to_stmt_list(pPg);
      }else{
        i64 offset = pPager->stmtNRec*(4+pPager->pageSize);
        char *pData2 = CODEC2(pPager, pData, pPg->pgno, 7);
        rc = write32bits(pPager->stfd, offset, pPg->pgno);
        if( rc==SQLITE_OK ){
          rc = sqlite3OsWrite(pPager->stfd, pData2, pPager->pageSize, offset+4);
        }
        PAGERTRACE3("STMT-JOURNAL %d page %d\n", PAGERID(pPager), pPg->pgno);
        if( rc!=SQLITE_OK ){
          return rc;
        }
        pPager->stmtNRec++;
        assert( pPager->pInStmt!=0 );
        sqlite3BitvecSet(pPager->pInStmt, pPg->pgno);
      }
    }
  }

  /* Update the database size and return.
  */
  assert( pPager->state>=PAGER_SHARED );
  if( pPager->dbSize<(int)pPg->pgno ){
    pPager->dbSize = pPg->pgno;
    if( !MEMDB && pPager->dbSize==PENDING_BYTE/pPager->pageSize ){
      pPager->dbSize++;
    }
  }
  return rc;
}

/*
** This function is used to mark a data-page as writable. It uses 
** pager_write() to open a journal file (if it is not already open)
** and write the page *pData to the journal.
**
** The difference between this function and pager_write() is that this
** function also deals with the special case where 2 or more pages
** fit on a single disk sector. In this case all co-resident pages
** must have been written to the journal file before returning.
*/
int sqlite3PagerWrite(DbPage *pDbPage){
  int rc = SQLITE_OK;

  PgHdr *pPg = pDbPage;
  Pager *pPager = pPg->pPager;
  Pgno nPagePerSector = (pPager->sectorSize/pPager->pageSize);

  pagerEnter(pPager);
  if( !MEMDB && nPagePerSector>1 ){
    Pgno nPageCount;          /* Total number of pages in database file */
    Pgno pg1;                 /* First page of the sector pPg is located on. */
    int nPage;                /* Number of pages starting at pg1 to journal */
    int ii;
    int needSync = 0;

    /* Set the doNotSync flag to 1. This is because we cannot allow a journal
    ** header to be written between the pages journaled by this function.
    */
    assert( pPager->doNotSync==0 );
    pPager->doNotSync = 1;

    /* This trick assumes that both the page-size and sector-size are
    ** an integer power of 2. It sets variable pg1 to the identifier
    ** of the first page of the sector pPg is located on.
    */
    pg1 = ((pPg->pgno-1) & ~(nPagePerSector-1)) + 1;

    sqlite3PagerPagecount(pPager, (int *)&nPageCount);
    if( pPg->pgno>nPageCount ){
      nPage = (pPg->pgno - pg1)+1;
    }else if( (pg1+nPagePerSector-1)>nPageCount ){
      nPage = nPageCount+1-pg1;
    }else{
      nPage = nPagePerSector;
    }
    assert(nPage>0);
    assert(pg1<=pPg->pgno);
    assert((pg1+nPage)>pPg->pgno);

    for(ii=0; ii<nPage && rc==SQLITE_OK; ii++){
      Pgno pg = pg1+ii;
      PgHdr *pPage;
      if( pg==pPg->pgno || !sqlite3BitvecTest(pPager->pInJournal, pg) ){
        if( pg!=PAGER_MJ_PGNO(pPager) ){
          rc = sqlite3PagerGet(pPager, pg, &pPage);
          if( rc==SQLITE_OK ){
            rc = pager_write(pPage);
            if( pPage->needSync ){
              needSync = 1;
            }
            sqlite3PagerUnref(pPage);
          }
        }
      }else if( (pPage = pager_lookup(pPager, pg))!=0 ){
        if( pPage->needSync ){
          needSync = 1;
        }
      }
    }

    /* If the PgHdr.needSync flag is set for any of the nPage pages 
    ** starting at pg1, then it needs to be set for all of them. Because
    ** writing to any of these nPage pages may damage the others, the
    ** journal file must contain sync()ed copies of all of them
    ** before any of them can be written out to the database file.
    */
    if( needSync ){
      for(ii=0; ii<nPage && needSync; ii++){
        PgHdr *pPage = pager_lookup(pPager, pg1+ii);
        if( pPage ) pPage->needSync = 1;
      }
      assert(pPager->needSync);
    }

    assert( pPager->doNotSync==1 );
    pPager->doNotSync = 0;
  }else{
    rc = pager_write(pDbPage);
  }
  pagerLeave(pPager);
  return rc;
}

/*
** Return TRUE if the page given in the argument was previously passed
** to sqlite3PagerWrite().  In other words, return TRUE if it is ok
** to change the content of the page.
*/
#ifndef NDEBUG
int sqlite3PagerIswriteable(DbPage *pPg){
  return pPg->dirty;
}
#endif

/*
** A call to this routine tells the pager that it is not necessary to
** write the information on page pPg back to the disk, even though
** that page might be marked as dirty.
**
** The overlying software layer calls this routine when all of the data
** on the given page is unused.  The pager marks the page as clean so
** that it does not get written to disk.
**
** Tests show that this optimization, together with the
** sqlite3PagerDontRollback() below, more than double the speed
** of large INSERT operations and quadruple the speed of large DELETEs.
**
** When this routine is called, set the alwaysRollback flag to true.
** Subsequent calls to sqlite3PagerDontRollback() for the same page
** will thereafter be ignored.  This is necessary to avoid a problem
** where a page with data is added to the freelist during one part of
** a transaction then removed from the freelist during a later part
** of the same transaction and reused for some other purpose.  When it
** is first added to the freelist, this routine is called.  When reused,
** the sqlite3PagerDontRollback() routine is called.  But because the
** page contains critical data, we still need to be sure it gets
** rolled back in spite of the sqlite3PagerDontRollback() call.
*/
void sqlite3PagerDontWrite(DbPage *pDbPage){
  PgHdr *pPg = pDbPage;
  Pager *pPager = pPg->pPager;

  if( MEMDB ) return;
  pagerEnter(pPager);
  pPg->alwaysRollback = 1;
  if( pPg->dirty && !pPager->stmtInUse ){
    assert( pPager->state>=PAGER_SHARED );
    if( pPager->dbSize==(int)pPg->pgno && pPager->origDbSize<pPager->dbSize ){
      /* If this pages is the last page in the file and the file has grown
      ** during the current transaction, then do NOT mark the page as clean.
      ** When the database file grows, we must make sure that the last page
      ** gets written at least once so that the disk file will be the correct
      ** size. If you do not write this page and the size of the file
      ** on the disk ends up being too small, that can lead to database
      ** corruption during the next transaction.
      */
    }else{
      PAGERTRACE3("DONT_WRITE page %d of %d\n", pPg->pgno, PAGERID(pPager));
      IOTRACE(("CLEAN %p %d\n", pPager, pPg->pgno))
      makeClean(pPg);
#ifdef SQLITE_CHECK_PAGES
      pPg->pageHash = pager_pagehash(pPg);
#endif
    }
  }
  pagerLeave(pPager);
}

/*
** A call to this routine tells the pager that if a rollback occurs,
** it is not necessary to restore the data on the given page.  This
** means that the pager does not have to record the given page in the
** rollback journal.
**
** If we have not yet actually read the content of this page (if
** the PgHdr.needRead flag is set) then this routine acts as a promise
** that we will never need to read the page content in the future.
** so the needRead flag can be cleared at this point.
*/
void sqlite3PagerDontRollback(DbPage *pPg){
  Pager *pPager = pPg->pPager;

  pagerEnter(pPager);
  assert( pPager->state>=PAGER_RESERVED );

  /* If the journal file is not open, or DontWrite() has been called on
  ** this page (DontWrite() sets the alwaysRollback flag), then this
  ** function is a no-op.
  */
  if( pPager->journalOpen==0 || pPg->alwaysRollback || pPager->alwaysRollback ){
    pagerLeave(pPager);
    return;
  }
  assert( !MEMDB );    /* For a memdb, pPager->journalOpen is always 0 */

#ifdef SQLITE_SECURE_DELETE
  if( pPg->inJournal || (int)pPg->pgno > pPager->origDbSize ){
    return;
  }
#endif

  /* If SECURE_DELETE is disabled, then there is no way that this
  ** routine can be called on a page for which sqlite3PagerDontWrite()
  ** has not been previously called during the same transaction.
  ** And if DontWrite() has previously been called, the following
  ** conditions must be met.
  **
  ** (Later:)  Not true.  If the database is corrupted by having duplicate
  ** pages on the freelist (ex: corrupt9.test) then the following is not
  ** necessarily true:
  */
  /* assert( !pPg->inJournal && (int)pPg->pgno <= pPager->origDbSize ); */

  assert( pPager->pInJournal!=0 );
  sqlite3BitvecSet(pPager->pInJournal, pPg->pgno);
  pPg->inJournal = 1;
  pPg->needRead = 0;
  if( pPager->stmtInUse ){
    assert( pPager->stmtSize >= pPager->origDbSize );
    sqlite3BitvecSet(pPager->pInStmt, pPg->pgno);
  }
  PAGERTRACE3("DONT_ROLLBACK page %d of %d\n", pPg->pgno, PAGERID(pPager));
  IOTRACE(("GARBAGE %p %d\n", pPager, pPg->pgno))
  pagerLeave(pPager);
}


/*
** This routine is called to increment the database file change-counter,
** stored at byte 24 of the pager file.
*/
static int pager_incr_changecounter(Pager *pPager, int isDirect){
  PgHdr *pPgHdr;
  u32 change_counter;
  int rc = SQLITE_OK;

#ifndef SQLITE_ENABLE_ATOMIC_WRITE
  assert( isDirect==0 );  /* isDirect is only true for atomic writes */
#endif
  if( !pPager->changeCountDone ){
    /* Open page 1 of the file for writing. */
    rc = sqlite3PagerGet(pPager, 1, &pPgHdr);
    if( rc!=SQLITE_OK ) return rc;

    if( !isDirect ){
      rc = sqlite3PagerWrite(pPgHdr);
      if( rc!=SQLITE_OK ){
        sqlite3PagerUnref(pPgHdr);
        return rc;
      }
    }

    /* Increment the value just read and write it back to byte 24. */
    change_counter = sqlite3Get4byte((u8*)pPager->dbFileVers);
    change_counter++;
    put32bits(((char*)PGHDR_TO_DATA(pPgHdr))+24, change_counter);

#ifdef SQLITE_ENABLE_ATOMIC_WRITE
    if( isDirect && pPager->fd->pMethods ){
      const void *zBuf = PGHDR_TO_DATA(pPgHdr);
      rc = sqlite3OsWrite(pPager->fd, zBuf, pPager->pageSize, 0);
    }
#endif

    /* Release the page reference. */
    sqlite3PagerUnref(pPgHdr);
    pPager->changeCountDone = 1;
  }
  return rc;
}

/*
** Sync the pager file to disk.
*/
int sqlite3PagerSync(Pager *pPager){
  int rc;
  pagerEnter(pPager);
  rc = sqlite3OsSync(pPager->fd, pPager->sync_flags);
  pagerLeave(pPager);
  return rc;
}

/*
** Sync the database file for the pager pPager. zMaster points to the name
** of a master journal file that should be written into the individual
** journal file. zMaster may be NULL, which is interpreted as no master
** journal (a single database transaction).
**
** This routine ensures that the journal is synced, all dirty pages written
** to the database file and the database file synced. The only thing that
** remains to commit the transaction is to delete the journal file (or
** master journal file if specified).
**
** Note that if zMaster==NULL, this does not overwrite a previous value
** passed to an sqlite3PagerCommitPhaseOne() call.
**
** If parameter nTrunc is non-zero, then the pager file is truncated to
** nTrunc pages (this is used by auto-vacuum databases).
**
** If the final parameter - noSync - is true, then the database file itself
** is not synced. The caller must call sqlite3PagerSync() directly to
** sync the database file before calling CommitPhaseTwo() to delete the
** journal file in this case.
*/
int sqlite3PagerCommitPhaseOne(
  Pager *pPager, 
  const char *zMaster, 
  Pgno nTrunc,
  int noSync
){
  int rc = SQLITE_OK;

  if( pPager->errCode ){
    return pPager->errCode;
  }

  /* If no changes have been made, we can leave the transaction early.
  */
  if( pPager->dbModified==0 &&
        (pPager->journalMode!=PAGER_JOURNALMODE_DELETE ||
          pPager->exclusiveMode!=0) ){
    assert( pPager->dirtyCache==0 || pPager->journalOpen==0 );
    return SQLITE_OK;
  }

  PAGERTRACE4("DATABASE SYNC: File=%s zMaster=%s nTrunc=%d\n", 
      pPager->zFilename, zMaster, nTrunc);
  pagerEnter(pPager);

  /* If this is an in-memory db, or no pages have been written to, or this
  ** function has already been called, it is a no-op.
  */
  if( pPager->state!=PAGER_SYNCED && !MEMDB && pPager->dirtyCache ){
    PgHdr *pPg;

#ifdef SQLITE_ENABLE_ATOMIC_WRITE
    /* The atomic-write optimization can be used if all of the
    ** following are true:
    **
    **    + The file-system supports the atomic-write property for
    **      blocks of size page-size, and
    **    + This commit is not part of a multi-file transaction, and
    **    + Exactly one page has been modified and store in the journal file.
    **
    ** If the optimization can be used, then the journal file will never
    ** be created for this transaction.
    */
    int useAtomicWrite = (
        !zMaster && 
        pPager->journalOpen &&
        pPager->journalOff==jrnlBufferSize(pPager) && 
        nTrunc==0 && 
        (0==pPager->pDirty || 0==pPager->pDirty->pDirty)
    );
    assert( pPager->journalOpen || pPager->journalMode==PAGER_JOURNALMODE_OFF );
    if( useAtomicWrite ){
      /* Update the nRec field in the journal file. */
      int offset = pPager->journalHdr + sizeof(aJournalMagic);
      assert(pPager->nRec==1);
      rc = write32bits(pPager->jfd, offset, pPager->nRec);

      /* Update the db file change counter. The following call will modify
      ** the in-memory representation of page 1 to include the updated
      ** change counter and then write page 1 directly to the database
      ** file. Because of the atomic-write property of the host file-system, 
      ** this is safe.
      */
      if( rc==SQLITE_OK ){
        rc = pager_incr_changecounter(pPager, 1);
      }
    }else{
      rc = sqlite3JournalCreate(pPager->jfd);
    }

    if( !useAtomicWrite && rc==SQLITE_OK )
#endif

    /* If a master journal file name has already been written to the
    ** journal file, then no sync is required. This happens when it is
    ** written, then the process fails to upgrade from a RESERVED to an
    ** EXCLUSIVE lock. The next time the process tries to commit the
    ** transaction the m-j name will have already been written.
    */
    if( !pPager->setMaster ){
      rc = pager_incr_changecounter(pPager, 0);
      if( rc!=SQLITE_OK ) goto sync_exit;
      if( pPager->journalMode!=PAGER_JOURNALMODE_OFF ){
#ifndef SQLITE_OMIT_AUTOVACUUM
        if( nTrunc!=0 ){
          /* If this transaction has made the database smaller, then all pages
          ** being discarded by the truncation must be written to the journal
          ** file.
          */
          Pgno i;
          int iSkip = PAGER_MJ_PGNO(pPager);
          for( i=nTrunc+1; i<=pPager->origDbSize; i++ ){
            if( !sqlite3BitvecTest(pPager->pInJournal, i) && i!=iSkip ){
              rc = sqlite3PagerGet(pPager, i, &pPg);
              if( rc!=SQLITE_OK ) goto sync_exit;
              rc = sqlite3PagerWrite(pPg);
              sqlite3PagerUnref(pPg);
              if( rc!=SQLITE_OK ) goto sync_exit;
            }
          } 
        }
#endif
        rc = writeMasterJournal(pPager, zMaster);
        if( rc!=SQLITE_OK ) goto sync_exit;
        rc = syncJournal(pPager);
      }
    }
    if( rc!=SQLITE_OK ) goto sync_exit;

#ifndef SQLITE_OMIT_AUTOVACUUM
    if( nTrunc!=0 ){
      rc = sqlite3PagerTruncate(pPager, nTrunc);
      if( rc!=SQLITE_OK ) goto sync_exit;
    }
#endif

    /* Write all dirty pages to the database file */
    pPg = pager_get_all_dirty_pages(pPager);
    rc = pager_write_pagelist(pPg);
    if( rc!=SQLITE_OK ){
      assert( rc!=SQLITE_IOERR_BLOCKED );
      /* The error might have left the dirty list all fouled up here,
      ** but that does not matter because if the if the dirty list did
      ** get corrupted, then the transaction will roll back and
      ** discard the dirty list.  There is an assert in
      ** pager_get_all_dirty_pages() that verifies that no attempt
      ** is made to use an invalid dirty list.
      */
      goto sync_exit;
    }
    pPager->pDirty = 0;

    /* Sync the database file. */
    if( !pPager->noSync && !noSync ){
      rc = sqlite3OsSync(pPager->fd, pPager->sync_flags);
    }
    IOTRACE(("DBSYNC %p\n", pPager))

    pPager->state = PAGER_SYNCED;
  }else if( MEMDB && nTrunc!=0 ){
    rc = sqlite3PagerTruncate(pPager, nTrunc);
  }

sync_exit:
  if( rc==SQLITE_IOERR_BLOCKED ){
    /* pager_incr_changecounter() may attempt to obtain an exclusive
     * lock to spill the cache and return IOERR_BLOCKED. But since 
     * there is no chance the cache is inconsistent, it is
     * better to return SQLITE_BUSY.
     */
    rc = SQLITE_BUSY;
  }
  pagerLeave(pPager);
  return rc;
}


/*
** Commit all changes to the database and release the write lock.
**
** If the commit fails for any reason, a rollback attempt is made
** and an error code is returned.  If the commit worked, SQLITE_OK
** is returned.
*/
int sqlite3PagerCommitPhaseTwo(Pager *pPager){
  int rc;
  PgHdr *pPg;

  if( pPager->errCode ){
    return pPager->errCode;
  }
  if( pPager->state<PAGER_RESERVED ){
    return SQLITE_ERROR;
  }
  if( pPager->dbModified==0 &&
        (pPager->journalMode!=PAGER_JOURNALMODE_DELETE ||
          pPager->exclusiveMode!=0) ){
    assert( pPager->dirtyCache==0 || pPager->journalOpen==0 );
    return SQLITE_OK;
  }
  pagerEnter(pPager);
  PAGERTRACE2("COMMIT %d\n", PAGERID(pPager));
  if( MEMDB ){
    pPg = pager_get_all_dirty_pages(pPager);
    while( pPg ){
      PgHistory *pHist = PGHDR_TO_HIST(pPg, pPager);
      clearHistory(pHist);
      pPg->dirty = 0;
      pPg->inJournal = 0;
      pHist->inStmt = 0;
      pPg->needSync = 0;
      pHist->pPrevStmt = pHist->pNextStmt = 0;
      pPg = pPg->pDirty;
    }
    pPager->pDirty = 0;
#ifndef NDEBUG
    for(pPg=pPager->pAll; pPg; pPg=pPg->pNextAll){
      PgHistory *pHist = PGHDR_TO_HIST(pPg, pPager);
      assert( !pPg->alwaysRollback );
      assert( !pHist->pOrig );
      assert( !pHist->pStmt );
    }
#endif
    pPager->pStmt = 0;
    pPager->state = PAGER_SHARED;
    pagerLeave(pPager);
    return SQLITE_OK;
  }
  assert( pPager->state==PAGER_SYNCED || !pPager->dirtyCache );
  rc = pager_end_transaction(pPager, pPager->setMaster);
  rc = pager_error(pPager, rc);
  pagerLeave(pPager);
  return rc;
}

/*
** Rollback all changes.  The database falls back to PAGER_SHARED mode.
** All in-memory cache pages revert to their original data contents.
** The journal is deleted.
**
** This routine cannot fail unless some other process is not following
** the correct locking protocol or unless some other
** process is writing trash into the journal file (SQLITE_CORRUPT) or
** unless a prior malloc() failed (SQLITE_NOMEM).  Appropriate error
** codes are returned for all these occasions.  Otherwise,
** SQLITE_OK is returned.
*/
int sqlite3PagerRollback(Pager *pPager){
  int rc;
  PAGERTRACE2("ROLLBACK %d\n", PAGERID(pPager));
  if( MEMDB ){
    PgHdr *p;
    for(p=pPager->pAll; p; p=p->pNextAll){
      PgHistory *pHist;
      assert( !p->alwaysRollback );
      if( !p->dirty ){
        assert( !((PgHistory *)PGHDR_TO_HIST(p, pPager))->pOrig );
        assert( !((PgHistory *)PGHDR_TO_HIST(p, pPager))->pStmt );
        continue;
      }

      pHist = PGHDR_TO_HIST(p, pPager);
      if( pHist->pOrig ){
        memcpy(PGHDR_TO_DATA(p), pHist->pOrig, pPager->pageSize);
        PAGERTRACE3("ROLLBACK-PAGE %d of %d\n", p->pgno, PAGERID(pPager));
      }else{
        PAGERTRACE3("PAGE %d is clean on %d\n", p->pgno, PAGERID(pPager));
      }
      clearHistory(pHist);
      p->dirty = 0;
      p->inJournal = 0;
      pHist->inStmt = 0;
      pHist->pPrevStmt = pHist->pNextStmt = 0;
      if( pPager->xReiniter ){
        pPager->xReiniter(p, pPager->pageSize);
      }
    }
    pPager->pDirty = 0;
    pPager->pStmt = 0;
    pPager->dbSize = pPager->origDbSize;
    pager_truncate_cache(pPager);
    pPager->stmtInUse = 0;
    pPager->state = PAGER_SHARED;
    return SQLITE_OK;
  }

  pagerEnter(pPager);
  if( !pPager->dirtyCache || !pPager->journalOpen ){
    rc = pager_end_transaction(pPager, pPager->setMaster);
    pagerLeave(pPager);
    return rc;
  }

  if( pPager->errCode && pPager->errCode!=SQLITE_FULL ){
    if( pPager->state>=PAGER_EXCLUSIVE ){
      pager_playback(pPager, 0);
    }
    pagerLeave(pPager);
    return pPager->errCode;
  }
  if( pPager->state==PAGER_RESERVED ){
    int rc2;
    rc = pager_playback(pPager, 0);
    rc2 = pager_end_transaction(pPager, pPager->setMaster);
    if( rc==SQLITE_OK ){
      rc = rc2;
    }
  }else{
    rc = pager_playback(pPager, 0);
  }
  /* pager_reset(pPager); */
  pPager->dbSize = -1;

  /* If an error occurs during a ROLLBACK, we can no longer trust the pager
  ** cache. So call pager_error() on the way out to make any error 
  ** persistent.
  */
  rc = pager_error(pPager, rc);
  pagerLeave(pPager);
  return rc;
}

/*
** Return TRUE if the database file is opened read-only.  Return FALSE
** if the database is (in theory) writable.
*/
int sqlite3PagerIsreadonly(Pager *pPager){
  return pPager->readOnly;
}

/*
** Return the number of references to the pager.
*/
int sqlite3PagerRefcount(Pager *pPager){
  return pPager->nRef;
}

#ifdef SQLITE_TEST
/*
** This routine is used for testing and analysis only.
*/
int *sqlite3PagerStats(Pager *pPager){
  static int a[11];
  a[0] = pPager->nRef;
  a[1] = pPager->nPage;
  a[2] = pPager->mxPage;
  a[3] = pPager->dbSize;
  a[4] = pPager->state;
  a[5] = pPager->errCode;
  a[6] = pPager->nHit;
  a[7] = pPager->nMiss;
  a[8] = 0;  /* Used to be pPager->nOvfl */
  a[9] = pPager->nRead;
  a[10] = pPager->nWrite;
  return a;
}
int sqlite3PagerIsMemdb(Pager *pPager){
  return MEMDB;
}
#endif

/*
** Set the statement rollback point.
**
** This routine should be called with the transaction journal already
** open.  A new statement journal is created that can be used to rollback
** changes of a single SQL command within a larger transaction.
*/
static int pagerStmtBegin(Pager *pPager){
  int rc;
  assert( !pPager->stmtInUse );
  assert( pPager->state>=PAGER_SHARED );
  assert( pPager->dbSize>=0 );
  PAGERTRACE2("STMT-BEGIN %d\n", PAGERID(pPager));
  if( MEMDB ){
    pPager->stmtInUse = 1;
    pPager->stmtSize = pPager->dbSize;
    return SQLITE_OK;
  }
  if( !pPager->journalOpen ){
    pPager->stmtAutoopen = 1;
    return SQLITE_OK;
  }
  assert( pPager->journalOpen );
  pagerLeave(pPager);
  assert( pPager->pInStmt==0 );
  pPager->pInStmt = sqlite3BitvecCreate(pPager->dbSize);
  pagerEnter(pPager);
  if( pPager->pInStmt==0 ){
    /* sqlite3OsLock(pPager->fd, SHARED_LOCK); */
    return SQLITE_NOMEM;
  }
  pPager->stmtJSize = pPager->journalOff;
  pPager->stmtSize = pPager->dbSize;
  pPager->stmtHdrOff = 0;
  pPager->stmtCksum = pPager->cksumInit;
  if( !pPager->stmtOpen ){
    rc = sqlite3PagerOpentemp(pPager, pPager->stfd, SQLITE_OPEN_SUBJOURNAL);
    if( rc ){
      goto stmt_begin_failed;
    }
    pPager->stmtOpen = 1;
    pPager->stmtNRec = 0;
  }
  pPager->stmtInUse = 1;
  return SQLITE_OK;
 
stmt_begin_failed:
  if( pPager->pInStmt ){
    sqlite3BitvecDestroy(pPager->pInStmt);
    pPager->pInStmt = 0;
  }
  return rc;
}
int sqlite3PagerStmtBegin(Pager *pPager){
  int rc;
  pagerEnter(pPager);
  rc = pagerStmtBegin(pPager);
  pagerLeave(pPager);
  return rc;
}

/*
** Commit a statement.
*/
int sqlite3PagerStmtCommit(Pager *pPager){
  pagerEnter(pPager);
  if( pPager->stmtInUse ){
    PgHdr *pPg, *pNext;
    PAGERTRACE2("STMT-COMMIT %d\n", PAGERID(pPager));
    if( !MEMDB ){
      /* sqlite3OsTruncate(pPager->stfd, 0); */
      sqlite3BitvecDestroy(pPager->pInStmt);
      pPager->pInStmt = 0;
    }else{
      for(pPg=pPager->pStmt; pPg; pPg=pNext){
        PgHistory *pHist = PGHDR_TO_HIST(pPg, pPager);
        pNext = pHist->pNextStmt;
        assert( pHist->inStmt );
        pHist->inStmt = 0;
        pHist->pPrevStmt = pHist->pNextStmt = 0;
        sqlite3PageFree(pHist->pStmt);
        pHist->pStmt = 0;
      }
    }
    pPager->stmtNRec = 0;
    pPager->stmtInUse = 0;
    pPager->pStmt = 0;
  }
  pPager->stmtAutoopen = 0;
  pagerLeave(pPager);
  return SQLITE_OK;
}

/*
** Rollback a statement.
*/
int sqlite3PagerStmtRollback(Pager *pPager){
  int rc;
  pagerEnter(pPager);
  if( pPager->stmtInUse ){
    PAGERTRACE2("STMT-ROLLBACK %d\n", PAGERID(pPager));
    if( MEMDB ){
      PgHdr *pPg;
      PgHistory *pHist;
      for(pPg=pPager->pStmt; pPg; pPg=pHist->pNextStmt){
        pHist = PGHDR_TO_HIST(pPg, pPager);
        if( pHist->pStmt ){
          memcpy(PGHDR_TO_DATA(pPg), pHist->pStmt, pPager->pageSize);
          sqlite3PageFree(pHist->pStmt);
          pHist->pStmt = 0;
        }
      }
      pPager->dbSize = pPager->stmtSize;
      pager_truncate_cache(pPager);
      rc = SQLITE_OK;
    }else{
      rc = pager_stmt_playback(pPager);
    }
    sqlite3PagerStmtCommit(pPager);
  }else{
    rc = SQLITE_OK;
  }
  pPager->stmtAutoopen = 0;
  pagerLeave(pPager);
  return rc;
}

/*
** Return the full pathname of the database file.
*/
const char *sqlite3PagerFilename(Pager *pPager){
  return pPager->zFilename;
}

/*
** Return the VFS structure for the pager.
*/
const sqlite3_vfs *sqlite3PagerVfs(Pager *pPager){
  return pPager->pVfs;
}

/*
** Return the file handle for the database file associated
** with the pager.  This might return NULL if the file has
** not yet been opened.
*/
sqlite3_file *sqlite3PagerFile(Pager *pPager){
  return pPager->fd;
}

/*
** Return the directory of the database file.
*/
const char *sqlite3PagerDirname(Pager *pPager){
  return pPager->zDirectory;
}

/*
** Return the full pathname of the journal file.
*/
const char *sqlite3PagerJournalname(Pager *pPager){
  return pPager->zJournal;
}

/*
** Return true if fsync() calls are disabled for this pager.  Return FALSE
** if fsync()s are executed normally.
*/
int sqlite3PagerNosync(Pager *pPager){
  return pPager->noSync;
}

#ifdef SQLITE_HAS_CODEC
/*
** Set the codec for this pager
*/
void sqlite3PagerSetCodec(
  Pager *pPager,
  void *(*xCodec)(void*,void*,Pgno,int),
  void *pCodecArg
){
  pPager->xCodec = xCodec;
  pPager->pCodecArg = pCodecArg;
}
#endif

#ifndef SQLITE_OMIT_AUTOVACUUM
/*
** Move the page pPg to location pgno in the file.
**
** There must be no references to the page previously located at
** pgno (which we call pPgOld) though that page is allowed to be
** in cache.  If the page previous located at pgno is not already
** in the rollback journal, it is not put there by by this routine.
**
** References to the page pPg remain valid. Updating any
** meta-data associated with pPg (i.e. data stored in the nExtra bytes
** allocated along with the page) is the responsibility of the caller.
**
** A transaction must be active when this routine is called. It used to be
** required that a statement transaction was not active, but this restriction
** has been removed (CREATE INDEX needs to move a page when a statement
** transaction is active).
**
** If the fourth argument, isCommit, is non-zero, then this page is being
** moved as part of a database reorganization just before the transaction 
** is being committed. In this case, it is guaranteed that the database page 
** pPg refers to will not be written to again within this transaction.
*/
int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, int isCommit){
  PgHdr *pPgOld;  /* The page being overwritten. */
  int h;
  Pgno needSyncPgno = 0;

  pagerEnter(pPager);
  assert( pPg->nRef>0 );

  PAGERTRACE5("MOVE %d page %d (needSync=%d) moves to %d\n", 
      PAGERID(pPager), pPg->pgno, pPg->needSync, pgno);
  IOTRACE(("MOVE %p %d %d\n", pPager, pPg->pgno, pgno))

  pager_get_content(pPg);

  /* If the journal needs to be sync()ed before page pPg->pgno can
  ** be written to, store pPg->pgno in local variable needSyncPgno.
  **
  ** If the isCommit flag is set, there is no need to remember that
  ** the journal needs to be sync()ed before database page pPg->pgno 
  ** can be written to. The caller has already promised not to write to it.
  */
  if( pPg->needSync && !isCommit ){
    needSyncPgno = pPg->pgno;
    assert( pPg->inJournal || (int)pgno>pPager->origDbSize );
    assert( pPg->dirty );
    assert( pPager->needSync );
  }

  /* Unlink pPg from its hash-chain */
  unlinkHashChain(pPager, pPg);

  /* If the cache contains a page with page-number pgno, remove it
  ** from its hash chain. Also, if the PgHdr.needSync was set for 
  ** page pgno before the 'move' operation, it needs to be retained 
  ** for the page moved there.
  */
  pPg->needSync = 0;
  pPgOld = pager_lookup(pPager, pgno);
  if( pPgOld ){
    assert( pPgOld->nRef==0 );
    unlinkHashChain(pPager, pPgOld);
    makeClean(pPgOld);
    pPg->needSync = pPgOld->needSync;
  }else{
    pPg->needSync = 0;
  }
  pPg->inJournal = sqlite3BitvecTest(pPager->pInJournal, pgno);

  /* Change the page number for pPg and insert it into the new hash-chain. */
  assert( pgno!=0 );
  pPg->pgno = pgno;
  h = pgno & (pPager->nHash-1);
  if( pPager->aHash[h] ){
    assert( pPager->aHash[h]->pPrevHash==0 );
    pPager->aHash[h]->pPrevHash = pPg;
  }
  pPg->pNextHash = pPager->aHash[h];
  pPager->aHash[h] = pPg;
  pPg->pPrevHash = 0;

  makeDirty(pPg);
  pPager->dirtyCache = 1;
  pPager->dbModified = 1;

  if( needSyncPgno ){
    /* If needSyncPgno is non-zero, then the journal file needs to be 
    ** sync()ed before any data is written to database file page needSyncPgno.
    ** Currently, no such page exists in the page-cache and the 
    ** "is journaled" bitvec flag has been set. This needs to be remedied by
    ** loading the page into the pager-cache and setting the PgHdr.needSync 
    ** flag.
    **
    ** If the attempt to load the page into the page-cache fails, (due
    ** to a malloc() or IO failure), clear the bit in the pInJournal[]
    ** array. Otherwise, if the page is loaded and written again in
    ** this transaction, it may be written to the database file before
    ** it is synced into the journal file. This way, it may end up in
    ** the journal file twice, but that is not a problem.
    **
    ** The sqlite3PagerGet() call may cause the journal to sync. So make
    ** sure the Pager.needSync flag is set too.
    */
    int rc;
    PgHdr *pPgHdr;
    assert( pPager->needSync );
    rc = sqlite3PagerGet(pPager, needSyncPgno, &pPgHdr);
    if( rc!=SQLITE_OK ){
      if( pPager->pInJournal && (int)needSyncPgno<=pPager->origDbSize ){
        sqlite3BitvecClear(pPager->pInJournal, needSyncPgno);
      }
      pagerLeave(pPager);
      return rc;
    }
    pPager->needSync = 1;
    pPgHdr->needSync = 1;
    pPgHdr->inJournal = 1;
    makeDirty(pPgHdr);
    sqlite3PagerUnref(pPgHdr);
  }

  pagerLeave(pPager);
  return SQLITE_OK;
}
#endif

/*
** Return a pointer to the data for the specified page.
*/
void *sqlite3PagerGetData(DbPage *pPg){
  return PGHDR_TO_DATA(pPg);
}

/*
** Return a pointer to the Pager.nExtra bytes of "extra" space 
** allocated along with the specified page.
*/
void *sqlite3PagerGetExtra(DbPage *pPg){
  Pager *pPager = pPg->pPager;
  return (pPager?PGHDR_TO_EXTRA(pPg, pPager):0);
}

/*
** Get/set the locking-mode for this pager. Parameter eMode must be one
** of PAGER_LOCKINGMODE_QUERY, PAGER_LOCKINGMODE_NORMAL or 
** PAGER_LOCKINGMODE_EXCLUSIVE. If the parameter is not _QUERY, then
** the locking-mode is set to the value specified.
**
** The returned value is either PAGER_LOCKINGMODE_NORMAL or
** PAGER_LOCKINGMODE_EXCLUSIVE, indicating the current (possibly updated)
** locking-mode.
*/
int sqlite3PagerLockingMode(Pager *pPager, int eMode){
  assert( eMode==PAGER_LOCKINGMODE_QUERY
            || eMode==PAGER_LOCKINGMODE_NORMAL
            || eMode==PAGER_LOCKINGMODE_EXCLUSIVE );
  assert( PAGER_LOCKINGMODE_QUERY<0 );
  assert( PAGER_LOCKINGMODE_NORMAL>=0 && PAGER_LOCKINGMODE_EXCLUSIVE>=0 );
  if( eMode>=0 && !pPager->tempFile ){
    pPager->exclusiveMode = eMode;
  }
  return (int)pPager->exclusiveMode;
}

/*
** Get/set the journal-mode for this pager. Parameter eMode must be one
** of PAGER_JOURNALMODE_QUERY, PAGER_JOURNALMODE_DELETE or 
** PAGER_JOURNALMODE_PERSIST. If the parameter is not _QUERY, then
** the journal-mode is set to the value specified.
**
** The returned value is either PAGER_JOURNALMODE_DELETE or
** PAGER_JOURNALMODE_PERSIST, indicating the current (possibly updated)
** journal-mode.
*/
int sqlite3PagerJournalMode(Pager *pPager, int eMode){
  assert( eMode==PAGER_JOURNALMODE_QUERY
            || eMode==PAGER_JOURNALMODE_DELETE
            || eMode==PAGER_JOURNALMODE_PERSIST
            || eMode==PAGER_JOURNALMODE_OFF );
  assert( PAGER_JOURNALMODE_QUERY<0 );
  assert( PAGER_JOURNALMODE_DELETE>=0 && PAGER_JOURNALMODE_PERSIST>=0 );
  if( eMode>=0 ){
    pPager->journalMode = eMode;
  }
  return (int)pPager->journalMode;
}

/*
** Get/set the size-limit used for persistent journal files.
*/
i64 sqlite3PagerJournalSizeLimit(Pager *pPager, i64 iLimit){
  if( iLimit>=-1 ){
    pPager->journalSizeLimit = iLimit;
  }
  return pPager->journalSizeLimit;
}

#endif /* SQLITE_OMIT_DISKIO */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/pager.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the sqlite page cache
** subsystem.  The page cache subsystem reads and writes a file a page
** at a time and provides a journal for rollback.
**
** @(#) $Id: pager.h,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/

#ifndef _PAGER_H_
#define _PAGER_H_

/*
** If defined as non-zero, auto-vacuum is enabled by default. Otherwise
** it must be turned on for each database using "PRAGMA auto_vacuum = 1".
*/
#ifndef SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT
  #define SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT -1
#endif

/*
** The type used to represent a page number.  The first page in a file
** is called page 1.  0 is used to represent "not a page".
*/
typedef u32 Pgno;

/*
** Each open file is managed by a separate instance of the "Pager" structure.
*/
typedef struct Pager Pager;

/*
** Handle type for pages.
*/
typedef struct PgHdr DbPage;

/*
** Allowed values for the flags parameter to sqlite3PagerOpen().
**
** NOTE: This values must match the corresponding BTREE_ values in btree.h.
*/
#define PAGER_OMIT_JOURNAL  0x0001    /* Do not use a rollback journal */
#define PAGER_NO_READLOCK   0x0002    /* Omit readlocks on readonly files */

/*
** Valid values for the second argument to sqlite3PagerLockingMode().
*/
#define PAGER_LOCKINGMODE_QUERY      -1
#define PAGER_LOCKINGMODE_NORMAL      0
#define PAGER_LOCKINGMODE_EXCLUSIVE   1

/*
** Valid values for the second argument to sqlite3PagerJournalMode().
*/
#define PAGER_JOURNALMODE_QUERY      -1
#define PAGER_JOURNALMODE_DELETE      0   /* Commit by deleting journal file */
#define PAGER_JOURNALMODE_PERSIST     1   /* Commit by zeroing journal header */
#define PAGER_JOURNALMODE_OFF         2   /* Journal omitted.  */

/*
** See source code comments for a detailed description of the following
** routines:
*/
int sqlite3PagerOpen(sqlite3_vfs *, Pager **ppPager, const char*, int,int,int);
void sqlite3PagerSetBusyhandler(Pager*, BusyHandler *pBusyHandler);
void sqlite3PagerSetDestructor(Pager*, void(*)(DbPage*,int));
void sqlite3PagerSetReiniter(Pager*, void(*)(DbPage*,int));
int sqlite3PagerSetPagesize(Pager*, u16*);
int sqlite3PagerMaxPageCount(Pager*, int);
int sqlite3PagerReadFileheader(Pager*, int, unsigned char*);
void sqlite3PagerSetCachesize(Pager*, int);
int sqlite3PagerClose(Pager *pPager);
int sqlite3PagerAcquire(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag);
#define sqlite3PagerGet(A,B,C) sqlite3PagerAcquire(A,B,C,0)
DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno);
int sqlite3PagerRef(DbPage*);
int sqlite3PagerUnref(DbPage*);
int sqlite3PagerWrite(DbPage*);
int sqlite3PagerPagecount(Pager*, int*);
int sqlite3PagerTruncate(Pager*,Pgno);
int sqlite3PagerBegin(DbPage*, int exFlag);
int sqlite3PagerCommitPhaseOne(Pager*,const char *zMaster, Pgno, int);
int sqlite3PagerCommitPhaseTwo(Pager*);
int sqlite3PagerRollback(Pager*);
int sqlite3PagerIsreadonly(Pager*);
int sqlite3PagerStmtBegin(Pager*);
int sqlite3PagerStmtCommit(Pager*);
int sqlite3PagerStmtRollback(Pager*);
void sqlite3PagerDontRollback(DbPage*);
void sqlite3PagerDontWrite(DbPage*);
int sqlite3PagerRefcount(Pager*);
void sqlite3PagerSetSafetyLevel(Pager*,int,int);
const char *sqlite3PagerFilename(Pager*);
const sqlite3_vfs *sqlite3PagerVfs(Pager*);
sqlite3_file *sqlite3PagerFile(Pager*);
const char *sqlite3PagerDirname(Pager*);
const char *sqlite3PagerJournalname(Pager*);
int sqlite3PagerNosync(Pager*);
int sqlite3PagerMovepage(Pager*,DbPage*,Pgno,int);
void *sqlite3PagerGetData(DbPage *); 
void *sqlite3PagerGetExtra(DbPage *); 
int sqlite3PagerLockingMode(Pager *, int);
int sqlite3PagerJournalMode(Pager *, int);
i64 sqlite3PagerJournalSizeLimit(Pager *, i64);
void *sqlite3PagerTempSpace(Pager*);
int sqlite3PagerSync(Pager *pPager);

#if defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) && !defined(SQLITE_OMIT_DISKIO)
  int sqlite3PagerReleaseMemory(int);
#endif

#ifdef SQLITE_HAS_CODEC
  void sqlite3PagerSetCodec(Pager*,void*(*)(void*,void*,Pgno,int),void*);
#endif

#if !defined(NDEBUG) || defined(SQLITE_TEST)
  Pgno sqlite3PagerPagenumber(DbPage*);
  int sqlite3PagerIswriteable(DbPage*);
#endif

#ifdef SQLITE_TEST
  int *sqlite3PagerStats(Pager*);
  void sqlite3PagerRefdump(Pager*);
  int sqlite3PagerIsMemdb(Pager*);
#endif

#ifdef SQLITE_TEST
void disable_simulated_io_errors(void);
void enable_simulated_io_errors(void);
#else
# define disable_simulated_io_errors()
# define enable_simulated_io_errors()
#endif

#endif /* _PAGER_H_ */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































































































Deleted SQLite.Interop/splitsource/parse.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
/* Driver template for the LEMON parser generator.
** The author disclaims copyright to this source code.
*/
/* First off, code is included that follows the "include" declaration
** in the input grammar file. */
#include <stdio.h>
#line 51 "parse.y"

#include "sqliteInt.h"

/*
** An instance of this structure holds information about the
** LIMIT clause of a SELECT statement.
*/
struct LimitVal {
  Expr *pLimit;    /* The LIMIT expression.  NULL if there is no limit */
  Expr *pOffset;   /* The OFFSET expression.  NULL if there is none */
};

/*
** An instance of this structure is used to store the LIKE,
** GLOB, NOT LIKE, and NOT GLOB operators.
*/
struct LikeOp {
  Token eOperator;  /* "like" or "glob" or "regexp" */
  int not;         /* True if the NOT keyword is present */
};

/*
** An instance of the following structure describes the event of a
** TRIGGER.  "a" is the event type, one of TK_UPDATE, TK_INSERT,
** TK_DELETE, or TK_INSTEAD.  If the event is of the form
**
**      UPDATE ON (a,b,c)
**
** Then the "b" IdList records the list "a,b,c".
*/
struct TrigEvent { int a; IdList * b; };

/*
** An instance of this structure holds the ATTACH key and the key type.
*/
struct AttachKey { int type;  Token key; };

#line 48 "parse.c"
/* Next is all token values, in a form suitable for use by makeheaders.
** This section will be null unless lemon is run with the -m switch.
*/
/* 
** These constants (all generated automatically by the parser generator)
** specify the various kinds of tokens (terminals) that the parser
** understands. 
**
** Each symbol here is a terminal symbol in the grammar.
*/
/* Make sure the INTERFACE macro is defined.
*/
#ifndef INTERFACE
# define INTERFACE 1
#endif
/* The next thing included is series of defines which control
** various aspects of the generated parser.
**    YYCODETYPE         is the data type used for storing terminal
**                       and nonterminal numbers.  "unsigned char" is
**                       used if there are fewer than 250 terminals
**                       and nonterminals.  "int" is used otherwise.
**    YYNOCODE           is a number of type YYCODETYPE which corresponds
**                       to no legal terminal or nonterminal number.  This
**                       number is used to fill in empty slots of the hash 
**                       table.
**    YYFALLBACK         If defined, this indicates that one or more tokens
**                       have fall-back values which should be used if the
**                       original value of the token will not parse.
**    YYACTIONTYPE       is the data type used for storing terminal
**                       and nonterminal numbers.  "unsigned char" is
**                       used if there are fewer than 250 rules and
**                       states combined.  "int" is used otherwise.
**    sqlite3ParserTOKENTYPE     is the data type used for minor tokens given 
**                       directly to the parser from the tokenizer.
**    YYMINORTYPE        is the data type used for all minor tokens.
**                       This is typically a union of many types, one of
**                       which is sqlite3ParserTOKENTYPE.  The entry in the union
**                       for base tokens is called "yy0".
**    YYSTACKDEPTH       is the maximum depth of the parser's stack.  If
**                       zero the stack is dynamically sized using realloc()
**    sqlite3ParserARG_SDECL     A static variable declaration for the %extra_argument
**    sqlite3ParserARG_PDECL     A parameter declaration for the %extra_argument
**    sqlite3ParserARG_STORE     Code to store %extra_argument into yypParser
**    sqlite3ParserARG_FETCH     Code to extract %extra_argument from yypParser
**    YYNSTATE           the combined number of states.
**    YYNRULE            the number of rules in the grammar
**    YYERRORSYMBOL      is the code number of the error symbol.  If not
**                       defined, then do no error processing.
*/
#define YYCODETYPE unsigned char
#define YYNOCODE 248
#define YYACTIONTYPE unsigned short int
#define YYWILDCARD 59
#define sqlite3ParserTOKENTYPE Token
typedef union {
  sqlite3ParserTOKENTYPE yy0;
  int yy46;
  struct LikeOp yy72;
  Expr* yy172;
  ExprList* yy174;
  Select* yy219;
  struct LimitVal yy234;
  TriggerStep* yy243;
  struct TrigEvent yy370;
  SrcList* yy373;
  struct {int value; int mask;} yy405;
  IdList* yy432;
} YYMINORTYPE;
#ifndef YYSTACKDEPTH
#define YYSTACKDEPTH 100
#endif
#define sqlite3ParserARG_SDECL Parse *pParse;
#define sqlite3ParserARG_PDECL ,Parse *pParse
#define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse
#define sqlite3ParserARG_STORE yypParser->pParse = pParse
#define YYNSTATE 589
#define YYNRULE 313
#define YYFALLBACK 1
#define YY_NO_ACTION      (YYNSTATE+YYNRULE+2)
#define YY_ACCEPT_ACTION  (YYNSTATE+YYNRULE+1)
#define YY_ERROR_ACTION   (YYNSTATE+YYNRULE)

/* The yyzerominor constant is used to initialize instances of
** YYMINORTYPE objects to zero. */
static const YYMINORTYPE yyzerominor;

/* Next are the tables used to determine what action to take based on the
** current state and lookahead token.  These tables are used to implement
** functions that take a state number and lookahead value and return an
** action integer.  
**
** Suppose the action integer is N.  Then the action is determined as
** follows
**
**   0 <= N < YYNSTATE                  Shift N.  That is, push the lookahead
**                                      token onto the stack and goto state N.
**
**   YYNSTATE <= N < YYNSTATE+YYNRULE   Reduce by rule N-YYNSTATE.
**
**   N == YYNSTATE+YYNRULE              A syntax error has occurred.
**
**   N == YYNSTATE+YYNRULE+1            The parser accepts its input.
**
**   N == YYNSTATE+YYNRULE+2            No such action.  Denotes unused
**                                      slots in the yy_action[] table.
**
** The action table is constructed as a single large table named yy_action[].
** Given state S and lookahead X, the action is computed as
**
**      yy_action[ yy_shift_ofst[S] + X ]
**
** If the index value yy_shift_ofst[S]+X is out of range or if the value
** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S]
** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table
** and that yy_default[S] should be used instead.  
**
** The formula above is for computing the action when the lookahead is
** a terminal symbol.  If the lookahead is a non-terminal (as occurs after
** a reduce action) then the yy_reduce_ofst[] array is used in place of
** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of
** YY_SHIFT_USE_DFLT.
**
** The following are the tables generated in this section:
**
**  yy_action[]        A single table containing all actions.
**  yy_lookahead[]     A table containing the lookahead for each entry in
**                     yy_action.  Used to detect hash collisions.
**  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 */   292,  903,  124,  588,  409,  172,    2,  418,   61,   61,
 /*    10 */    61,   61,  519,   63,   63,   63,   63,   64,   64,   65,
 /*    20 */    65,   65,   66,  210,  447,  212,  425,  431,   68,   63,
 /*    30 */    63,   63,   63,   64,   64,   65,   65,   65,   66,  210,
 /*    40 */   391,  388,  396,  451,   60,   59,  297,  435,  436,  432,
 /*    50 */   432,   62,   62,   61,   61,   61,   61,  263,   63,   63,
 /*    60 */    63,   63,   64,   64,   65,   65,   65,   66,  210,  292,
 /*    70 */   493,  494,  418,  489,  208,   82,   67,  420,   69,  154,
 /*    80 */    63,   63,   63,   63,   64,   64,   65,   65,   65,   66,
 /*    90 */   210,   67,  462,   69,  154,  425,  431,  574,  264,   58,
 /*   100 */    64,   64,   65,   65,   65,   66,  210,  397,  398,  422,
 /*   110 */   422,  422,  292,   60,   59,  297,  435,  436,  432,  432,
 /*   120 */    62,   62,   61,   61,   61,   61,  317,   63,   63,   63,
 /*   130 */    63,   64,   64,   65,   65,   65,   66,  210,  425,  431,
 /*   140 */    94,   65,   65,   65,   66,  210,  396,  210,  414,   34,
 /*   150 */    56,  298,  442,  443,  410,  418,   60,   59,  297,  435,
 /*   160 */   436,  432,  432,   62,   62,   61,   61,   61,   61,  208,
 /*   170 */    63,   63,   63,   63,   64,   64,   65,   65,   65,   66,
 /*   180 */   210,  292,  372,  524,  295,  572,  113,  408,  522,  451,
 /*   190 */   331,  317,  407,   20,  244,  340,  519,  396,  478,  531,
 /*   200 */   505,  447,  212,  571,  570,  245,  530,  425,  431,  149,
 /*   210 */   150,  397,  398,  414,   41,  211,  151,  533,  488,  489,
 /*   220 */   418,  568,  569,  420,  292,   60,   59,  297,  435,  436,
 /*   230 */   432,  432,   62,   62,   61,   61,   61,   61,  317,   63,
 /*   240 */    63,   63,   63,   64,   64,   65,   65,   65,   66,  210,
 /*   250 */   425,  431,  447,  333,  215,  422,  422,  422,  363,  299,
 /*   260 */   414,   41,  397,  398,  366,  567,  211,  292,   60,   59,
 /*   270 */   297,  435,  436,  432,  432,   62,   62,   61,   61,   61,
 /*   280 */    61,  396,   63,   63,   63,   63,   64,   64,   65,   65,
 /*   290 */    65,   66,  210,  425,  431,  491,  300,  524,  474,   66,
 /*   300 */   210,  214,  474,  229,  411,  286,  534,   20,  449,  523,
 /*   310 */   168,   60,   59,  297,  435,  436,  432,  432,   62,   62,
 /*   320 */    61,   61,   61,   61,  474,   63,   63,   63,   63,   64,
 /*   330 */    64,   65,   65,   65,   66,  210,  209,  480,  317,   77,
 /*   340 */   292,  239,  300,   55,  484,  490,  397,  398,  181,  547,
 /*   350 */   494,  345,  348,  349,   67,  152,   69,  154,  339,  524,
 /*   360 */   414,   35,  350,  241,  221,  370,  425,  431,  579,   20,
 /*   370 */   164,  118,  243,  343,  248,  344,  176,  322,  442,  443,
 /*   380 */   414,    3,   80,  252,   60,   59,  297,  435,  436,  432,
 /*   390 */   432,   62,   62,   61,   61,   61,   61,  174,   63,   63,
 /*   400 */    63,   63,   64,   64,   65,   65,   65,   66,  210,  292,
 /*   410 */   221,  550,  236,  487,  510,  353,  317,  118,  243,  343,
 /*   420 */   248,  344,  176,  181,  317,  532,  345,  348,  349,  252,
 /*   430 */   223,  415,  155,  464,  511,  425,  431,  350,  414,   34,
 /*   440 */   465,  211,  177,  175,  160,  525,  414,   34,  338,  549,
 /*   450 */   449,  323,  168,   60,   59,  297,  435,  436,  432,  432,
 /*   460 */    62,   62,   61,   61,   61,   61,  415,   63,   63,   63,
 /*   470 */    63,   64,   64,   65,   65,   65,   66,  210,  292,  542,
 /*   480 */   335,  517,  504,  541,  456,  572,  302,   19,  331,  144,
 /*   490 */   317,  390,  317,  330,    2,  362,  457,  294,  483,  373,
 /*   500 */   269,  268,  252,  571,  425,  431,  589,  391,  388,  458,
 /*   510 */   208,  495,  414,   49,  414,   49,  303,  586,  894,  230,
 /*   520 */   894,  496,   60,   59,  297,  435,  436,  432,  432,   62,
 /*   530 */    62,   61,   61,   61,   61,  201,   63,   63,   63,   63,
 /*   540 */    64,   64,   65,   65,   65,   66,  210,  292,  317,  181,
 /*   550 */   439,  255,  345,  348,  349,  370,  153,  583,  308,  251,
 /*   560 */   309,  452,   76,  350,   78,  382,  211,  426,  427,  415,
 /*   570 */   414,   27,  319,  425,  431,  440,    1,   22,  586,  893,
 /*   580 */   396,  893,  544,  478,  320,  263,  438,  438,  429,  430,
 /*   590 */   415,   60,   59,  297,  435,  436,  432,  432,   62,   62,
 /*   600 */    61,   61,   61,   61,  237,   63,   63,   63,   63,   64,
 /*   610 */    64,   65,   65,   65,   66,  210,  292,  428,  583,  374,
 /*   620 */   224,   93,  517,    9,  159,  396,  557,  396,  456,   67,
 /*   630 */   396,   69,  154,  399,  400,  401,  320,  328,  438,  438,
 /*   640 */   457,  336,  425,  431,  361,  397,  398,  320,  433,  438,
 /*   650 */   438,  582,  291,  458,  238,  327,  318,  222,  546,  292,
 /*   660 */    60,   59,  297,  435,  436,  432,  432,   62,   62,   61,
 /*   670 */    61,   61,   61,  225,   63,   63,   63,   63,   64,   64,
 /*   680 */    65,   65,   65,   66,  210,  425,  431,  482,  313,  392,
 /*   690 */   397,  398,  397,  398,  207,  397,  398,  825,  273,  517,
 /*   700 */   251,  200,  292,   60,   59,  297,  435,  436,  432,  432,
 /*   710 */    62,   62,   61,   61,   61,   61,  470,   63,   63,   63,
 /*   720 */    63,   64,   64,   65,   65,   65,   66,  210,  425,  431,
 /*   730 */   171,  160,  263,  263,  304,  415,  276,  395,  274,  263,
 /*   740 */   517,  517,  263,  517,  192,  292,   60,   70,  297,  435,
 /*   750 */   436,  432,  432,   62,   62,   61,   61,   61,   61,  379,
 /*   760 */    63,   63,   63,   63,   64,   64,   65,   65,   65,   66,
 /*   770 */   210,  425,  431,  384,  559,  305,  306,  251,  415,  320,
 /*   780 */   560,  438,  438,  561,  540,  360,  540,  387,  292,  196,
 /*   790 */    59,  297,  435,  436,  432,  432,   62,   62,   61,   61,
 /*   800 */    61,   61,  371,   63,   63,   63,   63,   64,   64,   65,
 /*   810 */    65,   65,   66,  210,  425,  431,  396,  275,  251,  251,
 /*   820 */   172,  250,  418,  415,  386,  367,  178,  179,  180,  469,
 /*   830 */   311,  123,  156,    5,  297,  435,  436,  432,  432,   62,
 /*   840 */    62,   61,   61,   61,   61,  317,   63,   63,   63,   63,
 /*   850 */    64,   64,   65,   65,   65,   66,  210,   72,  324,  194,
 /*   860 */     4,  317,  263,  317,  296,  263,  415,  414,   28,  317,
 /*   870 */   257,  317,  321,   72,  324,  317,    4,  119,  165,  177,
 /*   880 */   296,  397,  398,  414,   23,  414,   32,  418,  321,  326,
 /*   890 */   421,  414,   53,  414,   52,  317,  158,  414,   98,  451,
 /*   900 */   317,  263,  317,  277,  317,  326,  378,  471,  261,  317,
 /*   910 */   259,   18,  478,  445,  445,  451,  317,  414,   96,   75,
 /*   920 */    74,  469,  414,  101,  414,  102,  414,  112,   73,  315,
 /*   930 */   316,  414,  114,  420,  294,   75,   74,  481,  414,   16,
 /*   940 */   381,  317,  279,  467,   73,  315,  316,   72,  324,  420,
 /*   950 */     4,  208,  317,  183,  296,  317,  186,  128,   84,  208,
 /*   960 */     8,  341,  321,  414,   99,  422,  422,  422,  423,  424,
 /*   970 */    11,  623,  380,  307,  414,   33,  413,  414,   97,  326,
 /*   980 */   412,  422,  422,  422,  423,  424,   11,  415,  413,  451,
 /*   990 */   415,  162,  412,  317,  499,  500,  226,  227,  228,  104,
 /*  1000 */   448,  476,  317,  173,  507,  317,  509,  508,  317,   75,
 /*  1010 */    74,  329,  205,   21,  281,  414,   24,  418,   73,  315,
 /*  1020 */   316,  282,  317,  420,  414,   54,  460,  414,  115,  317,
 /*  1030 */   414,  116,  502,  203,  147,  549,  514,  468,  128,  202,
 /*  1040 */   317,  473,  204,  317,  414,  117,  317,  477,  317,  584,
 /*  1050 */   317,  414,   25,  317,  249,  422,  422,  422,  423,  424,
 /*  1060 */    11,  506,  414,   36,  512,  414,   37,  317,  414,   26,
 /*  1070 */   414,   38,  414,   39,  526,  414,   40,  317,  254,  317,
 /*  1080 */   128,  317,  418,  317,  256,  377,  278,  268,  585,  414,
 /*  1090 */    42,  293,  317,  352,  317,  128,  208,  513,  258,  414,
 /*  1100 */    43,  414,   44,  414,   29,  414,   30,  545,  260,  128,
 /*  1110 */   317,  553,  317,  173,  414,   45,  414,   46,  317,  262,
 /*  1120 */   383,  554,  317,   91,  564,  317,   91,  317,  581,  189,
 /*  1130 */   290,  357,  414,   47,  414,   48,  267,  365,  368,  369,
 /*  1140 */   414,   31,  270,  271,  414,   10,  272,  414,   50,  414,
 /*  1150 */    51,  556,  566,  280,  283,  284,  578,  146,  419,  405,
 /*  1160 */   231,  505,  444,  325,  516,  463,  163,  446,  552,  394,
 /*  1170 */   466,  563,  246,  515,  518,  520,  402,  403,  404,    7,
 /*  1180 */   314,   84,  232,  334,  347,   83,  332,   57,  170,   79,
 /*  1190 */   213,  461,  125,   85,  337,  342,  492,  502,  497,  301,
 /*  1200 */   498,  416,  105,  219,  247,  218,  503,  501,  233,  220,
 /*  1210 */   287,  234,  527,  528,  235,  529,  417,  521,  354,  288,
 /*  1220 */   184,  121,  185,  240,  535,  475,  242,  356,  187,  479,
 /*  1230 */   188,  358,  537,   88,  190,  548,  364,  193,  132,  376,
 /*  1240 */   555,  375,  133,  134,  135,  310,  562,  138,  136,  575,
 /*  1250 */   576,  577,  580,  100,  393,  406,  217,  142,  624,  625,
 /*  1260 */   103,  141,  265,  166,  167,  434,   71,  453,  441,  437,
 /*  1270 */   450,  143,  538,  157,  120,  454,  161,  472,  455,  169,
 /*  1280 */   459,   81,    6,   12,   13,   92,   95,  126,  216,  127,
 /*  1290 */   111,  485,  486,   17,   86,  346,  106,  122,  253,  107,
 /*  1300 */    87,  108,  182,  245,  355,  145,  351,  536,  129,  359,
 /*  1310 */   312,  130,  543,  173,  539,  266,  191,  109,  289,  551,
 /*  1320 */   195,   14,  131,  198,  197,  558,  137,  199,  139,  140,
 /*  1330 */    15,  565,   89,   90,  573,  110,  385,  206,  148,  389,
 /*  1340 */   285,  587,
};
static const YYCODETYPE yy_lookahead[] = {
 /*     0 */    16,  139,  140,  141,  168,   21,  144,   23,   69,   70,
 /*    10 */    71,   72,  176,   74,   75,   76,   77,   78,   79,   80,
 /*    20 */    81,   82,   83,   84,   78,   79,   42,   43,   73,   74,
 /*    30 */    75,   76,   77,   78,   79,   80,   81,   82,   83,   84,
 /*    40 */     1,    2,   23,   58,   60,   61,   62,   63,   64,   65,
 /*    50 */    66,   67,   68,   69,   70,   71,   72,  147,   74,   75,
 /*    60 */    76,   77,   78,   79,   80,   81,   82,   83,   84,   16,
 /*    70 */   185,  186,   88,   88,  110,   22,  217,   92,  219,  220,
 /*    80 */    74,   75,   76,   77,   78,   79,   80,   81,   82,   83,
 /*    90 */    84,  217,  218,  219,  220,   42,   43,  238,  188,   46,
 /*   100 */    78,   79,   80,   81,   82,   83,   84,   88,   89,  124,
 /*   110 */   125,  126,   16,   60,   61,   62,   63,   64,   65,   66,
 /*   120 */    67,   68,   69,   70,   71,   72,  147,   74,   75,   76,
 /*   130 */    77,   78,   79,   80,   81,   82,   83,   84,   42,   43,
 /*   140 */    44,   80,   81,   82,   83,   84,   23,   84,  169,  170,
 /*   150 */    19,  164,  165,  166,   23,   23,   60,   61,   62,   63,
 /*   160 */    64,   65,   66,   67,   68,   69,   70,   71,   72,  110,
 /*   170 */    74,   75,   76,   77,   78,   79,   80,   81,   82,   83,
 /*   180 */    84,   16,  123,  147,  150,  147,   21,  167,  168,   58,
 /*   190 */   211,  147,  156,  157,   92,  216,  176,   23,  147,  176,
 /*   200 */   177,   78,   79,  165,  166,  103,  183,   42,   43,   78,
 /*   210 */    79,   88,   89,  169,  170,  228,  180,  181,  169,   88,
 /*   220 */    88,   98,   99,   92,   16,   60,   61,   62,   63,   64,
 /*   230 */    65,   66,   67,   68,   69,   70,   71,   72,  147,   74,
 /*   240 */    75,   76,   77,   78,   79,   80,   81,   82,   83,   84,
 /*   250 */    42,   43,   78,  209,  210,  124,  125,  126,  224,  208,
 /*   260 */   169,  170,   88,   89,  230,  227,  228,   16,   60,   61,
 /*   270 */    62,   63,   64,   65,   66,   67,   68,   69,   70,   71,
 /*   280 */    72,   23,   74,   75,   76,   77,   78,   79,   80,   81,
 /*   290 */    82,   83,   84,   42,   43,  160,   16,  147,  161,   83,
 /*   300 */    84,  210,  161,  153,  169,  158,  156,  157,  161,  162,
 /*   310 */   163,   60,   61,   62,   63,   64,   65,   66,   67,   68,
 /*   320 */    69,   70,   71,   72,  161,   74,   75,   76,   77,   78,
 /*   330 */    79,   80,   81,   82,   83,   84,  192,  200,  147,  131,
 /*   340 */    16,  200,   16,  199,   20,  169,   88,   89,   90,  185,
 /*   350 */   186,   93,   94,   95,  217,   22,  219,  220,  147,  147,
 /*   360 */   169,  170,  104,  200,   84,  147,   42,   43,  156,  157,
 /*   370 */    90,   91,   92,   93,   94,   95,   96,  164,  165,  166,
 /*   380 */   169,  170,  131,  103,   60,   61,   62,   63,   64,   65,
 /*   390 */    66,   67,   68,   69,   70,   71,   72,  155,   74,   75,
 /*   400 */    76,   77,   78,   79,   80,   81,   82,   83,   84,   16,
 /*   410 */    84,   11,  221,   20,   30,   16,  147,   91,   92,   93,
 /*   420 */    94,   95,   96,   90,  147,  181,   93,   94,   95,  103,
 /*   430 */   212,  189,  155,   27,   50,   42,   43,  104,  169,  170,
 /*   440 */    34,  228,   43,  201,  202,  181,  169,  170,  206,   49,
 /*   450 */   161,  162,  163,   60,   61,   62,   63,   64,   65,   66,
 /*   460 */    67,   68,   69,   70,   71,   72,  189,   74,   75,   76,
 /*   470 */    77,   78,   79,   80,   81,   82,   83,   84,   16,   25,
 /*   480 */   211,  147,   20,   29,   12,  147,  102,   19,  211,   21,
 /*   490 */   147,  141,  147,  216,  144,   41,   24,   98,   20,   99,
 /*   500 */   100,  101,  103,  165,   42,   43,    0,    1,    2,   37,
 /*   510 */   110,   39,  169,  170,  169,  170,  182,   19,   20,  190,
 /*   520 */    22,   49,   60,   61,   62,   63,   64,   65,   66,   67,
 /*   530 */    68,   69,   70,   71,   72,  155,   74,   75,   76,   77,
 /*   540 */    78,   79,   80,   81,   82,   83,   84,   16,  147,   90,
 /*   550 */    20,   20,   93,   94,   95,  147,  155,   59,  215,  225,
 /*   560 */   215,   20,  130,  104,  132,  227,  228,   42,   43,  189,
 /*   570 */   169,  170,   16,   42,   43,   20,   19,   22,   19,   20,
 /*   580 */    23,   22,   18,  147,  106,  147,  108,  109,   63,   64,
 /*   590 */   189,   60,   61,   62,   63,   64,   65,   66,   67,   68,
 /*   600 */    69,   70,   71,   72,  147,   74,   75,   76,   77,   78,
 /*   610 */    79,   80,   81,   82,   83,   84,   16,   92,   59,   55,
 /*   620 */   212,   21,  147,   19,  147,   23,  188,   23,   12,  217,
 /*   630 */    23,  219,  220,    7,    8,    9,  106,  186,  108,  109,
 /*   640 */    24,  147,   42,   43,  208,   88,   89,  106,   92,  108,
 /*   650 */   109,  244,  245,   37,  147,   39,  147,  182,   94,   16,
 /*   660 */    60,   61,   62,   63,   64,   65,   66,   67,   68,   69,
 /*   670 */    70,   71,   72,  145,   74,   75,   76,   77,   78,   79,
 /*   680 */    80,   81,   82,   83,   84,   42,   43,   80,  142,  143,
 /*   690 */    88,   89,   88,   89,  148,   88,   89,  133,   14,  147,
 /*   700 */   225,  155,   16,   60,   61,   62,   63,   64,   65,   66,
 /*   710 */    67,   68,   69,   70,   71,   72,  114,   74,   75,   76,
 /*   720 */    77,   78,   79,   80,   81,   82,   83,   84,   42,   43,
 /*   730 */   201,  202,  147,  147,  182,  189,   52,  147,   54,  147,
 /*   740 */   147,  147,  147,  147,  155,   16,   60,   61,   62,   63,
 /*   750 */    64,   65,   66,   67,   68,   69,   70,   71,   72,  213,
 /*   760 */    74,   75,   76,   77,   78,   79,   80,   81,   82,   83,
 /*   770 */    84,   42,   43,  188,  188,  182,  182,  225,  189,  106,
 /*   780 */   188,  108,  109,  188,   99,  100,  101,  241,   16,  155,
 /*   790 */    61,   62,   63,   64,   65,   66,   67,   68,   69,   70,
 /*   800 */    71,   72,  213,   74,   75,   76,   77,   78,   79,   80,
 /*   810 */    81,   82,   83,   84,   42,   43,   23,  133,  225,  225,
 /*   820 */    21,  225,   23,  189,  239,  236,   99,  100,  101,   22,
 /*   830 */   242,  243,  155,  191,   62,   63,   64,   65,   66,   67,
 /*   840 */    68,   69,   70,   71,   72,  147,   74,   75,   76,   77,
 /*   850 */    78,   79,   80,   81,   82,   83,   84,   16,   17,   22,
 /*   860 */    19,  147,  147,  147,   23,  147,  189,  169,  170,  147,
 /*   870 */    14,  147,   31,   16,   17,  147,   19,  147,   19,   43,
 /*   880 */    23,   88,   89,  169,  170,  169,  170,   88,   31,   48,
 /*   890 */   147,  169,  170,  169,  170,  147,   89,  169,  170,   58,
 /*   900 */   147,  147,  147,  188,  147,   48,  188,  114,   52,  147,
 /*   910 */    54,   19,  147,  124,  125,   58,  147,  169,  170,   78,
 /*   920 */    79,  114,  169,  170,  169,  170,  169,  170,   87,   88,
 /*   930 */    89,  169,  170,   92,   98,   78,   79,   80,  169,  170,
 /*   940 */    91,  147,  188,   22,   87,   88,   89,   16,   17,   92,
 /*   950 */    19,  110,  147,  155,   23,  147,  155,   22,  121,  110,
 /*   960 */    68,   80,   31,  169,  170,  124,  125,  126,  127,  128,
 /*   970 */   129,  112,  123,  208,  169,  170,  107,  169,  170,   48,
 /*   980 */   111,  124,  125,  126,  127,  128,  129,  189,  107,   58,
 /*   990 */   189,    5,  111,  147,    7,    8,   10,   11,   12,   13,
 /*  1000 */   161,   20,  147,   22,  178,  147,   91,   92,  147,   78,
 /*  1010 */    79,  147,   26,   19,   28,  169,  170,   23,   87,   88,
 /*  1020 */    89,   35,  147,   92,  169,  170,  147,  169,  170,  147,
 /*  1030 */   169,  170,   97,   47,  113,   49,   20,  203,   22,   53,
 /*  1040 */   147,  147,   56,  147,  169,  170,  147,  147,  147,   20,
 /*  1050 */   147,  169,  170,  147,  147,  124,  125,  126,  127,  128,
 /*  1060 */   129,  147,  169,  170,  178,  169,  170,  147,  169,  170,
 /*  1070 */   169,  170,  169,  170,  147,  169,  170,  147,   20,  147,
 /*  1080 */    22,  147,   88,  147,  147,   99,  100,  101,   59,  169,
 /*  1090 */   170,  105,  147,   20,  147,   22,  110,  178,  147,  169,
 /*  1100 */   170,  169,  170,  169,  170,  169,  170,   20,  147,   22,
 /*  1110 */   147,   20,  147,   22,  169,  170,  169,  170,  147,  147,
 /*  1120 */   134,   20,  147,   22,   20,  147,   22,  147,   20,  232,
 /*  1130 */    22,  233,  169,  170,  169,  170,  147,  147,  147,  147,
 /*  1140 */   169,  170,  147,  147,  169,  170,  147,  169,  170,  169,
 /*  1150 */   170,  147,  147,  147,  147,  147,  147,  191,  161,  149,
 /*  1160 */   193,  177,  229,  223,  161,  172,    6,  229,  194,  146,
 /*  1170 */   172,  194,  172,  172,  172,  161,  146,  146,  146,   22,
 /*  1180 */   154,  121,  194,  118,  173,  119,  116,  120,  112,  130,
 /*  1190 */   222,  152,  152,   98,  115,   98,  171,   97,  171,   40,
 /*  1200 */   179,  189,   19,   84,  171,  226,  171,  173,  195,  226,
 /*  1210 */   174,  196,  171,  171,  197,  171,  198,  179,   15,  174,
 /*  1220 */   151,   60,  151,  204,  152,  205,  204,  152,  151,  205,
 /*  1230 */   152,   38,  152,  130,  151,  184,  152,  184,   19,   15,
 /*  1240 */   194,  152,  187,  187,  187,  152,  194,  184,  187,   33,
 /*  1250 */   152,  152,  137,  159,    1,   20,  175,  214,  112,  112,
 /*  1260 */   175,  214,  234,  112,  112,   92,   19,   11,   20,  107,
 /*  1270 */    20,   19,  235,   19,   32,   20,  112,  114,   20,   22,
 /*  1280 */    20,   22,  117,   22,  117,  237,  237,   19,   44,   20,
 /*  1290 */   240,   20,   20,  231,   19,   44,   19,  243,   20,   19,
 /*  1300 */    19,   19,   96,  103,   16,   21,   44,   17,   98,   36,
 /*  1310 */   246,   45,   45,   22,   51,  133,   98,   19,    5,    1,
 /*  1320 */   122,   19,  102,   14,  113,   17,  113,  115,  102,  122,
 /*  1330 */    19,  123,   68,   68,   20,   14,   57,  135,   19,    3,
 /*  1340 */   136,    4,
};
#define YY_SHIFT_USE_DFLT (-62)
#define YY_SHIFT_MAX 389
static const short yy_shift_ofst[] = {
 /*     0 */    39,  841,  986,  -16,  841,  931,  931,  258,  123,  -36,
 /*    10 */    96,  931,  931,  931,  931,  931,  -45,  400,  174,   19,
 /*    20 */   132,  -54,  -54,   53,  165,  208,  251,  324,  393,  462,
 /*    30 */   531,  600,  643,  686,  643,  643,  643,  643,  643,  643,
 /*    40 */   643,  643,  643,  643,  643,  643,  643,  643,  643,  643,
 /*    50 */   643,  643,  729,  772,  772,  857,  931,  931,  931,  931,
 /*    60 */   931,  931,  931,  931,  931,  931,  931,  931,  931,  931,
 /*    70 */   931,  931,  931,  931,  931,  931,  931,  931,  931,  931,
 /*    80 */   931,  931,  931,  931,  931,  931,  931,  931,  931,  931,
 /*    90 */   931,  931,  931,  931,  931,  931,  -61,  -61,    6,    6,
 /*   100 */   280,   22,   61,  399,  564,   19,   19,   19,   19,   19,
 /*   110 */    19,   19,  216,  132,   63,  -62,  -62,  -62,  131,  326,
 /*   120 */   472,  472,  498,  559,  506,  799,   19,  799,   19,   19,
 /*   130 */    19,   19,   19,   19,   19,   19,   19,   19,   19,   19,
 /*   140 */    19,  849,   59,  -36,  -36,  -36,  -62,  -62,  -62,  -15,
 /*   150 */   -15,  333,  459,  478,  557,  530,  541,  616,  602,  793,
 /*   160 */   604,  607,  626,   19,   19,  881,   19,   19,  994,   19,
 /*   170 */    19,  807,   19,   19,  673,  807,   19,   19,  384,  384,
 /*   180 */   384,   19,   19,  673,   19,   19,  673,   19,  454,  685,
 /*   190 */    19,   19,  673,   19,   19,   19,  673,   19,   19,   19,
 /*   200 */   673,  673,   19,   19,   19,   19,   19,  468,  869,  921,
 /*   210 */   132,  789,  789,  432,  406,  406,  406,  836,  406,  132,
 /*   220 */   406,  132,  935,  837,  837, 1160, 1160, 1160, 1160, 1157,
 /*   230 */   -36, 1060, 1065, 1066, 1070, 1067, 1059, 1076, 1076, 1095,
 /*   240 */  1079, 1095, 1079, 1097, 1097, 1159, 1097, 1100, 1097, 1183,
 /*   250 */  1119, 1119, 1159, 1097, 1097, 1097, 1183, 1203, 1076, 1203,
 /*   260 */  1076, 1203, 1076, 1076, 1193, 1103, 1203, 1076, 1161, 1161,
 /*   270 */  1219, 1060, 1076, 1224, 1224, 1224, 1224, 1060, 1161, 1219,
 /*   280 */  1076, 1216, 1216, 1076, 1076, 1115,  -62,  -62,  -62,  -62,
 /*   290 */   -62,  -62,  525,  684,  727,  856,  859,  556,  555,  981,
 /*   300 */   102,  987,  915, 1016, 1058, 1073, 1087, 1091, 1101, 1104,
 /*   310 */   892, 1108, 1029, 1253, 1235, 1146, 1147, 1151, 1152, 1173,
 /*   320 */  1162, 1247, 1248, 1250, 1252, 1256, 1254, 1255, 1257, 1258,
 /*   330 */  1260, 1259, 1165, 1261, 1167, 1259, 1163, 1268, 1269, 1164,
 /*   340 */  1271, 1272, 1242, 1244, 1275, 1251, 1277, 1278, 1280, 1281,
 /*   350 */  1262, 1282, 1206, 1200, 1288, 1290, 1284, 1210, 1273, 1263,
 /*   360 */  1266, 1291, 1267, 1182, 1218, 1298, 1313, 1318, 1220, 1264,
 /*   370 */  1265, 1198, 1302, 1211, 1309, 1212, 1308, 1213, 1226, 1207,
 /*   380 */  1311, 1208, 1314, 1321, 1279, 1202, 1204, 1319, 1336, 1337,
};
#define YY_REDUCE_USE_DFLT (-165)
#define YY_REDUCE_MAX 291
static const short yy_reduce_ofst[] = {
 /*     0 */  -138,  277,  546,  137,  401,  -21,   44,   36,   38,  242,
 /*    10 */  -141,  191,   91,  269,  343,  345, -126,  589,  338,  150,
 /*    20 */   147,  -13,  213,  412,  412,  412,  412,  412,  412,  412,
 /*    30 */   412,  412,  412,  412,  412,  412,  412,  412,  412,  412,
 /*    40 */   412,  412,  412,  412,  412,  412,  412,  412,  412,  412,
 /*    50 */   412,  412,  412,  412,  412,  211,  698,  714,  716,  722,
 /*    60 */   724,  728,  748,  753,  755,  757,  762,  769,  794,  805,
 /*    70 */   808,  846,  855,  858,  861,  875,  882,  893,  896,  899,
 /*    80 */   901,  903,  906,  920,  930,  932,  934,  936,  945,  947,
 /*    90 */   963,  965,  971,  975,  978,  980,  412,  412,  412,  412,
 /*   100 */    20,  412,  412,   23,   34,  334,  475,  552,  593,  594,
 /*   110 */   585,  212,  412,  289,  412,  412,  412,  412,  135, -164,
 /*   120 */  -115,  164,  407,  407,  350,  141,   51,  163,  596,  -90,
 /*   130 */   436,  218,  765,  438,  586,  592,  595,  715,  718,  408,
 /*   140 */   754,  380,  634,  677,  798,  801,  144,  529,  588,   49,
 /*   150 */   176,  244,  264,  329,  457,  329,  329,  451,  477,  494,
 /*   160 */   507,  509,  528,  590,  730,  642,  509,  743,  839,  864,
 /*   170 */   879,  834,  894,  900,  329,  834,  907,  914,  826,  886,
 /*   180 */   919,  927,  937,  329,  951,  961,  329,  972,  897,  898,
 /*   190 */   989,  990,  329,  991,  992,  995,  329,  996,  999, 1004,
 /*   200 */   329,  329, 1005, 1006, 1007, 1008, 1009, 1010,  966,  967,
 /*   210 */   997,  933,  938,  940,  993,  998, 1000,  984, 1001, 1003,
 /*   220 */  1002, 1014, 1011,  974,  977, 1023, 1030, 1031, 1032, 1026,
 /*   230 */  1012,  988, 1013, 1015, 1017, 1018,  968, 1039, 1040, 1019,
 /*   240 */  1020, 1022, 1024, 1025, 1027, 1021, 1033, 1034, 1035, 1036,
 /*   250 */   979,  983, 1038, 1041, 1042, 1044, 1045, 1069, 1072, 1071,
 /*   260 */  1075, 1077, 1078, 1080, 1028, 1037, 1083, 1084, 1051, 1053,
 /*   270 */  1043, 1046, 1089, 1055, 1056, 1057, 1061, 1052, 1063, 1047,
 /*   280 */  1093, 1048, 1049, 1098, 1099, 1050, 1094, 1081, 1085, 1062,
 /*   290 */  1054, 1064,
};
static const YYACTIONTYPE yy_default[] = {
 /*     0 */   595,  820,  902,  710,  902,  820,  902,  902,  848,  714,
 /*    10 */   877,  818,  902,  902,  902,  902,  792,  902,  848,  902,
 /*    20 */   626,  848,  848,  743,  902,  902,  902,  902,  902,  902,
 /*    30 */   902,  902,  744,  902,  822,  817,  813,  815,  814,  821,
 /*    40 */   745,  734,  741,  748,  726,  861,  750,  751,  757,  758,
 /*    50 */   878,  876,  780,  779,  798,  902,  902,  902,  902,  902,
 /*    60 */   902,  902,  902,  902,  902,  902,  902,  902,  902,  902,
 /*    70 */   902,  902,  902,  902,  902,  902,  902,  902,  902,  902,
 /*    80 */   902,  902,  902,  902,  902,  902,  902,  902,  902,  902,
 /*    90 */   902,  902,  902,  902,  902,  902,  782,  804,  781,  791,
 /*   100 */   619,  783,  784,  679,  614,  902,  902,  902,  902,  902,
 /*   110 */   902,  902,  785,  902,  786,  799,  800,  801,  902,  902,
 /*   120 */   902,  902,  902,  902,  595,  710,  902,  710,  902,  902,
 /*   130 */   902,  902,  902,  902,  902,  902,  902,  902,  902,  902,
 /*   140 */   902,  902,  902,  902,  902,  902,  704,  714,  895,  902,
 /*   150 */   902,  670,  902,  902,  902,  902,  902,  902,  902,  902,
 /*   160 */   902,  902,  602,  600,  902,  702,  902,  902,  628,  902,
 /*   170 */   902,  712,  902,  902,  717,  718,  902,  902,  902,  902,
 /*   180 */   902,  902,  902,  616,  902,  902,  691,  902,  854,  902,
 /*   190 */   902,  902,  868,  902,  902,  902,  866,  902,  902,  902,
 /*   200 */   693,  753,  834,  902,  881,  883,  902,  902,  702,  711,
 /*   210 */   902,  902,  902,  816,  737,  737,  737,  649,  737,  902,
 /*   220 */   737,  902,  652,  747,  747,  599,  599,  599,  599,  669,
 /*   230 */   902,  747,  738,  740,  730,  742,  902,  719,  719,  727,
 /*   240 */   729,  727,  729,  681,  681,  666,  681,  652,  681,  826,
 /*   250 */   831,  831,  666,  681,  681,  681,  826,  611,  719,  611,
 /*   260 */   719,  611,  719,  719,  858,  860,  611,  719,  683,  683,
 /*   270 */   759,  747,  719,  690,  690,  690,  690,  747,  683,  759,
 /*   280 */   719,  880,  880,  719,  719,  888,  636,  654,  654,  863,
 /*   290 */   895,  900,  902,  902,  902,  902,  766,  902,  902,  902,
 /*   300 */   902,  902,  902,  902,  902,  902,  902,  902,  902,  902,
 /*   310 */   841,  902,  902,  902,  902,  771,  767,  902,  768,  902,
 /*   320 */   696,  902,  902,  902,  902,  902,  902,  902,  902,  902,
 /*   330 */   902,  819,  902,  731,  902,  739,  902,  902,  902,  902,
 /*   340 */   902,  902,  902,  902,  902,  902,  902,  902,  902,  902,
 /*   350 */   902,  902,  902,  902,  902,  902,  902,  902,  902,  902,
 /*   360 */   856,  857,  902,  902,  902,  902,  902,  902,  902,  902,
 /*   370 */   902,  902,  902,  902,  902,  902,  902,  902,  902,  902,
 /*   380 */   902,  902,  902,  902,  887,  902,  902,  890,  596,  902,
 /*   390 */   590,  593,  592,  594,  598,  601,  623,  624,  625,  603,
 /*   400 */   604,  605,  606,  607,  608,  609,  615,  617,  635,  637,
 /*   410 */   621,  639,  700,  701,  763,  694,  695,  699,  622,  774,
 /*   420 */   765,  769,  770,  772,  773,  787,  788,  790,  796,  803,
 /*   430 */   806,  789,  794,  795,  797,  802,  805,  697,  698,  809,
 /*   440 */   629,  630,  633,  634,  844,  846,  845,  847,  632,  631,
 /*   450 */   775,  778,  811,  812,  869,  870,  871,  872,  873,  807,
 /*   460 */   720,  810,  793,  732,  735,  736,  733,  703,  713,  722,
 /*   470 */   723,  724,  725,  708,  709,  715,  728,  761,  762,  716,
 /*   480 */   705,  706,  707,  808,  764,  776,  777,  640,  641,  771,
 /*   490 */   642,  643,  644,  682,  685,  686,  687,  645,  664,  667,
 /*   500 */   668,  646,  653,  647,  648,  655,  656,  657,  660,  661,
 /*   510 */   662,  663,  658,  659,  827,  828,  832,  830,  829,  650,
 /*   520 */   651,  665,  638,  627,  620,  671,  674,  675,  676,  677,
 /*   530 */   678,  680,  672,  673,  618,  610,  612,  721,  850,  859,
 /*   540 */   855,  851,  852,  853,  613,  823,  824,  684,  755,  756,
 /*   550 */   849,  862,  864,  760,  865,  867,  892,  688,  689,  692,
 /*   560 */   833,  874,  746,  749,  752,  754,  835,  836,  837,  838,
 /*   570 */   839,  842,  843,  840,  875,  879,  882,  884,  885,  886,
 /*   580 */   889,  891,  896,  897,  898,  901,  899,  597,  591,
};
#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.
**
** appears in the grammar, then ID becomes a fallback token for X, Y,
** and Z.  Whenever one of the tokens X, Y, or Z is input to the parser
** but it does not parse, the type of the token is changed to ID and
** the parse is retried before an error is thrown.
*/
#ifdef YYFALLBACK
static const YYCODETYPE yyFallback[] = {
    0,  /*          $ => nothing */
    0,  /*       SEMI => nothing */
   23,  /*    EXPLAIN => ID */
   23,  /*      QUERY => ID */
   23,  /*       PLAN => ID */
   23,  /*      BEGIN => ID */
    0,  /* TRANSACTION => nothing */
   23,  /*   DEFERRED => ID */
   23,  /*  IMMEDIATE => ID */
   23,  /*  EXCLUSIVE => ID */
    0,  /*     COMMIT => nothing */
   23,  /*        END => ID */
    0,  /*   ROLLBACK => nothing */
    0,  /*     CREATE => nothing */
    0,  /*      TABLE => nothing */
   23,  /*         IF => ID */
    0,  /*        NOT => nothing */
    0,  /*     EXISTS => nothing */
   23,  /*       TEMP => ID */
    0,  /*         LP => nothing */
    0,  /*         RP => nothing */
    0,  /*         AS => nothing */
    0,  /*      COMMA => nothing */
    0,  /*         ID => nothing */
   23,  /*      ABORT => ID */
   23,  /*      AFTER => ID */
   23,  /*    ANALYZE => ID */
   23,  /*        ASC => ID */
   23,  /*     ATTACH => ID */
   23,  /*     BEFORE => ID */
   23,  /*    CASCADE => ID */
   23,  /*       CAST => ID */
   23,  /*   CONFLICT => ID */
   23,  /*   DATABASE => ID */
   23,  /*       DESC => ID */
   23,  /*     DETACH => ID */
   23,  /*       EACH => ID */
   23,  /*       FAIL => ID */
   23,  /*        FOR => ID */
   23,  /*     IGNORE => ID */
   23,  /*  INITIALLY => ID */
   23,  /*    INSTEAD => ID */
   23,  /*    LIKE_KW => ID */
   23,  /*      MATCH => ID */
   23,  /*        KEY => ID */
   23,  /*         OF => ID */
   23,  /*     OFFSET => ID */
   23,  /*     PRAGMA => ID */
   23,  /*      RAISE => ID */
   23,  /*    REPLACE => ID */
   23,  /*   RESTRICT => ID */
   23,  /*        ROW => ID */
   23,  /*    TRIGGER => ID */
   23,  /*     VACUUM => ID */
   23,  /*       VIEW => ID */
   23,  /*    VIRTUAL => ID */
   23,  /*    REINDEX => ID */
   23,  /*     RENAME => ID */
   23,  /*   CTIME_KW => ID */
    0,  /*        ANY => nothing */
    0,  /*         OR => nothing */
    0,  /*        AND => nothing */
    0,  /*         IS => nothing */
    0,  /*    BETWEEN => nothing */
    0,  /*         IN => nothing */
    0,  /*     ISNULL => nothing */
    0,  /*    NOTNULL => nothing */
    0,  /*         NE => nothing */
    0,  /*         EQ => nothing */
    0,  /*         GT => nothing */
    0,  /*         LE => nothing */
    0,  /*         LT => nothing */
    0,  /*         GE => nothing */
    0,  /*     ESCAPE => nothing */
    0,  /*     BITAND => nothing */
    0,  /*      BITOR => nothing */
    0,  /*     LSHIFT => nothing */
    0,  /*     RSHIFT => nothing */
    0,  /*       PLUS => nothing */
    0,  /*      MINUS => nothing */
    0,  /*       STAR => nothing */
    0,  /*      SLASH => nothing */
    0,  /*        REM => nothing */
    0,  /*     CONCAT => nothing */
    0,  /*    COLLATE => nothing */
    0,  /*     UMINUS => nothing */
    0,  /*      UPLUS => nothing */
    0,  /*     BITNOT => nothing */
    0,  /*     STRING => nothing */
    0,  /*    JOIN_KW => nothing */
    0,  /* CONSTRAINT => nothing */
    0,  /*    DEFAULT => nothing */
    0,  /*       NULL => nothing */
    0,  /*    PRIMARY => nothing */
    0,  /*     UNIQUE => nothing */
    0,  /*      CHECK => nothing */
    0,  /* REFERENCES => nothing */
    0,  /*   AUTOINCR => nothing */
    0,  /*         ON => nothing */
    0,  /*     DELETE => nothing */
    0,  /*     UPDATE => nothing */
    0,  /*     INSERT => nothing */
    0,  /*        SET => nothing */
    0,  /* DEFERRABLE => nothing */
    0,  /*    FOREIGN => nothing */
    0,  /*       DROP => nothing */
    0,  /*      UNION => nothing */
    0,  /*        ALL => nothing */
    0,  /*     EXCEPT => nothing */
    0,  /*  INTERSECT => nothing */
    0,  /*     SELECT => nothing */
    0,  /*   DISTINCT => nothing */
    0,  /*        DOT => nothing */
    0,  /*       FROM => nothing */
    0,  /*       JOIN => nothing */
    0,  /*      USING => nothing */
    0,  /*      ORDER => nothing */
    0,  /*         BY => nothing */
    0,  /*      GROUP => nothing */
    0,  /*     HAVING => nothing */
    0,  /*      LIMIT => nothing */
    0,  /*      WHERE => nothing */
    0,  /*       INTO => nothing */
    0,  /*     VALUES => nothing */
    0,  /*    INTEGER => nothing */
    0,  /*      FLOAT => nothing */
    0,  /*       BLOB => nothing */
    0,  /*   REGISTER => nothing */
    0,  /*   VARIABLE => nothing */
    0,  /*       CASE => nothing */
    0,  /*       WHEN => nothing */
    0,  /*       THEN => nothing */
    0,  /*       ELSE => nothing */
    0,  /*      INDEX => nothing */
    0,  /*      ALTER => nothing */
    0,  /*         TO => nothing */
    0,  /*        ADD => nothing */
    0,  /*   COLUMNKW => nothing */
};
#endif /* YYFALLBACK */

/* The following structure represents a single element of the
** parser's stack.  Information stored includes:
**
**   +  The state number for the parser at this level of the stack.
**
**   +  The value of the token stored at this level of the stack.
**      (In other words, the "major" token.)
**
**   +  The semantic value stored at this level of the stack.  This is
**      the information used by the action routines in the grammar.
**      It is sometimes called the "minor" token.
*/
struct yyStackEntry {
  YYACTIONTYPE stateno;  /* The state-number */
  YYCODETYPE major;      /* The major token value.  This is the code
                         ** number for the token at this stack level */
  YYMINORTYPE minor;     /* The user-supplied minor token value.  This
                         ** is the value of the token  */
};
typedef struct yyStackEntry yyStackEntry;

/* The state of the parser is completely contained in an instance of
** the following structure */
struct yyParser {
  int yyidx;                    /* Index of top element in stack */
#ifdef YYTRACKMAXSTACKDEPTH
  int yyidxMax;                 /* Maximum value of yyidx */
#endif
  int yyerrcnt;                 /* Shifts left before out of the error */
  sqlite3ParserARG_SDECL                /* A place to hold %extra_argument */
#if YYSTACKDEPTH<=0
  int yystksz;                  /* Current side of the stack */
  yyStackEntry *yystack;        /* The parser's stack */
#else
  yyStackEntry yystack[YYSTACKDEPTH];  /* The parser's stack */
#endif
};
typedef struct yyParser yyParser;

#ifndef NDEBUG
#include <stdio.h>
static FILE *yyTraceFILE = 0;
static char *yyTracePrompt = 0;
#endif /* NDEBUG */

#ifndef NDEBUG
/* 
** Turn parser tracing on by giving a stream to which to write the trace
** and a prompt to preface each trace message.  Tracing is turned off
** by making either argument NULL 
**
** Inputs:
** <ul>
** <li> A FILE* to which trace output should be written.
**      If NULL, then tracing is turned off.
** <li> A prefix string written at the beginning of every
**      line of trace output.  If NULL, then tracing is
**      turned off.
** </ul>
**
** Outputs:
** None.
*/
void sqlite3ParserTrace(FILE *TraceFILE, char *zTracePrompt){
  yyTraceFILE = TraceFILE;
  yyTracePrompt = zTracePrompt;
  if( yyTraceFILE==0 ) yyTracePrompt = 0;
  else if( yyTracePrompt==0 ) yyTraceFILE = 0;
}
#endif /* NDEBUG */

#ifndef NDEBUG
/* For tracing shifts, the names of all terminals and nonterminals
** are required.  The following table supplies these names */
static const char *const yyTokenName[] = { 
  "$",             "SEMI",          "EXPLAIN",       "QUERY",       
  "PLAN",          "BEGIN",         "TRANSACTION",   "DEFERRED",    
  "IMMEDIATE",     "EXCLUSIVE",     "COMMIT",        "END",         
  "ROLLBACK",      "CREATE",        "TABLE",         "IF",          
  "NOT",           "EXISTS",        "TEMP",          "LP",          
  "RP",            "AS",            "COMMA",         "ID",          
  "ABORT",         "AFTER",         "ANALYZE",       "ASC",         
  "ATTACH",        "BEFORE",        "CASCADE",       "CAST",        
  "CONFLICT",      "DATABASE",      "DESC",          "DETACH",      
  "EACH",          "FAIL",          "FOR",           "IGNORE",      
  "INITIALLY",     "INSTEAD",       "LIKE_KW",       "MATCH",       
  "KEY",           "OF",            "OFFSET",        "PRAGMA",      
  "RAISE",         "REPLACE",       "RESTRICT",      "ROW",         
  "TRIGGER",       "VACUUM",        "VIEW",          "VIRTUAL",     
  "REINDEX",       "RENAME",        "CTIME_KW",      "ANY",         
  "OR",            "AND",           "IS",            "BETWEEN",     
  "IN",            "ISNULL",        "NOTNULL",       "NE",          
  "EQ",            "GT",            "LE",            "LT",          
  "GE",            "ESCAPE",        "BITAND",        "BITOR",       
  "LSHIFT",        "RSHIFT",        "PLUS",          "MINUS",       
  "STAR",          "SLASH",         "REM",           "CONCAT",      
  "COLLATE",       "UMINUS",        "UPLUS",         "BITNOT",      
  "STRING",        "JOIN_KW",       "CONSTRAINT",    "DEFAULT",     
  "NULL",          "PRIMARY",       "UNIQUE",        "CHECK",       
  "REFERENCES",    "AUTOINCR",      "ON",            "DELETE",      
  "UPDATE",        "INSERT",        "SET",           "DEFERRABLE",  
  "FOREIGN",       "DROP",          "UNION",         "ALL",         
  "EXCEPT",        "INTERSECT",     "SELECT",        "DISTINCT",    
  "DOT",           "FROM",          "JOIN",          "USING",       
  "ORDER",         "BY",            "GROUP",         "HAVING",      
  "LIMIT",         "WHERE",         "INTO",          "VALUES",      
  "INTEGER",       "FLOAT",         "BLOB",          "REGISTER",    
  "VARIABLE",      "CASE",          "WHEN",          "THEN",        
  "ELSE",          "INDEX",         "ALTER",         "TO",          
  "ADD",           "COLUMNKW",      "error",         "input",       
  "cmdlist",       "ecmd",          "cmdx",          "cmd",         
  "explain",       "transtype",     "trans_opt",     "nm",          
  "create_table",  "create_table_args",  "temp",          "ifnotexists", 
  "dbnm",          "columnlist",    "conslist_opt",  "select",      
  "column",        "columnid",      "type",          "carglist",    
  "id",            "ids",           "typetoken",     "typename",    
  "signed",        "plus_num",      "minus_num",     "carg",        
  "ccons",         "term",          "expr",          "onconf",      
  "sortorder",     "autoinc",       "idxlist_opt",   "refargs",     
  "defer_subclause",  "refarg",        "refact",        "init_deferred_pred_opt",
  "conslist",      "tcons",         "idxlist",       "defer_subclause_opt",
  "orconf",        "resolvetype",   "raisetype",     "ifexists",    
  "fullname",      "oneselect",     "multiselect_op",  "distinct",    
  "selcollist",    "from",          "where_opt",     "groupby_opt", 
  "having_opt",    "orderby_opt",   "limit_opt",     "sclp",        
  "as",            "seltablist",    "stl_prefix",    "joinop",      
  "on_opt",        "using_opt",     "seltablist_paren",  "joinop2",     
  "inscollist",    "sortlist",      "sortitem",      "nexprlist",   
  "setlist",       "insert_cmd",    "inscollist_opt",  "itemlist",    
  "exprlist",      "likeop",        "escape",        "between_op",  
  "in_op",         "case_operand",  "case_exprlist",  "case_else",   
  "uniqueflag",    "idxitem",       "collate",       "nmnum",       
  "plus_opt",      "number",        "trigger_decl",  "trigger_cmd_list",
  "trigger_time",  "trigger_event",  "foreach_clause",  "when_clause", 
  "trigger_cmd",   "database_kw_opt",  "key_opt",       "add_column_fullname",
  "kwcolumn_opt",  "create_vtab",   "vtabarglist",   "vtabarg",     
  "vtabargtoken",  "lp",            "anylist",     
};
#endif /* NDEBUG */

#ifndef NDEBUG
/* For tracing reduce actions, the names of all rules are required.
*/
static const char *const yyRuleName[] = {
 /*   0 */ "input ::= cmdlist",
 /*   1 */ "cmdlist ::= cmdlist ecmd",
 /*   2 */ "cmdlist ::= ecmd",
 /*   3 */ "cmdx ::= cmd",
 /*   4 */ "ecmd ::= SEMI",
 /*   5 */ "ecmd ::= explain cmdx SEMI",
 /*   6 */ "explain ::=",
 /*   7 */ "explain ::= EXPLAIN",
 /*   8 */ "explain ::= EXPLAIN QUERY PLAN",
 /*   9 */ "cmd ::= BEGIN transtype trans_opt",
 /*  10 */ "trans_opt ::=",
 /*  11 */ "trans_opt ::= TRANSACTION",
 /*  12 */ "trans_opt ::= TRANSACTION nm",
 /*  13 */ "transtype ::=",
 /*  14 */ "transtype ::= DEFERRED",
 /*  15 */ "transtype ::= IMMEDIATE",
 /*  16 */ "transtype ::= EXCLUSIVE",
 /*  17 */ "cmd ::= COMMIT trans_opt",
 /*  18 */ "cmd ::= END trans_opt",
 /*  19 */ "cmd ::= ROLLBACK trans_opt",
 /*  20 */ "cmd ::= create_table create_table_args",
 /*  21 */ "create_table ::= CREATE temp TABLE ifnotexists nm dbnm",
 /*  22 */ "ifnotexists ::=",
 /*  23 */ "ifnotexists ::= IF NOT EXISTS",
 /*  24 */ "temp ::= TEMP",
 /*  25 */ "temp ::=",
 /*  26 */ "create_table_args ::= LP columnlist conslist_opt RP",
 /*  27 */ "create_table_args ::= AS select",
 /*  28 */ "columnlist ::= columnlist COMMA column",
 /*  29 */ "columnlist ::= column",
 /*  30 */ "column ::= columnid type carglist",
 /*  31 */ "columnid ::= nm",
 /*  32 */ "id ::= ID",
 /*  33 */ "ids ::= ID|STRING",
 /*  34 */ "nm ::= ID",
 /*  35 */ "nm ::= STRING",
 /*  36 */ "nm ::= JOIN_KW",
 /*  37 */ "type ::=",
 /*  38 */ "type ::= typetoken",
 /*  39 */ "typetoken ::= typename",
 /*  40 */ "typetoken ::= typename LP signed RP",
 /*  41 */ "typetoken ::= typename LP signed COMMA signed RP",
 /*  42 */ "typename ::= ids",
 /*  43 */ "typename ::= typename ids",
 /*  44 */ "signed ::= plus_num",
 /*  45 */ "signed ::= minus_num",
 /*  46 */ "carglist ::= carglist carg",
 /*  47 */ "carglist ::=",
 /*  48 */ "carg ::= CONSTRAINT nm ccons",
 /*  49 */ "carg ::= ccons",
 /*  50 */ "ccons ::= DEFAULT term",
 /*  51 */ "ccons ::= DEFAULT LP expr RP",
 /*  52 */ "ccons ::= DEFAULT PLUS term",
 /*  53 */ "ccons ::= DEFAULT MINUS term",
 /*  54 */ "ccons ::= DEFAULT id",
 /*  55 */ "ccons ::= NULL onconf",
 /*  56 */ "ccons ::= NOT NULL onconf",
 /*  57 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc",
 /*  58 */ "ccons ::= UNIQUE onconf",
 /*  59 */ "ccons ::= CHECK LP expr RP",
 /*  60 */ "ccons ::= REFERENCES nm idxlist_opt refargs",
 /*  61 */ "ccons ::= defer_subclause",
 /*  62 */ "ccons ::= COLLATE ids",
 /*  63 */ "autoinc ::=",
 /*  64 */ "autoinc ::= AUTOINCR",
 /*  65 */ "refargs ::=",
 /*  66 */ "refargs ::= refargs refarg",
 /*  67 */ "refarg ::= MATCH nm",
 /*  68 */ "refarg ::= ON DELETE refact",
 /*  69 */ "refarg ::= ON UPDATE refact",
 /*  70 */ "refarg ::= ON INSERT refact",
 /*  71 */ "refact ::= SET NULL",
 /*  72 */ "refact ::= SET DEFAULT",
 /*  73 */ "refact ::= CASCADE",
 /*  74 */ "refact ::= RESTRICT",
 /*  75 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
 /*  76 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
 /*  77 */ "init_deferred_pred_opt ::=",
 /*  78 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
 /*  79 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
 /*  80 */ "conslist_opt ::=",
 /*  81 */ "conslist_opt ::= COMMA conslist",
 /*  82 */ "conslist ::= conslist COMMA tcons",
 /*  83 */ "conslist ::= conslist tcons",
 /*  84 */ "conslist ::= tcons",
 /*  85 */ "tcons ::= CONSTRAINT nm",
 /*  86 */ "tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf",
 /*  87 */ "tcons ::= UNIQUE LP idxlist RP onconf",
 /*  88 */ "tcons ::= CHECK LP expr RP onconf",
 /*  89 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt",
 /*  90 */ "defer_subclause_opt ::=",
 /*  91 */ "defer_subclause_opt ::= defer_subclause",
 /*  92 */ "onconf ::=",
 /*  93 */ "onconf ::= ON CONFLICT resolvetype",
 /*  94 */ "orconf ::=",
 /*  95 */ "orconf ::= OR resolvetype",
 /*  96 */ "resolvetype ::= raisetype",
 /*  97 */ "resolvetype ::= IGNORE",
 /*  98 */ "resolvetype ::= REPLACE",
 /*  99 */ "cmd ::= DROP TABLE ifexists fullname",
 /* 100 */ "ifexists ::= IF EXISTS",
 /* 101 */ "ifexists ::=",
 /* 102 */ "cmd ::= CREATE temp VIEW ifnotexists nm dbnm AS select",
 /* 103 */ "cmd ::= DROP VIEW ifexists fullname",
 /* 104 */ "cmd ::= select",
 /* 105 */ "select ::= oneselect",
 /* 106 */ "select ::= select multiselect_op oneselect",
 /* 107 */ "multiselect_op ::= UNION",
 /* 108 */ "multiselect_op ::= UNION ALL",
 /* 109 */ "multiselect_op ::= EXCEPT|INTERSECT",
 /* 110 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
 /* 111 */ "distinct ::= DISTINCT",
 /* 112 */ "distinct ::= ALL",
 /* 113 */ "distinct ::=",
 /* 114 */ "sclp ::= selcollist COMMA",
 /* 115 */ "sclp ::=",
 /* 116 */ "selcollist ::= sclp expr as",
 /* 117 */ "selcollist ::= sclp STAR",
 /* 118 */ "selcollist ::= sclp nm DOT STAR",
 /* 119 */ "as ::= AS nm",
 /* 120 */ "as ::= ids",
 /* 121 */ "as ::=",
 /* 122 */ "from ::=",
 /* 123 */ "from ::= FROM seltablist",
 /* 124 */ "stl_prefix ::= seltablist joinop",
 /* 125 */ "stl_prefix ::=",
 /* 126 */ "seltablist ::= stl_prefix nm dbnm as on_opt using_opt",
 /* 127 */ "seltablist ::= stl_prefix LP seltablist_paren RP as on_opt using_opt",
 /* 128 */ "seltablist_paren ::= select",
 /* 129 */ "seltablist_paren ::= seltablist",
 /* 130 */ "dbnm ::=",
 /* 131 */ "dbnm ::= DOT nm",
 /* 132 */ "fullname ::= nm dbnm",
 /* 133 */ "joinop ::= COMMA|JOIN",
 /* 134 */ "joinop ::= JOIN_KW JOIN",
 /* 135 */ "joinop ::= JOIN_KW nm JOIN",
 /* 136 */ "joinop ::= JOIN_KW nm nm JOIN",
 /* 137 */ "on_opt ::= ON expr",
 /* 138 */ "on_opt ::=",
 /* 139 */ "using_opt ::= USING LP inscollist RP",
 /* 140 */ "using_opt ::=",
 /* 141 */ "orderby_opt ::=",
 /* 142 */ "orderby_opt ::= ORDER BY sortlist",
 /* 143 */ "sortlist ::= sortlist COMMA sortitem sortorder",
 /* 144 */ "sortlist ::= sortitem sortorder",
 /* 145 */ "sortitem ::= expr",
 /* 146 */ "sortorder ::= ASC",
 /* 147 */ "sortorder ::= DESC",
 /* 148 */ "sortorder ::=",
 /* 149 */ "groupby_opt ::=",
 /* 150 */ "groupby_opt ::= GROUP BY nexprlist",
 /* 151 */ "having_opt ::=",
 /* 152 */ "having_opt ::= HAVING expr",
 /* 153 */ "limit_opt ::=",
 /* 154 */ "limit_opt ::= LIMIT expr",
 /* 155 */ "limit_opt ::= LIMIT expr OFFSET expr",
 /* 156 */ "limit_opt ::= LIMIT expr COMMA expr",
 /* 157 */ "cmd ::= DELETE FROM fullname where_opt",
 /* 158 */ "where_opt ::=",
 /* 159 */ "where_opt ::= WHERE expr",
 /* 160 */ "cmd ::= UPDATE orconf fullname SET setlist where_opt",
 /* 161 */ "setlist ::= setlist COMMA nm EQ expr",
 /* 162 */ "setlist ::= nm EQ expr",
 /* 163 */ "cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP",
 /* 164 */ "cmd ::= insert_cmd INTO fullname inscollist_opt select",
 /* 165 */ "cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES",
 /* 166 */ "insert_cmd ::= INSERT orconf",
 /* 167 */ "insert_cmd ::= REPLACE",
 /* 168 */ "itemlist ::= itemlist COMMA expr",
 /* 169 */ "itemlist ::= expr",
 /* 170 */ "inscollist_opt ::=",
 /* 171 */ "inscollist_opt ::= LP inscollist RP",
 /* 172 */ "inscollist ::= inscollist COMMA nm",
 /* 173 */ "inscollist ::= nm",
 /* 174 */ "expr ::= term",
 /* 175 */ "expr ::= LP expr RP",
 /* 176 */ "term ::= NULL",
 /* 177 */ "expr ::= ID",
 /* 178 */ "expr ::= JOIN_KW",
 /* 179 */ "expr ::= nm DOT nm",
 /* 180 */ "expr ::= nm DOT nm DOT nm",
 /* 181 */ "term ::= INTEGER|FLOAT|BLOB",
 /* 182 */ "term ::= STRING",
 /* 183 */ "expr ::= REGISTER",
 /* 184 */ "expr ::= VARIABLE",
 /* 185 */ "expr ::= expr COLLATE ids",
 /* 186 */ "expr ::= CAST LP expr AS typetoken RP",
 /* 187 */ "expr ::= ID LP distinct exprlist RP",
 /* 188 */ "expr ::= ID LP STAR RP",
 /* 189 */ "term ::= CTIME_KW",
 /* 190 */ "expr ::= expr AND expr",
 /* 191 */ "expr ::= expr OR expr",
 /* 192 */ "expr ::= expr LT|GT|GE|LE expr",
 /* 193 */ "expr ::= expr EQ|NE expr",
 /* 194 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
 /* 195 */ "expr ::= expr PLUS|MINUS expr",
 /* 196 */ "expr ::= expr STAR|SLASH|REM expr",
 /* 197 */ "expr ::= expr CONCAT expr",
 /* 198 */ "likeop ::= LIKE_KW",
 /* 199 */ "likeop ::= NOT LIKE_KW",
 /* 200 */ "likeop ::= MATCH",
 /* 201 */ "likeop ::= NOT MATCH",
 /* 202 */ "escape ::= ESCAPE expr",
 /* 203 */ "escape ::=",
 /* 204 */ "expr ::= expr likeop expr escape",
 /* 205 */ "expr ::= expr ISNULL|NOTNULL",
 /* 206 */ "expr ::= expr IS NULL",
 /* 207 */ "expr ::= expr NOT NULL",
 /* 208 */ "expr ::= expr IS NOT NULL",
 /* 209 */ "expr ::= NOT expr",
 /* 210 */ "expr ::= BITNOT expr",
 /* 211 */ "expr ::= MINUS expr",
 /* 212 */ "expr ::= PLUS expr",
 /* 213 */ "between_op ::= BETWEEN",
 /* 214 */ "between_op ::= NOT BETWEEN",
 /* 215 */ "expr ::= expr between_op expr AND expr",
 /* 216 */ "in_op ::= IN",
 /* 217 */ "in_op ::= NOT IN",
 /* 218 */ "expr ::= expr in_op LP exprlist RP",
 /* 219 */ "expr ::= LP select RP",
 /* 220 */ "expr ::= expr in_op LP select RP",
 /* 221 */ "expr ::= expr in_op nm dbnm",
 /* 222 */ "expr ::= EXISTS LP select RP",
 /* 223 */ "expr ::= CASE case_operand case_exprlist case_else END",
 /* 224 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
 /* 225 */ "case_exprlist ::= WHEN expr THEN expr",
 /* 226 */ "case_else ::= ELSE expr",
 /* 227 */ "case_else ::=",
 /* 228 */ "case_operand ::= expr",
 /* 229 */ "case_operand ::=",
 /* 230 */ "exprlist ::= nexprlist",
 /* 231 */ "exprlist ::=",
 /* 232 */ "nexprlist ::= nexprlist COMMA expr",
 /* 233 */ "nexprlist ::= expr",
 /* 234 */ "cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP",
 /* 235 */ "uniqueflag ::= UNIQUE",
 /* 236 */ "uniqueflag ::=",
 /* 237 */ "idxlist_opt ::=",
 /* 238 */ "idxlist_opt ::= LP idxlist RP",
 /* 239 */ "idxlist ::= idxlist COMMA idxitem collate sortorder",
 /* 240 */ "idxlist ::= idxitem collate sortorder",
 /* 241 */ "idxitem ::= nm",
 /* 242 */ "collate ::=",
 /* 243 */ "collate ::= COLLATE ids",
 /* 244 */ "cmd ::= DROP INDEX ifexists fullname",
 /* 245 */ "cmd ::= VACUUM",
 /* 246 */ "cmd ::= VACUUM nm",
 /* 247 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
 /* 248 */ "cmd ::= PRAGMA nm dbnm EQ ON",
 /* 249 */ "cmd ::= PRAGMA nm dbnm EQ DELETE",
 /* 250 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
 /* 251 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
 /* 252 */ "cmd ::= PRAGMA nm dbnm",
 /* 253 */ "nmnum ::= plus_num",
 /* 254 */ "nmnum ::= nm",
 /* 255 */ "plus_num ::= plus_opt number",
 /* 256 */ "minus_num ::= MINUS number",
 /* 257 */ "number ::= INTEGER|FLOAT",
 /* 258 */ "plus_opt ::= PLUS",
 /* 259 */ "plus_opt ::=",
 /* 260 */ "cmd ::= CREATE trigger_decl BEGIN trigger_cmd_list END",
 /* 261 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
 /* 262 */ "trigger_time ::= BEFORE",
 /* 263 */ "trigger_time ::= AFTER",
 /* 264 */ "trigger_time ::= INSTEAD OF",
 /* 265 */ "trigger_time ::=",
 /* 266 */ "trigger_event ::= DELETE|INSERT",
 /* 267 */ "trigger_event ::= UPDATE",
 /* 268 */ "trigger_event ::= UPDATE OF inscollist",
 /* 269 */ "foreach_clause ::=",
 /* 270 */ "foreach_clause ::= FOR EACH ROW",
 /* 271 */ "when_clause ::=",
 /* 272 */ "when_clause ::= WHEN expr",
 /* 273 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
 /* 274 */ "trigger_cmd_list ::=",
 /* 275 */ "trigger_cmd ::= UPDATE orconf nm SET setlist where_opt",
 /* 276 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt VALUES LP itemlist RP",
 /* 277 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt select",
 /* 278 */ "trigger_cmd ::= DELETE FROM nm where_opt",
 /* 279 */ "trigger_cmd ::= select",
 /* 280 */ "expr ::= RAISE LP IGNORE RP",
 /* 281 */ "expr ::= RAISE LP raisetype COMMA nm RP",
 /* 282 */ "raisetype ::= ROLLBACK",
 /* 283 */ "raisetype ::= ABORT",
 /* 284 */ "raisetype ::= FAIL",
 /* 285 */ "cmd ::= DROP TRIGGER ifexists fullname",
 /* 286 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
 /* 287 */ "cmd ::= DETACH database_kw_opt expr",
 /* 288 */ "key_opt ::=",
 /* 289 */ "key_opt ::= KEY expr",
 /* 290 */ "database_kw_opt ::= DATABASE",
 /* 291 */ "database_kw_opt ::=",
 /* 292 */ "cmd ::= REINDEX",
 /* 293 */ "cmd ::= REINDEX nm dbnm",
 /* 294 */ "cmd ::= ANALYZE",
 /* 295 */ "cmd ::= ANALYZE nm dbnm",
 /* 296 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
 /* 297 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column",
 /* 298 */ "add_column_fullname ::= fullname",
 /* 299 */ "kwcolumn_opt ::=",
 /* 300 */ "kwcolumn_opt ::= COLUMNKW",
 /* 301 */ "cmd ::= create_vtab",
 /* 302 */ "cmd ::= create_vtab LP vtabarglist RP",
 /* 303 */ "create_vtab ::= CREATE VIRTUAL TABLE nm dbnm USING nm",
 /* 304 */ "vtabarglist ::= vtabarg",
 /* 305 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
 /* 306 */ "vtabarg ::=",
 /* 307 */ "vtabarg ::= vtabarg vtabargtoken",
 /* 308 */ "vtabargtoken ::= ANY",
 /* 309 */ "vtabargtoken ::= lp anylist RP",
 /* 310 */ "lp ::= LP",
 /* 311 */ "anylist ::=",
 /* 312 */ "anylist ::= anylist ANY",
};
#endif /* NDEBUG */


#if YYSTACKDEPTH<=0
/*
** Try to increase the size of the parser stack.
*/
static void yyGrowStack(yyParser *p){
  int newSize;
  yyStackEntry *pNew;

  newSize = p->yystksz*2 + 100;
  pNew = realloc(p->yystack, newSize*sizeof(pNew[0]));
  if( pNew ){
    p->yystack = pNew;
    p->yystksz = newSize;
#ifndef NDEBUG
    if( yyTraceFILE ){
      fprintf(yyTraceFILE,"%sStack grows to %d entries!\n",
              yyTracePrompt, p->yystksz);
    }
#endif
  }
}
#endif

/* 
** This function allocates a new parser.
** The only argument is a pointer to a function which works like
** malloc.
**
** Inputs:
** A pointer to the function used to allocate memory.
**
** Outputs:
** A pointer to a parser.  This pointer is used in subsequent calls
** to sqlite3Parser and sqlite3ParserFree.
*/
void *sqlite3ParserAlloc(void *(*mallocProc)(size_t)){
  yyParser *pParser;
  pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) );
  if( pParser ){
    pParser->yyidx = -1;
#ifdef YYTRACKMAXSTACKDEPTH
    pParser->yyidxMax = 0;
#endif
#if YYSTACKDEPTH<=0
    yyGrowStack(pParser);
#endif
  }
  return pParser;
}

/* The following function deletes the value associated with a
** symbol.  The symbol can be either a terminal or nonterminal.
** "yymajor" is the symbol code, and "yypminor" is a pointer to
** the value.
*/
static void yy_destructor(
  yyParser *yypParser,    /* The parser */
  YYCODETYPE yymajor,     /* Type code for object to destroy */
  YYMINORTYPE *yypminor   /* The object to be destroyed */
){
  sqlite3ParserARG_FETCH;
  switch( yymajor ){
    /* Here is inserted the actions which take place when a
    ** terminal or non-terminal is destroyed.  This can happen
    ** when the symbol is popped from the stack during a
    ** reduce or during error processing or when a parser is 
    ** being destroyed before it is finished parsing.
    **
    ** Note: during a reduce, the only symbols destroyed are those
    ** which appear on the RHS of the rule, but which are not used
    ** inside the C code.
    */
    case 155: /* select */
    case 189: /* oneselect */
    case 206: /* seltablist_paren */
{
#line 369 "parse.y"
sqlite3SelectDelete(pParse->db, (yypminor->yy219));
#line 1289 "parse.c"
}
      break;
    case 169: /* term */
    case 170: /* expr */
    case 194: /* where_opt */
    case 196: /* having_opt */
    case 204: /* on_opt */
    case 210: /* sortitem */
    case 218: /* escape */
    case 221: /* case_operand */
    case 223: /* case_else */
    case 235: /* when_clause */
    case 238: /* key_opt */
{
#line 629 "parse.y"
sqlite3ExprDelete(pParse->db, (yypminor->yy172));
#line 1306 "parse.c"
}
      break;
    case 174: /* idxlist_opt */
    case 182: /* idxlist */
    case 192: /* selcollist */
    case 195: /* groupby_opt */
    case 197: /* orderby_opt */
    case 199: /* sclp */
    case 209: /* sortlist */
    case 211: /* nexprlist */
    case 212: /* setlist */
    case 215: /* itemlist */
    case 216: /* exprlist */
    case 222: /* case_exprlist */
{
#line 887 "parse.y"
sqlite3ExprListDelete(pParse->db, (yypminor->yy174));
#line 1324 "parse.c"
}
      break;
    case 188: /* fullname */
    case 193: /* from */
    case 201: /* seltablist */
    case 202: /* stl_prefix */
{
#line 486 "parse.y"
sqlite3SrcListDelete(pParse->db, (yypminor->yy373));
#line 1334 "parse.c"
}
      break;
    case 205: /* using_opt */
    case 208: /* inscollist */
    case 214: /* inscollist_opt */
{
#line 503 "parse.y"
sqlite3IdListDelete(pParse->db, (yypminor->yy432));
#line 1343 "parse.c"
}
      break;
    case 231: /* trigger_cmd_list */
    case 236: /* trigger_cmd */
{
#line 993 "parse.y"
sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy243));
#line 1351 "parse.c"
}
      break;
    case 233: /* trigger_event */
{
#line 979 "parse.y"
sqlite3IdListDelete(pParse->db, (yypminor->yy370).b);
#line 1358 "parse.c"
}
      break;
    default:  break;   /* If no destructor action specified: do nothing */
  }
}

/*
** Pop the parser's stack once.
**
** If there is a destructor routine associated with the token which
** is popped from the stack, then call it.
**
** Return the major token number for the symbol popped.
*/
static int yy_pop_parser_stack(yyParser *pParser){
  YYCODETYPE yymajor;
  yyStackEntry *yytos = &pParser->yystack[pParser->yyidx];

  if( pParser->yyidx<0 ) return 0;
#ifndef NDEBUG
  if( yyTraceFILE && pParser->yyidx>=0 ){
    fprintf(yyTraceFILE,"%sPopping %s\n",
      yyTracePrompt,
      yyTokenName[yytos->major]);
  }
#endif
  yymajor = yytos->major;
  yy_destructor(pParser, yymajor, &yytos->minor);
  pParser->yyidx--;
  return yymajor;
}

/* 
** Deallocate and destroy a parser.  Destructors are all called for
** all stack elements before shutting the parser down.
**
** Inputs:
** <ul>
** <li>  A pointer to the parser.  This should be a pointer
**       obtained from sqlite3ParserAlloc.
** <li>  A pointer to a function used to reclaim memory obtained
**       from malloc.
** </ul>
*/
void sqlite3ParserFree(
  void *p,                    /* The parser to be deleted */
  void (*freeProc)(void*)     /* Function used to reclaim memory */
){
  yyParser *pParser = (yyParser*)p;
  if( pParser==0 ) return;
  while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser);
#if YYSTACKDEPTH<=0
  free(pParser->yystack);
#endif
  (*freeProc)((void*)pParser);
}

/*
** Return the peak depth of the stack for a parser.
*/
#ifdef YYTRACKMAXSTACKDEPTH
int sqlite3ParserStackPeak(void *p){
  yyParser *pParser = (yyParser*)p;
  return pParser->yyidxMax;
}
#endif

/*
** Find the appropriate action for a parser given the terminal
** look-ahead token iLookAhead.
**
** If the look-ahead token is YYNOCODE, then check to see if the action is
** independent of the look-ahead.  If it is, return the action, otherwise
** return YY_NO_ACTION.
*/
static int yy_find_shift_action(
  yyParser *pParser,        /* The parser */
  YYCODETYPE iLookAhead     /* The look-ahead token */
){
  int i;
  int stateno = pParser->yystack[pParser->yyidx].stateno;
 
  if( stateno>YY_SHIFT_MAX || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){
    return yy_default[stateno];
  }
  assert( iLookAhead!=YYNOCODE );
  i += iLookAhead;
  if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
    if( iLookAhead>0 ){
#ifdef YYFALLBACK
      int iFallback;            /* Fallback token */
      if( iLookAhead<sizeof(yyFallback)/sizeof(yyFallback[0])
             && (iFallback = yyFallback[iLookAhead])!=0 ){
#ifndef NDEBUG
        if( yyTraceFILE ){
          fprintf(yyTraceFILE, "%sFALLBACK %s => %s\n",
             yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]);
        }
#endif
        return yy_find_shift_action(pParser, iFallback);
      }
#endif
#ifdef YYWILDCARD
      {
        int j = i - iLookAhead + YYWILDCARD;
        if( j>=0 && j<YY_SZ_ACTTAB && yy_lookahead[j]==YYWILDCARD ){
#ifndef NDEBUG
          if( yyTraceFILE ){
            fprintf(yyTraceFILE, "%sWILDCARD %s => %s\n",
               yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]);
          }
#endif /* NDEBUG */
          return yy_action[j];
        }
      }
#endif /* YYWILDCARD */
    }
    return yy_default[stateno];
  }else{
    return yy_action[i];
  }
}

/*
** Find the appropriate action for a parser given the non-terminal
** look-ahead token iLookAhead.
**
** If the look-ahead token is YYNOCODE, then check to see if the action is
** independent of the look-ahead.  If it is, return the action, otherwise
** return YY_NO_ACTION.
*/
static int yy_find_reduce_action(
  int stateno,              /* Current state number */
  YYCODETYPE iLookAhead     /* The look-ahead token */
){
  int i;
#ifdef YYERRORSYMBOL
  if( stateno>YY_REDUCE_MAX ){
    return yy_default[stateno];
  }
#else
  assert( stateno<=YY_REDUCE_MAX );
#endif
  i = yy_reduce_ofst[stateno];
  assert( i!=YY_REDUCE_USE_DFLT );
  assert( iLookAhead!=YYNOCODE );
  i += iLookAhead;
#ifdef YYERRORSYMBOL
  if( i<0 || i>=YY_SZ_ACTTAB || yy_lookahead[i]!=iLookAhead ){
    return yy_default[stateno];
  }
#else
  assert( i>=0 && i<YY_SZ_ACTTAB );
  assert( yy_lookahead[i]==iLookAhead );
#endif
  return yy_action[i];
}

/*
** The following routine is called if the stack overflows.
*/
static void yyStackOverflow(yyParser *yypParser, YYMINORTYPE *yypMinor){
   sqlite3ParserARG_FETCH;
   yypParser->yyidx--;
#ifndef NDEBUG
   if( yyTraceFILE ){
     fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt);
   }
#endif
   while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
   /* Here code is inserted which will execute if the parser
   ** stack every overflows */
#line 39 "parse.y"

  sqlite3ErrorMsg(pParse, "parser stack overflow");
  pParse->parseError = 1;
#line 1536 "parse.c"
   sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument var */
}

/*
** Perform a shift action.
*/
static void yy_shift(
  yyParser *yypParser,          /* The parser to be shifted */
  int yyNewState,               /* The new state to shift in */
  int yyMajor,                  /* The major token to shift in */
  YYMINORTYPE *yypMinor         /* Pointer to the minor token to shift in */
){
  yyStackEntry *yytos;
  yypParser->yyidx++;
#ifdef YYTRACKMAXSTACKDEPTH
  if( yypParser->yyidx>yypParser->yyidxMax ){
    yypParser->yyidxMax = yypParser->yyidx;
  }
#endif
#if YYSTACKDEPTH>0 
  if( yypParser->yyidx>=YYSTACKDEPTH ){
    yyStackOverflow(yypParser, yypMinor);
    return;
  }
#else
  if( yypParser->yyidx>=yypParser->yystksz ){
    yyGrowStack(yypParser);
    if( yypParser->yyidx>=yypParser->yystksz ){
      yyStackOverflow(yypParser, yypMinor);
      return;
    }
  }
#endif
  yytos = &yypParser->yystack[yypParser->yyidx];
  yytos->stateno = yyNewState;
  yytos->major = yyMajor;
  yytos->minor = *yypMinor;
#ifndef NDEBUG
  if( yyTraceFILE && yypParser->yyidx>0 ){
    int i;
    fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState);
    fprintf(yyTraceFILE,"%sStack:",yyTracePrompt);
    for(i=1; i<=yypParser->yyidx; i++)
      fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]);
    fprintf(yyTraceFILE,"\n");
  }
#endif
}

/* The following table contains information about every rule that
** is used during the reduce.
*/
static const struct {
  YYCODETYPE lhs;         /* Symbol on the left-hand side of the rule */
  unsigned char nrhs;     /* Number of right-hand side symbols in the rule */
} yyRuleInfo[] = {
  { 139, 1 },
  { 140, 2 },
  { 140, 1 },
  { 142, 1 },
  { 141, 1 },
  { 141, 3 },
  { 144, 0 },
  { 144, 1 },
  { 144, 3 },
  { 143, 3 },
  { 146, 0 },
  { 146, 1 },
  { 146, 2 },
  { 145, 0 },
  { 145, 1 },
  { 145, 1 },
  { 145, 1 },
  { 143, 2 },
  { 143, 2 },
  { 143, 2 },
  { 143, 2 },
  { 148, 6 },
  { 151, 0 },
  { 151, 3 },
  { 150, 1 },
  { 150, 0 },
  { 149, 4 },
  { 149, 2 },
  { 153, 3 },
  { 153, 1 },
  { 156, 3 },
  { 157, 1 },
  { 160, 1 },
  { 161, 1 },
  { 147, 1 },
  { 147, 1 },
  { 147, 1 },
  { 158, 0 },
  { 158, 1 },
  { 162, 1 },
  { 162, 4 },
  { 162, 6 },
  { 163, 1 },
  { 163, 2 },
  { 164, 1 },
  { 164, 1 },
  { 159, 2 },
  { 159, 0 },
  { 167, 3 },
  { 167, 1 },
  { 168, 2 },
  { 168, 4 },
  { 168, 3 },
  { 168, 3 },
  { 168, 2 },
  { 168, 2 },
  { 168, 3 },
  { 168, 5 },
  { 168, 2 },
  { 168, 4 },
  { 168, 4 },
  { 168, 1 },
  { 168, 2 },
  { 173, 0 },
  { 173, 1 },
  { 175, 0 },
  { 175, 2 },
  { 177, 2 },
  { 177, 3 },
  { 177, 3 },
  { 177, 3 },
  { 178, 2 },
  { 178, 2 },
  { 178, 1 },
  { 178, 1 },
  { 176, 3 },
  { 176, 2 },
  { 179, 0 },
  { 179, 2 },
  { 179, 2 },
  { 154, 0 },
  { 154, 2 },
  { 180, 3 },
  { 180, 2 },
  { 180, 1 },
  { 181, 2 },
  { 181, 7 },
  { 181, 5 },
  { 181, 5 },
  { 181, 10 },
  { 183, 0 },
  { 183, 1 },
  { 171, 0 },
  { 171, 3 },
  { 184, 0 },
  { 184, 2 },
  { 185, 1 },
  { 185, 1 },
  { 185, 1 },
  { 143, 4 },
  { 187, 2 },
  { 187, 0 },
  { 143, 8 },
  { 143, 4 },
  { 143, 1 },
  { 155, 1 },
  { 155, 3 },
  { 190, 1 },
  { 190, 2 },
  { 190, 1 },
  { 189, 9 },
  { 191, 1 },
  { 191, 1 },
  { 191, 0 },
  { 199, 2 },
  { 199, 0 },
  { 192, 3 },
  { 192, 2 },
  { 192, 4 },
  { 200, 2 },
  { 200, 1 },
  { 200, 0 },
  { 193, 0 },
  { 193, 2 },
  { 202, 2 },
  { 202, 0 },
  { 201, 6 },
  { 201, 7 },
  { 206, 1 },
  { 206, 1 },
  { 152, 0 },
  { 152, 2 },
  { 188, 2 },
  { 203, 1 },
  { 203, 2 },
  { 203, 3 },
  { 203, 4 },
  { 204, 2 },
  { 204, 0 },
  { 205, 4 },
  { 205, 0 },
  { 197, 0 },
  { 197, 3 },
  { 209, 4 },
  { 209, 2 },
  { 210, 1 },
  { 172, 1 },
  { 172, 1 },
  { 172, 0 },
  { 195, 0 },
  { 195, 3 },
  { 196, 0 },
  { 196, 2 },
  { 198, 0 },
  { 198, 2 },
  { 198, 4 },
  { 198, 4 },
  { 143, 4 },
  { 194, 0 },
  { 194, 2 },
  { 143, 6 },
  { 212, 5 },
  { 212, 3 },
  { 143, 8 },
  { 143, 5 },
  { 143, 6 },
  { 213, 2 },
  { 213, 1 },
  { 215, 3 },
  { 215, 1 },
  { 214, 0 },
  { 214, 3 },
  { 208, 3 },
  { 208, 1 },
  { 170, 1 },
  { 170, 3 },
  { 169, 1 },
  { 170, 1 },
  { 170, 1 },
  { 170, 3 },
  { 170, 5 },
  { 169, 1 },
  { 169, 1 },
  { 170, 1 },
  { 170, 1 },
  { 170, 3 },
  { 170, 6 },
  { 170, 5 },
  { 170, 4 },
  { 169, 1 },
  { 170, 3 },
  { 170, 3 },
  { 170, 3 },
  { 170, 3 },
  { 170, 3 },
  { 170, 3 },
  { 170, 3 },
  { 170, 3 },
  { 217, 1 },
  { 217, 2 },
  { 217, 1 },
  { 217, 2 },
  { 218, 2 },
  { 218, 0 },
  { 170, 4 },
  { 170, 2 },
  { 170, 3 },
  { 170, 3 },
  { 170, 4 },
  { 170, 2 },
  { 170, 2 },
  { 170, 2 },
  { 170, 2 },
  { 219, 1 },
  { 219, 2 },
  { 170, 5 },
  { 220, 1 },
  { 220, 2 },
  { 170, 5 },
  { 170, 3 },
  { 170, 5 },
  { 170, 4 },
  { 170, 4 },
  { 170, 5 },
  { 222, 5 },
  { 222, 4 },
  { 223, 2 },
  { 223, 0 },
  { 221, 1 },
  { 221, 0 },
  { 216, 1 },
  { 216, 0 },
  { 211, 3 },
  { 211, 1 },
  { 143, 11 },
  { 224, 1 },
  { 224, 0 },
  { 174, 0 },
  { 174, 3 },
  { 182, 5 },
  { 182, 3 },
  { 225, 1 },
  { 226, 0 },
  { 226, 2 },
  { 143, 4 },
  { 143, 1 },
  { 143, 2 },
  { 143, 5 },
  { 143, 5 },
  { 143, 5 },
  { 143, 5 },
  { 143, 6 },
  { 143, 3 },
  { 227, 1 },
  { 227, 1 },
  { 165, 2 },
  { 166, 2 },
  { 229, 1 },
  { 228, 1 },
  { 228, 0 },
  { 143, 5 },
  { 230, 11 },
  { 232, 1 },
  { 232, 1 },
  { 232, 2 },
  { 232, 0 },
  { 233, 1 },
  { 233, 1 },
  { 233, 3 },
  { 234, 0 },
  { 234, 3 },
  { 235, 0 },
  { 235, 2 },
  { 231, 3 },
  { 231, 0 },
  { 236, 6 },
  { 236, 8 },
  { 236, 5 },
  { 236, 4 },
  { 236, 1 },
  { 170, 4 },
  { 170, 6 },
  { 186, 1 },
  { 186, 1 },
  { 186, 1 },
  { 143, 4 },
  { 143, 6 },
  { 143, 3 },
  { 238, 0 },
  { 238, 2 },
  { 237, 1 },
  { 237, 0 },
  { 143, 1 },
  { 143, 3 },
  { 143, 1 },
  { 143, 3 },
  { 143, 6 },
  { 143, 6 },
  { 239, 1 },
  { 240, 0 },
  { 240, 1 },
  { 143, 1 },
  { 143, 4 },
  { 241, 7 },
  { 242, 1 },
  { 242, 3 },
  { 243, 0 },
  { 243, 2 },
  { 244, 1 },
  { 244, 3 },
  { 245, 1 },
  { 246, 0 },
  { 246, 2 },
};

static void yy_accept(yyParser*);  /* Forward Declaration */

/*
** Perform a reduce action and the shift that must immediately
** follow the reduce.
*/
static void yy_reduce(
  yyParser *yypParser,         /* The parser */
  int yyruleno                 /* Number of the rule by which to reduce */
){
  int yygoto;                     /* The next state */
  int yyact;                      /* The next action */
  YYMINORTYPE yygotominor;        /* The LHS of the rule reduced */
  yyStackEntry *yymsp;            /* The top of the parser's stack */
  int yysize;                     /* Amount to pop the stack */
  sqlite3ParserARG_FETCH;
  yymsp = &yypParser->yystack[yypParser->yyidx];
#ifndef NDEBUG
  if( yyTraceFILE && yyruleno>=0 
        && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
    fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt,
      yyRuleName[yyruleno]);
  }
#endif /* NDEBUG */

  /* Silence complaints from purify about yygotominor being uninitialized
  ** in some cases when it is copied into the stack after the following
  ** switch.  yygotominor is uninitialized when a rule reduces that does
  ** not set the value of its left-hand side nonterminal.  Leaving the
  ** value of the nonterminal uninitialized is utterly harmless as long
  ** as the value is never used.  So really the only thing this code
  ** accomplishes is to quieten purify.  
  **
  ** 2007-01-16:  The wireshark project (www.wireshark.org) reports that
  ** without this code, their parser segfaults.  I'm not sure what there
  ** parser is doing to make this happen.  This is the second bug report
  ** from wireshark this week.  Clearly they are stressing Lemon in ways
  ** that it has not been previously stressed...  (SQLite ticket #2172)
  */
  /*memset(&yygotominor, 0, sizeof(yygotominor));*/
  yygotominor = yyzerominor;


  switch( yyruleno ){
  /* Beginning here are the reduction cases.  A typical example
  ** follows:
  **   case 0:
  **  #line <lineno> <grammarfile>
  **     { ... }           // User supplied code
  **  #line <lineno> <thisfile>
  **     break;
  */
      case 0: /* input ::= cmdlist */
      case 1: /* cmdlist ::= cmdlist ecmd */
      case 2: /* cmdlist ::= ecmd */
      case 4: /* ecmd ::= SEMI */
      case 5: /* ecmd ::= explain cmdx SEMI */
      case 10: /* trans_opt ::= */
      case 11: /* trans_opt ::= TRANSACTION */
      case 12: /* trans_opt ::= TRANSACTION nm */
      case 20: /* cmd ::= create_table create_table_args */
      case 28: /* columnlist ::= columnlist COMMA column */
      case 29: /* columnlist ::= column */
      case 37: /* type ::= */
      case 44: /* signed ::= plus_num */
      case 45: /* signed ::= minus_num */
      case 46: /* carglist ::= carglist carg */
      case 47: /* carglist ::= */
      case 48: /* carg ::= CONSTRAINT nm ccons */
      case 49: /* carg ::= ccons */
      case 55: /* ccons ::= NULL onconf */
      case 82: /* conslist ::= conslist COMMA tcons */
      case 83: /* conslist ::= conslist tcons */
      case 84: /* conslist ::= tcons */
      case 85: /* tcons ::= CONSTRAINT nm */
      case 258: /* plus_opt ::= PLUS */
      case 259: /* plus_opt ::= */
      case 269: /* foreach_clause ::= */
      case 270: /* foreach_clause ::= FOR EACH ROW */
      case 290: /* database_kw_opt ::= DATABASE */
      case 291: /* database_kw_opt ::= */
      case 299: /* kwcolumn_opt ::= */
      case 300: /* kwcolumn_opt ::= COLUMNKW */
      case 304: /* vtabarglist ::= vtabarg */
      case 305: /* vtabarglist ::= vtabarglist COMMA vtabarg */
      case 307: /* vtabarg ::= vtabarg vtabargtoken */
      case 311: /* anylist ::= */
#line 91 "parse.y"
{
}
#line 1998 "parse.c"
        break;
      case 3: /* cmdx ::= cmd */
#line 94 "parse.y"
{ sqlite3FinishCoding(pParse); }
#line 2003 "parse.c"
        break;
      case 6: /* explain ::= */
#line 97 "parse.y"
{ sqlite3BeginParse(pParse, 0); }
#line 2008 "parse.c"
        break;
      case 7: /* explain ::= EXPLAIN */
#line 99 "parse.y"
{ sqlite3BeginParse(pParse, 1); }
#line 2013 "parse.c"
        break;
      case 8: /* explain ::= EXPLAIN QUERY PLAN */
#line 100 "parse.y"
{ sqlite3BeginParse(pParse, 2); }
#line 2018 "parse.c"
        break;
      case 9: /* cmd ::= BEGIN transtype trans_opt */
#line 106 "parse.y"
{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy46);}
#line 2023 "parse.c"
        break;
      case 13: /* transtype ::= */
#line 111 "parse.y"
{yygotominor.yy46 = TK_DEFERRED;}
#line 2028 "parse.c"
        break;
      case 14: /* transtype ::= DEFERRED */
      case 15: /* transtype ::= IMMEDIATE */
      case 16: /* transtype ::= EXCLUSIVE */
      case 107: /* multiselect_op ::= UNION */
      case 109: /* multiselect_op ::= EXCEPT|INTERSECT */
#line 112 "parse.y"
{yygotominor.yy46 = yymsp[0].major;}
#line 2037 "parse.c"
        break;
      case 17: /* cmd ::= COMMIT trans_opt */
      case 18: /* cmd ::= END trans_opt */
#line 115 "parse.y"
{sqlite3CommitTransaction(pParse);}
#line 2043 "parse.c"
        break;
      case 19: /* cmd ::= ROLLBACK trans_opt */
#line 117 "parse.y"
{sqlite3RollbackTransaction(pParse);}
#line 2048 "parse.c"
        break;
      case 21: /* create_table ::= CREATE temp TABLE ifnotexists nm dbnm */
#line 122 "parse.y"
{
   sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy46,0,0,yymsp[-2].minor.yy46);
}
#line 2055 "parse.c"
        break;
      case 22: /* ifnotexists ::= */
      case 25: /* temp ::= */
      case 63: /* autoinc ::= */
      case 77: /* init_deferred_pred_opt ::= */
      case 79: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
      case 90: /* defer_subclause_opt ::= */
      case 101: /* ifexists ::= */
      case 112: /* distinct ::= ALL */
      case 113: /* distinct ::= */
      case 213: /* between_op ::= BETWEEN */
      case 216: /* in_op ::= IN */
#line 126 "parse.y"
{yygotominor.yy46 = 0;}
#line 2070 "parse.c"
        break;
      case 23: /* ifnotexists ::= IF NOT EXISTS */
      case 24: /* temp ::= TEMP */
      case 64: /* autoinc ::= AUTOINCR */
      case 78: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
      case 100: /* ifexists ::= IF EXISTS */
      case 111: /* distinct ::= DISTINCT */
      case 214: /* between_op ::= NOT BETWEEN */
      case 217: /* in_op ::= NOT IN */
#line 127 "parse.y"
{yygotominor.yy46 = 1;}
#line 2082 "parse.c"
        break;
      case 26: /* create_table_args ::= LP columnlist conslist_opt RP */
#line 133 "parse.y"
{
  sqlite3EndTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0);
}
#line 2089 "parse.c"
        break;
      case 27: /* create_table_args ::= AS select */
#line 136 "parse.y"
{
  sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy219);
  sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy219);
}
#line 2097 "parse.c"
        break;
      case 30: /* column ::= columnid type carglist */
#line 148 "parse.y"
{
  yygotominor.yy0.z = yymsp[-2].minor.yy0.z;
  yygotominor.yy0.n = (pParse->sLastToken.z-yymsp[-2].minor.yy0.z) + pParse->sLastToken.n;
}
#line 2105 "parse.c"
        break;
      case 31: /* columnid ::= nm */
#line 152 "parse.y"
{
  sqlite3AddColumn(pParse,&yymsp[0].minor.yy0);
  yygotominor.yy0 = yymsp[0].minor.yy0;
}
#line 2113 "parse.c"
        break;
      case 32: /* id ::= ID */
      case 33: /* ids ::= ID|STRING */
      case 34: /* nm ::= ID */
      case 35: /* nm ::= STRING */
      case 36: /* nm ::= JOIN_KW */
      case 39: /* typetoken ::= typename */
      case 42: /* typename ::= ids */
      case 119: /* as ::= AS nm */
      case 120: /* as ::= ids */
      case 131: /* dbnm ::= DOT nm */
      case 241: /* idxitem ::= nm */
      case 243: /* collate ::= COLLATE ids */
      case 253: /* nmnum ::= plus_num */
      case 254: /* nmnum ::= nm */
      case 255: /* plus_num ::= plus_opt number */
      case 256: /* minus_num ::= MINUS number */
      case 257: /* number ::= INTEGER|FLOAT */
#line 162 "parse.y"
{yygotominor.yy0 = yymsp[0].minor.yy0;}
#line 2134 "parse.c"
        break;
      case 38: /* type ::= typetoken */
#line 223 "parse.y"
{sqlite3AddColumnType(pParse,&yymsp[0].minor.yy0);}
#line 2139 "parse.c"
        break;
      case 40: /* typetoken ::= typename LP signed RP */
#line 225 "parse.y"
{
  yygotominor.yy0.z = yymsp[-3].minor.yy0.z;
  yygotominor.yy0.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z;
}
#line 2147 "parse.c"
        break;
      case 41: /* typetoken ::= typename LP signed COMMA signed RP */
#line 229 "parse.y"
{
  yygotominor.yy0.z = yymsp[-5].minor.yy0.z;
  yygotominor.yy0.n = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy0.z;
}
#line 2155 "parse.c"
        break;
      case 43: /* typename ::= typename ids */
#line 235 "parse.y"
{yygotominor.yy0.z=yymsp[-1].minor.yy0.z; yygotominor.yy0.n=yymsp[0].minor.yy0.n+(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
#line 2160 "parse.c"
        break;
      case 50: /* ccons ::= DEFAULT term */
      case 52: /* ccons ::= DEFAULT PLUS term */
#line 246 "parse.y"
{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy172);}
#line 2166 "parse.c"
        break;
      case 51: /* ccons ::= DEFAULT LP expr RP */
#line 247 "parse.y"
{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy172);}
#line 2171 "parse.c"
        break;
      case 53: /* ccons ::= DEFAULT MINUS term */
#line 249 "parse.y"
{
  Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy172, 0, 0);
  sqlite3AddDefaultValue(pParse,p);
}
#line 2179 "parse.c"
        break;
      case 54: /* ccons ::= DEFAULT id */
#line 253 "parse.y"
{
  Expr *p = sqlite3PExpr(pParse, TK_STRING, 0, 0, &yymsp[0].minor.yy0);
  sqlite3AddDefaultValue(pParse,p);
}
#line 2187 "parse.c"
        break;
      case 56: /* ccons ::= NOT NULL onconf */
#line 262 "parse.y"
{sqlite3AddNotNull(pParse, yymsp[0].minor.yy46);}
#line 2192 "parse.c"
        break;
      case 57: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
#line 264 "parse.y"
{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy46,yymsp[0].minor.yy46,yymsp[-2].minor.yy46);}
#line 2197 "parse.c"
        break;
      case 58: /* ccons ::= UNIQUE onconf */
#line 265 "parse.y"
{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy46,0,0,0,0);}
#line 2202 "parse.c"
        break;
      case 59: /* ccons ::= CHECK LP expr RP */
#line 266 "parse.y"
{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy172);}
#line 2207 "parse.c"
        break;
      case 60: /* ccons ::= REFERENCES nm idxlist_opt refargs */
#line 268 "parse.y"
{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy174,yymsp[0].minor.yy46);}
#line 2212 "parse.c"
        break;
      case 61: /* ccons ::= defer_subclause */
#line 269 "parse.y"
{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy46);}
#line 2217 "parse.c"
        break;
      case 62: /* ccons ::= COLLATE ids */
#line 270 "parse.y"
{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
#line 2222 "parse.c"
        break;
      case 65: /* refargs ::= */
#line 283 "parse.y"
{ yygotominor.yy46 = OE_Restrict * 0x010101; }
#line 2227 "parse.c"
        break;
      case 66: /* refargs ::= refargs refarg */
#line 284 "parse.y"
{ yygotominor.yy46 = (yymsp[-1].minor.yy46 & yymsp[0].minor.yy405.mask) | yymsp[0].minor.yy405.value; }
#line 2232 "parse.c"
        break;
      case 67: /* refarg ::= MATCH nm */
#line 286 "parse.y"
{ yygotominor.yy405.value = 0;     yygotominor.yy405.mask = 0x000000; }
#line 2237 "parse.c"
        break;
      case 68: /* refarg ::= ON DELETE refact */
#line 287 "parse.y"
{ yygotominor.yy405.value = yymsp[0].minor.yy46;     yygotominor.yy405.mask = 0x0000ff; }
#line 2242 "parse.c"
        break;
      case 69: /* refarg ::= ON UPDATE refact */
#line 288 "parse.y"
{ yygotominor.yy405.value = yymsp[0].minor.yy46<<8;  yygotominor.yy405.mask = 0x00ff00; }
#line 2247 "parse.c"
        break;
      case 70: /* refarg ::= ON INSERT refact */
#line 289 "parse.y"
{ yygotominor.yy405.value = yymsp[0].minor.yy46<<16; yygotominor.yy405.mask = 0xff0000; }
#line 2252 "parse.c"
        break;
      case 71: /* refact ::= SET NULL */
#line 291 "parse.y"
{ yygotominor.yy46 = OE_SetNull; }
#line 2257 "parse.c"
        break;
      case 72: /* refact ::= SET DEFAULT */
#line 292 "parse.y"
{ yygotominor.yy46 = OE_SetDflt; }
#line 2262 "parse.c"
        break;
      case 73: /* refact ::= CASCADE */
#line 293 "parse.y"
{ yygotominor.yy46 = OE_Cascade; }
#line 2267 "parse.c"
        break;
      case 74: /* refact ::= RESTRICT */
#line 294 "parse.y"
{ yygotominor.yy46 = OE_Restrict; }
#line 2272 "parse.c"
        break;
      case 75: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
      case 76: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
      case 91: /* defer_subclause_opt ::= defer_subclause */
      case 93: /* onconf ::= ON CONFLICT resolvetype */
      case 95: /* orconf ::= OR resolvetype */
      case 96: /* resolvetype ::= raisetype */
      case 166: /* insert_cmd ::= INSERT orconf */
#line 296 "parse.y"
{yygotominor.yy46 = yymsp[0].minor.yy46;}
#line 2283 "parse.c"
        break;
      case 80: /* conslist_opt ::= */
#line 306 "parse.y"
{yygotominor.yy0.n = 0; yygotominor.yy0.z = 0;}
#line 2288 "parse.c"
        break;
      case 81: /* conslist_opt ::= COMMA conslist */
#line 307 "parse.y"
{yygotominor.yy0 = yymsp[-1].minor.yy0;}
#line 2293 "parse.c"
        break;
      case 86: /* tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf */
#line 313 "parse.y"
{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy174,yymsp[0].minor.yy46,yymsp[-2].minor.yy46,0);}
#line 2298 "parse.c"
        break;
      case 87: /* tcons ::= UNIQUE LP idxlist RP onconf */
#line 315 "parse.y"
{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy174,yymsp[0].minor.yy46,0,0,0,0);}
#line 2303 "parse.c"
        break;
      case 88: /* tcons ::= CHECK LP expr RP onconf */
#line 316 "parse.y"
{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy172);}
#line 2308 "parse.c"
        break;
      case 89: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt */
#line 318 "parse.y"
{
    sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy174, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy174, yymsp[-1].minor.yy46);
    sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy46);
}
#line 2316 "parse.c"
        break;
      case 92: /* onconf ::= */
      case 94: /* orconf ::= */
#line 332 "parse.y"
{yygotominor.yy46 = OE_Default;}
#line 2322 "parse.c"
        break;
      case 97: /* resolvetype ::= IGNORE */
#line 337 "parse.y"
{yygotominor.yy46 = OE_Ignore;}
#line 2327 "parse.c"
        break;
      case 98: /* resolvetype ::= REPLACE */
      case 167: /* insert_cmd ::= REPLACE */
#line 338 "parse.y"
{yygotominor.yy46 = OE_Replace;}
#line 2333 "parse.c"
        break;
      case 99: /* cmd ::= DROP TABLE ifexists fullname */
#line 342 "parse.y"
{
  sqlite3DropTable(pParse, yymsp[0].minor.yy373, 0, yymsp[-1].minor.yy46);
}
#line 2340 "parse.c"
        break;
      case 102: /* cmd ::= CREATE temp VIEW ifnotexists nm dbnm AS select */
#line 352 "parse.y"
{
  sqlite3CreateView(pParse, &yymsp[-7].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, yymsp[0].minor.yy219, yymsp[-6].minor.yy46, yymsp[-4].minor.yy46);
}
#line 2347 "parse.c"
        break;
      case 103: /* cmd ::= DROP VIEW ifexists fullname */
#line 355 "parse.y"
{
  sqlite3DropTable(pParse, yymsp[0].minor.yy373, 1, yymsp[-1].minor.yy46);
}
#line 2354 "parse.c"
        break;
      case 104: /* cmd ::= select */
#line 362 "parse.y"
{
  SelectDest dest = {SRT_Callback, 0, 0, 0, 0};
  sqlite3Select(pParse, yymsp[0].minor.yy219, &dest, 0, 0, 0);
  sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy219);
}
#line 2363 "parse.c"
        break;
      case 105: /* select ::= oneselect */
      case 128: /* seltablist_paren ::= select */
#line 373 "parse.y"
{yygotominor.yy219 = yymsp[0].minor.yy219;}
#line 2369 "parse.c"
        break;
      case 106: /* select ::= select multiselect_op oneselect */
#line 375 "parse.y"
{
  if( yymsp[0].minor.yy219 ){
    yymsp[0].minor.yy219->op = yymsp[-1].minor.yy46;
    yymsp[0].minor.yy219->pPrior = yymsp[-2].minor.yy219;
  }else{
    sqlite3SelectDelete(pParse->db, yymsp[-2].minor.yy219);
  }
  yygotominor.yy219 = yymsp[0].minor.yy219;
}
#line 2382 "parse.c"
        break;
      case 108: /* multiselect_op ::= UNION ALL */
#line 386 "parse.y"
{yygotominor.yy46 = TK_ALL;}
#line 2387 "parse.c"
        break;
      case 110: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
#line 390 "parse.y"
{
  yygotominor.yy219 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy174,yymsp[-5].minor.yy373,yymsp[-4].minor.yy172,yymsp[-3].minor.yy174,yymsp[-2].minor.yy172,yymsp[-1].minor.yy174,yymsp[-7].minor.yy46,yymsp[0].minor.yy234.pLimit,yymsp[0].minor.yy234.pOffset);
}
#line 2394 "parse.c"
        break;
      case 114: /* sclp ::= selcollist COMMA */
      case 238: /* idxlist_opt ::= LP idxlist RP */
#line 411 "parse.y"
{yygotominor.yy174 = yymsp[-1].minor.yy174;}
#line 2400 "parse.c"
        break;
      case 115: /* sclp ::= */
      case 141: /* orderby_opt ::= */
      case 149: /* groupby_opt ::= */
      case 231: /* exprlist ::= */
      case 237: /* idxlist_opt ::= */
#line 412 "parse.y"
{yygotominor.yy174 = 0;}
#line 2409 "parse.c"
        break;
      case 116: /* selcollist ::= sclp expr as */
#line 413 "parse.y"
{
   yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy174,yymsp[-1].minor.yy172,yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0);
}
#line 2416 "parse.c"
        break;
      case 117: /* selcollist ::= sclp STAR */
#line 416 "parse.y"
{
  Expr *p = sqlite3PExpr(pParse, TK_ALL, 0, 0, 0);
  yygotominor.yy174 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy174, p, 0);
}
#line 2424 "parse.c"
        break;
      case 118: /* selcollist ::= sclp nm DOT STAR */
#line 420 "parse.y"
{
  Expr *pRight = sqlite3PExpr(pParse, TK_ALL, 0, 0, &yymsp[0].minor.yy0);
  Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
  Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0);
  yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy174, pDot, 0);
}
#line 2434 "parse.c"
        break;
      case 121: /* as ::= */
#line 433 "parse.y"
{yygotominor.yy0.n = 0;}
#line 2439 "parse.c"
        break;
      case 122: /* from ::= */
#line 445 "parse.y"
{yygotominor.yy373 = sqlite3DbMallocZero(pParse->db, sizeof(*yygotominor.yy373));}
#line 2444 "parse.c"
        break;
      case 123: /* from ::= FROM seltablist */
#line 446 "parse.y"
{
  yygotominor.yy373 = yymsp[0].minor.yy373;
  sqlite3SrcListShiftJoinType(yygotominor.yy373);
}
#line 2452 "parse.c"
        break;
      case 124: /* stl_prefix ::= seltablist joinop */
#line 454 "parse.y"
{
   yygotominor.yy373 = yymsp[-1].minor.yy373;
   if( yygotominor.yy373 && yygotominor.yy373->nSrc>0 ) yygotominor.yy373->a[yygotominor.yy373->nSrc-1].jointype = yymsp[0].minor.yy46;
}
#line 2460 "parse.c"
        break;
      case 125: /* stl_prefix ::= */
#line 458 "parse.y"
{yygotominor.yy373 = 0;}
#line 2465 "parse.c"
        break;
      case 126: /* seltablist ::= stl_prefix nm dbnm as on_opt using_opt */
#line 459 "parse.y"
{
  yygotominor.yy373 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-5].minor.yy373,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy172,yymsp[0].minor.yy432);
}
#line 2472 "parse.c"
        break;
      case 127: /* seltablist ::= stl_prefix LP seltablist_paren RP as on_opt using_opt */
#line 464 "parse.y"
{
    yygotominor.yy373 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy373,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy219,yymsp[-1].minor.yy172,yymsp[0].minor.yy432);
  }
#line 2479 "parse.c"
        break;
      case 129: /* seltablist_paren ::= seltablist */
#line 475 "parse.y"
{
     sqlite3SrcListShiftJoinType(yymsp[0].minor.yy373);
     yygotominor.yy219 = sqlite3SelectNew(pParse,0,yymsp[0].minor.yy373,0,0,0,0,0,0,0);
  }
#line 2487 "parse.c"
        break;
      case 130: /* dbnm ::= */
#line 482 "parse.y"
{yygotominor.yy0.z=0; yygotominor.yy0.n=0;}
#line 2492 "parse.c"
        break;
      case 132: /* fullname ::= nm dbnm */
#line 487 "parse.y"
{yygotominor.yy373 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
#line 2497 "parse.c"
        break;
      case 133: /* joinop ::= COMMA|JOIN */
#line 491 "parse.y"
{ yygotominor.yy46 = JT_INNER; }
#line 2502 "parse.c"
        break;
      case 134: /* joinop ::= JOIN_KW JOIN */
#line 492 "parse.y"
{ yygotominor.yy46 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); }
#line 2507 "parse.c"
        break;
      case 135: /* joinop ::= JOIN_KW nm JOIN */
#line 493 "parse.y"
{ yygotominor.yy46 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); }
#line 2512 "parse.c"
        break;
      case 136: /* joinop ::= JOIN_KW nm nm JOIN */
#line 495 "parse.y"
{ yygotominor.yy46 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); }
#line 2517 "parse.c"
        break;
      case 137: /* on_opt ::= ON expr */
      case 145: /* sortitem ::= expr */
      case 152: /* having_opt ::= HAVING expr */
      case 159: /* where_opt ::= WHERE expr */
      case 174: /* expr ::= term */
      case 202: /* escape ::= ESCAPE expr */
      case 226: /* case_else ::= ELSE expr */
      case 228: /* case_operand ::= expr */
#line 499 "parse.y"
{yygotominor.yy172 = yymsp[0].minor.yy172;}
#line 2529 "parse.c"
        break;
      case 138: /* on_opt ::= */
      case 151: /* having_opt ::= */
      case 158: /* where_opt ::= */
      case 203: /* escape ::= */
      case 227: /* case_else ::= */
      case 229: /* case_operand ::= */
#line 500 "parse.y"
{yygotominor.yy172 = 0;}
#line 2539 "parse.c"
        break;
      case 139: /* using_opt ::= USING LP inscollist RP */
      case 171: /* inscollist_opt ::= LP inscollist RP */
#line 504 "parse.y"
{yygotominor.yy432 = yymsp[-1].minor.yy432;}
#line 2545 "parse.c"
        break;
      case 140: /* using_opt ::= */
      case 170: /* inscollist_opt ::= */
#line 505 "parse.y"
{yygotominor.yy432 = 0;}
#line 2551 "parse.c"
        break;
      case 142: /* orderby_opt ::= ORDER BY sortlist */
      case 150: /* groupby_opt ::= GROUP BY nexprlist */
      case 230: /* exprlist ::= nexprlist */
#line 516 "parse.y"
{yygotominor.yy174 = yymsp[0].minor.yy174;}
#line 2558 "parse.c"
        break;
      case 143: /* sortlist ::= sortlist COMMA sortitem sortorder */
#line 517 "parse.y"
{
  yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy174,yymsp[-1].minor.yy172,0);
  if( yygotominor.yy174 ) yygotominor.yy174->a[yygotominor.yy174->nExpr-1].sortOrder = yymsp[0].minor.yy46;
}
#line 2566 "parse.c"
        break;
      case 144: /* sortlist ::= sortitem sortorder */
#line 521 "parse.y"
{
  yygotominor.yy174 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy172,0);
  if( yygotominor.yy174 && yygotominor.yy174->a ) yygotominor.yy174->a[0].sortOrder = yymsp[0].minor.yy46;
}
#line 2574 "parse.c"
        break;
      case 146: /* sortorder ::= ASC */
      case 148: /* sortorder ::= */
#line 529 "parse.y"
{yygotominor.yy46 = SQLITE_SO_ASC;}
#line 2580 "parse.c"
        break;
      case 147: /* sortorder ::= DESC */
#line 530 "parse.y"
{yygotominor.yy46 = SQLITE_SO_DESC;}
#line 2585 "parse.c"
        break;
      case 153: /* limit_opt ::= */
#line 556 "parse.y"
{yygotominor.yy234.pLimit = 0; yygotominor.yy234.pOffset = 0;}
#line 2590 "parse.c"
        break;
      case 154: /* limit_opt ::= LIMIT expr */
#line 557 "parse.y"
{yygotominor.yy234.pLimit = yymsp[0].minor.yy172; yygotominor.yy234.pOffset = 0;}
#line 2595 "parse.c"
        break;
      case 155: /* limit_opt ::= LIMIT expr OFFSET expr */
#line 559 "parse.y"
{yygotominor.yy234.pLimit = yymsp[-2].minor.yy172; yygotominor.yy234.pOffset = yymsp[0].minor.yy172;}
#line 2600 "parse.c"
        break;
      case 156: /* limit_opt ::= LIMIT expr COMMA expr */
#line 561 "parse.y"
{yygotominor.yy234.pOffset = yymsp[-2].minor.yy172; yygotominor.yy234.pLimit = yymsp[0].minor.yy172;}
#line 2605 "parse.c"
        break;
      case 157: /* cmd ::= DELETE FROM fullname where_opt */
#line 565 "parse.y"
{sqlite3DeleteFrom(pParse,yymsp[-1].minor.yy373,yymsp[0].minor.yy172);}
#line 2610 "parse.c"
        break;
      case 160: /* cmd ::= UPDATE orconf fullname SET setlist where_opt */
#line 575 "parse.y"
{
  sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy174,"set list"); 
  sqlite3Update(pParse,yymsp[-3].minor.yy373,yymsp[-1].minor.yy174,yymsp[0].minor.yy172,yymsp[-4].minor.yy46);
}
#line 2618 "parse.c"
        break;
      case 161: /* setlist ::= setlist COMMA nm EQ expr */
#line 584 "parse.y"
{yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy174,yymsp[0].minor.yy172,&yymsp[-2].minor.yy0);}
#line 2623 "parse.c"
        break;
      case 162: /* setlist ::= nm EQ expr */
#line 586 "parse.y"
{yygotominor.yy174 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy172,&yymsp[-2].minor.yy0);}
#line 2628 "parse.c"
        break;
      case 163: /* cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP */
#line 592 "parse.y"
{sqlite3Insert(pParse, yymsp[-5].minor.yy373, yymsp[-1].minor.yy174, 0, yymsp[-4].minor.yy432, yymsp[-7].minor.yy46);}
#line 2633 "parse.c"
        break;
      case 164: /* cmd ::= insert_cmd INTO fullname inscollist_opt select */
#line 594 "parse.y"
{sqlite3Insert(pParse, yymsp[-2].minor.yy373, 0, yymsp[0].minor.yy219, yymsp[-1].minor.yy432, yymsp[-4].minor.yy46);}
#line 2638 "parse.c"
        break;
      case 165: /* cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES */
#line 596 "parse.y"
{sqlite3Insert(pParse, yymsp[-3].minor.yy373, 0, 0, yymsp[-2].minor.yy432, yymsp[-5].minor.yy46);}
#line 2643 "parse.c"
        break;
      case 168: /* itemlist ::= itemlist COMMA expr */
      case 232: /* nexprlist ::= nexprlist COMMA expr */
#line 607 "parse.y"
{yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy174,yymsp[0].minor.yy172,0);}
#line 2649 "parse.c"
        break;
      case 169: /* itemlist ::= expr */
      case 233: /* nexprlist ::= expr */
#line 609 "parse.y"
{yygotominor.yy174 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy172,0);}
#line 2655 "parse.c"
        break;
      case 172: /* inscollist ::= inscollist COMMA nm */
#line 619 "parse.y"
{yygotominor.yy432 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy432,&yymsp[0].minor.yy0);}
#line 2660 "parse.c"
        break;
      case 173: /* inscollist ::= nm */
#line 621 "parse.y"
{yygotominor.yy432 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0);}
#line 2665 "parse.c"
        break;
      case 175: /* expr ::= LP expr RP */
#line 632 "parse.y"
{yygotominor.yy172 = yymsp[-1].minor.yy172; sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); }
#line 2670 "parse.c"
        break;
      case 176: /* term ::= NULL */
      case 181: /* term ::= INTEGER|FLOAT|BLOB */
      case 182: /* term ::= STRING */
#line 633 "parse.y"
{yygotominor.yy172 = sqlite3PExpr(pParse, yymsp[0].major, 0, 0, &yymsp[0].minor.yy0);}
#line 2677 "parse.c"
        break;
      case 177: /* expr ::= ID */
      case 178: /* expr ::= JOIN_KW */
#line 634 "parse.y"
{yygotominor.yy172 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);}
#line 2683 "parse.c"
        break;
      case 179: /* expr ::= nm DOT nm */
#line 636 "parse.y"
{
  Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
  Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);
  yygotominor.yy172 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0);
}
#line 2692 "parse.c"
        break;
      case 180: /* expr ::= nm DOT nm DOT nm */
#line 641 "parse.y"
{
  Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-4].minor.yy0);
  Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0);
  Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);
  Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0);
  yygotominor.yy172 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0);
}
#line 2703 "parse.c"
        break;
      case 183: /* expr ::= REGISTER */
#line 650 "parse.y"
{yygotominor.yy172 = sqlite3RegisterExpr(pParse, &yymsp[0].minor.yy0);}
#line 2708 "parse.c"
        break;
      case 184: /* expr ::= VARIABLE */
#line 651 "parse.y"
{
  Token *pToken = &yymsp[0].minor.yy0;
  Expr *pExpr = yygotominor.yy172 = sqlite3PExpr(pParse, TK_VARIABLE, 0, 0, pToken);
  sqlite3ExprAssignVarNumber(pParse, pExpr);
}
#line 2717 "parse.c"
        break;
      case 185: /* expr ::= expr COLLATE ids */
#line 656 "parse.y"
{
  yygotominor.yy172 = sqlite3ExprSetColl(pParse, yymsp[-2].minor.yy172, &yymsp[0].minor.yy0);
}
#line 2724 "parse.c"
        break;
      case 186: /* expr ::= CAST LP expr AS typetoken RP */
#line 660 "parse.y"
{
  yygotominor.yy172 = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy172, 0, &yymsp[-1].minor.yy0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0);
}
#line 2732 "parse.c"
        break;
      case 187: /* expr ::= ID LP distinct exprlist RP */
#line 665 "parse.y"
{
  if( yymsp[-1].minor.yy174 && yymsp[-1].minor.yy174->nExpr>SQLITE_MAX_FUNCTION_ARG ){
    sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0);
  }
  yygotominor.yy172 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy174, &yymsp[-4].minor.yy0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0);
  if( yymsp[-2].minor.yy46 && yygotominor.yy172 ){
    yygotominor.yy172->flags |= EP_Distinct;
  }
}
#line 2746 "parse.c"
        break;
      case 188: /* expr ::= ID LP STAR RP */
#line 675 "parse.y"
{
  yygotominor.yy172 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
}
#line 2754 "parse.c"
        break;
      case 189: /* term ::= CTIME_KW */
#line 679 "parse.y"
{
  /* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are
  ** treated as functions that return constants */
  yygotominor.yy172 = sqlite3ExprFunction(pParse, 0,&yymsp[0].minor.yy0);
  if( yygotominor.yy172 ){
    yygotominor.yy172->op = TK_CONST_FUNC;  
    yygotominor.yy172->span = yymsp[0].minor.yy0;
  }
}
#line 2767 "parse.c"
        break;
      case 190: /* expr ::= expr AND expr */
      case 191: /* expr ::= expr OR expr */
      case 192: /* expr ::= expr LT|GT|GE|LE expr */
      case 193: /* expr ::= expr EQ|NE expr */
      case 194: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */
      case 195: /* expr ::= expr PLUS|MINUS expr */
      case 196: /* expr ::= expr STAR|SLASH|REM expr */
      case 197: /* expr ::= expr CONCAT expr */
#line 688 "parse.y"
{yygotominor.yy172 = sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy172,yymsp[0].minor.yy172,0);}
#line 2779 "parse.c"
        break;
      case 198: /* likeop ::= LIKE_KW */
      case 200: /* likeop ::= MATCH */
#line 700 "parse.y"
{yygotominor.yy72.eOperator = yymsp[0].minor.yy0; yygotominor.yy72.not = 0;}
#line 2785 "parse.c"
        break;
      case 199: /* likeop ::= NOT LIKE_KW */
      case 201: /* likeop ::= NOT MATCH */
#line 701 "parse.y"
{yygotominor.yy72.eOperator = yymsp[0].minor.yy0; yygotominor.yy72.not = 1;}
#line 2791 "parse.c"
        break;
      case 204: /* expr ::= expr likeop expr escape */
#line 708 "parse.y"
{
  ExprList *pList;
  pList = sqlite3ExprListAppend(pParse,0, yymsp[-1].minor.yy172, 0);
  pList = sqlite3ExprListAppend(pParse,pList, yymsp[-3].minor.yy172, 0);
  if( yymsp[0].minor.yy172 ){
    pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy172, 0);
  }
  yygotominor.yy172 = sqlite3ExprFunction(pParse, pList, &yymsp[-2].minor.yy72.eOperator);
  if( yymsp[-2].minor.yy72.not ) yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy172, 0, 0);
  sqlite3ExprSpan(yygotominor.yy172, &yymsp[-3].minor.yy172->span, &yymsp[-1].minor.yy172->span);
  if( yygotominor.yy172 ) yygotominor.yy172->flags |= EP_InfixFunc;
}
#line 2807 "parse.c"
        break;
      case 205: /* expr ::= expr ISNULL|NOTNULL */
#line 721 "parse.y"
{
  yygotominor.yy172 = sqlite3PExpr(pParse, yymsp[0].major, yymsp[-1].minor.yy172, 0, 0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy172->span,&yymsp[0].minor.yy0);
}
#line 2815 "parse.c"
        break;
      case 206: /* expr ::= expr IS NULL */
#line 725 "parse.y"
{
  yygotominor.yy172 = sqlite3PExpr(pParse, TK_ISNULL, yymsp[-2].minor.yy172, 0, 0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy172->span,&yymsp[0].minor.yy0);
}
#line 2823 "parse.c"
        break;
      case 207: /* expr ::= expr NOT NULL */
#line 729 "parse.y"
{
  yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOTNULL, yymsp[-2].minor.yy172, 0, 0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy172->span,&yymsp[0].minor.yy0);
}
#line 2831 "parse.c"
        break;
      case 208: /* expr ::= expr IS NOT NULL */
#line 733 "parse.y"
{
  yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOTNULL, yymsp[-3].minor.yy172, 0, 0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-3].minor.yy172->span,&yymsp[0].minor.yy0);
}
#line 2839 "parse.c"
        break;
      case 209: /* expr ::= NOT expr */
      case 210: /* expr ::= BITNOT expr */
#line 737 "parse.y"
{
  yygotominor.yy172 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy172, 0, 0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy172->span);
}
#line 2848 "parse.c"
        break;
      case 211: /* expr ::= MINUS expr */
#line 745 "parse.y"
{
  yygotominor.yy172 = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy172, 0, 0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy172->span);
}
#line 2856 "parse.c"
        break;
      case 212: /* expr ::= PLUS expr */
#line 749 "parse.y"
{
  yygotominor.yy172 = sqlite3PExpr(pParse, TK_UPLUS, yymsp[0].minor.yy172, 0, 0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy172->span);
}
#line 2864 "parse.c"
        break;
      case 215: /* expr ::= expr between_op expr AND expr */
#line 756 "parse.y"
{
  ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy172, 0);
  pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy172, 0);
  yygotominor.yy172 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy172, 0, 0);
  if( yygotominor.yy172 ){
    yygotominor.yy172->pList = pList;
  }else{
    sqlite3ExprListDelete(pParse->db, pList);
  } 
  if( yymsp[-3].minor.yy46 ) yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy172, 0, 0);
  sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy172->span,&yymsp[0].minor.yy172->span);
}
#line 2880 "parse.c"
        break;
      case 218: /* expr ::= expr in_op LP exprlist RP */
#line 772 "parse.y"
{
    yygotominor.yy172 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy172, 0, 0);
    if( yygotominor.yy172 ){
      yygotominor.yy172->pList = yymsp[-1].minor.yy174;
      sqlite3ExprSetHeight(pParse, yygotominor.yy172);
    }else{
      sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy174);
    }
    if( yymsp[-3].minor.yy46 ) yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy172, 0, 0);
    sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy172->span,&yymsp[0].minor.yy0);
  }
#line 2895 "parse.c"
        break;
      case 219: /* expr ::= LP select RP */
#line 783 "parse.y"
{
    yygotominor.yy172 = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0);
    if( yygotominor.yy172 ){
      yygotominor.yy172->pSelect = yymsp[-1].minor.yy219;
      sqlite3ExprSetHeight(pParse, yygotominor.yy172);
    }else{
      sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy219);
    }
    sqlite3ExprSpan(yygotominor.yy172,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);
  }
#line 2909 "parse.c"
        break;
      case 220: /* expr ::= expr in_op LP select RP */
#line 793 "parse.y"
{
    yygotominor.yy172 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy172, 0, 0);
    if( yygotominor.yy172 ){
      yygotominor.yy172->pSelect = yymsp[-1].minor.yy219;
      sqlite3ExprSetHeight(pParse, yygotominor.yy172);
    }else{
      sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy219);
    }
    if( yymsp[-3].minor.yy46 ) yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy172, 0, 0);
    sqlite3ExprSpan(yygotominor.yy172,&yymsp[-4].minor.yy172->span,&yymsp[0].minor.yy0);
  }
#line 2924 "parse.c"
        break;
      case 221: /* expr ::= expr in_op nm dbnm */
#line 804 "parse.y"
{
    SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);
    yygotominor.yy172 = sqlite3PExpr(pParse, TK_IN, yymsp[-3].minor.yy172, 0, 0);
    if( yygotominor.yy172 ){
      yygotominor.yy172->pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
      sqlite3ExprSetHeight(pParse, yygotominor.yy172);
    }else{
      sqlite3SrcListDelete(pParse->db, pSrc);
    }
    if( yymsp[-2].minor.yy46 ) yygotominor.yy172 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy172, 0, 0);
    sqlite3ExprSpan(yygotominor.yy172,&yymsp[-3].minor.yy172->span,yymsp[0].minor.yy0.z?&yymsp[0].minor.yy0:&yymsp[-1].minor.yy0);
  }
#line 2940 "parse.c"
        break;
      case 222: /* expr ::= EXISTS LP select RP */
#line 816 "parse.y"
{
    Expr *p = yygotominor.yy172 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0);
    if( p ){
      p->pSelect = yymsp[-1].minor.yy219;
      sqlite3ExprSpan(p,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
      sqlite3ExprSetHeight(pParse, yygotominor.yy172);
    }else{
      sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy219);
    }
  }
#line 2954 "parse.c"
        break;
      case 223: /* expr ::= CASE case_operand case_exprlist case_else END */
#line 829 "parse.y"
{
  yygotominor.yy172 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy172, yymsp[-1].minor.yy172, 0);
  if( yygotominor.yy172 ){
    yygotominor.yy172->pList = yymsp[-2].minor.yy174;
    sqlite3ExprSetHeight(pParse, yygotominor.yy172);
  }else{
    sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy174);
  }
  sqlite3ExprSpan(yygotominor.yy172, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0);
}
#line 2968 "parse.c"
        break;
      case 224: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
#line 841 "parse.y"
{
  yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy174, yymsp[-2].minor.yy172, 0);
  yygotominor.yy174 = sqlite3ExprListAppend(pParse,yygotominor.yy174, yymsp[0].minor.yy172, 0);
}
#line 2976 "parse.c"
        break;
      case 225: /* case_exprlist ::= WHEN expr THEN expr */
#line 845 "parse.y"
{
  yygotominor.yy174 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy172, 0);
  yygotominor.yy174 = sqlite3ExprListAppend(pParse,yygotominor.yy174, yymsp[0].minor.yy172, 0);
}
#line 2984 "parse.c"
        break;
      case 234: /* cmd ::= CREATE uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP */
#line 874 "parse.y"
{
  sqlite3CreateIndex(pParse, &yymsp[-6].minor.yy0, &yymsp[-5].minor.yy0, 
                     sqlite3SrcListAppend(pParse->db,0,&yymsp[-3].minor.yy0,0), yymsp[-1].minor.yy174, yymsp[-9].minor.yy46,
                      &yymsp[-10].minor.yy0, &yymsp[0].minor.yy0, SQLITE_SO_ASC, yymsp[-7].minor.yy46);
}
#line 2993 "parse.c"
        break;
      case 235: /* uniqueflag ::= UNIQUE */
      case 283: /* raisetype ::= ABORT */
#line 881 "parse.y"
{yygotominor.yy46 = OE_Abort;}
#line 2999 "parse.c"
        break;
      case 236: /* uniqueflag ::= */
#line 882 "parse.y"
{yygotominor.yy46 = OE_None;}
#line 3004 "parse.c"
        break;
      case 239: /* idxlist ::= idxlist COMMA idxitem collate sortorder */
#line 892 "parse.y"
{
  Expr *p = 0;
  if( yymsp[-1].minor.yy0.n>0 ){
    p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0);
    sqlite3ExprSetColl(pParse, p, &yymsp[-1].minor.yy0);
  }
  yygotominor.yy174 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy174, p, &yymsp[-2].minor.yy0);
  sqlite3ExprListCheckLength(pParse, yygotominor.yy174, "index");
  if( yygotominor.yy174 ) yygotominor.yy174->a[yygotominor.yy174->nExpr-1].sortOrder = yymsp[0].minor.yy46;
}
#line 3018 "parse.c"
        break;
      case 240: /* idxlist ::= idxitem collate sortorder */
#line 902 "parse.y"
{
  Expr *p = 0;
  if( yymsp[-1].minor.yy0.n>0 ){
    p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0);
    sqlite3ExprSetColl(pParse, p, &yymsp[-1].minor.yy0);
  }
  yygotominor.yy174 = sqlite3ExprListAppend(pParse,0, p, &yymsp[-2].minor.yy0);
  sqlite3ExprListCheckLength(pParse, yygotominor.yy174, "index");
  if( yygotominor.yy174 ) yygotominor.yy174->a[yygotominor.yy174->nExpr-1].sortOrder = yymsp[0].minor.yy46;
}
#line 3032 "parse.c"
        break;
      case 242: /* collate ::= */
#line 915 "parse.y"
{yygotominor.yy0.z = 0; yygotominor.yy0.n = 0;}
#line 3037 "parse.c"
        break;
      case 244: /* cmd ::= DROP INDEX ifexists fullname */
#line 921 "parse.y"
{sqlite3DropIndex(pParse, yymsp[0].minor.yy373, yymsp[-1].minor.yy46);}
#line 3042 "parse.c"
        break;
      case 245: /* cmd ::= VACUUM */
      case 246: /* cmd ::= VACUUM nm */
#line 927 "parse.y"
{sqlite3Vacuum(pParse);}
#line 3048 "parse.c"
        break;
      case 247: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
      case 248: /* cmd ::= PRAGMA nm dbnm EQ ON */
      case 249: /* cmd ::= PRAGMA nm dbnm EQ DELETE */
#line 936 "parse.y"
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
#line 3055 "parse.c"
        break;
      case 250: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
#line 939 "parse.y"
{
  sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);
}
#line 3062 "parse.c"
        break;
      case 251: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
#line 942 "parse.y"
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
#line 3067 "parse.c"
        break;
      case 252: /* cmd ::= PRAGMA nm dbnm */
#line 943 "parse.y"
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
#line 3072 "parse.c"
        break;
      case 260: /* cmd ::= CREATE trigger_decl BEGIN trigger_cmd_list END */
#line 958 "parse.y"
{
  Token all;
  all.z = yymsp[-3].minor.yy0.z;
  all.n = (yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n;
  sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy243, &all);
}
#line 3082 "parse.c"
        break;
      case 261: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
#line 967 "parse.y"
{
  sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy46, yymsp[-4].minor.yy370.a, yymsp[-4].minor.yy370.b, yymsp[-2].minor.yy373, yymsp[0].minor.yy172, yymsp[-10].minor.yy46, yymsp[-8].minor.yy46);
  yygotominor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0);
}
#line 3090 "parse.c"
        break;
      case 262: /* trigger_time ::= BEFORE */
      case 265: /* trigger_time ::= */
#line 973 "parse.y"
{ yygotominor.yy46 = TK_BEFORE; }
#line 3096 "parse.c"
        break;
      case 263: /* trigger_time ::= AFTER */
#line 974 "parse.y"
{ yygotominor.yy46 = TK_AFTER;  }
#line 3101 "parse.c"
        break;
      case 264: /* trigger_time ::= INSTEAD OF */
#line 975 "parse.y"
{ yygotominor.yy46 = TK_INSTEAD;}
#line 3106 "parse.c"
        break;
      case 266: /* trigger_event ::= DELETE|INSERT */
      case 267: /* trigger_event ::= UPDATE */
#line 980 "parse.y"
{yygotominor.yy370.a = yymsp[0].major; yygotominor.yy370.b = 0;}
#line 3112 "parse.c"
        break;
      case 268: /* trigger_event ::= UPDATE OF inscollist */
#line 982 "parse.y"
{yygotominor.yy370.a = TK_UPDATE; yygotominor.yy370.b = yymsp[0].minor.yy432;}
#line 3117 "parse.c"
        break;
      case 271: /* when_clause ::= */
      case 288: /* key_opt ::= */
#line 989 "parse.y"
{ yygotominor.yy172 = 0; }
#line 3123 "parse.c"
        break;
      case 272: /* when_clause ::= WHEN expr */
      case 289: /* key_opt ::= KEY expr */
#line 990 "parse.y"
{ yygotominor.yy172 = yymsp[0].minor.yy172; }
#line 3129 "parse.c"
        break;
      case 273: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
#line 994 "parse.y"
{
  if( yymsp[-2].minor.yy243 ){
    yymsp[-2].minor.yy243->pLast->pNext = yymsp[-1].minor.yy243;
  }else{
    yymsp[-2].minor.yy243 = yymsp[-1].minor.yy243;
  }
  yymsp[-2].minor.yy243->pLast = yymsp[-1].minor.yy243;
  yygotominor.yy243 = yymsp[-2].minor.yy243;
}
#line 3142 "parse.c"
        break;
      case 274: /* trigger_cmd_list ::= */
#line 1003 "parse.y"
{ yygotominor.yy243 = 0; }
#line 3147 "parse.c"
        break;
      case 275: /* trigger_cmd ::= UPDATE orconf nm SET setlist where_opt */
#line 1009 "parse.y"
{ yygotominor.yy243 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy174, yymsp[0].minor.yy172, yymsp[-4].minor.yy46); }
#line 3152 "parse.c"
        break;
      case 276: /* trigger_cmd ::= insert_cmd INTO nm inscollist_opt VALUES LP itemlist RP */
#line 1014 "parse.y"
{yygotominor.yy243 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy432, yymsp[-1].minor.yy174, 0, yymsp[-7].minor.yy46);}
#line 3157 "parse.c"
        break;
      case 277: /* trigger_cmd ::= insert_cmd INTO nm inscollist_opt select */
#line 1017 "parse.y"
{yygotominor.yy243 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy432, 0, yymsp[0].minor.yy219, yymsp[-4].minor.yy46);}
#line 3162 "parse.c"
        break;
      case 278: /* trigger_cmd ::= DELETE FROM nm where_opt */
#line 1021 "parse.y"
{yygotominor.yy243 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-1].minor.yy0, yymsp[0].minor.yy172);}
#line 3167 "parse.c"
        break;
      case 279: /* trigger_cmd ::= select */
#line 1024 "parse.y"
{yygotominor.yy243 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy219); }
#line 3172 "parse.c"
        break;
      case 280: /* expr ::= RAISE LP IGNORE RP */
#line 1027 "parse.y"
{
  yygotominor.yy172 = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0); 
  if( yygotominor.yy172 ){
    yygotominor.yy172->iColumn = OE_Ignore;
    sqlite3ExprSpan(yygotominor.yy172, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0);
  }
}
#line 3183 "parse.c"
        break;
      case 281: /* expr ::= RAISE LP raisetype COMMA nm RP */
#line 1034 "parse.y"
{
  yygotominor.yy172 = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0); 
  if( yygotominor.yy172 ) {
    yygotominor.yy172->iColumn = yymsp[-3].minor.yy46;
    sqlite3ExprSpan(yygotominor.yy172, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0);
  }
}
#line 3194 "parse.c"
        break;
      case 282: /* raisetype ::= ROLLBACK */
#line 1044 "parse.y"
{yygotominor.yy46 = OE_Rollback;}
#line 3199 "parse.c"
        break;
      case 284: /* raisetype ::= FAIL */
#line 1046 "parse.y"
{yygotominor.yy46 = OE_Fail;}
#line 3204 "parse.c"
        break;
      case 285: /* cmd ::= DROP TRIGGER ifexists fullname */
#line 1051 "parse.y"
{
  sqlite3DropTrigger(pParse,yymsp[0].minor.yy373,yymsp[-1].minor.yy46);
}
#line 3211 "parse.c"
        break;
      case 286: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
#line 1058 "parse.y"
{
  sqlite3Attach(pParse, yymsp[-3].minor.yy172, yymsp[-1].minor.yy172, yymsp[0].minor.yy172);
}
#line 3218 "parse.c"
        break;
      case 287: /* cmd ::= DETACH database_kw_opt expr */
#line 1061 "parse.y"
{
  sqlite3Detach(pParse, yymsp[0].minor.yy172);
}
#line 3225 "parse.c"
        break;
      case 292: /* cmd ::= REINDEX */
#line 1076 "parse.y"
{sqlite3Reindex(pParse, 0, 0);}
#line 3230 "parse.c"
        break;
      case 293: /* cmd ::= REINDEX nm dbnm */
#line 1077 "parse.y"
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
#line 3235 "parse.c"
        break;
      case 294: /* cmd ::= ANALYZE */
#line 1082 "parse.y"
{sqlite3Analyze(pParse, 0, 0);}
#line 3240 "parse.c"
        break;
      case 295: /* cmd ::= ANALYZE nm dbnm */
#line 1083 "parse.y"
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
#line 3245 "parse.c"
        break;
      case 296: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
#line 1088 "parse.y"
{
  sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy373,&yymsp[0].minor.yy0);
}
#line 3252 "parse.c"
        break;
      case 297: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column */
#line 1091 "parse.y"
{
  sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy0);
}
#line 3259 "parse.c"
        break;
      case 298: /* add_column_fullname ::= fullname */
#line 1094 "parse.y"
{
  sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy373);
}
#line 3266 "parse.c"
        break;
      case 301: /* cmd ::= create_vtab */
#line 1103 "parse.y"
{sqlite3VtabFinishParse(pParse,0);}
#line 3271 "parse.c"
        break;
      case 302: /* cmd ::= create_vtab LP vtabarglist RP */
#line 1104 "parse.y"
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
#line 3276 "parse.c"
        break;
      case 303: /* create_vtab ::= CREATE VIRTUAL TABLE nm dbnm USING nm */
#line 1105 "parse.y"
{
    sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0);
}
#line 3283 "parse.c"
        break;
      case 306: /* vtabarg ::= */
#line 1110 "parse.y"
{sqlite3VtabArgInit(pParse);}
#line 3288 "parse.c"
        break;
      case 308: /* vtabargtoken ::= ANY */
      case 309: /* vtabargtoken ::= lp anylist RP */
      case 310: /* lp ::= LP */
      case 312: /* anylist ::= anylist ANY */
#line 1112 "parse.y"
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
#line 3296 "parse.c"
        break;
  };
  yygoto = yyRuleInfo[yyruleno].lhs;
  yysize = yyRuleInfo[yyruleno].nrhs;
  yypParser->yyidx -= yysize;
  yyact = yy_find_reduce_action(yymsp[-yysize].stateno,yygoto);
  if( yyact < YYNSTATE ){
#ifdef NDEBUG
    /* If we are not debugging and the reduce action popped at least
    ** one element off the stack, then we can push the new element back
    ** onto the stack here, and skip the stack overflow test in yy_shift().
    ** That gives a significant speed improvement. */
    if( yysize ){
      yypParser->yyidx++;
      yymsp -= yysize-1;
      yymsp->stateno = yyact;
      yymsp->major = yygoto;
      yymsp->minor = yygotominor;
    }else
#endif
    {
      yy_shift(yypParser,yyact,yygoto,&yygotominor);
    }
  }else{
    assert( yyact == YYNSTATE + YYNRULE + 1 );
    yy_accept(yypParser);
  }
}

/*
** The following code executes when the parse fails
*/
static void yy_parse_failed(
  yyParser *yypParser           /* The parser */
){
  sqlite3ParserARG_FETCH;
#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt);
  }
#endif
  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
  /* Here code is inserted which will be executed whenever the
  ** parser fails */
  sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
}

/*
** The following code executes when a syntax error first occurs.
*/
static void yy_syntax_error(
  yyParser *yypParser,           /* The parser */
  int yymajor,                   /* The major type of the error token */
  YYMINORTYPE yyminor            /* The minor type of the error token */
){
  sqlite3ParserARG_FETCH;
#define TOKEN (yyminor.yy0)
#line 34 "parse.y"

  assert( TOKEN.z[0] );  /* The tokenizer always gives us a token */
  sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
  pParse->parseError = 1;
#line 3361 "parse.c"
  sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
}

/*
** The following is executed when the parser accepts
*/
static void yy_accept(
  yyParser *yypParser           /* The parser */
){
  sqlite3ParserARG_FETCH;
#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt);
  }
#endif
  while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser);
  /* Here code is inserted which will be executed whenever the
  ** parser accepts */
  sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */
}

/* The main parser program.
** The first argument is a pointer to a structure obtained from
** "sqlite3ParserAlloc" which describes the current state of the parser.
** The second argument is the major token number.  The third is
** the minor token.  The fourth optional argument is whatever the
** user wants (and specified in the grammar) and is available for
** use by the action routines.
**
** Inputs:
** <ul>
** <li> A pointer to the parser (an opaque structure.)
** <li> The major token number.
** <li> The minor token number.
** <li> An option argument of a grammar-specified type.
** </ul>
**
** Outputs:
** None.
*/
void sqlite3Parser(
  void *yyp,                   /* The parser */
  int yymajor,                 /* The major token code number */
  sqlite3ParserTOKENTYPE yyminor       /* The value for the token */
  sqlite3ParserARG_PDECL               /* Optional %extra_argument parameter */
){
  YYMINORTYPE yyminorunion;
  int yyact;            /* The parser action. */
  int yyendofinput;     /* True if we are at the end of input */
#ifdef YYERRORSYMBOL
  int yyerrorhit = 0;   /* True if yymajor has invoked an error */
#endif
  yyParser *yypParser;  /* The parser */

  /* (re)initialize the parser, if necessary */
  yypParser = (yyParser*)yyp;
  if( yypParser->yyidx<0 ){
#if YYSTACKDEPTH<=0
    if( yypParser->yystksz <=0 ){
      /*memset(&yyminorunion, 0, sizeof(yyminorunion));*/
      yyminorunion = yyzerominor;
      yyStackOverflow(yypParser, &yyminorunion);
      return;
    }
#endif
    yypParser->yyidx = 0;
    yypParser->yyerrcnt = -1;
    yypParser->yystack[0].stateno = 0;
    yypParser->yystack[0].major = 0;
  }
  yyminorunion.yy0 = yyminor;
  yyendofinput = (yymajor==0);
  sqlite3ParserARG_STORE;

#ifndef NDEBUG
  if( yyTraceFILE ){
    fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]);
  }
#endif

  do{
    yyact = yy_find_shift_action(yypParser,yymajor);
    if( yyact<YYNSTATE ){
      assert( !yyendofinput );  /* Impossible to shift the $ token */
      yy_shift(yypParser,yyact,yymajor,&yyminorunion);
      yypParser->yyerrcnt--;
      yymajor = YYNOCODE;
    }else if( yyact < YYNSTATE + YYNRULE ){
      yy_reduce(yypParser,yyact-YYNSTATE);
    }else{
      assert( yyact == YY_ERROR_ACTION );
#ifdef YYERRORSYMBOL
      int yymx;
#endif
#ifndef NDEBUG
      if( yyTraceFILE ){
        fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt);
      }
#endif
#ifdef YYERRORSYMBOL
      /* A syntax error has occurred.
      ** The response to an error depends upon whether or not the
      ** grammar defines an error token "ERROR".  
      **
      ** This is what we do if the grammar does define ERROR:
      **
      **  * Call the %syntax_error function.
      **
      **  * Begin popping the stack until we enter a state where
      **    it is legal to shift the error symbol, then shift
      **    the error symbol.
      **
      **  * Set the error count to three.
      **
      **  * Begin accepting and shifting new tokens.  No new error
      **    processing will occur until three tokens have been
      **    shifted successfully.
      **
      */
      if( yypParser->yyerrcnt<0 ){
        yy_syntax_error(yypParser,yymajor,yyminorunion);
      }
      yymx = yypParser->yystack[yypParser->yyidx].major;
      if( yymx==YYERRORSYMBOL || yyerrorhit ){
#ifndef NDEBUG
        if( yyTraceFILE ){
          fprintf(yyTraceFILE,"%sDiscard input token %s\n",
             yyTracePrompt,yyTokenName[yymajor]);
        }
#endif
        yy_destructor(yypParser, yymajor,&yyminorunion);
        yymajor = YYNOCODE;
      }else{
         while(
          yypParser->yyidx >= 0 &&
          yymx != YYERRORSYMBOL &&
          (yyact = yy_find_reduce_action(
                        yypParser->yystack[yypParser->yyidx].stateno,
                        YYERRORSYMBOL)) >= YYNSTATE
        ){
          yy_pop_parser_stack(yypParser);
        }
        if( yypParser->yyidx < 0 || yymajor==0 ){
          yy_destructor(yypParser,yymajor,&yyminorunion);
          yy_parse_failed(yypParser);
          yymajor = YYNOCODE;
        }else if( yymx!=YYERRORSYMBOL ){
          YYMINORTYPE u2;
          u2.YYERRSYMDT = 0;
          yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2);
        }
      }
      yypParser->yyerrcnt = 3;
      yyerrorhit = 1;
#else  /* YYERRORSYMBOL is not defined */
      /* This is what we do if the grammar does not define ERROR:
      **
      **  * Report an error message, and throw away the input token.
      **
      **  * If the input token is $, then fail the parse.
      **
      ** As before, subsequent error messages are suppressed until
      ** three input tokens have been successfully shifted.
      */
      if( yypParser->yyerrcnt<=0 ){
        yy_syntax_error(yypParser,yymajor,yyminorunion);
      }
      yypParser->yyerrcnt = 3;
      yy_destructor(yypParser,yymajor,&yyminorunion);
      if( yyendofinput ){
        yy_parse_failed(yypParser);
      }
      yymajor = YYNOCODE;
#endif
    }
  }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 );
  return;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/parse.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#define TK_SEMI                            1
#define TK_EXPLAIN                         2
#define TK_QUERY                           3
#define TK_PLAN                            4
#define TK_BEGIN                           5
#define TK_TRANSACTION                     6
#define TK_DEFERRED                        7
#define TK_IMMEDIATE                       8
#define TK_EXCLUSIVE                       9
#define TK_COMMIT                         10
#define TK_END                            11
#define TK_ROLLBACK                       12
#define TK_CREATE                         13
#define TK_TABLE                          14
#define TK_IF                             15
#define TK_NOT                            16
#define TK_EXISTS                         17
#define TK_TEMP                           18
#define TK_LP                             19
#define TK_RP                             20
#define TK_AS                             21
#define TK_COMMA                          22
#define TK_ID                             23
#define TK_ABORT                          24
#define TK_AFTER                          25
#define TK_ANALYZE                        26
#define TK_ASC                            27
#define TK_ATTACH                         28
#define TK_BEFORE                         29
#define TK_CASCADE                        30
#define TK_CAST                           31
#define TK_CONFLICT                       32
#define TK_DATABASE                       33
#define TK_DESC                           34
#define TK_DETACH                         35
#define TK_EACH                           36
#define TK_FAIL                           37
#define TK_FOR                            38
#define TK_IGNORE                         39
#define TK_INITIALLY                      40
#define TK_INSTEAD                        41
#define TK_LIKE_KW                        42
#define TK_MATCH                          43
#define TK_KEY                            44
#define TK_OF                             45
#define TK_OFFSET                         46
#define TK_PRAGMA                         47
#define TK_RAISE                          48
#define TK_REPLACE                        49
#define TK_RESTRICT                       50
#define TK_ROW                            51
#define TK_TRIGGER                        52
#define TK_VACUUM                         53
#define TK_VIEW                           54
#define TK_VIRTUAL                        55
#define TK_REINDEX                        56
#define TK_RENAME                         57
#define TK_CTIME_KW                       58
#define TK_ANY                            59
#define TK_OR                             60
#define TK_AND                            61
#define TK_IS                             62
#define TK_BETWEEN                        63
#define TK_IN                             64
#define TK_ISNULL                         65
#define TK_NOTNULL                        66
#define TK_NE                             67
#define TK_EQ                             68
#define TK_GT                             69
#define TK_LE                             70
#define TK_LT                             71
#define TK_GE                             72
#define TK_ESCAPE                         73
#define TK_BITAND                         74
#define TK_BITOR                          75
#define TK_LSHIFT                         76
#define TK_RSHIFT                         77
#define TK_PLUS                           78
#define TK_MINUS                          79
#define TK_STAR                           80
#define TK_SLASH                          81
#define TK_REM                            82
#define TK_CONCAT                         83
#define TK_COLLATE                        84
#define TK_UMINUS                         85
#define TK_UPLUS                          86
#define TK_BITNOT                         87
#define TK_STRING                         88
#define TK_JOIN_KW                        89
#define TK_CONSTRAINT                     90
#define TK_DEFAULT                        91
#define TK_NULL                           92
#define TK_PRIMARY                        93
#define TK_UNIQUE                         94
#define TK_CHECK                          95
#define TK_REFERENCES                     96
#define TK_AUTOINCR                       97
#define TK_ON                             98
#define TK_DELETE                         99
#define TK_UPDATE                         100
#define TK_INSERT                         101
#define TK_SET                            102
#define TK_DEFERRABLE                     103
#define TK_FOREIGN                        104
#define TK_DROP                           105
#define TK_UNION                          106
#define TK_ALL                            107
#define TK_EXCEPT                         108
#define TK_INTERSECT                      109
#define TK_SELECT                         110
#define TK_DISTINCT                       111
#define TK_DOT                            112
#define TK_FROM                           113
#define TK_JOIN                           114
#define TK_USING                          115
#define TK_ORDER                          116
#define TK_BY                             117
#define TK_GROUP                          118
#define TK_HAVING                         119
#define TK_LIMIT                          120
#define TK_WHERE                          121
#define TK_INTO                           122
#define TK_VALUES                         123
#define TK_INTEGER                        124
#define TK_FLOAT                          125
#define TK_BLOB                           126
#define TK_REGISTER                       127
#define TK_VARIABLE                       128
#define TK_CASE                           129
#define TK_WHEN                           130
#define TK_THEN                           131
#define TK_ELSE                           132
#define TK_INDEX                          133
#define TK_ALTER                          134
#define TK_TO                             135
#define TK_ADD                            136
#define TK_COLUMNKW                       137
#define TK_TO_TEXT                        138
#define TK_TO_BLOB                        139
#define TK_TO_NUMERIC                     140
#define TK_TO_INT                         141
#define TK_TO_REAL                        142
#define TK_END_OF_FILE                    143
#define TK_ILLEGAL                        144
#define TK_SPACE                          145
#define TK_UNCLOSED_STRING                146
#define TK_COMMENT                        147
#define TK_FUNCTION                       148
#define TK_COLUMN                         149
#define TK_AGG_FUNCTION                   150
#define TK_AGG_COLUMN                     151
#define TK_CONST_FUNC                     152
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































































































Deleted SQLite.Interop/splitsource/parse.y.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains SQLite's grammar for SQL.  Process this file
** using the lemon parser generator to generate C code that runs
** the parser.  Lemon will also generate a header file containing
** numeric codes for all of the tokens.
**
** @(#) $Id: parse.y,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/

// All token codes are small integers with #defines that begin with "TK_"
%token_prefix TK_

// The type of the data attached to each token is Token.  This is also the
// default type for non-terminals.
//
%token_type {Token}
%default_type {Token}

// The generated parser function takes a 4th argument as follows:
%extra_argument {Parse *pParse}

// This code runs whenever there is a syntax error
//
%syntax_error {
  assert( TOKEN.z[0] );  /* The tokenizer always gives us a token */
  sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN);
  pParse->parseError = 1;
}
%stack_overflow {
  sqlite3ErrorMsg(pParse, "parser stack overflow");
  pParse->parseError = 1;
}

// The name of the generated procedure that implements the parser
// is as follows:
%name sqlite3Parser

// The following text is included near the beginning of the C source
// code file that implements the parser.
//
%include {
#include "sqliteInt.h"

/*
** An instance of this structure holds information about the
** LIMIT clause of a SELECT statement.
*/
struct LimitVal {
  Expr *pLimit;    /* The LIMIT expression.  NULL if there is no limit */
  Expr *pOffset;   /* The OFFSET expression.  NULL if there is none */
};

/*
** An instance of this structure is used to store the LIKE,
** GLOB, NOT LIKE, and NOT GLOB operators.
*/
struct LikeOp {
  Token eOperator;  /* "like" or "glob" or "regexp" */
  int not;         /* True if the NOT keyword is present */
};

/*
** An instance of the following structure describes the event of a
** TRIGGER.  "a" is the event type, one of TK_UPDATE, TK_INSERT,
** TK_DELETE, or TK_INSTEAD.  If the event is of the form
**
**      UPDATE ON (a,b,c)
**
** Then the "b" IdList records the list "a,b,c".
*/
struct TrigEvent { int a; IdList * b; };

/*
** An instance of this structure holds the ATTACH key and the key type.
*/
struct AttachKey { int type;  Token key; };

} // end %include

// Input is a single SQL command
input ::= cmdlist.
cmdlist ::= cmdlist ecmd.
cmdlist ::= ecmd.
cmdx ::= cmd.           { sqlite3FinishCoding(pParse); }
ecmd ::= SEMI.
ecmd ::= explain cmdx SEMI.
explain ::= .           { sqlite3BeginParse(pParse, 0); }
%ifndef SQLITE_OMIT_EXPLAIN
explain ::= EXPLAIN.              { sqlite3BeginParse(pParse, 1); }
explain ::= EXPLAIN QUERY PLAN.   { sqlite3BeginParse(pParse, 2); }
%endif  SQLITE_OMIT_EXPLAIN

///////////////////// Begin and end transactions. ////////////////////////////
//

cmd ::= BEGIN transtype(Y) trans_opt.  {sqlite3BeginTransaction(pParse, Y);}
trans_opt ::= .
trans_opt ::= TRANSACTION.
trans_opt ::= TRANSACTION nm.
%type transtype {int}
transtype(A) ::= .             {A = TK_DEFERRED;}
transtype(A) ::= DEFERRED(X).  {A = @X;}
transtype(A) ::= IMMEDIATE(X). {A = @X;}
transtype(A) ::= EXCLUSIVE(X). {A = @X;}
cmd ::= COMMIT trans_opt.      {sqlite3CommitTransaction(pParse);}
cmd ::= END trans_opt.         {sqlite3CommitTransaction(pParse);}
cmd ::= ROLLBACK trans_opt.    {sqlite3RollbackTransaction(pParse);}

///////////////////// The CREATE TABLE statement ////////////////////////////
//
cmd ::= create_table create_table_args.
create_table ::= CREATE temp(T) TABLE ifnotexists(E) nm(Y) dbnm(Z). {
   sqlite3StartTable(pParse,&Y,&Z,T,0,0,E);
}
%type ifnotexists {int}
ifnotexists(A) ::= .              {A = 0;}
ifnotexists(A) ::= IF NOT EXISTS. {A = 1;}
%type temp {int}
%ifndef SQLITE_OMIT_TEMPDB
temp(A) ::= TEMP.  {A = 1;}
%endif  SQLITE_OMIT_TEMPDB
temp(A) ::= .      {A = 0;}
create_table_args ::= LP columnlist conslist_opt(X) RP(Y). {
  sqlite3EndTable(pParse,&X,&Y,0);
}
create_table_args ::= AS select(S). {
  sqlite3EndTable(pParse,0,0,S);
  sqlite3SelectDelete(pParse->db, S);
}
columnlist ::= columnlist COMMA column.
columnlist ::= column.

// A "column" is a complete description of a single column in a
// CREATE TABLE statement.  This includes the column name, its
// datatype, and other keywords such as PRIMARY KEY, UNIQUE, REFERENCES,
// NOT NULL and so forth.
//
column(A) ::= columnid(X) type carglist. {
  A.z = X.z;
  A.n = (pParse->sLastToken.z-X.z) + pParse->sLastToken.n;
}
columnid(A) ::= nm(X). {
  sqlite3AddColumn(pParse,&X);
  A = X;
}


// An IDENTIFIER can be a generic identifier, or one of several
// keywords.  Any non-standard keyword can also be an identifier.
//
%type id {Token}
id(A) ::= ID(X).         {A = X;}

// The following directive causes tokens ABORT, AFTER, ASC, etc. to
// fallback to ID if they will not parse as their original value.
// This obviates the need for the "id" nonterminal.
//
%fallback ID
  ABORT AFTER ANALYZE ASC ATTACH BEFORE BEGIN CASCADE CAST CONFLICT
  DATABASE DEFERRED DESC DETACH EACH END EXCLUSIVE EXPLAIN FAIL FOR
  IGNORE IMMEDIATE INITIALLY INSTEAD LIKE_KW MATCH PLAN
  QUERY KEY OF OFFSET PRAGMA RAISE REPLACE RESTRICT ROW
  TEMP TRIGGER VACUUM VIEW VIRTUAL
%ifdef SQLITE_OMIT_COMPOUND_SELECT
  EXCEPT INTERSECT UNION
%endif SQLITE_OMIT_COMPOUND_SELECT
  REINDEX RENAME CTIME_KW IF
  .
%wildcard ANY.

// Define operator precedence early so that this is the first occurance
// of the operator tokens in the grammer.  Keeping the operators together
// causes them to be assigned integer values that are close together,
// which keeps parser tables smaller.
//
// The token values assigned to these symbols is determined by the order
// in which lemon first sees them.  It must be the case that ISNULL/NOTNULL,
// NE/EQ, GT/LE, and GE/LT are separated by only a single value.  See
// the sqlite3ExprIfFalse() routine for additional information on this
// constraint.
//
%left OR.
%left AND.
%right NOT.
%left IS MATCH LIKE_KW BETWEEN IN ISNULL NOTNULL NE EQ.
%left GT LE LT GE.
%right ESCAPE.
%left BITAND BITOR LSHIFT RSHIFT.
%left PLUS MINUS.
%left STAR SLASH REM.
%left CONCAT.
%left COLLATE.
%right UMINUS UPLUS BITNOT.

// And "ids" is an identifer-or-string.
//
%type ids {Token}
ids(A) ::= ID|STRING(X).   {A = X;}

// The name of a column or table can be any of the following:
//
%type nm {Token}
nm(A) ::= ID(X).         {A = X;}
nm(A) ::= STRING(X).     {A = X;}
nm(A) ::= JOIN_KW(X).    {A = X;}

// A typetoken is really one or more tokens that form a type name such
// as can be found after the column name in a CREATE TABLE statement.
// Multiple tokens are concatenated to form the value of the typetoken.
//
%type typetoken {Token}
type ::= .
type ::= typetoken(X).                   {sqlite3AddColumnType(pParse,&X);}
typetoken(A) ::= typename(X).   {A = X;}
typetoken(A) ::= typename(X) LP signed RP(Y). {
  A.z = X.z;
  A.n = &Y.z[Y.n] - X.z;
}
typetoken(A) ::= typename(X) LP signed COMMA signed RP(Y). {
  A.z = X.z;
  A.n = &Y.z[Y.n] - X.z;
}
%type typename {Token}
typename(A) ::= ids(X).             {A = X;}
typename(A) ::= typename(X) ids(Y). {A.z=X.z; A.n=Y.n+(Y.z-X.z);}
signed ::= plus_num.
signed ::= minus_num.

// "carglist" is a list of additional constraints that come after the
// column name and column type in a CREATE TABLE statement.
//
carglist ::= carglist carg.
carglist ::= .
carg ::= CONSTRAINT nm ccons.
carg ::= ccons.
ccons ::= DEFAULT term(X).            {sqlite3AddDefaultValue(pParse,X);}
ccons ::= DEFAULT LP expr(X) RP.      {sqlite3AddDefaultValue(pParse,X);}
ccons ::= DEFAULT PLUS term(X).       {sqlite3AddDefaultValue(pParse,X);}
ccons ::= DEFAULT MINUS term(X).      {
  Expr *p = sqlite3PExpr(pParse, TK_UMINUS, X, 0, 0);
  sqlite3AddDefaultValue(pParse,p);
}
ccons ::= DEFAULT id(X).              {
  Expr *p = sqlite3PExpr(pParse, TK_STRING, 0, 0, &X);
  sqlite3AddDefaultValue(pParse,p);
}

// In addition to the type name, we also care about the primary key and
// UNIQUE constraints.
//
ccons ::= NULL onconf.
ccons ::= NOT NULL onconf(R).               {sqlite3AddNotNull(pParse, R);}
ccons ::= PRIMARY KEY sortorder(Z) onconf(R) autoinc(I).
                                     {sqlite3AddPrimaryKey(pParse,0,R,I,Z);}
ccons ::= UNIQUE onconf(R).    {sqlite3CreateIndex(pParse,0,0,0,0,R,0,0,0,0);}
ccons ::= CHECK LP expr(X) RP.       {sqlite3AddCheckConstraint(pParse,X);}
ccons ::= REFERENCES nm(T) idxlist_opt(TA) refargs(R).
                                {sqlite3CreateForeignKey(pParse,0,&T,TA,R);}
ccons ::= defer_subclause(D).   {sqlite3DeferForeignKey(pParse,D);}
ccons ::= COLLATE ids(C).  {sqlite3AddCollateType(pParse, &C);}

// The optional AUTOINCREMENT keyword
%type autoinc {int}
autoinc(X) ::= .          {X = 0;}
autoinc(X) ::= AUTOINCR.  {X = 1;}

// The next group of rules parses the arguments to a REFERENCES clause
// that determine if the referential integrity checking is deferred or
// or immediate and which determine what action to take if a ref-integ
// check fails.
//
%type refargs {int}
refargs(A) ::= .                     { A = OE_Restrict * 0x010101; }
refargs(A) ::= refargs(X) refarg(Y). { A = (X & Y.mask) | Y.value; }
%type refarg {struct {int value; int mask;}}
refarg(A) ::= MATCH nm.              { A.value = 0;     A.mask = 0x000000; }
refarg(A) ::= ON DELETE refact(X).   { A.value = X;     A.mask = 0x0000ff; }
refarg(A) ::= ON UPDATE refact(X).   { A.value = X<<8;  A.mask = 0x00ff00; }
refarg(A) ::= ON INSERT refact(X).   { A.value = X<<16; A.mask = 0xff0000; }
%type refact {int}
refact(A) ::= SET NULL.              { A = OE_SetNull; }
refact(A) ::= SET DEFAULT.           { A = OE_SetDflt; }
refact(A) ::= CASCADE.               { A = OE_Cascade; }
refact(A) ::= RESTRICT.              { A = OE_Restrict; }
%type defer_subclause {int}
defer_subclause(A) ::= NOT DEFERRABLE init_deferred_pred_opt(X).  {A = X;}
defer_subclause(A) ::= DEFERRABLE init_deferred_pred_opt(X).      {A = X;}
%type init_deferred_pred_opt {int}
init_deferred_pred_opt(A) ::= .                       {A = 0;}
init_deferred_pred_opt(A) ::= INITIALLY DEFERRED.     {A = 1;}
init_deferred_pred_opt(A) ::= INITIALLY IMMEDIATE.    {A = 0;}

// For the time being, the only constraint we care about is the primary
// key and UNIQUE.  Both create indices.
//
conslist_opt(A) ::= .                   {A.n = 0; A.z = 0;}
conslist_opt(A) ::= COMMA(X) conslist.  {A = X;}
conslist ::= conslist COMMA tcons.
conslist ::= conslist tcons.
conslist ::= tcons.
tcons ::= CONSTRAINT nm.
tcons ::= PRIMARY KEY LP idxlist(X) autoinc(I) RP onconf(R).
                                         {sqlite3AddPrimaryKey(pParse,X,R,I,0);}
tcons ::= UNIQUE LP idxlist(X) RP onconf(R).
                                 {sqlite3CreateIndex(pParse,0,0,0,X,R,0,0,0,0);}
tcons ::= CHECK LP expr(E) RP onconf. {sqlite3AddCheckConstraint(pParse,E);}
tcons ::= FOREIGN KEY LP idxlist(FA) RP
          REFERENCES nm(T) idxlist_opt(TA) refargs(R) defer_subclause_opt(D). {
    sqlite3CreateForeignKey(pParse, FA, &T, TA, R);
    sqlite3DeferForeignKey(pParse, D);
}
%type defer_subclause_opt {int}
defer_subclause_opt(A) ::= .                    {A = 0;}
defer_subclause_opt(A) ::= defer_subclause(X).  {A = X;}

// The following is a non-standard extension that allows us to declare the
// default behavior when there is a constraint conflict.
//
%type onconf {int}
%type orconf {int}
%type resolvetype {int}
onconf(A) ::= .                              {A = OE_Default;}
onconf(A) ::= ON CONFLICT resolvetype(X).    {A = X;}
orconf(A) ::= .                              {A = OE_Default;}
orconf(A) ::= OR resolvetype(X).             {A = X;}
resolvetype(A) ::= raisetype(X).             {A = X;}
resolvetype(A) ::= IGNORE.                   {A = OE_Ignore;}
resolvetype(A) ::= REPLACE.                  {A = OE_Replace;}

////////////////////////// The DROP TABLE /////////////////////////////////////
//
cmd ::= DROP TABLE ifexists(E) fullname(X). {
  sqlite3DropTable(pParse, X, 0, E);
}
%type ifexists {int}
ifexists(A) ::= IF EXISTS.   {A = 1;}
ifexists(A) ::= .            {A = 0;}

///////////////////// The CREATE VIEW statement /////////////////////////////
//
%ifndef SQLITE_OMIT_VIEW
cmd ::= CREATE(X) temp(T) VIEW ifnotexists(E) nm(Y) dbnm(Z) AS select(S). {
  sqlite3CreateView(pParse, &X, &Y, &Z, S, T, E);
}
cmd ::= DROP VIEW ifexists(E) fullname(X). {
  sqlite3DropTable(pParse, X, 1, E);
}
%endif  SQLITE_OMIT_VIEW

//////////////////////// The SELECT statement /////////////////////////////////
//
cmd ::= select(X).  {
  SelectDest dest = {SRT_Callback, 0, 0, 0, 0};
  sqlite3Select(pParse, X, &dest, 0, 0, 0);
  sqlite3SelectDelete(pParse->db, X);
}

%type select {Select*}
%destructor select {sqlite3SelectDelete(pParse->db, $$);}
%type oneselect {Select*}
%destructor oneselect {sqlite3SelectDelete(pParse->db, $$);}

select(A) ::= oneselect(X).                      {A = X;}
%ifndef SQLITE_OMIT_COMPOUND_SELECT
select(A) ::= select(X) multiselect_op(Y) oneselect(Z).  {
  if( Z ){
    Z->op = Y;
    Z->pPrior = X;
  }else{
    sqlite3SelectDelete(pParse->db, X);
  }
  A = Z;
}
%type multiselect_op {int}
multiselect_op(A) ::= UNION(OP).             {A = @OP;}
multiselect_op(A) ::= UNION ALL.             {A = TK_ALL;}
multiselect_op(A) ::= EXCEPT|INTERSECT(OP).  {A = @OP;}
%endif SQLITE_OMIT_COMPOUND_SELECT
oneselect(A) ::= SELECT distinct(D) selcollist(W) from(X) where_opt(Y)
                 groupby_opt(P) having_opt(Q) orderby_opt(Z) limit_opt(L). {
  A = sqlite3SelectNew(pParse,W,X,Y,P,Q,Z,D,L.pLimit,L.pOffset);
}

// The "distinct" nonterminal is true (1) if the DISTINCT keyword is
// present and false (0) if it is not.
//
%type distinct {int}
distinct(A) ::= DISTINCT.   {A = 1;}
distinct(A) ::= ALL.        {A = 0;}
distinct(A) ::= .           {A = 0;}

// selcollist is a list of expressions that are to become the return
// values of the SELECT statement.  The "*" in statements like
// "SELECT * FROM ..." is encoded as a special expression with an
// opcode of TK_ALL.
//
%type selcollist {ExprList*}
%destructor selcollist {sqlite3ExprListDelete(pParse->db, $$);}
%type sclp {ExprList*}
%destructor sclp {sqlite3ExprListDelete(pParse->db, $$);}
sclp(A) ::= selcollist(X) COMMA.             {A = X;}
sclp(A) ::= .                                {A = 0;}
selcollist(A) ::= sclp(P) expr(X) as(Y).     {
   A = sqlite3ExprListAppend(pParse,P,X,Y.n?&Y:0);
}
selcollist(A) ::= sclp(P) STAR. {
  Expr *p = sqlite3PExpr(pParse, TK_ALL, 0, 0, 0);
  A = sqlite3ExprListAppend(pParse, P, p, 0);
}
selcollist(A) ::= sclp(P) nm(X) DOT STAR(Y). {
  Expr *pRight = sqlite3PExpr(pParse, TK_ALL, 0, 0, &Y);
  Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &X);
  Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0);
  A = sqlite3ExprListAppend(pParse,P, pDot, 0);
}

// An option "AS <id>" phrase that can follow one of the expressions that
// define the result set, or one of the tables in the FROM clause.
//
%type as {Token}
as(X) ::= AS nm(Y).    {X = Y;}
as(X) ::= ids(Y).      {X = Y;}
as(X) ::= .            {X.n = 0;}


%type seltablist {SrcList*}
%destructor seltablist {sqlite3SrcListDelete(pParse->db, $$);}
%type stl_prefix {SrcList*}
%destructor stl_prefix {sqlite3SrcListDelete(pParse->db, $$);}
%type from {SrcList*}
%destructor from {sqlite3SrcListDelete(pParse->db, $$);}

// A complete FROM clause.
//
from(A) ::= .                {A = sqlite3DbMallocZero(pParse->db, sizeof(*A));}
from(A) ::= FROM seltablist(X).  {
  A = X;
  sqlite3SrcListShiftJoinType(A);
}

// "seltablist" is a "Select Table List" - the content of the FROM clause
// in a SELECT statement.  "stl_prefix" is a prefix of this list.
//
stl_prefix(A) ::= seltablist(X) joinop(Y).    {
   A = X;
   if( A && A->nSrc>0 ) A->a[A->nSrc-1].jointype = Y;
}
stl_prefix(A) ::= .                           {A = 0;}
seltablist(A) ::= stl_prefix(X) nm(Y) dbnm(D) as(Z) on_opt(N) using_opt(U). {
  A = sqlite3SrcListAppendFromTerm(pParse,X,&Y,&D,&Z,0,N,U);
}
%ifndef SQLITE_OMIT_SUBQUERY
  seltablist(A) ::= stl_prefix(X) LP seltablist_paren(S) RP
                    as(Z) on_opt(N) using_opt(U). {
    A = sqlite3SrcListAppendFromTerm(pParse,X,0,0,&Z,S,N,U);
  }
  
  // A seltablist_paren nonterminal represents anything in a FROM that
  // is contained inside parentheses.  This can be either a subquery or
  // a grouping of table and subqueries.
  //
  %type seltablist_paren {Select*}
  %destructor seltablist_paren {sqlite3SelectDelete(pParse->db, $$);}
  seltablist_paren(A) ::= select(S).      {A = S;}
  seltablist_paren(A) ::= seltablist(F).  {
     sqlite3SrcListShiftJoinType(F);
     A = sqlite3SelectNew(pParse,0,F,0,0,0,0,0,0,0);
  }
%endif  SQLITE_OMIT_SUBQUERY

%type dbnm {Token}
dbnm(A) ::= .          {A.z=0; A.n=0;}
dbnm(A) ::= DOT nm(X). {A = X;}

%type fullname {SrcList*}
%destructor fullname {sqlite3SrcListDelete(pParse->db, $$);}
fullname(A) ::= nm(X) dbnm(Y).  {A = sqlite3SrcListAppend(pParse->db,0,&X,&Y);}

%type joinop {int}
%type joinop2 {int}
joinop(X) ::= COMMA|JOIN.              { X = JT_INNER; }
joinop(X) ::= JOIN_KW(A) JOIN.         { X = sqlite3JoinType(pParse,&A,0,0); }
joinop(X) ::= JOIN_KW(A) nm(B) JOIN.   { X = sqlite3JoinType(pParse,&A,&B,0); }
joinop(X) ::= JOIN_KW(A) nm(B) nm(C) JOIN.
                                       { X = sqlite3JoinType(pParse,&A,&B,&C); }

%type on_opt {Expr*}
%destructor on_opt {sqlite3ExprDelete(pParse->db, $$);}
on_opt(N) ::= ON expr(E).   {N = E;}
on_opt(N) ::= .             {N = 0;}

%type using_opt {IdList*}
%destructor using_opt {sqlite3IdListDelete(pParse->db, $$);}
using_opt(U) ::= USING LP inscollist(L) RP.  {U = L;}
using_opt(U) ::= .                        {U = 0;}


%type orderby_opt {ExprList*}
%destructor orderby_opt {sqlite3ExprListDelete(pParse->db, $$);}
%type sortlist {ExprList*}
%destructor sortlist {sqlite3ExprListDelete(pParse->db, $$);}
%type sortitem {Expr*}
%destructor sortitem {sqlite3ExprDelete(pParse->db, $$);}

orderby_opt(A) ::= .                          {A = 0;}
orderby_opt(A) ::= ORDER BY sortlist(X).      {A = X;}
sortlist(A) ::= sortlist(X) COMMA sortitem(Y) sortorder(Z). {
  A = sqlite3ExprListAppend(pParse,X,Y,0);
  if( A ) A->a[A->nExpr-1].sortOrder = Z;
}
sortlist(A) ::= sortitem(Y) sortorder(Z). {
  A = sqlite3ExprListAppend(pParse,0,Y,0);
  if( A && A->a ) A->a[0].sortOrder = Z;
}
sortitem(A) ::= expr(X).   {A = X;}

%type sortorder {int}

sortorder(A) ::= ASC.           {A = SQLITE_SO_ASC;}
sortorder(A) ::= DESC.          {A = SQLITE_SO_DESC;}
sortorder(A) ::= .              {A = SQLITE_SO_ASC;}

%type groupby_opt {ExprList*}
%destructor groupby_opt {sqlite3ExprListDelete(pParse->db, $$);}
groupby_opt(A) ::= .                      {A = 0;}
groupby_opt(A) ::= GROUP BY nexprlist(X). {A = X;}

%type having_opt {Expr*}
%destructor having_opt {sqlite3ExprDelete(pParse->db, $$);}
having_opt(A) ::= .                {A = 0;}
having_opt(A) ::= HAVING expr(X).  {A = X;}

%type limit_opt {struct LimitVal}

// The destructor for limit_opt will never fire in the current grammar.
// The limit_opt non-terminal only occurs at the end of a single production
// rule for SELECT statements.  As soon as the rule that create the 
// limit_opt non-terminal reduces, the SELECT statement rule will also
// reduce.  So there is never a limit_opt non-terminal on the stack 
// except as a transient.  So there is never anything to destroy.
//
//%destructor limit_opt {
//  sqlite3ExprDelete(pParse->db, $$.pLimit);
//  sqlite3ExprDelete(pParse->db, $$.pOffset);
//}
limit_opt(A) ::= .                     {A.pLimit = 0; A.pOffset = 0;}
limit_opt(A) ::= LIMIT expr(X).        {A.pLimit = X; A.pOffset = 0;}
limit_opt(A) ::= LIMIT expr(X) OFFSET expr(Y). 
                                       {A.pLimit = X; A.pOffset = Y;}
limit_opt(A) ::= LIMIT expr(X) COMMA expr(Y). 
                                       {A.pOffset = X; A.pLimit = Y;}

/////////////////////////// The DELETE statement /////////////////////////////
//
cmd ::= DELETE FROM fullname(X) where_opt(Y). {sqlite3DeleteFrom(pParse,X,Y);}

%type where_opt {Expr*}
%destructor where_opt {sqlite3ExprDelete(pParse->db, $$);}

where_opt(A) ::= .                    {A = 0;}
where_opt(A) ::= WHERE expr(X).       {A = X;}

////////////////////////// The UPDATE command ////////////////////////////////
//
cmd ::= UPDATE orconf(R) fullname(X) SET setlist(Y) where_opt(Z).  {
  sqlite3ExprListCheckLength(pParse,Y,"set list"); 
  sqlite3Update(pParse,X,Y,Z,R);
}

%type setlist {ExprList*}
%destructor setlist {sqlite3ExprListDelete(pParse->db, $$);}

setlist(A) ::= setlist(Z) COMMA nm(X) EQ expr(Y).
    {A = sqlite3ExprListAppend(pParse,Z,Y,&X);}
setlist(A) ::= nm(X) EQ expr(Y).
    {A = sqlite3ExprListAppend(pParse,0,Y,&X);}

////////////////////////// The INSERT command /////////////////////////////////
//
cmd ::= insert_cmd(R) INTO fullname(X) inscollist_opt(F) 
        VALUES LP itemlist(Y) RP.
            {sqlite3Insert(pParse, X, Y, 0, F, R);}
cmd ::= insert_cmd(R) INTO fullname(X) inscollist_opt(F) select(S).
            {sqlite3Insert(pParse, X, 0, S, F, R);}
cmd ::= insert_cmd(R) INTO fullname(X) inscollist_opt(F) DEFAULT VALUES.
            {sqlite3Insert(pParse, X, 0, 0, F, R);}

%type insert_cmd {int}
insert_cmd(A) ::= INSERT orconf(R).   {A = R;}
insert_cmd(A) ::= REPLACE.            {A = OE_Replace;}


%type itemlist {ExprList*}
%destructor itemlist {sqlite3ExprListDelete(pParse->db, $$);}

itemlist(A) ::= itemlist(X) COMMA expr(Y).
    {A = sqlite3ExprListAppend(pParse,X,Y,0);}
itemlist(A) ::= expr(X).
    {A = sqlite3ExprListAppend(pParse,0,X,0);}

%type inscollist_opt {IdList*}
%destructor inscollist_opt {sqlite3IdListDelete(pParse->db, $$);}
%type inscollist {IdList*}
%destructor inscollist {sqlite3IdListDelete(pParse->db, $$);}

inscollist_opt(A) ::= .                       {A = 0;}
inscollist_opt(A) ::= LP inscollist(X) RP.    {A = X;}
inscollist(A) ::= inscollist(X) COMMA nm(Y).
    {A = sqlite3IdListAppend(pParse->db,X,&Y);}
inscollist(A) ::= nm(Y).
    {A = sqlite3IdListAppend(pParse->db,0,&Y);}

/////////////////////////// Expression Processing /////////////////////////////
//

%type expr {Expr*}
%destructor expr {sqlite3ExprDelete(pParse->db, $$);}
%type term {Expr*}
%destructor term {sqlite3ExprDelete(pParse->db, $$);}

expr(A) ::= term(X).             {A = X;}
expr(A) ::= LP(B) expr(X) RP(E). {A = X; sqlite3ExprSpan(A,&B,&E); }
term(A) ::= NULL(X).             {A = sqlite3PExpr(pParse, @X, 0, 0, &X);}
expr(A) ::= ID(X).               {A = sqlite3PExpr(pParse, TK_ID, 0, 0, &X);}
expr(A) ::= JOIN_KW(X).          {A = sqlite3PExpr(pParse, TK_ID, 0, 0, &X);}
expr(A) ::= nm(X) DOT nm(Y). {
  Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &X);
  Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &Y);
  A = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0);
}
expr(A) ::= nm(X) DOT nm(Y) DOT nm(Z). {
  Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &X);
  Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &Y);
  Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &Z);
  Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0);
  A = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0);
}
term(A) ::= INTEGER|FLOAT|BLOB(X).  {A = sqlite3PExpr(pParse, @X, 0, 0, &X);}
term(A) ::= STRING(X).       {A = sqlite3PExpr(pParse, @X, 0, 0, &X);}
expr(A) ::= REGISTER(X).     {A = sqlite3RegisterExpr(pParse, &X);}
expr(A) ::= VARIABLE(X).     {
  Token *pToken = &X;
  Expr *pExpr = A = sqlite3PExpr(pParse, TK_VARIABLE, 0, 0, pToken);
  sqlite3ExprAssignVarNumber(pParse, pExpr);
}
expr(A) ::= expr(E) COLLATE ids(C). {
  A = sqlite3ExprSetColl(pParse, E, &C);
}
%ifndef SQLITE_OMIT_CAST
expr(A) ::= CAST(X) LP expr(E) AS typetoken(T) RP(Y). {
  A = sqlite3PExpr(pParse, TK_CAST, E, 0, &T);
  sqlite3ExprSpan(A,&X,&Y);
}
%endif  SQLITE_OMIT_CAST
expr(A) ::= ID(X) LP distinct(D) exprlist(Y) RP(E). {
  if( Y && Y->nExpr>SQLITE_MAX_FUNCTION_ARG ){
    sqlite3ErrorMsg(pParse, "too many arguments on function %T", &X);
  }
  A = sqlite3ExprFunction(pParse, Y, &X);
  sqlite3ExprSpan(A,&X,&E);
  if( D && A ){
    A->flags |= EP_Distinct;
  }
}
expr(A) ::= ID(X) LP STAR RP(E). {
  A = sqlite3ExprFunction(pParse, 0, &X);
  sqlite3ExprSpan(A,&X,&E);
}
term(A) ::= CTIME_KW(OP). {
  /* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are
  ** treated as functions that return constants */
  A = sqlite3ExprFunction(pParse, 0,&OP);
  if( A ){
    A->op = TK_CONST_FUNC;  
    A->span = OP;
  }
}
expr(A) ::= expr(X) AND(OP) expr(Y).       {A = sqlite3PExpr(pParse,@OP,X,Y,0);}
expr(A) ::= expr(X) OR(OP) expr(Y).        {A = sqlite3PExpr(pParse,@OP,X,Y,0);}
expr(A) ::= expr(X) LT|GT|GE|LE(OP) expr(Y).
                                           {A = sqlite3PExpr(pParse,@OP,X,Y,0);}
expr(A) ::= expr(X) EQ|NE(OP) expr(Y).     {A = sqlite3PExpr(pParse,@OP,X,Y,0);}
expr(A) ::= expr(X) BITAND|BITOR|LSHIFT|RSHIFT(OP) expr(Y).
                                           {A = sqlite3PExpr(pParse,@OP,X,Y,0);}
expr(A) ::= expr(X) PLUS|MINUS(OP) expr(Y).{A = sqlite3PExpr(pParse,@OP,X,Y,0);}
expr(A) ::= expr(X) STAR|SLASH|REM(OP) expr(Y).
                                           {A = sqlite3PExpr(pParse,@OP,X,Y,0);}
expr(A) ::= expr(X) CONCAT(OP) expr(Y).    {A = sqlite3PExpr(pParse,@OP,X,Y,0);}
%type likeop {struct LikeOp}
likeop(A) ::= LIKE_KW(X).     {A.eOperator = X; A.not = 0;}
likeop(A) ::= NOT LIKE_KW(X). {A.eOperator = X; A.not = 1;}
likeop(A) ::= MATCH(X).       {A.eOperator = X; A.not = 0;}
likeop(A) ::= NOT MATCH(X).   {A.eOperator = X; A.not = 1;}
%type escape {Expr*}
%destructor escape {sqlite3ExprDelete(pParse->db, $$);}
escape(X) ::= ESCAPE expr(A). [ESCAPE] {X = A;}
escape(X) ::= .               [ESCAPE] {X = 0;}
expr(A) ::= expr(X) likeop(OP) expr(Y) escape(E).  [LIKE_KW]  {
  ExprList *pList;
  pList = sqlite3ExprListAppend(pParse,0, Y, 0);
  pList = sqlite3ExprListAppend(pParse,pList, X, 0);
  if( E ){
    pList = sqlite3ExprListAppend(pParse,pList, E, 0);
  }
  A = sqlite3ExprFunction(pParse, pList, &OP.eOperator);
  if( OP.not ) A = sqlite3PExpr(pParse, TK_NOT, A, 0, 0);
  sqlite3ExprSpan(A, &X->span, &Y->span);
  if( A ) A->flags |= EP_InfixFunc;
}

expr(A) ::= expr(X) ISNULL|NOTNULL(E). {
  A = sqlite3PExpr(pParse, @E, X, 0, 0);
  sqlite3ExprSpan(A,&X->span,&E);
}
expr(A) ::= expr(X) IS NULL(E). {
  A = sqlite3PExpr(pParse, TK_ISNULL, X, 0, 0);
  sqlite3ExprSpan(A,&X->span,&E);
}
expr(A) ::= expr(X) NOT NULL(E). {
  A = sqlite3PExpr(pParse, TK_NOTNULL, X, 0, 0);
  sqlite3ExprSpan(A,&X->span,&E);
}
expr(A) ::= expr(X) IS NOT NULL(E). {
  A = sqlite3PExpr(pParse, TK_NOTNULL, X, 0, 0);
  sqlite3ExprSpan(A,&X->span,&E);
}
expr(A) ::= NOT(B) expr(X). {
  A = sqlite3PExpr(pParse, @B, X, 0, 0);
  sqlite3ExprSpan(A,&B,&X->span);
}
expr(A) ::= BITNOT(B) expr(X). {
  A = sqlite3PExpr(pParse, @B, X, 0, 0);
  sqlite3ExprSpan(A,&B,&X->span);
}
expr(A) ::= MINUS(B) expr(X). [UMINUS] {
  A = sqlite3PExpr(pParse, TK_UMINUS, X, 0, 0);
  sqlite3ExprSpan(A,&B,&X->span);
}
expr(A) ::= PLUS(B) expr(X). [UPLUS] {
  A = sqlite3PExpr(pParse, TK_UPLUS, X, 0, 0);
  sqlite3ExprSpan(A,&B,&X->span);
}
%type between_op {int}
between_op(A) ::= BETWEEN.     {A = 0;}
between_op(A) ::= NOT BETWEEN. {A = 1;}
expr(A) ::= expr(W) between_op(N) expr(X) AND expr(Y). [BETWEEN] {
  ExprList *pList = sqlite3ExprListAppend(pParse,0, X, 0);
  pList = sqlite3ExprListAppend(pParse,pList, Y, 0);
  A = sqlite3PExpr(pParse, TK_BETWEEN, W, 0, 0);
  if( A ){
    A->pList = pList;
  }else{
    sqlite3ExprListDelete(pParse->db, pList);
  } 
  if( N ) A = sqlite3PExpr(pParse, TK_NOT, A, 0, 0);
  sqlite3ExprSpan(A,&W->span,&Y->span);
}
%ifndef SQLITE_OMIT_SUBQUERY
  %type in_op {int}
  in_op(A) ::= IN.      {A = 0;}
  in_op(A) ::= NOT IN.  {A = 1;}
  expr(A) ::= expr(X) in_op(N) LP exprlist(Y) RP(E). [IN] {
    A = sqlite3PExpr(pParse, TK_IN, X, 0, 0);
    if( A ){
      A->pList = Y;
      sqlite3ExprSetHeight(pParse, A);
    }else{
      sqlite3ExprListDelete(pParse->db, Y);
    }
    if( N ) A = sqlite3PExpr(pParse, TK_NOT, A, 0, 0);
    sqlite3ExprSpan(A,&X->span,&E);
  }
  expr(A) ::= LP(B) select(X) RP(E). {
    A = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0);
    if( A ){
      A->pSelect = X;
      sqlite3ExprSetHeight(pParse, A);
    }else{
      sqlite3SelectDelete(pParse->db, X);
    }
    sqlite3ExprSpan(A,&B,&E);
  }
  expr(A) ::= expr(X) in_op(N) LP select(Y) RP(E).  [IN] {
    A = sqlite3PExpr(pParse, TK_IN, X, 0, 0);
    if( A ){
      A->pSelect = Y;
      sqlite3ExprSetHeight(pParse, A);
    }else{
      sqlite3SelectDelete(pParse->db, Y);
    }
    if( N ) A = sqlite3PExpr(pParse, TK_NOT, A, 0, 0);
    sqlite3ExprSpan(A,&X->span,&E);
  }
  expr(A) ::= expr(X) in_op(N) nm(Y) dbnm(Z). [IN] {
    SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&Y,&Z);
    A = sqlite3PExpr(pParse, TK_IN, X, 0, 0);
    if( A ){
      A->pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
      sqlite3ExprSetHeight(pParse, A);
    }else{
      sqlite3SrcListDelete(pParse->db, pSrc);
    }
    if( N ) A = sqlite3PExpr(pParse, TK_NOT, A, 0, 0);
    sqlite3ExprSpan(A,&X->span,Z.z?&Z:&Y);
  }
  expr(A) ::= EXISTS(B) LP select(Y) RP(E). {
    Expr *p = A = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0);
    if( p ){
      p->pSelect = Y;
      sqlite3ExprSpan(p,&B,&E);
      sqlite3ExprSetHeight(pParse, A);
    }else{
      sqlite3SelectDelete(pParse->db, Y);
    }
  }
%endif SQLITE_OMIT_SUBQUERY

/* CASE expressions */
expr(A) ::= CASE(C) case_operand(X) case_exprlist(Y) case_else(Z) END(E). {
  A = sqlite3PExpr(pParse, TK_CASE, X, Z, 0);
  if( A ){
    A->pList = Y;
    sqlite3ExprSetHeight(pParse, A);
  }else{
    sqlite3ExprListDelete(pParse->db, Y);
  }
  sqlite3ExprSpan(A, &C, &E);
}
%type case_exprlist {ExprList*}
%destructor case_exprlist {sqlite3ExprListDelete(pParse->db, $$);}
case_exprlist(A) ::= case_exprlist(X) WHEN expr(Y) THEN expr(Z). {
  A = sqlite3ExprListAppend(pParse,X, Y, 0);
  A = sqlite3ExprListAppend(pParse,A, Z, 0);
}
case_exprlist(A) ::= WHEN expr(Y) THEN expr(Z). {
  A = sqlite3ExprListAppend(pParse,0, Y, 0);
  A = sqlite3ExprListAppend(pParse,A, Z, 0);
}
%type case_else {Expr*}
%destructor case_else {sqlite3ExprDelete(pParse->db, $$);}
case_else(A) ::=  ELSE expr(X).         {A = X;}
case_else(A) ::=  .                     {A = 0;} 
%type case_operand {Expr*}
%destructor case_operand {sqlite3ExprDelete(pParse->db, $$);}
case_operand(A) ::= expr(X).            {A = X;} 
case_operand(A) ::= .                   {A = 0;} 

%type exprlist {ExprList*}
%destructor exprlist {sqlite3ExprListDelete(pParse->db, $$);}
%type nexprlist {ExprList*}
%destructor nexprlist {sqlite3ExprListDelete(pParse->db, $$);}

exprlist(A) ::= nexprlist(X).                {A = X;}
exprlist(A) ::= .                            {A = 0;}
nexprlist(A) ::= nexprlist(X) COMMA expr(Y).
    {A = sqlite3ExprListAppend(pParse,X,Y,0);}
nexprlist(A) ::= expr(Y).
    {A = sqlite3ExprListAppend(pParse,0,Y,0);}


///////////////////////////// The CREATE INDEX command ///////////////////////
//
cmd ::= CREATE(S) uniqueflag(U) INDEX ifnotexists(NE) nm(X) dbnm(D)
        ON nm(Y) LP idxlist(Z) RP(E). {
  sqlite3CreateIndex(pParse, &X, &D, 
                     sqlite3SrcListAppend(pParse->db,0,&Y,0), Z, U,
                      &S, &E, SQLITE_SO_ASC, NE);
}

%type uniqueflag {int}
uniqueflag(A) ::= UNIQUE.  {A = OE_Abort;}
uniqueflag(A) ::= .        {A = OE_None;}

%type idxlist {ExprList*}
%destructor idxlist {sqlite3ExprListDelete(pParse->db, $$);}
%type idxlist_opt {ExprList*}
%destructor idxlist_opt {sqlite3ExprListDelete(pParse->db, $$);}
%type idxitem {Token}

idxlist_opt(A) ::= .                         {A = 0;}
idxlist_opt(A) ::= LP idxlist(X) RP.         {A = X;}
idxlist(A) ::= idxlist(X) COMMA idxitem(Y) collate(C) sortorder(Z).  {
  Expr *p = 0;
  if( C.n>0 ){
    p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0);
    sqlite3ExprSetColl(pParse, p, &C);
  }
  A = sqlite3ExprListAppend(pParse,X, p, &Y);
  sqlite3ExprListCheckLength(pParse, A, "index");
  if( A ) A->a[A->nExpr-1].sortOrder = Z;
}
idxlist(A) ::= idxitem(Y) collate(C) sortorder(Z). {
  Expr *p = 0;
  if( C.n>0 ){
    p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0);
    sqlite3ExprSetColl(pParse, p, &C);
  }
  A = sqlite3ExprListAppend(pParse,0, p, &Y);
  sqlite3ExprListCheckLength(pParse, A, "index");
  if( A ) A->a[A->nExpr-1].sortOrder = Z;
}
idxitem(A) ::= nm(X).              {A = X;}

%type collate {Token}
collate(C) ::= .                {C.z = 0; C.n = 0;}
collate(C) ::= COLLATE ids(X).   {C = X;}


///////////////////////////// The DROP INDEX command /////////////////////////
//
cmd ::= DROP INDEX ifexists(E) fullname(X).   {sqlite3DropIndex(pParse, X, E);}

///////////////////////////// The VACUUM command /////////////////////////////
//
%ifndef SQLITE_OMIT_VACUUM
%ifndef SQLITE_OMIT_ATTACH
cmd ::= VACUUM.                {sqlite3Vacuum(pParse);}
cmd ::= VACUUM nm.             {sqlite3Vacuum(pParse);}
%endif  SQLITE_OMIT_ATTACH
%endif  SQLITE_OMIT_VACUUM

///////////////////////////// The PRAGMA command /////////////////////////////
//
%ifndef SQLITE_OMIT_PARSER
%ifndef SQLITE_OMIT_PRAGMA
cmd ::= PRAGMA nm(X) dbnm(Z) EQ nmnum(Y).   {sqlite3Pragma(pParse,&X,&Z,&Y,0);}
cmd ::= PRAGMA nm(X) dbnm(Z) EQ ON(Y).      {sqlite3Pragma(pParse,&X,&Z,&Y,0);}
cmd ::= PRAGMA nm(X) dbnm(Z) EQ DELETE(Y).  {sqlite3Pragma(pParse,&X,&Z,&Y,0);}
cmd ::= PRAGMA nm(X) dbnm(Z) EQ minus_num(Y). {
  sqlite3Pragma(pParse,&X,&Z,&Y,1);
}
cmd ::= PRAGMA nm(X) dbnm(Z) LP nmnum(Y) RP. {sqlite3Pragma(pParse,&X,&Z,&Y,0);}
cmd ::= PRAGMA nm(X) dbnm(Z).             {sqlite3Pragma(pParse,&X,&Z,0,0);}
nmnum(A) ::= plus_num(X).             {A = X;}
nmnum(A) ::= nm(X).                   {A = X;}
%endif SQLITE_OMIT_PRAGMA
%endif SQLITE_OMIT_PARSER
plus_num(A) ::= plus_opt number(X).   {A = X;}
minus_num(A) ::= MINUS number(X).     {A = X;}
number(A) ::= INTEGER|FLOAT(X).       {A = X;}
plus_opt ::= PLUS.
plus_opt ::= .

//////////////////////////// The CREATE TRIGGER command /////////////////////

%ifndef SQLITE_OMIT_TRIGGER

cmd ::= CREATE trigger_decl(A) BEGIN trigger_cmd_list(S) END(Z). {
  Token all;
  all.z = A.z;
  all.n = (Z.z - A.z) + Z.n;
  sqlite3FinishTrigger(pParse, S, &all);
}

trigger_decl(A) ::= temp(T) TRIGGER ifnotexists(NOERR) nm(B) dbnm(Z) 
                    trigger_time(C) trigger_event(D)
                    ON fullname(E) foreach_clause when_clause(G). {
  sqlite3BeginTrigger(pParse, &B, &Z, C, D.a, D.b, E, G, T, NOERR);
  A = (Z.n==0?B:Z);
}

%type trigger_time {int}
trigger_time(A) ::= BEFORE.      { A = TK_BEFORE; }
trigger_time(A) ::= AFTER.       { A = TK_AFTER;  }
trigger_time(A) ::= INSTEAD OF.  { A = TK_INSTEAD;}
trigger_time(A) ::= .            { A = TK_BEFORE; }

%type trigger_event {struct TrigEvent}
%destructor trigger_event {sqlite3IdListDelete(pParse->db, $$.b);}
trigger_event(A) ::= DELETE|INSERT(OP).       {A.a = @OP; A.b = 0;}
trigger_event(A) ::= UPDATE(OP).              {A.a = @OP; A.b = 0;}
trigger_event(A) ::= UPDATE OF inscollist(X). {A.a = TK_UPDATE; A.b = X;}

foreach_clause ::= .
foreach_clause ::= FOR EACH ROW.

%type when_clause {Expr*}
%destructor when_clause {sqlite3ExprDelete(pParse->db, $$);}
when_clause(A) ::= .             { A = 0; }
when_clause(A) ::= WHEN expr(X). { A = X; }

%type trigger_cmd_list {TriggerStep*}
%destructor trigger_cmd_list {sqlite3DeleteTriggerStep(pParse->db, $$);}
trigger_cmd_list(A) ::= trigger_cmd_list(Y) trigger_cmd(X) SEMI. {
  if( Y ){
    Y->pLast->pNext = X;
  }else{
    Y = X;
  }
  Y->pLast = X;
  A = Y;
}
trigger_cmd_list(A) ::= . { A = 0; }

%type trigger_cmd {TriggerStep*}
%destructor trigger_cmd {sqlite3DeleteTriggerStep(pParse->db, $$);}
// UPDATE 
trigger_cmd(A) ::= UPDATE orconf(R) nm(X) SET setlist(Y) where_opt(Z).  
               { A = sqlite3TriggerUpdateStep(pParse->db, &X, Y, Z, R); }

// INSERT
trigger_cmd(A) ::= insert_cmd(R) INTO nm(X) inscollist_opt(F) 
                   VALUES LP itemlist(Y) RP.  
               {A = sqlite3TriggerInsertStep(pParse->db, &X, F, Y, 0, R);}

trigger_cmd(A) ::= insert_cmd(R) INTO nm(X) inscollist_opt(F) select(S).
               {A = sqlite3TriggerInsertStep(pParse->db, &X, F, 0, S, R);}

// DELETE
trigger_cmd(A) ::= DELETE FROM nm(X) where_opt(Y).
               {A = sqlite3TriggerDeleteStep(pParse->db, &X, Y);}

// SELECT
trigger_cmd(A) ::= select(X).  {A = sqlite3TriggerSelectStep(pParse->db, X); }

// The special RAISE expression that may occur in trigger programs
expr(A) ::= RAISE(X) LP IGNORE RP(Y).  {
  A = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0); 
  if( A ){
    A->iColumn = OE_Ignore;
    sqlite3ExprSpan(A, &X, &Y);
  }
}
expr(A) ::= RAISE(X) LP raisetype(T) COMMA nm(Z) RP(Y).  {
  A = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &Z); 
  if( A ) {
    A->iColumn = T;
    sqlite3ExprSpan(A, &X, &Y);
  }
}
%endif  !SQLITE_OMIT_TRIGGER

%type raisetype {int}
raisetype(A) ::= ROLLBACK.  {A = OE_Rollback;}
raisetype(A) ::= ABORT.     {A = OE_Abort;}
raisetype(A) ::= FAIL.      {A = OE_Fail;}


////////////////////////  DROP TRIGGER statement //////////////////////////////
%ifndef SQLITE_OMIT_TRIGGER
cmd ::= DROP TRIGGER ifexists(NOERR) fullname(X). {
  sqlite3DropTrigger(pParse,X,NOERR);
}
%endif  !SQLITE_OMIT_TRIGGER

//////////////////////// ATTACH DATABASE file AS name /////////////////////////
%ifndef SQLITE_OMIT_ATTACH
cmd ::= ATTACH database_kw_opt expr(F) AS expr(D) key_opt(K). {
  sqlite3Attach(pParse, F, D, K);
}
cmd ::= DETACH database_kw_opt expr(D). {
  sqlite3Detach(pParse, D);
}

%type key_opt {Expr*}
%destructor key_opt {sqlite3ExprDelete(pParse->db, $$);}
key_opt(A) ::= .                     { A = 0; }
key_opt(A) ::= KEY expr(X).          { A = X; }

database_kw_opt ::= DATABASE.
database_kw_opt ::= .
%endif SQLITE_OMIT_ATTACH

////////////////////////// REINDEX collation //////////////////////////////////
%ifndef SQLITE_OMIT_REINDEX
cmd ::= REINDEX.                {sqlite3Reindex(pParse, 0, 0);}
cmd ::= REINDEX nm(X) dbnm(Y).  {sqlite3Reindex(pParse, &X, &Y);}
%endif  SQLITE_OMIT_REINDEX

/////////////////////////////////// ANALYZE ///////////////////////////////////
%ifndef SQLITE_OMIT_ANALYZE
cmd ::= ANALYZE.                {sqlite3Analyze(pParse, 0, 0);}
cmd ::= ANALYZE nm(X) dbnm(Y).  {sqlite3Analyze(pParse, &X, &Y);}
%endif

//////////////////////// ALTER TABLE table ... ////////////////////////////////
%ifndef SQLITE_OMIT_ALTERTABLE
cmd ::= ALTER TABLE fullname(X) RENAME TO nm(Z). {
  sqlite3AlterRenameTable(pParse,X,&Z);
}
cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column(Y). {
  sqlite3AlterFinishAddColumn(pParse, &Y);
}
add_column_fullname ::= fullname(X). {
  sqlite3AlterBeginAddColumn(pParse, X);
}
kwcolumn_opt ::= .
kwcolumn_opt ::= COLUMNKW.
%endif  SQLITE_OMIT_ALTERTABLE

//////////////////////// CREATE VIRTUAL TABLE ... /////////////////////////////
%ifndef SQLITE_OMIT_VIRTUALTABLE
cmd ::= create_vtab.                       {sqlite3VtabFinishParse(pParse,0);}
cmd ::= create_vtab LP vtabarglist RP(X).  {sqlite3VtabFinishParse(pParse,&X);}
create_vtab ::= CREATE VIRTUAL TABLE nm(X) dbnm(Y) USING nm(Z). {
    sqlite3VtabBeginParse(pParse, &X, &Y, &Z);
}
vtabarglist ::= vtabarg.
vtabarglist ::= vtabarglist COMMA vtabarg.
vtabarg ::= .                       {sqlite3VtabArgInit(pParse);}
vtabarg ::= vtabarg vtabargtoken.
vtabargtoken ::= ANY(X).            {sqlite3VtabArgExtend(pParse,&X);}
vtabargtoken ::= lp anylist RP(X).  {sqlite3VtabArgExtend(pParse,&X);}
lp ::= LP(X).                       {sqlite3VtabArgExtend(pParse,&X);}
anylist ::= .
anylist ::= anylist ANY(X).         {sqlite3VtabArgExtend(pParse,&X);}
%endif  SQLITE_OMIT_VIRTUALTABLE
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/pragma.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
/*
** 2003 April 6
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to implement the PRAGMA command.
**
** $Id: pragma.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/* Ignore this whole file if pragmas are disabled
*/
#if !defined(SQLITE_OMIT_PRAGMA) && !defined(SQLITE_OMIT_PARSER)

/*
** Interpret the given string as a safety level.  Return 0 for OFF,
** 1 for ON or NORMAL and 2 for FULL.  Return 1 for an empty or 
** unrecognized string argument.
**
** Note that the values returned are one less that the values that
** should be passed into sqlite3BtreeSetSafetyLevel().  The is done
** to support legacy SQL code.  The safety level used to be boolean
** and older scripts may have used numbers 0 for OFF and 1 for ON.
*/
static int getSafetyLevel(const char *z){
                             /* 123456789 123456789 */
  static const char zText[] = "onoffalseyestruefull";
  static const u8 iOffset[] = {0, 1, 2, 4, 9, 12, 16};
  static const u8 iLength[] = {2, 2, 3, 5, 3, 4, 4};
  static const u8 iValue[] =  {1, 0, 0, 0, 1, 1, 2};
  int i, n;
  if( isdigit(*z) ){
    return atoi(z);
  }
  n = strlen(z);
  for(i=0; i<sizeof(iLength); i++){
    if( iLength[i]==n && sqlite3StrNICmp(&zText[iOffset[i]],z,n)==0 ){
      return iValue[i];
    }
  }
  return 1;
}

/*
** Interpret the given string as a boolean value.
*/
static int getBoolean(const char *z){
  return getSafetyLevel(z)&1;
}

/*
** Interpret the given string as a locking mode value.
*/
static int getLockingMode(const char *z){
  if( z ){
    if( 0==sqlite3StrICmp(z, "exclusive") ) return PAGER_LOCKINGMODE_EXCLUSIVE;
    if( 0==sqlite3StrICmp(z, "normal") ) return PAGER_LOCKINGMODE_NORMAL;
  }
  return PAGER_LOCKINGMODE_QUERY;
}

#ifndef SQLITE_OMIT_AUTOVACUUM
/*
** Interpret the given string as an auto-vacuum mode value.
**
** The following strings, "none", "full" and "incremental" are 
** acceptable, as are their numeric equivalents: 0, 1 and 2 respectively.
*/
static int getAutoVacuum(const char *z){
  int i;
  if( 0==sqlite3StrICmp(z, "none") ) return BTREE_AUTOVACUUM_NONE;
  if( 0==sqlite3StrICmp(z, "full") ) return BTREE_AUTOVACUUM_FULL;
  if( 0==sqlite3StrICmp(z, "incremental") ) return BTREE_AUTOVACUUM_INCR;
  i = atoi(z);
  return ((i>=0&&i<=2)?i:0);
}
#endif /* ifndef SQLITE_OMIT_AUTOVACUUM */

#ifndef SQLITE_OMIT_PAGER_PRAGMAS
/*
** Interpret the given string as a temp db location. Return 1 for file
** backed temporary databases, 2 for the Red-Black tree in memory database
** and 0 to use the compile-time default.
*/
static int getTempStore(const char *z){
  if( z[0]>='0' && z[0]<='2' ){
    return z[0] - '0';
  }else if( sqlite3StrICmp(z, "file")==0 ){
    return 1;
  }else if( sqlite3StrICmp(z, "memory")==0 ){
    return 2;
  }else{
    return 0;
  }
}
#endif /* SQLITE_PAGER_PRAGMAS */

#ifndef SQLITE_OMIT_PAGER_PRAGMAS
/*
** Invalidate temp storage, either when the temp storage is changed
** from default, or when 'file' and the temp_store_directory has changed
*/
static int invalidateTempStorage(Parse *pParse){
  sqlite3 *db = pParse->db;
  if( db->aDb[1].pBt!=0 ){
    if( !db->autoCommit || sqlite3BtreeIsInReadTrans(db->aDb[1].pBt) ){
      sqlite3ErrorMsg(pParse, "temporary storage cannot be changed "
        "from within a transaction");
      return SQLITE_ERROR;
    }
    sqlite3BtreeClose(db->aDb[1].pBt);
    db->aDb[1].pBt = 0;
    sqlite3ResetInternalSchema(db, 0);
  }
  return SQLITE_OK;
}
#endif /* SQLITE_PAGER_PRAGMAS */

#ifndef SQLITE_OMIT_PAGER_PRAGMAS
/*
** If the TEMP database is open, close it and mark the database schema
** as needing reloading.  This must be done when using the SQLITE_TEMP_STORE
** or DEFAULT_TEMP_STORE pragmas.
*/
static int changeTempStorage(Parse *pParse, const char *zStorageType){
  int ts = getTempStore(zStorageType);
  sqlite3 *db = pParse->db;
  if( db->temp_store==ts ) return SQLITE_OK;
  if( invalidateTempStorage( pParse ) != SQLITE_OK ){
    return SQLITE_ERROR;
  }
  db->temp_store = ts;
  return SQLITE_OK;
}
#endif /* SQLITE_PAGER_PRAGMAS */

/*
** Generate code to return a single integer value.
*/
static void returnSingleInt(Parse *pParse, const char *zLabel, int value){
  Vdbe *v = sqlite3GetVdbe(pParse);
  int mem = ++pParse->nMem;
  sqlite3VdbeAddOp2(v, OP_Integer, value, mem);
  if( pParse->explain==0 ){
    sqlite3VdbeSetNumCols(v, 1);
    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLabel, P4_STATIC);
  }
  sqlite3VdbeAddOp2(v, OP_ResultRow, mem, 1);
}

#ifndef SQLITE_OMIT_FLAG_PRAGMAS
/*
** Check to see if zRight and zLeft refer to a pragma that queries
** or changes one of the flags in db->flags.  Return 1 if so and 0 if not.
** Also, implement the pragma.
*/
static int flagPragma(Parse *pParse, const char *zLeft, const char *zRight){
  static const struct sPragmaType {
    const char *zName;  /* Name of the pragma */
    int mask;           /* Mask for the db->flags value */
  } aPragma[] = {
    { "full_column_names",        SQLITE_FullColNames  },
    { "short_column_names",       SQLITE_ShortColNames },
    { "count_changes",            SQLITE_CountRows     },
    { "empty_result_callbacks",   SQLITE_NullCallback  },
    { "legacy_file_format",       SQLITE_LegacyFileFmt },
    { "fullfsync",                SQLITE_FullFSync     },
#ifdef SQLITE_DEBUG
    { "sql_trace",                SQLITE_SqlTrace      },
    { "vdbe_listing",             SQLITE_VdbeListing   },
    { "vdbe_trace",               SQLITE_VdbeTrace     },
#endif
#ifndef SQLITE_OMIT_CHECK
    { "ignore_check_constraints", SQLITE_IgnoreChecks  },
#endif
    /* The following is VERY experimental */
    { "writable_schema",          SQLITE_WriteSchema|SQLITE_RecoveryMode },
    { "omit_readlock",            SQLITE_NoReadlock    },

    /* TODO: Maybe it shouldn't be possible to change the ReadUncommitted
    ** flag if there are any active statements. */
    { "read_uncommitted",         SQLITE_ReadUncommitted },
  };
  int i;
  const struct sPragmaType *p;
  for(i=0, p=aPragma; i<sizeof(aPragma)/sizeof(aPragma[0]); i++, p++){
    if( sqlite3StrICmp(zLeft, p->zName)==0 ){
      sqlite3 *db = pParse->db;
      Vdbe *v;
      v = sqlite3GetVdbe(pParse);
      if( v ){
        if( zRight==0 ){
          returnSingleInt(pParse, p->zName, (db->flags & p->mask)!=0 );
        }else{
          if( getBoolean(zRight) ){
            db->flags |= p->mask;
          }else{
            db->flags &= ~p->mask;
          }

          /* Many of the flag-pragmas modify the code generated by the SQL 
          ** compiler (eg. count_changes). So add an opcode to expire all
          ** compiled SQL statements after modifying a pragma value.
          */
          sqlite3VdbeAddOp2(v, OP_Expire, 0, 0);
        }
      }

      return 1;
    }
  }
  return 0;
}
#endif /* SQLITE_OMIT_FLAG_PRAGMAS */

/*
** Process a pragma statement.  
**
** Pragmas are of this form:
**
**      PRAGMA [database.]id [= value]
**
** The identifier might also be a string.  The value is a string, and
** identifier, or a number.  If minusFlag is true, then the value is
** a number that was preceded by a minus sign.
**
** If the left side is "database.id" then pId1 is the database name
** and pId2 is the id.  If the left side is just "id" then pId1 is the
** id and pId2 is any empty string.
*/
void sqlite3Pragma(
  Parse *pParse, 
  Token *pId1,        /* First part of [database.]id field */
  Token *pId2,        /* Second part of [database.]id field, or NULL */
  Token *pValue,      /* Token for <value>, or NULL */
  int minusFlag       /* True if a '-' sign preceded <value> */
){
  char *zLeft = 0;       /* Nul-terminated UTF-8 string <id> */
  char *zRight = 0;      /* Nul-terminated UTF-8 string <value>, or NULL */
  const char *zDb = 0;   /* The database name */
  Token *pId;            /* Pointer to <id> token */
  int iDb;               /* Database index for <database> */
  sqlite3 *db = pParse->db;
  Db *pDb;
  Vdbe *v = pParse->pVdbe = sqlite3VdbeCreate(db);
  if( v==0 ) return;
  pParse->nMem = 2;

  /* Interpret the [database.] part of the pragma statement. iDb is the
  ** index of the database this pragma is being applied to in db.aDb[]. */
  iDb = sqlite3TwoPartName(pParse, pId1, pId2, &pId);
  if( iDb<0 ) return;
  pDb = &db->aDb[iDb];

  /* If the temp database has been explicitly named as part of the 
  ** pragma, make sure it is open. 
  */
  if( iDb==1 && sqlite3OpenTempDatabase(pParse) ){
    return;
  }

  zLeft = sqlite3NameFromToken(db, pId);
  if( !zLeft ) return;
  if( minusFlag ){
    zRight = sqlite3MPrintf(db, "-%T", pValue);
  }else{
    zRight = sqlite3NameFromToken(db, pValue);
  }

  zDb = ((iDb>0)?pDb->zName:0);
  if( sqlite3AuthCheck(pParse, SQLITE_PRAGMA, zLeft, zRight, zDb) ){
    goto pragma_out;
  }
 
#ifndef SQLITE_OMIT_PAGER_PRAGMAS
  /*
  **  PRAGMA [database.]default_cache_size
  **  PRAGMA [database.]default_cache_size=N
  **
  ** The first form reports the current persistent setting for the
  ** page cache size.  The value returned is the maximum number of
  ** pages in the page cache.  The second form sets both the current
  ** page cache size value and the persistent page cache size value
  ** stored in the database file.
  **
  ** The default cache size is stored in meta-value 2 of page 1 of the
  ** database file.  The cache size is actually the absolute value of
  ** this memory location.  The sign of meta-value 2 determines the
  ** synchronous setting.  A negative value means synchronous is off
  ** and a positive value means synchronous is on.
  */
  if( sqlite3StrICmp(zLeft,"default_cache_size")==0 ){
    static const VdbeOpList getCacheSize[] = {
      { OP_ReadCookie,  0, 1,        2},  /* 0 */
      { OP_IfPos,       1, 6,        0},
      { OP_Integer,     0, 2,        0},
      { OP_Subtract,    1, 2,        1},
      { OP_IfPos,       1, 6,        0},
      { OP_Integer,     0, 1,        0},  /* 5 */
      { OP_ResultRow,   1, 1,        0},
    };
    int addr;
    if( sqlite3ReadSchema(pParse) ) goto pragma_out;
    sqlite3VdbeUsesBtree(v, iDb);
    if( !zRight ){
      sqlite3VdbeSetNumCols(v, 1);
      sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "cache_size", P4_STATIC);
      pParse->nMem += 2;
      addr = sqlite3VdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize);
      sqlite3VdbeChangeP1(v, addr, iDb);
      sqlite3VdbeChangeP1(v, addr+5, SQLITE_DEFAULT_CACHE_SIZE);
    }else{
      int size = atoi(zRight);
      if( size<0 ) size = -size;
      sqlite3BeginWriteOperation(pParse, 0, iDb);
      sqlite3VdbeAddOp2(v, OP_Integer, size, 1);
      sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, 2, 2);
      addr = sqlite3VdbeAddOp2(v, OP_IfPos, 2, 0);
      sqlite3VdbeAddOp2(v, OP_Integer, -size, 1);
      sqlite3VdbeJumpHere(v, addr);
      sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, 2, 1);
      pDb->pSchema->cache_size = size;
      sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
    }
  }else

  /*
  **  PRAGMA [database.]page_size
  **  PRAGMA [database.]page_size=N
  **
  ** The first form reports the current setting for the
  ** database page size in bytes.  The second form sets the
  ** database page size value.  The value can only be set if
  ** the database has not yet been created.
  */
  if( sqlite3StrICmp(zLeft,"page_size")==0 ){
    Btree *pBt = pDb->pBt;
    if( !zRight ){
      int size = pBt ? sqlite3BtreeGetPageSize(pBt) : 0;
      returnSingleInt(pParse, "page_size", size);
    }else{
      /* Malloc may fail when setting the page-size, as there is an internal
      ** buffer that the pager module resizes using sqlite3_realloc().
      */
      db->nextPagesize = atoi(zRight);
      if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize, -1) ){
        db->mallocFailed = 1;
      }
    }
  }else

  /*
  **  PRAGMA [database.]max_page_count
  **  PRAGMA [database.]max_page_count=N
  **
  ** The first form reports the current setting for the
  ** maximum number of pages in the database file.  The 
  ** second form attempts to change this setting.  Both
  ** forms return the current setting.
  */
  if( sqlite3StrICmp(zLeft,"max_page_count")==0 ){
    Btree *pBt = pDb->pBt;
    int newMax = 0;
    if( zRight ){
      newMax = atoi(zRight);
    }
    if( pBt ){
      newMax = sqlite3BtreeMaxPageCount(pBt, newMax);
    }
    returnSingleInt(pParse, "max_page_count", newMax);
  }else

  /*
  **  PRAGMA [database.]page_count
  **
  ** Return the number of pages in the specified database.
  */
  if( sqlite3StrICmp(zLeft,"page_count")==0 ){
    Vdbe *v;
    int iReg;
    v = sqlite3GetVdbe(pParse);
    if( !v || sqlite3ReadSchema(pParse) ) goto pragma_out;
    sqlite3CodeVerifySchema(pParse, iDb);
    iReg = ++pParse->nMem;
    sqlite3VdbeAddOp2(v, OP_Pagecount, iDb, iReg);
    sqlite3VdbeAddOp2(v, OP_ResultRow, iReg, 1);
    sqlite3VdbeSetNumCols(v, 1);
    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "page_count", P4_STATIC);
  }else

  /*
  **  PRAGMA [database.]locking_mode
  **  PRAGMA [database.]locking_mode = (normal|exclusive)
  */
  if( sqlite3StrICmp(zLeft,"locking_mode")==0 ){
    const char *zRet = "normal";
    int eMode = getLockingMode(zRight);

    if( pId2->n==0 && eMode==PAGER_LOCKINGMODE_QUERY ){
      /* Simple "PRAGMA locking_mode;" statement. This is a query for
      ** the current default locking mode (which may be different to
      ** the locking-mode of the main database).
      */
      eMode = db->dfltLockMode;
    }else{
      Pager *pPager;
      if( pId2->n==0 ){
        /* This indicates that no database name was specified as part
        ** of the PRAGMA command. In this case the locking-mode must be
        ** set on all attached databases, as well as the main db file.
        **
        ** Also, the sqlite3.dfltLockMode variable is set so that
        ** any subsequently attached databases also use the specified
        ** locking mode.
        */
        int ii;
        assert(pDb==&db->aDb[0]);
        for(ii=2; ii<db->nDb; ii++){
          pPager = sqlite3BtreePager(db->aDb[ii].pBt);
          sqlite3PagerLockingMode(pPager, eMode);
        }
        db->dfltLockMode = eMode;
      }
      pPager = sqlite3BtreePager(pDb->pBt);
      eMode = sqlite3PagerLockingMode(pPager, eMode);
    }

    assert(eMode==PAGER_LOCKINGMODE_NORMAL||eMode==PAGER_LOCKINGMODE_EXCLUSIVE);
    if( eMode==PAGER_LOCKINGMODE_EXCLUSIVE ){
      zRet = "exclusive";
    }
    sqlite3VdbeSetNumCols(v, 1);
    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "locking_mode", P4_STATIC);
    sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, zRet, 0);
    sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
  }else

  /*
  **  PRAGMA [database.]journal_mode
  **  PRAGMA [database.]journal_mode = (delete|persist|off)
  */
  if( sqlite3StrICmp(zLeft,"journal_mode")==0 ){
    int eMode;
    static const char *azModeName[] = {"delete", "persist", "off"};

    if( zRight==0 ){
      eMode = PAGER_JOURNALMODE_QUERY;
    }else{
      int n = strlen(zRight);
      eMode = 2;
      while( eMode>=0 && sqlite3StrNICmp(zRight, azModeName[eMode], n)!=0 ){
        eMode--;
      }
    }
    if( pId2->n==0 && eMode==PAGER_JOURNALMODE_QUERY ){
      /* Simple "PRAGMA journal_mode;" statement. This is a query for
      ** the current default journal mode (which may be different to
      ** the journal-mode of the main database).
      */
      eMode = db->dfltJournalMode;
    }else{
      Pager *pPager;
      if( pId2->n==0 ){
        /* This indicates that no database name was specified as part
        ** of the PRAGMA command. In this case the journal-mode must be
        ** set on all attached databases, as well as the main db file.
        **
        ** Also, the sqlite3.dfltJournalMode variable is set so that
        ** any subsequently attached databases also use the specified
        ** journal mode.
        */
        int ii;
        assert(pDb==&db->aDb[0]);
        for(ii=1; ii<db->nDb; ii++){
          if( db->aDb[ii].pBt ){
            pPager = sqlite3BtreePager(db->aDb[ii].pBt);
            sqlite3PagerJournalMode(pPager, eMode);
          }
        }
        db->dfltJournalMode = eMode;
      }
      pPager = sqlite3BtreePager(pDb->pBt);
      eMode = sqlite3PagerJournalMode(pPager, eMode);
    }
    assert( eMode==PAGER_JOURNALMODE_DELETE
              || eMode==PAGER_JOURNALMODE_PERSIST
              || eMode==PAGER_JOURNALMODE_OFF );
    sqlite3VdbeSetNumCols(v, 1);
    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "journal_mode", P4_STATIC);
    sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, 
           azModeName[eMode], P4_STATIC);
    sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
  }else

  /*
  **  PRAGMA [database.]journal_size_limit
  **  PRAGMA [database.]journal_size_limit=N
  **
  ** Get or set the (boolean) value of the database 'auto-vacuum' parameter.
  */
  if( sqlite3StrICmp(zLeft,"journal_size_limit")==0 ){
    Pager *pPager = sqlite3BtreePager(pDb->pBt);
    i64 iLimit = -2;
    if( zRight ){
      int iLimit32 = atoi(zRight);
      if( iLimit32<-1 ){
        iLimit32 = -1;
      }
      iLimit = iLimit32;
    }
    iLimit = sqlite3PagerJournalSizeLimit(pPager, iLimit);
    returnSingleInt(pParse, "journal_size_limit", (int)iLimit);
  }else

#endif /* SQLITE_OMIT_PAGER_PRAGMAS */

  /*
  **  PRAGMA [database.]auto_vacuum
  **  PRAGMA [database.]auto_vacuum=N
  **
  ** Get or set the (boolean) value of the database 'auto-vacuum' parameter.
  */
#ifndef SQLITE_OMIT_AUTOVACUUM
  if( sqlite3StrICmp(zLeft,"auto_vacuum")==0 ){
    Btree *pBt = pDb->pBt;
    if( sqlite3ReadSchema(pParse) ){
      goto pragma_out;
    }
    if( !zRight ){
      int auto_vacuum = 
          pBt ? sqlite3BtreeGetAutoVacuum(pBt) : SQLITE_DEFAULT_AUTOVACUUM;
      returnSingleInt(pParse, "auto_vacuum", auto_vacuum);
    }else{
      int eAuto = getAutoVacuum(zRight);
      db->nextAutovac = eAuto;
      if( eAuto>=0 ){
        /* Call SetAutoVacuum() to set initialize the internal auto and
        ** incr-vacuum flags. This is required in case this connection
        ** creates the database file. It is important that it is created
        ** as an auto-vacuum capable db.
        */
        int rc = sqlite3BtreeSetAutoVacuum(pBt, eAuto);
        if( rc==SQLITE_OK && (eAuto==1 || eAuto==2) ){
          /* When setting the auto_vacuum mode to either "full" or 
          ** "incremental", write the value of meta[6] in the database
          ** file. Before writing to meta[6], check that meta[3] indicates
          ** that this really is an auto-vacuum capable database.
          */
          static const VdbeOpList setMeta6[] = {
            { OP_Transaction,    0,               1,        0},    /* 0 */
            { OP_ReadCookie,     0,               1,        3},    /* 1 */
            { OP_If,             1,               0,        0},    /* 2 */
            { OP_Halt,           SQLITE_OK,       OE_Abort, 0},    /* 3 */
            { OP_Integer,        0,               1,        0},    /* 4 */
            { OP_SetCookie,      0,               6,        1},    /* 5 */
          };
          int iAddr;
          iAddr = sqlite3VdbeAddOpList(v, ArraySize(setMeta6), setMeta6);
          sqlite3VdbeChangeP1(v, iAddr, iDb);
          sqlite3VdbeChangeP1(v, iAddr+1, iDb);
          sqlite3VdbeChangeP2(v, iAddr+2, iAddr+4);
          sqlite3VdbeChangeP1(v, iAddr+4, eAuto-1);
          sqlite3VdbeChangeP1(v, iAddr+5, iDb);
          sqlite3VdbeUsesBtree(v, iDb);
        }
      }
    }
  }else
#endif

  /*
  **  PRAGMA [database.]incremental_vacuum(N)
  **
  ** Do N steps of incremental vacuuming on a database.
  */
#ifndef SQLITE_OMIT_AUTOVACUUM
  if( sqlite3StrICmp(zLeft,"incremental_vacuum")==0 ){
    int iLimit, addr;
    if( sqlite3ReadSchema(pParse) ){
      goto pragma_out;
    }
    if( zRight==0 || !sqlite3GetInt32(zRight, &iLimit) || iLimit<=0 ){
      iLimit = 0x7fffffff;
    }
    sqlite3BeginWriteOperation(pParse, 0, iDb);
    sqlite3VdbeAddOp2(v, OP_Integer, iLimit, 1);
    addr = sqlite3VdbeAddOp1(v, OP_IncrVacuum, iDb);
    sqlite3VdbeAddOp1(v, OP_ResultRow, 1);
    sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1);
    sqlite3VdbeAddOp2(v, OP_IfPos, 1, addr);
    sqlite3VdbeJumpHere(v, addr);
  }else
#endif

#ifndef SQLITE_OMIT_PAGER_PRAGMAS
  /*
  **  PRAGMA [database.]cache_size
  **  PRAGMA [database.]cache_size=N
  **
  ** The first form reports the current local setting for the
  ** page cache size.  The local setting can be different from
  ** the persistent cache size value that is stored in the database
  ** file itself.  The value returned is the maximum number of
  ** pages in the page cache.  The second form sets the local
  ** page cache size value.  It does not change the persistent
  ** cache size stored on the disk so the cache size will revert
  ** to its default value when the database is closed and reopened.
  ** N should be a positive integer.
  */
  if( sqlite3StrICmp(zLeft,"cache_size")==0 ){
    if( sqlite3ReadSchema(pParse) ) goto pragma_out;
    if( !zRight ){
      returnSingleInt(pParse, "cache_size", pDb->pSchema->cache_size);
    }else{
      int size = atoi(zRight);
      if( size<0 ) size = -size;
      pDb->pSchema->cache_size = size;
      sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
    }
  }else

  /*
  **   PRAGMA temp_store
  **   PRAGMA temp_store = "default"|"memory"|"file"
  **
  ** Return or set the local value of the temp_store flag.  Changing
  ** the local value does not make changes to the disk file and the default
  ** value will be restored the next time the database is opened.
  **
  ** Note that it is possible for the library compile-time options to
  ** override this setting
  */
  if( sqlite3StrICmp(zLeft, "temp_store")==0 ){
    if( !zRight ){
      returnSingleInt(pParse, "temp_store", db->temp_store);
    }else{
      changeTempStorage(pParse, zRight);
    }
  }else

  /*
  **   PRAGMA temp_store_directory
  **   PRAGMA temp_store_directory = ""|"directory_name"
  **
  ** Return or set the local value of the temp_store_directory flag.  Changing
  ** the value sets a specific directory to be used for temporary files.
  ** Setting to a null string reverts to the default temporary directory search.
  ** If temporary directory is changed, then invalidateTempStorage.
  **
  */
  if( sqlite3StrICmp(zLeft, "temp_store_directory")==0 ){
    if( !zRight ){
      if( sqlite3_temp_directory ){
        sqlite3VdbeSetNumCols(v, 1);
        sqlite3VdbeSetColName(v, 0, COLNAME_NAME, 
            "temp_store_directory", P4_STATIC);
        sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, sqlite3_temp_directory, 0);
        sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
      }
    }else{
      if( zRight[0] ){
        int res;
        sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res);
        if( res==0 ){
          sqlite3ErrorMsg(pParse, "not a writable directory");
          goto pragma_out;
        }
      }
      if( SQLITE_TEMP_STORE==0
       || (SQLITE_TEMP_STORE==1 && db->temp_store<=1)
       || (SQLITE_TEMP_STORE==2 && db->temp_store==1)
      ){
        invalidateTempStorage(pParse);
      }
      sqlite3_free(sqlite3_temp_directory);
      if( zRight[0] ){
        sqlite3_temp_directory = sqlite3DbStrDup(0, zRight);
      }else{
        sqlite3_temp_directory = 0;
      }
    }
  }else

  /*
  **   PRAGMA [database.]synchronous
  **   PRAGMA [database.]synchronous=OFF|ON|NORMAL|FULL
  **
  ** Return or set the local value of the synchronous flag.  Changing
  ** the local value does not make changes to the disk file and the
  ** default value will be restored the next time the database is
  ** opened.
  */
  if( sqlite3StrICmp(zLeft,"synchronous")==0 ){
    if( sqlite3ReadSchema(pParse) ) goto pragma_out;
    if( !zRight ){
      returnSingleInt(pParse, "synchronous", pDb->safety_level-1);
    }else{
      if( !db->autoCommit ){
        sqlite3ErrorMsg(pParse, 
            "Safety level may not be changed inside a transaction");
      }else{
        pDb->safety_level = getSafetyLevel(zRight)+1;
      }
    }
  }else
#endif /* SQLITE_OMIT_PAGER_PRAGMAS */

#ifndef SQLITE_OMIT_FLAG_PRAGMAS
  if( flagPragma(pParse, zLeft, zRight) ){
    /* The flagPragma() subroutine also generates any necessary code
    ** there is nothing more to do here */
  }else
#endif /* SQLITE_OMIT_FLAG_PRAGMAS */

#ifndef SQLITE_OMIT_SCHEMA_PRAGMAS
  /*
  **   PRAGMA table_info(<table>)
  **
  ** Return a single row for each column of the named table. The columns of
  ** the returned data set are:
  **
  ** cid:        Column id (numbered from left to right, starting at 0)
  ** name:       Column name
  ** type:       Column declaration type.
  ** notnull:    True if 'NOT NULL' is part of column declaration
  ** dflt_value: The default value for the column, if any.
  */
  if( sqlite3StrICmp(zLeft, "table_info")==0 && zRight ){
    Table *pTab;
    if( sqlite3ReadSchema(pParse) ) goto pragma_out;
    pTab = sqlite3FindTable(db, zRight, zDb);
    if( pTab ){
      int i;
      int nHidden = 0;
      Column *pCol;
      sqlite3VdbeSetNumCols(v, 6);
      pParse->nMem = 6;
      sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "cid", P4_STATIC);
      sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "name", P4_STATIC);
      sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "type", P4_STATIC);
      sqlite3VdbeSetColName(v, 3, COLNAME_NAME, "notnull", P4_STATIC);
      sqlite3VdbeSetColName(v, 4, COLNAME_NAME, "dflt_value", P4_STATIC);
      sqlite3VdbeSetColName(v, 5, COLNAME_NAME, "pk", P4_STATIC);
      sqlite3ViewGetColumnNames(pParse, pTab);
      for(i=0, pCol=pTab->aCol; i<pTab->nCol; i++, pCol++){
        const Token *pDflt;
        if( IsHiddenColumn(pCol) ){
          nHidden++;
          continue;
        }
        sqlite3VdbeAddOp2(v, OP_Integer, i-nHidden, 1);
        sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, pCol->zName, 0);
        sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0,
           pCol->zType ? pCol->zType : "", 0);
        sqlite3VdbeAddOp2(v, OP_Integer, pCol->notNull, 4);
        if( pCol->pDflt && (pDflt = &pCol->pDflt->span)->z ){
          sqlite3VdbeAddOp4(v, OP_String8, 0, 5, 0, (char*)pDflt->z, pDflt->n);
        }else{
          sqlite3VdbeAddOp2(v, OP_Null, 0, 5);
        }
        sqlite3VdbeAddOp2(v, OP_Integer, pCol->isPrimKey, 6);
        sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 6);
      }
    }
  }else

  if( sqlite3StrICmp(zLeft, "index_info")==0 && zRight ){
    Index *pIdx;
    Table *pTab;
    if( sqlite3ReadSchema(pParse) ) goto pragma_out;
    pIdx = sqlite3FindIndex(db, zRight, zDb);
    if( pIdx ){
      int i;
      pTab = pIdx->pTable;
      sqlite3VdbeSetNumCols(v, 3);
      pParse->nMem = 3;
      sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "seqno", P4_STATIC);
      sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "cid", P4_STATIC);
      sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "name", P4_STATIC);
      for(i=0; i<pIdx->nColumn; i++){
        int cnum = pIdx->aiColumn[i];
        sqlite3VdbeAddOp2(v, OP_Integer, i, 1);
        sqlite3VdbeAddOp2(v, OP_Integer, cnum, 2);
        assert( pTab->nCol>cnum );
        sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, pTab->aCol[cnum].zName, 0);
        sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3);
      }
    }
  }else

  if( sqlite3StrICmp(zLeft, "index_list")==0 && zRight ){
    Index *pIdx;
    Table *pTab;
    if( sqlite3ReadSchema(pParse) ) goto pragma_out;
    pTab = sqlite3FindTable(db, zRight, zDb);
    if( pTab ){
      v = sqlite3GetVdbe(pParse);
      pIdx = pTab->pIndex;
      if( pIdx ){
        int i = 0; 
        sqlite3VdbeSetNumCols(v, 3);
        pParse->nMem = 3;
        sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "seq", P4_STATIC);
        sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "name", P4_STATIC);
        sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "unique", P4_STATIC);
        while(pIdx){
          sqlite3VdbeAddOp2(v, OP_Integer, i, 1);
          sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, pIdx->zName, 0);
          sqlite3VdbeAddOp2(v, OP_Integer, pIdx->onError!=OE_None, 3);
          sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3);
          ++i;
          pIdx = pIdx->pNext;
        }
      }
    }
  }else

  if( sqlite3StrICmp(zLeft, "database_list")==0 ){
    int i;
    if( sqlite3ReadSchema(pParse) ) goto pragma_out;
    sqlite3VdbeSetNumCols(v, 3);
    pParse->nMem = 3;
    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "seq", P4_STATIC);
    sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "name", P4_STATIC);
    sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "file", P4_STATIC);
    for(i=0; i<db->nDb; i++){
      if( db->aDb[i].pBt==0 ) continue;
      assert( db->aDb[i].zName!=0 );
      sqlite3VdbeAddOp2(v, OP_Integer, i, 1);
      sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, db->aDb[i].zName, 0);
      sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0,
           sqlite3BtreeGetFilename(db->aDb[i].pBt), 0);
      sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3);
    }
  }else

  if( sqlite3StrICmp(zLeft, "collation_list")==0 ){
    int i = 0;
    HashElem *p;
    sqlite3VdbeSetNumCols(v, 2);
    pParse->nMem = 2;
    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "seq", P4_STATIC);
    sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "name", P4_STATIC);
    for(p=sqliteHashFirst(&db->aCollSeq); p; p=sqliteHashNext(p)){
      CollSeq *pColl = (CollSeq *)sqliteHashData(p);
      sqlite3VdbeAddOp2(v, OP_Integer, i++, 1);
      sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, pColl->zName, 0);
      sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 2);
    }
  }else
#endif /* SQLITE_OMIT_SCHEMA_PRAGMAS */

#ifndef SQLITE_OMIT_FOREIGN_KEY
  if( sqlite3StrICmp(zLeft, "foreign_key_list")==0 && zRight ){
    FKey *pFK;
    Table *pTab;
    if( sqlite3ReadSchema(pParse) ) goto pragma_out;
    pTab = sqlite3FindTable(db, zRight, zDb);
    if( pTab ){
      v = sqlite3GetVdbe(pParse);
      pFK = pTab->pFKey;
      if( pFK ){
        int i = 0; 
        sqlite3VdbeSetNumCols(v, 5);
        pParse->nMem = 5;
        sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "id", P4_STATIC);
        sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "seq", P4_STATIC);
        sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "table", P4_STATIC);
        sqlite3VdbeSetColName(v, 3, COLNAME_NAME, "from", P4_STATIC);
        sqlite3VdbeSetColName(v, 4, COLNAME_NAME, "to", P4_STATIC);
        while(pFK){
          int j;
          for(j=0; j<pFK->nCol; j++){
            char *zCol = pFK->aCol[j].zCol;
            sqlite3VdbeAddOp2(v, OP_Integer, i, 1);
            sqlite3VdbeAddOp2(v, OP_Integer, j, 2);
            sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, pFK->zTo, 0);
            sqlite3VdbeAddOp4(v, OP_String8, 0, 4, 0,
                              pTab->aCol[pFK->aCol[j].iFrom].zName, 0);
            sqlite3VdbeAddOp4(v, zCol ? OP_String8 : OP_Null, 0, 5, 0, zCol, 0);
            sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 5);
          }
          ++i;
          pFK = pFK->pNextFrom;
        }
      }
    }
  }else
#endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */

#ifndef NDEBUG
  if( sqlite3StrICmp(zLeft, "parser_trace")==0 ){
    if( zRight ){
      if( getBoolean(zRight) ){
        sqlite3ParserTrace(stderr, "parser: ");
      }else{
        sqlite3ParserTrace(0, 0);
      }
    }
  }else
#endif

  /* Reinstall the LIKE and GLOB functions.  The variant of LIKE
  ** used will be case sensitive or not depending on the RHS.
  */
  if( sqlite3StrICmp(zLeft, "case_sensitive_like")==0 ){
    if( zRight ){
      sqlite3RegisterLikeFunctions(db, getBoolean(zRight));
    }
  }else

#ifndef SQLITE_INTEGRITY_CHECK_ERROR_MAX
# define SQLITE_INTEGRITY_CHECK_ERROR_MAX 100
#endif

#ifndef SQLITE_OMIT_INTEGRITY_CHECK
  /* Pragma "quick_check" is an experimental reduced version of 
  ** integrity_check designed to detect most database corruption
  ** without most of the overhead of a full integrity-check.
  */
  if( sqlite3StrICmp(zLeft, "integrity_check")==0
   || sqlite3StrICmp(zLeft, "quick_check")==0 
  ){
    int i, j, addr, mxErr;

    /* Code that appears at the end of the integrity check.  If no error
    ** messages have been generated, output OK.  Otherwise output the
    ** error message
    */
    static const VdbeOpList endCode[] = {
      { OP_AddImm,      1, 0,        0},    /* 0 */
      { OP_IfNeg,       1, 0,        0},    /* 1 */
      { OP_String8,     0, 3,        0},    /* 2 */
      { OP_ResultRow,   3, 1,        0},
    };

    int isQuick = (zLeft[0]=='q');

    /* Initialize the VDBE program */
    if( sqlite3ReadSchema(pParse) ) goto pragma_out;
    pParse->nMem = 6;
    sqlite3VdbeSetNumCols(v, 1);
    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "integrity_check", P4_STATIC);

    /* Set the maximum error count */
    mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;
    if( zRight ){
      mxErr = atoi(zRight);
      if( mxErr<=0 ){
        mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX;
      }
    }
    sqlite3VdbeAddOp2(v, OP_Integer, mxErr, 1);  /* reg[1] holds errors left */

    /* Do an integrity check on each database file */
    for(i=0; i<db->nDb; i++){
      HashElem *x;
      Hash *pTbls;
      int cnt = 0;

      if( OMIT_TEMPDB && i==1 ) continue;

      sqlite3CodeVerifySchema(pParse, i);
      addr = sqlite3VdbeAddOp1(v, OP_IfPos, 1); /* Halt if out of errors */
      sqlite3VdbeAddOp2(v, OP_Halt, 0, 0);
      sqlite3VdbeJumpHere(v, addr);

      /* Do an integrity check of the B-Tree
      **
      ** Begin by filling registers 2, 3, ... with the root pages numbers
      ** for all tables and indices in the database.
      */
      pTbls = &db->aDb[i].pSchema->tblHash;
      for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
        Table *pTab = sqliteHashData(x);
        Index *pIdx;
        sqlite3VdbeAddOp2(v, OP_Integer, pTab->tnum, 2+cnt);
        cnt++;
        for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
          sqlite3VdbeAddOp2(v, OP_Integer, pIdx->tnum, 2+cnt);
          cnt++;
        }
      }
      if( cnt==0 ) continue;

      /* Make sure sufficient number of registers have been allocated */
      if( pParse->nMem < cnt+4 ){
        pParse->nMem = cnt+4;
      }

      /* Do the b-tree integrity checks */
      sqlite3VdbeAddOp3(v, OP_IntegrityCk, 2, cnt, 1);
      sqlite3VdbeChangeP5(v, i);
      addr = sqlite3VdbeAddOp1(v, OP_IsNull, 2);
      sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0,
         sqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zName),
         P4_DYNAMIC);
      sqlite3VdbeAddOp3(v, OP_Move, 2, 4, 1);
      sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 2);
      sqlite3VdbeAddOp2(v, OP_ResultRow, 2, 1);
      sqlite3VdbeJumpHere(v, addr);

      /* Make sure all the indices are constructed correctly.
      */
      for(x=sqliteHashFirst(pTbls); x && !isQuick; x=sqliteHashNext(x)){
        Table *pTab = sqliteHashData(x);
        Index *pIdx;
        int loopTop;

        if( pTab->pIndex==0 ) continue;
        addr = sqlite3VdbeAddOp1(v, OP_IfPos, 1);  /* Stop if out of errors */
        sqlite3VdbeAddOp2(v, OP_Halt, 0, 0);
        sqlite3VdbeJumpHere(v, addr);
        sqlite3OpenTableAndIndices(pParse, pTab, 1, OP_OpenRead);
        sqlite3VdbeAddOp2(v, OP_Integer, 0, 2);  /* reg(2) will count entries */
        loopTop = sqlite3VdbeAddOp2(v, OP_Rewind, 1, 0);
        sqlite3VdbeAddOp2(v, OP_AddImm, 2, 1);   /* increment entry count */
        for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
          int jmp2;
          static const VdbeOpList idxErr[] = {
            { OP_AddImm,      1, -1,  0},
            { OP_String8,     0,  3,  0},    /* 1 */
            { OP_Rowid,       1,  4,  0},
            { OP_String8,     0,  5,  0},    /* 3 */
            { OP_String8,     0,  6,  0},    /* 4 */
            { OP_Concat,      4,  3,  3},
            { OP_Concat,      5,  3,  3},
            { OP_Concat,      6,  3,  3},
            { OP_ResultRow,   3,  1,  0},
            { OP_IfPos,       1,  0,  0},    /* 9 */
            { OP_Halt,        0,  0,  0},
          };
          sqlite3GenerateIndexKey(pParse, pIdx, 1, 3, 1);
          jmp2 = sqlite3VdbeAddOp3(v, OP_Found, j+2, 0, 3);
          addr = sqlite3VdbeAddOpList(v, ArraySize(idxErr), idxErr);
          sqlite3VdbeChangeP4(v, addr+1, "rowid ", P4_STATIC);
          sqlite3VdbeChangeP4(v, addr+3, " missing from index ", P4_STATIC);
          sqlite3VdbeChangeP4(v, addr+4, pIdx->zName, P4_STATIC);
          sqlite3VdbeJumpHere(v, addr+9);
          sqlite3VdbeJumpHere(v, jmp2);
        }
        sqlite3VdbeAddOp2(v, OP_Next, 1, loopTop+1);
        sqlite3VdbeJumpHere(v, loopTop);
        for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
          static const VdbeOpList cntIdx[] = {
             { OP_Integer,      0,  3,  0},
             { OP_Rewind,       0,  0,  0},  /* 1 */
             { OP_AddImm,       3,  1,  0},
             { OP_Next,         0,  0,  0},  /* 3 */
             { OP_Eq,           2,  0,  3},  /* 4 */
             { OP_AddImm,       1, -1,  0},
             { OP_String8,      0,  2,  0},  /* 6 */
             { OP_String8,      0,  3,  0},  /* 7 */
             { OP_Concat,       3,  2,  2},
             { OP_ResultRow,    2,  1,  0},
          };
          if( pIdx->tnum==0 ) continue;
          addr = sqlite3VdbeAddOp1(v, OP_IfPos, 1);
          sqlite3VdbeAddOp2(v, OP_Halt, 0, 0);
          sqlite3VdbeJumpHere(v, addr);
          addr = sqlite3VdbeAddOpList(v, ArraySize(cntIdx), cntIdx);
          sqlite3VdbeChangeP1(v, addr+1, j+2);
          sqlite3VdbeChangeP2(v, addr+1, addr+4);
          sqlite3VdbeChangeP1(v, addr+3, j+2);
          sqlite3VdbeChangeP2(v, addr+3, addr+2);
          sqlite3VdbeJumpHere(v, addr+4);
          sqlite3VdbeChangeP4(v, addr+6, 
                     "wrong # of entries in index ", P4_STATIC);
          sqlite3VdbeChangeP4(v, addr+7, pIdx->zName, P4_STATIC);
        }
      } 
    }
    addr = sqlite3VdbeAddOpList(v, ArraySize(endCode), endCode);
    sqlite3VdbeChangeP2(v, addr, -mxErr);
    sqlite3VdbeJumpHere(v, addr+1);
    sqlite3VdbeChangeP4(v, addr+2, "ok", P4_STATIC);
  }else
#endif /* SQLITE_OMIT_INTEGRITY_CHECK */

#ifndef SQLITE_OMIT_UTF16
  /*
  **   PRAGMA encoding
  **   PRAGMA encoding = "utf-8"|"utf-16"|"utf-16le"|"utf-16be"
  **
  ** In its first form, this pragma returns the encoding of the main
  ** database. If the database is not initialized, it is initialized now.
  **
  ** The second form of this pragma is a no-op if the main database file
  ** has not already been initialized. In this case it sets the default
  ** encoding that will be used for the main database file if a new file
  ** is created. If an existing main database file is opened, then the
  ** default text encoding for the existing database is used.
  ** 
  ** In all cases new databases created using the ATTACH command are
  ** created to use the same default text encoding as the main database. If
  ** the main database has not been initialized and/or created when ATTACH
  ** is executed, this is done before the ATTACH operation.
  **
  ** In the second form this pragma sets the text encoding to be used in
  ** new database files created using this database handle. It is only
  ** useful if invoked immediately after the main database i
  */
  if( sqlite3StrICmp(zLeft, "encoding")==0 ){
    static const struct EncName {
      char *zName;
      u8 enc;
    } encnames[] = {
      { "UTF-8",    SQLITE_UTF8        },
      { "UTF8",     SQLITE_UTF8        },
      { "UTF-16le", SQLITE_UTF16LE     },
      { "UTF16le",  SQLITE_UTF16LE     },
      { "UTF-16be", SQLITE_UTF16BE     },
      { "UTF16be",  SQLITE_UTF16BE     },
      { "UTF-16",   0                  }, /* SQLITE_UTF16NATIVE */
      { "UTF16",    0                  }, /* SQLITE_UTF16NATIVE */
      { 0, 0 }
    };
    const struct EncName *pEnc;
    if( !zRight ){    /* "PRAGMA encoding" */
      if( sqlite3ReadSchema(pParse) ) goto pragma_out;
      sqlite3VdbeSetNumCols(v, 1);
      sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "encoding", P4_STATIC);
      sqlite3VdbeAddOp2(v, OP_String8, 0, 1);
      for(pEnc=&encnames[0]; pEnc->zName; pEnc++){
        if( pEnc->enc==ENC(pParse->db) ){
          sqlite3VdbeChangeP4(v, -1, pEnc->zName, P4_STATIC);
          break;
        }
      }
      sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
    }else{                        /* "PRAGMA encoding = XXX" */
      /* Only change the value of sqlite.enc if the database handle is not
      ** initialized. If the main database exists, the new sqlite.enc value
      ** will be overwritten when the schema is next loaded. If it does not
      ** already exists, it will be created to use the new encoding value.
      */
      if( 
        !(DbHasProperty(db, 0, DB_SchemaLoaded)) || 
        DbHasProperty(db, 0, DB_Empty) 
      ){
        for(pEnc=&encnames[0]; pEnc->zName; pEnc++){
          if( 0==sqlite3StrICmp(zRight, pEnc->zName) ){
            ENC(pParse->db) = pEnc->enc ? pEnc->enc : SQLITE_UTF16NATIVE;
            break;
          }
        }
        if( !pEnc->zName ){
          sqlite3ErrorMsg(pParse, "unsupported encoding: %s", zRight);
        }
      }
    }
  }else
#endif /* SQLITE_OMIT_UTF16 */

#ifndef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
  /*
  **   PRAGMA [database.]schema_version
  **   PRAGMA [database.]schema_version = <integer>
  **
  **   PRAGMA [database.]user_version
  **   PRAGMA [database.]user_version = <integer>
  **
  ** The pragma's schema_version and user_version are used to set or get
  ** the value of the schema-version and user-version, respectively. Both
  ** the schema-version and the user-version are 32-bit signed integers
  ** stored in the database header.
  **
  ** The schema-cookie is usually only manipulated internally by SQLite. It
  ** is incremented by SQLite whenever the database schema is modified (by
  ** creating or dropping a table or index). The schema version is used by
  ** SQLite each time a query is executed to ensure that the internal cache
  ** of the schema used when compiling the SQL query matches the schema of
  ** the database against which the compiled query is actually executed.
  ** Subverting this mechanism by using "PRAGMA schema_version" to modify
  ** the schema-version is potentially dangerous and may lead to program
  ** crashes or database corruption. Use with caution!
  **
  ** The user-version is not used internally by SQLite. It may be used by
  ** applications for any purpose.
  */
  if( sqlite3StrICmp(zLeft, "schema_version")==0 
   || sqlite3StrICmp(zLeft, "user_version")==0 
   || sqlite3StrICmp(zLeft, "freelist_count")==0 
  ){

    int iCookie;   /* Cookie index. 0 for schema-cookie, 6 for user-cookie. */
    sqlite3VdbeUsesBtree(v, iDb);
    switch( zLeft[0] ){
      case 's': case 'S':
        iCookie = 0;
        break;
      case 'f': case 'F':
        iCookie = 1;
        iDb = (-1*(iDb+1));
        assert(iDb<=0);
        break;
      default:
        iCookie = 5;
        break;
    }

    if( zRight && iDb>=0 ){
      /* Write the specified cookie value */
      static const VdbeOpList setCookie[] = {
        { OP_Transaction,    0,  1,  0},    /* 0 */
        { OP_Integer,        0,  1,  0},    /* 1 */
        { OP_SetCookie,      0,  0,  1},    /* 2 */
      };
      int addr = sqlite3VdbeAddOpList(v, ArraySize(setCookie), setCookie);
      sqlite3VdbeChangeP1(v, addr, iDb);
      sqlite3VdbeChangeP1(v, addr+1, atoi(zRight));
      sqlite3VdbeChangeP1(v, addr+2, iDb);
      sqlite3VdbeChangeP2(v, addr+2, iCookie);
    }else{
      /* Read the specified cookie value */
      static const VdbeOpList readCookie[] = {
        { OP_ReadCookie,      0,  1,  0},    /* 0 */
        { OP_ResultRow,       1,  1,  0}
      };
      int addr = sqlite3VdbeAddOpList(v, ArraySize(readCookie), readCookie);
      sqlite3VdbeChangeP1(v, addr, iDb);
      sqlite3VdbeChangeP3(v, addr, iCookie);
      sqlite3VdbeSetNumCols(v, 1);
      sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLeft, P4_TRANSIENT);
    }
  }else
#endif /* SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS */

#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
  /*
  ** Report the current state of file logs for all databases
  */
  if( sqlite3StrICmp(zLeft, "lock_status")==0 ){
    static const char *const azLockName[] = {
      "unlocked", "shared", "reserved", "pending", "exclusive"
    };
    int i;
    Vdbe *v = sqlite3GetVdbe(pParse);
    sqlite3VdbeSetNumCols(v, 2);
    pParse->nMem = 2;
    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "database", P4_STATIC);
    sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "status", P4_STATIC);
    for(i=0; i<db->nDb; i++){
      Btree *pBt;
      Pager *pPager;
      const char *zState = "unknown";
      int j;
      if( db->aDb[i].zName==0 ) continue;
      sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, db->aDb[i].zName, P4_STATIC);
      pBt = db->aDb[i].pBt;
      if( pBt==0 || (pPager = sqlite3BtreePager(pBt))==0 ){
        zState = "closed";
      }else if( sqlite3_file_control(db, i ? db->aDb[i].zName : 0, 
                                     SQLITE_FCNTL_LOCKSTATE, &j)==SQLITE_OK ){
         zState = azLockName[j];
      }
      sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, zState, P4_STATIC);
      sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 2);
    }
  }else
#endif

#ifdef SQLITE_SSE
  /*
  ** Check to see if the sqlite_statements table exists.  Create it
  ** if it does not.
  */
  if( sqlite3StrICmp(zLeft, "create_sqlite_statement_table")==0 ){
    extern int sqlite3CreateStatementsTable(Parse*);
    sqlite3CreateStatementsTable(pParse);
  }else
#endif

#if SQLITE_HAS_CODEC
  if( sqlite3StrICmp(zLeft, "key")==0 ){
    sqlite3_key(db, zRight, strlen(zRight));
  }else
#endif
#if SQLITE_HAS_CODEC || defined(SQLITE_ENABLE_CEROD)
  if( sqlite3StrICmp(zLeft, "activate_extensions")==0 ){
#if SQLITE_HAS_CODEC
    if( sqlite3StrNICmp(zRight, "see-", 4)==0 ){
      extern void sqlite3_activate_see(const char*);
      sqlite3_activate_see(&zRight[4]);
    }
#endif
#ifdef SQLITE_ENABLE_CEROD
    if( sqlite3StrNICmp(zRight, "cerod-", 6)==0 ){
      extern void sqlite3_activate_cerod(const char*);
      sqlite3_activate_cerod(&zRight[6]);
    }
#endif
  }
#endif

  {}

  if( v ){
    /* Code an OP_Expire at the end of each PRAGMA program to cause
    ** the VDBE implementing the pragma to expire. Most (all?) pragmas
    ** are only valid for a single execution.
    */
    sqlite3VdbeAddOp2(v, OP_Expire, 1, 0);

    /*
    ** Reset the safety level, in case the fullfsync flag or synchronous
    ** setting changed.
    */
#ifndef SQLITE_OMIT_PAGER_PRAGMAS
    if( db->autoCommit ){
      sqlite3BtreeSetSafetyLevel(pDb->pBt, pDb->safety_level,
                 (db->flags&SQLITE_FullFSync)!=0);
    }
#endif
  }
pragma_out:
  sqlite3DbFree(db, zLeft);
  sqlite3DbFree(db, zRight);
}

#endif /* SQLITE_OMIT_PRAGMA || SQLITE_OMIT_PARSER */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/prepare.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
/*
** 2005 May 25
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains the implementation of the sqlite3_prepare()
** interface, and routines that contribute to loading the database schema
** from disk.
**
** $Id: prepare.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>

/*
** Fill the InitData structure with an error message that indicates
** that the database is corrupt.
*/
static void corruptSchema(
  InitData *pData,     /* Initialization context */
  const char *zObj,    /* Object being parsed at the point of error */
  const char *zExtra   /* Error information */
){
  if( !pData->db->mallocFailed ){
    if( zObj==0 ) zObj = "?";
    sqlite3SetString(pData->pzErrMsg, pData->db,
       "malformed database schema (%s)", zObj);
    if( zExtra && zExtra[0] ){
      *pData->pzErrMsg = sqlite3MAppendf(pData->db, *pData->pzErrMsg, "%s - %s",
                                  *pData->pzErrMsg, zExtra);
    }
  }
  pData->rc = SQLITE_CORRUPT;
}

/*
** This is the callback routine for the code that initializes the
** database.  See sqlite3Init() below for additional information.
** This routine is also called from the OP_ParseSchema opcode of the VDBE.
**
** Each callback contains the following information:
**
**     argv[0] = name of thing being created
**     argv[1] = root page number for table or index. 0 for trigger or view.
**     argv[2] = SQL text for the CREATE statement.
**
*/
int sqlite3InitCallback(void *pInit, int argc, char **argv, char **azColName){
  InitData *pData = (InitData*)pInit;
  sqlite3 *db = pData->db;
  int iDb = pData->iDb;

  assert( sqlite3_mutex_held(db->mutex) );
  pData->rc = SQLITE_OK;
  DbClearProperty(db, iDb, DB_Empty);
  if( db->mallocFailed ){
    corruptSchema(pData, argv[0], 0);
    return SQLITE_NOMEM;
  }

  assert( argc==3 );
  if( argv==0 ) return 0;   /* Might happen if EMPTY_RESULT_CALLBACKS are on */
  if( argv[1]==0 ){
    corruptSchema(pData, argv[0], 0);
    return 1;
  }
  assert( iDb>=0 && iDb<db->nDb );
  if( argv[2] && argv[2][0] ){
    /* Call the parser to process a CREATE TABLE, INDEX or VIEW.
    ** But because db->init.busy is set to 1, no VDBE code is generated
    ** or executed.  All the parser does is build the internal data
    ** structures that describe the table, index, or view.
    */
    char *zErr;
    int rc;
    u8 lookasideEnabled;
    assert( db->init.busy );
    db->init.iDb = iDb;
    db->init.newTnum = atoi(argv[1]);
    lookasideEnabled = db->lookaside.bEnabled;
    db->lookaside.bEnabled = 0;
    rc = sqlite3_exec(db, argv[2], 0, 0, &zErr);
    db->init.iDb = 0;
    db->lookaside.bEnabled = lookasideEnabled;
    assert( rc!=SQLITE_OK || zErr==0 );
    if( SQLITE_OK!=rc ){
      pData->rc = rc;
      if( rc==SQLITE_NOMEM ){
        db->mallocFailed = 1;
      }else if( rc!=SQLITE_INTERRUPT ){
        corruptSchema(pData, argv[0], zErr);
      }
      sqlite3DbFree(db, zErr);
      return 1;
    }
  }else if( argv[0]==0 ){
    corruptSchema(pData, 0, 0);
  }else{
    /* If the SQL column is blank it means this is an index that
    ** was created to be the PRIMARY KEY or to fulfill a UNIQUE
    ** constraint for a CREATE TABLE.  The index should have already
    ** been created when we processed the CREATE TABLE.  All we have
    ** to do here is record the root page number for that index.
    */
    Index *pIndex;
    pIndex = sqlite3FindIndex(db, argv[0], db->aDb[iDb].zName);
    if( pIndex==0 || pIndex->tnum!=0 ){
      /* This can occur if there exists an index on a TEMP table which
      ** has the same name as another index on a permanent index.  Since
      ** the permanent table is hidden by the TEMP table, we can also
      ** safely ignore the index on the permanent table.
      */
      /* Do Nothing */;
    }else{
      pIndex->tnum = atoi(argv[1]);
    }
  }
  return 0;
}

/*
** Attempt to read the database schema and initialize internal
** data structures for a single database file.  The index of the
** database file is given by iDb.  iDb==0 is used for the main
** database.  iDb==1 should never be used.  iDb>=2 is used for
** auxiliary databases.  Return one of the SQLITE_ error codes to
** indicate success or failure.
*/
static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
  int rc;
  BtCursor *curMain;
  int size;
  Table *pTab;
  Db *pDb;
  char const *azArg[4];
  int meta[10];
  InitData initData;
  char const *zMasterSchema;
  char const *zMasterName = SCHEMA_TABLE(iDb);

  /*
  ** The master database table has a structure like this
  */
  static const char master_schema[] = 
     "CREATE TABLE sqlite_master(\n"
     "  type text,\n"
     "  name text,\n"
     "  tbl_name text,\n"
     "  rootpage integer,\n"
     "  sql text\n"
     ")"
  ;
#ifndef SQLITE_OMIT_TEMPDB
  static const char temp_master_schema[] = 
     "CREATE TEMP TABLE sqlite_temp_master(\n"
     "  type text,\n"
     "  name text,\n"
     "  tbl_name text,\n"
     "  rootpage integer,\n"
     "  sql text\n"
     ")"
  ;
#else
  #define temp_master_schema 0
#endif

  assert( iDb>=0 && iDb<db->nDb );
  assert( db->aDb[iDb].pSchema );
  assert( sqlite3_mutex_held(db->mutex) );
  assert( iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) );

  /* zMasterSchema and zInitScript are set to point at the master schema
  ** and initialisation script appropriate for the database being
  ** initialised. zMasterName is the name of the master table.
  */
  if( !OMIT_TEMPDB && iDb==1 ){
    zMasterSchema = temp_master_schema;
  }else{
    zMasterSchema = master_schema;
  }
  zMasterName = SCHEMA_TABLE(iDb);

  /* Construct the schema tables.  */
  azArg[0] = zMasterName;
  azArg[1] = "1";
  azArg[2] = zMasterSchema;
  azArg[3] = 0;
  initData.db = db;
  initData.iDb = iDb;
  initData.pzErrMsg = pzErrMsg;
  (void)sqlite3SafetyOff(db);
  rc = sqlite3InitCallback(&initData, 3, (char **)azArg, 0);
  (void)sqlite3SafetyOn(db);
  if( rc ){
    rc = initData.rc;
    goto error_out;
  }
  pTab = sqlite3FindTable(db, zMasterName, db->aDb[iDb].zName);
  if( pTab ){
    pTab->readOnly = 1;
  }

  /* Create a cursor to hold the database open
  */
  pDb = &db->aDb[iDb];
  if( pDb->pBt==0 ){
    if( !OMIT_TEMPDB && iDb==1 ){
      DbSetProperty(db, 1, DB_SchemaLoaded);
    }
    return SQLITE_OK;
  }
  curMain = sqlite3MallocZero(sqlite3BtreeCursorSize());
  if( !curMain ){
    rc = SQLITE_NOMEM;
    goto error_out;
  }
  sqlite3BtreeEnter(pDb->pBt);
  rc = sqlite3BtreeCursor(pDb->pBt, MASTER_ROOT, 0, 0, curMain);
  if( rc!=SQLITE_OK && rc!=SQLITE_EMPTY ){
    sqlite3SetString(pzErrMsg, db, "%s", sqlite3ErrStr(rc));
    goto initone_error_out;
  }

  /* Get the database meta information.
  **
  ** Meta values are as follows:
  **    meta[0]   Schema cookie.  Changes with each schema change.
  **    meta[1]   File format of schema layer.
  **    meta[2]   Size of the page cache.
  **    meta[3]   Use freelist if 0.  Autovacuum if greater than zero.
  **    meta[4]   Db text encoding. 1:UTF-8 2:UTF-16LE 3:UTF-16BE
  **    meta[5]   The user cookie. Used by the application.
  **    meta[6]   Incremental-vacuum flag.
  **    meta[7]
  **    meta[8]
  **    meta[9]
  **
  ** Note: The #defined SQLITE_UTF* symbols in sqliteInt.h correspond to
  ** the possible values of meta[4].
  */
  if( rc==SQLITE_OK ){
    int i;
    for(i=0; i<sizeof(meta)/sizeof(meta[0]); i++){
      rc = sqlite3BtreeGetMeta(pDb->pBt, i+1, (u32 *)&meta[i]);
      if( rc ){
        sqlite3SetString(pzErrMsg, db, "%s", sqlite3ErrStr(rc));
        goto initone_error_out;
      }
    }
  }else{
    memset(meta, 0, sizeof(meta));
  }
  pDb->pSchema->schema_cookie = meta[0];

  /* If opening a non-empty database, check the text encoding. For the
  ** main database, set sqlite3.enc to the encoding of the main database.
  ** For an attached db, it is an error if the encoding is not the same
  ** as sqlite3.enc.
  */
  if( meta[4] ){  /* text encoding */
    if( iDb==0 ){
      /* If opening the main database, set ENC(db). */
      ENC(db) = (u8)meta[4];
      db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "BINARY", 6, 0);
    }else{
      /* If opening an attached database, the encoding much match ENC(db) */
      if( meta[4]!=ENC(db) ){
        sqlite3SetString(pzErrMsg, db, "attached databases must use the same"
            " text encoding as main database");
        rc = SQLITE_ERROR;
        goto initone_error_out;
      }
    }
  }else{
    DbSetProperty(db, iDb, DB_Empty);
  }
  pDb->pSchema->enc = ENC(db);

  if( pDb->pSchema->cache_size==0 ){
    size = meta[2];
    if( size==0 ){ size = SQLITE_DEFAULT_CACHE_SIZE; }
    if( size<0 ) size = -size;
    pDb->pSchema->cache_size = size;
    sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size);
  }

  /*
  ** file_format==1    Version 3.0.0.
  ** file_format==2    Version 3.1.3.  // ALTER TABLE ADD COLUMN
  ** file_format==3    Version 3.1.4.  // ditto but with non-NULL defaults
  ** file_format==4    Version 3.3.0.  // DESC indices.  Boolean constants
  */
  pDb->pSchema->file_format = meta[1];
  if( pDb->pSchema->file_format==0 ){
    pDb->pSchema->file_format = 1;
  }
  if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){
    sqlite3SetString(pzErrMsg, db, "unsupported file format");
    rc = SQLITE_ERROR;
    goto initone_error_out;
  }

  /* Ticket #2804:  When we open a database in the newer file format,
  ** clear the legacy_file_format pragma flag so that a VACUUM will
  ** not downgrade the database and thus invalidate any descending
  ** indices that the user might have created.
  */
  if( iDb==0 && meta[1]>=4 ){
    db->flags &= ~SQLITE_LegacyFileFmt;
  }

  /* Read the schema information out of the schema tables
  */
  assert( db->init.busy );
  if( rc==SQLITE_EMPTY ){
    /* For an empty database, there is nothing to read */
    rc = SQLITE_OK;
  }else{
    char *zSql;
    zSql = sqlite3MPrintf(db, 
        "SELECT name, rootpage, sql FROM '%q'.%s",
        db->aDb[iDb].zName, zMasterName);
    (void)sqlite3SafetyOff(db);
#ifndef SQLITE_OMIT_AUTHORIZATION
    {
      int (*xAuth)(void*,int,const char*,const char*,const char*,const char*);
      xAuth = db->xAuth;
      db->xAuth = 0;
#endif
      rc = sqlite3_exec(db, zSql, sqlite3InitCallback, &initData, 0);
#ifndef SQLITE_OMIT_AUTHORIZATION
      db->xAuth = xAuth;
    }
#endif
    if( rc==SQLITE_ABORT ) rc = initData.rc;
    (void)sqlite3SafetyOn(db);
    sqlite3DbFree(db, zSql);
#ifndef SQLITE_OMIT_ANALYZE
    if( rc==SQLITE_OK ){
      sqlite3AnalysisLoad(db, iDb);
    }
#endif
  }
  if( db->mallocFailed ){
    rc = SQLITE_NOMEM;
    sqlite3ResetInternalSchema(db, 0);
  }
  if( rc==SQLITE_OK || (db->flags&SQLITE_RecoveryMode)){
    /* Black magic: If the SQLITE_RecoveryMode flag is set, then consider
    ** the schema loaded, even if errors occured. In this situation the 
    ** current sqlite3_prepare() operation will fail, but the following one
    ** will attempt to compile the supplied statement against whatever subset
    ** of the schema was loaded before the error occured. The primary
    ** purpose of this is to allow access to the sqlite_master table
    ** even when its contents have been corrupted.
    */
    DbSetProperty(db, iDb, DB_SchemaLoaded);
    rc = SQLITE_OK;
  }

  /* Jump here for an error that occurs after successfully allocating
  ** curMain and calling sqlite3BtreeEnter(). For an error that occurs
  ** before that point, jump to error_out.
  */
initone_error_out:
  sqlite3BtreeCloseCursor(curMain);
  sqlite3_free(curMain);
  sqlite3BtreeLeave(pDb->pBt);

error_out:
  if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){
    db->mallocFailed = 1;
  }
  return rc;
}

/*
** Initialize all database files - the main database file, the file
** used to store temporary tables, and any additional database files
** created using ATTACH statements.  Return a success code.  If an
** error occurs, write an error message into *pzErrMsg.
**
** After a database is initialized, the DB_SchemaLoaded bit is set
** bit is set in the flags field of the Db structure. If the database
** file was of zero-length, then the DB_Empty flag is also set.
*/
int sqlite3Init(sqlite3 *db, char **pzErrMsg){
  int i, rc;
  int commit_internal = !(db->flags&SQLITE_InternChanges);
  
  assert( sqlite3_mutex_held(db->mutex) );
  if( db->init.busy ) return SQLITE_OK;
  rc = SQLITE_OK;
  db->init.busy = 1;
  for(i=0; rc==SQLITE_OK && i<db->nDb; i++){
    if( DbHasProperty(db, i, DB_SchemaLoaded) || i==1 ) continue;
    rc = sqlite3InitOne(db, i, pzErrMsg);
    if( rc ){
      sqlite3ResetInternalSchema(db, i);
    }
  }

  /* Once all the other databases have been initialised, load the schema
  ** for the TEMP database. This is loaded last, as the TEMP database
  ** schema may contain references to objects in other databases.
  */
#ifndef SQLITE_OMIT_TEMPDB
  if( rc==SQLITE_OK && db->nDb>1 && !DbHasProperty(db, 1, DB_SchemaLoaded) ){
    rc = sqlite3InitOne(db, 1, pzErrMsg);
    if( rc ){
      sqlite3ResetInternalSchema(db, 1);
    }
  }
#endif

  db->init.busy = 0;
  if( rc==SQLITE_OK && commit_internal ){
    sqlite3CommitInternalChanges(db);
  }

  return rc; 
}

/*
** This routine is a no-op if the database schema is already initialised.
** Otherwise, the schema is loaded. An error code is returned.
*/
int sqlite3ReadSchema(Parse *pParse){
  int rc = SQLITE_OK;
  sqlite3 *db = pParse->db;
  assert( sqlite3_mutex_held(db->mutex) );
  if( !db->init.busy ){
    rc = sqlite3Init(db, &pParse->zErrMsg);
  }
  if( rc!=SQLITE_OK ){
    pParse->rc = rc;
    pParse->nErr++;
  }
  return rc;
}


/*
** Check schema cookies in all databases.  If any cookie is out
** of date, return 0.  If all schema cookies are current, return 1.
*/
static int schemaIsValid(sqlite3 *db){
  int iDb;
  int rc;
  BtCursor *curTemp;
  int cookie;
  int allOk = 1;

  curTemp = (BtCursor *)sqlite3Malloc(sqlite3BtreeCursorSize());
  if( curTemp ){
    assert( sqlite3_mutex_held(db->mutex) );
    for(iDb=0; allOk && iDb<db->nDb; iDb++){
      Btree *pBt;
      pBt = db->aDb[iDb].pBt;
      if( pBt==0 ) continue;
      memset(curTemp, 0, sqlite3BtreeCursorSize());
      rc = sqlite3BtreeCursor(pBt, MASTER_ROOT, 0, 0, curTemp);
      if( rc==SQLITE_OK ){
        rc = sqlite3BtreeGetMeta(pBt, 1, (u32 *)&cookie);
        if( rc==SQLITE_OK && cookie!=db->aDb[iDb].pSchema->schema_cookie ){
          allOk = 0;
        }
        sqlite3BtreeCloseCursor(curTemp);
      }
      if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){
        db->mallocFailed = 1;
      }
    }
    sqlite3_free(curTemp);
  }else{
    allOk = 0;
    db->mallocFailed = 1;
  }

  return allOk;
}

/*
** Convert a schema pointer into the iDb index that indicates
** which database file in db->aDb[] the schema refers to.
**
** If the same database is attached more than once, the first
** attached database is returned.
*/
int sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){
  int i = -1000000;

  /* If pSchema is NULL, then return -1000000. This happens when code in 
  ** expr.c is trying to resolve a reference to a transient table (i.e. one
  ** created by a sub-select). In this case the return value of this 
  ** function should never be used.
  **
  ** We return -1000000 instead of the more usual -1 simply because using
  ** -1000000 as incorrectly using -1000000 index into db->aDb[] is much 
  ** more likely to cause a segfault than -1 (of course there are assert()
  ** statements too, but it never hurts to play the odds).
  */
  assert( sqlite3_mutex_held(db->mutex) );
  if( pSchema ){
    for(i=0; i<db->nDb; i++){
      if( db->aDb[i].pSchema==pSchema ){
        break;
      }
    }
    assert( i>=0 &&i>=0 &&  i<db->nDb );
  }
  return i;
}

/*
** 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 sParse;
  char *zErrMsg = 0;
  int rc = SQLITE_OK;
  int i;

  assert( ppStmt );
  *ppStmt = 0;
  if( sqlite3SafetyOn(db) ){
    return SQLITE_MISUSE;
  }
  assert( !db->mallocFailed );
  assert( sqlite3_mutex_held(db->mutex) );

  /* If any attached database schemas are locked, do not proceed with
  ** compilation. Instead return SQLITE_LOCKED immediately.
  */
  for(i=0; i<db->nDb; i++) {
    Btree *pBt = db->aDb[i].pBt;
    if( pBt ){
      int rc;
      rc = sqlite3BtreeSchemaLocked(pBt);
      if( rc ){
        const char *zDb = db->aDb[i].zName;
        sqlite3Error(db, SQLITE_LOCKED, "database schema is locked: %s", zDb);
        (void)sqlite3SafetyOff(db);
        return sqlite3ApiExit(db, SQLITE_LOCKED);
      }
    }
  }
  
  memset(&sParse, 0, sizeof(sParse));
  sParse.db = db;
  if( nBytes>=0 && (nBytes==0 || zSql[nBytes-1]!=0) ){
    char *zSqlCopy;
    int mxLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH];
    if( nBytes>mxLen ){
      sqlite3Error(db, SQLITE_TOOBIG, "statement too long");
      (void)sqlite3SafetyOff(db);
      return sqlite3ApiExit(db, SQLITE_TOOBIG);
    }
    zSqlCopy = sqlite3DbStrNDup(db, zSql, nBytes);
    if( zSqlCopy ){
      sqlite3RunParser(&sParse, zSqlCopy, &zErrMsg);
      sqlite3DbFree(db, zSqlCopy);
      sParse.zTail = &zSql[sParse.zTail-zSqlCopy];
    }else{
      sParse.zTail = &zSql[nBytes];
    }
  }else{
    sqlite3RunParser(&sParse, zSql, &zErrMsg);
  }

  if( db->mallocFailed ){
    sParse.rc = SQLITE_NOMEM;
  }
  if( sParse.rc==SQLITE_DONE ) sParse.rc = SQLITE_OK;
  if( sParse.checkSchema && !schemaIsValid(db) ){
    sParse.rc = SQLITE_SCHEMA;
  }
  if( sParse.rc==SQLITE_SCHEMA ){
    sqlite3ResetInternalSchema(db, 0);
  }
  if( db->mallocFailed ){
    sParse.rc = SQLITE_NOMEM;
  }
  if( pzTail ){
    *pzTail = sParse.zTail;
  }
  rc = sParse.rc;

#ifndef SQLITE_OMIT_EXPLAIN
  if( rc==SQLITE_OK && sParse.pVdbe && sParse.explain ){
    if( sParse.explain==2 ){
      sqlite3VdbeSetNumCols(sParse.pVdbe, 3);
      sqlite3VdbeSetColName(sParse.pVdbe, 0, COLNAME_NAME, "order", P4_STATIC);
      sqlite3VdbeSetColName(sParse.pVdbe, 1, COLNAME_NAME, "from", P4_STATIC);
      sqlite3VdbeSetColName(sParse.pVdbe, 2, COLNAME_NAME, "detail", P4_STATIC);
    }else{
      sqlite3VdbeSetNumCols(sParse.pVdbe, 8);
      sqlite3VdbeSetColName(sParse.pVdbe, 0, COLNAME_NAME, "addr", P4_STATIC);
      sqlite3VdbeSetColName(sParse.pVdbe, 1, COLNAME_NAME, "opcode", P4_STATIC);
      sqlite3VdbeSetColName(sParse.pVdbe, 2, COLNAME_NAME, "p1", P4_STATIC);
      sqlite3VdbeSetColName(sParse.pVdbe, 3, COLNAME_NAME, "p2", P4_STATIC);
      sqlite3VdbeSetColName(sParse.pVdbe, 4, COLNAME_NAME, "p3", P4_STATIC);
      sqlite3VdbeSetColName(sParse.pVdbe, 5, COLNAME_NAME, "p4", P4_STATIC);
      sqlite3VdbeSetColName(sParse.pVdbe, 6, COLNAME_NAME, "p5", P4_STATIC);
      sqlite3VdbeSetColName(sParse.pVdbe, 7, COLNAME_NAME, "comment",P4_STATIC);
    }
  }
#endif

  if( sqlite3SafetyOff(db) ){
    rc = SQLITE_MISUSE;
  }

  if( saveSqlFlag ){
    sqlite3VdbeSetSql(sParse.pVdbe, zSql, sParse.zTail - zSql);
  }
  if( rc!=SQLITE_OK || db->mallocFailed ){
    sqlite3_finalize((sqlite3_stmt*)sParse.pVdbe);
    assert(!(*ppStmt));
  }else{
    *ppStmt = (sqlite3_stmt*)sParse.pVdbe;
  }

  if( zErrMsg ){
    sqlite3Error(db, rc, "%s", zErrMsg);
    sqlite3DbFree(db, zErrMsg);
  }else{
    sqlite3Error(db, rc, 0);
  }

  rc = sqlite3ApiExit(db, rc);
  assert( (rc&db->errMask)==rc );
  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;
  if( !sqlite3SafetyCheckOk(db) ){
    return SQLITE_MISUSE;
  }
  sqlite3_mutex_enter(db->mutex);
  sqlite3BtreeEnterAll(db);
  rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, ppStmt, pzTail);
  sqlite3BtreeLeaveAll(db);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

/*
** Rerun the compilation of a statement after a schema change.
** Return true if the statement was recompiled successfully.
** Return false if there is an error of some kind.
*/
int sqlite3Reprepare(Vdbe *p){
  int rc;
  sqlite3_stmt *pNew;
  const char *zSql;
  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 0;
  }else{
    assert( pNew!=0 );
  }
  sqlite3VdbeSwap((Vdbe*)pNew, p);
  sqlite3_transfer_bindings(pNew, (sqlite3_stmt*)p);
  sqlite3VdbeResetStepResult((Vdbe*)pNew);
  sqlite3VdbeFinalize((Vdbe*)pNew);
  return 1;
}


/*
** Two versions of the official API.  Legacy and new use.  In the legacy
** version, the original SQL text is not saved in the prepared statement
** and so if a schema change occurs, SQLITE_SCHEMA is returned by
** sqlite3_step().  In the new version, the original SQL text is retained
** and the statement is automatically recompiled if an schema change
** occurs.
*/
int sqlite3_prepare(
  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;
}
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
/*
** Compile the UTF-16 encoded SQL statement zSql into a statement handle.
*/
static int sqlite3Prepare16(
  sqlite3 *db,              /* Database handle. */ 
  const void *zSql,         /* UTF-8 encoded SQL statement. */
  int nBytes,               /* Length of zSql in bytes. */
  int saveSqlFlag,          /* True to save SQL text into the sqlite3_stmt */
  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */
  const void **pzTail       /* OUT: End of parsed string */
){
  /* This function currently works by first transforming the UTF-16
  ** encoded string to UTF-8, then invoking sqlite3_prepare(). The
  ** tricky bit is figuring out the pointer to return in *pzTail.
  */
  char *zSql8;
  const char *zTail8 = 0;
  int rc = SQLITE_OK;

  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.
    */
    int chars_parsed = sqlite3Utf8CharLen(zSql8, zTail8-zSql8);
    *pzTail = (u8 *)zSql + sqlite3Utf16ByteLen(zSql, chars_parsed);
  }
  sqlite3DbFree(db, zSql8); 
  rc = sqlite3ApiExit(db, rc);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

/*
** Two versions of the official API.  Legacy and new use.  In the legacy
** version, the original SQL text is not saved in the prepared statement
** and so if a schema change occurs, SQLITE_SCHEMA is returned by
** sqlite3_step().  In the new version, the original SQL text is retained
** and the statement is automatically recompiled if an schema change
** occurs.
*/
int sqlite3_prepare16(
  sqlite3 *db,              /* Database handle. */ 
  const void *zSql,         /* UTF-8 encoded SQL statement. */
  int nBytes,               /* Length of zSql in bytes. */
  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */
  const void **pzTail       /* OUT: End of parsed string */
){
  int rc;
  rc = sqlite3Prepare16(db,zSql,nBytes,0,ppStmt,pzTail);
  assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 );  /* VERIFY: F13021 */
  return rc;
}
int sqlite3_prepare16_v2(
  sqlite3 *db,              /* Database handle. */ 
  const void *zSql,         /* UTF-8 encoded SQL statement. */
  int nBytes,               /* Length of zSql in bytes. */
  sqlite3_stmt **ppStmt,    /* OUT: A pointer to the prepared statement */
  const void **pzTail       /* OUT: End of parsed string */
){
  int rc;
  rc = sqlite3Prepare16(db,zSql,nBytes,1,ppStmt,pzTail);
  assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 );  /* VERIFY: F13021 */
  return rc;
}

#endif /* SQLITE_OMIT_UTF16 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/printf.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
/*
** The "printf" code that follows dates from the 1980's.  It is in
** the public domain.  The original comments are included here for
** completeness.  They are very out-of-date but might be useful as
** an historical reference.  Most of the "enhancements" have been backed
** out so that the functionality is now the same as standard printf().
**
** $Id: printf.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
**
**************************************************************************
**
** The following modules is an enhanced replacement for the "printf" subroutines
** found in the standard C library.  The following enhancements are
** supported:
**
**      +  Additional functions.  The standard set of "printf" functions
**         includes printf, fprintf, sprintf, vprintf, vfprintf, and
**         vsprintf.  This module adds the following:
**
**           *  snprintf -- Works like sprintf, but has an extra argument
**                          which is the size of the buffer written to.
**
**           *  mprintf --  Similar to sprintf.  Writes output to memory
**                          obtained from malloc.
**
**           *  xprintf --  Calls a function to dispose of output.
**
**           *  nprintf --  No output, but returns the number of characters
**                          that would have been output by printf.
**
**           *  A v- version (ex: vsnprintf) of every function is also
**              supplied.
**
**      +  A few extensions to the formatting notation are supported:
**
**           *  The "=" flag (similar to "-") causes the output to be
**              be centered in the appropriately sized field.
**
**           *  The %b field outputs an integer in binary notation.
**
**           *  The %c field now accepts a precision.  The character output
**              is repeated by the number of times the precision specifies.
**
**           *  The %' field works like %c, but takes as its character the
**              next character of the format string, instead of the next
**              argument.  For example,  printf("%.78'-")  prints 78 minus
**              signs, the same as  printf("%.78c",'-').
**
**      +  When compiled using GCC on a SPARC, this version of printf is
**         faster than the library printf for SUN OS 4.1.
**
**      +  All functions are fully reentrant.
**
*/
#include "sqliteInt.h"

/*
** Conversion types fall into various categories as defined by the
** following enumeration.
*/
#define etRADIX       1 /* Integer types.  %d, %x, %o, and so forth */
#define etFLOAT       2 /* Floating point.  %f */
#define etEXP         3 /* Exponentional notation. %e and %E */
#define etGENERIC     4 /* Floating or exponential, depending on exponent. %g */
#define etSIZE        5 /* Return number of characters processed so far. %n */
#define etSTRING      6 /* Strings. %s */
#define etDYNSTRING   7 /* Dynamically allocated strings. %z */
#define etPERCENT     8 /* Percent symbol. %% */
#define etCHARX       9 /* Characters. %c */
/* The rest are extensions, not normally found in printf() */
#define etSQLESCAPE  10 /* Strings with '\'' doubled.  %q */
#define etSQLESCAPE2 11 /* Strings with '\'' doubled and enclosed in '',
                          NULL pointers replaced by SQL NULL.  %Q */
#define etTOKEN      12 /* a pointer to a Token structure */
#define etSRCLIST    13 /* a pointer to a SrcList */
#define etPOINTER    14 /* The %p conversion */
#define etSQLESCAPE3 15 /* %w -> Strings with '\"' doubled */
#define etORDINAL    16 /* %r -> 1st, 2nd, 3rd, 4th, etc.  English only */


/*
** An "etByte" is an 8-bit unsigned value.
*/
typedef unsigned char etByte;

/*
** Each builtin conversion character (ex: the 'd' in "%d") is described
** by an instance of the following structure
*/
typedef struct et_info {   /* Information about each format field */
  char fmttype;            /* The format field code letter */
  etByte base;             /* The base for radix conversion */
  etByte flags;            /* One or more of FLAG_ constants below */
  etByte type;             /* Conversion paradigm */
  etByte charset;          /* Offset into aDigits[] of the digits string */
  etByte prefix;           /* Offset into aPrefix[] of the prefix string */
} et_info;

/*
** Allowed values for et_info.flags
*/
#define FLAG_SIGNED  1     /* True if the value to convert is signed */
#define FLAG_INTERN  2     /* True if for internal use only */
#define FLAG_STRING  4     /* Allow infinity precision */


/*
** The following table is searched linearly, so it is good to put the
** most frequently used conversion types first.
*/
static const char aDigits[] = "0123456789ABCDEF0123456789abcdef";
static const char aPrefix[] = "-x0\000X0";
static const et_info fmtinfo[] = {
  {  'd', 10, 1, etRADIX,      0,  0 },
  {  's',  0, 4, etSTRING,     0,  0 },
  {  'g',  0, 1, etGENERIC,    30, 0 },
  {  'z',  0, 4, etDYNSTRING,  0,  0 },
  {  'q',  0, 4, etSQLESCAPE,  0,  0 },
  {  'Q',  0, 4, etSQLESCAPE2, 0,  0 },
  {  'w',  0, 4, etSQLESCAPE3, 0,  0 },
  {  'c',  0, 0, etCHARX,      0,  0 },
  {  'o',  8, 0, etRADIX,      0,  2 },
  {  'u', 10, 0, etRADIX,      0,  0 },
  {  'x', 16, 0, etRADIX,      16, 1 },
  {  'X', 16, 0, etRADIX,      0,  4 },
#ifndef SQLITE_OMIT_FLOATING_POINT
  {  'f',  0, 1, etFLOAT,      0,  0 },
  {  'e',  0, 1, etEXP,        30, 0 },
  {  'E',  0, 1, etEXP,        14, 0 },
  {  'G',  0, 1, etGENERIC,    14, 0 },
#endif
  {  'i', 10, 1, etRADIX,      0,  0 },
  {  'n',  0, 0, etSIZE,       0,  0 },
  {  '%',  0, 0, etPERCENT,    0,  0 },
  {  'p', 16, 0, etPOINTER,    0,  1 },
  {  'T',  0, 2, etTOKEN,      0,  0 },
  {  'S',  0, 2, etSRCLIST,    0,  0 },
  {  'r', 10, 3, etORDINAL,    0,  0 },
};
#define etNINFO  (sizeof(fmtinfo)/sizeof(fmtinfo[0]))

/*
** If SQLITE_OMIT_FLOATING_POINT is defined, then none of the floating point
** conversions will work.
*/
#ifndef SQLITE_OMIT_FLOATING_POINT
/*
** "*val" is a double such that 0.1 <= *val < 10.0
** Return the ascii code for the leading digit of *val, then
** multiply "*val" by 10.0 to renormalize.
**
** Example:
**     input:     *val = 3.14159
**     output:    *val = 1.4159    function return = '3'
**
** The counter *cnt is incremented each time.  After counter exceeds
** 16 (the number of significant digits in a 64-bit float) '0' is
** always returned.
*/
static int et_getdigit(LONGDOUBLE_TYPE *val, int *cnt){
  int digit;
  LONGDOUBLE_TYPE d;
  if( (*cnt)++ >= 16 ) return '0';
  digit = (int)*val;
  d = digit;
  digit += '0';
  *val = (*val - d)*10.0;
  return digit;
}
#endif /* SQLITE_OMIT_FLOATING_POINT */

/*
** Append N space characters to the given string buffer.
*/
static void appendSpace(StrAccum *pAccum, int N){
  static const char zSpaces[] = "                             ";
  while( N>=sizeof(zSpaces)-1 ){
    sqlite3StrAccumAppend(pAccum, zSpaces, sizeof(zSpaces)-1);
    N -= sizeof(zSpaces)-1;
  }
  if( N>0 ){
    sqlite3StrAccumAppend(pAccum, zSpaces, N);
  }
}

/*
** On machines with a small stack size, you can redefine the
** SQLITE_PRINT_BUF_SIZE to be less than 350.  But beware - for
** smaller values some %f conversions may go into an infinite loop.
*/
#ifndef SQLITE_PRINT_BUF_SIZE
# define SQLITE_PRINT_BUF_SIZE 350
#endif
#define etBUFSIZE SQLITE_PRINT_BUF_SIZE  /* Size of the output buffer */

/*
** The root program.  All variations call this core.
**
** INPUTS:
**   func   This is a pointer to a function taking three arguments
**            1. A pointer to anything.  Same as the "arg" parameter.
**            2. A pointer to the list of characters to be output
**               (Note, this list is NOT null terminated.)
**            3. An integer number of characters to be output.
**               (Note: This number might be zero.)
**
**   arg    This is the pointer to anything which will be passed as the
**          first argument to "func".  Use it for whatever you like.
**
**   fmt    This is the format string, as in the usual print.
**
**   ap     This is a pointer to a list of arguments.  Same as in
**          vfprint.
**
** OUTPUTS:
**          The return value is the total number of characters sent to
**          the function "func".  Returns -1 on a error.
**
** Note that the order in which automatic variables are declared below
** seems to make a big difference in determining how fast this beast
** will run.
*/
void sqlite3VXPrintf(
  StrAccum *pAccum,                  /* Accumulate results here */
  int useExtended,                   /* Allow extended %-conversions */
  const char *fmt,                   /* Format string */
  va_list ap                         /* arguments */
){
  int c;                     /* Next character in the format string */
  char *bufpt;               /* Pointer to the conversion buffer */
  int precision;             /* Precision of the current field */
  int length;                /* Length of the field */
  int idx;                   /* A general purpose loop counter */
  int width;                 /* Width of the current field */
  etByte flag_leftjustify;   /* True if "-" flag is present */
  etByte flag_plussign;      /* True if "+" flag is present */
  etByte flag_blanksign;     /* True if " " flag is present */
  etByte flag_alternateform; /* True if "#" flag is present */
  etByte flag_altform2;      /* True if "!" flag is present */
  etByte flag_zeropad;       /* True if field width constant starts with zero */
  etByte flag_long;          /* True if "l" flag is present */
  etByte flag_longlong;      /* True if the "ll" flag is present */
  etByte done;               /* Loop termination flag */
  sqlite_uint64 longvalue;   /* Value for integer types */
  LONGDOUBLE_TYPE realvalue; /* Value for real types */
  const et_info *infop;      /* Pointer to the appropriate info structure */
  char buf[etBUFSIZE];       /* Conversion buffer */
  char prefix;               /* Prefix character.  "+" or "-" or " " or '\0'. */
  etByte errorflag = 0;      /* True if an error is encountered */
  etByte xtype;              /* Conversion paradigm */
  char *zExtra;              /* Extra memory used for etTCLESCAPE conversions */
#ifndef SQLITE_OMIT_FLOATING_POINT
  int  exp, e2;              /* exponent of real numbers */
  double rounder;            /* Used for rounding floating point values */
  etByte flag_dp;            /* True if decimal point should be shown */
  etByte flag_rtz;           /* True if trailing zeros should be removed */
  etByte flag_exp;           /* True to force display of the exponent */
  int nsd;                   /* Number of significant digits returned */
#endif

  length = 0;
  bufpt = 0;
  for(; (c=(*fmt))!=0; ++fmt){
    if( c!='%' ){
      int amt;
      bufpt = (char *)fmt;
      amt = 1;
      while( (c=(*++fmt))!='%' && c!=0 ) amt++;
      sqlite3StrAccumAppend(pAccum, bufpt, amt);
      if( c==0 ) break;
    }
    if( (c=(*++fmt))==0 ){
      errorflag = 1;
      sqlite3StrAccumAppend(pAccum, "%", 1);
      break;
    }
    /* Find out what flags are present */
    flag_leftjustify = flag_plussign = flag_blanksign = 
     flag_alternateform = flag_altform2 = flag_zeropad = 0;
    done = 0;
    do{
      switch( c ){
        case '-':   flag_leftjustify = 1;     break;
        case '+':   flag_plussign = 1;        break;
        case ' ':   flag_blanksign = 1;       break;
        case '#':   flag_alternateform = 1;   break;
        case '!':   flag_altform2 = 1;        break;
        case '0':   flag_zeropad = 1;         break;
        default:    done = 1;                 break;
      }
    }while( !done && (c=(*++fmt))!=0 );
    /* Get the field width */
    width = 0;
    if( c=='*' ){
      width = va_arg(ap,int);
      if( width<0 ){
        flag_leftjustify = 1;
        width = -width;
      }
      c = *++fmt;
    }else{
      while( c>='0' && c<='9' ){
        width = width*10 + c - '0';
        c = *++fmt;
      }
    }
    if( width > etBUFSIZE-10 ){
      width = etBUFSIZE-10;
    }
    /* Get the precision */
    if( c=='.' ){
      precision = 0;
      c = *++fmt;
      if( c=='*' ){
        precision = va_arg(ap,int);
        if( precision<0 ) precision = -precision;
        c = *++fmt;
      }else{
        while( c>='0' && c<='9' ){
          precision = precision*10 + c - '0';
          c = *++fmt;
        }
      }
    }else{
      precision = -1;
    }
    /* Get the conversion type modifier */
    if( c=='l' ){
      flag_long = 1;
      c = *++fmt;
      if( c=='l' ){
        flag_longlong = 1;
        c = *++fmt;
      }else{
        flag_longlong = 0;
      }
    }else{
      flag_long = flag_longlong = 0;
    }
    /* Fetch the info entry for the field */
    infop = 0;
    for(idx=0; idx<etNINFO; idx++){
      if( c==fmtinfo[idx].fmttype ){
        infop = &fmtinfo[idx];
        if( useExtended || (infop->flags & FLAG_INTERN)==0 ){
          xtype = infop->type;
        }else{
          return;
        }
        break;
      }
    }
    zExtra = 0;
    if( infop==0 ){
      return;
    }


    /* Limit the precision to prevent overflowing buf[] during conversion */
    if( precision>etBUFSIZE-40 && (infop->flags & FLAG_STRING)==0 ){
      precision = etBUFSIZE-40;
    }

    /*
    ** At this point, variables are initialized as follows:
    **
    **   flag_alternateform          TRUE if a '#' is present.
    **   flag_altform2               TRUE if a '!' is present.
    **   flag_plussign               TRUE if a '+' is present.
    **   flag_leftjustify            TRUE if a '-' is present or if the
    **                               field width was negative.
    **   flag_zeropad                TRUE if the width began with 0.
    **   flag_long                   TRUE if the letter 'l' (ell) prefixed
    **                               the conversion character.
    **   flag_longlong               TRUE if the letter 'll' (ell ell) prefixed
    **                               the conversion character.
    **   flag_blanksign              TRUE if a ' ' is present.
    **   width                       The specified field width.  This is
    **                               always non-negative.  Zero is the default.
    **   precision                   The specified precision.  The default
    **                               is -1.
    **   xtype                       The class of the conversion.
    **   infop                       Pointer to the appropriate info struct.
    */
    switch( xtype ){
      case etPOINTER:
        flag_longlong = sizeof(char*)==sizeof(i64);
        flag_long = sizeof(char*)==sizeof(long int);
        /* Fall through into the next case */
      case etORDINAL:
      case etRADIX:
        if( infop->flags & FLAG_SIGNED ){
          i64 v;
          if( flag_longlong )   v = va_arg(ap,i64);
          else if( flag_long )  v = va_arg(ap,long int);
          else                  v = va_arg(ap,int);
          if( v<0 ){
            longvalue = -v;
            prefix = '-';
          }else{
            longvalue = v;
            if( flag_plussign )        prefix = '+';
            else if( flag_blanksign )  prefix = ' ';
            else                       prefix = 0;
          }
        }else{
          if( flag_longlong )   longvalue = va_arg(ap,u64);
          else if( flag_long )  longvalue = va_arg(ap,unsigned long int);
          else                  longvalue = va_arg(ap,unsigned int);
          prefix = 0;
        }
        if( longvalue==0 ) flag_alternateform = 0;
        if( flag_zeropad && precision<width-(prefix!=0) ){
          precision = width-(prefix!=0);
        }
        bufpt = &buf[etBUFSIZE-1];
        if( xtype==etORDINAL ){
          static const char zOrd[] = "thstndrd";
          int x = longvalue % 10;
          if( x>=4 || (longvalue/10)%10==1 ){
            x = 0;
          }
          buf[etBUFSIZE-3] = zOrd[x*2];
          buf[etBUFSIZE-2] = zOrd[x*2+1];
          bufpt -= 2;
        }
        {
          register const char *cset;      /* Use registers for speed */
          register int base;
          cset = &aDigits[infop->charset];
          base = infop->base;
          do{                                           /* Convert to ascii */
            *(--bufpt) = cset[longvalue%base];
            longvalue = longvalue/base;
          }while( longvalue>0 );
        }
        length = &buf[etBUFSIZE-1]-bufpt;
        for(idx=precision-length; idx>0; idx--){
          *(--bufpt) = '0';                             /* Zero pad */
        }
        if( prefix ) *(--bufpt) = prefix;               /* Add sign */
        if( flag_alternateform && infop->prefix ){      /* Add "0" or "0x" */
          const char *pre;
          char x;
          pre = &aPrefix[infop->prefix];
          for(; (x=(*pre))!=0; pre++) *(--bufpt) = x;
        }
        length = &buf[etBUFSIZE-1]-bufpt;
        break;
      case etFLOAT:
      case etEXP:
      case etGENERIC:
        realvalue = va_arg(ap,double);
#ifndef SQLITE_OMIT_FLOATING_POINT
        if( precision<0 ) precision = 6;         /* Set default precision */
        if( precision>etBUFSIZE/2-10 ) precision = etBUFSIZE/2-10;
        if( realvalue<0.0 ){
          realvalue = -realvalue;
          prefix = '-';
        }else{
          if( flag_plussign )          prefix = '+';
          else if( flag_blanksign )    prefix = ' ';
          else                         prefix = 0;
        }
        if( xtype==etGENERIC && precision>0 ) precision--;
#if 0
        /* Rounding works like BSD when the constant 0.4999 is used.  Wierd! */
        for(idx=precision, rounder=0.4999; idx>0; idx--, rounder*=0.1);
#else
        /* It makes more sense to use 0.5 */
        for(idx=precision, rounder=0.5; idx>0; idx--, rounder*=0.1){}
#endif
        if( xtype==etFLOAT ) realvalue += rounder;
        /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
        exp = 0;
        if( sqlite3IsNaN(realvalue) ){
          bufpt = "NaN";
          length = 3;
          break;
        }
        if( realvalue>0.0 ){
          while( realvalue>=1e32 && exp<=350 ){ realvalue *= 1e-32; exp+=32; }
          while( realvalue>=1e8 && exp<=350 ){ realvalue *= 1e-8; exp+=8; }
          while( realvalue>=10.0 && exp<=350 ){ realvalue *= 0.1; exp++; }
          while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; }
          while( realvalue<1.0 ){ realvalue *= 10.0; exp--; }
          if( exp>350 ){
            if( prefix=='-' ){
              bufpt = "-Inf";
            }else if( prefix=='+' ){
              bufpt = "+Inf";
            }else{
              bufpt = "Inf";
            }
            length = strlen(bufpt);
            break;
          }
        }
        bufpt = buf;
        /*
        ** If the field type is etGENERIC, then convert to either etEXP
        ** or etFLOAT, as appropriate.
        */
        flag_exp = xtype==etEXP;
        if( xtype!=etFLOAT ){
          realvalue += rounder;
          if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; }
        }
        if( xtype==etGENERIC ){
          flag_rtz = !flag_alternateform;
          if( exp<-4 || exp>precision ){
            xtype = etEXP;
          }else{
            precision = precision - exp;
            xtype = etFLOAT;
          }
        }else{
          flag_rtz = 0;
        }
        if( xtype==etEXP ){
          e2 = 0;
        }else{
          e2 = exp;
        }
        nsd = 0;
        flag_dp = (precision>0) | flag_alternateform | flag_altform2;
        /* The sign in front of the number */
        if( prefix ){
          *(bufpt++) = prefix;
        }
        /* Digits prior to the decimal point */
        if( e2<0 ){
          *(bufpt++) = '0';
        }else{
          for(; e2>=0; e2--){
            *(bufpt++) = et_getdigit(&realvalue,&nsd);
          }
        }
        /* The decimal point */
        if( flag_dp ){
          *(bufpt++) = '.';
        }
        /* "0" digits after the decimal point but before the first
        ** significant digit of the number */
        for(e2++; e2<0; precision--, e2++){
          assert( precision>0 );
          *(bufpt++) = '0';
        }
        /* Significant digits after the decimal point */
        while( (precision--)>0 ){
          *(bufpt++) = et_getdigit(&realvalue,&nsd);
        }
        /* Remove trailing zeros and the "." if no digits follow the "." */
        if( flag_rtz && flag_dp ){
          while( bufpt[-1]=='0' ) *(--bufpt) = 0;
          assert( bufpt>buf );
          if( bufpt[-1]=='.' ){
            if( flag_altform2 ){
              *(bufpt++) = '0';
            }else{
              *(--bufpt) = 0;
            }
          }
        }
        /* Add the "eNNN" suffix */
        if( flag_exp || xtype==etEXP ){
          *(bufpt++) = aDigits[infop->charset];
          if( exp<0 ){
            *(bufpt++) = '-'; exp = -exp;
          }else{
            *(bufpt++) = '+';
          }
          if( exp>=100 ){
            *(bufpt++) = (exp/100)+'0';                /* 100's digit */
            exp %= 100;
          }
          *(bufpt++) = exp/10+'0';                     /* 10's digit */
          *(bufpt++) = exp%10+'0';                     /* 1's digit */
        }
        *bufpt = 0;

        /* The converted number is in buf[] and zero terminated. Output it.
        ** Note that the number is in the usual order, not reversed as with
        ** integer conversions. */
        length = bufpt-buf;
        bufpt = buf;

        /* Special case:  Add leading zeros if the flag_zeropad flag is
        ** set and we are not left justified */
        if( flag_zeropad && !flag_leftjustify && length < width){
          int i;
          int nPad = width - length;
          for(i=width; i>=nPad; i--){
            bufpt[i] = bufpt[i-nPad];
          }
          i = prefix!=0;
          while( nPad-- ) bufpt[i++] = '0';
          length = width;
        }
#endif
        break;
      case etSIZE:
        *(va_arg(ap,int*)) = pAccum->nChar;
        length = width = 0;
        break;
      case etPERCENT:
        buf[0] = '%';
        bufpt = buf;
        length = 1;
        break;
      case etCHARX:
        c = buf[0] = va_arg(ap,int);
        if( precision>=0 ){
          for(idx=1; idx<precision; idx++) buf[idx] = c;
          length = precision;
        }else{
          length =1;
        }
        bufpt = buf;
        break;
      case etSTRING:
      case etDYNSTRING:
        bufpt = va_arg(ap,char*);
        if( bufpt==0 ){
          bufpt = "";
        }else if( xtype==etDYNSTRING ){
          zExtra = bufpt;
        }
        if( precision>=0 ){
          for(length=0; length<precision && bufpt[length]; length++){}
        }else{
          length = strlen(bufpt);
        }
        break;
      case etSQLESCAPE:
      case etSQLESCAPE2:
      case etSQLESCAPE3: {
        int i, j, n, ch, isnull;
        int needQuote;
        char q = ((xtype==etSQLESCAPE3)?'"':'\'');   /* Quote character */
        char *escarg = va_arg(ap,char*);
        isnull = escarg==0;
        if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
        for(i=n=0; (ch=escarg[i])!=0; i++){
          if( ch==q )  n++;
        }
        needQuote = !isnull && xtype==etSQLESCAPE2;
        n += i + 1 + needQuote*2;
        if( n>etBUFSIZE ){
          bufpt = zExtra = sqlite3Malloc( n );
          if( bufpt==0 ) return;
        }else{
          bufpt = buf;
        }
        j = 0;
        if( needQuote ) bufpt[j++] = q;
        for(i=0; (ch=escarg[i])!=0; i++){
          bufpt[j++] = ch;
          if( ch==q ) bufpt[j++] = ch;
        }
        if( needQuote ) bufpt[j++] = q;
        bufpt[j] = 0;
        length = j;
        /* The precision is ignored on %q and %Q */
        /* if( precision>=0 && precision<length ) length = precision; */
        break;
      }
      case etTOKEN: {
        Token *pToken = va_arg(ap, Token*);
        if( pToken ){
          sqlite3StrAccumAppend(pAccum, (const char*)pToken->z, pToken->n);
        }
        length = width = 0;
        break;
      }
      case etSRCLIST: {
        SrcList *pSrc = va_arg(ap, SrcList*);
        int k = va_arg(ap, int);
        struct SrcList_item *pItem = &pSrc->a[k];
        assert( k>=0 && k<pSrc->nSrc );
        if( pItem->zDatabase ){
          sqlite3StrAccumAppend(pAccum, pItem->zDatabase, -1);
          sqlite3StrAccumAppend(pAccum, ".", 1);
        }
        sqlite3StrAccumAppend(pAccum, pItem->zName, -1);
        length = width = 0;
        break;
      }
    }/* End switch over the format type */
    /*
    ** The text of the conversion is pointed to by "bufpt" and is
    ** "length" characters long.  The field width is "width".  Do
    ** the output.
    */
    if( !flag_leftjustify ){
      register int nspace;
      nspace = width-length;
      if( nspace>0 ){
        appendSpace(pAccum, nspace);
      }
    }
    if( length>0 ){
      sqlite3StrAccumAppend(pAccum, bufpt, length);
    }
    if( flag_leftjustify ){
      register int nspace;
      nspace = width-length;
      if( nspace>0 ){
        appendSpace(pAccum, nspace);
      }
    }
    if( zExtra ){
      sqlite3_free(zExtra);
    }
  }/* End for loop over the format string */
} /* End of function */

/*
** Append N bytes of text from z to the StrAccum object.
*/
void sqlite3StrAccumAppend(StrAccum *p, const char *z, int N){
  if( p->tooBig | p->mallocFailed ){
    return;
  }
  if( N<0 ){
    N = strlen(z);
  }
  if( N==0 ){
    return;
  }
  if( p->nChar+N >= p->nAlloc ){
    char *zNew;
    if( !p->useMalloc ){
      p->tooBig = 1;
      N = p->nAlloc - p->nChar - 1;
      if( N<=0 ){
        return;
      }
    }else{
      i64 szNew = p->nChar;
      szNew += N + 1;
      if( szNew > p->mxAlloc ){
        sqlite3StrAccumReset(p);
        p->tooBig = 1;
        return;
      }else{
        p->nAlloc = szNew;
      }
      zNew = sqlite3DbMallocRaw(p->db, p->nAlloc );
      if( zNew ){
        memcpy(zNew, p->zText, p->nChar);
        sqlite3StrAccumReset(p);
        p->zText = zNew;
      }else{
        p->mallocFailed = 1;
        sqlite3StrAccumReset(p);
        return;
      }
    }
  }
  memcpy(&p->zText[p->nChar], z, N);
  p->nChar += N;
}

/*
** Finish off a string by making sure it is zero-terminated.
** Return a pointer to the resulting string.  Return a NULL
** pointer if any kind of error was encountered.
*/
char *sqlite3StrAccumFinish(StrAccum *p){
  if( p->zText ){
    p->zText[p->nChar] = 0;
    if( p->useMalloc && p->zText==p->zBase ){
      p->zText = sqlite3DbMallocRaw(p->db, p->nChar+1 );
      if( p->zText ){
        memcpy(p->zText, p->zBase, p->nChar+1);
      }else{
        p->mallocFailed = 1;
      }
    }
  }
  return p->zText;
}

/*
** Reset an StrAccum string.  Reclaim all malloced memory.
*/
void sqlite3StrAccumReset(StrAccum *p){
  if( p->zText!=p->zBase ){
    sqlite3DbFree(p->db, p->zText);
  }
  p->zText = 0;
}

/*
** Initialize a string accumulator
*/
void sqlite3StrAccumInit(StrAccum *p, char *zBase, int n, int mx){
  p->zText = p->zBase = zBase;
  p->db = 0;
  p->nChar = 0;
  p->nAlloc = n;
  p->mxAlloc = mx;
  p->useMalloc = 1;
  p->tooBig = 0;
  p->mallocFailed = 0;
}

/*
** Print into memory obtained from sqliteMalloc().  Use the internal
** %-conversion extensions.
*/
char *sqlite3VMPrintf(sqlite3 *db, const char *zFormat, va_list ap){
  char *z;
  char zBase[SQLITE_PRINT_BUF_SIZE];
  StrAccum acc;
  sqlite3StrAccumInit(&acc, zBase, sizeof(zBase),
                      db ? db->aLimit[SQLITE_LIMIT_LENGTH] : SQLITE_MAX_LENGTH);
  acc.db = db;
  sqlite3VXPrintf(&acc, 1, zFormat, ap);
  z = sqlite3StrAccumFinish(&acc);
  if( acc.mallocFailed && db ){
    db->mallocFailed = 1;
  }
  return z;
}

/*
** Print into memory obtained from sqliteMalloc().  Use the internal
** %-conversion extensions.
*/
char *sqlite3MPrintf(sqlite3 *db, const char *zFormat, ...){
  va_list ap;
  char *z;
  va_start(ap, zFormat);
  z = sqlite3VMPrintf(db, zFormat, ap);
  va_end(ap);
  return z;
}

/*
** Like sqlite3MPrintf(), but call sqlite3DbFree() on zStr after formatting
** the string and before returnning.  This routine is intended to be used
** to modify an existing string.  For example:
**
**       x = sqlite3MPrintf(db, x, "prefix %s suffix", x);
**
*/
char *sqlite3MAppendf(sqlite3 *db, char *zStr, const char *zFormat, ...){
  va_list ap;
  char *z;
  va_start(ap, zFormat);
  z = sqlite3VMPrintf(db, zFormat, ap);
  va_end(ap);
  sqlite3DbFree(db, zStr);
  return z;
}

/*
** Print into memory obtained from sqlite3_malloc().  Omit the internal
** %-conversion extensions.
*/
char *sqlite3_vmprintf(const char *zFormat, va_list ap){
  char *z;
  char zBase[SQLITE_PRINT_BUF_SIZE];
  StrAccum acc;
#ifndef SQLITE_OMIT_AUTOINIT
  if( sqlite3_initialize() ) return 0;
#endif
  sqlite3StrAccumInit(&acc, zBase, sizeof(zBase), SQLITE_MAX_LENGTH);
  sqlite3VXPrintf(&acc, 0, zFormat, ap);
  z = sqlite3StrAccumFinish(&acc);
  return z;
}

/*
** Print into memory obtained from sqlite3_malloc()().  Omit the internal
** %-conversion extensions.
*/
char *sqlite3_mprintf(const char *zFormat, ...){
  va_list ap;
  char *z;
#ifndef SQLITE_OMIT_AUTOINIT
  if( sqlite3_initialize() ) return 0;
#endif
  va_start(ap, zFormat);
  z = sqlite3_vmprintf(zFormat, ap);
  va_end(ap);
  return z;
}

/*
** sqlite3_snprintf() works like snprintf() except that it ignores the
** current locale settings.  This is important for SQLite because we
** are not able to use a "," as the decimal point in place of "." as
** specified by some locales.
*/
char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){
  char *z;
  va_list ap;
  StrAccum acc;

  if( n<=0 ){
    return zBuf;
  }
  sqlite3StrAccumInit(&acc, zBuf, n, 0);
  acc.useMalloc = 0;
  va_start(ap,zFormat);
  sqlite3VXPrintf(&acc, 0, zFormat, ap);
  va_end(ap);
  z = sqlite3StrAccumFinish(&acc);
  return z;
}

#if defined(SQLITE_DEBUG)
/*
** A version of printf() that understands %lld.  Used for debugging.
** The printf() built into some versions of windows does not understand %lld
** and segfaults if you give it a long long int.
*/
void sqlite3DebugPrintf(const char *zFormat, ...){
  va_list ap;
  StrAccum acc;
  char zBuf[500];
  sqlite3StrAccumInit(&acc, zBuf, sizeof(zBuf), 0);
  acc.useMalloc = 0;
  va_start(ap,zFormat);
  sqlite3VXPrintf(&acc, 0, zFormat, ap);
  va_end(ap);
  sqlite3StrAccumFinish(&acc);
  fprintf(stdout,"%s", zBuf);
  fflush(stdout);
}
#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/random.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code to implement a pseudo-random number
** generator (PRNG) for SQLite.
**
** Random numbers are used by some of the database backends in order
** to generate random integer keys for tables or random filenames.
**
** $Id: random.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "sqliteInt.h"


/* All threads share a single random number generator.
** This structure is the current state of the generator.
*/
static struct sqlite3PrngType {
  unsigned char isInit;          /* True if initialized */
  unsigned char i, j;            /* State variables */
  unsigned char s[256];          /* State variables */
} sqlite3Prng;

/*
** Get a single 8-bit random value from the RC4 PRNG.  The Mutex
** must be held while executing this routine.
**
** Why not just use a library random generator like lrand48() for this?
** Because the OP_NewRowid opcode in the VDBE depends on having a very
** good source of random numbers.  The lrand48() library function may
** well be good enough.  But maybe not.  Or maybe lrand48() has some
** subtle problems on some systems that could cause problems.  It is hard
** to know.  To minimize the risk of problems due to bad lrand48()
** implementations, SQLite uses this random number generator based
** on RC4, which we know works very well.
**
** (Later):  Actually, OP_NewRowid does not depend on a good source of
** randomness any more.  But we will leave this code in all the same.
*/
static int randomByte(void){
  unsigned char t;


  /* Initialize the state of the random number generator once,
  ** the first time this routine is called.  The seed value does
  ** not need to contain a lot of randomness since we are not
  ** trying to do secure encryption or anything like that...
  **
  ** Nothing in this file or anywhere else in SQLite does any kind of
  ** encryption.  The RC4 algorithm is being used as a PRNG (pseudo-random
  ** number generator) not as an encryption device.
  */
  if( !sqlite3Prng.isInit ){
    int i;
    char k[256];
    sqlite3Prng.j = 0;
    sqlite3Prng.i = 0;
    sqlite3OsRandomness(sqlite3_vfs_find(0), 256, k);
    for(i=0; i<256; i++){
      sqlite3Prng.s[i] = i;
    }
    for(i=0; i<256; i++){
      sqlite3Prng.j += sqlite3Prng.s[i] + k[i];
      t = sqlite3Prng.s[sqlite3Prng.j];
      sqlite3Prng.s[sqlite3Prng.j] = sqlite3Prng.s[i];
      sqlite3Prng.s[i] = t;
    }
    sqlite3Prng.isInit = 1;
  }

  /* Generate and return single random byte
  */
  sqlite3Prng.i++;
  t = sqlite3Prng.s[sqlite3Prng.i];
  sqlite3Prng.j += t;
  sqlite3Prng.s[sqlite3Prng.i] = sqlite3Prng.s[sqlite3Prng.j];
  sqlite3Prng.s[sqlite3Prng.j] = t;
  t += sqlite3Prng.s[sqlite3Prng.i];
  return sqlite3Prng.s[t];
}

/*
** Return N random bytes.
*/
void sqlite3_randomness(int N, void *pBuf){
  unsigned char *zBuf = pBuf;
#ifndef SQLITE_MUTEX_NOOP
  sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG);
#endif
  sqlite3_mutex_enter(mutex);
  while( N-- ){
    *(zBuf++) = randomByte();
  }
  sqlite3_mutex_leave(mutex);
}

#ifndef SQLITE_OMIT_BUILTIN_TEST
/*
** For testing purposes, we sometimes want to preserve the state of
** PRNG and restore the PRNG to its saved state at a later time.
** The sqlite3_test_control() interface calls these routines to
** control the PRNG.
*/
static struct sqlite3PrngType sqlite3SavedPrng;
void sqlite3PrngSaveState(void){
  memcpy(&sqlite3SavedPrng, &sqlite3Prng, sizeof(sqlite3Prng));
}
void sqlite3PrngRestoreState(void){
  memcpy(&sqlite3Prng, &sqlite3SavedPrng, sizeof(sqlite3Prng));
}
void sqlite3PrngResetState(void){
  sqlite3Prng.isInit = 0;
}
#endif /* SQLITE_OMIT_BUILTIN_TEST */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































Deleted SQLite.Interop/splitsource/rtree.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code for implementations of the r-tree and r*-tree
** algorithms packaged as an SQLite virtual table module.
**
** $Id: rtree.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/

#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RTREE)

/*
** This file contains an implementation of a couple of different variants
** of the r-tree algorithm. See the README file for further details. The 
** same data-structure is used for all, but the algorithms for insert and
** delete operations vary. The variants used are selected at compile time 
** by defining the following symbols:
*/

/* Either, both or none of the following may be set to activate 
** r*tree variant algorithms.
*/
#define VARIANT_RSTARTREE_CHOOSESUBTREE 0
#define VARIANT_RSTARTREE_REINSERT      1

/* 
** Exactly one of the following must be set to 1.
*/
#define VARIANT_GUTTMAN_QUADRATIC_SPLIT 0
#define VARIANT_GUTTMAN_LINEAR_SPLIT    0
#define VARIANT_RSTARTREE_SPLIT         1

#define VARIANT_GUTTMAN_SPLIT \
        (VARIANT_GUTTMAN_LINEAR_SPLIT||VARIANT_GUTTMAN_QUADRATIC_SPLIT)

#if VARIANT_GUTTMAN_QUADRATIC_SPLIT
  #define PickNext QuadraticPickNext
  #define PickSeeds QuadraticPickSeeds
  #define AssignCells splitNodeGuttman
#endif
#if VARIANT_GUTTMAN_LINEAR_SPLIT
  #define PickNext LinearPickNext
  #define PickSeeds LinearPickSeeds
  #define AssignCells splitNodeGuttman
#endif
#if VARIANT_RSTARTREE_SPLIT
  #define AssignCells splitNodeStartree
#endif


#ifndef SQLITE_CORE
  #include "sqlite3ext.h"
  SQLITE_EXTENSION_INIT1
#else
  #include "sqlite3.h"
#endif

#include <string.h>
#include <assert.h>

#ifndef SQLITE_AMALGAMATION
typedef sqlite3_int64 i64;
typedef unsigned char u8;
typedef unsigned int u32;
#endif

typedef struct Rtree Rtree;
typedef struct RtreeCursor RtreeCursor;
typedef struct RtreeNode RtreeNode;
typedef struct RtreeCell RtreeCell;
typedef struct RtreeConstraint RtreeConstraint;
typedef union RtreeCoord RtreeCoord;

/* The rtree may have between 1 and RTREE_MAX_DIMENSIONS dimensions. */
#define RTREE_MAX_DIMENSIONS 5

/* Size of hash table Rtree.aHash. This hash table is not expected to
** ever contain very many entries, so a fixed number of buckets is 
** used.
*/
#define HASHSIZE 128

/* 
** An rtree virtual-table object.
*/
struct Rtree {
  sqlite3_vtab base;
  sqlite3 *db;                /* Host database connection */
  int iNodeSize;              /* Size in bytes of each node in the node table */
  int nDim;                   /* Number of dimensions */
  int nBytesPerCell;          /* Bytes consumed per cell */
  int iDepth;                 /* Current depth of the r-tree structure */
  char *zDb;                  /* Name of database containing r-tree table */
  char *zName;                /* Name of r-tree table */ 
  RtreeNode *aHash[HASHSIZE]; /* Hash table of in-memory nodes. */ 
  int nBusy;                  /* Current number of users of this structure */

  /* List of nodes removed during a CondenseTree operation. List is
  ** linked together via the pointer normally used for hash chains -
  ** RtreeNode.pNext. RtreeNode.iNode stores the depth of the sub-tree 
  ** headed by the node (leaf nodes have RtreeNode.iNode==0).
  */
  RtreeNode *pDeleted;
  int iReinsertHeight;        /* Height of sub-trees Reinsert() has run on */

  /* Statements to read/write/delete a record from xxx_node */
  sqlite3_stmt *pReadNode;
  sqlite3_stmt *pWriteNode;
  sqlite3_stmt *pDeleteNode;

  /* Statements to read/write/delete a record from xxx_rowid */
  sqlite3_stmt *pReadRowid;
  sqlite3_stmt *pWriteRowid;
  sqlite3_stmt *pDeleteRowid;

  /* Statements to read/write/delete a record from xxx_parent */
  sqlite3_stmt *pReadParent;
  sqlite3_stmt *pWriteParent;
  sqlite3_stmt *pDeleteParent;

  int eCoordType;
};

/* Possible values for eCoordType: */
#define RTREE_COORD_REAL32 0
#define RTREE_COORD_INT32  1

/*
** The minimum number of cells allowed for a node is a third of the 
** maximum. In Gutman's notation:
**
**     m = M/3
**
** If an R*-tree "Reinsert" operation is required, the same number of
** cells are removed from the overfull node and reinserted into the tree.
*/
#define RTREE_MINCELLS(p) ((((p)->iNodeSize-4)/(p)->nBytesPerCell)/3)
#define RTREE_REINSERT(p) RTREE_MINCELLS(p)
#define RTREE_MAXCELLS 51

/* 
** An rtree cursor object.
*/
struct RtreeCursor {
  sqlite3_vtab_cursor base;
  RtreeNode *pNode;                 /* Node cursor is currently pointing at */
  int iCell;                        /* Index of current cell in pNode */
  int iStrategy;                    /* Copy of idxNum search parameter */
  int nConstraint;                  /* Number of entries in aConstraint */
  RtreeConstraint *aConstraint;     /* Search constraints. */
};

union RtreeCoord {
  float f;
  int i;
};

/*
** The argument is an RtreeCoord. Return the value stored within the RtreeCoord
** formatted as a double. This macro assumes that local variable pRtree points
** to the Rtree structure associated with the RtreeCoord.
*/
#define DCOORD(coord) (                           \
  (pRtree->eCoordType==RTREE_COORD_REAL32) ?      \
    ((double)coord.f) :                           \
    ((double)coord.i)                             \
)

/*
** A search constraint.
*/
struct RtreeConstraint {
  int iCoord;                       /* Index of constrained coordinate */
  int op;                           /* Constraining operation */
  double rValue;                    /* Constraint value. */
};

/* Possible values for RtreeConstraint.op */
#define RTREE_EQ 0x41
#define RTREE_LE 0x42
#define RTREE_LT 0x43
#define RTREE_GE 0x44
#define RTREE_GT 0x45

/* 
** An rtree structure node.
**
** Data format (RtreeNode.zData):
**
**   1. If the node is the root node (node 1), then the first 2 bytes
**      of the node contain the tree depth as a big-endian integer.
**      For non-root nodes, the first 2 bytes are left unused.
**
**   2. The next 2 bytes contain the number of entries currently 
**      stored in the node.
**
**   3. The remainder of the node contains the node entries. Each entry
**      consists of a single 8-byte integer followed by an even number
**      of 4-byte coordinates. For leaf nodes the integer is the rowid
**      of a record. For internal nodes it is the node number of a
**      child page.
*/
struct RtreeNode {
  RtreeNode *pParent;               /* Parent node */
  i64 iNode;
  int nRef;
  int isDirty;
  u8 *zData;
  RtreeNode *pNext;                 /* Next node in this hash chain */
};
#define NCELL(pNode) readInt16(&(pNode)->zData[2])

/* 
** Structure to store a deserialized rtree record.
*/
struct RtreeCell {
  i64 iRowid;
  RtreeCoord aCoord[RTREE_MAX_DIMENSIONS*2];
};

#define MAX(x,y) ((x) < (y) ? (y) : (x))
#define MIN(x,y) ((x) > (y) ? (y) : (x))

/*
** Functions to deserialize a 16 bit integer, 32 bit real number and
** 64 bit integer. The deserialized value is returned.
*/
static int readInt16(u8 *p){
  return (p[0]<<8) + p[1];
}
static void readCoord(u8 *p, RtreeCoord *pCoord){
  u32 i = (
    (((u32)p[0]) << 24) + 
    (((u32)p[1]) << 16) + 
    (((u32)p[2]) <<  8) + 
    (((u32)p[3]) <<  0)
  );
  *(u32 *)pCoord = i;
}
static i64 readInt64(u8 *p){
  return (
    (((i64)p[0]) << 56) + 
    (((i64)p[1]) << 48) + 
    (((i64)p[2]) << 40) + 
    (((i64)p[3]) << 32) + 
    (((i64)p[4]) << 24) + 
    (((i64)p[5]) << 16) + 
    (((i64)p[6]) <<  8) + 
    (((i64)p[7]) <<  0)
  );
}

/*
** Functions to serialize a 16 bit integer, 32 bit real number and
** 64 bit integer. The value returned is the number of bytes written
** to the argument buffer (always 2, 4 and 8 respectively).
*/
static int writeInt16(u8 *p, int i){
  p[0] = (i>> 8)&0xFF;
  p[1] = (i>> 0)&0xFF;
  return 2;
}
static int writeCoord(u8 *p, RtreeCoord *pCoord){
  u32 i;
  assert( sizeof(RtreeCoord)==4 );
  assert( sizeof(u32)==4 );
  i = *(u32 *)pCoord;
  p[0] = (i>>24)&0xFF;
  p[1] = (i>>16)&0xFF;
  p[2] = (i>> 8)&0xFF;
  p[3] = (i>> 0)&0xFF;
  return 4;
}
static int writeInt64(u8 *p, i64 i){
  p[0] = (i>>56)&0xFF;
  p[1] = (i>>48)&0xFF;
  p[2] = (i>>40)&0xFF;
  p[3] = (i>>32)&0xFF;
  p[4] = (i>>24)&0xFF;
  p[5] = (i>>16)&0xFF;
  p[6] = (i>> 8)&0xFF;
  p[7] = (i>> 0)&0xFF;
  return 8;
}

/*
** Increment the reference count of node p.
*/
static void nodeReference(RtreeNode *p){
  if( p ){
    p->nRef++;
  }
}

/*
** Clear the content of node p (set all bytes to 0x00).
*/
static void nodeZero(Rtree *pRtree, RtreeNode *p){
  if( p ){
    memset(&p->zData[2], 0, pRtree->iNodeSize-2);
    p->isDirty = 1;
  }
}

/*
** Given a node number iNode, return the corresponding key to use
** in the Rtree.aHash table.
*/
static int nodeHash(i64 iNode){
  return (
    (iNode>>56) ^ (iNode>>48) ^ (iNode>>40) ^ (iNode>>32) ^ 
    (iNode>>24) ^ (iNode>>16) ^ (iNode>> 8) ^ (iNode>> 0)
  ) % HASHSIZE;
}

/*
** Search the node hash table for node iNode. If found, return a pointer
** to it. Otherwise, return 0.
*/
static RtreeNode *nodeHashLookup(Rtree *pRtree, i64 iNode){
  RtreeNode *p;
  assert( iNode!=0 );
  for(p=pRtree->aHash[nodeHash(iNode)]; p && p->iNode!=iNode; p=p->pNext);
  return p;
}

/*
** Add node pNode to the node hash table.
*/
static void nodeHashInsert(Rtree *pRtree, RtreeNode *pNode){
  if( pNode ){
    int iHash;
    assert( pNode->pNext==0 );
    iHash = nodeHash(pNode->iNode);
    pNode->pNext = pRtree->aHash[iHash];
    pRtree->aHash[iHash] = pNode;
  }
}

/*
** Remove node pNode from the node hash table.
*/
static void nodeHashDelete(Rtree *pRtree, RtreeNode *pNode){
  RtreeNode **pp;
  if( pNode->iNode!=0 ){
    pp = &pRtree->aHash[nodeHash(pNode->iNode)];
    for( ; (*pp)!=pNode; pp = &(*pp)->pNext){ assert(*pp); }
    *pp = pNode->pNext;
    pNode->pNext = 0;
  }
}

/*
** Allocate and return new r-tree node. Initially, (RtreeNode.iNode==0),
** indicating that node has not yet been assigned a node number. It is
** assigned a node number when nodeWrite() is called to write the
** node contents out to the database.
*/
static RtreeNode *nodeNew(Rtree *pRtree, RtreeNode *pParent, int zero){
  RtreeNode *pNode;
  pNode = (RtreeNode *)sqlite3_malloc(sizeof(RtreeNode) + pRtree->iNodeSize);
  if( pNode ){
    memset(pNode, 0, sizeof(RtreeNode) + (zero?pRtree->iNodeSize:0));
    pNode->zData = (u8 *)&pNode[1];
    pNode->nRef = 1;
    pNode->pParent = pParent;
    pNode->isDirty = 1;
    nodeReference(pParent);
  }
  return pNode;
}

/*
** Obtain a reference to an r-tree node.
*/
static int
nodeAcquire(
  Rtree *pRtree,             /* R-tree structure */
  i64 iNode,                 /* Node number to load */
  RtreeNode *pParent,        /* Either the parent node or NULL */
  RtreeNode **ppNode         /* OUT: Acquired node */
){
  int rc;
  RtreeNode *pNode;

  /* Check if the requested node is already in the hash table. If so,
  ** increase its reference count and return it.
  */
  if( (pNode = nodeHashLookup(pRtree, iNode)) ){
    assert( !pParent || !pNode->pParent || pNode->pParent==pParent );
    if( pParent ){
      pNode->pParent = pParent;
    }
    pNode->nRef++;
    *ppNode = pNode;
    return SQLITE_OK;
  }

  pNode = (RtreeNode *)sqlite3_malloc(sizeof(RtreeNode) + pRtree->iNodeSize);
  if( !pNode ){
    *ppNode = 0;
    return SQLITE_NOMEM;
  }
  pNode->pParent = pParent;
  pNode->zData = (u8 *)&pNode[1];
  pNode->nRef = 1;
  pNode->iNode = iNode;
  pNode->isDirty = 0;
  pNode->pNext = 0;

  sqlite3_bind_int64(pRtree->pReadNode, 1, iNode);
  rc = sqlite3_step(pRtree->pReadNode);
  if( rc==SQLITE_ROW ){
    const u8 *zBlob = sqlite3_column_blob(pRtree->pReadNode, 0);
    memcpy(pNode->zData, zBlob, pRtree->iNodeSize);
    nodeReference(pParent);
  }else{
    sqlite3_free(pNode);
    pNode = 0;
  }

  *ppNode = pNode;
  rc = sqlite3_reset(pRtree->pReadNode);

  if( rc==SQLITE_OK && iNode==1 ){
    pRtree->iDepth = readInt16(pNode->zData);
  }

  assert( (rc==SQLITE_OK && pNode) || (pNode==0 && rc!=SQLITE_OK) );
  nodeHashInsert(pRtree, pNode);

  return rc;
}

/*
** Overwrite cell iCell of node pNode with the contents of pCell.
*/
static void nodeOverwriteCell(
  Rtree *pRtree, 
  RtreeNode *pNode,  
  RtreeCell *pCell, 
  int iCell
){
  int ii;
  u8 *p = &pNode->zData[4 + pRtree->nBytesPerCell*iCell];
  p += writeInt64(p, pCell->iRowid);
  for(ii=0; ii<(pRtree->nDim*2); ii++){
    p += writeCoord(p, &pCell->aCoord[ii]);
  }
  pNode->isDirty = 1;
}

/*
** Remove cell the cell with index iCell from node pNode.
*/
static void nodeDeleteCell(Rtree *pRtree, RtreeNode *pNode, int iCell){
  u8 *pDst = &pNode->zData[4 + pRtree->nBytesPerCell*iCell];
  u8 *pSrc = &pDst[pRtree->nBytesPerCell];
  int nByte = (NCELL(pNode) - iCell - 1) * pRtree->nBytesPerCell;
  memmove(pDst, pSrc, nByte);
  writeInt16(&pNode->zData[2], NCELL(pNode)-1);
  pNode->isDirty = 1;
}

/*
** Insert the contents of cell pCell into node pNode. If the insert
** is successful, return SQLITE_OK.
**
** If there is not enough free space in pNode, return SQLITE_FULL.
*/
static int
nodeInsertCell(
  Rtree *pRtree, 
  RtreeNode *pNode, 
  RtreeCell *pCell 
){
  int nCell;                    /* Current number of cells in pNode */
  int nMaxCell;                 /* Maximum number of cells for pNode */

  nMaxCell = (pRtree->iNodeSize-4)/pRtree->nBytesPerCell;
  nCell = NCELL(pNode);

  assert(nCell<=nMaxCell);

  if( nCell<nMaxCell ){
    nodeOverwriteCell(pRtree, pNode, pCell, nCell);
    writeInt16(&pNode->zData[2], nCell+1);
    pNode->isDirty = 1;
  }

  return (nCell==nMaxCell);
}

/*
** If the node is dirty, write it out to the database.
*/
static int
nodeWrite(Rtree *pRtree, RtreeNode *pNode){
  int rc = SQLITE_OK;
  if( pNode->isDirty ){
    sqlite3_stmt *p = pRtree->pWriteNode;
    if( pNode->iNode ){
      sqlite3_bind_int64(p, 1, pNode->iNode);
    }else{
      sqlite3_bind_null(p, 1);
    }
    sqlite3_bind_blob(p, 2, pNode->zData, pRtree->iNodeSize, SQLITE_STATIC);
    sqlite3_step(p);
    pNode->isDirty = 0;
    rc = sqlite3_reset(p);
    if( pNode->iNode==0 && rc==SQLITE_OK ){
      pNode->iNode = sqlite3_last_insert_rowid(pRtree->db);
      nodeHashInsert(pRtree, pNode);
    }
  }
  return rc;
}

/*
** Release a reference to a node. If the node is dirty and the reference
** count drops to zero, the node data is written to the database.
*/
static int
nodeRelease(Rtree *pRtree, RtreeNode *pNode){
  int rc = SQLITE_OK;
  if( pNode ){
    assert( pNode->nRef>0 );
    pNode->nRef--;
    if( pNode->nRef==0 ){
      if( pNode->iNode==1 ){
        pRtree->iDepth = -1;
      }
      if( pNode->pParent ){
        rc = nodeRelease(pRtree, pNode->pParent);
      }
      if( rc==SQLITE_OK ){
        rc = nodeWrite(pRtree, pNode);
      }
      nodeHashDelete(pRtree, pNode);
      sqlite3_free(pNode);
    }
  }
  return rc;
}

/*
** Return the 64-bit integer value associated with cell iCell of
** node pNode. If pNode is a leaf node, this is a rowid. If it is
** an internal node, then the 64-bit integer is a child page number.
*/
static i64 nodeGetRowid(
  Rtree *pRtree, 
  RtreeNode *pNode, 
  int iCell
){
  assert( iCell<NCELL(pNode) );
  return readInt64(&pNode->zData[4 + pRtree->nBytesPerCell*iCell]);
}

/*
** Return coordinate iCoord from cell iCell in node pNode.
*/
static void nodeGetCoord(
  Rtree *pRtree, 
  RtreeNode *pNode, 
  int iCell,
  int iCoord,
  RtreeCoord *pCoord           /* Space to write result to */
){
  readCoord(&pNode->zData[12 + pRtree->nBytesPerCell*iCell + 4*iCoord], pCoord);
}

/*
** Deserialize cell iCell of node pNode. Populate the structure pointed
** to by pCell with the results.
*/
static void nodeGetCell(
  Rtree *pRtree, 
  RtreeNode *pNode, 
  int iCell,
  RtreeCell *pCell
){
  int ii;
  pCell->iRowid = nodeGetRowid(pRtree, pNode, iCell);
  for(ii=0; ii<pRtree->nDim*2; ii++){
    nodeGetCoord(pRtree, pNode, iCell, ii, &pCell->aCoord[ii]);
  }
}


/* Forward declaration for the function that does the work of
** the virtual table module xCreate() and xConnect() methods.
*/
static int rtreeInit(
  sqlite3 *, void *, int, const char *const*, sqlite3_vtab **, char **, int, int
);

/* 
** Rtree virtual table module xCreate method.
*/
static int rtreeCreate(
  sqlite3 *db,
  void *pAux,
  int argc, const char *const*argv,
  sqlite3_vtab **ppVtab,
  char **pzErr
){
  return rtreeInit(db, pAux, argc, argv, ppVtab, pzErr, 1, (int)pAux);
}

/* 
** Rtree virtual table module xConnect method.
*/
static int rtreeConnect(
  sqlite3 *db,
  void *pAux,
  int argc, const char *const*argv,
  sqlite3_vtab **ppVtab,
  char **pzErr
){
  return rtreeInit(db, pAux, argc, argv, ppVtab, pzErr, 0, (int)pAux);
}

/*
** Increment the r-tree reference count.
*/
static void rtreeReference(Rtree *pRtree){
  pRtree->nBusy++;
}

/*
** Decrement the r-tree reference count. When the reference count reaches
** zero the structure is deleted.
*/
static void rtreeRelease(Rtree *pRtree){
  pRtree->nBusy--;
  if( pRtree->nBusy==0 ){
    sqlite3_finalize(pRtree->pReadNode);
    sqlite3_finalize(pRtree->pWriteNode);
    sqlite3_finalize(pRtree->pDeleteNode);
    sqlite3_finalize(pRtree->pReadRowid);
    sqlite3_finalize(pRtree->pWriteRowid);
    sqlite3_finalize(pRtree->pDeleteRowid);
    sqlite3_finalize(pRtree->pReadParent);
    sqlite3_finalize(pRtree->pWriteParent);
    sqlite3_finalize(pRtree->pDeleteParent);
    sqlite3_free(pRtree);
  }
}

/* 
** Rtree virtual table module xDisconnect method.
*/
static int rtreeDisconnect(sqlite3_vtab *pVtab){
  rtreeRelease((Rtree *)pVtab);
  return SQLITE_OK;
}

/* 
** Rtree virtual table module xDestroy method.
*/
static int rtreeDestroy(sqlite3_vtab *pVtab){
  Rtree *pRtree = (Rtree *)pVtab;
  int rc;
  char *zCreate = sqlite3_mprintf(
    "DROP TABLE '%q'.'%q_node';"
    "DROP TABLE '%q'.'%q_rowid';"
    "DROP TABLE '%q'.'%q_parent';",
    pRtree->zDb, pRtree->zName, 
    pRtree->zDb, pRtree->zName,
    pRtree->zDb, pRtree->zName
  );
  if( !zCreate ){
    rc = SQLITE_NOMEM;
  }else{
    rc = sqlite3_exec(pRtree->db, zCreate, 0, 0, 0);
    sqlite3_free(zCreate);
  }
  if( rc==SQLITE_OK ){
    rtreeRelease(pRtree);
  }

  return rc;
}

/* 
** Rtree virtual table module xOpen method.
*/
static int rtreeOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){
  int rc = SQLITE_NOMEM;
  RtreeCursor *pCsr;

  pCsr = (RtreeCursor *)sqlite3_malloc(sizeof(RtreeCursor));
  if( pCsr ){
    memset(pCsr, 0, sizeof(RtreeCursor));
    pCsr->base.pVtab = pVTab;
    rc = SQLITE_OK;
  }
  *ppCursor = (sqlite3_vtab_cursor *)pCsr;

  return rc;
}

/* 
** Rtree virtual table module xClose method.
*/
static int rtreeClose(sqlite3_vtab_cursor *cur){
  Rtree *pRtree = (Rtree *)(cur->pVtab);
  int rc;
  RtreeCursor *pCsr = (RtreeCursor *)cur;
  sqlite3_free(pCsr->aConstraint);
  rc = nodeRelease(pRtree, pCsr->pNode);
  sqlite3_free(pCsr);
  return rc;
}

/*
** Rtree virtual table module xEof method.
**
** Return non-zero if the cursor does not currently point to a valid 
** record (i.e if the scan has finished), or zero otherwise.
*/
static int rtreeEof(sqlite3_vtab_cursor *cur){
  RtreeCursor *pCsr = (RtreeCursor *)cur;
  return (pCsr->pNode==0);
}

/* 
** Cursor pCursor currently points to a cell in a non-leaf page.
** Return true if the sub-tree headed by the cell is filtered
** (excluded) by the constraints in the pCursor->aConstraint[] 
** array, or false otherwise.
*/
static int testRtreeCell(Rtree *pRtree, RtreeCursor *pCursor){
  RtreeCell cell;
  int ii;
  int bRes = 0;

  nodeGetCell(pRtree, pCursor->pNode, pCursor->iCell, &cell);
  for(ii=0; bRes==0 && ii<pCursor->nConstraint; ii++){
    RtreeConstraint *p = &pCursor->aConstraint[ii];
    double cell_min = DCOORD(cell.aCoord[(p->iCoord>>1)*2]);
    double cell_max = DCOORD(cell.aCoord[(p->iCoord>>1)*2+1]);

    assert(p->op==RTREE_LE || p->op==RTREE_LT || p->op==RTREE_GE 
        || p->op==RTREE_GT || p->op==RTREE_EQ
    );

    switch( p->op ){
      case RTREE_LE: case RTREE_LT: bRes = p->rValue<cell_min; break;
      case RTREE_GE: case RTREE_GT: bRes = p->rValue>cell_max; break;
      case RTREE_EQ: 
        bRes = (p->rValue>cell_max || p->rValue<cell_min);
        break;
    }
  }

  return bRes;
}

/* 
** Return true if the cell that cursor pCursor currently points to
** would be filtered (excluded) by the constraints in the 
** pCursor->aConstraint[] array, or false otherwise.
**
** This function assumes that the cell is part of a leaf node.
*/
static int testRtreeEntry(Rtree *pRtree, RtreeCursor *pCursor){
  RtreeCell cell;
  int ii;

  nodeGetCell(pRtree, pCursor->pNode, pCursor->iCell, &cell);
  for(ii=0; ii<pCursor->nConstraint; ii++){
    RtreeConstraint *p = &pCursor->aConstraint[ii];
    double coord = DCOORD(cell.aCoord[p->iCoord]);
    int res;
    assert(p->op==RTREE_LE || p->op==RTREE_LT || p->op==RTREE_GE 
        || p->op==RTREE_GT || p->op==RTREE_EQ
    );
    switch( p->op ){
      case RTREE_LE: res = (coord<=p->rValue); break;
      case RTREE_LT: res = (coord<p->rValue);  break;
      case RTREE_GE: res = (coord>=p->rValue); break;
      case RTREE_GT: res = (coord>p->rValue);  break;
      case RTREE_EQ: res = (coord==p->rValue); break;
    }

    if( !res ) return 1;
  }

  return 0;
}

/*
** Cursor pCursor currently points at a node that heads a sub-tree of
** height iHeight (if iHeight==0, then the node is a leaf). Descend
** to point to the left-most cell of the sub-tree that matches the 
** configured constraints.
*/
static int descendToCell(
  Rtree *pRtree, 
  RtreeCursor *pCursor, 
  int iHeight,
  int *pEof                 /* OUT: Set to true if cannot descend */
){
  int isEof;
  int rc;
  int ii;
  RtreeNode *pChild;
  sqlite3_int64 iRowid;

  RtreeNode *pSavedNode = pCursor->pNode;
  int iSavedCell = pCursor->iCell;

  assert( iHeight>=0 );

  if( iHeight==0 ){
    isEof = testRtreeEntry(pRtree, pCursor);
  }else{
    isEof = testRtreeCell(pRtree, pCursor);
  }
  if( isEof || iHeight==0 ){
    *pEof = isEof;
    return SQLITE_OK;
  }

  iRowid = nodeGetRowid(pRtree, pCursor->pNode, pCursor->iCell);
  rc = nodeAcquire(pRtree, iRowid, pCursor->pNode, &pChild);
  if( rc!=SQLITE_OK ){
    return rc;
  }

  nodeRelease(pRtree, pCursor->pNode);
  pCursor->pNode = pChild;
  isEof = 1;
  for(ii=0; isEof && ii<NCELL(pChild); ii++){
    pCursor->iCell = ii;
    rc = descendToCell(pRtree, pCursor, iHeight-1, &isEof);
    if( rc!=SQLITE_OK ){
      return rc;
    }
  }

  if( isEof ){
    assert( pCursor->pNode==pChild );
    nodeReference(pSavedNode);
    nodeRelease(pRtree, pChild);
    pCursor->pNode = pSavedNode;
    pCursor->iCell = iSavedCell;
  }

  *pEof = isEof;
  return SQLITE_OK;
}

/*
** One of the cells in node pNode is guaranteed to have a 64-bit 
** integer value equal to iRowid. Return the index of this cell.
*/
static int nodeRowidIndex(Rtree *pRtree, RtreeNode *pNode, i64 iRowid){
  int ii;
  for(ii=0; nodeGetRowid(pRtree, pNode, ii)!=iRowid; ii++){
    assert( ii<(NCELL(pNode)-1) );
  }
  return ii;
}

/*
** Return the index of the cell containing a pointer to node pNode
** in its parent. If pNode is the root node, return -1.
*/
static int nodeParentIndex(Rtree *pRtree, RtreeNode *pNode){
  RtreeNode *pParent = pNode->pParent;
  if( pParent ){
    return nodeRowidIndex(pRtree, pParent, pNode->iNode);
  }
  return -1;
}

/* 
** Rtree virtual table module xNext method.
*/
static int rtreeNext(sqlite3_vtab_cursor *pVtabCursor){
  Rtree *pRtree = (Rtree *)(pVtabCursor->pVtab);
  RtreeCursor *pCsr = (RtreeCursor *)pVtabCursor;
  int rc = SQLITE_OK;

  if( pCsr->iStrategy==1 ){
    /* This "scan" is a direct lookup by rowid. There is no next entry. */
    nodeRelease(pRtree, pCsr->pNode);
    pCsr->pNode = 0;
  }

  else if( pCsr->pNode ){
    /* Move to the next entry that matches the configured constraints. */
    int iHeight = 0;
    while( pCsr->pNode ){
      RtreeNode *pNode = pCsr->pNode;
      int nCell = NCELL(pNode);
      for(pCsr->iCell++; pCsr->iCell<nCell; pCsr->iCell++){
        int isEof;
        rc = descendToCell(pRtree, pCsr, iHeight, &isEof);
        if( rc!=SQLITE_OK || !isEof ){
          return rc;
        }
      }
      pCsr->pNode = pNode->pParent;
      pCsr->iCell = nodeParentIndex(pRtree, pNode);
      nodeReference(pCsr->pNode);
      nodeRelease(pRtree, pNode);
      iHeight++;
    }
  }

  return rc;
}

/* 
** Rtree virtual table module xRowid method.
*/
static int rtreeRowid(sqlite3_vtab_cursor *pVtabCursor, sqlite_int64 *pRowid){
  Rtree *pRtree = (Rtree *)pVtabCursor->pVtab;
  RtreeCursor *pCsr = (RtreeCursor *)pVtabCursor;

  assert(pCsr->pNode);
  *pRowid = nodeGetRowid(pRtree, pCsr->pNode, pCsr->iCell);

  return SQLITE_OK;
}

/* 
** Rtree virtual table module xColumn method.
*/
static int rtreeColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){
  Rtree *pRtree = (Rtree *)cur->pVtab;
  RtreeCursor *pCsr = (RtreeCursor *)cur;

  if( i==0 ){
    i64 iRowid = nodeGetRowid(pRtree, pCsr->pNode, pCsr->iCell);
    sqlite3_result_int64(ctx, iRowid);
  }else{
    RtreeCoord c;
    nodeGetCoord(pRtree, pCsr->pNode, pCsr->iCell, i-1, &c);
    if( pRtree->eCoordType==RTREE_COORD_REAL32 ){
      sqlite3_result_double(ctx, c.f);
    }else{
      assert( pRtree->eCoordType==RTREE_COORD_INT32 );
      sqlite3_result_int(ctx, c.i);
    }
  }

  return SQLITE_OK;
}

/* 
** Use nodeAcquire() to obtain the leaf node containing the record with 
** rowid iRowid. If successful, set *ppLeaf to point to the node and
** return SQLITE_OK. If there is no such record in the table, set
** *ppLeaf to 0 and return SQLITE_OK. If an error occurs, set *ppLeaf
** to zero and return an SQLite error code.
*/
static int findLeafNode(Rtree *pRtree, i64 iRowid, RtreeNode **ppLeaf){
  int rc;
  *ppLeaf = 0;
  sqlite3_bind_int64(pRtree->pReadRowid, 1, iRowid);
  if( sqlite3_step(pRtree->pReadRowid)==SQLITE_ROW ){
    i64 iNode = sqlite3_column_int64(pRtree->pReadRowid, 0);
    rc = nodeAcquire(pRtree, iNode, 0, ppLeaf);
    sqlite3_reset(pRtree->pReadRowid);
  }else{
    rc = sqlite3_reset(pRtree->pReadRowid);
  }
  return rc;
}


/* 
** Rtree virtual table module xFilter method.
*/
static int rtreeFilter(
  sqlite3_vtab_cursor *pVtabCursor, 
  int idxNum, const char *idxStr,
  int argc, sqlite3_value **argv
){
  Rtree *pRtree = (Rtree *)pVtabCursor->pVtab;
  RtreeCursor *pCsr = (RtreeCursor *)pVtabCursor;

  RtreeNode *pRoot = 0;
  int ii;
  int rc = SQLITE_OK;

  rtreeReference(pRtree);

  sqlite3_free(pCsr->aConstraint);
  pCsr->aConstraint = 0;
  pCsr->iStrategy = idxNum;

  if( idxNum==1 ){
    /* Special case - lookup by rowid. */
    RtreeNode *pLeaf;        /* Leaf on which the required cell resides */
    i64 iRowid = sqlite3_value_int64(argv[0]);
    rc = findLeafNode(pRtree, iRowid, &pLeaf);
    pCsr->pNode = pLeaf; 
    if( pLeaf && rc==SQLITE_OK ){
      pCsr->iCell = nodeRowidIndex(pRtree, pLeaf, iRowid);
    }
  }else{
    /* Normal case - r-tree scan. Set up the RtreeCursor.aConstraint array 
    ** with the configured constraints. 
    */
    if( argc>0 ){
      pCsr->aConstraint = sqlite3_malloc(sizeof(RtreeConstraint)*argc);
      pCsr->nConstraint = argc;
      if( !pCsr->aConstraint ){
        rc = SQLITE_NOMEM;
      }else{
        assert( (idxStr==0 && argc==0) || strlen(idxStr)==argc*2 );
        for(ii=0; ii<argc; ii++){
          RtreeConstraint *p = &pCsr->aConstraint[ii];
          p->op = idxStr[ii*2];
          p->iCoord = idxStr[ii*2+1]-'a';
          p->rValue = sqlite3_value_double(argv[ii]);
        }
      }
    }
  
    if( rc==SQLITE_OK ){
      pCsr->pNode = 0;
      rc = nodeAcquire(pRtree, 1, 0, &pRoot);
    }
    if( rc==SQLITE_OK ){
      int isEof = 1;
      int nCell = NCELL(pRoot);
      pCsr->pNode = pRoot;
      for(pCsr->iCell=0; rc==SQLITE_OK && pCsr->iCell<nCell; pCsr->iCell++){
        assert( pCsr->pNode==pRoot );
        rc = descendToCell(pRtree, pCsr, pRtree->iDepth, &isEof);
        if( !isEof ){
          break;
        }
      }
      if( rc==SQLITE_OK && isEof ){
        assert( pCsr->pNode==pRoot );
        nodeRelease(pRtree, pRoot);
        pCsr->pNode = 0;
      }
      assert( rc!=SQLITE_OK || !pCsr->pNode || pCsr->iCell<NCELL(pCsr->pNode) );
    }
  }

  rtreeRelease(pRtree);
  return rc;
}

/*
** Rtree virtual table module xBestIndex method. There are three
** table scan strategies to choose from (in order from most to 
** least desirable):
**
**   idxNum     idxStr        Strategy
**   ------------------------------------------------
**     1        Unused        Direct lookup by rowid.
**     2        See below     R-tree query.
**     3        Unused        Full table scan.
**   ------------------------------------------------
**
** If strategy 1 or 3 is used, then idxStr is not meaningful. If strategy
** 2 is used, idxStr is formatted to contain 2 bytes for each 
** constraint used. The first two bytes of idxStr correspond to 
** the constraint in sqlite3_index_info.aConstraintUsage[] with
** (argvIndex==1) etc.
**
** The first of each pair of bytes in idxStr identifies the constraint
** operator as follows:
**
**   Operator    Byte Value
**   ----------------------
**      =        0x41 ('A')
**     <=        0x42 ('B')
**      <        0x43 ('C')
**     >=        0x44 ('D')
**      >        0x45 ('E')
**   ----------------------
**
** The second of each pair of bytes identifies the coordinate column
** to which the constraint applies. The leftmost coordinate column
** is 'a', the second from the left 'b' etc.
*/
static int rtreeBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
  int rc = SQLITE_OK;
  int ii, cCol;

  int iIdx = 0;
  char zIdxStr[RTREE_MAX_DIMENSIONS*8+1];
  memset(zIdxStr, 0, sizeof(zIdxStr));

  assert( pIdxInfo->idxStr==0 );
  for(ii=0; ii<pIdxInfo->nConstraint; ii++){
    struct sqlite3_index_constraint *p = &pIdxInfo->aConstraint[ii];

    if( p->usable && p->iColumn==0 && p->op==SQLITE_INDEX_CONSTRAINT_EQ ){
      /* We have an equality constraint on the rowid. Use strategy 1. */
      int jj;
      for(jj=0; jj<ii; jj++){
        pIdxInfo->aConstraintUsage[jj].argvIndex = 0;
        pIdxInfo->aConstraintUsage[jj].omit = 0;
      }
      pIdxInfo->idxNum = 1;
      pIdxInfo->aConstraintUsage[ii].argvIndex = 1;
      pIdxInfo->aConstraintUsage[jj].omit = 1;
      return SQLITE_OK;
    }

    if( p->usable && p->iColumn>0 ){
      u8 op = 0;
      switch( p->op ){
        case SQLITE_INDEX_CONSTRAINT_EQ: op = RTREE_EQ; break;
        case SQLITE_INDEX_CONSTRAINT_GT: op = RTREE_GT; break;
        case SQLITE_INDEX_CONSTRAINT_LE: op = RTREE_LE; break;
        case SQLITE_INDEX_CONSTRAINT_LT: op = RTREE_LT; break;
        case SQLITE_INDEX_CONSTRAINT_GE: op = RTREE_GE; break;
      }
      if( op ){
        /* Make sure this particular constraint has not been used before.
        ** If it has been used before, ignore it.
        **
        ** A <= or < can be used if there is a prior >= or >.
        ** A >= or > can be used if there is a prior < or <=.
        ** A <= or < is disqualified if there is a prior <=, <, or ==.
        ** A >= or > is disqualified if there is a prior >=, >, or ==.
        ** A == is disqualifed if there is any prior constraint.
        */
        int j, opmsk;
        static const unsigned char compatible[] = { 0, 0, 1, 1, 2, 2 };
        assert( compatible[RTREE_EQ & 7]==0 );
        assert( compatible[RTREE_LT & 7]==1 );
        assert( compatible[RTREE_LE & 7]==1 );
        assert( compatible[RTREE_GT & 7]==2 );
        assert( compatible[RTREE_GE & 7]==2 );
        cCol = p->iColumn - 1 + 'a';
        opmsk = compatible[op & 7];
        for(j=0; j<iIdx; j+=2){
          if( zIdxStr[j+1]==cCol && (compatible[zIdxStr[j] & 7] & opmsk)!=0 ){
            op = 0;
            break;
          }
        }
      }
      if( op ){
        assert( iIdx<sizeof(zIdxStr)-1 );
        zIdxStr[iIdx++] = op;
        zIdxStr[iIdx++] = cCol;
        pIdxInfo->aConstraintUsage[ii].argvIndex = (iIdx/2);
        pIdxInfo->aConstraintUsage[ii].omit = 1;
      }
    }
  }

  pIdxInfo->idxNum = 2;
  pIdxInfo->needToFreeIdxStr = 1;
  if( iIdx>0 && 0==(pIdxInfo->idxStr = sqlite3_mprintf("%s", zIdxStr)) ){
    return SQLITE_NOMEM;
  }
  return rc;
}

/*
** Return the N-dimensional volumn of the cell stored in *p.
*/
static float cellArea(Rtree *pRtree, RtreeCell *p){
  float area = 1.0;
  int ii;
  for(ii=0; ii<(pRtree->nDim*2); ii+=2){
    area = area * (DCOORD(p->aCoord[ii+1]) - DCOORD(p->aCoord[ii]));
  }
  return area;
}

/*
** Return the margin length of cell p. The margin length is the sum
** of the objects size in each dimension.
*/
static float cellMargin(Rtree *pRtree, RtreeCell *p){
  float margin = 0.0;
  int ii;
  for(ii=0; ii<(pRtree->nDim*2); ii+=2){
    margin += (DCOORD(p->aCoord[ii+1]) - DCOORD(p->aCoord[ii]));
  }
  return margin;
}

/*
** Store the union of cells p1 and p2 in p1.
*/
static void cellUnion(Rtree *pRtree, RtreeCell *p1, RtreeCell *p2){
  int ii;
  if( pRtree->eCoordType==RTREE_COORD_REAL32 ){
    for(ii=0; ii<(pRtree->nDim*2); ii+=2){
      p1->aCoord[ii].f = MIN(p1->aCoord[ii].f, p2->aCoord[ii].f);
      p1->aCoord[ii+1].f = MAX(p1->aCoord[ii+1].f, p2->aCoord[ii+1].f);
    }
  }else{
    for(ii=0; ii<(pRtree->nDim*2); ii+=2){
      p1->aCoord[ii].i = MIN(p1->aCoord[ii].i, p2->aCoord[ii].i);
      p1->aCoord[ii+1].i = MAX(p1->aCoord[ii+1].i, p2->aCoord[ii+1].i);
    }
  }
}

/*
** Return the amount cell p would grow by if it were unioned with pCell.
*/
static float cellGrowth(Rtree *pRtree, RtreeCell *p, RtreeCell *pCell){
  float area;
  RtreeCell cell;
  memcpy(&cell, p, sizeof(RtreeCell));
  area = cellArea(pRtree, &cell);
  cellUnion(pRtree, &cell, pCell);
  return (cellArea(pRtree, &cell)-area);
}

#if VARIANT_RSTARTREE_CHOOSESUBTREE || VARIANT_RSTARTREE_SPLIT
static float cellOverlap(
  Rtree *pRtree, 
  RtreeCell *p, 
  RtreeCell *aCell, 
  int nCell, 
  int iExclude
){
  int ii;
  float overlap = 0.0;
  for(ii=0; ii<nCell; ii++){
    if( ii!=iExclude ){
      int jj;
      float o = 1.0;
      for(jj=0; jj<(pRtree->nDim*2); jj+=2){
        double x1;
        double x2;

        x1 = MAX(DCOORD(p->aCoord[jj]), DCOORD(aCell[ii].aCoord[jj]));
        x2 = MIN(DCOORD(p->aCoord[jj+1]), DCOORD(aCell[ii].aCoord[jj+1]));

        if( x2<x1 ){
          o = 0.0;
          break;
        }else{
          o = o * (x2-x1);
        }
      }
      overlap += o;
    }
  }
  return overlap;
}
#endif

#if VARIANT_RSTARTREE_CHOOSESUBTREE
static float cellOverlapEnlargement(
  Rtree *pRtree, 
  RtreeCell *p, 
  RtreeCell *pInsert, 
  RtreeCell *aCell, 
  int nCell, 
  int iExclude
){
  float before;
  float after;
  before = cellOverlap(pRtree, p, aCell, nCell, iExclude);
  cellUnion(pRtree, p, pInsert);
  after = cellOverlap(pRtree, p, aCell, nCell, iExclude);
  return after-before;
}
#endif


/*
** This function implements the ChooseLeaf algorithm from Gutman[84].
** ChooseSubTree in r*tree terminology.
*/
static int ChooseLeaf(
  Rtree *pRtree,               /* Rtree table */
  RtreeCell *pCell,            /* Cell to insert into rtree */
  int iHeight,                 /* Height of sub-tree rooted at pCell */
  RtreeNode **ppLeaf           /* OUT: Selected leaf page */
){
  int rc;
  int ii;
  RtreeNode *pNode;
  rc = nodeAcquire(pRtree, 1, 0, &pNode);

  for(ii=0; rc==SQLITE_OK && ii<(pRtree->iDepth-iHeight); ii++){
    int iCell;
    sqlite3_int64 iBest;

    float fMinGrowth;
    float fMinArea;
    float fMinOverlap;

    int nCell = NCELL(pNode);
    RtreeCell cell;
    RtreeNode *pChild;

    RtreeCell *aCell = 0;

#if VARIANT_RSTARTREE_CHOOSESUBTREE
    if( ii==(pRtree->iDepth-1) ){
      int jj;
      aCell = sqlite3_malloc(sizeof(RtreeCell)*nCell);
      if( !aCell ){
        rc = SQLITE_NOMEM;
        nodeRelease(pRtree, pNode);
        pNode = 0;
        continue;
      }
      for(jj=0; jj<nCell; jj++){
        nodeGetCell(pRtree, pNode, jj, &aCell[jj]);
      }
    }
#endif

    /* Select the child node which will be enlarged the least if pCell
    ** is inserted into it. Resolve ties by choosing the entry with
    ** the smallest area.
    */
    for(iCell=0; iCell<nCell; iCell++){
      float growth;
      float area;
      float overlap = 0.0;
      nodeGetCell(pRtree, pNode, iCell, &cell);
      growth = cellGrowth(pRtree, &cell, pCell);
      area = cellArea(pRtree, &cell);
#if VARIANT_RSTARTREE_CHOOSESUBTREE
      if( ii==(pRtree->iDepth-1) ){
        overlap = cellOverlapEnlargement(pRtree,&cell,pCell,aCell,nCell,iCell);
      }
#endif
      if( (iCell==0) 
       || (overlap<fMinOverlap) 
       || (overlap==fMinOverlap && growth<fMinGrowth)
       || (overlap==fMinOverlap && growth==fMinGrowth && area<fMinArea)
      ){
        fMinOverlap = overlap;
        fMinGrowth = growth;
        fMinArea = area;
        iBest = cell.iRowid;
      }
    }

    sqlite3_free(aCell);
    rc = nodeAcquire(pRtree, iBest, pNode, &pChild);
    nodeRelease(pRtree, pNode);
    pNode = pChild;
  }

  *ppLeaf = pNode;
  return rc;
}

/*
** A cell with the same content as pCell has just been inserted into
** the node pNode. This function updates the bounding box cells in
** all ancestor elements.
*/
static void AdjustTree(
  Rtree *pRtree,                    /* Rtree table */
  RtreeNode *pNode,                 /* Adjust ancestry of this node. */
  RtreeCell *pCell                  /* This cell was just inserted */
){
  RtreeNode *p = pNode;
  while( p->pParent ){
    RtreeCell cell;
    RtreeNode *pParent = p->pParent;
    int iCell = nodeParentIndex(pRtree, p);

    nodeGetCell(pRtree, pParent, iCell, &cell);
    if( cellGrowth(pRtree, &cell, pCell)>0.0 ){
      cellUnion(pRtree, &cell, pCell);
      nodeOverwriteCell(pRtree, pParent, &cell, iCell);
    }
 
    p = pParent;
  }
}

/*
** Write mapping (iRowid->iNode) to the <rtree>_rowid table.
*/
static int rowidWrite(Rtree *pRtree, sqlite3_int64 iRowid, sqlite3_int64 iNode){
  sqlite3_bind_int64(pRtree->pWriteRowid, 1, iRowid);
  sqlite3_bind_int64(pRtree->pWriteRowid, 2, iNode);
  sqlite3_step(pRtree->pWriteRowid);
  return sqlite3_reset(pRtree->pWriteRowid);
}

/*
** Write mapping (iNode->iPar) to the <rtree>_parent table.
*/
static int parentWrite(Rtree *pRtree, sqlite3_int64 iNode, sqlite3_int64 iPar){
  sqlite3_bind_int64(pRtree->pWriteParent, 1, iNode);
  sqlite3_bind_int64(pRtree->pWriteParent, 2, iPar);
  sqlite3_step(pRtree->pWriteParent);
  return sqlite3_reset(pRtree->pWriteParent);
}

static int rtreeInsertCell(Rtree *, RtreeNode *, RtreeCell *, int);

#if VARIANT_GUTTMAN_LINEAR_SPLIT
/*
** Implementation of the linear variant of the PickNext() function from
** Guttman[84].
*/
static RtreeCell *LinearPickNext(
  Rtree *pRtree,
  RtreeCell *aCell, 
  int nCell, 
  RtreeCell *pLeftBox, 
  RtreeCell *pRightBox,
  int *aiUsed
){
  int ii;
  for(ii=0; aiUsed[ii]; ii++);
  aiUsed[ii] = 1;
  return &aCell[ii];
}

/*
** Implementation of the linear variant of the PickSeeds() function from
** Guttman[84].
*/
static void LinearPickSeeds(
  Rtree *pRtree,
  RtreeCell *aCell, 
  int nCell, 
  int *piLeftSeed, 
  int *piRightSeed
){
  int i;
  int iLeftSeed = 0;
  int iRightSeed = 1;
  float maxNormalInnerWidth = 0.0;

  /* Pick two "seed" cells from the array of cells. The algorithm used
  ** here is the LinearPickSeeds algorithm from Gutman[1984]. The 
  ** indices of the two seed cells in the array are stored in local
  ** variables iLeftSeek and iRightSeed.
  */
  for(i=0; i<pRtree->nDim; i++){
    float x1 = aCell[0].aCoord[i*2];
    float x2 = aCell[0].aCoord[i*2+1];
    float x3 = x1;
    float x4 = x2;
    int jj;

    int iCellLeft = 0;
    int iCellRight = 0;

    for(jj=1; jj<nCell; jj++){
      float left = aCell[jj].aCoord[i*2];
      float right = aCell[jj].aCoord[i*2+1];

      if( left<x1 ) x1 = left;
      if( right>x4 ) x4 = right;
      if( left>x3 ){
        x3 = left;
        iCellRight = jj;
      }
      if( right<x2 ){
        x2 = right;
        iCellLeft = jj;
      }
    }

    if( x4!=x1 ){
      float normalwidth = (x3 - x2) / (x4 - x1);
      if( normalwidth>maxNormalInnerWidth ){
        iLeftSeed = iCellLeft;
        iRightSeed = iCellRight;
      }
    }
  }

  *piLeftSeed = iLeftSeed;
  *piRightSeed = iRightSeed;
}
#endif /* VARIANT_GUTTMAN_LINEAR_SPLIT */

#if VARIANT_GUTTMAN_QUADRATIC_SPLIT
/*
** Implementation of the quadratic variant of the PickNext() function from
** Guttman[84].
*/
static RtreeCell *QuadraticPickNext(
  Rtree *pRtree,
  RtreeCell *aCell, 
  int nCell, 
  RtreeCell *pLeftBox, 
  RtreeCell *pRightBox,
  int *aiUsed
){
  #define FABS(a) ((a)<0.0?-1.0*(a):(a))

  int iSelect = -1;
  float fDiff;
  int ii;
  for(ii=0; ii<nCell; ii++){
    if( aiUsed[ii]==0 ){
      float left = cellGrowth(pRtree, pLeftBox, &aCell[ii]);
      float right = cellGrowth(pRtree, pLeftBox, &aCell[ii]);
      float diff = FABS(right-left);
      if( iSelect<0 || diff>fDiff ){
        fDiff = diff;
        iSelect = ii;
      }
    }
  }
  aiUsed[iSelect] = 1;
  return &aCell[iSelect];
}

/*
** Implementation of the quadratic variant of the PickSeeds() function from
** Guttman[84].
*/
static void QuadraticPickSeeds(
  Rtree *pRtree,
  RtreeCell *aCell, 
  int nCell, 
  int *piLeftSeed, 
  int *piRightSeed
){
  int ii;
  int jj;

  int iLeftSeed = 0;
  int iRightSeed = 1;
  float fWaste = 0.0;

  for(ii=0; ii<nCell; ii++){
    for(jj=ii+1; jj<nCell; jj++){
      float right = cellArea(pRtree, &aCell[jj]);
      float growth = cellGrowth(pRtree, &aCell[ii], &aCell[jj]);
      float waste = growth - right;

      if( waste>fWaste ){
        iLeftSeed = ii;
        iRightSeed = jj;
        fWaste = waste;
      }
    }
  }

  *piLeftSeed = iLeftSeed;
  *piRightSeed = iRightSeed;
}
#endif /* VARIANT_GUTTMAN_QUADRATIC_SPLIT */

/*
** Arguments aIdx, aDistance and aSpare all point to arrays of size
** nIdx. The aIdx array contains the set of integers from 0 to 
** (nIdx-1) in no particular order. This function sorts the values
** in aIdx according to the indexed values in aDistance. For
** example, assuming the inputs:
**
**   aIdx      = { 0,   1,   2,   3 }
**   aDistance = { 5.0, 2.0, 7.0, 6.0 }
**
** this function sets the aIdx array to contain:
**
**   aIdx      = { 0,   1,   2,   3 }
**
** The aSpare array is used as temporary working space by the
** sorting algorithm.
*/
static void SortByDistance(
  int *aIdx, 
  int nIdx, 
  float *aDistance, 
  int *aSpare
){
  if( nIdx>1 ){
    int iLeft = 0;
    int iRight = 0;

    int nLeft = nIdx/2;
    int nRight = nIdx-nLeft;
    int *aLeft = aIdx;
    int *aRight = &aIdx[nLeft];

    SortByDistance(aLeft, nLeft, aDistance, aSpare);
    SortByDistance(aRight, nRight, aDistance, aSpare);

    memcpy(aSpare, aLeft, sizeof(int)*nLeft);
    aLeft = aSpare;

    while( iLeft<nLeft || iRight<nRight ){
      if( iLeft==nLeft ){
        aIdx[iLeft+iRight] = aRight[iRight];
        iRight++;
      }else if( iRight==nRight ){
        aIdx[iLeft+iRight] = aLeft[iLeft];
        iLeft++;
      }else{
        float fLeft = aDistance[aLeft[iLeft]];
        float fRight = aDistance[aRight[iRight]];
        if( fLeft<fRight ){
          aIdx[iLeft+iRight] = aLeft[iLeft];
          iLeft++;
        }else{
          aIdx[iLeft+iRight] = aRight[iRight];
          iRight++;
        }
      }
    }

#if 0
    /* Check that the sort worked */
    {
      int jj;
      for(jj=1; jj<nIdx; jj++){
        float left = aDistance[aIdx[jj-1]];
        float right = aDistance[aIdx[jj]];
        assert( left<=right );
      }
    }
#endif
  }
}

/*
** Arguments aIdx, aCell and aSpare all point to arrays of size
** nIdx. The aIdx array contains the set of integers from 0 to 
** (nIdx-1) in no particular order. This function sorts the values
** in aIdx according to dimension iDim of the cells in aCell. The
** minimum value of dimension iDim is considered first, the
** maximum used to break ties.
**
** The aSpare array is used as temporary working space by the
** sorting algorithm.
*/
static void SortByDimension(
  Rtree *pRtree,
  int *aIdx, 
  int nIdx, 
  int iDim, 
  RtreeCell *aCell, 
  int *aSpare
){
  if( nIdx>1 ){

    int iLeft = 0;
    int iRight = 0;

    int nLeft = nIdx/2;
    int nRight = nIdx-nLeft;
    int *aLeft = aIdx;
    int *aRight = &aIdx[nLeft];

    SortByDimension(pRtree, aLeft, nLeft, iDim, aCell, aSpare);
    SortByDimension(pRtree, aRight, nRight, iDim, aCell, aSpare);

    memcpy(aSpare, aLeft, sizeof(int)*nLeft);
    aLeft = aSpare;
    while( iLeft<nLeft || iRight<nRight ){
      double xleft1 = DCOORD(aCell[aLeft[iLeft]].aCoord[iDim*2]);
      double xleft2 = DCOORD(aCell[aLeft[iLeft]].aCoord[iDim*2+1]);
      double xright1 = DCOORD(aCell[aRight[iRight]].aCoord[iDim*2]);
      double xright2 = DCOORD(aCell[aRight[iRight]].aCoord[iDim*2+1]);
      if( (iLeft!=nLeft) && ((iRight==nRight)
       || (xleft1<xright1)
       || (xleft1==xright1 && xleft2<xright2)
      )){
        aIdx[iLeft+iRight] = aLeft[iLeft];
        iLeft++;
      }else{
        aIdx[iLeft+iRight] = aRight[iRight];
        iRight++;
      }
    }

#if 0
    /* Check that the sort worked */
    {
      int jj;
      for(jj=1; jj<nIdx; jj++){
        float xleft1 = aCell[aIdx[jj-1]].aCoord[iDim*2];
        float xleft2 = aCell[aIdx[jj-1]].aCoord[iDim*2+1];
        float xright1 = aCell[aIdx[jj]].aCoord[iDim*2];
        float xright2 = aCell[aIdx[jj]].aCoord[iDim*2+1];
        assert( xleft1<=xright1 && (xleft1<xright1 || xleft2<=xright2) );
      }
    }
#endif
  }
}

#if VARIANT_RSTARTREE_SPLIT
/*
** Implementation of the R*-tree variant of SplitNode from Beckman[1990].
*/
static int splitNodeStartree(
  Rtree *pRtree,
  RtreeCell *aCell,
  int nCell,
  RtreeNode *pLeft,
  RtreeNode *pRight,
  RtreeCell *pBboxLeft,
  RtreeCell *pBboxRight
){
  int **aaSorted;
  int *aSpare;
  int ii;

  int iBestDim;
  int iBestSplit;
  float fBestMargin;

  int nByte = (pRtree->nDim+1)*(sizeof(int*)+nCell*sizeof(int));

  aaSorted = (int **)sqlite3_malloc(nByte);
  if( !aaSorted ){
    return SQLITE_NOMEM;
  }

  aSpare = &((int *)&aaSorted[pRtree->nDim])[pRtree->nDim*nCell];
  memset(aaSorted, 0, nByte);
  for(ii=0; ii<pRtree->nDim; ii++){
    int jj;
    aaSorted[ii] = &((int *)&aaSorted[pRtree->nDim])[ii*nCell];
    for(jj=0; jj<nCell; jj++){
      aaSorted[ii][jj] = jj;
    }
    SortByDimension(pRtree, aaSorted[ii], nCell, ii, aCell, aSpare);
  }

  for(ii=0; ii<pRtree->nDim; ii++){
    float margin = 0.0;
    float fBestOverlap;
    float fBestArea;
    int iBestLeft;
    int nLeft;

    for(
      nLeft=RTREE_MINCELLS(pRtree); 
      nLeft<=(nCell-RTREE_MINCELLS(pRtree)); 
      nLeft++
    ){
      RtreeCell left;
      RtreeCell right;
      int kk;
      float overlap;
      float area;

      memcpy(&left, &aCell[aaSorted[ii][0]], sizeof(RtreeCell));
      memcpy(&right, &aCell[aaSorted[ii][nCell-1]], sizeof(RtreeCell));
      for(kk=1; kk<(nCell-1); kk++){
        if( kk<nLeft ){
          cellUnion(pRtree, &left, &aCell[aaSorted[ii][kk]]);
        }else{
          cellUnion(pRtree, &right, &aCell[aaSorted[ii][kk]]);
        }
      }
      margin += cellMargin(pRtree, &left);
      margin += cellMargin(pRtree, &right);
      overlap = cellOverlap(pRtree, &left, &right, 1, -1);
      area = cellArea(pRtree, &left) + cellArea(pRtree, &right);
      if( (nLeft==RTREE_MINCELLS(pRtree))
       || (overlap<fBestOverlap)
       || (overlap==fBestOverlap && area<fBestArea)
      ){
        iBestLeft = nLeft;
        fBestOverlap = overlap;
        fBestArea = area;
      }
    }

    if( ii==0 || margin<fBestMargin ){
      iBestDim = ii;
      fBestMargin = margin;
      iBestSplit = iBestLeft;
    }
  }

  memcpy(pBboxLeft, &aCell[aaSorted[iBestDim][0]], sizeof(RtreeCell));
  memcpy(pBboxRight, &aCell[aaSorted[iBestDim][iBestSplit]], sizeof(RtreeCell));
  for(ii=0; ii<nCell; ii++){
    RtreeNode *pTarget = (ii<iBestSplit)?pLeft:pRight;
    RtreeCell *pBbox = (ii<iBestSplit)?pBboxLeft:pBboxRight;
    RtreeCell *pCell = &aCell[aaSorted[iBestDim][ii]];
    nodeInsertCell(pRtree, pTarget, pCell);
    cellUnion(pRtree, pBbox, pCell);
  }

  sqlite3_free(aaSorted);
  return SQLITE_OK;
}
#endif

#if VARIANT_GUTTMAN_SPLIT
/*
** Implementation of the regular R-tree SplitNode from Guttman[1984].
*/
static int splitNodeGuttman(
  Rtree *pRtree,
  RtreeCell *aCell,
  int nCell,
  RtreeNode *pLeft,
  RtreeNode *pRight,
  RtreeCell *pBboxLeft,
  RtreeCell *pBboxRight
){
  int iLeftSeed = 0;
  int iRightSeed = 1;
  int *aiUsed;
  int i;

  aiUsed = sqlite3_malloc(sizeof(int)*nCell);
  memset(aiUsed, 0, sizeof(int)*nCell);

  PickSeeds(pRtree, aCell, nCell, &iLeftSeed, &iRightSeed);

  memcpy(pBboxLeft, &aCell[iLeftSeed], sizeof(RtreeCell));
  memcpy(pBboxRight, &aCell[iRightSeed], sizeof(RtreeCell));
  nodeInsertCell(pRtree, pLeft, &aCell[iLeftSeed]);
  nodeInsertCell(pRtree, pRight, &aCell[iRightSeed]);
  aiUsed[iLeftSeed] = 1;
  aiUsed[iRightSeed] = 1;

  for(i=nCell-2; i>0; i--){
    RtreeCell *pNext;
    pNext = PickNext(pRtree, aCell, nCell, pBboxLeft, pBboxRight, aiUsed);
    float diff =  
      cellGrowth(pRtree, pBboxLeft, pNext) - 
      cellGrowth(pRtree, pBboxRight, pNext)
    ;
    if( (RTREE_MINCELLS(pRtree)-NCELL(pRight)==i)
     || (diff>0.0 && (RTREE_MINCELLS(pRtree)-NCELL(pLeft)!=i))
    ){
      nodeInsertCell(pRtree, pRight, pNext);
      cellUnion(pRtree, pBboxRight, pNext);
    }else{
      nodeInsertCell(pRtree, pLeft, pNext);
      cellUnion(pRtree, pBboxLeft, pNext);
    }
  }

  sqlite3_free(aiUsed);
  return SQLITE_OK;
}
#endif

static int updateMapping(
  Rtree *pRtree, 
  i64 iRowid, 
  RtreeNode *pNode, 
  int iHeight
){
  int (*xSetMapping)(Rtree *, sqlite3_int64, sqlite3_int64);
  xSetMapping = ((iHeight==0)?rowidWrite:parentWrite);
  if( iHeight>0 ){
    RtreeNode *pChild = nodeHashLookup(pRtree, iRowid);
    if( pChild ){
      nodeRelease(pRtree, pChild->pParent);
      nodeReference(pNode);
      pChild->pParent = pNode;
    }
  }
  return xSetMapping(pRtree, iRowid, pNode->iNode);
}

static int SplitNode(
  Rtree *pRtree,
  RtreeNode *pNode,
  RtreeCell *pCell,
  int iHeight
){
  int i;
  int newCellIsRight = 0;

  int rc = SQLITE_OK;
  int nCell = NCELL(pNode);
  RtreeCell *aCell;
  int *aiUsed;

  RtreeNode *pLeft = 0;
  RtreeNode *pRight = 0;

  RtreeCell leftbbox;
  RtreeCell rightbbox;

  /* Allocate an array and populate it with a copy of pCell and 
  ** all cells from node pLeft. Then zero the original node.
  */
  aCell = sqlite3_malloc((sizeof(RtreeCell)+sizeof(int))*(nCell+1));
  if( !aCell ){
    rc = SQLITE_NOMEM;
    goto splitnode_out;
  }
  aiUsed = (int *)&aCell[nCell+1];
  memset(aiUsed, 0, sizeof(int)*(nCell+1));
  for(i=0; i<nCell; i++){
    nodeGetCell(pRtree, pNode, i, &aCell[i]);
  }
  nodeZero(pRtree, pNode);
  memcpy(&aCell[nCell], pCell, sizeof(RtreeCell));
  nCell++;

  if( pNode->iNode==1 ){
    pRight = nodeNew(pRtree, pNode, 1);
    pLeft = nodeNew(pRtree, pNode, 1);
    pRtree->iDepth++;
    pNode->isDirty = 1;
    writeInt16(pNode->zData, pRtree->iDepth);
  }else{
    pLeft = pNode;
    pRight = nodeNew(pRtree, pLeft->pParent, 1);
    nodeReference(pLeft);
  }

  if( !pLeft || !pRight ){
    rc = SQLITE_NOMEM;
    goto splitnode_out;
  }

  memset(pLeft->zData, 0, pRtree->iNodeSize);
  memset(pRight->zData, 0, pRtree->iNodeSize);

  rc = AssignCells(pRtree, aCell, nCell, pLeft, pRight, &leftbbox, &rightbbox);
  if( rc!=SQLITE_OK ){
    goto splitnode_out;
  }

  /* Ensure both child nodes have node numbers assigned to them. */
  if( (0==pRight->iNode && SQLITE_OK!=(rc = nodeWrite(pRtree, pRight)))
   || (0==pLeft->iNode && SQLITE_OK!=(rc = nodeWrite(pRtree, pLeft)))
  ){
    goto splitnode_out;
  }

  rightbbox.iRowid = pRight->iNode;
  leftbbox.iRowid = pLeft->iNode;

  if( pNode->iNode==1 ){
    rc = rtreeInsertCell(pRtree, pLeft->pParent, &leftbbox, iHeight+1);
    if( rc!=SQLITE_OK ){
      goto splitnode_out;
    }
  }else{
    RtreeNode *pParent = pLeft->pParent;
    int iCell = nodeParentIndex(pRtree, pLeft);
    nodeOverwriteCell(pRtree, pParent, &leftbbox, iCell);
    AdjustTree(pRtree, pParent, &leftbbox);
  }
  if( (rc = rtreeInsertCell(pRtree, pRight->pParent, &rightbbox, iHeight+1)) ){
    goto splitnode_out;
  }

  for(i=0; i<NCELL(pRight); i++){
    i64 iRowid = nodeGetRowid(pRtree, pRight, i);
    rc = updateMapping(pRtree, iRowid, pRight, iHeight);
    if( iRowid==pCell->iRowid ){
      newCellIsRight = 1;
    }
    if( rc!=SQLITE_OK ){
      goto splitnode_out;
    }
  }
  if( pNode->iNode==1 ){
    for(i=0; i<NCELL(pLeft); i++){
      i64 iRowid = nodeGetRowid(pRtree, pLeft, i);
      rc = updateMapping(pRtree, iRowid, pLeft, iHeight);
      if( rc!=SQLITE_OK ){
        goto splitnode_out;
      }
    }
  }else if( newCellIsRight==0 ){
    rc = updateMapping(pRtree, pCell->iRowid, pLeft, iHeight);
  }

  if( rc==SQLITE_OK ){
    rc = nodeRelease(pRtree, pRight);
    pRight = 0;
  }
  if( rc==SQLITE_OK ){
    rc = nodeRelease(pRtree, pLeft);
    pLeft = 0;
  }

splitnode_out:
  nodeRelease(pRtree, pRight);
  nodeRelease(pRtree, pLeft);
  sqlite3_free(aCell);
  return rc;
}

static int fixLeafParent(Rtree *pRtree, RtreeNode *pLeaf){
  int rc = SQLITE_OK;
  if( pLeaf->iNode!=1 && pLeaf->pParent==0 ){
    sqlite3_bind_int64(pRtree->pReadParent, 1, pLeaf->iNode);
    if( sqlite3_step(pRtree->pReadParent)==SQLITE_ROW ){
      i64 iNode = sqlite3_column_int64(pRtree->pReadParent, 0);
      rc = nodeAcquire(pRtree, iNode, 0, &pLeaf->pParent);
    }else{
      rc = SQLITE_ERROR;
    }
    sqlite3_reset(pRtree->pReadParent);
    if( rc==SQLITE_OK ){
      rc = fixLeafParent(pRtree, pLeaf->pParent);
    }
  }
  return rc;
}

static int deleteCell(Rtree *, RtreeNode *, int, int);

static int removeNode(Rtree *pRtree, RtreeNode *pNode, int iHeight){
  int rc;
  RtreeNode *pParent;
  int iCell;

  assert( pNode->nRef==1 );

  /* Remove the entry in the parent cell. */
  iCell = nodeParentIndex(pRtree, pNode);
  pParent = pNode->pParent;
  pNode->pParent = 0;
  if( SQLITE_OK!=(rc = deleteCell(pRtree, pParent, iCell, iHeight+1)) 
   || SQLITE_OK!=(rc = nodeRelease(pRtree, pParent))
  ){
    return rc;
  }

  /* Remove the xxx_node entry. */
  sqlite3_bind_int64(pRtree->pDeleteNode, 1, pNode->iNode);
  sqlite3_step(pRtree->pDeleteNode);
  if( SQLITE_OK!=(rc = sqlite3_reset(pRtree->pDeleteNode)) ){
    return rc;
  }

  /* Remove the xxx_parent entry. */
  sqlite3_bind_int64(pRtree->pDeleteParent, 1, pNode->iNode);
  sqlite3_step(pRtree->pDeleteParent);
  if( SQLITE_OK!=(rc = sqlite3_reset(pRtree->pDeleteParent)) ){
    return rc;
  }
  
  /* Remove the node from the in-memory hash table and link it into
  ** the Rtree.pDeleted list. Its contents will be re-inserted later on.
  */
  nodeHashDelete(pRtree, pNode);
  pNode->iNode = iHeight;
  pNode->pNext = pRtree->pDeleted;
  pNode->nRef++;
  pRtree->pDeleted = pNode;

  return SQLITE_OK;
}

static void fixBoundingBox(Rtree *pRtree, RtreeNode *pNode){
  RtreeNode *pParent = pNode->pParent;
  if( pParent ){
    int ii; 
    int nCell = NCELL(pNode);
    RtreeCell box;                            /* Bounding box for pNode */
    nodeGetCell(pRtree, pNode, 0, &box);
    for(ii=1; ii<nCell; ii++){
      RtreeCell cell;
      nodeGetCell(pRtree, pNode, ii, &cell);
      cellUnion(pRtree, &box, &cell);
    }
    box.iRowid = pNode->iNode;
    ii = nodeParentIndex(pRtree, pNode);
    nodeOverwriteCell(pRtree, pParent, &box, ii);
    fixBoundingBox(pRtree, pParent);
  }
}

/*
** Delete the cell at index iCell of node pNode. After removing the
** cell, adjust the r-tree data structure if required.
*/
static int deleteCell(Rtree *pRtree, RtreeNode *pNode, int iCell, int iHeight){
  int rc;

  if( SQLITE_OK!=(rc = fixLeafParent(pRtree, pNode)) ){
    return rc;
  }

  /* Remove the cell from the node. This call just moves bytes around
  ** the in-memory node image, so it cannot fail.
  */
  nodeDeleteCell(pRtree, pNode, iCell);

  /* If the node is not the tree root and now has less than the minimum
  ** number of cells, remove it from the tree. Otherwise, update the
  ** cell in the parent node so that it tightly contains the updated
  ** node.
  */
  if( pNode->iNode!=1 ){
    RtreeNode *pParent = pNode->pParent;
    if( (pParent->iNode!=1 || NCELL(pParent)!=1) 
     && (NCELL(pNode)<RTREE_MINCELLS(pRtree))
    ){
      rc = removeNode(pRtree, pNode, iHeight);
    }else{
      fixBoundingBox(pRtree, pNode);
    }
  }

  return rc;
}

static int Reinsert(
  Rtree *pRtree, 
  RtreeNode *pNode, 
  RtreeCell *pCell, 
  int iHeight
){
  int *aOrder;
  int *aSpare;
  RtreeCell *aCell;
  float *aDistance;
  int nCell;
  float aCenterCoord[RTREE_MAX_DIMENSIONS];
  int iDim;
  int ii;
  int rc = SQLITE_OK;

  memset(aCenterCoord, 0, sizeof(float)*RTREE_MAX_DIMENSIONS);

  nCell = NCELL(pNode)+1;

  /* Allocate the buffers used by this operation. The allocation is
  ** relinquished before this function returns.
  */
  aCell = (RtreeCell *)sqlite3_malloc(nCell * (
    sizeof(RtreeCell) +         /* aCell array */
    sizeof(int)       +         /* aOrder array */
    sizeof(int)       +         /* aSpare array */
    sizeof(float)               /* aDistance array */
  ));
  if( !aCell ){
    return SQLITE_NOMEM;
  }
  aOrder    = (int *)&aCell[nCell];
  aSpare    = (int *)&aOrder[nCell];
  aDistance = (float *)&aSpare[nCell];

  for(ii=0; ii<nCell; ii++){
    if( ii==(nCell-1) ){
      memcpy(&aCell[ii], pCell, sizeof(RtreeCell));
    }else{
      nodeGetCell(pRtree, pNode, ii, &aCell[ii]);
    }
    aOrder[ii] = ii;
    for(iDim=0; iDim<pRtree->nDim; iDim++){
      aCenterCoord[iDim] += DCOORD(aCell[ii].aCoord[iDim*2]);
      aCenterCoord[iDim] += DCOORD(aCell[ii].aCoord[iDim*2+1]);
    }
  }
  for(iDim=0; iDim<pRtree->nDim; iDim++){
    aCenterCoord[iDim] = aCenterCoord[iDim]/((float)nCell*2.0);
  }

  for(ii=0; ii<nCell; ii++){
    aDistance[ii] = 0.0;
    for(iDim=0; iDim<pRtree->nDim; iDim++){
      float coord = DCOORD(aCell[ii].aCoord[iDim*2+1]) - 
          DCOORD(aCell[ii].aCoord[iDim*2]);
      aDistance[ii] += (coord-aCenterCoord[iDim])*(coord-aCenterCoord[iDim]);
    }
  }

  SortByDistance(aOrder, nCell, aDistance, aSpare);
  nodeZero(pRtree, pNode);

  for(ii=0; rc==SQLITE_OK && ii<(nCell-(RTREE_MINCELLS(pRtree)+1)); ii++){
    RtreeCell *p = &aCell[aOrder[ii]];
    nodeInsertCell(pRtree, pNode, p);
    if( p->iRowid==pCell->iRowid ){
      if( iHeight==0 ){
        rc = rowidWrite(pRtree, p->iRowid, pNode->iNode);
      }else{
        rc = parentWrite(pRtree, p->iRowid, pNode->iNode);
      }
    }
  }
  if( rc==SQLITE_OK ){
    fixBoundingBox(pRtree, pNode);
  }
  for(; rc==SQLITE_OK && ii<nCell; ii++){
    /* Find a node to store this cell in. pNode->iNode currently contains
    ** the height of the sub-tree headed by the cell.
    */
    RtreeNode *pInsert;
    RtreeCell *p = &aCell[aOrder[ii]];
    rc = ChooseLeaf(pRtree, p, iHeight, &pInsert);
    if( rc==SQLITE_OK ){
      int rc2;
      rc = rtreeInsertCell(pRtree, pInsert, p, iHeight);
      rc2 = nodeRelease(pRtree, pInsert);
      if( rc==SQLITE_OK ){
        rc = rc2;
      }
    }
  }

  sqlite3_free(aCell);
  return rc;
}

/*
** Insert cell pCell into node pNode. Node pNode is the head of a 
** subtree iHeight high (leaf nodes have iHeight==0).
*/
static int rtreeInsertCell(
  Rtree *pRtree,
  RtreeNode *pNode,
  RtreeCell *pCell,
  int iHeight
){
  int rc = SQLITE_OK;
  if( iHeight>0 ){
    RtreeNode *pChild = nodeHashLookup(pRtree, pCell->iRowid);
    if( pChild ){
      nodeRelease(pRtree, pChild->pParent);
      nodeReference(pNode);
      pChild->pParent = pNode;
    }
  }
  if( nodeInsertCell(pRtree, pNode, pCell) ){
#if VARIANT_RSTARTREE_REINSERT
    if( iHeight<=pRtree->iReinsertHeight || pNode->iNode==1){
      rc = SplitNode(pRtree, pNode, pCell, iHeight);
    }else{
      pRtree->iReinsertHeight = iHeight;
      rc = Reinsert(pRtree, pNode, pCell, iHeight);
    }
#else
    rc = SplitNode(pRtree, pNode, pCell, iHeight);
#endif
  }else{
    AdjustTree(pRtree, pNode, pCell);
    if( iHeight==0 ){
      rc = rowidWrite(pRtree, pCell->iRowid, pNode->iNode);
    }else{
      rc = parentWrite(pRtree, pCell->iRowid, pNode->iNode);
    }
  }
  return rc;
}

static int reinsertNodeContent(Rtree *pRtree, RtreeNode *pNode){
  int ii;
  int rc = SQLITE_OK;
  int nCell = NCELL(pNode);

  for(ii=0; rc==SQLITE_OK && ii<nCell; ii++){
    RtreeNode *pInsert;
    RtreeCell cell;
    nodeGetCell(pRtree, pNode, ii, &cell);

    /* Find a node to store this cell in. pNode->iNode currently contains
    ** the height of the sub-tree headed by the cell.
    */
    rc = ChooseLeaf(pRtree, &cell, pNode->iNode, &pInsert);
    if( rc==SQLITE_OK ){
      int rc2;
      rc = rtreeInsertCell(pRtree, pInsert, &cell, pNode->iNode);
      rc2 = nodeRelease(pRtree, pInsert);
      if( rc==SQLITE_OK ){
        rc = rc2;
      }
    }
  }
  return rc;
}

/*
** Select a currently unused rowid for a new r-tree record.
*/
static int newRowid(Rtree *pRtree, i64 *piRowid){
  int rc;
  sqlite3_bind_null(pRtree->pWriteRowid, 1);
  sqlite3_bind_null(pRtree->pWriteRowid, 2);
  sqlite3_step(pRtree->pWriteRowid);
  rc = sqlite3_reset(pRtree->pWriteRowid);
  *piRowid = sqlite3_last_insert_rowid(pRtree->db);
  return rc;
}

#ifndef NDEBUG
static int hashIsEmpty(Rtree *pRtree){
  int ii;
  for(ii=0; ii<HASHSIZE; ii++){
    assert( !pRtree->aHash[ii] );
  }
  return 1;
}
#endif

/*
** The xUpdate method for rtree module virtual tables.
*/
int rtreeUpdate(
  sqlite3_vtab *pVtab, 
  int nData, 
  sqlite3_value **azData, 
  sqlite_int64 *pRowid
){
  Rtree *pRtree = (Rtree *)pVtab;
  int rc = SQLITE_OK;

  rtreeReference(pRtree);

  assert(nData>=1);
  assert(hashIsEmpty(pRtree));

  /* If azData[0] is not an SQL NULL value, it is the rowid of a
  ** record to delete from the r-tree table. The following block does
  ** just that.
  */
  if( sqlite3_value_type(azData[0])!=SQLITE_NULL ){
    i64 iDelete;                /* The rowid to delete */
    RtreeNode *pLeaf;           /* Leaf node containing record iDelete */
    int iCell;                  /* Index of iDelete cell in pLeaf */
    RtreeNode *pRoot;

    /* Obtain a reference to the root node to initialise Rtree.iDepth */
    rc = nodeAcquire(pRtree, 1, 0, &pRoot);

    /* Obtain a reference to the leaf node that contains the entry 
    ** about to be deleted. 
    */
    if( rc==SQLITE_OK ){
      iDelete = sqlite3_value_int64(azData[0]);
      rc = findLeafNode(pRtree, iDelete, &pLeaf);
    }

    /* Delete the cell in question from the leaf node. */
    if( rc==SQLITE_OK ){
      int rc2;
      iCell = nodeRowidIndex(pRtree, pLeaf, iDelete);
      rc = deleteCell(pRtree, pLeaf, iCell, 0);
      rc2 = nodeRelease(pRtree, pLeaf);
      if( rc==SQLITE_OK ){
        rc = rc2;
      }
    }

    /* Delete the corresponding entry in the <rtree>_rowid table. */
    if( rc==SQLITE_OK ){
      sqlite3_bind_int64(pRtree->pDeleteRowid, 1, iDelete);
      sqlite3_step(pRtree->pDeleteRowid);
      rc = sqlite3_reset(pRtree->pDeleteRowid);
    }

    /* Check if the root node now has exactly one child. If so, remove
    ** it, schedule the contents of the child for reinsertion and 
    ** reduce the tree height by one.
    **
    ** This is equivalent to copying the contents of the child into
    ** the root node (the operation that Gutman's paper says to perform 
    ** in this scenario).
    */
    if( rc==SQLITE_OK && pRtree->iDepth>0 ){
      if( rc==SQLITE_OK && NCELL(pRoot)==1 ){
        RtreeNode *pChild;
        i64 iChild = nodeGetRowid(pRtree, pRoot, 0);
        rc = nodeAcquire(pRtree, iChild, pRoot, &pChild);
        if( rc==SQLITE_OK ){
          rc = removeNode(pRtree, pChild, pRtree->iDepth-1);
        }
        if( rc==SQLITE_OK ){
          pRtree->iDepth--;
          writeInt16(pRoot->zData, pRtree->iDepth);
          pRoot->isDirty = 1;
        }
      }
    }

    /* Re-insert the contents of any underfull nodes removed from the tree. */
    for(pLeaf=pRtree->pDeleted; pLeaf; pLeaf=pRtree->pDeleted){
      if( rc==SQLITE_OK ){
        rc = reinsertNodeContent(pRtree, pLeaf);
      }
      pRtree->pDeleted = pLeaf->pNext;
      sqlite3_free(pLeaf);
    }

    /* Release the reference to the root node. */
    if( rc==SQLITE_OK ){
      rc = nodeRelease(pRtree, pRoot);
    }else{
      nodeRelease(pRtree, pRoot);
    }
  }

  /* If the azData[] array contains more than one element, elements
  ** (azData[2]..azData[argc-1]) contain a new record to insert into
  ** the r-tree structure.
  */
  if( rc==SQLITE_OK && nData>1 ){
    /* Insert a new record into the r-tree */
    RtreeCell cell;
    int ii;
    RtreeNode *pLeaf;

    /* Populate the cell.aCoord[] array. The first coordinate is azData[3]. */
    assert( nData==(pRtree->nDim*2 + 3) );
    if( pRtree->eCoordType==RTREE_COORD_REAL32 ){
      for(ii=0; ii<(pRtree->nDim*2); ii+=2){
        cell.aCoord[ii].f = (float)sqlite3_value_double(azData[ii+3]);
        cell.aCoord[ii+1].f = (float)sqlite3_value_double(azData[ii+4]);
        if( cell.aCoord[ii].f>cell.aCoord[ii+1].f ){
          rc = SQLITE_CONSTRAINT;
          goto constraint;
        }
      }
    }else{
      for(ii=0; ii<(pRtree->nDim*2); ii+=2){
        cell.aCoord[ii].i = sqlite3_value_int(azData[ii+3]);
        cell.aCoord[ii+1].i = sqlite3_value_int(azData[ii+4]);
        if( cell.aCoord[ii].i>cell.aCoord[ii+1].i ){
          rc = SQLITE_CONSTRAINT;
          goto constraint;
        }
      }
    }

    /* Figure out the rowid of the new row. */
    if( sqlite3_value_type(azData[2])==SQLITE_NULL ){
      rc = newRowid(pRtree, &cell.iRowid);
    }else{
      cell.iRowid = sqlite3_value_int64(azData[2]);
      sqlite3_bind_int64(pRtree->pReadRowid, 1, cell.iRowid);
      if( SQLITE_ROW==sqlite3_step(pRtree->pReadRowid) ){
        sqlite3_reset(pRtree->pReadRowid);
        rc = SQLITE_CONSTRAINT;
        goto constraint;
      }
      rc = sqlite3_reset(pRtree->pReadRowid);
    }

    if( rc==SQLITE_OK ){
      rc = ChooseLeaf(pRtree, &cell, 0, &pLeaf);
    }
    if( rc==SQLITE_OK ){
      int rc2;
      pRtree->iReinsertHeight = -1;
      rc = rtreeInsertCell(pRtree, pLeaf, &cell, 0);
      rc2 = nodeRelease(pRtree, pLeaf);
      if( rc==SQLITE_OK ){
        rc = rc2;
      }
    }
  }

constraint:
  rtreeRelease(pRtree);
  return rc;
}

/*
** The xRename method for rtree module virtual tables.
*/
static int rtreeRename(sqlite3_vtab *pVtab, const char *zNewName){
  Rtree *pRtree = (Rtree *)pVtab;
  int rc = SQLITE_NOMEM;
  char *zSql = sqlite3_mprintf(
    "ALTER TABLE %Q.'%q_node'   RENAME TO \"%w_node\";"
    "ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";"
    "ALTER TABLE %Q.'%q_rowid'  RENAME TO \"%w_rowid\";"
    , pRtree->zDb, pRtree->zName, zNewName 
    , pRtree->zDb, pRtree->zName, zNewName 
    , pRtree->zDb, pRtree->zName, zNewName
  );
  if( zSql ){
    rc = sqlite3_exec(pRtree->db, zSql, 0, 0, 0);
    sqlite3_free(zSql);
  }
  return rc;
}

static sqlite3_module rtreeModule = {
  0,                         /* iVersion */
  rtreeCreate,                /* xCreate - create a table */
  rtreeConnect,               /* xConnect - connect to an existing table */
  rtreeBestIndex,             /* xBestIndex - Determine search strategy */
  rtreeDisconnect,            /* xDisconnect - Disconnect from a table */
  rtreeDestroy,               /* xDestroy - Drop a table */
  rtreeOpen,                  /* xOpen - open a cursor */
  rtreeClose,                 /* xClose - close a cursor */
  rtreeFilter,                /* xFilter - configure scan constraints */
  rtreeNext,                  /* xNext - advance a cursor */
  rtreeEof,                   /* xEof */
  rtreeColumn,                /* xColumn - read data */
  rtreeRowid,                 /* xRowid - read data */
  rtreeUpdate,                /* xUpdate - write data */
  0,                          /* xBegin - begin transaction */
  0,                          /* xSync - sync transaction */
  0,                          /* xCommit - commit transaction */
  0,                          /* xRollback - rollback transaction */
  0,                          /* xFindFunction - function overloading */
  rtreeRename                 /* xRename - rename the table */
};

static int rtreeSqlInit(
  Rtree *pRtree, 
  sqlite3 *db, 
  const char *zDb, 
  const char *zPrefix, 
  int isCreate
){
  int rc = SQLITE_OK;

  #define N_STATEMENT 9
  static const char *azSql[N_STATEMENT] = {
    /* Read and write the xxx_node table */
    "SELECT data FROM '%q'.'%q_node' WHERE nodeno = :1",
    "INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(:1, :2)",
    "DELETE FROM '%q'.'%q_node' WHERE nodeno = :1",

    /* Read and write the xxx_rowid table */
    "SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = :1",
    "INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(:1, :2)",
    "DELETE FROM '%q'.'%q_rowid' WHERE rowid = :1",

    /* Read and write the xxx_parent table */
    "SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = :1",
    "INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(:1, :2)",
    "DELETE FROM '%q'.'%q_parent' WHERE nodeno = :1"
  };
  sqlite3_stmt **appStmt[N_STATEMENT];
  int i;

  pRtree->db = db;

  if( isCreate ){
    char *zCreate = sqlite3_mprintf(
"CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY, data BLOB);"
"CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY, nodeno INTEGER);"
"CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY, parentnode INTEGER);"
"INSERT INTO '%q'.'%q_node' VALUES(1, zeroblob(%d))",
      zDb, zPrefix, zDb, zPrefix, zDb, zPrefix, zDb, zPrefix, pRtree->iNodeSize
    );
    if( !zCreate ){
      return SQLITE_NOMEM;
    }
    rc = sqlite3_exec(db, zCreate, 0, 0, 0);
    sqlite3_free(zCreate);
    if( rc!=SQLITE_OK ){
      return rc;
    }
  }

  appStmt[0] = &pRtree->pReadNode;
  appStmt[1] = &pRtree->pWriteNode;
  appStmt[2] = &pRtree->pDeleteNode;
  appStmt[3] = &pRtree->pReadRowid;
  appStmt[4] = &pRtree->pWriteRowid;
  appStmt[5] = &pRtree->pDeleteRowid;
  appStmt[6] = &pRtree->pReadParent;
  appStmt[7] = &pRtree->pWriteParent;
  appStmt[8] = &pRtree->pDeleteParent;

  for(i=0; i<N_STATEMENT && rc==SQLITE_OK; i++){
    char *zSql = sqlite3_mprintf(azSql[i], zDb, zPrefix);
    if( zSql ){
      rc = sqlite3_prepare_v2(db, zSql, -1, appStmt[i], 0); 
    }else{
      rc = SQLITE_NOMEM;
    }
    sqlite3_free(zSql);
  }

  return rc;
}

/*
** This routine queries database handle db for the page-size used by
** database zDb. If successful, the page-size in bytes is written to
** *piPageSize and SQLITE_OK returned. Otherwise, and an SQLite error 
** code is returned.
*/
static int getPageSize(sqlite3 *db, const char *zDb, int *piPageSize){
  int rc = SQLITE_NOMEM;
  char *zSql;
  sqlite3_stmt *pStmt = 0;

  zSql = sqlite3_mprintf("PRAGMA %Q.page_size", zDb);
  if( !zSql ){
    return SQLITE_NOMEM;
  }

  rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
  sqlite3_free(zSql);
  if( rc!=SQLITE_OK ){
    return rc;
  }

  if( SQLITE_ROW==sqlite3_step(pStmt) ){
    *piPageSize = sqlite3_column_int(pStmt, 0);
  }
  return sqlite3_finalize(pStmt);
}

/* 
** This function is the implementation of both the xConnect and xCreate
** methods of the r-tree virtual table.
**
**   argv[0]   -> module name
**   argv[1]   -> database name
**   argv[2]   -> table name
**   argv[...] -> column names...
*/
static int rtreeInit(
  sqlite3 *db,                        /* Database connection */
  void *pAux,                         /* Pointer to head of rtree list */
  int argc, const char *const*argv,   /* Parameters to CREATE TABLE statement */
  sqlite3_vtab **ppVtab,              /* OUT: New virtual table */
  char **pzErr,                       /* OUT: Error message, if any */
  int isCreate,                       /* True for xCreate, false for xConnect */
  int eCoordType                      /* One of the RTREE_COORD_* constants */
){
  int rc = SQLITE_OK;
  int iPageSize = 0;
  Rtree *pRtree;
  int nDb;              /* Length of string argv[1] */
  int nName;            /* Length of string argv[2] */

  const char *aErrMsg[] = {
    0,                                                    /* 0 */
    "Wrong number of columns for an rtree table",         /* 1 */
    "Too few columns for an rtree table",                 /* 2 */
    "Too many columns for an rtree table"                 /* 3 */
  };

  int iErr = (argc<6) ? 2 : argc>(RTREE_MAX_DIMENSIONS*2+4) ? 3 : argc%2;
  if( aErrMsg[iErr] ){
    *pzErr = sqlite3_mprintf("%s", aErrMsg[iErr]);
    return SQLITE_ERROR;
  }

  rc = getPageSize(db, argv[1], &iPageSize);
  if( rc!=SQLITE_OK ){
    return rc;
  }

  /* Allocate the sqlite3_vtab structure */
  nDb = strlen(argv[1]);
  nName = strlen(argv[2]);
  pRtree = (Rtree *)sqlite3_malloc(sizeof(Rtree)+nDb+nName+2);
  if( !pRtree ){
    return SQLITE_NOMEM;
  }
  memset(pRtree, 0, sizeof(Rtree)+nDb+nName+2);
  pRtree->nBusy = 1;
  pRtree->base.pModule = &rtreeModule;
  pRtree->zDb = (char *)&pRtree[1];
  pRtree->zName = &pRtree->zDb[nDb+1];
  pRtree->nDim = (argc-4)/2;
  pRtree->nBytesPerCell = 8 + pRtree->nDim*4*2;
  pRtree->eCoordType = eCoordType;
  memcpy(pRtree->zDb, argv[1], nDb);
  memcpy(pRtree->zName, argv[2], nName);

  /* Figure out the node size to use. By default, use 64 bytes less than
  ** the database page-size. This ensures that each node is stored on
  ** a single database page.
  **
  ** If the databasd page-size is so large that more than RTREE_MAXCELLS
  ** entries would fit in a single node, use a smaller node-size.
  */
  pRtree->iNodeSize = iPageSize-64;
  if( (4+pRtree->nBytesPerCell*RTREE_MAXCELLS)<pRtree->iNodeSize ){
    pRtree->iNodeSize = 4+pRtree->nBytesPerCell*RTREE_MAXCELLS;
  }

  /* Create/Connect to the underlying relational database schema. If
  ** that is successful, call sqlite3_declare_vtab() to configure
  ** the r-tree table schema.
  */
  if( (rc = rtreeSqlInit(pRtree, db, argv[1], argv[2], isCreate)) ){
    *pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db));
  }else{
    char *zSql = sqlite3_mprintf("CREATE TABLE x(%s", argv[3]);
    char *zTmp;
    int ii;
    for(ii=4; zSql && ii<argc; ii++){
      zTmp = zSql;
      zSql = sqlite3_mprintf("%s, %s", zTmp, argv[ii]);
      sqlite3_free(zTmp);
    }
    if( zSql ){
      zTmp = zSql;
      zSql = sqlite3_mprintf("%s);", zTmp);
      sqlite3_free(zTmp);
    }
    if( !zSql || sqlite3_declare_vtab(db, zSql) ){
      rc = SQLITE_NOMEM;
    }
    sqlite3_free(zSql);
  }

  if( rc==SQLITE_OK ){
    *ppVtab = (sqlite3_vtab *)pRtree;
  }else{
    rtreeRelease(pRtree);
  }
  return rc;
}


/*
** Implementation of a scalar function that decodes r-tree nodes to
** human readable strings. This can be used for debugging and analysis.
**
** The scalar function takes two arguments, a blob of data containing
** an r-tree node, and the number of dimensions the r-tree indexes.
** For a two-dimensional r-tree structure called "rt", to deserialize
** all nodes, a statement like:
**
**   SELECT rtreenode(2, data) FROM rt_node;
**
** The human readable string takes the form of a Tcl list with one
** entry for each cell in the r-tree node. Each entry is itself a
** list, containing the 8-byte rowid/pageno followed by the 
** <num-dimension>*2 coordinates.
*/
static void rtreenode(sqlite3_context *ctx, int nArg, sqlite3_value **apArg){
  char *zText = 0;
  RtreeNode node;
  Rtree tree;
  int ii;

  memset(&node, 0, sizeof(RtreeNode));
  memset(&tree, 0, sizeof(Rtree));
  tree.nDim = sqlite3_value_int(apArg[0]);
  tree.nBytesPerCell = 8 + 8 * tree.nDim;
  node.zData = (u8 *)sqlite3_value_blob(apArg[1]);

  for(ii=0; ii<NCELL(&node); ii++){
    char zCell[512];
    int nCell = 0;
    RtreeCell cell;
    int jj;

    nodeGetCell(&tree, &node, ii, &cell);
    sqlite3_snprintf(512-nCell,&zCell[nCell],"%d", cell.iRowid);
    nCell = strlen(zCell);
    for(jj=0; jj<tree.nDim*2; jj++){
      sqlite3_snprintf(512-nCell,&zCell[nCell]," %f",(double)cell.aCoord[jj].f);
      nCell = strlen(zCell);
    }

    if( zText ){
      char *zTextNew = sqlite3_mprintf("%s {%s}", zText, zCell);
      sqlite3_free(zText);
      zText = zTextNew;
    }else{
      zText = sqlite3_mprintf("{%s}", zCell);
    }
  }
  
  sqlite3_result_text(ctx, zText, -1, sqlite3_free);
}

static void rtreedepth(sqlite3_context *ctx, int nArg, sqlite3_value **apArg){
  if( sqlite3_value_type(apArg[0])!=SQLITE_BLOB 
   || sqlite3_value_bytes(apArg[0])<2
  ){
    sqlite3_result_error(ctx, "Invalid argument to rtreedepth()", -1); 
  }else{
    u8 *zBlob = (u8 *)sqlite3_value_blob(apArg[0]);
    sqlite3_result_int(ctx, readInt16(zBlob));
  }
}

/*
** Register the r-tree module with database handle db. This creates the
** virtual table module "rtree" and the debugging/analysis scalar 
** function "rtreenode".
*/
int sqlite3RtreeInit(sqlite3 *db){
  int rc = SQLITE_OK;

  if( rc==SQLITE_OK ){
    int utf8 = SQLITE_UTF8;
    rc = sqlite3_create_function(db, "rtreenode", 2, utf8, 0, rtreenode, 0, 0);
  }
  if( rc==SQLITE_OK ){
    int utf8 = SQLITE_UTF8;
    rc = sqlite3_create_function(db, "rtreedepth", 1, utf8, 0,rtreedepth, 0, 0);
  }
  if( rc==SQLITE_OK ){
    void *c = (void *)RTREE_COORD_REAL32;
    rc = sqlite3_create_module_v2(db, "rtree", &rtreeModule, c, 0);
  }
  if( rc==SQLITE_OK ){
    void *c = (void *)RTREE_COORD_INT32;
    rc = sqlite3_create_module_v2(db, "rtree_i32", &rtreeModule, c, 0);
  }

  return rc;
}

#if !SQLITE_CORE
int sqlite3_extension_init(
  sqlite3 *db,
  char **pzErrMsg,
  const sqlite3_api_routines *pApi
){
  SQLITE_EXTENSION_INIT2(pApi)
  return sqlite3RtreeInit(db);
}
#endif

#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/rtree.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
** 2008 May 26
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This header file is used by programs that want to link against the
** RTREE library.  All it does is declare the sqlite3RtreeInit() interface.
*/
#include "sqlite3.h"

#ifdef __cplusplus
extern "C" {
#endif  /* __cplusplus */

int sqlite3RtreeInit(sqlite3 *db);

#ifdef __cplusplus
}  /* extern "C" */
#endif  /* __cplusplus */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































Deleted SQLite.Interop/splitsource/select.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: select.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "sqliteInt.h"


/*
** Delete all the content of a Select structure but do not deallocate
** the select structure itself.
*/
static void clearSelect(sqlite3 *db, Select *p){
  sqlite3ExprListDelete(db, p->pEList);
  sqlite3SrcListDelete(db, p->pSrc);
  sqlite3ExprDelete(db, p->pWhere);
  sqlite3ExprListDelete(db, p->pGroupBy);
  sqlite3ExprDelete(db, p->pHaving);
  sqlite3ExprListDelete(db, p->pOrderBy);
  sqlite3SelectDelete(db, p->pPrior);
  sqlite3ExprDelete(db, p->pLimit);
  sqlite3ExprDelete(db, p->pOffset);
}

/*
** Initialize a SelectDest structure.
*/
void sqlite3SelectDestInit(SelectDest *pDest, int eDest, int iParm){
  pDest->eDest = eDest;
  pDest->iParm = iParm;
  pDest->affinity = 0;
  pDest->iMem = 0;
  pDest->nMem = 0;
}


/*
** Allocate a new Select structure and return a pointer to that
** structure.
*/
Select *sqlite3SelectNew(
  Parse *pParse,        /* Parsing context */
  ExprList *pEList,     /* which columns to include in the result */
  SrcList *pSrc,        /* the FROM clause -- which tables to scan */
  Expr *pWhere,         /* the WHERE clause */
  ExprList *pGroupBy,   /* the GROUP BY clause */
  Expr *pHaving,        /* the HAVING clause */
  ExprList *pOrderBy,   /* the ORDER BY clause */
  int isDistinct,       /* true if the DISTINCT keyword is present */
  Expr *pLimit,         /* LIMIT value.  NULL means not used */
  Expr *pOffset         /* OFFSET value.  NULL means no offset */
){
  Select *pNew;
  Select standin;
  sqlite3 *db = pParse->db;
  pNew = sqlite3DbMallocZero(db, sizeof(*pNew) );
  assert( !pOffset || pLimit );   /* Can't have OFFSET without LIMIT. */
  if( pNew==0 ){
    pNew = &standin;
    memset(pNew, 0, sizeof(*pNew));
  }
  if( pEList==0 ){
    pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db,TK_ALL,0,0,0), 0);
  }
  pNew->pEList = pEList;
  pNew->pSrc = pSrc;
  pNew->pWhere = pWhere;
  pNew->pGroupBy = pGroupBy;
  pNew->pHaving = pHaving;
  pNew->pOrderBy = pOrderBy;
  pNew->isDistinct = isDistinct;
  pNew->op = TK_SELECT;
  assert( pOffset==0 || pLimit!=0 );
  pNew->pLimit = pLimit;
  pNew->pOffset = pOffset;
  pNew->addrOpenEphm[0] = -1;
  pNew->addrOpenEphm[1] = -1;
  pNew->addrOpenEphm[2] = -1;
  if( pNew==&standin) {
    clearSelect(db, pNew);
    pNew = 0;
  }
  return pNew;
}

/*
** Delete the given Select structure and all of its substructures.
*/
void sqlite3SelectDelete(sqlite3 *db, Select *p){
  if( p ){
    clearSelect(db, p);
    sqlite3DbFree(db, p);
  }
}

/*
** Given 1 to 3 identifiers preceeding the JOIN keyword, determine the
** type of join.  Return an integer constant that expresses that type
** in terms of the following bit values:
**
**     JT_INNER
**     JT_CROSS
**     JT_OUTER
**     JT_NATURAL
**     JT_LEFT
**     JT_RIGHT
**
** A full outer join is the combination of JT_LEFT and JT_RIGHT.
**
** If an illegal or unsupported join type is seen, then still return
** a join type, but put an error in the pParse structure.
*/
int sqlite3JoinType(Parse *pParse, Token *pA, Token *pB, Token *pC){
  int jointype = 0;
  Token *apAll[3];
  Token *p;
  static const struct {
    const char zKeyword[8];
    u8 nChar;
    u8 code;
  } keywords[] = {
    { "natural", 7, JT_NATURAL },
    { "left",    4, JT_LEFT|JT_OUTER },
    { "right",   5, JT_RIGHT|JT_OUTER },
    { "full",    4, JT_LEFT|JT_RIGHT|JT_OUTER },
    { "outer",   5, JT_OUTER },
    { "inner",   5, JT_INNER },
    { "cross",   5, JT_INNER|JT_CROSS },
  };
  int i, j;
  apAll[0] = pA;
  apAll[1] = pB;
  apAll[2] = pC;
  for(i=0; i<3 && apAll[i]; i++){
    p = apAll[i];
    for(j=0; j<sizeof(keywords)/sizeof(keywords[0]); j++){
      if( p->n==keywords[j].nChar 
          && sqlite3StrNICmp((char*)p->z, keywords[j].zKeyword, p->n)==0 ){
        jointype |= keywords[j].code;
        break;
      }
    }
    if( j>=sizeof(keywords)/sizeof(keywords[0]) ){
      jointype |= JT_ERROR;
      break;
    }
  }
  if(
     (jointype & (JT_INNER|JT_OUTER))==(JT_INNER|JT_OUTER) ||
     (jointype & JT_ERROR)!=0
  ){
    const char *zSp = " ";
    assert( pB!=0 );
    if( pC==0 ){ zSp++; }
    sqlite3ErrorMsg(pParse, "unknown or unsupported join type: "
       "%T %T%s%T", pA, pB, zSp, pC);
    jointype = JT_INNER;
  }else if( jointype & JT_RIGHT ){
    sqlite3ErrorMsg(pParse, 
      "RIGHT and FULL OUTER JOINs are not currently supported");
    jointype = JT_INNER;
  }
  return jointype;
}

/*
** Return the index of a column in a table.  Return -1 if the column
** is not contained in the table.
*/
static int columnIndex(Table *pTab, const char *zCol){
  int i;
  for(i=0; i<pTab->nCol; i++){
    if( sqlite3StrICmp(pTab->aCol[i].zName, zCol)==0 ) return i;
  }
  return -1;
}

/*
** Set the value of a token to a '\000'-terminated string.
*/
static void setToken(Token *p, const char *z){
  p->z = (u8*)z;
  p->n = z ? strlen(z) : 0;
  p->dyn = 0;
}

/*
** Set the token to the double-quoted and escaped version of the string pointed
** to by z. For example;
**
**    {a"bc}  ->  {"a""bc"}
*/
static void setQuotedToken(Parse *pParse, Token *p, const char *z){

  /* Check if the string contains any " characters. If it does, then
  ** this function will malloc space to create a quoted version of
  ** the string in. Otherwise, save a call to sqlite3MPrintf() by
  ** just copying the pointer to the string.
  */
  const char *z2 = z;
  while( *z2 ){
    if( *z2=='"' ) break;
    z2++;
  }

  if( *z2 ){
    /* String contains " characters - copy and quote the string. */
    p->z = (u8 *)sqlite3MPrintf(pParse->db, "\"%w\"", z);
    if( p->z ){
      p->n = strlen((char *)p->z);
      p->dyn = 1;
    }
  }else{
    /* String contains no " characters - copy the pointer. */
    p->z = (u8*)z;
    p->n = (z2 - z);
    p->dyn = 0;
  }
}

/*
** Create an expression node for an identifier with the name of zName
*/
Expr *sqlite3CreateIdExpr(Parse *pParse, const char *zName){
  Token dummy;
  setToken(&dummy, zName);
  return sqlite3PExpr(pParse, TK_ID, 0, 0, &dummy);
}

/*
** 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);
    pE->iRightJoinTable = 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.
**
** The EP_FromJoin property is used on terms of an expression to tell
** the LEFT OUTER JOIN processing logic that this term is part of the
** join restriction specified in the ON or USING clause and not a part
** of the more general WHERE clause.  These terms are moved over to the
** WHERE clause during join processing but we need to remember that they
** originated in the ON or USING clause.
**
** The Expr.iRightJoinTable tells the WHERE clause processing that the
** expression depends on table iRightJoinTable even if that table is not
** explicitly mentioned in the expression.  That information is needed
** for cases like this:
**
**    SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.b AND t1.x=5
**
** The where clause needs to defer the handling of the t1.x=5
** term until after the t2 loop of the join.  In that way, a
** NULL t2 row will be inserted whenever t1.x!=5.  If we do not
** defer the handling of t1.x=5, it will be processed immediately
** after the t1 loop and rows with t1.x!=5 will never appear in
** the output, which is incorrect.
*/
static void setJoinExpr(Expr *p, int iTable){
  while( p ){
    ExprSetProperty(p, EP_FromJoin);
    p->iRightJoinTable = iTable;
    setJoinExpr(p->pLeft, iTable);
    p = p->pRight;
  } 
}

/*
** This routine processes the join information for a SELECT statement.
** ON and USING clauses are converted into extra terms of the WHERE clause.
** NATURAL joins also create extra WHERE clause terms.
**
** The terms of a FROM clause are contained in the Select.pSrc structure.
** The left most table is the first entry in Select.pSrc.  The right-most
** table is the last entry.  The join operator is held in the entry to
** the left.  Thus entry 0 contains the join operator for the join between
** entries 0 and 1.  Any ON or USING clauses associated with the join are
** also attached to the left entry.
**
** This routine returns the number of errors encountered.
*/
static int sqliteProcessJoin(Parse *pParse, Select *p){
  SrcList *pSrc;                  /* All tables in the FROM clause */
  int i, j;                       /* Loop counters */
  struct SrcList_item *pLeft;     /* Left table being joined */
  struct SrcList_item *pRight;    /* Right table being joined */

  pSrc = p->pSrc;
  pLeft = &pSrc->a[0];
  pRight = &pLeft[1];
  for(i=0; i<pSrc->nSrc-1; i++, pRight++, pLeft++){
    Table *pLeftTab = pLeft->pTab;
    Table *pRightTab = pRight->pTab;
    int isOuter;

    if( pLeftTab==0 || pRightTab==0 ) continue;
    isOuter = (pRight->jointype & JT_OUTER)!=0;

    /* When the NATURAL keyword is present, add WHERE clause terms for
    ** every column that the two tables have in common.
    */
    if( pRight->jointype & JT_NATURAL ){
      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 ){
      sqlite3ErrorMsg(pParse, "cannot have both ON and USING "
        "clauses in the same join");
      return 1;
    }

    /* Add the ON clause to the end of the WHERE clause, connected by
    ** an AND operator.
    */
    if( pRight->pOn ){
      if( isOuter ) setJoinExpr(pRight->pOn, pRight->iCursor);
      p->pWhere = sqlite3ExprAnd(pParse->db, p->pWhere, pRight->pOn);
      pRight->pOn = 0;
    }

    /* Create extra terms on the WHERE clause for each column named
    ** in the USING clause.  Example: If the two tables to be joined are 
    ** A and B and the USING clause names X, Y, and Z, then add this
    ** to the WHERE clause:    A.X=B.X AND A.Y=B.Y AND A.Z=B.Z
    ** 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;
}

/*
** Insert code into "v" that will push the record on the top of the
** stack into the sorter.
*/
static void pushOntoSorter(
  Parse *pParse,         /* Parser context */
  ExprList *pOrderBy,    /* The ORDER BY clause */
  Select *pSelect,       /* The whole SELECT statement */
  int regData            /* Register holding data to be sorted */
){
  Vdbe *v = pParse->pVdbe;
  int nExpr = pOrderBy->nExpr;
  int regBase = sqlite3GetTempRange(pParse, nExpr+2);
  int regRecord = sqlite3GetTempReg(pParse);
  sqlite3ExprCodeExprList(pParse, pOrderBy, regBase, 0);
  sqlite3VdbeAddOp2(v, OP_Sequence, pOrderBy->iECursor, regBase+nExpr);
  sqlite3ExprCodeMove(pParse, regData, regBase+nExpr+1, 1);
  sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nExpr + 2, regRecord);
  sqlite3VdbeAddOp2(v, OP_IdxInsert, pOrderBy->iECursor, regRecord);
  sqlite3ReleaseTempReg(pParse, regRecord);
  sqlite3ReleaseTempRange(pParse, regBase, nExpr+2);
  if( pSelect->iLimit ){
    int addr1, addr2;
    int iLimit;
    if( pSelect->iOffset ){
      iLimit = pSelect->iOffset+1;
    }else{
      iLimit = pSelect->iLimit;
    }
    addr1 = sqlite3VdbeAddOp1(v, OP_IfZero, iLimit);
    sqlite3VdbeAddOp2(v, OP_AddImm, iLimit, -1);
    addr2 = sqlite3VdbeAddOp0(v, OP_Goto);
    sqlite3VdbeJumpHere(v, addr1);
    sqlite3VdbeAddOp1(v, OP_Last, pOrderBy->iECursor);
    sqlite3VdbeAddOp1(v, OP_Delete, pOrderBy->iECursor);
    sqlite3VdbeJumpHere(v, addr2);
    pSelect->iLimit = 0;
  }
}

/*
** Add code to implement the OFFSET
*/
static void codeOffset(
  Vdbe *v,          /* Generate code into this VM */
  Select *p,        /* The SELECT statement being coded */
  int iContinue     /* Jump here to skip the current record */
){
  if( p->iOffset && iContinue!=0 ){
    int addr;
    sqlite3VdbeAddOp2(v, OP_AddImm, p->iOffset, -1);
    addr = sqlite3VdbeAddOp1(v, OP_IfNeg, p->iOffset);
    sqlite3VdbeAddOp2(v, OP_Goto, 0, iContinue);
    VdbeComment((v, "skip OFFSET records"));
    sqlite3VdbeJumpHere(v, addr);
  }
}

/*
** Add code that will check to make sure the N registers starting at iMem
** form a distinct entry.  iTab is a sorting index that holds previously
** seen combinations of the N values.  A new entry is made in iTab
** if the current N values are new.
**
** A jump to addrRepeat is made and the N+1 values are popped from the
** stack if the top N elements are not distinct.
*/
static void codeDistinct(
  Parse *pParse,     /* Parsing and code generating context */
  int iTab,          /* A sorting index used to test for distinctness */
  int addrRepeat,    /* Jump to here if not distinct */
  int N,             /* Number of elements */
  int iMem           /* First element */
){
  Vdbe *v;
  int r1;

  v = pParse->pVdbe;
  r1 = sqlite3GetTempReg(pParse);
  sqlite3VdbeAddOp3(v, OP_MakeRecord, iMem, N, r1);
  sqlite3VdbeAddOp3(v, OP_Found, iTab, addrRepeat, r1);
  sqlite3VdbeAddOp2(v, OP_IdxInsert, iTab, r1);
  sqlite3ReleaseTempReg(pParse, r1);
}

/*
** Generate an error message when a SELECT is used within a subexpression
** (example:  "a IN (SELECT * FROM table)") but it has more than 1 result
** column.  We do this in a subroutine because the error occurs in multiple
** places.
*/
static int checkForMultiColumnSelectError(
  Parse *pParse,       /* Parse context. */
  SelectDest *pDest,   /* Destination of SELECT results */
  int nExpr            /* Number of result columns returned by SELECT */
){
  int eDest = pDest->eDest;
  if( nExpr>1 && (eDest==SRT_Mem || eDest==SRT_Set) ){
    sqlite3ErrorMsg(pParse, "only a single result allowed for "
       "a SELECT that is part of an expression");
    return 1;
  }else{
    return 0;
  }
}

/*
** This routine generates the code for the inside of the inner loop
** of a SELECT.
**
** If srcTab and nColumn are both zero, then the pEList expressions
** are evaluated in order to get the data for this row.  If nColumn>0
** then data is pulled from srcTab and pEList is used only to get the
** datatypes for each column.
*/
static void selectInnerLoop(
  Parse *pParse,          /* The parser context */
  Select *p,              /* The complete select statement being coded */
  ExprList *pEList,       /* List of values being extracted */
  int srcTab,             /* Pull data from this table */
  int nColumn,            /* Number of columns in the source table */
  ExprList *pOrderBy,     /* If not NULL, sort results using this key */
  int distinct,           /* If >=0, make sure results are distinct */
  SelectDest *pDest,      /* How to dispose of the results */
  int iContinue,          /* Jump here to continue with next row */
  int iBreak              /* Jump here to break out of the inner loop */
){
  Vdbe *v = pParse->pVdbe;
  int i;
  int hasDistinct;        /* True if the DISTINCT keyword is present */
  int regResult;              /* Start of memory holding result set */
  int eDest = pDest->eDest;   /* How to dispose of results */
  int iParm = pDest->iParm;   /* First argument to disposal method */
  int nResultCol;             /* Number of result columns */

  if( v==0 ) return;
  assert( pEList!=0 );
  hasDistinct = distinct>=0;
  if( pOrderBy==0 && !hasDistinct ){
    codeOffset(v, p, iContinue);
  }

  /* Pull the requested columns.
  */
  if( nColumn>0 ){
    nResultCol = nColumn;
  }else{
    nResultCol = pEList->nExpr;
  }
  if( pDest->iMem==0 ){
    pDest->iMem = pParse->nMem+1;
    pDest->nMem = nResultCol;
    pParse->nMem += nResultCol;
  }else if( pDest->nMem!=nResultCol ){
    /* This happens when two SELECTs of a compound SELECT have differing
    ** numbers of result columns.  The error message will be generated by
    ** a higher-level routine. */
    return;
  }
  regResult = pDest->iMem;
  if( nColumn>0 ){
    for(i=0; i<nColumn; i++){
      sqlite3VdbeAddOp3(v, OP_Column, srcTab, i, regResult+i);
    }
  }else if( eDest!=SRT_Exists ){
    /* If the destination is an EXISTS(...) expression, the actual
    ** values returned by the SELECT are not required.
    */
    sqlite3ExprCodeExprList(pParse, pEList, regResult, eDest==SRT_Callback);
  }
  nColumn = nResultCol;

  /* If the DISTINCT keyword was present on the SELECT statement
  ** and this row has been seen before, then do not make this row
  ** part of the result.
  */
  if( hasDistinct ){
    assert( pEList!=0 );
    assert( pEList->nExpr==nColumn );
    codeDistinct(pParse, distinct, iContinue, nColumn, regResult);
    if( pOrderBy==0 ){
      codeOffset(v, p, iContinue);
    }
  }

  if( checkForMultiColumnSelectError(pParse, pDest, pEList->nExpr) ){
    return;
  }

  switch( eDest ){
    /* In this mode, write each query result to the key of the temporary
    ** table iParm.
    */
#ifndef SQLITE_OMIT_COMPOUND_SELECT
    case SRT_Union: {
      int r1;
      r1 = sqlite3GetTempReg(pParse);
      sqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nColumn, r1);
      sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm, r1);
      sqlite3ReleaseTempReg(pParse, r1);
      break;
    }

    /* Construct a record from the query result, but instead of
    ** saving that record, use it as a key to delete elements from
    ** the temporary table iParm.
    */
    case SRT_Except: {
      sqlite3VdbeAddOp3(v, OP_IdxDelete, iParm, regResult, nColumn);
      break;
    }
#endif

    /* Store the result as data using a unique key.
    */
    case SRT_Table:
    case SRT_EphemTab: {
      int r1 = sqlite3GetTempReg(pParse);
      sqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nColumn, r1);
      if( pOrderBy ){
        pushOntoSorter(pParse, pOrderBy, p, r1);
      }else{
        int r2 = sqlite3GetTempReg(pParse);
        sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, r2);
        sqlite3VdbeAddOp3(v, OP_Insert, iParm, r1, r2);
        sqlite3VdbeChangeP5(v, OPFLAG_APPEND);
        sqlite3ReleaseTempReg(pParse, r2);
      }
      sqlite3ReleaseTempReg(pParse, r1);
      break;
    }

#ifndef SQLITE_OMIT_SUBQUERY
    /* If we are creating a set for an "expr IN (SELECT ...)" construct,
    ** then there should be a single item on the stack.  Write this
    ** item into the set table with bogus data.
    */
    case SRT_Set: {
      assert( nColumn==1 );
      p->affinity = sqlite3CompareAffinity(pEList->a[0].pExpr, pDest->affinity);
      if( pOrderBy ){
        /* At first glance you would think we could optimize out the
        ** ORDER BY in this case since the order of entries in the set
        ** does not matter.  But there might be a LIMIT clause, in which
        ** case the order does matter */
        pushOntoSorter(pParse, pOrderBy, p, regResult);
      }else{
        int r1 = sqlite3GetTempReg(pParse);
        sqlite3VdbeAddOp4(v, OP_MakeRecord, regResult, 1, r1, &p->affinity, 1);
        sqlite3ExprCacheAffinityChange(pParse, regResult, 1);
        sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm, r1);
        sqlite3ReleaseTempReg(pParse, r1);
      }
      break;
    }

    /* If any row exist in the result set, record that fact and abort.
    */
    case SRT_Exists: {
      sqlite3VdbeAddOp2(v, OP_Integer, 1, iParm);
      /* The LIMIT clause will terminate the loop for us */
      break;
    }

    /* If this is a scalar select that is part of an expression, then
    ** store the results in the appropriate memory cell and break out
    ** of the scan loop.
    */
    case SRT_Mem: {
      assert( nColumn==1 );
      if( pOrderBy ){
        pushOntoSorter(pParse, pOrderBy, p, regResult);
      }else{
        sqlite3ExprCodeMove(pParse, regResult, iParm, 1);
        /* The LIMIT clause will jump out of the loop for us */
      }
      break;
    }
#endif /* #ifndef SQLITE_OMIT_SUBQUERY */

    /* Send the data to the callback function or to a subroutine.  In the
    ** case of a subroutine, the subroutine itself is responsible for
    ** popping the data from the stack.
    */
    case SRT_Coroutine:
    case SRT_Callback: {
      if( pOrderBy ){
        int r1 = sqlite3GetTempReg(pParse);
        sqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nColumn, r1);
        pushOntoSorter(pParse, pOrderBy, p, r1);
        sqlite3ReleaseTempReg(pParse, r1);
      }else if( eDest==SRT_Coroutine ){
        sqlite3VdbeAddOp1(v, OP_Yield, pDest->iParm);
      }else{
        sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, nColumn);
        sqlite3ExprCacheAffinityChange(pParse, regResult, nColumn);
      }
      break;
    }

#if !defined(SQLITE_OMIT_TRIGGER)
    /* Discard the results.  This is used for SELECT statements inside
    ** the body of a TRIGGER.  The purpose of such selects is to call
    ** user-defined functions that have side effects.  We do not care
    ** about the actual results of the select.
    */
    default: {
      assert( eDest==SRT_Discard );
      break;
    }
#endif
  }

  /* Jump to the end of the loop if the LIMIT is reached.
  */
  if( p->iLimit ){
    assert( pOrderBy==0 );  /* If there is an ORDER BY, the call to
                            ** pushOntoSorter() would have cleared p->iLimit */
    sqlite3VdbeAddOp2(v, OP_AddImm, p->iLimit, -1);
    sqlite3VdbeAddOp2(v, OP_IfZero, p->iLimit, iBreak);
  }
}

/*
** Given an expression list, generate a KeyInfo structure that records
** the collating sequence for each expression in that expression list.
**
** If the ExprList is an ORDER BY or GROUP BY clause then the resulting
** KeyInfo structure is appropriate for initializing a virtual index to
** implement that clause.  If the ExprList is the result set of a SELECT
** then the KeyInfo structure is appropriate for initializing a virtual
** index to implement a DISTINCT test.
**
** Space to hold the KeyInfo structure is obtain from malloc.  The calling
** function is responsible for seeing that this structure is eventually
** freed.  Add the KeyInfo structure to the P4 field of an opcode using
** P4_KEYINFO_HANDOFF is the usual way of dealing with this.
*/
static KeyInfo *keyInfoFromExprList(Parse *pParse, ExprList *pList){
  sqlite3 *db = pParse->db;
  int nExpr;
  KeyInfo *pInfo;
  struct ExprList_item *pItem;
  int i;

  nExpr = pList->nExpr;
  pInfo = sqlite3DbMallocZero(db, sizeof(*pInfo) + nExpr*(sizeof(CollSeq*)+1) );
  if( pInfo ){
    pInfo->aSortOrder = (u8*)&pInfo->aColl[nExpr];
    pInfo->nField = nExpr;
    pInfo->enc = ENC(db);
    for(i=0, pItem=pList->a; i<nExpr; i++, pItem++){
      CollSeq *pColl;
      pColl = sqlite3ExprCollSeq(pParse, pItem->pExpr);
      if( !pColl ){
        pColl = db->pDfltColl;
      }
      pInfo->aColl[i] = pColl;
      pInfo->aSortOrder[i] = pItem->sortOrder;
    }
  }
  return pInfo;
}


/*
** If the inner loop was generated using a non-null pOrderBy argument,
** then the results were placed in a sorter.  After the loop is terminated
** we need to run the sorter and output the results.  The following
** routine generates the code needed to do that.
*/
static void generateSortTail(
  Parse *pParse,    /* Parsing context */
  Select *p,        /* The SELECT statement */
  Vdbe *v,          /* Generate code into this VDBE */
  int nColumn,      /* Number of columns of data */
  SelectDest *pDest /* Write the sorted results here */
){
  int brk = sqlite3VdbeMakeLabel(v);
  int cont = sqlite3VdbeMakeLabel(v);
  int addr;
  int iTab;
  int pseudoTab = 0;
  ExprList *pOrderBy = p->pOrderBy;

  int eDest = pDest->eDest;
  int iParm = pDest->iParm;

  int regRow;
  int regRowid;

  iTab = pOrderBy->iECursor;
  if( eDest==SRT_Callback || eDest==SRT_Coroutine ){
    pseudoTab = pParse->nTab++;
    sqlite3VdbeAddOp2(v, OP_SetNumColumns, 0, nColumn);
    sqlite3VdbeAddOp2(v, OP_OpenPseudo, pseudoTab, eDest==SRT_Callback);
  }
  addr = 1 + sqlite3VdbeAddOp2(v, OP_Sort, iTab, brk);
  codeOffset(v, p, cont);
  regRow = sqlite3GetTempReg(pParse);
  regRowid = sqlite3GetTempReg(pParse);
  sqlite3VdbeAddOp3(v, OP_Column, iTab, pOrderBy->nExpr + 1, regRow);
  switch( eDest ){
    case SRT_Table:
    case SRT_EphemTab: {
      sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, regRowid);
      sqlite3VdbeAddOp3(v, OP_Insert, iParm, regRow, regRowid);
      sqlite3VdbeChangeP5(v, OPFLAG_APPEND);
      break;
    }
#ifndef SQLITE_OMIT_SUBQUERY
    case SRT_Set: {
      assert( nColumn==1 );
      sqlite3VdbeAddOp4(v, OP_MakeRecord, regRow, 1, regRowid, &p->affinity, 1);
      sqlite3ExprCacheAffinityChange(pParse, regRow, 1);
      sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm, regRowid);
      break;
    }
    case SRT_Mem: {
      assert( nColumn==1 );
      sqlite3ExprCodeMove(pParse, regRow, iParm, 1);
      /* The LIMIT clause will terminate the loop for us */
      break;
    }
#endif
    case SRT_Callback:
    case SRT_Coroutine: {
      int i;
      sqlite3VdbeAddOp2(v, OP_Integer, 1, regRowid);
      sqlite3VdbeAddOp3(v, OP_Insert, pseudoTab, regRow, regRowid);
      for(i=0; i<nColumn; i++){
        assert( regRow!=pDest->iMem+i );
        sqlite3VdbeAddOp3(v, OP_Column, pseudoTab, i, pDest->iMem+i);
      }
      if( eDest==SRT_Callback ){
        sqlite3VdbeAddOp2(v, OP_ResultRow, pDest->iMem, nColumn);
        sqlite3ExprCacheAffinityChange(pParse, pDest->iMem, nColumn);
      }else{
        sqlite3VdbeAddOp1(v, OP_Yield, pDest->iParm);
      }
      break;
    }
    default: {
      /* Do nothing */
      break;
    }
  }
  sqlite3ReleaseTempReg(pParse, regRow);
  sqlite3ReleaseTempReg(pParse, regRowid);

  /* LIMIT has been implemented by the pushOntoSorter() routine.
  */
  assert( p->iLimit==0 );

  /* The bottom of the loop
  */
  sqlite3VdbeResolveLabel(v, cont);
  sqlite3VdbeAddOp2(v, OP_Next, iTab, addr);
  sqlite3VdbeResolveLabel(v, brk);
  if( eDest==SRT_Callback || eDest==SRT_Coroutine ){
    sqlite3VdbeAddOp2(v, OP_Close, pseudoTab, 0);
  }

}

/*
** Return a pointer to a string containing the 'declaration type' of the
** expression pExpr. The string may be treated as static by the caller.
**
** The declaration type is the exact datatype definition extracted from the
** original CREATE TABLE statement if the expression is a column. The
** declaration type for a ROWID field is INTEGER. Exactly when an expression
** is considered a column can be complex in the presence of subqueries. The
** result-set expression in all of the following SELECT statements is 
** considered a column by this function.
**
**   SELECT col FROM tbl;
**   SELECT (SELECT col FROM tbl;
**   SELECT (SELECT col FROM tbl);
**   SELECT abc FROM (SELECT col AS abc FROM tbl);
** 
** The declaration type for any expression other than a column is NULL.
*/
static const char *columnType(
  NameContext *pNC, 
  Expr *pExpr,
  const char **pzOriginDb,
  const char **pzOriginTab,
  const char **pzOriginCol
){
  char const *zType = 0;
  char const *zOriginDb = 0;
  char const *zOriginTab = 0;
  char const *zOriginCol = 0;
  int j;
  if( pExpr==0 || pNC->pSrcList==0 ) return 0;

  switch( pExpr->op ){
    case TK_AGG_COLUMN:
    case TK_COLUMN: {
      /* The expression is a column. Locate the table the column is being
      ** extracted from in NameContext.pSrcList. This table may be real
      ** database table or a subquery.
      */
      Table *pTab = 0;            /* Table structure column is extracted from */
      Select *pS = 0;             /* Select the column is extracted from */
      int iCol = pExpr->iColumn;  /* Index of column in pTab */
      while( pNC && !pTab ){
        SrcList *pTabList = pNC->pSrcList;
        for(j=0;j<pTabList->nSrc && pTabList->a[j].iCursor!=pExpr->iTable;j++);
        if( j<pTabList->nSrc ){
          pTab = pTabList->a[j].pTab;
          pS = pTabList->a[j].pSelect;
        }else{
          pNC = pNC->pNext;
        }
      }

      if( pTab==0 ){
        /* FIX ME:
        ** This can occurs if you have something like "SELECT new.x;" inside
        ** a trigger.  In other words, if you reference the special "new"
        ** table in the result set of a select.  We do not have a good way
        ** to find the actual table type, so call it "TEXT".  This is really
        ** something of a bug, but I do not know how to fix it.
        **
        ** This code does not produce the correct answer - it just prevents
        ** a segfault.  See ticket #1229.
        */
        zType = "TEXT";
        break;
      }

      assert( pTab );
      if( pS ){
        /* The "table" is actually a sub-select or a view in the FROM clause
        ** of the SELECT statement. Return the declaration type and origin
        ** data for the result-set column of the sub-select.
        */
        if( iCol>=0 && iCol<pS->pEList->nExpr ){
          /* If iCol is less than zero, then the expression requests the
          ** rowid of the sub-select or view. This expression is legal (see 
          ** test case misc2.2.2) - it always evaluates to NULL.
          */
          NameContext sNC;
          Expr *p = pS->pEList->a[iCol].pExpr;
          sNC.pSrcList = pS->pSrc;
          sNC.pNext = 0;
          sNC.pParse = pNC->pParse;
          zType = columnType(&sNC, p, &zOriginDb, &zOriginTab, &zOriginCol); 
        }
      }else if( pTab->pSchema ){
        /* A real table */
        assert( !pS );
        if( iCol<0 ) iCol = pTab->iPKey;
        assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
        if( iCol<0 ){
          zType = "INTEGER";
          zOriginCol = "rowid";
        }else{
          zType = pTab->aCol[iCol].zType;
          zOriginCol = pTab->aCol[iCol].zName;
        }
        zOriginTab = pTab->zName;
        if( pNC->pParse ){
          int iDb = sqlite3SchemaToIndex(pNC->pParse->db, pTab->pSchema);
          zOriginDb = pNC->pParse->db->aDb[iDb].zName;
        }
      }
      break;
    }
#ifndef SQLITE_OMIT_SUBQUERY
    case TK_SELECT: {
      /* The expression is a sub-select. Return the declaration type and
      ** origin info for the single column in the result set of the SELECT
      ** statement.
      */
      NameContext sNC;
      Select *pS = pExpr->pSelect;
      Expr *p = pS->pEList->a[0].pExpr;
      sNC.pSrcList = pS->pSrc;
      sNC.pNext = pNC;
      sNC.pParse = pNC->pParse;
      zType = columnType(&sNC, p, &zOriginDb, &zOriginTab, &zOriginCol); 
      break;
    }
#endif
  }
  
  if( pzOriginDb ){
    assert( pzOriginTab && pzOriginCol );
    *pzOriginDb = zOriginDb;
    *pzOriginTab = zOriginTab;
    *pzOriginCol = zOriginCol;
  }
  return zType;
}

/*
** Generate code that will tell the VDBE the declaration types of columns
** in the result set.
*/
static void generateColumnTypes(
  Parse *pParse,      /* Parser context */
  SrcList *pTabList,  /* List of tables */
  ExprList *pEList    /* Expressions defining the result set */
){
#ifndef SQLITE_OMIT_DECLTYPE
  Vdbe *v = pParse->pVdbe;
  int i;
  NameContext sNC;
  sNC.pSrcList = pTabList;
  sNC.pParse = pParse;
  for(i=0; i<pEList->nExpr; i++){
    Expr *p = pEList->a[i].pExpr;
    const char *zType;
#ifdef SQLITE_ENABLE_COLUMN_METADATA
    const char *zOrigDb = 0;
    const char *zOrigTab = 0;
    const char *zOrigCol = 0;
    zType = columnType(&sNC, p, &zOrigDb, &zOrigTab, &zOrigCol);

    /* The vdbe must make its own copy of the column-type and other 
    ** column specific strings, in case the schema is reset before this
    ** virtual machine is deleted.
    */
    sqlite3VdbeSetColName(v, i, COLNAME_DATABASE, zOrigDb, P4_TRANSIENT);
    sqlite3VdbeSetColName(v, i, COLNAME_TABLE, zOrigTab, P4_TRANSIENT);
    sqlite3VdbeSetColName(v, i, COLNAME_COLUMN, zOrigCol, P4_TRANSIENT);
#else
    zType = columnType(&sNC, p, 0, 0, 0);
#endif
    sqlite3VdbeSetColName(v, i, COLNAME_DECLTYPE, zType, P4_TRANSIENT);
  }
#endif /* SQLITE_OMIT_DECLTYPE */
}

/*
** Generate code that will tell the VDBE the names of columns
** in the result set.  This information is used to provide the
** azCol[] values in the callback.
*/
static void generateColumnNames(
  Parse *pParse,      /* Parser context */
  SrcList *pTabList,  /* List of tables */
  ExprList *pEList    /* Expressions defining the result set */
){
  Vdbe *v = pParse->pVdbe;
  int i, j;
  sqlite3 *db = pParse->db;
  int fullNames, shortNames;

#ifndef SQLITE_OMIT_EXPLAIN
  /* If this is an EXPLAIN, skip this step */
  if( pParse->explain ){
    return;
  }
#endif

  assert( v!=0 );
  if( pParse->colNamesSet || v==0 || db->mallocFailed ) return;
  pParse->colNamesSet = 1;
  fullNames = (db->flags & SQLITE_FullColNames)!=0;
  shortNames = (db->flags & SQLITE_ShortColNames)!=0;
  sqlite3VdbeSetNumCols(v, pEList->nExpr);
  for(i=0; i<pEList->nExpr; i++){
    Expr *p;
    p = pEList->a[i].pExpr;
    if( p==0 ) continue;
    if( pEList->a[i].zName ){
      char *zName = pEList->a[i].zName;
      sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, strlen(zName));
    }else if( p->op==TK_COLUMN && pTabList ){
      Table *pTab;
      char *zCol;
      int iCol = p->iColumn;
      for(j=0; j<pTabList->nSrc && pTabList->a[j].iCursor!=p->iTable; j++){}
      assert( j<pTabList->nSrc );
      pTab = pTabList->a[j].pTab;
      if( iCol<0 ) iCol = pTab->iPKey;
      assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
      if( iCol<0 ){
        zCol = "rowid";
      }else{
        zCol = pTab->aCol[iCol].zName;
      }
      if( !shortNames && !fullNames ){
        sqlite3VdbeSetColName(v, i, COLNAME_NAME, (char*)p->span.z, p->span.n);
      }else if( fullNames || (!shortNames && pTabList->nSrc>1) ){
        char *zName = 0;
        char *zTab;
 
        zTab = pTabList->a[j].zAlias;
        if( fullNames || zTab==0 ) zTab = pTab->zName;
        zName = sqlite3MPrintf(db, "%s.%s", zTab, zCol);
        sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, P4_DYNAMIC);
      }else{
        sqlite3VdbeSetColName(v, i, COLNAME_NAME, zCol, strlen(zCol));
      }
    }else{
      sqlite3VdbeSetColName(v, i, COLNAME_NAME, (char*)p->span.z, p->span.n);
    }
  }
  generateColumnTypes(pParse, pTabList, pEList);
}

#ifndef SQLITE_OMIT_COMPOUND_SELECT
/*
** Name of the connection operator, used for error messages.
*/
static const char *selectOpName(int id){
  char *z;
  switch( id ){
    case TK_ALL:       z = "UNION ALL";   break;
    case TK_INTERSECT: z = "INTERSECT";   break;
    case TK_EXCEPT:    z = "EXCEPT";      break;
    default:           z = "UNION";       break;
  }
  return z;
}
#endif /* SQLITE_OMIT_COMPOUND_SELECT */

/*
** Forward declaration
*/
static int prepSelectStmt(Parse*, Select*);

/*
** Given a SELECT statement, generate a Table structure that describes
** the result set of that SELECT.
*/
Table *sqlite3ResultSetOfSelect(Parse *pParse, char *zTabName, Select *pSelect){
  Table *pTab;
  int i, j, rc;
  ExprList *pEList;
  Column *aCol, *pCol;
  sqlite3 *db = pParse->db;
  int savedFlags;

  savedFlags = db->flags;
  db->flags &= ~SQLITE_FullColNames;
  db->flags |= SQLITE_ShortColNames;
  rc = sqlite3SelectResolve(pParse, pSelect, 0);
  if( rc==SQLITE_OK ){
    while( pSelect->pPrior ) pSelect = pSelect->pPrior;
    rc = prepSelectStmt(pParse, pSelect);
    if( rc==SQLITE_OK ){
      rc = sqlite3SelectResolve(pParse, pSelect, 0);
    }
  }
  db->flags = savedFlags;
  if( rc ){
    return 0;
  }
  pTab = sqlite3DbMallocZero(db, sizeof(Table) );
  if( pTab==0 ){
    return 0;
  }
  pTab->db = db;
  pTab->nRef = 1;
  pTab->zName = zTabName ? sqlite3DbStrDup(db, zTabName) : 0;
  pEList = pSelect->pEList;
  pTab->nCol = pEList->nExpr;
  assert( pTab->nCol>0 );
  pTab->aCol = aCol = sqlite3DbMallocZero(db, sizeof(pTab->aCol[0])*pTab->nCol);
  testcase( aCol==0 );
  for(i=0, pCol=aCol; i<pTab->nCol; i++, pCol++){
    Expr *p;
    char *zType;
    char *zName;
    int nName;
    CollSeq *pColl;
    int cnt;
    NameContext sNC;
    
    /* Get an appropriate name for the column
    */
    p = pEList->a[i].pExpr;
    assert( p->pRight==0 || p->pRight->token.z==0 || p->pRight->token.z[0]!=0 );
    if( (zName = pEList->a[i].zName)!=0 ){
      /* If the column contains an "AS <name>" phrase, use <name> as the name */
      zName = sqlite3DbStrDup(db, zName);
    }else if( p->op==TK_COLUMN && p->pTab ){
      /* For columns use the column name name */
      int iCol = p->iColumn;
      if( iCol<0 ) iCol = p->pTab->iPKey;
      zName = sqlite3MPrintf(db, "%s", p->pTab->aCol[iCol].zName);
    }else{
      /* Use the original text of the column expression as its name */
      zName = sqlite3MPrintf(db, "%T", &p->span);
    }
    if( db->mallocFailed ){
      sqlite3DbFree(db, zName);
      break;
    }
    sqlite3Dequote(zName);

    /* Make sure the column name is unique.  If the name is not unique,
    ** append a integer to the name so that it becomes unique.
    */
    nName = strlen(zName);
    for(j=cnt=0; j<i; j++){
      if( sqlite3StrICmp(aCol[j].zName, zName)==0 ){
        char *zNewName;
        zName[nName] = 0;
        zNewName = sqlite3MPrintf(db, "%s:%d", zName, ++cnt);
        sqlite3DbFree(db, zName);
        zName = zNewName;
        j = -1;
        if( zName==0 ) break;
      }
    }
    pCol->zName = zName;

    /* Get the typename, type affinity, and collating sequence for the
    ** column.
    */
    memset(&sNC, 0, sizeof(sNC));
    sNC.pSrcList = pSelect->pSrc;
    zType = sqlite3DbStrDup(db, columnType(&sNC, p, 0, 0, 0));
    pCol->zType = zType;
    pCol->affinity = sqlite3ExprAffinity(p);
    pColl = sqlite3ExprCollSeq(pParse, p);
    if( pColl ){
      pCol->zColl = sqlite3DbStrDup(db, pColl->zName);
    }
  }
  pTab->iPKey = -1;
  if( db->mallocFailed ){
    sqlite3DeleteTable(pTab);
    return 0;
  }
  return pTab;
}

/*
** Prepare a SELECT statement for processing by doing the following
** things:
**
**    (1)  Make sure VDBE cursor numbers have been assigned to every
**         element of the FROM clause.
**
**    (2)  Fill in the pTabList->a[].pTab fields in the SrcList that 
**         defines FROM clause.  When views appear in the FROM clause,
**         fill pTabList->a[].pSelect with a copy of the SELECT statement
**         that implements the view.  A copy is made of the view's SELECT
**         statement so that we can freely modify or delete that statement
**         without worrying about messing up the presistent representation
**         of the view.
**
**    (3)  Add terms to the WHERE clause to accomodate the NATURAL keyword
**         on joins and the ON and USING clause of joins.
**
**    (4)  Scan the list of columns in the result set (pEList) looking
**         for instances of the "*" operator or the TABLE.* operator.
**         If found, expand each "*" to be every column in every table
**         and TABLE.* to be every column in TABLE.
**
** Return 0 on success.  If there are problems, leave an error message
** in pParse and return non-zero.
*/
static int prepSelectStmt(Parse *pParse, Select *p){
  int i, j, k, rc;
  SrcList *pTabList;
  ExprList *pEList;
  struct SrcList_item *pFrom;
  sqlite3 *db = pParse->db;

  if( p==0 || p->pSrc==0 || db->mallocFailed ){
    return 1;
  }
  pTabList = p->pSrc;
  pEList = p->pEList;

  /* Make sure cursor numbers have been assigned to all entries in
  ** the FROM clause of the SELECT statement.
  */
  sqlite3SrcListAssignCursors(pParse, p->pSrc);

  /* Look up every table named in the FROM clause of the select.  If
  ** an entry of the FROM clause is a subquery instead of a table or view,
  ** then create a transient table structure to describe the subquery.
  */
  for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){
    Table *pTab;
    if( pFrom->pTab!=0 ){
      /* This statement has already been prepared.  There is no need
      ** to go further. */
      assert( i==0 );
      return 0;
    }
    if( pFrom->zName==0 ){
#ifndef SQLITE_OMIT_SUBQUERY
      /* A sub-query in the FROM clause of a SELECT */
      assert( pFrom->pSelect!=0 );
      if( pFrom->zAlias==0 ){
        pFrom->zAlias =
          sqlite3MPrintf(db, "sqlite_subquery_%p_", (void*)pFrom->pSelect);
      }
      assert( pFrom->pTab==0 );
      pFrom->pTab = pTab = 
        sqlite3ResultSetOfSelect(pParse, pFrom->zAlias, pFrom->pSelect);
      if( pTab==0 ){
        return 1;
      }
      /* The isEphem flag indicates that the Table structure has been
      ** dynamically allocated and may be freed at any time.  In other words,
      ** pTab is not pointing to a persistent table structure that defines
      ** part of the schema. */
      pTab->isEphem = 1;
#endif
    }else{
      /* An ordinary table or view name in the FROM clause */
      assert( pFrom->pTab==0 );
      pFrom->pTab = pTab = 
        sqlite3LocateTable(pParse,0,pFrom->zName,pFrom->zDatabase);
      if( pTab==0 ){
        return 1;
      }
      pTab->nRef++;
#if !defined(SQLITE_OMIT_VIEW) || !defined (SQLITE_OMIT_VIRTUALTABLE)
      if( pTab->pSelect || IsVirtual(pTab) ){
        /* We reach here if the named table is a really a view */
        if( sqlite3ViewGetColumnNames(pParse, pTab) ){
          return 1;
        }
        /* If pFrom->pSelect!=0 it means we are dealing with a
        ** view within a view.  The SELECT structure has already been
        ** copied by the outer view so we can skip the copy step here
        ** in the inner view.
        */
        if( pFrom->pSelect==0 ){
          pFrom->pSelect = sqlite3SelectDup(db, pTab->pSelect);
        }
      }
#endif
    }
  }

  /* Process NATURAL keywords, and ON and USING clauses of joins.
  */
  if( sqliteProcessJoin(pParse, p) ) return 1;

  /* For every "*" that occurs in the column list, insert the names of
  ** all columns in all tables.  And for every TABLE.* insert the names
  ** of all columns in TABLE.  The parser inserted a special expression
  ** with the TK_ALL operator for each "*" that it found in the column list.
  ** The following code just has to locate the TK_ALL expressions and expand
  ** each one to the list of all columns in all tables.
  **
  ** The first loop just checks to see if there are any "*" operators
  ** that need expanding.
  */
  for(k=0; k<pEList->nExpr; k++){
    Expr *pE = pEList->a[k].pExpr;
    if( pE->op==TK_ALL ) break;
    if( pE->op==TK_DOT && pE->pRight && pE->pRight->op==TK_ALL
         && pE->pLeft && pE->pLeft->op==TK_ID ) break;
  }
  rc = 0;
  if( k<pEList->nExpr ){
    /*
    ** If we get here it means the result set contains one or more "*"
    ** operators that need to be expanded.  Loop through each expression
    ** in the result set and expand them one by one.
    */
    struct ExprList_item *a = pEList->a;
    ExprList *pNew = 0;
    int flags = pParse->db->flags;
    int longNames = (flags & SQLITE_FullColNames)!=0
                      && (flags & SQLITE_ShortColNames)==0;

    for(k=0; k<pEList->nExpr; k++){
      Expr *pE = a[k].pExpr;
      if( pE->op!=TK_ALL &&
           (pE->op!=TK_DOT || pE->pRight==0 || pE->pRight->op!=TK_ALL) ){
        /* This particular expression does not need to be expanded.
        */
        pNew = sqlite3ExprListAppend(pParse, pNew, a[k].pExpr, 0);
        if( pNew ){
          pNew->a[pNew->nExpr-1].zName = a[k].zName;
        }else{
          rc = 1;
        }
        a[k].pExpr = 0;
        a[k].zName = 0;
      }else{
        /* This expression is a "*" or a "TABLE.*" and needs to be
        ** expanded. */
        int tableSeen = 0;      /* Set to 1 when TABLE matches */
        char *zTName;            /* text of name of TABLE */
        if( pE->op==TK_DOT && pE->pLeft ){
          zTName = sqlite3NameFromToken(db, &pE->pLeft->token);
        }else{
          zTName = 0;
        }
        for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){
          Table *pTab = pFrom->pTab;
          char *zTabName = pFrom->zAlias;
          if( zTabName==0 || zTabName[0]==0 ){ 
            zTabName = pTab->zName;
          }
          assert( zTabName );
          if( zTName && sqlite3StrICmp(zTName, zTabName)!=0 ){
            continue;
          }
          tableSeen = 1;
          for(j=0; j<pTab->nCol; j++){
            Expr *pExpr, *pRight;
            char *zName = pTab->aCol[j].zName;

            /* If a column is marked as 'hidden' (currently only possible
            ** for virtual tables), do not include it in the expanded
            ** result-set list.
            */
            if( IsHiddenColumn(&pTab->aCol[j]) ){
              assert(IsVirtual(pTab));
              continue;
            }

            if( i>0 ){
              struct SrcList_item *pLeft = &pTabList->a[i-1];
              if( (pLeft[1].jointype & JT_NATURAL)!=0 &&
                        columnIndex(pLeft->pTab, zName)>=0 ){
                /* In a NATURAL join, omit the join columns from the 
                ** table on the right */
                continue;
              }
              if( sqlite3IdListIndex(pLeft[1].pUsing, zName)>=0 ){
                /* In a join with a USING clause, omit columns in the
                ** using clause from the table on the right. */
                continue;
              }
            }
            pRight = sqlite3PExpr(pParse, TK_ID, 0, 0, 0);
            if( pRight==0 ) break;
            setQuotedToken(pParse, &pRight->token, zName);
            if( longNames || pTabList->nSrc>1 ){
              Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, 0);
              pExpr = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0);
              if( pExpr==0 ) break;
              setQuotedToken(pParse, &pLeft->token, zTabName);
#if 1
              setToken(&pExpr->span, 
                  sqlite3MPrintf(db, "%s.%s", zTabName, zName));
              pExpr->span.dyn = 1;
#else
              pExpr->span = pRight->token;
              pExpr->span.dyn = 0;
#endif
              pExpr->token.z = 0;
              pExpr->token.n = 0;
              pExpr->token.dyn = 0;
            }else{
              pExpr = pRight;
              pExpr->span = pExpr->token;
              pExpr->span.dyn = 0;
            }
            if( longNames ){
              pNew = sqlite3ExprListAppend(pParse, pNew, pExpr, &pExpr->span);
            }else{
              pNew = sqlite3ExprListAppend(pParse, pNew, pExpr, &pRight->token);
            }
          }
        }
        if( !tableSeen ){
          if( zTName ){
            sqlite3ErrorMsg(pParse, "no such table: %s", zTName);
          }else{
            sqlite3ErrorMsg(pParse, "no tables specified");
          }
          rc = 1;
        }
        sqlite3DbFree(db, zTName);
      }
    }
    sqlite3ExprListDelete(db, pEList);
    p->pEList = pNew;
  }
#if SQLITE_MAX_COLUMN
  if( p->pEList && p->pEList->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){
    sqlite3ErrorMsg(pParse, "too many columns in result set");
    rc = SQLITE_ERROR;
  }
#endif
  if( db->mallocFailed ){
    rc = SQLITE_NOMEM;
  }
  return rc;
}

/*
** pE is a pointer to an expression which is a single term in
** ORDER BY or GROUP BY clause.
**
** At the point this routine is called, we already know that the
** ORDER BY term is not an integer index into the result set.  That
** casee is handled by the calling routine.
**
** If pE is a well-formed expression and the SELECT statement
** is not compound, then return 0.  This indicates to the
** caller that it should sort by the value of the ORDER BY
** expression.
**
** If the SELECT is compound, then attempt to match pE against
** result set columns in the left-most SELECT statement.  Return
** the index i of the matching column, as an indication to the 
** caller that it should sort by the i-th column.  If there is
** no match, return -1 and leave an error message in pParse.
*/
static int matchOrderByTermToExprList(
  Parse *pParse,     /* Parsing context for error messages */
  Select *pSelect,   /* The SELECT statement with the ORDER BY clause */
  Expr *pE,          /* The specific ORDER BY term */
  int idx,           /* When ORDER BY term is this */
  int isCompound,    /* True if this is a compound SELECT */
  u8 *pHasAgg        /* True if expression contains aggregate functions */
){
  int i;             /* Loop counter */
  ExprList *pEList;  /* The columns of the result set */
  NameContext nc;    /* Name context for resolving pE */

  assert( sqlite3ExprIsInteger(pE, &i)==0 );
  pEList = pSelect->pEList;

  /* If the term is a simple identifier that try to match that identifier
  ** against a column name in the result set.
  */
  if( pE->op==TK_ID || (pE->op==TK_STRING && pE->token.z[0]!='\'') ){
    sqlite3 *db = pParse->db;
    char *zCol = sqlite3NameFromToken(db, &pE->token);
    if( zCol==0 ){
      return -1;
    }
    for(i=0; i<pEList->nExpr; i++){
      char *zAs = pEList->a[i].zName;
      if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){
        sqlite3DbFree(db, zCol);
        return i+1;
      }
    }
    sqlite3DbFree(db, zCol);
  }

  /* Resolve all names in the ORDER BY term expression
  */
  memset(&nc, 0, sizeof(nc));
  nc.pParse = pParse;
  nc.pSrcList = pSelect->pSrc;
  nc.pEList = pEList;
  nc.allowAgg = 1;
  nc.nErr = 0;
  if( sqlite3ExprResolveNames(&nc, pE) ){
    if( isCompound ){
      sqlite3ErrorClear(pParse);
      return 0;
    }else{
      return -1;
    }
  }
  if( nc.hasAgg && pHasAgg ){
    *pHasAgg = 1;
  }

  /* For a compound SELECT, we need to try to match the ORDER BY
  ** expression against an expression in the result set
  */
  if( isCompound ){
    for(i=0; i<pEList->nExpr; i++){
      if( sqlite3ExprCompare(pEList->a[i].pExpr, pE) ){
        return i+1;
      }
    }
  }
  return 0;
}


/*
** Analyze and ORDER BY or GROUP BY clause in a simple SELECT statement.
** Return the number of errors seen.
**
** Every term of the ORDER BY or GROUP BY clause needs to be an
** expression.  If any expression is an integer constant, then
** that expression is replaced by the corresponding 
** expression from the result set.
*/
static int processOrderGroupBy(
  Parse *pParse,        /* Parsing context.  Leave error messages here */
  Select *pSelect,      /* The SELECT statement containing the clause */
  ExprList *pOrderBy,   /* The ORDER BY or GROUP BY clause to be processed */
  int isOrder,          /* 1 for ORDER BY.  0 for GROUP BY */
  u8 *pHasAgg           /* Set to TRUE if any term contains an aggregate */
){
  int i;
  sqlite3 *db = pParse->db;
  ExprList *pEList;

  if( pOrderBy==0 || pParse->db->mallocFailed ) return 0;
#if SQLITE_MAX_COLUMN
  if( pOrderBy->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){
    const char *zType = isOrder ? "ORDER" : "GROUP";
    sqlite3ErrorMsg(pParse, "too many terms in %s BY clause", zType);
    return 1;
  }
#endif
  pEList = pSelect->pEList;
  if( pEList==0 ){
    return 0;
  }
  for(i=0; i<pOrderBy->nExpr; i++){
    int iCol;
    Expr *pE = pOrderBy->a[i].pExpr;
    if( sqlite3ExprIsInteger(pE, &iCol) ){
      if( iCol<=0 || iCol>pEList->nExpr ){
        const char *zType = isOrder ? "ORDER" : "GROUP";
        sqlite3ErrorMsg(pParse, 
           "%r %s BY term out of range - should be "
           "between 1 and %d", i+1, zType, pEList->nExpr);
        return 1;
      }
    }else{
      iCol = matchOrderByTermToExprList(pParse, pSelect, pE, i+1, 0, pHasAgg);
      if( iCol<0 ){
        return 1;
      }
    }
    if( iCol>0 ){
      CollSeq *pColl = pE->pColl;
      int flags = pE->flags & EP_ExpCollate;
      sqlite3ExprDelete(db, pE);
      pE = sqlite3ExprDup(db, pEList->a[iCol-1].pExpr);
      pOrderBy->a[i].pExpr = pE;
      if( pE && pColl && flags ){
        pE->pColl = pColl;
        pE->flags |= flags;
      }
    }
  }
  return 0;
}

/*
** Analyze and ORDER BY or GROUP BY clause in a SELECT statement.  Return
** the number of errors seen.
**
** If iTable>0 then make the N-th term of the ORDER BY clause refer to
** the N-th column of table iTable.
**
** If iTable==0 then transform each term of the ORDER BY clause to refer
** to a column of the result set by number.
*/
static int processCompoundOrderBy(
  Parse *pParse,        /* Parsing context.  Leave error messages here */
  Select *pSelect       /* The SELECT statement containing the ORDER BY */
){
  int i;
  ExprList *pOrderBy;
  ExprList *pEList;
  sqlite3 *db;
  int moreToDo = 1;

  pOrderBy = pSelect->pOrderBy;
  if( pOrderBy==0 ) return 0;
  db = pParse->db;
#if SQLITE_MAX_COLUMN
  if( pOrderBy->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){
    sqlite3ErrorMsg(pParse, "too many terms in ORDER BY clause");
    return 1;
  }
#endif
  for(i=0; i<pOrderBy->nExpr; i++){
    pOrderBy->a[i].done = 0;
  }
  while( pSelect->pPrior ){
    pSelect = pSelect->pPrior;
  }
  while( pSelect && moreToDo ){
    moreToDo = 0;
    pEList = pSelect->pEList;
    if( pEList==0 ){
      return 1;
    }
    for(i=0; i<pOrderBy->nExpr; i++){
      int iCol = -1;
      Expr *pE, *pDup;
      if( pOrderBy->a[i].done ) continue;
      pE = pOrderBy->a[i].pExpr;
      if( sqlite3ExprIsInteger(pE, &iCol) ){
        if( iCol<0 || iCol>pEList->nExpr ){
          sqlite3ErrorMsg(pParse, 
             "%r ORDER BY term out of range - should be "
             "between 1 and %d", i+1, pEList->nExpr);
          return 1;
        }
      }else{
        pDup = sqlite3ExprDup(db, pE);
        if( !db->mallocFailed ){
          assert(pDup);
          iCol = matchOrderByTermToExprList(pParse, pSelect, pDup, i+1, 1, 0);
        }
        sqlite3ExprDelete(db, pDup);
        if( iCol<0 ){
          return 1;
        }
      }
      if( iCol>0 ){
        pE->op = TK_INTEGER;
        pE->flags |= EP_IntValue;
        pE->iTable = iCol;
        pOrderBy->a[i].done = 1;
      }else{
        moreToDo = 1;
      }
    }
    pSelect = pSelect->pNext;
  }
  for(i=0; i<pOrderBy->nExpr; i++){
    if( pOrderBy->a[i].done==0 ){
      sqlite3ErrorMsg(pParse, "%r ORDER BY term does not match any "
            "column in the result set", i+1);
      return 1;
    }
  }
  return 0;
}

/*
** Get a VDBE for the given parser context.  Create a new one if necessary.
** If an error occurs, return NULL and leave a message in pParse.
*/
Vdbe *sqlite3GetVdbe(Parse *pParse){
  Vdbe *v = pParse->pVdbe;
  if( v==0 ){
    v = pParse->pVdbe = sqlite3VdbeCreate(pParse->db);
#ifndef SQLITE_OMIT_TRACE
    if( v ){
      sqlite3VdbeAddOp0(v, OP_Trace);
    }
#endif
  }
  return v;
}


/*
** Compute the iLimit and iOffset fields of the SELECT based on the
** pLimit and pOffset expressions.  pLimit and pOffset hold the expressions
** that appear in the original SQL statement after the LIMIT and OFFSET
** keywords.  Or NULL if those keywords are omitted. iLimit and iOffset 
** are the integer memory register numbers for counters used to compute 
** the limit and offset.  If there is no limit and/or offset, then 
** iLimit and iOffset are negative.
**
** This routine changes the values of iLimit and iOffset only if
** a limit or offset is defined by pLimit and pOffset.  iLimit and
** iOffset should have been preset to appropriate default values
** (usually but not always -1) prior to calling this routine.
** Only if pLimit!=0 or pOffset!=0 do the limit registers get
** redefined.  The UNION ALL operator uses this property to force
** the reuse of the same limit and offset registers across multiple
** SELECT statements.
*/
static void computeLimitRegisters(Parse *pParse, Select *p, int iBreak){
  Vdbe *v = 0;
  int iLimit = 0;
  int iOffset;
  int addr1;
  if( p->iLimit ) return;

  /* 
  ** "LIMIT -1" always shows all rows.  There is some
  ** contraversy about what the correct behavior should be.
  ** The current implementation interprets "LIMIT 0" to mean
  ** no rows.
  */
  if( p->pLimit ){
    p->iLimit = iLimit = ++pParse->nMem;
    v = sqlite3GetVdbe(pParse);
    if( v==0 ) return;
    sqlite3ExprCode(pParse, p->pLimit, iLimit);
    sqlite3VdbeAddOp1(v, OP_MustBeInt, iLimit);
    VdbeComment((v, "LIMIT counter"));
    sqlite3VdbeAddOp2(v, OP_IfZero, iLimit, iBreak);
  }
  if( p->pOffset ){
    p->iOffset = iOffset = ++pParse->nMem;
    if( p->pLimit ){
      pParse->nMem++;   /* Allocate an extra register for limit+offset */
    }
    v = sqlite3GetVdbe(pParse);
    if( v==0 ) return;
    sqlite3ExprCode(pParse, p->pOffset, iOffset);
    sqlite3VdbeAddOp1(v, OP_MustBeInt, iOffset);
    VdbeComment((v, "OFFSET counter"));
    addr1 = sqlite3VdbeAddOp1(v, OP_IfPos, iOffset);
    sqlite3VdbeAddOp2(v, OP_Integer, 0, iOffset);
    sqlite3VdbeJumpHere(v, addr1);
    if( p->pLimit ){
      sqlite3VdbeAddOp3(v, OP_Add, iLimit, iOffset, iOffset+1);
      VdbeComment((v, "LIMIT+OFFSET"));
      addr1 = sqlite3VdbeAddOp1(v, OP_IfPos, iLimit);
      sqlite3VdbeAddOp2(v, OP_Integer, -1, iOffset+1);
      sqlite3VdbeJumpHere(v, addr1);
    }
  }
}

#ifndef SQLITE_OMIT_COMPOUND_SELECT
/*
** Return the appropriate collating sequence for the iCol-th column of
** the result set for the compound-select statement "p".  Return NULL if
** the column has no default collating sequence.
**
** The collating sequence for the compound select is taken from the
** left-most term of the select that has a collating sequence.
*/
static CollSeq *multiSelectCollSeq(Parse *pParse, Select *p, int iCol){
  CollSeq *pRet;
  if( p->pPrior ){
    pRet = multiSelectCollSeq(pParse, p->pPrior, iCol);
  }else{
    pRet = 0;
  }
  if( pRet==0 ){
    pRet = sqlite3ExprCollSeq(pParse, p->pEList->a[iCol].pExpr);
  }
  return pRet;
}
#endif /* SQLITE_OMIT_COMPOUND_SELECT */

/* Forward reference */
static int multiSelectOrderBy(
  Parse *pParse,        /* Parsing context */
  Select *p,            /* The right-most of SELECTs to be coded */
  SelectDest *pDest     /* What to do with query results */
);


#ifndef SQLITE_OMIT_COMPOUND_SELECT
/*
** This routine is called to process a compound query form from
** two or more separate queries using UNION, UNION ALL, EXCEPT, or
** INTERSECT
**
** "p" points to the right-most of the two queries.  the query on the
** left is p->pPrior.  The left query could also be a compound query
** in which case this routine will be called recursively. 
**
** The results of the total query are to be written into a destination
** of type eDest with parameter iParm.
**
** Example 1:  Consider a three-way compound SQL statement.
**
**     SELECT a FROM t1 UNION SELECT b FROM t2 UNION SELECT c FROM t3
**
** This statement is parsed up as follows:
**
**     SELECT c FROM t3
**      |
**      `----->  SELECT b FROM t2
**                |
**                `------>  SELECT a FROM t1
**
** The arrows in the diagram above represent the Select.pPrior pointer.
** So if this routine is called with p equal to the t3 query, then
** pPrior will be the t2 query.  p->op will be TK_UNION in this case.
**
** Notice that because of the way SQLite parses compound SELECTs, the
** individual selects always group from left to right.
*/
static int multiSelect(
  Parse *pParse,        /* Parsing context */
  Select *p,            /* The right-most of SELECTs to be coded */
  SelectDest *pDest     /* What to do with query results */
){
  int rc = SQLITE_OK;   /* Success code from a subroutine */
  Select *pPrior;       /* Another SELECT immediately to our left */
  Vdbe *v;              /* Generate code to this VDBE */
  SelectDest dest;      /* Alternative data destination */
  Select *pDelete = 0;  /* Chain of simple selects to delete */
  sqlite3 *db;          /* Database connection */

  /* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs.  Only
  ** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT.
  */
  assert( p && p->pPrior );  /* Calling function guarantees this much */
  db = pParse->db;
  pPrior = p->pPrior;
  assert( pPrior->pRightmost!=pPrior );
  assert( pPrior->pRightmost==p->pRightmost );
  if( pPrior->pOrderBy ){
    sqlite3ErrorMsg(pParse,"ORDER BY clause should come after %s not before",
      selectOpName(p->op));
    rc = 1;
    goto multi_select_end;
  }
  if( pPrior->pLimit ){
    sqlite3ErrorMsg(pParse,"LIMIT clause should come after %s not before",
      selectOpName(p->op));
    rc = 1;
    goto multi_select_end;
  }

  v = sqlite3GetVdbe(pParse);
  assert( v!=0 );  /* The VDBE already created by calling function */

  /* Create the destination temporary table if necessary
  */
  dest = *pDest;
  if( dest.eDest==SRT_EphemTab ){
    assert( p->pEList );
    sqlite3VdbeAddOp2(v, OP_OpenEphemeral, dest.iParm, p->pEList->nExpr);
    dest.eDest = SRT_Table;
  }

  /* Make sure all SELECTs in the statement have the same number of elements
  ** in their result sets.
  */
  assert( p->pEList && pPrior->pEList );
  if( p->pEList->nExpr!=pPrior->pEList->nExpr ){
    sqlite3ErrorMsg(pParse, "SELECTs to the left and right of %s"
      " do not have the same number of result columns", selectOpName(p->op));
    rc = 1;
    goto multi_select_end;
  }

  /* Compound SELECTs that have an ORDER BY clause are handled separately.
  */
  if( p->pOrderBy ){
    return multiSelectOrderBy(pParse, p, pDest);
  }

  /* Generate code for the left and right SELECT statements.
  */
  switch( p->op ){
    case TK_ALL: {
      int addr = 0;
      assert( !pPrior->pLimit );
      pPrior->pLimit = p->pLimit;
      pPrior->pOffset = p->pOffset;
      rc = sqlite3Select(pParse, pPrior, &dest, 0, 0, 0);
      p->pLimit = 0;
      p->pOffset = 0;
      if( rc ){
        goto multi_select_end;
      }
      p->pPrior = 0;
      p->iLimit = pPrior->iLimit;
      p->iOffset = pPrior->iOffset;
      if( p->iLimit ){
        addr = sqlite3VdbeAddOp1(v, OP_IfZero, p->iLimit);
        VdbeComment((v, "Jump ahead if LIMIT reached"));
      }
      rc = sqlite3Select(pParse, p, &dest, 0, 0, 0);
      pDelete = p->pPrior;
      p->pPrior = pPrior;
      if( rc ){
        goto multi_select_end;
      }
      if( addr ){
        sqlite3VdbeJumpHere(v, addr);
      }
      break;
    }
    case TK_EXCEPT:
    case TK_UNION: {
      int unionTab;    /* Cursor number of the temporary table holding result */
      int op = 0;      /* One of the SRT_ operations to apply to self */
      int priorOp;     /* The SRT_ operation to apply to prior selects */
      Expr *pLimit, *pOffset; /* Saved values of p->nLimit and p->nOffset */
      int addr;
      SelectDest uniondest;

      priorOp = SRT_Union;
      if( dest.eDest==priorOp && !p->pLimit && !p->pOffset ){
        /* We can reuse a temporary table generated by a SELECT to our
        ** right.
        */
        unionTab = dest.iParm;
      }else{
        /* We will need to create our own temporary table to hold the
        ** intermediate results.
        */
        unionTab = pParse->nTab++;
        assert( p->pOrderBy==0 );
        addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, unionTab, 0);
        assert( p->addrOpenEphm[0] == -1 );
        p->addrOpenEphm[0] = addr;
        p->pRightmost->usesEphm = 1;
        assert( p->pEList );
      }

      /* Code the SELECT statements to our left
      */
      assert( !pPrior->pOrderBy );
      sqlite3SelectDestInit(&uniondest, priorOp, unionTab);
      rc = sqlite3Select(pParse, pPrior, &uniondest, 0, 0, 0);
      if( rc ){
        goto multi_select_end;
      }

      /* Code the current SELECT statement
      */
      if( p->op==TK_EXCEPT ){
        op = SRT_Except;
      }else{
        assert( p->op==TK_UNION );
        op = SRT_Union;
      }
      p->pPrior = 0;
      p->disallowOrderBy = 0;
      pLimit = p->pLimit;
      p->pLimit = 0;
      pOffset = p->pOffset;
      p->pOffset = 0;
      uniondest.eDest = op;
      rc = sqlite3Select(pParse, p, &uniondest, 0, 0, 0);
      /* Query flattening in sqlite3Select() might refill p->pOrderBy.
      ** Be sure to delete p->pOrderBy, therefore, to avoid a memory leak. */
      sqlite3ExprListDelete(db, p->pOrderBy);
      pDelete = p->pPrior;
      p->pPrior = pPrior;
      p->pOrderBy = 0;
      sqlite3ExprDelete(db, p->pLimit);
      p->pLimit = pLimit;
      p->pOffset = pOffset;
      p->iLimit = 0;
      p->iOffset = 0;
      if( rc ){
        goto multi_select_end;
      }


      /* Convert the data in the temporary table into whatever form
      ** it is that we currently need.
      */      
      if( dest.eDest!=priorOp || unionTab!=dest.iParm ){
        int iCont, iBreak, iStart;
        assert( p->pEList );
        if( dest.eDest==SRT_Callback ){
          Select *pFirst = p;
          while( pFirst->pPrior ) pFirst = pFirst->pPrior;
          generateColumnNames(pParse, 0, pFirst->pEList);
        }
        iBreak = sqlite3VdbeMakeLabel(v);
        iCont = sqlite3VdbeMakeLabel(v);
        computeLimitRegisters(pParse, p, iBreak);
        sqlite3VdbeAddOp2(v, OP_Rewind, unionTab, iBreak);
        iStart = sqlite3VdbeCurrentAddr(v);
        selectInnerLoop(pParse, p, p->pEList, unionTab, p->pEList->nExpr,
                        0, -1, &dest, iCont, iBreak);
        sqlite3VdbeResolveLabel(v, iCont);
        sqlite3VdbeAddOp2(v, OP_Next, unionTab, iStart);
        sqlite3VdbeResolveLabel(v, iBreak);
        sqlite3VdbeAddOp2(v, OP_Close, unionTab, 0);
      }
      break;
    }
    case TK_INTERSECT: {
      int tab1, tab2;
      int iCont, iBreak, iStart;
      Expr *pLimit, *pOffset;
      int addr;
      SelectDest intersectdest;
      int r1;

      /* INTERSECT is different from the others since it requires
      ** two temporary tables.  Hence it has its own case.  Begin
      ** by allocating the tables we will need.
      */
      tab1 = pParse->nTab++;
      tab2 = pParse->nTab++;
      assert( p->pOrderBy==0 );

      addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab1, 0);
      assert( p->addrOpenEphm[0] == -1 );
      p->addrOpenEphm[0] = addr;
      p->pRightmost->usesEphm = 1;
      assert( p->pEList );

      /* Code the SELECTs to our left into temporary table "tab1".
      */
      sqlite3SelectDestInit(&intersectdest, SRT_Union, tab1);
      rc = sqlite3Select(pParse, pPrior, &intersectdest, 0, 0, 0);
      if( rc ){
        goto multi_select_end;
      }

      /* Code the current SELECT into temporary table "tab2"
      */
      addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab2, 0);
      assert( p->addrOpenEphm[1] == -1 );
      p->addrOpenEphm[1] = addr;
      p->pPrior = 0;
      pLimit = p->pLimit;
      p->pLimit = 0;
      pOffset = p->pOffset;
      p->pOffset = 0;
      intersectdest.iParm = tab2;
      rc = sqlite3Select(pParse, p, &intersectdest, 0, 0, 0);
      pDelete = p->pPrior;
      p->pPrior = pPrior;
      sqlite3ExprDelete(db, p->pLimit);
      p->pLimit = pLimit;
      p->pOffset = pOffset;
      if( rc ){
        goto multi_select_end;
      }

      /* Generate code to take the intersection of the two temporary
      ** tables.
      */
      assert( p->pEList );
      if( dest.eDest==SRT_Callback ){
        Select *pFirst = p;
        while( pFirst->pPrior ) pFirst = pFirst->pPrior;
        generateColumnNames(pParse, 0, pFirst->pEList);
      }
      iBreak = sqlite3VdbeMakeLabel(v);
      iCont = sqlite3VdbeMakeLabel(v);
      computeLimitRegisters(pParse, p, iBreak);
      sqlite3VdbeAddOp2(v, OP_Rewind, tab1, iBreak);
      r1 = sqlite3GetTempReg(pParse);
      iStart = sqlite3VdbeAddOp2(v, OP_RowKey, tab1, r1);
      sqlite3VdbeAddOp3(v, OP_NotFound, tab2, iCont, r1);
      sqlite3ReleaseTempReg(pParse, r1);
      selectInnerLoop(pParse, p, p->pEList, tab1, p->pEList->nExpr,
                      0, -1, &dest, iCont, iBreak);
      sqlite3VdbeResolveLabel(v, iCont);
      sqlite3VdbeAddOp2(v, OP_Next, tab1, iStart);
      sqlite3VdbeResolveLabel(v, iBreak);
      sqlite3VdbeAddOp2(v, OP_Close, tab2, 0);
      sqlite3VdbeAddOp2(v, OP_Close, tab1, 0);
      break;
    }
  }

  /* Compute collating sequences used by 
  ** temporary tables needed to implement the compound select.
  ** Attach the KeyInfo structure to all temporary tables.
  **
  ** This section is run by the right-most SELECT statement only.
  ** SELECT statements to the left always skip this part.  The right-most
  ** SELECT might also skip this part if it has no ORDER BY clause and
  ** no temp tables are required.
  */
  if( p->usesEphm ){
    int i;                        /* Loop counter */
    KeyInfo *pKeyInfo;            /* Collating sequence for the result set */
    Select *pLoop;                /* For looping through SELECT statements */
    CollSeq **apColl;             /* For looping through pKeyInfo->aColl[] */
    int nCol;                     /* Number of columns in result set */

    assert( p->pRightmost==p );
    nCol = p->pEList->nExpr;
    pKeyInfo = sqlite3DbMallocZero(db,
                       sizeof(*pKeyInfo)+nCol*(sizeof(CollSeq*) + 1));
    if( !pKeyInfo ){
      rc = SQLITE_NOMEM;
      goto multi_select_end;
    }

    pKeyInfo->enc = ENC(db);
    pKeyInfo->nField = nCol;

    for(i=0, apColl=pKeyInfo->aColl; i<nCol; i++, apColl++){
      *apColl = multiSelectCollSeq(pParse, p, i);
      if( 0==*apColl ){
        *apColl = db->pDfltColl;
      }
    }

    for(pLoop=p; pLoop; pLoop=pLoop->pPrior){
      for(i=0; i<2; i++){
        int addr = pLoop->addrOpenEphm[i];
        if( addr<0 ){
          /* If [0] is unused then [1] is also unused.  So we can
          ** always safely abort as soon as the first unused slot is found */
          assert( pLoop->addrOpenEphm[1]<0 );
          break;
        }
        sqlite3VdbeChangeP2(v, addr, nCol);
        sqlite3VdbeChangeP4(v, addr, (char*)pKeyInfo, P4_KEYINFO);
        pLoop->addrOpenEphm[i] = -1;
      }
    }
    sqlite3DbFree(db, pKeyInfo);
  }

multi_select_end:
  pDest->iMem = dest.iMem;
  pDest->nMem = dest.nMem;
  sqlite3SelectDelete(db, pDelete);
  return rc;
}
#endif /* SQLITE_OMIT_COMPOUND_SELECT */

/*
** Code an output subroutine for a coroutine implementation of a
** SELECT statment.
**
** The data to be output is contained in pIn->iMem.  There are
** pIn->nMem columns to be output.  pDest is where the output should
** be sent.
**
** regReturn is the number of the register holding the subroutine
** return address.
**
** If regPrev>0 then it is a the first register in a vector that
** records the previous output.  mem[regPrev] is a flag that is false
** if there has been no previous output.  If regPrev>0 then code is
** generated to suppress duplicates.  pKeyInfo is used for comparing
** keys.
**
** If the LIMIT found in p->iLimit is reached, jump immediately to
** iBreak.
*/
static int generateOutputSubroutine(
  Parse *pParse,          /* Parsing context */
  Select *p,              /* The SELECT statement */
  SelectDest *pIn,        /* Coroutine supplying data */
  SelectDest *pDest,      /* Where to send the data */
  int regReturn,          /* The return address register */
  int regPrev,            /* Previous result register.  No uniqueness if 0 */
  KeyInfo *pKeyInfo,      /* For comparing with previous entry */
  int p4type,             /* The p4 type for pKeyInfo */
  int iBreak              /* Jump here if we hit the LIMIT */
){
  Vdbe *v = pParse->pVdbe;
  int iContinue;
  int addr;

  addr = sqlite3VdbeCurrentAddr(v);
  iContinue = sqlite3VdbeMakeLabel(v);

  /* Suppress duplicates for UNION, EXCEPT, and INTERSECT 
  */
  if( regPrev ){
    int j1, j2;
    j1 = sqlite3VdbeAddOp1(v, OP_IfNot, regPrev);
    j2 = sqlite3VdbeAddOp4(v, OP_Compare, pIn->iMem, regPrev+1, pIn->nMem,
                              (char*)pKeyInfo, p4type);
    sqlite3VdbeAddOp3(v, OP_Jump, j2+2, iContinue, j2+2);
    sqlite3VdbeJumpHere(v, j1);
    sqlite3ExprCodeCopy(pParse, pIn->iMem, regPrev+1, pIn->nMem);
    sqlite3VdbeAddOp2(v, OP_Integer, 1, regPrev);
  }
  if( pParse->db->mallocFailed ) return 0;

  /* Suppress the the first OFFSET entries if there is an OFFSET clause
  */
  codeOffset(v, p, iContinue);

  switch( pDest->eDest ){
    /* Store the result as data using a unique key.
    */
    case SRT_Table:
    case SRT_EphemTab: {
      int r1 = sqlite3GetTempReg(pParse);
      int r2 = sqlite3GetTempReg(pParse);
      sqlite3VdbeAddOp3(v, OP_MakeRecord, pIn->iMem, pIn->nMem, r1);
      sqlite3VdbeAddOp2(v, OP_NewRowid, pDest->iParm, r2);
      sqlite3VdbeAddOp3(v, OP_Insert, pDest->iParm, r1, r2);
      sqlite3VdbeChangeP5(v, OPFLAG_APPEND);
      sqlite3ReleaseTempReg(pParse, r2);
      sqlite3ReleaseTempReg(pParse, r1);
      break;
    }

#ifndef SQLITE_OMIT_SUBQUERY
    /* If we are creating a set for an "expr IN (SELECT ...)" construct,
    ** then there should be a single item on the stack.  Write this
    ** item into the set table with bogus data.
    */
    case SRT_Set: {
      int r1;
      assert( pIn->nMem==1 );
      p->affinity = 
         sqlite3CompareAffinity(p->pEList->a[0].pExpr, pDest->affinity);
      r1 = sqlite3GetTempReg(pParse);
      sqlite3VdbeAddOp4(v, OP_MakeRecord, pIn->iMem, 1, r1, &p->affinity, 1);
      sqlite3ExprCacheAffinityChange(pParse, pIn->iMem, 1);
      sqlite3VdbeAddOp2(v, OP_IdxInsert, pDest->iParm, r1);
      sqlite3ReleaseTempReg(pParse, r1);
      break;
    }

#if 0  /* Never occurs on an ORDER BY query */
    /* If any row exist in the result set, record that fact and abort.
    */
    case SRT_Exists: {
      sqlite3VdbeAddOp2(v, OP_Integer, 1, pDest->iParm);
      /* The LIMIT clause will terminate the loop for us */
      break;
    }
#endif

    /* If this is a scalar select that is part of an expression, then
    ** store the results in the appropriate memory cell and break out
    ** of the scan loop.
    */
    case SRT_Mem: {
      assert( pIn->nMem==1 );
      sqlite3ExprCodeMove(pParse, pIn->iMem, pDest->iParm, 1);
      /* The LIMIT clause will jump out of the loop for us */
      break;
    }
#endif /* #ifndef SQLITE_OMIT_SUBQUERY */

    /* Send the data to the callback function or to a subroutine.  In the
    ** case of a subroutine, the subroutine itself is responsible for
    ** popping the data from the stack.
    */
    case SRT_Coroutine: {
      if( pDest->iMem==0 ){
        pDest->iMem = sqlite3GetTempRange(pParse, pIn->nMem);
        pDest->nMem = pIn->nMem;
      }
      sqlite3ExprCodeMove(pParse, pIn->iMem, pDest->iMem, pDest->nMem);
      sqlite3VdbeAddOp1(v, OP_Yield, pDest->iParm);
      break;
    }

    case SRT_Callback: {
      sqlite3VdbeAddOp2(v, OP_ResultRow, pIn->iMem, pIn->nMem);
      sqlite3ExprCacheAffinityChange(pParse, pIn->iMem, pIn->nMem);
      break;
    }

#if !defined(SQLITE_OMIT_TRIGGER)
    /* Discard the results.  This is used for SELECT statements inside
    ** the body of a TRIGGER.  The purpose of such selects is to call
    ** user-defined functions that have side effects.  We do not care
    ** about the actual results of the select.
    */
    default: {
      break;
    }
#endif
  }

  /* Jump to the end of the loop if the LIMIT is reached.
  */
  if( p->iLimit ){
    sqlite3VdbeAddOp2(v, OP_AddImm, p->iLimit, -1);
    sqlite3VdbeAddOp2(v, OP_IfZero, p->iLimit, iBreak);
  }

  /* Generate the subroutine return
  */
  sqlite3VdbeResolveLabel(v, iContinue);
  sqlite3VdbeAddOp1(v, OP_Return, regReturn);

  return addr;
}

/*
** Alternative compound select code generator for cases when there
** is an ORDER BY clause.
**
** We assume a query of the following form:
**
**      <selectA>  <operator>  <selectB>  ORDER BY <orderbylist>
**
** <operator> is one of UNION ALL, UNION, EXCEPT, or INTERSECT.  The idea
** is to code both <selectA> and <selectB> with the ORDER BY clause as
** co-routines.  Then run the co-routines in parallel and merge the results
** into the output.  In addition to the two coroutines (called selectA and
** selectB) there are 7 subroutines:
**
**    outA:    Move the output of the selectA coroutine into the output
**             of the compound query.
**
**    outB:    Move the output of the selectB coroutine into the output
**             of the compound query.  (Only generated for UNION and
**             UNION ALL.  EXCEPT and INSERTSECT never output a row that
**             appears only in B.)
**
**    AltB:    Called when there is data from both coroutines and A<B.
**
**    AeqB:    Called when there is data from both coroutines and A==B.
**
**    AgtB:    Called when there is data from both coroutines and A>B.
**
**    EofA:    Called when data is exhausted from selectA.
**
**    EofB:    Called when data is exhausted from selectB.
**
** The implementation of the latter five subroutines depend on which 
** <operator> is used:
**
**
**             UNION ALL         UNION            EXCEPT          INTERSECT
**          -------------  -----------------  --------------  -----------------
**   AltB:   outA, nextA      outA, nextA       outA, nextA         nextA
**
**   AeqB:   outA, nextA         nextA             nextA         outA, nextA
**
**   AgtB:   outB, nextB      outB, nextB          nextB            nextB
**
**   EofA:   outB, nextB      outB, nextB          halt             halt
**
**   EofB:   outA, nextA      outA, nextA       outA, nextA         halt
**
** In the AltB, AeqB, and AgtB subroutines, an EOF on A following nextA
** causes an immediate jump to EofA and an EOF on B following nextB causes
** an immediate jump to EofB.  Within EofA and EofB, and EOF on entry or
** following nextX causes a jump to the end of the select processing.
**
** Duplicate removal in the UNION, EXCEPT, and INTERSECT cases is handled
** within the output subroutine.  The regPrev register set holds the previously
** output value.  A comparison is made against this value and the output
** is skipped if the next results would be the same as the previous.
**
** The implementation plan is to implement the two coroutines and seven
** subroutines first, then put the control logic at the bottom.  Like this:
**
**          goto Init
**     coA: coroutine for left query (A)
**     coB: coroutine for right query (B)
**    outA: output one row of A
**    outB: output one row of B (UNION and UNION ALL only)
**    EofA: ...
**    EofB: ...
**    AltB: ...
**    AeqB: ...
**    AgtB: ...
**    Init: initialize coroutine registers
**          yield coA
**          if eof(A) goto EofA
**          yield coB
**          if eof(B) goto EofB
**    Cmpr: Compare A, B
**          Jump AltB, AeqB, AgtB
**     End: ...
**
** We call AltB, AeqB, AgtB, EofA, and EofB "subroutines" but they are not
** actually called using Gosub and they do not Return.  EofA and EofB loop
** until all data is exhausted then jump to the "end" labe.  AltB, AeqB,
** and AgtB jump to either L2 or to one of EofA or EofB.
*/
#ifndef SQLITE_OMIT_COMPOUND_SELECT
static int multiSelectOrderBy(
  Parse *pParse,        /* Parsing context */
  Select *p,            /* The right-most of SELECTs to be coded */
  SelectDest *pDest     /* What to do with query results */
){
  int i, j;             /* Loop counters */
  Select *pPrior;       /* Another SELECT immediately to our left */
  Vdbe *v;              /* Generate code to this VDBE */
  SelectDest destA;     /* Destination for coroutine A */
  SelectDest destB;     /* Destination for coroutine B */
  int regAddrA;         /* Address register for select-A coroutine */
  int regEofA;          /* Flag to indicate when select-A is complete */
  int regAddrB;         /* Address register for select-B coroutine */
  int regEofB;          /* Flag to indicate when select-B is complete */
  int addrSelectA;      /* Address of the select-A coroutine */
  int addrSelectB;      /* Address of the select-B coroutine */
  int regOutA;          /* Address register for the output-A subroutine */
  int regOutB;          /* Address register for the output-B subroutine */
  int addrOutA;         /* Address of the output-A subroutine */
  int addrOutB;         /* Address of the output-B subroutine */
  int addrEofA;         /* Address of the select-A-exhausted subroutine */
  int addrEofB;         /* Address of the select-B-exhausted subroutine */
  int addrAltB;         /* Address of the A<B subroutine */
  int addrAeqB;         /* Address of the A==B subroutine */
  int addrAgtB;         /* Address of the A>B subroutine */
  int regLimitA;        /* Limit register for select-A */
  int regLimitB;        /* Limit register for select-A */
  int regPrev;          /* A range of registers to hold previous output */
  int savedLimit;       /* Saved value of p->iLimit */
  int savedOffset;      /* Saved value of p->iOffset */
  int labelCmpr;        /* Label for the start of the merge algorithm */
  int labelEnd;         /* Label for the end of the overall SELECT stmt */
  int j1;               /* Jump instructions that get retargetted */
  int op;               /* One of TK_ALL, TK_UNION, TK_EXCEPT, TK_INTERSECT */
  KeyInfo *pKeyDup;     /* Comparison information for duplicate removal */
  KeyInfo *pKeyMerge;   /* Comparison information for merging rows */
  sqlite3 *db;          /* Database connection */
  ExprList *pOrderBy;   /* The ORDER BY clause */
  int nOrderBy;         /* Number of terms in the ORDER BY clause */
  int *aPermute;        /* Mapping from ORDER BY terms to result set columns */
  u8 NotUsed;           /* Dummy variables */

  assert( p->pOrderBy!=0 );
  db = pParse->db;
  v = pParse->pVdbe;
  if( v==0 ) return SQLITE_NOMEM;
  labelEnd = sqlite3VdbeMakeLabel(v);
  labelCmpr = sqlite3VdbeMakeLabel(v);


  /* Patch up the ORDER BY clause
  */
  op = p->op;  
  pPrior = p->pPrior;
  assert( pPrior->pOrderBy==0 );
  pOrderBy = p->pOrderBy;
  assert( pOrderBy );
  if( processCompoundOrderBy(pParse, p) ){
    return SQLITE_ERROR;
  }
  nOrderBy = pOrderBy->nExpr;

  /* For operators other than UNION ALL we have to make sure that
  ** the ORDER BY clause covers every term of the result set.  Add
  ** terms to the ORDER BY clause as necessary.
  */
  if( op!=TK_ALL ){
    for(i=1; db->mallocFailed==0 && i<=p->pEList->nExpr; i++){
      for(j=0; j<nOrderBy; j++){
        Expr *pTerm = pOrderBy->a[j].pExpr;
        assert( pTerm->op==TK_INTEGER );
        assert( (pTerm->flags & EP_IntValue)!=0 );
        if( pTerm->iTable==i ) break;
      }
      if( j==nOrderBy ){
        Expr *pNew = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, 0);
        if( pNew==0 ) return SQLITE_NOMEM;
        pNew->flags |= EP_IntValue;
        pNew->iTable = i;
        pOrderBy = sqlite3ExprListAppend(pParse, pOrderBy, pNew, 0);
        nOrderBy++;
      }
    }
  }

  /* Compute the comparison permutation and keyinfo that is used with
  ** the permutation in order to comparisons to determine if the next
  ** row of results comes from selectA or selectB.  Also add explicit
  ** collations to the ORDER BY clause terms so that when the subqueries
  ** to the right and the left are evaluated, they use the correct
  ** collation.
  */
  aPermute = sqlite3DbMallocRaw(db, sizeof(int)*nOrderBy);
  if( aPermute ){
    for(i=0; i<nOrderBy; i++){
      Expr *pTerm = pOrderBy->a[i].pExpr;
      assert( pTerm->op==TK_INTEGER );
      assert( (pTerm->flags & EP_IntValue)!=0 );
      aPermute[i] = pTerm->iTable-1;
      assert( aPermute[i]>=0 && aPermute[i]<p->pEList->nExpr );
    }
    pKeyMerge =
      sqlite3DbMallocRaw(db, sizeof(*pKeyMerge)+nOrderBy*(sizeof(CollSeq*)+1));
    if( pKeyMerge ){
      pKeyMerge->aSortOrder = (u8*)&pKeyMerge->aColl[nOrderBy];
      pKeyMerge->nField = nOrderBy;
      pKeyMerge->enc = ENC(db);
      for(i=0; i<nOrderBy; i++){
        CollSeq *pColl;
        Expr *pTerm = pOrderBy->a[i].pExpr;
        if( pTerm->flags & EP_ExpCollate ){
          pColl = pTerm->pColl;
        }else{
          pColl = multiSelectCollSeq(pParse, p, aPermute[i]);
          pTerm->flags |= EP_ExpCollate;
          pTerm->pColl = pColl;
        }
        pKeyMerge->aColl[i] = pColl;
        pKeyMerge->aSortOrder[i] = pOrderBy->a[i].sortOrder;
      }
    }
  }else{
    pKeyMerge = 0;
  }

  /* Reattach the ORDER BY clause to the query.
  */
  p->pOrderBy = pOrderBy;
  pPrior->pOrderBy = sqlite3ExprListDup(pParse->db, pOrderBy);

  /* Allocate a range of temporary registers and the KeyInfo needed
  ** for the logic that removes duplicate result rows when the
  ** operator is UNION, EXCEPT, or INTERSECT (but not UNION ALL).
  */
  if( op==TK_ALL ){
    regPrev = 0;
  }else{
    int nExpr = p->pEList->nExpr;
    assert( nOrderBy>=nExpr );
    regPrev = sqlite3GetTempRange(pParse, nExpr+1);
    sqlite3VdbeAddOp2(v, OP_Integer, 0, regPrev);
    pKeyDup = sqlite3DbMallocZero(db,
                  sizeof(*pKeyDup) + nExpr*(sizeof(CollSeq*)+1) );
    if( pKeyDup ){
      pKeyDup->aSortOrder = (u8*)&pKeyDup->aColl[nExpr];
      pKeyDup->nField = nExpr;
      pKeyDup->enc = ENC(db);
      for(i=0; i<nExpr; i++){
        pKeyDup->aColl[i] = multiSelectCollSeq(pParse, p, i);
        pKeyDup->aSortOrder[i] = 0;
      }
    }
  }
 
  /* Separate the left and the right query from one another
  */
  p->pPrior = 0;
  pPrior->pRightmost = 0;
  processOrderGroupBy(pParse, p, p->pOrderBy, 1, &NotUsed);
  if( pPrior->pPrior==0 ){
    processOrderGroupBy(pParse, pPrior, pPrior->pOrderBy, 1, &NotUsed);
  }

  /* Compute the limit registers */
  computeLimitRegisters(pParse, p, labelEnd);
  if( p->iLimit && op==TK_ALL ){
    regLimitA = ++pParse->nMem;
    regLimitB = ++pParse->nMem;
    sqlite3VdbeAddOp2(v, OP_Copy, p->iOffset ? p->iOffset+1 : p->iLimit,
                                  regLimitA);
    sqlite3VdbeAddOp2(v, OP_Copy, regLimitA, regLimitB);
  }else{
    regLimitA = regLimitB = 0;
  }
  sqlite3ExprDelete(db, p->pLimit);
  p->pLimit = 0;
  sqlite3ExprDelete(db, p->pOffset);
  p->pOffset = 0;

  regAddrA = ++pParse->nMem;
  regEofA = ++pParse->nMem;
  regAddrB = ++pParse->nMem;
  regEofB = ++pParse->nMem;
  regOutA = ++pParse->nMem;
  regOutB = ++pParse->nMem;
  sqlite3SelectDestInit(&destA, SRT_Coroutine, regAddrA);
  sqlite3SelectDestInit(&destB, SRT_Coroutine, regAddrB);

  /* Jump past the various subroutines and coroutines to the main
  ** merge loop
  */
  j1 = sqlite3VdbeAddOp0(v, OP_Goto);
  addrSelectA = sqlite3VdbeCurrentAddr(v);


  /* Generate a coroutine to evaluate the SELECT statement to the
  ** left of the compound operator - the "A" select.
  */
  VdbeNoopComment((v, "Begin coroutine for left SELECT"));
  pPrior->iLimit = regLimitA;
  sqlite3Select(pParse, pPrior, &destA, 0, 0, 0);
  sqlite3VdbeAddOp2(v, OP_Integer, 1, regEofA);
  sqlite3VdbeAddOp1(v, OP_Yield, regAddrA);
  VdbeNoopComment((v, "End coroutine for left SELECT"));

  /* Generate a coroutine to evaluate the SELECT statement on 
  ** the right - the "B" select
  */
  addrSelectB = sqlite3VdbeCurrentAddr(v);
  VdbeNoopComment((v, "Begin coroutine for right SELECT"));
  savedLimit = p->iLimit;
  savedOffset = p->iOffset;
  p->iLimit = regLimitB;
  p->iOffset = 0;  
  sqlite3Select(pParse, p, &destB, 0, 0, 0);
  p->iLimit = savedLimit;
  p->iOffset = savedOffset;
  sqlite3VdbeAddOp2(v, OP_Integer, 1, regEofB);
  sqlite3VdbeAddOp1(v, OP_Yield, regAddrB);
  VdbeNoopComment((v, "End coroutine for right SELECT"));

  /* Generate a subroutine that outputs the current row of the A
  ** select as the next output row of the compound select.
  */
  VdbeNoopComment((v, "Output routine for A"));
  addrOutA = generateOutputSubroutine(pParse,
                 p, &destA, pDest, regOutA,
                 regPrev, pKeyDup, P4_KEYINFO_HANDOFF, labelEnd);
  
  /* Generate a subroutine that outputs the current row of the B
  ** select as the next output row of the compound select.
  */
  if( op==TK_ALL || op==TK_UNION ){
    VdbeNoopComment((v, "Output routine for B"));
    addrOutB = generateOutputSubroutine(pParse,
                 p, &destB, pDest, regOutB,
                 regPrev, pKeyDup, P4_KEYINFO_STATIC, labelEnd);
  }

  /* Generate a subroutine to run when the results from select A
  ** are exhausted and only data in select B remains.
  */
  VdbeNoopComment((v, "eof-A subroutine"));
  if( op==TK_EXCEPT || op==TK_INTERSECT ){
    addrEofA = sqlite3VdbeAddOp2(v, OP_Goto, 0, labelEnd);
  }else{  
    addrEofA = sqlite3VdbeAddOp2(v, OP_If, regEofB, labelEnd);
    sqlite3VdbeAddOp2(v, OP_Gosub, regOutB, addrOutB);
    sqlite3VdbeAddOp1(v, OP_Yield, regAddrB);
    sqlite3VdbeAddOp2(v, OP_Goto, 0, addrEofA);
  }

  /* Generate a subroutine to run when the results from select B
  ** are exhausted and only data in select A remains.
  */
  if( op==TK_INTERSECT ){
    addrEofB = addrEofA;
  }else{  
    VdbeNoopComment((v, "eof-B subroutine"));
    addrEofB = sqlite3VdbeAddOp2(v, OP_If, regEofA, labelEnd);
    sqlite3VdbeAddOp2(v, OP_Gosub, regOutA, addrOutA);
    sqlite3VdbeAddOp1(v, OP_Yield, regAddrA);
    sqlite3VdbeAddOp2(v, OP_Goto, 0, addrEofB);
  }

  /* Generate code to handle the case of A<B
  */
  VdbeNoopComment((v, "A-lt-B subroutine"));
  addrAltB = sqlite3VdbeAddOp2(v, OP_Gosub, regOutA, addrOutA);
  sqlite3VdbeAddOp1(v, OP_Yield, regAddrA);
  sqlite3VdbeAddOp2(v, OP_If, regEofA, addrEofA);
  sqlite3VdbeAddOp2(v, OP_Goto, 0, labelCmpr);

  /* Generate code to handle the case of A==B
  */
  if( op==TK_ALL ){
    addrAeqB = addrAltB;
  }else if( op==TK_INTERSECT ){
    addrAeqB = addrAltB;
    addrAltB++;
  }else{
    VdbeNoopComment((v, "A-eq-B subroutine"));
    addrAeqB =
    sqlite3VdbeAddOp1(v, OP_Yield, regAddrA);
    sqlite3VdbeAddOp2(v, OP_If, regEofA, addrEofA);
    sqlite3VdbeAddOp2(v, OP_Goto, 0, labelCmpr);
  }

  /* Generate code to handle the case of A>B
  */
  VdbeNoopComment((v, "A-gt-B subroutine"));
  addrAgtB = sqlite3VdbeCurrentAddr(v);
  if( op==TK_ALL || op==TK_UNION ){
    sqlite3VdbeAddOp2(v, OP_Gosub, regOutB, addrOutB);
  }
  sqlite3VdbeAddOp1(v, OP_Yield, regAddrB);
  sqlite3VdbeAddOp2(v, OP_If, regEofB, addrEofB);
  sqlite3VdbeAddOp2(v, OP_Goto, 0, labelCmpr);

  /* This code runs once to initialize everything.
  */
  sqlite3VdbeJumpHere(v, j1);
  sqlite3VdbeAddOp2(v, OP_Integer, 0, regEofA);
  sqlite3VdbeAddOp2(v, OP_Integer, 0, regEofB);
  sqlite3VdbeAddOp2(v, OP_Gosub, regAddrA, addrSelectA);
  sqlite3VdbeAddOp2(v, OP_Gosub, regAddrB, addrSelectB);
  sqlite3VdbeAddOp2(v, OP_If, regEofA, addrEofA);
  sqlite3VdbeAddOp2(v, OP_If, regEofB, addrEofB);

  /* Implement the main merge loop
  */
  sqlite3VdbeResolveLabel(v, labelCmpr);
  sqlite3VdbeAddOp4(v, OP_Permutation, 0, 0, 0, (char*)aPermute, P4_INTARRAY);
  sqlite3VdbeAddOp4(v, OP_Compare, destA.iMem, destB.iMem, nOrderBy,
                         (char*)pKeyMerge, P4_KEYINFO_HANDOFF);
  sqlite3VdbeAddOp3(v, OP_Jump, addrAltB, addrAeqB, addrAgtB);

  /* Release temporary registers
  */
  if( regPrev ){
    sqlite3ReleaseTempRange(pParse, regPrev, nOrderBy+1);
  }

  /* Jump to the this point in order to terminate the query.
  */
  sqlite3VdbeResolveLabel(v, labelEnd);

  /* Set the number of output columns
  */
  if( pDest->eDest==SRT_Callback ){
    Select *pFirst = pPrior;
    while( pFirst->pPrior ) pFirst = pFirst->pPrior;
    generateColumnNames(pParse, 0, pFirst->pEList);
  }

  /* Reassembly the compound query so that it will be freed correctly
  ** by the calling function */
  if( p->pPrior ){
    sqlite3SelectDelete(db, p->pPrior);
  }
  p->pPrior = pPrior;

  /*** TBD:  Insert subroutine calls to close cursors on incomplete
  **** subqueries ****/
  return SQLITE_OK;
}
#endif

#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
/* Forward Declarations */
static void substExprList(sqlite3*, ExprList*, int, ExprList*);
static void substSelect(sqlite3*, Select *, int, ExprList *);

/*
** Scan through the expression pExpr.  Replace every reference to
** a column in table number iTable with a copy of the iColumn-th
** entry in pEList.  (But leave references to the ROWID column 
** unchanged.)
**
** This routine is part of the flattening procedure.  A subquery
** whose result set is defined by pEList appears as entry in the
** FROM clause of a SELECT such that the VDBE cursor assigned to that
** FORM clause entry is iTable.  This routine make the necessary 
** changes to pExpr so that it refers directly to the source table
** of the subquery rather the result set of the subquery.
*/
static void substExpr(
  sqlite3 *db,        /* Report malloc errors to this connection */
  Expr *pExpr,        /* Expr in which substitution occurs */
  int iTable,         /* Table to be substituted */
  ExprList *pEList    /* Substitute expressions */
){
  if( pExpr==0 ) return;
  if( pExpr->op==TK_COLUMN && pExpr->iTable==iTable ){
    if( pExpr->iColumn<0 ){
      pExpr->op = TK_NULL;
    }else{
      Expr *pNew;
      assert( pEList!=0 && pExpr->iColumn<pEList->nExpr );
      assert( pExpr->pLeft==0 && pExpr->pRight==0 && pExpr->pList==0 );
      pNew = pEList->a[pExpr->iColumn].pExpr;
      assert( pNew!=0 );
      pExpr->op = pNew->op;
      assert( pExpr->pLeft==0 );
      pExpr->pLeft = sqlite3ExprDup(db, pNew->pLeft);
      assert( pExpr->pRight==0 );
      pExpr->pRight = sqlite3ExprDup(db, pNew->pRight);
      assert( pExpr->pList==0 );
      pExpr->pList = sqlite3ExprListDup(db, pNew->pList);
      pExpr->iTable = pNew->iTable;
      pExpr->pTab = pNew->pTab;
      pExpr->iColumn = pNew->iColumn;
      pExpr->iAgg = pNew->iAgg;
      sqlite3TokenCopy(db, &pExpr->token, &pNew->token);
      sqlite3TokenCopy(db, &pExpr->span, &pNew->span);
      pExpr->pSelect = sqlite3SelectDup(db, pNew->pSelect);
      pExpr->flags = pNew->flags;
    }
  }else{
    substExpr(db, pExpr->pLeft, iTable, pEList);
    substExpr(db, pExpr->pRight, iTable, pEList);
    substSelect(db, pExpr->pSelect, iTable, pEList);
    substExprList(db, pExpr->pList, iTable, pEList);
  }
}
static void substExprList(
  sqlite3 *db,         /* Report malloc errors here */
  ExprList *pList,     /* List to scan and in which to make substitutes */
  int iTable,          /* Table to be substituted */
  ExprList *pEList     /* Substitute values */
){
  int i;
  if( pList==0 ) return;
  for(i=0; i<pList->nExpr; i++){
    substExpr(db, pList->a[i].pExpr, iTable, pEList);
  }
}
static void substSelect(
  sqlite3 *db,         /* Report malloc errors here */
  Select *p,           /* SELECT statement in which to make substitutions */
  int iTable,          /* Table to be replaced */
  ExprList *pEList     /* Substitute values */
){
  if( !p ) return;
  substExprList(db, p->pEList, iTable, pEList);
  substExprList(db, p->pGroupBy, iTable, pEList);
  substExprList(db, p->pOrderBy, iTable, pEList);
  substExpr(db, p->pHaving, iTable, pEList);
  substExpr(db, p->pWhere, iTable, pEList);
  substSelect(db, p->pPrior, iTable, pEList);
}
#endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */

#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
/*
** This routine attempts to flatten subqueries in order to speed
** execution.  It returns 1 if it makes changes and 0 if no flattening
** occurs.
**
** To understand the concept of flattening, consider the following
** query:
**
**     SELECT a FROM (SELECT x+y AS a FROM t1 WHERE z<100) WHERE a>5
**
** The default way of implementing this query is to execute the
** subquery first and store the results in a temporary table, then
** run the outer query on that temporary table.  This requires two
** passes over the data.  Furthermore, because the temporary table
** has no indices, the WHERE clause on the outer query cannot be
** optimized.
**
** This routine attempts to rewrite queries such as the above into
** a single flat select, like this:
**
**     SELECT x+y AS a FROM t1 WHERE z<100 AND a>5
**
** The code generated for this simpification gives the same result
** but only has to scan the data once.  And because indices might 
** exist on the table t1, a complete scan of the data might be
** avoided.
**
** Flattening is only attempted if all of the following are true:
**
**   (1)  The subquery and the outer query do not both use aggregates.
**
**   (2)  The subquery is not an aggregate or the outer query is not a join.
**
**   (3)  The subquery is not the right operand of a left outer join, or
**        the subquery is not itself a join.  (Ticket #306)
**
**   (4)  The subquery is not DISTINCT or the outer query is not a join.
**
**   (5)  The subquery is not DISTINCT or the outer query does not use
**        aggregates.
**
**   (6)  The subquery does not use aggregates or the outer query is not
**        DISTINCT.
**
**   (7)  The subquery has a FROM clause.
**
**   (8)  The subquery does not use LIMIT or the outer query is not a join.
**
**   (9)  The subquery does not use LIMIT or the outer query does not use
**        aggregates.
**
**  (10)  The subquery does not use aggregates or the outer query does not
**        use LIMIT.
**
**  (11)  The subquery and the outer query do not both have ORDER BY clauses.
**
**  (12)  The subquery is not the right term of a LEFT OUTER JOIN or the
**        subquery has no WHERE clause.  (added by ticket #350)
**
**  (13)  The subquery and outer query do not both use LIMIT
**
**  (14)  The subquery does not use OFFSET
**
**  (15)  The outer query is not part of a compound select or the
**        subquery does not have both an ORDER BY and a LIMIT clause.
**        (See ticket #2339)
**
**  (16)  The outer query is not an aggregate or the subquery does
**        not contain ORDER BY.  (Ticket #2942)  This used to not matter
**        until we introduced the group_concat() function.  
**
**  (17)  The sub-query is not a compound select, or it is a UNION ALL 
**        compound clause made up entirely of non-aggregate queries, and 
**        the parent query:
**
**          * is not itself part of a compound select,
**          * is not an aggregate or DISTINCT query, and
**          * has no other tables or sub-selects in the FROM clause.
**
**        The parent and sub-query may contain WHERE clauses. Subject to
**        rules (11), (13) and (14), they may also contain ORDER BY,
**        LIMIT and OFFSET clauses.
**
**  (18)  If the sub-query is a compound select, then all terms of the
**        ORDER by clause of the parent must be simple references to 
**        columns of the sub-query.
**
** In this routine, the "p" parameter is a pointer to the outer query.
** The subquery is p->pSrc->a[iFrom].  isAgg is true if the outer query
** uses aggregates and subqueryIsAgg is true if the subquery uses aggregates.
**
** If flattening is not attempted, this routine is a no-op and returns 0.
** If flattening is attempted this routine returns 1.
**
** All of the expression analysis must occur on both the outer query and
** the subquery before this routine runs.
*/
static int flattenSubquery(
  Parse *pParse,       /* Parsing context */
  Select *p,           /* The parent or outer SELECT statement */
  int iFrom,           /* Index in p->pSrc->a[] of the inner subquery */
  int isAgg,           /* True if outer SELECT uses aggregate functions */
  int subqueryIsAgg    /* True if the subquery uses aggregate functions */
){
  const char *zSavedAuthContext = pParse->zAuthContext;
  Select *pParent;
  Select *pSub;       /* The inner query or "subquery" */
  Select *pSub1;      /* Pointer to the rightmost select in sub-query */
  SrcList *pSrc;      /* The FROM clause of the outer query */
  SrcList *pSubSrc;   /* The FROM clause of the subquery */
  ExprList *pList;    /* The result set of the outer query */
  int iParent;        /* VDBE cursor number of the pSub result set temp table */
  int i;              /* Loop counter */
  Expr *pWhere;                    /* The WHERE clause */
  struct SrcList_item *pSubitem;   /* The subquery */
  sqlite3 *db = pParse->db;

  /* Check to see if flattening is permitted.  Return 0 if not.
  */
  if( p==0 ) return 0;
  pSrc = p->pSrc;
  assert( pSrc && iFrom>=0 && iFrom<pSrc->nSrc );
  pSubitem = &pSrc->a[iFrom];
  iParent = pSubitem->iCursor;
  pSub = pSubitem->pSelect;
  assert( pSub!=0 );
  if( isAgg && subqueryIsAgg ) return 0;                 /* Restriction (1)  */
  if( subqueryIsAgg && pSrc->nSrc>1 ) return 0;          /* Restriction (2)  */
  pSubSrc = pSub->pSrc;
  assert( pSubSrc );
  /* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants,
  ** not arbitrary expresssions, we allowed some combining of LIMIT and OFFSET
  ** because they could be computed at compile-time.  But when LIMIT and OFFSET
  ** became arbitrary expressions, we were forced to add restrictions (13)
  ** and (14). */
  if( pSub->pLimit && p->pLimit ) return 0;              /* Restriction (13) */
  if( pSub->pOffset ) return 0;                          /* Restriction (14) */
  if( p->pRightmost && pSub->pLimit && pSub->pOrderBy ){
    return 0;                                            /* Restriction (15) */
  }
  if( pSubSrc->nSrc==0 ) return 0;                       /* Restriction (7)  */
  if( (pSub->isDistinct || pSub->pLimit) 
         && (pSrc->nSrc>1 || isAgg) ){          /* Restrictions (4)(5)(8)(9) */
     return 0;       
  }
  if( p->isDistinct && subqueryIsAgg ) return 0;         /* Restriction (6)  */
  if( (p->disallowOrderBy || p->pOrderBy) && pSub->pOrderBy ){
     return 0;                                           /* Restriction (11) */
  }
  if( isAgg && pSub->pOrderBy ) return 0;                /* Restriction (16) */

  /* Restriction 3:  If the subquery is a join, make sure the subquery is 
  ** not used as the right operand of an outer join.  Examples of why this
  ** is not allowed:
  **
  **         t1 LEFT OUTER JOIN (t2 JOIN t3)
  **
  ** If we flatten the above, we would get
  **
  **         (t1 LEFT OUTER JOIN t2) JOIN t3
  **
  ** which is not at all the same thing.
  */
  if( pSubSrc->nSrc>1 && (pSubitem->jointype & JT_OUTER)!=0 ){
    return 0;
  }

  /* Restriction 12:  If the subquery is the right operand of a left outer
  ** join, make sure the subquery has no WHERE clause.
  ** An examples of why this is not allowed:
  **
  **         t1 LEFT OUTER JOIN (SELECT * FROM t2 WHERE t2.x>0)
  **
  ** If we flatten the above, we would get
  **
  **         (t1 LEFT OUTER JOIN t2) WHERE t2.x>0
  **
  ** But the t2.x>0 test will always fail on a NULL row of t2, which
  ** effectively converts the OUTER JOIN into an INNER JOIN.
  */
  if( (pSubitem->jointype & JT_OUTER)!=0 && pSub->pWhere!=0 ){
    return 0;
  }

  /* Restriction 17: If the sub-query is a compound SELECT, then it must
  ** use only the UNION ALL operator. And none of the simple select queries
  ** that make up the compound SELECT are allowed to be aggregate or distinct
  ** queries.
  */
  if( pSub->pPrior ){
    if( p->pPrior || isAgg || p->isDistinct || pSrc->nSrc!=1 ){
      return 0;
    }
    for(pSub1=pSub; pSub1; pSub1=pSub1->pPrior){
      if( pSub1->isAgg || pSub1->isDistinct 
       || (pSub1->pPrior && pSub1->op!=TK_ALL) 
       || !pSub1->pSrc || pSub1->pSrc->nSrc!=1
      ){
        return 0;
      }
    }

    /* Restriction 18. */
    if( p->pOrderBy ){
      int ii;
      for(ii=0; ii<p->pOrderBy->nExpr; ii++){
        Expr *pExpr = p->pOrderBy->a[ii].pExpr;
        if( pExpr->op!=TK_COLUMN || pExpr->iTable!=iParent ){ 
          return 0;
        }
      }
    }
  }

  pParse->zAuthContext = pSubitem->zName;
  sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0);
  pParse->zAuthContext = zSavedAuthContext;

  /* If the sub-query is a compound SELECT statement, then it must be
  ** a UNION ALL and the parent query must be of the form:
  **
  **     SELECT <expr-list> FROM (<sub-query>) <where-clause> 
  **
  ** followed by any ORDER BY, LIMIT and/or OFFSET clauses. This block
  ** creates N copies of the parent query without any ORDER BY, LIMIT or 
  ** OFFSET clauses and joins them to the left-hand-side of the original
  ** using UNION ALL operators. In this case N is the number of simple
  ** select statements in the compound sub-query.
  */
  for(pSub=pSub->pPrior; pSub; pSub=pSub->pPrior){
    Select *pNew;
    ExprList *pOrderBy = p->pOrderBy;
    Expr *pLimit = p->pLimit;
    Expr *pOffset = p->pOffset;
    Select *pPrior = p->pPrior;
    p->pOrderBy = 0;
    p->pSrc = 0;
    p->pPrior = 0;
    p->pLimit = 0;
    pNew = sqlite3SelectDup(db, p);
    pNew->pPrior = pPrior;
    p->pPrior = pNew;
    p->pOrderBy = pOrderBy;
    p->op = TK_ALL;
    p->pSrc = pSrc;
    p->pLimit = pLimit;
    p->pOffset = pOffset;
    p->pRightmost = 0;
    pNew->pRightmost = 0;
  }

  /* If we reach this point, it means flattening is permitted for the
  ** iFrom-th entry of the FROM clause in the outer query.
  */
  pSub = pSub1 = pSubitem->pSelect;
  for(pParent=p; pParent; pParent=pParent->pPrior, pSub=pSub->pPrior){
    int nSubSrc = pSubSrc->nSrc;
    int jointype = 0;
    pSubSrc = pSub->pSrc;
    pSrc = pParent->pSrc;

    /* Move all of the FROM elements of the subquery into the
    ** the FROM clause of the outer query.  Before doing this, remember
    ** the cursor number for the original outer query FROM element in
    ** iParent.  The iParent cursor will never be used.  Subsequent code
    ** will scan expressions looking for iParent references and replace
    ** those references with expressions that resolve to the subquery FROM
    ** elements we are now copying in.
    */
    if( pSrc ){
      pSubitem = &pSrc->a[iFrom];
      nSubSrc = pSubSrc->nSrc;
      jointype = pSubitem->jointype;
      sqlite3DeleteTable(pSubitem->pTab);
      sqlite3DbFree(db, pSubitem->zDatabase);
      sqlite3DbFree(db, pSubitem->zName);
      sqlite3DbFree(db, pSubitem->zAlias);
      pSubitem->pTab = 0;
      pSubitem->zDatabase = 0;
      pSubitem->zName = 0;
      pSubitem->zAlias = 0;
    }
    if( nSubSrc!=1 || !pSrc ){
      int extra = nSubSrc - 1;
      for(i=(pSrc?1:0); i<nSubSrc; i++){
        pSrc = sqlite3SrcListAppend(db, pSrc, 0, 0);
        if( pSrc==0 ){
          pParent->pSrc = 0;
          return 1;
        }
      }
      pParent->pSrc = pSrc;
      for(i=pSrc->nSrc-1; i-extra>=iFrom; i--){
        pSrc->a[i] = pSrc->a[i-extra];
      }
    }
    for(i=0; i<nSubSrc; i++){
      pSrc->a[i+iFrom] = pSubSrc->a[i];
      memset(&pSubSrc->a[i], 0, sizeof(pSubSrc->a[i]));
    }
    pSrc->a[iFrom].jointype = jointype;
  
    /* Now begin substituting subquery result set expressions for 
    ** references to the iParent in the outer query.
    ** 
    ** Example:
    **
    **   SELECT a+5, b*10 FROM (SELECT x*3 AS a, y+10 AS b FROM t1) WHERE a>b;
    **   \                     \_____________ subquery __________/          /
    **    \_____________________ outer query ______________________________/
    **
    ** We look at every expression in the outer query and every place we see
    ** "a" we substitute "x*3" and every place we see "b" we substitute "y+10".
    */
    pList = pParent->pEList;
    for(i=0; i<pList->nExpr; i++){
      Expr *pExpr;
      if( pList->a[i].zName==0 && (pExpr = pList->a[i].pExpr)->span.z!=0 ){
        pList->a[i].zName = 
               sqlite3DbStrNDup(db, (char*)pExpr->span.z, pExpr->span.n);
      }
    }
    substExprList(db, pParent->pEList, iParent, pSub->pEList);
    if( isAgg ){
      substExprList(db, pParent->pGroupBy, iParent, pSub->pEList);
      substExpr(db, pParent->pHaving, iParent, pSub->pEList);
    }
    if( pSub->pOrderBy ){
      assert( pParent->pOrderBy==0 );
      pParent->pOrderBy = pSub->pOrderBy;
      pSub->pOrderBy = 0;
    }else if( pParent->pOrderBy ){
      substExprList(db, pParent->pOrderBy, iParent, pSub->pEList);
    }
    if( pSub->pWhere ){
      pWhere = sqlite3ExprDup(db, pSub->pWhere);
    }else{
      pWhere = 0;
    }
    if( subqueryIsAgg ){
      assert( pParent->pHaving==0 );
      pParent->pHaving = pParent->pWhere;
      pParent->pWhere = pWhere;
      substExpr(db, pParent->pHaving, iParent, pSub->pEList);
      pParent->pHaving = sqlite3ExprAnd(db, pParent->pHaving, 
                                  sqlite3ExprDup(db, pSub->pHaving));
      assert( pParent->pGroupBy==0 );
      pParent->pGroupBy = sqlite3ExprListDup(db, pSub->pGroupBy);
    }else{
      substExpr(db, pParent->pWhere, iParent, pSub->pEList);
      pParent->pWhere = sqlite3ExprAnd(db, pParent->pWhere, pWhere);
    }
  
    /* The flattened query is distinct if either the inner or the
    ** outer query is distinct. 
    */
    pParent->isDistinct = pParent->isDistinct || pSub->isDistinct;
  
    /*
    ** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y;
    **
    ** One is tempted to try to add a and b to combine the limits.  But this
    ** does not work if either limit is negative.
    */
    if( pSub->pLimit ){
      pParent->pLimit = pSub->pLimit;
      pSub->pLimit = 0;
    }
  }

  /* Finially, delete what is left of the subquery and return
  ** success.
  */
  sqlite3SelectDelete(db, pSub1);

  return 1;
}
#endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */

/*
** Analyze the SELECT statement passed as an argument to see if it
** is a min() or max() query. Return WHERE_ORDERBY_MIN or WHERE_ORDERBY_MAX if 
** it is, or 0 otherwise. At present, a query is considered to be
** a min()/max() query if:
**
**   1. There is a single object in the FROM clause.
**
**   2. There is a single expression in the result set, and it is
**      either min(x) or max(x), where x is a column reference.
*/
static int minMaxQuery(Parse *pParse, Select *p){
  Expr *pExpr;
  ExprList *pEList = p->pEList;

  if( pEList->nExpr!=1 ) return WHERE_ORDERBY_NORMAL;
  pExpr = pEList->a[0].pExpr;
  pEList = pExpr->pList;
  if( pExpr->op!=TK_AGG_FUNCTION || pEList==0 || pEList->nExpr!=1 ) return 0;
  if( pEList->a[0].pExpr->op!=TK_AGG_COLUMN ) return WHERE_ORDERBY_NORMAL;
  if( pExpr->token.n!=3 ) return WHERE_ORDERBY_NORMAL;
  if( sqlite3StrNICmp((char*)pExpr->token.z,"min",3)==0 ){
    return WHERE_ORDERBY_MIN;
  }else if( sqlite3StrNICmp((char*)pExpr->token.z,"max",3)==0 ){
    return WHERE_ORDERBY_MAX;
  }
  return WHERE_ORDERBY_NORMAL;
}

/*
** This routine resolves any names used in the result set of the
** supplied SELECT statement. If the SELECT statement being resolved
** is a sub-select, then pOuterNC is a pointer to the NameContext 
** of the parent SELECT.
*/
int sqlite3SelectResolve(
  Parse *pParse,         /* The parser context */
  Select *p,             /* The SELECT statement being coded. */
  NameContext *pOuterNC  /* The outer name context. May be NULL. */
){
  ExprList *pEList;          /* Result set. */
  int i;                     /* For-loop variable used in multiple places */
  NameContext sNC;           /* Local name-context */
  ExprList *pGroupBy;        /* The group by clause */

  /* If this routine has run before, return immediately. */
  if( p->isResolved ){
    assert( !pOuterNC );
    return SQLITE_OK;
  }
  p->isResolved = 1;

  /* If there have already been errors, do nothing. */
  if( pParse->nErr>0 ){
    return SQLITE_ERROR;
  }

  /* Prepare the select statement. This call will allocate all cursors
  ** required to handle the tables and subqueries in the FROM clause.
  */
  if( prepSelectStmt(pParse, p) ){
    return SQLITE_ERROR;
  }

  /* Resolve the expressions in the LIMIT and OFFSET clauses. These
  ** are not allowed to refer to any names, so pass an empty NameContext.
  */
  memset(&sNC, 0, sizeof(sNC));
  sNC.pParse = pParse;
  if( sqlite3ExprResolveNames(&sNC, p->pLimit) ||
      sqlite3ExprResolveNames(&sNC, p->pOffset) ){
    return SQLITE_ERROR;
  }

  /* Set up the local name-context to pass to ExprResolveNames() to
  ** resolve the expression-list.
  */
  sNC.allowAgg = 1;
  sNC.pSrcList = p->pSrc;
  sNC.pNext = pOuterNC;

  /* Resolve names in the result set. */
  pEList = p->pEList;
  if( !pEList ) return SQLITE_ERROR;
  for(i=0; i<pEList->nExpr; i++){
    Expr *pX = pEList->a[i].pExpr;
    if( sqlite3ExprResolveNames(&sNC, pX) ){
      return SQLITE_ERROR;
    }
  }

  /* If there are no aggregate functions in the result-set, and no GROUP BY 
  ** expression, do not allow aggregates in any of the other expressions.
  */
  assert( !p->isAgg );
  pGroupBy = p->pGroupBy;
  if( pGroupBy || sNC.hasAgg ){
    p->isAgg = 1;
  }else{
    sNC.allowAgg = 0;
  }

  /* If a HAVING clause is present, then there must be a GROUP BY clause.
  */
  if( p->pHaving && !pGroupBy ){
    sqlite3ErrorMsg(pParse, "a GROUP BY clause is required before HAVING");
    return SQLITE_ERROR;
  }

  /* Add the expression list to the name-context before parsing the
  ** other expressions in the SELECT statement. This is so that
  ** expressions in the WHERE clause (etc.) can refer to expressions by
  ** aliases in the result set.
  **
  ** Minor point: If this is the case, then the expression will be
  ** re-evaluated for each reference to it.
  */
  sNC.pEList = p->pEList;
  if( sqlite3ExprResolveNames(&sNC, p->pWhere) ||
     sqlite3ExprResolveNames(&sNC, p->pHaving) ){
    return SQLITE_ERROR;
  }
  if( p->pPrior==0 ){
    if( processOrderGroupBy(pParse, p, p->pOrderBy, 1, &sNC.hasAgg) ){
      return SQLITE_ERROR;
    }
  }
  if( processOrderGroupBy(pParse, p, pGroupBy, 0, &sNC.hasAgg) ){
    return SQLITE_ERROR;
  }

  if( pParse->db->mallocFailed ){
    return SQLITE_NOMEM;
  }

  /* Make sure the GROUP BY clause does not contain aggregate functions.
  */
  if( pGroupBy ){
    struct ExprList_item *pItem;
  
    for(i=0, pItem=pGroupBy->a; i<pGroupBy->nExpr; i++, pItem++){
      if( ExprHasProperty(pItem->pExpr, EP_Agg) ){
        sqlite3ErrorMsg(pParse, "aggregate functions are not allowed in "
            "the GROUP BY clause");
        return SQLITE_ERROR;
      }
    }
  }

  /* If this is one SELECT of a compound, be sure to resolve names
  ** in the other SELECTs.
  */
  if( p->pPrior ){
    return sqlite3SelectResolve(pParse, p->pPrior, pOuterNC);
  }else{
    return SQLITE_OK;
  }
}

/*
** Reset the aggregate accumulator.
**
** The aggregate accumulator is a set of memory cells that hold
** intermediate results while calculating an aggregate.  This
** routine simply stores NULLs in all of those memory cells.
*/
static void resetAccumulator(Parse *pParse, AggInfo *pAggInfo){
  Vdbe *v = pParse->pVdbe;
  int i;
  struct AggInfo_func *pFunc;
  if( pAggInfo->nFunc+pAggInfo->nColumn==0 ){
    return;
  }
  for(i=0; i<pAggInfo->nColumn; i++){
    sqlite3VdbeAddOp2(v, OP_Null, 0, pAggInfo->aCol[i].iMem);
  }
  for(pFunc=pAggInfo->aFunc, i=0; i<pAggInfo->nFunc; i++, pFunc++){
    sqlite3VdbeAddOp2(v, OP_Null, 0, pFunc->iMem);
    if( pFunc->iDistinct>=0 ){
      Expr *pE = pFunc->pExpr;
      if( pE->pList==0 || pE->pList->nExpr!=1 ){
        sqlite3ErrorMsg(pParse, "DISTINCT in aggregate must be followed "
           "by an expression");
        pFunc->iDistinct = -1;
      }else{
        KeyInfo *pKeyInfo = keyInfoFromExprList(pParse, pE->pList);
        sqlite3VdbeAddOp4(v, OP_OpenEphemeral, pFunc->iDistinct, 0, 0,
                          (char*)pKeyInfo, P4_KEYINFO_HANDOFF);
      }
    }
  }
}

/*
** Invoke the OP_AggFinalize opcode for every aggregate function
** in the AggInfo structure.
*/
static void finalizeAggFunctions(Parse *pParse, AggInfo *pAggInfo){
  Vdbe *v = pParse->pVdbe;
  int i;
  struct AggInfo_func *pF;
  for(i=0, pF=pAggInfo->aFunc; i<pAggInfo->nFunc; i++, pF++){
    ExprList *pList = pF->pExpr->pList;
    sqlite3VdbeAddOp4(v, OP_AggFinal, pF->iMem, pList ? pList->nExpr : 0, 0,
                      (void*)pF->pFunc, P4_FUNCDEF);
  }
}

/*
** Update the accumulator memory cells for an aggregate based on
** the current cursor position.
*/
static void updateAccumulator(Parse *pParse, AggInfo *pAggInfo){
  Vdbe *v = pParse->pVdbe;
  int i;
  struct AggInfo_func *pF;
  struct AggInfo_col *pC;

  pAggInfo->directMode = 1;
  for(i=0, pF=pAggInfo->aFunc; i<pAggInfo->nFunc; i++, pF++){
    int nArg;
    int addrNext = 0;
    int regAgg;
    ExprList *pList = pF->pExpr->pList;
    if( pList ){
      nArg = pList->nExpr;
      regAgg = sqlite3GetTempRange(pParse, nArg);
      sqlite3ExprCodeExprList(pParse, pList, regAgg, 0);
    }else{
      nArg = 0;
      regAgg = 0;
    }
    if( pF->iDistinct>=0 ){
      addrNext = sqlite3VdbeMakeLabel(v);
      assert( nArg==1 );
      codeDistinct(pParse, pF->iDistinct, addrNext, 1, regAgg);
    }
    if( pF->pFunc->needCollSeq ){
      CollSeq *pColl = 0;
      struct ExprList_item *pItem;
      int j;
      assert( pList!=0 );  /* pList!=0 if pF->pFunc->needCollSeq is true */
      for(j=0, pItem=pList->a; !pColl && j<nArg; j++, pItem++){
        pColl = sqlite3ExprCollSeq(pParse, pItem->pExpr);
      }
      if( !pColl ){
        pColl = pParse->db->pDfltColl;
      }
      sqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ);
    }
    sqlite3VdbeAddOp4(v, OP_AggStep, 0, regAgg, pF->iMem,
                      (void*)pF->pFunc, P4_FUNCDEF);
    sqlite3VdbeChangeP5(v, nArg);
    sqlite3ReleaseTempRange(pParse, regAgg, nArg);
    sqlite3ExprCacheAffinityChange(pParse, regAgg, nArg);
    if( addrNext ){
      sqlite3VdbeResolveLabel(v, addrNext);
    }
  }
  for(i=0, pC=pAggInfo->aCol; i<pAggInfo->nAccumulator; i++, pC++){
    sqlite3ExprCode(pParse, pC->pExpr, pC->iMem);
  }
  pAggInfo->directMode = 0;
}

/*
** Generate code for the given SELECT statement.
**
** The results are distributed in various ways depending on the
** contents of the SelectDest structure pointed to by argument pDest
** as follows:
**
**     pDest->eDest    Result
**     ------------    -------------------------------------------
**     SRT_Callback    Invoke the callback for each row of the result.
**
**     SRT_Mem         Store first result in memory cell pDest->iParm
**
**     SRT_Set         Store results as keys of table pDest->iParm. 
**                     Apply the affinity pDest->affinity before storing them.
**
**     SRT_Union       Store results as a key in a temporary table pDest->iParm.
**
**     SRT_Except      Remove results from the temporary table pDest->iParm.
**
**     SRT_Table       Store results in temporary table pDest->iParm
**
**     SRT_EphemTab    Create an temporary table pDest->iParm and store
**                     the result there. The cursor is left open after
**                     returning.
**
**     SRT_Coroutine   Invoke a co-routine to compute a single row of 
**                     the result
**
**     SRT_Exists      Store a 1 in memory cell pDest->iParm if the result
**                     set is not empty.
**
**     SRT_Discard     Throw the results away.
**
** See the selectInnerLoop() function for a canonical listing of the 
** allowed values of eDest and their meanings.
**
** This routine returns the number of errors.  If any errors are
** encountered, then an appropriate error message is left in
** pParse->zErrMsg.
**
** This routine does NOT free the Select structure passed in.  The
** calling function needs to do that.
**
** The pParent, parentTab, and *pParentAgg fields are filled in if this
** SELECT is a subquery.  This routine may try to combine this SELECT
** with its parent to form a single flat query.  In so doing, it might
** change the parent query from a non-aggregate to an aggregate query.
** For that reason, the pParentAgg flag is passed as a pointer, so it
** can be changed.
**
** Example 1:   The meaning of the pParent parameter.
**
**    SELECT * FROM t1 JOIN (SELECT x, count(*) FROM t2) JOIN t3;
**    \                      \_______ subquery _______/        /
**     \                                                      /
**      \____________________ outer query ___________________/
**
** This routine is called for the outer query first.   For that call,
** pParent will be NULL.  During the processing of the outer query, this 
** routine is called recursively to handle the subquery.  For the recursive
** call, pParent will point to the outer query.  Because the subquery is
** the second element in a three-way join, the parentTab parameter will
** be 1 (the 2nd value of a 0-indexed array.)
*/
int sqlite3Select(
  Parse *pParse,         /* The parser context */
  Select *p,             /* The SELECT statement being coded. */
  SelectDest *pDest,     /* What to do with the query results */
  Select *pParent,       /* Another SELECT for which this is a sub-query */
  int parentTab,         /* Index in pParent->pSrc of this query */
  int *pParentAgg        /* True if pParent uses aggregate functions */
){
  int i, j;              /* Loop counters */
  WhereInfo *pWInfo;     /* Return from sqlite3WhereBegin() */
  Vdbe *v;               /* The virtual machine under construction */
  int isAgg;             /* True for select lists like "count(*)" */
  ExprList *pEList;      /* List of columns to extract. */
  SrcList *pTabList;     /* List of tables to select from */
  Expr *pWhere;          /* The WHERE clause.  May be NULL */
  ExprList *pOrderBy;    /* The ORDER BY clause.  May be NULL */
  ExprList *pGroupBy;    /* The GROUP BY clause.  May be NULL */
  Expr *pHaving;         /* The HAVING clause.  May be NULL */
  int isDistinct;        /* True if the DISTINCT keyword is present */
  int distinct;          /* Table to use for the distinct set */
  int rc = 1;            /* Value to return from this function */
  int addrSortIndex;     /* Address of an OP_OpenEphemeral instruction */
  AggInfo sAggInfo;      /* Information used by aggregate queries */
  int iEnd;              /* Address of the end of the query */
  sqlite3 *db;           /* The database connection */

  db = pParse->db;
  if( p==0 || db->mallocFailed || pParse->nErr ){
    return 1;
  }
  if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1;
  memset(&sAggInfo, 0, sizeof(sAggInfo));

  pOrderBy = p->pOrderBy;
  if( IgnorableOrderby(pDest) ){
    p->pOrderBy = 0;

    /* In these cases the DISTINCT operator makes no difference to the
    ** results, so remove it if it were specified.
    */
    assert(pDest->eDest==SRT_Exists || pDest->eDest==SRT_Union || 
           pDest->eDest==SRT_Except || pDest->eDest==SRT_Discard);
    p->isDistinct = 0;
  }
  if( sqlite3SelectResolve(pParse, p, 0) ){
    goto select_end;
  }
  p->pOrderBy = pOrderBy;


  /* Make local copies of the parameters for this query.
  */
  pTabList = p->pSrc;
  isAgg = p->isAgg;
  pEList = p->pEList;
  if( pEList==0 ) goto select_end;

  /* 
  ** Do not even attempt to generate any code if we have already seen
  ** errors before this routine starts.
  */
  if( pParse->nErr>0 ) goto select_end;

  /* ORDER BY is ignored for some destinations.
  */
  if( IgnorableOrderby(pDest) ){
    pOrderBy = 0;
  }

  /* Begin generating code.
  */
  v = sqlite3GetVdbe(pParse);
  if( v==0 ) goto select_end;

  /* Generate code for all sub-queries in the FROM clause
  */
#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
  for(i=0; !p->pPrior && i<pTabList->nSrc; i++){
    struct SrcList_item *pItem = &pTabList->a[i];
    SelectDest dest;
    Select *pSub = pItem->pSelect;
    int isAggSub;
    char *zName = pItem->zName;

    if( pSub==0 || pItem->isPopulated ) continue;
    if( zName!=0 ){   /* An sql view */
      const char *zSavedAuthContext = pParse->zAuthContext;
      pParse->zAuthContext = zName;
      rc = sqlite3SelectResolve(pParse, pSub, 0);
      pParse->zAuthContext = zSavedAuthContext;
      if( rc ){
        goto select_end;
      }
    }

    /* Increment Parse.nHeight by the height of the largest expression
    ** tree refered to by this, the parent select. The child select
    ** may contain expression trees of at most
    ** (SQLITE_MAX_EXPR_DEPTH-Parse.nHeight) height. This is a bit
    ** more conservative than necessary, but much easier than enforcing
    ** an exact limit.
    */
    pParse->nHeight += sqlite3SelectExprHeight(p);

    /* Check to see if the subquery can be absorbed into the parent. */
    isAggSub = pSub->isAgg;
    if( flattenSubquery(pParse, p, i, isAgg, isAggSub) ){
      if( isAggSub ){
        p->isAgg = isAgg = 1;
      }
      i = -1;
    }else{
      sqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor);
      sqlite3Select(pParse, pSub, &dest, p, i, &isAgg);
    }
    if( pParse->nErr || db->mallocFailed ){
      goto select_end;
    }
    pParse->nHeight -= sqlite3SelectExprHeight(p);
    pTabList = p->pSrc;
    if( !IgnorableOrderby(pDest) ){
      pOrderBy = p->pOrderBy;
    }
  }
  pEList = p->pEList;
#endif
  pWhere = p->pWhere;
  pGroupBy = p->pGroupBy;
  pHaving = p->pHaving;
  isDistinct = p->isDistinct;

#ifndef SQLITE_OMIT_COMPOUND_SELECT
  /* If there is are a sequence of queries, do the earlier ones first.
  */
  if( p->pPrior ){
    if( p->pRightmost==0 ){
      Select *pLoop, *pRight = 0;
      int cnt = 0;
      int mxSelect;
      for(pLoop=p; pLoop; pLoop=pLoop->pPrior, cnt++){
        pLoop->pRightmost = p;
        pLoop->pNext = pRight;
        pRight = pLoop;
      }
      mxSelect = db->aLimit[SQLITE_LIMIT_COMPOUND_SELECT];
      if( mxSelect && cnt>mxSelect ){
        sqlite3ErrorMsg(pParse, "too many terms in compound SELECT");
        return 1;
      }
    }
    return multiSelect(pParse, p, pDest);
  }
#endif

  /* If writing to memory or generating a set
  ** only a single column may be output.
  */
#ifndef SQLITE_OMIT_SUBQUERY
  if( checkForMultiColumnSelectError(pParse, pDest, pEList->nExpr) ){
    goto select_end;
  }
#endif

  /* If possible, rewrite the query to use GROUP BY instead of DISTINCT.
  ** GROUP BY may use an index, DISTINCT never does.
  */
  if( p->isDistinct && !p->isAgg && !p->pGroupBy ){
    p->pGroupBy = sqlite3ExprListDup(db, p->pEList);
    pGroupBy = p->pGroupBy;
    p->isDistinct = 0;
    isDistinct = 0;
  }

  /* If there is an ORDER BY clause, then this sorting
  ** index might end up being unused if the data can be 
  ** extracted in pre-sorted order.  If that is the case, then the
  ** OP_OpenEphemeral instruction will be changed to an OP_Noop once
  ** we figure out that the sorting index is not needed.  The addrSortIndex
  ** variable is used to facilitate that change.
  */
  if( pOrderBy ){
    KeyInfo *pKeyInfo;
    pKeyInfo = keyInfoFromExprList(pParse, pOrderBy);
    pOrderBy->iECursor = pParse->nTab++;
    p->addrOpenEphm[2] = addrSortIndex =
      sqlite3VdbeAddOp4(v, OP_OpenEphemeral,
                           pOrderBy->iECursor, pOrderBy->nExpr+2, 0,
                           (char*)pKeyInfo, P4_KEYINFO_HANDOFF);
  }else{
    addrSortIndex = -1;
  }

  /* If the output is destined for a temporary table, open that table.
  */
  if( pDest->eDest==SRT_EphemTab ){
    sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pDest->iParm, pEList->nExpr);
  }

  /* Set the limiter.
  */
  iEnd = sqlite3VdbeMakeLabel(v);
  computeLimitRegisters(pParse, p, iEnd);

  /* Open a virtual index to use for the distinct set.
  */
  if( isDistinct ){
    KeyInfo *pKeyInfo;
    assert( isAgg || pGroupBy );
    distinct = pParse->nTab++;
    pKeyInfo = keyInfoFromExprList(pParse, p->pEList);
    sqlite3VdbeAddOp4(v, OP_OpenEphemeral, distinct, 0, 0,
                        (char*)pKeyInfo, P4_KEYINFO_HANDOFF);
  }else{
    distinct = -1;
  }

  /* Aggregate and non-aggregate queries are handled differently */
  if( !isAgg && pGroupBy==0 ){
    /* This case is for non-aggregate queries
    ** Begin the database scan
    */
    pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, &pOrderBy, 0);
    if( pWInfo==0 ) goto select_end;

    /* If sorting index that was created by a prior OP_OpenEphemeral 
    ** instruction ended up not being needed, then change the OP_OpenEphemeral
    ** into an OP_Noop.
    */
    if( addrSortIndex>=0 && pOrderBy==0 ){
      sqlite3VdbeChangeToNoop(v, addrSortIndex, 1);
      p->addrOpenEphm[2] = -1;
    }

    /* Use the standard inner loop
    */
    assert(!isDistinct);
    selectInnerLoop(pParse, p, pEList, 0, 0, pOrderBy, -1, pDest,
                    pWInfo->iContinue, pWInfo->iBreak);

    /* End the database scan loop.
    */
    sqlite3WhereEnd(pWInfo);
  }else{
    /* This is the processing for aggregate queries */
    NameContext sNC;    /* Name context for processing aggregate information */
    int iAMem;          /* First Mem address for storing current GROUP BY */
    int iBMem;          /* First Mem address for previous GROUP BY */
    int iUseFlag;       /* Mem address holding flag indicating that at least
                        ** one row of the input to the aggregator has been
                        ** processed */
    int iAbortFlag;     /* Mem address which causes query abort if positive */
    int groupBySort;    /* Rows come from source in GROUP BY order */


    /* The following variables hold addresses or labels for parts of the
    ** virtual machine program we are putting together */
    int addrOutputRow;      /* Start of subroutine that outputs a result row */
    int regOutputRow;       /* Return address register for output subroutine */
    int addrSetAbort;       /* Set the abort flag and return */
    int addrInitializeLoop; /* Start of code that initializes the input loop */
    int addrTopOfLoop;      /* Top of the input loop */
    int addrEnd;            /* End of all processing */
    int addrSortingIdx;     /* The OP_OpenEphemeral for the sorting index */
    int addrReset;          /* Subroutine for resetting the accumulator */
    int regReset;           /* Return address register for reset subroutine */

    addrEnd = sqlite3VdbeMakeLabel(v);

    /* Convert TK_COLUMN nodes into TK_AGG_COLUMN and make entries in
    ** sAggInfo for all TK_AGG_FUNCTION nodes in expressions of the
    ** SELECT statement.
    */
    memset(&sNC, 0, sizeof(sNC));
    sNC.pParse = pParse;
    sNC.pSrcList = pTabList;
    sNC.pAggInfo = &sAggInfo;
    sAggInfo.nSortingColumn = pGroupBy ? pGroupBy->nExpr+1 : 0;
    sAggInfo.pGroupBy = pGroupBy;
    sqlite3ExprAnalyzeAggList(&sNC, pEList);
    sqlite3ExprAnalyzeAggList(&sNC, pOrderBy);
    if( pHaving ){
      sqlite3ExprAnalyzeAggregates(&sNC, pHaving);
    }
    sAggInfo.nAccumulator = sAggInfo.nColumn;
    for(i=0; i<sAggInfo.nFunc; i++){
      sqlite3ExprAnalyzeAggList(&sNC, sAggInfo.aFunc[i].pExpr->pList);
    }
    if( db->mallocFailed ) goto select_end;

    /* Processing for aggregates with GROUP BY is very different and
    ** much more complex than aggregates without a GROUP BY.
    */
    if( pGroupBy ){
      KeyInfo *pKeyInfo;  /* Keying information for the group by clause */
      int j1;

      /* Create labels that we will be needing
      */
      addrInitializeLoop = sqlite3VdbeMakeLabel(v);

      /* If there is a GROUP BY clause we might need a sorting index to
      ** implement it.  Allocate that sorting index now.  If it turns out
      ** that we do not need it after all, the OpenEphemeral instruction
      ** will be converted into a Noop.  
      */
      sAggInfo.sortingIdx = pParse->nTab++;
      pKeyInfo = keyInfoFromExprList(pParse, pGroupBy);
      addrSortingIdx = sqlite3VdbeAddOp4(v, OP_OpenEphemeral, 
          sAggInfo.sortingIdx, sAggInfo.nSortingColumn, 
          0, (char*)pKeyInfo, P4_KEYINFO_HANDOFF);

      /* Initialize memory locations used by GROUP BY aggregate processing
      */
      iUseFlag = ++pParse->nMem;
      iAbortFlag = ++pParse->nMem;
      iAMem = pParse->nMem + 1;
      pParse->nMem += pGroupBy->nExpr;
      iBMem = pParse->nMem + 1;
      pParse->nMem += pGroupBy->nExpr;
      sqlite3VdbeAddOp2(v, OP_Integer, 0, iAbortFlag);
      VdbeComment((v, "clear abort flag"));
      sqlite3VdbeAddOp2(v, OP_Integer, 0, iUseFlag);
      VdbeComment((v, "indicate accumulator empty"));
      sqlite3VdbeAddOp2(v, OP_Goto, 0, addrInitializeLoop);

      /* Generate a subroutine that outputs a single row of the result
      ** set.  This subroutine first looks at the iUseFlag.  If iUseFlag
      ** is less than or equal to zero, the subroutine is a no-op.  If
      ** the processing calls for the query to abort, this subroutine
      ** increments the iAbortFlag memory location before returning in
      ** order to signal the caller to abort.
      */
      addrSetAbort = sqlite3VdbeCurrentAddr(v);
      sqlite3VdbeAddOp2(v, OP_Integer, 1, iAbortFlag);
      VdbeComment((v, "set abort flag"));
      regOutputRow = ++pParse->nMem;
      sqlite3VdbeAddOp1(v, OP_Return, regOutputRow);
      addrOutputRow = sqlite3VdbeCurrentAddr(v);
      sqlite3VdbeAddOp2(v, OP_IfPos, iUseFlag, addrOutputRow+2);
      VdbeComment((v, "Groupby result generator entry point"));
      sqlite3VdbeAddOp1(v, OP_Return, regOutputRow);
      finalizeAggFunctions(pParse, &sAggInfo);
      if( pHaving ){
        sqlite3ExprIfFalse(pParse, pHaving, addrOutputRow+1, SQLITE_JUMPIFNULL);
      }
      selectInnerLoop(pParse, p, p->pEList, 0, 0, pOrderBy,
                      distinct, pDest,
                      addrOutputRow+1, addrSetAbort);
      sqlite3VdbeAddOp1(v, OP_Return, regOutputRow);
      VdbeComment((v, "end groupby result generator"));

      /* Generate a subroutine that will reset the group-by accumulator
      */
      addrReset = sqlite3VdbeCurrentAddr(v);
      regReset = ++pParse->nMem;
      resetAccumulator(pParse, &sAggInfo);
      sqlite3VdbeAddOp1(v, OP_Return, regReset);

      /* Begin a loop that will extract all source rows in GROUP BY order.
      ** This might involve two separate loops with an OP_Sort in between, or
      ** it might be a single loop that uses an index to extract information
      ** in the right order to begin with.
      */
      sqlite3VdbeResolveLabel(v, addrInitializeLoop);
      sqlite3VdbeAddOp2(v, OP_Gosub, regReset, addrReset);
      pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, &pGroupBy, 0);
      if( pWInfo==0 ) goto select_end;
      if( pGroupBy==0 ){
        /* The optimizer is able to deliver rows in group by order so
        ** we do not have to sort.  The OP_OpenEphemeral table will be
        ** cancelled later because we still need to use the pKeyInfo
        */
        pGroupBy = p->pGroupBy;
        groupBySort = 0;
      }else{
        /* Rows are coming out in undetermined order.  We have to push
        ** each row into a sorting index, terminate the first loop,
        ** then loop over the sorting index in order to get the output
        ** in sorted order
        */
        int regBase;
        int regRecord;
        int nCol;
        int nGroupBy;

        groupBySort = 1;
        nGroupBy = pGroupBy->nExpr;
        nCol = nGroupBy + 1;
        j = nGroupBy+1;
        for(i=0; i<sAggInfo.nColumn; i++){
          if( sAggInfo.aCol[i].iSorterColumn>=j ){
            nCol++;
            j++;
          }
        }
        regBase = sqlite3GetTempRange(pParse, nCol);
        sqlite3ExprCodeExprList(pParse, pGroupBy, regBase, 0);
        sqlite3VdbeAddOp2(v, OP_Sequence, sAggInfo.sortingIdx,regBase+nGroupBy);
        j = nGroupBy+1;
        for(i=0; i<sAggInfo.nColumn; i++){
          struct AggInfo_col *pCol = &sAggInfo.aCol[i];
          if( pCol->iSorterColumn>=j ){
            int r1 = j + regBase;
#ifndef NDEBUG
            int r2 = 
#endif
                     sqlite3ExprCodeGetColumn(pParse, 
                               pCol->pTab, pCol->iColumn, pCol->iTable, r1, 0);
            j++;

            /* sAggInfo.aCol[] only contains one entry per column.  So
            ** The reference to pCol->iColumn,pCol->iTable must have been
            ** the first reference to that column.  Hence, 
            ** sqliteExprCodeGetColumn is guaranteed to put the result in
            ** the column requested. 
            */
            assert( r1==r2 );
          }
        }
        regRecord = sqlite3GetTempReg(pParse);
        sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol, regRecord);
        sqlite3VdbeAddOp2(v, OP_IdxInsert, sAggInfo.sortingIdx, regRecord);
        sqlite3ReleaseTempReg(pParse, regRecord);
        sqlite3ReleaseTempRange(pParse, regBase, nCol);
        sqlite3WhereEnd(pWInfo);
        sqlite3VdbeAddOp2(v, OP_Sort, sAggInfo.sortingIdx, addrEnd);
        VdbeComment((v, "GROUP BY sort"));
        sAggInfo.useSortingIdx = 1;
      }

      /* Evaluate the current GROUP BY terms and store in b0, b1, b2...
      ** (b0 is memory location iBMem+0, b1 is iBMem+1, and so forth)
      ** Then compare the current GROUP BY terms against the GROUP BY terms
      ** from the previous row currently stored in a0, a1, a2...
      */
      addrTopOfLoop = sqlite3VdbeCurrentAddr(v);
      for(j=0; j<pGroupBy->nExpr; j++){
        if( groupBySort ){
          sqlite3VdbeAddOp3(v, OP_Column, sAggInfo.sortingIdx, j, iBMem+j);
        }else{
          sAggInfo.directMode = 1;
          sqlite3ExprCode(pParse, pGroupBy->a[j].pExpr, iBMem+j);
        }
      }
      sqlite3VdbeAddOp4(v, OP_Compare, iAMem, iBMem, pGroupBy->nExpr,
                          (char*)pKeyInfo, P4_KEYINFO);
      j1 = sqlite3VdbeCurrentAddr(v);
      sqlite3VdbeAddOp3(v, OP_Jump, j1+1, 0, j1+1);

      /* Generate code that runs whenever the GROUP BY changes.
      ** Changes in the GROUP BY are detected by the previous code
      ** block.  If there were no changes, this block is skipped.
      **
      ** This code copies current group by terms in b0,b1,b2,...
      ** over to a0,a1,a2.  It then calls the output subroutine
      ** and resets the aggregate accumulator registers in preparation
      ** for the next GROUP BY batch.
      */
      sqlite3ExprCodeMove(pParse, iBMem, iAMem, pGroupBy->nExpr);
      sqlite3VdbeAddOp2(v, OP_Gosub, regOutputRow, addrOutputRow);
      VdbeComment((v, "output one row"));
      sqlite3VdbeAddOp2(v, OP_IfPos, iAbortFlag, addrEnd);
      VdbeComment((v, "check abort flag"));
      sqlite3VdbeAddOp2(v, OP_Gosub, regReset, addrReset);
      VdbeComment((v, "reset accumulator"));

      /* Update the aggregate accumulators based on the content of
      ** the current row
      */
      sqlite3VdbeJumpHere(v, j1);
      updateAccumulator(pParse, &sAggInfo);
      sqlite3VdbeAddOp2(v, OP_Integer, 1, iUseFlag);
      VdbeComment((v, "indicate data in accumulator"));

      /* End of the loop
      */
      if( groupBySort ){
        sqlite3VdbeAddOp2(v, OP_Next, sAggInfo.sortingIdx, addrTopOfLoop);
      }else{
        sqlite3WhereEnd(pWInfo);
        sqlite3VdbeChangeToNoop(v, addrSortingIdx, 1);
      }

      /* Output the final row of result
      */
      sqlite3VdbeAddOp2(v, OP_Gosub, regOutputRow, addrOutputRow);
      VdbeComment((v, "output final row"));
      
    } /* endif pGroupBy */
    else {
      ExprList *pMinMax = 0;
      ExprList *pDel = 0;
      u8 flag;

      /* Check if the query is of one of the following forms:
      **
      **   SELECT min(x) FROM ...
      **   SELECT max(x) FROM ...
      **
      ** If it is, then ask the code in where.c to attempt to sort results
      ** as if there was an "ORDER ON x" or "ORDER ON x DESC" clause. 
      ** If where.c is able to produce results sorted in this order, then
      ** add vdbe code to break out of the processing loop after the 
      ** first iteration (since the first iteration of the loop is 
      ** guaranteed to operate on the row with the minimum or maximum 
      ** value of x, the only row required).
      **
      ** A special flag must be passed to sqlite3WhereBegin() to slightly
      ** modify behaviour as follows:
      **
      **   + If the query is a "SELECT min(x)", then the loop coded by
      **     where.c should not iterate over any values with a NULL value
      **     for x.
      **
      **   + The optimizer code in where.c (the thing that decides which
      **     index or indices to use) should place a different priority on 
      **     satisfying the 'ORDER BY' clause than it does in other cases.
      **     Refer to code and comments in where.c for details.
      */
      flag = minMaxQuery(pParse, p);
      if( flag ){
        pDel = pMinMax = sqlite3ExprListDup(db, p->pEList->a[0].pExpr->pList);
        if( pMinMax && !db->mallocFailed ){
          pMinMax->a[0].sortOrder = flag!=WHERE_ORDERBY_MIN;
          pMinMax->a[0].pExpr->op = TK_COLUMN;
        }
      }

      /* This case runs if the aggregate has no GROUP BY clause.  The
      ** processing is much simpler since there is only a single row
      ** of output.
      */
      resetAccumulator(pParse, &sAggInfo);
      pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, &pMinMax, flag);
      if( pWInfo==0 ){
        sqlite3ExprListDelete(db, pDel);
        goto select_end;
      }
      updateAccumulator(pParse, &sAggInfo);
      if( !pMinMax && flag ){
        sqlite3VdbeAddOp2(v, OP_Goto, 0, pWInfo->iBreak);
        VdbeComment((v, "%s() by index",(flag==WHERE_ORDERBY_MIN?"min":"max")));
      }
      sqlite3WhereEnd(pWInfo);
      finalizeAggFunctions(pParse, &sAggInfo);
      pOrderBy = 0;
      if( pHaving ){
        sqlite3ExprIfFalse(pParse, pHaving, addrEnd, SQLITE_JUMPIFNULL);
      }
      selectInnerLoop(pParse, p, p->pEList, 0, 0, 0, -1, 
                      pDest, addrEnd, addrEnd);

      sqlite3ExprListDelete(db, pDel);
    }
    sqlite3VdbeResolveLabel(v, addrEnd);
    
  } /* endif aggregate query */

  /* If there is an ORDER BY clause, then we need to sort the results
  ** and send them to the callback one by one.
  */
  if( pOrderBy ){
    generateSortTail(pParse, p, v, pEList->nExpr, pDest);
  }

#ifndef SQLITE_OMIT_SUBQUERY
  /* If this was a subquery, we have now converted the subquery into a
  ** temporary table.  So set the SrcList_item.isPopulated flag to prevent
  ** this subquery from being evaluated again and to force the use of
  ** the temporary table.
  */
  if( pParent ){
    assert( pParent->pSrc->nSrc>parentTab );
    assert( pParent->pSrc->a[parentTab].pSelect==p );
    pParent->pSrc->a[parentTab].isPopulated = 1;
  }
#endif

  /* Jump here to skip this query
  */
  sqlite3VdbeResolveLabel(v, iEnd);

  /* The SELECT was successfully coded.   Set the return code to 0
  ** to indicate no errors.
  */
  rc = 0;

  /* Control jumps to here if an error is encountered above, or upon
  ** successful coding of the SELECT.
  */
select_end:

  /* Identify column names if we will be using them in a callback.  This
  ** step is skipped if the output is going to some other destination.
  */
  if( rc==SQLITE_OK && pDest->eDest==SRT_Callback ){
    generateColumnNames(pParse, pTabList, pEList);
  }

  sqlite3DbFree(db, sAggInfo.aCol);
  sqlite3DbFree(db, sAggInfo.aFunc);
  return rc;
}

#if defined(SQLITE_DEBUG)
/*
*******************************************************************************
** The following code is used for testing and debugging only.  The code
** that follows does not appear in normal builds.
**
** These routines are used to print out the content of all or part of a 
** parse structures such as Select or Expr.  Such printouts are useful
** for helping to understand what is happening inside the code generator
** during the execution of complex SELECT statements.
**
** These routine are not called anywhere from within the normal
** code base.  Then are intended to be called from within the debugger
** or from temporary "printf" statements inserted for debugging.
*/
void sqlite3PrintExpr(Expr *p){
  if( p->token.z && p->token.n>0 ){
    sqlite3DebugPrintf("(%.*s", p->token.n, p->token.z);
  }else{
    sqlite3DebugPrintf("(%d", p->op);
  }
  if( p->pLeft ){
    sqlite3DebugPrintf(" ");
    sqlite3PrintExpr(p->pLeft);
  }
  if( p->pRight ){
    sqlite3DebugPrintf(" ");
    sqlite3PrintExpr(p->pRight);
  }
  sqlite3DebugPrintf(")");
}
void sqlite3PrintExprList(ExprList *pList){
  int i;
  for(i=0; i<pList->nExpr; i++){
    sqlite3PrintExpr(pList->a[i].pExpr);
    if( i<pList->nExpr-1 ){
      sqlite3DebugPrintf(", ");
    }
  }
}
void sqlite3PrintSelect(Select *p, int indent){
  sqlite3DebugPrintf("%*sSELECT(%p) ", indent, "", p);
  sqlite3PrintExprList(p->pEList);
  sqlite3DebugPrintf("\n");
  if( p->pSrc ){
    char *zPrefix;
    int i;
    zPrefix = "FROM";
    for(i=0; i<p->pSrc->nSrc; i++){
      struct SrcList_item *pItem = &p->pSrc->a[i];
      sqlite3DebugPrintf("%*s ", indent+6, zPrefix);
      zPrefix = "";
      if( pItem->pSelect ){
        sqlite3DebugPrintf("(\n");
        sqlite3PrintSelect(pItem->pSelect, indent+10);
        sqlite3DebugPrintf("%*s)", indent+8, "");
      }else if( pItem->zName ){
        sqlite3DebugPrintf("%s", pItem->zName);
      }
      if( pItem->pTab ){
        sqlite3DebugPrintf("(table: %s)", pItem->pTab->zName);
      }
      if( pItem->zAlias ){
        sqlite3DebugPrintf(" AS %s", pItem->zAlias);
      }
      if( i<p->pSrc->nSrc-1 ){
        sqlite3DebugPrintf(",");
      }
      sqlite3DebugPrintf("\n");
    }
  }
  if( p->pWhere ){
    sqlite3DebugPrintf("%*s WHERE ", indent, "");
    sqlite3PrintExpr(p->pWhere);
    sqlite3DebugPrintf("\n");
  }
  if( p->pGroupBy ){
    sqlite3DebugPrintf("%*s GROUP BY ", indent, "");
    sqlite3PrintExprList(p->pGroupBy);
    sqlite3DebugPrintf("\n");
  }
  if( p->pHaving ){
    sqlite3DebugPrintf("%*s HAVING ", indent, "");
    sqlite3PrintExpr(p->pHaving);
    sqlite3DebugPrintf("\n");
  }
  if( p->pOrderBy ){
    sqlite3DebugPrintf("%*s ORDER BY ", indent, "");
    sqlite3PrintExprList(p->pOrderBy);
    sqlite3DebugPrintf("\n");
  }
}
/* End of the structure debug printing code
*****************************************************************************/
#endif /* defined(SQLITE_TEST) || defined(SQLITE_DEBUG) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/shell.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
**
** $Id: shell.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "sqlite3.h"
#include <ctype.h>
#include <stdarg.h>

#if !defined(_WIN32) && !defined(WIN32) && !defined(__OS2__)
# include <signal.h>
# include <pwd.h>
# include <unistd.h>
# include <sys/types.h>
#endif

#ifdef __OS2__
# include <unistd.h>
#endif

#if defined(HAVE_READLINE) && HAVE_READLINE==1
# include <readline/readline.h>
# include <readline/history.h>
#else
# define readline(p) local_getline(p,stdin)
# define add_history(X)
# define read_history(X)
# define write_history(X)
# define stifle_history(X)
#endif

#if defined(_WIN32) || defined(WIN32)
# include <io.h>
#else
/* Make sure isatty() has a prototype.
*/
extern int isatty();
#endif

#if defined(_WIN32_WCE)
/* Windows CE (arm-wince-mingw32ce-gcc) does not provide isatty()
 * thus we always assume that we have a console. That can be
 * overridden with the -batch command line option.
 */
#define isatty(x) 1
#endif

#if !defined(_WIN32) && !defined(WIN32) && !defined(__OS2__)
#include <sys/time.h>
#include <sys/resource.h>

/* Saved resource information for the beginning of an operation */
static struct rusage sBegin;

/* True if the timer is enabled */
static int enableTimer = 0;

/*
** Begin timing an operation
*/
static void beginTimer(void){
  if( enableTimer ){
    getrusage(RUSAGE_SELF, &sBegin);
  }
}

/* Return the difference of two time_structs in seconds */
static double timeDiff(struct timeval *pStart, struct timeval *pEnd){
  return (pEnd->tv_usec - pStart->tv_usec)*0.000001 + 
         (double)(pEnd->tv_sec - pStart->tv_sec);
}

/*
** Print the timing results.
*/
static void endTimer(void){
  if( enableTimer ){
    struct rusage sEnd;
    getrusage(RUSAGE_SELF, &sEnd);
    printf("CPU Time: user %f sys %f\n",
       timeDiff(&sBegin.ru_utime, &sEnd.ru_utime),
       timeDiff(&sBegin.ru_stime, &sEnd.ru_stime));
  }
}
#define BEGIN_TIMER beginTimer()
#define END_TIMER endTimer()
#define HAS_TIMER 1
#else
#define BEGIN_TIMER 
#define END_TIMER
#define HAS_TIMER 0
#endif


/*
** If the following flag is set, then command execution stops
** at an error if we are not interactive.
*/
static int bail_on_error = 0;

/*
** Threat stdin as an interactive input if the following variable
** is true.  Otherwise, assume stdin is connected to a file or pipe.
*/
static int stdin_is_interactive = 1;

/*
** The following is the open SQLite database.  We make a pointer
** to this database a static variable so that it can be accessed
** by the SIGINT handler to interrupt database processing.
*/
static sqlite3 *db = 0;

/*
** True if an interrupt (Control-C) has been received.
*/
static volatile int seenInterrupt = 0;

/*
** This is the name of our program. It is set in main(), used
** in a number of other places, mostly for error messages.
*/
static char *Argv0;

/*
** Prompt strings. Initialized in main. Settable with
**   .prompt main continue
*/
static char mainPrompt[20];     /* First line prompt. default: "sqlite> "*/
static char continuePrompt[20]; /* Continuation prompt. default: "   ...> " */

/*
** Write I/O traces to the following stream.
*/
#ifdef SQLITE_ENABLE_IOTRACE
static FILE *iotrace = 0;
#endif

/*
** This routine works like printf in that its first argument is a
** format string and subsequent arguments are values to be substituted
** in place of % fields.  The result of formatting this string
** is written to iotrace.
*/
#ifdef SQLITE_ENABLE_IOTRACE
static void iotracePrintf(const char *zFormat, ...){
  va_list ap;
  char *z;
  if( iotrace==0 ) return;
  va_start(ap, zFormat);
  z = sqlite3_vmprintf(zFormat, ap);
  va_end(ap);
  fprintf(iotrace, "%s", z);
  sqlite3_free(z);
}
#endif


/*
** Determines if a string is a number of not.
*/
static int isNumber(const char *z, int *realnum){
  if( *z=='-' || *z=='+' ) z++;
  if( !isdigit(*z) ){
    return 0;
  }
  z++;
  if( realnum ) *realnum = 0;
  while( isdigit(*z) ){ z++; }
  if( *z=='.' ){
    z++;
    if( !isdigit(*z) ) return 0;
    while( isdigit(*z) ){ z++; }
    if( realnum ) *realnum = 1;
  }
  if( *z=='e' || *z=='E' ){
    z++;
    if( *z=='+' || *z=='-' ) z++;
    if( !isdigit(*z) ) return 0;
    while( isdigit(*z) ){ z++; }
    if( realnum ) *realnum = 1;
  }
  return *z==0;
}

/*
** A global char* and an SQL function to access its current value 
** from within an SQL statement. This program used to use the 
** sqlite_exec_printf() API to substitue a string into an SQL statement.
** The correct way to do this with sqlite3 is to use the bind API, but
** since the shell is built around the callback paradigm it would be a lot
** of work. Instead just use this hack, which is quite harmless.
*/
static const char *zShellStatic = 0;
static void shellstaticFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  assert( 0==argc );
  assert( zShellStatic );
  sqlite3_result_text(context, zShellStatic, -1, SQLITE_STATIC);
}


/*
** This routine reads a line of text from FILE in, stores
** the text in memory obtained from malloc() and returns a pointer
** to the text.  NULL is returned at end of file, or if malloc()
** fails.
**
** The interface is like "readline" but no command-line editing
** is done.
*/
static char *local_getline(char *zPrompt, FILE *in){
  char *zLine;
  int nLine;
  int n;
  int eol;

  if( zPrompt && *zPrompt ){
    printf("%s",zPrompt);
    fflush(stdout);
  }
  nLine = 100;
  zLine = malloc( nLine );
  if( zLine==0 ) return 0;
  n = 0;
  eol = 0;
  while( !eol ){
    if( n+100>nLine ){
      nLine = nLine*2 + 100;
      zLine = realloc(zLine, nLine);
      if( zLine==0 ) return 0;
    }
    if( fgets(&zLine[n], nLine - n, in)==0 ){
      if( n==0 ){
        free(zLine);
        return 0;
      }
      zLine[n] = 0;
      eol = 1;
      break;
    }
    while( zLine[n] ){ n++; }
    if( n>0 && zLine[n-1]=='\n' ){
      n--;
      zLine[n] = 0;
      eol = 1;
    }
  }
  zLine = realloc( zLine, n+1 );
  return zLine;
}

/*
** Retrieve a single line of input text.
**
** zPrior is a string of prior text retrieved.  If not the empty
** string, then issue a continuation prompt.
*/
static char *one_input_line(const char *zPrior, FILE *in){
  char *zPrompt;
  char *zResult;
  if( in!=0 ){
    return local_getline(0, in);
  }
  if( zPrior && zPrior[0] ){
    zPrompt = continuePrompt;
  }else{
    zPrompt = mainPrompt;
  }
  zResult = readline(zPrompt);
#if defined(HAVE_READLINE) && HAVE_READLINE==1
  if( zResult && *zResult ) add_history(zResult);
#endif
  return zResult;
}

struct previous_mode_data {
  int valid;        /* Is there legit data in here? */
  int mode;
  int showHeader;
  int colWidth[100];
};

/*
** An pointer to an instance of this structure is passed from
** the main program to the callback.  This is used to communicate
** state and mode information.
*/
struct callback_data {
  sqlite3 *db;            /* The database */
  int echoOn;            /* True to echo input commands */
  int cnt;               /* Number of records displayed so far */
  FILE *out;             /* Write results here */
  int mode;              /* An output mode setting */
  int writableSchema;    /* True if PRAGMA writable_schema=ON */
  int showHeader;        /* True to show column names in List or Column mode */
  char *zDestTable;      /* Name of destination table when MODE_Insert */
  char separator[20];    /* Separator character for MODE_List */
  int colWidth[100];     /* Requested width of each column when in column mode*/
  int actualWidth[100];  /* Actual width of each column */
  char nullvalue[20];    /* The text to print when a NULL comes back from
                         ** the database */
  struct previous_mode_data explainPrev;
                         /* Holds the mode information just before
                         ** .explain ON */
  char outfile[FILENAME_MAX]; /* Filename for *out */
  const char *zDbFilename;    /* name of the database file */
};

/*
** These are the allowed modes.
*/
#define MODE_Line     0  /* One column per line.  Blank line between records */
#define MODE_Column   1  /* One record per line in neat columns */
#define MODE_List     2  /* One record per line with a separator */
#define MODE_Semi     3  /* Same as MODE_List but append ";" to each line */
#define MODE_Html     4  /* Generate an XHTML table */
#define MODE_Insert   5  /* Generate SQL "insert" statements */
#define MODE_Tcl      6  /* Generate ANSI-C or TCL quoted elements */
#define MODE_Csv      7  /* Quote strings, numbers are plain */
#define MODE_Explain  8  /* Like MODE_Column, but do not truncate data */

static const char *modeDescr[] = {
  "line",
  "column",
  "list",
  "semi",
  "html",
  "insert",
  "tcl",
  "csv",
  "explain",
};

/*
** Number of elements in an array
*/
#define ArraySize(X)  (sizeof(X)/sizeof(X[0]))

/*
** Output the given string as a quoted string using SQL quoting conventions.
*/
static void output_quoted_string(FILE *out, const char *z){
  int i;
  int nSingle = 0;
  for(i=0; z[i]; i++){
    if( z[i]=='\'' ) nSingle++;
  }
  if( nSingle==0 ){
    fprintf(out,"'%s'",z);
  }else{
    fprintf(out,"'");
    while( *z ){
      for(i=0; z[i] && z[i]!='\''; i++){}
      if( i==0 ){
        fprintf(out,"''");
        z++;
      }else if( z[i]=='\'' ){
        fprintf(out,"%.*s''",i,z);
        z += i+1;
      }else{
        fprintf(out,"%s",z);
        break;
      }
    }
    fprintf(out,"'");
  }
}

/*
** Output the given string as a quoted according to C or TCL quoting rules.
*/
static void output_c_string(FILE *out, const char *z){
  unsigned int c;
  fputc('"', out);
  while( (c = *(z++))!=0 ){
    if( c=='\\' ){
      fputc(c, out);
      fputc(c, out);
    }else if( c=='\t' ){
      fputc('\\', out);
      fputc('t', out);
    }else if( c=='\n' ){
      fputc('\\', out);
      fputc('n', out);
    }else if( c=='\r' ){
      fputc('\\', out);
      fputc('r', out);
    }else if( !isprint(c) ){
      fprintf(out, "\\%03o", c&0xff);
    }else{
      fputc(c, out);
    }
  }
  fputc('"', out);
}

/*
** Output the given string with characters that are special to
** HTML escaped.
*/
static void output_html_string(FILE *out, const char *z){
  int i;
  while( *z ){
    for(i=0; z[i] && z[i]!='<' && z[i]!='&'; i++){}
    if( i>0 ){
      fprintf(out,"%.*s",i,z);
    }
    if( z[i]=='<' ){
      fprintf(out,"&lt;");
    }else if( z[i]=='&' ){
      fprintf(out,"&amp;");
    }else{
      break;
    }
    z += i + 1;
  }
}

/*
** If a field contains any character identified by a 1 in the following
** array, then the string must be quoted for CSV.
*/
static const char needCsvQuote[] = {
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
  1, 0, 1, 0, 0, 0, 0, 1,   0, 0, 0, 0, 0, 0, 0, 0, 
  0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 
  0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 
  0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 
  0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 
  0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 1, 
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
};

/*
** Output a single term of CSV.  Actually, p->separator is used for
** the separator, which may or may not be a comma.  p->nullvalue is
** the null value.  Strings are quoted using ANSI-C rules.  Numbers
** appear outside of quotes.
*/
static void output_csv(struct callback_data *p, const char *z, int bSep){
  FILE *out = p->out;
  if( z==0 ){
    fprintf(out,"%s",p->nullvalue);
  }else{
    int i;
    int nSep = strlen(p->separator);
    for(i=0; z[i]; i++){
      if( needCsvQuote[((unsigned char*)z)[i]] 
         || (z[i]==p->separator[0] && 
             (nSep==1 || memcmp(z, p->separator, nSep)==0)) ){
        i = 0;
        break;
      }
    }
    if( i==0 ){
      putc('"', out);
      for(i=0; z[i]; i++){
        if( z[i]=='"' ) putc('"', out);
        putc(z[i], out);
      }
      putc('"', out);
    }else{
      fprintf(out, "%s", z);
    }
  }
  if( bSep ){
    fprintf(p->out, "%s", p->separator);
  }
}

#ifdef SIGINT
/*
** This routine runs when the user presses Ctrl-C
*/
static void interrupt_handler(int NotUsed){
  seenInterrupt = 1;
  if( db ) sqlite3_interrupt(db);
}
#endif

/*
** This is the callback routine that the SQLite library
** invokes for each row of a query result.
*/
static int callback(void *pArg, int nArg, char **azArg, char **azCol){
  int i;
  struct callback_data *p = (struct callback_data*)pArg;
  switch( p->mode ){
    case MODE_Line: {
      int w = 5;
      if( azArg==0 ) break;
      for(i=0; i<nArg; i++){
        int len = strlen(azCol[i] ? azCol[i] : "");
        if( len>w ) w = len;
      }
      if( p->cnt++>0 ) fprintf(p->out,"\n");
      for(i=0; i<nArg; i++){
        fprintf(p->out,"%*s = %s\n", w, azCol[i],
                azArg[i] ? azArg[i] : p->nullvalue);
      }
      break;
    }
    case MODE_Explain:
    case MODE_Column: {
      if( p->cnt++==0 ){
        for(i=0; i<nArg; i++){
          int w, n;
          if( i<ArraySize(p->colWidth) ){
            w = p->colWidth[i];
          }else{
            w = 0;
          }
          if( w<=0 ){
            w = strlen(azCol[i] ? azCol[i] : "");
            if( w<10 ) w = 10;
            n = strlen(azArg && azArg[i] ? azArg[i] : p->nullvalue);
            if( w<n ) w = n;
          }
          if( i<ArraySize(p->actualWidth) ){
            p->actualWidth[i] = w;
          }
          if( p->showHeader ){
            fprintf(p->out,"%-*.*s%s",w,w,azCol[i], i==nArg-1 ? "\n": "  ");
          }
        }
        if( p->showHeader ){
          for(i=0; i<nArg; i++){
            int w;
            if( i<ArraySize(p->actualWidth) ){
               w = p->actualWidth[i];
            }else{
               w = 10;
            }
            fprintf(p->out,"%-*.*s%s",w,w,"-----------------------------------"
                   "----------------------------------------------------------",
                    i==nArg-1 ? "\n": "  ");
          }
        }
      }
      if( azArg==0 ) break;
      for(i=0; i<nArg; i++){
        int w;
        if( i<ArraySize(p->actualWidth) ){
           w = p->actualWidth[i];
        }else{
           w = 10;
        }
        if( p->mode==MODE_Explain && azArg[i] && strlen(azArg[i])>w ){
          w = strlen(azArg[i]);
        }
        fprintf(p->out,"%-*.*s%s",w,w,
            azArg[i] ? azArg[i] : p->nullvalue, i==nArg-1 ? "\n": "  ");
      }
      break;
    }
    case MODE_Semi:
    case MODE_List: {
      if( p->cnt++==0 && p->showHeader ){
        for(i=0; i<nArg; i++){
          fprintf(p->out,"%s%s",azCol[i], i==nArg-1 ? "\n" : p->separator);
        }
      }
      if( azArg==0 ) break;
      for(i=0; i<nArg; i++){
        char *z = azArg[i];
        if( z==0 ) z = p->nullvalue;
        fprintf(p->out, "%s", z);
        if( i<nArg-1 ){
          fprintf(p->out, "%s", p->separator);
        }else if( p->mode==MODE_Semi ){
          fprintf(p->out, ";\n");
        }else{
          fprintf(p->out, "\n");
        }
      }
      break;
    }
    case MODE_Html: {
      if( p->cnt++==0 && p->showHeader ){
        fprintf(p->out,"<TR>");
        for(i=0; i<nArg; i++){
          fprintf(p->out,"<TH>%s</TH>",azCol[i]);
        }
        fprintf(p->out,"</TR>\n");
      }
      if( azArg==0 ) break;
      fprintf(p->out,"<TR>");
      for(i=0; i<nArg; i++){
        fprintf(p->out,"<TD>");
        output_html_string(p->out, azArg[i] ? azArg[i] : p->nullvalue);
        fprintf(p->out,"</TD>\n");
      }
      fprintf(p->out,"</TR>\n");
      break;
    }
    case MODE_Tcl: {
      if( p->cnt++==0 && p->showHeader ){
        for(i=0; i<nArg; i++){
          output_c_string(p->out,azCol[i] ? azCol[i] : "");
          fprintf(p->out, "%s", p->separator);
        }
        fprintf(p->out,"\n");
      }
      if( azArg==0 ) break;
      for(i=0; i<nArg; i++){
        output_c_string(p->out, azArg[i] ? azArg[i] : p->nullvalue);
        fprintf(p->out, "%s", p->separator);
      }
      fprintf(p->out,"\n");
      break;
    }
    case MODE_Csv: {
      if( p->cnt++==0 && p->showHeader ){
        for(i=0; i<nArg; i++){
          output_csv(p, azCol[i] ? azCol[i] : "", i<nArg-1);
        }
        fprintf(p->out,"\n");
      }
      if( azArg==0 ) break;
      for(i=0; i<nArg; i++){
        output_csv(p, azArg[i], i<nArg-1);
      }
      fprintf(p->out,"\n");
      break;
    }
    case MODE_Insert: {
      if( azArg==0 ) break;
      fprintf(p->out,"INSERT INTO %s VALUES(",p->zDestTable);
      for(i=0; i<nArg; i++){
        char *zSep = i>0 ? ",": "";
        if( azArg[i]==0 ){
          fprintf(p->out,"%sNULL",zSep);
        }else if( isNumber(azArg[i], 0) ){
          fprintf(p->out,"%s%s",zSep, azArg[i]);
        }else{
          if( zSep[0] ) fprintf(p->out,"%s",zSep);
          output_quoted_string(p->out, azArg[i]);
        }
      }
      fprintf(p->out,");\n");
      break;
    }
  }
  return 0;
}

/*
** Set the destination table field of the callback_data structure to
** the name of the table given.  Escape any quote characters in the
** table name.
*/
static void set_table_name(struct callback_data *p, const char *zName){
  int i, n;
  int needQuote;
  char *z;

  if( p->zDestTable ){
    free(p->zDestTable);
    p->zDestTable = 0;
  }
  if( zName==0 ) return;
  needQuote = !isalpha((unsigned char)*zName) && *zName!='_';
  for(i=n=0; zName[i]; i++, n++){
    if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ){
      needQuote = 1;
      if( zName[i]=='\'' ) n++;
    }
  }
  if( needQuote ) n += 2;
  z = p->zDestTable = malloc( n+1 );
  if( z==0 ){
    fprintf(stderr,"Out of memory!\n");
    exit(1);
  }
  n = 0;
  if( needQuote ) z[n++] = '\'';
  for(i=0; zName[i]; i++){
    z[n++] = zName[i];
    if( zName[i]=='\'' ) z[n++] = '\'';
  }
  if( needQuote ) z[n++] = '\'';
  z[n] = 0;
}

/* zIn is either a pointer to a NULL-terminated string in memory obtained
** from malloc(), or a NULL pointer. The string pointed to by zAppend is
** added to zIn, and the result returned in memory obtained from malloc().
** zIn, if it was not NULL, is freed.
**
** If the third argument, quote, is not '\0', then it is used as a 
** quote character for zAppend.
*/
static char *appendText(char *zIn, char const *zAppend, char quote){
  int len;
  int i;
  int nAppend = strlen(zAppend);
  int nIn = (zIn?strlen(zIn):0);

  len = nAppend+nIn+1;
  if( quote ){
    len += 2;
    for(i=0; i<nAppend; i++){
      if( zAppend[i]==quote ) len++;
    }
  }

  zIn = (char *)realloc(zIn, len);
  if( !zIn ){
    return 0;
  }

  if( quote ){
    char *zCsr = &zIn[nIn];
    *zCsr++ = quote;
    for(i=0; i<nAppend; i++){
      *zCsr++ = zAppend[i];
      if( zAppend[i]==quote ) *zCsr++ = quote;
    }
    *zCsr++ = quote;
    *zCsr++ = '\0';
    assert( (zCsr-zIn)==len );
  }else{
    memcpy(&zIn[nIn], zAppend, nAppend);
    zIn[len-1] = '\0';
  }

  return zIn;
}


/*
** Execute a query statement that has a single result column.  Print
** that result column on a line by itself with a semicolon terminator.
**
** This is used, for example, to show the schema of the database by
** querying the SQLITE_MASTER table.
*/
static int run_table_dump_query(FILE *out, sqlite3 *db, const char *zSelect){
  sqlite3_stmt *pSelect;
  int rc;
  rc = sqlite3_prepare(db, zSelect, -1, &pSelect, 0);
  if( rc!=SQLITE_OK || !pSelect ){
    return rc;
  }
  rc = sqlite3_step(pSelect);
  while( rc==SQLITE_ROW ){
    fprintf(out, "%s;\n", sqlite3_column_text(pSelect, 0));
    rc = sqlite3_step(pSelect);
  }
  return sqlite3_finalize(pSelect);
}


/*
** This is a different callback routine used for dumping the database.
** Each row received by this callback consists of a table name,
** the table type ("index" or "table") and SQL to create the table.
** This routine should print text sufficient to recreate the table.
*/
static int dump_callback(void *pArg, int nArg, char **azArg, char **azCol){
  int rc;
  const char *zTable;
  const char *zType;
  const char *zSql;
  struct callback_data *p = (struct callback_data *)pArg;

  if( nArg!=3 ) return 1;
  zTable = azArg[0];
  zType = azArg[1];
  zSql = azArg[2];
  
  if( strcmp(zTable, "sqlite_sequence")==0 ){
    fprintf(p->out, "DELETE FROM sqlite_sequence;\n");
  }else if( strcmp(zTable, "sqlite_stat1")==0 ){
    fprintf(p->out, "ANALYZE sqlite_master;\n");
  }else if( strncmp(zTable, "sqlite_", 7)==0 ){
    return 0;
  }else if( strncmp(zSql, "CREATE VIRTUAL TABLE", 20)==0 ){
    char *zIns;
    if( !p->writableSchema ){
      fprintf(p->out, "PRAGMA writable_schema=ON;\n");
      p->writableSchema = 1;
    }
    zIns = sqlite3_mprintf(
       "INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)"
       "VALUES('table','%q','%q',0,'%q');",
       zTable, zTable, zSql);
    fprintf(p->out, "%s\n", zIns);
    sqlite3_free(zIns);
    return 0;
  }else{
    fprintf(p->out, "%s;\n", zSql);
  }

  if( strcmp(zType, "table")==0 ){
    sqlite3_stmt *pTableInfo = 0;
    char *zSelect = 0;
    char *zTableInfo = 0;
    char *zTmp = 0;
   
    zTableInfo = appendText(zTableInfo, "PRAGMA table_info(", 0);
    zTableInfo = appendText(zTableInfo, zTable, '"');
    zTableInfo = appendText(zTableInfo, ");", 0);

    rc = sqlite3_prepare(p->db, zTableInfo, -1, &pTableInfo, 0);
    if( zTableInfo ) free(zTableInfo);
    if( rc!=SQLITE_OK || !pTableInfo ){
      return 1;
    }

    zSelect = appendText(zSelect, "SELECT 'INSERT INTO ' || ", 0);
    zTmp = appendText(zTmp, zTable, '"');
    if( zTmp ){
      zSelect = appendText(zSelect, zTmp, '\'');
    }
    zSelect = appendText(zSelect, " || ' VALUES(' || ", 0);
    rc = sqlite3_step(pTableInfo);
    while( rc==SQLITE_ROW ){
      const char *zText = (const char *)sqlite3_column_text(pTableInfo, 1);
      zSelect = appendText(zSelect, "quote(", 0);
      zSelect = appendText(zSelect, zText, '"');
      rc = sqlite3_step(pTableInfo);
      if( rc==SQLITE_ROW ){
        zSelect = appendText(zSelect, ") || ',' || ", 0);
      }else{
        zSelect = appendText(zSelect, ") ", 0);
      }
    }
    rc = sqlite3_finalize(pTableInfo);
    if( rc!=SQLITE_OK ){
      if( zSelect ) free(zSelect);
      return 1;
    }
    zSelect = appendText(zSelect, "|| ')' FROM  ", 0);
    zSelect = appendText(zSelect, zTable, '"');

    rc = run_table_dump_query(p->out, p->db, zSelect);
    if( rc==SQLITE_CORRUPT ){
      zSelect = appendText(zSelect, " ORDER BY rowid DESC", 0);
      rc = run_table_dump_query(p->out, p->db, zSelect);
    }
    if( zSelect ) free(zSelect);
  }
  return 0;
}

/*
** Run zQuery.  Use dump_callback() as the callback routine so that
** the contents of the query are output as SQL statements.
**
** If we get a SQLITE_CORRUPT error, rerun the query after appending
** "ORDER BY rowid DESC" to the end.
*/
static int run_schema_dump_query(
  struct callback_data *p, 
  const char *zQuery,
  char **pzErrMsg
){
  int rc;
  rc = sqlite3_exec(p->db, zQuery, dump_callback, p, pzErrMsg);
  if( rc==SQLITE_CORRUPT ){
    char *zQ2;
    int len = strlen(zQuery);
    if( pzErrMsg ) sqlite3_free(*pzErrMsg);
    zQ2 = malloc( len+100 );
    if( zQ2==0 ) return rc;
    sqlite3_snprintf(sizeof(zQ2), zQ2, "%s ORDER BY rowid DESC", zQuery);
    rc = sqlite3_exec(p->db, zQ2, dump_callback, p, pzErrMsg);
    free(zQ2);
  }
  return rc;
}

/*
** Text of a help message
*/
static char zHelp[] =
  ".bail ON|OFF           Stop after hitting an error.  Default OFF\n"
  ".databases             List names and files of attached databases\n"
  ".dump ?TABLE? ...      Dump the database in an SQL text format\n"
  ".echo ON|OFF           Turn command echo on or off\n"
  ".exit                  Exit this program\n"
  ".explain ON|OFF        Turn output mode suitable for EXPLAIN on or off.\n"
  ".header(s) ON|OFF      Turn display of headers on or off\n"
  ".help                  Show this message\n"
  ".import FILE TABLE     Import data from FILE into TABLE\n"
  ".indices TABLE         Show names of all indices on TABLE\n"
#ifdef SQLITE_ENABLE_IOTRACE
  ".iotrace FILE          Enable I/O diagnostic logging to FILE\n"
#endif
#ifndef SQLITE_OMIT_LOAD_EXTENSION
  ".load FILE ?ENTRY?     Load an extension library\n"
#endif
  ".mode MODE ?TABLE?     Set output mode where MODE is one of:\n"
  "                         csv      Comma-separated values\n"
  "                         column   Left-aligned columns.  (See .width)\n"
  "                         html     HTML <table> code\n"
  "                         insert   SQL insert statements for TABLE\n"
  "                         line     One value per line\n"
  "                         list     Values delimited by .separator string\n"
  "                         tabs     Tab-separated values\n"
  "                         tcl      TCL list elements\n"
  ".nullvalue STRING      Print STRING in place of NULL values\n"
  ".output FILENAME       Send output to FILENAME\n"
  ".output stdout         Send output to the screen\n"
  ".prompt MAIN CONTINUE  Replace the standard prompts\n"
  ".quit                  Exit this program\n"
  ".read FILENAME         Execute SQL in FILENAME\n"
  ".schema ?TABLE?        Show the CREATE statements\n"
  ".separator STRING      Change separator used by output mode and .import\n"
  ".show                  Show the current values for various settings\n"
  ".tables ?PATTERN?      List names of tables matching a LIKE pattern\n"
  ".timeout MS            Try opening locked tables for MS milliseconds\n"
#if HAS_TIMER
  ".timer ON|OFF          Turn the CPU timer measurement on or off\n"
#endif
  ".width NUM NUM ...     Set column widths for \"column\" mode\n"
;

/* Forward reference */
static int process_input(struct callback_data *p, FILE *in);

/*
** Make sure the database is open.  If it is not, then open it.  If
** the database fails to open, print an error message and exit.
*/
static void open_db(struct callback_data *p){
  if( p->db==0 ){
    sqlite3_open(p->zDbFilename, &p->db);
    db = p->db;
    if( db && sqlite3_errcode(db)==SQLITE_OK ){
      sqlite3_create_function(db, "shellstatic", 0, SQLITE_UTF8, 0,
          shellstaticFunc, 0, 0);
    }
    if( db==0 || SQLITE_OK!=sqlite3_errcode(db) ){
      fprintf(stderr,"Unable to open database \"%s\": %s\n", 
          p->zDbFilename, sqlite3_errmsg(db));
      exit(1);
    }
#ifndef SQLITE_OMIT_LOAD_EXTENSION
    sqlite3_enable_load_extension(p->db, 1);
#endif
  }
}

/*
** Do C-language style dequoting.
**
**    \t    -> tab
**    \n    -> newline
**    \r    -> carriage return
**    \NNN  -> ascii character NNN in octal
**    \\    -> backslash
*/
static void resolve_backslashes(char *z){
  int i, j, c;
  for(i=j=0; (c = z[i])!=0; i++, j++){
    if( c=='\\' ){
      c = z[++i];
      if( c=='n' ){
        c = '\n';
      }else if( c=='t' ){
        c = '\t';
      }else if( c=='r' ){
        c = '\r';
      }else if( c>='0' && c<='7' ){
        c -= '0';
        if( z[i+1]>='0' && z[i+1]<='7' ){
          i++;
          c = (c<<3) + z[i] - '0';
          if( z[i+1]>='0' && z[i+1]<='7' ){
            i++;
            c = (c<<3) + z[i] - '0';
          }
        }
      }
    }
    z[j] = c;
  }
  z[j] = 0;
}

/*
** Interpret zArg as a boolean value.  Return either 0 or 1.
*/
static int booleanValue(char *zArg){
  int val = atoi(zArg);
  int j;
  for(j=0; zArg[j]; j++){
    zArg[j] = tolower(zArg[j]);
  }
  if( strcmp(zArg,"on")==0 ){
    val = 1;
  }else if( strcmp(zArg,"yes")==0 ){
    val = 1;
  }
  return val;
}

/*
** If an input line begins with "." then invoke this routine to
** process that line.
**
** Return 1 on error, 2 to exit, and 0 otherwise.
*/
static int do_meta_command(char *zLine, struct callback_data *p){
  int i = 1;
  int nArg = 0;
  int n, c;
  int rc = 0;
  char *azArg[50];

  /* Parse the input line into tokens.
  */
  while( zLine[i] && nArg<ArraySize(azArg) ){
    while( isspace((unsigned char)zLine[i]) ){ i++; }
    if( zLine[i]==0 ) break;
    if( zLine[i]=='\'' || zLine[i]=='"' ){
      int delim = zLine[i++];
      azArg[nArg++] = &zLine[i];
      while( zLine[i] && zLine[i]!=delim ){ i++; }
      if( zLine[i]==delim ){
        zLine[i++] = 0;
      }
      if( delim=='"' ) resolve_backslashes(azArg[nArg-1]);
    }else{
      azArg[nArg++] = &zLine[i];
      while( zLine[i] && !isspace((unsigned char)zLine[i]) ){ i++; }
      if( zLine[i] ) zLine[i++] = 0;
      resolve_backslashes(azArg[nArg-1]);
    }
  }

  /* Process the input line.
  */
  if( nArg==0 ) return rc;
  n = strlen(azArg[0]);
  c = azArg[0][0];
  if( c=='b' && n>1 && strncmp(azArg[0], "bail", n)==0 && nArg>1 ){
    bail_on_error = booleanValue(azArg[1]);
  }else

  if( c=='d' && n>1 && strncmp(azArg[0], "databases", n)==0 ){
    struct callback_data data;
    char *zErrMsg = 0;
    open_db(p);
    memcpy(&data, p, sizeof(data));
    data.showHeader = 1;
    data.mode = MODE_Column;
    data.colWidth[0] = 3;
    data.colWidth[1] = 15;
    data.colWidth[2] = 58;
    data.cnt = 0;
    sqlite3_exec(p->db, "PRAGMA database_list; ", callback, &data, &zErrMsg);
    if( zErrMsg ){
      fprintf(stderr,"Error: %s\n", zErrMsg);
      sqlite3_free(zErrMsg);
    }
  }else

  if( c=='d' && strncmp(azArg[0], "dump", n)==0 ){
    char *zErrMsg = 0;
    open_db(p);
    fprintf(p->out, "BEGIN TRANSACTION;\n");
    p->writableSchema = 0;
    if( nArg==1 ){
      run_schema_dump_query(p, 
        "SELECT name, type, sql FROM sqlite_master "
        "WHERE sql NOT NULL AND type=='table'", 0
      );
      run_table_dump_query(p->out, p->db,
        "SELECT sql FROM sqlite_master "
        "WHERE sql NOT NULL AND type IN ('index','trigger','view')"
      );
    }else{
      int i;
      for(i=1; i<nArg; i++){
        zShellStatic = azArg[i];
        run_schema_dump_query(p,
          "SELECT name, type, sql FROM sqlite_master "
          "WHERE tbl_name LIKE shellstatic() AND type=='table'"
          "  AND sql NOT NULL", 0);
        run_table_dump_query(p->out, p->db,
          "SELECT sql FROM sqlite_master "
          "WHERE sql NOT NULL"
          "  AND type IN ('index','trigger','view')"
          "  AND tbl_name LIKE shellstatic()"
        );
        zShellStatic = 0;
      }
    }
    if( p->writableSchema ){
      fprintf(p->out, "PRAGMA writable_schema=OFF;\n");
      p->writableSchema = 0;
    }
    if( zErrMsg ){
      fprintf(stderr,"Error: %s\n", zErrMsg);
      sqlite3_free(zErrMsg);
    }else{
      fprintf(p->out, "COMMIT;\n");
    }
  }else

  if( c=='e' && strncmp(azArg[0], "echo", n)==0 && nArg>1 ){
    p->echoOn = booleanValue(azArg[1]);
  }else

  if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){
    rc = 2;
  }else

  if( c=='e' && strncmp(azArg[0], "explain", n)==0 ){
    int val = nArg>=2 ? booleanValue(azArg[1]) : 1;
    if(val == 1) {
      if(!p->explainPrev.valid) {
        p->explainPrev.valid = 1;
        p->explainPrev.mode = p->mode;
        p->explainPrev.showHeader = p->showHeader;
        memcpy(p->explainPrev.colWidth,p->colWidth,sizeof(p->colWidth));
      }
      /* We could put this code under the !p->explainValid
      ** condition so that it does not execute if we are already in
      ** explain mode. However, always executing it allows us an easy
      ** was to reset to explain mode in case the user previously
      ** did an .explain followed by a .width, .mode or .header
      ** command.
      */
      p->mode = MODE_Explain;
      p->showHeader = 1;
      memset(p->colWidth,0,ArraySize(p->colWidth));
      p->colWidth[0] = 4;                  /* addr */
      p->colWidth[1] = 13;                 /* opcode */
      p->colWidth[2] = 4;                  /* P1 */
      p->colWidth[3] = 4;                  /* P2 */
      p->colWidth[4] = 4;                  /* P3 */
      p->colWidth[5] = 13;                 /* P4 */
      p->colWidth[6] = 2;                  /* P5 */
      p->colWidth[7] = 13;                  /* Comment */
    }else if (p->explainPrev.valid) {
      p->explainPrev.valid = 0;
      p->mode = p->explainPrev.mode;
      p->showHeader = p->explainPrev.showHeader;
      memcpy(p->colWidth,p->explainPrev.colWidth,sizeof(p->colWidth));
    }
  }else

  if( c=='h' && (strncmp(azArg[0], "header", n)==0 ||
                 strncmp(azArg[0], "headers", n)==0 )&& nArg>1 ){
    p->showHeader = booleanValue(azArg[1]);
  }else

  if( c=='h' && strncmp(azArg[0], "help", n)==0 ){
    fprintf(stderr,zHelp);
  }else

  if( c=='i' && strncmp(azArg[0], "import", n)==0 && nArg>=3 ){
    char *zTable = azArg[2];    /* Insert data into this table */
    char *zFile = azArg[1];     /* The file from which to extract data */
    sqlite3_stmt *pStmt;        /* A statement */
    int rc;                     /* Result code */
    int nCol;                   /* Number of columns in the table */
    int nByte;                  /* Number of bytes in an SQL string */
    int i, j;                   /* Loop counters */
    int nSep;                   /* Number of bytes in p->separator[] */
    char *zSql;                 /* An SQL statement */
    char *zLine;                /* A single line of input from the file */
    char **azCol;               /* zLine[] broken up into columns */
    char *zCommit;              /* How to commit changes */   
    FILE *in;                   /* The input file */
    int lineno = 0;             /* Line number of input file */

    open_db(p);
    nSep = strlen(p->separator);
    if( nSep==0 ){
      fprintf(stderr, "non-null separator required for import\n");
      return 0;
    }
    zSql = sqlite3_mprintf("SELECT * FROM '%q'", zTable);
    if( zSql==0 ) return 0;
    nByte = strlen(zSql);
    rc = sqlite3_prepare(p->db, zSql, -1, &pStmt, 0);
    sqlite3_free(zSql);
    if( rc ){
      fprintf(stderr,"Error: %s\n", sqlite3_errmsg(db));
      nCol = 0;
      rc = 1;
    }else{
      nCol = sqlite3_column_count(pStmt);
    }
    sqlite3_finalize(pStmt);
    if( nCol==0 ) return 0;
    zSql = malloc( nByte + 20 + nCol*2 );
    if( zSql==0 ) return 0;
    sqlite3_snprintf(nByte+20, zSql, "INSERT INTO '%q' VALUES(?", zTable);
    j = strlen(zSql);
    for(i=1; i<nCol; i++){
      zSql[j++] = ',';
      zSql[j++] = '?';
    }
    zSql[j++] = ')';
    zSql[j] = 0;
    rc = sqlite3_prepare(p->db, zSql, -1, &pStmt, 0);
    free(zSql);
    if( rc ){
      fprintf(stderr, "Error: %s\n", sqlite3_errmsg(db));
      sqlite3_finalize(pStmt);
      return 1;
    }
    in = fopen(zFile, "rb");
    if( in==0 ){
      fprintf(stderr, "cannot open file: %s\n", zFile);
      sqlite3_finalize(pStmt);
      return 0;
    }
    azCol = malloc( sizeof(azCol[0])*(nCol+1) );
    if( azCol==0 ){
      fclose(in);
      return 0;
    }
    sqlite3_exec(p->db, "BEGIN", 0, 0, 0);
    zCommit = "COMMIT";
    while( (zLine = local_getline(0, in))!=0 ){
      char *z;
      i = 0;
      lineno++;
      azCol[0] = zLine;
      for(i=0, z=zLine; *z && *z!='\n' && *z!='\r'; z++){
        if( *z==p->separator[0] && strncmp(z, p->separator, nSep)==0 ){
          *z = 0;
          i++;
          if( i<nCol ){
            azCol[i] = &z[nSep];
            z += nSep-1;
          }
        }
      }
      *z = 0;
      if( i+1!=nCol ){
        fprintf(stderr,"%s line %d: expected %d columns of data but found %d\n",
           zFile, lineno, nCol, i+1);
        zCommit = "ROLLBACK";
        break;
      }
      for(i=0; i<nCol; i++){
        sqlite3_bind_text(pStmt, i+1, azCol[i], -1, SQLITE_STATIC);
      }
      sqlite3_step(pStmt);
      rc = sqlite3_reset(pStmt);
      free(zLine);
      if( rc!=SQLITE_OK ){
        fprintf(stderr,"Error: %s\n", sqlite3_errmsg(db));
        zCommit = "ROLLBACK";
        rc = 1;
        break;
      }
    }
    free(azCol);
    fclose(in);
    sqlite3_finalize(pStmt);
    sqlite3_exec(p->db, zCommit, 0, 0, 0);
  }else

  if( c=='i' && strncmp(azArg[0], "indices", n)==0 && nArg>1 ){
    struct callback_data data;
    char *zErrMsg = 0;
    open_db(p);
    memcpy(&data, p, sizeof(data));
    data.showHeader = 0;
    data.mode = MODE_List;
    zShellStatic = azArg[1];
    sqlite3_exec(p->db,
      "SELECT name FROM sqlite_master "
      "WHERE type='index' AND tbl_name LIKE shellstatic() "
      "UNION ALL "
      "SELECT name FROM sqlite_temp_master "
      "WHERE type='index' AND tbl_name LIKE shellstatic() "
      "ORDER BY 1",
      callback, &data, &zErrMsg
    );
    zShellStatic = 0;
    if( zErrMsg ){
      fprintf(stderr,"Error: %s\n", zErrMsg);
      sqlite3_free(zErrMsg);
    }
  }else

#ifdef SQLITE_ENABLE_IOTRACE
  if( c=='i' && strncmp(azArg[0], "iotrace", n)==0 ){
    extern void (*sqlite3IoTrace)(const char*, ...);
    if( iotrace && iotrace!=stdout ) fclose(iotrace);
    iotrace = 0;
    if( nArg<2 ){
      sqlite3IoTrace = 0;
    }else if( strcmp(azArg[1], "-")==0 ){
      sqlite3IoTrace = iotracePrintf;
      iotrace = stdout;
    }else{
      iotrace = fopen(azArg[1], "w");
      if( iotrace==0 ){
        fprintf(stderr, "cannot open \"%s\"\n", azArg[1]);
        sqlite3IoTrace = 0;
      }else{
        sqlite3IoTrace = iotracePrintf;
      }
    }
  }else
#endif

#ifndef SQLITE_OMIT_LOAD_EXTENSION
  if( c=='l' && strncmp(azArg[0], "load", n)==0 && nArg>=2 ){
    const char *zFile, *zProc;
    char *zErrMsg = 0;
    int rc;
    zFile = azArg[1];
    zProc = nArg>=3 ? azArg[2] : 0;
    open_db(p);
    rc = sqlite3_load_extension(p->db, zFile, zProc, &zErrMsg);
    if( rc!=SQLITE_OK ){
      fprintf(stderr, "%s\n", zErrMsg);
      sqlite3_free(zErrMsg);
      rc = 1;
    }
  }else
#endif

  if( c=='m' && strncmp(azArg[0], "mode", n)==0 && nArg>=2 ){
    int n2 = strlen(azArg[1]);
    if( strncmp(azArg[1],"line",n2)==0
        ||
        strncmp(azArg[1],"lines",n2)==0 ){
      p->mode = MODE_Line;
    }else if( strncmp(azArg[1],"column",n2)==0
              ||
              strncmp(azArg[1],"columns",n2)==0 ){
      p->mode = MODE_Column;
    }else if( strncmp(azArg[1],"list",n2)==0 ){
      p->mode = MODE_List;
    }else if( strncmp(azArg[1],"html",n2)==0 ){
      p->mode = MODE_Html;
    }else if( strncmp(azArg[1],"tcl",n2)==0 ){
      p->mode = MODE_Tcl;
    }else if( strncmp(azArg[1],"csv",n2)==0 ){
      p->mode = MODE_Csv;
      sqlite3_snprintf(sizeof(p->separator), p->separator, ",");
    }else if( strncmp(azArg[1],"tabs",n2)==0 ){
      p->mode = MODE_List;
      sqlite3_snprintf(sizeof(p->separator), p->separator, "\t");
    }else if( strncmp(azArg[1],"insert",n2)==0 ){
      p->mode = MODE_Insert;
      if( nArg>=3 ){
        set_table_name(p, azArg[2]);
      }else{
        set_table_name(p, "table");
      }
    }else {
      fprintf(stderr,"mode should be one of: "
         "column csv html insert line list tabs tcl\n");
    }
  }else

  if( c=='n' && strncmp(azArg[0], "nullvalue", n)==0 && nArg==2 ) {
    sqlite3_snprintf(sizeof(p->nullvalue), p->nullvalue,
                     "%.*s", (int)ArraySize(p->nullvalue)-1, azArg[1]);
  }else

  if( c=='o' && strncmp(azArg[0], "output", n)==0 && nArg==2 ){
    if( p->out!=stdout ){
      fclose(p->out);
    }
    if( strcmp(azArg[1],"stdout")==0 ){
      p->out = stdout;
      sqlite3_snprintf(sizeof(p->outfile), p->outfile, "stdout");
    }else{
      p->out = fopen(azArg[1], "wb");
      if( p->out==0 ){
        fprintf(stderr,"can't write to \"%s\"\n", azArg[1]);
        p->out = stdout;
      } else {
         sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", azArg[1]);
      }
    }
  }else

  if( c=='p' && strncmp(azArg[0], "prompt", n)==0 && (nArg==2 || nArg==3)){
    if( nArg >= 2) {
      strncpy(mainPrompt,azArg[1],(int)ArraySize(mainPrompt)-1);
    }
    if( nArg >= 3) {
      strncpy(continuePrompt,azArg[2],(int)ArraySize(continuePrompt)-1);
    }
  }else

  if( c=='q' && strncmp(azArg[0], "quit", n)==0 ){
    rc = 2;
  }else

  if( c=='r' && strncmp(azArg[0], "read", n)==0 && nArg==2 ){
    FILE *alt = fopen(azArg[1], "rb");
    if( alt==0 ){
      fprintf(stderr,"can't open \"%s\"\n", azArg[1]);
    }else{
      process_input(p, alt);
      fclose(alt);
    }
  }else

  if( c=='s' && strncmp(azArg[0], "schema", n)==0 ){
    struct callback_data data;
    char *zErrMsg = 0;
    open_db(p);
    memcpy(&data, p, sizeof(data));
    data.showHeader = 0;
    data.mode = MODE_Semi;
    if( nArg>1 ){
      int i;
      for(i=0; azArg[1][i]; i++) azArg[1][i] = tolower(azArg[1][i]);
      if( strcmp(azArg[1],"sqlite_master")==0 ){
        char *new_argv[2], *new_colv[2];
        new_argv[0] = "CREATE TABLE sqlite_master (\n"
                      "  type text,\n"
                      "  name text,\n"
                      "  tbl_name text,\n"
                      "  rootpage integer,\n"
                      "  sql text\n"
                      ")";
        new_argv[1] = 0;
        new_colv[0] = "sql";
        new_colv[1] = 0;
        callback(&data, 1, new_argv, new_colv);
      }else if( strcmp(azArg[1],"sqlite_temp_master")==0 ){
        char *new_argv[2], *new_colv[2];
        new_argv[0] = "CREATE TEMP TABLE sqlite_temp_master (\n"
                      "  type text,\n"
                      "  name text,\n"
                      "  tbl_name text,\n"
                      "  rootpage integer,\n"
                      "  sql text\n"
                      ")";
        new_argv[1] = 0;
        new_colv[0] = "sql";
        new_colv[1] = 0;
        callback(&data, 1, new_argv, new_colv);
      }else{
        zShellStatic = azArg[1];
        sqlite3_exec(p->db,
          "SELECT sql FROM "
          "  (SELECT * FROM sqlite_master UNION ALL"
          "   SELECT * FROM sqlite_temp_master) "
          "WHERE tbl_name LIKE shellstatic() AND type!='meta' AND sql NOTNULL "
          "ORDER BY substr(type,2,1), name",
          callback, &data, &zErrMsg);
        zShellStatic = 0;
      }
    }else{
      sqlite3_exec(p->db,
         "SELECT sql FROM "
         "  (SELECT * FROM sqlite_master UNION ALL"
         "   SELECT * FROM sqlite_temp_master) "
         "WHERE type!='meta' AND sql NOTNULL AND name NOT LIKE 'sqlite_%'"
         "ORDER BY substr(type,2,1), name",
         callback, &data, &zErrMsg
      );
    }
    if( zErrMsg ){
      fprintf(stderr,"Error: %s\n", zErrMsg);
      sqlite3_free(zErrMsg);
    }
  }else

  if( c=='s' && strncmp(azArg[0], "separator", n)==0 && nArg==2 ){
    sqlite3_snprintf(sizeof(p->separator), p->separator,
                     "%.*s", (int)sizeof(p->separator)-1, azArg[1]);
  }else

  if( c=='s' && strncmp(azArg[0], "show", n)==0){
    int i;
    fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off");
    fprintf(p->out,"%9.9s: %s\n","explain", p->explainPrev.valid ? "on" :"off");
    fprintf(p->out,"%9.9s: %s\n","headers", p->showHeader ? "on" : "off");
    fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]);
    fprintf(p->out,"%9.9s: ", "nullvalue");
      output_c_string(p->out, p->nullvalue);
      fprintf(p->out, "\n");
    fprintf(p->out,"%9.9s: %s\n","output",
                                 strlen(p->outfile) ? p->outfile : "stdout");
    fprintf(p->out,"%9.9s: ", "separator");
      output_c_string(p->out, p->separator);
      fprintf(p->out, "\n");
    fprintf(p->out,"%9.9s: ","width");
    for (i=0;i<(int)ArraySize(p->colWidth) && p->colWidth[i] != 0;i++) {
      fprintf(p->out,"%d ",p->colWidth[i]);
    }
    fprintf(p->out,"\n");
  }else

  if( c=='t' && n>1 && strncmp(azArg[0], "tables", n)==0 ){
    char **azResult;
    int nRow, rc;
    char *zErrMsg;
    open_db(p);
    if( nArg==1 ){
      rc = sqlite3_get_table(p->db,
        "SELECT name FROM sqlite_master "
        "WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%'"
        "UNION ALL "
        "SELECT name FROM sqlite_temp_master "
        "WHERE type IN ('table','view') "
        "ORDER BY 1",
        &azResult, &nRow, 0, &zErrMsg
      );
    }else{
      zShellStatic = azArg[1];
      rc = sqlite3_get_table(p->db,
        "SELECT name FROM sqlite_master "
        "WHERE type IN ('table','view') AND name LIKE '%'||shellstatic()||'%' "
        "UNION ALL "
        "SELECT name FROM sqlite_temp_master "
        "WHERE type IN ('table','view') AND name LIKE '%'||shellstatic()||'%' "
        "ORDER BY 1",
        &azResult, &nRow, 0, &zErrMsg
      );
      zShellStatic = 0;
    }
    if( zErrMsg ){
      fprintf(stderr,"Error: %s\n", zErrMsg);
      sqlite3_free(zErrMsg);
    }
    if( rc==SQLITE_OK ){
      int len, maxlen = 0;
      int i, j;
      int nPrintCol, nPrintRow;
      for(i=1; i<=nRow; i++){
        if( azResult[i]==0 ) continue;
        len = strlen(azResult[i]);
        if( len>maxlen ) maxlen = len;
      }
      nPrintCol = 80/(maxlen+2);
      if( nPrintCol<1 ) nPrintCol = 1;
      nPrintRow = (nRow + nPrintCol - 1)/nPrintCol;
      for(i=0; i<nPrintRow; i++){
        for(j=i+1; j<=nRow; j+=nPrintRow){
          char *zSp = j<=nPrintRow ? "" : "  ";
          printf("%s%-*s", zSp, maxlen, azResult[j] ? azResult[j] : "");
        }
        printf("\n");
      }
    }else{
      rc = 1;
    }
    sqlite3_free_table(azResult);
  }else

  if( c=='t' && n>4 && strncmp(azArg[0], "timeout", n)==0 && nArg>=2 ){
    open_db(p);
    sqlite3_busy_timeout(p->db, atoi(azArg[1]));
  }else
  
#if HAS_TIMER  
  if( c=='t' && n>=5 && strncmp(azArg[0], "timer", n)==0 && nArg>1 ){
    enableTimer = booleanValue(azArg[1]);
  }else
#endif

  if( c=='w' && strncmp(azArg[0], "width", n)==0 ){
    int j;
    assert( nArg<=ArraySize(azArg) );
    for(j=1; j<nArg && j<ArraySize(p->colWidth); j++){
      p->colWidth[j-1] = atoi(azArg[j]);
    }
  }else


  {
    fprintf(stderr, "unknown command or invalid arguments: "
      " \"%s\". Enter \".help\" for help\n", azArg[0]);
  }

  return rc;
}

/*
** Return TRUE if a semicolon occurs anywhere in the first N characters
** of string z[].
*/
static int _contains_semicolon(const char *z, int N){
  int i;
  for(i=0; i<N; i++){  if( z[i]==';' ) return 1; }
  return 0;
}

/*
** Test to see if a line consists entirely of whitespace.
*/
static int _all_whitespace(const char *z){
  for(; *z; z++){
    if( isspace(*(unsigned char*)z) ) continue;
    if( *z=='/' && z[1]=='*' ){
      z += 2;
      while( *z && (*z!='*' || z[1]!='/') ){ z++; }
      if( *z==0 ) return 0;
      z++;
      continue;
    }
    if( *z=='-' && z[1]=='-' ){
      z += 2;
      while( *z && *z!='\n' ){ z++; }
      if( *z==0 ) return 1;
      continue;
    }
    return 0;
  }
  return 1;
}

/*
** Return TRUE if the line typed in is an SQL command terminator other
** than a semi-colon.  The SQL Server style "go" command is understood
** as is the Oracle "/".
*/
static int _is_command_terminator(const char *zLine){
  while( isspace(*(unsigned char*)zLine) ){ zLine++; };
  if( zLine[0]=='/' && _all_whitespace(&zLine[1]) ) return 1;  /* Oracle */
  if( tolower(zLine[0])=='g' && tolower(zLine[1])=='o'
         && _all_whitespace(&zLine[2]) ){
    return 1;  /* SQL Server */
  }
  return 0;
}

/*
** Read input from *in and process it.  If *in==0 then input
** is interactive - the user is typing it it.  Otherwise, input
** is coming from a file or device.  A prompt is issued and history
** is saved only if input is interactive.  An interrupt signal will
** cause this routine to exit immediately, unless input is interactive.
**
** Return the number of errors.
*/
static int process_input(struct callback_data *p, FILE *in){
  char *zLine = 0;
  char *zSql = 0;
  int nSql = 0;
  int nSqlPrior = 0;
  char *zErrMsg;
  int rc;
  int errCnt = 0;
  int lineno = 0;
  int startline = 0;

  while( errCnt==0 || !bail_on_error || (in==0 && stdin_is_interactive) ){
    fflush(p->out);
    free(zLine);
    zLine = one_input_line(zSql, in);
    if( zLine==0 ){
      break;  /* We have reached EOF */
    }
    if( seenInterrupt ){
      if( in!=0 ) break;
      seenInterrupt = 0;
    }
    lineno++;
    if( p->echoOn ) printf("%s\n", zLine);
    if( (zSql==0 || zSql[0]==0) && _all_whitespace(zLine) ) continue;
    if( zLine && zLine[0]=='.' && nSql==0 ){
      rc = do_meta_command(zLine, p);
      if( rc==2 ){
        break;
      }else if( rc ){
        errCnt++;
      }
      continue;
    }
    if( _is_command_terminator(zLine) ){
      memcpy(zLine,";",2);
    }
    nSqlPrior = nSql;
    if( zSql==0 ){
      int i;
      for(i=0; zLine[i] && isspace((unsigned char)zLine[i]); i++){}
      if( zLine[i]!=0 ){
        nSql = strlen(zLine);
        zSql = malloc( nSql+1 );
        if( zSql==0 ){
          fprintf(stderr, "out of memory\n");
          exit(1);
        }
        memcpy(zSql, zLine, nSql+1);
        startline = lineno;
      }
    }else{
      int len = strlen(zLine);
      zSql = realloc( zSql, nSql + len + 2 );
      if( zSql==0 ){
        fprintf(stderr,"%s: out of memory!\n", Argv0);
        exit(1);
      }
      zSql[nSql++] = '\n';
      memcpy(&zSql[nSql], zLine, len+1);
      nSql += len;
    }
    if( zSql && _contains_semicolon(&zSql[nSqlPrior], nSql-nSqlPrior)
                && sqlite3_complete(zSql) ){
      p->cnt = 0;
      open_db(p);
      BEGIN_TIMER;
      rc = sqlite3_exec(p->db, zSql, callback, p, &zErrMsg);
      END_TIMER;
      if( rc || zErrMsg ){
        char zPrefix[100];
        if( in!=0 || !stdin_is_interactive ){
          sqlite3_snprintf(sizeof(zPrefix), zPrefix, 
                           "SQL error near line %d:", startline);
        }else{
          sqlite3_snprintf(sizeof(zPrefix), zPrefix, "SQL error:");
        }
        if( zErrMsg!=0 ){
          printf("%s %s\n", zPrefix, zErrMsg);
          sqlite3_free(zErrMsg);
          zErrMsg = 0;
        }else{
          printf("%s %s\n", zPrefix, sqlite3_errmsg(p->db));
        }
        errCnt++;
      }
      free(zSql);
      zSql = 0;
      nSql = 0;
    }
  }
  if( zSql ){
    if( !_all_whitespace(zSql) ) printf("Incomplete SQL: %s\n", zSql);
    free(zSql);
  }
  free(zLine);
  return errCnt;
}

/*
** Return a pathname which is the user's home directory.  A
** 0 return indicates an error of some kind.  Space to hold the
** resulting string is obtained from malloc().  The calling
** function should free the result.
*/
static char *find_home_dir(void){
  char *home_dir = NULL;

#if !defined(_WIN32) && !defined(WIN32) && !defined(__OS2__) && !defined(_WIN32_WCE)
  struct passwd *pwent;
  uid_t uid = getuid();
  if( (pwent=getpwuid(uid)) != NULL) {
    home_dir = pwent->pw_dir;
  }
#endif

#if defined(_WIN32_WCE)
  /* Windows CE (arm-wince-mingw32ce-gcc) does not provide getenv()
   */
  home_dir = strdup("/");
#else

#if defined(_WIN32) || defined(WIN32) || defined(__OS2__)
  if (!home_dir) {
    home_dir = getenv("USERPROFILE");
  }
#endif

  if (!home_dir) {
    home_dir = getenv("HOME");
  }

#if defined(_WIN32) || defined(WIN32) || defined(__OS2__)
  if (!home_dir) {
    char *zDrive, *zPath;
    int n;
    zDrive = getenv("HOMEDRIVE");
    zPath = getenv("HOMEPATH");
    if( zDrive && zPath ){
      n = strlen(zDrive) + strlen(zPath) + 1;
      home_dir = malloc( n );
      if( home_dir==0 ) return 0;
      sqlite3_snprintf(n, home_dir, "%s%s", zDrive, zPath);
      return home_dir;
    }
    home_dir = "c:\\";
  }
#endif

#endif /* !_WIN32_WCE */

  if( home_dir ){
    int n = strlen(home_dir) + 1;
    char *z = malloc( n );
    if( z ) memcpy(z, home_dir, n);
    home_dir = z;
  }

  return home_dir;
}

/*
** Read input from the file given by sqliterc_override.  Or if that
** parameter is NULL, take input from ~/.sqliterc
*/
static void process_sqliterc(
  struct callback_data *p,        /* Configuration data */
  const char *sqliterc_override   /* Name of config file. NULL to use default */
){
  char *home_dir = NULL;
  const char *sqliterc = sqliterc_override;
  char *zBuf = 0;
  FILE *in = NULL;
  int nBuf;

  if (sqliterc == NULL) {
    home_dir = find_home_dir();
    if( home_dir==0 ){
      fprintf(stderr,"%s: cannot locate your home directory!\n", Argv0);
      return;
    }
    nBuf = strlen(home_dir) + 16;
    zBuf = malloc( nBuf );
    if( zBuf==0 ){
      fprintf(stderr,"%s: out of memory!\n", Argv0);
      exit(1);
    }
    sqlite3_snprintf(nBuf, zBuf,"%s/.sqliterc",home_dir);
    free(home_dir);
    sqliterc = (const char*)zBuf;
  }
  in = fopen(sqliterc,"rb");
  if( in ){
    if( stdin_is_interactive ){
      printf("-- Loading resources from %s\n",sqliterc);
    }
    process_input(p,in);
    fclose(in);
  }
  free(zBuf);
  return;
}

/*
** Show available command line options
*/
static const char zOptions[] = 
  "   -init filename       read/process named file\n"
  "   -echo                print commands before execution\n"
  "   -[no]header          turn headers on or off\n"
  "   -bail                stop after hitting an error\n"
  "   -interactive         force interactive I/O\n"
  "   -batch               force batch I/O\n"
  "   -column              set output mode to 'column'\n"
  "   -csv                 set output mode to 'csv'\n"
  "   -html                set output mode to HTML\n"
  "   -line                set output mode to 'line'\n"
  "   -list                set output mode to 'list'\n"
  "   -separator 'x'       set output field separator (|)\n"
  "   -nullvalue 'text'    set text string for NULL values\n"
  "   -version             show SQLite version\n"
;
static void usage(int showDetail){
  fprintf(stderr,
      "Usage: %s [OPTIONS] FILENAME [SQL]\n"  
      "FILENAME is the name of an SQLite database. A new database is created\n"
      "if the file does not previously exist.\n", Argv0);
  if( showDetail ){
    fprintf(stderr, "OPTIONS include:\n%s", zOptions);
  }else{
    fprintf(stderr, "Use the -help option for additional information\n");
  }
  exit(1);
}

/*
** Initialize the state information in data
*/
static void main_init(struct callback_data *data) {
  memset(data, 0, sizeof(*data));
  data->mode = MODE_List;
  memcpy(data->separator,"|", 2);
  data->showHeader = 0;
  sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
  sqlite3_snprintf(sizeof(continuePrompt), continuePrompt,"   ...> ");
}

int main(int argc, char **argv){
  char *zErrMsg = 0;
  struct callback_data data;
  const char *zInitFile = 0;
  char *zFirstCmd = 0;
  int i;
  int rc = 0;

  Argv0 = argv[0];
  main_init(&data);
  stdin_is_interactive = isatty(0);

  /* Make sure we have a valid signal handler early, before anything
  ** else is done.
  */
#ifdef SIGINT
  signal(SIGINT, interrupt_handler);
#endif

  /* Do an initial pass through the command-line argument to locate
  ** the name of the database file, the name of the initialization file,
  ** and the first command to execute.
  */
  for(i=1; i<argc-1; i++){
    char *z;
    if( argv[i][0]!='-' ) break;
    z = argv[i];
    if( z[0]=='-' && z[1]=='-' ) z++;
    if( strcmp(argv[i],"-separator")==0 || strcmp(argv[i],"-nullvalue")==0 ){
      i++;
    }else if( strcmp(argv[i],"-init")==0 ){
      i++;
      zInitFile = argv[i];
    }
  }
  if( i<argc ){
#if defined(SQLITE_OS_OS2) && SQLITE_OS_OS2
    data.zDbFilename = (const char *)convertCpPathToUtf8( argv[i++] );
#else
    data.zDbFilename = argv[i++];
#endif
  }else{
#ifndef SQLITE_OMIT_MEMORYDB
    data.zDbFilename = ":memory:";
#else
    data.zDbFilename = 0;
#endif
  }
  if( i<argc ){
    zFirstCmd = argv[i++];
  }
  data.out = stdout;

#ifdef SQLITE_OMIT_MEMORYDB
  if( data.zDbFilename==0 ){
    fprintf(stderr,"%s: no database filename specified\n", argv[0]);
    exit(1);
  }
#endif

  /* Go ahead and open the database file if it already exists.  If the
  ** file does not exist, delay opening it.  This prevents empty database
  ** files from being created if a user mistypes the database name argument
  ** to the sqlite command-line tool.
  */
  if( access(data.zDbFilename, 0)==0 ){
    open_db(&data);
  }

  /* Process the initialization file if there is one.  If no -init option
  ** is given on the command line, look for a file named ~/.sqliterc and
  ** try to process it.
  */
  process_sqliterc(&data,zInitFile);

  /* Make a second pass through the command-line argument and set
  ** options.  This second pass is delayed until after the initialization
  ** file is processed so that the command-line arguments will override
  ** settings in the initialization file.
  */
  for(i=1; i<argc && argv[i][0]=='-'; i++){
    char *z = argv[i];
    if( z[1]=='-' ){ z++; }
    if( strcmp(z,"-init")==0 ){
      i++;
    }else if( strcmp(z,"-html")==0 ){
      data.mode = MODE_Html;
    }else if( strcmp(z,"-list")==0 ){
      data.mode = MODE_List;
    }else if( strcmp(z,"-line")==0 ){
      data.mode = MODE_Line;
    }else if( strcmp(z,"-column")==0 ){
      data.mode = MODE_Column;
    }else if( strcmp(z,"-csv")==0 ){
      data.mode = MODE_Csv;
      memcpy(data.separator,",",2);
    }else if( strcmp(z,"-separator")==0 ){
      i++;
      sqlite3_snprintf(sizeof(data.separator), data.separator,
                       "%.*s",(int)sizeof(data.separator)-1,argv[i]);
    }else if( strcmp(z,"-nullvalue")==0 ){
      i++;
      sqlite3_snprintf(sizeof(data.nullvalue), data.nullvalue,
                       "%.*s",(int)sizeof(data.nullvalue)-1,argv[i]);
    }else if( strcmp(z,"-header")==0 ){
      data.showHeader = 1;
    }else if( strcmp(z,"-noheader")==0 ){
      data.showHeader = 0;
    }else if( strcmp(z,"-echo")==0 ){
      data.echoOn = 1;
    }else if( strcmp(z,"-bail")==0 ){
      bail_on_error = 1;
    }else if( strcmp(z,"-version")==0 ){
      printf("%s\n", sqlite3_libversion());
      return 0;
    }else if( strcmp(z,"-interactive")==0 ){
      stdin_is_interactive = 1;
    }else if( strcmp(z,"-batch")==0 ){
      stdin_is_interactive = 0;
    }else if( strcmp(z,"-help")==0 || strcmp(z, "--help")==0 ){
      usage(1);
    }else{
      fprintf(stderr,"%s: unknown option: %s\n", Argv0, z);
      fprintf(stderr,"Use -help for a list of options.\n");
      return 1;
    }
  }

  if( zFirstCmd ){
    /* Run just the command that follows the database name
    */
    if( zFirstCmd[0]=='.' ){
      do_meta_command(zFirstCmd, &data);
      exit(0);
    }else{
      int rc;
      open_db(&data);
      rc = sqlite3_exec(data.db, zFirstCmd, callback, &data, &zErrMsg);
      if( rc!=0 && zErrMsg!=0 ){
        fprintf(stderr,"SQL error: %s\n", zErrMsg);
        exit(1);
      }
    }
  }else{
    /* Run commands received from standard input
    */
    if( stdin_is_interactive ){
      char *zHome;
      char *zHistory = 0;
      int nHistory;
      printf(
        "SQLite version %s\n"
        "Enter \".help\" for instructions\n"
        "Enter SQL statements terminated with a \";\"\n",
        sqlite3_libversion()
      );
      zHome = find_home_dir();
      if( zHome && (zHistory = malloc(nHistory = strlen(zHome)+20))!=0 ){
        sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
      }
#if defined(HAVE_READLINE) && HAVE_READLINE==1
      if( zHistory ) read_history(zHistory);
#endif
      rc = process_input(&data, 0);
      if( zHistory ){
        stifle_history(100);
        write_history(zHistory);
        free(zHistory);
      }
      free(zHome);
    }else{
      rc = process_input(&data, stdin);
    }
  }
  set_table_name(&data, 0);
  if( db ){
    if( sqlite3_close(db)!=SQLITE_OK ){
      fprintf(stderr,"error closing database: %s\n", sqlite3_errmsg(db));
    }
  }
  return rc;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/sqlite3.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the SQLite library
** presents to client programs.  If a C-function, structure, datatype,
** or constant definition does not appear in this file, then it is
** not a published API of SQLite, is subject to change without
** notice, and should not be referenced by programs that use SQLite.
**
** Some of the definitions that are in this file are marked as
** "experimental".  Experimental interfaces are normally new
** features recently added to SQLite.  We do not anticipate changes
** to experimental interfaces but reserve to make minor changes if
** experience from use "in the wild" suggest such changes are prudent.
**
** The official C-language API documentation for SQLite is derived
** from comments in this file.  This file is the authoritative source
** on how SQLite interfaces are suppose to operate.
**
** The name of this file under configuration management is "sqlite.h.in".
** The makefile makes some minor changes to this file (such as inserting
** the version number) and changes its name to "sqlite3.h" as
** part of the build process.
**
** @(#) $Id: sqlite3.h,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_
#include <stdarg.h>     /* Needed for the definition of va_list */

/*
** Make sure we can call this stuff from C++.
*/
#ifdef __cplusplus
extern "C" {
#endif


/*
** Add the ability to override 'extern'
*/
#ifndef SQLITE_EXTERN
# define SQLITE_EXTERN extern
#endif

/*
** Ensure these symbols were not defined by some previous header file.
*/
#ifdef SQLITE_VERSION
# undef SQLITE_VERSION
#endif
#ifdef SQLITE_VERSION_NUMBER
# undef SQLITE_VERSION_NUMBER
#endif

/*
** CAPI3REF: Compile-Time Library Version Numbers {H10010} <S60100>
**
** The SQLITE_VERSION and SQLITE_VERSION_NUMBER #defines in
** the sqlite3.h file specify the version of SQLite with which
** that header file is associated.
**
** The "version" of SQLite is a string of the form "X.Y.Z".
** The phrase "alpha" or "beta" might be appended after the Z.
** The X value is major version number always 3 in SQLite3.
** The X value only changes when backwards compatibility is
** broken and we intend to never break backwards compatibility.
** The Y value is the minor version number and only changes when
** there are major feature enhancements that are forwards compatible
** but not backwards compatible.
** The Z value is the release number and is incremented with
** each release but resets back to 0 whenever Y is incremented.
**
** See also: [sqlite3_libversion()] and [sqlite3_libversion_number()].
**
** INVARIANTS:
**
** {H10011} The SQLITE_VERSION #define in the sqlite3.h header file shall
**          evaluate to a string literal that is the SQLite version
**          with which the header file is associated.
**
** {H10014} The SQLITE_VERSION_NUMBER #define shall resolve to an integer
**          with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z
**          are the major version, minor version, and release number.
*/
#define SQLITE_VERSION         "3.6.1"
#define SQLITE_VERSION_NUMBER  3006001

/*
** CAPI3REF: Run-Time Library Version Numbers {H10020} <S60100>
** KEYWORDS: sqlite3_version
**
** These features provide the same information as the [SQLITE_VERSION]
** and [SQLITE_VERSION_NUMBER] #defines in the header, but are associated
** with the library instead of the header file.  Cautious programmers might
** include a check in their application to verify that
** sqlite3_libversion_number() always returns the value
** [SQLITE_VERSION_NUMBER].
**
** The sqlite3_libversion() function returns the same information as is
** in the sqlite3_version[] string constant.  The function is provided
** for use in DLLs since DLL users usually do not have direct access to string
** constants within the DLL.
**
** INVARIANTS:
**
** {H10021} The [sqlite3_libversion_number()] interface shall return
**          an integer equal to [SQLITE_VERSION_NUMBER].
**
** {H10022} The [sqlite3_version] string constant shall contain
**          the text of the [SQLITE_VERSION] string.
**
** {H10023} The [sqlite3_libversion()] function shall return
**          a pointer to the [sqlite3_version] string constant.
*/
SQLITE_EXTERN const char sqlite3_version[];
const char *sqlite3_libversion(void);
int sqlite3_libversion_number(void);

/*
** CAPI3REF: Test To See If The Library Is Threadsafe {H10100} <S60100>
**
** SQLite can be compiled with or without mutexes.  When
** the [SQLITE_THREADSAFE] C preprocessor macro is true, mutexes
** are enabled and SQLite is threadsafe.  When that macro is false,
** the mutexes are omitted.  Without the mutexes, it is not safe
** to use SQLite concurrently from more than one thread.
**
** Enabling mutexes incurs a measurable performance penalty.
** So if speed is of utmost importance, it makes sense to disable
** the mutexes.  But for maximum safety, mutexes should be enabled.
** The default behavior is for mutexes to be enabled.
**
** This interface can be used by a program to make sure that the
** version of SQLite that it is linking against was compiled with
** the desired setting of the [SQLITE_THREADSAFE] macro.
**
** This interface only reports on the compile-time mutex setting
** of the [SQLITE_THREADSAFE] flag.  If SQLite is compiled with
** SQLITE_THREADSAFE=1 then mutexes are enabled by default but
** can be fully or partially disabled using a call to [sqlite3_config()]
** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD],
** or [SQLITE_CONFIG_MUTEX].  The return value of this function shows
** only the default compile-time setting, not any run-time changes
** to that setting.
**
** INVARIANTS:
**
** {H10101} The [sqlite3_threadsafe()] function shall return nonzero if
**          SQLite was compiled with the its mutexes enabled by default
**          or zero if SQLite was compiled such that mutexes are
**          permanently disabled.
**
** {H10102} The value returned by the [sqlite3_threadsafe()] function
**          shall not change when mutex setting are modified at
**          runtime using the [sqlite3_config()] interface and 
**          especially the [SQLITE_CONFIG_SINGLETHREAD],
**          [SQLITE_CONFIG_MULTITHREAD], [SQLITE_CONFIG_SERIALIZED],
**          and [SQLITE_CONFIG_MUTEX] verbs.
*/
int sqlite3_threadsafe(void);

/*
** CAPI3REF: Database Connection Handle {H12000} <S40200>
** KEYWORDS: {database connection} {database connections}
**
** Each open SQLite database is represented by a pointer to an instance of
** the opaque structure named "sqlite3".  It is useful to think of an sqlite3
** pointer as an object.  The [sqlite3_open()], [sqlite3_open16()], and
** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]
** is its destructor.  There are many other interfaces (such as
** [sqlite3_prepare_v2()], [sqlite3_create_function()], and
** [sqlite3_busy_timeout()] to name but three) that are methods on an
** sqlite3 object.
*/
typedef struct sqlite3 sqlite3;

/*
** CAPI3REF: 64-Bit Integer Types {H10200} <S10110>
** KEYWORDS: sqlite_int64 sqlite_uint64
**
** Because there is no cross-platform way to specify 64-bit integer types
** SQLite includes typedefs for 64-bit signed and unsigned integers.
**
** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions.
** The sqlite_int64 and sqlite_uint64 types are supported for backwards
** compatibility only.
**
** INVARIANTS:
**
** {H10201} The [sqlite_int64] and [sqlite3_int64] type shall specify
**          a 64-bit signed integer.
**
** {H10202} The [sqlite_uint64] and [sqlite3_uint64] type shall specify
**          a 64-bit unsigned integer.
*/
#ifdef SQLITE_INT64_TYPE
  typedef SQLITE_INT64_TYPE sqlite_int64;
  typedef unsigned SQLITE_INT64_TYPE sqlite_uint64;
#elif defined(_MSC_VER) || defined(__BORLANDC__)
  typedef __int64 sqlite_int64;
  typedef unsigned __int64 sqlite_uint64;
#else
  typedef long long int sqlite_int64;
  typedef unsigned long long int sqlite_uint64;
#endif
typedef sqlite_int64 sqlite3_int64;
typedef sqlite_uint64 sqlite3_uint64;

/*
** If compiling for a processor that lacks floating point support,
** substitute integer for floating-point.
*/
#ifdef SQLITE_OMIT_FLOATING_POINT
# define double sqlite3_int64
#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.
**
** INVARIANTS:
**
** {H12011} A successful call to [sqlite3_close(C)] shall destroy the
**          [database connection] object C.
**
** {H12012} A successful call to [sqlite3_close(C)] shall return SQLITE_OK.
**
** {H12013} A successful call to [sqlite3_close(C)] shall release all
**          memory and system resources associated with [database connection]
**          C.
**
** {H12014} A call to [sqlite3_close(C)] on a [database connection] C that
**          has one or more open [prepared statements] shall fail with
**          an [SQLITE_BUSY] error code.
**
** {H12015} A call to [sqlite3_close(C)] where C is a NULL pointer shall
**          return SQLITE_OK.
**
** {H12019} When [sqlite3_close(C)] is invoked on a [database connection] C
**          that has a pending transaction, the transaction shall be
**          rolled back.
**
** ASSUMPTIONS:
**
** {A12016} 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
**          [sqlite3_open_v2()], and not previously closed.
*/
int sqlite3_close(sqlite3 *);

/*
** The type for a callback function.
** This is legacy and deprecated.  It is included for historical
** compatibility and is not documented.
*/
typedef int (*sqlite3_callback)(void*,int,char**, char**);

/*
** CAPI3REF: One-Step Query Execution Interface {H12100} <S10000>
**
** The sqlite3_exec() interface is a convenient way of running one or more
** SQL statements without having to write a lot of C code.  The UTF-8 encoded
** SQL statements are passed in as the second parameter to sqlite3_exec().
** The statements are evaluated one by one until either an error or
** an interrupt is encountered, or until they are all done.  The 3rd parameter
** is an optional callback that is invoked once for each row of any query
** results produced by the SQL statements.  The 5th parameter tells where
** to write any error messages.
**
** The error message passed back through the 5th parameter is held
** in memory obtained from [sqlite3_malloc()].  To avoid a memory leak,
** the calling application should call [sqlite3_free()] on any error
** message returned through the 5th parameter when it has finished using
** the error message.
**
** If the SQL statement in the 2nd parameter is NULL or an empty string
** or a string containing only whitespace and comments, then no SQL
** statements are evaluated and the database is not changed.
**
** The sqlite3_exec() interface is implemented in terms of
** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()].
** The sqlite3_exec() routine does nothing to the database that cannot be done
** by [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()].
**
** INVARIANTS:
**
** {H12101} A successful invocation of [sqlite3_exec(D,S,C,A,E)]
**          shall sequentially evaluate all of the UTF-8 encoded,
**          semicolon-separated SQL statements in the zero-terminated
**          string S within the context of the [database connection] D.
**
** {H12102} If the S parameter to [sqlite3_exec(D,S,C,A,E)] is NULL then
**          the actions of the interface shall be the same as if the
**          S parameter were an empty string.
**
** {H12104} The return value of [sqlite3_exec()] shall be [SQLITE_OK] if all
**          SQL statements run successfully and to completion.
**
** {H12105} The return value of [sqlite3_exec()] shall be an appropriate
**          non-zero [error code] if any SQL statement fails.
**
** {H12107} If one or more of the SQL statements handed to [sqlite3_exec()]
**          return results and the 3rd parameter is not NULL, then
**          the callback function specified by the 3rd parameter shall be
**          invoked once for each row of result.
**
** {H12110} If the callback returns a non-zero value then [sqlite3_exec()]
**          shall abort the SQL statement it is currently evaluating,
**          skip all subsequent SQL statements, and return [SQLITE_ABORT].
**
** {H12113} The [sqlite3_exec()] routine shall pass its 4th parameter through
**          as the 1st parameter of the callback.
**
** {H12116} The [sqlite3_exec()] routine shall set the 2nd parameter of its
**          callback to be the number of columns in the current row of
**          result.
**
** {H12119} The [sqlite3_exec()] routine shall set the 3rd parameter of its
**          callback to be an array of pointers to strings holding the
**          values for each column in the current result set row as
**          obtained from [sqlite3_column_text()].
**
** {H12122} The [sqlite3_exec()] routine shall set the 4th parameter of its
**          callback to be an array of pointers to strings holding the
**          names of result columns as obtained from [sqlite3_column_name()].
**
** {H12125} If the 3rd parameter to [sqlite3_exec()] is NULL then
**          [sqlite3_exec()] shall silently discard query results.
**
** {H12131} If an error occurs while parsing or evaluating any of the SQL
**          statements in the S parameter of [sqlite3_exec(D,S,C,A,E)] and if
**          the E parameter is not NULL, then [sqlite3_exec()] shall store
**          in *E an appropriate error message written into memory obtained
**          from [sqlite3_malloc()].
**
** {H12134} The [sqlite3_exec(D,S,C,A,E)] routine shall set the value of
**          *E to NULL if E is not NULL and there are no errors.
**
** {H12137} The [sqlite3_exec(D,S,C,A,E)] function shall set the [error code]
**          and message accessible via [sqlite3_errcode()],
**          [sqlite3_errmsg()], and [sqlite3_errmsg16()].
**
** {H12138} If the S parameter to [sqlite3_exec(D,S,C,A,E)] is NULL or an
**          empty string or contains nothing other than whitespace, comments,
**          and/or semicolons, then results of [sqlite3_errcode()],
**          [sqlite3_errmsg()], and [sqlite3_errmsg16()]
**          shall reset to indicate no errors.
**
** ASSUMPTIONS:
**
** {A12141} The first parameter to [sqlite3_exec()] must be an valid and open
**          [database connection].
**
** {A12142} The database connection must not be closed while
**          [sqlite3_exec()] is running.
**
** {A12143} The calling function should use [sqlite3_free()] to free
**          the memory that *errmsg is left pointing at once the error
**          message is no longer needed.
**
** {A12145} The SQL statement text in the 2nd parameter to [sqlite3_exec()]
**          must remain unchanged while [sqlite3_exec()] is running.
*/
int sqlite3_exec(
  sqlite3*,                                  /* An open database */
  const char *sql,                           /* SQL to be evaluated */
  int (*callback)(void*,int,char**,char**),  /* Callback function */
  void *,                                    /* 1st argument to callback */
  char **errmsg                              /* Error msg written here */
);

/*
** CAPI3REF: Result Codes {H10210} <S10700>
** KEYWORDS: SQLITE_OK {error code} {error codes}
** KEYWORDS: {result code} {result codes}
**
** Many SQLite functions return an integer result code from the set shown
** here in order to indicates success or failure.
**
** New error codes may be added in future versions of SQLite.
**
** See also: [SQLITE_IOERR_READ | extended result codes]
*/
#define SQLITE_OK           0   /* Successful result */
/* beginning-of-error-codes */
#define SQLITE_ERROR        1   /* SQL error or missing database */
#define SQLITE_INTERNAL     2   /* Internal logic error in SQLite */
#define SQLITE_PERM         3   /* Access permission denied */
#define SQLITE_ABORT        4   /* Callback routine requested an abort */
#define SQLITE_BUSY         5   /* The database file is locked */
#define SQLITE_LOCKED       6   /* A table in the database is locked */
#define SQLITE_NOMEM        7   /* A malloc() failed */
#define SQLITE_READONLY     8   /* Attempt to write a readonly database */
#define SQLITE_INTERRUPT    9   /* Operation terminated by sqlite3_interrupt()*/
#define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */
#define SQLITE_CORRUPT     11   /* The database disk image is malformed */
#define SQLITE_NOTFOUND    12   /* NOT USED. Table or record not found */
#define SQLITE_FULL        13   /* Insertion failed because database is full */
#define SQLITE_CANTOPEN    14   /* Unable to open the database file */
#define SQLITE_PROTOCOL    15   /* NOT USED. Database lock protocol error */
#define SQLITE_EMPTY       16   /* Database is empty */
#define SQLITE_SCHEMA      17   /* The database schema changed */
#define SQLITE_TOOBIG      18   /* String or BLOB exceeds size limit */
#define SQLITE_CONSTRAINT  19   /* Abort due to constraint violation */
#define SQLITE_MISMATCH    20   /* Data type mismatch */
#define SQLITE_MISUSE      21   /* Library used incorrectly */
#define SQLITE_NOLFS       22   /* Uses OS features not supported on host */
#define SQLITE_AUTH        23   /* Authorization denied */
#define SQLITE_FORMAT      24   /* Auxiliary database format error */
#define SQLITE_RANGE       25   /* 2nd parameter to sqlite3_bind out of range */
#define SQLITE_NOTADB      26   /* File opened that is not a database file */
#define SQLITE_ROW         100  /* sqlite3_step() has another row ready */
#define SQLITE_DONE        101  /* sqlite3_step() has finished executing */
/* end-of-error-codes */

/*
** CAPI3REF: Extended Result Codes {H10220} <S10700>
** KEYWORDS: {extended error code} {extended error codes}
** KEYWORDS: {extended result code} {extended result codes}
**
** In its default configuration, SQLite API routines return one of 26 integer
** [SQLITE_OK | result codes].  However, experience has shown that many of
** these result codes are too coarse-grained.  They do not provide as
** much information about problems as programmers might like.  In an effort to
** address this, newer versions of SQLite (version 3.3.8 and later) include
** support for additional result codes that provide more detailed information
** about errors. The extended result codes are enabled or disabled
** on a per database connection basis using the
** [sqlite3_extended_result_codes()] API.
**
** Some of the available extended result codes are listed here.
** One may expect the number of extended result codes will be expand
** over time.  Software that uses extended result codes should expect
** to see new result codes in future releases of SQLite.
**
** The SQLITE_OK result code will never be extended.  It will always
** be exactly zero.
**
** INVARIANTS:
**
** {H10223} The symbolic name for an extended result code shall contains
**          a related primary result code as a prefix.
**
** {H10224} Primary result code names shall contain a single "_" character.
**
** {H10225} Extended result code names shall contain two or more "_" characters.
**
** {H10226} The numeric value of an extended result code shall contain the
**          numeric value of its corresponding primary result code in
**          its least significant 8 bits.
*/
#define SQLITE_IOERR_READ              (SQLITE_IOERR | (1<<8))
#define SQLITE_IOERR_SHORT_READ        (SQLITE_IOERR | (2<<8))
#define SQLITE_IOERR_WRITE             (SQLITE_IOERR | (3<<8))
#define SQLITE_IOERR_FSYNC             (SQLITE_IOERR | (4<<8))
#define SQLITE_IOERR_DIR_FSYNC         (SQLITE_IOERR | (5<<8))
#define SQLITE_IOERR_TRUNCATE          (SQLITE_IOERR | (6<<8))
#define SQLITE_IOERR_FSTAT             (SQLITE_IOERR | (7<<8))
#define SQLITE_IOERR_UNLOCK            (SQLITE_IOERR | (8<<8))
#define SQLITE_IOERR_RDLOCK            (SQLITE_IOERR | (9<<8))
#define SQLITE_IOERR_DELETE            (SQLITE_IOERR | (10<<8))
#define SQLITE_IOERR_BLOCKED           (SQLITE_IOERR | (11<<8))
#define SQLITE_IOERR_NOMEM             (SQLITE_IOERR | (12<<8))
#define SQLITE_IOERR_ACCESS            (SQLITE_IOERR | (13<<8))
#define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8))

/*
** CAPI3REF: Flags For File Open Operations {H10230} <H11120> <H12700>
**
** These bit values are intended for use in the
** 3rd parameter to the [sqlite3_open_v2()] interface and
** in the 4th parameter to the xOpen method of the
** [sqlite3_vfs] object.
*/
#define SQLITE_OPEN_READONLY         0x00000001
#define SQLITE_OPEN_READWRITE        0x00000002
#define SQLITE_OPEN_CREATE           0x00000004
#define SQLITE_OPEN_DELETEONCLOSE    0x00000008
#define SQLITE_OPEN_EXCLUSIVE        0x00000010
#define SQLITE_OPEN_MAIN_DB          0x00000100
#define SQLITE_OPEN_TEMP_DB          0x00000200
#define SQLITE_OPEN_TRANSIENT_DB     0x00000400
#define SQLITE_OPEN_MAIN_JOURNAL     0x00000800
#define SQLITE_OPEN_TEMP_JOURNAL     0x00001000
#define SQLITE_OPEN_SUBJOURNAL       0x00002000
#define SQLITE_OPEN_MASTER_JOURNAL   0x00004000
#define SQLITE_OPEN_NOMUTEX          0x00008000

/*
** CAPI3REF: Device Characteristics {H10240} <H11120>
**
** The xDeviceCapabilities method of the [sqlite3_io_methods]
** object returns an integer which is a vector of the these
** bit values expressing I/O characteristics of the mass storage
** device that holds the file that the [sqlite3_io_methods]
** refers to.
**
** The SQLITE_IOCAP_ATOMIC property means that all writes of
** any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values
** mean that writes of blocks that are nnn bytes in size and
** are aligned to an address which is an integer multiple of
** nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means
** that when data is appended to a file, the data is appended
** first then the size of the file is extended, never the other
** way around.  The SQLITE_IOCAP_SEQUENTIAL property means that
** information is written to disk in the same order as calls
** to xWrite().
*/
#define SQLITE_IOCAP_ATOMIC          0x00000001
#define SQLITE_IOCAP_ATOMIC512       0x00000002
#define SQLITE_IOCAP_ATOMIC1K        0x00000004
#define SQLITE_IOCAP_ATOMIC2K        0x00000008
#define SQLITE_IOCAP_ATOMIC4K        0x00000010
#define SQLITE_IOCAP_ATOMIC8K        0x00000020
#define SQLITE_IOCAP_ATOMIC16K       0x00000040
#define SQLITE_IOCAP_ATOMIC32K       0x00000080
#define SQLITE_IOCAP_ATOMIC64K       0x00000100
#define SQLITE_IOCAP_SAFE_APPEND     0x00000200
#define SQLITE_IOCAP_SEQUENTIAL      0x00000400

/*
** CAPI3REF: File Locking Levels {H10250} <H11120> <H11310>
**
** SQLite uses one of these integer values as the second
** argument to calls it makes to the xLock() and xUnlock() methods
** of an [sqlite3_io_methods] object.
*/
#define SQLITE_LOCK_NONE          0
#define SQLITE_LOCK_SHARED        1
#define SQLITE_LOCK_RESERVED      2
#define SQLITE_LOCK_PENDING       3
#define SQLITE_LOCK_EXCLUSIVE     4

/*
** CAPI3REF: Synchronization Type Flags {H10260} <H11120>
**
** When SQLite invokes the xSync() method of an
** [sqlite3_io_methods] object it uses a combination of
** these integer values as the second argument.
**
** When the SQLITE_SYNC_DATAONLY flag is used, it means that the
** sync operation only needs to flush data to mass storage.  Inode
** information need not be flushed. The SQLITE_SYNC_NORMAL flag means
** to use normal fsync() semantics. The SQLITE_SYNC_FULL flag means
** to use Mac OS-X style fullsync instead of fsync().
*/
#define SQLITE_SYNC_NORMAL        0x00002
#define SQLITE_SYNC_FULL          0x00003
#define SQLITE_SYNC_DATAONLY      0x00010

/*
** CAPI3REF: OS Interface Open File Handle {H11110} <S20110>
**
** An [sqlite3_file] object represents an open file in the OS
** interface layer.  Individual OS interface implementations will
** want to subclass this object by appending additional fields
** for their own use.  The pMethods entry is a pointer to an
** [sqlite3_io_methods] object that defines methods for performing
** I/O operations on the open file.
*/
typedef struct sqlite3_file sqlite3_file;
struct sqlite3_file {
  const struct sqlite3_io_methods *pMethods;  /* Methods for an open file */
};

/*
** CAPI3REF: OS Interface File Virtual Methods Object {H11120} <S20110>
**
** Every file opened by the [sqlite3_vfs] xOpen method populates an
** [sqlite3_file] object (or, more commonly, a subclass of the
** [sqlite3_file] object) with a pointer to an instance of this object.
** This object defines the methods used to perform various operations
** against the open file represented by the [sqlite3_file] object.
**
** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or
** [SQLITE_SYNC_FULL].  The first choice is the normal fsync().
** The second choice is a Mac OS-X style fullsync.  The [SQLITE_SYNC_DATAONLY]
** flag may be ORed in to indicate that only the data of the file
** and not its inode needs to be synced.
**
** The integer values to xLock() and xUnlock() are one of
** <ul>
** <li> [SQLITE_LOCK_NONE],
** <li> [SQLITE_LOCK_SHARED],
** <li> [SQLITE_LOCK_RESERVED],
** <li> [SQLITE_LOCK_PENDING], or
** <li> [SQLITE_LOCK_EXCLUSIVE].
** </ul>
** xLock() increases the lock. xUnlock() decreases the lock.
** The xCheckReservedLock() method checks whether any database connection,
** either in this process or in some other process, is holding a RESERVED,
** PENDING, or EXCLUSIVE lock on the file.  It returns true
** if such a lock exists and false otherwise.
**
** The xFileControl() method is a generic interface that allows custom
** VFS implementations to directly control an open file using the
** [sqlite3_file_control()] interface.  The second "op" argument is an
** integer opcode.  The third argument is a generic pointer intended to
** point to a structure that may contain arguments or space in which to
** write return values.  Potential uses for xFileControl() might be
** functions to enable blocking locks with timeouts, to change the
** locking strategy (for example to use dot-file locks), to inquire
** about the status of a lock, or to break stale locks.  The SQLite
** core reserves all opcodes less than 100 for its own use.
** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available.
** Applications that define a custom xFileControl method should use opcodes
** greater than 100 to avoid conflicts.
**
** The xSectorSize() method returns the sector size of the
** device that underlies the file.  The sector size is the
** minimum write that can be performed without disturbing
** other bytes in the file.  The xDeviceCharacteristics()
** method returns a bit vector describing behaviors of the
** underlying device:
**
** <ul>
** <li> [SQLITE_IOCAP_ATOMIC]
** <li> [SQLITE_IOCAP_ATOMIC512]
** <li> [SQLITE_IOCAP_ATOMIC1K]
** <li> [SQLITE_IOCAP_ATOMIC2K]
** <li> [SQLITE_IOCAP_ATOMIC4K]
** <li> [SQLITE_IOCAP_ATOMIC8K]
** <li> [SQLITE_IOCAP_ATOMIC16K]
** <li> [SQLITE_IOCAP_ATOMIC32K]
** <li> [SQLITE_IOCAP_ATOMIC64K]
** <li> [SQLITE_IOCAP_SAFE_APPEND]
** <li> [SQLITE_IOCAP_SEQUENTIAL]
** </ul>
**
** The SQLITE_IOCAP_ATOMIC property means that all writes of
** any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values
** mean that writes of blocks that are nnn bytes in size and
** are aligned to an address which is an integer multiple of
** nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means
** that when data is appended to a file, the data is appended
** first then the size of the file is extended, never the other
** way around.  The SQLITE_IOCAP_SEQUENTIAL property means that
** information is written to disk in the same order as calls
** to xWrite().
*/
typedef struct sqlite3_io_methods sqlite3_io_methods;
struct sqlite3_io_methods {
  int iVersion;
  int (*xClose)(sqlite3_file*);
  int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);
  int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst);
  int (*xTruncate)(sqlite3_file*, sqlite3_int64 size);
  int (*xSync)(sqlite3_file*, int flags);
  int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize);
  int (*xLock)(sqlite3_file*, int);
  int (*xUnlock)(sqlite3_file*, int);
  int (*xCheckReservedLock)(sqlite3_file*, int *pResOut);
  int (*xFileControl)(sqlite3_file*, int op, void *pArg);
  int (*xSectorSize)(sqlite3_file*);
  int (*xDeviceCharacteristics)(sqlite3_file*);
  /* Additional methods may be added in future releases */
};

/*
** CAPI3REF: Standard File Control Opcodes {H11310} <S30800>
**
** These integer constants are opcodes for the xFileControl method
** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
** interface.
**
** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging.  This
** opcode causes the xFileControl method to write the current state of
** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
** into an integer that the pArg argument points to. This capability
** is used during testing and only needs to be supported when SQLITE_TEST
** is defined.
*/
#define SQLITE_FCNTL_LOCKSTATE        1

/*
** CAPI3REF: Mutex Handle {H17110} <S20130>
**
** The mutex module within SQLite defines [sqlite3_mutex] to be an
** abstract type for a mutex object.  The SQLite core never looks
** at the internal representation of an [sqlite3_mutex].  It only
** deals with pointers to the [sqlite3_mutex] object.
**
** Mutexes are created using [sqlite3_mutex_alloc()].
*/
typedef struct sqlite3_mutex sqlite3_mutex;

/*
** CAPI3REF: OS Interface Object {H11140} <S20100>
**
** An instance of the sqlite3_vfs object defines the interface between
** the SQLite core and the underlying operating system.  The "vfs"
** in the name of the object stands for "virtual file system".
**
** The value of the iVersion field is initially 1 but may be larger in
** future versions of SQLite.  Additional fields may be appended to this
** object when the iVersion value is increased.  Note that the structure
** of the sqlite3_vfs object changes in the transaction between
** SQLite version 3.5.9 and 3.6.0 and yet the iVersion field was not
** modified.
**
** The szOsFile field is the size of the subclassed [sqlite3_file]
** structure used by this VFS.  mxPathname is the maximum length of
** a pathname in this VFS.
**
** Registered sqlite3_vfs objects are kept on a linked list formed by
** the pNext pointer.  The [sqlite3_vfs_register()]
** and [sqlite3_vfs_unregister()] interfaces manage this list
** in a thread-safe way.  The [sqlite3_vfs_find()] interface
** searches the list.  Neither the application code nor the VFS
** implementation should use the pNext pointer.
**
** The pNext field is the only field in the sqlite3_vfs
** structure that SQLite will ever modify.  SQLite will only access
** or modify this field while holding a particular static mutex.
** The application should never modify anything within the sqlite3_vfs
** object once the object has been registered.
**
** The zName field holds the name of the VFS module.  The name must
** be unique across all VFS modules.
**
** {H11141} SQLite will guarantee that the zFilename parameter to xOpen
** is either a NULL pointer or string obtained
** from xFullPathname().  SQLite further guarantees that
** the string will be valid and unchanged until xClose() is
** called. {END}  Because of the previous sentense,
** the [sqlite3_file] can safely store a pointer to the
** filename if it needs to remember the filename for some reason.
** If the zFilename parameter is xOpen is a NULL pointer then xOpen
** must invite its own temporary name for the file.  Whenever the 
** xFilename parameter is NULL it will also be the case that the
** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].
**
** {H11142} The flags argument to xOpen() includes all bits set in
** the flags argument to [sqlite3_open_v2()].  Or if [sqlite3_open()]
** or [sqlite3_open16()] is used, then flags includes at least
** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. {END}
** If xOpen() opens a file read-only then it sets *pOutFlags to
** include [SQLITE_OPEN_READONLY].  Other bits in *pOutFlags may be set.
**
** {H11143} SQLite will also add one of the following flags to the xOpen()
** call, depending on the object being opened:
**
** <ul>
** <li>  [SQLITE_OPEN_MAIN_DB]
** <li>  [SQLITE_OPEN_MAIN_JOURNAL]
** <li>  [SQLITE_OPEN_TEMP_DB]
** <li>  [SQLITE_OPEN_TEMP_JOURNAL]
** <li>  [SQLITE_OPEN_TRANSIENT_DB]
** <li>  [SQLITE_OPEN_SUBJOURNAL]
** <li>  [SQLITE_OPEN_MASTER_JOURNAL]
** </ul> {END}
**
** The file I/O implementation can use the object type flags to
** change the way it deals with files.  For example, an application
** that does not care about crash recovery or rollback might make
** the open of a journal file a no-op.  Writes to this journal would
** also be no-ops, and any attempt to read the journal would return
** SQLITE_IOERR.  Or the implementation might recognize that a database
** file will be doing page-aligned sector reads and writes in a random
** order and set up its I/O subsystem accordingly.
**
** SQLite might also add one of the following flags to the xOpen method:
**
** <ul>
** <li> [SQLITE_OPEN_DELETEONCLOSE]
** <li> [SQLITE_OPEN_EXCLUSIVE]
** </ul>
**
** {H11145} The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be
** deleted when it is closed.  {H11146} The [SQLITE_OPEN_DELETEONCLOSE]
** will be set for TEMP  databases, journals and for subjournals.
**
** {H11147} The [SQLITE_OPEN_EXCLUSIVE] flag means the file should be opened
** for exclusive access.  This flag is set for all files except
** for the main database file.
**
** {H11148} At least szOsFile bytes of memory are allocated by SQLite
** to hold the  [sqlite3_file] structure passed as the third
** argument to xOpen. {END}  The xOpen method does not have to
** allocate the structure; it should just fill it in.
**
** {H11149} The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
** test whether a file is readable and writable, or [SQLITE_ACCESS_READ]
** to test whether a file is at least readable. {END}  The file can be a
** directory.
**
** {H11150} SQLite will always allocate at least mxPathname+1 bytes for the
** output buffer xFullPathname. {H11151} The exact size of the output buffer
** is also passed as a parameter to both  methods. {END}  If the output buffer
** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is
** handled as a fatal error by SQLite, vfs implementations should endeavor
** to prevent this by setting mxPathname to a sufficiently large value.
**
** The xRandomness(), xSleep(), and xCurrentTime() interfaces
** are not strictly a part of the filesystem, but they are
** included in the VFS structure for completeness.
** The xRandomness() function attempts to return nBytes bytes
** of good-quality randomness into zOut.  The return value is
** the actual number of bytes of randomness obtained.
** The xSleep() method causes the calling thread to sleep for at
** least the number of microseconds given.  The xCurrentTime()
** method returns a Julian Day Number for the current date and time.
*/
typedef struct sqlite3_vfs sqlite3_vfs;
struct sqlite3_vfs {
  int iVersion;            /* Structure version number */
  int szOsFile;            /* Size of subclassed sqlite3_file */
  int mxPathname;          /* Maximum file pathname length */
  sqlite3_vfs *pNext;      /* Next registered VFS */
  const char *zName;       /* Name of this virtual file system */
  void *pAppData;          /* Pointer to application-specific data */
  int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*,
               int flags, int *pOutFlags);
  int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir);
  int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut);
  int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut);
  void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename);
  void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg);
  void *(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol);
  void (*xDlClose)(sqlite3_vfs*, void*);
  int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut);
  int (*xSleep)(sqlite3_vfs*, int microseconds);
  int (*xCurrentTime)(sqlite3_vfs*, double*);
  int (*xGetLastError)(sqlite3_vfs*, int, char *);
  /* New fields may be appended in figure versions.  The iVersion
  ** value will increment whenever this happens. */
};

/*
** CAPI3REF: Flags for the xAccess VFS method {H11190} <H11140>
**
** {H11191} These integer constants can be used as the third parameter to
** the xAccess method of an [sqlite3_vfs] object. {END}  They determine
** what kind of permissions the xAccess method is looking for.
** {H11192} With SQLITE_ACCESS_EXISTS, the xAccess method
** simply checks whether the file exists.
** {H11193} With SQLITE_ACCESS_READWRITE, the xAccess method
** checks whether the file is both readable and writable.
** {H11194} With SQLITE_ACCESS_READ, the xAccess method
** checks whether the file is readable.
*/
#define SQLITE_ACCESS_EXISTS    0
#define SQLITE_ACCESS_READWRITE 1
#define SQLITE_ACCESS_READ      2

/*
** 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.
**
** 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
** SQLite interfaces so that an application usually does not need to
** invoke sqlite3_initialize() directly.  For example, [sqlite3_open()]
** calls sqlite3_initialize() so the SQLite library will be automatically
** initialized when [sqlite3_open()] is called if it has not be initialized
** already.  However, if SQLite is compiled with the SQLITE_OMIT_AUTOINIT
** compile-time option, then the automatic calls to sqlite3_initialize()
** are omitted and the application must call sqlite3_initialize() directly
** prior to using any other SQLite interface.  For maximum portability,
** it is recommended that applications always invoke sqlite3_initialize()
** directly prior to using any other SQLite interface.  Future releases
** of SQLite may require this.  In other words, the behavior exhibited
** when SQLite is compiled with SQLITE_OMIT_AUTOINIT might become the
** default behavior in some future release of SQLite.
**
** The sqlite3_os_init() routine does operating-system specific
** initialization of the SQLite library.  The sqlite3_os_end()
** routine undoes the effect of sqlite3_os_init().  Typical tasks
** performed by these routines include allocation or deallocation
** of static resources, initialization of global variables,
** setting up a default [sqlite3_vfs] module, or setting up
** a default configuration using [sqlite3_config()].
**
** The application should never invoke either sqlite3_os_init()
** or sqlite3_os_end() directly.  The application should only invoke
** sqlite3_initialize() and sqlite3_shutdown().  The sqlite3_os_init()
** interface is called automatically by sqlite3_initialize() and
** sqlite3_os_end() is called by sqlite3_shutdown().  Appropriate
** implementations for sqlite3_os_init() and sqlite3_os_end()
** are built into SQLite when it is compiled for unix, windows, or os/2.
** When built for other platforms (using the SQLITE_OS_OTHER=1 compile-time
** option) the application must supply a suitable implementation for
** sqlite3_os_init() and sqlite3_os_end().  An application-supplied
** implementation of sqlite3_os_init() or sqlite3_os_end()
** must return SQLITE_OK on success and some other [error code] upon
** failure.
*/
int sqlite3_initialize(void);
int sqlite3_shutdown(void);
int sqlite3_os_init(void);
int sqlite3_os_end(void);

/*
** CAPI3REF: Configuring The SQLite Library {H10145} <S20000><S30200>
** EXPERIMENTAL
**
** The sqlite3_config() interface is used to make global configuration
** changes to SQLite in order to tune SQLite to the specific needs of
** the application.  The default configuration is recommended for most
** applications and so this routine is usually not necessary.  It is
** provided to support rare applications with unusual needs.
**
** The sqlite3_config() interface is not threadsafe.  The application
** must insure that no other SQLite interfaces are invoked by other
** threads while sqlite3_config() is running.  Furthermore, sqlite3_config()
** may only be invoked prior to library initialization using
** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
** Note, however, that sqlite3_config() can be called as part of the
** implementation of an application-defined [sqlite3_os_init()].
**
** The first argument to sqlite3_config() is an integer
** [SQLITE_CONFIG_SINGLETHREAD | configuration option] that determines
** what property of SQLite is to be configured.  Subsequent arguments
** vary depending on the [SQLITE_CONFIG_SINGLETHREAD | configuration option]
** in the first argument.
**
** When a configuration option is set, sqlite3_config() returns SQLITE_OK.
** If the option is unknown or SQLite is unable to set the option
** then this routine returns a non-zero [error code].
*/
int sqlite3_config(int, ...);

/*
** CAPI3REF: Configure database connections  {H10180} <S20000>
** EXPERIMENTAL
**
** The sqlite3_db_config() interface is used to make configuration
** changes to a [database connection].  The interface is similar to
** [sqlite3_config()] except that the changes apply to a single
** [database connection] (specified in the first argument).  The
** sqlite3_db_config() interface can only be used immediately after
** the database connection is created using [sqlite3_open()],
** [sqlite3_open16()], or [sqlite3_open_v2()].  
**
** The second argument to sqlite3_db_config(D,V,...)  is the
** configuration verb - an integer code that indicates what
** aspect of the [database connection] is being configured.
** The only choice for this value is [SQLITE_DBCONFIG_LOOKASIDE].
** New verbs are likely to be added in future releases of SQLite.
** Additional arguments depend on the verb.
*/
int sqlite3_db_config(sqlite3*, int op, ...);

/*
** CAPI3REF: Memory Allocation Routines {H10155} <S20120>
** EXPERIMENTAL
**
** An instance of this object defines the interface between SQLite
** and low-level memory allocation routines.
**
** This object is used in only one place in the SQLite interface.
** A pointer to an instance of this object is the argument to
** [sqlite3_config()] when the configuration option is
** [SQLITE_CONFIG_MALLOC].  By creating an instance of this object
** and passing it to [sqlite3_config()] during configuration, an
** application can specify an alternative memory allocation subsystem
** for SQLite to use for all of its dynamic memory needs.
**
** Note that SQLite comes with a built-in memory allocator that is
** perfectly adequate for the overwhelming majority of applications
** and that this object is only useful to a tiny minority of applications
** with specialized memory allocation requirements.  This object is
** also used during testing of SQLite in order to specify an alternative
** memory allocator that simulates memory out-of-memory conditions in
** order to verify that SQLite recovers gracefully from such
** conditions.
**
** The xMalloc, xFree, and xRealloc methods must work like the
** malloc(), free(), and realloc() functions from the standard library.
**
** xSize should return the allocated size of a memory allocation
** previously obtained from xMalloc or xRealloc.  The allocated size
** is always at least as big as the requested size but may be larger.
**
** The xRoundup method returns what would be the allocated size of
** a memory allocation given a particular requested size.  Most memory
** allocators round up memory allocations at least to the next multiple
** of 8.  Some allocators round up to a larger multiple or to a power of 2.
**
** The xInit method initializes the memory allocator.  (For example,
** it might allocate any require mutexes or initialize internal data
** structures.  The xShutdown method is invoked (indirectly) by
** [sqlite3_shutdown()] and should deallocate any resources acquired
** by xInit.  The pAppData pointer is used as the only parameter to
** xInit and xShutdown.
*/
typedef struct sqlite3_mem_methods sqlite3_mem_methods;
struct sqlite3_mem_methods {
  void *(*xMalloc)(int);         /* Memory allocation function */
  void (*xFree)(void*);          /* Free a prior allocation */
  void *(*xRealloc)(void*,int);  /* Resize an allocation */
  int (*xSize)(void*);           /* Return the size of an allocation */
  int (*xRoundup)(int);          /* Round up request size to allocation size */
  int (*xInit)(void*);           /* Initialize the memory allocator */
  void (*xShutdown)(void*);      /* Deinitialize the memory allocator */
  void *pAppData;                /* Argument to xInit() and xShutdown() */
};

/*
** CAPI3REF: Configuration Options {H10160} <S20000>
** EXPERIMENTAL
**
** These constants are the available integer configuration options that
** can be passed as the first argument to the [sqlite3_config()] interface.
**
** New configuration options may be added in future releases of SQLite.
** Existing configuration options might be discontinued.  Applications
** should check the return code from [sqlite3_config()] to make sure that
** the call worked.  The [sqlite3_config()] interface will return a
** non-zero [error code] if a discontinued or unsupported configuration option
** is invoked.
**
** <dl>
** <dt>SQLITE_CONFIG_SINGLETHREAD</dt>
** <dd>There are no arguments to this option.  This option disables
** all mutexing and puts SQLite into a mode where it can only be used
** by a single thread.</dd>
**
** <dt>SQLITE_CONFIG_MULTITHREAD</dt>
** <dd>There are no arguments to this option.  This option disables
** mutexing on [database connection] and [prepared statement] objects.
** The application is responsible for serializing access to
** [database connections] and [prepared statements].  But other mutexes
** are enabled so that SQLite will be safe to use in a multi-threaded
** environment.</dd>
**
** <dt>SQLITE_CONFIG_SERIALIZED</dt>
** <dd>There are no arguments to this option.  This option enables
** all mutexes including the recursive
** mutexes on [database connection] and [prepared statement] objects.
** In this mode (which is the default when SQLite is compiled with
** [SQLITE_THREADSAFE=1]) the SQLite library will itself serialize access
** to [database connections] and [prepared statements] so that the
** application is free to use the same [database connection] or the
** same [prepared statement] in different threads at the same time.
**
** <p>This configuration option merely sets the default mutex 
** behavior to serialize access to [database connections].  Individual
** [database connections] can override this setting
** using the [SQLITE_OPEN_NOMUTEX] flag to [sqlite3_open_v2()].</p></dd>
**
** <dt>SQLITE_CONFIG_MALLOC</dt>
** <dd>This option takes a single argument which is a pointer to an
** instance of the [sqlite3_mem_methods] structure.  The argument specifies
** alternative low-level memory allocation routines to be used in place of
** the memory allocation routines built into SQLite.</dd>
**
** <dt>SQLITE_CONFIG_GETMALLOC</dt>
** <dd>This option takes a single argument which is a pointer to an
** instance of the [sqlite3_mem_methods] structure.  The [sqlite3_mem_methods]
** structure is filled with the currently defined memory allocation routines.
** This option can be used to overload the default memory allocation
** routines with a wrapper that simulations memory allocation failure or
** tracks memory usage, for example.</dd>
**
** <dt>SQLITE_CONFIG_MEMSTATUS</dt>
** <dd>This option takes single argument of type int, interpreted as a 
** boolean, which enables or disables the collection of memory allocation 
** statistics. When disabled, the following SQLite interfaces become 
** non-operational:
**   <ul>
**   <li> [sqlite3_memory_used()]
**   <li> [sqlite3_memory_highwater()]
**   <li> [sqlite3_soft_heap_limit()]
**   <li> [sqlite3_status()]
**   </ul>
** </dd>
**
** <dt>SQLITE_CONFIG_SCRATCH</dt>
** <dd>This option specifies a static memory buffer that SQLite can use for
** scratch memory.  There are three arguments:  A pointer to the memory, the
** size of each scratch buffer (sz), and the number of buffers (N).  The sz
** argument must be a multiple of 16. The sz parameter should be a few bytes
** larger than the actual scratch space required due internal overhead.
** The first
** argument should point to an allocation of at least sz*N bytes of memory.
** SQLite will use no more than one scratch buffer at once per thread, so
** N should be set to the expected maximum number of threads.  The sz
** parameter should be 6 times the size of the largest database page size.
** Scratch buffers are used as part of the btree balance operation.  If
** The btree balancer needs additional memory beyond what is provided by
** scratch buffers or if no scratch buffer space is specified, then SQLite
** goes to [sqlite3_malloc()] to obtain the memory it needs.</dd>
**
** <dt>SQLITE_CONFIG_PAGECACHE</dt>
** <dd>This option specifies a static memory buffer that SQLite can use for
** the database page cache.  There are three arguments: A pointer to the
** memory, the size of each page buffer (sz), and the number of pages (N).
** The sz argument must be a power of two between 512 and 32768.  The first
** argument should point to an allocation of at least sz*N bytes of memory.
** SQLite will use the memory provided by the first argument to satisfy its
** memory needs for the first N pages that it adds to cache.  If additional
** page cache memory is needed beyond what is provided by this option, then
** SQLite goes to [sqlite3_malloc()] for the additional storage space.
** The implementation might use one or more of the N buffers to hold 
** memory accounting information. </dd>
**
** <dt>SQLITE_CONFIG_HEAP</dt>
** <dd>This option specifies a static memory buffer that SQLite will use
** for all of its dynamic memory allocation needs beyond those provided
** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE].
** There are three arguments: A pointer to the memory, the number of
** bytes in the memory buffer, and the minimum allocation size.  If
** the first pointer (the memory pointer) is NULL, then SQLite reverts
** to using its default memory allocator (the system malloc() implementation),
** undoing any prior invocation of [SQLITE_CONFIG_MALLOC].  If the
** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or
** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory
** allocator is engaged to handle all of SQLites memory allocation needs.</dd>
**
** <dt>SQLITE_CONFIG_MUTEX</dt>
** <dd>This option takes a single argument which is a pointer to an
** instance of the [sqlite3_mutex_methods] structure.  The argument specifies
** alternative low-level mutex routines to be used in place
** the mutex routines built into SQLite.</dd>
**
** <dt>SQLITE_CONFIG_GETMUTEX</dt>
** <dd>This option takes a single argument which is a pointer to an
** instance of the [sqlite3_mutex_methods] structure.  The
** [sqlite3_mutex_methods]
** structure is filled with the currently defined mutex routines.
** This option can be used to overload the default mutex allocation
** routines with a wrapper used to track mutex usage for performance
** profiling or testing, for example.</dd>
**
** <dt>SQLITE_CONFIG_LOOKASIDE</dt>
** <dd>This option takes two arguments that determine the default
** memory allcation lookaside optimization.  The first argument is the
** size of each lookaside buffer slot and the second is the number of
** slots allocated to each database connection.</dd>
**
** </dl>
*/
#define SQLITE_CONFIG_SINGLETHREAD  1  /* nil */
#define SQLITE_CONFIG_MULTITHREAD   2  /* nil */
#define SQLITE_CONFIG_SERIALIZED    3  /* nil */
#define SQLITE_CONFIG_MALLOC        4  /* sqlite3_mem_methods* */
#define SQLITE_CONFIG_GETMALLOC     5  /* sqlite3_mem_methods* */
#define SQLITE_CONFIG_SCRATCH       6  /* void*, int sz, int N */
#define SQLITE_CONFIG_PAGECACHE     7  /* void*, int sz, int N */
#define SQLITE_CONFIG_HEAP          8  /* void*, int nByte, int min */
#define SQLITE_CONFIG_MEMSTATUS     9  /* boolean */
#define SQLITE_CONFIG_MUTEX        10  /* sqlite3_mutex_methods* */
#define SQLITE_CONFIG_GETMUTEX     11  /* sqlite3_mutex_methods* */
#define SQLITE_CONFIG_CHUNKALLOC   12  /* int threshold */
#define SQLITE_CONFIG_LOOKASIDE    13  /* int int */

/*
** CAPI3REF: Configuration Options {H10170} <S20000>
** EXPERIMENTAL
**
** These constants are the available integer configuration options that
** can be passed as the second argument to the [sqlite3_db_config()] interface.
**
** New configuration options may be added in future releases of SQLite.
** Existing configuration options might be discontinued.  Applications
** should check the return code from [sqlite3_db_config()] to make sure that
** the call worked.  The [sqlite3_db_config()] interface will return a
** non-zero [error code] if a discontinued or unsupported configuration option
** is invoked.
**
** <dl>
** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
** <dd>This option takes three additional arguments that determine the 
** [lookaside memory allocator] configuration for the [database connection].
** The first argument (the third parameter to [sqlite3_db_config()] is a
** pointer to a memory buffer to use for lookaside memory.  The first
** argument may be NULL in which case SQLite will allocate the lookaside
** buffer itself using [sqlite3_malloc()].  The second argument is the
** size of each lookaside buffer slot and the third argument is the number of
** slots.  The size of the buffer in the first argument must be greater than
** or equal to the product of the second and third arguments.</dd>
**
** </dl>
*/
#define SQLITE_DBCONFIG_LOOKASIDE    1001  /* void* int int */


/*
** CAPI3REF: Enable Or Disable Extended Result Codes {H12200} <S10700>
**
** The sqlite3_extended_result_codes() routine enables or disables the
** [extended result codes] feature of SQLite. The extended result
** codes are disabled by default for historical compatibility considerations.
**
** INVARIANTS:
**
** {H12201} Each new [database connection] shall have the
**          [extended result codes] feature disabled by default.
**
** {H12202} The [sqlite3_extended_result_codes(D,F)] interface shall enable
**          [extended result codes] for the  [database connection] D
**          if the F parameter is true, or disable them if F is false.
*/
int sqlite3_extended_result_codes(sqlite3*, int onoff);

/*
** CAPI3REF: Last Insert Rowid {H12220} <S10700>
**
** Each entry in an SQLite table has a unique 64-bit signed
** integer key called the "rowid". The rowid is always available
** as an undeclared column named ROWID, OID, or _ROWID_ as long as those
** names are not also used by explicitly declared columns. If
** the table has a column of type INTEGER PRIMARY KEY then that column
** is another alias for the rowid.
**
** This routine returns the rowid of the most recent
** successful INSERT into the database from the [database connection]
** in the first argument.  If no successful INSERTs
** have ever occurred on that database connection, zero is returned.
**
** If an INSERT occurs within a trigger, then the rowid of the inserted
** row is returned by this routine as long as the trigger is running.
** But once the trigger terminates, the value returned by this routine
** reverts to the last value inserted before the trigger fired.
**
** An INSERT that fails due to a constraint violation is not a
** successful INSERT and does not change the value returned by this
** routine.  Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK,
** and INSERT OR ABORT make no changes to the return value of this
** routine when their insertion fails.  When INSERT OR REPLACE
** encounters a constraint violation, it does not fail.  The
** INSERT continues to completion after deleting rows that caused
** the constraint problem so INSERT OR REPLACE will always change
** the return value of this interface.
**
** For the purposes of this routine, an INSERT is considered to
** be successful even if it is subsequently rolled back.
**
** INVARIANTS:
**
** {H12221} The [sqlite3_last_insert_rowid()] function returns the rowid
**          of the most recent successful INSERT performed on the same
**          [database connection] and within the same or higher level
**          trigger context, or zero if there have been no qualifying inserts.
**
** {H12223} The [sqlite3_last_insert_rowid()] function returns the
**          same value when called from the same trigger context
**          immediately before and after a ROLLBACK.
**
** ASSUMPTIONS:
**
** {A12232} If a separate thread performs a new INSERT on the same
**          database connection while the [sqlite3_last_insert_rowid()]
**          function is running and thus changes the last insert rowid,
**          then the value returned by [sqlite3_last_insert_rowid()] is
**          unpredictable and might not equal either the old or the new
**          last insert rowid.
*/
sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);

/*
** CAPI3REF: Count The Number Of Rows Modified {H12240} <S10600>
**
** This function returns the number of database rows that were changed
** or inserted or deleted by the most recently completed SQL statement
** on the [database connection] specified by the first parameter.
** Only changes that are directly specified by the INSERT, UPDATE,
** or DELETE statement are counted.  Auxiliary changes caused by
** triggers are not counted. Use the [sqlite3_total_changes()] function
** to find the total number of changes including changes caused by triggers.
**
** A "row change" is a change to a single row of a single table
** caused by an INSERT, DELETE, or UPDATE statement.  Rows that
** are changed as side effects of REPLACE constraint resolution,
** rollback, ABORT processing, DROP TABLE, or by any other
** mechanisms do not count as direct row changes.
**
** A "trigger context" is a scope of execution that begins and
** ends with the script of a trigger.  Most SQL statements are
** evaluated outside of any trigger.  This is the "top level"
** trigger context.  If a trigger fires from the top level, a
** new trigger context is entered for the duration of that one
** trigger.  Subtriggers create subcontexts for their duration.
**
** Calling [sqlite3_exec()] or [sqlite3_step()] recursively does
** not create a new trigger context.
**
** This function returns the number of direct row changes in the
** most recent INSERT, UPDATE, or DELETE statement within the same
** trigger context.
**
** Thus, when called from the top level, this function returns the
** number of changes in the most recent INSERT, UPDATE, or DELETE
** that also occurred at the top level.  Within the body of a trigger,
** the sqlite3_changes() interface can be called to find the number of
** changes in the most recently completed INSERT, UPDATE, or DELETE
** statement within the body of the same trigger.
** However, the number returned does not include changes
** caused by subtriggers since those have their own context.
**
** SQLite implements the command "DELETE FROM table" without a WHERE clause
** by dropping and recreating the table.  (This is much faster than going
** through and deleting individual elements from the table.)  Because of this
** optimization, the deletions in "DELETE FROM table" are not row changes and
** will not be counted by the sqlite3_changes() or [sqlite3_total_changes()]
** functions, regardless of the number of elements that were originally
** in the table.  To get an accurate count of the number of rows deleted, use
** "DELETE FROM table WHERE 1" instead.
**
** INVARIANTS:
**
** {H12241} The [sqlite3_changes()] function shall return the number of
**          row changes caused by the most recent INSERT, UPDATE,
**          or DELETE statement on the same database connection and
**          within the same or higher trigger context, or zero if there have
**          not been any qualifying row changes.
**
** {H12243} Statements of the form "DELETE FROM tablename" with no
**          WHERE clause shall cause subsequent calls to
**          [sqlite3_changes()] to return zero, regardless of the
**          number of rows originally in the table.
**
** ASSUMPTIONS:
**
** {A12252} If a separate thread makes changes on the same database connection
**          while [sqlite3_changes()] is running then the value returned
**          is unpredictable and not meaningful.
*/
int sqlite3_changes(sqlite3*);

/*
** CAPI3REF: Total Number Of Rows Modified {H12260} <S10600>
**
** This function returns the number of row changes caused by INSERT,
** UPDATE or DELETE statements since the [database connection] was opened.
** The count includes all changes from all trigger contexts.  However,
** the count does not include changes used to implement REPLACE constraints,
** do rollbacks or ABORT processing, or DROP table processing.
** The changes are counted as soon as the statement that makes them is
** completed (when the statement handle is passed to [sqlite3_reset()] or
** [sqlite3_finalize()]).
**
** SQLite implements the command "DELETE FROM table" without a WHERE clause
** by dropping and recreating the table.  (This is much faster than going
** through and deleting individual elements from the table.)  Because of this
** optimization, the deletions in "DELETE FROM table" are not row changes and
** will not be counted by the sqlite3_changes() or [sqlite3_total_changes()]
** functions, regardless of the number of elements that were originally
** in the table.  To get an accurate count of the number of rows deleted, use
** "DELETE FROM table WHERE 1" instead.
**
** See also the [sqlite3_changes()] interface.
**
** INVARIANTS:
**
** {H12261} The [sqlite3_total_changes()] returns the total number
**          of row changes caused by INSERT, UPDATE, and/or DELETE
**          statements on the same [database connection], in any
**          trigger context, since the database connection was created.
**
** {H12263} Statements of the form "DELETE FROM tablename" with no
**          WHERE clause shall not change the value returned
**          by [sqlite3_total_changes()].
**
** ASSUMPTIONS:
**
** {A12264} If a separate thread makes changes on the same database connection
**          while [sqlite3_total_changes()] is running then the value
**          returned is unpredictable and not meaningful.
*/
int sqlite3_total_changes(sqlite3*);

/*
** CAPI3REF: Interrupt A Long-Running Query {H12270} <S30500>
**
** This function causes any pending database operation to abort and
** return at its earliest opportunity. This routine is typically
** called in response to a user action such as pressing "Cancel"
** or Ctrl-C where the user wants a long query operation to halt
** immediately.
**
** It is safe to call this routine from a thread different from the
** thread that is currently running the database operation.  But it
** is not safe to call this routine with a [database connection] that
** is closed or might close before sqlite3_interrupt() returns.
**
** If an SQL operation is very nearly finished at the time when
** sqlite3_interrupt() is called, then it might not have an opportunity
** to be interrupted and might continue to completion.
**
** An SQL operation that is interrupted will return [SQLITE_INTERRUPT].
** If the interrupted SQL operation is an INSERT, UPDATE, or DELETE
** that is inside an explicit transaction, then the entire transaction
** will be rolled back automatically.
**
** A call to sqlite3_interrupt() has no effect on SQL statements
** that are started after sqlite3_interrupt() returns.
**
** INVARIANTS:
**
** {H12271} The [sqlite3_interrupt()] interface will force all running
**          SQL statements associated with the same database connection
**          to halt after processing at most one additional row of data.
**
** {H12272} Any SQL statement that is interrupted by [sqlite3_interrupt()]
**          will return [SQLITE_INTERRUPT].
**
** ASSUMPTIONS:
**
** {A12279} If the database connection closes while [sqlite3_interrupt()]
**          is running then bad things will likely happen.
*/
void sqlite3_interrupt(sqlite3*);

/*
** CAPI3REF: Determine If An SQL Statement Is Complete {H10510} <S70200>
**
** These routines are useful for command-line input to determine if the
** currently entered text seems to form complete a SQL statement or
** if additional input is needed before sending the text into
** SQLite for parsing.  These routines return true if the input string
** appears to be a complete SQL statement.  A statement is judged to be
** complete if it ends with a semicolon token and is not a fragment of a
** CREATE TRIGGER statement.  Semicolons that are embedded within
** string literals or quoted identifier names or comments are not
** independent tokens (they are part of the token in which they are
** embedded) and thus do not count as a statement terminator.
**
** These routines do not parse the SQL statements thus
** will not detect syntactically incorrect SQL.
**
** INVARIANTS:
**
** {H10511} A successful evaluation of [sqlite3_complete()] or
**          [sqlite3_complete16()] functions shall
**          return a numeric 1 if and only if the last non-whitespace
**          token in their input is a semicolon that is not in between
**          the BEGIN and END of a CREATE TRIGGER statement.
**
** {H10512} If a memory allocation error occurs during an invocation
**          of [sqlite3_complete()] or [sqlite3_complete16()] then the
**          routine shall return [SQLITE_NOMEM].
**
** ASSUMPTIONS:
**
** {A10512} The input to [sqlite3_complete()] must be a zero-terminated
**          UTF-8 string.
**
** {A10513} The input to [sqlite3_complete16()] must be a zero-terminated
**          UTF-16 string in native byte order.
*/
int sqlite3_complete(const char *sql);
int sqlite3_complete16(const void *sql);

/*
** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors {H12310} <S40400>
**
** This routine sets a callback function that might be invoked whenever
** an attempt is made to open a database table that another thread
** or process has locked.
**
** If the busy callback is NULL, then [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED]
** is returned immediately upon encountering the lock. If the busy callback
** is not NULL, then the callback will be invoked with two arguments.
**
** The first argument to the handler is a copy of the void* pointer which
** is the third argument to sqlite3_busy_handler().  The second argument to
** the handler callback is the number of times that the busy handler has
** been invoked for this locking event.  If the
** busy callback returns 0, then no additional attempts are made to
** access the database and [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] is returned.
** If the callback returns non-zero, then another attempt
** is made to open the database for reading and the cycle repeats.
**
** The presence of a busy handler does not guarantee that it will be invoked
** when there is lock contention. If SQLite determines that invoking the busy
** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY]
** or [SQLITE_IOERR_BLOCKED] instead of invoking the busy handler.
** Consider a scenario where one process is holding a read lock that
** it is trying to promote to a reserved lock and
** a second process is holding a reserved lock that it is trying
** to promote to an exclusive lock.  The first process cannot proceed
** because it is blocked by the second and the second process cannot
** proceed because it is blocked by the first.  If both processes
** invoke the busy handlers, neither will make any progress.  Therefore,
** SQLite returns [SQLITE_BUSY] for the first process, hoping that this
** will induce the first process to release its read lock and allow
** the second process to proceed.
**
** The default busy callback is NULL.
**
** The [SQLITE_BUSY] error is converted to [SQLITE_IOERR_BLOCKED]
** when SQLite is in the middle of a large transaction where all the
** changes will not fit into the in-memory cache.  SQLite will
** already hold a RESERVED lock on the database file, but it needs
** to promote this lock to EXCLUSIVE so that it can spill cache
** pages into the database file without harm to concurrent
** readers.  If it is unable to promote the lock, then the in-memory
** cache will be left in an inconsistent state and so the error
** code is promoted from the relatively benign [SQLITE_BUSY] to
** the more severe [SQLITE_IOERR_BLOCKED].  This error code promotion
** forces an automatic rollback of the changes.  See the
** <a href="/cvstrac/wiki?p=CorruptionFollowingBusyError">
** CorruptionFollowingBusyError</a> wiki page for a discussion of why
** this is important.
**
** There can only be a single busy handler defined for each
** [database connection].  Setting a new busy handler clears any
** previously set handler.  Note that calling [sqlite3_busy_timeout()]
** will also set or clear the busy handler.
**
** INVARIANTS:
**
** {H12311} The [sqlite3_busy_handler(D,C,A)] function shall replace
**          busy callback in the [database connection] D with a new
**          a new busy handler C and application data pointer A.
**
** {H12312} Newly created [database connections] shall have a busy
**          handler of NULL.
**
** {H12314} When two or more [database connections] share a
**          [sqlite3_enable_shared_cache | common cache],
**          the busy handler for the database connection currently using
**          the cache shall be invoked when the cache encounters a lock.
**
** {H12316} If a busy handler callback returns zero, then the SQLite interface
**          that provoked the locking event shall return [SQLITE_BUSY].
**
** {H12318} SQLite shall invokes the busy handler with two arguments which
**          are a copy of the pointer supplied by the 3rd parameter to
**          [sqlite3_busy_handler()] and a count of the number of prior
**          invocations of the busy handler for the same locking event.
**
** ASSUMPTIONS:
**
** {A12319} A busy handler must not close the database connection
**          or [prepared statement] that invoked the busy handler.
*/
int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);

/*
** CAPI3REF: Set A Busy Timeout {H12340} <S40410>
**
** This routine sets a [sqlite3_busy_handler | busy handler] that sleeps
** for a specified amount of time when a table is locked.  The handler
** will sleep multiple times until at least "ms" milliseconds of sleeping
** have accumulated. {H12343} After "ms" milliseconds of sleeping,
** the handler returns 0 which causes [sqlite3_step()] to return
** [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED].
**
** Calling this routine with an argument less than or equal to zero
** turns off all busy handlers.
**
** There can only be a single busy handler for a particular
** [database connection] any any given moment.  If another busy handler
** was defined  (using [sqlite3_busy_handler()]) prior to calling
** this routine, that other busy handler is cleared.
**
** INVARIANTS:
**
** {H12341} The [sqlite3_busy_timeout()] function shall override any prior
**          [sqlite3_busy_timeout()] or [sqlite3_busy_handler()] setting
**          on the same [database connection].
**
** {H12343} If the 2nd parameter to [sqlite3_busy_timeout()] is less than
**          or equal to zero, then the busy handler shall be cleared so that
**          all subsequent locking events immediately return [SQLITE_BUSY].
**
** {H12344} If the 2nd parameter to [sqlite3_busy_timeout()] is a positive
**          number N, then a busy handler shall be set that repeatedly calls
**          the xSleep() method in the [sqlite3_vfs | VFS interface] until
**          either the lock clears or until the cumulative sleep time
**          reported back by xSleep() exceeds N milliseconds.
*/
int sqlite3_busy_timeout(sqlite3*, int ms);

/*
** CAPI3REF: Convenience Routines For Running Queries {H12370} <S10000>
**
** Definition: A <b>result table</b> is memory data structure created by the
** [sqlite3_get_table()] interface.  A result table records the
** complete query results from one or more queries.
**
** The table conceptually has a number of rows and columns.  But
** these numbers are not part of the result table itself.  These
** numbers are obtained separately.  Let N be the number of rows
** and M be the number of columns.
**
** A result table is an array of pointers to zero-terminated UTF-8 strings.
** There are (N+1)*M elements in the array.  The first M pointers point
** to zero-terminated strings that  contain the names of the columns.
** The remaining entries all point to query results.  NULL values result
** in NULL pointers.  All other values are in their UTF-8 zero-terminated
** string representation as returned by [sqlite3_column_text()].
**
** A result table might consist of one or more memory allocations.
** It is not safe to pass a result table directly to [sqlite3_free()].
** A result table should be deallocated using [sqlite3_free_table()].
**
** As an example of the result table format, suppose a query result
** is as follows:
**
** <blockquote><pre>
**        Name        | Age
**        -----------------------
**        Alice       | 43
**        Bob         | 28
**        Cindy       | 21
** </pre></blockquote>
**
** There are two column (M==2) and three rows (N==3).  Thus the
** result table has 8 entries.  Suppose the result table is stored
** in an array names azResult.  Then azResult holds this content:
**
** <blockquote><pre>
**        azResult&#91;0] = "Name";
**        azResult&#91;1] = "Age";
**        azResult&#91;2] = "Alice";
**        azResult&#91;3] = "43";
**        azResult&#91;4] = "Bob";
**        azResult&#91;5] = "28";
**        azResult&#91;6] = "Cindy";
**        azResult&#91;7] = "21";
** </pre></blockquote>
**
** The sqlite3_get_table() function evaluates one or more
** semicolon-separated SQL statements in the zero-terminated UTF-8
** string of its 2nd parameter.  It returns a result table to the
** pointer given in its 3rd parameter.
**
** After the calling function has finished using the result, it should
** pass the pointer to the result table to sqlite3_free_table() in order to
** release the memory that was malloced.  Because of the way the
** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling
** function must not try to call [sqlite3_free()] directly.  Only
** [sqlite3_free_table()] is able to release the memory properly and safely.
**
** The sqlite3_get_table() interface is implemented as a wrapper around
** [sqlite3_exec()].  The sqlite3_get_table() routine does not have access
** to any internal data structures of SQLite.  It uses only the public
** interface defined here.  As a consequence, errors that occur in the
** wrapper layer outside of the internal [sqlite3_exec()] call are not
** reflected in subsequent calls to [sqlite3_errcode()] or [sqlite3_errmsg()].
**
** INVARIANTS:
**
** {H12371} If a [sqlite3_get_table()] fails a memory allocation, then
**          it shall free the result table under construction, abort the
**          query in process, skip any subsequent queries, set the
**          *pazResult output pointer to NULL and return [SQLITE_NOMEM].
**
** {H12373} If the pnColumn parameter to [sqlite3_get_table()] is not NULL
**          then a successful invocation of [sqlite3_get_table()] shall
**          write the number of columns in the
**          result set of the query into *pnColumn.
**
** {H12374} If the pnRow parameter to [sqlite3_get_table()] is not NULL
**          then a successful invocation of [sqlite3_get_table()] shall
**          writes the number of rows in the
**          result set of the query into *pnRow.
**
** {H12376} A successful invocation of [sqlite3_get_table()] that computes
**          N rows of result with C columns per row shall make *pazResult
**          point to an array of pointers to (N+1)*C strings where the first
**          C strings are column names as obtained from
**          [sqlite3_column_name()] and the rest are column result values
**          obtained from [sqlite3_column_text()].
**
** {H12379} The values in the pazResult array returned by [sqlite3_get_table()]
**          shall remain valid until cleared by [sqlite3_free_table()].
**
** {H12382} When an error occurs during evaluation of [sqlite3_get_table()]
**          the function shall set *pazResult to NULL, write an error message
**          into memory obtained from [sqlite3_malloc()], make
**          **pzErrmsg point to that error message, and return a
**          appropriate [error code].
*/
int sqlite3_get_table(
  sqlite3 *db,          /* An open database */
  const char *zSql,     /* SQL to be evaluated */
  char ***pazResult,    /* Results of the query */
  int *pnRow,           /* Number of result rows written here */
  int *pnColumn,        /* Number of result columns written here */
  char **pzErrmsg       /* Error msg written here */
);
void sqlite3_free_table(char **result);

/*
** CAPI3REF: Formatted String Printing Functions {H17400} <S70000><S20000>
**
** These routines are workalikes of the "printf()" family of functions
** from the standard C library.
**
** The sqlite3_mprintf() and sqlite3_vmprintf() routines write their
** results into memory obtained from [sqlite3_malloc()].
** The strings returned by these two routines should be
** released by [sqlite3_free()].  Both routines return a
** NULL pointer if [sqlite3_malloc()] is unable to allocate enough
** memory to hold the resulting string.
**
** In sqlite3_snprintf() routine is similar to "snprintf()" from
** the standard C library.  The result is written into the
** buffer supplied as the second parameter whose size is given by
** the first parameter. Note that the order of the
** first two parameters is reversed from snprintf().  This is an
** historical accident that cannot be fixed without breaking
** backwards compatibility.  Note also that sqlite3_snprintf()
** returns a pointer to its buffer instead of the number of
** characters actually written into the buffer.  We admit that
** the number of characters written would be a more useful return
** value but we cannot change the implementation of sqlite3_snprintf()
** now without breaking compatibility.
**
** As long as the buffer size is greater than zero, sqlite3_snprintf()
** guarantees that the buffer is always zero-terminated.  The first
** parameter "n" is the total size of the buffer, including space for
** the zero terminator.  So the longest string that can be completely
** written will be n-1 characters.
**
** These routines all implement some additional formatting
** options that are useful for constructing SQL statements.
** All of the usual printf() formatting options apply.  In addition, there
** is are "%q", "%Q", and "%z" options.
**
** The %q option works like %s in that it substitutes a null-terminated
** string from the argument list.  But %q also doubles every '\'' character.
** %q is designed for use inside a string literal.  By doubling each '\''
** character it escapes that character and allows it to be inserted into
** the string.
**
** For example, assume the string variable zText contains text as follows:
**
** <blockquote><pre>
**  char *zText = "It's a happy day!";
** </pre></blockquote>
**
** One can use this text in an SQL statement as follows:
**
** <blockquote><pre>
**  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES('%q')", zText);
**  sqlite3_exec(db, zSQL, 0, 0, 0);
**  sqlite3_free(zSQL);
** </pre></blockquote>
**
** Because the %q format string is used, the '\'' character in zText
** is escaped and the SQL generated is as follows:
**
** <blockquote><pre>
**  INSERT INTO table1 VALUES('It''s a happy day!')
** </pre></blockquote>
**
** This is correct.  Had we used %s instead of %q, the generated SQL
** would have looked like this:
**
** <blockquote><pre>
**  INSERT INTO table1 VALUES('It's a happy day!');
** </pre></blockquote>
**
** This second example is an SQL syntax error.  As a general rule you should
** always use %q instead of %s when inserting text into a string literal.
**
** The %Q option works like %q except it also adds single quotes around
** the outside of the total string.  Additionally, if the parameter in the
** argument list is a NULL pointer, %Q substitutes the text "NULL" (without
** single quotes) in place of the %Q option.  So, for example, one could say:
**
** <blockquote><pre>
**  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES(%Q)", zText);
**  sqlite3_exec(db, zSQL, 0, 0, 0);
**  sqlite3_free(zSQL);
** </pre></blockquote>
**
** The code above will render a correct SQL statement in the zSQL
** variable even if the zText variable is a NULL pointer.
**
** The "%z" formatting option works exactly like "%s" with the
** addition that after the string has been read and copied into
** the result, [sqlite3_free()] is called on the input string. {END}
**
** INVARIANTS:
**
** {H17403}  The [sqlite3_mprintf()] and [sqlite3_vmprintf()] interfaces
**           return either pointers to zero-terminated UTF-8 strings held in
**           memory obtained from [sqlite3_malloc()] or NULL pointers if
**           a call to [sqlite3_malloc()] fails.
**
** {H17406}  The [sqlite3_snprintf()] interface writes a zero-terminated
**           UTF-8 string into the buffer pointed to by the second parameter
**           provided that the first parameter is greater than zero.
**
** {H17407}  The [sqlite3_snprintf()] interface does not write slots of
**           its output buffer (the second parameter) outside the range
**           of 0 through N-1 (where N is the first parameter)
**           regardless of the length of the string
**           requested by the format specification.
*/
char *sqlite3_mprintf(const char*,...);
char *sqlite3_vmprintf(const char*, va_list);
char *sqlite3_snprintf(int,char*,const char*, ...);

/*
** CAPI3REF: Memory Allocation Subsystem {H17300} <S20000>
**
** The SQLite core  uses these three routines for all of its own
** internal memory allocation needs. "Core" in the previous sentence
** does not include operating-system specific VFS implementation.  The
** Windows VFS uses native malloc() and free() for some operations.
**
** The sqlite3_malloc() routine returns a pointer to a block
** of memory at least N bytes in length, where N is the parameter.
** If sqlite3_malloc() is unable to obtain sufficient free
** memory, it returns a NULL pointer.  If the parameter N to
** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns
** a NULL pointer.
**
** Calling sqlite3_free() with a pointer previously returned
** by sqlite3_malloc() or sqlite3_realloc() releases that memory so
** that it might be reused.  The sqlite3_free() routine is
** a no-op if is called with a NULL pointer.  Passing a NULL pointer
** to sqlite3_free() is harmless.  After being freed, memory
** should neither be read nor written.  Even reading previously freed
** memory might result in a segmentation fault or other severe error.
** Memory corruption, a segmentation fault, or other severe error
** might result if sqlite3_free() is called with a non-NULL pointer that
** was not obtained from sqlite3_malloc() or sqlite3_free().
**
** The sqlite3_realloc() interface attempts to resize a
** prior memory allocation to be at least N bytes, where N is the
** second parameter.  The memory allocation to be resized is the first
** parameter.  If the first parameter to sqlite3_realloc()
** is a NULL pointer then its behavior is identical to calling
** sqlite3_malloc(N) where N is the second parameter to sqlite3_realloc().
** If the second parameter to sqlite3_realloc() is zero or
** negative then the behavior is exactly the same as calling
** sqlite3_free(P) where P is the first parameter to sqlite3_realloc().
** sqlite3_realloc() returns a pointer to a memory allocation
** of at least N bytes in size or NULL if sufficient memory is unavailable.
** If M is the size of the prior allocation, then min(N,M) bytes
** of the prior allocation are copied into the beginning of buffer returned
** by sqlite3_realloc() and the prior allocation is freed.
** If sqlite3_realloc() returns NULL, then the prior allocation
** is not freed.
**
** The memory returned by sqlite3_malloc() and sqlite3_realloc()
** is always aligned to at least an 8 byte boundary. {END}
**
** The default implementation of the memory allocation subsystem uses
** the malloc(), realloc() and free() provided by the standard C library.
** {H17382} However, if SQLite is compiled with the
** SQLITE_MEMORY_SIZE=<i>NNN</i> C preprocessor macro (where <i>NNN</i>
** is an integer), then SQLite create a static array of at least
** <i>NNN</i> bytes in size and uses that array for all of its dynamic
** memory allocation needs. {END}  Additional memory allocator options
** may be added in future releases.
**
** In SQLite version 3.5.0 and 3.5.1, it was possible to define
** the SQLITE_OMIT_MEMORY_ALLOCATION which would cause the built-in
** implementation of these routines to be omitted.  That capability
** is no longer provided.  Only built-in memory allocators can be used.
**
** The Windows OS interface layer calls
** the system malloc() and free() directly when converting
** filenames between the UTF-8 encoding used by SQLite
** and whatever filename encoding is used by the particular Windows
** installation.  Memory allocation errors are detected, but
** they are reported back as [SQLITE_CANTOPEN] or
** [SQLITE_IOERR] rather than [SQLITE_NOMEM].
**
** INVARIANTS:
**
** {H17303}  The [sqlite3_malloc(N)] interface returns either a pointer to
**           a newly checked-out block of at least N bytes of memory
**           that is 8-byte aligned, or it returns NULL if it is unable
**           to fulfill the request.
**
** {H17304}  The [sqlite3_malloc(N)] interface returns a NULL pointer if
**           N is less than or equal to zero.
**
** {H17305}  The [sqlite3_free(P)] interface releases memory previously
**           returned from [sqlite3_malloc()] or [sqlite3_realloc()],
**           making it available for reuse.
**
** {H17306}  A call to [sqlite3_free(NULL)] is a harmless no-op.
**
** {H17310}  A call to [sqlite3_realloc(0,N)] is equivalent to a call
**           to [sqlite3_malloc(N)].
**
** {H17312}  A call to [sqlite3_realloc(P,0)] is equivalent to a call
**           to [sqlite3_free(P)].
**
** {H17315}  The SQLite core uses [sqlite3_malloc()], [sqlite3_realloc()],
**           and [sqlite3_free()] for all of its memory allocation and
**           deallocation needs.
**
** {H17318}  The [sqlite3_realloc(P,N)] interface returns either a pointer
**           to a block of checked-out memory of at least N bytes in size
**           that is 8-byte aligned, or a NULL pointer.
**
** {H17321}  When [sqlite3_realloc(P,N)] returns a non-NULL pointer, it first
**           copies the first K bytes of content from P into the newly
**           allocated block, where K is the lesser of N and the size of
**           the buffer P.
**
** {H17322}  When [sqlite3_realloc(P,N)] returns a non-NULL pointer, it first
**           releases the buffer P.
**
** {H17323}  When [sqlite3_realloc(P,N)] returns NULL, the buffer P is
**           not modified or released.
**
** ASSUMPTIONS:
**
** {A17350}  The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()]
**           must be either NULL or else pointers obtained from a prior
**           invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have
**           not yet been released.
**
** {A17351}  The application must not read or write any part of
**           a block of memory after it has been released using
**           [sqlite3_free()] or [sqlite3_realloc()].
*/
void *sqlite3_malloc(int);
void *sqlite3_realloc(void*, int);
void sqlite3_free(void*);

/*
** CAPI3REF: Memory Allocator Statistics {H17370} <S30210>
**
** SQLite provides these two interfaces for reporting on the status
** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()]
** routines, which form the built-in memory allocation subsystem.
**
** INVARIANTS:
**
** {H17371} The [sqlite3_memory_used()] routine returns the number of bytes
**          of memory currently outstanding (malloced but not freed).
**
** {H17373} The [sqlite3_memory_highwater()] routine returns the maximum
**          value of [sqlite3_memory_used()] since the high-water mark
**          was last reset.
**
** {H17374} The values returned by [sqlite3_memory_used()] and
**          [sqlite3_memory_highwater()] include any overhead
**          added by SQLite in its implementation of [sqlite3_malloc()],
**          but not overhead added by the any underlying system library
**          routines that [sqlite3_malloc()] may call.
**
** {H17375} The memory high-water mark is reset to the current value of
**          [sqlite3_memory_used()] if and only if the parameter to
**          [sqlite3_memory_highwater()] is true.  The value returned
**          by [sqlite3_memory_highwater(1)] is the high-water mark
**          prior to the reset.
*/
sqlite3_int64 sqlite3_memory_used(void);
sqlite3_int64 sqlite3_memory_highwater(int resetFlag);

/*
** CAPI3REF: Pseudo-Random Number Generator {H17390} <S20000>
**
** SQLite contains a high-quality pseudo-random number generator (PRNG) used to
** select random ROWIDs when inserting new records into a table that
** already uses the largest possible ROWID.  The PRNG is also used for
** the build-in random() and randomblob() SQL functions.  This interface allows
** applications to access the same PRNG for other purposes.
**
** A call to this routine stores N bytes of randomness into buffer P.
**
** The first time this routine is invoked (either internally or by
** the application) the PRNG is seeded using randomness obtained
** from the xRandomness method of the default [sqlite3_vfs] object.
** On all subsequent invocations, the pseudo-randomness is generated
** internally and without recourse to the [sqlite3_vfs] xRandomness
** method.
**
** INVARIANTS:
**
** {H17392} The [sqlite3_randomness(N,P)] interface writes N bytes of
**          high-quality pseudo-randomness into buffer P.
*/
void sqlite3_randomness(int N, void *P);

/*
** CAPI3REF: Compile-Time Authorization Callbacks {H12500} <S70100>
**
** This routine registers a authorizer callback with a particular
** [database connection], supplied in the first argument.
** The authorizer callback is invoked as SQL statements are being compiled
** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()].  At various
** points during the compilation process, as logic is being created
** to perform various actions, the authorizer callback is invoked to
** see if those actions are allowed.  The authorizer callback should
** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the
** specific action but allow the SQL statement to continue to be
** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be
** rejected with an error.  If the authorizer callback returns
** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY]
** then the [sqlite3_prepare_v2()] or equivalent call that triggered
** the authorizer will fail with an error message.
**
** When the callback returns [SQLITE_OK], that means the operation
** requested is ok.  When the callback returns [SQLITE_DENY], the
** [sqlite3_prepare_v2()] or equivalent call that triggered the
** authorizer will fail with an error message explaining that
** access is denied.  If the authorizer code is [SQLITE_READ]
** and the callback returns [SQLITE_IGNORE] then the
** [prepared statement] statement is constructed to substitute
** a NULL value in place of the table column that would have
** been read if [SQLITE_OK] had been returned.  The [SQLITE_IGNORE]
** return can be used to deny an untrusted user access to individual
** columns of a table.
**
** The first parameter to the authorizer callback is a copy of the third
** parameter to the sqlite3_set_authorizer() interface. The second parameter
** to the callback is an integer [SQLITE_COPY | action code] that specifies
** the particular action to be authorized. The third through sixth parameters
** to the callback are zero-terminated strings that contain additional
** details about the action to be authorized.
**
** An authorizer is used when [sqlite3_prepare | preparing]
** SQL statements from an untrusted source, to ensure that the SQL statements
** do not try to access data they are not allowed to see, or that they do not
** try to execute malicious statements that damage the database.  For
** example, an application may allow a user to enter arbitrary
** SQL queries for evaluation by a database.  But the application does
** not want the user to be able to make arbitrary changes to the
** database.  An authorizer could then be put in place while the
** user-entered SQL is being [sqlite3_prepare | prepared] that
** disallows everything except [SELECT] statements.
**
** Applications that need to process SQL from untrusted sources
** might also consider lowering resource limits using [sqlite3_limit()]
** and limiting database size using the [max_page_count] [PRAGMA]
** in addition to using an authorizer.
**
** Only a single authorizer can be in place on a database connection
** at a time.  Each call to sqlite3_set_authorizer overrides the
** previous call.  Disable the authorizer by installing a NULL callback.
** The authorizer is disabled by default.
**
** Note that the authorizer callback is invoked only during
** [sqlite3_prepare()] or its variants.  Authorization is not
** performed during statement evaluation in [sqlite3_step()].
**
** INVARIANTS:
**
** {H12501} The [sqlite3_set_authorizer(D,...)] interface registers a
**          authorizer callback with database connection D.
**
** {H12502} The authorizer callback is invoked as SQL statements are
**          being compiled.
**
** {H12503} If the authorizer callback returns any value other than
**          [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY], then
**          the [sqlite3_prepare_v2()] or equivalent call that caused
**          the authorizer callback to run shall fail with an
**          [SQLITE_ERROR] error code and an appropriate error message.
**
** {H12504} When the authorizer callback returns [SQLITE_OK], the operation
**          described is processed normally.
**
** {H12505} When the authorizer callback returns [SQLITE_DENY], the
**          [sqlite3_prepare_v2()] or equivalent call that caused the
**          authorizer callback to run shall fail
**          with an [SQLITE_ERROR] error code and an error message
**          explaining that access is denied.
**
** {H12506} If the authorizer code (the 2nd parameter to the authorizer
**          callback) is [SQLITE_READ] and the authorizer callback returns
**          [SQLITE_IGNORE], then the prepared statement is constructed to
**          insert a NULL value in place of the table column that would have
**          been read if [SQLITE_OK] had been returned.
**
** {H12507} If the authorizer code (the 2nd parameter to the authorizer
**          callback) is anything other than [SQLITE_READ], then
**          a return of [SQLITE_IGNORE] has the same effect as [SQLITE_DENY].
**
** {H12510} The first parameter to the authorizer callback is a copy of
**          the third parameter to the [sqlite3_set_authorizer()] interface.
**
** {H12511} The second parameter to the callback is an integer
**          [SQLITE_COPY | action code] that specifies the particular action
**          to be authorized.
**
** {H12512} The third through sixth parameters to the callback are
**          zero-terminated strings that contain
**          additional details about the action to be authorized.
**
** {H12520} Each call to [sqlite3_set_authorizer()] overrides
**          any previously installed authorizer.
**
** {H12521} A NULL authorizer means that no authorization
**          callback is invoked.
**
** {H12522} The default authorizer is NULL.
*/
int sqlite3_set_authorizer(
  sqlite3*,
  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
  void *pUserData
);

/*
** CAPI3REF: Authorizer Return Codes {H12590} <H12500>
**
** The [sqlite3_set_authorizer | authorizer callback function] must
** return either [SQLITE_OK] or one of these two constants in order
** to signal SQLite whether or not the action is permitted.  See the
** [sqlite3_set_authorizer | authorizer documentation] for additional
** information.
*/
#define SQLITE_DENY   1   /* Abort the SQL statement with an error */
#define SQLITE_IGNORE 2   /* Don't allow access, but don't generate an error */

/*
** CAPI3REF: Authorizer Action Codes {H12550} <H12500>
**
** The [sqlite3_set_authorizer()] interface registers a callback function
** that is invoked to authorize certain SQL statement actions.  The
** second parameter to the callback is an integer code that specifies
** what action is being authorized.  These are the integer action codes that
** the authorizer callback may be passed.
**
** These action code values signify what kind of operation is to be
** authorized.  The 3rd and 4th parameters to the authorization
** callback function will be parameters or NULL depending on which of these
** codes is used as the second parameter.  The 5th parameter to the
** authorizer callback is the name of the database ("main", "temp",
** etc.) if applicable.  The 6th parameter to the authorizer callback
** is the name of the inner-most trigger or view that is responsible for
** the access attempt or NULL if this access attempt is directly from
** top-level SQL code.
**
** INVARIANTS:
**
** {H12551} The second parameter to an
**          [sqlite3_set_authorizer | authorizer callback] is always an integer
**          [SQLITE_COPY | authorizer code] that specifies what action
**          is being authorized.
**
** {H12552} The 3rd and 4th parameters to the
**          [sqlite3_set_authorizer | authorization callback]
**          will be parameters or NULL depending on which
**          [SQLITE_COPY | authorizer code] is used as the second parameter.
**
** {H12553} The 5th parameter to the
**          [sqlite3_set_authorizer | authorizer callback] is the name
**          of the database (example: "main", "temp", etc.) if applicable.
**
** {H12554} The 6th parameter to the
**          [sqlite3_set_authorizer | authorizer callback] is the name
**          of the inner-most trigger or view that is responsible for
**          the access attempt or NULL if this access attempt is directly from
**          top-level SQL code.
*/
/******************************************* 3rd ************ 4th ***********/
#define SQLITE_CREATE_INDEX          1   /* Index Name      Table Name      */
#define SQLITE_CREATE_TABLE          2   /* Table Name      NULL            */
#define SQLITE_CREATE_TEMP_INDEX     3   /* Index Name      Table Name      */
#define SQLITE_CREATE_TEMP_TABLE     4   /* Table Name      NULL            */
#define SQLITE_CREATE_TEMP_TRIGGER   5   /* Trigger Name    Table Name      */
#define SQLITE_CREATE_TEMP_VIEW      6   /* View Name       NULL            */
#define SQLITE_CREATE_TRIGGER        7   /* Trigger Name    Table Name      */
#define SQLITE_CREATE_VIEW           8   /* View Name       NULL            */
#define SQLITE_DELETE                9   /* Table Name      NULL            */
#define SQLITE_DROP_INDEX           10   /* Index Name      Table Name      */
#define SQLITE_DROP_TABLE           11   /* Table Name      NULL            */
#define SQLITE_DROP_TEMP_INDEX      12   /* Index Name      Table Name      */
#define SQLITE_DROP_TEMP_TABLE      13   /* Table Name      NULL            */
#define SQLITE_DROP_TEMP_TRIGGER    14   /* Trigger Name    Table Name      */
#define SQLITE_DROP_TEMP_VIEW       15   /* View Name       NULL            */
#define SQLITE_DROP_TRIGGER         16   /* Trigger Name    Table Name      */
#define SQLITE_DROP_VIEW            17   /* View Name       NULL            */
#define SQLITE_INSERT               18   /* Table Name      NULL            */
#define SQLITE_PRAGMA               19   /* Pragma Name     1st arg or NULL */
#define SQLITE_READ                 20   /* Table Name      Column Name     */
#define SQLITE_SELECT               21   /* NULL            NULL            */
#define SQLITE_TRANSACTION          22   /* NULL            NULL            */
#define SQLITE_UPDATE               23   /* Table Name      Column Name     */
#define SQLITE_ATTACH               24   /* Filename        NULL            */
#define SQLITE_DETACH               25   /* Database Name   NULL            */
#define SQLITE_ALTER_TABLE          26   /* Database Name   Table Name      */
#define SQLITE_REINDEX              27   /* Index Name      NULL            */
#define SQLITE_ANALYZE              28   /* Table Name      NULL            */
#define SQLITE_CREATE_VTABLE        29   /* Table Name      Module Name     */
#define SQLITE_DROP_VTABLE          30   /* Table Name      Module Name     */
#define SQLITE_FUNCTION             31   /* Function Name   NULL            */
#define SQLITE_COPY                  0   /* No longer used */

/*
** CAPI3REF: Tracing And Profiling Functions {H12280} <S60400>
** EXPERIMENTAL
**
** These routines register callback functions that can be used for
** tracing and profiling the execution of SQL statements.
**
** The callback function registered by sqlite3_trace() is invoked at
** various times when an SQL statement is being run by [sqlite3_step()].
** The callback returns a UTF-8 rendering of the SQL statement text
** as the statement first begins executing.  Additional callbacks occur
** as each triggered subprogram is entered.  The callbacks for triggers
** contain a UTF-8 SQL comment that identifies the trigger.
**
** The callback function registered by sqlite3_profile() is invoked
** as each SQL statement finishes.  The profile callback contains
** the original statement text and an estimate of wall-clock time
** of how long that statement took to run.
**
** INVARIANTS:
**
** {H12281} The callback function registered by [sqlite3_trace()] is
**          whenever an SQL statement first begins to execute and
**          whenever a trigger subprogram first begins to run.
**
** {H12282} Each call to [sqlite3_trace()] overrides the previously
**          registered trace callback.
**
** {H12283} A NULL trace callback disables tracing.
**
** {H12284} The first argument to the trace callback is a copy of
**          the pointer which was the 3rd argument to [sqlite3_trace()].
**
** {H12285} The second argument to the trace callback is a
**          zero-terminated UTF-8 string containing the original text
**          of the SQL statement as it was passed into [sqlite3_prepare_v2()]
**          or the equivalent, or an SQL comment indicating the beginning
**          of a trigger subprogram.
**
** {H12287} The callback function registered by [sqlite3_profile()] is invoked
**          as each SQL statement finishes.
**
** {H12288} The first parameter to the profile callback is a copy of
**          the 3rd parameter to [sqlite3_profile()].
**
** {H12289} The second parameter to the profile callback is a
**          zero-terminated UTF-8 string that contains the complete text of
**          the SQL statement as it was processed by [sqlite3_prepare_v2()]
**          or the equivalent.
**
** {H12290} The third parameter to the profile callback is an estimate
**          of the number of nanoseconds of wall-clock time required to
**          run the SQL statement from start to finish.
*/
void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
void *sqlite3_profile(sqlite3*,
   void(*xProfile)(void*,const char*,sqlite3_uint64), void*);

/*
** CAPI3REF: Query Progress Callbacks {H12910} <S60400>
**
** This routine configures a callback function - the
** progress callback - that is invoked periodically during long
** running calls to [sqlite3_exec()], [sqlite3_step()] and
** [sqlite3_get_table()].  An example use for this
** interface is to keep a GUI updated during a large query.
**
** If the progress callback returns non-zero, the operation is
** interrupted.  This feature can be used to implement a
** "Cancel" button on a GUI dialog box.
**
** INVARIANTS:
**
** {H12911} The callback function registered by sqlite3_progress_handler()
**          is invoked periodically during long running calls to
**          [sqlite3_step()].
**
** {H12912} The progress callback is invoked once for every N virtual
**          machine opcodes, where N is the second argument to
**          the [sqlite3_progress_handler()] call that registered
**          the callback.  If N is less than 1, sqlite3_progress_handler()
**          acts as if a NULL progress handler had been specified.
**
** {H12913} The progress callback itself is identified by the third
**          argument to sqlite3_progress_handler().
**
** {H12914} The fourth argument to sqlite3_progress_handler() is a
**          void pointer passed to the progress callback
**          function each time it is invoked.
**
** {H12915} If a call to [sqlite3_step()] results in fewer than N opcodes
**          being executed, then the progress callback is never invoked.
**
** {H12916} Every call to [sqlite3_progress_handler()]
**          overwrites any previously registered progress handler.
**
** {H12917} If the progress handler callback is NULL then no progress
**          handler is invoked.
**
** {H12918} If the progress callback returns a result other than 0, then
**          the behavior is a if [sqlite3_interrupt()] had been called.
**          <S30500>
*/
void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);

/*
** CAPI3REF: Opening A New Database Connection {H12700} <S40200>
**
** These routines open an SQLite database file whose name is given by the
** filename argument. The filename argument is interpreted as UTF-8 for
** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte
** order for sqlite3_open16(). A [database connection] handle is usually
** returned in *ppDb, even if an error occurs.  The only exception is that
** if SQLite is unable to allocate memory to hold the [sqlite3] object,
** a NULL will be written into *ppDb instead of a pointer to the [sqlite3]
** object. If the database is opened (and/or created) successfully, then
** [SQLITE_OK] is returned.  Otherwise an [error code] is returned.  The
** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain
** an English language description of the error.
**
** The default encoding for the database will be UTF-8 if
** sqlite3_open() or sqlite3_open_v2() is called and
** UTF-16 in the native byte order if sqlite3_open16() is used.
**
** Whether or not an error occurs when it is opened, resources
** associated with the [database connection] handle should be released by
** passing it to [sqlite3_close()] when it is no longer required.
**
** The sqlite3_open_v2() interface works like sqlite3_open()
** except that it accepts two additional parameters for additional control
** over the new database connection.  The flags parameter can take one of
** the following three values, optionally combined with the 
** [SQLITE_OPEN_NOMUTEX] flag:
**
** <dl>
** <dt>[SQLITE_OPEN_READONLY]</dt>
** <dd>The database is opened in read-only mode.  If the database does not
** already exist, an error is returned.</dd>
**
** <dt>[SQLITE_OPEN_READWRITE]</dt>
** <dd>The database is opened for reading and writing if possible, or reading
** only if the file is write protected by the operating system.  In either
** case the database must already exist, otherwise an error is returned.</dd>
**
** <dt>[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]</dt>
** <dd>The database is opened for reading and writing, and is creates it if
** it does not already exist. This is the behavior that is always used for
** sqlite3_open() and sqlite3_open16().</dd>
** </dl>
**
** If the 3rd parameter to sqlite3_open_v2() is not one of the
** combinations shown above or one of the combinations shown above combined
** with the [SQLITE_OPEN_NOMUTEX] flag, then the behavior is undefined.
**
** If the [SQLITE_OPEN_NOMUTEX] flag is set, then mutexes on the
** opened [database connection] are disabled and the appliation must
** insure that access to the [database connection] and its associated
** [prepared statements] is serialized.  The [SQLITE_OPEN_NOMUTEX] flag
** is the default behavior is SQLite is configured using the
** [SQLITE_CONFIG_MULTITHREAD] or [SQLITE_CONFIG_SINGLETHREAD] options
** to [sqlite3_config()].  The [SQLITE_OPEN_NOMUTEX] flag only makes a
** difference when SQLite is in its default [SQLITE_CONFIG_SERIALIZED] mode.
**
** If the filename is ":memory:", then a private, temporary in-memory database
** is created for the connection.  This in-memory database will vanish when
** the database connection is closed.  Future versions of SQLite might
** make use of additional special filenames that begin with the ":" character.
** It is recommended that when a database filename actually does begin with
** a ":" character you should prefix the filename with a pathname such as
** "./" to avoid ambiguity.
**
** If the filename is an empty string, then a private, temporary
** on-disk database will be created.  This private database will be
** automatically deleted as soon as the database connection is closed.
**
** The fourth parameter to sqlite3_open_v2() is the name of the
** [sqlite3_vfs] object that defines the operating system interface that
** the new database connection should use.  If the fourth parameter is
** a NULL pointer then the default [sqlite3_vfs] object is used.
**
** <b>Note to Windows users:</b>  The encoding used for the filename argument
** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever
** codepage is currently defined.  Filenames containing international
** characters must be converted to UTF-8 prior to passing them into
** sqlite3_open() or sqlite3_open_v2().
**
** INVARIANTS:
**
** {H12701} The [sqlite3_open()], [sqlite3_open16()], and
**          [sqlite3_open_v2()] interfaces create a new
**          [database connection] associated with
**          the database file given in their first parameter.
**
** {H12702} The filename argument is interpreted as UTF-8
**          for [sqlite3_open()] and [sqlite3_open_v2()] and as UTF-16
**          in the native byte order for [sqlite3_open16()].
**
** {H12703} A successful invocation of [sqlite3_open()], [sqlite3_open16()],
**          or [sqlite3_open_v2()] writes a pointer to a new
**          [database connection] into *ppDb.
**
** {H12704} The [sqlite3_open()], [sqlite3_open16()], and
**          [sqlite3_open_v2()] interfaces return [SQLITE_OK] upon success,
**          or an appropriate [error code] on failure.
**
** {H12706} The default text encoding for a new database created using
**          [sqlite3_open()] or [sqlite3_open_v2()] will be UTF-8.
**
** {H12707} The default text encoding for a new database created using
**          [sqlite3_open16()] will be UTF-16.
**
** {H12709} The [sqlite3_open(F,D)] interface is equivalent to
**          [sqlite3_open_v2(F,D,G,0)] where the G parameter is
**          [SQLITE_OPEN_READWRITE]|[SQLITE_OPEN_CREATE].
**
** {H12711} If the G parameter to [sqlite3_open_v2(F,D,G,V)] contains the
**          bit value [SQLITE_OPEN_READONLY] then the database is opened
**          for reading only.
**
** {H12712} If the G parameter to [sqlite3_open_v2(F,D,G,V)] contains the
**          bit value [SQLITE_OPEN_READWRITE] then the database is opened
**          reading and writing if possible, or for reading only if the
**          file is write protected by the operating system.
**
** {H12713} If the G parameter to [sqlite3_open(v2(F,D,G,V)] omits the
**          bit value [SQLITE_OPEN_CREATE] and the database does not
**          previously exist, an error is returned.
**
** {H12714} If the G parameter to [sqlite3_open(v2(F,D,G,V)] contains the
**          bit value [SQLITE_OPEN_CREATE] and the database does not
**          previously exist, then an attempt is made to create and
**          initialize the database.
**
** {H12717} If the filename argument to [sqlite3_open()], [sqlite3_open16()],
**          or [sqlite3_open_v2()] is ":memory:", then an private,
**          ephemeral, in-memory database is created for the connection.
**          <todo>Is SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE required
**          in sqlite3_open_v2()?</todo>
**
** {H12719} If the filename is NULL or an empty string, then a private,
**          ephemeral on-disk database will be created.
**          <todo>Is SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE required
**          in sqlite3_open_v2()?</todo>
**
** {H12721} The [database connection] created by [sqlite3_open_v2(F,D,G,V)]
**          will use the [sqlite3_vfs] object identified by the V parameter,
**          or the default [sqlite3_vfs] object if V is a NULL pointer.
**
** {H12723} Two [database connections] will share a common cache if both were
**          opened with the same VFS while [shared cache mode] was enabled and
**          if both filenames compare equal using memcmp() after having been
**          processed by the [sqlite3_vfs | xFullPathname] method of the VFS.
*/
int sqlite3_open(
  const char *filename,   /* Database filename (UTF-8) */
  sqlite3 **ppDb          /* OUT: SQLite db handle */
);
int sqlite3_open16(
  const void *filename,   /* Database filename (UTF-16) */
  sqlite3 **ppDb          /* OUT: SQLite db handle */
);
int sqlite3_open_v2(
  const char *filename,   /* Database filename (UTF-8) */
  sqlite3 **ppDb,         /* OUT: SQLite db handle */
  int flags,              /* Flags */
  const char *zVfs        /* Name of VFS module to use */
);

/*
** CAPI3REF: Error Codes And Messages {H12800} <S60200>
**
** The sqlite3_errcode() interface returns the numeric [result code] or
** [extended result code] for the most recent failed sqlite3_* API call
** associated with a [database connection]. If a prior API call failed
** but the most recent API call succeeded, the return value from
** sqlite3_errcode() is undefined.
**
** The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
** text that describes the error, as either UTF-8 or UTF-16 respectively.
** Memory to hold the error message string is managed internally.
** The application does not need to worry about freeing the result.
** However, the error string might be overwritten or deallocated by
** subsequent calls to other SQLite interface functions.
**
** If an interface fails with SQLITE_MISUSE, that means the interface
** was invoked incorrectly by the application.  In that case, the
** error code and message may or may not be set.
**
** INVARIANTS:
**
** {H12801} The [sqlite3_errcode(D)] interface returns the numeric
**          [result code] or [extended result code] for the most recently
**          failed interface call associated with the [database connection] D.
**
** {H12803} The [sqlite3_errmsg(D)] and [sqlite3_errmsg16(D)]
**          interfaces return English-language text that describes
**          the error in the mostly recently failed interface call,
**          encoded as either UTF-8 or UTF-16 respectively.
**
** {H12807} The strings returned by [sqlite3_errmsg()] and [sqlite3_errmsg16()]
**          are valid until the next SQLite interface call.
**
** {H12808} Calls to API routines that do not return an error code
**          (example: [sqlite3_data_count()]) do not
**          change the error code or message returned by
**          [sqlite3_errcode()], [sqlite3_errmsg()], or [sqlite3_errmsg16()].
**
** {H12809} Interfaces that are not associated with a specific
**          [database connection] (examples:
**          [sqlite3_mprintf()] or [sqlite3_enable_shared_cache()]
**          do not change the values returned by
**          [sqlite3_errcode()], [sqlite3_errmsg()], or [sqlite3_errmsg16()].
*/
int sqlite3_errcode(sqlite3 *db);
const char *sqlite3_errmsg(sqlite3*);
const void *sqlite3_errmsg16(sqlite3*);

/*
** CAPI3REF: SQL Statement Object {H13000} <H13010>
** KEYWORDS: {prepared statement} {prepared statements}
**
** An instance of this object represents a single SQL statement.
** This object is variously known as a "prepared statement" or a
** "compiled SQL statement" or simply as a "statement".
**
** The life of a statement object goes something like this:
**
** <ol>
** <li> Create the object using [sqlite3_prepare_v2()] or a related
**      function.
** <li> Bind values to [host parameters] using the sqlite3_bind_*()
**      interfaces.
** <li> Run the SQL by calling [sqlite3_step()] one or more times.
** <li> Reset the statement using [sqlite3_reset()] then go back
**      to step 2.  Do this zero or more times.
** <li> Destroy the object using [sqlite3_finalize()].
** </ol>
**
** Refer to documentation on individual methods above for additional
** information.
*/
typedef struct sqlite3_stmt sqlite3_stmt;

/*
** CAPI3REF: Run-time Limits {H12760} <S20600>
**
** This interface allows the size of various constructs to be limited
** on a connection by connection basis.  The first parameter is the
** [database connection] whose limit is to be set or queried.  The
** second parameter is one of the [limit categories] that define a
** class of constructs to be size limited.  The third parameter is the
** new limit for that construct.  The function returns the old limit.
**
** If the new limit is a negative number, the limit is unchanged.
** For the limit category of SQLITE_LIMIT_XYZ there is a hard upper
** bound set by a compile-time C preprocessor macro named SQLITE_MAX_XYZ.
** (The "_LIMIT_" in the name is changed to "_MAX_".)
** Attempts to increase a limit above its hard upper bound are
** silently truncated to the hard upper limit.
**
** Run time limits are intended for use in applications that manage
** both their own internal database and also databases that are controlled
** by untrusted external sources.  An example application might be a
** webbrowser that has its own databases for storing history and
** separate databases controlled by JavaScript applications downloaded
** off the Internet.  The internal databases can be given the
** large, default limits.  Databases managed by external sources can
** be given much smaller limits designed to prevent a denial of service
** attack.  Developers might also want to use the [sqlite3_set_authorizer()]
** interface to further control untrusted SQL.  The size of the database
** created by an untrusted script can be contained using the
** [max_page_count] [PRAGMA].
**
** New run-time limit categories may be added in future releases.
**
** INVARIANTS:
**
** {H12762} A successful call to [sqlite3_limit(D,C,V)] where V is
**          positive changes the limit on the size of construct C in the
**          [database connection] D to the lesser of V and the hard upper
**          bound on the size of C that is set at compile-time.
**
** {H12766} A successful call to [sqlite3_limit(D,C,V)] where V is negative
**          leaves the state of the [database connection] D unchanged.
**
** {H12769} A successful call to [sqlite3_limit(D,C,V)] returns the
**          value of the limit on the size of construct C in the
**          [database connection] D as it was prior to the call.
*/
int sqlite3_limit(sqlite3*, int id, int newVal);

/*
** CAPI3REF: Run-Time Limit Categories {H12790} <H12760>
** KEYWORDS: {limit category} {limit categories}
**
** These constants define various aspects of a [database connection]
** that can be limited in size by calls to [sqlite3_limit()].
** The meanings of the various limits are as follows:
**
** <dl>
** <dt>SQLITE_LIMIT_LENGTH</dt>
** <dd>The maximum size of any string or BLOB or table row.<dd>
**
** <dt>SQLITE_LIMIT_SQL_LENGTH</dt>
** <dd>The maximum length of an SQL statement.</dd>
**
** <dt>SQLITE_LIMIT_COLUMN</dt>
** <dd>The maximum number of columns in a table definition or in the
** result set of a SELECT or the maximum number of columns in an index
** or in an ORDER BY or GROUP BY clause.</dd>
**
** <dt>SQLITE_LIMIT_EXPR_DEPTH</dt>
** <dd>The maximum depth of the parse tree on any expression.</dd>
**
** <dt>SQLITE_LIMIT_COMPOUND_SELECT</dt>
** <dd>The maximum number of terms in a compound SELECT statement.</dd>
**
** <dt>SQLITE_LIMIT_VDBE_OP</dt>
** <dd>The maximum number of instructions in a virtual machine program
** used to implement an SQL statement.</dd>
**
** <dt>SQLITE_LIMIT_FUNCTION_ARG</dt>
** <dd>The maximum number of arguments on a function.</dd>
**
** <dt>SQLITE_LIMIT_ATTACHED</dt>
** <dd>The maximum number of attached databases.</dd>
**
** <dt>SQLITE_LIMIT_LIKE_PATTERN_LENGTH</dt>
** <dd>The maximum length of the pattern argument to the LIKE or
** GLOB operators.</dd>
**
** <dt>SQLITE_LIMIT_VARIABLE_NUMBER</dt>
** <dd>The maximum number of variables in an SQL statement that can
** be bound.</dd>
** </dl>
*/
#define SQLITE_LIMIT_LENGTH                    0
#define SQLITE_LIMIT_SQL_LENGTH                1
#define SQLITE_LIMIT_COLUMN                    2
#define SQLITE_LIMIT_EXPR_DEPTH                3
#define SQLITE_LIMIT_COMPOUND_SELECT           4
#define SQLITE_LIMIT_VDBE_OP                   5
#define SQLITE_LIMIT_FUNCTION_ARG              6
#define SQLITE_LIMIT_ATTACHED                  7
#define SQLITE_LIMIT_LIKE_PATTERN_LENGTH       8
#define SQLITE_LIMIT_VARIABLE_NUMBER           9

/*
** CAPI3REF: Compiling An SQL Statement {H13010} <S10000>
** KEYWORDS: {SQL statement compiler}
**
** To execute an SQL query, it must first be compiled into a byte-code
** program using one of these routines.
**
** The first argument, "db", is a [database connection] obtained from a
** prior call to [sqlite3_open()], [sqlite3_open_v2()] or [sqlite3_open16()].
**
** The second argument, "zSql", is the statement to be compiled, encoded
** as either UTF-8 or UTF-16.  The sqlite3_prepare() and sqlite3_prepare_v2()
** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2()
** use UTF-16.
**
** If the nByte argument is less than zero, then zSql is read up to the
** first zero terminator. If nByte is non-negative, then it is the maximum
** number of  bytes read from zSql.  When nByte is non-negative, the
** zSql string ends at either the first '\000' or '\u0000' character or
** the nByte-th byte, whichever comes first. If the caller knows
** that the supplied string is nul-terminated, then there is a small
** performance advantage to be gained by passing an nByte parameter that
** is equal to the number of bytes in the input string <i>including</i>
** the nul-terminator bytes.
**
** *pzTail is made to point to the first byte past the end of the
** first SQL statement in zSql.  These routines only compile the first
** statement in zSql, so *pzTail is left pointing to what remains
** uncompiled.
**
** *ppStmt is left pointing to a compiled [prepared statement] that can be
** executed using [sqlite3_step()].  If there is an error, *ppStmt is set
** to NULL.  If the input text contains no SQL (if the input is an empty
** string or a comment) then *ppStmt is set to NULL.
** {A13018} The calling procedure is responsible for deleting the compiled
** SQL statement using [sqlite3_finalize()] after it has finished with it.
**
** On success, [SQLITE_OK] is returned, otherwise an [error code] is returned.
**
** 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
** return [SQLITE_SCHEMA].  But unlike the legacy behavior, [SQLITE_SCHEMA] is
** now a fatal error.  Calling [sqlite3_prepare_v2()] again will not make the
** error go away.  Note: use [sqlite3_errmsg()] to find the text
** of the parsing error that results in an [SQLITE_SCHEMA] return.
** </li>
**
** <li>
** 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>
**
** INVARIANTS:
**
** {H13011} The [sqlite3_prepare(db,zSql,...)] and
**          [sqlite3_prepare_v2(db,zSql,...)] interfaces interpret the
**          text in their zSql parameter as UTF-8.
**
** {H13012} The [sqlite3_prepare16(db,zSql,...)] and
**          [sqlite3_prepare16_v2(db,zSql,...)] interfaces interpret the
**          text in their zSql parameter as UTF-16 in the native byte order.
**
** {H13013} If the nByte argument to [sqlite3_prepare_v2(db,zSql,nByte,...)]
**          and its variants is less than zero, the SQL text is
**          read from zSql is read up to the first zero terminator.
**
** {H13014} If the nByte argument to [sqlite3_prepare_v2(db,zSql,nByte,...)]
**          and its variants is non-negative, then at most nBytes bytes of
**          SQL text is read from zSql.
**
** {H13015} In [sqlite3_prepare_v2(db,zSql,N,P,pzTail)] and its variants
**          if the zSql input text contains more than one SQL statement
**          and pzTail is not NULL, then *pzTail is made to point to the
**          first byte past the end of the first SQL statement in zSql.
**          <todo>What does *pzTail point to if there is one statement?</todo>
**
** {H13016} A successful call to [sqlite3_prepare_v2(db,zSql,N,ppStmt,...)]
**          or one of its variants writes into *ppStmt a pointer to a new
**          [prepared statement] or a pointer to NULL if zSql contains
**          nothing other than whitespace or comments.
**
** {H13019} The [sqlite3_prepare_v2()] interface and its variants return
**          [SQLITE_OK] or an appropriate [error code] upon failure.
**
** {H13021} Before [sqlite3_prepare(db,zSql,nByte,ppStmt,pzTail)] or its
**          variants returns an error (any value other than [SQLITE_OK]),
**          they first set *ppStmt to NULL.
*/
int sqlite3_prepare(
  sqlite3 *db,            /* Database handle */
  const char *zSql,       /* SQL statement, UTF-8 encoded */
  int nByte,              /* Maximum length of zSql in bytes. */
  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
  const char **pzTail     /* OUT: Pointer to unused portion of zSql */
);
int sqlite3_prepare_v2(
  sqlite3 *db,            /* Database handle */
  const char *zSql,       /* SQL statement, UTF-8 encoded */
  int nByte,              /* Maximum length of zSql in bytes. */
  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
  const char **pzTail     /* OUT: Pointer to unused portion of zSql */
);
int sqlite3_prepare16(
  sqlite3 *db,            /* Database handle */
  const void *zSql,       /* SQL statement, UTF-16 encoded */
  int nByte,              /* Maximum length of zSql in bytes. */
  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
  const void **pzTail     /* OUT: Pointer to unused portion of zSql */
);
int sqlite3_prepare16_v2(
  sqlite3 *db,            /* Database handle */
  const void *zSql,       /* SQL statement, UTF-16 encoded */
  int nByte,              /* Maximum length of zSql in bytes. */
  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
  const void **pzTail     /* OUT: Pointer to unused portion of zSql */
);

/*
** CAPIREF: Retrieving Statement SQL {H13100} <H13000>
**
** This interface can be used to retrieve a saved copy of the original
** SQL text used to create a [prepared statement] if that statement was
** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()].
**
** INVARIANTS:
**
** {H13101} If the [prepared statement] passed as the argument to
**          [sqlite3_sql()] was compiled using either [sqlite3_prepare_v2()] or
**          [sqlite3_prepare16_v2()], then [sqlite3_sql()] returns
**          a pointer to a zero-terminated string containing a UTF-8 rendering
**          of the original SQL statement.
**
** {H13102} If the [prepared statement] passed as the argument to
**          [sqlite3_sql()] was compiled using either [sqlite3_prepare()] or
**          [sqlite3_prepare16()], then [sqlite3_sql()] returns a NULL pointer.
**
** {H13103} The string returned by [sqlite3_sql(S)] is valid until the
**          [prepared statement] S is deleted using [sqlite3_finalize(S)].
*/
const char *sqlite3_sql(sqlite3_stmt *pStmt);

/*
** CAPI3REF: Dynamically Typed Value Object {H15000} <S20200>
** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
**
** SQLite uses the sqlite3_value object to represent all values
** that can be stored in a database table. SQLite uses dynamic typing
** for the values it stores. Values stored in sqlite3_value objects
** can be integers, floating point values, strings, BLOBs, or NULL.
**
** An sqlite3_value object may be either "protected" or "unprotected".
** Some interfaces require a protected sqlite3_value.  Other interfaces
** will accept either a protected or an unprotected sqlite3_value.
** Every interface that accepts sqlite3_value arguments specifies
** whether or not it requires a protected sqlite3_value.
**
** The terms "protected" and "unprotected" refer to whether or not
** a mutex is held.  A internal mutex is held for a protected
** sqlite3_value object but no mutex is held for an unprotected
** sqlite3_value object.  If SQLite is compiled to be single-threaded
** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)
** or if SQLite is run in one of reduced mutex modes 
** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]
** then there is no distinction between protected and unprotected
** sqlite3_value objects and they can be used interchangeably.  However,
** for maximum code portability it is recommended that applications
** still make the distinction between between protected and unprotected
** sqlite3_value objects even when not strictly required.
**
** The sqlite3_value objects that are passed as parameters into the
** implementation of [application-defined SQL functions] are protected.
** The sqlite3_value object returned by
** [sqlite3_column_value()] is unprotected.
** Unprotected sqlite3_value objects may only be used with
** [sqlite3_result_value()] and [sqlite3_bind_value()].
** The [sqlite3_value_blob | sqlite3_value_type()] family of
** interfaces require protected sqlite3_value objects.
*/
typedef struct Mem sqlite3_value;

/*
** CAPI3REF: SQL Function Context Object {H16001} <S20200>
**
** The context in which an SQL function executes is stored in an
** sqlite3_context object.  A pointer to an sqlite3_context object
** is always first parameter to [application-defined SQL functions].
** The application-defined SQL function implementation will pass this
** pointer through into calls to [sqlite3_result_int | sqlite3_result()],
** [sqlite3_aggregate_context()], [sqlite3_user_data()],
** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()],
** and/or [sqlite3_set_auxdata()].
*/
typedef struct sqlite3_context sqlite3_context;

/*
** CAPI3REF: Binding Values To Prepared Statements {H13500} <S70300>
** KEYWORDS: {host parameter} {host parameters} {host parameter name}
** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding}
**
** In the SQL strings input to [sqlite3_prepare_v2()] and its variants,
** literals may be replaced by a parameter in one of these forms:
**
** <ul>
** <li>  ?
** <li>  ?NNN
** <li>  :VVV
** <li>  @VVV
** <li>  $VVV
** </ul>
**
** In the parameter forms shown above NNN is an integer literal,
** and VVV is an alpha-numeric parameter name. The values of these
** parameters (also called "host parameter names" or "SQL parameters")
** can be set using the sqlite3_bind_*() routines defined here.
**
** The first argument to the sqlite3_bind_*() routines is always
** a pointer to the [sqlite3_stmt] object returned from
** [sqlite3_prepare_v2()] or its variants.
**
** The second argument is the index of the SQL parameter to be set.
** The leftmost SQL parameter has an index of 1.  When the same named
** SQL parameter is used more than once, second and subsequent
** occurrences have the same index as the first occurrence.
** The index for named parameters can be looked up using the
** [sqlite3_bind_parameter_index()] API if desired.  The index
** for "?NNN" parameters is the value of NNN.
** The NNN value must be between 1 and the [sqlite3_limit()]
** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 999).
**
** The third argument is the value to bind to the parameter.
**
** In those routines that have a fourth argument, its value is the
** number of bytes in the parameter.  To be clear: the value is the
** number of <u>bytes</u> in the value, not the number of characters.
** If the fourth parameter is negative, the length of the string is
** the number of bytes up to the first zero terminator.
**
** The fifth argument to sqlite3_bind_blob(), sqlite3_bind_text(), and
** sqlite3_bind_text16() is a destructor used to dispose of the BLOB or
** string after SQLite has finished with it. If the fifth argument is
** the special value [SQLITE_STATIC], then SQLite assumes that the
** information is in static, unmanaged space and does not need to be freed.
** If the fifth argument has the value [SQLITE_TRANSIENT], then
** SQLite makes its own private copy of the data immediately, before
** the sqlite3_bind_*() routine returns.
**
** The sqlite3_bind_zeroblob() routine binds a BLOB of length N that
** is filled with zeroes.  A zeroblob uses a fixed amount of memory
** (just an integer to hold its size) while it is being processed.
** Zeroblobs are intended to serve as placeholders for BLOBs whose
** content is later written using
** [sqlite3_blob_open | incremental BLOB I/O] routines.
** A negative value for the zeroblob results in a zero-length BLOB.
**
** The sqlite3_bind_*() routines must be called after
** [sqlite3_prepare_v2()] (and its variants) or [sqlite3_reset()] and
** before [sqlite3_step()].
** Bindings are not cleared by the [sqlite3_reset()] routine.
** Unbound parameters are interpreted as NULL.
**
** These routines return [SQLITE_OK] on success or an error code if
** anything goes wrong.  [SQLITE_RANGE] is returned if the parameter
** index is out of range.  [SQLITE_NOMEM] is returned if malloc() fails.
** [SQLITE_MISUSE] might be returned if these routines are called on a
** virtual machine that is the wrong state or which has already been finalized.
** Detection of misuse is unreliable.  Applications should not depend
** on SQLITE_MISUSE returns.  SQLITE_MISUSE is intended to indicate a
** a logic error in the application.  Future versions of SQLite might
** panic rather than return SQLITE_MISUSE.
**
** See also: [sqlite3_bind_parameter_count()],
** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].
**
** INVARIANTS:
**
** {H13506} The [SQL statement compiler] recognizes tokens of the forms
**          "?", "?NNN", "$VVV", ":VVV", and "@VVV" as SQL parameters,
**          where NNN is any sequence of one or more digits
**          and where VVV is any sequence of one or more alphanumeric
**          characters or "::" optionally followed by a string containing
**          no spaces and contained within parentheses.
**
** {H13509} The initial value of an SQL parameter is NULL.
**
** {H13512} The index of an "?" SQL parameter is one larger than the
**          largest index of SQL parameter to the left, or 1 if
**          the "?" is the leftmost SQL parameter.
**
** {H13515} The index of an "?NNN" SQL parameter is the integer NNN.
**
** {H13518} The index of an ":VVV", "$VVV", or "@VVV" SQL parameter is
**          the same as the index of leftmost occurrences of the same
**          parameter, or one more than the largest index over all
**          parameters to the left if this is the first occurrence
**          of this parameter, or 1 if this is the leftmost parameter.
**
** {H13521} The [SQL statement compiler] fails with an [SQLITE_RANGE]
**          error if the index of an SQL parameter is less than 1
**          or greater than the compile-time SQLITE_MAX_VARIABLE_NUMBER
**          parameter.
**
** {H13524} Calls to [sqlite3_bind_text | sqlite3_bind(S,N,V,...)]
**          associate the value V with all SQL parameters having an
**          index of N in the [prepared statement] S.
**
** {H13527} Calls to [sqlite3_bind_text | sqlite3_bind(S,N,...)]
**          override prior calls with the same values of S and N.
**
** {H13530} Bindings established by [sqlite3_bind_text | sqlite3_bind(S,...)]
**          persist across calls to [sqlite3_reset(S)].
**
** {H13533} In calls to [sqlite3_bind_blob(S,N,V,L,D)],
**          [sqlite3_bind_text(S,N,V,L,D)], or
**          [sqlite3_bind_text16(S,N,V,L,D)] SQLite binds the first L
**          bytes of the BLOB or string pointed to by V, when L
**          is non-negative.
**
** {H13536} In calls to [sqlite3_bind_text(S,N,V,L,D)] or
**          [sqlite3_bind_text16(S,N,V,L,D)] SQLite binds characters
**          from V through the first zero character when L is negative.
**
** {H13539} In calls to [sqlite3_bind_blob(S,N,V,L,D)],
**          [sqlite3_bind_text(S,N,V,L,D)], or
**          [sqlite3_bind_text16(S,N,V,L,D)] when D is the special
**          constant [SQLITE_STATIC], SQLite assumes that the value V
**          is held in static unmanaged space that will not change
**          during the lifetime of the binding.
**
** {H13542} In calls to [sqlite3_bind_blob(S,N,V,L,D)],
**          [sqlite3_bind_text(S,N,V,L,D)], or
**          [sqlite3_bind_text16(S,N,V,L,D)] when D is the special
**          constant [SQLITE_TRANSIENT], the routine makes a
**          private copy of the value V before it returns.
**
** {H13545} In calls to [sqlite3_bind_blob(S,N,V,L,D)],
**          [sqlite3_bind_text(S,N,V,L,D)], or
**          [sqlite3_bind_text16(S,N,V,L,D)] when D is a pointer to
**          a function, SQLite invokes that function to destroy the
**          value V after it has finished using the value V.
**
** {H13548} In calls to [sqlite3_bind_zeroblob(S,N,V,L)] the value bound
**          is a BLOB of L bytes, or a zero-length BLOB if L is negative.
**
** {H13551} In calls to [sqlite3_bind_value(S,N,V)] the V argument may
**          be either a [protected sqlite3_value] object or an
**          [unprotected sqlite3_value] object.
*/
int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
int sqlite3_bind_double(sqlite3_stmt*, int, double);
int sqlite3_bind_int(sqlite3_stmt*, int, int);
int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
int sqlite3_bind_null(sqlite3_stmt*, int);
int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*));
int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);

/*
** CAPI3REF: Number Of SQL Parameters {H13600} <S70300>
**
** This routine can be used to find the number of [SQL parameters]
** in a [prepared statement].  SQL parameters are tokens of the
** form "?", "?NNN", ":AAA", "$AAA", or "@AAA" that serve as
** placeholders for values that are [sqlite3_bind_blob | bound]
** to the parameters at a later time.
**
** This routine actually returns the index of the largest (rightmost)
** parameter. For all forms except ?NNN, this will correspond to the
** number of unique parameters.  If parameters of the ?NNN are used,
** there may be gaps in the list.
**
** See also: [sqlite3_bind_blob|sqlite3_bind()],
** [sqlite3_bind_parameter_name()], and
** [sqlite3_bind_parameter_index()].
**
** INVARIANTS:
**
** {H13601} The [sqlite3_bind_parameter_count(S)] interface returns
**          the largest index of all SQL parameters in the
**          [prepared statement] S, or 0 if S contains no SQL parameters.
*/
int sqlite3_bind_parameter_count(sqlite3_stmt*);

/*
** CAPI3REF: Name Of A Host Parameter {H13620} <S70300>
**
** This routine returns a pointer to the name of the n-th
** [SQL parameter] in a [prepared statement].
** SQL parameters of the form "?NNN" or ":AAA" or "@AAA" or "$AAA"
** have a name which is the string "?NNN" or ":AAA" or "@AAA" or "$AAA"
** respectively.
** In other words, the initial ":" or "$" or "@" or "?"
** is included as part of the name.
** Parameters of the form "?" without a following integer have no name
** and are also referred to as "anonymous parameters".
**
** The first host parameter has an index of 1, not 0.
**
** If the value n is out of range or if the n-th parameter is
** nameless, then NULL is returned.  The returned string is
** always in UTF-8 encoding even if the named parameter was
** originally specified as UTF-16 in [sqlite3_prepare16()] or
** [sqlite3_prepare16_v2()].
**
** See also: [sqlite3_bind_blob|sqlite3_bind()],
** [sqlite3_bind_parameter_count()], and
** [sqlite3_bind_parameter_index()].
**
** INVARIANTS:
**
** {H13621} The [sqlite3_bind_parameter_name(S,N)] interface returns
**          a UTF-8 rendering of the name of the SQL parameter in
**          the [prepared statement] S having index N, or
**          NULL if there is no SQL parameter with index N or if the
**          parameter with index N is an anonymous parameter "?".
*/
const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);

/*
** CAPI3REF: Index Of A Parameter With A Given Name {H13640} <S70300>
**
** Return the index of an SQL parameter given its name.  The
** index value returned is suitable for use as the second
** parameter to [sqlite3_bind_blob|sqlite3_bind()].  A zero
** is returned if no matching parameter is found.  The parameter
** name must be given in UTF-8 even if the original statement
** was prepared from UTF-16 text using [sqlite3_prepare16_v2()].
**
** See also: [sqlite3_bind_blob|sqlite3_bind()],
** [sqlite3_bind_parameter_count()], and
** [sqlite3_bind_parameter_index()].
**
** INVARIANTS:
**
** {H13641} The [sqlite3_bind_parameter_index(S,N)] interface returns
**          the index of SQL parameter in the [prepared statement]
**          S whose name matches the UTF-8 string N, or 0 if there is
**          no match.
*/
int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);

/*
** CAPI3REF: Reset All Bindings On A Prepared Statement {H13660} <S70300>
**
** Contrary to the intuition of many, [sqlite3_reset()] does not reset
** the [sqlite3_bind_blob | bindings] on a [prepared statement].
** Use this routine to reset all host parameters to NULL.
**
** INVARIANTS:
**
** {H13661} The [sqlite3_clear_bindings(S)] interface resets all SQL
**          parameter bindings in the [prepared statement] S back to NULL.
*/
int sqlite3_clear_bindings(sqlite3_stmt*);

/*
** CAPI3REF: Number Of Columns In A Result Set {H13710} <S10700>
**
** Return the number of columns in the result set returned by the
** [prepared statement]. This routine returns 0 if pStmt is an SQL
** statement that does not return data (for example an [UPDATE]).
**
** INVARIANTS:
**
** {H13711} The [sqlite3_column_count(S)] interface returns the number of
**          columns in the result set generated by the [prepared statement] S,
**          or 0 if S does not generate a result set.
*/
int sqlite3_column_count(sqlite3_stmt *pStmt);

/*
** CAPI3REF: Column Names In A Result Set {H13720} <S10700>
**
** These routines return the name assigned to a particular column
** in the result set of a [SELECT] statement.  The sqlite3_column_name()
** interface returns a pointer to a zero-terminated UTF-8 string
** and sqlite3_column_name16() returns a pointer to a zero-terminated
** UTF-16 string.  The first parameter is the [prepared statement]
** that implements the [SELECT] statement. The second parameter is the
** column number.  The leftmost column is number 0.
**
** The returned string pointer is valid until either the [prepared statement]
** is destroyed by [sqlite3_finalize()] or until the next call to
** sqlite3_column_name() or sqlite3_column_name16() on the same column.
**
** If sqlite3_malloc() fails during the processing of either routine
** (for example during a conversion from UTF-8 to UTF-16) then a
** NULL pointer is returned.
**
** The name of a result column is the value of the "AS" clause for
** that column, if there is an AS clause.  If there is no AS clause
** then the name of the column is unspecified and may change from
** one release of SQLite to the next.
**
** INVARIANTS:
**
** {H13721} A successful invocation of the [sqlite3_column_name(S,N)]
**          interface returns the name of the Nth column (where 0 is
**          the leftmost column) for the result set of the
**          [prepared statement] S as a zero-terminated UTF-8 string.
**
** {H13723} A successful invocation of the [sqlite3_column_name16(S,N)]
**          interface returns the name of the Nth column (where 0 is
**          the leftmost column) for the result set of the
**          [prepared statement] S as a zero-terminated UTF-16 string
**          in the native byte order.
**
** {H13724} The [sqlite3_column_name()] and [sqlite3_column_name16()]
**          interfaces return a NULL pointer if they are unable to
**          allocate memory to hold their normal return strings.
**
** {H13725} If the N parameter to [sqlite3_column_name(S,N)] or
**          [sqlite3_column_name16(S,N)] is out of range, then the
**          interfaces return a NULL pointer.
**
** {H13726} The strings returned by [sqlite3_column_name(S,N)] and
**          [sqlite3_column_name16(S,N)] are valid until the next
**          call to either routine with the same S and N parameters
**          or until [sqlite3_finalize(S)] is called.
**
** {H13727} When a result column of a [SELECT] statement contains
**          an AS clause, the name of that column is the identifier
**          to the right of the AS keyword.
*/
const char *sqlite3_column_name(sqlite3_stmt*, int N);
const void *sqlite3_column_name16(sqlite3_stmt*, int N);

/*
** CAPI3REF: Source Of Data In A Query Result {H13740} <S10700>
**
** These routines provide a means to determine what column of what
** table in which database a result of a [SELECT] statement comes from.
** The name of the database or table or column can be returned as
** either a UTF-8 or UTF-16 string.  The _database_ routines return
** the database name, the _table_ routines return the table name, and
** the origin_ routines return the column name.
** The returned string is valid until the [prepared statement] is destroyed
** using [sqlite3_finalize()] or until the same information is requested
** again in a different encoding.
**
** The names returned are the original un-aliased names of the
** database, table, and column.
**
** The first argument to the following calls is a [prepared statement].
** These functions return information about the Nth column returned by
** the statement, where N is the second function argument.
**
** If the Nth column returned by the statement is an expression or
** subquery and is not a column value, then all of these functions return
** NULL.  These routine might also return NULL if a memory allocation error
** occurs.  Otherwise, they return the name of the attached database, table
** and column that query result column was extracted from.
**
** As with all other SQLite APIs, those postfixed with "16" return
** UTF-16 encoded strings, the other functions return UTF-8. {END}
**
** These APIs are only available if the library was compiled with the
** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol defined.
**
** {A13751}
** If two or more threads call one or more of these routines against the same
** prepared statement and column at the same time then the results are
** undefined.
**
** INVARIANTS:
**
** {H13741} The [sqlite3_column_database_name(S,N)] interface returns either
**          the UTF-8 zero-terminated name of the database from which the
**          Nth result column of the [prepared statement] S is extracted,
**          or NULL if the Nth column of S is a general expression
**          or if unable to allocate memory to store the name.
**
** {H13742} The [sqlite3_column_database_name16(S,N)] interface returns either
**          the UTF-16 native byte order zero-terminated name of the database
**          from which the Nth result column of the [prepared statement] S is
**          extracted, or NULL if the Nth column of S is a general expression
**          or if unable to allocate memory to store the name.
**
** {H13743} The [sqlite3_column_table_name(S,N)] interface returns either
**          the UTF-8 zero-terminated name of the table from which the
**          Nth result column of the [prepared statement] S is extracted,
**          or NULL if the Nth column of S is a general expression
**          or if unable to allocate memory to store the name.
**
** {H13744} The [sqlite3_column_table_name16(S,N)] interface returns either
**          the UTF-16 native byte order zero-terminated name of the table
**          from which the Nth result column of the [prepared statement] S is
**          extracted, or NULL if the Nth column of S is a general expression
**          or if unable to allocate memory to store the name.
**
** {H13745} The [sqlite3_column_origin_name(S,N)] interface returns either
**          the UTF-8 zero-terminated name of the table column from which the
**          Nth result column of the [prepared statement] S is extracted,
**          or NULL if the Nth column of S is a general expression
**          or if unable to allocate memory to store the name.
**
** {H13746} The [sqlite3_column_origin_name16(S,N)] interface returns either
**          the UTF-16 native byte order zero-terminated name of the table
**          column from which the Nth result column of the
**          [prepared statement] S is extracted, or NULL if the Nth column
**          of S is a general expression or if unable to allocate memory
**          to store the name.
**
** {H13748} The return values from
**          [sqlite3_column_database_name | column metadata interfaces]
**          are valid for the lifetime of the [prepared statement]
**          or until the encoding is changed by another metadata
**          interface call for the same prepared statement and column.
**
** ASSUMPTIONS:
**
** {A13751} If two or more threads call one or more
**          [sqlite3_column_database_name | column metadata interfaces]
**          for the same [prepared statement] and result column
**          at the same time then the results are undefined.
*/
const char *sqlite3_column_database_name(sqlite3_stmt*,int);
const void *sqlite3_column_database_name16(sqlite3_stmt*,int);
const char *sqlite3_column_table_name(sqlite3_stmt*,int);
const void *sqlite3_column_table_name16(sqlite3_stmt*,int);
const char *sqlite3_column_origin_name(sqlite3_stmt*,int);
const void *sqlite3_column_origin_name16(sqlite3_stmt*,int);

/*
** CAPI3REF: Declared Datatype Of A Query Result {H13760} <S10700>
**
** The first parameter is a [prepared statement].
** If this statement is a [SELECT] statement and the Nth column of the
** returned result set of that [SELECT] is a table column (not an
** expression or subquery) then the declared type of the table
** column is returned.  If the Nth column of the result set is an
** expression or subquery, then a NULL pointer is returned.
** The returned string is always UTF-8 encoded. {END}
**
** For example, given the database schema:
**
** CREATE TABLE t1(c1 VARIANT);
**
** and the following statement to be compiled:
**
** SELECT c1 + 1, c1 FROM t1;
**
** this routine would return the string "VARIANT" for the second result
** column (i==1), and a NULL pointer for the first result column (i==0).
**
** SQLite uses dynamic run-time typing.  So just because a column
** is declared to contain a particular type does not mean that the
** data stored in that column is of the declared type.  SQLite is
** strongly typed, but the typing is dynamic not static.  Type
** is associated with individual values, not with the containers
** used to hold those values.
**
** INVARIANTS:
**
** {H13761}  A successful call to [sqlite3_column_decltype(S,N)] returns a
**           zero-terminated UTF-8 string containing the declared datatype
**           of the table column that appears as the Nth column (numbered
**           from 0) of the result set to the [prepared statement] S.
**
** {H13762}  A successful call to [sqlite3_column_decltype16(S,N)]
**           returns a zero-terminated UTF-16 native byte order string
**           containing the declared datatype of the table column that appears
**           as the Nth column (numbered from 0) of the result set to the
**           [prepared statement] S.
**
** {H13763}  If N is less than 0 or N is greater than or equal to
**           the number of columns in the [prepared statement] S,
**           or if the Nth column of S is an expression or subquery rather
**           than a table column, or if a memory allocation failure
**           occurs during encoding conversions, then
**           calls to [sqlite3_column_decltype(S,N)] or
**           [sqlite3_column_decltype16(S,N)] return NULL.
*/
const char *sqlite3_column_decltype(sqlite3_stmt*,int);
const void *sqlite3_column_decltype16(sqlite3_stmt*,int);

/*
** CAPI3REF: Evaluate An SQL Statement {H13200} <S10000>
**
** After a [prepared statement] has been prepared using either
** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy
** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function
** must be called one or more times to evaluate the statement.
**
** The details of the behavior of the sqlite3_step() interface depend
** on whether the statement was prepared using the newer "v2" interface
** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy
** interface [sqlite3_prepare()] and [sqlite3_prepare16()].  The use of the
** new "v2" interface is recommended for new applications but the legacy
** interface will continue to be supported.
**
** In the legacy interface, the return value will be either [SQLITE_BUSY],
** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE].
** With the "v2" interface, any of the other [result codes] or
** [extended result codes] might be returned as well.
**
** [SQLITE_BUSY] means that the database engine was unable to acquire the
** database locks it needs to do its job.  If the statement is a [COMMIT]
** or occurs outside of an explicit transaction, then you can retry the
** statement.  If the statement is not a [COMMIT] and occurs within a
** explicit transaction then you should rollback the transaction before
** continuing.
**
** [SQLITE_DONE] means that the statement has finished executing
** successfully.  sqlite3_step() should not be called again on this virtual
** machine without first calling [sqlite3_reset()] to reset the virtual
** machine back to its initial state.
**
** If the SQL statement being executed returns any data, then [SQLITE_ROW]
** is returned each time a new row of data is ready for processing by the
** caller. The values may be accessed using the [column access functions].
** sqlite3_step() is called again to retrieve the next row of data.
**
** [SQLITE_ERROR] means that a run-time error (such as a constraint
** violation) has occurred.  sqlite3_step() should not be called again on
** the VM. More information may be found by calling [sqlite3_errmsg()].
** With the legacy interface, a more specific error code (for example,
** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth)
** can be obtained by calling [sqlite3_reset()] on the
** [prepared statement].  In the "v2" interface,
** the more specific error code is returned directly by sqlite3_step().
**
** [SQLITE_MISUSE] means that the this routine was called inappropriately.
** Perhaps it was called on a [prepared statement] that has
** already been [sqlite3_finalize | finalized] or on one that had
** previously returned [SQLITE_ERROR] or [SQLITE_DONE].  Or it could
** be the case that the same database connection is being used by two or
** more threads at the same moment in time.
**
** <b>Goofy Interface Alert:</b> In the legacy interface, the sqlite3_step()
** API always returns a generic error code, [SQLITE_ERROR], following any
** error other than [SQLITE_BUSY] and [SQLITE_MISUSE].  You must call
** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the
** specific [error codes] that better describes the error.
** We admit that this is a goofy design.  The problem has been fixed
** with the "v2" interface.  If you prepare all of your SQL statements
** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead
** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,
** then the more specific [error codes] are returned directly
** by sqlite3_step().  The use of the "v2" interface is recommended.
**
** INVARIANTS:
**
** {H13202}  If the [prepared statement] S is ready to be run, then
**           [sqlite3_step(S)] advances that prepared statement until
**           completion or until it is ready to return another row of the
**           result set, or until an [sqlite3_interrupt | interrupt]
**           or a run-time error occurs.
**
** {H15304}  When a call to [sqlite3_step(S)] causes the [prepared statement]
**           S to run to completion, the function returns [SQLITE_DONE].
**
** {H15306}  When a call to [sqlite3_step(S)] stops because it is ready to
**           return another row of the result set, it returns [SQLITE_ROW].
**
** {H15308}  If a call to [sqlite3_step(S)] encounters an
**           [sqlite3_interrupt | interrupt] or a run-time error,
**           it returns an appropriate error code that is not one of
**           [SQLITE_OK], [SQLITE_ROW], or [SQLITE_DONE].
**
** {H15310}  If an [sqlite3_interrupt | interrupt] or a run-time error
**           occurs during a call to [sqlite3_step(S)]
**           for a [prepared statement] S created using
**           legacy interfaces [sqlite3_prepare()] or
**           [sqlite3_prepare16()], then the function returns either
**           [SQLITE_ERROR], [SQLITE_BUSY], or [SQLITE_MISUSE].
*/
int sqlite3_step(sqlite3_stmt*);

/*
** CAPI3REF: Number of columns in a result set {H13770} <S10700>
**
** Returns the number of values in the current row of the result set.
**
** INVARIANTS:
**
** {H13771}  After a call to [sqlite3_step(S)] that returns [SQLITE_ROW],
**           the [sqlite3_data_count(S)] routine will return the same value
**           as the [sqlite3_column_count(S)] function.
**
** {H13772}  After [sqlite3_step(S)] has returned any value other than
**           [SQLITE_ROW] or before [sqlite3_step(S)] has been called on the
**           [prepared statement] for the first time since it was
**           [sqlite3_prepare | prepared] or [sqlite3_reset | reset],
**           the [sqlite3_data_count(S)] routine returns zero.
*/
int sqlite3_data_count(sqlite3_stmt *pStmt);

/*
** CAPI3REF: Fundamental Datatypes {H10265} <S10110><S10120>
** KEYWORDS: SQLITE_TEXT
**
** {H10266} Every value in SQLite has one of five fundamental datatypes:
**
** <ul>
** <li> 64-bit signed integer
** <li> 64-bit IEEE floating point number
** <li> string
** <li> BLOB
** <li> NULL
** </ul> {END}
**
** These constants are codes for each of those types.
**
** Note that the SQLITE_TEXT constant was also used in SQLite version 2
** for a completely different meaning.  Software that links against both
** SQLite version 2 and SQLite version 3 should use SQLITE3_TEXT, not
** SQLITE_TEXT.
*/
#define SQLITE_INTEGER  1
#define SQLITE_FLOAT    2
#define SQLITE_BLOB     4
#define SQLITE_NULL     5
#ifdef SQLITE_TEXT
# undef SQLITE_TEXT
#else
# define SQLITE_TEXT     3
#endif
#define SQLITE3_TEXT     3

/*
** CAPI3REF: Result Values From A Query {H13800} <S10700>
** KEYWORDS: {column access functions}
**
** These routines form the "result set query" interface.
**
** 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
** [sqlite3_finalize()] or after [sqlite3_step()] has returned
** something other than [SQLITE_ROW], the results are undefined.
** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()]
** are called from a different thread while any of these routines
** are pending, then the results are undefined.
**
** The sqlite3_column_type() routine returns the
** [SQLITE_INTEGER | datatype code] for the initial data type
** of the result column.  The returned value is one of [SQLITE_INTEGER],
** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].  The value
** returned by sqlite3_column_type() is only meaningful if no type
** conversions have occurred as described below.  After a type conversion,
** the value returned by sqlite3_column_type() is undefined.  Future
** versions of SQLite may change the behavior of sqlite3_column_type()
** following a type conversion.
**
** If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()
** routine returns the number of bytes in that BLOB or string.
** If the result is a UTF-16 string, then sqlite3_column_bytes() converts
** the string to UTF-8 and then returns the number of bytes.
** If the result is a numeric value then sqlite3_column_bytes() uses
** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns
** the number of bytes in that string.
** The value returned does not include the zero terminator at the end
** of the string.  For clarity: the value returned is the number of
** bytes in the string, not the number of characters.
**
** Strings returned by sqlite3_column_text() and sqlite3_column_text16(),
** even empty strings, are always zero terminated.  The return
** value from sqlite3_column_blob() for a zero-length BLOB is an arbitrary
** pointer, possibly even a NULL pointer.
**
** The sqlite3_column_bytes16() routine is similar to sqlite3_column_bytes()
** but leaves the result in UTF-16 in native byte order instead of UTF-8.
** The zero terminator is not included in this count.
**
** The object returned by [sqlite3_column_value()] is an
** [unprotected sqlite3_value] object.  An unprotected sqlite3_value object
** may only be used with [sqlite3_bind_value()] and [sqlite3_result_value()].
** If the [unprotected sqlite3_value] object returned by
** [sqlite3_column_value()] is used in any other way, including calls
** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
** or [sqlite3_value_bytes()], then the behavior is undefined.
**
** These routines attempt to convert the value where appropriate.  For
** example, if the internal representation is FLOAT and a text result
** is requested, [sqlite3_snprintf()] is used internally to perform the
** conversion automatically.  The following table details the conversions
** that are applied:
**
** <blockquote>
** <table border="1">
** <tr><th> Internal<br>Type <th> Requested<br>Type <th>  Conversion
**
** <tr><td>  NULL    <td> INTEGER   <td> Result is 0
** <tr><td>  NULL    <td>  FLOAT    <td> Result is 0.0
** <tr><td>  NULL    <td>   TEXT    <td> Result is NULL pointer
** <tr><td>  NULL    <td>   BLOB    <td> Result is NULL pointer
** <tr><td> INTEGER  <td>  FLOAT    <td> Convert from integer to float
** <tr><td> INTEGER  <td>   TEXT    <td> ASCII rendering of the integer
** <tr><td> INTEGER  <td>   BLOB    <td> Same as INTEGER->TEXT
** <tr><td>  FLOAT   <td> INTEGER   <td> Convert from float to integer
** <tr><td>  FLOAT   <td>   TEXT    <td> ASCII rendering of the float
** <tr><td>  FLOAT   <td>   BLOB    <td> Same as FLOAT->TEXT
** <tr><td>  TEXT    <td> INTEGER   <td> Use atoi()
** <tr><td>  TEXT    <td>  FLOAT    <td> Use atof()
** <tr><td>  TEXT    <td>   BLOB    <td> No change
** <tr><td>  BLOB    <td> INTEGER   <td> Convert to TEXT then use atoi()
** <tr><td>  BLOB    <td>  FLOAT    <td> Convert to TEXT then use atof()
** <tr><td>  BLOB    <td>   TEXT    <td> Add a zero terminator if needed
** </table>
** </blockquote>
**
** The table above makes reference to standard C library functions atoi()
** and atof().  SQLite does not really use these functions.  It has its
** own equivalent internal routines.  The atoi() and atof() names are
** used in the table for brevity and because they are familiar to most
** C programmers.
**
** Note that when type conversions occur, pointers returned by prior
** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or
** sqlite3_column_text16() may be invalidated.
** Type conversions and pointer invalidations might occur
** in the following cases:
**
** <ul>
** <li> The initial content is a BLOB and sqlite3_column_text() or
**      sqlite3_column_text16() is called.  A zero-terminator might
**      need to be added to the string.</li>
** <li> The initial content is UTF-8 text and sqlite3_column_bytes16() or
**      sqlite3_column_text16() is called.  The content must be converted
**      to UTF-16.</li>
** <li> The initial content is UTF-16 text and sqlite3_column_bytes() or
**      sqlite3_column_text() is called.  The content must be converted
**      to UTF-8.</li>
** </ul>
**
** Conversions between UTF-16be and UTF-16le are always done in place and do
** not invalidate a prior pointer, though of course the content of the buffer
** that the prior pointer points to will have been modified.  Other kinds
** of conversion are done in place when it is possible, but sometimes they
** are not possible and in those cases prior pointers are invalidated.
**
** The safest and easiest to remember policy is to invoke these routines
** in one of the following ways:
**
** <ul>
**  <li>sqlite3_column_text() followed by sqlite3_column_bytes()</li>
**  <li>sqlite3_column_blob() followed by sqlite3_column_bytes()</li>
**  <li>sqlite3_column_text16() followed by sqlite3_column_bytes16()</li>
** </ul>
**
** In other words, you should call sqlite3_column_text(),
** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result
** into the desired format, then invoke sqlite3_column_bytes() or
** sqlite3_column_bytes16() to find the size of the result.  Do not mix calls
** to sqlite3_column_text() or sqlite3_column_blob() with calls to
** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16()
** with calls to sqlite3_column_bytes().
**
** The pointers returned are valid until a type conversion occurs as
** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
** [sqlite3_finalize()] is called.  The memory space used to hold strings
** and BLOBs is freed automatically.  Do <b>not</b> pass the pointers returned
** [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
** [sqlite3_free()].
**
** If a memory allocation error occurs during the evaluation of any
** of these routines, a default value is returned.  The default value
** is either the integer 0, the floating point number 0.0, or a NULL
** pointer.  Subsequent calls to [sqlite3_errcode()] will return
** [SQLITE_NOMEM].
**
** INVARIANTS:
**
** {H13803} The [sqlite3_column_blob(S,N)] interface converts the
**          Nth column in the current row of the result set for
**          the [prepared statement] S into a BLOB and then returns a
**          pointer to the converted value.
**
** {H13806} The [sqlite3_column_bytes(S,N)] interface returns the
**          number of bytes in the BLOB or string (exclusive of the
**          zero terminator on the string) that was returned by the
**          most recent call to [sqlite3_column_blob(S,N)] or
**          [sqlite3_column_text(S,N)].
**
** {H13809} The [sqlite3_column_bytes16(S,N)] interface returns the
**          number of bytes in the string (exclusive of the
**          zero terminator on the string) that was returned by the
**          most recent call to [sqlite3_column_text16(S,N)].
**
** {H13812} The [sqlite3_column_double(S,N)] interface converts the
**          Nth column in the current row of the result set for the
**          [prepared statement] S into a floating point value and
**          returns a copy of that value.
**
** {H13815} The [sqlite3_column_int(S,N)] interface converts the
**          Nth column in the current row of the result set for the
**          [prepared statement] S into a 64-bit signed integer and
**          returns the lower 32 bits of that integer.
**
** {H13818} The [sqlite3_column_int64(S,N)] interface converts the
**          Nth column in the current row of the result set for the
**          [prepared statement] S into a 64-bit signed integer and
**          returns a copy of that integer.
**
** {H13821} The [sqlite3_column_text(S,N)] interface converts the
**          Nth column in the current row of the result set for
**          the [prepared statement] S into a zero-terminated UTF-8
**          string and returns a pointer to that string.
**
** {H13824} The [sqlite3_column_text16(S,N)] interface converts the
**          Nth column in the current row of the result set for the
**          [prepared statement] S into a zero-terminated 2-byte
**          aligned UTF-16 native byte order string and returns
**          a pointer to that string.
**
** {H13827} The [sqlite3_column_type(S,N)] interface returns
**          one of [SQLITE_NULL], [SQLITE_INTEGER], [SQLITE_FLOAT],
**          [SQLITE_TEXT], or [SQLITE_BLOB] as appropriate for
**          the Nth column in the current row of the result set for
**          the [prepared statement] S.
**
** {H13830} The [sqlite3_column_value(S,N)] interface returns a
**          pointer to an [unprotected sqlite3_value] object for the
**          Nth column in the current row of the result set for
**          the [prepared statement] S.
*/
const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
double sqlite3_column_double(sqlite3_stmt*, int iCol);
int sqlite3_column_int(sqlite3_stmt*, int iCol);
sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
int sqlite3_column_type(sqlite3_stmt*, int iCol);
sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);

/*
** CAPI3REF: Destroy A Prepared Statement Object {H13300} <S70300><S30100>
**
** The sqlite3_finalize() function is called to delete a [prepared statement].
** If the statement was executed successfully or not executed at all, then
** SQLITE_OK is returned. If execution of the statement failed then an
** [error code] or [extended error code] is returned.
**
** This routine can be called at any point during the execution of the
** [prepared statement].  If the virtual machine has not
** completed execution when this routine is called, that is like
** encountering an error or an [sqlite3_interrupt | interrupt].
** Incomplete updates may be rolled back and transactions canceled,
** depending on the circumstances, and the
** [error code] returned will be [SQLITE_ABORT].
**
** INVARIANTS:
**
** {H11302} The [sqlite3_finalize(S)] interface destroys the
**          [prepared statement] S and releases all
**          memory and file resources held by that object.
**
** {H11304} If the most recent call to [sqlite3_step(S)] for the
**          [prepared statement] S returned an error,
**          then [sqlite3_finalize(S)] returns that same error.
*/
int sqlite3_finalize(sqlite3_stmt *pStmt);

/*
** CAPI3REF: Reset A Prepared Statement Object {H13330} <S70300>
**
** The sqlite3_reset() function is called to reset a [prepared statement]
** object back to its initial state, ready to be re-executed.
** Any SQL statement variables that had values bound to them using
** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values.
** Use [sqlite3_clear_bindings()] to reset the bindings.
**
** {H11332} The [sqlite3_reset(S)] interface resets the [prepared statement] S
**          back to the beginning of its program.
**
** {H11334} If the most recent call to [sqlite3_step(S)] for the
**          [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE],
**          or if [sqlite3_step(S)] has never before been called on S,
**          then [sqlite3_reset(S)] returns [SQLITE_OK].
**
** {H11336} If the most recent call to [sqlite3_step(S)] for the
**          [prepared statement] S indicated an error, then
**          [sqlite3_reset(S)] returns an appropriate [error code].
**
** {H11338} The [sqlite3_reset(S)] interface does not change the values
**          of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
*/
int sqlite3_reset(sqlite3_stmt *pStmt);

/*
** CAPI3REF: Create Or Redefine SQL Functions {H16100} <S20200>
** KEYWORDS: {function creation routines}
** KEYWORDS: {application-defined SQL function}
** KEYWORDS: {application-defined SQL functions}
**
** These two functions (collectively known as "function creation routines")
** are used to add SQL functions or aggregates or to redefine the behavior
** of existing SQL functions or aggregates.  The only difference between the
** two is that the second parameter, the name of the (scalar) function or
** aggregate, is encoded in UTF-8 for sqlite3_create_function() and UTF-16
** for sqlite3_create_function16().
**
** The first parameter is the [database connection] to which the SQL
** function is to be added.  If a single program uses more than one database
** connection internally, then SQL functions must be added individually to
** each database connection.
**
** The second parameter is the name of the SQL function to be created or
** redefined.  The length of the name is limited to 255 bytes, exclusive of
** the zero-terminator.  Note that the name length limit is in bytes, not
** characters.  Any attempt to create a function with a longer name
** will result in [SQLITE_ERROR] being returned.
**
** The third parameter is the number of arguments that the SQL function or
** aggregate takes. If this parameter is negative, then the SQL function or
** aggregate may take any number of arguments.
**
** The fourth parameter, eTextRep, specifies what
** [SQLITE_UTF8 | text encoding] this SQL function prefers for
** its parameters.  Any SQL function implementation should be able to work
** work with UTF-8, UTF-16le, or UTF-16be.  But some implementations may be
** more efficient with one encoding than another.  It is allowed to
** invoke sqlite3_create_function() or sqlite3_create_function16() multiple
** times with the same function but with different values of eTextRep.
** When multiple implementations of the same function are available, SQLite
** will pick the one that involves the least amount of data conversion.
** If there is only a single implementation which does not care what text
** encoding is used, then the fourth argument should be [SQLITE_ANY].
**
** The fifth parameter is an arbitrary pointer.  The implementation of the
** function can gain access to this pointer using [sqlite3_user_data()].
**
** The seventh, eighth and ninth parameters, xFunc, xStep and xFinal, are
** pointers to C-language functions that implement the SQL function or
** aggregate. A scalar SQL function requires an implementation of the xFunc
** callback only, NULL pointers should be passed as the xStep and xFinal
** parameters. An aggregate SQL function requires an implementation of xStep
** and xFinal and NULL should be passed for xFunc. To delete an existing
** SQL function or aggregate, pass NULL for all three function callbacks.
**
** It is permitted to register multiple implementations of the same
** functions with the same name but with either differing numbers of
** arguments or differing preferred text encodings.  SQLite will use
** the implementation most closely matches the way in which the
** SQL function is used.
**
** INVARIANTS:
**
** {H16103} The [sqlite3_create_function16()] interface behaves exactly
**          like [sqlite3_create_function()] in every way except that it
**          interprets the zFunctionName argument as zero-terminated UTF-16
**          native byte order instead of as zero-terminated UTF-8.
**
** {H16106} A successful invocation of
**          the [sqlite3_create_function(D,X,N,E,...)] interface registers
**          or replaces callback functions in the [database connection] D
**          used to implement the SQL function named X with N parameters
**          and having a preferred text encoding of E.
**
** {H16109} A successful call to [sqlite3_create_function(D,X,N,E,P,F,S,L)]
**          replaces the P, F, S, and L values from any prior calls with
**          the same D, X, N, and E values.
**
** {H16112} The [sqlite3_create_function(D,X,...)] interface fails with
**          a return code of [SQLITE_ERROR] if the SQL function name X is
**          longer than 255 bytes exclusive of the zero terminator.
**
** {H16118} Either F must be NULL and S and L are non-NULL or else F
**          is non-NULL and S and L are NULL, otherwise
**          [sqlite3_create_function(D,X,N,E,P,F,S,L)] returns [SQLITE_ERROR].
**
** {H16121} The [sqlite3_create_function(D,...)] interface fails with an
**          error code of [SQLITE_BUSY] if there exist [prepared statements]
**          associated with the [database connection] D.
**
** {H16124} The [sqlite3_create_function(D,X,N,...)] interface fails with an
**          error code of [SQLITE_ERROR] if parameter N (specifying the number
**          of arguments to the SQL function being registered) is less
**          than -1 or greater than 127.
**
** {H16127} When N is non-negative, the [sqlite3_create_function(D,X,N,...)]
**          interface causes callbacks to be invoked for the SQL function
**          named X when the number of arguments to the SQL function is
**          exactly N.
**
** {H16130} When N is -1, the [sqlite3_create_function(D,X,N,...)]
**          interface causes callbacks to be invoked for the SQL function
**          named X with any number of arguments.
**
** {H16133} When calls to [sqlite3_create_function(D,X,N,...)]
**          specify multiple implementations of the same function X
**          and when one implementation has N>=0 and the other has N=(-1)
**          the implementation with a non-zero N is preferred.
**
** {H16136} When calls to [sqlite3_create_function(D,X,N,E,...)]
**          specify multiple implementations of the same function X with
**          the same number of arguments N but with different
**          encodings E, then the implementation where E matches the
**          database encoding is preferred.
**
** {H16139} For an aggregate SQL function created using
**          [sqlite3_create_function(D,X,N,E,P,0,S,L)] the finalizer
**          function L will always be invoked exactly once if the
**          step function S is called one or more times.
**
** {H16142} When SQLite invokes either the xFunc or xStep function of
**          an application-defined SQL function or aggregate created
**          by [sqlite3_create_function()] or [sqlite3_create_function16()],
**          then the array of [sqlite3_value] objects passed as the
**          third parameter are always [protected sqlite3_value] objects.
*/
int sqlite3_create_function(
  sqlite3 *db,
  const char *zFunctionName,
  int nArg,
  int eTextRep,
  void *pApp,
  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
  void (*xFinal)(sqlite3_context*)
);
int sqlite3_create_function16(
  sqlite3 *db,
  const void *zFunctionName,
  int nArg,
  int eTextRep,
  void *pApp,
  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
  void (*xFinal)(sqlite3_context*)
);

/*
** CAPI3REF: Text Encodings {H10267} <S50200> <H16100>
**
** These constant define integer codes that represent the various
** text encodings supported by SQLite.
*/
#define SQLITE_UTF8           1
#define SQLITE_UTF16LE        2
#define SQLITE_UTF16BE        3
#define SQLITE_UTF16          4    /* Use native byte order */
#define SQLITE_ANY            5    /* sqlite3_create_function only */
#define SQLITE_UTF16_ALIGNED  8    /* sqlite3_create_collation only */

/*
** CAPI3REF: Deprecated Functions
** DEPRECATED
**
** These functions are [deprecated].  In order to maintain
** backwards compatibility with older code, these functions continue 
** to be supported.  However, new applications should avoid
** the use of these functions.  To help encourage people to avoid
** using these functions, we are not going to tell you want they do.
*/
int sqlite3_aggregate_count(sqlite3_context*);
int sqlite3_expired(sqlite3_stmt*);
int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
int sqlite3_global_recover(void);
void sqlite3_thread_cleanup(void);
int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),void*,sqlite3_int64);

/*
** CAPI3REF: Obtaining SQL Function Parameter Values {H15100} <S20200>
**
** The C-language implementation of SQL functions and aggregates uses
** this set of interface routines to access the parameter values on
** the function or aggregate.
**
** The xFunc (for scalar functions) or xStep (for aggregates) parameters
** to [sqlite3_create_function()] and [sqlite3_create_function16()]
** define callbacks that implement the SQL functions and aggregates.
** The 4th parameter to these callbacks is an array of pointers to
** [protected sqlite3_value] objects.  There is one [sqlite3_value] object for
** each parameter to the SQL function.  These routines are used to
** extract values from the [sqlite3_value] objects.
**
** These routines work only with [protected sqlite3_value] objects.
** Any attempt to use these routines on an [unprotected sqlite3_value]
** object results in undefined behavior.
**
** These routines work just like the corresponding [column access functions]
** except that  these routines take a single [protected sqlite3_value] object
** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.
**
** The sqlite3_value_text16() interface extracts a UTF-16 string
** in the native byte-order of the host machine.  The
** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces
** extract UTF-16 strings as big-endian and little-endian respectively.
**
** The sqlite3_value_numeric_type() interface attempts to apply
** numeric affinity to the value.  This means that an attempt is
** made to convert the value to an integer or floating point.  If
** such a conversion is possible without loss of information (in other
** words, if the value is a string that looks like a number)
** then the conversion is performed.  Otherwise no conversion occurs.
** The [SQLITE_INTEGER | datatype] after conversion is returned.
**
** Please pay particular attention to the fact that the pointer returned
** from [sqlite3_value_blob()], [sqlite3_value_text()], or
** [sqlite3_value_text16()] can be invalidated by a subsequent call to
** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()],
** or [sqlite3_value_text16()].
**
** These routines must be called from the same thread as
** the SQL function that supplied the [sqlite3_value*] parameters.
**
** INVARIANTS:
**
** {H15103} The [sqlite3_value_blob(V)] interface converts the
**          [protected sqlite3_value] object V into a BLOB and then
**          returns a pointer to the converted value.
**
** {H15106} The [sqlite3_value_bytes(V)] interface returns the
**          number of bytes in the BLOB or string (exclusive of the
**          zero terminator on the string) that was returned by the
**          most recent call to [sqlite3_value_blob(V)] or
**          [sqlite3_value_text(V)].
**
** {H15109} The [sqlite3_value_bytes16(V)] interface returns the
**          number of bytes in the string (exclusive of the
**          zero terminator on the string) that was returned by the
**          most recent call to [sqlite3_value_text16(V)],
**          [sqlite3_value_text16be(V)], or [sqlite3_value_text16le(V)].
**
** {H15112} The [sqlite3_value_double(V)] interface converts the
**          [protected sqlite3_value] object V into a floating point value and
**          returns a copy of that value.
**
** {H15115} The [sqlite3_value_int(V)] interface converts the
**          [protected sqlite3_value] object V into a 64-bit signed integer and
**          returns the lower 32 bits of that integer.
**
** {H15118} The [sqlite3_value_int64(V)] interface converts the
**          [protected sqlite3_value] object V into a 64-bit signed integer and
**          returns a copy of that integer.
**
** {H15121} The [sqlite3_value_text(V)] interface converts the
**          [protected sqlite3_value] object V into a zero-terminated UTF-8
**          string and returns a pointer to that string.
**
** {H15124} The [sqlite3_value_text16(V)] interface converts the
**          [protected sqlite3_value] object V into a zero-terminated 2-byte
**          aligned UTF-16 native byte order
**          string and returns a pointer to that string.
**
** {H15127} The [sqlite3_value_text16be(V)] interface converts the
**          [protected sqlite3_value] object V into a zero-terminated 2-byte
**          aligned UTF-16 big-endian
**          string and returns a pointer to that string.
**
** {H15130} The [sqlite3_value_text16le(V)] interface converts the
**          [protected sqlite3_value] object V into a zero-terminated 2-byte
**          aligned UTF-16 little-endian
**          string and returns a pointer to that string.
**
** {H15133} The [sqlite3_value_type(V)] interface returns
**          one of [SQLITE_NULL], [SQLITE_INTEGER], [SQLITE_FLOAT],
**          [SQLITE_TEXT], or [SQLITE_BLOB] as appropriate for
**          the [sqlite3_value] object V.
**
** {H15136} The [sqlite3_value_numeric_type(V)] interface converts
**          the [protected sqlite3_value] object V into either an integer or
**          a floating point value if it can do so without loss of
**          information, and returns one of [SQLITE_NULL],
**          [SQLITE_INTEGER], [SQLITE_FLOAT], [SQLITE_TEXT], or
**          [SQLITE_BLOB] as appropriate for the
**          [protected sqlite3_value] object V after the conversion attempt.
*/
const void *sqlite3_value_blob(sqlite3_value*);
int sqlite3_value_bytes(sqlite3_value*);
int sqlite3_value_bytes16(sqlite3_value*);
double sqlite3_value_double(sqlite3_value*);
int sqlite3_value_int(sqlite3_value*);
sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
const unsigned char *sqlite3_value_text(sqlite3_value*);
const void *sqlite3_value_text16(sqlite3_value*);
const void *sqlite3_value_text16le(sqlite3_value*);
const void *sqlite3_value_text16be(sqlite3_value*);
int sqlite3_value_type(sqlite3_value*);
int sqlite3_value_numeric_type(sqlite3_value*);

/*
** CAPI3REF: Obtain Aggregate Function Context {H16210} <S20200>
**
** The implementation of aggregate SQL functions use this routine to allocate
** a structure for storing their state.
**
** The first time the sqlite3_aggregate_context() routine is called for a
** particular aggregate, SQLite allocates nBytes of memory, zeroes out that
** memory, and returns a pointer to it. On second and subsequent calls to
** sqlite3_aggregate_context() for the same aggregate function index,
** the same buffer is returned. The implementation of the aggregate can use
** the returned buffer to accumulate data.
**
** SQLite automatically frees the allocated buffer when the aggregate
** query concludes.
**
** The first parameter should be a copy of the
** [sqlite3_context | SQL function context] that is the first parameter
** to the callback routine that implements the aggregate function.
**
** This routine must be called from the same thread in which
** the aggregate SQL function is running.
**
** INVARIANTS:
**
** {H16211} The first invocation of [sqlite3_aggregate_context(C,N)] for
**          a particular instance of an aggregate function (for a particular
**          context C) causes SQLite to allocate N bytes of memory,
**          zero that memory, and return a pointer to the allocated memory.
**
** {H16213} If a memory allocation error occurs during
**          [sqlite3_aggregate_context(C,N)] then the function returns 0.
**
** {H16215} Second and subsequent invocations of
**          [sqlite3_aggregate_context(C,N)] for the same context pointer C
**          ignore the N parameter and return a pointer to the same
**          block of memory returned by the first invocation.
**
** {H16217} The memory allocated by [sqlite3_aggregate_context(C,N)] is
**          automatically freed on the next call to [sqlite3_reset()]
**          or [sqlite3_finalize()] for the [prepared statement] containing
**          the aggregate function associated with context C.
*/
void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);

/*
** CAPI3REF: User Data For Functions {H16240} <S20200>
**
** The sqlite3_user_data() interface returns a copy of
** the pointer that was the pUserData parameter (the 5th parameter)
** of the [sqlite3_create_function()]
** and [sqlite3_create_function16()] routines that originally
** registered the application defined function. {END}
**
** This routine must be called from the same thread in which
** the application-defined function is running.
**
** INVARIANTS:
**
** {H16243} The [sqlite3_user_data(C)] interface returns a copy of the
**          P pointer from the [sqlite3_create_function(D,X,N,E,P,F,S,L)]
**          or [sqlite3_create_function16(D,X,N,E,P,F,S,L)] call that
**          registered the SQL function associated with [sqlite3_context] C.
*/
void *sqlite3_user_data(sqlite3_context*);

/*
** CAPI3REF: Database Connection For Functions {H16250} <S60600><S20200>
**
** The sqlite3_context_db_handle() interface returns a copy of
** the pointer to the [database connection] (the 1st parameter)
** of the [sqlite3_create_function()]
** and [sqlite3_create_function16()] routines that originally
** registered the application defined function.
**
** INVARIANTS:
**
** {H16253} The [sqlite3_context_db_handle(C)] interface returns a copy of the
**          D pointer from the [sqlite3_create_function(D,X,N,E,P,F,S,L)]
**          or [sqlite3_create_function16(D,X,N,E,P,F,S,L)] call that
**          registered the SQL function associated with [sqlite3_context] C.
*/
sqlite3 *sqlite3_context_db_handle(sqlite3_context*);

/*
** CAPI3REF: Function Auxiliary Data {H16270} <S20200>
**
** The following two functions may be used by scalar SQL functions to
** associate metadata with argument values. If the same value is passed to
** multiple invocations of the same SQL function during query execution, under
** some circumstances the associated metadata may be preserved. This may
** be used, for example, to add a regular-expression matching scalar
** function. The compiled version of the regular expression is stored as
** metadata associated with the SQL value passed as the regular expression
** pattern.  The compiled regular expression can be reused on multiple
** invocations of the same function so that the original pattern string
** does not need to be recompiled on each invocation.
**
** The sqlite3_get_auxdata() interface returns a pointer to the metadata
** associated by the sqlite3_set_auxdata() function with the Nth argument
** value to the application-defined function. If no metadata has been ever
** been set for the Nth argument of the function, or if the corresponding
** function parameter has changed since the meta-data was set,
** then sqlite3_get_auxdata() returns a NULL pointer.
**
** The sqlite3_set_auxdata() interface saves the metadata
** pointed to by its 3rd parameter as the metadata for the N-th
** argument of the application-defined function.  Subsequent
** calls to sqlite3_get_auxdata() might return this data, if it has
** not been destroyed.
** If it is not NULL, SQLite will invoke the destructor
** function given by the 4th parameter to sqlite3_set_auxdata() on
** the metadata when the corresponding function parameter changes
** or when the SQL statement completes, whichever comes first.
**
** SQLite is free to call the destructor and drop metadata on any
** parameter of any function at any time.  The only guarantee is that
** the destructor will be called before the metadata is dropped.
**
** In practice, metadata is preserved between function calls for
** expressions that are constant at compile time. This includes literal
** values and SQL variables.
**
** These routines must be called from the same thread in which
** the SQL function is running.
**
** INVARIANTS:
**
** {H16272} The [sqlite3_get_auxdata(C,N)] interface returns a pointer
**          to metadata associated with the Nth parameter of the SQL function
**          whose context is C, or NULL if there is no metadata associated
**          with that parameter.
**
** {H16274} The [sqlite3_set_auxdata(C,N,P,D)] interface assigns a metadata
**          pointer P to the Nth parameter of the SQL function with context C.
**
** {H16276} SQLite will invoke the destructor D with a single argument
**          which is the metadata pointer P following a call to
**          [sqlite3_set_auxdata(C,N,P,D)] when SQLite ceases to hold
**          the metadata.
**
** {H16277} SQLite ceases to hold metadata for an SQL function parameter
**          when the value of that parameter changes.
**
** {H16278} When [sqlite3_set_auxdata(C,N,P,D)] is invoked, the destructor
**          is called for any prior metadata associated with the same function
**          context C and parameter N.
**
** {H16279} SQLite will call destructors for any metadata it is holding
**          in a particular [prepared statement] S when either
**          [sqlite3_reset(S)] or [sqlite3_finalize(S)] is called.
*/
void *sqlite3_get_auxdata(sqlite3_context*, int N);
void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));


/*
** CAPI3REF: Constants Defining Special Destructor Behavior {H10280} <S30100>
**
** These are special values for the destructor that is passed in as the
** final argument to routines like [sqlite3_result_blob()].  If the destructor
** argument is SQLITE_STATIC, it means that the content pointer is constant
** and will never change.  It does not need to be destroyed.  The
** SQLITE_TRANSIENT value means that the content will likely change in
** the near future and that SQLite should make its own private copy of
** the content before returning.
**
** The typedef is necessary to work around problems in certain
** C++ compilers.  See ticket #2191.
*/
typedef void (*sqlite3_destructor_type)(void*);
#define SQLITE_STATIC      ((sqlite3_destructor_type)0)
#define SQLITE_TRANSIENT   ((sqlite3_destructor_type)-1)

/*
** CAPI3REF: Setting The Result Of An SQL Function {H16400} <S20200>
**
** These routines are used by the xFunc or xFinal callbacks that
** implement SQL functions and aggregates.  See
** [sqlite3_create_function()] and [sqlite3_create_function16()]
** for additional information.
**
** These functions work very much like the [parameter binding] family of
** functions used to bind values to host parameters in prepared statements.
** Refer to the [SQL parameter] documentation for additional information.
**
** The sqlite3_result_blob() interface sets the result from
** an application-defined function to be the BLOB whose content is pointed
** to by the second parameter and which is N bytes long where N is the
** third parameter.
**
** The sqlite3_result_zeroblob() interfaces set the result of
** the application-defined function to be a BLOB containing all zero
** bytes and N bytes in size, where N is the value of the 2nd parameter.
**
** The sqlite3_result_double() interface sets the result from
** an application-defined function to be a floating point value specified
** by its 2nd argument.
**
** The sqlite3_result_error() and sqlite3_result_error16() functions
** cause the implemented SQL function to throw an exception.
** SQLite uses the string pointed to by the
** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16()
** as the text of an error message.  SQLite interprets the error
** message string from sqlite3_result_error() as UTF-8. SQLite
** interprets the string from sqlite3_result_error16() as UTF-16 in native
** byte order.  If the third parameter to sqlite3_result_error()
** or sqlite3_result_error16() is negative then SQLite takes as the error
** message all text up through the first zero character.
** If the third parameter to sqlite3_result_error() or
** sqlite3_result_error16() is non-negative then SQLite takes that many
** bytes (not characters) from the 2nd parameter as the error message.
** The sqlite3_result_error() and sqlite3_result_error16()
** routines make a private copy of the error message text before
** they return.  Hence, the calling function can deallocate or
** modify the text after they return without harm.
** The sqlite3_result_error_code() function changes the error code
** returned by SQLite as a result of an error in a function.  By default,
** the error code is SQLITE_ERROR.  A subsequent call to sqlite3_result_error()
** or sqlite3_result_error16() resets the error code to SQLITE_ERROR.
**
** The sqlite3_result_toobig() interface causes SQLite to throw an error
** indicating that a string or BLOB is to long to represent.
**
** The sqlite3_result_nomem() interface causes SQLite to throw an error
** indicating that a memory allocation failed.
**
** The sqlite3_result_int() interface sets the return value
** of the application-defined function to be the 32-bit signed integer
** value given in the 2nd argument.
** The sqlite3_result_int64() interface sets the return value
** of the application-defined function to be the 64-bit signed integer
** value given in the 2nd argument.
**
** The sqlite3_result_null() interface sets the return value
** of the application-defined function to be NULL.
**
** The sqlite3_result_text(), sqlite3_result_text16(),
** sqlite3_result_text16le(), and sqlite3_result_text16be() interfaces
** set the return value of the application-defined function to be
** a text string which is represented as UTF-8, UTF-16 native byte order,
** UTF-16 little endian, or UTF-16 big endian, respectively.
** SQLite takes the text result from the application from
** the 2nd parameter of the sqlite3_result_text* interfaces.
** If the 3rd parameter to the sqlite3_result_text* interfaces
** is negative, then SQLite takes result text from the 2nd parameter
** through the first zero character.
** If the 3rd parameter to the sqlite3_result_text* interfaces
** is non-negative, then as many bytes (not characters) of the text
** pointed to by the 2nd parameter are taken as the application-defined
** function result.
** If the 4th parameter to the sqlite3_result_text* interfaces
** or sqlite3_result_blob is a non-NULL pointer, then SQLite calls that
** function as the destructor on the text or BLOB result when it has
** finished using that result.
** If the 4th parameter to the sqlite3_result_text* interfaces or
** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite
** assumes that the text or BLOB result is in constant space and does not
** copy the it or call a destructor when it has finished using that result.
** If the 4th parameter to the sqlite3_result_text* interfaces
** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT
** then SQLite makes a copy of the result into space obtained from
** from [sqlite3_malloc()] before it returns.
**
** The sqlite3_result_value() interface sets the result of
** the application-defined function to be a copy the
** [unprotected sqlite3_value] object specified by the 2nd parameter.  The
** sqlite3_result_value() interface makes a copy of the [sqlite3_value]
** so that the [sqlite3_value] specified in the parameter may change or
** be deallocated after sqlite3_result_value() returns without harm.
** A [protected sqlite3_value] object may always be used where an
** [unprotected sqlite3_value] object is required, so either
** kind of [sqlite3_value] object can be used with this interface.
**
** If these routines are called from within the different thread
** than the one containing the application-defined function that received
** the [sqlite3_context] pointer, the results are undefined.
**
** INVARIANTS:
**
** {H16403} The default return value from any SQL function is NULL.
**
** {H16406} The [sqlite3_result_blob(C,V,N,D)] interface changes the
**          return value of function C to be a BLOB that is N bytes
**          in length and with content pointed to by V.
**
** {H16409} The [sqlite3_result_double(C,V)] interface changes the
**          return value of function C to be the floating point value V.
**
** {H16412} The [sqlite3_result_error(C,V,N)] interface changes the return
**          value of function C to be an exception with error code
**          [SQLITE_ERROR] and a UTF-8 error message copied from V up to the
**          first zero byte or until N bytes are read if N is positive.
**
** {H16415} The [sqlite3_result_error16(C,V,N)] interface changes the return
**          value of function C to be an exception with error code
**          [SQLITE_ERROR] and a UTF-16 native byte order error message
**          copied from V up to the first zero terminator or until N bytes
**          are read if N is positive.
**
** {H16418} The [sqlite3_result_error_toobig(C)] interface changes the return
**          value of the function C to be an exception with error code
**          [SQLITE_TOOBIG] and an appropriate error message.
**
** {H16421} The [sqlite3_result_error_nomem(C)] interface changes the return
**          value of the function C to be an exception with error code
**          [SQLITE_NOMEM] and an appropriate error message.
**
** {H16424} The [sqlite3_result_error_code(C,E)] interface changes the return
**          value of the function C to be an exception with error code E.
**          The error message text is unchanged.
**
** {H16427} The [sqlite3_result_int(C,V)] interface changes the
**          return value of function C to be the 32-bit integer value V.
**
** {H16430} The [sqlite3_result_int64(C,V)] interface changes the
**          return value of function C to be the 64-bit integer value V.
**
** {H16433} The [sqlite3_result_null(C)] interface changes the
**          return value of function C to be NULL.
**
** {H16436} The [sqlite3_result_text(C,V,N,D)] interface changes the
**          return value of function C to be the UTF-8 string
**          V up to the first zero if N is negative
**          or the first N bytes of V if N is non-negative.
**
** {H16439} The [sqlite3_result_text16(C,V,N,D)] interface changes the
**          return value of function C to be the UTF-16 native byte order
**          string V up to the first zero if N is negative
**          or the first N bytes of V if N is non-negative.
**
** {H16442} The [sqlite3_result_text16be(C,V,N,D)] interface changes the
**          return value of function C to be the UTF-16 big-endian
**          string V up to the first zero if N is negative
**          or the first N bytes or V if N is non-negative.
**
** {H16445} The [sqlite3_result_text16le(C,V,N,D)] interface changes the
**          return value of function C to be the UTF-16 little-endian
**          string V up to the first zero if N is negative
**          or the first N bytes of V if N is non-negative.
**
** {H16448} The [sqlite3_result_value(C,V)] interface changes the
**          return value of function C to be the [unprotected sqlite3_value]
**          object V.
**
** {H16451} The [sqlite3_result_zeroblob(C,N)] interface changes the
**          return value of function C to be an N-byte BLOB of all zeros.
**
** {H16454} The [sqlite3_result_error()] and [sqlite3_result_error16()]
**          interfaces make a copy of their error message strings before
**          returning.
**
** {H16457} If the D destructor parameter to [sqlite3_result_blob(C,V,N,D)],
**          [sqlite3_result_text(C,V,N,D)], [sqlite3_result_text16(C,V,N,D)],
**          [sqlite3_result_text16be(C,V,N,D)], or
**          [sqlite3_result_text16le(C,V,N,D)] is the constant [SQLITE_STATIC]
**          then no destructor is ever called on the pointer V and SQLite
**          assumes that V is immutable.
**
** {H16460} If the D destructor parameter to [sqlite3_result_blob(C,V,N,D)],
**          [sqlite3_result_text(C,V,N,D)], [sqlite3_result_text16(C,V,N,D)],
**          [sqlite3_result_text16be(C,V,N,D)], or
**          [sqlite3_result_text16le(C,V,N,D)] is the constant
**          [SQLITE_TRANSIENT] then the interfaces makes a copy of the
**          content of V and retains the copy.
**
** {H16463} If the D destructor parameter to [sqlite3_result_blob(C,V,N,D)],
**          [sqlite3_result_text(C,V,N,D)], [sqlite3_result_text16(C,V,N,D)],
**          [sqlite3_result_text16be(C,V,N,D)], or
**          [sqlite3_result_text16le(C,V,N,D)] is some value other than
**          the constants [SQLITE_STATIC] and [SQLITE_TRANSIENT] then
**          SQLite will invoke the destructor D with V as its only argument
**          when it has finished with the V value.
*/
void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
void sqlite3_result_double(sqlite3_context*, double);
void sqlite3_result_error(sqlite3_context*, const char*, int);
void sqlite3_result_error16(sqlite3_context*, const void*, int);
void sqlite3_result_error_toobig(sqlite3_context*);
void sqlite3_result_error_nomem(sqlite3_context*);
void sqlite3_result_error_code(sqlite3_context*, int);
void sqlite3_result_int(sqlite3_context*, int);
void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
void sqlite3_result_null(sqlite3_context*);
void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
void sqlite3_result_zeroblob(sqlite3_context*, int n);

/*
** CAPI3REF: Define New Collating Sequences {H16600} <S20300>
**
** These functions are used to add new collation sequences to the
** [database connection] specified as the first argument.
**
** The name of the new collation sequence is specified as a UTF-8 string
** for sqlite3_create_collation() and sqlite3_create_collation_v2()
** and a UTF-16 string for sqlite3_create_collation16(). In all cases
** the name is passed as the second function argument.
**
** The third argument may be one of the constants [SQLITE_UTF8],
** [SQLITE_UTF16LE] or [SQLITE_UTF16BE], indicating that the user-supplied
** routine expects to be passed pointers to strings encoded using UTF-8,
** UTF-16 little-endian, or UTF-16 big-endian, respectively. The
** third argument might also be [SQLITE_UTF16_ALIGNED] to indicate that
** the routine expects pointers to 16-bit word aligned strings
** of UTF-16 in the native byte order of the host computer.
**
** A pointer to the user supplied routine must be passed as the fifth
** argument.  If it is NULL, this is the same as deleting the collation
** sequence (so that SQLite cannot call it anymore).
** Each time the application supplied function is invoked, it is passed
** as its first parameter a copy of the void* passed as the fourth argument
** to sqlite3_create_collation() or sqlite3_create_collation16().
**
** The remaining arguments to the application-supplied routine are two strings,
** each represented by a (length, data) pair and encoded in the encoding
** that was passed as the third argument when the collation sequence was
** registered. {END}  The application defined collation routine should
** return negative, zero or positive if the first string is less than,
** equal to, or greater than the second string. i.e. (STRING1 - STRING2).
**
** The sqlite3_create_collation_v2() works like sqlite3_create_collation()
** except that it takes an extra argument which is a destructor for
** the collation.  The destructor is called when the collation is
** destroyed and is passed a copy of the fourth parameter void* pointer
** of the sqlite3_create_collation_v2().
** Collations are destroyed when they are overridden by later calls to the
** collation creation functions or when the [database connection] is closed
** using [sqlite3_close()].
**
** INVARIANTS:
**
** {H16603} A successful call to the
**          [sqlite3_create_collation_v2(B,X,E,P,F,D)] interface
**          registers function F as the comparison function used to
**          implement collation X on the [database connection] B for
**          databases having encoding E.
**
** {H16604} SQLite understands the X parameter to
**          [sqlite3_create_collation_v2(B,X,E,P,F,D)] as a zero-terminated
**          UTF-8 string in which case is ignored for ASCII characters and
**          is significant for non-ASCII characters.
**
** {H16606} Successive calls to [sqlite3_create_collation_v2(B,X,E,P,F,D)]
**          with the same values for B, X, and E, override prior values
**          of P, F, and D.
**
** {H16609} If the destructor D in [sqlite3_create_collation_v2(B,X,E,P,F,D)]
**          is not NULL then it is called with argument P when the
**          collating function is dropped by SQLite.
**
** {H16612} A collating function is dropped when it is overloaded.
**
** {H16615} A collating function is dropped when the database connection
**          is closed using [sqlite3_close()].
**
** {H16618} The pointer P in [sqlite3_create_collation_v2(B,X,E,P,F,D)]
**          is passed through as the first parameter to the comparison
**          function F for all subsequent invocations of F.
**
** {H16621} A call to [sqlite3_create_collation(B,X,E,P,F)] is exactly
**          the same as a call to [sqlite3_create_collation_v2()] with
**          the same parameters and a NULL destructor.
**
** {H16624} Following a [sqlite3_create_collation_v2(B,X,E,P,F,D)],
**          SQLite uses the comparison function F for all text comparison
**          operations on the [database connection] B on text values that
**          use the collating sequence named X.
**
** {H16627} The [sqlite3_create_collation16(B,X,E,P,F)] works the same
**          as [sqlite3_create_collation(B,X,E,P,F)] except that the
**          collation name X is understood as UTF-16 in native byte order
**          instead of UTF-8.
**
** {H16630} When multiple comparison functions are available for the same
**          collating sequence, SQLite chooses the one whose text encoding
**          requires the least amount of conversion from the default
**          text encoding of the database.
*/
int sqlite3_create_collation(
  sqlite3*, 
  const char *zName, 
  int eTextRep, 
  void*,
  int(*xCompare)(void*,int,const void*,int,const void*)
);
int sqlite3_create_collation_v2(
  sqlite3*, 
  const char *zName, 
  int eTextRep, 
  void*,
  int(*xCompare)(void*,int,const void*,int,const void*),
  void(*xDestroy)(void*)
);
int sqlite3_create_collation16(
  sqlite3*, 
  const void *zName,
  int eTextRep, 
  void*,
  int(*xCompare)(void*,int,const void*,int,const void*)
);

/*
** CAPI3REF: Collation Needed Callbacks {H16700} <S20300>
**
** To avoid having to register all collation sequences before a database
** can be used, a single callback function may be registered with the
** [database connection] to be called whenever an undefined collation
** sequence is required.
**
** If the function is registered using the sqlite3_collation_needed() API,
** then it is passed the names of undefined collation sequences as strings
** encoded in UTF-8. {H16703} If sqlite3_collation_needed16() is used,
** the names are passed as UTF-16 in machine native byte order.
** A call to either function replaces any existing callback.
**
** When the callback is invoked, the first argument passed is a copy
** of the second argument to sqlite3_collation_needed() or
** sqlite3_collation_needed16().  The second argument is the database
** connection.  The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE],
** or [SQLITE_UTF16LE], indicating the most desirable form of the collation
** sequence function required.  The fourth parameter is the name of the
** required collation sequence.
**
** The callback function should register the desired collation using
** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
** [sqlite3_create_collation_v2()].
**
** INVARIANTS:
**
** {H16702} A successful call to [sqlite3_collation_needed(D,P,F)]
**          or [sqlite3_collation_needed16(D,P,F)] causes
**          the [database connection] D to invoke callback F with first
**          parameter P whenever it needs a comparison function for a
**          collating sequence that it does not know about.
**
** {H16704} Each successful call to [sqlite3_collation_needed()] or
**          [sqlite3_collation_needed16()] overrides the callback registered
**          on the same [database connection] by prior calls to either
**          interface.
**
** {H16706} The name of the requested collating function passed in the
**          4th parameter to the callback is in UTF-8 if the callback
**          was registered using [sqlite3_collation_needed()] and
**          is in UTF-16 native byte order if the callback was
**          registered using [sqlite3_collation_needed16()].
*/
int sqlite3_collation_needed(
  sqlite3*, 
  void*, 
  void(*)(void*,sqlite3*,int eTextRep,const char*)
);
int sqlite3_collation_needed16(
  sqlite3*, 
  void*,
  void(*)(void*,sqlite3*,int eTextRep,const void*)
);

/*
** Specify the key for an encrypted database.  This routine should be
** called right after sqlite3_open().
**
** The code to implement this API is not available in the public release
** of SQLite.
*/
int sqlite3_key(
  sqlite3 *db,                   /* Database to be rekeyed */
  const void *pKey, int nKey     /* The key */
);

/*
** Change the key on an open database.  If the current database is not
** encrypted, this routine will encrypt it.  If pNew==0 or nNew==0, the
** database is decrypted.
**
** The code to implement this API is not available in the public release
** of SQLite.
*/
int sqlite3_rekey(
  sqlite3 *db,                   /* Database to be rekeyed */
  const void *pKey, int nKey     /* The new key */
);

/*
** CAPI3REF: Suspend Execution For A Short Time {H10530} <S40410>
**
** The sqlite3_sleep() function causes the current thread to suspend execution
** for at least a number of milliseconds specified in its parameter.
**
** If the operating system does not support sleep requests with
** millisecond time resolution, then the time will be rounded up to
** the nearest second. The number of milliseconds of sleep actually
** requested from the operating system is returned.
**
** SQLite implements this interface by calling the xSleep()
** method of the default [sqlite3_vfs] object.
**
** INVARIANTS:
**
** {H10533} The [sqlite3_sleep(M)] interface invokes the xSleep
**          method of the default [sqlite3_vfs|VFS] in order to
**          suspend execution of the current thread for at least
**          M milliseconds.
**
** {H10536} The [sqlite3_sleep(M)] interface returns the number of
**          milliseconds of sleep actually requested of the operating
**          system, which might be larger than the parameter M.
*/
int sqlite3_sleep(int);

/*
** CAPI3REF: Name Of The Folder Holding Temporary Files {H10310} <S20000>
**
** If this global variable is made to point to a string which is
** the name of a folder (a.k.a. directory), then all temporary files
** created by SQLite will be placed in that directory.  If this variable
** is a NULL pointer, then SQLite performs a search for an appropriate
** temporary file directory.
**
** It is not safe to modify this variable once a [database connection]
** has been opened.  It is intended that this variable be set once
** as part of process initialization and before any SQLite interface
** routines have been call and remain unchanged thereafter.
*/
SQLITE_EXTERN char *sqlite3_temp_directory;

/*
** CAPI3REF: Test For Auto-Commit Mode {H12930} <S60200>
** KEYWORDS: {autocommit mode}
**
** The sqlite3_get_autocommit() interface returns non-zero or
** zero if the given database connection is or is not in autocommit mode,
** respectively.  Autocommit mode is on by default.
** Autocommit mode is disabled by a [BEGIN] statement.
** Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK].
**
** If certain kinds of errors occur on a statement within a multi-statement
** transaction (errors including [SQLITE_FULL], [SQLITE_IOERR],
** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the
** transaction might be rolled back automatically.  The only way to
** find out whether SQLite automatically rolled back the transaction after
** an error is to use this function.
**
** INVARIANTS:
**
** {H12931} The [sqlite3_get_autocommit(D)] interface returns non-zero or
**          zero if the [database connection] D is or is not in autocommit
**          mode, respectively.
**
** {H12932} Autocommit mode is on by default.
**
** {H12933} Autocommit mode is disabled by a successful [BEGIN] statement.
**
** {H12934} Autocommit mode is enabled by a successful [COMMIT] or [ROLLBACK]
**          statement.
**
** ASSUMPTIONS:
**
** {A12936} If another thread changes the autocommit status of the database
**          connection while this routine is running, then the return value
**          is undefined.
*/
int sqlite3_get_autocommit(sqlite3*);

/*
** CAPI3REF: Find The Database Handle Of A Prepared Statement {H13120} <S60600>
**
** The sqlite3_db_handle interface returns the [database connection] handle
** to which a [prepared statement] belongs.  The database handle returned by
** sqlite3_db_handle is the same database handle that was the first argument
** to the [sqlite3_prepare_v2()] call (or its variants) that was used to
** create the statement in the first place.
**
** INVARIANTS:
**
** {H13123} The [sqlite3_db_handle(S)] interface returns a pointer
**          to the [database connection] associated with the
**          [prepared statement] S.
*/
sqlite3 *sqlite3_db_handle(sqlite3_stmt*);

/*
** CAPI3REF: Find the next prepared statement {H13140} <S60600>
**
** This interface returns a pointer to the next [prepared statement] after
** pStmt associated with the [database connection] pDb.  If pStmt is NULL
** then this interface returns a pointer to the first prepared statement
** associated with the database connection pDb.  If no prepared statement
** satisfies the conditions of this routine, it returns NULL.
**
** INVARIANTS:
**
** {H13143} If D is a [database connection] that holds one or more
**          unfinalized [prepared statements] and S is a NULL pointer,
**          then [sqlite3_next_stmt(D, S)] routine shall return a pointer
**          to one of the prepared statements associated with D.
**
** {H13146} If D is a [database connection] that holds no unfinalized
**          [prepared statements] and S is a NULL pointer, then
**          [sqlite3_next_stmt(D, S)] routine shall return a NULL pointer.
**
** {H13149} If S is a [prepared statement] in the [database connection] D
**          and S is not the last prepared statement in D, then
**          [sqlite3_next_stmt(D, S)] routine shall return a pointer
**          to the next prepared statement in D after S.
**
** {H13152} If S is the last [prepared statement] in the
**          [database connection] D then the [sqlite3_next_stmt(D, S)]
**          routine shall return a NULL pointer.
**
** ASSUMPTIONS:
**
** {A13154} The [database connection] pointer D in a call to
**          [sqlite3_next_stmt(D,S)] must refer to an open database
**          connection and in particular must not be a NULL pointer.
*/
sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);

/*
** CAPI3REF: Commit And Rollback Notification Callbacks {H12950} <S60400>
**
** The sqlite3_commit_hook() interface registers a callback
** function to be invoked whenever a transaction is committed.
** Any callback set by a previous call to sqlite3_commit_hook()
** for the same database connection is overridden.
** The sqlite3_rollback_hook() interface registers a callback
** function to be invoked whenever a transaction is committed.
** Any callback set by a previous call to sqlite3_commit_hook()
** for the same database connection is overridden.
** The pArg argument is passed through to the callback.
** If the callback on a commit hook function returns non-zero,
** then the commit is converted into a rollback.
**
** If another function was previously registered, its
** pArg value is returned.  Otherwise NULL is returned.
**
** Registering a NULL function disables the callback.
**
** For the purposes of this API, a transaction is said to have been
** rolled back if an explicit "ROLLBACK" statement is executed, or
** an error or constraint causes an implicit rollback to occur.
** The rollback callback is not invoked if a transaction is
** automatically rolled back because the database connection is closed.
** The rollback callback is not invoked if a transaction is
** rolled back because a commit callback returned non-zero.
** <todo> Check on this </todo>
**
** INVARIANTS:
**
** {H12951} The [sqlite3_commit_hook(D,F,P)] interface registers the
**          callback function F to be invoked with argument P whenever
**          a transaction commits on the [database connection] D.
**
** {H12952} The [sqlite3_commit_hook(D,F,P)] interface returns the P argument
**          from the previous call with the same [database connection] D,
**          or NULL on the first call for a particular database connection D.
**
** {H12953} Each call to [sqlite3_commit_hook()] overwrites the callback
**          registered by prior calls.
**
** {H12954} If the F argument to [sqlite3_commit_hook(D,F,P)] is NULL
**          then the commit hook callback is canceled and no callback
**          is invoked when a transaction commits.
**
** {H12955} If the commit callback returns non-zero then the commit is
**          converted into a rollback.
**
** {H12961} The [sqlite3_rollback_hook(D,F,P)] interface registers the
**          callback function F to be invoked with argument P whenever
**          a transaction rolls back on the [database connection] D.
**
** {H12962} The [sqlite3_rollback_hook(D,F,P)] interface returns the P
**          argument from the previous call with the same
**          [database connection] D, or NULL on the first call
**          for a particular database connection D.
**
** {H12963} Each call to [sqlite3_rollback_hook()] overwrites the callback
**          registered by prior calls.
**
** {H12964} If the F argument to [sqlite3_rollback_hook(D,F,P)] is NULL
**          then the rollback hook callback is canceled and no callback
**          is invoked when a transaction rolls back.
*/
void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);

/*
** CAPI3REF: Data Change Notification Callbacks {H12970} <S60400>
**
** The sqlite3_update_hook() interface registers a callback function
** with the [database connection] identified by the first argument
** to be invoked whenever a row is updated, inserted or deleted.
** Any callback set by a previous call to this function
** for the same database connection is overridden.
**
** The second argument is a pointer to the function to invoke when a
** row is updated, inserted or deleted.
** The first argument to the callback is a copy of the third argument
** to sqlite3_update_hook().
** The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE],
** or [SQLITE_UPDATE], depending on the operation that caused the callback
** to be invoked.
** The third and fourth arguments to the callback contain pointers to the
** database and table name containing the affected row.
** The final callback parameter is the rowid of the row. In the case of
** an update, this is the rowid after the update takes place.
**
** The update hook is not invoked when internal system tables are
** modified (i.e. sqlite_master and sqlite_sequence).
**
** If another function was previously registered, its pArg value
** is returned.  Otherwise NULL is returned.
**
** INVARIANTS:
**
** {H12971} The [sqlite3_update_hook(D,F,P)] interface causes the callback
**          function F to be invoked with first parameter P whenever
**          a table row is modified, inserted, or deleted on
**          the [database connection] D.
**
** {H12973} The [sqlite3_update_hook(D,F,P)] interface returns the value
**          of P for the previous call on the same [database connection] D,
**          or NULL for the first call.
**
** {H12975} If the update hook callback F in [sqlite3_update_hook(D,F,P)]
**          is NULL then the no update callbacks are made.
**
** {H12977} Each call to [sqlite3_update_hook(D,F,P)] overrides prior calls
**          to the same interface on the same [database connection] D.
**
** {H12979} The update hook callback is not invoked when internal system
**          tables such as sqlite_master and sqlite_sequence are modified.
**
** {H12981} The second parameter to the update callback
**          is one of [SQLITE_INSERT], [SQLITE_DELETE] or [SQLITE_UPDATE],
**          depending on the operation that caused the callback to be invoked.
**
** {H12983} The third and fourth arguments to the callback contain pointers
**          to zero-terminated UTF-8 strings which are the names of the
**          database and table that is being updated.

** {H12985} The final callback parameter is the rowid of the row after
**          the change occurs.
*/
void *sqlite3_update_hook(
  sqlite3*, 
  void(*)(void *,int ,char const *,char const *,sqlite3_int64),
  void*
);

/*
** CAPI3REF: Enable Or Disable Shared Pager Cache {H10330} <S30900>
** KEYWORDS: {shared cache} {shared cache mode}
**
** This routine enables or disables the sharing of the database cache
** and schema data structures between [database connection | connections]
** to the same database. Sharing is enabled if the argument is true
** and disabled if the argument is false.
**
** Cache sharing is enabled and disabled for an entire process. {END}
** This is a change as of SQLite version 3.5.0. In prior versions of SQLite,
** sharing was enabled or disabled for each thread separately.
**
** The cache sharing mode set by this interface effects all subsequent
** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].
** Existing database connections continue use the sharing mode
** that was in effect at the time they were opened.
**
** Virtual tables cannot be used with a shared cache.  When shared
** cache is enabled, the [sqlite3_create_module()] API used to register
** virtual tables will always return an error.
**
** This routine returns [SQLITE_OK] if shared cache was enabled or disabled
** successfully.  An [error code] is returned otherwise.
**
** Shared cache is disabled by default. But this might change in
** future releases of SQLite.  Applications that care about shared
** cache setting should set it explicitly.
**
** INVARIANTS:
**
** {H10331} A successful invocation of [sqlite3_enable_shared_cache(B)]
**          will enable or disable shared cache mode for any subsequently
**          created [database connection] in the same process.
**
** {H10336} When shared cache is enabled, the [sqlite3_create_module()]
**          interface will always return an error.
**
** {H10337} The [sqlite3_enable_shared_cache(B)] interface returns
**          [SQLITE_OK] if shared cache was enabled or disabled successfully.
**
** {H10339} Shared cache is disabled by default.
*/
int sqlite3_enable_shared_cache(int);

/*
** CAPI3REF: Attempt To Free Heap Memory {H17340} <S30220>
**
** The sqlite3_release_memory() interface attempts to free N bytes
** of heap memory by deallocating non-essential memory allocations
** held by the database library. {END}  Memory used to cache database
** pages to improve performance is an example of non-essential memory.
** sqlite3_release_memory() returns the number of bytes actually freed,
** which might be more or less than the amount requested.
**
** INVARIANTS:
**
** {H17341} The [sqlite3_release_memory(N)] interface attempts to
**          free N bytes of heap memory by deallocating non-essential
**          memory allocations held by the database library.
**
** {H16342} The [sqlite3_release_memory(N)] returns the number
**          of bytes actually freed, which might be more or less
**          than the amount requested.
*/
int sqlite3_release_memory(int);

/*
** CAPI3REF: Impose A Limit On Heap Size {H17350} <S30220>
**
** The sqlite3_soft_heap_limit() interface places a "soft" limit
** on the amount of heap memory that may be allocated by SQLite.
** If an internal allocation is requested that would exceed the
** soft heap limit, [sqlite3_release_memory()] is invoked one or
** more times to free up some space before the allocation is performed.
**
** The limit is called "soft", because if [sqlite3_release_memory()]
** cannot free sufficient memory to prevent the limit from being exceeded,
** the memory is allocated anyway and the current operation proceeds.
**
** A negative or zero value for N means that there is no soft heap limit and
** [sqlite3_release_memory()] will only be called when memory is exhausted.
** The default value for the soft heap limit is zero.
**
** SQLite makes a best effort to honor the soft heap limit.
** But if the soft heap limit cannot be honored, execution will
** continue without error or notification.  This is why the limit is
** called a "soft" limit.  It is advisory only.
**
** Prior to SQLite version 3.5.0, this routine only constrained the memory
** allocated by a single thread - the same thread in which this routine
** runs.  Beginning with SQLite version 3.5.0, the soft heap limit is
** applied to all threads. The value specified for the soft heap limit
** is an upper bound on the total memory allocation for all threads. In
** version 3.5.0 there is no mechanism for limiting the heap usage for
** individual threads.
**
** INVARIANTS:
**
** {H16351} The [sqlite3_soft_heap_limit(N)] interface places a soft limit
**          of N bytes on the amount of heap memory that may be allocated
**          using [sqlite3_malloc()] or [sqlite3_realloc()] at any point
**          in time.
**
** {H16352} If a call to [sqlite3_malloc()] or [sqlite3_realloc()] would
**          cause the total amount of allocated memory to exceed the
**          soft heap limit, then [sqlite3_release_memory()] is invoked
**          in an attempt to reduce the memory usage prior to proceeding
**          with the memory allocation attempt.
**
** {H16353} Calls to [sqlite3_malloc()] or [sqlite3_realloc()] that trigger
**          attempts to reduce memory usage through the soft heap limit
**          mechanism continue even if the attempt to reduce memory
**          usage is unsuccessful.
**
** {H16354} A negative or zero value for N in a call to
**          [sqlite3_soft_heap_limit(N)] means that there is no soft
**          heap limit and [sqlite3_release_memory()] will only be
**          called when memory is completely exhausted.
**
** {H16355} The default value for the soft heap limit is zero.
**
** {H16358} Each call to [sqlite3_soft_heap_limit(N)] overrides the
**          values set by all prior calls.
*/
void sqlite3_soft_heap_limit(int);

/*
** CAPI3REF: Extract Metadata About A Column Of A Table {H12850} <S60300>
**
** This routine returns metadata about a specific column of a specific
** database table accessible using the [database connection] handle
** passed as the first function argument.
**
** The column is identified by the second, third and fourth parameters to
** this function. The second parameter is either the name of the database
** (i.e. "main", "temp" or an attached database) containing the specified
** table or NULL. If it is NULL, then all attached databases are searched
** for the table using the same algorithm used by the database engine to
** resolve unqualified table references.
**
** The third and fourth parameters to this function are the table and column
** name of the desired column, respectively. Neither of these parameters
** may be NULL.
**
** Metadata is returned by writing to the memory locations passed as the 5th
** and subsequent parameters to this function. Any of these arguments may be
** NULL, in which case the corresponding element of metadata is omitted.
**
** <blockquote>
** <table border="1">
** <tr><th> Parameter <th> Output<br>Type <th>  Description
**
** <tr><td> 5th <td> const char* <td> Data type
** <tr><td> 6th <td> const char* <td> Name of default collation sequence
** <tr><td> 7th <td> int         <td> True if column has a NOT NULL constraint
** <tr><td> 8th <td> int         <td> True if column is part of the PRIMARY KEY
** <tr><td> 9th <td> int         <td> True if column is AUTOINCREMENT
** </table>
** </blockquote>
**
** The memory pointed to by the character pointers returned for the
** declaration type and collation sequence is valid only until the next
** call to any SQLite API function.
**
** If the specified table is actually a view, an [error code] is returned.
**
** If the specified column is "rowid", "oid" or "_rowid_" and an
** INTEGER PRIMARY KEY column has been explicitly declared, then the output
** parameters are set for the explicitly declared column. If there is no
** explicitly declared INTEGER PRIMARY KEY column, then the output
** parameters are set as follows:
**
** <pre>
**     data type: "INTEGER"
**     collation sequence: "BINARY"
**     not null: 0
**     primary key: 1
**     auto increment: 0
** </pre>
**
** This function may load one or more schemas from database files. If an
** error occurs during this process, or if the requested table or column
** cannot be found, an [error code] is returned and an error message left
** in the [database connection] (to be retrieved using sqlite3_errmsg()).
**
** This API is only available if the library was compiled with the
** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol defined.
*/
int sqlite3_table_column_metadata(
  sqlite3 *db,                /* Connection handle */
  const char *zDbName,        /* Database name or NULL */
  const char *zTableName,     /* Table name */
  const char *zColumnName,    /* Column name */
  char const **pzDataType,    /* OUTPUT: Declared data type */
  char const **pzCollSeq,     /* OUTPUT: Collation sequence name */
  int *pNotNull,              /* OUTPUT: True if NOT NULL constraint exists */
  int *pPrimaryKey,           /* OUTPUT: True if column part of PK */
  int *pAutoinc               /* OUTPUT: True if column is auto-increment */
);

/*
** CAPI3REF: Load An Extension {H12600} <S20500>
**
** This interface loads an SQLite extension library from the named file.
**
** {H12601} The sqlite3_load_extension() interface attempts to load an
**          SQLite extension library contained in the file zFile.
**
** {H12602} The entry point is zProc.
**
** {H12603} zProc may be 0, in which case the name of the entry point
**          defaults to "sqlite3_extension_init".
**
** {H12604} The sqlite3_load_extension() interface shall return
**          [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
**
** {H12605} If an error occurs and pzErrMsg is not 0, then the
**          [sqlite3_load_extension()] interface shall attempt to
**          fill *pzErrMsg with error message text stored in memory
**          obtained from [sqlite3_malloc()]. {END}  The calling function
**          should free this memory by calling [sqlite3_free()].
**
** {H12606} Extension loading must be enabled using
**          [sqlite3_enable_load_extension()] prior to calling this API,
**          otherwise an error will be returned.
*/
int sqlite3_load_extension(
  sqlite3 *db,          /* Load the extension into this database connection */
  const char *zFile,    /* Name of the shared library containing extension */
  const char *zProc,    /* Entry point.  Derived from zFile if 0 */
  char **pzErrMsg       /* Put error message here if not 0 */
);

/*
** CAPI3REF: Enable Or Disable Extension Loading {H12620} <S20500>
**
** So as not to open security holes in older applications that are
** unprepared to deal with extension loading, and as a means of disabling
** extension loading while evaluating user-entered SQL, the following API
** is provided to turn the [sqlite3_load_extension()] mechanism on and off.
**
** Extension loading is off by default. See ticket #1863.
**
** {H12621} Call the sqlite3_enable_load_extension() routine with onoff==1
**          to turn extension loading on and call it with onoff==0 to turn
**          it back off again.
**
** {H12622} Extension loading is off by default.
*/
int sqlite3_enable_load_extension(sqlite3 *db, int onoff);

/*
** CAPI3REF: Automatically Load An Extensions {H12640} <S20500>
**
** This API can be invoked at program startup in order to register
** one or more statically linked extensions that will be available
** to all new [database connections]. {END}
**
** This routine stores a pointer to the extension in an array that is
** obtained from [sqlite3_malloc()].  If you run a memory leak checker
** on your program and it reports a leak because of this array, invoke
** [sqlite3_reset_auto_extension()] prior to shutdown to free the memory.
**
** {H12641} This function registers an extension entry point that is
**          automatically invoked whenever a new [database connection]
**          is opened using [sqlite3_open()], [sqlite3_open16()],
**          or [sqlite3_open_v2()].
**
** {H12642} Duplicate extensions are detected so calling this routine
**          multiple times with the same extension is harmless.
**
** {H12643} This routine stores a pointer to the extension in an array
**          that is obtained from [sqlite3_malloc()].
**
** {H12644} Automatic extensions apply across all threads.
*/
int sqlite3_auto_extension(void *xEntryPoint);

/*
** CAPI3REF: Reset Automatic Extension Loading {H12660} <S20500>
**
** This function disables all previously registered automatic
** extensions. {END}  It undoes the effect of all prior
** [sqlite3_auto_extension()] calls.
**
** {H12661} This function disables all previously registered
**          automatic extensions.
**
** {H12662} This function disables automatic extensions in all threads.
*/
void sqlite3_reset_auto_extension(void);

/*
****** EXPERIMENTAL - subject to change without notice **************
**
** The interface to the virtual-table mechanism is currently considered
** to be experimental.  The interface might change in incompatible ways.
** If this is a problem for you, do not use the interface at this time.
**
** When the virtual-table mechanism stabilizes, we will declare the
** interface fixed, support it indefinitely, and remove this comment.
*/

/*
** Structures used by the virtual table interface
*/
typedef struct sqlite3_vtab sqlite3_vtab;
typedef struct sqlite3_index_info sqlite3_index_info;
typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor;
typedef struct sqlite3_module sqlite3_module;

/*
** CAPI3REF: Virtual Table Object {H18000} <S20400>
** KEYWORDS: sqlite3_module
** EXPERIMENTAL
**
** A module is a class of virtual tables.  Each module is defined
** by an instance of the following structure.  This structure consists
** mostly of methods for the module.
**
** This interface is experimental and is subject to change or
** removal in future releases of SQLite.
*/
struct sqlite3_module {
  int iVersion;
  int (*xCreate)(sqlite3*, void *pAux,
               int argc, const char *const*argv,
               sqlite3_vtab **ppVTab, char**);
  int (*xConnect)(sqlite3*, void *pAux,
               int argc, const char *const*argv,
               sqlite3_vtab **ppVTab, char**);
  int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*);
  int (*xDisconnect)(sqlite3_vtab *pVTab);
  int (*xDestroy)(sqlite3_vtab *pVTab);
  int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor);
  int (*xClose)(sqlite3_vtab_cursor*);
  int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr,
                int argc, sqlite3_value **argv);
  int (*xNext)(sqlite3_vtab_cursor*);
  int (*xEof)(sqlite3_vtab_cursor*);
  int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int);
  int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *pRowid);
  int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *);
  int (*xBegin)(sqlite3_vtab *pVTab);
  int (*xSync)(sqlite3_vtab *pVTab);
  int (*xCommit)(sqlite3_vtab *pVTab);
  int (*xRollback)(sqlite3_vtab *pVTab);
  int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName,
                       void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),
                       void **ppArg);
  int (*xRename)(sqlite3_vtab *pVtab, const char *zNew);
};

/*
** CAPI3REF: Virtual Table Indexing Information {H18100} <S20400>
** KEYWORDS: sqlite3_index_info
** EXPERIMENTAL
**
** The sqlite3_index_info structure and its substructures is used to
** pass information into and receive the reply from the xBestIndex
** method of an sqlite3_module.  The fields under **Inputs** are the
** inputs to xBestIndex and are read-only.  xBestIndex inserts its
** results into the **Outputs** fields.
**
** The aConstraint[] array records WHERE clause constraints of the form:
**
** <pre>column OP expr</pre>
**
** where OP is =, &lt;, &lt;=, &gt;, or &gt;=.  The particular operator is
** stored in aConstraint[].op.  The index of the column is stored in
** aConstraint[].iColumn.  aConstraint[].usable is TRUE if the
** expr on the right-hand side can be evaluated (and thus the constraint
** is usable) and false if it cannot.
**
** The optimizer automatically inverts terms of the form "expr OP column"
** and makes other simplifications to the WHERE clause in an attempt to
** get as many WHERE clause terms into the form shown above as possible.
** The aConstraint[] array only reports WHERE clause terms in the correct
** form that refer to the particular virtual table being queried.
**
** Information about the ORDER BY clause is stored in aOrderBy[].
** Each term of aOrderBy records a column of the ORDER BY clause.
**
** The xBestIndex method must fill aConstraintUsage[] with information
** about what parameters to pass to xFilter.  If argvIndex>0 then
** the right-hand side of the corresponding aConstraint[] is evaluated
** and becomes the argvIndex-th entry in argv.  If aConstraintUsage[].omit
** is true, then the constraint is assumed to be fully handled by the
** virtual table and is not checked again by SQLite.
**
** The idxNum and idxPtr values are recorded and passed into xFilter.
** sqlite3_free() is used to free idxPtr if needToFreeIdxPtr is true.
**
** The orderByConsumed means that output from xFilter will occur in
** the correct order to satisfy the ORDER BY clause so that no separate
** sorting step is required.
**
** The estimatedCost value is an estimate of the cost of doing the
** particular lookup.  A full scan of a table with N entries should have
** a cost of N.  A binary search of a table of N entries should have a
** cost of approximately log(N).
**
** This interface is experimental and is subject to change or
** removal in future releases of SQLite.
*/
struct sqlite3_index_info {
  /* Inputs */
  int nConstraint;           /* Number of entries in aConstraint */
  struct sqlite3_index_constraint {
     int iColumn;              /* Column on left-hand side of constraint */
     unsigned char op;         /* Constraint operator */
     unsigned char usable;     /* True if this constraint is usable */
     int iTermOffset;          /* Used internally - xBestIndex should ignore */
  } *aConstraint;            /* Table of WHERE clause constraints */
  int nOrderBy;              /* Number of terms in the ORDER BY clause */
  struct sqlite3_index_orderby {
     int iColumn;              /* Column number */
     unsigned char desc;       /* True for DESC.  False for ASC. */
  } *aOrderBy;               /* The ORDER BY clause */
  /* Outputs */
  struct sqlite3_index_constraint_usage {
    int argvIndex;           /* if >0, constraint is part of argv to xFilter */
    unsigned char omit;      /* Do not code a test for this constraint */
  } *aConstraintUsage;
  int idxNum;                /* Number used to identify the index */
  char *idxStr;              /* String, possibly obtained from sqlite3_malloc */
  int needToFreeIdxStr;      /* Free idxStr using sqlite3_free() if true */
  int orderByConsumed;       /* True if output is already ordered */
  double estimatedCost;      /* Estimated cost of using this index */
};
#define SQLITE_INDEX_CONSTRAINT_EQ    2
#define SQLITE_INDEX_CONSTRAINT_GT    4
#define SQLITE_INDEX_CONSTRAINT_LE    8
#define SQLITE_INDEX_CONSTRAINT_LT    16
#define SQLITE_INDEX_CONSTRAINT_GE    32
#define SQLITE_INDEX_CONSTRAINT_MATCH 64

/*
** CAPI3REF: Register A Virtual Table Implementation {H18200} <S20400>
** EXPERIMENTAL
**
** This routine is used to register a new module name with a
** [database connection].  Module names must be registered before
** creating new virtual tables on the module, or before using
** preexisting virtual tables of the module.
**
** This interface is experimental and is subject to change or
** removal in future releases of SQLite.
*/
int sqlite3_create_module(
  sqlite3 *db,               /* SQLite connection to register module with */
  const char *zName,         /* Name of the module */
  const sqlite3_module *,    /* Methods for the module */
  void *                     /* Client data for xCreate/xConnect */
);

/*
** CAPI3REF: Register A Virtual Table Implementation {H18210} <S20400>
** EXPERIMENTAL
**
** This routine is identical to the [sqlite3_create_module()] method above,
** except that it allows a destructor function to be specified. It is
** even more experimental than the rest of the virtual tables API.
*/
int sqlite3_create_module_v2(
  sqlite3 *db,               /* SQLite connection to register module with */
  const char *zName,         /* Name of the module */
  const sqlite3_module *,    /* Methods for the module */
  void *,                    /* Client data for xCreate/xConnect */
  void(*xDestroy)(void*)     /* Module destructor function */
);

/*
** CAPI3REF: Virtual Table Instance Object {H18010} <S20400>
** KEYWORDS: sqlite3_vtab
** EXPERIMENTAL
**
** Every module implementation uses a subclass of the following structure
** to describe a particular instance of the module.  Each subclass will
** be tailored to the specific needs of the module implementation.
** The purpose of this superclass is to define certain fields that are
** common to all module implementations.
**
** Virtual tables methods can set an error message by assigning a
** string obtained from [sqlite3_mprintf()] to zErrMsg.  The method should
** take care that any prior string is freed by a call to [sqlite3_free()]
** prior to assigning a new string to zErrMsg.  After the error message
** is delivered up to the client application, the string will be automatically
** freed by sqlite3_free() and the zErrMsg field will be zeroed.  Note
** that sqlite3_mprintf() and sqlite3_free() are used on the zErrMsg field
** since virtual tables are commonly implemented in loadable extensions which
** do not have access to sqlite3MPrintf() or sqlite3Free().
**
** This interface is experimental and is subject to change or
** removal in future releases of SQLite.
*/
struct sqlite3_vtab {
  const sqlite3_module *pModule;  /* The module for this virtual table */
  int nRef;                       /* Used internally */
  char *zErrMsg;                  /* Error message from sqlite3_mprintf() */
  /* Virtual table implementations will typically add additional fields */
};

/*
** CAPI3REF: Virtual Table Cursor Object  {H18020} <S20400>
** KEYWORDS: sqlite3_vtab_cursor
** EXPERIMENTAL
**
** Every module implementation uses a subclass of the following structure
** to describe cursors that point into the virtual table and are used
** to loop through the virtual table.  Cursors are created using the
** xOpen method of the module.  Each module implementation will define
** the content of a cursor structure to suit its own needs.
**
** This superclass exists in order to define fields of the cursor that
** are common to all implementations.
**
** This interface is experimental and is subject to change or
** removal in future releases of SQLite.
*/
struct sqlite3_vtab_cursor {
  sqlite3_vtab *pVtab;      /* Virtual table of this cursor */
  /* Virtual table implementations will typically add additional fields */
};

/*
** CAPI3REF: Declare The Schema Of A Virtual Table {H18280} <S20400>
** EXPERIMENTAL
**
** The xCreate and xConnect methods of a module use the following API
** to declare the format (the names and datatypes of the columns) of
** the virtual tables they implement.
**
** This interface is experimental and is subject to change or
** removal in future releases of SQLite.
*/
int sqlite3_declare_vtab(sqlite3*, const char *zCreateTable);

/*
** CAPI3REF: Overload A Function For A Virtual Table {H18300} <S20400>
** EXPERIMENTAL
**
** Virtual tables can provide alternative implementations of functions
** using the xFindFunction method.  But global versions of those functions
** must exist in order to be overloaded.
**
** This API makes sure a global version of a function with a particular
** name and number of parameters exists.  If no such function exists
** before this API is called, a new function is created.  The implementation
** of the new function always causes an exception to be thrown.  So
** the new function is not good for anything by itself.  Its only
** purpose is to be a placeholder function that can be overloaded
** by virtual tables.
**
** This API should be considered part of the virtual table interface,
** which is experimental and subject to change.
*/
int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);

/*
** The interface to the virtual-table mechanism defined above (back up
** to a comment remarkably similar to this one) is currently considered
** to be experimental.  The interface might change in incompatible ways.
** If this is a problem for you, do not use the interface at this time.
**
** When the virtual-table mechanism stabilizes, we will declare the
** interface fixed, support it indefinitely, and remove this comment.
**
****** EXPERIMENTAL - subject to change without notice **************
*/

/*
** CAPI3REF: A Handle To An Open BLOB {H17800} <S30230>
** KEYWORDS: {BLOB handle} {BLOB handles}
**
** An instance of this object represents an open BLOB on which
** [sqlite3_blob_open | incremental BLOB I/O] can be performed.
** Objects of this type are created by [sqlite3_blob_open()]
** and destroyed by [sqlite3_blob_close()].
** The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces
** can be used to read or write small subsections of the BLOB.
** The [sqlite3_blob_bytes()] interface returns the size of the BLOB in bytes.
*/
typedef struct sqlite3_blob sqlite3_blob;

/*
** CAPI3REF: Open A BLOB For Incremental I/O {H17810} <S30230>
**
** This interfaces opens a [BLOB handle | handle] to the BLOB located
** in row iRow, column zColumn, table zTable in database zDb;
** in other words, the same BLOB that would be selected by:
**
** <pre>
**     SELECT zColumn FROM zDb.zTable WHERE rowid = iRow;
** </pre> {END}
**
** If the flags parameter is non-zero, the the BLOB is opened for read
** and write access. If it is zero, the BLOB is opened for read access.
**
** Note that the database name is not the filename that contains
** the database but rather the symbolic name of the database that
** is assigned when the database is connected using [ATTACH].
** For the main database file, the database name is "main".
** For TEMP tables, the database name is "temp".
**
** On success, [SQLITE_OK] is returned and the new [BLOB handle] is written
** to *ppBlob. Otherwise an [error code] is returned and any value written
** to *ppBlob should not be used by the caller.
** This function sets the [database connection] error code and message
** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()].
**
** If the row that a BLOB handle points to is modified by an
** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
** then the BLOB handle is marked as "expired".
** This is true if any column of the row is changed, even a column
** other than the one the BLOB handle is open on.
** Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for
** a expired BLOB handle fail with an return code of [SQLITE_ABORT].
** Changes written into a BLOB prior to the BLOB expiring are not
** rollback by the expiration of the BLOB.  Such changes will eventually
** commit if the transaction continues to completion.
**
** INVARIANTS:
**
** {H17813} A successful invocation of the [sqlite3_blob_open(D,B,T,C,R,F,P)]
**          interface shall open an [sqlite3_blob] object P on the BLOB
**          in column C of the table T in the database B on
**          the [database connection] D.
**
** {H17814} A successful invocation of [sqlite3_blob_open(D,...)] shall start
**          a new transaction on the [database connection] D if that
**          connection is not already in a transaction.
**
** {H17816} The [sqlite3_blob_open(D,B,T,C,R,F,P)] interface shall open
**          the BLOB for read and write access if and only if the F
**          parameter is non-zero.
**
** {H17819} The [sqlite3_blob_open()] interface shall return [SQLITE_OK] on
**          success and an appropriate [error code] on failure.
**
** {H17821} If an error occurs during evaluation of [sqlite3_blob_open(D,...)]
**          then subsequent calls to [sqlite3_errcode(D)],
**          [sqlite3_errmsg(D)], and [sqlite3_errmsg16(D)] shall return
**          information appropriate for that error.
**
** {H17824} If any column in the row that a [sqlite3_blob] has open is
**          changed by a separate [UPDATE] or [DELETE] statement or by
**          an [ON CONFLICT] side effect, then the [sqlite3_blob] shall
**          be marked as invalid.
*/
int sqlite3_blob_open(
  sqlite3*,
  const char *zDb,
  const char *zTable,
  const char *zColumn,
  sqlite3_int64 iRow,
  int flags,
  sqlite3_blob **ppBlob
);

/*
** CAPI3REF: Close A BLOB Handle {H17830} <S30230>
**
** Closes an open [BLOB handle].
**
** Closing a BLOB shall cause the current transaction to commit
** if there are no other BLOBs, no pending prepared statements, and the
** database connection is in [autocommit mode].
** If any writes were made to the BLOB, they might be held in cache
** until the close operation if they will fit. {END}
**
** Closing the BLOB often forces the changes
** out to disk and so if any I/O errors occur, they will likely occur
** at the time when the BLOB is closed.  {H17833} Any errors that occur during
** closing are reported as a non-zero return value.
**
** The BLOB is closed unconditionally.  Even if this routine returns
** an error code, the BLOB is still closed.
**
** INVARIANTS:
**
** {H17833} The [sqlite3_blob_close(P)] interface closes an [sqlite3_blob]
**          object P previously opened using [sqlite3_blob_open()].
**
** {H17836} Closing an [sqlite3_blob] object using
**          [sqlite3_blob_close()] shall cause the current transaction to
**          commit if there are no other open [sqlite3_blob] objects
**          or [prepared statements] on the same [database connection] and
**          the database connection is in [autocommit mode].
**
** {H17839} The [sqlite3_blob_close(P)] interfaces shall close the
**          [sqlite3_blob] object P unconditionally, even if
**          [sqlite3_blob_close(P)] returns something other than [SQLITE_OK].
*/
int sqlite3_blob_close(sqlite3_blob *);

/*
** CAPI3REF: Return The Size Of An Open BLOB {H17840} <S30230>
**
** Returns the size in bytes of the BLOB accessible via the open
** []BLOB handle] in its only argument.
**
** INVARIANTS:
**
** {H17843} The [sqlite3_blob_bytes(P)] interface returns the size
**          in bytes of the BLOB that the [sqlite3_blob] object P
**          refers to.
*/
int sqlite3_blob_bytes(sqlite3_blob *);

/*
** CAPI3REF: Read Data From A BLOB Incrementally {H17850} <S30230>
**
** This function is used to read data from an open [BLOB handle] into a
** caller-supplied buffer. N bytes of data are copied into buffer Z
** from the open BLOB, starting at offset iOffset.
**
** If offset iOffset is less than N bytes from the end of the BLOB,
** [SQLITE_ERROR] is returned and no data is read.  If N or iOffset is
** less than zero, [SQLITE_ERROR] is returned and no data is read.
**
** An attempt to read from an expired [BLOB handle] fails with an
** error code of [SQLITE_ABORT].
**
** On success, SQLITE_OK is returned.
** Otherwise, an [error code] or an [extended error code] is returned.
**
** INVARIANTS:
**
** {H17853} A successful invocation of [sqlite3_blob_read(P,Z,N,X)] 
**          shall reads N bytes of data out of the BLOB referenced by
**          [BLOB handle] P beginning at offset X and store those bytes
**          into buffer Z.
**
** {H17856} In [sqlite3_blob_read(P,Z,N,X)] if the size of the BLOB
**          is less than N+X bytes, then the function shall leave the
**          Z buffer unchanged and return [SQLITE_ERROR].
**
** {H17859} In [sqlite3_blob_read(P,Z,N,X)] if X or N is less than zero
**          then the function shall leave the Z buffer unchanged
**          and return [SQLITE_ERROR].
**
** {H17862} The [sqlite3_blob_read(P,Z,N,X)] interface shall return [SQLITE_OK]
**          if N bytes are successfully read into buffer Z.
**
** {H17863} If the [BLOB handle] P is expired and X and N are within bounds
**          then [sqlite3_blob_read(P,Z,N,X)] shall leave the Z buffer
**          unchanged and return [SQLITE_ABORT].
**
** {H17865} If the requested read could not be completed,
**          the [sqlite3_blob_read(P,Z,N,X)] interface shall return an
**          appropriate [error code] or [extended error code].
**
** {H17868} If an error occurs during evaluation of [sqlite3_blob_read(P,...)]
**          then subsequent calls to [sqlite3_errcode(D)],
**          [sqlite3_errmsg(D)], and [sqlite3_errmsg16(D)] shall return
**          information appropriate for that error, where D is the
**          [database connection] that was used to open the [BLOB handle] P.
*/
int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);

/*
** CAPI3REF: Write Data Into A BLOB Incrementally {H17870} <S30230>
**
** This function is used to write data into an open [BLOB handle] from a
** caller-supplied buffer. N bytes of data are copied from the buffer Z
** into the open BLOB, starting at offset iOffset.
**
** If the [BLOB handle] passed as the first argument was not opened for
** writing (the flags parameter to [sqlite3_blob_open()] was zero),
** this function returns [SQLITE_READONLY].
**
** This function may only modify the contents of the BLOB; it is
** not possible to increase the size of a BLOB using this API.
** If offset iOffset is less than N bytes from the end of the BLOB,
** [SQLITE_ERROR] is returned and no data is written.  If N is
** less than zero [SQLITE_ERROR] is returned and no data is written.
**
** An attempt to write to an expired [BLOB handle] fails with an
** error code of [SQLITE_ABORT].  Writes to the BLOB that occurred
** before the [BLOB handle] expired are not rolled back by the
** expiration of the handle, though of course those changes might
** have been overwritten by the statement that expired the BLOB handle
** or by other independent statements.
**
** On success, SQLITE_OK is returned.
** Otherwise, an  [error code] or an [extended error code] is returned.
**
** INVARIANTS:
**
** {H17873} A successful invocation of [sqlite3_blob_write(P,Z,N,X)]
**          shall write N bytes of data from buffer Z into the BLOB 
**          referenced by [BLOB handle] P beginning at offset X into
**          the BLOB.
**
** {H17874} In the absence of other overridding changes, the changes
**          written to a BLOB by [sqlite3_blob_write()] shall
**          remain in effect after the associated [BLOB handle] expires.
**
** {H17875} If the [BLOB handle] P was opened for reading only then
**          an invocation of [sqlite3_blob_write(P,Z,N,X)] shall leave
**          the referenced BLOB unchanged and return [SQLITE_READONLY].
**
** {H17876} If the size of the BLOB referenced by [BLOB handle] P is
**          less than N+X bytes then [sqlite3_blob_write(P,Z,N,X)] shall
**          leave the BLOB unchanged and return [SQLITE_ERROR].
**
** {H17877} If the [BLOB handle] P is expired and X and N are within bounds
**          then [sqlite3_blob_read(P,Z,N,X)] shall leave the BLOB
**          unchanged and return [SQLITE_ABORT].
**
** {H17879} If X or N are less than zero then [sqlite3_blob_write(P,Z,N,X)]
**          shall leave the BLOB referenced by [BLOB handle] P unchanged
**          and return [SQLITE_ERROR].
**
** {H17882} The [sqlite3_blob_write(P,Z,N,X)] interface shall return
**          [SQLITE_OK] if N bytes where successfully written into the BLOB.
**
** {H17885} If the requested write could not be completed,
**          the [sqlite3_blob_write(P,Z,N,X)] interface shall return an
**          appropriate [error code] or [extended error code].
**
** {H17888} If an error occurs during evaluation of [sqlite3_blob_write(D,...)]
**          then subsequent calls to [sqlite3_errcode(D)],
**          [sqlite3_errmsg(D)], and [sqlite3_errmsg16(D)] shall return
**          information appropriate for that error.
*/
int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);

/*
** CAPI3REF: Virtual File System Objects {H11200} <S20100>
**
** A virtual filesystem (VFS) is an [sqlite3_vfs] object
** that SQLite uses to interact
** with the underlying operating system.  Most SQLite builds come with a
** single default VFS that is appropriate for the host computer.
** New VFSes can be registered and existing VFSes can be unregistered.
** The following interfaces are provided.
**
** The sqlite3_vfs_find() interface returns a pointer to a VFS given its name.
** Names are case sensitive.
** Names are zero-terminated UTF-8 strings.
** If there is no match, a NULL pointer is returned.
** If zVfsName is NULL then the default VFS is returned.
**
** New VFSes are registered with sqlite3_vfs_register().
** Each new VFS becomes the default VFS if the makeDflt flag is set.
** The same VFS can be registered multiple times without injury.
** To make an existing VFS into the default VFS, register it again
** with the makeDflt flag set.  If two different VFSes with the
** same name are registered, the behavior is undefined.  If a
** VFS is registered with a name that is NULL or an empty string,
** then the behavior is undefined.
**
** Unregister a VFS with the sqlite3_vfs_unregister() interface.
** If the default VFS is unregistered, another VFS is chosen as
** the default.  The choice for the new VFS is arbitrary.
**
** INVARIANTS:
**
** {H11203} The [sqlite3_vfs_find(N)] interface returns a pointer to the
**          registered [sqlite3_vfs] object whose name exactly matches
**          the zero-terminated UTF-8 string N, or it returns NULL if
**          there is no match.
**
** {H11206} If the N parameter to [sqlite3_vfs_find(N)] is NULL then
**          the function returns a pointer to the default [sqlite3_vfs]
**          object if there is one, or NULL if there is no default
**          [sqlite3_vfs] object.
**
** {H11209} The [sqlite3_vfs_register(P,F)] interface registers the
**          well-formed [sqlite3_vfs] object P using the name given
**          by the zName field of the object.
**
** {H11212} Using the [sqlite3_vfs_register(P,F)] interface to register
**          the same [sqlite3_vfs] object multiple times is a harmless no-op.
**
** {H11215} The [sqlite3_vfs_register(P,F)] interface makes the [sqlite3_vfs]
**          object P the default [sqlite3_vfs] object if F is non-zero.
**
** {H11218} The [sqlite3_vfs_unregister(P)] interface unregisters the
**          [sqlite3_vfs] object P so that it is no longer returned by
**          subsequent calls to [sqlite3_vfs_find()].
*/
sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);
int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
int sqlite3_vfs_unregister(sqlite3_vfs*);

/*
** CAPI3REF: Mutexes {H17000} <S20000>
**
** The SQLite core uses these routines for thread
** synchronization. Though they are intended for internal
** use by SQLite, code that links against SQLite is
** permitted to use any of these routines.
**
** The SQLite source code contains multiple implementations
** of these mutex routines.  An appropriate implementation
** is selected automatically at compile-time.  The following
** implementations are available in the SQLite core:
**
** <ul>
** <li>   SQLITE_MUTEX_OS2
** <li>   SQLITE_MUTEX_PTHREAD
** <li>   SQLITE_MUTEX_W32
** <li>   SQLITE_MUTEX_NOOP
** </ul>
**
** The SQLITE_MUTEX_NOOP implementation is a set of routines
** that does no real locking and is appropriate for use in
** a single-threaded application.  The SQLITE_MUTEX_OS2,
** SQLITE_MUTEX_PTHREAD, and SQLITE_MUTEX_W32 implementations
** are appropriate for use on OS/2, Unix, and Windows.
**
** If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex
** implementation is included with the library. In this case the
** application must supply a custom mutex implementation using the
** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function
** before calling sqlite3_initialize() or any other public sqlite3_
** function that calls sqlite3_initialize().
**
** {H17011} The sqlite3_mutex_alloc() routine allocates a new
** mutex and returns a pointer to it. {H17012} If it returns NULL
** that means that a mutex could not be allocated. {H17013} SQLite
** will unwind its stack and return an error. {H17014} The argument
** to sqlite3_mutex_alloc() is one of these integer constants:
**
** <ul>
** <li>  SQLITE_MUTEX_FAST
** <li>  SQLITE_MUTEX_RECURSIVE
** <li>  SQLITE_MUTEX_STATIC_MASTER
** <li>  SQLITE_MUTEX_STATIC_MEM
** <li>  SQLITE_MUTEX_STATIC_MEM2
** <li>  SQLITE_MUTEX_STATIC_PRNG
** <li>  SQLITE_MUTEX_STATIC_LRU
** <li>  SQLITE_MUTEX_STATIC_LRU2
** </ul>
**
** {H17015} The first two constants cause sqlite3_mutex_alloc() to create
** a new mutex.  The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
** is used but not necessarily so when SQLITE_MUTEX_FAST is used. {END}
** The mutex implementation does not need to make a distinction
** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
** not want to.  {H17016} But SQLite will only request a recursive mutex in
** cases where it really needs one.  {END} If a faster non-recursive mutex
** implementation is available on the host platform, the mutex subsystem
** might return such a mutex in response to SQLITE_MUTEX_FAST.
**
** {H17017} The other allowed parameters to sqlite3_mutex_alloc() each return
** a pointer to a static preexisting mutex. {END}  Four static mutexes are
** used by the current version of SQLite.  Future versions of SQLite
** may add additional static mutexes.  Static mutexes are for internal
** use by SQLite only.  Applications that use SQLite mutexes should
** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
** SQLITE_MUTEX_RECURSIVE.
**
** {H17018} Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
** returns a different mutex on every call.  {H17034} But for the static
** mutex types, the same mutex is returned on every call that has
** the same type number.
**
** {H17019} The sqlite3_mutex_free() routine deallocates a previously
** allocated dynamic mutex. {H17020} SQLite is careful to deallocate every
** dynamic mutex that it allocates. {A17021} The dynamic mutexes must not be in
** use when they are deallocated. {A17022} Attempting to deallocate a static
** mutex results in undefined behavior. {H17023} SQLite never deallocates
** a static mutex. {END}
**
** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
** to enter a mutex. {H17024} If another thread is already within the mutex,
** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
** SQLITE_BUSY. {H17025}  The sqlite3_mutex_try() interface returns [SQLITE_OK]
** upon successful entry.  {H17026} Mutexes created using
** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.
** {H17027} In such cases the,
** mutex must be exited an equal number of times before another thread
** can enter.  {A17028} If the same thread tries to enter any other
** kind of mutex more than once, the behavior is undefined.
** {H17029} SQLite will never exhibit
** such behavior in its own use of mutexes.
**
** Some systems (for example, Windows 95) do not support the operation
** implemented by sqlite3_mutex_try().  On those systems, sqlite3_mutex_try()
** will always return SQLITE_BUSY.  {H17030} The SQLite core only ever uses
** sqlite3_mutex_try() as an optimization so this is acceptable behavior.
**
** {H17031} The sqlite3_mutex_leave() routine exits a mutex that was
** previously entered by the same thread.  {A17032} The behavior
** is undefined if the mutex is not currently entered by the
** calling thread or is not currently allocated.  {H17033} SQLite will
** never do either. {END}
**
** If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
** sqlite3_mutex_leave() is a NULL pointer, then all three routines
** behave as no-ops.
**
** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
*/
sqlite3_mutex *sqlite3_mutex_alloc(int);
void sqlite3_mutex_free(sqlite3_mutex*);
void sqlite3_mutex_enter(sqlite3_mutex*);
int sqlite3_mutex_try(sqlite3_mutex*);
void sqlite3_mutex_leave(sqlite3_mutex*);

/*
** CAPI3REF: Mutex Methods Object {H17120} <S20130>
** EXPERIMENTAL
**
** An instance of this structure defines the low-level routines
** used to allocate and use mutexes.
**
** Usually, the default mutex implementations provided by SQLite are
** sufficient, however the user has the option of substituting a custom
** implementation for specialized deployments or systems for which SQLite
** does not provide a suitable implementation. In this case, the user
** creates and populates an instance of this structure to pass
** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
** Additionally, an instance of this structure can be used as an
** output variable when querying the system for the current mutex
** implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
**
** The xMutexInit method defined by this structure is invoked as
** part of system initialization by the sqlite3_initialize() function.
** {H17001} The xMutexInit routine shall be called by SQLite once for each
** effective call to [sqlite3_initialize()].
**
** The xMutexEnd method defined by this structure is invoked as
** part of system shutdown by the sqlite3_shutdown() function. The
** implementation of this method is expected to release all outstanding
** resources obtained by the mutex methods implementation, especially
** those obtained by the xMutexInit method. {H17003} The xMutexEnd()
** interface shall be invoked once for each call to [sqlite3_shutdown()].
**
** The remaining seven methods defined by this structure (xMutexAlloc,
** xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and
** xMutexNotheld) implement the following interfaces (respectively):
**
** <ul>
**   <li>  [sqlite3_mutex_alloc()] </li>
**   <li>  [sqlite3_mutex_free()] </li>
**   <li>  [sqlite3_mutex_enter()] </li>
**   <li>  [sqlite3_mutex_try()] </li>
**   <li>  [sqlite3_mutex_leave()] </li>
**   <li>  [sqlite3_mutex_held()] </li>
**   <li>  [sqlite3_mutex_notheld()] </li>
** </ul>
**
** The only difference is that the public sqlite3_XXX functions enumerated
** above silently ignore any invocations that pass a NULL pointer instead
** of a valid mutex handle. The implementations of the methods defined
** by this structure are not required to handle this case, the results
** of passing a NULL pointer instead of a valid mutex handle are undefined
** (i.e. it is acceptable to provide an implementation that segfaults if
** it is passed a NULL pointer).
*/
typedef struct sqlite3_mutex_methods sqlite3_mutex_methods;
struct sqlite3_mutex_methods {
  int (*xMutexInit)(void);
  int (*xMutexEnd)(void);
  sqlite3_mutex *(*xMutexAlloc)(int);
  void (*xMutexFree)(sqlite3_mutex *);
  void (*xMutexEnter)(sqlite3_mutex *);
  int (*xMutexTry)(sqlite3_mutex *);
  void (*xMutexLeave)(sqlite3_mutex *);
  int (*xMutexHeld)(sqlite3_mutex *);
  int (*xMutexNotheld)(sqlite3_mutex *);
};

/*
** CAPI3REF: Mutex Verification Routines {H17080} <S20130> <S30800>
**
** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines
** are intended for use inside assert() statements. {H17081} The SQLite core
** never uses these routines except inside an assert() and applications
** are advised to follow the lead of the core.  {H17082} The core only
** provides implementations for these routines when it is compiled
** with the SQLITE_DEBUG flag.  {A17087} External mutex implementations
** are only required to provide these routines if SQLITE_DEBUG is
** defined and if NDEBUG is not defined.
**
** {H17083} These routines should return true if the mutex in their argument
** is held or not held, respectively, by the calling thread.
**
** {X17084} The implementation is not required to provided versions of these
** routines that actually work. If the implementation does not provide working
** versions of these routines, it should at least provide stubs that always
** return true so that one does not get spurious assertion failures.
**
** {H17085} If the argument to sqlite3_mutex_held() is a NULL pointer then
** the routine should return 1.  {END} This seems counter-intuitive since
** clearly the mutex cannot be held if it does not exist.  But the
** the reason the mutex does not exist is because the build is not
** using mutexes.  And we do not want the assert() containing the
** call to sqlite3_mutex_held() to fail, so a non-zero return is
** the appropriate thing to do.  {H17086} The sqlite3_mutex_notheld()
** interface should also return 1 when given a NULL pointer.
*/
int sqlite3_mutex_held(sqlite3_mutex*);
int sqlite3_mutex_notheld(sqlite3_mutex*);

/*
** CAPI3REF: Mutex Types {H17001} <H17000>
**
** The [sqlite3_mutex_alloc()] interface takes a single argument
** which is one of these integer constants.
**
** The set of static mutexes may change from one SQLite release to the
** next.  Applications that override the built-in mutex logic must be
** prepared to accommodate additional static mutexes.
*/
#define SQLITE_MUTEX_FAST             0
#define SQLITE_MUTEX_RECURSIVE        1
#define SQLITE_MUTEX_STATIC_MASTER    2
#define SQLITE_MUTEX_STATIC_MEM       3  /* sqlite3_malloc() */
#define SQLITE_MUTEX_STATIC_MEM2      4  /* sqlite3_release_memory() */
#define SQLITE_MUTEX_STATIC_PRNG      5  /* sqlite3_random() */
#define SQLITE_MUTEX_STATIC_LRU       6  /* lru page list */
#define SQLITE_MUTEX_STATIC_LRU2      7  /* lru page list */

/*
** CAPI3REF: Low-Level Control Of Database Files {H11300} <S30800>
**
** {H11301} The [sqlite3_file_control()] interface makes a direct call to the
** xFileControl method for the [sqlite3_io_methods] object associated
** with a particular database identified by the second argument. {H11302} The
** name of the database is the name assigned to the database by the
** <a href="lang_attach.html">ATTACH</a> SQL command that opened the
** database. {H11303} To control the main database file, use the name "main"
** or a NULL pointer. {H11304} The third and fourth parameters to this routine
** are passed directly through to the second and third parameters of
** the xFileControl method.  {H11305} The return value of the xFileControl
** method becomes the return value of this routine.
**
** {H11306} If the second parameter (zDbName) does not match the name of any
** open database file, then SQLITE_ERROR is returned. {H11307} This error
** code is not remembered and will not be recalled by [sqlite3_errcode()]
** or [sqlite3_errmsg()]. {A11308} The underlying xFileControl method might
** also return SQLITE_ERROR.  {A11309} There is no way to distinguish between
** an incorrect zDbName and an SQLITE_ERROR return from the underlying
** xFileControl method. {END}
**
** See also: [SQLITE_FCNTL_LOCKSTATE]
*/
int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);

/*
** CAPI3REF: Testing Interface {H11400} <S30800>
**
** The sqlite3_test_control() interface is used to read out internal
** state of SQLite and to inject faults into SQLite for testing
** purposes.  The first parameter is an operation code that determines
** the number, meaning, and operation of all subsequent parameters.
**
** This interface is not for use by applications.  It exists solely
** for verifying the correct operation of the SQLite library.  Depending
** on how the SQLite library is compiled, this interface might not exist.
**
** The details of the operation codes, their meanings, the parameters
** they take, and what they do are all subject to change without notice.
** Unlike most of the SQLite API, this function is not guaranteed to
** operate consistently from one release to the next.
*/
int sqlite3_test_control(int op, ...);

/*
** CAPI3REF: Testing Interface Operation Codes {H11410} <H11400>
**
** These constants are the valid operation code parameters used
** as the first argument to [sqlite3_test_control()].
**
** These parameters and their meanings are subject to change
** without notice.  These values are for testing purposes only.
** Applications should not use any of these parameters or the
** [sqlite3_test_control()] interface.
*/
#define SQLITE_TESTCTRL_PRNG_SAVE                5
#define SQLITE_TESTCTRL_PRNG_RESTORE             6
#define SQLITE_TESTCTRL_PRNG_RESET               7
#define SQLITE_TESTCTRL_BITVEC_TEST              8
#define SQLITE_TESTCTRL_FAULT_INSTALL            9
#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS     10

/*
** CAPI3REF: SQLite Runtime Status {H17200} <S60200>
** EXPERIMENTAL
**
** This interface is used to retrieve runtime status information
** about the preformance of SQLite, and optionally to reset various
** highwater marks.  The first argument is an integer code for
** the specific parameter to measure.  Recognized integer codes
** are of the form [SQLITE_STATUS_MEMORY_USED | SQLITE_STATUS_...].
** The current value of the parameter is returned into *pCurrent.
** The highest recorded value is returned in *pHighwater.  If the
** resetFlag is true, then the highest record value is reset after
** *pHighwater is written. Some parameters do not record the highest
** value.  For those parameters
** nothing is written into *pHighwater and the resetFlag is ignored.
** Other parameters record only the highwater mark and not the current
** value.  For these latter parameters nothing is written into *pCurrent.
**
** This routine returns SQLITE_OK on success and a non-zero
** [error code] on failure.
**
** This routine is threadsafe but is not atomic.  This routine can
** called while other threads are running the same or different SQLite
** interfaces.  However the values returned in *pCurrent and
** *pHighwater reflect the status of SQLite at different points in time
** and it is possible that another thread might change the parameter
** in between the times when *pCurrent and *pHighwater are written.
**
** See also: [sqlite3_db_status()]
*/
int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);

/*
** CAPI3REF: Database Connection Status {H17201} <S60200>
** EXPERIMENTAL
**
** This interface is used to retrieve runtime status information 
** about a single [database connection].  The first argument is the
** database connection object to be interrogated.  The second argument
** is the parameter to interrogate.  Currently, the only allowed value
** for the second parameter is [SQLITE_DBSTATUS_LOOKASIDE_USED].
** Additional options will likely appear in future releases of SQLite.
**
** The current value of the request parameter is written into *pCur
** and the highest instantaneous value is written into *pHiwtr.  If
** the resetFlg is true, then the highest instantaneous value is
** reset back down to the current value.
**
** See also: [sqlite3_status()].
*/
int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);

/*
** CAPI3REF: Status Parameters {H17250} <H17200>
** EXPERIMENTAL
**
** These integer constants designate various run-time status parameters
** that can be returned by [sqlite3_status()].
**
** <dl>
** <dt>SQLITE_STATUS_MEMORY_USED</dt>
** <dd>This parameter is the current amount of memory checked out
** using [sqlite3_malloc()], either directly or indirectly.  The
** figure includes calls made to [sqlite3_malloc()] by the application
** and internal memory usage by the SQLite library.  Scratch memory
** controlled by [SQLITE_CONFIG_SCRATCH] and auxiliary page-cache
** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in
** this parameter.  The amount returned is the sum of the allocation
** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd>
**
** <dt>SQLITE_STATUS_MALLOC_SIZE</dt>
** <dd>This parameter records the largest memory allocation request
** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their
** internal equivalents).  Only the value returned in the
** *pHighwater parameter to [sqlite3_status()] is of interest.  
** The value written into the *pCurrent parameter is undefined.</dd>
**
** <dt>SQLITE_STATUS_PAGECACHE_USED</dt>
** <dd>This parameter returns the number of pages used out of the
** [pagecache memory allocator] that was configured using 
** [SQLITE_CONFIG_PAGECACHE].  The
** value returned is in pages, not in bytes.</dd>
**
** <dt>SQLITE_STATUS_PAGECACHE_OVERFLOW</dt>
** <dd>This parameter returns the number of bytes of page cache
** allocation which could not be statisfied by the [SQLITE_CONFIG_PAGECACHE]
** buffer and where forced to overflow to [sqlite3_malloc()].  The
** returned value includes allocations that overflowed because they
** where too large (they were larger than the "sz" parameter to
** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because
** no space was left in the page cache.</dd>
**
** <dt>SQLITE_STATUS_PAGECACHE_SIZE</dt>
** <dd>This parameter records the largest memory allocation request
** handed to [pagecache memory allocator].  Only the value returned in the
** *pHighwater parameter to [sqlite3_status()] is of interest.  
** The value written into the *pCurrent parameter is undefined.</dd>
**
** <dt>SQLITE_STATUS_SCRATCH_USED</dt>
** <dd>This parameter returns the number of allocations used out of the
** [scratch memory allocator] configured using
** [SQLITE_CONFIG_SCRATCH].  The value returned is in allocations, not
** in bytes.  Since a single thread may only have one scratch allocation
** outstanding at time, this parameter also reports the number of threads
** using scratch memory at the same time.</dd>
**
** <dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt>
** <dd>This parameter returns the number of bytes of scratch memory
** allocation which could not be statisfied by the [SQLITE_CONFIG_SCRATCH]
** buffer and where forced to overflow to [sqlite3_malloc()].  The values
** returned include overflows because the requested allocation was too
** larger (that is, because the requested allocation was larger than the
** "sz" parameter to [SQLITE_CONFIG_SCRATCH]) and because no scratch buffer
** slots were available.
** </dd>
**
** <dt>SQLITE_STATUS_SCRATCH_SIZE</dt>
** <dd>This parameter records the largest memory allocation request
** handed to [scratch memory allocator].  Only the value returned in the
** *pHighwater parameter to [sqlite3_status()] is of interest.  
** The value written into the *pCurrent parameter is undefined.</dd>
**
** <dt>SQLITE_STATUS_PARSER_STACK</dt>
** <dd>This parameter records the deepest parser stack.  It is only
** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].</dd>
** </dl>
**
** New status parameters may be added from time to time.
*/
#define SQLITE_STATUS_MEMORY_USED          0
#define SQLITE_STATUS_PAGECACHE_USED       1
#define SQLITE_STATUS_PAGECACHE_OVERFLOW   2
#define SQLITE_STATUS_SCRATCH_USED         3
#define SQLITE_STATUS_SCRATCH_OVERFLOW     4
#define SQLITE_STATUS_MALLOC_SIZE          5
#define SQLITE_STATUS_PARSER_STACK         6
#define SQLITE_STATUS_PAGECACHE_SIZE       7
#define SQLITE_STATUS_SCRATCH_SIZE         8

/*
** CAPI3REF: Status Parameters for database connections {H17275} <H17200>
** EXPERIMENTAL
**
** Status verbs for [sqlite3_db_status()].
**
** <dl>
** <dt>SQLITE_DBSTATUS_LOOKASIDE_USED</dt>
** <dd>This parameter returns the number of lookaside memory slots currently
** checked out.</dd>
** </dl>
*/
#define SQLITE_DBSTATUS_LOOKASIDE_USED     0

/*
** Undo the hack that converts floating point types to integer for
** builds on processors without floating point support.
*/
#ifdef SQLITE_OMIT_FLOATING_POINT
# undef double
#endif

#ifdef __cplusplus
}  /* End of the 'extern "C"' block */
#endif
#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/sqlite3ext.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
/*
** 2006 June 7
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the SQLite interface for use by
** shared libraries that want to be imported as extensions into
** an SQLite instance.  Shared libraries that intend to be loaded
** as extensions by SQLite should #include this file instead of 
** sqlite3.h.
**
** @(#) $Id: sqlite3ext.h,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#ifndef _SQLITE3EXT_H_
#define _SQLITE3EXT_H_
#include "sqlite3.h"

typedef struct sqlite3_api_routines sqlite3_api_routines;

/*
** The following structure holds pointers to all of the SQLite API
** routines.
**
** WARNING:  In order to maintain backwards compatibility, add new
** interfaces to the end of this structure only.  If you insert new
** interfaces in the middle of this structure, then older different
** versions of SQLite will not be able to load each others' shared
** libraries!
*/
struct sqlite3_api_routines {
  void * (*aggregate_context)(sqlite3_context*,int nBytes);
  int  (*aggregate_count)(sqlite3_context*);
  int  (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*));
  int  (*bind_double)(sqlite3_stmt*,int,double);
  int  (*bind_int)(sqlite3_stmt*,int,int);
  int  (*bind_int64)(sqlite3_stmt*,int,sqlite_int64);
  int  (*bind_null)(sqlite3_stmt*,int);
  int  (*bind_parameter_count)(sqlite3_stmt*);
  int  (*bind_parameter_index)(sqlite3_stmt*,const char*zName);
  const char * (*bind_parameter_name)(sqlite3_stmt*,int);
  int  (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*));
  int  (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*));
  int  (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*);
  int  (*busy_handler)(sqlite3*,int(*)(void*,int),void*);
  int  (*busy_timeout)(sqlite3*,int ms);
  int  (*changes)(sqlite3*);
  int  (*close)(sqlite3*);
  int  (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*,int eTextRep,const char*));
  int  (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*,int eTextRep,const void*));
  const void * (*column_blob)(sqlite3_stmt*,int iCol);
  int  (*column_bytes)(sqlite3_stmt*,int iCol);
  int  (*column_bytes16)(sqlite3_stmt*,int iCol);
  int  (*column_count)(sqlite3_stmt*pStmt);
  const char * (*column_database_name)(sqlite3_stmt*,int);
  const void * (*column_database_name16)(sqlite3_stmt*,int);
  const char * (*column_decltype)(sqlite3_stmt*,int i);
  const void * (*column_decltype16)(sqlite3_stmt*,int);
  double  (*column_double)(sqlite3_stmt*,int iCol);
  int  (*column_int)(sqlite3_stmt*,int iCol);
  sqlite_int64  (*column_int64)(sqlite3_stmt*,int iCol);
  const char * (*column_name)(sqlite3_stmt*,int);
  const void * (*column_name16)(sqlite3_stmt*,int);
  const char * (*column_origin_name)(sqlite3_stmt*,int);
  const void * (*column_origin_name16)(sqlite3_stmt*,int);
  const char * (*column_table_name)(sqlite3_stmt*,int);
  const void * (*column_table_name16)(sqlite3_stmt*,int);
  const unsigned char * (*column_text)(sqlite3_stmt*,int iCol);
  const void * (*column_text16)(sqlite3_stmt*,int iCol);
  int  (*column_type)(sqlite3_stmt*,int iCol);
  sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol);
  void * (*commit_hook)(sqlite3*,int(*)(void*),void*);
  int  (*complete)(const char*sql);
  int  (*complete16)(const void*sql);
  int  (*create_collation)(sqlite3*,const char*,int,void*,int(*)(void*,int,const void*,int,const void*));
  int  (*create_collation16)(sqlite3*,const void*,int,void*,int(*)(void*,int,const void*,int,const void*));
  int  (*create_function)(sqlite3*,const char*,int,int,void*,void (*xFunc)(sqlite3_context*,int,sqlite3_value**),void (*xStep)(sqlite3_context*,int,sqlite3_value**),void (*xFinal)(sqlite3_context*));
  int  (*create_function16)(sqlite3*,const void*,int,int,void*,void (*xFunc)(sqlite3_context*,int,sqlite3_value**),void (*xStep)(sqlite3_context*,int,sqlite3_value**),void (*xFinal)(sqlite3_context*));
  int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*);
  int  (*data_count)(sqlite3_stmt*pStmt);
  sqlite3 * (*db_handle)(sqlite3_stmt*);
  int (*declare_vtab)(sqlite3*,const char*);
  int  (*enable_shared_cache)(int);
  int  (*errcode)(sqlite3*db);
  const char * (*errmsg)(sqlite3*);
  const void * (*errmsg16)(sqlite3*);
  int  (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**);
  int  (*expired)(sqlite3_stmt*);
  int  (*finalize)(sqlite3_stmt*pStmt);
  void  (*free)(void*);
  void  (*free_table)(char**result);
  int  (*get_autocommit)(sqlite3*);
  void * (*get_auxdata)(sqlite3_context*,int);
  int  (*get_table)(sqlite3*,const char*,char***,int*,int*,char**);
  int  (*global_recover)(void);
  void  (*interruptx)(sqlite3*);
  sqlite_int64  (*last_insert_rowid)(sqlite3*);
  const char * (*libversion)(void);
  int  (*libversion_number)(void);
  void *(*malloc)(int);
  char * (*mprintf)(const char*,...);
  int  (*open)(const char*,sqlite3**);
  int  (*open16)(const void*,sqlite3**);
  int  (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
  int  (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
  void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*);
  void  (*progress_handler)(sqlite3*,int,int(*)(void*),void*);
  void *(*realloc)(void*,int);
  int  (*reset)(sqlite3_stmt*pStmt);
  void  (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*));
  void  (*result_double)(sqlite3_context*,double);
  void  (*result_error)(sqlite3_context*,const char*,int);
  void  (*result_error16)(sqlite3_context*,const void*,int);
  void  (*result_int)(sqlite3_context*,int);
  void  (*result_int64)(sqlite3_context*,sqlite_int64);
  void  (*result_null)(sqlite3_context*);
  void  (*result_text)(sqlite3_context*,const char*,int,void(*)(void*));
  void  (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*));
  void  (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*));
  void  (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*));
  void  (*result_value)(sqlite3_context*,sqlite3_value*);
  void * (*rollback_hook)(sqlite3*,void(*)(void*),void*);
  int  (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,const char*,const char*),void*);
  void  (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*));
  char * (*snprintf)(int,char*,const char*,...);
  int  (*step)(sqlite3_stmt*);
  int  (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,char const**,char const**,int*,int*,int*);
  void  (*thread_cleanup)(void);
  int  (*total_changes)(sqlite3*);
  void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*);
  int  (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*);
  void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*,sqlite_int64),void*);
  void * (*user_data)(sqlite3_context*);
  const void * (*value_blob)(sqlite3_value*);
  int  (*value_bytes)(sqlite3_value*);
  int  (*value_bytes16)(sqlite3_value*);
  double  (*value_double)(sqlite3_value*);
  int  (*value_int)(sqlite3_value*);
  sqlite_int64  (*value_int64)(sqlite3_value*);
  int  (*value_numeric_type)(sqlite3_value*);
  const unsigned char * (*value_text)(sqlite3_value*);
  const void * (*value_text16)(sqlite3_value*);
  const void * (*value_text16be)(sqlite3_value*);
  const void * (*value_text16le)(sqlite3_value*);
  int  (*value_type)(sqlite3_value*);
  char *(*vmprintf)(const char*,va_list);
  /* Added ??? */
  int (*overload_function)(sqlite3*, const char *zFuncName, int nArg);
  /* Added by 3.3.13 */
  int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
  int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
  int (*clear_bindings)(sqlite3_stmt*);
  /* Added by 3.4.1 */
  int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*,void (*xDestroy)(void *));
  /* Added by 3.5.0 */
  int (*bind_zeroblob)(sqlite3_stmt*,int,int);
  int (*blob_bytes)(sqlite3_blob*);
  int (*blob_close)(sqlite3_blob*);
  int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64,int,sqlite3_blob**);
  int (*blob_read)(sqlite3_blob*,void*,int,int);
  int (*blob_write)(sqlite3_blob*,const void*,int,int);
  int (*create_collation_v2)(sqlite3*,const char*,int,void*,int(*)(void*,int,const void*,int,const void*),void(*)(void*));
  int (*file_control)(sqlite3*,const char*,int,void*);
  sqlite3_int64 (*memory_highwater)(int);
  sqlite3_int64 (*memory_used)(void);
  sqlite3_mutex *(*mutex_alloc)(int);
  void (*mutex_enter)(sqlite3_mutex*);
  void (*mutex_free)(sqlite3_mutex*);
  void (*mutex_leave)(sqlite3_mutex*);
  int (*mutex_try)(sqlite3_mutex*);
  int (*open_v2)(const char*,sqlite3**,int,const char*);
  int (*release_memory)(int);
  void (*result_error_nomem)(sqlite3_context*);
  void (*result_error_toobig)(sqlite3_context*);
  int (*sleep)(int);
  void (*soft_heap_limit)(int);
  sqlite3_vfs *(*vfs_find)(const char*);
  int (*vfs_register)(sqlite3_vfs*,int);
  int (*vfs_unregister)(sqlite3_vfs*);
  int (*xthreadsafe)(void);
  void (*result_zeroblob)(sqlite3_context*,int);
  void (*result_error_code)(sqlite3_context*,int);
  int (*test_control)(int, ...);
  void (*randomness)(int,void*);
  sqlite3 *(*context_db_handle)(sqlite3_context*);
  int (*extended_result_codes)(sqlite3*,int);
  int (*limit)(sqlite3*,int,int);
  sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*);
  const char *(*sql)(sqlite3_stmt*);
  int (*status)(int,int*,int*,int);
};

/*
** The following macros redefine the API routines so that they are
** redirected throught the global sqlite3_api structure.
**
** This header file is also used by the loadext.c source file
** (part of the main SQLite library - not an extension) so that
** it can get access to the sqlite3_api_routines structure
** definition.  But the main library does not want to redefine
** the API.  So the redefinition macros are only valid if the
** SQLITE_CORE macros is undefined.
*/
#ifndef SQLITE_CORE
#define sqlite3_aggregate_context      sqlite3_api->aggregate_context
#define sqlite3_aggregate_count        sqlite3_api->aggregate_count
#define sqlite3_bind_blob              sqlite3_api->bind_blob
#define sqlite3_bind_double            sqlite3_api->bind_double
#define sqlite3_bind_int               sqlite3_api->bind_int
#define sqlite3_bind_int64             sqlite3_api->bind_int64
#define sqlite3_bind_null              sqlite3_api->bind_null
#define sqlite3_bind_parameter_count   sqlite3_api->bind_parameter_count
#define sqlite3_bind_parameter_index   sqlite3_api->bind_parameter_index
#define sqlite3_bind_parameter_name    sqlite3_api->bind_parameter_name
#define sqlite3_bind_text              sqlite3_api->bind_text
#define sqlite3_bind_text16            sqlite3_api->bind_text16
#define sqlite3_bind_value             sqlite3_api->bind_value
#define sqlite3_busy_handler           sqlite3_api->busy_handler
#define sqlite3_busy_timeout           sqlite3_api->busy_timeout
#define sqlite3_changes                sqlite3_api->changes
#define sqlite3_close                  sqlite3_api->close
#define sqlite3_collation_needed       sqlite3_api->collation_needed
#define sqlite3_collation_needed16     sqlite3_api->collation_needed16
#define sqlite3_column_blob            sqlite3_api->column_blob
#define sqlite3_column_bytes           sqlite3_api->column_bytes
#define sqlite3_column_bytes16         sqlite3_api->column_bytes16
#define sqlite3_column_count           sqlite3_api->column_count
#define sqlite3_column_database_name   sqlite3_api->column_database_name
#define sqlite3_column_database_name16 sqlite3_api->column_database_name16
#define sqlite3_column_decltype        sqlite3_api->column_decltype
#define sqlite3_column_decltype16      sqlite3_api->column_decltype16
#define sqlite3_column_double          sqlite3_api->column_double
#define sqlite3_column_int             sqlite3_api->column_int
#define sqlite3_column_int64           sqlite3_api->column_int64
#define sqlite3_column_name            sqlite3_api->column_name
#define sqlite3_column_name16          sqlite3_api->column_name16
#define sqlite3_column_origin_name     sqlite3_api->column_origin_name
#define sqlite3_column_origin_name16   sqlite3_api->column_origin_name16
#define sqlite3_column_table_name      sqlite3_api->column_table_name
#define sqlite3_column_table_name16    sqlite3_api->column_table_name16
#define sqlite3_column_text            sqlite3_api->column_text
#define sqlite3_column_text16          sqlite3_api->column_text16
#define sqlite3_column_type            sqlite3_api->column_type
#define sqlite3_column_value           sqlite3_api->column_value
#define sqlite3_commit_hook            sqlite3_api->commit_hook
#define sqlite3_complete               sqlite3_api->complete
#define sqlite3_complete16             sqlite3_api->complete16
#define sqlite3_create_collation       sqlite3_api->create_collation
#define sqlite3_create_collation16     sqlite3_api->create_collation16
#define sqlite3_create_function        sqlite3_api->create_function
#define sqlite3_create_function16      sqlite3_api->create_function16
#define sqlite3_create_module          sqlite3_api->create_module
#define sqlite3_create_module_v2       sqlite3_api->create_module_v2
#define sqlite3_data_count             sqlite3_api->data_count
#define sqlite3_db_handle              sqlite3_api->db_handle
#define sqlite3_declare_vtab           sqlite3_api->declare_vtab
#define sqlite3_enable_shared_cache    sqlite3_api->enable_shared_cache
#define sqlite3_errcode                sqlite3_api->errcode
#define sqlite3_errmsg                 sqlite3_api->errmsg
#define sqlite3_errmsg16               sqlite3_api->errmsg16
#define sqlite3_exec                   sqlite3_api->exec
#define sqlite3_expired                sqlite3_api->expired
#define sqlite3_finalize               sqlite3_api->finalize
#define sqlite3_free                   sqlite3_api->free
#define sqlite3_free_table             sqlite3_api->free_table
#define sqlite3_get_autocommit         sqlite3_api->get_autocommit
#define sqlite3_get_auxdata            sqlite3_api->get_auxdata
#define sqlite3_get_table              sqlite3_api->get_table
#define sqlite3_global_recover         sqlite3_api->global_recover
#define sqlite3_interrupt              sqlite3_api->interruptx
#define sqlite3_last_insert_rowid      sqlite3_api->last_insert_rowid
#define sqlite3_libversion             sqlite3_api->libversion
#define sqlite3_libversion_number      sqlite3_api->libversion_number
#define sqlite3_malloc                 sqlite3_api->malloc
#define sqlite3_mprintf                sqlite3_api->mprintf
#define sqlite3_open                   sqlite3_api->open
#define sqlite3_open16                 sqlite3_api->open16
#define sqlite3_prepare                sqlite3_api->prepare
#define sqlite3_prepare16              sqlite3_api->prepare16
#define sqlite3_prepare_v2             sqlite3_api->prepare_v2
#define sqlite3_prepare16_v2           sqlite3_api->prepare16_v2
#define sqlite3_profile                sqlite3_api->profile
#define sqlite3_progress_handler       sqlite3_api->progress_handler
#define sqlite3_realloc                sqlite3_api->realloc
#define sqlite3_reset                  sqlite3_api->reset
#define sqlite3_result_blob            sqlite3_api->result_blob
#define sqlite3_result_double          sqlite3_api->result_double
#define sqlite3_result_error           sqlite3_api->result_error
#define sqlite3_result_error16         sqlite3_api->result_error16
#define sqlite3_result_int             sqlite3_api->result_int
#define sqlite3_result_int64           sqlite3_api->result_int64
#define sqlite3_result_null            sqlite3_api->result_null
#define sqlite3_result_text            sqlite3_api->result_text
#define sqlite3_result_text16          sqlite3_api->result_text16
#define sqlite3_result_text16be        sqlite3_api->result_text16be
#define sqlite3_result_text16le        sqlite3_api->result_text16le
#define sqlite3_result_value           sqlite3_api->result_value
#define sqlite3_rollback_hook          sqlite3_api->rollback_hook
#define sqlite3_set_authorizer         sqlite3_api->set_authorizer
#define sqlite3_set_auxdata            sqlite3_api->set_auxdata
#define sqlite3_snprintf               sqlite3_api->snprintf
#define sqlite3_step                   sqlite3_api->step
#define sqlite3_table_column_metadata  sqlite3_api->table_column_metadata
#define sqlite3_thread_cleanup         sqlite3_api->thread_cleanup
#define sqlite3_total_changes          sqlite3_api->total_changes
#define sqlite3_trace                  sqlite3_api->trace
#define sqlite3_transfer_bindings      sqlite3_api->transfer_bindings
#define sqlite3_update_hook            sqlite3_api->update_hook
#define sqlite3_user_data              sqlite3_api->user_data
#define sqlite3_value_blob             sqlite3_api->value_blob
#define sqlite3_value_bytes            sqlite3_api->value_bytes
#define sqlite3_value_bytes16          sqlite3_api->value_bytes16
#define sqlite3_value_double           sqlite3_api->value_double
#define sqlite3_value_int              sqlite3_api->value_int
#define sqlite3_value_int64            sqlite3_api->value_int64
#define sqlite3_value_numeric_type     sqlite3_api->value_numeric_type
#define sqlite3_value_text             sqlite3_api->value_text
#define sqlite3_value_text16           sqlite3_api->value_text16
#define sqlite3_value_text16be         sqlite3_api->value_text16be
#define sqlite3_value_text16le         sqlite3_api->value_text16le
#define sqlite3_value_type             sqlite3_api->value_type
#define sqlite3_vmprintf               sqlite3_api->vmprintf
#define sqlite3_overload_function      sqlite3_api->overload_function
#define sqlite3_prepare_v2             sqlite3_api->prepare_v2
#define sqlite3_prepare16_v2           sqlite3_api->prepare16_v2
#define sqlite3_clear_bindings         sqlite3_api->clear_bindings
#define sqlite3_bind_zeroblob          sqlite3_api->bind_zeroblob
#define sqlite3_blob_bytes             sqlite3_api->blob_bytes
#define sqlite3_blob_close             sqlite3_api->blob_close
#define sqlite3_blob_open              sqlite3_api->blob_open
#define sqlite3_blob_read              sqlite3_api->blob_read
#define sqlite3_blob_write             sqlite3_api->blob_write
#define sqlite3_create_collation_v2    sqlite3_api->create_collation_v2
#define sqlite3_file_control           sqlite3_api->file_control
#define sqlite3_memory_highwater       sqlite3_api->memory_highwater
#define sqlite3_memory_used            sqlite3_api->memory_used
#define sqlite3_mutex_alloc            sqlite3_api->mutex_alloc
#define sqlite3_mutex_enter            sqlite3_api->mutex_enter
#define sqlite3_mutex_free             sqlite3_api->mutex_free
#define sqlite3_mutex_leave            sqlite3_api->mutex_leave
#define sqlite3_mutex_try              sqlite3_api->mutex_try
#define sqlite3_open_v2                sqlite3_api->open_v2
#define sqlite3_release_memory         sqlite3_api->release_memory
#define sqlite3_result_error_nomem     sqlite3_api->result_error_nomem
#define sqlite3_result_error_toobig    sqlite3_api->result_error_toobig
#define sqlite3_sleep                  sqlite3_api->sleep
#define sqlite3_soft_heap_limit        sqlite3_api->soft_heap_limit
#define sqlite3_vfs_find               sqlite3_api->vfs_find
#define sqlite3_vfs_register           sqlite3_api->vfs_register
#define sqlite3_vfs_unregister         sqlite3_api->vfs_unregister
#define sqlite3_threadsafe             sqlite3_api->xthreadsafe
#define sqlite3_result_zeroblob        sqlite3_api->result_zeroblob
#define sqlite3_result_error_code      sqlite3_api->result_error_code
#define sqlite3_test_control           sqlite3_api->test_control
#define sqlite3_randomness             sqlite3_api->randomness
#define sqlite3_context_db_handle      sqlite3_api->context_db_handle
#define sqlite3_extended_result_codes  sqlite3_api->extended_result_codes
#define sqlite3_limit                  sqlite3_api->limit
#define sqlite3_next_stmt              sqlite3_api->next_stmt
#define sqlite3_sql                    sqlite3_api->sql
#define sqlite3_status                 sqlite3_api->status
#endif /* SQLITE_CORE */

#define SQLITE_EXTENSION_INIT1     const sqlite3_api_routines *sqlite3_api = 0;
#define SQLITE_EXTENSION_INIT2(v)  sqlite3_api = v;

#endif /* _SQLITE3EXT_H_ */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/sqliteInt.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Internal interface definitions for SQLite.
**
** @(#) $Id: sqliteInt.h,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#ifndef _SQLITEINT_H_
#define _SQLITEINT_H_

/*
** Include the configuration header output by 'configure' if we're using the
** autoconf-based build
*/
#ifdef _HAVE_SQLITE_CONFIG_H
#include "config.h"
#endif

#include "sqliteLimit.h"

/* Disable nuisance warnings on Borland compilers */
#if defined(__BORLANDC__)
#pragma warn -rch /* unreachable code */
#pragma warn -ccc /* Condition is always true or false */
#pragma warn -aus /* Assigned value is never used */
#pragma warn -csu /* Comparing signed and unsigned */
#pragma warn -spa /* Suspicous pointer arithmetic */
#endif

/* Needed for various definitions... */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE
#endif

/*
** Include standard header files as necessary
*/
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif

/*
** A macro used to aid in coverage testing.  When doing coverage
** testing, the condition inside the argument must be evaluated 
** both true and false in order to get full branch coverage.
** This macro can be inserted to ensure adequate test coverage
** in places where simple condition/decision coverage is inadequate.
*/
#ifdef SQLITE_COVERAGE_TEST
  void sqlite3Coverage(int);
# define testcase(X)  if( X ){ sqlite3Coverage(__LINE__); }
#else
# define testcase(X)
#endif

/*
** The ALWAYS and NEVER macros surround boolean expressions which 
** are intended to always be true or false, respectively.  Such
** expressions could be omitted from the code completely.  But they
** are included in a few cases in order to enhance the resilience
** of SQLite to unexpected behavior - to make the code "self-healing"
** or "ductile" rather than being "brittle" and crashing at the first
** hint of unplanned behavior.
**
** When doing coverage testing ALWAYS and NEVER are hard-coded to
** be true and false so that the unreachable code then specify will
** not be counted as untested code.
*/
#ifdef SQLITE_COVERAGE_TEST
# define ALWAYS(X)      (1)
# define NEVER(X)       (0)
#else
# define ALWAYS(X)      (X)
# define NEVER(X)       (X)
#endif

/*
** The macro unlikely() is a hint that surrounds a boolean
** expression that is usually false.  Macro likely() surrounds
** a boolean expression that is usually true.  GCC is able to
** use these hints to generate better code, sometimes.
*/
#if defined(__GNUC__) && 0
# define likely(X)    __builtin_expect((X),1)
# define unlikely(X)  __builtin_expect((X),0)
#else
# define likely(X)    !!(X)
# define unlikely(X)  !!(X)
#endif

/*
 * This macro is used to "hide" some ugliness in casting an int
 * value to a ptr value under the MSVC 64-bit compiler.   Casting
 * non 64-bit values to ptr types results in a "hard" error with 
 * the MSVC 64-bit compiler which this attempts to avoid.  
 *
 * A simple compiler pragma or casting sequence could not be found
 * to correct this in all situations, so this macro was introduced.
 *
 * It could be argued that the intptr_t type could be used in this
 * case, but that type is not available on all compilers, or 
 * requires the #include of specific headers which differs between
 * platforms.
 */
#define SQLITE_INT_TO_PTR(X)   ((void*)&((char*)0)[X])
#define SQLITE_PTR_TO_INT(X)   ((int)(((char*)X)-(char*)0))

/*
** These #defines should enable >2GB file support on Posix if the
** underlying operating system supports it.  If the OS lacks
** large file support, or if the OS is windows, these should be no-ops.
**
** Ticket #2739:  The _LARGEFILE_SOURCE macro must appear before any
** system #includes.  Hence, this block of code must be the very first
** code in all source files.
**
** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch
** on the compiler command line.  This is necessary if you are compiling
** on a recent machine (ex: RedHat 7.2) but you want your code to work
** on an older machine (ex: RedHat 6.0).  If you compile on RedHat 7.2
** without this option, LFS is enable.  But LFS does not exist in the kernel
** in RedHat 6.0, so the code won't work.  Hence, for maximum binary
** portability you should omit LFS.
**
** Similar is true for MacOS.  LFS is only supported on MacOS 9 and later.
*/
#ifndef SQLITE_DISABLE_LFS
# define _LARGE_FILE       1
# ifndef _FILE_OFFSET_BITS
#   define _FILE_OFFSET_BITS 64
# endif
# define _LARGEFILE_SOURCE 1
#endif


/*
** The SQLITE_THREADSAFE macro must be defined as either 0 or 1.
** Older versions of SQLite used an optional THREADSAFE macro.
** We support that for legacy
*/
#if !defined(SQLITE_THREADSAFE)
#if defined(THREADSAFE)
# define SQLITE_THREADSAFE THREADSAFE
#else
# define SQLITE_THREADSAFE 1
#endif
#endif

/*
** Exactly one of the following macros must be defined in order to
** specify which memory allocation subsystem to use.
**
**     SQLITE_SYSTEM_MALLOC          // Use normal system malloc()
**     SQLITE_MEMDEBUG               // Debugging version of system malloc()
**     SQLITE_MEMORY_SIZE            // internal allocator #1
**     SQLITE_MMAP_HEAP_SIZE         // internal mmap() allocator
**     SQLITE_POW2_MEMORY_SIZE       // internal power-of-two allocator
**
** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as
** the default.
*/
#if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_MEMDEBUG)+\
    defined(SQLITE_MEMORY_SIZE)+defined(SQLITE_MMAP_HEAP_SIZE)+\
    defined(SQLITE_POW2_MEMORY_SIZE)>1
# error "At most one of the following compile-time configuration options\
 is allows: SQLITE_SYSTEM_MALLOC, SQLITE_MEMDEBUG, SQLITE_MEMORY_SIZE,\
 SQLITE_MMAP_HEAP_SIZE, SQLITE_POW2_MEMORY_SIZE"
#endif
#if defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_MEMDEBUG)+\
    defined(SQLITE_MEMORY_SIZE)+defined(SQLITE_MMAP_HEAP_SIZE)+\
    defined(SQLITE_POW2_MEMORY_SIZE)==0
# define SQLITE_SYSTEM_MALLOC 1
#endif

/*
** If SQLITE_MALLOC_SOFT_LIMIT is defined, then try to keep the
** sizes of memory allocations below this value where possible.
*/
#if defined(SQLITE_POW2_MEMORY_SIZE) && !defined(SQLITE_MALLOC_SOFT_LIMIT)
# define SQLITE_MALLOC_SOFT_LIMIT 1024
#endif

/*
** We need to define _XOPEN_SOURCE as follows in order to enable
** recursive mutexes on most unix systems.  But Mac OS X is different.
** The _XOPEN_SOURCE define causes problems for Mac OS X we are told,
** so it is omitted there.  See ticket #2673.
**
** Later we learn that _XOPEN_SOURCE is poorly or incorrectly
** implemented on some systems.  So we avoid defining it at all
** if it is already defined or if it is unneeded because we are
** not doing a threadsafe build.  Ticket #2681.
**
** See also ticket #2741.
*/
#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) && SQLITE_THREADSAFE
#  define _XOPEN_SOURCE 500  /* Needed to enable pthread recursive mutexes */
#endif

#if defined(SQLITE_TCL) || defined(TCLSH)
# include <tcl.h>
#endif

/*
** Many people are failing to set -DNDEBUG=1 when compiling SQLite.
** Setting NDEBUG makes the code smaller and run faster.  So the following
** lines are added to automatically set NDEBUG unless the -DSQLITE_DEBUG=1
** option is set.  Thus NDEBUG becomes an opt-in rather than an opt-out
** feature.
*/
#if !defined(NDEBUG) && !defined(SQLITE_DEBUG) 
# define NDEBUG 1
#endif

#include "sqlite3.h"
#include "hash.h"
#include "parse.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stddef.h>

/*
** If compiling for a processor that lacks floating point support,
** substitute integer for floating-point
*/
#ifdef SQLITE_OMIT_FLOATING_POINT
# define double sqlite_int64
# define LONGDOUBLE_TYPE sqlite_int64
# ifndef SQLITE_BIG_DBL
#   define SQLITE_BIG_DBL (0x7fffffffffffffff)
# endif
# define SQLITE_OMIT_DATETIME_FUNCS 1
# define SQLITE_OMIT_TRACE 1
# undef SQLITE_MIXED_ENDIAN_64BIT_FLOAT
#endif
#ifndef SQLITE_BIG_DBL
# define SQLITE_BIG_DBL (1e99)
#endif

/*
** OMIT_TEMPDB is set to 1 if SQLITE_OMIT_TEMPDB is defined, or 0
** afterward. Having this macro allows us to cause the C compiler 
** to omit code used by TEMP tables without messy #ifndef statements.
*/
#ifdef SQLITE_OMIT_TEMPDB
#define OMIT_TEMPDB 1
#else
#define OMIT_TEMPDB 0
#endif

/*
** If the following macro is set to 1, then NULL values are considered
** distinct when determining whether or not two entries are the same
** in a UNIQUE index.  This is the way PostgreSQL, Oracle, DB2, MySQL,
** OCELOT, and Firebird all work.  The SQL92 spec explicitly says this
** is the way things are suppose to work.
**
** If the following macro is set to 0, the NULLs are indistinct for
** a UNIQUE index.  In this mode, you can only have a single NULL entry
** for a column declared UNIQUE.  This is the way Informix and SQL Server
** work.
*/
#define NULL_DISTINCT_FOR_UNIQUE 1

/*
** The "file format" number is an integer that is incremented whenever
** the VDBE-level file format changes.  The following macros define the
** the default file format for new databases and the maximum file format
** that the library can read.
*/
#define SQLITE_MAX_FILE_FORMAT 4
#ifndef SQLITE_DEFAULT_FILE_FORMAT
# define SQLITE_DEFAULT_FILE_FORMAT 1
#endif

/*
** Provide a default value for SQLITE_TEMP_STORE in case it is not specified
** on the command-line
*/
#ifndef SQLITE_TEMP_STORE
# define SQLITE_TEMP_STORE 1
#endif

/*
** GCC does not define the offsetof() macro so we'll have to do it
** ourselves.
*/
#ifndef offsetof
#define offsetof(STRUCTURE,FIELD) ((int)((char*)&((STRUCTURE*)0)->FIELD))
#endif

/*
** Check to see if this machine uses EBCDIC.  (Yes, believe it or
** not, there are still machines out there that use EBCDIC.)
*/
#if 'A' == '\301'
# define SQLITE_EBCDIC 1
#else
# define SQLITE_ASCII 1
#endif

/*
** Integers of known sizes.  These typedefs might change for architectures
** where the sizes very.  Preprocessor macros are available so that the
** types can be conveniently redefined at compile-type.  Like this:
**
**         cc '-DUINTPTR_TYPE=long long int' ...
*/
#ifndef UINT32_TYPE
# ifdef HAVE_UINT32_T
#  define UINT32_TYPE uint32_t
# else
#  define UINT32_TYPE unsigned int
# endif
#endif
#ifndef UINT16_TYPE
# ifdef HAVE_UINT16_T
#  define UINT16_TYPE uint16_t
# else
#  define UINT16_TYPE unsigned short int
# endif
#endif
#ifndef INT16_TYPE
# ifdef HAVE_INT16_T
#  define INT16_TYPE int16_t
# else
#  define INT16_TYPE short int
# endif
#endif
#ifndef UINT8_TYPE
# ifdef HAVE_UINT8_T
#  define UINT8_TYPE uint8_t
# else
#  define UINT8_TYPE unsigned char
# endif
#endif
#ifndef INT8_TYPE
# ifdef HAVE_INT8_T
#  define INT8_TYPE int8_t
# else
#  define INT8_TYPE signed char
# endif
#endif
#ifndef LONGDOUBLE_TYPE
# define LONGDOUBLE_TYPE long double
#endif
typedef sqlite_int64 i64;          /* 8-byte signed integer */
typedef sqlite_uint64 u64;         /* 8-byte unsigned integer */
typedef UINT32_TYPE u32;           /* 4-byte unsigned integer */
typedef UINT16_TYPE u16;           /* 2-byte unsigned integer */
typedef INT16_TYPE i16;            /* 2-byte signed integer */
typedef UINT8_TYPE u8;             /* 1-byte unsigned integer */
typedef UINT8_TYPE i8;             /* 1-byte signed integer */

/*
** Macros to determine whether the machine is big or little endian,
** evaluated at runtime.
*/
#ifdef SQLITE_AMALGAMATION
const int sqlite3one;
#else
extern const int sqlite3one;
#endif
#if defined(i386) || defined(__i386__) || defined(_M_IX86)
# define SQLITE_BIGENDIAN    0
# define SQLITE_LITTLEENDIAN 1
# define SQLITE_UTF16NATIVE  SQLITE_UTF16LE
#else
# define SQLITE_BIGENDIAN    (*(char *)(&sqlite3one)==0)
# define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1)
# define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE)
#endif

/*
** Constants for the largest and smallest possible 64-bit signed integers.
** These macros are designed to work correctly on both 32-bit and 64-bit
** compilers.
*/
#define LARGEST_INT64  (0xffffffff|(((i64)0x7fffffff)<<32))
#define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64)

/*
** An instance of the following structure is used to store the busy-handler
** callback for a given sqlite handle. 
**
** The sqlite.busyHandler member of the sqlite struct contains the busy
** callback for the database handle. Each pager opened via the sqlite
** handle is passed a pointer to sqlite.busyHandler. The busy-handler
** callback is currently invoked only from within pager.c.
*/
typedef struct BusyHandler BusyHandler;
struct BusyHandler {
  int (*xFunc)(void *,int);  /* The busy callback */
  void *pArg;                /* First arg to busy callback */
  int nBusy;                 /* Incremented with each busy call */
};

/*
** Name of the master database table.  The master database table
** is a special table that holds the names and attributes of all
** user tables and indices.
*/
#define MASTER_NAME       "sqlite_master"
#define TEMP_MASTER_NAME  "sqlite_temp_master"

/*
** The root-page of the master database table.
*/
#define MASTER_ROOT       1

/*
** The name of the schema table.
*/
#define SCHEMA_TABLE(x)  ((!OMIT_TEMPDB)&&(x==1)?TEMP_MASTER_NAME:MASTER_NAME)

/*
** A convenience macro that returns the number of elements in
** an array.
*/
#define ArraySize(X)    (sizeof(X)/sizeof(X[0]))

/*
** The following value as a destructor means to use sqlite3DbFree().
** This is an internal extension to SQLITE_STATIC and SQLITE_TRANSIENT.
*/
#define SQLITE_DYNAMIC   ((sqlite3_destructor_type)sqlite3DbFree)

/*
** Forward references to structures
*/
typedef struct AggInfo AggInfo;
typedef struct AuthContext AuthContext;
typedef struct Bitvec Bitvec;
typedef struct CollSeq CollSeq;
typedef struct Column Column;
typedef struct Db Db;
typedef struct Schema Schema;
typedef struct Expr Expr;
typedef struct ExprList ExprList;
typedef struct FKey FKey;
typedef struct FuncDef FuncDef;
typedef struct IdList IdList;
typedef struct Index Index;
typedef struct KeyClass KeyClass;
typedef struct KeyInfo KeyInfo;
typedef struct Lookaside Lookaside;
typedef struct LookasideSlot LookasideSlot;
typedef struct Module Module;
typedef struct NameContext NameContext;
typedef struct Parse Parse;
typedef struct Select Select;
typedef struct SrcList SrcList;
typedef struct StrAccum StrAccum;
typedef struct Table Table;
typedef struct TableLock TableLock;
typedef struct Token Token;
typedef struct TriggerStack TriggerStack;
typedef struct TriggerStep TriggerStep;
typedef struct Trigger Trigger;
typedef struct WhereInfo WhereInfo;
typedef struct WhereLevel WhereLevel;

/*
** Defer sourcing vdbe.h and btree.h until after the "u8" and 
** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque
** pointer types (i.e. FuncDef) defined above.
*/
#include "btree.h"
#include "vdbe.h"
#include "pager.h"

#include "os.h"
#include "mutex.h"


/*
** Each database file to be accessed by the system is an instance
** of the following structure.  There are normally two of these structures
** in the sqlite.aDb[] array.  aDb[0] is the main database file and
** aDb[1] is the database file used to hold temporary tables.  Additional
** databases may be attached.
*/
struct Db {
  char *zName;         /* Name of this database */
  Btree *pBt;          /* The B*Tree structure for this database file */
  u8 inTrans;          /* 0: not writable.  1: Transaction.  2: Checkpoint */
  u8 safety_level;     /* How aggressive at synching data to disk */
  void *pAux;               /* Auxiliary data.  Usually NULL */
  void (*xFreeAux)(void*);  /* Routine to free pAux */
  Schema *pSchema;     /* Pointer to database schema (possibly shared) */
};

/*
** An instance of the following structure stores a database schema.
**
** If there are no virtual tables configured in this schema, the
** Schema.db variable is set to NULL. After the first virtual table
** has been added, it is set to point to the database connection 
** used to create the connection. Once a virtual table has been
** added to the Schema structure and the Schema.db variable populated, 
** only that database connection may use the Schema to prepare 
** statements.
*/
struct Schema {
  int schema_cookie;   /* Database schema version number for this file */
  Hash tblHash;        /* All tables indexed by name */
  Hash idxHash;        /* All (named) indices indexed by name */
  Hash trigHash;       /* All triggers indexed by name */
  Hash aFKey;          /* Foreign keys indexed by to-table */
  Table *pSeqTab;      /* The sqlite_sequence table used by AUTOINCREMENT */
  u8 file_format;      /* Schema format version for this file */
  u8 enc;              /* Text encoding used by this database */
  u16 flags;           /* Flags associated with this schema */
  int cache_size;      /* Number of pages to use in the cache */
#ifndef SQLITE_OMIT_VIRTUALTABLE
  sqlite3 *db;         /* "Owner" connection. See comment above */
#endif
};

/*
** These macros can be used to test, set, or clear bits in the 
** Db.flags field.
*/
#define DbHasProperty(D,I,P)     (((D)->aDb[I].pSchema->flags&(P))==(P))
#define DbHasAnyProperty(D,I,P)  (((D)->aDb[I].pSchema->flags&(P))!=0)
#define DbSetProperty(D,I,P)     (D)->aDb[I].pSchema->flags|=(P)
#define DbClearProperty(D,I,P)   (D)->aDb[I].pSchema->flags&=~(P)

/*
** Allowed values for the DB.flags field.
**
** The DB_SchemaLoaded flag is set after the database schema has been
** read into internal hash tables.
**
** DB_UnresetViews means that one or more views have column names that
** have been filled out.  If the schema changes, these column names might
** changes and so the view will need to be reset.
*/
#define DB_SchemaLoaded    0x0001  /* The schema has been loaded */
#define DB_UnresetViews    0x0002  /* Some views have defined column names */
#define DB_Empty           0x0004  /* The file is empty (length 0 bytes) */

/*
** The number of different kinds of things that can be limited
** using the sqlite3_limit() interface.
*/
#define SQLITE_N_LIMIT (SQLITE_LIMIT_VARIABLE_NUMBER+1)

/*
** Lookaside malloc is a set of fixed-size buffers that can be used
** to satisify small transient memory allocation requests for objects
** associated with a particular database connection.  The use of
** lookaside malloc provides a significant performance enhancement
** (approx 10%) by avoiding numerous malloc/free requests while parsing
** SQL statements.
**
** The Lookaside structure holds configuration information about the
** lookaside malloc subsystem.  Each available memory allocation in
** the lookaside subsystem is stored on a linked list of LookasideSlot
** objects.
*/
struct Lookaside {
  u16 sz;                 /* Size of each buffer in bytes */
  u8 bEnabled;            /* True if use lookaside.  False to ignore it */
  u8 bMalloced;           /* True if pStart obtained from sqlite3_malloc() */
  int nOut;               /* Number of buffers currently checked out */
  int mxOut;              /* Highwater mark for nOut */
  LookasideSlot *pFree;   /* List if available buffers */
  void *pStart;           /* First byte of available memory space */
  void *pEnd;             /* First byte past end of available space */
};
struct LookasideSlot {
  LookasideSlot *pNext;    /* Next buffer in the list of free buffers */
};

/*
** Each database is an instance of the following structure.
**
** The sqlite.lastRowid records the last insert rowid generated by an
** insert statement.  Inserts on views do not affect its value.  Each
** trigger has its own context, so that lastRowid can be updated inside
** triggers as usual.  The previous value will be restored once the trigger
** exits.  Upon entering a before or instead of trigger, lastRowid is no
** longer (since after version 2.8.12) reset to -1.
**
** The sqlite.nChange does not count changes within triggers and keeps no
** context.  It is reset at start of sqlite3_exec.
** The sqlite.lsChange represents the number of changes made by the last
** insert, update, or delete statement.  It remains constant throughout the
** length of a statement and is then updated by OP_SetCounts.  It keeps a
** context stack just like lastRowid so that the count of changes
** within a trigger is not seen outside the trigger.  Changes to views do not
** affect the value of lsChange.
** The sqlite.csChange keeps track of the number of current changes (since
** the last statement) and is used to update sqlite_lsChange.
**
** The member variables sqlite.errCode, sqlite.zErrMsg and sqlite.zErrMsg16
** store the most recent error code and, if applicable, string. The
** internal function sqlite3Error() is used to set these variables
** consistently.
*/
struct sqlite3 {
  sqlite3_vfs *pVfs;            /* OS Interface */
  int nDb;                      /* Number of backends currently in use */
  Db *aDb;                      /* All backends */
  int flags;                    /* Miscellanous flags. See below */
  int openFlags;                /* Flags passed to sqlite3_vfs.xOpen() */
  int errCode;                  /* Most recent error code (SQLITE_*) */
  int errMask;                  /* & result codes with this before returning */
  u8 autoCommit;                /* The auto-commit flag. */
  u8 temp_store;                /* 1: file 2: memory 0: default */
  u8 mallocFailed;              /* True if we have seen a malloc failure */
  u8 dfltLockMode;              /* Default locking-mode for attached dbs */
  u8 dfltJournalMode;           /* Default journal mode for attached dbs */
  signed char nextAutovac;      /* Autovac setting after VACUUM if >=0 */
  int nextPagesize;             /* Pagesize after VACUUM if >0 */
  int nTable;                   /* Number of tables in the database */
  CollSeq *pDfltColl;           /* The default collating sequence (BINARY) */
  i64 lastRowid;                /* ROWID of most recent insert (see above) */
  i64 priorNewRowid;            /* Last randomly generated ROWID */
  int magic;                    /* Magic number for detect library misuse */
  int nChange;                  /* Value returned by sqlite3_changes() */
  int nTotalChange;             /* Value returned by sqlite3_total_changes() */
  sqlite3_mutex *mutex;         /* Connection mutex */
  int aLimit[SQLITE_N_LIMIT];   /* Limits */
  struct sqlite3InitInfo {      /* Information used during initialization */
    int iDb;                    /* When back is being initialized */
    int newTnum;                /* Rootpage of table being initialized */
    u8 busy;                    /* TRUE if currently initializing */
  } init;
  int nExtension;               /* Number of loaded extensions */
  void **aExtension;            /* Array of shared libraray handles */
  struct Vdbe *pVdbe;           /* List of active virtual machines */
  int activeVdbeCnt;            /* Number of vdbes currently executing */
  void (*xTrace)(void*,const char*);        /* Trace function */
  void *pTraceArg;                          /* Argument to the trace function */
  void (*xProfile)(void*,const char*,u64);  /* Profiling function */
  void *pProfileArg;                        /* Argument to profile function */
  void *pCommitArg;                 /* Argument to xCommitCallback() */   
  int (*xCommitCallback)(void*);    /* Invoked at every commit. */
  void *pRollbackArg;               /* Argument to xRollbackCallback() */   
  void (*xRollbackCallback)(void*); /* Invoked at every commit. */
  void *pUpdateArg;
  void (*xUpdateCallback)(void*,int, const char*,const char*,sqlite_int64);
  void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*);
  void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*);
  void *pCollNeededArg;
  sqlite3_value *pErr;          /* Most recent error message */
  char *zErrMsg;                /* Most recent error message (UTF-8 encoded) */
  char *zErrMsg16;              /* Most recent error message (UTF-16 encoded) */
  union {
    int isInterrupted;          /* True if sqlite3_interrupt has been called */
    double notUsed1;            /* Spacer */
  } u1;
  Lookaside lookaside;          /* Lookaside malloc configuration */
#ifndef SQLITE_OMIT_AUTHORIZATION
  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*);
                                /* Access authorization function */
  void *pAuthArg;               /* 1st argument to the access auth function */
#endif
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
  int (*xProgress)(void *);     /* The progress callback */
  void *pProgressArg;           /* Argument to the progress callback */
  int nProgressOps;             /* Number of opcodes for progress callback */
#endif
#ifndef SQLITE_OMIT_VIRTUALTABLE
  Hash aModule;                 /* populated by sqlite3_create_module() */
  Table *pVTab;                 /* vtab with active Connect/Create method */
  sqlite3_vtab **aVTrans;       /* Virtual tables with open transactions */
  int nVTrans;                  /* Allocated size of aVTrans */
#endif
  Hash aFunc;                   /* All functions that can be in SQL exprs */
  Hash aCollSeq;                /* All collating sequences */
  BusyHandler busyHandler;      /* Busy callback */
  int busyTimeout;              /* Busy handler timeout, in msec */
  Db aDbStatic[2];              /* Static space for the 2 default backends */
#ifdef SQLITE_SSE
  sqlite3_stmt *pFetch;         /* Used by SSE to fetch stored statements */
#endif
};

/*
** A macro to discover the encoding of a database.
*/
#define ENC(db) ((db)->aDb[0].pSchema->enc)

/*
** Possible values for the sqlite.flags and or Db.flags fields.
**
** On sqlite.flags, the SQLITE_InTrans value means that we have
** executed a BEGIN.  On Db.flags, SQLITE_InTrans means a statement
** transaction is active on that particular database file.
*/
#define SQLITE_VdbeTrace      0x00000001  /* True to trace VDBE execution */
#define SQLITE_InTrans        0x00000008  /* True if in a transaction */
#define SQLITE_InternChanges  0x00000010  /* Uncommitted Hash table changes */
#define SQLITE_FullColNames   0x00000020  /* Show full column names on SELECT */
#define SQLITE_ShortColNames  0x00000040  /* Show short columns names */
#define SQLITE_CountRows      0x00000080  /* Count rows changed by INSERT, */
                                          /*   DELETE, or UPDATE and return */
                                          /*   the count using a callback. */
#define SQLITE_NullCallback   0x00000100  /* Invoke the callback once if the */
                                          /*   result set is empty */
#define SQLITE_SqlTrace       0x00000200  /* Debug print SQL as it executes */
#define SQLITE_VdbeListing    0x00000400  /* Debug listings of VDBE programs */
#define SQLITE_WriteSchema    0x00000800  /* OK to update SQLITE_MASTER */
#define SQLITE_NoReadlock     0x00001000  /* Readlocks are omitted when 
                                          ** accessing read-only databases */
#define SQLITE_IgnoreChecks   0x00002000  /* Do not enforce check constraints */
#define SQLITE_ReadUncommitted 0x00004000 /* For shared-cache mode */
#define SQLITE_LegacyFileFmt  0x00008000  /* Create new databases in format 1 */
#define SQLITE_FullFSync      0x00010000  /* Use full fsync on the backend */
#define SQLITE_LoadExtension  0x00020000  /* Enable load_extension */

#define SQLITE_RecoveryMode   0x00040000  /* Ignore schema errors */
#define SQLITE_SharedCache    0x00080000  /* Cache sharing is enabled */
#define SQLITE_Vtab           0x00100000  /* There exists a virtual table */

/*
** Possible values for the sqlite.magic field.
** The numbers are obtained at random and have no special meaning, other
** than being distinct from one another.
*/
#define SQLITE_MAGIC_OPEN     0xa029a697  /* Database is open */
#define SQLITE_MAGIC_CLOSED   0x9f3c2d33  /* Database is closed */
#define SQLITE_MAGIC_SICK     0x4b771290  /* Error and awaiting close */
#define SQLITE_MAGIC_BUSY     0xf03b7906  /* Database currently in use */
#define SQLITE_MAGIC_ERROR    0xb5357930  /* An SQLITE_MISUSE error occurred */

/*
** Each SQL function is defined by an instance of the following
** structure.  A pointer to this structure is stored in the sqlite.aFunc
** hash table.  When multiple functions have the same name, the hash table
** points to a linked list of these structures.
*/
struct FuncDef {
  i16 nArg;            /* Number of arguments.  -1 means unlimited */
  u8 iPrefEnc;         /* Preferred text encoding (SQLITE_UTF8, 16LE, 16BE) */
  u8 needCollSeq;      /* True if sqlite3GetFuncCollSeq() might be called */
  u8 flags;            /* Some combination of SQLITE_FUNC_* */
  void *pUserData;     /* User data parameter */
  FuncDef *pNext;      /* Next function with same name */
  void (*xFunc)(sqlite3_context*,int,sqlite3_value**); /* Regular function */
  void (*xStep)(sqlite3_context*,int,sqlite3_value**); /* Aggregate step */
  void (*xFinalize)(sqlite3_context*);                /* Aggregate finializer */
  char zName[1];       /* SQL name of the function.  MUST BE LAST */
};

/*
** Each SQLite module (virtual table definition) is defined by an
** instance of the following structure, stored in the sqlite3.aModule
** hash table.
*/
struct Module {
  const sqlite3_module *pModule;       /* Callback pointers */
  const char *zName;                   /* Name passed to create_module() */
  void *pAux;                          /* pAux passed to create_module() */
  void (*xDestroy)(void *);            /* Module destructor function */
};

/*
** Possible values for FuncDef.flags
*/
#define SQLITE_FUNC_LIKE   0x01  /* Candidate for the LIKE optimization */
#define SQLITE_FUNC_CASE   0x02  /* Case-sensitive LIKE-type function */
#define SQLITE_FUNC_EPHEM  0x04  /* Ephermeral.  Delete with VDBE */

/*
** information about each column of an SQL table is held in an instance
** of this structure.
*/
struct Column {
  char *zName;     /* Name of this column */
  Expr *pDflt;     /* Default value of this column */
  char *zType;     /* Data type for this column */
  char *zColl;     /* Collating sequence.  If NULL, use the default */
  u8 notNull;      /* True if there is a NOT NULL constraint */
  u8 isPrimKey;    /* True if this column is part of the PRIMARY KEY */
  char affinity;   /* One of the SQLITE_AFF_... values */
#ifndef SQLITE_OMIT_VIRTUALTABLE
  u8 isHidden;     /* True if this column is 'hidden' */
#endif
};

/*
** A "Collating Sequence" is defined by an instance of the following
** structure. Conceptually, a collating sequence consists of a name and
** a comparison routine that defines the order of that sequence.
**
** There may two seperate implementations of the collation function, one
** that processes text in UTF-8 encoding (CollSeq.xCmp) and another that
** processes text encoded in UTF-16 (CollSeq.xCmp16), using the machine
** native byte order. When a collation sequence is invoked, SQLite selects
** the version that will require the least expensive encoding
** translations, if any.
**
** The CollSeq.pUser member variable is an extra parameter that passed in
** as the first argument to the UTF-8 comparison function, xCmp.
** CollSeq.pUser16 is the equivalent for the UTF-16 comparison function,
** xCmp16.
**
** If both CollSeq.xCmp and CollSeq.xCmp16 are NULL, it means that the
** collating sequence is undefined.  Indices built on an undefined
** collating sequence may not be read or written.
*/
struct CollSeq {
  char *zName;          /* Name of the collating sequence, UTF-8 encoded */
  u8 enc;               /* Text encoding handled by xCmp() */
  u8 type;              /* One of the SQLITE_COLL_... values below */
  void *pUser;          /* First argument to xCmp() */
  int (*xCmp)(void*,int, const void*, int, const void*);
  void (*xDel)(void*);  /* Destructor for pUser */
};

/*
** Allowed values of CollSeq flags:
*/
#define SQLITE_COLL_BINARY  1  /* The default memcmp() collating sequence */
#define SQLITE_COLL_NOCASE  2  /* The built-in NOCASE collating sequence */
#define SQLITE_COLL_REVERSE 3  /* The built-in REVERSE collating sequence */
#define SQLITE_COLL_USER    0  /* Any other user-defined collating sequence */

/*
** A sort order can be either ASC or DESC.
*/
#define SQLITE_SO_ASC       0  /* Sort in ascending order */
#define SQLITE_SO_DESC      1  /* Sort in ascending order */

/*
** Column affinity types.
**
** These used to have mnemonic name like 'i' for SQLITE_AFF_INTEGER and
** 't' for SQLITE_AFF_TEXT.  But we can save a little space and improve
** the speed a little by number the values consecutively.  
**
** But rather than start with 0 or 1, we begin with 'a'.  That way,
** when multiple affinity types are concatenated into a string and
** used as the P4 operand, they will be more readable.
**
** Note also that the numeric types are grouped together so that testing
** for a numeric type is a single comparison.
*/
#define SQLITE_AFF_TEXT     'a'
#define SQLITE_AFF_NONE     'b'
#define SQLITE_AFF_NUMERIC  'c'
#define SQLITE_AFF_INTEGER  'd'
#define SQLITE_AFF_REAL     'e'

#define sqlite3IsNumericAffinity(X)  ((X)>=SQLITE_AFF_NUMERIC)

/*
** The SQLITE_AFF_MASK values masks off the significant bits of an
** affinity value. 
*/
#define SQLITE_AFF_MASK     0x67

/*
** Additional bit values that can be ORed with an affinity without
** changing the affinity.
*/
#define SQLITE_JUMPIFNULL   0x08  /* jumps if either operand is NULL */
#define SQLITE_STOREP2      0x10  /* Store result in reg[P2] rather than jump */

/*
** Each SQL table is represented in memory by an instance of the
** following structure.
**
** Table.zName is the name of the table.  The case of the original
** CREATE TABLE statement is stored, but case is not significant for
** comparisons.
**
** Table.nCol is the number of columns in this table.  Table.aCol is a
** pointer to an array of Column structures, one for each column.
**
** If the table has an INTEGER PRIMARY KEY, then Table.iPKey is the index of
** the column that is that key.   Otherwise Table.iPKey is negative.  Note
** that the datatype of the PRIMARY KEY must be INTEGER for this field to
** be set.  An INTEGER PRIMARY KEY is used as the rowid for each row of
** the table.  If a table has no INTEGER PRIMARY KEY, then a random rowid
** is generated for each row of the table.  Table.hasPrimKey is true if
** the table has any PRIMARY KEY, INTEGER or otherwise.
**
** Table.tnum is the page number for the root BTree page of the table in the
** database file.  If Table.iDb is the index of the database table backend
** in sqlite.aDb[].  0 is for the main database and 1 is for the file that
** holds temporary tables and indices.  If Table.isEphem
** is true, then the table is stored in a file that is automatically deleted
** when the VDBE cursor to the table is closed.  In this case Table.tnum 
** refers VDBE cursor number that holds the table open, not to the root
** page number.  Transient tables are used to hold the results of a
** sub-query that appears instead of a real table name in the FROM clause 
** of a SELECT statement.
*/
struct Table {
  sqlite3 *db;     /* Associated database connection.  Might be NULL. */
  char *zName;     /* Name of the table */
  int nCol;        /* Number of columns in this table */
  Column *aCol;    /* Information about each column */
  int iPKey;       /* If not less then 0, use aCol[iPKey] as the primary key */
  Index *pIndex;   /* List of SQL indexes on this table. */
  int tnum;        /* Root BTree node for this table (see note above) */
  Select *pSelect; /* NULL for tables.  Points to definition if a view. */
  int nRef;          /* Number of pointers to this Table */
  Trigger *pTrigger; /* List of SQL triggers on this table */
  FKey *pFKey;       /* Linked list of all foreign keys in this table */
  char *zColAff;     /* String defining the affinity of each column */
#ifndef SQLITE_OMIT_CHECK
  Expr *pCheck;      /* The AND of all CHECK constraints */
#endif
#ifndef SQLITE_OMIT_ALTERTABLE
  int addColOffset;  /* Offset in CREATE TABLE statement to add a new column */
#endif
  u8 readOnly;     /* True if this table should not be written by the user */
  u8 isEphem;      /* True if created using OP_OpenEphermeral */
  u8 hasPrimKey;   /* True if there exists a primary key */
  u8 keyConf;      /* What to do in case of uniqueness conflict on iPKey */
  u8 autoInc;      /* True if the integer primary key is autoincrement */
#ifndef SQLITE_OMIT_VIRTUALTABLE
  u8 isVirtual;             /* True if this is a virtual table */
  u8 isCommit;              /* True once the CREATE TABLE has been committed */
  Module *pMod;             /* Pointer to the implementation of the module */
  sqlite3_vtab *pVtab;      /* Pointer to the module instance */
  int nModuleArg;           /* Number of arguments to the module */
  char **azModuleArg;       /* Text of all module args. [0] is module name */
#endif
  Schema *pSchema;          /* Schema that contains this table */
};

/*
** Test to see whether or not a table is a virtual table.  This is
** done as a macro so that it will be optimized out when virtual
** table support is omitted from the build.
*/
#ifndef SQLITE_OMIT_VIRTUALTABLE
#  define IsVirtual(X)      ((X)->isVirtual)
#  define IsHiddenColumn(X) ((X)->isHidden)
#else
#  define IsVirtual(X)      0
#  define IsHiddenColumn(X) 0
#endif

/*
** Each foreign key constraint is an instance of the following structure.
**
** A foreign key is associated with two tables.  The "from" table is
** the table that contains the REFERENCES clause that creates the foreign
** key.  The "to" table is the table that is named in the REFERENCES clause.
** Consider this example:
**
**     CREATE TABLE ex1(
**       a INTEGER PRIMARY KEY,
**       b INTEGER CONSTRAINT fk1 REFERENCES ex2(x)
**     );
**
** For foreign key "fk1", the from-table is "ex1" and the to-table is "ex2".
**
** Each REFERENCES clause generates an instance of the following structure
** which is attached to the from-table.  The to-table need not exist when
** the from-table is created.  The existance of the to-table is not checked
** until an attempt is made to insert data into the from-table.
**
** The sqlite.aFKey hash table stores pointers to this structure
** given the name of a to-table.  For each to-table, all foreign keys
** associated with that table are on a linked list using the FKey.pNextTo
** field.
*/
struct FKey {
  Table *pFrom;     /* The table that constains the REFERENCES clause */
  FKey *pNextFrom;  /* Next foreign key in pFrom */
  char *zTo;        /* Name of table that the key points to */
  FKey *pNextTo;    /* Next foreign key that points to zTo */
  int nCol;         /* Number of columns in this key */
  struct sColMap {  /* Mapping of columns in pFrom to columns in zTo */
    int iFrom;         /* Index of column in pFrom */
    char *zCol;        /* Name of column in zTo.  If 0 use PRIMARY KEY */
  } *aCol;          /* One entry for each of nCol column s */
  u8 isDeferred;    /* True if constraint checking is deferred till COMMIT */
  u8 updateConf;    /* How to resolve conflicts that occur on UPDATE */
  u8 deleteConf;    /* How to resolve conflicts that occur on DELETE */
  u8 insertConf;    /* How to resolve conflicts that occur on INSERT */
};

/*
** SQLite supports many different ways to resolve a constraint
** error.  ROLLBACK processing means that a constraint violation
** causes the operation in process to fail and for the current transaction
** to be rolled back.  ABORT processing means the operation in process
** fails and any prior changes from that one operation are backed out,
** but the transaction is not rolled back.  FAIL processing means that
** the operation in progress stops and returns an error code.  But prior
** changes due to the same operation are not backed out and no rollback
** occurs.  IGNORE means that the particular row that caused the constraint
** error is not inserted or updated.  Processing continues and no error
** is returned.  REPLACE means that preexisting database rows that caused
** a UNIQUE constraint violation are removed so that the new insert or
** update can proceed.  Processing continues and no error is reported.
**
** RESTRICT, SETNULL, and CASCADE actions apply only to foreign keys.
** RESTRICT is the same as ABORT for IMMEDIATE foreign keys and the
** same as ROLLBACK for DEFERRED keys.  SETNULL means that the foreign
** key is set to NULL.  CASCADE means that a DELETE or UPDATE of the
** referenced table row is propagated into the row that holds the
** foreign key.
** 
** The following symbolic values are used to record which type
** of action to take.
*/
#define OE_None     0   /* There is no constraint to check */
#define OE_Rollback 1   /* Fail the operation and rollback the transaction */
#define OE_Abort    2   /* Back out changes but do no rollback transaction */
#define OE_Fail     3   /* Stop the operation but leave all prior changes */
#define OE_Ignore   4   /* Ignore the error. Do not do the INSERT or UPDATE */
#define OE_Replace  5   /* Delete existing record, then do INSERT or UPDATE */

#define OE_Restrict 6   /* OE_Abort for IMMEDIATE, OE_Rollback for DEFERRED */
#define OE_SetNull  7   /* Set the foreign key value to NULL */
#define OE_SetDflt  8   /* Set the foreign key value to its default */
#define OE_Cascade  9   /* Cascade the changes */

#define OE_Default  99  /* Do whatever the default action is */


/*
** An instance of the following structure is passed as the first
** argument to sqlite3VdbeKeyCompare and is used to control the 
** comparison of the two index keys.
**
** If the KeyInfo.incrKey value is true and the comparison would
** otherwise be equal, then return a result as if the second key
** were larger.
*/
struct KeyInfo {
  sqlite3 *db;        /* The database connection */
  u8 enc;             /* Text encoding - one of the TEXT_Utf* values */
  u8 incrKey;         /* Increase 2nd key by epsilon before comparison */
  u8 prefixIsEqual;   /* Treat a prefix as equal */
  int nField;         /* Number of entries in aColl[] */
  u8 *aSortOrder;     /* If defined an aSortOrder[i] is true, sort DESC */
  CollSeq *aColl[1];  /* Collating sequence for each term of the key */
};

/*
** Each SQL index is represented in memory by an
** instance of the following structure.
**
** The columns of the table that are to be indexed are described
** by the aiColumn[] field of this structure.  For example, suppose
** we have the following table and index:
**
**     CREATE TABLE Ex1(c1 int, c2 int, c3 text);
**     CREATE INDEX Ex2 ON Ex1(c3,c1);
**
** In the Table structure describing Ex1, nCol==3 because there are
** three columns in the table.  In the Index structure describing
** Ex2, nColumn==2 since 2 of the 3 columns of Ex1 are indexed.
** The value of aiColumn is {2, 0}.  aiColumn[0]==2 because the 
** first column to be indexed (c3) has an index of 2 in Ex1.aCol[].
** The second column to be indexed (c1) has an index of 0 in
** Ex1.aCol[], hence Ex2.aiColumn[1]==0.
**
** The Index.onError field determines whether or not the indexed columns
** must be unique and what to do if they are not.  When Index.onError=OE_None,
** it means this is not a unique index.  Otherwise it is a unique index
** and the value of Index.onError indicate the which conflict resolution 
** algorithm to employ whenever an attempt is made to insert a non-unique
** element.
*/
struct Index {
  char *zName;     /* Name of this index */
  int nColumn;     /* Number of columns in the table used by this index */
  int *aiColumn;   /* Which columns are used by this index.  1st is 0 */
  unsigned *aiRowEst; /* Result of ANALYZE: Est. rows selected by each column */
  Table *pTable;   /* The SQL table being indexed */
  int tnum;        /* Page containing root of this index in database file */
  u8 onError;      /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */
  u8 autoIndex;    /* True if is automatically created (ex: by UNIQUE) */
  char *zColAff;   /* String defining the affinity of each column */
  Index *pNext;    /* The next index associated with the same table */
  Schema *pSchema; /* Schema containing this index */
  u8 *aSortOrder;  /* Array of size Index.nColumn. True==DESC, False==ASC */
  char **azColl;   /* Array of collation sequence names for index */
};

/*
** Each token coming out of the lexer is an instance of
** this structure.  Tokens are also used as part of an expression.
**
** Note if Token.z==0 then Token.dyn and Token.n are undefined and
** may contain random values.  Do not make any assuptions about Token.dyn
** and Token.n when Token.z==0.
*/
struct Token {
  const unsigned char *z; /* Text of the token.  Not NULL-terminated! */
  unsigned dyn  : 1;      /* True for malloced memory, false for static */
  unsigned n    : 31;     /* Number of characters in this token */
};

/*
** An instance of this structure contains information needed to generate
** code for a SELECT that contains aggregate functions.
**
** If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a
** pointer to this structure.  The Expr.iColumn field is the index in
** AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate
** code for that node.
**
** AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the
** original Select structure that describes the SELECT statement.  These
** fields do not need to be freed when deallocating the AggInfo structure.
*/
struct AggInfo {
  u8 directMode;          /* Direct rendering mode means take data directly
                          ** from source tables rather than from accumulators */
  u8 useSortingIdx;       /* In direct mode, reference the sorting index rather
                          ** than the source table */
  int sortingIdx;         /* Cursor number of the sorting index */
  ExprList *pGroupBy;     /* The group by clause */
  int nSortingColumn;     /* Number of columns in the sorting index */
  struct AggInfo_col {    /* For each column used in source tables */
    Table *pTab;             /* Source table */
    int iTable;              /* Cursor number of the source table */
    int iColumn;             /* Column number within the source table */
    int iSorterColumn;       /* Column number in the sorting index */
    int iMem;                /* Memory location that acts as accumulator */
    Expr *pExpr;             /* The original expression */
  } *aCol;
  int nColumn;            /* Number of used entries in aCol[] */
  int nColumnAlloc;       /* Number of slots allocated for aCol[] */
  int nAccumulator;       /* Number of columns that show through to the output.
                          ** Additional columns are used only as parameters to
                          ** aggregate functions */
  struct AggInfo_func {   /* For each aggregate function */
    Expr *pExpr;             /* Expression encoding the function */
    FuncDef *pFunc;          /* The aggregate function implementation */
    int iMem;                /* Memory location that acts as accumulator */
    int iDistinct;           /* Ephermeral table used to enforce DISTINCT */
  } *aFunc;
  int nFunc;              /* Number of entries in aFunc[] */
  int nFuncAlloc;         /* Number of slots allocated for aFunc[] */
};

/*
** Each node of an expression in the parse tree is an instance
** of this structure.
**
** Expr.op is the opcode.  The integer parser token codes are reused
** as opcodes here.  For example, the parser defines TK_GE to be an integer
** code representing the ">=" operator.  This same integer code is reused
** to represent the greater-than-or-equal-to operator in the expression
** tree.
**
** Expr.pRight and Expr.pLeft are subexpressions.  Expr.pList is a list
** of argument if the expression is a function.
**
** Expr.token is the operator token for this node.  For some expressions
** that have subexpressions, Expr.token can be the complete text that gave
** rise to the Expr.  In the latter case, the token is marked as being
** a compound token.
**
** An expression of the form ID or ID.ID refers to a column in a table.
** For such expressions, Expr.op is set to TK_COLUMN and Expr.iTable is
** the integer cursor number of a VDBE cursor pointing to that table and
** Expr.iColumn is the column number for the specific column.  If the
** expression is used as a result in an aggregate SELECT, then the
** value is also stored in the Expr.iAgg column in the aggregate so that
** it can be accessed after all aggregates are computed.
**
** If the expression is a function, the Expr.iTable is an integer code
** representing which function.  If the expression is an unbound variable
** marker (a question mark character '?' in the original SQL) then the
** Expr.iTable holds the index number for that variable.
**
** If the expression is a subquery then Expr.iColumn holds an integer
** register number containing the result of the subquery.  If the
** subquery gives a constant result, then iTable is -1.  If the subquery
** gives a different answer at different times during statement processing
** then iTable is the address of a subroutine that computes the subquery.
**
** The Expr.pSelect field points to a SELECT statement.  The SELECT might
** be the right operand of an IN operator.  Or, if a scalar SELECT appears
** in an expression the opcode is TK_SELECT and Expr.pSelect is the only
** operand.
**
** If the Expr is of type OP_Column, and the table it is selecting from
** is a disk table or the "old.*" pseudo-table, then pTab points to the
** corresponding table definition.
*/
struct Expr {
  u8 op;                 /* Operation performed by this node */
  char affinity;         /* The affinity of the column or 0 if not a column */
  u16 flags;             /* Various flags.  See below */
  CollSeq *pColl;        /* The collation type of the column or 0 */
  Expr *pLeft, *pRight;  /* Left and right subnodes */
  ExprList *pList;       /* A list of expressions used as function arguments
                         ** or in "<expr> IN (<expr-list)" */
  Token token;           /* An operand token */
  Token span;            /* Complete text of the expression */
  int iTable, iColumn;   /* When op==TK_COLUMN, then this expr node means the
                         ** iColumn-th field of the iTable-th table. */
  AggInfo *pAggInfo;     /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */
  int iAgg;              /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
  int iRightJoinTable;   /* If EP_FromJoin, the right table of the join */
  Select *pSelect;       /* When the expression is a sub-select.  Also the
                         ** right side of "<expr> IN (<select>)" */
  Table *pTab;           /* Table for OP_Column expressions. */
#if SQLITE_MAX_EXPR_DEPTH>0
  int nHeight;           /* Height of the tree headed by this node */
#endif
};

/*
** The following are the meanings of bits in the Expr.flags field.
*/
#define EP_FromJoin   0x0001  /* Originated in ON or USING clause of a join */
#define EP_Agg        0x0002  /* Contains one or more aggregate functions */
#define EP_Resolved   0x0004  /* IDs have been resolved to COLUMNs */
#define EP_Error      0x0008  /* Expression contains one or more errors */
#define EP_Distinct   0x0010  /* Aggregate function with DISTINCT keyword */
#define EP_VarSelect  0x0020  /* pSelect is correlated, not constant */
#define EP_Dequoted   0x0040  /* True if the string has been dequoted */
#define EP_InfixFunc  0x0080  /* True for an infix function: LIKE, GLOB, etc */
#define EP_ExpCollate 0x0100  /* Collating sequence specified explicitly */
#define EP_AnyAff     0x0200  /* Can take a cached column of any affinity */
#define EP_FixedDest  0x0400  /* Result needed in a specific register */
#define EP_IntValue   0x0800  /* Integer value contained in iTable */
/*
** These macros can be used to test, set, or clear bits in the 
** Expr.flags field.
*/
#define ExprHasProperty(E,P)     (((E)->flags&(P))==(P))
#define ExprHasAnyProperty(E,P)  (((E)->flags&(P))!=0)
#define ExprSetProperty(E,P)     (E)->flags|=(P)
#define ExprClearProperty(E,P)   (E)->flags&=~(P)

/*
** A list of expressions.  Each expression may optionally have a
** name.  An expr/name combination can be used in several ways, such
** as the list of "expr AS ID" fields following a "SELECT" or in the
** list of "ID = expr" items in an UPDATE.  A list of expressions can
** also be used as the argument to a function, in which case the a.zName
** field is not used.
*/
struct ExprList {
  int nExpr;             /* Number of expressions on the list */
  int nAlloc;            /* Number of entries allocated below */
  int iECursor;          /* VDBE Cursor associated with this ExprList */
  struct ExprList_item {
    Expr *pExpr;           /* The list of expressions */
    char *zName;           /* Token associated with this expression */
    u8 sortOrder;          /* 1 for DESC or 0 for ASC */
    u8 isAgg;              /* True if this is an aggregate like count(*) */
    u8 done;               /* A flag to indicate when processing is finished */
  } *a;                  /* One entry for each expression */
};

/*
** An instance of this structure can hold a simple list of identifiers,
** such as the list "a,b,c" in the following statements:
**
**      INSERT INTO t(a,b,c) VALUES ...;
**      CREATE INDEX idx ON t(a,b,c);
**      CREATE TRIGGER trig BEFORE UPDATE ON t(a,b,c) ...;
**
** The IdList.a.idx field is used when the IdList represents the list of
** column names after a table name in an INSERT statement.  In the statement
**
**     INSERT INTO t(a,b,c) ...
**
** If "a" is the k-th column of table "t", then IdList.a[0].idx==k.
*/
struct IdList {
  struct IdList_item {
    char *zName;      /* Name of the identifier */
    int idx;          /* Index in some Table.aCol[] of a column named zName */
  } *a;
  int nId;         /* Number of identifiers on the list */
  int nAlloc;      /* Number of entries allocated for a[] below */
};

/*
** The bitmask datatype defined below is used for various optimizations.
**
** Changing this from a 64-bit to a 32-bit type limits the number of
** tables in a join to 32 instead of 64.  But it also reduces the size
** of the library by 738 bytes on ix86.
*/
typedef u64 Bitmask;

/*
** The following structure describes the FROM clause of a SELECT statement.
** Each table or subquery in the FROM clause is a separate element of
** the SrcList.a[] array.
**
** With the addition of multiple database support, the following structure
** can also be used to describe a particular table such as the table that
** is modified by an INSERT, DELETE, or UPDATE statement.  In standard SQL,
** such a table must be a simple name: ID.  But in SQLite, the table can
** now be identified by a database name, a dot, then the table name: ID.ID.
**
** The jointype starts out showing the join type between the current table
** and the next table on the list.  The parser builds the list this way.
** But sqlite3SrcListShiftJoinType() later shifts the jointypes so that each
** jointype expresses the join between the table and the previous table.
*/
struct SrcList {
  i16 nSrc;        /* Number of tables or subqueries in the FROM clause */
  i16 nAlloc;      /* Number of entries allocated in a[] below */
  struct SrcList_item {
    char *zDatabase;  /* Name of database holding this table */
    char *zName;      /* Name of the table */
    char *zAlias;     /* The "B" part of a "A AS B" phrase.  zName is the "A" */
    Table *pTab;      /* An SQL table corresponding to zName */
    Select *pSelect;  /* A SELECT statement used in place of a table name */
    u8 isPopulated;   /* Temporary table associated with SELECT is populated */
    u8 jointype;      /* Type of join between this able and the previous */
    int iCursor;      /* The VDBE cursor number used to access this table */
    Expr *pOn;        /* The ON clause of a join */
    IdList *pUsing;   /* The USING clause of a join */
    Bitmask colUsed;  /* Bit N (1<<N) set if column N or pTab is used */
  } a[1];             /* One entry for each identifier on the list */
};

/*
** Permitted values of the SrcList.a.jointype field
*/
#define JT_INNER     0x0001    /* Any kind of inner or cross join */
#define JT_CROSS     0x0002    /* Explicit use of the CROSS keyword */
#define JT_NATURAL   0x0004    /* True for a "natural" join */
#define JT_LEFT      0x0008    /* Left outer join */
#define JT_RIGHT     0x0010    /* Right outer join */
#define JT_OUTER     0x0020    /* The "OUTER" keyword is present */
#define JT_ERROR     0x0040    /* unknown or unsupported join type */

/*
** For each nested loop in a WHERE clause implementation, the WhereInfo
** structure contains a single instance of this structure.  This structure
** is intended to be private the the where.c module and should not be
** access or modified by other modules.
**
** The pIdxInfo and pBestIdx fields are used to help pick the best
** index on a virtual table.  The pIdxInfo pointer contains indexing
** information for the i-th table in the FROM clause before reordering.
** All the pIdxInfo pointers are freed by whereInfoFree() in where.c.
** The pBestIdx pointer is a copy of pIdxInfo for the i-th table after
** FROM clause ordering.  This is a little confusing so I will repeat
** it in different words.  WhereInfo.a[i].pIdxInfo is index information 
** for WhereInfo.pTabList.a[i].  WhereInfo.a[i].pBestInfo is the
** index information for the i-th loop of the join.  pBestInfo is always
** either NULL or a copy of some pIdxInfo.  So for cleanup it is 
** sufficient to free all of the pIdxInfo pointers.
** 
*/
struct WhereLevel {
  int iFrom;            /* Which entry in the FROM clause */
  int flags;            /* Flags associated with this level */
  int iMem;             /* First memory cell used by this level */
  int iLeftJoin;        /* Memory cell used to implement LEFT OUTER JOIN */
  Index *pIdx;          /* Index used.  NULL if no index */
  int iTabCur;          /* The VDBE cursor used to access the table */
  int iIdxCur;          /* The VDBE cursor used to acesss pIdx */
  int brk;              /* Jump here to break out of the loop */
  int nxt;              /* Jump here to start the next IN combination */
  int cont;             /* Jump here to continue with the next loop cycle */
  int top;              /* First instruction of interior of the loop */
  int op, p1, p2;       /* Opcode used to terminate the loop */
  int nEq;              /* Number of == or IN constraints on this loop */
  int nIn;              /* Number of IN operators constraining this loop */
  struct InLoop {
    int iCur;              /* The VDBE cursor used by this IN operator */
    int topAddr;           /* Top of the IN loop */
  } *aInLoop;           /* Information about each nested IN operator */
  sqlite3_index_info *pBestIdx;  /* Index information for this level */

  /* The following field is really not part of the current level.  But
  ** we need a place to cache index information for each table in the
  ** FROM clause and the WhereLevel structure is a convenient place.
  */
  sqlite3_index_info *pIdxInfo;  /* Index info for n-th source table */
};

/*
** Flags appropriate for the wflags parameter of sqlite3WhereBegin().
*/
#define WHERE_ORDERBY_NORMAL     0   /* No-op */
#define WHERE_ORDERBY_MIN        1   /* ORDER BY processing for min() func */
#define WHERE_ORDERBY_MAX        2   /* ORDER BY processing for max() func */
#define WHERE_ONEPASS_DESIRED    4   /* Want to do one-pass UPDATE/DELETE */

/*
** The WHERE clause processing routine has two halves.  The
** first part does the start of the WHERE loop and the second
** half does the tail of the WHERE loop.  An instance of
** this structure is returned by the first half and passed
** into the second half to give some continuity.
*/
struct WhereInfo {
  Parse *pParse;       /* Parsing and code generating context */
  u8 okOnePass;        /* Ok to use one-pass algorithm for UPDATE or DELETE */
  SrcList *pTabList;   /* List of tables in the join */
  int iTop;            /* The very beginning of the WHERE loop */
  int iContinue;       /* Jump here to continue with next record */
  int iBreak;          /* Jump here to break out of the loop */
  int nLevel;          /* Number of nested loop */
  sqlite3_index_info **apInfo;  /* Array of pointers to index info structures */
  WhereLevel a[1];     /* Information about each nest loop in the WHERE */
};

/*
** A NameContext defines a context in which to resolve table and column
** names.  The context consists of a list of tables (the pSrcList) field and
** a list of named expression (pEList).  The named expression list may
** be NULL.  The pSrc corresponds to the FROM clause of a SELECT or
** to the table being operated on by INSERT, UPDATE, or DELETE.  The
** pEList corresponds to the result set of a SELECT and is NULL for
** other statements.
**
** NameContexts can be nested.  When resolving names, the inner-most 
** context is searched first.  If no match is found, the next outer
** context is checked.  If there is still no match, the next context
** is checked.  This process continues until either a match is found
** or all contexts are check.  When a match is found, the nRef member of
** the context containing the match is incremented. 
**
** Each subquery gets a new NameContext.  The pNext field points to the
** NameContext in the parent query.  Thus the process of scanning the
** NameContext list corresponds to searching through successively outer
** subqueries looking for a match.
*/
struct NameContext {
  Parse *pParse;       /* The parser */
  SrcList *pSrcList;   /* One or more tables used to resolve names */
  ExprList *pEList;    /* Optional list of named expressions */
  int nRef;            /* Number of names resolved by this context */
  int nErr;            /* Number of errors encountered while resolving names */
  u8 allowAgg;         /* Aggregate functions allowed here */
  u8 hasAgg;           /* True if aggregates are seen */
  u8 isCheck;          /* True if resolving names in a CHECK constraint */
  int nDepth;          /* Depth of subquery recursion. 1 for no recursion */
  AggInfo *pAggInfo;   /* Information about aggregates at this level */
  NameContext *pNext;  /* Next outer name context.  NULL for outermost */
};

/*
** An instance of the following structure contains all information
** needed to generate code for a single SELECT statement.
**
** nLimit is set to -1 if there is no LIMIT clause.  nOffset is set to 0.
** If there is a LIMIT clause, the parser sets nLimit to the value of the
** limit and nOffset to the value of the offset (or 0 if there is not
** offset).  But later on, nLimit and nOffset become the memory locations
** in the VDBE that record the limit and offset counters.
**
** addrOpenEphm[] entries contain the address of OP_OpenEphemeral opcodes.
** These addresses must be stored so that we can go back and fill in
** the P4_KEYINFO and P2 parameters later.  Neither the KeyInfo nor
** the number of columns in P2 can be computed at the same time
** as the OP_OpenEphm instruction is coded because not
** enough information about the compound query is known at that point.
** The KeyInfo for addrOpenTran[0] and [1] contains collating sequences
** for the result set.  The KeyInfo for addrOpenTran[2] contains collating
** sequences for the ORDER BY clause.
*/
struct Select {
  ExprList *pEList;      /* The fields of the result */
  u8 op;                 /* One of: TK_UNION TK_ALL TK_INTERSECT TK_EXCEPT */
  u8 isDistinct;         /* True if the DISTINCT keyword is present */
  u8 isResolved;         /* True once sqlite3SelectResolve() has run. */
  u8 isAgg;              /* True if this is an aggregate query */
  u8 usesEphm;           /* True if uses an OpenEphemeral opcode */
  u8 disallowOrderBy;    /* Do not allow an ORDER BY to be attached if TRUE */
  char affinity;         /* MakeRecord with this affinity for SRT_Set */
  SrcList *pSrc;         /* The FROM clause */
  Expr *pWhere;          /* The WHERE clause */
  ExprList *pGroupBy;    /* The GROUP BY clause */
  Expr *pHaving;         /* The HAVING clause */
  ExprList *pOrderBy;    /* The ORDER BY clause */
  Select *pPrior;        /* Prior select in a compound select statement */
  Select *pNext;         /* Next select to the left in a compound */
  Select *pRightmost;    /* Right-most select in a compound select statement */
  Expr *pLimit;          /* LIMIT expression. NULL means not used. */
  Expr *pOffset;         /* OFFSET expression. NULL means not used. */
  int iLimit, iOffset;   /* Memory registers holding LIMIT & OFFSET counters */
  int addrOpenEphm[3];   /* OP_OpenEphem opcodes related to this select */
};

/*
** The results of a select can be distributed in several ways.
*/
#define SRT_Union        1  /* Store result as keys in an index */
#define SRT_Except       2  /* Remove result from a UNION index */
#define SRT_Exists       3  /* Store 1 if the result is not empty */
#define SRT_Discard      4  /* Do not save the results anywhere */

/* The ORDER BY clause is ignored for all of the above */
#define IgnorableOrderby(X) ((X->eDest)<=SRT_Discard)

#define SRT_Callback     5  /* Invoke a callback with each row of result */
#define SRT_Mem          6  /* Store result in a memory cell */
#define SRT_Set          7  /* Store results as keys in an index */
#define SRT_Table        8  /* Store result as data with an automatic rowid */
#define SRT_EphemTab     9  /* Create transient tab and store like SRT_Table */
#define SRT_Coroutine   10  /* Generate a single row of result */

/*
** A structure used to customize the behaviour of sqlite3Select(). See
** comments above sqlite3Select() for details.
*/
typedef struct SelectDest SelectDest;
struct SelectDest {
  u8 eDest;         /* How to dispose of the results */
  u8 affinity;      /* Affinity used when eDest==SRT_Set */
  int iParm;        /* A parameter used by the eDest disposal method */
  int iMem;         /* Base register where results are written */
  int nMem;         /* Number of registers allocated */
};

/*
** An SQL parser context.  A copy of this structure is passed through
** the parser and down into all the parser action routine in order to
** carry around information that is global to the entire parse.
**
** The structure is divided into two parts.  When the parser and code
** generate call themselves recursively, the first part of the structure
** is constant but the second part is reset at the beginning and end of
** each recursion.
**
** The nTableLock and aTableLock variables are only used if the shared-cache 
** feature is enabled (if sqlite3Tsd()->useSharedData is true). They are
** used to store the set of table-locks required by the statement being
** compiled. Function sqlite3TableLock() is used to add entries to the
** list.
*/
struct Parse {
  sqlite3 *db;         /* The main database structure */
  int rc;              /* Return code from execution */
  char *zErrMsg;       /* An error message */
  Vdbe *pVdbe;         /* An engine for executing database bytecode */
  u8 colNamesSet;      /* TRUE after OP_ColumnName has been issued to pVdbe */
  u8 nameClash;        /* A permanent table name clashes with temp table name */
  u8 checkSchema;      /* Causes schema cookie check after an error */
  u8 nested;           /* Number of nested calls to the parser/code generator */
  u8 parseError;       /* True after a parsing error.  Ticket #1794 */
  u8 nTempReg;         /* Number of temporary registers in aTempReg[] */
  u8 nTempInUse;       /* Number of aTempReg[] currently checked out */
  int aTempReg[8];     /* Holding area for temporary registers */
  int nRangeReg;       /* Size of the temporary register block */
  int iRangeReg;       /* First register in temporary register block */
  int nErr;            /* Number of errors seen */
  int nTab;            /* Number of previously allocated VDBE cursors */
  int nMem;            /* Number of memory cells used so far */
  int nSet;            /* Number of sets used so far */
  int ckBase;          /* Base register of data during check constraints */
  int disableColCache; /* True to disable adding to column cache */
  int nColCache;       /* Number of entries in the column cache */
  int iColCache;       /* Next entry of the cache to replace */
  struct yColCache {
    int iTable;           /* Table cursor number */
    int iColumn;          /* Table column number */
    char affChange;       /* True if this register has had an affinity change */
    int iReg;             /* Register holding value of this column */
  } aColCache[10];     /* One for each valid column cache entry */
  u32 writeMask;       /* Start a write transaction on these databases */
  u32 cookieMask;      /* Bitmask of schema verified databases */
  int cookieGoto;      /* Address of OP_Goto to cookie verifier subroutine */
  int cookieValue[SQLITE_MAX_ATTACHED+2];  /* Values of cookies to verify */
#ifndef SQLITE_OMIT_SHARED_CACHE
  int nTableLock;        /* Number of locks in aTableLock */
  TableLock *aTableLock; /* Required table locks for shared-cache mode */
#endif
  int regRowid;        /* Register holding rowid of CREATE TABLE entry */
  int regRoot;         /* Register holding root page number for new objects */

  /* 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 */
  u8 explain;          /* True if the EXPLAIN flag is found on the query */
  Token sErrToken;     /* The token at which the error occurred */
  Token sNameToken;    /* Token with unqualified schema object name */
  Token sLastToken;    /* The last token parsed */
  const char *zSql;    /* All SQL text */
  const char *zTail;   /* All SQL text past the last semicolon parsed */
  Table *pNewTable;    /* A table being constructed by CREATE TABLE */
  Trigger *pNewTrigger;     /* Trigger under construct by a CREATE TRIGGER */
  TriggerStack *trigStack;  /* Trigger actions being coded */
  const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */
#ifndef SQLITE_OMIT_VIRTUALTABLE
  Token sArg;                /* Complete text of a module argument */
  u8 declareVtab;            /* True if inside sqlite3_declare_vtab() */
  int nVtabLock;             /* Number of virtual tables to lock */
  Table **apVtabLock;        /* Pointer to virtual tables needing locking */
#endif
  int nHeight;            /* Expression tree height of current sub-select */
};

#ifdef SQLITE_OMIT_VIRTUALTABLE
  #define IN_DECLARE_VTAB 0
#else
  #define IN_DECLARE_VTAB (pParse->declareVtab)
#endif

/*
** An instance of the following structure can be declared on a stack and used
** to save the Parse.zAuthContext value so that it can be restored later.
*/
struct AuthContext {
  const char *zAuthContext;   /* Put saved Parse.zAuthContext here */
  Parse *pParse;              /* The Parse structure */
};

/*
** Bitfield flags for P2 value in OP_Insert and OP_Delete
*/
#define OPFLAG_NCHANGE   1    /* Set to update db->nChange */
#define OPFLAG_LASTROWID 2    /* Set to update db->lastRowid */
#define OPFLAG_ISUPDATE  4    /* This OP_Insert is an sql UPDATE */
#define OPFLAG_APPEND    8    /* This is likely to be an append */

/*
 * Each trigger present in the database schema is stored as an instance of
 * struct Trigger. 
 *
 * Pointers to instances of struct Trigger are stored in two ways.
 * 1. In the "trigHash" hash table (part of the sqlite3* that represents the 
 *    database). This allows Trigger structures to be retrieved by name.
 * 2. All triggers associated with a single table form a linked list, using the
 *    pNext member of struct Trigger. A pointer to the first element of the
 *    linked list is stored as the "pTrigger" member of the associated
 *    struct Table.
 *
 * The "step_list" member points to the first element of a linked list
 * containing the SQL statements specified as the trigger program.
 */
struct Trigger {
  char *name;             /* The name of the trigger                        */
  char *table;            /* The table or view to which the trigger applies */
  u8 op;                  /* One of TK_DELETE, TK_UPDATE, TK_INSERT         */
  u8 tr_tm;               /* One of TRIGGER_BEFORE, TRIGGER_AFTER */
  Expr *pWhen;            /* The WHEN clause of the expresion (may be NULL) */
  IdList *pColumns;       /* If this is an UPDATE OF <column-list> trigger,
                             the <column-list> is stored here */
  Token nameToken;        /* Token containing zName. Use during parsing only */
  Schema *pSchema;        /* Schema containing the trigger */
  Schema *pTabSchema;     /* Schema containing the table */
  TriggerStep *step_list; /* Link list of trigger program steps             */
  Trigger *pNext;         /* Next trigger associated with the table */
};

/*
** A trigger is either a BEFORE or an AFTER trigger.  The following constants
** determine which. 
**
** If there are multiple triggers, you might of some BEFORE and some AFTER.
** In that cases, the constants below can be ORed together.
*/
#define TRIGGER_BEFORE  1
#define TRIGGER_AFTER   2

/*
 * An instance of struct TriggerStep is used to store a single SQL statement
 * that is a part of a trigger-program. 
 *
 * Instances of struct TriggerStep are stored in a singly linked list (linked
 * using the "pNext" member) referenced by the "step_list" member of the 
 * associated struct Trigger instance. The first element of the linked list is
 * the first step of the trigger-program.
 * 
 * The "op" member indicates whether this is a "DELETE", "INSERT", "UPDATE" or
 * "SELECT" statement. The meanings of the other members is determined by the 
 * value of "op" as follows:
 *
 * (op == TK_INSERT)
 * orconf    -> stores the ON CONFLICT algorithm
 * pSelect   -> If this is an INSERT INTO ... SELECT ... statement, then
 *              this stores a pointer to the SELECT statement. Otherwise NULL.
 * target    -> A token holding the name of the table to insert into.
 * pExprList -> If this is an INSERT INTO ... VALUES ... statement, then
 *              this stores values to be inserted. Otherwise NULL.
 * pIdList   -> If this is an INSERT INTO ... (<column-names>) VALUES ... 
 *              statement, then this stores the column-names to be
 *              inserted into.
 *
 * (op == TK_DELETE)
 * target    -> A token holding the name of the table to delete from.
 * pWhere    -> The WHERE clause of the DELETE statement if one is specified.
 *              Otherwise NULL.
 * 
 * (op == TK_UPDATE)
 * target    -> A token holding the name of the table to update rows of.
 * pWhere    -> The WHERE clause of the UPDATE statement if one is specified.
 *              Otherwise NULL.
 * pExprList -> A list of the columns to update and the expressions to update
 *              them to. See sqlite3Update() documentation of "pChanges"
 *              argument.
 * 
 */
struct TriggerStep {
  int op;              /* One of TK_DELETE, TK_UPDATE, TK_INSERT, TK_SELECT */
  int orconf;          /* OE_Rollback etc. */
  Trigger *pTrig;      /* The trigger that this step is a part of */

  Select *pSelect;     /* Valid for SELECT and sometimes 
                          INSERT steps (when pExprList == 0) */
  Token target;        /* Valid for DELETE, UPDATE, INSERT steps */
  Expr *pWhere;        /* Valid for DELETE, UPDATE steps */
  ExprList *pExprList; /* Valid for UPDATE statements and sometimes 
                           INSERT steps (when pSelect == 0)         */
  IdList *pIdList;     /* Valid for INSERT statements only */
  TriggerStep *pNext;  /* Next in the link-list */
  TriggerStep *pLast;  /* Last element in link-list. Valid for 1st elem only */
};

/*
 * An instance of struct TriggerStack stores information required during code
 * generation of a single trigger program. While the trigger program is being
 * coded, its associated TriggerStack instance is pointed to by the
 * "pTriggerStack" member of the Parse structure.
 *
 * The pTab member points to the table that triggers are being coded on. The 
 * newIdx member contains the index of the vdbe cursor that points at the temp
 * table that stores the new.* references. If new.* references are not valid
 * for the trigger being coded (for example an ON DELETE trigger), then newIdx
 * is set to -1. The oldIdx member is analogous to newIdx, for old.* references.
 *
 * The ON CONFLICT policy to be used for the trigger program steps is stored 
 * as the orconf member. If this is OE_Default, then the ON CONFLICT clause 
 * specified for individual triggers steps is used.
 *
 * struct TriggerStack has a "pNext" member, to allow linked lists to be
 * constructed. When coding nested triggers (triggers fired by other triggers)
 * each nested trigger stores its parent trigger's TriggerStack as the "pNext" 
 * pointer. Once the nested trigger has been coded, the pNext value is restored
 * to the pTriggerStack member of the Parse stucture and coding of the parent
 * trigger continues.
 *
 * Before a nested trigger is coded, the linked list pointed to by the 
 * pTriggerStack is scanned to ensure that the trigger is not about to be coded
 * recursively. If this condition is detected, the nested trigger is not coded.
 */
struct TriggerStack {
  Table *pTab;         /* Table that triggers are currently being coded on */
  int newIdx;          /* Index of vdbe cursor to "new" temp table */
  int oldIdx;          /* Index of vdbe cursor to "old" temp table */
  u32 newColMask;
  u32 oldColMask;
  int orconf;          /* Current orconf policy */
  int ignoreJump;      /* where to jump to for a RAISE(IGNORE) */
  Trigger *pTrigger;   /* The trigger currently being coded */
  TriggerStack *pNext; /* Next trigger down on the trigger stack */
};

/*
** The following structure contains information used by the sqliteFix...
** routines as they walk the parse tree to make database references
** explicit.  
*/
typedef struct DbFixer DbFixer;
struct DbFixer {
  Parse *pParse;      /* The parsing context.  Error messages written here */
  const char *zDb;    /* Make sure all objects are contained in this database */
  const char *zType;  /* Type of the container - used for error messages */
  const Token *pName; /* Name of the container - used for error messages */
};

/*
** An objected used to accumulate the text of a string where we
** do not necessarily know how big the string will be in the end.
*/
struct StrAccum {
  sqlite3 *db;         /* Optional database for lookaside.  Can be NULL */
  char *zBase;         /* A base allocation.  Not from malloc. */
  char *zText;         /* The string collected so far */
  int  nChar;          /* Length of the string so far */
  int  nAlloc;         /* Amount of space allocated in zText */
  int  mxAlloc;        /* Maximum allowed string length */
  u8   mallocFailed;   /* Becomes true if any memory allocation fails */
  u8   useMalloc;      /* True if zText is enlargable using realloc */
  u8   tooBig;         /* Becomes true if string size exceeds limits */
};

/*
** A pointer to this structure is used to communicate information
** from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback.
*/
typedef struct {
  sqlite3 *db;        /* The database being initialized */
  int iDb;            /* 0 for main database.  1 for TEMP, 2.. for ATTACHed */
  char **pzErrMsg;    /* Error message stored here */
  int rc;             /* Result code stored here */
} InitData;

/*
** Structure containing global configuration data for the SQLite library.
**
** This structure also contains some state information.
*/
struct Sqlite3Config {
  int bMemstat;                     /* True to enable memory status */
  int bCoreMutex;                   /* True to enable core mutexing */
  int bFullMutex;                   /* True to enable full mutexing */
  int mxStrlen;                     /* Maximum string length */
  int szLookaside;                  /* Default lookaside buffer size */
  int nLookaside;                   /* Default lookaside buffer count */
  sqlite3_mem_methods m;            /* Low-level memory allocation interface */
  sqlite3_mutex_methods mutex;      /* Low-level mutex interface */
  void *pHeap;                      /* Heap storage space */
  int nHeap;                        /* Size of pHeap[] */
  int mnReq, mxReq;                 /* Min and max heap requests sizes */
  void *pScratch;                   /* Scratch memory */
  int szScratch;                    /* Size of each scratch buffer */
  int nScratch;                     /* Number of scratch buffers */
  void *pPage;                      /* Page cache memory */
  int szPage;                       /* Size of each page in pPage[] */
  int nPage;                        /* Number of pages in pPage[] */
  int isInit;                       /* True after initialization has finished */
  int isMallocInit;                 /* True after malloc is initialized */
  sqlite3_mutex *pInitMutex;        /* Mutex used by sqlite3_initialize() */
  int nSmall;                       /* alloc size threshold used by mem6.c */
  int mxParserStack;                /* maximum depth of the parser stack */
};

/*
** Assuming zIn points to the first byte of a UTF-8 character,
** advance zIn to point to the first byte of the next UTF-8 character.
*/
#define SQLITE_SKIP_UTF8(zIn) {                        \
  if( (*(zIn++))>=0xc0 ){                              \
    while( (*zIn & 0xc0)==0x80 ){ zIn++; }             \
  }                                                    \
}

/*
** The SQLITE_CORRUPT_BKPT macro can be either a constant (for production
** builds) or a function call (for debugging).  If it is a function call,
** it allows the operator to set a breakpoint at the spot where database
** corruption is first detected.
*/
#ifdef SQLITE_DEBUG
  int sqlite3Corrupt(void);
# define SQLITE_CORRUPT_BKPT sqlite3Corrupt()
#else
# define SQLITE_CORRUPT_BKPT SQLITE_CORRUPT
#endif

/*
** Internal function prototypes
*/
int sqlite3StrICmp(const char *, const char *);
int sqlite3StrNICmp(const char *, const char *, int);
int sqlite3IsNumber(const char*, int*, u8);
int sqlite3Strlen(sqlite3*, const char*);

int sqlite3MallocInit(void);
void sqlite3MallocEnd(void);
void *sqlite3Malloc(int);
void *sqlite3MallocZero(int);
void *sqlite3DbMallocZero(sqlite3*, int);
void *sqlite3DbMallocRaw(sqlite3*, int);
char *sqlite3DbStrDup(sqlite3*,const char*);
char *sqlite3DbStrNDup(sqlite3*,const char*, int);
void *sqlite3Realloc(void*, int);
void *sqlite3DbReallocOrFree(sqlite3 *, void *, int);
void *sqlite3DbRealloc(sqlite3 *, void *, int);
void sqlite3DbFree(sqlite3*, void*);
int sqlite3MallocSize(void*);
int sqlite3DbMallocSize(sqlite3*, void*);
void *sqlite3ScratchMalloc(int);
void sqlite3ScratchFree(void*);
void *sqlite3PageMalloc(int);
void sqlite3PageFree(void*);
void sqlite3MemSetDefault(void);
const sqlite3_mem_methods *sqlite3MemGetDefault(void);
const sqlite3_mem_methods *sqlite3MemGetMemsys5(void);
const sqlite3_mem_methods *sqlite3MemGetMemsys3(void);
const sqlite3_mem_methods *sqlite3MemGetMemsys6(void);
void sqlite3BenignMallocHooks(void (*)(void), void (*)(void));

#ifndef SQLITE_MUTEX_NOOP
  sqlite3_mutex_methods *sqlite3DefaultMutex(void);
  sqlite3_mutex *sqlite3MutexAlloc(int);
  int sqlite3MutexInit(void);
  int sqlite3MutexEnd(void);
#endif

void sqlite3StatusReset(void);
int sqlite3StatusValue(int);
void sqlite3StatusAdd(int, int);
void sqlite3StatusSet(int, int);

int sqlite3IsNaN(double);

void sqlite3VXPrintf(StrAccum*, int, const char*, va_list);
char *sqlite3MPrintf(sqlite3*,const char*, ...);
char *sqlite3VMPrintf(sqlite3*,const char*, va_list);
char *sqlite3MAppendf(sqlite3*,char*,const char*,...);
#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
  void sqlite3DebugPrintf(const char*, ...);
#endif
#if defined(SQLITE_TEST)
  void *sqlite3TestTextToPtr(const char*);
#endif
void sqlite3SetString(char **, sqlite3*, const char*, ...);
void sqlite3ErrorMsg(Parse*, const char*, ...);
void sqlite3ErrorClear(Parse*);
void sqlite3Dequote(char*);
void sqlite3DequoteExpr(sqlite3*, Expr*);
int sqlite3KeywordCode(const unsigned char*, int);
int sqlite3RunParser(Parse*, const char*, char **);
void sqlite3FinishCoding(Parse*);
int sqlite3GetTempReg(Parse*);
void sqlite3ReleaseTempReg(Parse*,int);
int sqlite3GetTempRange(Parse*,int);
void sqlite3ReleaseTempRange(Parse*,int,int);
Expr *sqlite3Expr(sqlite3*, int, Expr*, Expr*, const Token*);
Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*, const Token*);
Expr *sqlite3RegisterExpr(Parse*,Token*);
Expr *sqlite3ExprAnd(sqlite3*,Expr*, Expr*);
void sqlite3ExprSpan(Expr*,Token*,Token*);
Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*);
void sqlite3ExprAssignVarNumber(Parse*, Expr*);
void sqlite3ExprDelete(sqlite3*, Expr*);
ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*,Token*);
void sqlite3ExprListDelete(sqlite3*, ExprList*);
int sqlite3Init(sqlite3*, char**);
int sqlite3InitCallback(void*, int, char**, char**);
void sqlite3Pragma(Parse*,Token*,Token*,Token*,int);
void sqlite3ResetInternalSchema(sqlite3*, int);
void sqlite3BeginParse(Parse*,int);
void sqlite3CommitInternalChanges(sqlite3*);
Table *sqlite3ResultSetOfSelect(Parse*,char*,Select*);
void sqlite3OpenMasterTable(Parse *, int);
void sqlite3StartTable(Parse*,Token*,Token*,int,int,int,int);
void sqlite3AddColumn(Parse*,Token*);
void sqlite3AddNotNull(Parse*, int);
void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int);
void sqlite3AddCheckConstraint(Parse*, Expr*);
void sqlite3AddColumnType(Parse*,Token*);
void sqlite3AddDefaultValue(Parse*,Expr*);
void sqlite3AddCollateType(Parse*, Token*);
void sqlite3EndTable(Parse*,Token*,Token*,Select*);

Bitvec *sqlite3BitvecCreate(u32);
int sqlite3BitvecTest(Bitvec*, u32);
int sqlite3BitvecSet(Bitvec*, u32);
void sqlite3BitvecClear(Bitvec*, u32);
void sqlite3BitvecDestroy(Bitvec*);
int sqlite3BitvecBuiltinTest(int,int*);

void sqlite3CreateView(Parse*,Token*,Token*,Token*,Select*,int,int);

#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE)
  int sqlite3ViewGetColumnNames(Parse*,Table*);
#else
# define sqlite3ViewGetColumnNames(A,B) 0
#endif

void sqlite3DropTable(Parse*, SrcList*, int, int);
void sqlite3DeleteTable(Table*);
void sqlite3Insert(Parse*, SrcList*, ExprList*, Select*, IdList*, int);
void *sqlite3ArrayAllocate(sqlite3*,void*,int,int,int*,int*,int*);
IdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*);
int sqlite3IdListIndex(IdList*,const char*);
SrcList *sqlite3SrcListAppend(sqlite3*, SrcList*, Token*, Token*);
SrcList *sqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, Token*, Token*,
                                      Select*, Expr*, IdList*);
void sqlite3SrcListShiftJoinType(SrcList*);
void sqlite3SrcListAssignCursors(Parse*, SrcList*);
void sqlite3IdListDelete(sqlite3*, IdList*);
void sqlite3SrcListDelete(sqlite3*, SrcList*);
void sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*,
                        Token*, int, int);
void sqlite3DropIndex(Parse*, SrcList*, int);
int sqlite3Select(Parse*, Select*, SelectDest*, Select*, int, int*);
Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*,
                         Expr*,ExprList*,int,Expr*,Expr*);
void sqlite3SelectDelete(sqlite3*, Select*);
Table *sqlite3SrcListLookup(Parse*, SrcList*);
int sqlite3IsReadOnly(Parse*, Table*, int);
void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int);
void sqlite3DeleteFrom(Parse*, SrcList*, Expr*);
void sqlite3Update(Parse*, SrcList*, ExprList*, Expr*, int);
WhereInfo *sqlite3WhereBegin(Parse*, SrcList*, Expr*, ExprList**, u8);
void sqlite3WhereEnd(WhereInfo*);
int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int, int);
void sqlite3ExprCodeMove(Parse*, int, int, int);
void sqlite3ExprCodeCopy(Parse*, int, int, int);
void sqlite3ExprClearColumnCache(Parse*, int);
void sqlite3ExprCacheAffinityChange(Parse*, int, int);
int sqlite3ExprWritableRegister(Parse*,int,int);
void sqlite3ExprHardCopy(Parse*,int,int);
int sqlite3ExprCode(Parse*, Expr*, int);
int sqlite3ExprCodeTemp(Parse*, Expr*, int*);
int sqlite3ExprCodeTarget(Parse*, Expr*, int);
int sqlite3ExprCodeAndCache(Parse*, Expr*, int);
void sqlite3ExprCodeConstants(Parse*, Expr*);
int sqlite3ExprCodeExprList(Parse*, ExprList*, int, int);
void sqlite3ExprIfTrue(Parse*, Expr*, int, int);
void sqlite3ExprIfFalse(Parse*, Expr*, int, int);
Table *sqlite3FindTable(sqlite3*,const char*, const char*);
Table *sqlite3LocateTable(Parse*,int isView,const char*, const char*);
Index *sqlite3FindIndex(sqlite3*,const char*, const char*);
void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*);
void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*);
void sqlite3Vacuum(Parse*);
int sqlite3RunVacuum(char**, sqlite3*);
char *sqlite3NameFromToken(sqlite3*, Token*);
int sqlite3ExprCompare(Expr*, Expr*);
int sqlite3ExprResolveNames(NameContext *, Expr *);
void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*);
void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*);
Vdbe *sqlite3GetVdbe(Parse*);
Expr *sqlite3CreateIdExpr(Parse *, const char*);
void sqlite3PrngSaveState(void);
void sqlite3PrngRestoreState(void);
void sqlite3PrngResetState(void);
void sqlite3RollbackAll(sqlite3*);
void sqlite3CodeVerifySchema(Parse*, int);
void sqlite3BeginTransaction(Parse*, int);
void sqlite3CommitTransaction(Parse*);
void sqlite3RollbackTransaction(Parse*);
int sqlite3ExprIsConstant(Expr*);
int sqlite3ExprIsConstantNotJoin(Expr*);
int sqlite3ExprIsConstantOrFunction(Expr*);
int sqlite3ExprIsInteger(Expr*, int*);
int sqlite3IsRowid(const char*);
void sqlite3GenerateRowDelete(Parse*, Table*, int, int, int);
void sqlite3GenerateRowIndexDelete(Parse*, Table*, int, int*);
int sqlite3GenerateIndexKey(Parse*, Index*, int, int, int);
void sqlite3GenerateConstraintChecks(Parse*,Table*,int,int,
                                     int*,int,int,int,int);
void sqlite3CompleteInsertion(Parse*, Table*, int, int, int*,int,int,int,int);
int sqlite3OpenTableAndIndices(Parse*, Table*, int, int);
void sqlite3BeginWriteOperation(Parse*, int, int);
Expr *sqlite3ExprDup(sqlite3*,Expr*);
void sqlite3TokenCopy(sqlite3*,Token*, Token*);
ExprList *sqlite3ExprListDup(sqlite3*,ExprList*);
SrcList *sqlite3SrcListDup(sqlite3*,SrcList*);
IdList *sqlite3IdListDup(sqlite3*,IdList*);
Select *sqlite3SelectDup(sqlite3*,Select*);
FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,int,u8,int);
void sqlite3RegisterBuiltinFunctions(sqlite3*);
void sqlite3RegisterDateTimeFunctions(sqlite3*);
#ifdef SQLITE_DEBUG
  int sqlite3SafetyOn(sqlite3*);
  int sqlite3SafetyOff(sqlite3*);
#else
# define sqlite3SafetyOn(A) 0
# define sqlite3SafetyOff(A) 0
#endif
int sqlite3SafetyCheckOk(sqlite3*);
int sqlite3SafetyCheckSickOrOk(sqlite3*);
void sqlite3ChangeCookie(Parse*, int);
void sqlite3MaterializeView(Parse*, Select*, Expr*, int);

#ifndef SQLITE_OMIT_TRIGGER
  void sqlite3BeginTrigger(Parse*, Token*,Token*,int,int,IdList*,SrcList*,
                           Expr*,int, int);
  void sqlite3FinishTrigger(Parse*, TriggerStep*, Token*);
  void sqlite3DropTrigger(Parse*, SrcList*, int);
  void sqlite3DropTriggerPtr(Parse*, Trigger*);
  int sqlite3TriggersExist(Parse*, Table*, int, ExprList*);
  int sqlite3CodeRowTrigger(Parse*, int, ExprList*, int, Table *, int, int, 
                           int, int, u32*, u32*);
  void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*);
  void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*);
  TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*);
  TriggerStep *sqlite3TriggerInsertStep(sqlite3*,Token*, IdList*,
                                        ExprList*,Select*,int);
  TriggerStep *sqlite3TriggerUpdateStep(sqlite3*,Token*,ExprList*, Expr*, int);
  TriggerStep *sqlite3TriggerDeleteStep(sqlite3*,Token*, Expr*);
  void sqlite3DeleteTrigger(sqlite3*, Trigger*);
  void sqlite3UnlinkAndDeleteTrigger(sqlite3*,int,const char*);
#else
# define sqlite3TriggersExist(A,B,C,D,E,F) 0
# define sqlite3DeleteTrigger(A,B)
# define sqlite3DropTriggerPtr(A,B)
# define sqlite3UnlinkAndDeleteTrigger(A,B,C)
# define sqlite3CodeRowTrigger(A,B,C,D,E,F,G,H,I,J,K) 0
#endif

int sqlite3JoinType(Parse*, Token*, Token*, Token*);
void sqlite3CreateForeignKey(Parse*, ExprList*, Token*, ExprList*, int);
void sqlite3DeferForeignKey(Parse*, int);
#ifndef SQLITE_OMIT_AUTHORIZATION
  void sqlite3AuthRead(Parse*,Expr*,Schema*,SrcList*);
  int sqlite3AuthCheck(Parse*,int, const char*, const char*, const char*);
  void sqlite3AuthContextPush(Parse*, AuthContext*, const char*);
  void sqlite3AuthContextPop(AuthContext*);
#else
# define sqlite3AuthRead(a,b,c,d)
# define sqlite3AuthCheck(a,b,c,d,e)    SQLITE_OK
# define sqlite3AuthContextPush(a,b,c)
# define sqlite3AuthContextPop(a)  ((void)(a))
#endif
void sqlite3Attach(Parse*, Expr*, Expr*, Expr*);
void sqlite3Detach(Parse*, Expr*);
int sqlite3BtreeFactory(const sqlite3 *db, const char *zFilename,
                       int omitJournal, int nCache, int flags, Btree **ppBtree);
int sqlite3FixInit(DbFixer*, Parse*, int, const char*, const Token*);
int sqlite3FixSrcList(DbFixer*, SrcList*);
int sqlite3FixSelect(DbFixer*, Select*);
int sqlite3FixExpr(DbFixer*, Expr*);
int sqlite3FixExprList(DbFixer*, ExprList*);
int sqlite3FixTriggerStep(DbFixer*, TriggerStep*);
int sqlite3AtoF(const char *z, double*);
char *sqlite3_snprintf(int,char*,const char*,...);
int sqlite3GetInt32(const char *, int*);
int sqlite3FitsIn64Bits(const char *, int);
int sqlite3Utf16ByteLen(const void *pData, int nChar);
int sqlite3Utf8CharLen(const char *pData, int nByte);
int sqlite3Utf8Read(const u8*, const u8*, const u8**);

/*
** Routines to read and write variable-length integers.  These used to
** be defined locally, but now we use the varint routines in the util.c
** file.  Code should use the MACRO forms below, as the Varint32 versions
** are coded to assume the single byte case is already handled (which 
** the MACRO form does).
*/
int sqlite3PutVarint(unsigned char*, u64);
int sqlite3PutVarint32(unsigned char*, u32);
int sqlite3GetVarint(const unsigned char *, u64 *);
int sqlite3GetVarint32(const unsigned char *, u32 *);
int sqlite3VarintLen(u64 v);

/*
** The header of a record consists of a sequence variable-length integers.
** These integers are almost always small and are encoded as a single byte.
** The following macros take advantage this fact to provide a fast encode
** and decode of the integers in a record header.  It is faster for the common
** case where the integer is a single byte.  It is a little slower when the
** integer is two or more bytes.  But overall it is faster.
**
** The following expressions are equivalent:
**
**     x = sqlite3GetVarint32( A, &B );
**     x = sqlite3PutVarint32( A, B );
**
**     x = getVarint32( A, B );
**     x = putVarint32( A, B );
**
*/
#define getVarint32(A,B)  ((*(A)<(unsigned char)0x80) ? ((B) = (u32)*(A)),1 : sqlite3GetVarint32((A), &(B)))
#define putVarint32(A,B)  (((B)<(u32)0x80) ? (*(A) = (unsigned char)(B)),1 : sqlite3PutVarint32((A), (B)))
#define getVarint    sqlite3GetVarint
#define putVarint    sqlite3PutVarint


void sqlite3IndexAffinityStr(Vdbe *, Index *);
void sqlite3TableAffinityStr(Vdbe *, Table *);
char sqlite3CompareAffinity(Expr *pExpr, char aff2);
int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity);
char sqlite3ExprAffinity(Expr *pExpr);
int sqlite3Atoi64(const char*, i64*);
void sqlite3Error(sqlite3*, int, const char*,...);
void *sqlite3HexToBlob(sqlite3*, const char *z, int n);
int sqlite3TwoPartName(Parse *, Token *, Token *, Token **);
const char *sqlite3ErrStr(int);
int sqlite3ReadSchema(Parse *pParse);
CollSeq *sqlite3FindCollSeq(sqlite3*,u8 enc, const char *,int,int);
CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char *zName, int nName);
CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr);
Expr *sqlite3ExprSetColl(Parse *pParse, Expr *, Token *);
int sqlite3CheckCollSeq(Parse *, CollSeq *);
int sqlite3CheckObjectName(Parse *, const char *);
void sqlite3VdbeSetChanges(sqlite3 *, int);

const void *sqlite3ValueText(sqlite3_value*, u8);
int sqlite3ValueBytes(sqlite3_value*, u8);
void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8, 
                        void(*)(void*));
void sqlite3ValueFree(sqlite3_value*);
sqlite3_value *sqlite3ValueNew(sqlite3 *);
char *sqlite3Utf16to8(sqlite3 *, const void*, int);
int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **);
void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
#ifndef SQLITE_AMALGAMATION
extern const unsigned char sqlite3UpperToLower[];
extern struct Sqlite3Config sqlite3Config;
#endif
void sqlite3RootPageMoved(Db*, int, int);
void sqlite3Reindex(Parse*, Token*, Token*);
void sqlite3AlterFunctions(sqlite3*);
void sqlite3AlterRenameTable(Parse*, SrcList*, Token*);
int sqlite3GetToken(const unsigned char *, int *);
void sqlite3NestedParse(Parse*, const char*, ...);
void sqlite3ExpirePreparedStatements(sqlite3*);
void sqlite3CodeSubselect(Parse *, Expr *, int);
int sqlite3SelectResolve(Parse *, Select *, NameContext *);
void sqlite3ColumnDefault(Vdbe *, Table *, int);
void sqlite3AlterFinishAddColumn(Parse *, Token *);
void sqlite3AlterBeginAddColumn(Parse *, SrcList *);
CollSeq *sqlite3GetCollSeq(sqlite3*, CollSeq *, const char *, int);
char sqlite3AffinityType(const Token*);
void sqlite3Analyze(Parse*, Token*, Token*);
int sqlite3InvokeBusyHandler(BusyHandler*);
int sqlite3FindDb(sqlite3*, Token*);
int sqlite3AnalysisLoad(sqlite3*,int iDB);
void sqlite3DefaultRowEst(Index*);
void sqlite3RegisterLikeFunctions(sqlite3*, int);
int sqlite3IsLikeFunction(sqlite3*,Expr*,int*,char*);
void sqlite3AttachFunctions(sqlite3 *);
void sqlite3MinimumFileFormat(Parse*, int, int);
void sqlite3SchemaFree(void *);
Schema *sqlite3SchemaGet(sqlite3 *, Btree *);
int sqlite3SchemaToIndex(sqlite3 *db, Schema *);
KeyInfo *sqlite3IndexKeyinfo(Parse *, Index *);
int sqlite3CreateFunc(sqlite3 *, const char *, int, int, void *, 
  void (*)(sqlite3_context*,int,sqlite3_value **),
  void (*)(sqlite3_context*,int,sqlite3_value **), void (*)(sqlite3_context*));
int sqlite3ApiExit(sqlite3 *db, int);
int sqlite3OpenTempDatabase(Parse *);

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

/*
** The interface to the LEMON-generated parser
*/
void *sqlite3ParserAlloc(void*(*)(size_t));
void sqlite3ParserFree(void*, void(*)(void*));
void sqlite3Parser(void*, int, Token, Parse*);
#ifdef YYTRACKMAXSTACKDEPTH
  int sqlite3ParserStackPeak(void*);
#endif

int sqlite3AutoLoadExtensions(sqlite3*);
#ifndef SQLITE_OMIT_LOAD_EXTENSION
  void sqlite3CloseExtensions(sqlite3*);
#else
# define sqlite3CloseExtensions(X)
#endif

#ifndef SQLITE_OMIT_SHARED_CACHE
  void sqlite3TableLock(Parse *, int, int, u8, const char *);
#else
  #define sqlite3TableLock(v,w,x,y,z)
#endif

#ifdef SQLITE_TEST
  int sqlite3Utf8To8(unsigned char*);
#endif

#ifdef SQLITE_OMIT_VIRTUALTABLE
#  define sqlite3VtabClear(X)
#  define sqlite3VtabSync(X,Y) SQLITE_OK
#  define sqlite3VtabRollback(X)
#  define sqlite3VtabCommit(X)
#else
   void sqlite3VtabClear(Table*);
   int sqlite3VtabSync(sqlite3 *db, char **);
   int sqlite3VtabRollback(sqlite3 *db);
   int sqlite3VtabCommit(sqlite3 *db);
#endif
void sqlite3VtabMakeWritable(Parse*,Table*);
void sqlite3VtabLock(sqlite3_vtab*);
void sqlite3VtabUnlock(sqlite3*, sqlite3_vtab*);
void sqlite3VtabBeginParse(Parse*, Token*, Token*, Token*);
void sqlite3VtabFinishParse(Parse*, Token*);
void sqlite3VtabArgInit(Parse*);
void sqlite3VtabArgExtend(Parse*, Token*);
int sqlite3VtabCallCreate(sqlite3*, int, const char *, char **);
int sqlite3VtabCallConnect(Parse*, Table*);
int sqlite3VtabCallDestroy(sqlite3*, int, const char *);
int sqlite3VtabBegin(sqlite3 *, sqlite3_vtab *);
FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*);
void sqlite3InvalidFunction(sqlite3_context*,int,sqlite3_value**);
int sqlite3Reprepare(Vdbe*);
void sqlite3ExprListCheckLength(Parse*, ExprList*, const char*);
CollSeq *sqlite3BinaryCompareCollSeq(Parse *, Expr *, Expr *);


/*
** Available fault injectors.  Should be numbered beginning with 0.
*/
#define SQLITE_FAULTINJECTOR_MALLOC     0
#define SQLITE_FAULTINJECTOR_COUNT      1

/*
** The interface to the code in fault.c used for identifying "benign"
** malloc failures. This is only present if SQLITE_OMIT_BUILTIN_TEST
** is not defined.
*/
#ifndef SQLITE_OMIT_BUILTIN_TEST
  void sqlite3BeginBenignMalloc(void);
  void sqlite3EndBenignMalloc(void);
#else
  #define sqlite3BeginBenignMalloc()
  #define sqlite3EndBenignMalloc()
#endif

#define IN_INDEX_ROWID           1
#define IN_INDEX_EPH             2
#define IN_INDEX_INDEX           3
int sqlite3FindInIndex(Parse *, Expr *, int*);

#ifdef SQLITE_ENABLE_ATOMIC_WRITE
  int sqlite3JournalOpen(sqlite3_vfs *, const char *, sqlite3_file *, int, int);
  int sqlite3JournalSize(sqlite3_vfs *);
  int sqlite3JournalCreate(sqlite3_file *);
#else
  #define sqlite3JournalSize(pVfs) ((pVfs)->szOsFile)
#endif

#if SQLITE_MAX_EXPR_DEPTH>0
  void sqlite3ExprSetHeight(Parse *pParse, Expr *p);
  int sqlite3SelectExprHeight(Select *);
#else
  #define sqlite3ExprSetHeight(x,y)
  #define sqlite3SelectExprHeight(x) 0
#endif

u32 sqlite3Get4byte(const u8*);
void sqlite3Put4byte(u8*, u32);

#ifdef SQLITE_SSE
#include "sseInt.h"
#endif

#ifdef SQLITE_DEBUG
  void sqlite3ParserTrace(FILE*, char *);
#endif

/*
** If the SQLITE_ENABLE IOTRACE exists then the global variable
** sqlite3IoTrace is a pointer to a printf-like routine used to
** print I/O tracing messages. 
*/
#ifdef SQLITE_ENABLE_IOTRACE
# define IOTRACE(A)  if( sqlite3IoTrace ){ sqlite3IoTrace A; }
  void sqlite3VdbeIOTraceSql(Vdbe*);
SQLITE_EXTERN void (*sqlite3IoTrace)(const char*,...);
#else
# define IOTRACE(A)
# define sqlite3VdbeIOTraceSql(X)
#endif

#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/sqliteLimit.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/*
** 2007 May 7
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** 
** This file defines various limits of what SQLite can process.
**
** @(#) $Id: sqliteLimit.h,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/

/*
** The maximum length of a TEXT or BLOB in bytes.   This also
** limits the size of a row in a table or index.
**
** The hard limit is the ability of a 32-bit signed integer
** to count the size: 2^31-1 or 2147483647.
*/
#ifndef SQLITE_MAX_LENGTH
# define SQLITE_MAX_LENGTH 1000000000
#endif

/*
** This is the maximum number of
**
**    * Columns in a table
**    * Columns in an index
**    * Columns in a view
**    * Terms in the SET clause of an UPDATE statement
**    * Terms in the result set of a SELECT statement
**    * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement.
**    * Terms in the VALUES clause of an INSERT statement
**
** The hard upper limit here is 32676.  Most database people will
** tell you that in a well-normalized database, you usually should
** not have more than a dozen or so columns in any table.  And if
** that is the case, there is no point in having more than a few
** dozen values in any of the other situations described above.
*/
#ifndef SQLITE_MAX_COLUMN
# define SQLITE_MAX_COLUMN 2000
#endif

/*
** The maximum length of a single SQL statement in bytes.
**
** It used to be the case that setting this value to zero would
** turn the limit off.  That is no longer true.  It is not possible
** to turn this limit off.
*/
#ifndef SQLITE_MAX_SQL_LENGTH
# define SQLITE_MAX_SQL_LENGTH 1000000000
#endif

/*
** The maximum depth of an expression tree. This is limited to 
** some extent by SQLITE_MAX_SQL_LENGTH. But sometime you might 
** want to place more severe limits on the complexity of an 
** expression.
**
** A value of 0 used to mean that the limit was not enforced.
** But that is no longer true.  The limit is now strictly enforced
** at all times.
*/
#ifndef SQLITE_MAX_EXPR_DEPTH
# define SQLITE_MAX_EXPR_DEPTH 1000
#endif

/*
** The maximum number of terms in a compound SELECT statement.
** The code generator for compound SELECT statements does one
** level of recursion for each term.  A stack overflow can result
** if the number of terms is too large.  In practice, most SQL
** never has more than 3 or 4 terms.  Use a value of 0 to disable
** any limit on the number of terms in a compount SELECT.
*/
#ifndef SQLITE_MAX_COMPOUND_SELECT
# define SQLITE_MAX_COMPOUND_SELECT 500
#endif

/*
** The maximum number of opcodes in a VDBE program.
** Not currently enforced.
*/
#ifndef SQLITE_MAX_VDBE_OP
# define SQLITE_MAX_VDBE_OP 25000
#endif

/*
** The maximum number of arguments to an SQL function.
*/
#ifndef SQLITE_MAX_FUNCTION_ARG
# define SQLITE_MAX_FUNCTION_ARG 100
#endif

/*
** The maximum number of in-memory pages to use for the main database
** table and for temporary tables.  The SQLITE_DEFAULT_CACHE_SIZE
*/
#ifndef SQLITE_DEFAULT_CACHE_SIZE
# define SQLITE_DEFAULT_CACHE_SIZE  2000
#endif
#ifndef SQLITE_DEFAULT_TEMP_CACHE_SIZE
# define SQLITE_DEFAULT_TEMP_CACHE_SIZE  500
#endif

/*
** The maximum number of attached databases.  This must be between 0
** and 30.  The upper bound on 30 is because a 32-bit integer bitmap
** is used internally to track attached databases.
*/
#ifndef SQLITE_MAX_ATTACHED
# define SQLITE_MAX_ATTACHED 10
#endif


/*
** The maximum value of a ?nnn wildcard that the parser will accept.
*/
#ifndef SQLITE_MAX_VARIABLE_NUMBER
# define SQLITE_MAX_VARIABLE_NUMBER 999
#endif

/* Maximum page size.  The upper bound on this value is 32768.  This a limit
** imposed by the necessity of storing the value in a 2-byte unsigned integer
** and the fact that the page size must be a power of 2.
*/
#ifndef SQLITE_MAX_PAGE_SIZE
# define SQLITE_MAX_PAGE_SIZE 32768
#endif


/*
** The default size of a database page.
*/
#ifndef SQLITE_DEFAULT_PAGE_SIZE
# define SQLITE_DEFAULT_PAGE_SIZE 1024
#endif
#if SQLITE_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
# undef SQLITE_DEFAULT_PAGE_SIZE
# define SQLITE_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
#endif

/*
** Ordinarily, if no value is explicitly provided, SQLite creates databases
** with page size SQLITE_DEFAULT_PAGE_SIZE. However, based on certain
** device characteristics (sector-size and atomic write() support),
** SQLite may choose a larger value. This constant is the maximum value
** SQLite will choose on its own.
*/
#ifndef SQLITE_MAX_DEFAULT_PAGE_SIZE
# define SQLITE_MAX_DEFAULT_PAGE_SIZE 8192
#endif
#if SQLITE_MAX_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE
# undef SQLITE_MAX_DEFAULT_PAGE_SIZE
# define SQLITE_MAX_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE
#endif


/*
** Maximum number of pages in one database file.
**
** This is really just the default value for the max_page_count pragma.
** This value can be lowered (or raised) at run-time using that the
** max_page_count macro.
*/
#ifndef SQLITE_MAX_PAGE_COUNT
# define SQLITE_MAX_PAGE_COUNT 1073741823
#endif

/*
** Maximum length (in bytes) of the pattern in a LIKE or GLOB
** operator.
*/
#ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH
# define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000
#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































Deleted SQLite.Interop/splitsource/status.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
** 2008 June 18
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This module implements the sqlite3_status() interface and related
** functionality.
**
** $Id: status.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** Variables in which to record status information.
*/
static struct {
  int nowValue[9];         /* Current value */
  int mxValue[9];          /* Maximum value */
} sqlite3Stat;


/*
** Reset the status records.  This routine is called by
** sqlite3_initialize().
*/
void sqlite3StatusReset(void){
  memset(&sqlite3Stat, 0, sizeof(sqlite3Stat));
}

/*
** Return the current value of a status parameter.
*/
int sqlite3StatusValue(int op){
  assert( op>=0 && op<ArraySize(sqlite3Stat.nowValue) );
  return sqlite3Stat.nowValue[op];
}

/*
** Add N to the value of a status record.  It is assumed that the
** caller holds appropriate locks.
*/
void sqlite3StatusAdd(int op, int N){
  assert( op>=0 && op<ArraySize(sqlite3Stat.nowValue) );
  sqlite3Stat.nowValue[op] += N;
  if( sqlite3Stat.nowValue[op]>sqlite3Stat.mxValue[op] ){
    sqlite3Stat.mxValue[op] = sqlite3Stat.nowValue[op];
  }
}

/*
** Set the value of a status to X.
*/
void sqlite3StatusSet(int op, int X){
  assert( op>=0 && op<ArraySize(sqlite3Stat.nowValue) );
  sqlite3Stat.nowValue[op] = X;
  if( sqlite3Stat.nowValue[op]>sqlite3Stat.mxValue[op] ){
    sqlite3Stat.mxValue[op] = sqlite3Stat.nowValue[op];
  }
}

/*
** Query status information.
**
** This implementation assumes that reading or writing an aligned
** 32-bit integer is an atomic operation.  If that assumption is not true,
** then this routine is not threadsafe.
*/
int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){
  if( op<0 || op>=ArraySize(sqlite3Stat.nowValue) ){
    return SQLITE_MISUSE;
  }
  *pCurrent = sqlite3Stat.nowValue[op];
  *pHighwater = sqlite3Stat.mxValue[op];
  if( resetFlag ){
    sqlite3Stat.mxValue[op] = sqlite3Stat.nowValue[op];
  }
  return SQLITE_OK;
}

/*
** Query status information for a single database connection
*/
int sqlite3_db_status(
  sqlite3 *db,          /* The database connection whose status is desired */
  int op,               /* Status verb */
  int *pCurrent,        /* Write current value here */
  int *pHighwater,      /* Write high-water mark here */
  int resetFlag         /* Reset high-water mark if true */
){
  switch( op ){
    case SQLITE_DBSTATUS_LOOKASIDE_USED: {
      *pCurrent = db->lookaside.nOut;
      *pHighwater = db->lookaside.mxOut;
      if( resetFlag ){
        db->lookaside.mxOut = db->lookaside.nOut;
      }
      break;
    }
    default: {
      return SQLITE_ERROR;
    }
  }
  return SQLITE_OK;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































Deleted SQLite.Interop/splitsource/table.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains the sqlite3_get_table() and sqlite3_free_table()
** interface routines.  These are just wrappers around the main
** interface routine of sqlite3_exec().
**
** These routines are in a separate files so that they will not be linked
** if they are not used.
**
** $Id: table.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <stdlib.h>
#include <string.h>

#ifndef SQLITE_OMIT_GET_TABLE

/*
** This structure is used to pass data from sqlite3_get_table() through
** to the callback function is uses to build the result.
*/
typedef struct TabResult {
  char **azResult;
  char *zErrMsg;
  int nResult;
  int nAlloc;
  int nRow;
  int nColumn;
  int nData;
  int rc;
} TabResult;

/*
** This routine is called once for each row in the result table.  Its job
** is to fill in the TabResult structure appropriately, allocating new
** memory as necessary.
*/
static int sqlite3_get_table_cb(void *pArg, int nCol, char **argv, char **colv){
  TabResult *p = (TabResult*)pArg;
  int need;
  int i;
  char *z;

  /* Make sure there is enough space in p->azResult to hold everything
  ** we need to remember from this invocation of the callback.
  */
  if( p->nRow==0 && argv!=0 ){
    need = nCol*2;
  }else{
    need = nCol;
  }
  if( p->nData + need >= p->nAlloc ){
    char **azNew;
    p->nAlloc = p->nAlloc*2 + need + 1;
    azNew = sqlite3_realloc( p->azResult, sizeof(char*)*p->nAlloc );
    if( azNew==0 ) goto malloc_failed;
    p->azResult = azNew;
  }

  /* If this is the first row, then generate an extra row containing
  ** the names of all columns.
  */
  if( p->nRow==0 ){
    p->nColumn = nCol;
    for(i=0; i<nCol; i++){
      z = sqlite3_mprintf("%s", colv[i]);
      if( z==0 ) goto malloc_failed;
      p->azResult[p->nData++] = z;
    }
  }else if( p->nColumn!=nCol ){
    sqlite3_free(p->zErrMsg);
    p->zErrMsg = sqlite3_mprintf(
       "sqlite3_get_table() called with two or more incompatible queries"
    );
    p->rc = SQLITE_ERROR;
    return 1;
  }

  /* Copy over the row data
  */
  if( argv!=0 ){
    for(i=0; i<nCol; i++){
      if( argv[i]==0 ){
        z = 0;
      }else{
        int n = strlen(argv[i])+1;
        z = sqlite3_malloc( n );
        if( z==0 ) goto malloc_failed;
        memcpy(z, argv[i], n);
      }
      p->azResult[p->nData++] = z;
    }
    p->nRow++;
  }
  return 0;

malloc_failed:
  p->rc = SQLITE_NOMEM;
  return 1;
}

/*
** Query the database.  But instead of invoking a callback for each row,
** malloc() for space to hold the result and return the entire results
** at the conclusion of the call.
**
** The result that is written to ***pazResult is held in memory obtained
** from malloc().  But the caller cannot free this memory directly.  
** Instead, the entire table should be passed to sqlite3_free_table() when
** the calling procedure is finished using it.
*/
int sqlite3_get_table(
  sqlite3 *db,                /* The database on which the SQL executes */
  const char *zSql,           /* The SQL to be executed */
  char ***pazResult,          /* Write the result table here */
  int *pnRow,                 /* Write the number of rows in the result here */
  int *pnColumn,              /* Write the number of columns of result here */
  char **pzErrMsg             /* Write error messages here */
){
  int rc;
  TabResult res;

  *pazResult = 0;
  if( pnColumn ) *pnColumn = 0;
  if( pnRow ) *pnRow = 0;
  res.zErrMsg = 0;
  res.nResult = 0;
  res.nRow = 0;
  res.nColumn = 0;
  res.nData = 1;
  res.nAlloc = 20;
  res.rc = SQLITE_OK;
  res.azResult = sqlite3_malloc(sizeof(char*)*res.nAlloc );
  if( res.azResult==0 ){
     db->errCode = SQLITE_NOMEM;
     return SQLITE_NOMEM;
  }
  res.azResult[0] = 0;
  rc = sqlite3_exec(db, zSql, sqlite3_get_table_cb, &res, pzErrMsg);
  assert( sizeof(res.azResult[0])>= sizeof(res.nData) );
  res.azResult[0] = SQLITE_INT_TO_PTR(res.nData);
  if( (rc&0xff)==SQLITE_ABORT ){
    sqlite3_free_table(&res.azResult[1]);
    if( res.zErrMsg ){
      if( pzErrMsg ){
        sqlite3_free(*pzErrMsg);
        *pzErrMsg = sqlite3_mprintf("%s",res.zErrMsg);
      }
      sqlite3_free(res.zErrMsg);
    }
    db->errCode = res.rc;  /* Assume 32-bit assignment is atomic */
    return res.rc;
  }
  sqlite3_free(res.zErrMsg);
  if( rc!=SQLITE_OK ){
    sqlite3_free_table(&res.azResult[1]);
    return rc;
  }
  if( res.nAlloc>res.nData ){
    char **azNew;
    azNew = sqlite3_realloc( res.azResult, sizeof(char*)*(res.nData+1) );
    if( azNew==0 ){
      sqlite3_free_table(&res.azResult[1]);
      db->errCode = SQLITE_NOMEM;
      return SQLITE_NOMEM;
    }
    res.nAlloc = res.nData+1;
    res.azResult = azNew;
  }
  *pazResult = &res.azResult[1];
  if( pnColumn ) *pnColumn = res.nColumn;
  if( pnRow ) *pnRow = res.nRow;
  return rc;
}

/*
** This routine frees the space the sqlite3_get_table() malloced.
*/
void sqlite3_free_table(
  char **azResult            /* Result returned from from sqlite3_get_table() */
){
  if( azResult ){
    int i, n;
    azResult--;
    assert( azResult!=0 );
    n = SQLITE_PTR_TO_INT(azResult[0]);
    for(i=1; i<n; i++){ if( azResult[i] ) sqlite3_free(azResult[i]); }
    sqlite3_free(azResult);
  }
}

#endif /* SQLITE_OMIT_GET_TABLE */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/tclsqlite.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** A TCL Interface to SQLite.  Append this file to sqlite3.c and
** compile the whole thing to build a TCL-enabled version of SQLite.
**
** $Id: tclsqlite.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "tcl.h"
#include <errno.h>

/*
** Some additional include files are needed if this file is not
** appended to the amalgamation.
*/
#ifndef SQLITE_AMALGAMATION
# include "sqliteInt.h"
# include <stdlib.h>
# include <string.h>
# include <assert.h>
# include <ctype.h>
#endif

/*
 * Windows needs to know which symbols to export.  Unix does not.
 * BUILD_sqlite should be undefined for Unix.
 */
#ifdef BUILD_sqlite
#undef TCL_STORAGE_CLASS
#define TCL_STORAGE_CLASS DLLEXPORT
#endif /* BUILD_sqlite */

#define NUM_PREPARED_STMTS 10
#define MAX_PREPARED_STMTS 100

/*
** If TCL uses UTF-8 and SQLite is configured to use iso8859, then we
** have to do a translation when going between the two.  Set the 
** UTF_TRANSLATION_NEEDED macro to indicate that we need to do
** this translation.  
*/
#if defined(TCL_UTF_MAX) && !defined(SQLITE_UTF8)
# define UTF_TRANSLATION_NEEDED 1
#endif

/*
** New SQL functions can be created as TCL scripts.  Each such function
** is described by an instance of the following structure.
*/
typedef struct SqlFunc SqlFunc;
struct SqlFunc {
  Tcl_Interp *interp;   /* The TCL interpret to execute the function */
  Tcl_Obj *pScript;     /* The Tcl_Obj representation of the script */
  int useEvalObjv;      /* True if it is safe to use Tcl_EvalObjv */
  char *zName;          /* Name of this function */
  SqlFunc *pNext;       /* Next function on the list of them all */
};

/*
** New collation sequences function can be created as TCL scripts.  Each such
** function is described by an instance of the following structure.
*/
typedef struct SqlCollate SqlCollate;
struct SqlCollate {
  Tcl_Interp *interp;   /* The TCL interpret to execute the function */
  char *zScript;        /* The script to be run */
  SqlCollate *pNext;    /* Next function on the list of them all */
};

/*
** Prepared statements are cached for faster execution.  Each prepared
** statement is described by an instance of the following structure.
*/
typedef struct SqlPreparedStmt SqlPreparedStmt;
struct SqlPreparedStmt {
  SqlPreparedStmt *pNext;  /* Next in linked list */
  SqlPreparedStmt *pPrev;  /* Previous on the list */
  sqlite3_stmt *pStmt;     /* The prepared statement */
  int nSql;                /* chars in zSql[] */
  const char *zSql;        /* Text of the SQL statement */
};

typedef struct IncrblobChannel IncrblobChannel;

/*
** There is one instance of this structure for each SQLite database
** that has been opened by the SQLite TCL interface.
*/
typedef struct SqliteDb SqliteDb;
struct SqliteDb {
  sqlite3 *db;               /* The "real" database structure. MUST BE FIRST */
  Tcl_Interp *interp;        /* The interpreter used for this database */
  char *zBusy;               /* The busy callback routine */
  char *zCommit;             /* The commit hook callback routine */
  char *zTrace;              /* The trace callback routine */
  char *zProfile;            /* The profile callback routine */
  char *zProgress;           /* The progress callback routine */
  char *zAuth;               /* The authorization callback routine */
  char *zNull;               /* Text to substitute for an SQL NULL value */
  SqlFunc *pFunc;            /* List of SQL functions */
  Tcl_Obj *pUpdateHook;      /* Update hook script (if any) */
  Tcl_Obj *pRollbackHook;    /* Rollback hook script (if any) */
  SqlCollate *pCollate;      /* List of SQL collation functions */
  int rc;                    /* Return code of most recent sqlite3_exec() */
  Tcl_Obj *pCollateNeeded;   /* Collation needed script */
  SqlPreparedStmt *stmtList; /* List of prepared statements*/
  SqlPreparedStmt *stmtLast; /* Last statement in the list */
  int maxStmt;               /* The next maximum number of stmtList */
  int nStmt;                 /* Number of statements in stmtList */
  IncrblobChannel *pIncrblob;/* Linked list of open incrblob channels */
};

struct IncrblobChannel {
  sqlite3_blob *pBlob;      /* sqlite3 blob handle */
  SqliteDb *pDb;            /* Associated database connection */
  int iSeek;                /* Current seek offset */
  Tcl_Channel channel;      /* Channel identifier */
  IncrblobChannel *pNext;   /* Linked list of all open incrblob channels */
  IncrblobChannel *pPrev;   /* Linked list of all open incrblob channels */
};

#ifndef SQLITE_OMIT_INCRBLOB
/*
** Close all incrblob channels opened using database connection pDb.
** This is called when shutting down the database connection.
*/
static void closeIncrblobChannels(SqliteDb *pDb){
  IncrblobChannel *p;
  IncrblobChannel *pNext;

  for(p=pDb->pIncrblob; p; p=pNext){
    pNext = p->pNext;

    /* Note: Calling unregister here call Tcl_Close on the incrblob channel, 
    ** which deletes the IncrblobChannel structure at *p. So do not
    ** call Tcl_Free() here.
    */
    Tcl_UnregisterChannel(pDb->interp, p->channel);
  }
}

/*
** Close an incremental blob channel.
*/
static int incrblobClose(ClientData instanceData, Tcl_Interp *interp){
  IncrblobChannel *p = (IncrblobChannel *)instanceData;
  int rc = sqlite3_blob_close(p->pBlob);
  sqlite3 *db = p->pDb->db;

  /* Remove the channel from the SqliteDb.pIncrblob list. */
  if( p->pNext ){
    p->pNext->pPrev = p->pPrev;
  }
  if( p->pPrev ){
    p->pPrev->pNext = p->pNext;
  }
  if( p->pDb->pIncrblob==p ){
    p->pDb->pIncrblob = p->pNext;
  }

  /* Free the IncrblobChannel structure */
  Tcl_Free((char *)p);

  if( rc!=SQLITE_OK ){
    Tcl_SetResult(interp, (char *)sqlite3_errmsg(db), TCL_VOLATILE);
    return TCL_ERROR;
  }
  return TCL_OK;
}

/*
** Read data from an incremental blob channel.
*/
static int incrblobInput(
  ClientData instanceData, 
  char *buf, 
  int bufSize,
  int *errorCodePtr
){
  IncrblobChannel *p = (IncrblobChannel *)instanceData;
  int nRead = bufSize;         /* Number of bytes to read */
  int nBlob;                   /* Total size of the blob */
  int rc;                      /* sqlite error code */

  nBlob = sqlite3_blob_bytes(p->pBlob);
  if( (p->iSeek+nRead)>nBlob ){
    nRead = nBlob-p->iSeek;
  }
  if( nRead<=0 ){
    return 0;
  }

  rc = sqlite3_blob_read(p->pBlob, (void *)buf, nRead, p->iSeek);
  if( rc!=SQLITE_OK ){
    *errorCodePtr = rc;
    return -1;
  }

  p->iSeek += nRead;
  return nRead;
}

/*
** Write data to an incremental blob channel.
*/
static int incrblobOutput(
  ClientData instanceData, 
  CONST char *buf, 
  int toWrite,
  int *errorCodePtr
){
  IncrblobChannel *p = (IncrblobChannel *)instanceData;
  int nWrite = toWrite;        /* Number of bytes to write */
  int nBlob;                   /* Total size of the blob */
  int rc;                      /* sqlite error code */

  nBlob = sqlite3_blob_bytes(p->pBlob);
  if( (p->iSeek+nWrite)>nBlob ){
    *errorCodePtr = EINVAL;
    return -1;
  }
  if( nWrite<=0 ){
    return 0;
  }

  rc = sqlite3_blob_write(p->pBlob, (void *)buf, nWrite, p->iSeek);
  if( rc!=SQLITE_OK ){
    *errorCodePtr = EIO;
    return -1;
  }

  p->iSeek += nWrite;
  return nWrite;
}

/*
** Seek an incremental blob channel.
*/
static int incrblobSeek(
  ClientData instanceData, 
  long offset,
  int seekMode,
  int *errorCodePtr
){
  IncrblobChannel *p = (IncrblobChannel *)instanceData;

  switch( seekMode ){
    case SEEK_SET:
      p->iSeek = offset;
      break;
    case SEEK_CUR:
      p->iSeek += offset;
      break;
    case SEEK_END:
      p->iSeek = sqlite3_blob_bytes(p->pBlob) + offset;
      break;

    default: assert(!"Bad seekMode");
  }

  return p->iSeek;
}


static void incrblobWatch(ClientData instanceData, int mode){ 
  /* NO-OP */ 
}
static int incrblobHandle(ClientData instanceData, int dir, ClientData *hPtr){
  return TCL_ERROR;
}

static Tcl_ChannelType IncrblobChannelType = {
  "incrblob",                        /* typeName                             */
  TCL_CHANNEL_VERSION_2,             /* version                              */
  incrblobClose,                     /* closeProc                            */
  incrblobInput,                     /* inputProc                            */
  incrblobOutput,                    /* outputProc                           */
  incrblobSeek,                      /* seekProc                             */
  0,                                 /* setOptionProc                        */
  0,                                 /* getOptionProc                        */
  incrblobWatch,                     /* watchProc (this is a no-op)          */
  incrblobHandle,                    /* getHandleProc (always returns error) */
  0,                                 /* close2Proc                           */
  0,                                 /* blockModeProc                        */
  0,                                 /* flushProc                            */
  0,                                 /* handlerProc                          */
  0,                                 /* wideSeekProc                         */
};

/*
** Create a new incrblob channel.
*/
static int createIncrblobChannel(
  Tcl_Interp *interp, 
  SqliteDb *pDb, 
  const char *zDb,
  const char *zTable, 
  const char *zColumn, 
  sqlite_int64 iRow,
  int isReadonly
){
  IncrblobChannel *p;
  sqlite3 *db = pDb->db;
  sqlite3_blob *pBlob;
  int rc;
  int flags = TCL_READABLE|(isReadonly ? 0 : TCL_WRITABLE);

  /* This variable is used to name the channels: "incrblob_[incr count]" */
  static int count = 0;
  char zChannel[64];

  rc = sqlite3_blob_open(db, zDb, zTable, zColumn, iRow, !isReadonly, &pBlob);
  if( rc!=SQLITE_OK ){
    Tcl_SetResult(interp, (char *)sqlite3_errmsg(pDb->db), TCL_VOLATILE);
    return TCL_ERROR;
  }

  p = (IncrblobChannel *)Tcl_Alloc(sizeof(IncrblobChannel));
  p->iSeek = 0;
  p->pBlob = pBlob;

  sqlite3_snprintf(sizeof(zChannel), zChannel, "incrblob_%d", ++count);
  p->channel = Tcl_CreateChannel(&IncrblobChannelType, zChannel, p, flags);
  Tcl_RegisterChannel(interp, p->channel);

  /* Link the new channel into the SqliteDb.pIncrblob list. */
  p->pNext = pDb->pIncrblob;
  p->pPrev = 0;
  if( p->pNext ){
    p->pNext->pPrev = p;
  }
  pDb->pIncrblob = p;
  p->pDb = pDb;

  Tcl_SetResult(interp, (char *)Tcl_GetChannelName(p->channel), TCL_VOLATILE);
  return TCL_OK;
}
#else  /* else clause for "#ifndef SQLITE_OMIT_INCRBLOB" */
  #define closeIncrblobChannels(pDb)
#endif

/*
** Look at the script prefix in pCmd.  We will be executing this script
** after first appending one or more arguments.  This routine analyzes
** the script to see if it is safe to use Tcl_EvalObjv() on the script
** rather than the more general Tcl_EvalEx().  Tcl_EvalObjv() is much
** faster.
**
** Scripts that are safe to use with Tcl_EvalObjv() consists of a
** command name followed by zero or more arguments with no [...] or $
** or {...} or ; to be seen anywhere.  Most callback scripts consist
** of just a single procedure name and they meet this requirement.
*/
static int safeToUseEvalObjv(Tcl_Interp *interp, Tcl_Obj *pCmd){
  /* We could try to do something with Tcl_Parse().  But we will instead
  ** just do a search for forbidden characters.  If any of the forbidden
  ** characters appear in pCmd, we will report the string as unsafe.
  */
  const char *z;
  int n;
  z = Tcl_GetStringFromObj(pCmd, &n);
  while( n-- > 0 ){
    int c = *(z++);
    if( c=='$' || c=='[' || c==';' ) return 0;
  }
  return 1;
}

/*
** Find an SqlFunc structure with the given name.  Or create a new
** one if an existing one cannot be found.  Return a pointer to the
** structure.
*/
static SqlFunc *findSqlFunc(SqliteDb *pDb, const char *zName){
  SqlFunc *p, *pNew;
  int i;
  pNew = (SqlFunc*)Tcl_Alloc( sizeof(*pNew) + strlen(zName) + 1 );
  pNew->zName = (char*)&pNew[1];
  for(i=0; zName[i]; i++){ pNew->zName[i] = tolower(zName[i]); }
  pNew->zName[i] = 0;
  for(p=pDb->pFunc; p; p=p->pNext){ 
    if( strcmp(p->zName, pNew->zName)==0 ){
      Tcl_Free((char*)pNew);
      return p;
    }
  }
  pNew->interp = pDb->interp;
  pNew->pScript = 0;
  pNew->pNext = pDb->pFunc;
  pDb->pFunc = pNew;
  return pNew;
}

/*
** Finalize and free a list of prepared statements
*/
static void flushStmtCache( SqliteDb *pDb ){
  SqlPreparedStmt *pPreStmt;

  while(  pDb->stmtList ){
    sqlite3_finalize( pDb->stmtList->pStmt );
    pPreStmt = pDb->stmtList;
    pDb->stmtList = pDb->stmtList->pNext;
    Tcl_Free( (char*)pPreStmt );
  }
  pDb->nStmt = 0;
  pDb->stmtLast = 0;
}

/*
** TCL calls this procedure when an sqlite3 database command is
** deleted.
*/
static void DbDeleteCmd(void *db){
  SqliteDb *pDb = (SqliteDb*)db;
  flushStmtCache(pDb);
  closeIncrblobChannels(pDb);
  sqlite3_close(pDb->db);
  while( pDb->pFunc ){
    SqlFunc *pFunc = pDb->pFunc;
    pDb->pFunc = pFunc->pNext;
    Tcl_DecrRefCount(pFunc->pScript);
    Tcl_Free((char*)pFunc);
  }
  while( pDb->pCollate ){
    SqlCollate *pCollate = pDb->pCollate;
    pDb->pCollate = pCollate->pNext;
    Tcl_Free((char*)pCollate);
  }
  if( pDb->zBusy ){
    Tcl_Free(pDb->zBusy);
  }
  if( pDb->zTrace ){
    Tcl_Free(pDb->zTrace);
  }
  if( pDb->zProfile ){
    Tcl_Free(pDb->zProfile);
  }
  if( pDb->zAuth ){
    Tcl_Free(pDb->zAuth);
  }
  if( pDb->zNull ){
    Tcl_Free(pDb->zNull);
  }
  if( pDb->pUpdateHook ){
    Tcl_DecrRefCount(pDb->pUpdateHook);
  }
  if( pDb->pRollbackHook ){
    Tcl_DecrRefCount(pDb->pRollbackHook);
  }
  if( pDb->pCollateNeeded ){
    Tcl_DecrRefCount(pDb->pCollateNeeded);
  }
  Tcl_Free((char*)pDb);
}

/*
** This routine is called when a database file is locked while trying
** to execute SQL.
*/
static int DbBusyHandler(void *cd, int nTries){
  SqliteDb *pDb = (SqliteDb*)cd;
  int rc;
  char zVal[30];

  sqlite3_snprintf(sizeof(zVal), zVal, "%d", nTries);
  rc = Tcl_VarEval(pDb->interp, pDb->zBusy, " ", zVal, (char*)0);
  if( rc!=TCL_OK || atoi(Tcl_GetStringResult(pDb->interp)) ){
    return 0;
  }
  return 1;
}

#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
/*
** This routine is invoked as the 'progress callback' for the database.
*/
static int DbProgressHandler(void *cd){
  SqliteDb *pDb = (SqliteDb*)cd;
  int rc;

  assert( pDb->zProgress );
  rc = Tcl_Eval(pDb->interp, pDb->zProgress);
  if( rc!=TCL_OK || atoi(Tcl_GetStringResult(pDb->interp)) ){
    return 1;
  }
  return 0;
}
#endif

#ifndef SQLITE_OMIT_TRACE
/*
** This routine is called by the SQLite trace handler whenever a new
** block of SQL is executed.  The TCL script in pDb->zTrace is executed.
*/
static void DbTraceHandler(void *cd, const char *zSql){
  SqliteDb *pDb = (SqliteDb*)cd;
  Tcl_DString str;

  Tcl_DStringInit(&str);
  Tcl_DStringAppend(&str, pDb->zTrace, -1);
  Tcl_DStringAppendElement(&str, zSql);
  Tcl_Eval(pDb->interp, Tcl_DStringValue(&str));
  Tcl_DStringFree(&str);
  Tcl_ResetResult(pDb->interp);
}
#endif

#ifndef SQLITE_OMIT_TRACE
/*
** This routine is called by the SQLite profile handler after a statement
** SQL has executed.  The TCL script in pDb->zProfile is evaluated.
*/
static void DbProfileHandler(void *cd, const char *zSql, sqlite_uint64 tm){
  SqliteDb *pDb = (SqliteDb*)cd;
  Tcl_DString str;
  char zTm[100];

  sqlite3_snprintf(sizeof(zTm)-1, zTm, "%lld", tm);
  Tcl_DStringInit(&str);
  Tcl_DStringAppend(&str, pDb->zProfile, -1);
  Tcl_DStringAppendElement(&str, zSql);
  Tcl_DStringAppendElement(&str, zTm);
  Tcl_Eval(pDb->interp, Tcl_DStringValue(&str));
  Tcl_DStringFree(&str);
  Tcl_ResetResult(pDb->interp);
}
#endif

/*
** This routine is called when a transaction is committed.  The
** TCL script in pDb->zCommit is executed.  If it returns non-zero or
** if it throws an exception, the transaction is rolled back instead
** of being committed.
*/
static int DbCommitHandler(void *cd){
  SqliteDb *pDb = (SqliteDb*)cd;
  int rc;

  rc = Tcl_Eval(pDb->interp, pDb->zCommit);
  if( rc!=TCL_OK || atoi(Tcl_GetStringResult(pDb->interp)) ){
    return 1;
  }
  return 0;
}

static void DbRollbackHandler(void *clientData){
  SqliteDb *pDb = (SqliteDb*)clientData;
  assert(pDb->pRollbackHook);
  if( TCL_OK!=Tcl_EvalObjEx(pDb->interp, pDb->pRollbackHook, 0) ){
    Tcl_BackgroundError(pDb->interp);
  }
}

static void DbUpdateHandler(
  void *p, 
  int op,
  const char *zDb, 
  const char *zTbl, 
  sqlite_int64 rowid
){
  SqliteDb *pDb = (SqliteDb *)p;
  Tcl_Obj *pCmd;

  assert( pDb->pUpdateHook );
  assert( op==SQLITE_INSERT || op==SQLITE_UPDATE || op==SQLITE_DELETE );

  pCmd = Tcl_DuplicateObj(pDb->pUpdateHook);
  Tcl_IncrRefCount(pCmd);
  Tcl_ListObjAppendElement(0, pCmd, Tcl_NewStringObj(
    ( (op==SQLITE_INSERT)?"INSERT":(op==SQLITE_UPDATE)?"UPDATE":"DELETE"), -1));
  Tcl_ListObjAppendElement(0, pCmd, Tcl_NewStringObj(zDb, -1));
  Tcl_ListObjAppendElement(0, pCmd, Tcl_NewStringObj(zTbl, -1));
  Tcl_ListObjAppendElement(0, pCmd, Tcl_NewWideIntObj(rowid));
  Tcl_EvalObjEx(pDb->interp, pCmd, TCL_EVAL_DIRECT);
}

static void tclCollateNeeded(
  void *pCtx,
  sqlite3 *db,
  int enc,
  const char *zName
){
  SqliteDb *pDb = (SqliteDb *)pCtx;
  Tcl_Obj *pScript = Tcl_DuplicateObj(pDb->pCollateNeeded);
  Tcl_IncrRefCount(pScript);
  Tcl_ListObjAppendElement(0, pScript, Tcl_NewStringObj(zName, -1));
  Tcl_EvalObjEx(pDb->interp, pScript, 0);
  Tcl_DecrRefCount(pScript);
}

/*
** This routine is called to evaluate an SQL collation function implemented
** using TCL script.
*/
static int tclSqlCollate(
  void *pCtx,
  int nA,
  const void *zA,
  int nB,
  const void *zB
){
  SqlCollate *p = (SqlCollate *)pCtx;
  Tcl_Obj *pCmd;

  pCmd = Tcl_NewStringObj(p->zScript, -1);
  Tcl_IncrRefCount(pCmd);
  Tcl_ListObjAppendElement(p->interp, pCmd, Tcl_NewStringObj(zA, nA));
  Tcl_ListObjAppendElement(p->interp, pCmd, Tcl_NewStringObj(zB, nB));
  Tcl_EvalObjEx(p->interp, pCmd, TCL_EVAL_DIRECT);
  Tcl_DecrRefCount(pCmd);
  return (atoi(Tcl_GetStringResult(p->interp)));
}

/*
** This routine is called to evaluate an SQL function implemented
** using TCL script.
*/
static void tclSqlFunc(sqlite3_context *context, int argc, sqlite3_value**argv){
  SqlFunc *p = sqlite3_user_data(context);
  Tcl_Obj *pCmd;
  int i;
  int rc;

  if( argc==0 ){
    /* If there are no arguments to the function, call Tcl_EvalObjEx on the
    ** script object directly.  This allows the TCL compiler to generate
    ** bytecode for the command on the first invocation and thus make
    ** subsequent invocations much faster. */
    pCmd = p->pScript;
    Tcl_IncrRefCount(pCmd);
    rc = Tcl_EvalObjEx(p->interp, pCmd, 0);
    Tcl_DecrRefCount(pCmd);
  }else{
    /* If there are arguments to the function, make a shallow copy of the
    ** script object, lappend the arguments, then evaluate the copy.
    **
    ** By "shallow" copy, we mean a only the outer list Tcl_Obj is duplicated.
    ** The new Tcl_Obj contains pointers to the original list elements. 
    ** That way, when Tcl_EvalObjv() is run and shimmers the first element
    ** of the list to tclCmdNameType, that alternate representation will
    ** be preserved and reused on the next invocation.
    */
    Tcl_Obj **aArg;
    int nArg;
    if( Tcl_ListObjGetElements(p->interp, p->pScript, &nArg, &aArg) ){
      sqlite3_result_error(context, Tcl_GetStringResult(p->interp), -1); 
      return;
    }     
    pCmd = Tcl_NewListObj(nArg, aArg);
    Tcl_IncrRefCount(pCmd);
    for(i=0; i<argc; i++){
      sqlite3_value *pIn = argv[i];
      Tcl_Obj *pVal;
            
      /* Set pVal to contain the i'th column of this row. */
      switch( sqlite3_value_type(pIn) ){
        case SQLITE_BLOB: {
          int bytes = sqlite3_value_bytes(pIn);
          pVal = Tcl_NewByteArrayObj(sqlite3_value_blob(pIn), bytes);
          break;
        }
        case SQLITE_INTEGER: {
          sqlite_int64 v = sqlite3_value_int64(pIn);
          if( v>=-2147483647 && v<=2147483647 ){
            pVal = Tcl_NewIntObj(v);
          }else{
            pVal = Tcl_NewWideIntObj(v);
          }
          break;
        }
        case SQLITE_FLOAT: {
          double r = sqlite3_value_double(pIn);
          pVal = Tcl_NewDoubleObj(r);
          break;
        }
        case SQLITE_NULL: {
          pVal = Tcl_NewStringObj("", 0);
          break;
        }
        default: {
          int bytes = sqlite3_value_bytes(pIn);
          pVal = Tcl_NewStringObj((char *)sqlite3_value_text(pIn), bytes);
          break;
        }
      }
      rc = Tcl_ListObjAppendElement(p->interp, pCmd, pVal);
      if( rc ){
        Tcl_DecrRefCount(pCmd);
        sqlite3_result_error(context, Tcl_GetStringResult(p->interp), -1); 
        return;
      }
    }
    if( !p->useEvalObjv ){
      /* Tcl_EvalObjEx() will automatically call Tcl_EvalObjv() if pCmd
      ** is a list without a string representation.  To prevent this from
      ** happening, make sure pCmd has a valid string representation */
      Tcl_GetString(pCmd);
    }
    rc = Tcl_EvalObjEx(p->interp, pCmd, TCL_EVAL_DIRECT);
    Tcl_DecrRefCount(pCmd);
  }

  if( rc && rc!=TCL_RETURN ){
    sqlite3_result_error(context, Tcl_GetStringResult(p->interp), -1); 
  }else{
    Tcl_Obj *pVar = Tcl_GetObjResult(p->interp);
    int n;
    u8 *data;
    char *zType = pVar->typePtr ? pVar->typePtr->name : "";
    char c = zType[0];
    if( c=='b' && strcmp(zType,"bytearray")==0 && pVar->bytes==0 ){
      /* Only return a BLOB type if the Tcl variable is a bytearray and
      ** has no string representation. */
      data = Tcl_GetByteArrayFromObj(pVar, &n);
      sqlite3_result_blob(context, data, n, SQLITE_TRANSIENT);
    }else if( c=='b' && strcmp(zType,"boolean")==0 ){
      Tcl_GetIntFromObj(0, pVar, &n);
      sqlite3_result_int(context, n);
    }else if( c=='d' && strcmp(zType,"double")==0 ){
      double r;
      Tcl_GetDoubleFromObj(0, pVar, &r);
      sqlite3_result_double(context, r);
    }else if( (c=='w' && strcmp(zType,"wideInt")==0) ||
          (c=='i' && strcmp(zType,"int")==0) ){
      Tcl_WideInt v;
      Tcl_GetWideIntFromObj(0, pVar, &v);
      sqlite3_result_int64(context, v);
    }else{
      data = (unsigned char *)Tcl_GetStringFromObj(pVar, &n);
      sqlite3_result_text(context, (char *)data, n, SQLITE_TRANSIENT);
    }
  }
}

#ifndef SQLITE_OMIT_AUTHORIZATION
/*
** This is the authentication function.  It appends the authentication
** type code and the two arguments to zCmd[] then invokes the result
** on the interpreter.  The reply is examined to determine if the
** authentication fails or succeeds.
*/
static int auth_callback(
  void *pArg,
  int code,
  const char *zArg1,
  const char *zArg2,
  const char *zArg3,
  const char *zArg4
){
  char *zCode;
  Tcl_DString str;
  int rc;
  const char *zReply;
  SqliteDb *pDb = (SqliteDb*)pArg;

  switch( code ){
    case SQLITE_COPY              : zCode="SQLITE_COPY"; break;
    case SQLITE_CREATE_INDEX      : zCode="SQLITE_CREATE_INDEX"; break;
    case SQLITE_CREATE_TABLE      : zCode="SQLITE_CREATE_TABLE"; break;
    case SQLITE_CREATE_TEMP_INDEX : zCode="SQLITE_CREATE_TEMP_INDEX"; break;
    case SQLITE_CREATE_TEMP_TABLE : zCode="SQLITE_CREATE_TEMP_TABLE"; break;
    case SQLITE_CREATE_TEMP_TRIGGER: zCode="SQLITE_CREATE_TEMP_TRIGGER"; break;
    case SQLITE_CREATE_TEMP_VIEW  : zCode="SQLITE_CREATE_TEMP_VIEW"; break;
    case SQLITE_CREATE_TRIGGER    : zCode="SQLITE_CREATE_TRIGGER"; break;
    case SQLITE_CREATE_VIEW       : zCode="SQLITE_CREATE_VIEW"; break;
    case SQLITE_DELETE            : zCode="SQLITE_DELETE"; break;
    case SQLITE_DROP_INDEX        : zCode="SQLITE_DROP_INDEX"; break;
    case SQLITE_DROP_TABLE        : zCode="SQLITE_DROP_TABLE"; break;
    case SQLITE_DROP_TEMP_INDEX   : zCode="SQLITE_DROP_TEMP_INDEX"; break;
    case SQLITE_DROP_TEMP_TABLE   : zCode="SQLITE_DROP_TEMP_TABLE"; break;
    case SQLITE_DROP_TEMP_TRIGGER : zCode="SQLITE_DROP_TEMP_TRIGGER"; break;
    case SQLITE_DROP_TEMP_VIEW    : zCode="SQLITE_DROP_TEMP_VIEW"; break;
    case SQLITE_DROP_TRIGGER      : zCode="SQLITE_DROP_TRIGGER"; break;
    case SQLITE_DROP_VIEW         : zCode="SQLITE_DROP_VIEW"; break;
    case SQLITE_INSERT            : zCode="SQLITE_INSERT"; break;
    case SQLITE_PRAGMA            : zCode="SQLITE_PRAGMA"; break;
    case SQLITE_READ              : zCode="SQLITE_READ"; break;
    case SQLITE_SELECT            : zCode="SQLITE_SELECT"; break;
    case SQLITE_TRANSACTION       : zCode="SQLITE_TRANSACTION"; break;
    case SQLITE_UPDATE            : zCode="SQLITE_UPDATE"; break;
    case SQLITE_ATTACH            : zCode="SQLITE_ATTACH"; break;
    case SQLITE_DETACH            : zCode="SQLITE_DETACH"; break;
    case SQLITE_ALTER_TABLE       : zCode="SQLITE_ALTER_TABLE"; break;
    case SQLITE_REINDEX           : zCode="SQLITE_REINDEX"; break;
    case SQLITE_ANALYZE           : zCode="SQLITE_ANALYZE"; break;
    case SQLITE_CREATE_VTABLE     : zCode="SQLITE_CREATE_VTABLE"; break;
    case SQLITE_DROP_VTABLE       : zCode="SQLITE_DROP_VTABLE"; break;
    case SQLITE_FUNCTION          : zCode="SQLITE_FUNCTION"; break;
    default                       : zCode="????"; break;
  }
  Tcl_DStringInit(&str);
  Tcl_DStringAppend(&str, pDb->zAuth, -1);
  Tcl_DStringAppendElement(&str, zCode);
  Tcl_DStringAppendElement(&str, zArg1 ? zArg1 : "");
  Tcl_DStringAppendElement(&str, zArg2 ? zArg2 : "");
  Tcl_DStringAppendElement(&str, zArg3 ? zArg3 : "");
  Tcl_DStringAppendElement(&str, zArg4 ? zArg4 : "");
  rc = Tcl_GlobalEval(pDb->interp, Tcl_DStringValue(&str));
  Tcl_DStringFree(&str);
  zReply = Tcl_GetStringResult(pDb->interp);
  if( strcmp(zReply,"SQLITE_OK")==0 ){
    rc = SQLITE_OK;
  }else if( strcmp(zReply,"SQLITE_DENY")==0 ){
    rc = SQLITE_DENY;
  }else if( strcmp(zReply,"SQLITE_IGNORE")==0 ){
    rc = SQLITE_IGNORE;
  }else{
    rc = 999;
  }
  return rc;
}
#endif /* SQLITE_OMIT_AUTHORIZATION */

/*
** zText is a pointer to text obtained via an sqlite3_result_text()
** or similar interface. This routine returns a Tcl string object, 
** reference count set to 0, containing the text. If a translation
** between iso8859 and UTF-8 is required, it is preformed.
*/
static Tcl_Obj *dbTextToObj(char const *zText){
  Tcl_Obj *pVal;
#ifdef UTF_TRANSLATION_NEEDED
  Tcl_DString dCol;
  Tcl_DStringInit(&dCol);
  Tcl_ExternalToUtfDString(NULL, zText, -1, &dCol);
  pVal = Tcl_NewStringObj(Tcl_DStringValue(&dCol), -1);
  Tcl_DStringFree(&dCol);
#else
  pVal = Tcl_NewStringObj(zText, -1);
#endif
  return pVal;
}

/*
** This routine reads a line of text from FILE in, stores
** the text in memory obtained from malloc() and returns a pointer
** to the text.  NULL is returned at end of file, or if malloc()
** fails.
**
** The interface is like "readline" but no command-line editing
** is done.
**
** copied from shell.c from '.import' command
*/
static char *local_getline(char *zPrompt, FILE *in){
  char *zLine;
  int nLine;
  int n;
  int eol;

  nLine = 100;
  zLine = malloc( nLine );
  if( zLine==0 ) return 0;
  n = 0;
  eol = 0;
  while( !eol ){
    if( n+100>nLine ){
      nLine = nLine*2 + 100;
      zLine = realloc(zLine, nLine);
      if( zLine==0 ) return 0;
    }
    if( fgets(&zLine[n], nLine - n, in)==0 ){
      if( n==0 ){
        free(zLine);
        return 0;
      }
      zLine[n] = 0;
      eol = 1;
      break;
    }
    while( zLine[n] ){ n++; }
    if( n>0 && zLine[n-1]=='\n' ){
      n--;
      zLine[n] = 0;
      eol = 1;
    }
  }
  zLine = realloc( zLine, n+1 );
  return zLine;
}


/*
** Figure out the column names for the data returned by the statement
** passed as the second argument.
**
** If parameter papColName is not NULL, then *papColName is set to point
** at an array allocated using Tcl_Alloc(). It is the callers responsibility
** to free this array using Tcl_Free(), and to decrement the reference
** count of each Tcl_Obj* member of the array.
**
** The return value of this function is the number of columns of data
** returned by pStmt (and hence the size of the *papColName array).
**
** If pArray is not NULL, then it contains the name of a Tcl array
** variable. The "*" member of this array is set to a list containing
** the names of the columns returned by the statement, in order from
** left to right. e.g. if the names of the returned columns are a, b and
** c, it does the equivalent of the tcl command:
**
**     set ${pArray}(*) {a b c}
*/
static int
computeColumnNames(
  Tcl_Interp *interp, 
  sqlite3_stmt *pStmt,              /* SQL statement */
  Tcl_Obj ***papColName,            /* OUT: Array of column names */
  Tcl_Obj *pArray                   /* Name of array variable (may be null) */
){
  int nCol;

  /* Compute column names */
  nCol = sqlite3_column_count(pStmt);
  if( papColName ){
    int i;
    Tcl_Obj **apColName = (Tcl_Obj**)Tcl_Alloc( sizeof(Tcl_Obj*)*nCol );
    for(i=0; i<nCol; i++){
      apColName[i] = dbTextToObj(sqlite3_column_name(pStmt,i));
      Tcl_IncrRefCount(apColName[i]);
    }

    /* If results are being stored in an array variable, then create
    ** the array(*) entry for that array
    */
    if( pArray ){
      Tcl_Obj *pColList = Tcl_NewObj();
      Tcl_Obj *pStar = Tcl_NewStringObj("*", -1);
      Tcl_IncrRefCount(pColList);
      for(i=0; i<nCol; i++){
        Tcl_ListObjAppendElement(interp, pColList, apColName[i]);
      }
      Tcl_IncrRefCount(pStar);
      Tcl_ObjSetVar2(interp, pArray, pStar, pColList,0);
      Tcl_DecrRefCount(pColList);
      Tcl_DecrRefCount(pStar);
    }
    *papColName = apColName;
  }

  return nCol;
}

/*
** The "sqlite" command below creates a new Tcl command for each
** connection it opens to an SQLite database.  This routine is invoked
** whenever one of those connection-specific commands is executed
** in Tcl.  For example, if you run Tcl code like this:
**
**       sqlite3 db1  "my_database"
**       db1 close
**
** The first command opens a connection to the "my_database" database
** and calls that connection "db1".  The second command causes this
** subroutine to be invoked.
*/
static int DbObjCmd(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
  SqliteDb *pDb = (SqliteDb*)cd;
  int choice;
  int rc = TCL_OK;
  static const char *DB_strs[] = {
    "authorizer",         "busy",              "cache",
    "changes",            "close",             "collate",
    "collation_needed",   "commit_hook",       "complete",
    "copy",               "enable_load_extension","errorcode",
    "eval",               "exists",            "function",
    "incrblob",           "interrupt",         "last_insert_rowid",
    "nullvalue",          "onecolumn",         "profile",
    "progress",           "rekey",             "rollback_hook",
    "timeout",            "total_changes",     "trace",
    "transaction",        "update_hook",       "version",
    0                    
  };
  enum DB_enum {
    DB_AUTHORIZER,        DB_BUSY,             DB_CACHE,
    DB_CHANGES,           DB_CLOSE,            DB_COLLATE,
    DB_COLLATION_NEEDED,  DB_COMMIT_HOOK,      DB_COMPLETE,
    DB_COPY,              DB_ENABLE_LOAD_EXTENSION,DB_ERRORCODE,
    DB_EVAL,              DB_EXISTS,           DB_FUNCTION,
    DB_INCRBLOB,          DB_INTERRUPT,        DB_LAST_INSERT_ROWID,
    DB_NULLVALUE,         DB_ONECOLUMN,        DB_PROFILE,
    DB_PROGRESS,          DB_REKEY,            DB_ROLLBACK_HOOK,
    DB_TIMEOUT,           DB_TOTAL_CHANGES,    DB_TRACE,
    DB_TRANSACTION,       DB_UPDATE_HOOK,      DB_VERSION
  };
  /* don't leave trailing commas on DB_enum, it confuses the AIX xlc compiler */

  if( objc<2 ){
    Tcl_WrongNumArgs(interp, 1, objv, "SUBCOMMAND ...");
    return TCL_ERROR;
  }
  if( Tcl_GetIndexFromObj(interp, objv[1], DB_strs, "option", 0, &choice) ){
    return TCL_ERROR;
  }

  switch( (enum DB_enum)choice ){

  /*    $db authorizer ?CALLBACK?
  **
  ** Invoke the given callback to authorize each SQL operation as it is
  ** compiled.  5 arguments are appended to the callback before it is
  ** invoked:
  **
  **   (1) The authorization type (ex: SQLITE_CREATE_TABLE, SQLITE_INSERT, ...)
  **   (2) First descriptive name (depends on authorization type)
  **   (3) Second descriptive name
  **   (4) Name of the database (ex: "main", "temp")
  **   (5) Name of trigger that is doing the access
  **
  ** The callback should return on of the following strings: SQLITE_OK,
  ** SQLITE_IGNORE, or SQLITE_DENY.  Any other return value is an error.
  **
  ** If this method is invoked with no arguments, the current authorization
  ** callback string is returned.
  */
  case DB_AUTHORIZER: {
#ifdef SQLITE_OMIT_AUTHORIZATION
    Tcl_AppendResult(interp, "authorization not available in this build", 0);
    return TCL_ERROR;
#else
    if( objc>3 ){
      Tcl_WrongNumArgs(interp, 2, objv, "?CALLBACK?");
      return TCL_ERROR;
    }else if( objc==2 ){
      if( pDb->zAuth ){
        Tcl_AppendResult(interp, pDb->zAuth, 0);
      }
    }else{
      char *zAuth;
      int len;
      if( pDb->zAuth ){
        Tcl_Free(pDb->zAuth);
      }
      zAuth = Tcl_GetStringFromObj(objv[2], &len);
      if( zAuth && len>0 ){
        pDb->zAuth = Tcl_Alloc( len + 1 );
        memcpy(pDb->zAuth, zAuth, len+1);
      }else{
        pDb->zAuth = 0;
      }
      if( pDb->zAuth ){
        pDb->interp = interp;
        sqlite3_set_authorizer(pDb->db, auth_callback, pDb);
      }else{
        sqlite3_set_authorizer(pDb->db, 0, 0);
      }
    }
#endif
    break;
  }

  /*    $db busy ?CALLBACK?
  **
  ** Invoke the given callback if an SQL statement attempts to open
  ** a locked database file.
  */
  case DB_BUSY: {
    if( objc>3 ){
      Tcl_WrongNumArgs(interp, 2, objv, "CALLBACK");
      return TCL_ERROR;
    }else if( objc==2 ){
      if( pDb->zBusy ){
        Tcl_AppendResult(interp, pDb->zBusy, 0);
      }
    }else{
      char *zBusy;
      int len;
      if( pDb->zBusy ){
        Tcl_Free(pDb->zBusy);
      }
      zBusy = Tcl_GetStringFromObj(objv[2], &len);
      if( zBusy && len>0 ){
        pDb->zBusy = Tcl_Alloc( len + 1 );
        memcpy(pDb->zBusy, zBusy, len+1);
      }else{
        pDb->zBusy = 0;
      }
      if( pDb->zBusy ){
        pDb->interp = interp;
        sqlite3_busy_handler(pDb->db, DbBusyHandler, pDb);
      }else{
        sqlite3_busy_handler(pDb->db, 0, 0);
      }
    }
    break;
  }

  /*     $db cache flush
  **     $db cache size n
  **
  ** Flush the prepared statement cache, or set the maximum number of
  ** cached statements.
  */
  case DB_CACHE: {
    char *subCmd;
    int n;

    if( objc<=2 ){
      Tcl_WrongNumArgs(interp, 1, objv, "cache option ?arg?");
      return TCL_ERROR;
    }
    subCmd = Tcl_GetStringFromObj( objv[2], 0 );
    if( *subCmd=='f' && strcmp(subCmd,"flush")==0 ){
      if( objc!=3 ){
        Tcl_WrongNumArgs(interp, 2, objv, "flush");
        return TCL_ERROR;
      }else{
        flushStmtCache( pDb );
      }
    }else if( *subCmd=='s' && strcmp(subCmd,"size")==0 ){
      if( objc!=4 ){
        Tcl_WrongNumArgs(interp, 2, objv, "size n");
        return TCL_ERROR;
      }else{
        if( TCL_ERROR==Tcl_GetIntFromObj(interp, objv[3], &n) ){
          Tcl_AppendResult( interp, "cannot convert \"", 
               Tcl_GetStringFromObj(objv[3],0), "\" to integer", 0);
          return TCL_ERROR;
        }else{
          if( n<0 ){
            flushStmtCache( pDb );
            n = 0;
          }else if( n>MAX_PREPARED_STMTS ){
            n = MAX_PREPARED_STMTS;
          }
          pDb->maxStmt = n;
        }
      }
    }else{
      Tcl_AppendResult( interp, "bad option \"", 
          Tcl_GetStringFromObj(objv[2],0), "\": must be flush or size", 0);
      return TCL_ERROR;
    }
    break;
  }

  /*     $db changes
  **
  ** Return the number of rows that were modified, inserted, or deleted by
  ** the most recent INSERT, UPDATE or DELETE statement, not including 
  ** any changes made by trigger programs.
  */
  case DB_CHANGES: {
    Tcl_Obj *pResult;
    if( objc!=2 ){
      Tcl_WrongNumArgs(interp, 2, objv, "");
      return TCL_ERROR;
    }
    pResult = Tcl_GetObjResult(interp);
    Tcl_SetIntObj(pResult, sqlite3_changes(pDb->db));
    break;
  }

  /*    $db close
  **
  ** Shutdown the database
  */
  case DB_CLOSE: {
    Tcl_DeleteCommand(interp, Tcl_GetStringFromObj(objv[0], 0));
    break;
  }

  /*
  **     $db collate NAME SCRIPT
  **
  ** Create a new SQL collation function called NAME.  Whenever
  ** that function is called, invoke SCRIPT to evaluate the function.
  */
  case DB_COLLATE: {
    SqlCollate *pCollate;
    char *zName;
    char *zScript;
    int nScript;
    if( objc!=4 ){
      Tcl_WrongNumArgs(interp, 2, objv, "NAME SCRIPT");
      return TCL_ERROR;
    }
    zName = Tcl_GetStringFromObj(objv[2], 0);
    zScript = Tcl_GetStringFromObj(objv[3], &nScript);
    pCollate = (SqlCollate*)Tcl_Alloc( sizeof(*pCollate) + nScript + 1 );
    if( pCollate==0 ) return TCL_ERROR;
    pCollate->interp = interp;
    pCollate->pNext = pDb->pCollate;
    pCollate->zScript = (char*)&pCollate[1];
    pDb->pCollate = pCollate;
    memcpy(pCollate->zScript, zScript, nScript+1);
    if( sqlite3_create_collation(pDb->db, zName, SQLITE_UTF8, 
        pCollate, tclSqlCollate) ){
      Tcl_SetResult(interp, (char *)sqlite3_errmsg(pDb->db), TCL_VOLATILE);
      return TCL_ERROR;
    }
    break;
  }

  /*
  **     $db collation_needed SCRIPT
  **
  ** Create a new SQL collation function called NAME.  Whenever
  ** that function is called, invoke SCRIPT to evaluate the function.
  */
  case DB_COLLATION_NEEDED: {
    if( objc!=3 ){
      Tcl_WrongNumArgs(interp, 2, objv, "SCRIPT");
      return TCL_ERROR;
    }
    if( pDb->pCollateNeeded ){
      Tcl_DecrRefCount(pDb->pCollateNeeded);
    }
    pDb->pCollateNeeded = Tcl_DuplicateObj(objv[2]);
    Tcl_IncrRefCount(pDb->pCollateNeeded);
    sqlite3_collation_needed(pDb->db, pDb, tclCollateNeeded);
    break;
  }

  /*    $db commit_hook ?CALLBACK?
  **
  ** Invoke the given callback just before committing every SQL transaction.
  ** If the callback throws an exception or returns non-zero, then the
  ** transaction is aborted.  If CALLBACK is an empty string, the callback
  ** is disabled.
  */
  case DB_COMMIT_HOOK: {
    if( objc>3 ){
      Tcl_WrongNumArgs(interp, 2, objv, "?CALLBACK?");
      return TCL_ERROR;
    }else if( objc==2 ){
      if( pDb->zCommit ){
        Tcl_AppendResult(interp, pDb->zCommit, 0);
      }
    }else{
      char *zCommit;
      int len;
      if( pDb->zCommit ){
        Tcl_Free(pDb->zCommit);
      }
      zCommit = Tcl_GetStringFromObj(objv[2], &len);
      if( zCommit && len>0 ){
        pDb->zCommit = Tcl_Alloc( len + 1 );
        memcpy(pDb->zCommit, zCommit, len+1);
      }else{
        pDb->zCommit = 0;
      }
      if( pDb->zCommit ){
        pDb->interp = interp;
        sqlite3_commit_hook(pDb->db, DbCommitHandler, pDb);
      }else{
        sqlite3_commit_hook(pDb->db, 0, 0);
      }
    }
    break;
  }

  /*    $db complete SQL
  **
  ** Return TRUE if SQL is a complete SQL statement.  Return FALSE if
  ** additional lines of input are needed.  This is similar to the
  ** built-in "info complete" command of Tcl.
  */
  case DB_COMPLETE: {
#ifndef SQLITE_OMIT_COMPLETE
    Tcl_Obj *pResult;
    int isComplete;
    if( objc!=3 ){
      Tcl_WrongNumArgs(interp, 2, objv, "SQL");
      return TCL_ERROR;
    }
    isComplete = sqlite3_complete( Tcl_GetStringFromObj(objv[2], 0) );
    pResult = Tcl_GetObjResult(interp);
    Tcl_SetBooleanObj(pResult, isComplete);
#endif
    break;
  }

  /*    $db copy conflict-algorithm table filename ?SEPARATOR? ?NULLINDICATOR?
  **
  ** Copy data into table from filename, optionally using SEPARATOR
  ** as column separators.  If a column contains a null string, or the
  ** value of NULLINDICATOR, a NULL is inserted for the column.
  ** conflict-algorithm is one of the sqlite conflict algorithms:
  **    rollback, abort, fail, ignore, replace
  ** On success, return the number of lines processed, not necessarily same
  ** as 'db changes' due to conflict-algorithm selected.
  **
  ** This code is basically an implementation/enhancement of
  ** the sqlite3 shell.c ".import" command.
  **
  ** This command usage is equivalent to the sqlite2.x COPY statement,
  ** which imports file data into a table using the PostgreSQL COPY file format:
  **   $db copy $conflit_algo $table_name $filename \t \\N
  */
  case DB_COPY: {
    char *zTable;               /* Insert data into this table */
    char *zFile;                /* The file from which to extract data */
    char *zConflict;            /* The conflict algorithm to use */
    sqlite3_stmt *pStmt;        /* A statement */
    int nCol;                   /* Number of columns in the table */
    int nByte;                  /* Number of bytes in an SQL string */
    int i, j;                   /* Loop counters */
    int nSep;                   /* Number of bytes in zSep[] */
    int nNull;                  /* Number of bytes in zNull[] */
    char *zSql;                 /* An SQL statement */
    char *zLine;                /* A single line of input from the file */
    char **azCol;               /* zLine[] broken up into columns */
    char *zCommit;              /* How to commit changes */
    FILE *in;                   /* The input file */
    int lineno = 0;             /* Line number of input file */
    char zLineNum[80];          /* Line number print buffer */
    Tcl_Obj *pResult;           /* interp result */

    char *zSep;
    char *zNull;
    if( objc<5 || objc>7 ){
      Tcl_WrongNumArgs(interp, 2, objv, 
         "CONFLICT-ALGORITHM TABLE FILENAME ?SEPARATOR? ?NULLINDICATOR?");
      return TCL_ERROR;
    }
    if( objc>=6 ){
      zSep = Tcl_GetStringFromObj(objv[5], 0);
    }else{
      zSep = "\t";
    }
    if( objc>=7 ){
      zNull = Tcl_GetStringFromObj(objv[6], 0);
    }else{
      zNull = "";
    }
    zConflict = Tcl_GetStringFromObj(objv[2], 0);
    zTable = Tcl_GetStringFromObj(objv[3], 0);
    zFile = Tcl_GetStringFromObj(objv[4], 0);
    nSep = strlen(zSep);
    nNull = strlen(zNull);
    if( nSep==0 ){
      Tcl_AppendResult(interp,"Error: non-null separator required for copy",0);
      return TCL_ERROR;
    }
    if(strcasecmp(zConflict, "rollback") != 0 &&
       strcasecmp(zConflict, "abort"   ) != 0 &&
       strcasecmp(zConflict, "fail"    ) != 0 &&
       strcasecmp(zConflict, "ignore"  ) != 0 &&
       strcasecmp(zConflict, "replace" ) != 0 ) {
      Tcl_AppendResult(interp, "Error: \"", zConflict, 
            "\", conflict-algorithm must be one of: rollback, "
            "abort, fail, ignore, or replace", 0);
      return TCL_ERROR;
    }
    zSql = sqlite3_mprintf("SELECT * FROM '%q'", zTable);
    if( zSql==0 ){
      Tcl_AppendResult(interp, "Error: no such table: ", zTable, 0);
      return TCL_ERROR;
    }
    nByte = strlen(zSql);
    rc = sqlite3_prepare(pDb->db, zSql, -1, &pStmt, 0);
    sqlite3_free(zSql);
    if( rc ){
      Tcl_AppendResult(interp, "Error: ", sqlite3_errmsg(pDb->db), 0);
      nCol = 0;
    }else{
      nCol = sqlite3_column_count(pStmt);
    }
    sqlite3_finalize(pStmt);
    if( nCol==0 ) {
      return TCL_ERROR;
    }
    zSql = malloc( nByte + 50 + nCol*2 );
    if( zSql==0 ) {
      Tcl_AppendResult(interp, "Error: can't malloc()", 0);
      return TCL_ERROR;
    }
    sqlite3_snprintf(nByte+50, zSql, "INSERT OR %q INTO '%q' VALUES(?",
         zConflict, zTable);
    j = strlen(zSql);
    for(i=1; i<nCol; i++){
      zSql[j++] = ',';
      zSql[j++] = '?';
    }
    zSql[j++] = ')';
    zSql[j] = 0;
    rc = sqlite3_prepare(pDb->db, zSql, -1, &pStmt, 0);
    free(zSql);
    if( rc ){
      Tcl_AppendResult(interp, "Error: ", sqlite3_errmsg(pDb->db), 0);
      sqlite3_finalize(pStmt);
      return TCL_ERROR;
    }
    in = fopen(zFile, "rb");
    if( in==0 ){
      Tcl_AppendResult(interp, "Error: cannot open file: ", zFile, NULL);
      sqlite3_finalize(pStmt);
      return TCL_ERROR;
    }
    azCol = malloc( sizeof(azCol[0])*(nCol+1) );
    if( azCol==0 ) {
      Tcl_AppendResult(interp, "Error: can't malloc()", 0);
      fclose(in);
      return TCL_ERROR;
    }
    (void)sqlite3_exec(pDb->db, "BEGIN", 0, 0, 0);
    zCommit = "COMMIT";
    while( (zLine = local_getline(0, in))!=0 ){
      char *z;
      i = 0;
      lineno++;
      azCol[0] = zLine;
      for(i=0, z=zLine; *z; z++){
        if( *z==zSep[0] && strncmp(z, zSep, nSep)==0 ){
          *z = 0;
          i++;
          if( i<nCol ){
            azCol[i] = &z[nSep];
            z += nSep-1;
          }
        }
      }
      if( i+1!=nCol ){
        char *zErr;
        int nErr = strlen(zFile) + 200;
        zErr = malloc(nErr);
        if( zErr ){
          sqlite3_snprintf(nErr, zErr,
             "Error: %s line %d: expected %d columns of data but found %d",
             zFile, lineno, nCol, i+1);
          Tcl_AppendResult(interp, zErr, 0);
          free(zErr);
        }
        zCommit = "ROLLBACK";
        break;
      }
      for(i=0; i<nCol; i++){
        /* check for null data, if so, bind as null */
        if ((nNull>0 && strcmp(azCol[i], zNull)==0) || strlen(azCol[i])==0) {
          sqlite3_bind_null(pStmt, i+1);
        }else{
          sqlite3_bind_text(pStmt, i+1, azCol[i], -1, SQLITE_STATIC);
        }
      }
      sqlite3_step(pStmt);
      rc = sqlite3_reset(pStmt);
      free(zLine);
      if( rc!=SQLITE_OK ){
        Tcl_AppendResult(interp,"Error: ", sqlite3_errmsg(pDb->db), 0);
        zCommit = "ROLLBACK";
        break;
      }
    }
    free(azCol);
    fclose(in);
    sqlite3_finalize(pStmt);
    (void)sqlite3_exec(pDb->db, zCommit, 0, 0, 0);

    if( zCommit[0] == 'C' ){
      /* success, set result as number of lines processed */
      pResult = Tcl_GetObjResult(interp);
      Tcl_SetIntObj(pResult, lineno);
      rc = TCL_OK;
    }else{
      /* failure, append lineno where failed */
      sqlite3_snprintf(sizeof(zLineNum), zLineNum,"%d",lineno);
      Tcl_AppendResult(interp,", failed while processing line: ",zLineNum,0);
      rc = TCL_ERROR;
    }
    break;
  }

  /*
  **    $db enable_load_extension BOOLEAN
  **
  ** Turn the extension loading feature on or off.  It if off by
  ** default.
  */
  case DB_ENABLE_LOAD_EXTENSION: {
#ifndef SQLITE_OMIT_LOAD_EXTENSION
    int onoff;
    if( objc!=3 ){
      Tcl_WrongNumArgs(interp, 2, objv, "BOOLEAN");
      return TCL_ERROR;
    }
    if( Tcl_GetBooleanFromObj(interp, objv[2], &onoff) ){
      return TCL_ERROR;
    }
    sqlite3_enable_load_extension(pDb->db, onoff);
    break;
#else
    Tcl_AppendResult(interp, "extension loading is turned off at compile-time",
                     0);
    return TCL_ERROR;
#endif
  }

  /*
  **    $db errorcode
  **
  ** Return the numeric error code that was returned by the most recent
  ** call to sqlite3_exec().
  */
  case DB_ERRORCODE: {
    Tcl_SetObjResult(interp, Tcl_NewIntObj(sqlite3_errcode(pDb->db)));
    break;
  }
   
  /*
  **    $db eval $sql ?array? ?{  ...code... }?
  **    $db onecolumn $sql
  **
  ** The SQL statement in $sql is evaluated.  For each row, the values are
  ** placed in elements of the array named "array" and ...code... is executed.
  ** If "array" and "code" are omitted, then no callback is every invoked.
  ** If "array" is an empty string, then the values are placed in variables
  ** that have the same name as the fields extracted by the query.
  **
  ** The onecolumn method is the equivalent of:
  **     lindex [$db eval $sql] 0
  */
  case DB_ONECOLUMN:
  case DB_EVAL:
  case DB_EXISTS: {
    char const *zSql;      /* Next SQL statement to execute */
    char const *zLeft;     /* What is left after first stmt in zSql */
    sqlite3_stmt *pStmt;   /* Compiled SQL statment */
    Tcl_Obj *pArray;       /* Name of array into which results are written */
    Tcl_Obj *pScript;      /* Script to run for each result set */
    Tcl_Obj **apParm;      /* Parameters that need a Tcl_DecrRefCount() */
    int nParm;             /* Number of entries used in apParm[] */
    Tcl_Obj *aParm[10];    /* Static space for apParm[] in the common case */
    Tcl_Obj *pRet;         /* Value to be returned */
    SqlPreparedStmt *pPreStmt;  /* Pointer to a prepared statement */
    int rc2;

    if( choice==DB_EVAL ){
      if( objc<3 || objc>5 ){
        Tcl_WrongNumArgs(interp, 2, objv, "SQL ?ARRAY-NAME? ?SCRIPT?");
        return TCL_ERROR;
      }
      pRet = Tcl_NewObj();
      Tcl_IncrRefCount(pRet);
    }else{
      if( objc!=3 ){
        Tcl_WrongNumArgs(interp, 2, objv, "SQL");
        return TCL_ERROR;
      }
      if( choice==DB_EXISTS ){
        pRet = Tcl_NewBooleanObj(0);
        Tcl_IncrRefCount(pRet);
      }else{
        pRet = 0;
      }
    }
    if( objc==3 ){
      pArray = pScript = 0;
    }else if( objc==4 ){
      pArray = 0;
      pScript = objv[3];
    }else{
      pArray = objv[3];
      if( Tcl_GetString(pArray)[0]==0 ) pArray = 0;
      pScript = objv[4];
    }

    Tcl_IncrRefCount(objv[2]);
    zSql = Tcl_GetStringFromObj(objv[2], 0);
    while( rc==TCL_OK && zSql[0] ){
      int i;                     /* Loop counter */
      int nVar;                  /* Number of bind parameters in the pStmt */
      int nCol = -1;             /* Number of columns in the result set */
      Tcl_Obj **apColName = 0;   /* Array of column names */
      int len;                   /* String length of zSql */
  
      /* Try to find a SQL statement that has already been compiled and
      ** which matches the next sequence of SQL.
      */
      pStmt = 0;
      len = strlen(zSql);
      for(pPreStmt = pDb->stmtList; pPreStmt; pPreStmt=pPreStmt->pNext){
        int n = pPreStmt->nSql;
        if( len>=n 
            && memcmp(pPreStmt->zSql, zSql, n)==0
            && (zSql[n]==0 || zSql[n-1]==';')
        ){
          pStmt = pPreStmt->pStmt;
          zLeft = &zSql[pPreStmt->nSql];

          /* When a prepared statement is found, unlink it from the
          ** cache list.  It will later be added back to the beginning
          ** of the cache list in order to implement LRU replacement.
          */
          if( pPreStmt->pPrev ){
            pPreStmt->pPrev->pNext = pPreStmt->pNext;
          }else{
            pDb->stmtList = pPreStmt->pNext;
          }
          if( pPreStmt->pNext ){
            pPreStmt->pNext->pPrev = pPreStmt->pPrev;
          }else{
            pDb->stmtLast = pPreStmt->pPrev;
          }
          pDb->nStmt--;
          break;
        }
      }
  
      /* If no prepared statement was found.  Compile the SQL text
      */
      if( pStmt==0 ){
        if( SQLITE_OK!=sqlite3_prepare_v2(pDb->db, zSql, -1, &pStmt, &zLeft) ){
          Tcl_SetObjResult(interp, dbTextToObj(sqlite3_errmsg(pDb->db)));
          rc = TCL_ERROR;
          break;
        }
        if( pStmt==0 ){
          if( SQLITE_OK!=sqlite3_errcode(pDb->db) ){
            /* A compile-time error in the statement
            */
            Tcl_SetObjResult(interp, dbTextToObj(sqlite3_errmsg(pDb->db)));
            rc = TCL_ERROR;
            break;
          }else{
            /* The statement was a no-op.  Continue to the next statement
            ** in the SQL string.
            */
            zSql = zLeft;
            continue;
          }
        }
        assert( pPreStmt==0 );
      }

      /* Bind values to parameters that begin with $ or :
      */  
      nVar = sqlite3_bind_parameter_count(pStmt);
      nParm = 0;
      if( nVar>sizeof(aParm)/sizeof(aParm[0]) ){
        apParm = (Tcl_Obj**)Tcl_Alloc(nVar*sizeof(apParm[0]));
      }else{
        apParm = aParm;
      }
      for(i=1; i<=nVar; i++){
        const char *zVar = sqlite3_bind_parameter_name(pStmt, i);
        if( zVar!=0 && (zVar[0]=='$' || zVar[0]==':' || zVar[0]=='@') ){
          Tcl_Obj *pVar = Tcl_GetVar2Ex(interp, &zVar[1], 0, 0);
          if( pVar ){
            int n;
            u8 *data;
            char *zType = pVar->typePtr ? pVar->typePtr->name : "";
            char c = zType[0];
            if( zVar[0]=='@' ||
               (c=='b' && strcmp(zType,"bytearray")==0 && pVar->bytes==0) ){
              /* Load a BLOB type if the Tcl variable is a bytearray and
              ** it has no string representation or the host
              ** parameter name begins with "@". */
              data = Tcl_GetByteArrayFromObj(pVar, &n);
              sqlite3_bind_blob(pStmt, i, data, n, SQLITE_STATIC);
              Tcl_IncrRefCount(pVar);
              apParm[nParm++] = pVar;
            }else if( c=='b' && strcmp(zType,"boolean")==0 ){
              Tcl_GetIntFromObj(interp, pVar, &n);
              sqlite3_bind_int(pStmt, i, n);
            }else if( c=='d' && strcmp(zType,"double")==0 ){
              double r;
              Tcl_GetDoubleFromObj(interp, pVar, &r);
              sqlite3_bind_double(pStmt, i, r);
            }else if( (c=='w' && strcmp(zType,"wideInt")==0) ||
                  (c=='i' && strcmp(zType,"int")==0) ){
              Tcl_WideInt v;
              Tcl_GetWideIntFromObj(interp, pVar, &v);
              sqlite3_bind_int64(pStmt, i, v);
            }else{
              data = (unsigned char *)Tcl_GetStringFromObj(pVar, &n);
              sqlite3_bind_text(pStmt, i, (char *)data, n, SQLITE_STATIC);
              Tcl_IncrRefCount(pVar);
              apParm[nParm++] = pVar;
            }
          }else{
            sqlite3_bind_null( pStmt, i );
          }
        }
      }

      /* Execute the SQL
      */
      while( rc==TCL_OK && pStmt && SQLITE_ROW==sqlite3_step(pStmt) ){

	/* Compute column names. This must be done after the first successful
	** call to sqlite3_step(), in case the query is recompiled and the
        ** number or names of the returned columns changes. 
        */
        assert(!pArray||pScript);
        if (nCol < 0) {
          Tcl_Obj ***ap = (pScript?&apColName:0);
          nCol = computeColumnNames(interp, pStmt, ap, pArray);
        }

        for(i=0; i<nCol; i++){
          Tcl_Obj *pVal;
          
          /* Set pVal to contain the i'th column of this row. */
          switch( sqlite3_column_type(pStmt, i) ){
            case SQLITE_BLOB: {
              int bytes = sqlite3_column_bytes(pStmt, i);
              const char *zBlob = sqlite3_column_blob(pStmt, i);
              if( !zBlob ) bytes = 0;
              pVal = Tcl_NewByteArrayObj((u8*)zBlob, bytes);
              break;
            }
            case SQLITE_INTEGER: {
              sqlite_int64 v = sqlite3_column_int64(pStmt, i);
              if( v>=-2147483647 && v<=2147483647 ){
                pVal = Tcl_NewIntObj(v);
              }else{
                pVal = Tcl_NewWideIntObj(v);
              }
              break;
            }
            case SQLITE_FLOAT: {
              double r = sqlite3_column_double(pStmt, i);
              pVal = Tcl_NewDoubleObj(r);
              break;
            }
            case SQLITE_NULL: {
              pVal = dbTextToObj(pDb->zNull);
              break;
            }
            default: {
              pVal = dbTextToObj((char *)sqlite3_column_text(pStmt, i));
              break;
            }
          }
  
          if( pScript ){
            if( pArray==0 ){
              Tcl_ObjSetVar2(interp, apColName[i], 0, pVal, 0);
            }else{
              Tcl_ObjSetVar2(interp, pArray, apColName[i], pVal, 0);
            }
          }else if( choice==DB_ONECOLUMN ){
            assert( pRet==0 );
            if( pRet==0 ){
              pRet = pVal;
              Tcl_IncrRefCount(pRet);
            }
            rc = TCL_BREAK;
            i = nCol;
          }else if( choice==DB_EXISTS ){
            Tcl_DecrRefCount(pRet);
            pRet = Tcl_NewBooleanObj(1);
            Tcl_IncrRefCount(pRet);
            rc = TCL_BREAK;
            i = nCol;
          }else{
            Tcl_ListObjAppendElement(interp, pRet, pVal);
          }
        }
  
        if( pScript ){
          rc = Tcl_EvalObjEx(interp, pScript, 0);
          if( rc==TCL_CONTINUE ){
            rc = TCL_OK;
          }
        }
      }
      if( rc==TCL_BREAK ){
        rc = TCL_OK;
      }

      /* Free the column name objects */
      if( pScript ){
        /* If the query returned no rows, but an array variable was 
        ** specified, call computeColumnNames() now to populate the 
        ** arrayname(*) variable.
        */
        if (pArray && nCol < 0) {
          Tcl_Obj ***ap = (pScript?&apColName:0);
          nCol = computeColumnNames(interp, pStmt, ap, pArray);
        }
        for(i=0; i<nCol; i++){
          Tcl_DecrRefCount(apColName[i]);
        }
        Tcl_Free((char*)apColName);
      }

      /* Free the bound string and blob parameters */
      for(i=0; i<nParm; i++){
        Tcl_DecrRefCount(apParm[i]);
      }
      if( apParm!=aParm ){
        Tcl_Free((char*)apParm);
      }

      /* Reset the statement.  If the result code is SQLITE_SCHEMA, then
      ** flush the statement cache and try the statement again.
      */
      rc2 = sqlite3_reset(pStmt);
      if( SQLITE_OK!=rc2 ){
        /* If a run-time error occurs, report the error and stop reading
        ** the SQL
        */
        Tcl_SetObjResult(interp, dbTextToObj(sqlite3_errmsg(pDb->db)));
        sqlite3_finalize(pStmt);
        rc = TCL_ERROR;
        if( pPreStmt ) Tcl_Free((char*)pPreStmt);
        break;
      }else if( pDb->maxStmt<=0 ){
        /* If the cache is turned off, deallocated the statement */
        if( pPreStmt ) Tcl_Free((char*)pPreStmt);
        sqlite3_finalize(pStmt);
      }else{
        /* Everything worked and the cache is operational.
        ** Create a new SqlPreparedStmt structure if we need one.
        ** (If we already have one we can just reuse it.)
        */
        if( pPreStmt==0 ){
          len = zLeft - zSql;
          pPreStmt = (SqlPreparedStmt*)Tcl_Alloc( sizeof(*pPreStmt) );
          if( pPreStmt==0 ) return TCL_ERROR;
          pPreStmt->pStmt = pStmt;
          pPreStmt->nSql = len;
          pPreStmt->zSql = sqlite3_sql(pStmt);
          assert( strlen(pPreStmt->zSql)==len );
          assert( 0==memcmp(pPreStmt->zSql, zSql, len) );
        }

        /* Add the prepared statement to the beginning of the cache list
        */
        pPreStmt->pNext = pDb->stmtList;
        pPreStmt->pPrev = 0;
        if( pDb->stmtList ){
         pDb->stmtList->pPrev = pPreStmt;
        }
        pDb->stmtList = pPreStmt;
        if( pDb->stmtLast==0 ){
          assert( pDb->nStmt==0 );
          pDb->stmtLast = pPreStmt;
        }else{
          assert( pDb->nStmt>0 );
        }
        pDb->nStmt++;
   
        /* If we have too many statement in cache, remove the surplus from the
        ** end of the cache list.
        */
        while( pDb->nStmt>pDb->maxStmt ){
          sqlite3_finalize(pDb->stmtLast->pStmt);
          pDb->stmtLast = pDb->stmtLast->pPrev;
          Tcl_Free((char*)pDb->stmtLast->pNext);
          pDb->stmtLast->pNext = 0;
          pDb->nStmt--;
        }
      }

      /* Proceed to the next statement */
      zSql = zLeft;
    }
    Tcl_DecrRefCount(objv[2]);

    if( pRet ){
      if( rc==TCL_OK ){
        Tcl_SetObjResult(interp, pRet);
      }
      Tcl_DecrRefCount(pRet);
    }else if( rc==TCL_OK ){
      Tcl_ResetResult(interp);
    }
    break;
  }

  /*
  **     $db function NAME SCRIPT
  **
  ** Create a new SQL function called NAME.  Whenever that function is
  ** called, invoke SCRIPT to evaluate the function.
  */
  case DB_FUNCTION: {
    SqlFunc *pFunc;
    Tcl_Obj *pScript;
    char *zName;
    if( objc!=4 ){
      Tcl_WrongNumArgs(interp, 2, objv, "NAME SCRIPT");
      return TCL_ERROR;
    }
    zName = Tcl_GetStringFromObj(objv[2], 0);
    pScript = objv[3];
    pFunc = findSqlFunc(pDb, zName);
    if( pFunc==0 ) return TCL_ERROR;
    if( pFunc->pScript ){
      Tcl_DecrRefCount(pFunc->pScript);
    }
    pFunc->pScript = pScript;
    Tcl_IncrRefCount(pScript);
    pFunc->useEvalObjv = safeToUseEvalObjv(interp, pScript);
    rc = sqlite3_create_function(pDb->db, zName, -1, SQLITE_UTF8,
        pFunc, tclSqlFunc, 0, 0);
    if( rc!=SQLITE_OK ){
      rc = TCL_ERROR;
      Tcl_SetResult(interp, (char *)sqlite3_errmsg(pDb->db), TCL_VOLATILE);
    }
    break;
  }

  /*
  **     $db incrblob ?-readonly? ?DB? TABLE COLUMN ROWID
  */
  case DB_INCRBLOB: {
#ifdef SQLITE_OMIT_INCRBLOB
    Tcl_AppendResult(interp, "incrblob not available in this build", 0);
    return TCL_ERROR;
#else
    int isReadonly = 0;
    const char *zDb = "main";
    const char *zTable;
    const char *zColumn;
    sqlite_int64 iRow;

    /* Check for the -readonly option */
    if( objc>3 && strcmp(Tcl_GetString(objv[2]), "-readonly")==0 ){
      isReadonly = 1;
    }

    if( objc!=(5+isReadonly) && objc!=(6+isReadonly) ){
      Tcl_WrongNumArgs(interp, 2, objv, "?-readonly? ?DB? TABLE COLUMN ROWID");
      return TCL_ERROR;
    }

    if( objc==(6+isReadonly) ){
      zDb = Tcl_GetString(objv[2]);
    }
    zTable = Tcl_GetString(objv[objc-3]);
    zColumn = Tcl_GetString(objv[objc-2]);
    rc = Tcl_GetWideIntFromObj(interp, objv[objc-1], &iRow);

    if( rc==TCL_OK ){
      rc = createIncrblobChannel(
          interp, pDb, zDb, zTable, zColumn, iRow, isReadonly
      );
    }
#endif
    break;
  }

  /*
  **     $db interrupt
  **
  ** Interrupt the execution of the inner-most SQL interpreter.  This
  ** causes the SQL statement to return an error of SQLITE_INTERRUPT.
  */
  case DB_INTERRUPT: {
    sqlite3_interrupt(pDb->db);
    break;
  }

  /*
  **     $db nullvalue ?STRING?
  **
  ** Change text used when a NULL comes back from the database. If ?STRING?
  ** is not present, then the current string used for NULL is returned.
  ** If STRING is present, then STRING is returned.
  **
  */
  case DB_NULLVALUE: {
    if( objc!=2 && objc!=3 ){
      Tcl_WrongNumArgs(interp, 2, objv, "NULLVALUE");
      return TCL_ERROR;
    }
    if( objc==3 ){
      int len;
      char *zNull = Tcl_GetStringFromObj(objv[2], &len);
      if( pDb->zNull ){
        Tcl_Free(pDb->zNull);
      }
      if( zNull && len>0 ){
        pDb->zNull = Tcl_Alloc( len + 1 );
        strncpy(pDb->zNull, zNull, len);
        pDb->zNull[len] = '\0';
      }else{
        pDb->zNull = 0;
      }
    }
    Tcl_SetObjResult(interp, dbTextToObj(pDb->zNull));
    break;
  }

  /*
  **     $db last_insert_rowid 
  **
  ** Return an integer which is the ROWID for the most recent insert.
  */
  case DB_LAST_INSERT_ROWID: {
    Tcl_Obj *pResult;
    Tcl_WideInt rowid;
    if( objc!=2 ){
      Tcl_WrongNumArgs(interp, 2, objv, "");
      return TCL_ERROR;
    }
    rowid = sqlite3_last_insert_rowid(pDb->db);
    pResult = Tcl_GetObjResult(interp);
    Tcl_SetWideIntObj(pResult, rowid);
    break;
  }

  /*
  ** The DB_ONECOLUMN method is implemented together with DB_EVAL.
  */

  /*    $db progress ?N CALLBACK?
  ** 
  ** Invoke the given callback every N virtual machine opcodes while executing
  ** queries.
  */
  case DB_PROGRESS: {
    if( objc==2 ){
      if( pDb->zProgress ){
        Tcl_AppendResult(interp, pDb->zProgress, 0);
      }
    }else if( objc==4 ){
      char *zProgress;
      int len;
      int N;
      if( TCL_OK!=Tcl_GetIntFromObj(interp, objv[2], &N) ){
        return TCL_ERROR;
      };
      if( pDb->zProgress ){
        Tcl_Free(pDb->zProgress);
      }
      zProgress = Tcl_GetStringFromObj(objv[3], &len);
      if( zProgress && len>0 ){
        pDb->zProgress = Tcl_Alloc( len + 1 );
        memcpy(pDb->zProgress, zProgress, len+1);
      }else{
        pDb->zProgress = 0;
      }
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
      if( pDb->zProgress ){
        pDb->interp = interp;
        sqlite3_progress_handler(pDb->db, N, DbProgressHandler, pDb);
      }else{
        sqlite3_progress_handler(pDb->db, 0, 0, 0);
      }
#endif
    }else{
      Tcl_WrongNumArgs(interp, 2, objv, "N CALLBACK");
      return TCL_ERROR;
    }
    break;
  }

  /*    $db profile ?CALLBACK?
  **
  ** Make arrangements to invoke the CALLBACK routine after each SQL statement
  ** that has run.  The text of the SQL and the amount of elapse time are
  ** appended to CALLBACK before the script is run.
  */
  case DB_PROFILE: {
    if( objc>3 ){
      Tcl_WrongNumArgs(interp, 2, objv, "?CALLBACK?");
      return TCL_ERROR;
    }else if( objc==2 ){
      if( pDb->zProfile ){
        Tcl_AppendResult(interp, pDb->zProfile, 0);
      }
    }else{
      char *zProfile;
      int len;
      if( pDb->zProfile ){
        Tcl_Free(pDb->zProfile);
      }
      zProfile = Tcl_GetStringFromObj(objv[2], &len);
      if( zProfile && len>0 ){
        pDb->zProfile = Tcl_Alloc( len + 1 );
        memcpy(pDb->zProfile, zProfile, len+1);
      }else{
        pDb->zProfile = 0;
      }
#ifndef SQLITE_OMIT_TRACE
      if( pDb->zProfile ){
        pDb->interp = interp;
        sqlite3_profile(pDb->db, DbProfileHandler, pDb);
      }else{
        sqlite3_profile(pDb->db, 0, 0);
      }
#endif
    }
    break;
  }

  /*
  **     $db rekey KEY
  **
  ** Change the encryption key on the currently open database.
  */
  case DB_REKEY: {
    int nKey;
    void *pKey;
    if( objc!=3 ){
      Tcl_WrongNumArgs(interp, 2, objv, "KEY");
      return TCL_ERROR;
    }
    pKey = Tcl_GetByteArrayFromObj(objv[2], &nKey);
#ifdef SQLITE_HAS_CODEC
    rc = sqlite3_rekey(pDb->db, pKey, nKey);
    if( rc ){
      Tcl_AppendResult(interp, sqlite3ErrStr(rc), 0);
      rc = TCL_ERROR;
    }
#endif
    break;
  }

  /*
  **     $db timeout MILLESECONDS
  **
  ** Delay for the number of milliseconds specified when a file is locked.
  */
  case DB_TIMEOUT: {
    int ms;
    if( objc!=3 ){
      Tcl_WrongNumArgs(interp, 2, objv, "MILLISECONDS");
      return TCL_ERROR;
    }
    if( Tcl_GetIntFromObj(interp, objv[2], &ms) ) return TCL_ERROR;
    sqlite3_busy_timeout(pDb->db, ms);
    break;
  }
  
  /*
  **     $db total_changes
  **
  ** Return the number of rows that were modified, inserted, or deleted 
  ** since the database handle was created.
  */
  case DB_TOTAL_CHANGES: {
    Tcl_Obj *pResult;
    if( objc!=2 ){
      Tcl_WrongNumArgs(interp, 2, objv, "");
      return TCL_ERROR;
    }
    pResult = Tcl_GetObjResult(interp);
    Tcl_SetIntObj(pResult, sqlite3_total_changes(pDb->db));
    break;
  }

  /*    $db trace ?CALLBACK?
  **
  ** Make arrangements to invoke the CALLBACK routine for each SQL statement
  ** that is executed.  The text of the SQL is appended to CALLBACK before
  ** it is executed.
  */
  case DB_TRACE: {
    if( objc>3 ){
      Tcl_WrongNumArgs(interp, 2, objv, "?CALLBACK?");
      return TCL_ERROR;
    }else if( objc==2 ){
      if( pDb->zTrace ){
        Tcl_AppendResult(interp, pDb->zTrace, 0);
      }
    }else{
      char *zTrace;
      int len;
      if( pDb->zTrace ){
        Tcl_Free(pDb->zTrace);
      }
      zTrace = Tcl_GetStringFromObj(objv[2], &len);
      if( zTrace && len>0 ){
        pDb->zTrace = Tcl_Alloc( len + 1 );
        memcpy(pDb->zTrace, zTrace, len+1);
      }else{
        pDb->zTrace = 0;
      }
#ifndef SQLITE_OMIT_TRACE
      if( pDb->zTrace ){
        pDb->interp = interp;
        sqlite3_trace(pDb->db, DbTraceHandler, pDb);
      }else{
        sqlite3_trace(pDb->db, 0, 0);
      }
#endif
    }
    break;
  }

  /*    $db transaction [-deferred|-immediate|-exclusive] SCRIPT
  **
  ** Start a new transaction (if we are not already in the midst of a
  ** transaction) and execute the TCL script SCRIPT.  After SCRIPT
  ** completes, either commit the transaction or roll it back if SCRIPT
  ** throws an exception.  Or if no new transation was started, do nothing.
  ** pass the exception on up the stack.
  **
  ** This command was inspired by Dave Thomas's talk on Ruby at the
  ** 2005 O'Reilly Open Source Convention (OSCON).
  */
  case DB_TRANSACTION: {
    int inTrans;
    Tcl_Obj *pScript;
    const char *zBegin = "BEGIN";
    if( objc!=3 && objc!=4 ){
      Tcl_WrongNumArgs(interp, 2, objv, "[TYPE] SCRIPT");
      return TCL_ERROR;
    }
    if( objc==3 ){
      pScript = objv[2];
    } else {
      static const char *TTYPE_strs[] = {
        "deferred",   "exclusive",  "immediate", 0
      };
      enum TTYPE_enum {
        TTYPE_DEFERRED, TTYPE_EXCLUSIVE, TTYPE_IMMEDIATE
      };
      int ttype;
      if( Tcl_GetIndexFromObj(interp, objv[2], TTYPE_strs, "transaction type",
                              0, &ttype) ){
        return TCL_ERROR;
      }
      switch( (enum TTYPE_enum)ttype ){
        case TTYPE_DEFERRED:    /* no-op */;                 break;
        case TTYPE_EXCLUSIVE:   zBegin = "BEGIN EXCLUSIVE";  break;
        case TTYPE_IMMEDIATE:   zBegin = "BEGIN IMMEDIATE";  break;
      }
      pScript = objv[3];
    }
    inTrans = !sqlite3_get_autocommit(pDb->db);
    if( !inTrans ){
      (void)sqlite3_exec(pDb->db, zBegin, 0, 0, 0);
    }
    rc = Tcl_EvalObjEx(interp, pScript, 0);
    if( !inTrans ){
      const char *zEnd;
      if( rc==TCL_ERROR ){
        zEnd = "ROLLBACK";
      } else {
        zEnd = "COMMIT";
      }
      if( sqlite3_exec(pDb->db, zEnd, 0, 0, 0) ){
        sqlite3_exec(pDb->db, "ROLLBACK", 0, 0, 0);
      }
    }
    break;
  }

  /*
  **    $db update_hook ?script?
  **    $db rollback_hook ?script?
  */
  case DB_UPDATE_HOOK: 
  case DB_ROLLBACK_HOOK: {

    /* set ppHook to point at pUpdateHook or pRollbackHook, depending on 
    ** whether [$db update_hook] or [$db rollback_hook] was invoked.
    */
    Tcl_Obj **ppHook; 
    if( choice==DB_UPDATE_HOOK ){
      ppHook = &pDb->pUpdateHook;
    }else{
      ppHook = &pDb->pRollbackHook;
    }

    if( objc!=2 && objc!=3 ){
       Tcl_WrongNumArgs(interp, 2, objv, "?SCRIPT?");
       return TCL_ERROR;
    }
    if( *ppHook ){
      Tcl_SetObjResult(interp, *ppHook);
      if( objc==3 ){
        Tcl_DecrRefCount(*ppHook);
        *ppHook = 0;
      }
    }
    if( objc==3 ){
      assert( !(*ppHook) );
      if( Tcl_GetCharLength(objv[2])>0 ){
        *ppHook = objv[2];
        Tcl_IncrRefCount(*ppHook);
      }
    }

    sqlite3_update_hook(pDb->db, (pDb->pUpdateHook?DbUpdateHandler:0), pDb);
    sqlite3_rollback_hook(pDb->db,(pDb->pRollbackHook?DbRollbackHandler:0),pDb);

    break;
  }

  /*    $db version
  **
  ** Return the version string for this database.
  */
  case DB_VERSION: {
    Tcl_SetResult(interp, (char *)sqlite3_libversion(), TCL_STATIC);
    break;
  }


  } /* End of the SWITCH statement */
  return rc;
}

/*
**   sqlite3 DBNAME FILENAME ?-vfs VFSNAME? ?-key KEY? ?-readonly BOOLEAN?
**                           ?-create BOOLEAN? ?-nomutex BOOLEAN?
**
** This is the main Tcl command.  When the "sqlite" Tcl command is
** invoked, this routine runs to process that command.
**
** The first argument, DBNAME, is an arbitrary name for a new
** database connection.  This command creates a new command named
** DBNAME that is used to control that connection.  The database
** connection is deleted when the DBNAME command is deleted.
**
** The second argument is the name of the database file.
**
*/
static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){
  SqliteDb *p;
  void *pKey = 0;
  int nKey = 0;
  const char *zArg;
  char *zErrMsg;
  int i;
  const char *zFile;
  const char *zVfs = 0;
  int flags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
  Tcl_DString translatedFilename;
  if( objc==2 ){
    zArg = Tcl_GetStringFromObj(objv[1], 0);
    if( strcmp(zArg,"-version")==0 ){
      Tcl_AppendResult(interp,sqlite3_version,0);
      return TCL_OK;
    }
    if( strcmp(zArg,"-has-codec")==0 ){
#ifdef SQLITE_HAS_CODEC
      Tcl_AppendResult(interp,"1",0);
#else
      Tcl_AppendResult(interp,"0",0);
#endif
      return TCL_OK;
    }
  }
  for(i=3; i+1<objc; i+=2){
    zArg = Tcl_GetString(objv[i]);
    if( strcmp(zArg,"-key")==0 ){
      pKey = Tcl_GetByteArrayFromObj(objv[i+1], &nKey);
    }else if( strcmp(zArg, "-vfs")==0 ){
      i++;
      zVfs = Tcl_GetString(objv[i]);
    }else if( strcmp(zArg, "-readonly")==0 ){
      int b;
      if( Tcl_GetBooleanFromObj(interp, objv[i+1], &b) ) return TCL_ERROR;
      if( b ){
        flags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE);
        flags |= SQLITE_OPEN_READONLY;
      }else{
        flags &= ~SQLITE_OPEN_READONLY;
        flags |= SQLITE_OPEN_READWRITE;
      }
    }else if( strcmp(zArg, "-create")==0 ){
      int b;
      if( Tcl_GetBooleanFromObj(interp, objv[i+1], &b) ) return TCL_ERROR;
      if( b && (flags & SQLITE_OPEN_READONLY)==0 ){
        flags |= SQLITE_OPEN_CREATE;
      }else{
        flags &= ~SQLITE_OPEN_CREATE;
      }
    }else if( strcmp(zArg, "-nomutex")==0 ){
      int b;
      if( Tcl_GetBooleanFromObj(interp, objv[i+1], &b) ) return TCL_ERROR;
      if( b ){
        flags |= SQLITE_OPEN_NOMUTEX;
      }else{
        flags &= ~SQLITE_OPEN_NOMUTEX;
      }
    }else{
      Tcl_AppendResult(interp, "unknown option: ", zArg, (char*)0);
      return TCL_ERROR;
    }
  }
  if( objc<3 || (objc&1)!=1 ){
    Tcl_WrongNumArgs(interp, 1, objv, 
      "HANDLE FILENAME ?-vfs VFSNAME? ?-readonly BOOLEAN? ?-create BOOLEAN?"
      " ?-nomutex BOOLEAN?"
#ifdef SQLITE_HAS_CODEC
      " ?-key CODECKEY?"
#endif
    );
    return TCL_ERROR;
  }
  zErrMsg = 0;
  p = (SqliteDb*)Tcl_Alloc( sizeof(*p) );
  if( p==0 ){
    Tcl_SetResult(interp, "malloc failed", TCL_STATIC);
    return TCL_ERROR;
  }
  memset(p, 0, sizeof(*p));
  zFile = Tcl_GetStringFromObj(objv[2], 0);
  zFile = Tcl_TranslateFileName(interp, zFile, &translatedFilename);
  sqlite3_open_v2(zFile, &p->db, flags, zVfs);
  Tcl_DStringFree(&translatedFilename);
  if( SQLITE_OK!=sqlite3_errcode(p->db) ){
    zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(p->db));
    sqlite3_close(p->db);
    p->db = 0;
  }
#ifdef SQLITE_HAS_CODEC
  if( p->db ){
    sqlite3_key(p->db, pKey, nKey);
  }
#endif
  if( p->db==0 ){
    Tcl_SetResult(interp, zErrMsg, TCL_VOLATILE);
    Tcl_Free((char*)p);
    sqlite3_free(zErrMsg);
    return TCL_ERROR;
  }
  p->maxStmt = NUM_PREPARED_STMTS;
  p->interp = interp;
  zArg = Tcl_GetStringFromObj(objv[1], 0);
  Tcl_CreateObjCommand(interp, zArg, DbObjCmd, (char*)p, DbDeleteCmd);
  return TCL_OK;
}

/*
** Provide a dummy Tcl_InitStubs if we are using this as a static
** library.
*/
#ifndef USE_TCL_STUBS
# undef  Tcl_InitStubs
# define Tcl_InitStubs(a,b,c)
#endif

/*
** Make sure we have a PACKAGE_VERSION macro defined.  This will be
** defined automatically by the TEA makefile.  But other makefiles
** do not define it.
*/
#ifndef PACKAGE_VERSION
# define PACKAGE_VERSION SQLITE_VERSION
#endif

/*
** Initialize this module.
**
** This Tcl module contains only a single new Tcl command named "sqlite".
** (Hence there is no namespace.  There is no point in using a namespace
** if the extension only supplies one new name!)  The "sqlite" command is
** used to open a new SQLite database.  See the DbMain() routine above
** for additional information.
*/
EXTERN int Sqlite3_Init(Tcl_Interp *interp){
  Tcl_InitStubs(interp, "8.4", 0);
  Tcl_CreateObjCommand(interp, "sqlite3", (Tcl_ObjCmdProc*)DbMain, 0, 0);
  Tcl_PkgProvide(interp, "sqlite3", PACKAGE_VERSION);
  Tcl_CreateObjCommand(interp, "sqlite", (Tcl_ObjCmdProc*)DbMain, 0, 0);
  Tcl_PkgProvide(interp, "sqlite", PACKAGE_VERSION);
  return TCL_OK;
}
EXTERN int Tclsqlite3_Init(Tcl_Interp *interp){ return Sqlite3_Init(interp); }
EXTERN int Sqlite3_SafeInit(Tcl_Interp *interp){ return TCL_OK; }
EXTERN int Tclsqlite3_SafeInit(Tcl_Interp *interp){ return TCL_OK; }

#ifndef SQLITE_3_SUFFIX_ONLY
EXTERN int Sqlite_Init(Tcl_Interp *interp){ return Sqlite3_Init(interp); }
EXTERN int Tclsqlite_Init(Tcl_Interp *interp){ return Sqlite3_Init(interp); }
EXTERN int Sqlite_SafeInit(Tcl_Interp *interp){ return TCL_OK; }
EXTERN int Tclsqlite_SafeInit(Tcl_Interp *interp){ return TCL_OK; }
#endif

#ifdef TCLSH
/*****************************************************************************
** The code that follows is used to build standalone TCL interpreters
** that are statically linked with SQLite.  
*/

/*
** If the macro TCLSH is one, then put in code this for the
** "main" routine that will initialize Tcl and take input from
** standard input, or if a file is named on the command line
** the TCL interpreter reads and evaluates that file.
*/
#if TCLSH==1
static char zMainloop[] =
  "set line {}\n"
  "while {![eof stdin]} {\n"
    "if {$line!=\"\"} {\n"
      "puts -nonewline \"> \"\n"
    "} else {\n"
      "puts -nonewline \"% \"\n"
    "}\n"
    "flush stdout\n"
    "append line [gets stdin]\n"
    "if {[info complete $line]} {\n"
      "if {[catch {uplevel #0 $line} result]} {\n"
        "puts stderr \"Error: $result\"\n"
      "} elseif {$result!=\"\"} {\n"
        "puts $result\n"
      "}\n"
      "set line {}\n"
    "} else {\n"
      "append line \\n\n"
    "}\n"
  "}\n"
;
#endif

/*
** If the macro TCLSH is two, then get the main loop code out of
** the separate file "spaceanal_tcl.h".
*/
#if TCLSH==2
static char zMainloop[] = 
#include "spaceanal_tcl.h"
;
#endif

#define TCLSH_MAIN main   /* Needed to fake out mktclapp */
int TCLSH_MAIN(int argc, char **argv){
  Tcl_Interp *interp;
  Tcl_FindExecutable(argv[0]);
  interp = Tcl_CreateInterp();
  Sqlite3_Init(interp);
#ifdef SQLITE_TEST
  {
    extern int Md5_Init(Tcl_Interp*);
    extern int Sqliteconfig_Init(Tcl_Interp*);
    extern int Sqlitetest1_Init(Tcl_Interp*);
    extern int Sqlitetest2_Init(Tcl_Interp*);
    extern int Sqlitetest3_Init(Tcl_Interp*);
    extern int Sqlitetest4_Init(Tcl_Interp*);
    extern int Sqlitetest5_Init(Tcl_Interp*);
    extern int Sqlitetest6_Init(Tcl_Interp*);
    extern int Sqlitetest7_Init(Tcl_Interp*);
    extern int Sqlitetest8_Init(Tcl_Interp*);
    extern int Sqlitetest9_Init(Tcl_Interp*);
    extern int Sqlitetestasync_Init(Tcl_Interp*);
    extern int Sqlitetest_autoext_Init(Tcl_Interp*);
    extern int Sqlitetest_func_Init(Tcl_Interp*);
    extern int Sqlitetest_hexio_Init(Tcl_Interp*);
    extern int Sqlitetest_malloc_Init(Tcl_Interp*);
    extern int Sqlitetest_mutex_Init(Tcl_Interp*);
    extern int Sqlitetestschema_Init(Tcl_Interp*);
    extern int Sqlitetestsse_Init(Tcl_Interp*);
    extern int Sqlitetesttclvar_Init(Tcl_Interp*);
    extern int SqlitetestThread_Init(Tcl_Interp*);
    extern int SqlitetestOnefile_Init();
    extern int SqlitetestOsinst_Init(Tcl_Interp*);

    Md5_Init(interp);
    Sqliteconfig_Init(interp);
    Sqlitetest1_Init(interp);
    Sqlitetest2_Init(interp);
    Sqlitetest3_Init(interp);
    Sqlitetest4_Init(interp);
    Sqlitetest5_Init(interp);
    Sqlitetest6_Init(interp);
    Sqlitetest7_Init(interp);
    Sqlitetest8_Init(interp);
    Sqlitetest9_Init(interp);
    Sqlitetestasync_Init(interp);
    Sqlitetest_autoext_Init(interp);
    Sqlitetest_func_Init(interp);
    Sqlitetest_hexio_Init(interp);
    Sqlitetest_malloc_Init(interp);
    Sqlitetest_mutex_Init(interp);
    Sqlitetestschema_Init(interp);
    Sqlitetesttclvar_Init(interp);
    SqlitetestThread_Init(interp);
    SqlitetestOnefile_Init(interp);
    SqlitetestOsinst_Init(interp);

#ifdef SQLITE_SSE
    Sqlitetestsse_Init(interp);
#endif
  }
#endif
  if( argc>=2 || TCLSH==2 ){
    int i;
    char zArgc[32];
    sqlite3_snprintf(sizeof(zArgc), zArgc, "%d", argc-(3-TCLSH));
    Tcl_SetVar(interp,"argc", zArgc, TCL_GLOBAL_ONLY);
    Tcl_SetVar(interp,"argv0",argv[1],TCL_GLOBAL_ONLY);
    Tcl_SetVar(interp,"argv", "", TCL_GLOBAL_ONLY);
    for(i=3-TCLSH; i<argc; i++){
      Tcl_SetVar(interp, "argv", argv[i],
          TCL_GLOBAL_ONLY | TCL_LIST_ELEMENT | TCL_APPEND_VALUE);
    }
    if( TCLSH==1 && Tcl_EvalFile(interp, argv[1])!=TCL_OK ){
      const char *zInfo = Tcl_GetVar(interp, "errorInfo", TCL_GLOBAL_ONLY);
      if( zInfo==0 ) zInfo = interp->result;
      fprintf(stderr,"%s: %s\n", *argv, zInfo);
      return 1;
    }
  }
  if( argc<=1 || TCLSH==2 ){
    Tcl_GlobalEval(interp, zMainloop);
  }
  return 0;
}
#endif /* TCLSH */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/tokenize.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** An tokenizer for SQL
**
** This file contains C code that splits an SQL input string up into
** individual tokens and sends those tokens one-by-one over to the
** parser for analysis.
**
** $Id: tokenize.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
#include <stdlib.h>

/*
** The charMap() macro maps alphabetic characters into their
** lower-case ASCII equivalent.  On ASCII machines, this is just
** an upper-to-lower case map.  On EBCDIC machines we also need
** to adjust the encoding.  Only alphabetic characters and underscores
** need to be translated.
*/
#ifdef SQLITE_ASCII
# define charMap(X) sqlite3UpperToLower[(unsigned char)X]
#endif
#ifdef SQLITE_EBCDIC
# define charMap(X) ebcdicToAscii[(unsigned char)X]
const unsigned char ebcdicToAscii[] = {
/* 0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F */
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 0x */
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 1x */
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 2x */
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 3x */
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 4x */
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 5x */
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 95,  0,  0,  /* 6x */
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* 7x */
   0, 97, 98, 99,100,101,102,103,104,105,  0,  0,  0,  0,  0,  0,  /* 8x */
   0,106,107,108,109,110,111,112,113,114,  0,  0,  0,  0,  0,  0,  /* 9x */
   0,  0,115,116,117,118,119,120,121,122,  0,  0,  0,  0,  0,  0,  /* Ax */
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* Bx */
   0, 97, 98, 99,100,101,102,103,104,105,  0,  0,  0,  0,  0,  0,  /* Cx */
   0,106,107,108,109,110,111,112,113,114,  0,  0,  0,  0,  0,  0,  /* Dx */
   0,  0,115,116,117,118,119,120,121,122,  0,  0,  0,  0,  0,  0,  /* Ex */
   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  /* Fx */
};
#endif

/*
** The sqlite3KeywordCode function looks up an identifier to determine if
** it is a keyword.  If it is a keyword, the token code of that keyword is 
** returned.  If the input is not a keyword, TK_ID is returned.
**
** The implementation of this routine was generated by a program,
** mkkeywordhash.h, located in the tool subdirectory of the distribution.
** The output of the mkkeywordhash.c program is written into a file
** named keywordhash.h and then included into this source file by
** the #include below.
*/
#include "keywordhash.h"


/*
** If X is a character that can be used in an identifier then
** IdChar(X) will be true.  Otherwise it is false.
**
** For ASCII, any character with the high-order bit set is
** allowed in an identifier.  For 7-bit characters, 
** sqlite3IsIdChar[X] must be 1.
**
** For EBCDIC, the rules are more complex but have the same
** end result.
**
** Ticket #1066.  the SQL standard does not allow '$' in the
** middle of identfiers.  But many SQL implementations do. 
** SQLite will allow '$' in identifiers for compatibility.
** But the feature is undocumented.
*/
#ifdef SQLITE_ASCII
const char sqlite3IsAsciiIdChar[] = {
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
    0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* 2x */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  /* 3x */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 4x */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,  /* 5x */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  /* 6x */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,  /* 7x */
};
#define IdChar(C)  (((c=C)&0x80)!=0 || (c>0x1f && sqlite3IsAsciiIdChar[c-0x20]))
#endif
#ifdef SQLITE_EBCDIC
const char sqlite3IsEbcdicIdChar[] = {
/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
    0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,  /* 4x */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0,  /* 5x */
    0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0,  /* 6x */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,  /* 7x */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0,  /* 8x */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0,  /* 9x */
    1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0,  /* Ax */
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  /* Bx */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,  /* Cx */
    0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,  /* Dx */
    0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1,  /* Ex */
    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0,  /* Fx */
};
#define IdChar(C)  (((c=C)>=0x42 && sqlite3IsEbcdicIdChar[c-0x40]))
#endif


/*
** Return the length of the token that begins at z[0]. 
** Store the token type in *tokenType before returning.
*/
int sqlite3GetToken(const unsigned char *z, int *tokenType){
  int i, c;
  switch( *z ){
    case ' ': case '\t': case '\n': case '\f': case '\r': {
      for(i=1; isspace(z[i]); i++){}
      *tokenType = TK_SPACE;
      return i;
    }
    case '-': {
      if( z[1]=='-' ){
        for(i=2; (c=z[i])!=0 && c!='\n'; i++){}
        *tokenType = TK_COMMENT;
        return i;
      }
      *tokenType = TK_MINUS;
      return 1;
    }
    case '(': {
      *tokenType = TK_LP;
      return 1;
    }
    case ')': {
      *tokenType = TK_RP;
      return 1;
    }
    case ';': {
      *tokenType = TK_SEMI;
      return 1;
    }
    case '+': {
      *tokenType = TK_PLUS;
      return 1;
    }
    case '*': {
      *tokenType = TK_STAR;
      return 1;
    }
    case '/': {
      if( z[1]!='*' || z[2]==0 ){
        *tokenType = TK_SLASH;
        return 1;
      }
      for(i=3, c=z[2]; (c!='*' || z[i]!='/') && (c=z[i])!=0; i++){}
      if( c ) i++;
      *tokenType = TK_COMMENT;
      return i;
    }
    case '%': {
      *tokenType = TK_REM;
      return 1;
    }
    case '=': {
      *tokenType = TK_EQ;
      return 1 + (z[1]=='=');
    }
    case '<': {
      if( (c=z[1])=='=' ){
        *tokenType = TK_LE;
        return 2;
      }else if( c=='>' ){
        *tokenType = TK_NE;
        return 2;
      }else if( c=='<' ){
        *tokenType = TK_LSHIFT;
        return 2;
      }else{
        *tokenType = TK_LT;
        return 1;
      }
    }
    case '>': {
      if( (c=z[1])=='=' ){
        *tokenType = TK_GE;
        return 2;
      }else if( c=='>' ){
        *tokenType = TK_RSHIFT;
        return 2;
      }else{
        *tokenType = TK_GT;
        return 1;
      }
    }
    case '!': {
      if( z[1]!='=' ){
        *tokenType = TK_ILLEGAL;
        return 2;
      }else{
        *tokenType = TK_NE;
        return 2;
      }
    }
    case '|': {
      if( z[1]!='|' ){
        *tokenType = TK_BITOR;
        return 1;
      }else{
        *tokenType = TK_CONCAT;
        return 2;
      }
    }
    case ',': {
      *tokenType = TK_COMMA;
      return 1;
    }
    case '&': {
      *tokenType = TK_BITAND;
      return 1;
    }
    case '~': {
      *tokenType = TK_BITNOT;
      return 1;
    }
    case '`':
    case '\'':
    case '"': {
      int delim = z[0];
      for(i=1; (c=z[i])!=0; i++){
        if( c==delim ){
          if( z[i+1]==delim ){
            i++;
          }else{
            break;
          }
        }
      }
      if( c ){
        *tokenType = TK_STRING;
        return i+1;
      }else{
        *tokenType = TK_ILLEGAL;
        return i;
      }
    }
    case '.': {
#ifndef SQLITE_OMIT_FLOATING_POINT
      if( !isdigit(z[1]) )
#endif
      {
        *tokenType = TK_DOT;
        return 1;
      }
      /* If the next character is a digit, this is a floating point
      ** number that begins with ".".  Fall thru into the next case */
    }
    case '0': case '1': case '2': case '3': case '4':
    case '5': case '6': case '7': case '8': case '9': {
      *tokenType = TK_INTEGER;
      for(i=0; isdigit(z[i]); i++){}
#ifndef SQLITE_OMIT_FLOATING_POINT
      if( z[i]=='.' ){
        i++;
        while( isdigit(z[i]) ){ i++; }
        *tokenType = TK_FLOAT;
      }
      if( (z[i]=='e' || z[i]=='E') &&
           ( isdigit(z[i+1]) 
            || ((z[i+1]=='+' || z[i+1]=='-') && isdigit(z[i+2]))
           )
      ){
        i += 2;
        while( isdigit(z[i]) ){ i++; }
        *tokenType = TK_FLOAT;
      }
#endif
      while( IdChar(z[i]) ){
        *tokenType = TK_ILLEGAL;
        i++;
      }
      return i;
    }
    case '[': {
      for(i=1, c=z[0]; c!=']' && (c=z[i])!=0; i++){}
      *tokenType = c==']' ? TK_ID : TK_ILLEGAL;
      return i;
    }
    case '?': {
      *tokenType = TK_VARIABLE;
      for(i=1; isdigit(z[i]); i++){}
      return i;
    }
    case '#': {
      for(i=1; isdigit(z[i]); i++){}
      if( i>1 ){
        /* Parameters of the form #NNN (where NNN is a number) are used
        ** internally by sqlite3NestedParse.  */
        *tokenType = TK_REGISTER;
        return i;
      }
      /* Fall through into the next case if the '#' is not followed by
      ** a digit. Try to match #AAAA where AAAA is a parameter name. */
    }
#ifndef SQLITE_OMIT_TCL_VARIABLE
    case '$':
#endif
    case '@':  /* For compatibility with MS SQL Server */
    case ':': {
      int n = 0;
      *tokenType = TK_VARIABLE;
      for(i=1; (c=z[i])!=0; i++){
        if( IdChar(c) ){
          n++;
#ifndef SQLITE_OMIT_TCL_VARIABLE
        }else if( c=='(' && n>0 ){
          do{
            i++;
          }while( (c=z[i])!=0 && !isspace(c) && c!=')' );
          if( c==')' ){
            i++;
          }else{
            *tokenType = TK_ILLEGAL;
          }
          break;
        }else if( c==':' && z[i+1]==':' ){
          i++;
#endif
        }else{
          break;
        }
      }
      if( n==0 ) *tokenType = TK_ILLEGAL;
      return i;
    }
#ifndef SQLITE_OMIT_BLOB_LITERAL
    case 'x': case 'X': {
      if( z[1]=='\'' ){
        *tokenType = TK_BLOB;
        for(i=2; (c=z[i])!=0 && c!='\''; i++){
          if( !isxdigit(c) ){
            *tokenType = TK_ILLEGAL;
          }
        }
        if( i%2 || !c ) *tokenType = TK_ILLEGAL;
        if( c ) i++;
        return i;
      }
      /* Otherwise fall through to the next case */
    }
#endif
    default: {
      if( !IdChar(*z) ){
        break;
      }
      for(i=1; IdChar(z[i]); i++){}
      *tokenType = keywordCode((char*)z, i);
      return i;
    }
  }
  *tokenType = TK_ILLEGAL;
  return 1;
}

/*
** Run the parser on the given SQL string.  The parser structure is
** passed in.  An SQLITE_ status code is returned.  If an error occurs
** then an and attempt is made to write an error message into 
** memory obtained from sqlite3_malloc() and to make *pzErrMsg point to that
** error message.
*/
int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){
  int nErr = 0;
  int i;
  void *pEngine;
  int tokenType;
  int lastTokenParsed = -1;
  sqlite3 *db = pParse->db;
  int mxSqlLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH];

  if( db->activeVdbeCnt==0 ){
    db->u1.isInterrupted = 0;
  }
  pParse->rc = SQLITE_OK;
  pParse->zTail = pParse->zSql = zSql;
  i = 0;
  assert( pzErrMsg!=0 );
  pEngine = sqlite3ParserAlloc((void*(*)(size_t))sqlite3Malloc);
  if( pEngine==0 ){
    db->mallocFailed = 1;
    return SQLITE_NOMEM;
  }
  assert( pParse->sLastToken.dyn==0 );
  assert( pParse->pNewTable==0 );
  assert( pParse->pNewTrigger==0 );
  assert( pParse->nVar==0 );
  assert( pParse->nVarExpr==0 );
  assert( pParse->nVarExprAlloc==0 );
  assert( pParse->apVarExpr==0 );
  while( !db->mallocFailed && zSql[i]!=0 ){
    assert( i>=0 );
    pParse->sLastToken.z = (u8*)&zSql[i];
    assert( pParse->sLastToken.dyn==0 );
    pParse->sLastToken.n = sqlite3GetToken((unsigned char*)&zSql[i],&tokenType);
    i += pParse->sLastToken.n;
    if( i>mxSqlLen ){
      pParse->rc = SQLITE_TOOBIG;
      break;
    }
    switch( tokenType ){
      case TK_SPACE:
      case TK_COMMENT: {
        if( db->u1.isInterrupted ){
          pParse->rc = SQLITE_INTERRUPT;
          sqlite3SetString(pzErrMsg, db, "interrupt");
          goto abort_parse;
        }
        break;
      }
      case TK_ILLEGAL: {
        sqlite3DbFree(db, *pzErrMsg);
        *pzErrMsg = sqlite3MPrintf(db, "unrecognized token: \"%T\"",
                        &pParse->sLastToken);
        nErr++;
        goto abort_parse;
      }
      case TK_SEMI: {
        pParse->zTail = &zSql[i];
        /* Fall thru into the default case */
      }
      default: {
        sqlite3Parser(pEngine, tokenType, pParse->sLastToken, pParse);
        lastTokenParsed = tokenType;
        if( pParse->rc!=SQLITE_OK ){
          goto abort_parse;
        }
        break;
      }
    }
  }
abort_parse:
  if( zSql[i]==0 && nErr==0 && pParse->rc==SQLITE_OK ){
    if( lastTokenParsed!=TK_SEMI ){
      sqlite3Parser(pEngine, TK_SEMI, pParse->sLastToken, pParse);
      pParse->zTail = &zSql[i];
    }
    sqlite3Parser(pEngine, 0, pParse->sLastToken, pParse);
  }
#ifdef YYTRACKMAXSTACKDEPTH
  sqlite3StatusSet(SQLITE_STATUS_PARSER_STACK,
      sqlite3ParserStackPeak(pEngine)
  );
#endif /* YYDEBUG */
  sqlite3ParserFree(pEngine, sqlite3_free);
  if( db->mallocFailed ){
    pParse->rc = SQLITE_NOMEM;
  }
  if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){
    sqlite3SetString(&pParse->zErrMsg, db, "%s", sqlite3ErrStr(pParse->rc));
  }
  if( pParse->zErrMsg ){
    if( *pzErrMsg==0 ){
      *pzErrMsg = pParse->zErrMsg;
    }else{
      sqlite3DbFree(db, pParse->zErrMsg);
    }
    pParse->zErrMsg = 0;
    nErr++;
  }
  if( pParse->pVdbe && pParse->nErr>0 && pParse->nested==0 ){
    sqlite3VdbeDelete(pParse->pVdbe);
    pParse->pVdbe = 0;
  }
#ifndef SQLITE_OMIT_SHARED_CACHE
  if( pParse->nested==0 ){
    sqlite3DbFree(db, pParse->aTableLock);
    pParse->aTableLock = 0;
    pParse->nTableLock = 0;
  }
#endif
#ifndef SQLITE_OMIT_VIRTUALTABLE
  sqlite3DbFree(db, pParse->apVtabLock);
#endif

  if( !IN_DECLARE_VTAB ){
    /* If the pParse->declareVtab flag is set, do not delete any table 
    ** structure built up in pParse->pNewTable. The calling code (see vtab.c)
    ** will take responsibility for freeing the Table structure.
    */
    sqlite3DeleteTable(pParse->pNewTable);
  }

  sqlite3DeleteTrigger(db, pParse->pNewTrigger);
  sqlite3DbFree(db, pParse->apVarExpr);
  if( nErr>0 && (pParse->rc==SQLITE_OK || pParse->rc==SQLITE_DONE) ){
    pParse->rc = SQLITE_ERROR;
  }
  return nErr;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/trigger.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
/*
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
**
** $Id: trigger.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "sqliteInt.h"

#ifndef SQLITE_OMIT_TRIGGER
/*
** Delete a linked list of TriggerStep structures.
*/
void sqlite3DeleteTriggerStep(sqlite3 *db, TriggerStep *pTriggerStep){
  while( pTriggerStep ){
    TriggerStep * pTmp = pTriggerStep;
    pTriggerStep = pTriggerStep->pNext;

    if( pTmp->target.dyn ) sqlite3DbFree(db, (char*)pTmp->target.z);
    sqlite3ExprDelete(db, pTmp->pWhere);
    sqlite3ExprListDelete(db, pTmp->pExprList);
    sqlite3SelectDelete(db, pTmp->pSelect);
    sqlite3IdListDelete(db, pTmp->pIdList);

    sqlite3DbFree(db, pTmp);
  }
}

/*
** This is called by the parser when it sees a CREATE TRIGGER statement
** up to the point of the BEGIN before the trigger actions.  A Trigger
** structure is generated based on the information available and stored
** in pParse->pNewTrigger.  After the trigger actions have been parsed, the
** sqlite3FinishTrigger() function is called to complete the trigger
** construction process.
*/
void sqlite3BeginTrigger(
  Parse *pParse,      /* The parse context of the CREATE TRIGGER statement */
  Token *pName1,      /* The name of the trigger */
  Token *pName2,      /* The name of the trigger */
  int tr_tm,          /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */
  int op,             /* One of TK_INSERT, TK_UPDATE, TK_DELETE */
  IdList *pColumns,   /* column list if this is an UPDATE OF trigger */
  SrcList *pTableName,/* The name of the table/view the trigger applies to */
  Expr *pWhen,        /* WHEN clause */
  int isTemp,         /* True if the TEMPORARY keyword is present */
  int noErr           /* Suppress errors if the trigger already exists */
){
  Trigger *pTrigger = 0;
  Table *pTab;
  char *zName = 0;        /* Name of the trigger */
  sqlite3 *db = pParse->db;
  int iDb;                /* The database to store the trigger in */
  Token *pName;           /* The unqualified db name */
  DbFixer sFix;
  int iTabDb;

  assert( pName1!=0 );   /* pName1->z might be NULL, but not pName1 itself */
  assert( pName2!=0 );
  if( isTemp ){
    /* If TEMP was specified, then the trigger name may not be qualified. */
    if( pName2->n>0 ){
      sqlite3ErrorMsg(pParse, "temporary trigger may not have qualified name");
      goto trigger_cleanup;
    }
    iDb = 1;
    pName = pName1;
  }else{
    /* Figure out the db that the the trigger will be created in */
    iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName);
    if( iDb<0 ){
      goto trigger_cleanup;
    }
  }

  /* If the trigger name was unqualified, and the table is a temp table,
  ** then set iDb to 1 to create the trigger in the temporary database.
  ** If sqlite3SrcListLookup() returns 0, indicating the table does not
  ** exist, the error is caught by the block below.
  */
  if( !pTableName || db->mallocFailed ){
    goto trigger_cleanup;
  }
  pTab = sqlite3SrcListLookup(pParse, pTableName);
  if( pName2->n==0 && pTab && pTab->pSchema==db->aDb[1].pSchema ){
    iDb = 1;
  }

  /* Ensure the table name matches database name and that the table exists */
  if( db->mallocFailed ) goto trigger_cleanup;
  assert( pTableName->nSrc==1 );
  if( sqlite3FixInit(&sFix, pParse, iDb, "trigger", pName) && 
      sqlite3FixSrcList(&sFix, pTableName) ){
    goto trigger_cleanup;
  }
  pTab = sqlite3SrcListLookup(pParse, pTableName);
  if( !pTab ){
    /* The table does not exist. */
    goto trigger_cleanup;
  }
  if( IsVirtual(pTab) ){
    sqlite3ErrorMsg(pParse, "cannot create triggers on virtual tables");
    goto trigger_cleanup;
  }

  /* Check that the trigger name is not reserved and that no trigger of the
  ** specified name exists */
  zName = sqlite3NameFromToken(db, pName);
  if( !zName || SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){
    goto trigger_cleanup;
  }
  if( sqlite3HashFind(&(db->aDb[iDb].pSchema->trigHash), zName,strlen(zName)) ){
    if( !noErr ){
      sqlite3ErrorMsg(pParse, "trigger %T already exists", pName);
    }
    goto trigger_cleanup;
  }

  /* Do not create a trigger on a system table */
  if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 ){
    sqlite3ErrorMsg(pParse, "cannot create trigger on system table");
    pParse->nErr++;
    goto trigger_cleanup;
  }

  /* INSTEAD of triggers are only for views and views only support INSTEAD
  ** of triggers.
  */
  if( pTab->pSelect && tr_tm!=TK_INSTEAD ){
    sqlite3ErrorMsg(pParse, "cannot create %s trigger on view: %S", 
        (tr_tm == TK_BEFORE)?"BEFORE":"AFTER", pTableName, 0);
    goto trigger_cleanup;
  }
  if( !pTab->pSelect && tr_tm==TK_INSTEAD ){
    sqlite3ErrorMsg(pParse, "cannot create INSTEAD OF"
        " trigger on table: %S", pTableName, 0);
    goto trigger_cleanup;
  }
  iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema);

#ifndef SQLITE_OMIT_AUTHORIZATION
  {
    int code = SQLITE_CREATE_TRIGGER;
    const char *zDb = db->aDb[iTabDb].zName;
    const char *zDbTrig = isTemp ? db->aDb[1].zName : zDb;
    if( iTabDb==1 || isTemp ) code = SQLITE_CREATE_TEMP_TRIGGER;
    if( sqlite3AuthCheck(pParse, code, zName, pTab->zName, zDbTrig) ){
      goto trigger_cleanup;
    }
    if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iTabDb),0,zDb)){
      goto trigger_cleanup;
    }
  }
#endif

  /* INSTEAD OF triggers can only appear on views and BEFORE triggers
  ** cannot appear on views.  So we might as well translate every
  ** INSTEAD OF trigger into a BEFORE trigger.  It simplifies code
  ** elsewhere.
  */
  if (tr_tm == TK_INSTEAD){
    tr_tm = TK_BEFORE;
  }

  /* Build the Trigger object */
  pTrigger = (Trigger*)sqlite3DbMallocZero(db, sizeof(Trigger));
  if( pTrigger==0 ) goto trigger_cleanup;
  pTrigger->name = zName;
  zName = 0;
  pTrigger->table = sqlite3DbStrDup(db, pTableName->a[0].zName);
  pTrigger->pSchema = db->aDb[iDb].pSchema;
  pTrigger->pTabSchema = pTab->pSchema;
  pTrigger->op = op;
  pTrigger->tr_tm = tr_tm==TK_BEFORE ? TRIGGER_BEFORE : TRIGGER_AFTER;
  pTrigger->pWhen = sqlite3ExprDup(db, pWhen);
  pTrigger->pColumns = sqlite3IdListDup(db, pColumns);
  sqlite3TokenCopy(db, &pTrigger->nameToken,pName);
  assert( pParse->pNewTrigger==0 );
  pParse->pNewTrigger = pTrigger;

trigger_cleanup:
  sqlite3DbFree(db, zName);
  sqlite3SrcListDelete(db, pTableName);
  sqlite3IdListDelete(db, pColumns);
  sqlite3ExprDelete(db, pWhen);
  if( !pParse->pNewTrigger ){
    sqlite3DeleteTrigger(db, pTrigger);
  }else{
    assert( pParse->pNewTrigger==pTrigger );
  }
}

/*
** This routine is called after all of the trigger actions have been parsed
** in order to complete the process of building the trigger.
*/
void sqlite3FinishTrigger(
  Parse *pParse,          /* Parser context */
  TriggerStep *pStepList, /* The triggered program */
  Token *pAll             /* Token that describes the complete CREATE TRIGGER */
){
  Trigger *pTrig = 0;     /* The trigger whose construction is finishing up */
  sqlite3 *db = pParse->db;  /* The database */
  DbFixer sFix;
  int iDb;                   /* Database containing the trigger */

  pTrig = pParse->pNewTrigger;
  pParse->pNewTrigger = 0;
  if( pParse->nErr || !pTrig ) goto triggerfinish_cleanup;
  iDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema);
  pTrig->step_list = pStepList;
  while( pStepList ){
    pStepList->pTrig = pTrig;
    pStepList = pStepList->pNext;
  }
  if( sqlite3FixInit(&sFix, pParse, iDb, "trigger", &pTrig->nameToken) 
          && sqlite3FixTriggerStep(&sFix, pTrig->step_list) ){
    goto triggerfinish_cleanup;
  }

  /* if we are not initializing, and this trigger is not on a TEMP table, 
  ** build the sqlite_master entry
  */
  if( !db->init.busy ){
    Vdbe *v;
    char *z;

    /* Make an entry in the sqlite_master table */
    v = sqlite3GetVdbe(pParse);
    if( v==0 ) goto triggerfinish_cleanup;
    sqlite3BeginWriteOperation(pParse, 0, iDb);
    z = sqlite3DbStrNDup(db, (char*)pAll->z, pAll->n);
    sqlite3NestedParse(pParse,
       "INSERT INTO %Q.%s VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')",
       db->aDb[iDb].zName, SCHEMA_TABLE(iDb), pTrig->name,
       pTrig->table, z);
    sqlite3DbFree(db, z);
    sqlite3ChangeCookie(pParse, iDb);
    sqlite3VdbeAddOp4(v, OP_ParseSchema, iDb, 0, 0, sqlite3MPrintf(
        db, "type='trigger' AND name='%q'", pTrig->name), P4_DYNAMIC
    );
  }

  if( db->init.busy ){
    int n;
    Table *pTab;
    Trigger *pDel;
    pDel = sqlite3HashInsert(&db->aDb[iDb].pSchema->trigHash, 
                     pTrig->name, strlen(pTrig->name), pTrig);
    if( pDel ){
      assert( pDel==pTrig );
      db->mallocFailed = 1;
      goto triggerfinish_cleanup;
    }
    n = strlen(pTrig->table) + 1;
    pTab = sqlite3HashFind(&pTrig->pTabSchema->tblHash, pTrig->table, n);
    assert( pTab!=0 );
    pTrig->pNext = pTab->pTrigger;
    pTab->pTrigger = pTrig;
    pTrig = 0;
  }

triggerfinish_cleanup:
  sqlite3DeleteTrigger(db, pTrig);
  assert( !pParse->pNewTrigger );
  sqlite3DeleteTriggerStep(db, pStepList);
}

/*
** Make a copy of all components of the given trigger step.  This has
** the effect of copying all Expr.token.z values into memory obtained
** from sqlite3_malloc().  As initially created, the Expr.token.z values
** all point to the input string that was fed to the parser.  But that
** string is ephemeral - it will go away as soon as the sqlite3_exec()
** call that started the parser exits.  This routine makes a persistent
** copy of all the Expr.token.z strings so that the TriggerStep structure
** will be valid even after the sqlite3_exec() call returns.
*/
static void sqlitePersistTriggerStep(sqlite3 *db, TriggerStep *p){
  if( p->target.z ){
    p->target.z = (u8*)sqlite3DbStrNDup(db, (char*)p->target.z, p->target.n);
    p->target.dyn = 1;
  }
  if( p->pSelect ){
    Select *pNew = sqlite3SelectDup(db, p->pSelect);
    sqlite3SelectDelete(db, p->pSelect);
    p->pSelect = pNew;
  }
  if( p->pWhere ){
    Expr *pNew = sqlite3ExprDup(db, p->pWhere);
    sqlite3ExprDelete(db, p->pWhere);
    p->pWhere = pNew;
  }
  if( p->pExprList ){
    ExprList *pNew = sqlite3ExprListDup(db, p->pExprList);
    sqlite3ExprListDelete(db, p->pExprList);
    p->pExprList = pNew;
  }
  if( p->pIdList ){
    IdList *pNew = sqlite3IdListDup(db, p->pIdList);
    sqlite3IdListDelete(db, p->pIdList);
    p->pIdList = pNew;
  }
}

/*
** Turn a SELECT statement (that the pSelect parameter points to) into
** a trigger step.  Return a pointer to a TriggerStep structure.
**
** The parser calls this routine when it finds a SELECT statement in
** body of a TRIGGER.  
*/
TriggerStep *sqlite3TriggerSelectStep(sqlite3 *db, Select *pSelect){
  TriggerStep *pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep));
  if( pTriggerStep==0 ) {
    sqlite3SelectDelete(db, pSelect);
    return 0;
  }

  pTriggerStep->op = TK_SELECT;
  pTriggerStep->pSelect = pSelect;
  pTriggerStep->orconf = OE_Default;
  sqlitePersistTriggerStep(db, pTriggerStep);

  return pTriggerStep;
}

/*
** Build a trigger step out of an INSERT statement.  Return a pointer
** to the new trigger step.
**
** The parser calls this routine when it sees an INSERT inside the
** body of a trigger.
*/
TriggerStep *sqlite3TriggerInsertStep(
  sqlite3 *db,        /* The database connection */
  Token *pTableName,  /* Name of the table into which we insert */
  IdList *pColumn,    /* List of columns in pTableName to insert into */
  ExprList *pEList,   /* The VALUE clause: a list of values to be inserted */
  Select *pSelect,    /* A SELECT statement that supplies values */
  int orconf          /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */
){
  TriggerStep *pTriggerStep;

  assert(pEList == 0 || pSelect == 0);
  assert(pEList != 0 || pSelect != 0 || db->mallocFailed);

  pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep));
  if( pTriggerStep ){
    pTriggerStep->op = TK_INSERT;
    pTriggerStep->pSelect = pSelect;
    pTriggerStep->target  = *pTableName;
    pTriggerStep->pIdList = pColumn;
    pTriggerStep->pExprList = pEList;
    pTriggerStep->orconf = orconf;
    sqlitePersistTriggerStep(db, pTriggerStep);
  }else{
    sqlite3IdListDelete(db, pColumn);
    sqlite3ExprListDelete(db, pEList);
    sqlite3SelectDelete(db, pSelect);
  }

  return pTriggerStep;
}

/*
** Construct a trigger step that implements an UPDATE statement and return
** a pointer to that trigger step.  The parser calls this routine when it
** sees an UPDATE statement inside the body of a CREATE TRIGGER.
*/
TriggerStep *sqlite3TriggerUpdateStep(
  sqlite3 *db,         /* The database connection */
  Token *pTableName,   /* Name of the table to be updated */
  ExprList *pEList,    /* The SET clause: list of column and new values */
  Expr *pWhere,        /* The WHERE clause */
  int orconf           /* The conflict algorithm. (OE_Abort, OE_Ignore, etc) */
){
  TriggerStep *pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep));
  if( pTriggerStep==0 ){
     sqlite3ExprListDelete(db, pEList);
     sqlite3ExprDelete(db, pWhere);
     return 0;
  }

  pTriggerStep->op = TK_UPDATE;
  pTriggerStep->target  = *pTableName;
  pTriggerStep->pExprList = pEList;
  pTriggerStep->pWhere = pWhere;
  pTriggerStep->orconf = orconf;
  sqlitePersistTriggerStep(db, pTriggerStep);

  return pTriggerStep;
}

/*
** Construct a trigger step that implements a DELETE statement and return
** a pointer to that trigger step.  The parser calls this routine when it
** sees a DELETE statement inside the body of a CREATE TRIGGER.
*/
TriggerStep *sqlite3TriggerDeleteStep(
  sqlite3 *db,            /* Database connection */
  Token *pTableName,      /* The table from which rows are deleted */
  Expr *pWhere            /* The WHERE clause */
){
  TriggerStep *pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep));
  if( pTriggerStep==0 ){
    sqlite3ExprDelete(db, pWhere);
    return 0;
  }

  pTriggerStep->op = TK_DELETE;
  pTriggerStep->target  = *pTableName;
  pTriggerStep->pWhere = pWhere;
  pTriggerStep->orconf = OE_Default;
  sqlitePersistTriggerStep(db, pTriggerStep);

  return pTriggerStep;
}

/* 
** Recursively delete a Trigger structure
*/
void sqlite3DeleteTrigger(sqlite3 *db, Trigger *pTrigger){
  if( pTrigger==0 ) return;
  sqlite3DeleteTriggerStep(db, pTrigger->step_list);
  sqlite3DbFree(db, pTrigger->name);
  sqlite3DbFree(db, pTrigger->table);
  sqlite3ExprDelete(db, pTrigger->pWhen);
  sqlite3IdListDelete(db, pTrigger->pColumns);
  if( pTrigger->nameToken.dyn ) sqlite3DbFree(db, (char*)pTrigger->nameToken.z);
  sqlite3DbFree(db, pTrigger);
}

/*
** This function is called to drop a trigger from the database schema. 
**
** This may be called directly from the parser and therefore identifies
** the trigger by name.  The sqlite3DropTriggerPtr() routine does the
** same job as this routine except it takes a pointer to the trigger
** instead of the trigger name.
**/
void sqlite3DropTrigger(Parse *pParse, SrcList *pName, int noErr){
  Trigger *pTrigger = 0;
  int i;
  const char *zDb;
  const char *zName;
  int nName;
  sqlite3 *db = pParse->db;

  if( db->mallocFailed ) goto drop_trigger_cleanup;
  if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){
    goto drop_trigger_cleanup;
  }

  assert( pName->nSrc==1 );
  zDb = pName->a[0].zDatabase;
  zName = pName->a[0].zName;
  nName = strlen(zName);
  for(i=OMIT_TEMPDB; i<db->nDb; i++){
    int j = (i<2) ? i^1 : i;  /* Search TEMP before MAIN */
    if( zDb && sqlite3StrICmp(db->aDb[j].zName, zDb) ) continue;
    pTrigger = sqlite3HashFind(&(db->aDb[j].pSchema->trigHash), zName, nName);
    if( pTrigger ) break;
  }
  if( !pTrigger ){
    if( !noErr ){
      sqlite3ErrorMsg(pParse, "no such trigger: %S", pName, 0);
    }
    goto drop_trigger_cleanup;
  }
  sqlite3DropTriggerPtr(pParse, pTrigger);

drop_trigger_cleanup:
  sqlite3SrcListDelete(db, pName);
}

/*
** Return a pointer to the Table structure for the table that a trigger
** is set on.
*/
static Table *tableOfTrigger(Trigger *pTrigger){
  int n = strlen(pTrigger->table) + 1;
  return sqlite3HashFind(&pTrigger->pTabSchema->tblHash, pTrigger->table, n);
}


/*
** Drop a trigger given a pointer to that trigger. 
*/
void sqlite3DropTriggerPtr(Parse *pParse, Trigger *pTrigger){
  Table   *pTable;
  Vdbe *v;
  sqlite3 *db = pParse->db;
  int iDb;

  iDb = sqlite3SchemaToIndex(pParse->db, pTrigger->pSchema);
  assert( iDb>=0 && iDb<db->nDb );
  pTable = tableOfTrigger(pTrigger);
  assert( pTable );
  assert( pTable->pSchema==pTrigger->pSchema || iDb==1 );
#ifndef SQLITE_OMIT_AUTHORIZATION
  {
    int code = SQLITE_DROP_TRIGGER;
    const char *zDb = db->aDb[iDb].zName;
    const char *zTab = SCHEMA_TABLE(iDb);
    if( iDb==1 ) code = SQLITE_DROP_TEMP_TRIGGER;
    if( sqlite3AuthCheck(pParse, code, pTrigger->name, pTable->zName, zDb) ||
      sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){
      return;
    }
  }
#endif

  /* Generate code to destroy the database record of the trigger.
  */
  assert( pTable!=0 );
  if( (v = sqlite3GetVdbe(pParse))!=0 ){
    int base;
    static const VdbeOpList dropTrigger[] = {
      { OP_Rewind,     0, ADDR(9),  0},
      { OP_String8,    0, 1,        0}, /* 1 */
      { OP_Column,     0, 1,        2},
      { OP_Ne,         2, ADDR(8),  1},
      { OP_String8,    0, 1,        0}, /* 4: "trigger" */
      { OP_Column,     0, 0,        2},
      { OP_Ne,         2, ADDR(8),  1},
      { OP_Delete,     0, 0,        0},
      { OP_Next,       0, ADDR(1),  0}, /* 8 */
    };

    sqlite3BeginWriteOperation(pParse, 0, iDb);
    sqlite3OpenMasterTable(pParse, iDb);
    base = sqlite3VdbeAddOpList(v,  ArraySize(dropTrigger), dropTrigger);
    sqlite3VdbeChangeP4(v, base+1, pTrigger->name, 0);
    sqlite3VdbeChangeP4(v, base+4, "trigger", P4_STATIC);
    sqlite3ChangeCookie(pParse, iDb);
    sqlite3VdbeAddOp2(v, OP_Close, 0, 0);
    sqlite3VdbeAddOp4(v, OP_DropTrigger, iDb, 0, 0, pTrigger->name, 0);
  }
}

/*
** Remove a trigger from the hash tables of the sqlite* pointer.
*/
void sqlite3UnlinkAndDeleteTrigger(sqlite3 *db, int iDb, const char *zName){
  Trigger *pTrigger;
  int nName = strlen(zName);
  pTrigger = sqlite3HashInsert(&(db->aDb[iDb].pSchema->trigHash),
                               zName, nName, 0);
  if( pTrigger ){
    Table *pTable = tableOfTrigger(pTrigger);
    assert( pTable!=0 );
    if( pTable->pTrigger == pTrigger ){
      pTable->pTrigger = pTrigger->pNext;
    }else{
      Trigger *cc = pTable->pTrigger;
      while( cc ){ 
        if( cc->pNext == pTrigger ){
          cc->pNext = cc->pNext->pNext;
          break;
        }
        cc = cc->pNext;
      }
      assert(cc);
    }
    sqlite3DeleteTrigger(db, pTrigger);
    db->flags |= SQLITE_InternChanges;
  }
}

/*
** pEList is the SET clause of an UPDATE statement.  Each entry
** in pEList is of the format <id>=<expr>.  If any of the entries
** in pEList have an <id> which matches an identifier in pIdList,
** then return TRUE.  If pIdList==NULL, then it is considered a
** wildcard that matches anything.  Likewise if pEList==NULL then
** it matches anything so always return true.  Return false only
** if there is no match.
*/
static int checkColumnOverLap(IdList *pIdList, ExprList *pEList){
  int e;
  if( !pIdList || !pEList ) return 1;
  for(e=0; e<pEList->nExpr; e++){
    if( sqlite3IdListIndex(pIdList, pEList->a[e].zName)>=0 ) return 1;
  }
  return 0; 
}

/*
** Return a bit vector to indicate what kind of triggers exist for operation
** "op" on table pTab.  If pChanges is not NULL then it is a list of columns
** that are being updated.  Triggers only match if the ON clause of the
** trigger definition overlaps the set of columns being updated.
**
** The returned bit vector is some combination of TRIGGER_BEFORE and
** TRIGGER_AFTER.
*/
int sqlite3TriggersExist(
  Parse *pParse,          /* Used to check for recursive triggers */
  Table *pTab,            /* The table the contains the triggers */
  int op,                 /* one of TK_DELETE, TK_INSERT, TK_UPDATE */
  ExprList *pChanges      /* Columns that change in an UPDATE statement */
){
  Trigger *pTrigger;
  int mask = 0;

  pTrigger = IsVirtual(pTab) ? 0 : pTab->pTrigger;
  while( pTrigger ){
    if( pTrigger->op==op && checkColumnOverLap(pTrigger->pColumns, pChanges) ){
      mask |= pTrigger->tr_tm;
    }
    pTrigger = pTrigger->pNext;
  }
  return mask;
}

/*
** Convert the pStep->target token into a SrcList and return a pointer
** to that SrcList.
**
** This routine adds a specific database name, if needed, to the target when
** forming the SrcList.  This prevents a trigger in one database from
** referring to a target in another database.  An exception is when the
** trigger is in TEMP in which case it can refer to any other database it
** wants.
*/
static SrcList *targetSrcList(
  Parse *pParse,       /* The parsing context */
  TriggerStep *pStep   /* The trigger containing the target token */
){
  Token sDb;           /* Dummy database name token */
  int iDb;             /* Index of the database to use */
  SrcList *pSrc;       /* SrcList to be returned */

  iDb = sqlite3SchemaToIndex(pParse->db, pStep->pTrig->pSchema);
  if( iDb==0 || iDb>=2 ){
    assert( iDb<pParse->db->nDb );
    sDb.z = (u8*)pParse->db->aDb[iDb].zName;
    sDb.n = strlen((char*)sDb.z);
    pSrc = sqlite3SrcListAppend(pParse->db, 0, &sDb, &pStep->target);
  } else {
    pSrc = sqlite3SrcListAppend(pParse->db, 0, &pStep->target, 0);
  }
  return pSrc;
}

/*
** Generate VDBE code for zero or more statements inside the body of a
** trigger.  
*/
static int codeTriggerProgram(
  Parse *pParse,            /* The parser context */
  TriggerStep *pStepList,   /* List of statements inside the trigger body */
  int orconfin              /* Conflict algorithm. (OE_Abort, etc) */  
){
  TriggerStep * pTriggerStep = pStepList;
  int orconf;
  Vdbe *v = pParse->pVdbe;
  sqlite3 *db = pParse->db;

  assert( pTriggerStep!=0 );
  assert( v!=0 );
  sqlite3VdbeAddOp2(v, OP_ContextPush, 0, 0);
  VdbeComment((v, "begin trigger %s", pStepList->pTrig->name));
  while( pTriggerStep ){
    orconf = (orconfin == OE_Default)?pTriggerStep->orconf:orconfin;
    pParse->trigStack->orconf = orconf;
    switch( pTriggerStep->op ){
      case TK_SELECT: {
        Select *ss = sqlite3SelectDup(db, pTriggerStep->pSelect);
        if( ss ){
          SelectDest dest;

          sqlite3SelectDestInit(&dest, SRT_Discard, 0);
          sqlite3SelectResolve(pParse, ss, 0);
          sqlite3Select(pParse, ss, &dest, 0, 0, 0);
          sqlite3SelectDelete(db, ss);
        }
        break;
      }
      case TK_UPDATE: {
        SrcList *pSrc;
        pSrc = targetSrcList(pParse, pTriggerStep);
        sqlite3VdbeAddOp2(v, OP_ResetCount, 0, 0);
        sqlite3Update(pParse, pSrc,
                sqlite3ExprListDup(db, pTriggerStep->pExprList), 
                sqlite3ExprDup(db, pTriggerStep->pWhere), orconf);
        sqlite3VdbeAddOp2(v, OP_ResetCount, 1, 0);
        break;
      }
      case TK_INSERT: {
        SrcList *pSrc;
        pSrc = targetSrcList(pParse, pTriggerStep);
        sqlite3VdbeAddOp2(v, OP_ResetCount, 0, 0);
        sqlite3Insert(pParse, pSrc,
          sqlite3ExprListDup(db, pTriggerStep->pExprList), 
          sqlite3SelectDup(db, pTriggerStep->pSelect), 
          sqlite3IdListDup(db, pTriggerStep->pIdList), orconf);
        sqlite3VdbeAddOp2(v, OP_ResetCount, 1, 0);
        break;
      }
      case TK_DELETE: {
        SrcList *pSrc;
        sqlite3VdbeAddOp2(v, OP_ResetCount, 0, 0);
        pSrc = targetSrcList(pParse, pTriggerStep);
        sqlite3DeleteFrom(pParse, pSrc, 
                          sqlite3ExprDup(db, pTriggerStep->pWhere));
        sqlite3VdbeAddOp2(v, OP_ResetCount, 1, 0);
        break;
      }
      default:
        assert(0);
    } 
    pTriggerStep = pTriggerStep->pNext;
  }
  sqlite3VdbeAddOp2(v, OP_ContextPop, 0, 0);
  VdbeComment((v, "end trigger %s", pStepList->pTrig->name));

  return 0;
}

/*
** This is called to code FOR EACH ROW triggers.
**
** When the code that this function generates is executed, the following 
** must be true:
**
** 1. No cursors may be open in the main database.  (But newIdx and oldIdx
**    can be indices of cursors in temporary tables.  See below.)
**
** 2. If the triggers being coded are ON INSERT or ON UPDATE triggers, then
**    a temporary vdbe cursor (index newIdx) must be open and pointing at
**    a row containing values to be substituted for new.* expressions in the
**    trigger program(s).
**
** 3. If the triggers being coded are ON DELETE or ON UPDATE triggers, then
**    a temporary vdbe cursor (index oldIdx) must be open and pointing at
**    a row containing values to be substituted for old.* expressions in the
**    trigger program(s).
**
** If they are not NULL, the piOldColMask and piNewColMask output variables
** are set to values that describe the columns used by the trigger program
** in the OLD.* and NEW.* tables respectively. If column N of the 
** pseudo-table is read at least once, the corresponding bit of the output
** mask is set. If a column with an index greater than 32 is read, the
** output mask is set to the special value 0xffffffff.
**
*/
int sqlite3CodeRowTrigger(
  Parse *pParse,       /* Parse context */
  int op,              /* One of TK_UPDATE, TK_INSERT, TK_DELETE */
  ExprList *pChanges,  /* Changes list for any UPDATE OF triggers */
  int tr_tm,           /* One of TRIGGER_BEFORE, TRIGGER_AFTER */
  Table *pTab,         /* The table to code triggers from */
  int newIdx,          /* The indice of the "new" row to access */
  int oldIdx,          /* The indice of the "old" row to access */
  int orconf,          /* ON CONFLICT policy */
  int ignoreJump,      /* Instruction to jump to for RAISE(IGNORE) */
  u32 *piOldColMask,   /* OUT: Mask of columns used from the OLD.* table */
  u32 *piNewColMask    /* OUT: Mask of columns used from the NEW.* table */
){
  Trigger *p;
  sqlite3 *db = pParse->db;
  TriggerStack trigStackEntry;

  trigStackEntry.oldColMask = 0;
  trigStackEntry.newColMask = 0;

  assert(op == TK_UPDATE || op == TK_INSERT || op == TK_DELETE);
  assert(tr_tm == TRIGGER_BEFORE || tr_tm == TRIGGER_AFTER );

  assert(newIdx != -1 || oldIdx != -1);

  for(p=pTab->pTrigger; p; p=p->pNext){
    int fire_this = 0;

    /* Determine whether we should code this trigger */
    if( 
      p->op==op && 
      p->tr_tm==tr_tm && 
      (p->pSchema==p->pTabSchema || p->pSchema==db->aDb[1].pSchema) &&
      (op!=TK_UPDATE||!p->pColumns||checkColumnOverLap(p->pColumns,pChanges))
    ){
      TriggerStack *pS;      /* Pointer to trigger-stack entry */
      for(pS=pParse->trigStack; pS && p!=pS->pTrigger; pS=pS->pNext){}
      if( !pS ){
        fire_this = 1;
      }
#if 0    /* Give no warning for recursive triggers.  Just do not do them */
      else{
        sqlite3ErrorMsg(pParse, "recursive triggers not supported (%s)",
            p->name);
        return SQLITE_ERROR;
      }
#endif
    }
 
    if( fire_this ){
      int endTrigger;
      Expr * whenExpr;
      AuthContext sContext;
      NameContext sNC;

#ifndef SQLITE_OMIT_TRACE
      sqlite3VdbeAddOp4(pParse->pVdbe, OP_Trace, 0, 0, 0,
                        sqlite3MPrintf(db, "-- TRIGGER %s", p->name),
                        P4_DYNAMIC);
#endif
      memset(&sNC, 0, sizeof(sNC));
      sNC.pParse = pParse;

      /* Push an entry on to the trigger stack */
      trigStackEntry.pTrigger = p;
      trigStackEntry.newIdx = newIdx;
      trigStackEntry.oldIdx = oldIdx;
      trigStackEntry.pTab = pTab;
      trigStackEntry.pNext = pParse->trigStack;
      trigStackEntry.ignoreJump = ignoreJump;
      pParse->trigStack = &trigStackEntry;
      sqlite3AuthContextPush(pParse, &sContext, p->name);

      /* code the WHEN clause */
      endTrigger = sqlite3VdbeMakeLabel(pParse->pVdbe);
      whenExpr = sqlite3ExprDup(db, p->pWhen);
      if( db->mallocFailed || sqlite3ExprResolveNames(&sNC, whenExpr) ){
        pParse->trigStack = trigStackEntry.pNext;
        sqlite3ExprDelete(db, whenExpr);
        return 1;
      }
      sqlite3ExprIfFalse(pParse, whenExpr, endTrigger, SQLITE_JUMPIFNULL);
      sqlite3ExprDelete(db, whenExpr);

      codeTriggerProgram(pParse, p->step_list, orconf); 

      /* Pop the entry off the trigger stack */
      pParse->trigStack = trigStackEntry.pNext;
      sqlite3AuthContextPop(&sContext);

      sqlite3VdbeResolveLabel(pParse->pVdbe, endTrigger);
    }
  }
  if( piOldColMask ) *piOldColMask |= trigStackEntry.oldColMask;
  if( piNewColMask ) *piNewColMask |= trigStackEntry.newColMask;
  return 0;
}
#endif /* !defined(SQLITE_OMIT_TRIGGER) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/update.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains C code routines that are called by the parser
** to handle UPDATE statements.
**
** $Id: update.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "sqliteInt.h"

#ifndef SQLITE_OMIT_VIRTUALTABLE
/* Forward declaration */
static void updateVirtualTable(
  Parse *pParse,       /* The parsing context */
  SrcList *pSrc,       /* The virtual table to be modified */
  Table *pTab,         /* The virtual table */
  ExprList *pChanges,  /* The columns to change in the UPDATE statement */
  Expr *pRowidExpr,    /* Expression used to recompute the rowid */
  int *aXRef,          /* Mapping from columns of pTab to entries in pChanges */
  Expr *pWhere         /* WHERE clause of the UPDATE statement */
);
#endif /* SQLITE_OMIT_VIRTUALTABLE */

/*
** The most recently coded instruction was an OP_Column to retrieve the
** i-th column of table pTab. This routine sets the P4 parameter of the 
** OP_Column to the default value, if any.
**
** The default value of a column is specified by a DEFAULT clause in the 
** column definition. This was either supplied by the user when the table
** was created, or added later to the table definition by an ALTER TABLE
** command. If the latter, then the row-records in the table btree on disk
** may not contain a value for the column and the default value, taken
** from the P4 parameter of the OP_Column instruction, is returned instead.
** If the former, then all row-records are guaranteed to include a value
** for the column and the P4 value is not required.
**
** Column definitions created by an ALTER TABLE command may only have 
** literal default values specified: a number, null or a string. (If a more
** complicated default expression value was provided, it is evaluated 
** when the ALTER TABLE is executed and one of the literal values written
** into the sqlite_master table.)
**
** Therefore, the P4 parameter is only required if the default value for
** the column is a literal number, string or null. The sqlite3ValueFromExpr()
** function is capable of transforming these types of expressions into
** sqlite3_value objects.
*/
void sqlite3ColumnDefault(Vdbe *v, Table *pTab, int i){
  if( pTab && !pTab->pSelect ){
    sqlite3_value *pValue;
    u8 enc = ENC(sqlite3VdbeDb(v));
    Column *pCol = &pTab->aCol[i];
    VdbeComment((v, "%s.%s", pTab->zName, pCol->zName));
    assert( i<pTab->nCol );
    sqlite3ValueFromExpr(sqlite3VdbeDb(v), pCol->pDflt, enc, 
                         pCol->affinity, &pValue);
    if( pValue ){
      sqlite3VdbeChangeP4(v, -1, (const char *)pValue, P4_MEM);
    }
  }
}

/*
** Process an UPDATE statement.
**
**   UPDATE OR IGNORE table_wxyz SET a=b, c=d WHERE e<5 AND f NOT NULL;
**          \_______/ \________/     \______/       \________________/
*            onError   pTabList      pChanges             pWhere
*/
void sqlite3Update(
  Parse *pParse,         /* The parser context */
  SrcList *pTabList,     /* The table in which we should change things */
  ExprList *pChanges,    /* Things to be changed */
  Expr *pWhere,          /* The WHERE clause.  May be null */
  int onError            /* How to handle constraint errors */
){
  int i, j;              /* Loop counters */
  Table *pTab;           /* The table to be updated */
  int addr = 0;          /* VDBE instruction address of the start of the loop */
  WhereInfo *pWInfo;     /* Information about the WHERE clause */
  Vdbe *v;               /* The virtual database engine */
  Index *pIdx;           /* For looping over indices */
  int nIdx;              /* Number of indices that need updating */
  int iCur;              /* VDBE Cursor number of pTab */
  sqlite3 *db;           /* The database structure */
  int *aRegIdx = 0;      /* One register assigned to each index to be updated */
  int *aXRef = 0;        /* aXRef[i] is the index in pChanges->a[] of the
                         ** an expression for the i-th column of the table.
                         ** aXRef[i]==-1 if the i-th column is not changed. */
  int chngRowid;         /* True if the record number is being changed */
  Expr *pRowidExpr = 0;  /* Expression defining the new record number */
  int openAll = 0;       /* True if all indices need to be opened */
  AuthContext sContext;  /* The authorization context */
  NameContext sNC;       /* The name-context to resolve expressions in */
  int iDb;               /* Database containing the table being updated */
  int j1;                /* Addresses of jump instructions */
  int okOnePass;         /* True for one-pass algorithm without the FIFO */

#ifndef SQLITE_OMIT_TRIGGER
  int isView;                  /* Trying to update a view */
  int triggers_exist = 0;      /* True if any row triggers exist */
#endif
  int iBeginAfterTrigger;      /* Address of after trigger program */
  int iEndAfterTrigger;        /* Exit of after trigger program */
  int iBeginBeforeTrigger;     /* Address of before trigger program */
  int iEndBeforeTrigger;       /* Exit of before trigger program */
  u32 old_col_mask = 0;        /* Mask of OLD.* columns in use */
  u32 new_col_mask = 0;        /* Mask of NEW.* columns in use */

  int newIdx      = -1;  /* index of trigger "new" temp table       */
  int oldIdx      = -1;  /* index of trigger "old" temp table       */

  /* Register Allocations */
  int regRowCount = 0;   /* A count of rows changed */
  int regOldRowid;       /* The old rowid */
  int regNewRowid;       /* The new rowid */
  int regData;           /* New data for the row */

  sContext.pParse = 0;
  db = pParse->db;
  if( pParse->nErr || db->mallocFailed ){
    goto update_cleanup;
  }
  assert( pTabList->nSrc==1 );

  /* Locate the table which we want to update. 
  */
  pTab = sqlite3SrcListLookup(pParse, pTabList);
  if( pTab==0 ) goto update_cleanup;
  iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);

  /* Figure out if we have any triggers and if the table being
  ** updated is a view
  */
#ifndef SQLITE_OMIT_TRIGGER
  triggers_exist = sqlite3TriggersExist(pParse, pTab, TK_UPDATE, pChanges);
  isView = pTab->pSelect!=0;
#else
# define triggers_exist 0
# define isView 0
#endif
#ifdef SQLITE_OMIT_VIEW
# undef isView
# define isView 0
#endif

  if( sqlite3IsReadOnly(pParse, pTab, triggers_exist) ){
    goto update_cleanup;
  }
  if( sqlite3ViewGetColumnNames(pParse, pTab) ){
    goto update_cleanup;
  }
  aXRef = sqlite3DbMallocRaw(db, sizeof(int) * pTab->nCol );
  if( aXRef==0 ) goto update_cleanup;
  for(i=0; i<pTab->nCol; i++) aXRef[i] = -1;

  /* If there are FOR EACH ROW triggers, allocate cursors for the
  ** special OLD and NEW tables
  */
  if( triggers_exist ){
    newIdx = pParse->nTab++;
    oldIdx = pParse->nTab++;
  }

  /* Allocate a cursors for the main database table and for all indices.
  ** The index cursors might not be used, but if they are used they
  ** need to occur right after the database cursor.  So go ahead and
  ** allocate enough space, just in case.
  */
  pTabList->a[0].iCursor = iCur = pParse->nTab++;
  for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
    pParse->nTab++;
  }

  /* Initialize the name-context */
  memset(&sNC, 0, sizeof(sNC));
  sNC.pParse = pParse;
  sNC.pSrcList = pTabList;

  /* Resolve the column names in all the expressions of the
  ** of the UPDATE statement.  Also find the column index
  ** for each column to be updated in the pChanges array.  For each
  ** column to be updated, make sure we have authorization to change
  ** that column.
  */
  chngRowid = 0;
  for(i=0; i<pChanges->nExpr; i++){
    if( sqlite3ExprResolveNames(&sNC, pChanges->a[i].pExpr) ){
      goto update_cleanup;
    }
    for(j=0; j<pTab->nCol; j++){
      if( sqlite3StrICmp(pTab->aCol[j].zName, pChanges->a[i].zName)==0 ){
        if( j==pTab->iPKey ){
          chngRowid = 1;
          pRowidExpr = pChanges->a[i].pExpr;
        }
        aXRef[j] = i;
        break;
      }
    }
    if( j>=pTab->nCol ){
      if( sqlite3IsRowid(pChanges->a[i].zName) ){
        chngRowid = 1;
        pRowidExpr = pChanges->a[i].pExpr;
      }else{
        sqlite3ErrorMsg(pParse, "no such column: %s", pChanges->a[i].zName);
        goto update_cleanup;
      }
    }
#ifndef SQLITE_OMIT_AUTHORIZATION
    {
      int rc;
      rc = sqlite3AuthCheck(pParse, SQLITE_UPDATE, pTab->zName,
                           pTab->aCol[j].zName, db->aDb[iDb].zName);
      if( rc==SQLITE_DENY ){
        goto update_cleanup;
      }else if( rc==SQLITE_IGNORE ){
        aXRef[j] = -1;
      }
    }
#endif
  }

  /* Allocate memory for the array aRegIdx[].  There is one entry in the
  ** array for each index associated with table being updated.  Fill in
  ** the value with a register number for indices that are to be used
  ** and with zero for unused indices.
  */
  for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){}
  if( nIdx>0 ){
    aRegIdx = sqlite3DbMallocRaw(db, sizeof(Index*) * nIdx );
    if( aRegIdx==0 ) goto update_cleanup;
  }
  for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
    int reg;
    if( chngRowid ){
      reg = ++pParse->nMem;
    }else{
      reg = 0;
      for(i=0; i<pIdx->nColumn; i++){
        if( aXRef[pIdx->aiColumn[i]]>=0 ){
          reg = ++pParse->nMem;
          break;
        }
      }
    }
    aRegIdx[j] = reg;
  }

  /* Allocate a block of register used to store the change record
  ** sent to sqlite3GenerateConstraintChecks().  There are either
  ** one or two registers for holding the rowid.  One rowid register
  ** is used if chngRowid is false and two are used if chngRowid is
  ** true.  Following these are pTab->nCol register holding column
  ** data.
  */
  regOldRowid = regNewRowid = pParse->nMem + 1;
  pParse->nMem += pTab->nCol + 1;
  if( chngRowid ){
    regNewRowid++;
    pParse->nMem++;
  }
  regData = regNewRowid+1;
 

  /* Begin generating code.
  */
  v = sqlite3GetVdbe(pParse);
  if( v==0 ) goto update_cleanup;
  if( pParse->nested==0 ) sqlite3VdbeCountChanges(v);
  sqlite3BeginWriteOperation(pParse, 1, iDb);

#ifndef SQLITE_OMIT_VIRTUALTABLE
  /* Virtual tables must be handled separately */
  if( IsVirtual(pTab) ){
    updateVirtualTable(pParse, pTabList, pTab, pChanges, pRowidExpr, aXRef,
                       pWhere);
    pWhere = 0;
    pTabList = 0;
    goto update_cleanup;
  }
#endif

  /* Start the view context
  */
  if( isView ){
    sqlite3AuthContextPush(pParse, &sContext, pTab->zName);
  }

  /* Generate the code for triggers.
  */
  if( triggers_exist ){
    int iGoto;

    /* Create pseudo-tables for NEW and OLD
    */
    sqlite3VdbeAddOp2(v, OP_SetNumColumns, 0, pTab->nCol);
    sqlite3VdbeAddOp2(v, OP_OpenPseudo, oldIdx, 0);
    sqlite3VdbeAddOp2(v, OP_SetNumColumns, 0, pTab->nCol);
    sqlite3VdbeAddOp2(v, OP_OpenPseudo, newIdx, 0);

    iGoto = sqlite3VdbeAddOp2(v, OP_Goto, 0, 0);
    addr = sqlite3VdbeMakeLabel(v);
    iBeginBeforeTrigger = sqlite3VdbeCurrentAddr(v);
    if( sqlite3CodeRowTrigger(pParse, TK_UPDATE, pChanges, TRIGGER_BEFORE, pTab,
          newIdx, oldIdx, onError, addr, &old_col_mask, &new_col_mask) ){
      goto update_cleanup;
    }
    iEndBeforeTrigger = sqlite3VdbeAddOp2(v, OP_Goto, 0, 0);
    iBeginAfterTrigger = sqlite3VdbeCurrentAddr(v);
    if( sqlite3CodeRowTrigger(pParse, TK_UPDATE, pChanges, TRIGGER_AFTER, pTab, 
          newIdx, oldIdx, onError, addr, &old_col_mask, &new_col_mask) ){
      goto update_cleanup;
    }
    iEndAfterTrigger = sqlite3VdbeAddOp2(v, OP_Goto, 0, 0);
    sqlite3VdbeJumpHere(v, iGoto);
  }

  /* If we are trying to update a view, realize that view into
  ** a ephemeral table.
  */
  if( isView ){
    sqlite3MaterializeView(pParse, pTab->pSelect, pWhere, iCur);
  }

  /* Resolve the column names in all the expressions in the
  ** WHERE clause.
  */
  if( sqlite3ExprResolveNames(&sNC, pWhere) ){
    goto update_cleanup;
  }

  /* Begin the database scan
  */
  sqlite3VdbeAddOp2(v, OP_Null, 0, regOldRowid);
  pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0,
                             WHERE_ONEPASS_DESIRED);
  if( pWInfo==0 ) goto update_cleanup;
  okOnePass = pWInfo->okOnePass;

  /* Remember the rowid of every item to be updated.
  */
  sqlite3VdbeAddOp2(v, IsVirtual(pTab)?OP_VRowid:OP_Rowid, iCur, regOldRowid);
  if( !okOnePass ) sqlite3VdbeAddOp2(v, OP_FifoWrite, regOldRowid, 0);

  /* End the database scan loop.
  */
  sqlite3WhereEnd(pWInfo);

  /* Initialize the count of updated rows
  */
  if( db->flags & SQLITE_CountRows && !pParse->trigStack ){
    regRowCount = ++pParse->nMem;
    sqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount);
  }

  if( !isView && !IsVirtual(pTab) ){
    /* 
    ** Open every index that needs updating.  Note that if any
    ** index could potentially invoke a REPLACE conflict resolution 
    ** action, then we need to open all indices because we might need
    ** to be deleting some records.
    */
    if( !okOnePass ) sqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenWrite); 
    if( onError==OE_Replace ){
      openAll = 1;
    }else{
      openAll = 0;
      for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
        if( pIdx->onError==OE_Replace ){
          openAll = 1;
          break;
        }
      }
    }
    for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
      if( openAll || aRegIdx[i]>0 ){
        KeyInfo *pKey = sqlite3IndexKeyinfo(pParse, pIdx);
        sqlite3VdbeAddOp4(v, OP_OpenWrite, iCur+i+1, pIdx->tnum, iDb,
                       (char*)pKey, P4_KEYINFO_HANDOFF);
        assert( pParse->nTab>iCur+i+1 );
      }
    }
  }
  
  /* Jump back to this point if a trigger encounters an IGNORE constraint. */
  if( triggers_exist ){
    sqlite3VdbeResolveLabel(v, addr);
  }

  /* Top of the update loop */
  if( okOnePass ){
    int a1 = sqlite3VdbeAddOp1(v, OP_NotNull, regOldRowid);
    addr = sqlite3VdbeAddOp0(v, OP_Goto);
    sqlite3VdbeJumpHere(v, a1);
  }else{
    addr = sqlite3VdbeAddOp2(v, OP_FifoRead, regOldRowid, 0);
  }

  if( triggers_exist ){
    int regRowid;
    int regRow;
    int regCols;

    /* Make cursor iCur point to the record that is being updated.
    */
    sqlite3VdbeAddOp3(v, OP_NotExists, iCur, addr, regOldRowid);

    /* Generate the OLD table
    */
    regRowid = sqlite3GetTempReg(pParse);
    regRow = sqlite3GetTempReg(pParse);
    sqlite3VdbeAddOp2(v, OP_Rowid, iCur, regRowid);
    if( !old_col_mask ){
      sqlite3VdbeAddOp2(v, OP_Null, 0, regRow);
    }else{
      sqlite3VdbeAddOp2(v, OP_RowData, iCur, regRow);
    }
    sqlite3VdbeAddOp3(v, OP_Insert, oldIdx, regRow, regRowid);

    /* Generate the NEW table
    */
    if( chngRowid ){
      sqlite3ExprCodeAndCache(pParse, pRowidExpr, regRowid);
    }else{
      sqlite3VdbeAddOp2(v, OP_Rowid, iCur, regRowid);
    }
    regCols = sqlite3GetTempRange(pParse, pTab->nCol);
    for(i=0; i<pTab->nCol; i++){
      if( i==pTab->iPKey ){
        sqlite3VdbeAddOp2(v, OP_Null, 0, regCols+i);
        continue;
      }
      j = aXRef[i];
      if( new_col_mask&((u32)1<<i) || new_col_mask==0xffffffff ){
        if( j<0 ){
          sqlite3VdbeAddOp3(v, OP_Column, iCur, i, regCols+i);
          sqlite3ColumnDefault(v, pTab, i);
        }else{
          sqlite3ExprCodeAndCache(pParse, pChanges->a[j].pExpr, regCols+i);
        }
      }else{
        sqlite3VdbeAddOp2(v, OP_Null, 0, regCols+i);
      }
    }
    sqlite3VdbeAddOp3(v, OP_MakeRecord, regCols, pTab->nCol, regRow);
    if( !isView ){
      sqlite3TableAffinityStr(v, pTab);
      sqlite3ExprCacheAffinityChange(pParse, regCols, pTab->nCol);
    }
    sqlite3ReleaseTempRange(pParse, regCols, pTab->nCol);
    /* if( pParse->nErr ) goto update_cleanup; */
    sqlite3VdbeAddOp3(v, OP_Insert, newIdx, regRow, regRowid);
    sqlite3ReleaseTempReg(pParse, regRowid);
    sqlite3ReleaseTempReg(pParse, regRow);

    sqlite3VdbeAddOp2(v, OP_Goto, 0, iBeginBeforeTrigger);
    sqlite3VdbeJumpHere(v, iEndBeforeTrigger);
  }

  if( !isView && !IsVirtual(pTab) ){
    /* Loop over every record that needs updating.  We have to load
    ** the old data for each record to be updated because some columns
    ** might not change and we will need to copy the old value.
    ** Also, the old data is needed to delete the old index entries.
    ** So make the cursor point at the old record.
    */
    sqlite3VdbeAddOp3(v, OP_NotExists, iCur, addr, regOldRowid);

    /* If the record number will change, push the record number as it
    ** will be after the update. (The old record number is currently
    ** on top of the stack.)
    */
    if( chngRowid ){
      sqlite3ExprCode(pParse, pRowidExpr, regNewRowid);
      sqlite3VdbeAddOp1(v, OP_MustBeInt, regNewRowid);
    }

    /* Compute new data for this record.  
    */
    for(i=0; i<pTab->nCol; i++){
      if( i==pTab->iPKey ){
        sqlite3VdbeAddOp2(v, OP_Null, 0, regData+i);
        continue;
      }
      j = aXRef[i];
      if( j<0 ){
        sqlite3VdbeAddOp3(v, OP_Column, iCur, i, regData+i);
        sqlite3ColumnDefault(v, pTab, i);
      }else{
        sqlite3ExprCode(pParse, pChanges->a[j].pExpr, regData+i);
      }
    }

    /* Do constraint checks
    */
    sqlite3GenerateConstraintChecks(pParse, pTab, iCur, regNewRowid,
                                    aRegIdx, chngRowid, 1,
                                    onError, addr);

    /* Delete the old indices for the current record.
    */
    j1 = sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, regOldRowid);
    sqlite3GenerateRowIndexDelete(pParse, pTab, iCur, aRegIdx);

    /* If changing the record number, delete the old record.
    */
    if( chngRowid ){
      sqlite3VdbeAddOp2(v, OP_Delete, iCur, 0);
    }
    sqlite3VdbeJumpHere(v, j1);

    /* Create the new index entries and the new record.
    */
    sqlite3CompleteInsertion(pParse, pTab, iCur, regNewRowid, 
                             aRegIdx, chngRowid, 1, -1, 0);
  }

  /* Increment the row counter 
  */
  if( db->flags & SQLITE_CountRows && !pParse->trigStack){
    sqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1);
  }

  /* If there are triggers, close all the cursors after each iteration
  ** through the loop.  The fire the after triggers.
  */
  if( triggers_exist ){
    sqlite3VdbeAddOp2(v, OP_Goto, 0, iBeginAfterTrigger);
    sqlite3VdbeJumpHere(v, iEndAfterTrigger);
  }

  /* Repeat the above with the next record to be updated, until
  ** all record selected by the WHERE clause have been updated.
  */
  sqlite3VdbeAddOp2(v, OP_Goto, 0, addr);
  sqlite3VdbeJumpHere(v, addr);

  /* Close all tables */
  for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){
    if( openAll || aRegIdx[i]>0 ){
      sqlite3VdbeAddOp2(v, OP_Close, iCur+i+1, 0);
    }
  }
  sqlite3VdbeAddOp2(v, OP_Close, iCur, 0);
  if( triggers_exist ){
    sqlite3VdbeAddOp2(v, OP_Close, newIdx, 0);
    sqlite3VdbeAddOp2(v, OP_Close, oldIdx, 0);
  }

  /*
  ** Return the number of rows that were changed. If this routine is 
  ** generating code because of a call to sqlite3NestedParse(), do not
  ** invoke the callback function.
  */
  if( db->flags & SQLITE_CountRows && !pParse->trigStack && pParse->nested==0 ){
    sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1);
    sqlite3VdbeSetNumCols(v, 1);
    sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows updated", P4_STATIC);
  }

update_cleanup:
  sqlite3AuthContextPop(&sContext);
  sqlite3DbFree(db, aRegIdx);
  sqlite3DbFree(db, aXRef);
  sqlite3SrcListDelete(db, pTabList);
  sqlite3ExprListDelete(db, pChanges);
  sqlite3ExprDelete(db, pWhere);
  return;
}

#ifndef SQLITE_OMIT_VIRTUALTABLE
/*
** Generate code for an UPDATE of a virtual table.
**
** The strategy is that we create an ephemerial table that contains
** for each row to be changed:
**
**   (A)  The original rowid of that row.
**   (B)  The revised rowid for the row. (note1)
**   (C)  The content of every column in the row.
**
** Then we loop over this ephemeral table and for each row in
** the ephermeral table call VUpdate.
**
** When finished, drop the ephemeral table.
**
** (note1) Actually, if we know in advance that (A) is always the same
** as (B) we only store (A), then duplicate (A) when pulling
** it out of the ephemeral table before calling VUpdate.
*/
static void updateVirtualTable(
  Parse *pParse,       /* The parsing context */
  SrcList *pSrc,       /* The virtual table to be modified */
  Table *pTab,         /* The virtual table */
  ExprList *pChanges,  /* The columns to change in the UPDATE statement */
  Expr *pRowid,        /* Expression used to recompute the rowid */
  int *aXRef,          /* Mapping from columns of pTab to entries in pChanges */
  Expr *pWhere         /* WHERE clause of the UPDATE statement */
){
  Vdbe *v = pParse->pVdbe;  /* Virtual machine under construction */
  ExprList *pEList = 0;     /* The result set of the SELECT statement */
  Select *pSelect = 0;      /* The SELECT statement */
  Expr *pExpr;              /* Temporary expression */
  int ephemTab;             /* Table holding the result of the SELECT */
  int i;                    /* Loop counter */
  int addr;                 /* Address of top of loop */
  int iReg;                 /* First register in set passed to OP_VUpdate */
  sqlite3 *db = pParse->db; /* Database connection */
  const char *pVtab = (const char*)pTab->pVtab;
  SelectDest dest;

  /* Construct the SELECT statement that will find the new values for
  ** all updated rows. 
  */
  pEList = sqlite3ExprListAppend(pParse, 0, 
                                 sqlite3CreateIdExpr(pParse, "_rowid_"), 0);
  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);
    }else{
      pExpr = sqlite3CreateIdExpr(pParse, pTab->aCol[i].zName);
    }
    pEList = sqlite3ExprListAppend(pParse, pEList, pExpr, 0);
  }
  pSelect = sqlite3SelectNew(pParse, pEList, pSrc, pWhere, 0, 0, 0, 0, 0, 0);
  
  /* Create the ephemeral table into which the update results will
  ** be stored.
  */
  assert( v );
  ephemTab = pParse->nTab++;
  sqlite3VdbeAddOp2(v, OP_OpenEphemeral, ephemTab, pTab->nCol+1+(pRowid!=0));

  /* fill the ephemeral table 
  */
  sqlite3SelectDestInit(&dest, SRT_Table, ephemTab);
  sqlite3Select(pParse, pSelect, &dest, 0, 0, 0);

  /* Generate code to scan the ephemeral table and call VUpdate. */
  iReg = ++pParse->nMem;
  pParse->nMem += pTab->nCol+1;
  sqlite3VdbeAddOp2(v, OP_Rewind, ephemTab, 0);
  addr = sqlite3VdbeCurrentAddr(v);
  sqlite3VdbeAddOp3(v, OP_Column,  ephemTab, 0, iReg);
  sqlite3VdbeAddOp3(v, OP_Column, ephemTab, (pRowid?1:0), iReg+1);
  for(i=0; i<pTab->nCol; i++){
    sqlite3VdbeAddOp3(v, OP_Column, ephemTab, i+1+(pRowid!=0), iReg+2+i);
  }
  sqlite3VtabMakeWritable(pParse, pTab);
  sqlite3VdbeAddOp4(v, OP_VUpdate, 0, pTab->nCol+2, iReg, pVtab, P4_VTAB);
  sqlite3VdbeAddOp2(v, OP_Next, ephemTab, addr);
  sqlite3VdbeJumpHere(v, addr-1);
  sqlite3VdbeAddOp2(v, OP_Close, ephemTab, 0);

  /* Cleanup */
  sqlite3SelectDelete(db, pSelect);  
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */

/* Make sure "isView" gets undefined in case this file becomes part of
** the amalgamation - so that subsequent files do not see isView as a
** macro. */
#undef isView
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/utf.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
/*
** 2004 April 13
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains routines used to translate between UTF-8, 
** UTF-16, UTF-16BE, and UTF-16LE.
**
** $Id: utf.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
**
** Notes on UTF-8:
**
**   Byte-0    Byte-1    Byte-2    Byte-3    Value
**  0xxxxxxx                                 00000000 00000000 0xxxxxxx
**  110yyyyy  10xxxxxx                       00000000 00000yyy yyxxxxxx
**  1110zzzz  10yyyyyy  10xxxxxx             00000000 zzzzyyyy yyxxxxxx
**  11110uuu  10uuzzzz  10yyyyyy  10xxxxxx   000uuuuu zzzzyyyy yyxxxxxx
**
**
** Notes on UTF-16:  (with wwww+1==uuuuu)
**
**      Word-0               Word-1          Value
**  110110ww wwzzzzyy   110111yy yyxxxxxx    000uuuuu zzzzyyyy yyxxxxxx
**  zzzzyyyy yyxxxxxx                        00000000 zzzzyyyy yyxxxxxx
**
**
** BOM or Byte Order Mark:
**     0xff 0xfe   little-endian utf-16 follows
**     0xfe 0xff   big-endian utf-16 follows
**
*/
#include "sqliteInt.h"
#include <assert.h>
#include "vdbeInt.h"

/*
** The following constant value is used by the SQLITE_BIGENDIAN and
** SQLITE_LITTLEENDIAN macros.
*/
const int sqlite3one = 1;

/*
** This lookup table is used to help decode the first byte of
** a multi-byte UTF8 character.
*/
static const unsigned char sqlite3UtfTrans1[] = {
  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
  0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
  0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
  0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
  0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
  0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
  0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x00, 0x00,
};


#define WRITE_UTF8(zOut, c) {                          \
  if( c<0x00080 ){                                     \
    *zOut++ = (c&0xFF);                                \
  }                                                    \
  else if( c<0x00800 ){                                \
    *zOut++ = 0xC0 + ((c>>6)&0x1F);                    \
    *zOut++ = 0x80 + (c & 0x3F);                       \
  }                                                    \
  else if( c<0x10000 ){                                \
    *zOut++ = 0xE0 + ((c>>12)&0x0F);                   \
    *zOut++ = 0x80 + ((c>>6) & 0x3F);                  \
    *zOut++ = 0x80 + (c & 0x3F);                       \
  }else{                                               \
    *zOut++ = 0xF0 + ((c>>18) & 0x07);                 \
    *zOut++ = 0x80 + ((c>>12) & 0x3F);                 \
    *zOut++ = 0x80 + ((c>>6) & 0x3F);                  \
    *zOut++ = 0x80 + (c & 0x3F);                       \
  }                                                    \
}

#define WRITE_UTF16LE(zOut, c) {                                \
  if( c<=0xFFFF ){                                              \
    *zOut++ = (c&0x00FF);                                       \
    *zOut++ = ((c>>8)&0x00FF);                                  \
  }else{                                                        \
    *zOut++ = (((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0));  \
    *zOut++ = (0x00D8 + (((c-0x10000)>>18)&0x03));              \
    *zOut++ = (c&0x00FF);                                       \
    *zOut++ = (0x00DC + ((c>>8)&0x03));                         \
  }                                                             \
}

#define WRITE_UTF16BE(zOut, c) {                                \
  if( c<=0xFFFF ){                                              \
    *zOut++ = ((c>>8)&0x00FF);                                  \
    *zOut++ = (c&0x00FF);                                       \
  }else{                                                        \
    *zOut++ = (0x00D8 + (((c-0x10000)>>18)&0x03));              \
    *zOut++ = (((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0));  \
    *zOut++ = (0x00DC + ((c>>8)&0x03));                         \
    *zOut++ = (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);   \
    if( (c & 0xFFFF0000)==0 ) c = 0xFFFD;                             \
  }                                                                   \
}

#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);   \
    if( (c & 0xFFFF0000)==0 ) c = 0xFFFD;                             \
  }                                                                   \
}

/*
** Translate a single UTF-8 character.  Return the unicode value.
**
** During translation, assume that the byte that zTerm points
** is a 0x00.
**
** Write a pointer to the next unread byte back into *pzNext.
**
** Notes On Invalid UTF-8:
**
**  *  This routine never allows a 7-bit character (0x00 through 0x7f) to
**     be encoded as a multi-byte character.  Any multi-byte character that
**     attempts to encode a value between 0x00 and 0x7f is rendered as 0xfffd.
**
**  *  This routine never allows a UTF16 surrogate value to be encoded.
**     If a multi-byte character attempts to encode a value between
**     0xd800 and 0xe000 then it is rendered as 0xfffd.
**
**  *  Bytes in the range of 0x80 through 0xbf which occur as the first
**     byte of a character are interpreted as single-byte characters
**     and rendered as themselves even though they are technically
**     invalid characters.
**
**  *  This routine accepts an infinite number of different UTF8 encodings
**     for unicode values 0x80 and greater.  It do not change over-length
**     encodings to 0xfffd as some systems recommend.
*/
#define READ_UTF8(zIn, zTerm, c)                           \
  c = *(zIn++);                                            \
  if( c>=0xc0 ){                                           \
    c = sqlite3UtfTrans1[c-0xc0];                          \
    while( zIn!=zTerm && (*zIn & 0xc0)==0x80 ){            \
      c = (c<<6) + (0x3f & *(zIn++));                      \
    }                                                      \
    if( c<0x80                                             \
        || (c&0xFFFFF800)==0xD800                          \
        || (c&0xFFFFFFFE)==0xFFFE ){  c = 0xFFFD; }        \
  }
int sqlite3Utf8Read(
  const unsigned char *z,         /* First byte of UTF-8 character */
  const unsigned char *zTerm,     /* Pretend this byte is 0x00 */
  const unsigned char **pzNext    /* Write first byte past UTF-8 char here */
){
  int c;
  READ_UTF8(z, zTerm, c);
  *pzNext = z;
  return c;
}




/*
** If the TRANSLATE_TRACE macro is defined, the value of each Mem is
** printed on stderr on the way into and out of sqlite3VdbeMemTranslate().
*/ 
/* #define TRANSLATE_TRACE 1 */

#ifndef SQLITE_OMIT_UTF16
/*
** This routine transforms the internal text encoding used by pMem to
** desiredEnc. It is an error if the string is already of the desired
** encoding, or if *pMem does not contain a string value.
*/
int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){
  int len;                    /* Maximum length of output string in bytes */
  unsigned char *zOut;                  /* Output buffer */
  unsigned char *zIn;                   /* Input iterator */
  unsigned char *zTerm;                 /* End of input */
  unsigned char *z;                     /* Output iterator */
  unsigned int c;

  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
  assert( pMem->flags&MEM_Str );
  assert( pMem->enc!=desiredEnc );
  assert( pMem->enc!=0 );
  assert( pMem->n>=0 );

#if defined(TRANSLATE_TRACE) && defined(SQLITE_DEBUG)
  {
    char zBuf[100];
    sqlite3VdbeMemPrettyPrint(pMem, zBuf);
    fprintf(stderr, "INPUT:  %s\n", zBuf);
  }
#endif

  /* If the translation is between UTF-16 little and big endian, then 
  ** all that is required is to swap the byte order. This case is handled
  ** differently from the others.
  */
  if( pMem->enc!=SQLITE_UTF8 && desiredEnc!=SQLITE_UTF8 ){
    u8 temp;
    int rc;
    rc = sqlite3VdbeMemMakeWriteable(pMem);
    if( rc!=SQLITE_OK ){
      assert( rc==SQLITE_NOMEM );
      return SQLITE_NOMEM;
    }
    zIn = (u8*)pMem->z;
    zTerm = &zIn[pMem->n];
    while( zIn<zTerm ){
      temp = *zIn;
      *zIn = *(zIn+1);
      zIn++;
      *zIn++ = temp;
    }
    pMem->enc = desiredEnc;
    goto translate_out;
  }

  /* Set len to the maximum number of bytes required in the output buffer. */
  if( desiredEnc==SQLITE_UTF8 ){
    /* When converting from UTF-16, the maximum growth results from
    ** translating a 2-byte character to a 4-byte UTF-8 character.
    ** A single byte is required for the output string
    ** nul-terminator.
    */
    len = pMem->n * 2 + 1;
  }else{
    /* When converting from UTF-8 to UTF-16 the maximum growth is caused
    ** when a 1-byte UTF-8 character is translated into a 2-byte UTF-16
    ** character. Two bytes are required in the output buffer for the
    ** nul-terminator.
    */
    len = pMem->n * 2 + 2;
  }

  /* Set zIn to point at the start of the input buffer and zTerm to point 1
  ** byte past the end.
  **
  ** Variable zOut is set to point at the output buffer, space obtained
  ** from sqlite3_malloc().
  */
  zIn = (u8*)pMem->z;
  zTerm = &zIn[pMem->n];
  zOut = sqlite3DbMallocRaw(pMem->db, len);
  if( !zOut ){
    return SQLITE_NOMEM;
  }
  z = zOut;

  if( pMem->enc==SQLITE_UTF8 ){
    if( desiredEnc==SQLITE_UTF16LE ){
      /* UTF-8 -> UTF-16 Little-endian */
      while( zIn<zTerm ){
        /* c = sqlite3Utf8Read(zIn, zTerm, (const u8**)&zIn); */
        READ_UTF8(zIn, zTerm, c);
        WRITE_UTF16LE(z, c);
      }
    }else{
      assert( desiredEnc==SQLITE_UTF16BE );
      /* UTF-8 -> UTF-16 Big-endian */
      while( zIn<zTerm ){
        /* c = sqlite3Utf8Read(zIn, zTerm, (const u8**)&zIn); */
        READ_UTF8(zIn, zTerm, c);
        WRITE_UTF16BE(z, c);
      }
    }
    pMem->n = 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 = z - zOut;
  }
  *z = 0;
  assert( (pMem->n+(desiredEnc==SQLITE_UTF8?1:2))<=len );

  sqlite3VdbeMemRelease(pMem);
  pMem->flags &= ~(MEM_Static|MEM_Dyn|MEM_Ephem);
  pMem->enc = desiredEnc;
  pMem->flags |= (MEM_Term|MEM_Dyn);
  pMem->z = (char*)zOut;
  pMem->zMalloc = pMem->z;

translate_out:
#if defined(TRANSLATE_TRACE) && defined(SQLITE_DEBUG)
  {
    char zBuf[100];
    sqlite3VdbeMemPrettyPrint(pMem, zBuf);
    fprintf(stderr, "OUTPUT: %s\n", zBuf);
  }
#endif
  return SQLITE_OK;
}

/*
** This routine checks for a byte-order mark at the beginning of the 
** UTF-16 string stored in *pMem. If one is present, it is removed and
** the encoding of the Mem adjusted. This routine does not do any
** byte-swapping, it just sets Mem.enc appropriately.
**
** The allocation (static, dynamic etc.) and encoding of the Mem may be
** changed by this function.
*/
int sqlite3VdbeMemHandleBom(Mem *pMem){
  int rc = SQLITE_OK;
  u8 bom = 0;

  if( pMem->n<0 || pMem->n>1 ){
    u8 b1 = *(u8 *)pMem->z;
    u8 b2 = *(((u8 *)pMem->z) + 1);
    if( b1==0xFE && b2==0xFF ){
      bom = SQLITE_UTF16BE;
    }
    if( b1==0xFF && b2==0xFE ){
      bom = SQLITE_UTF16LE;
    }
  }
  
  if( bom ){
    rc = sqlite3VdbeMemMakeWriteable(pMem);
    if( rc==SQLITE_OK ){
      pMem->n -= 2;
      memmove(pMem->z, &pMem->z[2], pMem->n);
      pMem->z[pMem->n] = '\0';
      pMem->z[pMem->n+1] = '\0';
      pMem->flags |= MEM_Term;
      pMem->enc = bom;
    }
  }
  return rc;
}
#endif /* SQLITE_OMIT_UTF16 */

/*
** pZ is a UTF-8 encoded unicode string. If nByte is less than zero,
** return the number of unicode characters in pZ up to (but not including)
** the first 0x00 byte. If nByte is not less than zero, return the
** number of unicode characters in the first nByte of pZ (or up to 
** the first 0x00, whichever comes first).
*/
int sqlite3Utf8CharLen(const char *zIn, int nByte){
  int r = 0;
  const u8 *z = (const u8*)zIn;
  const u8 *zTerm;
  if( nByte>=0 ){
    zTerm = &z[nByte];
  }else{
    zTerm = (const u8*)(-1);
  }
  assert( z<=zTerm );
  while( *z!=0 && z<zTerm ){
    SQLITE_SKIP_UTF8(z);
    r++;
  }
  return r;
}

/* This test function is not currently used by the automated test-suite. 
** Hence it is only available in debug builds.
*/
#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG)
/*
** Translate UTF-8 to UTF-8.
**
** This has the effect of making sure that the string is well-formed
** UTF-8.  Miscoded characters are removed.
**
** The translation is done in-place (since it is impossible for the
** correct UTF-8 encoding to be longer than a malformed encoding).
*/
int sqlite3Utf8To8(unsigned char *zIn){
  unsigned char *zOut = zIn;
  unsigned char *zStart = zIn;
  unsigned char *zTerm;
  u32 c;

  while( zIn[0] ){
    c = sqlite3Utf8Read(zIn, zTerm, (const u8**)&zIn);
    if( c!=0xfffd ){
      WRITE_UTF8(zOut, c);
    }
  }
  *zOut = 0;
  return zOut - zStart;
}
#endif

#ifndef SQLITE_OMIT_UTF16
/*
** Convert a UTF-16 string in the native encoding into a UTF-8 string.
** Memory to hold the UTF-8 string is obtained from sqlite3_malloc and must
** be freed by the calling function.
**
** NULL is returned if there is an allocation error.
*/
char *sqlite3Utf16to8(sqlite3 *db, const void *z, int nByte){
  Mem m;
  memset(&m, 0, sizeof(m));
  m.db = db;
  sqlite3VdbeMemSetStr(&m, z, nByte, SQLITE_UTF16NATIVE, SQLITE_STATIC);
  sqlite3VdbeChangeEncoding(&m, SQLITE_UTF8);
  if( db->mallocFailed ){
    sqlite3VdbeMemRelease(&m);
    m.z = 0;
  }
  assert( (m.flags & MEM_Term)!=0 || db->mallocFailed );
  assert( (m.flags & MEM_Str)!=0 || db->mallocFailed );
  return (m.flags & MEM_Dyn)!=0 ? m.z : sqlite3DbStrDup(db, m.z);
}

/*
** pZ is a UTF-16 encoded unicode string. If nChar is less than zero,
** return the number of bytes up to (but not including), the first pair
** of consecutive 0x00 bytes in pZ. If nChar is not less than zero,
** then return the number of bytes in the first nChar unicode characters
** in pZ (or up until the first pair of 0x00 bytes, whichever comes first).
*/
int sqlite3Utf16ByteLen(const void *zIn, int nChar){
  unsigned int c = 1;
  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( c && ((nChar<0) || n<nChar) ){
      READ_UTF16BE(z, c);
      n++;
    }
  }else{
    while( c && ((nChar<0) || n<nChar) ){
      READ_UTF16LE(z, c);
      n++;
    }
  }
  return (z-(char const *)zIn)-((c==0)?2:0);
}

#if defined(SQLITE_TEST)
/*
** This routine is called from the TCL test function "translate_selftest".
** It checks that the primitives for serializing and deserializing
** characters in each encoding are inverses of each other.
*/
void sqlite3UtfSelfTest(){
  unsigned int i, t;
  unsigned char zBuf[20];
  unsigned char *z;
  unsigned char *zTerm;
  int n;
  unsigned int c;

  for(i=0; i<0x00110000; i++){
    z = zBuf;
    WRITE_UTF8(z, i);
    n = z-zBuf;
    z[0] = 0;
    zTerm = z;
    z = zBuf;
    c = sqlite3Utf8Read(z, zTerm, (const u8**)&z);
    t = i;
    if( i>=0xD800 && i<=0xDFFF ) t = 0xFFFD;
    if( (i&0xFFFFFFFE)==0xFFFE ) t = 0xFFFD;
    assert( c==t );
    assert( (z-zBuf)==n );
  }
  for(i=0; i<0x00110000; i++){
    if( i>=0xD800 && i<0xE000 ) continue;
    z = zBuf;
    WRITE_UTF16LE(z, i);
    n = z-zBuf;
    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 = z-zBuf;
    z[0] = 0;
    z = zBuf;
    READ_UTF16BE(z, c);
    assert( c==i );
    assert( (z-zBuf)==n );
  }
}
#endif /* SQLITE_TEST */
#endif /* SQLITE_OMIT_UTF16 */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/util.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Utility functions used throughout sqlite.
**
** This file contains functions for allocating memory, comparing
** strings, and stuff like that.
**
** $Id: util.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <stdarg.h>
#include <ctype.h>


/*
** Return true if the floating point value is Not a Number (NaN).
*/
int sqlite3IsNaN(double x){
  /* This NaN test sometimes fails if compiled on GCC with -ffast-math.
  ** On the other hand, the use of -ffast-math comes with the following
  ** warning:
  **
  **      This option [-ffast-math] should never be turned on by any
  **      -O option since it can result in incorrect output for programs
  **      which depend on an exact implementation of IEEE or ISO 
  **      rules/specifications for math functions.
  **
  ** Under MSVC, this NaN test may fail if compiled with a floating-
  ** point precision mode other than /fp:precise.  From the MSDN 
  ** documentation:
  **
  **      The compiler [with /fp:precise] will properly handle comparisons 
  **      involving NaN. For example, x != x evaluates to true if x is NaN 
  **      ...
  */
#ifdef __FAST_MATH__
# error SQLite will not work correctly with the -ffast-math option of GCC.
#endif
  volatile double y = x;
  volatile double z = y;
  return y!=z;
}

/*
** Return the length of a string, except do not allow the string length
** to exceed the SQLITE_LIMIT_LENGTH setting.
*/
int sqlite3Strlen(sqlite3 *db, const char *z){
  const char *z2 = z;
  int len;
  size_t x;
  while( *z2 ){ z2++; }
  x = z2 - z;
  len = 0x7fffffff & x;
  if( len!=x || len > db->aLimit[SQLITE_LIMIT_LENGTH] ){
    return db->aLimit[SQLITE_LIMIT_LENGTH];
  }else{
    return len;
  }
}

/*
** Set the most recent error code and error string for the sqlite
** handle "db". The error code is set to "err_code".
**
** If it is not NULL, string zFormat specifies the format of the
** error string in the style of the printf functions: The following
** format characters are allowed:
**
**      %s      Insert a string
**      %z      A string that should be freed after use
**      %d      Insert an integer
**      %T      Insert a token
**      %S      Insert the first element of a SrcList
**
** zFormat and any string tokens that follow it are assumed to be
** encoded in UTF-8.
**
** To clear the most recent error for sqlite handle "db", sqlite3Error
** should be called with err_code set to SQLITE_OK and zFormat set
** to NULL.
*/
void sqlite3Error(sqlite3 *db, int err_code, const char *zFormat, ...){
  if( db && (db->pErr || (db->pErr = sqlite3ValueNew(db))!=0) ){
    db->errCode = err_code;
    if( zFormat ){
      char *z;
      va_list ap;
      va_start(ap, zFormat);
      z = sqlite3VMPrintf(db, zFormat, ap);
      va_end(ap);
      sqlite3ValueSetStr(db->pErr, -1, z, SQLITE_UTF8, SQLITE_DYNAMIC);
    }else{
      sqlite3ValueSetStr(db->pErr, 0, 0, SQLITE_UTF8, SQLITE_STATIC);
    }
  }
}

/*
** Add an error message to pParse->zErrMsg and increment pParse->nErr.
** The following formatting characters are allowed:
**
**      %s      Insert a string
**      %z      A string that should be freed after use
**      %d      Insert an integer
**      %T      Insert a token
**      %S      Insert the first element of a SrcList
**
** This function should be used to report any error that occurs whilst
** compiling an SQL statement (i.e. within sqlite3_prepare()). The
** last thing the sqlite3_prepare() function does is copy the error
** stored by this function into the database handle using sqlite3Error().
** Function sqlite3Error() should be used during statement execution
** (sqlite3_step() etc.).
*/
void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){
  va_list ap;
  sqlite3 *db = pParse->db;
  pParse->nErr++;
  sqlite3DbFree(db, pParse->zErrMsg);
  va_start(ap, zFormat);
  pParse->zErrMsg = sqlite3VMPrintf(db, zFormat, ap);
  va_end(ap);
  if( pParse->rc==SQLITE_OK ){
    pParse->rc = SQLITE_ERROR;
  }
}

/*
** Clear the error message in pParse, if any
*/
void sqlite3ErrorClear(Parse *pParse){
  sqlite3DbFree(pParse->db, pParse->zErrMsg);
  pParse->zErrMsg = 0;
  pParse->nErr = 0;
}

/*
** Convert an SQL-style quoted string into a normal string by removing
** the quote characters.  The conversion is done in-place.  If the
** input does not begin with a quote character, then this routine
** is a no-op.
**
** 2002-Feb-14: This routine is extended to remove MS-Access style
** brackets from around identifers.  For example:  "[a-b-c]" becomes
** "a-b-c".
*/
void sqlite3Dequote(char *z){
  int quote;
  int i, j;
  if( z==0 ) return;
  quote = z[0];
  switch( quote ){
    case '\'':  break;
    case '"':   break;
    case '`':   break;                /* For MySQL compatibility */
    case '[':   quote = ']';  break;  /* For MS SqlServer compatibility */
    default:    return;
  }
  for(i=1, j=0; z[i]; i++){
    if( z[i]==quote ){
      if( z[i+1]==quote ){
        z[j++] = quote;
        i++;
      }else{
        z[j++] = 0;
        break;
      }
    }else{
      z[j++] = z[i];
    }
  }
}

/* Convenient short-hand */
#define UpperToLower sqlite3UpperToLower

/*
** Some systems have stricmp().  Others have strcasecmp().  Because
** there is no consistency, we will define our own.
*/
int sqlite3StrICmp(const char *zLeft, const char *zRight){
  register unsigned char *a, *b;
  a = (unsigned char *)zLeft;
  b = (unsigned char *)zRight;
  while( *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
  return UpperToLower[*a] - UpperToLower[*b];
}
int sqlite3StrNICmp(const char *zLeft, const char *zRight, int N){
  register unsigned char *a, *b;
  a = (unsigned char *)zLeft;
  b = (unsigned char *)zRight;
  while( N-- > 0 && *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; }
  return N<0 ? 0 : UpperToLower[*a] - UpperToLower[*b];
}

/*
** Return TRUE if z is a pure numeric string.  Return FALSE if the
** string contains any character which is not part of a number. If
** the string is numeric and contains the '.' character, set *realnum
** to TRUE (otherwise FALSE).
**
** An empty string is considered non-numeric.
*/
int sqlite3IsNumber(const char *z, int *realnum, u8 enc){
  int incr = (enc==SQLITE_UTF8?1:2);
  if( enc==SQLITE_UTF16BE ) z++;
  if( *z=='-' || *z=='+' ) z += incr;
  if( !isdigit(*(u8*)z) ){
    return 0;
  }
  z += incr;
  if( realnum ) *realnum = 0;
  while( isdigit(*(u8*)z) ){ z += incr; }
  if( *z=='.' ){
    z += incr;
    if( !isdigit(*(u8*)z) ) return 0;
    while( isdigit(*(u8*)z) ){ z += incr; }
    if( realnum ) *realnum = 1;
  }
  if( *z=='e' || *z=='E' ){
    z += incr;
    if( *z=='+' || *z=='-' ) z += incr;
    if( !isdigit(*(u8*)z) ) return 0;
    while( isdigit(*(u8*)z) ){ z += incr; }
    if( realnum ) *realnum = 1;
  }
  return *z==0;
}

/*
** The string z[] is an ascii representation of a real number.
** Convert this string to a double.
**
** This routine assumes that z[] really is a valid number.  If it
** is not, the result is undefined.
**
** This routine is used instead of the library atof() function because
** the library atof() might want to use "," as the decimal point instead
** of "." depending on how locale is set.  But that would cause problems
** for SQL.  So this routine always uses "." regardless of locale.
*/
int sqlite3AtoF(const char *z, double *pResult){
#ifndef SQLITE_OMIT_FLOATING_POINT
  int sign = 1;
  const char *zBegin = z;
  LONGDOUBLE_TYPE v1 = 0.0;
  int nSignificant = 0;
  while( isspace(*(u8*)z) ) z++;
  if( *z=='-' ){
    sign = -1;
    z++;
  }else if( *z=='+' ){
    z++;
  }
  while( z[0]=='0' ){
    z++;
  }
  while( isdigit(*(u8*)z) ){
    v1 = v1*10.0 + (*z - '0');
    z++;
    nSignificant++;
  }
  if( *z=='.' ){
    LONGDOUBLE_TYPE divisor = 1.0;
    z++;
    if( nSignificant==0 ){
      while( z[0]=='0' ){
        divisor *= 10.0;
        z++;
      }
    }
    while( isdigit(*(u8*)z) ){
      if( nSignificant<18 ){
        v1 = v1*10.0 + (*z - '0');
        divisor *= 10.0;
        nSignificant++;
      }
      z++;
    }
    v1 /= divisor;
  }
  if( *z=='e' || *z=='E' ){
    int esign = 1;
    int eval = 0;
    LONGDOUBLE_TYPE scale = 1.0;
    z++;
    if( *z=='-' ){
      esign = -1;
      z++;
    }else if( *z=='+' ){
      z++;
    }
    while( isdigit(*(u8*)z) ){
      eval = eval*10 + *z - '0';
      z++;
    }
    while( eval>=64 ){ scale *= 1.0e+64; eval -= 64; }
    while( eval>=16 ){ scale *= 1.0e+16; eval -= 16; }
    while( eval>=4 ){ scale *= 1.0e+4; eval -= 4; }
    while( eval>=1 ){ scale *= 1.0e+1; eval -= 1; }
    if( esign<0 ){
      v1 /= scale;
    }else{
      v1 *= scale;
    }
  }
  *pResult = sign<0 ? -v1 : v1;
  return z - zBegin;
#else
  return sqlite3Atoi64(z, pResult);
#endif /* SQLITE_OMIT_FLOATING_POINT */
}

/*
** Compare the 19-character string zNum against the text representation
** value 2^63:  9223372036854775808.  Return negative, zero, or positive
** if zNum is less than, equal to, or greater than the string.
**
** Unlike memcmp() this routine is guaranteed to return the difference
** in the values of the last digit if the only difference is in the
** last digit.  So, for example,
**
**      compare2pow63("9223372036854775800")
**
** will return -8.
*/
static int compare2pow63(const char *zNum){
  int c;
  c = memcmp(zNum,"922337203685477580",18);
  if( c==0 ){
    c = zNum[18] - '8';
  }
  return c;
}


/*
** Return TRUE if zNum is a 64-bit signed integer and write
** the value of the integer into *pNum.  If zNum is not an integer
** or is an integer that is too large to be expressed with 64 bits,
** then return false.
**
** When this routine was originally written it dealt with only
** 32-bit numbers.  At that time, it was much faster than the
** atoi() library routine in RedHat 7.2.
*/
int sqlite3Atoi64(const char *zNum, i64 *pNum){
  i64 v = 0;
  int neg;
  int i, c;
  const char *zStart;
  while( isspace(*(u8*)zNum) ) zNum++;
  if( *zNum=='-' ){
    neg = 1;
    zNum++;
  }else if( *zNum=='+' ){
    neg = 0;
    zNum++;
  }else{
    neg = 0;
  }
  zStart = zNum;
  while( zNum[0]=='0' ){ zNum++; } /* Skip over leading zeros. Ticket #2454 */
  for(i=0; (c=zNum[i])>='0' && c<='9'; i++){
    v = v*10 + c - '0';
  }
  *pNum = neg ? -v : v;
  if( c!=0 || (i==0 && zStart==zNum) || i>19 ){
    /* zNum is empty or contains non-numeric text or is longer
    ** than 19 digits (thus guaranting that it is too large) */
    return 0;
  }else if( i<19 ){
    /* Less than 19 digits, so we know that it fits in 64 bits */
    return 1;
  }else{
    /* 19-digit numbers must be no larger than 9223372036854775807 if positive
    ** or 9223372036854775808 if negative.  Note that 9223372036854665808
    ** is 2^63. */
    return compare2pow63(zNum)<neg;
  }
}

/*
** The string zNum represents an integer.  There might be some other
** information following the integer too, but that part is ignored.
** If the integer that the prefix of zNum represents will fit in a
** 64-bit signed integer, return TRUE.  Otherwise return FALSE.
**
** This routine returns FALSE for the string -9223372036854775808 even that
** that number will, in theory fit in a 64-bit integer.  Positive
** 9223373036854775808 will not fit in 64 bits.  So it seems safer to return
** false.
*/
int sqlite3FitsIn64Bits(const char *zNum, int negFlag){
  int i, c;
  int neg = 0;
  if( *zNum=='-' ){
    neg = 1;
    zNum++;
  }else if( *zNum=='+' ){
    zNum++;
  }
  if( negFlag ) neg = 1-neg;
  while( *zNum=='0' ){
    zNum++;   /* Skip leading zeros.  Ticket #2454 */
  }
  for(i=0; (c=zNum[i])>='0' && c<='9'; i++){}
  if( i<19 ){
    /* Guaranteed to fit if less than 19 digits */
    return 1;
  }else if( i>19 ){
    /* Guaranteed to be too big if greater than 19 digits */
    return 0;
  }else{
    /* Compare against 2^63. */
    return compare2pow63(zNum)<neg;
  }
}

/*
** If zNum represents an integer that will fit in 32-bits, then set
** *pValue to that integer and return true.  Otherwise return false.
**
** Any non-numeric characters that following zNum are ignored.
** This is different from sqlite3Atoi64() which requires the
** input number to be zero-terminated.
*/
int sqlite3GetInt32(const char *zNum, int *pValue){
  sqlite_int64 v = 0;
  int i, c;
  int neg = 0;
  if( zNum[0]=='-' ){
    neg = 1;
    zNum++;
  }else if( zNum[0]=='+' ){
    zNum++;
  }
  while( zNum[0]=='0' ) zNum++;
  for(i=0; i<11 && (c = zNum[i] - '0')>=0 && c<=9; i++){
    v = v*10 + c;
  }

  /* The longest decimal representation of a 32 bit integer is 10 digits:
  **
  **             1234567890
  **     2^31 -> 2147483648
  */
  if( i>10 ){
    return 0;
  }
  if( v-neg>2147483647 ){
    return 0;
  }
  if( neg ){
    v = -v;
  }
  *pValue = (int)v;
  return 1;
}

/*
** The variable-length integer encoding is as follows:
**
** KEY:
**         A = 0xxxxxxx    7 bits of data and one flag bit
**         B = 1xxxxxxx    7 bits of data and one flag bit
**         C = xxxxxxxx    8 bits of data
**
**  7 bits - A
** 14 bits - BA
** 21 bits - BBA
** 28 bits - BBBA
** 35 bits - BBBBA
** 42 bits - BBBBBA
** 49 bits - BBBBBBA
** 56 bits - BBBBBBBA
** 64 bits - BBBBBBBBC
*/

/*
** Write a 64-bit variable-length integer to memory starting at p[0].
** The length of data write will be between 1 and 9 bytes.  The number
** of bytes written is returned.
**
** A variable-length integer consists of the lower 7 bits of each byte
** for all bytes that have the 8th bit set and one byte with the 8th
** bit clear.  Except, if we get to the 9th byte, it stores the full
** 8 bits and is the last byte.
*/
int sqlite3PutVarint(unsigned char *p, u64 v){
  int i, j, n;
  u8 buf[10];
  if( v & (((u64)0xff000000)<<32) ){
    p[8] = v;
    v >>= 8;
    for(i=7; i>=0; i--){
      p[i] = (v & 0x7f) | 0x80;
      v >>= 7;
    }
    return 9;
  }    
  n = 0;
  do{
    buf[n++] = (v & 0x7f) | 0x80;
    v >>= 7;
  }while( v!=0 );
  buf[0] &= 0x7f;
  assert( n<=9 );
  for(i=0, j=n-1; j>=0; j--, i++){
    p[i] = buf[j];
  }
  return n;
}

/*
** This routine is a faster version of sqlite3PutVarint() that only
** works for 32-bit positive integers and which is optimized for
** the common case of small integers.  A MACRO version, putVarint32,
** is provided which inlines the single-byte case.  All code should use
** the MACRO version as this function assumes the single-byte case has
** already been handled.
*/
int sqlite3PutVarint32(unsigned char *p, u32 v){
#ifndef putVarint32
  if( (v & ~0x7f)==0 ){
    p[0] = v;
    return 1;
  }
#endif
  if( (v & ~0x3fff)==0 ){
    p[0] = (v>>7) | 0x80;
    p[1] = v & 0x7f;
    return 2;
  }
  return sqlite3PutVarint(p, v);
}

/*
** Read a 64-bit variable-length integer from memory starting at p[0].
** Return the number of bytes read.  The value is stored in *v.
*/
int sqlite3GetVarint(const unsigned char *p, u64 *v){
  u32 a,b,s;

  a = *p;
  /* a: p0 (unmasked) */
  if (!(a&0x80))
  {
    *v = a;
    return 1;
  }

  p++;
  b = *p;
  /* b: p1 (unmasked) */
  if (!(b&0x80))
  {
    a &= 0x7f;
    a = a<<7;
    a |= b;
    *v = a;
    return 2;
  }

  p++;
  a = a<<14;
  a |= *p;
  /* a: p0<<14 | p2 (unmasked) */
  if (!(a&0x80))
  {
    a &= (0x7f<<14)|(0x7f);
    b &= 0x7f;
    b = b<<7;
    a |= b;
    *v = a;
    return 3;
  }

  /* CSE1 from below */
  a &= (0x7f<<14)|(0x7f);
  p++;
  b = b<<14;
  b |= *p;
  /* b: p1<<14 | p3 (unmasked) */
  if (!(b&0x80))
  {
    b &= (0x7f<<14)|(0x7f);
    /* moved CSE1 up */
    /* a &= (0x7f<<14)|(0x7f); */
    a = a<<7;
    a |= b;
    *v = a;
    return 4;
  }

  /* a: p0<<14 | p2 (masked) */
  /* b: p1<<14 | p3 (unmasked) */
  /* 1:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) */
  /* moved CSE1 up */
  /* a &= (0x7f<<14)|(0x7f); */
  b &= (0x7f<<14)|(0x7f);
  s = a;
  /* s: p0<<14 | p2 (masked) */

  p++;
  a = a<<14;
  a |= *p;
  /* a: p0<<28 | p2<<14 | p4 (unmasked) */
  if (!(a&0x80))
  {
    /* we can skip these cause they were (effectively) done above in calc'ing s */
    /* a &= (0x7f<<28)|(0x7f<<14)|(0x7f); */
    /* b &= (0x7f<<14)|(0x7f); */
    b = b<<7;
    a |= b;
    s = s>>18;
    *v = ((u64)s)<<32 | a;
    return 5;
  }

  /* 2:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) */
  s = s<<7;
  s |= b;
  /* s: p0<<21 | p1<<14 | p2<<7 | p3 (masked) */

  p++;
  b = b<<14;
  b |= *p;
  /* b: p1<<28 | p3<<14 | p5 (unmasked) */
  if (!(b&0x80))
  {
    /* we can skip this cause it was (effectively) done above in calc'ing s */
    /* b &= (0x7f<<28)|(0x7f<<14)|(0x7f); */
    a &= (0x7f<<14)|(0x7f);
    a = a<<7;
    a |= b;
    s = s>>18;
    *v = ((u64)s)<<32 | a;
    return 6;
  }

  p++;
  a = a<<14;
  a |= *p;
  /* a: p2<<28 | p4<<14 | p6 (unmasked) */
  if (!(a&0x80))
  {
    a &= (0x7f<<28)|(0x7f<<14)|(0x7f);
    b &= (0x7f<<14)|(0x7f);
    b = b<<7;
    a |= b;
    s = s>>11;
    *v = ((u64)s)<<32 | a;
    return 7;
  }

  /* CSE2 from below */
  a &= (0x7f<<14)|(0x7f);
  p++;
  b = b<<14;
  b |= *p;
  /* b: p3<<28 | p5<<14 | p7 (unmasked) */
  if (!(b&0x80))
  {
    b &= (0x7f<<28)|(0x7f<<14)|(0x7f);
    /* moved CSE2 up */
    /* a &= (0x7f<<14)|(0x7f); */
    a = a<<7;
    a |= b;
    s = s>>4;
    *v = ((u64)s)<<32 | a;
    return 8;
  }

  p++;
  a = a<<15;
  a |= *p;
  /* a: p4<<29 | p6<<15 | p8 (unmasked) */

  /* moved CSE2 up */
  /* a &= (0x7f<<29)|(0x7f<<15)|(0xff); */
  b &= (0x7f<<14)|(0x7f);
  b = b<<8;
  a |= b;

  s = s<<4;
  b = p[-4];
  b &= 0x7f;
  b = b>>3;
  s |= b;

  *v = ((u64)s)<<32 | a;

  return 9;
}

/*
** Read a 32-bit variable-length integer from memory starting at p[0].
** Return the number of bytes read.  The value is stored in *v.
** A MACRO version, getVarint32, is provided which inlines the 
** single-byte case.  All code should use the MACRO version as 
** this function assumes the single-byte case has already been handled.
*/
int sqlite3GetVarint32(const unsigned char *p, u32 *v){
  u32 a,b;

  a = *p;
  /* a: p0 (unmasked) */
#ifndef getVarint32
  if (!(a&0x80))
  {
    *v = a;
    return 1;
  }
#endif

  p++;
  b = *p;
  /* b: p1 (unmasked) */
  if (!(b&0x80))
  {
    a &= 0x7f;
    a = a<<7;
    *v = a | b;
    return 2;
  }

  p++;
  a = a<<14;
  a |= *p;
  /* a: p0<<14 | p2 (unmasked) */
  if (!(a&0x80))
  {
    a &= (0x7f<<14)|(0x7f);
    b &= 0x7f;
    b = b<<7;
    *v = a | b;
    return 3;
  }

  p++;
  b = b<<14;
  b |= *p;
  /* b: p1<<14 | p3 (unmasked) */
  if (!(b&0x80))
  {
    b &= (0x7f<<14)|(0x7f);
    a &= (0x7f<<14)|(0x7f);
    a = a<<7;
    *v = a | b;
    return 4;
  }

  p++;
  a = a<<14;
  a |= *p;
  /* a: p0<<28 | p2<<14 | p4 (unmasked) */
  if (!(a&0x80))
  {
    a &= (0x7f<<28)|(0x7f<<14)|(0x7f);
    b &= (0x7f<<28)|(0x7f<<14)|(0x7f);
    b = b<<7;
    *v = a | b;
    return 5;
  }

  /* We can only reach this point when reading a corrupt database
  ** file.  In that case we are not in any hurry.  Use the (relatively
  ** slow) general-purpose sqlite3GetVarint() routine to extract the
  ** value. */
  {
    u64 v64;
    int n;

    p -= 4;
    n = sqlite3GetVarint(p, &v64);
    assert( n>5 && n<=9 );
    *v = (u32)v64;
    return n;
  }
}

/*
** Return the number of bytes that will be needed to store the given
** 64-bit integer.
*/
int sqlite3VarintLen(u64 v){
  int i = 0;
  do{
    i++;
    v >>= 7;
  }while( v!=0 && i<9 );
  return i;
}


/*
** Read or write a four-byte big-endian integer value.
*/
u32 sqlite3Get4byte(const u8 *p){
  return (p[0]<<24) | (p[1]<<16) | (p[2]<<8) | p[3];
}
void sqlite3Put4byte(unsigned char *p, u32 v){
  p[0] = v>>24;
  p[1] = v>>16;
  p[2] = v>>8;
  p[3] = v;
}



#if !defined(SQLITE_OMIT_BLOB_LITERAL) || defined(SQLITE_HAS_CODEC)
/*
** Translate a single byte of Hex into an integer.
** This routinen only works if h really is a valid hexadecimal
** character:  0..9a..fA..F
*/
static int hexToInt(int h){
  assert( (h>='0' && h<='9') ||  (h>='a' && h<='f') ||  (h>='A' && h<='F') );
#ifdef SQLITE_ASCII
  h += 9*(1&(h>>6));
#endif
#ifdef SQLITE_EBCDIC
  h += 9*(1&~(h>>4));
#endif
  return h & 0xf;
}
#endif /* !SQLITE_OMIT_BLOB_LITERAL || SQLITE_HAS_CODEC */

#if !defined(SQLITE_OMIT_BLOB_LITERAL) || defined(SQLITE_HAS_CODEC)
/*
** Convert a BLOB literal of the form "x'hhhhhh'" into its binary
** value.  Return a pointer to its binary value.  Space to hold the
** binary value has been obtained from malloc and must be freed by
** the calling routine.
*/
void *sqlite3HexToBlob(sqlite3 *db, const char *z, int n){
  char *zBlob;
  int i;

  zBlob = (char *)sqlite3DbMallocRaw(db, n/2 + 1);
  n--;
  if( zBlob ){
    for(i=0; i<n; i+=2){
      zBlob[i/2] = (hexToInt(z[i])<<4) | hexToInt(z[i+1]);
    }
    zBlob[i/2] = 0;
  }
  return zBlob;
}
#endif /* !SQLITE_OMIT_BLOB_LITERAL || SQLITE_HAS_CODEC */


/*
** Change the sqlite.magic from SQLITE_MAGIC_OPEN to SQLITE_MAGIC_BUSY.
** Return an error (non-zero) if the magic was not SQLITE_MAGIC_OPEN
** when this routine is called.
**
** This routine is called when entering an SQLite API.  The SQLITE_MAGIC_OPEN
** value indicates that the database connection passed into the API is
** open and is not being used by another thread.  By changing the value
** to SQLITE_MAGIC_BUSY we indicate that the connection is in use.
** sqlite3SafetyOff() below will change the value back to SQLITE_MAGIC_OPEN
** when the API exits. 
**
** This routine is a attempt to detect if two threads use the
** same sqlite* pointer at the same time.  There is a race 
** condition so it is possible that the error is not detected.
** But usually the problem will be seen.  The result will be an
** error which can be used to debug the application that is
** using SQLite incorrectly.
**
** Ticket #202:  If db->magic is not a valid open value, take care not
** to modify the db structure at all.  It could be that db is a stale
** pointer.  In other words, it could be that there has been a prior
** call to sqlite3_close(db) and db has been deallocated.  And we do
** not want to write into deallocated memory.
*/
#ifdef SQLITE_DEBUG
int sqlite3SafetyOn(sqlite3 *db){
  if( db->magic==SQLITE_MAGIC_OPEN ){
    db->magic = SQLITE_MAGIC_BUSY;
    assert( sqlite3_mutex_held(db->mutex) );
    return 0;
  }else if( db->magic==SQLITE_MAGIC_BUSY ){
    db->magic = SQLITE_MAGIC_ERROR;
    db->u1.isInterrupted = 1;
  }
  return 1;
}
#endif

/*
** Change the magic from SQLITE_MAGIC_BUSY to SQLITE_MAGIC_OPEN.
** Return an error (non-zero) if the magic was not SQLITE_MAGIC_BUSY
** when this routine is called.
*/
#ifdef SQLITE_DEBUG
int sqlite3SafetyOff(sqlite3 *db){
  if( db->magic==SQLITE_MAGIC_BUSY ){
    db->magic = SQLITE_MAGIC_OPEN;
    assert( sqlite3_mutex_held(db->mutex) );
    return 0;
  }else{
    db->magic = SQLITE_MAGIC_ERROR;
    db->u1.isInterrupted = 1;
    return 1;
  }
}
#endif

/*
** Check to make sure we have a valid db pointer.  This test is not
** foolproof but it does provide some measure of protection against
** misuse of the interface such as passing in db pointers that are
** NULL or which have been previously closed.  If this routine returns
** 1 it means that the db pointer is valid and 0 if it should not be
** dereferenced for any reason.  The calling function should invoke
** SQLITE_MISUSE immediately.
**
** sqlite3SafetyCheckOk() requires that the db pointer be valid for
** use.  sqlite3SafetyCheckSickOrOk() allows a db pointer that failed to
** open properly and is not fit for general use but which can be
** used as an argument to sqlite3_errmsg() or sqlite3_close().
*/
int sqlite3SafetyCheckOk(sqlite3 *db){
  int magic;
  if( db==0 ) return 0;
  magic = db->magic;
  if( magic!=SQLITE_MAGIC_OPEN &&
      magic!=SQLITE_MAGIC_BUSY ) return 0;
  return 1;
}
int sqlite3SafetyCheckSickOrOk(sqlite3 *db){
  int magic;
  if( db==0 ) return 0;
  magic = db->magic;
  if( magic!=SQLITE_MAGIC_SICK &&
      magic!=SQLITE_MAGIC_OPEN &&
      magic!=SQLITE_MAGIC_BUSY ) return 0;
  return 1;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/vacuum.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
/*
** 2003 April 6
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to implement the VACUUM command.
**
** Most of the code in this file may be omitted by defining the
** SQLITE_OMIT_VACUUM macro.
**
** $Id: vacuum.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"

#if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH)
/*
** Execute zSql on database db. Return an error code.
*/
static int execSql(sqlite3 *db, const char *zSql){
  sqlite3_stmt *pStmt;
  if( !zSql ){
    return SQLITE_NOMEM;
  }
  if( SQLITE_OK!=sqlite3_prepare(db, zSql, -1, &pStmt, 0) ){
    return sqlite3_errcode(db);
  }
  while( SQLITE_ROW==sqlite3_step(pStmt) ){}
  return sqlite3_finalize(pStmt);
}

/*
** Execute zSql on database db. The statement returns exactly
** one column. Execute this as SQL on the same database.
*/
static int execExecSql(sqlite3 *db, const char *zSql){
  sqlite3_stmt *pStmt;
  int rc;

  rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0);
  if( rc!=SQLITE_OK ) return rc;

  while( SQLITE_ROW==sqlite3_step(pStmt) ){
    rc = execSql(db, (char*)sqlite3_column_text(pStmt, 0));
    if( rc!=SQLITE_OK ){
      sqlite3_finalize(pStmt);
      return rc;
    }
  }

  return sqlite3_finalize(pStmt);
}

/*
** The non-standard VACUUM command is used to clean up the database,
** collapse free space, etc.  It is modelled after the VACUUM command
** in PostgreSQL.
**
** In version 1.0.x of SQLite, the VACUUM command would call
** gdbm_reorganize() on all the database tables.  But beginning
** with 2.0.0, SQLite no longer uses GDBM so this command has
** become a no-op.
*/
void sqlite3Vacuum(Parse *pParse){
  Vdbe *v = sqlite3GetVdbe(pParse);
  if( v ){
    sqlite3VdbeAddOp2(v, OP_Vacuum, 0, 0);
  }
  return;
}

/*
** This routine implements the OP_Vacuum opcode of the VDBE.
*/
int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db){
  int rc = SQLITE_OK;     /* Return code from service routines */
  Btree *pMain;           /* The database being vacuumed */
  Btree *pTemp;           /* The temporary database we vacuum into */
  char *zSql = 0;         /* SQL statements */
  int saved_flags;        /* Saved value of the db->flags */
  int saved_nChange;      /* Saved value of db->nChange */
  int saved_nTotalChange; /* Saved value of db->nTotalChange */
  Db *pDb = 0;            /* Database to detach at end of vacuum */
  int nRes;

  /* Save the current value of the write-schema flag before setting it. */
  saved_flags = db->flags;
  saved_nChange = db->nChange;
  saved_nTotalChange = db->nTotalChange;
  db->flags |= SQLITE_WriteSchema | SQLITE_IgnoreChecks;

  if( !db->autoCommit ){
    sqlite3SetString(pzErrMsg, db, "cannot VACUUM from within a transaction");
    rc = SQLITE_ERROR;
    goto end_of_vacuum;
  }
  pMain = db->aDb[0].pBt;

  /* Attach the temporary database as 'vacuum_db'. The synchronous pragma
  ** can be set to 'off' for this file, as it is not recovered if a crash
  ** occurs anyway. The integrity of the database is maintained by a
  ** (possibly synchronous) transaction opened on the main database before
  ** sqlite3BtreeCopyFile() is called.
  **
  ** An optimisation would be to use a non-journaled pager.
  ** (Later:) I tried setting "PRAGMA vacuum_db.journal_mode=OFF" but
  ** that actually made the VACUUM run slower.  Very little journalling
  ** actually occurs when doing a vacuum since the vacuum_db is initially
  ** empty.  Only the journal header is written.  Apparently it takes more
  ** time to parse and run the PRAGMA to turn journalling off than it does
  ** to write the journal header file.
  */
  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*);
    int nKey;
    char *zKey;
    sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey);
    if( nKey ) db->nextPagesize = 0;
  }
#endif

  if( sqlite3BtreeSetPageSize(pTemp, sqlite3BtreeGetPageSize(pMain), nRes)
   || sqlite3BtreeSetPageSize(pTemp, db->nextPagesize, nRes)
   || db->mallocFailed 
  ){
    rc = SQLITE_NOMEM;
    goto end_of_vacuum;
  }
  rc = execSql(db, "PRAGMA vacuum_db.synchronous=OFF");
  if( rc!=SQLITE_OK ){
    goto end_of_vacuum;
  }

#ifndef SQLITE_OMIT_AUTOVACUUM
  sqlite3BtreeSetAutoVacuum(pTemp, db->nextAutovac>=0 ? db->nextAutovac :
                                           sqlite3BtreeGetAutoVacuum(pMain));
#endif

  /* Begin a transaction */
  rc = execSql(db, "BEGIN EXCLUSIVE;");
  if( rc!=SQLITE_OK ) goto end_of_vacuum;

  /* Query the schema of the main database. Create a mirror schema
  ** in the temporary database.
  */
  rc = execExecSql(db, 
      "SELECT 'CREATE TABLE vacuum_db.' || substr(sql,14) "
      "  FROM sqlite_master WHERE type='table' AND name!='sqlite_sequence'"
      "   AND rootpage>0"
  );
  if( rc!=SQLITE_OK ) goto end_of_vacuum;
  rc = execExecSql(db, 
      "SELECT 'CREATE INDEX vacuum_db.' || substr(sql,14)"
      "  FROM sqlite_master WHERE sql LIKE 'CREATE INDEX %' ");
  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.
  ** Open a btree level transaction on the main database. This allows a
  ** call to sqlite3BtreeCopyFile(). The main database btree level
  ** transaction is then committed, so the SQL level never knows it was
  ** opened for writing. This way, the SQL transaction used to create the
  ** temporary database never needs to be committed.
  */
  if( rc==SQLITE_OK ){
    u32 meta;
    int i;

    /* This array determines which meta meta values are preserved in the
    ** vacuum.  Even entries are the meta value number and odd entries
    ** are an increment to apply to the meta value after the vacuum.
    ** The increment is used to increase the schema cookie so that other
    ** connections to the same database will know to reread the schema.
    */
    static const unsigned char aCopy[] = {
       1, 1,    /* Add one to the old schema cookie */
       3, 0,    /* Preserve the default page cache size */
       5, 0,    /* Preserve the default text encoding */
       6, 0,    /* Preserve the user version */
    };

    assert( 1==sqlite3BtreeIsInTrans(pTemp) );
    assert( 1==sqlite3BtreeIsInTrans(pMain) );

    /* Copy Btree meta values */
    for(i=0; i<sizeof(aCopy)/sizeof(aCopy[0]); i+=2){
      rc = sqlite3BtreeGetMeta(pMain, aCopy[i], &meta);
      if( rc!=SQLITE_OK ) goto end_of_vacuum;
      rc = sqlite3BtreeUpdateMeta(pTemp, aCopy[i], meta+aCopy[i+1]);
      if( rc!=SQLITE_OK ) goto end_of_vacuum;
    }

    rc = sqlite3BtreeCopyFile(pMain, pTemp);
    if( rc!=SQLITE_OK ) goto end_of_vacuum;
    rc = sqlite3BtreeCommit(pTemp);
    if( rc!=SQLITE_OK ) goto end_of_vacuum;
    rc = sqlite3BtreeCommit(pMain);
  }

  if( rc==SQLITE_OK ){
    rc = sqlite3BtreeSetPageSize(pMain, sqlite3BtreeGetPageSize(pTemp), nRes);
  }

end_of_vacuum:
  /* Restore the original value of db->flags */
  db->flags = saved_flags;
  db->nChange = saved_nChange;
  db->nTotalChange = saved_nTotalChange;

  /* Currently there is an SQL level transaction open on the vacuum
  ** database. No locks are held on any other files (since the main file
  ** was committed at the btree level). So it safe to end the transaction
  ** by manually setting the autoCommit flag to true and detaching the
  ** vacuum database. The vacuum_db journal file is deleted when the pager
  ** is closed by the DETACH.
  */
  db->autoCommit = 1;

  if( pDb ){
    sqlite3BtreeClose(pDb->pBt);
    pDb->pBt = 0;
    pDb->pSchema = 0;
  }

  sqlite3ResetInternalSchema(db, 0);

  return rc;
}
#endif  /* SQLITE_OMIT_VACUUM && SQLITE_OMIT_ATTACH */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/vdbe.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** The code in this file implements execution method of the 
** Virtual Database Engine (VDBE).  A separate file ("vdbeaux.c")
** handles housekeeping details such as creating and deleting
** VDBE instances.  This file is solely interested in executing
** the VDBE program.
**
** In the external interface, an "sqlite3_stmt*" is an opaque pointer
** to a VDBE.
**
** The SQL parser generates a program which is then executed by
** the VDBE to do the work of the SQL statement.  VDBE programs are 
** similar in form to assembly language.  The program consists of
** a linear sequence of operations.  Each operation has an opcode 
** and 5 operands.  Operands P1, P2, and P3 are integers.  Operand P4 
** is a null-terminated string.  Operand P5 is an unsigned character.
** Few opcodes use all 5 operands.
**
** Computation results are stored on a set of registers numbered beginning
** with 1 and going up to Vdbe.nMem.  Each register can store
** either an integer, a null-terminated string, a floating point
** number, or the SQL "NULL" value.  An implicit conversion from one
** type to the other occurs as necessary.
** 
** Most of the code in this file is taken up by the sqlite3VdbeExec()
** function which does the work of interpreting a VDBE program.
** But other routines are also provided to help in building up
** a program instruction by instruction.
**
** Various scripts scan this source file in order to generate HTML
** documentation, headers files, or other derived files.  The formatting
** of the code in this file is, therefore, important.  See other comments
** in this file for details.  If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code.
**
** $Id: vdbe.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
#include "vdbeInt.h"

/*
** The following global variable is incremented every time a cursor
** moves, either by the OP_MoveXX, OP_Next, or OP_Prev opcodes.  The test
** procedures use this information to make sure that indices are
** working correctly.  This variable has no function other than to
** help verify the correct operation of the library.
*/
#ifdef SQLITE_TEST
int sqlite3_search_count = 0;
#endif

/*
** When this global variable is positive, it gets decremented once before
** each instruction in the VDBE.  When reaches zero, the u1.isInterrupted
** field of the sqlite3 structure is set in order to simulate and interrupt.
**
** This facility is used for testing purposes only.  It does not function
** in an ordinary build.
*/
#ifdef SQLITE_TEST
int sqlite3_interrupt_count = 0;
#endif

/*
** The next global variable is incremented each type the OP_Sort opcode
** is executed.  The test procedures use this information to make sure that
** sorting is occurring or not occurring at appropriate times.   This variable
** has no function other than to help verify the correct operation of the
** library.
*/
#ifdef SQLITE_TEST
int sqlite3_sort_count = 0;
#endif

/*
** The next global variable records the size of the largest MEM_Blob
** or MEM_Str that has been used by a VDBE opcode.  The test procedures
** use this information to make sure that the zero-blob functionality
** is working correctly.   This variable has no function other than to
** help verify the correct operation of the library.
*/
#ifdef SQLITE_TEST
int sqlite3_max_blobsize = 0;
static void updateMaxBlobsize(Mem *p){
  if( (p->flags & (MEM_Str|MEM_Blob))!=0 && p->n>sqlite3_max_blobsize ){
    sqlite3_max_blobsize = p->n;
  }
}
#endif

/*
** Test a register to see if it exceeds the current maximum blob size.
** If it does, record the new maximum blob size.
*/
#if defined(SQLITE_TEST) && !defined(SQLITE_OMIT_BUILTIN_TEST)
# define UPDATE_MAX_BLOBSIZE(P)  updateMaxBlobsize(P)
#else
# define UPDATE_MAX_BLOBSIZE(P)
#endif

/*
** Release the memory associated with a register.  This
** leaves the Mem.flags field in an inconsistent state.
*/
#define Release(P) if((P)->flags&MEM_Dyn){ sqlite3VdbeMemRelease(P); }

/*
** Convert the given register into a string if it isn't one
** already. Return non-zero if a malloc() fails.
*/
#define Stringify(P, enc) \
   if(((P)->flags&(MEM_Str|MEM_Blob))==0 && sqlite3VdbeMemStringify(P,enc)) \
     { goto no_mem; }

/*
** An ephemeral string value (signified by the MEM_Ephem flag) contains
** a pointer to a dynamically allocated string where some other entity
** is responsible for deallocating that string.  Because the register
** does not control the string, it might be deleted without the register
** knowing it.
**
** This routine converts an ephemeral string into a dynamically allocated
** string that the register itself controls.  In other words, it
** converts an MEM_Ephem string into an MEM_Dyn string.
*/
#define Deephemeralize(P) \
   if( ((P)->flags&MEM_Ephem)!=0 \
       && sqlite3VdbeMemMakeWriteable(P) ){ goto no_mem;}

/*
** Call sqlite3VdbeMemExpandBlob() on the supplied value (type Mem*)
** 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;
  }
  else if( flags & MEM_Real ){
    pMem->type = SQLITE_FLOAT;
  }
  else if( flags & MEM_Str ){
    pMem->type = SQLITE_TEXT;
  }else{
    pMem->type = SQLITE_BLOB;
  }
}

/*
** Properties of opcodes.  The OPFLG_INITIALIZER macro is
** created by mkopcodeh.awk during compilation.  Data is obtained
** from the comments following the "case OP_xxxx:" statements in
** this file.  
*/
static unsigned char opcodeProperty[] = OPFLG_INITIALIZER;

/*
** Return true if an opcode has any of the OPFLG_xxx properties
** specified by mask.
*/
int sqlite3VdbeOpcodeHasProperty(int opcode, int mask){
  assert( opcode>0 && opcode<sizeof(opcodeProperty) );
  return (opcodeProperty[opcode]&mask)!=0;
}

/*
** Allocate cursor number iCur.  Return a pointer to it.  Return NULL
** if we run out of memory.
*/
static Cursor *allocateCursor(
  Vdbe *p, 
  int iCur, 
  Op *pOp,
  int iDb, 
  int isBtreeCursor
){
  /* Find the memory cell that will be used to store the blob of memory
  ** required for this Cursor structure. It is convenient to use a 
  ** vdbe memory cell to manage the memory allocation required for a
  ** Cursor structure for the following reasons:
  **
  **   * Sometimes cursor numbers are used for a couple of different
  **     purposes in a vdbe program. The different uses might require
  **     different sized allocations. Memory cells provide growable
  **     allocations.
  **
  **   * When using ENABLE_MEMORY_MANAGEMENT, memory cell buffers can
  **     be freed lazily via the sqlite3_release_memory() API. This
  **     minimizes the number of malloc calls made by the system.
  **
  ** Memory cells for cursors are allocated at the top of the address
  ** space. Memory cell (p->nMem) corresponds to cursor 0. Space for
  ** cursor 1 is managed by memory cell (p->nMem-1), etc.
  */
  Mem *pMem = &p->aMem[p->nMem-iCur];

  int nByte;
  Cursor *pCx = 0;
  /* If the opcode of pOp is OP_SetNumColumns, then pOp->p2 contains
  ** the number of fields in the records contained in the table or
  ** index being opened. Use this to reserve space for the 
  ** Cursor.aType[] array.
  */
  int nField = 0;
  if( pOp->opcode==OP_SetNumColumns || pOp->opcode==OP_OpenEphemeral ){
    nField = pOp->p2;
  }
  nByte = 
      sizeof(Cursor) + 
      (isBtreeCursor?sqlite3BtreeCursorSize():0) + 
      2*nField*sizeof(u32);

  assert( iCur<p->nCursor );
  if( p->apCsr[iCur] ){
    sqlite3VdbeFreeCursor(p, p->apCsr[iCur]);
    p->apCsr[iCur] = 0;
  }
  if( SQLITE_OK==sqlite3VdbeMemGrow(pMem, nByte, 0) ){
    p->apCsr[iCur] = pCx = (Cursor *)pMem->z;
    memset(pMem->z, 0, nByte);
    pCx->iDb = iDb;
    pCx->nField = nField;
    if( nField ){
      pCx->aType = (u32 *)&pMem->z[sizeof(Cursor)];
    }
    if( isBtreeCursor ){
      pCx->pCursor = (BtCursor *)&pMem->z[sizeof(Cursor)+2*nField*sizeof(u32)];
    }
  }
  return pCx;
}

/*
** Try to convert a value into a numeric representation if we can
** do so without loss of information.  In other words, if the string
** looks like a number, convert it into a number.  If it does not
** look like a number, leave it alone.
*/
static void applyNumericAffinity(Mem *pRec){
  if( (pRec->flags & (MEM_Real|MEM_Int))==0 ){
    int realnum;
    sqlite3VdbeMemNulTerminate(pRec);
    if( (pRec->flags&MEM_Str)
         && sqlite3IsNumber(pRec->z, &realnum, pRec->enc) ){
      i64 value;
      sqlite3VdbeChangeEncoding(pRec, SQLITE_UTF8);
      if( !realnum && sqlite3Atoi64(pRec->z, &value) ){
        pRec->u.i = value;
        MemSetTypeFlag(pRec, MEM_Int);
      }else{
        sqlite3VdbeMemRealify(pRec);
      }
    }
  }
}

/*
** Processing is determine by the affinity parameter:
**
** SQLITE_AFF_INTEGER:
** SQLITE_AFF_REAL:
** SQLITE_AFF_NUMERIC:
**    Try to convert pRec to an integer representation or a 
**    floating-point representation if an integer representation
**    is not possible.  Note that the integer representation is
**    always preferred, even if the affinity is REAL, because
**    an integer representation is more space efficient on disk.
**
** SQLITE_AFF_TEXT:
**    Convert pRec to a text representation.
**
** SQLITE_AFF_NONE:
**    No-op.  pRec is unchanged.
*/
static void applyAffinity(
  Mem *pRec,          /* The value to apply affinity to */
  char affinity,      /* The affinity to be applied */
  u8 enc              /* Use this text encoding */
){
  if( affinity==SQLITE_AFF_TEXT ){
    /* Only attempt the conversion to TEXT if there is an integer or real
    ** representation (blob and NULL do not get converted) but no string
    ** representation.
    */
    if( 0==(pRec->flags&MEM_Str) && (pRec->flags&(MEM_Real|MEM_Int)) ){
      sqlite3VdbeMemStringify(pRec, enc);
    }
    pRec->flags &= ~(MEM_Real|MEM_Int);
  }else if( affinity!=SQLITE_AFF_NONE ){
    assert( affinity==SQLITE_AFF_INTEGER || affinity==SQLITE_AFF_REAL
             || affinity==SQLITE_AFF_NUMERIC );
    applyNumericAffinity(pRec);
    if( pRec->flags & MEM_Real ){
      sqlite3VdbeIntegerAffinity(pRec);
    }
  }
}

/*
** Try to convert the type of a function argument or a result column
** into a numeric representation.  Use either INTEGER or REAL whichever
** is appropriate.  But only do the conversion if it is possible without
** loss of information and return the revised type of the argument.
**
** This is an EXPERIMENTAL api and is subject to change or removal.
*/
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.
*/
void sqlite3ValueApplyAffinity(
  sqlite3_value *pVal, 
  u8 affinity, 
  u8 enc
){
  applyAffinity((Mem *)pVal, affinity, enc);
}

#ifdef SQLITE_DEBUG
/*
** Write a nice string representation of the contents of cell pMem
** into buffer zBuf, length nBuf.
*/
void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf){
  char *zCsr = zBuf;
  int f = pMem->flags;

  static const char *const encnames[] = {"(X)", "(8)", "(16LE)", "(16BE)"};

  if( f&MEM_Blob ){
    int i;
    char c;
    if( f & MEM_Dyn ){
      c = 'z';
      assert( (f & (MEM_Static|MEM_Ephem))==0 );
    }else if( f & MEM_Static ){
      c = 't';
      assert( (f & (MEM_Dyn|MEM_Ephem))==0 );
    }else if( f & MEM_Ephem ){
      c = 'e';
      assert( (f & (MEM_Static|MEM_Dyn))==0 );
    }else{
      c = 's';
    }

    sqlite3_snprintf(100, zCsr, "%c", c);
    zCsr += strlen(zCsr);
    sqlite3_snprintf(100, zCsr, "%d[", pMem->n);
    zCsr += strlen(zCsr);
    for(i=0; i<16 && i<pMem->n; i++){
      sqlite3_snprintf(100, zCsr, "%02X", ((int)pMem->z[i] & 0xFF));
      zCsr += strlen(zCsr);
    }
    for(i=0; i<16 && i<pMem->n; i++){
      char z = pMem->z[i];
      if( z<32 || z>126 ) *zCsr++ = '.';
      else *zCsr++ = z;
    }

    sqlite3_snprintf(100, zCsr, "]%s", encnames[pMem->enc]);
    zCsr += strlen(zCsr);
    if( f & MEM_Zero ){
      sqlite3_snprintf(100, zCsr,"+%lldz",pMem->u.i);
      zCsr += strlen(zCsr);
    }
    *zCsr = '\0';
  }else if( f & MEM_Str ){
    int j, k;
    zBuf[0] = ' ';
    if( f & MEM_Dyn ){
      zBuf[1] = 'z';
      assert( (f & (MEM_Static|MEM_Ephem))==0 );
    }else if( f & MEM_Static ){
      zBuf[1] = 't';
      assert( (f & (MEM_Dyn|MEM_Ephem))==0 );
    }else if( f & MEM_Ephem ){
      zBuf[1] = 'e';
      assert( (f & (MEM_Static|MEM_Dyn))==0 );
    }else{
      zBuf[1] = 's';
    }
    k = 2;
    sqlite3_snprintf(100, &zBuf[k], "%d", pMem->n);
    k += strlen(&zBuf[k]);
    zBuf[k++] = '[';
    for(j=0; j<15 && j<pMem->n; j++){
      u8 c = pMem->z[j];
      if( c>=0x20 && c<0x7f ){
        zBuf[k++] = c;
      }else{
        zBuf[k++] = '.';
      }
    }
    zBuf[k++] = ']';
    sqlite3_snprintf(100,&zBuf[k], encnames[pMem->enc]);
    k += strlen(&zBuf[k]);
    zBuf[k++] = 0;
  }
}
#endif

#ifdef SQLITE_DEBUG
/*
** Print the value of a register for tracing purposes:
*/
static void memTracePrint(FILE *out, Mem *p){
  if( p->flags & MEM_Null ){
    fprintf(out, " NULL");
  }else if( (p->flags & (MEM_Int|MEM_Str))==(MEM_Int|MEM_Str) ){
    fprintf(out, " si:%lld", p->u.i);
  }else if( p->flags & MEM_Int ){
    fprintf(out, " i:%lld", p->u.i);
  }else if( p->flags & MEM_Real ){
    fprintf(out, " r:%g", p->r);
  }else{
    char zBuf[200];
    sqlite3VdbeMemPrettyPrint(p, zBuf);
    fprintf(out, " ");
    fprintf(out, "%s", zBuf);
  }
}
static void registerTrace(FILE *out, int iReg, Mem *p){
  fprintf(out, "REG[%d] = ", iReg);
  memTracePrint(out, p);
  fprintf(out, "\n");
}
#endif

#ifdef SQLITE_DEBUG
#  define REGISTER_TRACE(R,M) if(p->trace)registerTrace(p->trace,R,M)
#else
#  define REGISTER_TRACE(R,M)
#endif


#ifdef VDBE_PROFILE

/* 
** hwtime.h contains inline assembler code for implementing 
** high-performance timing routines.
*/
#include "hwtime.h"

#endif

/*
** The CHECK_FOR_INTERRUPT macro defined here looks to see if the
** sqlite3_interrupt() routine has been called.  If it has been, then
** processing of the VDBE program is interrupted.
**
** This macro added to every instruction that does a jump in order to
** implement a loop.  This test used to be on every single instruction,
** but that meant we more testing that we needed.  By only testing the
** flag on jump instructions, we get a (small) speed improvement.
*/
#define CHECK_FOR_INTERRUPT \
   if( db->u1.isInterrupted ) goto abort_due_to_interrupt;

#ifdef SQLITE_DEBUG
static int fileExists(sqlite3 *db, const char *zFile){
  int res = 0;
  int rc = SQLITE_OK;
#ifdef SQLITE_TEST
  /* If we are currently testing IO errors, then do not call OsAccess() to
  ** test for the presence of zFile. This is because any IO error that
  ** occurs here will not be reported, causing the test to fail.
  */
  extern int sqlite3_io_error_pending;
  if( sqlite3_io_error_pending<=0 )
#endif
    rc = sqlite3OsAccess(db->pVfs, zFile, SQLITE_ACCESS_EXISTS, &res);
  return (res && rc==SQLITE_OK);
}
#endif

/*
** Execute as much of a VDBE program as we can then return.
**
** sqlite3VdbeMakeReady() must be called before this routine in order to
** close the program with a final OP_Halt and to set up the callbacks
** and the error message pointer.
**
** Whenever a row or result data is available, this routine will either
** invoke the result callback (if there is one) or return with
** SQLITE_ROW.
**
** If an attempt is made to open a locked database, then this routine
** will either invoke the busy callback (if there is one) or it will
** return SQLITE_BUSY.
**
** If an error occurs, an error message is written to memory obtained
** from sqlite3_malloc() and p->zErrMsg is made to point to that memory.
** The error code is stored in p->rc and this routine returns SQLITE_ERROR.
**
** If the callback ever returns non-zero, then the program exits
** immediately.  There will be no error message but the p->rc field is
** set to SQLITE_ABORT and this routine will return SQLITE_ERROR.
**
** A memory allocation error causes p->rc to be set to SQLITE_NOMEM and this
** routine to return SQLITE_ERROR.
**
** Other fatal errors return SQLITE_ERROR.
**
** After this routine has finished, sqlite3VdbeFinalize() should be
** used to clean up the mess that was left behind.
*/
int sqlite3VdbeExec(
  Vdbe *p                    /* The VDBE */
){
  int pc;                    /* The program counter */
  Op *pOp;                   /* Current operation */
  int rc = SQLITE_OK;        /* Value to return */
  sqlite3 *db = p->db;       /* The database */
  u8 encoding = ENC(db);     /* The database encoding */
  Mem *pIn1, *pIn2, *pIn3;   /* Input operands */
  Mem *pOut;                 /* Output operand */
  u8 opProperty;
  int iCompare = 0;          /* Result of last OP_Compare operation */
  int *aPermute = 0;         /* Permuation of columns for OP_Compare */
#ifdef VDBE_PROFILE
  u64 start;                 /* CPU clock count at start of opcode */
  int origPc;                /* Program counter at start of opcode */
#endif
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
  int nProgressOps = 0;      /* Opcodes executed since progress callback. */
#endif

  assert( p->magic==VDBE_MAGIC_RUN );  /* sqlite3_step() verifies this */
  assert( db->magic==SQLITE_MAGIC_BUSY );
  sqlite3BtreeMutexArrayEnter(&p->aMutex);
  if( p->rc==SQLITE_NOMEM ){
    /* This happens if a malloc() inside a call to sqlite3_column_text() or
    ** sqlite3_column_text16() failed.  */
    goto no_mem;
  }
  assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY );
  p->rc = SQLITE_OK;
  assert( p->explain==0 );
  p->pResultSet = 0;
  db->busyHandler.nBusy = 0;
  CHECK_FOR_INTERRUPT;
  sqlite3VdbeIOTraceSql(p);
#ifdef SQLITE_DEBUG
  sqlite3BeginBenignMalloc();
  if( p->pc==0 
   && ((p->db->flags & SQLITE_VdbeListing) || fileExists(db, "vdbe_explain"))
  ){
    int i;
    printf("VDBE Program Listing:\n");
    sqlite3VdbePrintSql(p);
    for(i=0; i<p->nOp; i++){
      sqlite3VdbePrintOp(stdout, i, &p->aOp[i]);
    }
  }
  if( fileExists(db, "vdbe_trace") ){
    p->trace = stdout;
  }
  sqlite3EndBenignMalloc();
#endif
  for(pc=p->pc; rc==SQLITE_OK; pc++){
    assert( pc>=0 && pc<p->nOp );
    if( db->mallocFailed ) goto no_mem;
#ifdef VDBE_PROFILE
    origPc = pc;
    start = sqlite3Hwtime();
#endif
    pOp = &p->aOp[pc];

    /* Only allow tracing if SQLITE_DEBUG is defined.
    */
#ifdef SQLITE_DEBUG
    if( p->trace ){
      if( pc==0 ){
        printf("VDBE Execution Trace:\n");
        sqlite3VdbePrintSql(p);
      }
      sqlite3VdbePrintOp(p->trace, pc, pOp);
    }
    if( p->trace==0 && pc==0 ){
      sqlite3BeginBenignMalloc();
      if( fileExists(db, "vdbe_sqltrace") ){
        sqlite3VdbePrintSql(p);
      }
      sqlite3EndBenignMalloc();
    }
#endif
      

    /* Check to see if we need to simulate an interrupt.  This only happens
    ** if we have a special test build.
    */
#ifdef SQLITE_TEST
    if( sqlite3_interrupt_count>0 ){
      sqlite3_interrupt_count--;
      if( sqlite3_interrupt_count==0 ){
        sqlite3_interrupt(db);
      }
    }
#endif

#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
    /* Call the progress callback if it is configured and the required number
    ** of VDBE ops have been executed (either since this invocation of
    ** sqlite3VdbeExec() or since last time the progress callback was called).
    ** If the progress callback returns non-zero, exit the virtual machine with
    ** a return code SQLITE_ABORT.
    */
    if( db->xProgress ){
      if( db->nProgressOps==nProgressOps ){
        int prc;
        if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
        prc =db->xProgress(db->pProgressArg);
        if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
        if( prc!=0 ){
          rc = SQLITE_INTERRUPT;
          goto vdbe_error_halt;
        }
        nProgressOps = 0;
      }
      nProgressOps++;
    }
#endif

    /* Do common setup processing for any opcode that is marked
    ** with the "out2-prerelease" tag.  Such opcodes have a single
    ** output which is specified by the P2 parameter.  The P2 register
    ** is initialized to a NULL.
    */
    opProperty = opcodeProperty[pOp->opcode];
    if( (opProperty & OPFLG_OUT2_PRERELEASE)!=0 ){
      assert( pOp->p2>0 );
      assert( pOp->p2<=p->nMem );
      pOut = &p->aMem[pOp->p2];
      sqlite3VdbeMemReleaseExternal(pOut);
      pOut->flags = MEM_Null;
    }else
 
    /* Do common setup for opcodes marked with one of the following
    ** combinations of properties.
    **
    **           in1
    **           in1 in2
    **           in1 in2 out3
    **           in1 in3
    **
    ** Variables pIn1, pIn2, and pIn3 are made to point to appropriate
    ** registers for inputs.  Variable pOut points to the output register.
    */
    if( (opProperty & OPFLG_IN1)!=0 ){
      assert( pOp->p1>0 );
      assert( pOp->p1<=p->nMem );
      pIn1 = &p->aMem[pOp->p1];
      REGISTER_TRACE(pOp->p1, pIn1);
      if( (opProperty & OPFLG_IN2)!=0 ){
        assert( pOp->p2>0 );
        assert( pOp->p2<=p->nMem );
        pIn2 = &p->aMem[pOp->p2];
        REGISTER_TRACE(pOp->p2, pIn2);
        if( (opProperty & OPFLG_OUT3)!=0 ){
          assert( pOp->p3>0 );
          assert( pOp->p3<=p->nMem );
          pOut = &p->aMem[pOp->p3];
        }
      }else if( (opProperty & OPFLG_IN3)!=0 ){
        assert( pOp->p3>0 );
        assert( pOp->p3<=p->nMem );
        pIn3 = &p->aMem[pOp->p3];
        REGISTER_TRACE(pOp->p3, pIn3);
      }
    }else if( (opProperty & OPFLG_IN2)!=0 ){
      assert( pOp->p2>0 );
      assert( pOp->p2<=p->nMem );
      pIn2 = &p->aMem[pOp->p2];
      REGISTER_TRACE(pOp->p2, pIn2);
    }else if( (opProperty & OPFLG_IN3)!=0 ){
      assert( pOp->p3>0 );
      assert( pOp->p3<=p->nMem );
      pIn3 = &p->aMem[pOp->p3];
      REGISTER_TRACE(pOp->p3, pIn3);
    }

    switch( pOp->opcode ){

/*****************************************************************************
** What follows is a massive switch statement where each case implements a
** separate instruction in the virtual machine.  If we follow the usual
** indentation conventions, each case should be indented by 6 spaces.  But
** that is a lot of wasted space on the left margin.  So the code within
** the switch statement will break with convention and be flush-left. Another
** big comment (similar to this one) will mark the point in the code where
** we transition back to normal indentation.
**
** The formatting of each case is important.  The makefile for SQLite
** generates two C files "opcodes.h" and "opcodes.c" by scanning this
** file looking for lines that begin with "case OP_".  The opcodes.h files
** will be filled with #defines that give unique integer values to each
** opcode and the opcodes.c file is filled with an array of strings where
** each string is the symbolic name for the corresponding opcode.  If the
** case statement is followed by a comment of the form "/# same as ... #/"
** that comment is used to determine the particular value of the opcode.
**
** Other keywords in the comment that follows each case are used to
** construct the OPFLG_INITIALIZER value that initializes opcodeProperty[].
** Keywords include: in1, in2, in3, out2_prerelease, out2, out3.  See
** the mkopcodeh.awk script for additional information.
**
** Documentation about VDBE opcodes is generated by scanning this file
** for lines of that contain "Opcode:".  That line and all subsequent
** comment lines are used in the generation of the opcode.html documentation
** file.
**
** SUMMARY:
**
**     Formatting is important to scripts that scan this file.
**     Do not deviate from the formatting style currently in use.
**
*****************************************************************************/

/* Opcode:  Goto * P2 * * *
**
** An unconditional jump to address P2.
** The next instruction executed will be 
** the one at index P2 from the beginning of
** the program.
*/
case OP_Goto: {             /* jump */
  CHECK_FOR_INTERRUPT;
  pc = pOp->p2 - 1;
  break;
}

/* Opcode:  Gosub P1 P2 * * *
**
** Write the current address onto register P1
** and then jump to address P2.
*/
case OP_Gosub: {            /* jump */
  assert( pOp->p1>0 );
  assert( pOp->p1<=p->nMem );
  pIn1 = &p->aMem[pOp->p1];
  assert( (pIn1->flags & MEM_Dyn)==0 );
  pIn1->flags = MEM_Int;
  pIn1->u.i = pc;
  REGISTER_TRACE(pOp->p1, pIn1);
  pc = pOp->p2 - 1;
  break;
}

/* Opcode:  Return P1 * * * *
**
** Jump to the next instruction after the address in register P1.
*/
case OP_Return: {           /* in1 */
  assert( pIn1->flags & MEM_Int );
  pc = pIn1->u.i;
  break;
}

/* Opcode:  Yield P1 * * * *
**
** Swap the program counter with the value in register P1.
*/
case OP_Yield: {
  int pcDest;
  assert( pOp->p1>0 );
  assert( pOp->p1<=p->nMem );
  pIn1 = &p->aMem[pOp->p1];
  assert( (pIn1->flags & MEM_Dyn)==0 );
  pIn1->flags = MEM_Int;
  pcDest = pIn1->u.i;
  pIn1->u.i = pc;
  REGISTER_TRACE(pOp->p1, pIn1);
  pc = pcDest;
  break;
}


/* Opcode:  Halt P1 P2 * P4 *
**
** Exit immediately.  All open cursors, Fifos, etc are closed
** automatically.
**
** P1 is the result code returned by sqlite3_exec(), sqlite3_reset(),
** or sqlite3_finalize().  For a normal halt, this should be SQLITE_OK (0).
** For errors, it can be some other value.  If P1!=0 then P2 will determine
** whether or not to rollback the current transaction.  Do not rollback
** if P2==OE_Fail. Do the rollback if P2==OE_Rollback.  If P2==OE_Abort,
** then back out all changes that have occurred during this execution of the
** VDBE, but do not rollback the transaction. 
**
** If P4 is not null then it is an error message string.
**
** There is an implied "Halt 0 0 0" instruction inserted at the very end of
** every program.  So a jump past the last instruction of the program
** is the same as executing Halt.
*/
case OP_Halt: {
  p->rc = pOp->p1;
  p->pc = pc;
  p->errorAction = pOp->p2;
  if( pOp->p4.z ){
    sqlite3SetString(&p->zErrMsg, db, "%s", pOp->p4.z);
  }
  rc = sqlite3VdbeHalt(p);
  assert( rc==SQLITE_BUSY || rc==SQLITE_OK );
  if( rc==SQLITE_BUSY ){
    p->rc = rc = SQLITE_BUSY;
  }else{
    rc = p->rc ? SQLITE_ERROR : SQLITE_DONE;
  }
  goto vdbe_return;
}

/* Opcode: Integer P1 P2 * * *
**
** The 32-bit integer value P1 is written into register P2.
*/
case OP_Integer: {         /* out2-prerelease */
  pOut->flags = MEM_Int;
  pOut->u.i = pOp->p1;
  break;
}

/* Opcode: Int64 * P2 * P4 *
**
** P4 is a pointer to a 64-bit integer value.
** Write that value into register P2.
*/
case OP_Int64: {           /* out2-prerelease */
  assert( pOp->p4.pI64!=0 );
  pOut->flags = MEM_Int;
  pOut->u.i = *pOp->p4.pI64;
  break;
}

/* Opcode: Real * P2 * P4 *
**
** P4 is a pointer to a 64-bit floating point value.
** Write that value into register P2.
*/
case OP_Real: {            /* same as TK_FLOAT, out2-prerelease */
  pOut->flags = MEM_Real;
  assert( !sqlite3IsNaN(*pOp->p4.pReal) );
  pOut->r = *pOp->p4.pReal;
  break;
}

/* Opcode: String8 * P2 * P4 *
**
** P4 points to a nul terminated UTF-8 string. This opcode is transformed 
** into an OP_String before it is executed for the first time.
*/
case OP_String8: {         /* same as TK_STRING, out2-prerelease */
  assert( pOp->p4.z!=0 );
  pOp->opcode = OP_String;
  pOp->p1 = strlen(pOp->p4.z);

#ifndef SQLITE_OMIT_UTF16
  if( encoding!=SQLITE_UTF8 ){
    sqlite3VdbeMemSetStr(pOut, pOp->p4.z, -1, SQLITE_UTF8, SQLITE_STATIC);
    if( SQLITE_OK!=sqlite3VdbeChangeEncoding(pOut, encoding) ) goto no_mem;
    if( SQLITE_OK!=sqlite3VdbeMemMakeWriteable(pOut) ) goto no_mem;
    pOut->zMalloc = 0;
    pOut->flags |= MEM_Static;
    pOut->flags &= ~MEM_Dyn;
    if( pOp->p4type==P4_DYNAMIC ){
      sqlite3DbFree(db, pOp->p4.z);
    }
    pOp->p4type = P4_DYNAMIC;
    pOp->p4.z = pOut->z;
    pOp->p1 = pOut->n;
    if( pOp->p1>db->aLimit[SQLITE_LIMIT_LENGTH] ){
      goto too_big;
    }
    UPDATE_MAX_BLOBSIZE(pOut);
    break;
  }
#endif
  if( pOp->p1>db->aLimit[SQLITE_LIMIT_LENGTH] ){
    goto too_big;
  }
  /* Fall through to the next case, OP_String */
}
  
/* Opcode: String P1 P2 * P4 *
**
** The string value P4 of length P1 (bytes) is stored in register P2.
*/
case OP_String: {          /* out2-prerelease */
  assert( pOp->p4.z!=0 );
  pOut->flags = MEM_Str|MEM_Static|MEM_Term;
  pOut->z = pOp->p4.z;
  pOut->n = pOp->p1;
  pOut->enc = encoding;
  UPDATE_MAX_BLOBSIZE(pOut);
  break;
}

/* Opcode: Null * P2 * * *
**
** Write a NULL into register P2.
*/
case OP_Null: {           /* out2-prerelease */
  break;
}


#ifndef SQLITE_OMIT_BLOB_LITERAL
/* Opcode: Blob P1 P2 * P4
**
** P4 points to a blob of data P1 bytes long.  Store this
** blob in register P2. This instruction is not coded directly
** by the compiler. Instead, the compiler layer specifies
** an OP_HexBlob opcode, with the hex string representation of
** the blob as P4. This opcode is transformed to an OP_Blob
** the first time it is executed.
*/
case OP_Blob: {                /* out2-prerelease */
  assert( pOp->p1 <= SQLITE_MAX_LENGTH );
  sqlite3VdbeMemSetStr(pOut, pOp->p4.z, pOp->p1, 0, 0);
  pOut->enc = encoding;
  UPDATE_MAX_BLOBSIZE(pOut);
  break;
}
#endif /* SQLITE_OMIT_BLOB_LITERAL */

/* Opcode: Variable P1 P2 * * *
**
** The value of variable P1 is written into register P2. A variable is
** an unknown in the original SQL string as handed to sqlite3_compile().
** Any occurrence of the '?' character in the original SQL is considered
** a variable.  Variables in the SQL string are number from left to
** right beginning with 1.  The values of variables are set using the
** sqlite3_bind() API.
*/
case OP_Variable: {           /* out2-prerelease */
  int j = pOp->p1 - 1;
  Mem *pVar;
  assert( j>=0 && j<p->nVar );

  pVar = &p->aVar[j];
  if( sqlite3VdbeMemTooBig(pVar) ){
    goto too_big;
  }
  sqlite3VdbeMemShallowCopy(pOut, &p->aVar[j], MEM_Static);
  UPDATE_MAX_BLOBSIZE(pOut);
  break;
}

/* Opcode: Move P1 P2 P3 * *
**
** Move the values in register P1..P1+P3-1 over into
** registers P2..P2+P3-1.  Registers P1..P1+P1-1 are
** left holding a NULL.  It is an error for register ranges
** P1..P1+P3-1 and P2..P2+P3-1 to overlap.
*/
case OP_Move: {
  char *zMalloc;
  int n = pOp->p3;
  int p1 = pOp->p1;
  int p2 = pOp->p2;
  assert( n>0 );
  assert( p1>0 );
  assert( p1+n<p->nMem );
  pIn1 = &p->aMem[p1];
  assert( p2>0 );
  assert( p2+n<p->nMem );
  pOut = &p->aMem[p2];
  assert( p1+n<=p2 || p2+n<=p1 );
  while( n-- ){
    zMalloc = pOut->zMalloc;
    pOut->zMalloc = 0;
    sqlite3VdbeMemMove(pOut, pIn1);
    pIn1->zMalloc = zMalloc;
    REGISTER_TRACE(p2++, pOut);
    pIn1++;
    pOut++;
  }
  break;
}

/* Opcode: Copy P1 P2 * * *
**
** Make a copy of register P1 into register P2.
**
** This instruction makes a deep copy of the value.  A duplicate
** is made of any string or blob constant.  See also OP_SCopy.
*/
case OP_Copy: {
  assert( pOp->p1>0 );
  assert( pOp->p1<=p->nMem );
  pIn1 = &p->aMem[pOp->p1];
  assert( pOp->p2>0 );
  assert( pOp->p2<=p->nMem );
  pOut = &p->aMem[pOp->p2];
  assert( pOut!=pIn1 );
  sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem);
  Deephemeralize(pOut);
  REGISTER_TRACE(pOp->p2, pOut);
  break;
}

/* Opcode: SCopy P1 P2 * * *
**
** Make a shallow copy of register P1 into register P2.
**
** This instruction makes a shallow copy of the value.  If the value
** is a string or blob, then the copy is only a pointer to the
** original and hence if the original changes so will the copy.
** Worse, if the original is deallocated, the copy becomes invalid.
** Thus the program must guarantee that the original will not change
** during the lifetime of the copy.  Use OP_Copy to make a complete
** copy.
*/
case OP_SCopy: {
  assert( pOp->p1>0 );
  assert( pOp->p1<=p->nMem );
  pIn1 = &p->aMem[pOp->p1];
  REGISTER_TRACE(pOp->p1, pIn1);
  assert( pOp->p2>0 );
  assert( pOp->p2<=p->nMem );
  pOut = &p->aMem[pOp->p2];
  assert( pOut!=pIn1 );
  sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem);
  REGISTER_TRACE(pOp->p2, pOut);
  break;
}

/* Opcode: ResultRow P1 P2 * * *
**
** The registers P1 through P1+P2-1 contain a single row of
** results. This opcode causes the sqlite3_step() call to terminate
** with an SQLITE_ROW return code and it sets up the sqlite3_stmt
** structure to provide access to the top P1 values as the result
** row.
*/
case OP_ResultRow: {
  Mem *pMem;
  int i;
  assert( p->nResColumn==pOp->p2 );
  assert( pOp->p1>0 );
  assert( pOp->p1+pOp->p2<=p->nMem );

  /* Invalidate all ephemeral cursor row caches */
  p->cacheCtr = (p->cacheCtr + 2)|1;

  /* 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.
  */
  pMem = p->pResultSet = &p->aMem[pOp->p1];
  for(i=0; i<pOp->p2; i++){
    sqlite3VdbeMemNulTerminate(&pMem[i]);
    storeTypeInfo(&pMem[i], encoding);
    REGISTER_TRACE(pOp->p1+i, &pMem[i]);
  }
  if( db->mallocFailed ) goto no_mem;

  /* Return SQLITE_ROW
  */
  p->nCallback++;
  p->pc = pc + 1;
  rc = SQLITE_ROW;
  goto vdbe_return;
}

/* Opcode: Concat P1 P2 P3 * *
**
** Add the text in register P1 onto the end of the text in
** register P2 and store the result in register P3.
** If either the P1 or P2 text are NULL then store NULL in P3.
**
**   P3 = P2 || P1
**
** It is illegal for P1 and P3 to be the same register. Sometimes,
** if P3 is the same register as P2, the implementation is able
** to avoid a memcpy().
*/
case OP_Concat: {           /* same as TK_CONCAT, in1, in2, out3 */
  i64 nByte;

  assert( pIn1!=pOut );
  if( (pIn1->flags | pIn2->flags) & MEM_Null ){
    sqlite3VdbeMemSetNull(pOut);
    break;
  }
  ExpandBlob(pIn1);
  Stringify(pIn1, encoding);
  ExpandBlob(pIn2);
  Stringify(pIn2, encoding);
  nByte = pIn1->n + pIn2->n;
  if( nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){
    goto too_big;
  }
  MemSetTypeFlag(pOut, MEM_Str);
  if( sqlite3VdbeMemGrow(pOut, nByte+2, pOut==pIn2) ){
    goto no_mem;
  }
  if( pOut!=pIn2 ){
    memcpy(pOut->z, pIn2->z, pIn2->n);
  }
  memcpy(&pOut->z[pIn2->n], pIn1->z, pIn1->n);
  pOut->z[nByte] = 0;
  pOut->z[nByte+1] = 0;
  pOut->flags |= MEM_Term;
  pOut->n = nByte;
  pOut->enc = encoding;
  UPDATE_MAX_BLOBSIZE(pOut);
  break;
}

/* Opcode: Add P1 P2 P3 * *
**
** Add the value in register P1 to the value in register P2
** and store the result in register P3.
** If either input is NULL, the result is NULL.
*/
/* Opcode: Multiply P1 P2 P3 * *
**
**
** Multiply the value in register P1 by the value in register P2
** and store the result in register P3.
** If either input is NULL, the result is NULL.
*/
/* Opcode: Subtract P1 P2 P3 * *
**
** Subtract the value in register P1 from the value in register P2
** and store the result in register P3.
** If either input is NULL, the result is NULL.
*/
/* Opcode: Divide P1 P2 P3 * *
**
** Divide the value in register P1 by the value in register P2
** and store the result in register P3.  If the value in register P2
** is zero, then the result is NULL.
** If either input is NULL, the result is NULL.
*/
/* Opcode: Remainder P1 P2 P3 * *
**
** Compute the remainder after integer division of the value in
** register P1 by the value in register P2 and store the result in P3. 
** If the value in register P2 is zero the result is NULL.
** If either operand is NULL, the result is NULL.
*/
case OP_Add:                   /* same as TK_PLUS, in1, in2, out3 */
case OP_Subtract:              /* same as TK_MINUS, in1, in2, out3 */
case OP_Multiply:              /* same as TK_STAR, in1, in2, out3 */
case OP_Divide:                /* same as TK_SLASH, in1, in2, out3 */
case OP_Remainder: {           /* same as TK_REM, in1, in2, out3 */
  int flags;
  applyNumericAffinity(pIn1);
  applyNumericAffinity(pIn2);
  flags = pIn1->flags | pIn2->flags;
  if( (flags & MEM_Null)!=0 ) goto arithmetic_result_is_null;
  if( (pIn1->flags & pIn2->flags & MEM_Int)==MEM_Int ){
    i64 a, b;
    a = pIn1->u.i;
    b = pIn2->u.i;
    switch( pOp->opcode ){
      case OP_Add:         b += a;       break;
      case OP_Subtract:    b -= a;       break;
      case OP_Multiply:    b *= a;       break;
      case OP_Divide: {
        if( a==0 ) goto arithmetic_result_is_null;
        /* Dividing the largest possible negative 64-bit integer (1<<63) by 
        ** -1 returns an integer too large to store in a 64-bit data-type. On
        ** some architectures, the value overflows to (1<<63). On others,
        ** a SIGFPE is issued. The following statement normalizes this
        ** behavior so that all architectures behave as if integer 
        ** overflow occurred.
        */
        if( a==-1 && b==SMALLEST_INT64 ) a = 1;
        b /= a;
        break;
      }
      default: {
        if( a==0 ) goto arithmetic_result_is_null;
        if( a==-1 ) a = 1;
        b %= a;
        break;
      }
    }
    pOut->u.i = b;
    MemSetTypeFlag(pOut, MEM_Int);
  }else{
    double a, b;
    a = sqlite3VdbeRealValue(pIn1);
    b = sqlite3VdbeRealValue(pIn2);
    switch( pOp->opcode ){
      case OP_Add:         b += a;       break;
      case OP_Subtract:    b -= a;       break;
      case OP_Multiply:    b *= a;       break;
      case OP_Divide: {
        if( a==0.0 ) goto arithmetic_result_is_null;
        b /= a;
        break;
      }
      default: {
        i64 ia = (i64)a;
        i64 ib = (i64)b;
        if( ia==0 ) goto arithmetic_result_is_null;
        if( ia==-1 ) ia = 1;
        b = ib % ia;
        break;
      }
    }
    if( sqlite3IsNaN(b) ){
      goto arithmetic_result_is_null;
    }
    pOut->r = b;
    MemSetTypeFlag(pOut, MEM_Real);
    if( (flags & MEM_Real)==0 ){
      sqlite3VdbeIntegerAffinity(pOut);
    }
  }
  break;

arithmetic_result_is_null:
  sqlite3VdbeMemSetNull(pOut);
  break;
}

/* Opcode: CollSeq * * P4
**
** P4 is a pointer to a CollSeq struct. If the next call to a user function
** or aggregate calls sqlite3GetFuncCollSeq(), this collation sequence will
** be returned. This is used by the built-in min(), max() and nullif()
** functions.
**
** The interface used by the implementation of the aforementioned functions
** to retrieve the collation sequence set by this opcode is not available
** publicly, only to user functions defined in func.c.
*/
case OP_CollSeq: {
  assert( pOp->p4type==P4_COLLSEQ );
  break;
}

/* Opcode: Function P1 P2 P3 P4 P5
**
** Invoke a user function (P4 is a pointer to a Function structure that
** defines the function) with P5 arguments taken from register P2 and
** successors.  The result of the function is stored in register P3.
** Register P3 must not be one of the function inputs.
**
** P1 is a 32-bit bitmask indicating whether or not each argument to the 
** function was determined to be constant at compile time. If the first
** argument was constant then bit 0 of P1 is set. This is used to determine
** whether meta data associated with a user function argument using the
** sqlite3_set_auxdata() API may be safely retained until the next
** invocation of this opcode.
**
** See also: AggStep and AggFinal
*/
case OP_Function: {
  int i;
  Mem *pArg;
  sqlite3_context ctx;
  sqlite3_value **apVal;
  int n = pOp->p5;

  apVal = p->apArg;
  assert( apVal || n==0 );

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

  assert( pOp->p4type==P4_FUNCDEF || pOp->p4type==P4_VDBEFUNC );
  if( pOp->p4type==P4_FUNCDEF ){
    ctx.pFunc = pOp->p4.pFunc;
    ctx.pVdbeFunc = 0;
  }else{
    ctx.pVdbeFunc = (VdbeFunc*)pOp->p4.pVdbeFunc;
    ctx.pFunc = ctx.pVdbeFunc->pFunc;
  }

  assert( pOp->p3>0 && pOp->p3<=p->nMem );
  pOut = &p->aMem[pOp->p3];
  ctx.s.flags = MEM_Null;
  ctx.s.db = db;
  ctx.s.xDel = 0;
  ctx.s.zMalloc = 0;

  /* The output cell may already have a buffer allocated. Move
  ** the pointer to ctx.s so in case the user-function can use
  ** the already allocated buffer instead of allocating a new one.
  */
  sqlite3VdbeMemMove(&ctx.s, pOut);
  MemSetTypeFlag(&ctx.s, MEM_Null);

  ctx.isError = 0;
  if( ctx.pFunc->needCollSeq ){
    assert( pOp>p->aOp );
    assert( pOp[-1].p4type==P4_COLLSEQ );
    assert( pOp[-1].opcode==OP_CollSeq );
    ctx.pColl = pOp[-1].p4.pColl;
  }
  if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
  (*ctx.pFunc->xFunc)(&ctx, n, apVal);
  if( sqlite3SafetyOn(db) ){
    sqlite3VdbeMemRelease(&ctx.s);
    goto abort_due_to_misuse;
  }
  if( db->mallocFailed ){
    /* Even though a malloc() has failed, the implementation of the
    ** user function may have called an sqlite3_result_XXX() function
    ** to return a value. The following call releases any resources
    ** associated with such a value.
    **
    ** Note: Maybe MemRelease() should be called if sqlite3SafetyOn()
    ** fails also (the if(...) statement above). But if people are
    ** misusing sqlite, they have bigger problems than a leaked value.
    */
    sqlite3VdbeMemRelease(&ctx.s);
    goto no_mem;
  }

  /* If any auxiliary data functions have been called by this user function,
  ** immediately call the destructor for any non-static values.
  */
  if( ctx.pVdbeFunc ){
    sqlite3VdbeDeleteAuxData(ctx.pVdbeFunc, pOp->p1);
    pOp->p4.pVdbeFunc = ctx.pVdbeFunc;
    pOp->p4type = P4_VDBEFUNC;
  }

  /* If the function returned an error, throw an exception */
  if( ctx.isError ){
    sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3_value_text(&ctx.s));
    rc = ctx.isError;
  }

  /* Copy the result of the function into register P3 */
  sqlite3VdbeChangeEncoding(&ctx.s, encoding);
  sqlite3VdbeMemMove(pOut, &ctx.s);
  if( sqlite3VdbeMemTooBig(pOut) ){
    goto too_big;
  }
  REGISTER_TRACE(pOp->p3, pOut);
  UPDATE_MAX_BLOBSIZE(pOut);
  break;
}

/* Opcode: BitAnd P1 P2 P3 * *
**
** Take the bit-wise AND of the values in register P1 and P2 and
** store the result in register P3.
** If either input is NULL, the result is NULL.
*/
/* Opcode: BitOr P1 P2 P3 * *
**
** Take the bit-wise OR of the values in register P1 and P2 and
** store the result in register P3.
** If either input is NULL, the result is NULL.
*/
/* Opcode: ShiftLeft P1 P2 P3 * *
**
** Shift the integer value in register P2 to the left by the
** number of bits specified by the integer in regiser P1.
** Store the result in register P3.
** If either input is NULL, the result is NULL.
*/
/* Opcode: ShiftRight P1 P2 P3 * *
**
** Shift the integer value in register P2 to the right by the
** number of bits specified by the integer in register P1.
** Store the result in register P3.
** If either input is NULL, the result is NULL.
*/
case OP_BitAnd:                 /* same as TK_BITAND, in1, in2, out3 */
case OP_BitOr:                  /* same as TK_BITOR, in1, in2, out3 */
case OP_ShiftLeft:              /* same as TK_LSHIFT, in1, in2, out3 */
case OP_ShiftRight: {           /* same as TK_RSHIFT, in1, in2, out3 */
  i64 a, b;

  if( (pIn1->flags | pIn2->flags) & MEM_Null ){
    sqlite3VdbeMemSetNull(pOut);
    break;
  }
  a = sqlite3VdbeIntValue(pIn2);
  b = sqlite3VdbeIntValue(pIn1);
  switch( pOp->opcode ){
    case OP_BitAnd:      a &= b;     break;
    case OP_BitOr:       a |= b;     break;
    case OP_ShiftLeft:   a <<= b;    break;
    default:  assert( pOp->opcode==OP_ShiftRight );
                         a >>= b;    break;
  }
  pOut->u.i = a;
  MemSetTypeFlag(pOut, MEM_Int);
  break;
}

/* Opcode: AddImm  P1 P2 * * *
** 
** Add the constant P2 to the value in register P1.
** The result is always an integer.
**
** To force any register to be an integer, just add 0.
*/
case OP_AddImm: {            /* in1 */
  sqlite3VdbeMemIntegerify(pIn1);
  pIn1->u.i += pOp->p2;
  break;
}

/* Opcode: ForceInt P1 P2 P3 * *
**
** Convert value in register P1 into an integer.  If the value 
** in P1 is not numeric (meaning that is is a NULL or a string that
** does not look like an integer or floating point number) then
** jump to P2.  If the value in P1 is numeric then
** convert it into the least integer that is greater than or equal to its
** current value if P3==0, or to the least integer that is strictly
** greater than its current value if P3==1.
*/
case OP_ForceInt: {            /* jump, in1 */
  i64 v;
  applyAffinity(pIn1, SQLITE_AFF_NUMERIC, encoding);
  if( (pIn1->flags & (MEM_Int|MEM_Real))==0 ){
    pc = pOp->p2 - 1;
    break;
  }
  if( pIn1->flags & MEM_Int ){
    v = pIn1->u.i + (pOp->p3!=0);
  }else{
    assert( pIn1->flags & MEM_Real );
    v = (sqlite3_int64)pIn1->r;
    if( pIn1->r>(double)v ) v++;
    if( pOp->p3 && pIn1->r==(double)v ) v++;
  }
  pIn1->u.i = v;
  MemSetTypeFlag(pIn1, MEM_Int);
  break;
}

/* Opcode: MustBeInt P1 P2 * * *
** 
** Force the value in register P1 to be an integer.  If the value
** in P1 is not an integer and cannot be converted into an integer
** without data loss, then jump immediately to P2, or if P2==0
** raise an SQLITE_MISMATCH exception.
*/
case OP_MustBeInt: {            /* jump, in1 */
  applyAffinity(pIn1, SQLITE_AFF_NUMERIC, encoding);
  if( (pIn1->flags & MEM_Int)==0 ){
    if( pOp->p2==0 ){
      rc = SQLITE_MISMATCH;
      goto abort_due_to_error;
    }else{
      pc = pOp->p2 - 1;
    }
  }else{
    MemSetTypeFlag(pIn1, MEM_Int);
  }
  break;
}

/* Opcode: RealAffinity P1 * * * *
**
** If register P1 holds an integer convert it to a real value.
**
** This opcode is used when extracting information from a column that
** has REAL affinity.  Such column values may still be stored as
** integers, for space efficiency, but after extraction we want them
** to have only a real value.
*/
case OP_RealAffinity: {                  /* in1 */
  if( pIn1->flags & MEM_Int ){
    sqlite3VdbeMemRealify(pIn1);
  }
  break;
}

#ifndef SQLITE_OMIT_CAST
/* Opcode: ToText P1 * * * *
**
** Force the value in register P1 to be text.
** If the value is numeric, convert it to a string using the
** equivalent of printf().  Blob values are unchanged and
** are afterwards simply interpreted as text.
**
** A NULL value is not changed by this routine.  It remains NULL.
*/
case OP_ToText: {                  /* same as TK_TO_TEXT, in1 */
  if( pIn1->flags & MEM_Null ) break;
  assert( MEM_Str==(MEM_Blob>>3) );
  pIn1->flags |= (pIn1->flags&MEM_Blob)>>3;
  applyAffinity(pIn1, SQLITE_AFF_TEXT, encoding);
  rc = ExpandBlob(pIn1);
  assert( pIn1->flags & MEM_Str || db->mallocFailed );
  pIn1->flags &= ~(MEM_Int|MEM_Real|MEM_Blob);
  UPDATE_MAX_BLOBSIZE(pIn1);
  break;
}

/* Opcode: ToBlob P1 * * * *
**
** Force the value in register P1 to be a BLOB.
** If the value is numeric, convert it to a string first.
** Strings are simply reinterpreted as blobs with no change
** to the underlying data.
**
** A NULL value is not changed by this routine.  It remains NULL.
*/
case OP_ToBlob: {                  /* same as TK_TO_BLOB, in1 */
  if( pIn1->flags & MEM_Null ) break;
  if( (pIn1->flags & MEM_Blob)==0 ){
    applyAffinity(pIn1, SQLITE_AFF_TEXT, encoding);
    assert( pIn1->flags & MEM_Str || db->mallocFailed );
  }
  MemSetTypeFlag(pIn1, MEM_Blob);
  UPDATE_MAX_BLOBSIZE(pIn1);
  break;
}

/* Opcode: ToNumeric P1 * * * *
**
** Force the value in register P1 to be numeric (either an
** integer or a floating-point number.)
** If the value is text or blob, try to convert it to an using the
** equivalent of atoi() or atof() and store 0 if no such conversion 
** is possible.
**
** A NULL value is not changed by this routine.  It remains NULL.
*/
case OP_ToNumeric: {                  /* same as TK_TO_NUMERIC, in1 */
  if( (pIn1->flags & (MEM_Null|MEM_Int|MEM_Real))==0 ){
    sqlite3VdbeMemNumerify(pIn1);
  }
  break;
}
#endif /* SQLITE_OMIT_CAST */

/* Opcode: ToInt P1 * * * *
**
** Force the value in register P1 be an integer.  If
** The value is currently a real number, drop its fractional part.
** If the value is text or blob, try to convert it to an integer using the
** equivalent of atoi() and store 0 if no such conversion is possible.
**
** A NULL value is not changed by this routine.  It remains NULL.
*/
case OP_ToInt: {                  /* same as TK_TO_INT, in1 */
  if( (pIn1->flags & MEM_Null)==0 ){
    sqlite3VdbeMemIntegerify(pIn1);
  }
  break;
}

#ifndef SQLITE_OMIT_CAST
/* Opcode: ToReal P1 * * * *
**
** Force the value in register P1 to be a floating point number.
** If The value is currently an integer, convert it.
** If the value is text or blob, try to convert it to an integer using the
** equivalent of atoi() and store 0.0 if no such conversion is possible.
**
** A NULL value is not changed by this routine.  It remains NULL.
*/
case OP_ToReal: {                  /* same as TK_TO_REAL, in1 */
  if( (pIn1->flags & MEM_Null)==0 ){
    sqlite3VdbeMemRealify(pIn1);
  }
  break;
}
#endif /* SQLITE_OMIT_CAST */

/* Opcode: Lt P1 P2 P3 P4 P5
**
** Compare the values in register P1 and P3.  If reg(P3)<reg(P1) then
** jump to address P2.  
**
** If the SQLITE_JUMPIFNULL bit of P5 is set and either reg(P1) or
** reg(P3) is NULL then take the jump.  If the SQLITE_JUMPIFNULL 
** bit is clear then fall thru if either operand is NULL.
**
** The SQLITE_AFF_MASK portion of P5 must be an affinity character -
** SQLITE_AFF_TEXT, SQLITE_AFF_INTEGER, and so forth. An attempt is made 
** to coerce both inputs according to this affinity before the
** comparison is made. If the SQLITE_AFF_MASK is 0x00, then numeric
** affinity is used. Note that the affinity conversions are stored
** back into the input registers P1 and P3.  So this opcode can cause
** persistent changes to registers P1 and P3.
**
** Once any conversions have taken place, and neither value is NULL, 
** the values are compared. If both values are blobs then memcmp() is
** used to determine the results of the comparison.  If both values
** are text, then the appropriate collating function specified in
** P4 is  used to do the comparison.  If P4 is not specified then
** memcmp() is used to compare text string.  If both values are
** numeric, then a numeric comparison is used. If the two values
** are of different types, then numbers are considered less than
** strings and strings are considered less than blobs.
**
** If the SQLITE_STOREP2 bit of P5 is set, then do not jump.  Instead,
** store a boolean result (either 0, or 1, or NULL) in register P2.
*/
/* Opcode: Ne P1 P2 P3 P4 P5
**
** This works just like the Lt opcode except that the jump is taken if
** the operands in registers P1 and P3 are not equal.  See the Lt opcode for
** additional information.
*/
/* Opcode: Eq P1 P2 P3 P4 P5
**
** This works just like the Lt opcode except that the jump is taken if
** the operands in registers P1 and P3 are equal.
** See the Lt opcode for additional information.
*/
/* Opcode: Le P1 P2 P3 P4 P5
**
** This works just like the Lt opcode except that the jump is taken if
** the content of register P3 is less than or equal to the content of
** register P1.  See the Lt opcode for additional information.
*/
/* Opcode: Gt P1 P2 P3 P4 P5
**
** This works just like the Lt opcode except that the jump is taken if
** the content of register P3 is greater than the content of
** register P1.  See the Lt opcode for additional information.
*/
/* Opcode: Ge P1 P2 P3 P4 P5
**
** This works just like the Lt opcode except that the jump is taken if
** the content of register P3 is greater than or equal to the content of
** register P1.  See the Lt opcode for additional information.
*/
case OP_Eq:               /* same as TK_EQ, jump, in1, in3 */
case OP_Ne:               /* same as TK_NE, jump, in1, in3 */
case OP_Lt:               /* same as TK_LT, jump, in1, in3 */
case OP_Le:               /* same as TK_LE, jump, in1, in3 */
case OP_Gt:               /* same as TK_GT, jump, in1, in3 */
case OP_Ge: {             /* same as TK_GE, jump, in1, in3 */
  int flags;
  int res;
  char affinity;

  flags = pIn1->flags|pIn3->flags;

  if( flags&MEM_Null ){
    /* If either operand is NULL then the result is always NULL.
    ** The jump is taken if the SQLITE_JUMPIFNULL bit is set.
    */
    if( pOp->p5 & SQLITE_STOREP2 ){
      pOut = &p->aMem[pOp->p2];
      MemSetTypeFlag(pOut, MEM_Null);
      REGISTER_TRACE(pOp->p2, pOut);
    }else if( pOp->p5 & SQLITE_JUMPIFNULL ){
      pc = pOp->p2-1;
    }
    break;
  }

  affinity = pOp->p5 & SQLITE_AFF_MASK;
  if( affinity ){
    applyAffinity(pIn1, affinity, encoding);
    applyAffinity(pIn3, affinity, encoding);
  }

  assert( pOp->p4type==P4_COLLSEQ || pOp->p4.pColl==0 );
  ExpandBlob(pIn1);
  ExpandBlob(pIn3);
  res = sqlite3MemCompare(pIn3, pIn1, pOp->p4.pColl);
  switch( pOp->opcode ){
    case OP_Eq:    res = res==0;     break;
    case OP_Ne:    res = res!=0;     break;
    case OP_Lt:    res = res<0;      break;
    case OP_Le:    res = res<=0;     break;
    case OP_Gt:    res = res>0;      break;
    default:       res = res>=0;     break;
  }

  if( pOp->p5 & SQLITE_STOREP2 ){
    pOut = &p->aMem[pOp->p2];
    MemSetTypeFlag(pOut, MEM_Int);
    pOut->u.i = res;
    REGISTER_TRACE(pOp->p2, pOut);
  }else if( res ){
    pc = pOp->p2-1;
  }
  break;
}

/* Opcode: Permutation * * * P4 *
**
** Set the permuation used by the OP_Compare operator to be the array
** of integers in P4.
**
** The permutation is only valid until the next OP_Permutation, OP_Compare,
** OP_Halt, or OP_ResultRow.  Typically the OP_Permutation should occur
** immediately prior to the OP_Compare.
*/
case OP_Permutation: {
  assert( pOp->p4type==P4_INTARRAY );
  assert( pOp->p4.ai );
  aPermute = pOp->p4.ai;
  break;
}

/* Opcode: Compare P1 P2 P3 P4 *
**
** Compare to vectors of registers in reg(P1)..reg(P1+P3-1) (all this
** one "A") and in reg(P2)..reg(P2+P3-1) ("B").  Save the result of
** the comparison for use by the next OP_Jump instruct.
**
** P4 is a KeyInfo structure that defines collating sequences and sort
** orders for the comparison.  The permutation applies to registers
** only.  The KeyInfo elements are used sequentially.
**
** The comparison is a sort comparison, so NULLs compare equal,
** NULLs are less than numbers, numbers are less than strings,
** and strings are less than blobs.
*/
case OP_Compare: {
  int n = pOp->p3;
  int i, p1, p2;
  const KeyInfo *pKeyInfo = pOp->p4.pKeyInfo;
  assert( n>0 );
  assert( pKeyInfo!=0 );
  p1 = pOp->p1;
  assert( p1>0 && p1+n-1<p->nMem );
  p2 = pOp->p2;
  assert( p2>0 && p2+n-1<p->nMem );
  for(i=0; i<n; i++){
    int idx = aPermute ? aPermute[i] : i;
    CollSeq *pColl;    /* Collating sequence to use on this term */
    int bRev;          /* True for DESCENDING sort order */
    REGISTER_TRACE(p1+idx, &p->aMem[p1+idx]);
    REGISTER_TRACE(p2+idx, &p->aMem[p2+idx]);
    assert( i<pKeyInfo->nField );
    pColl = pKeyInfo->aColl[i];
    bRev = pKeyInfo->aSortOrder[i];
    iCompare = sqlite3MemCompare(&p->aMem[p1+idx], &p->aMem[p2+idx], pColl);
    if( iCompare ){
      if( bRev ) iCompare = -iCompare;
      break;
    }
  }
  aPermute = 0;
  break;
}

/* Opcode: Jump P1 P2 P3 * *
**
** Jump to the instruction at address P1, P2, or P3 depending on whether
** in the most recent OP_Compare instruction the P1 vector was less than
** equal to, or greater than the P2 vector, respectively.
*/
case OP_Jump: {             /* jump */
  if( iCompare<0 ){
    pc = pOp->p1 - 1;
  }else if( iCompare==0 ){
    pc = pOp->p2 - 1;
  }else{
    pc = pOp->p3 - 1;
  }
  break;
}

/* Opcode: And P1 P2 P3 * *
**
** Take the logical AND of the values in registers P1 and P2 and
** write the result into register P3.
**
** If either P1 or P2 is 0 (false) then the result is 0 even if
** the other input is NULL.  A NULL and true or two NULLs give
** a NULL output.
*/
/* Opcode: Or P1 P2 P3 * *
**
** Take the logical OR of the values in register P1 and P2 and
** store the answer in register P3.
**
** If either P1 or P2 is nonzero (true) then the result is 1 (true)
** even if the other input is NULL.  A NULL and false or two NULLs
** give a NULL output.
*/
case OP_And:              /* same as TK_AND, in1, in2, out3 */
case OP_Or: {             /* same as TK_OR, in1, in2, out3 */
  int v1, v2;    /* 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */

  if( pIn1->flags & MEM_Null ){
    v1 = 2;
  }else{
    v1 = sqlite3VdbeIntValue(pIn1)!=0;
  }
  if( pIn2->flags & MEM_Null ){
    v2 = 2;
  }else{
    v2 = sqlite3VdbeIntValue(pIn2)!=0;
  }
  if( pOp->opcode==OP_And ){
    static const unsigned char and_logic[] = { 0, 0, 0, 0, 1, 2, 0, 2, 2 };
    v1 = and_logic[v1*3+v2];
  }else{
    static const unsigned char or_logic[] = { 0, 1, 2, 1, 1, 1, 2, 1, 2 };
    v1 = or_logic[v1*3+v2];
  }
  if( v1==2 ){
    MemSetTypeFlag(pOut, MEM_Null);
  }else{
    pOut->u.i = v1;
    MemSetTypeFlag(pOut, MEM_Int);
  }
  break;
}

/* Opcode: Not P1 * * * *
**
** Interpret the value in register P1 as a boolean value.  Replace it
** with its complement.  If the value in register P1 is NULL its value
** is unchanged.
*/
case OP_Not: {                /* same as TK_NOT, in1 */
  if( pIn1->flags & MEM_Null ) break;  /* Do nothing to NULLs */
  sqlite3VdbeMemIntegerify(pIn1);
  pIn1->u.i = !pIn1->u.i;
  assert( pIn1->flags&MEM_Int );
  break;
}

/* Opcode: BitNot P1 * * * *
**
** Interpret the content of register P1 as an integer.  Replace it
** with its ones-complement.  If the value is originally NULL, leave
** it unchanged.
*/
case OP_BitNot: {             /* same as TK_BITNOT, in1 */
  if( pIn1->flags & MEM_Null ) break;  /* Do nothing to NULLs */
  sqlite3VdbeMemIntegerify(pIn1);
  pIn1->u.i = ~pIn1->u.i;
  assert( pIn1->flags&MEM_Int );
  break;
}

/* Opcode: If P1 P2 P3 * *
**
** Jump to P2 if the value in register P1 is true.  The value is
** is considered true if it is numeric and non-zero.  If the value
** in P1 is NULL then take the jump if P3 is true.
*/
/* Opcode: IfNot P1 P2 P3 * *
**
** Jump to P2 if the value in register P1 is False.  The value is
** is considered true if it has a numeric value of zero.  If the value
** in P1 is NULL then take the jump if P3 is true.
*/
case OP_If:                 /* jump, in1 */
case OP_IfNot: {            /* jump, in1 */
  int c;
  if( pIn1->flags & MEM_Null ){
    c = pOp->p3;
  }else{
#ifdef SQLITE_OMIT_FLOATING_POINT
    c = sqlite3VdbeIntValue(pIn1);
#else
    c = sqlite3VdbeRealValue(pIn1)!=0.0;
#endif
    if( pOp->opcode==OP_IfNot ) c = !c;
  }
  if( c ){
    pc = pOp->p2-1;
  }
  break;
}

/* Opcode: IsNull P1 P2 P3 * *
**
** Jump to P2 if the value in register P1 is NULL.  If P3 is greater
** than zero, then check all values reg(P1), reg(P1+1), 
** reg(P1+2), ..., reg(P1+P3-1).
*/
case OP_IsNull: {            /* same as TK_ISNULL, jump, in1 */
  int n = pOp->p3;
  assert( pOp->p3==0 || pOp->p1>0 );
  do{
    if( (pIn1->flags & MEM_Null)!=0 ){
      pc = pOp->p2 - 1;
      break;
    }
    pIn1++;
  }while( --n > 0 );
  break;
}

/* Opcode: NotNull P1 P2 * * *
**
** Jump to P2 if the value in register P1 is not NULL.  
*/
case OP_NotNull: {            /* same as TK_NOTNULL, jump, in1 */
  if( (pIn1->flags & MEM_Null)==0 ){
    pc = pOp->p2 - 1;
  }
  break;
}

/* Opcode: SetNumColumns * P2 * * *
**
** This opcode sets the number of columns for the cursor opened by the
** following instruction to P2.
**
** An OP_SetNumColumns is only useful if it occurs immediately before 
** one of the following opcodes:
**
**     OpenRead
**     OpenWrite
**     OpenPseudo
**
** If the OP_Column opcode is to be executed on a cursor, then
** this opcode must be present immediately before the opcode that
** opens the cursor.
*/
case OP_SetNumColumns: {
  break;
}

/* Opcode: Column P1 P2 P3 P4 *
**
** Interpret the data that cursor P1 points to as a structure built using
** the MakeRecord instruction.  (See the MakeRecord opcode for additional
** information about the format of the data.)  Extract the P2-th column
** from this record.  If there are less that (P2+1) 
** values in the record, extract a NULL.
**
** The value extracted is stored in register P3.
**
** If the KeyAsData opcode has previously executed on this cursor, then the
** field might be extracted from the key rather than the data.
**
** If the column contains fewer than P2 fields, then extract a NULL.  Or,
** if the P4 argument is a P4_MEM use the value of the P4 argument as
** the result.
*/
case OP_Column: {
  u32 payloadSize;   /* Number of bytes in the record */
  int p1 = pOp->p1;  /* P1 value of the opcode */
  int p2 = pOp->p2;  /* column number to retrieve */
  Cursor *pC = 0;    /* The VDBE cursor */
  char *zRec;        /* Pointer to complete record-data */
  BtCursor *pCrsr;   /* The BTree cursor */
  u32 *aType;        /* aType[i] holds the numeric type of the i-th column */
  u32 *aOffset;      /* aOffset[i] is offset to start of data for i-th column */
  u32 nField;        /* number of fields in the record */
  int len;           /* The length of the serialized data for the column */
  int i;             /* Loop counter */
  char *zData;       /* Part of the record being decoded */
  Mem *pDest;        /* Where to write the extracted value */
  Mem sMem;          /* For storing the record being decoded */

  sMem.flags = 0;
  sMem.db = 0;
  sMem.zMalloc = 0;
  assert( p1<p->nCursor );
  assert( pOp->p3>0 && pOp->p3<=p->nMem );
  pDest = &p->aMem[pOp->p3];
  MemSetTypeFlag(pDest, MEM_Null);

  /* This block sets the variable payloadSize to be the total number of
  ** bytes in the record.
  **
  ** zRec is set to be the complete text of the record if it is available.
  ** The complete record text is always available for pseudo-tables
  ** If the record is stored in a cursor, the complete record text
  ** might be available in the  pC->aRow cache.  Or it might not be.
  ** If the data is unavailable,  zRec is set to NULL.
  **
  ** We also compute the number of columns in the record.  For cursors,
  ** the number of columns is stored in the Cursor.nField element.
  */
  pC = p->apCsr[p1];
  assert( pC!=0 );
#ifndef SQLITE_OMIT_VIRTUALTABLE
  assert( pC->pVtabCursor==0 );
#endif
  if( pC->pCursor!=0 ){
    /* The record is stored in a B-Tree */
    rc = sqlite3VdbeCursorMoveto(pC);
    if( rc ) goto abort_due_to_error;
    zRec = 0;
    pCrsr = pC->pCursor;
    if( pC->nullRow ){
      payloadSize = 0;
    }else if( pC->cacheStatus==p->cacheCtr ){
      payloadSize = pC->payloadSize;
      zRec = (char*)pC->aRow;
    }else if( pC->isIndex ){
      i64 payloadSize64;
      sqlite3BtreeKeySize(pCrsr, &payloadSize64);
      payloadSize = payloadSize64;
    }else{
      sqlite3BtreeDataSize(pCrsr, &payloadSize);
    }
    nField = pC->nField;
  }else{
    assert( pC->pseudoTable );
    /* The record is the sole entry of a pseudo-table */
    payloadSize = pC->nData;
    zRec = pC->pData;
    pC->cacheStatus = CACHE_STALE;
    assert( payloadSize==0 || zRec!=0 );
    nField = pC->nField;
    pCrsr = 0;
  }

  /* If payloadSize is 0, then just store a NULL */
  if( payloadSize==0 ){
    assert( pDest->flags&MEM_Null );
    goto op_column_out;
  }
  if( payloadSize>db->aLimit[SQLITE_LIMIT_LENGTH] ){
    goto too_big;
  }

  assert( p2<nField );

  /* Read and parse the table header.  Store the results of the parse
  ** into the record header cache fields of the cursor.
  */
  aType = pC->aType;
  if( pC->cacheStatus==p->cacheCtr ){
    aOffset = pC->aOffset;
  }else{
    u8 *zIdx;        /* Index into header */
    u8 *zEndHdr;     /* Pointer to first byte after the header */
    u32 offset;      /* Offset into the data */
    int szHdrSz;     /* Size of the header size field at start of record */
    int avail;       /* Number of bytes of available data */

    assert(aType);
    pC->aOffset = aOffset = &aType[nField];
    pC->payloadSize = payloadSize;
    pC->cacheStatus = p->cacheCtr;

    /* Figure out how many bytes are in the header */
    if( zRec ){
      zData = zRec;
    }else{
      if( pC->isIndex ){
        zData = (char*)sqlite3BtreeKeyFetch(pCrsr, &avail);
      }else{
        zData = (char*)sqlite3BtreeDataFetch(pCrsr, &avail);
      }
      /* If KeyFetch()/DataFetch() managed to get the entire payload,
      ** save the payload in the pC->aRow cache.  That will save us from
      ** having to make additional calls to fetch the content portion of
      ** the record.
      */
      if( avail>=payloadSize ){
        zRec = zData;
        pC->aRow = (u8*)zData;
      }else{
        pC->aRow = 0;
      }
    }
    /* The following assert is true in all cases accept when
    ** the database file has been corrupted externally.
    **    assert( zRec!=0 || avail>=payloadSize || avail>=9 ); */
    szHdrSz = getVarint32((u8*)zData, offset);

    /* The KeyFetch() or DataFetch() above are fast and will get the entire
    ** record header in most cases.  But they will fail to get the complete
    ** record header if the record header does not fit on a single page
    ** in the B-Tree.  When that happens, use sqlite3VdbeMemFromBtree() to
    ** acquire the complete header text.
    */
    if( !zRec && avail<offset ){
      sMem.flags = 0;
      sMem.db = 0;
      rc = sqlite3VdbeMemFromBtree(pCrsr, 0, offset, pC->isIndex, &sMem);
      if( rc!=SQLITE_OK ){
        goto op_column_out;
      }
      zData = sMem.z;
    }
    zEndHdr = (u8 *)&zData[offset];
    zIdx = (u8 *)&zData[szHdrSz];

    /* Scan the header and use it to fill in the aType[] and aOffset[]
    ** arrays.  aType[i] will contain the type integer for the i-th
    ** column and aOffset[i] will contain the offset from the beginning
    ** of the record to the start of the data for the i-th column
    */
    for(i=0; i<nField; i++){
      if( zIdx<zEndHdr ){
        aOffset[i] = offset;
        zIdx += getVarint32(zIdx, aType[i]);
        offset += sqlite3VdbeSerialTypeLen(aType[i]);
      }else{
        /* If i is less that nField, then there are less fields in this
        ** record than SetNumColumns indicated there are columns in the
        ** table. Set the offset for any extra columns not present in
        ** the record to 0. This tells code below to store a NULL
        ** instead of deserializing a value from the record.
        */
        aOffset[i] = 0;
      }
    }
    sqlite3VdbeMemRelease(&sMem);
    sMem.flags = MEM_Null;

    /* If we have read more header data than was contained in the header,
    ** or if the end of the last field appears to be past the end of the
    ** record, or if the end of the last field appears to be before the end
    ** of the record (when all fields present), then we must be dealing 
    ** with a corrupt database.
    */
    if( zIdx>zEndHdr || offset>payloadSize || (zIdx==zEndHdr && offset!=payloadSize) ){
      rc = SQLITE_CORRUPT_BKPT;
      goto op_column_out;
    }
  }

  /* Get the column information. If aOffset[p2] is non-zero, then 
  ** deserialize the value from the record. If aOffset[p2] is zero,
  ** then there are not enough fields in the record to satisfy the
  ** request.  In this case, set the value NULL or to P4 if P4 is
  ** a pointer to a Mem object.
  */
  if( aOffset[p2] ){
    assert( rc==SQLITE_OK );
    if( zRec ){
      sqlite3VdbeMemReleaseExternal(pDest);
      sqlite3VdbeSerialGet((u8 *)&zRec[aOffset[p2]], aType[p2], pDest);
    }else{
      len = sqlite3VdbeSerialTypeLen(aType[p2]);
      sqlite3VdbeMemMove(&sMem, pDest);
      rc = sqlite3VdbeMemFromBtree(pCrsr, aOffset[p2], len, pC->isIndex, &sMem);
      if( rc!=SQLITE_OK ){
        goto op_column_out;
      }
      zData = sMem.z;
      sqlite3VdbeSerialGet((u8*)zData, aType[p2], pDest);
    }
    pDest->enc = encoding;
  }else{
    if( pOp->p4type==P4_MEM ){
      sqlite3VdbeMemShallowCopy(pDest, pOp->p4.pMem, MEM_Static);
    }else{
      assert( pDest->flags&MEM_Null );
    }
  }

  /* If we dynamically allocated space to hold the data (in the
  ** sqlite3VdbeMemFromBtree() call above) then transfer control of that
  ** dynamically allocated space over to the pDest structure.
  ** This prevents a memory copy.
  */
  if( sMem.zMalloc ){
    assert( sMem.z==sMem.zMalloc );
    assert( !(pDest->flags & MEM_Dyn) );
    assert( !(pDest->flags & (MEM_Blob|MEM_Str)) || pDest->z==sMem.z );
    pDest->flags &= ~(MEM_Ephem|MEM_Static);
    pDest->flags |= MEM_Term;
    pDest->z = sMem.z;
    pDest->zMalloc = sMem.zMalloc;
  }

  rc = sqlite3VdbeMemMakeWriteable(pDest);

op_column_out:
  UPDATE_MAX_BLOBSIZE(pDest);
  REGISTER_TRACE(pOp->p3, pDest);
  break;
}

/* Opcode: Affinity P1 P2 * P4 *
**
** Apply affinities to a range of P2 registers starting with P1.
**
** P4 is a string that is P2 characters long. The nth character of the
** string indicates the column affinity that should be used for the nth
** memory cell in the range.
*/
case OP_Affinity: {
  char *zAffinity = pOp->p4.z;
  Mem *pData0 = &p->aMem[pOp->p1];
  Mem *pLast = &pData0[pOp->p2-1];
  Mem *pRec;

  for(pRec=pData0; pRec<=pLast; pRec++){
    ExpandBlob(pRec);
    applyAffinity(pRec, zAffinity[pRec-pData0], encoding);
  }
  break;
}

/* Opcode: MakeRecord P1 P2 P3 P4 *
**
** Convert P2 registers beginning with P1 into a single entry
** suitable for use as a data record in a database table or as a key
** in an index.  The details of the format are irrelevant as long as
** the OP_Column opcode can decode the record later.
** Refer to source code comments for the details of the record
** format.
**
** P4 may be a string that is P2 characters long.  The nth character of the
** string indicates the column affinity that should be used for the nth
** field of the index key.
**
** The mapping from character to affinity is given by the SQLITE_AFF_
** macros defined in sqliteInt.h.
**
** If P4 is NULL then all index fields have the affinity NONE.
*/
case OP_MakeRecord: {
  /* Assuming the record contains N fields, the record format looks
  ** like this:
  **
  ** ------------------------------------------------------------------------
  ** | hdr-size | type 0 | type 1 | ... | type N-1 | data0 | ... | data N-1 | 
  ** ------------------------------------------------------------------------
  **
  ** Data(0) is taken from register P1.  Data(1) comes from register P1+1
  ** and so froth.
  **
  ** Each type field is a varint representing the serial type of the 
  ** corresponding data element (see sqlite3VdbeSerialType()). The
  ** hdr-size field is also a varint which is the offset from the beginning
  ** of the record to data0.
  */
  u8 *zNewRecord;        /* A buffer to hold the data for the new record */
  Mem *pRec;             /* The new record */
  u64 nData = 0;         /* Number of bytes of data space */
  int nHdr = 0;          /* Number of bytes of header space */
  u64 nByte = 0;         /* Data space required for this record */
  int nZero = 0;         /* Number of zero bytes at the end of the record */
  int nVarint;           /* Number of bytes in a varint */
  u32 serial_type;       /* Type field */
  Mem *pData0;           /* First field to be combined into the record */
  Mem *pLast;            /* Last field of the record */
  int nField;            /* Number of fields in the record */
  char *zAffinity;       /* The affinity string for the record */
  int file_format;       /* File format to use for encoding */
  int i;                 /* Space used in zNewRecord[] */

  nField = pOp->p1;
  zAffinity = pOp->p4.z;
  assert( nField>0 && pOp->p2>0 && pOp->p2+nField<=p->nMem );
  pData0 = &p->aMem[nField];
  nField = pOp->p2;
  pLast = &pData0[nField-1];
  file_format = p->minWriteFileFormat;

  /* Loop through the elements that will make up the record to figure
  ** out how much space is required for the new record.
  */
  for(pRec=pData0; pRec<=pLast; pRec++){
    int len;
    if( zAffinity ){
      applyAffinity(pRec, zAffinity[pRec-pData0], encoding);
    }
    if( pRec->flags&MEM_Zero && pRec->n>0 ){
      sqlite3VdbeMemExpandBlob(pRec);
    }
    serial_type = sqlite3VdbeSerialType(pRec, file_format);
    len = sqlite3VdbeSerialTypeLen(serial_type);
    nData += len;
    nHdr += sqlite3VarintLen(serial_type);
    if( pRec->flags & MEM_Zero ){
      /* Only pure zero-filled BLOBs can be input to this Opcode.
      ** We do not allow blobs with a prefix and a zero-filled tail. */
      nZero += pRec->u.i;
    }else if( len ){
      nZero = 0;
    }
  }

  /* Add the initial header varint and total the size */
  nHdr += nVarint = sqlite3VarintLen(nHdr);
  if( nVarint<sqlite3VarintLen(nHdr) ){
    nHdr++;
  }
  nByte = nHdr+nData-nZero;
  if( nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){
    goto too_big;
  }

  /* Make sure the output register has a buffer large enough to store 
  ** the new record. The output register (pOp->p3) is not allowed to
  ** be one of the input registers (because the following call to
  ** sqlite3VdbeMemGrow() could clobber the value before it is used).
  */
  assert( pOp->p3<pOp->p1 || pOp->p3>=pOp->p1+pOp->p2 );
  pOut = &p->aMem[pOp->p3];
  if( sqlite3VdbeMemGrow(pOut, nByte, 0) ){
    goto no_mem;
  }
  zNewRecord = (u8 *)pOut->z;

  /* Write the record */
  i = putVarint32(zNewRecord, nHdr);
  for(pRec=pData0; pRec<=pLast; pRec++){
    serial_type = sqlite3VdbeSerialType(pRec, file_format);
    i += putVarint32(&zNewRecord[i], serial_type);      /* serial type */
  }
  for(pRec=pData0; pRec<=pLast; pRec++){  /* serial data */
    i += sqlite3VdbeSerialPut(&zNewRecord[i], nByte-i, pRec, file_format);
  }
  assert( i==nByte );

  assert( pOp->p3>0 && pOp->p3<=p->nMem );
  pOut->n = nByte;
  pOut->flags = MEM_Blob | MEM_Dyn;
  pOut->xDel = 0;
  if( nZero ){
    pOut->u.i = nZero;
    pOut->flags |= MEM_Zero;
  }
  pOut->enc = SQLITE_UTF8;  /* In case the blob is ever converted to text */
  REGISTER_TRACE(pOp->p3, pOut);
  UPDATE_MAX_BLOBSIZE(pOut);
  break;
}

/* Opcode: Statement P1 * * * *
**
** Begin an individual statement transaction which is part of a larger
** transaction.  This is needed so that the statement
** can be rolled back after an error without having to roll back the
** entire transaction.  The statement transaction will automatically
** commit when the VDBE halts.
**
** If the database connection is currently in autocommit mode (that 
** is to say, if it is in between BEGIN and COMMIT)
** and if there are no other active statements on the same database
** connection, then this operation is a no-op.  No statement transaction
** is needed since any error can use the normal ROLLBACK process to
** undo changes.
**
** If a statement transaction is started, then a statement journal file
** will be allocated and initialized.
**
** The statement is begun on the database file with index P1.  The main
** database file has an index of 0 and the file used for temporary tables
** has an index of 1.
*/
case OP_Statement: {
  if( db->autoCommit==0 || db->activeVdbeCnt>1 ){
    int i = pOp->p1;
    Btree *pBt;
    assert( i>=0 && i<db->nDb );
    assert( db->aDb[i].pBt!=0 );
    pBt = db->aDb[i].pBt;
    assert( sqlite3BtreeIsInTrans(pBt) );
    assert( (p->btreeMask & (1<<i))!=0 );
    if( !sqlite3BtreeIsInStmt(pBt) ){
      rc = sqlite3BtreeBeginStmt(pBt);
      p->openedStatement = 1;
    }
  }
  break;
}

/* Opcode: AutoCommit P1 P2 * * *
**
** Set the database auto-commit flag to P1 (1 or 0). If P2 is true, roll
** back any currently active btree transactions. If there are any active
** VMs (apart from this one), then the COMMIT or ROLLBACK statement fails.
**
** This instruction causes the VM to halt.
*/
case OP_AutoCommit: {
  u8 i = pOp->p1;
  u8 rollback = pOp->p2;

  assert( i==1 || i==0 );
  assert( i==1 || rollback==0 );

  assert( db->activeVdbeCnt>0 );  /* At least this one VM is active */

  if( db->activeVdbeCnt>1 && i && !db->autoCommit ){
    /* If this instruction implements a COMMIT or ROLLBACK, other VMs are
    ** still running, and a transaction is active, return an error indicating
    ** that the other VMs must complete first. 
    */
    sqlite3SetString(&p->zErrMsg, db, "cannot %s transaction - "
        "SQL statements in progress",
        rollback ? "rollback" : "commit");
    rc = SQLITE_ERROR;
  }else if( i!=db->autoCommit ){
    if( pOp->p2 ){
      assert( i==1 );
      sqlite3RollbackAll(db);
      db->autoCommit = 1;
    }else{
      db->autoCommit = i;
      if( sqlite3VdbeHalt(p)==SQLITE_BUSY ){
        p->pc = pc;
        db->autoCommit = 1-i;
        p->rc = rc = SQLITE_BUSY;
        goto vdbe_return;
      }
    }
    if( p->rc==SQLITE_OK ){
      rc = SQLITE_DONE;
    }else{
      rc = SQLITE_ERROR;
    }
    goto vdbe_return;
  }else{
    sqlite3SetString(&p->zErrMsg, db,
        (!i)?"cannot start a transaction within a transaction":(
        (rollback)?"cannot rollback - no transaction is active":
                   "cannot commit - no transaction is active"));
         
    rc = SQLITE_ERROR;
  }
  break;
}

/* Opcode: Transaction P1 P2 * * *
**
** Begin a transaction.  The transaction ends when a Commit or Rollback
** opcode is encountered.  Depending on the ON CONFLICT setting, the
** transaction might also be rolled back if an error is encountered.
**
** P1 is the index of the database file on which the transaction is
** started.  Index 0 is the main database file and index 1 is the
** file used for temporary tables.  Indices of 2 or more are used for
** attached databases.
**
** If P2 is non-zero, then a write-transaction is started.  A RESERVED lock is
** obtained on the database file when a write-transaction is started.  No
** other process can start another write transaction while this transaction is
** underway.  Starting a write transaction also creates a rollback journal. A
** write transaction must be started before any changes can be made to the
** database.  If P2 is 2 or greater then an EXCLUSIVE lock is also obtained
** on the file.
**
** If P2 is zero, then a read-lock is obtained on the database file.
*/
case OP_Transaction: {
  int i = pOp->p1;
  Btree *pBt;

  assert( i>=0 && i<db->nDb );
  assert( (p->btreeMask & (1<<i))!=0 );
  pBt = db->aDb[i].pBt;

  if( pBt ){
    rc = sqlite3BtreeBeginTrans(pBt, pOp->p2);
    if( rc==SQLITE_BUSY ){
      p->pc = pc;
      p->rc = rc = SQLITE_BUSY;
      goto vdbe_return;
    }
    if( rc!=SQLITE_OK && rc!=SQLITE_READONLY /* && rc!=SQLITE_BUSY */ ){
      goto abort_due_to_error;
    }
  }
  break;
}

/* Opcode: ReadCookie P1 P2 P3 * *
**
** Read cookie number P3 from database P1 and write it into register P2.
** P3==0 is the schema version.  P3==1 is the database format.
** P3==2 is the recommended pager cache size, and so forth.  P1==0 is
** the main database file and P1==1 is the database file used to store
** temporary tables.
**
** If P1 is negative, then this is a request to read the size of a
** databases free-list. P3 must be set to 1 in this case. The actual
** database accessed is ((P1+1)*-1). For example, a P1 parameter of -1
** corresponds to database 0 ("main"), a P1 of -2 is database 1 ("temp").
**
** There must be a read-lock on the database (either a transaction
** must be started or there must be an open cursor) before
** executing this instruction.
*/
case OP_ReadCookie: {               /* out2-prerelease */
  int iMeta;
  int iDb = pOp->p1;
  int iCookie = pOp->p3;

  assert( pOp->p3<SQLITE_N_BTREE_META );
  if( iDb<0 ){
    iDb = (-1*(iDb+1));
    iCookie *= -1;
  }
  assert( iDb>=0 && iDb<db->nDb );
  assert( db->aDb[iDb].pBt!=0 );
  assert( (p->btreeMask & (1<<iDb))!=0 );
  /* The indexing of meta values at the schema layer is off by one from
  ** the indexing in the btree layer.  The btree considers meta[0] to
  ** be the number of free pages in the database (a read-only value)
  ** and meta[1] to be the schema cookie.  The schema layer considers
  ** meta[1] to be the schema cookie.  So we have to shift the index
  ** by one in the following statement.
  */
  rc = sqlite3BtreeGetMeta(db->aDb[iDb].pBt, 1 + iCookie, (u32 *)&iMeta);
  pOut->u.i = iMeta;
  MemSetTypeFlag(pOut, MEM_Int);
  break;
}

/* Opcode: SetCookie P1 P2 P3 * *
**
** Write the content of register P3 (interpreted as an integer)
** into cookie number P2 of database P1.
** P2==0 is the schema version.  P2==1 is the database format.
** P2==2 is the recommended pager cache size, and so forth.  P1==0 is
** the main database file and P1==1 is the database file used to store
** temporary tables.
**
** A transaction must be started before executing this opcode.
*/
case OP_SetCookie: {       /* in3 */
  Db *pDb;
  assert( pOp->p2<SQLITE_N_BTREE_META );
  assert( pOp->p1>=0 && pOp->p1<db->nDb );
  assert( (p->btreeMask & (1<<pOp->p1))!=0 );
  pDb = &db->aDb[pOp->p1];
  assert( pDb->pBt!=0 );
  sqlite3VdbeMemIntegerify(pIn3);
  /* See note about index shifting on OP_ReadCookie */
  rc = sqlite3BtreeUpdateMeta(pDb->pBt, 1+pOp->p2, (int)pIn3->u.i);
  if( pOp->p2==0 ){
    /* When the schema cookie changes, record the new cookie internally */
    pDb->pSchema->schema_cookie = pIn3->u.i;
    db->flags |= SQLITE_InternChanges;
  }else if( pOp->p2==1 ){
    /* Record changes in the file format */
    pDb->pSchema->file_format = 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
** schema version) and make sure it is equal to P2.  
** P1 is the database number which is 0 for the main database file
** and 1 for the file holding temporary tables and some higher number
** for auxiliary databases.
**
** The cookie changes its value whenever the database schema changes.
** This operation is used to detect when that the cookie has changed
** and that the current process needs to reread the schema.
**
** Either a transaction needs to have been started or an OP_Open needs
** to be executed (to establish a read lock) before this opcode is
** invoked.
*/
case OP_VerifyCookie: {
  int iMeta;
  Btree *pBt;
  assert( pOp->p1>=0 && pOp->p1<db->nDb );
  assert( (p->btreeMask & (1<<pOp->p1))!=0 );
  pBt = db->aDb[pOp->p1].pBt;
  if( pBt ){
    rc = sqlite3BtreeGetMeta(pBt, 1, (u32 *)&iMeta);
  }else{
    rc = SQLITE_OK;
    iMeta = 0;
  }
  if( rc==SQLITE_OK && iMeta!=pOp->p2 ){
    sqlite3DbFree(db, p->zErrMsg);
    p->zErrMsg = sqlite3DbStrDup(db, "database schema has changed");
    /* If the schema-cookie from the database file matches the cookie 
    ** stored with the in-memory representation of the schema, do
    ** not reload the schema from the database file.
    **
    ** If virtual-tables are in use, this is not just an optimization.
    ** Often, v-tables store their data in other SQLite tables, which
    ** are queried from within xNext() and other v-table methods using
    ** prepared queries. If such a query is out-of-date, we do not want to
    ** discard the database schema, as the user code implementing the
    ** v-table would have to be ready for the sqlite3_vtab structure itself
    ** to be invalidated whenever sqlite3_step() is called from within 
    ** a v-table method.
    */
    if( db->aDb[pOp->p1].pSchema->schema_cookie!=iMeta ){
      sqlite3ResetInternalSchema(db, pOp->p1);
    }

    sqlite3ExpirePreparedStatements(db);
    rc = SQLITE_SCHEMA;
  }
  break;
}

/* Opcode: OpenRead P1 P2 P3 P4 P5
**
** Open a read-only cursor for the database table whose root page is
** P2 in a database file.  The database file is determined by P3. 
** P3==0 means the main database, P3==1 means the database used for 
** temporary tables, and P3>1 means used the corresponding attached
** database.  Give the new cursor an identifier of P1.  The P1
** values need not be contiguous but all P1 values should be small integers.
** It is an error for P1 to be negative.
**
** If P5!=0 then use the content of register P2 as the root page, not
** the value of P2 itself.
**
** There will be a read lock on the database whenever there is an
** open cursor.  If the database was unlocked prior to this instruction
** then a read lock is acquired as part of this instruction.  A read
** lock allows other processes to read the database but prohibits
** any other process from modifying the database.  The read lock is
** released when all cursors are closed.  If this instruction attempts
** to get a read lock but fails, the script terminates with an
** SQLITE_BUSY error code.
**
** The P4 value is a pointer to a KeyInfo structure that defines the
** content and collating sequence of indices.  P4 is NULL for cursors
** that are not pointing to indices.
**
** See also OpenWrite.
*/
/* Opcode: OpenWrite P1 P2 P3 P4 P5
**
** Open a read/write cursor named P1 on the table or index whose root
** page is P2.  Or if P5!=0 use the content of register P2 to find the
** root page.
**
** The P4 value is a pointer to a KeyInfo structure that defines the
** content and collating sequence of indices.  P4 is NULL for cursors
** that are not pointing to indices.
**
** This instruction works just like OpenRead except that it opens the cursor
** in read/write mode.  For a given table, there can be one or more read-only
** cursors or a single read/write cursor but not both.
**
** See also OpenRead.
*/
case OP_OpenRead:
case OP_OpenWrite: {
  int i = pOp->p1;
  int p2 = pOp->p2;
  int iDb = pOp->p3;
  int wrFlag;
  Btree *pX;
  Cursor *pCur;
  Db *pDb;
  
  assert( iDb>=0 && iDb<db->nDb );
  assert( (p->btreeMask & (1<<iDb))!=0 );
  pDb = &db->aDb[iDb];
  pX = pDb->pBt;
  assert( pX!=0 );
  if( pOp->opcode==OP_OpenWrite ){
    wrFlag = 1;
    if( pDb->pSchema->file_format < p->minWriteFileFormat ){
      p->minWriteFileFormat = pDb->pSchema->file_format;
    }
  }else{
    wrFlag = 0;
  }
  if( pOp->p5 ){
    assert( p2>0 );
    assert( p2<=p->nMem );
    pIn2 = &p->aMem[p2];
    sqlite3VdbeMemIntegerify(pIn2);
    p2 = pIn2->u.i;
    assert( p2>=2 );
  }
  assert( i>=0 );
  pCur = allocateCursor(p, i, &pOp[-1], iDb, 1);
  if( pCur==0 ) goto no_mem;
  pCur->nullRow = 1;
  rc = sqlite3BtreeCursor(pX, p2, wrFlag, pOp->p4.p, pCur->pCursor);
  if( pOp->p4type==P4_KEYINFO ){
    pCur->pKeyInfo = pOp->p4.pKeyInfo;
    pCur->pIncrKey = &pCur->pKeyInfo->incrKey;
    pCur->pKeyInfo->enc = ENC(p->db);
  }else{
    pCur->pKeyInfo = 0;
    pCur->pIncrKey = &pCur->bogusIncrKey;
  }
  switch( rc ){
    case SQLITE_BUSY: {
      p->pc = pc;
      p->rc = rc = SQLITE_BUSY;
      goto vdbe_return;
    }
    case SQLITE_OK: {
      int flags = sqlite3BtreeFlags(pCur->pCursor);
      /* Sanity checking.  Only the lower four bits of the flags byte should
      ** be used.  Bit 3 (mask 0x08) is unpredictable.  The lower 3 bits
      ** (mask 0x07) should be either 5 (intkey+leafdata for tables) or
      ** 2 (zerodata for indices).  If these conditions are not met it can
      ** only mean that we are dealing with a corrupt database file
      */
      if( (flags & 0xf0)!=0 || ((flags & 0x07)!=5 && (flags & 0x07)!=2) ){
        rc = SQLITE_CORRUPT_BKPT;
        goto abort_due_to_error;
      }
      pCur->isTable = (flags & BTREE_INTKEY)!=0;
      pCur->isIndex = (flags & BTREE_ZERODATA)!=0;
      /* If P4==0 it means we are expected to open a table.  If P4!=0 then
      ** we expect to be opening an index.  If this is not what happened,
      ** then the database is corrupt
      */
      if( (pCur->isTable && pOp->p4type==P4_KEYINFO)
       || (pCur->isIndex && pOp->p4type!=P4_KEYINFO) ){
        rc = SQLITE_CORRUPT_BKPT;
        goto abort_due_to_error;
      }
      break;
    }
    case SQLITE_EMPTY: {
      pCur->isTable = pOp->p4type!=P4_KEYINFO;
      pCur->isIndex = !pCur->isTable;
      pCur->pCursor = 0;
      rc = SQLITE_OK;
      break;
    }
    default: {
      goto abort_due_to_error;
    }
  }
  break;
}

/* Opcode: OpenEphemeral P1 P2 * P4 *
**
** Open a new cursor P1 to a transient table.
** The cursor is always opened read/write even if 
** the main database is read-only.  The transient or virtual
** table is deleted automatically when the cursor is closed.
**
** P2 is the number of columns in the virtual table.
** The cursor points to a BTree table if P4==0 and to a BTree index
** if P4 is not 0.  If P4 is not NULL, it points to a KeyInfo structure
** that defines the format of keys in the index.
**
** This opcode was once called OpenTemp.  But that created
** confusion because the term "temp table", might refer either
** to a TEMP table at the SQL level, or to a table opened by
** this opcode.  Then this opcode was call OpenVirtual.  But
** that created confusion with the whole virtual-table idea.
*/
case OP_OpenEphemeral: {
  int i = pOp->p1;
  Cursor *pCx;
  static const int openFlags = 
      SQLITE_OPEN_READWRITE |
      SQLITE_OPEN_CREATE |
      SQLITE_OPEN_EXCLUSIVE |
      SQLITE_OPEN_DELETEONCLOSE |
      SQLITE_OPEN_TRANSIENT_DB;

  assert( i>=0 );
  pCx = allocateCursor(p, i, pOp, -1, 1);
  if( pCx==0 ) goto no_mem;
  pCx->nullRow = 1;
  rc = sqlite3BtreeFactory(db, 0, 1, SQLITE_DEFAULT_TEMP_CACHE_SIZE, openFlags,
                           &pCx->pBt);
  if( rc==SQLITE_OK ){
    rc = sqlite3BtreeBeginTrans(pCx->pBt, 1);
  }
  if( rc==SQLITE_OK ){
    /* If a transient index is required, create it by calling
    ** sqlite3BtreeCreateTable() with the BTREE_ZERODATA flag before
    ** opening it. If a transient table is required, just use the
    ** automatically created table with root-page 1 (an INTKEY table).
    */
    if( pOp->p4.pKeyInfo ){
      int pgno;
      assert( pOp->p4type==P4_KEYINFO );
      rc = sqlite3BtreeCreateTable(pCx->pBt, &pgno, BTREE_ZERODATA); 
      if( rc==SQLITE_OK ){
        assert( pgno==MASTER_ROOT+1 );
        rc = sqlite3BtreeCursor(pCx->pBt, pgno, 1, 
                                (KeyInfo*)pOp->p4.z, pCx->pCursor);
        pCx->pKeyInfo = pOp->p4.pKeyInfo;
        pCx->pKeyInfo->enc = ENC(p->db);
        pCx->pIncrKey = &pCx->pKeyInfo->incrKey;
      }
      pCx->isTable = 0;
    }else{
      rc = sqlite3BtreeCursor(pCx->pBt, MASTER_ROOT, 1, 0, pCx->pCursor);
      pCx->isTable = 1;
      pCx->pIncrKey = &pCx->bogusIncrKey;
    }
  }
  pCx->isIndex = !pCx->isTable;
  break;
}

/* Opcode: OpenPseudo P1 P2 * * *
**
** Open a new cursor that points to a fake table that contains a single
** row of data.  Any attempt to write a second row of data causes the
** first row to be deleted.  All data is deleted when the cursor is
** closed.
**
** A pseudo-table created by this opcode is useful for holding the
** NEW or OLD tables in a trigger.  Also used to hold the a single
** row output from the sorter so that the row can be decomposed into
** individual columns using the OP_Column opcode.
**
** When OP_Insert is executed to insert a row in to the pseudo table,
** the pseudo-table cursor may or may not make it's own copy of the
** original row data. If P2 is 0, then the pseudo-table will copy the
** original row data. Otherwise, a pointer to the original memory cell
** is stored. In this case, the vdbe program must ensure that the 
** memory cell containing the row data is not overwritten until the
** pseudo table is closed (or a new row is inserted into it).
*/
case OP_OpenPseudo: {
  int i = pOp->p1;
  Cursor *pCx;
  assert( i>=0 );
  pCx = allocateCursor(p, i, &pOp[-1], -1, 0);
  if( pCx==0 ) goto no_mem;
  pCx->nullRow = 1;
  pCx->pseudoTable = 1;
  pCx->ephemPseudoTable = pOp->p2;
  pCx->pIncrKey = &pCx->bogusIncrKey;
  pCx->isTable = 1;
  pCx->isIndex = 0;
  break;
}

/* Opcode: Close P1 * * * *
**
** Close a cursor previously opened as P1.  If P1 is not
** currently open, this instruction is a no-op.
*/
case OP_Close: {
  int i = pOp->p1;
  assert( i>=0 && i<p->nCursor );
  sqlite3VdbeFreeCursor(p, p->apCsr[i]);
  p->apCsr[i] = 0;
  break;
}

/* Opcode: MoveGe P1 P2 P3 P4 *
**
** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), 
** use the integer value in register P3 as a key. If cursor P1 refers 
** to an SQL index, then P3 is the first in an array of P4 registers 
** that are used as an unpacked index key. 
**
** Reposition cursor P1 so that  it points to the smallest entry that 
** is greater than or equal to the key value. If there are no records 
** greater than or equal to the key and P2 is not zero, then jump to P2.
**
** A special feature of this opcode (and different from the
** related OP_MoveGt, OP_MoveLt, and OP_MoveLe) is that if P2 is
** zero and P1 is an SQL table (a b-tree with integer keys) then
** the seek is deferred until it is actually needed.  It might be
** the case that the cursor is never accessed.  By deferring the
** seek, we avoid unnecessary seeks.
**
** See also: Found, NotFound, Distinct, MoveLt, MoveGt, MoveLe
*/
/* Opcode: MoveGt P1 P2 P3 P4 *
**
** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), 
** use the integer value in register P3 as a key. If cursor P1 refers 
** to an SQL index, then P3 is the first in an array of P4 registers 
** that are used as an unpacked index key. 
**
** Reposition cursor P1 so that  it points to the smallest entry that 
** is greater than the key value. If there are no records greater than 
** the key and P2 is not zero, then jump to P2.
**
** See also: Found, NotFound, Distinct, MoveLt, MoveGe, MoveLe
*/
/* Opcode: MoveLt P1 P2 P3 P4 * 
**
** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), 
** use the integer value in register P3 as a key. If cursor P1 refers 
** to an SQL index, then P3 is the first in an array of P4 registers 
** that are used as an unpacked index key. 
**
** Reposition cursor P1 so that  it points to the largest entry that 
** is less than the key value. If there are no records less than 
** the key and P2 is not zero, then jump to P2.
**
** See also: Found, NotFound, Distinct, MoveGt, MoveGe, MoveLe
*/
/* Opcode: MoveLe P1 P2 P3 P4 *
**
** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), 
** use the integer value in register P3 as a key. If cursor P1 refers 
** to an SQL index, then P3 is the first in an array of P4 registers 
** that are used as an unpacked index key. 
**
** Reposition cursor P1 so that it points to the largest entry that 
** is less than or equal to the key value. If there are no records 
** less than or equal to the key and P2 is not zero, then jump to P2.
**
** See also: Found, NotFound, Distinct, MoveGt, MoveGe, MoveLt
*/
case OP_MoveLt:         /* jump, in3 */
case OP_MoveLe:         /* jump, in3 */
case OP_MoveGe:         /* jump, in3 */
case OP_MoveGt: {       /* jump, in3 */
  int i = pOp->p1;
  Cursor *pC;

  assert( i>=0 && i<p->nCursor );
  pC = p->apCsr[i];
  assert( pC!=0 );
  if( pC->pCursor!=0 ){
    int res, oc;
    oc = pOp->opcode;
    pC->nullRow = 0;
    *pC->pIncrKey = oc==OP_MoveGt || oc==OP_MoveLe;
    if( pC->isTable ){
      i64 iKey = sqlite3VdbeIntValue(pIn3);
      if( pOp->p2==0 ){
        assert( pOp->opcode==OP_MoveGe );
        pC->movetoTarget = iKey;
        pC->rowidIsValid = 0;
        pC->deferredMoveto = 1;
        break;
      }
      rc = sqlite3BtreeMoveto(pC->pCursor, 0, 0, (u64)iKey, 0, &res);
      if( rc!=SQLITE_OK ){
        goto abort_due_to_error;
      }
      pC->lastRowid = iKey;
      pC->rowidIsValid = res==0;
    }else{
      UnpackedRecord r;
      int nField = pOp->p4.i;
      assert( pOp->p4type==P4_INT32 );
      assert( nField>0 );
      r.pKeyInfo = pC->pKeyInfo;
      r.nField = nField;
      r.needFree = 0;
      r.needDestroy = 0;
      r.aMem = &p->aMem[pOp->p3];
      rc = sqlite3BtreeMoveto(pC->pCursor, 0, &r, 0, 0, &res);
      if( rc!=SQLITE_OK ){
        goto abort_due_to_error;
      }
      pC->rowidIsValid = 0;
    }
    pC->deferredMoveto = 0;
    pC->cacheStatus = CACHE_STALE;
    *pC->pIncrKey = 0;
#ifdef SQLITE_TEST
    sqlite3_search_count++;
#endif
    if( oc==OP_MoveGe || oc==OP_MoveGt ){
      if( res<0 ){
        rc = sqlite3BtreeNext(pC->pCursor, &res);
        if( rc!=SQLITE_OK ) goto abort_due_to_error;
        pC->rowidIsValid = 0;
      }else{
        res = 0;
      }
    }else{
      assert( oc==OP_MoveLt || oc==OP_MoveLe );
      if( res>=0 ){
        rc = sqlite3BtreePrevious(pC->pCursor, &res);
        if( rc!=SQLITE_OK ) goto abort_due_to_error;
        pC->rowidIsValid = 0;
      }else{
        /* res might be negative because the table is empty.  Check to
        ** see if this is the case.
        */
        res = sqlite3BtreeEof(pC->pCursor);
      }
    }
    assert( pOp->p2>0 );
    if( res ){
      pc = pOp->p2 - 1;
    }
  }else if( !pC->pseudoTable ){
    /* This happens when attempting to open the sqlite3_master table
    ** for read access returns SQLITE_EMPTY. In this case always
    ** take the jump (since there are no records in the table).
    */
    pc = pOp->p2 - 1;
  }
  break;
}

/* Opcode: Found P1 P2 P3 * *
**
** Register P3 holds a blob constructed by MakeRecord.  P1 is an index.
** If an entry that matches the value in register p3 exists in P1 then
** jump to P2.  If the P3 value does not match any entry in P1
** then fall thru.  The P1 cursor is left pointing at the matching entry
** if it exists.
**
** This instruction is used to implement the IN operator where the
** left-hand side is a SELECT statement.  P1 may be a true index, or it
** may be a temporary index that holds the results of the SELECT
** statement.   This instruction is also used to implement the
** DISTINCT keyword in SELECT statements.
**
** This instruction checks if index P1 contains a record for which 
** the first N serialized values exactly match the N serialized values
** in the record in register P3, where N is the total number of values in
** the P3 record (the P3 record is a prefix of the P1 record). 
**
** See also: NotFound, MoveTo, IsUnique, NotExists
*/
/* Opcode: NotFound P1 P2 P3 * *
**
** Register P3 holds a blob constructed by MakeRecord.  P1 is
** an index.  If no entry exists in P1 that matches the blob then jump
** to P2.  If an entry does existing, fall through.  The cursor is left
** pointing to the entry that matches.
**
** See also: Found, MoveTo, NotExists, IsUnique
*/
case OP_NotFound:       /* jump, in3 */
case OP_Found: {        /* jump, in3 */
  int i = pOp->p1;
  int alreadyExists = 0;
  Cursor *pC;
  assert( i>=0 && i<p->nCursor );
  assert( p->apCsr[i]!=0 );
  if( (pC = p->apCsr[i])->pCursor!=0 ){
    int res;
    assert( pC->isTable==0 );
    assert( pIn3->flags & MEM_Blob );
    if( pOp->opcode==OP_Found ){
      pC->pKeyInfo->prefixIsEqual = 1;
    }
    rc = sqlite3BtreeMoveto(pC->pCursor, pIn3->z, 0, pIn3->n, 0, &res);
    pC->pKeyInfo->prefixIsEqual = 0;
    if( rc!=SQLITE_OK ){
      break;
    }
    alreadyExists = (res==0);
    pC->deferredMoveto = 0;
    pC->cacheStatus = CACHE_STALE;
  }
  if( pOp->opcode==OP_Found ){
    if( alreadyExists ) pc = pOp->p2 - 1;
  }else{
    if( !alreadyExists ) pc = pOp->p2 - 1;
  }
  break;
}

/* Opcode: IsUnique P1 P2 P3 P4 *
**
** The P3 register contains an integer record number.  Call this
** record number R.  The P4 register contains an index key created
** using MakeIdxRec.  Call it K.
**
** P1 is an index.  So it has no data and its key consists of a
** record generated by OP_MakeRecord where the last field is the 
** rowid of the entry that the index refers to.
** 
** This instruction asks if there is an entry in P1 where the
** fields matches K but the rowid is different from R.
** If there is no such entry, then there is an immediate
** jump to P2.  If any entry does exist where the index string
** matches K but the record number is not R, then the record
** number for that entry is written into P3 and control
** falls through to the next instruction.
**
** See also: NotFound, NotExists, Found
*/
case OP_IsUnique: {        /* jump, in3 */
  int i = pOp->p1;
  Cursor *pCx;
  BtCursor *pCrsr;
  Mem *pK;
  i64 R;

  /* Pop the value R off the top of the stack
  */
  assert( pOp->p4type==P4_INT32 );
  assert( pOp->p4.i>0 && pOp->p4.i<=p->nMem );
  pK = &p->aMem[pOp->p4.i];
  sqlite3VdbeMemIntegerify(pIn3);
  R = pIn3->u.i;
  assert( i>=0 && i<p->nCursor );
  pCx = p->apCsr[i];
  assert( pCx!=0 );
  pCrsr = pCx->pCursor;
  if( pCrsr!=0 ){
    int res;
    i64 v;         /* The record number on the P1 entry that matches K */
    char *zKey;    /* The value of K */
    int nKey;      /* Number of bytes in K */
    int len;       /* Number of bytes in K without the rowid at the end */
    int szRowid;   /* Size of the rowid column at the end of zKey */

    /* Make sure K is a string and make zKey point to K
    */
    assert( pK->flags & MEM_Blob );
    zKey = pK->z;
    nKey = pK->n;

    /* sqlite3VdbeIdxRowidLen() only returns other than SQLITE_OK when the
    ** record passed as an argument corrupt. Since the record in this case
    ** has just been created by an OP_MakeRecord instruction, and not loaded
    ** from the database file, it is not possible for it to be corrupt.
    ** Therefore, assert(rc==SQLITE_OK).
    */
    rc = sqlite3VdbeIdxRowidLen((u8*)zKey, nKey, &szRowid);
    assert(rc==SQLITE_OK);
    len = nKey-szRowid;

    /* Search for an entry in P1 where all but the last four bytes match K.
    ** If there is no such entry, jump immediately to P2.
    */
    assert( pCx->deferredMoveto==0 );
    pCx->cacheStatus = CACHE_STALE;
    rc = sqlite3BtreeMoveto(pCrsr, zKey, 0, len, 0, &res);
    if( rc!=SQLITE_OK ){
      goto abort_due_to_error;
    }
    if( res<0 ){
      rc = sqlite3BtreeNext(pCrsr, &res);
      if( res ){
        pc = pOp->p2 - 1;
        break;
      }
    }
    rc = sqlite3VdbeIdxKeyCompare(pCx, 0, len, (u8*)zKey, &res); 
    if( rc!=SQLITE_OK ) goto abort_due_to_error;
    if( res>0 ){
      pc = pOp->p2 - 1;
      break;
    }

    /* At this point, pCrsr is pointing to an entry in P1 where all but
    ** the final entry (the rowid) matches K.  Check to see if the
    ** final rowid column is different from R.  If it equals R then jump
    ** immediately to P2.
    */
    rc = sqlite3VdbeIdxRowid(pCrsr, &v);
    if( rc!=SQLITE_OK ){
      goto abort_due_to_error;
    }
    if( v==R ){
      pc = pOp->p2 - 1;
      break;
    }

    /* The final varint of the key is different from R.  Store it back
    ** into register R3.  (The record number of an entry that violates
    ** a UNIQUE constraint.)
    */
    pIn3->u.i = v;
    assert( pIn3->flags&MEM_Int );
  }
  break;
}

/* Opcode: NotExists P1 P2 P3 * *
**
** Use the content of register P3 as a integer key.  If a record 
** with that key does not exist in table of P1, then jump to P2. 
** If the record does exist, then fall thru.  The cursor is left 
** pointing to the record if it exists.
**
** The difference between this operation and NotFound is that this
** operation assumes the key is an integer and that P1 is a table whereas
** NotFound assumes key is a blob constructed from MakeRecord and
** P1 is an index.
**
** See also: Found, MoveTo, NotFound, IsUnique
*/
case OP_NotExists: {        /* jump, in3 */
  int i = pOp->p1;
  Cursor *pC;
  BtCursor *pCrsr;
  assert( i>=0 && i<p->nCursor );
  assert( p->apCsr[i]!=0 );
  if( (pCrsr = (pC = p->apCsr[i])->pCursor)!=0 ){
    int res;
    u64 iKey;
    assert( pIn3->flags & MEM_Int );
    assert( p->apCsr[i]->isTable );
    iKey = intToKey(pIn3->u.i);
    rc = sqlite3BtreeMoveto(pCrsr, 0, 0, iKey, 0,&res);
    pC->lastRowid = pIn3->u.i;
    pC->rowidIsValid = res==0;
    pC->nullRow = 0;
    pC->cacheStatus = CACHE_STALE;
    /* res might be uninitialized if rc!=SQLITE_OK.  But if rc!=SQLITE_OK
    ** processing is about to abort so we really do not care whether or not
    ** the following jump is taken.  (In other words, do not stress over
    ** the error that valgrind sometimes shows on the next statement when
    ** running ioerr.test and similar failure-recovery test scripts.) */
    if( res!=0 ){
      pc = pOp->p2 - 1;
      assert( pC->rowidIsValid==0 );
    }
  }else if( !pC->pseudoTable ){
    /* This happens when an attempt to open a read cursor on the 
    ** sqlite_master table returns SQLITE_EMPTY.
    */
    assert( pC->isTable );
    pc = pOp->p2 - 1;
    assert( pC->rowidIsValid==0 );
  }
  break;
}

/* Opcode: Sequence P1 P2 * * *
**
** Find the next available sequence number for cursor P1.
** Write the sequence number into register P2.
** The sequence number on the cursor is incremented after this
** instruction.  
*/
case OP_Sequence: {           /* out2-prerelease */
  int i = pOp->p1;
  assert( i>=0 && i<p->nCursor );
  assert( p->apCsr[i]!=0 );
  pOut->u.i = p->apCsr[i]->seqCount++;
  MemSetTypeFlag(pOut, MEM_Int);
  break;
}


/* Opcode: NewRowid P1 P2 P3 * *
**
** Get a new integer record number (a.k.a "rowid") used as the key to a table.
** The record number is not previously used as a key in the database
** table that cursor P1 points to.  The new record number is written
** written to register P2.
**
** If P3>0 then P3 is a register that holds the largest previously
** generated record number.  No new record numbers are allowed to be less
** than this value.  When this value reaches its maximum, a SQLITE_FULL
** error is generated.  The P3 register is updated with the generated
** record number.  This P3 mechanism is used to help implement the
** AUTOINCREMENT feature.
*/
case OP_NewRowid: {           /* out2-prerelease */
  int i = pOp->p1;
  i64 v = 0;
  Cursor *pC;
  assert( i>=0 && i<p->nCursor );
  assert( p->apCsr[i]!=0 );
  if( (pC = p->apCsr[i])->pCursor==0 ){
    /* The zero initialization above is all that is needed */
  }else{
    /* The next rowid or record number (different terms for the same
    ** thing) is obtained in a two-step algorithm.
    **
    ** First we attempt to find the largest existing rowid and add one
    ** to that.  But if the largest existing rowid is already the maximum
    ** positive integer, we have to fall through to the second
    ** probabilistic algorithm
    **
    ** The second algorithm is to select a rowid at random and see if
    ** it already exists in the table.  If it does not exist, we have
    ** succeeded.  If the random rowid does exist, we select a new one
    ** and try again, up to 1000 times.
    **
    ** For a table with less than 2 billion entries, the probability
    ** of not finding a unused rowid is about 1.0e-300.  This is a 
    ** non-zero probability, but it is still vanishingly small and should
    ** never cause a problem.  You are much, much more likely to have a
    ** hardware failure than for this algorithm to fail.
    **
    ** The analysis in the previous paragraph assumes that you have a good
    ** source of random numbers.  Is a library function like lrand48()
    ** good enough?  Maybe. Maybe not. It's hard to know whether there
    ** might be subtle bugs is some implementations of lrand48() that
    ** could cause problems. To avoid uncertainty, SQLite uses its own 
    ** random number generator based on the RC4 algorithm.
    **
    ** To promote locality of reference for repetitive inserts, the
    ** first few attempts at choosing a random rowid pick values just a little
    ** larger than the previous rowid.  This has been shown experimentally
    ** to double the speed of the COPY operation.
    */
    int res, rx=SQLITE_OK, cnt;
    i64 x;
    cnt = 0;
    if( (sqlite3BtreeFlags(pC->pCursor)&(BTREE_INTKEY|BTREE_ZERODATA)) !=
          BTREE_INTKEY ){
      rc = SQLITE_CORRUPT_BKPT;
      goto abort_due_to_error;
    }
    assert( (sqlite3BtreeFlags(pC->pCursor) & BTREE_INTKEY)!=0 );
    assert( (sqlite3BtreeFlags(pC->pCursor) & BTREE_ZERODATA)==0 );

#ifdef SQLITE_32BIT_ROWID
#   define MAX_ROWID 0x7fffffff
#else
    /* Some compilers complain about constants of the form 0x7fffffffffffffff.
    ** Others complain about 0x7ffffffffffffffffLL.  The following macro seems
    ** to provide the constant while making all compilers happy.
    */
#   define MAX_ROWID  ( (((u64)0x7fffffff)<<32) | (u64)0xffffffff )
#endif

    if( !pC->useRandomRowid ){
      if( pC->nextRowidValid ){
        v = pC->nextRowid;
      }else{
        rc = sqlite3BtreeLast(pC->pCursor, &res);
        if( rc!=SQLITE_OK ){
          goto abort_due_to_error;
        }
        if( res ){
          v = 1;
        }else{
          sqlite3BtreeKeySize(pC->pCursor, &v);
          v = keyToInt(v);
          if( v==MAX_ROWID ){
            pC->useRandomRowid = 1;
          }else{
            v++;
          }
        }
      }

#ifndef SQLITE_OMIT_AUTOINCREMENT
      if( pOp->p3 ){
        Mem *pMem;
        assert( pOp->p3>0 && pOp->p3<=p->nMem ); /* P3 is a valid memory cell */
        pMem = &p->aMem[pOp->p3];
	REGISTER_TRACE(pOp->p3, pMem);
        sqlite3VdbeMemIntegerify(pMem);
        assert( (pMem->flags & MEM_Int)!=0 );  /* mem(P3) holds an integer */
        if( pMem->u.i==MAX_ROWID || pC->useRandomRowid ){
          rc = SQLITE_FULL;
          goto abort_due_to_error;
        }
        if( v<pMem->u.i+1 ){
          v = pMem->u.i + 1;
        }
        pMem->u.i = v;
      }
#endif

      if( v<MAX_ROWID ){
        pC->nextRowidValid = 1;
        pC->nextRowid = v+1;
      }else{
        pC->nextRowidValid = 0;
      }
    }
    if( pC->useRandomRowid ){
      assert( pOp->p3==0 );  /* SQLITE_FULL must have occurred prior to this */
      v = db->priorNewRowid;
      cnt = 0;
      do{
        if( cnt==0 && (v&0xffffff)==v ){
          v++;
        }else{
          sqlite3_randomness(sizeof(v), &v);
          if( cnt<5 ) v &= 0xffffff;
        }
        if( v==0 ) continue;
        x = intToKey(v);
        rx = sqlite3BtreeMoveto(pC->pCursor, 0, 0, (u64)x, 0, &res);
        cnt++;
      }while( cnt<100 && rx==SQLITE_OK && res==0 );
      db->priorNewRowid = v;
      if( rx==SQLITE_OK && res==0 ){
        rc = SQLITE_FULL;
        goto abort_due_to_error;
      }
    }
    pC->rowidIsValid = 0;
    pC->deferredMoveto = 0;
    pC->cacheStatus = CACHE_STALE;
  }
  MemSetTypeFlag(pOut, MEM_Int);
  pOut->u.i = v;
  break;
}

/* Opcode: Insert P1 P2 P3 P4 P5
**
** Write an entry into the table of cursor P1.  A new entry is
** created if it doesn't already exist or the data for an existing
** entry is overwritten.  The data is the value stored register
** number P2. The key is stored in register P3. The key must
** be an integer.
**
** If the OPFLAG_NCHANGE flag of P5 is set, then the row change count is
** incremented (otherwise not).  If the OPFLAG_LASTROWID flag of P5 is set,
** then rowid is stored for subsequent return by the
** sqlite3_last_insert_rowid() function (otherwise it is unmodified).
**
** Parameter P4 may point to a string containing the table-name, or
** may be NULL. If it is not NULL, then the update-hook 
** (sqlite3.xUpdateCallback) is invoked following a successful insert.
**
** (WARNING/TODO: If P1 is a pseudo-cursor and P2 is dynamically
** allocated, then ownership of P2 is transferred to the pseudo-cursor
** 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: {
  Mem *pData = &p->aMem[pOp->p2];
  Mem *pKey = &p->aMem[pOp->p3];

  i64 iKey;   /* The integer ROWID or key for the record to be inserted */
  int i = pOp->p1;
  Cursor *pC;
  assert( i>=0 && i<p->nCursor );
  pC = p->apCsr[i];
  assert( pC!=0 );
  assert( pC->pCursor!=0 || pC->pseudoTable );
  assert( pKey->flags & MEM_Int );
  assert( pC->isTable );
  REGISTER_TRACE(pOp->p2, pData);
  REGISTER_TRACE(pOp->p3, pKey);

  iKey = intToKey(pKey->u.i);
  if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;
  if( pOp->p5 & OPFLAG_LASTROWID ) db->lastRowid = pKey->u.i;
  if( pC->nextRowidValid && pKey->u.i>=pC->nextRowid ){
    pC->nextRowidValid = 0;
  }
  if( pData->flags & MEM_Null ){
    pData->z = 0;
    pData->n = 0;
  }else{
    assert( pData->flags & (MEM_Blob|MEM_Str) );
  }
  if( pC->pseudoTable ){
    if( !pC->ephemPseudoTable ){
      sqlite3DbFree(db, pC->pData);
    }
    pC->iKey = iKey;
    pC->nData = pData->n;
    if( pData->z==pData->zMalloc || pC->ephemPseudoTable ){
      pC->pData = pData->z;
      if( !pC->ephemPseudoTable ){
        pData->flags &= ~MEM_Dyn;
        pData->flags |= MEM_Ephem;
        pData->zMalloc = 0;
      }
    }else{
      pC->pData = sqlite3Malloc( pC->nData+2 );
      if( !pC->pData ) goto no_mem;
      memcpy(pC->pData, pData->z, pC->nData);
      pC->pData[pC->nData] = 0;
      pC->pData[pC->nData+1] = 0;
    }
    pC->nullRow = 0;
  }else{
    int nZero;
    if( pData->flags & MEM_Zero ){
      nZero = pData->u.i;
    }else{
      nZero = 0;
    }
    rc = sqlite3BtreeInsert(pC->pCursor, 0, iKey,
                            pData->z, pData->n, nZero,
                            pOp->p5 & OPFLAG_APPEND);
  }
  
  pC->rowidIsValid = 0;
  pC->deferredMoveto = 0;
  pC->cacheStatus = CACHE_STALE;

  /* Invoke the update-hook if required. */
  if( rc==SQLITE_OK && db->xUpdateCallback && pOp->p4.z ){
    const char *zDb = db->aDb[pC->iDb].zName;
    const char *zTbl = pOp->p4.z;
    int op = ((pOp->p5 & OPFLAG_ISUPDATE) ? SQLITE_UPDATE : SQLITE_INSERT);
    assert( pC->isTable );
    db->xUpdateCallback(db->pUpdateArg, op, zDb, zTbl, iKey);
    assert( pC->iDb>=0 );
  }
  break;
}

/* Opcode: Delete P1 P2 * P4 *
**
** Delete the record at which the P1 cursor is currently pointing.
**
** The cursor will be left pointing at either the next or the previous
** record in the table. If it is left pointing at the next record, then
** the next Next instruction will be a no-op.  Hence it is OK to delete
** a record from within an Next loop.
**
** If the OPFLAG_NCHANGE flag of P2 is set, then the row change count is
** incremented (otherwise not).
**
** P1 must not be pseudo-table.  It has to be a real table with
** multiple rows.
**
** If P4 is not NULL, then it is the name of the table that P1 is
** pointing to.  The update hook will be invoked, if it exists.
** If P4 is not NULL then the P1 cursor must have been positioned
** using OP_NotFound prior to invoking this opcode.
*/
case OP_Delete: {
  int i = pOp->p1;
  i64 iKey;
  Cursor *pC;

  assert( i>=0 && i<p->nCursor );
  pC = p->apCsr[i];
  assert( pC!=0 );
  assert( pC->pCursor!=0 );  /* Only valid for real tables, no pseudotables */

  /* If the update-hook will be invoked, set iKey to the rowid of the
  ** row being deleted.
  */
  if( db->xUpdateCallback && pOp->p4.z ){
    assert( pC->isTable );
    assert( pC->rowidIsValid );  /* lastRowid set by previous OP_NotFound */
    iKey = pC->lastRowid;
  }

  rc = sqlite3VdbeCursorMoveto(pC);
  if( rc ) goto abort_due_to_error;
  rc = sqlite3BtreeDelete(pC->pCursor);
  pC->nextRowidValid = 0;
  pC->cacheStatus = CACHE_STALE;

  /* Invoke the update-hook if required. */
  if( rc==SQLITE_OK && db->xUpdateCallback && pOp->p4.z ){
    const char *zDb = db->aDb[pC->iDb].zName;
    const char *zTbl = pOp->p4.z;
    db->xUpdateCallback(db->pUpdateArg, SQLITE_DELETE, zDb, zTbl, iKey);
    assert( pC->iDb>=0 );
  }
  if( pOp->p2 & OPFLAG_NCHANGE ) p->nChange++;
  break;
}

/* Opcode: ResetCount P1 * *
**
** This opcode resets the VMs internal change counter to 0. If P1 is true,
** then the value of the change counter is copied to the database handle
** change counter (returned by subsequent calls to sqlite3_changes())
** before it is reset. This is used by trigger programs.
*/
case OP_ResetCount: {
  if( pOp->p1 ){
    sqlite3VdbeSetChanges(db, p->nChange);
  }
  p->nChange = 0;
  break;
}

/* Opcode: RowData P1 P2 * * *
**
** Write into register P2 the complete row data for cursor P1.
** There is no interpretation of the data.  
** It is just copied onto the P2 register exactly as 
** it is found in the database file.
**
** If the P1 cursor must be pointing to a valid row (not a NULL row)
** of a real table, not a pseudo-table.
*/
/* Opcode: RowKey P1 P2 * * *
**
** Write into register P2 the complete row key for cursor P1.
** There is no interpretation of the data.  
** The key is copied onto the P3 register exactly as 
** it is found in the database file.
**
** If the P1 cursor must be pointing to a valid row (not a NULL row)
** of a real table, not a pseudo-table.
*/
case OP_RowKey:
case OP_RowData: {
  int i = pOp->p1;
  Cursor *pC;
  BtCursor *pCrsr;
  u32 n;

  pOut = &p->aMem[pOp->p2];

  /* Note that RowKey and RowData are really exactly the same instruction */
  assert( i>=0 && i<p->nCursor );
  pC = p->apCsr[i];
  assert( pC->isTable || pOp->opcode==OP_RowKey );
  assert( pC->isIndex || pOp->opcode==OP_RowData );
  assert( pC!=0 );
  assert( pC->nullRow==0 );
  assert( pC->pseudoTable==0 );
  assert( pC->pCursor!=0 );
  pCrsr = pC->pCursor;
  rc = sqlite3VdbeCursorMoveto(pC);
  if( rc ) goto abort_due_to_error;
  if( pC->isIndex ){
    i64 n64;
    assert( !pC->isTable );
    sqlite3BtreeKeySize(pCrsr, &n64);
    if( n64>db->aLimit[SQLITE_LIMIT_LENGTH] ){
      goto too_big;
    }
    n = n64;
  }else{
    sqlite3BtreeDataSize(pCrsr, &n);
    if( n>db->aLimit[SQLITE_LIMIT_LENGTH] ){
      goto too_big;
    }
  }
  if( sqlite3VdbeMemGrow(pOut, n, 0) ){
    goto no_mem;
  }
  pOut->n = n;
  MemSetTypeFlag(pOut, MEM_Blob);
  if( pC->isIndex ){
    rc = sqlite3BtreeKey(pCrsr, 0, n, pOut->z);
  }else{
    rc = sqlite3BtreeData(pCrsr, 0, n, pOut->z);
  }
  pOut->enc = SQLITE_UTF8;  /* In case the blob is ever cast to text */
  UPDATE_MAX_BLOBSIZE(pOut);
  break;
}

/* Opcode: Rowid P1 P2 * * *
**
** Store in register P2 an integer which is the key of the table entry that
** P1 is currently point to.
*/
case OP_Rowid: {                 /* out2-prerelease */
  int i = pOp->p1;
  Cursor *pC;
  i64 v;

  assert( i>=0 && i<p->nCursor );
  pC = p->apCsr[i];
  assert( pC!=0 );
  rc = sqlite3VdbeCursorMoveto(pC);
  if( rc ) goto abort_due_to_error;
  if( pC->rowidIsValid ){
    v = pC->lastRowid;
  }else if( pC->pseudoTable ){
    v = keyToInt(pC->iKey);
  }else if( pC->nullRow ){
    /* Leave the rowid set to a NULL */
    break;
  }else{
    assert( pC->pCursor!=0 );
    sqlite3BtreeKeySize(pC->pCursor, &v);
    v = keyToInt(v);
  }
  pOut->u.i = v;
  MemSetTypeFlag(pOut, MEM_Int);
  break;
}

/* Opcode: NullRow P1 * * * *
**
** Move the cursor P1 to a null row.  Any OP_Column operations
** that occur while the cursor is on the null row will always
** write a NULL.
*/
case OP_NullRow: {
  int i = pOp->p1;
  Cursor *pC;

  assert( i>=0 && i<p->nCursor );
  pC = p->apCsr[i];
  assert( pC!=0 );
  pC->nullRow = 1;
  pC->rowidIsValid = 0;
  break;
}

/* Opcode: Last P1 P2 * * *
**
** The next use of the Rowid or Column or Next instruction for P1 
** will refer to the last entry in the database table or index.
** If the table or index is empty and P2>0, then jump immediately to P2.
** If P2 is 0 or if the table or index is not empty, fall through
** to the following instruction.
*/
case OP_Last: {        /* jump */
  int i = pOp->p1;
  Cursor *pC;
  BtCursor *pCrsr;
  int res;

  assert( i>=0 && i<p->nCursor );
  pC = p->apCsr[i];
  assert( pC!=0 );
  pCrsr = pC->pCursor;
  assert( pCrsr!=0 );
  rc = sqlite3BtreeLast(pCrsr, &res);
  pC->nullRow = res;
  pC->deferredMoveto = 0;
  pC->cacheStatus = CACHE_STALE;
  if( res && pOp->p2>0 ){
    pc = pOp->p2 - 1;
  }
  break;
}


/* Opcode: Sort P1 P2 * * *
**
** This opcode does exactly the same thing as OP_Rewind except that
** it increments an undocumented global variable used for testing.
**
** Sorting is accomplished by writing records into a sorting index,
** then rewinding that index and playing it back from beginning to
** end.  We use the OP_Sort opcode instead of OP_Rewind to do the
** rewinding so that the global variable will be incremented and
** regression tests can determine whether or not the optimizer is
** correctly optimizing out sorts.
*/
case OP_Sort: {        /* jump */
#ifdef SQLITE_TEST
  sqlite3_sort_count++;
  sqlite3_search_count--;
#endif
  /* Fall through into OP_Rewind */
}
/* Opcode: Rewind P1 P2 * * *
**
** The next use of the Rowid or Column or Next instruction for P1 
** will refer to the first entry in the database table or index.
** If the table or index is empty and P2>0, then jump immediately to P2.
** If P2 is 0 or if the table or index is not empty, fall through
** to the following instruction.
*/
case OP_Rewind: {        /* jump */
  int i = pOp->p1;
  Cursor *pC;
  BtCursor *pCrsr;
  int res;

  assert( i>=0 && i<p->nCursor );
  pC = p->apCsr[i];
  assert( pC!=0 );
  if( (pCrsr = pC->pCursor)!=0 ){
    rc = sqlite3BtreeFirst(pCrsr, &res);
    pC->atFirst = res==0;
    pC->deferredMoveto = 0;
    pC->cacheStatus = CACHE_STALE;
  }else{
    res = 1;
  }
  pC->nullRow = res;
  assert( pOp->p2>0 && pOp->p2<p->nOp );
  if( res ){
    pc = pOp->p2 - 1;
  }
  break;
}

/* Opcode: Next P1 P2 * * *
**
** Advance cursor P1 so that it points to the next key/data pair in its
** table or index.  If there are no more key/value pairs then fall through
** to the following instruction.  But if the cursor advance was successful,
** jump immediately to P2.
**
** The P1 cursor must be for a real table, not a pseudo-table.
**
** See also: Prev
*/
/* Opcode: Prev P1 P2 * * *
**
** Back up cursor P1 so that it points to the previous key/data pair in its
** table or index.  If there is no previous key/value pairs then fall through
** to the following instruction.  But if the cursor backup was successful,
** jump immediately to P2.
**
** The P1 cursor must be for a real table, not a pseudo-table.
*/
case OP_Prev:          /* jump */
case OP_Next: {        /* jump */
  Cursor *pC;
  BtCursor *pCrsr;
  int res;

  CHECK_FOR_INTERRUPT;
  assert( pOp->p1>=0 && pOp->p1<p->nCursor );
  pC = p->apCsr[pOp->p1];
  if( pC==0 ){
    break;  /* See ticket #2273 */
  }
  pCrsr = pC->pCursor;
  assert( pCrsr );
  res = 1;
  assert( pC->deferredMoveto==0 );
  rc = pOp->opcode==OP_Next ? sqlite3BtreeNext(pCrsr, &res) :
                              sqlite3BtreePrevious(pCrsr, &res);
  pC->nullRow = res;
  pC->cacheStatus = CACHE_STALE;
  if( res==0 ){
    pc = pOp->p2 - 1;
#ifdef SQLITE_TEST
    sqlite3_search_count++;
#endif
  }
  pC->rowidIsValid = 0;
  break;
}

/* Opcode: IdxInsert P1 P2 P3 * *
**
** Register P2 holds a SQL index key made using the
** MakeIdxRec instructions.  This opcode writes that key
** into the index P1.  Data for the entry is nil.
**
** P3 is a flag that provides a hint to the b-tree layer that this
** insert is likely to be an append.
**
** This instruction only works for indices.  The equivalent instruction
** for tables is OP_Insert.
*/
case OP_IdxInsert: {        /* in2 */
  int i = pOp->p1;
  Cursor *pC;
  BtCursor *pCrsr;
  assert( i>=0 && i<p->nCursor );
  assert( p->apCsr[i]!=0 );
  assert( pIn2->flags & MEM_Blob );
  if( (pCrsr = (pC = p->apCsr[i])->pCursor)!=0 ){
    assert( pC->isTable==0 );
    rc = ExpandBlob(pIn2);
    if( rc==SQLITE_OK ){
      int nKey = pIn2->n;
      const char *zKey = pIn2->z;
      rc = sqlite3BtreeInsert(pCrsr, zKey, nKey, "", 0, 0, pOp->p3);
      assert( pC->deferredMoveto==0 );
      pC->cacheStatus = CACHE_STALE;
    }
  }
  break;
}

/* Opcode: IdxDeleteM P1 P2 P3 * *
**
** The content of P3 registers starting at register P2 form
** an unpacked index key. This opcode removes that entry from the 
** index opened by cursor P1.
*/
case OP_IdxDelete: {
  int i = pOp->p1;
  Cursor *pC;
  BtCursor *pCrsr;
  assert( pOp->p3>0 );
  assert( pOp->p2>0 && pOp->p2+pOp->p3<=p->nMem );
  assert( i>=0 && i<p->nCursor );
  assert( p->apCsr[i]!=0 );
  if( (pCrsr = (pC = p->apCsr[i])->pCursor)!=0 ){
    int res;
    UnpackedRecord r;
    r.pKeyInfo = pC->pKeyInfo;
    r.nField = pOp->p3;
    r.needFree = 0;
    r.needDestroy = 0;
    r.aMem = &p->aMem[pOp->p2];
    rc = sqlite3BtreeMoveto(pCrsr, 0, &r, 0, 0, &res);
    if( rc==SQLITE_OK && res==0 ){
      rc = sqlite3BtreeDelete(pCrsr);
    }
    assert( pC->deferredMoveto==0 );
    pC->cacheStatus = CACHE_STALE;
  }
  break;
}

/* Opcode: IdxRowid P1 P2 * * *
**
** Write into register P2 an integer which is the last entry in the record at
** the end of the index key pointed to by cursor P1.  This integer should be
** the rowid of the table entry to which this index entry points.
**
** See also: Rowid, MakeIdxRec.
*/
case OP_IdxRowid: {              /* out2-prerelease */
  int i = pOp->p1;
  BtCursor *pCrsr;
  Cursor *pC;

  assert( i>=0 && i<p->nCursor );
  assert( p->apCsr[i]!=0 );
  if( (pCrsr = (pC = p->apCsr[i])->pCursor)!=0 ){
    i64 rowid;

    assert( pC->deferredMoveto==0 );
    assert( pC->isTable==0 );
    if( !pC->nullRow ){
      rc = sqlite3VdbeIdxRowid(pCrsr, &rowid);
      if( rc!=SQLITE_OK ){
        goto abort_due_to_error;
      }
      MemSetTypeFlag(pOut, MEM_Int);
      pOut->u.i = rowid;
    }
  }
  break;
}

/* Opcode: IdxGE P1 P2 P3 P4 P5
**
** The P4 register values beginning with P3 form an unpacked index 
** key that omits the ROWID.  Compare this key value against the index 
** that P1 is currently pointing to, ignoring the ROWID on the P1 index.
**
** If the P1 index entry is greater than or equal to the key value
** then jump to P2.  Otherwise fall through to the next instruction.
**
** If P5 is non-zero then the key value is increased by an epsilon 
** prior to the comparison.  This make the opcode work like IdxGT except
** that if the key from register P3 is a prefix of the key in the cursor,
** the result is false whereas it would be true with IdxGT.
*/
/* Opcode: IdxLT P1 P2 P3 * P5
**
** The P4 register values beginning with P3 form an unpacked index 
** key that omits the ROWID.  Compare this key value against the index 
** that P1 is currently pointing to, ignoring the ROWID on the P1 index.
**
** If the P1 index entry is less than the key value then jump to P2.
** Otherwise fall through to the next instruction.
**
** If P5 is non-zero then the key value is increased by an epsilon prior 
** to the comparison.  This makes the opcode work like IdxLE.
*/
case OP_IdxLT:          /* jump, in3 */
case OP_IdxGE: {        /* jump, in3 */
  int i= pOp->p1;
  Cursor *pC;

  assert( i>=0 && i<p->nCursor );
  assert( p->apCsr[i]!=0 );
  if( (pC = p->apCsr[i])->pCursor!=0 ){
    int res;
    UnpackedRecord r;
    assert( pC->deferredMoveto==0 );
    assert( pOp->p5==0 || pOp->p5==1 );
    assert( pOp->p4type==P4_INT32 );
    r.pKeyInfo = pC->pKeyInfo;
    r.nField = pOp->p4.i;
    r.needFree = 0;
    r.needDestroy = 0;
    r.aMem = &p->aMem[pOp->p3];
    *pC->pIncrKey = pOp->p5;
    rc = sqlite3VdbeIdxKeyCompare(pC, &r, 0, 0, &res);
    *pC->pIncrKey = 0;
    if( pOp->opcode==OP_IdxLT ){
      res = -res;
    }else{
      assert( pOp->opcode==OP_IdxGE );
      res++;
    }
    if( res>0 ){
      pc = pOp->p2 - 1 ;
    }
  }
  break;
}

/* Opcode: Destroy P1 P2 P3 * *
**
** Delete an entire database table or index whose root page in the database
** file is given by P1.
**
** The table being destroyed is in the main database file if P3==0.  If
** P3==1 then the table to be clear is in the auxiliary database file
** that is used to store tables create using CREATE TEMPORARY TABLE.
**
** If AUTOVACUUM is enabled then it is possible that another root page
** might be moved into the newly deleted root page in order to keep all
** root pages contiguous at the beginning of the database.  The former
** value of the root page that moved - its value before the move occurred -
** is stored in register P2.  If no page 
** movement was required (because the table being dropped was already 
** the last one in the database) then a zero is stored in register P2.
** If AUTOVACUUM is disabled then a zero is stored in register P2.
**
** See also: Clear
*/
case OP_Destroy: {     /* out2-prerelease */
  int iMoved;
  int iCnt;
#ifndef SQLITE_OMIT_VIRTUALTABLE
  Vdbe *pVdbe;
  iCnt = 0;
  for(pVdbe=db->pVdbe; pVdbe; pVdbe=pVdbe->pNext){
    if( pVdbe->magic==VDBE_MAGIC_RUN && pVdbe->inVtabMethod<2 && pVdbe->pc>=0 ){
      iCnt++;
    }
  }
#else
  iCnt = db->activeVdbeCnt;
#endif
  if( iCnt>1 ){
    rc = SQLITE_LOCKED;
    p->errorAction = OE_Abort;
  }else{
    int iDb = pOp->p3;
    assert( iCnt==1 );
    assert( (p->btreeMask & (1<<iDb))!=0 );
    rc = sqlite3BtreeDropTable(db->aDb[iDb].pBt, pOp->p1, &iMoved);
    MemSetTypeFlag(pOut, MEM_Int);
    pOut->u.i = iMoved;
#ifndef SQLITE_OMIT_AUTOVACUUM
    if( rc==SQLITE_OK && iMoved!=0 ){
      sqlite3RootPageMoved(&db->aDb[iDb], iMoved, pOp->p1);
    }
#endif
  }
  break;
}

/* Opcode: Clear P1 P2 *
**
** Delete all contents of the database table or index whose root page
** in the database file is given by P1.  But, unlike Destroy, do not
** remove the table or index from the database file.
**
** The table being clear is in the main database file if P2==0.  If
** P2==1 then the table to be clear is in the auxiliary database file
** that is used to store tables create using CREATE TEMPORARY TABLE.
**
** See also: Destroy
*/
case OP_Clear: {
  assert( (p->btreeMask & (1<<pOp->p2))!=0 );
  rc = sqlite3BtreeClearTable(db->aDb[pOp->p2].pBt, pOp->p1);
  break;
}

/* Opcode: CreateTable P1 P2 * * *
**
** Allocate a new table in the main database file if P1==0 or in the
** auxiliary database file if P1==1 or in an attached database if
** P1>1.  Write the root page number of the new table into
** register P2
**
** The difference between a table and an index is this:  A table must
** have a 4-byte integer key and can have arbitrary data.  An index
** has an arbitrary key but no data.
**
** See also: CreateIndex
*/
/* Opcode: CreateIndex P1 P2 * * *
**
** Allocate a new index in the main database file if P1==0 or in the
** auxiliary database file if P1==1 or in an attached database if
** P1>1.  Write the root page number of the new table into
** register P2.
**
** See documentation on OP_CreateTable for additional information.
*/
case OP_CreateIndex:            /* out2-prerelease */
case OP_CreateTable: {          /* out2-prerelease */
  int pgno;
  int flags;
  Db *pDb;
  assert( pOp->p1>=0 && pOp->p1<db->nDb );
  assert( (p->btreeMask & (1<<pOp->p1))!=0 );
  pDb = &db->aDb[pOp->p1];
  assert( pDb->pBt!=0 );
  if( pOp->opcode==OP_CreateTable ){
    /* flags = BTREE_INTKEY; */
    flags = BTREE_LEAFDATA|BTREE_INTKEY;
  }else{
    flags = BTREE_ZERODATA;
  }
  rc = sqlite3BtreeCreateTable(pDb->pBt, &pgno, flags);
  if( rc==SQLITE_OK ){
    pOut->u.i = pgno;
    MemSetTypeFlag(pOut, MEM_Int);
  }
  break;
}

/* Opcode: ParseSchema P1 P2 * P4 *
**
** Read and parse all entries from the SQLITE_MASTER table of database P1
** that match the WHERE clause P4.  P2 is the "force" flag.   Always do
** the parsing if P2 is true.  If P2 is false, then this routine is a
** no-op if the schema is not currently loaded.  In other words, if P2
** is false, the SQLITE_MASTER table is only parsed if the rest of the
** schema is already loaded into the symbol table.
**
** This opcode invokes the parser to create a new virtual machine,
** then runs the new virtual machine.  It is thus a re-entrant opcode.
*/
case OP_ParseSchema: {
  char *zSql;
  int iDb = pOp->p1;
  const char *zMaster;
  InitData initData;

  assert( iDb>=0 && iDb<db->nDb );
  if( !pOp->p2 && !DbHasProperty(db, iDb, DB_SchemaLoaded) ){
    break;
  }
  zMaster = SCHEMA_TABLE(iDb);
  initData.db = db;
  initData.iDb = pOp->p1;
  initData.pzErrMsg = &p->zErrMsg;
  zSql = sqlite3MPrintf(db,
     "SELECT name, rootpage, sql FROM '%q'.%s WHERE %s",
     db->aDb[iDb].zName, zMaster, pOp->p4.z);
  if( zSql==0 ) goto no_mem;
  (void)sqlite3SafetyOff(db);
  assert( db->init.busy==0 );
  db->init.busy = 1;
  assert( !db->mallocFailed );
  rc = sqlite3_exec(db, zSql, sqlite3InitCallback, &initData, 0);
  if( rc==SQLITE_ABORT ) rc = initData.rc;
  sqlite3DbFree(db, zSql);
  db->init.busy = 0;
  (void)sqlite3SafetyOn(db);
  if( rc==SQLITE_NOMEM ){
    goto no_mem;
  }
  break;  
}

#if !defined(SQLITE_OMIT_ANALYZE) && !defined(SQLITE_OMIT_PARSER)
/* Opcode: LoadAnalysis P1 * * * *
**
** Read the sqlite_stat1 table for database P1 and load the content
** of that table into the internal index hash table.  This will cause
** the analysis to be used when preparing all subsequent queries.
*/
case OP_LoadAnalysis: {
  int iDb = pOp->p1;
  assert( iDb>=0 && iDb<db->nDb );
  rc = sqlite3AnalysisLoad(db, iDb);
  break;  
}
#endif /* !defined(SQLITE_OMIT_ANALYZE) && !defined(SQLITE_OMIT_PARSER)  */

/* Opcode: DropTable P1 * * P4 *
**
** Remove the internal (in-memory) data structures that describe
** the table named P4 in database P1.  This is called after a table
** is dropped in order to keep the internal representation of the
** schema consistent with what is on disk.
*/
case OP_DropTable: {
  sqlite3UnlinkAndDeleteTable(db, pOp->p1, pOp->p4.z);
  break;
}

/* Opcode: DropIndex P1 * * P4 *
**
** Remove the internal (in-memory) data structures that describe
** the index named P4 in database P1.  This is called after an index
** is dropped in order to keep the internal representation of the
** schema consistent with what is on disk.
*/
case OP_DropIndex: {
  sqlite3UnlinkAndDeleteIndex(db, pOp->p1, pOp->p4.z);
  break;
}

/* Opcode: DropTrigger P1 * * P4 *
**
** Remove the internal (in-memory) data structures that describe
** the trigger named P4 in database P1.  This is called after a trigger
** is dropped in order to keep the internal representation of the
** schema consistent with what is on disk.
*/
case OP_DropTrigger: {
  sqlite3UnlinkAndDeleteTrigger(db, pOp->p1, pOp->p4.z);
  break;
}


#ifndef SQLITE_OMIT_INTEGRITY_CHECK
/* Opcode: IntegrityCk P1 P2 P3 * P5
**
** Do an analysis of the currently open database.  Store in
** register P1 the text of an error message describing any problems.
** If no problems are found, store a NULL in register P1.
**
** The register P3 contains the maximum number of allowed errors.
** At most reg(P3) errors will be reported.
** In other words, the analysis stops as soon as reg(P1) errors are 
** seen.  Reg(P1) is updated with the number of errors remaining.
**
** The root page numbers of all tables in the database are integer
** stored in reg(P1), reg(P1+1), reg(P1+2), ....  There are P2 tables
** total.
**
** If P5 is not zero, the check is done on the auxiliary database
** file, not the main database file.
**
** This opcode is used to implement the integrity_check pragma.
*/
case OP_IntegrityCk: {
  int nRoot;      /* Number of tables to check.  (Number of root pages.) */
  int *aRoot;     /* Array of rootpage numbers for tables to be checked */
  int j;          /* Loop counter */
  int nErr;       /* Number of errors reported */
  char *z;        /* Text of the error report */
  Mem *pnErr;     /* Register keeping track of errors remaining */
  
  nRoot = pOp->p2;
  assert( nRoot>0 );
  aRoot = sqlite3DbMallocRaw(db, sizeof(int)*(nRoot+1) );
  if( aRoot==0 ) goto no_mem;
  assert( pOp->p3>0 && pOp->p3<=p->nMem );
  pnErr = &p->aMem[pOp->p3];
  assert( (pnErr->flags & MEM_Int)!=0 );
  assert( (pnErr->flags & (MEM_Str|MEM_Blob))==0 );
  pIn1 = &p->aMem[pOp->p1];
  for(j=0; j<nRoot; j++){
    aRoot[j] = sqlite3VdbeIntValue(&pIn1[j]);
  }
  aRoot[j] = 0;
  assert( pOp->p5<db->nDb );
  assert( (p->btreeMask & (1<<pOp->p5))!=0 );
  z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p5].pBt, aRoot, nRoot,
                                 pnErr->u.i, &nErr);
  sqlite3DbFree(db, aRoot);
  pnErr->u.i -= nErr;
  sqlite3VdbeMemSetNull(pIn1);
  if( nErr==0 ){
    assert( z==0 );
  }else if( z==0 ){
    goto no_mem;
  }else{
    sqlite3VdbeMemSetStr(pIn1, z, -1, SQLITE_UTF8, sqlite3_free);
  }
  UPDATE_MAX_BLOBSIZE(pIn1);
  sqlite3VdbeChangeEncoding(pIn1, encoding);
  break;
}
#endif /* SQLITE_OMIT_INTEGRITY_CHECK */

/* Opcode: FifoWrite P1 * * * *
**
** Write the integer from register P1 into the Fifo.
*/
case OP_FifoWrite: {        /* in1 */
  p->sFifo.db = db;
  if( sqlite3VdbeFifoPush(&p->sFifo, sqlite3VdbeIntValue(pIn1))==SQLITE_NOMEM ){
    goto no_mem;
  }
  break;
}

/* Opcode: FifoRead P1 P2 * * *
**
** Attempt to read a single integer from the Fifo.  Store that
** integer in register P1.
** 
** If the Fifo is empty jump to P2.
*/
case OP_FifoRead: {         /* jump */
  CHECK_FOR_INTERRUPT;
  assert( pOp->p1>0 && pOp->p1<=p->nMem );
  pOut = &p->aMem[pOp->p1];
  MemSetTypeFlag(pOut, MEM_Int);
  if( sqlite3VdbeFifoPop(&p->sFifo, &pOut->u.i)==SQLITE_DONE ){
    pc = pOp->p2 - 1;
  }
  break;
}

#ifndef SQLITE_OMIT_TRIGGER
/* Opcode: ContextPush * * * 
**
** Save the current Vdbe context such that it can be restored by a ContextPop
** opcode. The context stores the last insert row id, the last statement change
** count, and the current statement change count.
*/
case OP_ContextPush: {
  int i = p->contextStackTop++;
  Context *pContext;

  assert( i>=0 );
  /* FIX ME: This should be allocated as part of the vdbe at compile-time */
  if( i>=p->contextStackDepth ){
    p->contextStackDepth = i+1;
    p->contextStack = sqlite3DbReallocOrFree(db, p->contextStack,
                                          sizeof(Context)*(i+1));
    if( p->contextStack==0 ) goto no_mem;
  }
  pContext = &p->contextStack[i];
  pContext->lastRowid = db->lastRowid;
  pContext->nChange = p->nChange;
  pContext->sFifo = p->sFifo;
  sqlite3VdbeFifoInit(&p->sFifo, db);
  break;
}

/* Opcode: ContextPop * * * 
**
** Restore the Vdbe context to the state it was in when contextPush was last
** executed. The context stores the last insert row id, the last statement
** change count, and the current statement change count.
*/
case OP_ContextPop: {
  Context *pContext = &p->contextStack[--p->contextStackTop];
  assert( p->contextStackTop>=0 );
  db->lastRowid = pContext->lastRowid;
  p->nChange = pContext->nChange;
  sqlite3VdbeFifoClear(&p->sFifo);
  p->sFifo = pContext->sFifo;
  break;
}
#endif /* #ifndef SQLITE_OMIT_TRIGGER */

#ifndef SQLITE_OMIT_AUTOINCREMENT
/* Opcode: MemMax P1 P2 * * *
**
** Set the value of register P1 to the maximum of its current value
** and the value in register P2.
**
** This instruction throws an error if the memory cell is not initially
** an integer.
*/
case OP_MemMax: {        /* in1, in2 */
  sqlite3VdbeMemIntegerify(pIn1);
  sqlite3VdbeMemIntegerify(pIn2);
  if( pIn1->u.i<pIn2->u.i){
    pIn1->u.i = pIn2->u.i;
  }
  break;
}
#endif /* SQLITE_OMIT_AUTOINCREMENT */

/* Opcode: IfPos P1 P2 * * *
**
** If the value of register P1 is 1 or greater, jump to P2.
**
** It is illegal to use this instruction on a register that does
** not contain an integer.  An assertion fault will result if you try.
*/
case OP_IfPos: {        /* jump, in1 */
  assert( pIn1->flags&MEM_Int );
  if( pIn1->u.i>0 ){
     pc = pOp->p2 - 1;
  }
  break;
}

/* Opcode: IfNeg P1 P2 * * *
**
** If the value of register P1 is less than zero, jump to P2. 
**
** It is illegal to use this instruction on a register that does
** not contain an integer.  An assertion fault will result if you try.
*/
case OP_IfNeg: {        /* jump, in1 */
  assert( pIn1->flags&MEM_Int );
  if( pIn1->u.i<0 ){
     pc = pOp->p2 - 1;
  }
  break;
}

/* Opcode: IfZero P1 P2 * * *
**
** If the value of register P1 is exactly 0, jump to P2. 
**
** It is illegal to use this instruction on a register that does
** not contain an integer.  An assertion fault will result if you try.
*/
case OP_IfZero: {        /* jump, in1 */
  assert( pIn1->flags&MEM_Int );
  if( pIn1->u.i==0 ){
     pc = pOp->p2 - 1;
  }
  break;
}

/* Opcode: AggStep * P2 P3 P4 P5
**
** Execute the step function for an aggregate.  The
** function has P5 arguments.   P4 is a pointer to the FuncDef
** structure that specifies the function.  Use register
** P3 as the accumulator.
**
** The P5 arguments are taken from register P2 and its
** successors.
*/
case OP_AggStep: {
  int n = pOp->p5;
  int i;
  Mem *pMem, *pRec;
  sqlite3_context ctx;
  sqlite3_value **apVal;

  assert( n>=0 );
  pRec = &p->aMem[pOp->p2];
  apVal = p->apArg;
  assert( apVal || n==0 );
  for(i=0; i<n; i++, pRec++){
    apVal[i] = pRec;
    storeTypeInfo(pRec, encoding);
  }
  ctx.pFunc = pOp->p4.pFunc;
  assert( pOp->p3>0 && pOp->p3<=p->nMem );
  ctx.pMem = pMem = &p->aMem[pOp->p3];
  pMem->n++;
  ctx.s.flags = MEM_Null;
  ctx.s.z = 0;
  ctx.s.zMalloc = 0;
  ctx.s.xDel = 0;
  ctx.s.db = db;
  ctx.isError = 0;
  ctx.pColl = 0;
  if( ctx.pFunc->needCollSeq ){
    assert( pOp>p->aOp );
    assert( pOp[-1].p4type==P4_COLLSEQ );
    assert( pOp[-1].opcode==OP_CollSeq );
    ctx.pColl = pOp[-1].p4.pColl;
  }
  (ctx.pFunc->xStep)(&ctx, n, apVal);
  if( ctx.isError ){
    sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3_value_text(&ctx.s));
    rc = ctx.isError;
  }
  sqlite3VdbeMemRelease(&ctx.s);
  break;
}

/* Opcode: AggFinal P1 P2 * P4 *
**
** Execute the finalizer function for an aggregate.  P1 is
** the memory location that is the accumulator for the aggregate.
**
** P2 is the number of arguments that the step function takes and
** P4 is a pointer to the FuncDef for this function.  The P2
** argument is not used by this opcode.  It is only there to disambiguate
** functions that can take varying numbers of arguments.  The
** P4 argument is only needed for the degenerate case where
** the step function was not previously called.
*/
case OP_AggFinal: {
  Mem *pMem;
  assert( pOp->p1>0 && pOp->p1<=p->nMem );
  pMem = &p->aMem[pOp->p1];
  assert( (pMem->flags & ~(MEM_Null|MEM_Agg))==0 );
  rc = sqlite3VdbeMemFinalize(pMem, pOp->p4.pFunc);
  if( rc==SQLITE_ERROR ){
    sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3_value_text(pMem));
  }
  sqlite3VdbeChangeEncoding(pMem, encoding);
  UPDATE_MAX_BLOBSIZE(pMem);
  if( sqlite3VdbeMemTooBig(pMem) ){
    goto too_big;
  }
  break;
}


#if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH)
/* Opcode: Vacuum * * * * *
**
** Vacuum the entire database.  This opcode will cause other virtual
** machines to be created and run.  It may not be called from within
** a transaction.
*/
case OP_Vacuum: {
  if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse; 
  rc = sqlite3RunVacuum(&p->zErrMsg, db);
  if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
  break;
}
#endif

#if !defined(SQLITE_OMIT_AUTOVACUUM)
/* Opcode: IncrVacuum P1 P2 * * *
**
** Perform a single step of the incremental vacuum procedure on
** the P1 database. If the vacuum has finished, jump to instruction
** P2. Otherwise, fall through to the next instruction.
*/
case OP_IncrVacuum: {        /* jump */
  Btree *pBt;

  assert( pOp->p1>=0 && pOp->p1<db->nDb );
  assert( (p->btreeMask & (1<<pOp->p1))!=0 );
  pBt = db->aDb[pOp->p1].pBt;
  rc = sqlite3BtreeIncrVacuum(pBt);
  if( rc==SQLITE_DONE ){
    pc = pOp->p2 - 1;
    rc = SQLITE_OK;
  }
  break;
}
#endif

/* Opcode: Expire P1 * * * *
**
** Cause precompiled statements to become expired. An expired statement
** fails with an error code of SQLITE_SCHEMA if it is ever executed 
** (via sqlite3_step()).
** 
** If P1 is 0, then all SQL statements become expired. If P1 is non-zero,
** then only the currently executing statement is affected. 
*/
case OP_Expire: {
  if( !pOp->p1 ){
    sqlite3ExpirePreparedStatements(db);
  }else{
    p->expired = 1;
  }
  break;
}

#ifndef SQLITE_OMIT_SHARED_CACHE
/* Opcode: TableLock P1 P2 P3 P4 *
**
** Obtain a lock on a particular table. This instruction is only used when
** the shared-cache feature is enabled. 
**
** If P1 is  the index of the database in sqlite3.aDb[] of the database
** on which the lock is acquired.  A readlock is obtained if P3==0 or
** a write lock if P3==1.
**
** P2 contains the root-page of the table to lock.
**
** P4 contains a pointer to the name of the table being locked. This is only
** used to generate an error message if the lock cannot be obtained.
*/
case OP_TableLock: {
  int p1 = pOp->p1; 
  u8 isWriteLock = pOp->p3;
  assert( p1>=0 && p1<db->nDb );
  assert( (p->btreeMask & (1<<p1))!=0 );
  assert( isWriteLock==0 || isWriteLock==1 );
  rc = sqlite3BtreeLockTable(db->aDb[p1].pBt, pOp->p2, isWriteLock);
  if( rc==SQLITE_LOCKED ){
    const char *z = pOp->p4.z;
    sqlite3SetString(&p->zErrMsg, db, "database table is locked: %s", z);
  }
  break;
}
#endif /* SQLITE_OMIT_SHARED_CACHE */

#ifndef SQLITE_OMIT_VIRTUALTABLE
/* Opcode: VBegin * * * P4 *
**
** P4 may be a pointer to an sqlite3_vtab structure. If so, call the 
** xBegin method for that table.
**
** Also, whether or not P4 is set, check that this is not being called from
** within a callback to a virtual table xSync() method. If it is, set the
** error code to SQLITE_LOCKED.
*/
case OP_VBegin: {
  sqlite3_vtab *pVtab = pOp->p4.pVtab;
  rc = sqlite3VtabBegin(db, pVtab);
  if( pVtab ){
    sqlite3DbFree(db, p->zErrMsg);
    p->zErrMsg = pVtab->zErrMsg;
    pVtab->zErrMsg = 0;
  }
  break;
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */

#ifndef SQLITE_OMIT_VIRTUALTABLE
/* Opcode: VCreate P1 * * P4 *
**
** P4 is the name of a virtual table in database P1. Call the xCreate method
** for that table.
*/
case OP_VCreate: {
  rc = sqlite3VtabCallCreate(db, pOp->p1, pOp->p4.z, &p->zErrMsg);
  break;
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */

#ifndef SQLITE_OMIT_VIRTUALTABLE
/* Opcode: VDestroy P1 * * P4 *
**
** P4 is the name of a virtual table in database P1.  Call the xDestroy method
** of that table.
*/
case OP_VDestroy: {
  p->inVtabMethod = 2;
  rc = sqlite3VtabCallDestroy(db, pOp->p1, pOp->p4.z);
  p->inVtabMethod = 0;
  break;
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */

#ifndef SQLITE_OMIT_VIRTUALTABLE
/* Opcode: VOpen P1 * * P4 *
**
** P4 is a pointer to a virtual table object, an sqlite3_vtab structure.
** P1 is a cursor number.  This opcode opens a cursor to the virtual
** table and stores that cursor in P1.
*/
case OP_VOpen: {
  Cursor *pCur = 0;
  sqlite3_vtab_cursor *pVtabCursor = 0;

  sqlite3_vtab *pVtab = pOp->p4.pVtab;
  sqlite3_module *pModule = (sqlite3_module *)pVtab->pModule;

  assert(pVtab && pModule);
  if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
  rc = pModule->xOpen(pVtab, &pVtabCursor);
  sqlite3DbFree(db, p->zErrMsg);
  p->zErrMsg = pVtab->zErrMsg;
  pVtab->zErrMsg = 0;
  if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
  if( SQLITE_OK==rc ){
    /* Initialize sqlite3_vtab_cursor base class */
    pVtabCursor->pVtab = pVtab;

    /* Initialise vdbe cursor object */
    pCur = allocateCursor(p, pOp->p1, &pOp[-1], -1, 0);
    if( pCur ){
      pCur->pVtabCursor = pVtabCursor;
      pCur->pModule = pVtabCursor->pVtab->pModule;
    }else{
      db->mallocFailed = 1;
      pModule->xClose(pVtabCursor);
    }
  }
  break;
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */

#ifndef SQLITE_OMIT_VIRTUALTABLE
/* Opcode: VFilter P1 P2 P3 P4 *
**
** P1 is a cursor opened using VOpen.  P2 is an address to jump to if
** the filtered result set is empty.
**
** P4 is either NULL or a string that was generated by the xBestIndex
** method of the module.  The interpretation of the P4 string is left
** to the module implementation.
**
** This opcode invokes the xFilter method on the virtual table specified
** by P1.  The integer query plan parameter to xFilter is stored in register
** P3. Register P3+1 stores the argc parameter to be passed to the
** xFilter method. Registers P3+2..P3+1+argc are the argc
** additional parameters which are passed to
** xFilter as argv. Register P3+2 becomes argv[0] when passed to xFilter.
**
** A jump is made to P2 if the result set after filtering would be empty.
*/
case OP_VFilter: {   /* jump */
  int nArg;
  int iQuery;
  const sqlite3_module *pModule;
  Mem *pQuery = &p->aMem[pOp->p3];
  Mem *pArgc = &pQuery[1];
  sqlite3_vtab_cursor *pVtabCursor;
  sqlite3_vtab *pVtab;

  Cursor *pCur = p->apCsr[pOp->p1];

  REGISTER_TRACE(pOp->p3, pQuery);
  assert( pCur->pVtabCursor );
  pVtabCursor = pCur->pVtabCursor;
  pVtab = pVtabCursor->pVtab;
  pModule = pVtab->pModule;

  /* Grab the index number and argc parameters */
  assert( (pQuery->flags&MEM_Int)!=0 && pArgc->flags==MEM_Int );
  nArg = pArgc->u.i;
  iQuery = pQuery->u.i;

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

    if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
    sqlite3VtabLock(pVtab);
    p->inVtabMethod = 1;
    rc = pModule->xFilter(pVtabCursor, iQuery, pOp->p4.z, nArg, apArg);
    p->inVtabMethod = 0;
    sqlite3DbFree(db, p->zErrMsg);
    p->zErrMsg = pVtab->zErrMsg;
    pVtab->zErrMsg = 0;
    sqlite3VtabUnlock(db, pVtab);
    if( rc==SQLITE_OK ){
      res = pModule->xEof(pVtabCursor);
    }
    if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;

    if( res ){
      pc = pOp->p2 - 1;
    }
  }
  pCur->nullRow = 0;

  break;
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */

#ifndef SQLITE_OMIT_VIRTUALTABLE
/* Opcode: VRowid P1 P2 * * *
**
** Store into register P2  the rowid of
** the virtual-table that the P1 cursor is pointing to.
*/
case OP_VRowid: {             /* out2-prerelease */
  sqlite3_vtab *pVtab;
  const sqlite3_module *pModule;
  sqlite_int64 iRow;
  Cursor *pCur = p->apCsr[pOp->p1];

  assert( pCur->pVtabCursor );
  if( pCur->nullRow ){
    break;
  }
  pVtab = pCur->pVtabCursor->pVtab;
  pModule = pVtab->pModule;
  assert( pModule->xRowid );
  if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
  rc = pModule->xRowid(pCur->pVtabCursor, &iRow);
  sqlite3DbFree(db, p->zErrMsg);
  p->zErrMsg = pVtab->zErrMsg;
  pVtab->zErrMsg = 0;
  if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
  MemSetTypeFlag(pOut, MEM_Int);
  pOut->u.i = iRow;
  break;
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */

#ifndef SQLITE_OMIT_VIRTUALTABLE
/* Opcode: VColumn P1 P2 P3 * *
**
** Store the value of the P2-th column of
** the row of the virtual-table that the 
** P1 cursor is pointing to into register P3.
*/
case OP_VColumn: {
  sqlite3_vtab *pVtab;
  const sqlite3_module *pModule;
  Mem *pDest;
  sqlite3_context sContext;

  Cursor *pCur = p->apCsr[pOp->p1];
  assert( pCur->pVtabCursor );
  assert( pOp->p3>0 && pOp->p3<=p->nMem );
  pDest = &p->aMem[pOp->p3];
  if( pCur->nullRow ){
    sqlite3VdbeMemSetNull(pDest);
    break;
  }
  pVtab = pCur->pVtabCursor->pVtab;
  pModule = pVtab->pModule;
  assert( pModule->xColumn );
  memset(&sContext, 0, sizeof(sContext));

  /* The output cell may already have a buffer allocated. Move
  ** the current contents to sContext.s so in case the user-function 
  ** can use the already allocated buffer instead of allocating a 
  ** new one.
  */
  sqlite3VdbeMemMove(&sContext.s, pDest);
  MemSetTypeFlag(&sContext.s, MEM_Null);

  if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
  rc = pModule->xColumn(pCur->pVtabCursor, &sContext, pOp->p2);
  sqlite3DbFree(db, p->zErrMsg);
  p->zErrMsg = pVtab->zErrMsg;
  pVtab->zErrMsg = 0;

  /* Copy the result of the function to the P3 register. We
  ** do this regardless of whether or not an error occured to ensure any
  ** dynamic allocation in sContext.s (a Mem struct) is  released.
  */
  sqlite3VdbeChangeEncoding(&sContext.s, encoding);
  REGISTER_TRACE(pOp->p3, pDest);
  sqlite3VdbeMemMove(pDest, &sContext.s);
  UPDATE_MAX_BLOBSIZE(pDest);

  if( sqlite3SafetyOn(db) ){
    goto abort_due_to_misuse;
  }
  if( sqlite3VdbeMemTooBig(pDest) ){
    goto too_big;
  }
  break;
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */

#ifndef SQLITE_OMIT_VIRTUALTABLE
/* Opcode: VNext P1 P2 * * *
**
** Advance virtual table P1 to the next row in its result set and
** jump to instruction P2.  Or, if the virtual table has reached
** the end of its result set, then fall through to the next instruction.
*/
case OP_VNext: {   /* jump */
  sqlite3_vtab *pVtab;
  const sqlite3_module *pModule;
  int res = 0;

  Cursor *pCur = p->apCsr[pOp->p1];
  assert( pCur->pVtabCursor );
  if( pCur->nullRow ){
    break;
  }
  pVtab = pCur->pVtabCursor->pVtab;
  pModule = pVtab->pModule;
  assert( pModule->xNext );

  /* Invoke the xNext() method of the module. There is no way for the
  ** underlying implementation to return an error if one occurs during
  ** xNext(). Instead, if an error occurs, true is returned (indicating that 
  ** data is available) and the error code returned when xColumn or
  ** some other method is next invoked on the save virtual table cursor.
  */
  if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
  sqlite3VtabLock(pVtab);
  p->inVtabMethod = 1;
  rc = pModule->xNext(pCur->pVtabCursor);
  p->inVtabMethod = 0;
  sqlite3DbFree(db, p->zErrMsg);
  p->zErrMsg = pVtab->zErrMsg;
  pVtab->zErrMsg = 0;
  sqlite3VtabUnlock(db, pVtab);
  if( rc==SQLITE_OK ){
    res = pModule->xEof(pCur->pVtabCursor);
  }
  if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;

  if( !res ){
    /* If there is data, jump to P2 */
    pc = pOp->p2 - 1;
  }
  break;
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */

#ifndef SQLITE_OMIT_VIRTUALTABLE
/* Opcode: VRename P1 * * P4 *
**
** P4 is a pointer to a virtual table object, an sqlite3_vtab structure.
** This opcode invokes the corresponding xRename method. The value
** in register P1 is passed as the zName argument to the xRename method.
*/
case OP_VRename: {
  sqlite3_vtab *pVtab = pOp->p4.pVtab;
  Mem *pName = &p->aMem[pOp->p1];
  assert( pVtab->pModule->xRename );
  REGISTER_TRACE(pOp->p1, pName);

  Stringify(pName, encoding);

  if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
  sqlite3VtabLock(pVtab);
  rc = pVtab->pModule->xRename(pVtab, pName->z);
  sqlite3DbFree(db, p->zErrMsg);
  p->zErrMsg = pVtab->zErrMsg;
  pVtab->zErrMsg = 0;
  sqlite3VtabUnlock(db, pVtab);
  if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;

  break;
}
#endif

#ifndef SQLITE_OMIT_VIRTUALTABLE
/* Opcode: VUpdate P1 P2 P3 P4 *
**
** P4 is a pointer to a virtual table object, an sqlite3_vtab structure.
** This opcode invokes the corresponding xUpdate method. P2 values
** are contiguous memory cells starting at P3 to pass to the xUpdate 
** invocation. The value in register (P3+P2-1) corresponds to the 
** p2th element of the argv array passed to xUpdate.
**
** The xUpdate method will do a DELETE or an INSERT or both.
** The argv[0] element (which corresponds to memory cell P3)
** is the rowid of a row to delete.  If argv[0] is NULL then no 
** deletion occurs.  The argv[1] element is the rowid of the new 
** row.  This can be NULL to have the virtual table select the new 
** rowid for itself.  The subsequent elements in the array are 
** the values of columns in the new row.
**
** If P2==1 then no insert is performed.  argv[0] is the rowid of
** a row to delete.
**
** P1 is a boolean flag. If it is set to true and the xUpdate call
** is successful, then the value returned by sqlite3_last_insert_rowid() 
** is set to the value of the rowid for the row just inserted.
*/
case OP_VUpdate: {
  sqlite3_vtab *pVtab = pOp->p4.pVtab;
  sqlite3_module *pModule = (sqlite3_module *)pVtab->pModule;
  int nArg = pOp->p2;
  assert( pOp->p4type==P4_VTAB );
  if( pModule->xUpdate==0 ){
    sqlite3SetString(&p->zErrMsg, db, "read-only table");
    rc = SQLITE_ERROR;
  }else{
    int i;
    sqlite_int64 rowid;
    Mem **apArg = p->apArg;
    Mem *pX = &p->aMem[pOp->p3];
    for(i=0; i<nArg; i++){
      storeTypeInfo(pX, 0);
      apArg[i] = pX;
      pX++;
    }
    if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
    sqlite3VtabLock(pVtab);
    rc = pModule->xUpdate(pVtab, nArg, apArg, &rowid);
    sqlite3DbFree(db, p->zErrMsg);
    p->zErrMsg = pVtab->zErrMsg;
    pVtab->zErrMsg = 0;
    sqlite3VtabUnlock(db, pVtab);
    if( sqlite3SafetyOn(db) ) goto abort_due_to_misuse;
    if( pOp->p1 && rc==SQLITE_OK ){
      assert( nArg>1 && apArg[0] && (apArg[0]->flags&MEM_Null) );
      db->lastRowid = rowid;
    }
    p->nChange++;
  }
  break;
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */

#ifndef  SQLITE_OMIT_PAGER_PRAGMAS
/* Opcode: Pagecount P1 P2 * * *
**
** Write the current number of pages in database P1 to memory cell P2.
*/
case OP_Pagecount: {            /* out2-prerelease */
  int p1 = pOp->p1; 
  int nPage;
  Pager *pPager = sqlite3BtreePager(db->aDb[p1].pBt);

  rc = sqlite3PagerPagecount(pPager, &nPage);
  if( rc==SQLITE_OK ){
    pOut->flags = MEM_Int;
    pOut->u.i = nPage;
  }
  break;
}
#endif

#ifndef SQLITE_OMIT_TRACE
/* Opcode: Trace * * * P4 *
**
** If tracing is enabled (by the sqlite3_trace()) interface, then
** the UTF-8 string contained in P4 is emitted on the trace callback.
*/
case OP_Trace: {
  if( pOp->p4.z ){
    if( db->xTrace ){
      db->xTrace(db->pTraceArg, pOp->p4.z);
    }
#ifdef SQLITE_DEBUG
    if( (db->flags & SQLITE_SqlTrace)!=0 ){
      sqlite3DebugPrintf("SQL-trace: %s\n", pOp->p4.z);
    }
#endif /* SQLITE_DEBUG */
  }
  break;
}
#endif


/* Opcode: Noop * * * * *
**
** Do nothing.  This instruction is often useful as a jump
** destination.
*/
/*
** The magic Explain opcode are only inserted when explain==2 (which
** is to say when the EXPLAIN QUERY PLAN syntax is used.)
** This opcode records information from the optimizer.  It is the
** the same as a no-op.  This opcodesnever appears in a real VM program.
*/
default: {          /* This is really OP_Noop and OP_Explain */
  break;
}

/*****************************************************************************
** The cases of the switch statement above this line should all be indented
** by 6 spaces.  But the left-most 6 spaces have been removed to improve the
** readability.  From this point on down, the normal indentation rules are
** restored.
*****************************************************************************/
    }

#ifdef VDBE_PROFILE
    {
      u64 elapsed = sqlite3Hwtime() - start;
      pOp->cycles += elapsed;
      pOp->cnt++;
#if 0
        fprintf(stdout, "%10llu ", elapsed);
        sqlite3VdbePrintOp(stdout, origPc, &p->aOp[origPc]);
#endif
    }
#endif

    /* The following code adds nothing to the actual functionality
    ** of the program.  It is only here for testing and debugging.
    ** On the other hand, it does burn CPU cycles every time through
    ** the evaluator loop.  So we can leave it out when NDEBUG is defined.
    */
#ifndef NDEBUG
    assert( pc>=-1 && pc<p->nOp );

#ifdef SQLITE_DEBUG
    if( p->trace ){
      if( rc!=0 ) fprintf(p->trace,"rc=%d\n",rc);
      if( opProperty & OPFLG_OUT2_PRERELEASE ){
        registerTrace(p->trace, pOp->p2, pOut);
      }
      if( opProperty & OPFLG_OUT3 ){
        registerTrace(p->trace, pOp->p3, pOut);
      }
    }
#endif  /* SQLITE_DEBUG */
#endif  /* NDEBUG */
  }  /* The end of the for(;;) loop the loops through opcodes */

  /* If we reach this point, it means that execution is finished with
  ** an error of some kind.
  */
vdbe_error_halt:
  assert( rc );
  p->rc = rc;
  sqlite3VdbeHalt(p);
  if( rc==SQLITE_IOERR_NOMEM ) db->mallocFailed = 1;
  rc = SQLITE_ERROR;

  /* This is the only way out of this procedure.  We have to
  ** release the mutexes on btrees that were acquired at the
  ** top. */
vdbe_return:
  sqlite3BtreeMutexArrayLeave(&p->aMutex);
  return rc;

  /* Jump to here if a string or blob larger than SQLITE_MAX_LENGTH
  ** is encountered.
  */
too_big:
  sqlite3SetString(&p->zErrMsg, db, "string or blob too big");
  rc = SQLITE_TOOBIG;
  goto vdbe_error_halt;

  /* Jump to here if a malloc() fails.
  */
no_mem:
  db->mallocFailed = 1;
  sqlite3SetString(&p->zErrMsg, db, "out of memory");
  rc = SQLITE_NOMEM;
  goto vdbe_error_halt;

  /* Jump to here for an SQLITE_MISUSE error.
  */
abort_due_to_misuse:
  rc = SQLITE_MISUSE;
  /* Fall thru into abort_due_to_error */

  /* Jump to here for any other kind of fatal error.  The "rc" variable
  ** should hold the error number.
  */
abort_due_to_error:
  assert( p->zErrMsg==0 );
  if( db->mallocFailed ) rc = SQLITE_NOMEM;
  if( rc!=SQLITE_IOERR_NOMEM ){
    sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3ErrStr(rc));
  }
  goto vdbe_error_halt;

  /* Jump to here if the sqlite3_interrupt() API sets the interrupt
  ** flag.
  */
abort_due_to_interrupt:
  assert( db->u1.isInterrupted );
  rc = SQLITE_INTERRUPT;
  p->rc = rc;
  sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3ErrStr(rc));
  goto vdbe_error_halt;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/vdbe.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** Header file for the Virtual DataBase Engine (VDBE)
**
** This header defines the interface to the virtual database engine
** or VDBE.  The VDBE implements an abstract machine that runs a
** simple program to access and modify the underlying database.
**
** $Id: vdbe.h,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#ifndef _SQLITE_VDBE_H_
#define _SQLITE_VDBE_H_
#include <stdio.h>

/*
** A single VDBE is an opaque structure named "Vdbe".  Only routines
** in the source file sqliteVdbe.c are allowed to see the insides
** of this structure.
*/
typedef struct Vdbe Vdbe;

/*
** The names of the following types declared in vdbeInt.h are required
** for the VdbeOp definition.
*/
typedef struct VdbeFunc VdbeFunc;
typedef struct Mem Mem;
typedef struct UnpackedRecord UnpackedRecord;

/*
** A single instruction of the virtual machine has an opcode
** and as many as three operands.  The instruction is recorded
** as an instance of the following structure:
*/
struct VdbeOp {
  u8 opcode;          /* What operation to perform */
  signed char p4type; /* One of the P4_xxx constants for p4 */
  u8 opflags;         /* Not currently used */
  u8 p5;              /* Fifth parameter is an unsigned character */
  int p1;             /* First operand */
  int p2;             /* Second parameter (often the jump destination) */
  int p3;             /* The third parameter */
  union {             /* forth parameter */
    int i;                 /* Integer value if p4type==P4_INT32 */
    void *p;               /* Generic pointer */
    char *z;               /* Pointer to data for string (char array) types */
    i64 *pI64;             /* Used when p4type is P4_INT64 */
    double *pReal;         /* Used when p4type is P4_REAL */
    FuncDef *pFunc;        /* Used when p4type is P4_FUNCDEF */
    VdbeFunc *pVdbeFunc;   /* Used when p4type is P4_VDBEFUNC */
    CollSeq *pColl;        /* Used when p4type is P4_COLLSEQ */
    Mem *pMem;             /* Used when p4type is P4_MEM */
    sqlite3_vtab *pVtab;   /* Used when p4type is P4_VTAB */
    KeyInfo *pKeyInfo;     /* Used when p4type is P4_KEYINFO */
    int *ai;               /* Used when p4type is P4_INTARRAY */
  } p4;
#ifdef SQLITE_DEBUG
  char *zComment;          /* Comment to improve readability */
#endif
#ifdef VDBE_PROFILE
  int cnt;                 /* Number of times this instruction was executed */
  u64 cycles;              /* Total time spent executing this instruction */
#endif
};
typedef struct VdbeOp VdbeOp;

/*
** A smaller version of VdbeOp used for the VdbeAddOpList() function because
** it takes up less space.
*/
struct VdbeOpList {
  u8 opcode;          /* What operation to perform */
  signed char p1;     /* First operand */
  signed char p2;     /* Second parameter (often the jump destination) */
  signed char p3;     /* Third parameter */
};
typedef struct VdbeOpList VdbeOpList;

/*
** Allowed values of VdbeOp.p3type
*/
#define P4_NOTUSED    0   /* The P4 parameter is not used */
#define P4_DYNAMIC  (-1)  /* Pointer to a string obtained from sqliteMalloc() */
#define P4_STATIC   (-2)  /* Pointer to a static string */
#define P4_COLLSEQ  (-4)  /* P4 is a pointer to a CollSeq structure */
#define P4_FUNCDEF  (-5)  /* P4 is a pointer to a FuncDef structure */
#define P4_KEYINFO  (-6)  /* P4 is a pointer to a KeyInfo structure */
#define P4_VDBEFUNC (-7)  /* P4 is a pointer to a VdbeFunc structure */
#define P4_MEM      (-8)  /* P4 is a pointer to a Mem*    structure */
#define P4_TRANSIENT (-9) /* P4 is a pointer to a transient string */
#define P4_VTAB     (-10) /* P4 is a pointer to an sqlite3_vtab structure */
#define P4_MPRINTF  (-11) /* P4 is a string obtained from sqlite3_mprintf() */
#define P4_REAL     (-12) /* P4 is a 64-bit floating point value */
#define P4_INT64    (-13) /* P4 is a 64-bit signed integer */
#define P4_INT32    (-14) /* P4 is a 32-bit signed integer */
#define P4_INTARRAY (-15) /* P4 is a vector of 32-bit integers */

/* When adding a P4 argument using P4_KEYINFO, a copy of the KeyInfo structure
** is made.  That copy is freed when the Vdbe is finalized.  But if the
** argument is P4_KEYINFO_HANDOFF, the passed in pointer is used.  It still
** gets freed when the Vdbe is finalized so it still should be obtained
** from a single sqliteMalloc().  But no copy is made and the calling
** function should *not* try to free the KeyInfo.
*/
#define P4_KEYINFO_HANDOFF (-16)
#define P4_KEYINFO_STATIC  (-17)

/*
** The Vdbe.aColName array contains 5n Mem structures, where n is the 
** number of columns of data returned by the statement.
*/
#define COLNAME_NAME     0
#define COLNAME_DECLTYPE 1
#define COLNAME_DATABASE 2
#define COLNAME_TABLE    3
#define COLNAME_COLUMN   4
#ifdef SQLITE_ENABLE_COLUMN_METADATA
# define COLNAME_N        5      /* Number of COLNAME_xxx symbols */
#else
# ifdef SQLITE_OMIT_DECLTYPE
#   define COLNAME_N      1      /* Store only the name */
# else
#   define COLNAME_N      2      /* Store the name and decltype */
# endif
#endif

/*
** The following macro converts a relative address in the p2 field
** of a VdbeOp structure into a negative number so that 
** sqlite3VdbeAddOpList() knows that the address is relative.  Calling
** the macro again restores the address.
*/
#define ADDR(X)  (-1-(X))

/*
** 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"

/*
** Prototypes for the VDBE interface.  See comments on the implementation
** for a description of what each of these routines does.
*/
Vdbe *sqlite3VdbeCreate(sqlite3*);
int sqlite3VdbeAddOp0(Vdbe*,int);
int sqlite3VdbeAddOp1(Vdbe*,int,int);
int sqlite3VdbeAddOp2(Vdbe*,int,int,int);
int sqlite3VdbeAddOp3(Vdbe*,int,int,int,int);
int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int);
int sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp);
void sqlite3VdbeChangeP1(Vdbe*, int addr, int P1);
void sqlite3VdbeChangeP2(Vdbe*, int addr, int P2);
void sqlite3VdbeChangeP3(Vdbe*, int addr, int P3);
void sqlite3VdbeChangeP5(Vdbe*, u8 P5);
void sqlite3VdbeJumpHere(Vdbe*, int addr);
void sqlite3VdbeChangeToNoop(Vdbe*, int addr, int N);
void sqlite3VdbeChangeP4(Vdbe*, int addr, const char *zP4, int N);
void sqlite3VdbeUsesBtree(Vdbe*, int);
VdbeOp *sqlite3VdbeGetOp(Vdbe*, int);
int sqlite3VdbeMakeLabel(Vdbe*);
void sqlite3VdbeDelete(Vdbe*);
void sqlite3VdbeMakeReady(Vdbe*,int,int,int,int);
int sqlite3VdbeFinalize(Vdbe*);
void sqlite3VdbeResolveLabel(Vdbe*, int);
int sqlite3VdbeCurrentAddr(Vdbe*);
#ifdef SQLITE_DEBUG
  void sqlite3VdbeTrace(Vdbe*,FILE*);
#endif
void sqlite3VdbeResetStepResult(Vdbe*);
int sqlite3VdbeReset(Vdbe*);
void sqlite3VdbeSetNumCols(Vdbe*,int);
int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, int);
void sqlite3VdbeCountChanges(Vdbe*);
sqlite3 *sqlite3VdbeDb(Vdbe*);
void sqlite3VdbeSetSql(Vdbe*, const char *z, int n);
void sqlite3VdbeSwap(Vdbe*,Vdbe*);

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


#ifndef NDEBUG
  void sqlite3VdbeComment(Vdbe*, const char*, ...);
# define VdbeComment(X)  sqlite3VdbeComment X
  void sqlite3VdbeNoopComment(Vdbe*, const char*, ...);
# define VdbeNoopComment(X)  sqlite3VdbeNoopComment X
#else
# define VdbeComment(X)
# define VdbeNoopComment(X)
#endif

#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/vdbeInt.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
/*
** 2003 September 6
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This is the header file for information that is private to the
** VDBE.  This information used to all be at the top of the single
** source code file "vdbe.c".  When that file became too big (over
** 6000 lines long) it was split up into several smaller files and
** this header information was factored out.
**
** $Id: vdbeInt.h,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#ifndef _VDBEINT_H_
#define _VDBEINT_H_

/*
** intToKey() and keyToInt() used to transform the rowid.  But with
** the latest versions of the design they are no-ops.
*/
#define keyToInt(X)   (X)
#define intToKey(X)   (X)


/*
** SQL is translated into a sequence of instructions to be
** executed by a virtual machine.  Each instruction is an instance
** of the following structure.
*/
typedef struct VdbeOp Op;

/*
** Boolean values
*/
typedef unsigned char Bool;

/*
** A cursor is a pointer into a single BTree within a database file.
** The cursor can seek to a BTree entry with a particular key, or
** loop over all entries of the Btree.  You can also insert new BTree
** entries or retrieve the key or data from the entry that the cursor
** is currently pointing to.
** 
** Every cursor that the virtual machine has open is represented by an
** instance of the following structure.
**
** If the Cursor.isTriggerRow flag is set it means that this cursor is
** really a single row that represents the NEW or OLD pseudo-table of
** a row trigger.  The data for the row is stored in Cursor.pData and
** the rowid is in Cursor.iKey.
*/
struct Cursor {
  BtCursor *pCursor;    /* The cursor structure of the backend */
  int iDb;              /* Index of cursor database in db->aDb[] (or -1) */
  i64 lastRowid;        /* Last rowid from a Next or NextIdx operation */
  i64 nextRowid;        /* Next rowid returned by OP_NewRowid */
  Bool zeroed;          /* True if zeroed out and ready for reuse */
  Bool rowidIsValid;    /* True if lastRowid is valid */
  Bool atFirst;         /* True if pointing to first entry */
  Bool useRandomRowid;  /* Generate new record numbers semi-randomly */
  Bool nullRow;         /* True if pointing to a row with no data */
  Bool nextRowidValid;  /* True if the nextRowid field is valid */
  Bool pseudoTable;     /* This is a NEW or OLD pseudo-tables of a trigger */
  Bool ephemPseudoTable;
  Bool deferredMoveto;  /* A call to sqlite3BtreeMoveto() is needed */
  Bool isTable;         /* True if a table requiring integer keys */
  Bool isIndex;         /* True if an index containing keys only - no data */
  u8 bogusIncrKey;      /* Something for pIncrKey to point to if pKeyInfo==0 */
  i64 movetoTarget;     /* Argument to the deferred sqlite3BtreeMoveto() */
  Btree *pBt;           /* Separate file holding temporary table */
  int nData;            /* Number of bytes in pData */
  char *pData;          /* Data for a NEW or OLD pseudo-table */
  i64 iKey;             /* Key for the NEW or OLD pseudo-table row */
  u8 *pIncrKey;         /* Pointer to pKeyInfo->incrKey */
  KeyInfo *pKeyInfo;    /* Info about index keys needed by index cursors */
  int nField;           /* Number of fields in the header */
  i64 seqCount;         /* Sequence counter */
  sqlite3_vtab_cursor *pVtabCursor;  /* The cursor for a virtual table */
  const sqlite3_module *pModule;     /* Module for cursor pVtabCursor */

  /* Cached information about the header for the data record that the
  ** cursor is currently pointing to.  Only valid if cacheValid is true.
  ** aRow might point to (ephemeral) data for the current row, or it might
  ** be NULL.
  */
  int cacheStatus;      /* Cache is valid if this matches Vdbe.cacheCtr */
  int payloadSize;      /* Total number of bytes in the record */
  u32 *aType;           /* Type values for all entries in the record */
  u32 *aOffset;         /* Cached offsets to the start of each columns data */
  u8 *aRow;             /* Data for the current row, if all on one page */
};
typedef struct Cursor Cursor;

/*
** A value for Cursor.cacheValid that means the cache is always invalid.
*/
#define CACHE_STALE 0

/*
** Internally, the vdbe manipulates nearly all SQL values as Mem
** structures. Each Mem struct may cache multiple representations (string,
** integer etc.) of the same value.  A value (and therefore Mem structure)
** has the following properties:
**
** Each value has a manifest type. The manifest type of the value stored
** in a Mem struct is returned by the MemType(Mem*) macro. The type is
** one of SQLITE_NULL, SQLITE_INTEGER, SQLITE_REAL, SQLITE_TEXT or
** SQLITE_BLOB.
*/
struct Mem {
  union {
    i64 i;              /* Integer value. Or FuncDef* when flags==MEM_Agg */
    FuncDef *pDef;      /* Used only when flags==MEM_Agg */
  } u;
  double r;           /* Real value */
  sqlite3 *db;        /* The associated database connection */
  char *z;            /* String or BLOB value */
  int n;              /* Number of characters in string value, excluding '\0' */
  u16 flags;          /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */
  u8  type;           /* One of SQLITE_NULL, SQLITE_TEXT, SQLITE_INTEGER, etc */
  u8  enc;            /* SQLITE_UTF8, SQLITE_UTF16BE, SQLITE_UTF16LE */
  void (*xDel)(void *);  /* If not null, call this function to delete Mem.z */
  char *zMalloc;      /* Dynamic buffer allocated by sqlite3_malloc() */
};

/* One or more of the following flags are set to indicate the validOK
** representations of the value stored in the Mem struct.
**
** If the MEM_Null flag is set, then the value is an SQL NULL value.
** No other flags may be set in this case.
**
** If the MEM_Str flag is set then Mem.z points at a string representation.
** Usually this is encoded in the same unicode encoding as the main
** database (see below for exceptions). If the MEM_Term flag is also
** set, then the string is nul terminated. The MEM_Int and MEM_Real 
** flags may coexist with the MEM_Str flag.
**
** Multiple of these values can appear in Mem.flags.  But only one
** at a time can appear in Mem.type.
*/
#define MEM_Null      0x0001   /* Value is NULL */
#define MEM_Str       0x0002   /* Value is a string */
#define MEM_Int       0x0004   /* Value is an integer */
#define MEM_Real      0x0008   /* Value is a real number */
#define MEM_Blob      0x0010   /* Value is a BLOB */

#define MemSetTypeFlag(p, f) \
  ((p)->flags = ((p)->flags&~(MEM_Int|MEM_Real|MEM_Null|MEM_Blob|MEM_Str))|f)

/* Whenever Mem contains a valid string or blob representation, one of
** the following flags must be set to determine the memory management
** policy for Mem.z.  The MEM_Term flag tells us whether or not the
** string is \000 or \u0000 terminated
*/
#define MEM_Term      0x0020   /* String rep is nul terminated */
#define MEM_Dyn       0x0040   /* Need to call sqliteFree() on Mem.z */
#define MEM_Static    0x0080   /* Mem.z points to a static string */
#define MEM_Ephem     0x0100   /* Mem.z points to an ephemeral string */
#define MEM_Agg       0x0400   /* Mem.z points to an agg function context */
#define MEM_Zero      0x0800   /* Mem.i contains count of 0s appended to blob */

#ifdef SQLITE_OMIT_INCRBLOB
  #undef MEM_Zero
  #define MEM_Zero 0x0000
#endif


/* A VdbeFunc is just a FuncDef (defined in sqliteInt.h) that contains
** additional information about auxiliary information bound to arguments
** of the function.  This is used to implement the sqlite3_get_auxdata()
** and sqlite3_set_auxdata() APIs.  The "auxdata" is some auxiliary data
** that can be associated with a constant argument to a function.  This
** allows functions such as "regexp" to compile their constant regular
** expression argument once and reused the compiled code for multiple
** invocations.
*/
struct VdbeFunc {
  FuncDef *pFunc;               /* The definition of the function */
  int nAux;                     /* Number of entries allocated for apAux[] */
  struct AuxData {
    void *pAux;                   /* Aux data for the i-th argument */
    void (*xDelete)(void *);      /* Destructor for the aux data */
  } apAux[1];                   /* One slot for each function argument */
};

/*
** The "context" argument for a installable function.  A pointer to an
** instance of this structure is the first argument to the routines used
** implement the SQL functions.
**
** There is a typedef for this structure in sqlite.h.  So all routines,
** even the public interface to SQLite, can use a pointer to this structure.
** But this file is the only place where the internal details of this
** structure are known.
**
** This structure is defined inside of vdbeInt.h because it uses substructures
** (Mem) which are only defined there.
*/
struct sqlite3_context {
  FuncDef *pFunc;       /* Pointer to function information.  MUST BE FIRST */
  VdbeFunc *pVdbeFunc;  /* Auxilary data, if created. */
  Mem s;                /* The return value is stored here */
  Mem *pMem;            /* Memory cell used to store aggregate context */
  int isError;          /* Error code returned by the function. */
  CollSeq *pColl;       /* Collating sequence */
};

/*
** A Set structure is used for quick testing to see if a value
** is part of a small set.  Sets are used to implement code like
** this:
**            x.y IN ('hi','hoo','hum')
*/
typedef struct Set Set;
struct Set {
  Hash hash;             /* A set is just a hash table */
  HashElem *prev;        /* Previously accessed hash elemen */
};

/*
** A FifoPage structure holds a single page of valves.  Pages are arranged
** in a list.
*/
typedef struct FifoPage FifoPage;
struct FifoPage {
  int nSlot;         /* Number of entries aSlot[] */
  int iWrite;        /* Push the next value into this entry in aSlot[] */
  int iRead;         /* Read the next value from this entry in aSlot[] */
  FifoPage *pNext;   /* Next page in the fifo */
  i64 aSlot[1];      /* One or more slots for rowid values */
};

/*
** The Fifo structure is typedef-ed in vdbeInt.h.  But the implementation
** of that structure is private to this file.
**
** The Fifo structure describes the entire fifo.  
*/
typedef struct Fifo Fifo;
struct Fifo {
  int nEntry;         /* Total number of entries */
  sqlite3 *db;        /* The associated database connection */
  FifoPage *pFirst;   /* First page on the list */
  FifoPage *pLast;    /* Last page on the list */
};

/*
** A Context stores the last insert rowid, the last statement change count,
** and the current statement change count (i.e. changes since last statement).
** The current keylist is also stored in the context.
** Elements of Context structure type make up the ContextStack, which is
** updated by the ContextPush and ContextPop opcodes (used by triggers).
** The context is pushed before executing a trigger a popped when the
** trigger finishes.
*/
typedef struct Context Context;
struct Context {
  i64 lastRowid;    /* Last insert rowid (sqlite3.lastRowid) */
  int nChange;      /* Statement changes (Vdbe.nChanges)     */
  Fifo sFifo;       /* Records that will participate in a DELETE or UPDATE */
};

/*
** An instance of the virtual machine.  This structure contains the complete
** state of the virtual machine.
**
** The "sqlite3_stmt" structure pointer that is returned by sqlite3_compile()
** is really a pointer to an instance of this structure.
**
** The Vdbe.inVtabMethod variable is set to non-zero for the duration of
** any virtual table method invocations made by the vdbe program. It is
** set to 2 for xDestroy method calls and 1 for all other methods. This
** variable is used for two purposes: to allow xDestroy methods to execute
** "DROP TABLE" statements and to prevent some nasty side effects of
** malloc failure when SQLite is invoked recursively by a virtual table 
** method function.
*/
struct Vdbe {
  sqlite3 *db;        /* The whole database */
  Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */
  int nOp;            /* Number of instructions in the program */
  int nOpAlloc;       /* Number of slots allocated for aOp[] */
  Op *aOp;            /* Space to hold the virtual machine's program */
  int nLabel;         /* Number of labels used */
  int nLabelAlloc;    /* Number of slots allocated in aLabel[] */
  int *aLabel;        /* Space to hold the labels */
  Mem **apArg;        /* Arguments to currently executing user function */
  Mem *aColName;      /* Column names to return */
  int nCursor;        /* Number of slots in apCsr[] */
  Cursor **apCsr;     /* One element of this array for each open cursor */
  int nVar;           /* Number of entries in aVar[] */
  Mem *aVar;          /* Values for the OP_Variable opcode. */
  char **azVar;       /* Name of variables */
  int okVar;          /* True if azVar[] has been initialized */
  int magic;              /* Magic number for sanity checking */
  int nMem;               /* Number of memory locations currently allocated */
  Mem *aMem;              /* The memory locations */
  int nCallback;          /* Number of callbacks invoked so far */
  int cacheCtr;           /* Cursor row cache generation counter */
  Fifo sFifo;             /* A list of ROWIDs */
  int contextStackTop;    /* Index of top element in the context stack */
  int contextStackDepth;  /* The size of the "context" stack */
  Context *contextStack;  /* Stack used by opcodes ContextPush & ContextPop*/
  int pc;                 /* The program counter */
  int rc;                 /* Value to return */
  unsigned uniqueCnt;     /* Used by OP_MakeRecord when P2!=0 */
  int errorAction;        /* Recovery action to do in case of an error */
  int inTempTrans;        /* True if temp database is transactioned */
  int nResColumn;         /* Number of columns in one row of the result set */
  char **azResColumn;     /* Values for one row of result */ 
  char *zErrMsg;          /* Error message written here */
  Mem *pResultSet;        /* Pointer to an array of results */
  u8 explain;             /* True if EXPLAIN present on SQL command */
  u8 changeCntOn;         /* True to update the change-counter */
  u8 expired;             /* True if the VM needs to be recompiled */
  u8 minWriteFileFormat;  /* Minimum file format for writable database files */
  u8 inVtabMethod;        /* See comments above */
  int nChange;            /* Number of db changes made since last reset */
  i64 startTime;          /* Time when query started - used for profiling */
  int btreeMask;          /* Bitmask of db->aDb[] entries referenced */
  BtreeMutexArray aMutex; /* An array of Btree used here and needing locks */
  int nSql;             /* Number of bytes in zSql */
  char *zSql;           /* Text of the SQL statement that generated this */
#ifdef SQLITE_DEBUG
  FILE *trace;        /* Write an execution trace here, if not NULL */
#endif
  int openedStatement;  /* True if this VM has opened a statement journal */
#ifdef SQLITE_SSE
  int fetchId;          /* Statement number used by sqlite3_fetch_statement */
  int lru;              /* Counter used for LRU cache replacement */
#endif
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
  Vdbe *pLruPrev;
  Vdbe *pLruNext;
#endif
};

/*
** An instance of the following structure holds information about a
** single index record that has already been parsed out into individual
** values.
**
** A record is an object that contains one or more fields of data.
** Records are used to store the content of a table row and to store
** the key of an index.  A blob encoding of a record is created by
** the OP_MakeRecord opcode of the VDBE and is disassemblied by the
** OP_Column opcode.
**
** This structure holds a record that has already been disassembled
** into its constitutent fields.
*/
struct UnpackedRecord {
  KeyInfo *pKeyInfo;  /* Collation and sort-order information */
  u16 nField;         /* Number of entries in apMem[] */
  u8 needFree;        /* True if memory obtained from sqlite3_malloc() */
  u8 needDestroy;     /* True if apMem[]s should be destroyed on close */
  Mem *aMem;          /* Values */
};

/*
** 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 */
#define VDBE_MAGIC_HALT     0x519c2973    /* VDBE has completed execution */
#define VDBE_MAGIC_DEAD     0xb606c3c8    /* The VDBE has been deallocated */

/*
** Function prototypes
*/
void sqlite3VdbeFreeCursor(Vdbe *, Cursor*);
void sqliteVdbePopStack(Vdbe*,int);
int sqlite3VdbeCursorMoveto(Cursor*);
#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
void sqlite3VdbePrintOp(FILE*, int, Op*);
#endif
int sqlite3VdbeSerialTypeLen(u32);
u32 sqlite3VdbeSerialType(Mem*, int);
int sqlite3VdbeSerialPut(unsigned char*, int, Mem*, int);
int sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
void sqlite3VdbeDeleteAuxData(VdbeFunc*, int);

int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
int sqlite3VdbeIdxKeyCompare(Cursor*,UnpackedRecord *,int,const unsigned char*,int*);
int sqlite3VdbeIdxRowid(BtCursor *, i64 *);
int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*);
int sqlite3VdbeIdxRowidLen(const u8*, int, int*);
int sqlite3VdbeExec(Vdbe*);
int sqlite3VdbeList(Vdbe*);
int sqlite3VdbeHalt(Vdbe*);
int sqlite3VdbeChangeEncoding(Mem *, int);
int sqlite3VdbeMemTooBig(Mem*);
int sqlite3VdbeMemCopy(Mem*, const Mem*);
void sqlite3VdbeMemShallowCopy(Mem*, const Mem*, int);
void sqlite3VdbeMemMove(Mem*, Mem*);
int sqlite3VdbeMemNulTerminate(Mem*);
int sqlite3VdbeMemSetStr(Mem*, const char*, int, u8, void(*)(void*));
void sqlite3VdbeMemSetInt64(Mem*, i64);
void sqlite3VdbeMemSetDouble(Mem*, double);
void sqlite3VdbeMemSetNull(Mem*);
void sqlite3VdbeMemSetZeroBlob(Mem*,int);
int sqlite3VdbeMemMakeWriteable(Mem*);
int sqlite3VdbeMemStringify(Mem*, int);
i64 sqlite3VdbeIntValue(Mem*);
int sqlite3VdbeMemIntegerify(Mem*);
double sqlite3VdbeRealValue(Mem*);
void sqlite3VdbeIntegerAffinity(Mem*);
int sqlite3VdbeMemRealify(Mem*);
int sqlite3VdbeMemNumerify(Mem*);
int sqlite3VdbeMemFromBtree(BtCursor*,int,int,int,Mem*);
void sqlite3VdbeMemRelease(Mem *p);
void sqlite3VdbeMemReleaseExternal(Mem *p);
int sqlite3VdbeMemFinalize(Mem*, FuncDef*);
const char *sqlite3OpcodeName(int);
int sqlite3VdbeOpcodeHasProperty(int, int);
int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve);
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
int sqlite3VdbeReleaseBuffers(Vdbe *p);
#endif

#ifndef NDEBUG
  void sqlite3VdbeMemSanity(Mem*);
#endif
int sqlite3VdbeMemTranslate(Mem*, u8);
#ifdef SQLITE_DEBUG
  void sqlite3VdbePrintSql(Vdbe*);
  void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf);
#endif
int sqlite3VdbeMemHandleBom(Mem *pMem);
void sqlite3VdbeFifoInit(Fifo*, sqlite3*);
int sqlite3VdbeFifoPush(Fifo*, i64);
int sqlite3VdbeFifoPop(Fifo*, i64*);
void sqlite3VdbeFifoClear(Fifo*);

#ifndef SQLITE_OMIT_INCRBLOB
  int sqlite3VdbeMemExpandBlob(Mem *);
#else
  #define sqlite3VdbeMemExpandBlob(x) SQLITE_OK
#endif

#endif /* !defined(_VDBEINT_H_) */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/vdbeapi.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
/*
** 2004 May 26
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains code use to implement APIs that are part of the
** VDBE.
**
** $Id: vdbeapi.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"

#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
/*
** The following structure contains pointers to the end points of a
** doubly-linked list of all compiled SQL statements that may be holding
** buffers eligible for release when the sqlite3_release_memory() interface is
** invoked. Access to this list is protected by the SQLITE_MUTEX_STATIC_LRU2
** mutex.
**
** Statements are added to the end of this list when sqlite3_reset() is
** called. They are removed either when sqlite3_step() or sqlite3_finalize()
** is called. When statements are added to this list, the associated 
** register array (p->aMem[1..p->nMem]) may contain dynamic buffers that
** can be freed using sqlite3VdbeReleaseMemory().
**
** When statements are added or removed from this list, the mutex
** associated with the Vdbe being added or removed (Vdbe.db->mutex) is
** already held. The LRU2 mutex is then obtained, blocking if necessary,
** the linked-list pointers manipulated and the LRU2 mutex relinquished.
*/
struct StatementLruList {
  Vdbe *pFirst;
  Vdbe *pLast;
};
static struct StatementLruList sqlite3LruStatements;

/*
** Check that the list looks to be internally consistent. This is used
** as part of an assert() statement as follows:
**
**   assert( stmtLruCheck() );
*/
#ifndef NDEBUG
static int stmtLruCheck(){
  Vdbe *p;
  for(p=sqlite3LruStatements.pFirst; p; p=p->pLruNext){
    assert(p->pLruNext || p==sqlite3LruStatements.pLast);
    assert(!p->pLruNext || p->pLruNext->pLruPrev==p);
    assert(p->pLruPrev || p==sqlite3LruStatements.pFirst);
    assert(!p->pLruPrev || p->pLruPrev->pLruNext==p);
  }
  return 1;
}
#endif

/*
** Add vdbe p to the end of the statement lru list. It is assumed that
** p is not already part of the list when this is called. The lru list
** is protected by the SQLITE_MUTEX_STATIC_LRU mutex.
*/
static void stmtLruAdd(Vdbe *p){
  sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));

  if( p->pLruPrev || p->pLruNext || sqlite3LruStatements.pFirst==p ){
    sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));
    return;
  }

  assert( stmtLruCheck() );

  if( !sqlite3LruStatements.pFirst ){
    assert( !sqlite3LruStatements.pLast );
    sqlite3LruStatements.pFirst = p;
    sqlite3LruStatements.pLast = p;
  }else{
    assert( !sqlite3LruStatements.pLast->pLruNext );
    p->pLruPrev = sqlite3LruStatements.pLast;
    sqlite3LruStatements.pLast->pLruNext = p;
    sqlite3LruStatements.pLast = p;
  }

  assert( stmtLruCheck() );

  sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));
}

/*
** Assuming the SQLITE_MUTEX_STATIC_LRU2 mutext is already held, remove
** statement p from the least-recently-used statement list. If the 
** statement is not currently part of the list, this call is a no-op.
*/
static void stmtLruRemoveNomutex(Vdbe *p){
  if( p->pLruPrev || p->pLruNext || p==sqlite3LruStatements.pFirst ){
    assert( stmtLruCheck() );
    if( p->pLruNext ){
      p->pLruNext->pLruPrev = p->pLruPrev;
    }else{
      sqlite3LruStatements.pLast = p->pLruPrev;
    }
    if( p->pLruPrev ){
      p->pLruPrev->pLruNext = p->pLruNext;
    }else{
      sqlite3LruStatements.pFirst = p->pLruNext;
    }
    p->pLruNext = 0;
    p->pLruPrev = 0;
    assert( stmtLruCheck() );
  }
}

/*
** Assuming the SQLITE_MUTEX_STATIC_LRU2 mutext is not held, remove
** statement p from the least-recently-used statement list. If the 
** statement is not currently part of the list, this call is a no-op.
*/
static void stmtLruRemove(Vdbe *p){
  sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));
  stmtLruRemoveNomutex(p);
  sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));
}

/*
** Try to release n bytes of memory by freeing buffers associated 
** with the memory registers of currently unused vdbes.
*/
int sqlite3VdbeReleaseMemory(int n){
  Vdbe *p;
  Vdbe *pNext;
  int nFree = 0;

  sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));
  for(p=sqlite3LruStatements.pFirst; p && nFree<n; p=pNext){
    pNext = p->pLruNext;

    /* For each statement handle in the lru list, attempt to obtain the
    ** associated database mutex. If it cannot be obtained, continue
    ** to the next statement handle. It is not possible to block on
    ** the database mutex - that could cause deadlock.
    */
    if( SQLITE_OK==sqlite3_mutex_try(p->db->mutex) ){
      nFree += sqlite3VdbeReleaseBuffers(p);
      stmtLruRemoveNomutex(p);
      sqlite3_mutex_leave(p->db->mutex);
    }
  }
  sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_LRU2));

  return nFree;
}

/*
** Call sqlite3Reprepare() on the statement. Remove it from the
** lru list before doing so, as Reprepare() will free all the
** memory register buffers anyway.
*/
int vdbeReprepare(Vdbe *p){
  stmtLruRemove(p);
  return sqlite3Reprepare(p);
}

#else       /* !SQLITE_ENABLE_MEMORY_MANAGEMENT */
  #define stmtLruRemove(x)
  #define stmtLruAdd(x)
  #define vdbeReprepare(x) sqlite3Reprepare(x)
#endif


/*
** Return TRUE (non-zero) of the statement supplied as an argument needs
** to be recompiled.  A statement needs to be recompiled whenever the
** execution environment changes in a way that would alter the program
** that sqlite3_prepare() generates.  For example, if new functions or
** collating sequences are registered or if an authorizer function is
** added or changed.
*/
int sqlite3_expired(sqlite3_stmt *pStmt){
  Vdbe *p = (Vdbe*)pStmt;
  return p==0 || p->expired;
}

/*
** The following routine destroys a virtual machine that is created by
** the sqlite3_compile() routine. The integer returned is an SQLITE_
** success/failure code that describes the result of executing the virtual
** machine.
**
** This routine sets the error code and string returned by
** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().
*/
int sqlite3_finalize(sqlite3_stmt *pStmt){
  int rc;
  if( pStmt==0 ){
    rc = SQLITE_OK;
  }else{
    Vdbe *v = (Vdbe*)pStmt;
#ifndef SQLITE_MUTEX_NOOP
    sqlite3_mutex *mutex = v->db->mutex;
#endif
    sqlite3_mutex_enter(mutex);
    stmtLruRemove(v);
    rc = sqlite3VdbeFinalize(v);
    sqlite3_mutex_leave(mutex);
  }
  return rc;
}

/*
** Terminate the current execution of an SQL statement and reset it
** back to its starting state so that it can be reused. A success code from
** the prior execution is returned.
**
** This routine sets the error code and string returned by
** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16().
*/
int sqlite3_reset(sqlite3_stmt *pStmt){
  int rc;
  if( pStmt==0 ){
    rc = SQLITE_OK;
  }else{
    Vdbe *v = (Vdbe*)pStmt;
    sqlite3_mutex_enter(v->db->mutex);
    rc = sqlite3VdbeReset(v);
    stmtLruAdd(v);
    sqlite3VdbeMakeReady(v, -1, 0, 0, 0);
    assert( (rc & (v->db->errMask))==rc );
    sqlite3_mutex_leave(v->db->mutex);
  }
  return rc;
}

/*
** Set all the parameters in the compiled SQL statement to NULL.
*/
int sqlite3_clear_bindings(sqlite3_stmt *pStmt){
  int i;
  int rc = SQLITE_OK;
  Vdbe *p = (Vdbe*)pStmt;
#ifndef SQLITE_MUTEX_NOOP
  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_  *******************************
** The following routines extract information from a Mem or sqlite3_value
** structure.
*/
const void *sqlite3_value_blob(sqlite3_value *pVal){
  Mem *p = (Mem*)pVal;
  if( p->flags & (MEM_Blob|MEM_Str) ){
    sqlite3VdbeMemExpandBlob(p);
    p->flags &= ~MEM_Str;
    p->flags |= MEM_Blob;
    return p->z;
  }else{
    return sqlite3_value_text(pVal);
  }
}
int sqlite3_value_bytes(sqlite3_value *pVal){
  return sqlite3ValueBytes(pVal, SQLITE_UTF8);
}
int sqlite3_value_bytes16(sqlite3_value *pVal){
  return sqlite3ValueBytes(pVal, SQLITE_UTF16NATIVE);
}
double sqlite3_value_double(sqlite3_value *pVal){
  return sqlite3VdbeRealValue((Mem*)pVal);
}
int sqlite3_value_int(sqlite3_value *pVal){
  return sqlite3VdbeIntValue((Mem*)pVal);
}
sqlite_int64 sqlite3_value_int64(sqlite3_value *pVal){
  return sqlite3VdbeIntValue((Mem*)pVal);
}
const unsigned char *sqlite3_value_text(sqlite3_value *pVal){
  return (const unsigned char *)sqlite3ValueText(pVal, SQLITE_UTF8);
}
#ifndef SQLITE_OMIT_UTF16
const void *sqlite3_value_text16(sqlite3_value* pVal){
  return sqlite3ValueText(pVal, SQLITE_UTF16NATIVE);
}
const void *sqlite3_value_text16be(sqlite3_value *pVal){
  return sqlite3ValueText(pVal, SQLITE_UTF16BE);
}
const void *sqlite3_value_text16le(sqlite3_value *pVal){
  return sqlite3ValueText(pVal, SQLITE_UTF16LE);
}
#endif /* SQLITE_OMIT_UTF16 */
int sqlite3_value_type(sqlite3_value* pVal){
  return pVal->type;
}

/**************************** sqlite3_result_  *******************************
** The following routines are used by user-defined functions to specify
** the function result.
*/
void sqlite3_result_blob(
  sqlite3_context *pCtx, 
  const void *z, 
  int n, 
  void (*xDel)(void *)
){
  assert( n>=0 );
  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
  sqlite3VdbeMemSetStr(&pCtx->s, z, n, 0, xDel);
}
void sqlite3_result_double(sqlite3_context *pCtx, double rVal){
  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
  sqlite3VdbeMemSetDouble(&pCtx->s, rVal);
}
void sqlite3_result_error(sqlite3_context *pCtx, const char *z, int n){
  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
  pCtx->isError = SQLITE_ERROR;
  sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF8, SQLITE_TRANSIENT);
}
#ifndef SQLITE_OMIT_UTF16
void sqlite3_result_error16(sqlite3_context *pCtx, const void *z, int n){
  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
  pCtx->isError = SQLITE_ERROR;
  sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF16NATIVE, SQLITE_TRANSIENT);
}
#endif
void sqlite3_result_int(sqlite3_context *pCtx, int iVal){
  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
  sqlite3VdbeMemSetInt64(&pCtx->s, (i64)iVal);
}
void sqlite3_result_int64(sqlite3_context *pCtx, i64 iVal){
  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
  sqlite3VdbeMemSetInt64(&pCtx->s, iVal);
}
void sqlite3_result_null(sqlite3_context *pCtx){
  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
  sqlite3VdbeMemSetNull(&pCtx->s);
}
void sqlite3_result_text(
  sqlite3_context *pCtx, 
  const char *z, 
  int n,
  void (*xDel)(void *)
){
  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
  sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF8, xDel);
}
#ifndef SQLITE_OMIT_UTF16
void sqlite3_result_text16(
  sqlite3_context *pCtx, 
  const void *z, 
  int n, 
  void (*xDel)(void *)
){
  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
  sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF16NATIVE, xDel);
}
void sqlite3_result_text16be(
  sqlite3_context *pCtx, 
  const void *z, 
  int n, 
  void (*xDel)(void *)
){
  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
  sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF16BE, xDel);
}
void sqlite3_result_text16le(
  sqlite3_context *pCtx, 
  const void *z, 
  int n, 
  void (*xDel)(void *)
){
  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
  sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF16LE, xDel);
}
#endif /* SQLITE_OMIT_UTF16 */
void sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value *pValue){
  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
  sqlite3VdbeMemCopy(&pCtx->s, pValue);
}
void sqlite3_result_zeroblob(sqlite3_context *pCtx, int n){
  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
  sqlite3VdbeMemSetZeroBlob(&pCtx->s, n);
}
void sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){
  pCtx->isError = errCode;
}

/* Force an SQLITE_TOOBIG error. */
void sqlite3_result_error_toobig(sqlite3_context *pCtx){
  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
  pCtx->isError = SQLITE_TOOBIG;
  sqlite3VdbeMemSetStr(&pCtx->s, "string or blob too big", -1, 
                       SQLITE_UTF8, SQLITE_STATIC);
}

/* An SQLITE_NOMEM error. */
void sqlite3_result_error_nomem(sqlite3_context *pCtx){
  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
  sqlite3VdbeMemSetNull(&pCtx->s);
  pCtx->isError = SQLITE_NOMEM;
  pCtx->s.db->mallocFailed = 1;
}

/*
** Execute the statement pStmt, either until a row of data is ready, the
** statement is completely executed or an error occurs.
**
** This routine implements the bulk of the logic behind the sqlite_step()
** API.  The only thing omitted is the automatic recompile if a 
** schema change has occurred.  That detail is handled by the
** outer sqlite3_step() wrapper procedure.
*/
static int sqlite3Step(Vdbe *p){
  sqlite3 *db;
  int rc;

  assert(p);
  if( p->magic!=VDBE_MAGIC_RUN ){
    return SQLITE_MISUSE;
  }

  /* Assert that malloc() has not failed */
  db = p->db;
  assert( !db->mallocFailed );

  if( p->pc<=0 && p->expired ){
    if( p->rc==SQLITE_OK ){
      p->rc = SQLITE_SCHEMA;
    }
    rc = SQLITE_ERROR;
    goto end_of_step;
  }
  if( sqlite3SafetyOn(db) ){
    p->rc = SQLITE_MISUSE;
    return SQLITE_MISUSE;
  }
  if( p->pc<0 ){
    /* If there are no other statements currently running, then
    ** reset the interrupt flag.  This prevents a call to sqlite3_interrupt
    ** from interrupting a statement that has not yet started.
    */
    if( db->activeVdbeCnt==0 ){
      db->u1.isInterrupted = 0;
    }

#ifndef SQLITE_OMIT_TRACE
    if( db->xProfile && !db->init.busy ){
      double rNow;
      sqlite3OsCurrentTime(db->pVfs, &rNow);
      p->startTime = (rNow - (int)rNow)*3600.0*24.0*1000000000.0;
    }
#endif

    db->activeVdbeCnt++;
    p->pc = 0;
    stmtLruRemove(p);
  }
#ifndef SQLITE_OMIT_EXPLAIN
  if( p->explain ){
    rc = sqlite3VdbeList(p);
  }else
#endif /* SQLITE_OMIT_EXPLAIN */
  {
    rc = sqlite3VdbeExec(p);
  }

  if( sqlite3SafetyOff(db) ){
    rc = SQLITE_MISUSE;
  }

#ifndef SQLITE_OMIT_TRACE
  /* Invoke the profile callback if there is one
  */
  if( rc!=SQLITE_ROW && db->xProfile && !db->init.busy && p->nOp>0
           && p->aOp[0].opcode==OP_Trace && p->aOp[0].p4.z!=0 ){
    double rNow;
    u64 elapseTime;

    sqlite3OsCurrentTime(db->pVfs, &rNow);
    elapseTime = (rNow - (int)rNow)*3600.0*24.0*1000000000.0 - p->startTime;
    db->xProfile(db->pProfileArg, p->aOp[0].p4.z, elapseTime);
  }
#endif

  db->errCode = rc;
  /*sqlite3Error(p->db, rc, 0);*/
  p->rc = sqlite3ApiExit(p->db, p->rc);
end_of_step:
  assert( (rc&0xff)==rc );
  if( p->zSql && (rc&0xff)<SQLITE_ROW ){
    /* This behavior occurs if sqlite3_prepare_v2() was used to build
    ** the prepared statement.  Return error codes directly */
    p->db->errCode = p->rc;
    /* sqlite3Error(p->db, p->rc, 0); */
    return p->rc;
  }else{
    /* This is for legacy sqlite3_prepare() builds and when the code
    ** is SQLITE_ROW or SQLITE_DONE */
    return rc;
  }
}

/*
** This is the top-level implementation of sqlite3_step().  Call
** sqlite3Step() to do most of the work.  If a schema error occurs,
** call sqlite3Reprepare() and try again.
*/
#ifdef SQLITE_OMIT_PARSER
int sqlite3_step(sqlite3_stmt *pStmt){
  int rc = SQLITE_MISUSE;
  if( pStmt ){
    Vdbe *v;
    v = (Vdbe*)pStmt;
    sqlite3_mutex_enter(v->db->mutex);
    rc = sqlite3Step(v);
    sqlite3_mutex_leave(v->db->mutex);
  }
  return rc;
}
#else
int sqlite3_step(sqlite3_stmt *pStmt){
  int rc = SQLITE_MISUSE;
  if( pStmt ){
    int cnt = 0;
    Vdbe *v = (Vdbe*)pStmt;
    sqlite3 *db = v->db;
    sqlite3_mutex_enter(db->mutex);
    while( (rc = sqlite3Step(v))==SQLITE_SCHEMA
           && cnt++ < 5
           && vdbeReprepare(v) ){
      sqlite3_reset(pStmt);
      v->expired = 0;
    }
    if( rc==SQLITE_SCHEMA && v->zSql && db->pErr ){
      /* This case occurs after failing to recompile an sql statement. 
      ** The error message from the SQL compiler has already been loaded 
      ** into the database handle. This block copies the error message 
      ** from the database handle into the statement and sets the statement
      ** program counter to 0 to ensure that when the statement is 
      ** finalized or reset the parser error message is available via
      ** sqlite3_errmsg() and sqlite3_errcode().
      */
      const char *zErr = (const char *)sqlite3_value_text(db->pErr); 
      sqlite3DbFree(db, v->zErrMsg);
      if( !db->mallocFailed ){
        v->zErrMsg = sqlite3DbStrDup(db, zErr);
      } else {
        v->zErrMsg = 0;
        v->rc = SQLITE_NOMEM;
      }
    }
    rc = sqlite3ApiExit(db, rc);
    sqlite3_mutex_leave(db->mutex);
  }
  return rc;
}
#endif

/*
** Extract the user data from a sqlite3_context structure and return a
** pointer to it.
*/
void *sqlite3_user_data(sqlite3_context *p){
  assert( p && p->pFunc );
  return p->pFunc->pUserData;
}

/*
** Extract the user data from a sqlite3_context structure and return a
** pointer to it.
*/
sqlite3 *sqlite3_context_db_handle(sqlite3_context *p){
  assert( p && p->pFunc );
  return p->s.db;
}

/*
** The following is the implementation of an SQL function that always
** fails with an error message stating that the function is used in the
** wrong context.  The sqlite3_overload_function() API might construct
** SQL function that use this routine so that the functions will exist
** for name resolution but are actually overloaded by the xFindFunction
** method of virtual tables.
*/
void sqlite3InvalidFunction(
  sqlite3_context *context,  /* The function calling context */
  int argc,                  /* Number of arguments to the function */
  sqlite3_value **argv       /* Value of each argument */
){
  const char *zName = context->pFunc->zName;
  char *zErr;
  zErr = sqlite3MPrintf(0,
      "unable to use function %s in the requested context", zName);
  sqlite3_result_error(context, zErr, -1);
  sqlite3_free(zErr);
}

/*
** Allocate or return the aggregate context for a user function.  A new
** context is allocated on the first call.  Subsequent calls return the
** same context that was returned on prior calls.
*/
void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){
  Mem *pMem;
  assert( p && p->pFunc && p->pFunc->xStep );
  assert( sqlite3_mutex_held(p->s.db->mutex) );
  pMem = p->pMem;
  if( (pMem->flags & MEM_Agg)==0 ){
    if( nByte==0 ){
      sqlite3VdbeMemReleaseExternal(pMem);
      pMem->flags = MEM_Null;
      pMem->z = 0;
    }else{
      sqlite3VdbeMemGrow(pMem, nByte, 0);
      pMem->flags = MEM_Agg;
      pMem->u.pDef = p->pFunc;
      if( pMem->z ){
        memset(pMem->z, 0, nByte);
      }
    }
  }
  return (void*)pMem->z;
}

/*
** Return the auxilary data pointer, if any, for the iArg'th argument to
** the user-function defined by pCtx.
*/
void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){
  VdbeFunc *pVdbeFunc;

  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
  pVdbeFunc = pCtx->pVdbeFunc;
  if( !pVdbeFunc || iArg>=pVdbeFunc->nAux || iArg<0 ){
    return 0;
  }
  return pVdbeFunc->apAux[iArg].pAux;
}

/*
** Set the auxilary data pointer and delete function, for the iArg'th
** argument to the user-function defined by pCtx. Any previous value is
** deleted by calling the delete function specified when it was set.
*/
void sqlite3_set_auxdata(
  sqlite3_context *pCtx, 
  int iArg, 
  void *pAux, 
  void (*xDelete)(void*)
){
  struct AuxData *pAuxData;
  VdbeFunc *pVdbeFunc;
  if( iArg<0 ) goto failed;

  assert( sqlite3_mutex_held(pCtx->s.db->mutex) );
  pVdbeFunc = pCtx->pVdbeFunc;
  if( !pVdbeFunc || pVdbeFunc->nAux<=iArg ){
    int nAux = (pVdbeFunc ? pVdbeFunc->nAux : 0);
    int nMalloc = sizeof(VdbeFunc) + sizeof(struct AuxData)*iArg;
    pVdbeFunc = sqlite3DbRealloc(pCtx->s.db, pVdbeFunc, nMalloc);
    if( !pVdbeFunc ){
      goto failed;
    }
    pCtx->pVdbeFunc = pVdbeFunc;
    memset(&pVdbeFunc->apAux[nAux], 0, sizeof(struct AuxData)*(iArg+1-nAux));
    pVdbeFunc->nAux = iArg+1;
    pVdbeFunc->pFunc = pCtx->pFunc;
  }

  pAuxData = &pVdbeFunc->apAux[iArg];
  if( pAuxData->pAux && pAuxData->xDelete ){
    pAuxData->xDelete(pAuxData->pAux);
  }
  pAuxData->pAux = pAux;
  pAuxData->xDelete = xDelete;
  return;

failed:
  if( xDelete ){
    xDelete(pAux);
  }
}

/*
** Return the number of times the Step function of a aggregate has been 
** called.
**
** This function is deprecated.  Do not use it for new code.  It is
** provide only to avoid breaking legacy code.  New aggregate function
** implementations should keep their own counts within their aggregate
** context.
*/
int sqlite3_aggregate_count(sqlite3_context *p){
  assert( p && p->pFunc && p->pFunc->xStep );
  return p->pMem->n;
}

/*
** Return the number of columns in the result set for the statement pStmt.
*/
int sqlite3_column_count(sqlite3_stmt *pStmt){
  Vdbe *pVm = (Vdbe *)pStmt;
  return pVm ? pVm->nResColumn : 0;
}

/*
** Return the number of values available from the current row of the
** currently executing statement pStmt.
*/
int sqlite3_data_count(sqlite3_stmt *pStmt){
  Vdbe *pVm = (Vdbe *)pStmt;
  if( pVm==0 || pVm->pResultSet==0 ) return 0;
  return pVm->nResColumn;
}


/*
** Check to see if column iCol of the given statement is valid.  If
** it is, return a pointer to the Mem for the value of that column.
** If iCol is not valid, return a pointer to a Mem which has a value
** of NULL.
*/
static Mem *columnMem(sqlite3_stmt *pStmt, int i){
  Vdbe *pVm;
  int vals;
  Mem *pOut;

  pVm = (Vdbe *)pStmt;
  if( pVm && pVm->pResultSet!=0 && i<pVm->nResColumn && i>=0 ){
    sqlite3_mutex_enter(pVm->db->mutex);
    vals = sqlite3_data_count(pStmt);
    pOut = &pVm->pResultSet[i];
  }else{
    static const Mem nullMem = {{0}, 0.0, 0, "", 0, MEM_Null, SQLITE_NULL, 0, 0, 0 };
    if( pVm->db ){
      sqlite3_mutex_enter(pVm->db->mutex);
      sqlite3Error(pVm->db, SQLITE_RANGE, 0);
    }
    pOut = (Mem*)&nullMem;
  }
  return pOut;
}

/*
** This function is called after invoking an sqlite3_value_XXX function on a 
** column value (i.e. a value returned by evaluating an SQL expression in the
** select list of a SELECT statement) that may cause a malloc() failure. If 
** malloc() has failed, the threads mallocFailed flag is cleared and the result
** code of statement pStmt set to SQLITE_NOMEM.
**
** Specifically, this is called from within:
**
**     sqlite3_column_int()
**     sqlite3_column_int64()
**     sqlite3_column_text()
**     sqlite3_column_text16()
**     sqlite3_column_real()
**     sqlite3_column_bytes()
**     sqlite3_column_bytes16()
**
** But not for sqlite3_column_blob(), which never calls malloc().
*/
static void columnMallocFailure(sqlite3_stmt *pStmt)
{
  /* If malloc() failed during an encoding conversion within an
  ** sqlite3_column_XXX API, then set the return code of the statement to
  ** SQLITE_NOMEM. The next call to _step() (if any) will return SQLITE_ERROR
  ** and _finalize() will return NOMEM.
  */
  Vdbe *p = (Vdbe *)pStmt;
  if( p ){
    p->rc = sqlite3ApiExit(p->db, p->rc);
    sqlite3_mutex_leave(p->db->mutex);
  }
}

/**************************** sqlite3_column_  *******************************
** The following routines are used to access elements of the current row
** in the result set.
*/
const void *sqlite3_column_blob(sqlite3_stmt *pStmt, int i){
  const void *val;
  val = sqlite3_value_blob( columnMem(pStmt,i) );
  /* Even though there is no encoding conversion, value_blob() might
  ** need to call malloc() to expand the result of a zeroblob() 
  ** expression. 
  */
  columnMallocFailure(pStmt);
  return val;
}
int sqlite3_column_bytes(sqlite3_stmt *pStmt, int i){
  int val = sqlite3_value_bytes( columnMem(pStmt,i) );
  columnMallocFailure(pStmt);
  return val;
}
int sqlite3_column_bytes16(sqlite3_stmt *pStmt, int i){
  int val = sqlite3_value_bytes16( columnMem(pStmt,i) );
  columnMallocFailure(pStmt);
  return val;
}
double sqlite3_column_double(sqlite3_stmt *pStmt, int i){
  double val = sqlite3_value_double( columnMem(pStmt,i) );
  columnMallocFailure(pStmt);
  return val;
}
int sqlite3_column_int(sqlite3_stmt *pStmt, int i){
  int val = sqlite3_value_int( columnMem(pStmt,i) );
  columnMallocFailure(pStmt);
  return val;
}
sqlite_int64 sqlite3_column_int64(sqlite3_stmt *pStmt, int i){
  sqlite_int64 val = sqlite3_value_int64( columnMem(pStmt,i) );
  columnMallocFailure(pStmt);
  return val;
}
const unsigned char *sqlite3_column_text(sqlite3_stmt *pStmt, int i){
  const unsigned char *val = sqlite3_value_text( columnMem(pStmt,i) );
  columnMallocFailure(pStmt);
  return val;
}
sqlite3_value *sqlite3_column_value(sqlite3_stmt *pStmt, int i){
  sqlite3_value *pOut = columnMem(pStmt, i);
  columnMallocFailure(pStmt);
  return pOut;
}
#ifndef SQLITE_OMIT_UTF16
const void *sqlite3_column_text16(sqlite3_stmt *pStmt, int i){
  const void *val = sqlite3_value_text16( columnMem(pStmt,i) );
  columnMallocFailure(pStmt);
  return val;
}
#endif /* SQLITE_OMIT_UTF16 */
int sqlite3_column_type(sqlite3_stmt *pStmt, int i){
  int iType = sqlite3_value_type( columnMem(pStmt,i) );
  columnMallocFailure(pStmt);
  return iType;
}

/* The following function is experimental and subject to change or
** removal */
/*int sqlite3_column_numeric_type(sqlite3_stmt *pStmt, int i){
**  return sqlite3_value_numeric_type( columnMem(pStmt,i) );
**}
*/

/*
** Convert the N-th element of pStmt->pColName[] into a string using
** xFunc() then return that string.  If N is out of range, return 0.
**
** There are up to 5 names for each column.  useType determines which
** name is returned.  Here are the names:
**
**    0      The column name as it should be displayed for output
**    1      The datatype name for the column
**    2      The name of the database that the column derives from
**    3      The name of the table that the column derives from
**    4      The name of the table column that the result column derives from
**
** If the result is not a simple column reference (if it is an expression
** or a constant) then useTypes 2, 3, and 4 return NULL.
*/
static const void *columnName(
  sqlite3_stmt *pStmt,
  int N,
  const void *(*xFunc)(Mem*),
  int useType
){
  const void *ret = 0;
  Vdbe *p = (Vdbe *)pStmt;
  int n;
  

  if( p!=0 ){
    n = sqlite3_column_count(pStmt);
    if( N<n && N>=0 ){
      N += useType*n;
      sqlite3_mutex_enter(p->db->mutex);
      ret = xFunc(&p->aColName[N]);

      /* A malloc may have failed inside of the xFunc() call. If this
      ** is the case, clear the mallocFailed flag and return NULL.
      */
      if( p->db && p->db->mallocFailed ){
        p->db->mallocFailed = 0;
        ret = 0;
      }
      sqlite3_mutex_leave(p->db->mutex);
    }
  }
  return ret;
}

/*
** Return the name of the Nth column of the result set returned by SQL
** statement pStmt.
*/
const char *sqlite3_column_name(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_NAME);
}
#ifndef SQLITE_OMIT_UTF16
const void *sqlite3_column_name16(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_NAME);
}
#endif

/*
** Constraint:  If you have ENABLE_COLUMN_METADATA then you must
** not define OMIT_DECLTYPE.
*/
#if defined(SQLITE_OMIT_DECLTYPE) && defined(SQLITE_ENABLE_COLUMN_METADATA)
# error "Must not define both SQLITE_OMIT_DECLTYPE \
         and SQLITE_ENABLE_COLUMN_METADATA"
#endif

#ifndef SQLITE_OMIT_DECLTYPE
/*
** Return the column declaration type (if applicable) of the 'i'th column
** of the result set of SQL statement pStmt.
*/
const char *sqlite3_column_decltype(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DECLTYPE);
}
#ifndef SQLITE_OMIT_UTF16
const void *sqlite3_column_decltype16(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DECLTYPE);
}
#endif /* SQLITE_OMIT_UTF16 */
#endif /* SQLITE_OMIT_DECLTYPE */

#ifdef SQLITE_ENABLE_COLUMN_METADATA
/*
** Return the name of the database from which a result column derives.
** NULL is returned if the result column is an expression or constant or
** anything else which is not an unabiguous reference to a database column.
*/
const char *sqlite3_column_database_name(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DATABASE);
}
#ifndef SQLITE_OMIT_UTF16
const void *sqlite3_column_database_name16(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DATABASE);
}
#endif /* SQLITE_OMIT_UTF16 */

/*
** Return the name of the table from which a result column derives.
** NULL is returned if the result column is an expression or constant or
** anything else which is not an unabiguous reference to a database column.
*/
const char *sqlite3_column_table_name(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_TABLE);
}
#ifndef SQLITE_OMIT_UTF16
const void *sqlite3_column_table_name16(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_TABLE);
}
#endif /* SQLITE_OMIT_UTF16 */

/*
** Return the name of the table column from which a result column derives.
** NULL is returned if the result column is an expression or constant or
** anything else which is not an unabiguous reference to a database column.
*/
const char *sqlite3_column_origin_name(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_COLUMN);
}
#ifndef SQLITE_OMIT_UTF16
const void *sqlite3_column_origin_name16(sqlite3_stmt *pStmt, int N){
  return columnName(
      pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_COLUMN);
}
#endif /* SQLITE_OMIT_UTF16 */
#endif /* SQLITE_ENABLE_COLUMN_METADATA */


/******************************* sqlite3_bind_  ***************************
** 
** Routines used to attach values to wildcards in a compiled SQL statement.
*/
/*
** Unbind the value bound to variable i in virtual machine p. This is the 
** the same as binding a NULL value to the column. If the "i" parameter is
** out of range, then SQLITE_RANGE is returned. Othewise SQLITE_OK.
**
** The error code stored in database p->db is overwritten with the return
** value in any case.
*/
static int vdbeUnbind(Vdbe *p, int i){
  Mem *pVar;
  if( p==0 || p->magic!=VDBE_MAGIC_RUN || p->pc>=0 ){
    if( p ) sqlite3Error(p->db, SQLITE_MISUSE, 0);
    return SQLITE_MISUSE;
  }
  if( i<1 || i>p->nVar ){
    sqlite3Error(p->db, SQLITE_RANGE, 0);
    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(
  sqlite3_stmt *pStmt,   /* The statement to bind against */
  int i,                 /* Index of the parameter to bind */
  const void *zData,     /* Pointer to the data to be bound */
  int nData,             /* Number of bytes of data to be bound */
  void (*xDel)(void*),   /* Destructor for the data */
  int encoding           /* Encoding for the data */
){
  Vdbe *p = (Vdbe *)pStmt;
  Mem *pVar;
  int rc;

  if( p==0 ){
    return SQLITE_MISUSE;
  }
  sqlite3_mutex_enter(p->db->mutex);
  rc = vdbeUnbind(p, i);
  if( rc==SQLITE_OK && zData!=0 ){
    pVar = &p->aVar[i-1];
    rc = sqlite3VdbeMemSetStr(pVar, zData, nData, encoding, xDel);
    if( rc==SQLITE_OK && encoding!=0 ){
      rc = sqlite3VdbeChangeEncoding(pVar, ENC(p->db));
    }
    sqlite3Error(p->db, rc, 0);
    rc = sqlite3ApiExit(p->db, rc);
  }
  sqlite3_mutex_leave(p->db->mutex);
  return rc;
}


/*
** Bind a blob value to an SQL statement variable.
*/
int sqlite3_bind_blob(
  sqlite3_stmt *pStmt, 
  int i, 
  const void *zData, 
  int nData, 
  void (*xDel)(void*)
){
  return bindText(pStmt, i, zData, nData, xDel, 0);
}
int sqlite3_bind_double(sqlite3_stmt *pStmt, int i, double rValue){
  int rc;
  Vdbe *p = (Vdbe *)pStmt;
  sqlite3_mutex_enter(p->db->mutex);
  rc = vdbeUnbind(p, i);
  if( rc==SQLITE_OK ){
    sqlite3VdbeMemSetDouble(&p->aVar[i-1], rValue);
  }
  sqlite3_mutex_leave(p->db->mutex);
  return rc;
}
int sqlite3_bind_int(sqlite3_stmt *p, int i, int iValue){
  return sqlite3_bind_int64(p, i, (i64)iValue);
}
int sqlite3_bind_int64(sqlite3_stmt *pStmt, int i, sqlite_int64 iValue){
  int rc;
  Vdbe *p = (Vdbe *)pStmt;
  sqlite3_mutex_enter(p->db->mutex);
  rc = vdbeUnbind(p, i);
  if( rc==SQLITE_OK ){
    sqlite3VdbeMemSetInt64(&p->aVar[i-1], iValue);
  }
  sqlite3_mutex_leave(p->db->mutex);
  return rc;
}
int sqlite3_bind_null(sqlite3_stmt *pStmt, int i){
  int rc;
  Vdbe *p = (Vdbe*)pStmt;
  sqlite3_mutex_enter(p->db->mutex);
  rc = vdbeUnbind(p, i);
  sqlite3_mutex_leave(p->db->mutex);
  return rc;
}
int sqlite3_bind_text( 
  sqlite3_stmt *pStmt, 
  int i, 
  const char *zData, 
  int nData, 
  void (*xDel)(void*)
){
  return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF8);
}
#ifndef SQLITE_OMIT_UTF16
int sqlite3_bind_text16(
  sqlite3_stmt *pStmt, 
  int i, 
  const void *zData, 
  int nData, 
  void (*xDel)(void*)
){
  return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF16NATIVE);
}
#endif /* SQLITE_OMIT_UTF16 */
int sqlite3_bind_value(sqlite3_stmt *pStmt, int i, const sqlite3_value *pValue){
  int rc;
  Vdbe *p = (Vdbe *)pStmt;
  sqlite3_mutex_enter(p->db->mutex);
  rc = vdbeUnbind(p, i);
  if( rc==SQLITE_OK ){
    rc = sqlite3VdbeMemCopy(&p->aVar[i-1], pValue);
    if( rc==SQLITE_OK ){
      rc = sqlite3VdbeChangeEncoding(&p->aVar[i-1], ENC(p->db));
    }
  }
  rc = sqlite3ApiExit(p->db, rc);
  sqlite3_mutex_leave(p->db->mutex);
  return rc;
}
int sqlite3_bind_zeroblob(sqlite3_stmt *pStmt, int i, int n){
  int rc;
  Vdbe *p = (Vdbe *)pStmt;
  sqlite3_mutex_enter(p->db->mutex);
  rc = vdbeUnbind(p, i);
  if( rc==SQLITE_OK ){
    sqlite3VdbeMemSetZeroBlob(&p->aVar[i-1], n);
  }
  sqlite3_mutex_leave(p->db->mutex);
  return rc;
}

/*
** Return the number of wildcards that can be potentially bound to.
** This routine is added to support DBD::SQLite.  
*/
int sqlite3_bind_parameter_count(sqlite3_stmt *pStmt){
  Vdbe *p = (Vdbe*)pStmt;
  return p ? p->nVar : 0;
}

/*
** Create a mapping from variable numbers to variable names
** in the Vdbe.azVar[] array, if such a mapping does not already
** exist.
*/
static void createVarMap(Vdbe *p){
  if( !p->okVar ){
    sqlite3_mutex_enter(p->db->mutex);
    if( !p->okVar ){
      int j;
      Op *pOp;
      for(j=0, pOp=p->aOp; j<p->nOp; j++, pOp++){
        if( pOp->opcode==OP_Variable ){
          assert( pOp->p1>0 && pOp->p1<=p->nVar );
          p->azVar[pOp->p1-1] = pOp->p4.z;
        }
      }
      p->okVar = 1;
    }
    sqlite3_mutex_leave(p->db->mutex);
  }
}

/*
** Return the name of a wildcard parameter.  Return NULL if the index
** is out of range or if the wildcard is unnamed.
**
** The result is always UTF-8.
*/
const char *sqlite3_bind_parameter_name(sqlite3_stmt *pStmt, int i){
  Vdbe *p = (Vdbe*)pStmt;
  if( p==0 || i<1 || i>p->nVar ){
    return 0;
  }
  createVarMap(p);
  return p->azVar[i-1];
}

/*
** Given a wildcard parameter name, return the index of the variable
** with that name.  If there is no variable with the given name,
** return 0.
*/
int sqlite3_bind_parameter_index(sqlite3_stmt *pStmt, const char *zName){
  Vdbe *p = (Vdbe*)pStmt;
  int i;
  if( p==0 ){
    return 0;
  }
  createVarMap(p); 
  if( zName ){
    for(i=0; i<p->nVar; i++){
      const char *z = p->azVar[i];
      if( z && strcmp(z,zName)==0 ){
        return i+1;
      }
    }
  }
  return 0;
}

/*
** Transfer all bindings from the first statement over to the second.
** If the two statements contain a different number of bindings, then
** an SQLITE_ERROR is returned.
*/
int sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){
  Vdbe *pFrom = (Vdbe*)pFromStmt;
  Vdbe *pTo = (Vdbe*)pToStmt;
  int i, rc = SQLITE_OK;
  if( (pFrom->magic!=VDBE_MAGIC_RUN && pFrom->magic!=VDBE_MAGIC_HALT)
    || (pTo->magic!=VDBE_MAGIC_RUN && pTo->magic!=VDBE_MAGIC_HALT)
    || pTo->db!=pFrom->db ){
    return SQLITE_MISUSE;
  }
  if( pFrom->nVar!=pTo->nVar ){
    return SQLITE_ERROR;
  }
  sqlite3_mutex_enter(pTo->db->mutex);
  for(i=0; rc==SQLITE_OK && i<pFrom->nVar; i++){
    sqlite3VdbeMemMove(&pTo->aVar[i], &pFrom->aVar[i]);
  }
  sqlite3_mutex_leave(pTo->db->mutex);
  assert( rc==SQLITE_OK || rc==SQLITE_NOMEM );
  return rc;
}

/*
** Return the sqlite3* database handle to which the prepared statement given
** in the argument belongs.  This is the same database handle that was
** the first argument to the sqlite3_prepare() that was used to create
** the statement in the first place.
*/
sqlite3 *sqlite3_db_handle(sqlite3_stmt *pStmt){
  return pStmt ? ((Vdbe*)pStmt)->db : 0;
}

/*
** Return a pointer to the next prepared statement after pStmt associated
** with database connection pDb.  If pStmt is NULL, return the first
** prepared statement for the database connection.  Return NULL if there
** are no more.
*/
sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt){
  sqlite3_stmt *pNext;
  sqlite3_mutex_enter(pDb->mutex);
  if( pStmt==0 ){
    pNext = (sqlite3_stmt*)pDb->pVdbe;
  }else{
    pNext = (sqlite3_stmt*)((Vdbe*)pStmt)->pNext;
  }
  sqlite3_mutex_leave(pDb->mutex);
  return pNext;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/vdbeaux.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
/*
** 2003 September 6
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used for creating, destroying, and populating
** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.)  Prior
** to version 2.8.7, all this code was combined into the vdbe.c source file.
** But that file was getting too big so this subroutines were split out.
**
** $Id: vdbeaux.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
#include "vdbeInt.h"



/*
** When debugging the code generator in a symbolic debugger, one can
** set the sqlite3VdbeAddopTrace to 1 and all opcodes will be printed
** as they are added to the instruction stream.
*/
#ifdef SQLITE_DEBUG
int sqlite3VdbeAddopTrace = 0;
#endif


/*
** Create a new virtual database engine.
*/
Vdbe *sqlite3VdbeCreate(sqlite3 *db){
  Vdbe *p;
  p = sqlite3DbMallocZero(db, sizeof(Vdbe) );
  if( p==0 ) return 0;
  p->db = db;
  if( db->pVdbe ){
    db->pVdbe->pPrev = p;
  }
  p->pNext = db->pVdbe;
  p->pPrev = 0;
  db->pVdbe = p;
  p->magic = VDBE_MAGIC_INIT;
  return p;
}

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

/*
** Return the SQL associated with a prepared statement
*/
const char *sqlite3_sql(sqlite3_stmt *pStmt){
  return ((Vdbe *)pStmt)->zSql;
}

/*
** Swap all content between two VDBE structures.
*/
void sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){
  Vdbe tmp, *pTmp;
  char *zTmp;
  int nTmp;
  tmp = *pA;
  *pA = *pB;
  *pB = tmp;
  pTmp = pA->pNext;
  pA->pNext = pB->pNext;
  pB->pNext = pTmp;
  pTmp = pA->pPrev;
  pA->pPrev = pB->pPrev;
  pB->pPrev = pTmp;
  zTmp = pA->zSql;
  pA->zSql = pB->zSql;
  pB->zSql = zTmp;
  nTmp = pA->nSql;
  pA->nSql = pB->nSql;
  pB->nSql = nTmp;
}

#ifdef SQLITE_DEBUG
/*
** Turn tracing on or off
*/
void sqlite3VdbeTrace(Vdbe *p, FILE *trace){
  p->trace = trace;
}
#endif

/*
** Resize the Vdbe.aOp array so that it contains at least N
** elements.
**
** If an out-of-memory error occurs while resizing the array,
** Vdbe.aOp and Vdbe.nOpAlloc remain unchanged (this is so that
** any opcodes already allocated can be correctly deallocated
** along with the rest of the Vdbe).
*/
static void resizeOpArray(Vdbe *p, int N){
  VdbeOp *pNew;
  pNew = sqlite3DbRealloc(p->db, p->aOp, N*sizeof(Op));
  if( pNew ){
    p->nOpAlloc = N;
    p->aOp = pNew;
  }
}

/*
** Add a new instruction to the list of instructions current in the
** VDBE.  Return the address of the new instruction.
**
** Parameters:
**
**    p               Pointer to the VDBE
**
**    op              The opcode for this instruction
**
**    p1, p2, p3      Operands
**
** Use the sqlite3VdbeResolveLabel() function to fix an address and
** the sqlite3VdbeChangeP4() function to change the value of the P4
** operand.
*/
int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){
  int i;
  VdbeOp *pOp;

  i = p->nOp;
  assert( p->magic==VDBE_MAGIC_INIT );
  if( p->nOpAlloc<=i ){
    resizeOpArray(p, p->nOpAlloc ? p->nOpAlloc*2 : 1024/sizeof(Op));
    if( p->db->mallocFailed ){
      return 0;
    }
  }
  p->nOp++;
  pOp = &p->aOp[i];
  pOp->opcode = op;
  pOp->p5 = 0;
  pOp->p1 = p1;
  pOp->p2 = p2;
  pOp->p3 = p3;
  pOp->p4.p = 0;
  pOp->p4type = P4_NOTUSED;
  p->expired = 0;
#ifdef SQLITE_DEBUG
  pOp->zComment = 0;
  if( sqlite3VdbeAddopTrace ) sqlite3VdbePrintOp(0, i, &p->aOp[i]);
#endif
#ifdef VDBE_PROFILE
  pOp->cycles = 0;
  pOp->cnt = 0;
#endif
  return i;
}
int sqlite3VdbeAddOp0(Vdbe *p, int op){
  return sqlite3VdbeAddOp3(p, op, 0, 0, 0);
}
int sqlite3VdbeAddOp1(Vdbe *p, int op, int p1){
  return sqlite3VdbeAddOp3(p, op, p1, 0, 0);
}
int sqlite3VdbeAddOp2(Vdbe *p, int op, int p1, int p2){
  return sqlite3VdbeAddOp3(p, op, p1, p2, 0);
}


/*
** Add an opcode that includes the p4 value as a pointer.
*/
int sqlite3VdbeAddOp4(
  Vdbe *p,            /* Add the opcode to this VM */
  int op,             /* The new opcode */
  int p1,             /* The P1 operand */
  int p2,             /* The P2 operand */
  int p3,             /* The P3 operand */
  const char *zP4,    /* The P4 operand */
  int p4type          /* P4 operand type */
){
  int addr = sqlite3VdbeAddOp3(p, op, p1, p2, p3);
  sqlite3VdbeChangeP4(p, addr, zP4, p4type);
  return addr;
}

/*
** Create a new symbolic label for an instruction that has yet to be
** coded.  The symbolic label is really just a negative number.  The
** label can be used as the P2 value of an operation.  Later, when
** the label is resolved to a specific address, the VDBE will scan
** through its operation list and change all values of P2 which match
** the label into the resolved address.
**
** The VDBE knows that a P2 value is a label because labels are
** always negative and P2 values are suppose to be non-negative.
** Hence, a negative P2 value is a label that has yet to be resolved.
**
** Zero is returned if a malloc() fails.
*/
int sqlite3VdbeMakeLabel(Vdbe *p){
  int i;
  i = p->nLabel++;
  assert( p->magic==VDBE_MAGIC_INIT );
  if( i>=p->nLabelAlloc ){
    p->nLabelAlloc = p->nLabelAlloc*2 + 10;
    p->aLabel = sqlite3DbReallocOrFree(p->db, p->aLabel,
                                    p->nLabelAlloc*sizeof(p->aLabel[0]));
  }
  if( p->aLabel ){
    p->aLabel[i] = -1;
  }
  return -1-i;
}

/*
** Resolve label "x" to be the address of the next instruction to
** be inserted.  The parameter "x" must have been obtained from
** a prior call to sqlite3VdbeMakeLabel().
*/
void sqlite3VdbeResolveLabel(Vdbe *p, int x){
  int j = -1-x;
  assert( p->magic==VDBE_MAGIC_INIT );
  assert( j>=0 && j<p->nLabel );
  if( p->aLabel ){
    p->aLabel[j] = p->nOp;
  }
}

/*
** Loop through the program looking for P2 values that are negative
** on jump instructions.  Each such value is a label.  Resolve the
** label by setting the P2 value to its correct non-zero value.
**
** This routine is called once after all opcodes have been inserted.
**
** Variable *pMaxFuncArgs is set to the maximum value of any P2 argument 
** to an OP_Function, OP_AggStep or OP_VFilter opcode. This is used by 
** sqlite3VdbeMakeReady() to size the Vdbe.apArg[] array.
**
** This routine also does the following optimization:  It scans for
** instructions that might cause a statement rollback.  Such instructions
** are:
**
**   *  OP_Halt with P1=SQLITE_CONSTRAINT and P2=OE_Abort.
**   *  OP_Destroy
**   *  OP_VUpdate
**   *  OP_VRename
**
** If no such instruction is found, then every Statement instruction 
** is changed to a Noop.  In this way, we avoid creating the statement 
** journal file unnecessarily.
*/
static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
  int i;
  int nMaxArgs = 0;
  Op *pOp;
  int *aLabel = p->aLabel;
  int doesStatementRollback = 0;
  int hasStatementBegin = 0;
  for(pOp=p->aOp, i=p->nOp-1; i>=0; i--, pOp++){
    u8 opcode = pOp->opcode;

    if( opcode==OP_Function || opcode==OP_AggStep ){
      if( pOp->p5>nMaxArgs ) nMaxArgs = pOp->p5;
#ifndef SQLITE_OMIT_VIRTUALTABLE
    }else if( opcode==OP_VUpdate ){
      if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2;
#endif
    }
    if( opcode==OP_Halt ){
      if( pOp->p1==SQLITE_CONSTRAINT && pOp->p2==OE_Abort ){
        doesStatementRollback = 1;
      }
    }else if( opcode==OP_Statement ){
      hasStatementBegin = 1;
    }else if( opcode==OP_Destroy ){
      doesStatementRollback = 1;
#ifndef SQLITE_OMIT_VIRTUALTABLE
    }else if( opcode==OP_VUpdate || opcode==OP_VRename ){
      doesStatementRollback = 1;
    }else if( opcode==OP_VFilter ){
      int n;
      assert( p->nOp - i >= 3 );
      assert( pOp[-1].opcode==OP_Integer );
      n = pOp[-1].p1;
      if( n>nMaxArgs ) nMaxArgs = n;
#endif
    }

    if( sqlite3VdbeOpcodeHasProperty(opcode, OPFLG_JUMP) && pOp->p2<0 ){
      assert( -1-pOp->p2<p->nLabel );
      pOp->p2 = aLabel[-1-pOp->p2];
    }
  }
  sqlite3DbFree(p->db, p->aLabel);
  p->aLabel = 0;

  *pMaxFuncArgs = nMaxArgs;

  /* If we never rollback a statement transaction, then statement
  ** transactions are not needed.  So change every OP_Statement
  ** opcode into an OP_Noop.  This avoid a call to sqlite3OsOpenExclusive()
  ** which can be expensive on some platforms.
  */
  if( hasStatementBegin && !doesStatementRollback ){
    for(pOp=p->aOp, i=p->nOp-1; i>=0; i--, pOp++){
      if( pOp->opcode==OP_Statement ){
        pOp->opcode = OP_Noop;
      }
    }
  }
}

/*
** Return the address of the next instruction to be inserted.
*/
int sqlite3VdbeCurrentAddr(Vdbe *p){
  assert( p->magic==VDBE_MAGIC_INIT );
  return p->nOp;
}

/*
** Add a whole list of operations to the operation stack.  Return the
** address of the first operation added.
*/
int sqlite3VdbeAddOpList(Vdbe *p, int nOp, VdbeOpList const *aOp){
  int addr;
  assert( p->magic==VDBE_MAGIC_INIT );
  if( p->nOp + nOp > p->nOpAlloc ){
    resizeOpArray(p, p->nOpAlloc ? p->nOpAlloc*2 : 1024/sizeof(Op));
    assert( p->nOp+nOp<=p->nOpAlloc || p->db->mallocFailed );
  }
  if( p->db->mallocFailed ){
    return 0;
  }
  addr = p->nOp;
  if( nOp>0 ){
    int i;
    VdbeOpList const *pIn = aOp;
    for(i=0; i<nOp; i++, pIn++){
      int p2 = pIn->p2;
      VdbeOp *pOut = &p->aOp[i+addr];
      pOut->opcode = pIn->opcode;
      pOut->p1 = pIn->p1;
      if( p2<0 && sqlite3VdbeOpcodeHasProperty(pOut->opcode, OPFLG_JUMP) ){
        pOut->p2 = addr + ADDR(p2);
      }else{
        pOut->p2 = p2;
      }
      pOut->p3 = pIn->p3;
      pOut->p4type = P4_NOTUSED;
      pOut->p4.p = 0;
      pOut->p5 = 0;
#ifdef SQLITE_DEBUG
      pOut->zComment = 0;
      if( sqlite3VdbeAddopTrace ){
        sqlite3VdbePrintOp(0, i+addr, &p->aOp[i+addr]);
      }
#endif
    }
    p->nOp += nOp;
  }
  return addr;
}

/*
** Change the value of the P1 operand for a specific instruction.
** This routine is useful when a large program is loaded from a
** static array using sqlite3VdbeAddOpList but we want to make a
** few minor changes to the program.
*/
void sqlite3VdbeChangeP1(Vdbe *p, int addr, int val){
  assert( p==0 || p->magic==VDBE_MAGIC_INIT );
  if( p && addr>=0 && p->nOp>addr && p->aOp ){
    p->aOp[addr].p1 = val;
  }
}

/*
** Change the value of the P2 operand for a specific instruction.
** This routine is useful for setting a jump destination.
*/
void sqlite3VdbeChangeP2(Vdbe *p, int addr, int val){
  assert( p==0 || p->magic==VDBE_MAGIC_INIT );
  if( p && addr>=0 && p->nOp>addr && p->aOp ){
    p->aOp[addr].p2 = val;
  }
}

/*
** Change the value of the P3 operand for a specific instruction.
*/
void sqlite3VdbeChangeP3(Vdbe *p, int addr, int val){
  assert( p==0 || p->magic==VDBE_MAGIC_INIT );
  if( p && addr>=0 && p->nOp>addr && p->aOp ){
    p->aOp[addr].p3 = val;
  }
}

/*
** Change the value of the P5 operand for the most recently
** added operation.
*/
void sqlite3VdbeChangeP5(Vdbe *p, u8 val){
  assert( p==0 || p->magic==VDBE_MAGIC_INIT );
  if( p && p->aOp ){
    assert( p->nOp>0 );
    p->aOp[p->nOp-1].p5 = val;
  }
}

/*
** Change the P2 operand of instruction addr so that it points to
** the address of the next instruction to be coded.
*/
void sqlite3VdbeJumpHere(Vdbe *p, int addr){
  sqlite3VdbeChangeP2(p, addr, p->nOp);
}


/*
** If the input FuncDef structure is ephemeral, then free it.  If
** the FuncDef is not ephermal, then do nothing.
*/
static void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef){
  if( pDef && (pDef->flags & SQLITE_FUNC_EPHEM)!=0 ){
    sqlite3DbFree(db, pDef);
  }
}

/*
** Delete a P4 value if necessary.
*/
static void freeP4(sqlite3 *db, int p4type, void *p4){
  if( p4 ){
    switch( p4type ){
      case P4_REAL:
      case P4_INT64:
      case P4_MPRINTF:
      case P4_DYNAMIC:
      case P4_KEYINFO:
      case P4_INTARRAY:
      case P4_KEYINFO_HANDOFF: {
        sqlite3DbFree(db, p4);
        break;
      }
      case P4_VDBEFUNC: {
        VdbeFunc *pVdbeFunc = (VdbeFunc *)p4;
        freeEphemeralFunction(db, pVdbeFunc->pFunc);
        sqlite3VdbeDeleteAuxData(pVdbeFunc, 0);
        sqlite3DbFree(db, pVdbeFunc);
        break;
      }
      case P4_FUNCDEF: {
        freeEphemeralFunction(db, (FuncDef*)p4);
        break;
      }
      case P4_MEM: {
        sqlite3ValueFree((sqlite3_value*)p4);
        break;
      }
    }
  }
}


/*
** Change N opcodes starting at addr to No-ops.
*/
void sqlite3VdbeChangeToNoop(Vdbe *p, int addr, int N){
  if( p && p->aOp ){
    VdbeOp *pOp = &p->aOp[addr];
    sqlite3 *db = p->db;
    while( N-- ){
      freeP4(db, pOp->p4type, pOp->p4.p);
      memset(pOp, 0, sizeof(pOp[0]));
      pOp->opcode = OP_Noop;
      pOp++;
    }
  }
}

/*
** Change the value of the P4 operand for a specific instruction.
** This routine is useful when a large program is loaded from a
** static array using sqlite3VdbeAddOpList but we want to make a
** few minor changes to the program.
**
** If n>=0 then the P4 operand is dynamic, meaning that a copy of
** the string is made into memory obtained from sqlite3_malloc().
** A value of n==0 means copy bytes of zP4 up to and including the
** first null byte.  If n>0 then copy n+1 bytes of zP4.
**
** If n==P4_KEYINFO it means that zP4 is a pointer to a KeyInfo structure.
** A copy is made of the KeyInfo structure into memory obtained from
** sqlite3_malloc, to be freed when the Vdbe is finalized.
** n==P4_KEYINFO_HANDOFF indicates that zP4 points to a KeyInfo structure
** stored in memory that the caller has obtained from sqlite3_malloc. The 
** caller should not free the allocation, it will be freed when the Vdbe is
** finalized.
** 
** Other values of n (P4_STATIC, P4_COLLSEQ etc.) indicate that zP4 points
** to a string or structure that is guaranteed to exist for the lifetime of
** the Vdbe. In these cases we can just copy the pointer.
**
** If addr<0 then change P4 on the most recently inserted instruction.
*/
void sqlite3VdbeChangeP4(Vdbe *p, int addr, const char *zP4, int n){
  Op *pOp;
  sqlite3 *db;
  assert( p!=0 );
  db = p->db;
  assert( p->magic==VDBE_MAGIC_INIT );
  if( p->aOp==0 || db->mallocFailed ){
    if (n != P4_KEYINFO) {
      freeP4(db, n, (void*)*(char**)&zP4);
    }
    return;
  }
  assert( addr<p->nOp );
  if( addr<0 ){
    addr = p->nOp - 1;
    if( addr<0 ) return;
  }
  pOp = &p->aOp[addr];
  freeP4(db, pOp->p4type, pOp->p4.p);
  pOp->p4.p = 0;
  if( n==P4_INT32 ){
    /* Note: this cast is safe, because the origin data point was an int
    ** that was cast to a (const char *). */
    pOp->p4.i = SQLITE_PTR_TO_INT(zP4);
    pOp->p4type = n;
  }else if( zP4==0 ){
    pOp->p4.p = 0;
    pOp->p4type = P4_NOTUSED;
  }else if( n==P4_KEYINFO ){
    KeyInfo *pKeyInfo;
    int nField, nByte;

    nField = ((KeyInfo*)zP4)->nField;
    nByte = sizeof(*pKeyInfo) + (nField-1)*sizeof(pKeyInfo->aColl[0]) + nField;
    pKeyInfo = sqlite3Malloc( nByte );
    pOp->p4.pKeyInfo = pKeyInfo;
    if( pKeyInfo ){
      u8 *aSortOrder;
      memcpy(pKeyInfo, zP4, nByte);
      aSortOrder = pKeyInfo->aSortOrder;
      if( aSortOrder ){
        pKeyInfo->aSortOrder = (unsigned char*)&pKeyInfo->aColl[nField];
        memcpy(pKeyInfo->aSortOrder, aSortOrder, nField);
      }
      pOp->p4type = P4_KEYINFO;
    }else{
      p->db->mallocFailed = 1;
      pOp->p4type = P4_NOTUSED;
    }
  }else if( n==P4_KEYINFO_HANDOFF ){
    pOp->p4.p = (void*)zP4;
    pOp->p4type = P4_KEYINFO;
  }else if( n<0 ){
    pOp->p4.p = (void*)zP4;
    pOp->p4type = n;
  }else{
    if( n==0 ) n = strlen(zP4);
    pOp->p4.z = sqlite3DbStrNDup(p->db, zP4, n);
    pOp->p4type = P4_DYNAMIC;
  }
}

#ifndef NDEBUG
/*
** Change the comment on the the most recently coded instruction.  Or
** insert a No-op and add the comment to that new instruction.  This
** makes the code easier to read during debugging.  None of this happens
** in a production build.
*/
void sqlite3VdbeComment(Vdbe *p, const char *zFormat, ...){
  va_list ap;
  assert( p->nOp>0 || p->aOp==0 );
  assert( p->aOp==0 || p->aOp[p->nOp-1].zComment==0 || p->db->mallocFailed );
  if( p->nOp ){
    char **pz = &p->aOp[p->nOp-1].zComment;
    va_start(ap, zFormat);
    sqlite3DbFree(p->db, *pz);
    *pz = sqlite3VMPrintf(p->db, zFormat, ap);
    va_end(ap);
  }
}
void sqlite3VdbeNoopComment(Vdbe *p, const char *zFormat, ...){
  va_list ap;
  sqlite3VdbeAddOp0(p, OP_Noop);
  assert( p->nOp>0 || p->aOp==0 );
  assert( p->aOp==0 || p->aOp[p->nOp-1].zComment==0 || p->db->mallocFailed );
  if( p->nOp ){
    char **pz = &p->aOp[p->nOp-1].zComment;
    va_start(ap, zFormat);
    sqlite3DbFree(p->db, *pz);
    *pz = sqlite3VMPrintf(p->db, zFormat, ap);
    va_end(ap);
  }
}
#endif  /* NDEBUG */

/*
** Return the opcode for a given address.
*/
VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){
  assert( p->magic==VDBE_MAGIC_INIT );
  assert( (addr>=0 && addr<p->nOp) || p->db->mallocFailed );
  return ((addr>=0 && addr<p->nOp)?(&p->aOp[addr]):0);
}

#if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) \
     || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)
/*
** Compute a string that describes the P4 parameter for an opcode.
** Use zTemp for any required temporary buffer space.
*/
static char *displayP4(Op *pOp, char *zTemp, int nTemp){
  char *zP4 = zTemp;
  assert( nTemp>=20 );
  switch( pOp->p4type ){
    case P4_KEYINFO_STATIC:
    case P4_KEYINFO: {
      int i, j;
      KeyInfo *pKeyInfo = pOp->p4.pKeyInfo;
      sqlite3_snprintf(nTemp, zTemp, "keyinfo(%d", pKeyInfo->nField);
      i = strlen(zTemp);
      for(j=0; j<pKeyInfo->nField; j++){
        CollSeq *pColl = pKeyInfo->aColl[j];
        if( pColl ){
          int n = strlen(pColl->zName);
          if( i+n>nTemp-6 ){
            memcpy(&zTemp[i],",...",4);
            break;
          }
          zTemp[i++] = ',';
          if( pKeyInfo->aSortOrder && pKeyInfo->aSortOrder[j] ){
            zTemp[i++] = '-';
          }
          memcpy(&zTemp[i], pColl->zName,n+1);
          i += n;
        }else if( i+4<nTemp-6 ){
          memcpy(&zTemp[i],",nil",4);
          i += 4;
        }
      }
      zTemp[i++] = ')';
      zTemp[i] = 0;
      assert( i<nTemp );
      break;
    }
    case P4_COLLSEQ: {
      CollSeq *pColl = pOp->p4.pColl;
      sqlite3_snprintf(nTemp, zTemp, "collseq(%.20s)", pColl->zName);
      break;
    }
    case P4_FUNCDEF: {
      FuncDef *pDef = pOp->p4.pFunc;
      sqlite3_snprintf(nTemp, zTemp, "%s(%d)", pDef->zName, pDef->nArg);
      break;
    }
    case P4_INT64: {
      sqlite3_snprintf(nTemp, zTemp, "%lld", *pOp->p4.pI64);
      break;
    }
    case P4_INT32: {
      sqlite3_snprintf(nTemp, zTemp, "%d", pOp->p4.i);
      break;
    }
    case P4_REAL: {
      sqlite3_snprintf(nTemp, zTemp, "%.16g", *pOp->p4.pReal);
      break;
    }
    case P4_MEM: {
      Mem *pMem = pOp->p4.pMem;
      assert( (pMem->flags & MEM_Null)==0 );
      if( pMem->flags & MEM_Str ){
        zP4 = pMem->z;
      }else if( pMem->flags & MEM_Int ){
        sqlite3_snprintf(nTemp, zTemp, "%lld", pMem->u.i);
      }else if( pMem->flags & MEM_Real ){
        sqlite3_snprintf(nTemp, zTemp, "%.16g", pMem->r);
      }
      break;
    }
#ifndef SQLITE_OMIT_VIRTUALTABLE
    case P4_VTAB: {
      sqlite3_vtab *pVtab = pOp->p4.pVtab;
      sqlite3_snprintf(nTemp, zTemp, "vtab:%p:%p", pVtab, pVtab->pModule);
      break;
    }
#endif
    case P4_INTARRAY: {
      sqlite3_snprintf(nTemp, zTemp, "intarray");
      break;
    }
    default: {
      zP4 = pOp->p4.z;
      if( zP4==0 ){
        zP4 = zTemp;
        zTemp[0] = 0;
      }
    }
  }
  assert( zP4!=0 );
  return zP4;
}
#endif

/*
** Declare to the Vdbe that the BTree object at db->aDb[i] is used.
**
*/
void sqlite3VdbeUsesBtree(Vdbe *p, int i){
  int mask;
  assert( i>=0 && i<p->db->nDb );
  assert( i<sizeof(p->btreeMask)*8 );
  mask = 1<<i;
  if( (p->btreeMask & mask)==0 ){
    p->btreeMask |= mask;
    sqlite3BtreeMutexArrayInsert(&p->aMutex, p->db->aDb[i].pBt);
  }
}


#if defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)
/*
** Print a single opcode.  This routine is used for debugging only.
*/
void sqlite3VdbePrintOp(FILE *pOut, int pc, Op *pOp){
  char *zP4;
  char zPtr[50];
  static const char *zFormat1 = "%4d %-13s %4d %4d %4d %-4s %.2X %s\n";
  if( pOut==0 ) pOut = stdout;
  zP4 = displayP4(pOp, zPtr, sizeof(zPtr));
  fprintf(pOut, zFormat1, pc, 
      sqlite3OpcodeName(pOp->opcode), pOp->p1, pOp->p2, pOp->p3, zP4, pOp->p5,
#ifdef SQLITE_DEBUG
      pOp->zComment ? pOp->zComment : ""
#else
      ""
#endif
  );
  fflush(pOut);
}
#endif

/*
** Release an array of N Mem elements
*/
static void releaseMemArray(Mem *p, int N){
  if( p && N ){
    sqlite3 *db = p->db;
    int malloc_failed = db->mallocFailed;
    while( N-->0 ){
      assert( N<2 || p[0].db==p[1].db );
      sqlite3VdbeMemRelease(p);
      p->flags = MEM_Null;
      p++;
    }
    db->mallocFailed = malloc_failed;
  }
}

#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
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->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".
**
** When p->explain==1, each instruction is listed.  When
** p->explain==2, only OP_Explain instructions are listed and these
** are shown in a different format.  p->explain==2 is used to implement
** EXPLAIN QUERY PLAN.
*/
int sqlite3VdbeList(
  Vdbe *p                   /* The VDBE */
){
  sqlite3 *db = p->db;
  int i;
  int rc = SQLITE_OK;
  Mem *pMem = p->pResultSet = &p->aMem[1];

  assert( p->explain );
  if( p->magic!=VDBE_MAGIC_RUN ) return SQLITE_MISUSE;
  assert( db->magic==SQLITE_MAGIC_BUSY );
  assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY );

  /* Even though this opcode does not use dynamic strings for
  ** the result, result columns may become dynamic if the user calls
  ** sqlite3_column_text16(), causing a translation to UTF-16 encoding.
  */
  releaseMemArray(pMem, p->nMem);

  do{
    i = p->pc++;
  }while( i<p->nOp && p->explain==2 && p->aOp[i].opcode!=OP_Explain );
  if( i>=p->nOp ){
    p->rc = SQLITE_OK;
    rc = SQLITE_DONE;
  }else if( db->u1.isInterrupted ){
    p->rc = SQLITE_INTERRUPT;
    rc = SQLITE_ERROR;
    sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3ErrStr(p->rc));
  }else{
    char *z;
    Op *pOp = &p->aOp[i];
    if( p->explain==1 ){
      pMem->flags = MEM_Int;
      pMem->type = SQLITE_INTEGER;
      pMem->u.i = i;                                /* Program counter */
      pMem++;
  
      pMem->flags = MEM_Static|MEM_Str|MEM_Term;
      pMem->z = (char*)sqlite3OpcodeName(pOp->opcode);  /* Opcode */
      assert( pMem->z!=0 );
      pMem->n = strlen(pMem->z);
      pMem->type = SQLITE_TEXT;
      pMem->enc = SQLITE_UTF8;
      pMem++;
    }

    pMem->flags = MEM_Int;
    pMem->u.i = pOp->p1;                          /* P1 */
    pMem->type = SQLITE_INTEGER;
    pMem++;

    pMem->flags = MEM_Int;
    pMem->u.i = pOp->p2;                          /* P2 */
    pMem->type = SQLITE_INTEGER;
    pMem++;

    if( p->explain==1 ){
      pMem->flags = MEM_Int;
      pMem->u.i = pOp->p3;                          /* P3 */
      pMem->type = SQLITE_INTEGER;
      pMem++;
    }

    if( sqlite3VdbeMemGrow(pMem, 32, 0) ){            /* P4 */
      p->db->mallocFailed = 1;
      return SQLITE_NOMEM;
    }
    pMem->flags = MEM_Dyn|MEM_Str|MEM_Term;
    z = displayP4(pOp, pMem->z, 32);
    if( z!=pMem->z ){
      sqlite3VdbeMemSetStr(pMem, z, -1, SQLITE_UTF8, 0);
    }else{
      assert( pMem->z!=0 );
      pMem->n = strlen(pMem->z);
      pMem->enc = SQLITE_UTF8;
    }
    pMem->type = SQLITE_TEXT;
    pMem++;

    if( p->explain==1 ){
      if( sqlite3VdbeMemGrow(pMem, 4, 0) ){
        p->db->mallocFailed = 1;
        return SQLITE_NOMEM;
      }
      pMem->flags = MEM_Dyn|MEM_Str|MEM_Term;
      pMem->n = 2;
      sqlite3_snprintf(3, pMem->z, "%.2x", pOp->p5);   /* P5 */
      pMem->type = SQLITE_TEXT;
      pMem->enc = SQLITE_UTF8;
      pMem++;
  
#ifdef SQLITE_DEBUG
      if( pOp->zComment ){
        pMem->flags = MEM_Str|MEM_Term;
        pMem->z = pOp->zComment;
        pMem->n = strlen(pMem->z);
        pMem->enc = SQLITE_UTF8;
      }else
#endif
      {
        pMem->flags = MEM_Null;                       /* Comment */
        pMem->type = SQLITE_NULL;
      }
    }

    p->nResColumn = 8 - 5*(p->explain-1);
    p->rc = SQLITE_OK;
    rc = SQLITE_ROW;
  }
  return rc;
}
#endif /* SQLITE_OMIT_EXPLAIN */

#ifdef SQLITE_DEBUG
/*
** Print the SQL that was used to generate a VDBE program.
*/
void sqlite3VdbePrintSql(Vdbe *p){
  int nOp = p->nOp;
  VdbeOp *pOp;
  if( nOp<1 ) return;
  pOp = &p->aOp[0];
  if( pOp->opcode==OP_Trace && pOp->p4.z!=0 ){
    const char *z = pOp->p4.z;
    while( isspace(*(u8*)z) ) z++;
    printf("SQL: [%s]\n", z);
  }
}
#endif

#if !defined(SQLITE_OMIT_TRACE) && defined(SQLITE_ENABLE_IOTRACE)
/*
** Print an IOTRACE message showing SQL content.
*/
void sqlite3VdbeIOTraceSql(Vdbe *p){
  int nOp = p->nOp;
  VdbeOp *pOp;
  if( sqlite3IoTrace==0 ) return;
  if( nOp<1 ) return;
  pOp = &p->aOp[0];
  if( pOp->opcode==OP_Trace && pOp->p4.z!=0 ){
    int i, j;
    char z[1000];
    sqlite3_snprintf(sizeof(z), z, "%s", pOp->p4.z);
    for(i=0; isspace((unsigned char)z[i]); i++){}
    for(j=0; z[i]; i++){
      if( isspace((unsigned char)z[i]) ){
        if( z[i-1]!=' ' ){
          z[j++] = ' ';
        }
      }else{
        z[j++] = z[i];
      }
    }
    z[j] = 0;
    sqlite3IoTrace("SQL %s\n", z);
  }
}
#endif /* !SQLITE_OMIT_TRACE && SQLITE_ENABLE_IOTRACE */


/*
** Prepare a virtual machine for execution.  This involves things such
** as allocating stack space and initializing the program counter.
** After the VDBE has be prepped, it can be executed by one or more
** calls to sqlite3VdbeExec().  
**
** This is the only way to move a VDBE from VDBE_MAGIC_INIT to
** VDBE_MAGIC_RUN.
*/
void sqlite3VdbeMakeReady(
  Vdbe *p,                       /* The VDBE */
  int nVar,                      /* Number of '?' see in the SQL statement */
  int nMem,                      /* Number of memory cells to allocate */
  int nCursor,                   /* Number of cursors to allocate */
  int isExplain                  /* True if the EXPLAIN keywords is present */
){
  int n;
  sqlite3 *db = p->db;

  assert( p!=0 );
  assert( p->magic==VDBE_MAGIC_INIT );

  /* There should be at least one opcode.
  */
  assert( p->nOp>0 );

  /* Set the magic to VDBE_MAGIC_RUN sooner rather than later. This
   * is because the call to resizeOpArray() below may shrink the
   * p->aOp[] array to save memory if called when in VDBE_MAGIC_RUN 
   * state.
   */
  p->magic = VDBE_MAGIC_RUN;

  /* For each cursor required, also allocate a memory cell. Memory
  ** cells (nMem+1-nCursor)..nMem, inclusive, will never be used by
  ** the vdbe program. Instead they are used to allocate space for
  ** Cursor/BtCursor structures. The blob of memory associated with 
  ** cursor 0 is stored in memory cell nMem. Memory cell (nMem-1)
  ** stores the blob of memory associated with cursor 1, etc.
  **
  ** See also: allocateCursor().
  */
  nMem += nCursor;

  /*
  ** Allocation space for registers.
  */
  if( p->aMem==0 ){
    int nArg;       /* Maximum number of args passed to a user function. */
    resolveP2Values(p, &nArg);
    /*resizeOpArray(p, p->nOp);*/
    assert( nVar>=0 );
    if( isExplain && nMem<10 ){
      p->nMem = nMem = 10;
    }
    p->aMem = sqlite3DbMallocZero(db,
        nMem*sizeof(Mem)               /* aMem */
      + nVar*sizeof(Mem)               /* aVar */
      + nArg*sizeof(Mem*)              /* apArg */
      + nVar*sizeof(char*)             /* azVar */
      + nCursor*sizeof(Cursor*) + 1    /* apCsr */
    );
    if( !db->mallocFailed ){
      p->aMem--;             /* aMem[] goes from 1..nMem */
      p->nMem = nMem;        /*       not from 0..nMem-1 */
      p->aVar = &p->aMem[nMem+1];
      p->nVar = nVar;
      p->okVar = 0;
      p->apArg = (Mem**)&p->aVar[nVar];
      p->azVar = (char**)&p->apArg[nArg];
      p->apCsr = (Cursor**)&p->azVar[nVar];
      p->nCursor = nCursor;
      for(n=0; n<nVar; n++){
        p->aVar[n].flags = MEM_Null;
        p->aVar[n].db = db;
      }
      for(n=1; n<=nMem; n++){
        p->aMem[n].flags = MEM_Null;
        p->aMem[n].db = db;
      }
    }
  }
#ifdef SQLITE_DEBUG
  for(n=1; n<p->nMem; n++){
    assert( p->aMem[n].db==db );
  }
#endif

  p->pc = -1;
  p->rc = SQLITE_OK;
  p->uniqueCnt = 0;
  p->errorAction = OE_Abort;
  p->explain |= isExplain;
  p->magic = VDBE_MAGIC_RUN;
  p->nChange = 0;
  p->cacheCtr = 1;
  p->minWriteFileFormat = 255;
  p->openedStatement = 0;
#ifdef VDBE_PROFILE
  {
    int i;
    for(i=0; i<p->nOp; i++){
      p->aOp[i].cnt = 0;
      p->aOp[i].cycles = 0;
    }
  }
#endif
}

/*
** Close a VDBE cursor and release all the resources that cursor 
** happens to hold.
*/
void sqlite3VdbeFreeCursor(Vdbe *p, Cursor *pCx){
  if( pCx==0 ){
    return;
  }
  if( pCx->pBt ){
    sqlite3BtreeClose(pCx->pBt);
    /* The pCx->pCursor will be close automatically, if it exists, by
    ** the call above. */
  }else if( pCx->pCursor ){
    sqlite3BtreeCloseCursor(pCx->pCursor);
  }
#ifndef SQLITE_OMIT_VIRTUALTABLE
  if( pCx->pVtabCursor ){
    sqlite3_vtab_cursor *pVtabCursor = pCx->pVtabCursor;
    const sqlite3_module *pModule = pCx->pModule;
    p->inVtabMethod = 1;
    (void)sqlite3SafetyOff(p->db);
    pModule->xClose(pVtabCursor);
    (void)sqlite3SafetyOn(p->db);
    p->inVtabMethod = 0;
  }
#endif
  if( !pCx->ephemPseudoTable ){
    sqlite3DbFree(p->db, pCx->pData);
  }
}

/*
** Close all cursors except for VTab cursors that are currently
** in use.
*/
static void closeAllCursorsExceptActiveVtabs(Vdbe *p){
  int i;
  if( p->apCsr==0 ) return;
  for(i=0; i<p->nCursor; i++){
    Cursor *pC = p->apCsr[i];
    if( pC && (!p->inVtabMethod || !pC->pVtabCursor) ){
      sqlite3VdbeFreeCursor(p, pC);
      p->apCsr[i] = 0;
    }
  }
}

/*
** Clean up the VM after execution.
**
** This routine will automatically close any cursors, lists, and/or
** sorters that were left open.  It also deletes the values of
** variables in the aVar[] array.
*/
static void Cleanup(Vdbe *p){
  int i;
  sqlite3 *db = p->db;
  closeAllCursorsExceptActiveVtabs(p);
  for(i=1; i<=p->nMem; i++){
    MemSetTypeFlag(&p->aMem[i], MEM_Null);
  }
  releaseMemArray(&p->aMem[1], p->nMem);
  sqlite3VdbeFifoClear(&p->sFifo);
  if( p->contextStack ){
    for(i=0; i<p->contextStackTop; i++){
      sqlite3VdbeFifoClear(&p->contextStack[i].sFifo);
    }
    sqlite3DbFree(db, p->contextStack);
  }
  p->contextStack = 0;
  p->contextStackDepth = 0;
  p->contextStackTop = 0;
  sqlite3DbFree(db, p->zErrMsg);
  p->zErrMsg = 0;
  p->pResultSet = 0;
}

/*
** Set the number of result columns that will be returned by this SQL
** statement. This is now set at compile time, rather than during
** execution of the vdbe program so that sqlite3_column_count() can
** be called on an SQL statement before sqlite3_step().
*/
void sqlite3VdbeSetNumCols(Vdbe *p, int nResColumn){
  Mem *pColName;
  int n;
  sqlite3 *db = p->db;

  releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
  sqlite3DbFree(db, p->aColName);
  n = nResColumn*COLNAME_N;
  p->nResColumn = nResColumn;
  p->aColName = pColName = (Mem*)sqlite3DbMallocZero(db, sizeof(Mem)*n );
  if( p->aColName==0 ) return;
  while( n-- > 0 ){
    pColName->flags = MEM_Null;
    pColName->db = p->db;
    pColName++;
  }
}

/*
** Set the name of the idx'th column to be returned by the SQL statement.
** zName must be a pointer to a nul terminated string.
**
** This call must be made after a call to sqlite3VdbeSetNumCols().
**
** If N==P4_STATIC  it means that zName is a pointer to a constant static
** string and we can just copy the pointer. If it is P4_DYNAMIC, then 
** the string is freed using sqlite3DbFree(db, ) when the vdbe is finished with
** it. Otherwise, N bytes of zName are copied.
*/
int sqlite3VdbeSetColName(Vdbe *p, int idx, int var, const char *zName, int N){
  int rc;
  Mem *pColName;
  assert( idx<p->nResColumn );
  assert( var<COLNAME_N );
  if( p->db->mallocFailed ) return SQLITE_NOMEM;
  assert( p->aColName!=0 );
  pColName = &(p->aColName[idx+var*p->nResColumn]);
  if( N==P4_DYNAMIC || N==P4_STATIC ){
    rc = sqlite3VdbeMemSetStr(pColName, zName, -1, SQLITE_UTF8, SQLITE_STATIC);
  }else{
    rc = sqlite3VdbeMemSetStr(pColName, zName, N, SQLITE_UTF8,SQLITE_TRANSIENT);
  }
  if( rc==SQLITE_OK && N==P4_DYNAMIC ){
    pColName->flags &= (~MEM_Static);
    pColName->zMalloc = pColName->z;
  }
  return rc;
}

/*
** A read or write transaction may or may not be active on database handle
** db. If a transaction is active, commit it. If there is a
** write-transaction spanning more than one database file, this routine
** takes care of the master journal trickery.
*/
static int vdbeCommit(sqlite3 *db, Vdbe *p){
  int i;
  int nTrans = 0;  /* Number of databases with an active write-transaction */
  int rc = SQLITE_OK;
  int needXcommit = 0;

  /* Before doing anything else, call the xSync() callback for any
  ** virtual module tables written in this transaction. This has to
  ** be done before determining whether a master journal file is 
  ** required, as an xSync() callback may add an attached database
  ** to the transaction.
  */
  rc = sqlite3VtabSync(db, &p->zErrMsg);
  if( rc!=SQLITE_OK ){
    return rc;
  }

  /* This loop determines (a) if the commit hook should be invoked and
  ** (b) how many database files have open write transactions, not 
  ** including the temp database. (b) is important because if more than 
  ** one database file has an open write transaction, a master journal
  ** file is required for an atomic commit.
  */ 
  for(i=0; i<db->nDb; i++){ 
    Btree *pBt = db->aDb[i].pBt;
    if( sqlite3BtreeIsInTrans(pBt) ){
      needXcommit = 1;
      if( i!=1 ) nTrans++;
    }
  }

  /* If there are any write-transactions at all, invoke the commit hook */
  if( needXcommit && db->xCommitCallback ){
    (void)sqlite3SafetyOff(db);
    rc = db->xCommitCallback(db->pCommitArg);
    (void)sqlite3SafetyOn(db);
    if( rc ){
      return SQLITE_CONSTRAINT;
    }
  }

  /* The simple case - no more than one database file (not counting the
  ** TEMP database) has a transaction active.   There is no need for the
  ** master-journal.
  **
  ** If the return value of sqlite3BtreeGetFilename() is a zero length
  ** string, it means the main database is :memory: or a temp file.  In 
  ** that case we do not support atomic multi-file commits, so use the 
  ** simple case then too.
  */
  if( 0==strlen(sqlite3BtreeGetFilename(db->aDb[0].pBt)) || nTrans<=1 ){
    for(i=0; rc==SQLITE_OK && i<db->nDb; i++){ 
      Btree *pBt = db->aDb[i].pBt;
      if( pBt ){
        rc = sqlite3BtreeCommitPhaseOne(pBt, 0);
      }
    }

    /* Do the commit only if all databases successfully complete phase 1. 
    ** If one of the BtreeCommitPhaseOne() calls fails, this indicates an
    ** IO error while deleting or truncating a journal file. It is unlikely,
    ** but could happen. In this case abandon processing and return the error.
    */
    for(i=0; rc==SQLITE_OK && i<db->nDb; i++){
      Btree *pBt = db->aDb[i].pBt;
      if( pBt ){
        rc = sqlite3BtreeCommitPhaseTwo(pBt);
      }
    }
    if( rc==SQLITE_OK ){
      sqlite3VtabCommit(db);
    }
  }

  /* The complex case - There is a multi-file write-transaction active.
  ** This requires a master journal file to ensure the transaction is
  ** committed atomicly.
  */
#ifndef SQLITE_OMIT_DISKIO
  else{
    sqlite3_vfs *pVfs = db->pVfs;
    int needSync = 0;
    char *zMaster = 0;   /* File-name for the master journal */
    char const *zMainFile = sqlite3BtreeGetFilename(db->aDb[0].pBt);
    sqlite3_file *pMaster = 0;
    i64 offset = 0;
    int res;

    /* Select a master journal file name */
    do {
      u32 random;
      sqlite3DbFree(db, zMaster);
      sqlite3_randomness(sizeof(random), &random);
      zMaster = sqlite3MPrintf(db, "%s-mj%08X", zMainFile, random&0x7fffffff);
      if( !zMaster ){
        return SQLITE_NOMEM;
      }
      rc = sqlite3OsAccess(pVfs, zMaster, SQLITE_ACCESS_EXISTS, &res);
    }while( rc==SQLITE_OK && res );
    if( rc==SQLITE_OK ){
      /* Open the master journal. */
      rc = sqlite3OsOpenMalloc(pVfs, zMaster, &pMaster, 
          SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|
          SQLITE_OPEN_EXCLUSIVE|SQLITE_OPEN_MASTER_JOURNAL, 0
      );
    }
    if( rc!=SQLITE_OK ){
      sqlite3DbFree(db, zMaster);
      return rc;
    }
 
    /* Write the name of each database file in the transaction into the new
    ** master journal file. If an error occurs at this point close
    ** and delete the master journal file. All the individual journal files
    ** still have 'null' as the master journal pointer, so they will roll
    ** back independently if a failure occurs.
    */
    for(i=0; i<db->nDb; i++){
      Btree *pBt = db->aDb[i].pBt;
      if( i==1 ) continue;   /* Ignore the TEMP database */
      if( sqlite3BtreeIsInTrans(pBt) ){
        char const *zFile = sqlite3BtreeGetJournalname(pBt);
        if( zFile[0]==0 ) continue;  /* Ignore :memory: databases */
        if( !needSync && !sqlite3BtreeSyncDisabled(pBt) ){
          needSync = 1;
        }
        rc = sqlite3OsWrite(pMaster, zFile, strlen(zFile)+1, offset);
        offset += strlen(zFile)+1;
        if( rc!=SQLITE_OK ){
          sqlite3OsCloseFree(pMaster);
          sqlite3OsDelete(pVfs, zMaster, 0);
          sqlite3DbFree(db, zMaster);
          return rc;
        }
      }
    }

    /* Sync the master journal file. If the IOCAP_SEQUENTIAL device
    ** flag is set this is not required.
    */
    zMainFile = sqlite3BtreeGetDirname(db->aDb[0].pBt);
    if( (needSync 
     && (0==(sqlite3OsDeviceCharacteristics(pMaster)&SQLITE_IOCAP_SEQUENTIAL))
     && (rc=sqlite3OsSync(pMaster, SQLITE_SYNC_NORMAL))!=SQLITE_OK) ){
      sqlite3OsCloseFree(pMaster);
      sqlite3OsDelete(pVfs, zMaster, 0);
      sqlite3DbFree(db, zMaster);
      return rc;
    }

    /* Sync all the db files involved in the transaction. The same call
    ** sets the master journal pointer in each individual journal. If
    ** an error occurs here, do not delete the master journal file.
    **
    ** If the error occurs during the first call to
    ** sqlite3BtreeCommitPhaseOne(), then there is a chance that the
    ** master journal file will be orphaned. But we cannot delete it,
    ** in case the master journal file name was written into the journal
    ** file before the failure occured.
    */
    for(i=0; rc==SQLITE_OK && i<db->nDb; i++){ 
      Btree *pBt = db->aDb[i].pBt;
      if( pBt ){
        rc = sqlite3BtreeCommitPhaseOne(pBt, zMaster);
      }
    }
    sqlite3OsCloseFree(pMaster);
    if( rc!=SQLITE_OK ){
      sqlite3DbFree(db, zMaster);
      return rc;
    }

    /* Delete the master journal file. This commits the transaction. After
    ** doing this the directory is synced again before any individual
    ** transaction files are deleted.
    */
    rc = sqlite3OsDelete(pVfs, zMaster, 1);
    sqlite3DbFree(db, zMaster);
    zMaster = 0;
    if( rc ){
      return rc;
    }

    /* All files and directories have already been synced, so the following
    ** calls to sqlite3BtreeCommitPhaseTwo() are only closing files and
    ** deleting or truncating journals. If something goes wrong while
    ** this is happening we don't really care. The integrity of the
    ** transaction is already guaranteed, but some stray 'cold' journals
    ** may be lying around. Returning an error code won't help matters.
    */
    disable_simulated_io_errors();
    sqlite3BeginBenignMalloc();
    for(i=0; i<db->nDb; i++){ 
      Btree *pBt = db->aDb[i].pBt;
      if( pBt ){
        sqlite3BtreeCommitPhaseTwo(pBt);
      }
    }
    sqlite3EndBenignMalloc();
    enable_simulated_io_errors();

    sqlite3VtabCommit(db);
  }
#endif

  return rc;
}

/* 
** This routine checks that the sqlite3.activeVdbeCnt count variable
** matches the number of vdbe's in the list sqlite3.pVdbe that are
** currently active. An assertion fails if the two counts do not match.
** This is an internal self-check only - it is not an essential processing
** step.
**
** This is a no-op if NDEBUG is defined.
*/
#ifndef NDEBUG
static void checkActiveVdbeCnt(sqlite3 *db){
  Vdbe *p;
  int cnt = 0;
  p = db->pVdbe;
  while( p ){
    if( p->magic==VDBE_MAGIC_RUN && p->pc>=0 ){
      cnt++;
    }
    p = p->pNext;
  }
  assert( cnt==db->activeVdbeCnt );
}
#else
#define checkActiveVdbeCnt(x)
#endif

/*
** For every Btree that in database connection db which 
** has been modified, "trip" or invalidate each cursor in
** that Btree might have been modified so that the cursor
** can never be used again.  This happens when a rollback
*** occurs.  We have to trip all the other cursors, even
** cursor from other VMs in different database connections,
** so that none of them try to use the data at which they
** were pointing and which now may have been changed due
** to the rollback.
**
** Remember that a rollback can delete tables complete and
** reorder rootpages.  So it is not sufficient just to save
** the state of the cursor.  We have to invalidate the cursor
** so that it is never used again.
*/
static void invalidateCursorsOnModifiedBtrees(sqlite3 *db){
  int i;
  for(i=0; i<db->nDb; i++){
    Btree *p = db->aDb[i].pBt;
    if( p && sqlite3BtreeIsInTrans(p) ){
      sqlite3BtreeTripAllCursors(p, SQLITE_ABORT);
    }
  }
}

/*
** This routine is called the when a VDBE tries to halt.  If the VDBE
** has made changes and is in autocommit mode, then commit those
** changes.  If a rollback is needed, then do the rollback.
**
** This routine is the only way to move the state of a VM from
** SQLITE_MAGIC_RUN to SQLITE_MAGIC_HALT.  It is harmless to
** call this on a VM that is in the SQLITE_MAGIC_HALT state.
**
** Return an error code.  If the commit could not complete because of
** lock contention, return SQLITE_BUSY.  If SQLITE_BUSY is returned, it
** means the close did not happen and needs to be repeated.
*/
int sqlite3VdbeHalt(Vdbe *p){
  sqlite3 *db = p->db;
  int i;
  int (*xFunc)(Btree *pBt) = 0;  /* Function to call on each btree backend */
  int isSpecialError;            /* Set to true if SQLITE_NOMEM or IOERR */

  /* This function contains the logic that determines if a statement or
  ** transaction will be committed or rolled back as a result of the
  ** execution of this virtual machine. 
  **
  ** If any of the following errors occur:
  **
  **     SQLITE_NOMEM
  **     SQLITE_IOERR
  **     SQLITE_FULL
  **     SQLITE_INTERRUPT
  **
  ** Then the internal cache might have been left in an inconsistent
  ** state.  We need to rollback the statement transaction, if there is
  ** one, or the complete transaction if there is no statement transaction.
  */

  if( p->db->mallocFailed ){
    p->rc = SQLITE_NOMEM;
  }
  closeAllCursorsExceptActiveVtabs(p);
  if( p->magic!=VDBE_MAGIC_RUN ){
    return SQLITE_OK;
  }
  checkActiveVdbeCnt(db);

  /* No commit or rollback needed if the program never started */
  if( p->pc>=0 ){
    int mrc;   /* Primary error code from p->rc */

    /* Lock all btrees used by the statement */
    sqlite3BtreeMutexArrayEnter(&p->aMutex);

    /* Check for one of the special errors */
    mrc = p->rc & 0xff;
    isSpecialError = mrc==SQLITE_NOMEM || mrc==SQLITE_IOERR
                     || mrc==SQLITE_INTERRUPT || mrc==SQLITE_FULL;
    if( isSpecialError ){
      /* This loop does static analysis of the query to see which of the
      ** following three categories it falls into:
      **
      **     Read-only
      **     Query with statement journal
      **     Query without statement journal
      **
      ** We could do something more elegant than this static analysis (i.e.
      ** store the type of query as part of the compliation phase), but 
      ** handling malloc() or IO failure is a fairly obscure edge case so 
      ** this is probably easier. Todo: Might be an opportunity to reduce 
      ** code size a very small amount though...
      */
      int notReadOnly = 0;
      int isStatement = 0;
      assert(p->aOp || p->nOp==0);
      for(i=0; i<p->nOp; i++){ 
        switch( p->aOp[i].opcode ){
          case OP_Transaction:
            notReadOnly |= p->aOp[i].p2;
            break;
          case OP_Statement:
            isStatement = 1;
            break;
        }
      }

   
      /* If the query was read-only, we need do no rollback at all. Otherwise,
      ** proceed with the special handling.
      */
      if( notReadOnly || mrc!=SQLITE_INTERRUPT ){
        if( p->rc==SQLITE_IOERR_BLOCKED && isStatement ){
          xFunc = sqlite3BtreeRollbackStmt;
          p->rc = SQLITE_BUSY;
        } else if( (mrc==SQLITE_NOMEM || mrc==SQLITE_FULL) && isStatement ){
          xFunc = sqlite3BtreeRollbackStmt;
        }else{
          /* We are forced to roll back the active transaction. Before doing
          ** so, abort any other statements this handle currently has active.
          */
          invalidateCursorsOnModifiedBtrees(db);
          sqlite3RollbackAll(db);
          db->autoCommit = 1;
        }
      }
    }
  
    /* If the auto-commit flag is set and this is the only active vdbe, then
    ** we do either a commit or rollback of the current transaction. 
    **
    ** Note: This block also runs if one of the special errors handled 
    ** above has occured. 
    */
    if( db->autoCommit && db->activeVdbeCnt==1 ){
      if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){
        /* The auto-commit flag is true, and the vdbe program was 
        ** successful or hit an 'OR FAIL' constraint. This means a commit 
        ** is required.
        */
        int rc = vdbeCommit(db, p);
        if( rc==SQLITE_BUSY ){
          sqlite3BtreeMutexArrayLeave(&p->aMutex);
          return SQLITE_BUSY;
        }else if( rc!=SQLITE_OK ){
          p->rc = rc;
          sqlite3RollbackAll(db);
        }else{
          sqlite3CommitInternalChanges(db);
        }
      }else{
        sqlite3RollbackAll(db);
      }
    }else if( !xFunc ){
      if( p->rc==SQLITE_OK || p->errorAction==OE_Fail ){
        if( p->openedStatement ){
          xFunc = sqlite3BtreeCommitStmt;
        } 
      }else if( p->errorAction==OE_Abort ){
        xFunc = sqlite3BtreeRollbackStmt;
      }else{
        invalidateCursorsOnModifiedBtrees(db);
        sqlite3RollbackAll(db);
        db->autoCommit = 1;
      }
    }
  
    /* If xFunc is not NULL, then it is one of sqlite3BtreeRollbackStmt or
    ** sqlite3BtreeCommitStmt. Call it once on each backend. If an error occurs
    ** and the return code is still SQLITE_OK, set the return code to the new
    ** error value.
    */
    assert(!xFunc ||
      xFunc==sqlite3BtreeCommitStmt ||
      xFunc==sqlite3BtreeRollbackStmt
    );
    for(i=0; xFunc && i<db->nDb; i++){ 
      int rc;
      Btree *pBt = db->aDb[i].pBt;
      if( pBt ){
        rc = xFunc(pBt);
        if( rc && (p->rc==SQLITE_OK || p->rc==SQLITE_CONSTRAINT) ){
          p->rc = rc;
          sqlite3DbFree(db, p->zErrMsg);
          p->zErrMsg = 0;
        }
      }
    }
  
    /* If this was an INSERT, UPDATE or DELETE and the statement was committed, 
    ** set the change counter. 
    */
    if( p->changeCntOn && p->pc>=0 ){
      if( !xFunc || xFunc==sqlite3BtreeCommitStmt ){
        sqlite3VdbeSetChanges(db, p->nChange);
      }else{
        sqlite3VdbeSetChanges(db, 0);
      }
      p->nChange = 0;
    }
  
    /* Rollback or commit any schema changes that occurred. */
    if( p->rc!=SQLITE_OK && db->flags&SQLITE_InternChanges ){
      sqlite3ResetInternalSchema(db, 0);
      db->flags = (db->flags | SQLITE_InternChanges);
    }

    /* Release the locks */
    sqlite3BtreeMutexArrayLeave(&p->aMutex);
  }

  /* We have successfully halted and closed the VM.  Record this fact. */
  if( p->pc>=0 ){
    db->activeVdbeCnt--;
  }
  p->magic = VDBE_MAGIC_HALT;
  checkActiveVdbeCnt(db);
  if( p->db->mallocFailed ){
    p->rc = SQLITE_NOMEM;
  }

  return SQLITE_OK;
}


/*
** Each VDBE holds the result of the most recent sqlite3_step() call
** in p->rc.  This routine sets that result back to SQLITE_OK.
*/
void sqlite3VdbeResetStepResult(Vdbe *p){
  p->rc = SQLITE_OK;
}

/*
** Clean up a VDBE after execution but do not delete the VDBE just yet.
** Write any error messages into *pzErrMsg.  Return the result code.
**
** After this routine is run, the VDBE should be ready to be executed
** again.
**
** To look at it another way, this routine resets the state of the
** virtual machine from VDBE_MAGIC_RUN or VDBE_MAGIC_HALT back to
** VDBE_MAGIC_INIT.
*/
int sqlite3VdbeReset(Vdbe *p){
  sqlite3 *db;
  db = p->db;

  /* If the VM did not run to completion or if it encountered an
  ** error, then it might not have been halted properly.  So halt
  ** it now.
  */
  (void)sqlite3SafetyOn(db);
  sqlite3VdbeHalt(p);
  (void)sqlite3SafetyOff(db);

  /* If the VDBE has be run even partially, then transfer the error code
  ** and error message from the VDBE into the main database structure.  But
  ** if the VDBE has just been set to run but has not actually executed any
  ** instructions yet, leave the main database error information unchanged.
  */
  if( p->pc>=0 ){
    if( p->zErrMsg ){
      sqlite3ValueSetStr(db->pErr,-1,p->zErrMsg,SQLITE_UTF8,SQLITE_TRANSIENT);
      db->errCode = p->rc;
      sqlite3DbFree(db, p->zErrMsg);
      p->zErrMsg = 0;
    }else if( p->rc ){
      sqlite3Error(db, p->rc, 0);
    }else{
      sqlite3Error(db, SQLITE_OK, 0);
    }
  }else if( p->rc && p->expired ){
    /* The expired flag was set on the VDBE before the first call
    ** to sqlite3_step(). For consistency (since sqlite3_step() was
    ** called), set the database error in this case as well.
    */
    sqlite3Error(db, p->rc, 0);
    sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT);
    sqlite3DbFree(db, p->zErrMsg);
    p->zErrMsg = 0;
  }

  /* Reclaim all memory used by the VDBE
  */
  Cleanup(p);

  /* Save profiling information from this VDBE run.
  */
#ifdef VDBE_PROFILE
  {
    FILE *out = fopen("vdbe_profile.out", "a");
    if( out ){
      int i;
      fprintf(out, "---- ");
      for(i=0; i<p->nOp; i++){
        fprintf(out, "%02x", p->aOp[i].opcode);
      }
      fprintf(out, "\n");
      for(i=0; i<p->nOp; i++){
        fprintf(out, "%6d %10lld %8lld ",
           p->aOp[i].cnt,
           p->aOp[i].cycles,
           p->aOp[i].cnt>0 ? p->aOp[i].cycles/p->aOp[i].cnt : 0
        );
        sqlite3VdbePrintOp(out, i, &p->aOp[i]);
      }
      fclose(out);
    }
  }
#endif
  p->magic = VDBE_MAGIC_INIT;
  return p->rc & db->errMask;
}
 
/*
** Clean up and delete a VDBE after execution.  Return an integer which is
** the result code.  Write any error message text into *pzErrMsg.
*/
int sqlite3VdbeFinalize(Vdbe *p){
  int rc = SQLITE_OK;
  if( p->magic==VDBE_MAGIC_RUN || p->magic==VDBE_MAGIC_HALT ){
    rc = sqlite3VdbeReset(p);
    assert( (rc & p->db->errMask)==rc );
  }else if( p->magic!=VDBE_MAGIC_INIT ){
    return SQLITE_MISUSE;
  }
  sqlite3VdbeDelete(p);
  return rc;
}

/*
** Call the destructor for each auxdata entry in pVdbeFunc for which
** the corresponding bit in mask is clear.  Auxdata entries beyond 31
** are always destroyed.  To destroy all auxdata entries, call this
** routine with mask==0.
*/
void sqlite3VdbeDeleteAuxData(VdbeFunc *pVdbeFunc, int mask){
  int i;
  for(i=0; i<pVdbeFunc->nAux; i++){
    struct AuxData *pAux = &pVdbeFunc->apAux[i];
    if( (i>31 || !(mask&(1<<i))) && pAux->pAux ){
      if( pAux->xDelete ){
        pAux->xDelete(pAux->pAux);
      }
      pAux->pAux = 0;
    }
  }
}

/*
** Delete an entire VDBE.
*/
void sqlite3VdbeDelete(Vdbe *p){
  int i;
  sqlite3 *db;

  if( p==0 ) return;
  db = p->db;
  if( p->pPrev ){
    p->pPrev->pNext = p->pNext;
  }else{
    assert( db->pVdbe==p );
    db->pVdbe = p->pNext;
  }
  if( p->pNext ){
    p->pNext->pPrev = p->pPrev;
  }
  if( p->aOp ){
    Op *pOp = p->aOp;
    for(i=0; i<p->nOp; i++, pOp++){
      freeP4(db, pOp->p4type, pOp->p4.p);
#ifdef SQLITE_DEBUG
      sqlite3DbFree(db, pOp->zComment);
#endif     
    }
    sqlite3DbFree(db, p->aOp);
  }
  releaseMemArray(p->aVar, p->nVar);
  sqlite3DbFree(db, p->aLabel);
  if( p->aMem ){
    sqlite3DbFree(db, &p->aMem[1]);
  }
  releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
  sqlite3DbFree(db, p->aColName);
  sqlite3DbFree(db, p->zSql);
  p->magic = VDBE_MAGIC_DEAD;
  sqlite3DbFree(db, p);
}

/*
** If a MoveTo operation is pending on the given cursor, then do that
** MoveTo now.  Return an error code.  If no MoveTo is pending, this
** routine does nothing and returns SQLITE_OK.
*/
int sqlite3VdbeCursorMoveto(Cursor *p){
  if( p->deferredMoveto ){
    int res, rc;
#ifdef SQLITE_TEST
    extern int sqlite3_search_count;
#endif
    assert( p->isTable );
    rc = sqlite3BtreeMoveto(p->pCursor, 0, 0, p->movetoTarget, 0, &res);
    if( rc ) return rc;
    *p->pIncrKey = 0;
    p->lastRowid = keyToInt(p->movetoTarget);
    p->rowidIsValid = res==0;
    if( res<0 ){
      rc = sqlite3BtreeNext(p->pCursor, &res);
      if( rc ) return rc;
    }
#ifdef SQLITE_TEST
    sqlite3_search_count++;
#endif
    p->deferredMoveto = 0;
    p->cacheStatus = CACHE_STALE;
  }else if( p->pCursor ){
    int hasMoved;
    int rc = sqlite3BtreeCursorHasMoved(p->pCursor, &hasMoved);
    if( rc ) return rc;
    if( hasMoved ){
      p->cacheStatus = CACHE_STALE;
      p->nullRow = 1;
    }
  }
  return SQLITE_OK;
}

/*
** The following functions:
**
** sqlite3VdbeSerialType()
** sqlite3VdbeSerialTypeLen()
** sqlite3VdbeSerialLen()
** sqlite3VdbeSerialPut()
** sqlite3VdbeSerialGet()
**
** encapsulate the code that serializes values for storage in SQLite
** data and index records. Each serialized value consists of a
** 'serial-type' and a blob of data. The serial type is an 8-byte unsigned
** integer, stored as a varint.
**
** In an SQLite index record, the serial type is stored directly before
** the blob of data that it corresponds to. In a table record, all serial
** types are stored at the start of the record, and the blobs of data at
** the end. Hence these functions allow the caller to handle the
** serial-type and data blob seperately.
**
** The following table describes the various storage classes for data:
**
**   serial type        bytes of data      type
**   --------------     ---------------    ---------------
**      0                     0            NULL
**      1                     1            signed integer
**      2                     2            signed integer
**      3                     3            signed integer
**      4                     4            signed integer
**      5                     6            signed integer
**      6                     8            signed integer
**      7                     8            IEEE float
**      8                     0            Integer constant 0
**      9                     0            Integer constant 1
**     10,11                               reserved for expansion
**    N>=12 and even       (N-12)/2        BLOB
**    N>=13 and odd        (N-13)/2        text
**
** The 8 and 9 types were added in 3.3.0, file format 4.  Prior versions
** of SQLite will not understand those serial types.
*/

/*
** Return the serial-type for the value stored in pMem.
*/
u32 sqlite3VdbeSerialType(Mem *pMem, int file_format){
  int flags = pMem->flags;
  int n;

  if( flags&MEM_Null ){
    return 0;
  }
  if( flags&MEM_Int ){
    /* Figure out whether to use 1, 2, 4, 6 or 8 bytes. */
#   define MAX_6BYTE ((((i64)0x00008000)<<32)-1)
    i64 i = pMem->u.i;
    u64 u;
    if( file_format>=4 && (i&1)==i ){
      return 8+i;
    }
    u = i<0 ? -i : i;
    if( u<=127 ) return 1;
    if( u<=32767 ) return 2;
    if( u<=8388607 ) return 3;
    if( u<=2147483647 ) return 4;
    if( u<=MAX_6BYTE ) return 5;
    return 6;
  }
  if( flags&MEM_Real ){
    return 7;
  }
  assert( flags&(MEM_Str|MEM_Blob) );
  n = pMem->n;
  if( flags & MEM_Zero ){
    n += pMem->u.i;
  }
  assert( n>=0 );
  return ((n*2) + 12 + ((flags&MEM_Str)!=0));
}

/*
** Return the length of the data corresponding to the supplied serial-type.
*/
int sqlite3VdbeSerialTypeLen(u32 serial_type){
  if( serial_type>=12 ){
    return (serial_type-12)/2;
  }else{
    static const u8 aSize[] = { 0, 1, 2, 3, 4, 6, 8, 8, 0, 0, 0, 0 };
    return aSize[serial_type];
  }
}

/*
** If we are on an architecture with mixed-endian floating 
** points (ex: ARM7) then swap the lower 4 bytes with the 
** upper 4 bytes.  Return the result.
**
** For most architectures, this is a no-op.
**
** (later):  It is reported to me that the mixed-endian problem
** on ARM7 is an issue with GCC, not with the ARM7 chip.  It seems
** that early versions of GCC stored the two words of a 64-bit
** float in the wrong order.  And that error has been propagated
** ever since.  The blame is not necessarily with GCC, though.
** GCC might have just copying the problem from a prior compiler.
** I am also told that newer versions of GCC that follow a different
** ABI get the byte order right.
**
** Developers using SQLite on an ARM7 should compile and run their
** application using -DSQLITE_DEBUG=1 at least once.  With DEBUG
** enabled, some asserts below will ensure that the byte order of
** floating point values is correct.
**
** (2007-08-30)  Frank van Vugt has studied this problem closely
** and has send his findings to the SQLite developers.  Frank
** writes that some Linux kernels offer floating point hardware
** emulation that uses only 32-bit mantissas instead of a full 
** 48-bits as required by the IEEE standard.  (This is the
** CONFIG_FPE_FASTFPE option.)  On such systems, floating point
** byte swapping becomes very complicated.  To avoid problems,
** the necessary byte swapping is carried out using a 64-bit integer
** rather than a 64-bit float.  Frank assures us that the code here
** works for him.  We, the developers, have no way to independently
** verify this, but Frank seems to know what he is talking about
** so we trust him.
*/
#ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT
static u64 floatSwap(u64 in){
  union {
    u64 r;
    u32 i[2];
  } u;
  u32 t;

  u.r = in;
  t = u.i[0];
  u.i[0] = u.i[1];
  u.i[1] = t;
  return u.r;
}
# define swapMixedEndianFloat(X)  X = floatSwap(X)
#else
# define swapMixedEndianFloat(X)
#endif

/*
** Write the serialized data blob for the value stored in pMem into 
** buf. It is assumed that the caller has allocated sufficient space.
** Return the number of bytes written.
**
** nBuf is the amount of space left in buf[].  nBuf must always be
** large enough to hold the entire field.  Except, if the field is
** a blob with a zero-filled tail, then buf[] might be just the right
** size to hold everything except for the zero-filled tail.  If buf[]
** is only big enough to hold the non-zero prefix, then only write that
** prefix into buf[].  But if buf[] is large enough to hold both the
** prefix and the tail then write the prefix and set the tail to all
** zeros.
**
** Return the number of bytes actually written into buf[].  The number
** of bytes in the zero-filled tail is included in the return value only
** if those bytes were zeroed in buf[].
*/ 
int sqlite3VdbeSerialPut(u8 *buf, int nBuf, Mem *pMem, int file_format){
  u32 serial_type = sqlite3VdbeSerialType(pMem, file_format);
  int len;

  /* Integer and Real */
  if( serial_type<=7 && serial_type>0 ){
    u64 v;
    int i;
    if( serial_type==7 ){
      assert( sizeof(v)==sizeof(pMem->r) );
      memcpy(&v, &pMem->r, sizeof(v));
      swapMixedEndianFloat(v);
    }else{
      v = pMem->u.i;
    }
    len = i = sqlite3VdbeSerialTypeLen(serial_type);
    assert( len<=nBuf );
    while( i-- ){
      buf[i] = (v&0xFF);
      v >>= 8;
    }
    return len;
  }

  /* String or blob */
  if( serial_type>=12 ){
    assert( pMem->n + ((pMem->flags & MEM_Zero)?pMem->u.i:0)
             == sqlite3VdbeSerialTypeLen(serial_type) );
    assert( pMem->n<=nBuf );
    len = pMem->n;
    memcpy(buf, pMem->z, len);
    if( pMem->flags & MEM_Zero ){
      len += pMem->u.i;
      if( len>nBuf ){
        len = nBuf;
      }
      memset(&buf[pMem->n], 0, len-pMem->n);
    }
    return len;
  }

  /* NULL or constants 0 or 1 */
  return 0;
}

/*
** Deserialize the data blob pointed to by buf as serial type serial_type
** and store the result in pMem.  Return the number of bytes read.
*/ 
int sqlite3VdbeSerialGet(
  const unsigned char *buf,     /* Buffer to deserialize from */
  u32 serial_type,              /* Serial type to deserialize */
  Mem *pMem                     /* Memory cell to write value into */
){
  switch( serial_type ){
    case 10:   /* Reserved for future use */
    case 11:   /* Reserved for future use */
    case 0: {  /* NULL */
      pMem->flags = MEM_Null;
      break;
    }
    case 1: { /* 1-byte signed integer */
      pMem->u.i = (signed char)buf[0];
      pMem->flags = MEM_Int;
      return 1;
    }
    case 2: { /* 2-byte signed integer */
      pMem->u.i = (((signed char)buf[0])<<8) | buf[1];
      pMem->flags = MEM_Int;
      return 2;
    }
    case 3: { /* 3-byte signed integer */
      pMem->u.i = (((signed char)buf[0])<<16) | (buf[1]<<8) | buf[2];
      pMem->flags = MEM_Int;
      return 3;
    }
    case 4: { /* 4-byte signed integer */
      pMem->u.i = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
      pMem->flags = MEM_Int;
      return 4;
    }
    case 5: { /* 6-byte signed integer */
      u64 x = (((signed char)buf[0])<<8) | buf[1];
      u32 y = (buf[2]<<24) | (buf[3]<<16) | (buf[4]<<8) | buf[5];
      x = (x<<32) | y;
      pMem->u.i = *(i64*)&x;
      pMem->flags = MEM_Int;
      return 6;
    }
    case 6:   /* 8-byte signed integer */
    case 7: { /* IEEE floating point */
      u64 x;
      u32 y;
#if !defined(NDEBUG) && !defined(SQLITE_OMIT_FLOATING_POINT)
      /* Verify that integers and floating point values use the same
      ** byte order.  Or, that if SQLITE_MIXED_ENDIAN_64BIT_FLOAT is
      ** defined that 64-bit floating point values really are mixed
      ** endian.
      */
      static const u64 t1 = ((u64)0x3ff00000)<<32;
      static const double r1 = 1.0;
      u64 t2 = t1;
      swapMixedEndianFloat(t2);
      assert( sizeof(r1)==sizeof(t2) && memcmp(&r1, &t2, sizeof(r1))==0 );
#endif

      x = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
      y = (buf[4]<<24) | (buf[5]<<16) | (buf[6]<<8) | buf[7];
      x = (x<<32) | y;
      if( serial_type==6 ){
        pMem->u.i = *(i64*)&x;
        pMem->flags = MEM_Int;
      }else{
        assert( sizeof(x)==8 && sizeof(pMem->r)==8 );
        swapMixedEndianFloat(x);
        memcpy(&pMem->r, &x, sizeof(x));
        pMem->flags = sqlite3IsNaN(pMem->r) ? MEM_Null : MEM_Real;
      }
      return 8;
    }
    case 8:    /* Integer 0 */
    case 9: {  /* Integer 1 */
      pMem->u.i = serial_type-8;
      pMem->flags = MEM_Int;
      return 0;
    }
    default: {
      int len = (serial_type-12)/2;
      pMem->z = (char *)buf;
      pMem->n = len;
      pMem->xDel = 0;
      if( serial_type&0x01 ){
        pMem->flags = MEM_Str | MEM_Ephem;
      }else{
        pMem->flags = MEM_Blob | MEM_Ephem;
      }
      return len;
    }
  }
  return 0;
}


/*
** Given the nKey-byte encoding of a record in pKey[], parse the
** record into a UnpackedRecord structure.  Return a pointer to
** that structure.
**
** The calling function might provide szSpace bytes of memory
** space at pSpace.  This space can be used to hold the returned
** VDbeParsedRecord structure if it is large enough.  If it is
** not big enough, space is obtained from sqlite3_malloc().
**
** The returned structure should be closed by a call to
** sqlite3VdbeDeleteUnpackedRecord().
*/ 
UnpackedRecord *sqlite3VdbeRecordUnpack(
  KeyInfo *pKeyInfo,     /* Information about the record format */
  int nKey,              /* Size of the binary record */
  const void *pKey,      /* The binary record */
  void *pSpace,          /* Space available to hold resulting object */
  int szSpace            /* Size of pSpace[] in bytes */
){
  const unsigned char *aKey = (const unsigned char *)pKey;
  UnpackedRecord *p;
  int nByte;
  int idx, d;
  u16 u;                 /* Unsigned loop counter */
  u32 szHdr;
  Mem *pMem;
  
  assert( sizeof(Mem)>sizeof(*p) );
  nByte = sizeof(Mem)*(pKeyInfo->nField+2);
  if( nByte>szSpace ){
    p = sqlite3DbMallocRaw(pKeyInfo->db, nByte);
    if( p==0 ) return 0;
    p->needFree = 1;
  }else{
    p = pSpace;
    p->needFree = 0;
  }
  p->pKeyInfo = pKeyInfo;
  p->nField = pKeyInfo->nField + 1;
  p->needDestroy = 1;
  p->aMem = pMem = &((Mem*)p)[1];
  idx = getVarint32(aKey, szHdr);
  d = szHdr;
  u = 0;
  while( idx<szHdr && u<p->nField ){
    u32 serial_type;

    idx += getVarint32( aKey+idx, serial_type);
    if( d>=nKey && sqlite3VdbeSerialTypeLen(serial_type)>0 ) break;
    pMem->enc = pKeyInfo->enc;
    pMem->db = pKeyInfo->db;
    pMem->flags = 0;
    pMem->zMalloc = 0;
    d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem);
    pMem++;
    u++;
  }
  p->nField = u;
  return (void*)p;
}

/*
** This routine destroys a UnpackedRecord object
*/
void sqlite3VdbeDeleteUnpackedRecord(UnpackedRecord *p){
  if( p ){
    if( p->needDestroy ){
      int i;
      Mem *pMem;
      for(i=0, pMem=p->aMem; i<p->nField; i++, pMem++){
        if( pMem->zMalloc ){
          sqlite3VdbeMemRelease(pMem);
        }
      }
    }
    if( p->needFree ){
      sqlite3DbFree(p->pKeyInfo->db, p);
    }
  }
}

/*
** This function compares the two table rows or index records
** specified by {nKey1, pKey1} and pPKey2.  It returns a negative, zero
** or positive integer if {nKey1, pKey1} is less than, equal to or 
** greater than pPKey2.  The {nKey1, pKey1} key must be a blob
** created by th OP_MakeRecord opcode of the VDBE.  The pPKey2
** key must be a parsed key such as obtained from
** sqlite3VdbeParseRecord.
**
** Key1 and Key2 do not have to contain the same number of fields.
** But if the lengths differ, Key2 must be the shorter of the two.
**
** Historical note: In earlier versions of this routine both Key1
** and Key2 were blobs obtained from OP_MakeRecord.  But we found
** that in typical use the same Key2 would be submitted multiple times
** in a row.  So an optimization was added to parse the Key2 key
** separately and submit the parsed version.  In this way, we avoid
** parsing the same Key2 multiple times in a row.
*/
int sqlite3VdbeRecordCompare(
  int nKey1, const void *pKey1, 
  UnpackedRecord *pPKey2
){
  u32 d1;            /* Offset into aKey[] of next data element */
  u32 idx1;          /* Offset into aKey[] of next header element */
  u32 szHdr1;        /* Number of bytes in header */
  int i = 0;
  int nField;
  int rc = 0;
  const unsigned char *aKey1 = (const unsigned char *)pKey1;
  KeyInfo *pKeyInfo;
  Mem mem1;

  pKeyInfo = pPKey2->pKeyInfo;
  mem1.enc = pKeyInfo->enc;
  mem1.db = pKeyInfo->db;
  mem1.flags = 0;
  mem1.zMalloc = 0;
  
  idx1 = getVarint32(aKey1, szHdr1);
  d1 = szHdr1;
  nField = pKeyInfo->nField;
  while( idx1<szHdr1 && i<pPKey2->nField ){
    u32 serial_type1;

    /* Read the serial types for the next element in each key. */
    idx1 += getVarint32( aKey1+idx1, serial_type1 );
    if( d1>=nKey1 && sqlite3VdbeSerialTypeLen(serial_type1)>0 ) break;

    /* Extract the values to be compared.
    */
    d1 += sqlite3VdbeSerialGet(&aKey1[d1], serial_type1, &mem1);

    /* Do the comparison
    */
    rc = sqlite3MemCompare(&mem1, &pPKey2->aMem[i],
                           i<nField ? pKeyInfo->aColl[i] : 0);
    if( rc!=0 ){
      break;
    }
    i++;
  }
  if( mem1.zMalloc ) sqlite3VdbeMemRelease(&mem1);

  /* One of the keys ran out of fields, but all the fields up to that point
  ** were equal. If the incrKey flag is true, then the second key is
  ** treated as larger.
  */
  if( rc==0 ){
    if( pKeyInfo->incrKey ){
      rc = -1;
    }else if( !pKeyInfo->prefixIsEqual ){
      if( d1<nKey1 ){
        rc = 1;
      }
    }
  }else if( pKeyInfo->aSortOrder && i<pKeyInfo->nField
               && pKeyInfo->aSortOrder[i] ){
    rc = -rc;
  }

  return rc;
}

/*
** The argument is an index entry composed using the OP_MakeRecord opcode.
** The last entry in this record should be an integer (specifically
** an integer rowid).  This routine returns the number of bytes in
** that integer.
*/
int sqlite3VdbeIdxRowidLen(const u8 *aKey, int nKey, int *pRowidLen){
  u32 szHdr;        /* Size of the header */
  u32 typeRowid;    /* Serial type of the rowid */

  (void)getVarint32(aKey, szHdr);
  if( szHdr>nKey ){
    return SQLITE_CORRUPT_BKPT;
  }
  (void)getVarint32(&aKey[szHdr-1], typeRowid);
  *pRowidLen = sqlite3VdbeSerialTypeLen(typeRowid);
  return SQLITE_OK;
}
  

/*
** pCur points at an index entry created using the OP_MakeRecord opcode.
** Read the rowid (the last field in the record) and store it in *rowid.
** Return SQLITE_OK if everything works, or an error code otherwise.
*/
int sqlite3VdbeIdxRowid(BtCursor *pCur, i64 *rowid){
  i64 nCellKey = 0;
  int rc;
  u32 szHdr;        /* Size of the header */
  u32 typeRowid;    /* Serial type of the rowid */
  u32 lenRowid;     /* Size of the rowid */
  Mem m, v;

  sqlite3BtreeKeySize(pCur, &nCellKey);
  if( nCellKey<=0 ){
    return SQLITE_CORRUPT_BKPT;
  }
  m.flags = 0;
  m.db = 0;
  m.zMalloc = 0;
  rc = sqlite3VdbeMemFromBtree(pCur, 0, nCellKey, 1, &m);
  if( rc ){
    return rc;
  }
  (void)getVarint32((u8*)m.z, szHdr);
  (void)getVarint32((u8*)&m.z[szHdr-1], typeRowid);
  lenRowid = sqlite3VdbeSerialTypeLen(typeRowid);
  sqlite3VdbeSerialGet((u8*)&m.z[m.n-lenRowid], typeRowid, &v);
  *rowid = v.u.i;
  sqlite3VdbeMemRelease(&m);
  return SQLITE_OK;
}

/*
** Compare the key of the index entry that cursor pC is point to against
** the key string in pKey (of length nKey).  Write into *pRes a number
** that is negative, zero, or positive if pC is less than, equal to,
** or greater than pKey.  Return SQLITE_OK on success.
**
** pKey is either created without a rowid or is truncated so that it
** omits the rowid at the end.  The rowid at the end of the index entry
** is ignored as well.
*/
int sqlite3VdbeIdxKeyCompare(
  Cursor *pC,                 /* The cursor to compare against */
  UnpackedRecord *pUnpacked,
  int nKey, const u8 *pKey,   /* The key to compare */
  int *res                    /* Write the comparison result here */
){
  i64 nCellKey = 0;
  int rc;
  BtCursor *pCur = pC->pCursor;
  int lenRowid;
  Mem m;
  UnpackedRecord *pRec;
  char zSpace[200];

  sqlite3BtreeKeySize(pCur, &nCellKey);
  if( nCellKey<=0 ){
    *res = 0;
    return SQLITE_OK;
  }
  m.db = 0;
  m.flags = 0;
  m.zMalloc = 0;
  if( (rc = sqlite3VdbeMemFromBtree(pC->pCursor, 0, nCellKey, 1, &m))
   || (rc = sqlite3VdbeIdxRowidLen((u8*)m.z, m.n, &lenRowid))
  ){
    return rc;
  }
  if( !pUnpacked ){
    pRec = sqlite3VdbeRecordUnpack(pC->pKeyInfo, nKey, pKey,
                                zSpace, sizeof(zSpace));
  }else{
    pRec = pUnpacked;
  }
  if( pRec==0 ){
    return SQLITE_NOMEM;
  }
  *res = sqlite3VdbeRecordCompare(m.n-lenRowid, m.z, pRec);
  if( !pUnpacked ){
    sqlite3VdbeDeleteUnpackedRecord(pRec);
  }
  sqlite3VdbeMemRelease(&m);
  return SQLITE_OK;
}

/*
** This routine sets the value to be returned by subsequent calls to
** sqlite3_changes() on the database handle 'db'. 
*/
void sqlite3VdbeSetChanges(sqlite3 *db, int nChange){
  assert( sqlite3_mutex_held(db->mutex) );
  db->nChange = nChange;
  db->nTotalChange += nChange;
}

/*
** Set a flag in the vdbe to update the change counter when it is finalised
** or reset.
*/
void sqlite3VdbeCountChanges(Vdbe *v){
  v->changeCntOn = 1;
}

/*
** Mark every prepared statement associated with a database connection
** as expired.
**
** An expired statement means that recompilation of the statement is
** recommend.  Statements expire when things happen that make their
** programs obsolete.  Removing user-defined functions or collating
** sequences, or changing an authorization function are the types of
** things that make prepared statements obsolete.
*/
void sqlite3ExpirePreparedStatements(sqlite3 *db){
  Vdbe *p;
  for(p = db->pVdbe; p; p=p->pNext){
    p->expired = 1;
  }
}

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




































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/vdbeblob.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
/*
** 2007 May 1
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains code used to implement incremental BLOB I/O.
**
** $Id: vdbeblob.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/

#include "sqliteInt.h"
#include "vdbeInt.h"

#ifndef SQLITE_OMIT_INCRBLOB

/*
** Valid sqlite3_blob* handles point to Incrblob structures.
*/
typedef struct Incrblob Incrblob;
struct Incrblob {
  int flags;              /* Copy of "flags" passed to sqlite3_blob_open() */
  int nByte;              /* Size of open blob, in bytes */
  int iOffset;            /* Byte offset of blob in cursor data */
  BtCursor *pCsr;         /* Cursor pointing at blob row */
  sqlite3_stmt *pStmt;    /* Statement holding cursor open */
  sqlite3 *db;            /* The associated database */
};

/*
** Open a blob handle.
*/
int sqlite3_blob_open(
  sqlite3* db,            /* The database connection */
  const char *zDb,        /* The attached database containing the blob */
  const char *zTable,     /* The table containing the blob */
  const char *zColumn,    /* The column containing the blob */
  sqlite_int64 iRow,      /* The row containing the glob */
  int flags,              /* True -> read/write access, false -> read-only */
  sqlite3_blob **ppBlob   /* Handle for accessing the blob returned here */
){
  int nAttempt = 0;
  int iCol;               /* Index of zColumn in row-record */

  /* This VDBE program seeks a btree cursor to the identified 
  ** db/table/row entry. The reason for using a vdbe program instead
  ** of writing code to use the b-tree layer directly is that the
  ** vdbe program will take advantage of the various transaction,
  ** locking and error handling infrastructure built into the vdbe.
  **
  ** After seeking the cursor, the vdbe executes an OP_ResultRow.
  ** Code external to the Vdbe then "borrows" the b-tree cursor and
  ** uses it to implement the blob_read(), blob_write() and 
  ** blob_bytes() functions.
  **
  ** The sqlite3_blob_close() function finalizes the vdbe program,
  ** which closes the b-tree cursor and (possibly) commits the 
  ** transaction.
  */
  static const VdbeOpList openBlob[] = {
    {OP_Transaction, 0, 0, 0},     /* 0: Start a transaction */
    {OP_VerifyCookie, 0, 0, 0},    /* 1: Check the schema cookie */

    /* One of the following two instructions is replaced by an
    ** OP_Noop before exection.
    */
    {OP_SetNumColumns, 0, 0, 0},   /* 2: Num cols for cursor */
    {OP_OpenRead, 0, 0, 0},        /* 3: Open cursor 0 for reading */
    {OP_SetNumColumns, 0, 0, 0},   /* 4: Num cols for cursor */
    {OP_OpenWrite, 0, 0, 0},       /* 5: Open cursor 0 for read/write */

    {OP_Variable, 1, 1, 0},        /* 6: Push the rowid to the stack */
    {OP_NotExists, 0, 10, 1},      /* 7: Seek the cursor */
    {OP_Column, 0, 0, 1},          /* 8  */
    {OP_ResultRow, 1, 0, 0},       /* 9  */
    {OP_Close, 0, 0, 0},           /* 10  */
    {OP_Halt, 0, 0, 0},            /* 11 */
  };

  Vdbe *v = 0;
  int rc = SQLITE_OK;
  char zErr[128];

  zErr[0] = 0;
  sqlite3_mutex_enter(db->mutex);
  do {
    Parse sParse;
    Table *pTab;

    memset(&sParse, 0, sizeof(Parse));
    sParse.db = db;

    if( sqlite3SafetyOn(db) ){
      sqlite3_mutex_leave(db->mutex);
      return SQLITE_MISUSE;
    }

    sqlite3BtreeEnterAll(db);
    pTab = sqlite3LocateTable(&sParse, 0, zTable, zDb);
    if( pTab && IsVirtual(pTab) ){
      pTab = 0;
      sqlite3ErrorMsg(&sParse, "cannot open virtual table: %s", zTable);
    }
#ifndef SQLITE_OMIT_VIEW
    if( pTab && pTab->pSelect ){
      pTab = 0;
      sqlite3ErrorMsg(&sParse, "cannot open view: %s", zTable);
    }
#endif
    if( !pTab ){
      if( sParse.zErrMsg ){
        sqlite3_snprintf(sizeof(zErr), zErr, "%s", sParse.zErrMsg);
      }
      sqlite3DbFree(db, sParse.zErrMsg);
      rc = SQLITE_ERROR;
      (void)sqlite3SafetyOff(db);
      sqlite3BtreeLeaveAll(db);
      goto blob_open_out;
    }

    /* Now search pTab for the exact column. */
    for(iCol=0; iCol < pTab->nCol; iCol++) {
      if( sqlite3StrICmp(pTab->aCol[iCol].zName, zColumn)==0 ){
        break;
      }
    }
    if( iCol==pTab->nCol ){
      sqlite3_snprintf(sizeof(zErr), zErr, "no such column: \"%s\"", zColumn);
      rc = SQLITE_ERROR;
      (void)sqlite3SafetyOff(db);
      sqlite3BtreeLeaveAll(db);
      goto blob_open_out;
    }

    /* If the value is being opened for writing, check that the
    ** column is not indexed. It is against the rules to open an
    ** indexed column for writing.
    */
    if( flags ){
      Index *pIdx;
      for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
        int j;
        for(j=0; j<pIdx->nColumn; j++){
          if( pIdx->aiColumn[j]==iCol ){
            sqlite3_snprintf(sizeof(zErr), zErr,
                             "cannot open indexed column for writing");
            rc = SQLITE_ERROR;
            (void)sqlite3SafetyOff(db);
            sqlite3BtreeLeaveAll(db);
            goto blob_open_out;
          }
        }
      }
    }

    v = sqlite3VdbeCreate(db);
    if( v ){
      int iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
      sqlite3VdbeAddOpList(v, sizeof(openBlob)/sizeof(VdbeOpList), openBlob);

      /* Configure the OP_Transaction */
      sqlite3VdbeChangeP1(v, 0, iDb);
      sqlite3VdbeChangeP2(v, 0, (flags ? 1 : 0));

      /* Configure the OP_VerifyCookie */
      sqlite3VdbeChangeP1(v, 1, iDb);
      sqlite3VdbeChangeP2(v, 1, pTab->pSchema->schema_cookie);

      /* Make sure a mutex is held on the table to be accessed */
      sqlite3VdbeUsesBtree(v, iDb); 

      /* Remove either the OP_OpenWrite or OpenRead. Set the P2 
      ** parameter of the other to pTab->tnum. 
      */
      sqlite3VdbeChangeToNoop(v, (flags ? 3 : 5), 1);
      sqlite3VdbeChangeP2(v, (flags ? 5 : 3), pTab->tnum);
      sqlite3VdbeChangeP3(v, (flags ? 5 : 3), iDb);

      /* Configure the OP_SetNumColumns. Configure the cursor to
      ** think that the table has one more column than it really
      ** does. An OP_Column to retrieve this imaginary column will
      ** always return an SQL NULL. This is useful because it means
      ** we can invoke OP_Column to fill in the vdbe cursors type 
      ** and offset cache without causing any IO.
      */
      sqlite3VdbeChangeP2(v, flags ? 4 : 2, pTab->nCol+1);
      sqlite3VdbeChangeP2(v, 8, pTab->nCol);
      if( !db->mallocFailed ){
        sqlite3VdbeMakeReady(v, 1, 1, 1, 0);
      }
    }
   
    sqlite3BtreeLeaveAll(db);
    rc = sqlite3SafetyOff(db);
    if( rc!=SQLITE_OK || db->mallocFailed ){
      goto blob_open_out;
    }

    sqlite3_bind_int64((sqlite3_stmt *)v, 1, iRow);
    rc = sqlite3_step((sqlite3_stmt *)v);
    if( rc!=SQLITE_ROW ){
      nAttempt++;
      rc = sqlite3_finalize((sqlite3_stmt *)v);
      sqlite3_snprintf(sizeof(zErr), zErr, sqlite3_errmsg(db));
      v = 0;
    }
  } while( nAttempt<5 && rc==SQLITE_SCHEMA );

  if( rc==SQLITE_ROW ){
    /* The row-record has been opened successfully. Check that the
    ** column in question contains text or a blob. If it contains
    ** text, it is up to the caller to get the encoding right.
    */
    Incrblob *pBlob;
    u32 type = v->apCsr[0]->aType[iCol];

    if( type<12 ){
      sqlite3_snprintf(sizeof(zErr), zErr, "cannot open value of type %s",
          type==0?"null": type==7?"real": "integer"
      );
      rc = SQLITE_ERROR;
      goto blob_open_out;
    }
    pBlob = (Incrblob *)sqlite3DbMallocZero(db, sizeof(Incrblob));
    if( db->mallocFailed ){
      sqlite3DbFree(db, pBlob);
      goto blob_open_out;
    }
    pBlob->flags = flags;
    pBlob->pCsr =  v->apCsr[0]->pCursor;
    sqlite3BtreeEnterCursor(pBlob->pCsr);
    sqlite3BtreeCacheOverflow(pBlob->pCsr);
    sqlite3BtreeLeaveCursor(pBlob->pCsr);
    pBlob->pStmt = (sqlite3_stmt *)v;
    pBlob->iOffset = v->apCsr[0]->aOffset[iCol];
    pBlob->nByte = sqlite3VdbeSerialTypeLen(type);
    pBlob->db = db;
    *ppBlob = (sqlite3_blob *)pBlob;
    rc = SQLITE_OK;
  }else if( rc==SQLITE_OK ){
    sqlite3_snprintf(sizeof(zErr), zErr, "no such rowid: %lld", iRow);
    rc = SQLITE_ERROR;
  }

blob_open_out:
  zErr[sizeof(zErr)-1] = '\0';
  if( rc!=SQLITE_OK || db->mallocFailed ){
    sqlite3_finalize((sqlite3_stmt *)v);
  }
  sqlite3Error(db, rc, (rc==SQLITE_OK?0:zErr));
  rc = sqlite3ApiExit(db, rc);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

/*
** Close a blob handle that was previously created using
** sqlite3_blob_open().
*/
int sqlite3_blob_close(sqlite3_blob *pBlob){
  Incrblob *p = (Incrblob *)pBlob;
  int rc;

  rc = sqlite3_finalize(p->pStmt);
  sqlite3DbFree(p->db, p);
  return rc;
}

/*
** Perform a read or write operation on a blob
*/
static int blobReadWrite(
  sqlite3_blob *pBlob, 
  void *z, 
  int n, 
  int iOffset, 
  int (*xCall)(BtCursor*, u32, u32, void*)
){
  int rc;
  Incrblob *p = (Incrblob *)pBlob;
  Vdbe *v;
  sqlite3 *db = p->db;  

  /* Request is out of range. Return a transient error. */
  if( (iOffset+n)>p->nByte ){
    return SQLITE_ERROR;
  }
  sqlite3_mutex_enter(db->mutex);

  /* If there is no statement handle, then the blob-handle has
  ** already been invalidated. Return SQLITE_ABORT in this case.
  */
  v = (Vdbe*)p->pStmt;
  if( v==0 ){
    rc = SQLITE_ABORT;
  }else{
    /* Call either BtreeData() or BtreePutData(). If SQLITE_ABORT is
    ** returned, clean-up the statement handle.
    */
    assert( db == v->db );
    sqlite3BtreeEnterCursor(p->pCsr);
    rc = xCall(p->pCsr, iOffset+p->iOffset, n, z);
    sqlite3BtreeLeaveCursor(p->pCsr);
    if( rc==SQLITE_ABORT ){
      sqlite3VdbeFinalize(v);
      p->pStmt = 0;
    }else{
      db->errCode = rc;
      v->rc = rc;
    }
  }
  rc = sqlite3ApiExit(db, rc);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

/*
** Read data from a blob handle.
*/
int sqlite3_blob_read(sqlite3_blob *pBlob, void *z, int n, int iOffset){
  return blobReadWrite(pBlob, z, n, iOffset, sqlite3BtreeData);
}

/*
** Write data to a blob handle.
*/
int sqlite3_blob_write(sqlite3_blob *pBlob, const void *z, int n, int iOffset){
  return blobReadWrite(pBlob, (void *)z, n, iOffset, sqlite3BtreePutData);
}

/*
** Query a blob handle for the size of the data.
**
** The Incrblob.nByte field is fixed for the lifetime of the Incrblob
** so no mutex is required for access.
*/
int sqlite3_blob_bytes(sqlite3_blob *pBlob){
  Incrblob *p = (Incrblob *)pBlob;
  return p->nByte;
}

#endif /* #ifndef SQLITE_OMIT_INCRBLOB */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/vdbefifo.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
** 2005 June 16
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file implements a FIFO queue of rowids used for processing
** UPDATE and DELETE statements.
**
** $Id: vdbefifo.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include "vdbeInt.h"

/*
** Constants FIFOSIZE_FIRST and FIFOSIZE_MAX are the initial
** number of entries in a fifo page and the maximum number of
** entries in a fifo page.
*/
#define FIFOSIZE_FIRST (((128-sizeof(FifoPage))/8)+1)
#ifdef SQLITE_MALLOC_SOFT_LIMIT
# define FIFOSIZE_MAX   (((SQLITE_MALLOC_SOFT_LIMIT-sizeof(FifoPage))/8)+1)
#else
# define FIFOSIZE_MAX   (((262144-sizeof(FifoPage))/8)+1)
#endif

/*
** Allocate a new FifoPage and return a pointer to it.  Return NULL if
** we run out of memory.  Leave space on the page for nEntry entries.
*/
static FifoPage *allocateFifoPage(sqlite3 *db, int nEntry){
  FifoPage *pPage;
  if( nEntry>FIFOSIZE_MAX ){
    nEntry = FIFOSIZE_MAX;
  }
  pPage = sqlite3DbMallocRaw(db, sizeof(FifoPage) + sizeof(i64)*(nEntry-1) );
  if( pPage ){
    pPage->nSlot = nEntry;
    pPage->iWrite = 0;
    pPage->iRead = 0;
    pPage->pNext = 0;
  }
  return pPage;
}

/*
** Initialize a Fifo structure.
*/
void sqlite3VdbeFifoInit(Fifo *pFifo, sqlite3 *db){
  memset(pFifo, 0, sizeof(*pFifo));
  pFifo->db = db;
}

/*
** Push a single 64-bit integer value into the Fifo.  Return SQLITE_OK
** normally.   SQLITE_NOMEM is returned if we are unable to allocate
** memory.
*/
int sqlite3VdbeFifoPush(Fifo *pFifo, i64 val){
  FifoPage *pPage;
  pPage = pFifo->pLast;
  if( pPage==0 ){
    pPage = pFifo->pLast = pFifo->pFirst =
         allocateFifoPage(pFifo->db, FIFOSIZE_FIRST);
    if( pPage==0 ){
      return SQLITE_NOMEM;
    }
  }else if( pPage->iWrite>=pPage->nSlot ){
    pPage->pNext = allocateFifoPage(pFifo->db, pFifo->nEntry);
    if( pPage->pNext==0 ){
      return SQLITE_NOMEM;
    }
    pPage = pFifo->pLast = pPage->pNext;
  }
  pPage->aSlot[pPage->iWrite++] = val;
  pFifo->nEntry++;
  return SQLITE_OK;
}

/*
** Extract a single 64-bit integer value from the Fifo.  The integer
** extracted is the one least recently inserted.  If the Fifo is empty
** return SQLITE_DONE.
*/
int sqlite3VdbeFifoPop(Fifo *pFifo, i64 *pVal){
  FifoPage *pPage;
  if( pFifo->nEntry==0 ){
    return SQLITE_DONE;
  }
  assert( pFifo->nEntry>0 );
  pPage = pFifo->pFirst;
  assert( pPage!=0 );
  assert( pPage->iWrite>pPage->iRead );
  assert( pPage->iWrite<=pPage->nSlot );
  assert( pPage->iRead<pPage->nSlot );
  assert( pPage->iRead>=0 );
  *pVal = pPage->aSlot[pPage->iRead++];
  pFifo->nEntry--;
  if( pPage->iRead>=pPage->iWrite ){
    pFifo->pFirst = pPage->pNext;
    sqlite3DbFree(pFifo->db, pPage);
    if( pFifo->nEntry==0 ){
      assert( pFifo->pLast==pPage );
      pFifo->pLast = 0;
    }else{
      assert( pFifo->pFirst!=0 );
    }
  }else{
    assert( pFifo->nEntry>0 );
  }
  return SQLITE_OK;
}

/*
** Delete all information from a Fifo object.   Free all memory held
** by the Fifo.
*/
void sqlite3VdbeFifoClear(Fifo *pFifo){
  FifoPage *pPage, *pNextPage;
  for(pPage=pFifo->pFirst; pPage; pPage=pNextPage){
    pNextPage = pPage->pNext;
    sqlite3DbFree(pFifo->db, pPage);
  }
  sqlite3VdbeFifoInit(pFifo, pFifo->db);
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































Deleted SQLite.Interop/splitsource/vdbemem.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
/*
** 2004 May 26
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** This file contains code use to manipulate "Mem" structure.  A "Mem"
** stores a single value in the VDBE.  Mem is an opaque structure visible
** only within the VDBE.  Interface routines refer to a Mem using the
** name sqlite_value
**
** $Id: vdbemem.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "sqliteInt.h"
#include <ctype.h>
#include "vdbeInt.h"

/*
** Call sqlite3VdbeMemExpandBlob() on the supplied value (type Mem*)
** P if required.
*/
#define expandBlob(P) (((P)->flags&MEM_Zero)?sqlite3VdbeMemExpandBlob(P):0)

/*
** If pMem is an object with a valid string representation, this routine
** ensures the internal encoding for the string representation is
** 'desiredEnc', one of SQLITE_UTF8, SQLITE_UTF16LE or SQLITE_UTF16BE.
**
** If pMem is not a string object, or the encoding of the string
** representation is already stored using the requested encoding, then this
** routine is a no-op.
**
** SQLITE_OK is returned if the conversion is successful (or not required).
** SQLITE_NOMEM may be returned if a malloc() fails during conversion
** between formats.
*/
int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){
  int rc;
  if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){
    return SQLITE_OK;
  }
  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
#ifdef SQLITE_OMIT_UTF16
  return SQLITE_ERROR;
#else

  /* MemTranslate() may return SQLITE_OK or SQLITE_NOMEM. If NOMEM is returned,
  ** then the encoding of the value may not have changed.
  */
  rc = sqlite3VdbeMemTranslate(pMem, desiredEnc);
  assert(rc==SQLITE_OK    || rc==SQLITE_NOMEM);
  assert(rc==SQLITE_OK    || pMem->enc!=desiredEnc);
  assert(rc==SQLITE_NOMEM || pMem->enc==desiredEnc);
  return rc;
#endif
}

/*
** Make sure pMem->z points to a writable allocation of at least 
** n bytes.
**
** If the memory cell currently contains string or blob data
** and the third argument passed to this function is true, the 
** current content of the cell is preserved. Otherwise, it may
** be discarded.  
**
** This function sets the MEM_Dyn flag and clears any xDel callback.
** It also clears MEM_Ephem and MEM_Static. If the preserve flag is 
** not set, Mem.n is zeroed.
*/
int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve){
  assert( 1 >=
    ((pMem->zMalloc && pMem->zMalloc==pMem->z) ? 1 : 0) +
    (((pMem->flags&MEM_Dyn)&&pMem->xDel) ? 1 : 0) + 
    ((pMem->flags&MEM_Ephem) ? 1 : 0) + 
    ((pMem->flags&MEM_Static) ? 1 : 0)
  );

  if( n<32 ) n = 32;
  if( sqlite3DbMallocSize(pMem->db, pMem->zMalloc)<n ){
    if( preserve && pMem->z==pMem->zMalloc ){
      pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n);
      if( !pMem->z ){
        pMem->flags = MEM_Null;
      }
      preserve = 0;
    }else{
      sqlite3DbFree(pMem->db, pMem->zMalloc);
      pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, n);
    }
  }

  if( preserve && pMem->z && pMem->zMalloc && pMem->z!=pMem->zMalloc ){
    memcpy(pMem->zMalloc, pMem->z, pMem->n);
  }
  if( pMem->flags&MEM_Dyn && pMem->xDel ){
    pMem->xDel((void *)(pMem->z));
  }

  pMem->z = pMem->zMalloc;
  pMem->flags &= ~(MEM_Ephem|MEM_Static);
  pMem->xDel = 0;
  return (pMem->z ? SQLITE_OK : SQLITE_NOMEM);
}

/*
** Make the given Mem object MEM_Dyn.  In other words, make it so
** that any TEXT or BLOB content is stored in memory obtained from
** malloc().  In this way, we know that the memory is safe to be
** overwritten or altered.
**
** Return SQLITE_OK on success or SQLITE_NOMEM if malloc fails.
*/
int sqlite3VdbeMemMakeWriteable(Mem *pMem){
  int f;
  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
  expandBlob(pMem);
  f = pMem->flags;
  if( (f&(MEM_Str|MEM_Blob)) && pMem->z!=pMem->zMalloc ){
    if( sqlite3VdbeMemGrow(pMem, pMem->n + 2, 1) ){
      return SQLITE_NOMEM;
    }
    pMem->z[pMem->n] = 0;
    pMem->z[pMem->n+1] = 0;
    pMem->flags |= MEM_Term;
  }

  return SQLITE_OK;
}

/*
** If the given Mem* has a zero-filled tail, turn it into an ordinary
** blob stored in dynamically allocated space.
*/
#ifndef SQLITE_OMIT_INCRBLOB
int sqlite3VdbeMemExpandBlob(Mem *pMem){
  if( pMem->flags & MEM_Zero ){
    int nByte;
    assert( pMem->flags&MEM_Blob );
    assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );

    /* Set nByte to the number of bytes required to store the expanded blob. */
    nByte = pMem->n + pMem->u.i;
    if( nByte<=0 ){
      nByte = 1;
    }
    if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){
      return SQLITE_NOMEM;
    }

    memset(&pMem->z[pMem->n], 0, pMem->u.i);
    pMem->n += pMem->u.i;
    pMem->flags &= ~(MEM_Zero|MEM_Term);
  }
  return SQLITE_OK;
}
#endif


/*
** Make sure the given Mem is \u0000 terminated.
*/
int sqlite3VdbeMemNulTerminate(Mem *pMem){
  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
  if( (pMem->flags & MEM_Term)!=0 || (pMem->flags & MEM_Str)==0 ){
    return SQLITE_OK;   /* Nothing to do */
  }
  if( sqlite3VdbeMemGrow(pMem, pMem->n+2, 1) ){
    return SQLITE_NOMEM;
  }
  pMem->z[pMem->n] = 0;
  pMem->z[pMem->n+1] = 0;
  pMem->flags |= MEM_Term;
  return SQLITE_OK;
}

/*
** Add MEM_Str to the set of representations for the given Mem.  Numbers
** are converted using sqlite3_snprintf().  Converting a BLOB to a string
** is a no-op.
**
** Existing representations MEM_Int and MEM_Real are *not* invalidated.
**
** A MEM_Null value will never be passed to this function. This function is
** used for converting values to text for returning to the user (i.e. via
** sqlite3_value_text()), or for ensuring that values to be used as btree
** keys are strings. In the former case a NULL pointer is returned the
** user and the later is an internal programming error.
*/
int sqlite3VdbeMemStringify(Mem *pMem, int enc){
  int rc = SQLITE_OK;
  int fg = pMem->flags;
  const int nByte = 32;

  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
  assert( !(fg&MEM_Zero) );
  assert( !(fg&(MEM_Str|MEM_Blob)) );
  assert( fg&(MEM_Int|MEM_Real) );

  if( sqlite3VdbeMemGrow(pMem, nByte, 0) ){
    return SQLITE_NOMEM;
  }

  /* For a Real or Integer, use sqlite3_mprintf() to produce the UTF-8
  ** string representation of the value. Then, if the required encoding
  ** is UTF-16le or UTF-16be do a translation.
  ** 
  ** FIX ME: It would be better if sqlite3_snprintf() could do UTF-16.
  */
  if( fg & MEM_Int ){
    sqlite3_snprintf(nByte, pMem->z, "%lld", pMem->u.i);
  }else{
    assert( fg & MEM_Real );
    sqlite3_snprintf(nByte, pMem->z, "%!.15g", pMem->r);
  }
  pMem->n = strlen(pMem->z);
  pMem->enc = SQLITE_UTF8;
  pMem->flags |= MEM_Str|MEM_Term;
  sqlite3VdbeChangeEncoding(pMem, enc);
  return rc;
}

/*
** Memory cell pMem contains the context of an aggregate function.
** This routine calls the finalize method for that function.  The
** result of the aggregate is stored back into pMem.
**
** Return SQLITE_ERROR if the finalizer reports an error.  SQLITE_OK
** otherwise.
*/
int sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){
  int rc = SQLITE_OK;
  if( pFunc && pFunc->xFinalize ){
    sqlite3_context ctx;
    assert( (pMem->flags & MEM_Null)!=0 || pFunc==pMem->u.pDef );
    assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
    ctx.s.flags = MEM_Null;
    ctx.s.db = pMem->db;
    ctx.s.zMalloc = 0;
    ctx.pMem = pMem;
    ctx.pFunc = pFunc;
    ctx.isError = 0;
    pFunc->xFinalize(&ctx);
    assert( 0==(pMem->flags&MEM_Dyn) && !pMem->xDel );
    sqlite3DbFree(pMem->db, pMem->zMalloc);
    *pMem = ctx.s;
    rc = (ctx.isError?SQLITE_ERROR:SQLITE_OK);
  }
  return rc;
}

/*
** If the memory cell contains a string value that must be freed by
** invoking an external callback, free it now. Calling this function
** does not free any Mem.zMalloc buffer.
*/
void sqlite3VdbeMemReleaseExternal(Mem *p){
  assert( p->db==0 || sqlite3_mutex_held(p->db->mutex) );
  if( p->flags&MEM_Agg ){
    sqlite3VdbeMemFinalize(p, p->u.pDef);
    assert( (p->flags & MEM_Agg)==0 );
    sqlite3VdbeMemRelease(p);
  }else if( p->flags&MEM_Dyn && p->xDel ){
    p->xDel((void *)p->z);
    p->xDel = 0;
  }
}

/*
** Release any memory held by the Mem. This may leave the Mem in an
** inconsistent state, for example with (Mem.z==0) and
** (Mem.type==SQLITE_TEXT).
*/
void sqlite3VdbeMemRelease(Mem *p){
  sqlite3VdbeMemReleaseExternal(p);
  sqlite3DbFree(p->db, p->zMalloc);
  p->z = 0;
  p->zMalloc = 0;
  p->xDel = 0;
}

/*
** Convert a 64-bit IEEE double into a 64-bit signed integer.
** If the double is too large, return 0x8000000000000000.
**
** Most systems appear to do this simply by assigning
** variables and without the extra range tests.  But
** there are reports that windows throws an expection
** if the floating point value is out of range. (See ticket #2880.)
** Because we do not completely understand the problem, we will
** take the conservative approach and always do range tests
** before attempting the conversion.
*/
static i64 doubleToInt64(double r){
  /*
  ** Many compilers we encounter do not define constants for the
  ** minimum and maximum 64-bit integers, or they define them
  ** inconsistently.  And many do not understand the "LL" notation.
  ** So we define our own static constants here using nothing
  ** larger than a 32-bit integer constant.
  */
  static const i64 maxInt = LARGEST_INT64;
  static const i64 minInt = SMALLEST_INT64;

  if( r<(double)minInt ){
    return minInt;
  }else if( r>(double)maxInt ){
    return minInt;
  }else{
    return (i64)r;
  }
}

/*
** Return some kind of integer value which is the best we can do
** at representing the value that *pMem describes as an integer.
** If pMem is an integer, then the value is exact.  If pMem is
** a floating-point then the value returned is the integer part.
** If pMem is a string or blob, then we make an attempt to convert
** it into a integer and return that.  If pMem is NULL, return 0.
**
** If pMem is a string, its encoding might be changed.
*/
i64 sqlite3VdbeIntValue(Mem *pMem){
  int flags;
  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
  flags = pMem->flags;
  if( flags & MEM_Int ){
    return pMem->u.i;
  }else if( flags & MEM_Real ){
    return doubleToInt64(pMem->r);
  }else if( flags & (MEM_Str|MEM_Blob) ){
    i64 value;
    pMem->flags |= MEM_Str;
    if( sqlite3VdbeChangeEncoding(pMem, SQLITE_UTF8)
       || sqlite3VdbeMemNulTerminate(pMem) ){
      return 0;
    }
    assert( pMem->z );
    sqlite3Atoi64(pMem->z, &value);
    return value;
  }else{
    return 0;
  }
}

/*
** Return the best representation of pMem that we can get into a
** double.  If pMem is already a double or an integer, return its
** value.  If it is a string or blob, try to convert it to a double.
** If it is a NULL, return 0.0.
*/
double sqlite3VdbeRealValue(Mem *pMem){
  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
  if( pMem->flags & MEM_Real ){
    return pMem->r;
  }else if( pMem->flags & MEM_Int ){
    return (double)pMem->u.i;
  }else if( pMem->flags & (MEM_Str|MEM_Blob) ){
    double val = 0.0;
    pMem->flags |= MEM_Str;
    if( sqlite3VdbeChangeEncoding(pMem, SQLITE_UTF8)
       || sqlite3VdbeMemNulTerminate(pMem) ){
      return 0.0;
    }
    assert( pMem->z );
    sqlite3AtoF(pMem->z, &val);
    return val;
  }else{
    return 0.0;
  }
}

/*
** The MEM structure is already a MEM_Real.  Try to also make it a
** MEM_Int if we can.
*/
void sqlite3VdbeIntegerAffinity(Mem *pMem){
  assert( pMem->flags & MEM_Real );
  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );

  pMem->u.i = doubleToInt64(pMem->r);
  if( pMem->r==(double)pMem->u.i ){
    pMem->flags |= MEM_Int;
  }
}

static void setTypeFlag(Mem *pMem, int f){
  MemSetTypeFlag(pMem, f);
}

/*
** Convert pMem to type integer.  Invalidate any prior representations.
*/
int sqlite3VdbeMemIntegerify(Mem *pMem){
  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
  pMem->u.i = sqlite3VdbeIntValue(pMem);
  setTypeFlag(pMem, MEM_Int);
  return SQLITE_OK;
}

/*
** Convert pMem so that it is of type MEM_Real.
** Invalidate any prior representations.
*/
int sqlite3VdbeMemRealify(Mem *pMem){
  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
  pMem->r = sqlite3VdbeRealValue(pMem);
  setTypeFlag(pMem, MEM_Real);
  return SQLITE_OK;
}

/*
** Convert pMem so that it has types MEM_Real or MEM_Int or both.
** Invalidate any prior representations.
*/
int sqlite3VdbeMemNumerify(Mem *pMem){
  double r1, r2;
  i64 i;
  assert( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))==0 );
  assert( (pMem->flags & (MEM_Blob|MEM_Str))!=0 );
  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
  r1 = sqlite3VdbeRealValue(pMem);
  i = doubleToInt64(r1);
  r2 = (double)i;
  if( r1==r2 ){
    sqlite3VdbeMemIntegerify(pMem);
  }else{
    pMem->r = r1;
    setTypeFlag(pMem, MEM_Real);
  }
  return SQLITE_OK;
}

/*
** Delete any previous value and set the value stored in *pMem to NULL.
*/
void sqlite3VdbeMemSetNull(Mem *pMem){
  setTypeFlag(pMem, MEM_Null);
  pMem->type = SQLITE_NULL;
}

/*
** Delete any previous value and set the value to be a BLOB of length
** n containing all zeros.
*/
void sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){
  sqlite3VdbeMemRelease(pMem);
  setTypeFlag(pMem, MEM_Blob);
  pMem->flags = MEM_Blob|MEM_Zero;
  pMem->type = SQLITE_BLOB;
  pMem->n = 0;
  if( n<0 ) n = 0;
  pMem->u.i = n;
  pMem->enc = SQLITE_UTF8;
}

/*
** Delete any previous value and set the value stored in *pMem to val,
** manifest type INTEGER.
*/
void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){
  sqlite3VdbeMemRelease(pMem);
  pMem->u.i = val;
  pMem->flags = MEM_Int;
  pMem->type = SQLITE_INTEGER;
}

/*
** Delete any previous value and set the value stored in *pMem to val,
** manifest type REAL.
*/
void sqlite3VdbeMemSetDouble(Mem *pMem, double val){
  if( sqlite3IsNaN(val) ){
    sqlite3VdbeMemSetNull(pMem);
  }else{
    sqlite3VdbeMemRelease(pMem);
    pMem->r = val;
    pMem->flags = MEM_Real;
    pMem->type = SQLITE_FLOAT;
  }
}

/*
** Return true if the Mem object contains a TEXT or BLOB that is
** too large - whose size exceeds SQLITE_MAX_LENGTH.
*/
int sqlite3VdbeMemTooBig(Mem *p){
  assert( p->db!=0 );
  if( p->flags & (MEM_Str|MEM_Blob) ){
    int n = p->n;
    if( p->flags & MEM_Zero ){
      n += p->u.i;
    }
    return n>p->db->aLimit[SQLITE_LIMIT_LENGTH];
  }
  return 0; 
}

/*
** Size of struct Mem not including the Mem.zMalloc member.
*/
#define MEMCELLSIZE (size_t)(&(((Mem *)0)->zMalloc))

/*
** Make an shallow copy of pFrom into pTo.  Prior contents of
** pTo are freed.  The pFrom->z field is not duplicated.  If
** pFrom->z is used, then pTo->z points to the same thing as pFrom->z
** and flags gets srcType (either MEM_Ephem or MEM_Static).
*/
void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){
  sqlite3VdbeMemReleaseExternal(pTo);
  memcpy(pTo, pFrom, MEMCELLSIZE);
  pTo->xDel = 0;
  if( (pFrom->flags&MEM_Dyn)!=0 || pFrom->z==pFrom->zMalloc ){
    pTo->flags &= ~(MEM_Dyn|MEM_Static|MEM_Ephem);
    assert( srcType==MEM_Ephem || srcType==MEM_Static );
    pTo->flags |= srcType;
  }
}

/*
** Make a full copy of pFrom into pTo.  Prior contents of pTo are
** freed before the copy is made.
*/
int sqlite3VdbeMemCopy(Mem *pTo, const Mem *pFrom){
  int rc = SQLITE_OK;

  sqlite3VdbeMemReleaseExternal(pTo);
  memcpy(pTo, pFrom, MEMCELLSIZE);
  pTo->flags &= ~MEM_Dyn;

  if( pTo->flags&(MEM_Str|MEM_Blob) ){
    if( 0==(pFrom->flags&MEM_Static) ){
      pTo->flags |= MEM_Ephem;
      rc = sqlite3VdbeMemMakeWriteable(pTo);
    }
  }

  return rc;
}

/*
** Transfer the contents of pFrom to pTo. Any existing value in pTo is
** freed. If pFrom contains ephemeral data, a copy is made.
**
** pFrom contains an SQL NULL when this routine returns.
*/
void sqlite3VdbeMemMove(Mem *pTo, Mem *pFrom){
  assert( pFrom->db==0 || sqlite3_mutex_held(pFrom->db->mutex) );
  assert( pTo->db==0 || sqlite3_mutex_held(pTo->db->mutex) );
  assert( pFrom->db==0 || pTo->db==0 || pFrom->db==pTo->db );

  sqlite3VdbeMemRelease(pTo);
  memcpy(pTo, pFrom, sizeof(Mem));
  pFrom->flags = MEM_Null;
  pFrom->xDel = 0;
  pFrom->zMalloc = 0;
}

/*
** Change the value of a Mem to be a string or a BLOB.
**
** The memory management strategy depends on the value of the xDel
** parameter. If the value passed is SQLITE_TRANSIENT, then the 
** string is copied into a (possibly existing) buffer managed by the 
** Mem structure. Otherwise, any existing buffer is freed and the
** pointer copied.
*/
int sqlite3VdbeMemSetStr(
  Mem *pMem,          /* Memory cell to set to string value */
  const char *z,      /* String pointer */
  int n,              /* Bytes in string, or negative */
  u8 enc,             /* Encoding of z.  0 for BLOBs */
  void (*xDel)(void*) /* Destructor function */
){
  int nByte = n;      /* New value for pMem->n */
  int iLimit;         /* Maximum allowed string or blob size */
  int flags = 0;      /* New value for pMem->flags */

  assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );

  /* If z is a NULL pointer, set pMem to contain an SQL NULL. */
  if( !z ){
    sqlite3VdbeMemSetNull(pMem);
    return SQLITE_OK;
  }

  if( pMem->db ){
    iLimit = pMem->db->aLimit[SQLITE_LIMIT_LENGTH];
  }else{
    iLimit = SQLITE_MAX_LENGTH;
  }
  flags = (enc==0?MEM_Blob:MEM_Str);
  if( nByte<0 ){
    assert( enc!=0 );
    if( enc==SQLITE_UTF8 ){
      for(nByte=0; nByte<=iLimit && z[nByte]; nByte++){}
    }else{
      for(nByte=0; nByte<=iLimit && (z[nByte] | z[nByte+1]); nByte+=2){}
    }
    flags |= MEM_Term;
  }
  if( nByte>iLimit ){
    return SQLITE_TOOBIG;
  }

  /* The following block sets the new values of Mem.z and Mem.xDel. It
  ** also sets a flag in local variable "flags" to indicate the memory
  ** management (one of MEM_Dyn or MEM_Static).
  */
  if( xDel==SQLITE_TRANSIENT ){
    int nAlloc = nByte;
    if( flags&MEM_Term ){
      nAlloc += (enc==SQLITE_UTF8?1:2);
    }
    if( sqlite3VdbeMemGrow(pMem, nAlloc, 0) ){
      return SQLITE_NOMEM;
    }
    memcpy(pMem->z, z, nAlloc);
  }else if( xDel==SQLITE_DYNAMIC ){
    sqlite3VdbeMemRelease(pMem);
    pMem->zMalloc = pMem->z = (char *)z;
    pMem->xDel = 0;
  }else{
    sqlite3VdbeMemRelease(pMem);
    pMem->z = (char *)z;
    pMem->xDel = xDel;
    flags |= ((xDel==SQLITE_STATIC)?MEM_Static:MEM_Dyn);
  }

  pMem->n = nByte;
  pMem->flags = flags;
  pMem->enc = (enc==0 ? SQLITE_UTF8 : enc);
  pMem->type = (enc==0 ? SQLITE_BLOB : SQLITE_TEXT);

#ifndef SQLITE_OMIT_UTF16
  if( pMem->enc!=SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){
    return SQLITE_NOMEM;
  }
#endif

  return SQLITE_OK;
}

/*
** Compare the values contained by the two memory cells, returning
** negative, zero or positive if pMem1 is less than, equal to, or greater
** than pMem2. Sorting order is NULL's first, followed by numbers (integers
** and reals) sorted numerically, followed by text ordered by the collating
** sequence pColl and finally blob's ordered by memcmp().
**
** Two NULL values are considered equal by this function.
*/
int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const CollSeq *pColl){
  int rc;
  int f1, f2;
  int combined_flags;

  /* Interchange pMem1 and pMem2 if the collating sequence specifies
  ** DESC order.
  */
  f1 = pMem1->flags;
  f2 = pMem2->flags;
  combined_flags = f1|f2;
 
  /* If one value is NULL, it is less than the other. If both values
  ** are NULL, return 0.
  */
  if( combined_flags&MEM_Null ){
    return (f2&MEM_Null) - (f1&MEM_Null);
  }

  /* If one value is a number and the other is not, the number is less.
  ** If both are numbers, compare as reals if one is a real, or as integers
  ** if both values are integers.
  */
  if( combined_flags&(MEM_Int|MEM_Real) ){
    if( !(f1&(MEM_Int|MEM_Real)) ){
      return 1;
    }
    if( !(f2&(MEM_Int|MEM_Real)) ){
      return -1;
    }
    if( (f1 & f2 & MEM_Int)==0 ){
      double r1, r2;
      if( (f1&MEM_Real)==0 ){
        r1 = pMem1->u.i;
      }else{
        r1 = pMem1->r;
      }
      if( (f2&MEM_Real)==0 ){
        r2 = pMem2->u.i;
      }else{
        r2 = pMem2->r;
      }
      if( r1<r2 ) return -1;
      if( r1>r2 ) return 1;
      return 0;
    }else{
      assert( f1&MEM_Int );
      assert( f2&MEM_Int );
      if( pMem1->u.i < pMem2->u.i ) return -1;
      if( pMem1->u.i > pMem2->u.i ) return 1;
      return 0;
    }
  }

  /* If one value is a string and the other is a blob, the string is less.
  ** If both are strings, compare using the collating functions.
  */
  if( combined_flags&MEM_Str ){
    if( (f1 & MEM_Str)==0 ){
      return 1;
    }
    if( (f2 & MEM_Str)==0 ){
      return -1;
    }

    assert( pMem1->enc==pMem2->enc );
    assert( pMem1->enc==SQLITE_UTF8 || 
            pMem1->enc==SQLITE_UTF16LE || pMem1->enc==SQLITE_UTF16BE );

    /* The collation sequence must be defined at this point, even if
    ** the user deletes the collation sequence after the vdbe program is
    ** compiled (this was not always the case).
    */
    assert( !pColl || pColl->xCmp );

    if( pColl ){
      if( pMem1->enc==pColl->enc ){
        /* The strings are already in the correct encoding.  Call the
        ** comparison function directly */
        return pColl->xCmp(pColl->pUser,pMem1->n,pMem1->z,pMem2->n,pMem2->z);
      }else{
        u8 origEnc = pMem1->enc;
        const void *v1, *v2;
        int n1, n2;
        /* Convert the strings into the encoding that the comparison
        ** function expects */
        v1 = sqlite3ValueText((sqlite3_value*)pMem1, pColl->enc);
        n1 = v1==0 ? 0 : pMem1->n;
        assert( n1==sqlite3ValueBytes((sqlite3_value*)pMem1, pColl->enc) );
        v2 = sqlite3ValueText((sqlite3_value*)pMem2, pColl->enc);
        n2 = v2==0 ? 0 : pMem2->n;
        assert( n2==sqlite3ValueBytes((sqlite3_value*)pMem2, pColl->enc) );
        /* Do the comparison */
        rc = pColl->xCmp(pColl->pUser, n1, v1, n2, v2);
        /* Convert the strings back into the database encoding */
        sqlite3ValueText((sqlite3_value*)pMem1, origEnc);
        sqlite3ValueText((sqlite3_value*)pMem2, origEnc);
        return rc;
      }
    }
    /* If a NULL pointer was passed as the collate function, fall through
    ** to the blob case and use memcmp().  */
  }
 
  /* Both values must be blobs.  Compare using memcmp().  */
  rc = memcmp(pMem1->z, pMem2->z, (pMem1->n>pMem2->n)?pMem2->n:pMem1->n);
  if( rc==0 ){
    rc = pMem1->n - pMem2->n;
  }
  return rc;
}

/*
** Move data out of a btree key or data field and into a Mem structure.
** The data or key is taken from the entry that pCur is currently pointing
** to.  offset and amt determine what portion of the data or key to retrieve.
** key is true to get the key or false to get data.  The result is written
** into the pMem element.
**
** The pMem structure is assumed to be uninitialized.  Any prior content
** is overwritten without being freed.
**
** If this routine fails for any reason (malloc returns NULL or unable
** to read from the disk) then the pMem is left in an inconsistent state.
*/
int sqlite3VdbeMemFromBtree(
  BtCursor *pCur,   /* Cursor pointing at record to retrieve. */
  int offset,       /* Offset from the start of data to return bytes from. */
  int amt,          /* Number of bytes to return. */
  int key,          /* If true, retrieve from the btree key, not data. */
  Mem *pMem         /* OUT: Return data in this Mem structure. */
){
  char *zData;       /* Data from the btree layer */
  int available = 0; /* Number of bytes available on the local btree page */
  sqlite3 *db;       /* Database connection */
  int rc = SQLITE_OK;

  db = sqlite3BtreeCursorDb(pCur);
  assert( sqlite3_mutex_held(db->mutex) );
  if( key ){
    zData = (char *)sqlite3BtreeKeyFetch(pCur, &available);
  }else{
    zData = (char *)sqlite3BtreeDataFetch(pCur, &available);
  }
  assert( zData!=0 );

  if( offset+amt<=available && ((pMem->flags&MEM_Dyn)==0 || pMem->xDel) ){
    sqlite3VdbeMemRelease(pMem);
    pMem->z = &zData[offset];
    pMem->flags = MEM_Blob|MEM_Ephem;
  }else if( SQLITE_OK==(rc = sqlite3VdbeMemGrow(pMem, amt+2, 0)) ){
    pMem->flags = MEM_Blob|MEM_Dyn|MEM_Term;
    pMem->enc = 0;
    pMem->type = SQLITE_BLOB;
    if( key ){
      rc = sqlite3BtreeKey(pCur, offset, amt, pMem->z);
    }else{
      rc = sqlite3BtreeData(pCur, offset, amt, pMem->z);
    }
    pMem->z[amt] = 0;
    pMem->z[amt+1] = 0;
    if( rc!=SQLITE_OK ){
      sqlite3VdbeMemRelease(pMem);
    }
  }
  pMem->n = amt;

  return rc;
}

#if 0
/*
** Perform various checks on the memory cell pMem. An assert() will
** fail if pMem is internally inconsistent.
*/
void sqlite3VdbeMemSanity(Mem *pMem){
  int flags = pMem->flags;
  assert( flags!=0 );  /* Must define some type */
  if( flags & (MEM_Str|MEM_Blob) ){
    int x = flags & (MEM_Static|MEM_Dyn|MEM_Ephem|MEM_Short);
    assert( x!=0 );            /* Strings must define a string subtype */
    assert( (x & (x-1))==0 );  /* Only one string subtype can be defined */
    assert( pMem->z!=0 );      /* Strings must have a value */
    /* Mem.z points to Mem.zShort iff the subtype is MEM_Short */
    assert( (x & MEM_Short)==0 || pMem->z==pMem->zShort );
    assert( (x & MEM_Short)!=0 || pMem->z!=pMem->zShort );
    /* No destructor unless there is MEM_Dyn */
    assert( pMem->xDel==0 || (pMem->flags & MEM_Dyn)!=0 );

    if( (flags & MEM_Str) ){
      assert( pMem->enc==SQLITE_UTF8 || 
              pMem->enc==SQLITE_UTF16BE ||
              pMem->enc==SQLITE_UTF16LE 
      );
      /* If the string is UTF-8 encoded and nul terminated, then pMem->n
      ** must be the length of the string.  (Later:)  If the database file
      ** has been corrupted, '\000' characters might have been inserted
      ** into the middle of the string.  In that case, the strlen() might
      ** be less.
      */
      if( pMem->enc==SQLITE_UTF8 && (flags & MEM_Term) ){ 
        assert( strlen(pMem->z)<=pMem->n );
        assert( pMem->z[pMem->n]==0 );
      }
    }
  }else{
    /* Cannot define a string subtype for non-string objects */
    assert( (pMem->flags & (MEM_Static|MEM_Dyn|MEM_Ephem|MEM_Short))==0 );
    assert( pMem->xDel==0 );
  }
  /* MEM_Null excludes all other types */
  assert( (pMem->flags&(MEM_Str|MEM_Int|MEM_Real|MEM_Blob))==0
          || (pMem->flags&MEM_Null)==0 );
  /* If the MEM is both real and integer, the values are equal */
  assert( (pMem->flags & (MEM_Int|MEM_Real))!=(MEM_Int|MEM_Real) 
          || pMem->r==pMem->u.i );
}
#endif

/* This function is only available internally, it is not part of the
** external API. It works in a similar way to sqlite3_value_text(),
** except the data returned is in the encoding specified by the second
** parameter, which must be one of SQLITE_UTF16BE, SQLITE_UTF16LE or
** SQLITE_UTF8.
**
** (2006-02-16:)  The enc value can be or-ed with SQLITE_UTF16_ALIGNED.
** If that is the case, then the result must be aligned on an even byte
** boundary.
*/
const void *sqlite3ValueText(sqlite3_value* pVal, u8 enc){
  if( !pVal ) return 0;

  assert( pVal->db==0 || sqlite3_mutex_held(pVal->db->mutex) );
  assert( (enc&3)==(enc&~SQLITE_UTF16_ALIGNED) );

  if( pVal->flags&MEM_Null ){
    return 0;
  }
  assert( (MEM_Blob>>3) == MEM_Str );
  pVal->flags |= (pVal->flags & MEM_Blob)>>3;
  expandBlob(pVal);
  if( pVal->flags&MEM_Str ){
    sqlite3VdbeChangeEncoding(pVal, enc & ~SQLITE_UTF16_ALIGNED);
    if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&SQLITE_PTR_TO_INT(pVal->z)) ){
      assert( (pVal->flags & (MEM_Ephem|MEM_Static))!=0 );
      if( sqlite3VdbeMemMakeWriteable(pVal)!=SQLITE_OK ){
        return 0;
      }
    }
    sqlite3VdbeMemNulTerminate(pVal);
  }else{
    assert( (pVal->flags&MEM_Blob)==0 );
    sqlite3VdbeMemStringify(pVal, enc);
    assert( 0==(1&(int)pVal->z) );
  }
  assert(pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) || pVal->db==0
              || pVal->db->mallocFailed );
  if( pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) ){
    return pVal->z;
  }else{
    return 0;
  }
}

/*
** Create a new sqlite3_value object.
*/
sqlite3_value *sqlite3ValueNew(sqlite3 *db){
  Mem *p = sqlite3DbMallocZero(db, sizeof(*p));
  if( p ){
    p->flags = MEM_Null;
    p->type = SQLITE_NULL;
    p->db = db;
  }
  return p;
}

/*
** Create a new sqlite3_value object, containing the value of pExpr.
**
** This only works for very simple expressions that consist of one constant
** token (i.e. "5", "5.1", "'a string'"). If the expression can
** be converted directly into a value, then the value is allocated and
** a pointer written to *ppVal. The caller is responsible for deallocating
** the value by passing it to sqlite3ValueFree() later on. If the expression
** cannot be converted to a value, then *ppVal is set to NULL.
*/
int sqlite3ValueFromExpr(
  sqlite3 *db,              /* The database connection */
  Expr *pExpr,              /* The expression to evaluate */
  u8 enc,                   /* Encoding to use */
  u8 affinity,              /* Affinity to use */
  sqlite3_value **ppVal     /* Write the new value here */
){
  int op;
  char *zVal = 0;
  sqlite3_value *pVal = 0;

  if( !pExpr ){
    *ppVal = 0;
    return SQLITE_OK;
  }
  op = pExpr->op;

  if( op==TK_STRING || op==TK_FLOAT || op==TK_INTEGER ){
    zVal = sqlite3DbStrNDup(db, (char*)pExpr->token.z, pExpr->token.n);
    pVal = sqlite3ValueNew(db);
    if( !zVal || !pVal ) goto no_mem;
    sqlite3Dequote(zVal);
    sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC);
    if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_NONE ){
      sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, enc);
    }else{
      sqlite3ValueApplyAffinity(pVal, affinity, enc);
    }
  }else if( op==TK_UMINUS ) {
    if( SQLITE_OK==sqlite3ValueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal) ){
      pVal->u.i = -1 * pVal->u.i;
      pVal->r = -1.0 * pVal->r;
    }
  }
#ifndef SQLITE_OMIT_BLOB_LITERAL
  else if( op==TK_BLOB ){
    int nVal;
    assert( pExpr->token.n>=3 );
    assert( pExpr->token.z[0]=='x' || pExpr->token.z[0]=='X' );
    assert( pExpr->token.z[1]=='\'' );
    assert( pExpr->token.z[pExpr->token.n-1]=='\'' );
    pVal = sqlite3ValueNew(db);
    nVal = pExpr->token.n - 3;
    zVal = (char*)pExpr->token.z + 2;
    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);
  *ppVal = 0;
  return SQLITE_NOMEM;
}

/*
** Change the string value of an sqlite3_value object
*/
void sqlite3ValueSetStr(
  sqlite3_value *v,     /* Value to be set */
  int n,                /* Length of string z */
  const void *z,        /* Text of the new string */
  u8 enc,               /* Encoding to use */
  void (*xDel)(void*)   /* Destructor for the string */
){
  if( v ) sqlite3VdbeMemSetStr((Mem *)v, z, n, enc, xDel);
}

/*
** Free an sqlite3_value object
*/
void sqlite3ValueFree(sqlite3_value *v){
  if( !v ) return;
  sqlite3VdbeMemRelease((Mem *)v);
  sqlite3DbFree(((Mem*)v)->db, v);
}

/*
** Return the number of bytes in the sqlite3_value object assuming
** that it uses the encoding "enc"
*/
int sqlite3ValueBytes(sqlite3_value *pVal, u8 enc){
  Mem *p = (Mem*)pVal;
  if( (p->flags & MEM_Blob)!=0 || sqlite3ValueText(pVal, enc) ){
    if( p->flags & MEM_Zero ){
      return p->n+p->u.i;
    }else{
      return p->n;
    }
  }
  return 0;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/vtab.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
/*
** 2006 June 10
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code used to help implement virtual tables.
**
** $Id: vtab.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#ifndef SQLITE_OMIT_VIRTUALTABLE
#include "sqliteInt.h"

static int createModule(
  sqlite3 *db,                    /* Database in which module is registered */
  const char *zName,              /* Name assigned to this module */
  const sqlite3_module *pModule,  /* The definition of the module */
  void *pAux,                     /* Context pointer for xCreate/xConnect */
  void (*xDestroy)(void *)        /* Module destructor function */
) {
  int rc, nName;
  Module *pMod;

  sqlite3_mutex_enter(db->mutex);
  nName = strlen(zName);
  pMod = (Module *)sqlite3DbMallocRaw(db, sizeof(Module) + nName + 1);
  if( pMod ){
    Module *pDel;
    char *zCopy = (char *)(&pMod[1]);
    memcpy(zCopy, zName, nName+1);
    pMod->zName = zCopy;
    pMod->pModule = pModule;
    pMod->pAux = pAux;
    pMod->xDestroy = xDestroy;
    pDel = (Module *)sqlite3HashInsert(&db->aModule, zCopy, nName, (void*)pMod);
    if( pDel && pDel->xDestroy ){
      pDel->xDestroy(pDel->pAux);
    }
    sqlite3DbFree(db, pDel);
    if( pDel==pMod ){
      db->mallocFailed = 1;
    }
    sqlite3ResetInternalSchema(db, 0);
  }
  rc = sqlite3ApiExit(db, SQLITE_OK);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}


/*
** External API function used to create a new virtual-table module.
*/
int sqlite3_create_module(
  sqlite3 *db,                    /* Database in which module is registered */
  const char *zName,              /* Name assigned to this module */
  const sqlite3_module *pModule,  /* The definition of the module */
  void *pAux                      /* Context pointer for xCreate/xConnect */
){
  return createModule(db, zName, pModule, pAux, 0);
}

/*
** External API function used to create a new virtual-table module.
*/
int sqlite3_create_module_v2(
  sqlite3 *db,                    /* Database in which module is registered */
  const char *zName,              /* Name assigned to this module */
  const sqlite3_module *pModule,  /* The definition of the module */
  void *pAux,                     /* Context pointer for xCreate/xConnect */
  void (*xDestroy)(void *)        /* Module destructor function */
){
  return createModule(db, zName, pModule, pAux, xDestroy);
}

/*
** Lock the virtual table so that it cannot be disconnected.
** Locks nest.  Every lock should have a corresponding unlock.
** If an unlock is omitted, resources leaks will occur.  
**
** If a disconnect is attempted while a virtual table is locked,
** the disconnect is deferred until all locks have been removed.
*/
void sqlite3VtabLock(sqlite3_vtab *pVtab){
  pVtab->nRef++;
}

/*
** Unlock a virtual table.  When the last lock is removed,
** disconnect the virtual table.
*/
void sqlite3VtabUnlock(sqlite3 *db, sqlite3_vtab *pVtab){
  pVtab->nRef--;
  assert(db);
  assert( sqlite3SafetyCheckOk(db) );
  if( pVtab->nRef==0 ){
    if( db->magic==SQLITE_MAGIC_BUSY ){
      (void)sqlite3SafetyOff(db);
      pVtab->pModule->xDisconnect(pVtab);
      (void)sqlite3SafetyOn(db);
    } else {
      pVtab->pModule->xDisconnect(pVtab);
    }
  }
}

/*
** Clear any and all virtual-table information from the Table record.
** This routine is called, for example, just before deleting the Table
** record.
*/
void sqlite3VtabClear(Table *p){
  sqlite3_vtab *pVtab = p->pVtab;
  sqlite3 *db = p->db;
  if( pVtab ){
    assert( p->pMod && p->pMod->pModule );
    sqlite3VtabUnlock(db, pVtab);
    p->pVtab = 0;
  }
  if( p->azModuleArg ){
    int i;
    for(i=0; i<p->nModuleArg; i++){
      sqlite3DbFree(db, p->azModuleArg[i]);
    }
    sqlite3DbFree(db, p->azModuleArg);
  }
}

/*
** Add a new module argument to pTable->azModuleArg[].
** The string is not copied - the pointer is stored.  The
** string will be freed automatically when the table is
** deleted.
*/
static void addModuleArgument(sqlite3 *db, Table *pTable, char *zArg){
  int i = pTable->nModuleArg++;
  int nBytes = sizeof(char *)*(1+pTable->nModuleArg);
  char **azModuleArg;
  azModuleArg = sqlite3DbRealloc(db, pTable->azModuleArg, nBytes);
  if( azModuleArg==0 ){
    int j;
    for(j=0; j<i; j++){
      sqlite3DbFree(db, pTable->azModuleArg[j]);
    }
    sqlite3DbFree(db, zArg);
    sqlite3DbFree(db, pTable->azModuleArg);
    pTable->nModuleArg = 0;
  }else{
    azModuleArg[i] = zArg;
    azModuleArg[i+1] = 0;
  }
  pTable->azModuleArg = azModuleArg;
}

/*
** The parser calls this routine when it first sees a CREATE VIRTUAL TABLE
** statement.  The module name has been parsed, but the optional list
** of parameters that follow the module name are still pending.
*/
void sqlite3VtabBeginParse(
  Parse *pParse,        /* Parsing context */
  Token *pName1,        /* Name of new table, or database name */
  Token *pName2,        /* Name of new table or NULL */
  Token *pModuleName    /* Name of the module for the virtual table */
){
  int iDb;              /* The database the table is being created in */
  Table *pTable;        /* The new virtual table */
  sqlite3 *db;          /* Database connection */

  if( pParse->db->flags & SQLITE_SharedCache ){
    sqlite3ErrorMsg(pParse, "Cannot use virtual tables in shared-cache mode");
    return;
  }

  sqlite3StartTable(pParse, pName1, pName2, 0, 0, 1, 0);
  pTable = pParse->pNewTable;
  if( pTable==0 || pParse->nErr ) return;
  assert( 0==pTable->pIndex );

  db = pParse->db;
  iDb = sqlite3SchemaToIndex(db, pTable->pSchema);
  assert( iDb>=0 );

  pTable->isVirtual = 1;
  pTable->nModuleArg = 0;
  addModuleArgument(db, pTable, sqlite3NameFromToken(db, pModuleName));
  addModuleArgument(db, pTable, sqlite3DbStrDup(db, db->aDb[iDb].zName));
  addModuleArgument(db, pTable, sqlite3DbStrDup(db, pTable->zName));
  pParse->sNameToken.n = pModuleName->z + pModuleName->n - pName1->z;

#ifndef SQLITE_OMIT_AUTHORIZATION
  /* Creating a virtual table invokes the authorization callback twice.
  ** The first invocation, to obtain permission to INSERT a row into the
  ** sqlite_master table, has already been made by sqlite3StartTable().
  ** The second call, to obtain permission to create the table, is made now.
  */
  if( pTable->azModuleArg ){
    sqlite3AuthCheck(pParse, SQLITE_CREATE_VTABLE, pTable->zName, 
            pTable->azModuleArg[0], pParse->db->aDb[iDb].zName);
  }
#endif
}

/*
** This routine takes the module argument that has been accumulating
** in pParse->zArg[] and appends it to the list of arguments on the
** virtual table currently under construction in pParse->pTable.
*/
static void addArgumentToVtab(Parse *pParse){
  if( pParse->sArg.z && pParse->pNewTable ){
    const char *z = (const char*)pParse->sArg.z;
    int n = pParse->sArg.n;
    sqlite3 *db = pParse->db;
    addModuleArgument(db, pParse->pNewTable, sqlite3DbStrNDup(db, z, n));
  }
}

/*
** The parser calls this routine after the CREATE VIRTUAL TABLE statement
** has been completely parsed.
*/
void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){
  Table *pTab;        /* The table being constructed */
  sqlite3 *db;        /* The database connection */
  char *zModule;      /* The module name of the table: USING modulename */
  Module *pMod = 0;

  addArgumentToVtab(pParse);
  pParse->sArg.z = 0;

  /* Lookup the module name. */
  pTab = pParse->pNewTable;
  if( pTab==0 ) return;
  db = pParse->db;
  if( pTab->nModuleArg<1 ) return;
  zModule = pTab->azModuleArg[0];
  pMod = (Module *)sqlite3HashFind(&db->aModule, zModule, strlen(zModule));
  pTab->pMod = pMod;
  
  /* If the CREATE VIRTUAL TABLE statement is being entered for the
  ** first time (in other words if the virtual table is actually being
  ** created now instead of just being read out of sqlite_master) then
  ** do additional initialization work and store the statement text
  ** in the sqlite_master table.
  */
  if( !db->init.busy ){
    char *zStmt;
    char *zWhere;
    int iDb;
    Vdbe *v;

    /* Compute the complete text of the CREATE VIRTUAL TABLE statement */
    if( pEnd ){
      pParse->sNameToken.n = pEnd->z - pParse->sNameToken.z + pEnd->n;
    }
    zStmt = sqlite3MPrintf(db, "CREATE VIRTUAL TABLE %T", &pParse->sNameToken);

    /* A slot for the record has already been allocated in the 
    ** SQLITE_MASTER table.  We just need to update that slot with all
    ** the information we've collected.  
    **
    ** The VM register number pParse->regRowid holds the rowid of an
    ** entry in the sqlite_master table tht was created for this vtab
    ** by sqlite3StartTable().
    */
    iDb = sqlite3SchemaToIndex(db, pTab->pSchema);
    sqlite3NestedParse(pParse,
      "UPDATE %Q.%s "
         "SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q "
       "WHERE rowid=#%d",
      db->aDb[iDb].zName, SCHEMA_TABLE(iDb),
      pTab->zName,
      pTab->zName,
      zStmt,
      pParse->regRowid
    );
    sqlite3DbFree(db, zStmt);
    v = sqlite3GetVdbe(pParse);
    sqlite3ChangeCookie(pParse, iDb);

    sqlite3VdbeAddOp2(v, OP_Expire, 0, 0);
    zWhere = sqlite3MPrintf(db, "name='%q'", pTab->zName);
    sqlite3VdbeAddOp4(v, OP_ParseSchema, iDb, 1, 0, zWhere, P4_DYNAMIC);
    sqlite3VdbeAddOp4(v, OP_VCreate, iDb, 0, 0, 
                         pTab->zName, strlen(pTab->zName) + 1);
  }

  /* If we are rereading the sqlite_master table create the in-memory
  ** record of the table. If the module has already been registered,
  ** also call the xConnect method here.
  */
  else {
    Table *pOld;
    Schema *pSchema = pTab->pSchema;
    const char *zName = pTab->zName;
    int nName = strlen(zName) + 1;
    pOld = sqlite3HashInsert(&pSchema->tblHash, zName, nName, pTab);
    if( pOld ){
      db->mallocFailed = 1;
      assert( pTab==pOld );  /* Malloc must have failed inside HashInsert() */
      return;
    }
    pSchema->db = pParse->db;
    pParse->pNewTable = 0;
  }
}

/*
** The parser calls this routine when it sees the first token
** of an argument to the module name in a CREATE VIRTUAL TABLE statement.
*/
void sqlite3VtabArgInit(Parse *pParse){
  addArgumentToVtab(pParse);
  pParse->sArg.z = 0;
  pParse->sArg.n = 0;
}

/*
** The parser calls this routine for each token after the first token
** in an argument to the module name in a CREATE VIRTUAL TABLE statement.
*/
void sqlite3VtabArgExtend(Parse *pParse, Token *p){
  Token *pArg = &pParse->sArg;
  if( pArg->z==0 ){
    pArg->z = p->z;
    pArg->n = p->n;
  }else{
    assert(pArg->z < p->z);
    pArg->n = (p->z + p->n - pArg->z);
  }
}

/*
** Invoke a virtual table constructor (either xCreate or xConnect). The
** pointer to the function to invoke is passed as the fourth parameter
** to this procedure.
*/
static int vtabCallConstructor(
  sqlite3 *db, 
  Table *pTab,
  Module *pMod,
  int (*xConstruct)(sqlite3*,void*,int,const char*const*,sqlite3_vtab**,char**),
  char **pzErr
){
  int rc;
  int rc2;
  sqlite3_vtab *pVtab = 0;
  const char *const*azArg = (const char *const*)pTab->azModuleArg;
  int nArg = pTab->nModuleArg;
  char *zErr = 0;
  char *zModuleName = sqlite3MPrintf(db, "%s", pTab->zName);

  if( !zModuleName ){
    return SQLITE_NOMEM;
  }

  assert( !db->pVTab );
  assert( xConstruct );

  db->pVTab = pTab;
  rc = sqlite3SafetyOff(db);
  assert( rc==SQLITE_OK );
  rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVtab, &zErr);
  rc2 = sqlite3SafetyOn(db);
  if( rc==SQLITE_OK && pVtab ){
    pVtab->pModule = pMod->pModule;
    pVtab->nRef = 1;
    pTab->pVtab = pVtab;
  }

  if( SQLITE_OK!=rc ){
    if( zErr==0 ){
      *pzErr = sqlite3MPrintf(db, "vtable constructor failed: %s", zModuleName);
    }else {
      *pzErr = sqlite3MPrintf(db, "%s", zErr);
      sqlite3DbFree(db, zErr);
    }
  }else if( db->pVTab ){
    const char *zFormat = "vtable constructor did not declare schema: %s";
    *pzErr = sqlite3MPrintf(db, zFormat, pTab->zName);
    rc = SQLITE_ERROR;
  } 
  if( rc==SQLITE_OK ){
    rc = rc2;
  }
  db->pVTab = 0;
  sqlite3DbFree(db, zModuleName);

  /* If everything went according to plan, loop through the columns
  ** of the table to see if any of them contain the token "hidden".
  ** If so, set the Column.isHidden flag and remove the token from
  ** the type string.
  */
  if( rc==SQLITE_OK ){
    int iCol;
    for(iCol=0; iCol<pTab->nCol; iCol++){
      char *zType = pTab->aCol[iCol].zType;
      int nType;
      int i = 0;
      if( !zType ) continue;
      nType = strlen(zType);
      if( sqlite3StrNICmp("hidden", zType, 6) || (zType[6] && zType[6]!=' ') ){
        for(i=0; i<nType; i++){
          if( (0==sqlite3StrNICmp(" hidden", &zType[i], 7))
           && (zType[i+7]=='\0' || zType[i+7]==' ')
          ){
            i++;
            break;
          }
        }
      }
      if( i<nType ){
        int j;
        int nDel = 6 + (zType[i+6] ? 1 : 0);
        for(j=i; (j+nDel)<=nType; j++){
          zType[j] = zType[j+nDel];
        }
        if( zType[i]=='\0' && i>0 ){
          assert(zType[i-1]==' ');
          zType[i-1] = '\0';
        }
        pTab->aCol[iCol].isHidden = 1;
      }
    }
  }
  return rc;
}

/*
** This function is invoked by the parser to call the xConnect() method
** of the virtual table pTab. If an error occurs, an error code is returned 
** and an error left in pParse.
**
** This call is a no-op if table pTab is not a virtual table.
*/
int sqlite3VtabCallConnect(Parse *pParse, Table *pTab){
  Module *pMod;
  int rc = SQLITE_OK;

  if( !pTab || !pTab->isVirtual || pTab->pVtab ){
    return SQLITE_OK;
  }

  pMod = pTab->pMod;
  if( !pMod ){
    const char *zModule = pTab->azModuleArg[0];
    sqlite3ErrorMsg(pParse, "no such module: %s", zModule);
    rc = SQLITE_ERROR;
  } else {
    char *zErr = 0;
    sqlite3 *db = pParse->db;
    rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xConnect, &zErr);
    if( rc!=SQLITE_OK ){
      sqlite3ErrorMsg(pParse, "%s", zErr);
    }
    sqlite3DbFree(db, zErr);
  }

  return rc;
}

/*
** Add the virtual table pVtab to the array sqlite3.aVTrans[].
*/
static int addToVTrans(sqlite3 *db, sqlite3_vtab *pVtab){
  const int ARRAY_INCR = 5;

  /* Grow the sqlite3.aVTrans array if required */
  if( (db->nVTrans%ARRAY_INCR)==0 ){
    sqlite3_vtab **aVTrans;
    int nBytes = sizeof(sqlite3_vtab *) * (db->nVTrans + ARRAY_INCR);
    aVTrans = sqlite3DbRealloc(db, (void *)db->aVTrans, nBytes);
    if( !aVTrans ){
      return SQLITE_NOMEM;
    }
    memset(&aVTrans[db->nVTrans], 0, sizeof(sqlite3_vtab *)*ARRAY_INCR);
    db->aVTrans = aVTrans;
  }

  /* Add pVtab to the end of sqlite3.aVTrans */
  db->aVTrans[db->nVTrans++] = pVtab;
  sqlite3VtabLock(pVtab);
  return SQLITE_OK;
}

/*
** This function is invoked by the vdbe to call the xCreate method
** of the virtual table named zTab in database iDb. 
**
** If an error occurs, *pzErr is set to point an an English language
** description of the error and an SQLITE_XXX error code is returned.
** In this case the caller must call sqlite3DbFree(db, ) on *pzErr.
*/
int sqlite3VtabCallCreate(sqlite3 *db, int iDb, const char *zTab, char **pzErr){
  int rc = SQLITE_OK;
  Table *pTab;
  Module *pMod;
  const char *zModule;

  pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zName);
  assert(pTab && pTab->isVirtual && !pTab->pVtab);
  pMod = pTab->pMod;
  zModule = pTab->azModuleArg[0];

  /* If the module has been registered and includes a Create method, 
  ** invoke it now. If the module has not been registered, return an 
  ** error. Otherwise, do nothing.
  */
  if( !pMod ){
    *pzErr = sqlite3MPrintf(db, "no such module: %s", zModule);
    rc = SQLITE_ERROR;
  }else{
    rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xCreate, pzErr);
  }

  if( rc==SQLITE_OK && pTab->pVtab ){
      rc = addToVTrans(db, pTab->pVtab);
  }

  return rc;
}

/*
** This function is used to set the schema of a virtual table.  It is only
** valid to call this function from within the xCreate() or xConnect() of a
** virtual table module.
*/
int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
  Parse sParse;

  int rc = SQLITE_OK;
  Table *pTab;
  char *zErr = 0;

  sqlite3_mutex_enter(db->mutex);
  pTab = db->pVTab;
  if( !pTab ){
    sqlite3Error(db, SQLITE_MISUSE, 0);
    sqlite3_mutex_leave(db->mutex);
    return SQLITE_MISUSE;
  }
  assert(pTab->isVirtual && pTab->nCol==0 && pTab->aCol==0);

  memset(&sParse, 0, sizeof(Parse));
  sParse.declareVtab = 1;
  sParse.db = db;

  if( 
      SQLITE_OK == sqlite3RunParser(&sParse, zCreateTable, &zErr) && 
      sParse.pNewTable && 
      !sParse.pNewTable->pSelect && 
      !sParse.pNewTable->isVirtual 
  ){
    pTab->aCol = sParse.pNewTable->aCol;
    pTab->nCol = sParse.pNewTable->nCol;
    sParse.pNewTable->nCol = 0;
    sParse.pNewTable->aCol = 0;
    db->pVTab = 0;
  } else {
    sqlite3Error(db, SQLITE_ERROR, zErr);
    sqlite3DbFree(db, zErr);
    rc = SQLITE_ERROR;
  }
  sParse.declareVtab = 0;

  sqlite3_finalize((sqlite3_stmt*)sParse.pVdbe);
  sqlite3DeleteTable(sParse.pNewTable);
  sParse.pNewTable = 0;

  assert( (rc&0xff)==rc );
  rc = sqlite3ApiExit(db, rc);
  sqlite3_mutex_leave(db->mutex);
  return rc;
}

/*
** This function is invoked by the vdbe to call the xDestroy method
** of the virtual table named zTab in database iDb. This occurs
** when a DROP TABLE is mentioned.
**
** This call is a no-op if zTab is not a virtual table.
*/
int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab)
{
  int rc = SQLITE_OK;
  Table *pTab;

  pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zName);
  assert(pTab);
  if( pTab->pVtab ){
    int (*xDestroy)(sqlite3_vtab *pVTab) = pTab->pMod->pModule->xDestroy;
    rc = sqlite3SafetyOff(db);
    assert( rc==SQLITE_OK );
    if( xDestroy ){
      rc = xDestroy(pTab->pVtab);
    }
    (void)sqlite3SafetyOn(db);
    if( rc==SQLITE_OK ){
      int i;
      for(i=0; i<db->nVTrans; i++){
        if( db->aVTrans[i]==pTab->pVtab ){
          db->aVTrans[i] = db->aVTrans[--db->nVTrans];
          break;
        }
      }
      pTab->pVtab = 0;
    }
  }

  return rc;
}

/*
** This function invokes either the xRollback or xCommit method
** of each of the virtual tables in the sqlite3.aVTrans array. The method
** called is identified by the second argument, "offset", which is
** the offset of the method to call in the sqlite3_module structure.
**
** The array is cleared after invoking the callbacks. 
*/
static void callFinaliser(sqlite3 *db, int offset){
  int i;
  if( db->aVTrans ){
    for(i=0; i<db->nVTrans && db->aVTrans[i]; i++){
      sqlite3_vtab *pVtab = db->aVTrans[i];
      int (*x)(sqlite3_vtab *);
      x = *(int (**)(sqlite3_vtab *))((char *)pVtab->pModule + offset);
      if( x ) x(pVtab);
      sqlite3VtabUnlock(db, pVtab);
    }
    sqlite3DbFree(db, db->aVTrans);
    db->nVTrans = 0;
    db->aVTrans = 0;
  }
}

/*
** Invoke the xSync method of all virtual tables in the sqlite3.aVTrans
** array. Return the error code for the first error that occurs, or
** SQLITE_OK if all xSync operations are successful.
**
** Set *pzErrmsg to point to a buffer that should be released using 
** sqlite3DbFree() containing an error message, if one is available.
*/
int sqlite3VtabSync(sqlite3 *db, char **pzErrmsg){
  int i;
  int rc = SQLITE_OK;
  int rcsafety;
  sqlite3_vtab **aVTrans = db->aVTrans;

  rc = sqlite3SafetyOff(db);
  db->aVTrans = 0;
  for(i=0; rc==SQLITE_OK && i<db->nVTrans && aVTrans[i]; i++){
    sqlite3_vtab *pVtab = aVTrans[i];
    int (*x)(sqlite3_vtab *);
    x = pVtab->pModule->xSync;
    if( x ){
      rc = x(pVtab);
      sqlite3DbFree(db, *pzErrmsg);
      *pzErrmsg = pVtab->zErrMsg;
      pVtab->zErrMsg = 0;
    }
  }
  db->aVTrans = aVTrans;
  rcsafety = sqlite3SafetyOn(db);

  if( rc==SQLITE_OK ){
    rc = rcsafety;
  }
  return rc;
}

/*
** Invoke the xRollback method of all virtual tables in the 
** sqlite3.aVTrans array. Then clear the array itself.
*/
int sqlite3VtabRollback(sqlite3 *db){
  callFinaliser(db, offsetof(sqlite3_module,xRollback));
  return SQLITE_OK;
}

/*
** Invoke the xCommit method of all virtual tables in the 
** sqlite3.aVTrans array. Then clear the array itself.
*/
int sqlite3VtabCommit(sqlite3 *db){
  callFinaliser(db, offsetof(sqlite3_module,xCommit));
  return SQLITE_OK;
}

/*
** If the virtual table pVtab supports the transaction interface
** (xBegin/xRollback/xCommit and optionally xSync) and a transaction is
** not currently open, invoke the xBegin method now.
**
** If the xBegin call is successful, place the sqlite3_vtab pointer
** in the sqlite3.aVTrans array.
*/
int sqlite3VtabBegin(sqlite3 *db, sqlite3_vtab *pVtab){
  int rc = SQLITE_OK;
  const sqlite3_module *pModule;

  /* Special case: If db->aVTrans is NULL and db->nVTrans is greater
  ** than zero, then this function is being called from within a
  ** virtual module xSync() callback. It is illegal to write to 
  ** virtual module tables in this case, so return SQLITE_LOCKED.
  */
  if( 0==db->aVTrans && db->nVTrans>0 ){
    return SQLITE_LOCKED;
  }
  if( !pVtab ){
    return SQLITE_OK;
  } 
  pModule = pVtab->pModule;

  if( pModule->xBegin ){
    int i;


    /* If pVtab is already in the aVTrans array, return early */
    for(i=0; (i<db->nVTrans) && 0!=db->aVTrans[i]; i++){
      if( db->aVTrans[i]==pVtab ){
        return SQLITE_OK;
      }
    }

    /* Invoke the xBegin method */
    rc = pModule->xBegin(pVtab);
    if( rc==SQLITE_OK ){
      rc = addToVTrans(db, pVtab);
    }
  }
  return rc;
}

/*
** The first parameter (pDef) is a function implementation.  The
** second parameter (pExpr) is the first argument to this function.
** If pExpr is a column in a virtual table, then let the virtual
** table implementation have an opportunity to overload the function.
**
** This routine is used to allow virtual table implementations to
** overload MATCH, LIKE, GLOB, and REGEXP operators.
**
** Return either the pDef argument (indicating no change) or a 
** new FuncDef structure that is marked as ephemeral using the
** SQLITE_FUNC_EPHEM flag.
*/
FuncDef *sqlite3VtabOverloadFunction(
  sqlite3 *db,    /* Database connection for reporting malloc problems */
  FuncDef *pDef,  /* Function to possibly overload */
  int nArg,       /* Number of arguments to the function */
  Expr *pExpr     /* First argument to the function */
){
  Table *pTab;
  sqlite3_vtab *pVtab;
  sqlite3_module *pMod;
  void (*xFunc)(sqlite3_context*,int,sqlite3_value**);
  void *pArg;
  FuncDef *pNew;
  int rc = 0;
  char *zLowerName;
  unsigned char *z;


  /* Check to see the left operand is a column in a virtual table */
  if( pExpr==0 ) return pDef;
  if( pExpr->op!=TK_COLUMN ) return pDef;
  pTab = pExpr->pTab;
  if( pTab==0 ) return pDef;
  if( !pTab->isVirtual ) return pDef;
  pVtab = pTab->pVtab;
  assert( pVtab!=0 );
  assert( pVtab->pModule!=0 );
  pMod = (sqlite3_module *)pVtab->pModule;
  if( pMod->xFindFunction==0 ) return pDef;
 
  /* Call the xFindFunction method on the virtual table implementation
  ** to see if the implementation wants to overload this function 
  */
  zLowerName = sqlite3DbStrDup(db, pDef->zName);
  if( zLowerName ){
    for(z=(unsigned char*)zLowerName; *z; z++){
      *z = sqlite3UpperToLower[*z];
    }
    rc = pMod->xFindFunction(pVtab, nArg, zLowerName, &xFunc, &pArg);
    sqlite3DbFree(db, zLowerName);
    if( pVtab->zErrMsg ){
      sqlite3Error(db, rc, "%s", pVtab->zErrMsg);
      sqlite3DbFree(db, pVtab->zErrMsg);
      pVtab->zErrMsg = 0;
    }
  }
  if( rc==0 ){
    return pDef;
  }

  /* Create a new ephemeral function definition for the overloaded
  ** function */
  pNew = sqlite3DbMallocZero(db, sizeof(*pNew) + strlen(pDef->zName) );
  if( pNew==0 ){
    return pDef;
  }
  *pNew = *pDef;
  memcpy(pNew->zName, pDef->zName, strlen(pDef->zName)+1);
  pNew->xFunc = xFunc;
  pNew->pUserData = pArg;
  pNew->flags |= SQLITE_FUNC_EPHEM;
  return pNew;
}

/*
** Make sure virtual table pTab is contained in the pParse->apVirtualLock[]
** array so that an OP_VBegin will get generated for it.  Add pTab to the
** array if it is missing.  If pTab is already in the array, this routine
** is a no-op.
*/
void sqlite3VtabMakeWritable(Parse *pParse, Table *pTab){
  int i, n;
  assert( IsVirtual(pTab) );
  for(i=0; i<pParse->nVtabLock; i++){
    if( pTab==pParse->apVtabLock[i] ) return;
  }
  n = (pParse->nVtabLock+1)*sizeof(pParse->apVtabLock[0]);
  pParse->apVtabLock = sqlite3_realloc(pParse->apVtabLock, n);
  if( pParse->apVtabLock ){
    pParse->apVtabLock[pParse->nVtabLock++] = pTab;
  }else{
    pParse->db->mallocFailed = 1;
  }
}

#endif /* SQLITE_OMIT_VIRTUALTABLE */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/splitsource/where.c.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This module contains C code that generates VDBE code used to process
** the WHERE clause of SQL statements.  This module is responsible for
** generating the code that loops through a table looking for applicable
** rows.  Indices are selected and used to speed the search when doing
** so is applicable.  Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer".
**
** $Id: where.c,v 1.1 2008/08/06 21:48:07 rmsimpson Exp $
*/
#include "sqliteInt.h"

/*
** The number of bits in a Bitmask.  "BMS" means "BitMask Size".
*/
#define BMS  (sizeof(Bitmask)*8)

/*
** Trace output macros
*/
#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG)
int sqlite3WhereTrace = 0;
#endif
#if 0
# define WHERETRACE(X)  if(sqlite3WhereTrace) sqlite3DebugPrintf X
#else
# define WHERETRACE(X)
#endif

/* Forward reference
*/
typedef struct WhereClause WhereClause;
typedef struct ExprMaskSet ExprMaskSet;

/*
** The query generator uses an array of instances of this structure to
** help it analyze the subexpressions of the WHERE clause.  Each WHERE
** clause subexpression is separated from the others by an AND operator.
**
** All WhereTerms are collected into a single WhereClause structure.  
** The following identity holds:
**
**        WhereTerm.pWC->a[WhereTerm.idx] == WhereTerm
**
** When a term is of the form:
**
**              X <op> <expr>
**
** where X is a column name and <op> is one of certain operators,
** then WhereTerm.leftCursor and WhereTerm.leftColumn record the
** cursor number and column number for X.  WhereTerm.operator records
** the <op> using a bitmask encoding defined by WO_xxx below.  The
** use of a bitmask encoding for the operator allows us to search
** quickly for terms that match any of several different operators.
**
** prereqRight and prereqAll record sets of cursor numbers,
** but they do so indirectly.  A single ExprMaskSet structure translates
** cursor number into bits and the translated bit is stored in the prereq
** fields.  The translation is used in order to maximize the number of
** bits that will fit in a Bitmask.  The VDBE cursor numbers might be
** spread out over the non-negative integers.  For example, the cursor
** numbers might be 3, 8, 9, 10, 20, 23, 41, and 45.  The ExprMaskSet
** translates these sparse cursor numbers into consecutive integers
** beginning with 0 in order to make the best possible use of the available
** bits in the Bitmask.  So, in the example above, the cursor numbers
** would be mapped into integers 0 through 7.
*/
typedef struct WhereTerm WhereTerm;
struct WhereTerm {
  Expr *pExpr;            /* Pointer to the subexpression */
  i16 iParent;            /* Disable pWC->a[iParent] when this term disabled */
  i16 leftCursor;         /* Cursor number of X in "X <op> <expr>" */
  i16 leftColumn;         /* Column number of X in "X <op> <expr>" */
  u16 eOperator;          /* A WO_xx value describing <op> */
  u8 flags;               /* Bit flags.  See below */
  u8 nChild;              /* Number of children that must disable us */
  WhereClause *pWC;       /* The clause this term is part of */
  Bitmask prereqRight;    /* Bitmask of tables used by pRight */
  Bitmask prereqAll;      /* Bitmask of tables referenced by p */
};

/*
** Allowed values of WhereTerm.flags
*/
#define TERM_DYNAMIC    0x01   /* Need to call sqlite3ExprDelete(db, pExpr) */
#define TERM_VIRTUAL    0x02   /* Added by the optimizer.  Do not code */
#define TERM_CODED      0x04   /* This term is already coded */
#define TERM_COPIED     0x08   /* Has a child */
#define TERM_OR_OK      0x10   /* Used during OR-clause processing */

/*
** An instance of the following structure holds all information about a
** WHERE clause.  Mostly this is a container for one or more WhereTerms.
*/
struct WhereClause {
  Parse *pParse;           /* The parser context */
  ExprMaskSet *pMaskSet;   /* Mapping of table indices to bitmasks */
  int nTerm;               /* Number of terms */
  int nSlot;               /* Number of entries in a[] */
  WhereTerm *a;            /* Each a[] describes a term of the WHERE cluase */
  WhereTerm aStatic[10];   /* Initial static space for a[] */
};

/*
** An instance of the following structure keeps track of a mapping
** between VDBE cursor numbers and bits of the bitmasks in WhereTerm.
**
** The VDBE cursor numbers are small integers contained in 
** SrcList_item.iCursor and Expr.iTable fields.  For any given WHERE 
** clause, the cursor numbers might not begin with 0 and they might
** contain gaps in the numbering sequence.  But we want to make maximum
** use of the bits in our bitmasks.  This structure provides a mapping
** from the sparse cursor numbers into consecutive integers beginning
** with 0.
**
** If ExprMaskSet.ix[A]==B it means that The A-th bit of a Bitmask
** corresponds VDBE cursor number B.  The A-th bit of a bitmask is 1<<A.
**
** For example, if the WHERE clause expression used these VDBE
** cursors:  4, 5, 8, 29, 57, 73.  Then the  ExprMaskSet structure
** would map those cursor numbers into bits 0 through 5.
**
** Note that the mapping is not necessarily ordered.  In the example
** above, the mapping might go like this:  4->3, 5->1, 8->2, 29->0,
** 57->5, 73->4.  Or one of 719 other combinations might be used. It
** does not really matter.  What is important is that sparse cursor
** numbers all get mapped into bit numbers that begin with 0 and contain
** no gaps.
*/
struct ExprMaskSet {
  int n;                        /* Number of assigned cursor values */
  int ix[sizeof(Bitmask)*8];    /* Cursor assigned to each bit */
};


/*
** Bitmasks for the operators that indices are able to exploit.  An
** OR-ed combination of these values can be used when searching for
** terms in the where clause.
*/
#define WO_IN     1
#define WO_EQ     2
#define WO_LT     (WO_EQ<<(TK_LT-TK_EQ))
#define WO_LE     (WO_EQ<<(TK_LE-TK_EQ))
#define WO_GT     (WO_EQ<<(TK_GT-TK_EQ))
#define WO_GE     (WO_EQ<<(TK_GE-TK_EQ))
#define WO_MATCH  64
#define WO_ISNULL 128

/*
** Value for flags returned by bestIndex().  
**
** The least significant byte is reserved as a mask for WO_ values above.
** The WhereLevel.flags field is usually set to WO_IN|WO_EQ|WO_ISNULL.
** But if the table is the right table of a left join, WhereLevel.flags
** is set to WO_IN|WO_EQ.  The WhereLevel.flags field can then be used as
** the "op" parameter to findTerm when we are resolving equality constraints.
** ISNULL constraints will then not be used on the right table of a left
** join.  Tickets #2177 and #2189.
*/
#define WHERE_ROWID_EQ     0x000100   /* rowid=EXPR or rowid IN (...) */
#define WHERE_ROWID_RANGE  0x000200   /* rowid<EXPR and/or rowid>EXPR */
#define WHERE_COLUMN_EQ    0x001000   /* x=EXPR or x IN (...) */
#define WHERE_COLUMN_RANGE 0x002000   /* x<EXPR and/or x>EXPR */
#define WHERE_COLUMN_IN    0x004000   /* x IN (...) */
#define WHERE_TOP_LIMIT    0x010000   /* x<EXPR or x<=EXPR constraint */
#define WHERE_BTM_LIMIT    0x020000   /* x>EXPR or x>=EXPR constraint */
#define WHERE_IDX_ONLY     0x080000   /* Use index only - omit table */
#define WHERE_ORDERBY      0x100000   /* Output will appear in correct order */
#define WHERE_REVERSE      0x200000   /* Scan in reverse order */
#define WHERE_UNIQUE       0x400000   /* Selects no more than one row */
#define WHERE_VIRTUALTABLE 0x800000   /* Use virtual-table processing */

/*
** Initialize a preallocated WhereClause structure.
*/
static void whereClauseInit(
  WhereClause *pWC,        /* The WhereClause to be initialized */
  Parse *pParse,           /* The parsing context */
  ExprMaskSet *pMaskSet    /* Mapping from table indices to bitmasks */
){
  pWC->pParse = pParse;
  pWC->pMaskSet = pMaskSet;
  pWC->nTerm = 0;
  pWC->nSlot = ArraySize(pWC->aStatic);
  pWC->a = pWC->aStatic;
}

/*
** Deallocate a WhereClause structure.  The WhereClause structure
** itself is not freed.  This routine is the inverse of whereClauseInit().
*/
static void whereClauseClear(WhereClause *pWC){
  int i;
  WhereTerm *a;
  sqlite3 *db = pWC->pParse->db;
  for(i=pWC->nTerm-1, a=pWC->a; i>=0; i--, a++){
    if( a->flags & TERM_DYNAMIC ){
      sqlite3ExprDelete(db, a->pExpr);
    }
  }
  if( pWC->a!=pWC->aStatic ){
    sqlite3DbFree(db, pWC->a);
  }
}

/*
** Add a new entries to the WhereClause structure.  Increase the allocated
** space as necessary.
**
** If the flags argument includes TERM_DYNAMIC, then responsibility
** for freeing the expression p is assumed by the WhereClause object.
**
** WARNING:  This routine might reallocate the space used to store
** WhereTerms.  All pointers to WhereTerms should be invalidated after
** calling this routine.  Such pointers may be reinitialized by referencing
** the pWC->a[] array.
*/
static int whereClauseInsert(WhereClause *pWC, Expr *p, int flags){
  WhereTerm *pTerm;
  int idx;
  if( pWC->nTerm>=pWC->nSlot ){
    WhereTerm *pOld = pWC->a;
    sqlite3 *db = pWC->pParse->db;
    pWC->a = sqlite3DbMallocRaw(db, sizeof(pWC->a[0])*pWC->nSlot*2 );
    if( pWC->a==0 ){
      if( flags & TERM_DYNAMIC ){
        sqlite3ExprDelete(db, p);
      }
      pWC->a = pOld;
      return 0;
    }
    memcpy(pWC->a, pOld, sizeof(pWC->a[0])*pWC->nTerm);
    if( pOld!=pWC->aStatic ){
      sqlite3DbFree(db, pOld);
    }
    pWC->nSlot *= 2;
  }
  pTerm = &pWC->a[idx = pWC->nTerm];
  pWC->nTerm++;
  pTerm->pExpr = p;
  pTerm->flags = flags;
  pTerm->pWC = pWC;
  pTerm->iParent = -1;
  return idx;
}

/*
** This routine identifies subexpressions in the WHERE clause where
** each subexpression is separated by the AND operator or some other
** operator specified in the op parameter.  The WhereClause structure
** is filled with pointers to subexpressions.  For example:
**
**    WHERE  a=='hello' AND coalesce(b,11)<10 AND (c+12!=d OR c==22)
**           \________/     \_______________/     \________________/
**            slot[0]            slot[1]               slot[2]
**
** The original WHERE clause in pExpr is unaltered.  All this routine
** does is make slot[] entries point to substructure within pExpr.
**
** In the previous sentence and in the diagram, "slot[]" refers to
** the WhereClause.a[] array.  This array grows as needed to contain
** all terms of the WHERE clause.
*/
static void whereSplit(WhereClause *pWC, Expr *pExpr, int op){
  if( pExpr==0 ) return;
  if( pExpr->op!=op ){
    whereClauseInsert(pWC, pExpr, 0);
  }else{
    whereSplit(pWC, pExpr->pLeft, op);
    whereSplit(pWC, pExpr->pRight, op);
  }
}

/*
** Initialize an expression mask set
*/
#define initMaskSet(P)  memset(P, 0, sizeof(*P))

/*
** Return the bitmask for the given cursor number.  Return 0 if
** iCursor is not in the set.
*/
static Bitmask getMask(ExprMaskSet *pMaskSet, int iCursor){
  int i;
  for(i=0; i<pMaskSet->n; i++){
    if( pMaskSet->ix[i]==iCursor ){
      return ((Bitmask)1)<<i;
    }
  }
  return 0;
}

/*
** Create a new mask for cursor iCursor.
**
** There is one cursor per table in the FROM clause.  The number of
** tables in the FROM clause is limited by a test early in the
** sqlite3WhereBegin() routine.  So we know that the pMaskSet->ix[]
** array will never overflow.
*/
static void createMask(ExprMaskSet *pMaskSet, int iCursor){
  assert( pMaskSet->n < ArraySize(pMaskSet->ix) );
  pMaskSet->ix[pMaskSet->n++] = iCursor;
}

/*
** This routine walks (recursively) an expression tree and generates
** a bitmask indicating which tables are used in that expression
** tree.
**
** In order for this routine to work, the calling function must have
** previously invoked sqlite3ExprResolveNames() on the expression.  See
** the header comment on that routine for additional information.
** The sqlite3ExprResolveNames() routines looks for column names and
** sets their opcodes to TK_COLUMN and their Expr.iTable fields to
** the VDBE cursor number of the table.  This routine just has to
** translate the cursor numbers into bitmask values and OR all
** the bitmasks together.
*/
static Bitmask exprListTableUsage(ExprMaskSet*, ExprList*);
static Bitmask exprSelectTableUsage(ExprMaskSet*, Select*);
static Bitmask exprTableUsage(ExprMaskSet *pMaskSet, Expr *p){
  Bitmask mask = 0;
  if( p==0 ) return 0;
  if( p->op==TK_COLUMN ){
    mask = getMask(pMaskSet, p->iTable);
    return mask;
  }
  mask = exprTableUsage(pMaskSet, p->pRight);
  mask |= exprTableUsage(pMaskSet, p->pLeft);
  mask |= exprListTableUsage(pMaskSet, p->pList);
  mask |= exprSelectTableUsage(pMaskSet, p->pSelect);
  return mask;
}
static Bitmask exprListTableUsage(ExprMaskSet *pMaskSet, ExprList *pList){
  int i;
  Bitmask mask = 0;
  if( pList ){
    for(i=0; i<pList->nExpr; i++){
      mask |= exprTableUsage(pMaskSet, pList->a[i].pExpr);
    }
  }
  return mask;
}
static Bitmask exprSelectTableUsage(ExprMaskSet *pMaskSet, Select *pS){
  Bitmask mask = 0;
  while( pS ){
    mask |= exprListTableUsage(pMaskSet, pS->pEList);
    mask |= exprListTableUsage(pMaskSet, pS->pGroupBy);
    mask |= exprListTableUsage(pMaskSet, pS->pOrderBy);
    mask |= exprTableUsage(pMaskSet, pS->pWhere);
    mask |= exprTableUsage(pMaskSet, pS->pHaving);
    pS = pS->pPrior;
  }
  return mask;
}

/*
** Return TRUE if the given operator is one of the operators that is
** allowed for an indexable WHERE clause term.  The allowed operators are
** "=", "<", ">", "<=", ">=", and "IN".
*/
static int allowedOp(int op){
  assert( TK_GT>TK_EQ && TK_GT<TK_GE );
  assert( TK_LT>TK_EQ && TK_LT<TK_GE );
  assert( TK_LE>TK_EQ && TK_LE<TK_GE );
  assert( TK_GE==TK_EQ+4 );
  return op==TK_IN || (op>=TK_EQ && op<=TK_GE) || op==TK_ISNULL;
}

/*
** Swap two objects of type T.
*/
#define SWAP(TYPE,A,B) {TYPE t=A; A=B; B=t;}

/*
** Commute a comparison operator.  Expressions of the form "X op Y"
** are converted into "Y op X".
**
** If a collation sequence is associated with either the left or right
** side of the comparison, it remains associated with the same side after
** the commutation. So "Y collate NOCASE op X" becomes 
** "X collate NOCASE op Y". This is because any collation sequence on
** the left hand side of a comparison overrides any collation sequence 
** attached to the right. For the same reason the EP_ExpCollate flag
** is not commuted.
*/
static void exprCommute(Expr *pExpr){
  u16 expRight = (pExpr->pRight->flags & EP_ExpCollate);
  u16 expLeft = (pExpr->pLeft->flags & EP_ExpCollate);
  assert( allowedOp(pExpr->op) && pExpr->op!=TK_IN );
  SWAP(CollSeq*,pExpr->pRight->pColl,pExpr->pLeft->pColl);
  pExpr->pRight->flags = (pExpr->pRight->flags & ~EP_ExpCollate) | expLeft;
  pExpr->pLeft->flags = (pExpr->pLeft->flags & ~EP_ExpCollate) | expRight;
  SWAP(Expr*,pExpr->pRight,pExpr->pLeft);
  if( pExpr->op>=TK_GT ){
    assert( TK_LT==TK_GT+2 );
    assert( TK_GE==TK_LE+2 );
    assert( TK_GT>TK_EQ );
    assert( TK_GT<TK_LE );
    assert( pExpr->op>=TK_GT && pExpr->op<=TK_GE );
    pExpr->op = ((pExpr->op-TK_GT)^2)+TK_GT;
  }
}

/*
** Translate from TK_xx operator to WO_xx bitmask.
*/
static int operatorMask(int op){
  int c;
  assert( allowedOp(op) );
  if( op==TK_IN ){
    c = WO_IN;
  }else if( op==TK_ISNULL ){
    c = WO_ISNULL;
  }else{
    c = WO_EQ<<(op-TK_EQ);
  }
  assert( op!=TK_ISNULL || c==WO_ISNULL );
  assert( op!=TK_IN || c==WO_IN );
  assert( op!=TK_EQ || c==WO_EQ );
  assert( op!=TK_LT || c==WO_LT );
  assert( op!=TK_LE || c==WO_LE );
  assert( op!=TK_GT || c==WO_GT );
  assert( op!=TK_GE || c==WO_GE );
  return c;
}

/*
** Search for a term in the WHERE clause that is of the form "X <op> <expr>"
** where X is a reference to the iColumn of table iCur and <op> is one of
** the WO_xx operator codes specified by the op parameter.
** Return a pointer to the term.  Return 0 if not found.
*/
static WhereTerm *findTerm(
  WhereClause *pWC,     /* The WHERE clause to be searched */
  int iCur,             /* Cursor number of LHS */
  int iColumn,          /* Column number of LHS */
  Bitmask notReady,     /* RHS must not overlap with this mask */
  u16 op,               /* Mask of WO_xx values describing operator */
  Index *pIdx           /* Must be compatible with this index, if not NULL */
){
  WhereTerm *pTerm;
  int k;
  assert( iCur>=0 );
  for(pTerm=pWC->a, k=pWC->nTerm; k; k--, pTerm++){
    if( pTerm->leftCursor==iCur
       && (pTerm->prereqRight & notReady)==0
       && pTerm->leftColumn==iColumn
       && (pTerm->eOperator & op)!=0
    ){
      if( pIdx && pTerm->eOperator!=WO_ISNULL ){
        Expr *pX = pTerm->pExpr;
        CollSeq *pColl;
        char idxaff;
        int j;
        Parse *pParse = pWC->pParse;

        idxaff = pIdx->pTable->aCol[iColumn].affinity;
        if( !sqlite3IndexAffinityOk(pX, idxaff) ) continue;

        /* Figure out the collation sequence required from an index for
        ** it to be useful for optimising expression pX. Store this
        ** value in variable pColl.
        */
        assert(pX->pLeft);
        pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight);
        if( !pColl ){
          pColl = pParse->db->pDfltColl;
        }

        for(j=0; pIdx->aiColumn[j]!=iColumn; j++){
          if( NEVER(j>=pIdx->nColumn) ) return 0;
        }
        if( sqlite3StrICmp(pColl->zName, pIdx->azColl[j]) ) continue;
      }
      return pTerm;
    }
  }
  return 0;
}

/* Forward reference */
static void exprAnalyze(SrcList*, WhereClause*, int);

/*
** Call exprAnalyze on all terms in a WHERE clause.  
**
**
*/
static void exprAnalyzeAll(
  SrcList *pTabList,       /* the FROM clause */
  WhereClause *pWC         /* the WHERE clause to be analyzed */
){
  int i;
  for(i=pWC->nTerm-1; i>=0; i--){
    exprAnalyze(pTabList, pWC, i);
  }
}

#ifndef SQLITE_OMIT_LIKE_OPTIMIZATION
/*
** Check to see if the given expression is a LIKE or GLOB operator that
** can be optimized using inequality constraints.  Return TRUE if it is
** so and false if not.
**
** 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(
  sqlite3 *db,      /* The database */
  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;
  Expr *pRight, *pLeft;
  ExprList *pList;
  int c, cnt;
  char wc[3];
  CollSeq *pColl;

  if( !sqlite3IsLikeFunction(db, pExpr, pnoCase, wc) ){
    return 0;
  }
#ifdef SQLITE_EBCDIC
  if( *pnoCase ) return 0;
#endif
  pList = pExpr->pList;
  pRight = pList->a[0].pExpr;
  if( pRight->op!=TK_STRING
   && (pRight->op!=TK_REGISTER || pRight->iColumn!=TK_STRING) ){
    return 0;
  }
  pLeft = pList->a[1].pExpr;
  if( pLeft->op!=TK_COLUMN ){
    return 0;
  }
  pColl = pLeft->pColl;
  assert( pColl!=0 || pLeft->iColumn==-1 );
  if( pColl==0 ){
    /* No collation is defined for the ROWID.  Use the default. */
    pColl = db->pDfltColl;
  }
  if( (pColl->type!=SQLITE_COLL_BINARY || *pnoCase) &&
      (pColl->type!=SQLITE_COLL_NOCASE || !*pnoCase) ){
    return 0;
  }
  sqlite3DequoteExpr(db, pRight);
  z = (char *)pRight->token.z;
  cnt = 0;
  if( z ){
    while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){ cnt++; }
  }
  if( cnt==0 || 255==(u8)z[cnt] ){
    return 0;
  }
  *pisComplete = z[cnt]==wc[0] && z[cnt+1]==0;
  *pnPattern = cnt;
  return 1;
}
#endif /* SQLITE_OMIT_LIKE_OPTIMIZATION */


#ifndef SQLITE_OMIT_VIRTUALTABLE
/*
** Check to see if the given expression is of the form
**
**         column MATCH expr
**
** If it is then return TRUE.  If not, return FALSE.
*/
static int isMatchOfColumn(
  Expr *pExpr      /* Test this expression */
){
  ExprList *pList;

  if( pExpr->op!=TK_FUNCTION ){
    return 0;
  }
  if( pExpr->token.n!=5 ||
       sqlite3StrNICmp((const char*)pExpr->token.z,"match",5)!=0 ){
    return 0;
  }
  pList = pExpr->pList;
  if( pList->nExpr!=2 ){
    return 0;
  }
  if( pList->a[1].pExpr->op != TK_COLUMN ){
    return 0;
  }
  return 1;
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */

/*
** If the pBase expression originated in the ON or USING clause of
** a join, then transfer the appropriate markings over to derived.
*/
static void transferJoinMarkings(Expr *pDerived, Expr *pBase){
  pDerived->flags |= pBase->flags & EP_FromJoin;
  pDerived->iRightJoinTable = pBase->iRightJoinTable;
}

#if !defined(SQLITE_OMIT_OR_OPTIMIZATION) && !defined(SQLITE_OMIT_SUBQUERY)
/*
** Return TRUE if the given term of an OR clause can be converted
** into an IN clause.  The iCursor and iColumn define the left-hand
** side of the IN clause.
**
** The context is that we have multiple OR-connected equality terms
** like this:
**
**           a=<expr1> OR  a=<expr2> OR b=<expr3>  OR ...
**
** The pOrTerm input to this routine corresponds to a single term of
** this OR clause.  In order for the term to be a candidate for
** conversion to an IN operator, the following must be true:
**
**     *  The left-hand side of the term must be the column which
**        is identified by iCursor and iColumn.
**
**     *  If the right-hand side is also a column, then the affinities
**        of both right and left sides must be such that no type
**        conversions are required on the right.  (Ticket #2249)
**
** If both of these conditions are true, then return true.  Otherwise
** return false.
*/
static int orTermIsOptCandidate(WhereTerm *pOrTerm, int iCursor, int iColumn){
  int affLeft, affRight;
  assert( pOrTerm->eOperator==WO_EQ );
  if( pOrTerm->leftCursor!=iCursor ){
    return 0;
  }
  if( pOrTerm->leftColumn!=iColumn ){
    return 0;
  }
  affRight = sqlite3ExprAffinity(pOrTerm->pExpr->pRight);
  if( affRight==0 ){
    return 1;
  }
  affLeft = sqlite3ExprAffinity(pOrTerm->pExpr->pLeft);
  if( affRight!=affLeft ){
    return 0;
  }
  return 1;
}

/*
** Return true if the given term of an OR clause can be ignored during
** a check to make sure all OR terms are candidates for optimization.
** In other words, return true if a call to the orTermIsOptCandidate()
** above returned false but it is not necessary to disqualify the
** optimization.
**
** Suppose the original OR phrase was this:
**
**           a=4  OR  a=11  OR  a=b
**
** During analysis, the third term gets flipped around and duplicate
** so that we are left with this:
**
**           a=4  OR  a=11  OR  a=b  OR  b=a
**
** Since the last two terms are duplicates, only one of them
** has to qualify in order for the whole phrase to qualify.  When
** this routine is called, we know that pOrTerm did not qualify.
** This routine merely checks to see if pOrTerm has a duplicate that
** might qualify.  If there is a duplicate that has not yet been
** disqualified, then return true.  If there are no duplicates, or
** the duplicate has also been disqualified, return false.
*/
static int orTermHasOkDuplicate(WhereClause *pOr, WhereTerm *pOrTerm){
  if( pOrTerm->flags & TERM_COPIED ){
    /* This is the original term.  The duplicate is to the left had
    ** has not yet been analyzed and thus has not yet been disqualified. */
    return 1;
  }
  if( (pOrTerm->flags & TERM_VIRTUAL)!=0
     && (pOr->a[pOrTerm->iParent].flags & TERM_OR_OK)!=0 ){
    /* This is a duplicate term.  The original qualified so this one
    ** does not have to. */
    return 1;
  }
  /* This is either a singleton term or else it is a duplicate for
  ** which the original did not qualify.  Either way we are done for. */
  return 0;
}
#endif /* !SQLITE_OMIT_OR_OPTIMIZATION && !SQLITE_OMIT_SUBQUERY */

/*
** The input to this routine is an WhereTerm structure with only the
** "pExpr" field filled in.  The job of this routine is to analyze the
** subexpression and populate all the other fields of the WhereTerm
** structure.
**
** If the expression is of the form "<expr> <op> X" it gets commuted
** to the standard form of "X <op> <expr>".  If the expression is of
** the form "X <op> Y" where both X and Y are columns, then the original
** expression is unchanged and a new virtual expression of the form
** "Y <op> X" is added to the WHERE clause and analyzed separately.
*/
static void exprAnalyze(
  SrcList *pSrc,            /* the FROM clause */
  WhereClause *pWC,         /* the WHERE clause */
  int idxTerm               /* Index of the term to be analyzed */
){
  WhereTerm *pTerm;
  ExprMaskSet *pMaskSet;
  Expr *pExpr;
  Bitmask prereqLeft;
  Bitmask prereqAll;
  Bitmask extraRight = 0;
  int nPattern;
  int isComplete;
  int noCase;
  int op;
  Parse *pParse = pWC->pParse;
  sqlite3 *db = pParse->db;

  if( db->mallocFailed ){
    return;
  }
  pTerm = &pWC->a[idxTerm];
  pMaskSet = pWC->pMaskSet;
  pExpr = pTerm->pExpr;
  prereqLeft = exprTableUsage(pMaskSet, pExpr->pLeft);
  op = pExpr->op;
  if( op==TK_IN ){
    assert( pExpr->pRight==0 );
    pTerm->prereqRight = exprListTableUsage(pMaskSet, pExpr->pList)
                          | exprSelectTableUsage(pMaskSet, pExpr->pSelect);
  }else if( op==TK_ISNULL ){
    pTerm->prereqRight = 0;
  }else{
    pTerm->prereqRight = exprTableUsage(pMaskSet, pExpr->pRight);
  }
  prereqAll = exprTableUsage(pMaskSet, pExpr);
  if( ExprHasProperty(pExpr, EP_FromJoin) ){
    Bitmask x = getMask(pMaskSet, pExpr->iRightJoinTable);
    prereqAll |= x;
    extraRight = x-1;  /* ON clause terms may not be used with an index
                       ** on left table of a LEFT JOIN.  Ticket #3015 */
  }
  pTerm->prereqAll = prereqAll;
  pTerm->leftCursor = -1;
  pTerm->iParent = -1;
  pTerm->eOperator = 0;
  if( allowedOp(op) && (pTerm->prereqRight & prereqLeft)==0 ){
    Expr *pLeft = pExpr->pLeft;
    Expr *pRight = pExpr->pRight;
    if( pLeft->op==TK_COLUMN ){
      pTerm->leftCursor = pLeft->iTable;
      pTerm->leftColumn = pLeft->iColumn;
      pTerm->eOperator = operatorMask(op);
    }
    if( pRight && pRight->op==TK_COLUMN ){
      WhereTerm *pNew;
      Expr *pDup;
      if( pTerm->leftCursor>=0 ){
        int idxNew;
        pDup = sqlite3ExprDup(db, pExpr);
        if( db->mallocFailed ){
          sqlite3ExprDelete(db, pDup);
          return;
        }
        idxNew = whereClauseInsert(pWC, pDup, TERM_VIRTUAL|TERM_DYNAMIC);
        if( idxNew==0 ) return;
        pNew = &pWC->a[idxNew];
        pNew->iParent = idxTerm;
        pTerm = &pWC->a[idxTerm];
        pTerm->nChild = 1;
        pTerm->flags |= TERM_COPIED;
      }else{
        pDup = pExpr;
        pNew = pTerm;
      }
      exprCommute(pDup);
      pLeft = pDup->pLeft;
      pNew->leftCursor = pLeft->iTable;
      pNew->leftColumn = pLeft->iColumn;
      pNew->prereqRight = prereqLeft;
      pNew->prereqAll = prereqAll;
      pNew->eOperator = operatorMask(pDup->op);
    }
  }

#ifndef SQLITE_OMIT_BETWEEN_OPTIMIZATION
  /* If a term is the BETWEEN operator, create two new virtual terms
  ** that define the range that the BETWEEN implements.
  */
  else if( pExpr->op==TK_BETWEEN ){
    ExprList *pList = pExpr->pList;
    int i;
    static const u8 ops[] = {TK_GE, TK_LE};
    assert( pList!=0 );
    assert( pList->nExpr==2 );
    for(i=0; i<2; i++){
      Expr *pNewExpr;
      int idxNew;
      pNewExpr = sqlite3Expr(db, ops[i], sqlite3ExprDup(db, pExpr->pLeft),
                             sqlite3ExprDup(db, pList->a[i].pExpr), 0);
      idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC);
      exprAnalyze(pSrc, pWC, idxNew);
      pTerm = &pWC->a[idxTerm];
      pWC->a[idxNew].iParent = idxTerm;
    }
    pTerm->nChild = 2;
  }
#endif /* SQLITE_OMIT_BETWEEN_OPTIMIZATION */

#if !defined(SQLITE_OMIT_OR_OPTIMIZATION) && !defined(SQLITE_OMIT_SUBQUERY)
  /* Attempt to convert OR-connected terms into an IN operator so that
  ** they can make use of indices.  Example:
  **
  **      x = expr1  OR  expr2 = x  OR  x = expr3
  **
  ** is converted into
  **
  **      x IN (expr1,expr2,expr3)
  **
  ** This optimization must be omitted if OMIT_SUBQUERY is defined because
  ** the compiler for the the IN operator is part of sub-queries.
  */
  else if( pExpr->op==TK_OR ){
    int ok;
    int i, j;
    int iColumn, iCursor;
    WhereClause sOr;
    WhereTerm *pOrTerm;

    assert( (pTerm->flags & TERM_DYNAMIC)==0 );
    whereClauseInit(&sOr, pWC->pParse, pMaskSet);
    whereSplit(&sOr, pExpr, TK_OR);
    exprAnalyzeAll(pSrc, &sOr);
    assert( sOr.nTerm>=2 );
    j = 0;
    if( db->mallocFailed ) goto or_not_possible;
    do{
      assert( j<sOr.nTerm );
      iColumn = sOr.a[j].leftColumn;
      iCursor = sOr.a[j].leftCursor;
      ok = iCursor>=0;
      for(i=sOr.nTerm-1, pOrTerm=sOr.a; i>=0 && ok; i--, pOrTerm++){
        if( pOrTerm->eOperator!=WO_EQ ){
          goto or_not_possible;
        }
        if( orTermIsOptCandidate(pOrTerm, iCursor, iColumn) ){
          pOrTerm->flags |= TERM_OR_OK;
        }else if( orTermHasOkDuplicate(&sOr, pOrTerm) ){
          pOrTerm->flags &= ~TERM_OR_OK;
        }else{
          ok = 0;
        }
      }
    }while( !ok && (sOr.a[j++].flags & TERM_COPIED)!=0 && j<2 );
    if( ok ){
      ExprList *pList = 0;
      Expr *pNew, *pDup;
      Expr *pLeft = 0;
      for(i=sOr.nTerm-1, pOrTerm=sOr.a; i>=0; i--, pOrTerm++){
        if( (pOrTerm->flags & TERM_OR_OK)==0 ) continue;
        pDup = sqlite3ExprDup(db, pOrTerm->pExpr->pRight);
        pList = sqlite3ExprListAppend(pWC->pParse, pList, pDup, 0);
        pLeft = pOrTerm->pExpr->pLeft;
      }
      assert( pLeft!=0 );
      pDup = sqlite3ExprDup(db, pLeft);
      pNew = sqlite3Expr(db, TK_IN, pDup, 0, 0);
      if( pNew ){
        int idxNew;
        transferJoinMarkings(pNew, pExpr);
        pNew->pList = pList;
        idxNew = whereClauseInsert(pWC, pNew, TERM_VIRTUAL|TERM_DYNAMIC);
        exprAnalyze(pSrc, pWC, idxNew);
        pTerm = &pWC->a[idxTerm];
        pWC->a[idxNew].iParent = idxTerm;
        pTerm->nChild = 1;
      }else{
        sqlite3ExprListDelete(db, pList);
      }
    }
or_not_possible:
    whereClauseClear(&sOr);
  }
#endif /* SQLITE_OMIT_OR_OPTIMIZATION */

#ifndef SQLITE_OMIT_LIKE_OPTIMIZATION
  /* Add constraints to reduce the search space on a LIKE or GLOB
  ** operator.
  **
  ** 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(db, pExpr, &nPattern, &isComplete, &noCase) ){
    Expr *pLeft, *pRight;
    Expr *pStr1, *pStr2;
    Expr *pNewExpr1, *pNewExpr2;
    int idxNew1, idxNew2;

    pLeft = pExpr->pList->a[1].pExpr;
    pRight = pExpr->pList->a[0].pExpr;
    pStr1 = sqlite3PExpr(pParse, TK_STRING, 0, 0, 0);
    if( pStr1 ){
      sqlite3TokenCopy(db, &pStr1->token, &pRight->token);
      pStr1->token.n = nPattern;
      pStr1->flags = EP_Dequoted;
    }
    pStr2 = sqlite3ExprDup(db, pStr1);
    if( !db->mallocFailed ){
      u8 c, *pC;
      assert( pStr2->token.dyn );
      pC = (u8*)&pStr2->token.z[nPattern-1];
      c = *pC;
      if( noCase ){
        if( c=='@' ) isComplete = 0;
        c = sqlite3UpperToLower[c];
      }
      *pC = c + 1;
    }
    pNewExpr1 = sqlite3PExpr(pParse, TK_GE, sqlite3ExprDup(db,pLeft), pStr1, 0);
    idxNew1 = whereClauseInsert(pWC, pNewExpr1, TERM_VIRTUAL|TERM_DYNAMIC);
    exprAnalyze(pSrc, pWC, idxNew1);
    pNewExpr2 = sqlite3PExpr(pParse, TK_LT, sqlite3ExprDup(db,pLeft), pStr2, 0);
    idxNew2 = whereClauseInsert(pWC, pNewExpr2, TERM_VIRTUAL|TERM_DYNAMIC);
    exprAnalyze(pSrc, pWC, idxNew2);
    pTerm = &pWC->a[idxTerm];
    if( isComplete ){
      pWC->a[idxNew1].iParent = idxTerm;
      pWC->a[idxNew2].iParent = idxTerm;
      pTerm->nChild = 2;
    }
  }
#endif /* SQLITE_OMIT_LIKE_OPTIMIZATION */

#ifndef SQLITE_OMIT_VIRTUALTABLE
  /* Add a WO_MATCH auxiliary term to the constraint set if the
  ** current expression is of the form:  column MATCH expr.
  ** This information is used by the xBestIndex methods of
  ** virtual tables.  The native query optimizer does not attempt
  ** to do anything with MATCH functions.
  */
  if( isMatchOfColumn(pExpr) ){
    int idxNew;
    Expr *pRight, *pLeft;
    WhereTerm *pNewTerm;
    Bitmask prereqColumn, prereqExpr;

    pRight = pExpr->pList->a[0].pExpr;
    pLeft = pExpr->pList->a[1].pExpr;
    prereqExpr = exprTableUsage(pMaskSet, pRight);
    prereqColumn = exprTableUsage(pMaskSet, pLeft);
    if( (prereqExpr & prereqColumn)==0 ){
      Expr *pNewExpr;
      pNewExpr = sqlite3Expr(db, TK_MATCH, 0, sqlite3ExprDup(db, pRight), 0);
      idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC);
      pNewTerm = &pWC->a[idxNew];
      pNewTerm->prereqRight = prereqExpr;
      pNewTerm->leftCursor = pLeft->iTable;
      pNewTerm->leftColumn = pLeft->iColumn;
      pNewTerm->eOperator = WO_MATCH;
      pNewTerm->iParent = idxTerm;
      pTerm = &pWC->a[idxTerm];
      pTerm->nChild = 1;
      pTerm->flags |= TERM_COPIED;
      pNewTerm->prereqAll = pTerm->prereqAll;
    }
  }
#endif /* SQLITE_OMIT_VIRTUALTABLE */

  /* Prevent ON clause terms of a LEFT JOIN from being used to drive
  ** an index for tables to the left of the join.
  */
  pTerm->prereqRight |= extraRight;
}

/*
** Return TRUE if any of the expressions in pList->a[iFirst...] contain
** a reference to any table other than the iBase table.
*/
static int referencesOtherTables(
  ExprList *pList,          /* Search expressions in ths list */
  ExprMaskSet *pMaskSet,    /* Mapping from tables to bitmaps */
  int iFirst,               /* Be searching with the iFirst-th expression */
  int iBase                 /* Ignore references to this table */
){
  Bitmask allowed = ~getMask(pMaskSet, iBase);
  while( iFirst<pList->nExpr ){
    if( (exprTableUsage(pMaskSet, pList->a[iFirst++].pExpr)&allowed)!=0 ){
      return 1;
    }
  }
  return 0;
}


/*
** This routine decides if pIdx can be used to satisfy the ORDER BY
** clause.  If it can, it returns 1.  If pIdx cannot satisfy the
** ORDER BY clause, this routine returns 0.
**
** pOrderBy is an ORDER BY clause from a SELECT statement.  pTab is the
** left-most table in the FROM clause of that same SELECT statement and
** the table has a cursor number of "base".  pIdx is an index on pTab.
**
** nEqCol is the number of columns of pIdx that are used as equality
** constraints.  Any of these columns may be missing from the ORDER BY
** clause and the match can still be a success.
**
** All terms of the ORDER BY that match against the index must be either
** ASC or DESC.  (Terms of the ORDER BY clause past the end of a UNIQUE
** index do not need to satisfy this constraint.)  The *pbRev value is
** set to 1 if the ORDER BY clause is all DESC and it is set to 0 if
** the ORDER BY clause is all ASC.
*/
static int isSortingIndex(
  Parse *pParse,          /* Parsing context */
  ExprMaskSet *pMaskSet,  /* Mapping from table indices to bitmaps */
  Index *pIdx,            /* The index we are testing */
  int base,               /* Cursor number for the table to be sorted */
  ExprList *pOrderBy,     /* The ORDER BY clause */
  int nEqCol,             /* Number of index columns with == constraints */
  int *pbRev              /* Set to 1 if ORDER BY is DESC */
){
  int i, j;                       /* Loop counters */
  int sortOrder = 0;              /* XOR of index and ORDER BY sort direction */
  int nTerm;                      /* Number of ORDER BY terms */
  struct ExprList_item *pTerm;    /* A term of the ORDER BY clause */
  sqlite3 *db = pParse->db;

  assert( pOrderBy!=0 );
  nTerm = pOrderBy->nExpr;
  assert( nTerm>0 );

  /* Match terms of the ORDER BY clause against columns of
  ** the index.
  **
  ** Note that indices have pIdx->nColumn regular columns plus
  ** one additional column containing the rowid.  The rowid column
  ** of the index is also allowed to match against the ORDER BY
  ** clause.
  */
  for(i=j=0, pTerm=pOrderBy->a; j<nTerm && i<=pIdx->nColumn; i++){
    Expr *pExpr;       /* The expression of the ORDER BY pTerm */
    CollSeq *pColl;    /* The collating sequence of pExpr */
    int termSortOrder; /* Sort order for this term */
    int iColumn;       /* The i-th column of the index.  -1 for rowid */
    int iSortOrder;    /* 1 for DESC, 0 for ASC on the i-th index term */
    const char *zColl; /* Name of the collating sequence for i-th index term */

    pExpr = pTerm->pExpr;
    if( pExpr->op!=TK_COLUMN || pExpr->iTable!=base ){
      /* Can not use an index sort on anything that is not a column in the
      ** left-most table of the FROM clause */
      break;
    }
    pColl = sqlite3ExprCollSeq(pParse, pExpr);
    if( !pColl ){
      pColl = db->pDfltColl;
    }
    if( i<pIdx->nColumn ){
      iColumn = pIdx->aiColumn[i];
      if( iColumn==pIdx->pTable->iPKey ){
        iColumn = -1;
      }
      iSortOrder = pIdx->aSortOrder[i];
      zColl = pIdx->azColl[i];
    }else{
      iColumn = -1;
      iSortOrder = 0;
      zColl = pColl->zName;
    }
    if( pExpr->iColumn!=iColumn || sqlite3StrICmp(pColl->zName, zColl) ){
      /* Term j of the ORDER BY clause does not match column i of the index */
      if( i<nEqCol ){
        /* If an index column that is constrained by == fails to match an
        ** ORDER BY term, that is OK.  Just ignore that column of the index
        */
        continue;
      }else if( i==pIdx->nColumn ){
        /* Index column i is the rowid.  All other terms match. */
        break;
      }else{
        /* If an index column fails to match and is not constrained by ==
        ** then the index cannot satisfy the ORDER BY constraint.
        */
        return 0;
      }
    }
    assert( pIdx->aSortOrder!=0 );
    assert( pTerm->sortOrder==0 || pTerm->sortOrder==1 );
    assert( iSortOrder==0 || iSortOrder==1 );
    termSortOrder = iSortOrder ^ pTerm->sortOrder;
    if( i>nEqCol ){
      if( termSortOrder!=sortOrder ){
        /* Indices can only be used if all ORDER BY terms past the
        ** equality constraints are all either DESC or ASC. */
        return 0;
      }
    }else{
      sortOrder = termSortOrder;
    }
    j++;
    pTerm++;
    if( iColumn<0 && !referencesOtherTables(pOrderBy, pMaskSet, j, base) ){
      /* If the indexed column is the primary key and everything matches
      ** so far and none of the ORDER BY terms to the right reference other
      ** tables in the join, then we are assured that the index can be used 
      ** to sort because the primary key is unique and so none of the other
      ** columns will make any difference
      */
      j = nTerm;
    }
  }

  *pbRev = sortOrder!=0;
  if( j>=nTerm ){
    /* All terms of the ORDER BY clause are covered by this index so
    ** this index can be used for sorting. */
    return 1;
  }
  if( pIdx->onError!=OE_None && i==pIdx->nColumn
      && !referencesOtherTables(pOrderBy, pMaskSet, j, base) ){
    /* All terms of this index match some prefix of the ORDER BY clause
    ** and the index is UNIQUE and no terms on the tail of the ORDER BY
    ** clause reference other tables in a join.  If this is all true then
    ** the order by clause is superfluous. */
    return 1;
  }
  return 0;
}

/*
** Check table to see if the ORDER BY clause in pOrderBy can be satisfied
** by sorting in order of ROWID.  Return true if so and set *pbRev to be
** true for reverse ROWID and false for forward ROWID order.
*/
static int sortableByRowid(
  int base,               /* Cursor number for table to be sorted */
  ExprList *pOrderBy,     /* The ORDER BY clause */
  ExprMaskSet *pMaskSet,  /* Mapping from tables to bitmaps */
  int *pbRev              /* Set to 1 if ORDER BY is DESC */
){
  Expr *p;

  assert( pOrderBy!=0 );
  assert( pOrderBy->nExpr>0 );
  p = pOrderBy->a[0].pExpr;
  if( p->op==TK_COLUMN && p->iTable==base && p->iColumn==-1
    && !referencesOtherTables(pOrderBy, pMaskSet, 1, base) ){
    *pbRev = pOrderBy->a[0].sortOrder;
    return 1;
  }
  return 0;
}

/*
** Prepare a crude estimate of the logarithm of the input value.
** The results need not be exact.  This is only used for estimating
** the total cost of performing operations with O(logN) or O(NlogN)
** complexity.  Because N is just a guess, it is no great tragedy if
** logN is a little off.
*/
static double estLog(double N){
  double logN = 1;
  double x = 10;
  while( N>x ){
    logN += 1;
    x *= 10;
  }
  return logN;
}

/*
** Two routines for printing the content of an sqlite3_index_info
** structure.  Used for testing and debugging only.  If neither
** SQLITE_TEST or SQLITE_DEBUG are defined, then these routines
** are no-ops.
*/
#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_DEBUG)
static void TRACE_IDX_INPUTS(sqlite3_index_info *p){
  int i;
  if( !sqlite3WhereTrace ) return;
  for(i=0; i<p->nConstraint; i++){
    sqlite3DebugPrintf("  constraint[%d]: col=%d termid=%d op=%d usabled=%d\n",
       i,
       p->aConstraint[i].iColumn,
       p->aConstraint[i].iTermOffset,
       p->aConstraint[i].op,
       p->aConstraint[i].usable);
  }
  for(i=0; i<p->nOrderBy; i++){
    sqlite3DebugPrintf("  orderby[%d]: col=%d desc=%d\n",
       i,
       p->aOrderBy[i].iColumn,
       p->aOrderBy[i].desc);
  }
}
static void TRACE_IDX_OUTPUTS(sqlite3_index_info *p){
  int i;
  if( !sqlite3WhereTrace ) return;
  for(i=0; i<p->nConstraint; i++){
    sqlite3DebugPrintf("  usage[%d]: argvIdx=%d omit=%d\n",
       i,
       p->aConstraintUsage[i].argvIndex,
       p->aConstraintUsage[i].omit);
  }
  sqlite3DebugPrintf("  idxNum=%d\n", p->idxNum);
  sqlite3DebugPrintf("  idxStr=%s\n", p->idxStr);
  sqlite3DebugPrintf("  orderByConsumed=%d\n", p->orderByConsumed);
  sqlite3DebugPrintf("  estimatedCost=%g\n", p->estimatedCost);
}
#else
#define TRACE_IDX_INPUTS(A)
#define TRACE_IDX_OUTPUTS(A)
#endif

#ifndef SQLITE_OMIT_VIRTUALTABLE
/*
** Compute the best index for a virtual table.
**
** The best index is computed by the xBestIndex method of the virtual
** table module.  This routine is really just a wrapper that sets up
** the sqlite3_index_info structure that is used to communicate with
** xBestIndex.
**
** In a join, this routine might be called multiple times for the
** same virtual table.  The sqlite3_index_info structure is created
** and initialized on the first invocation and reused on all subsequent
** invocations.  The sqlite3_index_info structure is also used when
** code is generated to access the virtual table.  The whereInfoDelete() 
** routine takes care of freeing the sqlite3_index_info structure after
** everybody has finished with it.
*/
static double bestVirtualIndex(
  Parse *pParse,                 /* The parsing context */
  WhereClause *pWC,              /* The WHERE clause */
  struct SrcList_item *pSrc,     /* The FROM clause term to search */
  Bitmask notReady,              /* Mask of cursors that are not available */
  ExprList *pOrderBy,            /* The order by clause */
  int orderByUsable,             /* True if we can potential sort */
  sqlite3_index_info **ppIdxInfo /* Index information passed to xBestIndex */
){
  Table *pTab = pSrc->pTab;
  sqlite3_vtab *pVtab = pTab->pVtab;
  sqlite3_index_info *pIdxInfo;
  struct sqlite3_index_constraint *pIdxCons;
  struct sqlite3_index_orderby *pIdxOrderBy;
  struct sqlite3_index_constraint_usage *pUsage;
  WhereTerm *pTerm;
  int i, j;
  int nOrderBy;
  int rc;

  /* If the sqlite3_index_info structure has not been previously
  ** allocated and initialized for this virtual table, then allocate
  ** and initialize it now
  */
  pIdxInfo = *ppIdxInfo;
  if( pIdxInfo==0 ){
    WhereTerm *pTerm;
    int nTerm;
    WHERETRACE(("Recomputing index info for %s...\n", pTab->zName));

    /* Count the number of possible WHERE clause constraints referring
    ** to this virtual table */
    for(i=nTerm=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
      if( pTerm->leftCursor != pSrc->iCursor ) continue;
      if( (pTerm->eOperator&(pTerm->eOperator-1))==0 );
      testcase( pTerm->eOperator==WO_IN );
      testcase( pTerm->eOperator==WO_ISNULL );
      if( pTerm->eOperator & (WO_IN|WO_ISNULL) ) continue;
      nTerm++;
    }

    /* If the ORDER BY clause contains only columns in the current 
    ** virtual table then allocate space for the aOrderBy part of
    ** the sqlite3_index_info structure.
    */
    nOrderBy = 0;
    if( pOrderBy ){
      for(i=0; i<pOrderBy->nExpr; i++){
        Expr *pExpr = pOrderBy->a[i].pExpr;
        if( pExpr->op!=TK_COLUMN || pExpr->iTable!=pSrc->iCursor ) break;
      }
      if( i==pOrderBy->nExpr ){
        nOrderBy = pOrderBy->nExpr;
      }
    }

    /* Allocate the sqlite3_index_info structure
    */
    pIdxInfo = sqlite3DbMallocZero(pParse->db, sizeof(*pIdxInfo)
                             + (sizeof(*pIdxCons) + sizeof(*pUsage))*nTerm
                             + sizeof(*pIdxOrderBy)*nOrderBy );
    if( pIdxInfo==0 ){
      sqlite3ErrorMsg(pParse, "out of memory");
      return 0.0;
    }
    *ppIdxInfo = pIdxInfo;

    /* Initialize the structure.  The sqlite3_index_info structure contains
    ** many fields that are declared "const" to prevent xBestIndex from
    ** changing them.  We have to do some funky casting in order to
    ** initialize those fields.
    */
    pIdxCons = (struct sqlite3_index_constraint*)&pIdxInfo[1];
    pIdxOrderBy = (struct sqlite3_index_orderby*)&pIdxCons[nTerm];
    pUsage = (struct sqlite3_index_constraint_usage*)&pIdxOrderBy[nOrderBy];
    *(int*)&pIdxInfo->nConstraint = nTerm;
    *(int*)&pIdxInfo->nOrderBy = nOrderBy;
    *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint = pIdxCons;
    *(struct sqlite3_index_orderby**)&pIdxInfo->aOrderBy = pIdxOrderBy;
    *(struct sqlite3_index_constraint_usage**)&pIdxInfo->aConstraintUsage =
                                                                     pUsage;

    for(i=j=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
      if( pTerm->leftCursor != pSrc->iCursor ) continue;
      if( (pTerm->eOperator&(pTerm->eOperator-1))==0 );
      testcase( pTerm->eOperator==WO_IN );
      testcase( pTerm->eOperator==WO_ISNULL );
      if( pTerm->eOperator & (WO_IN|WO_ISNULL) ) continue;
      pIdxCons[j].iColumn = pTerm->leftColumn;
      pIdxCons[j].iTermOffset = i;
      pIdxCons[j].op = pTerm->eOperator;
      /* The direct assignment in the previous line is possible only because
      ** the WO_ and SQLITE_INDEX_CONSTRAINT_ codes are identical.  The
      ** following asserts verify this fact. */
      assert( WO_EQ==SQLITE_INDEX_CONSTRAINT_EQ );
      assert( WO_LT==SQLITE_INDEX_CONSTRAINT_LT );
      assert( WO_LE==SQLITE_INDEX_CONSTRAINT_LE );
      assert( WO_GT==SQLITE_INDEX_CONSTRAINT_GT );
      assert( WO_GE==SQLITE_INDEX_CONSTRAINT_GE );
      assert( WO_MATCH==SQLITE_INDEX_CONSTRAINT_MATCH );
      assert( pTerm->eOperator & (WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE|WO_MATCH) );
      j++;
    }
    for(i=0; i<nOrderBy; i++){
      Expr *pExpr = pOrderBy->a[i].pExpr;
      pIdxOrderBy[i].iColumn = pExpr->iColumn;
      pIdxOrderBy[i].desc = pOrderBy->a[i].sortOrder;
    }
  }

  /* At this point, the sqlite3_index_info structure that pIdxInfo points
  ** to will have been initialized, either during the current invocation or
  ** during some prior invocation.  Now we just have to customize the
  ** details of pIdxInfo for the current invocation and pass it to
  ** xBestIndex.
  */

  /* The module name must be defined. Also, by this point there must
  ** be a pointer to an sqlite3_vtab structure. Otherwise
  ** sqlite3ViewGetColumnNames() would have picked up the error. 
  */
  assert( pTab->azModuleArg && pTab->azModuleArg[0] );
  assert( pVtab );
#if 0
  if( pTab->pVtab==0 ){
    sqlite3ErrorMsg(pParse, "undefined module %s for table %s",
        pTab->azModuleArg[0], pTab->zName);
    return 0.0;
  }
#endif

  /* Set the aConstraint[].usable fields and initialize all 
  ** output variables to zero.
  **
  ** aConstraint[].usable is true for constraints where the right-hand
  ** side contains only references to tables to the left of the current
  ** table.  In other words, if the constraint is of the form:
  **
  **           column = expr
  **
  ** and we are evaluating a join, then the constraint on column is 
  ** only valid if all tables referenced in expr occur to the left
  ** of the table containing column.
  **
  ** The aConstraints[] array contains entries for all constraints
  ** on the current table.  That way we only have to compute it once
  ** even though we might try to pick the best index multiple times.
  ** For each attempt at picking an index, the order of tables in the
  ** join might be different so we have to recompute the usable flag
  ** each time.
  */
  pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint;
  pUsage = pIdxInfo->aConstraintUsage;
  for(i=0; i<pIdxInfo->nConstraint; i++, pIdxCons++){
    j = pIdxCons->iTermOffset;
    pTerm = &pWC->a[j];
    pIdxCons->usable =  (pTerm->prereqRight & notReady)==0;
  }
  memset(pUsage, 0, sizeof(pUsage[0])*pIdxInfo->nConstraint);
  if( pIdxInfo->needToFreeIdxStr ){
    sqlite3_free(pIdxInfo->idxStr);
  }
  pIdxInfo->idxStr = 0;
  pIdxInfo->idxNum = 0;
  pIdxInfo->needToFreeIdxStr = 0;
  pIdxInfo->orderByConsumed = 0;
  pIdxInfo->estimatedCost = SQLITE_BIG_DBL / 2.0;
  nOrderBy = pIdxInfo->nOrderBy;
  if( pIdxInfo->nOrderBy && !orderByUsable ){
    *(int*)&pIdxInfo->nOrderBy = 0;
  }

  (void)sqlite3SafetyOff(pParse->db);
  WHERETRACE(("xBestIndex for %s\n", pTab->zName));
  TRACE_IDX_INPUTS(pIdxInfo);
  rc = pVtab->pModule->xBestIndex(pVtab, pIdxInfo);
  TRACE_IDX_OUTPUTS(pIdxInfo);
  (void)sqlite3SafetyOn(pParse->db);

  if( rc!=SQLITE_OK ){
    if( rc==SQLITE_NOMEM ){
      pParse->db->mallocFailed = 1;
    }else if( !pVtab->zErrMsg ){
      sqlite3ErrorMsg(pParse, "%s", sqlite3ErrStr(rc));
    }else{
      sqlite3ErrorMsg(pParse, "%s", pVtab->zErrMsg);
    }
  }
  sqlite3DbFree(pParse->db, pVtab->zErrMsg);
  pVtab->zErrMsg = 0;

  for(i=0; i<pIdxInfo->nConstraint; i++){
    if( !pIdxInfo->aConstraint[i].usable && pUsage[i].argvIndex>0 ){
      sqlite3ErrorMsg(pParse, 
          "table %s: xBestIndex returned an invalid plan", pTab->zName);
      return 0.0;
    }
  }

  *(int*)&pIdxInfo->nOrderBy = nOrderBy;
  return pIdxInfo->estimatedCost;
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */

/*
** Find the best index for accessing a particular table.  Return a pointer
** to the index, flags that describe how the index should be used, the
** number of equality constraints, and the "cost" for this index.
**
** The lowest cost index wins.  The cost is an estimate of the amount of
** CPU and disk I/O need to process the request using the selected index.
** Factors that influence cost include:
**
**    *  The estimated number of rows that will be retrieved.  (The
**       fewer the better.)
**
**    *  Whether or not sorting must occur.
**
**    *  Whether or not there must be separate lookups in the
**       index and in the main table.
**
*/
static double bestIndex(
  Parse *pParse,              /* The parsing context */
  WhereClause *pWC,           /* The WHERE clause */
  struct SrcList_item *pSrc,  /* The FROM clause term to search */
  Bitmask notReady,           /* Mask of cursors that are not available */
  ExprList *pOrderBy,         /* The order by clause */
  Index **ppIndex,            /* Make *ppIndex point to the best index */
  int *pFlags,                /* Put flags describing this choice in *pFlags */
  int *pnEq                   /* Put the number of == or IN constraints here */
){
  WhereTerm *pTerm;
  Index *bestIdx = 0;         /* Index that gives the lowest cost */
  double lowestCost;          /* The cost of using bestIdx */
  int bestFlags = 0;          /* Flags associated with bestIdx */
  int bestNEq = 0;            /* Best value for nEq */
  int iCur = pSrc->iCursor;   /* The cursor of the table to be accessed */
  Index *pProbe;              /* An index we are evaluating */
  int rev;                    /* True to scan in reverse order */
  int flags;                  /* Flags associated with pProbe */
  int nEq;                    /* Number of == or IN constraints */
  int eqTermMask;             /* Mask of valid equality operators */
  double cost;                /* Cost of using pProbe */

  WHERETRACE(("bestIndex: tbl=%s notReady=%llx\n", pSrc->pTab->zName, notReady));
  lowestCost = SQLITE_BIG_DBL;
  pProbe = pSrc->pTab->pIndex;

  /* If the table has no indices and there are no terms in the where
  ** clause that refer to the ROWID, then we will never be able to do
  ** anything other than a full table scan on this table.  We might as
  ** well put it first in the join order.  That way, perhaps it can be
  ** referenced by other tables in the join.
  */
  if( pProbe==0 &&
     findTerm(pWC, iCur, -1, 0, WO_EQ|WO_IN|WO_LT|WO_LE|WO_GT|WO_GE,0)==0 &&
     (pOrderBy==0 || !sortableByRowid(iCur, pOrderBy, pWC->pMaskSet, &rev)) ){
    *pFlags = 0;
    *ppIndex = 0;
    *pnEq = 0;
    return 0.0;
  }

  /* Check for a rowid=EXPR or rowid IN (...) constraints
  */
  pTerm = findTerm(pWC, iCur, -1, notReady, WO_EQ|WO_IN, 0);
  if( pTerm ){
    Expr *pExpr;
    *ppIndex = 0;
    bestFlags = WHERE_ROWID_EQ;
    if( pTerm->eOperator & WO_EQ ){
      /* Rowid== is always the best pick.  Look no further.  Because only
      ** a single row is generated, output is always in sorted order */
      *pFlags = WHERE_ROWID_EQ | WHERE_UNIQUE;
      *pnEq = 1;
      WHERETRACE(("... best is rowid\n"));
      return 0.0;
    }else if( (pExpr = pTerm->pExpr)->pList!=0 ){
      /* Rowid IN (LIST): cost is NlogN where N is the number of list
      ** elements.  */
      lowestCost = pExpr->pList->nExpr;
      lowestCost *= estLog(lowestCost);
    }else{
      /* Rowid IN (SELECT): cost is NlogN where N is the number of rows
      ** in the result of the inner select.  We have no way to estimate
      ** that value so make a wild guess. */
      lowestCost = 200;
    }
    WHERETRACE(("... rowid IN cost: %.9g\n", lowestCost));
  }

  /* Estimate the cost of a table scan.  If we do not know how many
  ** entries are in the table, use 1 million as a guess.
  */
  cost = pProbe ? pProbe->aiRowEst[0] : 1000000;
  WHERETRACE(("... table scan base cost: %.9g\n", cost));
  flags = WHERE_ROWID_RANGE;

  /* Check for constraints on a range of rowids in a table scan.
  */
  pTerm = findTerm(pWC, iCur, -1, notReady, WO_LT|WO_LE|WO_GT|WO_GE, 0);
  if( pTerm ){
    if( findTerm(pWC, iCur, -1, notReady, WO_LT|WO_LE, 0) ){
      flags |= WHERE_TOP_LIMIT;
      cost /= 3;  /* Guess that rowid<EXPR eliminates two-thirds or rows */
    }
    if( findTerm(pWC, iCur, -1, notReady, WO_GT|WO_GE, 0) ){
      flags |= WHERE_BTM_LIMIT;
      cost /= 3;  /* Guess that rowid>EXPR eliminates two-thirds of rows */
    }
    WHERETRACE(("... rowid range reduces cost to %.9g\n", cost));
  }else{
    flags = 0;
  }

  /* If the table scan does not satisfy the ORDER BY clause, increase
  ** the cost by NlogN to cover the expense of sorting. */
  if( pOrderBy ){
    if( sortableByRowid(iCur, pOrderBy, pWC->pMaskSet, &rev) ){
      flags |= WHERE_ORDERBY|WHERE_ROWID_RANGE;
      if( rev ){
        flags |= WHERE_REVERSE;
      }
    }else{
      cost += cost*estLog(cost);
      WHERETRACE(("... sorting increases cost to %.9g\n", cost));
    }
  }
  if( cost<lowestCost ){
    lowestCost = cost;
    bestFlags = flags;
  }

  /* If the pSrc table is the right table of a LEFT JOIN then we may not
  ** use an index to satisfy IS NULL constraints on that table.  This is
  ** because columns might end up being NULL if the table does not match -
  ** a circumstance which the index cannot help us discover.  Ticket #2177.
  */
  if( (pSrc->jointype & JT_LEFT)!=0 ){
    eqTermMask = WO_EQ|WO_IN;
  }else{
    eqTermMask = WO_EQ|WO_IN|WO_ISNULL;
  }

  /* Look at each index.
  */
  for(; pProbe; pProbe=pProbe->pNext){
    int i;                       /* Loop counter */
    double inMultiplier = 1;

    WHERETRACE(("... index %s:\n", pProbe->zName));

    /* Count the number of columns in the index that are satisfied
    ** by x=EXPR constraints or x IN (...) constraints.
    */
    flags = 0;
    for(i=0; i<pProbe->nColumn; i++){
      int j = pProbe->aiColumn[i];
      pTerm = findTerm(pWC, iCur, j, notReady, eqTermMask, pProbe);
      if( pTerm==0 ) break;
      flags |= WHERE_COLUMN_EQ;
      if( pTerm->eOperator & WO_IN ){
        Expr *pExpr = pTerm->pExpr;
        flags |= WHERE_COLUMN_IN;
        if( pExpr->pSelect!=0 ){
          inMultiplier *= 25;
        }else if( ALWAYS(pExpr->pList) ){
          inMultiplier *= pExpr->pList->nExpr + 1;
        }
      }
    }
    cost = pProbe->aiRowEst[i] * inMultiplier * estLog(inMultiplier);
    nEq = i;
    if( pProbe->onError!=OE_None && (flags & WHERE_COLUMN_IN)==0
         && nEq==pProbe->nColumn ){
      flags |= WHERE_UNIQUE;
    }
    WHERETRACE(("...... nEq=%d inMult=%.9g cost=%.9g\n",nEq,inMultiplier,cost));

    /* Look for range constraints
    */
    if( nEq<pProbe->nColumn ){
      int j = pProbe->aiColumn[nEq];
      pTerm = findTerm(pWC, iCur, j, notReady, WO_LT|WO_LE|WO_GT|WO_GE, pProbe);
      if( pTerm ){
        flags |= WHERE_COLUMN_RANGE;
        if( findTerm(pWC, iCur, j, notReady, WO_LT|WO_LE, pProbe) ){
          flags |= WHERE_TOP_LIMIT;
          cost /= 3;
        }
        if( findTerm(pWC, iCur, j, notReady, WO_GT|WO_GE, pProbe) ){
          flags |= WHERE_BTM_LIMIT;
          cost /= 3;
        }
        WHERETRACE(("...... range reduces cost to %.9g\n", cost));
      }
    }

    /* Add the additional cost of sorting if that is a factor.
    */
    if( pOrderBy ){
      if( (flags & WHERE_COLUMN_IN)==0 &&
           isSortingIndex(pParse,pWC->pMaskSet,pProbe,iCur,pOrderBy,nEq,&rev) ){
        if( flags==0 ){
          flags = WHERE_COLUMN_RANGE;
        }
        flags |= WHERE_ORDERBY;
        if( rev ){
          flags |= WHERE_REVERSE;
        }
      }else{
        cost += cost*estLog(cost);
        WHERETRACE(("...... orderby increases cost to %.9g\n", cost));
      }
    }

    /* Check to see if we can get away with using just the index without
    ** ever reading the table.  If that is the case, then halve the
    ** cost of this index.
    */
    if( flags && pSrc->colUsed < (((Bitmask)1)<<(BMS-1)) ){
      Bitmask m = pSrc->colUsed;
      int j;
      for(j=0; j<pProbe->nColumn; j++){
        int x = pProbe->aiColumn[j];
        if( x<BMS-1 ){
          m &= ~(((Bitmask)1)<<x);
        }
      }
      if( m==0 ){
        flags |= WHERE_IDX_ONLY;
        cost /= 2;
        WHERETRACE(("...... idx-only reduces cost to %.9g\n", cost));
      }
    }

    /* If this index has achieved the lowest cost so far, then use it.
    */
    if( flags && cost < lowestCost ){
      bestIdx = pProbe;
      lowestCost = cost;
      bestFlags = flags;
      bestNEq = nEq;
    }
  }

  /* Report the best result
  */
  *ppIndex = bestIdx;
  WHERETRACE(("best index is %s, cost=%.9g, flags=%x, nEq=%d\n",
        bestIdx ? bestIdx->zName : "(none)", lowestCost, bestFlags, bestNEq));
  *pFlags = bestFlags | eqTermMask;
  *pnEq = bestNEq;
  return lowestCost;
}


/*
** Disable a term in the WHERE clause.  Except, do not disable the term
** if it controls a LEFT OUTER JOIN and it did not originate in the ON
** or USING clause of that join.
**
** Consider the term t2.z='ok' in the following queries:
**
**   (1)  SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x WHERE t2.z='ok'
**   (2)  SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x AND t2.z='ok'
**   (3)  SELECT * FROM t1, t2 WHERE t1.a=t2.x AND t2.z='ok'
**
** The t2.z='ok' is disabled in the in (2) because it originates
** in the ON clause.  The term is disabled in (3) because it is not part
** of a LEFT OUTER JOIN.  In (1), the term is not disabled.
**
** Disabling a term causes that term to not be tested in the inner loop
** of the join.  Disabling is an optimization.  When terms are satisfied
** by indices, we disable them to prevent redundant tests in the inner
** loop.  We would get the correct results if nothing were ever disabled,
** but joins might run a little slower.  The trick is to disable as much
** as we can without disabling too much.  If we disabled in (1), we'd get
** the wrong answer.  See ticket #813.
*/
static void disableTerm(WhereLevel *pLevel, WhereTerm *pTerm){
  if( pTerm
      && ALWAYS((pTerm->flags & TERM_CODED)==0)
      && (pLevel->iLeftJoin==0 || ExprHasProperty(pTerm->pExpr, EP_FromJoin))
  ){
    pTerm->flags |= TERM_CODED;
    if( pTerm->iParent>=0 ){
      WhereTerm *pOther = &pTerm->pWC->a[pTerm->iParent];
      if( (--pOther->nChild)==0 ){
        disableTerm(pLevel, pOther);
      }
    }
  }
}

/*
** Apply the affinities associated with the first n columns of index
** pIdx to the values in the n registers starting at base.
*/
static void codeApplyAffinity(Parse *pParse, int base, int n, Index *pIdx){
  if( n>0 ){
    Vdbe *v = pParse->pVdbe;
    assert( v!=0 );
    sqlite3VdbeAddOp2(v, OP_Affinity, base, n);
    sqlite3IndexAffinityStr(v, pIdx);
    sqlite3ExprCacheAffinityChange(pParse, base, n);
  }
}


/*
** Generate code for a single equality term of the WHERE clause.  An equality
** term can be either X=expr or X IN (...).   pTerm is the term to be 
** coded.
**
** The current value for the constraint is left in register iReg.
**
** For a constraint of the form X=expr, the expression is evaluated and its
** result is left on the stack.  For constraints of the form X IN (...)
** this routine sets up a loop that will iterate over all values of X.
*/
static int codeEqualityTerm(
  Parse *pParse,      /* The parsing context */
  WhereTerm *pTerm,   /* The term of the WHERE clause to be coded */
  WhereLevel *pLevel, /* When level of the FROM clause we are working on */
  int iTarget         /* Attempt to leave results in this register */
){
  Expr *pX = pTerm->pExpr;
  Vdbe *v = pParse->pVdbe;
  int iReg;                  /* Register holding results */

  if( iTarget<=0 ){
    iReg = iTarget = sqlite3GetTempReg(pParse);
  }
  if( pX->op==TK_EQ ){
    iReg = sqlite3ExprCodeTarget(pParse, pX->pRight, iTarget);
  }else if( pX->op==TK_ISNULL ){
    iReg = iTarget;
    sqlite3VdbeAddOp2(v, OP_Null, 0, iReg);
#ifndef SQLITE_OMIT_SUBQUERY
  }else{
    int eType;
    int iTab;
    struct InLoop *pIn;

    assert( pX->op==TK_IN );
    iReg = iTarget;
    eType = sqlite3FindInIndex(pParse, pX, 0);
    iTab = pX->iTable;
    sqlite3VdbeAddOp2(v, OP_Rewind, iTab, 0);
    VdbeComment((v, "%.*s", pX->span.n, pX->span.z));
    if( pLevel->nIn==0 ){
      pLevel->nxt = sqlite3VdbeMakeLabel(v);
    }
    pLevel->nIn++;
    pLevel->aInLoop = sqlite3DbReallocOrFree(pParse->db, pLevel->aInLoop,
                                    sizeof(pLevel->aInLoop[0])*pLevel->nIn);
    pIn = pLevel->aInLoop;
    if( pIn ){
      pIn += pLevel->nIn - 1;
      pIn->iCur = iTab;
      if( eType==IN_INDEX_ROWID ){
        pIn->topAddr = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iReg);
      }else{
        pIn->topAddr = sqlite3VdbeAddOp3(v, OP_Column, iTab, 0, iReg);
      }
      sqlite3VdbeAddOp1(v, OP_IsNull, iReg);
    }else{
      pLevel->nIn = 0;
    }
#endif
  }
  disableTerm(pLevel, pTerm);
  return iReg;
}

/*
** Generate code that will evaluate all == and IN constraints for an
** index.  The values for all constraints are left on the stack.
**
** For example, consider table t1(a,b,c,d,e,f) with index i1(a,b,c).
** Suppose the WHERE clause is this:  a==5 AND b IN (1,2,3) AND c>5 AND c<10
** The index has as many as three equality constraints, but in this
** example, the third "c" value is an inequality.  So only two 
** constraints are coded.  This routine will generate code to evaluate
** a==5 and b IN (1,2,3).  The current values for a and b will be left
** on the stack - a is the deepest and b the shallowest.
**
** In the example above nEq==2.  But this subroutine works for any value
** of nEq including 0.  If nEq==0, this routine is nearly a no-op.
** The only thing it does is allocate the pLevel->iMem memory cell.
**
** This routine always allocates at least one memory cell and puts
** the address of that memory cell in pLevel->iMem.  The code that
** calls this routine will use pLevel->iMem to store the termination
** key value of the loop.  If one or more IN operators appear, then
** this routine allocates an additional nEq memory cells for internal
** use.
*/
static int codeAllEqualityTerms(
  Parse *pParse,        /* Parsing context */
  WhereLevel *pLevel,   /* Which nested loop of the FROM we are coding */
  WhereClause *pWC,     /* The WHERE clause */
  Bitmask notReady,     /* Which parts of FROM have not yet been coded */
  int nExtraReg         /* Number of extra registers to allocate */
){
  int nEq = pLevel->nEq;        /* The number of == or IN constraints to code */
  Vdbe *v = pParse->pVdbe;      /* The virtual machine under construction */
  Index *pIdx = pLevel->pIdx;   /* The index being used for this loop */
  int iCur = pLevel->iTabCur;   /* The cursor of the table */
  WhereTerm *pTerm;             /* A single constraint term */
  int j;                        /* Loop counter */
  int regBase;                  /* Base register */

  /* Figure out how many memory cells we will need then allocate them.
  ** We always need at least one used to store the loop terminator
  ** value.  If there are IN operators we'll need one for each == or
  ** IN constraint.
  */
  pLevel->iMem = pParse->nMem + 1;
  regBase = pParse->nMem + 2;
  pParse->nMem += pLevel->nEq + 2 + nExtraReg;

  /* Evaluate the equality constraints
  */
  assert( pIdx->nColumn>=nEq );
  for(j=0; j<nEq; j++){
    int r1;
    int k = pIdx->aiColumn[j];
    pTerm = findTerm(pWC, iCur, k, notReady, pLevel->flags, pIdx);
    if( NEVER(pTerm==0) ) break;
    assert( (pTerm->flags & TERM_CODED)==0 );
    r1 = codeEqualityTerm(pParse, pTerm, pLevel, regBase+j);
    if( r1!=regBase+j ){
      sqlite3VdbeAddOp2(v, OP_SCopy, r1, regBase+j);
    }
    testcase( pTerm->eOperator & WO_ISNULL );
    testcase( pTerm->eOperator & WO_IN );
    if( (pTerm->eOperator & (WO_ISNULL|WO_IN))==0 ){
      sqlite3VdbeAddOp2(v, OP_IsNull, regBase+j, pLevel->brk);
    }
  }
  return regBase;
}

#if defined(SQLITE_TEST)
/*
** The following variable holds a text description of query plan generated
** by the most recent call to sqlite3WhereBegin().  Each call to WhereBegin
** overwrites the previous.  This information is used for testing and
** analysis only.
*/
char sqlite3_query_plan[BMS*2*40];  /* Text of the join */
static int nQPlan = 0;              /* Next free slow in _query_plan[] */

#endif /* SQLITE_TEST */


/*
** Free a WhereInfo structure
*/
static void whereInfoFree(WhereInfo *pWInfo){
  if( pWInfo ){
    int i;
    sqlite3 *db = pWInfo->pParse->db;
    for(i=0; i<pWInfo->nLevel; i++){
      sqlite3_index_info *pInfo = pWInfo->a[i].pIdxInfo;
      if( pInfo ){
        assert( pInfo->needToFreeIdxStr==0 );
        sqlite3DbFree(db, pInfo);
      }
    }
    sqlite3DbFree(db, pWInfo);
  }
}


/*
** Generate the beginning of the loop used for WHERE clause processing.
** The return value is a pointer to an opaque structure that contains
** information needed to terminate the loop.  Later, the calling routine
** should invoke sqlite3WhereEnd() with the return value of this function
** in order to complete the WHERE clause processing.
**
** If an error occurs, this routine returns NULL.
**
** The basic idea is to do a nested loop, one loop for each table in
** the FROM clause of a select.  (INSERT and UPDATE statements are the
** same as a SELECT with only a single table in the FROM clause.)  For
** example, if the SQL is this:
**
**       SELECT * FROM t1, t2, t3 WHERE ...;
**
** Then the code generated is conceptually like the following:
**
**      foreach row1 in t1 do       \    Code generated
**        foreach row2 in t2 do      |-- by sqlite3WhereBegin()
**          foreach row3 in t3 do   /
**            ...
**          end                     \    Code generated
**        end                        |-- by sqlite3WhereEnd()
**      end                         /
**
** Note that the loops might not be nested in the order in which they
** appear in the FROM clause if a different order is better able to make
** use of indices.  Note also that when the IN operator appears in
** the WHERE clause, it might result in additional nested loops for
** scanning through all values on the right-hand side of the IN.
**
** There are Btree cursors associated with each table.  t1 uses cursor
** number pTabList->a[0].iCursor.  t2 uses the cursor pTabList->a[1].iCursor.
** And so forth.  This routine generates code to open those VDBE cursors
** and sqlite3WhereEnd() generates the code to close them.
**
** The code that sqlite3WhereBegin() generates leaves the cursors named
** in pTabList pointing at their appropriate entries.  The [...] code
** can use OP_Column and OP_Rowid opcodes on these cursors to extract
** data from the various tables of the loop.
**
** If the WHERE clause is empty, the foreach loops must each scan their
** entire tables.  Thus a three-way join is an O(N^3) operation.  But if
** the tables have indices and there are terms in the WHERE clause that
** refer to those indices, a complete table scan can be avoided and the
** code will run much faster.  Most of the work of this routine is checking
** to see if there are indices that can be used to speed up the loop.
**
** Terms of the WHERE clause are also used to limit which rows actually
** make it to the "..." in the middle of the loop.  After each "foreach",
** terms of the WHERE clause that use only terms in that loop and outer
** loops are evaluated and if false a jump is made around all subsequent
** inner loops (or around the "..." if the test occurs within the inner-
** most loop)
**
** OUTER JOINS
**
** An outer join of tables t1 and t2 is conceptally coded as follows:
**
**    foreach row1 in t1 do
**      flag = 0
**      foreach row2 in t2 do
**        start:
**          ...
**          flag = 1
**      end
**      if flag==0 then
**        move the row2 cursor to a null row
**        goto start
**      fi
**    end
**
** ORDER BY CLAUSE PROCESSING
**
** *ppOrderBy is a pointer to the ORDER BY clause of a SELECT statement,
** if there is one.  If there is no ORDER BY clause or if this routine
** is called from an UPDATE or DELETE statement, then ppOrderBy is NULL.
**
** If an index can be used so that the natural output order of the table
** scan is correct for the ORDER BY clause, then that index is used and
** *ppOrderBy is set to NULL.  This is an optimization that prevents an
** unnecessary sort of the result set if an index appropriate for the
** ORDER BY clause already exists.
**
** If the where clause loops cannot be arranged to provide the correct
** output order, then the *ppOrderBy is unchanged.
*/
WhereInfo *sqlite3WhereBegin(
  Parse *pParse,        /* The parser context */
  SrcList *pTabList,    /* A list of all tables to be scanned */
  Expr *pWhere,         /* The WHERE clause */
  ExprList **ppOrderBy, /* An ORDER BY clause, or NULL */
  u8 wflags             /* One of the WHERE_* flags defined in sqliteInt.h */
){
  int i;                     /* Loop counter */
  WhereInfo *pWInfo;         /* Will become the return value of this function */
  Vdbe *v = pParse->pVdbe;   /* The virtual database engine */
  int brk, cont = 0;         /* Addresses used during code generation */
  Bitmask notReady;          /* Cursors that are not yet positioned */
  WhereTerm *pTerm;          /* A single term in the WHERE clause */
  ExprMaskSet maskSet;       /* The expression mask set */
  WhereClause wc;            /* The WHERE clause is divided into these terms */
  struct SrcList_item *pTabItem;  /* A single entry from pTabList */
  WhereLevel *pLevel;             /* A single level in the pWInfo list */
  int iFrom;                      /* First unused FROM clause element */
  int andFlags;              /* AND-ed combination of all wc.a[].flags */
  sqlite3 *db;               /* Database connection */
  ExprList *pOrderBy = 0;

  /* The number of tables in the FROM clause is limited by the number of
  ** bits in a Bitmask 
  */
  if( pTabList->nSrc>BMS ){
    sqlite3ErrorMsg(pParse, "at most %d tables in a join", BMS);
    return 0;
  }

  if( ppOrderBy ){
    pOrderBy = *ppOrderBy;
  }

  /* Split the WHERE clause into separate subexpressions where each
  ** subexpression is separated by an AND operator.
  */
  initMaskSet(&maskSet);
  whereClauseInit(&wc, pParse, &maskSet);
  sqlite3ExprCodeConstants(pParse, pWhere);
  whereSplit(&wc, pWhere, TK_AND);
    
  /* Allocate and initialize the WhereInfo structure that will become the
  ** return value.
  */
  db = pParse->db;
  pWInfo = sqlite3DbMallocZero(db,  
                      sizeof(WhereInfo) + pTabList->nSrc*sizeof(WhereLevel));
  if( db->mallocFailed ){
    goto whereBeginNoMem;
  }
  pWInfo->nLevel = pTabList->nSrc;
  pWInfo->pParse = pParse;
  pWInfo->pTabList = pTabList;
  pWInfo->iBreak = sqlite3VdbeMakeLabel(v);

  /* Special case: a WHERE clause that is constant.  Evaluate the
  ** expression and either jump over all of the code or fall thru.
  */
  if( pWhere && (pTabList->nSrc==0 || sqlite3ExprIsConstantNotJoin(pWhere)) ){
    sqlite3ExprIfFalse(pParse, pWhere, pWInfo->iBreak, SQLITE_JUMPIFNULL);
    pWhere = 0;
  }

  /* Assign a bit from the bitmask to every term in the FROM clause.
  **
  ** When assigning bitmask values to FROM clause cursors, it must be
  ** the case that if X is the bitmask for the N-th FROM clause term then
  ** the bitmask for all FROM clause terms to the left of the N-th term
  ** is (X-1).   An expression from the ON clause of a LEFT JOIN can use
  ** its Expr.iRightJoinTable value to find the bitmask of the right table
  ** of the join.  Subtracting one from the right table bitmask gives a
  ** bitmask for all tables to the left of the join.  Knowing the bitmask
  ** for all tables to the left of a left join is important.  Ticket #3015.
  */
  for(i=0; i<pTabList->nSrc; i++){
    createMask(&maskSet, pTabList->a[i].iCursor);
  }
#ifndef NDEBUG
  {
    Bitmask toTheLeft = 0;
    for(i=0; i<pTabList->nSrc; i++){
      Bitmask m = getMask(&maskSet, pTabList->a[i].iCursor);
      assert( (m-1)==toTheLeft );
      toTheLeft |= m;
    }
  }
#endif

  /* Analyze all of the subexpressions.  Note that exprAnalyze() might
  ** add new virtual terms onto the end of the WHERE clause.  We do not
  ** want to analyze these virtual terms, so start analyzing at the end
  ** and work forward so that the added virtual terms are never processed.
  */
  exprAnalyzeAll(pTabList, &wc);
  if( db->mallocFailed ){
    goto whereBeginNoMem;
  }

  /* Chose the best index to use for each table in the FROM clause.
  **
  ** This loop fills in the following fields:
  **
  **   pWInfo->a[].pIdx      The index to use for this level of the loop.
  **   pWInfo->a[].flags     WHERE_xxx flags associated with pIdx
  **   pWInfo->a[].nEq       The number of == and IN constraints
  **   pWInfo->a[].iFrom     When term of the FROM clause is being coded
  **   pWInfo->a[].iTabCur   The VDBE cursor for the database table
  **   pWInfo->a[].iIdxCur   The VDBE cursor for the index
  **
  ** This loop also figures out the nesting order of tables in the FROM
  ** clause.
  */
  notReady = ~(Bitmask)0;
  pTabItem = pTabList->a;
  pLevel = pWInfo->a;
  andFlags = ~0;
  WHERETRACE(("*** Optimizer Start ***\n"));
  for(i=iFrom=0, pLevel=pWInfo->a; i<pTabList->nSrc; i++, pLevel++){
    Index *pIdx;                /* Index for FROM table at pTabItem */
    int flags;                  /* Flags asssociated with pIdx */
    int nEq;                    /* Number of == or IN constraints */
    double cost;                /* The cost for pIdx */
    int j;                      /* For looping over FROM tables */
    Index *pBest = 0;           /* The best index seen so far */
    int bestFlags = 0;          /* Flags associated with pBest */
    int bestNEq = 0;            /* nEq associated with pBest */
    double lowestCost;          /* Cost of the pBest */
    int bestJ = 0;              /* The value of j */
    Bitmask m;                  /* Bitmask value for j or bestJ */
    int once = 0;               /* True when first table is seen */
    sqlite3_index_info *pIndex; /* Current virtual index */

    lowestCost = SQLITE_BIG_DBL;
    for(j=iFrom, pTabItem=&pTabList->a[j]; j<pTabList->nSrc; j++, pTabItem++){
      int doNotReorder;  /* True if this table should not be reordered */

      doNotReorder =  (pTabItem->jointype & (JT_LEFT|JT_CROSS))!=0;
      if( once && doNotReorder ) break;
      m = getMask(&maskSet, pTabItem->iCursor);
      if( (m & notReady)==0 ){
        if( j==iFrom ) iFrom++;
        continue;
      }
      assert( pTabItem->pTab );
#ifndef SQLITE_OMIT_VIRTUALTABLE
      if( IsVirtual(pTabItem->pTab) ){
        sqlite3_index_info **ppIdxInfo = &pWInfo->a[j].pIdxInfo;
        cost = bestVirtualIndex(pParse, &wc, pTabItem, notReady,
                                ppOrderBy ? *ppOrderBy : 0, i==0,
                                ppIdxInfo);
        flags = WHERE_VIRTUALTABLE;
        pIndex = *ppIdxInfo;
        if( pIndex && pIndex->orderByConsumed ){
          flags = WHERE_VIRTUALTABLE | WHERE_ORDERBY;
        }
        pIdx = 0;
        nEq = 0;
        if( (SQLITE_BIG_DBL/2.0)<cost ){
          /* The cost is not allowed to be larger than SQLITE_BIG_DBL (the
          ** inital value of lowestCost in this loop. If it is, then
          ** the (cost<lowestCost) test below will never be true and
          ** pLevel->pBestIdx never set.
          */ 
          cost = (SQLITE_BIG_DBL/2.0);
        }
      }else 
#endif
      {
        cost = bestIndex(pParse, &wc, pTabItem, notReady,
                         (i==0 && ppOrderBy) ? *ppOrderBy : 0,
                         &pIdx, &flags, &nEq);
        pIndex = 0;
      }
      if( cost<lowestCost ){
        once = 1;
        lowestCost = cost;
        pBest = pIdx;
        bestFlags = flags;
        bestNEq = nEq;
        bestJ = j;
        pLevel->pBestIdx = pIndex;
      }
      if( doNotReorder ) break;
    }
    WHERETRACE(("*** Optimizer selects table %d for loop %d\n", bestJ,
           pLevel-pWInfo->a));
    if( (bestFlags & WHERE_ORDERBY)!=0 ){
      *ppOrderBy = 0;
    }
    andFlags &= bestFlags;
    pLevel->flags = bestFlags;
    pLevel->pIdx = pBest;
    pLevel->nEq = bestNEq;
    pLevel->aInLoop = 0;
    pLevel->nIn = 0;
    if( pBest ){
      pLevel->iIdxCur = pParse->nTab++;
    }else{
      pLevel->iIdxCur = -1;
    }
    notReady &= ~getMask(&maskSet, pTabList->a[bestJ].iCursor);
    pLevel->iFrom = bestJ;
  }
  WHERETRACE(("*** Optimizer Finished ***\n"));

  /* If the total query only selects a single row, then the ORDER BY
  ** clause is irrelevant.
  */
  if( (andFlags & WHERE_UNIQUE)!=0 && ppOrderBy ){
    *ppOrderBy = 0;
  }

  /* If the caller is an UPDATE or DELETE statement that is requesting
  ** to use a one-pass algorithm, determine if this is appropriate.
  ** The one-pass algorithm only works if the WHERE clause constraints
  ** the statement to update a single row.
  */
  assert( (wflags & WHERE_ONEPASS_DESIRED)==0 || pWInfo->nLevel==1 );
  if( (wflags & WHERE_ONEPASS_DESIRED)!=0 && (andFlags & WHERE_UNIQUE)!=0 ){
    pWInfo->okOnePass = 1;
    pWInfo->a[0].flags &= ~WHERE_IDX_ONLY;
  }

  /* Open all tables in the pTabList and any indices selected for
  ** searching those tables.
  */
  sqlite3CodeVerifySchema(pParse, -1); /* Insert the cookie verifier Goto */
  for(i=0, pLevel=pWInfo->a; i<pTabList->nSrc; i++, pLevel++){
    Table *pTab;     /* Table to open */
    Index *pIx;      /* Index used to access pTab (if any) */
    int iDb;         /* Index of database containing table/index */
    int iIdxCur = pLevel->iIdxCur;

#ifndef SQLITE_OMIT_EXPLAIN
    if( pParse->explain==2 ){
      char *zMsg;
      struct SrcList_item *pItem = &pTabList->a[pLevel->iFrom];
      zMsg = sqlite3MPrintf(db, "TABLE %s", pItem->zName);
      if( pItem->zAlias ){
        zMsg = sqlite3MAppendf(db, zMsg, "%s AS %s", zMsg, pItem->zAlias);
      }
      if( (pIx = pLevel->pIdx)!=0 ){
        zMsg = sqlite3MAppendf(db, zMsg, "%s WITH INDEX %s", zMsg, pIx->zName);
      }else if( pLevel->flags & (WHERE_ROWID_EQ|WHERE_ROWID_RANGE) ){
        zMsg = sqlite3MAppendf(db, zMsg, "%s USING PRIMARY KEY", zMsg);
      }
#ifndef SQLITE_OMIT_VIRTUALTABLE
      else if( pLevel->pBestIdx ){
        sqlite3_index_info *pBestIdx = pLevel->pBestIdx;
        zMsg = sqlite3MAppendf(db, zMsg, "%s VIRTUAL TABLE INDEX %d:%s", zMsg,
                    pBestIdx->idxNum, pBestIdx->idxStr);
      }
#endif
      if( pLevel->flags & WHERE_ORDERBY ){
        zMsg = sqlite3MAppendf(db, zMsg, "%s ORDER BY", zMsg);
      }
      sqlite3VdbeAddOp4(v, OP_Explain, i, pLevel->iFrom, 0, zMsg, P4_DYNAMIC);
    }
#endif /* SQLITE_OMIT_EXPLAIN */
    pTabItem = &pTabList->a[pLevel->iFrom];
    pTab = pTabItem->pTab;
    iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
    if( pTab->isEphem || pTab->pSelect ) continue;
#ifndef SQLITE_OMIT_VIRTUALTABLE
    if( pLevel->pBestIdx ){
      int iCur = pTabItem->iCursor;
      sqlite3VdbeAddOp4(v, OP_VOpen, iCur, 0, 0,
                        (const char*)pTab->pVtab, P4_VTAB);
    }else
#endif
    if( (pLevel->flags & WHERE_IDX_ONLY)==0 ){
      int op = pWInfo->okOnePass ? OP_OpenWrite : OP_OpenRead;
      sqlite3OpenTable(pParse, pTabItem->iCursor, iDb, pTab, op);
      if( !pWInfo->okOnePass && pTab->nCol<(sizeof(Bitmask)*8) ){
        Bitmask b = pTabItem->colUsed;
        int n = 0;
        for(; b; b=b>>1, n++){}
        sqlite3VdbeChangeP2(v, sqlite3VdbeCurrentAddr(v)-2, n);
        assert( n<=pTab->nCol );
      }
    }else{
      sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
    }
    pLevel->iTabCur = pTabItem->iCursor;
    if( (pIx = pLevel->pIdx)!=0 ){
      KeyInfo *pKey = sqlite3IndexKeyinfo(pParse, pIx);
      assert( pIx->pSchema==pTab->pSchema );
      sqlite3VdbeAddOp2(v, OP_SetNumColumns, 0, pIx->nColumn+1);
      sqlite3VdbeAddOp4(v, OP_OpenRead, iIdxCur, pIx->tnum, iDb,
                        (char*)pKey, P4_KEYINFO_HANDOFF);
      VdbeComment((v, "%s", pIx->zName));
    }
    sqlite3CodeVerifySchema(pParse, iDb);
  }
  pWInfo->iTop = sqlite3VdbeCurrentAddr(v);

  /* Generate the code to do the search.  Each iteration of the for
  ** loop below generates code for a single nested loop of the VM
  ** program.
  */
  notReady = ~(Bitmask)0;
  for(i=0, pLevel=pWInfo->a; i<pTabList->nSrc; i++, pLevel++){
    int j;
    int iCur = pTabItem->iCursor;  /* The VDBE cursor for the table */
    Index *pIdx;       /* The index we will be using */
    int nxt;           /* Where to jump to continue with the next IN case */
    int iIdxCur;       /* The VDBE cursor for the index */
    int omitTable;     /* True if we use the index only */
    int bRev;          /* True if we need to scan in reverse order */

    pTabItem = &pTabList->a[pLevel->iFrom];
    iCur = pTabItem->iCursor;
    pIdx = pLevel->pIdx;
    iIdxCur = pLevel->iIdxCur;
    bRev = (pLevel->flags & WHERE_REVERSE)!=0;
    omitTable = (pLevel->flags & WHERE_IDX_ONLY)!=0;

    /* Create labels for the "break" and "continue" instructions
    ** for the current loop.  Jump to brk to break out of a loop.
    ** Jump to cont to go immediately to the next iteration of the
    ** loop.
    **
    ** When there is an IN operator, we also have a "nxt" label that
    ** means to continue with the next IN value combination.  When
    ** there are no IN operators in the constraints, the "nxt" label
    ** is the same as "brk".
    */
    brk = pLevel->brk = pLevel->nxt = sqlite3VdbeMakeLabel(v);
    cont = pLevel->cont = sqlite3VdbeMakeLabel(v);

    /* If this is the right table of a LEFT OUTER JOIN, allocate and
    ** initialize a memory cell that records if this table matches any
    ** row of the left table of the join.
    */
    if( pLevel->iFrom>0 && (pTabItem[0].jointype & JT_LEFT)!=0 ){
      pLevel->iLeftJoin = ++pParse->nMem;
      sqlite3VdbeAddOp2(v, OP_Integer, 0, pLevel->iLeftJoin);
      VdbeComment((v, "init LEFT JOIN no-match flag"));
    }

#ifndef SQLITE_OMIT_VIRTUALTABLE
    if( pLevel->pBestIdx ){
      /* Case 0:  The table is a virtual-table.  Use the VFilter and VNext
      **          to access the data.
      */
      int j;
      int iReg;   /* P3 Value for OP_VFilter */
      sqlite3_index_info *pBestIdx = pLevel->pBestIdx;
      int nConstraint = pBestIdx->nConstraint;
      struct sqlite3_index_constraint_usage *aUsage =
                                                  pBestIdx->aConstraintUsage;
      const struct sqlite3_index_constraint *aConstraint =
                                                  pBestIdx->aConstraint;

      iReg = sqlite3GetTempRange(pParse, nConstraint+2);
      pParse->disableColCache++;
      for(j=1; j<=nConstraint; j++){
        int k;
        for(k=0; k<nConstraint; k++){
          if( aUsage[k].argvIndex==j ){
            int iTerm = aConstraint[k].iTermOffset;
            assert( pParse->disableColCache );
            sqlite3ExprCode(pParse, wc.a[iTerm].pExpr->pRight, iReg+j+1);
            break;
          }
        }
        if( k==nConstraint ) break;
      }
      assert( pParse->disableColCache );
      pParse->disableColCache--;
      sqlite3VdbeAddOp2(v, OP_Integer, pBestIdx->idxNum, iReg);
      sqlite3VdbeAddOp2(v, OP_Integer, j-1, iReg+1);
      sqlite3VdbeAddOp4(v, OP_VFilter, iCur, brk, iReg, pBestIdx->idxStr,
                        pBestIdx->needToFreeIdxStr ? P4_MPRINTF : P4_STATIC);
      sqlite3ReleaseTempRange(pParse, iReg, nConstraint+2);
      pBestIdx->needToFreeIdxStr = 0;
      for(j=0; j<nConstraint; j++){
        if( aUsage[j].omit ){
          int iTerm = aConstraint[j].iTermOffset;
          disableTerm(pLevel, &wc.a[iTerm]);
        }
      }
      pLevel->op = OP_VNext;
      pLevel->p1 = iCur;
      pLevel->p2 = sqlite3VdbeCurrentAddr(v);
    }else
#endif /* SQLITE_OMIT_VIRTUALTABLE */

    if( pLevel->flags & WHERE_ROWID_EQ ){
      /* Case 1:  We can directly reference a single row using an
      **          equality comparison against the ROWID field.  Or
      **          we reference multiple rows using a "rowid IN (...)"
      **          construct.
      */
      int r1;
      pTerm = findTerm(&wc, iCur, -1, notReady, WO_EQ|WO_IN, 0);
      assert( pTerm!=0 );
      assert( pTerm->pExpr!=0 );
      assert( pTerm->leftCursor==iCur );
      assert( omitTable==0 );
      r1 = codeEqualityTerm(pParse, pTerm, pLevel, 0);
      nxt = pLevel->nxt;
      sqlite3VdbeAddOp2(v, OP_MustBeInt, r1, nxt);
      sqlite3VdbeAddOp3(v, OP_NotExists, iCur, nxt, r1);
      VdbeComment((v, "pk"));
      pLevel->op = OP_Noop;
    }else if( pLevel->flags & WHERE_ROWID_RANGE ){
      /* Case 2:  We have an inequality comparison against the ROWID field.
      */
      int testOp = OP_Noop;
      int start;
      WhereTerm *pStart, *pEnd;

      assert( omitTable==0 );
      pStart = findTerm(&wc, iCur, -1, notReady, WO_GT|WO_GE, 0);
      pEnd = findTerm(&wc, iCur, -1, notReady, WO_LT|WO_LE, 0);
      if( bRev ){
        pTerm = pStart;
        pStart = pEnd;
        pEnd = pTerm;
      }
      if( pStart ){
        Expr *pX;
        int r1, regFree1;
        pX = pStart->pExpr;
        assert( pX!=0 );
        assert( pStart->leftCursor==iCur );
        r1 = sqlite3ExprCodeTemp(pParse, pX->pRight, &regFree1);
        sqlite3VdbeAddOp3(v, OP_ForceInt, r1, brk, 
                             pX->op==TK_LE || pX->op==TK_GT);
        sqlite3VdbeAddOp3(v, bRev ? OP_MoveLt : OP_MoveGe, iCur, brk, r1);
        VdbeComment((v, "pk"));
        sqlite3ReleaseTempReg(pParse, regFree1);
        disableTerm(pLevel, pStart);
      }else{
        sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iCur, brk);
      }
      if( pEnd ){
        Expr *pX;
        pX = pEnd->pExpr;
        assert( pX!=0 );
        assert( pEnd->leftCursor==iCur );
        pLevel->iMem = ++pParse->nMem;
        sqlite3ExprCode(pParse, pX->pRight, pLevel->iMem);
        if( pX->op==TK_LT || pX->op==TK_GT ){
          testOp = bRev ? OP_Le : OP_Ge;
        }else{
          testOp = bRev ? OP_Lt : OP_Gt;
        }
        disableTerm(pLevel, pEnd);
      }
      start = sqlite3VdbeCurrentAddr(v);
      pLevel->op = bRev ? OP_Prev : OP_Next;
      pLevel->p1 = iCur;
      pLevel->p2 = start;
      if( testOp!=OP_Noop ){
        int r1 = sqlite3GetTempReg(pParse);
        sqlite3VdbeAddOp2(v, OP_Rowid, iCur, r1);
        /* sqlite3VdbeAddOp2(v, OP_SCopy, pLevel->iMem, 0); */
        sqlite3VdbeAddOp3(v, testOp, pLevel->iMem, brk, r1);
        sqlite3VdbeChangeP5(v, SQLITE_AFF_NUMERIC | SQLITE_JUMPIFNULL);
        sqlite3ReleaseTempReg(pParse, r1);
      }
    }else if( pLevel->flags & (WHERE_COLUMN_RANGE|WHERE_COLUMN_EQ) ){
      /* Case 3: A scan using an index.
      **
      **         The WHERE clause may contain zero or more equality 
      **         terms ("==" or "IN" operators) that refer to the N
      **         left-most columns of the index. It may also contain
      **         inequality constraints (>, <, >= or <=) on the indexed
      **         column that immediately follows the N equalities. Only 
      **         the right-most column can be an inequality - the rest must
      **         use the "==" and "IN" operators. For example, if the 
      **         index is on (x,y,z), then the following clauses are all 
      **         optimized:
      **
      **            x=5
      **            x=5 AND y=10
      **            x=5 AND y<10
      **            x=5 AND y>5 AND y<10
      **            x=5 AND y=5 AND z<=10
      **
      **         The z<10 term of the following cannot be used, only
      **         the x=5 term:
      **
      **            x=5 AND z<10
      **
      **         N may be zero if there are inequality constraints.
      **         If there are no inequality constraints, then N is at
      **         least one.
      **
      **         This case is also used when there are no WHERE clause
      **         constraints but an index is selected anyway, in order
      **         to force the output order to conform to an ORDER BY.
      */  
      int aStartOp[] = {
        0,
        0,
        OP_Rewind,           /* 2: (!start_constraints && startEq &&  !bRev) */
        OP_Last,             /* 3: (!start_constraints && startEq &&   bRev) */
        OP_MoveGt,           /* 4: (start_constraints  && !startEq && !bRev) */
        OP_MoveLt,           /* 5: (start_constraints  && !startEq &&  bRev) */
        OP_MoveGe,           /* 6: (start_constraints  &&  startEq && !bRev) */
        OP_MoveLe            /* 7: (start_constraints  &&  startEq &&  bRev) */
      };
      int aEndOp[] = {
        OP_Noop,             /* 0: (!end_constraints) */
        OP_IdxGE,            /* 1: (end_constraints && !bRev) */
        OP_IdxLT             /* 2: (end_constraints && bRev) */
      };
      int nEq = pLevel->nEq;
      int isMinQuery = 0;          /* If this is an optimized SELECT min(x).. */
      int regBase;                 /* Base register holding constraint values */
      int r1;                      /* Temp register */
      WhereTerm *pRangeStart = 0;  /* Inequality constraint at range start */
      WhereTerm *pRangeEnd = 0;    /* Inequality constraint at range end */
      int startEq;                 /* True if range start uses ==, >= or <= */
      int endEq;                   /* True if range end uses ==, >= or <= */
      int start_constraints;       /* Start of range is constrained */
      int k = pIdx->aiColumn[nEq]; /* Column for inequality constraints */
      int nConstraint;             /* Number of constraint terms */
      int op;

      /* Generate code to evaluate all constraint terms using == or IN
      ** and store the values of those terms in an array of registers
      ** starting at regBase.
      */
      regBase = codeAllEqualityTerms(pParse, pLevel, &wc, notReady, 2);
      nxt = pLevel->nxt;

      /* If this loop satisfies a sort order (pOrderBy) request that 
      ** was passed to this function to implement a "SELECT min(x) ..." 
      ** query, then the caller will only allow the loop to run for
      ** a single iteration. This means that the first row returned
      ** should not have a NULL value stored in 'x'. If column 'x' is
      ** the first one after the nEq equality constraints in the index,
      ** this requires some special handling.
      */
      if( (wflags&WHERE_ORDERBY_MIN)!=0
       && (pLevel->flags&WHERE_ORDERBY)
       && (pIdx->nColumn>nEq)
      ){
        assert( pOrderBy->nExpr==1 );
        assert( pOrderBy->a[0].pExpr->iColumn==pIdx->aiColumn[nEq] );
        isMinQuery = 1;
      }

      /* Find any inequality constraint terms for the start and end 
      ** of the range. 
      */
      if( pLevel->flags & WHERE_TOP_LIMIT ){
        pRangeEnd = findTerm(&wc, iCur, k, notReady, (WO_LT|WO_LE), pIdx);
      }
      if( pLevel->flags & WHERE_BTM_LIMIT ){
        pRangeStart = findTerm(&wc, iCur, k, notReady, (WO_GT|WO_GE), pIdx);
      }

      /* If we are doing a reverse order scan on an ascending index, or
      ** a forward order scan on a descending index, interchange the 
      ** start and end terms (pRangeStart and pRangeEnd).
      */
      if( bRev==(pIdx->aSortOrder[nEq]==SQLITE_SO_ASC) ){
        SWAP(WhereTerm *, pRangeEnd, pRangeStart);
      }

      testcase( pRangeStart && pRangeStart->eOperator & WO_LE );
      testcase( pRangeStart && pRangeStart->eOperator & WO_GE );
      testcase( pRangeEnd && pRangeEnd->eOperator & WO_LE );
      testcase( pRangeEnd && pRangeEnd->eOperator & WO_GE );
      startEq = !pRangeStart || pRangeStart->eOperator & (WO_LE|WO_GE);
      endEq =   !pRangeEnd || pRangeEnd->eOperator & (WO_LE|WO_GE);
      start_constraints = pRangeStart || nEq>0;

      /* Seek the index cursor to the start of the range. */
      nConstraint = nEq;
      if( pRangeStart ){
        int dcc = pParse->disableColCache;
        if( pRangeEnd ){
          pParse->disableColCache++;
        }
        sqlite3ExprCode(pParse, pRangeStart->pExpr->pRight, regBase+nEq);
        pParse->disableColCache = dcc;
        sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, nxt);
        nConstraint++;
      }else if( isMinQuery ){
        sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq);
        nConstraint++;
        startEq = 0;
        start_constraints = 1;
      }
      codeApplyAffinity(pParse, regBase, nConstraint, pIdx);
      op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev];
      assert( op!=0 );
      testcase( op==OP_Rewind );
      testcase( op==OP_Last );
      testcase( op==OP_MoveGt );
      testcase( op==OP_MoveGe );
      testcase( op==OP_MoveLe );
      testcase( op==OP_MoveLt );
      sqlite3VdbeAddOp4(v, op, iIdxCur, nxt, regBase, 
                        SQLITE_INT_TO_PTR(nConstraint), P4_INT32);

      /* Load the value for the inequality constraint at the end of the
      ** range (if any).
      */
      nConstraint = nEq;
      if( pRangeEnd ){
        sqlite3ExprCode(pParse, pRangeEnd->pExpr->pRight, regBase+nEq);
        sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, nxt);
        codeApplyAffinity(pParse, regBase, nEq+1, pIdx);
        nConstraint++;
      }

      /* Top of the loop body */
      pLevel->p2 = sqlite3VdbeCurrentAddr(v);

      /* Check if the index cursor is past the end of the range. */
      op = aEndOp[(pRangeEnd || nEq) * (1 + bRev)];
      testcase( op==OP_Noop );
      testcase( op==OP_IdxGE );
      testcase( op==OP_IdxLT );
      sqlite3VdbeAddOp4(v, op, iIdxCur, nxt, regBase,
                        SQLITE_INT_TO_PTR(nConstraint), P4_INT32);
      sqlite3VdbeChangeP5(v, endEq!=bRev);

      /* If there are inequality constraints, check that the value
      ** of the table column that the inequality contrains is not NULL.
      ** If it is, jump to the next iteration of the loop.
      */
      r1 = sqlite3GetTempReg(pParse);
      testcase( pLevel->flags & WHERE_BTM_LIMIT );
      testcase( pLevel->flags & WHERE_TOP_LIMIT );
      if( pLevel->flags & (WHERE_BTM_LIMIT|WHERE_TOP_LIMIT) ){
        sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, nEq, r1);
        sqlite3VdbeAddOp2(v, OP_IsNull, r1, cont);
      }

      /* Seek the table cursor, if required */
      if( !omitTable ){
        sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, r1);
        sqlite3VdbeAddOp3(v, OP_MoveGe, iCur, 0, r1);  /* Deferred seek */
      }
      sqlite3ReleaseTempReg(pParse, r1);

      /* Record the instruction used to terminate the loop. Disable 
      ** WHERE clause terms made redundant by the index range scan.
      */
      pLevel->op = bRev ? OP_Prev : OP_Next;
      pLevel->p1 = iIdxCur;
      disableTerm(pLevel, pRangeStart);
      disableTerm(pLevel, pRangeEnd);
    }else{
      /* Case 4:  There is no usable index.  We must do a complete
      **          scan of the entire table.
      */
      assert( omitTable==0 );
      assert( bRev==0 );
      pLevel->op = OP_Next;
      pLevel->p1 = iCur;
      pLevel->p2 = 1 + sqlite3VdbeAddOp2(v, OP_Rewind, iCur, brk);
    }
    notReady &= ~getMask(&maskSet, iCur);

    /* Insert code to test every subexpression that can be completely
    ** computed using the current set of tables.
    */
    for(pTerm=wc.a, j=wc.nTerm; j>0; j--, pTerm++){
      Expr *pE;
      testcase( pTerm->flags & TERM_VIRTUAL );
      testcase( pTerm->flags & TERM_CODED );
      if( pTerm->flags & (TERM_VIRTUAL|TERM_CODED) ) continue;
      if( (pTerm->prereqAll & notReady)!=0 ) continue;
      pE = pTerm->pExpr;
      assert( pE!=0 );
      if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){
        continue;
      }
      sqlite3ExprIfFalse(pParse, pE, cont, SQLITE_JUMPIFNULL);
      pTerm->flags |= TERM_CODED;
    }

    /* For a LEFT OUTER JOIN, generate code that will record the fact that
    ** at least one row of the right table has matched the left table.  
    */
    if( pLevel->iLeftJoin ){
      pLevel->top = sqlite3VdbeCurrentAddr(v);
      sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin);
      VdbeComment((v, "record LEFT JOIN hit"));
      sqlite3ExprClearColumnCache(pParse, pLevel->iTabCur);
      sqlite3ExprClearColumnCache(pParse, pLevel->iIdxCur);
      for(pTerm=wc.a, j=0; j<wc.nTerm; j++, pTerm++){
        testcase( pTerm->flags & TERM_VIRTUAL );
        testcase( pTerm->flags & TERM_CODED );
        if( pTerm->flags & (TERM_VIRTUAL|TERM_CODED) ) continue;
        if( (pTerm->prereqAll & notReady)!=0 ) continue;
        assert( pTerm->pExpr );
        sqlite3ExprIfFalse(pParse, pTerm->pExpr, cont, SQLITE_JUMPIFNULL);
        pTerm->flags |= TERM_CODED;
      }
    }
  }

#ifdef SQLITE_TEST  /* For testing and debugging use only */
  /* Record in the query plan information about the current table
  ** and the index used to access it (if any).  If the table itself
  ** is not used, its name is just '{}'.  If no index is used
  ** the index is listed as "{}".  If the primary key is used the
  ** index name is '*'.
  */
  for(i=0; i<pTabList->nSrc; i++){
    char *z;
    int n;
    pLevel = &pWInfo->a[i];
    pTabItem = &pTabList->a[pLevel->iFrom];
    z = pTabItem->zAlias;
    if( z==0 ) z = pTabItem->pTab->zName;
    n = strlen(z);
    if( n+nQPlan < sizeof(sqlite3_query_plan)-10 ){
      if( pLevel->flags & WHERE_IDX_ONLY ){
        memcpy(&sqlite3_query_plan[nQPlan], "{}", 2);
        nQPlan += 2;
      }else{
        memcpy(&sqlite3_query_plan[nQPlan], z, n);
        nQPlan += n;
      }
      sqlite3_query_plan[nQPlan++] = ' ';
    }
    testcase( pLevel->flags & WHERE_ROWID_EQ );
    testcase( pLevel->flags & WHERE_ROWID_RANGE );
    if( pLevel->flags & (WHERE_ROWID_EQ|WHERE_ROWID_RANGE) ){
      memcpy(&sqlite3_query_plan[nQPlan], "* ", 2);
      nQPlan += 2;
    }else if( pLevel->pIdx==0 ){
      memcpy(&sqlite3_query_plan[nQPlan], "{} ", 3);
      nQPlan += 3;
    }else{
      n = strlen(pLevel->pIdx->zName);
      if( n+nQPlan < sizeof(sqlite3_query_plan)-2 ){
        memcpy(&sqlite3_query_plan[nQPlan], pLevel->pIdx->zName, n);
        nQPlan += n;
        sqlite3_query_plan[nQPlan++] = ' ';
      }
    }
  }
  while( nQPlan>0 && sqlite3_query_plan[nQPlan-1]==' ' ){
    sqlite3_query_plan[--nQPlan] = 0;
  }
  sqlite3_query_plan[nQPlan] = 0;
  nQPlan = 0;
#endif /* SQLITE_TEST // Testing and debugging use only */

  /* Record the continuation address in the WhereInfo structure.  Then
  ** clean up and return.
  */
  pWInfo->iContinue = cont;
  whereClauseClear(&wc);
  return pWInfo;

  /* Jump here if malloc fails */
whereBeginNoMem:
  whereClauseClear(&wc);
  whereInfoFree(pWInfo);
  return 0;
}

/*
** Generate the end of the WHERE loop.  See comments on 
** sqlite3WhereBegin() for additional information.
*/
void sqlite3WhereEnd(WhereInfo *pWInfo){
  Parse *pParse = pWInfo->pParse;
  Vdbe *v = pParse->pVdbe;
  int i;
  WhereLevel *pLevel;
  SrcList *pTabList = pWInfo->pTabList;
  sqlite3 *db = pParse->db;

  /* Generate loop termination code.
  */
  sqlite3ExprClearColumnCache(pParse, -1);
  for(i=pTabList->nSrc-1; i>=0; i--){
    pLevel = &pWInfo->a[i];
    sqlite3VdbeResolveLabel(v, pLevel->cont);
    if( pLevel->op!=OP_Noop ){
      sqlite3VdbeAddOp2(v, pLevel->op, pLevel->p1, pLevel->p2);
    }
    if( pLevel->nIn ){
      struct InLoop *pIn;
      int j;
      sqlite3VdbeResolveLabel(v, pLevel->nxt);
      for(j=pLevel->nIn, pIn=&pLevel->aInLoop[j-1]; j>0; j--, pIn--){
        sqlite3VdbeJumpHere(v, pIn->topAddr+1);
        sqlite3VdbeAddOp2(v, OP_Next, pIn->iCur, pIn->topAddr);
        sqlite3VdbeJumpHere(v, pIn->topAddr-1);
      }
      sqlite3DbFree(db, pLevel->aInLoop);
    }
    sqlite3VdbeResolveLabel(v, pLevel->brk);
    if( pLevel->iLeftJoin ){
      int addr;
      addr = sqlite3VdbeAddOp1(v, OP_IfPos, pLevel->iLeftJoin);
      sqlite3VdbeAddOp1(v, OP_NullRow, pTabList->a[i].iCursor);
      if( pLevel->iIdxCur>=0 ){
        sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iIdxCur);
      }
      sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->top);
      sqlite3VdbeJumpHere(v, addr);
    }
  }

  /* The "break" point is here, just past the end of the outer loop.
  ** Set it.
  */
  sqlite3VdbeResolveLabel(v, pWInfo->iBreak);

  /* Close all of the cursors that were opened by sqlite3WhereBegin.
  */
  for(i=0, pLevel=pWInfo->a; i<pTabList->nSrc; i++, pLevel++){
    struct SrcList_item *pTabItem = &pTabList->a[pLevel->iFrom];
    Table *pTab = pTabItem->pTab;
    assert( pTab!=0 );
    if( pTab->isEphem || pTab->pSelect ) continue;
    if( !pWInfo->okOnePass && (pLevel->flags & WHERE_IDX_ONLY)==0 ){
      sqlite3VdbeAddOp1(v, OP_Close, pTabItem->iCursor);
    }
    if( pLevel->pIdx!=0 ){
      sqlite3VdbeAddOp1(v, OP_Close, pLevel->iIdxCur);
    }

    /* If this scan uses an index, make code substitutions to read data
    ** from the index in preference to the table. Sometimes, this means
    ** the table need never be read from. This is a performance boost,
    ** as the vdbe level waits until the table is read before actually
    ** seeking the table cursor to the record corresponding to the current
    ** position in the index.
    ** 
    ** Calls to the code generator in between sqlite3WhereBegin and
    ** sqlite3WhereEnd will have created code that references the table
    ** directly.  This loop scans all that code looking for opcodes
    ** that reference the table and converts them into opcodes that
    ** reference the index.
    */
    if( pLevel->pIdx ){
      int k, j, last;
      VdbeOp *pOp;
      Index *pIdx = pLevel->pIdx;
      int useIndexOnly = pLevel->flags & WHERE_IDX_ONLY;

      assert( pIdx!=0 );
      pOp = sqlite3VdbeGetOp(v, pWInfo->iTop);
      last = sqlite3VdbeCurrentAddr(v);
      for(k=pWInfo->iTop; k<last; k++, pOp++){
        if( pOp->p1!=pLevel->iTabCur ) continue;
        if( pOp->opcode==OP_Column ){
          for(j=0; j<pIdx->nColumn; j++){
            if( pOp->p2==pIdx->aiColumn[j] ){
              pOp->p2 = j;
              pOp->p1 = pLevel->iIdxCur;
              break;
            }
          }
          assert(!useIndexOnly || j<pIdx->nColumn);
        }else if( pOp->opcode==OP_Rowid ){
          pOp->p1 = pLevel->iIdxCur;
          pOp->opcode = OP_IdxRowid;
        }else if( pOp->opcode==OP_NullRow && useIndexOnly ){
          pOp->opcode = OP_Noop;
        }
      }
    }
  }

  /* Final cleanup
  */
  whereInfoFree(pWInfo);
  return;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Added SQLite.Interop/src/contrib/extension-functions.c.































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
/*
This library will provide common mathematical and string functions in
SQL queries using the operating system math library.  It includes the
following functions:

Math: acos, asin, atan, atn2, atan2, acosh, asinh, atanh, difference,
degrees, radians, cos, sin, tan, cot, cosh, sinh, tanh, coth, exp,
log, log10, power, sign, sqrt, square, ceil, floor, pi.

String: replicate, charindex, leftstr, rightstr, ltrim, rtrim, trim,
replace, reverse, proper, padl, padr, padc, strfilter.

Aggregate: stdev, variance, mode, median, lower_quartile,
upper_quartile.

The string functions ltrim, rtrim, trim, replace are included in
recent versions of SQLite and so by default do not build.

Instructions:
1) Compile with
   Linux:
     gcc -fPIC -lm -shared extension-functions.c -o libsqlitefunctions.so
   Mac OS X:
     gcc -fno-common -dynamiclib extension-functions.c -o libsqlitefunctions.dylib
   (You may need to add flags
    -I /opt/local/include/ -L/opt/local/lib -lsqlite3
    if your sqlite3 is installed from Mac ports, or
    -I /sw/include/ -L/sw/lib -lsqlite3
    if installed with Fink.)
2) In your application, call sqlite3_enable_load_extension(db,1) to
   allow loading external libraries.  Then load the library libsqlitefunctions
   using sqlite3_load_extension; the third argument should be 0.
   See https://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions.
3) Use, for example:
   SELECT cos(radians(inclination)) FROM satsum WHERE satnum = 25544;

Note: Loading extensions is by default prohibited as a
security measure; see "Security Considerations" in
https://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions.
If the sqlite3 program and library are built this
way, you cannot use these functions from the program, you
must write your own program using the sqlite3 API, and call
sqlite3_enable_load_extension as described above.

If the program is built so that loading extensions is permitted,
the following will work:
sqlite> SELECT load_extension('./libsqlitefunctions.so');
sqlite> select cos(radians(45));
0.707106781186548

Alterations:
The instructions are for Linux or Mac OS X; users of other OSes may
need to modify this procedure.  In particular, if your math library
lacks one or more of the needed trig or log functions, comment out the
appropriate HAVE_ #define at the top of file.  If you do not
wish to make a loadable module, comment out the define for
COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE.  If you are using a
version of SQLite without the trim functions and replace, comment out
the HAVE_TRIM #define.

Liam Healy

History:
2008-06-13 Change to instructions to indicate use of the math library
and that program might work.
2007-10-01 Minor clarification to instructions.
2007-09-29 Compilation as loadable module is optional with
COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE.
2007-09-28 Use sqlite3_extension_init and macros
SQLITE_EXTENSION_INIT1, SQLITE_EXTENSION_INIT2, so that it works with
sqlite3_load_extension.  Thanks to Eric Higashino and Joe Wilson.
New instructions for Mac compilation.
2007-09-17 With help from Joe Wilson and Nuno Luca, made use of
external interfaces so that compilation is no longer dependent on
SQLite source code.  Merged source, header, and README into a single
file.  Added casts so that Mac will compile without warnings (unsigned
and signed char).
2007-09-05 Included some definitions from sqlite 3.3.13 so that this
will continue to work in newer versions of sqlite.  Completed
description of functions available.
2007-03-27 Revised description.
2007-03-23 Small cleanup and a bug fix on the code.  This was mainly
letting errno flag errors encountered in the math library and checking
the result, rather than pre-checking.  This fixes a bug in power that
would cause an error if any non-positive number was raised to any
power.
2007-02-07 posted by Mikey C to sqlite mailing list.
Original code 2006 June 05 by relicoder.

*/

/* #include "config.h" */
#if defined(_WIN32)
#  include <windows.h>
#endif

/* #define COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE */

/* NOTE: More functions are available with MSVC 2013. */
#if !defined(_WIN32) || (defined(_MSC_VER) && _MSC_VER >= 1800)
#  define HAVE_ACOSH		1
#  define HAVE_ASINH		1
#  define HAVE_ATANH		1
#  define HAVE_ISBLANK		1
#endif

#define HAVE_SINH		1
#define HAVE_COSH		1
#define HAVE_TANH		1
#define HAVE_LOG10		1
#define SQLITE_SOUNDEX		1

/* LMH 2007-03-25 if SQLite has trim functions */
#define HAVE_TRIM		1

#ifdef COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE
#include "../core/sqlite3ext.h"
SQLITE_EXTENSION_INIT1
#else
#include "../core/sqlite3.h"
#endif

#include <ctype.h>
/* relicoder */
#include <math.h>
#include <string.h>
#include <stdio.h>

#if !defined(_WIN32_WCE) || defined(HAVE_ERRNO_H)
#  include <errno.h>		/* LMH 2007-03-25 */
#elif defined(_WIN32)
int errno;
#  define strerror(x)		""
#else
#  include <errno.h>
#endif

#include <stdlib.h>
#include <assert.h>

#ifndef _MAP_H_
#define _MAP_H_

#if defined(_WIN32)
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed int int16_t;
typedef unsigned int uint16_t;
typedef signed long int int32_t;
typedef unsigned long int uint32_t;
typedef signed long long int int64_t;
typedef unsigned long long int uint64_t;
#else
#  include <stdint.h>
#endif

/*
** Simple binary tree implementation to use in median, mode and quartile calculations
** Tree is not necessarily balanced. That would require something like red&black trees of AVL
*/

typedef int(*cmp_func)(const void *, const void *);
typedef void(*map_iterator)(void*, int64_t, void*);

typedef struct node{
  struct node *l;
  struct node *r;
  void* data;
  int64_t count;
} node;

typedef struct map{
  node *base;
  cmp_func cmp;
  short free;
} map;

/*
** creates a map given a comparison function
*/
map map_make(cmp_func cmp);

/*
** inserts the element e into map m
*/
void map_insert(map *m, void *e);

/*
** executes function iter over all elements in the map, in key increasing order
*/
void map_iterate(map *m, map_iterator iter, void* p);

/*
** frees all memory used by a map
*/
void map_destroy(map *m);

/*
** compares 2 integers
** to use with map_make
*/
int int_cmp(const void *a, const void *b);

/*
** compares 2 doubles
** to use with map_make
*/
int double_cmp(const void *a, const void *b);

#endif /* _MAP_H_ */

#if !defined(SQLITE_CORE)
typedef uint8_t         u8;
/* typedef uint16_t        u16; */
typedef int64_t         i64;
#endif

static char *sqlite3StrDup( const char *z ) {
    char *res = sqlite3_malloc( strlen(z)+1 );
    return strcpy( res, z );
}

/*
** These are copied verbatim from fun.c so as to not have the names exported
*/

/* LMH from sqlite3 3.3.13 */
/*
** This table maps from the first byte of a UTF-8 character to the number
** of trailing bytes expected. A value '4' indicates that the table key
** is not a legal first byte for a UTF-8 character.
*/
static const u8 xtra_utf8_bytes[256]  = {
/* 0xxxxxxx */
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,     0, 0, 0, 0, 0, 0, 0, 0,

/* 10wwwwww */
4, 4, 4, 4, 4, 4, 4, 4,     4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4,     4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4,     4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4,     4, 4, 4, 4, 4, 4, 4, 4,

/* 110yyyyy */
1, 1, 1, 1, 1, 1, 1, 1,     1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1,     1, 1, 1, 1, 1, 1, 1, 1,

/* 1110zzzz */
2, 2, 2, 2, 2, 2, 2, 2,     2, 2, 2, 2, 2, 2, 2, 2,

/* 11110yyy */
3, 3, 3, 3, 3, 3, 3, 3,     4, 4, 4, 4, 4, 4, 4, 4,
};


/*
** This table maps from the number of trailing bytes in a UTF-8 character
** to an integer constant that is effectively calculated for each character
** read by a naive implementation of a UTF-8 character reader. The code
** in the READ_UTF8 macro explains things best.
*/
static const int xtra_utf8_bits[] =  {
  0,
  12416,          /* (0xC0 << 6) + (0x80) */
  925824,         /* (0xE0 << 12) + (0x80 << 6) + (0x80) */
  63447168        /* (0xF0 << 18) + (0x80 << 12) + (0x80 << 6) + 0x80 */
};

/*
** If a UTF-8 character contains N bytes extra bytes (N bytes follow
** the initial byte so that the total character length is N+1) then
** masking the character with utf8_mask[N] must produce a non-zero
** result.  Otherwise, we have an (illegal) overlong encoding.
*/
static const int utf_mask[] = {
  0x00000000,
  0xffffff80,
  0xfffff800,
  0xffff0000,
};

/* LMH salvaged from sqlite3 3.3.13 source code src/utf.c */
#define OLD_READ_UTF8(zIn, c) { \
  int xtra;                                            \
  c = *(zIn)++;                                        \
  xtra = xtra_utf8_bytes[c];                           \
  switch( xtra ){                                      \
    case 4: c = (int)0xFFFD; break;                    \
    case 3: c = (c<<6) + *(zIn)++;                     \
    case 2: c = (c<<6) + *(zIn)++;                     \
    case 1: c = (c<<6) + *(zIn)++;                     \
    c -= xtra_utf8_bits[xtra];                         \
    if( (utf_mask[xtra]&c)==0                          \
        || (c&0xFFFFF800)==0xD800                      \
        || (c&0xFFFFFFFE)==0xFFFE ){  c = 0xFFFD; }    \
  }                                                    \
}

static int sqlite3ReadUtf8(const unsigned char *z){
  int c;
  OLD_READ_UTF8(z, c);
  return c;
}

#define SKIP_UTF8(zIn) {                               \
  zIn += (xtra_utf8_bytes[*(u8 *)zIn] + 1);            \
}

/*
** X is a pointer to the first byte of a UTF-8 character.  Increment
** X so that it points to the next character.  This only works right
** if X points to a well-formed UTF-8 string.
*/
#define sqliteNextChar(X)  while( (0xc0&*++(X))==0x80 ){}
#define sqliteCharVal(X)   sqlite3ReadUtf8(X)

/*
** This is a macro that facilitates writting wrappers for math.h functions
** it creates code for a function to use in SQlite that gets one numeric input
** and returns a floating point value.
**
** Could have been implemented using pointers to functions but this way it's inline
** and thus more efficient. Lower * ranking though...
**
** Parameters:
** name:      function name to de defined (eg: sinFunc)
** function:  function defined in math.h to wrap (eg: sin)
** domain:    boolean condition that CAN'T happen in terms of the input parameter rVal
**            (eg: rval<0 for sqrt)
*/
/* LMH 2007-03-25 Changed to use errno and remove domain; no pre-checking for errors. */
#define GEN_MATH_WRAP_DOUBLE_1(name, function) \
static void name(sqlite3_context *context, int argc, sqlite3_value **argv){\
  double rVal = 0.0, val;\
  assert( argc==1 );\
  switch( sqlite3_value_type(argv[0]) ){\
    case SQLITE_NULL: {\
      sqlite3_result_null(context);\
      break;\
    }\
    default: {\
      rVal = sqlite3_value_double(argv[0]);\
      errno = 0;\
      val = function(rVal);\
      if (errno == 0) {\
        sqlite3_result_double(context, val);\
      } else {\
        sqlite3_result_error(context, strerror(errno), errno);\
      }\
      break;\
    }\
  }\
}\


/*
** Example of GEN_MATH_WRAP_DOUBLE_1 usage
** this creates function sqrtFunc to wrap the math.h standard function sqrt(x)=x^0.5
*/
GEN_MATH_WRAP_DOUBLE_1(sqrtFunc, sqrt)

/* trignometric functions */
GEN_MATH_WRAP_DOUBLE_1(acosFunc, acos)
GEN_MATH_WRAP_DOUBLE_1(asinFunc, asin)
GEN_MATH_WRAP_DOUBLE_1(atanFunc, atan)

/*
** Many of systems don't have inverse hyperbolic trig functions so this will emulate
** them on those systems in terms of log and sqrt (formulas are too trivial to demand
** written proof here)
*/

#ifndef HAVE_ACOSH
static double acosh(double x){
  return log(x + sqrt(x*x - 1.0));
}
#endif

GEN_MATH_WRAP_DOUBLE_1(acoshFunc, acosh)

#ifndef HAVE_ASINH
static double asinh(double x){
  return log(x + sqrt(x*x + 1.0));
}
#endif

GEN_MATH_WRAP_DOUBLE_1(asinhFunc, asinh)

#ifndef HAVE_ATANH
static double atanh(double x){
  return (1.0/2.0)*log((1+x)/(1-x)) ;
}
#endif

GEN_MATH_WRAP_DOUBLE_1(atanhFunc, atanh)

/*
** math.h doesn't require cot (cotangent) so it's defined here
*/
static double cot(double x){
  return 1.0/tan(x);
}

GEN_MATH_WRAP_DOUBLE_1(sinFunc, sin)
GEN_MATH_WRAP_DOUBLE_1(cosFunc, cos)
GEN_MATH_WRAP_DOUBLE_1(tanFunc, tan)
GEN_MATH_WRAP_DOUBLE_1(cotFunc, cot)

static double coth(double x){
  return 1.0/tanh(x);
}

/*
** Many systems don't have hyperbolic trigonometric functions so this will emulate
** them on those systems directly from the definition in terms of exp
*/
#ifndef HAVE_SINH
static double sinh(double x){
  return (exp(x)-exp(-x))/2.0;
}
#endif

GEN_MATH_WRAP_DOUBLE_1(sinhFunc, sinh)

#ifndef HAVE_COSH
static double cosh(double x){
  return (exp(x)+exp(-x))/2.0;
}
#endif

GEN_MATH_WRAP_DOUBLE_1(coshFunc, cosh)

#ifndef HAVE_TANH
static double tanh(double x){
  return sinh(x)/cosh(x);
}
#endif

GEN_MATH_WRAP_DOUBLE_1(tanhFunc, tanh)

GEN_MATH_WRAP_DOUBLE_1(cothFunc, coth)

/*
** Some systems lack log in base 10. This will emulate it
*/

#ifndef HAVE_LOG10
static double log10(double x){
  static double l10 = -1.0;
  if( l10<0.0 ){
    l10 = log(10.0);
  }
  return log(x)/l10;
}
#endif

GEN_MATH_WRAP_DOUBLE_1(oldLogFunc, log)
GEN_MATH_WRAP_DOUBLE_1(log10Func, log10)
GEN_MATH_WRAP_DOUBLE_1(expFunc, exp)

/*
** Fallback for systems where math.h doesn't define M_PI
*/
#undef M_PI
#ifndef M_PI
/*
** static double PI = acos(-1.0);
** #define M_PI (PI)
*/
#define M_PI 3.14159265358979323846
#endif

/* Convert Degrees into Radians */
static double deg2rad(double x){
  return x*M_PI/180.0;
}

/* Convert Radians into Degrees */
static double rad2deg(double x){
  return 180.0*x/M_PI;
}

GEN_MATH_WRAP_DOUBLE_1(rad2degFunc, rad2deg)
GEN_MATH_WRAP_DOUBLE_1(deg2radFunc, deg2rad)

/* constant function that returns the value of PI=3.1415... */
static void oldPiFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  sqlite3_result_double(context, M_PI);
}

/*
** Implements the sqrt function, it has the peculiarity of returning an integer when the
** the argument is an integer.
** Since SQLite isn't strongly typed (almost untyped actually) this is a bit pedantic
*/
static void squareFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  i64 iVal = 0;
  double rVal = 0.0;
  assert( argc==1 );
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_INTEGER: {
      iVal = sqlite3_value_int64(argv[0]);
      sqlite3_result_int64(context, iVal*iVal);
      break;
    }
    case SQLITE_NULL: {
      sqlite3_result_null(context);
      break;
    }
    default: {
      rVal = sqlite3_value_double(argv[0]);
      sqlite3_result_double(context, rVal*rVal);
      break;
    }
  }
}

/*
** Wraps the pow math.h function
** When both the base and the exponent are integers the result should be integer
** (see sqrt just before this). Here the result is always double
*/
/* LMH 2007-03-25 Changed to use errno; no pre-checking for errors.  Also removes
  but that was present in the pre-checking that called sqlite3_result_error on
  a non-positive first argument, which is not always an error. */
static void powerFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  double r1 = 0.0;
  double r2 = 0.0;
  double val;

  assert( argc==2 );

  if( sqlite3_value_type(argv[0]) == SQLITE_NULL || sqlite3_value_type(argv[1]) == SQLITE_NULL ){
    sqlite3_result_null(context);
  }else{
    r1 = sqlite3_value_double(argv[0]);
    r2 = sqlite3_value_double(argv[1]);
    errno = 0;
    val = pow(r1,r2);
    if (errno == 0) {
      sqlite3_result_double(context, val);
    } else {
      sqlite3_result_error(context, strerror(errno), errno);
    }
  }
}

/*
** atan2 wrapper
*/
static void atn2Func(sqlite3_context *context, int argc, sqlite3_value **argv){
  double r1 = 0.0;
  double r2 = 0.0;

  assert( argc==2 );

  if( sqlite3_value_type(argv[0]) == SQLITE_NULL || sqlite3_value_type(argv[1]) == SQLITE_NULL ){
    sqlite3_result_null(context);
  }else{
    r1 = sqlite3_value_double(argv[0]);
    r2 = sqlite3_value_double(argv[1]);
    sqlite3_result_double(context, atan2(r1,r2));
  }
}

/*
** Implementation of the sign() function
** return one of 3 possibilities +1,0 or -1 when the argument is respectively
** positive, 0 or negative.
** When the argument is NULL the result is also NULL (completly conventional)
*/
static void oldSignFunc(sqlite3_context *context,int argc,sqlite3_value **argv){
  double rVal=0.0;
  i64 iVal=0;
  assert( argc==1 );
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_INTEGER: {
      iVal = sqlite3_value_int64(argv[0]);
      iVal = ( iVal > 0) ? 1: ( iVal < 0 ) ? -1: 0;
      sqlite3_result_int64(context, iVal);
      break;
    }
    case SQLITE_NULL: {
      sqlite3_result_null(context);
      break;
    }
    default: {
 /* 2nd change below. Line for abs was: if( rVal<0 ) rVal = rVal * -1.0;  */

      rVal = sqlite3_value_double(argv[0]);
      rVal = ( rVal > 0) ? 1: ( rVal < 0 ) ? -1: 0;
      sqlite3_result_double(context, rVal);
      break;
    }
  }
}


/*
** smallest integer value not less than argument
*/
static void ceilFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  double rVal=0.0;
  assert( argc==1 );
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_INTEGER: {
      i64 iVal = sqlite3_value_int64(argv[0]);
      sqlite3_result_int64(context, iVal);
      break;
    }
    case SQLITE_NULL: {
      sqlite3_result_null(context);
      break;
    }
    default: {
      rVal = sqlite3_value_double(argv[0]);
      sqlite3_result_int64(context, (i64) ceil(rVal));
      break;
    }
  }
}

/*
** largest integer value not greater than argument
*/
static void floorFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  double rVal=0.0;
  assert( argc==1 );
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_INTEGER: {
      i64 iVal = sqlite3_value_int64(argv[0]);
      sqlite3_result_int64(context, iVal);
      break;
    }
    case SQLITE_NULL: {
      sqlite3_result_null(context);
      break;
    }
    default: {
      rVal = sqlite3_value_double(argv[0]);
      sqlite3_result_int64(context, (i64) floor(rVal));
      break;
    }
  }
}

/*
** Given a string (s) in the first argument and an integer (n) in the second returns the
** string that constains s contatenated n times
*/
static void replicateFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  unsigned char *z;        /* input string */
  unsigned char *zo;       /* result string */
  i64 iCount;              /* times to repeat */
  i64 nLen;                /* length of the input string (no multibyte considerations) */
  i64 nTLen;               /* length of the result string (no multibyte considerations) */
  i64 i=0;

  if( argc!=2 || SQLITE_NULL==sqlite3_value_type(argv[0]) )
    return;

  iCount = sqlite3_value_int64(argv[1]);

  if( iCount<0 ){
    sqlite3_result_error(context, "domain error", -1);
  }else{

    nLen  = sqlite3_value_bytes(argv[0]);
    nTLen = nLen*iCount;
    z=sqlite3_malloc(nTLen+1);
    zo=sqlite3_malloc(nLen+1);
    if (!z || !zo){
      sqlite3_result_error_nomem(context);
      if (z) sqlite3_free(z);
      if (zo) sqlite3_free(zo);
      return;
    }
    strcpy((char*)zo, (char*)sqlite3_value_text(argv[0]));

    for(i=0; i<iCount; ++i){
      strcpy((char*)(z+i*nLen), (char*)zo);
    }

    sqlite3_result_text(context, (char*)z, -1, SQLITE_TRANSIENT);
    sqlite3_free(z);
    sqlite3_free(zo);
  }
}

/*
** Some systems (win32 among others) don't have an isblank function, this will emulate it.
** This function is not UFT-8 safe since it only analyses a byte character.
*/
#ifndef HAVE_ISBLANK
int isblank(char c){
  return( ' '==c || '\t'==c );
}
#endif

static void properFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  const unsigned char *z;     /* input string */
  unsigned char *zo;          /* output string */
  unsigned char *zt;          /* iterator */
  char r;
  int c=1;

  assert( argc!=1);
  if( SQLITE_NULL==sqlite3_value_type(argv[0]) ){
    sqlite3_result_null(context);
    return;
  }

  z = sqlite3_value_text(argv[0]);
  zo = (unsigned char *)sqlite3StrDup((char *) z);
  if (!zo) {
    sqlite3_result_error_nomem(context);
    return;
  }
  zt = zo;

  while( (r = *(z++))!=0 ){
    if( isblank(r) ){
      c=1;
    }else{
      if( c==1 ){
        r = toupper(r);
      }else{
        r = tolower(r);
      }
      c=0;
    }
    *(zt++) = r;
  }
  *zt = '\0';

  sqlite3_result_text(context, (char*)zo, -1, SQLITE_TRANSIENT);
  sqlite3_free(zo);
}

/*
** given an input string (s) and an integer (n) adds spaces at the begining of  s
** until it has a length of n characters.
** When s has a length >=n it's a NOP
** padl(NULL) = NULL
*/
static void padlFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  i64 ilen;          /* length to pad to */
  i64 zl;            /* length of the input string (UTF-8 chars) */
  int i = 0;
  const char *zi;    /* input string */
  char *zo;          /* output string */
  char *zt;

  assert( argc==2 );

  if( sqlite3_value_type(argv[0]) == SQLITE_NULL ){
    sqlite3_result_null(context);
  }else{
    zi = (char *)sqlite3_value_text(argv[0]);
    ilen = sqlite3_value_int64(argv[1]);
    /* check domain */
    if(ilen<0){
      sqlite3_result_error(context, "domain error", -1);
      return;
    }
    zl = sqlite3Utf8CharLen(zi, -1);
    if( zl>=ilen ){
      /* string is longer than the requested pad length, return the same string (dup it) */
      zo = sqlite3StrDup(zi);
      if (!zo){
        sqlite3_result_error_nomem(context);
        return;
      }
      sqlite3_result_text(context, zo, -1, SQLITE_TRANSIENT);
    }else{
      zo = sqlite3_malloc(strlen(zi)+ilen-zl+1);
      if (!zo){
        sqlite3_result_error_nomem(context);
        return;
      }
      zt = zo;
      for(i=1; i+zl<=ilen; ++i){
        *(zt++)=' ';
      }
      /* no need to take UTF-8 into consideration here */
      strcpy(zt,zi);
    }
    sqlite3_result_text(context, zo, -1, SQLITE_TRANSIENT);
    sqlite3_free(zo);
  }
}

/*
** given an input string (s) and an integer (n) appends spaces at the end of  s
** until it has a length of n characters.
** When s has a length >=n it's a NOP
** padl(NULL) = NULL
*/
static void padrFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  i64 ilen;          /* length to pad to */
  i64 zl;            /* length of the input string (UTF-8 chars) */
  i64 zll;           /* length of the input string (bytes) */
  int i = 0;
  const char *zi;    /* input string */
  char *zo;          /* output string */
  char *zt;

  assert( argc==2 );

  if( sqlite3_value_type(argv[0]) == SQLITE_NULL ){
    sqlite3_result_null(context);
  }else{
    zi = (char *)sqlite3_value_text(argv[0]);
    ilen = sqlite3_value_int64(argv[1]);
    /* check domain */
    if(ilen<0){
      sqlite3_result_error(context, "domain error", -1);
      return;
    }
    zl = sqlite3Utf8CharLen(zi, -1);
    if( zl>=ilen ){
      /* string is longer than the requested pad length, return the same string (dup it) */
      zo = sqlite3StrDup(zi);
      if (!zo){
        sqlite3_result_error_nomem(context);
        return;
      }
      sqlite3_result_text(context, zo, -1, SQLITE_TRANSIENT);
    }else{
      zll = strlen(zi);
      zo = sqlite3_malloc(zll+ilen-zl+1);
      if (!zo){
        sqlite3_result_error_nomem(context);
        return;
      }
      zt = strcpy(zo,zi)+zll;
      for(i=1; i+zl<=ilen; ++i){
        *(zt++) = ' ';
      }
      *zt = '\0';
    }
    sqlite3_result_text(context, zo, -1, SQLITE_TRANSIENT);
    sqlite3_free(zo);
  }
}

/*
** given an input string (s) and an integer (n) appends spaces at the end of  s
** and adds spaces at the begining of s until it has a length of n characters.
** Tries to add has many characters at the left as at the right.
** When s has a length >=n it's a NOP
** padl(NULL) = NULL
*/
static void padcFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  i64 ilen;           /* length to pad to */
  i64 zl;             /* length of the input string (UTF-8 chars) */
  i64 zll;            /* length of the input string (bytes) */
  int i = 0;
  const char *zi;     /* input string */
  char *zo;           /* output string */
  char *zt;

  assert( argc==2 );

  if( sqlite3_value_type(argv[0]) == SQLITE_NULL ){
    sqlite3_result_null(context);
  }else{
    zi = (char *)sqlite3_value_text(argv[0]);
    ilen = sqlite3_value_int64(argv[1]);
    /* check domain */
    if(ilen<0){
      sqlite3_result_error(context, "domain error", -1);
      return;
    }
    zl = sqlite3Utf8CharLen(zi, -1);
    if( zl>=ilen ){
      /* string is longer than the requested pad length, return the same string (dup it) */
      zo = sqlite3StrDup(zi);
      if (!zo){
        sqlite3_result_error_nomem(context);
        return;
      }
      sqlite3_result_text(context, zo, -1, SQLITE_TRANSIENT);
    }else{
      zll = strlen(zi);
      zo = sqlite3_malloc(zll+ilen-zl+1);
      if (!zo){
        sqlite3_result_error_nomem(context);
        return;
      }
      zt = zo;
      for(i=1; 2*i+zl<=ilen; ++i){
        *(zt++) = ' ';
      }
      strcpy(zt, zi);
      zt+=zll;
      for(; i+zl<=ilen; ++i){
        *(zt++) = ' ';
      }
      *zt = '\0';
    }
    sqlite3_result_text(context, zo, -1, SQLITE_TRANSIENT);
    sqlite3_free(zo);
  }
}

/*
** given 2 string (s1,s2) returns the string s1 with the characters NOT in s2 removed
** assumes strings are UTF-8 encoded
*/
static void strfilterFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  const char *zi1;        /* first parameter string (searched string) */
  const char *zi2;        /* second parameter string (vcontains valid characters) */
  const char *z1;
  const char *z21;
  const char *z22;
  char *zo;               /* output string */
  char *zot;
  int c1 = 0;
  int c2 = 0;

  assert( argc==2 );

  if( sqlite3_value_type(argv[0]) == SQLITE_NULL || sqlite3_value_type(argv[1]) == SQLITE_NULL ){
    sqlite3_result_null(context);
  }else{
    zi1 = (char *)sqlite3_value_text(argv[0]);
    zi2 = (char *)sqlite3_value_text(argv[1]);
    /*
    ** maybe I could allocate less, but that would imply 2 passes, rather waste
    ** (possibly) some memory
    */
    zo = sqlite3_malloc(strlen(zi1)+1);
    if (!zo){
      sqlite3_result_error_nomem(context);
      return;
    }
    zot = zo;
    z1 = zi1;
    while( (c1=sqliteCharVal((unsigned char *)z1))!=0 ){
      z21=zi2;
      while( (c2=sqliteCharVal((unsigned char *)z21))!=0 && c2!=c1 ){
        sqliteNextChar(z21);
      }
      if( c2!=0){
        z22=z21;
        sqliteNextChar(z22);
        strncpy(zot, z21, z22-z21);
        zot+=z22-z21;
      }
      sqliteNextChar(z1);
    }
    *zot = '\0';

    sqlite3_result_text(context, zo, -1, SQLITE_TRANSIENT);
    sqlite3_free(zo);
  }
}

/*
** Given a string z1, retutns the (0 based) index of it's first occurence
** in z2 after the first s characters.
** Returns -1 when there isn't a match.
** updates p to point to the character where the match occured.
** This is an auxiliary function.
*/
static int _substr(const char* z1, const char* z2, int s, CollSeq *pColl, const char** p){
  int c = 0;
  int rVal=-1;
  const char* zt1;
  const char* zt2;
  int c1,c2;

  if( '\0'==*z1 ){
    return -1;
  }

  while( (sqliteCharVal((unsigned char *)z2) != 0) && (c++)<s){
    sqliteNextChar(z2);
  }

  c = 0;
  while( (sqliteCharVal((unsigned char *)z2)) != 0 ){
    zt1 = z1;
    zt2 = z2;

    do{
      c1 = sqliteCharVal((unsigned char *)zt1);
      c2 = sqliteCharVal((unsigned char *)zt2);
      if (pColl->enc == SQLITE_UTF8){
        if (pColl->xCmp(pColl->pUser, 1, zt1, 1, zt2) == 0) {
          c1 = c2;
        }
        else {
          c1 = (c1) ? 1 : 0;
          c2 = (c2) ? 2 : 0;
        }
      }
      /* TODO:  Maybe try and convert the chars to UTF16 and run them thru the collating sequence? */
      sqliteNextChar(zt1);
      sqliteNextChar(zt2);
    }while( c1 == c2 && c1 != 0 && c2 != 0 );

    if( c1 == 0 ){
      rVal = c;
      break;
    }

    sqliteNextChar(z2);
    ++c;
  }
  if(p){
    *p=z2;
  }
  return rVal >=0 ? rVal+s : rVal;
}

/*
** given 2 input strings (s1,s2) and an integer (n) searches from the nth character
** for the string s1. Returns the position where the match occured.
** Characters are counted from 1.
** 0 is returned when no match occurs.
*/

static void charindexFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  const u8 *z1;          /* s1 string */
  u8 *z2;                /* s2 string */
  int s=0;
  int rVal=0;
#if SQLITE_VERSION_NUMBER >= 3008007
  CollSeq *pColl = sqlite3GetFuncCollSeq(context);
#else
  CollSeq *pColl = context->pColl;
#endif

  assert( argc==3 ||argc==2);

  if( SQLITE_NULL==sqlite3_value_type(argv[0]) || SQLITE_NULL==sqlite3_value_type(argv[1])){
    sqlite3_result_null(context);
    return;
  }

  z1 = sqlite3_value_text(argv[0]);
  if( z1==0 ) return;
  z2 = (u8*) sqlite3_value_text(argv[1]);
  if(argc==3){
    s = sqlite3_value_int(argv[2])-1;
    if(s<0){
      s=0;
    }
  }else{
    s = 0;
  }

  rVal = _substr((char *)z1,(char *)z2,s,pColl,NULL);
  sqlite3_result_int(context, rVal+1);
}

/*
** given a string (s) and an integer (n) returns the n leftmost (UTF-8) characters
** if the string has a length<=n or is NULL this function is NOP
*/
static void leftFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  int c=0;
  int cc=0;
  int l=0;
  const unsigned char *z;       /* input string */
  const unsigned char *zt;
  unsigned char *rz;            /* output string */

  assert( argc==2);

  if( SQLITE_NULL==sqlite3_value_type(argv[0]) || SQLITE_NULL==sqlite3_value_type(argv[1])){
    sqlite3_result_null(context);
    return;
  }

  z  = sqlite3_value_text(argv[0]);
  l  = sqlite3_value_int(argv[1]);
  zt = z;

  while( sqliteCharVal(zt) && c++<l)
    sqliteNextChar(zt);

  cc=zt-z;

  rz = sqlite3_malloc(zt-z+1);
  if (!rz){
    sqlite3_result_error_nomem(context);
    return;
  }
  strncpy((char*) rz, (char*) z, zt-z);
  *(rz+cc) = '\0';
  sqlite3_result_text(context, (char*)rz, -1, SQLITE_TRANSIENT);
  sqlite3_free(rz);
}

/*
** given a string (s) and an integer (n) returns the n rightmost (UTF-8) characters
** if the string has a length<=n or is NULL this function is NOP
*/
static void rightFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  int l=0;
  int c=0;
  int cc=0;
  const char *z;
  const char *zt;
  const char *ze;
  char *rz;

  assert( argc==2);

  if( SQLITE_NULL == sqlite3_value_type(argv[0]) || SQLITE_NULL == sqlite3_value_type(argv[1])){
    sqlite3_result_null(context);
    return;
  }

  z  = (char *)sqlite3_value_text(argv[0]);
  l  = sqlite3_value_int(argv[1]);
  zt = z;

  while( sqliteCharVal((unsigned char *)zt)!=0){
    sqliteNextChar(zt);
    ++c;
  }

  ze = zt;
  zt = z;

  cc=c-l;
  if(cc<0)
    cc=0;

  while( cc-- > 0 ){
    sqliteNextChar(zt);
  }

  rz = sqlite3_malloc(ze-zt+1);
  if (!rz){
    sqlite3_result_error_nomem(context);
    return;
  }
  strcpy((char*) rz, (char*) (zt));
  sqlite3_result_text(context, (char*)rz, -1, SQLITE_TRANSIENT);
  sqlite3_free(rz);
}

#ifndef HAVE_TRIM
/*
** removes the whitespaces at the begining of a string.
*/
const char* ltrim(const char* s){
  while( *s==' ' )
    ++s;
  return s;
}

/*
** removes the whitespaces at the end of a string.
** !mutates the input string!
*/
void rtrim(char* s){
  char* ss = s+strlen(s)-1;
  while( ss>=s && *ss==' ' )
    --ss;
  *(ss+1)='\0';
}

/*
**  Removes the whitespace at the begining of a string
*/
static void ltrimFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  const char *z;

  assert( argc==1);

  if( SQLITE_NULL==sqlite3_value_type(argv[0]) ){
    sqlite3_result_null(context);
    return;
  }
  z = sqlite3_value_text(argv[0]);
  sqlite3_result_text(context, ltrim(z), -1, SQLITE_TRANSIENT);
}

/*
**  Removes the whitespace at the end of a string
*/
static void rtrimFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  const char *z;
  char *rz;
  /* try not to change data in argv */

  assert( argc==1);

  if( SQLITE_NULL==sqlite3_value_type(argv[0]) ){
    sqlite3_result_null(context);
    return;
  }
  z = sqlite3_value_text(argv[0]);
  rz = sqlite3StrDup(z);
  rtrim(rz);
  sqlite3_result_text(context, rz, -1, SQLITE_TRANSIENT);
  sqlite3_free(rz);
}

/*
**  Removes the whitespace at the begining and end of a string
*/
static void trimFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  const char *z;
  char *rz;
  /* try not to change data in argv */

  assert( argc==1);

  if( SQLITE_NULL==sqlite3_value_type(argv[0]) ){
    sqlite3_result_null(context);
    return;
  }
  z = sqlite3_value_text(argv[0]);
  rz = sqlite3StrDup(z);
  rtrim(rz);
  sqlite3_result_text(context, ltrim(rz), -1, SQLITE_TRANSIENT);
  sqlite3_free(rz);
}
#endif

/*
** given a pointer to a string s1, the length of that string (l1), a new string (s2)
** and it's length (l2) appends s2 to s1.
** All lengths in bytes.
** This is just an auxiliary function
*/
/*
   static void _append(char **s1, int l1, const char *s2, int l2){
     *s1 = realloc(*s1, (l1+l2+1)*sizeof(char));
     strncpy((*s1)+l1, s2, l2);
     *(*(s1)+l1+l2) = '\0';
   }
*/

#ifndef HAVE_TRIM

/*
** given strings s, s1 and s2 replaces occurrences of s1 in s by s2
*/
static void replaceFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  const char *z1;     /* string s (first parameter) */
  const char *z2;     /* string s1 (second parameter) string to look for */
  const char *z3;     /* string s2 (third parameter) string to replace occurrences of s1 with */
  int lz1;
  int lz2;
  int lz3;
  int lzo=0;
  char *zo=0;
  int ret=0;
  const char *zt1;
  const char *zt2;

  assert( 3==argc );

  if( SQLITE_NULL==sqlite3_value_type(argv[0]) ){
    sqlite3_result_null(context);
    return;
  }

  z1 = sqlite3_value_text(argv[0]);
  z2 = sqlite3_value_text(argv[1]);
  z3 = sqlite3_value_text(argv[2]);
  /* handle possible null values */
  if( 0==z2 ){
    z2="";
  }
  if( 0==z3 ){
    z3="";
  }

  lz1 = strlen(z1);
  lz2 = strlen(z2);
  lz3 = strlen(z3);

#if 0
  /* special case when z2 is empty (or null) nothing will be changed */
  if( 0==lz2 ){
    sqlite3_result_text(context, z1, -1, SQLITE_TRANSIENT);
    return;
  }
#endif

  zt1=z1;
  zt2=z1;

  while(1){
    ret=_substr(z2,zt1 , 0, &zt2);

    if( ret<0 )
      break;

    _append(&zo, lzo, zt1, zt2-zt1);
    lzo+=zt2-zt1;
    _append(&zo, lzo, z3, lz3);
    lzo+=lz3;

    zt1=zt2+lz2;
  }
  _append(&zo, lzo, zt1, lz1-(zt1-z1));
  sqlite3_result_text(context, zo, -1, SQLITE_TRANSIENT);
  sqlite3_free(zo);
}
#endif

/*
** given a string returns the same string but with the characters in reverse order
*/
static void reverseFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  const char *z;
  const char *zt;
  char *rz;
  char *rzt;
  int l = 0;
  int i = 0;

  assert( 1==argc );

  if( SQLITE_NULL==sqlite3_value_type(argv[0]) ){
    sqlite3_result_null(context);
    return;
  }
  z = (char *)sqlite3_value_text(argv[0]);
  l = strlen(z);
  rz = sqlite3_malloc(l+1);
  if (!rz){
    sqlite3_result_error_nomem(context);
    return;
  }
  rzt = rz+l;
  *(rzt--) = '\0';

  zt=z;
  while( sqliteCharVal((unsigned char *)zt)!=0 ){
    z=zt;
    sqliteNextChar(zt);
    for(i=1; zt-i>=z; ++i){
      *(rzt--)=*(zt-i);
    }
  }

  sqlite3_result_text(context, rz, -1, SQLITE_TRANSIENT);
  sqlite3_free(rz);
}

/*
** An instance of the following structure holds the context of a
** stdev() or variance() aggregate computation.
** implementaion of https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Algorithm_II
** less prone to rounding errors
*/
typedef struct StdevCtx StdevCtx;
struct StdevCtx {
  double rM;
  double rS;
  i64 cnt;          /* number of elements */
};

/*
** An instance of the following structure holds the context of a
** mode() or median() aggregate computation.
** Depends on structures defined in map.c (see map & map)
** These aggregate functions only work for integers and floats although
** they could be made to work for strings. This is usually considered meaningless.
** Only usuall order (for median), no use of collation functions (would this even make sense?)
*/
typedef struct ModeCtx ModeCtx;
struct ModeCtx {
  i64 riM;            /* integer value found so far */
  double rdM;         /* double value found so far */
  i64 cnt;            /* number of elements so far */
  double pcnt;        /* number of elements smaller than a percentile */
  i64 mcnt;           /* maximum number of occurrences (for mode) */
  i64 mn;             /* number of occurrences (for mode and percentiles) */
  i64 is_double;      /* whether the computation is being done for doubles (>0) or integers (=0) */
  map* m;             /* map structure used for the computation */
  int done;           /* whether the answer has been found */
};

/*
** called for each value received during a calculation of stdev or variance
*/
static void varianceStep(sqlite3_context *context, int argc, sqlite3_value **argv){
  StdevCtx *p;

  double delta;
  double x;

  assert( argc==1 );
  p = sqlite3_aggregate_context(context, sizeof(*p));
  /* only consider non-null values */
  if( SQLITE_NULL != sqlite3_value_numeric_type(argv[0]) ){
    p->cnt++;
    x = sqlite3_value_double(argv[0]);
    delta = (x-p->rM);
    p->rM += delta/p->cnt;
    p->rS += delta*(x-p->rM);
  }
}

/*
** called for each value received during a calculation of mode of median
*/
static void modeStep(sqlite3_context *context, int argc, sqlite3_value **argv){
  ModeCtx *p;
  i64 xi=0;
  double xd=0.0;
  i64 *iptr;
  double *dptr;
  int type;

  assert( argc==1 );
  type = sqlite3_value_numeric_type(argv[0]);

  if( type == SQLITE_NULL)
    return;

  p = sqlite3_aggregate_context(context, sizeof(*p));

  if( 0==(p->m) ){
    p->m = calloc(1, sizeof(map));
    if( type==SQLITE_INTEGER ){
      /* map will be used for integers */
      *(p->m) = map_make(int_cmp);
      p->is_double = 0;
    }else{
      p->is_double = 1;
      /* map will be used for doubles */
      *(p->m) = map_make(double_cmp);
    }
  }

  ++(p->cnt);

  if( 0==p->is_double ){
    xi = sqlite3_value_int64(argv[0]);
    iptr = (i64*)calloc(1,sizeof(i64));
    *iptr = xi;
    map_insert(p->m, iptr);
  }else{
    xd = sqlite3_value_double(argv[0]);
    dptr = (double*)calloc(1,sizeof(double));
    *dptr = xd;
    map_insert(p->m, dptr);
  }
}

/*
**  Auxiliary function that iterates all elements in a map and finds the mode
**  (most frequent value)
*/
static void modeIterate(void* e, int64_t c, void* pp){
  int64_t ei;
  double ed;
  ModeCtx *p = (ModeCtx*)pp;

  if( 0==p->is_double ){
    ei = *(int*)(e);

	if( p->mcnt==c ){
      ++p->mn;
    }else if( p->mcnt<c ){
      p->riM = ei;
      p->mcnt = c;
	  p->mn=1;
    }
  }else{
    ed = *(double*)(e);

	if( p->mcnt==c ){
      ++p->mn;
    }else if(p->mcnt<c){
      p->rdM = ed;
      p->mcnt = c;
	  p->mn=1;
    }
  }
}

/*
**  Auxiliary function that iterates all elements in a map and finds the median
**  (the value such that the number of elements smaller is equal the the number of
**  elements larger)
*/
static void medianIterate(void* e, int64_t c, void* pp){
  int64_t ei;
  double ed;
  double iL;
  double iR;
  int il;
  int ir;
  ModeCtx *p = (ModeCtx*)pp;

  if(p->done>0)
    return;

  iL = p->pcnt;
  iR = p->cnt - p->pcnt;
  il = p->mcnt + c;
  ir = p->cnt - p->mcnt;

  if( il >= iL ){
    if( ir >= iR ){
    ++p->mn;
      if( 0==p->is_double ){
        ei = *(int*)(e);
        p->riM += ei;
      }else{
        ed = *(double*)(e);
        p->rdM += ed;
      }
    }else{
      p->done=1;
    }
  }
  p->mcnt+=c;
}

/*
** Returns the mode value
*/
static void modeFinalize(sqlite3_context *context){
  ModeCtx *p;
  p = sqlite3_aggregate_context(context, 0);
  if( p && p->m ){
    map_iterate(p->m, modeIterate, p);
    map_destroy(p->m);
    free(p->m);

    if( 1==p->mn ){
      if( 0==p->is_double )
        sqlite3_result_int64(context, p->riM);
      else
        sqlite3_result_double(context, p->rdM);
    }
  }
}

/*
** auxiliary function for percentiles
*/
static void _medianFinalize(sqlite3_context *context){
  ModeCtx *p;
  p = (ModeCtx*) sqlite3_aggregate_context(context, 0);
  if( p && p->m ){
    p->done=0;
    map_iterate(p->m, medianIterate, p);
    map_destroy(p->m);
    free(p->m);

    if( 0==p->is_double )
      if( 1==p->mn )
      	sqlite3_result_int64(context, p->riM);
      else
      	sqlite3_result_double(context, p->riM*1.0/p->mn);
    else
      sqlite3_result_double(context, p->rdM/p->mn);
  }
}

/*
** Returns the median value
*/
static void medianFinalize(sqlite3_context *context){
  ModeCtx *p;
  p = (ModeCtx*) sqlite3_aggregate_context(context, 0);
  if( p!=0 ){
    p->pcnt = (p->cnt)/2.0;
    _medianFinalize(context);
  }
}

/*
** Returns the lower_quartile value
*/
static void lower_quartileFinalize(sqlite3_context *context){
  ModeCtx *p;
  p = (ModeCtx*) sqlite3_aggregate_context(context, 0);
  if( p!=0 ){
    p->pcnt = (p->cnt)/4.0;
    _medianFinalize(context);
  }
}

/*
** Returns the upper_quartile value
*/
static void upper_quartileFinalize(sqlite3_context *context){
  ModeCtx *p;
  p = (ModeCtx*) sqlite3_aggregate_context(context, 0);
  if( p!=0 ){
    p->pcnt = (p->cnt)*3/4.0;
    _medianFinalize(context);
  }
}

/*
** Returns the stdev value
*/
static void stdevFinalize(sqlite3_context *context){
  StdevCtx *p;
  p = sqlite3_aggregate_context(context, 0);
  if( p && p->cnt>1 ){
    sqlite3_result_double(context, sqrt(p->rS/(p->cnt-1)));
  }else{
    sqlite3_result_double(context, 0.0);
  }
}

/*
** Returns the variance value
*/
static void varianceFinalize(sqlite3_context *context){
  StdevCtx *p;
  p = sqlite3_aggregate_context(context, 0);
  if( p && p->cnt>1 ){
    sqlite3_result_double(context, p->rS/(p->cnt-1));
  }else{
    sqlite3_result_double(context, 0.0);
  }
}

#ifdef SQLITE_SOUNDEX

/* relicoder factored code */
/*
** Calculates the soundex value of a string
*/

static void soundex(const u8 *zIn, char *zResult){
  int i, j;
  static const unsigned char iCode[] = {
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5, 5, 0,
    1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0,
    0, 0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5, 5, 0,
    1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0,
  };

  for(i=0; zIn[i] && !isalpha(zIn[i]); i++){}
  if( zIn[i] ){
    zResult[0] = toupper(zIn[i]);
    for(j=1; j<4 && zIn[i]; i++){
      int code = iCode[zIn[i]&0x7f];
      if( code>0 ){
        zResult[j++] = code + '0';
      }
    }
    while( j<4 ){
      zResult[j++] = '0';
    }
    zResult[j] = 0;
  }else{
    strcpy(zResult, "?000");
  }
}

/*
** computes the number of different characters between the soundex value fo 2 strings
*/
static void differenceFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  char zResult1[8];
  char zResult2[8];
  char *zR1 = zResult1;
  char *zR2 = zResult2;
  int rVal = 0;
  int i = 0;
  const u8 *zIn1;
  const u8 *zIn2;

  assert( argc==2 );

  if( sqlite3_value_type(argv[0])==SQLITE_NULL || sqlite3_value_type(argv[1])==SQLITE_NULL ){
    sqlite3_result_null(context);
    return;
  }

  zIn1 = (u8*)sqlite3_value_text(argv[0]);
  zIn2 = (u8*)sqlite3_value_text(argv[1]);

  soundex(zIn1, zR1);
  soundex(zIn2, zR2);

  for(i=0; i<4; ++i){
    if( sqliteCharVal((unsigned char *)zR1)==sqliteCharVal((unsigned char *)zR2) )
      ++rVal;
    sqliteNextChar(zR1);
    sqliteNextChar(zR2);
  }
  sqlite3_result_int(context, rVal);
}
#endif

static void lastRowsFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
  sqlite3 *db = sqlite3_context_db_handle(context);
  sqlite3_result_int64(context, sqlite3_changes(db));
}

/*
** This function registered all of the above C functions as SQL
** functions.  This should be the only routine in this file with
** external linkage.
*/
int RegisterExtensionFunctions(sqlite3 *db, int bNoCore){
  static const struct {
     char *zName;
     signed char nArg;
     u8 hasCoreFunc;       /* boolean */
     u8 argType;           /* 0: none.  1: db  2: (-1) */
     u8 eTextRep;          /* 1: UTF-16.  0: UTF-8 */
     u8 needCollSeq;
     void (*xFunc)(sqlite3_context*,int,sqlite3_value **);
  } aFuncs[] = {
    /* math.h */
    { "acos",               1, 1, 0, SQLITE_UTF8,    0, acosFunc  },
    { "asin",               1, 1, 0, SQLITE_UTF8,    0, asinFunc  },
    { "atan",               1, 1, 0, SQLITE_UTF8,    0, atanFunc  },
    { "atn2",               2, 0, 0, SQLITE_UTF8,    0, atn2Func  },
    /* XXX alias */
    { "atan2",              2, 1, 0, SQLITE_UTF8,    0, atn2Func  },
    { "acosh",              1, 1, 0, SQLITE_UTF8,    0, acoshFunc  },
    { "asinh",              1, 1, 0, SQLITE_UTF8,    0, asinhFunc  },
    { "atanh",              1, 1, 0, SQLITE_UTF8,    0, atanhFunc  },

    { "difference",         2, 0, 0, SQLITE_UTF8,    0, differenceFunc},
    { "degrees",            1, 1, 0, SQLITE_UTF8,    0, rad2degFunc  },
    { "radians",            1, 1, 0, SQLITE_UTF8,    0, deg2radFunc  },

    { "cos",                1, 1, 0, SQLITE_UTF8,    0, cosFunc  },
    { "sin",                1, 1, 0, SQLITE_UTF8,    0, sinFunc },
    { "tan",                1, 1, 0, SQLITE_UTF8,    0, tanFunc },
    { "cot",                1, 0, 0, SQLITE_UTF8,    0, cotFunc },
    { "cosh",               1, 1, 0, SQLITE_UTF8,    0, coshFunc  },
    { "sinh",               1, 1, 0, SQLITE_UTF8,    0, sinhFunc },
    { "tanh",               1, 1, 0, SQLITE_UTF8,    0, tanhFunc },
    { "coth",               1, 0, 0, SQLITE_UTF8,    0, cothFunc },

    { "exp",                1, 1, 0, SQLITE_UTF8,    0, expFunc  },
    { "log",                1, 1, 0, SQLITE_UTF8,    0, oldLogFunc  },
    { "log10",              1, 1, 0, SQLITE_UTF8,    0, log10Func  },
    { "power",              2, 1, 0, SQLITE_UTF8,    0, powerFunc  },
    { "sign",               1, 0, 0, SQLITE_UTF8,    0, oldSignFunc },
    { "sqrt",               1, 1, 0, SQLITE_UTF8,    0, sqrtFunc },
    { "square",             1, 0, 0, SQLITE_UTF8,    0, squareFunc },

    { "ceil",               1, 1, 0, SQLITE_UTF8,    0, ceilFunc },
    { "ceiling",            1, 1, 0, SQLITE_UTF8,    0, ceilFunc },
    { "floor",              1, 1, 0, SQLITE_UTF8,    0, floorFunc },

    { "pi",                 0, 1, 0, SQLITE_UTF8,    0, oldPiFunc },
    { "last_rows_affected", 0, 0, 0, SQLITE_UTF8,    0, lastRowsFunc },

    /* string */
    { "replicate",          2, 0, 0, SQLITE_UTF8,    0, replicateFunc },
    { "charindex",          2, 0, 0, SQLITE_UTF8,    1, charindexFunc },
    { "charindex",          3, 0, 0, SQLITE_UTF8,    1, charindexFunc },
    { "leftstr",            2, 0, 0, SQLITE_UTF8,    0, leftFunc },
    { "rightstr",           2, 0, 0, SQLITE_UTF8,    0, rightFunc },
#ifndef HAVE_TRIM
    { "ltrim",              1, 0, 0, SQLITE_UTF8,    0, ltrimFunc },
    { "rtrim",              1, 0, 0, SQLITE_UTF8,    0, rtrimFunc },
    { "trim",               1, 0, 0, SQLITE_UTF8,    0, trimFunc },
    { "replace",            3, 0, 0, SQLITE_UTF8,    0, replaceFunc },
#endif
    { "reverse",            1, 0, 0, SQLITE_UTF8,    0, reverseFunc },
    { "proper",             1, 0, 0, SQLITE_UTF8,    0, properFunc },
    { "padl",               2, 0, 0, SQLITE_UTF8,    0, padlFunc },
    { "padr",               2, 0, 0, SQLITE_UTF8,    0, padrFunc },
    { "padc",               2, 0, 0, SQLITE_UTF8,    0, padcFunc },
    { "strfilter",          2, 0, 0, SQLITE_UTF8,    0, strfilterFunc },

  };
  /* Aggregate functions */
  static const struct {
    char *zName;
    signed char nArg;
    u8 argType;
    u8 needCollSeq;
    void (*xStep)(sqlite3_context*,int,sqlite3_value**);
    void (*xFinalize)(sqlite3_context*);
  } aAggs[] = {
    { "stdev",            1, 0, 0, varianceStep, stdevFinalize  },
    { "variance",         1, 0, 0, varianceStep, varianceFinalize  },
    { "mode",             1, 0, 0, modeStep,     modeFinalize  },
    { "median",           1, 0, 0, modeStep,     medianFinalize  },
    { "lower_quartile",   1, 0, 0, modeStep,     lower_quartileFinalize  },
    { "upper_quartile",   1, 0, 0, modeStep,     upper_quartileFinalize  },
  };
  int i;

  for(i=0; i<sizeof(aFuncs)/sizeof(aFuncs[0]); i++){
    void *pArg = 0;
    if (bNoCore && aFuncs[i].hasCoreFunc) continue;
    switch( aFuncs[i].argType ){
      case 1: pArg = db; break;
      case 2: pArg = (void *)(-1); break;
    }
    /* sqlite3CreateFunc */
    /* LMH no error checking */
    sqlite3_create_function(db, aFuncs[i].zName, aFuncs[i].nArg,
        aFuncs[i].eTextRep, pArg, aFuncs[i].xFunc, 0, 0);
#if 1
    if( aFuncs[i].needCollSeq ){
      struct FuncDef *pFunc = sqlite3FindFunction(db, aFuncs[i].zName,
#if SQLITE_VERSION_NUMBER < 3012000
          strlen(aFuncs[i].zName),
#endif
          aFuncs[i].nArg, aFuncs[i].eTextRep, 0);
      if( pFunc && aFuncs[i].needCollSeq ){
#if SQLITE_VERSION_NUMBER >= 3008001
        pFunc->funcFlags |= SQLITE_FUNC_NEEDCOLL;
#else
        pFunc->flags |= SQLITE_FUNC_NEEDCOLL;
#endif
      }
    }
#endif
  }

  for(i=0; i<sizeof(aAggs)/sizeof(aAggs[0]); i++){
    void *pArg = 0;
    switch( aAggs[i].argType ){
      case 1: pArg = db; break;
      case 2: pArg = (void *)(-1); break;
    }
    /* sqlite3CreateFunc */
    /* LMH no error checking */
    sqlite3_create_function(db, aAggs[i].zName, aAggs[i].nArg, SQLITE_UTF8,
        pArg, 0, aAggs[i].xStep, aAggs[i].xFinalize);
#if 0
    if( aAggs[i].needCollSeq ){
      struct FuncDef *pFunc = sqlite3FindFunction( db, aAggs[i].zName,
#if SQLITE_VERSION_NUMBER < 3012000
          strlen(aAggs[i].zName),
#endif
          aAggs[i].nArg, SQLITE_UTF8, 0);
      if( pFunc && aAggs[i].needCollSeq ){
#if SQLITE_VERSION_NUMBER >= 3008001
        pFunc->funcFlags |= SQLITE_FUNC_NEEDCOLL;
#else
        pFunc->flags |= SQLITE_FUNC_NEEDCOLL;
#endif
      }
    }
#endif
  }
  return 0;
}

#ifdef COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE
int sqlite3_extension_init(
    sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi){
  SQLITE_EXTENSION_INIT2(pApi);
  RegisterExtensionFunctions(db);
  return 0;
}
#endif /* COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE */

map map_make(cmp_func cmp){
  map r;
  r.cmp=cmp;
  r.base = 0;

  return r;
}

void* xcalloc(size_t nmemb, size_t size, char* s){
  void* ret = calloc(nmemb, size);
  return ret;
}

void xfree(void* p){
  free(p);
}

void node_insert(node** n, cmp_func cmp, void *e){
  int c;
  node* nn;
  if(*n==0){
    nn = (node*)xcalloc(1,sizeof(node), "for node");
    nn->data = e;
    nn->count = 1;
    *n=nn;
  }else{
    c=cmp((*n)->data,e);
    if(0==c){
      ++((*n)->count);
      xfree(e);
    }else if(c>0){
      /* put it right here */
      node_insert(&((*n)->l), cmp, e);
    }else{
      node_insert(&((*n)->r), cmp, e);
    }
  }
}

void map_insert(map *m, void *e){
  node_insert(&(m->base), m->cmp, e);
}

void node_iterate(node *n, map_iterator iter, void* p){
  if(n){
    if(n->l)
      node_iterate(n->l, iter, p);
    iter(n->data, n->count, p);
    if(n->r)
      node_iterate(n->r, iter, p);
  }
}

void map_iterate(map *m, map_iterator iter, void* p){
  node_iterate(m->base, iter, p);
}

void node_destroy(node *n){
  if(0!=n){
    xfree(n->data);
    if(n->l)
      node_destroy(n->l);
    if(n->r)
      node_destroy(n->r);

    xfree(n);
  }
}

void map_destroy(map *m){
  node_destroy(m->base);
}

int int_cmp(const void *a, const void *b){
  int64_t aa = *(int64_t *)(a);
  int64_t bb = *(int64_t *)(b);
  if(aa==bb)
    return 0;
  else if(aa<bb)
    return -1;
  else
    return 1;
}

int double_cmp(const void *a, const void *b){
  double aa = *(double *)(a);
  double bb = *(double *)(b);
  if(aa==bb)
    return 0;
  else if(aa<bb)
    return -1;
  else
    return 1;
}

Added SQLite.Interop/src/core/sqlite3.c.

more than 10,000 changes

Added SQLite.Interop/src/core/sqlite3.h.

more than 10,000 changes

Added SQLite.Interop/src/core/sqlite3ext.h.































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
/*
** 2006 June 7
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the SQLite interface for use by
** shared libraries that want to be imported as extensions into
** an SQLite instance.  Shared libraries that intend to be loaded
** as extensions by SQLite should #include this file instead of 
** sqlite3.h.
*/
#ifndef SQLITE3EXT_H
#define SQLITE3EXT_H
#include "sqlite3.h"

/*
** The following structure holds pointers to all of the SQLite API
** routines.
**
** WARNING:  In order to maintain backwards compatibility, add new
** interfaces to the end of this structure only.  If you insert new
** interfaces in the middle of this structure, then older different
** versions of SQLite will not be able to load each other's shared
** libraries!
*/
struct sqlite3_api_routines {
  void * (*aggregate_context)(sqlite3_context*,int nBytes);
  int  (*aggregate_count)(sqlite3_context*);
  int  (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*));
  int  (*bind_double)(sqlite3_stmt*,int,double);
  int  (*bind_int)(sqlite3_stmt*,int,int);
  int  (*bind_int64)(sqlite3_stmt*,int,sqlite_int64);
  int  (*bind_null)(sqlite3_stmt*,int);
  int  (*bind_parameter_count)(sqlite3_stmt*);
  int  (*bind_parameter_index)(sqlite3_stmt*,const char*zName);
  const char * (*bind_parameter_name)(sqlite3_stmt*,int);
  int  (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*));
  int  (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*));
  int  (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*);
  int  (*busy_handler)(sqlite3*,int(*)(void*,int),void*);
  int  (*busy_timeout)(sqlite3*,int ms);
  int  (*changes)(sqlite3*);
  int  (*close)(sqlite3*);
  int  (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*,
                           int eTextRep,const char*));
  int  (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*,
                             int eTextRep,const void*));
  const void * (*column_blob)(sqlite3_stmt*,int iCol);
  int  (*column_bytes)(sqlite3_stmt*,int iCol);
  int  (*column_bytes16)(sqlite3_stmt*,int iCol);
  int  (*column_count)(sqlite3_stmt*pStmt);
  const char * (*column_database_name)(sqlite3_stmt*,int);
  const void * (*column_database_name16)(sqlite3_stmt*,int);
  const char * (*column_decltype)(sqlite3_stmt*,int i);
  const void * (*column_decltype16)(sqlite3_stmt*,int);
  double  (*column_double)(sqlite3_stmt*,int iCol);
  int  (*column_int)(sqlite3_stmt*,int iCol);
  sqlite_int64  (*column_int64)(sqlite3_stmt*,int iCol);
  const char * (*column_name)(sqlite3_stmt*,int);
  const void * (*column_name16)(sqlite3_stmt*,int);
  const char * (*column_origin_name)(sqlite3_stmt*,int);
  const void * (*column_origin_name16)(sqlite3_stmt*,int);
  const char * (*column_table_name)(sqlite3_stmt*,int);
  const void * (*column_table_name16)(sqlite3_stmt*,int);
  const unsigned char * (*column_text)(sqlite3_stmt*,int iCol);
  const void * (*column_text16)(sqlite3_stmt*,int iCol);
  int  (*column_type)(sqlite3_stmt*,int iCol);
  sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol);
  void * (*commit_hook)(sqlite3*,int(*)(void*),void*);
  int  (*complete)(const char*sql);
  int  (*complete16)(const void*sql);
  int  (*create_collation)(sqlite3*,const char*,int,void*,
                           int(*)(void*,int,const void*,int,const void*));
  int  (*create_collation16)(sqlite3*,const void*,int,void*,
                             int(*)(void*,int,const void*,int,const void*));
  int  (*create_function)(sqlite3*,const char*,int,int,void*,
                          void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
                          void (*xStep)(sqlite3_context*,int,sqlite3_value**),
                          void (*xFinal)(sqlite3_context*));
  int  (*create_function16)(sqlite3*,const void*,int,int,void*,
                            void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
                            void (*xStep)(sqlite3_context*,int,sqlite3_value**),
                            void (*xFinal)(sqlite3_context*));
  int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*);
  int  (*data_count)(sqlite3_stmt*pStmt);
  sqlite3 * (*db_handle)(sqlite3_stmt*);
  int (*declare_vtab)(sqlite3*,const char*);
  int  (*enable_shared_cache)(int);
  int  (*errcode)(sqlite3*db);
  const char * (*errmsg)(sqlite3*);
  const void * (*errmsg16)(sqlite3*);
  int  (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**);
  int  (*expired)(sqlite3_stmt*);
  int  (*finalize)(sqlite3_stmt*pStmt);
  void  (*free)(void*);
  void  (*free_table)(char**result);
  int  (*get_autocommit)(sqlite3*);
  void * (*get_auxdata)(sqlite3_context*,int);
  int  (*get_table)(sqlite3*,const char*,char***,int*,int*,char**);
  int  (*global_recover)(void);
  void  (*interruptx)(sqlite3*);
  sqlite_int64  (*last_insert_rowid)(sqlite3*);
  const char * (*libversion)(void);
  int  (*libversion_number)(void);
  void *(*malloc)(int);
  char * (*mprintf)(const char*,...);
  int  (*open)(const char*,sqlite3**);
  int  (*open16)(const void*,sqlite3**);
  int  (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
  int  (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
  void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*);
  void  (*progress_handler)(sqlite3*,int,int(*)(void*),void*);
  void *(*realloc)(void*,int);
  int  (*reset)(sqlite3_stmt*pStmt);
  void  (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*));
  void  (*result_double)(sqlite3_context*,double);
  void  (*result_error)(sqlite3_context*,const char*,int);
  void  (*result_error16)(sqlite3_context*,const void*,int);
  void  (*result_int)(sqlite3_context*,int);
  void  (*result_int64)(sqlite3_context*,sqlite_int64);
  void  (*result_null)(sqlite3_context*);
  void  (*result_text)(sqlite3_context*,const char*,int,void(*)(void*));
  void  (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*));
  void  (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*));
  void  (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*));
  void  (*result_value)(sqlite3_context*,sqlite3_value*);
  void * (*rollback_hook)(sqlite3*,void(*)(void*),void*);
  int  (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,
                         const char*,const char*),void*);
  void  (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*));
  char * (*xsnprintf)(int,char*,const char*,...);
  int  (*step)(sqlite3_stmt*);
  int  (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,
                                char const**,char const**,int*,int*,int*);
  void  (*thread_cleanup)(void);
  int  (*total_changes)(sqlite3*);
  void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*);
  int  (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*);
  void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*,
                                         sqlite_int64),void*);
  void * (*user_data)(sqlite3_context*);
  const void * (*value_blob)(sqlite3_value*);
  int  (*value_bytes)(sqlite3_value*);
  int  (*value_bytes16)(sqlite3_value*);
  double  (*value_double)(sqlite3_value*);
  int  (*value_int)(sqlite3_value*);
  sqlite_int64  (*value_int64)(sqlite3_value*);
  int  (*value_numeric_type)(sqlite3_value*);
  const unsigned char * (*value_text)(sqlite3_value*);
  const void * (*value_text16)(sqlite3_value*);
  const void * (*value_text16be)(sqlite3_value*);
  const void * (*value_text16le)(sqlite3_value*);
  int  (*value_type)(sqlite3_value*);
  char *(*vmprintf)(const char*,va_list);
  /* Added ??? */
  int (*overload_function)(sqlite3*, const char *zFuncName, int nArg);
  /* Added by 3.3.13 */
  int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
  int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
  int (*clear_bindings)(sqlite3_stmt*);
  /* Added by 3.4.1 */
  int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*,
                          void (*xDestroy)(void *));
  /* Added by 3.5.0 */
  int (*bind_zeroblob)(sqlite3_stmt*,int,int);
  int (*blob_bytes)(sqlite3_blob*);
  int (*blob_close)(sqlite3_blob*);
  int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64,
                   int,sqlite3_blob**);
  int (*blob_read)(sqlite3_blob*,void*,int,int);
  int (*blob_write)(sqlite3_blob*,const void*,int,int);
  int (*create_collation_v2)(sqlite3*,const char*,int,void*,
                             int(*)(void*,int,const void*,int,const void*),
                             void(*)(void*));
  int (*file_control)(sqlite3*,const char*,int,void*);
  sqlite3_int64 (*memory_highwater)(int);
  sqlite3_int64 (*memory_used)(void);
  sqlite3_mutex *(*mutex_alloc)(int);
  void (*mutex_enter)(sqlite3_mutex*);
  void (*mutex_free)(sqlite3_mutex*);
  void (*mutex_leave)(sqlite3_mutex*);
  int (*mutex_try)(sqlite3_mutex*);
  int (*open_v2)(const char*,sqlite3**,int,const char*);
  int (*release_memory)(int);
  void (*result_error_nomem)(sqlite3_context*);
  void (*result_error_toobig)(sqlite3_context*);
  int (*sleep)(int);
  void (*soft_heap_limit)(int);
  sqlite3_vfs *(*vfs_find)(const char*);
  int (*vfs_register)(sqlite3_vfs*,int);
  int (*vfs_unregister)(sqlite3_vfs*);
  int (*xthreadsafe)(void);
  void (*result_zeroblob)(sqlite3_context*,int);
  void (*result_error_code)(sqlite3_context*,int);
  int (*test_control)(int, ...);
  void (*randomness)(int,void*);
  sqlite3 *(*context_db_handle)(sqlite3_context*);
  int (*extended_result_codes)(sqlite3*,int);
  int (*limit)(sqlite3*,int,int);
  sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*);
  const char *(*sql)(sqlite3_stmt*);
  int (*status)(int,int*,int*,int);
  int (*backup_finish)(sqlite3_backup*);
  sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*);
  int (*backup_pagecount)(sqlite3_backup*);
  int (*backup_remaining)(sqlite3_backup*);
  int (*backup_step)(sqlite3_backup*,int);
  const char *(*compileoption_get)(int);
  int (*compileoption_used)(const char*);
  int (*create_function_v2)(sqlite3*,const char*,int,int,void*,
                            void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
                            void (*xStep)(sqlite3_context*,int,sqlite3_value**),
                            void (*xFinal)(sqlite3_context*),
                            void(*xDestroy)(void*));
  int (*db_config)(sqlite3*,int,...);
  sqlite3_mutex *(*db_mutex)(sqlite3*);
  int (*db_status)(sqlite3*,int,int*,int*,int);
  int (*extended_errcode)(sqlite3*);
  void (*log)(int,const char*,...);
  sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64);
  const char *(*sourceid)(void);
  int (*stmt_status)(sqlite3_stmt*,int,int);
  int (*strnicmp)(const char*,const char*,int);
  int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*);
  int (*wal_autocheckpoint)(sqlite3*,int);
  int (*wal_checkpoint)(sqlite3*,const char*);
  void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*);
  int (*blob_reopen)(sqlite3_blob*,sqlite3_int64);
  int (*vtab_config)(sqlite3*,int op,...);
  int (*vtab_on_conflict)(sqlite3*);
  /* Version 3.7.16 and later */
  int (*close_v2)(sqlite3*);
  const char *(*db_filename)(sqlite3*,const char*);
  int (*db_readonly)(sqlite3*,const char*);
  int (*db_release_memory)(sqlite3*);
  const char *(*errstr)(int);
  int (*stmt_busy)(sqlite3_stmt*);
  int (*stmt_readonly)(sqlite3_stmt*);
  int (*stricmp)(const char*,const char*);
  int (*uri_boolean)(const char*,const char*,int);
  sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64);
  const char *(*uri_parameter)(const char*,const char*);
  char *(*xvsnprintf)(int,char*,const char*,va_list);
  int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*);
  /* Version 3.8.7 and later */
  int (*auto_extension)(void(*)(void));
  int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64,
                     void(*)(void*));
  int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64,
                      void(*)(void*),unsigned char);
  int (*cancel_auto_extension)(void(*)(void));
  int (*load_extension)(sqlite3*,const char*,const char*,char**);
  void *(*malloc64)(sqlite3_uint64);
  sqlite3_uint64 (*msize)(void*);
  void *(*realloc64)(void*,sqlite3_uint64);
  void (*reset_auto_extension)(void);
  void (*result_blob64)(sqlite3_context*,const void*,sqlite3_uint64,
                        void(*)(void*));
  void (*result_text64)(sqlite3_context*,const char*,sqlite3_uint64,
                         void(*)(void*), unsigned char);
  int (*strglob)(const char*,const char*);
  /* Version 3.8.11 and later */
  sqlite3_value *(*value_dup)(const sqlite3_value*);
  void (*value_free)(sqlite3_value*);
  int (*result_zeroblob64)(sqlite3_context*,sqlite3_uint64);
  int (*bind_zeroblob64)(sqlite3_stmt*, int, sqlite3_uint64);
  /* Version 3.9.0 and later */
  unsigned int (*value_subtype)(sqlite3_value*);
  void (*result_subtype)(sqlite3_context*,unsigned int);
  /* Version 3.10.0 and later */
  int (*status64)(int,sqlite3_int64*,sqlite3_int64*,int);
  int (*strlike)(const char*,const char*,unsigned int);
  int (*db_cacheflush)(sqlite3*);
  /* Version 3.12.0 and later */
  int (*system_errno)(sqlite3*);
  /* Version 3.14.0 and later */
  int (*trace_v2)(sqlite3*,unsigned,int(*)(unsigned,void*,void*,void*),void*);
  char *(*expanded_sql)(sqlite3_stmt*);
  /* Version 3.18.0 and later */
  void (*set_last_insert_rowid)(sqlite3*,sqlite3_int64);
  /* Version 3.20.0 and later */
  int (*prepare_v3)(sqlite3*,const char*,int,unsigned int,
                    sqlite3_stmt**,const char**);
  int (*prepare16_v3)(sqlite3*,const void*,int,unsigned int,
                      sqlite3_stmt**,const void**);
  int (*bind_pointer)(sqlite3_stmt*,int,void*,const char*,void(*)(void*));
  void (*result_pointer)(sqlite3_context*,void*,const char*,void(*)(void*));
  void *(*value_pointer)(sqlite3_value*,const char*);
  int (*vtab_nochange)(sqlite3_context*);
  int (*value_nochange)(sqlite3_value*);
  const char *(*vtab_collation)(sqlite3_index_info*,int);
  /* Version 3.24.0 and later */
  int (*keyword_count)(void);
  int (*keyword_name)(int,const char**,int*);
  int (*keyword_check)(const char*,int);
  sqlite3_str *(*str_new)(sqlite3*);
  char *(*str_finish)(sqlite3_str*);
  void (*str_appendf)(sqlite3_str*, const char *zFormat, ...);
  void (*str_vappendf)(sqlite3_str*, const char *zFormat, va_list);
  void (*str_append)(sqlite3_str*, const char *zIn, int N);
  void (*str_appendall)(sqlite3_str*, const char *zIn);
  void (*str_appendchar)(sqlite3_str*, int N, char C);
  void (*str_reset)(sqlite3_str*);
  int (*str_errcode)(sqlite3_str*);
  int (*str_length)(sqlite3_str*);
  char *(*str_value)(sqlite3_str*);
  /* Version 3.25.0 and later */
  int (*create_window_function)(sqlite3*,const char*,int,int,void*,
                            void (*xStep)(sqlite3_context*,int,sqlite3_value**),
                            void (*xFinal)(sqlite3_context*),
                            void (*xValue)(sqlite3_context*),
                            void (*xInv)(sqlite3_context*,int,sqlite3_value**),
                            void(*xDestroy)(void*));
  /* Version 3.26.0 and later */
  const char *(*normalized_sql)(sqlite3_stmt*);
  /* Version 3.28.0 and later */
  int (*stmt_isexplain)(sqlite3_stmt*);
  int (*value_frombind)(sqlite3_value*);
  /* Version 3.30.0 and later */
  int (*drop_modules)(sqlite3*,const char**);
  /* Version 3.31.0 and later */
  sqlite3_int64 (*hard_heap_limit64)(sqlite3_int64);
  const char *(*uri_key)(const char*,int);
  const char *(*filename_database)(const char*);
  const char *(*filename_journal)(const char*);
  const char *(*filename_wal)(const char*);
  /* Version 3.32.0 and later */
  const char *(*create_filename)(const char*,const char*,const char*,
                           int,const char**);
  void (*free_filename)(const char*);
  sqlite3_file *(*database_file_object)(const char*);
  /* Version 3.34.0 and later */
  int (*txn_state)(sqlite3*,const char*);
  /* Version 3.36.1 and later */
  sqlite3_int64 (*changes64)(sqlite3*);
  sqlite3_int64 (*total_changes64)(sqlite3*);
  /* Version 3.37.0 and later */
  int (*autovacuum_pages)(sqlite3*,
     unsigned int(*)(void*,const char*,unsigned int,unsigned int,unsigned int),
     void*, void(*)(void*));
  /* Version 3.38.0 and later */
  int (*error_offset)(sqlite3*);
  int (*vtab_rhs_value)(sqlite3_index_info*,int,sqlite3_value**);
  int (*vtab_distinct)(sqlite3_index_info*);
  int (*vtab_in)(sqlite3_index_info*,int,int);
  int (*vtab_in_first)(sqlite3_value*,sqlite3_value**);
  int (*vtab_in_next)(sqlite3_value*,sqlite3_value**);
  /* Version 3.39.0 and later */
  int (*deserialize)(sqlite3*,const char*,unsigned char*,
                     sqlite3_int64,sqlite3_int64,unsigned);
  unsigned char *(*serialize)(sqlite3*,const char *,sqlite3_int64*,
                              unsigned int);
  const char *(*db_name)(sqlite3*,int);
  /* Version 3.40.0 and later */
  int (*value_encoding)(sqlite3_value*);
  /* Version 3.41.0 and later */
  int (*is_interrupted)(sqlite3*);
  /* Version 3.43.0 and later */
  int (*stmt_explain)(sqlite3_stmt*,int);
  /* Version 3.44.0 and later */
  void *(*get_clientdata)(sqlite3*,const char*);
  int (*set_clientdata)(sqlite3*, const char*, void*, void(*)(void*));
};

/*
** This is the function signature used for all extension entry points.  It
** is also defined in the file "loadext.c".
*/
typedef int (*sqlite3_loadext_entry)(
  sqlite3 *db,                       /* Handle to the database. */
  char **pzErrMsg,                   /* Used to set error string on failure. */
  const sqlite3_api_routines *pThunk /* Extension API function pointers. */
);

/*
** The following macros redefine the API routines so that they are
** redirected through the global sqlite3_api structure.
**
** This header file is also used by the loadext.c source file
** (part of the main SQLite library - not an extension) so that
** it can get access to the sqlite3_api_routines structure
** definition.  But the main library does not want to redefine
** the API.  So the redefinition macros are only valid if the
** SQLITE_CORE macros is undefined.
*/
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
#define sqlite3_aggregate_context      sqlite3_api->aggregate_context
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_aggregate_count        sqlite3_api->aggregate_count
#endif
#define sqlite3_bind_blob              sqlite3_api->bind_blob
#define sqlite3_bind_double            sqlite3_api->bind_double
#define sqlite3_bind_int               sqlite3_api->bind_int
#define sqlite3_bind_int64             sqlite3_api->bind_int64
#define sqlite3_bind_null              sqlite3_api->bind_null
#define sqlite3_bind_parameter_count   sqlite3_api->bind_parameter_count
#define sqlite3_bind_parameter_index   sqlite3_api->bind_parameter_index
#define sqlite3_bind_parameter_name    sqlite3_api->bind_parameter_name
#define sqlite3_bind_text              sqlite3_api->bind_text
#define sqlite3_bind_text16            sqlite3_api->bind_text16
#define sqlite3_bind_value             sqlite3_api->bind_value
#define sqlite3_busy_handler           sqlite3_api->busy_handler
#define sqlite3_busy_timeout           sqlite3_api->busy_timeout
#define sqlite3_changes                sqlite3_api->changes
#define sqlite3_close                  sqlite3_api->close
#define sqlite3_collation_needed       sqlite3_api->collation_needed
#define sqlite3_collation_needed16     sqlite3_api->collation_needed16
#define sqlite3_column_blob            sqlite3_api->column_blob
#define sqlite3_column_bytes           sqlite3_api->column_bytes
#define sqlite3_column_bytes16         sqlite3_api->column_bytes16
#define sqlite3_column_count           sqlite3_api->column_count
#define sqlite3_column_database_name   sqlite3_api->column_database_name
#define sqlite3_column_database_name16 sqlite3_api->column_database_name16
#define sqlite3_column_decltype        sqlite3_api->column_decltype
#define sqlite3_column_decltype16      sqlite3_api->column_decltype16
#define sqlite3_column_double          sqlite3_api->column_double
#define sqlite3_column_int             sqlite3_api->column_int
#define sqlite3_column_int64           sqlite3_api->column_int64
#define sqlite3_column_name            sqlite3_api->column_name
#define sqlite3_column_name16          sqlite3_api->column_name16
#define sqlite3_column_origin_name     sqlite3_api->column_origin_name
#define sqlite3_column_origin_name16   sqlite3_api->column_origin_name16
#define sqlite3_column_table_name      sqlite3_api->column_table_name
#define sqlite3_column_table_name16    sqlite3_api->column_table_name16
#define sqlite3_column_text            sqlite3_api->column_text
#define sqlite3_column_text16          sqlite3_api->column_text16
#define sqlite3_column_type            sqlite3_api->column_type
#define sqlite3_column_value           sqlite3_api->column_value
#define sqlite3_commit_hook            sqlite3_api->commit_hook
#define sqlite3_complete               sqlite3_api->complete
#define sqlite3_complete16             sqlite3_api->complete16
#define sqlite3_create_collation       sqlite3_api->create_collation
#define sqlite3_create_collation16     sqlite3_api->create_collation16
#define sqlite3_create_function        sqlite3_api->create_function
#define sqlite3_create_function16      sqlite3_api->create_function16
#define sqlite3_create_module          sqlite3_api->create_module
#define sqlite3_create_module_v2       sqlite3_api->create_module_v2
#define sqlite3_data_count             sqlite3_api->data_count
#define sqlite3_db_handle              sqlite3_api->db_handle
#define sqlite3_declare_vtab           sqlite3_api->declare_vtab
#define sqlite3_enable_shared_cache    sqlite3_api->enable_shared_cache
#define sqlite3_errcode                sqlite3_api->errcode
#define sqlite3_errmsg                 sqlite3_api->errmsg
#define sqlite3_errmsg16               sqlite3_api->errmsg16
#define sqlite3_exec                   sqlite3_api->exec
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_expired                sqlite3_api->expired
#endif
#define sqlite3_finalize               sqlite3_api->finalize
#define sqlite3_free                   sqlite3_api->free
#define sqlite3_free_table             sqlite3_api->free_table
#define sqlite3_get_autocommit         sqlite3_api->get_autocommit
#define sqlite3_get_auxdata            sqlite3_api->get_auxdata
#define sqlite3_get_table              sqlite3_api->get_table
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_global_recover         sqlite3_api->global_recover
#endif
#define sqlite3_interrupt              sqlite3_api->interruptx
#define sqlite3_last_insert_rowid      sqlite3_api->last_insert_rowid
#define sqlite3_libversion             sqlite3_api->libversion
#define sqlite3_libversion_number      sqlite3_api->libversion_number
#define sqlite3_malloc                 sqlite3_api->malloc
#define sqlite3_mprintf                sqlite3_api->mprintf
#define sqlite3_open                   sqlite3_api->open
#define sqlite3_open16                 sqlite3_api->open16
#define sqlite3_prepare                sqlite3_api->prepare
#define sqlite3_prepare16              sqlite3_api->prepare16
#define sqlite3_prepare_v2             sqlite3_api->prepare_v2
#define sqlite3_prepare16_v2           sqlite3_api->prepare16_v2
#define sqlite3_profile                sqlite3_api->profile
#define sqlite3_progress_handler       sqlite3_api->progress_handler
#define sqlite3_realloc                sqlite3_api->realloc
#define sqlite3_reset                  sqlite3_api->reset
#define sqlite3_result_blob            sqlite3_api->result_blob
#define sqlite3_result_double          sqlite3_api->result_double
#define sqlite3_result_error           sqlite3_api->result_error
#define sqlite3_result_error16         sqlite3_api->result_error16
#define sqlite3_result_int             sqlite3_api->result_int
#define sqlite3_result_int64           sqlite3_api->result_int64
#define sqlite3_result_null            sqlite3_api->result_null
#define sqlite3_result_text            sqlite3_api->result_text
#define sqlite3_result_text16          sqlite3_api->result_text16
#define sqlite3_result_text16be        sqlite3_api->result_text16be
#define sqlite3_result_text16le        sqlite3_api->result_text16le
#define sqlite3_result_value           sqlite3_api->result_value
#define sqlite3_rollback_hook          sqlite3_api->rollback_hook
#define sqlite3_set_authorizer         sqlite3_api->set_authorizer
#define sqlite3_set_auxdata            sqlite3_api->set_auxdata
#define sqlite3_snprintf               sqlite3_api->xsnprintf
#define sqlite3_step                   sqlite3_api->step
#define sqlite3_table_column_metadata  sqlite3_api->table_column_metadata
#define sqlite3_thread_cleanup         sqlite3_api->thread_cleanup
#define sqlite3_total_changes          sqlite3_api->total_changes
#define sqlite3_trace                  sqlite3_api->trace
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_transfer_bindings      sqlite3_api->transfer_bindings
#endif
#define sqlite3_update_hook            sqlite3_api->update_hook
#define sqlite3_user_data              sqlite3_api->user_data
#define sqlite3_value_blob             sqlite3_api->value_blob
#define sqlite3_value_bytes            sqlite3_api->value_bytes
#define sqlite3_value_bytes16          sqlite3_api->value_bytes16
#define sqlite3_value_double           sqlite3_api->value_double
#define sqlite3_value_int              sqlite3_api->value_int
#define sqlite3_value_int64            sqlite3_api->value_int64
#define sqlite3_value_numeric_type     sqlite3_api->value_numeric_type
#define sqlite3_value_text             sqlite3_api->value_text
#define sqlite3_value_text16           sqlite3_api->value_text16
#define sqlite3_value_text16be         sqlite3_api->value_text16be
#define sqlite3_value_text16le         sqlite3_api->value_text16le
#define sqlite3_value_type             sqlite3_api->value_type
#define sqlite3_vmprintf               sqlite3_api->vmprintf
#define sqlite3_vsnprintf              sqlite3_api->xvsnprintf
#define sqlite3_overload_function      sqlite3_api->overload_function
#define sqlite3_prepare_v2             sqlite3_api->prepare_v2
#define sqlite3_prepare16_v2           sqlite3_api->prepare16_v2
#define sqlite3_clear_bindings         sqlite3_api->clear_bindings
#define sqlite3_bind_zeroblob          sqlite3_api->bind_zeroblob
#define sqlite3_blob_bytes             sqlite3_api->blob_bytes
#define sqlite3_blob_close             sqlite3_api->blob_close
#define sqlite3_blob_open              sqlite3_api->blob_open
#define sqlite3_blob_read              sqlite3_api->blob_read
#define sqlite3_blob_write             sqlite3_api->blob_write
#define sqlite3_create_collation_v2    sqlite3_api->create_collation_v2
#define sqlite3_file_control           sqlite3_api->file_control
#define sqlite3_memory_highwater       sqlite3_api->memory_highwater
#define sqlite3_memory_used            sqlite3_api->memory_used
#define sqlite3_mutex_alloc            sqlite3_api->mutex_alloc
#define sqlite3_mutex_enter            sqlite3_api->mutex_enter
#define sqlite3_mutex_free             sqlite3_api->mutex_free
#define sqlite3_mutex_leave            sqlite3_api->mutex_leave
#define sqlite3_mutex_try              sqlite3_api->mutex_try
#define sqlite3_open_v2                sqlite3_api->open_v2
#define sqlite3_release_memory         sqlite3_api->release_memory
#define sqlite3_result_error_nomem     sqlite3_api->result_error_nomem
#define sqlite3_result_error_toobig    sqlite3_api->result_error_toobig
#define sqlite3_sleep                  sqlite3_api->sleep
#define sqlite3_soft_heap_limit        sqlite3_api->soft_heap_limit
#define sqlite3_vfs_find               sqlite3_api->vfs_find
#define sqlite3_vfs_register           sqlite3_api->vfs_register
#define sqlite3_vfs_unregister         sqlite3_api->vfs_unregister
#define sqlite3_threadsafe             sqlite3_api->xthreadsafe
#define sqlite3_result_zeroblob        sqlite3_api->result_zeroblob
#define sqlite3_result_error_code      sqlite3_api->result_error_code
#define sqlite3_test_control           sqlite3_api->test_control
#define sqlite3_randomness             sqlite3_api->randomness
#define sqlite3_context_db_handle      sqlite3_api->context_db_handle
#define sqlite3_extended_result_codes  sqlite3_api->extended_result_codes
#define sqlite3_limit                  sqlite3_api->limit
#define sqlite3_next_stmt              sqlite3_api->next_stmt
#define sqlite3_sql                    sqlite3_api->sql
#define sqlite3_status                 sqlite3_api->status
#define sqlite3_backup_finish          sqlite3_api->backup_finish
#define sqlite3_backup_init            sqlite3_api->backup_init
#define sqlite3_backup_pagecount       sqlite3_api->backup_pagecount
#define sqlite3_backup_remaining       sqlite3_api->backup_remaining
#define sqlite3_backup_step            sqlite3_api->backup_step
#define sqlite3_compileoption_get      sqlite3_api->compileoption_get
#define sqlite3_compileoption_used     sqlite3_api->compileoption_used
#define sqlite3_create_function_v2     sqlite3_api->create_function_v2
#define sqlite3_db_config              sqlite3_api->db_config
#define sqlite3_db_mutex               sqlite3_api->db_mutex
#define sqlite3_db_status              sqlite3_api->db_status
#define sqlite3_extended_errcode       sqlite3_api->extended_errcode
#define sqlite3_log                    sqlite3_api->log
#define sqlite3_soft_heap_limit64      sqlite3_api->soft_heap_limit64
#define sqlite3_sourceid               sqlite3_api->sourceid
#define sqlite3_stmt_status            sqlite3_api->stmt_status
#define sqlite3_strnicmp               sqlite3_api->strnicmp
#define sqlite3_unlock_notify          sqlite3_api->unlock_notify
#define sqlite3_wal_autocheckpoint     sqlite3_api->wal_autocheckpoint
#define sqlite3_wal_checkpoint         sqlite3_api->wal_checkpoint
#define sqlite3_wal_hook               sqlite3_api->wal_hook
#define sqlite3_blob_reopen            sqlite3_api->blob_reopen
#define sqlite3_vtab_config            sqlite3_api->vtab_config
#define sqlite3_vtab_on_conflict       sqlite3_api->vtab_on_conflict
/* Version 3.7.16 and later */
#define sqlite3_close_v2               sqlite3_api->close_v2
#define sqlite3_db_filename            sqlite3_api->db_filename
#define sqlite3_db_readonly            sqlite3_api->db_readonly
#define sqlite3_db_release_memory      sqlite3_api->db_release_memory
#define sqlite3_errstr                 sqlite3_api->errstr
#define sqlite3_stmt_busy              sqlite3_api->stmt_busy
#define sqlite3_stmt_readonly          sqlite3_api->stmt_readonly
#define sqlite3_stricmp                sqlite3_api->stricmp
#define sqlite3_uri_boolean            sqlite3_api->uri_boolean
#define sqlite3_uri_int64              sqlite3_api->uri_int64
#define sqlite3_uri_parameter          sqlite3_api->uri_parameter
#define sqlite3_uri_vsnprintf          sqlite3_api->xvsnprintf
#define sqlite3_wal_checkpoint_v2      sqlite3_api->wal_checkpoint_v2
/* Version 3.8.7 and later */
#define sqlite3_auto_extension         sqlite3_api->auto_extension
#define sqlite3_bind_blob64            sqlite3_api->bind_blob64
#define sqlite3_bind_text64            sqlite3_api->bind_text64
#define sqlite3_cancel_auto_extension  sqlite3_api->cancel_auto_extension
#define sqlite3_load_extension         sqlite3_api->load_extension
#define sqlite3_malloc64               sqlite3_api->malloc64
#define sqlite3_msize                  sqlite3_api->msize
#define sqlite3_realloc64              sqlite3_api->realloc64
#define sqlite3_reset_auto_extension   sqlite3_api->reset_auto_extension
#define sqlite3_result_blob64          sqlite3_api->result_blob64
#define sqlite3_result_text64          sqlite3_api->result_text64
#define sqlite3_strglob                sqlite3_api->strglob
/* Version 3.8.11 and later */
#define sqlite3_value_dup              sqlite3_api->value_dup
#define sqlite3_value_free             sqlite3_api->value_free
#define sqlite3_result_zeroblob64      sqlite3_api->result_zeroblob64
#define sqlite3_bind_zeroblob64        sqlite3_api->bind_zeroblob64
/* Version 3.9.0 and later */
#define sqlite3_value_subtype          sqlite3_api->value_subtype
#define sqlite3_result_subtype         sqlite3_api->result_subtype
/* Version 3.10.0 and later */
#define sqlite3_status64               sqlite3_api->status64
#define sqlite3_strlike                sqlite3_api->strlike
#define sqlite3_db_cacheflush          sqlite3_api->db_cacheflush
/* Version 3.12.0 and later */
#define sqlite3_system_errno           sqlite3_api->system_errno
/* Version 3.14.0 and later */
#define sqlite3_trace_v2               sqlite3_api->trace_v2
#define sqlite3_expanded_sql           sqlite3_api->expanded_sql
/* Version 3.18.0 and later */
#define sqlite3_set_last_insert_rowid  sqlite3_api->set_last_insert_rowid
/* Version 3.20.0 and later */
#define sqlite3_prepare_v3             sqlite3_api->prepare_v3
#define sqlite3_prepare16_v3           sqlite3_api->prepare16_v3
#define sqlite3_bind_pointer           sqlite3_api->bind_pointer
#define sqlite3_result_pointer         sqlite3_api->result_pointer
#define sqlite3_value_pointer          sqlite3_api->value_pointer
/* Version 3.22.0 and later */
#define sqlite3_vtab_nochange          sqlite3_api->vtab_nochange
#define sqlite3_value_nochange         sqlite3_api->value_nochange
#define sqlite3_vtab_collation         sqlite3_api->vtab_collation
/* Version 3.24.0 and later */
#define sqlite3_keyword_count          sqlite3_api->keyword_count
#define sqlite3_keyword_name           sqlite3_api->keyword_name
#define sqlite3_keyword_check          sqlite3_api->keyword_check
#define sqlite3_str_new                sqlite3_api->str_new
#define sqlite3_str_finish             sqlite3_api->str_finish
#define sqlite3_str_appendf            sqlite3_api->str_appendf
#define sqlite3_str_vappendf           sqlite3_api->str_vappendf
#define sqlite3_str_append             sqlite3_api->str_append
#define sqlite3_str_appendall          sqlite3_api->str_appendall
#define sqlite3_str_appendchar         sqlite3_api->str_appendchar
#define sqlite3_str_reset              sqlite3_api->str_reset
#define sqlite3_str_errcode            sqlite3_api->str_errcode
#define sqlite3_str_length             sqlite3_api->str_length
#define sqlite3_str_value              sqlite3_api->str_value
/* Version 3.25.0 and later */
#define sqlite3_create_window_function sqlite3_api->create_window_function
/* Version 3.26.0 and later */
#define sqlite3_normalized_sql         sqlite3_api->normalized_sql
/* Version 3.28.0 and later */
#define sqlite3_stmt_isexplain         sqlite3_api->stmt_isexplain
#define sqlite3_value_frombind         sqlite3_api->value_frombind
/* Version 3.30.0 and later */
#define sqlite3_drop_modules           sqlite3_api->drop_modules
/* Version 3.31.0 and later */
#define sqlite3_hard_heap_limit64      sqlite3_api->hard_heap_limit64
#define sqlite3_uri_key                sqlite3_api->uri_key
#define sqlite3_filename_database      sqlite3_api->filename_database
#define sqlite3_filename_journal       sqlite3_api->filename_journal
#define sqlite3_filename_wal           sqlite3_api->filename_wal
/* Version 3.32.0 and later */
#define sqlite3_create_filename        sqlite3_api->create_filename
#define sqlite3_free_filename          sqlite3_api->free_filename
#define sqlite3_database_file_object   sqlite3_api->database_file_object
/* Version 3.34.0 and later */
#define sqlite3_txn_state              sqlite3_api->txn_state
/* Version 3.36.1 and later */
#define sqlite3_changes64              sqlite3_api->changes64
#define sqlite3_total_changes64        sqlite3_api->total_changes64
/* Version 3.37.0 and later */
#define sqlite3_autovacuum_pages       sqlite3_api->autovacuum_pages
/* Version 3.38.0 and later */
#define sqlite3_error_offset           sqlite3_api->error_offset
#define sqlite3_vtab_rhs_value         sqlite3_api->vtab_rhs_value
#define sqlite3_vtab_distinct          sqlite3_api->vtab_distinct
#define sqlite3_vtab_in                sqlite3_api->vtab_in
#define sqlite3_vtab_in_first          sqlite3_api->vtab_in_first
#define sqlite3_vtab_in_next           sqlite3_api->vtab_in_next
/* Version 3.39.0 and later */
#ifndef SQLITE_OMIT_DESERIALIZE
#define sqlite3_deserialize            sqlite3_api->deserialize
#define sqlite3_serialize              sqlite3_api->serialize
#endif
#define sqlite3_db_name                sqlite3_api->db_name
/* Version 3.40.0 and later */
#define sqlite3_value_encoding         sqlite3_api->value_encoding
/* Version 3.41.0 and later */
#define sqlite3_is_interrupted         sqlite3_api->is_interrupted
/* Version 3.43.0 and later */
#define sqlite3_stmt_explain           sqlite3_api->stmt_explain
/* Version 3.44.0 and later */
#define sqlite3_get_clientdata         sqlite3_api->get_clientdata
#define sqlite3_set_clientdata         sqlite3_api->set_clientdata
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */

#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
  /* This case when the file really is being compiled as a loadable 
  ** extension */
# define SQLITE_EXTENSION_INIT1     const sqlite3_api_routines *sqlite3_api=0;
# define SQLITE_EXTENSION_INIT2(v)  sqlite3_api=v;
# define SQLITE_EXTENSION_INIT3     \
    extern const sqlite3_api_routines *sqlite3_api;
#else
  /* This case when the file is being statically linked into the 
  ** application */
# define SQLITE_EXTENSION_INIT1     /*no-op*/
# define SQLITE_EXTENSION_INIT2(v)  (void)v; /* unused parameter */
# define SQLITE_EXTENSION_INIT3     /*no-op*/
#endif

#endif /* SQLITE3EXT_H */

Added SQLite.Interop/src/ext/fts5.c.

more than 10,000 changes

Added SQLite.Interop/src/ext/percentile.c.

























































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
/*
** 2013-05-28
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains code to implement the percentile(Y,P) SQL function
** as described below:
**
**   (1)  The percentile(Y,P) function is an aggregate function taking
**        exactly two arguments.
**
**   (2)  If the P argument to percentile(Y,P) is not the same for every
**        row in the aggregate then an error is thrown.  The word "same"
**        in the previous sentence means that the value differ by less
**        than 0.001.
**
**   (3)  If the P argument to percentile(Y,P) evaluates to anything other
**        than a number in the range of 0.0 to 100.0 inclusive then an
**        error is thrown.
**
**   (4)  If any Y argument to percentile(Y,P) evaluates to a value that
**        is not NULL and is not numeric then an error is thrown.
**
**   (5)  If any Y argument to percentile(Y,P) evaluates to plus or minus
**        infinity then an error is thrown.  (SQLite always interprets NaN
**        values as NULL.)
**
**   (6)  Both Y and P in percentile(Y,P) can be arbitrary expressions,
**        including CASE WHEN expressions.
**
**   (7)  The percentile(Y,P) aggregate is able to handle inputs of at least
**        one million (1,000,000) rows.
**
**   (8)  If there are no non-NULL values for Y, then percentile(Y,P)
**        returns NULL.
**
**   (9)  If there is exactly one non-NULL value for Y, the percentile(Y,P)
**        returns the one Y value.
**
**  (10)  If there N non-NULL values of Y where N is two or more and
**        the Y values are ordered from least to greatest and a graph is
**        drawn from 0 to N-1 such that the height of the graph at J is
**        the J-th Y value and such that straight lines are drawn between
**        adjacent Y values, then the percentile(Y,P) function returns
**        the height of the graph at P*(N-1)/100.
**
**  (11)  The percentile(Y,P) function always returns either a floating
**        point number or NULL.
**
**  (12)  The percentile(Y,P) is implemented as a single C99 source-code
**        file that compiles into a shared-library or DLL that can be loaded
**        into SQLite using the sqlite3_load_extension() interface.
*/
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <string.h>
#include <stdlib.h>

/* The following object is the session context for a single percentile()
** function.  We have to remember all input Y values until the very end.
** Those values are accumulated in the Percentile.a[] array.
*/
typedef struct Percentile Percentile;
struct Percentile {
  unsigned nAlloc;     /* Number of slots allocated for a[] */
  unsigned nUsed;      /* Number of slots actually used in a[] */
  double rPct;         /* 1.0 more than the value for P */
  double *a;           /* Array of Y values */
};

/*
** Return TRUE if the input floating-point number is an infinity.
*/
static int isInfinity(double r){
  sqlite3_uint64 u;
  assert( sizeof(u)==sizeof(r) );
  memcpy(&u, &r, sizeof(u));
  return ((u>>52)&0x7ff)==0x7ff;
}

/*
** Return TRUE if two doubles differ by 0.001 or less
*/
static int sameValue(double a, double b){
  a -= b;
  return a>=-0.001 && a<=0.001;
}

/*
** The "step" function for percentile(Y,P) is called once for each
** input row.
*/
static void percentStep(sqlite3_context *pCtx, int argc, sqlite3_value **argv){
  Percentile *p;
  double rPct;
  int eType;
  double y;
  assert( argc==2 );

  /* Requirement 3:  P must be a number between 0 and 100 */
  eType = sqlite3_value_numeric_type(argv[1]);
  rPct = sqlite3_value_double(argv[1]);
  if( (eType!=SQLITE_INTEGER && eType!=SQLITE_FLOAT)
   || rPct<0.0 || rPct>100.0 ){
    sqlite3_result_error(pCtx, "2nd argument to percentile() is not "
                         "a number between 0.0 and 100.0", -1);
    return;
  }

  /* Allocate the session context. */
  p = (Percentile*)sqlite3_aggregate_context(pCtx, sizeof(*p));
  if( p==0 ) return;

  /* Remember the P value.  Throw an error if the P value is different
  ** from any prior row, per Requirement (2). */
  if( p->rPct==0.0 ){
    p->rPct = rPct+1.0;
  }else if( !sameValue(p->rPct,rPct+1.0) ){
    sqlite3_result_error(pCtx, "2nd argument to percentile() is not the "
                               "same for all input rows", -1);
    return;
  }

  /* Ignore rows for which Y is NULL */
  eType = sqlite3_value_type(argv[0]);
  if( eType==SQLITE_NULL ) return;

  /* If not NULL, then Y must be numeric.  Otherwise throw an error.
  ** Requirement 4 */
  if( eType!=SQLITE_INTEGER && eType!=SQLITE_FLOAT ){
    sqlite3_result_error(pCtx, "1st argument to percentile() is not "
                               "numeric", -1);
    return;
  }

  /* Throw an error if the Y value is infinity or NaN */
  y = sqlite3_value_double(argv[0]);
  if( isInfinity(y) ){
    sqlite3_result_error(pCtx, "Inf input to percentile()", -1);
    return;
  }

  /* Allocate and store the Y */
  if( p->nUsed>=p->nAlloc ){
    unsigned n = p->nAlloc*2 + 250;
    double *a = sqlite3_realloc64(p->a, sizeof(double)*n);
    if( a==0 ){
      sqlite3_free(p->a);
      memset(p, 0, sizeof(*p));
      sqlite3_result_error_nomem(pCtx);
      return;
    }
    p->nAlloc = n;
    p->a = a;
  }
  p->a[p->nUsed++] = y;
}

/*
** Compare to doubles for sorting using qsort()
*/
static int SQLITE_CDECL doubleCmp(const void *pA, const void *pB){
  double a = *(double*)pA;
  double b = *(double*)pB;
  if( a==b ) return 0;
  if( a<b ) return -1;
  return +1;
}

/*
** Called to compute the final output of percentile() and to clean
** up all allocated memory.
*/
static void percentFinal(sqlite3_context *pCtx){
  Percentile *p;
  unsigned i1, i2;
  double v1, v2;
  double ix, vx;
  p = (Percentile*)sqlite3_aggregate_context(pCtx, 0);
  if( p==0 ) return;
  if( p->a==0 ) return;
  if( p->nUsed ){
    qsort(p->a, p->nUsed, sizeof(double), doubleCmp);
    ix = (p->rPct-1.0)*(p->nUsed-1)*0.01;
    i1 = (unsigned)ix;
    i2 = ix==(double)i1 || i1==p->nUsed-1 ? i1 : i1+1;
    v1 = p->a[i1];
    v2 = p->a[i2];
    vx = v1 + (v2-v1)*(ix-i1);
    sqlite3_result_double(pCtx, vx);
  }
  sqlite3_free(p->a);
  memset(p, 0, sizeof(*p));
}


#ifdef _WIN32
__declspec(dllexport)
#endif
int sqlite3_percentile_init(
  sqlite3 *db, 
  char **pzErrMsg, 
  const sqlite3_api_routines *pApi
){
  int rc = SQLITE_OK;
  SQLITE_EXTENSION_INIT2(pApi);
  (void)pzErrMsg;  /* Unused parameter */
  rc = sqlite3_create_function(db, "percentile", 2, 
                               SQLITE_UTF8|SQLITE_INNOCUOUS, 0,
                               0, percentStep, percentFinal);
  return rc;
}

Added SQLite.Interop/src/ext/regexp.c.



































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
/*
** 2012-11-13
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** The code in this file implements a compact but reasonably
** efficient regular-expression matcher for posix extended regular
** expressions against UTF8 text.
**
** This file is an SQLite extension.  It registers a single function
** named "regexp(A,B)" where A is the regular expression and B is the
** string to be matched.  By registering this function, SQLite will also
** then implement the "B regexp A" operator.  Note that with the function
** the regular expression comes first, but with the operator it comes
** second.
**
**  The following regular expression syntax is supported:
**
**     X*      zero or more occurrences of X
**     X+      one or more occurrences of X
**     X?      zero or one occurrences of X
**     X{p,q}  between p and q occurrences of X
**     (X)     match X
**     X|Y     X or Y
**     ^X      X occurring at the beginning of the string
**     X$      X occurring at the end of the string
**     .       Match any single character
**     \c      Character c where c is one of \{}()[]|*+?.
**     \c      C-language escapes for c in afnrtv.  ex: \t or \n
**     \uXXXX  Where XXXX is exactly 4 hex digits, unicode value XXXX
**     \xXX    Where XX is exactly 2 hex digits, unicode value XX
**     [abc]   Any single character from the set abc
**     [^abc]  Any single character not in the set abc
**     [a-z]   Any single character in the range a-z
**     [^a-z]  Any single character not in the range a-z
**     \b      Word boundary
**     \w      Word character.  [A-Za-z0-9_]
**     \W      Non-word character
**     \d      Digit
**     \D      Non-digit
**     \s      Whitespace character
**     \S      Non-whitespace character
**
** A nondeterministic finite automaton (NFA) is used for matching, so the
** performance is bounded by O(N*M) where N is the size of the regular
** expression and M is the size of the input string.  The matcher never
** exhibits exponential behavior.  Note that the X{p,q} operator expands
** to p copies of X following by q-p copies of X? and that the size of the
** regular expression in the O(N*M) performance bound is computed after
** this expansion.
*/
#include <string.h>
#include <stdlib.h>
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1

/*
** The following #defines change the names of some functions implemented in
** this file to prevent name collisions with C-library functions of the
** same name.
*/
#define re_match   sqlite3re_match
#define re_compile sqlite3re_compile
#define re_free    sqlite3re_free

/* The end-of-input character */
#define RE_EOF            0    /* End of input */
#define RE_START  0xfffffff    /* Start of input - larger than an UTF-8 */

/* The NFA is implemented as sequence of opcodes taken from the following
** set.  Each opcode has a single integer argument.
*/
#define RE_OP_MATCH       1    /* Match the one character in the argument */
#define RE_OP_ANY         2    /* Match any one character.  (Implements ".") */
#define RE_OP_ANYSTAR     3    /* Special optimized version of .* */
#define RE_OP_FORK        4    /* Continue to both next and opcode at iArg */
#define RE_OP_GOTO        5    /* Jump to opcode at iArg */
#define RE_OP_ACCEPT      6    /* Halt and indicate a successful match */
#define RE_OP_CC_INC      7    /* Beginning of a [...] character class */
#define RE_OP_CC_EXC      8    /* Beginning of a [^...] character class */
#define RE_OP_CC_VALUE    9    /* Single value in a character class */
#define RE_OP_CC_RANGE   10    /* Range of values in a character class */
#define RE_OP_WORD       11    /* Perl word character [A-Za-z0-9_] */
#define RE_OP_NOTWORD    12    /* Not a perl word character */
#define RE_OP_DIGIT      13    /* digit:  [0-9] */
#define RE_OP_NOTDIGIT   14    /* Not a digit */
#define RE_OP_SPACE      15    /* space:  [ \t\n\r\v\f] */
#define RE_OP_NOTSPACE   16    /* Not a digit */
#define RE_OP_BOUNDARY   17    /* Boundary between word and non-word */
#define RE_OP_ATSTART    18    /* Currently at the start of the string */

#if defined(SQLITE_DEBUG)
/* Opcode names used for symbolic debugging */
static const char *ReOpName[] = {
  "EOF",
  "MATCH",
  "ANY",
  "ANYSTAR",
  "FORK",
  "GOTO",
  "ACCEPT",
  "CC_INC",
  "CC_EXC",
  "CC_VALUE",
  "CC_RANGE",
  "WORD",
  "NOTWORD",
  "DIGIT",
  "NOTDIGIT",
  "SPACE",
  "NOTSPACE",
  "BOUNDARY",
  "ATSTART",
};
#endif /* SQLITE_DEBUG */


/* Each opcode is a "state" in the NFA */
typedef unsigned short ReStateNumber;

/* Because this is an NFA and not a DFA, multiple states can be active at
** once.  An instance of the following object records all active states in
** the NFA.  The implementation is optimized for the common case where the
** number of actives states is small.
*/
typedef struct ReStateSet {
  unsigned nState;            /* Number of current states */
  ReStateNumber *aState;      /* Current states */
} ReStateSet;

/* An input string read one character at a time.
*/
typedef struct ReInput ReInput;
struct ReInput {
  const unsigned char *z;  /* All text */
  int i;                   /* Next byte to read */
  int mx;                  /* EOF when i>=mx */
};

/* A compiled NFA (or an NFA that is in the process of being compiled) is
** an instance of the following object.
*/
typedef struct ReCompiled ReCompiled;
struct ReCompiled {
  ReInput sIn;                /* Regular expression text */
  const char *zErr;           /* Error message to return */
  char *aOp;                  /* Operators for the virtual machine */
  int *aArg;                  /* Arguments to each operator */
  unsigned (*xNextChar)(ReInput*);  /* Next character function */
  unsigned char zInit[12];    /* Initial text to match */
  int nInit;                  /* Number of bytes in zInit */
  unsigned nState;            /* Number of entries in aOp[] and aArg[] */
  unsigned nAlloc;            /* Slots allocated for aOp[] and aArg[] */
};

/* Add a state to the given state set if it is not already there */
static void re_add_state(ReStateSet *pSet, int newState){
  unsigned i;
  for(i=0; i<pSet->nState; i++) if( pSet->aState[i]==newState ) return;
  pSet->aState[pSet->nState++] = (ReStateNumber)newState;
}

/* Extract the next unicode character from *pzIn and return it.  Advance
** *pzIn to the first byte past the end of the character returned.  To
** be clear:  this routine converts utf8 to unicode.  This routine is 
** optimized for the common case where the next character is a single byte.
*/
static unsigned re_next_char(ReInput *p){
  unsigned c;
  if( p->i>=p->mx ) return 0;
  c = p->z[p->i++];
  if( c>=0x80 ){
    if( (c&0xe0)==0xc0 && p->i<p->mx && (p->z[p->i]&0xc0)==0x80 ){
      c = (c&0x1f)<<6 | (p->z[p->i++]&0x3f);
      if( c<0x80 ) c = 0xfffd;
    }else if( (c&0xf0)==0xe0 && p->i+1<p->mx && (p->z[p->i]&0xc0)==0x80
           && (p->z[p->i+1]&0xc0)==0x80 ){
      c = (c&0x0f)<<12 | ((p->z[p->i]&0x3f)<<6) | (p->z[p->i+1]&0x3f);
      p->i += 2;
      if( c<=0x7ff || (c>=0xd800 && c<=0xdfff) ) c = 0xfffd;
    }else if( (c&0xf8)==0xf0 && p->i+2<p->mx && (p->z[p->i]&0xc0)==0x80
           && (p->z[p->i+1]&0xc0)==0x80 && (p->z[p->i+2]&0xc0)==0x80 ){
      c = (c&0x07)<<18 | ((p->z[p->i]&0x3f)<<12) | ((p->z[p->i+1]&0x3f)<<6)
                       | (p->z[p->i+2]&0x3f);
      p->i += 3;
      if( c<=0xffff || c>0x10ffff ) c = 0xfffd;
    }else{
      c = 0xfffd;
    }
  }
  return c;
}
static unsigned re_next_char_nocase(ReInput *p){
  unsigned c = re_next_char(p);
  if( c>='A' && c<='Z' ) c += 'a' - 'A';
  return c;
}

/* Return true if c is a perl "word" character:  [A-Za-z0-9_] */
static int re_word_char(int c){
  return (c>='0' && c<='9') || (c>='a' && c<='z')
      || (c>='A' && c<='Z') || c=='_';
}

/* Return true if c is a "digit" character:  [0-9] */
static int re_digit_char(int c){
  return (c>='0' && c<='9');
}

/* Return true if c is a perl "space" character:  [ \t\r\n\v\f] */
static int re_space_char(int c){
  return c==' ' || c=='\t' || c=='\n' || c=='\r' || c=='\v' || c=='\f';
}

/* Run a compiled regular expression on the zero-terminated input
** string zIn[].  Return true on a match and false if there is no match.
*/
static int re_match(ReCompiled *pRe, const unsigned char *zIn, int nIn){
  ReStateSet aStateSet[2], *pThis, *pNext;
  ReStateNumber aSpace[100];
  ReStateNumber *pToFree;
  unsigned int i = 0;
  unsigned int iSwap = 0;
  int c = RE_START;
  int cPrev = 0;
  int rc = 0;
  ReInput in;

  in.z = zIn;
  in.i = 0;
  in.mx = nIn>=0 ? nIn : (int)strlen((char const*)zIn);

  /* Look for the initial prefix match, if there is one. */
  if( pRe->nInit ){
    unsigned char x = pRe->zInit[0];
    while( in.i+pRe->nInit<=in.mx 
     && (zIn[in.i]!=x ||
         strncmp((const char*)zIn+in.i, (const char*)pRe->zInit, pRe->nInit)!=0)
    ){
      in.i++;
    }
    if( in.i+pRe->nInit>in.mx ) return 0;
    c = RE_START-1;
  }

  if( pRe->nState<=(sizeof(aSpace)/(sizeof(aSpace[0])*2)) ){
    pToFree = 0;
    aStateSet[0].aState = aSpace;
  }else{
    pToFree = sqlite3_malloc64( sizeof(ReStateNumber)*2*pRe->nState );
    if( pToFree==0 ) return -1;
    aStateSet[0].aState = pToFree;
  }
  aStateSet[1].aState = &aStateSet[0].aState[pRe->nState];
  pNext = &aStateSet[1];
  pNext->nState = 0;
  re_add_state(pNext, 0);
  while( c!=RE_EOF && pNext->nState>0 ){
    cPrev = c;
    c = pRe->xNextChar(&in);
    pThis = pNext;
    pNext = &aStateSet[iSwap];
    iSwap = 1 - iSwap;
    pNext->nState = 0;
    for(i=0; i<pThis->nState; i++){
      int x = pThis->aState[i];
      switch( pRe->aOp[x] ){
        case RE_OP_MATCH: {
          if( pRe->aArg[x]==c ) re_add_state(pNext, x+1);
          break;
        }
        case RE_OP_ATSTART: {
          if( cPrev==RE_START ) re_add_state(pThis, x+1);
          break;
        }
        case RE_OP_ANY: {
          if( c!=0 ) re_add_state(pNext, x+1);
          break;
        }
        case RE_OP_WORD: {
          if( re_word_char(c) ) re_add_state(pNext, x+1);
          break;
        }
        case RE_OP_NOTWORD: {
          if( !re_word_char(c) && c!=0 ) re_add_state(pNext, x+1);
          break;
        }
        case RE_OP_DIGIT: {
          if( re_digit_char(c) ) re_add_state(pNext, x+1);
          break;
        }
        case RE_OP_NOTDIGIT: {
          if( !re_digit_char(c) && c!=0 ) re_add_state(pNext, x+1);
          break;
        }
        case RE_OP_SPACE: {
          if( re_space_char(c) ) re_add_state(pNext, x+1);
          break;
        }
        case RE_OP_NOTSPACE: {
          if( !re_space_char(c) && c!=0 ) re_add_state(pNext, x+1);
          break;
        }
        case RE_OP_BOUNDARY: {
          if( re_word_char(c)!=re_word_char(cPrev) ) re_add_state(pThis, x+1);
          break;
        }
        case RE_OP_ANYSTAR: {
          re_add_state(pNext, x);
          re_add_state(pThis, x+1);
          break;
        }
        case RE_OP_FORK: {
          re_add_state(pThis, x+pRe->aArg[x]);
          re_add_state(pThis, x+1);
          break;
        }
        case RE_OP_GOTO: {
          re_add_state(pThis, x+pRe->aArg[x]);
          break;
        }
        case RE_OP_ACCEPT: {
          rc = 1;
          goto re_match_end;
        }
        case RE_OP_CC_EXC: {
          if( c==0 ) break;
          /* fall-through */ goto re_op_cc_inc;
        }
        case RE_OP_CC_INC: re_op_cc_inc: {
          int j = 1;
          int n = pRe->aArg[x];
          int hit = 0;
          for(j=1; j>0 && j<n; j++){
            if( pRe->aOp[x+j]==RE_OP_CC_VALUE ){
              if( pRe->aArg[x+j]==c ){
                hit = 1;
                j = -1;
              }
            }else{
              if( pRe->aArg[x+j]<=c && pRe->aArg[x+j+1]>=c ){
                hit = 1;
                j = -1;
              }else{
                j++;
              }
            }
          }
          if( pRe->aOp[x]==RE_OP_CC_EXC ) hit = !hit;
          if( hit ) re_add_state(pNext, x+n);
          break;
        }
      }
    }
  }
  for(i=0; i<pNext->nState; i++){
    int x = pNext->aState[i];
    while( pRe->aOp[x]==RE_OP_GOTO ) x += pRe->aArg[x];
    if( pRe->aOp[x]==RE_OP_ACCEPT ){ rc = 1; break; }
  }
re_match_end:
  sqlite3_free(pToFree);
  return rc;
}

/* Resize the opcode and argument arrays for an RE under construction.
*/
static int re_resize(ReCompiled *p, int N){
  char *aOp;
  int *aArg;
  aOp = sqlite3_realloc64(p->aOp, N*sizeof(p->aOp[0]));
  if( aOp==0 ) return 1;
  p->aOp = aOp;
  aArg = sqlite3_realloc64(p->aArg, N*sizeof(p->aArg[0]));
  if( aArg==0 ) return 1;
  p->aArg = aArg;
  p->nAlloc = N;
  return 0;
}

/* Insert a new opcode and argument into an RE under construction.  The
** insertion point is just prior to existing opcode iBefore.
*/
static int re_insert(ReCompiled *p, int iBefore, int op, int arg){
  int i;
  if( p->nAlloc<=p->nState && re_resize(p, p->nAlloc*2) ) return 0;
  for(i=p->nState; i>iBefore; i--){
    p->aOp[i] = p->aOp[i-1];
    p->aArg[i] = p->aArg[i-1];
  }
  p->nState++;
  p->aOp[iBefore] = (char)op;
  p->aArg[iBefore] = arg;
  return iBefore;
}

/* Append a new opcode and argument to the end of the RE under construction.
*/
static int re_append(ReCompiled *p, int op, int arg){
  return re_insert(p, p->nState, op, arg);
}

/* Make a copy of N opcodes starting at iStart onto the end of the RE
** under construction.
*/
static void re_copy(ReCompiled *p, int iStart, int N){
  if( p->nState+N>=p->nAlloc && re_resize(p, p->nAlloc*2+N) ) return;
  memcpy(&p->aOp[p->nState], &p->aOp[iStart], N*sizeof(p->aOp[0]));
  memcpy(&p->aArg[p->nState], &p->aArg[iStart], N*sizeof(p->aArg[0]));
  p->nState += N;
}

/* Return true if c is a hexadecimal digit character:  [0-9a-fA-F]
** If c is a hex digit, also set *pV = (*pV)*16 + valueof(c).  If
** c is not a hex digit *pV is unchanged.
*/
static int re_hex(int c, int *pV){
  if( c>='0' && c<='9' ){
    c -= '0';
  }else if( c>='a' && c<='f' ){
    c -= 'a' - 10;
  }else if( c>='A' && c<='F' ){
    c -= 'A' - 10;
  }else{
    return 0;
  }
  *pV = (*pV)*16 + (c & 0xff);
  return 1;
}

/* A backslash character has been seen, read the next character and
** return its interpretation.
*/
static unsigned re_esc_char(ReCompiled *p){
  static const char zEsc[] = "afnrtv\\()*.+?[$^{|}]";
  static const char zTrans[] = "\a\f\n\r\t\v";
  int i, v = 0;
  char c;
  if( p->sIn.i>=p->sIn.mx ) return 0;
  c = p->sIn.z[p->sIn.i];
  if( c=='u' && p->sIn.i+4<p->sIn.mx ){
    const unsigned char *zIn = p->sIn.z + p->sIn.i;
    if( re_hex(zIn[1],&v)
     && re_hex(zIn[2],&v)
     && re_hex(zIn[3],&v)
     && re_hex(zIn[4],&v)
    ){
      p->sIn.i += 5;
      return v;
    }
  }
  if( c=='x' && p->sIn.i+2<p->sIn.mx ){
    const unsigned char *zIn = p->sIn.z + p->sIn.i;
    if( re_hex(zIn[1],&v)
     && re_hex(zIn[2],&v)
    ){
      p->sIn.i += 3;
      return v;
    }
  }
  for(i=0; zEsc[i] && zEsc[i]!=c; i++){}
  if( zEsc[i] ){
    if( i<6 ) c = zTrans[i];
    p->sIn.i++;
  }else{
    p->zErr = "unknown \\ escape";
  }
  return c;
}

/* Forward declaration */
static const char *re_subcompile_string(ReCompiled*);

/* Peek at the next byte of input */
static unsigned char rePeek(ReCompiled *p){
  return p->sIn.i<p->sIn.mx ? p->sIn.z[p->sIn.i] : 0;
}

/* Compile RE text into a sequence of opcodes.  Continue up to the
** first unmatched ")" character, then return.  If an error is found,
** return a pointer to the error message string.
*/
static const char *re_subcompile_re(ReCompiled *p){
  const char *zErr;
  int iStart, iEnd, iGoto;
  iStart = p->nState;
  zErr = re_subcompile_string(p);
  if( zErr ) return zErr;
  while( rePeek(p)=='|' ){
    iEnd = p->nState;
    re_insert(p, iStart, RE_OP_FORK, iEnd + 2 - iStart);
    iGoto = re_append(p, RE_OP_GOTO, 0);
    p->sIn.i++;
    zErr = re_subcompile_string(p);
    if( zErr ) return zErr;
    p->aArg[iGoto] = p->nState - iGoto;
  }
  return 0;
}

/* Compile an element of regular expression text (anything that can be
** an operand to the "|" operator).  Return NULL on success or a pointer
** to the error message if there is a problem.
*/
static const char *re_subcompile_string(ReCompiled *p){
  int iPrev = -1;
  int iStart;
  unsigned c;
  const char *zErr;
  while( (c = p->xNextChar(&p->sIn))!=0 ){
    iStart = p->nState;
    switch( c ){
      case '|':
      case ')': {
        p->sIn.i--;
        return 0;
      }
      case '(': {
        zErr = re_subcompile_re(p);
        if( zErr ) return zErr;
        if( rePeek(p)!=')' ) return "unmatched '('";
        p->sIn.i++;
        break;
      }
      case '.': {
        if( rePeek(p)=='*' ){
          re_append(p, RE_OP_ANYSTAR, 0);
          p->sIn.i++;
        }else{
          re_append(p, RE_OP_ANY, 0);
        }
        break;
      }
      case '*': {
        if( iPrev<0 ) return "'*' without operand";
        re_insert(p, iPrev, RE_OP_GOTO, p->nState - iPrev + 1);
        re_append(p, RE_OP_FORK, iPrev - p->nState + 1);
        break;
      }
      case '+': {
        if( iPrev<0 ) return "'+' without operand";
        re_append(p, RE_OP_FORK, iPrev - p->nState);
        break;
      }
      case '?': {
        if( iPrev<0 ) return "'?' without operand";
        re_insert(p, iPrev, RE_OP_FORK, p->nState - iPrev+1);
        break;
      }
      case '$': {
        re_append(p, RE_OP_MATCH, RE_EOF);
        break;
      }
      case '^': {
        re_append(p, RE_OP_ATSTART, 0);
        break;
      }
      case '{': {
        int m = 0, n = 0;
        int sz, j;
        if( iPrev<0 ) return "'{m,n}' without operand";
        while( (c=rePeek(p))>='0' && c<='9' ){ m = m*10 + c - '0'; p->sIn.i++; }
        n = m;
        if( c==',' ){
          p->sIn.i++;
          n = 0;
          while( (c=rePeek(p))>='0' && c<='9' ){ n = n*10 + c-'0'; p->sIn.i++; }
        }
        if( c!='}' ) return "unmatched '{'";
        if( n>0 && n<m ) return "n less than m in '{m,n}'";
        p->sIn.i++;
        sz = p->nState - iPrev;
        if( m==0 ){
          if( n==0 ) return "both m and n are zero in '{m,n}'";
          re_insert(p, iPrev, RE_OP_FORK, sz+1);
          iPrev++;
          n--;
        }else{
          for(j=1; j<m; j++) re_copy(p, iPrev, sz);
        }
        for(j=m; j<n; j++){
          re_append(p, RE_OP_FORK, sz+1);
          re_copy(p, iPrev, sz);
        }
        if( n==0 && m>0 ){
          re_append(p, RE_OP_FORK, -sz);
        }
        break;
      }
      case '[': {
        unsigned int iFirst = p->nState;
        if( rePeek(p)=='^' ){
          re_append(p, RE_OP_CC_EXC, 0);
          p->sIn.i++;
        }else{
          re_append(p, RE_OP_CC_INC, 0);
        }
        while( (c = p->xNextChar(&p->sIn))!=0 ){
          if( c=='[' && rePeek(p)==':' ){
            return "POSIX character classes not supported";
          }
          if( c=='\\' ) c = re_esc_char(p);
          if( rePeek(p)=='-' ){
            re_append(p, RE_OP_CC_RANGE, c);
            p->sIn.i++;
            c = p->xNextChar(&p->sIn);
            if( c=='\\' ) c = re_esc_char(p);
            re_append(p, RE_OP_CC_RANGE, c);
          }else{
            re_append(p, RE_OP_CC_VALUE, c);
          }
          if( rePeek(p)==']' ){ p->sIn.i++; break; }
        }
        if( c==0 ) return "unclosed '['";
        if( p->nState>iFirst ) p->aArg[iFirst] = p->nState - iFirst;
        break;
      }
      case '\\': {
        int specialOp = 0;
        switch( rePeek(p) ){
          case 'b': specialOp = RE_OP_BOUNDARY;   break;
          case 'd': specialOp = RE_OP_DIGIT;      break;
          case 'D': specialOp = RE_OP_NOTDIGIT;   break;
          case 's': specialOp = RE_OP_SPACE;      break;
          case 'S': specialOp = RE_OP_NOTSPACE;   break;
          case 'w': specialOp = RE_OP_WORD;       break;
          case 'W': specialOp = RE_OP_NOTWORD;    break;
        }
        if( specialOp ){
          p->sIn.i++;
          re_append(p, specialOp, 0);
        }else{
          c = re_esc_char(p);
          re_append(p, RE_OP_MATCH, c);
        }
        break;
      }
      default: {
        re_append(p, RE_OP_MATCH, c);
        break;
      }
    }
    iPrev = iStart;
  }
  return 0;
}

/* Free and reclaim all the memory used by a previously compiled
** regular expression.  Applications should invoke this routine once
** for every call to re_compile() to avoid memory leaks.
*/
static void re_free(ReCompiled *pRe){
  if( pRe ){
    sqlite3_free(pRe->aOp);
    sqlite3_free(pRe->aArg);
    sqlite3_free(pRe);
  }
}

/*
** Compile a textual regular expression in zIn[] into a compiled regular
** expression suitable for us by re_match() and return a pointer to the
** compiled regular expression in *ppRe.  Return NULL on success or an
** error message if something goes wrong.
*/
static const char *re_compile(ReCompiled **ppRe, const char *zIn, int noCase){
  ReCompiled *pRe;
  const char *zErr;
  int i, j;

  *ppRe = 0;
  pRe = sqlite3_malloc( sizeof(*pRe) );
  if( pRe==0 ){
    return "out of memory";
  }
  memset(pRe, 0, sizeof(*pRe));
  pRe->xNextChar = noCase ? re_next_char_nocase : re_next_char;
  if( re_resize(pRe, 30) ){
    re_free(pRe);
    return "out of memory";
  }
  if( zIn[0]=='^' ){
    zIn++;
  }else{
    re_append(pRe, RE_OP_ANYSTAR, 0);
  }
  pRe->sIn.z = (unsigned char*)zIn;
  pRe->sIn.i = 0;
  pRe->sIn.mx = (int)strlen(zIn);
  zErr = re_subcompile_re(pRe);
  if( zErr ){
    re_free(pRe);
    return zErr;
  }
  if( pRe->sIn.i>=pRe->sIn.mx ){
    re_append(pRe, RE_OP_ACCEPT, 0);
    *ppRe = pRe;
  }else{
    re_free(pRe);
    return "unrecognized character";
  }

  /* The following is a performance optimization.  If the regex begins with
  ** ".*" (if the input regex lacks an initial "^") and afterwards there are
  ** one or more matching characters, enter those matching characters into
  ** zInit[].  The re_match() routine can then search ahead in the input 
  ** string looking for the initial match without having to run the whole
  ** regex engine over the string.  Do not worry about trying to match
  ** unicode characters beyond plane 0 - those are very rare and this is
  ** just an optimization. */
  if( pRe->aOp[0]==RE_OP_ANYSTAR && !noCase ){
    for(j=0, i=1; j<(int)sizeof(pRe->zInit)-2 && pRe->aOp[i]==RE_OP_MATCH; i++){
      unsigned x = pRe->aArg[i];
      if( x<=0x7f ){
        pRe->zInit[j++] = (unsigned char)x;
      }else if( x<=0x7ff ){
        pRe->zInit[j++] = (unsigned char)(0xc0 | (x>>6));
        pRe->zInit[j++] = 0x80 | (x&0x3f);
      }else if( x<=0xffff ){
        pRe->zInit[j++] = (unsigned char)(0xe0 | (x>>12));
        pRe->zInit[j++] = 0x80 | ((x>>6)&0x3f);
        pRe->zInit[j++] = 0x80 | (x&0x3f);
      }else{
        break;
      }
    }
    if( j>0 && pRe->zInit[j-1]==0 ) j--;
    pRe->nInit = j;
  }
  return pRe->zErr;
}

/*
** Implementation of the regexp() SQL function.  This function implements
** the build-in REGEXP operator.  The first argument to the function is the
** pattern and the second argument is the string.  So, the SQL statements:
**
**       A REGEXP B
**
** is implemented as regexp(B,A).
*/
static void re_sql_func(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  ReCompiled *pRe;          /* Compiled regular expression */
  const char *zPattern;     /* The regular expression */
  const unsigned char *zStr;/* String being searched */
  const char *zErr;         /* Compile error message */
  int setAux = 0;           /* True to invoke sqlite3_set_auxdata() */

  (void)argc;  /* Unused */
  pRe = sqlite3_get_auxdata(context, 0);
  if( pRe==0 ){
    zPattern = (const char*)sqlite3_value_text(argv[0]);
    if( zPattern==0 ) return;
    zErr = re_compile(&pRe, zPattern, sqlite3_user_data(context)!=0);
    if( zErr ){
      re_free(pRe);
      sqlite3_result_error(context, zErr, -1);
      return;
    }
    if( pRe==0 ){
      sqlite3_result_error_nomem(context);
      return;
    }
    setAux = 1;
  }
  zStr = (const unsigned char*)sqlite3_value_text(argv[1]);
  if( zStr!=0 ){
    sqlite3_result_int(context, re_match(pRe, zStr, -1));
  }
  if( setAux ){
    sqlite3_set_auxdata(context, 0, pRe, (void(*)(void*))re_free);
  }
}

#if defined(SQLITE_DEBUG)
/*
** This function is used for testing and debugging only.  It is only available
** if the SQLITE_DEBUG compile-time option is used.
**
** Compile a regular expression and then convert the compiled expression into
** text and return that text.
*/
static void re_bytecode_func(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  const char *zPattern;
  const char *zErr;
  ReCompiled *pRe;
  sqlite3_str *pStr;
  int i;
  int n;
  char *z;
  (void)argc;

  zPattern = (const char*)sqlite3_value_text(argv[0]);
  if( zPattern==0 ) return;
  zErr = re_compile(&pRe, zPattern, sqlite3_user_data(context)!=0);
  if( zErr ){
    re_free(pRe);
    sqlite3_result_error(context, zErr, -1);
    return;
  }
  if( pRe==0 ){
    sqlite3_result_error_nomem(context);
    return;
  }
  pStr = sqlite3_str_new(0);
  if( pStr==0 ) goto re_bytecode_func_err;
  if( pRe->nInit>0 ){
    sqlite3_str_appendf(pStr, "INIT     ");
    for(i=0; i<pRe->nInit; i++){
      sqlite3_str_appendf(pStr, "%02x", pRe->zInit[i]);
    }
    sqlite3_str_appendf(pStr, "\n");
  }
  for(i=0; (unsigned)i<pRe->nState; i++){
    sqlite3_str_appendf(pStr, "%-8s %4d\n",
         ReOpName[(unsigned char)pRe->aOp[i]], pRe->aArg[i]);
  }
  n = sqlite3_str_length(pStr);
  z = sqlite3_str_finish(pStr);
  if( n==0 ){
    sqlite3_free(z);
  }else{
    sqlite3_result_text(context, z, n-1, sqlite3_free);
  }

re_bytecode_func_err:
  re_free(pRe);
}

#endif /* SQLITE_DEBUG */


/*
** Invoke this routine to register the regexp() function with the
** SQLite database connection.
*/
#ifdef _WIN32
__declspec(dllexport)
#endif
int sqlite3_regexp_init(
  sqlite3 *db, 
  char **pzErrMsg, 
  const sqlite3_api_routines *pApi
){
  int rc = SQLITE_OK;
  SQLITE_EXTENSION_INIT2(pApi);
  (void)pzErrMsg;  /* Unused */
  rc = sqlite3_create_function(db, "regexp", 2, 
                            SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
                            0, re_sql_func, 0, 0);
  if( rc==SQLITE_OK ){
    /* The regexpi(PATTERN,STRING) function is a case-insensitive version
    ** of regexp(PATTERN,STRING). */
    rc = sqlite3_create_function(db, "regexpi", 2,
                            SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
                            (void*)db, re_sql_func, 0, 0);
#if defined(SQLITE_DEBUG)
    if( rc==SQLITE_OK ){
      rc = sqlite3_create_function(db, "regexp_bytecode", 1,
                            SQLITE_UTF8|SQLITE_INNOCUOUS|SQLITE_DETERMINISTIC,
                            0, re_bytecode_func, 0, 0);
    }
#endif /* SQLITE_DEBUG */
  }
  return rc;
}

Added SQLite.Interop/src/ext/sha1.c.



















































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
/*
** 2017-01-27
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This SQLite extension implements functions that compute SHA1 hashes.
** Two SQL functions are implemented:
**
**     sha1(X)
**     sha1_query(Y)
**
** The sha1(X) function computes the SHA1 hash of the input X, or NULL if
** X is NULL.
**
** The sha1_query(Y) function evalutes all queries in the SQL statements of Y
** and returns a hash of their results.
*/
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <string.h>
#include <stdarg.h>

/******************************************************************************
** The Hash Engine
*/
/* Context for the SHA1 hash */
typedef struct SHA1Context SHA1Context;
struct SHA1Context {
  unsigned int state[5];
  unsigned int count[2];
  unsigned char buffer[64];
};

#define SHA_ROT(x,l,r) ((x) << (l) | (x) >> (r))
#define rol(x,k) SHA_ROT(x,k,32-(k))
#define ror(x,k) SHA_ROT(x,32-(k),k)

#define blk0le(i) (block[i] = (ror(block[i],8)&0xFF00FF00) \
    |(rol(block[i],8)&0x00FF00FF))
#define blk0be(i) block[i]
#define blk(i) (block[i&15] = rol(block[(i+13)&15]^block[(i+8)&15] \
    ^block[(i+2)&15]^block[i&15],1))

/*
 * (R0+R1), R2, R3, R4 are the different operations (rounds) used in SHA1
 *
 * Rl0() for little-endian and Rb0() for big-endian.  Endianness is
 * determined at run-time.
 */
#define Rl0(v,w,x,y,z,i) \
    z+=((w&(x^y))^y)+blk0le(i)+0x5A827999+rol(v,5);w=ror(w,2);
#define Rb0(v,w,x,y,z,i) \
    z+=((w&(x^y))^y)+blk0be(i)+0x5A827999+rol(v,5);w=ror(w,2);
#define R1(v,w,x,y,z,i) \
    z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=ror(w,2);
#define R2(v,w,x,y,z,i) \
    z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=ror(w,2);
#define R3(v,w,x,y,z,i) \
    z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=ror(w,2);
#define R4(v,w,x,y,z,i) \
    z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=ror(w,2);

/*
 * Hash a single 512-bit block. This is the core of the algorithm.
 */
static void SHA1Transform(unsigned int state[5], const unsigned char buffer[64]){
  unsigned int qq[5]; /* a, b, c, d, e; */
  static int one = 1;
  unsigned int block[16];
  memcpy(block, buffer, 64);
  memcpy(qq,state,5*sizeof(unsigned int));

#define a qq[0]
#define b qq[1]
#define c qq[2]
#define d qq[3]
#define e qq[4]

  /* Copy p->state[] to working vars */
  /*
  a = state[0];
  b = state[1];
  c = state[2];
  d = state[3];
  e = state[4];
  */

  /* 4 rounds of 20 operations each. Loop unrolled. */
  if( 1 == *(unsigned char*)&one ){
    Rl0(a,b,c,d,e, 0); Rl0(e,a,b,c,d, 1); Rl0(d,e,a,b,c, 2); Rl0(c,d,e,a,b, 3);
    Rl0(b,c,d,e,a, 4); Rl0(a,b,c,d,e, 5); Rl0(e,a,b,c,d, 6); Rl0(d,e,a,b,c, 7);
    Rl0(c,d,e,a,b, 8); Rl0(b,c,d,e,a, 9); Rl0(a,b,c,d,e,10); Rl0(e,a,b,c,d,11);
    Rl0(d,e,a,b,c,12); Rl0(c,d,e,a,b,13); Rl0(b,c,d,e,a,14); Rl0(a,b,c,d,e,15);
  }else{
    Rb0(a,b,c,d,e, 0); Rb0(e,a,b,c,d, 1); Rb0(d,e,a,b,c, 2); Rb0(c,d,e,a,b, 3);
    Rb0(b,c,d,e,a, 4); Rb0(a,b,c,d,e, 5); Rb0(e,a,b,c,d, 6); Rb0(d,e,a,b,c, 7);
    Rb0(c,d,e,a,b, 8); Rb0(b,c,d,e,a, 9); Rb0(a,b,c,d,e,10); Rb0(e,a,b,c,d,11);
    Rb0(d,e,a,b,c,12); Rb0(c,d,e,a,b,13); Rb0(b,c,d,e,a,14); Rb0(a,b,c,d,e,15);
  }
  R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
  R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
  R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
  R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
  R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
  R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
  R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
  R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
  R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
  R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
  R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
  R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
  R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
  R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
  R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
  R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);

  /* Add the working vars back into context.state[] */
  state[0] += a;
  state[1] += b;
  state[2] += c;
  state[3] += d;
  state[4] += e;

#undef a
#undef b
#undef c
#undef d
#undef e
}


/* Initialize a SHA1 context */
static void hash_init(SHA1Context *p){
  /* SHA1 initialization constants */
  p->state[0] = 0x67452301;
  p->state[1] = 0xEFCDAB89;
  p->state[2] = 0x98BADCFE;
  p->state[3] = 0x10325476;
  p->state[4] = 0xC3D2E1F0;
  p->count[0] = p->count[1] = 0;
}

/* Add new content to the SHA1 hash */
static void hash_step(
  SHA1Context *p,                 /* Add content to this context */
  const unsigned char *data,      /* Data to be added */
  unsigned int len                /* Number of bytes in data */
){
  unsigned int i, j;

  j = p->count[0];
  if( (p->count[0] += len << 3) < j ){
    p->count[1] += (len>>29)+1;
  }
  j = (j >> 3) & 63;
  if( (j + len) > 63 ){
    (void)memcpy(&p->buffer[j], data, (i = 64-j));
    SHA1Transform(p->state, p->buffer);
    for(; i + 63 < len; i += 64){
      SHA1Transform(p->state, &data[i]);
    }
    j = 0;
  }else{
    i = 0;
  }
  (void)memcpy(&p->buffer[j], &data[i], len - i);
}

/* Compute a string using sqlite3_vsnprintf() and hash it */
static void hash_step_vformat(
  SHA1Context *p,                 /* Add content to this context */
  const char *zFormat,
  ...
){
  va_list ap;
  int n;
  char zBuf[50];
  va_start(ap, zFormat);
  sqlite3_vsnprintf(sizeof(zBuf),zBuf,zFormat,ap);
  va_end(ap);
  n = (int)strlen(zBuf);
  hash_step(p, (unsigned char*)zBuf, n);
}


/* Add padding and compute the message digest.  Render the
** message digest as lower-case hexadecimal and put it into
** zOut[].  zOut[] must be at least 41 bytes long. */
static void hash_finish(
  SHA1Context *p,           /* The SHA1 context to finish and render */
  char *zOut                /* Store hexadecimal hash here */
){
  unsigned int i;
  unsigned char finalcount[8];
  unsigned char digest[20];
  static const char zEncode[] = "0123456789abcdef";

  for (i = 0; i < 8; i++){
    finalcount[i] = (unsigned char)((p->count[(i >= 4 ? 0 : 1)]
       >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */
  }
  hash_step(p, (const unsigned char *)"\200", 1);
  while ((p->count[0] & 504) != 448){
    hash_step(p, (const unsigned char *)"\0", 1);
  }
  hash_step(p, finalcount, 8);  /* Should cause a SHA1Transform() */
  for (i = 0; i < 20; i++){
    digest[i] = (unsigned char)((p->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
  }
  for(i=0; i<20; i++){
    zOut[i*2] = zEncode[(digest[i]>>4)&0xf];
    zOut[i*2+1] = zEncode[digest[i] & 0xf];
  }
  zOut[i*2]= 0;
}
/* End of the hashing logic
*****************************************************************************/

/*
** Implementation of the sha1(X) function.
**
** Return a lower-case hexadecimal rendering of the SHA1 hash of the
** argument X.  If X is a BLOB, it is hashed as is.  For all other
** types of input, X is converted into a UTF-8 string and the string
** is hash without the trailing 0x00 terminator.  The hash of a NULL
** value is NULL.
*/
static void sha1Func(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  SHA1Context cx;
  int eType = sqlite3_value_type(argv[0]);
  int nByte = sqlite3_value_bytes(argv[0]);
  char zOut[44];

  assert( argc==1 );
  if( eType==SQLITE_NULL ) return;
  hash_init(&cx);
  if( eType==SQLITE_BLOB ){
    hash_step(&cx, sqlite3_value_blob(argv[0]), nByte);
  }else{
    hash_step(&cx, sqlite3_value_text(argv[0]), nByte);
  }
  hash_finish(&cx, zOut);
  sqlite3_result_text(context, zOut, 40, SQLITE_TRANSIENT);
}

/*
** Implementation of the sha1_query(SQL) function.
**
** This function compiles and runs the SQL statement(s) given in the
** argument. The results are hashed using SHA1 and that hash is returned.
**
** The original SQL text is included as part of the hash.
**
** The hash is not just a concatenation of the outputs.  Each query
** is delimited and each row and value within the query is delimited,
** with all values being marked with their datatypes.
*/
static void sha1QueryFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  sqlite3 *db = sqlite3_context_db_handle(context);
  const char *zSql = (const char*)sqlite3_value_text(argv[0]);
  sqlite3_stmt *pStmt = 0;
  int nCol;                   /* Number of columns in the result set */
  int i;                      /* Loop counter */
  int rc;
  int n;
  const char *z;
  SHA1Context cx;
  char zOut[44];

  assert( argc==1 );
  if( zSql==0 ) return;
  hash_init(&cx);
  while( zSql[0] ){
    rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zSql);
    if( rc ){
      char *zMsg = sqlite3_mprintf("error SQL statement [%s]: %s",
                                   zSql, sqlite3_errmsg(db));
      sqlite3_finalize(pStmt);
      sqlite3_result_error(context, zMsg, -1);
      sqlite3_free(zMsg);
      return;
    }
    if( !sqlite3_stmt_readonly(pStmt) ){
      char *zMsg = sqlite3_mprintf("non-query: [%s]", sqlite3_sql(pStmt));
      sqlite3_finalize(pStmt);
      sqlite3_result_error(context, zMsg, -1);
      sqlite3_free(zMsg);
      return;
    }
    nCol = sqlite3_column_count(pStmt);
    z = sqlite3_sql(pStmt);
    n = (int)strlen(z);
    hash_step_vformat(&cx,"S%d:",n);
    hash_step(&cx,(unsigned char*)z,n);

    /* Compute a hash over the result of the query */
    while( SQLITE_ROW==sqlite3_step(pStmt) ){
      hash_step(&cx,(const unsigned char*)"R",1);
      for(i=0; i<nCol; i++){
        switch( sqlite3_column_type(pStmt,i) ){
          case SQLITE_NULL: {
            hash_step(&cx, (const unsigned char*)"N",1);
            break;
          }
          case SQLITE_INTEGER: {
            sqlite3_uint64 u;
            int j;
            unsigned char x[9];
            sqlite3_int64 v = sqlite3_column_int64(pStmt,i);
            memcpy(&u, &v, 8);
            for(j=8; j>=1; j--){
              x[j] = u & 0xff;
              u >>= 8;
            }
            x[0] = 'I';
            hash_step(&cx, x, 9);
            break;
          }
          case SQLITE_FLOAT: {
            sqlite3_uint64 u;
            int j;
            unsigned char x[9];
            double r = sqlite3_column_double(pStmt,i);
            memcpy(&u, &r, 8);
            for(j=8; j>=1; j--){
              x[j] = u & 0xff;
              u >>= 8;
            }
            x[0] = 'F';
            hash_step(&cx,x,9);
            break;
          }
          case SQLITE_TEXT: {
            int n2 = sqlite3_column_bytes(pStmt, i);
            const unsigned char *z2 = sqlite3_column_text(pStmt, i);
            hash_step_vformat(&cx,"T%d:",n2);
            hash_step(&cx, z2, n2);
            break;
          }
          case SQLITE_BLOB: {
            int n2 = sqlite3_column_bytes(pStmt, i);
            const unsigned char *z2 = sqlite3_column_blob(pStmt, i);
            hash_step_vformat(&cx,"B%d:",n2);
            hash_step(&cx, z2, n2);
            break;
          }
        }
      }
    }
    sqlite3_finalize(pStmt);
  }
  hash_finish(&cx, zOut);
  sqlite3_result_text(context, zOut, 40, SQLITE_TRANSIENT);
}


#ifdef _WIN32
__declspec(dllexport)
#endif
int sqlite3_sha_init(
  sqlite3 *db,
  char **pzErrMsg,
  const sqlite3_api_routines *pApi
){
  int rc = SQLITE_OK;
  SQLITE_EXTENSION_INIT2(pApi);
  (void)pzErrMsg;  /* Unused parameter */
  rc = sqlite3_create_function(db, "sha1", 1, 
                       SQLITE_UTF8 | SQLITE_INNOCUOUS | SQLITE_DETERMINISTIC,
                               0, sha1Func, 0, 0);
  if( rc==SQLITE_OK ){
    rc = sqlite3_create_function(db, "sha1_query", 1, 
                                 SQLITE_UTF8|SQLITE_DIRECTONLY, 0,
                                 sha1QueryFunc, 0, 0);
  }
  return rc;
}

Added SQLite.Interop/src/ext/shathree.c.











































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
/*
** 2017-03-08
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This SQLite extension implements functions that compute SHA3 hashes
** in the way described by the (U.S.) NIST FIPS 202 SHA-3 Standard.
** Two SQL functions are implemented:
**
**     sha3(X,SIZE)
**     sha3_query(Y,SIZE)
**
** The sha3(X) function computes the SHA3 hash of the input X, or NULL if
** X is NULL.
**
** The sha3_query(Y) function evaluates all queries in the SQL statements of Y
** and returns a hash of their results.
**
** The SIZE argument is optional.  If omitted, the SHA3-256 hash algorithm
** is used.  If SIZE is included it must be one of the integers 224, 256,
** 384, or 512, to determine SHA3 hash variant that is computed.
*/
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <string.h>
#include <stdarg.h>

#ifndef SQLITE_AMALGAMATION
typedef sqlite3_uint64 u64;
#endif /* SQLITE_AMALGAMATION */

/******************************************************************************
** The Hash Engine
*/
/*
** Macros to determine whether the machine is big or little endian,
** and whether or not that determination is run-time or compile-time.
**
** For best performance, an attempt is made to guess at the byte-order
** using C-preprocessor macros.  If that is unsuccessful, or if
** -DSHA3_BYTEORDER=0 is set, then byte-order is determined
** at run-time.
*/
#ifndef SHA3_BYTEORDER
# if defined(i386)     || defined(__i386__)   || defined(_M_IX86) ||    \
     defined(__x86_64) || defined(__x86_64__) || defined(_M_X64)  ||    \
     defined(_M_AMD64) || defined(_M_ARM)     || defined(__x86)   ||    \
     defined(__arm__)
#   define SHA3_BYTEORDER    1234
# elif defined(sparc)    || defined(__ppc__)
#   define SHA3_BYTEORDER    4321
# else
#   define SHA3_BYTEORDER 0
# endif
#endif


/*
** State structure for a SHA3 hash in progress
*/
typedef struct SHA3Context SHA3Context;
struct SHA3Context {
  union {
    u64 s[25];                /* Keccak state. 5x5 lines of 64 bits each */
    unsigned char x[1600];    /* ... or 1600 bytes */
  } u;
  unsigned nRate;        /* Bytes of input accepted per Keccak iteration */
  unsigned nLoaded;      /* Input bytes loaded into u.x[] so far this cycle */
  unsigned ixMask;       /* Insert next input into u.x[nLoaded^ixMask]. */
};

/*
** A single step of the Keccak mixing function for a 1600-bit state
*/
static void KeccakF1600Step(SHA3Context *p){
  int i;
  u64 b0, b1, b2, b3, b4;
  u64 c0, c1, c2, c3, c4;
  u64 d0, d1, d2, d3, d4;
  static const u64 RC[] = {
    0x0000000000000001ULL,  0x0000000000008082ULL,
    0x800000000000808aULL,  0x8000000080008000ULL,
    0x000000000000808bULL,  0x0000000080000001ULL,
    0x8000000080008081ULL,  0x8000000000008009ULL,
    0x000000000000008aULL,  0x0000000000000088ULL,
    0x0000000080008009ULL,  0x000000008000000aULL,
    0x000000008000808bULL,  0x800000000000008bULL,
    0x8000000000008089ULL,  0x8000000000008003ULL,
    0x8000000000008002ULL,  0x8000000000000080ULL,
    0x000000000000800aULL,  0x800000008000000aULL,
    0x8000000080008081ULL,  0x8000000000008080ULL,
    0x0000000080000001ULL,  0x8000000080008008ULL
  };
# define a00 (p->u.s[0])
# define a01 (p->u.s[1])
# define a02 (p->u.s[2])
# define a03 (p->u.s[3])
# define a04 (p->u.s[4])
# define a10 (p->u.s[5])
# define a11 (p->u.s[6])
# define a12 (p->u.s[7])
# define a13 (p->u.s[8])
# define a14 (p->u.s[9])
# define a20 (p->u.s[10])
# define a21 (p->u.s[11])
# define a22 (p->u.s[12])
# define a23 (p->u.s[13])
# define a24 (p->u.s[14])
# define a30 (p->u.s[15])
# define a31 (p->u.s[16])
# define a32 (p->u.s[17])
# define a33 (p->u.s[18])
# define a34 (p->u.s[19])
# define a40 (p->u.s[20])
# define a41 (p->u.s[21])
# define a42 (p->u.s[22])
# define a43 (p->u.s[23])
# define a44 (p->u.s[24])
# define ROL64(a,x) ((a<<x)|(a>>(64-x)))

  for(i=0; i<24; i+=4){
    c0 = a00^a10^a20^a30^a40;
    c1 = a01^a11^a21^a31^a41;
    c2 = a02^a12^a22^a32^a42;
    c3 = a03^a13^a23^a33^a43;
    c4 = a04^a14^a24^a34^a44;
    d0 = c4^ROL64(c1, 1);
    d1 = c0^ROL64(c2, 1);
    d2 = c1^ROL64(c3, 1);
    d3 = c2^ROL64(c4, 1);
    d4 = c3^ROL64(c0, 1);

    b0 = (a00^d0);
    b1 = ROL64((a11^d1), 44);
    b2 = ROL64((a22^d2), 43);
    b3 = ROL64((a33^d3), 21);
    b4 = ROL64((a44^d4), 14);
    a00 =   b0 ^((~b1)&  b2 );
    a00 ^= RC[i];
    a11 =   b1 ^((~b2)&  b3 );
    a22 =   b2 ^((~b3)&  b4 );
    a33 =   b3 ^((~b4)&  b0 );
    a44 =   b4 ^((~b0)&  b1 );

    b2 = ROL64((a20^d0), 3);
    b3 = ROL64((a31^d1), 45);
    b4 = ROL64((a42^d2), 61);
    b0 = ROL64((a03^d3), 28);
    b1 = ROL64((a14^d4), 20);
    a20 =   b0 ^((~b1)&  b2 );
    a31 =   b1 ^((~b2)&  b3 );
    a42 =   b2 ^((~b3)&  b4 );
    a03 =   b3 ^((~b4)&  b0 );
    a14 =   b4 ^((~b0)&  b1 );

    b4 = ROL64((a40^d0), 18);
    b0 = ROL64((a01^d1), 1);
    b1 = ROL64((a12^d2), 6);
    b2 = ROL64((a23^d3), 25);
    b3 = ROL64((a34^d4), 8);
    a40 =   b0 ^((~b1)&  b2 );
    a01 =   b1 ^((~b2)&  b3 );
    a12 =   b2 ^((~b3)&  b4 );
    a23 =   b3 ^((~b4)&  b0 );
    a34 =   b4 ^((~b0)&  b1 );

    b1 = ROL64((a10^d0), 36);
    b2 = ROL64((a21^d1), 10);
    b3 = ROL64((a32^d2), 15);
    b4 = ROL64((a43^d3), 56);
    b0 = ROL64((a04^d4), 27);
    a10 =   b0 ^((~b1)&  b2 );
    a21 =   b1 ^((~b2)&  b3 );
    a32 =   b2 ^((~b3)&  b4 );
    a43 =   b3 ^((~b4)&  b0 );
    a04 =   b4 ^((~b0)&  b1 );

    b3 = ROL64((a30^d0), 41);
    b4 = ROL64((a41^d1), 2);
    b0 = ROL64((a02^d2), 62);
    b1 = ROL64((a13^d3), 55);
    b2 = ROL64((a24^d4), 39);
    a30 =   b0 ^((~b1)&  b2 );
    a41 =   b1 ^((~b2)&  b3 );
    a02 =   b2 ^((~b3)&  b4 );
    a13 =   b3 ^((~b4)&  b0 );
    a24 =   b4 ^((~b0)&  b1 );

    c0 = a00^a20^a40^a10^a30;
    c1 = a11^a31^a01^a21^a41;
    c2 = a22^a42^a12^a32^a02;
    c3 = a33^a03^a23^a43^a13;
    c4 = a44^a14^a34^a04^a24;
    d0 = c4^ROL64(c1, 1);
    d1 = c0^ROL64(c2, 1);
    d2 = c1^ROL64(c3, 1);
    d3 = c2^ROL64(c4, 1);
    d4 = c3^ROL64(c0, 1);

    b0 = (a00^d0);
    b1 = ROL64((a31^d1), 44);
    b2 = ROL64((a12^d2), 43);
    b3 = ROL64((a43^d3), 21);
    b4 = ROL64((a24^d4), 14);
    a00 =   b0 ^((~b1)&  b2 );
    a00 ^= RC[i+1];
    a31 =   b1 ^((~b2)&  b3 );
    a12 =   b2 ^((~b3)&  b4 );
    a43 =   b3 ^((~b4)&  b0 );
    a24 =   b4 ^((~b0)&  b1 );

    b2 = ROL64((a40^d0), 3);
    b3 = ROL64((a21^d1), 45);
    b4 = ROL64((a02^d2), 61);
    b0 = ROL64((a33^d3), 28);
    b1 = ROL64((a14^d4), 20);
    a40 =   b0 ^((~b1)&  b2 );
    a21 =   b1 ^((~b2)&  b3 );
    a02 =   b2 ^((~b3)&  b4 );
    a33 =   b3 ^((~b4)&  b0 );
    a14 =   b4 ^((~b0)&  b1 );

    b4 = ROL64((a30^d0), 18);
    b0 = ROL64((a11^d1), 1);
    b1 = ROL64((a42^d2), 6);
    b2 = ROL64((a23^d3), 25);
    b3 = ROL64((a04^d4), 8);
    a30 =   b0 ^((~b1)&  b2 );
    a11 =   b1 ^((~b2)&  b3 );
    a42 =   b2 ^((~b3)&  b4 );
    a23 =   b3 ^((~b4)&  b0 );
    a04 =   b4 ^((~b0)&  b1 );

    b1 = ROL64((a20^d0), 36);
    b2 = ROL64((a01^d1), 10);
    b3 = ROL64((a32^d2), 15);
    b4 = ROL64((a13^d3), 56);
    b0 = ROL64((a44^d4), 27);
    a20 =   b0 ^((~b1)&  b2 );
    a01 =   b1 ^((~b2)&  b3 );
    a32 =   b2 ^((~b3)&  b4 );
    a13 =   b3 ^((~b4)&  b0 );
    a44 =   b4 ^((~b0)&  b1 );

    b3 = ROL64((a10^d0), 41);
    b4 = ROL64((a41^d1), 2);
    b0 = ROL64((a22^d2), 62);
    b1 = ROL64((a03^d3), 55);
    b2 = ROL64((a34^d4), 39);
    a10 =   b0 ^((~b1)&  b2 );
    a41 =   b1 ^((~b2)&  b3 );
    a22 =   b2 ^((~b3)&  b4 );
    a03 =   b3 ^((~b4)&  b0 );
    a34 =   b4 ^((~b0)&  b1 );

    c0 = a00^a40^a30^a20^a10;
    c1 = a31^a21^a11^a01^a41;
    c2 = a12^a02^a42^a32^a22;
    c3 = a43^a33^a23^a13^a03;
    c4 = a24^a14^a04^a44^a34;
    d0 = c4^ROL64(c1, 1);
    d1 = c0^ROL64(c2, 1);
    d2 = c1^ROL64(c3, 1);
    d3 = c2^ROL64(c4, 1);
    d4 = c3^ROL64(c0, 1);

    b0 = (a00^d0);
    b1 = ROL64((a21^d1), 44);
    b2 = ROL64((a42^d2), 43);
    b3 = ROL64((a13^d3), 21);
    b4 = ROL64((a34^d4), 14);
    a00 =   b0 ^((~b1)&  b2 );
    a00 ^= RC[i+2];
    a21 =   b1 ^((~b2)&  b3 );
    a42 =   b2 ^((~b3)&  b4 );
    a13 =   b3 ^((~b4)&  b0 );
    a34 =   b4 ^((~b0)&  b1 );

    b2 = ROL64((a30^d0), 3);
    b3 = ROL64((a01^d1), 45);
    b4 = ROL64((a22^d2), 61);
    b0 = ROL64((a43^d3), 28);
    b1 = ROL64((a14^d4), 20);
    a30 =   b0 ^((~b1)&  b2 );
    a01 =   b1 ^((~b2)&  b3 );
    a22 =   b2 ^((~b3)&  b4 );
    a43 =   b3 ^((~b4)&  b0 );
    a14 =   b4 ^((~b0)&  b1 );

    b4 = ROL64((a10^d0), 18);
    b0 = ROL64((a31^d1), 1);
    b1 = ROL64((a02^d2), 6);
    b2 = ROL64((a23^d3), 25);
    b3 = ROL64((a44^d4), 8);
    a10 =   b0 ^((~b1)&  b2 );
    a31 =   b1 ^((~b2)&  b3 );
    a02 =   b2 ^((~b3)&  b4 );
    a23 =   b3 ^((~b4)&  b0 );
    a44 =   b4 ^((~b0)&  b1 );

    b1 = ROL64((a40^d0), 36);
    b2 = ROL64((a11^d1), 10);
    b3 = ROL64((a32^d2), 15);
    b4 = ROL64((a03^d3), 56);
    b0 = ROL64((a24^d4), 27);
    a40 =   b0 ^((~b1)&  b2 );
    a11 =   b1 ^((~b2)&  b3 );
    a32 =   b2 ^((~b3)&  b4 );
    a03 =   b3 ^((~b4)&  b0 );
    a24 =   b4 ^((~b0)&  b1 );

    b3 = ROL64((a20^d0), 41);
    b4 = ROL64((a41^d1), 2);
    b0 = ROL64((a12^d2), 62);
    b1 = ROL64((a33^d3), 55);
    b2 = ROL64((a04^d4), 39);
    a20 =   b0 ^((~b1)&  b2 );
    a41 =   b1 ^((~b2)&  b3 );
    a12 =   b2 ^((~b3)&  b4 );
    a33 =   b3 ^((~b4)&  b0 );
    a04 =   b4 ^((~b0)&  b1 );

    c0 = a00^a30^a10^a40^a20;
    c1 = a21^a01^a31^a11^a41;
    c2 = a42^a22^a02^a32^a12;
    c3 = a13^a43^a23^a03^a33;
    c4 = a34^a14^a44^a24^a04;
    d0 = c4^ROL64(c1, 1);
    d1 = c0^ROL64(c2, 1);
    d2 = c1^ROL64(c3, 1);
    d3 = c2^ROL64(c4, 1);
    d4 = c3^ROL64(c0, 1);

    b0 = (a00^d0);
    b1 = ROL64((a01^d1), 44);
    b2 = ROL64((a02^d2), 43);
    b3 = ROL64((a03^d3), 21);
    b4 = ROL64((a04^d4), 14);
    a00 =   b0 ^((~b1)&  b2 );
    a00 ^= RC[i+3];
    a01 =   b1 ^((~b2)&  b3 );
    a02 =   b2 ^((~b3)&  b4 );
    a03 =   b3 ^((~b4)&  b0 );
    a04 =   b4 ^((~b0)&  b1 );

    b2 = ROL64((a10^d0), 3);
    b3 = ROL64((a11^d1), 45);
    b4 = ROL64((a12^d2), 61);
    b0 = ROL64((a13^d3), 28);
    b1 = ROL64((a14^d4), 20);
    a10 =   b0 ^((~b1)&  b2 );
    a11 =   b1 ^((~b2)&  b3 );
    a12 =   b2 ^((~b3)&  b4 );
    a13 =   b3 ^((~b4)&  b0 );
    a14 =   b4 ^((~b0)&  b1 );

    b4 = ROL64((a20^d0), 18);
    b0 = ROL64((a21^d1), 1);
    b1 = ROL64((a22^d2), 6);
    b2 = ROL64((a23^d3), 25);
    b3 = ROL64((a24^d4), 8);
    a20 =   b0 ^((~b1)&  b2 );
    a21 =   b1 ^((~b2)&  b3 );
    a22 =   b2 ^((~b3)&  b4 );
    a23 =   b3 ^((~b4)&  b0 );
    a24 =   b4 ^((~b0)&  b1 );

    b1 = ROL64((a30^d0), 36);
    b2 = ROL64((a31^d1), 10);
    b3 = ROL64((a32^d2), 15);
    b4 = ROL64((a33^d3), 56);
    b0 = ROL64((a34^d4), 27);
    a30 =   b0 ^((~b1)&  b2 );
    a31 =   b1 ^((~b2)&  b3 );
    a32 =   b2 ^((~b3)&  b4 );
    a33 =   b3 ^((~b4)&  b0 );
    a34 =   b4 ^((~b0)&  b1 );

    b3 = ROL64((a40^d0), 41);
    b4 = ROL64((a41^d1), 2);
    b0 = ROL64((a42^d2), 62);
    b1 = ROL64((a43^d3), 55);
    b2 = ROL64((a44^d4), 39);
    a40 =   b0 ^((~b1)&  b2 );
    a41 =   b1 ^((~b2)&  b3 );
    a42 =   b2 ^((~b3)&  b4 );
    a43 =   b3 ^((~b4)&  b0 );
    a44 =   b4 ^((~b0)&  b1 );
  }
}

/*
** Initialize a new hash.  iSize determines the size of the hash
** in bits and should be one of 224, 256, 384, or 512.  Or iSize
** can be zero to use the default hash size of 256 bits.
*/
static void SHA3Init(SHA3Context *p, int iSize){
  memset(p, 0, sizeof(*p));
  if( iSize>=128 && iSize<=512 ){
    p->nRate = (1600 - ((iSize + 31)&~31)*2)/8;
  }else{
    p->nRate = (1600 - 2*256)/8;
  }
#if SHA3_BYTEORDER==1234
  /* Known to be little-endian at compile-time. No-op */
#elif SHA3_BYTEORDER==4321
  p->ixMask = 7;  /* Big-endian */
#else
  {
    static unsigned int one = 1;
    if( 1==*(unsigned char*)&one ){
      /* Little endian.  No byte swapping. */
      p->ixMask = 0;
    }else{
      /* Big endian.  Byte swap. */
      p->ixMask = 7;
    }
  }
#endif
}

/*
** Make consecutive calls to the SHA3Update function to add new content
** to the hash
*/
static void SHA3Update(
  SHA3Context *p,
  const unsigned char *aData,
  unsigned int nData
){
  unsigned int i = 0;
  if( aData==0 ) return;
#if SHA3_BYTEORDER==1234
  if( (p->nLoaded % 8)==0 && ((aData - (const unsigned char*)0)&7)==0 ){
    for(; i+7<nData; i+=8){
      p->u.s[p->nLoaded/8] ^= *(u64*)&aData[i];
      p->nLoaded += 8;
      if( p->nLoaded>=p->nRate ){
        KeccakF1600Step(p);
        p->nLoaded = 0;
      }
    }
  }
#endif
  for(; i<nData; i++){
#if SHA3_BYTEORDER==1234
    p->u.x[p->nLoaded] ^= aData[i];
#elif SHA3_BYTEORDER==4321
    p->u.x[p->nLoaded^0x07] ^= aData[i];
#else
    p->u.x[p->nLoaded^p->ixMask] ^= aData[i];
#endif
    p->nLoaded++;
    if( p->nLoaded==p->nRate ){
      KeccakF1600Step(p);
      p->nLoaded = 0;
    }
  }
}

/*
** After all content has been added, invoke SHA3Final() to compute
** the final hash.  The function returns a pointer to the binary
** hash value.
*/
static unsigned char *SHA3Final(SHA3Context *p){
  unsigned int i;
  if( p->nLoaded==p->nRate-1 ){
    const unsigned char c1 = 0x86;
    SHA3Update(p, &c1, 1);
  }else{
    const unsigned char c2 = 0x06;
    const unsigned char c3 = 0x80;
    SHA3Update(p, &c2, 1);
    p->nLoaded = p->nRate - 1;
    SHA3Update(p, &c3, 1);
  }
  for(i=0; i<p->nRate; i++){
    p->u.x[i+p->nRate] = p->u.x[i^p->ixMask];
  }
  return &p->u.x[p->nRate];
}
/* End of the hashing logic
*****************************************************************************/

/*
** Implementation of the sha3(X,SIZE) function.
**
** Return a BLOB which is the SIZE-bit SHA3 hash of X.  The default
** size is 256.  If X is a BLOB, it is hashed as is.  
** For all other non-NULL types of input, X is converted into a UTF-8 string
** and the string is hashed without the trailing 0x00 terminator.  The hash
** of a NULL value is NULL.
*/
static void sha3Func(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  SHA3Context cx;
  int eType = sqlite3_value_type(argv[0]);
  int nByte = sqlite3_value_bytes(argv[0]);
  int iSize;
  if( argc==1 ){
    iSize = 256;
  }else{
    iSize = sqlite3_value_int(argv[1]);
    if( iSize!=224 && iSize!=256 && iSize!=384 && iSize!=512 ){
      sqlite3_result_error(context, "SHA3 size should be one of: 224 256 "
                                    "384 512", -1);
      return;
    }
  }
  if( eType==SQLITE_NULL ) return;
  SHA3Init(&cx, iSize);
  if( eType==SQLITE_BLOB ){
    SHA3Update(&cx, sqlite3_value_blob(argv[0]), nByte);
  }else{
    SHA3Update(&cx, sqlite3_value_text(argv[0]), nByte);
  }
  sqlite3_result_blob(context, SHA3Final(&cx), iSize/8, SQLITE_TRANSIENT);
}

/* Compute a string using sqlite3_vsnprintf() with a maximum length
** of 50 bytes and add it to the hash.
*/
static void sha3_step_vformat(
  SHA3Context *p,                 /* Add content to this context */
  const char *zFormat,
  ...
){
  va_list ap;
  int n;
  char zBuf[50];
  va_start(ap, zFormat);
  sqlite3_vsnprintf(sizeof(zBuf),zBuf,zFormat,ap);
  va_end(ap);
  n = (int)strlen(zBuf);
  SHA3Update(p, (unsigned char*)zBuf, n);
}

/*
** Implementation of the sha3_query(SQL,SIZE) function.
**
** This function compiles and runs the SQL statement(s) given in the
** argument. The results are hashed using a SIZE-bit SHA3.  The default
** size is 256.
**
** The format of the byte stream that is hashed is summarized as follows:
**
**       S<n>:<sql>
**       R
**       N
**       I<int>
**       F<ieee-float>
**       B<size>:<bytes>
**       T<size>:<text>
**
** <sql> is the original SQL text for each statement run and <n> is
** the size of that text.  The SQL text is UTF-8.  A single R character
** occurs before the start of each row.  N means a NULL value.
** I mean an 8-byte little-endian integer <int>.  F is a floating point
** number with an 8-byte little-endian IEEE floating point value <ieee-float>.
** B means blobs of <size> bytes.  T means text rendered as <size>
** bytes of UTF-8.  The <n> and <size> values are expressed as an ASCII
** text integers.
**
** For each SQL statement in the X input, there is one S segment.  Each
** S segment is followed by zero or more R segments, one for each row in the
** result set.  After each R, there are one or more N, I, F, B, or T segments,
** one for each column in the result set.  Segments are concatentated directly
** with no delimiters of any kind.
*/
static void sha3QueryFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  sqlite3 *db = sqlite3_context_db_handle(context);
  const char *zSql = (const char*)sqlite3_value_text(argv[0]);
  sqlite3_stmt *pStmt = 0;
  int nCol;                   /* Number of columns in the result set */
  int i;                      /* Loop counter */
  int rc;
  int n;
  const char *z;
  SHA3Context cx;
  int iSize;

  if( argc==1 ){
    iSize = 256;
  }else{
    iSize = sqlite3_value_int(argv[1]);
    if( iSize!=224 && iSize!=256 && iSize!=384 && iSize!=512 ){
      sqlite3_result_error(context, "SHA3 size should be one of: 224 256 "
                                    "384 512", -1);
      return;
    }
  }
  if( zSql==0 ) return;
  SHA3Init(&cx, iSize);
  while( zSql[0] ){
    rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zSql);
    if( rc ){
      char *zMsg = sqlite3_mprintf("error SQL statement [%s]: %s",
                                   zSql, sqlite3_errmsg(db));
      sqlite3_finalize(pStmt);
      sqlite3_result_error(context, zMsg, -1);
      sqlite3_free(zMsg);
      return;
    }
    if( !sqlite3_stmt_readonly(pStmt) ){
      char *zMsg = sqlite3_mprintf("non-query: [%s]", sqlite3_sql(pStmt));
      sqlite3_finalize(pStmt);
      sqlite3_result_error(context, zMsg, -1);
      sqlite3_free(zMsg);
      return;
    }
    nCol = sqlite3_column_count(pStmt);
    z = sqlite3_sql(pStmt);
    if( z ){
      n = (int)strlen(z);
      sha3_step_vformat(&cx,"S%d:",n);
      SHA3Update(&cx,(unsigned char*)z,n);
    }

    /* Compute a hash over the result of the query */
    while( SQLITE_ROW==sqlite3_step(pStmt) ){
      SHA3Update(&cx,(const unsigned char*)"R",1);
      for(i=0; i<nCol; i++){
        switch( sqlite3_column_type(pStmt,i) ){
          case SQLITE_NULL: {
            SHA3Update(&cx, (const unsigned char*)"N",1);
            break;
          }
          case SQLITE_INTEGER: {
            sqlite3_uint64 u;
            int j;
            unsigned char x[9];
            sqlite3_int64 v = sqlite3_column_int64(pStmt,i);
            memcpy(&u, &v, 8);
            for(j=8; j>=1; j--){
              x[j] = u & 0xff;
              u >>= 8;
            }
            x[0] = 'I';
            SHA3Update(&cx, x, 9);
            break;
          }
          case SQLITE_FLOAT: {
            sqlite3_uint64 u;
            int j;
            unsigned char x[9];
            double r = sqlite3_column_double(pStmt,i);
            memcpy(&u, &r, 8);
            for(j=8; j>=1; j--){
              x[j] = u & 0xff;
              u >>= 8;
            }
            x[0] = 'F';
            SHA3Update(&cx,x,9);
            break;
          }
          case SQLITE_TEXT: {
            int n2 = sqlite3_column_bytes(pStmt, i);
            const unsigned char *z2 = sqlite3_column_text(pStmt, i);
            sha3_step_vformat(&cx,"T%d:",n2);
            SHA3Update(&cx, z2, n2);
            break;
          }
          case SQLITE_BLOB: {
            int n2 = sqlite3_column_bytes(pStmt, i);
            const unsigned char *z2 = sqlite3_column_blob(pStmt, i);
            sha3_step_vformat(&cx,"B%d:",n2);
            SHA3Update(&cx, z2, n2);
            break;
          }
        }
      }
    }
    sqlite3_finalize(pStmt);
  }
  sqlite3_result_blob(context, SHA3Final(&cx), iSize/8, SQLITE_TRANSIENT);
}


#ifdef _WIN32
__declspec(dllexport)
#endif
int sqlite3_shathree_init(
  sqlite3 *db,
  char **pzErrMsg,
  const sqlite3_api_routines *pApi
){
  int rc = SQLITE_OK;
  SQLITE_EXTENSION_INIT2(pApi);
  (void)pzErrMsg;  /* Unused parameter */
  rc = sqlite3_create_function(db, "sha3", 1,
                      SQLITE_UTF8 | SQLITE_INNOCUOUS | SQLITE_DETERMINISTIC,
                      0, sha3Func, 0, 0);
  if( rc==SQLITE_OK ){
    rc = sqlite3_create_function(db, "sha3", 2,
                      SQLITE_UTF8 | SQLITE_INNOCUOUS | SQLITE_DETERMINISTIC,
                      0, sha3Func, 0, 0);
  }
  if( rc==SQLITE_OK ){
    rc = sqlite3_create_function(db, "sha3_query", 1,
                      SQLITE_UTF8 | SQLITE_DIRECTONLY,
                      0, sha3QueryFunc, 0, 0);
  }
  if( rc==SQLITE_OK ){
    rc = sqlite3_create_function(db, "sha3_query", 2,
                      SQLITE_UTF8 | SQLITE_DIRECTONLY,
                      0, sha3QueryFunc, 0, 0);
  }
  return rc;
}

Added SQLite.Interop/src/ext/totype.c.

































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
/*
** 2013-10-14
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
******************************************************************************
**
** This SQLite extension implements functions tointeger(X) and toreal(X).
**
** If X is an integer, real, or string value that can be
** losslessly represented as an integer, then tointeger(X)
** returns the corresponding integer value.
** If X is an 8-byte BLOB then that blob is interpreted as
** a signed two-compliment little-endian encoding of an integer
** and tointeger(X) returns the corresponding integer value.
** Otherwise tointeger(X) return NULL.
**
** If X is an integer, real, or string value that can be
** convert into a real number, preserving at least 15 digits
** of precision, then toreal(X) returns the corresponding real value.
** If X is an 8-byte BLOB then that blob is interpreted as
** a 64-bit IEEE754 big-endian floating point value
** and toreal(X) returns the corresponding real value.
** Otherwise toreal(X) return NULL.
**
** Note that tointeger(X) of an 8-byte BLOB assumes a little-endian
** encoding whereas toreal(X) of an 8-byte BLOB assumes a big-endian
** encoding.
*/
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <string.h>

/*
** Determine if this is running on a big-endian or little-endian
** processor
*/
#if defined(i386) || defined(__i386__) || defined(_M_IX86)\
                             || defined(__x86_64) || defined(__x86_64__)
# define TOTYPE_BIGENDIAN    0
# define TOTYPE_LITTLEENDIAN 1
#else
  const int totype_one = 1;
# define TOTYPE_BIGENDIAN    (*(char *)(&totype_one)==0)
# define TOTYPE_LITTLEENDIAN (*(char *)(&totype_one)==1)
#endif

/*
** Constants for the largest and smallest possible 64-bit signed integers.
** These macros are designed to work correctly on both 32-bit and 64-bit
** compilers.
*/
#ifndef LARGEST_INT64
# define LARGEST_INT64   (0xffffffff|(((sqlite3_int64)0x7fffffff)<<32))
#endif

#ifndef SMALLEST_INT64
# define SMALLEST_INT64  (((sqlite3_int64)-1) - LARGEST_INT64)
#endif

/*
** Return TRUE if character c is a whitespace character
*/
static int totypeIsspace(unsigned char c){
  return c==' ' || c=='\t' || c=='\n' || c=='\v' || c=='\f' || c=='\r';
}

/*
** Return TRUE if character c is a digit
*/
static int totypeIsdigit(unsigned char c){
  return c>='0' && c<='9';
}

/*
** Compare the 19-character string zNum against the text representation
** value 2^63:  9223372036854775808.  Return negative, zero, or positive
** if zNum is less than, equal to, or greater than the string.
** Note that zNum must contain exactly 19 characters.
**
** Unlike memcmp() this routine is guaranteed to return the difference
** in the values of the last digit if the only difference is in the
** last digit.  So, for example,
**
**      totypeCompare2pow63("9223372036854775800")
**
** will return -8.
*/
static int totypeCompare2pow63(const char *zNum){
  int c = 0;
  int i;
                    /* 012345678901234567 */
  const char *pow63 = "922337203685477580";
  for(i=0; c==0 && i<18; i++){
    c = (zNum[i]-pow63[i])*10;
  }
  if( c==0 ){
    c = zNum[18] - '8';
  }
  return c;
}

/*
** Convert zNum to a 64-bit signed integer.
**
** If the zNum value is representable as a 64-bit twos-complement
** integer, then write that value into *pNum and return 0.
**
** If zNum is exactly 9223372036854665808, return 2.  This special
** case is broken out because while 9223372036854665808 cannot be a
** signed 64-bit integer, its negative -9223372036854665808 can be.
**
** If zNum is too big for a 64-bit integer and is not
** 9223372036854665808  or if zNum contains any non-numeric text,
** then return 1.
**
** The string is not necessarily zero-terminated.
*/
static int totypeAtoi64(const char *zNum, sqlite3_int64 *pNum, int length){
  sqlite3_uint64 u = 0;
  int neg = 0; /* assume positive */
  int i;
  int c = 0;
  int nonNum = 0;
  const char *zStart;
  const char *zEnd = zNum + length;

  while( zNum<zEnd && totypeIsspace(*zNum) ) zNum++;
  if( zNum<zEnd ){
    if( *zNum=='-' ){
      neg = 1;
      zNum++;
    }else if( *zNum=='+' ){
      zNum++;
    }
  }
  zStart = zNum;
  while( zNum<zEnd && zNum[0]=='0' ){ zNum++; } /* Skip leading zeros. */
  for(i=0; &zNum[i]<zEnd && (c=zNum[i])>='0' && c<='9'; i++){
    u = u*10 + c - '0';
  }
  if( u>LARGEST_INT64 ){
    *pNum = SMALLEST_INT64;
  }else if( neg ){
    *pNum = -(sqlite3_int64)u;
  }else{
    *pNum = (sqlite3_int64)u;
  }
  if( (c!=0 && &zNum[i]<zEnd) || (i==0 && zStart==zNum) || i>19 || nonNum ){
    /* zNum is empty or contains non-numeric text or is longer
    ** than 19 digits (thus guaranteeing that it is too large) */
    return 1;
  }else if( i<19 ){
    /* Less than 19 digits, so we know that it fits in 64 bits */
    assert( u<=LARGEST_INT64 );
    return 0;
  }else{
    /* zNum is a 19-digit numbers.  Compare it against 9223372036854775808. */
    c = totypeCompare2pow63(zNum);
    if( c<0 ){
      /* zNum is less than 9223372036854775808 so it fits */
      assert( u<=LARGEST_INT64 );
      return 0;
    }else if( c>0 ){
      /* zNum is greater than 9223372036854775808 so it overflows */
      return 1;
    }else{
      /* zNum is exactly 9223372036854775808.  Fits if negative.  The
      ** special case 2 overflow if positive */
      assert( u-1==LARGEST_INT64 );
      assert( (*pNum)==SMALLEST_INT64 );
      return neg ? 0 : 2;
    }
  }
}

/*
** The string z[] is an text representation of a real number.
** Convert this string to a double and write it into *pResult.
**
** The string is not necessarily zero-terminated.
**
** Return TRUE if the result is a valid real number (or integer) and FALSE
** if the string is empty or contains extraneous text.  Valid numbers
** are in one of these formats:
**
**    [+-]digits[E[+-]digits]
**    [+-]digits.[digits][E[+-]digits]
**    [+-].digits[E[+-]digits]
**
** Leading and trailing whitespace is ignored for the purpose of determining
** validity.
**
** If some prefix of the input string is a valid number, this routine
** returns FALSE but it still converts the prefix and writes the result
** into *pResult.
*/
static int totypeAtoF(const char *z, double *pResult, int length){
  const char *zEnd = z + length;
  /* sign * significand * (10 ^ (esign * exponent)) */
  int sign = 1;    /* sign of significand */
  sqlite3_int64 s = 0;       /* significand */
  int d = 0;       /* adjust exponent for shifting decimal point */
  int esign = 1;   /* sign of exponent */
  int e = 0;       /* exponent */
  int eValid = 1;  /* True exponent is either not used or is well-formed */
  double result;
  int nDigits = 0;
  int nonNum = 0;

  *pResult = 0.0;   /* Default return value, in case of an error */

  /* skip leading spaces */
  while( z<zEnd && totypeIsspace(*z) ) z++;
  if( z>=zEnd ) return 0;

  /* get sign of significand */
  if( *z=='-' ){
    sign = -1;
    z++;
  }else if( *z=='+' ){
    z++;
  }

  /* skip leading zeroes */
  while( z<zEnd && z[0]=='0' ) z++, nDigits++;

  /* copy max significant digits to significand */
  while( z<zEnd && totypeIsdigit(*z) && s<((LARGEST_INT64-9)/10) ){
    s = s*10 + (*z - '0');
    z++, nDigits++;
  }

  /* skip non-significant significand digits
  ** (increase exponent by d to shift decimal left) */
  while( z<zEnd && totypeIsdigit(*z) ) z++, nDigits++, d++;
  if( z>=zEnd ) goto totype_atof_calc;

  /* if decimal point is present */
  if( *z=='.' ){
    z++;
    /* copy digits from after decimal to significand
    ** (decrease exponent by d to shift decimal right) */
    while( z<zEnd && totypeIsdigit(*z) && s<((LARGEST_INT64-9)/10) ){
      s = s*10 + (*z - '0');
      z++, nDigits++, d--;
    }
    /* skip non-significant digits */
    while( z<zEnd && totypeIsdigit(*z) ) z++, nDigits++;
  }
  if( z>=zEnd ) goto totype_atof_calc;

  /* if exponent is present */
  if( *z=='e' || *z=='E' ){
    z++;
    eValid = 0;
    if( z>=zEnd ) goto totype_atof_calc;
    /* get sign of exponent */
    if( *z=='-' ){
      esign = -1;
      z++;
    }else if( *z=='+' ){
      z++;
    }
    /* copy digits to exponent */
    while( z<zEnd && totypeIsdigit(*z) ){
      e = e<10000 ? (e*10 + (*z - '0')) : 10000;
      z++;
      eValid = 1;
    }
  }

  /* skip trailing spaces */
  if( nDigits && eValid ){
    while( z<zEnd && totypeIsspace(*z) ) z++;
  }

totype_atof_calc:
  /* adjust exponent by d, and update sign */
  e = (e*esign) + d;
  if( e<0 ) {
    esign = -1;
    e *= -1;
  } else {
    esign = 1;
  }

  /* if 0 significand */
  if( !s ) {
    /* In the IEEE 754 standard, zero is signed.
    ** Add the sign if we've seen at least one digit */
    result = (sign<0 && nDigits) ? -(double)0 : (double)0;
  } else {
    /* attempt to reduce exponent */
    if( esign>0 ){
      while( s<(LARGEST_INT64/10) && e>0 ) e--,s*=10;
    }else{
      while( !(s%10) && e>0 ) e--,s/=10;
    }

    /* adjust the sign of significand */
    s = sign<0 ? -s : s;

    /* if exponent, scale significand as appropriate
    ** and store in result. */
    if( e ){
      double scale = 1.0;
      /* attempt to handle extremely small/large numbers better */
      if( e>307 && e<342 ){
        while( e%308 ) { scale *= 1.0e+1; e -= 1; }
        if( esign<0 ){
          result = s / scale;
          result /= 1.0e+308;
        }else{
          result = s * scale;
          result *= 1.0e+308;
        }
      }else if( e>=342 ){
        if( esign<0 ){
          result = 0.0*s;
        }else{
          result = 1e308*1e308*s;  /* Infinity */
        }
      }else{
        /* 1.0e+22 is the largest power of 10 than can be
        ** represented exactly. */
        while( e%22 ) { scale *= 1.0e+1; e -= 1; }
        while( e>0 ) { scale *= 1.0e+22; e -= 22; }
        if( esign<0 ){
          result = s / scale;
        }else{
          result = s * scale;
        }
      }
    } else {
      result = (double)s;
    }
  }

  /* store the result */
  *pResult = result;

  /* return true if number and no extra non-whitespace chracters after */
  return z>=zEnd && nDigits>0 && eValid && nonNum==0;
}

/* 
** Convert a floating point value to an integer. Or, if this cannot be
** done in a way that avoids 'outside the range of representable values' 
** warnings from UBSAN, return 0.
**
** This function is a modified copy of internal SQLite function
** sqlite3RealToI64().
*/
static sqlite3_int64 totypeDoubleToInt(double r){
  if( r<-9223372036854774784.0 ) return 0;
  if( r>+9223372036854774784.0 ) return 0;
  return (sqlite3_int64)r;
}

/*
** tointeger(X):  If X is any value (integer, double, blob, or string) that
** can be losslessly converted into an integer, then make the conversion and
** return the result.  Otherwise, return NULL.
*/
static void tointegerFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  assert( argc==1 );
  (void)argc;
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_FLOAT: {
      double rVal = sqlite3_value_double(argv[0]);
      sqlite3_int64 iVal = totypeDoubleToInt(rVal);
      if( rVal==(double)iVal ){
        sqlite3_result_int64(context, iVal);
      }
      break;
    }
    case SQLITE_INTEGER: {
      sqlite3_result_int64(context, sqlite3_value_int64(argv[0]));
      break;
    }
    case SQLITE_BLOB: {
      const unsigned char *zBlob = sqlite3_value_blob(argv[0]);
      if( zBlob ){
        int nBlob = sqlite3_value_bytes(argv[0]);
        if( nBlob==sizeof(sqlite3_int64) ){
          sqlite3_int64 iVal;
          if( TOTYPE_BIGENDIAN ){
            int i;
            unsigned char zBlobRev[sizeof(sqlite3_int64)];
            for(i=0; i<sizeof(sqlite3_int64); i++){
              zBlobRev[i] = zBlob[sizeof(sqlite3_int64)-1-i];
            }
            memcpy(&iVal, zBlobRev, sizeof(sqlite3_int64));
          }else{
            memcpy(&iVal, zBlob, sizeof(sqlite3_int64));
          }
          sqlite3_result_int64(context, iVal);
        }
      }
      break;
    }
    case SQLITE_TEXT: {
      const unsigned char *zStr = sqlite3_value_text(argv[0]);
      if( zStr ){
        int nStr = sqlite3_value_bytes(argv[0]);
        if( nStr && !totypeIsspace(zStr[0]) ){
          sqlite3_int64 iVal;
          if( !totypeAtoi64((const char*)zStr, &iVal, nStr) ){
            sqlite3_result_int64(context, iVal);
          }
        }
      }
      break;
    }
    default: {
      assert( sqlite3_value_type(argv[0])==SQLITE_NULL );
      break;
    }
  }
}

/*
** toreal(X): If X is any value (integer, double, blob, or string) that can
** be losslessly converted into a real number, then do so and return that
** real number.  Otherwise return NULL.
*/
#if defined(_MSC_VER)
#pragma warning(disable: 4748)
#pragma optimize("", off)
#endif
static void torealFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  assert( argc==1 );
  (void)argc;
  switch( sqlite3_value_type(argv[0]) ){
    case SQLITE_FLOAT: {
      sqlite3_result_double(context, sqlite3_value_double(argv[0]));
      break;
    }
    case SQLITE_INTEGER: {
      sqlite3_int64 iVal = sqlite3_value_int64(argv[0]);
      double rVal = (double)iVal;
      if( iVal==totypeDoubleToInt(rVal) ){
        sqlite3_result_double(context, rVal);
      }
      break;
    }
    case SQLITE_BLOB: {
      const unsigned char *zBlob = sqlite3_value_blob(argv[0]);
      if( zBlob ){
        int nBlob = sqlite3_value_bytes(argv[0]);
        if( nBlob==sizeof(double) ){
          double rVal;
          if( TOTYPE_LITTLEENDIAN ){
            int i;
            unsigned char zBlobRev[sizeof(double)];
            for(i=0; i<sizeof(double); i++){
              zBlobRev[i] = zBlob[sizeof(double)-1-i];
            }
            memcpy(&rVal, zBlobRev, sizeof(double));
          }else{
            memcpy(&rVal, zBlob, sizeof(double));
          }
          sqlite3_result_double(context, rVal);
        }
      }
      break;
    }
    case SQLITE_TEXT: {
      const unsigned char *zStr = sqlite3_value_text(argv[0]);
      if( zStr ){
        int nStr = sqlite3_value_bytes(argv[0]);
        if( nStr && !totypeIsspace(zStr[0]) && !totypeIsspace(zStr[nStr-1]) ){
          double rVal;
          if( totypeAtoF((const char*)zStr, &rVal, nStr) ){
            sqlite3_result_double(context, rVal);
            return;
          }
        }
      }
      break;
    }
    default: {
      assert( sqlite3_value_type(argv[0])==SQLITE_NULL );
      break;
    }
  }
}
#if defined(_MSC_VER)
#pragma optimize("", on)
#pragma warning(default: 4748)
#endif

#ifdef _WIN32
__declspec(dllexport)
#endif
int sqlite3_totype_init(
  sqlite3 *db,
  char **pzErrMsg,
  const sqlite3_api_routines *pApi
){
  int rc = SQLITE_OK;
  SQLITE_EXTENSION_INIT2(pApi);
  (void)pzErrMsg;  /* Unused parameter */
  rc = sqlite3_create_function(db, "tointeger", 1,
        SQLITE_UTF8 | SQLITE_DETERMINISTIC | SQLITE_INNOCUOUS, 0,
        tointegerFunc, 0, 0);
  if( rc==SQLITE_OK ){
    rc = sqlite3_create_function(db, "toreal", 1,
        SQLITE_UTF8 | SQLITE_DETERMINISTIC | SQLITE_INNOCUOUS, 0,
        torealFunc, 0, 0);
  }
  return rc;
}

Added SQLite.Interop/src/ext/vtshim.c.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
/*
** 2013-06-12
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
**
** A shim that sits between the SQLite virtual table interface and
** runtimes with garbage collector based memory management.
*/
#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <string.h>

#ifndef SQLITE_OMIT_VIRTUALTABLE

/* Forward references */
typedef struct vtshim_aux vtshim_aux;
typedef struct vtshim_vtab vtshim_vtab;
typedef struct vtshim_cursor vtshim_cursor;


/* The vtshim_aux argument is the auxiliary parameter that is passed
** into sqlite3_create_module_v2().
*/
struct vtshim_aux {
  void *pChildAux;              /* pAux for child virtual tables */
  void (*xChildDestroy)(void*); /* Destructor for pChildAux */
  sqlite3_module *pMod;         /* Methods for child virtual tables */
  sqlite3 *db;                  /* The database to which we are attached */
  char *zName;                  /* Name of the module */
  int bDisposed;                /* True if disposed */
  vtshim_vtab *pAllVtab;        /* List of all vtshim_vtab objects */
  sqlite3_module sSelf;         /* Methods used by this shim */
};

/* A vtshim virtual table object */
struct vtshim_vtab {
  sqlite3_vtab base;       /* Base class - must be first */
  sqlite3_vtab *pChild;    /* Child virtual table */
  vtshim_aux *pAux;        /* Pointer to vtshim_aux object */
  vtshim_cursor *pAllCur;  /* List of all cursors */
  vtshim_vtab **ppPrev;    /* Previous on list */
  vtshim_vtab *pNext;      /* Next on list */
};

/* A vtshim cursor object */
struct vtshim_cursor {
  sqlite3_vtab_cursor base;    /* Base class - must be first */
  sqlite3_vtab_cursor *pChild; /* Cursor generated by the managed subclass */
  vtshim_cursor **ppPrev;      /* Previous on list of all cursors */
  vtshim_cursor *pNext;        /* Next on list of all cursors */
};

/* Macro used to copy the child vtable error message to outer vtable */
#define VTSHIM_COPY_ERRMSG()                                             \
  do {                                                                   \
    sqlite3_free(pVtab->base.zErrMsg);                                   \
    pVtab->base.zErrMsg = sqlite3_mprintf("%s", pVtab->pChild->zErrMsg); \
  } while (0)

/* Methods for the vtshim module */
static int vtshimCreate(
  sqlite3 *db,
  void *ppAux,
  int argc,
  const char *const*argv,
  sqlite3_vtab **ppVtab,
  char **pzErr
){
  vtshim_aux *pAux = (vtshim_aux*)ppAux;
  vtshim_vtab *pNew;
  int rc;

  assert( db==pAux->db );
  if( pAux->bDisposed ){
    if( pzErr ){
      *pzErr = sqlite3_mprintf("virtual table was disposed: \"%s\"",
                               pAux->zName);
    }
    return SQLITE_ERROR;
  }
  pNew = sqlite3_malloc( sizeof(*pNew) );
  *ppVtab = (sqlite3_vtab*)pNew;
  if( pNew==0 ) return SQLITE_NOMEM;
  memset(pNew, 0, sizeof(*pNew));
  rc = pAux->pMod->xCreate(db, pAux->pChildAux, argc, argv,
                           &pNew->pChild, pzErr);
  if( rc ){
    sqlite3_free(pNew);
    *ppVtab = 0;
    return rc;
  }
  pNew->pAux = pAux;
  pNew->ppPrev = &pAux->pAllVtab;
  pNew->pNext = pAux->pAllVtab;
  if( pAux->pAllVtab ) pAux->pAllVtab->ppPrev = &pNew->pNext;
  pAux->pAllVtab = pNew;
  return rc;
}

static int vtshimConnect(
  sqlite3 *db,
  void *ppAux,
  int argc,
  const char *const*argv,
  sqlite3_vtab **ppVtab,
  char **pzErr
){
  vtshim_aux *pAux = (vtshim_aux*)ppAux;
  vtshim_vtab *pNew;
  int rc;

  assert( db==pAux->db );
  if( pAux->bDisposed ){
    if( pzErr ){
      *pzErr = sqlite3_mprintf("virtual table was disposed: \"%s\"",
                               pAux->zName);
    }
    return SQLITE_ERROR;
  }
  pNew = sqlite3_malloc( sizeof(*pNew) );
  *ppVtab = (sqlite3_vtab*)pNew;
  if( pNew==0 ) return SQLITE_NOMEM;
  memset(pNew, 0, sizeof(*pNew));
  rc = pAux->pMod->xConnect(db, pAux->pChildAux, argc, argv,
                            &pNew->pChild, pzErr);
  if( rc ){
    sqlite3_free(pNew);
    *ppVtab = 0;
    return rc;
  }
  pNew->pAux = pAux;
  pNew->ppPrev = &pAux->pAllVtab;
  pNew->pNext = pAux->pAllVtab;
  if( pAux->pAllVtab ) pAux->pAllVtab->ppPrev = &pNew->pNext;
  pAux->pAllVtab = pNew;
  return rc;
}

static int vtshimBestIndex(
  sqlite3_vtab *pBase,
  sqlite3_index_info *pIdxInfo
){
  vtshim_vtab *pVtab = (vtshim_vtab*)pBase;
  vtshim_aux *pAux = pVtab->pAux;
  int rc;
  if( pAux->bDisposed ) return SQLITE_ERROR;
  rc = pAux->pMod->xBestIndex(pVtab->pChild, pIdxInfo);
  if( rc!=SQLITE_OK ){
    VTSHIM_COPY_ERRMSG();
  }
  return rc;
}

static int vtshimDisconnect(sqlite3_vtab *pBase){
  vtshim_vtab *pVtab = (vtshim_vtab*)pBase;
  vtshim_aux *pAux = pVtab->pAux;
  int rc = SQLITE_OK;
  if( !pAux->bDisposed ){
    rc = pAux->pMod->xDisconnect(pVtab->pChild);
  }
  if( pVtab->pNext ) pVtab->pNext->ppPrev = pVtab->ppPrev;
  *pVtab->ppPrev = pVtab->pNext;
  sqlite3_free(pVtab);
  return rc;
}

static int vtshimDestroy(sqlite3_vtab *pBase){
  vtshim_vtab *pVtab = (vtshim_vtab*)pBase;
  vtshim_aux *pAux = pVtab->pAux;
  int rc = SQLITE_OK;
  if( !pAux->bDisposed ){
    rc = pAux->pMod->xDestroy(pVtab->pChild);
  }
  if( pVtab->pNext ) pVtab->pNext->ppPrev = pVtab->ppPrev;
  *pVtab->ppPrev = pVtab->pNext;
  sqlite3_free(pVtab);
  return rc;
}

static int vtshimOpen(sqlite3_vtab *pBase, sqlite3_vtab_cursor **ppCursor){
  vtshim_vtab *pVtab = (vtshim_vtab*)pBase;
  vtshim_aux *pAux = pVtab->pAux;
  vtshim_cursor *pCur;
  int rc;
  *ppCursor = 0;
  if( pAux->bDisposed ) return SQLITE_ERROR;
  pCur = sqlite3_malloc( sizeof(*pCur) );
  if( pCur==0 ) return SQLITE_NOMEM;
  memset(pCur, 0, sizeof(*pCur));
  rc = pAux->pMod->xOpen(pVtab->pChild, &pCur->pChild);
  if( rc ){
    sqlite3_free(pCur);
    VTSHIM_COPY_ERRMSG();
    return rc;
  }
  pCur->pChild->pVtab = pVtab->pChild;
  *ppCursor = &pCur->base;
  pCur->ppPrev = &pVtab->pAllCur;
  if( pVtab->pAllCur ) pVtab->pAllCur->ppPrev = &pCur->pNext;
  pCur->pNext = pVtab->pAllCur;
  pVtab->pAllCur = pCur;
  return SQLITE_OK;
}

static int vtshimClose(sqlite3_vtab_cursor *pX){
  vtshim_cursor *pCur = (vtshim_cursor*)pX;
  vtshim_vtab *pVtab = (vtshim_vtab*)pCur->base.pVtab;
  vtshim_aux *pAux = pVtab->pAux;
  int rc = SQLITE_OK;
  if( !pAux->bDisposed ){
    rc = pAux->pMod->xClose(pCur->pChild);
    if( rc!=SQLITE_OK ){
      VTSHIM_COPY_ERRMSG();
    }
  }
  if( pCur->pNext ) pCur->pNext->ppPrev = pCur->ppPrev;
  *pCur->ppPrev = pCur->pNext;
  sqlite3_free(pCur);
  return rc;
}

static int vtshimFilter(
  sqlite3_vtab_cursor *pX,
  int idxNum,
  const char *idxStr,
  int argc,
  sqlite3_value **argv
){
  vtshim_cursor *pCur = (vtshim_cursor*)pX;
  vtshim_vtab *pVtab = (vtshim_vtab*)pCur->base.pVtab;
  vtshim_aux *pAux = pVtab->pAux;
  int rc;
  if( pAux->bDisposed ) return SQLITE_ERROR;
  rc = pAux->pMod->xFilter(pCur->pChild, idxNum, idxStr, argc, argv);
  if( rc!=SQLITE_OK ){
    VTSHIM_COPY_ERRMSG();
  }
  return rc;
}

static int vtshimNext(sqlite3_vtab_cursor *pX){
  vtshim_cursor *pCur = (vtshim_cursor*)pX;
  vtshim_vtab *pVtab = (vtshim_vtab*)pCur->base.pVtab;
  vtshim_aux *pAux = pVtab->pAux;
  int rc;
  if( pAux->bDisposed ) return SQLITE_ERROR;
  rc = pAux->pMod->xNext(pCur->pChild);
  if( rc!=SQLITE_OK ){
    VTSHIM_COPY_ERRMSG();
  }
  return rc;
}

static int vtshimEof(sqlite3_vtab_cursor *pX){
  vtshim_cursor *pCur = (vtshim_cursor*)pX;
  vtshim_vtab *pVtab = (vtshim_vtab*)pCur->base.pVtab;
  vtshim_aux *pAux = pVtab->pAux;
  int rc;
  if( pAux->bDisposed ) return 1;
  rc = pAux->pMod->xEof(pCur->pChild);
  VTSHIM_COPY_ERRMSG();
  return rc;
}

static int vtshimColumn(sqlite3_vtab_cursor *pX, sqlite3_context *ctx, int i){
  vtshim_cursor *pCur = (vtshim_cursor*)pX;
  vtshim_vtab *pVtab = (vtshim_vtab*)pCur->base.pVtab;
  vtshim_aux *pAux = pVtab->pAux;
  int rc;
  if( pAux->bDisposed ) return SQLITE_ERROR;
  rc = pAux->pMod->xColumn(pCur->pChild, ctx, i);
  if( rc!=SQLITE_OK ){
    VTSHIM_COPY_ERRMSG();
  }
  return rc;
}

static int vtshimRowid(sqlite3_vtab_cursor *pX, sqlite3_int64 *pRowid){
  vtshim_cursor *pCur = (vtshim_cursor*)pX;
  vtshim_vtab *pVtab = (vtshim_vtab*)pCur->base.pVtab;
  vtshim_aux *pAux = pVtab->pAux;
  int rc;
  if( pAux->bDisposed ) return SQLITE_ERROR;
  rc = pAux->pMod->xRowid(pCur->pChild, pRowid);
  if( rc!=SQLITE_OK ){
    VTSHIM_COPY_ERRMSG();
  }
  return rc;
}

static int vtshimUpdate(
  sqlite3_vtab *pBase,
  int argc,
  sqlite3_value **argv,
  sqlite3_int64 *pRowid
){
  vtshim_vtab *pVtab = (vtshim_vtab*)pBase;
  vtshim_aux *pAux = pVtab->pAux;
  int rc;
  if( pAux->bDisposed ) return SQLITE_ERROR;
  rc = pAux->pMod->xUpdate(pVtab->pChild, argc, argv, pRowid);
  if( rc!=SQLITE_OK ){
    VTSHIM_COPY_ERRMSG();
  }
  return rc;
}

static int vtshimBegin(sqlite3_vtab *pBase){
  vtshim_vtab *pVtab = (vtshim_vtab*)pBase;
  vtshim_aux *pAux = pVtab->pAux;
  int rc;
  if( pAux->bDisposed ) return SQLITE_ERROR;
  rc = pAux->pMod->xBegin(pVtab->pChild);
  if( rc!=SQLITE_OK ){
    VTSHIM_COPY_ERRMSG();
  }
  return rc;
}

static int vtshimSync(sqlite3_vtab *pBase){
  vtshim_vtab *pVtab = (vtshim_vtab*)pBase;
  vtshim_aux *pAux = pVtab->pAux;
  int rc;
  if( pAux->bDisposed ) return SQLITE_ERROR;
  rc = pAux->pMod->xSync(pVtab->pChild);
  if( rc!=SQLITE_OK ){
    VTSHIM_COPY_ERRMSG();
  }
  return rc;
}

static int vtshimCommit(sqlite3_vtab *pBase){
  vtshim_vtab *pVtab = (vtshim_vtab*)pBase;
  vtshim_aux *pAux = pVtab->pAux;
  int rc;
  if( pAux->bDisposed ) return SQLITE_ERROR;
  rc = pAux->pMod->xCommit(pVtab->pChild);
  if( rc!=SQLITE_OK ){
    VTSHIM_COPY_ERRMSG();
  }
  return rc;
}

static int vtshimRollback(sqlite3_vtab *pBase){
  vtshim_vtab *pVtab = (vtshim_vtab*)pBase;
  vtshim_aux *pAux = pVtab->pAux;
  int rc;
  if( pAux->bDisposed ) return SQLITE_ERROR;
  rc = pAux->pMod->xRollback(pVtab->pChild);
  if( rc!=SQLITE_OK ){
    VTSHIM_COPY_ERRMSG();
  }
  return rc;
}

static int vtshimFindFunction(
  sqlite3_vtab *pBase,
  int nArg,
  const char *zName,
  void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),
  void **ppArg
){
  vtshim_vtab *pVtab = (vtshim_vtab*)pBase;
  vtshim_aux *pAux = pVtab->pAux;
  int rc;
  if( pAux->bDisposed ) return 0;
  rc = pAux->pMod->xFindFunction(pVtab->pChild, nArg, zName, pxFunc, ppArg);
  VTSHIM_COPY_ERRMSG();
  return rc;
}

static int vtshimRename(sqlite3_vtab *pBase, const char *zNewName){
  vtshim_vtab *pVtab = (vtshim_vtab*)pBase;
  vtshim_aux *pAux = pVtab->pAux;
  int rc;
  if( pAux->bDisposed ) return SQLITE_ERROR;
  rc = pAux->pMod->xRename(pVtab->pChild, zNewName);
  if( rc!=SQLITE_OK ){
    VTSHIM_COPY_ERRMSG();
  }
  return rc;
}

static int vtshimSavepoint(sqlite3_vtab *pBase, int n){
  vtshim_vtab *pVtab = (vtshim_vtab*)pBase;
  vtshim_aux *pAux = pVtab->pAux;
  int rc;
  if( pAux->bDisposed ) return SQLITE_ERROR;
  rc = pAux->pMod->xSavepoint(pVtab->pChild, n);
  if( rc!=SQLITE_OK ){
    VTSHIM_COPY_ERRMSG();
  }
  return rc;
}

static int vtshimRelease(sqlite3_vtab *pBase, int n){
  vtshim_vtab *pVtab = (vtshim_vtab*)pBase;
  vtshim_aux *pAux = pVtab->pAux;
  int rc;
  if( pAux->bDisposed ) return SQLITE_ERROR;
  rc = pAux->pMod->xRelease(pVtab->pChild, n);
  if( rc!=SQLITE_OK ){
    VTSHIM_COPY_ERRMSG();
  }
  return rc;
}

static int vtshimRollbackTo(sqlite3_vtab *pBase, int n){
  vtshim_vtab *pVtab = (vtshim_vtab*)pBase;
  vtshim_aux *pAux = pVtab->pAux;
  int rc;
  if( pAux->bDisposed ) return SQLITE_ERROR;
  rc = pAux->pMod->xRollbackTo(pVtab->pChild, n);
  if( rc!=SQLITE_OK ){
    VTSHIM_COPY_ERRMSG();
  }
  return rc;
}

/* The destructor function for a disposible module */
static void vtshimAuxDestructor(void *pXAux){
  vtshim_aux *pAux = (vtshim_aux*)pXAux;
  assert( pAux->pAllVtab==0 );
  if( !pAux->bDisposed && pAux->xChildDestroy ){
    pAux->xChildDestroy(pAux->pChildAux);
    pAux->xChildDestroy = 0;
  }
  sqlite3_free(pAux->zName);
  sqlite3_free(pAux->pMod);
  sqlite3_free(pAux);
}

static int vtshimCopyModule(
  const sqlite3_module *pMod,   /* Source module to be copied */
  sqlite3_module **ppMod        /* Destination for copied module */
){
  sqlite3_module *p;
  if( !pMod || !ppMod ) return SQLITE_ERROR;
  p = sqlite3_malloc( sizeof(*p) );
  if( p==0 ) return SQLITE_NOMEM;
  memcpy(p, pMod, sizeof(*p));
  *ppMod = p;
  return SQLITE_OK;
}

#ifdef _WIN32
__declspec(dllexport)
#endif
void *sqlite3_create_disposable_module(
  sqlite3 *db,               /* SQLite connection to register module with */
  const char *zName,         /* Name of the module */
  const sqlite3_module *p,   /* Methods for the module */
  void *pClientData,         /* Client data for xCreate/xConnect */
  void(*xDestroy)(void*)     /* Module destructor function */
){
  vtshim_aux *pAux;
  sqlite3_module *pMod;
  int rc;
  pAux = sqlite3_malloc( sizeof(*pAux) );
  if( pAux==0 ){
    if( xDestroy ) xDestroy(pClientData);
    return 0;
  }
  rc = vtshimCopyModule(p, &pMod);
  if( rc!=SQLITE_OK ){
    sqlite3_free(pAux);
    return 0;
  }
  pAux->pChildAux = pClientData;
  pAux->xChildDestroy = xDestroy;
  pAux->pMod = pMod;
  pAux->db = db;
  pAux->zName = sqlite3_mprintf("%s", zName);
  pAux->bDisposed = 0;
  pAux->pAllVtab = 0;
  pAux->sSelf.iVersion = p->iVersion<=2 ? p->iVersion : 2;
  pAux->sSelf.xCreate = p->xCreate ? vtshimCreate : 0;
  pAux->sSelf.xConnect = p->xConnect ? vtshimConnect : 0;
  pAux->sSelf.xBestIndex = p->xBestIndex ? vtshimBestIndex : 0;
  pAux->sSelf.xDisconnect = p->xDisconnect ? vtshimDisconnect : 0;
  pAux->sSelf.xDestroy = p->xDestroy ? vtshimDestroy : 0;
  pAux->sSelf.xOpen = p->xOpen ? vtshimOpen : 0;
  pAux->sSelf.xClose = p->xClose ? vtshimClose : 0;
  pAux->sSelf.xFilter = p->xFilter ? vtshimFilter : 0;
  pAux->sSelf.xNext = p->xNext ? vtshimNext : 0;
  pAux->sSelf.xEof = p->xEof ? vtshimEof : 0;
  pAux->sSelf.xColumn = p->xColumn ? vtshimColumn : 0;
  pAux->sSelf.xRowid = p->xRowid ? vtshimRowid : 0;
  pAux->sSelf.xUpdate = p->xUpdate ? vtshimUpdate : 0;
  pAux->sSelf.xBegin = p->xBegin ? vtshimBegin : 0;
  pAux->sSelf.xSync = p->xSync ? vtshimSync : 0;
  pAux->sSelf.xCommit = p->xCommit ? vtshimCommit : 0;
  pAux->sSelf.xRollback = p->xRollback ? vtshimRollback : 0;
  pAux->sSelf.xFindFunction = p->xFindFunction ? vtshimFindFunction : 0;
  pAux->sSelf.xRename = p->xRename ? vtshimRename : 0;
  if( p->iVersion>=2 ){
    pAux->sSelf.xSavepoint = p->xSavepoint ? vtshimSavepoint : 0;
    pAux->sSelf.xRelease = p->xRelease ? vtshimRelease : 0;
    pAux->sSelf.xRollbackTo = p->xRollbackTo ? vtshimRollbackTo : 0;
  }else{
    pAux->sSelf.xSavepoint = 0;
    pAux->sSelf.xRelease = 0;
    pAux->sSelf.xRollbackTo = 0;
  }
  rc = sqlite3_create_module_v2(db, zName, &pAux->sSelf,
                                pAux, vtshimAuxDestructor);
  return rc==SQLITE_OK ? (void*)pAux : 0;
}

#ifdef _WIN32
__declspec(dllexport)
#endif
void sqlite3_dispose_module(void *pX){
  vtshim_aux *pAux = (vtshim_aux*)pX;
  if( !pAux->bDisposed ){
    vtshim_vtab *pVtab;
    vtshim_cursor *pCur;
    for(pVtab=pAux->pAllVtab; pVtab; pVtab=pVtab->pNext){
      for(pCur=pVtab->pAllCur; pCur; pCur=pCur->pNext){
        pAux->pMod->xClose(pCur->pChild);
      }
      pAux->pMod->xDisconnect(pVtab->pChild);
    }
    pAux->bDisposed = 1;
    if( pAux->xChildDestroy ){
      pAux->xChildDestroy(pAux->pChildAux);
      pAux->xChildDestroy = 0;
    }
  }
}


#endif /* SQLITE_OMIT_VIRTUALTABLE */

#ifdef _WIN32
__declspec(dllexport)
#endif
int sqlite3_vtshim_init(
  sqlite3 *db,
  char **pzErrMsg,
  const sqlite3_api_routines *pApi
){
  SQLITE_EXTENSION_INIT2(pApi);
  return SQLITE_OK;
}

Added SQLite.Interop/src/generic/interop.c.











































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

#ifdef _WIN32
#define SQLITE_API __declspec(dllexport)
#else
#define WINAPI
#endif

#if /* SQLITE_VERSION_NUMBER >= 3013000 && */ defined(INTEROP_SESSION_EXTENSION)
#ifndef SQLITE_ENABLE_SESSION
#define SQLITE_ENABLE_SESSION (1)
#endif
#ifndef SQLITE_ENABLE_PREUPDATE_HOOK
#define SQLITE_ENABLE_PREUPDATE_HOOK (1)
#endif
#endif

#ifndef SQLITE_MAX_ATTACHED
#define SQLITE_MAX_ATTACHED 30
#endif

#if defined(INTEROP_INCLUDE_SEE)
#include "../core/sqlite3-see.c"
#else
#include "../core/sqlite3.c"
#endif

#if SQLITE_OS_WIN
#define GETPID (int)GetCurrentProcessId
#else
#define WINAPI
#define GETPID getpid
#endif

#if SQLITE_OS_WIN
#if SQLITE_OS_WINCE
#define VOLATILE
#else
#define VOLATILE volatile
#endif
#else
#define VOLATILE volatile
typedef long LONG;
#define InterlockedIncrement(p) (*((LONG*)(p)))++
#define InterlockedDecrement(p) (*((LONG*)(p)))--
#endif

#if !SQLITE_OS_WIN
#include <wchar.h>
#endif

#if defined(INTEROP_INCLUDE_EXTRA)
#include "../ext/extra.c"
#endif

#if defined(INTEROP_INCLUDE_CEROD)
#include "../ext/cerod.c"
#endif

#if SQLITE_VERSION_NUMBER < 3032000 && defined(INTEROP_INCLUDE_SEE)
#include "../ext/see.c"
#endif

#if defined(INTEROP_INCLUDE_ZIPVFS)
#include "../ext/zipvfs.c"
#if defined(SQLITE_ENABLE_ZIPVFS_VTAB)
#include "../ext/zipvfs_vtab.c"
#endif
#include "../ext/algorithms.c"
#endif

#if defined(INTEROP_EXTENSION_FUNCTIONS)
#undef COMPILE_SQLITE_EXTENSIONS_AS_LOADABLE_MODULE
#include "../contrib/extension-functions.c"
extern int RegisterExtensionFunctions(sqlite3 *db, int bNoCore);
#endif

#if SQLITE_OS_WIN && defined(INTEROP_CODEC) && !defined(INTEROP_INCLUDE_SEE)
#ifdef SQLITE_ENABLE_ZIPVFS
#define INTEROP_CODEC_GET_PAGER(a,b,c) sqlite3PagerGet(a,b,c,0)
#elif SQLITE_VERSION_NUMBER >= 3010000
#define INTEROP_CODEC_GET_PAGER(a,b,c) sqlite3PagerGet(a,b,c,0)
#else
#define INTEROP_CODEC_GET_PAGER(a,b,c) sqlite3PagerGet(a,b,c)
#endif
#include "../win/crypt.c"
#endif

#include "interop.h"

#define INTEROP_DEBUG_NONE           (0x0000)
#define INTEROP_DEBUG_CLOSE          (0x0001)
#define INTEROP_DEBUG_FINALIZE       (0x0002)
#define INTEROP_DEBUG_BACKUP_FINISH  (0x0004)
#define INTEROP_DEBUG_OPEN           (0x0008)
#define INTEROP_DEBUG_OPEN16         (0x0010)
#define INTEROP_DEBUG_PREPARE        (0x0020)
#define INTEROP_DEBUG_PREPARE16      (0x0040)
#define INTEROP_DEBUG_RESET          (0x0080)
#define INTEROP_DEBUG_CHANGES        (0x0100)
#define INTEROP_DEBUG_BREAK          (0x0200)
#define INTEROP_DEBUG_BLOB_CLOSE     (0x0400)

#if defined(_MSC_VER) && defined(INTEROP_DEBUG) && \
    (INTEROP_DEBUG & INTEROP_DEBUG_BREAK)
#define sqlite3InteropBreak(a) { sqlite3InteropDebug("[%d] %s\n", GETPID(), (a)); __debugbreak(); }
#else
#define sqlite3InteropBreak(a)
#endif

typedef void (*SQLITEUSERFUNC)(sqlite3_context *, int, sqlite3_value **);
typedef void (*SQLITEFUNCFINAL)(sqlite3_context *);

/*
** An array of names of all compile-time options.  This array should
** be sorted A-Z.
**
** This array looks large, but in a typical installation actually uses
** only a handful of compile-time options, so most times this array is usually
** rather short and uses little memory space.
*/
static const char * const azInteropCompileOpt[] = {

/* These macros are provided to "stringify" the value of the define
** for those options in which the value is meaningful. */
#ifndef CTIMEOPT_VAL_
#define CTIMEOPT_VAL_(opt) #opt
#endif

#ifndef CTIMEOPT_VAL
#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)
#endif

#ifdef INTEROP_CODEC
  "CODEC",
#endif
#ifdef INTEROP_DEBUG
  "DEBUG=" CTIMEOPT_VAL(INTEROP_DEBUG),
#endif
#ifdef INTEROP_EXTENSION_FUNCTIONS
  "EXTENSION_FUNCTIONS",
#endif
#ifdef INTEROP_FTS5_EXTENSION
  "FTS5_EXTENSION",
#endif
#ifdef INTEROP_INCLUDE_CEROD
  "INCLUDE_CEROD",
#endif
#ifdef INTEROP_INCLUDE_EXTRA
  "INCLUDE_EXTRA",
#endif
#ifdef INTEROP_INCLUDE_SEE
  "INCLUDE_SEE",
#endif
#ifdef INTEROP_INCLUDE_ZIPVFS
  "INCLUDE_ZIPVFS",
#endif
#ifdef INTEROP_JSON1_EXTENSION
  "JSON1_EXTENSION",
#endif
#ifdef INTEROP_LEGACY_CLOSE
  "LEGACY_CLOSE",
#endif
#ifdef INTEROP_LOG
  "LOG",
#endif
#ifdef INTEROP_PERCENTILE_EXTENSION
  "PERCENTILE_EXTENSION",
#endif
#ifdef INTEROP_REGEXP_EXTENSION
  "REGEXP_EXTENSION",
#endif
#ifdef INTEROP_SESSION_EXTENSION
  "SESSION_EXTENSION",
#endif
#ifdef INTEROP_SHA1_EXTENSION
  "SHA1_EXTENSION",
#endif
#ifdef INTEROP_SHA3_EXTENSION
  "SHA3_EXTENSION",
#endif
#ifdef INTEROP_TEST_EXTENSION
  "TEST_EXTENSION",
#endif
#ifdef INTEROP_TOTYPE_EXTENSION
  "TOTYPE_EXTENSION",
#endif
#ifdef SQLITE_VERSION_NUMBER
  "VERSION_NUMBER=" CTIMEOPT_VAL(SQLITE_VERSION_NUMBER),
#endif
#ifdef INTEROP_VIRTUAL_TABLE
  "VIRTUAL_TABLE",
#endif
};

/*
** Returns the number of 16-bit code points present in the specified
** string pointer, stopping when a zero terminator is found.  If the
** string pointer is NULL, the return value is undefined.
*/
size_t u16_str_len(const u16 *str){
  size_t len = 0;
  if( str!=NULL ){ while( (*str)!=0 ){ str++; len++; } }
  return len;
}

/*
** Returns the number of code points present in the specified string
** pointer, stopping when a zero terminator is found.  If the string
** pointer is NULL, the return value is undefined.
*/
size_t utf16_str_len(const void *str){
  assert( sizeof(u16)==2 );
#if SQLITE_OS_WIN
  assert( sizeof(wchar_t)==sizeof(u16) );
  return wcslen((wchar_t *)str);
#else
  return u16_str_len((u16 *)str);
#endif
}

/*
** Given the name of a compile-time option, return true if that option
** was used and false if not.
**
** The name can optionally begin with "SQLITE_" or "INTEROP_" but those
** prefixes are not required for a match.
*/
SQLITE_API int WINAPI interop_compileoption_used(const char *zOptName){
  int i, n;
  if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;
  if( sqlite3StrNICmp(zOptName, "INTEROP_", 8)==0 ) zOptName += 8;
  n = sqlite3Strlen30(zOptName);

  /* Since ArraySize(azInteropCompileOpt) is normally in single digits, a
  ** linear search is adequate.  No need for a binary search. */
  for(i=0; i<ArraySize(azInteropCompileOpt); i++){
    if( sqlite3StrNICmp(zOptName, azInteropCompileOpt[i], n)==0
     && sqlite3CtypeMap[(unsigned char)azInteropCompileOpt[i][n]]==0
    ){
      return 1;
    }
  }
  return 0;
}

/*
** Return the N-th compile-time option string.  If N is out of range,
** return a NULL pointer.
*/
SQLITE_API const char *WINAPI interop_compileoption_get(int N){
  if( N>=0 && N<ArraySize(azInteropCompileOpt) ){
    return azInteropCompileOpt[N];
  }
  return 0;
}

#if defined(INTEROP_DEBUG) || defined(INTEROP_LOG)
SQLITE_PRIVATE void sqlite3InteropDebug(const char *zFormat, ...){
  va_list ap;                         /* Vararg list */
#if SQLITE_VERSION_NUMBER >= 3024000
  sqlite3_str acc;                    /* Post 3.24 String accumulator */
#else
  StrAccum acc;                       /* Pre 3.24 string accumulator */
#endif
  char zMsg[SQLITE_PRINT_BUF_SIZE*3]; /* Complete log message */
  va_start(ap, zFormat);
#if SQLITE_VERSION_NUMBER >= 3008010
  sqlite3StrAccumInit(&acc, 0, zMsg, sizeof(zMsg), 0);
#else
  sqlite3StrAccumInit(&acc, zMsg, sizeof(zMsg), 0);
  acc.useMalloc = 0;
#endif
#if SQLITE_VERSION_NUMBER >= 3024000
  sqlite3_str_vappendf(&acc, zFormat, ap);
#elif SQLITE_VERSION_NUMBER >= 3011000
  sqlite3VXPrintf(&acc, zFormat, ap);
#else
  sqlite3VXPrintf(&acc, 0, zFormat, ap);
#endif
  va_end(ap);
#if SQLITE_OS_WIN && SQLITE_VERSION_NUMBER >= 3007013
  sqlite3_win32_write_debug(sqlite3StrAccumFinish(&acc), -1);
#elif SQLITE_OS_WIN && defined(SQLITE_WIN32_HAS_ANSI)
  OutputDebugStringA(sqlite3StrAccumFinish(&acc));
#elif SQLITE_OS_WIN && defined(SQLITE_WIN32_HAS_WIDE)
  {
    LPWSTR zWideMsg = utf8ToUnicode(sqlite3StrAccumFinish(&acc));
    if( zWideMsg ){
      OutputDebugStringW(zWideMsg);
      sqlite3_free(zWideMsg);
    }
  }
#else
  fprintf(stderr, "%s", sqlite3StrAccumFinish(&acc));
#endif
}
#endif

#if defined(INTEROP_LOG)
SQLITE_PRIVATE VOLATILE LONG logConfigured = 0;

SQLITE_PRIVATE void sqlite3InteropLogCallback(void *pArg, int iCode, const char *zMsg){
  sqlite3InteropDebug("[%d] INTEROP_LOG (%d) %s\n", GETPID(), iCode, zMsg);
}
#endif

SQLITE_API int WINAPI sqlite3_malloc_size_interop(void *p){
  return sqlite3MallocSize(p);
}

SQLITE_API void WINAPI sqlite3_msize_interop(void *p, sqlite_uint64 *pN)
{
  if (!pN) return;
  *pN = sqlite3_msize(p);
}

#if defined(INTEROP_LEGACY_CLOSE) || SQLITE_VERSION_NUMBER < 3007014
SQLITE_PRIVATE void * sqlite3DbMallocZero_interop(sqlite3 *db, int n)
{
  void *p;
  if (db) {
    sqlite3_mutex_enter(db->mutex);
  }
  p = sqlite3DbMallocZero(db,n);
  if (db) {
    sqlite3_mutex_leave(db->mutex);
  }
  return p;
}

SQLITE_PRIVATE void sqlite3DbFree_interop(sqlite3 *db, void *p)
{
  if (db) {
    sqlite3_mutex_enter(db->mutex);
  }
  if (p) {
#if SQLITE_VERSION_NUMBER >= 3008007
    sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
#else
    sqlite3MemdebugSetType(p, MEMTYPE_DB|MEMTYPE_HEAP);
#endif
  }
  sqlite3DbFree(db,p);
  if (db) {
    sqlite3_mutex_leave(db->mutex);
  }
}
#endif

/*
    The goal of this version of close is different than that of sqlite3_close(), and is designed to lend itself better to .NET's non-deterministic finalizers and
    the GC thread.  SQLite will not close a database if statements are open on it -- but for our purposes, we'd rather finalize all active statements
    and forcibly close the database.  The reason is simple -- a lot of people don't Dispose() of their objects correctly and let the garbage collector
    do it.  This leads to unexpected behavior when a user thinks they've closed a database, but it's still open because not all the statements have
    hit the GC yet.

    So, here we have a problem ... .NET has a pointer to any number of sqlite3_stmt objects.  We can't call sqlite3_finalize() on these because
    their memory is freed and can be used for something else.  The GC thread could potentially try and call finalize again on the statement after
    that memory was deallocated.  BAD.  So, what we need to do is make a copy of each statement, and call finalize() on the copy -- so that the original
    statement's memory is preserved, and marked as BAD, but we can still manage to finalize everything and forcibly close the database.  Later when the
    GC gets around to calling finalize_interop() on the "bad" statement, we detect that and finish deallocating the pointer.
*/
SQLITE_API int WINAPI sqlite3_close_interop(sqlite3 *db)
{
  int ret;
#if !defined(INTEROP_LEGACY_CLOSE) && SQLITE_VERSION_NUMBER >= 3007014

#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_CLOSE)
  sqlite3InteropDebug("[%d] sqlite3_close_interop(): calling sqlite3_close_v2(%p)...\n", GETPID(), db);
#endif

  ret = sqlite3_close_v2(db);

#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_CLOSE)
  sqlite3InteropDebug("[%d] sqlite3_close_interop(): sqlite3_close_v2(%p) returned %d.\n", GETPID(), db, ret);
#endif

  return ret;
#else
  ret = sqlite3_close(db);

  if (ret == SQLITE_BUSY)
  {
    sqlite3_mutex_enter(db->mutex);

    if (!db->pVdbe)
    {
      sqlite3_mutex_leave(db->mutex);
      return ret;
    }

    while (db->pVdbe)
    {
      /* Make a copy of the first prepared statement */
      Vdbe *p = (Vdbe *)sqlite3DbMallocZero_interop(db, sizeof(Vdbe));
      Vdbe *po = db->pVdbe;

      if (!p)
      {
        ret = SQLITE_NOMEM;
        break;
      }

      CopyMemory(p, po, sizeof(Vdbe));

      /* Put it on the chain so we can free it */
      db->pVdbe = p;
      ret = sqlite3_finalize((sqlite3_stmt *)p); /* This will also free the copy's memory */
      if (ret)
      {
        /* finalize failed -- so we must put back anything we munged */
        CopyMemory(po, p, sizeof(Vdbe));
        db->pVdbe = po;

        /*
        ** NOTE: Ok, we must free this block that *we* allocated (above) since
        **       finalize did not do so.
        */
        sqlite3DbFree_interop(db, p);
        break;
      }
      else
      {
        ZeroMemory(po, sizeof(Vdbe));
        po->magic = VDBE_MAGIC_DEAD;
      }
    }
    sqlite3_mutex_leave(db->mutex);
    ret = sqlite3_close(db);
  }
  return ret;
#endif
}

#if defined(INTEROP_LOG)
SQLITE_API int WINAPI sqlite3_config_log_interop()
{
  int ret;

  if( InterlockedIncrement(&logConfigured)==1 ){
    ret = sqlite3_config(SQLITE_CONFIG_LOG, sqlite3InteropLogCallback, 0);
    if( ret!=SQLITE_OK ){
      sqlite3InteropDebug("[%d] sqlite3_config_log_interop(): sqlite3_config(SQLITE_CONFIG_LOG) returned %d.\n", GETPID(), ret);
      InterlockedDecrement(&logConfigured);
    }
  }else{
    ret = SQLITE_DONE;
    InterlockedDecrement(&logConfigured);
  }
  return ret;
}

SQLITE_API int WINAPI sqlite3_unconfig_log_interop()
{
  int ret;

  if( InterlockedDecrement(&logConfigured)==0 ){
    ret = sqlite3_config(SQLITE_CONFIG_LOG, NULL, 0);
    if( ret!=SQLITE_OK ){
      sqlite3InteropDebug("[%d] sqlite3_unconfig_log_interop(): sqlite3_config(SQLITE_CONFIG_LOG) returned %d.\n", GETPID(), ret);
      InterlockedIncrement(&logConfigured);
    }
  }else{
    ret = SQLITE_DONE;
    InterlockedIncrement(&logConfigured);
  }
  return ret;
}
#endif

SQLITE_API const char *WINAPI interop_libversion(void)
{
  return INTEROP_VERSION;
}

SQLITE_API const char *WINAPI interop_sourceid(void)
{
  return INTEROP_SOURCE_ID " " INTEROP_SOURCE_TIMESTAMP;
}

SQLITE_API int WINAPI sqlite3_open_interop(const char *filename, const char *vfsName, int flags, int extFuncs, sqlite3 **ppdb)
{
#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_OPEN)
  sqlite3InteropDebug("[%d] sqlite3_open_interop(): calling sqlite3_open_v2(\"%s\", \"%s\", %d, %d, %p)...\n", GETPID(), filename, vfsName, flags, extFuncs, ppdb);
#endif

  {
    int ret = sqlite3_open_v2(filename, ppdb, flags, vfsName);

#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_OPEN)
    sqlite3InteropDebug("[%d] sqlite3_open_interop(): sqlite3_open_v2(\"%s\", \"%s\", %d, %d, %p) returned %d.\n", GETPID(), filename, vfsName, flags, extFuncs, ppdb, ret);
#endif

#if defined(INTEROP_EXTENSION_FUNCTIONS)
    if ((ret == SQLITE_OK) && ppdb && ((extFuncs & 1) == 1))
      RegisterExtensionFunctions(*ppdb, ((extFuncs & 2) == 2));
#endif

    return ret;
  }
}

SQLITE_API int WINAPI sqlite3_open16_interop(const char *filename, const char *vfsName, int flags, int extFuncs, sqlite3 **ppdb)
{
#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_OPEN16)
  sqlite3InteropDebug("[%d] sqlite3_open16_interop(): calling sqlite3_open_v2(\"%s\", \"%s\", %d, %d, %p)...\n", GETPID(), filename, vfsName, flags, extFuncs, ppdb);
#endif

  {
    int ret = sqlite3_open_v2(filename, ppdb, flags, vfsName);

#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_OPEN16)
    sqlite3InteropDebug("[%d] sqlite3_open16_interop(): sqlite3_open_v2(\"%s\", \"%s\", %d, %d, %p) returned %d.\n", GETPID(), filename, vfsName, flags, extFuncs, ppdb, ret);
#endif

#if defined(INTEROP_EXTENSION_FUNCTIONS)
    if ((ret == SQLITE_OK) && ppdb && extFuncs)
      RegisterExtensionFunctions(*ppdb, ((extFuncs & 2) == 2));
#endif

    if ((ret == SQLITE_OK) && ppdb && !DbHasProperty(*ppdb, 0, DB_SchemaLoaded))
    {
      ENC(*ppdb) = SQLITE_UTF16NATIVE;

#if SQLITE_VERSION_NUMBER >= 3008008
      //
      // BUGFIX: See ticket [7c151a2f0e22804c].
      //
      SCHEMA_ENC(*ppdb) = SQLITE_UTF16NATIVE;
#endif
    }

    return ret;
  }
}

SQLITE_API const char *WINAPI sqlite3_errmsg_interop(sqlite3 *db, int *plen)
{
  const char *pval = sqlite3_errmsg(db);
  if (plen) *plen = pval ? strlen(pval) : 0;
  return pval;
}

SQLITE_API int WINAPI sqlite3_changes_interop(sqlite3 *db)
{
  int result;

#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_CHANGES)
  sqlite3InteropDebug("[%d] sqlite3_changes_interop(): calling sqlite3_changes(%p)...\n", GETPID(), db);
#endif

#ifndef NDEBUG
  if (!db)
      sqlite3InteropBreak("null database handle for sqlite3_changes()");
#endif

  result = sqlite3_changes(db);

#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_CHANGES)
  sqlite3InteropDebug("[%d] sqlite3_changes_interop(): sqlite3_changes(%p) returned %d.\n", GETPID(), db, result);
#endif

  return result;
}

SQLITE_API int WINAPI sqlite3_prepare_interop(sqlite3 *db, const char *sql, int nbytes, sqlite3_stmt **ppstmt, const char **pztail, int *plen)
{
  int n;

#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_PREPARE)
  sqlite3InteropDebug("[%d] sqlite3_prepare_interop(): calling sqlite3_prepare(%p, \"%s\", %d, %p)...\n", GETPID(), db, sql, nbytes, ppstmt);
#endif

#if SQLITE_VERSION_NUMBER >= 3003009
  n = sqlite3_prepare_v2(db, sql, nbytes, ppstmt, pztail);
#else
  n = sqlite3_prepare(db, sql, nbytes, ppstmt, pztail);
#endif

#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_PREPARE)
  sqlite3InteropDebug("[%d] sqlite3_prepare_interop(): sqlite3_prepare(%p, \"%s\", %d, %p) returned %d.\n", GETPID(), db, sql, nbytes, ppstmt, n);
#endif

  if (plen) *plen = (pztail && *pztail) ? strlen(*pztail) : 0;

  return n;
}

SQLITE_API int WINAPI sqlite3_prepare16_interop(sqlite3 *db, const void *sql, int nchars, sqlite3_stmt **ppstmt, const void **pztail, int *plen)
{
  int n;

#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_PREPARE16)
  sqlite3InteropDebug("[%d] sqlite3_prepare_interop(): calling sqlite3_prepare16(%p, \"%s\", %d, %p)...\n", GETPID(), db, sql, nchars, ppstmt);
#endif

#if SQLITE_VERSION_NUMBER >= 3003009
  n = sqlite3_prepare16_v2(db, sql, nchars * sizeof(u16), ppstmt, pztail);
#else
  n = sqlite3_prepare16(db, sql, nchars * sizeof(u16), ppstmt, pztail);
#endif

#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_PREPARE16)
  sqlite3InteropDebug("[%d] sqlite3_prepare_interop(): sqlite3_prepare16(%p, \"%s\", %d, %p) returned %d.\n", GETPID(), db, sql, nchars, ppstmt, n);
#endif

  if (plen) *plen = (pztail && *pztail) ? utf16_str_len(*pztail) * sizeof(u16) : 0;

  return n;
}

#if defined(INTEROP_VIRTUAL_TABLE) && SQLITE_VERSION_NUMBER >= 3004001
#ifdef _WIN32
__declspec(dllexport)
#endif
void *sqlite3_create_disposable_module(
  sqlite3 *db,
  const char *zName,
  const sqlite3_module *p,
  void *pClientData,
  void(*xDestroy)(void*)
); /* defined in "src/ext/vtshim.c" (included below) */

SQLITE_API void *WINAPI sqlite3_create_disposable_module_interop(
  sqlite3 *db,
  const char *zName,
  sqlite3_module *pModule,
  int iVersion,
  int (*xCreate)(sqlite3*, void *, int, const char *const*, sqlite3_vtab **, char**),
  int (*xConnect)(sqlite3*, void *, int, const char *const*, sqlite3_vtab **, char**),
  int (*xBestIndex)(sqlite3_vtab *, sqlite3_index_info*),
  int (*xDisconnect)(sqlite3_vtab *),
  int (*xDestroy)(sqlite3_vtab *),
  int (*xOpen)(sqlite3_vtab *, sqlite3_vtab_cursor **),
  int (*xClose)(sqlite3_vtab_cursor*),
  int (*xFilter)(sqlite3_vtab_cursor*, int, const char *, int, sqlite3_value **),
  int (*xNext)(sqlite3_vtab_cursor*),
  int (*xEof)(sqlite3_vtab_cursor*),
  int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int),
  int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *),
  int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *),
  int (*xBegin)(sqlite3_vtab *),
  int (*xSync)(sqlite3_vtab *),
  int (*xCommit)(sqlite3_vtab *),
  int (*xRollback)(sqlite3_vtab *),
  int (*xFindFunction)(sqlite3_vtab *, int, const char *, void (**pxFunc)(sqlite3_context*, int, sqlite3_value**), void **ppArg),
  int (*xRename)(sqlite3_vtab *, const char *),
  int (*xSavepoint)(sqlite3_vtab *, int),
  int (*xRelease)(sqlite3_vtab *, int),
  int (*xRollbackTo)(sqlite3_vtab *, int),
  void *pClientData,
  void(*xDestroyModule)(void*)
){
  if (!pModule) return 0;
  memset(pModule, 0, sizeof(*pModule));
  pModule->iVersion = iVersion;
  pModule->xCreate = xCreate;
  pModule->xConnect = xConnect;
  pModule->xBestIndex = xBestIndex;
  pModule->xDisconnect = xDisconnect;
  pModule->xDestroy = xDestroy;
  pModule->xOpen = xOpen;
  pModule->xClose = xClose;
  pModule->xFilter = xFilter;
  pModule->xNext = xNext;
  pModule->xEof = xEof;
  pModule->xColumn = xColumn;
  pModule->xRowid = xRowid;
  pModule->xUpdate = xUpdate;
  pModule->xBegin = xBegin;
  pModule->xSync = xSync;
  pModule->xCommit = xCommit;
  pModule->xRollback = xRollback;
  pModule->xFindFunction = xFindFunction;
  pModule->xRename = xRename;
  pModule->xSavepoint = xSavepoint;
  pModule->xRelease = xRelease;
  pModule->xRollbackTo = xRollbackTo;
  return sqlite3_create_disposable_module(db, zName, pModule, pClientData, xDestroyModule);
}
#endif

SQLITE_API int WINAPI sqlite3_bind_double_interop(sqlite3_stmt *stmt, int iCol, double *val)
{
  if (!val) return SQLITE_ERROR;
  return sqlite3_bind_double(stmt,iCol,*val);
}

SQLITE_API int WINAPI sqlite3_bind_int64_interop(sqlite3_stmt *stmt, int iCol, sqlite_int64 *val)
{
  if (!val) return SQLITE_ERROR;
  return sqlite3_bind_int64(stmt,iCol,*val);
}

SQLITE_API const char * WINAPI sqlite3_bind_parameter_name_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const char *pval = sqlite3_bind_parameter_name(stmt, iCol);
  if (plen) *plen = pval ? strlen(pval) : 0;
  return pval;
}

SQLITE_API const char * WINAPI sqlite3_column_name_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const char *pval = sqlite3_column_name(stmt, iCol);
  if (plen) *plen = pval ? strlen(pval) : 0;
  return pval;
}

SQLITE_API const void * WINAPI sqlite3_column_name16_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const void *pval = sqlite3_column_name16(stmt, iCol);
  if (plen) *plen = pval ? utf16_str_len(pval) * sizeof(u16) : 0;
  return pval;
}

SQLITE_API const char * WINAPI sqlite3_column_decltype_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const char *pval = sqlite3_column_decltype(stmt, iCol);
  if (plen) *plen = pval ? strlen(pval) : 0;
  return pval;
}

SQLITE_API const void * WINAPI sqlite3_column_decltype16_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const void *pval = sqlite3_column_decltype16(stmt, iCol);
  if (plen) *plen = pval ? utf16_str_len(pval) * sizeof(u16) : 0;
  return pval;
}

SQLITE_API void WINAPI sqlite3_column_double_interop(sqlite3_stmt *stmt, int iCol, double *val)
{
  if (!val) return;
  *val = sqlite3_column_double(stmt,iCol);
}

SQLITE_API void WINAPI sqlite3_column_int64_interop(sqlite3_stmt *stmt, int iCol, sqlite_int64 *val)
{
  if (!val) return;
  *val = sqlite3_column_int64(stmt,iCol);
}

SQLITE_API void WINAPI sqlite3_last_insert_rowid_interop(sqlite3 *db, sqlite_int64 *rowId)
{
  if (!rowId) return;
  *rowId = sqlite3_last_insert_rowid(db);
}

SQLITE_API void WINAPI sqlite3_memory_used_interop(sqlite_int64 *nBytes)
{
  if (!nBytes) return;
  *nBytes = sqlite3_memory_used();
}

SQLITE_API void WINAPI sqlite3_memory_highwater_interop(int resetFlag, sqlite_int64 *nBytes)
{
  if (!nBytes) return;
  *nBytes = sqlite3_memory_highwater(resetFlag);
}

SQLITE_API const unsigned char * WINAPI sqlite3_column_text_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const unsigned char *pval = sqlite3_column_text(stmt, iCol);
  if (plen) *plen = sqlite3_column_bytes(stmt, iCol);
  return pval;
}

SQLITE_API const void * WINAPI sqlite3_column_text16_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const void *pval = sqlite3_column_text16(stmt, iCol);
  if (plen) *plen = sqlite3_column_bytes16(stmt, iCol);
  return pval;
}

SQLITE_API int WINAPI sqlite3_finalize_interop(sqlite3_stmt *stmt)
{
  int ret;
#if !defined(INTEROP_LEGACY_CLOSE) && SQLITE_VERSION_NUMBER >= 3007014

#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_FINALIZE)
  Vdbe *p = (Vdbe *)stmt;
  sqlite3 *db = p ? p->db : 0;
  sqlite3InteropDebug("[%d] sqlite3_finalize_interop(): calling sqlite3_finalize(%p, %p)...\n", GETPID(), db, stmt);
#endif

  ret = sqlite3_finalize(stmt);

#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_FINALIZE)
  sqlite3InteropDebug("[%d] sqlite3_finalize_interop(): sqlite3_finalize(%p, %p) returned %d.\n", GETPID(), db, stmt, ret);
#endif

  return ret;
#else
  Vdbe *p;
  ret = SQLITE_OK;

  p = (Vdbe *)stmt;
  if (p)
  {
    sqlite3 *db = p->db;

    if (db != NULL)
      sqlite3_mutex_enter(db->mutex);

    if ((p->magic == VDBE_MAGIC_DEAD) && (db == NULL))
    {
      sqlite3DbFree_interop(db, p);
    }
    else
    {
      ret = sqlite3_finalize(stmt);
    }

    if (db != NULL)
      sqlite3_mutex_leave(db->mutex);
  }

  return ret;
#endif
}

SQLITE_API int WINAPI sqlite3_backup_finish_interop(sqlite3_backup *p)
{
  int ret;

#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_BACKUP_FINISH)
  sqlite3* pDestDb = p ? p->pDestDb : 0;
  sqlite3* pSrcDb = p ? p->pSrcDb : 0;
  sqlite3InteropDebug("[%d] sqlite3_backup_finish_interop(): calling sqlite3_backup_finish(%p, %p, %p)...\n", GETPID(), pDestDb, pSrcDb, p);
#endif

  ret = sqlite3_backup_finish(p);

#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_BACKUP_FINISH)
  sqlite3InteropDebug("[%d] sqlite3_backup_finish_interop(): sqlite3_backup_finish(%p, %p, %p) returned %d.\n", GETPID(), pDestDb, pSrcDb, p, ret);
#endif

  return ret;
}

SQLITE_API int WINAPI sqlite3_blob_close_interop(sqlite3_blob *p)
{
  int ret;

#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_BLOB_CLOSE)
  sqlite3InteropDebug("[%d] sqlite3_blob_close_interop(): calling sqlite3_blob_close(%p)...\n", GETPID(), p);
#endif

  ret = sqlite3_blob_close(p);

#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_BLOB_CLOSE)
  sqlite3InteropDebug("[%d] sqlite3_blob_close_interop(): sqlite3_blob_close(%p) returned %d.\n", GETPID(), p, ret);
#endif

  return ret;
}

SQLITE_API int WINAPI sqlite3_reset_interop(sqlite3_stmt *stmt)
{
  int ret;
#if !defined(INTEROP_LEGACY_CLOSE) && SQLITE_VERSION_NUMBER >= 3007014

#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_RESET)
  sqlite3InteropDebug("[%d] sqlite3_reset_interop(): calling sqlite3_reset(%p)...\n", GETPID(), stmt);
#endif

  ret = sqlite3_reset(stmt);

#if defined(INTEROP_DEBUG) && (INTEROP_DEBUG & INTEROP_DEBUG_RESET)
  sqlite3InteropDebug("[%d] sqlite3_reset_interop(): sqlite3_reset(%p) returned %d.\n", GETPID(), stmt, ret);
#endif

  return ret;
#else
  if (stmt && ((Vdbe *)stmt)->magic == VDBE_MAGIC_DEAD) return SQLITE_SCHEMA;
  ret = sqlite3_reset(stmt);
  return ret;
#endif
}

SQLITE_API int WINAPI sqlite3_create_function_interop(sqlite3 *psql, const char *zFunctionName, int nArg, int eTextRep, void *pvUser, SQLITEUSERFUNC func, SQLITEUSERFUNC funcstep, SQLITEFUNCFINAL funcfinal, int needCollSeq)
{
  int n;

  if (eTextRep == SQLITE_UTF16)
    eTextRep = SQLITE_UTF16NATIVE;

  n = sqlite3_create_function(psql, zFunctionName, nArg, eTextRep, pvUser, func, funcstep, funcfinal);
  if (n == SQLITE_OK)
  {
    if (needCollSeq)
    {
      FuncDef *pFunc = sqlite3FindFunction(
          psql, zFunctionName,
#if SQLITE_VERSION_NUMBER < 3012000
          strlen(zFunctionName),
#endif
          nArg, eTextRep, 0);
      if( pFunc )
      {
#if SQLITE_VERSION_NUMBER >= 3008001
        pFunc->funcFlags |= SQLITE_FUNC_NEEDCOLL;
#else
        pFunc->flags |= SQLITE_FUNC_NEEDCOLL;
#endif
      }
    }
  }

  return n;
}

SQLITE_API int WINAPI sqlite3_create_window_function_interop(sqlite3 *psql, const char *zFunctionName, int nArg, int eTextRep, void *pvUser, SQLITEUSERFUNC funcstep, SQLITEFUNCFINAL funcfinal, SQLITEFUNCFINAL funcvalue, SQLITEUSERFUNC funcinverse, int needCollSeq)
{
  int n;

  if (eTextRep == SQLITE_UTF16)
    eTextRep = SQLITE_UTF16NATIVE;

  n = sqlite3_create_window_function(psql, zFunctionName, nArg, eTextRep, pvUser, funcstep, funcfinal, funcvalue, funcinverse, NULL);
  if (n == SQLITE_OK)
  {
    if (needCollSeq)
    {
      FuncDef *pFunc = sqlite3FindFunction(
          psql, zFunctionName,
#if SQLITE_VERSION_NUMBER < 3012000
          strlen(zFunctionName),
#endif
          nArg, eTextRep, 0);
      if( pFunc )
      {
#if SQLITE_VERSION_NUMBER >= 3008001
        pFunc->funcFlags |= SQLITE_FUNC_NEEDCOLL;
#else
        pFunc->flags |= SQLITE_FUNC_NEEDCOLL;
#endif
      }
    }
  }

  return n;
}

SQLITE_API void WINAPI sqlite3_value_double_interop(sqlite3_value *pval, double *val)
{
  if (!val) return;
  *val = sqlite3_value_double(pval);
}

SQLITE_API void WINAPI sqlite3_value_int64_interop(sqlite3_value *pval, sqlite_int64 *val)
{
  if (!val) return;
  *val = sqlite3_value_int64(pval);
}

SQLITE_API const unsigned char * WINAPI sqlite3_value_text_interop(sqlite3_value *val, int *plen)
{
  const unsigned char *pval = sqlite3_value_text(val);
  if (plen) *plen = sqlite3_value_bytes(val);
  return pval;
}

SQLITE_API const void * WINAPI sqlite3_value_text16_interop(sqlite3_value *val, int *plen)
{
  const void *pval = sqlite3_value_text16(val);
  if (plen) *plen = sqlite3_value_bytes16(val);
  return pval;
}

SQLITE_API void WINAPI sqlite3_result_double_interop(sqlite3_context *pctx, double *val)
{
  if (!val) return;
  sqlite3_result_double(pctx, *val);
}

SQLITE_API void WINAPI sqlite3_result_int64_interop(sqlite3_context *pctx, sqlite_int64 *val)
{
  if (!val) return;
  sqlite3_result_int64(pctx, *val);
}

SQLITE_API int WINAPI sqlite3_context_collcompare_interop(sqlite3_context *ctx, const void *p1, int p1len, const void *p2, int p2len)
{
#if SQLITE_VERSION_NUMBER >= 3008007
  CollSeq *pColl = ctx ? sqlite3GetFuncCollSeq(ctx) : 0;
#else
  CollSeq *pColl = ctx ? ctx->pColl : 0;
#endif
  if (!ctx || !ctx->pFunc) return 4; /* ERROR */
  if (!pColl || !pColl->xCmp) return 3; /* ERROR */
#if SQLITE_VERSION_NUMBER >= 3008001
  if ((ctx->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL) == 0) return 2; /* ERROR */
#else
  if ((ctx->pFunc->flags & SQLITE_FUNC_NEEDCOLL) == 0) return 2; /* ERROR */
#endif
  return pColl->xCmp(pColl->pUser, p1len, p1, p2len, p2);
}

SQLITE_API const char * WINAPI sqlite3_context_collseq_interop(sqlite3_context *ctx, int *ptype, int *enc, int *plen)
{
#if SQLITE_VERSION_NUMBER >= 3008007
  CollSeq *pColl = ctx ? sqlite3GetFuncCollSeq(ctx) : 0;
#else
  CollSeq *pColl = ctx ? ctx->pColl : 0;
#endif
  if (ptype) *ptype = 0;
  if (plen) *plen = 0;
  if (enc) *enc = 0;

  if (!ctx || !ctx->pFunc) return NULL;
#if SQLITE_VERSION_NUMBER >= 3008001
  if ((ctx->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL) == 0) return NULL;
#else
  if ((ctx->pFunc->flags & SQLITE_FUNC_NEEDCOLL) == 0) return NULL;
#endif

  if (pColl)
  {
    if (enc) *enc = pColl->enc;
#if SQLITE_VERSION_NUMBER < 3007010
    if (ptype) *ptype = pColl->type;
#endif
    if (plen) *plen = pColl->zName ? strlen(pColl->zName) : 0;

    return pColl->zName;
  }
  return NULL;
}

SQLITE_API const char * WINAPI sqlite3_column_database_name_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const char *pval = sqlite3_column_database_name(stmt, iCol);
  if (plen) *plen = pval ? strlen(pval) : 0;
  return pval;
}

SQLITE_API const void * WINAPI sqlite3_column_database_name16_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const void *pval = sqlite3_column_database_name16(stmt, iCol);
  if (plen) *plen = pval ? utf16_str_len(pval) * sizeof(u16) : 0;
  return pval;
}

SQLITE_API const char * WINAPI sqlite3_column_table_name_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const char *pval = sqlite3_column_table_name(stmt, iCol);
  if (plen) *plen = pval ? strlen(pval) : 0;
  return pval;
}

SQLITE_API const void * WINAPI sqlite3_column_table_name16_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const void *pval = sqlite3_column_table_name16(stmt, iCol);
  if (plen) *plen = pval ? utf16_str_len(pval) * sizeof(u16) : 0;
  return pval;
}

SQLITE_API const char * WINAPI sqlite3_column_origin_name_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const char *pval = sqlite3_column_origin_name(stmt, iCol);
  if (plen) *plen = pval ? strlen(pval) : 0;
  return pval;
}

SQLITE_API const void * WINAPI sqlite3_column_origin_name16_interop(sqlite3_stmt *stmt, int iCol, int *plen)
{
  const void *pval = sqlite3_column_origin_name16(stmt, iCol);
  if (plen) *plen = pval ? utf16_str_len(pval) * sizeof(u16) : 0;
  return pval;
}

SQLITE_API int WINAPI sqlite3_table_column_metadata_interop(sqlite3 *db, const char *zDbName, const char *zTableName, const char *zColumnName, char const **pzDataType, char const **pzCollSeq, int *pNotNull, int *pPrimaryKey, int *pAutoinc, int *pdtLen, int *pcsLen)
{
  int n;

  n = sqlite3_table_column_metadata(db, zDbName, zTableName, zColumnName, pzDataType, pzCollSeq, pNotNull, pPrimaryKey, pAutoinc);

  if (pdtLen) *pdtLen = (pzDataType && *pzDataType) ? strlen(*pzDataType) : 0;
  if (pcsLen) *pcsLen = (pzCollSeq && *pzCollSeq) ? strlen(*pzCollSeq) : 0;

  return n;
}

SQLITE_API int WINAPI sqlite3_index_column_info_interop(sqlite3 *db, const char *zDb, const char *zIndexName, const char *zColumnName, int *sortOrder, int *onError, const char **pzColl, int *plen)
{
  Index *pIdx;
  Table *pTab;
  int n;

  if (!db) return SQLITE_ERROR;
  sqlite3_mutex_enter(db->mutex);
  sqlite3BtreeEnterAll(db);

  pIdx = sqlite3FindIndex(db, zIndexName, zDb);

  sqlite3BtreeLeaveAll(db);
  sqlite3_mutex_leave(db->mutex);

  if (!pIdx) return SQLITE_ERROR;

  pTab = pIdx->pTable;
  for (n = 0; n < pIdx->nColumn; n++)
  {
    int cnum = pIdx->aiColumn[n];
#if SQLITE_VERSION_NUMBER > 3036000
    if (sqlite3StrICmp(pTab->aCol[cnum].zCnName, zColumnName) == 0)
#else
    if (sqlite3StrICmp(pTab->aCol[cnum].zName, zColumnName) == 0)
#endif
    {
      if ( sortOrder ) *sortOrder = pIdx->aSortOrder[n];
      if ( pzColl ) *pzColl = pIdx->azColl[n];
      if ( plen ) *plen = strlen(*pzColl);
      if ( onError ) *onError = pIdx->onError;

      return SQLITE_OK;
    }
  }
  return SQLITE_ERROR;
}

SQLITE_API int WINAPI sqlite3_table_cursor_interop(sqlite3_stmt *pstmt, int iDb, Pgno tableRootPage)
{
  Vdbe *p = (Vdbe *)pstmt;
  sqlite3 *db = (p == NULL) ? NULL : p->db;
  int n;
  int ret = -1; /* NOT FOUND */

  if (!p || !db) return ret;
  sqlite3_mutex_enter(db->mutex);
  for (n = 0; n < p->nCursor && p->apCsr[n] != NULL; n++)
  {
    if (p->apCsr[n]->isTable == 0) continue;
    if (p->apCsr[n]->iDb != iDb) continue;
#if SQLITE_VERSION_NUMBER >= 3010000
    if (p->apCsr[n]->uc.pCursor->pgnoRoot == tableRootPage)
#else
    if (p->apCsr[n]->pCursor->pgnoRoot == tableRootPage)
#endif
    {
      ret = n;
      break;
    }
  }
  sqlite3_mutex_leave(db->mutex);

  return ret;
}

#if SQLITE_VERSION_NUMBER >= 3039000
SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor **pp, u32 *piCol){
  VdbeCursor *p = *pp;
  assert( p->eCurType==CURTYPE_BTREE || p->eCurType==CURTYPE_PSEUDO );
  if( p->deferredMoveto ){
    u32 iMap;
    assert( !p->isEphemeral );
    if( p->ub.aAltMap && (iMap = p->ub.aAltMap[1+*piCol])>0 && !p->nullRow ){
      *pp = p->pAltCursor;
      *piCol = iMap - 1;
      return SQLITE_OK;
    }
    return sqlite3VdbeFinishMoveto(p);
  }
  if( sqlite3BtreeCursorHasMoved(p->uc.pCursor) ){
    return sqlite3VdbeHandleMovedCursor(p);
  }
  return SQLITE_OK;
}
#endif

SQLITE_API int WINAPI sqlite3_cursor_rowid_interop(sqlite3_stmt *pstmt, int cursor, sqlite_int64 *prowid)
{
  Vdbe *p = (Vdbe *)pstmt;
  sqlite3 *db = (p == NULL) ? NULL : p->db;
  VdbeCursor *pC;
#if SQLITE_VERSION_NUMBER >= 3033000
  u32 p2 = 0;
#elif SQLITE_VERSION_NUMBER >= 3011000
  int p2 = 0;
#endif
  int ret = SQLITE_OK;

  if (!p || !db) return SQLITE_ERROR;
  sqlite3_mutex_enter(db->mutex);
  while (1)
  {
    if (cursor < 0 || cursor >= p->nCursor)
    {
      ret = SQLITE_ERROR;
      break;
    }
    if (p->apCsr[cursor] == NULL)
    {
      ret = SQLITE_ERROR;
      break;
    }

    pC = p->apCsr[cursor];

#if SQLITE_VERSION_NUMBER >= 3011000
    ret = sqlite3VdbeCursorMoveto(&pC, &p2);
#else
    ret = sqlite3VdbeCursorMoveto(pC);
#endif
    if(ret)
      break;

#if SQLITE_VERSION_NUMBER < 3008007
    if(pC->rowidIsValid)
    {
      if (prowid) *prowid = pC->lastRowid;
    }
    else
#endif
#if SQLITE_VERSION_NUMBER >= 3010000
    if(pC->eCurType != CURTYPE_BTREE)
#else
    if(pC->pseudoTableReg > 0)
#endif
    {
      ret = SQLITE_ERROR;
      break;
    }
#if SQLITE_VERSION_NUMBER >= 3010000
    else if(pC->nullRow || pC->uc.pCursor==0)
#else
    else if(pC->nullRow || pC->pCursor==0)
#endif
    {
      ret = SQLITE_ERROR;
      break;
    }
    else
    {
#if SQLITE_VERSION_NUMBER >= 3010000
      if (pC->uc.pCursor == NULL)
#else
      if (pC->pCursor == NULL)
#endif
      {
        ret = SQLITE_ERROR;
        break;
      }
#if SQLITE_VERSION_NUMBER >= 3014000
      sqlite3BtreeEnterCursor(pC->uc.pCursor);
      *prowid = sqlite3BtreeIntegerKey(pC->uc.pCursor);
      sqlite3BtreeLeaveCursor(pC->uc.pCursor);
#elif SQLITE_VERSION_NUMBER >= 3010000
      sqlite3BtreeKeySize(pC->uc.pCursor, prowid);
#else
      sqlite3BtreeKeySize(pC->pCursor, prowid);
#endif
      if (prowid) *prowid = *prowid;
    }
    break;
  }
  sqlite3_mutex_leave(db->mutex);

  return ret;
}

/*****************************************************************************/

#if defined(SQLITE_CORE)
#undef SQLITE_CORE
#endif

#if defined(INTEROP_VIRTUAL_TABLE) && SQLITE_VERSION_NUMBER >= 3004001
#include "../ext/vtshim.c"
#endif

#if defined(INTEROP_FTS5_EXTENSION)
#include "../ext/fts5.c"
#endif

#if defined(INTEROP_PERCENTILE_EXTENSION)
#include "../ext/percentile.c"
#endif

#if defined(INTEROP_REGEXP_EXTENSION)
#include "../ext/regexp.c"
#endif

#if defined(INTEROP_SHA1_EXTENSION)
#include "../ext/sha1.c"
#endif

#if defined(INTEROP_SHA3_EXTENSION)
#include "../ext/shathree.c"
#endif

#if defined(INTEROP_TOTYPE_EXTENSION)
#include "../ext/totype.c"
#endif

/*****************************************************************************/

/*
** The INTEROP_TEST_EXTENSION block must be at the end of this source file
** because it includes the "sqlite3ext.h" file, which defines the sqlite3
** public API function names to be macros and that would cause the code
** above this point to malfunction.
*/
#if defined(INTEROP_TEST_EXTENSION)
#if !SQLITE_OS_WIN
#include <unistd.h>
#endif

#include "../core/sqlite3ext.h"
SQLITE_EXTENSION_INIT1

/*
** The interopError() SQL function treats its first argument as an integer
** error code to return.
*/
SQLITE_PRIVATE void interopErrorFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  int rc;
  if( argc!=1 ){
    sqlite3_result_error(context, "need exactly one argument", -1);
    return;
  }
  rc = sqlite3_value_int(argv[0]);
  sqlite3_result_error_code(context, rc);
}

/*
** The interopTest() SQL function returns its first argument or raises an
** error if there are not enough arguments.
*/
SQLITE_PRIVATE void interopTestFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  const unsigned char *z;
  if( argc!=1 ){
    sqlite3_result_error(context, "need exactly one argument", -1);
    return;
  }
  z = sqlite3_value_text(argv[0]);
  if( z ){
    sqlite3_result_text(context, (char*)z, -1, SQLITE_STATIC);
  }else{
    sqlite3_result_null(context);
  }
}

/*
** The interopSleep() SQL function waits the specified number of milliseconds
** or raises an error if there are not enough arguments.
*/
SQLITE_PRIVATE void interopSleepFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  int m;
  if( argc!=1 ){
    sqlite3_result_error(context, "need exactly one argument", -1);
    return;
  }
  m = sqlite3_value_int(argv[0]);
#if SQLITE_OS_WIN
#if SQLITE_OS_WINCE
  Sleep(m);
  sqlite3_result_int(context, WAIT_OBJECT_0);
#else
  sqlite3_result_int(context, SleepEx(m, TRUE));
#endif
#else
  if( m>0 ){
    sqlite3_result_int64(context, sleep((unsigned)m));
  }else{
    sqlite3_result_null(context);
  }
#endif
}

/* SQLite invokes this routine once when it loads the extension.
** Create new functions, collating sequences, and virtual table
** modules here.  This is usually the only exported symbol in
** the shared library.
*/
SQLITE_API int interop_test_extension_init(
  sqlite3 *db,
  char **pzErrMsg,
  const sqlite3_api_routines *pApi
){
  int rc;
  SQLITE_EXTENSION_INIT2(pApi)
  rc = sqlite3_create_function(db, "interopError", -1, SQLITE_ANY, 0,
      interopErrorFunc, 0, 0);
  if( rc==SQLITE_OK ){
    rc = sqlite3_create_function(db, "interopTest", -1, SQLITE_ANY, 0,
        interopTestFunc, 0, 0);
  }
  if( rc==SQLITE_OK ){
    rc = sqlite3_create_function(db, "interopSleep", 1, SQLITE_ANY, 0,
        interopSleepFunc, 0, 0);
  }
  return rc;
}
#endif /* SQLITE_OS_WIN */

Added SQLite.Interop/src/generic/interop.h.





































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * interop.h -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 */

#ifndef INTEROP_VERSION
#define INTEROP_VERSION          "1.0.119.0"
#endif

#ifndef INTEROP_SOURCE_ID
#define INTEROP_SOURCE_ID        "0000000000000000000000000000000000000000"
#endif

#ifndef INTEROP_SOURCE_TIMESTAMP
#define INTEROP_SOURCE_TIMESTAMP "0000-00-00 00:00:00 UTC"
#endif

Deleted SQLite.Interop/src/sqlite3.c.

more than 10,000 changes

Deleted SQLite.Interop/src/sqlite3.def.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
EXPORTS
sqlite3_aggregate_context
sqlite3_aggregate_count
sqlite3_auto_extension
sqlite3_backup_finish
sqlite3_backup_init
sqlite3_backup_pagecount
sqlite3_backup_remaining
sqlite3_backup_step
sqlite3_bind_blob
sqlite3_bind_double
sqlite3_bind_int
sqlite3_bind_int64
sqlite3_bind_null
sqlite3_bind_parameter_count
sqlite3_bind_parameter_index
sqlite3_bind_parameter_name
sqlite3_bind_text
sqlite3_bind_text16
sqlite3_bind_value
sqlite3_bind_zeroblob
sqlite3_blob_bytes
sqlite3_blob_close
sqlite3_blob_open
sqlite3_blob_read
sqlite3_blob_write
sqlite3_busy_handler
sqlite3_busy_timeout
sqlite3_changes
sqlite3_clear_bindings
sqlite3_close
sqlite3_collation_needed
sqlite3_collation_needed16
sqlite3_column_blob
sqlite3_column_bytes
sqlite3_column_bytes16
sqlite3_column_count
sqlite3_column_database_name
sqlite3_column_database_name16
sqlite3_column_decltype
sqlite3_column_decltype16
sqlite3_column_double
sqlite3_column_int
sqlite3_column_int64
sqlite3_column_name
sqlite3_column_name16
sqlite3_column_origin_name
sqlite3_column_origin_name16
sqlite3_column_table_name
sqlite3_column_table_name16
sqlite3_column_text
sqlite3_column_text16
sqlite3_column_type
sqlite3_column_value
sqlite3_commit_hook
sqlite3_compileoption_get
sqlite3_compileoption_used
sqlite3_complete
sqlite3_complete16
sqlite3_config
sqlite3_context_db_handle
sqlite3_create_collation
sqlite3_create_collation16
sqlite3_create_collation_v2
sqlite3_create_function
sqlite3_create_function16
sqlite3_create_module
sqlite3_create_module_v2
sqlite3_data_count
sqlite3_db_config
sqlite3_db_handle
sqlite3_db_mutex
sqlite3_db_status
sqlite3_declare_vtab
sqlite3_enable_load_extension
sqlite3_enable_shared_cache
sqlite3_errcode
sqlite3_errmsg
sqlite3_errmsg16
sqlite3_exec
sqlite3_expired
sqlite3_extended_errcode
sqlite3_extended_result_codes
sqlite3_file_control
sqlite3_finalize
sqlite3_free
sqlite3_free_table
sqlite3_get_autocommit
sqlite3_get_auxdata
sqlite3_get_table
sqlite3_global_recover
sqlite3_initialize
sqlite3_interrupt
sqlite3_last_insert_rowid
sqlite3_libversion
sqlite3_libversion_number
sqlite3_limit
sqlite3_load_extension
sqlite3_log
sqlite3_malloc
sqlite3_memory_alarm
sqlite3_memory_highwater
sqlite3_memory_used
sqlite3_mprintf
sqlite3_mutex_alloc
sqlite3_mutex_enter
sqlite3_mutex_free
sqlite3_mutex_leave
sqlite3_mutex_try
sqlite3_next_stmt
sqlite3_open
sqlite3_open16
sqlite3_open_v2
sqlite3_os_end
sqlite3_os_init
sqlite3_overload_function
sqlite3_prepare
sqlite3_prepare16
sqlite3_prepare16_v2
sqlite3_prepare_v2
sqlite3_profile
sqlite3_progress_handler
sqlite3_randomness
sqlite3_realloc
sqlite3_release_memory
sqlite3_reset
sqlite3_reset_auto_extension
sqlite3_result_blob
sqlite3_result_double
sqlite3_result_error
sqlite3_result_error16
sqlite3_result_error_code
sqlite3_result_error_nomem
sqlite3_result_error_toobig
sqlite3_result_int
sqlite3_result_int64
sqlite3_result_null
sqlite3_result_text
sqlite3_result_text16
sqlite3_result_text16be
sqlite3_result_text16le
sqlite3_result_value
sqlite3_result_zeroblob
sqlite3_rollback_hook
sqlite3_set_authorizer
sqlite3_set_auxdata
sqlite3_shutdown
sqlite3_sleep
sqlite3_snprintf
sqlite3_soft_heap_limit
sqlite3_sourceid
sqlite3_sql
sqlite3_status
sqlite3_step
sqlite3_stmt_status
sqlite3_strnicmp
sqlite3_table_column_metadata
sqlite3_test_control
sqlite3_thread_cleanup
sqlite3_threadsafe
sqlite3_total_changes
sqlite3_trace
sqlite3_transfer_bindings
sqlite3_update_hook
sqlite3_user_data
sqlite3_value_blob
sqlite3_value_bytes
sqlite3_value_bytes16
sqlite3_value_double
sqlite3_value_int
sqlite3_value_int64
sqlite3_value_numeric_type
sqlite3_value_text
sqlite3_value_text16
sqlite3_value_text16be
sqlite3_value_text16le
sqlite3_value_type
sqlite3_version
sqlite3_vfs_find
sqlite3_vfs_register
sqlite3_vfs_unregister
sqlite3_vmprintf
sqlite3_wal_autocheckpoint
sqlite3_wal_checkpoint
sqlite3_wal_hook
sqlite3_win32_mbcs_to_utf8
sqlite3_key
sqlite3_rekey
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































































































































































Deleted SQLite.Interop/src/sqlite3.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the interface that the SQLite library
** presents to client programs.  If a C-function, structure, datatype,
** or constant definition does not appear in this file, then it is
** not a published API of SQLite, is subject to change without
** notice, and should not be referenced by programs that use SQLite.
**
** Some of the definitions that are in this file are marked as
** "experimental".  Experimental interfaces are normally new
** features recently added to SQLite.  We do not anticipate changes
** to experimental interfaces but reserve the right to make minor changes
** if experience from use "in the wild" suggest such changes are prudent.
**
** The official C-language API documentation for SQLite is derived
** from comments in this file.  This file is the authoritative source
** on how SQLite interfaces are suppose to operate.
**
** The name of this file under configuration management is "sqlite.h.in".
** The makefile makes some minor changes to this file (such as inserting
** the version number) and changes its name to "sqlite3.h" as
** part of the build process.
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_
#include <stdarg.h>     /* Needed for the definition of va_list */

/*
** Make sure we can call this stuff from C++.
*/
#ifdef __cplusplus
extern "C" {
#endif


/*
** Add the ability to override 'extern'
*/
#ifndef SQLITE_EXTERN
# define SQLITE_EXTERN extern
#endif

#ifndef SQLITE_API
# define SQLITE_API
#endif


/*
** These no-op macros are used in front of interfaces to mark those
** interfaces as either deprecated or experimental.  New applications
** should not use deprecated interfaces - they are support for backwards
** compatibility only.  Application writers should be aware that
** experimental interfaces are subject to change in point releases.
**
** These macros used to resolve to various kinds of compiler magic that
** would generate warning messages when they were used.  But that
** compiler magic ended up generating such a flurry of bug reports
** that we have taken it all out and gone back to using simple
** noop macros.
*/
#define SQLITE_DEPRECATED
#define SQLITE_EXPERIMENTAL

/*
** Ensure these symbols were not defined by some previous header file.
*/
#ifdef SQLITE_VERSION
# undef SQLITE_VERSION
#endif
#ifdef SQLITE_VERSION_NUMBER
# undef SQLITE_VERSION_NUMBER
#endif

/*
** CAPI3REF: Compile-Time Library Version Numbers
**
** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header
** evaluates to a string literal that is the SQLite version in the
** format "X.Y.Z" where X is the major version number (always 3 for
** SQLite3) and Y is the minor version number and Z is the release number.)^
** ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves to an integer
** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same
** numbers used in [SQLITE_VERSION].)^
** The SQLITE_VERSION_NUMBER for any given release of SQLite will also
** be larger than the release from which it is derived.  Either Y will
** be held constant and Z will be incremented or else Y will be incremented
** and Z will be reset to zero.
**
** Since version 3.6.18, SQLite source code has been stored in the
** <a href="http://www.fossil-scm.org/">Fossil configuration management
** system</a>.  ^The SQLITE_SOURCE_ID macro evalutes to
** a string which identifies a particular check-in of SQLite
** within its configuration management system.  ^The SQLITE_SOURCE_ID
** string contains the date and time of the check-in (UTC) and an SHA1
** hash of the entire source tree.
**
** See also: [sqlite3_libversion()],
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
#define SQLITE_VERSION        "3.7.0.1"
#define SQLITE_VERSION_NUMBER 3007000
#define SQLITE_SOURCE_ID      "2010-08-04 12:31:11 042a1abb030a0711386add7eb6e10832cc8b0f57"

/*
** CAPI3REF: Run-Time Library Version Numbers
** KEYWORDS: sqlite3_version, sqlite3_sourceid
**
** These interfaces provide the same information as the [SQLITE_VERSION],
** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros
** but are associated with the library instead of the header file.  ^(Cautious
** programmers might include assert() statements in their application to
** verify that values returned by these interfaces match the macros in
** the header, and thus insure that the application is
** compiled with matching library and header files.
**
** <blockquote><pre>
** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 );
** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
** </pre></blockquote>)^
**
** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION]
** macro.  ^The sqlite3_libversion() function returns a pointer to the
** to the sqlite3_version[] string constant.  The sqlite3_libversion()
** function is provided for use in DLLs since DLL users usually do not have
** direct access to string constants within the DLL.  ^The
** sqlite3_libversion_number() function returns an integer equal to
** [SQLITE_VERSION_NUMBER].  ^The sqlite3_sourceid() function returns 
** a pointer to a string constant whose value is the same as the 
** [SQLITE_SOURCE_ID] C preprocessor macro.
**
** See also: [sqlite_version()] and [sqlite_source_id()].
*/
SQLITE_API SQLITE_EXTERN const char sqlite3_version[];
SQLITE_API const char *sqlite3_libversion(void);
SQLITE_API const char *sqlite3_sourceid(void);
SQLITE_API int sqlite3_libversion_number(void);

/*
** CAPI3REF: Run-Time Library Compilation Options Diagnostics
**
** ^The sqlite3_compileoption_used() function returns 0 or 1 
** indicating whether the specified option was defined at 
** compile time.  ^The SQLITE_ prefix may be omitted from the 
** option name passed to sqlite3_compileoption_used().  
**
** ^The sqlite3_compileoption_get() function allows interating
** over the list of options that were defined at compile time by
** returning the N-th compile time option string.  ^If N is out of range,
** sqlite3_compileoption_get() returns a NULL pointer.  ^The SQLITE_ 
** prefix is omitted from any strings returned by 
** sqlite3_compileoption_get().
**
** ^Support for the diagnostic functions sqlite3_compileoption_used()
** and sqlite3_compileoption_get() may be omitted by specifing the 
** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time.
**
** See also: SQL functions [sqlite_compileoption_used()] and
** [sqlite_compileoption_get()] and the [compile_options pragma].
*/
#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
SQLITE_API int sqlite3_compileoption_used(const char *zOptName);
SQLITE_API const char *sqlite3_compileoption_get(int N);
#endif

/*
** CAPI3REF: Test To See If The Library Is Threadsafe
**
** ^The sqlite3_threadsafe() function returns zero if and only if
** SQLite was compiled mutexing code omitted due to the
** [SQLITE_THREADSAFE] compile-time option being set to 0.
**
** SQLite can be compiled with or without mutexes.  When
** the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes
** are enabled and SQLite is threadsafe.  When the
** [SQLITE_THREADSAFE] macro is 0, 
** the mutexes are omitted.  Without the mutexes, it is not safe
** to use SQLite concurrently from more than one thread.
**
** Enabling mutexes incurs a measurable performance penalty.
** So if speed is of utmost importance, it makes sense to disable
** the mutexes.  But for maximum safety, mutexes should be enabled.
** ^The default behavior is for mutexes to be enabled.
**
** This interface can be used by an application to make sure that the
** version of SQLite that it is linking against was compiled with
** the desired setting of the [SQLITE_THREADSAFE] macro.
**
** This interface only reports on the compile-time mutex setting
** of the [SQLITE_THREADSAFE] flag.  If SQLite is compiled with
** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but
** can be fully or partially disabled using a call to [sqlite3_config()]
** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD],
** or [SQLITE_CONFIG_MUTEX].  ^(The return value of the
** sqlite3_threadsafe() function shows only the compile-time setting of
** thread safety, not any run-time changes to that setting made by
** sqlite3_config(). In other words, the return value from sqlite3_threadsafe()
** is unchanged by calls to sqlite3_config().)^
**
** See the [threading mode] documentation for additional information.
*/
SQLITE_API int sqlite3_threadsafe(void);

/*
** CAPI3REF: Database Connection Handle
** KEYWORDS: {database connection} {database connections}
**
** Each open SQLite database is represented by a pointer to an instance of
** the opaque structure named "sqlite3".  It is useful to think of an sqlite3
** pointer as an object.  The [sqlite3_open()], [sqlite3_open16()], and
** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()]
** is its destructor.  There are many other interfaces (such as
** [sqlite3_prepare_v2()], [sqlite3_create_function()], and
** [sqlite3_busy_timeout()] to name but three) that are methods on an
** sqlite3 object.
*/
typedef struct sqlite3 sqlite3;

/*
** CAPI3REF: 64-Bit Integer Types
** KEYWORDS: sqlite_int64 sqlite_uint64
**
** Because there is no cross-platform way to specify 64-bit integer types
** SQLite includes typedefs for 64-bit signed and unsigned integers.
**
** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions.
** The sqlite_int64 and sqlite_uint64 types are supported for backwards
** compatibility only.
**
** ^The sqlite3_int64 and sqlite_int64 types can store integer values
** between -9223372036854775808 and +9223372036854775807 inclusive.  ^The
** sqlite3_uint64 and sqlite_uint64 types can store integer values 
** between 0 and +18446744073709551615 inclusive.
*/
#ifdef SQLITE_INT64_TYPE
  typedef SQLITE_INT64_TYPE sqlite_int64;
  typedef unsigned SQLITE_INT64_TYPE sqlite_uint64;
#elif defined(_MSC_VER) || defined(__BORLANDC__)
  typedef __int64 sqlite_int64;
  typedef unsigned __int64 sqlite_uint64;
#else
  typedef long long int sqlite_int64;
  typedef unsigned long long int sqlite_uint64;
#endif
typedef sqlite_int64 sqlite3_int64;
typedef sqlite_uint64 sqlite3_uint64;

/*
** If compiling for a processor that lacks floating point support,
** substitute integer for floating-point.
*/
#ifdef SQLITE_OMIT_FLOATING_POINT
# define double sqlite3_int64
#endif

/*
** CAPI3REF: Closing A Database Connection
**
** ^The sqlite3_close() routine is the destructor for the [sqlite3] object.
** ^Calls to sqlite3_close() return SQLITE_OK if the [sqlite3] object is
** successfullly destroyed and all associated resources are deallocated.
**
** 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 called on a [database connection] that still has
** outstanding [prepared statements] or [BLOB handles], then it returns
** SQLITE_BUSY.
**
** ^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
** [sqlite3_open_v2()], and not previously closed.
** ^Calling sqlite3_close() with a NULL pointer argument is a 
** harmless no-op.
*/
SQLITE_API int sqlite3_close(sqlite3 *);

/*
** The type for a callback function.
** This is legacy and deprecated.  It is included for historical
** compatibility and is not documented.
*/
typedef int (*sqlite3_callback)(void*,int,char**, char**);

/*
** CAPI3REF: One-Step Query Execution Interface
**
** The sqlite3_exec() interface is a convenience wrapper around
** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()],
** that allows an application to run multiple statements of SQL
** without having to use a lot of C code. 
**
** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded,
** semicolon-separate SQL statements passed into its 2nd argument,
** in the context of the [database connection] passed in as its 1st
** argument.  ^If the callback function of the 3rd argument to
** sqlite3_exec() is not NULL, then it is invoked for each result row
** coming out of the evaluated SQL statements.  ^The 4th argument to
** to sqlite3_exec() is relayed through to the 1st argument of each
** callback invocation.  ^If the callback pointer to sqlite3_exec()
** is NULL, then no callback is ever invoked and result rows are
** ignored.
**
** ^If an error occurs while evaluating the SQL statements passed into
** sqlite3_exec(), then execution of the current statement stops and
** subsequent statements are skipped.  ^If the 5th parameter to sqlite3_exec()
** is not NULL then any error message is written into memory obtained
** from [sqlite3_malloc()] and passed back through the 5th parameter.
** To avoid memory leaks, the application should invoke [sqlite3_free()]
** on error message strings returned through the 5th parameter of
** of sqlite3_exec() after the error message string is no longer needed.
** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors
** occur, then sqlite3_exec() sets the pointer in its 5th parameter to
** NULL before returning.
**
** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec()
** routine returns SQLITE_ABORT without invoking the callback again and
** without running any subsequent SQL statements.
**
** ^The 2nd argument to the sqlite3_exec() callback function is the
** number of columns in the result.  ^The 3rd argument to the sqlite3_exec()
** callback is an array of pointers to strings obtained as if from
** [sqlite3_column_text()], one for each column.  ^If an element of a
** result row is NULL then the corresponding string pointer for the
** sqlite3_exec() callback is a NULL pointer.  ^The 4th argument to the
** sqlite3_exec() callback is an array of pointers to strings where each
** entry represents the name of corresponding result column as obtained
** from [sqlite3_column_name()].
**
** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer
** to an empty string, or a pointer that contains only whitespace and/or 
** SQL comments, then no SQL statements are evaluated and the database
** is not changed.
**
** Restrictions:
**
** <ul>
** <li> The application must insure that the 1st parameter to sqlite3_exec()
**      is a valid and open [database connection].
** <li> The application must not close [database connection] specified by
**      the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
** <li> The application must not modify the SQL statement text passed into
**      the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
** </ul>
*/
SQLITE_API int sqlite3_exec(
  sqlite3*,                                  /* An open database */
  const char *sql,                           /* SQL to be evaluated */
  int (*callback)(void*,int,char**,char**),  /* Callback function */
  void *,                                    /* 1st argument to callback */
  char **errmsg                              /* Error msg written here */
);

/*
** CAPI3REF: Result Codes
** KEYWORDS: SQLITE_OK {error code} {error codes}
** KEYWORDS: {result code} {result codes}
**
** Many SQLite functions return an integer result code from the set shown
** here in order to indicates success or failure.
**
** New error codes may be added in future versions of SQLite.
**
** See also: [SQLITE_IOERR_READ | extended result codes]
*/
#define SQLITE_OK           0   /* Successful result */
/* beginning-of-error-codes */
#define SQLITE_ERROR        1   /* SQL error or missing database */
#define SQLITE_INTERNAL     2   /* Internal logic error in SQLite */
#define SQLITE_PERM         3   /* Access permission denied */
#define SQLITE_ABORT        4   /* Callback routine requested an abort */
#define SQLITE_BUSY         5   /* The database file is locked */
#define SQLITE_LOCKED       6   /* A table in the database is locked */
#define SQLITE_NOMEM        7   /* A malloc() failed */
#define SQLITE_READONLY     8   /* Attempt to write a readonly database */
#define SQLITE_INTERRUPT    9   /* Operation terminated by sqlite3_interrupt()*/
#define SQLITE_IOERR       10   /* Some kind of disk I/O error occurred */
#define SQLITE_CORRUPT     11   /* The database disk image is malformed */
#define SQLITE_NOTFOUND    12   /* NOT USED. Table or record not found */
#define SQLITE_FULL        13   /* Insertion failed because database is full */
#define SQLITE_CANTOPEN    14   /* Unable to open the database file */
#define SQLITE_PROTOCOL    15   /* Database lock protocol error */
#define SQLITE_EMPTY       16   /* Database is empty */
#define SQLITE_SCHEMA      17   /* The database schema changed */
#define SQLITE_TOOBIG      18   /* String or BLOB exceeds size limit */
#define SQLITE_CONSTRAINT  19   /* Abort due to constraint violation */
#define SQLITE_MISMATCH    20   /* Data type mismatch */
#define SQLITE_MISUSE      21   /* Library used incorrectly */
#define SQLITE_NOLFS       22   /* Uses OS features not supported on host */
#define SQLITE_AUTH        23   /* Authorization denied */
#define SQLITE_FORMAT      24   /* Auxiliary database format error */
#define SQLITE_RANGE       25   /* 2nd parameter to sqlite3_bind out of range */
#define SQLITE_NOTADB      26   /* File opened that is not a database file */
#define SQLITE_ROW         100  /* sqlite3_step() has another row ready */
#define SQLITE_DONE        101  /* sqlite3_step() has finished executing */
/* end-of-error-codes */

/*
** CAPI3REF: Extended Result Codes
** KEYWORDS: {extended error code} {extended error codes}
** KEYWORDS: {extended result code} {extended result codes}
**
** In its default configuration, SQLite API routines return one of 26 integer
** [SQLITE_OK | result codes].  However, experience has shown that many of
** these result codes are too coarse-grained.  They do not provide as
** much information about problems as programmers might like.  In an effort to
** address this, newer versions of SQLite (version 3.3.8 and later) include
** support for additional result codes that provide more detailed information
** about errors. The extended result codes are enabled or disabled
** on a per database connection basis using the
** [sqlite3_extended_result_codes()] API.
**
** Some of the available extended result codes are listed here.
** One may expect the number of extended result codes will be expand
** over time.  Software that uses extended result codes should expect
** to see new result codes in future releases of SQLite.
**
** The SQLITE_OK result code will never be extended.  It will always
** be exactly zero.
*/
#define SQLITE_IOERR_READ              (SQLITE_IOERR | (1<<8))
#define SQLITE_IOERR_SHORT_READ        (SQLITE_IOERR | (2<<8))
#define SQLITE_IOERR_WRITE             (SQLITE_IOERR | (3<<8))
#define SQLITE_IOERR_FSYNC             (SQLITE_IOERR | (4<<8))
#define SQLITE_IOERR_DIR_FSYNC         (SQLITE_IOERR | (5<<8))
#define SQLITE_IOERR_TRUNCATE          (SQLITE_IOERR | (6<<8))
#define SQLITE_IOERR_FSTAT             (SQLITE_IOERR | (7<<8))
#define SQLITE_IOERR_UNLOCK            (SQLITE_IOERR | (8<<8))
#define SQLITE_IOERR_RDLOCK            (SQLITE_IOERR | (9<<8))
#define SQLITE_IOERR_DELETE            (SQLITE_IOERR | (10<<8))
#define SQLITE_IOERR_BLOCKED           (SQLITE_IOERR | (11<<8))
#define SQLITE_IOERR_NOMEM             (SQLITE_IOERR | (12<<8))
#define SQLITE_IOERR_ACCESS            (SQLITE_IOERR | (13<<8))
#define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8))
#define SQLITE_IOERR_LOCK              (SQLITE_IOERR | (15<<8))
#define SQLITE_IOERR_CLOSE             (SQLITE_IOERR | (16<<8))
#define SQLITE_IOERR_DIR_CLOSE         (SQLITE_IOERR | (17<<8))
#define SQLITE_IOERR_SHMOPEN           (SQLITE_IOERR | (18<<8))
#define SQLITE_IOERR_SHMSIZE           (SQLITE_IOERR | (19<<8))
#define SQLITE_IOERR_SHMLOCK           (SQLITE_IOERR | (20<<8))
#define SQLITE_LOCKED_SHAREDCACHE      (SQLITE_LOCKED |  (1<<8))
#define SQLITE_BUSY_RECOVERY           (SQLITE_BUSY   |  (1<<8))
#define SQLITE_CANTOPEN_NOTEMPDIR      (SQLITE_CANTOPEN | (1<<8))

/*
** CAPI3REF: Flags For File Open Operations
**
** These bit values are intended for use in the
** 3rd parameter to the [sqlite3_open_v2()] interface and
** in the 4th parameter to the xOpen method of the
** [sqlite3_vfs] object.
*/
#define SQLITE_OPEN_READONLY         0x00000001  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_READWRITE        0x00000002  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_CREATE           0x00000004  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_DELETEONCLOSE    0x00000008  /* VFS only */
#define SQLITE_OPEN_EXCLUSIVE        0x00000010  /* VFS only */
#define SQLITE_OPEN_AUTOPROXY        0x00000020  /* VFS only */
#define SQLITE_OPEN_MAIN_DB          0x00000100  /* VFS only */
#define SQLITE_OPEN_TEMP_DB          0x00000200  /* VFS only */
#define SQLITE_OPEN_TRANSIENT_DB     0x00000400  /* VFS only */
#define SQLITE_OPEN_MAIN_JOURNAL     0x00000800  /* VFS only */
#define SQLITE_OPEN_TEMP_JOURNAL     0x00001000  /* VFS only */
#define SQLITE_OPEN_SUBJOURNAL       0x00002000  /* VFS only */
#define SQLITE_OPEN_MASTER_JOURNAL   0x00004000  /* VFS only */
#define SQLITE_OPEN_NOMUTEX          0x00008000  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_FULLMUTEX        0x00010000  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_SHAREDCACHE      0x00020000  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_PRIVATECACHE     0x00040000  /* Ok for sqlite3_open_v2() */
#define SQLITE_OPEN_WAL              0x00080000  /* VFS only */

/*
** CAPI3REF: Device Characteristics
**
** The xDeviceCharacteristics method of the [sqlite3_io_methods]
** object returns an integer which is a vector of the these
** bit values expressing I/O characteristics of the mass storage
** device that holds the file that the [sqlite3_io_methods]
** refers to.
**
** The SQLITE_IOCAP_ATOMIC property means that all writes of
** any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values
** mean that writes of blocks that are nnn bytes in size and
** are aligned to an address which is an integer multiple of
** nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means
** that when data is appended to a file, the data is appended
** first then the size of the file is extended, never the other
** way around.  The SQLITE_IOCAP_SEQUENTIAL property means that
** information is written to disk in the same order as calls
** to xWrite().
*/
#define SQLITE_IOCAP_ATOMIC                 0x00000001
#define SQLITE_IOCAP_ATOMIC512              0x00000002
#define SQLITE_IOCAP_ATOMIC1K               0x00000004
#define SQLITE_IOCAP_ATOMIC2K               0x00000008
#define SQLITE_IOCAP_ATOMIC4K               0x00000010
#define SQLITE_IOCAP_ATOMIC8K               0x00000020
#define SQLITE_IOCAP_ATOMIC16K              0x00000040
#define SQLITE_IOCAP_ATOMIC32K              0x00000080
#define SQLITE_IOCAP_ATOMIC64K              0x00000100
#define SQLITE_IOCAP_SAFE_APPEND            0x00000200
#define SQLITE_IOCAP_SEQUENTIAL             0x00000400
#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN  0x00000800

/*
** CAPI3REF: File Locking Levels
**
** SQLite uses one of these integer values as the second
** argument to calls it makes to the xLock() and xUnlock() methods
** of an [sqlite3_io_methods] object.
*/
#define SQLITE_LOCK_NONE          0
#define SQLITE_LOCK_SHARED        1
#define SQLITE_LOCK_RESERVED      2
#define SQLITE_LOCK_PENDING       3
#define SQLITE_LOCK_EXCLUSIVE     4

/*
** CAPI3REF: Synchronization Type Flags
**
** When SQLite invokes the xSync() method of an
** [sqlite3_io_methods] object it uses a combination of
** these integer values as the second argument.
**
** When the SQLITE_SYNC_DATAONLY flag is used, it means that the
** sync operation only needs to flush data to mass storage.  Inode
** information need not be flushed. If the lower four bits of the flag
** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics.
** If the lower four bits equal SQLITE_SYNC_FULL, that means
** to use Mac OS X style fullsync instead of fsync().
*/
#define SQLITE_SYNC_NORMAL        0x00002
#define SQLITE_SYNC_FULL          0x00003
#define SQLITE_SYNC_DATAONLY      0x00010

/*
** CAPI3REF: OS Interface Open File Handle
**
** An [sqlite3_file] object represents an open file in the 
** [sqlite3_vfs | OS interface layer].  Individual OS interface
** implementations will
** want to subclass this object by appending additional fields
** for their own use.  The pMethods entry is a pointer to an
** [sqlite3_io_methods] object that defines methods for performing
** I/O operations on the open file.
*/
typedef struct sqlite3_file sqlite3_file;
struct sqlite3_file {
  const struct sqlite3_io_methods *pMethods;  /* Methods for an open file */
};

/*
** CAPI3REF: OS Interface File Virtual Methods Object
**
** Every file opened by the [sqlite3_vfs] xOpen method populates an
** [sqlite3_file] object (or, more commonly, a subclass of the
** [sqlite3_file] object) with a pointer to an instance of this object.
** This object defines the methods used to perform various operations
** against the open file represented by the [sqlite3_file] object.
**
** If the xOpen method sets the sqlite3_file.pMethods element 
** to a non-NULL pointer, then the sqlite3_io_methods.xClose method
** may be invoked even if the xOpen reported that it failed.  The
** only way to prevent a call to xClose following a failed xOpen
** is for the xOpen to set the sqlite3_file.pMethods element to NULL.
**
** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or
** [SQLITE_SYNC_FULL].  The first choice is the normal fsync().
** The second choice is a Mac OS X style fullsync.  The [SQLITE_SYNC_DATAONLY]
** flag may be ORed in to indicate that only the data of the file
** and not its inode needs to be synced.
**
** The integer values to xLock() and xUnlock() are one of
** <ul>
** <li> [SQLITE_LOCK_NONE],
** <li> [SQLITE_LOCK_SHARED],
** <li> [SQLITE_LOCK_RESERVED],
** <li> [SQLITE_LOCK_PENDING], or
** <li> [SQLITE_LOCK_EXCLUSIVE].
** </ul>
** xLock() increases the lock. xUnlock() decreases the lock.
** The xCheckReservedLock() method checks whether any database connection,
** either in this process or in some other process, is holding a RESERVED,
** PENDING, or EXCLUSIVE lock on the file.  It returns true
** if such a lock exists and false otherwise.
**
** The xFileControl() method is a generic interface that allows custom
** VFS implementations to directly control an open file using the
** [sqlite3_file_control()] interface.  The second "op" argument is an
** integer opcode.  The third argument is a generic pointer intended to
** point to a structure that may contain arguments or space in which to
** write return values.  Potential uses for xFileControl() might be
** functions to enable blocking locks with timeouts, to change the
** locking strategy (for example to use dot-file locks), to inquire
** about the status of a lock, or to break stale locks.  The SQLite
** core reserves all opcodes less than 100 for its own use.
** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available.
** Applications that define a custom xFileControl method should use opcodes
** greater than 100 to avoid conflicts.
**
** The xSectorSize() method returns the sector size of the
** device that underlies the file.  The sector size is the
** minimum write that can be performed without disturbing
** other bytes in the file.  The xDeviceCharacteristics()
** method returns a bit vector describing behaviors of the
** underlying device:
**
** <ul>
** <li> [SQLITE_IOCAP_ATOMIC]
** <li> [SQLITE_IOCAP_ATOMIC512]
** <li> [SQLITE_IOCAP_ATOMIC1K]
** <li> [SQLITE_IOCAP_ATOMIC2K]
** <li> [SQLITE_IOCAP_ATOMIC4K]
** <li> [SQLITE_IOCAP_ATOMIC8K]
** <li> [SQLITE_IOCAP_ATOMIC16K]
** <li> [SQLITE_IOCAP_ATOMIC32K]
** <li> [SQLITE_IOCAP_ATOMIC64K]
** <li> [SQLITE_IOCAP_SAFE_APPEND]
** <li> [SQLITE_IOCAP_SEQUENTIAL]
** </ul>
**
** The SQLITE_IOCAP_ATOMIC property means that all writes of
** any size are atomic.  The SQLITE_IOCAP_ATOMICnnn values
** mean that writes of blocks that are nnn bytes in size and
** are aligned to an address which is an integer multiple of
** nnn are atomic.  The SQLITE_IOCAP_SAFE_APPEND value means
** that when data is appended to a file, the data is appended
** first then the size of the file is extended, never the other
** way around.  The SQLITE_IOCAP_SEQUENTIAL property means that
** information is written to disk in the same order as calls
** to xWrite().
**
** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill
** in the unread portions of the buffer with zeros.  A VFS that
** fails to zero-fill short reads might seem to work.  However,
** failure to zero-fill short reads will eventually lead to
** database corruption.
*/
typedef struct sqlite3_io_methods sqlite3_io_methods;
struct sqlite3_io_methods {
  int iVersion;
  int (*xClose)(sqlite3_file*);
  int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);
  int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst);
  int (*xTruncate)(sqlite3_file*, sqlite3_int64 size);
  int (*xSync)(sqlite3_file*, int flags);
  int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize);
  int (*xLock)(sqlite3_file*, int);
  int (*xUnlock)(sqlite3_file*, int);
  int (*xCheckReservedLock)(sqlite3_file*, int *pResOut);
  int (*xFileControl)(sqlite3_file*, int op, void *pArg);
  int (*xSectorSize)(sqlite3_file*);
  int (*xDeviceCharacteristics)(sqlite3_file*);
  /* Methods above are valid for version 1 */
  int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**);
  int (*xShmLock)(sqlite3_file*, int offset, int n, int flags);
  void (*xShmBarrier)(sqlite3_file*);
  int (*xShmUnmap)(sqlite3_file*, int deleteFlag);
  /* Methods above are valid for version 2 */
  /* Additional methods may be added in future releases */
};

/*
** CAPI3REF: Standard File Control Opcodes
**
** These integer constants are opcodes for the xFileControl method
** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()]
** interface.
**
** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging.  This
** opcode causes the xFileControl method to write the current state of
** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED],
** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE])
** into an integer that the pArg argument points to. This capability
** is used during testing and only needs to be supported when SQLITE_TEST
** is defined.
**
** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS
** layer a hint of how large the database file will grow to be during the
** current transaction.  This hint is not guaranteed to be accurate but it
** is often close.  The underlying VFS might choose to preallocate database
** file space based on this hint in order to help writes to the database
** file run faster.
*/
#define SQLITE_FCNTL_LOCKSTATE        1
#define SQLITE_GET_LOCKPROXYFILE      2
#define SQLITE_SET_LOCKPROXYFILE      3
#define SQLITE_LAST_ERRNO             4
#define SQLITE_FCNTL_SIZE_HINT        5

/*
** CAPI3REF: Mutex Handle
**
** The mutex module within SQLite defines [sqlite3_mutex] to be an
** abstract type for a mutex object.  The SQLite core never looks
** at the internal representation of an [sqlite3_mutex].  It only
** deals with pointers to the [sqlite3_mutex] object.
**
** Mutexes are created using [sqlite3_mutex_alloc()].
*/
typedef struct sqlite3_mutex sqlite3_mutex;

/*
** CAPI3REF: OS Interface Object
**
** An instance of the sqlite3_vfs object defines the interface between
** the SQLite core and the underlying operating system.  The "vfs"
** in the name of the object stands for "virtual file system".
**
** The value of the iVersion field is initially 1 but may be larger in
** future versions of SQLite.  Additional fields may be appended to this
** object when the iVersion value is increased.  Note that the structure
** of the sqlite3_vfs object changes in the transaction between
** SQLite version 3.5.9 and 3.6.0 and yet the iVersion field was not
** modified.
**
** The szOsFile field is the size of the subclassed [sqlite3_file]
** structure used by this VFS.  mxPathname is the maximum length of
** a pathname in this VFS.
**
** Registered sqlite3_vfs objects are kept on a linked list formed by
** the pNext pointer.  The [sqlite3_vfs_register()]
** and [sqlite3_vfs_unregister()] interfaces manage this list
** in a thread-safe way.  The [sqlite3_vfs_find()] interface
** searches the list.  Neither the application code nor the VFS
** implementation should use the pNext pointer.
**
** The pNext field is the only field in the sqlite3_vfs
** structure that SQLite will ever modify.  SQLite will only access
** or modify this field while holding a particular static mutex.
** The application should never modify anything within the sqlite3_vfs
** object once the object has been registered.
**
** The zName field holds the name of the VFS module.  The name must
** be unique across all VFS modules.
**
** SQLite will guarantee that the zFilename parameter to xOpen
** is either a NULL pointer or string obtained
** from xFullPathname().  SQLite further guarantees that
** the string will be valid and unchanged until xClose() is
** called. Because of the previous sentence,
** the [sqlite3_file] can safely store a pointer to the
** filename if it needs to remember the filename for some reason.
** If the zFilename parameter is xOpen is a NULL pointer then xOpen
** must invent its own temporary name for the file.  Whenever the 
** xFilename parameter is NULL it will also be the case that the
** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE].
**
** The flags argument to xOpen() includes all bits set in
** the flags argument to [sqlite3_open_v2()].  Or if [sqlite3_open()]
** or [sqlite3_open16()] is used, then flags includes at least
** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. 
** If xOpen() opens a file read-only then it sets *pOutFlags to
** include [SQLITE_OPEN_READONLY].  Other bits in *pOutFlags may be set.
**
** SQLite will also add one of the following flags to the xOpen()
** call, depending on the object being opened:
**
** <ul>
** <li>  [SQLITE_OPEN_MAIN_DB]
** <li>  [SQLITE_OPEN_MAIN_JOURNAL]
** <li>  [SQLITE_OPEN_TEMP_DB]
** <li>  [SQLITE_OPEN_TEMP_JOURNAL]
** <li>  [SQLITE_OPEN_TRANSIENT_DB]
** <li>  [SQLITE_OPEN_SUBJOURNAL]
** <li>  [SQLITE_OPEN_MASTER_JOURNAL]
** </ul>
**
** The file I/O implementation can use the object type flags to
** change the way it deals with files.  For example, an application
** that does not care about crash recovery or rollback might make
** the open of a journal file a no-op.  Writes to this journal would
** also be no-ops, and any attempt to read the journal would return
** SQLITE_IOERR.  Or the implementation might recognize that a database
** file will be doing page-aligned sector reads and writes in a random
** order and set up its I/O subsystem accordingly.
**
** SQLite might also add one of the following flags to the xOpen method:
**
** <ul>
** <li> [SQLITE_OPEN_DELETEONCLOSE]
** <li> [SQLITE_OPEN_EXCLUSIVE]
** </ul>
**
** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be
** deleted when it is closed.  The [SQLITE_OPEN_DELETEONCLOSE]
** will be set for TEMP  databases, journals and for subjournals.
**
** The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction
** with the [SQLITE_OPEN_CREATE] flag, which are both directly
** analogous to the O_EXCL and O_CREAT flags of the POSIX open()
** API.  The SQLITE_OPEN_EXCLUSIVE flag, when paired with the 
** SQLITE_OPEN_CREATE, is used to indicate that file should always
** be created, and that it is an error if it already exists.
** It is <i>not</i> used to indicate the file should be opened 
** for exclusive access.
**
** At least szOsFile bytes of memory are allocated by SQLite
** to hold the  [sqlite3_file] structure passed as the third
** argument to xOpen.  The xOpen method does not have to
** allocate the structure; it should just fill it in.  Note that
** the xOpen method must set the sqlite3_file.pMethods to either
** a valid [sqlite3_io_methods] object or to NULL.  xOpen must do
** this even if the open fails.  SQLite expects that the sqlite3_file.pMethods
** element will be valid after xOpen returns regardless of the success
** or failure of the xOpen call.
**
** The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS]
** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to
** test whether a file is readable and writable, or [SQLITE_ACCESS_READ]
** to test whether a file is at least readable.   The file can be a
** directory.
**
** SQLite will always allocate at least mxPathname+1 bytes for the
** output buffer xFullPathname.  The exact size of the output buffer
** is also passed as a parameter to both  methods. If the output buffer
** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is
** handled as a fatal error by SQLite, vfs implementations should endeavor
** to prevent this by setting mxPathname to a sufficiently large value.
**
** The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64()
** interfaces are not strictly a part of the filesystem, but they are
** included in the VFS structure for completeness.
** The xRandomness() function attempts to return nBytes bytes
** of good-quality randomness into zOut.  The return value is
** the actual number of bytes of randomness obtained.
** The xSleep() method causes the calling thread to sleep for at
** least the number of microseconds given.  The xCurrentTime()
** method returns a Julian Day Number for the current date and time as
** a floating point value.
** The xCurrentTimeInt64() method returns, as an integer, the Julian
** Day Number multipled by 86400000 (the number of milliseconds in 
** a 24-hour day).  
** ^SQLite will use the xCurrentTimeInt64() method to get the current
** date and time if that method is available (if iVersion is 2 or 
** greater and the function pointer is not NULL) and will fall back
** to xCurrentTime() if xCurrentTimeInt64() is unavailable.
*/
typedef struct sqlite3_vfs sqlite3_vfs;
struct sqlite3_vfs {
  int iVersion;            /* Structure version number (currently 2) */
  int szOsFile;            /* Size of subclassed sqlite3_file */
  int mxPathname;          /* Maximum file pathname length */
  sqlite3_vfs *pNext;      /* Next registered VFS */
  const char *zName;       /* Name of this virtual file system */
  void *pAppData;          /* Pointer to application-specific data */
  int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*,
               int flags, int *pOutFlags);
  int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir);
  int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut);
  int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut);
  void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename);
  void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg);
  void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void);
  void (*xDlClose)(sqlite3_vfs*, void*);
  int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut);
  int (*xSleep)(sqlite3_vfs*, int microseconds);
  int (*xCurrentTime)(sqlite3_vfs*, double*);
  int (*xGetLastError)(sqlite3_vfs*, int, char *);
  /*
  ** The methods above are in version 1 of the sqlite_vfs object
  ** definition.  Those that follow are added in version 2 or later
  */
  int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*);
  /*
  ** The methods above are in versions 1 and 2 of the sqlite_vfs object.
  ** New fields may be appended in figure versions.  The iVersion
  ** value will increment whenever this happens. 
  */
};

/*
** CAPI3REF: Flags for the xAccess VFS method
**
** These integer constants can be used as the third parameter to
** the xAccess method of an [sqlite3_vfs] object.  They determine
** what kind of permissions the xAccess method is looking for.
** With SQLITE_ACCESS_EXISTS, the xAccess method
** simply checks whether the file exists.
** With SQLITE_ACCESS_READWRITE, the xAccess method
** checks whether the named directory is both readable and writable
** (in other words, if files can be added, removed, and renamed within
** the directory).
** The SQLITE_ACCESS_READWRITE constant is currently used only by the
** [temp_store_directory pragma], though this could change in a future
** release of SQLite.
** With SQLITE_ACCESS_READ, the xAccess method
** checks whether the file is readable.  The SQLITE_ACCESS_READ constant is
** currently unused, though it might be used in a future release of
** SQLite.
*/
#define SQLITE_ACCESS_EXISTS    0
#define SQLITE_ACCESS_READWRITE 1   /* Used by PRAGMA temp_store_directory */
#define SQLITE_ACCESS_READ      2   /* Unused */

/*
** CAPI3REF: Flags for the xShmLock VFS method
**
** These integer constants define the various locking operations
** allowed by the xShmLock method of [sqlite3_io_methods].  The
** following are the only legal combinations of flags to the
** xShmLock method:
**
** <ul>
** <li>  SQLITE_SHM_LOCK | SQLITE_SHM_SHARED
** <li>  SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE
** <li>  SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED
** <li>  SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE
** </ul>
**
** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as
** was given no the corresponding lock.  
**
** The xShmLock method can transition between unlocked and SHARED or
** between unlocked and EXCLUSIVE.  It cannot transition between SHARED
** and EXCLUSIVE.
*/
#define SQLITE_SHM_UNLOCK       1
#define SQLITE_SHM_LOCK         2
#define SQLITE_SHM_SHARED       4
#define SQLITE_SHM_EXCLUSIVE    8

/*
** CAPI3REF: Maximum xShmLock index
**
** The xShmLock method on [sqlite3_io_methods] may use values
** between 0 and this upper bound as its "offset" argument.
** The SQLite core will never attempt to acquire or release a
** lock outside of this range
*/
#define SQLITE_SHM_NLOCK        8


/*
** CAPI3REF: Initialize The SQLite Library
**
** ^The sqlite3_initialize() routine initializes the
** SQLite library.  ^The sqlite3_shutdown() routine
** deallocates any resources that were allocated by sqlite3_initialize().
** These 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
** SQLite interfaces so that an application usually does not need to
** invoke sqlite3_initialize() directly.  For example, [sqlite3_open()]
** calls sqlite3_initialize() so the SQLite library will be automatically
** initialized when [sqlite3_open()] is called if it has not be initialized
** already.  ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT]
** compile-time option, then the automatic calls to sqlite3_initialize()
** are omitted and the application must call sqlite3_initialize() directly
** prior to using any other SQLite interface.  For maximum portability,
** it is recommended that applications always invoke sqlite3_initialize()
** directly prior to using any other SQLite interface.  Future releases
** of SQLite may require this.  In other words, the behavior exhibited
** when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the
** default behavior in some future release of SQLite.
**
** The sqlite3_os_init() routine does operating-system specific
** initialization of the SQLite library.  The sqlite3_os_end()
** routine undoes the effect of sqlite3_os_init().  Typical tasks
** performed by these routines include allocation or deallocation
** of static resources, initialization of global variables,
** setting up a default [sqlite3_vfs] module, or setting up
** a default configuration using [sqlite3_config()].
**
** The application should never invoke either sqlite3_os_init()
** or sqlite3_os_end() directly.  The application should only invoke
** sqlite3_initialize() and sqlite3_shutdown().  The sqlite3_os_init()
** interface is called automatically by sqlite3_initialize() and
** sqlite3_os_end() is called by sqlite3_shutdown().  Appropriate
** implementations for sqlite3_os_init() and sqlite3_os_end()
** are built into SQLite when it is compiled for Unix, Windows, or OS/2.
** When [custom builds | built for other platforms]
** (using the [SQLITE_OS_OTHER=1] compile-time
** option) the application must supply a suitable implementation for
** sqlite3_os_init() and sqlite3_os_end().  An application-supplied
** implementation of sqlite3_os_init() or sqlite3_os_end()
** must return [SQLITE_OK] on success and some other [error code] upon
** failure.
*/
SQLITE_API int sqlite3_initialize(void);
SQLITE_API int sqlite3_shutdown(void);
SQLITE_API int sqlite3_os_init(void);
SQLITE_API int sqlite3_os_end(void);

/*
** CAPI3REF: Configuring The SQLite Library
**
** The sqlite3_config() interface is used to make global configuration
** changes to SQLite in order to tune SQLite to the specific needs of
** the application.  The default configuration is recommended for most
** applications and so this routine is usually not necessary.  It is
** provided to support rare applications with unusual needs.
**
** The sqlite3_config() interface is not threadsafe.  The application
** must insure that no other SQLite interfaces are invoked by other
** threads while sqlite3_config() is running.  Furthermore, sqlite3_config()
** may only be invoked prior to library initialization using
** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()].
** ^If sqlite3_config() is called after [sqlite3_initialize()] and before
** [sqlite3_shutdown()] then it will return SQLITE_MISUSE.
** Note, however, that ^sqlite3_config() can be called as part of the
** implementation of an application-defined [sqlite3_os_init()].
**
** The first argument to sqlite3_config() is an integer
** [SQLITE_CONFIG_SINGLETHREAD | configuration option] that determines
** what property of SQLite is to be configured.  Subsequent arguments
** vary depending on the [SQLITE_CONFIG_SINGLETHREAD | configuration option]
** in the first argument.
**
** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK].
** ^If the option is unknown or SQLite is unable to set the option
** then this routine returns a non-zero [error code].
*/
SQLITE_API int sqlite3_config(int, ...);

/*
** CAPI3REF: Configure database connections
**
** The sqlite3_db_config() interface is used to make configuration
** changes to a [database connection].  The interface is similar to
** [sqlite3_config()] except that the changes apply to a single
** [database connection] (specified in the first argument).  The
** sqlite3_db_config() interface should only be used immediately after
** the database connection is created using [sqlite3_open()],
** [sqlite3_open16()], or [sqlite3_open_v2()].  
**
** The second argument to sqlite3_db_config(D,V,...)  is the
** configuration verb - an integer code that indicates what
** aspect of the [database connection] is being configured.
** The only choice for this value is [SQLITE_DBCONFIG_LOOKASIDE].
** New verbs are likely to be added in future releases of SQLite.
** Additional arguments depend on the verb.
**
** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if
** the call is considered successful.
*/
SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...);

/*
** CAPI3REF: Memory Allocation Routines
**
** An instance of this object defines the interface between SQLite
** and low-level memory allocation routines.
**
** This object is used in only one place in the SQLite interface.
** A pointer to an instance of this object is the argument to
** [sqlite3_config()] when the configuration option is
** [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC].  
** By creating an instance of this object
** and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC])
** during configuration, an application can specify an alternative
** memory allocation subsystem for SQLite to use for all of its
** dynamic memory needs.
**
** Note that SQLite comes with several [built-in memory allocators]
** that are perfectly adequate for the overwhelming majority of applications
** and that this object is only useful to a tiny minority of applications
** with specialized memory allocation requirements.  This object is
** also used during testing of SQLite in order to specify an alternative
** memory allocator that simulates memory out-of-memory conditions in
** order to verify that SQLite recovers gracefully from such
** conditions.
**
** The xMalloc and xFree methods must work like the
** malloc() and free() functions from the standard C library.
** The xRealloc method must work like realloc() from the standard C library
** with the exception that if the second argument to xRealloc is zero,
** xRealloc must be a no-op - it must not perform any allocation or
** deallocation.  ^SQLite guarantees that the second argument to
** xRealloc is always a value returned by a prior call to xRoundup.
** And so in cases where xRoundup always returns a positive number,
** xRealloc can perform exactly as the standard library realloc() and
** still be in compliance with this specification.
**
** xSize should return the allocated size of a memory allocation
** previously obtained from xMalloc or xRealloc.  The allocated size
** is always at least as big as the requested size but may be larger.
**
** The xRoundup method returns what would be the allocated size of
** a memory allocation given a particular requested size.  Most memory
** allocators round up memory allocations at least to the next multiple
** of 8.  Some allocators round up to a larger multiple or to a power of 2.
** Every memory allocation request coming in through [sqlite3_malloc()]
** or [sqlite3_realloc()] first calls xRoundup.  If xRoundup returns 0, 
** that causes the corresponding memory allocation to fail.
**
** The xInit method initializes the memory allocator.  (For example,
** it might allocate any require mutexes or initialize internal data
** structures.  The xShutdown method is invoked (indirectly) by
** [sqlite3_shutdown()] and should deallocate any resources acquired
** by xInit.  The pAppData pointer is used as the only parameter to
** xInit and xShutdown.
**
** SQLite holds the [SQLITE_MUTEX_STATIC_MASTER] mutex when it invokes
** the xInit method, so the xInit method need not be threadsafe.  The
** xShutdown method is only called from [sqlite3_shutdown()] so it does
** not need to be threadsafe either.  For all other methods, SQLite
** holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the
** [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which
** it is by default) and so the methods are automatically serialized.
** However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other
** methods must be threadsafe or else make their own arrangements for
** serialization.
**
** SQLite will never invoke xInit() more than once without an intervening
** call to xShutdown().
*/
typedef struct sqlite3_mem_methods sqlite3_mem_methods;
struct sqlite3_mem_methods {
  void *(*xMalloc)(int);         /* Memory allocation function */
  void (*xFree)(void*);          /* Free a prior allocation */
  void *(*xRealloc)(void*,int);  /* Resize an allocation */
  int (*xSize)(void*);           /* Return the size of an allocation */
  int (*xRoundup)(int);          /* Round up request size to allocation size */
  int (*xInit)(void*);           /* Initialize the memory allocator */
  void (*xShutdown)(void*);      /* Deinitialize the memory allocator */
  void *pAppData;                /* Argument to xInit() and xShutdown() */
};

/*
** CAPI3REF: Configuration Options
**
** These constants are the available integer configuration options that
** can be passed as the first argument to the [sqlite3_config()] interface.
**
** New configuration options may be added in future releases of SQLite.
** Existing configuration options might be discontinued.  Applications
** should check the return code from [sqlite3_config()] to make sure that
** the call worked.  The [sqlite3_config()] interface will return a
** non-zero [error code] if a discontinued or unsupported configuration option
** is invoked.
**
** <dl>
** <dt>SQLITE_CONFIG_SINGLETHREAD</dt>
** <dd>There are no arguments to this option.  ^This option sets the
** [threading mode] to Single-thread.  In other words, it disables
** all mutexing and puts SQLite into a mode where it can only be used
** by a single thread.   ^If SQLite is compiled with
** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
** it is not possible to change the [threading mode] from its default
** value of Single-thread and so [sqlite3_config()] will return 
** [SQLITE_ERROR] if called with the SQLITE_CONFIG_SINGLETHREAD
** configuration option.</dd>
**
** <dt>SQLITE_CONFIG_MULTITHREAD</dt>
** <dd>There are no arguments to this option.  ^This option sets the
** [threading mode] to Multi-thread.  In other words, it disables
** mutexing on [database connection] and [prepared statement] objects.
** The application is responsible for serializing access to
** [database connections] and [prepared statements].  But other mutexes
** are enabled so that SQLite will be safe to use in a multi-threaded
** environment as long as no two threads attempt to use the same
** [database connection] at the same time.  ^If SQLite is compiled with
** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
** it is not possible to set the Multi-thread [threading mode] and
** [sqlite3_config()] will return [SQLITE_ERROR] if called with the
** SQLITE_CONFIG_MULTITHREAD configuration option.</dd>
**
** <dt>SQLITE_CONFIG_SERIALIZED</dt>
** <dd>There are no arguments to this option.  ^This option sets the
** [threading mode] to Serialized. In other words, this option enables
** all mutexes including the recursive
** mutexes on [database connection] and [prepared statement] objects.
** In this mode (which is the default when SQLite is compiled with
** [SQLITE_THREADSAFE=1]) the SQLite library will itself serialize access
** to [database connections] and [prepared statements] so that the
** application is free to use the same [database connection] or the
** same [prepared statement] in different threads at the same time.
** ^If SQLite is compiled with
** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
** it is not possible to set the Serialized [threading mode] and
** [sqlite3_config()] will return [SQLITE_ERROR] if called with the
** SQLITE_CONFIG_SERIALIZED configuration option.</dd>
**
** <dt>SQLITE_CONFIG_MALLOC</dt>
** <dd> ^(This option takes a single argument which is a pointer to an
** instance of the [sqlite3_mem_methods] structure.  The argument specifies
** alternative low-level memory allocation routines to be used in place of
** the memory allocation routines built into SQLite.)^ ^SQLite makes
** its own private copy of the content of the [sqlite3_mem_methods] structure
** before the [sqlite3_config()] call returns.</dd>
**
** <dt>SQLITE_CONFIG_GETMALLOC</dt>
** <dd> ^(This option takes a single argument which is a pointer to an
** instance of the [sqlite3_mem_methods] structure.  The [sqlite3_mem_methods]
** structure is filled with the currently defined memory allocation routines.)^
** This option can be used to overload the default memory allocation
** routines with a wrapper that simulations memory allocation failure or
** tracks memory usage, for example. </dd>
**
** <dt>SQLITE_CONFIG_MEMSTATUS</dt>
** <dd> ^This option takes single argument of type int, interpreted as a 
** boolean, which enables or disables the collection of memory allocation 
** statistics. ^(When memory allocation statistics are disabled, the 
** following SQLite interfaces become non-operational:
**   <ul>
**   <li> [sqlite3_memory_used()]
**   <li> [sqlite3_memory_highwater()]
**   <li> [sqlite3_soft_heap_limit()]
**   <li> [sqlite3_status()]
**   </ul>)^
** ^Memory allocation statistics are enabled by default unless SQLite is
** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory
** allocation statistics are disabled by default.
** </dd>
**
** <dt>SQLITE_CONFIG_SCRATCH</dt>
** <dd> ^This option specifies a static memory buffer that SQLite can use for
** scratch memory.  There are three arguments:  A pointer an 8-byte
** aligned memory buffer from which the scrach allocations will be
** drawn, the size of each scratch allocation (sz),
** and the maximum number of scratch allocations (N).  The sz
** argument must be a multiple of 16. The sz parameter should be a few bytes
** larger than the actual scratch space required due to internal overhead.
** The first argument must be a pointer to an 8-byte aligned buffer
** of at least sz*N bytes of memory.
** ^SQLite will use no more than one scratch buffer per thread.  So
** N should be set to the expected maximum number of threads.  ^SQLite will
** never require a scratch buffer that is more than 6 times the database
** page size. ^If SQLite needs needs additional scratch memory beyond 
** what is provided by this configuration option, then 
** [sqlite3_malloc()] will be used to obtain the memory needed.</dd>
**
** <dt>SQLITE_CONFIG_PAGECACHE</dt>
** <dd> ^This option specifies a static memory buffer that SQLite can use for
** the database page cache with the default page cache implemenation.  
** This configuration should not be used if an application-define page
** cache implementation is loaded using the SQLITE_CONFIG_PCACHE option.
** There are three arguments to this option: A pointer to 8-byte aligned
** memory, the size of each page buffer (sz), and the number of pages (N).
** The sz argument should be the size of the largest database page
** (a power of two between 512 and 32768) plus a little extra for each
** page header.  ^The page header size is 20 to 40 bytes depending on
** the host architecture.  ^It is harmless, apart from the wasted memory,
** to make sz a little too large.  The first
** argument should point to an allocation of at least sz*N bytes of memory.
** ^SQLite will use the memory provided by the first argument to satisfy its
** memory needs for the first N pages that it adds to cache.  ^If additional
** page cache memory is needed beyond what is provided by this option, then
** SQLite goes to [sqlite3_malloc()] for the additional storage space.
** ^The implementation might use one or more of the N buffers to hold 
** memory accounting information. The pointer in the first argument must
** be aligned to an 8-byte boundary or subsequent behavior of SQLite
** will be undefined.</dd>
**
** <dt>SQLITE_CONFIG_HEAP</dt>
** <dd> ^This option specifies a static memory buffer that SQLite will use
** for all of its dynamic memory allocation needs beyond those provided
** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE].
** There are three arguments: An 8-byte aligned pointer to the memory,
** the number of bytes in the memory buffer, and the minimum allocation size.
** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts
** to using its default memory allocator (the system malloc() implementation),
** undoing any prior invocation of [SQLITE_CONFIG_MALLOC].  ^If the
** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or
** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory
** allocator is engaged to handle all of SQLites memory allocation needs.
** The first pointer (the memory pointer) must be aligned to an 8-byte
** boundary or subsequent behavior of SQLite will be undefined.</dd>
**
** <dt>SQLITE_CONFIG_MUTEX</dt>
** <dd> ^(This option takes a single argument which is a pointer to an
** instance of the [sqlite3_mutex_methods] structure.  The argument specifies
** alternative low-level mutex routines to be used in place
** the mutex routines built into SQLite.)^  ^SQLite makes a copy of the
** content of the [sqlite3_mutex_methods] structure before the call to
** [sqlite3_config()] returns. ^If SQLite is compiled with
** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
** the entire mutexing subsystem is omitted from the build and hence calls to
** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will
** return [SQLITE_ERROR].</dd>
**
** <dt>SQLITE_CONFIG_GETMUTEX</dt>
** <dd> ^(This option takes a single argument which is a pointer to an
** instance of the [sqlite3_mutex_methods] structure.  The
** [sqlite3_mutex_methods]
** structure is filled with the currently defined mutex routines.)^
** This option can be used to overload the default mutex allocation
** routines with a wrapper used to track mutex usage for performance
** profiling or testing, for example.   ^If SQLite is compiled with
** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then
** the entire mutexing subsystem is omitted from the build and hence calls to
** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will
** return [SQLITE_ERROR].</dd>
**
** <dt>SQLITE_CONFIG_LOOKASIDE</dt>
** <dd> ^(This option takes two arguments that determine the default
** memory allocation for the lookaside memory allocator on each
** [database connection].  The first argument is the
** size of each lookaside buffer slot and the second is the number of
** slots allocated to each database connection.)^  ^(This option sets the
** <i>default</i> lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE]
** verb to [sqlite3_db_config()] can be used to change the lookaside
** configuration on individual connections.)^ </dd>
**
** <dt>SQLITE_CONFIG_PCACHE</dt>
** <dd> ^(This option takes a single argument which is a pointer to
** an [sqlite3_pcache_methods] object.  This object specifies the interface
** to a custom page cache implementation.)^  ^SQLite makes a copy of the
** object and uses it for page cache memory allocations.</dd>
**
** <dt>SQLITE_CONFIG_GETPCACHE</dt>
** <dd> ^(This option takes a single argument which is a pointer to an
** [sqlite3_pcache_methods] object.  SQLite copies of the current
** page cache implementation into that object.)^ </dd>
**
** <dt>SQLITE_CONFIG_LOG</dt>
** <dd> ^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a
** function with a call signature of void(*)(void*,int,const char*), 
** and a pointer to void. ^If the function pointer is not NULL, it is
** invoked by [sqlite3_log()] to process each logging event.  ^If the
** function pointer is NULL, the [sqlite3_log()] interface becomes a no-op.
** ^The void pointer that is the second argument to SQLITE_CONFIG_LOG is
** passed through as the first parameter to the application-defined logger
** function whenever that function is invoked.  ^The second parameter to
** the logger function is a copy of the first parameter to the corresponding
** [sqlite3_log()] call and is intended to be a [result code] or an
** [extended result code].  ^The third parameter passed to the logger is
** log message after formatting via [sqlite3_snprintf()].
** The SQLite logging interface is not reentrant; the logger function
** supplied by the application must not invoke any SQLite interface.
** In a multi-threaded application, the application-defined logger
** function must be threadsafe. </dd>
**
** </dl>
*/
#define SQLITE_CONFIG_SINGLETHREAD  1  /* nil */
#define SQLITE_CONFIG_MULTITHREAD   2  /* nil */
#define SQLITE_CONFIG_SERIALIZED    3  /* nil */
#define SQLITE_CONFIG_MALLOC        4  /* sqlite3_mem_methods* */
#define SQLITE_CONFIG_GETMALLOC     5  /* sqlite3_mem_methods* */
#define SQLITE_CONFIG_SCRATCH       6  /* void*, int sz, int N */
#define SQLITE_CONFIG_PAGECACHE     7  /* void*, int sz, int N */
#define SQLITE_CONFIG_HEAP          8  /* void*, int nByte, int min */
#define SQLITE_CONFIG_MEMSTATUS     9  /* boolean */
#define SQLITE_CONFIG_MUTEX        10  /* sqlite3_mutex_methods* */
#define SQLITE_CONFIG_GETMUTEX     11  /* sqlite3_mutex_methods* */
/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */ 
#define SQLITE_CONFIG_LOOKASIDE    13  /* int int */
#define SQLITE_CONFIG_PCACHE       14  /* sqlite3_pcache_methods* */
#define SQLITE_CONFIG_GETPCACHE    15  /* sqlite3_pcache_methods* */
#define SQLITE_CONFIG_LOG          16  /* xFunc, void* */

/*
** CAPI3REF: Database Connection Configuration Options
**
** These constants are the available integer configuration options that
** can be passed as the second argument to the [sqlite3_db_config()] interface.
**
** New configuration options may be added in future releases of SQLite.
** Existing configuration options might be discontinued.  Applications
** should check the return code from [sqlite3_db_config()] to make sure that
** the call worked.  ^The [sqlite3_db_config()] interface will return a
** non-zero [error code] if a discontinued or unsupported configuration option
** is invoked.
**
** <dl>
** <dt>SQLITE_DBCONFIG_LOOKASIDE</dt>
** <dd> ^This option takes three additional arguments that determine the 
** [lookaside memory allocator] configuration for the [database connection].
** ^The first argument (the third parameter to [sqlite3_db_config()] is a
** pointer to an memory buffer to use for lookaside memory.
** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb
** may be NULL in which case SQLite will allocate the
** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the
** size of each lookaside buffer slot.  ^The third argument is the number of
** slots.  The size of the buffer in the first argument must be greater than
** or equal to the product of the second and third arguments.  The buffer
** must be aligned to an 8-byte boundary.  ^If the second argument to
** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally
** rounded down to the next smaller
** multiple of 8.  See also: [SQLITE_CONFIG_LOOKASIDE]</dd>
**
** </dl>
*/
#define SQLITE_DBCONFIG_LOOKASIDE    1001  /* void* int int */


/*
** CAPI3REF: Enable Or Disable Extended Result Codes
**
** ^The sqlite3_extended_result_codes() routine enables or disables the
** [extended result codes] feature of SQLite. ^The extended result
** codes are disabled by default for historical compatibility.
*/
SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff);

/*
** CAPI3REF: Last Insert Rowid
**
** ^Each entry in an SQLite table has a unique 64-bit signed
** integer key called the [ROWID | "rowid"]. ^The rowid is always available
** as an undeclared column named ROWID, OID, or _ROWID_ as long as those
** names are not also used by explicitly declared columns. ^If
** the table has a column of type [INTEGER PRIMARY KEY] then that column
** is another alias for the rowid.
**
** ^This routine returns the [rowid] of the most recent
** successful [INSERT] into the database from the [database connection]
** in the first argument.  ^If no successful [INSERT]s
** have ever occurred on that database connection, zero is returned.
**
** ^(If an [INSERT] occurs within a trigger, then the [rowid] of the inserted
** row is returned by this routine as long as the trigger is running.
** But once the trigger terminates, the value returned by this routine
** reverts to the last value inserted before the trigger fired.)^
**
** ^An [INSERT] that fails due to a constraint violation is not a
** successful [INSERT] and does not change the value returned by this
** routine.  ^Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK,
** and INSERT OR ABORT make no changes to the return value of this
** routine when their insertion fails.  ^(When INSERT OR REPLACE
** encounters a constraint violation, it does not fail.  The
** INSERT continues to completion after deleting rows that caused
** the constraint problem so INSERT OR REPLACE will always change
** the return value of this interface.)^
**
** ^For the purposes of this routine, an [INSERT] is considered to
** be successful even if it is subsequently rolled back.
**
** This function is accessible to SQL statements via the
** [last_insert_rowid() SQL function].
**
** If a separate thread performs a new [INSERT] on the same
** database connection while the [sqlite3_last_insert_rowid()]
** function is running and thus changes the last insert [rowid],
** then the value returned by [sqlite3_last_insert_rowid()] is
** unpredictable and might not equal either the old or the new
** last insert [rowid].
*/
SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*);

/*
** CAPI3REF: Count The Number Of Rows Modified
**
** ^This function returns the number of database rows that were changed
** or inserted or deleted by the most recently completed SQL statement
** on the [database connection] specified by the first parameter.
** ^(Only changes that are directly specified by the [INSERT], [UPDATE],
** or [DELETE] statement are counted.  Auxiliary changes caused by
** triggers or [foreign key actions] are not counted.)^ Use the
** [sqlite3_total_changes()] function to find the total number of changes
** including changes caused by triggers and foreign key actions.
**
** ^Changes to a view that are simulated by an [INSTEAD OF trigger]
** are not counted.  Only real table changes are counted.
**
** ^(A "row change" is a change to a single row of a single table
** caused by an INSERT, DELETE, or UPDATE statement.  Rows that
** are changed as side effects of [REPLACE] constraint resolution,
** rollback, ABORT processing, [DROP TABLE], or by any other
** mechanisms do not count as direct row changes.)^
**
** A "trigger context" is a scope of execution that begins and
** ends with the script of a [CREATE TRIGGER | trigger]. 
** Most SQL statements are
** evaluated outside of any trigger.  This is the "top level"
** trigger context.  If a trigger fires from the top level, a
** new trigger context is entered for the duration of that one
** trigger.  Subtriggers create subcontexts for their duration.
**
** ^Calling [sqlite3_exec()] or [sqlite3_step()] recursively does
** not create a new trigger context.
**
** ^This function returns the number of direct row changes in the
** most recent INSERT, UPDATE, or DELETE statement within the same
** trigger context.
**
** ^Thus, when called from the top level, this function returns the
** number of changes in the most recent INSERT, UPDATE, or DELETE
** that also occurred at the top level.  ^(Within the body of a trigger,
** the sqlite3_changes() interface can be called to find the number of
** changes in the most recently completed INSERT, UPDATE, or DELETE
** statement within the body of the same trigger.
** However, the number returned does not include changes
** caused by subtriggers since those have their own context.)^
**
** See also the [sqlite3_total_changes()] interface, the
** [count_changes pragma], and the [changes() SQL function].
**
** If a separate thread makes changes on the same database connection
** while [sqlite3_changes()] is running then the value returned
** is unpredictable and not meaningful.
*/
SQLITE_API int sqlite3_changes(sqlite3*);

/*
** CAPI3REF: Total Number Of Rows Modified
**
** ^This function returns the number of row changes caused by [INSERT],
** [UPDATE] or [DELETE] statements since the [database connection] was opened.
** ^(The count returned by sqlite3_total_changes() includes all changes
** from all [CREATE TRIGGER | trigger] contexts and changes made by
** [foreign key actions]. However,
** the count does not include changes used to implement [REPLACE] constraints,
** do rollbacks or ABORT processing, or [DROP TABLE] processing.  The
** count does not include rows of views that fire an [INSTEAD OF trigger],
** though if the INSTEAD OF trigger makes changes of its own, those changes 
** are counted.)^
** ^The sqlite3_total_changes() function counts the changes as soon as
** the statement that makes them is completed (when the statement handle
** is passed to [sqlite3_reset()] or [sqlite3_finalize()]).
**
** See also the [sqlite3_changes()] interface, the
** [count_changes pragma], and the [total_changes() SQL function].
**
** If a separate thread makes changes on the same database connection
** while [sqlite3_total_changes()] is running then the value
** returned is unpredictable and not meaningful.
*/
SQLITE_API int sqlite3_total_changes(sqlite3*);

/*
** CAPI3REF: Interrupt A Long-Running Query
**
** ^This function causes any pending database operation to abort and
** return at its earliest opportunity. This routine is typically
** called in response to a user action such as pressing "Cancel"
** or Ctrl-C where the user wants a long query operation to halt
** immediately.
**
** ^It is safe to call this routine from a thread different from the
** thread that is currently running the database operation.  But it
** is not safe to call this routine with a [database connection] that
** is closed or might close before sqlite3_interrupt() returns.
**
** ^If an SQL operation is very nearly finished at the time when
** sqlite3_interrupt() is called, then it might not have an opportunity
** to be interrupted and might continue to completion.
**
** ^An SQL operation that is interrupted will return [SQLITE_INTERRUPT].
** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE
** that is inside an explicit transaction, then the entire transaction
** will be rolled back automatically.
**
** ^The sqlite3_interrupt(D) call is in effect until all currently running
** SQL statements on [database connection] D complete.  ^Any new SQL statements
** that are started after the sqlite3_interrupt() call and before the 
** running statements reaches zero are interrupted as if they had been
** running prior to the sqlite3_interrupt() call.  ^New SQL statements
** that are started after the running statement count reaches zero are
** not effected by the sqlite3_interrupt().
** ^A call to sqlite3_interrupt(D) that occurs when there are no running
** SQL statements is a no-op and has no effect on SQL statements
** that are started after the sqlite3_interrupt() call returns.
**
** If the database connection closes while [sqlite3_interrupt()]
** is running then bad things will likely happen.
*/
SQLITE_API void sqlite3_interrupt(sqlite3*);

/*
** CAPI3REF: Determine If An SQL Statement Is Complete
**
** These routines are useful during command-line input to determine if the
** currently entered text seems to form a complete SQL statement or
** if additional input is needed before sending the text into
** SQLite for parsing.  ^These routines return 1 if the input string
** appears to be a complete SQL statement.  ^A statement is judged to be
** complete if it ends with a semicolon token and is not a prefix of a
** well-formed CREATE TRIGGER statement.  ^Semicolons that are embedded within
** string literals or quoted identifier names or comments are not
** independent tokens (they are part of the token in which they are
** embedded) and thus do not count as a statement terminator.  ^Whitespace
** and comments that follow the final semicolon are ignored.
**
** ^These routines return 0 if the statement is incomplete.  ^If a
** memory allocation fails, then SQLITE_NOMEM is returned.
**
** ^These routines do not parse the SQL statements thus
** will not detect syntactically incorrect SQL.
**
** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior 
** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked
** automatically by sqlite3_complete16().  If that initialization fails,
** then the return value from sqlite3_complete16() will be non-zero
** regardless of whether or not the input SQL is complete.)^
**
** The input to [sqlite3_complete()] must be a zero-terminated
** UTF-8 string.
**
** The input to [sqlite3_complete16()] must be a zero-terminated
** UTF-16 string in native byte order.
*/
SQLITE_API int sqlite3_complete(const char *sql);
SQLITE_API int sqlite3_complete16(const void *sql);

/*
** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors
**
** ^This routine sets a callback function that might be invoked whenever
** an attempt is made to open a database table that another thread
** or process has locked.
**
** ^If the busy callback is NULL, then [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED]
** is returned immediately upon encountering the lock.  ^If the busy callback
** is not NULL, then the callback might be invoked with two arguments.
**
** ^The first argument to the busy handler is a copy of the void* pointer which
** is the third argument to sqlite3_busy_handler().  ^The second argument to
** the busy handler callback is the number of times that the busy handler has
** been invoked for this locking event.  ^If the
** busy callback returns 0, then no additional attempts are made to
** access the database and [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] is returned.
** ^If the callback returns non-zero, then another attempt
** is made to open the database for reading and the cycle repeats.
**
** The presence of a busy handler does not guarantee that it will be invoked
** when there is lock contention. ^If SQLite determines that invoking the busy
** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY]
** or [SQLITE_IOERR_BLOCKED] instead of invoking the busy handler.
** Consider a scenario where one process is holding a read lock that
** it is trying to promote to a reserved lock and
** a second process is holding a reserved lock that it is trying
** to promote to an exclusive lock.  The first process cannot proceed
** because it is blocked by the second and the second process cannot
** proceed because it is blocked by the first.  If both processes
** invoke the busy handlers, neither will make any progress.  Therefore,
** SQLite returns [SQLITE_BUSY] for the first process, hoping that this
** will induce the first process to release its read lock and allow
** the second process to proceed.
**
** ^The default busy callback is NULL.
**
** ^The [SQLITE_BUSY] error is converted to [SQLITE_IOERR_BLOCKED]
** when SQLite is in the middle of a large transaction where all the
** changes will not fit into the in-memory cache.  SQLite will
** already hold a RESERVED lock on the database file, but it needs
** to promote this lock to EXCLUSIVE so that it can spill cache
** pages into the database file without harm to concurrent
** readers.  ^If it is unable to promote the lock, then the in-memory
** cache will be left in an inconsistent state and so the error
** code is promoted from the relatively benign [SQLITE_BUSY] to
** the more severe [SQLITE_IOERR_BLOCKED].  ^This error code promotion
** forces an automatic rollback of the changes.  See the
** <a href="/cvstrac/wiki?p=CorruptionFollowingBusyError">
** CorruptionFollowingBusyError</a> wiki page for a discussion of why
** this is important.
**
** ^(There can only be a single busy handler defined for each
** [database connection].  Setting a new busy handler clears any
** previously set handler.)^  ^Note that calling [sqlite3_busy_timeout()]
** will also set or clear the busy handler.
**
** The busy callback should not take any actions which modify the
** database connection that invoked the busy handler.  Any such actions
** result in undefined behavior.
** 
** A busy handler must not close the database connection
** or [prepared statement] that invoked the busy handler.
*/
SQLITE_API int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*);

/*
** CAPI3REF: Set A Busy Timeout
**
** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps
** for a specified amount of time when a table is locked.  ^The handler
** will sleep multiple times until at least "ms" milliseconds of sleeping
** have accumulated.  ^After at least "ms" milliseconds of sleeping,
** the handler returns 0 which causes [sqlite3_step()] to return
** [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED].
**
** ^Calling this routine with an argument less than or equal to zero
** turns off all busy handlers.
**
** ^(There can only be a single busy handler for a particular
** [database connection] any any given moment.  If another busy handler
** was defined  (using [sqlite3_busy_handler()]) prior to calling
** this routine, that other busy handler is cleared.)^
*/
SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms);

/*
** CAPI3REF: Convenience Routines For Running Queries
**
** Definition: A <b>result table</b> is memory data structure created by the
** [sqlite3_get_table()] interface.  A result table records the
** complete query results from one or more queries.
**
** The table conceptually has a number of rows and columns.  But
** these numbers are not part of the result table itself.  These
** numbers are obtained separately.  Let N be the number of rows
** and M be the number of columns.
**
** A result table is an array of pointers to zero-terminated UTF-8 strings.
** There are (N+1)*M elements in the array.  The first M pointers point
** to zero-terminated strings that  contain the names of the columns.
** The remaining entries all point to query results.  NULL values result
** in NULL pointers.  All other values are in their UTF-8 zero-terminated
** string representation as returned by [sqlite3_column_text()].
**
** A result table might consist of one or more memory allocations.
** It is not safe to pass a result table directly to [sqlite3_free()].
** A result table should be deallocated using [sqlite3_free_table()].
**
** As an example of the result table format, suppose a query result
** is as follows:
**
** <blockquote><pre>
**        Name        | Age
**        -----------------------
**        Alice       | 43
**        Bob         | 28
**        Cindy       | 21
** </pre></blockquote>
**
** There are two column (M==2) and three rows (N==3).  Thus the
** result table has 8 entries.  Suppose the result table is stored
** in an array names azResult.  Then azResult holds this content:
**
** <blockquote><pre>
**        azResult&#91;0] = "Name";
**        azResult&#91;1] = "Age";
**        azResult&#91;2] = "Alice";
**        azResult&#91;3] = "43";
**        azResult&#91;4] = "Bob";
**        azResult&#91;5] = "28";
**        azResult&#91;6] = "Cindy";
**        azResult&#91;7] = "21";
** </pre></blockquote>
**
** ^The sqlite3_get_table() function evaluates one or more
** semicolon-separated SQL statements in the zero-terminated UTF-8
** string of its 2nd parameter and returns a result table to the
** pointer given in its 3rd parameter.
**
** After the application has finished with the result from sqlite3_get_table(),
** it should pass the result table pointer to sqlite3_free_table() in order to
** release the memory that was malloced.  Because of the way the
** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling
** function must not try to call [sqlite3_free()] directly.  Only
** [sqlite3_free_table()] is able to release the memory properly and safely.
**
** ^(The sqlite3_get_table() interface is implemented as a wrapper around
** [sqlite3_exec()].  The sqlite3_get_table() routine does not have access
** to any internal data structures of SQLite.  It uses only the public
** interface defined here.  As a consequence, errors that occur in the
** wrapper layer outside of the internal [sqlite3_exec()] call are not
** reflected in subsequent calls to [sqlite3_errcode()] or
** [sqlite3_errmsg()].)^
*/
SQLITE_API int sqlite3_get_table(
  sqlite3 *db,          /* An open database */
  const char *zSql,     /* SQL to be evaluated */
  char ***pazResult,    /* Results of the query */
  int *pnRow,           /* Number of result rows written here */
  int *pnColumn,        /* Number of result columns written here */
  char **pzErrmsg       /* Error msg written here */
);
SQLITE_API void sqlite3_free_table(char **result);

/*
** CAPI3REF: Formatted String Printing Functions
**
** These routines are work-alikes of the "printf()" family of functions
** from the standard C library.
**
** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their
** results into memory obtained from [sqlite3_malloc()].
** The strings returned by these two routines should be
** released by [sqlite3_free()].  ^Both routines return a
** NULL pointer if [sqlite3_malloc()] is unable to allocate enough
** memory to hold the resulting string.
**
** ^(In sqlite3_snprintf() routine is similar to "snprintf()" from
** the standard C library.  The result is written into the
** buffer supplied as the second parameter whose size is given by
** the first parameter. Note that the order of the
** first two parameters is reversed from snprintf().)^  This is an
** historical accident that cannot be fixed without breaking
** backwards compatibility.  ^(Note also that sqlite3_snprintf()
** returns a pointer to its buffer instead of the number of
** characters actually written into the buffer.)^  We admit that
** the number of characters written would be a more useful return
** value but we cannot change the implementation of sqlite3_snprintf()
** now without breaking compatibility.
**
** ^As long as the buffer size is greater than zero, sqlite3_snprintf()
** guarantees that the buffer is always zero-terminated.  ^The first
** parameter "n" is the total size of the buffer, including space for
** the zero terminator.  So the longest string that can be completely
** written will be n-1 characters.
**
** These routines all implement some additional formatting
** options that are useful for constructing SQL statements.
** All of the usual printf() formatting options apply.  In addition, there
** is are "%q", "%Q", and "%z" options.
**
** ^(The %q option works like %s in that it substitutes a null-terminated
** string from the argument list.  But %q also doubles every '\'' character.
** %q is designed for use inside a string literal.)^  By doubling each '\''
** character it escapes that character and allows it to be inserted into
** the string.
**
** For example, assume the string variable zText contains text as follows:
**
** <blockquote><pre>
**  char *zText = "It's a happy day!";
** </pre></blockquote>
**
** One can use this text in an SQL statement as follows:
**
** <blockquote><pre>
**  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES('%q')", zText);
**  sqlite3_exec(db, zSQL, 0, 0, 0);
**  sqlite3_free(zSQL);
** </pre></blockquote>
**
** Because the %q format string is used, the '\'' character in zText
** is escaped and the SQL generated is as follows:
**
** <blockquote><pre>
**  INSERT INTO table1 VALUES('It''s a happy day!')
** </pre></blockquote>
**
** This is correct.  Had we used %s instead of %q, the generated SQL
** would have looked like this:
**
** <blockquote><pre>
**  INSERT INTO table1 VALUES('It's a happy day!');
** </pre></blockquote>
**
** This second example is an SQL syntax error.  As a general rule you should
** always use %q instead of %s when inserting text into a string literal.
**
** ^(The %Q option works like %q except it also adds single quotes around
** the outside of the total string.  Additionally, if the parameter in the
** argument list is a NULL pointer, %Q substitutes the text "NULL" (without
** single quotes).)^  So, for example, one could say:
**
** <blockquote><pre>
**  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES(%Q)", zText);
**  sqlite3_exec(db, zSQL, 0, 0, 0);
**  sqlite3_free(zSQL);
** </pre></blockquote>
**
** The code above will render a correct SQL statement in the zSQL
** variable even if the zText variable is a NULL pointer.
**
** ^(The "%z" formatting option works like "%s" but with the
** addition that after the string has been read and copied into
** the result, [sqlite3_free()] is called on the input string.)^
*/
SQLITE_API char *sqlite3_mprintf(const char*,...);
SQLITE_API char *sqlite3_vmprintf(const char*, va_list);
SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...);

/*
** CAPI3REF: Memory Allocation Subsystem
**
** The SQLite core uses these three routines for all of its own
** internal memory allocation needs. "Core" in the previous sentence
** does not include operating-system specific VFS implementation.  The
** Windows VFS uses native malloc() and free() for some operations.
**
** ^The sqlite3_malloc() routine returns a pointer to a block
** of memory at least N bytes in length, where N is the parameter.
** ^If sqlite3_malloc() is unable to obtain sufficient free
** memory, it returns a NULL pointer.  ^If the parameter N to
** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns
** a NULL pointer.
**
** ^Calling sqlite3_free() with a pointer previously returned
** by sqlite3_malloc() or sqlite3_realloc() releases that memory so
** that it might be reused.  ^The sqlite3_free() routine is
** a no-op if is called with a NULL pointer.  Passing a NULL pointer
** to sqlite3_free() is harmless.  After being freed, memory
** should neither be read nor written.  Even reading previously freed
** memory might result in a segmentation fault or other severe error.
** Memory corruption, a segmentation fault, or other severe error
** might result if sqlite3_free() is called with a non-NULL pointer that
** was not obtained from sqlite3_malloc() or sqlite3_realloc().
**
** ^(The sqlite3_realloc() interface attempts to resize a
** prior memory allocation to be at least N bytes, where N is the
** second parameter.  The memory allocation to be resized is the first
** parameter.)^ ^ If the first parameter to sqlite3_realloc()
** is a NULL pointer then its behavior is identical to calling
** sqlite3_malloc(N) where N is the second parameter to sqlite3_realloc().
** ^If the second parameter to sqlite3_realloc() is zero or
** negative then the behavior is exactly the same as calling
** sqlite3_free(P) where P is the first parameter to sqlite3_realloc().
** ^sqlite3_realloc() returns a pointer to a memory allocation
** of at least N bytes in size or NULL if sufficient memory is unavailable.
** ^If M is the size of the prior allocation, then min(N,M) bytes
** of the prior allocation are copied into the beginning of buffer returned
** by sqlite3_realloc() and the prior allocation is freed.
** ^If sqlite3_realloc() returns NULL, then the prior allocation
** is not freed.
**
** ^The memory returned by sqlite3_malloc() and sqlite3_realloc()
** is always aligned to at least an 8 byte boundary.
**
** In SQLite version 3.5.0 and 3.5.1, it was possible to define
** the SQLITE_OMIT_MEMORY_ALLOCATION which would cause the built-in
** implementation of these routines to be omitted.  That capability
** is no longer provided.  Only built-in memory allocators can be used.
**
** The Windows OS interface layer calls
** the system malloc() and free() directly when converting
** filenames between the UTF-8 encoding used by SQLite
** and whatever filename encoding is used by the particular Windows
** installation.  Memory allocation errors are detected, but
** they are reported back as [SQLITE_CANTOPEN] or
** [SQLITE_IOERR] rather than [SQLITE_NOMEM].
**
** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()]
** must be either NULL or else pointers obtained from a prior
** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have
** not yet been released.
**
** The application must not read or write any part of
** a block of memory after it has been released using
** [sqlite3_free()] or [sqlite3_realloc()].
*/
SQLITE_API void *sqlite3_malloc(int);
SQLITE_API void *sqlite3_realloc(void*, int);
SQLITE_API void sqlite3_free(void*);

/*
** CAPI3REF: Memory Allocator Statistics
**
** SQLite provides these two interfaces for reporting on the status
** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()]
** routines, which form the built-in memory allocation subsystem.
**
** ^The [sqlite3_memory_used()] routine returns the number of bytes
** of memory currently outstanding (malloced but not freed).
** ^The [sqlite3_memory_highwater()] routine returns the maximum
** value of [sqlite3_memory_used()] since the high-water mark
** was last reset.  ^The values returned by [sqlite3_memory_used()] and
** [sqlite3_memory_highwater()] include any overhead
** added by SQLite in its implementation of [sqlite3_malloc()],
** but not overhead added by the any underlying system library
** routines that [sqlite3_malloc()] may call.
**
** ^The memory high-water mark is reset to the current value of
** [sqlite3_memory_used()] if and only if the parameter to
** [sqlite3_memory_highwater()] is true.  ^The value returned
** by [sqlite3_memory_highwater(1)] is the high-water mark
** prior to the reset.
*/
SQLITE_API sqlite3_int64 sqlite3_memory_used(void);
SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag);

/*
** CAPI3REF: Pseudo-Random Number Generator
**
** SQLite contains a high-quality pseudo-random number generator (PRNG) used to
** select random [ROWID | ROWIDs] when inserting new records into a table that
** already uses the largest possible [ROWID].  The PRNG is also used for
** the build-in random() and randomblob() SQL functions.  This interface allows
** applications to access the same PRNG for other purposes.
**
** ^A call to this routine stores N bytes of randomness into buffer P.
**
** ^The first time this routine is invoked (either internally or by
** the application) the PRNG is seeded using randomness obtained
** from the xRandomness method of the default [sqlite3_vfs] object.
** ^On all subsequent invocations, the pseudo-randomness is generated
** internally and without recourse to the [sqlite3_vfs] xRandomness
** method.
*/
SQLITE_API void sqlite3_randomness(int N, void *P);

/*
** CAPI3REF: Compile-Time Authorization Callbacks
**
** ^This routine registers a authorizer callback with a particular
** [database connection], supplied in the first argument.
** ^The authorizer callback is invoked as SQL statements are being compiled
** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()].  ^At various
** points during the compilation process, as logic is being created
** to perform various actions, the authorizer callback is invoked to
** see if those actions are allowed.  ^The authorizer callback should
** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the
** specific action but allow the SQL statement to continue to be
** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be
** rejected with an error.  ^If the authorizer callback returns
** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY]
** then the [sqlite3_prepare_v2()] or equivalent call that triggered
** the authorizer will fail with an error message.
**
** When the callback returns [SQLITE_OK], that means the operation
** requested is ok.  ^When the callback returns [SQLITE_DENY], the
** [sqlite3_prepare_v2()] or equivalent call that triggered the
** authorizer will fail with an error message explaining that
** access is denied. 
**
** ^The first parameter to the authorizer callback is a copy of the third
** parameter to the sqlite3_set_authorizer() interface. ^The second parameter
** to the callback is an integer [SQLITE_COPY | action code] that specifies
** the particular action to be authorized. ^The third through sixth parameters
** to the callback are zero-terminated strings that contain additional
** details about the action to be authorized.
**
** ^If the action code is [SQLITE_READ]
** and the callback returns [SQLITE_IGNORE] then the
** [prepared statement] statement is constructed to substitute
** a NULL value in place of the table column that would have
** been read if [SQLITE_OK] had been returned.  The [SQLITE_IGNORE]
** return can be used to deny an untrusted user access to individual
** columns of a table.
** ^If the action code is [SQLITE_DELETE] and the callback returns
** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the
** [truncate optimization] is disabled and all rows are deleted individually.
**
** An authorizer is used when [sqlite3_prepare | preparing]
** SQL statements from an untrusted source, to ensure that the SQL statements
** do not try to access data they are not allowed to see, or that they do not
** try to execute malicious statements that damage the database.  For
** example, an application may allow a user to enter arbitrary
** SQL queries for evaluation by a database.  But the application does
** not want the user to be able to make arbitrary changes to the
** database.  An authorizer could then be put in place while the
** user-entered SQL is being [sqlite3_prepare | prepared] that
** disallows everything except [SELECT] statements.
**
** Applications that need to process SQL from untrusted sources
** might also consider lowering resource limits using [sqlite3_limit()]
** and limiting database size using the [max_page_count] [PRAGMA]
** in addition to using an authorizer.
**
** ^(Only a single authorizer can be in place on a database connection
** at a time.  Each call to sqlite3_set_authorizer overrides the
** previous call.)^  ^Disable the authorizer by installing a NULL callback.
** The authorizer is disabled by default.
**
** The authorizer callback must not do anything that will modify
** the database connection that invoked the authorizer callback.
** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
** database connections for the meaning of "modify" in this paragraph.
**
** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the
** statement might be re-prepared during [sqlite3_step()] due to a 
** schema change.  Hence, the application should ensure that the
** correct authorizer callback remains in place during the [sqlite3_step()].
**
** ^Note that the authorizer callback is invoked only during
** [sqlite3_prepare()] or its variants.  Authorization is not
** performed during statement evaluation in [sqlite3_step()], unless
** as stated in the previous paragraph, sqlite3_step() invokes
** sqlite3_prepare_v2() to reprepare a statement after a schema change.
*/
SQLITE_API int sqlite3_set_authorizer(
  sqlite3*,
  int (*xAuth)(void*,int,const char*,const char*,const char*,const char*),
  void *pUserData
);

/*
** CAPI3REF: Authorizer Return Codes
**
** The [sqlite3_set_authorizer | authorizer callback function] must
** return either [SQLITE_OK] or one of these two constants in order
** to signal SQLite whether or not the action is permitted.  See the
** [sqlite3_set_authorizer | authorizer documentation] for additional
** information.
*/
#define SQLITE_DENY   1   /* Abort the SQL statement with an error */
#define SQLITE_IGNORE 2   /* Don't allow access, but don't generate an error */

/*
** CAPI3REF: Authorizer Action Codes
**
** The [sqlite3_set_authorizer()] interface registers a callback function
** that is invoked to authorize certain SQL statement actions.  The
** second parameter to the callback is an integer code that specifies
** what action is being authorized.  These are the integer action codes that
** the authorizer callback may be passed.
**
** These action code values signify what kind of operation is to be
** authorized.  The 3rd and 4th parameters to the authorization
** callback function will be parameters or NULL depending on which of these
** codes is used as the second parameter.  ^(The 5th parameter to the
** authorizer callback is the name of the database ("main", "temp",
** etc.) if applicable.)^  ^The 6th parameter to the authorizer callback
** is the name of the inner-most trigger or view that is responsible for
** the access attempt or NULL if this access attempt is directly from
** top-level SQL code.
*/
/******************************************* 3rd ************ 4th ***********/
#define SQLITE_CREATE_INDEX          1   /* Index Name      Table Name      */
#define SQLITE_CREATE_TABLE          2   /* Table Name      NULL            */
#define SQLITE_CREATE_TEMP_INDEX     3   /* Index Name      Table Name      */
#define SQLITE_CREATE_TEMP_TABLE     4   /* Table Name      NULL            */
#define SQLITE_CREATE_TEMP_TRIGGER   5   /* Trigger Name    Table Name      */
#define SQLITE_CREATE_TEMP_VIEW      6   /* View Name       NULL            */
#define SQLITE_CREATE_TRIGGER        7   /* Trigger Name    Table Name      */
#define SQLITE_CREATE_VIEW           8   /* View Name       NULL            */
#define SQLITE_DELETE                9   /* Table Name      NULL            */
#define SQLITE_DROP_INDEX           10   /* Index Name      Table Name      */
#define SQLITE_DROP_TABLE           11   /* Table Name      NULL            */
#define SQLITE_DROP_TEMP_INDEX      12   /* Index Name      Table Name      */
#define SQLITE_DROP_TEMP_TABLE      13   /* Table Name      NULL            */
#define SQLITE_DROP_TEMP_TRIGGER    14   /* Trigger Name    Table Name      */
#define SQLITE_DROP_TEMP_VIEW       15   /* View Name       NULL            */
#define SQLITE_DROP_TRIGGER         16   /* Trigger Name    Table Name      */
#define SQLITE_DROP_VIEW            17   /* View Name       NULL            */
#define SQLITE_INSERT               18   /* Table Name      NULL            */
#define SQLITE_PRAGMA               19   /* Pragma Name     1st arg or NULL */
#define SQLITE_READ                 20   /* Table Name      Column Name     */
#define SQLITE_SELECT               21   /* NULL            NULL            */
#define SQLITE_TRANSACTION          22   /* Operation       NULL            */
#define SQLITE_UPDATE               23   /* Table Name      Column Name     */
#define SQLITE_ATTACH               24   /* Filename        NULL            */
#define SQLITE_DETACH               25   /* Database Name   NULL            */
#define SQLITE_ALTER_TABLE          26   /* Database Name   Table Name      */
#define SQLITE_REINDEX              27   /* Index Name      NULL            */
#define SQLITE_ANALYZE              28   /* Table Name      NULL            */
#define SQLITE_CREATE_VTABLE        29   /* Table Name      Module Name     */
#define SQLITE_DROP_VTABLE          30   /* Table Name      Module Name     */
#define SQLITE_FUNCTION             31   /* NULL            Function Name   */
#define SQLITE_SAVEPOINT            32   /* Operation       Savepoint Name  */
#define SQLITE_COPY                  0   /* No longer used */

/*
** CAPI3REF: Tracing And Profiling Functions
**
** These routines register callback functions that can be used for
** tracing and profiling the execution of SQL statements.
**
** ^The callback function registered by sqlite3_trace() is invoked at
** various times when an SQL statement is being run by [sqlite3_step()].
** ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the
** SQL statement text as the statement first begins executing.
** ^(Additional sqlite3_trace() callbacks might occur
** as each triggered subprogram is entered.  The callbacks for triggers
** contain a UTF-8 SQL comment that identifies the trigger.)^
**
** ^The callback function registered by sqlite3_profile() is invoked
** as each SQL statement finishes.  ^The profile callback contains
** the original statement text and an estimate of wall-clock time
** of how long that statement took to run.
*/
SQLITE_API void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*,
   void(*xProfile)(void*,const char*,sqlite3_uint64), void*);

/*
** CAPI3REF: Query Progress Callbacks
**
** ^This routine configures a callback function - the
** progress callback - that is invoked periodically during long
** running calls to [sqlite3_exec()], [sqlite3_step()] and
** [sqlite3_get_table()].  An example use for this
** interface is to keep a GUI updated during a large query.
**
** ^If the progress callback returns non-zero, the operation is
** interrupted.  This feature can be used to implement a
** "Cancel" button on a GUI progress dialog box.
**
** The progress handler must not do anything that will modify
** the database connection that invoked the progress handler.
** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
** database connections for the meaning of "modify" in this paragraph.
**
*/
SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);

/*
** CAPI3REF: Opening A New Database Connection
**
** ^These routines open an SQLite database file whose name is given by the
** filename argument. ^The filename argument is interpreted as UTF-8 for
** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte
** order for sqlite3_open16(). ^(A [database connection] handle is usually
** returned in *ppDb, even if an error occurs.  The only exception is that
** if SQLite is unable to allocate memory to hold the [sqlite3] object,
** a NULL will be written into *ppDb instead of a pointer to the [sqlite3]
** object.)^ ^(If the database is opened (and/or created) successfully, then
** [SQLITE_OK] is returned.  Otherwise an [error code] is returned.)^ ^The
** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain
** an English language description of the error following a failure of any
** of the sqlite3_open() routines.
**
** ^The default encoding for the database will be UTF-8 if
** sqlite3_open() or sqlite3_open_v2() is called and
** UTF-16 in the native byte order if sqlite3_open16() is used.
**
** Whether or not an error occurs when it is opened, resources
** associated with the [database connection] handle should be released by
** passing it to [sqlite3_close()] when it is no longer required.
**
** The sqlite3_open_v2() interface works like sqlite3_open()
** except that it accepts two additional parameters for additional control
** over the new database connection.  ^(The flags parameter to
** sqlite3_open_v2() can take one of
** the following three values, optionally combined with the 
** [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX], [SQLITE_OPEN_SHAREDCACHE],
** and/or [SQLITE_OPEN_PRIVATECACHE] flags:)^
**
** <dl>
** ^(<dt>[SQLITE_OPEN_READONLY]</dt>
** <dd>The database is opened in read-only mode.  If the database does not
** already exist, an error is returned.</dd>)^
**
** ^(<dt>[SQLITE_OPEN_READWRITE]</dt>
** <dd>The database is opened for reading and writing if possible, or reading
** only if the file is write protected by the operating system.  In either
** case the database must already exist, otherwise an error is returned.</dd>)^
**
** ^(<dt>[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]</dt>
** <dd>The database is opened for reading and writing, and is creates it if
** it does not already exist. This is the behavior that is always used for
** sqlite3_open() and sqlite3_open16().</dd>)^
** </dl>
**
** If the 3rd parameter to sqlite3_open_v2() is not one of the
** combinations shown above or one of the combinations shown above combined
** with the [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX],
** [SQLITE_OPEN_SHAREDCACHE] and/or [SQLITE_OPEN_SHAREDCACHE] flags,
** then the behavior is undefined.
**
** ^If the [SQLITE_OPEN_NOMUTEX] flag is set, then the database connection
** opens in the multi-thread [threading mode] as long as the single-thread
** mode has not been set at compile-time or start-time.  ^If the
** [SQLITE_OPEN_FULLMUTEX] flag is set then the database connection opens
** in the serialized [threading mode] unless single-thread was
** previously selected at compile-time or start-time.
** ^The [SQLITE_OPEN_SHAREDCACHE] flag causes the database connection to be
** eligible to use [shared cache mode], regardless of whether or not shared
** cache is enabled using [sqlite3_enable_shared_cache()].  ^The
** [SQLITE_OPEN_PRIVATECACHE] flag causes the database connection to not
** participate in [shared cache mode] even if it is enabled.
**
** ^If the filename is ":memory:", then a private, temporary in-memory database
** is created for the connection.  ^This in-memory database will vanish when
** the database connection is closed.  Future versions of SQLite might
** make use of additional special filenames that begin with the ":" character.
** It is recommended that when a database filename actually does begin with
** a ":" character you should prefix the filename with a pathname such as
** "./" to avoid ambiguity.
**
** ^If the filename is an empty string, then a private, temporary
** on-disk database will be created.  ^This private database will be
** automatically deleted as soon as the database connection is closed.
**
** ^The fourth parameter to sqlite3_open_v2() is the name of the
** [sqlite3_vfs] object that defines the operating system interface that
** the new database connection should use.  ^If the fourth parameter is
** a NULL pointer then the default [sqlite3_vfs] object is used.
**
** <b>Note to Windows users:</b>  The encoding used for the filename argument
** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever
** codepage is currently defined.  Filenames containing international
** characters must be converted to UTF-8 prior to passing them into
** sqlite3_open() or sqlite3_open_v2().
*/
SQLITE_API int sqlite3_open(
  const char *filename,   /* Database filename (UTF-8) */
  sqlite3 **ppDb          /* OUT: SQLite db handle */
);
SQLITE_API int sqlite3_open16(
  const void *filename,   /* Database filename (UTF-16) */
  sqlite3 **ppDb          /* OUT: SQLite db handle */
);
SQLITE_API int sqlite3_open_v2(
  const char *filename,   /* Database filename (UTF-8) */
  sqlite3 **ppDb,         /* OUT: SQLite db handle */
  int flags,              /* Flags */
  const char *zVfs        /* Name of VFS module to use */
);

/*
** CAPI3REF: Error Codes And Messages
**
** ^The sqlite3_errcode() interface returns the numeric [result code] or
** [extended result code] for the most recent failed sqlite3_* API call
** associated with a [database connection]. If a prior API call failed
** but the most recent API call succeeded, the return value from
** sqlite3_errcode() is undefined.  ^The sqlite3_extended_errcode()
** interface is the same except that it always returns the 
** [extended result code] even when extended result codes are
** disabled.
**
** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
** text that describes the error, as either UTF-8 or UTF-16 respectively.
** ^(Memory to hold the error message string is managed internally.
** The application does not need to worry about freeing the result.
** However, the error string might be overwritten or deallocated by
** subsequent calls to other SQLite interface functions.)^
**
** When the serialized [threading mode] is in use, it might be the
** case that a second error occurs on a separate thread in between
** the time of the first error and the call to these interfaces.
** When that happens, the second error will be reported since these
** interfaces always report the most recent result.  To avoid
** this, each thread can obtain exclusive use of the [database connection] D
** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning
** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after
** all calls to the interfaces listed here are completed.
**
** If an interface fails with SQLITE_MISUSE, that means the interface
** was invoked incorrectly by the application.  In that case, the
** error code and message may or may not be set.
*/
SQLITE_API int sqlite3_errcode(sqlite3 *db);
SQLITE_API int sqlite3_extended_errcode(sqlite3 *db);
SQLITE_API const char *sqlite3_errmsg(sqlite3*);
SQLITE_API const void *sqlite3_errmsg16(sqlite3*);

/*
** CAPI3REF: SQL Statement Object
** KEYWORDS: {prepared statement} {prepared statements}
**
** An instance of this object represents a single SQL statement.
** This object is variously known as a "prepared statement" or a
** "compiled SQL statement" or simply as a "statement".
**
** The life of a statement object goes something like this:
**
** <ol>
** <li> Create the object using [sqlite3_prepare_v2()] or a related
**      function.
** <li> Bind values to [host parameters] using the sqlite3_bind_*()
**      interfaces.
** <li> Run the SQL by calling [sqlite3_step()] one or more times.
** <li> Reset the statement using [sqlite3_reset()] then go back
**      to step 2.  Do this zero or more times.
** <li> Destroy the object using [sqlite3_finalize()].
** </ol>
**
** Refer to documentation on individual methods above for additional
** information.
*/
typedef struct sqlite3_stmt sqlite3_stmt;

/*
** CAPI3REF: Run-time Limits
**
** ^(This interface allows the size of various constructs to be limited
** on a connection by connection basis.  The first parameter is the
** [database connection] whose limit is to be set or queried.  The
** second parameter is one of the [limit categories] that define a
** class of constructs to be size limited.  The third parameter is the
** new limit for that construct.  The function returns the old limit.)^
**
** ^If the new limit is a negative number, the limit is unchanged.
** ^(For the limit category of SQLITE_LIMIT_XYZ there is a 
** [limits | hard upper bound]
** set by a compile-time C preprocessor macro named 
** [limits | SQLITE_MAX_XYZ].
** (The "_LIMIT_" in the name is changed to "_MAX_".))^
** ^Attempts to increase a limit above its hard upper bound are
** silently truncated to the hard upper bound.
**
** Run-time limits are intended for use in applications that manage
** both their own internal database and also databases that are controlled
** by untrusted external sources.  An example application might be a
** web browser that has its own databases for storing history and
** separate databases controlled by JavaScript applications downloaded
** off the Internet.  The internal databases can be given the
** large, default limits.  Databases managed by external sources can
** be given much smaller limits designed to prevent a denial of service
** attack.  Developers might also want to use the [sqlite3_set_authorizer()]
** interface to further control untrusted SQL.  The size of the database
** created by an untrusted script can be contained using the
** [max_page_count] [PRAGMA].
**
** New run-time limit categories may be added in future releases.
*/
SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);

/*
** CAPI3REF: Run-Time Limit Categories
** KEYWORDS: {limit category} {*limit categories}
**
** These constants define various performance limits
** that can be lowered at run-time using [sqlite3_limit()].
** The synopsis of the meanings of the various limits is shown below.
** Additional information is available at [limits | Limits in SQLite].
**
** <dl>
** ^(<dt>SQLITE_LIMIT_LENGTH</dt>
** <dd>The maximum size of any string or BLOB or table row.<dd>)^
**
** ^(<dt>SQLITE_LIMIT_SQL_LENGTH</dt>
** <dd>The maximum length of an SQL statement, in bytes.</dd>)^
**
** ^(<dt>SQLITE_LIMIT_COLUMN</dt>
** <dd>The maximum number of columns in a table definition or in the
** result set of a [SELECT] or the maximum number of columns in an index
** or in an ORDER BY or GROUP BY clause.</dd>)^
**
** ^(<dt>SQLITE_LIMIT_EXPR_DEPTH</dt>
** <dd>The maximum depth of the parse tree on any expression.</dd>)^
**
** ^(<dt>SQLITE_LIMIT_COMPOUND_SELECT</dt>
** <dd>The maximum number of terms in a compound SELECT statement.</dd>)^
**
** ^(<dt>SQLITE_LIMIT_VDBE_OP</dt>
** <dd>The maximum number of instructions in a virtual machine program
** used to implement an SQL statement.</dd>)^
**
** ^(<dt>SQLITE_LIMIT_FUNCTION_ARG</dt>
** <dd>The maximum number of arguments on a function.</dd>)^
**
** ^(<dt>SQLITE_LIMIT_ATTACHED</dt>
** <dd>The maximum number of [ATTACH | attached databases].)^</dd>
**
** ^(<dt>SQLITE_LIMIT_LIKE_PATTERN_LENGTH</dt>
** <dd>The maximum length of the pattern argument to the [LIKE] or
** [GLOB] operators.</dd>)^
**
** ^(<dt>SQLITE_LIMIT_VARIABLE_NUMBER</dt>
** <dd>The maximum number of variables in an SQL statement that can
** be bound.</dd>)^
**
** ^(<dt>SQLITE_LIMIT_TRIGGER_DEPTH</dt>
** <dd>The maximum depth of recursion for triggers.</dd>)^
** </dl>
*/
#define SQLITE_LIMIT_LENGTH                    0
#define SQLITE_LIMIT_SQL_LENGTH                1
#define SQLITE_LIMIT_COLUMN                    2
#define SQLITE_LIMIT_EXPR_DEPTH                3
#define SQLITE_LIMIT_COMPOUND_SELECT           4
#define SQLITE_LIMIT_VDBE_OP                   5
#define SQLITE_LIMIT_FUNCTION_ARG              6
#define SQLITE_LIMIT_ATTACHED                  7
#define SQLITE_LIMIT_LIKE_PATTERN_LENGTH       8
#define SQLITE_LIMIT_VARIABLE_NUMBER           9
#define SQLITE_LIMIT_TRIGGER_DEPTH            10

/*
** CAPI3REF: Compiling An SQL Statement
** KEYWORDS: {SQL statement compiler}
**
** To execute an SQL query, it must first be compiled into a byte-code
** program using one of these routines.
**
** The first argument, "db", is a [database connection] obtained from a
** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or
** [sqlite3_open16()].  The database connection must not have been closed.
**
** The second argument, "zSql", is the statement to be compiled, encoded
** as either UTF-8 or UTF-16.  The sqlite3_prepare() and sqlite3_prepare_v2()
** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2()
** use UTF-16.
**
** ^If the nByte argument is less than zero, then zSql is read up to the
** first zero terminator. ^If nByte is non-negative, then it is the maximum
** number of  bytes read from zSql.  ^When nByte is non-negative, the
** zSql string ends at either the first '\000' or '\u0000' character or
** the nByte-th byte, whichever comes first. If the caller knows
** that the supplied string is nul-terminated, then there is a small
** performance advantage to be gained by passing an nByte parameter that
** is equal to the number of bytes in the input string <i>including</i>
** the nul-terminator bytes.
**
** ^If pzTail is not NULL then *pzTail is made to point to the first byte
** past the end of the first SQL statement in zSql.  These routines only
** compile the first statement in zSql, so *pzTail is left pointing to
** what remains uncompiled.
**
** ^*ppStmt is left pointing to a compiled [prepared statement] that can be
** executed using [sqlite3_step()].  ^If there is an error, *ppStmt is set
** to NULL.  ^If the input text contains no SQL (if the input is an empty
** string or a comment) then *ppStmt is set to NULL.
** The calling procedure is responsible for deleting the compiled
** SQL statement using [sqlite3_finalize()] after it has finished with it.
** ppStmt may not be NULL.
**
** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK];
** otherwise an [error code] is returned.
**
** 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 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
** return [SQLITE_SCHEMA].  But unlike the legacy behavior, [SQLITE_SCHEMA] is
** now a fatal error.  Calling [sqlite3_prepare_v2()] again will not make the
** error go away.  Note: use [sqlite3_errmsg()] to find the text
** of the parsing error that results in an [SQLITE_SCHEMA] return.
** </li>
**
** <li>
** ^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 the application 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>
*/
SQLITE_API int sqlite3_prepare(
  sqlite3 *db,            /* Database handle */
  const char *zSql,       /* SQL statement, UTF-8 encoded */
  int nByte,              /* Maximum length of zSql in bytes. */
  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
  const char **pzTail     /* OUT: Pointer to unused portion of zSql */
);
SQLITE_API int sqlite3_prepare_v2(
  sqlite3 *db,            /* Database handle */
  const char *zSql,       /* SQL statement, UTF-8 encoded */
  int nByte,              /* Maximum length of zSql in bytes. */
  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
  const char **pzTail     /* OUT: Pointer to unused portion of zSql */
);
SQLITE_API int sqlite3_prepare16(
  sqlite3 *db,            /* Database handle */
  const void *zSql,       /* SQL statement, UTF-16 encoded */
  int nByte,              /* Maximum length of zSql in bytes. */
  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
  const void **pzTail     /* OUT: Pointer to unused portion of zSql */
);
SQLITE_API int sqlite3_prepare16_v2(
  sqlite3 *db,            /* Database handle */
  const void *zSql,       /* SQL statement, UTF-16 encoded */
  int nByte,              /* Maximum length of zSql in bytes. */
  sqlite3_stmt **ppStmt,  /* OUT: Statement handle */
  const void **pzTail     /* OUT: Pointer to unused portion of zSql */
);

/*
** CAPI3REF: Retrieving Statement SQL
**
** ^This interface can be used to retrieve a saved copy of the original
** SQL text used to create a [prepared statement] if that statement was
** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()].
*/
SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt);

/*
** CAPI3REF: Dynamically Typed Value Object
** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value}
**
** SQLite uses the sqlite3_value object to represent all values
** that can be stored in a database table. SQLite uses dynamic typing
** for the values it stores.  ^Values stored in sqlite3_value objects
** can be integers, floating point values, strings, BLOBs, or NULL.
**
** An sqlite3_value object may be either "protected" or "unprotected".
** Some interfaces require a protected sqlite3_value.  Other interfaces
** will accept either a protected or an unprotected sqlite3_value.
** Every interface that accepts sqlite3_value arguments specifies
** whether or not it requires a protected sqlite3_value.
**
** The terms "protected" and "unprotected" refer to whether or not
** a mutex is held.  A internal mutex is held for a protected
** sqlite3_value object but no mutex is held for an unprotected
** sqlite3_value object.  If SQLite is compiled to be single-threaded
** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0)
** or if SQLite is run in one of reduced mutex modes 
** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD]
** then there is no distinction between protected and unprotected
** sqlite3_value objects and they can be used interchangeably.  However,
** for maximum code portability it is recommended that applications
** still make the distinction between between protected and unprotected
** sqlite3_value objects even when not strictly required.
**
** ^The sqlite3_value objects that are passed as parameters into the
** implementation of [application-defined SQL functions] are protected.
** ^The sqlite3_value object returned by
** [sqlite3_column_value()] is unprotected.
** Unprotected sqlite3_value objects may only be used with
** [sqlite3_result_value()] and [sqlite3_bind_value()].
** The [sqlite3_value_blob | sqlite3_value_type()] family of
** interfaces require protected sqlite3_value objects.
*/
typedef struct Mem sqlite3_value;

/*
** CAPI3REF: SQL Function Context Object
**
** The context in which an SQL function executes is stored in an
** sqlite3_context object.  ^A pointer to an sqlite3_context object
** is always first parameter to [application-defined SQL functions].
** The application-defined SQL function implementation will pass this
** pointer through into calls to [sqlite3_result_int | sqlite3_result()],
** [sqlite3_aggregate_context()], [sqlite3_user_data()],
** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()],
** and/or [sqlite3_set_auxdata()].
*/
typedef struct sqlite3_context sqlite3_context;

/*
** CAPI3REF: Binding Values To Prepared Statements
** KEYWORDS: {host parameter} {host parameters} {host parameter name}
** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding}
**
** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants,
** literals may be replaced by a [parameter] that matches one of following
** templates:
**
** <ul>
** <li>  ?
** <li>  ?NNN
** <li>  :VVV
** <li>  @VVV
** <li>  $VVV
** </ul>
**
** In the templates above, NNN represents an integer literal,
** and VVV represents an alphanumeric identifer.)^  ^The values of these
** parameters (also called "host parameter names" or "SQL parameters")
** can be set using the sqlite3_bind_*() routines defined here.
**
** ^The first argument to the sqlite3_bind_*() routines is always
** a pointer to the [sqlite3_stmt] object returned from
** [sqlite3_prepare_v2()] or its variants.
**
** ^The second argument is the index of the SQL parameter to be set.
** ^The leftmost SQL parameter has an index of 1.  ^When the same named
** SQL parameter is used more than once, second and subsequent
** occurrences have the same index as the first occurrence.
** ^The index for named parameters can be looked up using the
** [sqlite3_bind_parameter_index()] API if desired.  ^The index
** for "?NNN" parameters is the value of NNN.
** ^The NNN value must be between 1 and the [sqlite3_limit()]
** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 999).
**
** ^The third argument is the value to bind to the parameter.
**
** ^(In those routines that have a fourth argument, its value is the
** number of bytes in the parameter.  To be clear: the value is the
** number of <u>bytes</u> in the value, not the number of characters.)^
** ^If the fourth parameter is negative, the length of the string is
** the number of bytes up to the first zero terminator.
**
** ^The fifth argument to sqlite3_bind_blob(), sqlite3_bind_text(), and
** sqlite3_bind_text16() is a destructor used to dispose of the BLOB or
** string after SQLite has finished with it. ^If the fifth argument is
** the special value [SQLITE_STATIC], then SQLite assumes that the
** information is in static, unmanaged space and does not need to be freed.
** ^If the fifth argument has the value [SQLITE_TRANSIENT], then
** SQLite makes its own private copy of the data immediately, before
** the sqlite3_bind_*() routine returns.
**
** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that
** is filled with zeroes.  ^A zeroblob uses a fixed amount of memory
** (just an integer to hold its size) while it is being processed.
** Zeroblobs are intended to serve as placeholders for BLOBs whose
** content is later written using
** [sqlite3_blob_open | incremental BLOB I/O] routines.
** ^A negative value for the zeroblob results in a zero-length BLOB.
**
** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer
** for the [prepared statement] or with a prepared statement for which
** [sqlite3_step()] has been called more recently than [sqlite3_reset()],
** then the call will return [SQLITE_MISUSE].  If any sqlite3_bind_()
** routine is passed a [prepared statement] that has been finalized, the
** result is undefined and probably harmful.
**
** ^Bindings are not cleared by the [sqlite3_reset()] routine.
** ^Unbound parameters are interpreted as NULL.
**
** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an
** [error code] if anything goes wrong.
** ^[SQLITE_RANGE] is returned if the parameter
** index is out of range.  ^[SQLITE_NOMEM] is returned if malloc() fails.
**
** See also: [sqlite3_bind_parameter_count()],
** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()].
*/
SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double);
SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int);
SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int);
SQLITE_API int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*));
SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);

/*
** CAPI3REF: Number Of SQL Parameters
**
** ^This routine can be used to find the number of [SQL parameters]
** in a [prepared statement].  SQL parameters are tokens of the
** form "?", "?NNN", ":AAA", "$AAA", or "@AAA" that serve as
** placeholders for values that are [sqlite3_bind_blob | bound]
** to the parameters at a later time.
**
** ^(This routine actually returns the index of the largest (rightmost)
** parameter. For all forms except ?NNN, this will correspond to the
** number of unique parameters.  If parameters of the ?NNN form are used,
** there may be gaps in the list.)^
**
** See also: [sqlite3_bind_blob|sqlite3_bind()],
** [sqlite3_bind_parameter_name()], and
** [sqlite3_bind_parameter_index()].
*/
SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*);

/*
** CAPI3REF: Name Of A Host Parameter
**
** ^The sqlite3_bind_parameter_name(P,N) interface returns
** the name of the N-th [SQL parameter] in the [prepared statement] P.
** ^(SQL parameters of the form "?NNN" or ":AAA" or "@AAA" or "$AAA"
** have a name which is the string "?NNN" or ":AAA" or "@AAA" or "$AAA"
** respectively.
** In other words, the initial ":" or "$" or "@" or "?"
** is included as part of the name.)^
** ^Parameters of the form "?" without a following integer have no name
** and are referred to as "nameless" or "anonymous parameters".
**
** ^The first host parameter has an index of 1, not 0.
**
** ^If the value N is out of range or if the N-th parameter is
** nameless, then NULL is returned.  ^The returned string is
** always in UTF-8 encoding even if the named parameter was
** originally specified as UTF-16 in [sqlite3_prepare16()] or
** [sqlite3_prepare16_v2()].
**
** See also: [sqlite3_bind_blob|sqlite3_bind()],
** [sqlite3_bind_parameter_count()], and
** [sqlite3_bind_parameter_index()].
*/
SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);

/*
** CAPI3REF: Index Of A Parameter With A Given Name
**
** ^Return the index of an SQL parameter given its name.  ^The
** index value returned is suitable for use as the second
** parameter to [sqlite3_bind_blob|sqlite3_bind()].  ^A zero
** is returned if no matching parameter is found.  ^The parameter
** name must be given in UTF-8 even if the original statement
** was prepared from UTF-16 text using [sqlite3_prepare16_v2()].
**
** See also: [sqlite3_bind_blob|sqlite3_bind()],
** [sqlite3_bind_parameter_count()], and
** [sqlite3_bind_parameter_index()].
*/
SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName);

/*
** CAPI3REF: Reset All Bindings On A Prepared Statement
**
** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset
** the [sqlite3_bind_blob | bindings] on a [prepared statement].
** ^Use this routine to reset all host parameters to NULL.
*/
SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*);

/*
** CAPI3REF: Number Of Columns In A Result Set
**
** ^Return the number of columns in the result set returned by the
** [prepared statement]. ^This routine returns 0 if pStmt is an SQL
** statement that does not return data (for example an [UPDATE]).
*/
SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt);

/*
** CAPI3REF: Column Names In A Result Set
**
** ^These routines return the name assigned to a particular column
** in the result set of a [SELECT] statement.  ^The sqlite3_column_name()
** interface returns a pointer to a zero-terminated UTF-8 string
** and sqlite3_column_name16() returns a pointer to a zero-terminated
** UTF-16 string.  ^The first parameter is the [prepared statement]
** that implements the [SELECT] statement. ^The second parameter is the
** column number.  ^The leftmost column is number 0.
**
** ^The returned string pointer is valid until either the [prepared statement]
** is destroyed by [sqlite3_finalize()] or until the next call to
** sqlite3_column_name() or sqlite3_column_name16() on the same column.
**
** ^If sqlite3_malloc() fails during the processing of either routine
** (for example during a conversion from UTF-8 to UTF-16) then a
** NULL pointer is returned.
**
** ^The name of a result column is the value of the "AS" clause for
** that column, if there is an AS clause.  If there is no AS clause
** then the name of the column is unspecified and may change from
** one release of SQLite to the next.
*/
SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N);
SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N);

/*
** CAPI3REF: Source Of Data In A Query Result
**
** ^These routines provide a means to determine the database, table, and
** table column that is the origin of a particular result column in
** [SELECT] statement.
** ^The name of the database or table or column can be returned as
** either a UTF-8 or UTF-16 string.  ^The _database_ routines return
** the database name, the _table_ routines return the table name, and
** the origin_ routines return the column name.
** ^The returned string is valid until the [prepared statement] is destroyed
** using [sqlite3_finalize()] or until the same information is requested
** again in a different encoding.
**
** ^The names returned are the original un-aliased names of the
** database, table, and column.
**
** ^The first argument to these interfaces is a [prepared statement].
** ^These functions return information about the Nth result column returned by
** the statement, where N is the second function argument.
** ^The left-most column is column 0 for these routines.
**
** ^If the Nth column returned by the statement is an expression or
** subquery and is not a column value, then all of these functions return
** NULL.  ^These routine might also return NULL if a memory allocation error
** occurs.  ^Otherwise, they return the name of the attached database, table,
** or column that query result column was extracted from.
**
** ^As with all other SQLite APIs, those whose names end with "16" return
** UTF-16 encoded strings and the other functions return UTF-8.
**
** ^These APIs are only available if the library was compiled with the
** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol.
**
** If two or more threads call one or more of these routines against the same
** prepared statement and column at the same time then the results are
** undefined.
**
** If two or more threads call one or more
** [sqlite3_column_database_name | column metadata interfaces]
** for the same [prepared statement] and result column
** at the same time then the results are undefined.
*/
SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int);
SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int);
SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int);
SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int);
SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int);
SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int);

/*
** CAPI3REF: Declared Datatype Of A Query Result
**
** ^(The first parameter is a [prepared statement].
** If this statement is a [SELECT] statement and the Nth column of the
** returned result set of that [SELECT] is a table column (not an
** expression or subquery) then the declared type of the table
** column is returned.)^  ^If the Nth column of the result set is an
** expression or subquery, then a NULL pointer is returned.
** ^The returned string is always UTF-8 encoded.
**
** ^(For example, given the database schema:
**
** CREATE TABLE t1(c1 VARIANT);
**
** and the following statement to be compiled:
**
** SELECT c1 + 1, c1 FROM t1;
**
** this routine would return the string "VARIANT" for the second result
** column (i==1), and a NULL pointer for the first result column (i==0).)^
**
** ^SQLite uses dynamic run-time typing.  ^So just because a column
** is declared to contain a particular type does not mean that the
** data stored in that column is of the declared type.  SQLite is
** strongly typed, but the typing is dynamic not static.  ^Type
** is associated with individual values, not with the containers
** used to hold those values.
*/
SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int);
SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);

/*
** CAPI3REF: Evaluate An SQL Statement
**
** After a [prepared statement] has been prepared using either
** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy
** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function
** must be called one or more times to evaluate the statement.
**
** The details of the behavior of the sqlite3_step() interface depend
** on whether the statement was prepared using the newer "v2" interface
** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy
** interface [sqlite3_prepare()] and [sqlite3_prepare16()].  The use of the
** new "v2" interface is recommended for new applications but the legacy
** interface will continue to be supported.
**
** ^In the legacy interface, the return value will be either [SQLITE_BUSY],
** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE].
** ^With the "v2" interface, any of the other [result codes] or
** [extended result codes] might be returned as well.
**
** ^[SQLITE_BUSY] means that the database engine was unable to acquire the
** database locks it needs to do its job.  ^If the statement is a [COMMIT]
** or occurs outside of an explicit transaction, then you can retry the
** statement.  If the statement is not a [COMMIT] and occurs within a
** explicit transaction then you should rollback the transaction before
** continuing.
**
** ^[SQLITE_DONE] means that the statement has finished executing
** successfully.  sqlite3_step() should not be called again on this virtual
** machine without first calling [sqlite3_reset()] to reset the virtual
** machine back to its initial state.
**
** ^If the SQL statement being executed returns any data, then [SQLITE_ROW]
** is returned each time a new row of data is ready for processing by the
** caller. The values may be accessed using the [column access functions].
** sqlite3_step() is called again to retrieve the next row of data.
**
** ^[SQLITE_ERROR] means that a run-time error (such as a constraint
** violation) has occurred.  sqlite3_step() should not be called again on
** the VM. More information may be found by calling [sqlite3_errmsg()].
** ^With the legacy interface, a more specific error code (for example,
** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth)
** can be obtained by calling [sqlite3_reset()] on the
** [prepared statement].  ^In the "v2" interface,
** the more specific error code is returned directly by sqlite3_step().
**
** [SQLITE_MISUSE] means that the this routine was called inappropriately.
** Perhaps it was called on a [prepared statement] that has
** already been [sqlite3_finalize | finalized] or on one that had
** previously returned [SQLITE_ERROR] or [SQLITE_DONE].  Or it could
** be the case that the same database connection is being used by two or
** more threads at the same moment in time.
**
** For all versions of SQLite up to and including 3.6.23.1, it was required
** after sqlite3_step() returned anything other than [SQLITE_ROW] that
** [sqlite3_reset()] be called before any subsequent invocation of
** sqlite3_step().  Failure to invoke [sqlite3_reset()] in this way would
** result in an [SQLITE_MISUSE] return from sqlite3_step().  But after
** version 3.6.23.1, sqlite3_step() began calling [sqlite3_reset()] 
** automatically in this circumstance rather than returning [SQLITE_MISUSE].  
**
** <b>Goofy Interface Alert:</b> In the legacy interface, the sqlite3_step()
** API always returns a generic error code, [SQLITE_ERROR], following any
** error other than [SQLITE_BUSY] and [SQLITE_MISUSE].  You must call
** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the
** specific [error codes] that better describes the error.
** We admit that this is a goofy design.  The problem has been fixed
** with the "v2" interface.  If you prepare all of your SQL statements
** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead
** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,
** then the more specific [error codes] are returned directly
** by sqlite3_step().  The use of the "v2" interface is recommended.
*/
SQLITE_API int sqlite3_step(sqlite3_stmt*);

/*
** CAPI3REF: Number of columns in a result set
**
** ^The sqlite3_data_count(P) the number of columns in the
** of the result set of [prepared statement] P.
*/
SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);

/*
** CAPI3REF: Fundamental Datatypes
** KEYWORDS: SQLITE_TEXT
**
** ^(Every value in SQLite has one of five fundamental datatypes:
**
** <ul>
** <li> 64-bit signed integer
** <li> 64-bit IEEE floating point number
** <li> string
** <li> BLOB
** <li> NULL
** </ul>)^
**
** These constants are codes for each of those types.
**
** Note that the SQLITE_TEXT constant was also used in SQLite version 2
** for a completely different meaning.  Software that links against both
** SQLite version 2 and SQLite version 3 should use SQLITE3_TEXT, not
** SQLITE_TEXT.
*/
#define SQLITE_INTEGER  1
#define SQLITE_FLOAT    2
#define SQLITE_BLOB     4
#define SQLITE_NULL     5
#ifdef SQLITE_TEXT
# undef SQLITE_TEXT
#else
# define SQLITE_TEXT     3
#endif
#define SQLITE3_TEXT     3

/*
** CAPI3REF: Result Values From A Query
** KEYWORDS: {column access functions}
**
** These routines form the "result set" interface.
**
** ^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
** [sqlite3_finalize()] or after [sqlite3_step()] has returned
** something other than [SQLITE_ROW], the results are undefined.
** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()]
** are called from a different thread while any of these routines
** are pending, then the results are undefined.
**
** ^The sqlite3_column_type() routine returns the
** [SQLITE_INTEGER | datatype code] for the initial data type
** of the result column.  ^The returned value is one of [SQLITE_INTEGER],
** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].  The value
** returned by sqlite3_column_type() is only meaningful if no type
** conversions have occurred as described below.  After a type conversion,
** the value returned by sqlite3_column_type() is undefined.  Future
** versions of SQLite may change the behavior of sqlite3_column_type()
** following a type conversion.
**
** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()
** routine returns the number of bytes in that BLOB or string.
** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts
** the string to UTF-8 and then returns the number of bytes.
** ^If the result is a numeric value then sqlite3_column_bytes() uses
** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns
** the number of bytes in that string.
** ^The value returned does not include the zero terminator at the end
** of the string.  ^For clarity: the value returned is the number of
** bytes in the string, not the number of characters.
**
** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(),
** even empty strings, are always zero terminated.  ^The return
** value from sqlite3_column_blob() for a zero-length BLOB is an arbitrary
** pointer, possibly even a NULL pointer.
**
** ^The sqlite3_column_bytes16() routine is similar to sqlite3_column_bytes()
** but leaves the result in UTF-16 in native byte order instead of UTF-8.
** ^The zero terminator is not included in this count.
**
** ^The object returned by [sqlite3_column_value()] is an
** [unprotected sqlite3_value] object.  An unprotected sqlite3_value object
** may only be used with [sqlite3_bind_value()] and [sqlite3_result_value()].
** If the [unprotected sqlite3_value] object returned by
** [sqlite3_column_value()] is used in any other way, including calls
** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
** or [sqlite3_value_bytes()], then the behavior is undefined.
**
** These routines attempt to convert the value where appropriate.  ^For
** example, if the internal representation is FLOAT and a text result
** is requested, [sqlite3_snprintf()] is used internally to perform the
** conversion automatically.  ^(The following table details the conversions
** that are applied:
**
** <blockquote>
** <table border="1">
** <tr><th> Internal<br>Type <th> Requested<br>Type <th>  Conversion
**
** <tr><td>  NULL    <td> INTEGER   <td> Result is 0
** <tr><td>  NULL    <td>  FLOAT    <td> Result is 0.0
** <tr><td>  NULL    <td>   TEXT    <td> Result is NULL pointer
** <tr><td>  NULL    <td>   BLOB    <td> Result is NULL pointer
** <tr><td> INTEGER  <td>  FLOAT    <td> Convert from integer to float
** <tr><td> INTEGER  <td>   TEXT    <td> ASCII rendering of the integer
** <tr><td> INTEGER  <td>   BLOB    <td> Same as INTEGER->TEXT
** <tr><td>  FLOAT   <td> INTEGER   <td> Convert from float to integer
** <tr><td>  FLOAT   <td>   TEXT    <td> ASCII rendering of the float
** <tr><td>  FLOAT   <td>   BLOB    <td> Same as FLOAT->TEXT
** <tr><td>  TEXT    <td> INTEGER   <td> Use atoi()
** <tr><td>  TEXT    <td>  FLOAT    <td> Use atof()
** <tr><td>  TEXT    <td>   BLOB    <td> No change
** <tr><td>  BLOB    <td> INTEGER   <td> Convert to TEXT then use atoi()
** <tr><td>  BLOB    <td>  FLOAT    <td> Convert to TEXT then use atof()
** <tr><td>  BLOB    <td>   TEXT    <td> Add a zero terminator if needed
** </table>
** </blockquote>)^
**
** The table above makes reference to standard C library functions atoi()
** and atof().  SQLite does not really use these functions.  It has its
** own equivalent internal routines.  The atoi() and atof() names are
** used in the table for brevity and because they are familiar to most
** C programmers.
**
** ^Note that when type conversions occur, pointers returned by prior
** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or
** sqlite3_column_text16() may be invalidated.
** ^(Type conversions and pointer invalidations might occur
** in the following cases:
**
** <ul>
** <li> The initial content is a BLOB and sqlite3_column_text() or
**      sqlite3_column_text16() is called.  A zero-terminator might
**      need to be added to the string.</li>
** <li> The initial content is UTF-8 text and sqlite3_column_bytes16() or
**      sqlite3_column_text16() is called.  The content must be converted
**      to UTF-16.</li>
** <li> The initial content is UTF-16 text and sqlite3_column_bytes() or
**      sqlite3_column_text() is called.  The content must be converted
**      to UTF-8.</li>
** </ul>)^
**
** ^Conversions between UTF-16be and UTF-16le are always done in place and do
** not invalidate a prior pointer, though of course the content of the buffer
** that the prior pointer points to will have been modified.  Other kinds
** of conversion are done in place when it is possible, but sometimes they
** are not possible and in those cases prior pointers are invalidated.
**
** ^(The safest and easiest to remember policy is to invoke these routines
** in one of the following ways:
**
** <ul>
**  <li>sqlite3_column_text() followed by sqlite3_column_bytes()</li>
**  <li>sqlite3_column_blob() followed by sqlite3_column_bytes()</li>
**  <li>sqlite3_column_text16() followed by sqlite3_column_bytes16()</li>
** </ul>)^
**
** In other words, you should call sqlite3_column_text(),
** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result
** into the desired format, then invoke sqlite3_column_bytes() or
** sqlite3_column_bytes16() to find the size of the result.  Do not mix calls
** to sqlite3_column_text() or sqlite3_column_blob() with calls to
** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16()
** with calls to sqlite3_column_bytes().
**
** ^The pointers returned are valid until a type conversion occurs as
** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
** [sqlite3_finalize()] is called.  ^The memory space used to hold strings
** and BLOBs is freed automatically.  Do <b>not</b> pass the pointers returned
** [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
** [sqlite3_free()].
**
** ^(If a memory allocation error occurs during the evaluation of any
** of these routines, a default value is returned.  The default value
** is either the integer 0, the floating point number 0.0, or a NULL
** pointer.  Subsequent calls to [sqlite3_errcode()] will return
** [SQLITE_NOMEM].)^
*/
SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);

/*
** CAPI3REF: Destroy A Prepared Statement Object
**
** ^The sqlite3_finalize() function is called to delete a [prepared statement].
** ^If the statement was executed successfully or not executed at all, then
** SQLITE_OK is returned. ^If execution of the statement failed then an
** [error code] or [extended error code] is returned.
**
** ^This routine can be called at any point during the execution of the
** [prepared statement].  ^If the virtual machine has not
** completed execution when this routine is called, that is like
** encountering an error or an [sqlite3_interrupt | interrupt].
** ^Incomplete updates may be rolled back and transactions canceled,
** depending on the circumstances, and the
** [error code] returned will be [SQLITE_ABORT].
*/
SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt);

/*
** CAPI3REF: Reset A Prepared Statement Object
**
** The sqlite3_reset() function is called to reset a [prepared statement]
** object back to its initial state, ready to be re-executed.
** ^Any SQL statement variables that had values bound to them using
** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values.
** Use [sqlite3_clear_bindings()] to reset the bindings.
**
** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S
** back to the beginning of its program.
**
** ^If the most recent call to [sqlite3_step(S)] for the
** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE],
** or if [sqlite3_step(S)] has never before been called on S,
** then [sqlite3_reset(S)] returns [SQLITE_OK].
**
** ^If the most recent call to [sqlite3_step(S)] for the
** [prepared statement] S indicated an error, then
** [sqlite3_reset(S)] returns an appropriate [error code].
**
** ^The [sqlite3_reset(S)] interface does not change the values
** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S.
*/
SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt);

/*
** CAPI3REF: Create Or Redefine SQL Functions
** KEYWORDS: {function creation routines}
** KEYWORDS: {application-defined SQL function}
** KEYWORDS: {application-defined SQL functions}
**
** ^These two functions (collectively known as "function creation routines")
** are used to add SQL functions or aggregates or to redefine the behavior
** of existing SQL functions or aggregates.  The only difference between the
** two is that the second parameter, the name of the (scalar) function or
** aggregate, is encoded in UTF-8 for sqlite3_create_function() and UTF-16
** for sqlite3_create_function16().
**
** ^The first parameter is the [database connection] to which the SQL
** function is to be added.  ^If an application uses more than one database
** connection then application-defined SQL functions must be added
** to each database connection separately.
**
** The second parameter is the name of the SQL function to be created or
** redefined.  ^The length of the name is limited to 255 bytes, exclusive of
** the zero-terminator.  Note that the name length limit is in bytes, not
** characters.  ^Any attempt to create a function with a longer name
** will result in [SQLITE_ERROR] being returned.
**
** ^The third parameter (nArg)
** is the number of arguments that the SQL function or
** aggregate takes. ^If this parameter is -1, then the SQL function or
** aggregate may take any number of arguments between 0 and the limit
** set by [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]).  If the third
** parameter is less than -1 or greater than 127 then the behavior is
** undefined.
**
** The fourth parameter, eTextRep, specifies what
** [SQLITE_UTF8 | text encoding] this SQL function prefers for
** its parameters.  Any SQL function implementation should be able to work
** work with UTF-8, UTF-16le, or UTF-16be.  But some implementations may be
** more efficient with one encoding than another.  ^An application may
** invoke sqlite3_create_function() or sqlite3_create_function16() multiple
** times with the same function but with different values of eTextRep.
** ^When multiple implementations of the same function are available, SQLite
** will pick the one that involves the least amount of data conversion.
** If there is only a single implementation which does not care what text
** encoding is used, then the fourth argument should be [SQLITE_ANY].
**
** ^(The fifth parameter is an arbitrary pointer.  The implementation of the
** function can gain access to this pointer using [sqlite3_user_data()].)^
**
** The seventh, eighth and ninth parameters, xFunc, xStep and xFinal, are
** pointers to C-language functions that implement the SQL function or
** aggregate. ^A scalar SQL function requires an implementation of the xFunc
** callback only; NULL pointers should be passed as the xStep and xFinal
** parameters. ^An aggregate SQL function requires an implementation of xStep
** and xFinal and NULL should be passed for xFunc. ^To delete an existing
** SQL function or aggregate, pass NULL for all three function callbacks.
**
** ^It is permitted to register multiple implementations of the same
** functions with the same name but with either differing numbers of
** arguments or differing preferred text encodings.  ^SQLite will use
** the implementation that most closely matches the way in which the
** SQL function is used.  ^A function implementation with a non-negative
** nArg parameter is a better match than a function implementation with
** a negative nArg.  ^A function where the preferred text encoding
** matches the database encoding is a better
** match than a function where the encoding is different.  
** ^A function where the encoding difference is between UTF16le and UTF16be
** is a closer match than a function where the encoding difference is
** between UTF8 and UTF16.
**
** ^Built-in functions may be overloaded by new application-defined functions.
** ^The first application-defined function with a given name overrides all
** built-in functions in the same [database connection] with the same name.
** ^Subsequent application-defined functions of the same name only override 
** prior application-defined functions that are an exact match for the
** number of parameters and preferred encoding.
**
** ^An application-defined function is permitted to call other
** SQLite interfaces.  However, such calls must not
** close the database connection nor finalize or reset the prepared
** statement in which the function is running.
*/
SQLITE_API int sqlite3_create_function(
  sqlite3 *db,
  const char *zFunctionName,
  int nArg,
  int eTextRep,
  void *pApp,
  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
  void (*xFinal)(sqlite3_context*)
);
SQLITE_API int sqlite3_create_function16(
  sqlite3 *db,
  const void *zFunctionName,
  int nArg,
  int eTextRep,
  void *pApp,
  void (*xFunc)(sqlite3_context*,int,sqlite3_value**),
  void (*xStep)(sqlite3_context*,int,sqlite3_value**),
  void (*xFinal)(sqlite3_context*)
);

/*
** CAPI3REF: Text Encodings
**
** These constant define integer codes that represent the various
** text encodings supported by SQLite.
*/
#define SQLITE_UTF8           1
#define SQLITE_UTF16LE        2
#define SQLITE_UTF16BE        3
#define SQLITE_UTF16          4    /* Use native byte order */
#define SQLITE_ANY            5    /* sqlite3_create_function only */
#define SQLITE_UTF16_ALIGNED  8    /* sqlite3_create_collation only */

/*
** CAPI3REF: Deprecated Functions
** DEPRECATED
**
** These functions are [deprecated].  In order to maintain
** backwards compatibility with older code, these functions continue 
** to be supported.  However, new applications should avoid
** the use of these functions.  To help encourage people to avoid
** using these functions, we are not going to tell you what they do.
*/
#ifndef SQLITE_OMIT_DEPRECATED
SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*);
SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*);
SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*);
SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void);
SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void);
SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int),void*,sqlite3_int64);
#endif

/*
** CAPI3REF: Obtaining SQL Function Parameter Values
**
** The C-language implementation of SQL functions and aggregates uses
** this set of interface routines to access the parameter values on
** the function or aggregate.
**
** The xFunc (for scalar functions) or xStep (for aggregates) parameters
** to [sqlite3_create_function()] and [sqlite3_create_function16()]
** define callbacks that implement the SQL functions and aggregates.
** The 4th parameter to these callbacks is an array of pointers to
** [protected sqlite3_value] objects.  There is one [sqlite3_value] object for
** each parameter to the SQL function.  These routines are used to
** extract values from the [sqlite3_value] objects.
**
** These routines work only with [protected sqlite3_value] objects.
** Any attempt to use these routines on an [unprotected sqlite3_value]
** object results in undefined behavior.
**
** ^These routines work just like the corresponding [column access functions]
** except that  these routines take a single [protected sqlite3_value] object
** pointer instead of a [sqlite3_stmt*] pointer and an integer column number.
**
** ^The sqlite3_value_text16() interface extracts a UTF-16 string
** in the native byte-order of the host machine.  ^The
** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces
** extract UTF-16 strings as big-endian and little-endian respectively.
**
** ^(The sqlite3_value_numeric_type() interface attempts to apply
** numeric affinity to the value.  This means that an attempt is
** made to convert the value to an integer or floating point.  If
** such a conversion is possible without loss of information (in other
** words, if the value is a string that looks like a number)
** then the conversion is performed.  Otherwise no conversion occurs.
** The [SQLITE_INTEGER | datatype] after conversion is returned.)^
**
** Please pay particular attention to the fact that the pointer returned
** from [sqlite3_value_blob()], [sqlite3_value_text()], or
** [sqlite3_value_text16()] can be invalidated by a subsequent call to
** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()],
** or [sqlite3_value_text16()].
**
** These routines must be called from the same thread as
** the SQL function that supplied the [sqlite3_value*] parameters.
*/
SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
SQLITE_API double sqlite3_value_double(sqlite3_value*);
SQLITE_API int sqlite3_value_int(sqlite3_value*);
SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
SQLITE_API int sqlite3_value_type(sqlite3_value*);
SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);

/*
** CAPI3REF: Obtain Aggregate Function Context
**
** Implementions of aggregate SQL functions use this
** routine to allocate memory for storing their state.
**
** ^The first time the sqlite3_aggregate_context(C,N) routine is called 
** for a particular aggregate function, SQLite
** allocates N of memory, zeroes out that memory, and returns a pointer
** to the new memory. ^On second and subsequent calls to
** sqlite3_aggregate_context() for the same aggregate function instance,
** the same buffer is returned.  Sqlite3_aggregate_context() is normally
** called once for each invocation of the xStep callback and then one
** last time when the xFinal callback is invoked.  ^(When no rows match
** an aggregate query, the xStep() callback of the aggregate function
** implementation is never called and xFinal() is called exactly once.
** In those cases, sqlite3_aggregate_context() might be called for the
** first time from within xFinal().)^
**
** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer if N is
** less than or equal to zero or if a memory allocate error occurs.
**
** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is
** determined by the N parameter on first successful call.  Changing the
** value of N in subsequent call to sqlite3_aggregate_context() within
** the same aggregate function instance will not resize the memory
** allocation.)^
**
** ^SQLite automatically frees the memory allocated by 
** sqlite3_aggregate_context() when the aggregate query concludes.
**
** The first parameter must be a copy of the
** [sqlite3_context | SQL function context] that is the first parameter
** to the xStep or xFinal callback routine that implements the aggregate
** function.
**
** This routine must be called from the same thread in which
** the aggregate SQL function is running.
*/
SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes);

/*
** CAPI3REF: User Data For Functions
**
** ^The sqlite3_user_data() interface returns a copy of
** the pointer that was the pUserData parameter (the 5th parameter)
** of the [sqlite3_create_function()]
** and [sqlite3_create_function16()] routines that originally
** registered the application defined function.
**
** This routine must be called from the same thread in which
** the application-defined function is running.
*/
SQLITE_API void *sqlite3_user_data(sqlite3_context*);

/*
** CAPI3REF: Database Connection For Functions
**
** ^The sqlite3_context_db_handle() interface returns a copy of
** the pointer to the [database connection] (the 1st parameter)
** of the [sqlite3_create_function()]
** and [sqlite3_create_function16()] routines that originally
** registered the application defined function.
*/
SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*);

/*
** CAPI3REF: Function Auxiliary Data
**
** The following two functions may be used by scalar SQL functions to
** associate metadata with argument values. If the same value is passed to
** multiple invocations of the same SQL function during query execution, under
** some circumstances the associated metadata may be preserved. This may
** be used, for example, to add a regular-expression matching scalar
** function. The compiled version of the regular expression is stored as
** metadata associated with the SQL value passed as the regular expression
** pattern.  The compiled regular expression can be reused on multiple
** invocations of the same function so that the original pattern string
** does not need to be recompiled on each invocation.
**
** ^The sqlite3_get_auxdata() interface returns a pointer to the metadata
** associated by the sqlite3_set_auxdata() function with the Nth argument
** value to the application-defined function. ^If no metadata has been ever
** been set for the Nth argument of the function, or if the corresponding
** function parameter has changed since the meta-data was set,
** then sqlite3_get_auxdata() returns a NULL pointer.
**
** ^The sqlite3_set_auxdata() interface saves the metadata
** pointed to by its 3rd parameter as the metadata for the N-th
** argument of the application-defined function.  Subsequent
** calls to sqlite3_get_auxdata() might return this data, if it has
** not been destroyed.
** ^If it is not NULL, SQLite will invoke the destructor
** function given by the 4th parameter to sqlite3_set_auxdata() on
** the metadata when the corresponding function parameter changes
** or when the SQL statement completes, whichever comes first.
**
** SQLite is free to call the destructor and drop metadata on any
** parameter of any function at any time.  ^The only guarantee is that
** the destructor will be called before the metadata is dropped.
**
** ^(In practice, metadata is preserved between function calls for
** expressions that are constant at compile time. This includes literal
** values and [parameters].)^
**
** These routines must be called from the same thread in which
** the SQL function is running.
*/
SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N);
SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*));


/*
** CAPI3REF: Constants Defining Special Destructor Behavior
**
** These are special values for the destructor that is passed in as the
** final argument to routines like [sqlite3_result_blob()].  ^If the destructor
** argument is SQLITE_STATIC, it means that the content pointer is constant
** and will never change.  It does not need to be destroyed.  ^The
** SQLITE_TRANSIENT value means that the content will likely change in
** the near future and that SQLite should make its own private copy of
** the content before returning.
**
** The typedef is necessary to work around problems in certain
** C++ compilers.  See ticket #2191.
*/
typedef void (*sqlite3_destructor_type)(void*);
#define SQLITE_STATIC      ((sqlite3_destructor_type)0)
#define SQLITE_TRANSIENT   ((sqlite3_destructor_type)-1)

/*
** CAPI3REF: Setting The Result Of An SQL Function
**
** These routines are used by the xFunc or xFinal callbacks that
** implement SQL functions and aggregates.  See
** [sqlite3_create_function()] and [sqlite3_create_function16()]
** for additional information.
**
** These functions work very much like the [parameter binding] family of
** functions used to bind values to host parameters in prepared statements.
** Refer to the [SQL parameter] documentation for additional information.
**
** ^The sqlite3_result_blob() interface sets the result from
** an application-defined function to be the BLOB whose content is pointed
** to by the second parameter and which is N bytes long where N is the
** third parameter.
**
** ^The sqlite3_result_zeroblob() interfaces set the result of
** the application-defined function to be a BLOB containing all zero
** bytes and N bytes in size, where N is the value of the 2nd parameter.
**
** ^The sqlite3_result_double() interface sets the result from
** an application-defined function to be a floating point value specified
** by its 2nd argument.
**
** ^The sqlite3_result_error() and sqlite3_result_error16() functions
** cause the implemented SQL function to throw an exception.
** ^SQLite uses the string pointed to by the
** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16()
** as the text of an error message.  ^SQLite interprets the error
** message string from sqlite3_result_error() as UTF-8. ^SQLite
** interprets the string from sqlite3_result_error16() as UTF-16 in native
** byte order.  ^If the third parameter to sqlite3_result_error()
** or sqlite3_result_error16() is negative then SQLite takes as the error
** message all text up through the first zero character.
** ^If the third parameter to sqlite3_result_error() or
** sqlite3_result_error16() is non-negative then SQLite takes that many
** bytes (not characters) from the 2nd parameter as the error message.
** ^The sqlite3_result_error() and sqlite3_result_error16()
** routines make a private copy of the error message text before
** they return.  Hence, the calling function can deallocate or
** modify the text after they return without harm.
** ^The sqlite3_result_error_code() function changes the error code
** returned by SQLite as a result of an error in a function.  ^By default,
** the error code is SQLITE_ERROR.  ^A subsequent call to sqlite3_result_error()
** or sqlite3_result_error16() resets the error code to SQLITE_ERROR.
**
** ^The sqlite3_result_toobig() interface causes SQLite to throw an error
** indicating that a string or BLOB is too long to represent.
**
** ^The sqlite3_result_nomem() interface causes SQLite to throw an error
** indicating that a memory allocation failed.
**
** ^The sqlite3_result_int() interface sets the return value
** of the application-defined function to be the 32-bit signed integer
** value given in the 2nd argument.
** ^The sqlite3_result_int64() interface sets the return value
** of the application-defined function to be the 64-bit signed integer
** value given in the 2nd argument.
**
** ^The sqlite3_result_null() interface sets the return value
** of the application-defined function to be NULL.
**
** ^The sqlite3_result_text(), sqlite3_result_text16(),
** sqlite3_result_text16le(), and sqlite3_result_text16be() interfaces
** set the return value of the application-defined function to be
** a text string which is represented as UTF-8, UTF-16 native byte order,
** UTF-16 little endian, or UTF-16 big endian, respectively.
** ^SQLite takes the text result from the application from
** the 2nd parameter of the sqlite3_result_text* interfaces.
** ^If the 3rd parameter to the sqlite3_result_text* interfaces
** is negative, then SQLite takes result text from the 2nd parameter
** through the first zero character.
** ^If the 3rd parameter to the sqlite3_result_text* interfaces
** is non-negative, then as many bytes (not characters) of the text
** pointed to by the 2nd parameter are taken as the application-defined
** function result.
** ^If the 4th parameter to the sqlite3_result_text* interfaces
** or sqlite3_result_blob is a non-NULL pointer, then SQLite calls that
** function as the destructor on the text or BLOB result when it has
** finished using that result.
** ^If the 4th parameter to the sqlite3_result_text* interfaces or to
** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite
** assumes that the text or BLOB result is in constant space and does not
** copy the content of the parameter nor call a destructor on the content
** when it has finished using that result.
** ^If the 4th parameter to the sqlite3_result_text* interfaces
** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT
** then SQLite makes a copy of the result into space obtained from
** from [sqlite3_malloc()] before it returns.
**
** ^The sqlite3_result_value() interface sets the result of
** the application-defined function to be a copy the
** [unprotected sqlite3_value] object specified by the 2nd parameter.  ^The
** sqlite3_result_value() interface makes a copy of the [sqlite3_value]
** so that the [sqlite3_value] specified in the parameter may change or
** be deallocated after sqlite3_result_value() returns without harm.
** ^A [protected sqlite3_value] object may always be used where an
** [unprotected sqlite3_value] object is required, so either
** kind of [sqlite3_value] object can be used with this interface.
**
** If these routines are called from within the different thread
** than the one containing the application-defined function that received
** the [sqlite3_context] pointer, the results are undefined.
*/
SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*));
SQLITE_API void sqlite3_result_double(sqlite3_context*, double);
SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int);
SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int);
SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*);
SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*);
SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int);
SQLITE_API void sqlite3_result_int(sqlite3_context*, int);
SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
SQLITE_API void sqlite3_result_null(sqlite3_context*);
SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);

/*
** CAPI3REF: Define New Collating Sequences
**
** These functions are used to add new collation sequences to the
** [database connection] specified as the first argument.
**
** ^The name of the new collation sequence is specified as a UTF-8 string
** for sqlite3_create_collation() and sqlite3_create_collation_v2()
** and a UTF-16 string for sqlite3_create_collation16(). ^In all cases
** the name is passed as the second function argument.
**
** ^The third argument may be one of the constants [SQLITE_UTF8],
** [SQLITE_UTF16LE], or [SQLITE_UTF16BE], indicating that the user-supplied
** routine expects to be passed pointers to strings encoded using UTF-8,
** UTF-16 little-endian, or UTF-16 big-endian, respectively. ^The
** third argument might also be [SQLITE_UTF16] to indicate that the routine
** expects pointers to be UTF-16 strings in the native byte order, or the
** argument can be [SQLITE_UTF16_ALIGNED] if the
** the routine expects pointers to 16-bit word aligned strings
** of UTF-16 in the native byte order.
**
** A pointer to the user supplied routine must be passed as the fifth
** argument.  ^If it is NULL, this is the same as deleting the collation
** sequence (so that SQLite cannot call it anymore).
** ^Each time the application supplied function is invoked, it is passed
** as its first parameter a copy of the void* passed as the fourth argument
** to sqlite3_create_collation() or sqlite3_create_collation16().
**
** ^The remaining arguments to the application-supplied routine are two strings,
** each represented by a (length, data) pair and encoded in the encoding
** that was passed as the third argument when the collation sequence was
** registered.  The application defined collation routine should
** return negative, zero or positive if the first string is less than,
** equal to, or greater than the second string. i.e. (STRING1 - STRING2).
**
** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation()
** except that it takes an extra argument which is a destructor for
** the collation.  ^The destructor is called when the collation is
** destroyed and is passed a copy of the fourth parameter void* pointer
** of the sqlite3_create_collation_v2().
** ^Collations are destroyed when they are overridden by later calls to the
** collation creation functions or when the [database connection] is closed
** using [sqlite3_close()].
**
** See also:  [sqlite3_collation_needed()] and [sqlite3_collation_needed16()].
*/
SQLITE_API int sqlite3_create_collation(
  sqlite3*, 
  const char *zName, 
  int eTextRep, 
  void*,
  int(*xCompare)(void*,int,const void*,int,const void*)
);
SQLITE_API int sqlite3_create_collation_v2(
  sqlite3*, 
  const char *zName, 
  int eTextRep, 
  void*,
  int(*xCompare)(void*,int,const void*,int,const void*),
  void(*xDestroy)(void*)
);
SQLITE_API int sqlite3_create_collation16(
  sqlite3*, 
  const void *zName,
  int eTextRep, 
  void*,
  int(*xCompare)(void*,int,const void*,int,const void*)
);

/*
** CAPI3REF: Collation Needed Callbacks
**
** ^To avoid having to register all collation sequences before a database
** can be used, a single callback function may be registered with the
** [database connection] to be invoked whenever an undefined collation
** sequence is required.
**
** ^If the function is registered using the sqlite3_collation_needed() API,
** then it is passed the names of undefined collation sequences as strings
** encoded in UTF-8. ^If sqlite3_collation_needed16() is used,
** the names are passed as UTF-16 in machine native byte order.
** ^A call to either function replaces the existing collation-needed callback.
**
** ^(When the callback is invoked, the first argument passed is a copy
** of the second argument to sqlite3_collation_needed() or
** sqlite3_collation_needed16().  The second argument is the database
** connection.  The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE],
** or [SQLITE_UTF16LE], indicating the most desirable form of the collation
** sequence function required.  The fourth parameter is the name of the
** required collation sequence.)^
**
** The callback function should register the desired collation using
** [sqlite3_create_collation()], [sqlite3_create_collation16()], or
** [sqlite3_create_collation_v2()].
*/
SQLITE_API int sqlite3_collation_needed(
  sqlite3*, 
  void*, 
  void(*)(void*,sqlite3*,int eTextRep,const char*)
);
SQLITE_API int sqlite3_collation_needed16(
  sqlite3*, 
  void*,
  void(*)(void*,sqlite3*,int eTextRep,const void*)
);

#ifdef SQLITE_HAS_CODEC
/*
** Specify the key for an encrypted database.  This routine should be
** called right after sqlite3_open().
**
** The code to implement this API is not available in the public release
** of SQLite.
*/
SQLITE_API int sqlite3_key(
  sqlite3 *db,                   /* Database to be rekeyed */
  const void *pKey, int nKey     /* The key */
);

/*
** Change the key on an open database.  If the current database is not
** encrypted, this routine will encrypt it.  If pNew==0 or nNew==0, the
** database is decrypted.
**
** The code to implement this API is not available in the public release
** of SQLite.
*/
SQLITE_API int sqlite3_rekey(
  sqlite3 *db,                   /* Database to be rekeyed */
  const void *pKey, int nKey     /* The new key */
);

/*
** Specify the activation key for a SEE database.  Unless 
** activated, none of the SEE routines will work.
*/
SQLITE_API void sqlite3_activate_see(
  const char *zPassPhrase        /* Activation phrase */
);
#endif

#ifdef SQLITE_ENABLE_CEROD
/*
** Specify the activation key for a CEROD database.  Unless 
** activated, none of the CEROD routines will work.
*/
SQLITE_API void sqlite3_activate_cerod(
  const char *zPassPhrase        /* Activation phrase */
);
#endif

/*
** CAPI3REF: Suspend Execution For A Short Time
**
** ^The sqlite3_sleep() function causes the current thread to suspend execution
** for at least a number of milliseconds specified in its parameter.
**
** ^If the operating system does not support sleep requests with
** millisecond time resolution, then the time will be rounded up to
** the nearest second. ^The number of milliseconds of sleep actually
** requested from the operating system is returned.
**
** ^SQLite implements this interface by calling the xSleep()
** method of the default [sqlite3_vfs] object.
*/
SQLITE_API int sqlite3_sleep(int);

/*
** CAPI3REF: Name Of The Folder Holding Temporary Files
**
** ^(If this global variable is made to point to a string which is
** the name of a folder (a.k.a. directory), then all temporary files
** created by SQLite when using a built-in [sqlite3_vfs | VFS]
** will be placed in that directory.)^  ^If this variable
** is a NULL pointer, then SQLite performs a search for an appropriate
** temporary file directory.
**
** It is not safe to read or modify this variable in more than one
** thread at a time.  It is not safe to read or modify this variable
** if a [database connection] is being used at the same time in a separate
** thread.
** It is intended that this variable be set once
** as part of process initialization and before any SQLite interface
** routines have been called and that this variable remain unchanged
** thereafter.
**
** ^The [temp_store_directory pragma] may modify this variable and cause
** it to point to memory obtained from [sqlite3_malloc].  ^Furthermore,
** the [temp_store_directory pragma] always assumes that any string
** that this variable points to is held in memory obtained from 
** [sqlite3_malloc] and the pragma may attempt to free that memory
** using [sqlite3_free].
** Hence, if this variable is modified directly, either it should be
** made NULL or made to point to memory obtained from [sqlite3_malloc]
** or else the use of the [temp_store_directory pragma] should be avoided.
*/
SQLITE_API SQLITE_EXTERN char *sqlite3_temp_directory;

/*
** CAPI3REF: Test For Auto-Commit Mode
** KEYWORDS: {autocommit mode}
**
** ^The sqlite3_get_autocommit() interface returns non-zero or
** zero if the given database connection is or is not in autocommit mode,
** respectively.  ^Autocommit mode is on by default.
** ^Autocommit mode is disabled by a [BEGIN] statement.
** ^Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK].
**
** If certain kinds of errors occur on a statement within a multi-statement
** transaction (errors including [SQLITE_FULL], [SQLITE_IOERR],
** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the
** transaction might be rolled back automatically.  The only way to
** find out whether SQLite automatically rolled back the transaction after
** an error is to use this function.
**
** If another thread changes the autocommit status of the database
** connection while this routine is running, then the return value
** is undefined.
*/
SQLITE_API int sqlite3_get_autocommit(sqlite3*);

/*
** CAPI3REF: Find The Database Handle Of A Prepared Statement
**
** ^The sqlite3_db_handle interface returns the [database connection] handle
** to which a [prepared statement] belongs.  ^The [database connection]
** returned by sqlite3_db_handle is the same [database connection]
** that was the first argument
** to the [sqlite3_prepare_v2()] call (or its variants) that was used to
** create the statement in the first place.
*/
SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*);

/*
** CAPI3REF: Find the next prepared statement
**
** ^This interface returns a pointer to the next [prepared statement] after
** pStmt associated with the [database connection] pDb.  ^If pStmt is NULL
** then this interface returns a pointer to the first prepared statement
** associated with the database connection pDb.  ^If no prepared statement
** satisfies the conditions of this routine, it returns NULL.
**
** The [database connection] pointer D in a call to
** [sqlite3_next_stmt(D,S)] must refer to an open database
** connection and in particular must not be a NULL pointer.
*/
SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt);

/*
** CAPI3REF: Commit And Rollback Notification Callbacks
**
** ^The sqlite3_commit_hook() interface registers a callback
** function to be invoked whenever a transaction is [COMMIT | committed].
** ^Any callback set by a previous call to sqlite3_commit_hook()
** for the same database connection is overridden.
** ^The sqlite3_rollback_hook() interface registers a callback
** function to be invoked whenever a transaction is [ROLLBACK | rolled back].
** ^Any callback set by a previous call to sqlite3_rollback_hook()
** for the same database connection is overridden.
** ^The pArg argument is passed through to the callback.
** ^If the callback on a commit hook function returns non-zero,
** then the commit is converted into a rollback.
**
** ^The sqlite3_commit_hook(D,C,P) and sqlite3_rollback_hook(D,C,P) functions
** return the P argument from the previous call of the same function
** on the same [database connection] D, or NULL for
** the first call for each function on D.
**
** The callback implementation must not do anything that will modify
** the database connection that invoked the callback.  Any actions
** to modify the database connection must be deferred until after the
** completion of the [sqlite3_step()] call that triggered the commit
** or rollback hook in the first place.
** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
** database connections for the meaning of "modify" in this paragraph.
**
** ^Registering a NULL function disables the callback.
**
** ^When the commit hook callback routine returns zero, the [COMMIT]
** operation is allowed to continue normally.  ^If the commit hook
** returns non-zero, then the [COMMIT] is converted into a [ROLLBACK].
** ^The rollback hook is invoked on a rollback that results from a commit
** hook returning non-zero, just as it would be with any other rollback.
**
** ^For the purposes of this API, a transaction is said to have been
** rolled back if an explicit "ROLLBACK" statement is executed, or
** an error or constraint causes an implicit rollback to occur.
** ^The rollback callback is not invoked if a transaction is
** automatically rolled back because the database connection is closed.
**
** See also the [sqlite3_update_hook()] interface.
*/
SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*);
SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*);

/*
** CAPI3REF: Data Change Notification Callbacks
**
** ^The sqlite3_update_hook() interface registers a callback function
** with the [database connection] identified by the first argument
** to be invoked whenever a row is updated, inserted or deleted.
** ^Any callback set by a previous call to this function
** for the same database connection is overridden.
**
** ^The second argument is a pointer to the function to invoke when a
** row is updated, inserted or deleted.
** ^The first argument to the callback is a copy of the third argument
** to sqlite3_update_hook().
** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE],
** or [SQLITE_UPDATE], depending on the operation that caused the callback
** to be invoked.
** ^The third and fourth arguments to the callback contain pointers to the
** database and table name containing the affected row.
** ^The final callback parameter is the [rowid] of the row.
** ^In the case of an update, this is the [rowid] after the update takes place.
**
** ^(The update hook is not invoked when internal system tables are
** modified (i.e. sqlite_master and sqlite_sequence).)^
**
** ^In the current implementation, the update hook
** is not invoked when duplication rows are deleted because of an
** [ON CONFLICT | ON CONFLICT REPLACE] clause.  ^Nor is the update hook
** invoked when rows are deleted using the [truncate optimization].
** The exceptions defined in this paragraph might change in a future
** release of SQLite.
**
** The update hook implementation must not do anything that will modify
** the database connection that invoked the update hook.  Any actions
** to modify the database connection must be deferred until after the
** completion of the [sqlite3_step()] call that triggered the update hook.
** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their
** database connections for the meaning of "modify" in this paragraph.
**
** ^The sqlite3_update_hook(D,C,P) function
** returns the P argument from the previous call
** on the same [database connection] D, or NULL for
** the first call on D.
**
** See also the [sqlite3_commit_hook()] and [sqlite3_rollback_hook()]
** interfaces.
*/
SQLITE_API void *sqlite3_update_hook(
  sqlite3*, 
  void(*)(void *,int ,char const *,char const *,sqlite3_int64),
  void*
);

/*
** CAPI3REF: Enable Or Disable Shared Pager Cache
** KEYWORDS: {shared cache}
**
** ^(This routine enables or disables the sharing of the database cache
** and schema data structures between [database connection | connections]
** to the same database. Sharing is enabled if the argument is true
** and disabled if the argument is false.)^
**
** ^Cache sharing is enabled and disabled for an entire process.
** This is a change as of SQLite version 3.5.0. In prior versions of SQLite,
** sharing was enabled or disabled for each thread separately.
**
** ^(The cache sharing mode set by this interface effects all subsequent
** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()].
** Existing database connections continue use the sharing mode
** that was in effect at the time they were opened.)^
**
** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled
** successfully.  An [error code] is returned otherwise.)^
**
** ^Shared cache is disabled by default. But this might change in
** future releases of SQLite.  Applications that care about shared
** cache setting should set it explicitly.
**
** See Also:  [SQLite Shared-Cache Mode]
*/
SQLITE_API int sqlite3_enable_shared_cache(int);

/*
** CAPI3REF: Attempt To Free Heap Memory
**
** ^The sqlite3_release_memory() interface attempts to free N bytes
** of heap memory by deallocating non-essential memory allocations
** held by the database library.   Memory used to cache database
** pages to improve performance is an example of non-essential memory.
** ^sqlite3_release_memory() returns the number of bytes actually freed,
** which might be more or less than the amount requested.
*/
SQLITE_API int sqlite3_release_memory(int);

/*
** CAPI3REF: Impose A Limit On Heap Size
**
** ^The sqlite3_soft_heap_limit() interface places a "soft" limit
** on the amount of heap memory that may be allocated by SQLite.
** ^If an internal allocation is requested that would exceed the
** soft heap limit, [sqlite3_release_memory()] is invoked one or
** more times to free up some space before the allocation is performed.
**
** ^The limit is called "soft" because if [sqlite3_release_memory()]
** cannot free sufficient memory to prevent the limit from being exceeded,
** the memory is allocated anyway and the current operation proceeds.
**
** ^A negative or zero value for N means that there is no soft heap limit and
** [sqlite3_release_memory()] will only be called when memory is exhausted.
** ^The default value for the soft heap limit is zero.
**
** ^(SQLite makes a best effort to honor the soft heap limit.
** But if the soft heap limit cannot be honored, execution will
** continue without error or notification.)^  This is why the limit is
** called a "soft" limit.  It is advisory only.
**
** Prior to SQLite version 3.5.0, this routine only constrained the memory
** allocated by a single thread - the same thread in which this routine
** runs.  Beginning with SQLite version 3.5.0, the soft heap limit is
** applied to all threads. The value specified for the soft heap limit
** is an upper bound on the total memory allocation for all threads. In
** version 3.5.0 there is no mechanism for limiting the heap usage for
** individual threads.
*/
SQLITE_API void sqlite3_soft_heap_limit(int);

/*
** CAPI3REF: Extract Metadata About A Column Of A Table
**
** ^This routine returns metadata about a specific column of a specific
** database table accessible using the [database connection] handle
** passed as the first function argument.
**
** ^The column is identified by the second, third and fourth parameters to
** this function. ^The second parameter is either the name of the database
** (i.e. "main", "temp", or an attached database) containing the specified
** table or NULL. ^If it is NULL, then all attached databases are searched
** for the table using the same algorithm used by the database engine to
** resolve unqualified table references.
**
** ^The third and fourth parameters to this function are the table and column
** name of the desired column, respectively. Neither of these parameters
** may be NULL.
**
** ^Metadata is returned by writing to the memory locations passed as the 5th
** and subsequent parameters to this function. ^Any of these arguments may be
** NULL, in which case the corresponding element of metadata is omitted.
**
** ^(<blockquote>
** <table border="1">
** <tr><th> Parameter <th> Output<br>Type <th>  Description
**
** <tr><td> 5th <td> const char* <td> Data type
** <tr><td> 6th <td> const char* <td> Name of default collation sequence
** <tr><td> 7th <td> int         <td> True if column has a NOT NULL constraint
** <tr><td> 8th <td> int         <td> True if column is part of the PRIMARY KEY
** <tr><td> 9th <td> int         <td> True if column is [AUTOINCREMENT]
** </table>
** </blockquote>)^
**
** ^The memory pointed to by the character pointers returned for the
** declaration type and collation sequence is valid only until the next
** call to any SQLite API function.
**
** ^If the specified table is actually a view, an [error code] is returned.
**
** ^If the specified column is "rowid", "oid" or "_rowid_" and an
** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output
** parameters are set for the explicitly declared column. ^(If there is no
** explicitly declared [INTEGER PRIMARY KEY] column, then the output
** parameters are set as follows:
**
** <pre>
**     data type: "INTEGER"
**     collation sequence: "BINARY"
**     not null: 0
**     primary key: 1
**     auto increment: 0
** </pre>)^
**
** ^(This function may load one or more schemas from database files. If an
** error occurs during this process, or if the requested table or column
** cannot be found, an [error code] is returned and an error message left
** in the [database connection] (to be retrieved using sqlite3_errmsg()).)^
**
** ^This API is only available if the library was compiled with the
** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol defined.
*/
SQLITE_API int sqlite3_table_column_metadata(
  sqlite3 *db,                /* Connection handle */
  const char *zDbName,        /* Database name or NULL */
  const char *zTableName,     /* Table name */
  const char *zColumnName,    /* Column name */
  char const **pzDataType,    /* OUTPUT: Declared data type */
  char const **pzCollSeq,     /* OUTPUT: Collation sequence name */
  int *pNotNull,              /* OUTPUT: True if NOT NULL constraint exists */
  int *pPrimaryKey,           /* OUTPUT: True if column part of PK */
  int *pAutoinc               /* OUTPUT: True if column is auto-increment */
);

/*
** CAPI3REF: Load An Extension
**
** ^This interface loads an SQLite extension library from the named file.
**
** ^The sqlite3_load_extension() interface attempts to load an
** SQLite extension library contained in the file zFile.
**
** ^The entry point is zProc.
** ^zProc may be 0, in which case the name of the entry point
** defaults to "sqlite3_extension_init".
** ^The sqlite3_load_extension() interface returns
** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong.
** ^If an error occurs and pzErrMsg is not 0, then the
** [sqlite3_load_extension()] interface shall attempt to
** fill *pzErrMsg with error message text stored in memory
** obtained from [sqlite3_malloc()]. The calling function
** should free this memory by calling [sqlite3_free()].
**
** ^Extension loading must be enabled using
** [sqlite3_enable_load_extension()] prior to calling this API,
** otherwise an error will be returned.
**
** See also the [load_extension() SQL function].
*/
SQLITE_API int sqlite3_load_extension(
  sqlite3 *db,          /* Load the extension into this database connection */
  const char *zFile,    /* Name of the shared library containing extension */
  const char *zProc,    /* Entry point.  Derived from zFile if 0 */
  char **pzErrMsg       /* Put error message here if not 0 */
);

/*
** CAPI3REF: Enable Or Disable Extension Loading
**
** ^So as not to open security holes in older applications that are
** unprepared to deal with extension loading, and as a means of disabling
** extension loading while evaluating user-entered SQL, the following API
** is provided to turn the [sqlite3_load_extension()] mechanism on and off.
**
** ^Extension loading is off by default. See ticket #1863.
** ^Call the sqlite3_enable_load_extension() routine with onoff==1
** to turn extension loading on and call it with onoff==0 to turn
** it back off again.
*/
SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff);

/*
** CAPI3REF: Automatically Load An Extensions
**
** ^This API can be invoked at program startup in order to register
** one or more statically linked extensions that will be available
** to all new [database connections].
**
** ^(This routine stores a pointer to the extension entry point
** in an array that is obtained from [sqlite3_malloc()].  That memory
** is deallocated by [sqlite3_reset_auto_extension()].)^
**
** ^This function registers an extension entry point that is
** automatically invoked whenever a new [database connection]
** is opened using [sqlite3_open()], [sqlite3_open16()],
** or [sqlite3_open_v2()].
** ^Duplicate extensions are detected so calling this routine
** multiple times with the same extension is harmless.
** ^Automatic extensions apply across all threads.
*/
SQLITE_API int sqlite3_auto_extension(void (*xEntryPoint)(void));

/*
** CAPI3REF: Reset Automatic Extension Loading
**
** ^(This function disables all previously registered automatic
** extensions. It undoes the effect of all prior
** [sqlite3_auto_extension()] calls.)^
**
** ^This function disables automatic extensions in all threads.
*/
SQLITE_API void sqlite3_reset_auto_extension(void);

/*
** The interface to the virtual-table mechanism is currently considered
** to be experimental.  The interface might change in incompatible ways.
** If this is a problem for you, do not use the interface at this time.
**
** When the virtual-table mechanism stabilizes, we will declare the
** interface fixed, support it indefinitely, and remove this comment.
*/

/*
** Structures used by the virtual table interface
*/
typedef struct sqlite3_vtab sqlite3_vtab;
typedef struct sqlite3_index_info sqlite3_index_info;
typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor;
typedef struct sqlite3_module sqlite3_module;

/*
** CAPI3REF: Virtual Table Object
** KEYWORDS: sqlite3_module {virtual table module}
**
** This structure, sometimes called a a "virtual table module", 
** defines the implementation of a [virtual tables].  
** This structure consists mostly of methods for the module.
**
** ^A virtual table module is created by filling in a persistent
** instance of this structure and passing a pointer to that instance
** to [sqlite3_create_module()] or [sqlite3_create_module_v2()].
** ^The registration remains valid until it is replaced by a different
** module or until the [database connection] closes.  The content
** of this structure must not change while it is registered with
** any database connection.
*/
struct sqlite3_module {
  int iVersion;
  int (*xCreate)(sqlite3*, void *pAux,
               int argc, const char *const*argv,
               sqlite3_vtab **ppVTab, char**);
  int (*xConnect)(sqlite3*, void *pAux,
               int argc, const char *const*argv,
               sqlite3_vtab **ppVTab, char**);
  int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*);
  int (*xDisconnect)(sqlite3_vtab *pVTab);
  int (*xDestroy)(sqlite3_vtab *pVTab);
  int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor);
  int (*xClose)(sqlite3_vtab_cursor*);
  int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr,
                int argc, sqlite3_value **argv);
  int (*xNext)(sqlite3_vtab_cursor*);
  int (*xEof)(sqlite3_vtab_cursor*);
  int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int);
  int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *pRowid);
  int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *);
  int (*xBegin)(sqlite3_vtab *pVTab);
  int (*xSync)(sqlite3_vtab *pVTab);
  int (*xCommit)(sqlite3_vtab *pVTab);
  int (*xRollback)(sqlite3_vtab *pVTab);
  int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName,
                       void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),
                       void **ppArg);
  int (*xRename)(sqlite3_vtab *pVtab, const char *zNew);
};

/*
** CAPI3REF: Virtual Table Indexing Information
** KEYWORDS: sqlite3_index_info
**
** The sqlite3_index_info structure and its substructures is used to
** pass information into and receive the reply from the [xBestIndex]
** method of a [virtual table module].  The fields under **Inputs** are the
** inputs to xBestIndex and are read-only.  xBestIndex inserts its
** results into the **Outputs** fields.
**
** ^(The aConstraint[] array records WHERE clause constraints of the form:
**
** <pre>column OP expr</pre>
**
** where OP is =, &lt;, &lt;=, &gt;, or &gt;=.)^  ^(The particular operator is
** stored in aConstraint[].op.)^  ^(The index of the column is stored in
** aConstraint[].iColumn.)^  ^(aConstraint[].usable is TRUE if the
** expr on the right-hand side can be evaluated (and thus the constraint
** is usable) and false if it cannot.)^
**
** ^The optimizer automatically inverts terms of the form "expr OP column"
** and makes other simplifications to the WHERE clause in an attempt to
** get as many WHERE clause terms into the form shown above as possible.
** ^The aConstraint[] array only reports WHERE clause terms that are
** relevant to the particular virtual table being queried.
**
** ^Information about the ORDER BY clause is stored in aOrderBy[].
** ^Each term of aOrderBy records a column of the ORDER BY clause.
**
** The [xBestIndex] method must fill aConstraintUsage[] with information
** about what parameters to pass to xFilter.  ^If argvIndex>0 then
** the right-hand side of the corresponding aConstraint[] is evaluated
** and becomes the argvIndex-th entry in argv.  ^(If aConstraintUsage[].omit
** is true, then the constraint is assumed to be fully handled by the
** virtual table and is not checked again by SQLite.)^
**
** ^The idxNum and idxPtr values are recorded and passed into the
** [xFilter] method.
** ^[sqlite3_free()] is used to free idxPtr if and only if
** needToFreeIdxPtr is true.
**
** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in
** the correct order to satisfy the ORDER BY clause so that no separate
** sorting step is required.
**
** ^The estimatedCost value is an estimate of the cost of doing the
** particular lookup.  A full scan of a table with N entries should have
** a cost of N.  A binary search of a table of N entries should have a
** cost of approximately log(N).
*/
struct sqlite3_index_info {
  /* Inputs */
  int nConstraint;           /* Number of entries in aConstraint */
  struct sqlite3_index_constraint {
     int iColumn;              /* Column on left-hand side of constraint */
     unsigned char op;         /* Constraint operator */
     unsigned char usable;     /* True if this constraint is usable */
     int iTermOffset;          /* Used internally - xBestIndex should ignore */
  } *aConstraint;            /* Table of WHERE clause constraints */
  int nOrderBy;              /* Number of terms in the ORDER BY clause */
  struct sqlite3_index_orderby {
     int iColumn;              /* Column number */
     unsigned char desc;       /* True for DESC.  False for ASC. */
  } *aOrderBy;               /* The ORDER BY clause */
  /* Outputs */
  struct sqlite3_index_constraint_usage {
    int argvIndex;           /* if >0, constraint is part of argv to xFilter */
    unsigned char omit;      /* Do not code a test for this constraint */
  } *aConstraintUsage;
  int idxNum;                /* Number used to identify the index */
  char *idxStr;              /* String, possibly obtained from sqlite3_malloc */
  int needToFreeIdxStr;      /* Free idxStr using sqlite3_free() if true */
  int orderByConsumed;       /* True if output is already ordered */
  double estimatedCost;      /* Estimated cost of using this index */
};
#define SQLITE_INDEX_CONSTRAINT_EQ    2
#define SQLITE_INDEX_CONSTRAINT_GT    4
#define SQLITE_INDEX_CONSTRAINT_LE    8
#define SQLITE_INDEX_CONSTRAINT_LT    16
#define SQLITE_INDEX_CONSTRAINT_GE    32
#define SQLITE_INDEX_CONSTRAINT_MATCH 64

/*
** CAPI3REF: Register A Virtual Table Implementation
**
** ^These routines are used to register a new [virtual table module] name.
** ^Module names must be registered before
** creating a new [virtual table] using the module and before using a
** preexisting [virtual table] for the module.
**
** ^The module name is registered on the [database connection] specified
** by the first parameter.  ^The name of the module is given by the 
** second parameter.  ^The third parameter is a pointer to
** the implementation of the [virtual table module].   ^The fourth
** parameter is an arbitrary client data pointer that is passed through
** into the [xCreate] and [xConnect] methods of the virtual table module
** when a new virtual table is be being created or reinitialized.
**
** ^The sqlite3_create_module_v2() interface has a fifth parameter which
** is a pointer to a destructor for the pClientData.  ^SQLite will
** invoke the destructor function (if it is not NULL) when SQLite
** no longer needs the pClientData pointer.  ^The sqlite3_create_module()
** interface is equivalent to sqlite3_create_module_v2() with a NULL
** destructor.
*/
SQLITE_API int sqlite3_create_module(
  sqlite3 *db,               /* SQLite connection to register module with */
  const char *zName,         /* Name of the module */
  const sqlite3_module *p,   /* Methods for the module */
  void *pClientData          /* Client data for xCreate/xConnect */
);
SQLITE_API int sqlite3_create_module_v2(
  sqlite3 *db,               /* SQLite connection to register module with */
  const char *zName,         /* Name of the module */
  const sqlite3_module *p,   /* Methods for the module */
  void *pClientData,         /* Client data for xCreate/xConnect */
  void(*xDestroy)(void*)     /* Module destructor function */
);

/*
** CAPI3REF: Virtual Table Instance Object
** KEYWORDS: sqlite3_vtab
**
** Every [virtual table module] implementation uses a subclass
** of this object to describe a particular instance
** of the [virtual table].  Each subclass will
** be tailored to the specific needs of the module implementation.
** The purpose of this superclass is to define certain fields that are
** common to all module implementations.
**
** ^Virtual tables methods can set an error message by assigning a
** string obtained from [sqlite3_mprintf()] to zErrMsg.  The method should
** take care that any prior string is freed by a call to [sqlite3_free()]
** prior to assigning a new string to zErrMsg.  ^After the error message
** is delivered up to the client application, the string will be automatically
** freed by sqlite3_free() and the zErrMsg field will be zeroed.
*/
struct sqlite3_vtab {
  const sqlite3_module *pModule;  /* The module for this virtual table */
  int nRef;                       /* NO LONGER USED */
  char *zErrMsg;                  /* Error message from sqlite3_mprintf() */
  /* Virtual table implementations will typically add additional fields */
};

/*
** CAPI3REF: Virtual Table Cursor Object
** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor}
**
** Every [virtual table module] implementation uses a subclass of the
** following structure to describe cursors that point into the
** [virtual table] and are used
** to loop through the virtual table.  Cursors are created using the
** [sqlite3_module.xOpen | xOpen] method of the module and are destroyed
** by the [sqlite3_module.xClose | xClose] method.  Cursors are used
** by the [xFilter], [xNext], [xEof], [xColumn], and [xRowid] methods
** of the module.  Each module implementation will define
** the content of a cursor structure to suit its own needs.
**
** This superclass exists in order to define fields of the cursor that
** are common to all implementations.
*/
struct sqlite3_vtab_cursor {
  sqlite3_vtab *pVtab;      /* Virtual table of this cursor */
  /* Virtual table implementations will typically add additional fields */
};

/*
** CAPI3REF: Declare The Schema Of A Virtual Table
**
** ^The [xCreate] and [xConnect] methods of a
** [virtual table module] call this interface
** to declare the format (the names and datatypes of the columns) of
** the virtual tables they implement.
*/
SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL);

/*
** CAPI3REF: Overload A Function For A Virtual Table
**
** ^(Virtual tables can provide alternative implementations of functions
** using the [xFindFunction] method of the [virtual table module].  
** But global versions of those functions
** must exist in order to be overloaded.)^
**
** ^(This API makes sure a global version of a function with a particular
** name and number of parameters exists.  If no such function exists
** before this API is called, a new function is created.)^  ^The implementation
** of the new function always causes an exception to be thrown.  So
** the new function is not good for anything by itself.  Its only
** purpose is to be a placeholder function that can be overloaded
** by a [virtual table].
*/
SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg);

/*
** The interface to the virtual-table mechanism defined above (back up
** to a comment remarkably similar to this one) is currently considered
** to be experimental.  The interface might change in incompatible ways.
** If this is a problem for you, do not use the interface at this time.
**
** When the virtual-table mechanism stabilizes, we will declare the
** interface fixed, support it indefinitely, and remove this comment.
*/

/*
** CAPI3REF: A Handle To An Open BLOB
** KEYWORDS: {BLOB handle} {BLOB handles}
**
** An instance of this object represents an open BLOB on which
** [sqlite3_blob_open | incremental BLOB I/O] can be performed.
** ^Objects of this type are created by [sqlite3_blob_open()]
** and destroyed by [sqlite3_blob_close()].
** ^The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces
** can be used to read or write small subsections of the BLOB.
** ^The [sqlite3_blob_bytes()] interface returns the size of the BLOB in bytes.
*/
typedef struct sqlite3_blob sqlite3_blob;

/*
** CAPI3REF: Open A BLOB For Incremental I/O
**
** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located
** in row iRow, column zColumn, table zTable in database zDb;
** in other words, the same BLOB that would be selected by:
**
** <pre>
**     SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
** </pre>)^
**
** ^If the flags parameter is non-zero, then the BLOB is opened for read
** and write access. ^If it is zero, the BLOB is opened for read access.
** ^It is not possible to open a column that is part of an index or primary 
** key for writing. ^If [foreign key constraints] are enabled, it is 
** not possible to open a column that is part of a [child key] for writing.
**
** ^Note that the database name is not the filename that contains
** the database but rather the symbolic name of the database that
** appears after the AS keyword when the database is connected using [ATTACH].
** ^For the main database file, the database name is "main".
** ^For TEMP tables, the database name is "temp".
**
** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is written
** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set
** to be a null pointer.)^
** ^This function sets the [database connection] error code and message
** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()] and related
** functions. ^Note that the *ppBlob variable is always initialized in a
** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob
** regardless of the success or failure of this routine.
**
** ^(If the row that a BLOB handle points to is modified by an
** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects
** then the BLOB handle is marked as "expired".
** This is true if any column of the row is changed, even a column
** other than the one the BLOB handle is open on.)^
** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for
** a expired BLOB handle fail with an return code of [SQLITE_ABORT].
** ^(Changes written into a BLOB prior to the BLOB expiring are not
** rolled back by the expiration of the BLOB.  Such changes will eventually
** commit if the transaction continues to completion.)^
**
** ^Use the [sqlite3_blob_bytes()] interface to determine the size of
** the opened blob.  ^The size of a blob may not be changed by this
** interface.  Use the [UPDATE] SQL command to change the size of a
** blob.
**
** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces
** and the built-in [zeroblob] SQL function can be used, if desired,
** to create an empty, zero-filled blob in which to read or write using
** this interface.
**
** To avoid a resource leak, every open [BLOB handle] should eventually
** be released by a call to [sqlite3_blob_close()].
*/
SQLITE_API int sqlite3_blob_open(
  sqlite3*,
  const char *zDb,
  const char *zTable,
  const char *zColumn,
  sqlite3_int64 iRow,
  int flags,
  sqlite3_blob **ppBlob
);

/*
** CAPI3REF: Close A BLOB Handle
**
** ^Closes an open [BLOB handle].
**
** ^Closing a BLOB shall cause the current transaction to commit
** if there are no other BLOBs, no pending prepared statements, and the
** database connection is in [autocommit mode].
** ^If any writes were made to the BLOB, they might be held in cache
** until the close operation if they will fit.
**
** ^(Closing the BLOB often forces the changes
** out to disk and so if any I/O errors occur, they will likely occur
** at the time when the BLOB is closed.  Any errors that occur during
** closing are reported as a non-zero return value.)^
**
** ^(The BLOB is closed unconditionally.  Even if this routine returns
** an error code, the BLOB is still closed.)^
**
** ^Calling this routine with a null pointer (such as would be returned
** by a failed call to [sqlite3_blob_open()]) is a harmless no-op.
*/
SQLITE_API int sqlite3_blob_close(sqlite3_blob *);

/*
** CAPI3REF: Return The Size Of An Open BLOB
**
** ^Returns the size in bytes of the BLOB accessible via the 
** successfully opened [BLOB handle] in its only argument.  ^The
** incremental blob I/O routines can only read or overwriting existing
** blob content; they cannot change the size of a blob.
**
** This routine only works on a [BLOB handle] which has been created
** by a prior successful call to [sqlite3_blob_open()] and which has not
** been closed by [sqlite3_blob_close()].  Passing any other pointer in
** to this routine results in undefined and probably undesirable behavior.
*/
SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *);

/*
** CAPI3REF: Read Data From A BLOB Incrementally
**
** ^(This function is used to read data from an open [BLOB handle] into a
** caller-supplied buffer. N bytes of data are copied into buffer Z
** from the open BLOB, starting at offset iOffset.)^
**
** ^If offset iOffset is less than N bytes from the end of the BLOB,
** [SQLITE_ERROR] is returned and no data is read.  ^If N or iOffset is
** less than zero, [SQLITE_ERROR] is returned and no data is read.
** ^The size of the blob (and hence the maximum value of N+iOffset)
** can be determined using the [sqlite3_blob_bytes()] interface.
**
** ^An attempt to read from an expired [BLOB handle] fails with an
** error code of [SQLITE_ABORT].
**
** ^(On success, sqlite3_blob_read() returns SQLITE_OK.
** Otherwise, an [error code] or an [extended error code] is returned.)^
**
** This routine only works on a [BLOB handle] which has been created
** by a prior successful call to [sqlite3_blob_open()] and which has not
** been closed by [sqlite3_blob_close()].  Passing any other pointer in
** to this routine results in undefined and probably undesirable behavior.
**
** See also: [sqlite3_blob_write()].
*/
SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset);

/*
** CAPI3REF: Write Data Into A BLOB Incrementally
**
** ^This function is used to write data into an open [BLOB handle] from a
** caller-supplied buffer. ^N bytes of data are copied from the buffer Z
** into the open BLOB, starting at offset iOffset.
**
** ^If the [BLOB handle] passed as the first argument was not opened for
** writing (the flags parameter to [sqlite3_blob_open()] was zero),
** this function returns [SQLITE_READONLY].
**
** ^This function may only modify the contents of the BLOB; it is
** not possible to increase the size of a BLOB using this API.
** ^If offset iOffset is less than N bytes from the end of the BLOB,
** [SQLITE_ERROR] is returned and no data is written.  ^If N is
** less than zero [SQLITE_ERROR] is returned and no data is written.
** The size of the BLOB (and hence the maximum value of N+iOffset)
** can be determined using the [sqlite3_blob_bytes()] interface.
**
** ^An attempt to write to an expired [BLOB handle] fails with an
** error code of [SQLITE_ABORT].  ^Writes to the BLOB that occurred
** before the [BLOB handle] expired are not rolled back by the
** expiration of the handle, though of course those changes might
** have been overwritten by the statement that expired the BLOB handle
** or by other independent statements.
**
** ^(On success, sqlite3_blob_write() returns SQLITE_OK.
** Otherwise, an  [error code] or an [extended error code] is returned.)^
**
** This routine only works on a [BLOB handle] which has been created
** by a prior successful call to [sqlite3_blob_open()] and which has not
** been closed by [sqlite3_blob_close()].  Passing any other pointer in
** to this routine results in undefined and probably undesirable behavior.
**
** See also: [sqlite3_blob_read()].
*/
SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);

/*
** CAPI3REF: Virtual File System Objects
**
** A virtual filesystem (VFS) is an [sqlite3_vfs] object
** that SQLite uses to interact
** with the underlying operating system.  Most SQLite builds come with a
** single default VFS that is appropriate for the host computer.
** New VFSes can be registered and existing VFSes can be unregistered.
** The following interfaces are provided.
**
** ^The sqlite3_vfs_find() interface returns a pointer to a VFS given its name.
** ^Names are case sensitive.
** ^Names are zero-terminated UTF-8 strings.
** ^If there is no match, a NULL pointer is returned.
** ^If zVfsName is NULL then the default VFS is returned.
**
** ^New VFSes are registered with sqlite3_vfs_register().
** ^Each new VFS becomes the default VFS if the makeDflt flag is set.
** ^The same VFS can be registered multiple times without injury.
** ^To make an existing VFS into the default VFS, register it again
** with the makeDflt flag set.  If two different VFSes with the
** same name are registered, the behavior is undefined.  If a
** VFS is registered with a name that is NULL or an empty string,
** then the behavior is undefined.
**
** ^Unregister a VFS with the sqlite3_vfs_unregister() interface.
** ^(If the default VFS is unregistered, another VFS is chosen as
** the default.  The choice for the new VFS is arbitrary.)^
*/
SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName);
SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt);
SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);

/*
** CAPI3REF: Mutexes
**
** The SQLite core uses these routines for thread
** synchronization. Though they are intended for internal
** use by SQLite, code that links against SQLite is
** permitted to use any of these routines.
**
** The SQLite source code contains multiple implementations
** of these mutex routines.  An appropriate implementation
** is selected automatically at compile-time.  ^(The following
** implementations are available in the SQLite core:
**
** <ul>
** <li>   SQLITE_MUTEX_OS2
** <li>   SQLITE_MUTEX_PTHREAD
** <li>   SQLITE_MUTEX_W32
** <li>   SQLITE_MUTEX_NOOP
** </ul>)^
**
** ^The SQLITE_MUTEX_NOOP implementation is a set of routines
** that does no real locking and is appropriate for use in
** a single-threaded application.  ^The SQLITE_MUTEX_OS2,
** SQLITE_MUTEX_PTHREAD, and SQLITE_MUTEX_W32 implementations
** are appropriate for use on OS/2, Unix, and Windows.
**
** ^(If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor
** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex
** implementation is included with the library. In this case the
** application must supply a custom mutex implementation using the
** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function
** before calling sqlite3_initialize() or any other public sqlite3_
** function that calls sqlite3_initialize().)^
**
** ^The sqlite3_mutex_alloc() routine allocates a new
** mutex and returns a pointer to it. ^If it returns NULL
** that means that a mutex could not be allocated.  ^SQLite
** will unwind its stack and return an error.  ^(The argument
** to sqlite3_mutex_alloc() is one of these integer constants:
**
** <ul>
** <li>  SQLITE_MUTEX_FAST
** <li>  SQLITE_MUTEX_RECURSIVE
** <li>  SQLITE_MUTEX_STATIC_MASTER
** <li>  SQLITE_MUTEX_STATIC_MEM
** <li>  SQLITE_MUTEX_STATIC_MEM2
** <li>  SQLITE_MUTEX_STATIC_PRNG
** <li>  SQLITE_MUTEX_STATIC_LRU
** <li>  SQLITE_MUTEX_STATIC_LRU2
** </ul>)^
**
** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE)
** cause sqlite3_mutex_alloc() to create
** a new mutex.  ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE
** is used but not necessarily so when SQLITE_MUTEX_FAST is used.
** The mutex implementation does not need to make a distinction
** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does
** not want to.  ^SQLite will only request a recursive mutex in
** cases where it really needs one.  ^If a faster non-recursive mutex
** implementation is available on the host platform, the mutex subsystem
** might return such a mutex in response to SQLITE_MUTEX_FAST.
**
** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other
** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return
** a pointer to a static preexisting mutex.  ^Six static mutexes are
** used by the current version of SQLite.  Future versions of SQLite
** may add additional static mutexes.  Static mutexes are for internal
** use by SQLite only.  Applications that use SQLite mutexes should
** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or
** SQLITE_MUTEX_RECURSIVE.
**
** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST
** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc()
** returns a different mutex on every call.  ^But for the static
** mutex types, the same mutex is returned on every call that has
** the same type number.
**
** ^The sqlite3_mutex_free() routine deallocates a previously
** allocated dynamic mutex.  ^SQLite is careful to deallocate every
** dynamic mutex that it allocates.  The dynamic mutexes must not be in
** use when they are deallocated.  Attempting to deallocate a static
** mutex results in undefined behavior.  ^SQLite never deallocates
** a static mutex.
**
** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt
** to enter a mutex.  ^If another thread is already within the mutex,
** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return
** SQLITE_BUSY.  ^The sqlite3_mutex_try() interface returns [SQLITE_OK]
** upon successful entry.  ^(Mutexes created using
** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread.
** In such cases the,
** mutex must be exited an equal number of times before another thread
** can enter.)^  ^(If the same thread tries to enter any other
** kind of mutex more than once, the behavior is undefined.
** SQLite will never exhibit
** such behavior in its own use of mutexes.)^
**
** ^(Some systems (for example, Windows 95) do not support the operation
** implemented by sqlite3_mutex_try().  On those systems, sqlite3_mutex_try()
** will always return SQLITE_BUSY.  The SQLite core only ever uses
** sqlite3_mutex_try() as an optimization so this is acceptable behavior.)^
**
** ^The sqlite3_mutex_leave() routine exits a mutex that was
** previously entered by the same thread.   ^(The behavior
** is undefined if the mutex is not currently entered by the
** calling thread or is not currently allocated.  SQLite will
** never do either.)^
**
** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or
** sqlite3_mutex_leave() is a NULL pointer, then all three routines
** behave as no-ops.
**
** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()].
*/
SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int);
SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*);
SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*);
SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*);
SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*);

/*
** CAPI3REF: Mutex Methods Object
**
** An instance of this structure defines the low-level routines
** used to allocate and use mutexes.
**
** Usually, the default mutex implementations provided by SQLite are
** sufficient, however the user has the option of substituting a custom
** implementation for specialized deployments or systems for which SQLite
** does not provide a suitable implementation. In this case, the user
** creates and populates an instance of this structure to pass
** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option.
** Additionally, an instance of this structure can be used as an
** output variable when querying the system for the current mutex
** implementation, using the [SQLITE_CONFIG_GETMUTEX] option.
**
** ^The xMutexInit method defined by this structure is invoked as
** part of system initialization by the sqlite3_initialize() function.
** ^The xMutexInit routine is calle by SQLite exactly once for each
** effective call to [sqlite3_initialize()].
**
** ^The xMutexEnd method defined by this structure is invoked as
** part of system shutdown by the sqlite3_shutdown() function. The
** implementation of this method is expected to release all outstanding
** resources obtained by the mutex methods implementation, especially
** those obtained by the xMutexInit method.  ^The xMutexEnd()
** interface is invoked exactly once for each call to [sqlite3_shutdown()].
**
** ^(The remaining seven methods defined by this structure (xMutexAlloc,
** xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and
** xMutexNotheld) implement the following interfaces (respectively):
**
** <ul>
**   <li>  [sqlite3_mutex_alloc()] </li>
**   <li>  [sqlite3_mutex_free()] </li>
**   <li>  [sqlite3_mutex_enter()] </li>
**   <li>  [sqlite3_mutex_try()] </li>
**   <li>  [sqlite3_mutex_leave()] </li>
**   <li>  [sqlite3_mutex_held()] </li>
**   <li>  [sqlite3_mutex_notheld()] </li>
** </ul>)^
**
** The only difference is that the public sqlite3_XXX functions enumerated
** above silently ignore any invocations that pass a NULL pointer instead
** of a valid mutex handle. The implementations of the methods defined
** by this structure are not required to handle this case, the results
** of passing a NULL pointer instead of a valid mutex handle are undefined
** (i.e. it is acceptable to provide an implementation that segfaults if
** it is passed a NULL pointer).
**
** The xMutexInit() method must be threadsafe.  ^It must be harmless to
** invoke xMutexInit() mutiple times within the same process and without
** intervening calls to xMutexEnd().  Second and subsequent calls to
** xMutexInit() must be no-ops.
**
** ^xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()]
** and its associates).  ^Similarly, xMutexAlloc() must not use SQLite memory
** allocation for a static mutex.  ^However xMutexAlloc() may use SQLite
** memory allocation for a fast or recursive mutex.
**
** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is
** called, but only if the prior call to xMutexInit returned SQLITE_OK.
** If xMutexInit fails in any way, it is expected to clean up after itself
** prior to returning.
*/
typedef struct sqlite3_mutex_methods sqlite3_mutex_methods;
struct sqlite3_mutex_methods {
  int (*xMutexInit)(void);
  int (*xMutexEnd)(void);
  sqlite3_mutex *(*xMutexAlloc)(int);
  void (*xMutexFree)(sqlite3_mutex *);
  void (*xMutexEnter)(sqlite3_mutex *);
  int (*xMutexTry)(sqlite3_mutex *);
  void (*xMutexLeave)(sqlite3_mutex *);
  int (*xMutexHeld)(sqlite3_mutex *);
  int (*xMutexNotheld)(sqlite3_mutex *);
};

/*
** CAPI3REF: Mutex Verification Routines
**
** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines
** are intended for use inside assert() statements.  ^The SQLite core
** never uses these routines except inside an assert() and applications
** are advised to follow the lead of the core.  ^The SQLite core only
** provides implementations for these routines when it is compiled
** with the SQLITE_DEBUG flag.  ^External mutex implementations
** are only required to provide these routines if SQLITE_DEBUG is
** defined and if NDEBUG is not defined.
**
** ^These routines should return true if the mutex in their argument
** is held or not held, respectively, by the calling thread.
**
** ^The implementation is not required to provided versions of these
** routines that actually work. If the implementation does not provide working
** versions of these routines, it should at least provide stubs that always
** return true so that one does not get spurious assertion failures.
**
** ^If the argument to sqlite3_mutex_held() is a NULL pointer then
** the routine should return 1.   This seems counter-intuitive since
** clearly the mutex cannot be held if it does not exist.  But the
** the reason the mutex does not exist is because the build is not
** using mutexes.  And we do not want the assert() containing the
** call to sqlite3_mutex_held() to fail, so a non-zero return is
** the appropriate thing to do.  ^The sqlite3_mutex_notheld()
** interface should also return 1 when given a NULL pointer.
*/
#ifndef NDEBUG
SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*);
SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*);
#endif

/*
** CAPI3REF: Mutex Types
**
** The [sqlite3_mutex_alloc()] interface takes a single argument
** which is one of these integer constants.
**
** The set of static mutexes may change from one SQLite release to the
** next.  Applications that override the built-in mutex logic must be
** prepared to accommodate additional static mutexes.
*/
#define SQLITE_MUTEX_FAST             0
#define SQLITE_MUTEX_RECURSIVE        1
#define SQLITE_MUTEX_STATIC_MASTER    2
#define SQLITE_MUTEX_STATIC_MEM       3  /* sqlite3_malloc() */
#define SQLITE_MUTEX_STATIC_MEM2      4  /* NOT USED */
#define SQLITE_MUTEX_STATIC_OPEN      4  /* sqlite3BtreeOpen() */
#define SQLITE_MUTEX_STATIC_PRNG      5  /* sqlite3_random() */
#define SQLITE_MUTEX_STATIC_LRU       6  /* lru page list */
#define SQLITE_MUTEX_STATIC_LRU2      7  /* lru page list */

/*
** CAPI3REF: Retrieve the mutex for a database connection
**
** ^This interface returns a pointer the [sqlite3_mutex] object that 
** serializes access to the [database connection] given in the argument
** when the [threading mode] is Serialized.
** ^If the [threading mode] is Single-thread or Multi-thread then this
** routine returns a NULL pointer.
*/
SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);

/*
** CAPI3REF: Low-Level Control Of Database Files
**
** ^The [sqlite3_file_control()] interface makes a direct call to the
** xFileControl method for the [sqlite3_io_methods] object associated
** with a particular database identified by the second argument. ^The
** name of the database "main" for the main database or "temp" for the
** TEMP database, or the name that appears after the AS keyword for
** databases that are added using the [ATTACH] SQL command.
** ^A NULL pointer can be used in place of "main" to refer to the
** main database file.
** ^The third and fourth parameters to this routine
** are passed directly through to the second and third parameters of
** the xFileControl method.  ^The return value of the xFileControl
** method becomes the return value of this routine.
**
** ^If the second parameter (zDbName) does not match the name of any
** open database file, then SQLITE_ERROR is returned.  ^This error
** code is not remembered and will not be recalled by [sqlite3_errcode()]
** or [sqlite3_errmsg()].  The underlying xFileControl method might
** also return SQLITE_ERROR.  There is no way to distinguish between
** an incorrect zDbName and an SQLITE_ERROR return from the underlying
** xFileControl method.
**
** See also: [SQLITE_FCNTL_LOCKSTATE]
*/
SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*);

/*
** CAPI3REF: Testing Interface
**
** ^The sqlite3_test_control() interface is used to read out internal
** state of SQLite and to inject faults into SQLite for testing
** purposes.  ^The first parameter is an operation code that determines
** the number, meaning, and operation of all subsequent parameters.
**
** This interface is not for use by applications.  It exists solely
** for verifying the correct operation of the SQLite library.  Depending
** on how the SQLite library is compiled, this interface might not exist.
**
** The details of the operation codes, their meanings, the parameters
** they take, and what they do are all subject to change without notice.
** Unlike most of the SQLite API, this function is not guaranteed to
** operate consistently from one release to the next.
*/
SQLITE_API int sqlite3_test_control(int op, ...);

/*
** CAPI3REF: Testing Interface Operation Codes
**
** These constants are the valid operation code parameters used
** as the first argument to [sqlite3_test_control()].
**
** These parameters and their meanings are subject to change
** without notice.  These values are for testing purposes only.
** Applications should not use any of these parameters or the
** [sqlite3_test_control()] interface.
*/
#define SQLITE_TESTCTRL_FIRST                    5
#define SQLITE_TESTCTRL_PRNG_SAVE                5
#define SQLITE_TESTCTRL_PRNG_RESTORE             6
#define SQLITE_TESTCTRL_PRNG_RESET               7
#define SQLITE_TESTCTRL_BITVEC_TEST              8
#define SQLITE_TESTCTRL_FAULT_INSTALL            9
#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS     10
#define SQLITE_TESTCTRL_PENDING_BYTE            11
#define SQLITE_TESTCTRL_ASSERT                  12
#define SQLITE_TESTCTRL_ALWAYS                  13
#define SQLITE_TESTCTRL_RESERVE                 14
#define SQLITE_TESTCTRL_OPTIMIZATIONS           15
#define SQLITE_TESTCTRL_ISKEYWORD               16
#define SQLITE_TESTCTRL_PGHDRSZ                 17
#define SQLITE_TESTCTRL_LAST                    17

/*
** CAPI3REF: SQLite Runtime Status
**
** ^This interface is used to retrieve runtime status information
** about the preformance of SQLite, and optionally to reset various
** highwater marks.  ^The first argument is an integer code for
** the specific parameter to measure.  ^(Recognized integer codes
** are of the form [SQLITE_STATUS_MEMORY_USED | SQLITE_STATUS_...].)^
** ^The current value of the parameter is returned into *pCurrent.
** ^The highest recorded value is returned in *pHighwater.  ^If the
** resetFlag is true, then the highest record value is reset after
** *pHighwater is written.  ^(Some parameters do not record the highest
** value.  For those parameters
** nothing is written into *pHighwater and the resetFlag is ignored.)^
** ^(Other parameters record only the highwater mark and not the current
** value.  For these latter parameters nothing is written into *pCurrent.)^
**
** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a
** non-zero [error code] on failure.
**
** This routine is threadsafe but is not atomic.  This routine can be
** called while other threads are running the same or different SQLite
** interfaces.  However the values returned in *pCurrent and
** *pHighwater reflect the status of SQLite at different points in time
** and it is possible that another thread might change the parameter
** in between the times when *pCurrent and *pHighwater are written.
**
** See also: [sqlite3_db_status()]
*/
SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag);


/*
** CAPI3REF: Status Parameters
**
** These integer constants designate various run-time status parameters
** that can be returned by [sqlite3_status()].
**
** <dl>
** ^(<dt>SQLITE_STATUS_MEMORY_USED</dt>
** <dd>This parameter is the current amount of memory checked out
** using [sqlite3_malloc()], either directly or indirectly.  The
** figure includes calls made to [sqlite3_malloc()] by the application
** and internal memory usage by the SQLite library.  Scratch memory
** controlled by [SQLITE_CONFIG_SCRATCH] and auxiliary page-cache
** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in
** this parameter.  The amount returned is the sum of the allocation
** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd>)^
**
** ^(<dt>SQLITE_STATUS_MALLOC_SIZE</dt>
** <dd>This parameter records the largest memory allocation request
** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their
** internal equivalents).  Only the value returned in the
** *pHighwater parameter to [sqlite3_status()] is of interest.  
** The value written into the *pCurrent parameter is undefined.</dd>)^
**
** ^(<dt>SQLITE_STATUS_PAGECACHE_USED</dt>
** <dd>This parameter returns the number of pages used out of the
** [pagecache memory allocator] that was configured using 
** [SQLITE_CONFIG_PAGECACHE].  The
** value returned is in pages, not in bytes.</dd>)^
**
** ^(<dt>SQLITE_STATUS_PAGECACHE_OVERFLOW</dt>
** <dd>This parameter returns the number of bytes of page cache
** allocation which could not be statisfied by the [SQLITE_CONFIG_PAGECACHE]
** buffer and where forced to overflow to [sqlite3_malloc()].  The
** returned value includes allocations that overflowed because they
** where too large (they were larger than the "sz" parameter to
** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because
** no space was left in the page cache.</dd>)^
**
** ^(<dt>SQLITE_STATUS_PAGECACHE_SIZE</dt>
** <dd>This parameter records the largest memory allocation request
** handed to [pagecache memory allocator].  Only the value returned in the
** *pHighwater parameter to [sqlite3_status()] is of interest.  
** The value written into the *pCurrent parameter is undefined.</dd>)^
**
** ^(<dt>SQLITE_STATUS_SCRATCH_USED</dt>
** <dd>This parameter returns the number of allocations used out of the
** [scratch memory allocator] configured using
** [SQLITE_CONFIG_SCRATCH].  The value returned is in allocations, not
** in bytes.  Since a single thread may only have one scratch allocation
** outstanding at time, this parameter also reports the number of threads
** using scratch memory at the same time.</dd>)^
**
** ^(<dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt>
** <dd>This parameter returns the number of bytes of scratch memory
** allocation which could not be statisfied by the [SQLITE_CONFIG_SCRATCH]
** buffer and where forced to overflow to [sqlite3_malloc()].  The values
** returned include overflows because the requested allocation was too
** larger (that is, because the requested allocation was larger than the
** "sz" parameter to [SQLITE_CONFIG_SCRATCH]) and because no scratch buffer
** slots were available.
** </dd>)^
**
** ^(<dt>SQLITE_STATUS_SCRATCH_SIZE</dt>
** <dd>This parameter records the largest memory allocation request
** handed to [scratch memory allocator].  Only the value returned in the
** *pHighwater parameter to [sqlite3_status()] is of interest.  
** The value written into the *pCurrent parameter is undefined.</dd>)^
**
** ^(<dt>SQLITE_STATUS_PARSER_STACK</dt>
** <dd>This parameter records the deepest parser stack.  It is only
** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].</dd>)^
** </dl>
**
** New status parameters may be added from time to time.
*/
#define SQLITE_STATUS_MEMORY_USED          0
#define SQLITE_STATUS_PAGECACHE_USED       1
#define SQLITE_STATUS_PAGECACHE_OVERFLOW   2
#define SQLITE_STATUS_SCRATCH_USED         3
#define SQLITE_STATUS_SCRATCH_OVERFLOW     4
#define SQLITE_STATUS_MALLOC_SIZE          5
#define SQLITE_STATUS_PARSER_STACK         6
#define SQLITE_STATUS_PAGECACHE_SIZE       7
#define SQLITE_STATUS_SCRATCH_SIZE         8

/*
** CAPI3REF: Database Connection Status
**
** ^This interface is used to retrieve runtime status information 
** about a single [database connection].  ^The first argument is the
** database connection object to be interrogated.  ^The second argument
** is an integer constant, taken from the set of
** [SQLITE_DBSTATUS_LOOKASIDE_USED | SQLITE_DBSTATUS_*] macros, that
** determiness the parameter to interrogate.  The set of 
** [SQLITE_DBSTATUS_LOOKASIDE_USED | SQLITE_DBSTATUS_*] macros is likely
** to grow in future releases of SQLite.
**
** ^The current value of the requested parameter is written into *pCur
** and the highest instantaneous value is written into *pHiwtr.  ^If
** the resetFlg is true, then the highest instantaneous value is
** reset back down to the current value.
**
** See also: [sqlite3_status()] and [sqlite3_stmt_status()].
*/
SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg);

/*
** CAPI3REF: Status Parameters for database connections
**
** These constants are the available integer "verbs" that can be passed as
** the second argument to the [sqlite3_db_status()] interface.
**
** New verbs may be added in future releases of SQLite. Existing verbs
** might be discontinued. Applications should check the return code from
** [sqlite3_db_status()] to make sure that the call worked.
** The [sqlite3_db_status()] interface will return a non-zero error code
** if a discontinued or unsupported verb is invoked.
**
** <dl>
** ^(<dt>SQLITE_DBSTATUS_LOOKASIDE_USED</dt>
** <dd>This parameter returns the number of lookaside memory slots currently
** checked out.</dd>)^
**
** <dt>SQLITE_DBSTATUS_CACHE_USED</dt>
** <dd>^This parameter returns the approximate number of of bytes of heap
** memory used by all pager caches associated with the database connection.
** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0.
** </dd>
** </dl>
*/
#define SQLITE_DBSTATUS_LOOKASIDE_USED     0
#define SQLITE_DBSTATUS_CACHE_USED         1
#define SQLITE_DBSTATUS_MAX                1   /* Largest defined DBSTATUS */


/*
** CAPI3REF: Prepared Statement Status
**
** ^(Each prepared statement maintains various
** [SQLITE_STMTSTATUS_SORT | counters] that measure the number
** of times it has performed specific operations.)^  These counters can
** be used to monitor the performance characteristics of the prepared
** statements.  For example, if the number of table steps greatly exceeds
** the number of table searches or result rows, that would tend to indicate
** that the prepared statement is using a full table scan rather than
** an index.  
**
** ^(This interface is used to retrieve and reset counter values from
** a [prepared statement].  The first argument is the prepared statement
** object to be interrogated.  The second argument
** is an integer code for a specific [SQLITE_STMTSTATUS_SORT | counter]
** to be interrogated.)^
** ^The current value of the requested counter is returned.
** ^If the resetFlg is true, then the counter is reset to zero after this
** interface call returns.
**
** See also: [sqlite3_status()] and [sqlite3_db_status()].
*/
SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);

/*
** CAPI3REF: Status Parameters for prepared statements
**
** These preprocessor macros define integer codes that name counter
** values associated with the [sqlite3_stmt_status()] interface.
** The meanings of the various counters are as follows:
**
** <dl>
** <dt>SQLITE_STMTSTATUS_FULLSCAN_STEP</dt>
** <dd>^This is the number of times that SQLite has stepped forward in
** a table as part of a full table scan.  Large numbers for this counter
** may indicate opportunities for performance improvement through 
** careful use of indices.</dd>
**
** <dt>SQLITE_STMTSTATUS_SORT</dt>
** <dd>^This is the number of sort operations that have occurred.
** A non-zero value in this counter may indicate an opportunity to
** improvement performance through careful use of indices.</dd>
**
** <dt>SQLITE_STMTSTATUS_AUTOINDEX</dt>
** <dd>^This is the number of rows inserted into transient indices that
** were created automatically in order to help joins run faster.
** A non-zero value in this counter may indicate an opportunity to
** improvement performance by adding permanent indices that do not
** need to be reinitialized each time the statement is run.</dd>
**
** </dl>
*/
#define SQLITE_STMTSTATUS_FULLSCAN_STEP     1
#define SQLITE_STMTSTATUS_SORT              2
#define SQLITE_STMTSTATUS_AUTOINDEX         3

/*
** CAPI3REF: Custom Page Cache Object
**
** The sqlite3_pcache type is opaque.  It is implemented by
** the pluggable module.  The SQLite core has no knowledge of
** its size or internal structure and never deals with the
** sqlite3_pcache object except by holding and passing pointers
** to the object.
**
** See [sqlite3_pcache_methods] for additional information.
*/
typedef struct sqlite3_pcache sqlite3_pcache;

/*
** CAPI3REF: Application Defined Page Cache.
** KEYWORDS: {page cache}
**
** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE], ...) interface can
** register an alternative page cache implementation by passing in an 
** instance of the sqlite3_pcache_methods structure.)^ The majority of the 
** heap memory used by SQLite is used by the page cache to cache data read 
** from, or ready to be written to, the database file. By implementing a 
** custom page cache using this API, an application can control more 
** precisely the amount of memory consumed by SQLite, the way in which 
** that memory is allocated and released, and the policies used to 
** determine exactly which parts of a database file are cached and for 
** how long.
**
** ^(The contents of the sqlite3_pcache_methods structure are copied to an
** internal buffer by SQLite within the call to [sqlite3_config].  Hence
** the application may discard the parameter after the call to
** [sqlite3_config()] returns.)^
**
** ^The xInit() method is called once for each call to [sqlite3_initialize()]
** (usually only once during the lifetime of the process). ^(The xInit()
** method is passed a copy of the sqlite3_pcache_methods.pArg value.)^
** ^The xInit() method can set up up global structures and/or any mutexes
** required by the custom page cache implementation. 
**
** ^The xShutdown() method is called from within [sqlite3_shutdown()], 
** if the application invokes this API. It can be used to clean up 
** any outstanding resources before process shutdown, if required.
**
** ^SQLite holds a [SQLITE_MUTEX_RECURSIVE] mutex when it invokes
** the xInit method, so the xInit method need not be threadsafe.  ^The
** xShutdown method is only called from [sqlite3_shutdown()] so it does
** not need to be threadsafe either.  All other methods must be threadsafe
** in multithreaded applications.
**
** ^SQLite will never invoke xInit() more than once without an intervening
** call to xShutdown().
**
** ^The xCreate() method is used to construct a new cache instance.  SQLite
** will typically create one cache instance for each open database file,
** though this is not guaranteed. ^The
** first parameter, szPage, is the size in bytes of the pages that must
** be allocated by the cache.  ^szPage will not be a power of two.  ^szPage
** will the page size of the database file that is to be cached plus an
** increment (here called "R") of about 100 or 200.  ^SQLite will use the
** extra R bytes on each page to store metadata about the underlying
** database page on disk.  The value of R depends
** on the SQLite version, the target platform, and how SQLite was compiled.
** ^R is constant for a particular build of SQLite.  ^The second argument to
** xCreate(), bPurgeable, is true if the cache being created will
** be used to cache database pages of a file stored on disk, or
** false if it is used for an in-memory database. ^The cache implementation
** does not have to do anything special based with the value of bPurgeable;
** it is purely advisory.  ^On a cache where bPurgeable is false, SQLite will
** never invoke xUnpin() except to deliberately delete a page.
** ^In other words, a cache created with bPurgeable set to false will
** never contain any unpinned pages.
**
** ^(The xCachesize() method may be called at any time by SQLite to set the
** suggested maximum cache-size (number of pages stored by) the cache
** instance passed as the first argument. This is the value configured using
** the SQLite "[PRAGMA cache_size]" command.)^  ^As with the bPurgeable
** parameter, the implementation is not required to do anything with this
** value; it is advisory only.
**
** ^The xPagecount() method should return the number of pages currently
** stored in the cache.
** 
** ^The xFetch() method is used to fetch a page and return a pointer to it. 
** ^A 'page', in this context, is a buffer of szPage bytes aligned at an
** 8-byte boundary. ^The page to be fetched is determined by the key. ^The
** mimimum key value is 1. After it has been retrieved using xFetch, the page 
** is considered to be "pinned".
**
** ^If the requested page is already in the page cache, then the page cache
** implementation must return a pointer to the page buffer with its content
** intact.  ^(If the requested page is not already in the cache, then the
** behavior of the cache implementation is determined by the value of the
** createFlag parameter passed to xFetch, according to the following table:
**
** <table border=1 width=85% align=center>
** <tr><th> createFlag <th> Behaviour when page is not already in cache
** <tr><td> 0 <td> Do not allocate a new page.  Return NULL.
** <tr><td> 1 <td> Allocate a new page if it easy and convenient to do so.
**                 Otherwise return NULL.
** <tr><td> 2 <td> Make every effort to allocate a new page.  Only return
**                 NULL if allocating a new page is effectively impossible.
** </table>)^
**
** SQLite will normally invoke xFetch() with a createFlag of 0 or 1.  If
** a call to xFetch() with createFlag==1 returns NULL, then SQLite will
** attempt to unpin one or more cache pages by spilling the content of
** pinned pages to disk and synching the operating system disk cache. After
** attempting to unpin pages, the xFetch() method will be invoked again with
** a createFlag of 2.
**
** ^xUnpin() is called by SQLite with a pointer to a currently pinned page
** as its second argument. ^(If the third parameter, discard, is non-zero,
** then the page should be evicted from the cache. In this case SQLite 
** assumes that the next time the page is retrieved from the cache using
** the xFetch() method, it will be zeroed.)^ ^If the discard parameter is
** zero, then the page is considered to be unpinned. ^The cache implementation
** may choose to evict unpinned pages at any time.
**
** ^(The cache is not required to perform any reference counting. A single 
** call to xUnpin() unpins the page regardless of the number of prior calls 
** to xFetch().)^
**
** ^The xRekey() method is used to change the key value associated with the
** page passed as the second argument from oldKey to newKey. ^If the cache
** previously contains an entry associated with newKey, it should be
** discarded. ^Any prior cache entry associated with newKey is guaranteed not
** to be pinned.
**
** ^When SQLite calls the xTruncate() method, the cache must discard all
** existing cache entries with page numbers (keys) greater than or equal
** to the value of the iLimit parameter passed to xTruncate(). ^If any
** of these pages are pinned, they are implicitly unpinned, meaning that
** they can be safely discarded.
**
** ^The xDestroy() method is used to delete a cache allocated by xCreate().
** All resources associated with the specified cache should be freed. ^After
** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*]
** handle invalid, and will not use it with any other sqlite3_pcache_methods
** functions.
*/
typedef struct sqlite3_pcache_methods sqlite3_pcache_methods;
struct sqlite3_pcache_methods {
  void *pArg;
  int (*xInit)(void*);
  void (*xShutdown)(void*);
  sqlite3_pcache *(*xCreate)(int szPage, int bPurgeable);
  void (*xCachesize)(sqlite3_pcache*, int nCachesize);
  int (*xPagecount)(sqlite3_pcache*);
  void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);
  void (*xUnpin)(sqlite3_pcache*, void*, int discard);
  void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey);
  void (*xTruncate)(sqlite3_pcache*, unsigned iLimit);
  void (*xDestroy)(sqlite3_pcache*);
};

/*
** CAPI3REF: Online Backup Object
**
** The sqlite3_backup object records state information about an ongoing
** online backup operation.  ^The sqlite3_backup object is created by
** a call to [sqlite3_backup_init()] and is destroyed by a call to
** [sqlite3_backup_finish()].
**
** See Also: [Using the SQLite Online Backup API]
*/
typedef struct sqlite3_backup sqlite3_backup;

/*
** CAPI3REF: Online Backup API.
**
** The backup API copies the content of one database into another.
** It is useful either for creating backups of databases or
** for copying in-memory databases to or from persistent files. 
**
** See Also: [Using the SQLite Online Backup API]
**
** ^Exclusive access is required to the destination database for the 
** duration of the operation. ^However the source database is only
** read-locked while it is actually being read; it is not locked
** continuously for the entire backup operation. ^Thus, the backup may be
** performed on a live source database without preventing other users from
** reading or writing to the source database while the backup is underway.
** 
** ^(To perform a backup operation: 
**   <ol>
**     <li><b>sqlite3_backup_init()</b> is called once to initialize the
**         backup, 
**     <li><b>sqlite3_backup_step()</b> is called one or more times to transfer 
**         the data between the two databases, and finally
**     <li><b>sqlite3_backup_finish()</b> is called to release all resources 
**         associated with the backup operation. 
**   </ol>)^
** There should be exactly one call to sqlite3_backup_finish() for each
** successful call to sqlite3_backup_init().
**
** <b>sqlite3_backup_init()</b>
**
** ^The D and N arguments to sqlite3_backup_init(D,N,S,M) are the 
** [database connection] associated with the destination database 
** and the database name, respectively.
** ^The database name is "main" for the main database, "temp" for the
** temporary database, or the name specified after the AS keyword in
** an [ATTACH] statement for an attached database.
** ^The S and M arguments passed to 
** sqlite3_backup_init(D,N,S,M) identify the [database connection]
** and database name of the source database, respectively.
** ^The source and destination [database connections] (parameters S and D)
** must be different or else sqlite3_backup_init(D,N,S,M) will file with
** an error.
**
** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is
** returned and an error code and error message are store3d in the
** destination [database connection] D.
** ^The error code and message for the failed call to sqlite3_backup_init()
** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or
** [sqlite3_errmsg16()] functions.
** ^A successful call to sqlite3_backup_init() returns a pointer to an
** [sqlite3_backup] object.
** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and
** sqlite3_backup_finish() functions to perform the specified backup 
** operation.
**
** <b>sqlite3_backup_step()</b>
**
** ^Function sqlite3_backup_step(B,N) will copy up to N pages between 
** the source and destination databases specified by [sqlite3_backup] object B.
** ^If N is negative, all remaining source pages are copied. 
** ^If sqlite3_backup_step(B,N) successfully copies N pages and there
** are still more pages to be copied, then the function resturns [SQLITE_OK].
** ^If sqlite3_backup_step(B,N) successfully finishes copying all pages
** from source to destination, then it returns [SQLITE_DONE].
** ^If an error occurs while running sqlite3_backup_step(B,N),
** then an [error code] is returned. ^As well as [SQLITE_OK] and
** [SQLITE_DONE], a call to sqlite3_backup_step() may return [SQLITE_READONLY],
** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an
** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX] extended error code.
**
** ^(The sqlite3_backup_step() might return [SQLITE_READONLY] if
** <ol>
** <li> the destination database was opened read-only, or
** <li> the destination database is using write-ahead-log journaling
** and the destination and source page sizes differ, or
** <li> The destination database is an in-memory database and the
** destination and source page sizes differ.
** </ol>)^
**
** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then
** the [sqlite3_busy_handler | busy-handler function]
** is invoked (if one is specified). ^If the 
** busy-handler returns non-zero before the lock is available, then 
** [SQLITE_BUSY] is returned to the caller. ^In this case the call to
** sqlite3_backup_step() can be retried later. ^If the source
** [database connection]
** is being used to write to the source database when sqlite3_backup_step()
** is called, then [SQLITE_LOCKED] is returned immediately. ^Again, in this
** case the call to sqlite3_backup_step() can be retried later on. ^(If
** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX], [SQLITE_NOMEM], or
** [SQLITE_READONLY] is returned, then 
** there is no point in retrying the call to sqlite3_backup_step(). These 
** errors are considered fatal.)^  The application must accept 
** that the backup operation has failed and pass the backup operation handle 
** to the sqlite3_backup_finish() to release associated resources.
**
** ^The first call to sqlite3_backup_step() obtains an exclusive lock
** on the destination file. ^The exclusive lock is not released until either 
** sqlite3_backup_finish() is called or the backup operation is complete 
** and sqlite3_backup_step() returns [SQLITE_DONE].  ^Every call to
** sqlite3_backup_step() obtains a [shared lock] on the source database that
** lasts for the duration of the sqlite3_backup_step() call.
** ^Because the source database is not locked between calls to
** sqlite3_backup_step(), the source database may be modified mid-way
** through the backup process.  ^If the source database is modified by an
** external process or via a database connection other than the one being
** used by the backup operation, then the backup will be automatically
** restarted by the next call to sqlite3_backup_step(). ^If the source 
** database is modified by the using the same database connection as is used
** by the backup operation, then the backup database is automatically
** updated at the same time.
**
** <b>sqlite3_backup_finish()</b>
**
** When sqlite3_backup_step() has returned [SQLITE_DONE], or when the 
** application wishes to abandon the backup operation, the application
** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish().
** ^The sqlite3_backup_finish() interfaces releases all
** resources associated with the [sqlite3_backup] object. 
** ^If sqlite3_backup_step() has not yet returned [SQLITE_DONE], then any
** active write-transaction on the destination database is rolled back.
** The [sqlite3_backup] object is invalid
** and may not be used following a call to sqlite3_backup_finish().
**
** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no
** sqlite3_backup_step() errors occurred, regardless or whether or not
** sqlite3_backup_step() completed.
** ^If an out-of-memory condition or IO error occurred during any prior
** sqlite3_backup_step() call on the same [sqlite3_backup] object, then
** sqlite3_backup_finish() returns the corresponding [error code].
**
** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step()
** is not a permanent error and does not affect the return value of
** sqlite3_backup_finish().
**
** <b>sqlite3_backup_remaining(), sqlite3_backup_pagecount()</b>
**
** ^Each call to sqlite3_backup_step() sets two values inside
** the [sqlite3_backup] object: the number of pages still to be backed
** up and the total number of pages in the source databae file.
** The sqlite3_backup_remaining() and sqlite3_backup_pagecount() interfaces
** retrieve these two values, respectively.
**
** ^The values returned by these functions are only updated by
** sqlite3_backup_step(). ^If the source database is modified during a backup
** operation, then the values are not updated to account for any extra
** pages that need to be updated or the size of the source database file
** changing.
**
** <b>Concurrent Usage of Database Handles</b>
**
** ^The source [database connection] may be used by the application for other
** purposes while a backup operation is underway or being initialized.
** ^If SQLite is compiled and configured to support threadsafe database
** connections, then the source database connection may be used concurrently
** from within other threads.
**
** However, the application must guarantee that the destination 
** [database connection] is not passed to any other API (by any thread) after 
** sqlite3_backup_init() is called and before the corresponding call to
** sqlite3_backup_finish().  SQLite does not currently check to see
** if the application incorrectly accesses the destination [database connection]
** and so no error code is reported, but the operations may malfunction
** nevertheless.  Use of the destination database connection while a
** backup is in progress might also also cause a mutex deadlock.
**
** If running in [shared cache mode], the application must
** guarantee that the shared cache used by the destination database
** is not accessed while the backup is running. In practice this means
** that the application must guarantee that the disk file being 
** backed up to is not accessed by any connection within the process,
** not just the specific connection that was passed to sqlite3_backup_init().
**
** The [sqlite3_backup] object itself is partially threadsafe. Multiple 
** threads may safely make multiple concurrent calls to sqlite3_backup_step().
** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount()
** APIs are not strictly speaking threadsafe. If they are invoked at the
** same time as another thread is invoking sqlite3_backup_step() it is
** possible that they return invalid values.
*/
SQLITE_API sqlite3_backup *sqlite3_backup_init(
  sqlite3 *pDest,                        /* Destination database handle */
  const char *zDestName,                 /* Destination database name */
  sqlite3 *pSource,                      /* Source database handle */
  const char *zSourceName                /* Source database name */
);
SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage);
SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p);
SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p);
SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p);

/*
** CAPI3REF: Unlock Notification
**
** ^When running in shared-cache mode, a database operation may fail with
** an [SQLITE_LOCKED] error if the required locks on the shared-cache or
** individual tables within the shared-cache cannot be obtained. See
** [SQLite Shared-Cache Mode] for a description of shared-cache locking. 
** ^This API may be used to register a callback that SQLite will invoke 
** when the connection currently holding the required lock relinquishes it.
** ^This API is only available if the library was compiled with the
** [SQLITE_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined.
**
** See Also: [Using the SQLite Unlock Notification Feature].
**
** ^Shared-cache locks are released when a database connection concludes
** its current transaction, either by committing it or rolling it back. 
**
** ^When a connection (known as the blocked connection) fails to obtain a
** shared-cache lock and SQLITE_LOCKED is returned to the caller, the
** identity of the database connection (the blocking connection) that
** has locked the required resource is stored internally. ^After an 
** application receives an SQLITE_LOCKED error, it may call the
** sqlite3_unlock_notify() method with the blocked connection handle as 
** the first argument to register for a callback that will be invoked
** when the blocking connections current transaction is concluded. ^The
** callback is invoked from within the [sqlite3_step] or [sqlite3_close]
** call that concludes the blocking connections transaction.
**
** ^(If sqlite3_unlock_notify() is called in a multi-threaded application,
** there is a chance that the blocking connection will have already
** concluded its transaction by the time sqlite3_unlock_notify() is invoked.
** If this happens, then the specified callback is invoked immediately,
** from within the call to sqlite3_unlock_notify().)^
**
** ^If the blocked connection is attempting to obtain a write-lock on a
** shared-cache table, and more than one other connection currently holds
** a read-lock on the same table, then SQLite arbitrarily selects one of 
** the other connections to use as the blocking connection.
**
** ^(There may be at most one unlock-notify callback registered by a 
** blocked connection. If sqlite3_unlock_notify() is called when the
** blocked connection already has a registered unlock-notify callback,
** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is
** called with a NULL pointer as its second argument, then any existing
** unlock-notify callback is cancelled. ^The blocked connections 
** unlock-notify callback may also be canceled by closing the blocked
** connection using [sqlite3_close()].
**
** The unlock-notify callback is not reentrant. If an application invokes
** any sqlite3_xxx API functions from within an unlock-notify callback, a
** crash or deadlock may be the result.
**
** ^Unless deadlock is detected (see below), sqlite3_unlock_notify() always
** returns SQLITE_OK.
**
** <b>Callback Invocation Details</b>
**
** When an unlock-notify callback is registered, the application provides a 
** single void* pointer that is passed to the callback when it is invoked.
** However, the signature of the callback function allows SQLite to pass
** it an array of void* context pointers. The first argument passed to
** an unlock-notify callback is a pointer to an array of void* pointers,
** and the second is the number of entries in the array.
**
** When a blocking connections transaction is concluded, there may be
** more than one blocked connection that has registered for an unlock-notify
** callback. ^If two or more such blocked connections have specified the
** same callback function, then instead of invoking the callback function
** multiple times, it is invoked once with the set of void* context pointers
** specified by the blocked connections bundled together into an array.
** This gives the application an opportunity to prioritize any actions 
** related to the set of unblocked database connections.
**
** <b>Deadlock Detection</b>
**
** Assuming that after registering for an unlock-notify callback a 
** database waits for the callback to be issued before taking any further
** action (a reasonable assumption), then using this API may cause the
** application to deadlock. For example, if connection X is waiting for
** connection Y's transaction to be concluded, and similarly connection
** Y is waiting on connection X's transaction, then neither connection
** will proceed and the system may remain deadlocked indefinitely.
**
** To avoid this scenario, the sqlite3_unlock_notify() performs deadlock
** detection. ^If a given call to sqlite3_unlock_notify() would put the
** system in a deadlocked state, then SQLITE_LOCKED is returned and no
** unlock-notify callback is registered. The system is said to be in
** a deadlocked state if connection A has registered for an unlock-notify
** callback on the conclusion of connection B's transaction, and connection
** B has itself registered for an unlock-notify callback when connection
** A's transaction is concluded. ^Indirect deadlock is also detected, so
** the system is also considered to be deadlocked if connection B has
** registered for an unlock-notify callback on the conclusion of connection
** C's transaction, where connection C is waiting on connection A. ^Any
** number of levels of indirection are allowed.
**
** <b>The "DROP TABLE" Exception</b>
**
** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost 
** always appropriate to call sqlite3_unlock_notify(). There is however,
** one exception. When executing a "DROP TABLE" or "DROP INDEX" statement,
** SQLite checks if there are any currently executing SELECT statements
** that belong to the same connection. If there are, SQLITE_LOCKED is
** returned. In this case there is no "blocking connection", so invoking
** sqlite3_unlock_notify() results in the unlock-notify callback being
** invoked immediately. If the application then re-attempts the "DROP TABLE"
** or "DROP INDEX" query, an infinite loop might be the result.
**
** One way around this problem is to check the extended error code returned
** by an sqlite3_step() call. ^(If there is a blocking connection, then the
** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in
** the special "DROP TABLE/INDEX" case, the extended error code is just 
** SQLITE_LOCKED.)^
*/
SQLITE_API int sqlite3_unlock_notify(
  sqlite3 *pBlocked,                          /* Waiting connection */
  void (*xNotify)(void **apArg, int nArg),    /* Callback function to invoke */
  void *pNotifyArg                            /* Argument to pass to xNotify */
);


/*
** CAPI3REF: String Comparison
**
** ^The [sqlite3_strnicmp()] API allows applications and extensions to
** compare the contents of two buffers containing UTF-8 strings in a
** case-indendent fashion, using the same definition of case independence 
** that SQLite uses internally when comparing identifiers.
*/
SQLITE_API int sqlite3_strnicmp(const char *, const char *, int);

/*
** CAPI3REF: Error Logging Interface
**
** ^The [sqlite3_log()] interface writes a message into the error log
** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()].
** ^If logging is enabled, the zFormat string and subsequent arguments are
** used with [sqlite3_snprintf()] to generate the final output string.
**
** The sqlite3_log() interface is intended for use by extensions such as
** virtual tables, collating functions, and SQL functions.  While there is
** nothing to prevent an application from calling sqlite3_log(), doing so
** is considered bad form.
**
** The zFormat string must not be NULL.
**
** To avoid deadlocks and other threading problems, the sqlite3_log() routine
** will not use dynamically allocated memory.  The log message is stored in
** a fixed-length buffer on the stack.  If the log message is longer than
** a few hundred characters, it will be truncated to the length of the
** buffer.
*/
SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...);

/*
** CAPI3REF: Write-Ahead Log Commit Hook
**
** ^The [sqlite3_wal_hook()] function is used to register a callback that
** will be invoked each time a database connection commits data to a
** [write-ahead log] (i.e. whenever a transaction is committed in
** [journal_mode | journal_mode=WAL mode]). 
**
** ^The callback is invoked by SQLite after the commit has taken place and 
** the associated write-lock on the database released, so the implementation 
** may read, write or [checkpoint] the database as required.
**
** ^The first parameter passed to the callback function when it is invoked
** is a copy of the third parameter passed to sqlite3_wal_hook() when
** registering the callback. ^The second is a copy of the database handle.
** ^The third parameter is the name of the database that was written to -
** either "main" or the name of an [ATTACH]-ed database. ^The fourth parameter
** is the number of pages currently in the write-ahead log file,
** including those that were just committed.
**
** The callback function should normally return [SQLITE_OK].  ^If an error
** code is returned, that error will propagate back up through the
** SQLite code base to cause the statement that provoked the callback
** to report an error, though the commit will have still occurred. If the
** callback returns [SQLITE_ROW] or [SQLITE_DONE], or if it returns a value
** that does not correspond to any valid SQLite error code, the results
** are undefined.
**
** A single database handle may have at most a single write-ahead log callback 
** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any
** previously registered write-ahead log callback. ^Note that the
** [sqlite3_wal_autocheckpoint()] interface and the
** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will
** those overwrite any prior [sqlite3_wal_hook()] settings.
*/
SQLITE_API void *sqlite3_wal_hook(
  sqlite3*, 
  int(*)(void *,sqlite3*,const char*,int),
  void*
);

/*
** CAPI3REF: Configure an auto-checkpoint
**
** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around
** [sqlite3_wal_hook()] that causes any database on [database connection] D
** to automatically [checkpoint]
** after committing a transaction if there are N or
** more frames in the [write-ahead log] file.  ^Passing zero or 
** a negative value as the nFrame parameter disables automatic
** checkpoints entirely.
**
** ^The callback registered by this function replaces any existing callback
** registered using [sqlite3_wal_hook()].  ^Likewise, registering a callback
** using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism
** configured by this function.
**
** ^The [wal_autocheckpoint pragma] can be used to invoke this interface
** from SQL.
**
** ^Every new [database connection] defaults to having the auto-checkpoint
** enabled with a threshold of 1000 pages.  The use of this interface
** is only necessary if the default setting is found to be suboptimal
** for a particular application.
*/
SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N);

/*
** CAPI3REF: Checkpoint a database
**
** ^The [sqlite3_wal_checkpoint(D,X)] interface causes database named X
** on [database connection] D to be [checkpointed].  ^If X is NULL or an
** empty string, then a checkpoint is run on all databases of
** connection D.  ^If the database connection D is not in
** [WAL | write-ahead log mode] then this interface is a harmless no-op.
**
** ^The [wal_checkpoint pragma] can be used to invoke this interface
** from SQL.  ^The [sqlite3_wal_autocheckpoint()] interface and the
** [wal_autocheckpoint pragma] can be used to cause this interface to be
** run whenever the WAL reaches a certain size threshold.
*/
SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb);

/*
** Undo the hack that converts floating point types to integer for
** builds on processors without floating point support.
*/
#ifdef SQLITE_OMIT_FLOATING_POINT
# undef double
#endif

#ifdef __cplusplus
}  /* End of the 'extern "C"' block */
#endif
#endif

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






















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted SQLite.Interop/src/sqlite3ext.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
/*
** 2006 June 7
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This header file defines the SQLite interface for use by
** shared libraries that want to be imported as extensions into
** an SQLite instance.  Shared libraries that intend to be loaded
** as extensions by SQLite should #include this file instead of 
** sqlite3.h.
*/
#ifndef _SQLITE3EXT_H_
#define _SQLITE3EXT_H_
#include "sqlite3.h"

typedef struct sqlite3_api_routines sqlite3_api_routines;

/*
** The following structure holds pointers to all of the SQLite API
** routines.
**
** WARNING:  In order to maintain backwards compatibility, add new
** interfaces to the end of this structure only.  If you insert new
** interfaces in the middle of this structure, then older different
** versions of SQLite will not be able to load each others' shared
** libraries!
*/
struct sqlite3_api_routines {
  void * (*aggregate_context)(sqlite3_context*,int nBytes);
  int  (*aggregate_count)(sqlite3_context*);
  int  (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*));
  int  (*bind_double)(sqlite3_stmt*,int,double);
  int  (*bind_int)(sqlite3_stmt*,int,int);
  int  (*bind_int64)(sqlite3_stmt*,int,sqlite_int64);
  int  (*bind_null)(sqlite3_stmt*,int);
  int  (*bind_parameter_count)(sqlite3_stmt*);
  int  (*bind_parameter_index)(sqlite3_stmt*,const char*zName);
  const char * (*bind_parameter_name)(sqlite3_stmt*,int);
  int  (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*));
  int  (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*));
  int  (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*);
  int  (*busy_handler)(sqlite3*,int(*)(void*,int),void*);
  int  (*busy_timeout)(sqlite3*,int ms);
  int  (*changes)(sqlite3*);
  int  (*close)(sqlite3*);
  int  (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*,int eTextRep,const char*));
  int  (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*,int eTextRep,const void*));
  const void * (*column_blob)(sqlite3_stmt*,int iCol);
  int  (*column_bytes)(sqlite3_stmt*,int iCol);
  int  (*column_bytes16)(sqlite3_stmt*,int iCol);
  int  (*column_count)(sqlite3_stmt*pStmt);
  const char * (*column_database_name)(sqlite3_stmt*,int);
  const void * (*column_database_name16)(sqlite3_stmt*,int);
  const char * (*column_decltype)(sqlite3_stmt*,int i);
  const void * (*column_decltype16)(sqlite3_stmt*,int);
  double  (*column_double)(sqlite3_stmt*,int iCol);
  int  (*column_int)(sqlite3_stmt*,int iCol);
  sqlite_int64  (*column_int64)(sqlite3_stmt*,int iCol);
  const char * (*column_name)(sqlite3_stmt*,int);
  const void * (*column_name16)(sqlite3_stmt*,int);
  const char * (*column_origin_name)(sqlite3_stmt*,int);
  const void * (*column_origin_name16)(sqlite3_stmt*,int);
  const char * (*column_table_name)(sqlite3_stmt*,int);
  const void * (*column_table_name16)(sqlite3_stmt*,int);
  const unsigned char * (*column_text)(sqlite3_stmt*,int iCol);
  const void * (*column_text16)(sqlite3_stmt*,int iCol);
  int  (*column_type)(sqlite3_stmt*,int iCol);
  sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol);
  void * (*commit_hook)(sqlite3*,int(*)(void*),void*);
  int  (*complete)(const char*sql);
  int  (*complete16)(const void*sql);
  int  (*create_collation)(sqlite3*,const char*,int,void*,int(*)(void*,int,const void*,int,const void*));
  int  (*create_collation16)(sqlite3*,const void*,int,void*,int(*)(void*,int,const void*,int,const void*));
  int  (*create_function)(sqlite3*,const char*,int,int,void*,void (*xFunc)(sqlite3_context*,int,sqlite3_value**),void (*xStep)(sqlite3_context*,int,sqlite3_value**),void (*xFinal)(sqlite3_context*));
  int  (*create_function16)(sqlite3*,const void*,int,int,void*,void (*xFunc)(sqlite3_context*,int,sqlite3_value**),void (*xStep)(sqlite3_context*,int,sqlite3_value**),void (*xFinal)(sqlite3_context*));
  int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*);
  int  (*data_count)(sqlite3_stmt*pStmt);
  sqlite3 * (*db_handle)(sqlite3_stmt*);
  int (*declare_vtab)(sqlite3*,const char*);
  int  (*enable_shared_cache)(int);
  int  (*errcode)(sqlite3*db);
  const char * (*errmsg)(sqlite3*);
  const void * (*errmsg16)(sqlite3*);
  int  (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**);
  int  (*expired)(sqlite3_stmt*);
  int  (*finalize)(sqlite3_stmt*pStmt);
  void  (*free)(void*);
  void  (*free_table)(char**result);
  int  (*get_autocommit)(sqlite3*);
  void * (*get_auxdata)(sqlite3_context*,int);
  int  (*get_table)(sqlite3*,const char*,char***,int*,int*,char**);
  int  (*global_recover)(void);
  void  (*interruptx)(sqlite3*);
  sqlite_int64  (*last_insert_rowid)(sqlite3*);
  const char * (*libversion)(void);
  int  (*libversion_number)(void);
  void *(*malloc)(int);
  char * (*mprintf)(const char*,...);
  int  (*open)(const char*,sqlite3**);
  int  (*open16)(const void*,sqlite3**);
  int  (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
  int  (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
  void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*);
  void  (*progress_handler)(sqlite3*,int,int(*)(void*),void*);
  void *(*realloc)(void*,int);
  int  (*reset)(sqlite3_stmt*pStmt);
  void  (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*));
  void  (*result_double)(sqlite3_context*,double);
  void  (*result_error)(sqlite3_context*,const char*,int);
  void  (*result_error16)(sqlite3_context*,const void*,int);
  void  (*result_int)(sqlite3_context*,int);
  void  (*result_int64)(sqlite3_context*,sqlite_int64);
  void  (*result_null)(sqlite3_context*);
  void  (*result_text)(sqlite3_context*,const char*,int,void(*)(void*));
  void  (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*));
  void  (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*));
  void  (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*));
  void  (*result_value)(sqlite3_context*,sqlite3_value*);
  void * (*rollback_hook)(sqlite3*,void(*)(void*),void*);
  int  (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,const char*,const char*),void*);
  void  (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*));
  char * (*snprintf)(int,char*,const char*,...);
  int  (*step)(sqlite3_stmt*);
  int  (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,char const**,char const**,int*,int*,int*);
  void  (*thread_cleanup)(void);
  int  (*total_changes)(sqlite3*);
  void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*);
  int  (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*);
  void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*,sqlite_int64),void*);
  void * (*user_data)(sqlite3_context*);
  const void * (*value_blob)(sqlite3_value*);
  int  (*value_bytes)(sqlite3_value*);
  int  (*value_bytes16)(sqlite3_value*);
  double  (*value_double)(sqlite3_value*);
  int  (*value_int)(sqlite3_value*);
  sqlite_int64  (*value_int64)(sqlite3_value*);
  int  (*value_numeric_type)(sqlite3_value*);
  const unsigned char * (*value_text)(sqlite3_value*);
  const void * (*value_text16)(sqlite3_value*);
  const void * (*value_text16be)(sqlite3_value*);
  const void * (*value_text16le)(sqlite3_value*);
  int  (*value_type)(sqlite3_value*);
  char *(*vmprintf)(const char*,va_list);
  /* Added ??? */
  int (*overload_function)(sqlite3*, const char *zFuncName, int nArg);
  /* Added by 3.3.13 */
  int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**);
  int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**);
  int (*clear_bindings)(sqlite3_stmt*);
  /* Added by 3.4.1 */
  int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*,void (*xDestroy)(void *));
  /* Added by 3.5.0 */
  int (*bind_zeroblob)(sqlite3_stmt*,int,int);
  int (*blob_bytes)(sqlite3_blob*);
  int (*blob_close)(sqlite3_blob*);
  int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64,int,sqlite3_blob**);
  int (*blob_read)(sqlite3_blob*,void*,int,int);
  int (*blob_write)(sqlite3_blob*,const void*,int,int);
  int (*create_collation_v2)(sqlite3*,const char*,int,void*,int(*)(void*,int,const void*,int,const void*),void(*)(void*));
  int (*file_control)(sqlite3*,const char*,int,void*);
  sqlite3_int64 (*memory_highwater)(int);
  sqlite3_int64 (*memory_used)(void);
  sqlite3_mutex *(*mutex_alloc)(int);
  void (*mutex_enter)(sqlite3_mutex*);
  void (*mutex_free)(sqlite3_mutex*);
  void (*mutex_leave)(sqlite3_mutex*);
  int (*mutex_try)(sqlite3_mutex*);
  int (*open_v2)(const char*,sqlite3**,int,const char*);
  int (*release_memory)(int);
  void (*result_error_nomem)(sqlite3_context*);
  void (*result_error_toobig)(sqlite3_context*);
  int (*sleep)(int);
  void (*soft_heap_limit)(int);
  sqlite3_vfs *(*vfs_find)(const char*);
  int (*vfs_register)(sqlite3_vfs*,int);
  int (*vfs_unregister)(sqlite3_vfs*);
  int (*xthreadsafe)(void);
  void (*result_zeroblob)(sqlite3_context*,int);
  void (*result_error_code)(sqlite3_context*,int);
  int (*test_control)(int, ...);
  void (*randomness)(int,void*);
  sqlite3 *(*context_db_handle)(sqlite3_context*);
  int (*extended_result_codes)(sqlite3*,int);
  int (*limit)(sqlite3*,int,int);
  sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*);
  const char *(*sql)(sqlite3_stmt*);
  int (*status)(int,int*,int*,int);
};

/*
** The following macros redefine the API routines so that they are
** redirected throught the global sqlite3_api structure.
**
** This header file is also used by the loadext.c source file
** (part of the main SQLite library - not an extension) so that
** it can get access to the sqlite3_api_routines structure
** definition.  But the main library does not want to redefine
** the API.  So the redefinition macros are only valid if the
** SQLITE_CORE macros is undefined.
*/
#ifndef SQLITE_CORE
#define sqlite3_aggregate_context      sqlite3_api->aggregate_context
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_aggregate_count        sqlite3_api->aggregate_count
#endif
#define sqlite3_bind_blob              sqlite3_api->bind_blob
#define sqlite3_bind_double            sqlite3_api->bind_double
#define sqlite3_bind_int               sqlite3_api->bind_int
#define sqlite3_bind_int64             sqlite3_api->bind_int64
#define sqlite3_bind_null              sqlite3_api->bind_null
#define sqlite3_bind_parameter_count   sqlite3_api->bind_parameter_count
#define sqlite3_bind_parameter_index   sqlite3_api->bind_parameter_index
#define sqlite3_bind_parameter_name    sqlite3_api->bind_parameter_name
#define sqlite3_bind_text              sqlite3_api->bind_text
#define sqlite3_bind_text16            sqlite3_api->bind_text16
#define sqlite3_bind_value             sqlite3_api->bind_value
#define sqlite3_busy_handler           sqlite3_api->busy_handler
#define sqlite3_busy_timeout           sqlite3_api->busy_timeout
#define sqlite3_changes                sqlite3_api->changes
#define sqlite3_close                  sqlite3_api->close
#define sqlite3_collation_needed       sqlite3_api->collation_needed
#define sqlite3_collation_needed16     sqlite3_api->collation_needed16
#define sqlite3_column_blob            sqlite3_api->column_blob
#define sqlite3_column_bytes           sqlite3_api->column_bytes
#define sqlite3_column_bytes16         sqlite3_api->column_bytes16
#define sqlite3_column_count           sqlite3_api->column_count
#define sqlite3_column_database_name   sqlite3_api->column_database_name
#define sqlite3_column_database_name16 sqlite3_api->column_database_name16
#define sqlite3_column_decltype        sqlite3_api->column_decltype
#define sqlite3_column_decltype16      sqlite3_api->column_decltype16
#define sqlite3_column_double          sqlite3_api->column_double
#define sqlite3_column_int             sqlite3_api->column_int
#define sqlite3_column_int64           sqlite3_api->column_int64
#define sqlite3_column_name            sqlite3_api->column_name
#define sqlite3_column_name16          sqlite3_api->column_name16
#define sqlite3_column_origin_name     sqlite3_api->column_origin_name
#define sqlite3_column_origin_name16   sqlite3_api->column_origin_name16
#define sqlite3_column_table_name      sqlite3_api->column_table_name
#define sqlite3_column_table_name16    sqlite3_api->column_table_name16
#define sqlite3_column_text            sqlite3_api->column_text
#define sqlite3_column_text16          sqlite3_api->column_text16
#define sqlite3_column_type            sqlite3_api->column_type
#define sqlite3_column_value           sqlite3_api->column_value
#define sqlite3_commit_hook            sqlite3_api->commit_hook
#define sqlite3_complete               sqlite3_api->complete
#define sqlite3_complete16             sqlite3_api->complete16
#define sqlite3_create_collation       sqlite3_api->create_collation
#define sqlite3_create_collation16     sqlite3_api->create_collation16
#define sqlite3_create_function        sqlite3_api->create_function
#define sqlite3_create_function16      sqlite3_api->create_function16
#define sqlite3_create_module          sqlite3_api->create_module
#define sqlite3_create_module_v2       sqlite3_api->create_module_v2
#define sqlite3_data_count             sqlite3_api->data_count
#define sqlite3_db_handle              sqlite3_api->db_handle
#define sqlite3_declare_vtab           sqlite3_api->declare_vtab
#define sqlite3_enable_shared_cache    sqlite3_api->enable_shared_cache
#define sqlite3_errcode                sqlite3_api->errcode
#define sqlite3_errmsg                 sqlite3_api->errmsg
#define sqlite3_errmsg16               sqlite3_api->errmsg16
#define sqlite3_exec                   sqlite3_api->exec
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_expired                sqlite3_api->expired
#endif
#define sqlite3_finalize               sqlite3_api->finalize
#define sqlite3_free                   sqlite3_api->free
#define sqlite3_free_table             sqlite3_api->free_table
#define sqlite3_get_autocommit         sqlite3_api->get_autocommit
#define sqlite3_get_auxdata            sqlite3_api->get_auxdata
#define sqlite3_get_table              sqlite3_api->get_table
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_global_recover         sqlite3_api->global_recover
#endif
#define sqlite3_interrupt              sqlite3_api->interruptx
#define sqlite3_last_insert_rowid      sqlite3_api->last_insert_rowid
#define sqlite3_libversion             sqlite3_api->libversion
#define sqlite3_libversion_number      sqlite3_api->libversion_number
#define sqlite3_malloc                 sqlite3_api->malloc
#define sqlite3_mprintf                sqlite3_api->mprintf
#define sqlite3_open                   sqlite3_api->open
#define sqlite3_open16                 sqlite3_api->open16
#define sqlite3_prepare                sqlite3_api->prepare
#define sqlite3_prepare16              sqlite3_api->prepare16
#define sqlite3_prepare_v2             sqlite3_api->prepare_v2
#define sqlite3_prepare16_v2           sqlite3_api->prepare16_v2
#define sqlite3_profile                sqlite3_api->profile
#define sqlite3_progress_handler       sqlite3_api->progress_handler
#define sqlite3_realloc                sqlite3_api->realloc
#define sqlite3_reset                  sqlite3_api->reset
#define sqlite3_result_blob            sqlite3_api->result_blob
#define sqlite3_result_double          sqlite3_api->result_double
#define sqlite3_result_error           sqlite3_api->result_error
#define sqlite3_result_error16         sqlite3_api->result_error16
#define sqlite3_result_int             sqlite3_api->result_int
#define sqlite3_result_int64           sqlite3_api->result_int64
#define sqlite3_result_null            sqlite3_api->result_null
#define sqlite3_result_text            sqlite3_api->result_text
#define sqlite3_result_text16          sqlite3_api->result_text16
#define sqlite3_result_text16be        sqlite3_api->result_text16be
#define sqlite3_result_text16le        sqlite3_api->result_text16le
#define sqlite3_result_value           sqlite3_api->result_value
#define sqlite3_rollback_hook          sqlite3_api->rollback_hook
#define sqlite3_set_authorizer         sqlite3_api->set_authorizer
#define sqlite3_set_auxdata            sqlite3_api->set_auxdata
#define sqlite3_snprintf               sqlite3_api->snprintf
#define sqlite3_step                   sqlite3_api->step
#define sqlite3_table_column_metadata  sqlite3_api->table_column_metadata
#define sqlite3_thread_cleanup         sqlite3_api->thread_cleanup
#define sqlite3_total_changes          sqlite3_api->total_changes
#define sqlite3_trace                  sqlite3_api->trace
#ifndef SQLITE_OMIT_DEPRECATED
#define sqlite3_transfer_bindings      sqlite3_api->transfer_bindings
#endif
#define sqlite3_update_hook            sqlite3_api->update_hook
#define sqlite3_user_data              sqlite3_api->user_data
#define sqlite3_value_blob             sqlite3_api->value_blob
#define sqlite3_value_bytes            sqlite3_api->value_bytes
#define sqlite3_value_bytes16          sqlite3_api->value_bytes16
#define sqlite3_value_double           sqlite3_api->value_double
#define sqlite3_value_int              sqlite3_api->value_int
#define sqlite3_value_int64            sqlite3_api->value_int64
#define sqlite3_value_numeric_type     sqlite3_api->value_numeric_type
#define sqlite3_value_text             sqlite3_api->value_text
#define sqlite3_value_text16           sqlite3_api->value_text16
#define sqlite3_value_text16be         sqlite3_api->value_text16be
#define sqlite3_value_text16le         sqlite3_api->value_text16le
#define sqlite3_value_type             sqlite3_api->value_type
#define sqlite3_vmprintf               sqlite3_api->vmprintf
#define sqlite3_overload_function      sqlite3_api->overload_function
#define sqlite3_prepare_v2             sqlite3_api->prepare_v2
#define sqlite3_prepare16_v2           sqlite3_api->prepare16_v2
#define sqlite3_clear_bindings         sqlite3_api->clear_bindings
#define sqlite3_bind_zeroblob          sqlite3_api->bind_zeroblob
#define sqlite3_blob_bytes             sqlite3_api->blob_bytes
#define sqlite3_blob_close             sqlite3_api->blob_close
#define sqlite3_blob_open              sqlite3_api->blob_open
#define sqlite3_blob_read              sqlite3_api->blob_read
#define sqlite3_blob_write             sqlite3_api->blob_write
#define sqlite3_create_collation_v2    sqlite3_api->create_collation_v2
#define sqlite3_file_control           sqlite3_api->file_control
#define sqlite3_memory_highwater       sqlite3_api->memory_highwater
#define sqlite3_memory_used            sqlite3_api->memory_used
#define sqlite3_mutex_alloc            sqlite3_api->mutex_alloc
#define sqlite3_mutex_enter            sqlite3_api->mutex_enter
#define sqlite3_mutex_free             sqlite3_api->mutex_free
#define sqlite3_mutex_leave            sqlite3_api->mutex_leave
#define sqlite3_mutex_try              sqlite3_api->mutex_try
#define sqlite3_open_v2                sqlite3_api->open_v2
#define sqlite3_release_memory         sqlite3_api->release_memory
#define sqlite3_result_error_nomem     sqlite3_api->result_error_nomem
#define sqlite3_result_error_toobig    sqlite3_api->result_error_toobig
#define sqlite3_sleep                  sqlite3_api->sleep
#define sqlite3_soft_heap_limit        sqlite3_api->soft_heap_limit
#define sqlite3_vfs_find               sqlite3_api->vfs_find
#define sqlite3_vfs_register           sqlite3_api->vfs_register
#define sqlite3_vfs_unregister         sqlite3_api->vfs_unregister
#define sqlite3_threadsafe             sqlite3_api->xthreadsafe
#define sqlite3_result_zeroblob        sqlite3_api->result_zeroblob
#define sqlite3_result_error_code      sqlite3_api->result_error_code
#define sqlite3_test_control           sqlite3_api->test_control
#define sqlite3_randomness             sqlite3_api->randomness
#define sqlite3_context_db_handle      sqlite3_api->context_db_handle
#define sqlite3_extended_result_codes  sqlite3_api->extended_result_codes
#define sqlite3_limit                  sqlite3_api->limit
#define sqlite3_next_stmt              sqlite3_api->next_stmt
#define sqlite3_sql                    sqlite3_api->sql
#define sqlite3_status                 sqlite3_api->status
#endif /* SQLITE_CORE */

#define SQLITE_EXTENSION_INIT1     const sqlite3_api_routines *sqlite3_api = 0;
#define SQLITE_EXTENSION_INIT2(v)  sqlite3_api = v;

#endif /* _SQLITE3EXT_H_ */
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































































































































































































































































































































































































































































































































































































Added SQLite.Interop/src/win/AssemblyInfo.cpp.



























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * AssemblyInfo.cpp -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 */

using namespace System::Reflection;
using namespace System::Resources;
using namespace System::Runtime::InteropServices;

#include "../generic/interop.h"

[assembly:AssemblyTitleAttribute("SQLite.Interop")];
[assembly:AssemblyCompanyAttribute("https://system.data.sqlite.org/")];
[assembly:AssemblyDescriptionAttribute("System.Data.SQLite Interop Assembly")];
[assembly:AssemblyProductAttribute("System.Data.SQLite")];
[assembly:AssemblyCopyrightAttribute("Public Domain")];
[assembly:AssemblyVersionAttribute(INTEROP_VERSION)];
[assembly:AssemblyFileVersionAttribute(INTEROP_VERSION)];

#if DEBUG
[assembly:AssemblyConfiguration("Debug")];
#else
[assembly:AssemblyConfiguration("Release")];
#endif

[assembly:NeutralResourcesLanguage("en-US")];
[assembly:ComVisible(false)];

Added SQLite.Interop/src/win/SQLite.Interop.rc.















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
 * SQLite.Interop.rc -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 */

#if !defined(_WIN32_WCE)
#include "winresrc.h"
#else
#include "windows.h"
#endif /* !defined(_WIN32_WCE) */

#if !defined(VS_FF_NONE)
#  define VS_FF_NONE            0x00000000L
#endif /* !defined(VS_FF_NONE) */

#include "..\core\sqlite3.h"
#include "..\generic\interop.h"

/*
** English (U.S.) resources
*/

#if defined(_WIN32)
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif /* defined(_WIN32) */

/*
** Version
*/

VS_VERSION_INFO VERSIONINFO
 FILEVERSION INTEROP_RC_VERSION
 PRODUCTVERSION INTEROP_RC_VERSION
 FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#if defined(_DEBUG)
 FILEFLAGS VS_FF_DEBUG
#else
 FILEFLAGS VS_FF_NONE
#endif /* defined(_DEBUG) */
 FILEOS VOS__WINDOWS32
 FILETYPE VFT_DLL
 FILESUBTYPE VFT2_UNKNOWN
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "CompanyName", "Robert Simpson, et al."
            VALUE "FileDescription", "System.Data.SQLite Interop Assembly"
            VALUE "FileVersion", INTEROP_VERSION
            VALUE "InternalName", "SQLite.Interop"
            VALUE "LegalCopyright", "Public Domain"
            VALUE "OriginalFilename", "SQLite.Interop.dll"
            VALUE "ProductName", "System.Data.SQLite"
            VALUE "ProductVersion", INTEROP_VERSION
            VALUE "SourceId", INTEROP_SOURCE_ID " " INTEROP_SOURCE_TIMESTAMP
            VALUE "SQLiteCompanyName", "D. Richard Hipp, et al."
            VALUE "SQLiteDescription", "SQLite Database Engine"
            VALUE "SQLiteCopyright", "https://www.sqlite.org/copyright.html"
            VALUE "SQLiteVersion", SQLITE_VERSION
            VALUE "SQLiteSourceId", SQLITE_SOURCE_ID
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 0x4b0
    END
END

Added SQLite.Interop/src/win/crypt.c.





















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

#ifndef SQLITE_OMIT_DISKIO
#ifdef SQLITE_HAS_CODEC

#include <windows.h>
#include <wincrypt.h>

/* Extra padding before and after the cryptographic buffer */
#define CRYPT_OFFSET 8

typedef struct _CRYPTBLOCK
{
  Pager    *pPager;       /* Pager this cryptblock belongs to */
  HCRYPTKEY hReadKey;     /* Key used to read from the database and write to the journal */
  HCRYPTKEY hWriteKey;    /* Key used to write to the database */
  DWORD     dwPageSize;   /* Size of pages */
  LPVOID    pvCrypt;      /* A buffer for encrypting/decrypting (if necessary) */
  DWORD     dwCryptSize;  /* Equal to or greater than dwPageSize.  If larger, pvCrypt is valid and this is its size */
} CRYPTBLOCK, *LPCRYPTBLOCK;

#define CRYPT_PAGE1_UNKNOWN  (0)
#define CRYPT_PAGE1_ENABLED  (1)
#define CRYPT_PAGE1_DISABLED (2)

BOOL g_bEncryptPage1 = CRYPT_PAGE1_UNKNOWN;

HCRYPTPROV g_hProvider = 0; /* Global instance of the cryptographic provider */

#define SQLITECRYPTERROR_PROVIDER "Cryptographic provider not available"

/* Needed for re-keying */
static void * sqlite3pager_get_codecarg(Pager *pPager)
{
  return (pPager->xCodec) ? pPager->pCodec: NULL;
}

/* Create a cryptographic context.  Use the enhanced provider because it is available on
** most platforms
*/
static BOOL InitializeProvider()
{
  MUTEX_LOGIC( sqlite3_mutex *pMaster = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER); )
  sqlite3_mutex_enter(pMaster);

  if (g_hProvider)
  {
    sqlite3_mutex_leave(pMaster);
    return TRUE;
  }

  if (!CryptAcquireContext(&g_hProvider, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
  {
    sqlite3_mutex_leave(pMaster);
    return FALSE;
  }

  sqlite3_mutex_leave(pMaster);
  return TRUE;
}

/* Create or update a cryptographic context for a pager.
** This function will automatically determine if the encryption algorithm requires
** extra padding, and if it does, will create a temp buffer big enough to provide
** space to hold it.
*/
static LPCRYPTBLOCK CreateCryptBlock(HCRYPTKEY hKey, Pager *pager, int pageSize, LPCRYPTBLOCK pExisting)
{
  LPCRYPTBLOCK pBlock;

  if (!pExisting) /* Creating a new cryptblock */
  {
    pBlock = sqlite3_malloc(sizeof(CRYPTBLOCK));
    if (!pBlock) return NULL;

    ZeroMemory(pBlock, sizeof(CRYPTBLOCK));
    pBlock->hReadKey = hKey;
    pBlock->hWriteKey = hKey;
  }
  else /* Updating an existing cryptblock */
  {
    pBlock = pExisting;
  }

  if (pageSize == -1)
    pageSize = pager->pageSize;

  pBlock->pPager = pager;
  pBlock->dwPageSize = (DWORD)pageSize;
  pBlock->dwCryptSize = pBlock->dwPageSize;

  /* Existing cryptblocks may have a buffer, if so, delete it */
  if (pBlock->pvCrypt)
  {
    sqlite3_free(pBlock->pvCrypt);
    pBlock->pvCrypt = NULL;
  }

  /* Figure out how big to make our spare crypt block */
  CryptEncrypt(hKey, 0, TRUE, 0, NULL, &pBlock->dwCryptSize, pBlock->dwCryptSize * 2);
  pBlock->pvCrypt = sqlite3_malloc(pBlock->dwCryptSize + (CRYPT_OFFSET * 2));
  if (!pBlock->pvCrypt)
  {
    /* We created a new block in here, so free it.  Otherwise leave the original intact */
    if (pBlock != pExisting)
      sqlite3_free(pBlock);

    return NULL;
  }

  return pBlock;
}

/* Destroy a cryptographic context and any buffers and keys allocated therein */
static void sqlite3CodecFree(LPVOID pv)
{
  LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)pv;
  /* Destroy the read key if there is one */
  if (pBlock->hReadKey)
  {
    CryptDestroyKey(pBlock->hReadKey);
  }

  /* If there's a writekey and its not equal to the readkey, destroy it */
  if (pBlock->hWriteKey && pBlock->hWriteKey != pBlock->hReadKey)
  {
    CryptDestroyKey(pBlock->hWriteKey);
  }

  /* If there's extra buffer space allocated, free it as well */
  if (pBlock->pvCrypt)
  {
    sqlite3_free(pBlock->pvCrypt);
  }

  /* All done with this cryptblock */
  sqlite3_free(pBlock);
}

void sqlite3CodecSizeChange(void *pArg, int pageSize, int reservedSize)
{
  LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)pArg;

  if (pBlock->dwPageSize != pageSize)
  {
    CreateCryptBlock(pBlock->hReadKey, pBlock->pPager, pageSize, pBlock);
    /* If this fails, pvCrypt will be NULL, and the next time sqlite3Codec() is called, it will result in an error */
  }
}

/* Encrypt/Decrypt functionality, called by pager.c */
static void *sqlite3Codec(void *pArg, void *data, Pgno nPageNum, int nMode)
{
  LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)pArg;
  DWORD dwPageSize;
  LPVOID pvTemp = NULL;

  if (g_bEncryptPage1 == CRYPT_PAGE1_UNKNOWN)
  {
    WCHAR aBuf[2];
    memset(aBuf, 0, sizeof(aBuf));
    if ((GetEnvironmentVariableW(L"SQLite_LegacyEncryptPage1", aBuf, sizeof(aBuf)) != 0)
     || (GetLastError() != ERROR_ENVVAR_NOT_FOUND))
    {
      g_bEncryptPage1 = CRYPT_PAGE1_ENABLED;
    } else {
      g_bEncryptPage1 = CRYPT_PAGE1_DISABLED;
    }
  }

  if (!pBlock) return data;
  if (g_bEncryptPage1 == CRYPT_PAGE1_DISABLED)
  {
    if (nPageNum == 1) // BUGFIX: Skip first page as it contains metadata
                       //         necessary to initialize the pager.  For
                       //         backward compatibility, decrypt page #1
                       //         for any existing databases.
    {
      //
      // NOTE: If this is page #1 and it starts with the file header, it
      //       should not be encrypted; so, do nothing to it; otherwise,
      //       it is encrypted and must be decrypted.
      //
      if (memcmp(data, zMagicHeader, sizeof(zMagicHeader)) == 0)
      {
        return data;
      }
    }
  }
  if (pBlock->pvCrypt == NULL) return NULL; /* This only happens if CreateCryptBlock() failed to make scratch space */

  switch(nMode)
  {
  case 0: /* Undo a "case 7" journal file encryption */
  case 2: /* Reload a page */
  case 3: /* Load a page */
    if (!pBlock->hReadKey) break;

    /* Block ciphers often need to write extra padding beyond the
    data block.  We don't have that luxury for a given page of data so
    we must copy the page data to a buffer that IS large enough to hold
    the padding.  We then encrypt the block and write the buffer back to
    the page without the unnecessary padding.
    We only use the special block of memory if its absolutely necessary. */
    if (pBlock->dwCryptSize != pBlock->dwPageSize)
    {
      CopyMemory(((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET, data, pBlock->dwPageSize);
      pvTemp = data;
      data = ((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET;
    }

    dwPageSize = pBlock->dwCryptSize;
    CryptDecrypt(pBlock->hReadKey, 0, TRUE, 0, (LPBYTE)data, &dwPageSize);

    /* If the encryption algorithm required extra padding and we were forced to encrypt or
    ** decrypt a copy of the page data to a temp buffer, then write the contents of the temp
    ** buffer back to the page data minus any padding applied.
    */
    if (pBlock->dwCryptSize != pBlock->dwPageSize)
    {
      CopyMemory(pvTemp, data, pBlock->dwPageSize);
      data = pvTemp;
    }
    break;
  case 6: /* Encrypt a page for the main database file */
    if (!pBlock->hWriteKey) break;

    CopyMemory(((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET, data, pBlock->dwPageSize);
    data = ((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET;

    dwPageSize = pBlock->dwPageSize;
    CryptEncrypt(pBlock->hWriteKey, 0, TRUE, 0, ((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET, &dwPageSize, pBlock->dwCryptSize);
    break;
  case 7: /* Encrypt a page for the journal file */
    /* Under normal circumstances, the readkey is the same as the writekey.  However,
    when the database is being rekeyed, the readkey is not the same as the writekey.
    The rollback journal must be written using the original key for the
    database file because it is, by nature, a rollback journal.
    Therefore, for case 7, when the rollback is being written, always encrypt using
    the database's readkey, which is guaranteed to be the same key that was used to
    read the original data.
    */
    if (!pBlock->hReadKey) break;

    CopyMemory(((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET, data, pBlock->dwPageSize);
    data = ((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET;

    dwPageSize = pBlock->dwPageSize;
    CryptEncrypt(pBlock->hReadKey, 0, TRUE, 0, ((LPBYTE)pBlock->pvCrypt) + CRYPT_OFFSET, &dwPageSize, pBlock->dwCryptSize);
    break;
  }

  return data;
}

/* Derive an encryption key from a user-supplied buffer */
static HCRYPTKEY DeriveKey(const void *pKey, int nKey)
{
  HCRYPTHASH hHash = 0;
  HCRYPTKEY  hKey;

  if (!pKey || !nKey) return 0;

  if (!InitializeProvider())
  {
    return MAXDWORD;
  }

  {
    MUTEX_LOGIC( sqlite3_mutex *pMaster = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER); )
    sqlite3_mutex_enter(pMaster);

    if (CryptCreateHash(g_hProvider, CALG_SHA1, 0, 0, &hHash))
    {
      if (CryptHashData(hHash, (LPBYTE)pKey, nKey, 0))
      {
        CryptDeriveKey(g_hProvider, CALG_RC4, hHash, 0, &hKey);
      }
      CryptDestroyHash(hHash);
    }

    sqlite3_mutex_leave(pMaster);
  }

  return hKey;
}

/* Called by sqlite and sqlite3_key_interop to attach a key to a database. */
int sqlite3CodecAttach(sqlite3 *db, int nDb, const void *pKey, int nKeyLen)
{
  int rc = SQLITE_ERROR;
  HCRYPTKEY hKey = 0;

  /* No key specified, could mean either use the main db's encryption or no encryption */
  if (!pKey || !nKeyLen)
  {
    if (!nDb)
    {
      return SQLITE_OK; /* Main database, no key specified so not encrypted */
    }
    else /* Attached database, use the main database's key */
    {
      /* Get the encryption block for the main database and attempt to duplicate the key
      ** for use by the attached database
      */
      Pager *p = sqlite3BtreePager(db->aDb[0].pBt);
      LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)sqlite3pager_get_codecarg(p);

      if (!pBlock) return SQLITE_OK; /* Main database is not encrypted so neither will be any attached database */
      if (!pBlock->hReadKey) return SQLITE_OK; /* Not encrypted */

      if (!CryptDuplicateKey(pBlock->hReadKey, NULL, 0, &hKey))
        return rc; /* Unable to duplicate the key */
    }
  }
  else /* User-supplied passphrase, so create a cryptographic key out of it */
  {
    hKey = DeriveKey(pKey, nKeyLen);
    if (hKey == MAXDWORD)
    {
#if SQLITE_VERSION_NUMBER >= 3008007
      sqlite3ErrorWithMsg(db, rc, SQLITECRYPTERROR_PROVIDER);
#else
      sqlite3Error(db, rc, SQLITECRYPTERROR_PROVIDER);
#endif
      return rc;
    }
  }

  /* Create a new encryption block and assign the codec to the new attached database */
  if (hKey)
  {
    Pager *p = sqlite3BtreePager(db->aDb[nDb].pBt);
    LPCRYPTBLOCK pBlock = CreateCryptBlock(hKey, p, -1, NULL);
    if (!pBlock) return SQLITE_NOMEM;

    sqlite3PagerSetCodec(p, sqlite3Codec, sqlite3CodecSizeChange, sqlite3CodecFree, pBlock);

    rc = SQLITE_OK;
  }
  return rc;
}

/* Once a password has been supplied and a key created, we don't keep the
** original password for security purposes.  Therefore return NULL.
*/
void sqlite3CodecGetKey(sqlite3 *db, int nDb, void **ppKey, int *pnKeyLen)
{
  Btree *pbt = db->aDb[0].pBt;
  Pager *p = sqlite3BtreePager(pbt);
  LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)sqlite3pager_get_codecarg(p);

  if (ppKey) *ppKey = 0;
  if (pnKeyLen) *pnKeyLen = pBlock ? 1: 0;
}

SQLITE_API void sqlite3_activate_see(const char *info)
{
}

/* We do not attach this key to the temp store, only the main database. */
SQLITE_API int sqlite3_key_v2(sqlite3 *db, const char *zDbName, const void *pKey, int nKey)
{
  return sqlite3CodecAttach(db, 0, pKey, nKey);
}

SQLITE_API int sqlite3_key(sqlite3 *db, const void *pKey, int nKey)
{
  return sqlite3_key_v2(db, 0, pKey, nKey);
}

SQLITE_API int sqlite3_rekey(sqlite3 *db, const void *pKey, int nKey)
{
  return sqlite3_rekey_v2(db, 0, pKey, nKey);
}

/* Changes the encryption key for an existing database. */
SQLITE_API int sqlite3_rekey_v2(sqlite3 *db, const char *zDbName, const void *pKey, int nKey)
{
  Btree *pbt = db->aDb[0].pBt;
  Pager *p = sqlite3BtreePager(pbt);
  LPCRYPTBLOCK pBlock = (LPCRYPTBLOCK)sqlite3pager_get_codecarg(p);
  HCRYPTKEY hKey = DeriveKey(pKey, nKey);
  int rc = SQLITE_ERROR;

  if (hKey == MAXDWORD)
  {
#if SQLITE_VERSION_NUMBER >= 3008007
    sqlite3ErrorWithMsg(db, rc, SQLITECRYPTERROR_PROVIDER);
#else
    sqlite3Error(db, rc, SQLITECRYPTERROR_PROVIDER);
#endif
    return rc;
  }

  if (!pBlock && !hKey) return SQLITE_OK; /* Wasn't encrypted to begin with */

  /* To rekey a database, we change the writekey for the pager.  The readkey remains
  ** the same
  */
  if (!pBlock) /* Encrypt an unencrypted database */
  {
    pBlock = CreateCryptBlock(hKey, p, -1, NULL);
    if (!pBlock)
      return SQLITE_NOMEM;

    pBlock->hReadKey = 0; /* Original database is not encrypted */
    sqlite3PagerSetCodec(sqlite3BtreePager(pbt), sqlite3Codec, sqlite3CodecSizeChange, sqlite3CodecFree, pBlock);
  }
  else /* Change the writekey for an already-encrypted database */
  {
    pBlock->hWriteKey = hKey;
  }

  sqlite3_mutex_enter(db->mutex);

  /* Start a transaction */
#if SQLITE_VERSION_NUMBER >= 3025000
  rc = sqlite3BtreeBeginTrans(pbt, 1, 0);
#else
  rc = sqlite3BtreeBeginTrans(pbt, 1);
#endif

  if (!rc)
  {
    /* Rewrite all the pages in the database using the new encryption key */
    Pgno nPage;
    Pgno nSkip = PAGER_MJ_PGNO(p);
    DbPage *pPage;
    Pgno n;
    int count;

    sqlite3PagerPagecount(p, &count);
    nPage = (Pgno)count;

    for(n = 1; n <= nPage; n ++)
    {
      if (n == nSkip) continue;
      rc = INTEROP_CODEC_GET_PAGER(p, n, &pPage);
      if(!rc)
      {
        rc = sqlite3PagerWrite(pPage);
        sqlite3PagerUnref(pPage);
      }
    }
  }

  /* If we succeeded, try and commit the transaction */
  if (!rc)
  {
    rc = sqlite3BtreeCommit(pbt);
  }

  // If we failed, rollback */
  if (rc)
  {
#if SQLITE_VERSION_NUMBER >= 3008007
    sqlite3BtreeRollback(pbt, SQLITE_OK, 0);
#else
    sqlite3BtreeRollback(pbt, SQLITE_OK);
#endif
  }

  /* If we succeeded, destroy any previous read key this database used
  ** and make the readkey equal to the writekey
  */
  if (!rc)
  {
    if (pBlock->hReadKey)
    {
      CryptDestroyKey(pBlock->hReadKey);
    }
    pBlock->hReadKey = pBlock->hWriteKey;
  }
  /* We failed.  Destroy the new writekey (if there was one) and revert it back to
  ** the original readkey
  */
  else
  {
    if (pBlock->hWriteKey)
    {
      CryptDestroyKey(pBlock->hWriteKey);
    }
    pBlock->hWriteKey = pBlock->hReadKey;
  }

  /* If the readkey and writekey are both empty, there's no need for a codec on this
  ** pager anymore.  Destroy the crypt block and remove the codec from the pager.
  */
  if (!pBlock->hReadKey && !pBlock->hWriteKey)
  {
    sqlite3PagerSetCodec(p, NULL, NULL, NULL, NULL);
  }

  sqlite3_mutex_leave(db->mutex);

  return rc;
}

#endif /* SQLITE_HAS_CODEC */
#endif /* SQLITE_OMIT_DISKIO */

Added SQLite.NET.2005.MSBuild.sln.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = preProject
		data\exclude_bin.txt = data\exclude_bin.txt
		data\exclude_src.txt = data\exclude_src.txt
		Keys\System.Data.SQLite.CF.snk = Keys\System.Data.SQLite.CF.snk
		Keys\System.Data.SQLite.snk = Keys\System.Data.SQLite.snk
		NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\content\config.install.xdt = NuGet\shared\Core\content\config.install.xdt
		NuGet\shared\Core\content\config.transform = NuGet\shared\Core\content\config.transform
		NuGet\net40\EF6\content\config.transform = NuGet\net40\EF6\content\config.transform
		NuGet\net40\EF6\tools\provider.ps1 = NuGet\net40\EF6\tools\provider.ps1
		NuGet\SQLite.Core.nuspec = NuGet\SQLite.Core.nuspec
		NuGet\SQLite.Core.Beta.nuspec = NuGet\SQLite.Core.Beta.nuspec
		NuGet\SQLite.Core.NetFramework.nuspec = NuGet\SQLite.Core.NetFramework.nuspec
		NuGet\SQLite.Core.NetStandard.nuspec = NuGet\SQLite.Core.NetStandard.nuspec
		NuGet\SQLite.Core.Test.nuspec = NuGet\SQLite.Core.Test.nuspec
		NuGet\SQLite.Core.MSIL.nuspec = NuGet\SQLite.Core.MSIL.nuspec
		NuGet\SQLite.Core.MSIL.Beta.nuspec = NuGet\SQLite.Core.MSIL.Beta.nuspec
		NuGet\SQLite.Core.MSIL.Test.nuspec = NuGet\SQLite.Core.MSIL.Test.nuspec
		NuGet\SQLite.EF6.nuspec = NuGet\SQLite.EF6.nuspec
		NuGet\SQLite.EF6.Beta.nuspec = NuGet\SQLite.EF6.Beta.nuspec
		NuGet\SQLite.EF6.Test.nuspec = NuGet\SQLite.EF6.Test.nuspec
		NuGet\SQLite.Linq.nuspec = NuGet\SQLite.Linq.nuspec
		NuGet\SQLite.Linq.Beta.nuspec = NuGet\SQLite.Linq.Beta.nuspec
		NuGet\SQLite.Linq.Test.nuspec = NuGet\SQLite.Linq.Test.nuspec
		NuGet\SQLite.MSIL.nuspec = NuGet\SQLite.MSIL.nuspec
		NuGet\SQLite.MSIL.Beta.nuspec = NuGet\SQLite.MSIL.Beta.nuspec
		NuGet\SQLite.MSIL.Test.nuspec = NuGet\SQLite.MSIL.Test.nuspec
		NuGet\SQLite.nuspec = NuGet\SQLite.nuspec
		NuGet\SQLite.Beta.nuspec = NuGet\SQLite.Beta.nuspec
		NuGet\SQLite.Test.nuspec = NuGet\SQLite.Test.nuspec
		NuGet\SQLite.x64.nuspec = NuGet\SQLite.x64.nuspec
		NuGet\SQLite.x86.nuspec = NuGet\SQLite.x86.nuspec
		readme.htm = readme.htm
		System.Data.SQLite\Targets\System.Data.SQLite.Files.targets = System.Data.SQLite\Targets\System.Data.SQLite.Files.targets
		System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets = System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets
		System.Data.SQLite\Targets\System.Data.SQLite.References.targets = System.Data.SQLite\Targets\System.Data.SQLite.References.targets
		Targets\SQLite.NET.Mono.Settings.targets = Targets\SQLite.NET.Mono.Settings.targets
		Targets\SQLite.NET.NetStandard20.Settings.targets = Targets\SQLite.NET.NetStandard20.Settings.targets
		Targets\SQLite.NET.NetStandard21.Settings.targets = Targets\SQLite.NET.NetStandard21.Settings.targets
		Targets\SQLite.NET.Platform.Settings.targets = Targets\SQLite.NET.Platform.Settings.targets
		Targets\SQLite.NET.Settings.targets = Targets\SQLite.NET.Settings.targets
		Targets\SQLite.NET.Settings.targets.netFx35 = Targets\SQLite.NET.Settings.targets.netFx35
		Targets\SQLite.NET.Settings.targets.netFx40 = Targets\SQLite.NET.Settings.targets.netFx40
		Targets\SQLite.NET.targets = Targets\SQLite.NET.targets
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.2005", "System.Data.SQLite\System.Data.SQLite.2005.csproj", "{AC139952-261A-4463-B6FA-AEBC25283A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Module.2005", "System.Data.SQLite\System.Data.SQLite.Module.2005.csproj", "{AC139952-261A-4463-B6FA-AEBC25284A66}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.2005", "SQLite.Interop\SQLite.Interop.2005.vcproj", "{53784BC1-A8BC-4AC8-8A3E-158D6807345A}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.Static.2005", "SQLite.Interop\SQLite.Interop.Static.2005.vcproj", "{490CBC51-A3B2-4397-89F9-16E858DCB4F8}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Designer.2005", "SQLite.Designer\SQLite.Designer.2005.csproj", "{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Installer.2005", "tools\install\Installer.2005.csproj", "{A41FE2A5-07AD-4CE7-B836-1544634816F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test.2005", "test\test.2005.csproj", "{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Compact.2005", "System.Data.SQLite\System.Data.SQLite.Compact.2005.csproj", "{AC139951-261A-4463-B6FA-AEBC25283A66}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.CE.2005", "SQLite.Interop\SQLite.Interop.CE.2005.vcproj", "{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testce.2005", "testce\testce.2005.csproj", "{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|Pocket PC 2003 (ARMV4) = Debug|Pocket PC 2003 (ARMV4)
		Debug|Win32 = Debug|Win32
		Debug|x64 = Debug|x64
		DebugManagedOnly|Any CPU = DebugManagedOnly|Any CPU
		DebugManagedOnly|Mixed Platforms = DebugManagedOnly|Mixed Platforms
		DebugManagedOnly|Pocket PC 2003 (ARMV4) = DebugManagedOnly|Pocket PC 2003 (ARMV4)
		DebugManagedOnly|Win32 = DebugManagedOnly|Win32
		DebugManagedOnly|x64 = DebugManagedOnly|x64
		DebugNativeOnly|Any CPU = DebugNativeOnly|Any CPU
		DebugNativeOnly|Mixed Platforms = DebugNativeOnly|Mixed Platforms
		DebugNativeOnly|Pocket PC 2003 (ARMV4) = DebugNativeOnly|Pocket PC 2003 (ARMV4)
		DebugNativeOnly|Win32 = DebugNativeOnly|Win32
		DebugNativeOnly|x64 = DebugNativeOnly|x64
		Release|Any CPU = Release|Any CPU
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|Pocket PC 2003 (ARMV4) = Release|Pocket PC 2003 (ARMV4)
		Release|Win32 = Release|Win32
		Release|x64 = Release|x64
		ReleaseManagedOnly|Any CPU = ReleaseManagedOnly|Any CPU
		ReleaseManagedOnly|Mixed Platforms = ReleaseManagedOnly|Mixed Platforms
		ReleaseManagedOnly|Pocket PC 2003 (ARMV4) = ReleaseManagedOnly|Pocket PC 2003 (ARMV4)
		ReleaseManagedOnly|Win32 = ReleaseManagedOnly|Win32
		ReleaseManagedOnly|x64 = ReleaseManagedOnly|x64
		ReleaseNativeOnly|Any CPU = ReleaseNativeOnly|Any CPU
		ReleaseNativeOnly|Mixed Platforms = ReleaseNativeOnly|Mixed Platforms
		ReleaseNativeOnly|Pocket PC 2003 (ARMV4) = ReleaseNativeOnly|Pocket PC 2003 (ARMV4)
		ReleaseNativeOnly|Win32 = ReleaseNativeOnly|Win32
		ReleaseNativeOnly|x64 = ReleaseNativeOnly|x64
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.ActiveCfg = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.Build.0 = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.ActiveCfg = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.Build.0 = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.ActiveCfg = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.Build.0 = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.ActiveCfg = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.Build.0 = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Pocket PC 2003 (ARMV4).Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Any CPU.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Any CPU.Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Any CPU.Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Mixed Platforms.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Mixed Platforms.Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Mixed Platforms.Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Win32.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|x64.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugManagedOnly|Win32.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugManagedOnly|x64.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Any CPU.Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Any CPU.Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Mixed Platforms.Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Win32.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|x64.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Any CPU.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Any CPU.Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Any CPU.Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Mixed Platforms.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Mixed Platforms.Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Mixed Platforms.Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Win32.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|x64.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseManagedOnly|x64.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Any CPU.Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Mixed Platforms.Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|x64.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Mixed Platforms.Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|x64.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Any CPU.Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Mixed Platforms.Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Pocket PC 2003 (ARMV4).Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Any CPU.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Any CPU.Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Mixed Platforms.Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Win32.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|x64.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Any CPU.Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Mixed Platforms.Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Added SQLite.NET.2005.sln.

























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = preProject
		data\exclude_bin.txt = data\exclude_bin.txt
		data\exclude_src.txt = data\exclude_src.txt
		Keys\System.Data.SQLite.CF.snk = Keys\System.Data.SQLite.CF.snk
		Keys\System.Data.SQLite.snk = Keys\System.Data.SQLite.snk
		NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\content\config.install.xdt = NuGet\shared\Core\content\config.install.xdt
		NuGet\shared\Core\content\config.transform = NuGet\shared\Core\content\config.transform
		NuGet\net40\EF6\content\config.transform = NuGet\net40\EF6\content\config.transform
		NuGet\net40\EF6\tools\provider.ps1 = NuGet\net40\EF6\tools\provider.ps1
		NuGet\SQLite.Core.nuspec = NuGet\SQLite.Core.nuspec
		NuGet\SQLite.Core.Beta.nuspec = NuGet\SQLite.Core.Beta.nuspec
		NuGet\SQLite.Core.NetFramework.nuspec = NuGet\SQLite.Core.NetFramework.nuspec
		NuGet\SQLite.Core.NetStandard.nuspec = NuGet\SQLite.Core.NetStandard.nuspec
		NuGet\SQLite.Core.Test.nuspec = NuGet\SQLite.Core.Test.nuspec
		NuGet\SQLite.Core.MSIL.nuspec = NuGet\SQLite.Core.MSIL.nuspec
		NuGet\SQLite.Core.MSIL.Beta.nuspec = NuGet\SQLite.Core.MSIL.Beta.nuspec
		NuGet\SQLite.Core.MSIL.Test.nuspec = NuGet\SQLite.Core.MSIL.Test.nuspec
		NuGet\SQLite.EF6.nuspec = NuGet\SQLite.EF6.nuspec
		NuGet\SQLite.EF6.Beta.nuspec = NuGet\SQLite.EF6.Beta.nuspec
		NuGet\SQLite.EF6.Test.nuspec = NuGet\SQLite.EF6.Test.nuspec
		NuGet\SQLite.Linq.nuspec = NuGet\SQLite.Linq.nuspec
		NuGet\SQLite.Linq.Beta.nuspec = NuGet\SQLite.Linq.Beta.nuspec
		NuGet\SQLite.Linq.Test.nuspec = NuGet\SQLite.Linq.Test.nuspec
		NuGet\SQLite.MSIL.nuspec = NuGet\SQLite.MSIL.nuspec
		NuGet\SQLite.MSIL.Beta.nuspec = NuGet\SQLite.MSIL.Beta.nuspec
		NuGet\SQLite.MSIL.Test.nuspec = NuGet\SQLite.MSIL.Test.nuspec
		NuGet\SQLite.nuspec = NuGet\SQLite.nuspec
		NuGet\SQLite.Beta.nuspec = NuGet\SQLite.Beta.nuspec
		NuGet\SQLite.Test.nuspec = NuGet\SQLite.Test.nuspec
		NuGet\SQLite.x64.nuspec = NuGet\SQLite.x64.nuspec
		NuGet\SQLite.x86.nuspec = NuGet\SQLite.x86.nuspec
		readme.htm = readme.htm
		System.Data.SQLite\Targets\System.Data.SQLite.Files.targets = System.Data.SQLite\Targets\System.Data.SQLite.Files.targets
		System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets = System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets
		System.Data.SQLite\Targets\System.Data.SQLite.References.targets = System.Data.SQLite\Targets\System.Data.SQLite.References.targets
		Targets\SQLite.NET.Mono.Settings.targets = Targets\SQLite.NET.Mono.Settings.targets
		Targets\SQLite.NET.NetStandard20.Settings.targets = Targets\SQLite.NET.NetStandard20.Settings.targets
		Targets\SQLite.NET.NetStandard21.Settings.targets = Targets\SQLite.NET.NetStandard21.Settings.targets
		Targets\SQLite.NET.Platform.Settings.targets = Targets\SQLite.NET.Platform.Settings.targets
		Targets\SQLite.NET.Settings.targets = Targets\SQLite.NET.Settings.targets
		Targets\SQLite.NET.Settings.targets.netFx35 = Targets\SQLite.NET.Settings.targets.netFx35
		Targets\SQLite.NET.Settings.targets.netFx40 = Targets\SQLite.NET.Settings.targets.netFx40
		Targets\SQLite.NET.targets = Targets\SQLite.NET.targets
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.2005", "System.Data.SQLite\System.Data.SQLite.2005.csproj", "{AC139952-261A-4463-B6FA-AEBC25283A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Module.2005", "System.Data.SQLite\System.Data.SQLite.Module.2005.csproj", "{AC139952-261A-4463-B6FA-AEBC25284A66}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.2005", "SQLite.Interop\SQLite.Interop.2005.vcproj", "{53784BC1-A8BC-4AC8-8A3E-158D6807345A}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.Static.2005", "SQLite.Interop\SQLite.Interop.Static.2005.vcproj", "{490CBC51-A3B2-4397-89F9-16E858DCB4F8}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Designer.2005", "SQLite.Designer\SQLite.Designer.2005.csproj", "{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Installer.2005", "tools\install\Installer.2005.csproj", "{A41FE2A5-07AD-4CE7-B836-1544634816F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test.2005", "test\test.2005.csproj", "{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Compact.2005", "System.Data.SQLite\System.Data.SQLite.Compact.2005.csproj", "{AC139951-261A-4463-B6FA-AEBC25283A66}"
	ProjectSection(ProjectDependencies) = postProject
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6} = {9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.CE.2005", "SQLite.Interop\SQLite.Interop.CE.2005.vcproj", "{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testce.2005", "testce\testce.2005.csproj", "{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|Pocket PC 2003 (ARMV4) = Debug|Pocket PC 2003 (ARMV4)
		Debug|Win32 = Debug|Win32
		Debug|x64 = Debug|x64
		DebugNativeOnly|Any CPU = DebugNativeOnly|Any CPU
		DebugNativeOnly|Mixed Platforms = DebugNativeOnly|Mixed Platforms
		DebugNativeOnly|Pocket PC 2003 (ARMV4) = DebugNativeOnly|Pocket PC 2003 (ARMV4)
		DebugNativeOnly|Win32 = DebugNativeOnly|Win32
		DebugNativeOnly|x64 = DebugNativeOnly|x64
		Release|Any CPU = Release|Any CPU
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|Pocket PC 2003 (ARMV4) = Release|Pocket PC 2003 (ARMV4)
		Release|Win32 = Release|Win32
		Release|x64 = Release|x64
		ReleaseNativeOnly|Any CPU = ReleaseNativeOnly|Any CPU
		ReleaseNativeOnly|Mixed Platforms = ReleaseNativeOnly|Mixed Platforms
		ReleaseNativeOnly|Pocket PC 2003 (ARMV4) = ReleaseNativeOnly|Pocket PC 2003 (ARMV4)
		ReleaseNativeOnly|Win32 = ReleaseNativeOnly|Win32
		ReleaseNativeOnly|x64 = ReleaseNativeOnly|x64
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.ActiveCfg = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.Build.0 = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.ActiveCfg = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.Build.0 = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.ActiveCfg = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.Build.0 = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.ActiveCfg = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.Build.0 = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Pocket PC 2003 (ARMV4).Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Any CPU.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Any CPU.Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Any CPU.Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Mixed Platforms.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Mixed Platforms.Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Mixed Platforms.Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Win32.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|x64.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Any CPU.Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Any CPU.Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Mixed Platforms.Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Win32.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|x64.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Any CPU.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Any CPU.Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Any CPU.Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Mixed Platforms.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Mixed Platforms.Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Mixed Platforms.Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Win32.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|x64.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Any CPU.Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Mixed Platforms.Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|x64.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Mixed Platforms.Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|x64.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Pocket PC 2003 (ARMV4).Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Any CPU.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Any CPU.Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Mixed Platforms.Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Win32.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|x64.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Added SQLite.NET.2008.MSBuild.sln.































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = preProject
		data\exclude_bin.txt = data\exclude_bin.txt
		data\exclude_src.txt = data\exclude_src.txt
		Keys\System.Data.SQLite.CF.snk = Keys\System.Data.SQLite.CF.snk
		Keys\System.Data.SQLite.snk = Keys\System.Data.SQLite.snk
		NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\content\config.install.xdt = NuGet\shared\Core\content\config.install.xdt
		NuGet\shared\Core\content\config.transform = NuGet\shared\Core\content\config.transform
		NuGet\net40\EF6\content\config.transform = NuGet\net40\EF6\content\config.transform
		NuGet\net40\EF6\tools\provider.ps1 = NuGet\net40\EF6\tools\provider.ps1
		NuGet\SQLite.Core.nuspec = NuGet\SQLite.Core.nuspec
		NuGet\SQLite.Core.Beta.nuspec = NuGet\SQLite.Core.Beta.nuspec
		NuGet\SQLite.Core.NetFramework.nuspec = NuGet\SQLite.Core.NetFramework.nuspec
		NuGet\SQLite.Core.NetStandard.nuspec = NuGet\SQLite.Core.NetStandard.nuspec
		NuGet\SQLite.Core.Test.nuspec = NuGet\SQLite.Core.Test.nuspec
		NuGet\SQLite.Core.MSIL.nuspec = NuGet\SQLite.Core.MSIL.nuspec
		NuGet\SQLite.Core.MSIL.Beta.nuspec = NuGet\SQLite.Core.MSIL.Beta.nuspec
		NuGet\SQLite.Core.MSIL.Test.nuspec = NuGet\SQLite.Core.MSIL.Test.nuspec
		NuGet\SQLite.EF6.nuspec = NuGet\SQLite.EF6.nuspec
		NuGet\SQLite.EF6.Beta.nuspec = NuGet\SQLite.EF6.Beta.nuspec
		NuGet\SQLite.EF6.Test.nuspec = NuGet\SQLite.EF6.Test.nuspec
		NuGet\SQLite.Linq.nuspec = NuGet\SQLite.Linq.nuspec
		NuGet\SQLite.Linq.Beta.nuspec = NuGet\SQLite.Linq.Beta.nuspec
		NuGet\SQLite.Linq.Test.nuspec = NuGet\SQLite.Linq.Test.nuspec
		NuGet\SQLite.MSIL.nuspec = NuGet\SQLite.MSIL.nuspec
		NuGet\SQLite.MSIL.Beta.nuspec = NuGet\SQLite.MSIL.Beta.nuspec
		NuGet\SQLite.MSIL.Test.nuspec = NuGet\SQLite.MSIL.Test.nuspec
		NuGet\SQLite.nuspec = NuGet\SQLite.nuspec
		NuGet\SQLite.Beta.nuspec = NuGet\SQLite.Beta.nuspec
		NuGet\SQLite.Test.nuspec = NuGet\SQLite.Test.nuspec
		NuGet\SQLite.x64.nuspec = NuGet\SQLite.x64.nuspec
		NuGet\SQLite.x86.nuspec = NuGet\SQLite.x86.nuspec
		readme.htm = readme.htm
		System.Data.SQLite\Targets\System.Data.SQLite.Files.targets = System.Data.SQLite\Targets\System.Data.SQLite.Files.targets
		System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets = System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets
		System.Data.SQLite\Targets\System.Data.SQLite.References.targets = System.Data.SQLite\Targets\System.Data.SQLite.References.targets
		Targets\SQLite.NET.Mono.Settings.targets = Targets\SQLite.NET.Mono.Settings.targets
		Targets\SQLite.NET.NetStandard20.Settings.targets = Targets\SQLite.NET.NetStandard20.Settings.targets
		Targets\SQLite.NET.NetStandard21.Settings.targets = Targets\SQLite.NET.NetStandard21.Settings.targets
		Targets\SQLite.NET.Platform.Settings.targets = Targets\SQLite.NET.Platform.Settings.targets
		Targets\SQLite.NET.Settings.targets = Targets\SQLite.NET.Settings.targets
		Targets\SQLite.NET.Settings.targets.netFx35 = Targets\SQLite.NET.Settings.targets.netFx35
		Targets\SQLite.NET.Settings.targets.netFx40 = Targets\SQLite.NET.Settings.targets.netFx40
		Targets\SQLite.NET.targets = Targets\SQLite.NET.targets
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.2008", "System.Data.SQLite\System.Data.SQLite.2008.csproj", "{AC139952-261A-4463-B6FA-AEBC25283A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Module.2008", "System.Data.SQLite\System.Data.SQLite.Module.2008.csproj", "{AC139952-261A-4463-B6FA-AEBC25284A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Linq.2008", "System.Data.SQLite.Linq\System.Data.SQLite.Linq.2008.csproj", "{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.2008", "SQLite.Interop\SQLite.Interop.2008.vcproj", "{53784BC1-A8BC-4AC8-8A3E-158D6807345A}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.Static.2008", "SQLite.Interop\SQLite.Interop.Static.2008.vcproj", "{490CBC51-A3B2-4397-89F9-16E858DCB4F8}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Designer.2008", "SQLite.Designer\SQLite.Designer.2008.csproj", "{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Installer.2008", "tools\install\Installer.2008.csproj", "{A41FE2A5-07AD-4CE7-B836-1544634816F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test.2008", "test\test.2008.csproj", "{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testlinq.2008", "testlinq\testlinq.2008.csproj", "{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D} = {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Compact.2008", "System.Data.SQLite\System.Data.SQLite.Compact.2008.csproj", "{AC139951-261A-4463-B6FA-AEBC25283A66}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.CE.2008", "SQLite.Interop\SQLite.Interop.CE.2008.vcproj", "{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testce.2008", "testce\testce.2008.csproj", "{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|Pocket PC 2003 (ARMV4) = Debug|Pocket PC 2003 (ARMV4)
		Debug|Win32 = Debug|Win32
		Debug|x64 = Debug|x64
		DebugManagedOnly|Any CPU = DebugManagedOnly|Any CPU
		DebugManagedOnly|Mixed Platforms = DebugManagedOnly|Mixed Platforms
		DebugManagedOnly|Pocket PC 2003 (ARMV4) = DebugManagedOnly|Pocket PC 2003 (ARMV4)
		DebugManagedOnly|Win32 = DebugManagedOnly|Win32
		DebugManagedOnly|x64 = DebugManagedOnly|x64
		DebugNativeOnly|Any CPU = DebugNativeOnly|Any CPU
		DebugNativeOnly|Mixed Platforms = DebugNativeOnly|Mixed Platforms
		DebugNativeOnly|Pocket PC 2003 (ARMV4) = DebugNativeOnly|Pocket PC 2003 (ARMV4)
		DebugNativeOnly|Win32 = DebugNativeOnly|Win32
		DebugNativeOnly|x64 = DebugNativeOnly|x64
		Release|Any CPU = Release|Any CPU
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|Pocket PC 2003 (ARMV4) = Release|Pocket PC 2003 (ARMV4)
		Release|Win32 = Release|Win32
		Release|x64 = Release|x64
		ReleaseManagedOnly|Any CPU = ReleaseManagedOnly|Any CPU
		ReleaseManagedOnly|Mixed Platforms = ReleaseManagedOnly|Mixed Platforms
		ReleaseManagedOnly|Pocket PC 2003 (ARMV4) = ReleaseManagedOnly|Pocket PC 2003 (ARMV4)
		ReleaseManagedOnly|Win32 = ReleaseManagedOnly|Win32
		ReleaseManagedOnly|x64 = ReleaseManagedOnly|x64
		ReleaseNativeOnly|Any CPU = ReleaseNativeOnly|Any CPU
		ReleaseNativeOnly|Mixed Platforms = ReleaseNativeOnly|Mixed Platforms
		ReleaseNativeOnly|Pocket PC 2003 (ARMV4) = ReleaseNativeOnly|Pocket PC 2003 (ARMV4)
		ReleaseNativeOnly|Win32 = ReleaseNativeOnly|Win32
		ReleaseNativeOnly|x64 = ReleaseNativeOnly|x64
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.ActiveCfg = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.Build.0 = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.ActiveCfg = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.Build.0 = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.ActiveCfg = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.Build.0 = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.ActiveCfg = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.Build.0 = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Pocket PC 2003 (ARMV4).Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Any CPU.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Any CPU.Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Any CPU.Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Mixed Platforms.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Mixed Platforms.Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Mixed Platforms.Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Win32.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|x64.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugManagedOnly|Win32.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugManagedOnly|x64.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Any CPU.Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Any CPU.Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Mixed Platforms.Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Win32.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|x64.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Any CPU.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Any CPU.Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Any CPU.Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Mixed Platforms.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Mixed Platforms.Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Mixed Platforms.Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Win32.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|x64.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseManagedOnly|x64.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Any CPU.Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Mixed Platforms.Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|x64.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Mixed Platforms.Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|x64.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Any CPU.Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Mixed Platforms.Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Pocket PC 2003 (ARMV4).Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Any CPU.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Any CPU.Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Mixed Platforms.Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Win32.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|x64.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Any CPU.Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Mixed Platforms.Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Added SQLite.NET.2008.sln.

























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = preProject
		data\exclude_bin.txt = data\exclude_bin.txt
		data\exclude_src.txt = data\exclude_src.txt
		Keys\System.Data.SQLite.CF.snk = Keys\System.Data.SQLite.CF.snk
		Keys\System.Data.SQLite.snk = Keys\System.Data.SQLite.snk
		NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\content\config.install.xdt = NuGet\shared\Core\content\config.install.xdt
		NuGet\shared\Core\content\config.transform = NuGet\shared\Core\content\config.transform
		NuGet\net40\EF6\content\config.transform = NuGet\net40\EF6\content\config.transform
		NuGet\net40\EF6\tools\provider.ps1 = NuGet\net40\EF6\tools\provider.ps1
		NuGet\SQLite.Core.nuspec = NuGet\SQLite.Core.nuspec
		NuGet\SQLite.Core.Beta.nuspec = NuGet\SQLite.Core.Beta.nuspec
		NuGet\SQLite.Core.NetFramework.nuspec = NuGet\SQLite.Core.NetFramework.nuspec
		NuGet\SQLite.Core.NetStandard.nuspec = NuGet\SQLite.Core.NetStandard.nuspec
		NuGet\SQLite.Core.Test.nuspec = NuGet\SQLite.Core.Test.nuspec
		NuGet\SQLite.Core.MSIL.nuspec = NuGet\SQLite.Core.MSIL.nuspec
		NuGet\SQLite.Core.MSIL.Beta.nuspec = NuGet\SQLite.Core.MSIL.Beta.nuspec
		NuGet\SQLite.Core.MSIL.Test.nuspec = NuGet\SQLite.Core.MSIL.Test.nuspec
		NuGet\SQLite.EF6.nuspec = NuGet\SQLite.EF6.nuspec
		NuGet\SQLite.EF6.Beta.nuspec = NuGet\SQLite.EF6.Beta.nuspec
		NuGet\SQLite.EF6.Test.nuspec = NuGet\SQLite.EF6.Test.nuspec
		NuGet\SQLite.Linq.nuspec = NuGet\SQLite.Linq.nuspec
		NuGet\SQLite.Linq.Beta.nuspec = NuGet\SQLite.Linq.Beta.nuspec
		NuGet\SQLite.Linq.Test.nuspec = NuGet\SQLite.Linq.Test.nuspec
		NuGet\SQLite.MSIL.nuspec = NuGet\SQLite.MSIL.nuspec
		NuGet\SQLite.MSIL.Beta.nuspec = NuGet\SQLite.MSIL.Beta.nuspec
		NuGet\SQLite.MSIL.Test.nuspec = NuGet\SQLite.MSIL.Test.nuspec
		NuGet\SQLite.nuspec = NuGet\SQLite.nuspec
		NuGet\SQLite.Beta.nuspec = NuGet\SQLite.Beta.nuspec
		NuGet\SQLite.Test.nuspec = NuGet\SQLite.Test.nuspec
		NuGet\SQLite.x64.nuspec = NuGet\SQLite.x64.nuspec
		NuGet\SQLite.x86.nuspec = NuGet\SQLite.x86.nuspec
		readme.htm = readme.htm
		System.Data.SQLite\Targets\System.Data.SQLite.Files.targets = System.Data.SQLite\Targets\System.Data.SQLite.Files.targets
		System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets = System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets
		System.Data.SQLite\Targets\System.Data.SQLite.References.targets = System.Data.SQLite\Targets\System.Data.SQLite.References.targets
		Targets\SQLite.NET.Mono.Settings.targets = Targets\SQLite.NET.Mono.Settings.targets
		Targets\SQLite.NET.NetStandard20.Settings.targets = Targets\SQLite.NET.NetStandard20.Settings.targets
		Targets\SQLite.NET.NetStandard21.Settings.targets = Targets\SQLite.NET.NetStandard21.Settings.targets
		Targets\SQLite.NET.Platform.Settings.targets = Targets\SQLite.NET.Platform.Settings.targets
		Targets\SQLite.NET.Settings.targets = Targets\SQLite.NET.Settings.targets
		Targets\SQLite.NET.Settings.targets.netFx35 = Targets\SQLite.NET.Settings.targets.netFx35
		Targets\SQLite.NET.Settings.targets.netFx40 = Targets\SQLite.NET.Settings.targets.netFx40
		Targets\SQLite.NET.targets = Targets\SQLite.NET.targets
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.2008", "System.Data.SQLite\System.Data.SQLite.2008.csproj", "{AC139952-261A-4463-B6FA-AEBC25283A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Module.2008", "System.Data.SQLite\System.Data.SQLite.Module.2008.csproj", "{AC139952-261A-4463-B6FA-AEBC25284A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Linq.2008", "System.Data.SQLite.Linq\System.Data.SQLite.Linq.2008.csproj", "{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.2008", "SQLite.Interop\SQLite.Interop.2008.vcproj", "{53784BC1-A8BC-4AC8-8A3E-158D6807345A}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.Static.2008", "SQLite.Interop\SQLite.Interop.Static.2008.vcproj", "{490CBC51-A3B2-4397-89F9-16E858DCB4F8}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Designer.2008", "SQLite.Designer\SQLite.Designer.2008.csproj", "{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Installer.2008", "tools\install\Installer.2008.csproj", "{A41FE2A5-07AD-4CE7-B836-1544634816F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test.2008", "test\test.2008.csproj", "{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testlinq.2008", "testlinq\testlinq.2008.csproj", "{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D} = {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Compact.2008", "System.Data.SQLite\System.Data.SQLite.Compact.2008.csproj", "{AC139951-261A-4463-B6FA-AEBC25283A66}"
	ProjectSection(ProjectDependencies) = postProject
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6} = {9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.CE.2008", "SQLite.Interop\SQLite.Interop.CE.2008.vcproj", "{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testce.2008", "testce\testce.2008.csproj", "{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|Pocket PC 2003 (ARMV4) = Debug|Pocket PC 2003 (ARMV4)
		Debug|Win32 = Debug|Win32
		Debug|x64 = Debug|x64
		DebugNativeOnly|Any CPU = DebugNativeOnly|Any CPU
		DebugNativeOnly|Mixed Platforms = DebugNativeOnly|Mixed Platforms
		DebugNativeOnly|Pocket PC 2003 (ARMV4) = DebugNativeOnly|Pocket PC 2003 (ARMV4)
		DebugNativeOnly|Win32 = DebugNativeOnly|Win32
		DebugNativeOnly|x64 = DebugNativeOnly|x64
		Release|Any CPU = Release|Any CPU
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|Pocket PC 2003 (ARMV4) = Release|Pocket PC 2003 (ARMV4)
		Release|Win32 = Release|Win32
		Release|x64 = Release|x64
		ReleaseNativeOnly|Any CPU = ReleaseNativeOnly|Any CPU
		ReleaseNativeOnly|Mixed Platforms = ReleaseNativeOnly|Mixed Platforms
		ReleaseNativeOnly|Pocket PC 2003 (ARMV4) = ReleaseNativeOnly|Pocket PC 2003 (ARMV4)
		ReleaseNativeOnly|Win32 = ReleaseNativeOnly|Win32
		ReleaseNativeOnly|x64 = ReleaseNativeOnly|x64
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.ActiveCfg = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.Build.0 = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.ActiveCfg = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.Build.0 = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.ActiveCfg = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.Build.0 = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.ActiveCfg = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.Build.0 = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Pocket PC 2003 (ARMV4).Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Any CPU.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Any CPU.Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Any CPU.Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Mixed Platforms.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Mixed Platforms.Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Mixed Platforms.Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Win32.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|x64.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Any CPU.Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Any CPU.Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Mixed Platforms.Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|Win32.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.DebugNativeOnly|x64.ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Any CPU.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Any CPU.Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Any CPU.Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Mixed Platforms.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Mixed Platforms.Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Mixed Platforms.Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Win32.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|x64.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Any CPU.Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Mixed Platforms.Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.ReleaseNativeOnly|x64.ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Mixed Platforms.Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|x64.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Pocket PC 2003 (ARMV4).Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Any CPU.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Any CPU.Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Mixed Platforms.Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Win32.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|x64.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Added SQLite.NET.2010.MSBuild.sln.































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = preProject
		data\exclude_bin.txt = data\exclude_bin.txt
		data\exclude_src.txt = data\exclude_src.txt
		Keys\System.Data.SQLite.CF.snk = Keys\System.Data.SQLite.CF.snk
		Keys\System.Data.SQLite.snk = Keys\System.Data.SQLite.snk
		NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\content\config.install.xdt = NuGet\shared\Core\content\config.install.xdt
		NuGet\shared\Core\content\config.transform = NuGet\shared\Core\content\config.transform
		NuGet\net40\EF6\content\config.transform = NuGet\net40\EF6\content\config.transform
		NuGet\net40\EF6\tools\provider.ps1 = NuGet\net40\EF6\tools\provider.ps1
		NuGet\SQLite.Core.nuspec = NuGet\SQLite.Core.nuspec
		NuGet\SQLite.Core.Beta.nuspec = NuGet\SQLite.Core.Beta.nuspec
		NuGet\SQLite.Core.NetFramework.nuspec = NuGet\SQLite.Core.NetFramework.nuspec
		NuGet\SQLite.Core.NetStandard.nuspec = NuGet\SQLite.Core.NetStandard.nuspec
		NuGet\SQLite.Core.Test.nuspec = NuGet\SQLite.Core.Test.nuspec
		NuGet\SQLite.Core.MSIL.nuspec = NuGet\SQLite.Core.MSIL.nuspec
		NuGet\SQLite.Core.MSIL.Beta.nuspec = NuGet\SQLite.Core.MSIL.Beta.nuspec
		NuGet\SQLite.Core.MSIL.Test.nuspec = NuGet\SQLite.Core.MSIL.Test.nuspec
		NuGet\SQLite.EF6.nuspec = NuGet\SQLite.EF6.nuspec
		NuGet\SQLite.EF6.Beta.nuspec = NuGet\SQLite.EF6.Beta.nuspec
		NuGet\SQLite.EF6.Test.nuspec = NuGet\SQLite.EF6.Test.nuspec
		NuGet\SQLite.Linq.nuspec = NuGet\SQLite.Linq.nuspec
		NuGet\SQLite.Linq.Beta.nuspec = NuGet\SQLite.Linq.Beta.nuspec
		NuGet\SQLite.Linq.Test.nuspec = NuGet\SQLite.Linq.Test.nuspec
		NuGet\SQLite.MSIL.nuspec = NuGet\SQLite.MSIL.nuspec
		NuGet\SQLite.MSIL.Beta.nuspec = NuGet\SQLite.MSIL.Beta.nuspec
		NuGet\SQLite.MSIL.Test.nuspec = NuGet\SQLite.MSIL.Test.nuspec
		NuGet\SQLite.nuspec = NuGet\SQLite.nuspec
		NuGet\SQLite.Beta.nuspec = NuGet\SQLite.Beta.nuspec
		NuGet\SQLite.Test.nuspec = NuGet\SQLite.Test.nuspec
		NuGet\SQLite.x64.nuspec = NuGet\SQLite.x64.nuspec
		NuGet\SQLite.x86.nuspec = NuGet\SQLite.x86.nuspec
		readme.htm = readme.htm
		System.Data.SQLite\Targets\System.Data.SQLite.Files.targets = System.Data.SQLite\Targets\System.Data.SQLite.Files.targets
		System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets = System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets
		System.Data.SQLite\Targets\System.Data.SQLite.References.targets = System.Data.SQLite\Targets\System.Data.SQLite.References.targets
		Targets\SQLite.NET.Mono.Settings.targets = Targets\SQLite.NET.Mono.Settings.targets
		Targets\SQLite.NET.NetStandard20.Settings.targets = Targets\SQLite.NET.NetStandard20.Settings.targets
		Targets\SQLite.NET.NetStandard21.Settings.targets = Targets\SQLite.NET.NetStandard21.Settings.targets
		Targets\SQLite.NET.Platform.Settings.targets = Targets\SQLite.NET.Platform.Settings.targets
		Targets\SQLite.NET.Settings.targets = Targets\SQLite.NET.Settings.targets
		Targets\SQLite.NET.Settings.targets.netFx35 = Targets\SQLite.NET.Settings.targets.netFx35
		Targets\SQLite.NET.Settings.targets.netFx40 = Targets\SQLite.NET.Settings.targets.netFx40
		Targets\SQLite.NET.targets = Targets\SQLite.NET.targets
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.2010", "System.Data.SQLite\System.Data.SQLite.2010.csproj", "{AC139952-261A-4463-B6FA-AEBC25283A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Module.2010", "System.Data.SQLite\System.Data.SQLite.Module.2010.csproj", "{AC139952-261A-4463-B6FA-AEBC25284A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Linq.2010", "System.Data.SQLite.Linq\System.Data.SQLite.Linq.2010.csproj", "{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.EF6.2010", "System.Data.SQLite.Linq\System.Data.SQLite.EF6.2010.csproj", "{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.2010", "SQLite.Interop\SQLite.Interop.2010.vcxproj", "{53784BC1-A8BC-4AC8-8A3E-158D6807345A}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.Static.2010", "SQLite.Interop\SQLite.Interop.Static.2010.vcxproj", "{490CBC51-A3B2-4397-89F9-16E858DCB4F8}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Designer.2010", "SQLite.Designer\SQLite.Designer.2010.csproj", "{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Installer.2010", "tools\install\Installer.2010.csproj", "{A41FE2A5-07AD-4CE7-B836-1544634816F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test.2010", "test\test.2010.csproj", "{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testlinq.2010", "testlinq\testlinq.2010.csproj", "{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D} = {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testef6.2010", "testlinq\testef6.2010.csproj", "{2975AE0A-F159-4834-A837-5242C6691886}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B} = {F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}
	EndProjectSection
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|Win32 = Debug|Win32
		Debug|x64 = Debug|x64
		DebugManagedOnly|Any CPU = DebugManagedOnly|Any CPU
		DebugManagedOnly|Mixed Platforms = DebugManagedOnly|Mixed Platforms
		DebugManagedOnly|Win32 = DebugManagedOnly|Win32
		DebugManagedOnly|x64 = DebugManagedOnly|x64
		DebugNativeOnly|Any CPU = DebugNativeOnly|Any CPU
		DebugNativeOnly|Mixed Platforms = DebugNativeOnly|Mixed Platforms
		DebugNativeOnly|Win32 = DebugNativeOnly|Win32
		DebugNativeOnly|x64 = DebugNativeOnly|x64
		Release|Any CPU = Release|Any CPU
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|Win32 = Release|Win32
		Release|x64 = Release|x64
		ReleaseManagedOnly|Any CPU = ReleaseManagedOnly|Any CPU
		ReleaseManagedOnly|Mixed Platforms = ReleaseManagedOnly|Mixed Platforms
		ReleaseManagedOnly|Win32 = ReleaseManagedOnly|Win32
		ReleaseManagedOnly|x64 = ReleaseManagedOnly|x64
		ReleaseNativeOnly|Any CPU = ReleaseNativeOnly|Any CPU
		ReleaseNativeOnly|Mixed Platforms = ReleaseNativeOnly|Mixed Platforms
		ReleaseNativeOnly|Win32 = ReleaseNativeOnly|Win32
		ReleaseNativeOnly|x64 = ReleaseNativeOnly|x64
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.ActiveCfg = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.Build.0 = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.ActiveCfg = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.Build.0 = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.ActiveCfg = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.Build.0 = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.ActiveCfg = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.Build.0 = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Added SQLite.NET.2010.sln.































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = preProject
		data\exclude_bin.txt = data\exclude_bin.txt
		data\exclude_src.txt = data\exclude_src.txt
		Keys\System.Data.SQLite.CF.snk = Keys\System.Data.SQLite.CF.snk
		Keys\System.Data.SQLite.snk = Keys\System.Data.SQLite.snk
		NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\content\config.install.xdt = NuGet\shared\Core\content\config.install.xdt
		NuGet\shared\Core\content\config.transform = NuGet\shared\Core\content\config.transform
		NuGet\net40\EF6\content\config.transform = NuGet\net40\EF6\content\config.transform
		NuGet\net40\EF6\tools\provider.ps1 = NuGet\net40\EF6\tools\provider.ps1
		NuGet\SQLite.Core.nuspec = NuGet\SQLite.Core.nuspec
		NuGet\SQLite.Core.Beta.nuspec = NuGet\SQLite.Core.Beta.nuspec
		NuGet\SQLite.Core.NetFramework.nuspec = NuGet\SQLite.Core.NetFramework.nuspec
		NuGet\SQLite.Core.NetStandard.nuspec = NuGet\SQLite.Core.NetStandard.nuspec
		NuGet\SQLite.Core.Test.nuspec = NuGet\SQLite.Core.Test.nuspec
		NuGet\SQLite.Core.MSIL.nuspec = NuGet\SQLite.Core.MSIL.nuspec
		NuGet\SQLite.Core.MSIL.Beta.nuspec = NuGet\SQLite.Core.MSIL.Beta.nuspec
		NuGet\SQLite.Core.MSIL.Test.nuspec = NuGet\SQLite.Core.MSIL.Test.nuspec
		NuGet\SQLite.EF6.nuspec = NuGet\SQLite.EF6.nuspec
		NuGet\SQLite.EF6.Beta.nuspec = NuGet\SQLite.EF6.Beta.nuspec
		NuGet\SQLite.EF6.Test.nuspec = NuGet\SQLite.EF6.Test.nuspec
		NuGet\SQLite.Linq.nuspec = NuGet\SQLite.Linq.nuspec
		NuGet\SQLite.Linq.Beta.nuspec = NuGet\SQLite.Linq.Beta.nuspec
		NuGet\SQLite.Linq.Test.nuspec = NuGet\SQLite.Linq.Test.nuspec
		NuGet\SQLite.MSIL.nuspec = NuGet\SQLite.MSIL.nuspec
		NuGet\SQLite.MSIL.Beta.nuspec = NuGet\SQLite.MSIL.Beta.nuspec
		NuGet\SQLite.MSIL.Test.nuspec = NuGet\SQLite.MSIL.Test.nuspec
		NuGet\SQLite.nuspec = NuGet\SQLite.nuspec
		NuGet\SQLite.Beta.nuspec = NuGet\SQLite.Beta.nuspec
		NuGet\SQLite.Test.nuspec = NuGet\SQLite.Test.nuspec
		NuGet\SQLite.x64.nuspec = NuGet\SQLite.x64.nuspec
		NuGet\SQLite.x86.nuspec = NuGet\SQLite.x86.nuspec
		readme.htm = readme.htm
		System.Data.SQLite\Targets\System.Data.SQLite.Files.targets = System.Data.SQLite\Targets\System.Data.SQLite.Files.targets
		System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets = System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets
		System.Data.SQLite\Targets\System.Data.SQLite.References.targets = System.Data.SQLite\Targets\System.Data.SQLite.References.targets
		Targets\SQLite.NET.Mono.Settings.targets = Targets\SQLite.NET.Mono.Settings.targets
		Targets\SQLite.NET.NetStandard20.Settings.targets = Targets\SQLite.NET.NetStandard20.Settings.targets
		Targets\SQLite.NET.NetStandard21.Settings.targets = Targets\SQLite.NET.NetStandard21.Settings.targets
		Targets\SQLite.NET.Platform.Settings.targets = Targets\SQLite.NET.Platform.Settings.targets
		Targets\SQLite.NET.Settings.targets = Targets\SQLite.NET.Settings.targets
		Targets\SQLite.NET.Settings.targets.netFx35 = Targets\SQLite.NET.Settings.targets.netFx35
		Targets\SQLite.NET.Settings.targets.netFx40 = Targets\SQLite.NET.Settings.targets.netFx40
		Targets\SQLite.NET.targets = Targets\SQLite.NET.targets
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.2010", "System.Data.SQLite\System.Data.SQLite.2010.csproj", "{AC139952-261A-4463-B6FA-AEBC25283A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Module.2010", "System.Data.SQLite\System.Data.SQLite.Module.2010.csproj", "{AC139952-261A-4463-B6FA-AEBC25284A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Linq.2010", "System.Data.SQLite.Linq\System.Data.SQLite.Linq.2010.csproj", "{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.EF6.2010", "System.Data.SQLite.Linq\System.Data.SQLite.EF6.2010.csproj", "{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.2010", "SQLite.Interop\SQLite.Interop.2010.vcxproj", "{53784BC1-A8BC-4AC8-8A3E-158D6807345A}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.Static.2010", "SQLite.Interop\SQLite.Interop.Static.2010.vcxproj", "{490CBC51-A3B2-4397-89F9-16E858DCB4F8}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Designer.2010", "SQLite.Designer\SQLite.Designer.2010.csproj", "{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Installer.2010", "tools\install\Installer.2010.csproj", "{A41FE2A5-07AD-4CE7-B836-1544634816F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test.2010", "test\test.2010.csproj", "{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testlinq.2010", "testlinq\testlinq.2010.csproj", "{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D} = {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testef6.2010", "testlinq\testef6.2010.csproj", "{2975AE0A-F159-4834-A837-5242C6691886}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B} = {F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}
	EndProjectSection
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|Win32 = Debug|Win32
		Debug|x64 = Debug|x64
		DebugNativeOnly|Any CPU = DebugNativeOnly|Any CPU
		DebugNativeOnly|Mixed Platforms = DebugNativeOnly|Mixed Platforms
		DebugNativeOnly|Win32 = DebugNativeOnly|Win32
		DebugNativeOnly|x64 = DebugNativeOnly|x64
		Release|Any CPU = Release|Any CPU
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|Win32 = Release|Win32
		Release|x64 = Release|x64
		ReleaseNativeOnly|Any CPU = ReleaseNativeOnly|Any CPU
		ReleaseNativeOnly|Mixed Platforms = ReleaseNativeOnly|Mixed Platforms
		ReleaseNativeOnly|Win32 = ReleaseNativeOnly|Win32
		ReleaseNativeOnly|x64 = ReleaseNativeOnly|x64
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.ActiveCfg = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.Build.0 = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.ActiveCfg = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.Build.0 = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.ActiveCfg = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.Build.0 = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.ActiveCfg = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.Build.0 = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Added SQLite.NET.2012.Compact.sln.









































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Compact.2012", "System.Data.SQLite\System.Data.SQLite.Compact.2012.csproj", "{AC139951-261A-4463-B6FA-AEBC25283A66}"
	ProjectSection(ProjectDependencies) = postProject
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6} = {9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.CE.2012", "SQLite.Interop\SQLite.Interop.CE.2012.vcxproj", "{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testce.2012", "testce\testce.2012.csproj", "{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|CEPC DevPlatform = Debug|CEPC DevPlatform
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|ARMV7 = Debug|ARMV7
		Release|Any CPU = Release|Any CPU
		Release|CEPC DevPlatform = Release|CEPC DevPlatform
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|ARMV7 = Release|ARMV7
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|CEPC DevPlatform.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|CEPC DevPlatform.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|ARMV7.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|ARMV7.Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|CEPC DevPlatform.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|CEPC DevPlatform.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|ARMV7.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|ARMV7.Build.0 = Release|Any CPU
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Any CPU.ActiveCfg = Debug|CEPC DevPlatform
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Any CPU.Build.0 = Debug|CEPC DevPlatform
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|CEPC DevPlatform.ActiveCfg = Debug|CEPC DevPlatform
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|CEPC DevPlatform.Build.0 = Debug|CEPC DevPlatform
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Mixed Platforms.ActiveCfg = Debug|CEPC DevPlatform
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|Mixed Platforms.Build.0 = Debug|CEPC DevPlatform
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|ARMV7.ActiveCfg = Debug|ARMV7
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Debug|ARMV7.Build.0 = Debug|ARMV7
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Any CPU.ActiveCfg = Release|CEPC DevPlatform
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Any CPU.Build.0 = Release|CEPC DevPlatform
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|CEPC DevPlatform.ActiveCfg = Release|CEPC DevPlatform
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|CEPC DevPlatform.Build.0 = Release|CEPC DevPlatform
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Mixed Platforms.ActiveCfg = Release|CEPC DevPlatform
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|Mixed Platforms.Build.0 = Release|CEPC DevPlatform
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|ARMV7.ActiveCfg = Release|ARMV7
		{9E5A8F20-5F04-4629-B2E1-27B5E30F2AF6}.Release|ARMV7.Build.0 = Release|ARMV7
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|CEPC DevPlatform.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|CEPC DevPlatform.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|CEPC DevPlatform.Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Mixed Platforms.Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|ARMV7.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|ARMV7.Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|ARMV7.Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Any CPU.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Any CPU.Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|CEPC DevPlatform.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|CEPC DevPlatform.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|CEPC DevPlatform.Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Mixed Platforms.Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|ARMV7.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|ARMV7.Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|ARMV7.Deploy.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Added SQLite.NET.2012.MSBuild.sln.































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = preProject
		data\exclude_bin.txt = data\exclude_bin.txt
		data\exclude_src.txt = data\exclude_src.txt
		Keys\System.Data.SQLite.CF.snk = Keys\System.Data.SQLite.CF.snk
		Keys\System.Data.SQLite.snk = Keys\System.Data.SQLite.snk
		NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\content\config.install.xdt = NuGet\shared\Core\content\config.install.xdt
		NuGet\shared\Core\content\config.transform = NuGet\shared\Core\content\config.transform
		NuGet\net40\EF6\content\config.transform = NuGet\net40\EF6\content\config.transform
		NuGet\net40\EF6\tools\provider.ps1 = NuGet\net40\EF6\tools\provider.ps1
		NuGet\SQLite.Core.nuspec = NuGet\SQLite.Core.nuspec
		NuGet\SQLite.Core.Beta.nuspec = NuGet\SQLite.Core.Beta.nuspec
		NuGet\SQLite.Core.NetFramework.nuspec = NuGet\SQLite.Core.NetFramework.nuspec
		NuGet\SQLite.Core.NetStandard.nuspec = NuGet\SQLite.Core.NetStandard.nuspec
		NuGet\SQLite.Core.Test.nuspec = NuGet\SQLite.Core.Test.nuspec
		NuGet\SQLite.Core.MSIL.nuspec = NuGet\SQLite.Core.MSIL.nuspec
		NuGet\SQLite.Core.MSIL.Beta.nuspec = NuGet\SQLite.Core.MSIL.Beta.nuspec
		NuGet\SQLite.Core.MSIL.Test.nuspec = NuGet\SQLite.Core.MSIL.Test.nuspec
		NuGet\SQLite.EF6.nuspec = NuGet\SQLite.EF6.nuspec
		NuGet\SQLite.EF6.Beta.nuspec = NuGet\SQLite.EF6.Beta.nuspec
		NuGet\SQLite.EF6.Test.nuspec = NuGet\SQLite.EF6.Test.nuspec
		NuGet\SQLite.Linq.nuspec = NuGet\SQLite.Linq.nuspec
		NuGet\SQLite.Linq.Beta.nuspec = NuGet\SQLite.Linq.Beta.nuspec
		NuGet\SQLite.Linq.Test.nuspec = NuGet\SQLite.Linq.Test.nuspec
		NuGet\SQLite.MSIL.nuspec = NuGet\SQLite.MSIL.nuspec
		NuGet\SQLite.MSIL.Beta.nuspec = NuGet\SQLite.MSIL.Beta.nuspec
		NuGet\SQLite.MSIL.Test.nuspec = NuGet\SQLite.MSIL.Test.nuspec
		NuGet\SQLite.nuspec = NuGet\SQLite.nuspec
		NuGet\SQLite.Beta.nuspec = NuGet\SQLite.Beta.nuspec
		NuGet\SQLite.Test.nuspec = NuGet\SQLite.Test.nuspec
		NuGet\SQLite.x64.nuspec = NuGet\SQLite.x64.nuspec
		NuGet\SQLite.x86.nuspec = NuGet\SQLite.x86.nuspec
		readme.htm = readme.htm
		System.Data.SQLite\Targets\System.Data.SQLite.Files.targets = System.Data.SQLite\Targets\System.Data.SQLite.Files.targets
		System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets = System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets
		System.Data.SQLite\Targets\System.Data.SQLite.References.targets = System.Data.SQLite\Targets\System.Data.SQLite.References.targets
		Targets\SQLite.NET.Mono.Settings.targets = Targets\SQLite.NET.Mono.Settings.targets
		Targets\SQLite.NET.NetStandard20.Settings.targets = Targets\SQLite.NET.NetStandard20.Settings.targets
		Targets\SQLite.NET.NetStandard21.Settings.targets = Targets\SQLite.NET.NetStandard21.Settings.targets
		Targets\SQLite.NET.Platform.Settings.targets = Targets\SQLite.NET.Platform.Settings.targets
		Targets\SQLite.NET.Settings.targets = Targets\SQLite.NET.Settings.targets
		Targets\SQLite.NET.Settings.targets.netFx35 = Targets\SQLite.NET.Settings.targets.netFx35
		Targets\SQLite.NET.Settings.targets.netFx40 = Targets\SQLite.NET.Settings.targets.netFx40
		Targets\SQLite.NET.targets = Targets\SQLite.NET.targets
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.2012", "System.Data.SQLite\System.Data.SQLite.2012.csproj", "{AC139952-261A-4463-B6FA-AEBC25283A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Module.2012", "System.Data.SQLite\System.Data.SQLite.Module.2012.csproj", "{AC139952-261A-4463-B6FA-AEBC25284A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Linq.2012", "System.Data.SQLite.Linq\System.Data.SQLite.Linq.2012.csproj", "{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.EF6.2012", "System.Data.SQLite.Linq\System.Data.SQLite.EF6.2012.csproj", "{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.2012", "SQLite.Interop\SQLite.Interop.2012.vcxproj", "{53784BC1-A8BC-4AC8-8A3E-158D6807345A}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.Static.2012", "SQLite.Interop\SQLite.Interop.Static.2012.vcxproj", "{490CBC51-A3B2-4397-89F9-16E858DCB4F8}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Designer.2012", "SQLite.Designer\SQLite.Designer.2012.csproj", "{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Installer.2012", "tools\install\Installer.2012.csproj", "{A41FE2A5-07AD-4CE7-B836-1544634816F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test.2012", "test\test.2012.csproj", "{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testlinq.2012", "testlinq\testlinq.2012.csproj", "{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D} = {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testef6.2012", "testlinq\testef6.2012.csproj", "{2975AE0A-F159-4834-A837-5242C6691886}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B} = {F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}
	EndProjectSection
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|Win32 = Debug|Win32
		Debug|x64 = Debug|x64
		DebugManagedOnly|Any CPU = DebugManagedOnly|Any CPU
		DebugManagedOnly|Mixed Platforms = DebugManagedOnly|Mixed Platforms
		DebugManagedOnly|Win32 = DebugManagedOnly|Win32
		DebugManagedOnly|x64 = DebugManagedOnly|x64
		DebugNativeOnly|Any CPU = DebugNativeOnly|Any CPU
		DebugNativeOnly|Mixed Platforms = DebugNativeOnly|Mixed Platforms
		DebugNativeOnly|Win32 = DebugNativeOnly|Win32
		DebugNativeOnly|x64 = DebugNativeOnly|x64
		Release|Any CPU = Release|Any CPU
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|Win32 = Release|Win32
		Release|x64 = Release|x64
		ReleaseManagedOnly|Any CPU = ReleaseManagedOnly|Any CPU
		ReleaseManagedOnly|Mixed Platforms = ReleaseManagedOnly|Mixed Platforms
		ReleaseManagedOnly|Win32 = ReleaseManagedOnly|Win32
		ReleaseManagedOnly|x64 = ReleaseManagedOnly|x64
		ReleaseNativeOnly|Any CPU = ReleaseNativeOnly|Any CPU
		ReleaseNativeOnly|Mixed Platforms = ReleaseNativeOnly|Mixed Platforms
		ReleaseNativeOnly|Win32 = ReleaseNativeOnly|Win32
		ReleaseNativeOnly|x64 = ReleaseNativeOnly|x64
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.ActiveCfg = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.Build.0 = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.ActiveCfg = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.Build.0 = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.ActiveCfg = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.Build.0 = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.ActiveCfg = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.Build.0 = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Added SQLite.NET.2012.sln.































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = preProject
		data\exclude_bin.txt = data\exclude_bin.txt
		data\exclude_src.txt = data\exclude_src.txt
		Keys\System.Data.SQLite.CF.snk = Keys\System.Data.SQLite.CF.snk
		Keys\System.Data.SQLite.snk = Keys\System.Data.SQLite.snk
		NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\content\config.install.xdt = NuGet\shared\Core\content\config.install.xdt
		NuGet\shared\Core\content\config.transform = NuGet\shared\Core\content\config.transform
		NuGet\net40\EF6\content\config.transform = NuGet\net40\EF6\content\config.transform
		NuGet\net40\EF6\tools\provider.ps1 = NuGet\net40\EF6\tools\provider.ps1
		NuGet\SQLite.Core.nuspec = NuGet\SQLite.Core.nuspec
		NuGet\SQLite.Core.Beta.nuspec = NuGet\SQLite.Core.Beta.nuspec
		NuGet\SQLite.Core.NetFramework.nuspec = NuGet\SQLite.Core.NetFramework.nuspec
		NuGet\SQLite.Core.NetStandard.nuspec = NuGet\SQLite.Core.NetStandard.nuspec
		NuGet\SQLite.Core.Test.nuspec = NuGet\SQLite.Core.Test.nuspec
		NuGet\SQLite.Core.MSIL.nuspec = NuGet\SQLite.Core.MSIL.nuspec
		NuGet\SQLite.Core.MSIL.Beta.nuspec = NuGet\SQLite.Core.MSIL.Beta.nuspec
		NuGet\SQLite.Core.MSIL.Test.nuspec = NuGet\SQLite.Core.MSIL.Test.nuspec
		NuGet\SQLite.EF6.nuspec = NuGet\SQLite.EF6.nuspec
		NuGet\SQLite.EF6.Beta.nuspec = NuGet\SQLite.EF6.Beta.nuspec
		NuGet\SQLite.EF6.Test.nuspec = NuGet\SQLite.EF6.Test.nuspec
		NuGet\SQLite.Linq.nuspec = NuGet\SQLite.Linq.nuspec
		NuGet\SQLite.Linq.Beta.nuspec = NuGet\SQLite.Linq.Beta.nuspec
		NuGet\SQLite.Linq.Test.nuspec = NuGet\SQLite.Linq.Test.nuspec
		NuGet\SQLite.MSIL.nuspec = NuGet\SQLite.MSIL.nuspec
		NuGet\SQLite.MSIL.Beta.nuspec = NuGet\SQLite.MSIL.Beta.nuspec
		NuGet\SQLite.MSIL.Test.nuspec = NuGet\SQLite.MSIL.Test.nuspec
		NuGet\SQLite.nuspec = NuGet\SQLite.nuspec
		NuGet\SQLite.Beta.nuspec = NuGet\SQLite.Beta.nuspec
		NuGet\SQLite.Test.nuspec = NuGet\SQLite.Test.nuspec
		NuGet\SQLite.x64.nuspec = NuGet\SQLite.x64.nuspec
		NuGet\SQLite.x86.nuspec = NuGet\SQLite.x86.nuspec
		readme.htm = readme.htm
		System.Data.SQLite\Targets\System.Data.SQLite.Files.targets = System.Data.SQLite\Targets\System.Data.SQLite.Files.targets
		System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets = System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets
		System.Data.SQLite\Targets\System.Data.SQLite.References.targets = System.Data.SQLite\Targets\System.Data.SQLite.References.targets
		Targets\SQLite.NET.Mono.Settings.targets = Targets\SQLite.NET.Mono.Settings.targets
		Targets\SQLite.NET.NetStandard20.Settings.targets = Targets\SQLite.NET.NetStandard20.Settings.targets
		Targets\SQLite.NET.NetStandard21.Settings.targets = Targets\SQLite.NET.NetStandard21.Settings.targets
		Targets\SQLite.NET.Platform.Settings.targets = Targets\SQLite.NET.Platform.Settings.targets
		Targets\SQLite.NET.Settings.targets = Targets\SQLite.NET.Settings.targets
		Targets\SQLite.NET.Settings.targets.netFx35 = Targets\SQLite.NET.Settings.targets.netFx35
		Targets\SQLite.NET.Settings.targets.netFx40 = Targets\SQLite.NET.Settings.targets.netFx40
		Targets\SQLite.NET.targets = Targets\SQLite.NET.targets
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.2012", "System.Data.SQLite\System.Data.SQLite.2012.csproj", "{AC139952-261A-4463-B6FA-AEBC25283A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Module.2012", "System.Data.SQLite\System.Data.SQLite.Module.2012.csproj", "{AC139952-261A-4463-B6FA-AEBC25284A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Linq.2012", "System.Data.SQLite.Linq\System.Data.SQLite.Linq.2012.csproj", "{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.EF6.2012", "System.Data.SQLite.Linq\System.Data.SQLite.EF6.2012.csproj", "{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.2012", "SQLite.Interop\SQLite.Interop.2012.vcxproj", "{53784BC1-A8BC-4AC8-8A3E-158D6807345A}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.Static.2012", "SQLite.Interop\SQLite.Interop.Static.2012.vcxproj", "{490CBC51-A3B2-4397-89F9-16E858DCB4F8}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Designer.2012", "SQLite.Designer\SQLite.Designer.2012.csproj", "{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Installer.2012", "tools\install\Installer.2012.csproj", "{A41FE2A5-07AD-4CE7-B836-1544634816F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test.2012", "test\test.2012.csproj", "{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testlinq.2012", "testlinq\testlinq.2012.csproj", "{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D} = {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testef6.2012", "testlinq\testef6.2012.csproj", "{2975AE0A-F159-4834-A837-5242C6691886}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B} = {F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}
	EndProjectSection
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|Win32 = Debug|Win32
		Debug|x64 = Debug|x64
		DebugNativeOnly|Any CPU = DebugNativeOnly|Any CPU
		DebugNativeOnly|Mixed Platforms = DebugNativeOnly|Mixed Platforms
		DebugNativeOnly|Win32 = DebugNativeOnly|Win32
		DebugNativeOnly|x64 = DebugNativeOnly|x64
		Release|Any CPU = Release|Any CPU
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|Win32 = Release|Win32
		Release|x64 = Release|x64
		ReleaseNativeOnly|Any CPU = ReleaseNativeOnly|Any CPU
		ReleaseNativeOnly|Mixed Platforms = ReleaseNativeOnly|Mixed Platforms
		ReleaseNativeOnly|Win32 = ReleaseNativeOnly|Win32
		ReleaseNativeOnly|x64 = ReleaseNativeOnly|x64
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.ActiveCfg = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.Build.0 = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.ActiveCfg = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.Build.0 = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.ActiveCfg = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.Build.0 = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.ActiveCfg = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.Build.0 = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Added SQLite.NET.2013.MSBuild.sln.































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
Microsoft Visual Studio Solution File, Format Version 13.00
# Visual Studio 2013
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = preProject
		data\exclude_bin.txt = data\exclude_bin.txt
		data\exclude_src.txt = data\exclude_src.txt
		Keys\System.Data.SQLite.CF.snk = Keys\System.Data.SQLite.CF.snk
		Keys\System.Data.SQLite.snk = Keys\System.Data.SQLite.snk
		NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\content\config.install.xdt = NuGet\shared\Core\content\config.install.xdt
		NuGet\shared\Core\content\config.transform = NuGet\shared\Core\content\config.transform
		NuGet\net40\EF6\content\config.transform = NuGet\net40\EF6\content\config.transform
		NuGet\net40\EF6\tools\provider.ps1 = NuGet\net40\EF6\tools\provider.ps1
		NuGet\SQLite.Core.nuspec = NuGet\SQLite.Core.nuspec
		NuGet\SQLite.Core.Beta.nuspec = NuGet\SQLite.Core.Beta.nuspec
		NuGet\SQLite.Core.NetFramework.nuspec = NuGet\SQLite.Core.NetFramework.nuspec
		NuGet\SQLite.Core.NetStandard.nuspec = NuGet\SQLite.Core.NetStandard.nuspec
		NuGet\SQLite.Core.Test.nuspec = NuGet\SQLite.Core.Test.nuspec
		NuGet\SQLite.Core.MSIL.nuspec = NuGet\SQLite.Core.MSIL.nuspec
		NuGet\SQLite.Core.MSIL.Beta.nuspec = NuGet\SQLite.Core.MSIL.Beta.nuspec
		NuGet\SQLite.Core.MSIL.Test.nuspec = NuGet\SQLite.Core.MSIL.Test.nuspec
		NuGet\SQLite.EF6.nuspec = NuGet\SQLite.EF6.nuspec
		NuGet\SQLite.EF6.Beta.nuspec = NuGet\SQLite.EF6.Beta.nuspec
		NuGet\SQLite.EF6.Test.nuspec = NuGet\SQLite.EF6.Test.nuspec
		NuGet\SQLite.Linq.nuspec = NuGet\SQLite.Linq.nuspec
		NuGet\SQLite.Linq.Beta.nuspec = NuGet\SQLite.Linq.Beta.nuspec
		NuGet\SQLite.Linq.Test.nuspec = NuGet\SQLite.Linq.Test.nuspec
		NuGet\SQLite.MSIL.nuspec = NuGet\SQLite.MSIL.nuspec
		NuGet\SQLite.MSIL.Beta.nuspec = NuGet\SQLite.MSIL.Beta.nuspec
		NuGet\SQLite.MSIL.Test.nuspec = NuGet\SQLite.MSIL.Test.nuspec
		NuGet\SQLite.nuspec = NuGet\SQLite.nuspec
		NuGet\SQLite.Beta.nuspec = NuGet\SQLite.Beta.nuspec
		NuGet\SQLite.Test.nuspec = NuGet\SQLite.Test.nuspec
		NuGet\SQLite.x64.nuspec = NuGet\SQLite.x64.nuspec
		NuGet\SQLite.x86.nuspec = NuGet\SQLite.x86.nuspec
		readme.htm = readme.htm
		System.Data.SQLite\Targets\System.Data.SQLite.Files.targets = System.Data.SQLite\Targets\System.Data.SQLite.Files.targets
		System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets = System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets
		System.Data.SQLite\Targets\System.Data.SQLite.References.targets = System.Data.SQLite\Targets\System.Data.SQLite.References.targets
		Targets\SQLite.NET.Mono.Settings.targets = Targets\SQLite.NET.Mono.Settings.targets
		Targets\SQLite.NET.NetStandard20.Settings.targets = Targets\SQLite.NET.NetStandard20.Settings.targets
		Targets\SQLite.NET.NetStandard21.Settings.targets = Targets\SQLite.NET.NetStandard21.Settings.targets
		Targets\SQLite.NET.Platform.Settings.targets = Targets\SQLite.NET.Platform.Settings.targets
		Targets\SQLite.NET.Settings.targets = Targets\SQLite.NET.Settings.targets
		Targets\SQLite.NET.Settings.targets.netFx35 = Targets\SQLite.NET.Settings.targets.netFx35
		Targets\SQLite.NET.Settings.targets.netFx40 = Targets\SQLite.NET.Settings.targets.netFx40
		Targets\SQLite.NET.targets = Targets\SQLite.NET.targets
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.2013", "System.Data.SQLite\System.Data.SQLite.2013.csproj", "{AC139952-261A-4463-B6FA-AEBC25283A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Module.2013", "System.Data.SQLite\System.Data.SQLite.Module.2013.csproj", "{AC139952-261A-4463-B6FA-AEBC25284A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Linq.2013", "System.Data.SQLite.Linq\System.Data.SQLite.Linq.2013.csproj", "{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.EF6.2013", "System.Data.SQLite.Linq\System.Data.SQLite.EF6.2013.csproj", "{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.2013", "SQLite.Interop\SQLite.Interop.2013.vcxproj", "{53784BC1-A8BC-4AC8-8A3E-158D6807345A}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.Static.2013", "SQLite.Interop\SQLite.Interop.Static.2013.vcxproj", "{490CBC51-A3B2-4397-89F9-16E858DCB4F8}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Designer.2013", "SQLite.Designer\SQLite.Designer.2013.csproj", "{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Installer.2013", "tools\install\Installer.2013.csproj", "{A41FE2A5-07AD-4CE7-B836-1544634816F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test.2013", "test\test.2013.csproj", "{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testlinq.2013", "testlinq\testlinq.2013.csproj", "{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D} = {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testef6.2013", "testlinq\testef6.2013.csproj", "{2975AE0A-F159-4834-A837-5242C6691886}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B} = {F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}
	EndProjectSection
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|Win32 = Debug|Win32
		Debug|x64 = Debug|x64
		DebugManagedOnly|Any CPU = DebugManagedOnly|Any CPU
		DebugManagedOnly|Mixed Platforms = DebugManagedOnly|Mixed Platforms
		DebugManagedOnly|Win32 = DebugManagedOnly|Win32
		DebugManagedOnly|x64 = DebugManagedOnly|x64
		DebugNativeOnly|Any CPU = DebugNativeOnly|Any CPU
		DebugNativeOnly|Mixed Platforms = DebugNativeOnly|Mixed Platforms
		DebugNativeOnly|Win32 = DebugNativeOnly|Win32
		DebugNativeOnly|x64 = DebugNativeOnly|x64
		Release|Any CPU = Release|Any CPU
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|Win32 = Release|Win32
		Release|x64 = Release|x64
		ReleaseManagedOnly|Any CPU = ReleaseManagedOnly|Any CPU
		ReleaseManagedOnly|Mixed Platforms = ReleaseManagedOnly|Mixed Platforms
		ReleaseManagedOnly|Win32 = ReleaseManagedOnly|Win32
		ReleaseManagedOnly|x64 = ReleaseManagedOnly|x64
		ReleaseNativeOnly|Any CPU = ReleaseNativeOnly|Any CPU
		ReleaseNativeOnly|Mixed Platforms = ReleaseNativeOnly|Mixed Platforms
		ReleaseNativeOnly|Win32 = ReleaseNativeOnly|Win32
		ReleaseNativeOnly|x64 = ReleaseNativeOnly|x64
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.ActiveCfg = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.Build.0 = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.ActiveCfg = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.Build.0 = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.ActiveCfg = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.Build.0 = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.ActiveCfg = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.Build.0 = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Added SQLite.NET.2013.sln.































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
Microsoft Visual Studio Solution File, Format Version 13.00
# Visual Studio 2013
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = preProject
		data\exclude_bin.txt = data\exclude_bin.txt
		data\exclude_src.txt = data\exclude_src.txt
		Keys\System.Data.SQLite.CF.snk = Keys\System.Data.SQLite.CF.snk
		Keys\System.Data.SQLite.snk = Keys\System.Data.SQLite.snk
		NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\content\config.install.xdt = NuGet\shared\Core\content\config.install.xdt
		NuGet\shared\Core\content\config.transform = NuGet\shared\Core\content\config.transform
		NuGet\net40\EF6\content\config.transform = NuGet\net40\EF6\content\config.transform
		NuGet\net40\EF6\tools\provider.ps1 = NuGet\net40\EF6\tools\provider.ps1
		NuGet\SQLite.Core.nuspec = NuGet\SQLite.Core.nuspec
		NuGet\SQLite.Core.Beta.nuspec = NuGet\SQLite.Core.Beta.nuspec
		NuGet\SQLite.Core.NetFramework.nuspec = NuGet\SQLite.Core.NetFramework.nuspec
		NuGet\SQLite.Core.NetStandard.nuspec = NuGet\SQLite.Core.NetStandard.nuspec
		NuGet\SQLite.Core.Test.nuspec = NuGet\SQLite.Core.Test.nuspec
		NuGet\SQLite.Core.MSIL.nuspec = NuGet\SQLite.Core.MSIL.nuspec
		NuGet\SQLite.Core.MSIL.Beta.nuspec = NuGet\SQLite.Core.MSIL.Beta.nuspec
		NuGet\SQLite.Core.MSIL.Test.nuspec = NuGet\SQLite.Core.MSIL.Test.nuspec
		NuGet\SQLite.EF6.nuspec = NuGet\SQLite.EF6.nuspec
		NuGet\SQLite.EF6.Beta.nuspec = NuGet\SQLite.EF6.Beta.nuspec
		NuGet\SQLite.EF6.Test.nuspec = NuGet\SQLite.EF6.Test.nuspec
		NuGet\SQLite.Linq.nuspec = NuGet\SQLite.Linq.nuspec
		NuGet\SQLite.Linq.Beta.nuspec = NuGet\SQLite.Linq.Beta.nuspec
		NuGet\SQLite.Linq.Test.nuspec = NuGet\SQLite.Linq.Test.nuspec
		NuGet\SQLite.MSIL.nuspec = NuGet\SQLite.MSIL.nuspec
		NuGet\SQLite.MSIL.Beta.nuspec = NuGet\SQLite.MSIL.Beta.nuspec
		NuGet\SQLite.MSIL.Test.nuspec = NuGet\SQLite.MSIL.Test.nuspec
		NuGet\SQLite.nuspec = NuGet\SQLite.nuspec
		NuGet\SQLite.Beta.nuspec = NuGet\SQLite.Beta.nuspec
		NuGet\SQLite.Test.nuspec = NuGet\SQLite.Test.nuspec
		NuGet\SQLite.x64.nuspec = NuGet\SQLite.x64.nuspec
		NuGet\SQLite.x86.nuspec = NuGet\SQLite.x86.nuspec
		readme.htm = readme.htm
		System.Data.SQLite\Targets\System.Data.SQLite.Files.targets = System.Data.SQLite\Targets\System.Data.SQLite.Files.targets
		System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets = System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets
		System.Data.SQLite\Targets\System.Data.SQLite.References.targets = System.Data.SQLite\Targets\System.Data.SQLite.References.targets
		Targets\SQLite.NET.Mono.Settings.targets = Targets\SQLite.NET.Mono.Settings.targets
		Targets\SQLite.NET.NetStandard20.Settings.targets = Targets\SQLite.NET.NetStandard20.Settings.targets
		Targets\SQLite.NET.NetStandard21.Settings.targets = Targets\SQLite.NET.NetStandard21.Settings.targets
		Targets\SQLite.NET.Platform.Settings.targets = Targets\SQLite.NET.Platform.Settings.targets
		Targets\SQLite.NET.Settings.targets = Targets\SQLite.NET.Settings.targets
		Targets\SQLite.NET.Settings.targets.netFx35 = Targets\SQLite.NET.Settings.targets.netFx35
		Targets\SQLite.NET.Settings.targets.netFx40 = Targets\SQLite.NET.Settings.targets.netFx40
		Targets\SQLite.NET.targets = Targets\SQLite.NET.targets
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.2013", "System.Data.SQLite\System.Data.SQLite.2013.csproj", "{AC139952-261A-4463-B6FA-AEBC25283A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Module.2013", "System.Data.SQLite\System.Data.SQLite.Module.2013.csproj", "{AC139952-261A-4463-B6FA-AEBC25284A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Linq.2013", "System.Data.SQLite.Linq\System.Data.SQLite.Linq.2013.csproj", "{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.EF6.2013", "System.Data.SQLite.Linq\System.Data.SQLite.EF6.2013.csproj", "{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.2013", "SQLite.Interop\SQLite.Interop.2013.vcxproj", "{53784BC1-A8BC-4AC8-8A3E-158D6807345A}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.Static.2013", "SQLite.Interop\SQLite.Interop.Static.2013.vcxproj", "{490CBC51-A3B2-4397-89F9-16E858DCB4F8}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Designer.2013", "SQLite.Designer\SQLite.Designer.2013.csproj", "{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Installer.2013", "tools\install\Installer.2013.csproj", "{A41FE2A5-07AD-4CE7-B836-1544634816F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test.2013", "test\test.2013.csproj", "{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testlinq.2013", "testlinq\testlinq.2013.csproj", "{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D} = {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testef6.2013", "testlinq\testef6.2013.csproj", "{2975AE0A-F159-4834-A837-5242C6691886}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B} = {F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}
	EndProjectSection
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|Win32 = Debug|Win32
		Debug|x64 = Debug|x64
		DebugNativeOnly|Any CPU = DebugNativeOnly|Any CPU
		DebugNativeOnly|Mixed Platforms = DebugNativeOnly|Mixed Platforms
		DebugNativeOnly|Win32 = DebugNativeOnly|Win32
		DebugNativeOnly|x64 = DebugNativeOnly|x64
		Release|Any CPU = Release|Any CPU
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|Win32 = Release|Win32
		Release|x64 = Release|x64
		ReleaseNativeOnly|Any CPU = ReleaseNativeOnly|Any CPU
		ReleaseNativeOnly|Mixed Platforms = ReleaseNativeOnly|Mixed Platforms
		ReleaseNativeOnly|Win32 = ReleaseNativeOnly|Win32
		ReleaseNativeOnly|x64 = ReleaseNativeOnly|x64
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.ActiveCfg = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.Build.0 = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.ActiveCfg = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.Build.0 = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.ActiveCfg = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.Build.0 = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.ActiveCfg = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.Build.0 = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Added SQLite.NET.2015.MSBuild.sln.



































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = preProject
		data\exclude_bin.txt = data\exclude_bin.txt
		data\exclude_src.txt = data\exclude_src.txt
		Keys\System.Data.SQLite.CF.snk = Keys\System.Data.SQLite.CF.snk
		Keys\System.Data.SQLite.snk = Keys\System.Data.SQLite.snk
		NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\content\config.install.xdt = NuGet\shared\Core\content\config.install.xdt
		NuGet\shared\Core\content\config.transform = NuGet\shared\Core\content\config.transform
		NuGet\net40\EF6\content\config.transform = NuGet\net40\EF6\content\config.transform
		NuGet\net40\EF6\tools\provider.ps1 = NuGet\net40\EF6\tools\provider.ps1
		NuGet\SQLite.Core.nuspec = NuGet\SQLite.Core.nuspec
		NuGet\SQLite.Core.Beta.nuspec = NuGet\SQLite.Core.Beta.nuspec
		NuGet\SQLite.Core.NetFramework.nuspec = NuGet\SQLite.Core.NetFramework.nuspec
		NuGet\SQLite.Core.NetStandard.nuspec = NuGet\SQLite.Core.NetStandard.nuspec
		NuGet\SQLite.Core.Test.nuspec = NuGet\SQLite.Core.Test.nuspec
		NuGet\SQLite.Core.MSIL.nuspec = NuGet\SQLite.Core.MSIL.nuspec
		NuGet\SQLite.Core.MSIL.Beta.nuspec = NuGet\SQLite.Core.MSIL.Beta.nuspec
		NuGet\SQLite.Core.MSIL.Test.nuspec = NuGet\SQLite.Core.MSIL.Test.nuspec
		NuGet\SQLite.EF6.nuspec = NuGet\SQLite.EF6.nuspec
		NuGet\SQLite.EF6.Beta.nuspec = NuGet\SQLite.EF6.Beta.nuspec
		NuGet\SQLite.EF6.Test.nuspec = NuGet\SQLite.EF6.Test.nuspec
		NuGet\SQLite.Linq.nuspec = NuGet\SQLite.Linq.nuspec
		NuGet\SQLite.Linq.Beta.nuspec = NuGet\SQLite.Linq.Beta.nuspec
		NuGet\SQLite.Linq.Test.nuspec = NuGet\SQLite.Linq.Test.nuspec
		NuGet\SQLite.MSIL.nuspec = NuGet\SQLite.MSIL.nuspec
		NuGet\SQLite.MSIL.Beta.nuspec = NuGet\SQLite.MSIL.Beta.nuspec
		NuGet\SQLite.MSIL.Test.nuspec = NuGet\SQLite.MSIL.Test.nuspec
		NuGet\SQLite.nuspec = NuGet\SQLite.nuspec
		NuGet\SQLite.Beta.nuspec = NuGet\SQLite.Beta.nuspec
		NuGet\SQLite.Test.nuspec = NuGet\SQLite.Test.nuspec
		NuGet\SQLite.x64.nuspec = NuGet\SQLite.x64.nuspec
		NuGet\SQLite.x86.nuspec = NuGet\SQLite.x86.nuspec
		readme.htm = readme.htm
		System.Data.SQLite\Targets\System.Data.SQLite.Files.targets = System.Data.SQLite\Targets\System.Data.SQLite.Files.targets
		System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets = System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets
		System.Data.SQLite\Targets\System.Data.SQLite.References.targets = System.Data.SQLite\Targets\System.Data.SQLite.References.targets
		Targets\SQLite.NET.Mono.Settings.targets = Targets\SQLite.NET.Mono.Settings.targets
		Targets\SQLite.NET.NetStandard20.Settings.targets = Targets\SQLite.NET.NetStandard20.Settings.targets
		Targets\SQLite.NET.NetStandard21.Settings.targets = Targets\SQLite.NET.NetStandard21.Settings.targets
		Targets\SQLite.NET.Platform.Settings.targets = Targets\SQLite.NET.Platform.Settings.targets
		Targets\SQLite.NET.Settings.targets = Targets\SQLite.NET.Settings.targets
		Targets\SQLite.NET.Settings.targets.netFx35 = Targets\SQLite.NET.Settings.targets.netFx35
		Targets\SQLite.NET.Settings.targets.netFx40 = Targets\SQLite.NET.Settings.targets.netFx40
		Targets\SQLite.NET.targets = Targets\SQLite.NET.targets
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.2015", "System.Data.SQLite\System.Data.SQLite.2015.csproj", "{AC139952-261A-4463-B6FA-AEBC25283A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Module.2015", "System.Data.SQLite\System.Data.SQLite.Module.2015.csproj", "{AC139952-261A-4463-B6FA-AEBC25284A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Linq.2015", "System.Data.SQLite.Linq\System.Data.SQLite.Linq.2015.csproj", "{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.EF6.2015", "System.Data.SQLite.Linq\System.Data.SQLite.EF6.2015.csproj", "{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.2015", "SQLite.Interop\SQLite.Interop.2015.vcxproj", "{53784BC1-A8BC-4AC8-8A3E-158D6807345A}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.Static.2015", "SQLite.Interop\SQLite.Interop.Static.2015.vcxproj", "{490CBC51-A3B2-4397-89F9-16E858DCB4F8}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Designer.2015", "SQLite.Designer\SQLite.Designer.2015.csproj", "{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Installer.2015", "tools\install\Installer.2015.csproj", "{A41FE2A5-07AD-4CE7-B836-1544634816F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test.2015", "test\test.2015.csproj", "{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testlinq.2015", "testlinq\testlinq.2015.csproj", "{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D} = {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testef6.2015", "testlinq\testef6.2015.csproj", "{2975AE0A-F159-4834-A837-5242C6691886}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B} = {F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}
	EndProjectSection
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|Win32 = Debug|Win32
		Debug|x64 = Debug|x64
		DebugManagedOnly|Any CPU = DebugManagedOnly|Any CPU
		DebugManagedOnly|Mixed Platforms = DebugManagedOnly|Mixed Platforms
		DebugManagedOnly|Win32 = DebugManagedOnly|Win32
		DebugManagedOnly|x64 = DebugManagedOnly|x64
		DebugNativeOnly|Any CPU = DebugNativeOnly|Any CPU
		DebugNativeOnly|Mixed Platforms = DebugNativeOnly|Mixed Platforms
		DebugNativeOnly|Win32 = DebugNativeOnly|Win32
		DebugNativeOnly|x64 = DebugNativeOnly|x64
		Release|Any CPU = Release|Any CPU
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|Win32 = Release|Win32
		Release|x64 = Release|x64
		ReleaseManagedOnly|Any CPU = ReleaseManagedOnly|Any CPU
		ReleaseManagedOnly|Mixed Platforms = ReleaseManagedOnly|Mixed Platforms
		ReleaseManagedOnly|Win32 = ReleaseManagedOnly|Win32
		ReleaseManagedOnly|x64 = ReleaseManagedOnly|x64
		ReleaseNativeOnly|Any CPU = ReleaseNativeOnly|Any CPU
		ReleaseNativeOnly|Mixed Platforms = ReleaseNativeOnly|Mixed Platforms
		ReleaseNativeOnly|Win32 = ReleaseNativeOnly|Win32
		ReleaseNativeOnly|x64 = ReleaseNativeOnly|x64
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.ActiveCfg = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.Build.0 = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.ActiveCfg = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.Build.0 = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.ActiveCfg = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.Build.0 = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.ActiveCfg = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.Build.0 = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Added SQLite.NET.2015.sln.



































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = preProject
		data\exclude_bin.txt = data\exclude_bin.txt
		data\exclude_src.txt = data\exclude_src.txt
		Keys\System.Data.SQLite.CF.snk = Keys\System.Data.SQLite.CF.snk
		Keys\System.Data.SQLite.snk = Keys\System.Data.SQLite.snk
		NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\content\config.install.xdt = NuGet\shared\Core\content\config.install.xdt
		NuGet\shared\Core\content\config.transform = NuGet\shared\Core\content\config.transform
		NuGet\net40\EF6\content\config.transform = NuGet\net40\EF6\content\config.transform
		NuGet\net40\EF6\tools\provider.ps1 = NuGet\net40\EF6\tools\provider.ps1
		NuGet\SQLite.Core.nuspec = NuGet\SQLite.Core.nuspec
		NuGet\SQLite.Core.Beta.nuspec = NuGet\SQLite.Core.Beta.nuspec
		NuGet\SQLite.Core.NetFramework.nuspec = NuGet\SQLite.Core.NetFramework.nuspec
		NuGet\SQLite.Core.NetStandard.nuspec = NuGet\SQLite.Core.NetStandard.nuspec
		NuGet\SQLite.Core.Test.nuspec = NuGet\SQLite.Core.Test.nuspec
		NuGet\SQLite.Core.MSIL.nuspec = NuGet\SQLite.Core.MSIL.nuspec
		NuGet\SQLite.Core.MSIL.Beta.nuspec = NuGet\SQLite.Core.MSIL.Beta.nuspec
		NuGet\SQLite.Core.MSIL.Test.nuspec = NuGet\SQLite.Core.MSIL.Test.nuspec
		NuGet\SQLite.EF6.nuspec = NuGet\SQLite.EF6.nuspec
		NuGet\SQLite.EF6.Beta.nuspec = NuGet\SQLite.EF6.Beta.nuspec
		NuGet\SQLite.EF6.Test.nuspec = NuGet\SQLite.EF6.Test.nuspec
		NuGet\SQLite.Linq.nuspec = NuGet\SQLite.Linq.nuspec
		NuGet\SQLite.Linq.Beta.nuspec = NuGet\SQLite.Linq.Beta.nuspec
		NuGet\SQLite.Linq.Test.nuspec = NuGet\SQLite.Linq.Test.nuspec
		NuGet\SQLite.MSIL.nuspec = NuGet\SQLite.MSIL.nuspec
		NuGet\SQLite.MSIL.Beta.nuspec = NuGet\SQLite.MSIL.Beta.nuspec
		NuGet\SQLite.MSIL.Test.nuspec = NuGet\SQLite.MSIL.Test.nuspec
		NuGet\SQLite.nuspec = NuGet\SQLite.nuspec
		NuGet\SQLite.Beta.nuspec = NuGet\SQLite.Beta.nuspec
		NuGet\SQLite.Test.nuspec = NuGet\SQLite.Test.nuspec
		NuGet\SQLite.x64.nuspec = NuGet\SQLite.x64.nuspec
		NuGet\SQLite.x86.nuspec = NuGet\SQLite.x86.nuspec
		readme.htm = readme.htm
		System.Data.SQLite\Targets\System.Data.SQLite.Files.targets = System.Data.SQLite\Targets\System.Data.SQLite.Files.targets
		System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets = System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets
		System.Data.SQLite\Targets\System.Data.SQLite.References.targets = System.Data.SQLite\Targets\System.Data.SQLite.References.targets
		Targets\SQLite.NET.Mono.Settings.targets = Targets\SQLite.NET.Mono.Settings.targets
		Targets\SQLite.NET.NetStandard20.Settings.targets = Targets\SQLite.NET.NetStandard20.Settings.targets
		Targets\SQLite.NET.NetStandard21.Settings.targets = Targets\SQLite.NET.NetStandard21.Settings.targets
		Targets\SQLite.NET.Platform.Settings.targets = Targets\SQLite.NET.Platform.Settings.targets
		Targets\SQLite.NET.Settings.targets = Targets\SQLite.NET.Settings.targets
		Targets\SQLite.NET.Settings.targets.netFx35 = Targets\SQLite.NET.Settings.targets.netFx35
		Targets\SQLite.NET.Settings.targets.netFx40 = Targets\SQLite.NET.Settings.targets.netFx40
		Targets\SQLite.NET.targets = Targets\SQLite.NET.targets
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.2015", "System.Data.SQLite\System.Data.SQLite.2015.csproj", "{AC139952-261A-4463-B6FA-AEBC25283A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Module.2015", "System.Data.SQLite\System.Data.SQLite.Module.2015.csproj", "{AC139952-261A-4463-B6FA-AEBC25284A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Linq.2015", "System.Data.SQLite.Linq\System.Data.SQLite.Linq.2015.csproj", "{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.EF6.2015", "System.Data.SQLite.Linq\System.Data.SQLite.EF6.2015.csproj", "{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.2015", "SQLite.Interop\SQLite.Interop.2015.vcxproj", "{53784BC1-A8BC-4AC8-8A3E-158D6807345A}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.Static.2015", "SQLite.Interop\SQLite.Interop.Static.2015.vcxproj", "{490CBC51-A3B2-4397-89F9-16E858DCB4F8}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Designer.2015", "SQLite.Designer\SQLite.Designer.2015.csproj", "{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Installer.2015", "tools\install\Installer.2015.csproj", "{A41FE2A5-07AD-4CE7-B836-1544634816F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test.2015", "test\test.2015.csproj", "{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testlinq.2015", "testlinq\testlinq.2015.csproj", "{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D} = {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testef6.2015", "testlinq\testef6.2015.csproj", "{2975AE0A-F159-4834-A837-5242C6691886}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B} = {F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}
	EndProjectSection
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|Win32 = Debug|Win32
		Debug|x64 = Debug|x64
		DebugNativeOnly|Any CPU = DebugNativeOnly|Any CPU
		DebugNativeOnly|Mixed Platforms = DebugNativeOnly|Mixed Platforms
		DebugNativeOnly|Win32 = DebugNativeOnly|Win32
		DebugNativeOnly|x64 = DebugNativeOnly|x64
		Release|Any CPU = Release|Any CPU
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|Win32 = Release|Win32
		Release|x64 = Release|x64
		ReleaseNativeOnly|Any CPU = ReleaseNativeOnly|Any CPU
		ReleaseNativeOnly|Mixed Platforms = ReleaseNativeOnly|Mixed Platforms
		ReleaseNativeOnly|Win32 = ReleaseNativeOnly|Win32
		ReleaseNativeOnly|x64 = ReleaseNativeOnly|x64
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.ActiveCfg = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.Build.0 = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.ActiveCfg = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.Build.0 = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.ActiveCfg = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.Build.0 = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.ActiveCfg = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.Build.0 = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Added SQLite.NET.2017.MSBuild.sln.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = preProject
		data\exclude_bin.txt = data\exclude_bin.txt
		data\exclude_src.txt = data\exclude_src.txt
		Keys\System.Data.SQLite.CF.snk = Keys\System.Data.SQLite.CF.snk
		Keys\System.Data.SQLite.snk = Keys\System.Data.SQLite.snk
		NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\content\config.install.xdt = NuGet\shared\Core\content\config.install.xdt
		NuGet\shared\Core\content\config.transform = NuGet\shared\Core\content\config.transform
		NuGet\net40\EF6\content\config.transform = NuGet\net40\EF6\content\config.transform
		NuGet\net40\EF6\tools\provider.ps1 = NuGet\net40\EF6\tools\provider.ps1
		NuGet\SQLite.Core.nuspec = NuGet\SQLite.Core.nuspec
		NuGet\SQLite.Core.Beta.nuspec = NuGet\SQLite.Core.Beta.nuspec
		NuGet\SQLite.Core.NetFramework.nuspec = NuGet\SQLite.Core.NetFramework.nuspec
		NuGet\SQLite.Core.NetStandard.nuspec = NuGet\SQLite.Core.NetStandard.nuspec
		NuGet\SQLite.Core.Test.nuspec = NuGet\SQLite.Core.Test.nuspec
		NuGet\SQLite.Core.MSIL.nuspec = NuGet\SQLite.Core.MSIL.nuspec
		NuGet\SQLite.Core.MSIL.Beta.nuspec = NuGet\SQLite.Core.MSIL.Beta.nuspec
		NuGet\SQLite.Core.MSIL.Test.nuspec = NuGet\SQLite.Core.MSIL.Test.nuspec
		NuGet\SQLite.EF6.nuspec = NuGet\SQLite.EF6.nuspec
		NuGet\SQLite.EF6.Beta.nuspec = NuGet\SQLite.EF6.Beta.nuspec
		NuGet\SQLite.EF6.Test.nuspec = NuGet\SQLite.EF6.Test.nuspec
		NuGet\SQLite.Linq.nuspec = NuGet\SQLite.Linq.nuspec
		NuGet\SQLite.Linq.Beta.nuspec = NuGet\SQLite.Linq.Beta.nuspec
		NuGet\SQLite.Linq.Test.nuspec = NuGet\SQLite.Linq.Test.nuspec
		NuGet\SQLite.MSIL.nuspec = NuGet\SQLite.MSIL.nuspec
		NuGet\SQLite.MSIL.Beta.nuspec = NuGet\SQLite.MSIL.Beta.nuspec
		NuGet\SQLite.MSIL.Test.nuspec = NuGet\SQLite.MSIL.Test.nuspec
		NuGet\SQLite.nuspec = NuGet\SQLite.nuspec
		NuGet\SQLite.Beta.nuspec = NuGet\SQLite.Beta.nuspec
		NuGet\SQLite.Test.nuspec = NuGet\SQLite.Test.nuspec
		NuGet\SQLite.x64.nuspec = NuGet\SQLite.x64.nuspec
		NuGet\SQLite.x86.nuspec = NuGet\SQLite.x86.nuspec
		readme.htm = readme.htm
		System.Data.SQLite\Targets\System.Data.SQLite.Files.targets = System.Data.SQLite\Targets\System.Data.SQLite.Files.targets
		System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets = System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets
		System.Data.SQLite\Targets\System.Data.SQLite.References.targets = System.Data.SQLite\Targets\System.Data.SQLite.References.targets
		Targets\SQLite.NET.Mono.Settings.targets = Targets\SQLite.NET.Mono.Settings.targets
		Targets\SQLite.NET.NetStandard20.Settings.targets = Targets\SQLite.NET.NetStandard20.Settings.targets
		Targets\SQLite.NET.NetStandard21.Settings.targets = Targets\SQLite.NET.NetStandard21.Settings.targets
		Targets\SQLite.NET.Platform.Settings.targets = Targets\SQLite.NET.Platform.Settings.targets
		Targets\SQLite.NET.Settings.targets = Targets\SQLite.NET.Settings.targets
		Targets\SQLite.NET.Settings.targets.netFx35 = Targets\SQLite.NET.Settings.targets.netFx35
		Targets\SQLite.NET.Settings.targets.netFx40 = Targets\SQLite.NET.Settings.targets.netFx40
		Targets\SQLite.NET.targets = Targets\SQLite.NET.targets
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.2017", "System.Data.SQLite\System.Data.SQLite.2017.csproj", "{AC139952-261A-4463-B6FA-AEBC25283A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.NetStandard20", "System.Data.SQLite\System.Data.SQLite.NetStandard20.csproj", "{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Module.2017", "System.Data.SQLite\System.Data.SQLite.Module.2017.csproj", "{AC139952-261A-4463-B6FA-AEBC25284A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Linq.2017", "System.Data.SQLite.Linq\System.Data.SQLite.Linq.2017.csproj", "{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.EF6.2017", "System.Data.SQLite.Linq\System.Data.SQLite.EF6.2017.csproj", "{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.2017", "SQLite.Interop\SQLite.Interop.2017.vcxproj", "{53784BC1-A8BC-4AC8-8A3E-158D6807345A}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.Static.2017", "SQLite.Interop\SQLite.Interop.Static.2017.vcxproj", "{490CBC51-A3B2-4397-89F9-16E858DCB4F8}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Designer.2017", "SQLite.Designer\SQLite.Designer.2017.csproj", "{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Installer.2017", "tools\install\Installer.2017.csproj", "{A41FE2A5-07AD-4CE7-B836-1544634816F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test.2017", "test\test.2017.csproj", "{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testlinq.2017", "testlinq\testlinq.2017.csproj", "{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D} = {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testef6.2017", "testlinq\testef6.2017.csproj", "{2975AE0A-F159-4834-A837-5242C6691886}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B} = {F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}
	EndProjectSection
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|Win32 = Debug|Win32
		Debug|x64 = Debug|x64
		DebugManagedOnly|Any CPU = DebugManagedOnly|Any CPU
		DebugManagedOnly|Mixed Platforms = DebugManagedOnly|Mixed Platforms
		DebugManagedOnly|Win32 = DebugManagedOnly|Win32
		DebugManagedOnly|x64 = DebugManagedOnly|x64
		DebugNativeOnly|Any CPU = DebugNativeOnly|Any CPU
		DebugNativeOnly|Mixed Platforms = DebugNativeOnly|Mixed Platforms
		DebugNativeOnly|Win32 = DebugNativeOnly|Win32
		DebugNativeOnly|x64 = DebugNativeOnly|x64
		Release|Any CPU = Release|Any CPU
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|Win32 = Release|Win32
		Release|x64 = Release|x64
		ReleaseManagedOnly|Any CPU = ReleaseManagedOnly|Any CPU
		ReleaseManagedOnly|Mixed Platforms = ReleaseManagedOnly|Mixed Platforms
		ReleaseManagedOnly|Win32 = ReleaseManagedOnly|Win32
		ReleaseManagedOnly|x64 = ReleaseManagedOnly|x64
		ReleaseNativeOnly|Any CPU = ReleaseNativeOnly|Any CPU
		ReleaseNativeOnly|Mixed Platforms = ReleaseNativeOnly|Mixed Platforms
		ReleaseNativeOnly|Win32 = ReleaseNativeOnly|Win32
		ReleaseNativeOnly|x64 = ReleaseNativeOnly|x64
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Win32.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|x64.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|x64.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Any CPU.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Win32.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Win32.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|x64.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|x64.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.ActiveCfg = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.Build.0 = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugManagedOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.ActiveCfg = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.Build.0 = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseManagedOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.ActiveCfg = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.Build.0 = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugManagedOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.ActiveCfg = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.Build.0 = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseManagedOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Added SQLite.NET.2017.sln.







































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = preProject
		data\exclude_bin.txt = data\exclude_bin.txt
		data\exclude_src.txt = data\exclude_src.txt
		Keys\System.Data.SQLite.CF.snk = Keys\System.Data.SQLite.CF.snk
		Keys\System.Data.SQLite.snk = Keys\System.Data.SQLite.snk
		NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\content\config.install.xdt = NuGet\shared\Core\content\config.install.xdt
		NuGet\shared\Core\content\config.transform = NuGet\shared\Core\content\config.transform
		NuGet\net40\EF6\content\config.transform = NuGet\net40\EF6\content\config.transform
		NuGet\net40\EF6\tools\provider.ps1 = NuGet\net40\EF6\tools\provider.ps1
		NuGet\SQLite.Core.nuspec = NuGet\SQLite.Core.nuspec
		NuGet\SQLite.Core.Beta.nuspec = NuGet\SQLite.Core.Beta.nuspec
		NuGet\SQLite.Core.NetFramework.nuspec = NuGet\SQLite.Core.NetFramework.nuspec
		NuGet\SQLite.Core.NetStandard.nuspec = NuGet\SQLite.Core.NetStandard.nuspec
		NuGet\SQLite.Core.Test.nuspec = NuGet\SQLite.Core.Test.nuspec
		NuGet\SQLite.Core.MSIL.nuspec = NuGet\SQLite.Core.MSIL.nuspec
		NuGet\SQLite.Core.MSIL.Beta.nuspec = NuGet\SQLite.Core.MSIL.Beta.nuspec
		NuGet\SQLite.Core.MSIL.Test.nuspec = NuGet\SQLite.Core.MSIL.Test.nuspec
		NuGet\SQLite.EF6.nuspec = NuGet\SQLite.EF6.nuspec
		NuGet\SQLite.EF6.Beta.nuspec = NuGet\SQLite.EF6.Beta.nuspec
		NuGet\SQLite.EF6.Test.nuspec = NuGet\SQLite.EF6.Test.nuspec
		NuGet\SQLite.Linq.nuspec = NuGet\SQLite.Linq.nuspec
		NuGet\SQLite.Linq.Beta.nuspec = NuGet\SQLite.Linq.Beta.nuspec
		NuGet\SQLite.Linq.Test.nuspec = NuGet\SQLite.Linq.Test.nuspec
		NuGet\SQLite.MSIL.nuspec = NuGet\SQLite.MSIL.nuspec
		NuGet\SQLite.MSIL.Beta.nuspec = NuGet\SQLite.MSIL.Beta.nuspec
		NuGet\SQLite.MSIL.Test.nuspec = NuGet\SQLite.MSIL.Test.nuspec
		NuGet\SQLite.nuspec = NuGet\SQLite.nuspec
		NuGet\SQLite.Beta.nuspec = NuGet\SQLite.Beta.nuspec
		NuGet\SQLite.Test.nuspec = NuGet\SQLite.Test.nuspec
		NuGet\SQLite.x64.nuspec = NuGet\SQLite.x64.nuspec
		NuGet\SQLite.x86.nuspec = NuGet\SQLite.x86.nuspec
		readme.htm = readme.htm
		System.Data.SQLite\Targets\System.Data.SQLite.Files.targets = System.Data.SQLite\Targets\System.Data.SQLite.Files.targets
		System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets = System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets
		System.Data.SQLite\Targets\System.Data.SQLite.References.targets = System.Data.SQLite\Targets\System.Data.SQLite.References.targets
		Targets\SQLite.NET.Mono.Settings.targets = Targets\SQLite.NET.Mono.Settings.targets
		Targets\SQLite.NET.NetStandard20.Settings.targets = Targets\SQLite.NET.NetStandard20.Settings.targets
		Targets\SQLite.NET.NetStandard21.Settings.targets = Targets\SQLite.NET.NetStandard21.Settings.targets
		Targets\SQLite.NET.Platform.Settings.targets = Targets\SQLite.NET.Platform.Settings.targets
		Targets\SQLite.NET.Settings.targets = Targets\SQLite.NET.Settings.targets
		Targets\SQLite.NET.Settings.targets.netFx35 = Targets\SQLite.NET.Settings.targets.netFx35
		Targets\SQLite.NET.Settings.targets.netFx40 = Targets\SQLite.NET.Settings.targets.netFx40
		Targets\SQLite.NET.targets = Targets\SQLite.NET.targets
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.2017", "System.Data.SQLite\System.Data.SQLite.2017.csproj", "{AC139952-261A-4463-B6FA-AEBC25283A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.NetStandard20", "System.Data.SQLite\System.Data.SQLite.NetStandard20.csproj", "{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Module.2017", "System.Data.SQLite\System.Data.SQLite.Module.2017.csproj", "{AC139952-261A-4463-B6FA-AEBC25284A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Linq.2017", "System.Data.SQLite.Linq\System.Data.SQLite.Linq.2017.csproj", "{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.EF6.2017", "System.Data.SQLite.Linq\System.Data.SQLite.EF6.2017.csproj", "{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.2017", "SQLite.Interop\SQLite.Interop.2017.vcxproj", "{53784BC1-A8BC-4AC8-8A3E-158D6807345A}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop.Static.2017", "SQLite.Interop\SQLite.Interop.Static.2017.vcxproj", "{490CBC51-A3B2-4397-89F9-16E858DCB4F8}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SQLite.Designer.2017", "SQLite.Designer\SQLite.Designer.2017.csproj", "{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Installer.2017", "tools\install\Installer.2017.csproj", "{A41FE2A5-07AD-4CE7-B836-1544634816F5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test.2017", "test\test.2017.csproj", "{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testlinq.2017", "testlinq\testlinq.2017.csproj", "{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D} = {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testef6.2017", "testlinq\testef6.2017.csproj", "{2975AE0A-F159-4834-A837-5242C6691886}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B} = {F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}
	EndProjectSection
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|Win32 = Debug|Win32
		Debug|x64 = Debug|x64
		DebugNativeOnly|Any CPU = DebugNativeOnly|Any CPU
		DebugNativeOnly|Mixed Platforms = DebugNativeOnly|Mixed Platforms
		DebugNativeOnly|Win32 = DebugNativeOnly|Win32
		DebugNativeOnly|x64 = DebugNativeOnly|x64
		Release|Any CPU = Release|Any CPU
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|Win32 = Release|Win32
		Release|x64 = Release|x64
		ReleaseNativeOnly|Any CPU = ReleaseNativeOnly|Any CPU
		ReleaseNativeOnly|Mixed Platforms = ReleaseNativeOnly|Mixed Platforms
		ReleaseNativeOnly|Win32 = ReleaseNativeOnly|Win32
		ReleaseNativeOnly|x64 = ReleaseNativeOnly|x64
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Win32.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|x64.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|x64.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Any CPU.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Win32.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Win32.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|x64.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|x64.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Debug|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.Release|x64.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Any CPU.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.ActiveCfg = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|Win32.Build.0 = Debug|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.ActiveCfg = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Debug|x64.Build.0 = Debug|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Any CPU.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Mixed Platforms.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.ActiveCfg = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|Win32.Build.0 = Release|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.ActiveCfg = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.Release|x64.Build.0 = Release|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{53784BC1-A8BC-4AC8-8A3E-158D6807345A}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Any CPU.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Mixed Platforms.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.ActiveCfg = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|Win32.Build.0 = Debug|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.ActiveCfg = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Debug|x64.Build.0 = Debug|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Any CPU.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Mixed Platforms.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.ActiveCfg = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|Win32.Build.0 = DebugNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.ActiveCfg = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.DebugNativeOnly|x64.Build.0 = DebugNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Any CPU.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Mixed Platforms.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.ActiveCfg = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|Win32.Build.0 = Release|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.ActiveCfg = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.Release|x64.Build.0 = Release|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Any CPU.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Mixed Platforms.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.ActiveCfg = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|Win32.Build.0 = ReleaseNativeOnly|Win32
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.ActiveCfg = ReleaseNativeOnly|x64
		{490CBC51-A3B2-4397-89F9-16E858DCB4F8}.ReleaseNativeOnly|x64.Build.0 = ReleaseNativeOnly|x64
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Debug|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.Release|x64.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9B4A5CF6-5BE5-4926-ACC7-B729A8C05198}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Debug|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.Release|x64.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{A41FE2A5-07AD-4CE7-B836-1544634816F5}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|Win32.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.DebugNativeOnly|x64.Build.0 = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|Win32.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.ReleaseNativeOnly|x64.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Added SQLite.NET.NetStandard20.MSBuild.sln.































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = preProject
		data\exclude_bin.txt = data\exclude_bin.txt
		data\exclude_src.txt = data\exclude_src.txt
		Keys\System.Data.SQLite.CF.snk = Keys\System.Data.SQLite.CF.snk
		Keys\System.Data.SQLite.snk = Keys\System.Data.SQLite.snk
		NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\content\config.install.xdt = NuGet\shared\Core\content\config.install.xdt
		NuGet\shared\Core\content\config.transform = NuGet\shared\Core\content\config.transform
		NuGet\net40\EF6\content\config.transform = NuGet\net40\EF6\content\config.transform
		NuGet\net40\EF6\tools\provider.ps1 = NuGet\net40\EF6\tools\provider.ps1
		NuGet\SQLite.Core.nuspec = NuGet\SQLite.Core.nuspec
		NuGet\SQLite.Core.Beta.nuspec = NuGet\SQLite.Core.Beta.nuspec
		NuGet\SQLite.Core.NetFramework.nuspec = NuGet\SQLite.Core.NetFramework.nuspec
		NuGet\SQLite.Core.NetStandard.nuspec = NuGet\SQLite.Core.NetStandard.nuspec
		NuGet\SQLite.Core.Test.nuspec = NuGet\SQLite.Core.Test.nuspec
		NuGet\SQLite.Core.MSIL.nuspec = NuGet\SQLite.Core.MSIL.nuspec
		NuGet\SQLite.Core.MSIL.Beta.nuspec = NuGet\SQLite.Core.MSIL.Beta.nuspec
		NuGet\SQLite.Core.MSIL.Test.nuspec = NuGet\SQLite.Core.MSIL.Test.nuspec
		NuGet\SQLite.EF6.nuspec = NuGet\SQLite.EF6.nuspec
		NuGet\SQLite.EF6.Beta.nuspec = NuGet\SQLite.EF6.Beta.nuspec
		NuGet\SQLite.EF6.Test.nuspec = NuGet\SQLite.EF6.Test.nuspec
		NuGet\SQLite.Linq.nuspec = NuGet\SQLite.Linq.nuspec
		NuGet\SQLite.Linq.Beta.nuspec = NuGet\SQLite.Linq.Beta.nuspec
		NuGet\SQLite.Linq.Test.nuspec = NuGet\SQLite.Linq.Test.nuspec
		NuGet\SQLite.MSIL.nuspec = NuGet\SQLite.MSIL.nuspec
		NuGet\SQLite.MSIL.Beta.nuspec = NuGet\SQLite.MSIL.Beta.nuspec
		NuGet\SQLite.MSIL.Test.nuspec = NuGet\SQLite.MSIL.Test.nuspec
		NuGet\SQLite.nuspec = NuGet\SQLite.nuspec
		NuGet\SQLite.Beta.nuspec = NuGet\SQLite.Beta.nuspec
		NuGet\SQLite.Test.nuspec = NuGet\SQLite.Test.nuspec
		NuGet\SQLite.x64.nuspec = NuGet\SQLite.x64.nuspec
		NuGet\SQLite.x86.nuspec = NuGet\SQLite.x86.nuspec
		readme.htm = readme.htm
		System.Data.SQLite\Targets\System.Data.SQLite.Files.targets = System.Data.SQLite\Targets\System.Data.SQLite.Files.targets
		System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets = System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets
		System.Data.SQLite\Targets\System.Data.SQLite.References.targets = System.Data.SQLite\Targets\System.Data.SQLite.References.targets
		Targets\SQLite.NET.Mono.Settings.targets = Targets\SQLite.NET.Mono.Settings.targets
		Targets\SQLite.NET.NetStandard20.Settings.targets = Targets\SQLite.NET.NetStandard20.Settings.targets
		Targets\SQLite.NET.NetStandard21.Settings.targets = Targets\SQLite.NET.NetStandard21.Settings.targets
		Targets\SQLite.NET.Platform.Settings.targets = Targets\SQLite.NET.Platform.Settings.targets
		Targets\SQLite.NET.Settings.targets = Targets\SQLite.NET.Settings.targets
		Targets\SQLite.NET.Settings.targets.netFx35 = Targets\SQLite.NET.Settings.targets.netFx35
		Targets\SQLite.NET.Settings.targets.netFx40 = Targets\SQLite.NET.Settings.targets.netFx40
		Targets\SQLite.NET.targets = Targets\SQLite.NET.targets
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.NetStandard20", "System.Data.SQLite\System.Data.SQLite.NetStandard20.csproj", "{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|Win32 = Debug|Win32
		Debug|x64 = Debug|x64
		DebugManagedOnly|Any CPU = DebugManagedOnly|Any CPU
		DebugManagedOnly|Mixed Platforms = DebugManagedOnly|Mixed Platforms
		DebugManagedOnly|Win32 = DebugManagedOnly|Win32
		DebugManagedOnly|x64 = DebugManagedOnly|x64
		DebugNativeOnly|Any CPU = DebugNativeOnly|Any CPU
		DebugNativeOnly|Mixed Platforms = DebugNativeOnly|Mixed Platforms
		DebugNativeOnly|Win32 = DebugNativeOnly|Win32
		DebugNativeOnly|x64 = DebugNativeOnly|x64
		Release|Any CPU = Release|Any CPU
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|Win32 = Release|Win32
		Release|x64 = Release|x64
		ReleaseManagedOnly|Any CPU = ReleaseManagedOnly|Any CPU
		ReleaseManagedOnly|Mixed Platforms = ReleaseManagedOnly|Mixed Platforms
		ReleaseManagedOnly|Win32 = ReleaseManagedOnly|Win32
		ReleaseManagedOnly|x64 = ReleaseManagedOnly|x64
		ReleaseNativeOnly|Any CPU = ReleaseNativeOnly|Any CPU
		ReleaseNativeOnly|Mixed Platforms = ReleaseNativeOnly|Mixed Platforms
		ReleaseNativeOnly|Win32 = ReleaseNativeOnly|Win32
		ReleaseNativeOnly|x64 = ReleaseNativeOnly|x64
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Win32.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|x64.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|x64.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Any CPU.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Win32.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Win32.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|x64.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|x64.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Added SQLite.NET.NetStandard20.sln.























































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.16
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = preProject
		data\exclude_bin.txt = data\exclude_bin.txt
		data\exclude_src.txt = data\exclude_src.txt
		Keys\System.Data.SQLite.CF.snk = Keys\System.Data.SQLite.CF.snk
		Keys\System.Data.SQLite.snk = Keys\System.Data.SQLite.snk
		NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\content\config.install.xdt = NuGet\shared\Core\content\config.install.xdt
		NuGet\shared\Core\content\config.transform = NuGet\shared\Core\content\config.transform
		NuGet\net40\EF6\content\config.transform = NuGet\net40\EF6\content\config.transform
		NuGet\net40\EF6\tools\provider.ps1 = NuGet\net40\EF6\tools\provider.ps1
		NuGet\SQLite.Core.nuspec = NuGet\SQLite.Core.nuspec
		NuGet\SQLite.Core.Beta.nuspec = NuGet\SQLite.Core.Beta.nuspec
		NuGet\SQLite.Core.NetFramework.nuspec = NuGet\SQLite.Core.NetFramework.nuspec
		NuGet\SQLite.Core.NetStandard.nuspec = NuGet\SQLite.Core.NetStandard.nuspec
		NuGet\SQLite.Core.Test.nuspec = NuGet\SQLite.Core.Test.nuspec
		NuGet\SQLite.Core.MSIL.nuspec = NuGet\SQLite.Core.MSIL.nuspec
		NuGet\SQLite.Core.MSIL.Beta.nuspec = NuGet\SQLite.Core.MSIL.Beta.nuspec
		NuGet\SQLite.Core.MSIL.Test.nuspec = NuGet\SQLite.Core.MSIL.Test.nuspec
		NuGet\SQLite.EF6.nuspec = NuGet\SQLite.EF6.nuspec
		NuGet\SQLite.EF6.Beta.nuspec = NuGet\SQLite.EF6.Beta.nuspec
		NuGet\SQLite.EF6.Test.nuspec = NuGet\SQLite.EF6.Test.nuspec
		NuGet\SQLite.Linq.nuspec = NuGet\SQLite.Linq.nuspec
		NuGet\SQLite.Linq.Beta.nuspec = NuGet\SQLite.Linq.Beta.nuspec
		NuGet\SQLite.Linq.Test.nuspec = NuGet\SQLite.Linq.Test.nuspec
		NuGet\SQLite.MSIL.nuspec = NuGet\SQLite.MSIL.nuspec
		NuGet\SQLite.MSIL.Beta.nuspec = NuGet\SQLite.MSIL.Beta.nuspec
		NuGet\SQLite.MSIL.Test.nuspec = NuGet\SQLite.MSIL.Test.nuspec
		NuGet\SQLite.nuspec = NuGet\SQLite.nuspec
		NuGet\SQLite.Beta.nuspec = NuGet\SQLite.Beta.nuspec
		NuGet\SQLite.Test.nuspec = NuGet\SQLite.Test.nuspec
		NuGet\SQLite.x64.nuspec = NuGet\SQLite.x64.nuspec
		NuGet\SQLite.x86.nuspec = NuGet\SQLite.x86.nuspec
		readme.htm = readme.htm
		System.Data.SQLite\Targets\System.Data.SQLite.Files.targets = System.Data.SQLite\Targets\System.Data.SQLite.Files.targets
		System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets = System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets
		System.Data.SQLite\Targets\System.Data.SQLite.References.targets = System.Data.SQLite\Targets\System.Data.SQLite.References.targets
		Targets\SQLite.NET.Mono.Settings.targets = Targets\SQLite.NET.Mono.Settings.targets
		Targets\SQLite.NET.NetStandard20.Settings.targets = Targets\SQLite.NET.NetStandard20.Settings.targets
		Targets\SQLite.NET.NetStandard21.Settings.targets = Targets\SQLite.NET.NetStandard21.Settings.targets
		Targets\SQLite.NET.Platform.Settings.targets = Targets\SQLite.NET.Platform.Settings.targets
		Targets\SQLite.NET.Settings.targets = Targets\SQLite.NET.Settings.targets
		Targets\SQLite.NET.Settings.targets.netFx35 = Targets\SQLite.NET.Settings.targets.netFx35
		Targets\SQLite.NET.Settings.targets.netFx40 = Targets\SQLite.NET.Settings.targets.netFx40
		Targets\SQLite.NET.targets = Targets\SQLite.NET.targets
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.NetStandard20", "System.Data.SQLite\System.Data.SQLite.NetStandard20.csproj", "{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|Win32 = Debug|Win32
		Debug|x64 = Debug|x64
		DebugNativeOnly|Any CPU = DebugNativeOnly|Any CPU
		DebugNativeOnly|Mixed Platforms = DebugNativeOnly|Mixed Platforms
		DebugNativeOnly|Win32 = DebugNativeOnly|Win32
		DebugNativeOnly|x64 = DebugNativeOnly|x64
		Release|Any CPU = Release|Any CPU
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|Win32 = Release|Win32
		Release|x64 = Release|x64
		ReleaseNativeOnly|Any CPU = ReleaseNativeOnly|Any CPU
		ReleaseNativeOnly|Mixed Platforms = ReleaseNativeOnly|Mixed Platforms
		ReleaseNativeOnly|Win32 = ReleaseNativeOnly|Win32
		ReleaseNativeOnly|x64 = ReleaseNativeOnly|x64
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Win32.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|x64.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|x64.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Any CPU.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Win32.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Win32.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|x64.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|x64.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Added SQLite.NET.NetStandard21.MSBuild.sln.















































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28803.452
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = preProject
		data\exclude_bin.txt = data\exclude_bin.txt
		data\exclude_src.txt = data\exclude_src.txt
		Keys\System.Data.SQLite.CF.snk = Keys\System.Data.SQLite.CF.snk
		Keys\System.Data.SQLite.snk = Keys\System.Data.SQLite.snk
		NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\content\config.install.xdt = NuGet\shared\Core\content\config.install.xdt
		NuGet\shared\Core\content\config.transform = NuGet\shared\Core\content\config.transform
		NuGet\net40\EF6\content\config.transform = NuGet\net40\EF6\content\config.transform
		NuGet\net40\EF6\tools\provider.ps1 = NuGet\net40\EF6\tools\provider.ps1
		NuGet\SQLite.Core.nuspec = NuGet\SQLite.Core.nuspec
		NuGet\SQLite.Core.Beta.nuspec = NuGet\SQLite.Core.Beta.nuspec
		NuGet\SQLite.Core.NetFramework.nuspec = NuGet\SQLite.Core.NetFramework.nuspec
		NuGet\SQLite.Core.NetStandard.nuspec = NuGet\SQLite.Core.NetStandard.nuspec
		NuGet\SQLite.Core.Test.nuspec = NuGet\SQLite.Core.Test.nuspec
		NuGet\SQLite.Core.MSIL.nuspec = NuGet\SQLite.Core.MSIL.nuspec
		NuGet\SQLite.Core.MSIL.Beta.nuspec = NuGet\SQLite.Core.MSIL.Beta.nuspec
		NuGet\SQLite.Core.MSIL.Test.nuspec = NuGet\SQLite.Core.MSIL.Test.nuspec
		NuGet\SQLite.EF6.nuspec = NuGet\SQLite.EF6.nuspec
		NuGet\SQLite.EF6.Beta.nuspec = NuGet\SQLite.EF6.Beta.nuspec
		NuGet\SQLite.EF6.Test.nuspec = NuGet\SQLite.EF6.Test.nuspec
		NuGet\SQLite.Linq.nuspec = NuGet\SQLite.Linq.nuspec
		NuGet\SQLite.Linq.Beta.nuspec = NuGet\SQLite.Linq.Beta.nuspec
		NuGet\SQLite.Linq.Test.nuspec = NuGet\SQLite.Linq.Test.nuspec
		NuGet\SQLite.MSIL.nuspec = NuGet\SQLite.MSIL.nuspec
		NuGet\SQLite.MSIL.Beta.nuspec = NuGet\SQLite.MSIL.Beta.nuspec
		NuGet\SQLite.MSIL.Test.nuspec = NuGet\SQLite.MSIL.Test.nuspec
		NuGet\SQLite.nuspec = NuGet\SQLite.nuspec
		NuGet\SQLite.Beta.nuspec = NuGet\SQLite.Beta.nuspec
		NuGet\SQLite.Test.nuspec = NuGet\SQLite.Test.nuspec
		NuGet\SQLite.x64.nuspec = NuGet\SQLite.x64.nuspec
		NuGet\SQLite.x86.nuspec = NuGet\SQLite.x86.nuspec
		readme.htm = readme.htm
		System.Data.SQLite\Targets\System.Data.SQLite.Files.targets = System.Data.SQLite\Targets\System.Data.SQLite.Files.targets
		System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets = System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets
		System.Data.SQLite\Targets\System.Data.SQLite.References.targets = System.Data.SQLite\Targets\System.Data.SQLite.References.targets
		Targets\SQLite.NET.Mono.Settings.targets = Targets\SQLite.NET.Mono.Settings.targets
		Targets\SQLite.NET.NetStandard20.Settings.targets = Targets\SQLite.NET.NetStandard20.Settings.targets
		Targets\SQLite.NET.NetStandard21.Settings.targets = Targets\SQLite.NET.NetStandard21.Settings.targets
		Targets\SQLite.NET.Platform.Settings.targets = Targets\SQLite.NET.Platform.Settings.targets
		Targets\SQLite.NET.Settings.targets = Targets\SQLite.NET.Settings.targets
		Targets\SQLite.NET.Settings.targets.netFx35 = Targets\SQLite.NET.Settings.targets.netFx35
		Targets\SQLite.NET.Settings.targets.netFx40 = Targets\SQLite.NET.Settings.targets.netFx40
		Targets\SQLite.NET.targets = Targets\SQLite.NET.targets
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.NetStandard21", "System.Data.SQLite\System.Data.SQLite.NetStandard21.csproj", "{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.EF6.NetStandard21", "System.Data.SQLite.Linq\System.Data.SQLite.EF6.NetStandard21.csproj", "{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testef6.NetStandard21", "testlinq\testef6.NetStandard21.csproj", "{2975AE0A-F159-4834-A837-5242C6691886}"
	ProjectSection(ProjectDependencies) = postProject
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D} = {77BE07F7-8183-4A83-8AEC-D46A0C2C026D}
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E} = {5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}
	EndProjectSection
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|Win32 = Debug|Win32
		Debug|x64 = Debug|x64
		DebugManagedOnly|Any CPU = DebugManagedOnly|Any CPU
		DebugManagedOnly|Mixed Platforms = DebugManagedOnly|Mixed Platforms
		DebugManagedOnly|Win32 = DebugManagedOnly|Win32
		DebugManagedOnly|x64 = DebugManagedOnly|x64
		DebugNativeOnly|Any CPU = DebugNativeOnly|Any CPU
		DebugNativeOnly|Mixed Platforms = DebugNativeOnly|Mixed Platforms
		DebugNativeOnly|Win32 = DebugNativeOnly|Win32
		DebugNativeOnly|x64 = DebugNativeOnly|x64
		Release|Any CPU = Release|Any CPU
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|Win32 = Release|Win32
		Release|x64 = Release|x64
		ReleaseManagedOnly|Any CPU = ReleaseManagedOnly|Any CPU
		ReleaseManagedOnly|Mixed Platforms = ReleaseManagedOnly|Mixed Platforms
		ReleaseManagedOnly|Win32 = ReleaseManagedOnly|Win32
		ReleaseManagedOnly|x64 = ReleaseManagedOnly|x64
		ReleaseNativeOnly|Any CPU = ReleaseNativeOnly|Any CPU
		ReleaseNativeOnly|Mixed Platforms = ReleaseNativeOnly|Mixed Platforms
		ReleaseNativeOnly|Win32 = ReleaseNativeOnly|Win32
		ReleaseNativeOnly|x64 = ReleaseNativeOnly|x64
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Win32.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|x64.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|x64.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Any CPU.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Win32.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Win32.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|x64.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|x64.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Debug|Win32.Build.0 = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Debug|x64.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Debug|x64.Build.0 = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Release|Any CPU.Build.0 = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Release|Win32.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Release|Win32.Build.0 = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Release|x64.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Release|x64.Build.0 = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugManagedOnly|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseManagedOnly|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Added SQLite.NET.NetStandard21.sln.























































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28803.452
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = preProject
		data\exclude_bin.txt = data\exclude_bin.txt
		data\exclude_src.txt = data\exclude_src.txt
		Keys\System.Data.SQLite.CF.snk = Keys\System.Data.SQLite.CF.snk
		Keys\System.Data.SQLite.snk = Keys\System.Data.SQLite.snk
		NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\build\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets = NuGet\shared\Core\buildTransitive\System.Data.SQLite.Core.NetFramework.targets
		NuGet\shared\Core\content\config.install.xdt = NuGet\shared\Core\content\config.install.xdt
		NuGet\shared\Core\content\config.transform = NuGet\shared\Core\content\config.transform
		NuGet\net40\EF6\content\config.transform = NuGet\net40\EF6\content\config.transform
		NuGet\net40\EF6\tools\provider.ps1 = NuGet\net40\EF6\tools\provider.ps1
		NuGet\SQLite.Core.nuspec = NuGet\SQLite.Core.nuspec
		NuGet\SQLite.Core.Beta.nuspec = NuGet\SQLite.Core.Beta.nuspec
		NuGet\SQLite.Core.NetFramework.nuspec = NuGet\SQLite.Core.NetFramework.nuspec
		NuGet\SQLite.Core.NetStandard.nuspec = NuGet\SQLite.Core.NetStandard.nuspec
		NuGet\SQLite.Core.Test.nuspec = NuGet\SQLite.Core.Test.nuspec
		NuGet\SQLite.Core.MSIL.nuspec = NuGet\SQLite.Core.MSIL.nuspec
		NuGet\SQLite.Core.MSIL.Beta.nuspec = NuGet\SQLite.Core.MSIL.Beta.nuspec
		NuGet\SQLite.Core.MSIL.Test.nuspec = NuGet\SQLite.Core.MSIL.Test.nuspec
		NuGet\SQLite.EF6.nuspec = NuGet\SQLite.EF6.nuspec
		NuGet\SQLite.EF6.Beta.nuspec = NuGet\SQLite.EF6.Beta.nuspec
		NuGet\SQLite.EF6.Test.nuspec = NuGet\SQLite.EF6.Test.nuspec
		NuGet\SQLite.Linq.nuspec = NuGet\SQLite.Linq.nuspec
		NuGet\SQLite.Linq.Beta.nuspec = NuGet\SQLite.Linq.Beta.nuspec
		NuGet\SQLite.Linq.Test.nuspec = NuGet\SQLite.Linq.Test.nuspec
		NuGet\SQLite.MSIL.nuspec = NuGet\SQLite.MSIL.nuspec
		NuGet\SQLite.MSIL.Beta.nuspec = NuGet\SQLite.MSIL.Beta.nuspec
		NuGet\SQLite.MSIL.Test.nuspec = NuGet\SQLite.MSIL.Test.nuspec
		NuGet\SQLite.nuspec = NuGet\SQLite.nuspec
		NuGet\SQLite.Beta.nuspec = NuGet\SQLite.Beta.nuspec
		NuGet\SQLite.Test.nuspec = NuGet\SQLite.Test.nuspec
		NuGet\SQLite.x64.nuspec = NuGet\SQLite.x64.nuspec
		NuGet\SQLite.x86.nuspec = NuGet\SQLite.x86.nuspec
		readme.htm = readme.htm
		System.Data.SQLite\Targets\System.Data.SQLite.Files.targets = System.Data.SQLite\Targets\System.Data.SQLite.Files.targets
		System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets = System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets
		System.Data.SQLite\Targets\System.Data.SQLite.References.targets = System.Data.SQLite\Targets\System.Data.SQLite.References.targets
		Targets\SQLite.NET.Mono.Settings.targets = Targets\SQLite.NET.Mono.Settings.targets
		Targets\SQLite.NET.NetStandard20.Settings.targets = Targets\SQLite.NET.NetStandard20.Settings.targets
		Targets\SQLite.NET.NetStandard21.Settings.targets = Targets\SQLite.NET.NetStandard21.Settings.targets
		Targets\SQLite.NET.Platform.Settings.targets = Targets\SQLite.NET.Platform.Settings.targets
		Targets\SQLite.NET.Settings.targets = Targets\SQLite.NET.Settings.targets
		Targets\SQLite.NET.Settings.targets.netFx35 = Targets\SQLite.NET.Settings.targets.netFx35
		Targets\SQLite.NET.Settings.targets.netFx40 = Targets\SQLite.NET.Settings.targets.netFx40
		Targets\SQLite.NET.targets = Targets\SQLite.NET.targets
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.NetStandard21", "System.Data.SQLite\System.Data.SQLite.NetStandard21.csproj", "{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.EF6.NetStandard21", "System.Data.SQLite.Linq\System.Data.SQLite.EF6.NetStandard21.csproj", "{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testef6.NetStandard21", "testlinq\testef6.NetStandard21.csproj", "{2975AE0A-F159-4834-A837-5242C6691886}"
	ProjectSection(ProjectDependencies) = postProject
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D} = {77BE07F7-8183-4A83-8AEC-D46A0C2C026D}
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E} = {5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}
	EndProjectSection
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Debug|Mixed Platforms = Debug|Mixed Platforms
		Debug|Win32 = Debug|Win32
		Debug|x64 = Debug|x64
		DebugNativeOnly|Any CPU = DebugNativeOnly|Any CPU
		DebugNativeOnly|Mixed Platforms = DebugNativeOnly|Mixed Platforms
		DebugNativeOnly|Win32 = DebugNativeOnly|Win32
		DebugNativeOnly|x64 = DebugNativeOnly|x64
		Release|Any CPU = Release|Any CPU
		Release|Mixed Platforms = Release|Mixed Platforms
		Release|Win32 = Release|Win32
		Release|x64 = Release|x64
		ReleaseNativeOnly|Any CPU = ReleaseNativeOnly|Any CPU
		ReleaseNativeOnly|Mixed Platforms = ReleaseNativeOnly|Mixed Platforms
		ReleaseNativeOnly|Win32 = ReleaseNativeOnly|Win32
		ReleaseNativeOnly|x64 = ReleaseNativeOnly|x64
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|Win32.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|x64.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Debug|x64.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Any CPU.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Win32.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|Win32.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|x64.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.Release|x64.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Debug|Win32.Build.0 = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Debug|x64.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Debug|x64.Build.0 = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Release|Any CPU.Build.0 = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Release|Win32.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Release|Win32.Build.0 = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Release|x64.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.Release|x64.Build.0 = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|Win32.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Debug|x64.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Any CPU.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Any CPU.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Mixed Platforms.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Mixed Platforms.Build.0 = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|Win32.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.DebugNativeOnly|x64.ActiveCfg = Debug|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|Win32.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.Release|x64.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Any CPU.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Any CPU.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Mixed Platforms.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Mixed Platforms.Build.0 = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|Win32.ActiveCfg = Release|Any CPU
		{2975AE0A-F159-4834-A837-5242C6691886}.ReleaseNativeOnly|x64.ActiveCfg = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal

Deleted SQLite.NET.sln.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{39A3B743-1EBD-4CC0-8E37-ACE3DD38B1C0}"
	ProjectSection(SolutionItems) = preProject
		readme.htm = readme.htm
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite - Compact", "System.Data.SQLite\System.Data.SQLite - Compact.csproj", "{AC139951-261A-4463-B6FA-AEBC25283A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}"
	ProjectSection(ProjectDependencies) = postProject
		{10B51CE8-A838-44DE-BD82-B658F0296F80} = {10B51CE8-A838-44DE-BD82-B658F0296F80}
	EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SQLite.Interop", "SQLite.Interop\SQLite.Interop.vcproj", "{10B51CE8-A838-44DE-BD82-B658F0296F80}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139951-261A-4463-B6FA-AEBC25283A66} = {AC139951-261A-4463-B6FA-AEBC25283A66}
		{AC139952-261A-4463-B6FA-AEBC25283A66} = {AC139952-261A-4463-B6FA-AEBC25283A66}
		{AC139952-261A-4463-B6FA-AEBC25284A66} = {AC139952-261A-4463-B6FA-AEBC25284A66}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testce", "testce\testce.csproj", "{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}"
	ProjectSection(ProjectDependencies) = postProject
		{AC139951-261A-4463-B6FA-AEBC25283A66} = {AC139951-261A-4463-B6FA-AEBC25283A66}
		{10B51CE8-A838-44DE-BD82-B658F0296F80} = {10B51CE8-A838-44DE-BD82-B658F0296F80}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite - ManagedOnly", "System.Data.SQLite\System.Data.SQLite - ManagedOnly.csproj", "{AC139952-261A-4463-B6FA-AEBC25283A66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite.Linq", "System.Data.SQLite.Linq\System.Data.SQLite.Linq.csproj", "{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}"
	ProjectSection(ProjectDependencies) = postProject
		{10B51CE8-A838-44DE-BD82-B658F0296F80} = {10B51CE8-A838-44DE-BD82-B658F0296F80}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "testlinq", "testlinq\testlinq.csproj", "{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}"
	ProjectSection(ProjectDependencies) = postProject
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D} = {E6BF9F74-58E2-413B-A7CE-EA653ECB728D}
	EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Data.SQLite - Netmodule", "System.Data.SQLite\System.Data.SQLite - Netmodule.csproj", "{AC139952-261A-4463-B6FA-AEBC25284A66}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug - Stock|Compact Framework (ARMV4) = Debug - Stock|Compact Framework (ARMV4)
		Debug - Stock|Itanium = Debug - Stock|Itanium
		Debug - Stock|Win32 = Debug - Stock|Win32
		Debug - Stock|x64 = Debug - Stock|x64
		Debug|Compact Framework (ARMV4) = Debug|Compact Framework (ARMV4)
		Debug|Itanium = Debug|Itanium
		Debug|Win32 = Debug|Win32
		Debug|x64 = Debug|x64
		Release - Stock|Compact Framework (ARMV4) = Release - Stock|Compact Framework (ARMV4)
		Release - Stock|Itanium = Release - Stock|Itanium
		Release - Stock|Win32 = Release - Stock|Win32
		Release - Stock|x64 = Release - Stock|x64
		Release|Compact Framework (ARMV4) = Release|Compact Framework (ARMV4)
		Release|Itanium = Release|Itanium
		Release|Win32 = Release|Win32
		Release|x64 = Release|x64
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Compact Framework (ARMV4).Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Itanium.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Win32.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|x64.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Compact Framework (ARMV4).Build.0 = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Itanium.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Compact Framework (ARMV4).Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Itanium.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Win32.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release - Stock|x64.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Compact Framework (ARMV4).Build.0 = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Itanium.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139951-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug - Stock|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug - Stock|Itanium.ActiveCfg = Debug|Itanium
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug - Stock|Itanium.Build.0 = Debug|Itanium
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug - Stock|Win32.ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug - Stock|Win32.Build.0 = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug - Stock|x64.ActiveCfg = Debug|x64
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug - Stock|x64.Build.0 = Debug|x64
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Itanium.ActiveCfg = Debug|Itanium
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Itanium.Build.0 = Debug|Itanium
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.ActiveCfg = Debug|x86
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|Win32.Build.0 = Debug|x86
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.ActiveCfg = Debug|x64
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Debug|x64.Build.0 = Debug|x64
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release - Stock|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release - Stock|Itanium.ActiveCfg = Release|Itanium
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release - Stock|Itanium.Build.0 = Release|Itanium
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release - Stock|Win32.ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release - Stock|Win32.Build.0 = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release - Stock|x64.ActiveCfg = Release|x64
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release - Stock|x64.Build.0 = Release|x64
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Itanium.ActiveCfg = Release|Itanium
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Itanium.Build.0 = Release|Itanium
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.ActiveCfg = Release|x86
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|Win32.Build.0 = Release|x86
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.ActiveCfg = Release|x64
		{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}.Release|x64.Build.0 = Release|x64
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|Compact Framework (ARMV4).ActiveCfg = StockDebug|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|Compact Framework (ARMV4).Build.0 = StockDebug|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|Compact Framework (ARMV4).Deploy.0 = StockDebug|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|Itanium.ActiveCfg = Debug|Itanium
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|Itanium.Deploy.0 = Debug|Itanium
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|Win32.ActiveCfg = StockDebug|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|Win32.Deploy.0 = StockDebug|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|x64.ActiveCfg = Debug|x64
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug - Stock|x64.Deploy.0 = Debug|x64
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Compact Framework (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Compact Framework (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Compact Framework (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Itanium.ActiveCfg = Debug|Itanium
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Itanium.Build.0 = Debug|Itanium
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Itanium.Deploy.0 = Debug|Itanium
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Win32.ActiveCfg = Debug|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Win32.Build.0 = Debug|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|Win32.Deploy.0 = Debug|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|x64.ActiveCfg = Debug|x64
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|x64.Build.0 = Debug|x64
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Debug|x64.Deploy.0 = Debug|x64
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release - Stock|Compact Framework (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release - Stock|Compact Framework (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release - Stock|Compact Framework (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release - Stock|Itanium.ActiveCfg = Release|Itanium
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release - Stock|Win32.ActiveCfg = Release|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release - Stock|x64.ActiveCfg = Release|x64
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Compact Framework (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Compact Framework (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4)
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Itanium.ActiveCfg = Release|Itanium
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Itanium.Build.0 = Release|Itanium
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Win32.ActiveCfg = Release|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|Win32.Build.0 = Release|Win32
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|x64.ActiveCfg = Release|x64
		{10B51CE8-A838-44DE-BD82-B658F0296F80}.Release|x64.Build.0 = Release|x64
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug - Stock|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug - Stock|Compact Framework (ARMV4).Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug - Stock|Compact Framework (ARMV4).Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug - Stock|Itanium.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug - Stock|Win32.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug - Stock|x64.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Compact Framework (ARMV4).Build.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Compact Framework (ARMV4).Deploy.0 = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Itanium.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Debug|x64.ActiveCfg = Debug|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release - Stock|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release - Stock|Compact Framework (ARMV4).Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release - Stock|Compact Framework (ARMV4).Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release - Stock|Itanium.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release - Stock|Win32.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release - Stock|x64.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Compact Framework (ARMV4).Build.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Compact Framework (ARMV4).Deploy.0 = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Itanium.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|Win32.ActiveCfg = Release|Any CPU
		{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Itanium.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Itanium.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Win32.ActiveCfg = StockDebug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|Win32.Build.0 = StockDebug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug - Stock|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Itanium.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Itanium.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|Win32.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Debug|x64.Build.0 = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Itanium.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Itanium.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Win32.ActiveCfg = StockRelease|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release - Stock|Win32.Build.0 = StockRelease|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release - Stock|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release - Stock|x64.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Itanium.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25283A66}.Release|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug - Stock|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug - Stock|Itanium.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug - Stock|Itanium.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug - Stock|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug - Stock|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug - Stock|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug - Stock|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Itanium.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Itanium.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|Win32.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.ActiveCfg = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Debug|x64.Build.0 = Debug|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release - Stock|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release - Stock|Itanium.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release - Stock|Itanium.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release - Stock|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release - Stock|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release - Stock|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release - Stock|x64.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Itanium.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Itanium.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|Win32.Build.0 = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.ActiveCfg = Release|Any CPU
		{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}.Release|x64.Build.0 = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug - Stock|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug - Stock|Itanium.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug - Stock|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug - Stock|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Itanium.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Debug|x64.ActiveCfg = Debug|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release - Stock|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release - Stock|Itanium.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release - Stock|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release - Stock|x64.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Itanium.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|Win32.ActiveCfg = Release|Any CPU
		{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug - Stock|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug - Stock|Itanium.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug - Stock|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug - Stock|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Compact Framework (ARMV4).ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Itanium.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|Win32.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Debug|x64.ActiveCfg = Debug|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release - Stock|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release - Stock|Itanium.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release - Stock|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release - Stock|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Compact Framework (ARMV4).ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Itanium.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Itanium.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|Win32.Build.0 = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.ActiveCfg = Release|Any CPU
		{AC139952-261A-4463-B6FA-AEBC25284A66}.Release|x64.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































































































































































































































Deleted SQLite.NET.suo.

cannot compute difference between binary files

Added Setup/archive.bat.







































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
@ECHO OFF

::
:: archive.bat --
::
:: Source Archiving Tool
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

SET ROOT=%~dp0\..
SET ROOT=%ROOT:\\=\%

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Root = '%ROOT%'
%_VECHO% Tools = '%TOOLS%'

CALL :fn_ResetErrorLevel

%_CECHO2% PUSHD "%ROOT%"
%__ECHO2% PUSHD "%ROOT%"

IF ERRORLEVEL 1 (
  ECHO Could not change directory to "%ROOT%".
  GOTO errors
)

FOR /F "delims=" %%V IN ('TYPE System.Data.SQLite\AssemblyInfo.cs ^| find.exe "AssemblyVersion"') DO (
  SET VERSION=%%V
)

IF NOT DEFINED VERSION (
  SET VERSION=1.0.0.0
  GOTO skip_mungeVersion
)

REM
REM NOTE: Strip off all the extra stuff from the AssemblyVersion line we found
REM       in the AssemblyInfo.cs file that we do not need (i.e. everything
REM       except the raw version number itself).
REM
SET VERSION=%VERSION:(=%
SET VERSION=%VERSION:)=%
SET VERSION=%VERSION:[=%
SET VERSION=%VERSION:]=%
SET VERSION=%VERSION: =%
SET VERSION=%VERSION:assembly:=%
SET VERSION=%VERSION:AssemblyVersion=%
SET VERSION=%VERSION:"=%
REM "

:skip_mungeVersion

%_VECHO% Version = '%VERSION%'

CALL :fn_ResetErrorLevel

IF NOT EXIST Setup\Output (
  %__ECHO% MKDIR Setup\Output

  IF ERRORLEVEL 1 (
    ECHO Could not create directory "Setup\Output".
    GOTO errors
  )
)

IF DEFINED ARCHIVE_FULL (
  SET EXCLUDE_SRC=@data\exclude_full_src.txt
  SET PREFIX=sqlite-netFx-full-source
) ELSE (
  SET EXCLUDE_SRC=@data\exclude_src.txt
  SET PREFIX=sqlite-netFx-source
)

%_VECHO% ExcludeSrc = '%EXCLUDE_SRC%'
%_VECHO% Prefix = '%PREFIX%'

%_CECHO% zip.exe -v -r "Setup\Output\%PREFIX%-%VERSION%.zip" * -x "%EXCLUDE_SRC%"
%__ECHO% zip.exe -v -r "Setup\Output\%PREFIX%-%VERSION%.zip" * -x "%EXCLUDE_SRC%"

IF ERRORLEVEL 1 (
  ECHO Failed to archive source files.
  GOTO errors
)

%_CECHO2% POPD
%__ECHO2% POPD

IF ERRORLEVEL 1 (
  ECHO Could not restore directory.
  GOTO errors
)

GOTO no_errors

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Archive failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Archive success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/bake.bat.























































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
@ECHO OFF

::
:: bake.bat --
::
:: Setup Preparation & Baking Tool
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

IF NOT DEFINED FRAMEWORK (
  IF DEFINED YEAR (
    CALL :fn_SetVariable FRAMEWORK FRAMEWORK%YEAR%
  ) ELSE (
    SET FRAMEWORK=netFx20
  )
)

%_VECHO% Framework = '%FRAMEWORK%'

IF "%PROCESSOR_ARCHITECTURE%" == "x86" GOTO set_path_x86

SET INNOSETUPPATH=%ProgramFiles(x86)%\Inno Setup 5
GOTO set_path_done

:set_path_x86

SET INNOSETUPPATH=%ProgramFiles%\Inno Setup 5

:set_path_done

CALL :fn_PrependToPath INNOSETUPPATH

%_VECHO% InnoSetupPath = '%INNOSETUPPATH%'
%_VECHO% Path = '%PATH%'

%__ECHO% ISCC.exe "%TOOLS%\data\SQLite.iss" "/dAppId=%APPID%" "/dAppPublicKey=%PUBLICKEY%" "/dAppURL=%URL%" "/dIsNetFx2=%ISNETFX2%" "/dVcRuntime=%VCRUNTIME%" "/dAppConfiguration=%CONFIGURATION%" "/dAppPlatform=%PLATFORM%" "/dAppProcessor=%PROCESSOR%" "/dFramework=%FRAMEWORK%" "/dYear=%YEAR%"

IF %ERRORLEVEL% NEQ 0 (
  ECHO Failed to compile setup.
  GOTO errors
)

GOTO no_errors

:fn_SetVariable
  SETLOCAL
  SET __ECHO_CMD=ECHO %%%2%%
  FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
    SET VALUE=%%V
  )
  ENDLOCAL && (
    SET %1=%VALUE%
  )
  GOTO :EOF

:fn_PrependToPath
  IF NOT DEFINED %1 GOTO :EOF
  SETLOCAL
  SET __ECHO_CMD=ECHO %%%1%%
  FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
    SET VALUE=%%V
  )
  SET VALUE=%VALUE:"=%
  REM "
  ENDLOCAL && SET PATH=%VALUE%;%PATH%
  GOTO :EOF

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Bake failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Bake success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/bake_all.bat.









































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
@ECHO OFF

::
:: bake_all.bat --
::
:: Multi-Setup Preparation & Baking Tool
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

CALL :fn_ResetErrorLevel

%_CECHO3% CALL "%TOOLS%\vsSp.bat"
%__ECHO3% CALL "%TOOLS%\vsSp.bat"

IF ERRORLEVEL 1 (
  ECHO Could not detect Visual Studio.
  GOTO errors
)

REM
REM NOTE: There are no setup packages for .NET Standard 2.0 and
REM       .NET Standard 2.1.
REM
SET NONETSTANDARD20=1
SET NONETSTANDARD21=1

%_CECHO3% CALL "%TOOLS%\set_common.bat"
%__ECHO3% CALL "%TOOLS%\set_common.bat"

IF ERRORLEVEL 1 (
  ECHO Could not set common variables.
  GOTO errors
)

IF NOT DEFINED BAKE_CONFIGURATIONS (
  SET BAKE_CONFIGURATIONS=Release
)

%_VECHO% BakeConfigurations = '%BAKE_CONFIGURATIONS%'

IF NOT DEFINED PROCESSORS (
  SET PROCESSORS=x86
)

%_VECHO% Processors = '%PROCESSORS%'

IF NOT DEFINED YEARS (
  SET YEARS=2008
)

%_VECHO% Years = '%YEARS%'

FOR %%C IN (%BAKE_CONFIGURATIONS%) DO (
  FOR %%P IN (%PROCESSORS%) DO (
    FOR %%Y IN (%YEARS%) DO (
      %_CECHO3% CALL "%TOOLS%\set_%%C_%%P_%%Y.bat"
      %__ECHO3% CALL "%TOOLS%\set_%%C_%%P_%%Y.bat"

      IF ERRORLEVEL 1 (
        ECHO Could not set variables for %%C/%%P/%%Y.
        GOTO errors
      )

      %_CECHO3% CALL "%TOOLS%\bake.bat"
      %__ECHO3% CALL "%TOOLS%\bake.bat"

      IF ERRORLEVEL 1 (
        ECHO Could not bake setup for %%C/%%P/%%Y.
        GOTO errors
      )
    )
  )
)

GOTO no_errors

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/build-mono-debug.sh.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash

scriptdir=`dirname "$BASH_SOURCE"`

if [[ -z "$SQLITE_NET_YEAR" ]]; then
  SQLITE_NET_YEAR=2013
fi

pushd "$scriptdir/.."
xbuild SQLite.NET.$SQLITE_NET_YEAR.MSBuild.sln /property:Configuration=Debug "$@"
popd

Added Setup/build-mono-release.sh.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash

scriptdir=`dirname "$BASH_SOURCE"`

if [[ -z "$SQLITE_NET_YEAR" ]]; then
  SQLITE_NET_YEAR=2013
fi

pushd "$scriptdir/.."
xbuild SQLite.NET.$SQLITE_NET_YEAR.MSBuild.sln /property:Configuration=Release "$@"
popd

Added Setup/build-netstandard20-debug.sh.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash

scriptdir=`dirname "$BASH_SOURCE"`

if [[ -z "$SQLITE_NET_YEAR" ]]; then
  SQLITE_NET_YEAR=NetStandard20
fi

pushd "$scriptdir/.."
dotnet build SQLite.NET.$SQLITE_NET_YEAR.MSBuild.sln /property:Configuration=Debug "$@"
popd

Added Setup/build-netstandard20-release.sh.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash

scriptdir=`dirname "$BASH_SOURCE"`

if [[ -z "$SQLITE_NET_YEAR" ]]; then
  SQLITE_NET_YEAR=NetStandard20
fi

pushd "$scriptdir/.."
dotnet build SQLite.NET.$SQLITE_NET_YEAR.MSBuild.sln /property:Configuration=Release "$@"
popd

Added Setup/build-netstandard21-debug.sh.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash

scriptdir=`dirname "$BASH_SOURCE"`

if [[ -z "$SQLITE_NET_YEAR" ]]; then
  SQLITE_NET_YEAR=NetStandard21
fi

pushd "$scriptdir/.."
dotnet build SQLite.NET.$SQLITE_NET_YEAR.MSBuild.sln /property:Configuration=Debug "$@"
popd

Added Setup/build-netstandard21-release.sh.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash

scriptdir=`dirname "$BASH_SOURCE"`

if [[ -z "$SQLITE_NET_YEAR" ]]; then
  SQLITE_NET_YEAR=NetStandard21
fi

pushd "$scriptdir/.."
dotnet build SQLite.NET.$SQLITE_NET_YEAR.MSBuild.sln /property:Configuration=Release "$@"
popd

Added Setup/build.bat.







































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
@ECHO OFF

::
:: build.bat --
::
:: Wrapper Tool for MSBuild
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

CALL :fn_UnsetVariable BREAK

%_AECHO% Running %0 %*

SET DUMMY2=%4

IF DEFINED DUMMY2 (
  GOTO usage
)

SET ROOT=%~dp0\..
SET ROOT=%ROOT:\\=\%

%_VECHO% Root = '%ROOT%'

SET CONFIGURATION=%1

IF DEFINED CONFIGURATION (
  CALL :fn_UnquoteVariable CONFIGURATION
) ELSE (
  %_AECHO% No configuration specified, using default...
  SET CONFIGURATION=Release
)

%_VECHO% Configuration = '%CONFIGURATION%'

SET PLATFORM=%2

IF DEFINED PLATFORM (
  CALL :fn_UnquoteVariable PLATFORM
) ELSE (
  %_AECHO% No platform specified, using default...
  SET PLATFORM=Win32
)

%_VECHO% Platform = '%PLATFORM%'

SET YEAR=%3

IF DEFINED YEAR (
  CALL :fn_UnquoteVariable YEAR
) ELSE (
  %_AECHO% No year specified, using default...
)

%_VECHO% Year = '%YEAR%'

SET BASE_CONFIGURATION=%CONFIGURATION%
SET BASE_CONFIGURATION=%BASE_CONFIGURATION:ManagedOnly=%
SET BASE_CONFIGURATION=%BASE_CONFIGURATION:NativeOnly=%
SET BASE_CONFIGURATION=%BASE_CONFIGURATION:Static=%

%_VECHO% BaseConfiguration = '%BASE_CONFIGURATION%'

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

SET EXTERNALS=%ROOT%\Externals
SET EXTERNALS=%EXTERNALS:\\=\%

%_VECHO% Externals = '%EXTERNALS%'

IF NOT DEFINED VSWHERE_EXE (
  SET VSWHERE_EXE=%EXTERNALS%\vswhere\vswhere.exe
)

SET VSWHERE_EXE=%VSWHERE_EXE:\\=\%

%_VECHO% VsWhereExe = '%VSWHERE_EXE%'

IF EXIST "%TOOLS%\set_%CONFIGURATION%_%PLATFORM%.bat" (
  CALL :fn_ResetErrorLevel

  %_AECHO% Running "%TOOLS%\set_%CONFIGURATION%_%PLATFORM%.bat"...
  %_CECHO3% CALL "%TOOLS%\set_%CONFIGURATION%_%PLATFORM%.bat"
  %__ECHO3% CALL "%TOOLS%\set_%CONFIGURATION%_%PLATFORM%.bat"

  IF ERRORLEVEL 1 (
    ECHO File "%TOOLS%\set_%CONFIGURATION%_%PLATFORM%.bat" failed.
    GOTO errors
  )
)

IF NOT DEFINED NOUSER (
  IF EXIST "%TOOLS%\set_user_%USERNAME%_%BASE_CONFIGURATION%_%PLATFORM%.bat" (
    CALL :fn_ResetErrorLevel

    %_AECHO% Running "%TOOLS%\set_user_%USERNAME%_%BASE_CONFIGURATION%_%PLATFORM%.bat"...
    %_CECHO3% CALL "%TOOLS%\set_user_%USERNAME%_%BASE_CONFIGURATION%_%PLATFORM%.bat"
    %__ECHO3% CALL "%TOOLS%\set_user_%USERNAME%_%BASE_CONFIGURATION%_%PLATFORM%.bat"

    IF ERRORLEVEL 1 (
      ECHO File "%TOOLS%\set_user_%USERNAME%_%BASE_CONFIGURATION%_%PLATFORM%.bat" failed.
      GOTO errors
    )
  )

  IF EXIST "%TOOLS%\set_user_%USERNAME%_%BASE_CONFIGURATION%.bat" (
    CALL :fn_ResetErrorLevel

    %_AECHO% Running "%TOOLS%\set_user_%USERNAME%_%BASE_CONFIGURATION%.bat"...
    %_CECHO3% CALL "%TOOLS%\set_user_%USERNAME%_%BASE_CONFIGURATION%.bat"
    %__ECHO3% CALL "%TOOLS%\set_user_%USERNAME%_%BASE_CONFIGURATION%.bat"

    IF ERRORLEVEL 1 (
      ECHO File "%TOOLS%\set_user_%USERNAME%_%BASE_CONFIGURATION%.bat" failed.
      GOTO errors
    )
  )

  IF EXIST "%TOOLS%\set_user_%USERNAME%.bat" (
    CALL :fn_ResetErrorLevel

    %_AECHO% Running "%TOOLS%\set_user_%USERNAME%.bat"...
    %_CECHO3% CALL "%TOOLS%\set_user_%USERNAME%.bat"
    %__ECHO3% CALL "%TOOLS%\set_user_%USERNAME%.bat"

    IF ERRORLEVEL 1 (
      ECHO File "%TOOLS%\set_user_%USERNAME%.bat" failed.
      GOTO errors
    )
  )
)

IF NOT DEFINED MSBUILD (
  SET MSBUILD=MSBuild.exe
)

%_VECHO% MsBuild = '%MSBUILD%'

IF NOT DEFINED DOTNET (
  SET DOTNET=dotnet.exe
)

%_VECHO% DotNet = '%DOTNET%'

IF NOT DEFINED CSC (
  SET CSC=csc.exe
)

%_VECHO% Csc = '%CSC%'

REM ****************************************************************************
REM ********************* .NET Framework Version Overrides *********************
REM ****************************************************************************

REM
REM TODO: When the next version of Visual Studio is released, this section may
REM       need updating.
REM
IF DEFINED NETCORE20ONLY (
  %_AECHO% Forcing the use of the .NET Core 2.0...
  IF NOT DEFINED YEAR (
    IF DEFINED NETCORE20YEAR (
      SET YEAR=%NETCORE20YEAR%
    ) ELSE (
      SET YEAR=NetStandard20
    )
  )
  CALL :fn_VerifyDotNetCore
  IF ERRORLEVEL 1 GOTO errors
  SET NOBUILDTOOLDIR=1
  SET USEDOTNET=1
  GOTO setup_buildToolDir
)

IF DEFINED NETCORE30ONLY (
  %_AECHO% Forcing the use of the .NET Core 3.0...
  IF NOT DEFINED YEAR (
    IF DEFINED NETCORE30YEAR (
      SET YEAR=%NETCORE30YEAR%
    ) ELSE (
      SET YEAR=NetStandard21
    )
  )
  CALL :fn_VerifyDotNetCore
  IF ERRORLEVEL 1 GOTO errors
  SET NOBUILDTOOLDIR=1
  SET USEDOTNET=1
  GOTO setup_buildToolDir
)

IF DEFINED NETFX20ONLY (
  %_AECHO% Forcing the use of the .NET Framework 2.0...
  IF NOT DEFINED YEAR (
    IF DEFINED NETFX20YEAR (
      SET YEAR=%NETFX20YEAR%
    ) ELSE (
      SET YEAR=2005
    )
  )
  CALL :fn_CheckFrameworkDir v2.0.50727
  GOTO setup_buildToolDir
)

IF DEFINED NETFX35ONLY (
  %_AECHO% Forcing the use of the .NET Framework 3.5...
  IF NOT DEFINED YEAR (
    IF DEFINED NETFX35YEAR (
      SET YEAR=%NETFX35YEAR%
    ) ELSE (
      SET YEAR=2008
    )
  )
  CALL :fn_CheckFrameworkDir v3.5
  GOTO setup_buildToolDir
)

IF DEFINED NETFX40ONLY (
  %_AECHO% Forcing the use of the .NET Framework 4.0...
  IF NOT DEFINED YEAR (
    IF DEFINED NETFX40YEAR (
      SET YEAR=%NETFX40YEAR%
    ) ELSE (
      SET YEAR=2010
    )
  )
  CALL :fn_CheckFrameworkDir v4.0.30319
  GOTO setup_buildToolDir
)

IF DEFINED NETFX45ONLY (
  %_AECHO% Forcing the use of the .NET Framework 4.5...
  IF NOT DEFINED YEAR (
    IF DEFINED NETFX45YEAR (
      SET YEAR=%NETFX45YEAR%
    ) ELSE (
      SET YEAR=2012
    )
  )
  CALL :fn_CheckFrameworkDir v4.0.30319
  GOTO setup_buildToolDir
)

IF DEFINED NETFX451ONLY (
  %_AECHO% Forcing the use of the .NET Framework 4.5.1...
  IF NOT DEFINED YEAR (
    IF DEFINED NETFX451YEAR (
      SET YEAR=%NETFX451YEAR%
    ) ELSE (
      SET YEAR=2013
    )
  )
  CALL :fn_CheckFrameworkDir v4.0.30319
  CALL :fn_CheckMsBuildDir 12.0
  GOTO setup_buildToolDir
)

IF DEFINED NETFX452ONLY (
  %_AECHO% Forcing the use of the .NET Framework 4.5.2...
  IF NOT DEFINED YEAR (
    IF DEFINED NETFX452YEAR (
      SET YEAR=%NETFX452YEAR%
    ) ELSE (
      SET YEAR=2013
    )
  )
  CALL :fn_CheckFrameworkDir v4.0.30319
  CALL :fn_CheckMsBuildDir 12.0
  GOTO setup_buildToolDir
)

IF DEFINED NETFX46ONLY (
  %_AECHO% Forcing the use of the .NET Framework 4.6...
  IF NOT DEFINED YEAR (
    IF DEFINED NETFX46YEAR (
      SET YEAR=%NETFX46YEAR%
    ) ELSE (
      SET YEAR=2015
    )
  )
  CALL :fn_CheckFrameworkDir v4.0.30319
  CALL :fn_CheckMsBuildDir 14.0
  GOTO setup_buildToolDir
)

IF DEFINED NETFX461ONLY (
  %_AECHO% Forcing the use of the .NET Framework 4.6.1...
  IF NOT DEFINED YEAR (
    IF DEFINED NETFX461YEAR (
      SET YEAR=%NETFX461YEAR%
    ) ELSE (
      SET YEAR=2015
    )
  )
  CALL :fn_CheckFrameworkDir v4.0.30319
  CALL :fn_CheckMsBuildDir 14.0
  GOTO setup_buildToolDir
)

IF DEFINED NETFX462ONLY (
  %_AECHO% Forcing the use of the .NET Framework 4.6.2...
  IF NOT DEFINED YEAR (
    IF DEFINED NETFX462YEAR (
      SET YEAR=%NETFX462YEAR%
    ) ELSE (
      SET YEAR=2015
    )
  )
  CALL :fn_CheckFrameworkDir v4.0.30319
  CALL :fn_CheckMsBuildDir 14.0
  GOTO setup_buildToolDir
)

IF DEFINED NETFX47ONLY (
  %_AECHO% Forcing the use of the .NET Framework 4.7...
  IF NOT DEFINED YEAR (
    IF DEFINED NETFX47YEAR (
      SET YEAR=%NETFX47YEAR%
    ) ELSE (
      SET YEAR=2017
    )
  )
  IF NOT DEFINED NOUSEPACKAGERESTORE (
    IF NOT DEFINED USEPACKAGERESTORE (
      SET USEPACKAGERESTORE=1
    )
  )
  CALL :fn_CheckFrameworkDir v4.0.30319
  CALL :fn_CheckMsBuildDir 14.0
  CALL :fn_CheckVisualStudioMsBuildDir 15.0 15.0
  GOTO setup_buildToolDir
)

IF DEFINED NETFX471ONLY (
  %_AECHO% Forcing the use of the .NET Framework 4.7.1...
  IF NOT DEFINED YEAR (
    IF DEFINED NETFX471YEAR (
      SET YEAR=%NETFX471YEAR%
    ) ELSE (
      SET YEAR=2017
    )
  )
  IF NOT DEFINED NOUSEPACKAGERESTORE (
    IF NOT DEFINED USEPACKAGERESTORE (
      SET USEPACKAGERESTORE=1
    )
  )
  CALL :fn_CheckFrameworkDir v4.0.30319
  CALL :fn_CheckMsBuildDir 14.0
  CALL :fn_CheckVisualStudioMsBuildDir 15.0 15.0
  GOTO setup_buildToolDir
)

IF DEFINED NETFX472ONLY (
  %_AECHO% Forcing the use of the .NET Framework 4.7.2...
  IF NOT DEFINED YEAR (
    IF DEFINED NETFX472YEAR (
      SET YEAR=%NETFX472YEAR%
    ) ELSE (
      SET YEAR=2017
    )
  )
  IF NOT DEFINED NOUSEPACKAGERESTORE (
    IF NOT DEFINED USEPACKAGERESTORE (
      SET USEPACKAGERESTORE=1
    )
  )
  CALL :fn_CheckFrameworkDir v4.0.30319
  CALL :fn_CheckMsBuildDir 14.0
  CALL :fn_CheckVisualStudioMsBuildDir 15.0 15.0
  GOTO setup_buildToolDir
)

IF DEFINED NETFX48ONLY (
  %_AECHO% Forcing the use of the .NET Framework 4.8...
  IF NOT DEFINED YEAR (
    IF DEFINED NETFX48YEAR (
      SET YEAR=%NETFX48YEAR%
    ) ELSE (
      SET YEAR=2017
    )
  )
  IF NOT DEFINED NOUSEPACKAGERESTORE (
    IF NOT DEFINED USEPACKAGERESTORE (
      SET USEPACKAGERESTORE=1
    )
  )
  CALL :fn_CheckFrameworkDir v4.0.30319
  CALL :fn_CheckMsBuildDir 14.0
  CALL :fn_CheckVisualStudioMsBuildDir Current 16.0
  GOTO setup_buildToolDir
)

REM ****************************************************************************
REM *********************** Disable Microsoft Telemetry ************************
REM ****************************************************************************

SET VSCMD_SKIP_SENDTELEMETRY=1
SET VCPKG_KEEP_ENV_VARS=VSCMD_SKIP_SENDTELEMETRY
SET DOTNET_CLI_TELEMETRY_OPTOUT=1

REM ****************************************************************************
REM ********************* Visual Studio Version Detection **********************
REM ****************************************************************************

CALL :fn_DetectVisualStudioDir

REM ****************************************************************************
REM ************************ MSBuild Version Detection *************************
REM ****************************************************************************

CALL :fn_DetectMsBuildDir

REM ****************************************************************************
REM ********************* .NET Framework Version Detection *********************
REM ****************************************************************************

CALL :fn_DetectFrameworkDir

REM ****************************************************************************
REM ***************************** Build Tool Setup *****************************
REM ****************************************************************************

:setup_buildToolDir

CALL :fn_SetupBuildTool

IF ERRORLEVEL 1 (
  ECHO Initial build tool setup failed.
  GOTO errors
)

REM ****************************************************************************
REM ****************************** Save Directory ******************************
REM ****************************************************************************

CALL :fn_ResetErrorLevel

%_CECHO2% PUSHD "%ROOT%"
%__ECHO2% PUSHD "%ROOT%"

IF ERRORLEVEL 1 (
  ECHO Could not change directory to "%ROOT%".
  GOTO errors
)

REM ****************************************************************************
REM **************************** Solution Handling *****************************
REM ****************************************************************************

IF DEFINED USEDOTNET IF DEFINED INTEROPONLY (
  CALL :fn_ForceMsBuildForInteropProject
)

%_VECHO% Configuration = '%CONFIGURATION%'
%_VECHO% Year = '%YEAR%'
%_VECHO% InteropYear = '%INTEROPYEAR%'
%_VECHO% NoBuildToolDir = '%NOBUILDTOOLDIR%'
%_VECHO% UseDotNet = '%USEDOTNET%'
%_VECHO% Solution = '%SOLUTION%'
%_VECHO% CoreOnly = '%COREONLY%'
%_VECHO% InteropOnly = '%INTEROPONLY%'
%_VECHO% StaticOnly = '%STATICONLY%'
%_VECHO% BuildFull = '%BUILD_FULL%'

CALL :fn_SetupSolution

%_VECHO% Solution = '%SOLUTION%'

IF NOT DEFINED SOLUTION (
  ECHO Solution file is not defined.
  GOTO errors
)

IF NOT EXIST "%SOLUTION%" (
  ECHO Solution file "%SOLUTION%" does not exist.
  GOTO errors
)

FOR /F %%E IN ('ECHO %SOLUTION%') DO (SET SOLUTIONEXT=%%~xE)
CALL :fn_ResetErrorLevel

%_VECHO% SolutionExt = '%SOLUTIONEXT%'

IF /I "%SOLUTIONEXT%" == ".csproj" (
  SET MSBUILD_CONFIGURATION=%BASE_CONFIGURATION%
) ELSE (
  SET MSBUILD_CONFIGURATION=%CONFIGURATION%
)

%_VECHO% MsBuildConfiguration = '%MSBUILD_CONFIGURATION%'

IF DEFINED INTEROPONLY (
  CALL :fn_DetectVisualStudioDir
  CALL :fn_DetectMsBuildDir
  CALL :fn_DetectFrameworkDir
  CALL :fn_SetupBuildTool

  IF ERRORLEVEL 1 (
    ECHO Updated build tool setup failed.
    GOTO errors
  )
)

REM ****************************************************************************
REM ***************************** Target Handling ******************************
REM ****************************************************************************

CALL :fn_SetupTarget

%_VECHO% Target = '%TARGET%'

REM ****************************************************************************
REM ******************************* Log Handling *******************************
REM ****************************************************************************

CALL :fn_SetupLogging
IF ERRORLEVEL 1 GOTO errors

%_VECHO% Temp = '%TEMP%'
%_VECHO% LogAsm = '%LOGASM%'
%_VECHO% LogDir = '%LOGDIR%'
%_VECHO% LogPrefix = '%LOGPREFIX%'
%_VECHO% LogSuffix = '%LOGSUFFIX%'
%_VECHO% Logging = '%LOGGING%'

REM ****************************************************************************
REM ************************ Extra Properties Handling *************************
REM ****************************************************************************

IF NOT DEFINED NOPROPS (
  IF EXIST Externals\Eagle\bin\netFramework40\EagleShell.exe (
    IF DEFINED INTEROP_EXTRA_PROPS_FILE (
      REM
      REM HACK: This is used to work around a limitation of Visual Studio 2005
      REM       and 2008 that prevents the "InheritedPropertySheets" attribute
      REM       value from working correctly when it refers to a property that
      REM       evaluates to an empty string.
      REM
      %_CECHO% Externals\Eagle\bin\netFramework40\EagleShell.exe -evaluate "set fileName {SQLite.Interop/props/include.vsprops}; set data [readFile $fileName]; regsub -- {	InheritedPropertySheets=\"\"} $data {	InheritedPropertySheets=\"$^(INTEROP_EXTRA_PROPS_FILE^)\"} data; writeFile $fileName $data"
      %__ECHO% Externals\Eagle\bin\netFramework40\EagleShell.exe -evaluate "set fileName {SQLite.Interop/props/include.vsprops}; set data [readFile $fileName]; regsub -- {	InheritedPropertySheets=\"\"} $data {	InheritedPropertySheets=\"$^(INTEROP_EXTRA_PROPS_FILE^)\"} data; writeFile $fileName $data"

      IF ERRORLEVEL 1 (
        ECHO Property file modification of "SQLite.Interop\props\include.vsprops" failed.
        GOTO errors
      ) ELSE (
        ECHO Property file modification successful.
      )
    )
  ) ELSE (
    ECHO WARNING: Property file modification skipped, Eagle binaries are not available.
  )
) ELSE (
  ECHO WARNING: Property file modification skipped, disabled via NOPROPS environment variable.
)

REM ****************************************************************************
REM *************************** Version Tag Handling ***************************
REM ****************************************************************************

IF NOT DEFINED NOTAG (
  IF EXIST Externals\Eagle\bin\netFramework40\EagleShell.exe (
    %_CECHO% Externals\Eagle\bin\netFramework40\EagleShell.exe -file Setup\sourceTag.eagle SourceIdMode SQLite.Interop\src\generic\interop.h
    %__ECHO% Externals\Eagle\bin\netFramework40\EagleShell.exe -file Setup\sourceTag.eagle SourceIdMode SQLite.Interop\src\generic\interop.h

    IF ERRORLEVEL 1 (
      ECHO Source tagging of "SQLite.Interop\src\generic\interop.h" failed.
      GOTO errors
    )

    %_CECHO% Externals\Eagle\bin\netFramework40\EagleShell.exe -file Setup\sourceTag.eagle SourceIdMode System.Data.SQLite\SQLitePatchLevel.cs
    %__ECHO% Externals\Eagle\bin\netFramework40\EagleShell.exe -file Setup\sourceTag.eagle SourceIdMode System.Data.SQLite\SQLitePatchLevel.cs

    IF ERRORLEVEL 1 (
      ECHO Source tagging of "System.Data.SQLite\SQLitePatchLevel.cs" failed.
      GOTO errors
    )
  ) ELSE (
    ECHO WARNING: Source tagging skipped, Eagle binaries are not available.
  )
) ELSE (
  ECHO WARNING: Source tagging skipped, disabled via NOTAG environment variable.
)

REM ****************************************************************************
REM ****************************** Build Solution ******************************
REM ****************************************************************************

CALL :fn_CopyVariable MSBUILD_ARGS_%BASE_CONFIGURATION% MSBUILD_ARGS_CFG

IF DEFINED USEDOTNET (
  SET MSBUILD=%DOTNET%
  SET BUILD_SUBCOMMANDS=build
  SET TARGET=Build
) ELSE (
  CALL :fn_UnsetVariable BUILD_SUBCOMMANDS
)

IF NOT DEFINED RESTORE_SUBCOMMANDS (
  SET RESTORE_SUBCOMMANDS=restore
)

%_VECHO% MsBuild = '%MSBUILD%'
%_VECHO% BuildSubCommands = '%BUILD_SUBCOMMANDS%'
%_VECHO% Target = '%TARGET%'
%_VECHO% BuildArgs = '%BUILD_ARGS%'
%_VECHO% MsBuildArgs = '%MSBUILD_ARGS%'
%_VECHO% MsBuildArgsCfg = '%MSBUILD_ARGS_CFG%'
%_VECHO% RestoreSubCommands = '%RESTORE_SUBCOMMANDS%'

IF DEFINED USEPACKAGERESTORE (
  %_CECHO% "%DOTNET%" %RESTORE_SUBCOMMANDS% "%SOLUTION%"
  %__ECHO% "%DOTNET%" %RESTORE_SUBCOMMANDS% "%SOLUTION%"

  IF ERRORLEVEL 1 (
    ECHO Restore failed.
    GOTO errors
  )
)

IF NOT DEFINED NOBUILD (
  %_CECHO% "%MSBUILD%" %BUILD_SUBCOMMANDS% "%SOLUTION%" "/target:%TARGET%" "/property:Configuration=%MSBUILD_CONFIGURATION%" "/property:Platform=%PLATFORM%" %LOGGING% %BUILD_ARGS% %MSBUILD_ARGS% %MSBUILD_ARGS_CFG%
  %__ECHO% "%MSBUILD%" %BUILD_SUBCOMMANDS% "%SOLUTION%" "/target:%TARGET%" "/property:Configuration=%MSBUILD_CONFIGURATION%" "/property:Platform=%PLATFORM%" %LOGGING% %BUILD_ARGS% %MSBUILD_ARGS% %MSBUILD_ARGS_CFG%

  IF ERRORLEVEL 1 (
    ECHO Build failed.
    GOTO errors
  )
) ELSE (
  ECHO WARNING: Build skipped, disabled via NOBUILD environment variable.
)

REM ****************************************************************************
REM **************************** Restore Directory *****************************
REM ****************************************************************************

%_CECHO2% POPD
%__ECHO2% POPD

IF ERRORLEVEL 1 (
  ECHO Could not restore directory.
  GOTO errors
)

REM ****************************************************************************
REM *********************************** Done ***********************************
REM ****************************************************************************

GOTO no_errors

REM ****************************************************************************
REM ****************** Epilogue / Functions / Return Handling ******************
REM ****************************************************************************

:fn_CheckFrameworkDir
  IF DEFINED NOFRAMEWORKDIR GOTO :EOF
  SET FRAMEWORKVER=%1
  %_AECHO% Checking for .NET Framework "%FRAMEWORKVER%"...
  IF NOT DEFINED FRAMEWORKVER GOTO :EOF
  IF DEFINED NOFRAMEWORK64 (
    %_AECHO% Forced into using 32-bit version of MSBuild from Microsoft.NET...
    SET FRAMEWORKDIR1=%windir%\Microsoft.NET\Framework\%FRAMEWORKVER%
    CALL :fn_VerifyFrameworkDir
    GOTO :EOF
  )
  IF NOT "%PROCESSOR_ARCHITECTURE%" == "x86" (
    %_AECHO% The operating system appears to be 64-bit.
    IF EXIST "%windir%\Microsoft.NET\Framework64\%FRAMEWORKVER%" (
      IF EXIST "%windir%\Microsoft.NET\Framework64\%FRAMEWORKVER%\%MSBUILD%" (
        IF EXIST "%windir%\Microsoft.NET\Framework64\%FRAMEWORKVER%\%CSC%" (
          %_AECHO% Using 64-bit version of MSBuild from Microsoft.NET...
          SET FRAMEWORKDIR1=%windir%\Microsoft.NET\Framework64\%FRAMEWORKVER%
          CALL :fn_VerifyFrameworkDir
          GOTO :EOF
        ) ELSE (
          %_AECHO% Missing 64-bit version of "%CSC%".
        )
      ) ELSE (
        %_AECHO% Missing 64-bit version of "%MSBUILD%".
      )
    ) ELSE (
      %_AECHO% Missing 64-bit version of .NET Framework "%FRAMEWORKVER%".
    )
  ) ELSE (
    %_AECHO% The operating system appears to be 32-bit.
  )
  %_AECHO% Using 32-bit version of MSBuild from Microsoft.NET...
  SET FRAMEWORKDIR1=%windir%\Microsoft.NET\Framework\%FRAMEWORKVER%
  CALL :fn_VerifyFrameworkDir
  GOTO :EOF

:fn_VerifyFrameworkDir
  IF DEFINED NOFRAMEWORKDIR GOTO :EOF
  IF NOT DEFINED FRAMEWORKDIR1 (
    %_AECHO% .NET Framework directory is not defined.
    GOTO :EOF
  )
  IF DEFINED FRAMEWORKDIR1 IF NOT EXIST "%FRAMEWORKDIR1%" (
    %_AECHO% .NET Framework directory does not exist, unsetting...
    CALL :fn_UnsetVariable FRAMEWORKDIR1
    GOTO :EOF
  )
  IF DEFINED FRAMEWORKDIR1 IF NOT EXIST "%FRAMEWORKDIR1%\%MSBUILD%" (
    %_AECHO% File "%MSBUILD%" not in .NET Framework directory, unsetting...
    CALL :fn_UnsetVariable FRAMEWORKDIR1
    GOTO :EOF
  )
  IF DEFINED FRAMEWORKDIR1 IF NOT EXIST "%FRAMEWORKDIR1%\%CSC%" (
    %_AECHO% File "%CSC%" not in .NET Framework directory, unsetting...
    CALL :fn_UnsetVariable FRAMEWORKDIR1
    GOTO :EOF
  )
  %_AECHO% .NET Framework directory "%FRAMEWORKDIR1%" verified.
  GOTO :EOF

:fn_CheckMsBuildDir
  IF DEFINED NOMSBUILDDIR GOTO :EOF
  SET MSBUILDVER=%1
  %_AECHO% Checking for MSBuild "%MSBUILDVER%"...
  IF NOT DEFINED MSBUILDVER GOTO :EOF
  IF DEFINED NOMSBUILD64 (
    %_AECHO% Forced into using 32-bit version of MSBuild from Program Files...
    GOTO set_msbuild_x86
  )
  IF "%PROCESSOR_ARCHITECTURE%" == "x86" GOTO set_msbuild_x86
  %_AECHO% The operating system appears to be 64-bit.
  %_AECHO% Using 32-bit version of MSBuild from Program Files...
  SET MSBUILDDIR=%ProgramFiles(x86)%\MSBuild\%MSBUILDVER%\bin
  GOTO set_msbuild_done
  :set_msbuild_x86
  %_AECHO% The operating system appears to be 32-bit.
  %_AECHO% Using native version of MSBuild from Program Files...
  SET MSBUILDDIR=%ProgramFiles%\MSBuild\%MSBUILDVER%\bin
  :set_msbuild_done
  CALL :fn_VerifyMsBuildDir
  GOTO :EOF

:fn_VerifyMsBuildDir
  IF DEFINED NOMSBUILDDIR GOTO :EOF
  IF NOT DEFINED MSBUILDDIR (
    %_AECHO% MSBuild directory is not defined.
    GOTO :EOF
  )
  IF DEFINED MSBUILDDIR IF NOT EXIST "%MSBUILDDIR%" (
    %_AECHO% MSBuild directory does not exist, unsetting...
    CALL :fn_UnsetVariable MSBUILDDIR
    GOTO :EOF
  )
  IF DEFINED MSBUILDDIR IF NOT EXIST "%MSBUILDDIR%\%MSBUILD%" (
    %_AECHO% File "%MSBUILD%" not in MSBuild directory, unsetting...
    CALL :fn_UnsetVariable MSBUILDDIR
    GOTO :EOF
  )
  IF DEFINED MSBUILDDIR IF NOT EXIST "%MSBUILDDIR%\%CSC%" (
    %_AECHO% File "%CSC%" not in MSBuild directory, unsetting...
    CALL :fn_UnsetVariable MSBUILDDIR
    GOTO :EOF
  )
  %_AECHO% MSBuild directory "%MSBUILDDIR%" verified.
  GOTO :EOF

:fn_CheckVisualStudioMsBuildDir
  IF DEFINED NOVISUALSTUDIOMSBUILDDIR GOTO :EOF
  SET MSBUILDVER=%1
  SET VISUALSTUDIOVER=%2
  %_AECHO% Checking for MSBuild "%MSBUILDVER%" within Visual Studio "%VISUALSTUDIOVER%"...
  IF NOT DEFINED MSBUILDVER GOTO :EOF
  IF NOT DEFINED VISUALSTUDIOVER GOTO :EOF
  IF NOT DEFINED VSWHERE_EXE GOTO :EOF
  IF NOT EXIST "%VSWHERE_EXE%" GOTO :EOF
  SET VS_WHEREIS_CMD="%VSWHERE_EXE%" -version %VISUALSTUDIOVER% -products * -requires Microsoft.Component.MSBuild -property installationPath -latest
  IF DEFINED __ECHO (
    %__ECHO% %VS_WHEREIS_CMD%
    SET VISUALSTUDIOINSTALLDIR=C:\Program Files\Microsoft Visual Studio\2017\Community
    GOTO skip_visualStudioInstallDir
  )
  FOR /F "delims=" %%D IN ('%VS_WHEREIS_CMD%') DO (SET VISUALSTUDIOINSTALLDIR=%%D)
  :skip_visualStudioInstallDir
  IF NOT DEFINED VISUALSTUDIOINSTALLDIR (
    %_AECHO% Visual Studio "%VISUALSTUDIOVER%" is not installed.
    GOTO :EOF
  )
  %_AECHO% Visual Studio "%VISUALSTUDIOVER%" is installed.
  SET VISUALSTUDIOMSBUILDDIR=%VISUALSTUDIOINSTALLDIR%\MSBuild\%MSBUILDVER%\bin
  SET VISUALSTUDIOMSBUILDDIR=%VISUALSTUDIOMSBUILDDIR:\\=\%
  CALL :fn_VerifyVisualStudioMsBuildDir
  GOTO :EOF

:fn_VerifyVisualStudioMsBuildDir
  IF DEFINED NOVISUALSTUDIOMSBUILDDIR GOTO :EOF
  IF NOT DEFINED VISUALSTUDIOMSBUILDDIR (
    %_AECHO% Visual Studio directory is not defined.
    GOTO :EOF
  )
  IF DEFINED VISUALSTUDIOMSBUILDDIR IF NOT EXIST "%VISUALSTUDIOMSBUILDDIR%" (
    %_AECHO% Visual Studio directory does not exist, unsetting...
    CALL :fn_UnsetVariable VISUALSTUDIOMSBUILDDIR
    GOTO :EOF
  )
  IF DEFINED VISUALSTUDIOMSBUILDDIR IF NOT EXIST "%VISUALSTUDIOMSBUILDDIR%\%MSBUILD%" (
    %_AECHO% File "%MSBUILD%" not in Visual Studio directory, unsetting...
    CALL :fn_UnsetVariable VISUALSTUDIOMSBUILDDIR
    GOTO :EOF
  )
  IF DEFINED VISUALSTUDIOMSBUILDDIR IF NOT EXIST "%VISUALSTUDIOMSBUILDDIR%\Roslyn\%CSC%" (
    %_AECHO% File "%CSC%" not in Visual Studio directory, unsetting...
    CALL :fn_UnsetVariable VISUALSTUDIOMSBUILDDIR
    GOTO :EOF
  )
  %_AECHO% Visual Studio directory "%VISUALSTUDIOMSBUILDDIR%" verified.
  GOTO :EOF

:fn_CheckBuildToolDir
  %_AECHO% Checking for build tool directories...
  IF DEFINED VISUALSTUDIOMSBUILDDIR GOTO set_visualstudio_msbuild_tools
  IF DEFINED MSBUILDDIR GOTO set_msbuild_tools
  IF DEFINED FRAMEWORKDIR1 GOTO set_framework_tools
  %_AECHO% No build tool directories found.
  GOTO :EOF
  :set_visualstudio_msbuild_tools
  %_AECHO% Using Visual Studio MSBuild directory "%VISUALSTUDIOMSBUILDDIR%"...
  CALL :fn_CopyVariable VISUALSTUDIOMSBUILDDIR BUILDTOOLDIR
  GOTO :EOF
  :set_msbuild_tools
  %_AECHO% Using MSBuild directory "%MSBUILDDIR%"...
  CALL :fn_CopyVariable MSBUILDDIR BUILDTOOLDIR
  GOTO :EOF
  :set_framework_tools
  %_AECHO% Using .NET Framework directory "%FRAMEWORKDIR1%"...
  CALL :fn_CopyVariable FRAMEWORKDIR1 BUILDTOOLDIR
  GOTO :EOF

:fn_VerifyBuildToolDir
  IF NOT DEFINED BUILDTOOLDIR (
    %_AECHO% Build tool directory is not defined.
    GOTO :EOF
  )
  IF DEFINED BUILDTOOLDIR IF NOT EXIST "%BUILDTOOLDIR%" (
    %_AECHO% Build tool directory does not exist, unsetting...
    CALL :fn_UnsetVariable BUILDTOOLDIR
    GOTO :EOF
  )
  IF DEFINED BUILDTOOLDIR IF NOT EXIST "%BUILDTOOLDIR%\%MSBUILD%" (
    %_AECHO% File "%MSBUILD%" not in build tool directory, unsetting...
    CALL :fn_UnsetVariable BUILDTOOLDIR
    GOTO :EOF
  )
  IF DEFINED BUILDTOOLDIR IF NOT EXIST "%BUILDTOOLDIR%\%CSC%" IF NOT EXIST "%BUILDTOOLDIR%\Roslyn\%CSC%" (
    %_AECHO% File "%CSC%" not in build tool directory, unsetting...
    CALL :fn_UnsetVariable BUILDTOOLDIR
    GOTO :EOF
  )
  %_AECHO% Build tool directory "%BUILDTOOLDIR%" verified.
  GOTO :EOF

:fn_VerifyDotNetCore
  FOR %%T IN (%DOTNET%) DO (
    SET %%T_PATH=%%~dp$PATH:T
  )
  IF NOT DEFINED %DOTNET%_PATH (
    ECHO The .NET Core executable "%DOTNET%" is required to be in the PATH.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  GOTO :EOF

:fn_ForceMsBuildForInteropProject
  %_AECHO% Forcing use of MSBuild for interop project...
  SET CONFIGURATION=%CONFIGURATION:ManagedOnly=NativeOnly%
  IF DEFINED INTEROPYEAR (
    SET YEAR=%INTEROPYEAR%
  ) ELSE (
    REM TODO: Good default for Visual C++?
    SET YEAR=2015
  )
  CALL :fn_UnsetVariable NOBUILDTOOLDIR
  CALL :fn_UnsetVariable USEDOTNET
  GOTO :EOF

:fn_DetectVisualStudioDir
  REM
  REM TODO: When the next version of Visual Studio and/or
  REM       MSBuild is released, this section may need
  REM       updating.
  REM
  IF NOT DEFINED VISUALSTUDIOMSBUILDDIR (
    CALL :fn_CheckVisualStudioMsBuildDir Current 16.0
    IF DEFINED VISUALSTUDIOMSBUILDDIR (
      IF NOT DEFINED YEAR (
        SET YEAR=2017
      )
      IF NOT DEFINED NOUSEPACKAGERESTORE (
        IF NOT DEFINED USEPACKAGERESTORE (
          SET USEPACKAGERESTORE=1
        )
      )
    )
  )
  IF NOT DEFINED VISUALSTUDIOMSBUILDDIR (
    CALL :fn_CheckVisualStudioMsBuildDir 15.0 15.0
    IF DEFINED VISUALSTUDIOMSBUILDDIR (
      IF NOT DEFINED YEAR (
        SET YEAR=2017
      )
      IF NOT DEFINED NOUSEPACKAGERESTORE (
        IF NOT DEFINED USEPACKAGERESTORE (
          SET USEPACKAGERESTORE=1
        )
      )
    )
  )
  GOTO :EOF

:fn_DetectMsBuildDir
  REM
  REM TODO: When the next version of MSBuild is released,
  REM       this section may need updating.
  REM
  IF NOT DEFINED MSBUILDDIR (
    CALL :fn_CheckMsBuildDir 14.0
    IF DEFINED MSBUILDDIR (
      IF NOT DEFINED YEAR (
        SET YEAR=2015
      )
    )
  )
  IF NOT DEFINED MSBUILDDIR (
    CALL :fn_CheckMsBuildDir 12.0
    IF DEFINED MSBUILDDIR (
      IF NOT DEFINED YEAR (
        SET YEAR=2013
      )
    )
  )
  GOTO :EOF

:fn_DetectFrameworkDir
  REM
  REM TODO: When the next version of Visual Studio and/or
  REM       .NET Framework is released, this section may
  REM       need updating.
  REM
  IF NOT DEFINED FRAMEWORKDIR1 (
    CALL :fn_CheckFrameworkDir v4.0.30319
    IF DEFINED FRAMEWORKDIR1 (
      IF NOT DEFINED YEAR (
        SET YEAR=2010
      )
    )
  )
  IF NOT DEFINED FRAMEWORKDIR1 (
    CALL :fn_CheckFrameworkDir v3.5
    IF DEFINED FRAMEWORKDIR1 (
      IF NOT DEFINED YEAR (
        SET YEAR=2008
      )
    )
  )
  IF NOT DEFINED FRAMEWORKDIR1 (
    CALL :fn_CheckFrameworkDir v2.0.50727
    IF DEFINED FRAMEWORKDIR1 (
      IF NOT DEFINED YEAR (
        SET YEAR=2005
      )
    )
  )
  GOTO :EOF

:fn_SetupBuildTool
  %_AECHO% Setting up build tool...
  %_VECHO% NoBuildToolDir = '%NOBUILDTOOLDIR%'
  %_VECHO% UseDotNet = '%USEDOTNET%'
  %_VECHO% UsePackageRestore = '%USEPACKAGERESTORE%'
  IF NOT DEFINED NOBUILDTOOLDIR (
    IF DEFINED BUILDTOOLDIR (
      %_AECHO% Forcing the use of build tool directory "%BUILDTOOLDIR%"...
    ) ELSE (
      CALL :fn_CheckBuildToolDir
      CALL :fn_VerifyBuildToolDir
    )
  )
  %_VECHO% FrameworkDir1 = '%FRAMEWORKDIR1%'
  %_VECHO% MsBuildDir = '%MSBUILDDIR%'
  %_VECHO% VisualStudioMsBuildDir = '%VISUALSTUDIOMSBUILDDIR%'
  %_VECHO% BuildToolDir = '%BUILDTOOLDIR%'
  IF NOT DEFINED NOBUILDTOOLDIR (
    IF NOT DEFINED BUILDTOOLDIR (
      ECHO.
      ECHO No directory containing MSBuild could be found.
      ECHO.
      ECHO Please install the .NET Framework or set the "FRAMEWORKDIR1"
      ECHO environment variable to the location where it is installed.
      ECHO.
      CALL :fn_SetErrorLevel
      GOTO :EOF
    )
  )
  IF NOT DEFINED NOBUILDTOOLDIR (
    CALL :fn_PrependToPath BUILDTOOLDIR
  )
  %_VECHO% Path = '%PATH%'
  GOTO :EOF

:fn_SetupSolution
  IF DEFINED SOLUTION (
    %_AECHO% Building the specified project/solution only...
    GOTO :EOF
  )
  IF DEFINED COREONLY (
    %_AECHO% Building core managed project...
    SET SOLUTION=.\System.Data.SQLite\System.Data.SQLite.%YEAR%.csproj
    GOTO :EOF
  )
  IF DEFINED INTEROPONLY (
    IF DEFINED STATICONLY (
      %_AECHO% Building static core interop project...
      FOR /F "delims=" %%F IN ('DIR /B /S ".\SQLite.Interop\SQLite.Interop.Static.%YEAR%.vc*proj" 2^> NUL') DO (
        SET SOLUTION=%%F
      )
      IF NOT DEFINED SOLUTION (
        ECHO Could not locate static core interop project for %YEAR%.
        CALL :fn_SetErrorLevel
      )
      GOTO :EOF
    ) ELSE (
      %_AECHO% Building normal core interop project...
      FOR /F "delims=" %%F IN ('DIR /B /S ".\SQLite.Interop\SQLite.Interop.%YEAR%.vc*proj" 2^> NUL') DO (
        SET SOLUTION=%%F
      )
      IF NOT DEFINED SOLUTION (
        ECHO Could not locate normal core interop project for %YEAR%.
        CALL :fn_SetErrorLevel
      )
      GOTO :EOF
    )
  )
  IF DEFINED BUILD_FULL (
    %_AECHO% Building all projects...
    SET SOLUTION=.\SQLite.NET.%YEAR%.sln
    GOTO :EOF
  )
  %_AECHO% Building all MSBuild projects...
  SET SOLUTION=.\SQLite.NET.%YEAR%.MSBuild.sln
  GOTO :EOF

:fn_SetupTarget
  IF NOT DEFINED TARGET (
    SET TARGET=Rebuild
  )
  GOTO :EOF

:fn_SetupLogging
  IF NOT DEFINED TEMP (
    ECHO The TEMP environment variable must be set first.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  IF NOT DEFINED LOGASM (
    IF DEFINED USEDOTNET (
      SET LOGASM=Microsoft.Build
    ) ELSE (
      SET LOGASM=Microsoft.Build.Engine
    )
  )
  IF NOT DEFINED LOGDIR (
    SET LOGDIR=%TEMP%
  )
  IF NOT DEFINED LOGPREFIX (
    SET LOGPREFIX=System.Data.SQLite.Build
  )
  IF NOT DEFINED LOGSUFFIX (
    SET LOGSUFFIX=Unknown
  )
  IF DEFINED LOGGING GOTO :EOF
  IF DEFINED NOLOG GOTO :EOF
  SET LOGGING="/logger:FileLogger,%LOGASM%;Logfile=%LOGDIR%\%LOGPREFIX%_%CONFIGURATION%_%PLATFORM%_%YEAR%_%LOGSUFFIX%.log;Verbosity=diagnostic"
  GOTO :EOF

:fn_UnquoteVariable
  IF NOT DEFINED %1 GOTO :EOF
  SETLOCAL
  SET __ECHO_CMD=ECHO %%%1%%
  FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
    SET VALUE=%%V
  )
  SET VALUE=%VALUE:"=%
  REM "
  ENDLOCAL && SET %1=%VALUE%
  GOTO :EOF

:fn_PrependToPath
  IF NOT DEFINED %1 GOTO :EOF
  SETLOCAL
  SET __ECHO_CMD=ECHO %%%1%%
  FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
    SET VALUE=%%V
  )
  SET VALUE=%VALUE:"=%
  REM "
  ENDLOCAL && SET PATH=%VALUE%;%PATH%
  GOTO :EOF

:fn_CopyVariable
  IF NOT DEFINED %1 GOTO :EOF
  IF "%2" == "" GOTO :EOF
  SETLOCAL
  SET __ECHO_CMD=ECHO %%%1%%
  FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
    SET VALUE=%%V
  )
  ENDLOCAL && SET %2=%VALUE%
  GOTO :EOF

:fn_UnsetVariable
  SETLOCAL
  SET VALUE=%1
  IF DEFINED VALUE (
    SET VALUE=
    ENDLOCAL
    SET %VALUE%=
  ) ELSE (
    ENDLOCAL
  )
  CALL :fn_ResetErrorLevel
  GOTO :EOF

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0 [configuration] [platform] [year]
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Build failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Build success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/build_all.bat.







































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
@ECHO OFF

::
:: build_all.bat --
::
:: Multi-Wrapper Tool for MSBuild
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

CALL :fn_ResetErrorLevel

%_CECHO3% CALL "%TOOLS%\vsSp.bat"
%__ECHO3% CALL "%TOOLS%\vsSp.bat"

IF ERRORLEVEL 1 (
  ECHO Could not detect Visual Studio.
  GOTO errors
)

%_CECHO3% CALL "%TOOLS%\set_common.bat"
%__ECHO3% CALL "%TOOLS%\set_common.bat"

IF ERRORLEVEL 1 (
  ECHO Could not set common variables.
  GOTO errors
)

IF NOT DEFINED BUILD_CONFIGURATIONS (
  SET BUILD_CONFIGURATIONS=Debug Release
)

%_VECHO% BuildConfigurations = '%BUILD_CONFIGURATIONS%'

IF NOT DEFINED PLATFORMS (
  SET PLATFORMS=Win32
)

%_VECHO% Platforms = '%PLATFORMS%'

IF NOT DEFINED YEARS (
  SET YEARS=2008
)

%_VECHO% Years = '%YEARS%'

IF NOT DEFINED BUILD_TOOL (
  SET BUILD_TOOL=%TOOLS%\build.bat
)

%_VECHO% BuildTool = '%BUILD_TOOL%'

FOR %%C IN (%BUILD_CONFIGURATIONS%) DO (
  FOR %%P IN (%PLATFORMS%) DO (
    FOR %%Y IN (%YEARS%) DO (
      %_CECHO3% CALL "%TOOLS%\set_year_%%Y.bat"
      %__ECHO3% CALL "%TOOLS%\set_year_%%Y.bat"

      IF ERRORLEVEL 1 (
        ECHO Could not set variables for %%Y.
        GOTO errors
      )

      %_CECHO3% CALL "%BUILD_TOOL%" %%C %%P %%Y
      %__ECHO3% CALL "%BUILD_TOOL%" %%C %%P %%Y

      IF ERRORLEVEL 1 (
        ECHO Could not build binaries for %%C/%%P/%%Y.
        GOTO errors
      )
    )
  )
)

GOTO no_errors

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/build_ce_200x.bat.







































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
@ECHO OFF

::
:: build_ce_200x.bat --
::
:: WinCE Wrapper Tool for MSBuild
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

CALL :fn_ResetErrorLevel

%_CECHO3% CALL "%TOOLS%\vsSp.bat"
%__ECHO3% CALL "%TOOLS%\vsSp.bat"

IF ERRORLEVEL 1 (
  ECHO Could not detect Visual Studio.
  GOTO errors
)

IF DEFINED BUILD_DEBUG (
  SET BUILD_CONFIGURATIONS=Debug Release
) ELSE (
  SET BUILD_CONFIGURATIONS=Release
)

SET BASE_CONFIGURATIONSUFFIX=Compact
SET PLATFORMS="Pocket PC 2003 (ARMV4)"

REM
REM NOTE: The .NET Compact Framework is only supported by Visual Studio 2005
REM       and 2008, regardless of which versions of Visual Studio are installed
REM       on this machine; therefore, override the YEARS variable limiting it
REM       to 2005 and 2008 only.
REM
CALL :fn_UnsetVariable YEARS

IF NOT DEFINED NOVS2005 (
  IF DEFINED VS2005SP (
    CALL :fn_AppendVariable YEARS " 2005"
  )
)

IF NOT DEFINED NOVS2008 (
  IF DEFINED VS2008SP (
    CALL :fn_AppendVariable YEARS " 2008"
  )
)

%_VECHO% BuildConfigurations = '%BUILD_CONFIGURATIONS%'
%_VECHO% BaseConfigurationSuffix = '%BASE_CONFIGURATIONSUFFIX%'
%_VECHO% Platforms = '%PLATFORMS%'
%_VECHO% Years = '%YEARS%'

CALL :fn_ResetErrorLevel

%_CECHO3% CALL "%TOOLS%\build_all.bat"
%__ECHO3% CALL "%TOOLS%\build_all.bat"

IF ERRORLEVEL 1 (
  ECHO Failed to build WinCE binaries.
  GOTO errors
)

GOTO no_errors

:fn_AppendVariable
  SET __ECHO_CMD=ECHO %%%1%%
  IF DEFINED %1 (
    FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
      SET %1=%%V%~2
    )
  ) ELSE (
    SET %1=%~2
  )
  SET __ECHO_CMD=
  CALL :fn_ResetErrorLevel
  GOTO :EOF

:fn_UnsetVariable
  SETLOCAL
  SET VALUE=%1
  IF DEFINED VALUE (
    SET VALUE=
    ENDLOCAL
    SET %VALUE%=
  ) ELSE (
    ENDLOCAL
  )
  CALL :fn_ResetErrorLevel
  GOTO :EOF

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Build failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Build success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/build_ce_2013.bat.







































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
@ECHO OFF

::
:: build_ce_2013.bat --
::
:: WinCE Wrapper Tool for MSBuild
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

SET BUILD_CONFIGURATIONS=Debug Release
SET BASE_CONFIGURATIONSUFFIX=Compact
SET PLATFORMS="CEPC DevPlatform" ARMV7
SET YEARS=2012
SET SOLUTION=%TOOLS%\..\SQLite.NET.2012.Compact.sln

CALL :fn_ResetErrorLevel

%_CECHO3% CALL "%TOOLS%\build_all.bat"
%__ECHO3% CALL "%TOOLS%\build_all.bat"

IF ERRORLEVEL 1 (
  ECHO Failed to build WinCE binaries.
  GOTO errors
)

GOTO no_errors

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Build failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Build success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/build_mono.bat.







































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
@ECHO OFF

::
:: build_mono.bat --
::
:: Mono Wrapper Tool for MSBuild
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%2

IF DEFINED DUMMY2 (
  GOTO usage
)

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

SET BUILD_CONFIGURATIONS=%1

IF DEFINED BUILD_CONFIGURATIONS (
  CALL :fn_UnquoteVariable BUILD_CONFIGURATIONS
) ELSE (
  %_AECHO% No build configurations specified, using default...
  IF DEFINED BUILD_DEBUG (
    SET BUILD_CONFIGURATIONS=DebugManagedOnly ReleaseManagedOnly
  ) ELSE (
    SET BUILD_CONFIGURATIONS=ReleaseManagedOnly
  )
)

%_VECHO% BuildConfigurations = '%BUILD_CONFIGURATIONS%'

CALL :fn_ResetErrorLevel

%_CECHO3% CALL "%TOOLS%\vsSp.bat"
%__ECHO3% CALL "%TOOLS%\vsSp.bat"

IF ERRORLEVEL 1 (
  ECHO Could not detect Visual Studio.
  GOTO errors
)

CALL :fn_UnsetVariable YEARS

IF NOT DEFINED NOVS2019 (
  IF DEFINED VS2019SP (
    SET YEARS=2019
  ) ELSE (
    ECHO Could not detect Visual Studio 2019.
  )
) ELSE (
  ECHO Use of Visual Studio 2019 is disallowed.
)

IF NOT DEFINED NOVS2017 (
  IF DEFINED VS2017SP (
    SET YEARS=2017
  ) ELSE (
    ECHO Could not detect Visual Studio 2017.
  )
) ELSE (
  ECHO Use of Visual Studio 2017 is disallowed.
)

IF NOT DEFINED NOVS2015 (
  IF DEFINED VS2015SP (
    SET YEARS=2015
  ) ELSE (
    ECHO Could not detect Visual Studio 2015.
  )
) ELSE (
  ECHO Use of Visual Studio 2015 is disallowed.
)

IF NOT DEFINED NOVS2013 (
  IF DEFINED VS2013SP (
    SET YEARS=2013
  ) ELSE (
    ECHO Could not detect Visual Studio 2013.
  )
) ELSE (
  ECHO Use of Visual Studio 2013 is disallowed.
)

IF NOT DEFINED YEARS (
  IF NOT DEFINED NOVS2012 (
    IF DEFINED VS2012SP (
      SET YEARS=2012
    ) ELSE (
      ECHO Could not detect Visual Studio 2012.
    )
  ) ELSE (
    ECHO Use of Visual Studio 2012 is disallowed.
  )
)

IF NOT DEFINED YEARS (
  ECHO No supported version of Visual Studio was detected and allowed.
  goto errors
)

SET PLATFORMS="Any CPU"
SET NOUSER=1

REM
REM TODO: This list of properties must be kept synchronized with the common
REM       list in the "SQLite.NET.Mono.Settings.targets" file.
REM
SET MSBUILD_ARGS=/property:ConfigurationSuffix=MonoOnPosix
SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:InteropCodec=false
SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:InteropLog=false

IF DEFINED MSBUILD_ARGS_MONO (
  SET MSBUILD_ARGS=%MSBUILD_ARGS% %MSBUILD_ARGS_MONO%
)

REM
REM TODO: This list of properties must be kept synchronized with the debug
REM       list in the "SQLite.NET.Mono.Settings.targets" file.
REM
SET MSBUILD_ARGS_DEBUG=/property:CheckState=true
SET MSBUILD_ARGS_DEBUG=%MSBUILD_ARGS_DEBUG% /property:CountHandle=true
SET MSBUILD_ARGS_DEBUG=%MSBUILD_ARGS_DEBUG% /property:TraceConnection=true
SET MSBUILD_ARGS_DEBUG=%MSBUILD_ARGS_DEBUG% /property:TraceDetection=true
SET MSBUILD_ARGS_DEBUG=%MSBUILD_ARGS_DEBUG% /property:TraceHandle=true
SET MSBUILD_ARGS_DEBUG=%MSBUILD_ARGS_DEBUG% /property:TraceStatement=true
SET MSBUILD_ARGS_DEBUG=%MSBUILD_ARGS_DEBUG% /property:TrackMemoryBytes=true

%_CECHO3% CALL "%TOOLS%\build_all.bat"
%__ECHO3% CALL "%TOOLS%\build_all.bat"

IF ERRORLEVEL 1 (
  ECHO Failed to build Mono binaries.
  GOTO errors
)

GOTO no_errors

:fn_UnquoteVariable
  IF NOT DEFINED %1 GOTO :EOF
  SETLOCAL
  SET __ECHO_CMD=ECHO %%%1%%
  FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
    SET VALUE=%%V
  )
  SET VALUE=%VALUE:"=%
  REM "
  ENDLOCAL && SET %1=%VALUE%
  GOTO :EOF

:fn_UnsetVariable
  SETLOCAL
  SET VALUE=%1
  IF DEFINED VALUE (
    SET VALUE=
    ENDLOCAL
    SET %VALUE%=
  ) ELSE (
    ENDLOCAL
  )
  CALL :fn_ResetErrorLevel
  GOTO :EOF

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0 [configurations]
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Build failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Build success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/build_net_standard_20.bat.

























































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
@ECHO OFF

::
:: build_net_standard_20.bat --
::
:: .NET Standard 2.0 Wrapper Tool for MSBuild
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%2

IF DEFINED DUMMY2 (
  GOTO usage
)

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

SET BUILD_CONFIGURATIONS=%1

IF DEFINED BUILD_CONFIGURATIONS (
  CALL :fn_UnquoteVariable BUILD_CONFIGURATIONS
) ELSE (
  %_AECHO% No build configurations specified, using default...
  IF DEFINED BUILD_DEBUG (
    SET BUILD_CONFIGURATIONS=DebugManagedOnly ReleaseManagedOnly
  ) ELSE (
    SET BUILD_CONFIGURATIONS=ReleaseManagedOnly
  )
)

%_VECHO% BuildConfigurations = '%BUILD_CONFIGURATIONS%'

SET YEARS=NetStandard20
SET PLATFORMS="Any CPU"
SET NOUSER=1

REM
REM TODO: This list of properties must be kept synchronized with the common
REM       list in the "SQLite.NET.NetStandard20.Settings.targets" file.
REM
SET MSBUILD_ARGS=/property:ConfigurationSuffix=NetStandard20
SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:InteropCodec=false
SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:InteropLog=false

IF DEFINED MSBUILD_ARGS_NET_STANDARD_20 (
  SET MSBUILD_ARGS=%MSBUILD_ARGS% %MSBUILD_ARGS_NET_STANDARD_20%
)

REM
REM TODO: This list of properties must be kept synchronized with the debug
REM       list in the "SQLite.NET.NetStandard20.Settings.targets" file.
REM
SET MSBUILD_ARGS_DEBUG=/property:CheckState=true
SET MSBUILD_ARGS_DEBUG=%MSBUILD_ARGS_DEBUG% /property:CountHandle=true
SET MSBUILD_ARGS_DEBUG=%MSBUILD_ARGS_DEBUG% /property:TraceConnection=true
SET MSBUILD_ARGS_DEBUG=%MSBUILD_ARGS_DEBUG% /property:TraceDetection=true
SET MSBUILD_ARGS_DEBUG=%MSBUILD_ARGS_DEBUG% /property:TraceHandle=true
SET MSBUILD_ARGS_DEBUG=%MSBUILD_ARGS_DEBUG% /property:TraceStatement=true
SET MSBUILD_ARGS_DEBUG=%MSBUILD_ARGS_DEBUG% /property:TrackMemoryBytes=true

REM
REM NOTE: For use of the .NET Core SDK build system.
REM
SET NETCORE20ONLY=1

REM
REM NOTE: Prevent output files from being wrongly deleted.
REM
SET TARGET=Build

%_CECHO3% CALL "%TOOLS%\build_all.bat"
%__ECHO3% CALL "%TOOLS%\build_all.bat"

IF ERRORLEVEL 1 (
  ECHO Failed to build .NET Standard 2.0 binaries.
  GOTO errors
)

GOTO no_errors

:fn_UnquoteVariable
  IF NOT DEFINED %1 GOTO :EOF
  SETLOCAL
  SET __ECHO_CMD=ECHO %%%1%%
  FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
    SET VALUE=%%V
  )
  SET VALUE=%VALUE:"=%
  REM "
  ENDLOCAL && SET %1=%VALUE%
  GOTO :EOF

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0 [configurations]
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Build failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Build success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/build_net_standard_21.bat.

























































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
@ECHO OFF

::
:: build_net_standard_21.bat --
::
:: .NET Standard 2.1 Wrapper Tool for MSBuild
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%2

IF DEFINED DUMMY2 (
  GOTO usage
)

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

SET BUILD_CONFIGURATIONS=%1

IF DEFINED BUILD_CONFIGURATIONS (
  CALL :fn_UnquoteVariable BUILD_CONFIGURATIONS
) ELSE (
  %_AECHO% No build configurations specified, using default...
  IF DEFINED BUILD_DEBUG (
    SET BUILD_CONFIGURATIONS=DebugManagedOnly ReleaseManagedOnly
  ) ELSE (
    SET BUILD_CONFIGURATIONS=ReleaseManagedOnly
  )
)

%_VECHO% BuildConfigurations = '%BUILD_CONFIGURATIONS%'

SET YEARS=NetStandard21
SET PLATFORMS="Any CPU"
SET NOUSER=1

REM
REM TODO: This list of properties must be kept synchronized with the common
REM       list in the "SQLite.NET.NetStandard21.Settings.targets" file.
REM
SET MSBUILD_ARGS=/property:ConfigurationSuffix=NetStandard21
SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:InteropCodec=false
SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:InteropLog=false

IF DEFINED MSBUILD_ARGS_NET_STANDARD_21 (
  SET MSBUILD_ARGS=%MSBUILD_ARGS% %MSBUILD_ARGS_NET_STANDARD_21%
)

REM
REM TODO: This list of properties must be kept synchronized with the debug
REM       list in the "SQLite.NET.NetStandard21.Settings.targets" file.
REM
SET MSBUILD_ARGS_DEBUG=/property:CheckState=true
SET MSBUILD_ARGS_DEBUG=%MSBUILD_ARGS_DEBUG% /property:CountHandle=true
SET MSBUILD_ARGS_DEBUG=%MSBUILD_ARGS_DEBUG% /property:TraceConnection=true
SET MSBUILD_ARGS_DEBUG=%MSBUILD_ARGS_DEBUG% /property:TraceDetection=true
SET MSBUILD_ARGS_DEBUG=%MSBUILD_ARGS_DEBUG% /property:TraceHandle=true
SET MSBUILD_ARGS_DEBUG=%MSBUILD_ARGS_DEBUG% /property:TraceStatement=true
SET MSBUILD_ARGS_DEBUG=%MSBUILD_ARGS_DEBUG% /property:TrackMemoryBytes=true

REM
REM NOTE: For use of the .NET Core SDK build system.
REM
SET NETCORE30ONLY=1

REM
REM NOTE: Prevent output files from being wrongly deleted.
REM
SET TARGET=Build

%_CECHO3% CALL "%TOOLS%\build_all.bat"
%__ECHO3% CALL "%TOOLS%\build_all.bat"

IF ERRORLEVEL 1 (
  ECHO Failed to build .NET Standard 2.1 binaries.
  GOTO errors
)

GOTO no_errors

:fn_UnquoteVariable
  IF NOT DEFINED %1 GOTO :EOF
  SETLOCAL
  SET __ECHO_CMD=ECHO %%%1%%
  FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
    SET VALUE=%%V
  )
  SET VALUE=%VALUE:"=%
  REM "
  ENDLOCAL && SET %1=%VALUE%
  GOTO :EOF

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0 [configurations]
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Build failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Build success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/build_nuget.bat.





































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
@ECHO OFF

::
:: build_nuget.bat --
::
:: Wrapper Tool for NuGet
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

CALL :fn_UnsetVariable BREAK

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

SET ROOT=%~dp0\..
SET ROOT=%ROOT:\\=\%

%_VECHO% Root = '%ROOT%'

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

IF NOT DEFINED NUGET (
  REM
  REM WARNING: This batch tool relies upon a custom fork of the NuGet client that
  REM          implements the "-VerbatimVersion" option.  For further information,
  REM          please see "https://github.com/NuGet/Home/issues/3050".
  REM
  SET NUGET=%ROOT%\Externals\NuGet\NuGet.exe
)

%_VECHO% NuGet = '%NUGET%'

REM
REM NOTE: If the Eagle binaries do not appear to be available, skip doing
REM       things in this batch tool that require them.
REM
IF NOT EXIST "%ROOT%\Externals\Eagle\bin\netFramework40\EagleShell.exe" (
  SET NO_NUGET_VERSION=1
  SET NO_NUGET_XPLATFORM=1
)

CALL :fn_ResetErrorLevel

IF DEFINED NUGET_VERSION GOTO skip_nuGetVersion

IF DEFINED NO_NUGET_VERSION (
  SET NUGET_VERSION=1.0.0.0
  GOTO skip_nuGetVersion
)

%_CECHO2% PUSHD "%ROOT%\Externals\Eagle\bin\netFramework40"
%__ECHO2% PUSHD "%ROOT%\Externals\Eagle\bin\netFramework40"

IF ERRORLEVEL 1 (
  ECHO Could not change directory to "%ROOT%\Externals\Eagle\bin\netFramework40".
  GOTO errors
)

SET GET_NUGET_VERSION_CMD=EagleShell.exe -initialize -postInitialize setToolVariables -evaluate "puts stdout [regexp -inline -skip 1 -- $nuget_version_pattern [readFile {%ROOT%\NuGet\SQLite.Core.nuspec}]]"

IF DEFINED __ECHO (
  %__ECHO% %GET_NUGET_VERSION_CMD%
  SET NUGET_VERSION=1.0.X.0
) ELSE (
  FOR /F %%T IN ('%GET_NUGET_VERSION_CMD%') DO (SET NUGET_VERSION=%%T)
)

IF NOT DEFINED NUGET_VERSION (
  ECHO The NUGET_VERSION environment variable could not be set.
  GOTO errors
)

%_CECHO2% POPD
%__ECHO2% POPD

IF ERRORLEVEL 1 (
  ECHO Could not restore directory.
  GOTO errors
)

:skip_nuGetVersion

%_VECHO% NuGetVersion = '%NUGET_VERSION%'

IF NOT EXIST "%ROOT%\Setup\Output" (
  %__ECHO% MKDIR "%ROOT%\Setup\Output"

  IF ERRORLEVEL 1 (
    ECHO Could not create directory "%ROOT%\Setup\Output".
    GOTO errors
  )
)

IF NOT DEFINED LINUX_URI (
  SET LINUX_URI=https://system.data.sqlite.org/index.html/uv/%NUGET_VERSION%/linux-x64/SQLite.Interop.dll
)

IF NOT DEFINED LINUX_DIRECTORY (
  SET LINUX_DIRECTORY=%ROOT%\bin\2016\linux-x64\ReleaseNativeOnly
)

%_VECHO% LinuxUri = '%LINUX_URI%'
%_VECHO% LinuxDirectory = '%LINUX_DIRECTORY%'

IF NOT DEFINED MACOS_URI (
  SET MACOS_URI=https://system.data.sqlite.org/index.html/uv/%NUGET_VERSION%/osx-x64/SQLite.Interop.dll
)

IF NOT DEFINED MACOS_DIRECTORY (
  SET MACOS_DIRECTORY=%ROOT%\bin\2016\osx-x64\ReleaseNativeOnly
)

%_VECHO% MacOsUri = '%MACOS_URI%'
%_VECHO% MacOsDirectory = '%MACOS_DIRECTORY%'

IF NOT DEFINED NO_NUGET_XPLATFORM (
  %_CECHO% "%ROOT%\Externals\Eagle\bin\netFramework40\EagleShell.exe" -evaluate "set directory {%LINUX_DIRECTORY%}; set fileName [file join $directory SQLite.Interop.dll]; file mkdir $directory; catch {file delete $fileName}; uri download -- {%LINUX_URI%} $fileName"
  %__ECHO% "%ROOT%\Externals\Eagle\bin\netFramework40\EagleShell.exe" -evaluate "set directory {%LINUX_DIRECTORY%}; set fileName [file join $directory SQLite.Interop.dll]; file mkdir $directory; catch {file delete $fileName}; uri download -- {%LINUX_URI%} $fileName"

  IF ERRORLEVEL 1 (
    ECHO Download of System.Data.SQLite interop assembly "%LINUX_URI%" to "%LINUX_DIRECTORY%" failure.
    GOTO errors
  ) ELSE (
    %_AECHO% Download of System.Data.SQLite interop assembly "%LINUX_URI%" to "%LINUX_DIRECTORY%" success.
  )

  %_CECHO% "%ROOT%\Externals\Eagle\bin\netFramework40\EagleShell.exe" -evaluate "set directory {%MACOS_DIRECTORY%}; set fileName [file join $directory SQLite.Interop.dll]; file mkdir $directory; catch {file delete $fileName}; uri download -- {%MACOS_URI%} $fileName"
  %__ECHO% "%ROOT%\Externals\Eagle\bin\netFramework40\EagleShell.exe" -evaluate "set directory {%MACOS_DIRECTORY%}; set fileName [file join $directory SQLite.Interop.dll]; file mkdir $directory; catch {file delete $fileName}; uri download -- {%MACOS_URI%} $fileName"

  IF ERRORLEVEL 1 (
    ECHO Download of System.Data.SQLite interop assembly "%MACOS_URI%" to "%MACOS_DIRECTORY%" failure.
    GOTO errors
  ) ELSE (
    %_AECHO% Download of System.Data.SQLite interop assembly "%MACOS_URI%" to "%MACOS_DIRECTORY%" success.
  )
)

IF NOT DEFINED NUGET_LEGACY_ONLY (
  %__ECHO% "%NUGET%" pack -VerbatimVersion "%ROOT%\NuGet\SQLite.nuspec"

  IF ERRORLEVEL 1 (
    ECHO The "%ROOT%\NuGet\SQLite.nuspec" package could not be built.
    GOTO errors
  )

  %__ECHO% "%NUGET%" pack -VerbatimVersion "%ROOT%\NuGet\SQLite.Core.nuspec"

  IF ERRORLEVEL 1 (
    ECHO The "%ROOT%\NuGet\SQLite.Core.nuspec" package could not be built.
    GOTO errors
  )

  %__ECHO% "%NUGET%" pack -VerbatimVersion "%ROOT%\NuGet\SQLite.Core.NetFramework.nuspec"

  IF ERRORLEVEL 1 (
    ECHO The "%ROOT%\NuGet\SQLite.Core.NetFramework.nuspec" package could not be built.
    GOTO errors
  )

  %__ECHO% "%NUGET%" pack -VerbatimVersion "%ROOT%\NuGet\SQLite.Core.NetStandard.nuspec"

  IF ERRORLEVEL 1 (
    ECHO The "%ROOT%\NuGet\SQLite.Core.NetStandard.nuspec" package could not be built.
    GOTO errors
  )

  IF NOT DEFINED NUGET_CORE_ONLY (
    %__ECHO% "%NUGET%" pack -VerbatimVersion "%ROOT%\NuGet\SQLite.Core.MSIL.nuspec"

    IF ERRORLEVEL 1 (
      ECHO The "%ROOT%\NuGet\SQLite.Core.MSIL.nuspec" package could not be built.
      GOTO errors
    )
  )

  %__ECHO% "%NUGET%" pack -VerbatimVersion "%ROOT%\NuGet\SQLite.EF6.nuspec"

  IF ERRORLEVEL 1 (
    ECHO The "%ROOT%\NuGet\SQLite.EF6.nuspec" package could not be built.
    GOTO errors
  )

  %__ECHO% "%NUGET%" pack -VerbatimVersion "%ROOT%\NuGet\SQLite.Linq.nuspec"

  IF ERRORLEVEL 1 (
    ECHO The "%ROOT%\NuGet\SQLite.Linq.nuspec" package could not be built.
    GOTO errors
  )
)

IF NOT DEFINED NUGET_CORE_ONLY (
  IF NOT DEFINED NUGET_LEGACY_ONLY (
    %__ECHO% "%NUGET%" pack -VerbatimVersion "%ROOT%\NuGet\SQLite.MSIL.nuspec"

    IF ERRORLEVEL 1 (
      ECHO The "%ROOT%\NuGet\SQLite.MSIL.nuspec" package could not be built.
      GOTO errors
    )
  )

  IF NOT DEFINED NO_NUGET_LEGACY (
    %__ECHO% "%NUGET%" pack -VerbatimVersion "%ROOT%\NuGet\SQLite.x86.nuspec"

    IF ERRORLEVEL 1 (
      ECHO The "%ROOT%\NuGet\SQLite.x86.nuspec" package could not be built.
      GOTO errors
    )

    %__ECHO% "%NUGET%" pack -VerbatimVersion "%ROOT%\NuGet\SQLite.x64.nuspec"

    IF ERRORLEVEL 1 (
      ECHO The "%ROOT%\NuGet\SQLite.x64.nuspec" package could not be built.
      GOTO errors
    )
  )
)

%__ECHO% MOVE *.nupkg "%ROOT%\Setup\Output"

IF ERRORLEVEL 1 (
  ECHO Could not move "*.nupkg" to "%ROOT%\Setup\Output".
  GOTO errors
)

GOTO no_errors

:fn_UnsetVariable
  SETLOCAL
  SET VALUE=%1
  IF DEFINED VALUE (
    SET VALUE=
    ENDLOCAL
    SET %VALUE%=
  ) ELSE (
    ENDLOCAL
  )
  CALL :fn_ResetErrorLevel
  GOTO :EOF

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Build failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Build success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/clean.bat.



































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
@ECHO OFF

::
:: clean.bat --
::
:: Build Cleaning Tool
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

SET NULERR=2^>NUL
SET _CNULERR=2^^^>NUL
IF DEFINED __ECHO SET NULERR=2^^^>NUL

CALL :fn_UnsetVariable BREAK

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

SET SOURCE=%~dp0\..
SET SOURCE=%SOURCE:\\=\%

%_VECHO% Source = '%SOURCE%'

IF NOT DEFINED TEMP (
  ECHO The TEMP environment variable must be set first.
  GOTO usage
)

%_VECHO% Temp = '%TEMP%'

IF NOT EXIST "%TEMP%" (
  ECHO The TEMP directory, "%TEMP%", does not exist.
  GOTO usage
)

IF DEFINED CLEANDIRS GOTO skip_cleanDirs

SET CLEANDIRS=.vs bin obj Doc\Output Setup\Output
SET CLEANDIRS=%CLEANDIRS% SQLite.Designer\bin SQLite.Designer\obj
SET CLEANDIRS=%CLEANDIRS% SQLite.Interop\bin SQLite.Interop\obj
SET CLEANDIRS=%CLEANDIRS% System.Data.SQLite\bin System.Data.SQLite\obj
SET CLEANDIRS=%CLEANDIRS% System.Data.SQLite.Linq\bin System.Data.SQLite.Linq\obj
SET CLEANDIRS=%CLEANDIRS% test\bin test\obj testce\bin testce\obj testlinq\bin
SET CLEANDIRS=%CLEANDIRS% testlinq\obj tools\install\bin tools\install\obj

:skip_cleanDirs

%_VECHO% CleanDirs = '%CLEANDIRS%'

CALL :fn_ResetErrorLevel

%_AECHO%.

FOR %%D IN (%CLEANDIRS%) DO (
  IF EXIST "%SOURCE%\%%D" (
    %__ECHO% RMDIR /S /Q "%SOURCE%\%%D"

    IF ERRORLEVEL 1 (
      ECHO Could not remove directory "%SOURCE%\%%D".
      ECHO.
      GOTO errors
    ) ELSE (
      %_AECHO% Removed directory "%SOURCE%\%%D".
      %_AECHO%.
    )
  ) ELSE (
    %_AECHO% Directory "%SOURCE%\%%D" does not exist.
    %_AECHO%.
  )
)

IF EXIST "%SOURCE%\*.cache" (
  REM
  REM NOTE: *WARNING* Deleting from the entire source tree.
  REM
  %__ECHO% DEL /S /Q "%SOURCE%\*.cache"

  IF ERRORLEVEL 1 (
    ECHO Could not delete "%SOURCE%\*.cache".
    ECHO.
    GOTO errors
  ) ELSE (
    %_AECHO% Deleted "%SOURCE%\*.cache".
    %_AECHO%.
  )
) ELSE (
  %_AECHO% No files matching "%SOURCE%\*.cache" exist.
  %_AECHO%.
)

IF EXIST "%SOURCE%\*.ncb" (
  REM
  REM NOTE: *WARNING* Deleting from the entire source tree.
  REM
  %__ECHO% DEL /S /Q "%SOURCE%\*.ncb"

  IF ERRORLEVEL 1 (
    ECHO Could not delete "%SOURCE%\*.ncb".
    ECHO.
    GOTO errors
  ) ELSE (
    %_AECHO% Deleted "%SOURCE%\*.ncb".
    %_AECHO%.
  )
) ELSE (
  %_AECHO% No files matching "%SOURCE%\*.ncb" exist.
  %_AECHO%.
)

IF EXIST "%SOURCE%\*.psess" (
  %__ECHO% DEL /Q "%SOURCE%\*.psess"

  IF ERRORLEVEL 1 (
    ECHO Could not delete "%SOURCE%\*.psess".
    ECHO.
    GOTO errors
  ) ELSE (
    %_AECHO% Deleted "%SOURCE%\*.psess".
    %_AECHO%.
  )
) ELSE (
  %_AECHO% No files matching "%SOURCE%\*.psess" exist.
  %_AECHO%.
)

IF EXIST "%SOURCE%\*.sdf" (
  %__ECHO% DEL /Q "%SOURCE%\*.sdf"

  IF ERRORLEVEL 1 (
    ECHO Could not delete "%SOURCE%\*.sdf".
    ECHO.
    GOTO errors
  ) ELSE (
    %_AECHO% Deleted "%SOURCE%\*.sdf".
    %_AECHO%.
  )
) ELSE (
  %_AECHO% No files matching "%SOURCE%\*.sdf" exist.
  %_AECHO%.
)

IF EXIST "%SOURCE%\*.suo" (
  REM
  REM NOTE: *WARNING* Unhiding in the entire source tree.
  REM
  %__ECHO% ATTRIB -H "%SOURCE%\*.suo" /S

  IF ERRORLEVEL 1 (
    ECHO Could not make "%SOURCE%\*.suo" visible.
    ECHO.
    GOTO errors
  ) ELSE (
    %_AECHO% Made "%SOURCE%\*.suo" visible.
    %_AECHO%.
  )

  REM
  REM NOTE: *WARNING* Deleting from the entire source tree.
  REM
  %__ECHO% DEL /S /Q "%SOURCE%\*.suo"

  IF ERRORLEVEL 1 (
    ECHO Could not delete "%SOURCE%\*.suo".
    ECHO.
    GOTO errors
  ) ELSE (
    %_AECHO% Deleted "%SOURCE%\*.suo".
    %_AECHO%.
  )
) ELSE (
  %_AECHO% No files matching "%SOURCE%\*.suo" exist.
  %_AECHO%.
)

IF EXIST "%SOURCE%\*.vsp" (
  %__ECHO% DEL /Q "%SOURCE%\*.vsp"

  IF ERRORLEVEL 1 (
    ECHO Could not delete "%SOURCE%\*.vsp".
    ECHO.
    GOTO errors
  ) ELSE (
    %_AECHO% Deleted "%SOURCE%\*.vsp".
    %_AECHO%.
  )
) ELSE (
  %_AECHO% No files matching "%SOURCE%\*.vsp" exist.
  %_AECHO%.
)

IF EXIST "%SOURCE%\*.vsps" (
  %__ECHO% DEL /Q "%SOURCE%\*.vsps"

  IF ERRORLEVEL 1 (
    ECHO Could not delete "%SOURCE%\*.vsps".
    ECHO.
    GOTO errors
  ) ELSE (
    %_AECHO% Deleted "%SOURCE%\*.vsps".
    %_AECHO%.
  )
) ELSE (
  %_AECHO% No files matching "%SOURCE%\*.vsps" exist.
  %_AECHO%.
)

IF EXIST "%SOURCE%\*.nupkg" (
  %__ECHO% DEL /Q "%SOURCE%\*.nupkg"

  IF ERRORLEVEL 1 (
    ECHO Could not delete "%SOURCE%\*.nupkg".
    ECHO.
    GOTO errors
  ) ELSE (
    %_AECHO% Deleted "%SOURCE%\*.nupkg".
    %_AECHO%.
  )
) ELSE (
  %_AECHO% No files matching "%SOURCE%\*.nupkg" exist.
  %_AECHO%.
)

IF EXIST "%SOURCE%\Doc\SQLite.NET.chw" (
  %__ECHO% DEL /Q "%SOURCE%\Doc\SQLite.NET.chw"

  IF ERRORLEVEL 1 (
    ECHO Could not delete "%SOURCE%\Doc\SQLite.NET.chw".
    ECHO.
    GOTO errors
  ) ELSE (
    %_AECHO% Deleted "%SOURCE%\Doc\SQLite.NET.chw".
    %_AECHO%.
  )
) ELSE (
  %_AECHO% No files matching "%SOURCE%\Doc\SQLite.NET.chw" exist.
  %_AECHO%.
)

FOR %%D IN (net5 net6 netCore20 netCore30 netFramework40) DO (
  IF EXIST "%SOURCE%\Externals\Eagle\bin\%%D\EntityFramework.*" (
    %__ECHO% DEL /Q "%SOURCE%\Externals\Eagle\bin\%%D\EntityFramework.*"

    IF ERRORLEVEL 1 (
      ECHO Could not delete "%SOURCE%\Externals\Eagle\bin\%%D\EntityFramework.*".
      ECHO.
      GOTO errors
    ) ELSE (
      %_AECHO% Deleted "%SOURCE%\Externals\Eagle\bin\%%D\EntityFramework.*".
      %_AECHO%.
    )
  ) ELSE (
    %_AECHO% No files matching "%SOURCE%\Externals\Eagle\bin\%%D\EntityFramework.*" exist.
    %_AECHO%.
  )

  IF EXIST "%SOURCE%\Externals\Eagle\bin\%%D\sqlite3.*" (
    %__ECHO% DEL /Q "%SOURCE%\Externals\Eagle\bin\%%D\sqlite3.*"

    IF ERRORLEVEL 1 (
      ECHO Could not delete "%SOURCE%\Externals\Eagle\bin\%%D\sqlite3.*".
      ECHO.
      GOTO errors
    ) ELSE (
      %_AECHO% Deleted "%SOURCE%\Externals\Eagle\bin\%%D\sqlite3.*".
      %_AECHO%.
    )
  ) ELSE (
    %_AECHO% No files matching "%SOURCE%\Externals\Eagle\bin\%%D\sqlite3.*" exist.
    %_AECHO%.
  )

  IF EXIST "%SOURCE%\Externals\Eagle\bin\%%D\Win32\sqlite3.*" (
    %__ECHO% DEL /Q "%SOURCE%\Externals\Eagle\bin\%%D\Win32\sqlite3.*"

    IF ERRORLEVEL 1 (
      ECHO Could not delete "%SOURCE%\Externals\Eagle\bin\%%D\Win32\sqlite3.*".
      ECHO.
      GOTO errors
    ) ELSE (
      %_AECHO% Deleted "%SOURCE%\Externals\Eagle\bin\%%D\Win32\sqlite3.*".
      %_AECHO%.
    )
  ) ELSE (
    %_AECHO% No files matching "%SOURCE%\Externals\Eagle\bin\%%D\Win32\sqlite3.*" exist.
    %_AECHO%.
  )

  IF EXIST "%SOURCE%\Externals\Eagle\bin\%%D\x86\sqlite3.*" (
    %__ECHO% DEL /Q "%SOURCE%\Externals\Eagle\bin\%%D\x86\sqlite3.*"

    IF ERRORLEVEL 1 (
      ECHO Could not delete "%SOURCE%\Externals\Eagle\bin\%%D\x86\sqlite3.*".
      ECHO.
      GOTO errors
    ) ELSE (
      %_AECHO% Deleted "%SOURCE%\Externals\Eagle\bin\%%D\x86\sqlite3.*".
      %_AECHO%.
    )
  ) ELSE (
    %_AECHO% No files matching "%SOURCE%\Externals\Eagle\bin\%%D\x86\sqlite3.*" exist.
    %_AECHO%.
  )

  IF EXIST "%SOURCE%\Externals\Eagle\bin\%%D\x64\sqlite3.*" (
    %__ECHO% DEL /Q "%SOURCE%\Externals\Eagle\bin\%%D\x64\sqlite3.*"

    IF ERRORLEVEL 1 (
      ECHO Could not delete "%SOURCE%\Externals\Eagle\bin\%%D\x64\sqlite3.*".
      ECHO.
      GOTO errors
    ) ELSE (
      %_AECHO% Deleted "%SOURCE%\Externals\Eagle\bin\%%D\x64\sqlite3.*".
      %_AECHO%.
    )
  ) ELSE (
    %_AECHO% No files matching "%SOURCE%\Externals\Eagle\bin\%%D\x64\sqlite3.*" exist.
    %_AECHO%.
  )

  IF EXIST "%SOURCE%\Externals\Eagle\bin\%%D\SQLite.Interop.*" (
    %__ECHO% DEL /Q "%SOURCE%\Externals\Eagle\bin\%%D\SQLite.Interop.*"

    IF ERRORLEVEL 1 (
      ECHO Could not delete "%SOURCE%\Externals\Eagle\bin\%%D\SQLite.Interop.*".
      ECHO.
      GOTO errors
    ) ELSE (
      %_AECHO% Deleted "%SOURCE%\Externals\Eagle\bin\%%D\SQLite.Interop.*".
      %_AECHO%.
    )
  ) ELSE (
    %_AECHO% No files matching "%SOURCE%\Externals\Eagle\bin\%%D\SQLite.Interop.*" exist.
    %_AECHO%.
  )

  IF EXIST "%SOURCE%\Externals\Eagle\bin\%%D\Win32\SQLite.Interop.*" (
    %__ECHO% DEL /Q "%SOURCE%\Externals\Eagle\bin\%%D\Win32\SQLite.Interop.*"

    IF ERRORLEVEL 1 (
      ECHO Could not delete "%SOURCE%\Externals\Eagle\bin\%%D\Win32\SQLite.Interop.*".
      ECHO.
      GOTO errors
    ) ELSE (
      %_AECHO% Deleted "%SOURCE%\Externals\Eagle\bin\%%D\Win32\SQLite.Interop.*".
      %_AECHO%.
    )
  ) ELSE (
    %_AECHO% No files matching "%SOURCE%\Externals\Eagle\bin\%%D\Win32\SQLite.Interop.*" exist.
    %_AECHO%.
  )

  IF EXIST "%SOURCE%\Externals\Eagle\bin\%%D\x86\SQLite.Interop.*" (
    %__ECHO% DEL /Q "%SOURCE%\Externals\Eagle\bin\%%D\x86\SQLite.Interop.*"

    IF ERRORLEVEL 1 (
      ECHO Could not delete "%SOURCE%\Externals\Eagle\bin\%%D\x86\SQLite.Interop.*".
      ECHO.
      GOTO errors
    ) ELSE (
      %_AECHO% Deleted "%SOURCE%\Externals\Eagle\bin\%%D\x86\SQLite.Interop.*".
      %_AECHO%.
    )
  ) ELSE (
    %_AECHO% No files matching "%SOURCE%\Externals\Eagle\bin\%%D\x86\SQLite.Interop.*" exist.
    %_AECHO%.
  )

  IF EXIST "%SOURCE%\Externals\Eagle\bin\%%D\x64\SQLite.Interop.*" (
    %__ECHO% DEL /Q "%SOURCE%\Externals\Eagle\bin\%%D\x64\SQLite.Interop.*"

    IF ERRORLEVEL 1 (
      ECHO Could not delete "%SOURCE%\Externals\Eagle\bin\%%D\x64\SQLite.Interop.*".
      ECHO.
      GOTO errors
    ) ELSE (
      %_AECHO% Deleted "%SOURCE%\Externals\Eagle\bin\%%D\x64\SQLite.Interop.*".
      %_AECHO%.
    )
  ) ELSE (
    %_AECHO% No files matching "%SOURCE%\Externals\Eagle\bin\%%D\x64\SQLite.Interop.*" exist.
    %_AECHO%.
  )

  IF EXIST "%SOURCE%\Externals\Eagle\bin\%%D\System.Data.SQLite.*" (
    %__ECHO% DEL /Q "%SOURCE%\Externals\Eagle\bin\%%D\System.Data.SQLite.*"

    IF ERRORLEVEL 1 (
      ECHO Could not delete "%SOURCE%\Externals\Eagle\bin\%%D\System.Data.SQLite.*".
      ECHO.
      GOTO errors
    ) ELSE (
      %_AECHO% Deleted "%SOURCE%\Externals\Eagle\bin\%%D\System.Data.SQLite.*".
      %_AECHO%.
    )
  ) ELSE (
    %_AECHO% No files matching "%SOURCE%\Externals\Eagle\bin\%%D\System.Data.SQLite.*" exist.
    %_AECHO%.
  )

  IF EXIST "%SOURCE%\Externals\Eagle\bin\%%D\System.Data.SQLite.Linq.*" (
    %__ECHO% DEL /Q "%SOURCE%\Externals\Eagle\bin\%%D\System.Data.SQLite.Linq.*"

    IF ERRORLEVEL 1 (
      ECHO Could not delete "%SOURCE%\Externals\Eagle\bin\%%D\System.Data.SQLite.Linq.*".
      ECHO.
      GOTO errors
    ) ELSE (
      %_AECHO% Deleted "%SOURCE%\Externals\Eagle\bin\%%D\System.Data.SQLite.Linq.*".
      %_AECHO%.
    )
  ) ELSE (
    %_AECHO% No files matching "%SOURCE%\Externals\Eagle\bin\%%D\System.Data.SQLite.Linq.*" exist.
    %_AECHO%.
  )

  IF EXIST "%SOURCE%\Externals\Eagle\bin\%%D\System.Data.SQLite.EF6.*" (
    %__ECHO% DEL /Q "%SOURCE%\Externals\Eagle\bin\%%D\System.Data.SQLite.EF6.*"

    IF ERRORLEVEL 1 (
      ECHO Could not delete "%SOURCE%\Externals\Eagle\bin\%%D\System.Data.SQLite.EF6.*".
      ECHO.
      GOTO errors
    ) ELSE (
      %_AECHO% Deleted "%SOURCE%\Externals\Eagle\bin\%%D\System.Data.SQLite.EF6.*".
      %_AECHO%.
    )
  ) ELSE (
    %_AECHO% No files matching "%SOURCE%\Externals\Eagle\bin\%%D\System.Data.SQLite.EF6.*" exist.
    %_AECHO%.
  )
)

IF DEFINED NOLKG GOTO clean_allTestLogs
IF NOT DEFINED LKG GOTO clean_allTestLogs

SET SRCLKGDIR=%SOURCE%\Externals\Eagle\bin\netFramework40
SET SRCLKGDIR=%SRCLKGDIR:\\=\%

%_VECHO% SrcLkgDir = '%SRCLKGDIR%'

IF NOT EXIST "%SRCLKGDIR%\EagleShell.exe" (
  ECHO The file "%SRCLKGDIR%\EagleShell.exe" does not exist.
  GOTO usage
)

%__ECHO% "%SRCLKGDIR%\EagleShell.exe" /? > NUL 2>&1

IF ERRORLEVEL 1 (
  ECHO The "%SRCLKGDIR%\EagleShell.exe" tool appears to be missing.
  GOTO usage
)

%_AECHO% Using LKG "EagleShell.exe" tool from "%SRCLKGDIR%"...

CALL :fn_AppendToPath SRCLKGDIR

%_VECHO% Path = '%PATH%'

REM
REM BUGFIX: Do not attempt to delete a log file that is currently in use by
REM         a running test suite as that can cause spurious failures of the
REM         test suite due to a missing test log start sentry.
REM
SETLOCAL EnableDelayedExpansion
FOR %%E IN (%TESTEXEFILES%) DO (
  SET PATTERN=%%E
  SET PATTERN=!PATTERN:__=*!

  FOR /F "delims=" %%F IN ('DIR /B /S "%TEMP%\!PATTERN!.test.*.log" 2^> NUL') DO (
    CALL :fn_UnsetVariable SHOULD_DELETE_FILE

    CALL :fn_CheckTestLogFile "!PATTERN!" "%%F"
    IF ERRORLEVEL 1 GOTO errors

    IF DEFINED SHOULD_DELETE_FILE (
      %__ECHO% DEL /Q "%%F"

      IF ERRORLEVEL 1 (
        ECHO Could not delete "%%F".
        ECHO.
        GOTO errors
      ) ELSE (
        %_AECHO% Deleted "%%F".
        %_AECHO%.
      )

      %__ECHO% RMDIR "%%~dpF" %NULERR%

      IF ERRORLEVEL 1 (
        ECHO WARNING: Could not remove "%%~dpF".
        ECHO.
      ) ELSE (
        %_AECHO% Removed "%%~dpF".
        %_AECHO%.
      )
    ) ELSE (
      %_AECHO% Skipping "%%F", in use by active test suite.
      %_AECHO%.
    )
  )
)
ENDLOCAL

IF EXIST "%TEMP%\logs" (
  %__ECHO% RMDIR "%TEMP%\logs" %NULERR%

  IF ERRORLEVEL 1 (
    ECHO WARNING: Could not remove "%TEMP%\logs".
    ECHO.
  ) ELSE (
    %_AECHO% Removed "%TEMP%\logs".
    %_AECHO%.
  )
)

GOTO skip_allTestLogs

:clean_allTestLogs

IF NOT DEFINED NOTESTLOGS (
  IF EXIST "%TEMP%\dotnet.exe.test.*.log" (
    %__ECHO% DEL /S /Q "%TEMP%\dotnet.exe.test.*.log"

    IF ERRORLEVEL 1 (
      ECHO Could not delete "%TEMP%\dotnet.exe.test.*.log".
      ECHO.
      GOTO errors
    ) ELSE (
      %_AECHO% Deleted "%TEMP%\dotnet.exe.test.*.log".
      %_AECHO%.
    )
  ) ELSE (
    %_AECHO% No files matching "%TEMP%\dotnet.exe.test.*.log" exist.
    %_AECHO%.
  )
) ELSE (
  %_AECHO% Skipped deleting "%TEMP%\dotnet.exe.test.*.log".
  %_AECHO%.
)

IF NOT DEFINED NOTESTLOGS (
  IF EXIST "%TEMP%\EagleShell.dll.test.*.log" (
    %__ECHO% DEL /S /Q "%TEMP%\EagleShell.dll.test.*.log"

    IF ERRORLEVEL 1 (
      ECHO Could not delete "%TEMP%\EagleShell.dll.test.*.log".
      ECHO.
      GOTO errors
    ) ELSE (
      %_AECHO% Deleted "%TEMP%\EagleShell.dll.test.*.log".
      %_AECHO%.
    )
  ) ELSE (
    %_AECHO% No files matching "%TEMP%\EagleShell.dll.test.*.log" exist.
    %_AECHO%.
  )
) ELSE (
  %_AECHO% Skipped deleting "%TEMP%\EagleShell.dll.test.*.log".
  %_AECHO%.
)

IF NOT DEFINED NOTESTLOGS (
  IF EXIST "%TEMP%\EagleShell.exe.test.*.log" (
    %__ECHO% DEL /S /Q "%TEMP%\EagleShell.exe.test.*.log"

    IF ERRORLEVEL 1 (
      ECHO Could not delete "%TEMP%\EagleShell.exe.test.*.log".
      ECHO.
      GOTO errors
    ) ELSE (
      %_AECHO% Deleted "%TEMP%\EagleShell.exe.test.*.log".
      %_AECHO%.
    )
  ) ELSE (
    %_AECHO% No files matching "%TEMP%\EagleShell.exe.test.*.log" exist.
    %_AECHO%.
  )
) ELSE (
  %_AECHO% Skipped deleting "%TEMP%\EagleShell.exe.test.*.log".
  %_AECHO%.
)

IF NOT DEFINED NOTESTLOGS (
  IF EXIST "%TEMP%\EagleShell32.exe.test.*.log" (
    %__ECHO% DEL /S /Q "%TEMP%\EagleShell32.exe.test.*.log"

    IF ERRORLEVEL 1 (
      ECHO Could not delete "%TEMP%\EagleShell32.exe.test.*.log".
      ECHO.
      GOTO errors
    ) ELSE (
      %_AECHO% Deleted "%TEMP%\EagleShell32.exe.test.*.log".
      %_AECHO%.
    )
  ) ELSE (
    %_AECHO% No files matching "%TEMP%\EagleShell32.exe.test.*.log" exist.
    %_AECHO%.
  )
) ELSE (
  %_AECHO% Skipped deleting "%TEMP%\EagleShell32.exe.test.*.log".
  %_AECHO%.
)

IF NOT DEFINED NOTESTLOGS (
  IF EXIST "%TEMP%\mono.exe.test.*.log" (
    %__ECHO% DEL /S /Q "%TEMP%\mono.exe.test.*.log"

    IF ERRORLEVEL 1 (
      ECHO Could not delete "%TEMP%\mono.exe.test.*.log".
      ECHO.
      GOTO errors
    ) ELSE (
      %_AECHO% Deleted "%TEMP%\mono.exe.test.*.log".
      %_AECHO%.
    )
  ) ELSE (
    %_AECHO% No files matching "%TEMP%\mono.exe.test.*.log" exist.
    %_AECHO%.
  )
) ELSE (
  %_AECHO% Skipped deleting "%TEMP%\mono.exe.test.*.log".
  %_AECHO%.
)

IF NOT DEFINED NOTESTLOGS (
  IF EXIST "%TEMP%\tclsh*.exe.test.*.log" (
    %__ECHO% DEL /S /Q "%TEMP%\tclsh*.exe.test.*.log"

    IF ERRORLEVEL 1 (
      ECHO Could not delete "%TEMP%\tclsh*.exe.test.*.log".
      ECHO.
      GOTO errors
    ) ELSE (
      %_AECHO% Deleted "%TEMP%\tclsh*.exe.test.*.log".
      %_AECHO%.
    )
  ) ELSE (
    %_AECHO% No files matching "%TEMP%\tclsh*.exe.test.*.log" exist.
    %_AECHO%.
  )
) ELSE (
  %_AECHO% Skipped deleting "%TEMP%\tclsh*.exe.test.*.log".
  %_AECHO%.
)

:skip_allTestLogs

GOTO no_errors

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:fn_AppendToPath
  IF NOT DEFINED %1 GOTO :EOF
  SETLOCAL
  SET __ECHO_CMD=ECHO %%%1%%
  FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
    SET VALUE=%%V
  )
  SET VALUE=%VALUE:"=%
  REM "
  ENDLOCAL && SET PATH=%PATH%;%VALUE%
  GOTO :EOF

:fn_UnsetVariable
  SETLOCAL
  SET VALUE=%1
  IF DEFINED VALUE (
    SET VALUE=
    ENDLOCAL
    SET %VALUE%=
  ) ELSE (
    ENDLOCAL
  )
  CALL :fn_ResetErrorLevel
  GOTO :EOF

:fn_UnquoteVariable
  IF NOT DEFINED %1 GOTO :EOF
  SETLOCAL
  SET __ECHO_CMD=ECHO %%%1%%
  FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
    SET VALUE=%%V
  )
  SET VALUE=%VALUE:"=%
  REM "
  ENDLOCAL && SET %1=%VALUE%
  GOTO :EOF

:fn_CheckTestLogFile
  SET EXEFILENAME=%1
  IF NOT DEFINED EXEFILENAME (
    ECHO Cannot check log file, missing EXE file name.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  SET LOGFILENAME=%2
  IF NOT DEFINED LOGFILENAME (
    ECHO Cannot check log file, missing LOG file name.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  CALL :fn_UnquoteVariable EXEFILENAME
  CALL :fn_UnquoteVariable LOGFILENAME
  SET CHECK_TESTLOGFILE_CMD=EagleShell.exe -evaluate "package require Eagle.Test; checkActiveTestLogFile {%EXEFILENAME%} {%LOGFILENAME%}"
  IF NOT DEFINED __ECHO GOTO exec_checkTestLogFileCmd
  %__ECHO% %CHECK_TESTLOGFILE_CMD%
  GOTO :EOF
  :exec_checkTestLogFileCmd
  IF EXIST fn_CheckTestLogFile.err DEL /Q fn_CheckTestLogFile.err
  %_CECHO% %CHECK_TESTLOGFILE_CMD%
  FOR /F %%T IN ('%CHECK_TESTLOGFILE_CMD% ^|^| ECHO 1 ^>^> fn_CheckTestLogFile.err') DO (
    SET SHOULD_DELETE_FILE=%%T
  )
  IF EXIST fn_CheckTestLogFile.err (
    DEL /Q fn_CheckTestLogFile.err
    ECHO Failed to check log file.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  ECHO.
  ECHO The TEMP environment variable must be set to the full path of the existing
  ECHO directory used to store temporary files.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Clean failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Clean success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/compile-interop-assembly-debug.sh.



















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash

scriptdir=`dirname "$BASH_SOURCE"`
extradefs="$@"

if [[ "$OSTYPE" == "darwin"* ]]; then
  libname=libSQLite.Interop.dylib
  # NOTE: No longer works in 10.14+
  # gccflags="-arch i386 -arch x86_64"
  gccflags="-arch x86_64"
else
  libname=libSQLite.Interop.so
  gccflags=""
fi

if [[ -z "$SQLITE_NET_YEAR" ]]; then
  SQLITE_NET_YEAR=2013
fi

pushd "$scriptdir/../SQLite.Interop/src/generic"
gcc -g -fPIC -shared $gccflags -o $libname interop.c -I../core -DSQLITE_THREADSAFE=1 -DSQLITE_USE_URI=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_STAT4=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_LOAD_EXTENSION=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_SOUNDEX=1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 -DSQLITE_ENABLE_API_ARMOR=1 -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_ENABLE_STMTVTAB=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 -DSQLITE_DEBUG=1 -DSQLITE_MEMDEBUG=1 -DSQLITE_ENABLE_EXPENSIVE_ASSERT=1 -DINTEROP_LOG=1 -DINTEROP_TEST_EXTENSION=1 -DINTEROP_EXTENSION_FUNCTIONS=1 -DINTEROP_VIRTUAL_TABLE=1 -DINTEROP_FTS5_EXTENSION=1 -DINTEROP_PERCENTILE_EXTENSION=1 -DINTEROP_TOTYPE_EXTENSION=1 -DINTEROP_REGEXP_EXTENSION=1 -DINTEROP_JSON1_EXTENSION=1 -DINTEROP_SHA1_EXTENSION=1 -DINTEROP_SHA3_EXTENSION=1 -DINTEROP_SESSION_EXTENSION=1 $extradefs -lm -lpthread -ldl
mkdir -p ../../../bin/$SQLITE_NET_YEAR/Debug$SQLITE_NET_CONFIGURATION_SUFFIX/bin
cp $libname ../../../bin/$SQLITE_NET_YEAR/Debug$SQLITE_NET_CONFIGURATION_SUFFIX/bin/SQLite.Interop.dll
mv $libname ../../../bin/$SQLITE_NET_YEAR/Debug$SQLITE_NET_CONFIGURATION_SUFFIX/bin
popd

Added Setup/compile-interop-assembly-release.sh.



















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash

scriptdir=`dirname "$BASH_SOURCE"`
extradefs="$@"

if [[ "$OSTYPE" == "darwin"* ]]; then
  libname=libSQLite.Interop.dylib
  # NOTE: No longer works in 10.14+
  # gccflags="-arch i386 -arch x86_64"
  gccflags="-arch x86_64"
else
  libname=libSQLite.Interop.so
  gccflags=""
fi

if [[ -z "$SQLITE_NET_YEAR" ]]; then
  SQLITE_NET_YEAR=2013
fi

pushd "$scriptdir/../SQLite.Interop/src/generic"
gcc -g -fPIC -shared $gccflags -o $libname interop.c -I../core -DSQLITE_THREADSAFE=1 -DSQLITE_USE_URI=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_STAT4=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_LOAD_EXTENSION=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_SOUNDEX=1 -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 -DSQLITE_ENABLE_API_ARMOR=1 -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_ENABLE_STMTVTAB=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 -DINTEROP_TEST_EXTENSION=1 -DINTEROP_EXTENSION_FUNCTIONS=1 -DINTEROP_VIRTUAL_TABLE=1 -DINTEROP_FTS5_EXTENSION=1 -DINTEROP_PERCENTILE_EXTENSION=1 -DINTEROP_TOTYPE_EXTENSION=1 -DINTEROP_REGEXP_EXTENSION=1 -DINTEROP_JSON1_EXTENSION=1 -DINTEROP_SHA1_EXTENSION=1 -DINTEROP_SHA3_EXTENSION=1 -DINTEROP_SESSION_EXTENSION=1 $extradefs -lm -lpthread -ldl
mkdir -p ../../../bin/$SQLITE_NET_YEAR/Release$SQLITE_NET_CONFIGURATION_SUFFIX/bin
cp $libname ../../../bin/$SQLITE_NET_YEAR/Release$SQLITE_NET_CONFIGURATION_SUFFIX/bin/SQLite.Interop.dll
mv $libname ../../../bin/$SQLITE_NET_YEAR/Release$SQLITE_NET_CONFIGURATION_SUFFIX/bin
popd

Added Setup/data/CheckForNetFx.pas.













































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
{
  CheckForNetFx.iss --

  Written by Joe Mistachkin.
  Released to the public domain, use at your own risk!
}

var
  IsNetFx2Setup : Boolean;
  IsNetFx4Setup : Boolean;

  NetFxSubKeyName: String;
  NetFxInstallRoot: String;
  NetFxSetupSubKeyName: String;
  NetFxIsInstalled: String;

  NetFx2Version: String;
  NetFx2SetupVersion: String;
  NetFx2HasServicePack: String;
  NetFx2ServicePack: Integer;
  NetFx2ErrorMessage: String;

  NetFx35SetupVersion: String;
  NetFx35HasServicePack: String;
  NetFx35ServicePack: Integer;
  NetFx35ErrorMessage: String;

  NetFx4Version: String;
  NetFx4SetupVersion: String;
  NetFx4HasServicePack: String;
  NetFx4ServicePack: Integer;
  NetFx4ErrorMessage: String;

  VcRuntimeRedistributable: String;

function TrimSlash(const Path: String): String;
var
  LastCharacter: String;
begin
  Result := Path;

  if Result <> '' then
  begin
    LastCharacter := Copy(Result, Length(Result), 1);

    if (LastCharacter = '\') or (LastCharacter = '/') then
    begin
      Result := Copy(Result, 1, Length(Result) - 1);
    end;
  end;
end;

function CheckForNetFx2(const NeedServicePack: Integer): Boolean;
var
  SubKeyName: String;
  IsInstalled: Cardinal;
  HasServicePack: Cardinal;
begin
  Result := False;

  SubKeyName := NetFxSetupSubKeyName + '\' + NetFx2SetupVersion;

  if RegQueryDWordValue(HKEY_LOCAL_MACHINE, SubKeyName, NetFxIsInstalled,
      IsInstalled) then
  begin
    if IsInstalled <> 0 then
    begin
      if RegQueryDWordValue(HKEY_LOCAL_MACHINE, SubKeyName,
          NetFx2HasServicePack, HasServicePack) then
      begin
        if HasServicePack >= NeedServicePack then
        begin
          Result := True;
        end;
      end;
    end;
  end;
end;

function CheckForNetFx35(const NeedServicePack: Integer): Boolean;
var
  SubKeyName: String;
  IsInstalled: Cardinal;
  HasServicePack: Cardinal;
begin
  Result := False;

  SubKeyName := NetFxSetupSubKeyName + '\' + NetFx35SetupVersion;

  if RegQueryDWordValue(HKEY_LOCAL_MACHINE, SubKeyName, NetFxIsInstalled,
      IsInstalled) then
  begin
    if IsInstalled <> 0 then
    begin
      if RegQueryDWordValue(HKEY_LOCAL_MACHINE, SubKeyName,
          NetFx35HasServicePack, HasServicePack) then
      begin
        if HasServicePack >= NeedServicePack then
        begin
          Result := True;
        end;
      end;
    end;
  end;
end;

function CheckForNetFx4(const NeedServicePack: Integer): Boolean;
var
  SubKeyName: String;
  IsInstalled: Cardinal;
  HasServicePack: Cardinal;
begin
  Result := False;

  SubKeyName := NetFxSetupSubKeyName + '\' + NetFx4SetupVersion;

  if RegQueryDWordValue(HKEY_LOCAL_MACHINE, SubKeyName, NetFxIsInstalled,
      IsInstalled) then
  begin
    if IsInstalled <> 0 then
    begin
      if RegQueryDWordValue(HKEY_LOCAL_MACHINE, SubKeyName,
          NetFx4HasServicePack, HasServicePack) then
      begin
        if HasServicePack >= NeedServicePack then
        begin
          Result := True;
        end;
      end;
    end;
  end;
end;

function GetNetFx2InstallRoot(const FileName: String): String;
var
  InstallRoot: String;
begin
  Result := '';

  if RegQueryStringValue(HKEY_LOCAL_MACHINE, NetFxSubKeyName,
      NetFxInstallRoot, InstallRoot) then
  begin
    if InstallRoot <> '' then
    begin
      Result := TrimSlash(InstallRoot) + '\' + NetFx2Version;

      if FileName <> '' then
      begin
        Result := TrimSlash(Result) + '\' + FileName;
      end;
    end;
  end;
end;

function GetNetFx4InstallRoot(const FileName: String): String;
var
  InstallRoot: String;
begin
  Result := '';

  if RegQueryStringValue(HKEY_LOCAL_MACHINE, NetFxSubKeyName,
      NetFxInstallRoot, InstallRoot) then
  begin
    if InstallRoot <> '' then
    begin
      Result := TrimSlash(InstallRoot) + '\' + NetFx4Version;

      if FileName <> '' then
      begin
        Result := TrimSlash(Result) + '\' + FileName;
      end;
    end;
  end;
end;

function CheckIsNetFx2Setup(): Boolean;
begin
  Result := IsNetFx2Setup;
end;

function CheckIsNetFx4Setup(): Boolean;
begin
  Result := IsNetFx4Setup;
end;

function ExtractAndInstallVcRuntime(var ResultCode: Integer): Boolean;
begin
  ExtractTemporaryFile(VcRuntimeRedistributable);

  if Exec(ExpandConstant(
      '{tmp}\' + VcRuntimeRedistributable),
      '/q', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
  begin
    Result := True;
  end
  else begin
    Result := False;
  end;
end;

function NetFxInitializeSetup(): Boolean;
var
  ResultCode: Integer;
begin
  IsNetFx2Setup := {#IsNetFx2};
  IsNetFx4Setup := not IsNetFx2Setup;

  NetFxSubKeyName := 'Software\Microsoft\.NETFramework';
  NetFxInstallRoot := 'InstallRoot';
  NetFxSetupSubKeyName := 'Software\Microsoft\NET Framework Setup\NDP';
  NetFxIsInstalled := 'Install';

  NetFx2Version := 'v2.0.50727';
  NetFx2SetupVersion := 'v2.0.50727';
  NetFx2HasServicePack := 'SP';
  NetFx2ServicePack := 2;
  NetFx2ErrorMessage := 'The Microsoft .NET Framework v2.0 with Service Pack '
      + IntToStr(NetFx2ServicePack) + ' or higher is required.';

  NetFx35SetupVersion := 'v3.5';
  NetFx35HasServicePack := 'SP';
  NetFx35ServicePack := 1;
  NetFx35ErrorMessage := 'The Microsoft .NET Framework v3.5 with Service Pack '
      + IntToStr(NetFx35ServicePack) + ' or higher is required for LINQ support.';

  NetFx4Version := 'v4.0.30319';
  NetFx4SetupVersion := 'v4\Full';
  NetFx4HasServicePack := 'Servicing';
  NetFx4ServicePack := 0;
  NetFx4ErrorMessage := 'The Microsoft .NET Framework v4.0 with Service Pack '
      + IntToStr(NetFx4ServicePack) + ' or higher is required.';

  VcRuntimeRedistributable := 'vcredist_{#AppProcessor}_{#VcRuntime}.exe';

  if IsNetFx2Setup then
  begin
    Result := CheckForNetFx2(NetFx2ServicePack);

    if not Result then
    begin
      MsgBox(NetFx2ErrorMessage, mbError, MB_OK);
    end;

    if Result and not CheckForNetFx35(NetFx35ServicePack) then
    begin
      MsgBox(NetFx35ErrorMessage, mbInformation, MB_OK);
    end;
  end;

  if IsNetFx4Setup then
  begin
    Result := CheckForNetFx4(NetFx4ServicePack);

    if not Result then
    begin
      MsgBox(NetFx4ErrorMessage, mbError, MB_OK);
    end;
  end;

  if Result then
  begin
    Result := ExtractAndInstallVcRuntime(ResultCode);

    if not Result or ((ResultCode <> 0) and (ResultCode <> 1638)
        and (ResultCode <> 3010) and (ResultCode <> 5100)) then
    begin
      MsgBox('Failed to install Microsoft Visual C++ Runtime: ' +
          VcRuntimeRedistributable + ', ' + SysErrorMessage(ResultCode),
          mbError, MB_OK);

      if Result then
      begin
        Result := False;
      end;
    end;
  end;
end;


Added Setup/data/InitializeSetup.pas.

























>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
{
  InitializeSetup.iss --

  Written by Joe Mistachkin.
  Released to the public domain, use at your own risk!
}

function InitializeSetup(): Boolean;
begin
  Result := NetFxInitializeSetup();
end;


Added Setup/data/SQLite.iss.

















































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
;
; SQLite.iss --
;
; Written by Joe Mistachkin.
; Released to the public domain, use at your own risk!
;

#define BaseConfiguration StringChange(AppConfiguration, "NativeOnly", "")
#define GacProcessor StringChange(AppProcessor, "x64", "amd64")

#if Pos("NativeOnly", AppConfiguration) == 0
#define InstallerCondition "Application\Core\MSIL and Application\Designer and Application\Designer\Installer"
#define AppVersion GetStringFileInfo("..\..\bin\" + Year + "\" + AppPlatform + "\" + AppConfiguration + "\System.Data.SQLite.dll", PRODUCT_VERSION)
#define OutputConfiguration StringChange(StringChange(AppConfiguration, "Debug", "setup-debug"), "Release", "setup") + "-bundle"
#else
#define InstallerCondition "Application\Core\MSIL and Application\Core\" + AppProcessor + " and Application\Designer and Application\Designer\Installer"
#define AppVersion GetStringFileInfo("..\..\bin\" + Year + "\" + BaseConfiguration + "\bin\System.Data.SQLite.dll", PRODUCT_VERSION)
#define OutputConfiguration StringChange(StringChange(BaseConfiguration, "Debug", "setup-debug"), "Release", "setup")
#endif

[Setup]
AllowNoIcons=true

#if AppProcessor != "x86"
ArchitecturesAllowed={#AppProcessor}
ArchitecturesInstallIn64BitMode={#AppProcessor}
#endif

AlwaysShowComponentsList=false
AppCopyright=Public Domain
AppID={#AppId}
AppName=System.Data.SQLite
AppPublisher=System.Data.SQLite Team
AppPublisherURL={#AppURL}
AppSupportURL={#AppURL}
AppUpdatesURL={#AppURL}
AppVerName=System.Data.SQLite v{#AppVersion} ({#AppConfiguration})
AppVersion={#AppVersion}
AppComments=The ADO.NET adapter for the SQLite database engine.
AppReadmeFile={app}\readme.htm
DefaultDirName={pf}\System.Data.SQLite\{#Year}
DefaultGroupName=System.Data.SQLite\{#Year}
OutputDir=..\Output
OutputBaseFilename=sqlite-{#Framework}-{#OutputConfiguration}-{#AppProcessor}-{#Year}-{#AppVersion}
OutputManifestFile=sqlite-{#Framework}-{#OutputConfiguration}-{#AppProcessor}-{#Year}-{#AppVersion}-manifest.txt
SetupLogging=true
UninstallFilesDir={app}\uninstall
VersionInfoVersion={#AppVersion}
ExtraDiskSpaceRequired=2097152
ChangesEnvironment=true

[Code]
#include "CheckForNetFx.pas"
#include "InitializeSetup.pas"

[Components]
Name: Application; Description: System.Data.SQLite components.; Types: custom compact full
Name: Application\Core; Description: Core components.; Types: custom compact full
Name: Application\Core\MSIL; Description: Core managed components.; Types: custom compact full
Name: Application\Core\{#AppProcessor}; Description: Core native {#AppProcessor} components.; Types: custom compact full

#if Year != "2005"
Name: Application\LINQ; Description: LINQ support components.; Types: custom compact full
#endif

#if Year != "2005" && Year != "2008"
Name: Application\EF6; Description: Entity Framework 6 support components.; Types: custom compact full
#endif

Name: Application\Designer; Description: Visual Studio designer components.; Types: custom full
Name: Application\Designer\Installer; Description: Visual Studio designer installer components.; Types: custom full
Name: Application\Symbols; Description: Debugging symbol components.; Types: custom compact full
Name: Application\Documentation; Description: Documentation components.; Types: custom compact full
Name: Application\Test; Description: Test components.; Types: custom compact full

[Tasks]
#if Year == "2005"
Components: Application\Core\MSIL; Name: ngen; Description: Generate native images for the assemblies and install them into the native image cache.; Check: CheckIsNetFx2Setup() or CheckIsNetFx4Setup()
#elif Year == "2008"
Components: Application\Core\MSIL Or Application\LINQ; Name: ngen; Description: Generate native images for the assemblies and install them into the native image cache.; Check: CheckIsNetFx2Setup() or CheckIsNetFx4Setup()
#else
Components: Application\Core\MSIL Or Application\LINQ Or Application\EF6; Name: ngen; Description: Generate native images for the assemblies and install them into the native image cache.; Check: CheckIsNetFx4Setup()
#endif

#if Pos("NativeOnly", AppConfiguration) == 0
#if Year == "2005"
Components: Application\Core\MSIL; Name: gac; Description: Install the assemblies into the global assembly cache.; Flags: unchecked; Check: CheckIsNetFx2Setup() or CheckIsNetFx4Setup()
#elif Year == "2008"
Components: Application\Core\MSIL Or Application\LINQ; Name: gac; Description: Install the assemblies into the global assembly cache.; Flags: unchecked; Check: CheckIsNetFx2Setup() or CheckIsNetFx4Setup()
#else
Components: Application\Core\MSIL Or Application\LINQ Or Application\EF6; Name: gac; Description: Install the assemblies into the global assembly cache.; Flags: unchecked; Check: CheckIsNetFx4Setup()
#endif

#if AppProcessor == "x86"
#if Year == "2005"
Components: {#InstallerCondition}; Name: gac\vs2005; Description: Install the designer components for Visual Studio 2005.; Flags: unchecked; Check: CheckIsNetFx2Setup()
#endif
#if Year == "2008"
Components: {#InstallerCondition}; Name: gac\vs2008; Description: Install the designer components for Visual Studio 2008.; Flags: unchecked; Check: CheckIsNetFx2Setup()
#endif
#if Year == "2010"
Components: {#InstallerCondition}; Name: gac\vs2010; Description: Install the designer components for Visual Studio 2010.; Flags: unchecked; Check: CheckIsNetFx4Setup()
#endif
#if Year == "2012"
Components: {#InstallerCondition}; Name: gac\vs2012; Description: Install the designer components for Visual Studio 2012.; Flags: unchecked; Check: CheckIsNetFx4Setup()
#endif
#if Year == "2013"
Components: {#InstallerCondition}; Name: gac\vs2013; Description: Install the designer components for Visual Studio 2013.; Flags: unchecked; Check: CheckIsNetFx4Setup()
#endif
#if Year == "2015"
Components: {#InstallerCondition}; Name: gac\vs2015; Description: Install the designer components for Visual Studio 2015.; Flags: unchecked; Check: CheckIsNetFx4Setup()
#endif
#endif
#endif

[Run]
Components: Application\Core\MSIL; Tasks: ngen; Filename: {code:GetNetFx2InstallRoot|Ngen.exe}; Parameters: "install ""{app}\bin\System.Data.SQLite.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup()
Components: Application\Core\MSIL; Tasks: ngen; Filename: {code:GetNetFx4InstallRoot|Ngen.exe}; Parameters: "install ""{app}\bin\System.Data.SQLite.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()

#if Year != "2005"
Components: Application\LINQ; Tasks: ngen; Filename: {code:GetNetFx2InstallRoot|Ngen.exe}; Parameters: "install ""{app}\bin\System.Data.SQLite.Linq.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup() and CheckForNetFx35(1)
Components: Application\LINQ; Tasks: ngen; Filename: {code:GetNetFx4InstallRoot|Ngen.exe}; Parameters: "install ""{app}\bin\System.Data.SQLite.Linq.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
#endif

#if Year != "2005" && Year != "2008"
Components: Application\EF6; Tasks: ngen; Filename: {code:GetNetFx4InstallRoot|Ngen.exe}; Parameters: "install ""{app}\bin\System.Data.SQLite.EF6.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
#endif

#if Pos("NativeOnly", AppConfiguration) == 0 && AppProcessor == "x86"
#if Year == "2005"
Components: {#InstallerCondition}; Tasks: gac\vs2005; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2008 true -noVs2010 true -noVs2012 true -noVs2013 true -noVs2015 true -noVs2017 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup()
#endif
#if Year == "2008"
Components: {#InstallerCondition}; Tasks: gac\vs2008; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true -noVs2010 true -noVs2012 true -noVs2013 true -noVs2015 true -noVs2017 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup()
#endif
#if Year == "2010"
Components: {#InstallerCondition}; Tasks: gac\vs2010; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true -noVs2008 true -noVs2012 true -noVs2013 true -noVs2015 true -noVs2017 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
#endif
#if Year == "2012"
Components: {#InstallerCondition}; Tasks: gac\vs2012; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2013 true -noVs2015 true -noVs2017 true -configVersion 4.0.30319 -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
Components: {#InstallerCondition}; Tasks: gac\vs2012; Filename: {app}\bin\Installer.exe; Parameters: "-perUser true -install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2013 true -noVs2015 true -noVs2017 true -configVersion 4.0.30319 -vsVersionSuffix _Config -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
#endif
#if Year == "2013"
Components: {#InstallerCondition}; Tasks: gac\vs2013; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2012 true -noVs2015 true -noVs2017 true -configVersion 4.0.30319 -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
#endif
#if Year == "2015"
Components: {#InstallerCondition}; Tasks: gac\vs2015; Filename: {app}\bin\Installer.exe; Parameters: "-install true -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx461 true -noNetFx462 true -noNetFx47 true -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2012 true -noVs2013 true -noVs2017 true -configVersion 4.0.30319 -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
#endif
#endif

[UninstallRun]
#if Pos("NativeOnly", AppConfiguration) == 0 && AppProcessor == "x86"
#if Year == "2015"
Components: {#InstallerCondition}; Tasks: gac\vs2015; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx461 true -noNetFx462 true -noNetFx47 true -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2012 true -noVs2013 true -noVs2017 true -configVersion 4.0.30319 -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
#endif
#if Year == "2013"
Components: {#InstallerCondition}; Tasks: gac\vs2013; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2012 true -noVs2015 true -noVs2017 true -configVersion 4.0.30319 -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
#endif
#if Year == "2012"
Components: {#InstallerCondition}; Tasks: gac\vs2012; Filename: {app}\bin\Installer.exe; Parameters: "-perUser true -install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2013 true -noVs2015 true -noVs2017 true -configVersion 4.0.30319 -vsVersionSuffix _Config -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
Components: {#InstallerCondition}; Tasks: gac\vs2012; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx40 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true -noVs2008 true -noVs2010 true -noVs2013 true -noVs2015 true -noVs2017 true -configVersion 4.0.30319 -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
#endif
#if Year == "2010"
Components: {#InstallerCondition}; Tasks: gac\vs2010; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx20 true -noNetFx35 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true -noVs2008 true -noVs2012 true -noVs2013 true -noVs2015 true -noVs2017 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
#endif
#if Year == "2008"
Components: {#InstallerCondition}; Tasks: gac\vs2008; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true -noVs2010 true -noVs2012 true -noVs2013 true -noVs2015 true -noVs2017 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup()
#endif
#if Year == "2005"
Components: {#InstallerCondition}; Tasks: gac\vs2005; Filename: {app}\bin\Installer.exe; Parameters: "-install false -wow64 true -installFlags AllExceptGlobalAssemblyCache -tracePriority Lowest -verbose true -noCompact true -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2008 true -noVs2010 true -noVs2012 true -noVs2013 true -noVs2015 true -noVs2017 true -whatIf false -confirm true"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup()
#endif
#endif

#if Year != "2005" && Year != "2008"
Components: Application\EF6; Tasks: ngen; Filename: {code:GetNetFx4InstallRoot|Ngen.exe}; Parameters: "uninstall ""{app}\bin\System.Data.SQLite.EF6.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
#endif

#if Year != "2005"
Components: Application\LINQ; Tasks: ngen; Filename: {code:GetNetFx4InstallRoot|Ngen.exe}; Parameters: "uninstall ""{app}\bin\System.Data.SQLite.Linq.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
Components: Application\LINQ; Tasks: ngen; Filename: {code:GetNetFx2InstallRoot|Ngen.exe}; Parameters: "uninstall ""{app}\bin\System.Data.SQLite.Linq.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup() and CheckForNetFx35(1)
#endif

Components: Application\Core\MSIL; Tasks: ngen; Filename: {code:GetNetFx4InstallRoot|Ngen.exe}; Parameters: "uninstall ""{app}\bin\System.Data.SQLite.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx4Setup()
Components: Application\Core\MSIL; Tasks: ngen; Filename: {code:GetNetFx2InstallRoot|Ngen.exe}; Parameters: "uninstall ""{app}\bin\System.Data.SQLite.dll"" /nologo"; Flags: skipifdoesntexist; Check: CheckIsNetFx2Setup()

[Dirs]
Name: {app}\bin
Name: {app}\doc

#if Pos("NativeOnly", AppConfiguration) == 0
Name: {app}\GAC; Tasks: gac
#endif

[Files]
Components: Application\Core\{#AppProcessor}; Source: ..\..\Externals\MSVCPP\vcredist_{#AppProcessor}_{#VcRuntime}.exe; DestDir: {tmp}; Flags: dontcopy
Components: Application; Source: ..\..\System.Data.SQLite.url; DestDir: {app}; Flags: restartreplace uninsrestartdelete
Components: Application; Source: ..\..\readme.htm; DestDir: {app}; Flags: restartreplace uninsrestartdelete isreadme

#if Pos("NativeOnly", AppConfiguration) == 0
Components: Application\Core\MSIL; Tasks: gac; Source: ..\..\bin\{#Year}\{#AppPlatform}\{#AppConfiguration}\System.Data.SQLite.dll; DestDir: {app}\GAC; StrongAssemblyName: "System.Data.SQLite, Version={#AppVersion}, Culture=neutral, PublicKeyToken={#AppPublicKey}, ProcessorArchitecture={#GacProcessor}"; Flags: restartreplace uninsrestartdelete uninsnosharedfileprompt sharedfile gacinstall
Components: Application\Core\MSIL; Source: ..\..\bin\{#Year}\{#AppPlatform}\{#AppConfiguration}\System.Data.SQLite.dll; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
Components: Application\Core\MSIL and Application\Symbols; Source: ..\..\bin\{#Year}\{#AppPlatform}\{#AppConfiguration}\System.Data.SQLite.pdb; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
#else
Components: Application\Core\MSIL; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\System.Data.SQLite.dll; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
Components: Application\Core\MSIL and Application\Symbols; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\System.Data.SQLite.pdb; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
#endif

Components: Application\Core\MSIL; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\System.Data.SQLite.dll.config; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete

#if Year != "2005"
#if Pos("NativeOnly", AppConfiguration) == 0
Components: Application\LINQ; Tasks: gac; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\System.Data.SQLite.Linq.dll; DestDir: {app}\GAC; StrongAssemblyName: "System.Data.SQLite.Linq, Version={#AppVersion}, Culture=neutral, PublicKeyToken={#AppPublicKey}, ProcessorArchitecture=MSIL"; Flags: restartreplace uninsrestartdelete uninsnosharedfileprompt sharedfile gacinstall
#endif

Components: Application\LINQ; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\System.Data.SQLite.Linq.dll; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
Components: Application\LINQ and Application\Symbols; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\System.Data.SQLite.Linq.pdb; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
#endif

#if Year != "2005" && Year != "2008"
#if Year == "2010"
Components: Application\EF6; Source: ..\..\Externals\EntityFramework\v6.2\lib\net40\EntityFramework.dll; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
#elif Year == "2012" || Year == "2013" || Year == "2015"
Components: Application\EF6; Source: ..\..\Externals\EntityFramework\v6.2\lib\net45\EntityFramework.dll; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
#endif

#if Pos("NativeOnly", AppConfiguration) == 0
Components: Application\EF6; Tasks: gac; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\System.Data.SQLite.EF6.dll; DestDir: {app}\GAC; StrongAssemblyName: "System.Data.SQLite.EF6, Version={#AppVersion}, Culture=neutral, PublicKeyToken={#AppPublicKey}, ProcessorArchitecture=MSIL"; Flags: restartreplace uninsrestartdelete uninsnosharedfileprompt sharedfile gacinstall
#endif

Components: Application\EF6; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\System.Data.SQLite.EF6.dll; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
Components: Application\EF6 and Application\Symbols; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\System.Data.SQLite.EF6.pdb; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
#endif

#if Pos("NativeOnly", AppConfiguration) != 0
Components: Application\Core\{#AppProcessor}; Source: ..\..\bin\{#Year}\{#AppPlatform}\{#AppConfiguration}\SQLite.Interop.dll; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
Components: Application\Core\{#AppProcessor} and Application\Symbols; Source: ..\..\bin\{#Year}\{#AppPlatform}\{#AppConfiguration}\SQLite.Interop.pdb; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
#endif

Components: Application\Documentation; Source: ..\..\doc\SQLite.NET.chm; DestDir: {app}\doc; Flags: restartreplace uninsrestartdelete
Components: Application\Designer; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\SQLite.Designer.dll; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
Components: Application\Designer and Application\Symbols; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\SQLite.Designer.pdb; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
Components: Application\Designer\Installer; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\Installer.exe; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
Components: Application\Designer\Installer and Application\Symbols; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\Installer.pdb; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete

#if AppProcessor == "x86"
Components: Application\Test; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\test32.exe; DestDir: {app}\bin; DestName: test.exe; Flags: restartreplace uninsrestartdelete
#else
Components: Application\Test; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\test.exe; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
#endif

Components: Application\Test and Application\Symbols; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\test.pdb; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
Components: Application\Test; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\test.exe.config; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete

#if Year != "2005"
#if AppProcessor == "x86"
Components: Application\Test and Application\LINQ; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\testlinq32.exe; DestDir: {app}\bin; DestName: testlinq.exe; Flags: restartreplace uninsrestartdelete
#else
Components: Application\Test and Application\LINQ; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\testlinq.exe; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
#endif
Components: Application\Test and Application\LINQ and Application\Symbols; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\testlinq.pdb; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
Components: Application\Test and Application\LINQ; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\testlinq.exe.config; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
#endif

#if Year != "2005" && Year != "2008"
Components: Application\Test and (Application\LINQ or Application\EF6); Source: ..\..\testlinq\northwindEF.db; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
#if AppProcessor == "x86"
Components: Application\Test and (Application\LINQ or Application\EF6); Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\testef632.exe; DestDir: {app}\bin; DestName: testef6.exe; Flags: restartreplace uninsrestartdelete
#else
Components: Application\Test and (Application\LINQ or Application\EF6); Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\testef6.exe; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
#endif
Components: Application\Test and (Application\LINQ or Application\EF6) and Application\Symbols; Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\testef6.pdb; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
Components: Application\Test and (Application\LINQ or Application\EF6); Source: ..\..\bin\{#Year}\{#BaseConfiguration}\bin\testef6.exe.config; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
#elif Year != "2005"
Components: Application\Test and Application\LINQ; Source: ..\..\testlinq\northwindEF.db; DestDir: {app}\bin; Flags: restartreplace uninsrestartdelete
#endif

[Icons]
Name: {group}\Test Application; Filename: {app}\bin\test.exe; WorkingDir: {app}\bin; IconFilename: {app}\bin\test.exe; Comment: Launch Test Application; IconIndex: 0; Flags: createonlyiffileexists
Name: {group}\Class Library Documentation; Filename: {app}\doc\SQLite.NET.chm; WorkingDir: {app}\doc; Comment: Launch Class Library Documentation; Flags: createonlyiffileexists
Name: {group}\README File; Filename: {app}\readme.htm; WorkingDir: {app}; Comment: View README File; Flags: createonlyiffileexists

Added Setup/data/verify.lst.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
###############################################################################
#
# verify.lst -- Release Archive Manifest
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################
#
# NOTE: This file contains the master lists of all files that should be present
#       in the various archives generated during the release process.
#
###############################################################################
#
# NOTE: This is the list of all files that should be present in the standard
#       source code archive.
#
set sds_manifests(source) {
  data/
  data/exclude_bin.txt
  data/exclude_full_src.txt
  data/exclude_src.txt
  Doc/
  Doc/buildChm.tcl
  Doc/Extra/
  Doc/Extra/Core/
  Doc/Extra/Core/images/
  Doc/Extra/Core/images/sqlite370_banner.gif
  Doc/Extra/Core/json1.html
  Doc/Extra/Core/lang.html
  Doc/Extra/Core/lang_aggfunc.html
  Doc/Extra/Core/lang_altertable.html
  Doc/Extra/Core/lang_analyze.html
  Doc/Extra/Core/lang_attach.html
  Doc/Extra/Core/lang_comment.html
  Doc/Extra/Core/lang_conflict.html
  Doc/Extra/Core/lang_corefunc.html
  Doc/Extra/Core/lang_createindex.html
  Doc/Extra/Core/lang_createtable.html
  Doc/Extra/Core/lang_createtrigger.html
  Doc/Extra/Core/lang_createview.html
  Doc/Extra/Core/lang_createvtab.html
  Doc/Extra/Core/lang_datefunc.html
  Doc/Extra/Core/lang_delete.html
  Doc/Extra/Core/lang_detach.html
  Doc/Extra/Core/lang_dropindex.html
  Doc/Extra/Core/lang_droptable.html
  Doc/Extra/Core/lang_droptrigger.html
  Doc/Extra/Core/lang_dropview.html
  Doc/Extra/Core/lang_explain.html
  Doc/Extra/Core/lang_expr.html
  Doc/Extra/Core/lang_indexedby.html
  Doc/Extra/Core/lang_insert.html
  Doc/Extra/Core/lang_keywords.html
  Doc/Extra/Core/lang_mathfunc.html
  Doc/Extra/Core/lang_naming.html
  Doc/Extra/Core/lang_reindex.html
  Doc/Extra/Core/lang_replace.html
  Doc/Extra/Core/lang_returning.html
  Doc/Extra/Core/lang_savepoint.html
  Doc/Extra/Core/lang_select.html
  Doc/Extra/Core/lang_transaction.html
  Doc/Extra/Core/lang_update.html
  Doc/Extra/Core/lang_upsert.html
  Doc/Extra/Core/lang_vacuum.html
  Doc/Extra/Core/lang_with.html
  Doc/Extra/Core/pragma.html
  Doc/Extra/Core/sqlite.css
  Doc/Extra/Core/syntax.html
  Doc/Extra/Core/syntax/
  Doc/Extra/Core/syntax/aggregate-function-invocation.html
  Doc/Extra/Core/syntax/alter-table-stmt.html
  Doc/Extra/Core/syntax/analyze-stmt.html
  Doc/Extra/Core/syntax/attach-stmt.html
  Doc/Extra/Core/syntax/begin-stmt.html
  Doc/Extra/Core/syntax/column-constraint.html
  Doc/Extra/Core/syntax/column-def.html
  Doc/Extra/Core/syntax/column-name-list.html
  Doc/Extra/Core/syntax/comment-syntax.html
  Doc/Extra/Core/syntax/commit-stmt.html
  Doc/Extra/Core/syntax/common-table-expression.html
  Doc/Extra/Core/syntax/compound-operator.html
  Doc/Extra/Core/syntax/compound-select-stmt.html
  Doc/Extra/Core/syntax/conflict-clause.html
  Doc/Extra/Core/syntax/create-index-stmt.html
  Doc/Extra/Core/syntax/create-table-stmt.html
  Doc/Extra/Core/syntax/create-trigger-stmt.html
  Doc/Extra/Core/syntax/create-view-stmt.html
  Doc/Extra/Core/syntax/create-virtual-table-stmt.html
  Doc/Extra/Core/syntax/cte-table-name.html
  Doc/Extra/Core/syntax/delete-stmt-limited.html
  Doc/Extra/Core/syntax/delete-stmt.html
  Doc/Extra/Core/syntax/detach-stmt.html
  Doc/Extra/Core/syntax/drop-index-stmt.html
  Doc/Extra/Core/syntax/drop-table-stmt.html
  Doc/Extra/Core/syntax/drop-trigger-stmt.html
  Doc/Extra/Core/syntax/drop-view-stmt.html
  Doc/Extra/Core/syntax/expr.html
  Doc/Extra/Core/syntax/factored-select-stmt.html
  Doc/Extra/Core/syntax/filter-clause.html
  Doc/Extra/Core/syntax/foreign-key-clause.html
  Doc/Extra/Core/syntax/frame-spec.html
  Doc/Extra/Core/syntax/indexed-column.html
  Doc/Extra/Core/syntax/insert-stmt.html
  Doc/Extra/Core/syntax/join-clause.html
  Doc/Extra/Core/syntax/join-constraint.html
  Doc/Extra/Core/syntax/join-operator.html
  Doc/Extra/Core/syntax/literal-value.html
  Doc/Extra/Core/syntax/numeric-literal.html
  Doc/Extra/Core/syntax/ordering-term.html
  Doc/Extra/Core/syntax/over-clause.html
  Doc/Extra/Core/syntax/pragma-stmt.html
  Doc/Extra/Core/syntax/pragma-value.html
  Doc/Extra/Core/syntax/qualified-table-name.html
  Doc/Extra/Core/syntax/raise-function.html
  Doc/Extra/Core/syntax/recursive-cte.html
  Doc/Extra/Core/syntax/reindex-stmt.html
  Doc/Extra/Core/syntax/release-stmt.html
  Doc/Extra/Core/syntax/result-column.html
  Doc/Extra/Core/syntax/returning-clause.html
  Doc/Extra/Core/syntax/rollback-stmt.html
  Doc/Extra/Core/syntax/savepoint-stmt.html
  Doc/Extra/Core/syntax/select-core.html
  Doc/Extra/Core/syntax/select-stmt.html
  Doc/Extra/Core/syntax/signed-number.html
  Doc/Extra/Core/syntax/simple-function-invocation.html
  Doc/Extra/Core/syntax/simple-select-stmt.html
  Doc/Extra/Core/syntax/sql-stmt-list.html
  Doc/Extra/Core/syntax/sql-stmt.html
  Doc/Extra/Core/syntax/table-constraint.html
  Doc/Extra/Core/syntax/table-options.html
  Doc/Extra/Core/syntax/table-or-subquery.html
  Doc/Extra/Core/syntax/type-name.html
  Doc/Extra/Core/syntax/update-stmt-limited.html
  Doc/Extra/Core/syntax/update-stmt.html
  Doc/Extra/Core/syntax/upsert-clause.html
  Doc/Extra/Core/syntax/vacuum-stmt.html
  Doc/Extra/Core/syntax/window-defn.html
  Doc/Extra/Core/syntax/window-function-invocation.html
  Doc/Extra/Core/syntax/with-clause.html
  Doc/Extra/Core/syntaxdiagrams.html
  Doc/Extra/Include/
  Doc/Extra/Include/ndoc.css
  Doc/Extra/Provider/
  Doc/Extra/Provider/dbfactorysupport.html
  Doc/Extra/Provider/designer.html
  Doc/Extra/Provider/environment.html
  Doc/Extra/Provider/lang_types.html
  Doc/Extra/Provider/limitations.html
  Doc/Extra/Provider/optimizing.html
  Doc/Extra/Provider/syntax.html
  Doc/Extra/Provider/version.html
  Doc/Extra/Provider/welcome.html
  Doc/Special/
  Doc/Special/Core/
  Doc/Special/Core/vtab.html
  Doc/SQLite.NET.chm
  Doc/SQLite.NET.hhc
  Doc/SQLite.NET.hhp
  Doc/SQLite.NET.ndoc
  Doc/sync.eagle
  Doc/vtab.tcl
  Externals/
  Externals/Eagle/
  Externals/Eagle/bin/
  Externals/Eagle/bin/netFramework20/
  Externals/Eagle/bin/netFramework20/EagleShell.exe.config
  Externals/Eagle/bin/netFramework40/
  Externals/Eagle/bin/netFramework40/EagleShell.exe.config
  Externals/Eagle/lib/
  Externals/Eagle/lib/Eagle1.0/
  Externals/Eagle/lib/Eagle1.0/vendor.eagle
  Keys/
  Keys/System.Data.SQLite.CF.snk
  Keys/System.Data.SQLite.snk
  lib/
  lib/System.Data.SQLite/
  lib/System.Data.SQLite/common.eagle
  lib/System.Data.SQLite/pkgIndex.eagle
  NuGet/
  NuGet/net40/
  NuGet/net40/EF6/
  NuGet/net40/EF6/content/
  NuGet/net40/EF6/content/config.transform
  NuGet/net40/EF6/tools/
  NuGet/net40/EF6/tools/provider.ps1
  NuGet/shared/
  NuGet/shared/Core/
  NuGet/shared/Core/build/
  NuGet/shared/Core/build/System.Data.SQLite.Core.NetFramework.targets
  NuGet/shared/Core/buildTransitive/
  NuGet/shared/Core/buildTransitive/System.Data.SQLite.Core.NetFramework.targets
  NuGet/shared/Core/content/
  NuGet/shared/Core/content/config.install.xdt
  NuGet/shared/Core/content/config.transform
  NuGet/shared/Core/lib/
  NuGet/shared/Core/lib/System.Data.SQLite.dll.altconfig
  NuGet/SQLite.Beta.nuspec
  NuGet/SQLite.Core.Beta.nuspec
  NuGet/SQLite.Core.MSIL.Beta.nuspec
  NuGet/SQLite.Core.MSIL.nuspec
  NuGet/SQLite.Core.MSIL.Test.nuspec
  NuGet/SQLite.Core.NetFramework.nuspec
  NuGet/SQLite.Core.NetStandard.nuspec
  NuGet/SQLite.Core.nuspec
  NuGet/SQLite.Core.Test.nuspec
  NuGet/SQLite.EF6.Beta.nuspec
  NuGet/SQLite.EF6.nuspec
  NuGet/SQLite.EF6.Test.nuspec
  NuGet/SQLite.Linq.Beta.nuspec
  NuGet/SQLite.Linq.nuspec
  NuGet/SQLite.Linq.Test.nuspec
  NuGet/SQLite.MSIL.Beta.nuspec
  NuGet/SQLite.MSIL.nuspec
  NuGet/SQLite.MSIL.Test.nuspec
  NuGet/SQLite.nuspec
  NuGet/SQLite.Test.nuspec
  NuGet/SQLite.x64.nuspec
  NuGet/SQLite.x86.nuspec
  readme.htm
  Setup/
  Setup/archive.bat
  Setup/bake.bat
  Setup/bake_all.bat
  Setup/build-mono-debug.sh
  Setup/build-mono-release.sh
  Setup/build-netstandard20-debug.sh
  Setup/build-netstandard20-release.sh
  Setup/build-netstandard21-debug.sh
  Setup/build-netstandard21-release.sh
  Setup/build.bat
  Setup/build_all.bat
  Setup/build_ce_200x.bat
  Setup/build_ce_2013.bat
  Setup/build_mono.bat
  Setup/build_net_standard_20.bat
  Setup/build_net_standard_21.bat
  Setup/build_nuget.bat
  Setup/clean.bat
  Setup/compile-interop-assembly-debug.sh
  Setup/compile-interop-assembly-release.sh
  Setup/data/
  Setup/data/CheckForNetFx.pas
  Setup/data/InitializeSetup.pas
  Setup/data/SQLite.iss
  Setup/data/verify.lst
  Setup/deployAndTestCe200x.eagle
  Setup/release.bat
  Setup/release_all.bat
  Setup/release_ce_200x.bat
  Setup/release_ce_2013.bat
  Setup/release_mono.bat
  Setup/release_net_standard_20.bat
  Setup/release_net_standard_21.bat
  Setup/release_static.bat
  Setup/run-mono-tests-debug.sh
  Setup/run-mono-tests-release.sh
  Setup/run-net5-tests-debug.sh
  Setup/run-net5-tests-release.sh
  Setup/run-net6-tests-debug.sh
  Setup/run-net6-tests-release.sh
  Setup/run-netcore20-tests-debug.sh
  Setup/run-netcore20-tests-release.sh
  Setup/run-netcore30-tests-debug.sh
  Setup/run-netcore30-tests-release.sh
  Setup/set_common.bat
  Setup/set_Debug.bat
  Setup/set_Debug_ARMV7.bat
  "Setup/set_Debug_CEPC DevPlatform.bat"
  "Setup/set_Debug_Pocket PC 2003 (ARMV4).bat"
  Setup/set_Debug_Win32.bat
  Setup/set_Debug_x64.bat
  Setup/set_Debug_x64_2005.bat
  Setup/set_Debug_x64_2008.bat
  Setup/set_Debug_x64_2010.bat
  Setup/set_Debug_x64_2012.bat
  Setup/set_Debug_x64_2013.bat
  Setup/set_Debug_x64_2015.bat
  Setup/set_Debug_x64_2017.bat
  Setup/set_Debug_x86_2005.bat
  Setup/set_Debug_x86_2008.bat
  Setup/set_Debug_x86_2010.bat
  Setup/set_Debug_x86_2012.bat
  Setup/set_Debug_x86_2013.bat
  Setup/set_Debug_x86_2015.bat
  Setup/set_Debug_x86_2017.bat
  Setup/set_Debug_x86_NetStandard20.bat
  Setup/set_Debug_x86_NetStandard21.bat
  Setup/set_DebugNativeOnly.bat
  Setup/set_DebugNativeOnly_ARMV7.bat
  "Setup/set_DebugNativeOnly_CEPC DevPlatform.bat"
  "Setup/set_DebugNativeOnly_Pocket PC 2003 (ARMV4).bat"
  Setup/set_DebugNativeOnly_Win32.bat
  Setup/set_DebugNativeOnly_x64.bat
  Setup/set_DebugNativeOnly_x64_2005.bat
  Setup/set_DebugNativeOnly_x64_2008.bat
  Setup/set_DebugNativeOnly_x64_2010.bat
  Setup/set_DebugNativeOnly_x64_2012.bat
  Setup/set_DebugNativeOnly_x64_2013.bat
  Setup/set_DebugNativeOnly_x64_2015.bat
  Setup/set_DebugNativeOnly_x64_2017.bat
  Setup/set_DebugNativeOnly_x86_2005.bat
  Setup/set_DebugNativeOnly_x86_2008.bat
  Setup/set_DebugNativeOnly_x86_2010.bat
  Setup/set_DebugNativeOnly_x86_2012.bat
  Setup/set_DebugNativeOnly_x86_2013.bat
  Setup/set_DebugNativeOnly_x86_2015.bat
  Setup/set_DebugNativeOnly_x86_2017.bat
  Setup/set_DebugNativeOnly_x86_NetStandard20.bat
  Setup/set_DebugNativeOnly_x86_NetStandard21.bat
  Setup/set_netFx20.bat
  Setup/set_netFx35.bat
  Setup/set_netFx40.bat
  Setup/set_netFx45.bat
  Setup/set_netFx451.bat
  Setup/set_netFx452.bat
  Setup/set_netFx46.bat
  Setup/set_netFx461.bat
  Setup/set_netFx462.bat
  Setup/set_netFx47.bat
  Setup/set_netFx471.bat
  Setup/set_netFx472.bat
  Setup/set_netFx48.bat
  Setup/set_netStandard20.bat
  Setup/set_netStandard21.bat
  Setup/set_Release.bat
  Setup/set_Release_ARMV7.bat
  "Setup/set_Release_CEPC DevPlatform.bat"
  "Setup/set_Release_Pocket PC 2003 (ARMV4).bat"
  Setup/set_Release_Win32.bat
  Setup/set_Release_x64.bat
  Setup/set_Release_x64_2005.bat
  Setup/set_Release_x64_2008.bat
  Setup/set_Release_x64_2010.bat
  Setup/set_Release_x64_2012.bat
  Setup/set_Release_x64_2013.bat
  Setup/set_Release_x64_2015.bat
  Setup/set_Release_x64_2017.bat
  Setup/set_Release_x86_2005.bat
  Setup/set_Release_x86_2008.bat
  Setup/set_Release_x86_2010.bat
  Setup/set_Release_x86_2012.bat
  Setup/set_Release_x86_2013.bat
  Setup/set_Release_x86_2015.bat
  Setup/set_Release_x86_2017.bat
  Setup/set_Release_x86_NetStandard20.bat
  Setup/set_Release_x86_NetStandard21.bat
  Setup/set_ReleaseNativeOnly.bat
  Setup/set_ReleaseNativeOnly_ARMV7.bat
  "Setup/set_ReleaseNativeOnly_CEPC DevPlatform.bat"
  "Setup/set_ReleaseNativeOnly_Pocket PC 2003 (ARMV4).bat"
  Setup/set_ReleaseNativeOnly_Win32.bat
  Setup/set_ReleaseNativeOnly_x64.bat
  Setup/set_ReleaseNativeOnly_x64_2005.bat
  Setup/set_ReleaseNativeOnly_x64_2008.bat
  Setup/set_ReleaseNativeOnly_x64_2010.bat
  Setup/set_ReleaseNativeOnly_x64_2012.bat
  Setup/set_ReleaseNativeOnly_x64_2013.bat
  Setup/set_ReleaseNativeOnly_x64_2015.bat
  Setup/set_ReleaseNativeOnly_x64_2017.bat
  Setup/set_ReleaseNativeOnly_x86_2005.bat
  Setup/set_ReleaseNativeOnly_x86_2008.bat
  Setup/set_ReleaseNativeOnly_x86_2010.bat
  Setup/set_ReleaseNativeOnly_x86_2012.bat
  Setup/set_ReleaseNativeOnly_x86_2013.bat
  Setup/set_ReleaseNativeOnly_x86_2015.bat
  Setup/set_ReleaseNativeOnly_x86_2017.bat
  Setup/set_ReleaseNativeOnly_x86_NetStandard20.bat
  Setup/set_ReleaseNativeOnly_x86_NetStandard21.bat
  Setup/set_x64_2005.bat
  Setup/set_x64_2008.bat
  Setup/set_x64_2010.bat
  Setup/set_x64_2012.bat
  Setup/set_x64_2013.bat
  Setup/set_x64_2015.bat
  Setup/set_x64_2017.bat
  Setup/set_x86_2005.bat
  Setup/set_x86_2008.bat
  Setup/set_x86_2010.bat
  Setup/set_x86_2012.bat
  Setup/set_x86_2013.bat
  Setup/set_x86_2015.bat
  Setup/set_x86_2017.bat
  Setup/set_x86_NetStandard20.bat
  Setup/set_x86_NetStandard21.bat
  Setup/set_year_2005.bat
  Setup/set_year_2008.bat
  Setup/set_year_2010.bat
  Setup/set_year_2012.bat
  Setup/set_year_2013.bat
  Setup/set_year_2015.bat
  Setup/set_year_2017.bat
  Setup/set_year_NetStandard20.bat
  Setup/set_year_NetStandard21.bat
  Setup/sourceTag.eagle
  Setup/test.bat
  Setup/test_all.bat
  Setup/test_ce_200x.bat
  Setup/test_net_5.bat
  Setup/test_net_6.bat
  Setup/test_net_core_20.bat
  Setup/test_net_core_30.bat
  Setup/updateFileInfo.tcl
  Setup/verify.eagle
  Setup/vsSp.bat
  SQLite.Designer/
  SQLite.Designer/AssemblyInfo.cs
  SQLite.Designer/ChangePasswordDialog.cs
  SQLite.Designer/ChangePasswordDialog.Designer.cs
  SQLite.Designer/ChangePasswordDialog.resx
  SQLite.Designer/ChangeScriptDialog.cs
  SQLite.Designer/ChangeScriptDialog.Designer.cs
  SQLite.Designer/ChangeScriptDialog.resx
  SQLite.Designer/CtcComponents/
  SQLite.Designer/CtcComponents/Guids.h
  SQLite.Designer/CtcComponents/PkgCmd.ctc
  SQLite.Designer/CtcComponents/PkgCmdID.h
  SQLite.Designer/Design/
  SQLite.Designer/Design/Check.cs
  SQLite.Designer/Design/Column.cs
  SQLite.Designer/Design/ForeignKey.cs
  SQLite.Designer/Design/Index.cs
  SQLite.Designer/Design/PrimaryKey.cs
  SQLite.Designer/Design/SimpleTokenizer.cs
  SQLite.Designer/Design/Table.cs
  SQLite.Designer/Design/Trigger.cs
  SQLite.Designer/Design/Unique.cs
  SQLite.Designer/Design/View.cs
  SQLite.Designer/Editors/
  SQLite.Designer/Editors/AutoCompleteColumn.cs
  SQLite.Designer/Editors/TableDesignerDoc.cs
  SQLite.Designer/Editors/TableDesignerDoc.Designer.cs
  SQLite.Designer/Editors/TableDesignerDoc.resx
  SQLite.Designer/Editors/ViewDesignerDoc.cs
  SQLite.Designer/Editors/ViewDesignerDoc.Designer.cs
  SQLite.Designer/Editors/ViewDesignerDoc.resx
  SQLite.Designer/Pkgcmd.h
  SQLite.Designer/PkgCmd.vsct
  SQLite.Designer/plk.txt
  SQLite.Designer/Resources/
  SQLite.Designer/Resources/info.png
  SQLite.Designer/Resources/ToolboxItems.txt
  SQLite.Designer/source.extension.vsixmanifest
  SQLite.Designer/SQLite.Designer.2005.csproj
  SQLite.Designer/SQLite.Designer.2008.csproj
  SQLite.Designer/SQLite.Designer.2010.csproj
  SQLite.Designer/SQLite.Designer.2012.csproj
  SQLite.Designer/SQLite.Designer.2013.csproj
  SQLite.Designer/SQLite.Designer.2015.csproj
  SQLite.Designer/SQLite.Designer.2017.csproj
  SQLite.Designer/SQLiteAdapterDesigner.cs
  SQLite.Designer/SQLiteCommandDesigner.cs
  SQLite.Designer/SQLiteCommandHandler.cs
  SQLite.Designer/SQLiteConnectionProperties.cs
  SQLite.Designer/SQLiteConnectionStringEditor.cs
  SQLite.Designer/SQLiteConnectionUIControl.cs
  SQLite.Designer/SQLiteConnectionUIControl.Designer.cs
  SQLite.Designer/SQLiteConnectionUIControl.resx
  SQLite.Designer/SQLiteDataAdapterToolboxItem.cs
  SQLite.Designer/SQLiteDataConnectionSupport.cs
  SQLite.Designer/SQLiteDataObjectIdentifierResolver.cs
  SQLite.Designer/SQLiteDataObjectSupport.cs
  SQLite.Designer/SQLiteDataObjectSupport2005.xml
  SQLite.Designer/SQLiteDataObjectSupport2008.xml
  SQLite.Designer/SQLiteDataObjectSupport2010.xml
  SQLite.Designer/SQLiteDataObjectSupport2012.xml
  SQLite.Designer/SQLiteDataObjectSupport2013.xml
  SQLite.Designer/SQLiteDataObjectSupport2015.xml
  SQLite.Designer/SQLiteDataObjectSupport2017.xml
  SQLite.Designer/SQLiteDataSourceInformation.cs
  SQLite.Designer/SQLiteDataViewSupport.cs
  SQLite.Designer/SQLiteDataViewSupport2005.xml
  SQLite.Designer/SQLiteDataViewSupport2008.xml
  SQLite.Designer/SQLiteDataViewSupport2010.xml
  SQLite.Designer/SQLiteDataViewSupport2012.xml
  SQLite.Designer/SQLiteDataViewSupport2013.xml
  SQLite.Designer/SQLiteDataViewSupport2015.xml
  SQLite.Designer/SQLiteDataViewSupport2017.xml
  SQLite.Designer/SQLiteOptions.cs
  SQLite.Designer/SQLitePackage.cs
  SQLite.Designer/SQLiteProviderObjectFactory.cs
  SQLite.Designer/TableNameDialog.cs
  SQLite.Designer/TableNameDialog.Designer.cs
  SQLite.Designer/TableNameDialog.resx
  SQLite.Designer/VSPackage.Designer.cs
  SQLite.Designer/VSPackage.resx
  SQLite.Interop/
  SQLite.Interop/props/
  SQLite.Interop/props/empty.vsprops
  SQLite.Interop/props/include.vsprops
  SQLite.Interop/props/SQLite.Interop.2005.vsprops
  SQLite.Interop/props/SQLite.Interop.2008.vsprops
  SQLite.Interop/props/SQLite.Interop.2010.props
  SQLite.Interop/props/SQLite.Interop.2012.props
  SQLite.Interop/props/SQLite.Interop.2013.props
  SQLite.Interop/props/SQLite.Interop.2015.props
  SQLite.Interop/props/SQLite.Interop.2017.props
  SQLite.Interop/props/sqlite3.props
  SQLite.Interop/props/sqlite3.vsprops
  SQLite.Interop/SQLite.Interop.2005.vcproj
  SQLite.Interop/SQLite.Interop.2008.vcproj
  SQLite.Interop/SQLite.Interop.2010.vcxproj
  SQLite.Interop/SQLite.Interop.2010.vcxproj.filters
  SQLite.Interop/SQLite.Interop.2012.vcxproj
  SQLite.Interop/SQLite.Interop.2012.vcxproj.filters
  SQLite.Interop/SQLite.Interop.2013.vcxproj
  SQLite.Interop/SQLite.Interop.2013.vcxproj.filters
  SQLite.Interop/SQLite.Interop.2015.vcxproj
  SQLite.Interop/SQLite.Interop.2015.vcxproj.filters
  SQLite.Interop/SQLite.Interop.2017.vcxproj
  SQLite.Interop/SQLite.Interop.2017.vcxproj.filters
  SQLite.Interop/SQLite.Interop.CE.2005.vcproj
  SQLite.Interop/SQLite.Interop.CE.2008.vcproj
  SQLite.Interop/SQLite.Interop.CE.2012.vcxproj
  SQLite.Interop/SQLite.Interop.CE.2012.vcxproj.filters
  SQLite.Interop/SQLite.Interop.Static.2005.vcproj
  SQLite.Interop/SQLite.Interop.Static.2008.vcproj
  SQLite.Interop/SQLite.Interop.Static.2010.vcxproj
  SQLite.Interop/SQLite.Interop.Static.2010.vcxproj.filters
  SQLite.Interop/SQLite.Interop.Static.2012.vcxproj
  SQLite.Interop/SQLite.Interop.Static.2012.vcxproj.filters
  SQLite.Interop/SQLite.Interop.Static.2013.vcxproj
  SQLite.Interop/SQLite.Interop.Static.2013.vcxproj.filters
  SQLite.Interop/SQLite.Interop.Static.2015.vcxproj
  SQLite.Interop/SQLite.Interop.Static.2015.vcxproj.filters
  SQLite.Interop/SQLite.Interop.Static.2017.vcxproj
  SQLite.Interop/SQLite.Interop.Static.2017.vcxproj.filters
  SQLite.Interop/src/
  SQLite.Interop/src/contrib/
  SQLite.Interop/src/contrib/extension-functions.c
  SQLite.Interop/src/core/
  SQLite.Interop/src/core/sqlite3.c
  SQLite.Interop/src/core/sqlite3.h
  SQLite.Interop/src/core/sqlite3ext.h
  SQLite.Interop/src/ext/
  SQLite.Interop/src/ext/fts5.c
  SQLite.Interop/src/ext/percentile.c
  SQLite.Interop/src/ext/regexp.c
  SQLite.Interop/src/ext/sha1.c
  SQLite.Interop/src/ext/shathree.c
  SQLite.Interop/src/ext/totype.c
  SQLite.Interop/src/ext/vtshim.c
  SQLite.Interop/src/generic/
  SQLite.Interop/src/generic/interop.c
  SQLite.Interop/src/generic/interop.h
  SQLite.Interop/src/win/
  SQLite.Interop/src/win/AssemblyInfo.cpp
  SQLite.Interop/src/win/crypt.c
  SQLite.Interop/src/win/SQLite.Interop.rc
  SQLite.NET.2005.MSBuild.sln
  SQLite.NET.2005.sln
  SQLite.NET.2008.MSBuild.sln
  SQLite.NET.2008.sln
  SQLite.NET.2010.MSBuild.sln
  SQLite.NET.2010.sln
  SQLite.NET.2012.Compact.sln
  SQLite.NET.2012.MSBuild.sln
  SQLite.NET.2012.sln
  SQLite.NET.2013.MSBuild.sln
  SQLite.NET.2013.sln
  SQLite.NET.2015.MSBuild.sln
  SQLite.NET.2015.sln
  SQLite.NET.2017.MSBuild.sln
  SQLite.NET.2017.sln
  SQLite.NET.NetStandard20.MSBuild.sln
  SQLite.NET.NetStandard21.MSBuild.sln
  SQLite.NET.NetStandard20.sln
  SQLite.NET.NetStandard21.sln
  System.Data.SQLite.url
  System.Data.SQLite/
  System.Data.SQLite/AssemblyInfo.cs
  System.Data.SQLite/AssemblySourceIdAttribute.cs
  System.Data.SQLite/AssemblySourceTimeStampAttribute.cs
  System.Data.SQLite/Configurations/
  System.Data.SQLite/Configurations/System.Data.SQLite.dll.config
  System.Data.SQLite/Generated/
  System.Data.SQLite/Generated/SR.resources
  System.Data.SQLite/ISQLiteNativeModule.cs
  System.Data.SQLite/LINQ/
  System.Data.SQLite/LINQ/SQLiteConnection_Linq.cs
  System.Data.SQLite/LINQ/SQLiteFactory_Linq.cs
  System.Data.SQLite/Resources/
  System.Data.SQLite/Resources/DataTypes.xml
  System.Data.SQLite/Resources/MetaDataCollections.xml
  System.Data.SQLite/Resources/SQLiteCommand.bmp
  System.Data.SQLite/Resources/SQLiteConnection.bmp
  System.Data.SQLite/Resources/SQLiteDataAdapter.bmp
  System.Data.SQLite/Resources/SR.Designer.cs
  System.Data.SQLite/Resources/SR.resx
  System.Data.SQLite/SQLite3.cs
  System.Data.SQLite/SQLite3_UTF16.cs
  System.Data.SQLite/SQLiteBackup.cs
  System.Data.SQLite/SQLiteBase.cs
  System.Data.SQLite/SQLiteBlob.cs
  System.Data.SQLite/SQLiteCommand.cs
  System.Data.SQLite/SQLiteCommandBuilder.cs
  System.Data.SQLite/SQLiteConnection.cs
  System.Data.SQLite/SQLiteConnectionPool.cs
  System.Data.SQLite/SQLiteConnectionStringBuilder.cs
  System.Data.SQLite/SQLiteConvert.cs
  System.Data.SQLite/SQLiteDataAdapter.cs
  System.Data.SQLite/SQLiteDataReader.cs
  System.Data.SQLite/SQLiteDefineConstants.cs
  System.Data.SQLite/SQLiteEnlistment.cs
  System.Data.SQLite/SQLiteException.cs
  System.Data.SQLite/SQLiteFactory.cs
  System.Data.SQLite/SQLiteFunction.cs
  System.Data.SQLite/SQLiteFunctionAttribute.cs
  System.Data.SQLite/SQLiteKeyReader.cs
  System.Data.SQLite/SQLiteLog.cs
  System.Data.SQLite/SQLiteMetaDataCollectionNames.cs
  System.Data.SQLite/SQLiteModule.cs
  System.Data.SQLite/SQLiteModuleCommon.cs
  System.Data.SQLite/SQLiteModuleEnumerable.cs
  System.Data.SQLite/SQLiteModuleNoop.cs
  System.Data.SQLite/SQLiteParameter.cs
  System.Data.SQLite/SQLiteParameterCollection.cs
  System.Data.SQLite/SQLitePatchLevel.cs
  System.Data.SQLite/SQLiteSession.cs
  System.Data.SQLite/SQLiteStatement.cs
  System.Data.SQLite/SQLiteTransaction.cs
  System.Data.SQLite/SQLiteTransaction2.cs
  System.Data.SQLite/SQLiteTransactionBase.cs
  System.Data.SQLite/System.Data.SQLite.2005.csproj
  System.Data.SQLite/System.Data.SQLite.2008.csproj
  System.Data.SQLite/System.Data.SQLite.2010.csproj
  System.Data.SQLite/System.Data.SQLite.2012.csproj
  System.Data.SQLite/System.Data.SQLite.2013.csproj
  System.Data.SQLite/System.Data.SQLite.2015.csproj
  System.Data.SQLite/System.Data.SQLite.2017.csproj
  System.Data.SQLite/System.Data.SQLite.Compact.2005.csproj
  System.Data.SQLite/System.Data.SQLite.Compact.2008.csproj
  System.Data.SQLite/System.Data.SQLite.Compact.2012.csproj
  System.Data.SQLite/System.Data.SQLite.Module.2005.csproj
  System.Data.SQLite/System.Data.SQLite.Module.2008.csproj
  System.Data.SQLite/System.Data.SQLite.Module.2010.csproj
  System.Data.SQLite/System.Data.SQLite.Module.2012.csproj
  System.Data.SQLite/System.Data.SQLite.Module.2013.csproj
  System.Data.SQLite/System.Data.SQLite.Module.2015.csproj
  System.Data.SQLite/System.Data.SQLite.Module.2017.csproj
  System.Data.SQLite/System.Data.SQLite.NetStandard20.csproj
  System.Data.SQLite/System.Data.SQLite.NetStandard21.csproj
  System.Data.SQLite/Targets/
  System.Data.SQLite/Targets/System.Data.SQLite.Files.targets
  System.Data.SQLite/Targets/System.Data.SQLite.Properties.targets
  System.Data.SQLite/Targets/System.Data.SQLite.References.targets
  System.Data.SQLite/UnsafeNativeMethods.cs
  System.Data.SQLite.Linq/
  System.Data.SQLite.Linq/AssemblyInfo.cs
  System.Data.SQLite.Linq/Properties/
  System.Data.SQLite.Linq/Properties/Resources.Designer.cs
  System.Data.SQLite.Linq/Properties/Resources.resx
  System.Data.SQLite.Linq/Resources/
  System.Data.SQLite.Linq/Resources/Common.ConceptualSchemaDefinition.csdl
  System.Data.SQLite.Linq/Resources/Common.ProviderManifest.xsd
  System.Data.SQLite.Linq/Resources/SQLiteProviderServices.ProviderManifest.xml
  System.Data.SQLite.Linq/Resources/SQLiteProviderServices.StoreSchemaDefinition.EF6.ssdl
  System.Data.SQLite.Linq/Resources/SQLiteProviderServices.StoreSchemaDefinition.Linq.ssdl
  System.Data.SQLite.Linq/Resources/SQLiteProviderServices.StoreSchemaMapping.msl
  System.Data.SQLite.Linq/Resources/System.Data.Resources.CodeGenerationSchema.xsd
  System.Data.SQLite.Linq/Resources/System.Data.Resources.CSDLSchema.xsd
  System.Data.SQLite.Linq/Resources/System.Data.Resources.CSMSL.xsd
  System.Data.SQLite.Linq/Resources/System.Data.Resources.EntityStoreSchemaGenerator.xsd
  System.Data.SQLite.Linq/Resources/System.Data.Resources.SSDLSchema.xsd
  "System.Data.SQLite.Linq/SQL Generation/"
  "System.Data.SQLite.Linq/SQL Generation/DmlSqlGenerator.cs"
  "System.Data.SQLite.Linq/SQL Generation/InternalBase.cs"
  "System.Data.SQLite.Linq/SQL Generation/ISqlFragment.cs"
  "System.Data.SQLite.Linq/SQL Generation/JoinSymbol.cs"
  "System.Data.SQLite.Linq/SQL Generation/KeyToListMap.cs"
  "System.Data.SQLite.Linq/SQL Generation/License.txt"
  "System.Data.SQLite.Linq/SQL Generation/MetadataHelpers.cs"
  "System.Data.SQLite.Linq/SQL Generation/SkipClause.cs"
  "System.Data.SQLite.Linq/SQL Generation/SqlBuilder.cs"
  "System.Data.SQLite.Linq/SQL Generation/SqlChecker.cs"
  "System.Data.SQLite.Linq/SQL Generation/SqlGenerator.cs"
  "System.Data.SQLite.Linq/SQL Generation/SqlSelectStatement.cs"
  "System.Data.SQLite.Linq/SQL Generation/SqlWriter.cs"
  "System.Data.SQLite.Linq/SQL Generation/StringUtil.cs"
  "System.Data.SQLite.Linq/SQL Generation/Symbol.cs"
  "System.Data.SQLite.Linq/SQL Generation/SymbolPair.cs"
  "System.Data.SQLite.Linq/SQL Generation/SymbolTable.cs"
  "System.Data.SQLite.Linq/SQL Generation/TopClause.cs"
  System.Data.SQLite.Linq/SQLiteProviderFactory.cs
  System.Data.SQLite.Linq/SQLiteProviderManifest.cs
  System.Data.SQLite.Linq/SQLiteProviderServices.cs
  System.Data.SQLite.Linq/System.Data.SQLite.Core.2010.csproj
  System.Data.SQLite.Linq/System.Data.SQLite.Core.2012.csproj
  System.Data.SQLite.Linq/System.Data.SQLite.Core.2013.csproj
  System.Data.SQLite.Linq/System.Data.SQLite.Core.2015.csproj
  System.Data.SQLite.Linq/System.Data.SQLite.Core.2017.csproj
  System.Data.SQLite.Linq/System.Data.SQLite.EF6.2010.csproj
  System.Data.SQLite.Linq/System.Data.SQLite.EF6.2012.csproj
  System.Data.SQLite.Linq/System.Data.SQLite.EF6.2013.csproj
  System.Data.SQLite.Linq/System.Data.SQLite.EF6.2015.csproj
  System.Data.SQLite.Linq/System.Data.SQLite.EF6.2017.csproj
  System.Data.SQLite.Linq/System.Data.SQLite.EF6.NetStandard21.csproj
  System.Data.SQLite.Linq/System.Data.SQLite.Linq.2008.csproj
  System.Data.SQLite.Linq/System.Data.SQLite.Linq.2010.csproj
  System.Data.SQLite.Linq/System.Data.SQLite.Linq.2012.csproj
  System.Data.SQLite.Linq/System.Data.SQLite.Linq.2013.csproj
  System.Data.SQLite.Linq/System.Data.SQLite.Linq.2015.csproj
  System.Data.SQLite.Linq/System.Data.SQLite.Linq.2017.csproj
  Targets/
  Targets/SQLite.NET.Mono.Settings.targets
  Targets/SQLite.NET.NetStandard20.Settings.targets
  Targets/SQLite.NET.NetStandard21.Settings.targets
  Targets/SQLite.NET.Platform.Settings.targets
  Targets/SQLite.NET.Settings.targets
  Targets/SQLite.NET.Settings.targets.netFx35
  Targets/SQLite.NET.Settings.targets.netFx40
  Targets/SQLite.NET.targets
  test/
  test/app.config
  test/AssemblyInfo.cs
  test/Program.cs
  test/Properties/
  test/Properties/Resources.Designer.cs
  test/Properties/Resources.resx
  test/test.2005.csproj
  test/test.2008.csproj
  test/test.2010.csproj
  test/test.2012.csproj
  test/test.2013.csproj
  test/test.2015.csproj
  test/test.2017.csproj
  test/TestCases.cs
  test/TestCasesDialog.cs
  test/TestCasesDialog.Designer.cs
  test/TestCasesDialog.resx
  testce/
  testce/AssemblyInfo.cs
  testce/Form1.cs
  testce/Form1.Designer.cs
  testce/Form1.resx
  testce/Program.cs
  testce/test.cfg
  testce/test.sql
  testce/TestCases.cs
  testce/testce.2005.csproj
  testce/testce.2008.csproj
  testce/testce.2012.csproj
  testlinq/
  testlinq/2008/
  testlinq/2008/LINQ/
  testlinq/2008/LINQ/App.config
  testlinq/2010/
  testlinq/2010/EF6/
  testlinq/2010/EF6/App.config
  testlinq/2010/LINQ/
  testlinq/2010/LINQ/App.config
  testlinq/2012/
  testlinq/2012/EF6/
  testlinq/2012/EF6/App.config
  testlinq/2012/LINQ/
  testlinq/2012/LINQ/App.config
  testlinq/2013/
  testlinq/2013/EF6/
  testlinq/2013/EF6/App.config
  testlinq/2013/LINQ/
  testlinq/2013/LINQ/App.config
  testlinq/2015/
  testlinq/2015/EF6/
  testlinq/2015/EF6/App.config
  testlinq/2015/LINQ/
  testlinq/2015/LINQ/App.config
  testlinq/2017/
  testlinq/2017/EF6/
  testlinq/2017/EF6/App.config
  testlinq/2017/LINQ/
  testlinq/2017/LINQ/App.config
  testlinq/NetStandard21/
  testlinq/NetStandard21/EF6/
  testlinq/NetStandard21/EF6/App.config
  testlinq/northwindEF.db
  testlinq/NorthwindModel.EF6.2010.Designer.cs
  testlinq/NorthwindModel.EF6.2010.edmx
  testlinq/NorthwindModel.EF6.2012.Designer.cs
  testlinq/NorthwindModel.EF6.2012.edmx
  testlinq/NorthwindModel.EF6.2013.Designer.cs
  testlinq/NorthwindModel.EF6.2013.edmx
  testlinq/NorthwindModel.EF6.2015.Designer.cs
  testlinq/NorthwindModel.EF6.2015.edmx
  testlinq/NorthwindModel.EF6.2017.Designer.cs
  testlinq/NorthwindModel.EF6.2017.edmx
  testlinq/NorthwindModel.EF6.NetStandard21.Designer.cs
  testlinq/NorthwindModel.EF6.NetStandard21.edmx
  testlinq/NorthwindModel.Linq.2008.Designer.cs
  testlinq/NorthwindModel.Linq.2008.edmx
  testlinq/NorthwindModel.Linq.2010.Designer.cs
  testlinq/NorthwindModel.Linq.2010.edmx
  testlinq/NorthwindModel.Linq.2012.Designer.cs
  testlinq/NorthwindModel.Linq.2012.edmx
  testlinq/NorthwindModel.Linq.2013.Designer.cs
  testlinq/NorthwindModel.Linq.2013.edmx
  testlinq/NorthwindModel.Linq.2015.Designer.cs
  testlinq/NorthwindModel.Linq.2015.edmx
  testlinq/NorthwindModel.Linq.2017.Designer.cs
  testlinq/NorthwindModel.Linq.2017.edmx
  testlinq/Program.cs
  testlinq/Properties/
  testlinq/Properties/AssemblyInfo.cs
  testlinq/test.2010.csproj
  testlinq/test.2012.csproj
  testlinq/test.2013.csproj
  testlinq/test.2015.csproj
  testlinq/test.2017.csproj
  testlinq/testef6.2010.csproj
  testlinq/testef6.2012.csproj
  testlinq/testef6.2013.csproj
  testlinq/testef6.2015.csproj
  testlinq/testef6.2017.csproj
  testlinq/testef6.NetStandard21.csproj
  testlinq/testlinq.2008.csproj
  testlinq/testlinq.2010.csproj
  testlinq/testlinq.2012.csproj
  testlinq/testlinq.2013.csproj
  testlinq/testlinq.2015.csproj
  testlinq/testlinq.2017.csproj
  Tests/
  Tests/all.eagle
  Tests/authorizer.eagle
  Tests/backup.eagle
  Tests/basic.eagle
  Tests/busy.eagle
  Tests/data/
  Tests/data/Installer_Test_Vs2005.log
  Tests/data/Installer_Test_Vs2008.log
  Tests/data/Installer_Test_Vs2010.log
  Tests/data/Installer_Test_Vs2012.log
  Tests/data/Installer_Test_Vs2013.log
  Tests/data/Installer_Test_Vs2015.log
  Tests/data/nonWal.db
  Tests/data/testlinq.out
  Tests/data/Uninstaller_Test_Vs2005.log
  Tests/data/Uninstaller_Test_Vs2008.log
  Tests/data/Uninstaller_Test_Vs2010.log
  Tests/data/Uninstaller_Test_Vs2012.log
  Tests/data/Uninstaller_Test_Vs2013.log
  Tests/data/Uninstaller_Test_Vs2015.log
  Tests/data/wal.db
  Tests/function.eagle
  Tests/installer.eagle
  Tests/linq.eagle
  Tests/memory.eagle
  Tests/pool.eagle
  Tests/progress.eagle
  Tests/pst-4db2934c2e.eagle
  Tests/pst-eeaefb84ec.eagle
  Tests/pst-f4e718891d.eagle
  Tests/session.eagle
  Tests/speed.eagle
  Tests/stress.eagle
  Tests/template/
  Tests/template/empty.eagle
  Tests/thread.eagle
  Tests/tkt-00f86f9739.eagle
  Tests/tkt-0a32885109.eagle
  Tests/tkt-0d5b1ef362.eagle
  Tests/tkt-0e48e80333.eagle
  Tests/tkt-0ed01c447c.eagle
  Tests/tkt-17045010df.eagle
  Tests/tkt-1c456ae75f.eagle
  Tests/tkt-1f7bfff467.eagle
  Tests/tkt-201128cc88.eagle
  Tests/tkt-23d8d6171e.eagle
  Tests/tkt-2556655d1b.eagle
  Tests/tkt-2abbf2c244.eagle
  Tests/tkt-2c630bffa7.eagle
  Tests/tkt-2ce0870fad.eagle
  Tests/tkt-3113734605.eagle
  Tests/tkt-343d392b51.eagle
  Tests/tkt-3567020edf.eagle
  Tests/tkt-393d954be0.eagle
  Tests/tkt-3aa50d8413.eagle
  Tests/tkt-3c00ec5b52.eagle
  Tests/tkt-3e783eecbe.eagle
  Tests/tkt-41aea496e0.eagle
  Tests/tkt-448d663d11.eagle
  Tests/tkt-47c6fa04d3.eagle
  Tests/tkt-47f4bac575.eagle
  Tests/tkt-48a6b8e4ca.eagle
  Tests/tkt-4a791e70ab.eagle
  Tests/tkt-5251bd0878.eagle
  Tests/tkt-53633bbe39.eagle
  Tests/tkt-53962f9eff.eagle
  Tests/tkt-544dba0a2f.eagle
  Tests/tkt-5535448538.eagle
  Tests/tkt-56b42d99c1.eagle
  Tests/tkt-58ed318f2f.eagle
  Tests/tkt-59edc1018b.eagle
  Tests/tkt-5cee5409f8.eagle
  Tests/tkt-6434e23a0f.eagle
  Tests/tkt-647d282d11.eagle
  Tests/tkt-69cf6e5dc8.eagle
  Tests/tkt-6c6ecccc5f.eagle
  Tests/tkt-71bedaca19.eagle
  Tests/tkt-72905c9a77.eagle
  Tests/tkt-74542e702e.eagle
  Tests/tkt-7714b60d61.eagle
  Tests/tkt-7c151a2f0e.eagle
  Tests/tkt-7e3fa93744.eagle
  Tests/tkt-84718e79fa.eagle
  Tests/tkt-8554170e09.eagle
  Tests/tkt-85b824b736.eagle
  Tests/tkt-8b7d179c3c.eagle
  Tests/tkt-8c3bee31c8.eagle
  Tests/tkt-8d928c3e88.eagle
  Tests/tkt-92dbf1229a.eagle
  Tests/tkt-94252b9059.eagle
  Tests/tkt-964063da16.eagle
  Tests/tkt-996d13cd87.eagle
  Tests/tkt-9ba9346f75.eagle
  Tests/tkt-9d353b0bd8.eagle
  Tests/tkt-a4d9c7ee94.eagle
  Tests/tkt-a799e3978f.eagle
  Tests/tkt-a7d04fb111.eagle
  Tests/tkt-aba4549801.eagle
  Tests/tkt-ac47dd230a.eagle
  Tests/tkt-ae5267b863.eagle
  Tests/tkt-b167206ad3.eagle
  Tests/tkt-b4a7ddc83f.eagle
  Tests/tkt-baf42ee135.eagle
  Tests/tkt-bb4b04d457.eagle
  Tests/tkt-bbddfeb773.eagle
  Tests/tkt-c010fa6584.eagle
  Tests/tkt-c28d7fe915.eagle
  Tests/tkt-ccfa69fc32.eagle
  Tests/tkt-ce4d70ea6f.eagle
  Tests/tkt-d4728aecb7.eagle
  Tests/tkt-da685c0bac.eagle
  Tests/tkt-da9f18d039.eagle
  Tests/tkt-daeaf3150a.eagle
  Tests/tkt-dbd65441a5.eagle
  Tests/tkt-e06c4caff3.eagle
  Tests/tkt-e1b2e0f769.eagle
  Tests/tkt-e22d357a21.eagle
  Tests/tkt-e30b820248.eagle
  Tests/tkt-e36e05e299.eagle
  Tests/tkt-e47b3d8346.eagle
  Tests/tkt-ef2216192d.eagle
  Tests/tkt-f2c47a01eb.eagle
  Tests/tkt-f8dbab8baf.eagle
  Tests/tkt-fe50b8c2e8.eagle
  Tests/types.eagle
  Tests/version.eagle
  Tests/vtab.eagle
  tools/
  tools/install/
  tools/install/Installer.2005.csproj
  tools/install/Installer.2008.csproj
  tools/install/Installer.2010.csproj
  tools/install/Installer.2012.csproj
  tools/install/Installer.2013.csproj
  tools/install/Installer.2015.csproj
  tools/install/Installer.2017.csproj
  tools/install/Installer.cs
  tools/install/Properties/
  tools/install/Properties/AssemblyInfo.cs
  tools/install/Resources/
  tools/install/Resources/manifest.xml
}

###############################################################################
#
# NOTE: This is the list of Eagle files that should be present in the full
#       source code archive.  These files are needed only to run the test
#       suite.
#
set sds_manifests(eagle) {
  Externals/Eagle/bin/net5/
  Externals/Eagle/bin/net5/Eagle.dll
  Externals/Eagle/bin/net5/EagleShell.dll
  Externals/Eagle/bin/net5/EagleShell.runtimeconfig.json
  Externals/Eagle/bin/net6/
  Externals/Eagle/bin/net6/Eagle.dll
  Externals/Eagle/bin/net6/EagleShell.dll
  Externals/Eagle/bin/net6/EagleShell.runtimeconfig.json
  Externals/Eagle/bin/netCore20/
  Externals/Eagle/bin/netCore20/Eagle.dll
  Externals/Eagle/bin/netCore20/EagleShell.dll
  Externals/Eagle/bin/netCore20/EagleShell.runtimeconfig.json
  Externals/Eagle/bin/netCore30/
  Externals/Eagle/bin/netCore30/Eagle.dll
  Externals/Eagle/bin/netCore30/EagleShell.dll
  Externals/Eagle/bin/netCore30/EagleShell.runtimeconfig.json
  Externals/Eagle/bin/netFramework20/Eagle.dll
  Externals/Eagle/bin/netFramework20/EagleShell.exe
  Externals/Eagle/bin/netFramework20/EagleShell.exe.mda.config
  Externals/Eagle/bin/netFramework20/EagleShell32.exe
  Externals/Eagle/bin/netFramework20/x64/
  Externals/Eagle/bin/netFramework20/x64/Spilornis.dll
  Externals/Eagle/bin/netFramework20/x86/
  Externals/Eagle/bin/netFramework20/x86/Spilornis.dll
  Externals/Eagle/bin/netFramework40/Eagle.dll
  Externals/Eagle/bin/netFramework40/EagleShell.exe
  Externals/Eagle/bin/netFramework40/EagleShell.exe.mda.config
  Externals/Eagle/bin/netFramework40/EagleShell32.exe
  Externals/Eagle/bin/netFramework40/x64/
  Externals/Eagle/bin/netFramework40/x64/Spilornis.dll
  Externals/Eagle/bin/netFramework40/x86/
  Externals/Eagle/bin/netFramework40/x86/Spilornis.dll
  Externals/Eagle/lib/Eagle1.0/auxiliary.eagle
  Externals/Eagle/lib/Eagle1.0/compat.eagle
  Externals/Eagle/lib/Eagle1.0/csharp.eagle
  Externals/Eagle/lib/Eagle1.0/database.eagle
  Externals/Eagle/lib/Eagle1.0/embed.eagle
  Externals/Eagle/lib/Eagle1.0/exec.eagle
  Externals/Eagle/lib/Eagle1.0/file1.eagle
  Externals/Eagle/lib/Eagle1.0/file2.eagle
  Externals/Eagle/lib/Eagle1.0/file3.eagle
  Externals/Eagle/lib/Eagle1.0/info.eagle
  Externals/Eagle/lib/Eagle1.0/init.eagle
  Externals/Eagle/lib/Eagle1.0/list.eagle
  Externals/Eagle/lib/Eagle1.0/object.eagle
  Externals/Eagle/lib/Eagle1.0/pkgIndex.eagle
  Externals/Eagle/lib/Eagle1.0/pkgIndex.tcl
  Externals/Eagle/lib/Eagle1.0/pkgt.eagle
  Externals/Eagle/lib/Eagle1.0/platform.eagle
  Externals/Eagle/lib/Eagle1.0/process.eagle
  Externals/Eagle/lib/Eagle1.0/runopt.eagle
  Externals/Eagle/lib/Eagle1.0/safe.eagle
  Externals/Eagle/lib/Eagle1.0/shell.eagle
  Externals/Eagle/lib/Eagle1.0/shim.eagle
  Externals/Eagle/lib/Eagle1.0/test.eagle
  Externals/Eagle/lib/Eagle1.0/testlog.eagle
  Externals/Eagle/lib/Eagle1.0/unkobj.eagle
  Externals/Eagle/lib/Eagle1.0/unzip.eagle
  Externals/Eagle/lib/Eagle1.0/update.eagle
  Externals/Eagle/lib/Eagle1.0/vendor.eagle
  Externals/Eagle/lib/Eagle1.0/word.tcl
  Externals/Eagle/lib/Test1.0/
  Externals/Eagle/lib/Test1.0/all.eagle
  Externals/Eagle/lib/Test1.0/constraints.eagle
  Externals/Eagle/lib/Test1.0/epilogue.eagle
  Externals/Eagle/lib/Test1.0/pkgIndex.eagle
  Externals/Eagle/lib/Test1.0/pkgIndex.tcl
  Externals/Eagle/lib/Test1.0/prologue.eagle
  Externals/Eagle/Targets/
  Externals/Eagle/Targets/Eagle.Builds.targets
  Externals/Eagle/Targets/Eagle.Presets.targets
  Externals/Eagle/Targets/Eagle.Sample.targets
  Externals/Eagle/Targets/Eagle.Settings.targets
  Externals/Eagle/Targets/Eagle.targets
  Externals/Eagle/Targets/Eagle.tasks
}

###############################################################################
#
# NOTE: This is the list of external files that should be present in the full
#       source code archive.  These files may be required by the build and/or
#       during release processing.  If missing, some features and/or build
#       options may be unavailable.
#
set sds_manifests(external) {
  Externals/NuGet/
  Externals/NuGet/NuGet.exe
  Externals/ResGen/
  Externals/ResGen/ResGen.exe
  Externals/ResGen/ResGen.exe.config
  Externals/vswhere/
  Externals/vswhere/vswhere.exe
}

###############################################################################
#
# NOTE: This is the list of core files that should be present in all binary
#       archives that support the desktop versions of the .NET Framework.
#
set sds_manifests(binaryCore) {
  System.Data.SQLite.dll
  System.Data.SQLite.dll.config
  System.Data.SQLite.pdb
  System.Data.SQLite.xml
}

###############################################################################
#
# NOTE: This is the list of extra files that should be present in all binary
#       archives that support LINQ (i.e. available with the desktop .NET
#       Framework 3.5 and later).
#
set sds_manifests(binaryLinq) {
  System.Data.SQLite.Linq.dll
  System.Data.SQLite.Linq.pdb
  System.Data.SQLite.Linq.xml
  northwindEF.db
  testlinq.exe
  testlinq.exe.config
  testlinq.pdb
}

###############################################################################
#
# NOTE: This is the list of extra files that should be present in all binary
#       archives that support EF6 on desktop versions of the .NET Framework
#       4.0 and later.
#
set sds_manifests(binaryEf6) {
  System.Data.SQLite.EF6.dll
  System.Data.SQLite.EF6.pdb
  System.Data.SQLite.EF6.xml
  testef6.exe
  testef6.exe.config
  testef6.pdb
}

###############################################################################
#
# NOTE: This is the list of extra files that should be present in all binary
#       archives that support EF6 on .NET Core 3.0 and later.
#
set sds_manifests(binaryEf6NetCore) {
  System.Data.SQLite.EF6.dll
  System.Data.SQLite.EF6.pdb
  System.Data.SQLite.EF6.xml
  northwindEF.db
  testef6.dll
  testef6.dll.config
  testef6.pdb
}

###############################################################################
#
# NOTE: This is the list of extra files that should be present in all binary
#       archives that support the desktop versions of the .NET Framework.
#
set sds_manifests(binaryExtra) {
  Installer.exe
  Installer.pdb
  SQLite.Designer.dll
  SQLite.Designer.pdb
  SQLite.Designer.xml
  test.exe
  test.exe.config
  test.pdb
}

###############################################################################
#
# NOTE: This is the list of core interop files that should be present in the
#       standard binary archives (i.e. those not containing the mixed-mode
#       assembly).
#
set sds_manifests(binaryInterop) {
  SQLite.Interop.dll
  SQLite.Interop.pdb
}

###############################################################################
#
# NOTE: This is the list of interop and other files that should be present in
#       the standard "PocketPC" / "WinCE" binary archives (i.e. for the .NET
#       Compact Framework).
#
set sds_manifests(binaryCompact) {
  [appendArgs SQLite.Interop. [format %03d $build] .dll]
  [appendArgs SQLite.Interop. [format %03d $build] .pdb]
  test.cfg
  test.sql
  testce.exe
  testce.pdb
}

###############################################################################
#
# NOTE: This is the list of core files that should be present in all setup
#       archives supporting the desktop versions of the .NET Framework.
#
set sds_manifests(setupCore) {
  {{app}\System.Data.SQLite.url}
  {{app}\readme.htm}
  {{app}\bin\System.Data.SQLite.pdb}
  {{app}\doc\SQLite.NET.chm}
  {{app}\bin\SQLite.Designer.dll}
  {{app}\bin\SQLite.Designer.pdb}
  {{app}\bin\System.Data.SQLite.dll.config}
  {{app}\bin\Installer.exe}
  {{app}\bin\Installer.pdb}
  {{app}\bin\test.exe}
  {{app}\bin\test.pdb}
  {{app}\bin\test.exe.config}
  install_script.iss
}

###############################################################################
#
# NOTE: This is the list of core files that should be present in all setup
#       archives that support LINQ (i.e. available with the desktop .NET
#       Framework 3.5 and later).
#
set sds_manifests(setupLinqCore) {
  {{app}\bin\System.Data.SQLite.Linq.pdb}
  {{app}\bin\testlinq.exe}
  {{app}\bin\testlinq.pdb}
  {{app}\bin\testlinq.exe.config}
  {{app}\bin\northwindEF.db}
}

###############################################################################
#
# NOTE: This is the list of core files that should be present in all setup
#       archives that support EF6 (i.e. available with the desktop .NET
#       Framework 4.0 and later).
#
set sds_manifests(setupEf6Core) {
  {{app}\bin\System.Data.SQLite.EF6.pdb}
  {{app}\bin\testef6.exe}
  {{app}\bin\testef6.pdb}
  {{app}\bin\testef6.exe.config}
}

###############################################################################
#
# NOTE: This is the list of core interop files that should be present in the
#       standard setup archives (i.e. those not containing the mixed-mode
#       assembly) that support the desktop versions of the .NET Framework.
#
set sds_manifests(setupInterop) {
  {{app}\bin\System.Data.SQLite.dll}
  {{app}\bin\SQLite.Interop.dll}
  {{app}\bin\SQLite.Interop.pdb}
}

###############################################################################
#
# NOTE: This is the list of core files that should be present in the bundled
#       setup archives (i.e. those containing the mixed-mode assembly) that
#       support the desktop versions of the .NET Framework.
#
set sds_manifests(setupBundle) {
  {{app}\GAC\System.Data.SQLite.dll}
}

###############################################################################
#
# NOTE: This is the list of core interop files that should be present in the
#       standard setup archives (i.e. those not containing the mixed-mode
#       assembly) that support LINQ (i.e. available with the desktop .NET
#       Framework 3.5 and later).
#
set sds_manifests(setupLinqInterop) {
  {{app}\bin\System.Data.SQLite.Linq.dll}
}

###############################################################################
#
# NOTE: This is the list of core files that should be present in the bundled
#       setup archives (i.e. those containing the mixed-mode assembly) that
#       support LINQ (i.e. available with the desktop .NET Framework 3.5 and
#       later).
#
set sds_manifests(setupLinqBundle) {
  {{app}\GAC\System.Data.SQLite.Linq.dll}
}

###############################################################################
#
# NOTE: This is the list of core interop files that should be present in the
#       standard setup archives (i.e. those not containing the mixed-mode
#       assembly) that support EF6 (i.e. available with the desktop .NET
#       Framework 4.0 and later).
#
set sds_manifests(setupEf6Interop) {
  {{app}\bin\EntityFramework.dll}
  {{app}\bin\System.Data.SQLite.EF6.dll}
}

###############################################################################
#
# NOTE: This is the list of core files that should be present in the bundled
#       setup archives (i.e. those containing the mixed-mode assembly) that
#       support EF6 (i.e. available with the desktop .NET Framework 4.0 and
#       later).
#
set sds_manifests(setupEf6Bundle) {
  {{app}\bin\EntityFramework.dll}
  {{app}\GAC\System.Data.SQLite.EF6.dll}
}

###############################################################################
#
# NOTE: This is the list of files that should be present in all setup archives
#       supporting the .NET Framework 2.0 for x86.
#
set sds_manifests(setupX86Vs2005) {
  {{tmp}\vcredist_x86_2005_SP1_MFC.exe}
}

###############################################################################
#
# NOTE: This is the list of files that should be present in all setup archives
#       supporting the .NET Framework 2.0 for x64.
#
set sds_manifests(setupX64Vs2005) {
  {{tmp}\vcredist_x64_2005_SP1_MFC.exe}
}

###############################################################################
#
# NOTE: This is the list of files that should be present in all setup archives
#       supporting the .NET Framework 3.5 for x86.
#
set sds_manifests(setupX86Vs2008) {
  {{tmp}\vcredist_x86_2008_SP1_MFC.exe}
}

###############################################################################
#
# NOTE: This is the list of files that should be present in all setup archives
#       supporting the .NET Framework 3.5 for x64.
#
set sds_manifests(setupX64Vs2008) {
  {{tmp}\vcredist_x64_2008_SP1_MFC.exe}
}

###############################################################################
#
# NOTE: This is the list of files that should be present in all setup archives
#       supporting the .NET Framework 4.0 for x86.
#
set sds_manifests(setupX86Vs2010) {
  {{tmp}\vcredist_x86_2010_SP1_MFC.exe}
}

###############################################################################
#
# NOTE: This is the list of files that should be present in all setup archives
#       supporting the .NET Framework 4.0 for x64.
#
set sds_manifests(setupX64Vs2010) {
  {{tmp}\vcredist_x64_2010_SP1_MFC.exe}
}

###############################################################################
#
# NOTE: This is the list of files that should be present in all setup archives
#       supporting the .NET Framework 4.5 for x86.
#
set sds_manifests(setupX86Vs2012) {
  {{tmp}\vcredist_x86_2012_VSU4.exe}
}

###############################################################################
#
# NOTE: This is the list of files that should be present in all setup archives
#       supporting the .NET Framework 4.5 for x64.
#
set sds_manifests(setupX64Vs2012) {
  {{tmp}\vcredist_x64_2012_VSU4.exe}
}

###############################################################################
#
# NOTE: This is the list of files that should be present in all setup archives
#       supporting the .NET Framework 4.5.1 for x86.
#
set sds_manifests(setupX86Vs2013) {
  {{tmp}\vcredist_x86_2013_VSU2.exe}
}

###############################################################################
#
# NOTE: This is the list of files that should be present in all setup archives
#       supporting the .NET Framework 4.5.1 for x64.
#
set sds_manifests(setupX64Vs2013) {
  {{tmp}\vcredist_x64_2013_VSU2.exe}
}

###############################################################################
#
# NOTE: This is the list of files that should be present in all setup archives
#       supporting the .NET Framework 4.6 for x86.
#
set sds_manifests(setupX86Vs2015) {
  {{tmp}\vcredist_x86_2015_VSU3.exe}
}

###############################################################################
#
# NOTE: This is the list of files that should be present in all setup archives
#       supporting the .NET Framework 4.6 for x64.
#
set sds_manifests(setupX64Vs2015) {
  {{tmp}\vcredist_x64_2015_VSU3.exe}
}

###############################################################################
#
# NOTE: This is the list of all files that should be present in all NuGet
#       packages.
#
set sds_manifests(nuGetMetadata) {
  _rels/.rels
  [Content_Types].xml
  package/services/metadata/core-properties/${md5}.psmdcp
}

###############################################################################
#
# NOTE: This is the list of all files that should be present in all NuGet
#       packages that include the primary assembly, whether managed only
#       or mixed-mode, for the .NET Framework.
#
set sds_manifests(nuGetCoreNetFrameworkManagedOnly) {
  lib/net20/System.Data.SQLite.dll
  lib/net20/System.Data.SQLite.xml
  lib/net40/System.Data.SQLite.dll
  lib/net40/System.Data.SQLite.xml
  lib/net45/System.Data.SQLite.dll
  lib/net45/System.Data.SQLite.xml
  lib/net451/System.Data.SQLite.dll
  lib/net451/System.Data.SQLite.xml
  lib/net46/System.Data.SQLite.dll
  lib/net46/System.Data.SQLite.xml
}

###############################################################################
#
# NOTE: This is the list of all files that should be present in all core
#       NuGet packages that include the primary managed-only assembly,
#       for the .NET Standard.
#
set sds_manifests(nuGetCoreNetStandardManagedOnly) {
  lib/netstandard2.0/System.Data.SQLite.dll
  lib/netstandard2.0/System.Data.SQLite.xml
  lib/netstandard2.1/System.Data.SQLite.dll
  lib/netstandard2.1/System.Data.SQLite.xml
}

###############################################################################
#
# NOTE: This is the list of all files that should be present in all core
#       NuGet packages that include the primary interop assemblies, for
#       the .NET Framework.
#
set sds_manifests(nuGetCoreNetFrameworkNativeOnly) {
  build/net20/x64/SQLite.Interop.dll
  build/net20/x86/SQLite.Interop.dll
  build/net40/x64/SQLite.Interop.dll
  build/net40/x86/SQLite.Interop.dll
  build/net45/x64/SQLite.Interop.dll
  build/net45/x86/SQLite.Interop.dll
  build/net451/x64/SQLite.Interop.dll
  build/net451/x86/SQLite.Interop.dll
  build/net46/x64/SQLite.Interop.dll
  build/net46/x86/SQLite.Interop.dll
  build/net20/Stub.System.Data.SQLite.Core.NetFramework.targets
  build/net40/Stub.System.Data.SQLite.Core.NetFramework.targets
  build/net45/Stub.System.Data.SQLite.Core.NetFramework.targets
  build/net451/Stub.System.Data.SQLite.Core.NetFramework.targets
  build/net46/Stub.System.Data.SQLite.Core.NetFramework.targets
  buildTransitive/net20/Stub.System.Data.SQLite.Core.NetFramework.targets
  buildTransitive/net40/Stub.System.Data.SQLite.Core.NetFramework.targets
  buildTransitive/net45/Stub.System.Data.SQLite.Core.NetFramework.targets
  buildTransitive/net451/Stub.System.Data.SQLite.Core.NetFramework.targets
  buildTransitive/net46/Stub.System.Data.SQLite.Core.NetFramework.targets
}

###############################################################################
#
# NOTE: This is the list of all files that should be present in all core
#       NuGet packages that include the primary interop assemblies, for
#       the the .NET Standard.
#
set sds_manifests(nuGetCoreNetStandardNativeOnly) {
  runtimes/win-x86/native/SQLite.Interop.dll
  runtimes/win-x64/native/SQLite.Interop.dll
  runtimes/linux-x64/native/SQLite.Interop.dll
  runtimes/osx-x64/native/SQLite.Interop.dll
}

###############################################################################
#
# NOTE: This is the list of all files that should be present in all NuGet
#       packages that include support for the Entity Framework 6.x.
#
set sds_manifests(nuGetEf6) {
  System.Data.SQLite.EF6.nuspec
  content/net40/app.config.install.xdt
  content/net40/web.config.install.xdt
  content/net40/app.config.transform
  content/net40/web.config.transform
  content/net45/app.config.install.xdt
  content/net45/web.config.install.xdt
  content/net45/app.config.transform
  content/net45/web.config.transform
  content/net451/app.config.install.xdt
  content/net451/web.config.install.xdt
  content/net451/app.config.transform
  content/net451/web.config.transform
  content/net46/app.config.install.xdt
  content/net46/web.config.install.xdt
  content/net46/app.config.transform
  content/net46/web.config.transform
  lib/net40/System.Data.SQLite.EF6.dll
  lib/net45/System.Data.SQLite.EF6.dll
  lib/net451/System.Data.SQLite.EF6.dll
  lib/net46/System.Data.SQLite.EF6.dll
  lib/netstandard2.1/System.Data.SQLite.EF6.dll
  tools/net40/install.ps1
  tools/net45/install.ps1
  tools/net451/install.ps1
  tools/net46/install.ps1
}

###############################################################################
#
# NOTE: This is the list of all files that should be present in all NuGet
#       packages that include support for LINQ.
#
set sds_manifests(nuGetLinq) {
  System.Data.SQLite.Linq.nuspec
  content/net20/app.config.transform
  content/net20/web.config.transform
  content/net40/app.config.transform
  content/net40/web.config.transform
  content/net45/app.config.transform
  content/net45/web.config.transform
  content/net451/app.config.transform
  content/net451/web.config.transform
  content/net46/app.config.transform
  content/net46/web.config.transform
  lib/net20/System.Data.SQLite.Linq.dll
  lib/net40/System.Data.SQLite.Linq.dll
  lib/net45/System.Data.SQLite.Linq.dll
  lib/net451/System.Data.SQLite.Linq.dll
  lib/net46/System.Data.SQLite.Linq.dll
}

###############################################################################
#
# NOTE: This is the list of all files that should be present in the primary
#       NuGet package.
#
set sds_manifests(nuGetPrimary) {
  System.Data.SQLite.nuspec
}

###############################################################################
#
# NOTE: This is the list of all files that should be present in the core
#       NuGet package.
#
set sds_manifests(nuGetCore) {
  System.Data.SQLite.Core.nuspec
}

###############################################################################
#
# NOTE: This is the list of all files that should be present in the core
#       NuGet package that includes only the primary managed assembly.
#
set sds_manifests(nuGetCoreMsil) {
  System.Data.SQLite.Core.MSIL.nuspec
}

###############################################################################
#
# NOTE: This is the list of all files that should be present in the core
#       NuGet package for the .NET Framework.
#
set sds_manifests(nuGetCoreNetFramework) {
  Stub.System.Data.SQLite.Core.NetFramework.nuspec
  lib/net20/System.Data.SQLite.dll.altconfig
  lib/net40/System.Data.SQLite.dll.altconfig
  lib/net45/System.Data.SQLite.dll.altconfig
  lib/net451/System.Data.SQLite.dll.altconfig
  lib/net46/System.Data.SQLite.dll.altconfig
}

###############################################################################
#
# NOTE: This is the list of all files that should be present in the core
#       NuGet package for the .NET Standard.
#
set sds_manifests(nuGetCoreNetStandard) {
  Stub.System.Data.SQLite.Core.NetStandard.nuspec
  lib/netstandard2.0/System.Data.SQLite.dll.altconfig
  lib/netstandard2.1/System.Data.SQLite.dll.altconfig
}

###############################################################################
#
# NOTE: This is the list of all files that should be present in the NuGet
#       package that includes only the managed assemblies.
#
set sds_manifests(nuGetMsil) {
  System.Data.SQLite.MSIL.nuspec
}

###############################################################################
#
# NOTE: This is the list of all files that should be present in the NuGet
#       package that includes the mixed-mode assembly for x64.
#
set sds_manifests(nuGetX64) {
  System.Data.SQLite.x64.nuspec
}

###############################################################################
#
# NOTE: This is the list of all files that should be present in the NuGet
#       package that includes the mixed-mode assembly for x86.
#
set sds_manifests(nuGetX86) {
  System.Data.SQLite.x86.nuspec
}

###############################################################################
#
# NOTE: These are the master archive manifest groups, based on file name.  The
#       first element in each list is the array variable name prefix used to
#       locate another array containing the named elements referenced by the
#       remaining elements in each list.  Here is an example:
#
#       1. First, the archive file name has the patch level removed from it.
#          Next, it is mapped to the name of the array containing the file
#          lists via the first element of the corresponding list.
#
#       [lindex $manifests(EagleCore.exe) 0] ==> eagle ==> eagle_manifests
#
#       2. Next, the remaining elements are used to query the named file lists
#          from the array discovered in the previous step.
#
#       [lrange $manifests(EagleCore.exe) 1 end] ==> core library
#
#       3. Finally, the final list of files for this archive file name is built
#          by combining all the file names in the file lists discovered in the
#          previous step.  Duplicate file names, if any, should be harmless.
#
#       $result == $eagle_manifests(core) UNION $eagle_manifests(library)
#
###############################################################################
############################ Source Code Packages #############################
###############################################################################

set manifests(sqlite-netFx-source-.zip) [list sds \
    source]

set manifests(sqlite-netFx-full-source-.zip) [list sds \
    source eagle external]

###############################################################################
################### Visual Studio 2005 / .NET Framework 2.0 ###################
############################### Binary Packages ###############################
###############################################################################

set manifests(sqlite-netFx20-binary-Win32-2005-.zip) [list sds \
    binaryCore binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx20-binary-x64-2005-.zip) [list sds \
    binaryCore binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx20-binary-bundle-Win32-2005-.zip) [list sds \
    binaryCore binaryExtra]

###############################################################################

set manifests(sqlite-netFx20-binary-bundle-x64-2005-.zip) [list sds \
    binaryCore binaryExtra]

###############################################################################

set manifests(sqlite-netFx20-static-binary-Win32-2005-.zip) [list sds \
    binaryCore binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx20-static-binary-x64-2005-.zip) [list sds \
    binaryCore binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx20-static-binary-bundle-Win32-2005-.zip) [list sds \
    binaryCore binaryExtra]

###############################################################################

set manifests(sqlite-netFx20-static-binary-bundle-x64-2005-.zip) [list sds \
    binaryCore binaryExtra]

###############################################################################
################### Visual Studio 2005 / .NET Framework 2.0 ###################
############################### Setup Packages ################################
###############################################################################

set manifests(sqlite-netFx20-setup-x86-2005-.exe) [list sds \
    setupCore setupInterop setupX86Vs2005]

###############################################################################

set manifests(sqlite-netFx20-setup-x64-2005-.exe) [list sds \
    setupCore setupInterop setupX64Vs2005]

###############################################################################

set manifests(sqlite-netFx20-setup-bundle-x86-2005-.exe) [list sds \
    setupCore setupBundle setupX86Vs2005]

###############################################################################

set manifests(sqlite-netFx20-setup-bundle-x64-2005-.exe) [list sds \
    setupCore setupBundle setupX64Vs2005]

###############################################################################
################### Visual Studio 2008 / .NET Framework 3.5 ###################
############################### Binary Packages ###############################
###############################################################################

set manifests(sqlite-netFx35-binary-Win32-2008-.zip) [list sds \
    binaryCore binaryLinq binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx35-binary-x64-2008-.zip) [list sds \
    binaryCore binaryLinq binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx35-binary-bundle-Win32-2008-.zip) [list sds \
    binaryCore binaryLinq binaryExtra]

###############################################################################

set manifests(sqlite-netFx35-binary-bundle-x64-2008-.zip) [list sds \
    binaryCore binaryLinq binaryExtra]

###############################################################################

set manifests(sqlite-netFx35-static-binary-Win32-2008-.zip) [list sds \
    binaryCore binaryLinq binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx35-static-binary-x64-2008-.zip) [list sds \
    binaryCore binaryLinq binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx35-static-binary-bundle-Win32-2008-.zip) [list sds \
    binaryCore binaryLinq binaryExtra]

###############################################################################

set manifests(sqlite-netFx35-static-binary-bundle-x64-2008-.zip) [list sds \
    binaryCore binaryLinq binaryExtra]

###############################################################################
################### Visual Studio 2008 / .NET Framework 3.5 ###################
############################### Setup Packages ################################
###############################################################################

set manifests(sqlite-netFx35-setup-x86-2008-.exe) [list sds \
    setupCore setupLinqCore setupInterop setupLinqInterop setupX86Vs2008]

###############################################################################

set manifests(sqlite-netFx35-setup-x64-2008-.exe) [list sds \
    setupCore setupLinqCore setupInterop setupLinqInterop setupX64Vs2008]

###############################################################################

set manifests(sqlite-netFx35-setup-bundle-x86-2008-.exe) [list sds \
    setupCore setupLinqCore setupBundle setupLinqBundle setupX86Vs2008]

###############################################################################

set manifests(sqlite-netFx35-setup-bundle-x64-2008-.exe) [list sds \
    setupCore setupLinqCore setupBundle setupLinqBundle setupX64Vs2008]

###############################################################################
############### Visual Studio 2008 / .NET Compact Framework 3.5 ###############
############################### Binary Packages ###############################
###############################################################################

set manifests(sqlite-netFx35-binary-PocketPC-ARM-2008-.zip) [list sds \
    binaryCore binaryCompact]

set manifests(sqlite-netFx35-binary-PocketPC-ARM-2008-.zip,subst) ""; # dynamic

###############################################################################
################### Visual Studio 2010 / .NET Framework 4.0 ###################
############################### Binary Packages ###############################
###############################################################################

set manifests(sqlite-netFx40-binary-Win32-2010-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx40-binary-x64-2010-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx40-binary-bundle-Win32-2010-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx40-binary-bundle-x64-2010-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx40-static-binary-Win32-2010-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx40-static-binary-x64-2010-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx40-static-binary-bundle-Win32-2010-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx40-static-binary-bundle-x64-2010-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################
################### Visual Studio 2010 / .NET Framework 4.0 ###################
############################### Setup Packages ################################
###############################################################################

set manifests(sqlite-netFx40-setup-x86-2010-.exe) [list sds \
    setupCore setupInterop setupLinqCore setupEf6Core setupLinqInterop \
    setupEf6Interop setupX86Vs2010]

###############################################################################

set manifests(sqlite-netFx40-setup-x64-2010-.exe) [list sds \
    setupCore setupInterop setupLinqCore setupEf6Core setupLinqInterop \
    setupEf6Interop setupX64Vs2010]

###############################################################################

set manifests(sqlite-netFx40-setup-bundle-x86-2010-.exe) [list sds \
    setupCore setupBundle setupLinqCore setupEf6Core setupLinqBundle \
    setupEf6Bundle setupX86Vs2010]

###############################################################################

set manifests(sqlite-netFx40-setup-bundle-x64-2010-.exe) [list sds \
    setupCore setupBundle setupLinqCore setupEf6Core setupLinqBundle \
    setupEf6Bundle setupX64Vs2010]

###############################################################################
################### Visual Studio 2012 / .NET Framework 4.5 ###################
############################### Binary Packages ###############################
###############################################################################

set manifests(sqlite-netFx45-binary-Win32-2012-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx45-binary-x64-2012-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx45-binary-bundle-Win32-2012-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx45-binary-bundle-x64-2012-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx45-static-binary-Win32-2012-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx45-static-binary-x64-2012-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx45-static-binary-bundle-Win32-2012-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx45-static-binary-bundle-x64-2012-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################
################### Visual Studio 2012 / .NET Framework 4.5 ###################
############################### Setup Packages ################################
###############################################################################

set manifests(sqlite-netFx45-setup-x86-2012-.exe) [list sds \
    setupCore setupInterop setupLinqCore setupEf6Core setupLinqInterop \
    setupEf6Interop setupX86Vs2012]

###############################################################################

set manifests(sqlite-netFx45-setup-x64-2012-.exe) [list sds \
    setupCore setupInterop setupLinqCore setupEf6Core setupLinqInterop \
    setupEf6Interop setupX64Vs2012]

###############################################################################

set manifests(sqlite-netFx45-setup-bundle-x86-2012-.exe) [list sds \
    setupCore setupBundle setupLinqCore setupEf6Core setupLinqBundle \
    setupEf6Bundle setupX86Vs2012]

###############################################################################

set manifests(sqlite-netFx45-setup-bundle-x64-2012-.exe) [list sds \
    setupCore setupBundle setupLinqCore setupEf6Core setupLinqBundle \
    setupEf6Bundle setupX64Vs2012]

###############################################################################
############### Visual Studio 2012 / .NET Compact Framework 3.9 ###############
############################### Binary Packages ###############################
###############################################################################

set manifests(sqlite-netFx39-binary-WinCE-ARM-2012-.zip) [list sds \
    binaryCore binaryCompact]

set manifests(sqlite-netFx39-binary-WinCE-ARM-2012-.zip,subst) ""; # dynamic

###############################################################################

set manifests(sqlite-netFx39-binary-WinCE-x86-2012-.zip) [list sds \
    binaryCore binaryCompact]

set manifests(sqlite-netFx39-binary-WinCE-x86-2012-.zip,subst) ""; # dynamic

###############################################################################
################## Visual Studio 2013 / .NET Framework 4.5.1 ##################
############################### Binary Packages ###############################
###############################################################################

set manifests(sqlite-netFx451-binary-Win32-2013-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx451-binary-x64-2013-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx451-binary-bundle-Win32-2013-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx451-binary-bundle-x64-2013-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx451-static-binary-Win32-2013-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx451-static-binary-x64-2013-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx451-static-binary-bundle-Win32-2013-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx451-static-binary-bundle-x64-2013-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx451-binary-Mono-2013-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################
################## Visual Studio 2013 / .NET Framework 4.5.1 ##################
############################### Setup Packages ################################
###############################################################################

set manifests(sqlite-netFx451-setup-x86-2013-.exe) [list sds \
    setupCore setupInterop setupLinqCore setupEf6Core setupLinqInterop \
    setupEf6Interop setupX86Vs2013]

###############################################################################

set manifests(sqlite-netFx451-setup-x64-2013-.exe) [list sds \
    setupCore setupInterop setupLinqCore setupEf6Core setupLinqInterop \
    setupEf6Interop setupX64Vs2013]

###############################################################################

set manifests(sqlite-netFx451-setup-bundle-x86-2013-.exe) [list sds \
    setupCore setupBundle setupLinqCore setupEf6Core setupLinqBundle \
    setupEf6Bundle setupX86Vs2013]

###############################################################################

set manifests(sqlite-netFx451-setup-bundle-x64-2013-.exe) [list sds \
    setupCore setupBundle setupLinqCore setupEf6Core setupLinqBundle \
    setupEf6Bundle setupX64Vs2013]

###############################################################################
################### Visual Studio 2015 / .NET Framework 4.6 ###################
############################### Binary Packages ###############################
###############################################################################

set manifests(sqlite-netFx46-binary-Win32-2015-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx46-binary-x64-2015-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx46-binary-bundle-Win32-2015-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx46-binary-bundle-x64-2015-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx46-static-binary-Win32-2015-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx46-static-binary-x64-2015-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx46-static-binary-bundle-Win32-2015-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx46-static-binary-bundle-x64-2015-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################
################### Visual Studio 2015 / .NET Framework 4.6 ###################
############################### Setup Packages ################################
###############################################################################

set manifests(sqlite-netFx46-setup-x86-2015-.exe) [list sds \
    setupCore setupInterop setupLinqCore setupEf6Core setupLinqInterop \
    setupEf6Interop setupX86Vs2015]

###############################################################################

set manifests(sqlite-netFx46-setup-x64-2015-.exe) [list sds \
    setupCore setupInterop setupLinqCore setupEf6Core setupLinqInterop \
    setupEf6Interop setupX64Vs2015]

###############################################################################

set manifests(sqlite-netFx46-setup-bundle-x86-2015-.exe) [list sds \
    setupCore setupBundle setupLinqCore setupEf6Core setupLinqBundle \
    setupEf6Bundle setupX86Vs2015]

###############################################################################

set manifests(sqlite-netFx46-setup-bundle-x64-2015-.exe) [list sds \
    setupCore setupBundle setupLinqCore setupEf6Core setupLinqBundle \
    setupEf6Bundle setupX64Vs2015]

###############################################################################
################### Visual Studio 2017 / .NET Framework 4.7 ###################
############################### Binary Packages ###############################
###############################################################################

set manifests(sqlite-netFx47-binary-Win32-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx47-binary-x64-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx47-binary-bundle-Win32-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx47-binary-bundle-x64-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx47-static-binary-Win32-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx47-static-binary-x64-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx47-static-binary-bundle-Win32-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx47-static-binary-bundle-x64-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################
################### Visual Studio 2017 / .NET Framework 4.7 ###################
############################### Setup Packages ################################
###############################################################################

set manifests(sqlite-netFx47-setup-x86-2017-.exe) [list sds \
    setupCore setupInterop setupLinqCore setupEf6Core setupLinqInterop \
    setupEf6Interop setupX86Vs2017]

###############################################################################

set manifests(sqlite-netFx47-setup-x64-2017-.exe) [list sds \
    setupCore setupInterop setupLinqCore setupEf6Core setupLinqInterop \
    setupEf6Interop setupX64Vs2017]

###############################################################################

set manifests(sqlite-netFx47-setup-bundle-x86-2017-.exe) [list sds \
    setupCore setupBundle setupLinqCore setupEf6Core setupLinqBundle \
    setupEf6Bundle setupX86Vs2017]

###############################################################################

set manifests(sqlite-netFx47-setup-bundle-x64-2017-.exe) [list sds \
    setupCore setupBundle setupLinqCore setupEf6Core setupLinqBundle \
    setupEf6Bundle setupX64Vs2017]

###############################################################################
################## Visual Studio 2017 / .NET Framework 4.7.1 ##################
############################### Binary Packages ###############################
###############################################################################

set manifests(sqlite-netFx471-binary-Win32-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx471-binary-x64-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx471-binary-bundle-Win32-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx471-binary-bundle-x64-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx471-static-binary-Win32-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx471-static-binary-x64-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx471-static-binary-bundle-Win32-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx471-static-binary-bundle-x64-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################
################## Visual Studio 2017 / .NET Framework 4.7.1 ##################
############################### Setup Packages ################################
###############################################################################

set manifests(sqlite-netFx471-setup-x86-2017-.exe) [list sds \
    setupCore setupInterop setupLinqCore setupEf6Core setupLinqInterop \
    setupEf6Interop setupX86Vs2017]

###############################################################################

set manifests(sqlite-netFx471-setup-x64-2017-.exe) [list sds \
    setupCore setupInterop setupLinqCore setupEf6Core setupLinqInterop \
    setupEf6Interop setupX64Vs2017]

###############################################################################

set manifests(sqlite-netFx471-setup-bundle-x86-2017-.exe) [list sds \
    setupCore setupBundle setupLinqCore setupEf6Core setupLinqBundle \
    setupEf6Bundle setupX86Vs2017]

###############################################################################

set manifests(sqlite-netFx471-setup-bundle-x64-2017-.exe) [list sds \
    setupCore setupBundle setupLinqCore setupEf6Core setupLinqBundle \
    setupEf6Bundle setupX64Vs2017]

###############################################################################
################## Visual Studio 2017 / .NET Framework 4.7.2 ##################
############################### Binary Packages ###############################
###############################################################################

set manifests(sqlite-netFx472-binary-Win32-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx472-binary-x64-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx472-binary-bundle-Win32-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx472-binary-bundle-x64-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx472-static-binary-Win32-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx472-static-binary-x64-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx472-static-binary-bundle-Win32-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx472-static-binary-bundle-x64-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################
################## Visual Studio 2017 / .NET Framework 4.7.2 ##################
############################### Setup Packages ################################
###############################################################################

set manifests(sqlite-netFx472-setup-x86-2017-.exe) [list sds \
    setupCore setupInterop setupLinqCore setupEf6Core setupLinqInterop \
    setupEf6Interop setupX86Vs2017]

###############################################################################

set manifests(sqlite-netFx472-setup-x64-2017-.exe) [list sds \
    setupCore setupInterop setupLinqCore setupEf6Core setupLinqInterop \
    setupEf6Interop setupX64Vs2017]

###############################################################################

set manifests(sqlite-netFx472-setup-bundle-x86-2017-.exe) [list sds \
    setupCore setupBundle setupLinqCore setupEf6Core setupLinqBundle \
    setupEf6Bundle setupX86Vs2017]

###############################################################################

set manifests(sqlite-netFx472-setup-bundle-x64-2017-.exe) [list sds \
    setupCore setupBundle setupLinqCore setupEf6Core setupLinqBundle \
    setupEf6Bundle setupX64Vs2017]

###############################################################################
################### Visual Studio 2017 / .NET Framework 4.8 ###################
############################### Binary Packages ###############################
###############################################################################

set manifests(sqlite-netFx48-binary-Win32-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx48-binary-x64-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx48-binary-bundle-Win32-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx48-binary-bundle-x64-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx48-static-binary-Win32-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx48-static-binary-x64-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra binaryInterop]

###############################################################################

set manifests(sqlite-netFx48-static-binary-bundle-Win32-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################

set manifests(sqlite-netFx48-static-binary-bundle-x64-2017-.zip) [list sds \
    binaryCore binaryLinq binaryEf6 binaryExtra]

###############################################################################
################### Visual Studio 2017 / .NET Framework 4.8 ###################
############################### Setup Packages ################################
###############################################################################

set manifests(sqlite-netFx48-setup-x86-2017-.exe) [list sds \
    setupCore setupInterop setupLinqCore setupEf6Core setupLinqInterop \
    setupEf6Interop setupX86Vs2017]

###############################################################################

set manifests(sqlite-netFx48-setup-x64-2017-.exe) [list sds \
    setupCore setupInterop setupLinqCore setupEf6Core setupLinqInterop \
    setupEf6Interop setupX64Vs2017]

###############################################################################

set manifests(sqlite-netFx48-setup-bundle-x86-2017-.exe) [list sds \
    setupCore setupBundle setupLinqCore setupEf6Core setupLinqBundle \
    setupEf6Bundle setupX86Vs2017]

###############################################################################

set manifests(sqlite-netFx48-setup-bundle-x64-2017-.exe) [list sds \
    setupCore setupBundle setupLinqCore setupEf6Core setupLinqBundle \
    setupEf6Bundle setupX64Vs2017]

###############################################################################
################### Visual Studio 2017 / .NET Standard 2.0 ####################
############################### Binary Packages ###############################
###############################################################################

set manifests(sqlite-netStandard20-binary-.zip) [list sds binaryCore]

###############################################################################
################### Visual Studio 2019 / .NET Standard 2.1 ####################
############################### Binary Packages ###############################
###############################################################################

set manifests(sqlite-netStandard21-binary-.zip) [list sds binaryCore \
    binaryEf6NetCore]

###############################################################################
############################### NuGet Packages ################################
###############################################################################

set manifests(System.Data.SQLite..nupkg) [list sds \
    nuGetMetadata nuGetPrimary]

###############################################################################

set manifests(System.Data.SQLite.Core..nupkg) [list sds \
    nuGetMetadata nuGetCore]

###############################################################################

set manifests(System.Data.SQLite.Core.MSIL..nupkg) [list sds \
    nuGetMetadata nuGetCoreNetFrameworkManagedOnly \
    nuGetCoreNetFrameworkManagedOnly nuGetCoreNetStandardManagedOnly \
    nuGetCoreMsil]

###############################################################################

set manifests(Stub.System.Data.SQLite.Core.NetFramework..nupkg) [list sds \
    nuGetMetadata nuGetCoreNetFrameworkManagedOnly \
    nuGetCoreNetFrameworkNativeOnly nuGetCoreNetFramework]

###############################################################################

set manifests(Stub.System.Data.SQLite.Core.NetStandard..nupkg) [list sds \
    nuGetMetadata nuGetCoreNetStandardManagedOnly \
    nuGetCoreNetStandardNativeOnly nuGetCoreNetStandard]

###############################################################################

set manifests(System.Data.SQLite.EF6..nupkg) [list sds \
    nuGetMetadata nuGetEf6]

###############################################################################

set manifests(System.Data.SQLite.Linq..nupkg) [list sds \
    nuGetMetadata nuGetLinq]

###############################################################################

set manifests(System.Data.SQLite.MSIL..nupkg) [list sds \
    nuGetMetadata nuGetMsil]

###############################################################################

set manifests(System.Data.SQLite.x64..nupkg) [list sds \
    nuGetMetadata nuGetCoreNetFrameworkManagedOnly nuGetX64]

###############################################################################

set manifests(System.Data.SQLite.x86..nupkg) [list sds \
    nuGetMetadata nuGetCoreNetFrameworkManagedOnly nuGetX86]

###############################################################################
# end of file

Added Setup/deployAndTestCe200x.eagle.









































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
###############################################################################
#
# deployAndTestCe200x.eagle -- Windows CE Deployment & Testing Tool
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle

proc usage { error } {
  if {[string length $error] > 0} then {puts stdout $error}

  puts stdout "usage:\
[file tail [info nameofexecutable]]\
[file tail [info script]] \[year\] \[platform\] \[configuration\]\
\[culture\] \[platformId\] \[deviceId\] \[mode\] \[quiet\]"

  #
  # NOTE: Indicate to the caller, if any, that we have failed.
  #
  exit 1
}

#
# NOTE: This procedure will output a diagnostic message, typically to the
#       standard output channel, using the [puts] command unless the global
#       variable "quiet" is non-zero.
#
proc qputs { args } {
  if {![info exists ::quiet] || !$::quiet} then {
    eval puts $args; flush stdout
  }
}

proc showPlatforms { cultureInfo } {
  set datastoreManager [object create -alias \
      Microsoft.SmartDevice.Connectivity.DatastoreManager \
      [$cultureInfo LCID]]

  object foreach -alias platform [$datastoreManager GetPlatforms] {
    qputs stdout [appendArgs \
        "found platform \"" [$platform Id.ToString] "\" with name \"" \
        [$platform Name] \"...]
  }
}

#
# NOTE: This procedure looks up and returns the target device based on the
#       locale, platform Id, and device Id.
#
proc getDevice { cultureInfo platformId deviceId } {
  set datastoreManager [object create -alias \
      Microsoft.SmartDevice.Connectivity.DatastoreManager \
      [$cultureInfo LCID]]

  set platform [$datastoreManager -alias GetPlatform [object create \
      Microsoft.SmartDevice.Connectivity.ObjectId $platformId]]

  if {[string length $deviceId] == 0} then {
    set deviceId [$platform GetDefaultDeviceId]
  }

  set device [$platform -alias GetDevice $deviceId]

  qputs stdout [appendArgs \
      "returning device \"" [$device Name] "\" of platform \"" \
      [$device Platform.ToString] "\" with Id \"" [$device Id.ToString] \
      \"...]

  return $device
}

#
# NOTE: This procedure starts a process on the target device and optionally
#       waits for it to complete.
#
proc startRemoteProcess { device fileName arguments {wait true} } {
  set remoteProcess [$device -alias GetRemoteProcess]

  if {![$remoteProcess Start $fileName $arguments]} then {
    error [appendArgs "could not start remote process \"" $fileName \"]
  }

  if {$wait} then {
    qputs stdout [appendArgs \
        "waiting for remote process " [$remoteProcess GetId] ...]

    while {![$remoteProcess HasExited]} {
      qputs -nonewline stdout .
      after 1000
    }

    qputs stdout ""
    return [$remoteProcess GetExitCode]
  }

  return -1
}

set argc [llength $argv]

if {$argc >= 0 && $argc <= 8} then {
  #
  # NOTE: Setup the default values for all command line options.
  #
  array set default {
            year 2008
        platform {Pocket PC 2003 (ARMV4)}
   configuration Release
         culture en-US
      platformId 3c41c503-53ef-4c2a-8dd4-a8217cad115e
        deviceId {}
            mode test
           quiet false
  }

  #
  # NOTE: Process all the command line options.  If a command line option
  #       is not present, use the default value.
  #
  set names [list \
      year platform configuration culture platformId deviceId mode quiet]

  for {set index 0} {$index < [llength $names]} {incr index} {
    set name [lindex $names $index]; set value ""

    if {$argc > $index} then {
      set value [string trim [lindex $argv $index]]
    }

    if {[string length $value] > 0} then {
      set $name $value; set defaultValue false
    } else {
      set $name $default($name); set defaultValue true
    }

    qputs stdout [appendArgs \
        "named parameter \"" $name "\" value is now \"" [set $name] \" \
        [expr {$defaultValue ? " (default)" : ""}] .]
  }

  #
  # NOTE: Grab the culture instance based on the configured culture name.
  #
  set cultureInfo [object invoke -alias System.Globalization.CultureInfo \
      GetCultureInfo $culture]

  #
  # NOTE: Build the list of .NET Compact Framework 2.0 packages that need to
  #       be deployed to the target device, if necessary.
  #
  if {![info exists packages(2005)]} then {
    #
    # NOTE: The three letter Windows language name is needed when building
    #       the default list of .NET Compact Framework packages because one
    #       of them is a localized resource package.
    #
    set language3 [string toupper \
        [$cultureInfo ThreeLetterWindowsLanguageName]]

    #
    # NOTE: The default list of .NET Compact Framework 2.0 packages contains
    #       the .NET Compact Framework 2.0 installation CAB file for ARMV4
    #       on the Pocket PC and its associated resource installation CAB
    #       files.
    #
    set packages(2005) [list \
        abd785f0-cda7-41c5-8375-2451a7cbff26 \
        \\Windows\\NETCFv2.ppc.armv4.cab \
        c0ccf48e-4bfb-4d84-827c-981a595e40b4 \
        [appendArgs \\Windows\\System_SR_ $language3 .cab]]
  }

  #
  # NOTE: Build the list of .NET Compact Framework 3.5 packages that need to
  #       be deployed to the target device, if necessary.
  #
  if {![info exists packages(2008)]} then {
    #
    # NOTE: The two letter ISO language name is needed when building the
    #       default list of .NET Compact Framework packages because one of
    #       them is a localized resource package.
    #
    set language2 [string toupper \
        [$cultureInfo TwoLetterISOLanguageName]]

    #
    # NOTE: The default list of .NET Compact Framework 3.5 packages contains
    #       the .NET Compact Framework 3.5 installation CAB file for ARMV4
    #       on the Pocket PC and its associated resource installation CAB
    #       files.
    #
    set packages(2008) [list \
        abd785f0-cda7-41c5-8375-2451a7cbff37 \
        \\Windows\\NETCFv35.ppc.armv4.cab \
        c0ccf48e-4bfb-4d84-827c-981a595e40c5 \
        [appendArgs \\Windows\\NETCFv35.Messages. $language2 .cab]]
  }

  #
  # NOTE: Save the path where this script is running from.
  #
  set path [file dirname [info script]]

  #
  # NOTE: The base path should be the project root directory, which should
  #       be one level above the one containing this script.
  #
  if {![info exists base_path]} then {
    set base_path [file dirname $path]
  }

  #
  # NOTE: The managed binaries to be deployed to the target device should
  #       be located in the "<base>\bin\<year>\<configuration>Compact\bin"
  #       directory.
  #
  if {![info exists managed_directory]} then {
    set managed_directory [file join \
        $base_path bin $year [appendArgs $configuration Compact] bin]
  }

  #
  # NOTE: The native binaries to be deployed to the target device should
  #       be located in the "<base>\bin\<year>\<platform>\<configuration>"
  #       directory.
  #
  if {![info exists native_directory]} then {
    set native_directory [file join \
        $base_path bin $year $platform $configuration]
  }

  #
  # NOTE: Figure out the main test file names based on the mode argument from
  #       the caller.
  #
  switch -exact -nocase -- $mode {
    test {
      set testFileNameOnly testce.exe
      set cfgFileNameOnly test.cfg
      set sqlFileNameOnly test.sql
    }
    shell {
      set testFileNameOnly shellce.exe
      set cfgFileNameOnly shell.cfg
      set sqlFileNameOnly shell.sql
    }
    default {
      error [appendArgs "unsupported mode \"" $mode \"]
    }
  }

  #
  # NOTE: Build the list of all application files that need to be deployed to
  #       the target device, including all the native and managed binaries.
  #
  if {![info exists fileNames]} then {
    #
    # NOTE: Grab the assembly name instance based on the primary managed
    #       assembly file name.  This is needed because the build portion of
    #       the assembly version is used when building the default list of
    #       application files to be deployed to the target device.
    #
    set assemblyName [object invoke -alias System.Reflection.AssemblyName \
        GetAssemblyName [file join $managed_directory System.Data.SQLite.dll]]

    #
    # NOTE: The default list of application files includes the test application
    #       itself, the System.Data.SQLite managed assembly, the SQLite interop
    #       assembly, and the test application configuration file.
    #
    set fileNames [list [file join $managed_directory $testFileNameOnly] \
        [file join $managed_directory System.Data.SQLite.dll] [file join \
        $native_directory [appendArgs SQLite.Interop. [format %03d \
        [$assemblyName Version.Build]] .dll]] [file join $managed_directory \
        $cfgFileNameOnly] [file join $managed_directory $sqlFileNameOnly]]
  }

  #
  # NOTE: Setup the directory on the target device where the application files
  #       should be deployed to.  It should be noted that this directory value
  #       does not vary based on the mode.
  #
  if {![info exists device_directory]} then {
    set device_directory "\\Program Files\\testce\\"
  }

  #
  # NOTE: Load the managed assembly that allows us to communicate with the
  #       target device.  If this fails, the necessary SDK components are
  #       probably not available on this system.
  #
  # NOTE: As of Visual Studio 2013 Update 2 (?), this must specify the full
  #       (versioned) assembly name here in order to make sure the assembly
  #       associated with the Pocket PC 2003 platform(s) gets loaded.
  #
  object load [appendArgs \
      "Microsoft.Smartdevice.Connectivity, Version=9.0.0.0, " \
      "Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"]

  #
  # NOTE: Show the full list of available platforms.
  #
  showPlatforms $cultureInfo

  #
  # NOTE: Lookup the necessary device based on the platform and device Ids.
  #
  set device [getDevice $cultureInfo $platformId $deviceId]

  #
  # NOTE: Attempt to connect to the target device, which may be an emulator.
  #       By default, we attempt to connect to the "Pocket PC 2003 SE Emulator"
  #       device of the "Pocket PC 2003" platform (English).  If this fails,
  #       the target device is probably unavailable, either because it is not
  #       connected or some SDK components are missing.
  #
  $device Connect

  #
  # NOTE: Grab the file deployer instance for the target device.  This will
  #       be used to download packages and send files to the target device.
  #
  set fileDeployer [$device -alias GetFileDeployer]

  #
  # NOTE: If the list of packages related to the configured build year do not
  #       exist, skip this step.
  #
  if {[info exists packages($year)]} then {
    #
    # NOTE: Process each entry in the list of packages to be downloaded to the
    #       target device.  The package list must contain the package Id and
    #       the file name (relative to the target device), in that order, for
    #       each package to be downloaded to the target device.
    #
    foreach {packageId packageFileName} $packages($year) {
      qputs stdout [appendArgs \
          "downloading package \"" $packageId "\" to device..."]

      $fileDeployer DownloadPackage [object create \
          Microsoft.SmartDevice.Connectivity.ObjectId $packageId]

      qputs stdout [appendArgs \
          "installing package file \"" $packageFileName "\" on device..."]

      startRemoteProcess $device wceload.exe [appendArgs "/noui " \
          $packageFileName]
    }
  }

  #
  # NOTE: Process each application file to be sent to the target device.
  #
  foreach fileName $fileNames {
    qputs stdout [appendArgs \
        "sending file \"" $fileName "\" to device..."]

    #
    # NOTE: All the application files are sent to the same directory on the
    #       target device and the SendFile method requires a fully qualified
    #       file name; therefore, grab the file name only from the source file
    #       name and append that to the directory name on the target device.
    #       Using [file join] and/or [file normalize] should be avoided here
    #       because the directory name on the target device is not necessarily
    #       valid a file name on this system and vice versa.
    #
    $fileDeployer SendFile $fileName [appendArgs $device_directory \
        [file tail $fileName]] true false
  }

  #
  # NOTE: Run the test application on the target device in "automatic" mode
  #       (i.e. no user interaction is required) and capture the exit code.
  #       The exit code will be zero upon success (i.e. all tests passed) or
  #       non-zero otherwise.
  #
  set testFileName [file nativename \
      [file join $device_directory $testFileNameOnly]]

  #
  # NOTE: The first (and only) argument passed to main test EXE on the device
  #       is the auto-close flag.  When non-zero, it will close automatically
  #       upon completion.  Setting this to zero is sometimes useful in order
  #       to more carefully examine the detailed results.
  #
  set exitCode [startRemoteProcess $device $testFileName true]

  #
  # NOTE: If an output file is generated by the remote process, where should
  #       it be saved locally?
  #
  set outputFileName [file join $managed_directory output.txt]

  #
  # NOTE: Attempt to obtain the output file produced by the remote process,
  #       if any.
  #
  catch {
    $fileDeployer ReceiveFile [appendArgs \
        $device_directory [file tail $outputFileName]] $outputFileName false
  }

  #
  # NOTE: Is the target device actually an emulator running on this system?
  #
  set isEmulator [$device IsEmulator]

  #
  # NOTE: We no longer need to be connected to the target device.
  #
  $device Disconnect

  #
  # NOTE: Also, if the device is an emulator, attempt to shutdown the process
  #       containing it now (since we probably caused it to start).
  #
  if {$isEmulator} then {
    #
    # NOTE: Try to find the top-level window for the device emulator process
    #       based on the "LCDDisplay" window class name.  Using this method
    #       of finding the target window is somewhat fragile and may not work
    #       reliably in the future.
    #
    set hWnd [lindex [lindex [info windows LCDDisplay] 0] 0]; # FIXME: ???

    #
    # NOTE: Make sure we found it before trying to lookup the parent process.
    #
    if {[string is integer -strict $hWnd] && $hWnd != 0} then {
      #
      # NOTE: Attempt to lookup the parent process for the target window.
      #
      qputs stdout [appendArgs "found device emulator window handle " $hWnd \
          ", looking up the process Id..."]

      set processId 0; set threadId 0; set error null

      if {[object invoke -flags +NonPublic \
          Eagle._Components.Private.WindowOps GetWindowThreadProcessId \
          [object create IntPtr $hWnd] processId threadId error] eq "Ok" && \
          [string is integer -strict $processId] && $processId != 0} then {
        #
        # NOTE: This is not ideal; however, if we simply try to close the
        #       target window, it will prompt to save state changes and that
        #       requires user interaction.  We never want to save the state;
        #       therefore, just forcibly kill the process containing the
        #       emulator.
        #
        qputs stdout [appendArgs "found device emulator process Id " \
            $processId ", killing..."]

        kill -force $processId
      }
    }
  }

  #
  # NOTE: Print the overall result of running the test application and exit
  #       using the exit code from the test application on the target device.
  #
  qputs stdout [expr {$exitCode == 0 ? "SUCCESS" : "FAILURE"}]
  exit $exitCode
} else {
  usage ""
}

Added Setup/release.bat.



















































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
@ECHO OFF

::
:: release.bat --
::
:: Binary Release Tool
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%4

IF DEFINED DUMMY2 (
  GOTO usage
)

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

SET CONFIGURATION=%1

IF DEFINED CONFIGURATION (
  CALL :fn_UnquoteVariable CONFIGURATION
) ELSE (
  %_AECHO% No configuration specified, using default...
  SET CONFIGURATION=Release
)

%_VECHO% Configuration = '%CONFIGURATION%'
%_VECHO% ConfigurationSuffix = '%CONFIGURATIONSUFFIX%'

SET PLATFORM=%2

IF DEFINED PLATFORM (
  CALL :fn_UnquoteVariable PLATFORM
) ELSE (
  %_AECHO% No platform specified, using default...
  SET PLATFORM=Win32
)

%_VECHO% Platform = '%PLATFORM%'

SET YEAR=%3

IF DEFINED YEAR (
  CALL :fn_UnquoteVariable YEAR
) ELSE (
  %_AECHO% No year specified, using default...
  SET YEAR=2008
)

%_VECHO% Year = '%YEAR%'

SET BASE_CONFIGURATION=%CONFIGURATION%
SET BASE_CONFIGURATION=%BASE_CONFIGURATION:ManagedOnly=%
SET BASE_CONFIGURATION=%BASE_CONFIGURATION:NativeOnly=%
SET BASE_CONFIGURATION=%BASE_CONFIGURATION:Static=%

%_VECHO% BaseConfiguration = '%BASE_CONFIGURATION%'
%_VECHO% BaseConfigurationSuffix = '%BASE_CONFIGURATIONSUFFIX%'

IF NOT DEFINED BASE_PLATFORM (
  CALL :fn_SetVariable BASE_PLATFORM PLATFORM
)

%_VECHO% BasePlatform = '%BASE_PLATFORM%'
%_VECHO% ExtraPlatform = '%EXTRA_PLATFORM%'

IF NOT DEFINED TYPE (
  IF NOT DEFINED NOBUNDLE (
    IF /I "%CONFIGURATION%" == "%BASE_CONFIGURATION%" (
      IF /I "%BASE_CONFIGURATION%" == "Debug" (
        SET TYPE=%TYPE_PREFIX%binary-debug-bundle
      ) ELSE (
        SET TYPE=%TYPE_PREFIX%binary-bundle
      )
    ) ELSE (
      IF /I "%BASE_CONFIGURATION%" == "Debug" (
        SET TYPE=%TYPE_PREFIX%binary-debug
      ) ELSE (
        SET TYPE=%TYPE_PREFIX%binary
      )
    )
  ) ELSE (
    IF /I "%BASE_CONFIGURATION%" == "Debug" (
      SET TYPE=%TYPE_PREFIX%binary-debug
    ) ELSE (
      SET TYPE=%TYPE_PREFIX%binary
    )
  )
)

%_VECHO% Type = '%TYPE%'

CALL :fn_ResetErrorLevel

%_CECHO3% CALL "%TOOLS%\set_common.bat"
%__ECHO3% CALL "%TOOLS%\set_common.bat"

IF ERRORLEVEL 1 (
  ECHO Could not set common variables.
  GOTO errors
)

IF NOT DEFINED FRAMEWORK (
  IF DEFINED YEAR (
    CALL :fn_SetVariable FRAMEWORK FRAMEWORK%YEAR%
  ) ELSE (
    SET FRAMEWORK=netFx20
  )
)

%_VECHO% Framework = '%FRAMEWORK%'

SET ROOT=%~dp0\..
SET ROOT=%ROOT:\\=\%

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Root = '%ROOT%'
%_VECHO% Tools = '%TOOLS%'

CALL :fn_ResetErrorLevel

%_CECHO2% PUSHD "%ROOT%"
%__ECHO2% PUSHD "%ROOT%"

IF ERRORLEVEL 1 (
  ECHO Could not change directory to "%ROOT%".
  GOTO errors
)

FOR /F "delims=" %%V IN ('TYPE System.Data.SQLite\AssemblyInfo.cs ^| find.exe "AssemblyVersion"') DO (
  SET VERSION=%%V
)

IF NOT DEFINED VERSION (
  SET VERSION=1.0.0.0
  GOTO skip_mungeVersion
)

REM
REM NOTE: Strip off all the extra stuff from the AssemblyVersion line we found
REM       in the AssemblyInfo.cs file that we do not need (i.e. everything
REM       except the raw version number itself).
REM
SET VERSION=%VERSION:(=%
SET VERSION=%VERSION:)=%
SET VERSION=%VERSION:[=%
SET VERSION=%VERSION:]=%
SET VERSION=%VERSION: =%
SET VERSION=%VERSION:assembly:=%
SET VERSION=%VERSION:AssemblyVersion=%
SET VERSION=%VERSION:"=%
REM "

:skip_mungeVersion

%_VECHO% Version = '%VERSION%'

CALL :fn_ResetErrorLevel

IF NOT EXIST Setup\Output (
  %__ECHO% MKDIR Setup\Output

  IF ERRORLEVEL 1 (
    ECHO Could not create directory "Setup\Output".
    GOTO errors
  )
)

SET EXCLUDE_BIN=@data\exclude_bin.txt
SET PREFIX=sqlite

%_VECHO% ExcludeBin = '%EXCLUDE_BIN%'
%_VECHO% Prefix = '%PREFIX%'

IF DEFINED NO_RELEASE_YEAR (
  IF DEFINED NO_RELEASE_PLATFORM (
    SET RELEASE_OUTPUT_FILE=Setup\Output\%PREFIX%-%FRAMEWORK%-%TYPE%-%VERSION%.zip
  ) ELSE (
    SET RELEASE_OUTPUT_FILE=Setup\Output\%PREFIX%-%FRAMEWORK%-%TYPE%-%BASE_PLATFORM%%EXTRA_PLATFORM%-%VERSION%.zip
  )
) ELSE (
  IF DEFINED NO_RELEASE_PLATFORM (
    SET RELEASE_OUTPUT_FILE=Setup\Output\%PREFIX%-%FRAMEWORK%-%TYPE%-%YEAR%-%VERSION%.zip
  ) ELSE (
    SET RELEASE_OUTPUT_FILE=Setup\Output\%PREFIX%-%FRAMEWORK%-%TYPE%-%BASE_PLATFORM%%EXTRA_PLATFORM%-%YEAR%-%VERSION%.zip
  )
)

%_VECHO% ReleaseOutputFile = '%RELEASE_OUTPUT_FILE%'
%_VECHO% ReleaseRmDirSubDir = '%RELEASE_RMDIR_SUBDIR%'
%_VECHO% ReleaseRmDirPlatforms = '%RELEASE_RMDIR_PLATFORMS%'
%_VECHO% ReleaseManagedOnly = '%RELEASE_MANAGEDONLY%'
%_VECHO% NoReleaseInterop = '%NO_RELEASE_INTEROP%'

IF DEFINED BASE_CONFIGURATIONSUFFIX (
  IF NOT DEFINED NO_RELEASE_RMDIR (
    IF DEFINED RELEASE_RMDIR_SUBDIR (
      %_AECHO% Checking for directories under "bin\%YEAR%\%BASE_CONFIGURATION%%BASE_CONFIGURATIONSUFFIX%\bin\%RELEASE_RMDIR_SUBDIR%" for removal...

      IF DEFINED RELEASE_RMDIR_PLATFORMS (
        FOR %%N IN (%RELEASE_RMDIR_PLATFORMS%) DO (
          FOR /F "delims=" %%F IN ('DIR /B /S /AD "bin\%YEAR%\%BASE_CONFIGURATION%%BASE_CONFIGURATIONSUFFIX%\bin\%RELEASE_RMDIR_SUBDIR%" 2^> NUL') DO (
            IF /I "%%~nxF" == "%%N" (
              %_CECHO% RMDIR /S /Q "%%F"
              %__ECHO% RMDIR /S /Q "%%F"
            )
          )
        )
      ) ELSE (
        FOR /F "delims=" %%F IN ('DIR /B /S /AD "bin\%YEAR%\%BASE_CONFIGURATION%%BASE_CONFIGURATIONSUFFIX%\bin\%RELEASE_RMDIR_SUBDIR%" 2^> NUL') DO (
          %_CECHO% RMDIR /S /Q "%%F"
          %__ECHO% RMDIR /S /Q "%%F"
        )
      )
    ) ELSE (
      %_AECHO% Checking for directories under "bin\%YEAR%\%BASE_CONFIGURATION%%BASE_CONFIGURATIONSUFFIX%\bin" for removal...

      FOR /F "delims=" %%F IN ('DIR /B /S /AD "bin\%YEAR%\%BASE_CONFIGURATION%%BASE_CONFIGURATIONSUFFIX%\bin" 2^> NUL') DO (
        %_CECHO% RMDIR /S /Q "%%F"
        %__ECHO% RMDIR /S /Q "%%F"
      )
    )
  )
  IF DEFINED RELEASE_RMDIR_SUBDIR (
    %_CECHO% zip.exe -v -j -r "%RELEASE_OUTPUT_FILE%" "bin\%YEAR%\%BASE_CONFIGURATION%%BASE_CONFIGURATIONSUFFIX%\bin\%RELEASE_RMDIR_SUBDIR%" -x "%EXCLUDE_BIN%"
    %__ECHO% zip.exe -v -j -r "%RELEASE_OUTPUT_FILE%" "bin\%YEAR%\%BASE_CONFIGURATION%%BASE_CONFIGURATIONSUFFIX%\bin\%RELEASE_RMDIR_SUBDIR%" -x "%EXCLUDE_BIN%"
  ) ELSE (
    %_CECHO% zip.exe -v -j -r "%RELEASE_OUTPUT_FILE%" "bin\%YEAR%\%BASE_CONFIGURATION%%BASE_CONFIGURATIONSUFFIX%\bin" -x "%EXCLUDE_BIN%"
    %__ECHO% zip.exe -v -j -r "%RELEASE_OUTPUT_FILE%" "bin\%YEAR%\%BASE_CONFIGURATION%%BASE_CONFIGURATIONSUFFIX%\bin" -x "%EXCLUDE_BIN%"
  )
) ELSE (
  IF NOT DEFINED NO_RELEASE_RMDIR (
    IF DEFINED RELEASE_RMDIR_SUBDIR (
      %_AECHO% Checking for directories under "bin\%YEAR%\%BASE_CONFIGURATION%\bin\%RELEASE_RMDIR_SUBDIR%" for removal...

      IF DEFINED RELEASE_RMDIR_PLATFORMS (
        FOR %%N IN (%RELEASE_RMDIR_PLATFORMS%) DO (
          FOR /F "delims=" %%F IN ('DIR /B /S /AD "bin\%YEAR%\%BASE_CONFIGURATION%\bin\%RELEASE_RMDIR_SUBDIR%" 2^> NUL') DO (
            IF /I "%%~nxF" == "%%N" (
              %_CECHO% RMDIR /S /Q "%%F"
              %__ECHO% RMDIR /S /Q "%%F"
            )
          )
        )
      ) ELSE (
        FOR /F "delims=" %%F IN ('DIR /B /S /AD "bin\%YEAR%\%BASE_CONFIGURATION%\bin\%RELEASE_RMDIR_SUBDIR%" 2^> NUL') DO (
          %_CECHO% RMDIR /S /Q "%%F"
          %__ECHO% RMDIR /S /Q "%%F"
        )
      )
    ) ELSE (
      %_AECHO% Checking for directories under "bin\%YEAR%\%BASE_CONFIGURATION%\bin" for removal...

      FOR /F "delims=" %%F IN ('DIR /B /S /AD "bin\%YEAR%\%BASE_CONFIGURATION%\bin" 2^> NUL') DO (
        %_CECHO% RMDIR /S /Q "%%F"
        %__ECHO% RMDIR /S /Q "%%F"
      )
    )
  )
  IF DEFINED RELEASE_RMDIR_SUBDIR (
    %_CECHO% zip.exe -v -j -r "%RELEASE_OUTPUT_FILE%" "bin\%YEAR%\%BASE_CONFIGURATION%\bin\%RELEASE_RMDIR_SUBDIR%" -x "%EXCLUDE_BIN%"
    %__ECHO% zip.exe -v -j -r "%RELEASE_OUTPUT_FILE%" "bin\%YEAR%\%BASE_CONFIGURATION%\bin\%RELEASE_RMDIR_SUBDIR%" -x "%EXCLUDE_BIN%"
  ) ELSE (
    %_CECHO% zip.exe -v -j -r "%RELEASE_OUTPUT_FILE%" "bin\%YEAR%\%BASE_CONFIGURATION%\bin" -x "%EXCLUDE_BIN%"
    %__ECHO% zip.exe -v -j -r "%RELEASE_OUTPUT_FILE%" "bin\%YEAR%\%BASE_CONFIGURATION%\bin" -x "%EXCLUDE_BIN%"
  )
)

IF DEFINED RELEASE_MANAGEDONLY GOTO skip_releaseInterop

IF /I "%CONFIGURATION%" == "%BASE_CONFIGURATION%" (
  IF NOT DEFINED BASE_CONFIGURATIONSUFFIX (
    %_CECHO% zip.exe -v -d "%RELEASE_OUTPUT_FILE%" SQLite.Interop.*
    %__ECHO% zip.exe -v -d "%RELEASE_OUTPUT_FILE%" SQLite.Interop.*
  )
)

IF DEFINED NO_RELEASE_INTEROP (
  %_CECHO% zip.exe -v -d "%RELEASE_OUTPUT_FILE%" SQLite.Interop.*
  %__ECHO% zip.exe -v -d "%RELEASE_OUTPUT_FILE%" SQLite.Interop.*

  GOTO skip_releaseInterop
)

%_CECHO% zip.exe -v -j -r "%RELEASE_OUTPUT_FILE%" "bin\%YEAR%\%PLATFORM%\%CONFIGURATION%%CONFIGURATIONSUFFIX%" -x "%EXCLUDE_BIN%"
%__ECHO% zip.exe -v -j -r "%RELEASE_OUTPUT_FILE%" "bin\%YEAR%\%PLATFORM%\%CONFIGURATION%%CONFIGURATIONSUFFIX%" -x "%EXCLUDE_BIN%"

:skip_releaseInterop

IF ERRORLEVEL 1 (
  ECHO Failed to archive binary files.
  GOTO errors
)

%_CECHO2% POPD
%__ECHO2% POPD

IF ERRORLEVEL 1 (
  ECHO Could not restore directory.
  GOTO errors
)

GOTO no_errors

:fn_SetVariable
  SETLOCAL
  SET __ECHO_CMD=ECHO %%%2%%
  FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
    SET VALUE=%%V
  )
  ENDLOCAL && (
    SET %1=%VALUE%
  )
  GOTO :EOF

:fn_UnquoteVariable
  IF NOT DEFINED %1 GOTO :EOF
  SETLOCAL
  SET __ECHO_CMD=ECHO %%%1%%
  FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
    SET VALUE=%%V
  )
  SET VALUE=%VALUE:"=%
  REM "
  ENDLOCAL && SET %1=%VALUE%
  GOTO :EOF

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0 [configuration] [platform] [year]
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Release failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Release success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/release_all.bat.











































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
@ECHO OFF

::
:: release_all.bat --
::
:: Multi-Binary Release Tool
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

CALL :fn_ResetErrorLevel

%_CECHO3% CALL "%TOOLS%\vsSp.bat"
%__ECHO3% CALL "%TOOLS%\vsSp.bat"

IF ERRORLEVEL 1 (
  ECHO Could not detect Visual Studio.
  GOTO errors
)

REM
REM NOTE: Precompiled binary packages for .NET Standard 2.0 and
REM       .NET Standard 2.1 are handled by another tool.
REM
SET NONETSTANDARD20=1
SET NONETSTANDARD21=1

%_CECHO3% CALL "%TOOLS%\set_common.bat"
%__ECHO3% CALL "%TOOLS%\set_common.bat"

IF ERRORLEVEL 1 (
  ECHO Could not set common variables.
  GOTO errors
)

IF NOT DEFINED RELEASE_CONFIGURATIONS (
  SET RELEASE_CONFIGURATIONS=Release
)

%_VECHO% ReleaseConfigurations = '%RELEASE_CONFIGURATIONS%'

IF NOT DEFINED PLATFORMS (
  SET PLATFORMS=Win32
)

%_VECHO% Platforms = '%PLATFORMS%'

IF NOT DEFINED YEARS (
  SET YEARS=2008
)

%_VECHO% Years = '%YEARS%'

FOR %%C IN (%RELEASE_CONFIGURATIONS%) DO (
  FOR %%P IN (%PLATFORMS%) DO (
    FOR %%Y IN (%YEARS%) DO (
      CALL :fn_SetExtraPlatform "%%~P"

      %_CECHO3% CALL "%TOOLS%\release.bat" %%C %%P %%Y
      %__ECHO3% CALL "%TOOLS%\release.bat" %%C %%P %%Y

      IF ERRORLEVEL 1 (
        ECHO Could not build release archive for %%C/%%P/%%Y.
        GOTO errors
      )
    )
  )
)

GOTO no_errors

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:fn_CopyVariable
  IF NOT DEFINED %1 GOTO :EOF
  IF "%2" == "" GOTO :EOF
  SETLOCAL
  SET __ECHO_CMD=ECHO %%%1%%
  FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
    SET VALUE=%%V
  )
  ENDLOCAL && SET %2=%VALUE%
  GOTO :EOF

:fn_UnsetVariable
  SETLOCAL
  SET VALUE=%1
  IF DEFINED VALUE (
    SET VALUE=
    ENDLOCAL
    SET %VALUE%=
  ) ELSE (
    ENDLOCAL
  )
  CALL :fn_ResetErrorLevel
  GOTO :EOF

:fn_SetExtraPlatform
  IF "%~1" == "" GOTO :EOF
  SETLOCAL
  SET VALUE=%~1
  SET VALUE=%VALUE: =_%
  SET VALUE=%VALUE:(=%
  SET VALUE=%VALUE:)=%
  IF NOT DEFINED EXTRA_PLATFORM_%VALUE% (
    ENDLOCAL && CALL :fn_UnsetVariable EXTRA_PLATFORM
    GOTO :EOF
  )
  CALL :fn_CopyVariable EXTRA_PLATFORM_%VALUE% EXTRA_PLATFORM
  ENDLOCAL && SET EXTRA_PLATFORM=-%EXTRA_PLATFORM%
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/release_ce_200x.bat.





















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
@ECHO OFF

::
:: release_ce_200x.bat --
::
:: WinCE Binary Release Tool
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

IF DEFINED RELEASE_DEBUG (
  SET RELEASE_CONFIGURATIONS=Debug Release
) ELSE (
  SET RELEASE_CONFIGURATIONS=Release
)

SET BASE_CONFIGURATIONSUFFIX=Compact
SET PLATFORMS="Pocket PC 2003 (ARMV4)"
SET YEARS=2008
SET BASE_PLATFORM=PocketPC
SET EXTRA_PLATFORM_Pocket_PC_2003_ARMV4=ARM
SET NOBUNDLE=1

CALL :fn_ResetErrorLevel

%_CECHO3% CALL "%TOOLS%\release_all.bat"
%__ECHO3% CALL "%TOOLS%\release_all.bat"

IF ERRORLEVEL 1 (
  ECHO Failed to build WinCE release files.
  GOTO errors
)

GOTO no_errors

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Release failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Release success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/release_ce_2013.bat.

























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
@ECHO OFF

::
:: release_ce_2013.bat --
::
:: WinCE Binary Release Tool
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

IF DEFINED RELEASE_DEBUG (
  SET RELEASE_CONFIGURATIONS=Debug Release
) ELSE (
  SET RELEASE_CONFIGURATIONS=Release
)

SET FRAMEWORK2012=netFx39
SET BASE_CONFIGURATIONSUFFIX=Compact
SET PLATFORMS="CEPC DevPlatform" ARMV7
SET YEARS=2012
SET BASE_PLATFORM=WinCE
SET EXTRA_PLATFORM_CEPC_DevPlatform=x86
SET EXTRA_PLATFORM_ARMV7=ARM
SET NOBUNDLE=1

CALL :fn_ResetErrorLevel

%_CECHO3% CALL "%TOOLS%\release_all.bat"
%__ECHO3% CALL "%TOOLS%\release_all.bat"

IF ERRORLEVEL 1 (
  ECHO Failed to build WinCE release files.
  GOTO errors
)

GOTO no_errors

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Release failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Release success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/release_mono.bat.





















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
@ECHO OFF

::
:: release_mono.bat --
::
:: Mono Release Tool
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

IF DEFINED RELEASE_DEBUG (
  SET RELEASE_CONFIGURATIONS=DebugManagedOnly ReleaseManagedOnly
) ELSE (
  SET RELEASE_CONFIGURATIONS=ReleaseManagedOnly
)

SET BASE_CONFIGURATIONSUFFIX=MonoOnPosix
SET YEARS=2013
SET PLATFORMS=MSIL
SET BASE_PLATFORM=Mono
SET NOBUNDLE=1
SET RELEASE_MANAGEDONLY=1

CALL :fn_ResetErrorLevel

%_CECHO3% CALL "%TOOLS%\release_all.bat"
%__ECHO3% CALL "%TOOLS%\release_all.bat"

IF ERRORLEVEL 1 (
  ECHO Failed to build Mono release files.
  GOTO errors
)

GOTO no_errors

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Release failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Release success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/release_net_standard_20.bat.





























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
@ECHO OFF

::
:: release_net_standard_20.bat --
::
:: .NET Standard 2.0 Release Tool
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

IF DEFINED RELEASE_DEBUG (
  SET RELEASE_CONFIGURATIONS=DebugManagedOnly ReleaseManagedOnly
) ELSE (
  SET RELEASE_CONFIGURATIONS=ReleaseManagedOnly
)

SET BASE_CONFIGURATIONSUFFIX=NetStandard20
SET YEARS=NetStandard20
SET PLATFORMS=MSIL
SET BASE_PLATFORM=NetCore20
SET NOBUNDLE=1
SET NO_RELEASE_INTEROP=1
SET NO_RELEASE_YEAR=1
SET NO_RELEASE_PLATFORM=1
SET RELEASE_RMDIR_SUBDIR=netstandard2.0
SET RELEASE_RMDIR_PLATFORMS=Win32 x64

CALL :fn_ResetErrorLevel

%_CECHO3% CALL "%TOOLS%\release_all.bat"
%__ECHO3% CALL "%TOOLS%\release_all.bat"

IF ERRORLEVEL 1 (
  ECHO Failed to build .NET Standard 2.0 release files.
  GOTO errors
)

GOTO no_errors

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Release failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Release success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/release_net_standard_21.bat.





























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
@ECHO OFF

::
:: release_net_standard_21.bat --
::
:: .NET Standard 2.1 Release Tool
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

IF DEFINED RELEASE_DEBUG (
  SET RELEASE_CONFIGURATIONS=DebugManagedOnly ReleaseManagedOnly
) ELSE (
  SET RELEASE_CONFIGURATIONS=ReleaseManagedOnly
)

SET BASE_CONFIGURATIONSUFFIX=NetStandard21
SET YEARS=NetStandard21
SET PLATFORMS=MSIL
SET BASE_PLATFORM=NetCore30
SET NOBUNDLE=1
SET NO_RELEASE_INTEROP=1
SET NO_RELEASE_YEAR=1
SET NO_RELEASE_PLATFORM=1
SET RELEASE_RMDIR_SUBDIR=netstandard2.1
SET RELEASE_RMDIR_PLATFORMS=Win32 x64

CALL :fn_ResetErrorLevel

%_CECHO3% CALL "%TOOLS%\release_all.bat"
%__ECHO3% CALL "%TOOLS%\release_all.bat"

IF ERRORLEVEL 1 (
  ECHO Failed to build .NET Standard 2.1 release files.
  GOTO errors
)

GOTO no_errors

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Release failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Release success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/release_static.bat.

































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
@ECHO OFF

::
:: release_static.bat --
::
:: Static Binary Release Tool
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

SET CONFIGURATIONSUFFIX=Static
SET TYPE_PREFIX=static-

CALL :fn_ResetErrorLevel

%_CECHO3% CALL "%TOOLS%\release_all.bat"
%__ECHO3% CALL "%TOOLS%\release_all.bat"

IF ERRORLEVEL 1 (
  ECHO Failed to build static release files.
  GOTO errors
)

GOTO no_errors

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Release failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Release success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/run-mono-tests-debug.sh.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash

scriptdir=`dirname "$BASH_SOURCE"`

if [[ -z "$SQLITE_NET_YEAR" ]]; then
  SQLITE_NET_YEAR=2013
fi

pushd "$scriptdir/.."
mono Externals/Eagle/bin/netFramework40/EagleShell.exe -preInitialize "set test_configuration Debug; set test_year {$SQLITE_NET_YEAR}; set build_directory {bin/$SQLITE_NET_YEAR/Debug$SQLITE_NET_CONFIGURATION_SUFFIX/bin}" -file Tests/all.eagle "$@"
popd

Added Setup/run-mono-tests-release.sh.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash

scriptdir=`dirname "$BASH_SOURCE"`

if [[ -z "$SQLITE_NET_YEAR" ]]; then
  SQLITE_NET_YEAR=2013
fi

pushd "$scriptdir/.."
mono Externals/Eagle/bin/netFramework40/EagleShell.exe -preInitialize "set test_configuration Release; set test_year {$SQLITE_NET_YEAR}; set build_directory {bin/$SQLITE_NET_YEAR/Release$SQLITE_NET_CONFIGURATION_SUFFIX/bin}" -file Tests/all.eagle "$@"
popd

Added Setup/run-net5-tests-debug.sh.





















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

scriptdir=`dirname "$BASH_SOURCE"`

if [[ "$OSTYPE" == "darwin"* ]]; then
  libname=libSQLite.Interop.dylib
else
  libname=libSQLite.Interop.so
fi

if [[ -z "$SQLITE_NET_YEAR" ]]; then
  SQLITE_NET_YEAR=2013
fi

pushd "$scriptdir/.."

SQLITE_INTEROP_DIR=bin/$SQLITE_NET_YEAR/Debug$SQLITE_NET_CONFIGURATION_SUFFIX/bin
SQLITE_INTEROP_FILE=$SQLITE_INTEROP_DIR/$libname

if [[ -f "${SQLITE_INTEROP_FILE}" ]]; then
  cp "$SQLITE_INTEROP_FILE" "$SQLITE_INTEROP_DIR/SQLite.Interop.dll"
  libname=SQLite.Interop.dll
fi

dotnet exec Externals/Eagle/bin/net5/EagleShell.dll -preInitialize "set test_configuration Debug; set test_configuration_suffix {$SQLITE_NET_CONFIGURATION_SUFFIX}; set test_native_configuration_suffix {$SQLITE_NET_CONFIGURATION_SUFFIX}; set test_year NetStandard21; set test_native_year {$SQLITE_NET_YEAR}" -file Tests/all.eagle "$@"
popd

Added Setup/run-net5-tests-release.sh.





















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

scriptdir=`dirname "$BASH_SOURCE"`

if [[ "$OSTYPE" == "darwin"* ]]; then
  libname=libSQLite.Interop.dylib
else
  libname=libSQLite.Interop.so
fi

if [[ -z "$SQLITE_NET_YEAR" ]]; then
  SQLITE_NET_YEAR=2013
fi

pushd "$scriptdir/.."

SQLITE_INTEROP_DIR=bin/$SQLITE_NET_YEAR/Release$SQLITE_NET_CONFIGURATION_SUFFIX/bin
SQLITE_INTEROP_FILE=$SQLITE_INTEROP_DIR/$libname

if [[ -f "${SQLITE_INTEROP_FILE}" ]]; then
  cp "$SQLITE_INTEROP_FILE" "$SQLITE_INTEROP_DIR/SQLite.Interop.dll"
  libname=SQLite.Interop.dll
fi

dotnet exec Externals/Eagle/bin/net5/EagleShell.dll -preInitialize "set test_configuration Release; set test_configuration_suffix {$SQLITE_NET_CONFIGURATION_SUFFIX}; set test_native_configuration_suffix {$SQLITE_NET_CONFIGURATION_SUFFIX}; set test_year NetStandard21; set test_native_year {$SQLITE_NET_YEAR}" -file Tests/all.eagle "$@"
popd

Added Setup/run-net6-tests-debug.sh.





















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

scriptdir=`dirname "$BASH_SOURCE"`

if [[ "$OSTYPE" == "darwin"* ]]; then
  libname=libSQLite.Interop.dylib
else
  libname=libSQLite.Interop.so
fi

if [[ -z "$SQLITE_NET_YEAR" ]]; then
  SQLITE_NET_YEAR=2013
fi

pushd "$scriptdir/.."

SQLITE_INTEROP_DIR=bin/$SQLITE_NET_YEAR/Debug$SQLITE_NET_CONFIGURATION_SUFFIX/bin
SQLITE_INTEROP_FILE=$SQLITE_INTEROP_DIR/$libname

if [[ -f "${SQLITE_INTEROP_FILE}" ]]; then
  cp "$SQLITE_INTEROP_FILE" "$SQLITE_INTEROP_DIR/SQLite.Interop.dll"
  libname=SQLite.Interop.dll
fi

dotnet exec Externals/Eagle/bin/net6/EagleShell.dll -preInitialize "set test_configuration Debug; set test_configuration_suffix {$SQLITE_NET_CONFIGURATION_SUFFIX}; set test_native_configuration_suffix {$SQLITE_NET_CONFIGURATION_SUFFIX}; set test_year NetStandard21; set test_native_year {$SQLITE_NET_YEAR}; set test_extra netstandard2.1" -file Tests/all.eagle "$@"
popd

Added Setup/run-net6-tests-release.sh.





















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

scriptdir=`dirname "$BASH_SOURCE"`

if [[ "$OSTYPE" == "darwin"* ]]; then
  libname=libSQLite.Interop.dylib
else
  libname=libSQLite.Interop.so
fi

if [[ -z "$SQLITE_NET_YEAR" ]]; then
  SQLITE_NET_YEAR=2013
fi

pushd "$scriptdir/.."

SQLITE_INTEROP_DIR=bin/$SQLITE_NET_YEAR/Release$SQLITE_NET_CONFIGURATION_SUFFIX/bin
SQLITE_INTEROP_FILE=$SQLITE_INTEROP_DIR/$libname

if [[ -f "${SQLITE_INTEROP_FILE}" ]]; then
  cp "$SQLITE_INTEROP_FILE" "$SQLITE_INTEROP_DIR/SQLite.Interop.dll"
  libname=SQLite.Interop.dll
fi

dotnet exec Externals/Eagle/bin/net6/EagleShell.dll -preInitialize "set test_configuration Release; set test_configuration_suffix {$SQLITE_NET_CONFIGURATION_SUFFIX}; set test_native_configuration_suffix {$SQLITE_NET_CONFIGURATION_SUFFIX}; set test_year NetStandard21; set test_native_year {$SQLITE_NET_YEAR}; set test_extra netstandard2.1" -file Tests/all.eagle "$@"
popd

Added Setup/run-netcore20-tests-debug.sh.





















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

scriptdir=`dirname "$BASH_SOURCE"`

if [[ "$OSTYPE" == "darwin"* ]]; then
  libname=libSQLite.Interop.dylib
else
  libname=libSQLite.Interop.so
fi

if [[ -z "$SQLITE_NET_YEAR" ]]; then
  SQLITE_NET_YEAR=2013
fi

pushd "$scriptdir/.."

SQLITE_INTEROP_DIR=bin/$SQLITE_NET_YEAR/Debug$SQLITE_NET_CONFIGURATION_SUFFIX/bin
SQLITE_INTEROP_FILE=$SQLITE_INTEROP_DIR/$libname

if [[ -f "${SQLITE_INTEROP_FILE}" ]]; then
  cp "$SQLITE_INTEROP_FILE" "$SQLITE_INTEROP_DIR/SQLite.Interop.dll"
  libname=SQLite.Interop.dll
fi

dotnet exec Externals/Eagle/bin/netCore20/EagleShell.dll -preInitialize "set test_configuration Debug; set test_configuration_suffix {$SQLITE_NET_CONFIGURATION_SUFFIX}; set test_native_configuration_suffix {$SQLITE_NET_CONFIGURATION_SUFFIX}; set test_year NetStandard20; set test_native_year {$SQLITE_NET_YEAR}" -file Tests/all.eagle "$@"
popd

Added Setup/run-netcore20-tests-release.sh.





















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

scriptdir=`dirname "$BASH_SOURCE"`

if [[ "$OSTYPE" == "darwin"* ]]; then
  libname=libSQLite.Interop.dylib
else
  libname=libSQLite.Interop.so
fi

if [[ -z "$SQLITE_NET_YEAR" ]]; then
  SQLITE_NET_YEAR=2013
fi

pushd "$scriptdir/.."

SQLITE_INTEROP_DIR=bin/$SQLITE_NET_YEAR/Release$SQLITE_NET_CONFIGURATION_SUFFIX/bin
SQLITE_INTEROP_FILE=$SQLITE_INTEROP_DIR/$libname

if [[ -f "${SQLITE_INTEROP_FILE}" ]]; then
  cp "$SQLITE_INTEROP_FILE" "$SQLITE_INTEROP_DIR/SQLite.Interop.dll"
  libname=SQLite.Interop.dll
fi

dotnet exec Externals/Eagle/bin/netCore20/EagleShell.dll -preInitialize "set test_configuration Release; set test_configuration_suffix {$SQLITE_NET_CONFIGURATION_SUFFIX}; set test_native_configuration_suffix {$SQLITE_NET_CONFIGURATION_SUFFIX}; set test_year NetStandard20; set test_native_year {$SQLITE_NET_YEAR}" -file Tests/all.eagle "$@"
popd

Added Setup/run-netcore30-tests-debug.sh.





















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

scriptdir=`dirname "$BASH_SOURCE"`

if [[ "$OSTYPE" == "darwin"* ]]; then
  libname=libSQLite.Interop.dylib
else
  libname=libSQLite.Interop.so
fi

if [[ -z "$SQLITE_NET_YEAR" ]]; then
  SQLITE_NET_YEAR=2013
fi

pushd "$scriptdir/.."

SQLITE_INTEROP_DIR=bin/$SQLITE_NET_YEAR/Debug$SQLITE_NET_CONFIGURATION_SUFFIX/bin
SQLITE_INTEROP_FILE=$SQLITE_INTEROP_DIR/$libname

if [[ -f "${SQLITE_INTEROP_FILE}" ]]; then
  cp "$SQLITE_INTEROP_FILE" "$SQLITE_INTEROP_DIR/SQLite.Interop.dll"
  libname=SQLite.Interop.dll
fi

dotnet exec Externals/Eagle/bin/netCore30/EagleShell.dll -preInitialize "set test_configuration Debug; set test_configuration_suffix {$SQLITE_NET_CONFIGURATION_SUFFIX}; set test_native_configuration_suffix {$SQLITE_NET_CONFIGURATION_SUFFIX}; set test_year NetStandard21; set test_native_year {$SQLITE_NET_YEAR}; set test_extra netstandard2.1" -file Tests/all.eagle "$@"
popd

Added Setup/run-netcore30-tests-release.sh.





















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash

scriptdir=`dirname "$BASH_SOURCE"`

if [[ "$OSTYPE" == "darwin"* ]]; then
  libname=libSQLite.Interop.dylib
else
  libname=libSQLite.Interop.so
fi

if [[ -z "$SQLITE_NET_YEAR" ]]; then
  SQLITE_NET_YEAR=2013
fi

pushd "$scriptdir/.."

SQLITE_INTEROP_DIR=bin/$SQLITE_NET_YEAR/Release$SQLITE_NET_CONFIGURATION_SUFFIX/bin
SQLITE_INTEROP_FILE=$SQLITE_INTEROP_DIR/$libname

if [[ -f "${SQLITE_INTEROP_FILE}" ]]; then
  cp "$SQLITE_INTEROP_FILE" "$SQLITE_INTEROP_DIR/SQLite.Interop.dll"
  libname=SQLite.Interop.dll
fi

dotnet exec Externals/Eagle/bin/netCore30/EagleShell.dll -preInitialize "set test_configuration Release; set test_configuration_suffix {$SQLITE_NET_CONFIGURATION_SUFFIX}; set test_native_configuration_suffix {$SQLITE_NET_CONFIGURATION_SUFFIX}; set test_year NetStandard21; set test_native_year {$SQLITE_NET_YEAR}; set test_extra netstandard2.1" -file Tests/all.eagle "$@"
popd

Added Setup/set_Debug.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_Debug.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

REM SET MSBUILD_ARGS=/property:TargetFrameworkVersion=v3.5 /property:PlatformToolset=v100

Added Setup/set_DebugNativeOnly.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_DebugNativeOnly.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

REM SET MSBUILD_ARGS=/property:TargetFrameworkVersion=v3.5

Added Setup/set_DebugNativeOnly_ARMV7.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_DebugNativeOnly_ARMV7.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_DebugNativeOnly.bat"

Added Setup/set_DebugNativeOnly_CEPC DevPlatform.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_DebugNativeOnly_CEPC DevPlatform.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_DebugNativeOnly.bat"

Added Setup/set_DebugNativeOnly_Pocket PC 2003 (ARMV4).bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_DebugNativeOnly_Pocket PC 2003 (ARMV4).bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_DebugNativeOnly.bat"

Added Setup/set_DebugNativeOnly_Win32.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_DebugNativeOnly_Win32.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_DebugNativeOnly.bat"

Added Setup/set_DebugNativeOnly_x64.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_DebugNativeOnly_x64.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_DebugNativeOnly.bat"

Added Setup/set_DebugNativeOnly_x64_2005.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_DebugNativeOnly_x64_2005.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=DebugNativeOnly
CALL "%~dp0\set_x64_2005.bat"

Added Setup/set_DebugNativeOnly_x64_2008.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_DebugNativeOnly_x64_2008.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=DebugNativeOnly
CALL "%~dp0\set_x64_2008.bat"

Added Setup/set_DebugNativeOnly_x64_2010.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_DebugNativeOnly_x64_2010.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=DebugNativeOnly
CALL "%~dp0\set_x64_2010.bat"

Added Setup/set_DebugNativeOnly_x64_2012.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_DebugNativeOnly_x64_2012.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=DebugNativeOnly
CALL "%~dp0\set_x64_2012.bat"

Added Setup/set_DebugNativeOnly_x64_2013.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_DebugNativeOnly_x64_2013.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=DebugNativeOnly
CALL "%~dp0\set_x64_2013.bat"

Added Setup/set_DebugNativeOnly_x64_2015.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_DebugNativeOnly_x64_2015.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=DebugNativeOnly
CALL "%~dp0\set_x64_2015.bat"

Added Setup/set_DebugNativeOnly_x64_2017.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_DebugNativeOnly_x64_2017.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=DebugNativeOnly
CALL "%~dp0\set_x64_2017.bat"

Added Setup/set_DebugNativeOnly_x86_2005.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_DebugNativeOnly_x86_2005.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=DebugNativeOnly
CALL "%~dp0\set_x86_2005.bat"

Added Setup/set_DebugNativeOnly_x86_2008.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_DebugNativeOnly_x86_2008.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=DebugNativeOnly
CALL "%~dp0\set_x86_2008.bat"

Added Setup/set_DebugNativeOnly_x86_2010.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_DebugNativeOnly_x86_2010.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=DebugNativeOnly
CALL "%~dp0\set_x86_2010.bat"

Added Setup/set_DebugNativeOnly_x86_2012.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_DebugNativeOnly_x86_2012.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=DebugNativeOnly
CALL "%~dp0\set_x86_2012.bat"

Added Setup/set_DebugNativeOnly_x86_2013.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_DebugNativeOnly_x86_2013.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=DebugNativeOnly
CALL "%~dp0\set_x86_2013.bat"

Added Setup/set_DebugNativeOnly_x86_2015.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_DebugNativeOnly_x86_2015.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=DebugNativeOnly
CALL "%~dp0\set_x86_2015.bat"

Added Setup/set_DebugNativeOnly_x86_2017.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_DebugNativeOnly_x86_2017.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=DebugNativeOnly
CALL "%~dp0\set_x86_2017.bat"

Added Setup/set_DebugNativeOnly_x86_NetStandard20.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_DebugNativeOnly_x86_NetStandard20.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=DebugNativeOnly
CALL "%~dp0\set_x86_NetStandard20.bat"

Added Setup/set_DebugNativeOnly_x86_NetStandard21.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_DebugNativeOnly_x86_NetStandard21.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=DebugNativeOnly
CALL "%~dp0\set_x86_NetStandard21.bat"

Added Setup/set_Debug_ARMV7.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_Debug_ARMV7.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_Debug.bat"

Added Setup/set_Debug_CEPC DevPlatform.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_Debug_CEPC DevPlatform.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_Debug.bat"

Added Setup/set_Debug_Pocket PC 2003 (ARMV4).bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_Debug_Pocket PC 2003 (ARMV4).bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_Debug.bat"

Added Setup/set_Debug_Win32.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_Debug_Win32.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_Debug.bat"

Added Setup/set_Debug_x64.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_Debug_x64.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_Debug.bat"

Added Setup/set_Debug_x64_2005.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Debug_x64_2005.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Debug
CALL "%~dp0\set_x64_2005.bat"

Added Setup/set_Debug_x64_2008.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Debug_x64_2008.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Debug
CALL "%~dp0\set_x64_2008.bat"

Added Setup/set_Debug_x64_2010.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Debug_x64_2010.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Debug
CALL "%~dp0\set_x64_2010.bat"

Added Setup/set_Debug_x64_2012.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Debug_x64_2012.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Debug
CALL "%~dp0\set_x64_2012.bat"

Added Setup/set_Debug_x64_2013.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Debug_x64_2013.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Debug
CALL "%~dp0\set_x64_2013.bat"

Added Setup/set_Debug_x64_2015.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Debug_x64_2015.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Debug
CALL "%~dp0\set_x64_2015.bat"

Added Setup/set_Debug_x64_2017.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Debug_x64_2017.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Debug
CALL "%~dp0\set_x64_2017.bat"

Added Setup/set_Debug_x86_2005.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Debug_x86_2005.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Debug
CALL "%~dp0\set_x86_2005.bat"

Added Setup/set_Debug_x86_2008.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Debug_x86_2008.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Debug
CALL "%~dp0\set_x86_2008.bat"

Added Setup/set_Debug_x86_2010.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Debug_x86_2010.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Debug
CALL "%~dp0\set_x86_2010.bat"

Added Setup/set_Debug_x86_2012.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Debug_x86_2012.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Debug
CALL "%~dp0\set_x86_2012.bat"

Added Setup/set_Debug_x86_2013.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Debug_x86_2013.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Debug
CALL "%~dp0\set_x86_2013.bat"

Added Setup/set_Debug_x86_2015.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Debug_x86_2015.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Debug
CALL "%~dp0\set_x86_2015.bat"

Added Setup/set_Debug_x86_2017.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Debug_x86_2017.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Debug
CALL "%~dp0\set_x86_2017.bat"

Added Setup/set_Debug_x86_NetStandard20.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Debug_x86_NetStandard20.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Debug
CALL "%~dp0\set_x86_NetStandard20.bat"

Added Setup/set_Debug_x86_NetStandard21.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Debug_x86_NetStandard21.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Debug
CALL "%~dp0\set_x86_NetStandard21.bat"

Added Setup/set_Release.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_Release.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

REM SET MSBUILD_ARGS=/property:TargetFrameworkVersion=v3.5 /property:PlatformToolset=v100

Added Setup/set_ReleaseNativeOnly.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_ReleaseNativeOnly.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

REM SET MSBUILD_ARGS=/property:TargetFrameworkVersion=v3.5

Added Setup/set_ReleaseNativeOnly_ARMV7.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_ReleaseNativeOnly_ARMV7.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_ReleaseNativeOnly.bat"

Added Setup/set_ReleaseNativeOnly_CEPC DevPlatform.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_ReleaseNativeOnly_CEPC DevPlatform.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_ReleaseNativeOnly.bat"

Added Setup/set_ReleaseNativeOnly_Pocket PC 2003 (ARMV4).bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_ReleaseNativeOnly_Pocket PC 2003 (ARMV4).bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_ReleaseNativeOnly.bat"

Added Setup/set_ReleaseNativeOnly_Win32.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_ReleaseNativeOnly_Win32.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_ReleaseNativeOnly.bat"

Added Setup/set_ReleaseNativeOnly_x64.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_ReleaseNativeOnly_x64.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_ReleaseNativeOnly.bat"

Added Setup/set_ReleaseNativeOnly_x64_2005.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_ReleaseNativeOnly_x64_2005.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=ReleaseNativeOnly
CALL "%~dp0\set_x64_2005.bat"

Added Setup/set_ReleaseNativeOnly_x64_2008.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_ReleaseNativeOnly_x64_2008.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=ReleaseNativeOnly
CALL "%~dp0\set_x64_2008.bat"

Added Setup/set_ReleaseNativeOnly_x64_2010.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_ReleaseNativeOnly_x64_2010.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=ReleaseNativeOnly
CALL "%~dp0\set_x64_2010.bat"

Added Setup/set_ReleaseNativeOnly_x64_2012.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_ReleaseNativeOnly_x64_2012.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=ReleaseNativeOnly
CALL "%~dp0\set_x64_2012.bat"

Added Setup/set_ReleaseNativeOnly_x64_2013.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_ReleaseNativeOnly_x64_2013.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=ReleaseNativeOnly
CALL "%~dp0\set_x64_2013.bat"

Added Setup/set_ReleaseNativeOnly_x64_2015.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_ReleaseNativeOnly_x64_2015.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=ReleaseNativeOnly
CALL "%~dp0\set_x64_2015.bat"

Added Setup/set_ReleaseNativeOnly_x64_2017.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_ReleaseNativeOnly_x64_2017.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=ReleaseNativeOnly
CALL "%~dp0\set_x64_2017.bat"

Added Setup/set_ReleaseNativeOnly_x86_2005.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_ReleaseNativeOnly_x86_2005.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=ReleaseNativeOnly
CALL "%~dp0\set_x86_2005.bat"

Added Setup/set_ReleaseNativeOnly_x86_2008.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_ReleaseNativeOnly_x86_2008.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=ReleaseNativeOnly
CALL "%~dp0\set_x86_2008.bat"

Added Setup/set_ReleaseNativeOnly_x86_2010.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_ReleaseNativeOnly_x86_2010.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=ReleaseNativeOnly
CALL "%~dp0\set_x86_2010.bat"

Added Setup/set_ReleaseNativeOnly_x86_2012.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_ReleaseNativeOnly_x86_2012.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=ReleaseNativeOnly
CALL "%~dp0\set_x86_2012.bat"

Added Setup/set_ReleaseNativeOnly_x86_2013.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_ReleaseNativeOnly_x86_2013.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=ReleaseNativeOnly
CALL "%~dp0\set_x86_2013.bat"

Added Setup/set_ReleaseNativeOnly_x86_2015.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_ReleaseNativeOnly_x86_2015.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=ReleaseNativeOnly
CALL "%~dp0\set_x86_2015.bat"

Added Setup/set_ReleaseNativeOnly_x86_2017.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_ReleaseNativeOnly_x86_2017.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=ReleaseNativeOnly
CALL "%~dp0\set_x86_2017.bat"

Added Setup/set_ReleaseNativeOnly_x86_NetStandard20.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_ReleaseNativeOnly_x86_NetStandard20.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=ReleaseNativeOnly
CALL "%~dp0\set_x86_NetStandard20.bat"

Added Setup/set_ReleaseNativeOnly_x86_NetStandard21.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_ReleaseNativeOnly_x86_NetStandard21.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=ReleaseNativeOnly
CALL "%~dp0\set_x86_NetStandard21.bat"

Added Setup/set_Release_ARMV7.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_Release_ARMV7.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_Release.bat"

Added Setup/set_Release_CEPC DevPlatform.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_Release_CEPC DevPlatform.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_Release.bat"

Added Setup/set_Release_Pocket PC 2003 (ARMV4).bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_Release_Pocket PC 2003 (ARMV4).bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_Release.bat"

Added Setup/set_Release_Win32.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_Release_Win32.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_Release.bat"

Added Setup/set_Release_x64.bat.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
@ECHO OFF

::
:: set_Release_x64.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

CALL "%~dp0\set_Release.bat"

Added Setup/set_Release_x64_2005.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Release_x64_2005.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Release
CALL "%~dp0\set_x64_2005.bat"

Added Setup/set_Release_x64_2008.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Release_x64_2008.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Release
CALL "%~dp0\set_x64_2008.bat"

Added Setup/set_Release_x64_2010.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Release_x64_2010.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Release
CALL "%~dp0\set_x64_2010.bat"

Added Setup/set_Release_x64_2012.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Release_x64_2012.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Release
CALL "%~dp0\set_x64_2012.bat"

Added Setup/set_Release_x64_2013.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Release_x64_2013.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Release
CALL "%~dp0\set_x64_2013.bat"

Added Setup/set_Release_x64_2015.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Release_x64_2015.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Release
CALL "%~dp0\set_x64_2015.bat"

Added Setup/set_Release_x64_2017.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Release_x64_2017.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Release
CALL "%~dp0\set_x64_2017.bat"

Added Setup/set_Release_x86_2005.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Release_x86_2005.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Release
CALL "%~dp0\set_x86_2005.bat"

Added Setup/set_Release_x86_2008.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Release_x86_2008.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Release
CALL "%~dp0\set_x86_2008.bat"

Added Setup/set_Release_x86_2010.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Release_x86_2010.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Release
CALL "%~dp0\set_x86_2010.bat"

Added Setup/set_Release_x86_2012.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Release_x86_2012.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Release
CALL "%~dp0\set_x86_2012.bat"

Added Setup/set_Release_x86_2013.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Release_x86_2013.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Release
CALL "%~dp0\set_x86_2013.bat"

Added Setup/set_Release_x86_2015.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Release_x86_2015.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Release
CALL "%~dp0\set_x86_2015.bat"

Added Setup/set_Release_x86_2017.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Release_x86_2017.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Release
CALL "%~dp0\set_x86_2017.bat"

Added Setup/set_Release_x86_NetStandard20.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Release_x86_NetStandard20.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Release
CALL "%~dp0\set_x86_NetStandard20.bat"

Added Setup/set_Release_x86_NetStandard21.bat.























>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
@ECHO OFF

::
:: set_Release_x86_NetStandard21.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET CONFIGURATION=Release
CALL "%~dp0\set_x86_NetStandard21.bat"

Added Setup/set_common.bat.





















































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
@ECHO OFF

::
:: set_common.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

IF NOT DEFINED APPID (
  SET APPID={{02E43EC2-6B1C-45B5-9E48-941C3E1B204A}
)

IF NOT DEFINED URL (
  SET URL=https://system.data.sqlite.org/
)

IF NOT DEFINED PUBLICKEY (
  SET PUBLICKEY=db937bc2d44ff139
)

IF NOT DEFINED BUILD_CONFIGURATIONS (
  IF DEFINED BUILD_DEBUG (
    SET BUILD_CONFIGURATIONS=Debug DebugNativeOnly Release ReleaseNativeOnly
  ) ELSE (
    SET BUILD_CONFIGURATIONS=Release ReleaseNativeOnly
  )
)

IF NOT DEFINED TEST_CONFIGURATIONS (
  IF DEFINED TEST_DEBUG (
    SET TEST_CONFIGURATIONS=Debug Release
  ) ELSE (
    SET TEST_CONFIGURATIONS=Release
  )
)

IF NOT DEFINED TEST_NATIVE_CONFIGURATIONS (
  IF DEFINED TEST_DEBUG (
    SET TEST_NATIVE_CONFIGURATIONS=DebugNativeOnly ReleaseNativeOnly
  ) ELSE (
    SET TEST_NATIVE_CONFIGURATIONS=ReleaseNativeOnly
  )
)

IF NOT DEFINED BAKE_CONFIGURATIONS (
  IF DEFINED BAKE_DEBUG (
    SET BAKE_CONFIGURATIONS=Debug DebugNativeOnly Release ReleaseNativeOnly
  ) ELSE (
    SET BAKE_CONFIGURATIONS=Release ReleaseNativeOnly
  )
)

IF NOT DEFINED RELEASE_CONFIGURATIONS (
  IF DEFINED RELEASE_DEBUG (
    SET RELEASE_CONFIGURATIONS=Debug DebugNativeOnly Release ReleaseNativeOnly
  ) ELSE (
    SET RELEASE_CONFIGURATIONS=Release ReleaseNativeOnly
  )
)

IF NOT DEFINED PLATFORMS (
  SET PLATFORMS=Win32 x64
)

IF NOT DEFINED PROCESSORS (
  SET PROCESSORS=x86 x64
)

IF NOT DEFINED FRAMEWORK2005 (
  SET FRAMEWORK2005=netFx20
)

IF NOT DEFINED FRAMEWORK2008 (
  SET FRAMEWORK2008=netFx35
)

IF NOT DEFINED FRAMEWORK2010 (
  SET FRAMEWORK2010=netFx40
)

IF NOT DEFINED FRAMEWORK2012 (
  SET FRAMEWORK2012=netFx45
)

IF NOT DEFINED FRAMEWORK2013 (
  SET FRAMEWORK2013=netFx451
  REM SET FRAMEWORK2013=netFx452
)

IF NOT DEFINED FRAMEWORK2015 (
  SET FRAMEWORK2015=netFx46
  REM SET FRAMEWORK2015=netFx461
  REM SET FRAMEWORK2015=netFx462
)

IF NOT DEFINED FRAMEWORK2017 (
  SET FRAMEWORK2017=netFx47
  REM SET FRAMEWORK2017=netFx471
  REM SET FRAMEWORK2017=netFx472
  REM SET FRAMEWORK2017=netFx48
)

IF NOT DEFINED FRAMEWORKNETSTANDARD20 (
  SET FRAMEWORKNETSTANDARD20=netStandard20
)

IF NOT DEFINED FRAMEWORKNETSTANDARD21 (
  SET FRAMEWORKNETSTANDARD21=netStandard21
)

IF DEFINED YEARS GOTO end_of_file

IF NOT DEFINED NOVS2005 (
  IF DEFINED VS2005SP (
    SET YEARS=%YEARS% 2005
  )
)

IF NOT DEFINED NOVS2008 (
  IF DEFINED VS2008SP (
    SET YEARS=%YEARS% 2008
  )
)

IF NOT DEFINED NOVS2010 (
  IF DEFINED VS2010SP (
    SET YEARS=%YEARS% 2010
  )
)

IF NOT DEFINED NOVS2012 (
  IF DEFINED VS2012SP (
    SET YEARS=%YEARS% 2012
  )
)

IF NOT DEFINED NOVS2013 (
  IF DEFINED VS2013SP (
    SET YEARS=%YEARS% 2013
  )
)

IF NOT DEFINED NOVS2015 (
  IF DEFINED VS2015SP (
    SET YEARS=%YEARS% 2015
  )
)

IF NOT DEFINED NOVS2017 (
  IF DEFINED VS2017SP (
    SET YEARS=%YEARS% 2017
  )
)

IF NOT DEFINED NOVS2019 (
  IF DEFINED VS2019SP (
    SET YEARS=%YEARS% 2019
  )
)

IF NOT DEFINED NONETSTANDARD20 (
  SET YEARS=%YEARS% NetStandard20
)

IF NOT DEFINED NONETSTANDARD21 (
  SET YEARS=%YEARS% NetStandard21
)

:end_of_file

Added Setup/set_netFx20.bat.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@ECHO OFF

::
:: set_netFx20.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

IF NOT DEFINED ISNETFX2 (
  SET ISNETFX2=True
)

IF NOT DEFINED VCRUNTIME (
  SET VCRUNTIME=2005_SP1_MFC
)

IF NOT DEFINED CONFIGURATION (
  SET CONFIGURATION=Release
)

IF NOT DEFINED PLATFORM (
  SET PLATFORM=Win32
)

IF NOT DEFINED PROCESSOR (
  SET PROCESSOR=x86
)

IF NOT DEFINED YEAR (
  SET YEAR=2005
)

IF NOT DEFINED FRAMEWORK (
  SET FRAMEWORK=netFx20
)

:end_of_file

Added Setup/set_netFx35.bat.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@ECHO OFF

::
:: set_netFx35.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

IF NOT DEFINED ISNETFX2 (
  SET ISNETFX2=True
)

IF NOT DEFINED VCRUNTIME (
  SET VCRUNTIME=2008_SP1_MFC
)

IF NOT DEFINED CONFIGURATION (
  SET CONFIGURATION=Release
)

IF NOT DEFINED PLATFORM (
  SET PLATFORM=Win32
)

IF NOT DEFINED PROCESSOR (
  SET PROCESSOR=x86
)

IF NOT DEFINED YEAR (
  SET YEAR=2008
)

IF NOT DEFINED FRAMEWORK (
  SET FRAMEWORK=netFx35
)

:end_of_file

Added Setup/set_netFx40.bat.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@ECHO OFF

::
:: set_netFx40.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

IF NOT DEFINED ISNETFX2 (
  SET ISNETFX2=False
)

IF NOT DEFINED VCRUNTIME (
  SET VCRUNTIME=2010_SP1_MFC
)

IF NOT DEFINED CONFIGURATION (
  SET CONFIGURATION=Release
)

IF NOT DEFINED PLATFORM (
  SET PLATFORM=Win32
)

IF NOT DEFINED PROCESSOR (
  SET PROCESSOR=x86
)

IF NOT DEFINED YEAR (
  SET YEAR=2010
)

IF NOT DEFINED FRAMEWORK (
  SET FRAMEWORK=netFx40
)

:end_of_file

Added Setup/set_netFx45.bat.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@ECHO OFF

::
:: set_netFx45.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

IF NOT DEFINED ISNETFX2 (
  SET ISNETFX2=False
)

IF NOT DEFINED VCRUNTIME (
  SET VCRUNTIME=2012_VSU4
)

IF NOT DEFINED CONFIGURATION (
  SET CONFIGURATION=Release
)

IF NOT DEFINED PLATFORM (
  SET PLATFORM=Win32
)

IF NOT DEFINED PROCESSOR (
  SET PROCESSOR=x86
)

IF NOT DEFINED YEAR (
  SET YEAR=2012
)

IF NOT DEFINED FRAMEWORK (
  SET FRAMEWORK=netFx45
)

:end_of_file

Added Setup/set_netFx451.bat.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@ECHO OFF

::
:: set_netFx451.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

IF NOT DEFINED ISNETFX2 (
  SET ISNETFX2=False
)

IF NOT DEFINED VCRUNTIME (
  SET VCRUNTIME=2013_VSU2
)

IF NOT DEFINED CONFIGURATION (
  SET CONFIGURATION=Release
)

IF NOT DEFINED PLATFORM (
  SET PLATFORM=Win32
)

IF NOT DEFINED PROCESSOR (
  SET PROCESSOR=x86
)

IF NOT DEFINED YEAR (
  SET YEAR=2013
)

IF NOT DEFINED FRAMEWORK (
  SET FRAMEWORK=netFx451
)

:end_of_file

Added Setup/set_netFx452.bat.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@ECHO OFF

::
:: set_netFx452.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

IF NOT DEFINED ISNETFX2 (
  SET ISNETFX2=False
)

IF NOT DEFINED VCRUNTIME (
  SET VCRUNTIME=2013_VSU2
)

IF NOT DEFINED CONFIGURATION (
  SET CONFIGURATION=Release
)

IF NOT DEFINED PLATFORM (
  SET PLATFORM=Win32
)

IF NOT DEFINED PROCESSOR (
  SET PROCESSOR=x86
)

IF NOT DEFINED YEAR (
  SET YEAR=2013
)

IF NOT DEFINED FRAMEWORK (
  SET FRAMEWORK=netFx452
)

:end_of_file

Added Setup/set_netFx46.bat.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@ECHO OFF

::
:: set_netFx46.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

IF NOT DEFINED ISNETFX2 (
  SET ISNETFX2=False
)

IF NOT DEFINED VCRUNTIME (
  SET VCRUNTIME=2015_VSU3
)

IF NOT DEFINED CONFIGURATION (
  SET CONFIGURATION=Release
)

IF NOT DEFINED PLATFORM (
  SET PLATFORM=Win32
)

IF NOT DEFINED PROCESSOR (
  SET PROCESSOR=x86
)

IF NOT DEFINED YEAR (
  SET YEAR=2015
)

IF NOT DEFINED FRAMEWORK (
  SET FRAMEWORK=netFx46
)

:end_of_file

Added Setup/set_netFx461.bat.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@ECHO OFF

::
:: set_netFx461.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

IF NOT DEFINED ISNETFX2 (
  SET ISNETFX2=False
)

IF NOT DEFINED VCRUNTIME (
  SET VCRUNTIME=2015_VSU3
)

IF NOT DEFINED CONFIGURATION (
  SET CONFIGURATION=Release
)

IF NOT DEFINED PLATFORM (
  SET PLATFORM=Win32
)

IF NOT DEFINED PROCESSOR (
  SET PROCESSOR=x86
)

IF NOT DEFINED YEAR (
  SET YEAR=2015
)

IF NOT DEFINED FRAMEWORK (
  SET FRAMEWORK=netFx461
)

:end_of_file

Added Setup/set_netFx462.bat.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@ECHO OFF

::
:: set_netFx462.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

IF NOT DEFINED ISNETFX2 (
  SET ISNETFX2=False
)

IF NOT DEFINED VCRUNTIME (
  SET VCRUNTIME=2015_VSU3
)

IF NOT DEFINED CONFIGURATION (
  SET CONFIGURATION=Release
)

IF NOT DEFINED PLATFORM (
  SET PLATFORM=Win32
)

IF NOT DEFINED PROCESSOR (
  SET PROCESSOR=x86
)

IF NOT DEFINED YEAR (
  SET YEAR=2015
)

IF NOT DEFINED FRAMEWORK (
  SET FRAMEWORK=netFx462
)

:end_of_file

Added Setup/set_netFx47.bat.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@ECHO OFF

::
:: set_netFx47.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

IF NOT DEFINED ISNETFX2 (
  SET ISNETFX2=False
)

IF NOT DEFINED VCRUNTIME (
  SET VCRUNTIME=2017_VCU3
)

IF NOT DEFINED CONFIGURATION (
  SET CONFIGURATION=Release
)

IF NOT DEFINED PLATFORM (
  SET PLATFORM=Win32
)

IF NOT DEFINED PROCESSOR (
  SET PROCESSOR=x86
)

IF NOT DEFINED YEAR (
  SET YEAR=2017
)

IF NOT DEFINED FRAMEWORK (
  SET FRAMEWORK=netFx47
)

:end_of_file

Added Setup/set_netFx471.bat.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@ECHO OFF

::
:: set_netFx471.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

IF NOT DEFINED ISNETFX2 (
  SET ISNETFX2=False
)

IF NOT DEFINED VCRUNTIME (
  SET VCRUNTIME=2017_VCU3
)

IF NOT DEFINED CONFIGURATION (
  SET CONFIGURATION=Release
)

IF NOT DEFINED PLATFORM (
  SET PLATFORM=Win32
)

IF NOT DEFINED PROCESSOR (
  SET PROCESSOR=x86
)

IF NOT DEFINED YEAR (
  SET YEAR=2017
)

IF NOT DEFINED FRAMEWORK (
  SET FRAMEWORK=netFx471
)

:end_of_file

Added Setup/set_netFx472.bat.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@ECHO OFF

::
:: set_netFx472.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

IF NOT DEFINED ISNETFX2 (
  SET ISNETFX2=False
)

IF NOT DEFINED VCRUNTIME (
  SET VCRUNTIME=2017_VCU3
)

IF NOT DEFINED CONFIGURATION (
  SET CONFIGURATION=Release
)

IF NOT DEFINED PLATFORM (
  SET PLATFORM=Win32
)

IF NOT DEFINED PROCESSOR (
  SET PROCESSOR=x86
)

IF NOT DEFINED YEAR (
  SET YEAR=2017
)

IF NOT DEFINED FRAMEWORK (
  SET FRAMEWORK=netFx472
)

:end_of_file

Added Setup/set_netFx48.bat.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@ECHO OFF

::
:: set_netFx48.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

IF NOT DEFINED ISNETFX2 (
  SET ISNETFX2=False
)

IF NOT DEFINED VCRUNTIME (
  SET VCRUNTIME=2017_VCU3
)

IF NOT DEFINED CONFIGURATION (
  SET CONFIGURATION=Release
)

IF NOT DEFINED PLATFORM (
  SET PLATFORM=Win32
)

IF NOT DEFINED PROCESSOR (
  SET PROCESSOR=x86
)

IF NOT DEFINED YEAR (
  SET YEAR=2017
)

IF NOT DEFINED FRAMEWORK (
  SET FRAMEWORK=netFx48
)

:end_of_file

Added Setup/set_netStandard20.bat.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@ECHO OFF

::
:: set_netStandard20.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

IF NOT DEFINED ISNETFX2 (
  SET ISNETFX2=False
)

IF NOT DEFINED VCRUNTIME (
  SET VCRUNTIME=2017_VCU3
)

IF NOT DEFINED CONFIGURATION (
  SET CONFIGURATION=Release
)

IF NOT DEFINED PLATFORM (
  SET PLATFORM=Win32
)

IF NOT DEFINED PROCESSOR (
  SET PROCESSOR=x86
)

IF NOT DEFINED YEAR (
  SET YEAR=2017
)

IF NOT DEFINED FRAMEWORK (
  SET FRAMEWORK=netStandard20
)

:end_of_file

Added Setup/set_netStandard21.bat.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@ECHO OFF

::
:: set_netStandard21.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

IF NOT DEFINED ISNETFX2 (
  SET ISNETFX2=False
)

IF NOT DEFINED VCRUNTIME (
  SET VCRUNTIME=2019_VCU1
)

IF NOT DEFINED CONFIGURATION (
  SET CONFIGURATION=Release
)

IF NOT DEFINED PLATFORM (
  SET PLATFORM=Win32
)

IF NOT DEFINED PROCESSOR (
  SET PROCESSOR=x86
)

IF NOT DEFINED YEAR (
  SET YEAR=2019
)

IF NOT DEFINED FRAMEWORK (
  SET FRAMEWORK=netStandard21
)

:end_of_file

Added Setup/set_user_mistachkin_Debug.bat.













































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
@ECHO OFF

::
:: set_user_mistachkin_Debug.bat --
::
:: Custom Per-User Debug Build Settings
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

REM
REM NOTE: Enables the extra debug code helpful in troubleshooting issues.
REM
SET MSBUILD_ARGS=/property:CheckState=true
SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:InteropLog=false
REM SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:CountHandle=true
REM SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:TraceConnection=true
REM SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:TraceDetection=true
REM SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:TraceHandle=true
REM SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:TraceStatement=true
REM SET MSBUILD_ARGS=%MSBUILD_ARGS% /property:TrackMemoryBytes=true

Added Setup/set_user_mistachkin_Release.bat.





































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
@ECHO OFF

::
:: set_user_mistachkin_Release.bat --
::
:: Custom Per-User Release Build Settings
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

REM
REM NOTE: Unsets any extra MSBuild arguments that may be present to force the
REM       use of all the default settings.
REM
SET MSBUILD_ARGS=

VERIFY > NUL

Added Setup/set_x64_2005.bat.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@ECHO OFF

::
:: set_x64_2005.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET ISNETFX2=True
SET VCRUNTIME=2005_SP1_MFC
SET PLATFORM=x64
SET PROCESSOR=x64
SET YEAR=2005

Added Setup/set_x64_2008.bat.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@ECHO OFF

::
:: set_x64_2008.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET ISNETFX2=True
SET VCRUNTIME=2008_SP1_MFC
SET PLATFORM=x64
SET PROCESSOR=x64
SET YEAR=2008

Added Setup/set_x64_2010.bat.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@ECHO OFF

::
:: set_x64_2010.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET ISNETFX2=False
SET VCRUNTIME=2010_SP1_MFC
SET PLATFORM=x64
SET PROCESSOR=x64
SET YEAR=2010

Added Setup/set_x64_2012.bat.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@ECHO OFF

::
:: set_x64_2012.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET ISNETFX2=False
SET VCRUNTIME=2012_VSU4
SET PLATFORM=x64
SET PROCESSOR=x64
SET YEAR=2012

Added Setup/set_x64_2013.bat.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@ECHO OFF

::
:: set_x64_2013.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET ISNETFX2=False
SET VCRUNTIME=2013_VSU2
SET PLATFORM=x64
SET PROCESSOR=x64
SET YEAR=2013

Added Setup/set_x64_2015.bat.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@ECHO OFF

::
:: set_x64_2015.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET ISNETFX2=False
SET VCRUNTIME=2015_VSU3
SET PLATFORM=x64
SET PROCESSOR=x64
SET YEAR=2015

Added Setup/set_x64_2017.bat.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@ECHO OFF

::
:: set_x64_2017.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET ISNETFX2=False
SET VCRUNTIME=2017_VCU3
SET PLATFORM=x64
SET PROCESSOR=x64
SET YEAR=2017

Added Setup/set_x86_2005.bat.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@ECHO OFF

::
:: set_x86_2005.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET ISNETFX2=True
SET VCRUNTIME=2005_SP1_MFC
SET PLATFORM=Win32
SET PROCESSOR=x86
SET YEAR=2005

Added Setup/set_x86_2008.bat.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@ECHO OFF

::
:: set_x86_2008.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET ISNETFX2=True
SET VCRUNTIME=2008_SP1_MFC
SET PLATFORM=Win32
SET PROCESSOR=x86
SET YEAR=2008

Added Setup/set_x86_2010.bat.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@ECHO OFF

::
:: set_x86_2010.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET ISNETFX2=False
SET VCRUNTIME=2010_SP1_MFC
SET PLATFORM=Win32
SET PROCESSOR=x86
SET YEAR=2010

Added Setup/set_x86_2012.bat.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@ECHO OFF

::
:: set_x86_2012.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET ISNETFX2=False
SET VCRUNTIME=2012_VSU4
SET PLATFORM=Win32
SET PROCESSOR=x86
SET YEAR=2012

Added Setup/set_x86_2013.bat.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@ECHO OFF

::
:: set_x86_2013.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET ISNETFX2=False
SET VCRUNTIME=2013_VSU2
SET PLATFORM=Win32
SET PROCESSOR=x86
SET YEAR=2013

Added Setup/set_x86_2015.bat.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@ECHO OFF

::
:: set_x86_2015.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET ISNETFX2=False
SET VCRUNTIME=2015_VSU3
SET PLATFORM=Win32
SET PROCESSOR=x86
SET YEAR=2015

Added Setup/set_x86_2017.bat.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@ECHO OFF

::
:: set_x86_2017.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET ISNETFX2=False
SET VCRUNTIME=2017_VCU3
SET PLATFORM=Win32
SET PROCESSOR=x86
SET YEAR=2017

Added Setup/set_x86_NetStandard20.bat.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@ECHO OFF

::
:: set_x86_NetStandard20.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET ISNETFX2=False
SET VCRUNTIME=2017_VCU3
SET PLATFORM=Win32
SET PROCESSOR=x86
SET YEAR=NetStandard20

Added Setup/set_x86_NetStandard21.bat.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
@ECHO OFF

::
:: set_x86_NetStandard21.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET ISNETFX2=False
SET VCRUNTIME=2019_VCU1
SET PLATFORM=Win32
SET PROCESSOR=x86
SET YEAR=NetStandard21

Added Setup/set_year_2005.bat.























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
@ECHO OFF

::
:: set_year_2005.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET NETCORE20ONLY=
SET NETCORE30ONLY=
SET NETFX20ONLY=1
SET NETFX35ONLY=
SET NETFX40ONLY=
SET NETFX45ONLY=
SET NETFX451ONLY=
SET NETFX452ONLY=
SET NETFX46ONLY=
SET NETFX461ONLY=
SET NETFX462ONLY=
SET NETFX47ONLY=
SET NETFX471ONLY=
SET NETFX472ONLY=
SET NETFX48ONLY=
SET BUILD_ARGS=

VERIFY > NUL

Added Setup/set_year_2008.bat.























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
@ECHO OFF

::
:: set_year_2008.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET NETCORE20ONLY=
SET NETCORE30ONLY=
SET NETFX20ONLY=
SET NETFX35ONLY=1
SET NETFX40ONLY=
SET NETFX45ONLY=
SET NETFX451ONLY=
SET NETFX452ONLY=
SET NETFX46ONLY=
SET NETFX461ONLY=
SET NETFX462ONLY=
SET NETFX47ONLY=
SET NETFX471ONLY=
SET NETFX472ONLY=
SET NETFX48ONLY=
SET BUILD_ARGS=

VERIFY > NUL

Added Setup/set_year_2010.bat.























































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
@ECHO OFF

::
:: set_year_2010.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET NETCORE20ONLY=
SET NETCORE30ONLY=
SET NETFX20ONLY=
SET NETFX35ONLY=
SET NETFX40ONLY=1
SET NETFX45ONLY=
SET NETFX451ONLY=
SET NETFX452ONLY=
SET NETFX46ONLY=
SET NETFX461ONLY=
SET NETFX462ONLY=
SET NETFX47ONLY=
SET NETFX471ONLY=
SET NETFX472ONLY=
SET NETFX48ONLY=
SET BUILD_ARGS=

VERIFY > NUL

Added Setup/set_year_2012.bat.

































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
@ECHO OFF

::
:: set_year_2012.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET NETCORE20ONLY=
SET NETCORE30ONLY=
SET NETFX20ONLY=
SET NETFX35ONLY=
SET NETFX40ONLY=
SET NETFX45ONLY=1
SET NETFX451ONLY=
SET NETFX452ONLY=
SET NETFX46ONLY=
SET NETFX461ONLY=
SET NETFX462ONLY=
SET NETFX47ONLY=
SET NETFX471ONLY=
SET NETFX472ONLY=
SET NETFX48ONLY=

REM
REM HACK: Evidently, installing Visual Studio 2013 breaks using MSBuild to
REM       build native projects that specify a platform toolset of "v110".
REM
SET BUILD_ARGS=/property:VisualStudioVersion=11.0

VERIFY > NUL

Added Setup/set_year_2013.bat.

































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
@ECHO OFF

::
:: set_year_2013.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET NETCORE20ONLY=
SET NETCORE30ONLY=
SET NETFX20ONLY=
SET NETFX35ONLY=
SET NETFX40ONLY=
SET NETFX45ONLY=
SET NETFX451ONLY=1
SET NETFX452ONLY=
SET NETFX46ONLY=
SET NETFX461ONLY=
SET NETFX462ONLY=
SET NETFX47ONLY=
SET NETFX471ONLY=
SET NETFX472ONLY=
SET NETFX48ONLY=

REM
REM HACK: Evidently, using MSBuild with Visual Studio 2013 requires some
REM       extra magic to make it recognize the "v120" platform toolset.
REM
SET BUILD_ARGS=/property:VisualStudioVersion=12.0

VERIFY > NUL

Added Setup/set_year_2015.bat.

































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
@ECHO OFF

::
:: set_year_2015.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET NETCORE20ONLY=
SET NETCORE30ONLY=
SET NETFX20ONLY=
SET NETFX35ONLY=
SET NETFX40ONLY=
SET NETFX45ONLY=
SET NETFX451ONLY=
SET NETFX452ONLY=
SET NETFX46ONLY=1
SET NETFX461ONLY=
SET NETFX462ONLY=
SET NETFX47ONLY=
SET NETFX471ONLY=
SET NETFX472ONLY=
SET NETFX48ONLY=

REM
REM HACK: Evidently, using MSBuild with Visual Studio 2015 requires some
REM       extra magic to make it recognize the "v140" platform toolset.
REM
SET BUILD_ARGS=/property:VisualStudioVersion=14.0

VERIFY > NUL

Added Setup/set_year_2017.bat.

































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
@ECHO OFF

::
:: set_year_2017.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET NETCORE20ONLY=
SET NETCORE30ONLY=
SET NETFX20ONLY=
SET NETFX35ONLY=
SET NETFX40ONLY=
SET NETFX45ONLY=
SET NETFX451ONLY=
SET NETFX452ONLY=
SET NETFX46ONLY=
SET NETFX461ONLY=
SET NETFX462ONLY=
SET NETFX47ONLY=1
SET NETFX471ONLY=
SET NETFX472ONLY=
SET NETFX48ONLY=

REM
REM HACK: Evidently, using MSBuild with Visual Studio 2017 requires some
REM       extra magic to make it recognize the "v141" platform toolset.
REM
SET BUILD_ARGS=/property:VisualStudioVersion=15.0

VERIFY > NUL

Added Setup/set_year_NetStandard20.bat.





















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
@ECHO OFF

::
:: set_year_NetStandard20.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET NETCORE20ONLY=1
SET NETCORE30ONLY=
SET NETFX20ONLY=
SET NETFX35ONLY=
SET NETFX40ONLY=
SET NETFX45ONLY=
SET NETFX451ONLY=
SET NETFX452ONLY=
SET NETFX46ONLY=
SET NETFX461ONLY=
SET NETFX462ONLY=
SET NETFX47ONLY=
SET NETFX471ONLY=
SET NETFX472ONLY=
SET NETFX48ONLY=

VERIFY > NUL

Added Setup/set_year_NetStandard21.bat.





















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
@ECHO OFF

::
:: set_year_NetStandard21.bat --
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SET NETCORE20ONLY=
SET NETCORE30ONLY=1
SET NETFX20ONLY=
SET NETFX35ONLY=
SET NETFX40ONLY=
SET NETFX45ONLY=
SET NETFX451ONLY=
SET NETFX452ONLY=
SET NETFX46ONLY=
SET NETFX461ONLY=
SET NETFX462ONLY=
SET NETFX47ONLY=
SET NETFX471ONLY=
SET NETFX472ONLY=
SET NETFX48ONLY=

VERIFY > NUL

Added Setup/sourceTag.eagle.





































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
###############################################################################
#
# sourceTag.eagle -- Source Version Tag Tool
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle

proc usage { error } {
  if {[string length $error] > 0} then {puts stdout $error}

  puts stdout "usage:\
[file tail [info nameofexecutable]]\
[file tail [info script]] <SourceIdMode> <fileName>"

  #
  # NOTE: Indicate to the caller, if any, that we have failed.
  #
  exit 1
}

set modes [list \"SourceIdMode\"]
set argc [llength $argv]

if {$argc == 2} then {
  #
  # NOTE: Are we updating the "PatchLevel.cs" file?
  #
  set mode [lindex $argv 0]

  if {[string length $mode] > 0} then {
    #
    # NOTE: Get the file name to read/update/write.
    #
    set fileName [lindex $argv 1]

    #
    # NOTE: Make sure the file name provided is not obviously
    #       invalid.
    #
    if {[string length $fileName] > 0} then {
      #
      # NOTE: Read all the data out of the text file.
      #
      set data [readFile $fileName]

      #
      # NOTE: Normalize to Unix line-endings.
      #
      set data [string map [list \r\n \n] $data]; # Unix.

      #
      # NOTE: Figure out what mode we are in.
      #
      switch -exact -nocase -- $mode {
        SourceIdMode {
          #
          # NOTE: Query the source identifier from Fossil, if available.
          #       If we are not within an active checkout, this will fail.
          #
          set pattern {^checkout:\s+([^\s]+)\s+(.*)\s+$}

          if {[catch {set exec [string map [list \n \r\n] [exec \
                  -success Success -nocarriagereturns -directory \
                  [file dirname $fileName] -- fossil info]]}] || \
              [regexp -line -- $pattern $exec dummy id timeStamp] == 0} then {
            #
            # NOTE: We could not query the source identifier(s); therefore,
            #       use obviously invalid ones.  We would also be able to
            #       use null values here except that these values end up in
            #       native C header files as well (i.e. not just managed
            #       assembly attribute values).
            #
            set id 0000000000000000000000000000000000000000
            set timeStamp "0000-00-00 00:00:00 UTC"
          }

          #
          # NOTE: Match against this pattern in the "PatchLevel.cs"
          #       file (this pattern is fairly strict to prevent
          #       false-positives).
          #
          set pattern1 {AssemblySourceId\(.*?\)}
          set pattern2 {AssemblySourceTimeStamp\(.*?\)}
          set pattern3 {INTEROP_SOURCE_ID\s+".*?"}
          set pattern4 {INTEROP_SOURCE_TIMESTAMP\s+".*?"}

          #
          # NOTE: Build the final replacement specification string.
          #
          set subSpec1 [appendArgs AssemblySourceId(\" $id \" )]
          set subSpec2 [appendArgs AssemblySourceTimeStamp(\" $timeStamp \" )]
          set subSpec3 [appendArgs INTEROP_SOURCE_ID "        \"" $id \"]
          set subSpec4 [appendArgs INTEROP_SOURCE_TIMESTAMP " \"" $timeStamp \"]

          #
          # NOTE: Perform the replacements in the original data
          #       (first match only).
          #
          set count 0

          incr count [regsub -nocase -- $pattern1 $data $subSpec1 data]
          incr count [regsub -nocase -- $pattern2 $data $subSpec2 data]
          incr count [regsub -nocase -- $pattern3 $data $subSpec3 data]
          incr count [regsub -nocase -- $pattern4 $data $subSpec4 data]

          #
          # NOTE: If we actually replaced anything, we need to write back
          #       to the original file; otherwise, leave it alone.
          #
          if {$count > 0} then {
            #
            # NOTE: Show how we tagged it.
            #
            puts stdout [appendArgs "tagged \"" $fileName "\" " $mode \
                " " $id " " $timeStamp]

            #
            # NOTE: Re-write the original file with the modified data.
            #
            writeFile $fileName [string map [list \n \r\n] $data]; # DOS.
          } else {
            #
            # NOTE: We could not replace the string.  This is considered
            #       an overall failure.
            #
            usage [appendArgs "pattern \"" $pattern "\" not found in \"" \
                $fileName \"]
          }
        }
        default {
          usage [appendArgs "unknown mode, must be " [join $modes " "]]
        }
      }
    } else {
      usage "invalid file name"
    }
  } else {
    usage [appendArgs "invalid mode, must be " [join $modes " "]]
  }
} else {
  usage ""
}

Added Setup/test.bat.







































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
@ECHO OFF

::
:: test.bat --
::
:: Eagle Shell Testing Tool
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

CALL :fn_UnsetVariable BREAK

%_AECHO% Running %0 %*

SET ROOT=%~dp0\..
SET ROOT=%ROOT:\\=\%

%_VECHO% Root = '%ROOT%'

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

CALL :fn_ResetErrorLevel

%_CECHO2% PUSHD "%ROOT%"
%__ECHO2% PUSHD "%ROOT%"

IF ERRORLEVEL 1 (
  ECHO Could not change directory to "%ROOT%".
  GOTO errors
)

IF NOT DEFINED TEST_FILE (
  %_AECHO% No test file specified, using default...
  SET TEST_FILE=Tests\template\empty.eagle
)

IF NOT DEFINED PREARGS (
  %_AECHO% No pre-arguments specified, using default...
  SET PREARGS=-interactive -noExit -initialize

  IF DEFINED NOAUTOSELECT (
    %_AECHO% Skipping automatic build selection...
  ) ELSE (
    %_AECHO% Enabling automatic build selection...
    CALL :fn_AppendVariable PREARGS " -runtimeOption autoSelect"
  )
)

IF NOT DEFINED POSTARGS (
  %_AECHO% No post-arguments specified, using default...
  SET POSTARGS=-file "%TEST_FILE%"
)

%_VECHO% TestFile = '%TEST_FILE%'
%_VECHO% PreArgs = '%PREARGS%'
%_VECHO% MidArgs = '%MIDARGS%'
%_VECHO% PostArgs = '%POSTARGS%'

IF NOT DEFINED 32BITONLY (
  SET EAGLESHELL=EagleShell.exe
) ELSE (
  SET EAGLESHELL=EagleShell32.exe
)

%_VECHO% EagleShell = '%EAGLESHELL%'

%_CECHO% "Externals\Eagle\bin\netFramework40\%EAGLESHELL%" %PREARGS% %* %MIDARGS% %POSTARGS%
%__ECHO% "Externals\Eagle\bin\netFramework40\%EAGLESHELL%" %PREARGS% %* %MIDARGS% %POSTARGS%

CALL :fn_FixErrorLevel

IF ERRORLEVEL 1 (
  ECHO Received non-zero return code from the Eagle Shell.
  GOTO errors
)

%_CECHO2% POPD
%__ECHO2% POPD

IF ERRORLEVEL 1 (
  ECHO Could not restore directory.
  GOTO errors
)

GOTO no_errors

:fn_UnsetVariable
  SETLOCAL
  SET VALUE=%1
  IF DEFINED VALUE (
    SET VALUE=
    ENDLOCAL
    SET %VALUE%=
  ) ELSE (
    ENDLOCAL
  )
  CALL :fn_ResetErrorLevel
  GOTO :EOF

:fn_AppendVariable
  SET __ECHO_CMD=ECHO %%%1%%
  IF DEFINED %1 (
    FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
      SET %1=%%V%~2
    )
  ) ELSE (
    SET %1=%~2
  )
  SET __ECHO_CMD=
  CALL :fn_ResetErrorLevel
  GOTO :EOF

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:fn_FixErrorLevel
  IF %ERRORLEVEL% NEQ 0 (
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0 [...]
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/test_all.bat.

























































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
@ECHO OFF

::
:: test_all.bat --
::
:: Multiplexing Wrapper Tool for Unit Tests
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

:redo

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

CALL :fn_UnsetVariable BREAK

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

REM SET DFLAGS=/L

%_VECHO% DFlags = '%DFLAGS%'

SET FFLAGS=/V /F /G /H /I /R /Y /Z

%_VECHO% FFlags = '%FFLAGS%'

SET ROOT=%~dp0\..
SET ROOT=%ROOT:\\=\%

%_VECHO% Root = '%ROOT%'

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

CALL :fn_ResetErrorLevel

%_CECHO3% CALL "%TOOLS%\vsSp.bat"
%__ECHO3% CALL "%TOOLS%\vsSp.bat"

IF ERRORLEVEL 1 (
  ECHO Could not detect Visual Studio.
  GOTO errors
)

%_CECHO3% CALL "%TOOLS%\set_common.bat"
%__ECHO3% CALL "%TOOLS%\set_common.bat"

IF ERRORLEVEL 1 (
  ECHO Could not set common variables.
  GOTO errors
)

IF NOT DEFINED TEST_CONFIGURATIONS (
  SET TEST_CONFIGURATIONS=Release
)

%_VECHO% TestConfigurations = '%TEST_CONFIGURATIONS%'

IF DEFINED PLATFORM (
  %_AECHO% Skipping platform detection, already set...
  GOTO skip_detectPlatform
)

IF /I "%PROCESSOR_ARCHITECTURE%" == "x86" (
  SET PLATFORM=Win32
)

IF /I "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
  SET PLATFORM=x64
)

:skip_detectPlatform

IF NOT DEFINED PLATFORM (
  ECHO Unsupported platform.
  GOTO errors
)

%_VECHO% Platform = '%PLATFORM%'

IF NOT DEFINED YEARS (
  SET YEARS=2008
)

%_VECHO% Years = '%YEARS%'

IF NOT DEFINED TEST_FILE (
  SET TEST_FILE=Tests\all.eagle
)

%_VECHO% TestFile = '%TEST_FILE%'
%_VECHO% PreArgs = '%PREARGS%'
%_VECHO% MidArgs = '%MIDARGS%'
%_VECHO% PostArgs = '%POSTARGS%'

IF NOT DEFINED 32BITONLY (
  SET EAGLESHELL=EagleShell.exe
) ELSE (
  SET EAGLESHELL=EagleShell32.exe
)

%_VECHO% EagleShell = '%EAGLESHELL%'

REM
REM NOTE: Set an environment variable that can be used by the test suite to
REM       determine that testing is being performed in batch mode.
REM
REM HACK: If the SKIPMAIN environment variable is set, completely skip the
REM       main loop.  This allows callers to skip 64-bit testing and proceed
REM       directly to 32-bit testing.
REM
IF NOT DEFINED SKIPMAIN (
  %_CECHO2% PUSHD "%ROOT%"
  %__ECHO2% PUSHD "%ROOT%"

  IF ERRORLEVEL 1 (
    ECHO Could not change directory to "%ROOT%".
    GOTO errors
  )

  SET TEST_ALL=1

  FOR %%C IN (%TEST_CONFIGURATIONS%) DO (
    FOR %%Y IN (%YEARS%) DO (
      IF EXIST "bin\%%Y\%%C\bin" (
        IF DEFINED 32BITONLY (
          %__ECHO% DEL /Q "bin\%%Y\%%C\bin\SQLite.Interop.*"

          IF ERRORLEVEL 1 (
            ECHO Failed to delete "bin\%%Y\%%C\bin\SQLite.Interop.*".
            GOTO errors
          )
        )

        IF NOT DEFINED NOMANAGEDONLY (
          %_CECHO% "Externals\Eagle\bin\netFramework40\%EAGLESHELL%" %PREARGS% -anyInitialize "set test_year {%%Y}; set test_configuration {%%C}" %MIDARGS% -file "%TEST_FILE%" %POSTARGS%
          %__ECHO% "Externals\Eagle\bin\netFramework40\%EAGLESHELL%" %PREARGS% -anyInitialize "set test_year {%%Y}; set test_configuration {%%C}" %MIDARGS% -file "%TEST_FILE%" %POSTARGS%

          CALL :fn_FixErrorLevel

          IF ERRORLEVEL 1 (
            ECHO Testing of "%%Y/%%C" managed-only assembly failed.
            GOTO errors
          )
        )

        IF EXIST "bin\%%Y\%PLATFORM%\%%C" (
          IF NOT DEFINED NOMIXEDMODE (
            IF NOT DEFINED NOXCOPY (
              CALL :fn_CheckForLinq %%Y

              %__ECHO% XCOPY "bin\%%Y\%%C\bin\test.*" "bin\%%Y\%PLATFORM%\%%C" %FFLAGS% %DFLAGS%

              IF ERRORLEVEL 1 (
                ECHO Failed to copy "bin\%%Y\%%C\bin\test.*" to "bin\%%Y\%PLATFORM%\%%C".
                GOTO errors
              )

              IF DEFINED HAVE_LINQ (
                %__ECHO% XCOPY "bin\%%Y\%%C\bin\System.Data.SQLite.Linq.*" "bin\%%Y\%PLATFORM%\%%C" %FFLAGS% %DFLAGS%

                IF ERRORLEVEL 1 (
                  ECHO Failed to copy "bin\%%Y\%%C\bin\System.Data.SQLite.Linq.*" to "bin\%%Y\%PLATFORM%\%%C".
                  GOTO errors
                )

                %__ECHO% XCOPY "bin\%%Y\%%C\bin\testlinq.*" "bin\%%Y\%PLATFORM%\%%C" %FFLAGS% %DFLAGS%

                IF ERRORLEVEL 1 (
                  ECHO Failed to copy "bin\%%Y\%%C\bin\testlinq.*" to "bin\%%Y\%PLATFORM%\%%C".
                  GOTO errors
                )

                %__ECHO% XCOPY "bin\%%Y\%%C\bin\northwindEF.db" "bin\%%Y\%PLATFORM%\%%C" %FFLAGS% %DFLAGS%

                IF ERRORLEVEL 1 (
                  ECHO Failed to copy "bin\%%Y\%%C\bin\northwindEF.db" to "bin\%%Y\%PLATFORM%\%%C".
                  GOTO errors
                )
              )

              IF DEFINED HAVE_EF6 (
                %__ECHO% XCOPY "bin\%%Y\%%C\bin\EntityFramework.*" "bin\%%Y\%PLATFORM%\%%C" %FFLAGS% %DFLAGS%

                IF ERRORLEVEL 1 (
                  ECHO Failed to copy "bin\%%Y\%%C\bin\EntityFramework.*" to "bin\%%Y\%PLATFORM%\%%C".
                  GOTO errors
                )

                %__ECHO% XCOPY "bin\%%Y\%%C\bin\System.Data.SQLite.EF6.*" "bin\%%Y\%PLATFORM%\%%C" %FFLAGS% %DFLAGS%

                IF ERRORLEVEL 1 (
                  ECHO Failed to copy "bin\%%Y\%%C\bin\System.Data.SQLite.EF6.*" to "bin\%%Y\%PLATFORM%\%%C".
                  GOTO errors
                )

                %__ECHO% XCOPY "bin\%%Y\%%C\bin\testef6.*" "bin\%%Y\%PLATFORM%\%%C" %FFLAGS% %DFLAGS%

                IF ERRORLEVEL 1 (
                  ECHO Failed to copy "bin\%%Y\%%C\bin\testef6.*" to "bin\%%Y\%PLATFORM%\%%C".
                  GOTO errors
                )
              )

              %__ECHO% XCOPY "bin\%%Y\%%C\bin\SQLite.Designer.*" "bin\%%Y\%PLATFORM%\%%C" %FFLAGS% %DFLAGS%

              IF ERRORLEVEL 1 (
                ECHO Failed to copy "bin\%%Y\%%C\bin\SQLite.Designer.*" to "bin\%%Y\%PLATFORM%\%%C".
                GOTO errors
              )

              %__ECHO% XCOPY "bin\%%Y\%%C\bin\Installer.*" "bin\%%Y\%PLATFORM%\%%C" %FFLAGS% %DFLAGS%

              IF ERRORLEVEL 1 (
                ECHO Failed to copy "bin\%%Y\%%C\bin\Installer.*" to "bin\%%Y\%PLATFORM%\%%C".
                GOTO errors
              )
            )

            %_CECHO% "Externals\Eagle\bin\netFramework40\%EAGLESHELL%" %PREARGS% -preInitialize "set test_year {%%Y}; set test_configuration {%%C}" -initialize -runtimeOption native %MIDARGS% -file "%TEST_FILE%" %POSTARGS%
            %__ECHO% "Externals\Eagle\bin\netFramework40\%EAGLESHELL%" %PREARGS% -preInitialize "set test_year {%%Y}; set test_configuration {%%C}" -initialize -runtimeOption native %MIDARGS% -file "%TEST_FILE%" %POSTARGS%

            CALL :fn_FixErrorLevel

            IF ERRORLEVEL 1 (
              ECHO Testing of "%%Y/%%C" mixed-mode assembly failed.
              GOTO errors
            )
          )
        ) ELSE (
          %_AECHO% Native directory "bin\%%Y\%PLATFORM%\%%C" not found, skipped.
        )
      ) ELSE (
        %_AECHO% Managed directory "bin\%%Y\%%C\bin" not found, skipped.
      )
    )
  )

  %_CECHO2% POPD
  %__ECHO2% POPD

  IF ERRORLEVEL 1 (
    ECHO Could not restore directory.
    GOTO errors
  )
)

REM
REM NOTE: If this is a 64-bit machine and we have not already run the 32-bit
REM       tests, do so now, unless we are forbidden from doing so.
REM
IF NOT DEFINED SKIP32BITONLY (
  IF NOT DEFINED 32BITONLY (
    IF /I NOT "%PROCESSOR_ARCHITECTURE%" == "x86" (
      REM
      REM HACK: Always unset the SKIPMAIN environment variable so the primary
      REM       loop will run when only the 32-bit binaries are being tested.
      REM
      CALL :fn_UnsetVariable SKIPMAIN

      SET PLATFORM=Win32
      SET 32BITONLY=1
      GOTO redo
    )
  )
)

GOTO no_errors

:fn_CheckForLinq
  CALL :fn_UnsetVariable HAVE_LINQ
  CALL :fn_UnsetVariable HAVE_EF6
  IF /I "%1" == "2008" (
    SET HAVE_LINQ=1
  )
  IF /I "%1" == "2010" (
    SET HAVE_LINQ=1
    SET HAVE_EF6=1
  )
  IF /I "%1" == "2012" (
    SET HAVE_LINQ=1
    SET HAVE_EF6=1
  )
  IF /I "%1" == "2013" (
    SET HAVE_LINQ=1
    SET HAVE_EF6=1
  )
  IF /I "%1" == "2015" (
    SET HAVE_LINQ=1
    SET HAVE_EF6=1
  )
  IF /I "%1" == "2017" (
    SET HAVE_LINQ=1
    SET HAVE_EF6=1
  )
  GOTO :EOF

:fn_UnsetVariable
  SETLOCAL
  SET VALUE=%1
  IF DEFINED VALUE (
    SET VALUE=
    ENDLOCAL
    SET %VALUE%=
  ) ELSE (
    ENDLOCAL
  )
  CALL :fn_ResetErrorLevel
  GOTO :EOF

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:fn_FixErrorLevel
  IF %ERRORLEVEL% NEQ 0 (
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Test failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Test success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/test_ce_200x.bat.





















































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
@ECHO OFF

::
:: test_ce_200x.bat --
::
:: WinCE Testing Tool
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

CALL :fn_UnsetVariable BREAK

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

SET ROOT=%~dp0\..
SET ROOT=%ROOT:\\=\%

%_VECHO% Root = '%ROOT%'

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

SET EAGLEBINDIR=%ROOT%\Externals\Eagle\bin\netFramework40

CALL :fn_PrependToPath EAGLEBINDIR

%_VECHO% EagleBinDir = '%EAGLEBINDIR%'
%_VECHO% Path = '%PATH%'

%_CECHO3% CALL "%TOOLS%\vsSp.bat"
%__ECHO3% CALL "%TOOLS%\vsSp.bat"

IF ERRORLEVEL 1 (
  ECHO Could not detect Visual Studio.
  GOTO errors
)

%_CECHO3% CALL "%TOOLS%\set_common.bat"
%__ECHO3% CALL "%TOOLS%\set_common.bat"

IF ERRORLEVEL 1 (
  ECHO Could not set common variables.
  GOTO errors
)

IF NOT DEFINED TEST_CONFIGURATIONS (
  SET TEST_CONFIGURATIONS=Release
)

%_VECHO% TestConfigurations = '%TEST_CONFIGURATIONS%'

REM
REM NOTE: Reset the PLATFORMS variable to reflect the devices supported by the
REM       projects being tested.
REM
SET PLATFORMS="Pocket PC 2003 (ARMV4)"

%_VECHO% Platforms = '%PLATFORMS%'

REM
REM NOTE: The .NET Compact Framework is only supported by Visual Studio 2005
REM       and 2008, regardless of which versions of Visual Studio are installed
REM       on this machine; therefore, override the YEARS variable limiting it
REM       to 2005 and 2008 only.
REM
CALL :fn_UnsetVariable YEARS

IF NOT DEFINED NOVS2005 (
  IF DEFINED VS2005SP (
    CALL :fn_AppendVariable YEARS " 2005"
  )
)

IF NOT DEFINED NOVS2008 (
  IF DEFINED VS2008SP (
    CALL :fn_AppendVariable YEARS " 2008"
  )
)

%_VECHO% Years = '%YEARS%'

IF NOT DEFINED 32BITONLY (
  SET EAGLESHELL=EagleShell.exe
) ELSE (
  SET EAGLESHELL=EagleShell32.exe
)

%_VECHO% EagleShell = '%EAGLESHELL%'

FOR %%C IN (%TEST_CONFIGURATIONS%) DO (
  FOR %%P IN (%PLATFORMS%) DO (
    FOR %%Y IN (%YEARS%) DO (
      %_CECHO% "%EAGLESHELL%" -file "%TOOLS%\deployAndTestCe200x.eagle" %%Y %%P %%C
      %__ECHO% "%EAGLESHELL%" -file "%TOOLS%\deployAndTestCe200x.eagle" %%Y %%P %%C

      CALL :fn_FixErrorLevel

      IF ERRORLEVEL 1 (
        ECHO Tests failed for %%C/%%P/%%Y binaries.
        GOTO errors
      )
    )
  )
)

GOTO no_errors

:fn_AppendVariable
  SET __ECHO_CMD=ECHO %%%1%%
  IF DEFINED %1 (
    FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
      SET %1=%%V%~2
    )
  ) ELSE (
    SET %1=%~2
  )
  SET __ECHO_CMD=
  CALL :fn_ResetErrorLevel
  GOTO :EOF

:fn_UnsetVariable
  SETLOCAL
  SET VALUE=%1
  IF DEFINED VALUE (
    SET VALUE=
    ENDLOCAL
    SET %VALUE%=
  ) ELSE (
    ENDLOCAL
  )
  CALL :fn_ResetErrorLevel
  GOTO :EOF

:fn_PrependToPath
  IF NOT DEFINED %1 GOTO :EOF
  SETLOCAL
  SET __ECHO_CMD=ECHO %%%1%%
  FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
    SET VALUE=%%V
  )
  SET VALUE=%VALUE:"=%
  REM "
  ENDLOCAL && SET PATH=%VALUE%;%PATH%
  GOTO :EOF

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:fn_FixErrorLevel
  IF %ERRORLEVEL% NEQ 0 (
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Test failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Test success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/test_net_5.bat.

























































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
@ECHO OFF

::
:: test_net_5.bat --
::
:: .NET 5 Multiplexing Wrapper Tool for Unit Tests
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

REM SET DFLAGS=/L

%_VECHO% DFlags = '%DFLAGS%'

SET FFLAGS=/V /F /G /H /I /R /Y /Z

%_VECHO% FFlags = '%FFLAGS%'

SET ROOT=%~dp0\..
SET ROOT=%ROOT:\\=\%

%_VECHO% Root = '%ROOT%'

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

CALL :fn_ResetErrorLevel

SET NONETSTANDARD20=1

%_CECHO3% CALL "%TOOLS%\set_common.bat"
%__ECHO3% CALL "%TOOLS%\set_common.bat"

IF ERRORLEVEL 1 (
  ECHO Could not set common variables.
  GOTO errors
)

IF NOT DEFINED DOTNET (
  SET DOTNET=dotnet.exe
)

%_VECHO% DotNet = '%DOTNET%'

IF NOT DEFINED SUBCOMMANDS (
  SET SUBCOMMANDS=exec
)

%_VECHO% SubCommands = '%SUBCOMMANDS%'

IF NOT DEFINED TEST_NATIVE_CONFIGURATIONS (
  SET TEST_NATIVE_CONFIGURATIONS=ReleaseNativeOnly
)

%_VECHO% TestNativeConfigurations = '%TEST_NATIVE_CONFIGURATIONS%'

IF DEFINED PLATFORM (
  %_AECHO% Skipping platform detection, already set...
  GOTO skip_detectPlatform
)

IF /I "%PROCESSOR_ARCHITECTURE%" == "x86" (
  SET PLATFORM=Win32
)

IF /I "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
  SET PLATFORM=x64
)

:skip_detectPlatform

IF NOT DEFINED PLATFORM (
  ECHO Unsupported platform.
  GOTO errors
)

%_VECHO% Platform = '%PLATFORM%'

IF NOT DEFINED YEARS (
  SET YEARS=NetStandard21
)

%_VECHO% Years = '%YEARS%'

IF NOT DEFINED NATIVE_YEARS (
  SET NATIVE_YEARS=2017 2015
)

%_VECHO% NativeYears = '%NATIVE_YEARS%'

IF NOT DEFINED TEST_FILE (
  SET TEST_FILE=Tests\all.eagle
)

%_VECHO% TestFile = '%TEST_FILE%'
%_VECHO% PreArgs = '%PREARGS%'
%_VECHO% MidArgs = '%MIDARGS%'
%_VECHO% PostArgs = '%POSTARGS%'

IF NOT DEFINED EAGLESHELL (
  SET EAGLESHELL=EagleShell.dll
)

%_VECHO% EagleShell = '%EAGLESHELL%'

CALL :fn_VerifyDotNetCore
IF ERRORLEVEL 1 GOTO errors

%_CECHO2% PUSHD "%ROOT%"
%__ECHO2% PUSHD "%ROOT%"

IF ERRORLEVEL 1 (
  ECHO Could not change directory to "%ROOT%".
  GOTO errors
)

REM ****************************************************************************
REM *********************** Disable Microsoft Telemetry ************************
REM ****************************************************************************

SET VSCMD_SKIP_SENDTELEMETRY=1
SET VCPKG_KEEP_ENV_VARS=VSCMD_SKIP_SENDTELEMETRY
SET DOTNET_CLI_TELEMETRY_OPTOUT=1

REM ****************************************************************************
REM **************************** Run the Test Suite ****************************
REM ****************************************************************************

SET TEST_ALL=1

FOR %%C IN (%TEST_NATIVE_CONFIGURATIONS%) DO (
  FOR %%Y IN (%YEARS%) DO (
    FOR %%N IN (%NATIVE_YEARS%) DO (
      CALL :fn_RunDotNetCoreTestSuite %%C %%Y %%N
      IF ERRORLEVEL 1 GOTO errors
    )
  )
)

%_CECHO2% POPD
%__ECHO2% POPD

IF ERRORLEVEL 1 (
  ECHO Could not restore directory.
  GOTO errors
)

GOTO no_errors

:fn_VerifyDotNetCore
  FOR %%T IN (%DOTNET%) DO (
    SET %%T_PATH=%%~dp$PATH:T
  )
  IF NOT DEFINED %DOTNET%_PATH (
    ECHO The .NET Core executable "%DOTNET%" is required to be in the PATH.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  GOTO :EOF

:fn_RunDotNetCoreTestSuite
  SET NATIVE_CONFIGURATION=%1
  IF NOT DEFINED NATIVE_CONFIGURATION (
    ECHO Cannot run .NET Core test suite, missing native configuration.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  SET YEAR=%2
  IF NOT DEFINED YEAR (
    ECHO Cannot run .NET Core test suite, missing year.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  SET NATIVE_YEAR=%3
  IF NOT DEFINED NATIVE_YEAR (
    ECHO Cannot run .NET Core test suite, missing native year.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  SET CONFIGURATION=%NATIVE_CONFIGURATION%
  SET CONFIGURATION=%CONFIGURATION:NativeOnly=%
  IF EXIST "bin\%YEAR%\%CONFIGURATION%NetStandard21\bin" (
    IF EXIST "bin\%NATIVE_YEAR%\%PLATFORM%\%NATIVE_CONFIGURATION%" (
      %_CECHO% "%DOTNET%" %SUBCOMMANDS% "Externals\Eagle\bin\net5\%EAGLESHELL%" %PREARGS% -anyInitialize "set test_year {%YEAR%}; set test_native_year {%NATIVE_YEAR%}; set test_configuration {%CONFIGURATION%}; set test_configuration_suffix NetStandard21" -initialize -postInitialize "unset -nocomplain no(deleteSqliteImplicitNativeFiles); unset -nocomplain no(copySqliteImplicitNativeFiles)" %MIDARGS% -file "%TEST_FILE%" %POSTARGS%
      %__ECHO% "%DOTNET%" %SUBCOMMANDS% "Externals\Eagle\bin\net5\%EAGLESHELL%" %PREARGS% -anyInitialize "set test_year {%YEAR%}; set test_native_year {%NATIVE_YEAR%}; set test_configuration {%CONFIGURATION%}; set test_configuration_suffix NetStandard21" -initialize -postInitialize "unset -nocomplain no(deleteSqliteImplicitNativeFiles); unset -nocomplain no(copySqliteImplicitNativeFiles)" %MIDARGS% -file "%TEST_FILE%" %POSTARGS%
      CALL :fn_FixErrorLevel
      IF ERRORLEVEL 1 (
        ECHO Testing of "%YEAR%/%NATIVE_YEAR%/%CONFIGURATION%" .NET Standard 2.1 assembly via .NET 5 failed.
        CALL :fn_SetErrorLevel
        GOTO :EOF
      )
    ) ELSE (
      %_AECHO% Native directory "bin\%NATIVE_YEAR%\%PLATFORM%\%NATIVE_CONFIGURATION%" not found, skipped.
    )
  ) ELSE (
    %_AECHO% Managed directory "bin\%YEAR%\%CONFIGURATION%NetStandard21\bin" not found, skipped.
  )
  GOTO :EOF

:fn_SetVariable
  SETLOCAL
  SET __ECHO_CMD=ECHO %%%2%%
  FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
    SET VALUE=%%V
  )
  ENDLOCAL && (
    SET %1=%VALUE%
  )
  GOTO :EOF

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:fn_FixErrorLevel
  IF %ERRORLEVEL% NEQ 0 (
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Test failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Test success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/test_net_6.bat.

























































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
@ECHO OFF

::
:: test_net_6.bat --
::
:: .NET 6 Multiplexing Wrapper Tool for Unit Tests
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

REM SET DFLAGS=/L

%_VECHO% DFlags = '%DFLAGS%'

SET FFLAGS=/V /F /G /H /I /R /Y /Z

%_VECHO% FFlags = '%FFLAGS%'

SET ROOT=%~dp0\..
SET ROOT=%ROOT:\\=\%

%_VECHO% Root = '%ROOT%'

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

CALL :fn_ResetErrorLevel

SET NONETSTANDARD20=1

%_CECHO3% CALL "%TOOLS%\set_common.bat"
%__ECHO3% CALL "%TOOLS%\set_common.bat"

IF ERRORLEVEL 1 (
  ECHO Could not set common variables.
  GOTO errors
)

IF NOT DEFINED DOTNET (
  SET DOTNET=dotnet.exe
)

%_VECHO% DotNet = '%DOTNET%'

IF NOT DEFINED SUBCOMMANDS (
  SET SUBCOMMANDS=exec
)

%_VECHO% SubCommands = '%SUBCOMMANDS%'

IF NOT DEFINED TEST_NATIVE_CONFIGURATIONS (
  SET TEST_NATIVE_CONFIGURATIONS=ReleaseNativeOnly
)

%_VECHO% TestNativeConfigurations = '%TEST_NATIVE_CONFIGURATIONS%'

IF DEFINED PLATFORM (
  %_AECHO% Skipping platform detection, already set...
  GOTO skip_detectPlatform
)

IF /I "%PROCESSOR_ARCHITECTURE%" == "x86" (
  SET PLATFORM=Win32
)

IF /I "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
  SET PLATFORM=x64
)

:skip_detectPlatform

IF NOT DEFINED PLATFORM (
  ECHO Unsupported platform.
  GOTO errors
)

%_VECHO% Platform = '%PLATFORM%'

IF NOT DEFINED YEARS (
  SET YEARS=NetStandard21
)

%_VECHO% Years = '%YEARS%'

IF NOT DEFINED NATIVE_YEARS (
  SET NATIVE_YEARS=2019 2017 2015
)

%_VECHO% NativeYears = '%NATIVE_YEARS%'

IF NOT DEFINED TEST_FILE (
  SET TEST_FILE=Tests\all.eagle
)

%_VECHO% TestFile = '%TEST_FILE%'
%_VECHO% PreArgs = '%PREARGS%'
%_VECHO% MidArgs = '%MIDARGS%'
%_VECHO% PostArgs = '%POSTARGS%'

IF NOT DEFINED EAGLESHELL (
  SET EAGLESHELL=EagleShell.dll
)

%_VECHO% EagleShell = '%EAGLESHELL%'

CALL :fn_VerifyDotNetCore
IF ERRORLEVEL 1 GOTO errors

%_CECHO2% PUSHD "%ROOT%"
%__ECHO2% PUSHD "%ROOT%"

IF ERRORLEVEL 1 (
  ECHO Could not change directory to "%ROOT%".
  GOTO errors
)

REM ****************************************************************************
REM *********************** Disable Microsoft Telemetry ************************
REM ****************************************************************************

SET VSCMD_SKIP_SENDTELEMETRY=1
SET VCPKG_KEEP_ENV_VARS=VSCMD_SKIP_SENDTELEMETRY
SET DOTNET_CLI_TELEMETRY_OPTOUT=1

REM ****************************************************************************
REM **************************** Run the Test Suite ****************************
REM ****************************************************************************

SET TEST_ALL=1

FOR %%C IN (%TEST_NATIVE_CONFIGURATIONS%) DO (
  FOR %%Y IN (%YEARS%) DO (
    FOR %%N IN (%NATIVE_YEARS%) DO (
      CALL :fn_RunDotNetCoreTestSuite %%C %%Y %%N
      IF ERRORLEVEL 1 GOTO errors
    )
  )
)

%_CECHO2% POPD
%__ECHO2% POPD

IF ERRORLEVEL 1 (
  ECHO Could not restore directory.
  GOTO errors
)

GOTO no_errors

:fn_VerifyDotNetCore
  FOR %%T IN (%DOTNET%) DO (
    SET %%T_PATH=%%~dp$PATH:T
  )
  IF NOT DEFINED %DOTNET%_PATH (
    ECHO The .NET Core executable "%DOTNET%" is required to be in the PATH.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  GOTO :EOF

:fn_RunDotNetCoreTestSuite
  SET NATIVE_CONFIGURATION=%1
  IF NOT DEFINED NATIVE_CONFIGURATION (
    ECHO Cannot run .NET Core test suite, missing native configuration.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  SET YEAR=%2
  IF NOT DEFINED YEAR (
    ECHO Cannot run .NET Core test suite, missing year.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  SET NATIVE_YEAR=%3
  IF NOT DEFINED NATIVE_YEAR (
    ECHO Cannot run .NET Core test suite, missing native year.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  SET CONFIGURATION=%NATIVE_CONFIGURATION%
  SET CONFIGURATION=%CONFIGURATION:NativeOnly=%
  IF EXIST "bin\%YEAR%\%CONFIGURATION%NetStandard21\bin" (
    IF EXIST "bin\%NATIVE_YEAR%\%PLATFORM%\%NATIVE_CONFIGURATION%" (
      %_CECHO% "%DOTNET%" %SUBCOMMANDS% "Externals\Eagle\bin\net6\%EAGLESHELL%" %PREARGS% -anyInitialize "set test_year {%YEAR%}; set test_native_year {%NATIVE_YEAR%}; set test_configuration {%CONFIGURATION%}; set test_configuration_suffix NetStandard21; set test_extra netstandard2.1" -initialize -postInitialize "unset -nocomplain no(deleteSqliteImplicitNativeFiles); unset -nocomplain no(copySqliteImplicitNativeFiles)" %MIDARGS% -file "%TEST_FILE%" %POSTARGS%
      %__ECHO% "%DOTNET%" %SUBCOMMANDS% "Externals\Eagle\bin\net6\%EAGLESHELL%" %PREARGS% -anyInitialize "set test_year {%YEAR%}; set test_native_year {%NATIVE_YEAR%}; set test_configuration {%CONFIGURATION%}; set test_configuration_suffix NetStandard21; set test_extra netstandard2.1" -initialize -postInitialize "unset -nocomplain no(deleteSqliteImplicitNativeFiles); unset -nocomplain no(copySqliteImplicitNativeFiles)" %MIDARGS% -file "%TEST_FILE%" %POSTARGS%
      CALL :fn_FixErrorLevel
      IF ERRORLEVEL 1 (
        ECHO Testing of "%YEAR%/%NATIVE_YEAR%/%CONFIGURATION%" .NET Standard 2.1 assembly via .NET 6 failed.
        CALL :fn_SetErrorLevel
        GOTO :EOF
      )
    ) ELSE (
      %_AECHO% Native directory "bin\%NATIVE_YEAR%\%PLATFORM%\%NATIVE_CONFIGURATION%" not found, skipped.
    )
  ) ELSE (
    %_AECHO% Managed directory "bin\%YEAR%\%CONFIGURATION%NetStandard21\bin" not found, skipped.
  )
  GOTO :EOF

:fn_SetVariable
  SETLOCAL
  SET __ECHO_CMD=ECHO %%%2%%
  FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
    SET VALUE=%%V
  )
  ENDLOCAL && (
    SET %1=%VALUE%
  )
  GOTO :EOF

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:fn_FixErrorLevel
  IF %ERRORLEVEL% NEQ 0 (
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Test failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Test success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/test_net_core_20.bat.

























































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
@ECHO OFF

::
:: test_net_core_20.bat --
::
:: .NET Core 2.0 Multiplexing Wrapper Tool for Unit Tests
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

REM SET DFLAGS=/L

%_VECHO% DFlags = '%DFLAGS%'

SET FFLAGS=/V /F /G /H /I /R /Y /Z

%_VECHO% FFlags = '%FFLAGS%'

SET ROOT=%~dp0\..
SET ROOT=%ROOT:\\=\%

%_VECHO% Root = '%ROOT%'

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

CALL :fn_ResetErrorLevel

SET NONETSTANDARD21=1

%_CECHO3% CALL "%TOOLS%\set_common.bat"
%__ECHO3% CALL "%TOOLS%\set_common.bat"

IF ERRORLEVEL 1 (
  ECHO Could not set common variables.
  GOTO errors
)

IF NOT DEFINED DOTNET (
  SET DOTNET=dotnet.exe
)

%_VECHO% DotNet = '%DOTNET%'

IF NOT DEFINED SUBCOMMANDS (
  SET SUBCOMMANDS=exec
)

%_VECHO% SubCommands = '%SUBCOMMANDS%'

IF NOT DEFINED TEST_NATIVE_CONFIGURATIONS (
  SET TEST_NATIVE_CONFIGURATIONS=ReleaseNativeOnly
)

%_VECHO% TestNativeConfigurations = '%TEST_NATIVE_CONFIGURATIONS%'

IF DEFINED PLATFORM (
  %_AECHO% Skipping platform detection, already set...
  GOTO skip_detectPlatform
)

IF /I "%PROCESSOR_ARCHITECTURE%" == "x86" (
  SET PLATFORM=Win32
)

IF /I "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
  SET PLATFORM=x64
)

:skip_detectPlatform

IF NOT DEFINED PLATFORM (
  ECHO Unsupported platform.
  GOTO errors
)

%_VECHO% Platform = '%PLATFORM%'

IF NOT DEFINED YEARS (
  SET YEARS=NetStandard20
)

%_VECHO% Years = '%YEARS%'

IF NOT DEFINED NATIVE_YEARS (
  SET NATIVE_YEARS=2017 2015
)

%_VECHO% NativeYears = '%NATIVE_YEARS%'

IF NOT DEFINED TEST_FILE (
  SET TEST_FILE=Tests\all.eagle
)

%_VECHO% TestFile = '%TEST_FILE%'
%_VECHO% PreArgs = '%PREARGS%'
%_VECHO% MidArgs = '%MIDARGS%'
%_VECHO% PostArgs = '%POSTARGS%'

IF NOT DEFINED EAGLESHELL (
  SET EAGLESHELL=EagleShell.dll
)

%_VECHO% EagleShell = '%EAGLESHELL%'

CALL :fn_VerifyDotNetCore
IF ERRORLEVEL 1 GOTO errors

%_CECHO2% PUSHD "%ROOT%"
%__ECHO2% PUSHD "%ROOT%"

IF ERRORLEVEL 1 (
  ECHO Could not change directory to "%ROOT%".
  GOTO errors
)

REM ****************************************************************************
REM *********************** Disable Microsoft Telemetry ************************
REM ****************************************************************************

SET VSCMD_SKIP_SENDTELEMETRY=1
SET VCPKG_KEEP_ENV_VARS=VSCMD_SKIP_SENDTELEMETRY
SET DOTNET_CLI_TELEMETRY_OPTOUT=1

REM ****************************************************************************
REM **************************** Run the Test Suite ****************************
REM ****************************************************************************

SET TEST_ALL=1

FOR %%C IN (%TEST_NATIVE_CONFIGURATIONS%) DO (
  FOR %%Y IN (%YEARS%) DO (
    FOR %%N IN (%NATIVE_YEARS%) DO (
      CALL :fn_RunDotNetCoreTestSuite %%C %%Y %%N
      IF ERRORLEVEL 1 GOTO errors
    )
  )
)

%_CECHO2% POPD
%__ECHO2% POPD

IF ERRORLEVEL 1 (
  ECHO Could not restore directory.
  GOTO errors
)

GOTO no_errors

:fn_VerifyDotNetCore
  FOR %%T IN (%DOTNET%) DO (
    SET %%T_PATH=%%~dp$PATH:T
  )
  IF NOT DEFINED %DOTNET%_PATH (
    ECHO The .NET Core executable "%DOTNET%" is required to be in the PATH.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  GOTO :EOF

:fn_RunDotNetCoreTestSuite
  SET NATIVE_CONFIGURATION=%1
  IF NOT DEFINED NATIVE_CONFIGURATION (
    ECHO Cannot run .NET Core test suite, missing native configuration.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  SET YEAR=%2
  IF NOT DEFINED YEAR (
    ECHO Cannot run .NET Core test suite, missing year.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  SET NATIVE_YEAR=%3
  IF NOT DEFINED NATIVE_YEAR (
    ECHO Cannot run .NET Core test suite, missing native year.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  SET CONFIGURATION=%NATIVE_CONFIGURATION%
  SET CONFIGURATION=%CONFIGURATION:NativeOnly=%
  IF EXIST "bin\%YEAR%\%CONFIGURATION%NetStandard20\bin" (
    IF EXIST "bin\%NATIVE_YEAR%\%PLATFORM%\%NATIVE_CONFIGURATION%" (
      %_CECHO% "%DOTNET%" %SUBCOMMANDS% "Externals\Eagle\bin\netCore20\%EAGLESHELL%" %PREARGS% -anyInitialize "set test_year {%YEAR%}; set test_native_year {%NATIVE_YEAR%}; set test_configuration {%CONFIGURATION%}; set test_configuration_suffix NetStandard20" -initialize -postInitialize "unset -nocomplain no(deleteSqliteImplicitNativeFiles); unset -nocomplain no(copySqliteImplicitNativeFiles)" %MIDARGS% -file "%TEST_FILE%" %POSTARGS%
      %__ECHO% "%DOTNET%" %SUBCOMMANDS% "Externals\Eagle\bin\netCore20\%EAGLESHELL%" %PREARGS% -anyInitialize "set test_year {%YEAR%}; set test_native_year {%NATIVE_YEAR%}; set test_configuration {%CONFIGURATION%}; set test_configuration_suffix NetStandard20" -initialize -postInitialize "unset -nocomplain no(deleteSqliteImplicitNativeFiles); unset -nocomplain no(copySqliteImplicitNativeFiles)" %MIDARGS% -file "%TEST_FILE%" %POSTARGS%
      CALL :fn_FixErrorLevel
      IF ERRORLEVEL 1 (
        ECHO Testing of "%YEAR%/%NATIVE_YEAR%/%CONFIGURATION%" .NET Standard 2.0 assembly via .NET Core 2.0 failed.
        CALL :fn_SetErrorLevel
        GOTO :EOF
      )
    ) ELSE (
      %_AECHO% Native directory "bin\%NATIVE_YEAR%\%PLATFORM%\%NATIVE_CONFIGURATION%" not found, skipped.
    )
  ) ELSE (
    %_AECHO% Managed directory "bin\%YEAR%\%CONFIGURATION%NetStandard20\bin" not found, skipped.
  )
  GOTO :EOF

:fn_SetVariable
  SETLOCAL
  SET __ECHO_CMD=ECHO %%%2%%
  FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
    SET VALUE=%%V
  )
  ENDLOCAL && (
    SET %1=%VALUE%
  )
  GOTO :EOF

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:fn_FixErrorLevel
  IF %ERRORLEVEL% NEQ 0 (
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Test failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Test success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/test_net_core_30.bat.

























































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
@ECHO OFF

::
:: test_net_core_30.bat --
::
:: .NET Core 3.0 Multiplexing Wrapper Tool for Unit Tests
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

REM SET DFLAGS=/L

%_VECHO% DFlags = '%DFLAGS%'

SET FFLAGS=/V /F /G /H /I /R /Y /Z

%_VECHO% FFlags = '%FFLAGS%'

SET ROOT=%~dp0\..
SET ROOT=%ROOT:\\=\%

%_VECHO% Root = '%ROOT%'

SET TOOLS=%~dp0
SET TOOLS=%TOOLS:~0,-1%

%_VECHO% Tools = '%TOOLS%'

CALL :fn_ResetErrorLevel

SET NONETSTANDARD20=1

%_CECHO3% CALL "%TOOLS%\set_common.bat"
%__ECHO3% CALL "%TOOLS%\set_common.bat"

IF ERRORLEVEL 1 (
  ECHO Could not set common variables.
  GOTO errors
)

IF NOT DEFINED DOTNET (
  SET DOTNET=dotnet.exe
)

%_VECHO% DotNet = '%DOTNET%'

IF NOT DEFINED SUBCOMMANDS (
  SET SUBCOMMANDS=exec
)

%_VECHO% SubCommands = '%SUBCOMMANDS%'

IF NOT DEFINED TEST_NATIVE_CONFIGURATIONS (
  SET TEST_NATIVE_CONFIGURATIONS=ReleaseNativeOnly
)

%_VECHO% TestNativeConfigurations = '%TEST_NATIVE_CONFIGURATIONS%'

IF DEFINED PLATFORM (
  %_AECHO% Skipping platform detection, already set...
  GOTO skip_detectPlatform
)

IF /I "%PROCESSOR_ARCHITECTURE%" == "x86" (
  SET PLATFORM=Win32
)

IF /I "%PROCESSOR_ARCHITECTURE%" == "AMD64" (
  SET PLATFORM=x64
)

:skip_detectPlatform

IF NOT DEFINED PLATFORM (
  ECHO Unsupported platform.
  GOTO errors
)

%_VECHO% Platform = '%PLATFORM%'

IF NOT DEFINED YEARS (
  SET YEARS=NetStandard21
)

%_VECHO% Years = '%YEARS%'

IF NOT DEFINED NATIVE_YEARS (
  SET NATIVE_YEARS=2019 2017 2015
)

%_VECHO% NativeYears = '%NATIVE_YEARS%'

IF NOT DEFINED TEST_FILE (
  SET TEST_FILE=Tests\all.eagle
)

%_VECHO% TestFile = '%TEST_FILE%'
%_VECHO% PreArgs = '%PREARGS%'
%_VECHO% MidArgs = '%MIDARGS%'
%_VECHO% PostArgs = '%POSTARGS%'

IF NOT DEFINED EAGLESHELL (
  SET EAGLESHELL=EagleShell.dll
)

%_VECHO% EagleShell = '%EAGLESHELL%'

CALL :fn_VerifyDotNetCore
IF ERRORLEVEL 1 GOTO errors

%_CECHO2% PUSHD "%ROOT%"
%__ECHO2% PUSHD "%ROOT%"

IF ERRORLEVEL 1 (
  ECHO Could not change directory to "%ROOT%".
  GOTO errors
)

REM ****************************************************************************
REM *********************** Disable Microsoft Telemetry ************************
REM ****************************************************************************

SET VSCMD_SKIP_SENDTELEMETRY=1
SET VCPKG_KEEP_ENV_VARS=VSCMD_SKIP_SENDTELEMETRY
SET DOTNET_CLI_TELEMETRY_OPTOUT=1

REM ****************************************************************************
REM **************************** Run the Test Suite ****************************
REM ****************************************************************************

SET TEST_ALL=1

FOR %%C IN (%TEST_NATIVE_CONFIGURATIONS%) DO (
  FOR %%Y IN (%YEARS%) DO (
    FOR %%N IN (%NATIVE_YEARS%) DO (
      CALL :fn_RunDotNetCoreTestSuite %%C %%Y %%N
      IF ERRORLEVEL 1 GOTO errors
    )
  )
)

%_CECHO2% POPD
%__ECHO2% POPD

IF ERRORLEVEL 1 (
  ECHO Could not restore directory.
  GOTO errors
)

GOTO no_errors

:fn_VerifyDotNetCore
  FOR %%T IN (%DOTNET%) DO (
    SET %%T_PATH=%%~dp$PATH:T
  )
  IF NOT DEFINED %DOTNET%_PATH (
    ECHO The .NET Core executable "%DOTNET%" is required to be in the PATH.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  GOTO :EOF

:fn_RunDotNetCoreTestSuite
  SET NATIVE_CONFIGURATION=%1
  IF NOT DEFINED NATIVE_CONFIGURATION (
    ECHO Cannot run .NET Core test suite, missing native configuration.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  SET YEAR=%2
  IF NOT DEFINED YEAR (
    ECHO Cannot run .NET Core test suite, missing year.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  SET NATIVE_YEAR=%3
  IF NOT DEFINED NATIVE_YEAR (
    ECHO Cannot run .NET Core test suite, missing native year.
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  SET CONFIGURATION=%NATIVE_CONFIGURATION%
  SET CONFIGURATION=%CONFIGURATION:NativeOnly=%
  IF EXIST "bin\%YEAR%\%CONFIGURATION%NetStandard21\bin" (
    IF EXIST "bin\%NATIVE_YEAR%\%PLATFORM%\%NATIVE_CONFIGURATION%" (
      %_CECHO% "%DOTNET%" %SUBCOMMANDS% "Externals\Eagle\bin\netCore30\%EAGLESHELL%" %PREARGS% -anyInitialize "set test_year {%YEAR%}; set test_native_year {%NATIVE_YEAR%}; set test_configuration {%CONFIGURATION%}; set test_configuration_suffix NetStandard21; set test_extra netstandard2.1" -initialize -postInitialize "unset -nocomplain no(deleteSqliteImplicitNativeFiles); unset -nocomplain no(copySqliteImplicitNativeFiles)" %MIDARGS% -file "%TEST_FILE%" %POSTARGS%
      %__ECHO% "%DOTNET%" %SUBCOMMANDS% "Externals\Eagle\bin\netCore30\%EAGLESHELL%" %PREARGS% -anyInitialize "set test_year {%YEAR%}; set test_native_year {%NATIVE_YEAR%}; set test_configuration {%CONFIGURATION%}; set test_configuration_suffix NetStandard21; set test_extra netstandard2.1" -initialize -postInitialize "unset -nocomplain no(deleteSqliteImplicitNativeFiles); unset -nocomplain no(copySqliteImplicitNativeFiles)" %MIDARGS% -file "%TEST_FILE%" %POSTARGS%
      CALL :fn_FixErrorLevel
      IF ERRORLEVEL 1 (
        ECHO Testing of "%YEAR%/%NATIVE_YEAR%/%CONFIGURATION%" .NET Standard 2.1 assembly via .NET Core 3.0 failed.
        CALL :fn_SetErrorLevel
        GOTO :EOF
      )
    ) ELSE (
      %_AECHO% Native directory "bin\%NATIVE_YEAR%\%PLATFORM%\%NATIVE_CONFIGURATION%" not found, skipped.
    )
  ) ELSE (
    %_AECHO% Managed directory "bin\%YEAR%\%CONFIGURATION%NetStandard21\bin" not found, skipped.
  )
  GOTO :EOF

:fn_SetVariable
  SETLOCAL
  SET __ECHO_CMD=ECHO %%%2%%
  FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (
    SET VALUE=%%V
  )
  ENDLOCAL && (
    SET %1=%VALUE%
  )
  GOTO :EOF

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:fn_FixErrorLevel
  IF %ERRORLEVEL% NEQ 0 (
    CALL :fn_SetErrorLevel
    GOTO :EOF
  )
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Test failure, errors were encountered.
  GOTO end_of_file

:no_errors
  CALL :fn_ResetErrorLevel
  ENDLOCAL
  ECHO.
  ECHO Test success, no errors were encountered.
  GOTO end_of_file

:end_of_file
%__ECHO% EXIT /B %ERRORLEVEL%

Added Setup/updateFileInfo.tcl.



































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
###############################################################################
#
# updateFileInfo.tcl -- File Metadata Updating Tool
#
# WARNING: This tool requires the Fossil binary to exist somewhere along the
#          PATH.
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

proc readFile { fileName } {
  set file_id [open $fileName RDONLY]
  fconfigure $file_id -encoding binary -translation binary
  set result [read $file_id]
  close $file_id
  return $result
}

proc writeFile { fileName data } {
  set file_id [open $fileName {WRONLY CREAT TRUNC}]
  fconfigure $file_id -encoding binary -translation binary
  puts -nonewline $file_id $data
  close $file_id
  return ""
}

proc getFileSize { fileName } {
  #
  # NOTE: Return the number of mebibytes in the file with two digits after the
  #       decimal.
  #
  return [format %.2f [expr {[file size $fileName] / 1048576.0}]]
}

proc getFileHash { fileName } {
  #
  # NOTE: Return the SHA1 hash of the file, making use of Fossil via [exec] to
  #       actually calculate it.
  #
  return [string trim [lindex [regexp -inline -nocase -- {[0-9A-F]{40} } \
      [exec fossil sha1sum $fileName]] 0]]
}

#
# NOTE: Grab the fully qualified directory name of the directory containing
#       this script file.
#
set path [file normalize [file dirname [info script]]]

#
# NOTE: *WARNING* This assumes that the root of the source check-out is one
#       directory above the directory containing this script.
#
set root [file normalize [file dirname $path]]

#
# NOTE: Grab the name of the file to be updated from the command line, if
#       available; otherwise, use the defaults (i.e. "../www/downloads*.wiki").
#
if {[info exists argv] && [llength $argv] > 0} then {
  set updateFileNames [lindex $argv 0]
}

if {![info exists updateFileNames] || \
    [llength $updateFileNames] == 0} then {
  set updateFileNames [list \
      [file join $root www downloads.wiki] \
      [file join $root www downloads-unsup.wiki]]
}

#
# NOTE: Grab the directory containing the files referenced in the data of the
#       file to be updated from the command line, if available; otherwise, use
#       the default (i.e. "./Output").
#
if {[info exists argv] && [llength $argv] > 1} then {
  set outputDirectory [lindex $argv 1]
}

if {![info exists outputDirectory] || \
    [string length $outputDirectory] == 0} then {
  set outputDirectory [file join $path Output]
}

#
# NOTE: Setup the regular expression patterns with the necessary captures.
#       These patterns are mostly non-greedy; however, at the end we need to
#       match exactly 40 hexadecimal characters.  In theory, in Tcl, this can
#       have an undefined result due to the mixing of greedy and non-greedy
#       quantifiers; however, in practice, this seems to work properly.  Also,
#       these patterns assume a particular structure for the [HTML] file to be
#       updated.
#
set pattern1 {<a\
    href="[^"]*?/([^"]*?\.(?:exe|zip|nupkg))">.*?\((\d+?\.\d+?) MiB\).*?sha1:\
    ([0-9A-F]{40})}

set pattern2 {<a\
    href="[^"]*?/package/[^"]*?/\d+\.\d+\.\d+\.\d+">(.*?)</a>.*?\((\d+?\.\d+?)\
    MiB\).*?sha1: ([0-9A-F]{40})}

set pattern3 {href="/downloads/([^"]*?)"}
set pattern4 {\(sha1: ([0-9A-F]{40})\)}
set pattern5 {\((\d+?\.\d+?) MiB\)}

foreach updateFileName $updateFileNames {
  #
  # NOTE: Grab all the data from the file to be updated.
  #
  set data [readFile $updateFileName]

  #
  # NOTE: Initialize the total number of changes made to zero.
  #
  set count 0

  #
  # NOTE: Process each regular expression pattern against the page text.
  #
  foreach pattern [list $pattern1 $pattern2] {
    #
    # NOTE: Process each match in the data and capture the file name, size,
    #       and hash.
    #
    foreach {dummy fileName fileSize fileHash} \
        [regexp -all -inline -nocase -- $pattern $data] {
      #
      # NOTE: Get the fully qualified file name based on the configured
      #       directory.
      #
      set fullFileName [file join $outputDirectory [file tail $fileName]]

      #
      # NOTE: If the file does not exist, issue a warning and skip it.
      #
      if {![file exists $fullFileName]} then {
        puts stdout "WARNING: File \"$fullFileName\" does not exist, skipped."
        continue
      }

      #
      # NOTE: Replace the captured size and hash with ones calculated from the
      #       actual file name.  This will only replace the first instance of
      #       each (literal) match.  Since we are processing the matches in the
      #       exact order they appear in the data AND we are only replacing one
      #       literal instance per match AND the size sub-pattern is nothing
      #       like the hash sub-pattern, this should be 100% reliable.  In
      #       order to avoid superfluous matches of the file size or hash, the
      #       starting index is set to a position just beyond the matching file
      #       name.
      #
      set start [string first $fileName $data]

      if {$start == -1} then {
        puts stdout "WARNING: Position for \"$fileName\" not found, skipped."
        continue
      }

      incr start [string length $fileName]

      #
      # NOTE: Calculate the new file size and compare it to the old one.  If it
      #       has not changed, do nothing.
      #
      set newFileSize [getFileSize $fullFileName]

      if {$fileSize ne $newFileSize} then {
        incr count [regsub -nocase -start $start -- "***=$fileSize" $data \
            $newFileSize data]

        incr start [string length $fileSize]
      }

      #
      # NOTE: Calculate the new file hash and compare it to the old one.  If it
      #       has not changed, do nothing.
      #
      set newFileHash [getFileHash $fullFileName]

      if {$fileHash ne $newFileHash} then {
        incr count [regsub -nocase -start $start -- "***=$fileHash" $data \
            $newFileHash data]

        incr start [string length $fileHash]
      }
    }
  }

  #
  # NOTE: Attempt to verify that each file name now has the correct SHA1 hash
  #       associated with it on the page.
  #
  foreach {dummy3 fileName} [regexp -all -inline -nocase -- $pattern3 $data] \
          {dummy4 fileHash} [regexp -all -inline -nocase -- $pattern4 $data] \
          {dummy5 fileSize} [regexp -all -inline -nocase -- $pattern5 $data] {
    #
    # NOTE: Get the fully qualified file name based on the configured
    #       directory.
    #
    set fullFileName [file join $outputDirectory [file tail $fileName]]

    #
    # NOTE: If the file does not exist, issue a warning and skip it.
    #
    if {![file exists $fullFileName]} then {
      puts stdout "WARNING: File \"$fullFileName\" does not exist, skipped."
      continue
    }

    #
    # NOTE: Make sure the file hash from the [modified] data matches the
    #       calculated hash for the file.  If not, fail.
    #
    set fullFileHash [getFileHash $fullFileName]

    if {$fileHash ne $fullFileHash} then {
      puts stdout "ERROR: SHA1 hash mismatch for\
          file \"$fullFileName\", have \"$fileHash\" (from data),\
          need \"$fullFileHash\" (calculated)."
    }

    set fullFileSize [getFileSize $fullFileName]

    if {$fileSize ne $fullFileSize} then {
      puts stdout "ERROR: Byte size mismatch for\
          file \"$fullFileName\", have \"$fileSize\" (from data),\
          need \"$fullFileSize\" (calculated)."
    }
  }

  #
  # NOTE: Write the [modified] data to the file to be updated.
  #
  if {$count > 0} then {
    writeFile $updateFileName $data
  } else {
    puts stdout "WARNING: No changes, update of \"$updateFileName\" skipped."
  }
}

Added Setup/verify.eagle.





















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
###############################################################################
#
# verify.eagle -- Release Archive Verification Tool
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle

proc usage { error } {
  if {[string length $error] > 0} then {puts stdout $error}

  puts stdout "usage:\
[file tail [getShellExecutableName]]\
[file tail [info script]] <directory> <withHashes> \[failHashes\]"

  #
  # NOTE: Indicate to the caller, if any, that we have failed.
  #
  exit 1
}

proc getFileHashes { varName } {
  variable fossil

  upvar 1 $varName hashes

  set data [exec -success Success -nocarriagereturns -- \
      $fossil artifact current]; # or "release"

  set result 0
  set lines [split $data \n]

  foreach line $lines {
    if {[string range $line 0 1] eq "F "} then {
      set fields [split $line " "]

      if {[llength $fields] >= 3} then {
        set fileName [string map [list \\s " "] [lindex $fields 1]]
        set hash [lindex $fields 2]

        if {[regexp -- {[0-9a-f]{40,64}} $hash]} then {
          set hashes($fileName) $hash; incr result
        }
      }
    }
  }

  return $result
}

proc needSignature { fileName } {
  if {[file extension $fileName] in [list .dll .exe]} then {
    return true
  }

  return false
}

proc getSignature { fileName } {
  set channel [open $fileName RDONLY]
  makeBinaryChannel $channel
  set result [read $channel 4]
  close $channel

  set prefix [string range $result 0 1]

  if {$prefix eq "\x4D\x5A"} then {; # MZ
    set result $prefix
  }

  return $result
}

proc getSha1Sum { fileName } {
  variable fossil

  set hash [string range [exec -success Success -nocarriagereturns \
      -trimall -- $fossil sha1sum [appendArgs \" $fileName \"]] 0 39]

  if {[regexp -- {[0-9a-f]{40}} $hash]} then {
    return $hash
  }

  return ""
}

proc getSha3Sum { fileName } {
  variable fossil

  set hash [string range [exec -success Success -nocarriagereturns \
      -trimall -- $fossil sha3sum [appendArgs \" $fileName \"]] 0 63]

  if {[regexp -- {[0-9a-f]{64}} $hash]} then {
    return $hash
  }

  return ""
}

proc getInnoSetupRootMap {} {
  return [list app\\ [appendArgs {{app}} \\] tmp\\ [appendArgs {{tmp}} \\]]
}

proc getExecCommandPrefix {} {
  return [list exec -success Success -nocarriagereturns --]
}

proc combineErrors { error1 error2 } {
  return [appendArgs \n\n $error1 \n $error2 \n]
}

set argc [llength $argv]

if {$argc >= 2 && $argc <= 3} then {
  set directory [lindex $argv 0]

  if {[string length $directory] == 0} then {
    usage "invalid directory specified"
  }

  if {![file isdirectory $directory]} then {
    usage [appendArgs \
        "directory \"" $directory "\" does not exist"]
  }

  set withHashes [lindex $argv 1]

  if {[string length $withHashes] == 0} then {
    usage "invalid \"withHashes\" flag specified"
  }

  if {![string is boolean -strict $withHashes]} then {
    usage "bad \"withHashes\" flag, not a boolean"
  }

  set failHashes [expr {$argc >= 3 ? [lindex $argv 2] : true}]

  if {[string length $failHashes] == 0} then {
    usage "invalid \"failHashes\" flag specified"
  }

  if {![string is boolean -strict $failHashes]} then {
    usage "bad \"failHashes\" flag, not a boolean"
  }

  set exitCode 0

  set script [info script]
  set path [file dirname $script]
  set rootName [file rootname [file tail $script]]

  if {![info exists fossil]} then {
    if {[info exists env(FossilTool)]} then {
      set fossil $env(FossilTool)
    }

    if {![info exists fossil] || ![file exists $fossil]} then {
      set fossil [file join $path fossil.exe]
    }
  }

  if {![info exists innounp]} then {
    if {[info exists env(InnoUnpackTool)]} then {
      set innounp $env(InnoUnpackTool)
    }

    if {![info exists innounp] || ![file exists $innounp]} then {
      set innounp [file join $path innounp.exe]
    }
  }

  if {![info exists innoextract]} then {
    if {[info exists env(InnoExtractTool)]} then {
      set innoextract $env(InnoExtractTool)
    }

    if {![info exists innoextract] || ![file exists $innoextract]} then {
      set innoextract [file join $path innoextract.exe]
    }
  }

  if {![info exists rar]} then {
    if {[info exists env(UnRARTool)]} then {
      set rar $env(UnRARTool)
    }

    if {![info exists rar] || ![file exists $rar]} then {
      set rar [file join $path UnRAR.exe]
    }
  }

  if {![info exists zip]} then {
    if {[info exists env(UnZipTool)]} then {
      set zip $env(UnZipTool)
    }

    if {![info exists zip] || ![file exists $zip]} then {
      set zip [file join $path UnZip.exe]
    }
  }

  if {![info exists manifestListFileName]} then {
    set manifestListFileName [file join \
        $path data [appendArgs $rootName .lst]]
  }

  source $manifestListFileName

  if {![array exists manifests]} then {
    usage "list of archive manifests is missing"
  }

  package require Eagle.Test; set extractDirectory [getTemporaryFileName]

  if {[string length $extractDirectory] == 0} then {
    usage "no extract directory is available"
  }

  file delete $extractDirectory; file mkdir $extractDirectory

  if {![file isdirectory $extractDirectory]} then {
    usage [appendArgs \
        "extract directory \"" $extractDirectory "\" does not exist"]
  }

  if {$withHashes} then {
    if {![file exists $fossil]} then {
      usage [appendArgs "tool \"" $fossil "\" is missing"]
    }

    if {[getFileHashes hashes] == 0} then {
      usage "no repository hashes are available"
    }
  }

  set hashPrefix [expr {$failHashes ? "ERROR" : "WARNING"}]
  set archiveFileNames [list]

  foreach extension [list exe nupkg rar zip] {
    eval lappend archiveFileNames [findFilesRecursive \
        [file join $directory [appendArgs *. $extension]]]
  }

  foreach archiveFileName $archiveFileNames {
    set manifest [file tail $archiveFileName]

    #
    # HACK: Attempt to extract the version and/or date/time
    #       information from the manifest file name, for use
    #       by things like [subst] in the manifest itself.
    #
    regexp -- {(\d+)\.(\d+)\.(\d+)\.(\d+)} $manifest dummy \
        major minor build revision

    regexp -- {(\d{4})-(\d{2})-(\d{2})-(\d{2})} $manifest \
        dummy year month day sequence

    #
    # HACK: Attempt to match and remove sub-strings from the
    #       manifest file name that look like the name of a
    #       build configuration (e.g. "debug" or "release").
    #
    regsub -- {-debug-|-release-} $manifest {-} manifest

    #
    # HACK: Special hack to allow "CLRvX" to appear in the
    #       manifest file names, part 1, the vanishing.
    #
    set manifest [string map \
        [list CLRv2 CLRvTWO CLRv4 CLRvFOUR Standard.2.0 \
        StandardTWO-ZERO Standard.2.1 StandardTWO-ONE] \
        $manifest]

    #
    # HACK: Special hack to allow "EF6", "Win32", "x64", and
    #       "x86" to appear in the manifest file names, part 1,
    #       the vanishing.
    #
    set manifest [string map \
        [list EF6 EF-SIX Win32 Win-THIRTYTWO x64 x-SIXTYFOUR \
        x86 x-EIGHTYSIX] $manifest]

    #
    # HACK: Attempt to match and remove sub-strings from the
    #       manifest file name that look like a version number
    #       in the format "<major>.<minor>.<build>.<revision>"
    #       and/or a date/time string matching the format
    #       "YYYY-MM-DD-NN" (where the NN portion is a generic
    #       incrementing sequence number).
    #
    regsub -- {\d+\.\d+\.\d+\.\d+} $manifest {} manifest
    regsub -- {\d{4}-\d{2}-\d{2}-\d{2}} $manifest {} manifest

    #
    # HACK: Special hack to allow "CLRvX" to appear in the
    #       manifest file names, part 2, the return.
    #
    set manifest [string map \
        [list CLRvTWO CLRv2 CLRvFOUR CLRv4 StandardTWO-ZERO \
        Standard.2.0 StandardTWO-ONE Standard.2.1] $manifest]

    #
    # HACK: Special hack to allow "EF6", "Win32", "x64", and
    #       "x86" to appear in the manifest file names, part 2,
    #       the return.
    #
    set manifest [string map \
        [list EF-SIX EF6 Win-THIRTYTWO Win32 x-SIXTYFOUR x64 \
        x-EIGHTYSIX x86] $manifest]

    #
    # HACK: Fixup manifest file names that correspond to the
    #       NuGet packages for SymbolSource.
    #
    if {[regexp -- {[/\\]SymbolSource[/\\]} $archiveFileName]} then {
      set manifest [string map [list .. .Source..] $manifest]
    }

    if {![info exists manifests($manifest)]} then {
      if {![info exists no(warn)]} then {
        puts stdout [appendArgs \
            "WARNING: Cannot find manifest \"" $manifest \
            "\" for archive \"" $archiveFileName "\", skipped."]
      }

      continue
    }

    set manifestFileNames [list]

    foreach list [lrange $manifests($manifest) 1 end] {
      set rawManifestFileNames [set [appendArgs \
          [appendArgs [lindex $manifests($manifest) 0] \
          _manifests] ( $list )]]

      if {[info exists manifests($manifest,subst)]} then {
        set rawManifestFileNames [subst $rawManifestFileNames]
      }

      foreach manifestFileName $rawManifestFileNames {
        lappend manifestFileNames $manifestFileName
      }
    }

    set isSetup false

    if {[file extension $archiveFileName] in [list .nupkg .zip]} then {
      if {![file exists $zip]} then {
        usage [appendArgs "tool \"" $zip "\" is missing"]
      }

      set listCommand(1) [getExecCommandPrefix]

      if {[lindex $listCommand(1) 0] ne "error"} then {
        lappend listCommand(1) $zip -Z -1 \
            [file nativename $archiveFileName]
      }

      set listCommand(2) [list error "no fallback list command"]
      set extractCommand(1) [getExecCommandPrefix]

      if {[lindex $extractCommand(1) 0] ne "error"} then {
        lappend extractCommand(1) $zip -j -o \
            [file nativename $archiveFileName] \
            \"%fileName%\" -d \"%directory%\"
      }

      set extractCommand(2) [list error "no fallback extract command"]
    } elseif {[file extension $archiveFileName] eq ".exe" && \
        [string match -nocase *Setup*.exe $manifest]} then {
      #
      # HACK: There is some special handling needed for dealing with
      #       setup packages, which are currently always created with
      #       the Inno Setup tool.  The two tools that can be used to
      #       verify the contents of these packages are "innounp" and
      #       "innoextract".  Since this archive file name looks like
      #       one that contains a setup package, assume that it is.
      #
      set listCommand(1) [getExecCommandPrefix]

      if {[lindex $listCommand(1) 0] ne "error"} then {
        lappend listCommand(1) $innounp -v \
            [file nativename $archiveFileName]
      }

      set extractCommand(1) [getExecCommandPrefix]

      if {[lindex $extractCommand(1) 0] ne "error"} then {
        lappend extractCommand(1) $innounp -x -e -y \"-d%directory%\" \
            [file nativename $archiveFileName] \"%fileName%\"
      }

      set listCommand(2) [getExecCommandPrefix]

      if {[lindex $listCommand(2) 0] ne "error"} then {
        lappend listCommand(2) $innoextract --list \
            [file nativename $archiveFileName]
      }

      set extractCommand(2) [getExecCommandPrefix]

      if {[lindex $extractCommand(2) 0] ne "error"} then {
        lappend extractCommand(2) $innoextract --extract --output-dir \
            \"%directory%\" --include \"%fileName%\" \
            [file nativename $archiveFileName]
      }

      set isSetup true
    } else {
      if {![file exists $rar]} then {
        usage [appendArgs "tool \"" $rar "\" is missing"]
      }

      set listCommand(1) [getExecCommandPrefix]

      if {[lindex $listCommand(1) 0] ne "error"} then {
        lappend listCommand(1) $rar vb -- \
            [file nativename $archiveFileName]
      }

      set listCommand(2) [list error "no fallback list command"]
      set extractCommand(1) [getExecCommandPrefix]

      if {[lindex $extractCommand(1) 0] ne "error"} then {
        lappend extractCommand(1) $rar x -ep -y -- \
            [file nativename $archiveFileName] \
            \"%fileName%\" \"%directory%\"
      }

      set extractCommand(2) [list error "no fallback extract command"]
    }

    if {[catch {
      set data [eval $listCommand(1)]
    } error1] == 0 || [catch {
      set data [eval $listCommand(2)]

      if {$isSetup} then {
        #
        # HACK: The "innoextract" tool does not use the curly
        #       braces around the "{app}"-style directory names.
        #
        set data [string map [getInnoSetupRootMap] $data]
      }
    } error2] == 0} then {
      #
      # HACK: The Inno Setup unpacking tool requires some extra
      #       parsing logic to handle the output.
      #
      set containedFileNames [list]

      if {$isSetup} then {
        if {[llength $containedFileNames] == 0} then {
          foreach {dummy matchFileName} [regexp -line -all -inline -- \
              {^[ 0-9]{10}  \d{4}\.\d{2}\.\d{2} \d{2}:\d{2}  (.*)$} $data] {
            #
            # NOTE: Add the file name extracted from the output
            #       line to the list of file names contained in
            #       this archive.
            #
            lappend containedFileNames $matchFileName
          }
        }

        if {[llength $containedFileNames] == 0} then {
          foreach {dummy matchFileName} [regexp -line -all -inline -- \
              [appendArgs {^ - "(.*)"(?: \[temp\])? \(\d+(?:\.\d+)? } \
              {(?:B|KiB|MiB|GiB|TiB|PiB|EiB|ZiB|YiB)\)$}] $data] {
            #
            # NOTE: Add the file name extracted from the output
            #       line to the list of file names contained in
            #       this archive.
            #
            lappend containedFileNames $matchFileName
          }

          #
          # NOTE: The "innoextract" tool does not include the
          #       script file in the list; therefore, fake it.
          #
          lappend containedFileNames install_script.iss
        }
      } else {
        foreach matchFileName [split [string map [list \\ /] [string \
            trim $data]] \n] {
          #
          # NOTE: Replace the dynamically calculated MD5 hash
          #       for the special NuGet package file name, if
          #       needed.
          #
          if {[file extension $matchFileName] eq ".psmdcp"} then {
            if {[regexp -- {/([0-9a-f]{32})\.} $matchFileName dummy \
                md5]} then {
              regsub -- [appendArgs / $md5 \\.] $matchFileName \
                  {/${md5}.} matchFileName
            }
          }

          lappend containedFileNames $matchFileName
        }
      }

      foreach manifestFileName $manifestFileNames {
        #
        # TODO: Should we use -nocase here because Windows
        #       is the primary release platform?
        #
        if {[lsearch -exact -- $containedFileNames \
            $manifestFileName] == -1} then {
          puts stdout [appendArgs \
              "ERROR: Archive \"" $archiveFileName \
              "\" missing file \"" $manifestFileName \
              "\" from manifest \"" $manifest "\"."]

          set exitCode 1
        }

        #
        # NOTE: Is this archive supposed to contain source code -OR-
        #       something else?
        #
        if {[string match -nocase -- *Source* $archiveFileName]} then {
          #
          # NOTE: Skip checking hashes if that was not requested on the
          #       command line.
          #
          if {!$withHashes} then {
            continue
          }

          #
          # HACK: For now, only verify hashes for those files actually
          #       present in the repository.
          #
          if {![info exists hashes($manifestFileName)]} then {
            continue
          }

          #
          # NOTE: This is an archive containing source code.
          #
          set isSource true
        } else {
          #
          # NOTE: This is an archive containing something other than
          #       source code, e.g. a setup, binaries, NuGet package,
          #       etc.
          #
          set isSource false
        }

        #
        # HACK: If necessary, replace the MD5 token with the actual
        #       value extracted from the associated ".psmdcp" file
        #       name.
        #
        set altManifestFileName $manifestFileName

        if {[file extension $altManifestFileName] eq ".psmdcp" && \
            [info exists md5] && [string first \
            {/${md5}.} $altManifestFileName] != -1} then {
          set altManifestFileName [string map [list {/${md5}.} \
              [appendArgs / $md5 .]] $altManifestFileName]
        }

        #
        # NOTE: Skip anything that does not look like a file.
        #
        if {[string index $altManifestFileName end] in [list / \\]} then {
          continue
        }

        set extractFileName [file join \
            $extractDirectory [file tail $altManifestFileName]]

        catch {
          file attributes $extractFileName -readonly false
          file delete $extractFileName
        }

        try {
          if {!$isSource || [info exists hashes($manifestFileName)]} then {
            if {$isSource || [needSignature $extractFileName]} then {
              if {[catch {
                #
                # HACK: The UnZip tool cannot handle an unescaped literal
                #       opening square bracket in a file name.
                #
                set altManifestFileName [string map \
                    [list \[ \[\\\[\]] $altManifestFileName]

                set extractCommandMap [list \
                    %fileName% [file nativename $altManifestFileName] \
                    %directory% [file nativename $extractDirectory]]

                set data [eval \
                    [string map $extractCommandMap $extractCommand(1)]]
              } error1] == 0 || [catch {
                if {$isSetup} then {
                  #
                  # HACK: The "innoextract" tool does not use the curly
                  #       braces around the "{app}"-style directory names.
                  #
                  set altManifestFileName [string map [getInnoSetupRootMap] \
                      $altManifestFileName]

                  set extractCommandMap [list \
                      %fileName% [file nativename $altManifestFileName] \
                      %directory% [file nativename $extractDirectory]]

                  #
                  # HACK: The "innoextract" tool uses the full manifest
                  #       file name when writing the extracted file, so
                  #       adjust the extracted file name to match it;
                  #       however, first verify that the path type of
                  #       the manifest file name is relative.
                  #
                  if {[file pathtype $altManifestFileName] eq "relative"} then {
                    set extractFileName [file normalize [file join \
                        $extractDirectory $altManifestFileName]]

                    catch {
                      file attributes $extractFileName -readonly false
                      file delete $extractFileName
                    }
                  } else {
                    error [appendArgs \
                        "path type for manifest file name \"" \
                        $altManifestFileName "\" is not relative"]
                  }
                } else {
                  set extractCommandMap [list \
                      %fileName% [file nativename $altManifestFileName] \
                      %directory% [file nativename $extractDirectory]]
                }

                set data [eval \
                    [string map $extractCommandMap $extractCommand(2)]]
              } error2] == 0} then {
                if {[info exists hashes($manifestFileName)]} then {
                  if {[string length $hashes($manifestFileName)] == 64} then {
                    set hash [getSha3Sum $extractFileName]
                  } else {
                    set hash [getSha1Sum $extractFileName]
                  }

                  if {[string length $hash] > 0} then {
                    if {$hash ne $hashes($manifestFileName)} then {
                      puts stdout [appendArgs \
                          $hashPrefix ": Archive \"" $archiveFileName \
                          "\" file \"" $manifestFileName \
                          "\" repository hash mismatch, have \"" \
                          $hash "\", want \"" $hashes($manifestFileName) \
                          "\"."]

                      if {$failHashes} then {
                        set exitCode 1
                      }
                    }
                  } else {
                    puts stdout [appendArgs \
                        $hashPrefix ": Archive \"" $archiveFileName \
                        "\" file \"" $manifestFileName \
                        "\" could not be hashed."]

                    if {$failHashes} then {
                      set exitCode 1
                    }
                  }
                }

                if {[needSignature $extractFileName]} then {
                  switch -exact -- [getSignature $extractFileName] {
                    \x4D\x5A {
                      #
                      # NOTE: DOS/Windows executable.
                      #
                    }
                    \xCF\xFA\xED\xFE {
                      #
                      # NOTE: Apple OS X ABI Mach-O binary.
                      #
                    }
                    \x7F\x45\x4C\x46 {
                      #
                      # NOTE: Executable and Linking Format (ELF).
                      #
                    }
                    default {
                      puts stdout [appendArgs \
                          "ERROR: Archive \"" $archiveFileName \
                          "\" file \"" $manifestFileName \
                          "\" does not appear to be an executable."]

                      set exitCode 1
                    }
                  }
                }
              } else {
                puts stdout [appendArgs \
                    $hashPrefix ": Failed to extract file \"" \
                    $manifestFileName "\" from archive \"" \
                    $archiveFileName "\", error: " [combineErrors \
                    $error1 $error2]]

                if {$failHashes} then {
                  set exitCode 1
                }
              }
            }
          } else {
            puts stdout [appendArgs \
                $hashPrefix ": Archive \"" $archiveFileName \
                "\" file \"" $manifestFileName \
                "\" has no repository hash."]

            if {$failHashes} then {
              set exitCode 1
            }
          }
        } finally {
          catch {
            file attributes $extractFileName -readonly false
            file delete $extractFileName
          }
        }
      }

      foreach containedFileName $containedFileNames {
        #
        # TODO: Should we use -nocase here because Windows
        #       is the primary release platform?
        #
        if {[lsearch -exact -- $manifestFileNames \
            $containedFileName] == -1} then {
          puts stdout [appendArgs \
              "ERROR: Archive \"" $archiveFileName \
              "\" contains file \"" $containedFileName \
              "\" not in manifest \"" $manifest "\"."]

          set exitCode 1
        }
      }
    } else {
      puts stdout [appendArgs \
          "ERROR: Failed to get list of files in archive \"" \
          $archiveFileName "\", error: " [combineErrors \
          $error1 $error2]]

      set exitCode 1
    }
  }

  file rmdir $extractDirectory; # must be empty

  exit $exitCode
} else {
  usage ""
}

Added Setup/vsSp.bat.







































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
@ECHO OFF

::
:: vsSp.bat --
::
:: Visual Studio 200x/20xx Service Pack Detection Tool
::
:: Written by Joe Mistachkin.
:: Released to the public domain, use at your own risk!
::

SETLOCAL

REM SET __ECHO=ECHO
REM SET __ECHO2=ECHO
REM SET __ECHO3=ECHO
IF NOT DEFINED _AECHO (SET _AECHO=REM)
IF NOT DEFINED _CECHO (SET _CECHO=REM)
IF NOT DEFINED _CECHO2 (SET _CECHO2=REM)
IF NOT DEFINED _CECHO3 (SET _CECHO3=REM)
IF NOT DEFINED _VECHO (SET _VECHO=REM)

%_AECHO% Running %0 %*

SET DUMMY2=%1

IF DEFINED DUMMY2 (
  GOTO usage
)

REM
REM NOTE: Build the command that we will use to query for Visual Studio 2005.
REM       Visual Studio 2005 is 32-bit only; therefore, when not running on an
REM       x86 platform, look in the WoW64 registry hive.
REM
IF "%PROCESSOR_ARCHITECTURE%" == "x86" (
  SET GET_SP_CMD=reg.exe QUERY "HKLM\SOFTWARE\Microsoft\DevDiv\VS\Servicing\8.0" /v SP
) ELSE (
  SET GET_SP_CMD=reg.exe QUERY "HKLM\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VS\Servicing\8.0" /v SP
)

FOR /F "eol=; tokens=1,2,3*" %%I IN ('%GET_SP_CMD% 2^> NUL') DO (
  IF {%%I} == {SP} (
    IF {%%J} == {REG_DWORD} (
      %_AECHO% Found Visual Studio 2005 Service Pack "%%K".
      SET VS2005SP=%%K
    )
  )
)

REM
REM NOTE: Build the command that we will use to query for Visual Studio 2008.
REM       Visual Studio 2008 is 32-bit only; therefore, when not running on an
REM       x86 platform, look in the WoW64 registry hive.
REM
IF "%PROCESSOR_ARCHITECTURE%" == "x86" (
  SET GET_SP_CMD=reg.exe QUERY "HKLM\SOFTWARE\Microsoft\DevDiv\VS\Servicing\9.0" /v SP
) ELSE (
  SET GET_SP_CMD=reg.exe QUERY "HKLM\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VS\Servicing\9.0" /v SP
)

FOR /F "eol=; tokens=1,2,3*" %%I IN ('%GET_SP_CMD% 2^> NUL') DO (
  IF {%%I} == {SP} (
    IF {%%J} == {REG_DWORD} (
      %_AECHO% Found Visual Studio 2008 Service Pack "%%K".
      SET VS2008SP=%%K
    )
  )
)

REM
REM NOTE: Build the command that we will use to query for Visual Studio 2010.
REM       Visual Studio 2010 is 32-bit only; therefore, when not running on an
REM       x86 platform, look in the WoW64 registry hive.
REM
IF "%PROCESSOR_ARCHITECTURE%" == "x86" (
  SET GET_SP_CMD=reg.exe QUERY "HKLM\SOFTWARE\Microsoft\DevDiv\VS\Servicing\10.0" /v SP
) ELSE (
  SET GET_SP_CMD=reg.exe QUERY "HKLM\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VS\Servicing\10.0" /v SP
)

FOR /F "eol=; tokens=1,2,3*" %%I IN ('%GET_SP_CMD% 2^> NUL') DO (
  IF {%%I} == {SP} (
    IF {%%J} == {REG_DWORD} (
      %_AECHO% Found Visual Studio 2010 Service Pack "%%K".
      SET VS2010SP=%%K
    )
  )
)

REM
REM NOTE: Build the command that we will use to query for Visual Studio 2012.
REM       Visual Studio 2012 is 32-bit only; therefore, when not running on an
REM       x86 platform, look in the WoW64 registry hive.
REM
IF "%PROCESSOR_ARCHITECTURE%" == "x86" (
  SET GET_SP_CMD=reg.exe QUERY "HKLM\SOFTWARE\Microsoft\DevDiv\VS\Servicing\11.0" /v SP
) ELSE (
  SET GET_SP_CMD=reg.exe QUERY "HKLM\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VS\Servicing\11.0" /v SP
)

FOR /F "eol=; tokens=1,2,3*" %%I IN ('%GET_SP_CMD% 2^> NUL') DO (
  IF {%%I} == {SP} (
    IF {%%J} == {REG_DWORD} (
      %_AECHO% Found Visual Studio 2012 Service Pack "%%K".
      SET VS2012SP=%%K
    )
  )
)

REM
REM NOTE: Build the command that we will use to query for Visual Studio 2013.
REM       Visual Studio 2013 is 32-bit only; therefore, when not running on an
REM       x86 platform, look in the WoW64 registry hive.
REM
IF "%PROCESSOR_ARCHITECTURE%" == "x86" (
  SET GET_SP_CMD=reg.exe QUERY "HKLM\SOFTWARE\Microsoft\DevDiv\VS\Servicing\12.0" /v SP
) ELSE (
  SET GET_SP_CMD=reg.exe QUERY "HKLM\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VS\Servicing\12.0" /v SP
)

FOR /F "eol=; tokens=1,2,3*" %%I IN ('%GET_SP_CMD% 2^> NUL') DO (
  IF {%%I} == {SP} (
    IF {%%J} == {REG_DWORD} (
      %_AECHO% Found Visual Studio 2013 Service Pack "%%K".
      SET VS2013SP=%%K
    )
  )
)

REM
REM NOTE: Build the command that we will use to query for Visual Studio 2015.
REM       Visual Studio 2015 is 32-bit only; therefore, when not running on an
REM       x86 platform, look in the WoW64 registry hive.
REM
IF "%PROCESSOR_ARCHITECTURE%" == "x86" (
  SET GET_SP_CMD=reg.exe QUERY "HKLM\SOFTWARE\Microsoft\DevDiv\VS\Servicing\14.0" /v SP
) ELSE (
  SET GET_SP_CMD=reg.exe QUERY "HKLM\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VS\Servicing\14.0" /v SP
)

FOR /F "eol=; tokens=1,2,3*" %%I IN ('%GET_SP_CMD% 2^> NUL') DO (
  IF {%%I} == {SP} (
    IF {%%J} == {REG_DWORD} (
      %_AECHO% Found Visual Studio 2015 Service Pack "%%K".
      SET VS2015SP=%%K
    )
  )
)

REM
REM NOTE: Build the command that we will use to query for Visual Studio 2017.
REM       Visual Studio 2017 is 32-bit only; therefore, when not running on an
REM       x86 platform, look in the WoW64 registry hive.
REM
IF "%PROCESSOR_ARCHITECTURE%" == "x86" (
  SET GET_SP_CMD=reg.exe QUERY "HKLM\SOFTWARE\Microsoft\DevDiv\VS\Servicing\15.0" /v SP
) ELSE (
  SET GET_SP_CMD=reg.exe QUERY "HKLM\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VS\Servicing\15.0" /v SP
)

FOR /F "eol=; tokens=1,2,3*" %%I IN ('%GET_SP_CMD% 2^> NUL') DO (
  IF {%%I} == {SP} (
    IF {%%J} == {REG_DWORD} (
      %_AECHO% Found Visual Studio 2017 Service Pack "%%K".
      SET VS2017SP=%%K
    )
  )
)

REM
REM NOTE: Build the command that we will use to query for Visual Studio 2019.
REM       Visual Studio 2019 is 32-bit only; therefore, when not running on an
REM       x86 platform, look in the WoW64 registry hive.
REM
IF "%PROCESSOR_ARCHITECTURE%" == "x86" (
  SET GET_SP_CMD=reg.exe QUERY "HKLM\SOFTWARE\Microsoft\DevDiv\VS\Servicing\16.0" /v SP
) ELSE (
  SET GET_SP_CMD=reg.exe QUERY "HKLM\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VS\Servicing\16.0" /v SP
)

FOR /F "eol=; tokens=1,2,3*" %%I IN ('%GET_SP_CMD% 2^> NUL') DO (
  IF {%%I} == {SP} (
    IF {%%J} == {REG_DWORD} (
      %_AECHO% Found Visual Studio 2019 Service Pack "%%K".
      SET VS2019SP=%%K
    )
  )
)

GOTO no_errors

:fn_ResetErrorLevel
  VERIFY > NUL
  GOTO :EOF

:fn_SetErrorLevel
  VERIFY MAYBE 2> NUL
  GOTO :EOF

:usage
  ECHO.
  ECHO Usage: %~nx0
  ECHO.
  GOTO errors

:errors
  CALL :fn_SetErrorLevel
  ENDLOCAL
  GOTO end_of_file

:no_errors
  ENDLOCAL && (
    SET VS2005SP=%VS2005SP%
    SET VS2008SP=%VS2008SP%
    SET VS2010SP=%VS2010SP%
    SET VS2012SP=%VS2012SP%
    SET VS2013SP=%VS2013SP%
    SET VS2015SP=%VS2015SP%
    SET VS2017SP=%VS2017SP%
    SET VS2019SP=%VS2019SP%
  )
  CALL :fn_ResetErrorLevel
  GOTO end_of_file

:end_of_file
EXIT /B %ERRORLEVEL%

Changes to System.Data.SQLite.Linq/AssemblyInfo.cs.








1
2
3
4
5
6
7
8
9
10
11

12



13
14
15
16
17


18

19

20
21
22
23
24
25


26


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41







using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Security;
using System.Runtime.ConstrainedExecution;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.

[assembly: AssemblyTitle("System.Data.SQLite.Linq")]



[assembly: AssemblyDescription("ADO.NET 3.5SP1 Entity Framework support for SQLite")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("http://sqlite.phxsoftware.com")]
[assembly: AssemblyProduct("System.Data.SQLite")]
[assembly: AssemblyCopyright("Public Domain")]


[assembly: AssemblyTrademark("")]

[assembly: AssemblyCulture("")]


// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]


[assembly: AllowPartiallyTrustedCallers]


[assembly: ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers 
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.38.0")]
[assembly: AssemblyFileVersion("2.0.38.0")]
>
>
>
>
>
>
>


<

<



|


>
|
>
>
>
|
|
|


>
>
|
>
|
>

|
|



>
>

>
>

<




|



|


|
|
1
2
3
4
5
6
7
8
9

10

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

45
46
47
48
49
50
51
52
53
54
55
56
57
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System;
using System.Reflection;

using System.Runtime.InteropServices;

using System.Security;
using System.Runtime.ConstrainedExecution;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
#if USE_ENTITY_FRAMEWORK_6
[assembly: AssemblyTitle("System.Data.SQLite for Entity Framework 6")]
#else
[assembly: AssemblyTitle("System.Data.SQLite for LINQ")]
#endif

[assembly: AssemblyDescription("ADO.NET Data Provider for SQLite")]
[assembly: AssemblyCompany("https://system.data.sqlite.org/")]
[assembly: AssemblyProduct("System.Data.SQLite")]
[assembly: AssemblyCopyright("Public Domain")]

#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components.  If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]

#if !NET_40 && !NET_45 && !NET_451 && !NET_452 && !NET_46 && !NET_461 && !NET_462 && !NET_47 && !NET_471 && !NET_472 && !NET_48 && !NET_STANDARD_20 && !NET_STANDARD_21
[assembly: AllowPartiallyTrustedCallers]
#endif

[assembly: ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]


// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.119.0")]
[assembly: AssemblyFileVersion("1.0.119.0")]

Changes to System.Data.SQLite.Linq/Properties/Resources.Designer.cs.








1
2
3
4
5
6
7
8
9
10

11

12

13

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89







//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.3053
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------


namespace System.Data.SQLite.Properties {

    using System;

    

    
    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class Resources {
        
        private static global::System.Resources.ResourceManager resourceMan;
        
        private static global::System.Globalization.CultureInfo resourceCulture;
        
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resources() {
        }
        
        /// <summary>
        ///   Returns the cached ResourceManager instance used by this class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Data.SQLite.Properties.Resources", typeof(Resources).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }
        
        /// <summary>
        ///   Overrides the current thread's CurrentUICulture property for all
        ///   resource lookups using this strongly typed resource class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to CREATE TEMP VIEW SCHEMACONSTRAINTCOLUMNS AS
        ///SELECT CONSTRAINT_CATALOG, NULL AS CONSTRAINT_SCHEMA, CONSTRAINT_NAME, TABLE_CATALOG, NULL AS TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME 
        ///FROM TEMP.SCHEMAINDEXCOLUMNS
        ///UNION
        ///SELECT CONSTRAINT_CATALOG, NULL, CONSTRAINT_NAME, TABLE_CATALOG, NULL, TABLE_NAME, FKEY_FROM_COLUMN
        ///FROM TEMP.SCHEMAFOREIGNKEYS;.
        /// </summary>
        internal static string SQL_CONSTRAINTCOLUMNS {
            get {
                return ResourceManager.GetString("SQL_CONSTRAINTCOLUMNS", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to CREATE TEMP VIEW SCHEMACONSTRAINTS AS
        ///SELECT INDEX_CATALOG AS CONSTRAINT_CATALOG, NULL AS CONSTRAINT_SCHEMA, INDEX_NAME AS CONSTRAINT_NAME, TABLE_CATALOG, NULL AS TABLE_SCHEMA, TABLE_NAME, &apos;PRIMARY KEY&apos; AS CONSTRAINT_TYPE, 0 AS IS_DEFERRABLE, 0 AS INITIALLY_DEFERRED, NULL AS CHECK_CLAUSE
        ///FROM TEMP.SCHEMAINDEXES WHERE PRIMARY_KEY = 1
        ///UNION
        ///SELECT INDEX_CATALOG, NULL, INDEX_NAME, TABLE_CATALOG, NULL, TABLE_NAME, &apos;UNIQUE&apos;, 0, 0, NULL 
        ///FROM TEMP.SCHEMAINDEXES WHERE PRIMARY_KEY = 0 AND [UNIQUE] = 1
        ///UNION
        /// [rest of string was truncated]&quot;;.
        /// </summary>
        internal static string SQL_CONSTRAINTS {
            get {
                return ResourceManager.GetString("SQL_CONSTRAINTS", resourceCulture);
>
>
>
>
>
>
>



|






>
|
>
|
>
|
>
|







|


|
|

|

|



|







|





|













|


|










|





|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.1
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6.Properties
#else
namespace System.Data.SQLite.Linq.Properties
#endif
{
    using System;

    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal sealed class Resources {

        private static global::System.Resources.ResourceManager resourceMan;

        private static global::System.Globalization.CultureInfo resourceCulture;

        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resources() {
        }

        /// <summary>
        ///   Returns the cached ResourceManager instance used by this class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Data.SQLite.Properties", typeof(Resources).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }

        /// <summary>
        ///   Overrides the current thread's CurrentUICulture property for all
        ///   resource lookups using this strongly typed resource class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to CREATE TEMP VIEW SCHEMACONSTRAINTCOLUMNS AS
        ///SELECT CONSTRAINT_CATALOG, NULL AS CONSTRAINT_SCHEMA, CONSTRAINT_NAME, TABLE_CATALOG, NULL AS TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME
        ///FROM TEMP.SCHEMAINDEXCOLUMNS
        ///UNION
        ///SELECT CONSTRAINT_CATALOG, NULL, CONSTRAINT_NAME, TABLE_CATALOG, NULL, TABLE_NAME, FKEY_FROM_COLUMN
        ///FROM TEMP.SCHEMAFOREIGNKEYS;.
        /// </summary>
        internal static string SQL_CONSTRAINTCOLUMNS {
            get {
                return ResourceManager.GetString("SQL_CONSTRAINTCOLUMNS", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to CREATE TEMP VIEW SCHEMACONSTRAINTS AS
        ///SELECT INDEX_CATALOG AS CONSTRAINT_CATALOG, NULL AS CONSTRAINT_SCHEMA, INDEX_NAME AS CONSTRAINT_NAME, TABLE_CATALOG, NULL AS TABLE_SCHEMA, TABLE_NAME, &apos;PRIMARY KEY&apos; AS CONSTRAINT_TYPE, 0 AS IS_DEFERRABLE, 0 AS INITIALLY_DEFERRED, NULL AS CHECK_CLAUSE
        ///FROM TEMP.SCHEMAINDEXES WHERE PRIMARY_KEY = 1
        ///UNION
        ///SELECT INDEX_CATALOG, NULL, INDEX_NAME, TABLE_CATALOG, NULL, TABLE_NAME, &apos;UNIQUE&apos;, 0, 0, NULL
        ///FROM TEMP.SCHEMAINDEXES WHERE PRIMARY_KEY = 0 AND [UNIQUE] = 1
        ///UNION
        /// [rest of string was truncated]&quot;;.
        /// </summary>
        internal static string SQL_CONSTRAINTS {
            get {
                return ResourceManager.GetString("SQL_CONSTRAINTS", resourceCulture);

Changes to System.Data.SQLite.Linq/Properties/Resources.resx.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!-- 
    Microsoft ResX Schema 
    
    Version 2.0
    
    The primary goals of this format is to allow a simple XML format 
    that is mostly human readable. The generation and parsing of the 
    various data types are done through the TypeConverter classes 
    associated with the data types.
    
    Example:
    
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
                
    There are any number of "resheader" rows that contain simple 
    name/value pairs.
    
    Each data row contains a name, and value. The row also contains a 
    type or mimetype. Type corresponds to a .NET class that support 
    text/value conversion through the TypeConverter architecture. 
    Classes that don't support this are serialized and stored with the 
    mimetype set.
    
    The mimetype is used for serialized objects, and tells the 
    ResXResourceReader how to depersist the object. This is currently not 
    extensible. For a given mimetype the value must be set accordingly:
    
    Note - application/x-microsoft.net.object.binary.base64 is the format 
    that the ResXResourceWriter will generate, however the reader can 
    read any of the formats listed below.
    
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array 
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>


|
|
|

|
|
|
|

|

|














|
|

|
|
|
|
|

|
|
|

|
|
|

|

|


|

|




|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema

    Version 2.0

    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.

    Example:

    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>

    There are any number of "resheader" rows that contain simple
    name/value pairs.

    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.

    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:

    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.

    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
114
115
116
117
118
119
120

121
122






123
124
125






126

127
128

129
130









131

132
133









134

135
136









137

138
139
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <data name="SQL_CONSTRAINTCOLUMNS" xml:space="preserve">

    <value>CREATE TEMP VIEW SCHEMACONSTRAINTCOLUMNS AS
SELECT CONSTRAINT_CATALOG, NULL AS CONSTRAINT_SCHEMA, CONSTRAINT_NAME, TABLE_CATALOG, NULL AS TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME 






FROM TEMP.SCHEMAINDEXCOLUMNS
UNION
SELECT CONSTRAINT_CATALOG, NULL, CONSTRAINT_NAME, TABLE_CATALOG, NULL, TABLE_NAME, FKEY_FROM_COLUMN






FROM TEMP.SCHEMAFOREIGNKEYS;</value>

  </data>
  <data name="SQL_CONSTRAINTS" xml:space="preserve">

    <value>CREATE TEMP VIEW SCHEMACONSTRAINTS AS
SELECT INDEX_CATALOG AS CONSTRAINT_CATALOG, NULL AS CONSTRAINT_SCHEMA, INDEX_NAME AS CONSTRAINT_NAME, TABLE_CATALOG, NULL AS TABLE_SCHEMA, TABLE_NAME, 'PRIMARY KEY' AS CONSTRAINT_TYPE, 0 AS IS_DEFERRABLE, 0 AS INITIALLY_DEFERRED, NULL AS CHECK_CLAUSE









FROM TEMP.SCHEMAINDEXES WHERE PRIMARY_KEY = 1

UNION
SELECT INDEX_CATALOG, NULL, INDEX_NAME, TABLE_CATALOG, NULL, TABLE_NAME, 'UNIQUE', 0, 0, NULL 









FROM TEMP.SCHEMAINDEXES WHERE PRIMARY_KEY = 0 AND [UNIQUE] = 1

UNION
SELECT CONSTRAINT_CATALOG, NULL, CONSTRAINT_NAME, TABLE_CATALOG, NULL, TABLE_NAME, CONSTRAINT_TYPE, IS_DEFERRABLE, INITIALLY_DEFERRED, NULL 









FROM TEMP.SCHEMAFOREIGNKEYS;</value>

  </data>
</root>







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


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


114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <data name="SQL_CONSTRAINTCOLUMNS" xml:space="preserve">
    <value>
      CREATE TEMP VIEW SCHEMACONSTRAINTCOLUMNS AS
        SELECT CONSTRAINT_CATALOG,
               NULL AS CONSTRAINT_SCHEMA,
               CONSTRAINT_NAME,
               TABLE_CATALOG,
               NULL AS TABLE_SCHEMA,
               TABLE_NAME,
               COLUMN_NAME
        FROM TEMP.SCHEMAINDEXCOLUMNS
        UNION
        SELECT CONSTRAINT_CATALOG,
               NULL,
               CONSTRAINT_NAME,
               TABLE_CATALOG,
               NULL,
               TABLE_NAME,
               FKEY_FROM_COLUMN
        FROM TEMP.SCHEMAFOREIGNKEYS;
    </value>
  </data>
  <data name="SQL_CONSTRAINTS" xml:space="preserve">
    <value>
      CREATE TEMP VIEW SCHEMACONSTRAINTS AS
        SELECT INDEX_CATALOG AS CONSTRAINT_CATALOG,
               NULL AS CONSTRAINT_SCHEMA,
               INDEX_NAME AS CONSTRAINT_NAME,
               TABLE_CATALOG,
               NULL AS TABLE_SCHEMA,
               TABLE_NAME,
               'PRIMARY KEY' AS CONSTRAINT_TYPE,
               0 AS IS_DEFERRABLE,
               0 AS INITIALLY_DEFERRED,
               NULL AS CHECK_CLAUSE
        FROM TEMP.SCHEMAINDEXES
        WHERE PRIMARY_KEY = 1
        UNION
        SELECT INDEX_CATALOG,
               NULL,
               INDEX_NAME,
               TABLE_CATALOG,
               NULL,
               TABLE_NAME,
               'UNIQUE',
               0,
               0,
               NULL
        FROM TEMP.SCHEMAINDEXES
        WHERE PRIMARY_KEY = 0 AND [UNIQUE] = 1
        UNION
        SELECT CONSTRAINT_CATALOG,
               NULL,
               CONSTRAINT_NAME,
               TABLE_CATALOG,
               NULL,
               TABLE_NAME,
               CONSTRAINT_TYPE,
               IS_DEFERRABLE,
               INITIALLY_DEFERRED,
               NULL
        FROM TEMP.SCHEMAFOREIGNKEYS;
    </value>
  </data>
</root>

Changes to System.Data.SQLite.Linq/Resources/Common.ConceptualSchemaDefinition.csdl.

Changes to System.Data.SQLite.Linq/Resources/Common.ProviderManifest.xsd.

Changes to System.Data.SQLite.Linq/Resources/SQLiteProviderServices.ProviderManifest.xml.

1










2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?xml version="1.0" encoding="utf-8"?>










<!-- 
####################################################################################################################

BE AWARE THAT THE ORDER IN WHICH TYPES ARE DESCRIBED IN THE PROVIDER MANIFEST IS RELEVANT AND HAVE IMPACT IN LOOKUP
PROCESS

#################################################################################################################### 
-->
<ProviderManifest Namespace="SQLite" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/providermanifest">
  <Types>
    <Type Name="tinyint" PrimitiveTypeKind="Byte">
    </Type>
    <Type Name="smallint" PrimitiveTypeKind="Int16">
    </Type>
    <Type Name="int" PrimitiveTypeKind="Int32">
    </Type>
    <Type Name="integer" PrimitiveTypeKind="Int64">
    </Type>
    <Type Name="float" PrimitiveTypeKind="Double">
    </Type>
    <Type Name="real" PrimitiveTypeKind="Single">
    </Type>
    <Type Name="decimal" PrimitiveTypeKind="Decimal">
      <FacetDescriptions>
        <Precision Minimum="1" Maximum="53" DefaultValue="18" Constant="false" />
        <Scale Minimum="0" Maximum="53" DefaultValue="0" Constant="false" />
      </FacetDescriptions>
    </Type>

>
>
>
>
>
>
>
>
>
>




















|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<!-- 
####################################################################################################################

BE AWARE THAT THE ORDER IN WHICH TYPES ARE DESCRIBED IN THE PROVIDER MANIFEST IS RELEVANT AND HAVE IMPACT IN LOOKUP
PROCESS

#################################################################################################################### 
-->
<ProviderManifest Namespace="SQLite" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/providermanifest">
  <Types>
    <Type Name="tinyint" PrimitiveTypeKind="Byte">
    </Type>
    <Type Name="smallint" PrimitiveTypeKind="Int16">
    </Type>
    <Type Name="int" PrimitiveTypeKind="Int32">
    </Type>
    <Type Name="integer" PrimitiveTypeKind="Int64">
    </Type>
    <Type Name="float" PrimitiveTypeKind="Double">
    </Type>
    <Type Name="real" PrimitiveTypeKind="Double">
    </Type>
    <Type Name="decimal" PrimitiveTypeKind="Decimal">
      <FacetDescriptions>
        <Precision Minimum="1" Maximum="53" DefaultValue="18" Constant="false" />
        <Scale Minimum="0" Maximum="53" DefaultValue="0" Constant="false" />
      </FacetDescriptions>
    </Type>
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
    </Type>
    <Type Name="uniqueidentifier" PrimitiveTypeKind="Guid">
    </Type>
  </Types>
  <Functions>

    <!-- BEGIN AGGREGATES 
		http://www.sqlite.org/lang_aggfunc.html  -->
    <!-- AVG -->
    <Function Name="AVG" Aggregate="true" BuiltIn="true">
      <ReturnType Type="Double" />
      <Parameter Name="arg" Type="Collection(Int32)" Mode="In" />
    </Function>
    <Function Name="AVG" Aggregate="true" BuiltIn="true">
      <ReturnType Type="Double" />







|







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
    </Type>
    <Type Name="uniqueidentifier" PrimitiveTypeKind="Guid">
    </Type>
  </Types>
  <Functions>

    <!-- BEGIN AGGREGATES 
		https://www.sqlite.org/lang_aggfunc.html  -->
    <!-- AVG -->
    <Function Name="AVG" Aggregate="true" BuiltIn="true">
      <ReturnType Type="Double" />
      <Parameter Name="arg" Type="Collection(Int32)" Mode="In" />
    </Function>
    <Function Name="AVG" Aggregate="true" BuiltIn="true">
      <ReturnType Type="Double" />
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
    <Function Name="TOTAL" Aggregate="true" BuiltIn="true">
      <ReturnType Type="Double" />
      <Parameter Name="arg" Type="Collection(Double)" Mode="In" />
    </Function>

    <!-- END AGGREGATES ############################################# -->

    <!-- Begin Scalars http://www.sqlite.org/lang_corefunc.html -->

    <Function Name="ABS" BuiltIn="true">
      <ReturnType Type="Int32" />
      <Parameter Name="arg" Type="Int32" Mode="In" />
    </Function>
    <Function Name="ABS" BuiltIn="true">
      <ReturnType Type="Int64" />







|







281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
    <Function Name="TOTAL" Aggregate="true" BuiltIn="true">
      <ReturnType Type="Double" />
      <Parameter Name="arg" Type="Collection(Double)" Mode="In" />
    </Function>

    <!-- END AGGREGATES ############################################# -->

    <!-- Begin Scalars https://www.sqlite.org/lang_corefunc.html -->

    <Function Name="ABS" BuiltIn="true">
      <ReturnType Type="Int32" />
      <Parameter Name="arg" Type="Int32" Mode="In" />
    </Function>
    <Function Name="ABS" BuiltIn="true">
      <ReturnType Type="Int64" />

Added System.Data.SQLite.Linq/Resources/SQLiteProviderServices.StoreSchemaDefinition.EF6.ssdl.











































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
<?xml version="1.0" encoding="utf-8"?>
<Schema Namespace="EFSQLite" Provider="System.Data.SQLite.EF6" ProviderManifestToken="ISO8601" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl">
  <EntityContainer Name="Schema">
    <EntitySet Name="STables" EntityType="Self.Table">
      <DefiningQuery>
        SELECT
        '[' || TABLE_NAME || ']' COLLATE NOCASE [Id]
        ,   TABLE_CATALOG [CatalogName]
        ,   TABLE_SCHEMA [SchemaName]
        ,   TABLE_NAME    [Name]
        FROM
        TEMP.SCHEMATABLES
        WHERE
        TABLE_TYPE LIKE 'table'
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="STableColumns" EntityType="Self.TableColumn">
      <DefiningQuery>
        SELECT
        '[' || c.TABLE_NAME || ']' || '[' || c.COLUMN_NAME || ']' COLLATE NOCASE [Id]
        ,   '[' || c.TABLE_NAME || ']'  COLLATE NOCASE                     [ParentId]
        ,   c.COLUMN_NAME   [Name]
        ,   c.ORDINAL_POSITION [Ordinal]
        ,   c.IS_NULLABLE [IsNullable]
        ,   c.EDM_TYPE [TypeName]
        ,   c.CHARACTER_MAXIMUM_LENGTH [MaxLength]
        ,   c.NUMERIC_PRECISION [Precision]
        ,   c.DATETIME_PRECISION [DateTimePrecision]
        ,   c.NUMERIC_SCALE [Scale]
        ,   c.COLLATION_CATALOG [CollationCatalog]
        ,   c.COLLATION_SCHEMA [CollationSchema]
        ,   c.COLLATION_NAME [CollationName]
        ,   c.CHARACTER_SET_CATALOG [CharacterSetCatalog]
        ,   c.CHARACTER_SET_SCHEMA [CharacterSetSchema]
        ,   c.CHARACTER_SET_NAME [CharacterSetName]
        ,   0 as [IsMultiSet]
        ,   c.[AUTOINCREMENT] as [IsIdentity]
        ,   0 as [IsStoreGenerated]
        , c.COLUMN_DEFAULT as [Default]
        FROM
        TEMP.SCHEMACOLUMNS c
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SViews" EntityType="Self.View">
      <DefiningQuery>
        SELECT
        '[' || TABLE_NAME || ']'  COLLATE NOCASE [Id]
        ,   TABLE_CATALOG             [CatalogName]
        ,   TABLE_SCHEMA              [SchemaName]
        ,   TABLE_NAME                [Name]
        ,   VIEW_DEFINITION           [ViewDefinition]
        ,   IS_UPDATABLE              [IsUpdatable]
        FROM
        TEMP.SCHEMAVIEWS
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SViewColumns" EntityType="Self.ViewColumn">
      <DefiningQuery>
        SELECT
        '[' || c.VIEW_NAME || ']' || '[' || c.VIEW_COLUMN_NAME || ']' COLLATE NOCASE [Id]
        ,   '[' || c.VIEW_NAME || ']' COLLATE NOCASE                             [ParentId]
        ,   c.VIEW_COLUMN_NAME   [Name]
        ,   c.ORDINAL_POSITION [Ordinal]
        ,   c.IS_NULLABLE [IsNullable]
        ,   c.EDM_TYPE [TypeName]
        ,   c.CHARACTER_MAXIMUM_LENGTH [MaxLength]
        ,   c.NUMERIC_PRECISION [Precision]
        ,   c.DATETIME_PRECISION as [DateTimePrecision]
        ,   c.NUMERIC_SCALE [Scale]
        ,   c.COLLATION_CATALOG [CollationCatalog]
        ,   c.COLLATION_SCHEMA [CollationSchema]
        ,   c.COLLATION_NAME [CollationName]
        ,   c.CHARACTER_SET_CATALOG [CharacterSetCatalog]
        ,   c.CHARACTER_SET_SCHEMA [CharacterSetSchema]
        ,   c.CHARACTER_SET_NAME [CharacterSetName]
        ,   0 as [IsMultiSet]
        ,   c.[AUTOINCREMENT] as [IsIdentity]
        ,   0 as [IsStoreGenerated]
        ,   c.COLUMN_DEFAULT [Default]
        FROM
        TEMP.SCHEMAVIEWCOLUMNS c
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SFunctions" EntityType="Self.Function">
      <DefiningQuery>
        SELECT
        NULL [Id]
        , NULL         [CatalogName]
        , NULL         [SchemaName]
        , NULL         [Name]
        , NULL         [ReturnTypeName]
        , NULL [ReturnMaxLength]
        , NULL        [ReturnPrecision]
        , NULL [ReturnDateTimePrecision]
        , NULL            [ReturnScale]
        , NULL        [ReturnCollationCatalog]
        , NULL         [ReturnCollationSchema]
        , NULL           [ReturnCollationName]
        , NULL    [ReturnCharacterSetCatalog]
        , NULL     [ReturnCharacterSetSchema]
        , NULL       [ReturnCharacterSetName]
        , NULL as        [ReturnIsMultiSet]
        , NULL as [IsAggregate]
        , NULL as [IsBuiltIn]
        , NULL as [IsNiladic]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SFunctionParameters" EntityType="Self.Parameter">
      <DefiningQuery>
        SELECT
        NULL [Id]
        , NULL [ParentId]
        , NULL [Name]
        , NULL [Ordinal]
        , NULL [TypeName]
        , NULL [MaxLength]
        , NULL [Precision]
        , NULL [DateTimePrecision]
        , NULL    [Scale]
        , NULL [CollationCatalog]
        , NULL [CollationSchema]
        , NULL [CollationName]
        , NULL [CharacterSetCatalog]
        , NULL [CharacterSetSchema]
        , NULL [CharacterSetName]
        , NULL [IsMultiSet]
        , NULL [Mode]
        , NULL [Default]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SProcedures" EntityType="Self.Procedure">
      <DefiningQuery>
        SELECT
        NULL [Id]
        , NULL         [CatalogName]
        , NULL          [SchemaName]
        , NULL            [Name]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SProcedureParameters" EntityType="Self.Parameter">
      <DefiningQuery>
        SELECT
        NULL [Id]
        , NULL [ParentId]
        , NULL [Name]
        , NULL [Ordinal]
        , NULL [TypeName]
        , NULL [MaxLength]
        , NULL [Precision]
        , NULL [DateTimePrecision]
        , NULL [Scale]
        , NULL [CollationCatalog]
        , NULL [CollationSchema]
        , NULL [CollationName]
        , NULL [CharacterSetCatalog]
        , NULL [CharacterSetSchema]
        , NULL [CharacterSetName]
        , NULL as [IsMultiSet]
        , NULL   [Mode]
        , NULL [Default]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SConstraints" EntityType="Self.Constraint">
      <DefiningQuery>
        SELECT
        '[' || tc.CONSTRAINT_NAME || ']'  COLLATE NOCASE [Id]
        , '[' || tc.TABLE_NAME || ']'  COLLATE NOCASE [ParentId]
        , tc.CONSTRAINT_NAME [Name]
        , tc.CONSTRAINT_TYPE [ConstraintType]
        , tc.IS_DEFERRABLE [IsDeferrable]
        , tc.INITIALLY_DEFERRED [IsInitiallyDeferred]
        FROM
        TEMP.SCHEMACONSTRAINTS tc
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SCheckConstraints" EntityType="Self.CheckConstraint">
      <DefiningQuery>
        SELECT
        NULL [Id]
        , NULL [Expression]
        WHERE 1 = 2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SConstraintColumns" EntityType="Self.ConstraintColumn">
      <DefiningQuery>
        SELECT
        '[' || CONSTRAINT_NAME || ']'  COLLATE NOCASE [ConstraintId]
        , '[' || TABLE_NAME || ']' || '[' || COLUMN_NAME    || ']'  COLLATE NOCASE [ColumnId]
        FROM
        TEMP.SCHEMACONSTRAINTCOLUMNS
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SForeignKeyConstraints" EntityType="Self.ForeignKeyConstraint">
      <DefiningQuery>
        SELECT DISTINCT
        '[' || rc.CONSTRAINT_NAME || ']'  COLLATE NOCASE [Id]
        , 'NO ACTION'  COLLATE NOCASE [UpdateRule]
        , 'NO ACTION'  COLLATE NOCASE [DeleteRule]
        FROM
        TEMP.SCHEMAFOREIGNKEYS rc
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SForeignKeys" EntityType="Self.ForeignKey">
      <DefiningQuery>
        SELECT
        '[' || FC.CONSTRAINT_NAME || ']' || '[' || FC.FKEY_FROM_ORDINAL_POSITION || ']' COLLATE NOCASE [Id]
        ,   '[' || FC.FKEY_TO_TABLE || ']' || '[' || FC.FKEY_TO_COLUMN || ']' COLLATE NOCASE [ToColumnId]
        ,   '[' || FC.TABLE_NAME || ']' || '[' || FC.FKEY_FROM_COLUMN || ']' COLLATE NOCASE [FromColumnId]
        ,   '[' || FC.CONSTRAINT_NAME || ']' COLLATE NOCASE [ConstraintId]
        ,   FC.FKEY_FROM_ORDINAL_POSITION [Ordinal]
        FROM
        TEMP.SCHEMAFOREIGNKEYS FC
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SViewConstraints" EntityType="Self.ViewConstraint">
      <DefiningQuery>
        SELECT
        NULL   [Id]
        , NULL [ParentId]
        , NULL [Name]
        , NULL [ConstraintType]
        , NULL [IsDeferrable]
        , NULL [IsInitiallyDeferred]
        , NULL [Expression]
        , NULL  [UpdateRule]
        , NULL  [DeleteRule]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SViewConstraintColumns" EntityType="Self.ConstraintColumn">
      <DefiningQuery>
        SELECT
        NULL  [ConstraintId]
        , NULL [ColumnId]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SViewForeignKeys" EntityType="Self.ForeignKey">
      <DefiningQuery>
        SELECT
        NULL  [Id]
        ,  NULL [ToColumnId]
        ,  NULL [FromColumnId]
        ,  NULL  [ConstraintId]
        ,  0 [Ordinal]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <AssociationSet Name="STableTableColumns" Association="Self.TableTableColumn" >
      <End Role="Parent" EntitySet="STables"/>
      <End Role="Column" EntitySet="STableColumns"/>
    </AssociationSet>
    <AssociationSet Name="STableConstraints" Association="Self.TableTableConstraint" >
      <End Role="Parent" EntitySet="STables"/>
      <End Role="Constraint" EntitySet="SConstraints"/>
    </AssociationSet>
    <AssociationSet Name="SConstraintConstraintColumns" Association="Self.ConstraintConstraintColumn" >
      <End Role="ConstraintColumn" EntitySet="SConstraintColumns"/>
      <End Role="Constraint" EntitySet="SConstraints"/>
    </AssociationSet>
    <AssociationSet Name="SConstraintForeignKeys" Association="Self.ConstraintForeignKey" >
      <End Role="ForeignKey" EntitySet="SForeignKeys"/>
      <End Role="Constraint" EntitySet="SForeignKeyConstraints"/>
    </AssociationSet>
    <AssociationSet Name="SFromForeignKeyColumns" Association="Self.FromForeignKeyColumn" >
      <End Role="ForeignKey" EntitySet="SForeignKeys"/>
      <End Role="Column" EntitySet="STableColumns"/>
    </AssociationSet>
    <AssociationSet Name="SToForeignKeyColumns" Association="Self.ToForeignKeyColumn" >
      <End Role="ForeignKey" EntitySet="SForeignKeys"/>
      <End Role="Column" EntitySet="STableColumns"/>
    </AssociationSet>

    <AssociationSet Name="SViewViewColumns" Association="Self.ViewViewColumn" >
      <End Role="Parent" EntitySet="SViews"/>
      <End Role="Column" EntitySet="SViewColumns"/>
    </AssociationSet>
    <AssociationSet Name="SViewViewConstraints" Association="Self.ViewViewConstraint" >
      <End Role="Parent" EntitySet="SViews"/>
      <End Role="Constraint" EntitySet="SViewConstraints"/>
    </AssociationSet>
    <AssociationSet Name="SViewConstraintConstraintColumns" Association="Self.ViewConstraintConstraintColumn" >
      <End Role="ConstraintColumn" EntitySet="SViewConstraintColumns"/>
      <End Role="Constraint" EntitySet="SViewConstraints"/>
    </AssociationSet>
    <AssociationSet Name="SViewConstraintForeignKeys" Association="Self.ViewConstraintForeignKey" >
      <End Role="ForeignKey" EntitySet="SViewForeignKeys"/>
      <End Role="Constraint" EntitySet="SViewConstraints"/>
    </AssociationSet>
    <AssociationSet Name="SFromForeignKeyViewColumns" Association="Self.FromForeignKeyViewColumn" >
      <End Role="ForeignKey" EntitySet="SViewForeignKeys"/>
      <End Role="Column" EntitySet="SViewColumns"/>
    </AssociationSet>
    <AssociationSet Name="SToForeignKeyViewColumns" Association="Self.ToForeignKeyViewColumn" >
      <End Role="ForeignKey" EntitySet="SViewForeignKeys"/>
      <End Role="Column" EntitySet="SViewColumns"/>
    </AssociationSet>

    <AssociationSet Name="FunctionFunctionParameters" Association="Self.FunctionFunctionParameter">
      <End Role="Function" EntitySet="SFunctions"/>
      <End Role="Parameter" EntitySet="SFunctionParameters"/>
    </AssociationSet>
    <AssociationSet Name="ProcedureProcedureParameters" Association="Self.ProcedureProcedureParameter" >
      <End Role="Procedure" EntitySet="SProcedures"/>
      <End Role="Parameter" EntitySet="SProcedureParameters"/>
    </AssociationSet>

  </EntityContainer>

  <EntityType Name="Table">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="CatalogName" Type="nvarchar" />
    <Property Name="SchemaName" Type="nvarchar" />
    <Property Name="Name" Nullable="false" Type="nvarchar" />
  </EntityType>

  <EntityType Name="TableColumn" >
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar"/>
    <Property Name="ParentId" Nullable="false" Type="nvarchar"/>
    <Property Name="Name" Nullable="false" Type="nvarchar"/>
    <Property Name="Ordinal" Nullable="false" Type="int" />
    <Property Name="IsNullable" Nullable="false" Type="bit" />
    <Property Name="TypeName" Nullable="false" Type="nvarchar" />
    <Property Name="MaxLength" Type="int" />
    <Property Name="Precision" Type="int" />
    <Property Name="DateTimePrecision" Type="int" />
    <Property Name="Scale" Type="int" />
    <Property Name="CollationCatalog" Type="nvarchar" />
    <Property Name="CollationSchema" Type="nvarchar" />
    <Property Name="CollationName" Type="nvarchar" />
    <Property Name="CharacterSetCatalog" Type="nvarchar" />
    <Property Name="CharacterSetSchema" Type="nvarchar" />
    <Property Name="CharacterSetName" Type="nvarchar" />
    <Property Name="IsMultiSet" Nullable="false" Type="bit" />
    <Property Name="IsIdentity" Nullable="false" Type="bit" />
    <Property Name="IsStoreGenerated" Nullable="false" Type="bit" />
    <Property Name="Default" Nullable="true" Type="nvarchar"/>
  </EntityType>

  <EntityType Name="View">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="CatalogName" Type="nvarchar" />
    <Property Name="SchemaName" Type="nvarchar" />
    <Property Name="Name" Nullable="false" Type="nvarchar" />
    <Property Name="ViewDefinition" Nullable="true" Type="nvarchar" />
    <Property Name="IsUpdatable" Nullable="false" Type="bit" />
  </EntityType>

  <EntityType Name="ViewColumn">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar"/>
    <Property Name="ParentId" Nullable="false" Type="nvarchar"/>
    <Property Name="Name" Nullable="false" Type="nvarchar"/>
    <Property Name="Ordinal" Nullable="false" Type="int" />
    <Property Name="IsNullable" Nullable="false" Type="bit" />
    <Property Name="TypeName" Nullable="false" Type="nvarchar" />
    <Property Name="MaxLength" Type="int" />
    <Property Name="Precision" Type="int" />
    <Property Name="DateTimePrecision" Type="int" />
    <Property Name="Scale" Type="int" />
    <Property Name="CollationCatalog" Type="nvarchar" />
    <Property Name="CollationSchema" Type="nvarchar" />
    <Property Name="CollationName" Type="nvarchar" />
    <Property Name="CharacterSetCatalog" Type="nvarchar" />
    <Property Name="CharacterSetSchema" Type="nvarchar" />
    <Property Name="CharacterSetName" Type="nvarchar" />
    <Property Name="IsMultiSet" Nullable="false" Type="bit" />
    <Property Name="IsIdentity" Nullable="false" Type="bit" />
    <Property Name="IsStoreGenerated" Nullable="false" Type="bit" />
    <Property Name="Default" Nullable="true" Type="nvarchar"/>
  </EntityType>

  <EntityType Name="Function">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar"/>
    <Property Name="CatalogName" Type="nvarchar"/>
    <Property Name="SchemaName" Type="nvarchar"/>
    <Property Name="Name" Nullable="false" Type="nvarchar"/>
    <Property Name="ReturnTypeName" Type="nvarchar" />
    <Property Name="ReturnMaxLength" Type="int" />
    <Property Name="ReturnPrecision" Type="int" />
    <Property Name="ReturnDateTimePrecision" Type="int" />
    <Property Name="ReturnScale" Type="int" />
    <Property Name="ReturnCollationCatalog" Type="nvarchar" />
    <Property Name="ReturnCollationSchema" Type="nvarchar" />
    <Property Name="ReturnCollationName" Type="nvarchar" />
    <Property Name="ReturnCharacterSetCatalog" Type="nvarchar" />
    <Property Name="ReturnCharacterSetSchema" Type="nvarchar" />
    <Property Name="ReturnCharacterSetName" Type="nvarchar" />
    <Property Name="ReturnIsMultiSet" Nullable="false" Type="bit" />
    <Property Name="IsAggregate" Type="bit" />
    <Property Name="IsBuiltIn" Type="bit" />
    <Property Name="IsNiladic" Type="bit" />
  </EntityType>

  <EntityType Name="Procedure">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar"/>
    <Property Name="CatalogName" Type="nvarchar"/>
    <Property Name="SchemaName" Type="nvarchar"/>
    <Property Name="Name" Nullable="false" Type="nvarchar"/>
  </EntityType>

  <EntityType Name="Parameter">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar"/>
    <Property Name="ParentId" Nullable="false" Type="nvarchar"/>
    <Property Name="Name" Nullable="false" Type="nvarchar" />
    <Property Name="Ordinal" Nullable="false" Type="int"/>
    <Property Name="TypeName" Nullable="false" Type="nvarchar" />
    <Property Name="MaxLength" Nullable="true" Type="int" />
    <Property Name="Precision" Nullable="true" Type="int" />
    <Property Name="DateTimePrecision" Type="int" />
    <Property Name="Scale" Nullable="true" Type="int" />
    <Property Name="CollationCatalog" Type="nvarchar" />
    <Property Name="CollationSchema" Type="nvarchar" />
    <Property Name="CollationName" Type="nvarchar" />
    <Property Name="CharacterSetCatalog" Type="nvarchar" />
    <Property Name="CharacterSetSchema" Type="nvarchar" />
    <Property Name="CharacterSetName" Type="nvarchar" />
    <Property Name="IsMultiSet" Nullable="false" Type="bit" />
    <Property Name="Mode" Type="nvarchar" />
    <Property Name="Default" Type="nvarchar" />
  </EntityType>

  <EntityType Name="Constraint">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="ParentId" Nullable="false" Type="nvarchar" />
    <Property Name="Name" Nullable="false" Type="nvarchar" />
    <Property Name="IsDeferrable" Nullable="false" Type="bit" />
    <Property Name="IsInitiallyDeferred" Nullable="false" Type="bit" />
    <Property Name="ConstraintType" Nullable="false" Type="nvarchar" />
  </EntityType>

  <EntityType Name="CheckConstraint">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="Expression" Nullable="true" Type="nvarchar" />
  </EntityType>

  <EntityType Name="ConstraintColumn">
    <Key>
      <PropertyRef Name="ConstraintId" />
      <PropertyRef Name="ColumnId" />
    </Key>
    <Property Name="ConstraintId" Nullable="false" Type="nvarchar" />
    <Property Name="ColumnId" Nullable="false" Type="nvarchar" />
  </EntityType>

  <EntityType Name="ForeignKeyConstraint">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="UpdateRule" Nullable="false" Type="nvarchar" />
    <Property Name="DeleteRule" Nullable="false" Type="nvarchar" />
  </EntityType>

  <EntityType Name="ForeignKey">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="Ordinal" Nullable="false" Type="int" />
    <Property Name="ConstraintId" Nullable="false" Type="nvarchar" />
    <Property Name="FromColumnId" Nullable="false" Type="nvarchar" />
    <Property Name="ToColumnId" Nullable="false" Type="nvarchar" />
  </EntityType>

  <EntityType Name="ViewConstraint">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="ParentId" Nullable="false" Type="nvarchar" />
    <Property Name="Name" Nullable="false" Type="nvarchar" />
    <Property Name="IsDeferrable" Nullable="false" Type="bit" />
    <Property Name="IsInitiallyDeferred" Nullable="false" Type="bit" />
    <Property Name="ConstraintType" Nullable="false" Type="nvarchar" />
    <Property Name="Expression" Nullable="true" Type="nvarchar" />
    <Property Name="UpdateRule" Nullable="true" Type="nvarchar" />
    <Property Name="DeleteRule" Nullable="true" Type="nvarchar" />
  </EntityType>

  <Association Name="TableTableConstraint">
    <End Type="Self.Table" Role="Parent" Multiplicity="1" />
    <End Type="Self.Constraint" Role="Constraint" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Parent">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="Constraint">
        <PropertyRef Name="ParentId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ConstraintConstraintColumn">
    <End Type="Self.Constraint" Role="Constraint" Multiplicity="1" />
    <End Type="Self.ConstraintColumn" Role="ConstraintColumn" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Constraint">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ConstraintColumn">
        <PropertyRef Name="ConstraintId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ConstraintForeignKey">
    <End Type="Self.ForeignKeyConstraint" Role="Constraint" Multiplicity="1" />
    <End Type="Self.ForeignKey" Role="ForeignKey" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Constraint">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ForeignKey">
        <PropertyRef Name="ConstraintId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="FromForeignKeyColumn">
    <End Type="Self.TableColumn" Role="Column" Multiplicity="1" />
    <End Type="Self.ForeignKey" Role="ForeignKey" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Column">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ForeignKey">
        <PropertyRef Name="FromColumnId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ToForeignKeyColumn">
    <End Type="Self.TableColumn" Role="Column" Multiplicity="1" />
    <End Type="Self.ForeignKey" Role="ForeignKey" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Column">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ForeignKey">
        <PropertyRef Name="ToColumnId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="TableTableColumn">
    <End Type="Self.Table" Role="Parent" Multiplicity="1" />
    <End Type="Self.TableColumn" Role="Column" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Parent">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="Column">
        <PropertyRef Name="ParentId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ViewViewColumn">
    <End Type="Self.View" Role="Parent" Multiplicity="1" />
    <End Type="Self.ViewColumn" Role="Column" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Parent">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="Column">
        <PropertyRef Name="ParentId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="FunctionFunctionParameter">
    <End Type="Self.Function" Role="Function" Multiplicity="1" />
    <End Type="Self.Parameter" Role="Parameter" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Function">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="Parameter">
        <PropertyRef Name="ParentId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ProcedureProcedureParameter">
    <End Type="Self.Procedure" Role="Procedure" Multiplicity="1" />
    <End Type="Self.Parameter" Role="Parameter" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Procedure">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="Parameter">
        <PropertyRef Name="ParentId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ViewViewConstraint">
    <End Type="Self.View" Role="Parent" Multiplicity="1" />
    <End Type="Self.ViewConstraint" Role="Constraint" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Parent">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="Constraint">
        <PropertyRef Name="ParentId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ViewConstraintConstraintColumn">
    <End Type="Self.ViewConstraint" Role="Constraint" Multiplicity="1" />
    <End Type="Self.ConstraintColumn" Role="ConstraintColumn" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Constraint">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ConstraintColumn">
        <PropertyRef Name="ConstraintId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ViewConstraintForeignKey">
    <End Type="Self.ViewConstraint" Role="Constraint" Multiplicity="1" />
    <End Type="Self.ForeignKey" Role="ForeignKey" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Constraint">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ForeignKey">
        <PropertyRef Name="ConstraintId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="FromForeignKeyViewColumn">
    <End Type="Self.ViewColumn" Role="Column" Multiplicity="1" />
    <End Type="Self.ForeignKey" Role="ForeignKey" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Column">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ForeignKey">
        <PropertyRef Name="FromColumnId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ToForeignKeyViewColumn">
    <End Type="Self.ViewColumn" Role="Column" Multiplicity="1" />
    <End Type="Self.ForeignKey" Role="ForeignKey" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Column">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ForeignKey">
        <PropertyRef Name="ToColumnId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

</Schema>

Added System.Data.SQLite.Linq/Resources/SQLiteProviderServices.StoreSchemaDefinition.Linq.ssdl.











































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
<?xml version="1.0" encoding="utf-8"?>
<Schema Namespace="EFSQLite" Provider="System.Data.SQLite.Linq" ProviderManifestToken="ISO8601" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl">
  <EntityContainer Name="Schema">
    <EntitySet Name="STables" EntityType="Self.Table">
      <DefiningQuery>
        SELECT
        '[' || TABLE_NAME || ']' COLLATE NOCASE [Id]
        ,   TABLE_CATALOG [CatalogName]
        ,   TABLE_SCHEMA [SchemaName]
        ,   TABLE_NAME    [Name]
        FROM
        TEMP.SCHEMATABLES
        WHERE
        TABLE_TYPE LIKE 'table'
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="STableColumns" EntityType="Self.TableColumn">
      <DefiningQuery>
        SELECT
        '[' || c.TABLE_NAME || ']' || '[' || c.COLUMN_NAME || ']' COLLATE NOCASE [Id]
        ,   '[' || c.TABLE_NAME || ']'  COLLATE NOCASE                     [ParentId]
        ,   c.COLUMN_NAME   [Name]
        ,   c.ORDINAL_POSITION [Ordinal]
        ,   c.IS_NULLABLE [IsNullable]
        ,   c.EDM_TYPE [TypeName]
        ,   c.CHARACTER_MAXIMUM_LENGTH [MaxLength]
        ,   c.NUMERIC_PRECISION [Precision]
        ,   c.DATETIME_PRECISION [DateTimePrecision]
        ,   c.NUMERIC_SCALE [Scale]
        ,   c.COLLATION_CATALOG [CollationCatalog]
        ,   c.COLLATION_SCHEMA [CollationSchema]
        ,   c.COLLATION_NAME [CollationName]
        ,   c.CHARACTER_SET_CATALOG [CharacterSetCatalog]
        ,   c.CHARACTER_SET_SCHEMA [CharacterSetSchema]
        ,   c.CHARACTER_SET_NAME [CharacterSetName]
        ,   0 as [IsMultiSet]
        ,   c.[AUTOINCREMENT] as [IsIdentity]
        ,   0 as [IsStoreGenerated]
        , c.COLUMN_DEFAULT as [Default]
        FROM
        TEMP.SCHEMACOLUMNS c
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SViews" EntityType="Self.View">
      <DefiningQuery>
        SELECT
        '[' || TABLE_NAME || ']'  COLLATE NOCASE [Id]
        ,   TABLE_CATALOG             [CatalogName]
        ,   TABLE_SCHEMA              [SchemaName]
        ,   TABLE_NAME                [Name]
        ,   VIEW_DEFINITION           [ViewDefinition]
        ,   IS_UPDATABLE              [IsUpdatable]
        FROM
        TEMP.SCHEMAVIEWS
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SViewColumns" EntityType="Self.ViewColumn">
      <DefiningQuery>
        SELECT
        '[' || c.VIEW_NAME || ']' || '[' || c.VIEW_COLUMN_NAME || ']' COLLATE NOCASE [Id]
        ,   '[' || c.VIEW_NAME || ']' COLLATE NOCASE                             [ParentId]
        ,   c.VIEW_COLUMN_NAME   [Name]
        ,   c.ORDINAL_POSITION [Ordinal]
        ,   c.IS_NULLABLE [IsNullable]
        ,   c.EDM_TYPE [TypeName]
        ,   c.CHARACTER_MAXIMUM_LENGTH [MaxLength]
        ,   c.NUMERIC_PRECISION [Precision]
        ,   c.DATETIME_PRECISION as [DateTimePrecision]
        ,   c.NUMERIC_SCALE [Scale]
        ,   c.COLLATION_CATALOG [CollationCatalog]
        ,   c.COLLATION_SCHEMA [CollationSchema]
        ,   c.COLLATION_NAME [CollationName]
        ,   c.CHARACTER_SET_CATALOG [CharacterSetCatalog]
        ,   c.CHARACTER_SET_SCHEMA [CharacterSetSchema]
        ,   c.CHARACTER_SET_NAME [CharacterSetName]
        ,   0 as [IsMultiSet]
        ,   c.[AUTOINCREMENT] as [IsIdentity]
        ,   0 as [IsStoreGenerated]
        ,   c.COLUMN_DEFAULT [Default]
        FROM
        TEMP.SCHEMAVIEWCOLUMNS c
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SFunctions" EntityType="Self.Function">
      <DefiningQuery>
        SELECT
        NULL [Id]
        , NULL         [CatalogName]
        , NULL         [SchemaName]
        , NULL         [Name]
        , NULL         [ReturnTypeName]
        , NULL [ReturnMaxLength]
        , NULL        [ReturnPrecision]
        , NULL [ReturnDateTimePrecision]
        , NULL            [ReturnScale]
        , NULL        [ReturnCollationCatalog]
        , NULL         [ReturnCollationSchema]
        , NULL           [ReturnCollationName]
        , NULL    [ReturnCharacterSetCatalog]
        , NULL     [ReturnCharacterSetSchema]
        , NULL       [ReturnCharacterSetName]
        , NULL as        [ReturnIsMultiSet]
        , NULL as [IsAggregate]
        , NULL as [IsBuiltIn]
        , NULL as [IsNiladic]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SFunctionParameters" EntityType="Self.Parameter">
      <DefiningQuery>
        SELECT
        NULL [Id]
        , NULL [ParentId]
        , NULL [Name]
        , NULL [Ordinal]
        , NULL [TypeName]
        , NULL [MaxLength]
        , NULL [Precision]
        , NULL [DateTimePrecision]
        , NULL    [Scale]
        , NULL [CollationCatalog]
        , NULL [CollationSchema]
        , NULL [CollationName]
        , NULL [CharacterSetCatalog]
        , NULL [CharacterSetSchema]
        , NULL [CharacterSetName]
        , NULL [IsMultiSet]
        , NULL [Mode]
        , NULL [Default]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SProcedures" EntityType="Self.Procedure">
      <DefiningQuery>
        SELECT
        NULL [Id]
        , NULL         [CatalogName]
        , NULL          [SchemaName]
        , NULL            [Name]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SProcedureParameters" EntityType="Self.Parameter">
      <DefiningQuery>
        SELECT
        NULL [Id]
        , NULL [ParentId]
        , NULL [Name]
        , NULL [Ordinal]
        , NULL [TypeName]
        , NULL [MaxLength]
        , NULL [Precision]
        , NULL [DateTimePrecision]
        , NULL [Scale]
        , NULL [CollationCatalog]
        , NULL [CollationSchema]
        , NULL [CollationName]
        , NULL [CharacterSetCatalog]
        , NULL [CharacterSetSchema]
        , NULL [CharacterSetName]
        , NULL as [IsMultiSet]
        , NULL   [Mode]
        , NULL [Default]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SConstraints" EntityType="Self.Constraint">
      <DefiningQuery>
        SELECT
        '[' || tc.CONSTRAINT_NAME || ']'  COLLATE NOCASE [Id]
        , '[' || tc.TABLE_NAME || ']'  COLLATE NOCASE [ParentId]
        , tc.CONSTRAINT_NAME [Name]
        , tc.CONSTRAINT_TYPE [ConstraintType]
        , tc.IS_DEFERRABLE [IsDeferrable]
        , tc.INITIALLY_DEFERRED [IsInitiallyDeferred]
        FROM
        TEMP.SCHEMACONSTRAINTS tc
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SCheckConstraints" EntityType="Self.CheckConstraint">
      <DefiningQuery>
        SELECT
        NULL [Id]
        , NULL [Expression]
        WHERE 1 = 2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SConstraintColumns" EntityType="Self.ConstraintColumn">
      <DefiningQuery>
        SELECT
        '[' || CONSTRAINT_NAME || ']'  COLLATE NOCASE [ConstraintId]
        , '[' || TABLE_NAME || ']' || '[' || COLUMN_NAME    || ']'  COLLATE NOCASE [ColumnId]
        FROM
        TEMP.SCHEMACONSTRAINTCOLUMNS
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SForeignKeyConstraints" EntityType="Self.ForeignKeyConstraint">
      <DefiningQuery>
        SELECT DISTINCT
        '[' || rc.CONSTRAINT_NAME || ']'  COLLATE NOCASE [Id]
        , 'NO ACTION'  COLLATE NOCASE [UpdateRule]
        , 'NO ACTION'  COLLATE NOCASE [DeleteRule]
        FROM
        TEMP.SCHEMAFOREIGNKEYS rc
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SForeignKeys" EntityType="Self.ForeignKey">
      <DefiningQuery>
        SELECT
        '[' || FC.CONSTRAINT_NAME || ']' || '[' || FC.FKEY_FROM_ORDINAL_POSITION || ']' COLLATE NOCASE [Id]
        ,   '[' || FC.FKEY_TO_TABLE || ']' || '[' || FC.FKEY_TO_COLUMN || ']' COLLATE NOCASE [ToColumnId]
        ,   '[' || FC.TABLE_NAME || ']' || '[' || FC.FKEY_FROM_COLUMN || ']' COLLATE NOCASE [FromColumnId]
        ,   '[' || FC.CONSTRAINT_NAME || ']' COLLATE NOCASE [ConstraintId]
        ,   FC.FKEY_FROM_ORDINAL_POSITION [Ordinal]
        FROM
        TEMP.SCHEMAFOREIGNKEYS FC
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SViewConstraints" EntityType="Self.ViewConstraint">
      <DefiningQuery>
        SELECT
        NULL   [Id]
        , NULL [ParentId]
        , NULL [Name]
        , NULL [ConstraintType]
        , NULL [IsDeferrable]
        , NULL [IsInitiallyDeferred]
        , NULL [Expression]
        , NULL  [UpdateRule]
        , NULL  [DeleteRule]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SViewConstraintColumns" EntityType="Self.ConstraintColumn">
      <DefiningQuery>
        SELECT
        NULL  [ConstraintId]
        , NULL [ColumnId]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SViewForeignKeys" EntityType="Self.ForeignKey">
      <DefiningQuery>
        SELECT
        NULL  [Id]
        ,  NULL [ToColumnId]
        ,  NULL [FromColumnId]
        ,  NULL  [ConstraintId]
        ,  0 [Ordinal]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <AssociationSet Name="STableTableColumns" Association="Self.TableTableColumn" >
      <End Role="Parent" EntitySet="STables"/>
      <End Role="Column" EntitySet="STableColumns"/>
    </AssociationSet>
    <AssociationSet Name="STableConstraints" Association="Self.TableTableConstraint" >
      <End Role="Parent" EntitySet="STables"/>
      <End Role="Constraint" EntitySet="SConstraints"/>
    </AssociationSet>
    <AssociationSet Name="SConstraintConstraintColumns" Association="Self.ConstraintConstraintColumn" >
      <End Role="ConstraintColumn" EntitySet="SConstraintColumns"/>
      <End Role="Constraint" EntitySet="SConstraints"/>
    </AssociationSet>
    <AssociationSet Name="SConstraintForeignKeys" Association="Self.ConstraintForeignKey" >
      <End Role="ForeignKey" EntitySet="SForeignKeys"/>
      <End Role="Constraint" EntitySet="SForeignKeyConstraints"/>
    </AssociationSet>
    <AssociationSet Name="SFromForeignKeyColumns" Association="Self.FromForeignKeyColumn" >
      <End Role="ForeignKey" EntitySet="SForeignKeys"/>
      <End Role="Column" EntitySet="STableColumns"/>
    </AssociationSet>
    <AssociationSet Name="SToForeignKeyColumns" Association="Self.ToForeignKeyColumn" >
      <End Role="ForeignKey" EntitySet="SForeignKeys"/>
      <End Role="Column" EntitySet="STableColumns"/>
    </AssociationSet>

    <AssociationSet Name="SViewViewColumns" Association="Self.ViewViewColumn" >
      <End Role="Parent" EntitySet="SViews"/>
      <End Role="Column" EntitySet="SViewColumns"/>
    </AssociationSet>
    <AssociationSet Name="SViewViewConstraints" Association="Self.ViewViewConstraint" >
      <End Role="Parent" EntitySet="SViews"/>
      <End Role="Constraint" EntitySet="SViewConstraints"/>
    </AssociationSet>
    <AssociationSet Name="SViewConstraintConstraintColumns" Association="Self.ViewConstraintConstraintColumn" >
      <End Role="ConstraintColumn" EntitySet="SViewConstraintColumns"/>
      <End Role="Constraint" EntitySet="SViewConstraints"/>
    </AssociationSet>
    <AssociationSet Name="SViewConstraintForeignKeys" Association="Self.ViewConstraintForeignKey" >
      <End Role="ForeignKey" EntitySet="SViewForeignKeys"/>
      <End Role="Constraint" EntitySet="SViewConstraints"/>
    </AssociationSet>
    <AssociationSet Name="SFromForeignKeyViewColumns" Association="Self.FromForeignKeyViewColumn" >
      <End Role="ForeignKey" EntitySet="SViewForeignKeys"/>
      <End Role="Column" EntitySet="SViewColumns"/>
    </AssociationSet>
    <AssociationSet Name="SToForeignKeyViewColumns" Association="Self.ToForeignKeyViewColumn" >
      <End Role="ForeignKey" EntitySet="SViewForeignKeys"/>
      <End Role="Column" EntitySet="SViewColumns"/>
    </AssociationSet>

    <AssociationSet Name="FunctionFunctionParameters" Association="Self.FunctionFunctionParameter">
      <End Role="Function" EntitySet="SFunctions"/>
      <End Role="Parameter" EntitySet="SFunctionParameters"/>
    </AssociationSet>
    <AssociationSet Name="ProcedureProcedureParameters" Association="Self.ProcedureProcedureParameter" >
      <End Role="Procedure" EntitySet="SProcedures"/>
      <End Role="Parameter" EntitySet="SProcedureParameters"/>
    </AssociationSet>

  </EntityContainer>

  <EntityType Name="Table">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="CatalogName" Type="nvarchar" />
    <Property Name="SchemaName" Type="nvarchar" />
    <Property Name="Name" Nullable="false" Type="nvarchar" />
  </EntityType>

  <EntityType Name="TableColumn" >
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar"/>
    <Property Name="ParentId" Nullable="false" Type="nvarchar"/>
    <Property Name="Name" Nullable="false" Type="nvarchar"/>
    <Property Name="Ordinal" Nullable="false" Type="int" />
    <Property Name="IsNullable" Nullable="false" Type="bit" />
    <Property Name="TypeName" Nullable="false" Type="nvarchar" />
    <Property Name="MaxLength" Type="int" />
    <Property Name="Precision" Type="int" />
    <Property Name="DateTimePrecision" Type="int" />
    <Property Name="Scale" Type="int" />
    <Property Name="CollationCatalog" Type="nvarchar" />
    <Property Name="CollationSchema" Type="nvarchar" />
    <Property Name="CollationName" Type="nvarchar" />
    <Property Name="CharacterSetCatalog" Type="nvarchar" />
    <Property Name="CharacterSetSchema" Type="nvarchar" />
    <Property Name="CharacterSetName" Type="nvarchar" />
    <Property Name="IsMultiSet" Nullable="false" Type="bit" />
    <Property Name="IsIdentity" Nullable="false" Type="bit" />
    <Property Name="IsStoreGenerated" Nullable="false" Type="bit" />
    <Property Name="Default" Nullable="true" Type="nvarchar"/>
  </EntityType>

  <EntityType Name="View">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="CatalogName" Type="nvarchar" />
    <Property Name="SchemaName" Type="nvarchar" />
    <Property Name="Name" Nullable="false" Type="nvarchar" />
    <Property Name="ViewDefinition" Nullable="true" Type="nvarchar" />
    <Property Name="IsUpdatable" Nullable="false" Type="bit" />
  </EntityType>

  <EntityType Name="ViewColumn">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar"/>
    <Property Name="ParentId" Nullable="false" Type="nvarchar"/>
    <Property Name="Name" Nullable="false" Type="nvarchar"/>
    <Property Name="Ordinal" Nullable="false" Type="int" />
    <Property Name="IsNullable" Nullable="false" Type="bit" />
    <Property Name="TypeName" Nullable="false" Type="nvarchar" />
    <Property Name="MaxLength" Type="int" />
    <Property Name="Precision" Type="int" />
    <Property Name="DateTimePrecision" Type="int" />
    <Property Name="Scale" Type="int" />
    <Property Name="CollationCatalog" Type="nvarchar" />
    <Property Name="CollationSchema" Type="nvarchar" />
    <Property Name="CollationName" Type="nvarchar" />
    <Property Name="CharacterSetCatalog" Type="nvarchar" />
    <Property Name="CharacterSetSchema" Type="nvarchar" />
    <Property Name="CharacterSetName" Type="nvarchar" />
    <Property Name="IsMultiSet" Nullable="false" Type="bit" />
    <Property Name="IsIdentity" Nullable="false" Type="bit" />
    <Property Name="IsStoreGenerated" Nullable="false" Type="bit" />
    <Property Name="Default" Nullable="true" Type="nvarchar"/>
  </EntityType>

  <EntityType Name="Function">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar"/>
    <Property Name="CatalogName" Type="nvarchar"/>
    <Property Name="SchemaName" Type="nvarchar"/>
    <Property Name="Name" Nullable="false" Type="nvarchar"/>
    <Property Name="ReturnTypeName" Type="nvarchar" />
    <Property Name="ReturnMaxLength" Type="int" />
    <Property Name="ReturnPrecision" Type="int" />
    <Property Name="ReturnDateTimePrecision" Type="int" />
    <Property Name="ReturnScale" Type="int" />
    <Property Name="ReturnCollationCatalog" Type="nvarchar" />
    <Property Name="ReturnCollationSchema" Type="nvarchar" />
    <Property Name="ReturnCollationName" Type="nvarchar" />
    <Property Name="ReturnCharacterSetCatalog" Type="nvarchar" />
    <Property Name="ReturnCharacterSetSchema" Type="nvarchar" />
    <Property Name="ReturnCharacterSetName" Type="nvarchar" />
    <Property Name="ReturnIsMultiSet" Nullable="false" Type="bit" />
    <Property Name="IsAggregate" Type="bit" />
    <Property Name="IsBuiltIn" Type="bit" />
    <Property Name="IsNiladic" Type="bit" />
  </EntityType>

  <EntityType Name="Procedure">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar"/>
    <Property Name="CatalogName" Type="nvarchar"/>
    <Property Name="SchemaName" Type="nvarchar"/>
    <Property Name="Name" Nullable="false" Type="nvarchar"/>
  </EntityType>

  <EntityType Name="Parameter">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar"/>
    <Property Name="ParentId" Nullable="false" Type="nvarchar"/>
    <Property Name="Name" Nullable="false" Type="nvarchar" />
    <Property Name="Ordinal" Nullable="false" Type="int"/>
    <Property Name="TypeName" Nullable="false" Type="nvarchar" />
    <Property Name="MaxLength" Nullable="true" Type="int" />
    <Property Name="Precision" Nullable="true" Type="int" />
    <Property Name="DateTimePrecision" Type="int" />
    <Property Name="Scale" Nullable="true" Type="int" />
    <Property Name="CollationCatalog" Type="nvarchar" />
    <Property Name="CollationSchema" Type="nvarchar" />
    <Property Name="CollationName" Type="nvarchar" />
    <Property Name="CharacterSetCatalog" Type="nvarchar" />
    <Property Name="CharacterSetSchema" Type="nvarchar" />
    <Property Name="CharacterSetName" Type="nvarchar" />
    <Property Name="IsMultiSet" Nullable="false" Type="bit" />
    <Property Name="Mode" Type="nvarchar" />
    <Property Name="Default" Type="nvarchar" />
  </EntityType>

  <EntityType Name="Constraint">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="ParentId" Nullable="false" Type="nvarchar" />
    <Property Name="Name" Nullable="false" Type="nvarchar" />
    <Property Name="IsDeferrable" Nullable="false" Type="bit" />
    <Property Name="IsInitiallyDeferred" Nullable="false" Type="bit" />
    <Property Name="ConstraintType" Nullable="false" Type="nvarchar" />
  </EntityType>

  <EntityType Name="CheckConstraint">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="Expression" Nullable="true" Type="nvarchar" />
  </EntityType>

  <EntityType Name="ConstraintColumn">
    <Key>
      <PropertyRef Name="ConstraintId" />
      <PropertyRef Name="ColumnId" />
    </Key>
    <Property Name="ConstraintId" Nullable="false" Type="nvarchar" />
    <Property Name="ColumnId" Nullable="false" Type="nvarchar" />
  </EntityType>

  <EntityType Name="ForeignKeyConstraint">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="UpdateRule" Nullable="false" Type="nvarchar" />
    <Property Name="DeleteRule" Nullable="false" Type="nvarchar" />
  </EntityType>

  <EntityType Name="ForeignKey">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="Ordinal" Nullable="false" Type="int" />
    <Property Name="ConstraintId" Nullable="false" Type="nvarchar" />
    <Property Name="FromColumnId" Nullable="false" Type="nvarchar" />
    <Property Name="ToColumnId" Nullable="false" Type="nvarchar" />
  </EntityType>

  <EntityType Name="ViewConstraint">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="ParentId" Nullable="false" Type="nvarchar" />
    <Property Name="Name" Nullable="false" Type="nvarchar" />
    <Property Name="IsDeferrable" Nullable="false" Type="bit" />
    <Property Name="IsInitiallyDeferred" Nullable="false" Type="bit" />
    <Property Name="ConstraintType" Nullable="false" Type="nvarchar" />
    <Property Name="Expression" Nullable="true" Type="nvarchar" />
    <Property Name="UpdateRule" Nullable="true" Type="nvarchar" />
    <Property Name="DeleteRule" Nullable="true" Type="nvarchar" />
  </EntityType>

  <Association Name="TableTableConstraint">
    <End Type="Self.Table" Role="Parent" Multiplicity="1" />
    <End Type="Self.Constraint" Role="Constraint" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Parent">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="Constraint">
        <PropertyRef Name="ParentId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ConstraintConstraintColumn">
    <End Type="Self.Constraint" Role="Constraint" Multiplicity="1" />
    <End Type="Self.ConstraintColumn" Role="ConstraintColumn" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Constraint">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ConstraintColumn">
        <PropertyRef Name="ConstraintId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ConstraintForeignKey">
    <End Type="Self.ForeignKeyConstraint" Role="Constraint" Multiplicity="1" />
    <End Type="Self.ForeignKey" Role="ForeignKey" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Constraint">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ForeignKey">
        <PropertyRef Name="ConstraintId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="FromForeignKeyColumn">
    <End Type="Self.TableColumn" Role="Column" Multiplicity="1" />
    <End Type="Self.ForeignKey" Role="ForeignKey" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Column">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ForeignKey">
        <PropertyRef Name="FromColumnId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ToForeignKeyColumn">
    <End Type="Self.TableColumn" Role="Column" Multiplicity="1" />
    <End Type="Self.ForeignKey" Role="ForeignKey" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Column">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ForeignKey">
        <PropertyRef Name="ToColumnId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="TableTableColumn">
    <End Type="Self.Table" Role="Parent" Multiplicity="1" />
    <End Type="Self.TableColumn" Role="Column" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Parent">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="Column">
        <PropertyRef Name="ParentId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ViewViewColumn">
    <End Type="Self.View" Role="Parent" Multiplicity="1" />
    <End Type="Self.ViewColumn" Role="Column" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Parent">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="Column">
        <PropertyRef Name="ParentId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="FunctionFunctionParameter">
    <End Type="Self.Function" Role="Function" Multiplicity="1" />
    <End Type="Self.Parameter" Role="Parameter" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Function">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="Parameter">
        <PropertyRef Name="ParentId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ProcedureProcedureParameter">
    <End Type="Self.Procedure" Role="Procedure" Multiplicity="1" />
    <End Type="Self.Parameter" Role="Parameter" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Procedure">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="Parameter">
        <PropertyRef Name="ParentId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ViewViewConstraint">
    <End Type="Self.View" Role="Parent" Multiplicity="1" />
    <End Type="Self.ViewConstraint" Role="Constraint" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Parent">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="Constraint">
        <PropertyRef Name="ParentId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ViewConstraintConstraintColumn">
    <End Type="Self.ViewConstraint" Role="Constraint" Multiplicity="1" />
    <End Type="Self.ConstraintColumn" Role="ConstraintColumn" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Constraint">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ConstraintColumn">
        <PropertyRef Name="ConstraintId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ViewConstraintForeignKey">
    <End Type="Self.ViewConstraint" Role="Constraint" Multiplicity="1" />
    <End Type="Self.ForeignKey" Role="ForeignKey" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Constraint">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ForeignKey">
        <PropertyRef Name="ConstraintId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="FromForeignKeyViewColumn">
    <End Type="Self.ViewColumn" Role="Column" Multiplicity="1" />
    <End Type="Self.ForeignKey" Role="ForeignKey" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Column">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ForeignKey">
        <PropertyRef Name="FromColumnId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ToForeignKeyViewColumn">
    <End Type="Self.ViewColumn" Role="Column" Multiplicity="1" />
    <End Type="Self.ForeignKey" Role="ForeignKey" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Column">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ForeignKey">
        <PropertyRef Name="ToColumnId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

</Schema>

Deleted System.Data.SQLite.Linq/Resources/SQLiteProviderServices.StoreSchemaDefinition.ssdl.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
<?xml version="1.0" encoding="utf-8"?>
<Schema Namespace="EFSQLite" Provider="System.Data.SQLite" ProviderManifestToken="ISO8601" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl">
  <EntityContainer Name="Schema">
    <EntitySet Name="STables" EntityType="Self.Table">
      <DefiningQuery>
        SELECT
        '[' || TABLE_NAME || ']' COLLATE NOCASE [Id]
        ,   TABLE_CATALOG [CatalogName]
        ,   TABLE_SCHEMA [SchemaName]
        ,   TABLE_NAME    [Name]
        FROM
        TEMP.SCHEMATABLES
        WHERE
        TABLE_TYPE LIKE 'table'
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="STableColumns" EntityType="Self.TableColumn">
      <DefiningQuery>
        SELECT
        '[' || c.TABLE_NAME || ']' || '[' || c.COLUMN_NAME || ']' COLLATE NOCASE [Id]
        ,   '[' || c.TABLE_NAME || ']'  COLLATE NOCASE                     [ParentId]
        ,   c.COLUMN_NAME   [Name]
        ,   c.ORDINAL_POSITION [Ordinal]
        ,   c.IS_NULLABLE [IsNullable]
        ,   c.EDM_TYPE [TypeName]
        ,   c.CHARACTER_MAXIMUM_LENGTH [MaxLength]
        ,   c.NUMERIC_PRECISION [Precision]
        ,   c.DATETIME_PRECISION [DateTimePrecision]
        ,   c.NUMERIC_SCALE [Scale]
        ,   c.COLLATION_CATALOG [CollationCatalog]
        ,   c.COLLATION_SCHEMA [CollationSchema]
        ,   c.COLLATION_NAME [CollationName]
        ,   c.CHARACTER_SET_CATALOG [CharacterSetCatalog]
        ,   c.CHARACTER_SET_SCHEMA [CharacterSetSchema]
        ,   c.CHARACTER_SET_NAME [CharacterSetName]
        ,   0 as [IsMultiSet]
        ,   c.[AUTOINCREMENT] as [IsIdentity]
        ,   0 as [IsStoreGenerated]
        , c.COLUMN_DEFAULT as [Default]
        FROM
        TEMP.SCHEMACOLUMNS c
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SViews" EntityType="Self.View">
      <DefiningQuery>
        SELECT
        '[' || TABLE_NAME || ']'  COLLATE NOCASE [Id]
        ,   TABLE_CATALOG             [CatalogName]
        ,   TABLE_SCHEMA              [SchemaName]
        ,   TABLE_NAME                [Name]
        ,   VIEW_DEFINITION           [ViewDefinition]
        ,   IS_UPDATABLE              [IsUpdatable]
        FROM
        TEMP.SCHEMAVIEWS
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SViewColumns" EntityType="Self.ViewColumn">
      <DefiningQuery>
        SELECT
        '[' || c.VIEW_NAME || ']' || '[' || c.VIEW_COLUMN_NAME || ']' COLLATE NOCASE [Id]
        ,   '[' || c.VIEW_NAME || ']' COLLATE NOCASE                             [ParentId]
        ,   c.VIEW_COLUMN_NAME   [Name]
        ,   c.ORDINAL_POSITION [Ordinal]
        ,   c.IS_NULLABLE [IsNullable]
        ,   c.EDM_TYPE [TypeName]
        ,   c.CHARACTER_MAXIMUM_LENGTH [MaxLength]
        ,   c.NUMERIC_PRECISION [Precision]
        ,   c.DATETIME_PRECISION as [DateTimePrecision]
        ,   c.NUMERIC_SCALE [Scale]
        ,   c.COLLATION_CATALOG [CollationCatalog]
        ,   c.COLLATION_SCHEMA [CollationSchema]
        ,   c.COLLATION_NAME [CollationName]
        ,   c.CHARACTER_SET_CATALOG [CharacterSetCatalog]
        ,   c.CHARACTER_SET_SCHEMA [CharacterSetSchema]
        ,   c.CHARACTER_SET_NAME [CharacterSetName]
        ,   0 as [IsMultiSet]
        ,   c.[AUTOINCREMENT] as [IsIdentity]
        ,   0 as [IsStoreGenerated]
        ,   c.COLUMN_DEFAULT [Default]
        FROM
        TEMP.SCHEMAVIEWCOLUMNS c
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SFunctions" EntityType="Self.Function">
      <DefiningQuery>
        SELECT
        NULL [Id]
        , NULL         [CatalogName]
        , NULL         [SchemaName]
        , NULL         [Name]
        , NULL         [ReturnTypeName]
        , NULL [ReturnMaxLength]
        , NULL        [ReturnPrecision]
        , NULL [ReturnDateTimePrecision]
        , NULL            [ReturnScale]
        , NULL        [ReturnCollationCatalog]
        , NULL         [ReturnCollationSchema]
        , NULL           [ReturnCollationName]
        , NULL    [ReturnCharacterSetCatalog]
        , NULL     [ReturnCharacterSetSchema]
        , NULL       [ReturnCharacterSetName]
        , NULL as        [ReturnIsMultiSet]
        , NULL as [IsAggregate]
        , NULL as [IsBuiltIn]
        , NULL as [IsNiladic]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SFunctionParameters" EntityType="Self.Parameter">
      <DefiningQuery>
        SELECT
        NULL [Id]
        , NULL [ParentId]
        , NULL [Name]
        , NULL [Ordinal]
        , NULL [TypeName]
        , NULL [MaxLength]
        , NULL [Precision]
        , NULL [DateTimePrecision]
        , NULL    [Scale]
        , NULL [CollationCatalog]
        , NULL [CollationSchema]
        , NULL [CollationName]
        , NULL [CharacterSetCatalog]
        , NULL [CharacterSetSchema]
        , NULL [CharacterSetName]
        , NULL [IsMultiSet]
        , NULL [Mode]
        , NULL [Default]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SProcedures" EntityType="Self.Procedure">
      <DefiningQuery>
        SELECT
        NULL [Id]
        , NULL         [CatalogName]
        , NULL          [SchemaName]
        , NULL            [Name]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SProcedureParameters" EntityType="Self.Parameter">
      <DefiningQuery>
        SELECT
        NULL [Id]
        , NULL [ParentId]
        , NULL [Name]
        , NULL [Ordinal]
        , NULL [TypeName]
        , NULL [MaxLength]
        , NULL [Precision]
        , NULL [DateTimePrecision]
        , NULL [Scale]
        , NULL [CollationCatalog]
        , NULL [CollationSchema]
        , NULL [CollationName]
        , NULL [CharacterSetCatalog]
        , NULL [CharacterSetSchema]
        , NULL [CharacterSetName]
        , NULL as [IsMultiSet]
        , NULL   [Mode]
        , NULL [Default]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SConstraints" EntityType="Self.Constraint">
      <DefiningQuery>
        SELECT
        '[' || tc.CONSTRAINT_NAME || ']'  COLLATE NOCASE [Id]
        , '[' || tc.TABLE_NAME || ']'  COLLATE NOCASE [ParentId]
        , tc.CONSTRAINT_NAME [Name]
        , tc.CONSTRAINT_TYPE [ConstraintType]
        , tc.IS_DEFERRABLE [IsDeferrable]
        , tc.INITIALLY_DEFERRED [IsInitiallyDeferred]
        FROM
        TEMP.SCHEMACONSTRAINTS tc
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SCheckConstraints" EntityType="Self.CheckConstraint">
      <DefiningQuery>
        SELECT
        NULL [Id]
        , NULL [Expression]
        WHERE 1 = 2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SConstraintColumns" EntityType="Self.ConstraintColumn">
      <DefiningQuery>
        SELECT
        '[' || CONSTRAINT_NAME || ']'  COLLATE NOCASE [ConstraintId]
        , '[' || TABLE_NAME || ']' || '[' || COLUMN_NAME    || ']'  COLLATE NOCASE [ColumnId]
        FROM
        TEMP.SCHEMACONSTRAINTCOLUMNS
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SForeignKeyConstraints" EntityType="Self.ForeignKeyConstraint">
      <DefiningQuery>
        SELECT DISTINCT
        '[' || rc.CONSTRAINT_NAME || ']'  COLLATE NOCASE [Id]
        , 'NO ACTION'  COLLATE NOCASE [UpdateRule]
        , 'NO ACTION'  COLLATE NOCASE [DeleteRule]
        FROM
        TEMP.SCHEMAFOREIGNKEYS rc
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SForeignKeys" EntityType="Self.ForeignKey">
      <DefiningQuery>
        SELECT
        '[' || FC.CONSTRAINT_NAME || ']' || '[' || FC.FKEY_FROM_ORDINAL_POSITION || ']' COLLATE NOCASE [Id]
        ,   '[' || FC.FKEY_TO_TABLE || ']' || '[' || FC.FKEY_TO_COLUMN || ']' COLLATE NOCASE [ToColumnId]
        ,   '[' || FC.TABLE_NAME || ']' || '[' || FC.FKEY_FROM_COLUMN || ']' COLLATE NOCASE [FromColumnId]
        ,   '[' || FC.CONSTRAINT_NAME || ']' COLLATE NOCASE [ConstraintId]
        ,   FC.FKEY_FROM_ORDINAL_POSITION [Ordinal]
        FROM
        TEMP.SCHEMAFOREIGNKEYS FC
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SViewConstraints" EntityType="Self.ViewConstraint">
      <DefiningQuery>
        SELECT
        NULL   [Id]
        , NULL [ParentId]
        , NULL [Name]
        , NULL [ConstraintType]
        , NULL [IsDeferrable]
        , NULL [IsInitiallyDeferred]
        , NULL [Expression]
        , NULL  [UpdateRule]
        , NULL  [DeleteRule]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SViewConstraintColumns" EntityType="Self.ConstraintColumn">
      <DefiningQuery>
        SELECT
        NULL  [ConstraintId]
        , NULL [ColumnId]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <EntitySet Name="SViewForeignKeys" EntityType="Self.ForeignKey">
      <DefiningQuery>
        SELECT
        NULL  [Id]
        ,  NULL [ToColumnId]
        ,  NULL [FromColumnId]
        ,  NULL  [ConstraintId]
        ,  0 [Ordinal]
        WHERE 1=2
      </DefiningQuery>
    </EntitySet>

    <AssociationSet Name="STableTableColumns" Association="Self.TableTableColumn" >
      <End Role="Parent" EntitySet="STables"/>
      <End Role="Column" EntitySet="STableColumns"/>
    </AssociationSet>
    <AssociationSet Name="STableConstraints" Association="Self.TableTableConstraint" >
      <End Role="Parent" EntitySet="STables"/>
      <End Role="Constraint" EntitySet="SConstraints"/>
    </AssociationSet>
    <AssociationSet Name="SConstraintConstraintColumns" Association="Self.ConstraintConstraintColumn" >
      <End Role="ConstraintColumn" EntitySet="SConstraintColumns"/>
      <End Role="Constraint" EntitySet="SConstraints"/>
    </AssociationSet>    
    <AssociationSet Name="SConstraintForeignKeys" Association="Self.ConstraintForeignKey" >
      <End Role="ForeignKey" EntitySet="SForeignKeys"/>
      <End Role="Constraint" EntitySet="SForeignKeyConstraints"/>
    </AssociationSet>
    <AssociationSet Name="SFromForeignKeyColumns" Association="Self.FromForeignKeyColumn" >
      <End Role="ForeignKey" EntitySet="SForeignKeys"/>
      <End Role="Column" EntitySet="STableColumns"/>
    </AssociationSet>
    <AssociationSet Name="SToForeignKeyColumns" Association="Self.ToForeignKeyColumn" >
      <End Role="ForeignKey" EntitySet="SForeignKeys"/>
      <End Role="Column" EntitySet="STableColumns"/>
    </AssociationSet>

    <AssociationSet Name="SViewViewColumns" Association="Self.ViewViewColumn" >
      <End Role="Parent" EntitySet="SViews"/>
      <End Role="Column" EntitySet="SViewColumns"/>
    </AssociationSet>
    <AssociationSet Name="SViewViewConstraints" Association="Self.ViewViewConstraint" >
      <End Role="Parent" EntitySet="SViews"/>
      <End Role="Constraint" EntitySet="SViewConstraints"/>
    </AssociationSet>
    <AssociationSet Name="SViewConstraintConstraintColumns" Association="Self.ViewConstraintConstraintColumn" >
      <End Role="ConstraintColumn" EntitySet="SViewConstraintColumns"/>
      <End Role="Constraint" EntitySet="SViewConstraints"/>
    </AssociationSet>
    <AssociationSet Name="SViewConstraintForeignKeys" Association="Self.ViewConstraintForeignKey" >
      <End Role="ForeignKey" EntitySet="SViewForeignKeys"/>
      <End Role="Constraint" EntitySet="SViewConstraints"/>
    </AssociationSet>
    <AssociationSet Name="SFromForeignKeyViewColumns" Association="Self.FromForeignKeyViewColumn" >
      <End Role="ForeignKey" EntitySet="SViewForeignKeys"/>
      <End Role="Column" EntitySet="SViewColumns"/>
    </AssociationSet>
    <AssociationSet Name="SToForeignKeyViewColumns" Association="Self.ToForeignKeyViewColumn" >
      <End Role="ForeignKey" EntitySet="SViewForeignKeys"/>
      <End Role="Column" EntitySet="SViewColumns"/>
    </AssociationSet>

    <AssociationSet Name="FunctionFunctionParameters" Association="Self.FunctionFunctionParameter">
      <End Role="Function" EntitySet="SFunctions"/>
      <End Role="Parameter" EntitySet="SFunctionParameters"/>
    </AssociationSet>
    <AssociationSet Name="ProcedureProcedureParameters" Association="Self.ProcedureProcedureParameter" >
      <End Role="Procedure" EntitySet="SProcedures"/>
      <End Role="Parameter" EntitySet="SProcedureParameters"/>
    </AssociationSet>

  </EntityContainer>

  <EntityType Name="Table">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="CatalogName" Type="nvarchar" />
    <Property Name="SchemaName" Type="nvarchar" />
    <Property Name="Name" Nullable="false" Type="nvarchar" />
  </EntityType>

  <EntityType Name="TableColumn" >
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar"/>
    <Property Name="ParentId" Nullable="false" Type="nvarchar"/>
    <Property Name="Name" Nullable="false" Type="nvarchar"/>
    <Property Name="Ordinal" Nullable="false" Type="int" />
    <Property Name="IsNullable" Nullable="false" Type="bit" />
    <Property Name="TypeName" Nullable="false" Type="nvarchar" />
    <Property Name="MaxLength" Type="int" />
    <Property Name="Precision" Type="int" />
    <Property Name="DateTimePrecision" Type="int" />
    <Property Name="Scale" Type="int" />
    <Property Name="CollationCatalog" Type="nvarchar" />
    <Property Name="CollationSchema" Type="nvarchar" />
    <Property Name="CollationName" Type="nvarchar" />
    <Property Name="CharacterSetCatalog" Type="nvarchar" />
    <Property Name="CharacterSetSchema" Type="nvarchar" />
    <Property Name="CharacterSetName" Type="nvarchar" />
    <Property Name="IsMultiSet" Nullable="false" Type="bit" />
    <Property Name="IsIdentity" Nullable="false" Type="bit" />
    <Property Name="IsStoreGenerated" Nullable="false" Type="bit" />
    <Property Name="Default" Nullable="true" Type="nvarchar"/>
  </EntityType>

  <EntityType Name="View">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="CatalogName" Type="nvarchar" />
    <Property Name="SchemaName" Type="nvarchar" />
    <Property Name="Name" Nullable="false" Type="nvarchar" />
    <Property Name="ViewDefinition" Nullable="true" Type="nvarchar" />
    <Property Name="IsUpdatable" Nullable="false" Type="bit" />
  </EntityType>

  <EntityType Name="ViewColumn">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar"/>
    <Property Name="ParentId" Nullable="false" Type="nvarchar"/>
    <Property Name="Name" Nullable="false" Type="nvarchar"/>
    <Property Name="Ordinal" Nullable="false" Type="int" />
    <Property Name="IsNullable" Nullable="false" Type="bit" />
    <Property Name="TypeName" Nullable="false" Type="nvarchar" />
    <Property Name="MaxLength" Type="int" />
    <Property Name="Precision" Type="int" />
    <Property Name="DateTimePrecision" Type="int" />
    <Property Name="Scale" Type="int" />
    <Property Name="CollationCatalog" Type="nvarchar" />
    <Property Name="CollationSchema" Type="nvarchar" />
    <Property Name="CollationName" Type="nvarchar" />
    <Property Name="CharacterSetCatalog" Type="nvarchar" />
    <Property Name="CharacterSetSchema" Type="nvarchar" />
    <Property Name="CharacterSetName" Type="nvarchar" />
    <Property Name="IsMultiSet" Nullable="false" Type="bit" />
    <Property Name="IsIdentity" Nullable="false" Type="bit" />
    <Property Name="IsStoreGenerated" Nullable="false" Type="bit" />
    <Property Name="Default" Nullable="true" Type="nvarchar"/>
  </EntityType>

  <EntityType Name="Function">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar"/>
    <Property Name="CatalogName" Type="nvarchar"/>
    <Property Name="SchemaName" Type="nvarchar"/>
    <Property Name="Name" Nullable="false" Type="nvarchar"/>
    <Property Name="ReturnTypeName" Type="nvarchar" />
    <Property Name="ReturnMaxLength" Type="int" />
    <Property Name="ReturnPrecision" Type="int" />
    <Property Name="ReturnDateTimePrecision" Type="int" />
    <Property Name="ReturnScale" Type="int" />
    <Property Name="ReturnCollationCatalog" Type="nvarchar" />
    <Property Name="ReturnCollationSchema" Type="nvarchar" />
    <Property Name="ReturnCollationName" Type="nvarchar" />
    <Property Name="ReturnCharacterSetCatalog" Type="nvarchar" />
    <Property Name="ReturnCharacterSetSchema" Type="nvarchar" />
    <Property Name="ReturnCharacterSetName" Type="nvarchar" />
    <Property Name="ReturnIsMultiSet" Nullable="false" Type="bit" />
    <Property Name="IsAggregate" Type="bit" />
    <Property Name="IsBuiltIn" Type="bit" />
    <Property Name="IsNiladic" Type="bit" />
  </EntityType>

  <EntityType Name="Procedure">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar"/>
    <Property Name="CatalogName" Type="nvarchar"/>
    <Property Name="SchemaName" Type="nvarchar"/>
    <Property Name="Name" Nullable="false" Type="nvarchar"/>
  </EntityType>

  <EntityType Name="Parameter">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar"/>
    <Property Name="ParentId" Nullable="false" Type="nvarchar"/>
    <Property Name="Name" Nullable="false" Type="nvarchar" />
    <Property Name="Ordinal" Nullable="false" Type="int"/>
    <Property Name="TypeName" Nullable="false" Type="nvarchar" />
    <Property Name="MaxLength" Nullable="true" Type="int" />
    <Property Name="Precision" Nullable="true" Type="int" />
    <Property Name="DateTimePrecision" Type="int" />
    <Property Name="Scale" Nullable="true" Type="int" />
    <Property Name="CollationCatalog" Type="nvarchar" />
    <Property Name="CollationSchema" Type="nvarchar" />
    <Property Name="CollationName" Type="nvarchar" />
    <Property Name="CharacterSetCatalog" Type="nvarchar" />
    <Property Name="CharacterSetSchema" Type="nvarchar" />
    <Property Name="CharacterSetName" Type="nvarchar" />
    <Property Name="IsMultiSet" Nullable="false" Type="bit" />
    <Property Name="Mode" Type="nvarchar" />
    <Property Name="Default" Type="nvarchar" />
  </EntityType>

  <EntityType Name="Constraint">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="ParentId" Nullable="false" Type="nvarchar" />
    <Property Name="Name" Nullable="false" Type="nvarchar" />
    <Property Name="IsDeferrable" Nullable="false" Type="bit" />
    <Property Name="IsInitiallyDeferred" Nullable="false" Type="bit" />
    <Property Name="ConstraintType" Nullable="false" Type="nvarchar" />
  </EntityType>

  <EntityType Name="CheckConstraint">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="Expression" Nullable="true" Type="nvarchar" />
  </EntityType>
  
  <EntityType Name="ConstraintColumn">
    <Key>
      <PropertyRef Name="ConstraintId" />
      <PropertyRef Name="ColumnId" />
    </Key>
    <Property Name="ConstraintId" Nullable="false" Type="nvarchar" />
    <Property Name="ColumnId" Nullable="false" Type="nvarchar" />
  </EntityType>

  <EntityType Name="ForeignKeyConstraint">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="UpdateRule" Nullable="false" Type="nvarchar" />
    <Property Name="DeleteRule" Nullable="false" Type="nvarchar" />
  </EntityType>

  <EntityType Name="ForeignKey">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="Ordinal" Nullable="false" Type="int" />
    <Property Name="ConstraintId" Nullable="false" Type="nvarchar" />
    <Property Name="FromColumnId" Nullable="false" Type="nvarchar" />
    <Property Name="ToColumnId" Nullable="false" Type="nvarchar" />
  </EntityType>

  <EntityType Name="ViewConstraint">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Nullable="false" Type="nvarchar" />
    <Property Name="ParentId" Nullable="false" Type="nvarchar" />
    <Property Name="Name" Nullable="false" Type="nvarchar" />
    <Property Name="IsDeferrable" Nullable="false" Type="bit" />
    <Property Name="IsInitiallyDeferred" Nullable="false" Type="bit" />
    <Property Name="ConstraintType" Nullable="false" Type="nvarchar" />
    <Property Name="Expression" Nullable="true" Type="nvarchar" />
    <Property Name="UpdateRule" Nullable="true" Type="nvarchar" />
    <Property Name="DeleteRule" Nullable="true" Type="nvarchar" />
  </EntityType>

  <Association Name="TableTableConstraint">
    <End Type="Self.Table" Role="Parent" Multiplicity="1" />
    <End Type="Self.Constraint" Role="Constraint" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Parent">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="Constraint">
        <PropertyRef Name="ParentId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ConstraintConstraintColumn">
    <End Type="Self.Constraint" Role="Constraint" Multiplicity="1" />
    <End Type="Self.ConstraintColumn" Role="ConstraintColumn" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Constraint">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ConstraintColumn">
        <PropertyRef Name="ConstraintId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ConstraintForeignKey">
    <End Type="Self.ForeignKeyConstraint" Role="Constraint" Multiplicity="1" />
    <End Type="Self.ForeignKey" Role="ForeignKey" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Constraint">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ForeignKey">
        <PropertyRef Name="ConstraintId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="FromForeignKeyColumn">
    <End Type="Self.TableColumn" Role="Column" Multiplicity="1" />
    <End Type="Self.ForeignKey" Role="ForeignKey" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Column">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ForeignKey">
        <PropertyRef Name="FromColumnId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ToForeignKeyColumn">
    <End Type="Self.TableColumn" Role="Column" Multiplicity="1" />
    <End Type="Self.ForeignKey" Role="ForeignKey" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Column">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ForeignKey">
        <PropertyRef Name="ToColumnId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="TableTableColumn">
    <End Type="Self.Table" Role="Parent" Multiplicity="1" />
    <End Type="Self.TableColumn" Role="Column" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Parent">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="Column">
        <PropertyRef Name="ParentId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ViewViewColumn">
    <End Type="Self.View" Role="Parent" Multiplicity="1" />
    <End Type="Self.ViewColumn" Role="Column" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Parent">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="Column">
        <PropertyRef Name="ParentId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="FunctionFunctionParameter">
    <End Type="Self.Function" Role="Function" Multiplicity="1" />
    <End Type="Self.Parameter" Role="Parameter" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Function">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="Parameter">
        <PropertyRef Name="ParentId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ProcedureProcedureParameter">
    <End Type="Self.Procedure" Role="Procedure" Multiplicity="1" />
    <End Type="Self.Parameter" Role="Parameter" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Procedure">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="Parameter">
        <PropertyRef Name="ParentId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ViewViewConstraint">
    <End Type="Self.View" Role="Parent" Multiplicity="1" />
    <End Type="Self.ViewConstraint" Role="Constraint" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Parent">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="Constraint">
        <PropertyRef Name="ParentId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ViewConstraintConstraintColumn">
    <End Type="Self.ViewConstraint" Role="Constraint" Multiplicity="1" />
    <End Type="Self.ConstraintColumn" Role="ConstraintColumn" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Constraint">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ConstraintColumn">
        <PropertyRef Name="ConstraintId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ViewConstraintForeignKey">
    <End Type="Self.ViewConstraint" Role="Constraint" Multiplicity="1" />
    <End Type="Self.ForeignKey" Role="ForeignKey" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Constraint">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ForeignKey">
        <PropertyRef Name="ConstraintId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="FromForeignKeyViewColumn">
    <End Type="Self.ViewColumn" Role="Column" Multiplicity="1" />
    <End Type="Self.ForeignKey" Role="ForeignKey" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Column">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ForeignKey">
        <PropertyRef Name="FromColumnId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

  <Association Name="ToForeignKeyViewColumn">
    <End Type="Self.ViewColumn" Role="Column" Multiplicity="1" />
    <End Type="Self.ForeignKey" Role="ForeignKey" Multiplicity="*" />
    <ReferentialConstraint>
      <Principal Role="Column">
        <PropertyRef Name="Id" />
      </Principal>
      <Dependent Role="ForeignKey">
        <PropertyRef Name="ToColumnId" />
      </Dependent>
    </ReferentialConstraint>
  </Association>

</Schema>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Changes to System.Data.SQLite.Linq/Resources/SQLiteProviderServices.StoreSchemaMapping.msl.

Deleted System.Data.SQLite.Linq/SQL.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
//---------------------------------------------------------------------
// <copyright file="SqlSelectStatement.cs" company="Microsoft">
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>
//---------------------------------------------------------------------

namespace System.Data.SQLite
{
  using System;
  using System.Collections.Generic;
  using System.Diagnostics;
  using System.IO;
  using System.Text;
  using System.Data.Metadata.Edm;
  using System.Data.Common.CommandTrees;

  /// <summary>
  /// A SqlSelectStatement represents a canonical SQL SELECT statement.
  /// It has fields for the 6 main clauses
  /// <list type="number">
  /// <item>SELECT</item>
  /// <item>FROM</item>
  /// <item>WHERE</item>
  /// <item>GROUP BY</item>
  /// <item>ORDER BY</item>
  /// <item>LIMIT</item>
  /// </list>
  /// We do not have HAVING, since it does not correspond to anything in the DbCommandTree.
  /// Each of the fields is a SqlBuilder, so we can keep appending SQL strings
  /// or other fragments to build up the clause.
  ///
  /// We have a IsDistinct property to indicate that we want distict columns.
  /// This is given out of band, since the input expression to the select clause
  /// may already have some columns projected out, and we use append-only SqlBuilders.
  /// The DISTINCT is inserted when we finally write the object into a string.
  /// 
  /// Also, we have a Top property, which is non-null if the number of results should
  /// be limited to certain number. It is given out of band for the same reasons as DISTINCT.
  ///
  /// The FromExtents contains the list of inputs in use for the select statement.
  /// There is usually just one element in this - Select statements for joins may
  /// temporarily have more than one.
  ///
  /// If the select statement is created by a Join node, we maintain a list of
  /// all the extents that have been flattened in the join in AllJoinExtents
  /// <example>
  /// in J(j1= J(a,b), c)
  /// FromExtents has 2 nodes JoinSymbol(name=j1, ...) and Symbol(name=c)
  /// AllJoinExtents has 3 nodes Symbol(name=a), Symbol(name=b), Symbol(name=c)
  /// </example>
  ///
  /// If any expression in the non-FROM clause refers to an extent in a higher scope,
  /// we add that extent to the OuterExtents list.  This list denotes the list
  /// of extent aliases that may collide with the aliases used in this select statement.
  /// It is set by <see cref="SqlGenerator.Visit(DbVariableReferenceExpression)"/>.
  /// An extent is an outer extent if it is not one of the FromExtents.
  ///
  ///
  /// </summary>
  internal sealed class SqlSelectStatement : ISqlFragment
  {
    private bool isDistinct;

    /// <summary>
    /// Do we need to add a DISTINCT at the beginning of the SELECT
    /// </summary>
    internal bool IsDistinct
    {
      get { return isDistinct; }
      set { isDistinct = value; }
    }

    private List<Symbol> allJoinExtents;
    internal List<Symbol> AllJoinExtents
    {
      get { return allJoinExtents; }
      // We have a setter as well, even though this is a list,
      // since we use this field only in special cases.
      set { allJoinExtents = value; }
    }

    private List<Symbol> fromExtents;
    internal List<Symbol> FromExtents
    {
      get
      {
        if (null == fromExtents)
        {
          fromExtents = new List<Symbol>();
        }
        return fromExtents;
      }
    }

    private Dictionary<Symbol, bool> outerExtents;
    internal Dictionary<Symbol, bool> OuterExtents
    {
      get
      {
        if (null == outerExtents)
        {
          outerExtents = new Dictionary<Symbol, bool>();
        }
        return outerExtents;
      }
    }

    private TopClause top;
    internal TopClause Top
    {
      get { return top; }
      set
      {
        Debug.Assert(top == null, "SqlSelectStatement.Top has already been set");
        top = value;
      }
    }

    private SqlBuilder select = new SqlBuilder();
    internal SqlBuilder Select
    {
      get { return select; }
    }

    private SqlBuilder from = new SqlBuilder();
    internal SqlBuilder From
    {
      get { return from; }
    }


    private SqlBuilder where;
    internal SqlBuilder Where
    {
      get
      {
        if (null == where)
        {
          where = new SqlBuilder();
        }
        return where;
      }
    }

    private SqlBuilder groupBy;
    internal SqlBuilder GroupBy
    {
      get
      {
        if (null == groupBy)
        {
          groupBy = new SqlBuilder();
        }
        return groupBy;
      }
    }

    private SqlBuilder orderBy;
    public SqlBuilder OrderBy
    {
      get
      {
        if (null == orderBy)
        {
          orderBy = new SqlBuilder();
        }
        return orderBy;
      }
    }

    private string limit;
    public string Limit
    {
      get
      {
        return limit;
      }

      set
      {
        limit = value;
      }
    }

    private string offset;
    public string OffSet
    {
      get
      { return offset; }
      set
      { offset = value; }
    }

    //indicates whether it is the top most select statement, 
    // if not Order By should be omitted unless there is a corresponding TOP
    private bool isTopMost;
    internal bool IsTopMost
    {
      get { return this.isTopMost; }
      set { this.isTopMost = value; }
    }

    #region ISqlFragment Members

    /// <summary>
    /// Write out a SQL select statement as a string.
    /// We have to
    /// <list type="number">
    /// <item>Check whether the aliases extents we use in this statement have
    /// to be renamed.
    /// We first create a list of all the aliases used by the outer extents.
    /// For each of the FromExtents( or AllJoinExtents if it is non-null),
    /// rename it if it collides with the previous list.
    /// </item>
    /// <item>Write each of the clauses (if it exists) as a string</item>
    /// </list>
    /// </summary>
    /// <param name="writer"></param>
    /// <param name="sqlGenerator"></param>
    public void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator)
    {
      #region Check if FROM aliases need to be renamed

      // Create a list of the aliases used by the outer extents
      // JoinSymbols have to be treated specially.
      List<string> outerExtentAliases = null;
      if ((null != outerExtents) && (0 < outerExtents.Count))
      {
        foreach (Symbol outerExtent in outerExtents.Keys)
        {
          JoinSymbol joinSymbol = outerExtent as JoinSymbol;
          if (joinSymbol != null)
          {
            foreach (Symbol symbol in joinSymbol.FlattenedExtentList)
            {
              if (null == outerExtentAliases) { outerExtentAliases = new List<string>(); }
              outerExtentAliases.Add(symbol.NewName);
            }
          }
          else
          {
            if (null == outerExtentAliases) { outerExtentAliases = new List<string>(); }
            outerExtentAliases.Add(outerExtent.NewName);
          }
        }
      }

      // An then rename each of the FromExtents we have
      // If AllJoinExtents is non-null - it has precedence.
      // The new name is derived from the old name - we append an increasing int.
      List<Symbol> extentList = this.AllJoinExtents ?? this.fromExtents;
      if (null != extentList)
      {
        foreach (Symbol fromAlias in extentList)
        {
          if ((null != outerExtentAliases) && outerExtentAliases.Contains(fromAlias.Name))
          {
            int i = sqlGenerator.AllExtentNames[fromAlias.Name];
            string newName;
            do
            {
              ++i;
              newName = fromAlias.Name + i.ToString(System.Globalization.CultureInfo.InvariantCulture);
            }
            while (sqlGenerator.AllExtentNames.ContainsKey(newName));
            sqlGenerator.AllExtentNames[fromAlias.Name] = i;
            fromAlias.NewName = newName;

            // Add extent to list of known names (although i is always incrementing, "prefix11" can
            // eventually collide with "prefix1" when it is extended)
            sqlGenerator.AllExtentNames[newName] = 0;
          }

          // Add the current alias to the list, so that the extents
          // that follow do not collide with me.
          if (null == outerExtentAliases) { outerExtentAliases = new List<string>(); }
          outerExtentAliases.Add(fromAlias.NewName);
        }
      }
      #endregion

      // Increase the indent, so that the Sql statement is nested by one tab.
      writer.Indent += 1; // ++ can be confusing in this context

      writer.Write("SELECT ");
      if (IsDistinct)
      {
        writer.Write("DISTINCT ");
      }

      if ((null == this.select) || this.Select.IsEmpty)
      {
        Debug.Assert(false);  // we have removed all possibilities of SELECT *.
        writer.Write("*");
      }
      else
      {
        this.Select.WriteSql(writer, sqlGenerator);
      }

      writer.WriteLine();
      writer.Write("FROM ");
      this.From.WriteSql(writer, sqlGenerator);

      if ((null != this.where) && !this.Where.IsEmpty)
      {
        writer.WriteLine();
        writer.Write("WHERE ");
        this.Where.WriteSql(writer, sqlGenerator);
      }

      if ((null != this.groupBy) && !this.GroupBy.IsEmpty)
      {
        writer.WriteLine();
        writer.Write("GROUP BY ");
        this.GroupBy.WriteSql(writer, sqlGenerator);
      }

      if ((null != this.orderBy) && !this.OrderBy.IsEmpty && (this.IsTopMost || this.Top != null))
      {
        writer.WriteLine();
        writer.Write("ORDER BY ");
        this.OrderBy.WriteSql(writer, sqlGenerator);
      }

      if ((null != this.limit) && this.limit.Length != 0) //&& (this.IsTopMost || this.Top != null))
      {
        writer.WriteLine();
        writer.Write(string.Format("LIMIT {0} ", limit));
      }

      if ((null != this.offset) && this.offset.Length != 0)// && (this.IsTopMost || this.Top != null))
      {

        if (this.limit != null && this.limit.Length != 0)
          writer.Write(string.Format("OFFSET {0} ", offset));
        else
        {
          writer.WriteLine();
          writer.Write(string.Format("LIMIT 8999999999999999999 OFFSET {0} ", offset));
        }

      }

      if (this.Top != null)
      {
        this.Top.WriteSql(writer, sqlGenerator);
      }


      --writer.Indent;
    }

    #endregion
  }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































































































































































































































































































































































































































































































































































































































Added System.Data.SQLite.Linq/SQL Generation/DmlSqlGenerator.cs.



























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
//---------------------------------------------------------------------
// <copyright file="DmlSqlGenerator.cs" company="Microsoft">
//      Portions of this file copyright (c) Microsoft Corporation
//      and are released under the Microsoft Pulic License.  See
//      http://archive.msdn.microsoft.com/EFSampleProvider/Project/License.aspx
//      or License.txt for details.
//      All rights reserved.
// </copyright>
//---------------------------------------------------------------------

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
  using System;
  using System.Collections.Generic;
  using System.Diagnostics;
  using System.Globalization;
  using System.Text;
  using System.Data;
  using System.Data.Common;

#if USE_ENTITY_FRAMEWORK_6
  using System.Data.Entity.Core.Metadata.Edm;
  using System.Data.Entity.Core.Common.CommandTrees;
#else
  using System.Data.Metadata.Edm;
  using System.Data.Common.CommandTrees;
#endif

    /// <summary>
  /// Class generating SQL for a DML command tree.
  /// </summary>
  internal static class DmlSqlGenerator
  {
    private static readonly int s_commandTextBuilderInitialCapacity = 256;

    internal static string GenerateUpdateSql(DbUpdateCommandTree tree, out List<DbParameter> parameters)
    {
      StringBuilder commandText = new StringBuilder(s_commandTextBuilderInitialCapacity);
      ExpressionTranslator translator = new ExpressionTranslator(commandText, tree, null != tree.Returning, "UpdateFunction");

      // update [schemaName].[tableName]
      commandText.Append("UPDATE ");
      tree.Target.Expression.Accept(translator);
      commandText.AppendLine();

      // set c1 = ..., c2 = ..., ...
      bool first = true;
      commandText.Append("SET ");
      foreach (DbSetClause setClause in tree.SetClauses)
      {
        if (first) { first = false; }
        else { commandText.Append(", "); }
        setClause.Property.Accept(translator);
        commandText.Append(" = ");
        setClause.Value.Accept(translator);
      }

      if (first)
      {
        // If first is still true, it indicates there were no set
        // clauses. Introduce a fake set clause so that:
        // - we acquire the appropriate locks
        // - server-gen columns (e.g. timestamp) get recomputed
        //
        // We use the following pattern:
        //
        //  update Foo
        //  set @i = 0
        //  where ...
        DbParameter parameter = translator.CreateParameter(default(Int32), DbType.Int32);
        commandText.Append(parameter.ParameterName);
        commandText.Append(" = 0");
      }
      commandText.AppendLine();

      // where c1 = ..., c2 = ...
      commandText.Append("WHERE ");
      tree.Predicate.Accept(translator);
      commandText.AppendLine(";");

      // generate returning sql
      GenerateReturningSql(commandText, tree, translator, tree.Returning, false);

      parameters = translator.Parameters;
      return commandText.ToString();
    }

    internal static string GenerateDeleteSql(DbDeleteCommandTree tree, out List<DbParameter> parameters)
    {
      StringBuilder commandText = new StringBuilder(s_commandTextBuilderInitialCapacity);
      ExpressionTranslator translator = new ExpressionTranslator(commandText, tree, false, "DeleteFunction");

      // delete [schemaName].[tableName]
      commandText.Append("DELETE FROM ");
      tree.Target.Expression.Accept(translator);
      commandText.AppendLine();

      // where c1 = ... AND c2 = ...
      commandText.Append("WHERE ");
      tree.Predicate.Accept(translator);

      parameters = translator.Parameters;

      commandText.AppendLine(";");
      return commandText.ToString();
    }

    internal static string GenerateInsertSql(DbInsertCommandTree tree, out List<DbParameter> parameters)
    {
      StringBuilder commandText = new StringBuilder(s_commandTextBuilderInitialCapacity);
      ExpressionTranslator translator = new ExpressionTranslator(commandText, tree, null != tree.Returning, "InsertFunction");

      // insert [schemaName].[tableName]
      commandText.Append("INSERT INTO ");
      tree.Target.Expression.Accept(translator);

      if (tree.SetClauses.Count > 0)
      {
        // (c1, c2, c3, ...)
        commandText.Append("(");
        bool first = true;
        foreach (DbSetClause setClause in tree.SetClauses)
        {
          if (first) { first = false; }
          else { commandText.Append(", "); }
          setClause.Property.Accept(translator);
        }
        commandText.AppendLine(")");

        // values c1, c2, ...
        first = true;
        commandText.Append(" VALUES (");
        foreach (DbSetClause setClause in tree.SetClauses)
        {
          if (first) { first = false; }
          else { commandText.Append(", "); }
          setClause.Value.Accept(translator);

          translator.RegisterMemberValue(setClause.Property, setClause.Value);
        }
        commandText.AppendLine(");");
      }
      else // No columns specified.  Insert an empty row containing default values by inserting null into the rowid
      {
        commandText.AppendLine(" DEFAULT VALUES;");
      }

      // generate returning sql
      GenerateReturningSql(commandText, tree, translator, tree.Returning, true);

      parameters = translator.Parameters;
      return commandText.ToString();
    }

    // Generates T-SQL describing a member
    // Requires: member must belong to an entity type (a safe requirement for DML
    // SQL gen, where we only access table columns)
    private static string GenerateMemberTSql(EdmMember member)
    {
      return SqlGenerator.QuoteIdentifier(member.Name);
    }

    /// <summary>
    /// This method attempts to determine if the specified table has an integer
    /// primary key (i.e. "rowid").  If so, it sets the
    /// <paramref name="primaryKeyMember" /> parameter to the right
    /// <see cref="EdmMember" />; otherwise, the
    /// <paramref name="primaryKeyMember" /> parameter is set to null.
    /// </summary>
    /// <param name="table">The table to check.</param>
    /// <param name="keyMembers">
    /// The collection of key members.  An attempt is always made to set this
    /// parameter to a valid value.
    /// </param>
    /// <param name="primaryKeyMember">
    /// The <see cref="EdmMember" /> that represents the integer primary key
    /// -OR- null if no such <see cref="EdmMember" /> exists.
    /// </param>
    /// <returns>
    /// Non-zero if the specified table has an integer primary key.
    /// </returns>
    private static bool IsIntegerPrimaryKey(
        EntitySetBase table,
        out ReadOnlyMetadataCollection<EdmMember> keyMembers,
        out EdmMember primaryKeyMember
        )
    {
        keyMembers = table.ElementType.KeyMembers;

        if (keyMembers.Count == 1) /* NOTE: The "rowid" only? */
        {
            EdmMember keyMember = keyMembers[0];
            PrimitiveTypeKind typeKind;

            if (MetadataHelpers.TryGetPrimitiveTypeKind(
                    keyMember.TypeUsage, out typeKind) &&
                (typeKind == PrimitiveTypeKind.Int64))
            {
                primaryKeyMember = keyMember;
                return true;
            }
        }

        primaryKeyMember = null;
        return false;
    }

    /// <summary>
    /// This method attempts to determine if all the specified key members have
    /// values available.
    /// </summary>
    /// <param name="translator">
    /// The <see cref="ExpressionTranslator" /> to use.
    /// </param>
    /// <param name="keyMembers">
    /// The collection of key members to check.
    /// </param>
    /// <param name="missingKeyMember">
    /// The first missing key member that is found.  This is only set to a valid
    /// value if the method is returning false.
    /// </param>
    /// <returns>
    /// Non-zero if all key members have values; otherwise, zero.
    /// </returns>
    private static bool DoAllKeyMembersHaveValues(
        ExpressionTranslator translator,
        ReadOnlyMetadataCollection<EdmMember> keyMembers,
        out EdmMember missingKeyMember
        )
    {
        foreach (EdmMember keyMember in keyMembers)
        {
            if (!translator.MemberValues.ContainsKey(keyMember))
            {
                missingKeyMember = keyMember;
                return false;
            }
        }

        missingKeyMember = null;
        return true;
    }

    /// <summary>
    /// Generates SQL fragment returning server-generated values.
    /// Requires: translator knows about member values so that we can figure out
    /// how to construct the key predicate.
    /// <code>
    /// Sample SQL:
    ///     
    ///     select IdentityValue
    ///     from dbo.MyTable
    ///     where @@ROWCOUNT > 0 and IdentityValue = scope_identity()
    /// 
    /// or
    /// 
    ///     select TimestamptValue
    ///     from dbo.MyTable
    ///     where @@ROWCOUNT > 0 and Id = 1
    /// 
    /// Note that we filter on rowcount to ensure no rows are returned if no rows were modified.
    /// </code>
    /// </summary>
    /// <param name="commandText">Builder containing command text</param>
    /// <param name="tree">Modification command tree</param>
    /// <param name="translator">Translator used to produce DML SQL statement
    /// for the tree</param>
    /// <param name="returning">Returning expression. If null, the method returns
    /// immediately without producing a SELECT statement.</param>
    /// <param name="wasInsert">
    /// Non-zero if this method is being called as part of processing an INSERT;
    /// otherwise (e.g. UPDATE), zero.
    /// </param>
    private static void GenerateReturningSql(StringBuilder commandText, DbModificationCommandTree tree,
        ExpressionTranslator translator, DbExpression returning, bool wasInsert)
    {
      // Nothing to do if there is no Returning expression
      if (null == returning) { return; }

      // select
      commandText.Append("SELECT ");
      returning.Accept(translator);
      commandText.AppendLine();

      // from
      commandText.Append("FROM ");
      tree.Target.Expression.Accept(translator);
      commandText.AppendLine();

      // where
#if USE_INTEROP_DLL && INTEROP_EXTENSION_FUNCTIONS
      commandText.Append("WHERE last_rows_affected() > 0");
#else
      commandText.Append("WHERE changes() > 0");
#endif

      EntitySetBase table = ((DbScanExpression)tree.Target.Expression).Target;
      ReadOnlyMetadataCollection<EdmMember> keyMembers;
      EdmMember primaryKeyMember;
      EdmMember missingKeyMember;

      // Model Types can be (at the time of this implementation):
      //      Binary, Boolean, Byte, DateTime, Decimal, Double, Guid, Int16,
      //      Int32, Int64,Single, String
      if (IsIntegerPrimaryKey(table, out keyMembers, out primaryKeyMember))
      {
          //
          // NOTE: This must be an INTEGER PRIMARY KEY (i.e. "rowid") table.
          //
          commandText.Append(" AND ");
          commandText.Append(GenerateMemberTSql(primaryKeyMember));
          commandText.Append(" = ");

          DbParameter value;

          if (translator.MemberValues.TryGetValue(primaryKeyMember, out value))
          {
              //
              // NOTE: Use the integer primary key value that was specified as
              //       part the associated INSERT/UPDATE statement.
              //
              commandText.Append(value.ParameterName);
          }
          else if (wasInsert)
          {
              //
              // NOTE: This was part of an INSERT statement and we know the table
              //       has an integer primary key.  This should not fail unless
              //       something (e.g. a trigger) causes the last_insert_rowid()
              //       function to return an incorrect result.
              //
              commandText.AppendLine("last_insert_rowid()");
          }
          else /* NOT-REACHED? */
          {
              //
              // NOTE: We cannot simply use the "rowid" at this point because:
              //
              //       1. The last_insert_rowid() function is only valid after
              //          an INSERT and this was an UPDATE.
              //
              throw new NotSupportedException(String.Format(
                  "Missing value for INSERT key member '{0}' in table '{1}'.",
                   (primaryKeyMember != null) ? primaryKeyMember.Name : "<unknown>",
                   table.Name));
          }
      }
      else if (DoAllKeyMembersHaveValues(translator, keyMembers, out missingKeyMember))
      {
          foreach (EdmMember keyMember in keyMembers)
          {
              commandText.Append(" AND ");
              commandText.Append(GenerateMemberTSql(keyMember));
              commandText.Append(" = ");

              // Retrieve member value SQL. the translator remembers member values
              // as it constructs the DML statement (which precedes the "returning"
              // SQL).
              DbParameter value;

              if (translator.MemberValues.TryGetValue(keyMember, out value))
              {
                  //
                  // NOTE: Use the primary key value that was specified as part the
                  //       associated INSERT/UPDATE statement.  This also applies
                  //       to composite primary keys.
                  //
                  commandText.Append(value.ParameterName);
              }
              else /* NOT-REACHED? */
              {
                  //
                  // NOTE: We cannot simply use the "rowid" at this point because:
                  //
                  //       1. This associated INSERT/UPDATE statement appeared to
                  //          have all the key members availab;e however, there
                  //          appears to be an inconsistency.  This is an internal
                  //          error and should be thrown.
                  //
                  throw new NotSupportedException(String.Format(
                      "Missing value for {0} key member '{1}' in table '{2}' " +
                      "(internal).", wasInsert ? "INSERT" : "UPDATE",
                      (keyMember != null) ? keyMember.Name : "<unknown>",
                      table.Name));
              }
          }
      }
      else if (wasInsert) /* NOT-REACHED? */
      {
          //
          // NOTE: This was part of an INSERT statement; try using the "rowid"
          //       column to fetch the most recently inserted row.  This may
          //       still fail if the table is a WITHOUT ROWID table -OR-
          //       something (e.g. a trigger) causes the last_insert_rowid()
          //       function to return an incorrect result.
          //
          commandText.Append(" AND ");
          commandText.Append(SqlGenerator.QuoteIdentifier("rowid"));
          commandText.Append(" = ");
          commandText.AppendLine("last_insert_rowid()");
      }
      else /* NOT-REACHED? */
      {
          //
          // NOTE: We cannot simply use the "rowid" at this point because:
          //
          //       1. The last_insert_rowid() function is only valid after
          //          an INSERT and this was an UPDATE.
          //
          throw new NotSupportedException(String.Format(
              "Missing value for UPDATE key member '{0}' in table '{1}'.",
               (missingKeyMember != null) ? missingKeyMember.Name : "<unknown>",
               table.Name));
      }
      commandText.AppendLine(";");
    }

    /// <summary>
    /// Lightweight expression translator for DML expression trees, which have constrained
    /// scope and support.
    /// </summary>
    private class ExpressionTranslator : DbExpressionVisitor
    {
      /// <summary>
      /// Initialize a new expression translator populating the given string builder
      /// with command text. Command text builder and command tree must not be null.
      /// </summary>
      /// <param name="commandText">Command text with which to populate commands</param>
      /// <param name="commandTree">Command tree generating SQL</param>
      /// <param name="preserveMemberValues">Indicates whether the translator should preserve
      /// member values while compiling t-SQL (only needed for server generation)</param>
      /// <param name="kind"></param>
      internal ExpressionTranslator(StringBuilder commandText, DbModificationCommandTree commandTree,
          bool preserveMemberValues, string kind)
      {
        Debug.Assert(null != commandText);
        Debug.Assert(null != commandTree);
        _kind = kind;
        _commandText = commandText;
        _commandTree = commandTree;
        _parameters = new List<DbParameter>();
        _memberValues = preserveMemberValues ? new Dictionary<EdmMember, DbParameter>() :
            null;
      }

      private readonly StringBuilder _commandText;
      private readonly DbModificationCommandTree _commandTree;
      private readonly List<DbParameter> _parameters;
      private readonly Dictionary<EdmMember, DbParameter> _memberValues;
      private int parameterNameCount = 0;
      private string _kind;

      internal List<DbParameter> Parameters { get { return _parameters; } }
      internal Dictionary<EdmMember, DbParameter> MemberValues { get { return _memberValues; } }

      // generate parameter (name based on parameter ordinal)
      internal SQLiteParameter CreateParameter(object value, TypeUsage type)
      {
        PrimitiveTypeKind primitiveType = MetadataHelpers.GetPrimitiveTypeKind(type);
        DbType dbType = MetadataHelpers.GetDbType(primitiveType);
        return CreateParameter(value, dbType);
      }

      // Creates a new parameter for a value in this expression translator
      internal SQLiteParameter CreateParameter(object value, DbType dbType)
      {
        string parameterName = string.Concat("@p", parameterNameCount.ToString(CultureInfo.InvariantCulture));
        parameterNameCount++;
        SQLiteParameter parameter = new SQLiteParameter(parameterName, value);
        parameter.DbType = dbType;
        _parameters.Add(parameter);
        return parameter;
      }

      #region Basics

      public override void Visit(DbApplyExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");

        VisitExpressionBindingPre(expression.Input);
        if (expression.Apply != null)
        {
          VisitExpression(expression.Apply.Expression);
        }
        VisitExpressionBindingPost(expression.Input);
      }

      public override void Visit(DbArithmeticExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
        VisitExpressionList(expression.Arguments);
      }

      public override void Visit(DbCaseExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
        VisitExpressionList(expression.When);
        VisitExpressionList(expression.Then);
        VisitExpression(expression.Else);
      }

      public override void Visit(DbCastExpression expression)
      {
        VisitUnaryExpression(expression);
      }

      public override void Visit(DbCrossJoinExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
        foreach (DbExpressionBinding binding in expression.Inputs)
        {
          VisitExpressionBindingPre(binding);
        }
        foreach (DbExpressionBinding binding2 in expression.Inputs)
        {
          VisitExpressionBindingPost(binding2);
        }
      }

      public override void Visit(DbDerefExpression expression)
      {
        VisitUnaryExpression(expression);
      }

      public override void Visit(DbDistinctExpression expression)
      {
        VisitUnaryExpression(expression);
      }

      public override void Visit(DbElementExpression expression)
      {
        VisitUnaryExpression(expression);
      }

      public override void Visit(DbEntityRefExpression expression)
      {
        VisitUnaryExpression(expression);
      }

      public override void Visit(DbExceptExpression expression)
      {
        VisitBinary(expression);
      }

      protected virtual void VisitBinary(DbBinaryExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
        this.VisitExpression(expression.Left);
        this.VisitExpression(expression.Right);
      }

      public override void Visit(DbExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
        throw new NotSupportedException("DbExpression");
      }

      public override void Visit(DbFilterExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
        VisitExpressionBindingPre(expression.Input);
        VisitExpression(expression.Predicate);
        VisitExpressionBindingPost(expression.Input);
      }

      public override void Visit(DbFunctionExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
        VisitExpressionList(expression.Arguments);
        //if (expression.IsLambda)
        //{
        //  VisitLambdaFunctionPre(expression.Function, expression.LambdaBody);
        //  VisitExpression(expression.LambdaBody);
        //  VisitLambdaFunctionPost(expression.Function, expression.LambdaBody);
        //}
      }

      public override void Visit(DbGroupByExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
        VisitGroupExpressionBindingPre(expression.Input);
        VisitExpressionList(expression.Keys);
        VisitGroupExpressionBindingMid(expression.Input);
        VisitAggregateList(expression.Aggregates);
        VisitGroupExpressionBindingPost(expression.Input);
      }

      public override void Visit(DbIntersectExpression expression)
      {
        VisitBinary(expression);
      }

      public override void Visit(DbIsEmptyExpression expression)
      {
        VisitUnaryExpression(expression);
      }

      public override void Visit(DbIsOfExpression expression)
      {
        VisitUnaryExpression(expression);
      }

      public override void Visit(DbJoinExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
        VisitExpressionBindingPre(expression.Left);
        VisitExpressionBindingPre(expression.Right);
        VisitExpression(expression.JoinCondition);
        VisitExpressionBindingPost(expression.Left);
        VisitExpressionBindingPost(expression.Right);
      }

      public override void Visit(DbLikeExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
        VisitExpression(expression.Argument);
        VisitExpression(expression.Pattern);
        VisitExpression(expression.Escape);
      }

      public override void Visit(DbLimitExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
        VisitExpression(expression.Argument);
        VisitExpression(expression.Limit);
      }

      public override void Visit(DbOfTypeExpression expression)
      {
        VisitUnaryExpression(expression);
      }

      public override void Visit(DbParameterReferenceExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
      }

      public override void Visit(DbProjectExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
        VisitExpressionBindingPre(expression.Input);
        VisitExpression(expression.Projection);
        VisitExpressionBindingPost(expression.Input);
      }

      public override void Visit(DbQuantifierExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
        VisitExpressionBindingPre(expression.Input);
        VisitExpression(expression.Predicate);
        VisitExpressionBindingPost(expression.Input);
      }

      public override void Visit(DbRefExpression expression)
      {
        VisitUnaryExpression(expression);
      }

      public override void Visit(DbRefKeyExpression expression)
      {
        VisitUnaryExpression(expression);
      }

      public override void Visit(DbRelationshipNavigationExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
        VisitExpression(expression.NavigationSource);
      }

      public override void Visit(DbSkipExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
        VisitExpressionBindingPre(expression.Input);
        foreach (DbSortClause clause in expression.SortOrder)
        {
          VisitExpression(clause.Expression);
        }
        VisitExpressionBindingPost(expression.Input);
        VisitExpression(expression.Count);
      }

      public override void Visit(DbSortExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
        VisitExpressionBindingPre(expression.Input);
        for (int i = 0; i < expression.SortOrder.Count; i++)
        {
          VisitExpression(expression.SortOrder[i].Expression);
        }
        VisitExpressionBindingPost(expression.Input);
      }

      public override void Visit(DbTreatExpression expression)
      {
        VisitUnaryExpression(expression);
      }

      public override void Visit(DbUnionAllExpression expression)
      {
        VisitBinary(expression);
      }

      public override void Visit(DbVariableReferenceExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
      }

      public virtual void VisitAggregate(DbAggregate aggregate)
      {
        if (aggregate == null) throw new ArgumentException("aggregate");
        VisitExpressionList(aggregate.Arguments);
      }

      public virtual void VisitAggregateList(IList<DbAggregate> aggregates)
      {
        if (aggregates == null) throw new ArgumentException("aggregates");
        for (int i = 0; i < aggregates.Count; i++)
        {
          VisitAggregate(aggregates[i]);
        }
      }

      public virtual void VisitExpression(DbExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
        expression.Accept(this);
      }

      protected virtual void VisitExpressionBindingPost(DbExpressionBinding binding)
      {
      }

      protected virtual void VisitExpressionBindingPre(DbExpressionBinding binding)
      {
        if (binding == null) throw new ArgumentException("binding");
        VisitExpression(binding.Expression);
      }

      public virtual void VisitExpressionList(IList<DbExpression> expressionList)
      {
        if (expressionList == null) throw new ArgumentException("expressionList");
        for (int i = 0; i < expressionList.Count; i++)
        {
          VisitExpression(expressionList[i]);
        }
      }

      protected virtual void VisitGroupExpressionBindingMid(DbGroupExpressionBinding binding)
      {
      }

      protected virtual void VisitGroupExpressionBindingPost(DbGroupExpressionBinding binding)
      {
      }

      protected virtual void VisitGroupExpressionBindingPre(DbGroupExpressionBinding binding)
      {
        if (binding == null) throw new ArgumentException("binding");
        VisitExpression(binding.Expression);
      }

      protected virtual void VisitLambdaFunctionPost(EdmFunction function, DbExpression body)
      {
      }

      protected virtual void VisitLambdaFunctionPre(EdmFunction function, DbExpression body)
      {
        if (function == null) throw new ArgumentException("function");
        if (body == null) throw new ArgumentException("body");
      }

      //internal virtual void VisitRelatedEntityReference(DbRelatedEntityRef relatedEntityRef)
      //{
      //  VisitExpression(relatedEntityRef.TargetEntityReference);
      //}

      //internal virtual void VisitRelatedEntityReferenceList(IList<DbRelatedEntityRef> relatedEntityReferences)
      //{
      //  for (int i = 0; i < relatedEntityReferences.Count; i++)
      //  {
      //    VisitRelatedEntityReference(relatedEntityReferences[i]);
      //  }
      //}

      protected virtual void VisitUnaryExpression(DbUnaryExpression expression)
      {
        if (expression == null) throw new ArgumentException("expression");
        VisitExpression(expression.Argument);
      }
      #endregion

      public override void Visit(DbAndExpression expression)
      {
        VisitBinary(expression, " AND ");
      }

      public override void Visit(DbOrExpression expression)
      {
        VisitBinary(expression, " OR ");
      }

      public override void Visit(DbComparisonExpression expression)
      {
        Debug.Assert(expression.ExpressionKind == DbExpressionKind.Equals,
            "only equals comparison expressions are produced in DML command trees in V1");

        VisitBinary(expression, " = ");

        RegisterMemberValue(expression.Left, expression.Right);
      }

      /// <summary>
      /// Call this method to register a property value pair so the translator "remembers"
      /// the values for members of the row being modified. These values can then be used
      /// to form a predicate for server-generation (based on the key of the row)
      /// </summary>
      /// <param name="propertyExpression">DbExpression containing the column reference (property expression).</param>
      /// <param name="value">DbExpression containing the value of the column.</param>
      internal void RegisterMemberValue(DbExpression propertyExpression, DbExpression value)
      {
        if (null != _memberValues)
        {
          // register the value for this property
          Debug.Assert(propertyExpression.ExpressionKind == DbExpressionKind.Property,
              "DML predicates and setters must be of the form property = value");

          // get name of left property 
          EdmMember property = ((DbPropertyExpression)propertyExpression).Property;

          // don't track null values
          if (value.ExpressionKind != DbExpressionKind.Null)
          {
            Debug.Assert(value.ExpressionKind == DbExpressionKind.Constant,
                "value must either constant or null");
            // retrieve the last parameter added (which describes the parameter)
            _memberValues[property] = _parameters[_parameters.Count - 1];
          }
        }
      }

      public override void Visit(DbIsNullExpression expression)
      {
        expression.Argument.Accept(this);
        _commandText.Append(" IS NULL");
      }

      public override void Visit(DbNotExpression expression)
      {
        _commandText.Append("NOT (");
        expression.Accept(this);
        _commandText.Append(")");
      }

      public override void Visit(DbConstantExpression expression)
      {
        SQLiteParameter parameter = CreateParameter(expression.Value, expression.ResultType);
        _commandText.Append(parameter.ParameterName);
      }

      public override void Visit(DbScanExpression expression)
      {
        string definingQuery = MetadataHelpers.TryGetValueForMetadataProperty<string>(expression.Target, "DefiningQuery");
        if (definingQuery != null)
        {
          throw new NotSupportedException(String.Format("Unable to update the EntitySet '{0}' because it has a DefiningQuery and no <{1}> element exists in the <ModificationFunctionMapping> element to support the current operation.", expression.Target.Name, _kind));
        }
        _commandText.Append(SqlGenerator.GetTargetTSql(expression.Target));
      }

      public override void Visit(DbPropertyExpression expression)
      {
        _commandText.Append(GenerateMemberTSql(expression.Property));
      }

      public override void Visit(DbNullExpression expression)
      {
        _commandText.Append("NULL");
      }

      public override void Visit(DbNewInstanceExpression expression)
      {
        // assumes all arguments are self-describing (no need to use aliases
        // because no renames are ever used in the projection)
        bool first = true;
        foreach (DbExpression argument in expression.Arguments)
        {
          if (first) { first = false; }
          else { _commandText.Append(", "); }
          argument.Accept(this);
        }
      }

      private void VisitBinary(DbBinaryExpression expression, string separator)
      {
        _commandText.Append("(");
        expression.Left.Accept(this);
        _commandText.Append(separator);
        expression.Right.Accept(this);
        _commandText.Append(")");
      }
    }
  }
}

Added System.Data.SQLite.Linq/SQL Generation/ISqlFragment.cs.

































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//---------------------------------------------------------------------
// <copyright file="ISqlFragment.cs" company="Microsoft">
//      Portions of this file copyright (c) Microsoft Corporation
//      and are released under the Microsoft Pulic License.  See
//      http://archive.msdn.microsoft.com/EFSampleProvider/Project/License.aspx
//      or License.txt for details.
//      All rights reserved.
// </copyright>
//---------------------------------------------------------------------

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
#if USE_ENTITY_FRAMEWORK_6
  using System.Data.Entity.Core.Common.CommandTrees;
#else
  using System.Data.Common.CommandTrees;
#endif

  /// <summary>
  /// Represents the sql fragment for any node in the query tree.
  /// </summary>
  /// <remarks>
  /// The nodes in a query tree produce various kinds of sql
  /// <list type="bullet">
  /// <item>A select statement.</item>
  /// <item>A reference to an extent. (symbol)</item>
  /// <item>A raw string.</item>
  /// </list>
  /// We have this interface to allow for a common return type for the methods
  /// in the expression visitor <see cref="DbExpressionVisitor{T}"/>
  /// 
  /// At the end of translation, the sql fragments are converted into real strings.
  /// </remarks>
  internal interface ISqlFragment
  {
    /// <summary>
    /// Write the string represented by this fragment into the stream.
    /// </summary>
    /// <param name="writer">The stream that collects the strings.</param>
    /// <param name="sqlGenerator">Context information used for renaming.
    /// The global lists are used to generated new names without collisions.</param>
    void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator);
  }
}

Added System.Data.SQLite.Linq/SQL Generation/InternalBase.cs.











































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System.Text;

#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_20 || NET_STANDARD_21
using System.Runtime;
#endif

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
	internal abstract class InternalBase
	{
		// Methods
#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_20 || NET_STANDARD_21
		[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
#endif
		protected InternalBase()
		{
		}

		internal abstract void ToCompactString(StringBuilder builder);
		internal virtual string ToFullString()
		{
			StringBuilder builder = new StringBuilder();
			this.ToFullString(builder);
			return builder.ToString();
		}

#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_20 || NET_STANDARD_21
		[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
#endif
		internal virtual void ToFullString(StringBuilder builder)
		{
			this.ToCompactString(builder);
		}

		public override string ToString()
		{
			StringBuilder builder = new StringBuilder();
			this.ToCompactString(builder);
			return builder.ToString();
		}
	}
}

Added System.Data.SQLite.Linq/SQL Generation/JoinSymbol.cs.

























































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//---------------------------------------------------------------------
// <copyright file="JoinSymbol.cs" company="Microsoft">
//      Portions of this file copyright (c) Microsoft Corporation
//      and are released under the Microsoft Pulic License.  See
//      http://archive.msdn.microsoft.com/EFSampleProvider/Project/License.aspx
//      or License.txt for details.
//      All rights reserved.
// </copyright>
//---------------------------------------------------------------------

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
  using System;
  using System.Collections.Generic;

#if USE_ENTITY_FRAMEWORK_6
  using System.Data.Entity.Core.Metadata.Edm;
  using System.Data.Entity.Core.Common.CommandTrees;
#else
  using System.Data.Metadata.Edm;
  using System.Data.Common.CommandTrees;
#endif

  /// <summary>
  /// A Join symbol is a special kind of Symbol.
  /// It has to carry additional information
  /// <list type="bullet">
  /// <item>ColumnList for the list of columns in the select clause if this
  /// symbol represents a sql select statement.  This is set by <see cref="SqlGenerator.AddDefaultColumns"/>. </item>
  /// <item>ExtentList is the list of extents in the select clause.</item>
  /// <item>FlattenedExtentList - if the Join has multiple extents flattened at the 
  /// top level, we need this information to ensure that extent aliases are renamed
  /// correctly in <see cref="SqlSelectStatement.WriteSql"/></item>
  /// <item>NameToExtent has all the extents in ExtentList as a dictionary.
  /// This is used by <see cref="SqlGenerator.Visit(DbPropertyExpression)"/> to flatten
  /// record accesses.</item>
  /// <item>IsNestedJoin - is used to determine whether a JoinSymbol is an 
  /// ordinary join symbol, or one that has a corresponding SqlSelectStatement.</item>
  /// </list>
  /// 
  /// All the lists are set exactly once, and then used for lookups/enumerated.
  /// </summary>
  internal sealed class JoinSymbol : Symbol
  {
    private List<Symbol> columnList;
    internal List<Symbol> ColumnList
    {
      get
      {
        if (null == columnList)
        {
          columnList = new List<Symbol>();
        }
        return columnList;
      }
      set { columnList = value; }
    }

    private List<Symbol> extentList;
    internal List<Symbol> ExtentList
    {
      get { return extentList; }
    }

    private List<Symbol> flattenedExtentList;
    internal List<Symbol> FlattenedExtentList
    {
      get
      {
        if (null == flattenedExtentList)
        {
          flattenedExtentList = new List<Symbol>();
        }
        return flattenedExtentList;
      }
      set { flattenedExtentList = value; }
    }

    private Dictionary<string, Symbol> nameToExtent;
    internal Dictionary<string, Symbol> NameToExtent
    {
      get { return nameToExtent; }
    }

    private bool isNestedJoin;
    internal bool IsNestedJoin
    {
      get { return isNestedJoin; }
      set { isNestedJoin = value; }
    }

    public JoinSymbol(string name, TypeUsage type, List<Symbol> extents)
      : base(name, type)
    {
      extentList = new List<Symbol>(extents.Count);
      nameToExtent = new Dictionary<string, Symbol>(extents.Count, StringComparer.OrdinalIgnoreCase);
      foreach (Symbol symbol in extents)
      {
        this.nameToExtent[symbol.Name] = symbol;
        this.ExtentList.Add(symbol);
      }
    }
  }
}

Added System.Data.SQLite.Linq/SQL Generation/KeyToListMap.cs.















































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System.Collections.Generic;
using System.Text;
using System.Collections.ObjectModel;
using System.Collections;

#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_20 || NET_STANDARD_21
using System.Runtime;
#endif

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
	internal sealed class KeyToListMap<TKey, TValue> : InternalBase
	{
		// Fields
		private Dictionary<TKey, List<TValue>> m_map;

		// Methods
		internal KeyToListMap(IEqualityComparer<TKey> comparer)
		{
			this.m_map = new Dictionary<TKey, List<TValue>>(comparer);
		}

		internal void Add(TKey key, TValue value)
		{
			List<TValue> list;
			if (!this.m_map.TryGetValue(key, out list))
			{
				list = new List<TValue>();
				this.m_map[key] = list;
			}
			list.Add(value);
		}

		internal void AddRange(TKey key, IEnumerable<TValue> values)
		{
			foreach (TValue local in values)
			{
				this.Add(key, local);
			}
		}

		internal bool ContainsKey(TKey key)
		{
			return this.m_map.ContainsKey(key);
		}

		internal IEnumerable<TValue> EnumerateValues(TKey key)
		{
			List<TValue> values;
			if (m_map.TryGetValue(key, out values))
			{
				foreach (TValue value in values) { yield return value; }
			}
		}

		internal ReadOnlyCollection<TValue> ListForKey(TKey key)
		{
			return new ReadOnlyCollection<TValue>(this.m_map[key]);
		}

		internal bool RemoveKey(TKey key)
		{
			return this.m_map.Remove(key);
		}

		internal override void ToCompactString(StringBuilder builder)
		{
			foreach (TKey local in this.Keys)
			{
				StringUtil.FormatStringBuilder(builder, "{0}", new object[] { local });
				builder.Append(": ");
				IEnumerable<TValue> list = this.ListForKey(local);
				StringUtil.ToSeparatedString(builder, list, ",", "null");
				builder.Append("; ");
			}
		}

		internal bool TryGetListForKey(TKey key, out ReadOnlyCollection<TValue> valueCollection)
		{
			List<TValue> list;
			valueCollection = null;
			if (this.m_map.TryGetValue(key, out list))
			{
				valueCollection = new ReadOnlyCollection<TValue>(list);
				return true;
			}
			return false;
		}

		// Properties
		internal IEnumerable<TValue> AllValues
		{
			get
			{
				foreach (TKey key in Keys)
				{
					foreach (TValue value in ListForKey(key))
					{
						yield return value;
					}
				}
			}
		}

		internal IEnumerable<TKey> Keys
		{
			get
			{
				return this.m_map.Keys;
			}
		}

		internal IEnumerable<KeyValuePair<TKey, List<TValue>>> KeyValuePairs
		{
#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_20 || NET_STANDARD_21
			[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
#endif
			get
			{
				return this.m_map;
			}
		}
	}
}

Added System.Data.SQLite.Linq/SQL Generation/License.txt.































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Microsoft Public License (Ms-PL)

This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software.

1. Definitions

The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law.

A "contribution" is the original software, or any additions or changes to the software.

A "contributor" is any person that distributes its contribution under this license.

"Licensed patents" are a contributor's patent claims that read directly on its contribution.

2. Grant of Rights

(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create.

(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software.

3. Conditions and Limitations

(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.

(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically.

(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software.

(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license.

(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. 

Added System.Data.SQLite.Linq/SQL Generation/MetadataHelpers.cs.







































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
//---------------------------------------------------------------------
// <copyright file="MetadataHelpers.cs" company="Microsoft">
//      Portions of this file copyright (c) Microsoft Corporation
//      and are released under the Microsoft Pulic License.  See
//      http://archive.msdn.microsoft.com/EFSampleProvider/Project/License.aspx
//      or License.txt for details.
//      All rights reserved.
// </copyright>
//---------------------------------------------------------------------

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
  using System;
  using System.Data;
  using System.Collections.Generic;
  using System.Diagnostics;

#if USE_ENTITY_FRAMEWORK_6
  using System.Data.Entity.Core.Metadata.Edm;
#else
  using System.Data.Metadata.Edm;
#endif

  /// <summary>
  /// A set of static helpers for type metadata
  /// </summary>
  static class MetadataHelpers
  {
    #region Type Helpers

    /// <summary>
    /// Cast the EdmType of the given type usage to the given TEdmType
    /// </summary>
    /// <typeparam name="TEdmType"></typeparam>
    /// <param name="typeUsage"></param>
    /// <returns></returns>
    internal static TEdmType GetEdmType<TEdmType>(TypeUsage typeUsage)
        where TEdmType : EdmType
    {
      return (TEdmType)typeUsage.EdmType;
    }

    /// <summary>
    /// Gets the TypeUsage of the elment if the given type is a collection type
    /// </summary>
    /// <param name="type"></param>
    /// <returns></returns>
    internal static TypeUsage GetElementTypeUsage(TypeUsage type)
    {
      if (MetadataHelpers.IsCollectionType(type))
      {
        return ((CollectionType)type.EdmType).TypeUsage;
      }
      return null;
    }

    /// <summary>
    /// Retrieves the properties of in the EdmType underlying the input type usage, 
    ///  if that EdmType is a structured type (EntityType, RowType). 
    /// </summary>
    /// <param name="typeUsage"></param>
    /// <returns></returns>
    internal static IList<EdmProperty> GetProperties(TypeUsage typeUsage)
    {
      return MetadataHelpers.GetProperties(typeUsage.EdmType);
    }

    /// <summary>
    /// Retrieves the properties of the given EdmType, if it is
    ///  a structured type (EntityType, RowType). 
    /// </summary>
    /// <param name="edmType"></param>
    /// <returns></returns>
    internal static IList<EdmProperty> GetProperties(EdmType edmType)
    {
      switch (edmType.BuiltInTypeKind)
      {
        case BuiltInTypeKind.ComplexType:
          return ((ComplexType)edmType).Properties;
        case BuiltInTypeKind.EntityType:
          return ((EntityType)edmType).Properties;
        case BuiltInTypeKind.RowType:
          return ((RowType)edmType).Properties;
        default:
          return new List<EdmProperty>();
      }
    }

    /// <summary>
    /// Is the given type usage over a collection type
    /// </summary>
    /// <param name="typeUsage"></param>
    /// <returns></returns>
    internal static bool IsCollectionType(TypeUsage typeUsage)
    {
      return MetadataHelpers.IsCollectionType(typeUsage.EdmType);
    }

    /// <summary>
    /// Is the given type a collection type
    /// </summary>
    /// <param name="type"></param>
    /// <returns></returns>
    internal static bool IsCollectionType(EdmType type)
    {
      return (BuiltInTypeKind.CollectionType == type.BuiltInTypeKind);
    }

    /// <summary>
    /// Is the given type usage over a primitive type
    /// </summary>
    /// <param name="type"></param>
    /// <returns></returns>
    internal static bool IsPrimitiveType(TypeUsage type)
    {
      return MetadataHelpers.IsPrimitiveType(type.EdmType);
    }

    /// <summary>
    /// Is the given type a primitive type
    /// </summary>
    /// <param name="type"></param>
    /// <returns></returns>
    internal static bool IsPrimitiveType(EdmType type)
    {
      return (BuiltInTypeKind.PrimitiveType == type.BuiltInTypeKind);
    }

    /// <summary>
    /// Is the given type usage over a row type
    /// </summary>
    /// <param name="type"></param>
    /// <returns></returns>
    internal static bool IsRowType(TypeUsage type)
    {
      return MetadataHelpers.IsRowType(type.EdmType);
    }

    /// <summary>
    /// Is the given type a row type
    /// </summary>
    /// <param name="type"></param>
    /// <returns></returns>
    internal static bool IsRowType(EdmType type)
    {
      return (BuiltInTypeKind.RowType == type.BuiltInTypeKind);
    }

    /// <summary>
    /// Gets the type of the given type usage if it is a primitive type
    /// </summary>
    /// <param name="type"></param>
    /// <param name="typeKind"></param>
    /// <returns></returns>
    internal static bool TryGetPrimitiveTypeKind(TypeUsage type, out PrimitiveTypeKind typeKind)
    {
      if (type != null && type.EdmType != null && type.EdmType.BuiltInTypeKind == BuiltInTypeKind.PrimitiveType)
      {
        typeKind = ((PrimitiveType)type.EdmType).PrimitiveTypeKind;
        return true;
      }

      typeKind = default(PrimitiveTypeKind);
      return false;
    }

    internal static PrimitiveTypeKind GetPrimitiveTypeKind(TypeUsage type)
    {
      PrimitiveTypeKind returnValue;
      if (!MetadataHelpers.TryGetPrimitiveTypeKind(type, out returnValue))
      {
        Debug.Assert(false, "Cannot create parameter of non-primitive type");
        throw new NotSupportedException("Cannot create parameter of non-primitive type");
      }
      return returnValue;
    }

    /// <summary>
    /// Gets the value for the metadata property with the given name
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="item"></param>
    /// <param name="propertyName"></param>
    /// <returns></returns>
    internal static T TryGetValueForMetadataProperty<T>(MetadataItem item, string propertyName)
    {
      MetadataProperty property;
      if (!item.MetadataProperties.TryGetValue(propertyName, true, out property))
      {
        return default(T);
      }

      return (T)property.Value;
    }

    internal static bool IsPrimitiveType(TypeUsage type, PrimitiveTypeKind primitiveType)
    {
      PrimitiveTypeKind typeKind;
      if (TryGetPrimitiveTypeKind(type, out typeKind))
      {
        return (typeKind == primitiveType);
      }
      return false;
    }

    internal static DbType GetDbType(PrimitiveTypeKind primitiveType)
    {
      switch (primitiveType)
      {
        case PrimitiveTypeKind.Binary: return DbType.Binary;
        case PrimitiveTypeKind.Boolean: return DbType.Boolean;
        case PrimitiveTypeKind.Byte: return DbType.Byte;
        case PrimitiveTypeKind.DateTime: return DbType.DateTime;
        case PrimitiveTypeKind.Decimal: return DbType.Decimal;
        case PrimitiveTypeKind.Double: return DbType.Double;
        case PrimitiveTypeKind.Single: return DbType.Single;
        case PrimitiveTypeKind.Guid: return DbType.Guid;
        case PrimitiveTypeKind.Int16: return DbType.Int16;
        case PrimitiveTypeKind.Int32: return DbType.Int32;
        case PrimitiveTypeKind.Int64: return DbType.Int64;
        //case PrimitiveTypeKind.Money: return DbType.Decimal;
        case PrimitiveTypeKind.SByte: return DbType.SByte;
        case PrimitiveTypeKind.String: return DbType.String;
        //case PrimitiveTypeKind.UInt16: return DbType.UInt16;
        //case PrimitiveTypeKind.UInt32: return DbType.UInt32;
        //case PrimitiveTypeKind.UInt64: return DbType.UInt64;
        //case PrimitiveTypeKind.Xml: return DbType.Xml;
        default:
          Debug.Fail("unknown PrimitiveTypeKind" + primitiveType.ToString());
          throw new InvalidOperationException(string.Format("Unknown PrimitiveTypeKind {0}", primitiveType));
      }
    }

    #endregion

    #region Facet Support
    internal static readonly int UnicodeStringMaxMaxLength = Int32.MaxValue;
    internal static readonly int AsciiStringMaxMaxLength = Int32.MaxValue;
    internal static readonly int BinaryMaxMaxLength = Int32.MaxValue;

    #region Facet Names
    /// <summary>
    /// Name of the MaxLength Facet
    /// </summary>
    public static readonly string MaxLengthFacetName = "MaxLength";

    /// <summary>
    /// Name of the Unicode Facet
    /// </summary>
    public static readonly string UnicodeFacetName = "Unicode";

    /// <summary>
    /// Name of the FixedLength Facet
    /// </summary>
    public static readonly string FixedLengthFacetName = "FixedLength";

    /// <summary>
    /// Name of the PreserveSeconds Facet
    /// </summary>
    public static readonly string PreserveSecondsFacetName = "PreserveSeconds";

    /// <summary>
    /// Name of the Precision Facet
    /// </summary>
    public static readonly string PrecisionFacetName = "Precision";

    /// <summary>
    /// Name of the Scale Facet
    /// </summary>
    public static readonly string ScaleFacetName = "Scale";

    /// <summary>
    /// Name of the DefaultValue Facet
    /// </summary>
    public static readonly string DefaultValueFacetName = "DefaultValue";

    /// <summary>
    /// Name of the Nullable Facet
    /// </summary>
    internal const string NullableFacetName = "Nullable";
    #endregion

    #region Facet Retreival Helpers

    /// <summary>
    /// Get the value specified on the given type usage for the given facet name.
    /// If the faces does not have a value specifid or that value is null returns
    /// the default value for that facet.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="type"></param>
    /// <param name="facetName"></param>
    /// <param name="defaultValue"></param>
    /// <returns></returns>
    internal static T GetFacetValueOrDefault<T>(TypeUsage type, string facetName, T defaultValue)
    {
      //Get the value for the facet, if any
      Facet facet;
      if (type.Facets.TryGetValue(facetName, false, out facet) && facet.Value != null && !facet.IsUnbounded)
      {
        return (T)facet.Value;
      }
      else
      {
        return defaultValue;
      }
    }

    internal static bool IsFacetValueConstant(TypeUsage type, string facetName)
    {
      return MetadataHelpers.GetFacet(((PrimitiveType)type.EdmType).FacetDescriptions, facetName).IsConstant;
    }

    private static FacetDescription GetFacet(IEnumerable<FacetDescription> facetCollection, string facetName)
    {
      foreach (FacetDescription facetDescription in facetCollection)
      {
        if (facetDescription.FacetName == facetName)
        {
          return facetDescription;
        }
      }

      return null;
    }

    /// <summary>
    /// Given a facet name and an EdmType, tries to get that facet's description.
    /// </summary>
    /// <param name="edmType"></param>
    /// <param name="facetName"></param>
    /// <param name="facetDescription"></param>
    /// <returns></returns>
    internal static bool TryGetTypeFacetDescriptionByName(EdmType edmType, string facetName, out FacetDescription facetDescription)
    {
      facetDescription = null;
      if (MetadataHelpers.IsPrimitiveType(edmType))
      {
        PrimitiveType primitiveType = (PrimitiveType)edmType;
        foreach (FacetDescription fd in primitiveType.FacetDescriptions)
        {
          if (facetName.Equals(fd.FacetName, StringComparison.OrdinalIgnoreCase))
          {
            facetDescription = fd;
            return true;
          }
        }
      }
      return false;
    }

    internal static bool IsNullable(TypeUsage type)
    {
      Facet nullableFacet;
      if (type.Facets.TryGetValue(NullableFacetName, false, out nullableFacet))
      {
        return (bool)nullableFacet.Value;
      }
      return false;
    }

    internal static bool TryGetMaxLength(TypeUsage type, out int maxLength)
    {
      if (!IsPrimitiveType(type, PrimitiveTypeKind.String) &&
          !IsPrimitiveType(type, PrimitiveTypeKind.Binary))
      {
        maxLength = 0;
        return false;
      }

      // Binary and String FixedLength facets share the same name
      return TryGetIntFacetValue(type, MaxLengthFacetName, out maxLength);
    }

    internal static bool TryGetIntFacetValue(TypeUsage type, string facetName, out int intValue)
    {
      intValue = 0;
      Facet intFacet;

      if (type.Facets.TryGetValue(facetName, false, out intFacet) && intFacet.Value != null && !intFacet.IsUnbounded)
      {
        intValue = (int)intFacet.Value;
        return true;
      }

      return false;
    }

    internal static bool TryGetIsFixedLength(TypeUsage type, out bool isFixedLength)
    {
      if (!IsPrimitiveType(type, PrimitiveTypeKind.String) &&
          !IsPrimitiveType(type, PrimitiveTypeKind.Binary))
      {
        isFixedLength = false;
        return false;
      }

      // Binary and String MaxLength facets share the same name
      return TryGetBooleanFacetValue(type, FixedLengthFacetName, out isFixedLength);
    }

    internal static bool TryGetBooleanFacetValue(TypeUsage type, string facetName, out bool boolValue)
    {
      boolValue = false;
      Facet boolFacet;
      if (type.Facets.TryGetValue(facetName, false, out boolFacet) && boolFacet.Value != null)
      {
        boolValue = (bool)boolFacet.Value;
        return true;
      }

      return false;
    }

    internal static bool TryGetIsUnicode(TypeUsage type, out bool isUnicode)
    {
      if (!IsPrimitiveType(type, PrimitiveTypeKind.String))
      {
        isUnicode = false;
        return false;
      }

      return TryGetBooleanFacetValue(type, UnicodeFacetName, out isUnicode);
    }

    #endregion

    #endregion

    internal static bool IsCanonicalFunction(EdmFunction function)
    {
      return (function.NamespaceName == "Edm");
    }

    internal static bool IsStoreFunction(EdmFunction function)
    {
      return !IsCanonicalFunction(function);
    }

    // Returns ParameterDirection corresponding to given ParameterMode
    internal static ParameterDirection ParameterModeToParameterDirection(ParameterMode mode)
    {
      switch (mode)
      {
        case ParameterMode.In:
          return ParameterDirection.Input;

        case ParameterMode.InOut:
          return ParameterDirection.InputOutput;

        case ParameterMode.Out:
          return ParameterDirection.Output;

        case ParameterMode.ReturnValue:
          return ParameterDirection.ReturnValue;

        default:
          Debug.Fail("unrecognized mode " + mode.ToString());
          return default(ParameterDirection);
      }
    }
  }
}

Added System.Data.SQLite.Linq/SQL Generation/SkipClause.cs.











































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//---------------------------------------------------------------------
// <copyright file="SkipClause.cs" company="Microsoft">
//      Portions of this file copyright (c) Microsoft Corporation
//      and are released under the Microsoft Pulic License.  See
//      http://archive.msdn.microsoft.com/EFSampleProvider/Project/License.aspx
//      or License.txt for details.
//      All rights reserved.
// </copyright>
//---------------------------------------------------------------------

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
    using System.Globalization;

    /// <summary>
    /// SkipClause represents the a SKIP expression in a SqlSelectStatement.
    /// It has a count property, which indicates how many rows should be skipped.
    /// </summary>
    class SkipClause : ISqlFragment
    {
        ISqlFragment skipCount;

        /// <summary>
        /// How many rows should be skipped.
        /// </summary>
        internal ISqlFragment SkipCount
        {
            get { return skipCount; }
        }

        /// <summary>
        /// Creates a SkipClause with the given skipCount.
        /// </summary>
        /// <param name="skipCount"></param>
        internal SkipClause(ISqlFragment skipCount)
        {
            this.skipCount = skipCount;
        }

        /// <summary>
        /// Creates a SkipClause with the given skipCount.
        /// </summary>
        /// <param name="skipCount"></param>
        internal SkipClause(int skipCount)
        {
            SqlBuilder sqlBuilder = new SqlBuilder();
            sqlBuilder.Append(skipCount.ToString(CultureInfo.InvariantCulture));
            this.skipCount = sqlBuilder;
        }

        #region ISqlFragment Members
        /// <summary>
        /// Write out the SKIP part of sql select statement 
        /// It basically writes OFFSET (X).
        /// </summary>
        /// <param name="writer"></param>
        /// <param name="sqlGenerator"></param>
        public void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator)
        {
            writer.Write(" OFFSET ");
            this.SkipCount.WriteSql(writer, sqlGenerator);
        }
        #endregion
    }
}

Added System.Data.SQLite.Linq/SQL Generation/SqlBuilder.cs.















































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
//---------------------------------------------------------------------
// <copyright file="SqlBuilder.cs" company="Microsoft">
//      Portions of this file copyright (c) Microsoft Corporation
//      and are released under the Microsoft Pulic License.  See
//      http://archive.msdn.microsoft.com/EFSampleProvider/Project/License.aspx
//      or License.txt for details.
//      All rights reserved.
// </copyright>
//---------------------------------------------------------------------

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
  using System;
  using System.Collections.Generic;
  using System.Diagnostics;

#if USE_ENTITY_FRAMEWORK_6
  using System.Data.Entity.Core.Common.CommandTrees;
#else
  using System.Data.Common.CommandTrees;
#endif

  /// <summary>
  /// This class is like StringBuilder.  While traversing the tree for the first time, 
  /// we do not know all the strings that need to be appended e.g. things that need to be
  /// renamed, nested select statements etc.  So, we use a builder that can collect
  /// all kinds of sql fragments.
  /// </summary>
  internal sealed class SqlBuilder : ISqlFragment
  {
    private List<object> _sqlFragments;
    private List<object> sqlFragments
    {
      get
      {
        if (null == _sqlFragments)
        {
          _sqlFragments = new List<object>();
        }
        return _sqlFragments;
      }
    }


    /// <summary>
    /// Add an object to the list - we do not verify that it is a proper sql fragment
    /// since this is an internal method.
    /// </summary>
    /// <param name="s"></param>
    public void Append(object s)
    {
      Debug.Assert(s != null);
      sqlFragments.Add(s);
    }

    /// <summary>
    /// This is to pretty print the SQL.  The writer <see cref="SqlWriter.Write"/>
    /// needs to know about new lines so that it can add the right amount of 
    /// indentation at the beginning of lines.
    /// </summary>
    public void AppendLine()
    {
      sqlFragments.Add("\r\n");
    }

    /// <summary>
    /// Whether the builder is empty.  This is used by the <see cref="SqlGenerator.Visit(DbProjectExpression)"/>
    /// to determine whether a sql statement can be reused.
    /// </summary>
    public bool IsEmpty
    {
      get { return ((null == _sqlFragments) || (0 == _sqlFragments.Count)); }
    }

    #region ISqlFragment Members

    /// <summary>
    /// We delegate the writing of the fragment to the appropriate type.
    /// </summary>
    /// <param name="writer"></param>
    /// <param name="sqlGenerator"></param>
    public void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator)
    {
      if (null != _sqlFragments)
      {
        foreach (object o in _sqlFragments)
        {
          string str = (o as String);
          if (null != str)
          {
            writer.Write(str);
          }
          else
          {
            ISqlFragment sqlFragment = (o as ISqlFragment);
            if (null != sqlFragment)
            {
              sqlFragment.WriteSql(writer, sqlGenerator);
            }
            else if (o is char)
            {
              writer.Write((char)o);
            }
            else
            {
              throw new InvalidOperationException();
            }
          }
        }
      }
    }

    #endregion
  }
}

Added System.Data.SQLite.Linq/SQL Generation/SqlChecker.cs.























































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
  using System;
  using System.Collections.Generic;

#if USE_ENTITY_FRAMEWORK_6
  using System.Data.Entity.Core.Common.CommandTrees;
#else
  using System.Data.Common.CommandTrees;
#endif

    internal sealed class SqlChecker : DbExpressionVisitor<bool>
  {
#if false
    private static Type sql8rewriter;

    static SqlChecker()
    {
        string version =
#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_20 || NET_STANDARD_21
            "4.0.0.0";
#else
            "3.5.0.0";
#endif

        sql8rewriter = Type.GetType(String.Format("System.Data.SqlClient.SqlGen.Sql8ExpressionRewriter, System.Data.Entity, Version={0}, Culture=neutral, PublicKeyToken=b77a5c561934e089", version), false);
    }
#endif

    private SqlChecker()
    {
    }

#if false
    /// <summary>
    /// SQLite doesn't support things like SKIP and a few other things.
    /// So determine if the query has to be rewritten
    /// </summary>
    /// <remarks>
    /// Microsoft went to all the trouble of making things like SKIP work
    /// on Sql Server 2000 by doing a rewrite of the commandtree.
    /// However, all that fancy stuff is hidden from us.  Thanks to
    /// reflection however, we can go ahead and use the Sql 2000 rewriter code
    /// they made.
    /// </remarks>
    /// <param name="tree">The tree to inspect for a rewrite</param>
    /// <returns>Returns a new query tree if it needs rewriting</returns>
    internal static DbQueryCommandTree Rewrite(DbQueryCommandTree tree)
    {
      SqlChecker visitor = new SqlChecker();
      if (tree.Query.Accept<bool>(visitor))
      {
        tree = sql8rewriter.InvokeMember("Rewrite", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Static, null, null, new object[] { tree }) as DbQueryCommandTree;
      }
      return tree;
    }
#endif

    public override bool Visit(DbAndExpression expression)
    {
      return VisitBinaryExpression(expression);
    }

    public override bool Visit(DbApplyExpression expression)
    {
      throw new NotSupportedException("apply expression");
    }

    public override bool Visit(DbArithmeticExpression expression)
    {
      return VisitExpressionList(expression.Arguments);
    }

    public override bool Visit(DbCaseExpression expression)
    {
      bool flag1 = VisitExpressionList(expression.When);
      bool flag2 = VisitExpressionList(expression.Then);
      bool flag3 = VisitExpression(expression.Else);

      return (flag1 || flag2 || flag3);
    }

    public override bool Visit(DbCastExpression expression)
    {
      return VisitUnaryExpression(expression);
    }

    public override bool Visit(DbComparisonExpression expression)
    {
      return VisitBinaryExpression(expression);
    }

    public override bool Visit(DbConstantExpression expression)
    {
      return false;
    }

    public override bool Visit(DbCrossJoinExpression expression)
    {
      return VisitExpressionBindingList(expression.Inputs);
    }

    public override bool Visit(DbDerefExpression expression)
    {
      return VisitUnaryExpression(expression);
    }

    public override bool Visit(DbDistinctExpression expression)
    {
      return VisitUnaryExpression(expression);
    }

    public override bool Visit(DbElementExpression expression)
    {
      return VisitUnaryExpression(expression);
    }

    public override bool Visit(DbEntityRefExpression expression)
    {
      return VisitUnaryExpression(expression);
    }

    public override bool Visit(DbExceptExpression expression)
    {
      bool flag1 = VisitExpression(expression.Left);
      bool flag2 = VisitExpression(expression.Right);
      return (flag1 || flag2);
    }

    public override bool Visit(DbExpression expression)
    {
      throw new NotSupportedException(expression.GetType().FullName);
    }

    public override bool Visit(DbFilterExpression expression)
    {
      bool flag1 = VisitExpressionBinding(expression.Input);
      bool flag2 = VisitExpression(expression.Predicate);

      return (flag1 || flag2);
    }

    public override bool Visit(DbFunctionExpression expression)
    {
      return VisitExpressionList(expression.Arguments);
    }

    public override bool Visit(DbGroupByExpression expression)
    {
      bool flag1 = VisitExpression(expression.Input.Expression);
      bool flag2 = VisitExpressionList(expression.Keys);
      bool flag3 = VisitAggregateList(expression.Aggregates);

      return (flag1 || flag2 || flag3);
    }

    public override bool Visit(DbIntersectExpression expression)
    {
      bool flag1 = VisitExpression(expression.Left);
      bool flag2 = VisitExpression(expression.Right);
      return (flag1 || flag2);
    }

    public override bool Visit(DbIsEmptyExpression expression)
    {
      return VisitUnaryExpression(expression);
    }

    public override bool Visit(DbIsNullExpression expression)
    {
      return VisitUnaryExpression(expression);
    }

    public override bool Visit(DbIsOfExpression expression)
    {
      return VisitUnaryExpression(expression);
    }

    public override bool Visit(DbJoinExpression expression)
    {
      bool flag1 = VisitExpressionBinding(expression.Left);
      bool flag2 = VisitExpressionBinding(expression.Right);
      bool flag3 = VisitExpression(expression.JoinCondition);
      return (flag1 || flag2 || flag3);
    }

    public override bool Visit(DbLikeExpression expression)
    {
      bool flag1 = VisitExpression(expression.Argument);
      bool flag2 = VisitExpression(expression.Pattern);
      bool flag3 = VisitExpression(expression.Escape);
      return (flag1 || flag2 || flag3);
    }

    public override bool Visit(DbLimitExpression expression)
    {
      return VisitExpression(expression.Argument);
    }

    public override bool Visit(DbNewInstanceExpression expression)
    {
      return VisitExpressionList(expression.Arguments);
    }

    public override bool Visit(DbNotExpression expression)
    {
      return VisitUnaryExpression(expression);
    }

    public override bool Visit(DbNullExpression expression)
    {
      return false;
    }

    public override bool Visit(DbOfTypeExpression expression)
    {
      return VisitUnaryExpression(expression);
    }

    public override bool Visit(DbOrExpression expression)
    {
      return VisitBinaryExpression(expression);
    }

    public override bool Visit(DbParameterReferenceExpression expression)
    {
      return false;
    }

    public override bool Visit(DbProjectExpression expression)
    {
      bool flag1 = VisitExpressionBinding(expression.Input);
      bool flag2 = VisitExpression(expression.Projection);
      return (flag1 || flag2);
    }

    public override bool Visit(DbPropertyExpression expression)
    {
      return VisitExpression(expression.Instance);
    }

    public override bool Visit(DbQuantifierExpression expression)
    {
      bool flag1 = VisitExpressionBinding(expression.Input);
      bool flag2 = VisitExpression(expression.Predicate);
      return (flag1 || flag2);
    }

    public override bool Visit(DbRefExpression expression)
    {
      return VisitUnaryExpression(expression);
    }

    public override bool Visit(DbRefKeyExpression expression)
    {
      return VisitUnaryExpression(expression);
    }

    public override bool Visit(DbRelationshipNavigationExpression expression)
    {
      return VisitExpression(expression.NavigationSource);
    }

    public override bool Visit(DbScanExpression expression)
    {
      return false;
    }

    public override bool Visit(DbSkipExpression expression)
    {
      VisitExpressionBinding(expression.Input);
      VisitSortClauseList(expression.SortOrder);
      VisitExpression(expression.Count);
      return true;
    }

    public override bool Visit(DbSortExpression expression)
    {
      bool flag1 = VisitExpressionBinding(expression.Input);
      bool flag2 = VisitSortClauseList(expression.SortOrder);
      return (flag1 || flag2);
    }

    public override bool Visit(DbTreatExpression expression)
    {
      return VisitUnaryExpression(expression);
    }

    public override bool Visit(DbUnionAllExpression expression)
    {
      return VisitBinaryExpression(expression);
    }

    public override bool Visit(DbVariableReferenceExpression expression)
    {
      return false;
    }

    private bool VisitAggregate(DbAggregate aggregate)
    {
      return VisitExpressionList(aggregate.Arguments);
    }

    private bool VisitAggregateList(IList<DbAggregate> list)
    {
      return VisitList<DbAggregate>(new ListElementHandler<DbAggregate>(VisitAggregate), list);
    }

    private bool VisitBinaryExpression(DbBinaryExpression expr)
    {
      bool flag1 = VisitExpression(expr.Left);
      bool flag2 = VisitExpression(expr.Right);
      return (flag1 || flag2);
    }

    private bool VisitExpression(DbExpression expression)
    {
      if (expression == null)
      {
        return false;
      }
      return expression.Accept<bool>(this);
    }

    private bool VisitExpressionBinding(DbExpressionBinding expressionBinding)
    {
      return VisitExpression(expressionBinding.Expression);
    }

    private bool VisitExpressionBindingList(IList<DbExpressionBinding> list)
    {
      return VisitList<DbExpressionBinding>(new ListElementHandler<DbExpressionBinding>(VisitExpressionBinding), list);
    }

    private bool VisitExpressionList(IList<DbExpression> list)
    {
      return VisitList<DbExpression>(new ListElementHandler<DbExpression>(VisitExpression), list);
    }

    private static bool VisitList<TElementType>(ListElementHandler<TElementType> handler, IList<TElementType> list)
    {
      bool flag = false;
      foreach (TElementType local in list)
      {
        bool flag2 = handler(local);
        flag = flag || flag2;
      }
      return flag;
    }

    private bool VisitSortClause(DbSortClause sortClause)
    {
      return VisitExpression(sortClause.Expression);
    }

    private bool VisitSortClauseList(IList<DbSortClause> list)
    {
      return VisitList<DbSortClause>(new ListElementHandler<DbSortClause>(VisitSortClause), list);
    }

    private bool VisitUnaryExpression(DbUnaryExpression expr)
    {
      return VisitExpression(expr.Argument);
    }

    private delegate bool ListElementHandler<TElementType>(TElementType element);
  }
}

Added System.Data.SQLite.Linq/SQL Generation/SqlGenerator.cs.











































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
//---------------------------------------------------------------------
// <copyright file="SqlGenerator.cs" company="Microsoft">
//      Portions of this file copyright (c) Microsoft Corporation
//      and are released under the Microsoft Pulic License.  See
//      http://archive.msdn.microsoft.com/EFSampleProvider/Project/License.aspx
//      or License.txt for details.
//      All rights reserved.
// </copyright>
//---------------------------------------------------------------------

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
  using System;
  using System.Linq;
  using System.Diagnostics;
  using System.Globalization;
  using System.Text;
  using System.Data.Common;
  using System.Data;
  using System.Collections.ObjectModel;
  using System.Collections.Generic;

#if USE_ENTITY_FRAMEWORK_6
  using System.Data.Entity.Core.Metadata.Edm;
  using System.Data.Entity.Core.Common.CommandTrees;
#else
  using System.Data.Metadata.Edm;
  using System.Data.Common.CommandTrees;
#endif

  /// <summary>
  /// Translates the command object into a SQL string that can be executed on
  /// SQLite.
  /// </summary>
  /// <remarks>
  /// The translation is implemented as a visitor <see cref="DbExpressionVisitor{T}"/>
  /// over the query tree.  It makes a single pass over the tree, collecting the sql
  /// fragments for the various nodes in the tree <see cref="ISqlFragment"/>.
  ///
  /// The major operations are
  /// <list type="bullet">
  /// <item>Select statement minimization.  Multiple nodes in the query tree
  /// that can be part of a single SQL select statement are merged. e.g. a
  /// Filter node that is the input of a Project node can typically share the
  /// same SQL statement.</item>
  /// <item>Alpha-renaming.  As a result of the statement minimization above, there
  /// could be name collisions when using correlated subqueries
  /// <example>
  /// <code>
  /// Filter(
  ///     b = Project( c.x
  ///         c = Extent(foo)
  ///         )
  ///     exists (
  ///         Filter(
  ///             c = Extent(foo)
  ///             b.x = c.x
  ///             )
  ///     )
  /// )
  /// </code>
  /// The first Filter, Project and Extent will share the same SQL select statement.
  /// The alias for the Project i.e. b, will be replaced with c.
  /// If the alias c for the Filter within the exists clause is not renamed,
  /// we will get <c>c.x = c.x</c>, which is incorrect.
  /// Instead, the alias c within the second filter should be renamed to c1, to give
  /// <c>c.x = c1.x</c> i.e. b is renamed to c, and c is renamed to c1.
  /// </example>
  /// </item>
  /// <item>Join flattening.  In the query tree, a list of join nodes is typically
  /// represented as a tree of Join nodes, each with 2 children. e.g.
  /// <example>
  /// <code>
  /// a = Join(InnerJoin
  ///     b = Join(CrossJoin
  ///         c = Extent(foo)
  ///         d = Extent(foo)
  ///         )
  ///     e = Extent(foo)
  ///     on b.c.x = e.x
  ///     )
  /// </code>
  /// If translated directly, this will be translated to
  /// <code>
  /// FROM ( SELECT c.*, d.*
  ///         FROM foo as c
  ///         CROSS JOIN foo as d) as b
  /// INNER JOIN foo as e on b.x' = e.x
  /// </code>
  /// It would be better to translate this as
  /// <code>
  /// FROM foo as c
  /// CROSS JOIN foo as d
  /// INNER JOIN foo as e on c.x = e.x
  /// </code>
  /// This allows the optimizer to choose an appropriate join ordering for evaluation.
  /// </example>
  /// </item>
  /// <item>Select * and column renaming.  In the example above, we noticed that
  /// in some cases we add <c>SELECT * FROM ...</c> to complete the SQL
  /// statement. i.e. there is no explicit PROJECT list.
  /// In this case, we enumerate all the columns available in the FROM clause
  /// This is particularly problematic in the case of Join trees, since the columns
  /// from the extents joined might have the same name - this is illegal.  To solve
  /// this problem, we will have to rename columns if they are part of a SELECT *
  /// for a JOIN node - we do not need renaming in any other situation.
  /// <see cref="SqlGenerator.AddDefaultColumns"/>.
  /// </item>
  /// </list>
  ///
  /// <para>
  /// Renaming issues.
  /// When rows or columns are renamed, we produce names that are unique globally
  /// with respect to the query.  The names are derived from the original names,
  /// with an integer as a suffix. e.g. CustomerId will be renamed to CustomerId1,
  /// CustomerId2 etc.
  ///
  /// Since the names generated are globally unique, they will not conflict when the
  /// columns of a JOIN SELECT statement are joined with another JOIN.
  ///
  /// </para>
  ///
  /// <para>
  /// Record flattening.
  /// SQL server does not have the concept of records.  However, a join statement
  /// produces records.  We have to flatten the record accesses into a simple
  /// <c>alias.column</c> form.  <see cref="SqlGenerator.Visit(DbPropertyExpression)"/>
  /// </para>
  ///
  /// <para>
  /// Building the SQL.
  /// There are 2 phases
  /// <list type="numbered">
  /// <item>Traverse the tree, producing a sql builder <see cref="SqlBuilder"/></item>
  /// <item>Write the SqlBuilder into a string, renaming the aliases and columns
  /// as needed.</item>
  /// </list>
  ///
  /// In the first phase, we traverse the tree.  We cannot generate the SQL string
  /// right away, since
  /// <list type="bullet">
  /// <item>The WHERE clause has to be visited before the from clause.</item>
  /// <item>extent aliases and column aliases need to be renamed.  To minimize
  /// renaming collisions, all the names used must be known, before any renaming
  /// choice is made.</item>
  /// </list>
  /// To defer the renaming choices, we use symbols <see cref="Symbol"/>.  These
  /// are renamed in the second phase.
  ///
  /// Since visitor methods cannot transfer information to child nodes through
  /// parameters, we use some global stacks,
  /// <list type="bullet">
  /// <item>A stack for the current SQL select statement.  This is needed by
  /// <see cref="SqlGenerator.Visit(DbVariableReferenceExpression)"/> to create a
  /// list of free variables used by a select statement.  This is needed for
  /// alias renaming.
  /// </item>
  /// <item>A stack for the join context.  When visiting a <see cref="DbScanExpression"/>,
  /// we need to know whether we are inside a join or not.  If we are inside
  /// a join, we do not create a new SELECT statement.</item>
  /// </list>
  /// </para>
  ///
  /// <para>
  /// Global state.
  /// To enable renaming, we maintain
  /// <list type="bullet">
  /// <item>The set of all extent aliases used.</item>
  /// <item>The set of all column aliases used.</item>
  /// </list>
  ///
  /// Finally, we have a symbol table to lookup variable references.  All references
  /// to the same extent have the same symbol.
  /// </para>
  ///
  /// <para>
  /// Sql select statement sharing.
  ///
  /// Each of the relational operator nodes
  /// <list type="bullet">
  /// <item>Project</item>
  /// <item>Filter</item>
  /// <item>GroupBy</item>
  /// <item>Sort/OrderBy</item>
  /// </list>
  /// can add its non-input (e.g. project, predicate, sort order etc.) to
  /// the SQL statement for the input, or create a new SQL statement.
  /// If it chooses to reuse the input's SQL statement, we play the following
  /// symbol table trick to accomplish renaming.  The symbol table entry for
  /// the alias of the current node points to the symbol for the input in
  /// the input's SQL statement.
  /// <example>
  /// <code>
  /// Project(b.x
  ///     b = Filter(
  ///         c = Extent(foo)
  ///         c.x = 5)
  ///     )
  /// </code>
  /// The Extent node creates a new SqlSelectStatement.  This is added to the
  /// symbol table by the Filter as {c, Symbol(c)}.  Thus, <c>c.x</c> is resolved to
  /// <c>Symbol(c).x</c>.
  /// Looking at the project node, we add {b, Symbol(c)} to the symbol table if the
  /// SQL statement is reused, and {b, Symbol(b)}, if there is no reuse.
  ///
  /// Thus, <c>b.x</c> is resolved to <c>Symbol(c).x</c> if there is reuse, and to
  /// <c>Symbol(b).x</c> if there is no reuse.
  /// </example>
  /// </para>
  /// </remarks>
  internal sealed class SqlGenerator : DbExpressionVisitor<ISqlFragment>
  {
    private SQLiteProviderManifest _manifest;

    #region Visitor parameter stacks
    /// <summary>
    /// Every relational node has to pass its SELECT statement to its children
    /// This allows them (DbVariableReferenceExpression eventually) to update the list of
    /// outer extents (free variables) used by this select statement.
    /// </summary>
    Stack<SqlSelectStatement> selectStatementStack;

    /// <summary>
    /// The top of the stack
    /// </summary>
    private SqlSelectStatement CurrentSelectStatement
    {
      // There is always something on the stack, so we can always Peek.
      get { return selectStatementStack.Peek(); }
    }

    /// <summary>
    /// Nested joins and extents need to know whether they should create
    /// a new Select statement, or reuse the parent's.  This flag
    /// indicates whether the parent is a join or not.
    /// </summary>
    Stack<bool> isParentAJoinStack;

    /// <summary>
    /// The top of the stack
    /// </summary>
    private bool IsParentAJoin
    {
      // There might be no entry on the stack if a Join node has never
      // been seen, so we return false in that case.
      get { return isParentAJoinStack.Count == 0 ? false : isParentAJoinStack.Peek(); }
    }

    #endregion

    #region Global lists and state
    Dictionary<string, int> allExtentNames;
    internal Dictionary<string, int> AllExtentNames
    {
      get { return allExtentNames; }
    }

    // For each column name, we store the last integer suffix that
    // was added to produce a unique column name.  This speeds up
    // the creation of the next unique name for this column name.
    Dictionary<string, int> allColumnNames;
    internal Dictionary<string, int> AllColumnNames
    {
      get { return allColumnNames; }
    }

    SymbolTable symbolTable = new SymbolTable();

    /// <summary>
    /// VariableReferenceExpressions are allowed only as children of DbPropertyExpression
    /// or MethodExpression.  The cheapest way to ensure this is to set the following
    /// property in DbVariableReferenceExpression and reset it in the allowed parent expressions.
    /// </summary>
    bool isVarRefSingle = false;

    #endregion

    private bool HasBuiltMapForIn(DbExpression e, KeyToListMap<DbExpression, DbExpression> values)
    {
      DbExpressionKind expressionKind = e.ExpressionKind;
      if (expressionKind != DbExpressionKind.Equals)
      {
        if (expressionKind != DbExpressionKind.IsNull)
        {
          if (expressionKind != DbExpressionKind.Or)
          {
            return false;
          }
          DbBinaryExpression expression2 = e as DbBinaryExpression;
          return (this.HasBuiltMapForIn(expression2.Left, values) && this.HasBuiltMapForIn(expression2.Right, values));
        }
      }
      else
      {
        return this.TryAddExpressionForIn((DbBinaryExpression)e, values);
      }
      DbExpression argument = ((DbIsNullExpression)e).Argument;
      if (this.IsKeyForIn(argument))
      {
        values.Add(argument, e);
        return true;
      }
      return false;
    }

    #region Statics
    static private readonly Dictionary<string, FunctionHandler> _builtInFunctionHandlers = InitializeBuiltInFunctionHandlers();
    static private readonly Dictionary<string, FunctionHandler> _canonicalFunctionHandlers = InitializeCanonicalFunctionHandlers();
    static private readonly Dictionary<string, string> _functionNameToOperatorDictionary = InitializeFunctionNameToOperatorDictionary();
    static private readonly Dictionary<string, string> _datepartKeywords = InitializeDatepartKeywords();
    static private readonly char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };

    private delegate ISqlFragment FunctionHandler(SqlGenerator sqlgen, DbFunctionExpression functionExpr);

    /// <summary>
    /// All special built-in functions and their handlers
    /// </summary>
    /// <returns></returns>
    private static Dictionary<string, FunctionHandler> InitializeBuiltInFunctionHandlers()
    {
      Dictionary<string, FunctionHandler> functionHandlers = new Dictionary<string, FunctionHandler>(7, StringComparer.Ordinal);
      functionHandlers.Add("CONCAT", HandleConcatFunction);
      functionHandlers.Add("DATEPART", HandleDatepartDateFunction);
      functionHandlers.Add("DatePart", HandleDatepartDateFunction);
      functionHandlers.Add("GETDATE", HandleGetDateFunction);
      functionHandlers.Add("GETUTCDATE", HandleGetUtcDateFunction);
      return functionHandlers;
    }

    /// <summary>
    /// All special non-aggregate canonical functions and their handlers
    /// </summary>
    /// <returns></returns>
    private static Dictionary<string, FunctionHandler> InitializeCanonicalFunctionHandlers()
    {
      Dictionary<string, FunctionHandler> functionHandlers = new Dictionary<string, FunctionHandler>(16, StringComparer.Ordinal);

#if USE_INTEROP_DLL && INTEROP_EXTENSION_FUNCTIONS
      functionHandlers.Add("IndexOf", HandleCanonicalFunctionIndexOf);
#endif

      functionHandlers.Add("Length", HandleCanonicalFunctionLength);
      functionHandlers.Add("NewGuid", HandleCanonicalFunctionNewGuid);
      functionHandlers.Add("Round", HandleCanonicalFunctionRound);
      functionHandlers.Add("ToLower", HandleCanonicalFunctionToLower);
      functionHandlers.Add("ToUpper", HandleCanonicalFunctionToUpper);
      functionHandlers.Add("Trim", HandleCanonicalFunctionTrim);
      functionHandlers.Add("Left", HandleCanonicalFunctionLeft);
      functionHandlers.Add("Right", HandleCanonicalFunctionRight);
      functionHandlers.Add("Substring", HandleCanonicalFunctionSubstring);
      functionHandlers.Add("CurrentDateTime", HandleGetDateFunction);
      functionHandlers.Add("CurrentUtcDateTime", HandleGetUtcDateFunction);

      //DatePartFunctions
      functionHandlers.Add("Year", HandleCanonicalFunctionDatepart);
      functionHandlers.Add("Month", HandleCanonicalFunctionDatepart);
      functionHandlers.Add("Day", HandleCanonicalFunctionDatepart);
      functionHandlers.Add("Hour", HandleCanonicalFunctionDatepart);
      functionHandlers.Add("Minute", HandleCanonicalFunctionDatepart);
      functionHandlers.Add("Second", HandleCanonicalFunctionDatepart);
      functionHandlers.Add("DateAdd", HandleCanonicalFunctionDateAdd);
      functionHandlers.Add("DateDiff", HandleCanonicalFunctionDateSubtract);
      functionHandlers.Add("DATEADD", HandleCanonicalFunctionDateAdd); // store
      functionHandlers.Add("DATEDIFF", HandleCanonicalFunctionDateSubtract); // store

      //Functions that translate to operators
      functionHandlers.Add("Concat", HandleConcatFunction);
      functionHandlers.Add("BitwiseAnd", HandleCanonicalFunctionBitwise);
      functionHandlers.Add("BitwiseNot", HandleCanonicalFunctionBitwise);
      functionHandlers.Add("BitwiseOr", HandleCanonicalFunctionBitwise);
      functionHandlers.Add("BitwiseXor", HandleCanonicalFunctionBitwise);
      return functionHandlers;
    }

    /// <summary>
    /// Valid datepart values
    /// </summary>
    /// <returns></returns>
    private static Dictionary<string, string> InitializeDatepartKeywords()
    {
      #region Datepart Keywords
      //
      // valid datepart values
      //
      Dictionary<string, string> datepartKeywords = new Dictionary<string, string>(30, StringComparer.OrdinalIgnoreCase);
      datepartKeywords.Add("d", "%d");
      datepartKeywords.Add("day", "%d");
      datepartKeywords.Add("dayofyear", "%j");
      datepartKeywords.Add("dd", "%d");
      datepartKeywords.Add("dw", "%w");
      datepartKeywords.Add("dy", "%j");
      datepartKeywords.Add("hh", "%H");
      datepartKeywords.Add("hour", "%H");
      datepartKeywords.Add("m", "%m");
      datepartKeywords.Add("mi", "%M");
      datepartKeywords.Add("millisecond", "%f");
      datepartKeywords.Add("minute", "%M");
      datepartKeywords.Add("mm", "%m");
      datepartKeywords.Add("month", "%m");
      datepartKeywords.Add("ms", "%f");
      datepartKeywords.Add("n", "%M");
      datepartKeywords.Add("s", "%S");
      datepartKeywords.Add("second", "%S");
      datepartKeywords.Add("ss", "%S");
      datepartKeywords.Add("week", "%W");
      datepartKeywords.Add("weekday", "%w");
      datepartKeywords.Add("wk", "%W");
      datepartKeywords.Add("ww", "%W");
      datepartKeywords.Add("y", "%Y");
      datepartKeywords.Add("year", "%Y");
      datepartKeywords.Add("yy", "%Y");
      datepartKeywords.Add("yyyy", "%Y");
      return datepartKeywords;
      #endregion
    }

    /// <summary>
    /// Initializes the mapping from functions to T-SQL operators
    /// for all functions that translate to T-SQL operators
    /// </summary>
    /// <returns></returns>
    private static Dictionary<string, string> InitializeFunctionNameToOperatorDictionary()
    {
      Dictionary<string, string> functionNameToOperatorDictionary = new Dictionary<string, string>(5, StringComparer.Ordinal);
      functionNameToOperatorDictionary.Add("Concat", "||");    //canonical
      functionNameToOperatorDictionary.Add("CONCAT", "||");    //store
      functionNameToOperatorDictionary.Add("BitwiseAnd", "&");
      functionNameToOperatorDictionary.Add("BitwiseNot", "~");
      functionNameToOperatorDictionary.Add("BitwiseOr", "|");
      functionNameToOperatorDictionary.Add("BitwiseXor", "^");
      return functionNameToOperatorDictionary;
    }

    #endregion

    #region Constructor
    /// <summary>
    /// Basic constructor.
    /// </summary>
    private SqlGenerator(SQLiteProviderManifest manifest)
    {
      _manifest = manifest;
    }
    #endregion

    #region Entry points
    /// <summary>
    /// General purpose static function that can be called from System.Data assembly
    /// </summary>
    /// <param name="manifest"></param>
    /// <param name="tree">command tree</param>
    /// <param name="parameters">Parameters to add to the command tree corresponding
    /// to constants in the command tree. Used only in ModificationCommandTrees.</param>
    /// <param name="commandType"></param>
    /// <returns>The string representing the SQL to be executed.</returns>
    internal static string GenerateSql(SQLiteProviderManifest manifest, DbCommandTree tree, out List<DbParameter> parameters, out CommandType commandType)
    {
      commandType = CommandType.Text;

      //Handle Query
      DbQueryCommandTree queryCommandTree = tree as DbQueryCommandTree;
      if (queryCommandTree != null)
      {
        SqlGenerator sqlGen = new SqlGenerator(manifest);
        parameters = null;

        string sql = sqlGen.GenerateSql((DbQueryCommandTree)tree);

        return sql;
      }

      //Handle Function
      DbFunctionCommandTree DbFunctionCommandTree = tree as DbFunctionCommandTree;
      if (DbFunctionCommandTree != null)
      {
        SqlGenerator sqlGen = new SqlGenerator(manifest);
        parameters = null;

        string sql = sqlGen.GenerateFunctionSql(DbFunctionCommandTree, out commandType);

        return sql;
      }

      //Handle Insert
      DbInsertCommandTree insertCommandTree = tree as DbInsertCommandTree;
      if (insertCommandTree != null)
      {
        return DmlSqlGenerator.GenerateInsertSql(insertCommandTree, out parameters);
      }

      //Handle Delete
      DbDeleteCommandTree deleteCommandTree = tree as DbDeleteCommandTree;
      if (deleteCommandTree != null)
      {
        return DmlSqlGenerator.GenerateDeleteSql(deleteCommandTree, out parameters);
      }

      //Handle Update
      DbUpdateCommandTree updateCommandTree = tree as DbUpdateCommandTree;
      if (updateCommandTree != null)
      {
        return DmlSqlGenerator.GenerateUpdateSql(updateCommandTree, out parameters);
      }

      throw new NotSupportedException("Unrecognized command tree type");
    }
    #endregion

    //StringBuilder _typeDefs = new StringBuilder();

    #region Driver Methods
    /// <summary>
    /// Translate a command tree to a SQL string.
    ///
    /// The input tree could be translated to either a SQL SELECT statement
    /// or a SELECT expression.  This choice is made based on the return type
    /// of the expression
    /// CollectionType => select statement
    /// non collection type => select expression
    /// </summary>
    /// <param name="tree"></param>
    /// <returns>The string representing the SQL to be executed.</returns>
    private string GenerateSql(DbQueryCommandTree tree)
    {
#if false
      tree = SqlChecker.Rewrite(tree);
#endif

      selectStatementStack = new Stack<SqlSelectStatement>();
      isParentAJoinStack = new Stack<bool>();

      allExtentNames = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
      allColumnNames = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);

      // Literals will not be converted to parameters.

      ISqlFragment result;
      if (MetadataHelpers.IsCollectionType(tree.Query.ResultType))
      {
        SqlSelectStatement sqlStatement = VisitExpressionEnsureSqlStatement(tree.Query);
        Debug.Assert(sqlStatement != null, "The outer most sql statment is null");
        sqlStatement.IsTopMost = true;
        result = sqlStatement;

      }
      else
      {
        SqlBuilder sqlBuilder = new SqlBuilder();
        sqlBuilder.Append("SELECT ");
        sqlBuilder.Append(tree.Query.Accept(this));

        result = sqlBuilder;
      }

      if (isVarRefSingle)
      {
        throw new NotSupportedException();
        // A DbVariableReferenceExpression has to be a child of DbPropertyExpression or MethodExpression
      }

      // Check that the parameter stacks are not leaking.
      Debug.Assert(selectStatementStack.Count == 0);
      Debug.Assert(isParentAJoinStack.Count == 0);

      //if (_typeDefs.Length > 0)
      //{
      //  _typeDefs.Insert(0x0, "TYPES ");
      //  _typeDefs.Append(";\r\n");
      //  _typeDefs.Append(WriteSql(result));
      //  return _typeDefs.ToString();
      //}

      return WriteSql(result);
    }

    /// <summary>
    /// Translate a function command tree to a SQL string.
    /// </summary>
    private string GenerateFunctionSql(DbFunctionCommandTree tree, out CommandType commandType)
    {
      EdmFunction function = tree.EdmFunction;

      // We expect function to always have these properties
      string userCommandText = (string)function.MetadataProperties["CommandTextAttribute"].Value;
      //string userSchemaName = (string)function.MetadataProperties["Schema"].Value;
      string userFuncName = (string)function.MetadataProperties["StoreFunctionNameAttribute"].Value;

      if (String.IsNullOrEmpty(userCommandText))
      {
        // build a quoted description of the function
        commandType = CommandType.StoredProcedure;

        // if the schema name is not explicitly given, it is assumed to be the metadata namespace
        //string schemaName = String.IsNullOrEmpty(userSchemaName) ?
        //    function.NamespaceName : userSchemaName;

        // if the function store name is not explicitly given, it is assumed to be the metadata name
        string functionName = String.IsNullOrEmpty(userFuncName) ?
            function.Name : userFuncName;

        // quote elements of function text
        //string quotedSchemaName = QuoteIdentifier(schemaName);
        string quotedFunctionName = QuoteIdentifier(functionName);

        // separator
        //const string schemaSeparator = ".";

        // concatenate elements of function text
        string quotedFunctionText = /* quotedSchemaName + schemaSeparator + */ quotedFunctionName;

        return quotedFunctionText;
      }
      else
      {
        // if the user has specified the command text, pass it through verbatim and choose CommandType.Text
        commandType = CommandType.Text;
        return userCommandText;
      }
    }

    /// <summary>
    /// Convert the SQL fragments to a string.
    /// We have to setup the Stream for writing.
    /// </summary>
    /// <param name="sqlStatement"></param>
    /// <returns>A string representing the SQL to be executed.</returns>
    string WriteSql(ISqlFragment sqlStatement)
    {
      StringBuilder builder = new StringBuilder(1024);
      using (SqlWriter writer = new SqlWriter(builder))
      {
        sqlStatement.WriteSql(writer, this);
      }

      return builder.ToString();
    }
    #endregion

    private bool TryTranslateIntoIn(DbOrExpression e, out ISqlFragment sqlFragment)
    {
      KeyToListMap<DbExpression, DbExpression> values = new KeyToListMap<DbExpression, DbExpression>(KeyFieldExpressionComparer.Singleton);
      if (!(this.HasBuiltMapForIn(e, values) && (values.Keys.Count<DbExpression>() > 0)))
      {
        sqlFragment = null;
        return false;
      }
      SqlBuilder result = new SqlBuilder();
      bool flag2 = true;
      foreach (DbExpression expression in values.Keys)
      {
        ReadOnlyCollection<DbExpression> source = values.ListForKey(expression);
        if (!flag2)
        {
          result.Append(" OR ");
        }
        else
        {
          flag2 = false;
        }
        IEnumerable<DbExpression> enumerable = source.Where<DbExpression>(delegate(DbExpression v)
        {
          return v.ExpressionKind != DbExpressionKind.IsNull;
        });
        int num = enumerable.Count<DbExpression>();
        if (num == 1)
        {
          this.ParanthesizeExpressionIfNeeded(expression, result);
          result.Append(" = ");
          DbExpression expression2 = enumerable.First<DbExpression>();
          this.ParenthesizeExpressionWithoutRedundantConstantCasts(expression2, result);
        }
        if (num > 1)
        {
          this.ParanthesizeExpressionIfNeeded(expression, result);
          result.Append(" IN (");
          bool flag3 = true;
          foreach (DbExpression expression3 in enumerable)
          {
            if (!flag3)
            {
              result.Append(",");
            }
            else
            {
              flag3 = false;
            }
            this.ParenthesizeExpressionWithoutRedundantConstantCasts(expression3, result);
          }
          result.Append(")");
        }
        DbIsNullExpression expression4 = source.FirstOrDefault<DbExpression>(delegate(DbExpression v)
        {
          return (v.ExpressionKind == DbExpressionKind.IsNull);
        }) as DbIsNullExpression;
        if (expression4 != null)
        {
          if (num > 0)
          {
            result.Append(" OR ");
          }
          result.Append(this.VisitIsNullExpression(expression4, false));
        }
      }
      sqlFragment = result;
      return true;
    }

    #region DbExpressionVisitor Members

    /// <summary>
    /// Translate(left) AND Translate(right)
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlBuilder"/>.</returns>
    public override ISqlFragment Visit(DbAndExpression e)
    {
      return VisitBinaryExpression(" AND ", e.Left, e.Right);
    }

    /// <summary>
    /// An apply is just like a join, so it shares the common join processing
    /// in <see cref="VisitJoinExpression"/>
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlSelectStatement"/>.</returns>
    public override ISqlFragment Visit(DbApplyExpression e)
    {
      throw new NotSupportedException("APPLY joins are not supported");
    }

    /// <summary>
    /// For binary expressions, we delegate to <see cref="VisitBinaryExpression"/>.
    /// We handle the other expressions directly.
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlBuilder"/></returns>
    public override ISqlFragment Visit(DbArithmeticExpression e)
    {
      SqlBuilder result;

      switch (e.ExpressionKind)
      {
        case DbExpressionKind.Divide:
          result = VisitBinaryExpression(" / ", e.Arguments[0], e.Arguments[1]);
          break;
        case DbExpressionKind.Minus:
          result = VisitBinaryExpression(" - ", e.Arguments[0], e.Arguments[1]);
          break;
        case DbExpressionKind.Modulo:
          result = VisitBinaryExpression(" % ", e.Arguments[0], e.Arguments[1]);
          break;
        case DbExpressionKind.Multiply:
          result = VisitBinaryExpression(" * ", e.Arguments[0], e.Arguments[1]);
          break;
        case DbExpressionKind.Plus:
          result = VisitBinaryExpression(" + ", e.Arguments[0], e.Arguments[1]);
          break;

        case DbExpressionKind.UnaryMinus:
          result = new SqlBuilder();
          result.Append(" -(");
          result.Append(e.Arguments[0].Accept(this));
          result.Append(")");
          break;

        default:
          Debug.Assert(false);
          throw new InvalidOperationException();
      }

      return result;
    }

    /// <summary>
    /// If the ELSE clause is null, we do not write it out.
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlBuilder"/></returns>
    public override ISqlFragment Visit(DbCaseExpression e)
    {
      SqlBuilder result = new SqlBuilder();

      Debug.Assert(e.When.Count == e.Then.Count);

      result.Append("CASE");
      for (int i = 0; i < e.When.Count; ++i)
      {
        result.Append(" WHEN (");
        result.Append(e.When[i].Accept(this));
        result.Append(") THEN ");
        result.Append(e.Then[i].Accept(this));
      }
      if (e.Else != null && !(e.Else is DbNullExpression))
      {
        result.Append(" ELSE ");
        result.Append(e.Else.Accept(this));
      }

      result.Append(" END");

      return result;
    }

    /// <summary>
    ///
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    public override ISqlFragment Visit(DbCastExpression e)
    {
      SqlBuilder result = new SqlBuilder();
      result.Append(e.Argument.Accept(this));
      return result;
    }

    /// <summary>
    /// The parser generates Not(Equals(...)) for &lt;&gt;.
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlBuilder"/>.</returns>
    public override ISqlFragment Visit(DbComparisonExpression e)
    {
      SqlBuilder result;
      switch (e.ExpressionKind)
      {
        case DbExpressionKind.Equals:
            result = VisitBinaryExpression(" = ", e.Left, e.Right);
          break;
        case DbExpressionKind.LessThan:
          result = VisitBinaryExpression(" < ", e.Left, e.Right);
          break;
        case DbExpressionKind.LessThanOrEquals:
          result = VisitBinaryExpression(" <= ", e.Left, e.Right);
          break;
        case DbExpressionKind.GreaterThan:
          result = VisitBinaryExpression(" > ", e.Left, e.Right);
          break;
        case DbExpressionKind.GreaterThanOrEquals:
          result = VisitBinaryExpression(" >= ", e.Left, e.Right);
          break;
        // The parser does not generate the expression kind below.
        case DbExpressionKind.NotEquals:
          result = VisitBinaryExpression(" <> ", e.Left, e.Right);
          break;

        default:
          throw new InvalidOperationException();
      }

      return result;
    }

    /// <summary>
    /// Constants will be send to the store as part of the generated TSQL, not as parameters
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlBuilder"/>.  Strings are wrapped in single
    /// quotes and escaped.  Numbers are written literally.</returns>
    public override ISqlFragment Visit(DbConstantExpression e)
    {
      SqlBuilder result = new SqlBuilder();

      PrimitiveTypeKind typeKind;
      // Model Types can be (at the time of this implementation):
      //      Binary, Boolean, Byte, DateTime, Decimal, Double, Guid, Int16, Int32, Int64,Single, String
      if (MetadataHelpers.TryGetPrimitiveTypeKind(e.ResultType, out typeKind))
      {
        switch (typeKind)
        {
          case PrimitiveTypeKind.Int32:
            result.Append(e.Value.ToString());
            break;

          case PrimitiveTypeKind.Binary:
            ToBlobLiteral((byte[])e.Value, result);
            break;

          case PrimitiveTypeKind.Boolean:
            result.Append((bool)e.Value ? "1" : "0");
            break;

          case PrimitiveTypeKind.Byte:
            result.Append(e.Value.ToString());
            break;

          case PrimitiveTypeKind.DateTime:
            bool needQuotes = NeedSingleQuotes(_manifest._dateTimeFormat);

            string dateString = SQLiteConvert.ToString(
                (System.DateTime)e.Value, _manifest._dateTimeFormat,
                _manifest._dateTimeKind, _manifest._dateTimeFormatString);

            if (needQuotes)
            {
                result.Append(EscapeSingleQuote(
                    dateString, false /* IsUnicode */));
            }
            else
            {
                result.Append(dateString);
            }
            break;

          case PrimitiveTypeKind.Decimal:
            string strDecimal = ((Decimal)e.Value).ToString(CultureInfo.InvariantCulture);
            // if the decimal value has no decimal part, cast as decimal to preserve type
            // if the number has precision > int64 max precision, it will be handled as decimal by sql server
            // and does not need cast. if precision is lest then 20, then cast using Max(literal precision, sql default precision)
            if (-1 == strDecimal.IndexOf('.') && (strDecimal.TrimStart(new char[] { '-' }).Length < 20))
            {
              byte precision = (Byte)strDecimal.Length;
              FacetDescription precisionFacetDescription;
              Debug.Assert(MetadataHelpers.TryGetTypeFacetDescriptionByName(e.ResultType.EdmType, "precision", out precisionFacetDescription), "Decimal primitive type must have Precision facet");
              if (MetadataHelpers.TryGetTypeFacetDescriptionByName(e.ResultType.EdmType, "precision", out precisionFacetDescription))
              {
                if (precisionFacetDescription.DefaultValue != null)
                {
                  precision = Math.Max(precision, (byte)precisionFacetDescription.DefaultValue);
                }
              }
              Debug.Assert(precision > 0, "Precision must be greater than zero");
              result.Append(strDecimal);
            }
            else
            {
              result.Append(strDecimal);
            }
            break;

          case PrimitiveTypeKind.Double:
            result.Append(((Double)e.Value).ToString(CultureInfo.InvariantCulture));
            break;

          case PrimitiveTypeKind.Guid:
            {
                object value = e.Value;

                if (_manifest._binaryGuid && (value is Guid))
                    ToBlobLiteral(((Guid)value).ToByteArray(), result);
                else
                    result.Append(EscapeSingleQuote(e.Value.ToString(), false /* IsUnicode */));
            }
            break;

          case PrimitiveTypeKind.Int16:
            result.Append(e.Value.ToString());
            break;

          case PrimitiveTypeKind.Int64:
            result.Append(e.Value.ToString());
            break;

          case PrimitiveTypeKind.Single:
            result.Append(((Single)e.Value).ToString(CultureInfo.InvariantCulture));
            break;

          case PrimitiveTypeKind.String:
            bool isUnicode = MetadataHelpers.GetFacetValueOrDefault<bool>(e.ResultType, MetadataHelpers.UnicodeFacetName, true);
            result.Append(EscapeSingleQuote(e.Value as string, isUnicode));
            break;
          case PrimitiveTypeKind.DateTimeOffset:
            throw new NotSupportedException("datetimeoffset");
          case PrimitiveTypeKind.Time:
            throw new NotSupportedException("time");
          default:
            // all known scalar types should been handled already.
            throw new NotSupportedException();
        }
      }
      else
      {
        throw new NotSupportedException();
      }

      return result;

    }

    /// <summary>
    /// <see cref="DbDerefExpression"/> is illegal at this stage
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    public override ISqlFragment Visit(DbDerefExpression e)
    {
      throw new NotSupportedException();
    }

    /// <summary>
    /// The DISTINCT has to be added to the beginning of SqlSelectStatement.Select,
    /// but it might be too late for that.  So, we use a flag on SqlSelectStatement
    /// instead, and add the "DISTINCT" in the second phase.
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlSelectStatement"/></returns>
    public override ISqlFragment Visit(DbDistinctExpression e)
    {
      SqlSelectStatement result = VisitExpressionEnsureSqlStatement(e.Argument);

      if (!IsCompatible(result, e.ExpressionKind))
      {
        Symbol fromSymbol;
        TypeUsage inputType = MetadataHelpers.GetElementTypeUsage(e.Argument.ResultType);
        result = CreateNewSelectStatement(result, "DISTINCT", inputType, out fromSymbol);
        AddFromSymbol(result, "DISTINCT", fromSymbol, false);
      }

      result.IsDistinct = true;
      return result;
    }

    /// <summary>
    /// An element expression returns a scalar - so it is translated to
    /// ( Select ... )
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    public override ISqlFragment Visit(DbElementExpression e)
    {
      SqlBuilder result = new SqlBuilder();
      result.Append("(");
      result.Append(VisitExpressionEnsureSqlStatement(e.Argument));
      result.Append(")");

      return result;
    }

    /// <summary>
    /// <see cref="Visit(DbUnionAllExpression)"/>
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    public override ISqlFragment Visit(DbExceptExpression e)
    {
      return VisitSetOpExpression(e.Left, e.Right, "EXCEPT");
    }

    /// <summary>
    /// Only concrete expression types will be visited.
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    public override ISqlFragment Visit(DbExpression e)
    {
      throw new InvalidOperationException();
    }

    /// <summary>
    ///
    /// </summary>
    /// <param name="e"></param>
    /// <returns>If we are in a Join context, returns a <see cref="SqlBuilder"/>
    /// with the extent name, otherwise, a new <see cref="SqlSelectStatement"/>
    /// with the From field set.</returns>
    public override ISqlFragment Visit(DbScanExpression e)
    {
      EntitySetBase target = e.Target;

      if (IsParentAJoin)
      {
        SqlBuilder result = new SqlBuilder();
        result.Append(GetTargetTSql(target));

        return result;
      }
      else
      {
        SqlSelectStatement result = new SqlSelectStatement();
        result.From.Append(GetTargetTSql(target));

        return result;
      }
    }


    /// <summary>
    /// Gets escaped TSql identifier describing this entity set.
    /// </summary>
    /// <returns></returns>
    internal static string GetTargetTSql(EntitySetBase entitySetBase)
    {
      // construct escaped T-SQL referencing entity set
      StringBuilder builder = new StringBuilder(50);
      string definingQuery = MetadataHelpers.TryGetValueForMetadataProperty<string>(entitySetBase, "DefiningQuery");
      if (!string.IsNullOrEmpty(definingQuery))
      {
        //definingQuery = definingQuery.TrimStart(' ', '\t', '\r', '\n');
        //if (String.Compare(definingQuery, 0, "TYPES ", 0, 6, StringComparison.OrdinalIgnoreCase) == 0)
        //  definingQuery = definingQuery.Substring(definingQuery.IndexOf(';') + 1).TrimStart(' ', '\t', '\r', '\n');
        builder.Append("(");
        builder.Append(definingQuery);
        builder.Append(")");
      }
      else
      {
        //string schemaName = MetadataHelpers.TryGetValueForMetadataProperty<string>(entitySetBase, "Schema");
        //if (!string.IsNullOrEmpty(schemaName))
        //{
        //  builder.Append(SqlGenerator.QuoteIdentifier(schemaName));
        //  builder.Append(".");
        //}

        string tableName = MetadataHelpers.TryGetValueForMetadataProperty<string>(entitySetBase, "Table");
        if (!string.IsNullOrEmpty(tableName))
        {
          builder.Append(SqlGenerator.QuoteIdentifier(tableName));
        }
        else
        {
          builder.Append(SqlGenerator.QuoteIdentifier(entitySetBase.Name));
        }
      }
      return builder.ToString();
    }

    /// <summary>
    /// The bodies of <see cref="Visit(DbFilterExpression)"/>, <see cref="Visit(DbGroupByExpression)"/>,
    /// <see cref="Visit(DbProjectExpression)"/>, <see cref="Visit(DbSortExpression)"/> are similar.
    /// Each does the following.
    /// <list type="number">
    /// <item> Visit the input expression</item>
    /// <item> Determine if the input's SQL statement can be reused, or a new
    /// one must be created.</item>
    /// <item>Create a new symbol table scope</item>
    /// <item>Push the Sql statement onto a stack, so that children can
    /// update the free variable list.</item>
    /// <item>Visit the non-input expression.</item>
    /// <item>Cleanup</item>
    /// </list>
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlSelectStatement"/></returns>
    public override ISqlFragment Visit(DbFilterExpression e)
    {
      return VisitFilterExpression(e.Input, e.Predicate, false);
    }

    /// <summary>
    /// Lambda functions are not supported.
    /// The functions supported are:
    /// <list type="number">
    /// <item>Canonical Functions - We recognize these by their dataspace, it is DataSpace.CSpace</item>
    /// <item>Store Functions - We recognize these by the BuiltInAttribute and not being Canonical</item>
    /// <item>User-defined Functions - All the rest except for Lambda functions</item>
    /// </list>
    /// We handle Canonical and Store functions the same way: If they are in the list of functions
    /// that need special handling, we invoke the appropriate handler, otherwise we translate them to
    /// FunctionName(arg1, arg2, ..., argn).
    /// We translate user-defined functions to NamespaceName.FunctionName(arg1, arg2, ..., argn).
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlBuilder"/></returns>
    public override ISqlFragment Visit(DbFunctionExpression e)
    {
      //
      // check if function requires special case processing, if so, delegates to it
      //
      if (IsSpecialBuiltInFunction(e))
      {
        return HandleSpecialBuiltInFunction(e);
      }

      if (IsSpecialCanonicalFunction(e))
      {
        return HandleSpecialCanonicalFunction(e);
      }

      return HandleFunctionDefault(e);
    }


    /// <summary>
    /// <see cref="DbEntityRefExpression"/> is illegal at this stage
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    public override ISqlFragment Visit(DbEntityRefExpression e)
    {
      throw new NotSupportedException();
    }

    /// <summary>
    /// <see cref="DbRefKeyExpression"/> is illegal at this stage
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    public override ISqlFragment Visit(DbRefKeyExpression e)
    {
      throw new NotSupportedException();
    }

    /// <summary>
    /// <see cref="Visit(DbFilterExpression)"/> for general details.
    /// We modify both the GroupBy and the Select fields of the SqlSelectStatement.
    /// GroupBy gets just the keys without aliases,
    /// and Select gets the keys and the aggregates with aliases.
    ///
    /// Whenever there exists at least one aggregate with an argument that is not is not a simple
    /// <see cref="DbPropertyExpression"/>  over <see cref="DbVariableReferenceExpression"/>,
    /// we create a nested query in which we alias the arguments to the aggregates.
    /// That is due to the following two limitations of Sql Server:
    /// <list type="number">
    /// <item>If an expression being aggregated contains an outer reference, then that outer
    /// reference must be the only column referenced in the expression </item>
    /// <item>Sql Server cannot perform an aggregate function on an expression containing
    /// an aggregate or a subquery. </item>
    /// </list>
    ///
    /// The default translation, without inner query is:
    ///
    ///     SELECT
    ///         kexp1 AS key1, kexp2 AS key2,... kexpn AS keyn,
    ///         aggf1(aexpr1) AS agg1, .. aggfn(aexprn) AS aggn
    ///     FROM input AS a
    ///     GROUP BY kexp1, kexp2, .. kexpn
    ///
    /// When we inject an innner query, the equivalent translation is:
    ///
    ///     SELECT
    ///         key1 AS key1, key2 AS key2, .. keyn AS keys,
    ///         aggf1(agg1) AS agg1, aggfn(aggn) AS aggn
    ///     FROM (
    ///             SELECT
    ///                 kexp1 AS key1, kexp2 AS key2,... kexpn AS keyn,
    ///                 aexpr1 AS agg1, .. aexprn AS aggn
    ///             FROM input AS a
    ///         ) as a
    ///     GROUP BY key1, key2, keyn
    ///
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlSelectStatement"/></returns>
    public override ISqlFragment Visit(DbGroupByExpression e)
    {
      Symbol fromSymbol;
      //SqlSelectStatement result = VisitInputExpression(e.Input.Expression,
      SqlSelectStatement innerQuery = VisitInputExpression(e.Input.Expression,
          e.Input.VariableName, e.Input.VariableType, out fromSymbol);

      // GroupBy is compatible with Filter and OrderBy
      // but not with Project, GroupBy
      if (!IsCompatible(innerQuery, e.ExpressionKind))
      {
        innerQuery = CreateNewSelectStatement(innerQuery, e.Input.VariableName, e.Input.VariableType, out fromSymbol);
      }

      selectStatementStack.Push(innerQuery);
      symbolTable.EnterScope();

      AddFromSymbol(innerQuery, e.Input.VariableName, fromSymbol);
      // This line is not present for other relational nodes.
      symbolTable.Add(e.Input.GroupVariableName, fromSymbol);


      // The enumerator is shared by both the keys and the aggregates,
      // so, we do not close it in between.
      RowType groupByType = MetadataHelpers.GetEdmType<RowType>(MetadataHelpers.GetEdmType<CollectionType>(e.ResultType).TypeUsage);

      //Whenever there exists at least one aggregate with an argument that is not simply a PropertyExpression
      // over a VarRefExpression, we need a nested query in which we alias the arguments to the aggregates.
      bool needsInnerQuery = NeedsInnerQuery(e.Aggregates);

      SqlSelectStatement result;
      if (needsInnerQuery)
      {
        //Create the inner query
        result = CreateNewSelectStatement(innerQuery, e.Input.VariableName, e.Input.VariableType, false, out fromSymbol);
        AddFromSymbol(result, e.Input.VariableName, fromSymbol, false);
      }
      else
      {
        result = innerQuery;
      }

      using (IEnumerator<EdmProperty> members = groupByType.Properties.GetEnumerator())
      {
        members.MoveNext();
        Debug.Assert(result.Select.IsEmpty);

        string separator = String.Empty;

        foreach (DbExpression key in e.Keys)
        {
          EdmProperty member = members.Current;
          string alias = QuoteIdentifier(member.Name);

          result.GroupBy.Append(separator);

          ISqlFragment keySql = key.Accept(this);

          if (!needsInnerQuery)
          {
            //Default translation: Key AS Alias
            result.Select.Append(separator);
            result.Select.AppendLine();
            result.Select.Append(keySql);
            result.Select.Append(" AS ");
            result.Select.Append(alias);

            result.GroupBy.Append(keySql);
          }
          else
          {
            // The inner query contains the default translation Key AS Alias
            innerQuery.Select.Append(separator);
            innerQuery.Select.AppendLine();
            innerQuery.Select.Append(keySql);
            innerQuery.Select.Append(" AS ");
            innerQuery.Select.Append(alias);

            //The outer resulting query projects over the key aliased in the inner query:
            //  fromSymbol.Alias AS Alias
            result.Select.Append(separator);
            result.Select.AppendLine();
            result.Select.Append(fromSymbol);
            result.Select.Append(".");
            result.Select.Append(alias);
            result.Select.Append(" AS ");
            result.Select.Append(alias);

            result.GroupBy.Append(alias);
          }

          separator = ", ";
          members.MoveNext();
        }

        foreach (DbAggregate aggregate in e.Aggregates)
        {
          EdmProperty member = members.Current;
          string alias = QuoteIdentifier(member.Name);

          Debug.Assert(aggregate.Arguments.Count == 1);
          ISqlFragment translatedAggregateArgument = aggregate.Arguments[0].Accept(this);

          object aggregateArgument;

          if (needsInnerQuery)
          {
            //In this case the argument to the aggratete is reference to the one projected out by the
            // inner query
            SqlBuilder wrappingAggregateArgument = new SqlBuilder();
            wrappingAggregateArgument.Append(fromSymbol);
            wrappingAggregateArgument.Append(".");
            wrappingAggregateArgument.Append(alias);
            aggregateArgument = wrappingAggregateArgument;

            innerQuery.Select.Append(separator);
            innerQuery.Select.AppendLine();
            innerQuery.Select.Append(translatedAggregateArgument);
            innerQuery.Select.Append(" AS ");
            innerQuery.Select.Append(alias);
          }
          else
          {
            aggregateArgument = translatedAggregateArgument;
          }

          ISqlFragment aggregateResult = VisitAggregate(aggregate, aggregateArgument);

          result.Select.Append(separator);
          result.Select.AppendLine();
          result.Select.Append(aggregateResult);
          result.Select.Append(" AS ");
          result.Select.Append(alias);

          separator = ", ";
          members.MoveNext();
        }
      }


      symbolTable.ExitScope();
      selectStatementStack.Pop();

      return result;
    }

    /// <summary>
    /// <see cref="Visit(DbUnionAllExpression)"/>
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    public override ISqlFragment Visit(DbIntersectExpression e)
    {
      return VisitSetOpExpression(e.Left, e.Right, "INTERSECT");
    }

    /// <summary>
    /// Not(IsEmpty) has to be handled specially, so we delegate to
    /// <see cref="VisitIsEmptyExpression"/>.
    ///
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlBuilder"/>.
    /// <code>[NOT] EXISTS( ... )</code>
    /// </returns>
    public override ISqlFragment Visit(DbIsEmptyExpression e)
    {
      return VisitIsEmptyExpression(e, false);
    }

    /// <summary>
    /// Not(IsNull) is handled specially, so we delegate to
    /// <see cref="VisitIsNullExpression"/>
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlBuilder"/>
    /// <code>IS [NOT] NULL</code>
    /// </returns>
    public override ISqlFragment Visit(DbIsNullExpression e)
    {
      return VisitIsNullExpression(e, false);
    }

    /// <summary>
    /// <see cref="DbIsOfExpression"/> is illegal at this stage
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlBuilder"/></returns>
    public override ISqlFragment Visit(DbIsOfExpression e)
    {
      throw new NotSupportedException();
    }

    /// <summary>
    /// <see cref="VisitJoinExpression"/>
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlSelectStatement"/>.</returns>
    public override ISqlFragment Visit(DbCrossJoinExpression e)
    {
      return VisitJoinExpression(e.Inputs, e.ExpressionKind, "CROSS JOIN", null);
    }

    /// <summary>
    /// <see cref="VisitJoinExpression"/>
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlSelectStatement"/>.</returns>
    public override ISqlFragment Visit(DbJoinExpression e)
    {
      #region Map join type to a string
      string joinString;
      switch (e.ExpressionKind)
      {
        case DbExpressionKind.FullOuterJoin:
          joinString = "FULL OUTER JOIN";
          break;

        case DbExpressionKind.InnerJoin:
          joinString = "INNER JOIN";
          break;

        case DbExpressionKind.LeftOuterJoin:
          joinString = "LEFT OUTER JOIN";
          break;

        default:
          Debug.Assert(false);
          joinString = null;
          break;
      }
      #endregion

      List<DbExpressionBinding> inputs = new List<DbExpressionBinding>(2);
      inputs.Add(e.Left);
      inputs.Add(e.Right);

      return VisitJoinExpression(inputs, e.ExpressionKind, joinString, e.JoinCondition);
    }

    /// <summary>
    ///
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlBuilder"/></returns>
    public override ISqlFragment Visit(DbLikeExpression e)
    {
      SqlBuilder result = new SqlBuilder();
      result.Append(e.Argument.Accept(this));
      result.Append(" LIKE ");
      result.Append(e.Pattern.Accept(this));

      // if the ESCAPE expression is a DbNullExpression, then that's tantamount to
      // not having an ESCAPE at all
      if (e.Escape.ExpressionKind != DbExpressionKind.Null)
      {
        result.Append(" ESCAPE ");
        result.Append(e.Escape.Accept(this));
      }

      return result;
    }

    /// <summary>
    ///  Translates to TOP expression.
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlBuilder"/></returns>
    public override ISqlFragment Visit(DbLimitExpression e)
    {
      Debug.Assert(e.Limit is DbConstantExpression || e.Limit is DbParameterReferenceExpression, "DbLimitExpression.Limit is of invalid expression type");

      SqlSelectStatement result = VisitExpressionEnsureSqlStatement(e.Argument, false);
      Symbol fromSymbol;

      if (!IsCompatible(result, e.ExpressionKind))
      {
        TypeUsage inputType = MetadataHelpers.GetElementTypeUsage(e.Argument.ResultType);

        result = CreateNewSelectStatement(result, "top", inputType, out fromSymbol);
        AddFromSymbol(result, "top", fromSymbol, false);
      }

      ISqlFragment topCount = HandleCountExpression(e.Limit);

      result.Top = new TopClause(topCount, e.WithTies);
      return result;
    }

    /// <summary>
    /// DbNewInstanceExpression is allowed as a child of DbProjectExpression only.
    /// If anyone else is the parent, we throw.
    /// We also perform special casing for collections - where we could convert
    /// them into Unions
    ///
    /// <see cref="VisitNewInstanceExpression"/> for the actual implementation.
    ///
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    public override ISqlFragment Visit(DbNewInstanceExpression e)
    {
      if (MetadataHelpers.IsCollectionType(e.ResultType))
      {
        return VisitCollectionConstructor(e);
      }
      throw new NotSupportedException();
    }

    /// <summary>
    /// The Not expression may cause the translation of its child to change.
    /// These children are
    /// <list type="bullet">
    /// <item><see cref="DbNotExpression"/>NOT(Not(x)) becomes x</item>
    /// <item><see cref="DbIsEmptyExpression"/>NOT EXISTS becomes EXISTS</item>
    /// <item><see cref="DbIsNullExpression"/>IS NULL becomes IS NOT NULL</item>
    /// <item><see cref="DbComparisonExpression"/>= becomes&lt;&gt; </item>
    /// </list>
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlBuilder"/></returns>
    public override ISqlFragment Visit(DbNotExpression e)
    {
      // Flatten Not(Not(x)) to x.
      DbNotExpression notExpression = e.Argument as DbNotExpression;
      if (notExpression != null)
      {
        return notExpression.Argument.Accept(this);
      }

      DbIsEmptyExpression isEmptyExpression = e.Argument as DbIsEmptyExpression;
      if (isEmptyExpression != null)
      {
        return VisitIsEmptyExpression(isEmptyExpression, true);
      }

      DbIsNullExpression isNullExpression = e.Argument as DbIsNullExpression;
      if (isNullExpression != null)
      {
        return VisitIsNullExpression(isNullExpression, true);
      }

      DbComparisonExpression comparisonExpression = e.Argument as DbComparisonExpression;
      if (comparisonExpression != null)
      {
        if (comparisonExpression.ExpressionKind == DbExpressionKind.Equals)
        {
          return VisitBinaryExpression(" <> ", comparisonExpression.Left, comparisonExpression.Right);
        }
      }

      SqlBuilder result = new SqlBuilder();
      result.Append(" NOT (");
      result.Append(e.Argument.Accept(this));
      result.Append(")");

      return result;
    }

    /// <summary>
    /// </summary>
    /// <param name="e"></param>
    /// <returns><see cref="SqlBuilder"/></returns>
    public override ISqlFragment Visit(DbNullExpression e)
    {
      SqlBuilder result = new SqlBuilder();
      // always cast nulls - sqlserver doesn't like case expressions where the "then" clause is null
      result.Append("NULL");
      return result;
    }

    /// <summary>
    /// <see cref="DbOfTypeExpression"/> is illegal at this stage
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlBuilder"/></returns>
    public override ISqlFragment Visit(DbOfTypeExpression e)
    {
      throw new NotSupportedException();
    }

    /// <summary>
    ///
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlBuilder"/></returns>
    /// <seealso cref="Visit(DbAndExpression)"/>
    public override ISqlFragment Visit(DbOrExpression e)
    {
      ISqlFragment sqlFragment = null;
      if (this.TryTranslateIntoIn(e, out sqlFragment))
      {
        return sqlFragment;
      }
      return VisitBinaryExpression(" OR ", e.Left, e.Right);
    }

    /// <summary>
    ///
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlBuilder"/></returns>
    public override ISqlFragment Visit(DbParameterReferenceExpression e)
    {
      SqlBuilder result = new SqlBuilder();
      // Do not quote this name.
      // We are not checking that e.Name has no illegal characters. e.g. space
      result.Append("@" + e.ParameterName);

      return result;
    }

    /// <summary>
    /// <see cref="Visit(DbFilterExpression)"/> for the general ideas.
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlSelectStatement"/></returns>
    /// <seealso cref="Visit(DbFilterExpression)"/>
    public override ISqlFragment Visit(DbProjectExpression e)
    {
      Symbol fromSymbol;
      SqlSelectStatement result = VisitInputExpression(e.Input.Expression, e.Input.VariableName, e.Input.VariableType, out fromSymbol);

      // Project is compatible with Filter
      // but not with Project, GroupBy
      if (!IsCompatible(result, e.ExpressionKind))
      {
        result = CreateNewSelectStatement(result, e.Input.VariableName, e.Input.VariableType, out fromSymbol);
      }

      selectStatementStack.Push(result);
      symbolTable.EnterScope();

      AddFromSymbol(result, e.Input.VariableName, fromSymbol);

      // Project is the only node that can have DbNewInstanceExpression as a child
      // so we have to check it here.
      // We call VisitNewInstanceExpression instead of Visit(DbNewInstanceExpression), since
      // the latter throws.
      DbNewInstanceExpression newInstanceExpression = e.Projection as DbNewInstanceExpression;
      if (newInstanceExpression != null)
      {
        result.Select.Append(VisitNewInstanceExpression(newInstanceExpression));
      }
      else
      {
        result.Select.Append(e.Projection.Accept(this));
      }

      symbolTable.ExitScope();
      selectStatementStack.Pop();

      return result;
    }

    /// <summary>
    /// This method handles record flattening, which works as follows.
    /// consider an expression <c>Prop(y, Prop(x, Prop(d, Prop(c, Prop(b, Var(a)))))</c>
    /// where a,b,c are joins, d is an extent and x and y are fields.
    /// b has been flattened into a, and has its own SELECT statement.
    /// c has been flattened into b.
    /// d has been flattened into c.
    ///
    /// We visit the instance, so we reach Var(a) first.  This gives us a (join)symbol.
    /// Symbol(a).b gives us a join symbol, with a SELECT statement i.e. Symbol(b).
    /// From this point on , we need to remember Symbol(b) as the source alias,
    /// and then try to find the column.  So, we use a SymbolPair.
    ///
    /// We have reached the end when the symbol no longer points to a join symbol.
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="JoinSymbol"/> if we have not reached the first
    /// Join node that has a SELECT statement.
    /// A <see cref="SymbolPair"/> if we have seen the JoinNode, and it has
    /// a SELECT statement.
    /// A <see cref="SqlBuilder"/> with {Input}.propertyName otherwise.
    /// </returns>
    public override ISqlFragment Visit(DbPropertyExpression e)
    {
      SqlBuilder result;

      ISqlFragment instanceSql = e.Instance.Accept(this);

      // Since the DbVariableReferenceExpression is a proper child of ours, we can reset
      // isVarSingle.
      DbVariableReferenceExpression DbVariableReferenceExpression = e.Instance as DbVariableReferenceExpression;
      if (DbVariableReferenceExpression != null)
      {
        isVarRefSingle = false;
      }

      // We need to flatten, and have not yet seen the first nested SELECT statement.
      JoinSymbol joinSymbol = instanceSql as JoinSymbol;
      if (joinSymbol != null)
      {
        Debug.Assert(joinSymbol.NameToExtent.ContainsKey(e.Property.Name));
        if (joinSymbol.IsNestedJoin)
        {
          return new SymbolPair(joinSymbol, joinSymbol.NameToExtent[e.Property.Name]);
        }
        else
        {
          return joinSymbol.NameToExtent[e.Property.Name];
        }
      }

      // ---------------------------------------
      // We have seen the first nested SELECT statement, but not the column.
      SymbolPair symbolPair = instanceSql as SymbolPair;
      if (symbolPair != null)
      {
        JoinSymbol columnJoinSymbol = symbolPair.Column as JoinSymbol;
        if (columnJoinSymbol != null)
        {
          symbolPair.Column = columnJoinSymbol.NameToExtent[e.Property.Name];
          return symbolPair;
        }
        else
        {
          // symbolPair.Column has the base extent.
          // we need the symbol for the column, since it might have been renamed
          // when handling a JOIN.
          if (symbolPair.Column.Columns.ContainsKey(e.Property.Name))
          {
            result = new SqlBuilder();
            result.Append(symbolPair.Source);
            result.Append(".");
            result.Append(symbolPair.Column.Columns[e.Property.Name]);
            return result;
          }
        }
      }
      // ---------------------------------------

      result = new SqlBuilder();
      result.Append(instanceSql);
      result.Append(".");

      // At this point the column name cannot be renamed, so we do
      // not use a symbol.
      result.Append(QuoteIdentifier(e.Property.Name));

      return result;
    }

    /// <summary>
    /// Any(input, x) => Exists(Filter(input,x))
    /// All(input, x) => Not Exists(Filter(input, not(x))
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    public override ISqlFragment Visit(DbQuantifierExpression e)
    {
      SqlBuilder result = new SqlBuilder();

      bool negatePredicate = (e.ExpressionKind == DbExpressionKind.All);
      if (e.ExpressionKind == DbExpressionKind.Any)
      {
        result.Append("EXISTS (");
      }
      else
      {
        Debug.Assert(e.ExpressionKind == DbExpressionKind.All);
        result.Append("NOT EXISTS (");
      }

      SqlSelectStatement filter = VisitFilterExpression(e.Input, e.Predicate, negatePredicate);
      if (filter.Select.IsEmpty)
      {
        AddDefaultColumns(filter);
      }

      result.Append(filter);
      result.Append(")");

      return result;
    }

    /// <summary>
    /// <see cref="DbRefExpression"/> is illegal at this stage
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    public override ISqlFragment Visit(DbRefExpression e)
    {
      throw new NotSupportedException();
    }

    /// <summary>
    /// <see cref="DbRelationshipNavigationExpression"/> is illegal at this stage
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    public override ISqlFragment Visit(DbRelationshipNavigationExpression e)
    {
      throw new NotSupportedException();
    }

    /// <summary>
    /// For Sql9 it translates to:
    /// SELECT Y.x1, Y.x2, ..., Y.xn
    /// FROM (
    ///     SELECT X.x1, X.x2, ..., X.xn, row_number() OVER (ORDER BY sk1, sk2, ...) AS [row_number]
    ///     FROM input as X
    ///     ) as Y
    /// WHERE Y.[row_number] > count
    /// ORDER BY sk1, sk2, ...
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlBuilder"/></returns>
    public override ISqlFragment Visit(DbSkipExpression e)
    {
        Debug.Assert(e.Count is DbConstantExpression || e.Count is DbParameterReferenceExpression, "DbLimitExpression.Count is of invalid expression type");

        Symbol fromSymbol;
        SqlSelectStatement result = VisitInputExpression(e.Input.Expression, e.Input.VariableName, e.Input.VariableType, out fromSymbol);

        if (!IsCompatible(result, e.ExpressionKind))
        {
            result = CreateNewSelectStatement(result, e.Input.VariableName, e.Input.VariableType, out fromSymbol);
        }

        selectStatementStack.Push(result);
        symbolTable.EnterScope();

        AddFromSymbol(result, e.Input.VariableName, fromSymbol);

        AddSortKeys(result.OrderBy, e.SortOrder);

        symbolTable.ExitScope();
        selectStatementStack.Pop();

        ISqlFragment skipCount = HandleCountExpression(e.Count);

        result.Skip = new SkipClause(skipCount);
        return result;
    }

    /// <summary>
    /// <see cref="Visit(DbFilterExpression)"/>
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlSelectStatement"/></returns>
    /// <seealso cref="Visit(DbFilterExpression)"/>
    public override ISqlFragment Visit(DbSortExpression e)
    {
      Symbol fromSymbol;
      SqlSelectStatement result = VisitInputExpression(e.Input.Expression, e.Input.VariableName, e.Input.VariableType, out fromSymbol);

      // OrderBy is compatible with Filter
      // and nothing else
      if (!IsCompatible(result, e.ExpressionKind))
      {
        result = CreateNewSelectStatement(result, e.Input.VariableName, e.Input.VariableType, out fromSymbol);
      }

      selectStatementStack.Push(result);
      symbolTable.EnterScope();

      AddFromSymbol(result, e.Input.VariableName, fromSymbol);

      AddSortKeys(result.OrderBy, e.SortOrder);

      symbolTable.ExitScope();
      selectStatementStack.Pop();

      return result;
    }

    /// <summary>
    /// <see cref="DbTreatExpression"/> is illegal at this stage
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlBuilder"/></returns>
    public override ISqlFragment Visit(DbTreatExpression e)
    {
      throw new NotSupportedException();
    }

    /// <summary>
    /// This code is shared by <see cref="Visit(DbExceptExpression)"/>
    /// and <see cref="Visit(DbIntersectExpression)"/>
    ///
    /// <see cref="VisitSetOpExpression"/>
    /// Since the left and right expression may not be Sql select statements,
    /// we must wrap them up to look like SQL select statements.
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    public override ISqlFragment Visit(DbUnionAllExpression e)
    {
      return VisitSetOpExpression(e.Left, e.Right, "UNION ALL");
    }

    /// <summary>
    /// This method determines whether an extent from an outer scope(free variable)
    /// is used in the CurrentSelectStatement.
    ///
    /// An extent in an outer scope, if its symbol is not in the FromExtents
    /// of the CurrentSelectStatement.
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="Symbol"/>.</returns>
    public override ISqlFragment Visit(DbVariableReferenceExpression e)
    {
      if (isVarRefSingle)
      {
        throw new NotSupportedException();
        // A DbVariableReferenceExpression has to be a child of DbPropertyExpression or MethodExpression
        // This is also checked in GenerateSql(...) at the end of the visiting.
      }
      isVarRefSingle = true; // This will be reset by DbPropertyExpression or MethodExpression

      Symbol result = symbolTable.Lookup(e.VariableName);
      if (!CurrentSelectStatement.FromExtents.Contains(result))
      {
        CurrentSelectStatement.OuterExtents[result] = true;
      }

      return result;
    }

    #region Visits shared by multiple nodes
    /// <summary>
    /// Aggregates are not visited by the normal visitor walk.
    /// </summary>
    /// <param name="aggregate">The aggreate to be translated</param>
    /// <param name="aggregateArgument">The translated aggregate argument</param>
    /// <returns></returns>
    SqlBuilder VisitAggregate(DbAggregate aggregate, object aggregateArgument)
    {
      SqlBuilder aggregateResult = new SqlBuilder();
      DbFunctionAggregate functionAggregate = aggregate as DbFunctionAggregate;

      if (functionAggregate == null)
      {
        throw new NotSupportedException();
      }

      //The only aggregate function with different name is Big_Count
      //Note: If another such function is to be added, a dictionary should be created
      //if (MetadataHelpers.IsCanonicalFunction(functionAggregate.Function)
      //    && String.Equals(functionAggregate.Function.Name, "BigCount", StringComparison.Ordinal))
      //{
      //  aggregateResult.Append("COUNT_BIG");
      //}
      //else
      {
        WriteFunctionName(aggregateResult, functionAggregate.Function);
      }

      aggregateResult.Append("(");

      DbFunctionAggregate fnAggr = functionAggregate;
      if ((null != fnAggr) && (fnAggr.Distinct))
      {
        aggregateResult.Append("DISTINCT ");
      }

      aggregateResult.Append(aggregateArgument);

      aggregateResult.Append(")");
      return aggregateResult;
    }


    SqlBuilder VisitBinaryExpression(string op, DbExpression left, DbExpression right)
    {
      SqlBuilder result = new SqlBuilder();
      if (IsComplexExpression(left))
      {
        result.Append("(");
      }

      result.Append(left.Accept(this));

      if (IsComplexExpression(left))
      {
        result.Append(")");
      }

      result.Append(op);

      if (IsComplexExpression(right))
      {
        result.Append("(");
      }

      result.Append(right.Accept(this));

      if (IsComplexExpression(right))
      {
        result.Append(")");
      }

      return result;
    }

    /// <summary>
    /// This is called by the relational nodes.  It does the following
    /// <list>
    /// <item>If the input is not a SqlSelectStatement, it assumes that the input
    /// is a collection expression, and creates a new SqlSelectStatement </item>
    /// </list>
    /// </summary>
    /// <param name="inputExpression"></param>
    /// <param name="inputVarName"></param>
    /// <param name="inputVarType"></param>
    /// <param name="fromSymbol"></param>
    /// <returns>A <see cref="SqlSelectStatement"/> and the main fromSymbol
    /// for this select statement.</returns>
    SqlSelectStatement VisitInputExpression(DbExpression inputExpression,
        string inputVarName, TypeUsage inputVarType, out Symbol fromSymbol)
    {
      SqlSelectStatement result;
      ISqlFragment sqlFragment = inputExpression.Accept(this);
      result = sqlFragment as SqlSelectStatement;

      if (result == null)
      {
        result = new SqlSelectStatement();
        WrapNonQueryExtent(result, sqlFragment, inputExpression.ExpressionKind);
      }

      if (result.FromExtents.Count == 0)
      {
        // input was an extent
        fromSymbol = new Symbol(inputVarName, inputVarType);
      }
      else if (result.FromExtents.Count == 1)
      {
        // input was Filter/GroupBy/Project/OrderBy
        // we are likely to reuse this statement.
        fromSymbol = result.FromExtents[0];
      }
      else
      {
        // input was a join.
        // we are reusing the select statement produced by a Join node
        // we need to remove the original extents, and replace them with a
        // new extent with just the Join symbol.
        JoinSymbol joinSymbol = new JoinSymbol(inputVarName, inputVarType, result.FromExtents);
        joinSymbol.FlattenedExtentList = result.AllJoinExtents;

        fromSymbol = joinSymbol;
        result.FromExtents.Clear();
        result.FromExtents.Add(fromSymbol);
      }

      return result;
    }

    /// <summary>
    /// <see cref="Visit(DbIsEmptyExpression)"/>
    /// </summary>
    /// <param name="e"></param>
    /// <param name="negate">Was the parent a DbNotExpression?</param>
    /// <returns></returns>
    SqlBuilder VisitIsEmptyExpression(DbIsEmptyExpression e, bool negate)
    {
      SqlBuilder result = new SqlBuilder();
      if (!negate)
      {
        result.Append(" NOT");
      }
      result.Append(" EXISTS (");
      result.Append(VisitExpressionEnsureSqlStatement(e.Argument));
      result.AppendLine();
      result.Append(")");

      return result;
    }


    /// <summary>
    /// Translate a NewInstance(Element(X)) expression into
    ///   "select top(1) * from X"
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    private ISqlFragment VisitCollectionConstructor(DbNewInstanceExpression e)
    {
      Debug.Assert(e.Arguments.Count <= 1);

      if (e.Arguments.Count == 1 && e.Arguments[0].ExpressionKind == DbExpressionKind.Element)
      {
        DbElementExpression elementExpr = e.Arguments[0] as DbElementExpression;
        SqlSelectStatement result = VisitExpressionEnsureSqlStatement(elementExpr.Argument);

        if (!IsCompatible(result, DbExpressionKind.Element))
        {
          Symbol fromSymbol;
          TypeUsage inputType = MetadataHelpers.GetElementTypeUsage(elementExpr.Argument.ResultType);

          result = CreateNewSelectStatement(result, "element", inputType, out fromSymbol);
          AddFromSymbol(result, "element", fromSymbol, false);
        }
        result.Top = new TopClause(1, false);
        return result;
      }


      // Otherwise simply build this out as a union-all ladder
      CollectionType collectionType = MetadataHelpers.GetEdmType<CollectionType>(e.ResultType);
      Debug.Assert(collectionType != null);
      bool isScalarElement = MetadataHelpers.IsPrimitiveType(collectionType.TypeUsage);

      SqlBuilder resultSql = new SqlBuilder();
      string separator = String.Empty;

      // handle empty table
      if (e.Arguments.Count == 0)
      {
        Debug.Assert(isScalarElement);
        resultSql.Append(" SELECT NULL");
        resultSql.Append(" AS X FROM (SELECT 1) AS Y WHERE 1=0");
      }

      foreach (DbExpression arg in e.Arguments)
      {
        resultSql.Append(separator);
        resultSql.Append(" SELECT ");
        resultSql.Append(arg.Accept(this));
        // For scalar elements, no alias is appended yet. Add this.
        if (isScalarElement)
        {
          resultSql.Append(" AS X ");
        }
        separator = " UNION ALL ";
      }

      return resultSql;
    }


    /// <summary>
    /// <see cref="Visit(DbIsNullExpression)"/>
    /// </summary>
    /// <param name="e"></param>
    /// <param name="negate">Was the parent a DbNotExpression?</param>
    /// <returns></returns>
    SqlBuilder VisitIsNullExpression(DbIsNullExpression e, bool negate)
    {
      SqlBuilder result = new SqlBuilder();
      result.Append(e.Argument.Accept(this));
      if (!negate)
      {
        result.Append(" IS NULL");
      }
      else
      {
        result.Append(" IS NOT NULL");
      }

      return result;
    }

    /// <summary>
    /// This handles the processing of join expressions.
    /// The extents on a left spine are flattened, while joins
    /// not on the left spine give rise to new nested sub queries.
    ///
    /// Joins work differently from the rest of the visiting, in that
    /// the parent (i.e. the join node) creates the SqlSelectStatement
    /// for the children to use.
    ///
    /// The "parameter" IsInJoinContext indicates whether a child extent should
    /// add its stuff to the existing SqlSelectStatement, or create a new SqlSelectStatement
    /// By passing true, we ask the children to add themselves to the parent join,
    /// by passing false, we ask the children to create new Select statements for
    /// themselves.
    ///
    /// This method is called from <see cref="Visit(DbApplyExpression)"/> and
    /// <see cref="Visit(DbJoinExpression)"/>.
    /// </summary>
    /// <param name="inputs"></param>
    /// <param name="joinKind"></param>
    /// <param name="joinString"></param>
    /// <param name="joinCondition"></param>
    /// <returns> A <see cref="SqlSelectStatement"/></returns>
    ISqlFragment VisitJoinExpression(IList<DbExpressionBinding> inputs, DbExpressionKind joinKind,
        string joinString, DbExpression joinCondition)
    {
      SqlSelectStatement result;
      // If the parent is not a join( or says that it is not),
      // we should create a new SqlSelectStatement.
      // otherwise, we add our child extents to the parent's FROM clause.
      if (!IsParentAJoin)
      {
        result = new SqlSelectStatement();
        result.AllJoinExtents = new List<Symbol>();
        selectStatementStack.Push(result);
      }
      else
      {
        result = CurrentSelectStatement;
      }

      // Process each of the inputs, and then the joinCondition if it exists.
      // It would be nice if we could call VisitInputExpression - that would
      // avoid some code duplication
      // but the Join postprocessing is messy and prevents this reuse.
      symbolTable.EnterScope();

      string separator = String.Empty;
      bool isLeftMostInput = true;
      int inputCount = inputs.Count;
      for (int idx = 0; idx < inputCount; idx++)
      {
        DbExpressionBinding input = inputs[idx];

        if (separator != String.Empty)
        {
          result.From.AppendLine();
        }
        result.From.Append(separator + " ");
        // Change this if other conditions are required
        // to force the child to produce a nested SqlStatement.
        bool needsJoinContext = (input.Expression.ExpressionKind == DbExpressionKind.Scan)
                                || (isLeftMostInput &&
                                    (IsJoinExpression(input.Expression)
                                     || IsApplyExpression(input.Expression)))
                                ;

        isParentAJoinStack.Push(needsJoinContext ? true : false);
        // if the child reuses our select statement, it will append the from
        // symbols to our FromExtents list.  So, we need to remember the
        // start of the child's entries.
        int fromSymbolStart = result.FromExtents.Count;

        ISqlFragment fromExtentFragment = input.Expression.Accept(this);

        isParentAJoinStack.Pop();

        ProcessJoinInputResult(fromExtentFragment, result, input, fromSymbolStart);
        separator = joinString;

        isLeftMostInput = false;
      }

      // Visit the on clause/join condition.
      switch (joinKind)
      {
        case DbExpressionKind.FullOuterJoin:
        case DbExpressionKind.InnerJoin:
        case DbExpressionKind.LeftOuterJoin:
          result.From.Append(" ON ");
          isParentAJoinStack.Push(false);
          result.From.Append(joinCondition.Accept(this));
          isParentAJoinStack.Pop();
          break;
      }

      symbolTable.ExitScope();

      if (!IsParentAJoin)
      {
        selectStatementStack.Pop();
      }

      return result;
    }

    /// <summary>
    /// This is called from <see cref="VisitJoinExpression"/>.
    ///
    /// This is responsible for maintaining the symbol table after visiting
    /// a child of a join expression.
    ///
    /// The child's sql statement may need to be completed.
    ///
    /// The child's result could be one of
    /// <list type="number">
    /// <item>The same as the parent's - this is treated specially.</item>
    /// <item>A sql select statement, which may need to be completed</item>
    /// <item>An extent - just copy it to the from clause</item>
    /// <item>Anything else (from a collection-valued expression) -
    /// unnest and copy it.</item>
    /// </list>
    ///
    /// If the input was a Join, we need to create a new join symbol,
    /// otherwise, we create a normal symbol.
    ///
    /// We then call AddFromSymbol to add the AS clause, and update the symbol table.
    ///
    ///
    ///
    /// If the child's result was the same as the parent's, we have to clean up
    /// the list of symbols in the FromExtents list, since this contains symbols from
    /// the children of both the parent and the child.
    /// The happens when the child visited is a Join, and is the leftmost child of
    /// the parent.
    /// </summary>
    /// <param name="fromExtentFragment"></param>
    /// <param name="result"></param>
    /// <param name="input"></param>
    /// <param name="fromSymbolStart"></param>
    void ProcessJoinInputResult(ISqlFragment fromExtentFragment, SqlSelectStatement result,
        DbExpressionBinding input, int fromSymbolStart)
    {
      Symbol fromSymbol = null;

      if (result != fromExtentFragment)
      {
        // The child has its own select statement, and is not reusing
        // our select statement.
        // This should look a lot like VisitInputExpression().
        SqlSelectStatement sqlSelectStatement = fromExtentFragment as SqlSelectStatement;
        if (sqlSelectStatement != null)
        {
          if (sqlSelectStatement.Select.IsEmpty)
          {
            List<Symbol> columns = AddDefaultColumns(sqlSelectStatement);

            if (IsJoinExpression(input.Expression)
                || IsApplyExpression(input.Expression))
            {
              List<Symbol> extents = sqlSelectStatement.FromExtents;
              JoinSymbol newJoinSymbol = new JoinSymbol(input.VariableName, input.VariableType, extents);
              newJoinSymbol.IsNestedJoin = true;
              newJoinSymbol.ColumnList = columns;

              fromSymbol = newJoinSymbol;
            }
            else
            {
              // this is a copy of the code in CreateNewSelectStatement.

              // if the oldStatement has a join as its input, ...
              // clone the join symbol, so that we "reuse" the
              // join symbol.  Normally, we create a new symbol - see the next block
              // of code.
              JoinSymbol oldJoinSymbol = sqlSelectStatement.FromExtents[0] as JoinSymbol;
              if (oldJoinSymbol != null)
              {
                // Note: sqlSelectStatement.FromExtents will not do, since it might
                // just be an alias of joinSymbol, and we want an actual JoinSymbol.
                JoinSymbol newJoinSymbol = new JoinSymbol(input.VariableName, input.VariableType, oldJoinSymbol.ExtentList);
                // This indicates that the sqlSelectStatement is a blocking scope
                // i.e. it hides/renames extent columns
                newJoinSymbol.IsNestedJoin = true;
                newJoinSymbol.ColumnList = columns;
                newJoinSymbol.FlattenedExtentList = oldJoinSymbol.FlattenedExtentList;

                fromSymbol = newJoinSymbol;
              }
            }

          }
          result.From.Append(" (");
          result.From.Append(sqlSelectStatement);
          result.From.Append(" )");
        }
        else if (input.Expression is DbScanExpression)
        {
          result.From.Append(fromExtentFragment);
        }
        else // bracket it
        {
          WrapNonQueryExtent(result, fromExtentFragment, input.Expression.ExpressionKind);
        }

        if (fromSymbol == null) // i.e. not a join symbol
        {
          fromSymbol = new Symbol(input.VariableName, input.VariableType);
        }


        AddFromSymbol(result, input.VariableName, fromSymbol);
        result.AllJoinExtents.Add(fromSymbol);
      }
      else // result == fromExtentFragment.  The child extents have been merged into the parent's.
      {
        // we are adding extents to the current sql statement via flattening.
        // We are replacing the child's extents with a single Join symbol.
        // The child's extents are all those following the index fromSymbolStart.
        //
        List<Symbol> extents = new List<Symbol>();

        // We cannot call extents.AddRange, since the is no simple way to
        // get the range of symbols fromSymbolStart..result.FromExtents.Count
        // from result.FromExtents.
        // We copy these symbols to create the JoinSymbol later.
        for (int i = fromSymbolStart; i < result.FromExtents.Count; ++i)
        {
          extents.Add(result.FromExtents[i]);
        }
        result.FromExtents.RemoveRange(fromSymbolStart, result.FromExtents.Count - fromSymbolStart);
        fromSymbol = new JoinSymbol(input.VariableName, input.VariableType, extents);
        result.FromExtents.Add(fromSymbol);
        // this Join Symbol does not have its own select statement, so we
        // do not set IsNestedJoin


        // We do not call AddFromSymbol(), since we do not want to add
        // "AS alias" to the FROM clause- it has been done when the extent was added earlier.
        symbolTable.Add(input.VariableName, fromSymbol);
      }
    }

    /// <summary>
    /// We assume that this is only called as a child of a Project.
    ///
    /// This replaces <see cref="Visit(DbNewInstanceExpression)"/>, since
    /// we do not allow DbNewInstanceExpression as a child of any node other than
    /// DbProjectExpression.
    ///
    /// We write out the translation of each of the columns in the record.
    /// </summary>
    /// <param name="e"></param>
    /// <returns>A <see cref="SqlBuilder"/></returns>
    ISqlFragment VisitNewInstanceExpression(DbNewInstanceExpression e)
    {
      SqlBuilder result = new SqlBuilder();
      RowType rowType = e.ResultType.EdmType as RowType;

      if (null != rowType)
      {
        //_typeDefs.Length = 0;
        ReadOnlyMetadataCollection<EdmProperty> members = rowType.Properties;
        string separator = String.Empty;
        for (int i = 0; i < e.Arguments.Count; ++i)
        {
          DbExpression argument = e.Arguments[i];
          if (MetadataHelpers.IsRowType(argument.ResultType))
          {
            // We do not support nested records or other complex objects.
            throw new NotSupportedException();
          }

          EdmProperty member = members[i];
          //_typeDefs.Append(separator);
          //_typeDefs.Append(GetSqlPrimitiveType(member.TypeUsage));
          result.Append(separator);
          result.AppendLine();
          result.Append(argument.Accept(this));
          result.Append(" AS ");
          result.Append(QuoteIdentifier(member.Name));
          separator = ", ";
        }
      }
      else
      {
        //
        // Types other then RowType (such as UDTs for instance) are not supported.
        //
        throw new NotSupportedException();
      }

      return result;
    }

    ISqlFragment VisitSetOpExpression(DbExpression left, DbExpression right, string separator)
    {

      SqlSelectStatement leftSelectStatement = VisitExpressionEnsureSqlStatement(left);
      bool leftOrderByLimitOrOffset = leftSelectStatement.HaveOrderByLimitOrOffset();
      SqlSelectStatement rightSelectStatement = VisitExpressionEnsureSqlStatement(right);
      bool rightOrderByLimitOrOffset = rightSelectStatement.HaveOrderByLimitOrOffset();

      SqlBuilder setStatement = new SqlBuilder();

      if (leftOrderByLimitOrOffset)
          setStatement.Append("SELECT * FROM (");

      setStatement.Append(leftSelectStatement);

      if (leftOrderByLimitOrOffset)
          setStatement.Append(") ");

      setStatement.AppendLine();
      setStatement.Append(separator); // e.g. UNION ALL
      setStatement.AppendLine();

      if (rightOrderByLimitOrOffset)
          setStatement.Append("SELECT * FROM (");

      setStatement.Append(rightSelectStatement);

      if (rightOrderByLimitOrOffset)
          setStatement.Append(") ");

      return setStatement;
    }


    #endregion


    #region Function Handling Helpers
    /// <summary>
    /// Determines whether the given function is a built-in function that requires special handling
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    private bool IsSpecialBuiltInFunction(DbFunctionExpression e)
    {
      return IsBuiltinFunction(e.Function) && _builtInFunctionHandlers.ContainsKey(e.Function.Name);
    }

    /// <summary>
    /// Determines whether the given function is a canonical function that requires special handling
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    private bool IsSpecialCanonicalFunction(DbFunctionExpression e)
    {
      return MetadataHelpers.IsCanonicalFunction(e.Function) && _canonicalFunctionHandlers.ContainsKey(e.Function.Name);
    }

    /// <summary>
    /// Default handling for functions
    /// Translates them to FunctionName(arg1, arg2, ..., argn)
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    private ISqlFragment HandleFunctionDefault(DbFunctionExpression e)
    {
      SqlBuilder result = new SqlBuilder();
      WriteFunctionName(result, e.Function);
      HandleFunctionArgumentsDefault(e, result);
      return result;
    }

    /// <summary>
    /// Default handling for functions with a given name.
    /// Translates them to functionName(arg1, arg2, ..., argn)
    /// </summary>
    /// <param name="e"></param>
    /// <param name="functionName"></param>
    /// <returns></returns>
    private ISqlFragment HandleFunctionDefaultGivenName(DbFunctionExpression e, string functionName)
    {
      SqlBuilder result = new SqlBuilder();
      result.Append(functionName);
      HandleFunctionArgumentsDefault(e, result);
      return result;
    }

    /// <summary>
    /// Default handling on function arguments
    /// Appends the list of arguments to the given result
    /// If the function is niladic it does not append anything,
    /// otherwise it appends (arg1, arg2, ..., argn)
    /// </summary>
    /// <param name="e"></param>
    /// <param name="result"></param>
    private void HandleFunctionArgumentsDefault(DbFunctionExpression e, SqlBuilder result)
    {
      bool isNiladicFunction = MetadataHelpers.TryGetValueForMetadataProperty<bool>(e.Function, "NiladicFunctionAttribute");
      if (isNiladicFunction && e.Arguments.Count > 0)
      {
        throw new InvalidOperationException("Niladic functions cannot have parameters");
      }

      if (!isNiladicFunction)
      {
        result.Append("(");
        string separator = String.Empty;
        foreach (DbExpression arg in e.Arguments)
        {
          result.Append(separator);
          result.Append(arg.Accept(this));
          separator = ", ";
        }
        result.Append(")");
      }
    }

    /// <summary>
    /// Handler for special built in functions
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    private ISqlFragment HandleSpecialBuiltInFunction(DbFunctionExpression e)
    {
      return HandleSpecialFunction(_builtInFunctionHandlers, e);
    }

    /// <summary>
    /// Handler for special canonical functions
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    private ISqlFragment HandleSpecialCanonicalFunction(DbFunctionExpression e)
    {
      return HandleSpecialFunction(_canonicalFunctionHandlers, e);
    }

    /// <summary>
    /// Dispatches the special function processing to the appropriate handler
    /// </summary>
    /// <param name="handlers"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private ISqlFragment HandleSpecialFunction(Dictionary<string, FunctionHandler> handlers, DbFunctionExpression e)
    {
      if (!handlers.ContainsKey(e.Function.Name))
        throw new InvalidOperationException("Special handling should be called only for functions in the list of special functions");

      return handlers[e.Function.Name](this, e);
    }

    /// <summary>
    /// Handles functions that are translated into TSQL operators.
    /// The given function should have one or two arguments.
    /// Functions with one arguemnt are translated into
    ///     op arg
    /// Functions with two arguments are translated into
    ///     arg0 op arg1
    /// Also, the arguments can be optionaly enclosed in parethesis
    /// </summary>
    /// <param name="e"></param>
    /// <param name="parenthesiseArguments">Whether the arguments should be enclosed in parethesis</param>
    /// <returns></returns>
    private ISqlFragment HandleSpecialFunctionToOperator(DbFunctionExpression e, bool parenthesiseArguments)
    {
      SqlBuilder result = new SqlBuilder();
      Debug.Assert(e.Arguments.Count > 0 && e.Arguments.Count <= 2, "There should be 1 or 2 arguments for operator");

      if (e.Arguments.Count > 1)
      {
        if (parenthesiseArguments)
        {
          result.Append("(");
        }
        result.Append(e.Arguments[0].Accept(this));
        if (parenthesiseArguments)
        {
          result.Append(")");
        }
      }
      result.Append(" ");
      Debug.Assert(_functionNameToOperatorDictionary.ContainsKey(e.Function.Name), "The function can not be mapped to an operator");
      result.Append(_functionNameToOperatorDictionary[e.Function.Name]);
      result.Append(" ");

      if (parenthesiseArguments)
      {
        result.Append("(");
      }
      result.Append(e.Arguments[e.Arguments.Count - 1].Accept(this));
      if (parenthesiseArguments)
      {
        result.Append(")");
      }
      return result;
    }


    /// <summary>
    /// <see cref="HandleSpecialFunctionToOperator"></see>
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private static ISqlFragment HandleConcatFunction(SqlGenerator sqlgen, DbFunctionExpression e)
    {
      return sqlgen.HandleSpecialFunctionToOperator(e, false);
    }

    /// <summary>
    /// <see cref="HandleSpecialFunctionToOperator"></see>
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private static ISqlFragment HandleCanonicalFunctionBitwise(SqlGenerator sqlgen, DbFunctionExpression e)
    {
      return sqlgen.HandleSpecialFunctionToOperator(e, true);
    }

    private static ISqlFragment HandleGetDateFunction(SqlGenerator sqlgen, DbFunctionExpression e)
    {
      SqlBuilder result = new SqlBuilder();
      Debug.Assert(e.Arguments.Count == 0, "Canonical getdate function should have no arguments");

      switch (sqlgen._manifest._dateTimeFormat)
      {
        case SQLiteDateFormats.Ticks:
          result.Append("(STRFTIME('%s', 'now') * 10000000 + 621355968000000000)");
          break;
        case SQLiteDateFormats.JulianDay:
          result.Append("CAST(STRFTIME('%J', 'now') AS double)");
          break;
        default:
          result.Append("STRFTIME('%Y-%m-%d %H:%M:%S', 'now')");
          break;
      }

      return result;
    }

    private static ISqlFragment HandleGetUtcDateFunction(SqlGenerator sqlgen, DbFunctionExpression e)
    {
      SqlBuilder result = new SqlBuilder();
      Debug.Assert(e.Arguments.Count == 0, "Canonical getutcdate function should have no arguments");

      switch (sqlgen._manifest._dateTimeFormat)
      {
        case SQLiteDateFormats.Ticks:
          result.Append("(STRFTIME('%s', 'now', 'utc') * 10000000 + 621355968000000000)");
          break;
        case SQLiteDateFormats.JulianDay:
          result.Append("CAST(STRFTIME('%J', 'now', 'utc') AS double)");
          break;
        default:
          result.Append("STRFTIME('%Y-%m-%d %H:%M:%S', 'now', 'utc')");
          break;
      }

      return result;
    }

    /// <summary>
    /// Handles special case in which datepart 'type' parameter is present. all the functions
    /// handles here have *only* the 1st parameter as datepart. datepart value is passed along
    /// the QP as string and has to be expanded as TSQL keyword.
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private static ISqlFragment HandleDatepartDateFunction(SqlGenerator sqlgen, DbFunctionExpression e)
    {
      Debug.Assert(e.Arguments.Count == 2, "datepart function must have 2 arguments");

      DbConstantExpression constExpr = e.Arguments[0] as DbConstantExpression;
      if (null == constExpr)
      {
        throw new InvalidOperationException(String.Format("DATEPART argument to function '{0}.{1}' must be a literal string", e.Function.NamespaceName, e.Function.Name));
      }

      string datepart = constExpr.Value as string;
      if (null == datepart)
      {
        throw new InvalidOperationException(String.Format("DATEPART argument to function '{0}.{1}' must be a literal string", e.Function.NamespaceName, e.Function.Name));
      }

      SqlBuilder result = new SqlBuilder();

      //
      // check if datepart value is valid
      //
      string trans;
      if (!_datepartKeywords.TryGetValue(datepart, out trans))
      {
        throw new InvalidOperationException(String.Format("{0}' is not a valid value for DATEPART argument in '{1}.{2}' function", datepart, e.Function.NamespaceName, e.Function.Name));
      }

      if (trans != "%f")
      {
        result.Append("CAST(STRFTIME('");

        // expand the datepart literal as tsql kword
        result.Append(trans);
        result.Append("', ");

        switch (sqlgen._manifest._dateTimeFormat)
        {
          case SQLiteDateFormats.Ticks:
            result.Append(String.Format("(({0} - 621355968000000000) / 10000000.0)", e.Arguments[1].Accept(sqlgen)));
            break;
          default:
            result.Append(e.Arguments[1].Accept(sqlgen));
            break;
        }

        result.Append(") AS integer)");
      }
      else
      {
        result.Append("CAST(SUBSTR(STRFTIME('%f', ");

        switch (sqlgen._manifest._dateTimeFormat)
        {
          case SQLiteDateFormats.Ticks:
            result.Append(String.Format("(({0} - 621355968000000000) / 10000000.0)", e.Arguments[1].Accept(sqlgen)));
            break;
          default:
            result.Append(e.Arguments[1].Accept(sqlgen));
            break;
        }

        result.Append("), 4) AS integer)");
      }

      return result;
    }

    /// <summary>
    /// DateAdd(datetime, secondsToAdd) -> DATEADD ( seconds , number,  date)
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private static ISqlFragment HandleCanonicalFunctionDateAdd(SqlGenerator sqlgen, DbFunctionExpression e)
    {
      SqlBuilder result = new SqlBuilder();
      Debug.Assert(e.Arguments.Count == 2, "Canonical datepart functions should have exactly two arguments");

      switch (sqlgen._manifest._dateTimeFormat)
      {
        case SQLiteDateFormats.Ticks:
          result.Append(String.Format("(STRFTIME('%s', JULIANDAY({1}) + ({0} / 86400.0)) * 10000000 + 621355968000000000)", e.Arguments[0].Accept(sqlgen), e.Arguments[1].Accept(sqlgen)));
          break;
        case SQLiteDateFormats.JulianDay:
          result.Append(String.Format("CAST(STRFTIME('%J', JULIANDAY({1}) + ({0} / 86400.0)) AS double)", e.Arguments[0].Accept(sqlgen), e.Arguments[1].Accept(sqlgen)));
          break;
        default:
          result.Append(String.Format("STRFTIME('%Y-%m-%d %H:%M:%S', JULIANDAY({1}) + ({0} / 86400.0))", e.Arguments[0].Accept(sqlgen), e.Arguments[1].Accept(sqlgen)));
          break;
      }

      return result;
    }

    /// <summary>
    /// DateSubtract(datetime1, datetime2) -> DATEDIFF ( seconds , startdate , enddate )
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private static ISqlFragment HandleCanonicalFunctionDateSubtract(SqlGenerator sqlgen, DbFunctionExpression e)
    {
      SqlBuilder result = new SqlBuilder();
      Debug.Assert(e.Arguments.Count == 2, "Canonical datepart functions should have exactly two arguments");

      switch (sqlgen._manifest._dateTimeFormat)
      {
        case SQLiteDateFormats.Ticks:
          result.Append(String.Format("CAST((({0} - 621355968000000000) / 10000000.0)  - (({1} - 621355968000000000) / 10000000.0) * 86400.0 AS integer)", e.Arguments[0].Accept(sqlgen), e.Arguments[1].Accept(sqlgen)));
          break;
        default:
          result.Append(String.Format("CAST((JULIANDAY({1}) - JULIANDAY({0})) * 86400.0 AS integer)", e.Arguments[0].Accept(sqlgen), e.Arguments[1].Accept(sqlgen)));
          break;
      }

      return result;
    }

    /// <summary>
    /// Handler for canonical functions for extracting date parts.
    /// For example:
    ///     Year(date) -> DATEPART( year, date)
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private static ISqlFragment HandleCanonicalFunctionDatepart(SqlGenerator sqlgen, DbFunctionExpression e)
    {
      string trans;
      if (!_datepartKeywords.TryGetValue(e.Function.Name, out trans))
      {
        throw new InvalidOperationException(String.Format("{0}' is not a valid value for STRFTIME argument", e.Function.Name));
      }

      SqlBuilder result = new SqlBuilder();
      result.Append("CAST(STRFTIME('");
      result.Append(trans);
      result.Append("', ");

      Debug.Assert(e.Arguments.Count == 1, "Canonical datepart functions should have exactly one argument");

      switch (sqlgen._manifest._dateTimeFormat)
      {
        case SQLiteDateFormats.Ticks:
          result.Append(String.Format("(({0} - 621355968000000000) / 10000000.0)", e.Arguments[0].Accept(sqlgen)));
          break;
        default:
          result.Append(e.Arguments[0].Accept(sqlgen));
          break;
      }

      result.Append(") AS integer)");

      return result;
    }

#if USE_INTEROP_DLL && INTEROP_EXTENSION_FUNCTIONS
    /// <summary>
    ///  Function rename IndexOf -> CHARINDEX
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private static ISqlFragment HandleCanonicalFunctionIndexOf(SqlGenerator sqlgen, DbFunctionExpression e)
    {
      return sqlgen.HandleFunctionDefaultGivenName(e, "CHARINDEX");
    }
#endif

    /// <summary>
    ///  Function rename NewGuid -> NEWID
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private static ISqlFragment HandleCanonicalFunctionNewGuid(SqlGenerator sqlgen, DbFunctionExpression e)
    {
      SqlBuilder result = new SqlBuilder();
      result.Append("RANDOMBLOB(16)");
      return result;
    }

    /// <summary>
    ///  Length(arg) -> LEN(arg + '.') - LEN('.')
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private static ISqlFragment HandleCanonicalFunctionLength(SqlGenerator sqlgen, DbFunctionExpression e)
    {
      SqlBuilder result = new SqlBuilder();

      result.Append("LENGTH(");

      Debug.Assert(e.Arguments.Count == 1, "Len should have one argument");
      result.Append(e.Arguments[0].Accept(sqlgen));

      result.Append(")");
      //result.Append(" + '.') - LEN('.')");

      return result;
    }

    /// <summary>
    /// Round(numericExpression) -> Round(numericExpression, 0);
    /// Round(numericExpression, N) -> Round(numericExpression, N);
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private static ISqlFragment HandleCanonicalFunctionRound(SqlGenerator sqlgen, DbFunctionExpression e)
    {
      SqlBuilder result = new SqlBuilder();

      result.Append("ROUND(");

      Debug.Assert(e.Arguments.Count == 1 || e.Arguments.Count == 2, "Round should have one or two arguments");
      result.Append(e.Arguments[0].Accept(sqlgen));

      if (e.Arguments.Count == 2)
      {
        result.Append(", ");
        result.Append(e.Arguments[1].Accept(sqlgen));
        result.Append(")");
      }
      else
      {
        result.Append(", 0)");
      }

      return result;
    }

    /// <summary>
    /// TRIM(string) -> LTRIM(RTRIM(string))
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private static ISqlFragment HandleCanonicalFunctionTrim(SqlGenerator sqlgen, DbFunctionExpression e)
    {
      SqlBuilder result = new SqlBuilder();

      result.Append("TRIM(");

      Debug.Assert(e.Arguments.Count == 1, "Trim should have one argument");
      result.Append(e.Arguments[0].Accept(sqlgen));

      result.Append(")");

      return result;
    }

    /// <summary>
    /// LEFT(string, length) -> SUBSTR(string, 1, length)
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private static ISqlFragment HandleCanonicalFunctionLeft(SqlGenerator sqlgen, DbFunctionExpression e)
    {
        SqlBuilder result = new SqlBuilder();

        result.Append("SUBSTR(");

        Debug.Assert(e.Arguments.Count == 2, "Left should have two arguments");
        result.Append(e.Arguments[0].Accept(sqlgen));
        result.Append(", 1, ");
        result.Append(e.Arguments[1].Accept(sqlgen));
        result.Append(")");

        return result;
    }

    /// <summary>
    /// RIGHT(string, length) -> SUBSTR(string, -(length), length)
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private static ISqlFragment HandleCanonicalFunctionRight(SqlGenerator sqlgen, DbFunctionExpression e)
    {
        SqlBuilder result = new SqlBuilder();

        result.Append("SUBSTR(");

        Debug.Assert(e.Arguments.Count == 2, "Right should have two arguments");
        result.Append(e.Arguments[0].Accept(sqlgen));
        result.Append(", -(");
        result.Append(e.Arguments[1].Accept(sqlgen));
        result.Append("), ");
        result.Append(e.Arguments[1].Accept(sqlgen));
        result.Append(")");

        return result;
    }

    /// <summary>
    /// SUBSTRING(string, start) -> SUBSTR(string, start)
    /// SUBSTRING(string, start, length) -> SUBSTR(string, start, length)
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private static ISqlFragment HandleCanonicalFunctionSubstring(SqlGenerator sqlgen, DbFunctionExpression e)
    {
        SqlBuilder result = new SqlBuilder();

        result.Append("SUBSTR(");

        Debug.Assert(e.Arguments.Count == 2 || e.Arguments.Count == 3, "Substring should have two or three arguments");
        result.Append(e.Arguments[0].Accept(sqlgen));
        result.Append(", ");
        result.Append(e.Arguments[1].Accept(sqlgen));

        if (e.Arguments.Count == 3)
        {
            result.Append(", ");
            result.Append(e.Arguments[2].Accept(sqlgen));
        }

        result.Append(")");

        return result;
    }

    /// <summary>
    ///  Function rename ToLower -> LOWER
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private static ISqlFragment HandleCanonicalFunctionToLower(SqlGenerator sqlgen, DbFunctionExpression e)
    {
      return sqlgen.HandleFunctionDefaultGivenName(e, "LOWER");
    }

    /// <summary>
    ///  Function rename ToUpper -> UPPER
    /// </summary>
    /// <param name="sqlgen"></param>
    /// <param name="e"></param>
    /// <returns></returns>
    private static ISqlFragment HandleCanonicalFunctionToUpper(SqlGenerator sqlgen, DbFunctionExpression e)
    {
      return sqlgen.HandleFunctionDefaultGivenName(e, "UPPER");
    }

    #endregion


    #endregion

    #region Helper methods for the DbExpressionVisitor
    /// <summary>
    /// <see cref="AddDefaultColumns"/>
    /// Add the column names from the referenced extent/join to the
    /// select statement.
    ///
    /// If the symbol is a JoinSymbol, we recursively visit all the extents,
    /// halting at real extents and JoinSymbols that have an associated SqlSelectStatement.
    ///
    /// The column names for a real extent can be derived from its type.
    /// The column names for a Join Select statement can be got from the
    /// list of columns that was created when the Join's select statement
    /// was created.
    ///
    /// We do the following for each column.
    /// <list type="number">
    /// <item>Add the SQL string for each column to the SELECT clause</item>
    /// <item>Add the column to the list of columns - so that it can
    /// become part of the "type" of a JoinSymbol</item>
    /// <item>Check if the column name collides with a previous column added
    /// to the same select statement.  Flag both the columns for renaming if true.</item>
    /// <item>Add the column to a name lookup dictionary for collision detection.</item>
    /// </list>
    /// </summary>
    /// <param name="selectStatement">The select statement that started off as SELECT *</param>
    /// <param name="symbol">The symbol containing the type information for
    /// the columns to be added.</param>
    /// <param name="columnList">Columns that have been added to the Select statement.
    /// This is created in <see cref="AddDefaultColumns"/>.</param>
    /// <param name="columnDictionary">A dictionary of the columns above.</param>
    /// <param name="separator">Comma or nothing, depending on whether the SELECT
    /// clause is empty.</param>
    void AddColumns(SqlSelectStatement selectStatement, Symbol symbol,
        List<Symbol> columnList, Dictionary<string, Symbol> columnDictionary, ref string separator)
    {
      JoinSymbol joinSymbol = symbol as JoinSymbol;
      if (joinSymbol != null)
      {
        if (!joinSymbol.IsNestedJoin)
        {
          // Recurse if the join symbol is a collection of flattened extents
          foreach (Symbol sym in joinSymbol.ExtentList)
          {
            // if sym is ScalarType means we are at base case in the
            // recursion and there are not columns to add, just skip
            if (MetadataHelpers.IsPrimitiveType(sym.Type))
            {
              continue;
            }

            AddColumns(selectStatement, sym, columnList, columnDictionary, ref separator);
          }
        }
        else
        {
          foreach (Symbol joinColumn in joinSymbol.ColumnList)
          {
            // we write tableName.columnName
            // rather than tableName.columnName as alias
            // since the column name is unique (by the way we generate new column names)
            //
            // We use the symbols for both the table and the column,
            // since they are subject to renaming.
            selectStatement.Select.Append(separator);
            selectStatement.Select.Append(symbol);
            selectStatement.Select.Append(".");
            selectStatement.Select.Append(joinColumn);

            // check for name collisions.  If there is,
            // flag both the colliding symbols.
            if (columnDictionary.ContainsKey(joinColumn.Name))
            {
              columnDictionary[joinColumn.Name].NeedsRenaming = true; // the original symbol
              joinColumn.NeedsRenaming = true; // the current symbol.
            }
            else
            {
              columnDictionary[joinColumn.Name] = joinColumn;
            }

            columnList.Add(joinColumn);

            separator = ", ";
          }
        }
      }
      else
      {
        // This is a non-join extent/select statement, and the CQT type has
        // the relevant column information.

        // The type could be a record type(e.g. Project(...),
        // or an entity type ( e.g. EntityExpression(...)
        // so, we check whether it is a structuralType.

        // Consider an expression of the form J(a, b=P(E))
        // The inner P(E) would have been translated to a SQL statement
        // We should not use the raw names from the type, but the equivalent
        // symbols (they are present in symbol.Columns) if they exist.
        //
        // We add the new columns to the symbol's columns if they do
        // not already exist.
        //

        foreach (EdmProperty property in MetadataHelpers.GetProperties(symbol.Type))
        {
          string recordMemberName = property.Name;
          // Since all renaming happens in the second phase
          // we lose nothing by setting the next column name index to 0
          // many times.
          allColumnNames[recordMemberName] = 0;

          // Create a new symbol/reuse existing symbol for the column
          Symbol columnSymbol;
          if (!symbol.Columns.TryGetValue(recordMemberName, out columnSymbol))
          {
            // we do not care about the types of columns, so we pass null
            // when construction the symbol.
            columnSymbol = new Symbol(recordMemberName, null);
            symbol.Columns.Add(recordMemberName, columnSymbol);
          }

          selectStatement.Select.Append(separator);
          selectStatement.Select.Append(symbol);
          selectStatement.Select.Append(".");

          // We use the actual name before the "AS", the new name goes
          // after the AS.
          selectStatement.Select.Append(QuoteIdentifier(recordMemberName));

          selectStatement.Select.Append(" AS ");
          selectStatement.Select.Append(columnSymbol);

          // Check for column name collisions.
          if (columnDictionary.ContainsKey(recordMemberName))
          {
            columnDictionary[recordMemberName].NeedsRenaming = true;
            columnSymbol.NeedsRenaming = true;
          }
          else
          {
            columnDictionary[recordMemberName] = symbol.Columns[recordMemberName];
          }

          columnList.Add(columnSymbol);

          separator = ", ";
        }
      }
    }

    /// <summary>
    /// Expands Select * to "select the_list_of_columns"
    /// If the columns are taken from an extent, they are written as
    /// {original_column_name AS Symbol(original_column)} to allow renaming.
    ///
    /// If the columns are taken from a Join, they are written as just
    /// {original_column_name}, since there cannot be a name collision.
    ///
    /// We concatenate the columns from each of the inputs to the select statement.
    /// Since the inputs may be joins that are flattened, we need to recurse.
    /// The inputs are inferred from the symbols in FromExtents.
    /// </summary>
    /// <param name="selectStatement"></param>
    /// <returns></returns>
    List<Symbol> AddDefaultColumns(SqlSelectStatement selectStatement)
    {
      // This is the list of columns added in this select statement
      // This forms the "type" of the Select statement, if it has to
      // be expanded in another SELECT *
      List<Symbol> columnList = new List<Symbol>();

      // A lookup for the previous set of columns to aid column name
      // collision detection.
      Dictionary<string, Symbol> columnDictionary = new Dictionary<string, Symbol>(StringComparer.OrdinalIgnoreCase);

      string separator = String.Empty;
      // The Select should usually be empty before we are called,
      // but we do not mind if it is not.
      if (!selectStatement.Select.IsEmpty)
      {
        separator = ", ";
      }

      foreach (Symbol symbol in selectStatement.FromExtents)
      {
        AddColumns(selectStatement, symbol, columnList, columnDictionary, ref separator);
      }

      return columnList;
    }

    /// <summary>
    /// <see cref="AddFromSymbol(SqlSelectStatement, string, Symbol, bool)"/>
    /// </summary>
    /// <param name="selectStatement"></param>
    /// <param name="inputVarName"></param>
    /// <param name="fromSymbol"></param>
    void AddFromSymbol(SqlSelectStatement selectStatement, string inputVarName, Symbol fromSymbol)
    {
      AddFromSymbol(selectStatement, inputVarName, fromSymbol, true);
    }

    /// <summary>
    /// This method is called after the input to a relational node is visited.
    /// <see cref="Visit(DbProjectExpression)"/> and <see cref="ProcessJoinInputResult"/>
    /// There are 2 scenarios
    /// <list type="number">
    /// <item>The fromSymbol is new i.e. the select statement has just been
    /// created, or a join extent has been added.</item>
    /// <item>The fromSymbol is old i.e. we are reusing a select statement.</item>
    /// </list>
    ///
    /// If we are not reusing the select statement, we have to complete the
    /// FROM clause with the alias
    /// <code>
    /// -- if the input was an extent
    /// FROM = [SchemaName].[TableName]
    /// -- if the input was a Project
    /// FROM = (SELECT ... FROM ... WHERE ...)
    /// </code>
    ///
    /// These become
    /// <code>
    /// -- if the input was an extent
    /// FROM = [SchemaName].[TableName] AS alias
    /// -- if the input was a Project
    /// FROM = (SELECT ... FROM ... WHERE ...) AS alias
    /// </code>
    /// and look like valid FROM clauses.
    ///
    /// Finally, we have to add the alias to the global list of aliases used,
    /// and also to the current symbol table.
    /// </summary>
    /// <param name="selectStatement"></param>
    /// <param name="inputVarName">The alias to be used.</param>
    /// <param name="fromSymbol"></param>
    /// <param name="addToSymbolTable"></param>
    void AddFromSymbol(SqlSelectStatement selectStatement, string inputVarName, Symbol fromSymbol, bool addToSymbolTable)
    {
      // the first check is true if this is a new statement
      // the second check is true if we are in a join - we do not
      // check if we are in a join context.
      // We do not want to add "AS alias" if it has been done already
      // e.g. when we are reusing the Sql statement.
      if (selectStatement.FromExtents.Count == 0 || fromSymbol != selectStatement.FromExtents[0])
      {
        selectStatement.FromExtents.Add(fromSymbol);
        selectStatement.From.Append(" AS ");
        selectStatement.From.Append(fromSymbol);

        // We have this inside the if statement, since
        // we only want to add extents that are actually used.
        allExtentNames[fromSymbol.Name] = 0;
      }

      if (addToSymbolTable)
      {
        symbolTable.Add(inputVarName, fromSymbol);
      }
    }

    /// <summary>
    /// Translates a list of SortClauses.
    /// Used in the translation of OrderBy
    /// </summary>
    /// <param name="orderByClause">The SqlBuilder to which the sort keys should be appended</param>
    /// <param name="sortKeys"></param>
    void AddSortKeys(SqlBuilder orderByClause, IList<DbSortClause> sortKeys)
    {
      string separator = String.Empty;
      foreach (DbSortClause sortClause in sortKeys)
      {
        orderByClause.Append(separator);
        orderByClause.Append(sortClause.Expression.Accept(this));
        Debug.Assert(sortClause.Collation != null);
        if (!String.IsNullOrEmpty(sortClause.Collation))
        {
          orderByClause.Append(" COLLATE ");
          orderByClause.Append(sortClause.Collation);
        }

        orderByClause.Append(sortClause.Ascending ? " ASC" : " DESC");

        separator = ", ";
      }
    }

    /// <summary>
    /// <see cref="CreateNewSelectStatement(SqlSelectStatement, string, TypeUsage, bool, out Symbol) " />
    /// </summary>
    /// <param name="oldStatement"></param>
    /// <param name="inputVarName"></param>
    /// <param name="inputVarType"></param>
    /// <param name="fromSymbol"></param>
    /// <returns>A new select statement, with the old one as the from clause.</returns>
    SqlSelectStatement CreateNewSelectStatement(SqlSelectStatement oldStatement,
        string inputVarName, TypeUsage inputVarType, out Symbol fromSymbol)
    {
      return CreateNewSelectStatement(oldStatement, inputVarName, inputVarType, true, out fromSymbol);
    }


    /// <summary>
    /// This is called after a relational node's input has been visited, and the
    /// input's sql statement cannot be reused.  <see cref="Visit(DbProjectExpression)"/>
    ///
    /// When the input's sql statement cannot be reused, we create a new sql
    /// statement, with the old one as the from clause of the new statement.
    ///
    /// The old statement must be completed i.e. if it has an empty select list,
    /// the list of columns must be projected out.
    ///
    /// If the old statement being completed has a join symbol as its from extent,
    /// the new statement must have a clone of the join symbol as its extent.
    /// We cannot reuse the old symbol, but the new select statement must behave
    /// as though it is working over the "join" record.
    /// </summary>
    /// <param name="oldStatement"></param>
    /// <param name="inputVarName"></param>
    /// <param name="inputVarType"></param>
    /// <param name="finalizeOldStatement"></param>
    /// <param name="fromSymbol"></param>
    /// <returns>A new select statement, with the old one as the from clause.</returns>
    SqlSelectStatement CreateNewSelectStatement(SqlSelectStatement oldStatement,
        string inputVarName, TypeUsage inputVarType, bool finalizeOldStatement, out Symbol fromSymbol)
    {
      fromSymbol = null;

      // Finalize the old statement
      if (finalizeOldStatement && oldStatement.Select.IsEmpty)
      {
        List<Symbol> columns = AddDefaultColumns(oldStatement);

        // Thid could not have been called from a join node.
        Debug.Assert(oldStatement.FromExtents.Count == 1);

        // if the oldStatement has a join as its input, ...
        // clone the join symbol, so that we "reuse" the
        // join symbol.  Normally, we create a new symbol - see the next block
        // of code.
        JoinSymbol oldJoinSymbol = oldStatement.FromExtents[0] as JoinSymbol;
        if (oldJoinSymbol != null)
        {
          // Note: oldStatement.FromExtents will not do, since it might
          // just be an alias of joinSymbol, and we want an actual JoinSymbol.
          JoinSymbol newJoinSymbol = new JoinSymbol(inputVarName, inputVarType, oldJoinSymbol.ExtentList);
          // This indicates that the oldStatement is a blocking scope
          // i.e. it hides/renames extent columns
          newJoinSymbol.IsNestedJoin = true;
          newJoinSymbol.ColumnList = columns;
          newJoinSymbol.FlattenedExtentList = oldJoinSymbol.FlattenedExtentList;

          fromSymbol = newJoinSymbol;
        }
      }

      if (fromSymbol == null)
      {
        // This is just a simple extent/SqlSelectStatement,
        // and we can get the column list from the type.
        fromSymbol = new Symbol(inputVarName, inputVarType);
      }

      // Observe that the following looks like the body of Visit(ExtentExpression).
      SqlSelectStatement selectStatement = new SqlSelectStatement();
      selectStatement.From.Append("( ");
      selectStatement.From.Append(oldStatement);
      selectStatement.From.AppendLine();
      selectStatement.From.Append(") ");


      return selectStatement;
    }

    /// <summary>
    /// Determines if values of the specified <see cref="SQLiteDateFormats" />
    /// require wrapping in single quotes.
    /// </summary>
    /// <param name="format">
    /// The <see cref="SQLiteDateFormats" /> format.
    /// </param>
    /// <returns>
    /// Non-zero if single quotes are required for a value in the specified
    /// <see cref="SQLiteDateFormats" />.
    /// </returns>
    private static bool NeedSingleQuotes(
        SQLiteDateFormats format
        )
    {
        return format != SQLiteDateFormats.Ticks &&
            format != SQLiteDateFormats.JulianDay &&
            format != SQLiteDateFormats.UnixEpoch;
    }

    /// <summary>
    /// Before we embed a string literal in a SQL string, we should
    /// convert all ' to '', and enclose the whole string in single quotes.
    /// </summary>
    /// <param name="s"></param>
    /// <param name="isUnicode"></param>
    /// <returns>The escaped sql string.</returns>
    private static string EscapeSingleQuote(string s, bool isUnicode)
    {
      return "'" + s.Replace("'", "''") + "'";
    }

    /// <summary>
    /// Returns the sql primitive/native type name.
    /// It will include size, precision or scale depending on type information present in the
    /// type facets
    /// </summary>
    /// <param name="type"></param>
    /// <returns></returns>
    private string GetSqlPrimitiveType(TypeUsage type)
    {
      PrimitiveType primitiveType = MetadataHelpers.GetEdmType<PrimitiveType>(type);

      string typeName = primitiveType.Name;
      bool isUnicode = true;
      bool isFixedLength = false;
      int maxLength = 0;
      string length = "max";
      bool preserveSeconds = true;
      byte decimalPrecision = 0;
      byte decimalScale = 0;

      switch (primitiveType.PrimitiveTypeKind)
      {
        case PrimitiveTypeKind.Binary:
          maxLength = MetadataHelpers.GetFacetValueOrDefault<int>(type, MetadataHelpers.MaxLengthFacetName, MetadataHelpers.BinaryMaxMaxLength);
          if (maxLength == MetadataHelpers.BinaryMaxMaxLength)
          {
            length = "max";
          }
          else
          {
            length = maxLength.ToString(CultureInfo.InvariantCulture);
          }
          isFixedLength = MetadataHelpers.GetFacetValueOrDefault<bool>(type, MetadataHelpers.FixedLengthFacetName, false);
          typeName = (isFixedLength ? "binary(" : "varbinary(") + length + ")";
          break;

        case PrimitiveTypeKind.String:
          // Question: How do we handle ntext?
          isUnicode = MetadataHelpers.GetFacetValueOrDefault<bool>(type, MetadataHelpers.UnicodeFacetName, true);
          isFixedLength = MetadataHelpers.GetFacetValueOrDefault<bool>(type, MetadataHelpers.FixedLengthFacetName, false);
          maxLength = MetadataHelpers.GetFacetValueOrDefault<int>(type, MetadataHelpers.MaxLengthFacetName, Int32.MinValue);
          if (maxLength == Int32.MinValue)
          {
            length = "max";
          }
          else
          {
            length = maxLength.ToString(CultureInfo.InvariantCulture);
          }
          if (isUnicode && !isFixedLength && maxLength > 4000)
            length = "max";
          if (!isUnicode && !isFixedLength && maxLength > 8000)
            length = "max";
          if (isFixedLength)
          {
            typeName = (isUnicode ? "nchar(" : "char(") + length + ")";
          }
          else
          {
            typeName = (isUnicode ? "nvarchar(" : "varchar(") + length + ")";
          }
          break;

        case PrimitiveTypeKind.DateTime:
          preserveSeconds = MetadataHelpers.GetFacetValueOrDefault<bool>(type, MetadataHelpers.PreserveSecondsFacetName, false);
          typeName = preserveSeconds ? "datetime" : "smalldatetime";
          break;

        case PrimitiveTypeKind.Decimal:
          decimalPrecision = MetadataHelpers.GetFacetValueOrDefault<byte>(type, MetadataHelpers.PrecisionFacetName, 18);
          Debug.Assert(decimalPrecision > 0, "decimal precision must be greater than zero");
          decimalScale = MetadataHelpers.GetFacetValueOrDefault<byte>(type, MetadataHelpers.ScaleFacetName, 0);
          Debug.Assert(decimalPrecision >= decimalScale, "decimalPrecision must be greater or equal to decimalScale");
          Debug.Assert(decimalPrecision <= 53, "decimalPrecision must be less than or equal to 53");
          typeName = typeName + "(" + decimalPrecision + "," + decimalScale + ")";
          break;

        case PrimitiveTypeKind.Int32:
          typeName = "int";
          break;

        case PrimitiveTypeKind.Int64:
          typeName = "bigint";
          break;

        case PrimitiveTypeKind.Int16:
          typeName = "smallint";
          break;

        case PrimitiveTypeKind.Byte:
          typeName = "tinyint";
          break;

        case PrimitiveTypeKind.Boolean:
          typeName = "bit";
          break;

        case PrimitiveTypeKind.Single:
          typeName = "real";
          break;

        case PrimitiveTypeKind.Double:
          typeName = "float";
          break;

        case PrimitiveTypeKind.Guid:
          typeName = "uniqueidentifier";
          break;

        default:
          throw new NotSupportedException("Unsupported EdmType: " + primitiveType.PrimitiveTypeKind);
      }

      return typeName;
    }

    /// <summary>
    /// Handles the expression represending DbLimitExpression.Limit and DbSkipExpression.Count.
    /// If it is a constant expression, it simply does to string thus avoiding casting it to the specific value
    /// (which would be done if <see cref="Visit(DbConstantExpression)"/> is called)
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    private ISqlFragment HandleCountExpression(DbExpression e)
    {
      ISqlFragment result;

      if (e.ExpressionKind == DbExpressionKind.Constant)
      {
        //For constant expression we should not cast the value,
        // thus we don't go throught the default DbConstantExpression handling
        SqlBuilder sqlBuilder = new SqlBuilder();
        sqlBuilder.Append(((DbConstantExpression)e).Value.ToString());
        result = sqlBuilder;
      }
      else
      {
        result = e.Accept(this);
      }

      return result;
    }

    /// <summary>
    /// This is used to determine if a particular expression is an Apply operation.
    /// This is only the case when the DbExpressionKind is CrossApply or OuterApply.
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    bool IsApplyExpression(DbExpression e)
    {
      return (DbExpressionKind.CrossApply == e.ExpressionKind || DbExpressionKind.OuterApply == e.ExpressionKind);
    }

    private bool IsKeyForIn(DbExpression e)
    {
      if ((e.ExpressionKind != DbExpressionKind.Property) && (e.ExpressionKind != DbExpressionKind.VariableReference))
      {
        return (e.ExpressionKind == DbExpressionKind.ParameterReference);
      }
      return true;
    }

    /// <summary>
    /// This is used to determine if a particular expression is a Join operation.
    /// This is true for DbCrossJoinExpression and DbJoinExpression, the
    /// latter of which may have one of several different ExpressionKinds.
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    bool IsJoinExpression(DbExpression e)
    {
      return (DbExpressionKind.CrossJoin == e.ExpressionKind ||
              DbExpressionKind.FullOuterJoin == e.ExpressionKind ||
              DbExpressionKind.InnerJoin == e.ExpressionKind ||
              DbExpressionKind.LeftOuterJoin == e.ExpressionKind);
    }

    /// <summary>
    /// This is used to determine if a calling expression needs to place
    /// round brackets around the translation of the expression e.
    ///
    /// Constants, parameters and properties do not require brackets,
    /// everything else does.
    /// </summary>
    /// <param name="e"></param>
    /// <returns>true, if the expression needs brackets </returns>
    bool IsComplexExpression(DbExpression e)
    {
      switch (e.ExpressionKind)
      {
        case DbExpressionKind.Constant:
        case DbExpressionKind.ParameterReference:
        case DbExpressionKind.Property:
          return false;

        default:
          return true;
      }
    }

    /// <summary>
    /// Determine if the owner expression can add its unique sql to the input's
    /// SqlSelectStatement
    /// </summary>
    /// <param name="result">The SqlSelectStatement of the input to the relational node.</param>
    /// <param name="expressionKind">The kind of the expression node(not the input's)</param>
    /// <returns></returns>
    bool IsCompatible(SqlSelectStatement result, DbExpressionKind expressionKind)
    {
      switch (expressionKind)
      {
        case DbExpressionKind.Distinct:
          return result.Top == null
            // The projection after distinct may not project all
            // columns used in the Order By
              && result.OrderBy.IsEmpty;

        case DbExpressionKind.Filter:
          return result.Select.IsEmpty
                  && result.Where.IsEmpty
                  && result.GroupBy.IsEmpty
                  && result.Top == null;

        case DbExpressionKind.GroupBy:
          return result.Select.IsEmpty
                  && result.GroupBy.IsEmpty
                  && result.OrderBy.IsEmpty
                  && result.Top == null;

        case DbExpressionKind.Limit:
        case DbExpressionKind.Element:
          return result.Top == null;

        case DbExpressionKind.Project:
          return result.Select.IsEmpty
                  && result.GroupBy.IsEmpty;

        case DbExpressionKind.Skip:
          return result.Select.IsEmpty
                  && result.GroupBy.IsEmpty
                  && result.OrderBy.IsEmpty
                  && !result.IsDistinct;

        case DbExpressionKind.Sort:
          return result.Select.IsEmpty
                  && result.GroupBy.IsEmpty
                  && result.OrderBy.IsEmpty;

        default:
          Debug.Assert(false);
          throw new InvalidOperationException();
      }

    }

    private void ParenthesizeExpressionWithoutRedundantConstantCasts(DbExpression value, SqlBuilder sqlBuilder)
    {
      if (value.ExpressionKind == DbExpressionKind.Constant)
      {
        sqlBuilder.Append(this.Visit((DbConstantExpression)value));
      }
      else
      {
        this.ParanthesizeExpressionIfNeeded(value, sqlBuilder);
          }
      }

    private void ParanthesizeExpressionIfNeeded(DbExpression e, SqlBuilder result)
    {
      if (IsComplexExpression(e))
      {
        result.Append("(");
        result.Append(e.Accept<ISqlFragment>(this));
        result.Append(")");
      }
      else
      {
        result.Append(e.Accept<ISqlFragment>(this));
      }
    }

    /// <summary>
    /// We use the normal box quotes for SQL server.  We do not deal with ANSI quotes
    /// i.e. double quotes.
    /// </summary>
    /// <param name="name"></param>
    /// <returns></returns>
    internal static string QuoteIdentifier(string name)
    {
      Debug.Assert(!String.IsNullOrEmpty(name));
      // We assume that the names are not quoted to begin with.
      return "[" + name.Replace("]", "]]") + "]";
    }

    private bool TryAddExpressionForIn(DbBinaryExpression e, KeyToListMap<DbExpression, DbExpression> values)
    {
      if (this.IsKeyForIn(e.Left))
      {
        values.Add(e.Left, e.Right);
        return true;
      }
      if (this.IsKeyForIn(e.Right))
      {
        values.Add(e.Right, e.Left);
        return true;
      }
      return false;
    }

    /// <summary>
    /// Simply calls <see cref="VisitExpressionEnsureSqlStatement(DbExpression, bool)"/>
    /// with addDefaultColumns set to true
    /// </summary>
    /// <param name="e"></param>
    /// <returns></returns>
    SqlSelectStatement VisitExpressionEnsureSqlStatement(DbExpression e)
    {
      return VisitExpressionEnsureSqlStatement(e, true);
    }

    /// <summary>
    /// This is called from <see cref="GenerateSql(DbQueryCommandTree)"/> and nodes which require a
    /// select statement as an argument e.g. <see cref="Visit(DbIsEmptyExpression)"/>,
    /// <see cref="Visit(DbUnionAllExpression)"/>.
    ///
    /// SqlGenerator needs its child to have a proper alias if the child is
    /// just an extent or a join.
    ///
    /// The normal relational nodes result in complete valid SQL statements.
    /// For the rest, we need to treat them as there was a dummy
    /// <code>
    /// -- originally {expression}
    /// -- change that to
    /// SELECT *
    /// FROM {expression} as c
    /// </code>
    ///
    /// DbLimitExpression needs to start the statement but not add the default columns
    /// </summary>
    /// <param name="e"></param>
    /// <param name="addDefaultColumns"></param>
    /// <returns></returns>
    SqlSelectStatement VisitExpressionEnsureSqlStatement(DbExpression e, bool addDefaultColumns)
    {
      Debug.Assert(MetadataHelpers.IsCollectionType(e.ResultType));

      SqlSelectStatement result;
      switch (e.ExpressionKind)
      {
        case DbExpressionKind.Project:
        case DbExpressionKind.Filter:
        case DbExpressionKind.GroupBy:
        case DbExpressionKind.Sort:
          result = e.Accept(this) as SqlSelectStatement;
          break;

        default:
          Symbol fromSymbol;
          string inputVarName = "c";  // any name will do - this is my random choice.
          symbolTable.EnterScope();

          TypeUsage type = null;
          switch (e.ExpressionKind)
          {
            case DbExpressionKind.Scan:
            case DbExpressionKind.CrossJoin:
            case DbExpressionKind.FullOuterJoin:
            case DbExpressionKind.InnerJoin:
            case DbExpressionKind.LeftOuterJoin:
            case DbExpressionKind.CrossApply:
            case DbExpressionKind.OuterApply:
              type = MetadataHelpers.GetElementTypeUsage(e.ResultType);
              break;

            default:
              Debug.Assert(MetadataHelpers.IsCollectionType(e.ResultType));
              type = MetadataHelpers.GetEdmType<CollectionType>(e.ResultType).TypeUsage;
              break;
          }

          result = VisitInputExpression(e, inputVarName, type, out fromSymbol);
          AddFromSymbol(result, inputVarName, fromSymbol);
          symbolTable.ExitScope();
          break;
      }

      if (addDefaultColumns && result.Select.IsEmpty)
      {
        AddDefaultColumns(result);
      }

      return result;
    }

    /// <summary>
    /// This method is called by <see cref="Visit(DbFilterExpression)"/> and
    /// <see cref="Visit(DbQuantifierExpression)"/>
    ///
    /// </summary>
    /// <param name="input"></param>
    /// <param name="predicate"></param>
    /// <param name="negatePredicate">This is passed from <see cref="Visit(DbQuantifierExpression)"/>
    /// in the All(...) case.</param>
    /// <returns></returns>
    SqlSelectStatement VisitFilterExpression(DbExpressionBinding input, DbExpression predicate, bool negatePredicate)
    {
      Symbol fromSymbol;
      SqlSelectStatement result = VisitInputExpression(input.Expression,
          input.VariableName, input.VariableType, out fromSymbol);

      // Filter is compatible with OrderBy
      // but not with Project, another Filter or GroupBy
      if (!IsCompatible(result, DbExpressionKind.Filter))
      {
        result = CreateNewSelectStatement(result, input.VariableName, input.VariableType, out fromSymbol);
      }

      selectStatementStack.Push(result);
      symbolTable.EnterScope();

      AddFromSymbol(result, input.VariableName, fromSymbol);

      if (negatePredicate)
      {
        result.Where.Append("NOT (");
      }
      result.Where.Append(predicate.Accept(this));
      if (negatePredicate)
      {
        result.Where.Append(")");
      }

      symbolTable.ExitScope();
      selectStatementStack.Pop();

      return result;
    }

    /// <summary>
    /// If the sql fragment for an input expression is not a SqlSelect statement
    /// or other acceptable form (e.g. an extent as a SqlBuilder), we need
    /// to wrap it in a form acceptable in a FROM clause.  These are
    /// primarily the
    /// <list type="bullet">
    /// <item>The set operation expressions - union all, intersect, except</item>
    /// <item>TVFs, which are conceptually similar to tables</item>
    /// </list>
    /// </summary>
    /// <param name="result"></param>
    /// <param name="sqlFragment"></param>
    /// <param name="expressionKind"></param>
    void WrapNonQueryExtent(SqlSelectStatement result, ISqlFragment sqlFragment, DbExpressionKind expressionKind)
    {
      switch (expressionKind)
      {
        case DbExpressionKind.Function:
          // TVF
          result.From.Append(sqlFragment);
          break;

        default:
          result.From.Append(" (");
          result.From.Append(sqlFragment);
          result.From.Append(")");
          break;
      }
    }

    /// <summary>
    /// Is this a builtin function (ie) does it have the builtinAttribute specified?
    /// </summary>
    /// <param name="function"></param>
    /// <returns></returns>
    private static bool IsBuiltinFunction(EdmFunction function)
    {
      return MetadataHelpers.TryGetValueForMetadataProperty<bool>(function, "BuiltInAttribute");
    }

    /// <summary>
    ///
    /// </summary>
    /// <param name="function"></param>
    /// <param name="result"></param>
    void WriteFunctionName(SqlBuilder result, EdmFunction function)
    {
      string storeFunctionName = MetadataHelpers.TryGetValueForMetadataProperty<string>(function, "StoreFunctionNameAttribute");

      if (string.IsNullOrEmpty(storeFunctionName))
      {
        storeFunctionName = function.Name;
      }

      // If the function is a builtin (ie) the BuiltIn attribute has been
      // specified, then, the function name should not be quoted; additionally,
      // no namespace should be used.
      if (IsBuiltinFunction(function))
      {
        if (function.NamespaceName == "Edm")
        {
          switch (storeFunctionName.ToUpperInvariant())
          {
            default:
              result.Append(storeFunctionName);
              break;
          }

        }
        else
        {
          result.Append(storeFunctionName);
        }

      }
      else
      {
        // Should we actually support this?
        //result.Append(QuoteIdentifier((string)function.MetadataProperties["Schema"].Value ?? "dbo"));
        //result.Append(".");
        result.Append(QuoteIdentifier(storeFunctionName));
      }
    }

    /// <summary>
    /// Appends the literal BLOB string representation of the specified
    /// byte array to the <see cref="SqlBuilder" />.
    /// </summary>
    /// <param name="bytes">
    /// The byte array to be formatted as a literal BLOB string.
    /// </param>
    /// <param name="builder">
    /// The <see cref="SqlBuilder" /> object to use.  If null, an exception
    /// will be thrown.
    /// </param>
    private static void ToBlobLiteral(
        byte[] bytes,
        SqlBuilder builder
        )
    {
        if (builder == null)
            throw new ArgumentNullException("builder");

        if (bytes == null)
        {
            builder.Append("NULL"); /* TODO: Reasonable? */
            return;
        }

        builder.Append(" X'");

        for (int index = 0; index < bytes.Length; index++)
        {
            builder.Append(hexDigits[(bytes[index] & 0xF0) >> 4]);
            builder.Append(hexDigits[bytes[index] & 0x0F]);
        }

        builder.Append("' ");
    }

    /// <summary>
    /// Helper method for the Group By visitor
    /// Returns true if at least one of the aggregates in the given list
    /// has an argument that is not a <see cref="DbPropertyExpression"/>
    /// over <see cref="DbVariableReferenceExpression"/>
    /// </summary>
    /// <param name="aggregates"></param>
    /// <returns></returns>
    static bool NeedsInnerQuery(IList<DbAggregate> aggregates)
    {
      foreach (DbAggregate aggregate in aggregates)
      {
        Debug.Assert(aggregate.Arguments.Count == 1);
        if (!IsPropertyOverVarRef(aggregate.Arguments[0]))
        {
          return true;
        }
      }
      return false;
    }

    /// <summary>
    /// Determines whether the given expression is a <see cref="DbPropertyExpression"/>
    /// over <see cref="DbVariableReferenceExpression"/>
    /// </summary>
    /// <param name="expression"></param>
    /// <returns></returns>
    static bool IsPropertyOverVarRef(DbExpression expression)
    {
      DbPropertyExpression propertyExpression = expression as DbPropertyExpression;
      if (propertyExpression == null)
      {
        return false;
      }
      DbVariableReferenceExpression varRefExpression = propertyExpression.Instance as DbVariableReferenceExpression;
      if (varRefExpression == null)
      {
        return false;
      }
      return true;
    }

    #endregion

    private class KeyFieldExpressionComparer : IEqualityComparer<DbExpression>
    {
      // Fields
      internal static readonly SqlGenerator.KeyFieldExpressionComparer Singleton = new SqlGenerator.KeyFieldExpressionComparer();

      // Methods
      private KeyFieldExpressionComparer()
      {
      }

      public bool Equals(DbExpression x, DbExpression y)
      {
        if (x.ExpressionKind == y.ExpressionKind)
        {
          DbExpressionKind expressionKind = x.ExpressionKind;
          if (expressionKind <= DbExpressionKind.ParameterReference)
          {
            switch (expressionKind)
            {
              case DbExpressionKind.Cast:
                {
                  DbCastExpression expression5 = (DbCastExpression)x;
                  DbCastExpression expression6 = (DbCastExpression)y;
                  return ((expression5.ResultType == expression6.ResultType) && this.Equals(expression5.Argument, expression6.Argument));
                }
              case DbExpressionKind.ParameterReference:
                {
                  DbParameterReferenceExpression expression3 = (DbParameterReferenceExpression)x;
                  DbParameterReferenceExpression expression4 = (DbParameterReferenceExpression)y;
                  return (expression3.ParameterName == expression4.ParameterName);
                }
            }
            goto Label_00CC;
          }
          if (expressionKind != DbExpressionKind.Property)
          {
            if (expressionKind == DbExpressionKind.VariableReference)
            {
              return (x == y);
            }
            goto Label_00CC;
          }
          DbPropertyExpression expression = (DbPropertyExpression)x;
          DbPropertyExpression expression2 = (DbPropertyExpression)y;
          if (expression.Property == expression2.Property)
          {
            return this.Equals(expression.Instance, expression2.Instance);
          }
        }
        return false;
      Label_00CC:
        return false;
      }

      public int GetHashCode(DbExpression obj)
      {
        switch (obj.ExpressionKind)
        {
          case DbExpressionKind.Cast:
            return this.GetHashCode(((DbCastExpression)obj).Argument);

          case DbExpressionKind.ParameterReference:
            return (((DbParameterReferenceExpression)obj).ParameterName.GetHashCode() ^ 0x7fffffff);

          case DbExpressionKind.Property:
            return ((DbPropertyExpression)obj).Property.GetHashCode();

          case DbExpressionKind.VariableReference:
            return ((DbVariableReferenceExpression)obj).VariableName.GetHashCode();
        }
        return obj.GetHashCode();
      }
    }
  }
}

Added System.Data.SQLite.Linq/SQL Generation/SqlSelectStatement.cs.













































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
//---------------------------------------------------------------------
// <copyright file="SqlSelectStatement.cs" company="Microsoft">
//      Portions of this file copyright (c) Microsoft Corporation
//      and are released under the Microsoft Pulic License.  See
//      http://archive.msdn.microsoft.com/EFSampleProvider/Project/License.aspx
//      or License.txt for details.
//      All rights reserved.
// </copyright>
//---------------------------------------------------------------------

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
  using System.Collections.Generic;
  using System.Diagnostics;

#if USE_ENTITY_FRAMEWORK_6
  using System.Data.Entity.Core.Common.CommandTrees;
#else
  using System.Data.Common.CommandTrees;
#endif

  /// <summary>
  /// A SqlSelectStatement represents a canonical SQL SELECT statement.
  /// It has fields for the 5 main clauses
  /// <list type="number">
  /// <item>SELECT</item>
  /// <item>FROM</item>
  /// <item>WHERE</item>
  /// <item>GROUP BY</item>
  /// <item>ORDER BY</item>
  /// </list>
  /// We do not have HAVING, since it does not correspond to anything in the DbCommandTree.
  /// Each of the fields is a SqlBuilder, so we can keep appending SQL strings
  /// or other fragments to build up the clause.
  ///
  /// We have a IsDistinct property to indicate that we want distict columns.
  /// This is given out of band, since the input expression to the select clause
  /// may already have some columns projected out, and we use append-only SqlBuilders.
  /// The DISTINCT is inserted when we finally write the object into a string.
  /// 
  /// Also, we have a Top property, which is non-null if the number of results should
  /// be limited to certain number. It is given out of band for the same reasons as DISTINCT.
  ///
  /// The FromExtents contains the list of inputs in use for the select statement.
  /// There is usually just one element in this - Select statements for joins may
  /// temporarily have more than one.
  ///
  /// If the select statement is created by a Join node, we maintain a list of
  /// all the extents that have been flattened in the join in AllJoinExtents
  /// <example>
  /// in J(j1= J(a,b), c)
  /// FromExtents has 2 nodes JoinSymbol(name=j1, ...) and Symbol(name=c)
  /// AllJoinExtents has 3 nodes Symbol(name=a), Symbol(name=b), Symbol(name=c)
  /// </example>
  ///
  /// If any expression in the non-FROM clause refers to an extent in a higher scope,
  /// we add that extent to the OuterExtents list.  This list denotes the list
  /// of extent aliases that may collide with the aliases used in this select statement.
  /// It is set by <see cref="SqlGenerator.Visit(DbVariableReferenceExpression)"/>.
  /// An extent is an outer extent if it is not one of the FromExtents.
  ///
  ///
  /// </summary>
  internal sealed class SqlSelectStatement : ISqlFragment
  {
    private bool isDistinct;

    /// <summary>
    /// Do we need to add a DISTINCT at the beginning of the SELECT
    /// </summary>
    internal bool IsDistinct
    {
      get { return isDistinct; }
      set { isDistinct = value; }
    }

    private List<Symbol> allJoinExtents;
    internal List<Symbol> AllJoinExtents
    {
      get { return allJoinExtents; }
      // We have a setter as well, even though this is a list,
      // since we use this field only in special cases.
      set { allJoinExtents = value; }
    }

    private List<Symbol> fromExtents;
    internal List<Symbol> FromExtents
    {
      get
      {
        if (null == fromExtents)
        {
          fromExtents = new List<Symbol>();
        }
        return fromExtents;
      }
    }

    private Dictionary<Symbol, bool> outerExtents;
    internal Dictionary<Symbol, bool> OuterExtents
    {
      get
      {
        if (null == outerExtents)
        {
          outerExtents = new Dictionary<Symbol, bool>();
        }
        return outerExtents;
      }
    }

    private TopClause top;
    internal TopClause Top
    {
      get { return top; }
      set
      {
        Debug.Assert(top == null, "SqlSelectStatement.Top has already been set");
        top = value;
      }
    }

    private SkipClause skip;
    internal SkipClause Skip
    {
      get { return skip; }
      set
      {
          Debug.Assert(skip == null, "SqlSelectStatement.Skip has already been set");
          skip = value;
      }
    }

    private SqlBuilder select = new SqlBuilder();
    internal SqlBuilder Select
    {
      get { return select; }
    }

    private SqlBuilder from = new SqlBuilder();
    internal SqlBuilder From
    {
      get { return from; }
    }


    private SqlBuilder where;
    internal SqlBuilder Where
    {
      get
      {
        if (null == where)
        {
          where = new SqlBuilder();
        }
        return where;
      }
    }

    private SqlBuilder groupBy;
    internal SqlBuilder GroupBy
    {
      get
      {
        if (null == groupBy)
        {
          groupBy = new SqlBuilder();
        }
        return groupBy;
      }
    }

    private SqlBuilder orderBy;
    public SqlBuilder OrderBy
    {
      get
      {
        if (null == orderBy)
        {
          orderBy = new SqlBuilder();
        }
        return orderBy;
      }
    }

    //indicates whether it is the top most select statement, 
    // if not Order By should be omitted unless there is a corresponding TOP
    private bool isTopMost;
    internal bool IsTopMost
    {
      get { return this.isTopMost; }
      set { this.isTopMost = value; }
    }

    /// <summary>
    /// Checks if the statement has an ORDER BY, LIMIT, or OFFSET clause.
    /// </summary>
    /// <returns>
    /// Non-zero if there is an ORDER BY, LIMIT, or OFFSET clause;
    /// otherwise, zero.
    /// </returns>
    public bool HaveOrderByLimitOrOffset()
    {
        if ((this.orderBy != null) && !this.orderBy.IsEmpty)
            return true;

        if (this.top != null)
            return true;

        if (this.skip != null)
            return true;

        return false;
    }

    #region ISqlFragment Members

    /// <summary>
    /// Write out a SQL select statement as a string.
    /// We have to
    /// <list type="number">
    /// <item>Check whether the aliases extents we use in this statement have
    /// to be renamed.
    /// We first create a list of all the aliases used by the outer extents.
    /// For each of the FromExtents( or AllJoinExtents if it is non-null),
    /// rename it if it collides with the previous list.
    /// </item>
    /// <item>Write each of the clauses (if it exists) as a string</item>
    /// </list>
    /// </summary>
    /// <param name="writer"></param>
    /// <param name="sqlGenerator"></param>
    public void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator)
    {
      #region Check if FROM aliases need to be renamed

      // Create a list of the aliases used by the outer extents
      // JoinSymbols have to be treated specially.
      List<string> outerExtentAliases = null;
      if ((null != outerExtents) && (0 < outerExtents.Count))
      {
        foreach (Symbol outerExtent in outerExtents.Keys)
        {
          JoinSymbol joinSymbol = outerExtent as JoinSymbol;
          if (joinSymbol != null)
          {
            foreach (Symbol symbol in joinSymbol.FlattenedExtentList)
            {
              if (null == outerExtentAliases) { outerExtentAliases = new List<string>(); }
              outerExtentAliases.Add(symbol.NewName);
            }
          }
          else
          {
            if (null == outerExtentAliases) { outerExtentAliases = new List<string>(); }
            outerExtentAliases.Add(outerExtent.NewName);
          }
        }
      }

      // An then rename each of the FromExtents we have
      // If AllJoinExtents is non-null - it has precedence.
      // The new name is derived from the old name - we append an increasing int.
      List<Symbol> extentList = this.AllJoinExtents ?? this.fromExtents;
      if (null != extentList)
      {
        foreach (Symbol fromAlias in extentList)
        {
          if ((null != outerExtentAliases) && outerExtentAliases.Contains(fromAlias.Name))
          {
            int i = sqlGenerator.AllExtentNames[fromAlias.Name];
            string newName;
            do
            {
              ++i;
              newName = fromAlias.Name + i.ToString(System.Globalization.CultureInfo.InvariantCulture);
            }
            while (sqlGenerator.AllExtentNames.ContainsKey(newName));
            sqlGenerator.AllExtentNames[fromAlias.Name] = i;
            fromAlias.NewName = newName;

            // Add extent to list of known names (although i is always incrementing, "prefix11" can
            // eventually collide with "prefix1" when it is extended)
            sqlGenerator.AllExtentNames[newName] = 0;
          }

          // Add the current alias to the list, so that the extents
          // that follow do not collide with me.
          if (null == outerExtentAliases) { outerExtentAliases = new List<string>(); }
          outerExtentAliases.Add(fromAlias.NewName);
        }
      }
      #endregion

      // Increase the indent, so that the Sql statement is nested by one tab.
      writer.Indent += 1; // ++ can be confusing in this context

      writer.Write("SELECT ");
      if (IsDistinct)
      {
        writer.Write("DISTINCT ");
      }

      if ((null == this.select) || this.Select.IsEmpty)
      {
        Debug.Assert(false);  // we have removed all possibilities of SELECT *.
        writer.Write("*");
      }
      else
      {
        this.Select.WriteSql(writer, sqlGenerator);
      }

      writer.WriteLine();
      writer.Write("FROM ");
      this.From.WriteSql(writer, sqlGenerator);

      if ((null != this.where) && !this.Where.IsEmpty)
      {
        writer.WriteLine();
        writer.Write("WHERE ");
        this.Where.WriteSql(writer, sqlGenerator);
      }

      if ((null != this.groupBy) && !this.GroupBy.IsEmpty)
      {
        writer.WriteLine();
        writer.Write("GROUP BY ");
        this.GroupBy.WriteSql(writer, sqlGenerator);
      }

      if ((null != this.orderBy) && !this.OrderBy.IsEmpty && (this.IsTopMost || this.Top != null))
      {
        writer.WriteLine();
        writer.Write("ORDER BY ");
        this.OrderBy.WriteSql(writer, sqlGenerator);
      }

      if (this.Top != null)
      {
        this.Top.WriteSql(writer, sqlGenerator);
      }

      if (this.skip != null)
      {
        this.Skip.WriteSql(writer, sqlGenerator);
      }

      --writer.Indent;
    }

    #endregion
  }
}

Added System.Data.SQLite.Linq/SQL Generation/SqlWriter.cs.











































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//---------------------------------------------------------------------
// <copyright file="SqlWriter.cs" company="Microsoft">
//      Portions of this file copyright (c) Microsoft Corporation
//      and are released under the Microsoft Pulic License.  See
//      http://archive.msdn.microsoft.com/EFSampleProvider/Project/License.aspx
//      or License.txt for details.
//      All rights reserved.
// </copyright>
//---------------------------------------------------------------------

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
  using System.IO;
  using System.Text;

    /// <summary>
  /// This extends StringWriter primarily to add the ability to add an indent
  /// to each line that is written out.
  /// </summary>
  class SqlWriter : StringWriter
  {
    // We start at -1, since the first select statement will increment it to 0.
    int indent = -1;
    /// <summary>
    /// The number of tabs to be added at the beginning of each new line.
    /// </summary>
    internal int Indent
    {
      get { return indent; }
      set { indent = value; }
    }

    bool atBeginningOfLine = true;

    /// <summary>
    /// 
    /// </summary>
    /// <param name="b"></param>
    public SqlWriter(StringBuilder b)
      : base(b, System.Globalization.CultureInfo.InvariantCulture)
    {
    }

    /// <summary>
    /// Reset atBeginningofLine if we detect the newline string.
    /// <see cref="SqlBuilder.AppendLine"/>
    /// Add as many tabs as the value of indent if we are at the 
    /// beginning of a line.
    /// </summary>
    /// <param name="value"></param>
    public override void Write(string value)
    {
      if (value == "\r\n")
      {
        base.WriteLine();
        atBeginningOfLine = true;
      }
      else
      {
        if (atBeginningOfLine)
        {
          if (indent > 0)
          {
            base.Write(new string('\t', indent));
          }
          atBeginningOfLine = false;
        }
        base.Write(value);
      }
    }

    /// <summary>
    /// 
    /// </summary>
    public override void WriteLine()
    {
      base.WriteLine();
      atBeginningOfLine = true;
    }
  }
}

Added System.Data.SQLite.Linq/SQL Generation/StringUtil.cs.













































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System.Collections.Generic;
using System.Text;
using System.Globalization;
using System.Collections;

#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_20 || NET_STANDARD_21
using System.Runtime;
#endif

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
	internal static class StringUtil
	{
		// Fields
		private const string s_defaultDelimiter = ", ";

		// Methods
		internal static string BuildDelimitedList<T>(IEnumerable<T> values, ToStringConverter<T> converter, string delimiter)
		{
			if (values == null)
			{
				return string.Empty;
			}
			if (converter == null)
			{
				converter = new ToStringConverter<T>(StringUtil.InvariantConvertToString<T>);
			}
			if (delimiter == null)
			{
				delimiter = ", ";
			}
			StringBuilder builder = new StringBuilder();
			bool flag = true;
			foreach (T local in values)
			{
				if (flag)
				{
					flag = false;
				}
				else
				{
					builder.Append(delimiter);
				}
				builder.Append(converter(local));
			}
			return builder.ToString();
		}

		internal static string FormatIndex(string arrayVarName, int index)
		{
			StringBuilder builder = new StringBuilder((arrayVarName.Length + 10) + 2);
			return builder.Append(arrayVarName).Append('[').Append(index).Append(']').ToString();
		}

		internal static string FormatInvariant(string format, params object[] args)
		{
			return string.Format(CultureInfo.InvariantCulture, format, args);
		}

		internal static StringBuilder FormatStringBuilder(StringBuilder builder, string format, params object[] args)
		{
			builder.AppendFormat(CultureInfo.InvariantCulture, format, args);
			return builder;
		}

		internal static StringBuilder IndentNewLine(StringBuilder builder, int indent)
		{
			builder.AppendLine();
			for (int i = 0; i < indent; i++)
			{
				builder.Append("    ");
			}
			return builder;
		}

		private static string InvariantConvertToString<T>(T value)
		{
			return string.Format(CultureInfo.InvariantCulture, "{0}", new object[] { value });
		}

#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_20 || NET_STANDARD_21
		[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
#endif
		internal static bool IsNullOrEmptyOrWhiteSpace(string value)
		{
			return IsNullOrEmptyOrWhiteSpace(value, 0);
		}

		internal static bool IsNullOrEmptyOrWhiteSpace(string value, int offset)
		{
			if (value != null)
			{
				for (int i = offset; i < value.Length; i++)
				{
					if (!char.IsWhiteSpace(value[i]))
					{
						return false;
					}
				}
			}
			return true;
		}

		internal static bool IsNullOrEmptyOrWhiteSpace(string value, int offset, int length)
		{
			if (value != null)
			{
				length = Math.Min(value.Length, length);
				for (int i = offset; i < length; i++)
				{
					if (!char.IsWhiteSpace(value[i]))
					{
						return false;
					}
				}
			}
			return true;
		}

		internal static string MembersToCommaSeparatedString(IEnumerable members)
		{
			StringBuilder builder = new StringBuilder();
			builder.Append("{");
			ToCommaSeparatedString(builder, members);
			builder.Append("}");
			return builder.ToString();
		}

		internal static string ToCommaSeparatedString(IEnumerable list)
		{
			return ToSeparatedString(list, ", ", string.Empty);
		}

		internal static void ToCommaSeparatedString(StringBuilder builder, IEnumerable list)
		{
			ToSeparatedStringPrivate(builder, list, ", ", string.Empty, false);
		}

		internal static string ToCommaSeparatedStringSorted(IEnumerable list)
		{
			return ToSeparatedStringSorted(list, ", ", string.Empty);
		}

		internal static void ToCommaSeparatedStringSorted(StringBuilder builder, IEnumerable list)
		{
			ToSeparatedStringPrivate(builder, list, ", ", string.Empty, true);
		}

		internal static string ToSeparatedString(IEnumerable list, string separator, string nullValue)
		{
			StringBuilder stringBuilder = new StringBuilder();
			ToSeparatedString(stringBuilder, list, separator, nullValue);
			return stringBuilder.ToString();
		}

		internal static void ToSeparatedString(StringBuilder builder, IEnumerable list, string separator)
		{
			ToSeparatedStringPrivate(builder, list, separator, string.Empty, false);
		}

#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_20 || NET_STANDARD_21
		[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
#endif
		internal static void ToSeparatedString(StringBuilder stringBuilder, IEnumerable list, string separator, string nullValue)
		{
			ToSeparatedStringPrivate(stringBuilder, list, separator, nullValue, false);
		}

		private static void ToSeparatedStringPrivate(StringBuilder stringBuilder, IEnumerable list, string separator, string nullValue, bool toSort)
		{
			if (list != null)
			{
				bool flag = true;
				List<string> list2 = new List<string>();
				foreach (object obj2 in list)
				{
					string str;
					if (obj2 == null)
					{
						str = nullValue;
					}
					else
					{
						str = FormatInvariant("{0}", new object[] { obj2 });
					}
					list2.Add(str);
				}
				if (toSort)
				{
					list2.Sort(StringComparer.Ordinal);
				}
				foreach (string str2 in list2)
				{
					if (!flag)
					{
						stringBuilder.Append(separator);
					}
					stringBuilder.Append(str2);
					flag = false;
				}
			}
		}

		internal static string ToSeparatedStringSorted(IEnumerable list, string separator, string nullValue)
		{
			StringBuilder stringBuilder = new StringBuilder();
			ToSeparatedStringPrivate(stringBuilder, list, separator, nullValue, true);
			return stringBuilder.ToString();
		}

		internal static void ToSeparatedStringSorted(StringBuilder builder, IEnumerable list, string separator)
		{
			ToSeparatedStringPrivate(builder, list, separator, string.Empty, true);
		}

		// Nested Types
		internal delegate string ToStringConverter<T>(T value);
	}
}

Added System.Data.SQLite.Linq/SQL Generation/Symbol.cs.



































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//---------------------------------------------------------------------
// <copyright file="Symbol.cs" company="Microsoft">
//      Portions of this file copyright (c) Microsoft Corporation
//      and are released under the Microsoft Pulic License.  See
//      http://archive.msdn.microsoft.com/EFSampleProvider/Project/License.aspx
//      or License.txt for details.
//      All rights reserved.
// </copyright>
//---------------------------------------------------------------------

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
  using System;
  using System.Collections.Generic;

#if USE_ENTITY_FRAMEWORK_6
  using System.Data.Entity.Core.Metadata.Edm;
#else
  using System.Data.Metadata.Edm;
#endif

    /// <summary>
  /// <see cref="SymbolTable"/>
  /// This class represents an extent/nested select statement,
  /// or a column.
  ///
  /// The important fields are Name, Type and NewName.
  /// NewName starts off the same as Name, and is then modified as necessary.
  ///
  ///
  /// The rest are used by special symbols.
  /// e.g. NeedsRenaming is used by columns to indicate that a new name must
  /// be picked for the column in the second phase of translation.
  ///
  /// IsUnnest is used by symbols for a collection expression used as a from clause.
  /// This allows <see cref="SqlGenerator.AddFromSymbol(SqlSelectStatement, string, Symbol, bool)"/> to add the column list
  /// after the alias.
  ///
  /// </summary>
  class Symbol : ISqlFragment
  {
    private Dictionary<string, Symbol> columns = new Dictionary<string, Symbol>(StringComparer.CurrentCultureIgnoreCase);
    internal Dictionary<string, Symbol> Columns
    {
      get { return columns; }
    }

    private bool needsRenaming = false;
    internal bool NeedsRenaming
    {
      get { return needsRenaming; }
      set { needsRenaming = value; }
    }

    bool isUnnest = false;
    internal bool IsUnnest
    {
      get { return isUnnest; }
      set { isUnnest = value; }
    }

    string name;
    public string Name
    {
      get { return name; }
    }

    string newName;
    public string NewName
    {
      get { return newName; }
      set { newName = value; }
    }

    private TypeUsage type;
    internal TypeUsage Type
    {
      get { return type; }
      set { type = value; }
    }

    public Symbol(string name, TypeUsage type)
    {
      this.name = name;
      this.newName = name;
      this.Type = type;
    }

    #region ISqlFragment Members

    /// <summary>
    /// Write this symbol out as a string for sql.  This is just
    /// the new name of the symbol (which could be the same as the old name).
    ///
    /// We rename columns here if necessary.
    /// </summary>
    /// <param name="writer"></param>
    /// <param name="sqlGenerator"></param>
    public void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator)
    {
      if (this.NeedsRenaming)
      {
        string newName;
        int i = sqlGenerator.AllColumnNames[this.NewName];
        do
        {
          ++i;
          newName = this.Name + i.ToString(System.Globalization.CultureInfo.InvariantCulture);
        } while (sqlGenerator.AllColumnNames.ContainsKey(newName));
        sqlGenerator.AllColumnNames[this.NewName] = i;

        // Prevent it from being renamed repeatedly.
        this.NeedsRenaming = false;
        this.NewName = newName;

        // Add this column name to list of known names so that there are no subsequent
        // collisions
        sqlGenerator.AllColumnNames[newName] = 0;
      }
      writer.Write(SqlGenerator.QuoteIdentifier(this.NewName));
    }

    #endregion
  }
}

Added System.Data.SQLite.Linq/SQL Generation/SymbolPair.cs.





























































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//---------------------------------------------------------------------
// <copyright file="SymbolPair.cs" company="Microsoft">
//      Portions of this file copyright (c) Microsoft Corporation
//      and are released under the Microsoft Pulic License.  See
//      http://archive.msdn.microsoft.com/EFSampleProvider/Project/License.aspx
//      or License.txt for details.
//      All rights reserved.
// </copyright>
//---------------------------------------------------------------------

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
  using System.Diagnostics;

#if USE_ENTITY_FRAMEWORK_6
  using System.Data.Entity.Core.Common.CommandTrees;
#else
  using System.Data.Common.CommandTrees;
#endif

  /// <summary>
  /// The SymbolPair exists to solve the record flattening problem.
  /// <see cref="SqlGenerator.Visit(DbPropertyExpression)"/>
  /// Consider a property expression D(v, "j3.j2.j1.a.x")
  /// where v is a VarRef, j1, j2, j3 are joins, a is an extent and x is a columns.
  /// This has to be translated eventually into {j'}.{x'}
  /// 
  /// The source field represents the outermost SqlStatement representing a join
  /// expression (say j2) - this is always a Join symbol.
  /// 
  /// The column field keeps moving from one join symbol to the next, until it
  /// stops at a non-join symbol.
  /// 
  /// This is returned by <see cref="SqlGenerator.Visit(DbPropertyExpression)"/>,
  /// but never makes it into a SqlBuilder.
  /// </summary>
  class SymbolPair : ISqlFragment
  {
    public Symbol Source;
    public Symbol Column;

    public SymbolPair(Symbol source, Symbol column)
    {
      this.Source = source;
      this.Column = column;
    }

    #region ISqlFragment Members

    public void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator)
    {
      // Symbol pair should never be part of a SqlBuilder.
      Debug.Assert(false);
    }

    #endregion
  }
}

Added System.Data.SQLite.Linq/SQL Generation/SymbolTable.cs.



















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//---------------------------------------------------------------------
// <copyright file="SymbolTable.cs" company="Microsoft">
//      Portions of this file copyright (c) Microsoft Corporation
//      and are released under the Microsoft Pulic License.  See
//      http://archive.msdn.microsoft.com/EFSampleProvider/Project/License.aspx
//      or License.txt for details.
//      All rights reserved.
// </copyright>
//---------------------------------------------------------------------

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
  using System;
  using System.Collections.Generic;

#if USE_ENTITY_FRAMEWORK_6
  using System.Data.Entity.Core.Common.CommandTrees;
#else
  using System.Data.Common.CommandTrees;
#endif

  /// <summary>
  /// The symbol table is quite primitive - it is a stack with a new entry for
  /// each scope.  Lookups search from the top of the stack to the bottom, until
  /// an entry is found.
  /// 
  /// The symbols are of the following kinds
  /// <list type="bullet">
  /// <item><see cref="Symbol"/> represents tables (extents/nested selects/unnests)</item>
  /// <item><see cref="JoinSymbol"/> represents Join nodes</item>
  /// <item><see cref="Symbol"/> columns.</item>
  /// </list>
  /// 
  /// Symbols represent names <see cref="SqlGenerator.Visit(DbVariableReferenceExpression)"/> to be resolved, 
  /// or things to be renamed.
  /// </summary>
  internal sealed class SymbolTable
  {
    private List<Dictionary<string, Symbol>> symbols = new List<Dictionary<string, Symbol>>();

    internal void EnterScope()
    {
      symbols.Add(new Dictionary<string, Symbol>(StringComparer.OrdinalIgnoreCase));
    }

    internal void ExitScope()
    {
      symbols.RemoveAt(symbols.Count - 1);
    }

    internal void Add(string name, Symbol value)
    {
      symbols[symbols.Count - 1][name] = value;
    }

    internal Symbol Lookup(string name)
    {
      for (int i = symbols.Count - 1; i >= 0; --i)
      {
        if (symbols[i].ContainsKey(name))
        {
          return symbols[i][name];
        }
      }

      return null;
    }
  }
}

Added System.Data.SQLite.Linq/SQL Generation/TopClause.cs.

































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//---------------------------------------------------------------------
// <copyright file="TopClause.cs" company="Microsoft">
//      Portions of this file copyright (c) Microsoft Corporation
//      and are released under the Microsoft Pulic License.  See
//      http://archive.msdn.microsoft.com/EFSampleProvider/Project/License.aspx
//      or License.txt for details.
//      All rights reserved.
// </copyright>
//---------------------------------------------------------------------

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
  using System;
  using System.Globalization;

    /// <summary>
  /// TopClause represents the a TOP expression in a SqlSelectStatement. 
  /// It has a count property, which indicates how many TOP rows should be selected and a 
  /// boolen WithTies property.
  /// </summary>
  class TopClause : ISqlFragment
  {
    ISqlFragment topCount;
    bool withTies;

    /// <summary>
    /// Do we need to add a WITH_TIES to the top statement
    /// </summary>
    internal bool WithTies
    {
      get { return withTies; }
    }

    /// <summary>
    /// How many top rows should be selected.
    /// </summary>
    internal ISqlFragment TopCount
    {
      get { return topCount; }
    }

    /// <summary>
    /// Creates a TopClause with the given topCount and withTies.
    /// </summary>
    /// <param name="topCount"></param>
    /// <param name="withTies"></param>
    internal TopClause(ISqlFragment topCount, bool withTies)
    {
      this.topCount = topCount;
      this.withTies = withTies;
    }

    /// <summary>
    /// Creates a TopClause with the given topCount and withTies.
    /// </summary>
    /// <param name="topCount"></param>
    /// <param name="withTies"></param>
    internal TopClause(int topCount, bool withTies)
    {
      SqlBuilder sqlBuilder = new SqlBuilder();
      sqlBuilder.Append(topCount.ToString(CultureInfo.InvariantCulture));
      this.topCount = sqlBuilder;
      this.withTies = withTies;
    }

    #region ISqlFragment Members

    /// <summary>
    /// Write out the TOP part of sql select statement 
    /// It basically writes LIMIT (X).
    /// </summary>
    /// <param name="writer"></param>
    /// <param name="sqlGenerator"></param>
    public void WriteSql(SqlWriter writer, SqlGenerator sqlGenerator)
    {
      writer.Write(" LIMIT ");
      this.TopCount.WriteSql(writer, sqlGenerator);

      if (this.WithTies)
        throw new NotSupportedException("WITH TIES");

      //writer.Write(" ");

      //if (this.WithTies)
      //{
      //    writer.Write("WITH TIES ");
      //}
    }

    #endregion
  }
}

Added System.Data.SQLite.Linq/SQLiteProviderFactory.cs.





































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
    using System;
    using System.Data.Common;
    using System.Globalization;

#if USE_ENTITY_FRAMEWORK_6
    using System.Data.Entity.Core.Common;
#endif

    /// <summary>
    /// SQLite implementation of <see cref="DbProviderFactory" />.
    /// </summary>
    public sealed class SQLiteProviderFactory :
        DbProviderFactory, IServiceProvider, IDisposable
    {
        #region Public Static Data
        /// <summary>
        /// Static instance member which returns an instanced
        /// <see cref="SQLiteProviderFactory" /> class.
        /// </summary>
        public static readonly SQLiteProviderFactory Instance =
            new SQLiteProviderFactory();
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        /// <summary>
        /// Constructs a new instance.
        /// </summary>
        public SQLiteProviderFactory()
        {
            // do nothing.
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region System.Data.Common.DbProviderFactory Overrides
        /// <summary>
        /// Creates and returns a new <see cref="SQLiteCommand" /> object.
        /// </summary>
        /// <returns>The new object.</returns>
        public override DbCommand CreateCommand()
        {
            CheckDisposed();
            return new SQLiteCommand();
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Creates and returns a new <see cref="SQLiteCommandBuilder" /> object.
        /// </summary>
        /// <returns>The new object.</returns>
        public override DbCommandBuilder CreateCommandBuilder()
        {
            CheckDisposed();
            return new SQLiteCommandBuilder();
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Creates and returns a new <see cref="SQLiteConnection" /> object.
        /// </summary>
        /// <returns>The new object.</returns>
        public override DbConnection CreateConnection()
        {
            CheckDisposed();
            return new SQLiteConnection();
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Creates and returns a new <see cref="SQLiteConnectionStringBuilder" />
        /// object.
        /// </summary>
        /// <returns>The new object.</returns>
        public override DbConnectionStringBuilder CreateConnectionStringBuilder()
        {
            CheckDisposed();
            return new SQLiteConnectionStringBuilder();
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Creates and returns a new <see cref="SQLiteDataAdapter" /> object.
        /// </summary>
        /// <returns>The new object.</returns>
        public override DbDataAdapter CreateDataAdapter()
        {
            CheckDisposed();
            return new SQLiteDataAdapter();
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Creates and returns a new <see cref="SQLiteParameter" /> object.
        /// </summary>
        /// <returns>The new object.</returns>
        public override DbParameter CreateParameter()
        {
            CheckDisposed();
            return new SQLiteParameter();
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IServiceProvider Members
        /// <summary>
        /// Gets the service object of the specified type.
        /// </summary>
        /// <param name="serviceType">
        /// An object that specifies the type of service object to get.
        /// </param>
        /// <returns>
        /// A service object of type serviceType -OR- a null reference if
        /// there is no service object of type serviceType.
        /// </returns>
        public object GetService(
            Type serviceType
            )
        {
            if ((serviceType == typeof(ISQLiteSchemaExtensions)) ||
                (serviceType == typeof(DbProviderServices)))
            {
                object result = SQLiteProviderServices.Instance;

                if (SQLite3.ForceLogLifecycle())
                {
                    SQLiteLog.LogMessage(HelperMethods.StringFormat(
                        CultureInfo.CurrentCulture,
                        "Success of \"{0}\" from SQLiteProviderFactory.GetService(\"{1}\")...",
                        (result != null) ? result.ToString() : "<null>",
                        (serviceType != null) ? serviceType.ToString() : "<null>"));
                }

                return result;
            }

            if (SQLite3.ForceLogLifecycle())
            {
                SQLiteLog.LogMessage(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "Failure of SQLiteProviderFactory.GetService(\"{0}\")...",
                    (serviceType != null) ? serviceType.ToString() : "<null>"));
            }

            return null;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable Members
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        private bool disposed;
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteProviderFactory).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        private void Dispose(bool disposing)
        {
            if (!disposed)
            {
                //if (disposing)
                //{
                //    ////////////////////////////////////
                //    // dispose managed resources here...
                //    ////////////////////////////////////
                //}

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////

                disposed = true;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Destructor
        ~SQLiteProviderFactory()
        {
            Dispose(false);
        }
        #endregion
    }
}

Changes to System.Data.SQLite.Linq/SQLiteProviderManifest.cs.

1
2
3
4
5
6
7

8



9
10
11
12
13


14


15
16

17
18
19

20
21

22
23
24
25
26
27
28



29
30
31
32
33
34
35




36
37


38
39
40
41
42
43
44















































































45




46


























































47
48
49
50
51
52
53
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/


namespace System.Data.SQLite



{
  using System;
  using System.Data;
  using System.Reflection;
  using System.IO;


  using System.Xml;


  using System.Collections.Generic;
  using System.Collections.ObjectModel;

  using System.Data.EntityModel.SchemaObjectModel;
  using System.Data.EntityModel;
  using System.Data.Common;

  using System.Data.Entity;
  using System.Data.Metadata.Edm;


  /// <summary>
  /// The Provider Manifest for SQL Server
  /// </summary>
  internal class SQLiteProviderManifest : DbXmlEnabledProviderManifest
  {
    internal SQLiteDateFormats _dateFormat;




    /// <summary>
    /// Constructs the provider manifest.
    /// </summary>
    /// <remarks>
    /// We pass the token as a DateTimeFormat enum text, because all the datetime functions
    /// are vastly different depending on how the user is opening the connection




    /// </remarks>
    /// <param name="manifestToken">A token used to infer the capabilities of the store</param>


    public SQLiteProviderManifest(string manifestToken)
      : base(SQLiteProviderManifest.GetProviderManifest())
    {
      _dateFormat = (SQLiteDateFormats)Enum.Parse(typeof(SQLiteDateFormats), manifestToken, true);
    }

    internal static XmlReader GetProviderManifest()















































































    {




      return GetXmlResource("System.Data.SQLite.Resources.SQLiteProviderServices.ProviderManifest.xml");


























































    }

    /// <summary>
    /// Returns manifest information for the provider
    /// </summary>
    /// <param name="informationType">The name of the information to be retrieved.</param>
    /// <returns>An XmlReader at the begining of the information requested.</returns>







>
|
>
>
>


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

>




|

|
>
>
>





|
|
>
>
>
>

|
>
>

|

|


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

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







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
  using System;
  using System.Collections.Generic;
  using System.IO;
  using System.Reflection;

#if !PLATFORM_COMPACTFRAMEWORK
  using System.Text;
#endif

  using System.Xml;

#if USE_ENTITY_FRAMEWORK_6
  using System.Data.Entity.Core;
  using System.Data.Entity.Core.Common;
  using System.Data.Entity.Core.Metadata.Edm;
#else
  using System.Data.Common;
  using System.Data.Metadata.Edm;
#endif

  /// <summary>
  /// The Provider Manifest for SQL Server
  /// </summary>
  internal sealed class SQLiteProviderManifest : DbXmlEnabledProviderManifest
  {
    internal SQLiteDateFormats _dateTimeFormat;
    internal DateTimeKind _dateTimeKind;
    internal string _dateTimeFormatString;
    internal bool _binaryGuid;

    /// <summary>
    /// Constructs the provider manifest.
    /// </summary>
    /// <remarks>
    /// Previously, the manifest token was interpreted as a <see cref="SQLiteDateFormats" />,
    /// because the <see cref="DateTime" /> functions are vastly different depending on the
    /// connection was opened.  However, the manifest token may specify a connection string
    /// instead.  WARNING: Only the "DateTimeFormat", "DateTimeKind", "DateTimeFormatString",
    /// and "BinaryGUID" connection parameters are extracted from it.  All other connection
    /// parameters, if any are present, are silently ignored.
    /// </remarks>
    /// <param name="manifestToken">
    /// A token used to infer the capabilities of the store.
    /// </param>
    public SQLiteProviderManifest(string manifestToken)
      : base(GetProviderManifest())
    {
        SetFromOptions(ParseProviderManifestToken(GetProviderManifestToken(manifestToken)));
    }

    private static XmlReader GetProviderManifest()
    {
      return GetXmlResource("System.Data.SQLite.SQLiteProviderServices.ProviderManifest.xml");
    }

    /// <summary>
    /// Determines and returns the effective provider manifest token to use,
    /// based on the specified provider manifest token and the environment,
    /// if applicable.
    /// </summary>
    /// <param name="manifestToken">
    /// The original provider manifest token passed to the constructor for this
    /// class.
    /// </param>
    /// <returns>
    /// The effective provider manifest token.
    /// </returns>
    private static string GetProviderManifestToken(
        string manifestToken
        )
    {
#if !PLATFORM_COMPACTFRAMEWORK
        string value = UnsafeNativeMethods.GetSettingValue(
            "AppendManifestToken_SQLiteProviderManifest", null);

        if (String.IsNullOrEmpty(value))
            return manifestToken;

        int capacity = value.Length;

        if (manifestToken != null)
            capacity += manifestToken.Length;

        StringBuilder builder = new StringBuilder(capacity);

        builder.Append(manifestToken);
        builder.Append(value);

        return builder.ToString();
#else
        //
        // NOTE: The .NET Compact Framework lacks environment variable support.
        //       Therefore, just return the original provider manifest token
        //       verbatim in this case.
        //
        return manifestToken;
#endif
    }

    /// <summary>
    /// Attempts to parse a provider manifest token.  It must contain either a
    /// legacy string that specifies the <see cref="SQLiteDateFormats" /> value
    /// -OR- string that uses the standard connection string syntax; otherwise,
    /// the results are undefined.
    /// </summary>
    /// <param name="manifestToken">
    /// The manifest token to parse.
    /// </param>
    /// <returns>
    /// The dictionary containing the connection string parameters.
    /// </returns>
    private static SortedList<string, string> ParseProviderManifestToken(
        string manifestToken
        )
    {
        return SQLiteConnection.ParseConnectionString(manifestToken, false, true, false);
    }

    /// <summary>
    /// Attempts to set the provider manifest options from the specified
    /// connection string parameters.  An exception may be thrown if one
    /// or more of the connection string parameter values do not conform
    /// to the expected type.
    /// </summary>
    /// <param name="opts">
    /// The dictionary containing the connection string parameters.
    /// </param>
    internal void SetFromOptions(
        SortedList<string, string> opts
        )
    {
        _dateTimeFormat = SQLiteConnection.DefaultDateTimeFormat;
        _dateTimeKind = SQLiteConnection.DefaultDateTimeKind;
        _dateTimeFormatString = SQLiteConnection.DefaultDateTimeFormatString;
        _binaryGuid = /* SQLiteConnection.DefaultBinaryGUID; */ false; /* COMPAT: Legacy. */

        if (opts == null)
            return;

#if !PLATFORM_COMPACTFRAMEWORK
        string[] names = Enum.GetNames(typeof(SQLiteDateFormats));
#else
        string[] names = {
            SQLiteDateFormats.Ticks.ToString(),
            SQLiteDateFormats.ISO8601.ToString(),
            SQLiteDateFormats.JulianDay.ToString(),
            SQLiteDateFormats.UnixEpoch.ToString(),
            SQLiteDateFormats.InvariantCulture.ToString(),
            SQLiteDateFormats.CurrentCulture.ToString(),
            "Default"
        };
#endif

        foreach (string name in names)
        {
            if (String.IsNullOrEmpty(name))
                continue;

            object value = SQLiteConnection.FindKey(opts, name, null);

            if (value == null)
                continue;

            _dateTimeFormat = (SQLiteDateFormats)Enum.Parse(
                typeof(SQLiteDateFormats), name, true);
        }

        object enumValue;

        enumValue = SQLiteConnection.TryParseEnum(
            typeof(SQLiteDateFormats), SQLiteConnection.FindKey(
            opts, "DateTimeFormat", null), true);

        if (enumValue is SQLiteDateFormats)
            _dateTimeFormat = (SQLiteDateFormats)enumValue;

        enumValue = SQLiteConnection.TryParseEnum(
            typeof(DateTimeKind), SQLiteConnection.FindKey(
            opts, "DateTimeKind", null), true);

        if (enumValue is DateTimeKind)
            _dateTimeKind = (DateTimeKind)enumValue;

        string stringValue = SQLiteConnection.FindKey(
            opts, "DateTimeFormatString", null);

        if (stringValue != null)
            _dateTimeFormatString = stringValue;

        stringValue = SQLiteConnection.FindKey(
            opts, "BinaryGUID", null);

        if (stringValue != null)
            _binaryGuid = SQLiteConvert.ToBoolean(stringValue);
    }

    /// <summary>
    /// Returns manifest information for the provider
    /// </summary>
    /// <param name="informationType">The name of the information to be retrieved.</param>
    /// <returns>An XmlReader at the begining of the information requested.</returns>
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
          throw new NotSupportedException(String.Format("SQLite does not support the type '{0}'.", storeTypeName));
      }
    }

    /// <summary>
    /// This method takes a type and a set of facets and returns the best mapped equivalent type 
    /// </summary>
    /// <param name="storeType">A TypeUsage encapsulating an EDM type and a set of facets</param>
    /// <returns>A TypeUsage encapsulating a store type and a set of facets</returns>
    public override TypeUsage GetStoreType(TypeUsage edmType)
    {
      if (edmType == null)
        throw new ArgumentNullException("edmType");

      PrimitiveType primitiveType = edmType.EdmType as PrimitiveType;







|







345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
          throw new NotSupportedException(String.Format("SQLite does not support the type '{0}'.", storeTypeName));
      }
    }

    /// <summary>
    /// This method takes a type and a set of facets and returns the best mapped equivalent type 
    /// </summary>
    /// <param name="edmType">A TypeUsage encapsulating an EDM type and a set of facets</param>
    /// <returns>A TypeUsage encapsulating a store type and a set of facets</returns>
    public override TypeUsage GetStoreType(TypeUsage edmType)
    {
      if (edmType == null)
        throw new ArgumentNullException("edmType");

      PrimitiveType primitiveType = edmType.EdmType as PrimitiveType;
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
        default:
          throw new NotSupportedException(String.Format("There is no store type corresponding to the EDM type '{0}' of primitive type '{1}'.", edmType, primitiveType.PrimitiveTypeKind));
      }
    }

    private XmlReader GetStoreSchemaMapping()
    {
      return GetXmlResource("System.Data.SQLite.Resources.SQLiteProviderServices.StoreSchemaMapping.msl");
    }

    private XmlReader GetStoreSchemaDescription()
    {
      return GetXmlResource("System.Data.SQLite.Resources.SQLiteProviderServices.StoreSchemaDefinition.ssdl");
    }

    internal static XmlReader GetXmlResource(string resourceName)
    {
      Assembly executingAssembly = Assembly.GetExecutingAssembly();
      Stream stream = executingAssembly.GetManifestResourceStream(resourceName);
      return XmlReader.Create(stream);







|




|







459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
        default:
          throw new NotSupportedException(String.Format("There is no store type corresponding to the EDM type '{0}' of primitive type '{1}'.", edmType, primitiveType.PrimitiveTypeKind));
      }
    }

    private XmlReader GetStoreSchemaMapping()
    {
      return GetXmlResource("System.Data.SQLite.SQLiteProviderServices.StoreSchemaMapping.msl");
    }

    private XmlReader GetStoreSchemaDescription()
    {
      return GetXmlResource("System.Data.SQLite.SQLiteProviderServices.StoreSchemaDefinition.ssdl");
    }

    internal static XmlReader GetXmlResource(string resourceName)
    {
      Assembly executingAssembly = Assembly.GetExecutingAssembly();
      Stream stream = executingAssembly.GetManifestResourceStream(resourceName);
      return XmlReader.Create(stream);

Changes to System.Data.SQLite.Linq/SQLiteProviderServices.cs.

1
2
3
4
5
6
7

8



9
10
11
12
13
14
15


16



17
18

19
20
21
22
23
24
25
26
27
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/


namespace System.Data.SQLite



{
  using System;
  using System.Data.Common;
  using System.Data.Common.CommandTrees;
  using System.Data.Metadata.Edm;
  using System.Diagnostics;
  using System.Collections.Generic;


  using System.Data.SQLite;



  using System.Text;
  using System.Globalization;


  internal class SQLiteProviderServices : DbProviderServices, ISQLiteSchemaExtensions
  {
    internal static readonly SQLiteProviderServices Instance = new SQLiteProviderServices();

    protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest manifest, DbCommandTree commandTree)
    {
      DbCommand prototype = CreateCommand(manifest, commandTree);
      DbCommandDefinition result = this.CreateCommandDefinition(prototype);







>
|
>
>
>


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

|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

#if USE_ENTITY_FRAMEWORK_6
namespace System.Data.SQLite.EF6
#else
namespace System.Data.SQLite.Linq
#endif
{
  using System;
  using System.Collections.Generic;
  using System.Data.Common;
  using System.Diagnostics;
  using System.Globalization;
  using System.Text;

#if USE_ENTITY_FRAMEWORK_6
  using System.Data.Entity.Core.Common;
  using System.Data.Entity.Core.Metadata.Edm;
  using System.Data.Entity.Core.Common.CommandTrees;
#else
  using System.Data.Metadata.Edm;
  using System.Data.Common.CommandTrees;
#endif

  internal sealed class SQLiteProviderServices : DbProviderServices, ISQLiteSchemaExtensions
  {
    internal static readonly SQLiteProviderServices Instance = new SQLiteProviderServices();

    protected override DbCommandDefinition CreateDbCommandDefinition(DbProviderManifest manifest, DbCommandTree commandTree)
    {
      DbCommand prototype = CreateCommand(manifest, commandTree);
      DbCommandDefinition result = this.CreateCommandDefinition(prototype);
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
          SQLiteParameter parameter;

          // Use the corresponding function parameter TypeUsage where available (currently, the SSDL facets and 
          // type trump user-defined facets and type in the EntityCommand).
          FunctionParameter functionParameter;
          if (null != function && function.Parameters.TryGetValue(queryParameter.Key, false, out functionParameter))
          {
            parameter = CreateSqlParameter(functionParameter.Name, functionParameter.TypeUsage, functionParameter.Mode, DBNull.Value);
          }
          else
          {
            parameter = CreateSqlParameter(queryParameter.Key, queryParameter.Value, ParameterMode.In, DBNull.Value);
          }

          command.Parameters.Add(parameter);
        }

        // Now add parameters added as part of SQL gen (note: this feature is only safe for DML SQL gen which
        // does not support user parameters, where there is no risk of name collision)







|



|







68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
          SQLiteParameter parameter;

          // Use the corresponding function parameter TypeUsage where available (currently, the SSDL facets and 
          // type trump user-defined facets and type in the EntityCommand).
          FunctionParameter functionParameter;
          if (null != function && function.Parameters.TryGetValue(queryParameter.Key, false, out functionParameter))
          {
            parameter = CreateSqlParameter((SQLiteProviderManifest)manifest, functionParameter.Name, functionParameter.TypeUsage, functionParameter.Mode, DBNull.Value);
          }
          else
          {
            parameter = CreateSqlParameter((SQLiteProviderManifest)manifest, queryParameter.Key, queryParameter.Value, ParameterMode.In, DBNull.Value);
          }

          command.Parameters.Add(parameter);
        }

        // Now add parameters added as part of SQL gen (note: this feature is only safe for DML SQL gen which
        // does not support user parameters, where there is no risk of name collision)
96
97
98
99
100
101
102



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120












121
122
123
124
125
126
127
        command.Dispose();
        throw;
      }
    }

    protected override string GetDbProviderManifestToken(DbConnection connection)
    {



      if (String.IsNullOrEmpty(connection.ConnectionString))
        throw new ArgumentNullException("ConnectionString");

      SortedList<string, string> opts = SQLiteConnection.ParseConnectionString(connection.ConnectionString);
      return SQLiteConnection.FindKey(opts, "DateTimeFormat", "ISO8601");
    }

    protected override DbProviderManifest GetDbProviderManifest(string versionHint)
    {
      return new SQLiteProviderManifest(versionHint);
    }

    /// <summary>
    /// Creates a SQLiteParameter given a name, type, and direction
    /// </summary>
    internal static SQLiteParameter CreateSqlParameter(string name, TypeUsage type, ParameterMode mode, object value)
    {
      int? size;













      SQLiteParameter result = new SQLiteParameter(name, value);

      // .Direction
      ParameterDirection direction = MetadataHelpers.ParameterModeToParameterDirection(mode);
      if (result.Direction != direction)
      {







>
>
>
|
|

|
<










|


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







106
107
108
109
110
111
112
113
114
115
116
117
118
119

120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
        command.Dispose();
        throw;
      }
    }

    protected override string GetDbProviderManifestToken(DbConnection connection)
    {
        if (connection == null)
            throw new ArgumentNullException("connection");

        if (String.IsNullOrEmpty(connection.ConnectionString))
            throw new ArgumentNullException("ConnectionString");

        return connection.ConnectionString;

    }

    protected override DbProviderManifest GetDbProviderManifest(string versionHint)
    {
      return new SQLiteProviderManifest(versionHint);
    }

    /// <summary>
    /// Creates a SQLiteParameter given a name, type, and direction
    /// </summary>
    internal static SQLiteParameter CreateSqlParameter(SQLiteProviderManifest manifest, string name, TypeUsage type, ParameterMode mode, object value)
    {
      int? size;

      //
      // NOTE: Adjust the parameter type so that it will work with textual
      //       GUIDs.  Please see ticket [a4d9c7ee94] for more details.
      //
      if ((manifest != null) && !manifest._binaryGuid &&
          (MetadataHelpers.GetPrimitiveTypeKind(type) == PrimitiveTypeKind.Guid))
      {
          type = TypeUsage.CreateStringTypeUsage(
              PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String),
              false, true);
      }

      SQLiteParameter result = new SQLiteParameter(name, value);

      // .Direction
      ParameterDirection direction = MetadataHelpers.ParameterModeToParameterDirection(mode);
      if (result.Direction != direction)
      {
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
    /// <remarks>
    /// There's a lot of work involved in getting schema information out of SQLite, but LINQ expects to
    /// be able to query on schema tables.  Therefore we need to "fake" it by generating temporary tables
    /// filled with the schema of the current connection.  We get away with making this information static
    /// because schema information seems to always be queried on a new connection object, so the schema is
    /// always fresh.
    /// </remarks>
    /// <param name="cnn">The connection upon which to build the schema tables</param>
    void ISQLiteSchemaExtensions.BuildTempSchema(SQLiteConnection cnn)
    {
      string[] arr = new string[] { "TABLES", "COLUMNS", "VIEWS", "VIEWCOLUMNS", "INDEXES", "INDEXCOLUMNS", "FOREIGNKEYS", "CATALOGS" };

      using (DataTable table = cnn.GetSchema("Tables", new string[] { "temp", null, String.Format("SCHEMA{0}", arr[0]) }))
      {
        if (table.Rows.Count > 0) return;







|







334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
    /// <remarks>
    /// There's a lot of work involved in getting schema information out of SQLite, but LINQ expects to
    /// be able to query on schema tables.  Therefore we need to "fake" it by generating temporary tables
    /// filled with the schema of the current connection.  We get away with making this information static
    /// because schema information seems to always be queried on a new connection object, so the schema is
    /// always fresh.
    /// </remarks>
    /// <param name="cnn">The connection upon which to build the schema tables.</param>
    void ISQLiteSchemaExtensions.BuildTempSchema(SQLiteConnection cnn)
    {
      string[] arr = new string[] { "TABLES", "COLUMNS", "VIEWS", "VIEWCOLUMNS", "INDEXES", "INDEXCOLUMNS", "FOREIGNKEYS", "CATALOGS" };

      using (DataTable table = cnn.GetSchema("Tables", new string[] { "temp", null, String.Format("SCHEMA{0}", arr[0]) }))
      {
        if (table.Rows.Count > 0) return;
354
355
356
357
358
359
360

361
362
363
364
365
366
367
368
369
370
371
      SQLiteCommandBuilder builder = new SQLiteCommandBuilder();

      using (SQLiteCommand cmd = cnn.CreateCommand())
      using (DataTable source = new DataTable())
      {
        sql.AppendFormat(CultureInfo.InvariantCulture, "CREATE TEMP TABLE {0} (", builder.QuoteIdentifier(dest));
        string separator = String.Empty;

        foreach (DataColumn dc in table.Columns)
        {
          DbType dbtypeName = SQLiteConvert.TypeToDbType(dc.DataType);
          string typeName = SQLiteConvert.DbTypeToTypeName(dbtypeName);

          sql.AppendFormat(CultureInfo.InvariantCulture, "{2}{0} {1} COLLATE NOCASE", builder.QuoteIdentifier(dc.ColumnName), typeName, separator);
          separator = ", ";
        }
        sql.Append(")");

        cmd.CommandText = sql.ToString();







>



|







378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
      SQLiteCommandBuilder builder = new SQLiteCommandBuilder();

      using (SQLiteCommand cmd = cnn.CreateCommand())
      using (DataTable source = new DataTable())
      {
        sql.AppendFormat(CultureInfo.InvariantCulture, "CREATE TEMP TABLE {0} (", builder.QuoteIdentifier(dest));
        string separator = String.Empty;
        SQLiteConnectionFlags flags = cnn.Flags;
        foreach (DataColumn dc in table.Columns)
        {
          DbType dbtypeName = SQLiteConvert.TypeToDbType(dc.DataType);
          string typeName = SQLiteConvert.DbTypeToTypeName(cnn, dbtypeName, flags);

          sql.AppendFormat(CultureInfo.InvariantCulture, "{2}{0} {1} COLLATE NOCASE", builder.QuoteIdentifier(dc.ColumnName), typeName, separator);
          separator = ", ";
        }
        sql.Append(")");

        cmd.CommandText = sql.ToString();

Added System.Data.SQLite.Linq/System.Data.SQLite.Core.2010.csproj.













































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Core.2010.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>10.0.30319</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid Condition="'$(UseEntityFramework6)' == 'false'">{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}</ProjectGuid>
    <ProjectGuid Condition="'$(UseEntityFramework6)' != 'false'">{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace Condition="'$(UseEntityFramework6)' == 'false'">System.Data.SQLite.Linq</RootNamespace>
    <RootNamespace Condition="'$(UseEntityFramework6)' != 'false'">System.Data.SQLite.EF6</RootNamespace>
    <AssemblyName Condition="'$(UseEntityFramework6)' == 'false'">System.Data.SQLite.Linq</AssemblyName>
    <AssemblyName Condition="'$(UseEntityFramework6)' != 'false'">System.Data.SQLite.EF6</AssemblyName>
    <OldToolsVersion>3.5</OldToolsVersion>
    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx40>true</NetFx40>
    <ConfigurationYear>2010</ConfigurationYear>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile Condition="'$(UseEntityFramework6)' == 'false'">$(BinaryOutputPath)System.Data.SQLite.Linq.xml</DocumentationFile>
    <DocumentationFile Condition="'$(UseEntityFramework6)' != 'false'">$(BinaryOutputPath)System.Data.SQLite.EF6.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' == 'false'">
    <Reference Include="System.Data.Entity" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' != 'false'">
    <Reference Include="EntityFramework">
      <HintPath>$(SQLiteNetDir)\Externals\EntityFramework\v6.2\lib\net40\EntityFramework.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="SQL Generation\DmlSqlGenerator.cs" />
    <Compile Include="SQL Generation\InternalBase.cs" />
    <Compile Include="SQL Generation\ISqlFragment.cs" />
    <Compile Include="SQL Generation\JoinSymbol.cs" />
    <Compile Include="SQL Generation\KeyToListMap.cs" />
    <Compile Include="SQL Generation\MetadataHelpers.cs" />
    <Compile Include="SQL Generation\SkipClause.cs" />
    <Compile Include="SQL Generation\SqlBuilder.cs" />
    <Compile Include="SQL Generation\SqlChecker.cs" />
    <Compile Include="SQL Generation\SqlGenerator.cs" />
    <Compile Include="SQL Generation\SqlSelectStatement.cs" />
    <Compile Include="SQL Generation\SqlWriter.cs" />
    <Compile Include="SQL Generation\StringUtil.cs" />
    <Compile Include="SQL Generation\Symbol.cs" />
    <Compile Include="SQL Generation\SymbolPair.cs" />
    <Compile Include="SQL Generation\SymbolTable.cs" />
    <Compile Include="SQL Generation\TopClause.cs" />
    <Compile Include="SQLiteProviderFactory.cs" />
    <Compile Include="SQLiteProviderManifest.cs" />
    <Compile Include="SQLiteProviderServices.cs" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' == 'false'">
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaDefinition.Linq.ssdl">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.StoreSchemaDefinition.ssdl</LogicalName>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' != 'false'">
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaDefinition.EF6.ssdl">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.StoreSchemaDefinition.ssdl</LogicalName>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Resources\Common.ConceptualSchemaDefinition.csdl">
      <LogicalName>System.Data.SQLite.Common.ConceptualSchemaDefinition.csdl</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\SQLiteProviderServices.ProviderManifest.xml">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.ProviderManifest.xml</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaMapping.msl">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.StoreSchemaMapping.msl</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <LogicalName>System.Data.SQLite.Properties.resources</LogicalName>
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.2010.csproj">
      <Project>{AC139952-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.2010</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite.Linq/System.Data.SQLite.Core.2012.csproj.





































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Core.2012.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid Condition="'$(UseEntityFramework6)' == 'false'">{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}</ProjectGuid>
    <ProjectGuid Condition="'$(UseEntityFramework6)' != 'false'">{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace Condition="'$(UseEntityFramework6)' == 'false'">System.Data.SQLite.Linq</RootNamespace>
    <RootNamespace Condition="'$(UseEntityFramework6)' != 'false'">System.Data.SQLite.EF6</RootNamespace>
    <AssemblyName Condition="'$(UseEntityFramework6)' == 'false'">System.Data.SQLite.Linq</AssemblyName>
    <AssemblyName Condition="'$(UseEntityFramework6)' != 'false'">System.Data.SQLite.EF6</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx45>true</NetFx45>
    <ConfigurationYear>2012</ConfigurationYear>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile Condition="'$(UseEntityFramework6)' == 'false'">$(BinaryOutputPath)System.Data.SQLite.Linq.xml</DocumentationFile>
    <DocumentationFile Condition="'$(UseEntityFramework6)' != 'false'">$(BinaryOutputPath)System.Data.SQLite.EF6.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' == 'false'">
    <Reference Include="System.Data.Entity" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' != 'false'">
    <Reference Include="EntityFramework"
               Condition="'$(NetFx40)' != 'false'">
      <HintPath>$(SQLiteNetDir)\Externals\EntityFramework\v6.2\lib\net40\EntityFramework.dll</HintPath>
    </Reference>
    <Reference Include="EntityFramework"
               Condition="'$(NetFx45)' != 'false' Or
                          '$(NetFx451)' != 'false' Or
                          '$(NetFx452)' != 'false' Or
                          '$(NetFx46)' != 'false' Or
                          '$(NetFx461)' != 'false' Or
                          '$(NetFx462)' != 'false' Or
                          '$(NetFx47)' != 'false' Or
                          '$(NetFx471)' != 'false' Or
                          '$(NetFx472)' != 'false' Or
                          '$(NetFx48)' != 'false'">
      <HintPath>$(SQLiteNetDir)\Externals\EntityFramework\v6.2\lib\net45\EntityFramework.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="SQL Generation\DmlSqlGenerator.cs" />
    <Compile Include="SQL Generation\InternalBase.cs" />
    <Compile Include="SQL Generation\ISqlFragment.cs" />
    <Compile Include="SQL Generation\JoinSymbol.cs" />
    <Compile Include="SQL Generation\KeyToListMap.cs" />
    <Compile Include="SQL Generation\MetadataHelpers.cs" />
    <Compile Include="SQL Generation\SkipClause.cs" />
    <Compile Include="SQL Generation\SqlBuilder.cs" />
    <Compile Include="SQL Generation\SqlChecker.cs" />
    <Compile Include="SQL Generation\SqlGenerator.cs" />
    <Compile Include="SQL Generation\SqlSelectStatement.cs" />
    <Compile Include="SQL Generation\SqlWriter.cs" />
    <Compile Include="SQL Generation\StringUtil.cs" />
    <Compile Include="SQL Generation\Symbol.cs" />
    <Compile Include="SQL Generation\SymbolPair.cs" />
    <Compile Include="SQL Generation\SymbolTable.cs" />
    <Compile Include="SQL Generation\TopClause.cs" />
    <Compile Include="SQLiteProviderFactory.cs" />
    <Compile Include="SQLiteProviderManifest.cs" />
    <Compile Include="SQLiteProviderServices.cs" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' == 'false'">
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaDefinition.Linq.ssdl">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.StoreSchemaDefinition.ssdl</LogicalName>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' != 'false'">
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaDefinition.EF6.ssdl">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.StoreSchemaDefinition.ssdl</LogicalName>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Resources\Common.ConceptualSchemaDefinition.csdl">
      <LogicalName>System.Data.SQLite.Common.ConceptualSchemaDefinition.csdl</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\SQLiteProviderServices.ProviderManifest.xml">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.ProviderManifest.xml</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaMapping.msl">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.StoreSchemaMapping.msl</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <LogicalName>System.Data.SQLite.Properties.resources</LogicalName>
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.2012.csproj">
      <Project>{AC139952-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.2012</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite.Linq/System.Data.SQLite.Core.2013.csproj.





































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Core.2013.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid Condition="'$(UseEntityFramework6)' == 'false'">{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}</ProjectGuid>
    <ProjectGuid Condition="'$(UseEntityFramework6)' != 'false'">{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace Condition="'$(UseEntityFramework6)' == 'false'">System.Data.SQLite.Linq</RootNamespace>
    <RootNamespace Condition="'$(UseEntityFramework6)' != 'false'">System.Data.SQLite.EF6</RootNamespace>
    <AssemblyName Condition="'$(UseEntityFramework6)' == 'false'">System.Data.SQLite.Linq</AssemblyName>
    <AssemblyName Condition="'$(UseEntityFramework6)' != 'false'">System.Data.SQLite.EF6</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx451>true</NetFx451>
    <ConfigurationYear>2013</ConfigurationYear>
    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile Condition="'$(UseEntityFramework6)' == 'false'">$(BinaryOutputPath)System.Data.SQLite.Linq.xml</DocumentationFile>
    <DocumentationFile Condition="'$(UseEntityFramework6)' != 'false'">$(BinaryOutputPath)System.Data.SQLite.EF6.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' == 'false'">
    <Reference Include="System.Data.Entity" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' != 'false'">
    <Reference Include="EntityFramework"
               Condition="'$(NetFx40)' != 'false'">
      <HintPath>$(SQLiteNetDir)\Externals\EntityFramework\v6.2\lib\net40\EntityFramework.dll</HintPath>
    </Reference>
    <Reference Include="EntityFramework"
               Condition="'$(NetFx45)' != 'false' Or
                          '$(NetFx451)' != 'false' Or
                          '$(NetFx452)' != 'false' Or
                          '$(NetFx46)' != 'false' Or
                          '$(NetFx461)' != 'false' Or
                          '$(NetFx462)' != 'false' Or
                          '$(NetFx47)' != 'false' Or
                          '$(NetFx471)' != 'false' Or
                          '$(NetFx472)' != 'false' Or
                          '$(NetFx48)' != 'false'">
      <HintPath>$(SQLiteNetDir)\Externals\EntityFramework\v6.2\lib\net45\EntityFramework.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="SQL Generation\DmlSqlGenerator.cs" />
    <Compile Include="SQL Generation\InternalBase.cs" />
    <Compile Include="SQL Generation\ISqlFragment.cs" />
    <Compile Include="SQL Generation\JoinSymbol.cs" />
    <Compile Include="SQL Generation\KeyToListMap.cs" />
    <Compile Include="SQL Generation\MetadataHelpers.cs" />
    <Compile Include="SQL Generation\SkipClause.cs" />
    <Compile Include="SQL Generation\SqlBuilder.cs" />
    <Compile Include="SQL Generation\SqlChecker.cs" />
    <Compile Include="SQL Generation\SqlGenerator.cs" />
    <Compile Include="SQL Generation\SqlSelectStatement.cs" />
    <Compile Include="SQL Generation\SqlWriter.cs" />
    <Compile Include="SQL Generation\StringUtil.cs" />
    <Compile Include="SQL Generation\Symbol.cs" />
    <Compile Include="SQL Generation\SymbolPair.cs" />
    <Compile Include="SQL Generation\SymbolTable.cs" />
    <Compile Include="SQL Generation\TopClause.cs" />
    <Compile Include="SQLiteProviderFactory.cs" />
    <Compile Include="SQLiteProviderManifest.cs" />
    <Compile Include="SQLiteProviderServices.cs" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' == 'false'">
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaDefinition.Linq.ssdl">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.StoreSchemaDefinition.ssdl</LogicalName>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' != 'false'">
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaDefinition.EF6.ssdl">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.StoreSchemaDefinition.ssdl</LogicalName>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Resources\Common.ConceptualSchemaDefinition.csdl">
      <LogicalName>System.Data.SQLite.Common.ConceptualSchemaDefinition.csdl</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\SQLiteProviderServices.ProviderManifest.xml">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.ProviderManifest.xml</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaMapping.msl">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.StoreSchemaMapping.msl</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <LogicalName>System.Data.SQLite.Properties.resources</LogicalName>
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.2013.csproj">
      <Project>{AC139952-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.2013</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite.Linq/System.Data.SQLite.Core.2015.csproj.





































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Core.2015.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid Condition="'$(UseEntityFramework6)' == 'false'">{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}</ProjectGuid>
    <ProjectGuid Condition="'$(UseEntityFramework6)' != 'false'">{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace Condition="'$(UseEntityFramework6)' == 'false'">System.Data.SQLite.Linq</RootNamespace>
    <RootNamespace Condition="'$(UseEntityFramework6)' != 'false'">System.Data.SQLite.EF6</RootNamespace>
    <AssemblyName Condition="'$(UseEntityFramework6)' == 'false'">System.Data.SQLite.Linq</AssemblyName>
    <AssemblyName Condition="'$(UseEntityFramework6)' != 'false'">System.Data.SQLite.EF6</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx46>true</NetFx46>
    <ConfigurationYear>2015</ConfigurationYear>
    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile Condition="'$(UseEntityFramework6)' == 'false'">$(BinaryOutputPath)System.Data.SQLite.Linq.xml</DocumentationFile>
    <DocumentationFile Condition="'$(UseEntityFramework6)' != 'false'">$(BinaryOutputPath)System.Data.SQLite.EF6.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' == 'false'">
    <Reference Include="System.Data.Entity" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' != 'false'">
    <Reference Include="EntityFramework"
               Condition="'$(NetFx40)' != 'false'">
      <HintPath>$(SQLiteNetDir)\Externals\EntityFramework\v6.2\lib\net40\EntityFramework.dll</HintPath>
    </Reference>
    <Reference Include="EntityFramework"
               Condition="'$(NetFx45)' != 'false' Or
                          '$(NetFx451)' != 'false' Or
                          '$(NetFx452)' != 'false' Or
                          '$(NetFx46)' != 'false' Or
                          '$(NetFx461)' != 'false' Or
                          '$(NetFx462)' != 'false' Or
                          '$(NetFx47)' != 'false' Or
                          '$(NetFx471)' != 'false' Or
                          '$(NetFx472)' != 'false' Or
                          '$(NetFx48)' != 'false'">
      <HintPath>$(SQLiteNetDir)\Externals\EntityFramework\v6.2\lib\net45\EntityFramework.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="SQL Generation\DmlSqlGenerator.cs" />
    <Compile Include="SQL Generation\InternalBase.cs" />
    <Compile Include="SQL Generation\ISqlFragment.cs" />
    <Compile Include="SQL Generation\JoinSymbol.cs" />
    <Compile Include="SQL Generation\KeyToListMap.cs" />
    <Compile Include="SQL Generation\MetadataHelpers.cs" />
    <Compile Include="SQL Generation\SkipClause.cs" />
    <Compile Include="SQL Generation\SqlBuilder.cs" />
    <Compile Include="SQL Generation\SqlChecker.cs" />
    <Compile Include="SQL Generation\SqlGenerator.cs" />
    <Compile Include="SQL Generation\SqlSelectStatement.cs" />
    <Compile Include="SQL Generation\SqlWriter.cs" />
    <Compile Include="SQL Generation\StringUtil.cs" />
    <Compile Include="SQL Generation\Symbol.cs" />
    <Compile Include="SQL Generation\SymbolPair.cs" />
    <Compile Include="SQL Generation\SymbolTable.cs" />
    <Compile Include="SQL Generation\TopClause.cs" />
    <Compile Include="SQLiteProviderFactory.cs" />
    <Compile Include="SQLiteProviderManifest.cs" />
    <Compile Include="SQLiteProviderServices.cs" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' == 'false'">
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaDefinition.Linq.ssdl">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.StoreSchemaDefinition.ssdl</LogicalName>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' != 'false'">
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaDefinition.EF6.ssdl">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.StoreSchemaDefinition.ssdl</LogicalName>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Resources\Common.ConceptualSchemaDefinition.csdl">
      <LogicalName>System.Data.SQLite.Common.ConceptualSchemaDefinition.csdl</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\SQLiteProviderServices.ProviderManifest.xml">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.ProviderManifest.xml</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaMapping.msl">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.StoreSchemaMapping.msl</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <LogicalName>System.Data.SQLite.Properties.resources</LogicalName>
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.2015.csproj">
      <Project>{AC139952-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.2015</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite.Linq/System.Data.SQLite.Core.2017.csproj.





































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Core.2017.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid Condition="'$(UseEntityFramework6)' == 'false'">{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}</ProjectGuid>
    <ProjectGuid Condition="'$(UseEntityFramework6)' != 'false'">{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace Condition="'$(UseEntityFramework6)' == 'false'">System.Data.SQLite.Linq</RootNamespace>
    <RootNamespace Condition="'$(UseEntityFramework6)' != 'false'">System.Data.SQLite.EF6</RootNamespace>
    <AssemblyName Condition="'$(UseEntityFramework6)' == 'false'">System.Data.SQLite.Linq</AssemblyName>
    <AssemblyName Condition="'$(UseEntityFramework6)' != 'false'">System.Data.SQLite.EF6</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx47>true</NetFx47>
    <ConfigurationYear>2017</ConfigurationYear>
    <TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile Condition="'$(UseEntityFramework6)' == 'false'">$(BinaryOutputPath)System.Data.SQLite.Linq.xml</DocumentationFile>
    <DocumentationFile Condition="'$(UseEntityFramework6)' != 'false'">$(BinaryOutputPath)System.Data.SQLite.EF6.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' == 'false'">
    <Reference Include="System.Data.Entity" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' != 'false'">
    <Reference Include="EntityFramework"
               Condition="'$(NetFx40)' != 'false'">
      <HintPath>$(SQLiteNetDir)\Externals\EntityFramework\v6.4\lib\net40\EntityFramework.dll</HintPath>
    </Reference>
    <Reference Include="EntityFramework"
               Condition="'$(NetFx45)' != 'false' Or
                          '$(NetFx451)' != 'false' Or
                          '$(NetFx452)' != 'false' Or
                          '$(NetFx46)' != 'false' Or
                          '$(NetFx461)' != 'false' Or
                          '$(NetFx462)' != 'false' Or
                          '$(NetFx47)' != 'false' Or
                          '$(NetFx471)' != 'false' Or
                          '$(NetFx472)' != 'false' Or
                          '$(NetFx48)' != 'false'">
      <HintPath>$(SQLiteNetDir)\Externals\EntityFramework\v6.4\lib\net45\EntityFramework.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="SQL Generation\DmlSqlGenerator.cs" />
    <Compile Include="SQL Generation\InternalBase.cs" />
    <Compile Include="SQL Generation\ISqlFragment.cs" />
    <Compile Include="SQL Generation\JoinSymbol.cs" />
    <Compile Include="SQL Generation\KeyToListMap.cs" />
    <Compile Include="SQL Generation\MetadataHelpers.cs" />
    <Compile Include="SQL Generation\SkipClause.cs" />
    <Compile Include="SQL Generation\SqlBuilder.cs" />
    <Compile Include="SQL Generation\SqlChecker.cs" />
    <Compile Include="SQL Generation\SqlGenerator.cs" />
    <Compile Include="SQL Generation\SqlSelectStatement.cs" />
    <Compile Include="SQL Generation\SqlWriter.cs" />
    <Compile Include="SQL Generation\StringUtil.cs" />
    <Compile Include="SQL Generation\Symbol.cs" />
    <Compile Include="SQL Generation\SymbolPair.cs" />
    <Compile Include="SQL Generation\SymbolTable.cs" />
    <Compile Include="SQL Generation\TopClause.cs" />
    <Compile Include="SQLiteProviderFactory.cs" />
    <Compile Include="SQLiteProviderManifest.cs" />
    <Compile Include="SQLiteProviderServices.cs" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' == 'false'">
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaDefinition.Linq.ssdl">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.StoreSchemaDefinition.ssdl</LogicalName>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' != 'false'">
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaDefinition.EF6.ssdl">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.StoreSchemaDefinition.ssdl</LogicalName>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Resources\Common.ConceptualSchemaDefinition.csdl">
      <LogicalName>System.Data.SQLite.Common.ConceptualSchemaDefinition.csdl</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\SQLiteProviderServices.ProviderManifest.xml">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.ProviderManifest.xml</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaMapping.msl">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.StoreSchemaMapping.msl</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <LogicalName>System.Data.SQLite.Properties.resources</LogicalName>
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.2017.csproj">
      <Project>{AC139952-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.2017</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite.Linq/System.Data.SQLite.EF6.2010.csproj.

































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.EF6.2010.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <UseEntityFramework6>true</UseEntityFramework6>
    <ProjectGuid>{F1B93C04-C4AE-4D6D-B353-417AEFDCEE7B}</ProjectGuid>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\System.Data.SQLite.Core.2010.csproj" />
</Project>

Added System.Data.SQLite.Linq/System.Data.SQLite.EF6.2012.csproj.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.EF6.2012.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <UseEntityFramework6>true</UseEntityFramework6>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\System.Data.SQLite.Core.2012.csproj" />
</Project>

Added System.Data.SQLite.Linq/System.Data.SQLite.EF6.2013.csproj.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.EF6.2013.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
  <PropertyGroup>
    <UseEntityFramework6>true</UseEntityFramework6>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\System.Data.SQLite.Core.2013.csproj" />
</Project>

Added System.Data.SQLite.Linq/System.Data.SQLite.EF6.2015.csproj.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.EF6.2015.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
  <PropertyGroup>
    <UseEntityFramework6>true</UseEntityFramework6>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\System.Data.SQLite.Core.2015.csproj" />
</Project>

Added System.Data.SQLite.Linq/System.Data.SQLite.EF6.2017.csproj.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.EF6.2017.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <UseEntityFramework6>true</UseEntityFramework6>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\System.Data.SQLite.Core.2017.csproj" />
</Project>

Added System.Data.SQLite.Linq/System.Data.SQLite.EF6.NetStandard21.csproj.































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.EF6.NetStandard21.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="16.0">
  <!--
  ******************************************************************************
  **                     Import .NET Core SDK Properties                      **
  ******************************************************************************
  -->

  <!--
      WARNING: This project cannot use the recommended pattern of having the
               "Project" element simply include the "Sdk" attribute, due to
               the "BuildDependsOn" property not being honored, see:

               https://github.com/Microsoft/msbuild/issues/1680

               Instead, the .NET Core SDK properties file is imported here
               and the corresponding targets file is imported right before
               resetting the "BuildDependsOn" property to include targets
               necessary for this project.
  -->
  <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

  <!--
  ******************************************************************************
  **                       Project Specific Properties                        **
  ******************************************************************************
  -->

  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite.EF6</RootNamespace>
    <AssemblyName>System.Data.SQLite.EF6</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <IsDotNetStandard>true</IsDotNetStandard>
    <ConfigurationYear>NetStandard21</ConfigurationYear>
    <UseEntityFramework6>true</UseEntityFramework6>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **             Project / .NET Standard 2.1 Specific Properties              **
  ******************************************************************************
  -->

  <PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <Deterministic>False</Deterministic>
    <EnableDefaultItems>false</EnableDefaultItems>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **    .NET Standard 2.1 Specific Strong Name Signing Property Overrides     **
  ******************************************************************************
  -->

  <PropertyGroup>
    <!--
        NOTE: Apparently, the .NET Core build system sets the SignAssembly
              property to false; therefore, reset it to true.  Also, delay
              signing is currently non-functional due to the inability to
              run the strong name signing tool (sn.exe).  It behaves badly
              when run against a .NET Core assembly.
    -->
    <SignAssembly>true</SignAssembly>
    <DelaySign>false</DelaySign>

    <!--
        TODO: Why is this needed?  It seems that public signing is quite
              similar to delay signing.  Why is this necessary when not
              running on Windows?
    -->
    <PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                     Import Project Default Settings                      **
  ******************************************************************************
  -->

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />

  <!--
  ******************************************************************************
  **                       Import Project Build Targets                       **
  ******************************************************************************
  -->

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />

  <!--
  ******************************************************************************
  **               Convert Project Settings To MSBuild Settings               **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)netstandard2.1\System.Data.SQLite.EF6.xml</DocumentationFile>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                Project Configuration Specific Properties                 **
  ******************************************************************************
  -->

  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                Project Source Code Files (Unconditional)                 **
  ******************************************************************************
  -->

  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="SQL Generation\DmlSqlGenerator.cs" />
    <Compile Include="SQL Generation\InternalBase.cs" />
    <Compile Include="SQL Generation\ISqlFragment.cs" />
    <Compile Include="SQL Generation\JoinSymbol.cs" />
    <Compile Include="SQL Generation\KeyToListMap.cs" />
    <Compile Include="SQL Generation\MetadataHelpers.cs" />
    <Compile Include="SQL Generation\SkipClause.cs" />
    <Compile Include="SQL Generation\SqlBuilder.cs" />
    <Compile Include="SQL Generation\SqlChecker.cs" />
    <Compile Include="SQL Generation\SqlGenerator.cs" />
    <Compile Include="SQL Generation\SqlSelectStatement.cs" />
    <Compile Include="SQL Generation\SqlWriter.cs" />
    <Compile Include="SQL Generation\StringUtil.cs" />
    <Compile Include="SQL Generation\Symbol.cs" />
    <Compile Include="SQL Generation\SymbolPair.cs" />
    <Compile Include="SQL Generation\SymbolTable.cs" />
    <Compile Include="SQL Generation\TopClause.cs" />
    <Compile Include="SQLiteProviderFactory.cs" />
    <Compile Include="SQLiteProviderManifest.cs" />
    <Compile Include="SQLiteProviderServices.cs" />
  </ItemGroup>

  <!--
  ******************************************************************************
  **                     Project Embedded Resource Files                      **
  ******************************************************************************
  -->

  <ItemGroup>
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaDefinition.EF6.ssdl">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.StoreSchemaDefinition.ssdl</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\Common.ConceptualSchemaDefinition.csdl">
      <LogicalName>System.Data.SQLite.Common.ConceptualSchemaDefinition.csdl</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\SQLiteProviderServices.ProviderManifest.xml">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.ProviderManifest.xml</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaMapping.msl">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.StoreSchemaMapping.msl</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <LogicalName>System.Data.SQLite.Properties.resources</LogicalName>
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>

  <!--
  ******************************************************************************
  **                        Library Project References                        **
  ******************************************************************************
  -->

  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.NetStandard21.csproj">
      <Project>{AC139952-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.NetStandard21</Name>
      <Private>False</Private>
    </ProjectReference>
  </ItemGroup>

  <!--
  ******************************************************************************
  **                      .NET Core Assembly References                       **
  ******************************************************************************
  -->

  <ItemGroup>
    <PackageReference Include="EntityFramework" Version="6.4.4" />
  </ItemGroup>

  <!--
  ******************************************************************************
  **                       Import .NET Core SDK Targets                       **
  ******************************************************************************
  -->

  <!--
      WARNING: This project cannot use the recommended pattern of having the
               "Project" element simply include the "Sdk" attribute, see the
               comment at the top of this file for more information.
  -->
  <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

  <!--
  ******************************************************************************
  **                           Import Build Targets                           **
  ******************************************************************************
  -->

  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />

  <!--
  ******************************************************************************
  **                  Add Targets To BuildDependsOn Property                  **
  ******************************************************************************
  -->

  <PropertyGroup>
    <BuildDependsOn>
      DetectBuildTool;
      DetectOperatingSystem;
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite.Linq/System.Data.SQLite.Linq.2008.csproj.











































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Linq.2008.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite.Linq</RootNamespace>
    <AssemblyName>System.Data.SQLite.Linq</AssemblyName>
    <OldToolsVersion>2.0</OldToolsVersion>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx35>true</NetFx35>
    <ConfigurationYear>2008</ConfigurationYear>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)System.Data.SQLite.Linq.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Data" />
    <Reference Include="System.Data.Entity" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="SQL Generation\DmlSqlGenerator.cs" />
    <Compile Include="SQL Generation\InternalBase.cs" />
    <Compile Include="SQL Generation\ISqlFragment.cs" />
    <Compile Include="SQL Generation\JoinSymbol.cs" />
    <Compile Include="SQL Generation\KeyToListMap.cs" />
    <Compile Include="SQL Generation\MetadataHelpers.cs" />
    <Compile Include="SQL Generation\SkipClause.cs" />
    <Compile Include="SQL Generation\SqlBuilder.cs" />
    <Compile Include="SQL Generation\SqlChecker.cs" />
    <Compile Include="SQL Generation\SqlGenerator.cs" />
    <Compile Include="SQL Generation\SqlSelectStatement.cs" />
    <Compile Include="SQL Generation\SqlWriter.cs" />
    <Compile Include="SQL Generation\StringUtil.cs" />
    <Compile Include="SQL Generation\Symbol.cs" />
    <Compile Include="SQL Generation\SymbolPair.cs" />
    <Compile Include="SQL Generation\SymbolTable.cs" />
    <Compile Include="SQL Generation\TopClause.cs" />
    <Compile Include="SQLiteProviderFactory.cs" />
    <Compile Include="SQLiteProviderManifest.cs" />
    <Compile Include="SQLiteProviderServices.cs" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaDefinition.Linq.ssdl">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.StoreSchemaDefinition.ssdl</LogicalName>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Resources\Common.ConceptualSchemaDefinition.csdl">
      <LogicalName>System.Data.SQLite.Common.ConceptualSchemaDefinition.csdl</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\SQLiteProviderServices.ProviderManifest.xml">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.ProviderManifest.xml</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaMapping.msl">
      <LogicalName>System.Data.SQLite.SQLiteProviderServices.StoreSchemaMapping.msl</LogicalName>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <LogicalName>System.Data.SQLite.Properties.resources</LogicalName>
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.2008.csproj">
      <Project>{AC139952-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.2008</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite.Linq/System.Data.SQLite.Linq.2010.csproj.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Linq.2010.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <UseEntityFramework6>false</UseEntityFramework6>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\System.Data.SQLite.Core.2010.csproj" />
</Project>

Added System.Data.SQLite.Linq/System.Data.SQLite.Linq.2012.csproj.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Linq.2012.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <UseEntityFramework6>false</UseEntityFramework6>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\System.Data.SQLite.Core.2012.csproj" />
</Project>

Added System.Data.SQLite.Linq/System.Data.SQLite.Linq.2013.csproj.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Linq.2013.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
  <PropertyGroup>
    <UseEntityFramework6>false</UseEntityFramework6>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\System.Data.SQLite.Core.2013.csproj" />
</Project>

Added System.Data.SQLite.Linq/System.Data.SQLite.Linq.2015.csproj.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Linq.2015.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
  <PropertyGroup>
    <UseEntityFramework6>false</UseEntityFramework6>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\System.Data.SQLite.Core.2015.csproj" />
</Project>

Added System.Data.SQLite.Linq/System.Data.SQLite.Linq.2017.csproj.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Linq.2017.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <UseEntityFramework6>false</UseEntityFramework6>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\System.Data.SQLite.Core.2017.csproj" />
</Project>

Deleted System.Data.SQLite.Linq/System.Data.SQLite.Linq.csproj.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{E6BF9F74-58E2-413B-A7CE-EA653ECB728D}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite.Linq</AssemblyName>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <TargetFrameworkSubset>Full</TargetFrameworkSubset>
    <SignAssembly>true</SignAssembly>
    <AssemblyOriginatorKeyFile>..\System.Data.SQLite\System.Data.SQLite.snk</AssemblyOriginatorKeyFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>..\bin\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <UseVSHostingProcess>false</UseVSHostingProcess>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>none</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>..\bin\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <UseVSHostingProcess>false</UseVSHostingProcess>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core">
      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    </Reference>
    <Reference Include="System.Data" />
    <Reference Include="System.Data.Entity">
      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    </Reference>
    <Reference Include="System.Data.SQLite, Version=1.0.54.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\bin\System.Data.SQLite.DLL</HintPath>
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="SQL Generation\DmlSqlGenerator.cs" />
    <Compile Include="SQL Generation\ISqlFragment.cs" />
    <Compile Include="SQL Generation\JoinSymbol.cs" />
    <Compile Include="SQL Generation\MetadataHelpers.cs" />
    <Compile Include="SQL Generation\SqlBuilder.cs" />
    <Compile Include="SQL Generation\SqlChecker.cs" />
    <Compile Include="SQL Generation\SqlGenerator.cs" />
    <Compile Include="SQL Generation\SqlSelectStatement.cs" />
    <Compile Include="SQL Generation\SqlWriter.cs" />
    <Compile Include="SQL Generation\Symbol.cs" />
    <Compile Include="SQL Generation\SymbolPair.cs" />
    <Compile Include="SQL Generation\SymbolTable.cs" />
    <Compile Include="SQL Generation\TopClause.cs" />
    <Compile Include="SQLiteProviderManifest.cs" />
    <Compile Include="SQLiteProviderServices.cs" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Resources\Common.ConceptualSchemaDefinition.csdl" />
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaDefinition.ssdl" />
    <EmbeddedResource Include="Resources\SQLiteProviderServices.StoreSchemaMapping.msl" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <EmbeddedResource Include="Resources\SQLiteProviderServices.ProviderManifest.xml" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































Added System.Data.SQLite.url.





>
>
1
2
[InternetShortcut]
URL=https://system.data.sqlite.org/

Changes to System.Data.SQLite/AssemblyInfo.cs.








1
2
3
4
5
6
7
8
9

10
11
12
13
14
15
16
17
18
19
20
21


22

23

24
25
26
27
28
29
30
31
32
33
34





35
36
37

38


39
40






41
42
43
44
45
46
47
48
49
50
51
52
53
54
55







using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Security;
using System.Resources;

#if !PLATFORM_COMPACTFRAMEWORK

using System.Runtime.ConstrainedExecution;
#endif

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("System.Data.SQLite")]
[assembly: AssemblyDescription("ADO.NET 2.0 Data Provider for SQLite")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("http://sqlite.phxsoftware.com")]
[assembly: AssemblyProduct("System.Data.SQLite")]
[assembly: AssemblyCopyright("Public Domain")]


[assembly: AssemblyTrademark("")]

[assembly: AssemblyCulture("")]


#if PLATFORM_COMPACTFRAMEWORK && RETARGETABLE
[assembly: AssemblyFlags(AssemblyNameFlags.Retargetable)]
#endif

//  Setting ComVisible to false makes the types in this assembly not visible 
//  to COM componenets.  If you need to access a type in this assembly from 
//  COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: InternalsVisibleTo("System.Data.SQLite.Linq, PublicKey=002400000480000094000000060200000024000052534131000400000100010005a288de5687c4e1b621ddff5d844727418956997f475eb829429e411aff3e93f97b70de698b972640925bdd44280df0a25a843266973704137cbb0e7441c1fe7cae4e2440ae91ab8cde3933febcb1ac48dd33b40e13c421d8215c18a4349a436dd499e3c385cc683015f886f6c10bd90115eb2bd61b67750839e3a19941dc9c")]





[assembly: NeutralResourcesLanguage("en")]

#if !PLATFORM_COMPACTFRAMEWORK

[assembly: AllowPartiallyTrustedCallers]


[assembly: ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]






#endif

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Revision and Build Numbers 
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.67.0")]
#if !PLATFORM_COMPACTFRAMEWORK
[assembly: AssemblyFileVersion("1.0.67.0")]
#endif
>
>
>
>
>
>
>




<
<



>



|


|
|
<
|


>
>
|
>
|
>





|
|



|
>
>
>
>
>



>

>
>

|
>
>
>
>
>
>





|



|

|

|

1
2
3
4
5
6
7
8
9
10
11


12
13
14
15
16
17
18
19
20
21
22
23

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;


using System.Resources;

#if !PLATFORM_COMPACTFRAMEWORK
using System.Security;
using System.Runtime.ConstrainedExecution;
#endif

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("System.Data.SQLite Core")]
[assembly: AssemblyDescription("ADO.NET Data Provider for SQLite")]

[assembly: AssemblyCompany("https://system.data.sqlite.org/")]
[assembly: AssemblyProduct("System.Data.SQLite")]
[assembly: AssemblyCopyright("Public Domain")]

#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif

#if PLATFORM_COMPACTFRAMEWORK && RETARGETABLE
[assembly: AssemblyFlags(AssemblyNameFlags.Retargetable)]
#endif

//  Setting ComVisible to false makes the types in this assembly not visible
//  to COM componenets.  If you need to access a type in this assembly from
//  COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
[assembly: InternalsVisibleTo("System.Data.SQLite.Linq, PublicKey=" + System.Data.SQLite.SQLite3.PublicKey)]

#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_20 || NET_STANDARD_21
[assembly: InternalsVisibleTo("System.Data.SQLite.EF6, PublicKey=" + System.Data.SQLite.SQLite3.PublicKey)]
#endif

[assembly: NeutralResourcesLanguage("en")]

#if !PLATFORM_COMPACTFRAMEWORK
#if !NET_40 && !NET_45 && !NET_451 && !NET_452 && !NET_46 && !NET_461 && !NET_462 && !NET_47 && !NET_471 && !NET_472 && !NET_48 && !NET_STANDARD_20 && !NET_STANDARD_21
[assembly: AllowPartiallyTrustedCallers]
#endif

[assembly: ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]

#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_20 || NET_STANDARD_21
//
// NOTE: This attribute is only available in .NET Framework 4.0 or higher.
//
[assembly: SecurityRules(SecurityRuleSet.Level1)]
#endif
#endif

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.119.0")]
#if !PLATFORM_COMPACTFRAMEWORK
[assembly: AssemblyFileVersion("1.0.119.0")]
#endif

Added System.Data.SQLite/AssemblySourceIdAttribute.cs.





















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Joe Mistachkin (joe@mistachkin.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System;

namespace System.Data.SQLite
{
    /// <summary>
    /// Defines a source code identifier custom attribute for an assembly
    /// manifest.
    /// </summary>
    [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
    public sealed class AssemblySourceIdAttribute : Attribute
    {
        /// <summary>
        /// Constructs an instance of this attribute class using the specified
        /// source code identifier value.
        /// </summary>
        /// <param name="value">
        /// The source code identifier value to use.
        /// </param>
        public AssemblySourceIdAttribute(string value)
        {
            sourceId = value;
        }

        ///////////////////////////////////////////////////////////////////////

        private string sourceId;
        /// <summary>
        /// Gets the source code identifier value.
        /// </summary>
        public string SourceId
        {
            get { return sourceId; }
        }
    }
}

Added System.Data.SQLite/AssemblySourceTimeStampAttribute.cs.





















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Joe Mistachkin (joe@mistachkin.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System;

namespace System.Data.SQLite
{
    /// <summary>
    /// Defines a source code time-stamp custom attribute for an assembly
    /// manifest.
    /// </summary>
    [AttributeUsage(AttributeTargets.Assembly, Inherited = false)]
    public sealed class AssemblySourceTimeStampAttribute : Attribute
    {
        /// <summary>
        /// Constructs an instance of this attribute class using the specified
        /// source code time-stamp value.
        /// </summary>
        /// <param name="value">
        /// The source code time-stamp value to use.
        /// </param>
        public AssemblySourceTimeStampAttribute(string value)
        {
            sourceTimeStamp = value;
        }

        ///////////////////////////////////////////////////////////////////////

        private string sourceTimeStamp;
        /// <summary>
        /// Gets the source code time-stamp value.
        /// </summary>
        public string SourceTimeStamp
        {
            get { return sourceTimeStamp; }
        }
    }
}

Added System.Data.SQLite/Configurations/System.Data.SQLite.dll.config.







































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
<?xml version="1.0"?>
<!--
 *
 * System.Data.SQLite.dll.config -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<configuration>
  <appSettings>
    <!--
    ****************************************************************************
    **                       Special Replacement Tokens                       **
    ****************************************************************************
    -->

    <!--
        NOTE: %PreLoadSQLite_AssemblyDirectory% - If this token (which is
              case-sensitive and must include the percent characters) is
              present within a setting value being returned, it will be
              replaced with the qualified name of the directory containing the
              System.Data.SQLite assembly.  If the name of the directory is not
              available, the token will not be replaced.

        NOTE: %PreLoadSQLite_TargetFramework% - If this token (which is
              case-sensitive and must include the percent characters) is
              present within a setting value being returned, it will be
              replaced with an abbreviation of the target framework attribute
              value for the System.Data.SQLite assembly.  If the target
              framework attribute value is not available, the token will not be
              replaced.

        NOTE: %PreLoadSQLite_XmlConfigDirectory% - If this token (which is
              case-sensitive and must include the percent characters) is
              present within a setting value being returned, it will be
              replaced with the qualified name of the directory containing the
              XML configuration file.  If the name of the directory is not
              available, the token will not be replaced.  Generally, this token
              may only be used within the XML configuration file itself.
    -->

    <!--
    ****************************************************************************
    **                         Configuration Settings                         **
    ****************************************************************************
    -->

    <!--
        NOTE: If this environment variable is set [to anything], it will be
              used by the System.Data.SQLite.Linq.SQLiteProviderManifest class
              (and the System.Data.SQLite.EF6.SQLiteProviderManifest class) to
              modify future provider manifest tokens by appending the value of
              the environment variable to the existing provider manifest token,
              if any.  Typically, in order for the constructed provider
              manifest token to be syntactically correct, the environment
              variable value [to be appended] must begin with a semicolon.
    -->
    <!--
    <add key="AppendManifestToken_SQLiteProviderManifest" value="" />
    -->

    <!--
          NOTE: If this environment variable is set [to anything], it will be
                used by the System.Data.SQLite.SQLiteConnection class as the
                default flags for all opened connections (i.e. when they are
                not present in the connection string).
    -->
    <!--
    <add key="DefaultFlags_SQLiteConnection" value="" />
    -->

    <!--
        NOTE: If this configuration variable is set [to anything], the SQLite
              logging subsystem will be initially disabled when initialized.
    -->
    <!--
    <add key="Disable_SQLiteLog" value="1" />
    -->

    <!--
        NOTE: If this configuration variable is set [to anything], the SQLite
              logging subsystem may be initialized in a non-default application
              domain.  By default, this is not allowed due to the potential
              for application domain unloading issues.
    -->
    <!--
    <add key="Force_SQLiteLog" value="1" />
    -->

    <!--
        NOTE: If this environment variable is set [to anything], the SQLite
              logging subsystem will attempt to perform initialization even
              when an attempt was previously made.
    -->
    <!--
    <add key="Initialize_SQLiteLog" value="1" />
    -->

    <!--
        NOTE: If this configuration variable is set [to anything], the native
              library pre-loading functionality will be disabled.  By default,
              the native library pre-loading will attempt to load the native
              SQLite library from architecture-specific (e.g. "x86", "amd64",
              "x64") or platform-specific (e.g. "Win32") directories that
              reside underneath the application base directory.
    -->
    <!--
    <add key="No_PreLoadSQLite" value="1" />
    -->

    <!--
        NOTE: If this configuration variable is set [to anything], the new
              connection string parsing algorithm will not be used.  This
              environment variable is intended for use with legacy code only.
    -->
    <!--
    <add key="No_SQLiteConnectionNewParser" value="1" />
    -->

    <!--
        NOTE: If this configuration variable is set [to anything], the initial
              search for types in all loaded assemblies that are tagged with
              the SQLiteFunction attribute will be skipped.  Normally, this
              search is conducted only once per application domain by the
              static constructor of the SQLiteFunction class; however, these
              implementation details are subject to change.
    -->
    <!--
    <add key="No_SQLiteFunctions" value="1" />
    -->

    <!--
        NOTE: If this environment variable is set [to anything], all calls to
              the GetSettingValue method will return the default value.  This
              will effectively prevent all other setting values from having any
              effect, including those specified via other supported environment
              variables or in the associated XML configuration file.

        SPECIAL NOTE: This setting is included here only for completeness; it
                      does not make any sense to use it here as it will never
                      be consulted.  For this setting to work properly, it must
                      be set via an environment variable.
    -->
    <!--
    <add key="No_SQLiteGetSettingValue" value="1" />
    -->

    <!--
        NOTE: If this environment variable is set [to anything], the SQLite
              logging subsystem will not be initialized by the SQLiteLog class;
              however, it may still be initialized by external components (i.e.
              something other than System.Data.SQLite).
    -->
    <!--
    <add key="No_SQLiteLog" value="1" />
    -->

    <!--
        NOTE: If this environment variable is set [to anything], calls to the
              GetSettingValue method will never result in the XML configuration
              file being read; instead, the default value will be returned.
              This will effectively prevent any setting values specified via
              the XML configuration file from having any effect.

        SPECIAL NOTE: This setting is included here only for completeness; it
                      does not make any sense to use it here as it will never
                      be consulted.  For this setting to work properly, it must
                      be set via an environment variable.
    -->
    <!--
    <add key="No_SQLiteXmlConfigFile" value="1" />
    -->

    <!--
        NOTE: If this configuration variable is set [to anything], the base
              directory itself is considered valid for pre-loading the native
              SQLite library.
    -->
    <!--
    <add key="PreLoadSQLite_AllowBaseDirectoryOnly" value="1" />
    -->

    <!--
        NOTE: If this configuration variable is set [to anything], it will be
              used instead of the application base directory by the native
              library pre-loader.  This environment variable can be especially
              useful in ASP.NET and other hosted environments where direct
              control of the location of the managed assemblies is not under
              the control of the application.
    -->
    <!--
    <add key="PreLoadSQLite_BaseDirectory" value="" />
    -->

    <!--
        NOTE: If this configuration variable is set [to anything], the native
              library pre-loader subsystem will attempt to give the interactive
              user an opportunity to attach a debugger to the current process.
    -->
    <!--
    <add key="PreLoadSQLite_BreakIntoDebugger" value="1" />
    -->

    <!--
        NOTE: If this configuration variable is set [to anything], it will be
              used as the base file name (without directory information) for
              the native SQLite library to be pre-loaded (e.g. "sqlite3.dll"
              or "libsqlite3.so.0").
    -->
    <!--
    <add key="PreLoadSQLite_LibraryFileNameOnly" value="" />
    -->

    <!--
        NOTE: If this environment variable is set [to anything], the native
              library pre-loading code will skip conducting a search for the
              native library to pre-load.  By default, the search starts in the
              location of the currently executing assembly (i.e. the assembly
              containing all the managed components for System.Data.SQLite) and
              then falls back to the application domain base directory.
    -->
    <!--
    <add key="PreLoadSQLite_NoSearchForDirectory" value="1" />
    -->

    <!--
        NOTE: If this configuration variable is set [to anything], it will be
              used instead of the processor architecture value contained in the
              PROCESSOR_ARCHITECTURE environment variable to help build the
              path of the native library to pre-load.
    -->
    <!--
    <add key="PreLoadSQLite_ProcessorArchitecture" value="x86" />
    -->

    <!--
        NOTE: If this configuration variable is set [to anything], the location
              of the currently executing assembly (i.e. the one containing all
              the managed components for System.Data.SQLite) will be used as
              the basis for locating the the native library to pre-load (i.e.
              instead of using the application domain base directory).
    -->
    <!--
    <add key="PreLoadSQLite_UseAssemblyDirectory" value="1" />
    -->

    <!--
        NOTE: This configuration variable is normally set by the operating
              system itself and should reflect the native processor
              architecture of the current process (e.g. a 32-bit x86
              application running on a 64-bit x64 operating system should have
              the value "x86").
    -->
    <!--
    <add key="PROCESSOR_ARCHITECTURE" value="%PROCESSOR_ARCHITECTURE%" />
    -->

    <!--
        NOTE: If this environment variable is set [to anything], calls into
              key members pertaining to the lifecycle of connections and their
              associated classes (e.g. LINQ, EF6, etc) will be logged.
    -->
    <!--
    <add key="SQLite_ForceLogLifecycle" value="1" />
    -->

    <!--
        NOTE: If this environment variable is set [to anything], all calls to
              prepare a SQL query will be logged, regardless of the flags for
              the associated connection.
    -->
    <!--
    <add key="SQLite_ForceLogPrepare" value="1" />
    -->

    <!--
        NOTE: If this environment variable is set [to anything], all internal
              retries during statment preparation and stepping will be logged,
              regardless of the flags for the associated connection.
    -->
    <!--
    <add key="SQLite_ForceLogRetry" value="1" />
    -->

    <!--
        NOTE: If this environment variable is set [to anything], it will be
              processed as a list of CommandBehavior flags, if possible.  It
              will be ignored if it cannot be processed correctly.  For more
              details, please refer to the CombineBehaviors method.
    -->
    <!--
    <add key="SQLite_GlobalCommandBehaviors" value="" />
    -->

    <!--
        NOTE: If this environment variable is set [to anything], page #1
              of database files encrypted using the (unsupported) legacy
              CryptoAPI-based (RC4) codec will be encrypted.  This was the
              default behavior prior to release 1.0.112.3; however, it is now
              disabled (by default) as it can cause corruption and/or other
              malfunctions in some circumstances.  Please do not use this
              environment variable unless it is absolutely necessary for your
              specific use case.

        NOTE: Since this environment variable is (only) read from the native
              interop assembly, it cannot be set via this configuration file.
              It can only be set within the process environment.
    -->
    <!--
    <add key="SQLite_LegacyEncryptPage1" value="1" />
    -->

    <!--
        NOTE: If this environment variable is set [to anything], the default
              connection pool will use normal objects instead of weak
              references.  This should prevent any pooled connection objects
              from ever being automatically cleaned up by the garbage
              collector.
    -->
    <!--
    <add key="SQLite_StrongConnectionPool" value="1" />
    -->

    <!--
        NOTE: If this environment variable is set [to anything], it will be
              used by the System.Data.SQLite.SQLiteFactory class as the type
              name containing the System.Data.Common.DbProviderServices
              implementation that should be used.
    -->
    <!--
    <add key="TypeName_SQLiteProviderServices" value="" />
    -->

    <!--
        NOTE: If this environment variable is set [to anything], it will be
              used by the System.Data.SQLite.SQLiteConvert class as the default
              DbType value that should be used when a per-connection value is
              not available.
    -->
    <!--
    <add key="Use_SQLiteConvert_DefaultDbType" value="Object" />
    -->

    <!--
        NOTE: If this environment variable is set [to anything], it will be
              used by the System.Data.SQLite.SQLiteConvert class as the default
              type name that should be used when a per-connection value is not
              available.
    -->
    <!--
    <add key="Use_SQLiteConvert_DefaultTypeName" value="" />
    -->
  </appSettings>
</configuration>

Deleted System.Data.SQLite/DataTypes.xml.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
<?xml version="1.0" standalone="yes"?>
<DocumentElement>
  <DataTypes>
    <TypeName>smallint</TypeName>
    <ProviderDbType>10</ProviderDbType>
    <ColumnSize>5</ColumnSize>
    <DataType>System.Int16</DataType>
    <CreateFormat>smallint</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>int</TypeName>
    <ProviderDbType>11</ProviderDbType>
    <ColumnSize>10</ColumnSize>
    <DataType>System.Int32</DataType>
    <CreateFormat>int</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>real</TypeName>
    <ProviderDbType>15</ProviderDbType>
    <ColumnSize>7</ColumnSize>
    <DataType>System.Single</DataType>
    <CreateFormat>real</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>float</TypeName>
    <ProviderDbType>8</ProviderDbType>
    <ColumnSize>6</ColumnSize>
    <DataType>System.Double</DataType>
    <CreateFormat>float</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>double</TypeName>
    <ProviderDbType>8</ProviderDbType>
    <ColumnSize>6</ColumnSize>
    <DataType>System.Double</DataType>
    <CreateFormat>double</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>money</TypeName>
    <ProviderDbType>7</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Decimal</DataType>
    <CreateFormat>money</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>currency</TypeName>
    <ProviderDbType>7</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Decimal</DataType>
    <CreateFormat>currency</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>decimal</TypeName>
    <ProviderDbType>7</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Decimal</DataType>
    <CreateFormat>decimal</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>numeric</TypeName>
    <ProviderDbType>7</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Decimal</DataType>
    <CreateFormat>numeric</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>bit</TypeName>
    <ProviderDbType>3</ProviderDbType>
    <ColumnSize>1</ColumnSize>
    <DataType>System.Boolean</DataType>
    <CreateFormat>bit</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>yesno</TypeName>
    <ProviderDbType>3</ProviderDbType>
    <ColumnSize>1</ColumnSize>
    <DataType>System.Boolean</DataType>
    <CreateFormat>yesno</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>logical</TypeName>
    <ProviderDbType>3</ProviderDbType>
    <ColumnSize>1</ColumnSize>
    <DataType>System.Boolean</DataType>
    <CreateFormat>logical</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>bool</TypeName>
    <ProviderDbType>3</ProviderDbType>
    <ColumnSize>1</ColumnSize>
    <DataType>System.Boolean</DataType>
    <CreateFormat>bool</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>boolean</TypeName>
    <ProviderDbType>3</ProviderDbType>
    <ColumnSize>1</ColumnSize>
    <DataType>System.Boolean</DataType>
    <CreateFormat>boolean</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>tinyint</TypeName>
    <ProviderDbType>2</ProviderDbType>
    <ColumnSize>3</ColumnSize>
    <DataType>System.Byte</DataType>
    <CreateFormat>tinyint</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>true</IsUnsigned>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>integer</TypeName>
    <ProviderDbType>12</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Int64</DataType>
    <CreateFormat>integer</CreateFormat>
    <IsAutoIncrementable>true</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>counter</TypeName>
    <ProviderDbType>12</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Int64</DataType>
    <CreateFormat>counter</CreateFormat>
    <IsAutoIncrementable>true</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>autoincrement</TypeName>
    <ProviderDbType>12</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Int64</DataType>
    <CreateFormat>autoincrement</CreateFormat>
    <IsAutoIncrementable>true</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>identity</TypeName>
    <ProviderDbType>12</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Int64</DataType>
    <CreateFormat>identity</CreateFormat>
    <IsAutoIncrementable>true</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>long</TypeName>
    <ProviderDbType>12</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Int64</DataType>
    <CreateFormat>long</CreateFormat>
    <IsAutoIncrementable>true</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>bigint</TypeName>
    <ProviderDbType>12</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Int64</DataType>
    <CreateFormat>bigint</CreateFormat>
    <IsAutoIncrementable>true</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>binary</TypeName>
    <ProviderDbType>1</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <DataType>System.Byte[]</DataType>
    <CreateFormat>binary</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>false</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <LiteralPrefix>X'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>varbinary</TypeName>
    <ProviderDbType>1</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <DataType>System.Byte[]</DataType>
    <CreateFormat>varbinary</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>false</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <LiteralPrefix>X'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>blob</TypeName>
    <ProviderDbType>1</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <DataType>System.Byte[]</DataType>
    <CreateFormat>blob</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>false</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <LiteralPrefix>X'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>image</TypeName>
    <ProviderDbType>1</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <DataType>System.Byte[]</DataType>
    <CreateFormat>image</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>false</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <LiteralPrefix>X'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>general</TypeName>
    <ProviderDbType>1</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <DataType>System.Byte[]</DataType>
    <CreateFormat>general</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>false</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <LiteralPrefix>X'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>oleobject</TypeName>
    <ProviderDbType>1</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <DataType>System.Byte[]</DataType>
    <CreateFormat>oleobject</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>false</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <LiteralPrefix>X'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>varchar</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>varchar({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>nvarchar</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>nvarchar({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>memo</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>memo({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>longtext</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>longtext({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>note</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>note({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>text</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>text({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>ntext</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>ntext({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>string</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>string({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>char</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>char({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>nchar</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>char({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>datetime</TypeName>
    <ProviderDbType>6</ProviderDbType>
    <ColumnSize>23</ColumnSize>
    <DataType>System.DateTime</DataType>
    <CreateFormat>datetime</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>smalldate</TypeName>
    <ProviderDbType>6</ProviderDbType>
    <ColumnSize>23</ColumnSize>
    <DataType>System.DateTime</DataType>
    <CreateFormat>smalldate</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>timestamp</TypeName>
    <ProviderDbType>6</ProviderDbType>
    <ColumnSize>23</ColumnSize>
    <DataType>System.DateTime</DataType>
    <CreateFormat>timestamp</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>date</TypeName>
    <ProviderDbType>6</ProviderDbType>
    <ColumnSize>23</ColumnSize>
    <DataType>System.DateTime</DataType>
    <CreateFormat>date</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>time</TypeName>
    <ProviderDbType>6</ProviderDbType>
    <ColumnSize>23</ColumnSize>
    <DataType>System.DateTime</DataType>
    <CreateFormat>time</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>uniqueidentifier</TypeName>
    <ProviderDbType>9</ProviderDbType>
    <ColumnSize>16</ColumnSize>
    <DataType>System.Guid</DataType>
    <CreateFormat>uniqueidentifier</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>guid</TypeName>
    <ProviderDbType>9</ProviderDbType>
    <ColumnSize>16</ColumnSize>
    <DataType>System.Guid</DataType>
    <CreateFormat>guid</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
</DocumentElement>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Added System.Data.SQLite/Generated/SR.resources.

cannot compute difference between binary files

Added System.Data.SQLite/ISQLiteNativeModule.cs.





















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Joe Mistachkin (joe@mistachkin.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
    #region ISQLiteNativeModule Interface
    /// <summary>
    /// This interface represents a virtual table implementation written in
    /// native code.
    /// </summary>
    public interface ISQLiteNativeModule
    {
        /// <summary>
        /// <para><code>
        /// int (*xCreate)(sqlite3 *db, void *pAux,
        ///              int argc, char *const*argv,
        ///              sqlite3_vtab **ppVTab,
        ///              char **pzErr);
        /// </code></para>
        /// <para>
        /// The xCreate method is called to create a new instance of a virtual table 
        /// in response to a CREATE VIRTUAL TABLE statement.
        /// If the xCreate method is the same pointer as the xConnect method, then the
        /// virtual table is an eponymous virtual table.
        /// If the xCreate method is omitted (if it is a NULL pointer) then the virtual 
        /// table is an eponymous-only virtual table.
        /// </para>
        /// <para>
        /// The db parameter is a pointer to the SQLite database connection that 
        /// is executing the CREATE VIRTUAL TABLE statement. 
        /// The pAux argument is the copy of the client data pointer that was the 
        /// fourth argument to the sqlite3_create_module() or
        /// sqlite3_create_module_v2() call that registered the 
        /// virtual table module. 
        /// The argv parameter is an array of argc pointers to null terminated strings. 
        /// The first string, argv[0], is the name of the module being invoked.   The
        /// module name is the name provided as the second argument to 
        /// sqlite3_create_module() and as the argument to the USING clause of the
        /// CREATE VIRTUAL TABLE statement that is running.
        /// The second, argv[1], is the name of the database in which the new virtual 
        /// table is being created. The database name is "main" for the primary database, or
        /// "temp" for TEMP database, or the name given at the end of the ATTACH
        /// statement for attached databases.  The third element of the array, argv[2], 
        /// is the name of the new virtual table, as specified following the TABLE
        /// keyword in the CREATE VIRTUAL TABLE statement.
        /// If present, the fourth and subsequent strings in the argv[] array report 
        /// the arguments to the module name in the CREATE VIRTUAL TABLE statement.
        /// </para>
        /// <para>
        /// The job of this method is to construct the new virtual table object
        /// (an sqlite3_vtab object) and return a pointer to it in *ppVTab.
        /// </para>
        /// <para>
        /// As part of the task of creating a new sqlite3_vtab structure, this 
        /// method <u>must</u> invoke sqlite3_declare_vtab() to tell the SQLite 
        /// core about the columns and datatypes in the virtual table. 
        /// The sqlite3_declare_vtab() API has the following prototype:
        /// </para>
        /// <para><code>
        /// int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable)
        /// </code></para>
        /// <para>
        /// The first argument to sqlite3_declare_vtab() must be the same 
        /// database connection pointer as the first parameter to this method.
        /// The second argument to sqlite3_declare_vtab() must a zero-terminated 
        /// UTF-8 string that contains a well-formed CREATE TABLE statement that 
        /// defines the columns in the virtual table and their data types. 
        /// The name of the table in this CREATE TABLE statement is ignored, 
        /// as are all constraints. Only the column names and datatypes matter.
        /// The CREATE TABLE statement string need not to be 
        /// held in persistent memory.  The string can be
        /// deallocated and/or reused as soon as the sqlite3_declare_vtab()
        /// routine returns.
        /// </para>
        /// <para>
        /// The xConnect method can also optionally request special features
        /// for the virtual table by making one or more calls to
        /// the sqlite3_vtab_config() interface:
        /// </para>
        /// <para><code>
        /// int sqlite3_vtab_config(sqlite3 *db, int op, ...);
        /// </code></para>
        /// <para>
        /// Calls to sqlite3_vtab_config() are optional.  But for maximum
        /// security, it is recommended that virtual table implementations
        /// invoke "sqlite3_vtab_config(db, SQLITE_VTAB_DIRECTONLY)" if the
        /// virtual table will not be used from inside of triggers or views.
        /// </para>
        /// <para>
        /// The xCreate method need not initialize the pModule, nRef, and zErrMsg
        /// fields of the sqlite3_vtab object.  The SQLite core will take care of 
        /// that chore.
        /// </para>
        /// <para>
        /// The xCreate should return SQLITE_OK if it is successful in 
        /// creating the new virtual table, or SQLITE_ERROR if it is not successful.
        /// If not successful, the sqlite3_vtab structure must not be allocated. 
        /// An error message may optionally be returned in *pzErr if unsuccessful.
        /// Space to hold the error message string must be allocated using
        /// an SQLite memory allocation function like 
        /// sqlite3_malloc() or sqlite3_mprintf() as the SQLite core will
        /// attempt to free the space using sqlite3_free() after the error has
        /// been reported up to the application.
        /// </para>
        /// <para>
        /// If the xCreate method is omitted (left as a NULL pointer) then the
        /// virtual table is an eponymous-only virtual table.  New instances of
        /// the virtual table cannot be created using CREATE VIRTUAL TABLE and the
        /// virtual table can only be used via its module name.
        /// Note that SQLite versions prior to 3.9.0 (2015-10-14) do not understand
        /// eponymous-only virtual tables and will segfault if an attempt is made
        /// to CREATE VIRTUAL TABLE on an eponymous-only virtual table because
        /// the xCreate method was not checked for null.
        /// </para>
        /// <para>
        /// If the xCreate method is the exact same pointer as the xConnect method,
        /// that indicates that the virtual table does not need to initialize backing
        /// store.  Such a virtual table can be used as an eponymous virtual table
        /// or as a named virtual table using CREATE VIRTUAL TABLE or both.
        /// </para>
        /// <para>
        /// If a column datatype contains the special keyword "HIDDEN"
        /// (in any combination of upper and lower case letters) then that keyword
        /// it is omitted from the column datatype name and the column is marked 
        /// as a hidden column internally. 
        /// A hidden column differs from a normal column in three respects:
        /// </para>
        /// <para>
        /// <![CDATA[<ul>]]>
        /// <![CDATA[<li>]]> Hidden columns are not listed in the dataset returned by 
        ///      "PRAGMA table_info",
        /// <![CDATA[</li>]]><![CDATA[<li>]]> Hidden columns are not included in the expansion of a "*"
        ///      expression in the result set of a SELECT, and
        /// <![CDATA[</li>]]><![CDATA[<li>]]> Hidden columns are not included in the implicit column-list 
        ///      used by an INSERT statement that lacks an explicit column-list. 
        /// <![CDATA[</li>]]><![CDATA[</ul>]]>
        /// </para>
        /// <para>
        /// For example, if the following SQL is passed to sqlite3_declare_vtab():
        /// </para>
        /// <para><code>
        /// CREATE TABLE x(a HIDDEN VARCHAR(12), b INTEGER, c INTEGER Hidden);
        /// </code></para>
        /// <para>
        /// Then the virtual table would be created with two hidden columns,
        /// and with datatypes of "VARCHAR(12)" and "INTEGER".
        /// </para>
        /// <para>
        /// An example use of hidden columns can be seen in the FTS3 virtual 
        /// table implementation, where every FTS virtual table
        /// contains an FTS hidden column that is used to pass information from the
        /// virtual table into FTS auxiliary functions and to the FTS MATCH operator.
        /// </para>
        /// <para>
        /// A virtual table that contains hidden columns can be used like
        /// a table-valued function in the FROM clause of a SELECT statement.
        /// The arguments to the table-valued function become constraints on 
        /// the HIDDEN columns of the virtual table.
        /// </para>
        /// <para>
        /// For example, the "generate_series" extension (located in the
        /// ext/misc/series.c
        /// file in the source tree)
        /// implements an eponymous virtual table with the following schema:
        /// </para>
        /// <para><code>
        /// CREATE TABLE generate_series(
        ///   value,
        ///   start HIDDEN,
        ///   stop HIDDEN,
        ///   step HIDDEN
        /// );
        /// </code></para>
        /// <para>
        /// The sqlite3_module.xBestIndex method in the implementation of this
        /// table checks for equality constraints against the HIDDEN columns, and uses
        /// those as input parameters to determine the range of integer "value" outputs
        /// to generate.  Reasonable defaults are used for any unconstrained columns.
        /// For example, to list all integers between 5 and 50:
        /// </para>
        /// <para><code>
        /// SELECT value FROM generate_series(5,50);
        /// </code></para>
        /// <para>
        /// The previous query is equivalent to the following:
        /// </para>
        /// <para><code>
        /// SELECT value FROM generate_series WHERE start=5 AND stop=50;
        /// </code></para>
        /// <para>
        /// Arguments on the virtual table name are matched to hidden columns
        /// in order.  The number of arguments can be less than the
        /// number of hidden columns, in which case the latter hidden columns are
        /// unconstrained.  However, an error results if there are more arguments
        /// than there are hidden columns in the virtual table.
        /// </para>
        /// <para>
        /// Beginning with SQLite version 3.14.0 (2016-08-08), 
        /// the CREATE TABLE statement that
        /// is passed into sqlite3_declare_vtab() may contain a WITHOUT ROWID clause.
        /// This is useful for cases where the virtual table rows 
        /// cannot easily be mapped into unique integers.  A CREATE TABLE
        /// statement that includes WITHOUT ROWID must define one or more columns as
        /// the PRIMARY KEY.  Every column of the PRIMARY KEY must individually be
        /// NOT NULL and all columns for each row must be collectively unique.
        /// </para>
        /// <para>
        /// Note that SQLite does not enforce the PRIMARY KEY for a WITHOUT ROWID
        /// virtual table.  Enforcement is the responsibility of the underlying
        /// virtual table implementation.  But SQLite does assume that the PRIMARY KEY
        /// constraint is valid - that the identified columns really are UNIQUE and
        /// NOT NULL - and it uses that assumption to optimize queries against the
        /// virtual table.
        /// </para>
        /// <para>
        /// The rowid column is not accessible on a
        /// WITHOUT ROWID virtual table (of course).
        /// </para>
        /// <para>
        /// The xUpdate method was originally designed around having a
        /// ROWID as a single value.  The xUpdate method has been expanded to
        /// accommodate an arbitrary PRIMARY KEY in place of the ROWID, but the
        /// PRIMARY KEY must still be only one column.  For this reason, SQLite
        /// will reject any WITHOUT ROWID virtual table that has more than one
        /// PRIMARY KEY column and a non-NULL xUpdate method.
        /// </para>
        /// </summary>
        /// <param name="pDb">
        /// The native database connection handle.
        /// </param>
        /// <param name="pAux">
        /// The original native pointer value that was provided to the
        /// sqlite3_create_module(), sqlite3_create_module_v2() or
        /// sqlite3_create_disposable_module() functions.
        /// </param>
        /// <param name="argc">
        /// The number of arguments from the CREATE VIRTUAL TABLE statement.
        /// </param>
        /// <param name="argv">
        /// The array of string arguments from the CREATE VIRTUAL TABLE
        /// statement.
        /// </param>
        /// <param name="pVtab">
        /// Upon success, this parameter must be modified to point to the newly
        /// created native sqlite3_vtab derived structure.
        /// </param>
        /// <param name="pError">
        /// Upon failure, this parameter must be modified to point to the error
        /// message, with the underlying memory having been obtained from the
        /// sqlite3_malloc() function.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xCreate(
            IntPtr pDb,
            IntPtr pAux,
            int argc,
            IntPtr argv,
            ref IntPtr pVtab,
            ref IntPtr pError
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xConnect)(sqlite3*, void *pAux,
        ///              int argc, char *const*argv,
        ///              sqlite3_vtab **ppVTab,
        ///              char **pzErr);
        /// </code></para>
        /// <para>
        /// The xConnect method is very similar to xCreate. 
        /// It has the same parameters and constructs a new sqlite3_vtab structure 
        /// just like xCreate. 
        /// And it must also call sqlite3_declare_vtab() like xCreate.  It
        /// should also make all of the same sqlite3_vtab_config() calls as
        /// xCreate.
        /// </para>
        /// <para>
        /// The difference is that xConnect is called to establish a new 
        /// connection to an existing virtual table whereas xCreate is called 
        /// to create a new virtual table from scratch.
        /// </para>
        /// <para>
        /// The xCreate and xConnect methods are only different when the
        /// virtual table has some kind of backing store that must be initialized 
        /// the first time the virtual table is created. The xCreate method creates 
        /// and initializes the backing store. The xConnect method just connects 
        /// to an existing backing store.  When xCreate and xConnect are the same,
        /// the table is an eponymous virtual table.
        /// </para>
        /// <para>
        /// As an example, consider a virtual table implementation that 
        /// provides read-only access to existing comma-separated-value (CSV)
        /// files on disk. There is no backing store that needs to be created 
        /// or initialized for such a virtual table (since the CSV files already 
        /// exist on disk) so the xCreate and xConnect methods will be identical 
        /// for that module.
        /// </para>
        /// <para>
        /// Another example is a virtual table that implements a full-text index. 
        /// The xCreate method must create and initialize data structures to hold 
        /// the dictionary and posting lists for that index. The xConnect method,
        /// on the other hand, only has to locate and use an existing dictionary 
        /// and posting lists that were created by a prior xCreate call.
        /// </para>
        /// <para>
        /// The xConnect method must return SQLITE_OK if it is successful 
        /// in creating the new virtual table, or SQLITE_ERROR if it is not 
        /// successful. If not successful, the sqlite3_vtab structure must not be 
        /// allocated. An error message may optionally be returned in *pzErr if 
        /// unsuccessful. 
        /// Space to hold the error message string must be allocated using
        /// an SQLite memory allocation function like 
        /// sqlite3_malloc() or sqlite3_mprintf() as the SQLite core will
        /// attempt to free the space using sqlite3_free() after the error has
        /// been reported up to the application.
        /// </para>
        /// <para>
        /// The xConnect method is required for every virtual table implementation, 
        /// though the xCreate and xConnect pointers of the sqlite3_module object
        /// may point to the same function if the virtual table does not need to
        /// initialize backing store.
        /// </para>
        /// </summary>
        /// <param name="pDb">
        /// The native database connection handle.
        /// </param>
        /// <param name="pAux">
        /// The original native pointer value that was provided to the
        /// sqlite3_create_module(), sqlite3_create_module_v2() or
        /// sqlite3_create_disposable_module() functions.
        /// </param>
        /// <param name="argc">
        /// The number of arguments from the CREATE VIRTUAL TABLE statement.
        /// </param>
        /// <param name="argv">
        /// The array of string arguments from the CREATE VIRTUAL TABLE
        /// statement.
        /// </param>
        /// <param name="pVtab">
        /// Upon success, this parameter must be modified to point to the newly
        /// created native sqlite3_vtab derived structure.
        /// </param>
        /// <param name="pError">
        /// Upon failure, this parameter must be modified to point to the error
        /// message, with the underlying memory having been obtained from the
        /// sqlite3_malloc() function.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xConnect(
            IntPtr pDb,
            IntPtr pAux,
            int argc,
            IntPtr argv,
            ref IntPtr pVtab,
            ref IntPtr pError
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para>
        /// SQLite uses the xBestIndex method of a virtual table module to determine
        /// the best way to access the virtual table. 
        /// The xBestIndex method has a prototype like this:
        /// </para>
        /// <para><code>
        /// int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*);
        /// </code></para>
        /// <para>
        /// The SQLite core communicates with the xBestIndex method by filling 
        /// in certain fields of the sqlite3_index_info structure and passing a 
        /// pointer to that structure into xBestIndex as the second parameter. 
        /// The xBestIndex method fills out other fields of this structure which
        /// forms the reply. The sqlite3_index_info structure looks like this:
        /// </para>
        /// <para><code>
        /// struct sqlite3_index_info {
        ///   /* Inputs */
        ///   const int nConstraint;     /* Number of entries in aConstraint */
        ///   const struct sqlite3_index_constraint {
        ///      int iColumn;              /* Column constrained.  -1 for ROWID */
        ///      unsigned char op;         /* Constraint operator */
        ///      unsigned char usable;     /* True if this constraint is usable */
        ///      int iTermOffset;          /* Used internally - xBestIndex should ignore */
        ///   } *const aConstraint;      /* Table of WHERE clause constraints */
        ///   const int nOrderBy;        /* Number of terms in the ORDER BY clause */
        ///   const struct sqlite3_index_orderby {
        ///      int iColumn;              /* Column number */
        ///      unsigned char desc;       /* True for DESC.  False for ASC. */
        ///   } *const aOrderBy;         /* The ORDER BY clause */
        ///   /* Outputs */
        ///   struct sqlite3_index_constraint_usage {
        ///     int argvIndex;           /* if >0, constraint is part of argv to xFilter */
        ///     unsigned char omit;      /* Do not code a test for this constraint */
        ///   } *const aConstraintUsage;
        ///   int idxNum;                /* Number used to identify the index */
        ///   char *idxStr;              /* String, possibly obtained from sqlite3_malloc */
        ///   int needToFreeIdxStr;      /* Free idxStr using sqlite3_free() if true */
        ///   int orderByConsumed;       /* True if output is already ordered */
        ///   double estimatedCost;      /* Estimated cost of using this index */
        ///   <![CDATA[<b>]]>/* Fields below are only available in SQLite 3.8.2 and later */<![CDATA[</b>]]>
        ///   sqlite3_int64 estimatedRows;    /* Estimated number of rows returned */
        ///   <![CDATA[<b>]]>/* Fields below are only available in SQLite 3.9.0 and later */<![CDATA[</b>]]>
        ///   int idxFlags;              /* Mask of SQLITE_INDEX_SCAN_* flags */
        ///   <![CDATA[<b>]]>/* Fields below are only available in SQLite 3.10.0 and later */<![CDATA[</b>]]>
        ///   sqlite3_uint64 colUsed;    /* Input: Mask of columns used by statement */
        /// };
        /// </code></para>
        /// <para>
        /// Note the warnings on the "estimatedRows", "idxFlags", and colUsed fields.
        /// These fields were added with SQLite versions 3.8.2, 3.9.0, and 3.10.0, respectively. 
        /// Any extension that reads or writes these fields must first check that the 
        /// version of the SQLite library in use is greater than or equal to appropriate
        /// version - perhaps comparing the value returned from sqlite3_libversion_number()
        /// against constants 3008002, 3009000, and/or 3010000. The result of attempting 
        /// to access these fields in an sqlite3_index_info structure created by an 
        /// older version of SQLite are undefined.
        /// </para>
        /// <para>
        /// In addition, there are some defined constants:
        /// </para>
        /// <para><code>
        /// #define SQLITE_INDEX_CONSTRAINT_EQ         2
        /// #define SQLITE_INDEX_CONSTRAINT_GT         4
        /// #define SQLITE_INDEX_CONSTRAINT_LE         8
        /// #define SQLITE_INDEX_CONSTRAINT_LT        16
        /// #define SQLITE_INDEX_CONSTRAINT_GE        32
        /// #define SQLITE_INDEX_CONSTRAINT_MATCH     64
        /// #define SQLITE_INDEX_CONSTRAINT_LIKE      65  /* 3.10.0 and later */
        /// #define SQLITE_INDEX_CONSTRAINT_GLOB      66  /* 3.10.0 and later */
        /// #define SQLITE_INDEX_CONSTRAINT_REGEXP    67  /* 3.10.0 and later */
        /// #define SQLITE_INDEX_CONSTRAINT_NE        68  /* 3.21.0 and later */
        /// #define SQLITE_INDEX_CONSTRAINT_ISNOT     69  /* 3.21.0 and later */
        /// #define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70  /* 3.21.0 and later */
        /// #define SQLITE_INDEX_CONSTRAINT_ISNULL    71  /* 3.21.0 and later */
        /// #define SQLITE_INDEX_CONSTRAINT_IS        72  /* 3.21.0 and later */
        /// #define SQLITE_INDEX_CONSTRAINT_LIMIT     73  /* 3.38.0 and later */
        /// #define SQLITE_INDEX_CONSTRAINT_OFFSET    74  /* 3.38.0 and later */
        /// #define SQLITE_INDEX_CONSTRAINT_FUNCTION 150  /* 3.25.0 and later */
        /// #define SQLITE_INDEX_SCAN_UNIQUE           1  /* Scan visits at most 1 row */
        /// </code></para>
        /// <para>
        /// Use the sqlite3_vtab_collation() interface to find the name of
        /// the collating sequence that should be used when evaluating the i-th
        /// constraint:
        /// </para>
        /// <para><code>
        /// const char *sqlite3_vtab_collation(sqlite3_index_info*, int i);
        /// </code></para>
        /// <para>
        /// The SQLite core calls the xBestIndex method when it is compiling a query
        /// that involves a virtual table. In other words, SQLite calls this method 
        /// when it is running sqlite3_prepare() or the equivalent. 
        /// By calling this method, the 
        /// SQLite core is saying to the virtual table that it needs to access 
        /// some subset of the rows in the virtual table and it wants to know the
        /// most efficient way to do that access. The xBestIndex method replies 
        /// with information that the SQLite core can then use to conduct an 
        /// efficient search of the virtual table.
        /// </para>
        /// <para>
        /// While compiling a single SQL query, the SQLite core might call 
        /// xBestIndex multiple times with different settings in sqlite3_index_info.
        /// The SQLite core will then select the combination that appears to 
        /// give the best performance.
        /// </para>
        /// <para>
        /// Before calling this method, the SQLite core initializes an instance 
        /// of the sqlite3_index_info structure with information about the
        /// query that it is currently trying to process. This information 
        /// derives mainly from the WHERE clause and ORDER BY or GROUP BY clauses 
        /// of the query, but also from any ON or USING clauses if the query is a 
        /// join. The information that the SQLite core provides to the xBestIndex 
        /// method is held in the part of the structure that is marked as "Inputs". 
        /// The "Outputs" section is initialized to zero.
        /// </para>
        /// <para>
        /// The information in the sqlite3_index_info structure is ephemeral
        /// and may be overwritten or deallocated as soon as the xBestIndex method
        /// returns.  If the xBestIndex method needs to remember any part of the
        /// sqlite3_index_info structure, it should make a copy.  Care must be
        /// take to store the copy in a place where it will be deallocated, such
        /// as in the idxStr field with needToFreeIdxStr set to 1.
        /// </para>
        /// <para>
        /// Note that xBestIndex will always be called before xFilter, since
        /// the idxNum and idxStr outputs from xBestIndex are required inputs to
        /// xFilter.  However, there is no guarantee that xFilter will be called
        /// following a successful xBestIndex.
        /// </para>
        /// <para>
        /// The xBestIndex method is required for every virtual table implementation.
        /// </para>
        /// <para>
        /// The main thing that the SQLite core is trying to communicate to 
        /// the virtual table is the constraints that are available to limit 
        /// the number of rows that need to be searched. The aConstraint[] array 
        /// contains one entry for each constraint. There will be exactly 
        /// nConstraint entries in that array.
        /// </para>
        /// <para>
        /// Each constraint will usually correspond to a term in the WHERE clause
        /// or in a USING or ON clause that is of the form
        /// </para>
        /// <para><code>
        ///      column  OP  EXPR
        /// </code></para>
        /// <para>
        /// Where "column" is a column in the virtual table, OP is an operator 
        /// like "=" or "&lt;", and EXPR is an arbitrary expression. So, for example,
        /// if the WHERE clause contained a term like this:
        /// </para>
        /// <para><code>
        /// a = 5
        /// </code></para>
        /// <para>
        /// Then one of the constraints would be on the "a" column with 
        /// operator "=" and an expression of "5". Constraints need not have a
        /// literal representation of the WHERE clause. The query optimizer might
        /// make transformations to the 
        /// WHERE clause in order to extract as many constraints 
        /// as it can. So, for example, if the WHERE clause contained something 
        /// like this:
        /// </para>
        /// <para><code>
        /// x BETWEEN 10 AND 100 AND 999&gt;y
        /// </code></para>
        /// <para>
        /// The query optimizer might translate this into three separate constraints:
        /// </para>
        /// <para><code>
        /// x &gt;= 10
        /// x &lt;= 100
        /// y &lt; 999
        /// </code></para>
        /// <para>
        /// For each such constraint, the aConstraint[].iColumn field indicates which 
        /// column appears on the left-hand side of the constraint.
        /// The first column of the virtual table is column 0. 
        /// The rowid of the virtual table is column -1. 
        /// The aConstraint[].op field indicates which operator is used. 
        /// The SQLITE_INDEX_CONSTRAINT_* constants map integer constants 
        /// into operator values.
        /// Columns occur in the order they were defined by the call to
        /// sqlite3_declare_vtab() in the xCreate or xConnect method.
        /// Hidden columns are counted when determining the column index.
        /// </para>
        /// <para>
        /// If the xFindFunction() method for the virtual table is defined, and 
        /// if xFindFunction() sometimes returns SQLITE_INDEX_CONSTRAINT_FUNCTION or
        /// larger, then the constraints might also be of the form:
        /// </para>
        /// <para><code>
        ///      FUNCTION( column, EXPR)
        /// </code></para>
        /// <para>
        /// In this case the aConstraint[].op value is the same as the value
        /// returned by xFindFunction() for FUNCTION.
        /// </para>
        /// <para>
        /// The aConstraint[] array contains information about all constraints 
        /// that apply to the virtual table. But some of the constraints might
        /// not be usable because of the way tables are ordered in a join. 
        /// The xBestIndex method must therefore only consider constraints 
        /// that have an aConstraint[].usable flag which is true.
        /// </para>
        /// <para>
        /// In addition to WHERE clause constraints, the SQLite core also 
        /// tells the xBestIndex method about the ORDER BY clause. 
        /// (In an aggregate query, the SQLite core might put in GROUP BY clause 
        /// information in place of the ORDER BY clause information, but this fact
        /// should not make any difference to the xBestIndex method.) 
        /// If all terms of the ORDER BY clause are columns in the virtual table, 
        /// then nOrderBy will be the number of terms in the ORDER BY clause 
        /// and the aOrderBy[] array will identify the column for each term 
        /// in the order by clause and whether or not that column is ASC or DESC.
        /// </para>
        /// <para>
        /// In SQLite version 3.10.0 (2016-01-06) and later, 
        /// the colUsed field is available
        /// to indicate which fields of the virtual table are actually used by the
        /// statement being prepared.  If the lowest bit of colUsed is set, that
        /// means that the first column is used.  The second lowest bit corresponds
        /// to the second column.  And so forth.  If the most significant bit of
        /// colUsed is set, that means that one or more columns other than the 
        /// first 63 columns are used.  If column usage information is needed by the
        /// xFilter method, then the required bits must be encoded into either
        /// the output idxNum field or idxStr content.
        /// </para>
        /// <para>
        /// For the LIKE, GLOB, REGEXP, and MATCH operators, the 
        /// aConstraint[].iColumn value is the virtual table column that
        /// is the left operand of the operator.  However, if these operators
        /// are expressed as function calls instead of operators, then
        /// the aConstraint[].iColumn value references the virtual table
        /// column that is the second argument to that function:
        /// </para>
        /// <para><code>
        /// LIKE(<i>EXPR</i>, <i>column</i>)<![CDATA[<br>]]>
        /// GLOB(<i>EXPR</i>, <i>column</i>)<![CDATA[<br>]]>
        /// REGEXP(<i>EXPR</i>, <i>column</i>)<![CDATA[<br>]]>
        /// MATCH(<i>EXPR</i>, <i>column</i>)<![CDATA[<br>]]>
        /// </code></para>
        /// <para>
        /// Hence, as far as the xBestIndex() method is concerned, the following
        /// two forms are equivalent:
        /// </para>
        /// <para><code>
        /// <i>column</i> LIKE <i>EXPR</i><![CDATA[<br>]]>
        /// LIKE(<i>EXPR</i>,<i>column</i>)
        /// </code></para>
        /// <para>
        /// This special behavior of looking at the second argument of a function
        /// only occurs for the LIKE, GLOB, REGEXP, and MATCH functions.  For all
        /// other functions, the aConstraint[].iColumn value references the first
        /// argument of the function.
        /// </para>
        /// <para>
        /// This special feature of LIKE, GLOB, REGEXP, and MATCH does not
        /// apply to the xFindFunction() method, however.  The
        /// xFindFunction() method always keys off of the left operand of an
        /// LIKE, GLOB, REGEXP, or MATCH operator but off of the first argument
        /// to function-call equivalents of those operators.
        /// </para>
        /// <para>
        /// When aConstraint[].op is one of SQLITE_INDEX_CONSTRAINT_LIMIT or
        /// SQLITE_INDEX_CONSTRAINT_OFFSET, that indicates that there is a
        /// LIMIT or OFFSET clause on the SQL query statement that is using
        /// the virtual table.  The LIMIT and OFFSET operators have no
        /// left operand, and so when aConstraint[].op is one of
        /// SQLITE_INDEX_CONSTRAINT_LIMIT or SQLITE_INDEX_CONSTRAINT_OFFSET
        /// then the aConstraint[].iColumn value is meaningless and should
        /// not be used.
        /// </para>
        /// <para>
        /// The sqlite3_vtab_rhs_value() interface can be used to try to
        /// access the right-hand operand of a constraint.  However, the value
        /// of a right-hand operator might not be known at the time that
        /// the xBestIndex method is run, so the sqlite3_vtab_rhs_value()
        /// call might not be successful.  Usually the right operand of a
        /// constraint is only available to xBestIndex if it is coded as
        /// a literal value in the input SQL.  If the right operand is
        /// coded as an expression or a host parameter, it probably will
        /// not be accessible to xBestIndex.  Some operators, such as
        /// SQLITE_INDEX_CONSTRAINT_ISNULL and
        /// SQLITE_INDEX_CONSTRAINT_ISNOTNULL have no right-hand operand.
        /// The sqlite3_vtab_rhs_value() interface always returns
        /// SQLITE_NOTFOUND for such operators.
        /// </para>
        /// <para>
        /// Given all of the information above, the job of the xBestIndex 
        /// method it to figure out the best way to search the virtual table.
        /// </para>
        /// <para>
        /// The xBestIndex method conveys an indexing strategy to the xFilter 
        /// method through the idxNum and idxStr fields. The idxNum value and 
        /// idxStr string content are arbitrary as far as the SQLite core is 
        /// concerned and can have any meaning as long as xBestIndex and xFilter 
        /// agree on what that meaning is. The SQLite core just copies the 
        /// information from xBestIndex through to the xFilter method, assuming 
        /// only that the char sequence referenced via idxStr is NUL terminated.
        /// </para>
        /// <para>
        /// The idxStr value may be a string obtained from an SQLite
        /// memory allocation function such as sqlite3_mprintf(). 
        /// If this is the case, then the needToFreeIdxStr flag must be set to 
        /// true so that the SQLite core will know to call sqlite3_free() on 
        /// that string when it has finished with it, and thus avoid a memory leak.
        /// The idxStr value may also be a static constant string, in which case
        /// the needToFreeIdxStr boolean should remain false.
        /// </para>
        /// <para>
        /// The estimatedCost field should be set to the estimated number
        /// of disk access operations required to execute this query against 
        /// the virtual table. The SQLite core will often call xBestIndex 
        /// multiple times with different constraints, obtain multiple cost
        /// estimates, then choose the query plan that gives the lowest estimate.
        /// The SQLite core initializes estimatedCost to a very large value
        /// prior to invoking xBestIndex, so if xBestIndex determines that the
        /// current combination of parameters is undesirable, it can leave the
        /// estimatedCost field unchanged to discourage its use.
        /// </para>
        /// <para>
        /// If the current version of SQLite is 3.8.2 or greater, the estimatedRows
        /// field may be set to an estimate of the number of rows returned by the
        /// proposed query plan. If this value is not explicitly set, the default 
        /// estimate of 25 rows is used.
        /// </para>
        /// <para>
        /// If the current version of SQLite is 3.9.0 or greater, the idxFlags field
        /// may be set to SQLITE_INDEX_SCAN_UNIQUE to indicate that the virtual table
        /// will return only zero or one rows given the input constraints.  Additional
        /// bits of the idxFlags field might be understood in later versions of SQLite.
        /// </para>
        /// <para>
        /// The aConstraintUsage[] array contains one element for each of 
        /// the nConstraint constraints in the inputs section of the 
        /// sqlite3_index_info structure. 
        /// The aConstraintUsage[] array is used by xBestIndex to tell the 
        /// core how it is using the constraints.
        /// </para>
        /// <para>
        /// The xBestIndex method may set aConstraintUsage[].argvIndex 
        /// entries to values greater than zero. 
        /// Exactly one entry should be set to 1, another to 2, another to 3, 
        /// and so forth up to as many or as few as the xBestIndex method wants. 
        /// The EXPR of the corresponding constraints will then be passed 
        /// in as the argv[] parameters to xFilter.
        /// </para>
        /// <para>
        /// For example, if the aConstraint[3].argvIndex is set to 1, then 
        /// when xFilter is called, the argv[0] passed to xFilter will have 
        /// the EXPR value of the aConstraint[3] constraint.
        /// </para>
        /// <para>
        /// By default, the SQLite generates bytecode that will double
        /// checks all constraints on each row of the virtual table to verify
        /// that they are satisfied.  If the virtual table can guarantee
        /// that a constraint will always be satisfied, it can try to
        /// suppress that double-check by setting aConstraintUsage[].omit.
        /// However, with some exceptions, this is only a hint and
        /// there is no guarantee that the redundant check of the constraint
        /// will be suppressed.  Key points:
        /// </para>
        /// <![CDATA[<ul>]]>
        /// <![CDATA[<li>]]>
        /// The omit flag is only honored if the argvIndex value for the
        /// constraint is greater than 0 and less than or equal to 16.  
        /// Constraint checking is never suppressed for constraints
        /// that do not pass their right operand into the xFilter method.
        /// The current implementation is only able to suppress redundant
        /// constraint checking for the first 16 values passed to xFilter,
        /// though that limitation might be increased in future releases.
        /// <![CDATA[</li>]]><![CDATA[<li>]]>
        /// The omit flag is always honored for SQLITE_INDEX_CONSTRAINT_OFFSET
        /// constraints as long as argvIndex is greater than 0.  Setting the
        /// omit flag on an SQLITE_INDEX_CONSTRAINT_OFFSET constraint indicates
        /// to SQLite that the virtual table will itself suppress the first N
        /// rows of output, where N is the right operand of the OFFSET operator.
        /// If the virtual table implementation sets omit on an
        /// SQLITE_INDEX_CONSTRAINT_OFFSET constraint but then fails to suppress
        /// the first N rows of output, an incorrect answer will result from
        /// the overall query.
        /// <![CDATA[</li>]]><![CDATA[</ul>]]>
        /// <para>
        /// If the virtual table will output rows in the order specified by 
        /// the ORDER BY clause, then the orderByConsumed flag may be set to 
        /// true. If the output is not automatically in the correct order 
        /// then orderByConsumed must be left in its default false setting. 
        /// This will indicate to the SQLite core that it will need to do a 
        /// separate sorting pass over the data after it comes out of the virtual table.
        /// Setting orderByConsumed is an optimization.  A query will always
        /// get the correct answer if orderByConsumed is left at its default
        /// value (0).  Unnecessary sort operations might be avoided resulting
        /// in a faster query if orderByConsumed is set, but setting
        /// orderByConsumed incorrectly can result in an incorrect answer.
        /// It is suggested that new virtual table implementations leave
        /// the orderByConsumed value unset initially, and then after everything
        /// else is known to be working correctly, go back and attempt to
        /// optimize by setting orderByConsumed where appropriate.
        /// </para>
        /// <para>
        /// Sometimes the orderByConsumed flag can be safely set even if
        /// the outputs from the virtual table are not strictly in the order
        /// specified by nOrderBy and aOrderBy.  If the
        /// sqlite3_vtab_distinct() interface returns 1 or 2, that indicates
        /// that the ordering can be relaxed.  See the documentation on
        /// sqlite3_vtab_distinct() for further information.
        /// </para>
        /// <para>
        /// The xBestIndex method should return SQLITE_OK on success.  If any
        /// kind of fatal error occurs, an appropriate error code (ex: SQLITE_NOMEM)
        /// should be returned instead.
        /// </para>
        /// <para>
        /// If xBestIndex returns SQLITE_CONSTRAINT, that does not indicate an
        /// error.  Rather, SQLITE_CONSTRAINT indicates that the particular combination
        /// of input parameters specified is insufficient for the virtual table
        /// to do its job.
        /// This is logically the same as setting the estimatedCost to infinity.
        /// If every call to xBestIndex for a particular query plan returns
        /// SQLITE_CONSTRAINT, that means there is no way for the virtual table
        /// to be safely used, and the sqlite3_prepare() call will fail with
        /// a "no query solution" error.
        /// </para>
        /// <para>
        /// The SQLITE_CONSTRAINT return from xBestIndex
        /// is useful for table-valued functions that
        /// have required parameters.  If the aConstraint[].usable field is false
        /// for one of the required parameter, then the xBestIndex method should
        /// return SQLITE_CONSTRAINT.  If a required field does not appear in
        /// the aConstraint[] array at all, that means that the corresponding
        /// parameter is omitted from the input SQL.  In that case, xBestIndex
        /// should set an error message in pVTab-&gt;zErrMsg and return
        /// SQLITE_ERROR.  To summarize:
        /// </para>
        /// <![CDATA[<ol>]]>
        /// <![CDATA[<li>]]>
        /// The aConstraint[].usable value for a required parameter is
        /// false <big>&#8594;</big> return SQLITE_CONSTRAINT.
        /// <![CDATA[</li>]]><![CDATA[<li>]]>
        /// A required parameter does not appears anywhere in
        /// the aConstraint[] array <big>&#8594;</big>
        /// Set an error message in pVTab-&gt;zErrMsg and return
        /// SQLITE_ERROR
        /// <![CDATA[</li>]]><![CDATA[</ol>]]>
        /// <para>
        /// The following example will better illustrate the use of SQLITE_CONSTRAINT
        /// as a return value from xBestIndex:
        /// </para>
        /// <para><code>
        /// SELECT * FROM realtab, tablevaluedfunc(realtab.x);
        /// </code></para>
        /// <para>
        /// Assuming that the first hidden column of "tablevaluedfunc" is "param1",
        /// the query above is semantically equivalent to this:
        /// </para>
        /// <para><code>
        /// SELECT * FROM realtab, tablevaluedfunc
        ///  WHERE tablevaluedfunc.param1 = realtab.x;
        /// </code></para>
        /// <para>
        /// The query planner must decide between many possible implementations
        /// of this query, but two plans in particular are of note:
        /// </para>
        /// <![CDATA[<ol>]]>
        /// <![CDATA[<li>]]>Scan all
        /// rows of realtab and for each row, find rows in tablevaluedfunc where
        /// param1 is equal to realtab.x
        /// <![CDATA[</li>]]><![CDATA[<li>]]>Scan all rows of tablevalued func and for each row find rows
        /// in realtab where x is equal to tablevaluedfunc.param1.
        /// <![CDATA[</li>]]><![CDATA[</ol>]]>
        /// <para>
        /// The xBestIndex method will be invoked once for each of the potential
        /// plans above.  For plan 1, the aConstraint[].usable flag for the
        /// SQLITE_CONSTRAINT_EQ constraint on the param1 column will be true because
        /// the right-hand side value for the "param1 = ?" constraint will be known,
        /// since it is determined by the outer realtab loop.
        /// But for plan 2, the aConstraint[].usable flag for "param1 = ?" will be false
        /// because the right-hand side value is determined by an inner loop and is thus
        /// an unknown quantity.  Because param1 is a required input to the table-valued
        /// functions, the xBestIndex method should return SQLITE_CONSTRAINT when presented 
        /// with plan 2, indicating that a required input is missing.  This forces the
        /// query planner to select plan 1.
        /// </para>
        /// </summary>
        /// <param name="pVtab">
        /// The native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <param name="pIndex">
        /// The native pointer to the sqlite3_index_info structure.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xBestIndex(
            IntPtr pVtab,
            IntPtr pIndex
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xDisconnect)(sqlite3_vtab *pVTab);
        /// </code></para>
        /// <para>
        /// This method releases a connection to a virtual table. 
        /// Only the sqlite3_vtab object is destroyed.
        /// The virtual table is not destroyed and any backing store 
        /// associated with the virtual table persists. 
        /// </para>
        /// This method undoes the work of xConnect.
        /// <para>
        /// This method is a destructor for a connection to the virtual table.
        /// Contrast this method with xDestroy.  The xDestroy is a destructor
        /// for the entire virtual table.
        /// </para>
        /// <para>
        /// The xDisconnect method is required for every virtual table implementation,
        /// though it is acceptable for the xDisconnect and xDestroy methods to be
        /// the same function if that makes sense for the particular virtual table.
        /// </para>
        /// </summary>
        /// <param name="pVtab">
        /// The native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xDisconnect(
            IntPtr pVtab
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xDestroy)(sqlite3_vtab *pVTab);
        /// </code></para>
        /// <para>
        /// This method releases a connection to a virtual table, just like 
        /// the xDisconnect method, and it also destroys the underlying 
        /// table implementation. This method undoes the work of xCreate.
        /// </para>
        /// <para>
        /// The xDisconnect method is called whenever a database connection
        /// that uses a virtual table is closed. The xDestroy method is only 
        /// called when a DROP TABLE statement is executed against the virtual table.
        /// </para>
        /// <para>
        /// The xDestroy method is required for every virtual table implementation,
        /// though it is acceptable for the xDisconnect and xDestroy methods to be
        /// the same function if that makes sense for the particular virtual table.
        /// </para>
        /// </summary>
        /// <param name="pVtab">
        /// The native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xDestroy(
            IntPtr pVtab
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor);
        /// </code></para>
        /// <para>
        /// The xOpen method creates a new cursor used for accessing (read and/or
        /// writing) a virtual table.  A successful invocation of this method 
        /// will allocate the memory for the sqlite3_vtab_cursor (or a subclass),
        /// initialize the new object, and make *ppCursor point to the new object.
        /// The successful call then returns SQLITE_OK.
        /// </para>
        /// <para>
        /// For every successful call to this method, the SQLite core will
        /// later invoke the xClose method to destroy 
        /// the allocated cursor.
        /// </para>
        /// <para>
        /// The xOpen method need not initialize the pVtab field of the
        /// sqlite3_vtab_cursor structure.  The SQLite core will take care
        /// of that chore automatically.
        /// </para>
        /// <para>
        /// A virtual table implementation must be able to support an arbitrary
        /// number of simultaneously open cursors.
        /// </para>
        /// <para>
        /// When initially opened, the cursor is in an undefined state.
        /// The SQLite core will invoke the xFilter method
        /// on the cursor prior to any attempt to position or read from the cursor.
        /// </para>
        /// <para>
        /// The xOpen method is required for every virtual table implementation.
        /// </para>
        /// </summary>
        /// <param name="pVtab">
        /// The native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <param name="pCursor">
        /// Upon success, this parameter must be modified to point to the newly
        /// created native sqlite3_vtab_cursor derived structure.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xOpen(
            IntPtr pVtab,
            ref IntPtr pCursor
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xClose)(sqlite3_vtab_cursor*);
        /// </code></para>
        /// <para>
        /// The xClose method closes a cursor previously opened by 
        /// xOpen. 
        /// The SQLite core will always call xClose once for each cursor opened 
        /// using xOpen.
        /// </para>
        /// <para>
        /// This method must release all resources allocated by the
        /// corresponding xOpen call. The routine will not be called again even if it
        /// returns an error.  The SQLite core will not use the
        /// sqlite3_vtab_cursor again after it has been closed.
        /// </para>
        /// <para>
        /// The xClose method is required for every virtual table implementation.
        /// </para>
        /// </summary>
        /// <param name="pCursor">
        /// The native pointer to the sqlite3_vtab_cursor derived structure.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xClose(
            IntPtr pCursor
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr,
        ///               int argc, sqlite3_value **argv);
        /// </code></para>
        /// <para>
        /// This method begins a search of a virtual table. 
        /// The first argument is a cursor opened by xOpen. 
        /// The next two arguments define a particular search index previously 
        /// chosen by xBestIndex. The specific meanings of idxNum and idxStr 
        /// are unimportant as long as xFilter and xBestIndex agree on what 
        /// that meaning is.
        /// </para>
        /// <para>
        /// The xBestIndex function may have requested the values of 
        /// certain expressions using the aConstraintUsage[].argvIndex values 
        /// of the sqlite3_index_info structure. 
        /// Those values are passed to xFilter using the argc and argv parameters.
        /// </para>
        /// <para>
        /// If the virtual table contains one or more rows that match the
        /// search criteria, then the cursor must be left point at the first row.
        /// Subsequent calls to xEof must return false (zero).
        /// If there are no rows match, then the cursor must be left in a state 
        /// that will cause the xEof to return true (non-zero).
        /// The SQLite engine will use
        /// the xColumn and xRowid methods to access that row content.
        /// The xNext method will be used to advance to the next row.
        /// </para>
        /// <para>
        /// This method must return SQLITE_OK if successful, or an sqlite 
        /// error code if an error occurs.
        /// </para>
        /// <para>
        /// The xFilter method is required for every virtual table implementation.
        /// </para>
        /// </summary>
        /// <param name="pCursor">
        /// The native pointer to the sqlite3_vtab_cursor derived structure.
        /// </param>
        /// <param name="idxNum">
        /// Number used to help identify the selected index.
        /// </param>
        /// <param name="idxStr">
        /// The native pointer to the UTF-8 encoded string containing the
        /// string used to help identify the selected index.
        /// </param>
        /// <param name="argc">
        /// The number of native pointers to sqlite3_value structures specified
        /// in <paramref name="argv" />.
        /// </param>
        /// <param name="argv">
        /// An array of native pointers to sqlite3_value structures containing
        /// filtering criteria for the selected index.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xFilter(
            IntPtr pCursor,
            int idxNum,
            IntPtr idxStr,
            int argc,
            IntPtr argv
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xNext)(sqlite3_vtab_cursor*);
        /// </code></para>
        /// <para>
        /// The xNext method advances a virtual table cursor
        /// to the next row of a result set initiated by xFilter. 
        /// If the cursor is already pointing at the last row when this 
        /// routine is called, then the cursor no longer points to valid 
        /// data and a subsequent call to the xEof method must return true (non-zero). 
        /// If the cursor is successfully advanced to another row of content, then
        /// subsequent calls to xEof must return false (zero).
        /// </para>
        /// <para>
        /// This method must return SQLITE_OK if successful, or an sqlite 
        /// error code if an error occurs.
        /// </para>
        /// <para>
        /// The xNext method is required for every virtual table implementation.
        /// </para>
        /// </summary>
        /// <param name="pCursor">
        /// The native pointer to the sqlite3_vtab_cursor derived structure.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xNext(
            IntPtr pCursor
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xEof)(sqlite3_vtab_cursor*);
        /// </code></para>
        /// <para>
        /// The xEof method must return false (zero) if the specified cursor 
        /// currently points to a valid row of data, or true (non-zero) otherwise. 
        /// This method is called by the SQL engine immediately after each 
        /// xFilter and xNext invocation.
        /// </para>
        /// <para>
        /// The xEof method is required for every virtual table implementation.
        /// </para>
        /// </summary>
        /// <param name="pCursor">
        /// The native pointer to the sqlite3_vtab_cursor derived structure.
        /// </param>
        /// <returns>
        /// Non-zero if no more rows are available; zero otherwise.
        /// </returns>
        int xEof(
            IntPtr pCursor
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int N);
        /// </code></para>
        /// <para>
        /// The SQLite core invokes this method in order to find the value for 
        /// the N-th column of the current row. N is zero-based so the first column 
        /// is numbered 0. 
        /// The xColumn method may return its result back to SQLite using one of the
        /// following interface:
        /// </para>
        /// <para>
        /// <![CDATA[<ul>]]>
        /// <![CDATA[<li>]]> sqlite3_result_blob()
        /// <![CDATA[</li>]]><![CDATA[<li>]]> sqlite3_result_double()
        /// <![CDATA[</li>]]><![CDATA[<li>]]> sqlite3_result_int()
        /// <![CDATA[</li>]]><![CDATA[<li>]]> sqlite3_result_int64()
        /// <![CDATA[</li>]]><![CDATA[<li>]]> sqlite3_result_null()
        /// <![CDATA[</li>]]><![CDATA[<li>]]> sqlite3_result_text()
        /// <![CDATA[</li>]]><![CDATA[<li>]]> sqlite3_result_text16()
        /// <![CDATA[</li>]]><![CDATA[<li>]]> sqlite3_result_text16le()
        /// <![CDATA[</li>]]><![CDATA[<li>]]> sqlite3_result_text16be()
        /// <![CDATA[</li>]]><![CDATA[<li>]]> sqlite3_result_zeroblob()
        /// <![CDATA[</li>]]><![CDATA[</ul>]]>
        /// </para>
        /// <para>
        /// If the xColumn method implementation calls none of the functions above,
        /// then the value of the column defaults to an SQL NULL.
        /// </para>
        /// <para>
        /// To raise an error, the xColumn method should use one of the result_text() 
        /// methods to set the error message text, then return an appropriate
        /// error code.  The xColumn method must return SQLITE_OK on success.
        /// </para>
        /// <para>
        /// The xColumn method is required for every virtual table implementation.
        /// </para>
        /// </summary>
        /// <param name="pCursor">
        /// The native pointer to the sqlite3_vtab_cursor derived structure.
        /// </param>
        /// <param name="pContext">
        /// The native pointer to the sqlite3_context structure to be used
        /// for returning the specified column value to the SQLite core
        /// library.
        /// </param>
        /// <param name="index">
        /// The zero-based index corresponding to the column containing the
        /// value to be returned.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xColumn(
            IntPtr pCursor,
            IntPtr pContext,
            int index
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xRowid)(sqlite3_vtab_cursor *pCur, sqlite_int64 *pRowid);
        /// </code></para>
        /// <para>
        /// A successful invocation of this method will cause *pRowid to be
        /// filled with the rowid of row that the
        /// virtual table cursor pCur is currently pointing at.
        /// This method returns SQLITE_OK on success.
        /// It returns an appropriate error code on failure.
        /// </para>
        /// <para>
        /// The xRowid method is required for every virtual table implementation.
        /// </para>
        /// </summary>
        /// <param name="pCursor">
        /// The native pointer to the sqlite3_vtab_cursor derived structure.
        /// </param>
        /// <param name="rowId">
        /// Upon success, this parameter must be modified to contain the unique
        /// integer row identifier for the current row for the specified cursor.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xRowId(
            IntPtr pCursor,
            ref long rowId
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xUpdate)(
        ///   sqlite3_vtab *pVTab,
        ///   int argc,
        ///   sqlite3_value **argv,
        ///   sqlite_int64 *pRowid
        /// );
        /// </code></para>
        /// <para>
        /// All changes to a virtual table are made using the xUpdate method.
        /// This one method can be used to insert, delete, or update.
        /// </para>
        /// <para>
        /// The argc parameter specifies the number of entries in the argv array. 
        /// The value of argc will be 1 for a pure delete operation or N+2 for an insert
        /// or replace or update where N is the number of columns in the table.  
        /// In the previous sentence, N includes any hidden columns.
        /// </para>
        /// <para>
        /// Every argv entry will have a non-NULL value in C but may contain the 
        /// SQL value NULL.  In other words, it is always true that
        /// <![CDATA[<tt>]]>argv[i]!=0<![CDATA[</tt>]]> for <![CDATA[<b>]]>i<![CDATA[</b>]]> between 0 and <![CDATA[<tt>]]>argc-1<![CDATA[</tt>]]>.
        /// However, it might be the case that
        /// <![CDATA[<tt>]]>sqlite3_value_type(argv[i])==SQLITE_NULL<![CDATA[</tt>]]>.
        /// </para>
        /// <para>
        /// The argv[0] parameter is the rowid of a row in the virtual table 
        /// to be deleted. If argv[0] is an SQL NULL, then no deletion occurs.
        /// </para>
        /// <para>
        /// The argv[1] parameter is the rowid of a new row to be inserted 
        /// into the virtual table. If argv[1] is an SQL NULL, then the implementation 
        /// must choose a rowid for the newly inserted row. Subsequent argv[] 
        /// entries contain values of the columns of the virtual table, in the 
        /// order that the columns were declared. The number of columns will
        /// match the table declaration that the xConnect or xCreate method made 
        /// using the sqlite3_declare_vtab() call.  All hidden columns are included.
        /// </para>
        /// <para>
        /// When doing an insert without a rowid (argc>1, argv[1] is an SQL NULL),
        /// on a virtual table that uses ROWID (but not on a WITHOUT ROWID virtual table),
        /// the implementation must set *pRowid to the rowid of the newly inserted row; 
        /// this will become the value returned by the sqlite3_last_insert_rowid()
        /// function. Setting this value in all the other cases is a harmless no-op;
        /// the SQLite engine ignores the *pRowid return value if argc==1 or 
        /// argv[1] is not an SQL NULL.
        /// </para>
        /// <para>
        /// Each call to xUpdate will fall into one of cases shown below.
        /// Not that references to <![CDATA[<b>]]>argv[i]<![CDATA[</b>]]> mean the SQL value
        /// held within the argv[i] object, not the argv[i]
        /// object itself.
        /// </para>
        /// <para><code>
        /// <![CDATA[<dl>]]>
        /// <![CDATA[<dt>]]><![CDATA[<b>]]>argc = 1 <![CDATA[<br>]]> argv[0] &#8800; NULL<![CDATA[</b>]]>
        /// <![CDATA[</dt>]]><![CDATA[<dd>]]>
        /// DELETE: The single row with rowid or PRIMARY KEY equal to argv[0] is deleted. 
        /// No insert occurs.
        /// <![CDATA[</dd>]]><![CDATA[<dt>]]><![CDATA[<b>]]>argc &gt; 1 <![CDATA[<br>]]> argv[0] = NULL<![CDATA[</b>]]>
        /// <![CDATA[</dt>]]><![CDATA[<dd>]]>
        /// INSERT: A new row is inserted with column values taken from
        /// argv[2] and following.  In a rowid virtual table, if argv[1] is an SQL NULL,
        /// then a new unique rowid is generated automatically.  The argv[1] will be NULL
        /// for a WITHOUT ROWID virtual table, in which case the implementation should
        /// take the PRIMARY KEY value from the appropriate column in argv[2] and following.
        /// <![CDATA[</dd>]]><![CDATA[<dt>]]><![CDATA[<b>]]>argc &gt; 1 <![CDATA[<br>]]> argv[0] &#8800; NULL <![CDATA[<br>]]> argv[0] = argv[1]<![CDATA[</b>]]>
        /// <![CDATA[</dt>]]><![CDATA[<dd>]]>
        /// UPDATE:
        /// The row with rowid or PRIMARY KEY argv[0] is updated with new values 
        /// in argv[2] and following parameters.
        /// <![CDATA[</dd>]]><![CDATA[<dt>]]><![CDATA[<b>]]>argc &gt; 1 <![CDATA[<br>]]> argv[0] &#8800; NULL <![CDATA[<br>]]> argv[0] &#8800; argv[1]<![CDATA[</b>]]>
        /// <![CDATA[</dt>]]><![CDATA[<dd>]]>
        /// UPDATE with rowid or PRIMARY KEY change:
        /// The row with rowid or PRIMARY KEY argv[0] is updated with 
        /// the rowid or PRIMARY KEY in argv[1] 
        /// and new values in argv[2] and following parameters. This will occur 
        /// when an SQL statement updates a rowid, as in the statement:
        /// <para><code>
        ///    UPDATE table SET rowid=rowid+1 WHERE ...; 
        /// </code></para>
        /// <![CDATA[</dd>]]><![CDATA[</dl>]]>
        /// </code></para>
        /// <para>
        /// The xUpdate method must return SQLITE_OK if and only if it is
        /// successful.  If a failure occurs, the xUpdate must return an appropriate
        /// error code.  On a failure, the pVTab->zErrMsg element may optionally
        /// be replaced with error message text stored in memory allocated from SQLite 
        /// using functions such as sqlite3_mprintf() or sqlite3_malloc().
        /// </para>
        /// <para>
        /// If the xUpdate method violates some constraint of the virtual table
        /// (including, but not limited to, attempting to store a value of the wrong 
        /// datatype, attempting to store a value that is too
        /// large or too small, or attempting to change a read-only value) then the
        /// xUpdate must fail with an appropriate error code.
        /// </para>
        /// <para>
        /// If the xUpdate method is performing an UPDATE, then
        /// sqlite3_value_nochange(X) can be used to discover which columns
        /// of the virtual table were actually modified by the UPDATE
        /// statement.  The sqlite3_value_nochange(X) interface returns
        /// true for columns that do not change.
        /// On every UPDATE, SQLite will first invoke
        /// xColumn separately for each unchanging column in the table to 
        /// obtain the value for that column.  The xColumn method can
        /// check to see if the column is unchanged at the SQL level
        /// by invoking sqlite3_vtab_nochange().  If xColumn sees that
        /// the column is not being modified, it should return without setting 
        /// a result using one of the sqlite3_result_xxxxx()
        /// interfaces.  Only in that case sqlite3_value_nochange() will be
        /// true within the xUpdate method.  If xColumn does
        /// invoke one or more sqlite3_result_xxxxx()
        /// interfaces, then SQLite understands that as a change in the value
        /// of the column and the sqlite3_value_nochange() call for that
        /// column within xUpdate will return false.
        /// </para>
        /// <para>
        /// There might be one or more sqlite3_vtab_cursor objects open and in use 
        /// on the virtual table instance and perhaps even on the row of the virtual
        /// table when the xUpdate method is invoked.  The implementation of
        /// xUpdate must be prepared for attempts to delete or modify rows of the table
        /// out from other existing cursors.  If the virtual table cannot accommodate
        /// such changes, the xUpdate method must return an error code.
        /// </para>
        /// <para>
        /// The xUpdate method is optional.
        /// If the xUpdate pointer in the sqlite3_module for a virtual table
        /// is a NULL pointer, then the virtual table is read-only.
        /// </para>
        /// </summary>
        /// <param name="pVtab">
        /// The native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <param name="argc">
        /// The number of new or modified column values contained in
        /// <paramref name="argv" />.
        /// </param>
        /// <param name="argv">
        /// The array of native pointers to sqlite3_value structures containing
        /// the new or modified column values, if any.
        /// </param>
        /// <param name="rowId">
        /// Upon success, this parameter must be modified to contain the unique
        /// integer row identifier for the row that was inserted, if any.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xUpdate(
            IntPtr pVtab,
            int argc,
            IntPtr argv,
            ref long rowId
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xBegin)(sqlite3_vtab *pVTab);
        /// </code></para>
        /// <para>
        /// This method begins a transaction on a virtual table.
        /// This is method is optional.  The xBegin pointer of sqlite3_module
        /// may be NULL.
        /// </para>
        /// <para>
        /// This method is always followed by one call to either the
        /// xCommit or xRollback method.  Virtual table transactions do
        /// not nest, so the xBegin method will not be invoked more than once
        /// on a single virtual table
        /// without an intervening call to either xCommit or xRollback.
        /// Multiple calls to other methods can and likely will occur in between
        /// the xBegin and the corresponding xCommit or xRollback.
        /// </para>
        /// </summary>
        /// <param name="pVtab">
        /// The native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xBegin(
            IntPtr pVtab
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xSync)(sqlite3_vtab *pVTab);
        /// </code></para>
        /// <para>
        /// This method signals the start of a two-phase commit on a virtual
        /// table.
        /// This is method is optional.  The xSync pointer of sqlite3_module
        /// may be NULL.
        /// </para>
        /// <para>
        /// This method is only invoked after call to the xBegin method and
        /// prior to an xCommit or xRollback.  In order to implement two-phase
        /// commit, the xSync method on all virtual tables is invoked prior to
        /// invoking the xCommit method on any virtual table.  If any of the 
        /// xSync methods fail, the entire transaction is rolled back.
        /// </para>
        /// </summary>
        /// <param name="pVtab">
        /// The native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xSync(
            IntPtr pVtab
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xCommit)(sqlite3_vtab *pVTab);
        /// </code></para>
        /// <para>
        /// This method causes a virtual table transaction to commit.
        /// This is method is optional.  The xCommit pointer of sqlite3_module
        /// may be NULL.
        /// </para>
        /// <para>
        /// A call to this method always follows a prior call to xBegin and
        /// xSync.
        /// </para>
        /// </summary>
        /// <param name="pVtab">
        /// The native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xCommit(
            IntPtr pVtab
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xRollback)(sqlite3_vtab *pVTab);
        /// </code></para>
        /// <para>
        /// This method causes a virtual table transaction to rollback.
        /// This is method is optional.  The xRollback pointer of sqlite3_module
        /// may be NULL.
        /// </para>
        /// <para>
        /// A call to this method always follows a prior call to xBegin.
        /// </para>
        /// </summary>
        /// <param name="pVtab">
        /// The native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xRollback(
            IntPtr pVtab
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xFindFunction)(
        ///   sqlite3_vtab *pVtab,
        ///   int nArg,
        ///   const char *zName,
        ///   void (**pxFunc)(sqlite3_context*,int,sqlite3_value**),
        ///   void **ppArg
        /// );
        /// </code></para>
        /// <para>
        /// This method is called during sqlite3_prepare() to give the virtual
        /// table implementation an opportunity to overload functions. 
        /// This method may be set to NULL in which case no overloading occurs.
        /// </para>
        /// <para>
        /// When a function uses a column from a virtual table as its first 
        /// argument, this method is called to see if the virtual table would 
        /// like to overload the function. The first three parameters are inputs: 
        /// the virtual table, the number of arguments to the function, and the 
        /// name of the function. If no overloading is desired, this method
        /// returns 0. To overload the function, this method writes the new 
        /// function implementation into *pxFunc and writes user data into *ppArg 
        /// and returns either 1 or a number between
        /// SQLITE_INDEX_CONSTRAINT_FUNCTION and 255.
        /// </para>
        /// <para>
        /// Historically, the return value from xFindFunction() was either zero
        /// or one.  Zero means that the function is not overloaded and one means that
        /// it is overload.  The ability to return values of 
        /// SQLITE_INDEX_CONSTRAINT_FUNCTION or greater was added in
        /// version 3.25.0 (2018-09-15).  If xFindFunction returns
        /// SQLITE_INDEX_CONSTRAINT_FUNCTION or greater, than means that the function
        /// takes two arguments and the function
        /// can be used as a boolean in the WHERE clause of a query and that
        /// the virtual table is able to exploit that function to speed up the query
        /// result.  When xFindFunction returns SQLITE_INDEX_CONSTRAINT_FUNCTION or 
        /// larger, the value returned becomes the sqlite3_index_info.aConstraint.op
        /// value for one of the constraints passed into xBestIndex().  The first
        /// argument to the function is the column identified by 
        /// aConstraint[].iColumn field of the constraint and the second argument to the
        /// function is the value that will be passed into xFilter() (if the
        /// aConstraintUsage[].argvIndex value is set) or the value returned from
        /// sqlite3_vtab_rhs_value().
        /// </para>
        /// <para>
        /// The Geopoly module is an example of a virtual table that makes use
        /// of SQLITE_INDEX_CONSTRAINT_FUNCTION to improve performance.
        /// The xFindFunction() method for Geopoly returns
        /// SQLITE_INDEX_CONSTRAINT_FUNCTION for the geopoly_overlap() SQL function
        /// and it returns
        /// SQLITE_INDEX_CONSTRAINT_FUNCTION+1 for the geopoly_within() SQL function.
        /// This permits search optimizations for queries such as:
        /// </para>
        /// <para><code>
        /// SELECT * FROM geopolytab WHERE geopoly_overlap(_shape, $query_polygon);
        /// SELECT * FROM geopolytab WHERE geopoly_within(_shape, $query_polygon);
        /// </code></para>
        /// <para>
        /// Note that infix functions (LIKE, GLOB, REGEXP, and MATCH) reverse 
        /// the order of their arguments. So "like(A,B)" would normally work the same
        /// as "B like A".
        /// However, xFindFunction() always looks a the left-most argument, not
        /// the first logical argument.
        /// Hence, for the form "B like A", SQLite looks at the
        /// left operand "B" and if that operand is a virtual table column
        /// it invokes the xFindFunction() method on that virtual table.
        /// But if the form "like(A,B)" is used instead, then SQLite checks
        /// the A term to see if it is column of a virtual table and if so
        /// it invokes the xFindFunction() method for the virtual table of
        /// column A. 
        /// </para>
        /// <para>
        /// The function pointer returned by this routine must be valid for
        /// the lifetime of the sqlite3_vtab object given in the first parameter.
        /// </para>
        /// </summary>
        /// <param name="pVtab">
        /// The native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <param name="nArg">
        /// The number of arguments to the function being sought.
        /// </param>
        /// <param name="zName">
        /// The name of the function being sought.
        /// </param>
        /// <param name="callback">
        /// Upon success, this parameter must be modified to contain the
        /// delegate responsible for implementing the specified function.
        /// </param>
        /// <param name="pClientData">
        /// Upon success, this parameter must be modified to contain the
        /// native user-data pointer associated with
        /// <paramref name="callback" />.
        /// </param>
        /// <returns>
        /// Non-zero if the specified function was found; zero otherwise.
        /// </returns>
        int xFindFunction(
            IntPtr pVtab,
            int nArg,
            IntPtr zName,
            ref SQLiteCallback callback,
            ref IntPtr pClientData
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xRename)(sqlite3_vtab *pVtab, const char *zNew);
        /// </code></para>
        /// <para>
        /// This method provides notification that the virtual table implementation
        /// that the virtual table will be given a new name. 
        /// If this method returns SQLITE_OK then SQLite renames the table.
        /// If this method returns an error code then the renaming is prevented.
        /// </para>
        /// <para>
        /// The xRename method is optional.  If omitted, then the virtual
        /// table may not be renamed using the ALTER TABLE RENAME command.
        /// </para>
        /// <para>
        /// The PRAGMA legacy_alter_table setting is enabled prior to invoking this
        /// method, and the value for legacy_alter_table is restored after this
        /// method finishes.  This is necessary for the correct operation of virtual
        /// tables that make use of shadow tables where the shadow tables must be
        /// renamed to match the new virtual table name.  If the legacy_alter_format is
        /// off, then the xConnect method will be invoked for the virtual table every
        /// time the xRename method tries to change the name of the shadow table.
        /// </para>
        /// </summary>
        /// <param name="pVtab">
        /// The native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <param name="zNew">
        /// The native pointer to the UTF-8 encoded string containing the new
        /// name for the virtual table.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xRename(
            IntPtr pVtab,
            IntPtr zNew
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xSavepoint)(sqlite3_vtab *pVtab, int);
        /// int (*xRelease)(sqlite3_vtab *pVtab, int);
        /// int (*xRollbackTo)(sqlite3_vtab *pVtab, int);
        /// </code></para>
        /// <para>
        /// These methods provide the virtual table implementation an opportunity to
        /// implement nested transactions.  They are always optional and will only be
        /// called in SQLite version 3.7.7 (2011-06-23) and later.
        /// </para>
        /// <para>
        /// When xSavepoint(X,N) is invoked, that is a signal to the virtual table X
        /// that it should save its current state as savepoint N.  
        /// A subsequent call
        /// to xRollbackTo(X,R) means that the state of the virtual table should return
        /// to what it was when xSavepoint(X,R) was last called.  
        /// The call
        /// to xRollbackTo(X,R) will invalidate all savepoints with N>R; none of the
        /// invalided savepoints will be rolled back or released without first
        /// being reinitialized by a call to xSavepoint().  
        /// A call to xRelease(X,M) invalidates all savepoints where N>=M.
        /// </para>
        /// <para>
        /// None of the xSavepoint(), xRelease(), or xRollbackTo() methods will ever
        /// be called except in between calls to xBegin() and 
        /// either xCommit() or xRollback().
        /// </para>
        /// </summary>
        /// <param name="pVtab">
        /// The native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <param name="iSavepoint">
        /// This is an integer identifier under which the the current state of
        /// the virtual table should be saved.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xSavepoint(
            IntPtr pVtab,
            int iSavepoint
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xSavepoint)(sqlite3_vtab *pVtab, int);
        /// int (*xRelease)(sqlite3_vtab *pVtab, int);
        /// int (*xRollbackTo)(sqlite3_vtab *pVtab, int);
        /// </code></para>
        /// <para>
        /// These methods provide the virtual table implementation an opportunity to
        /// implement nested transactions.  They are always optional and will only be
        /// called in SQLite version 3.7.7 (2011-06-23) and later.
        /// </para>
        /// <para>
        /// When xSavepoint(X,N) is invoked, that is a signal to the virtual table X
        /// that it should save its current state as savepoint N.  
        /// A subsequent call
        /// to xRollbackTo(X,R) means that the state of the virtual table should return
        /// to what it was when xSavepoint(X,R) was last called.  
        /// The call
        /// to xRollbackTo(X,R) will invalidate all savepoints with N>R; none of the
        /// invalided savepoints will be rolled back or released without first
        /// being reinitialized by a call to xSavepoint().  
        /// A call to xRelease(X,M) invalidates all savepoints where N>=M.
        /// </para>
        /// <para>
        /// None of the xSavepoint(), xRelease(), or xRollbackTo() methods will ever
        /// be called except in between calls to xBegin() and 
        /// either xCommit() or xRollback().
        /// </para>
        /// </summary>
        /// <param name="pVtab">
        /// The native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <param name="iSavepoint">
        /// This is an integer used to indicate that any saved states with an
        /// identifier greater than or equal to this should be deleted by the
        /// virtual table.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xRelease(
            IntPtr pVtab,
            int iSavepoint
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// <para><code>
        /// int (*xSavepoint)(sqlite3_vtab *pVtab, int);
        /// int (*xRelease)(sqlite3_vtab *pVtab, int);
        /// int (*xRollbackTo)(sqlite3_vtab *pVtab, int);
        /// </code></para>
        /// <para>
        /// These methods provide the virtual table implementation an opportunity to
        /// implement nested transactions.  They are always optional and will only be
        /// called in SQLite version 3.7.7 (2011-06-23) and later.
        /// </para>
        /// <para>
        /// When xSavepoint(X,N) is invoked, that is a signal to the virtual table X
        /// that it should save its current state as savepoint N.  
        /// A subsequent call
        /// to xRollbackTo(X,R) means that the state of the virtual table should return
        /// to what it was when xSavepoint(X,R) was last called.  
        /// The call
        /// to xRollbackTo(X,R) will invalidate all savepoints with N>R; none of the
        /// invalided savepoints will be rolled back or released without first
        /// being reinitialized by a call to xSavepoint().  
        /// A call to xRelease(X,M) invalidates all savepoints where N>=M.
        /// </para>
        /// <para>
        /// None of the xSavepoint(), xRelease(), or xRollbackTo() methods will ever
        /// be called except in between calls to xBegin() and 
        /// either xCommit() or xRollback().
        /// </para>
        /// </summary>
        /// <param name="pVtab">
        /// The native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <param name="iSavepoint">
        /// This is an integer identifier used to specify a specific saved
        /// state for the virtual table for it to restore itself back to, which
        /// should also have the effect of deleting all saved states with an
        /// integer identifier greater than this one.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode xRollbackTo(
            IntPtr pVtab,
            int iSavepoint
            );
    }
    #endregion
}

Changes to System.Data.SQLite/LINQ/SQLiteConnection_Linq.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23


24











25
26
27
28
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Data;
  using System.Data.Common;
  using System.Collections.Generic;
  using System.Globalization;
  using System.ComponentModel;

  public sealed partial class SQLiteConnection
  {
    /// <summary>
    /// Returns a SQLiteProviderFactory object.
    /// </summary>
    protected override DbProviderFactory DbProviderFactory
    {


      get { return SQLiteFactory.Instance; }











    }
  }
}










|
<

<
<
<




|



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




1
2
3
4
5
6
7
8
9
10

11



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System.Globalization;

  using System.Data.Common;




  public sealed partial class SQLiteConnection
  {
    /// <summary>
    /// Returns the <see cref="SQLiteFactory" /> instance.
    /// </summary>
    protected override DbProviderFactory DbProviderFactory
    {
      get
      {
        DbProviderFactory result = SQLiteFactory.Instance;

        if (SQLite3.ForceLogLifecycle())
        {
          SQLiteLog.LogMessage(HelperMethods.StringFormat(
            CultureInfo.CurrentCulture,
            "Returning \"{0}\" from SQLiteConnection.DbProviderFactory...",
            (result != null) ? result.ToString() : "<null>"));
        }

        return result;
      }
    }
  }
}

Changes to System.Data.SQLite/LINQ/SQLiteFactory_Linq.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

















20
21
22


23
24


25

26





27









28



29

















30
31
32
33
34
35
36
37
38
39




















40
41
42



43

44
45
46
47
















48

49
50
51



52
53
54

55
56
57
58
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Data.Common;
  using System.Reflection;
  using System.Security.Permissions;

  /// <summary>
  /// SQLite implementation of DbProviderFactory.
  /// </summary>
  public sealed partial class SQLiteFactory : IServiceProvider
  {

















    private static Type _dbProviderServicesType;
    private static object _sqliteServices;



    static SQLiteFactory()
    {


      _dbProviderServicesType = Type.GetType("System.Data.Common.DbProviderServices, System.Data.Entity, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", false);

    }















    /// <summary>



    /// Will provide a DbProviderServices object in .NET 3.5

















    /// </summary>
    /// <param name="serviceType">The class or interface type to query for</param>
    /// <returns></returns>
    object IServiceProvider.GetService(Type serviceType)
    {
      if (serviceType == typeof(ISQLiteSchemaExtensions) ||
        (_dbProviderServicesType != null && serviceType == _dbProviderServicesType))
      {
        return GetSQLiteProviderServicesInstance();
      }




















      return null;
    }




    [ReflectionPermission(SecurityAction.Assert, MemberAccess = true)]

    private object GetSQLiteProviderServicesInstance()
    {
      if (_sqliteServices == null)
      {
















        Type type = Type.GetType("System.Data.SQLite.SQLiteProviderServices, System.Data.SQLite.Linq, Version=2.0.38.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139", false);

        if (type != null)
        {
          FieldInfo field = type.GetField("Instance", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);



          _sqliteServices = field.GetValue(null);
        }
      }

      return _sqliteServices;
    }
  }
}



|






|




|



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



>
>


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

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

|






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



>
>
>

>


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



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Globalization;
  using System.Reflection;
  using System.Security.Permissions;

  /// <summary>
  /// SQLite implementation of <see cref="IServiceProvider" />.
  /// </summary>
  public sealed partial class SQLiteFactory : IServiceProvider
  {
    //
    // TODO: This points to the legacy "System.Data.SQLite.Linq" assembly
    //       (i.e. the one that does not support Entity Framework 6).
    //       Currently, this class and its containing assembly (i.e.
    //       "System.Data.SQLite") know nothing about the Entity Framework
    //       6 compatible assembly (i.e. "System.Data.SQLite.EF6").  This
    //       situation may need to change.
    //
    private static readonly string DefaultTypeName =
      "System.Data.SQLite.Linq.SQLiteProviderServices, System.Data.SQLite.Linq, " +
      "Version={0}, Culture=neutral, PublicKeyToken=db937bc2d44ff139";

    private static readonly BindingFlags DefaultBindingFlags =
        BindingFlags.NonPublic | BindingFlags.Static;

    ///////////////////////////////////////////////////////////////////////////

    private static Type _dbProviderServicesType;
    private static object _sqliteServices;

    ///////////////////////////////////////////////////////////////////////////

    static SQLiteFactory()
    {
      InitializeDbProviderServices();
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// This method is called to perform preliminary static initialization
    /// necessary for this class.
    /// </summary>
    internal static void PreInitialize()
    {
#if (SQLITE_STANDARD || USE_INTEROP_DLL || PLATFORM_COMPACTFRAMEWORK) && PRELOAD_NATIVE_LIBRARY
        UnsafeNativeMethods.Initialize();
#endif

        SQLiteLog.Initialize(typeof(SQLiteFactory).Name);
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// This method is called to perform some of the static initialization
    /// necessary for this class.
    /// </summary>
    private static void InitializeDbProviderServices()
    {
        PreInitialize();

        string version =
#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_20 || NET_STANDARD_21
            "4.0.0.0";
#else
            "3.5.0.0";
#endif

        _dbProviderServicesType = Type.GetType(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "System.Data.Common.DbProviderServices, System.Data.Entity, Version={0}, Culture=neutral, PublicKeyToken=b77a5c561934e089", version), false);
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Will provide a <see cref="IServiceProvider" /> object in .NET 3.5.
    /// </summary>
    /// <param name="serviceType">The class or interface type to query for.</param>
    /// <returns></returns>
    object IServiceProvider.GetService(Type serviceType)
    {
      if (serviceType == typeof(ISQLiteSchemaExtensions) ||
        (_dbProviderServicesType != null && serviceType == _dbProviderServicesType))
      {
        object result = GetSQLiteProviderServicesInstance();

        if (SQLite3.ForceLogLifecycle())
        {
          SQLiteLog.LogMessage(HelperMethods.StringFormat(
            CultureInfo.CurrentCulture,
            "Success of \"{0}\" from SQLiteFactory.GetService(\"{1}\")...",
            (result != null) ? result.ToString() : "<null>",
            (serviceType != null) ? serviceType.ToString() : "<null>"));
        }

        return result;
      }

      if (SQLite3.ForceLogLifecycle())
      {
        SQLiteLog.LogMessage(HelperMethods.StringFormat(
          CultureInfo.CurrentCulture,
          "Failure of SQLiteFactory.GetService(\"{0}\")...",
          (serviceType != null) ? serviceType.ToString() : "<null>"));
      }

      return null;
    }

    ///////////////////////////////////////////////////////////////////////////

#if !NET_STANDARD_20 && !NET_STANDARD_21
    [ReflectionPermission(SecurityAction.Assert, MemberAccess = true)]
#endif
    private object GetSQLiteProviderServicesInstance()
    {
        if (_sqliteServices == null)
        {
            string typeName = UnsafeNativeMethods.GetSettingValue(
                "TypeName_SQLiteProviderServices", null);

            Version version = this.GetType().Assembly.GetName().Version;

            if (typeName != null)
            {
                typeName = HelperMethods.StringFormat(
                    CultureInfo.InvariantCulture, typeName, version);
            }
            else
            {
                typeName = HelperMethods.StringFormat(
                    CultureInfo.InvariantCulture, DefaultTypeName, version);
            }

            Type type = Type.GetType(typeName, false);

            if (type != null)
            {
                FieldInfo field = type.GetField(
                    "Instance", DefaultBindingFlags);

                if (field != null)
                    _sqliteServices = field.GetValue(null);
            }
        }

        return _sqliteServices;
    }
  }
}

Deleted System.Data.SQLite/MetaDataCollections.xml.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?xml version="1.0" encoding="utf-8" ?>
<DocumentElement>
  <MetaDataCollections>
    <CollectionName>MetaDataCollections</CollectionName>
    <NumberOfRestrictions>0</NumberOfRestrictions>
    <NumberOfIdentifierParts>0</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>DataSourceInformation</CollectionName>
    <NumberOfRestrictions>0</NumberOfRestrictions>
    <NumberOfIdentifierParts>0</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>DataTypes</CollectionName>
    <NumberOfRestrictions>0</NumberOfRestrictions>
    <NumberOfIdentifierParts>0</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>ReservedWords</CollectionName>
    <NumberOfRestrictions>0</NumberOfRestrictions>
    <NumberOfIdentifierParts>0</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>Catalogs</CollectionName>
    <NumberOfRestrictions>1</NumberOfRestrictions>
    <NumberOfIdentifierParts>1</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>Columns</CollectionName>
    <NumberOfRestrictions>4</NumberOfRestrictions>
    <NumberOfIdentifierParts>4</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>Indexes</CollectionName>
    <NumberOfRestrictions>4</NumberOfRestrictions>
    <NumberOfIdentifierParts>3</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>IndexColumns</CollectionName>
    <NumberOfRestrictions>5</NumberOfRestrictions>
    <NumberOfIdentifierParts>4</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>Tables</CollectionName>
    <NumberOfRestrictions>4</NumberOfRestrictions>
    <NumberOfIdentifierParts>3</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>Views</CollectionName>
    <NumberOfRestrictions>3</NumberOfRestrictions>
    <NumberOfIdentifierParts>3</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>ViewColumns</CollectionName>
    <NumberOfRestrictions>4</NumberOfRestrictions>
    <NumberOfIdentifierParts>4</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>ForeignKeys</CollectionName>
    <NumberOfRestrictions>4</NumberOfRestrictions>
    <NumberOfIdentifierParts>3</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>Triggers</CollectionName>
    <NumberOfRestrictions>4</NumberOfRestrictions>
    <NumberOfIndentifierParts>3</NumberOfIndentifierParts>
  </MetaDataCollections>
</DocumentElement>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































































































































Added System.Data.SQLite/Resources/DataTypes.xml.















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
<?xml version="1.0" standalone="yes"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<DocumentElement>
  <DataTypes>
    <TypeName>smallint</TypeName>
    <ProviderDbType>10</ProviderDbType>
    <ColumnSize>5</ColumnSize>
    <DataType>System.Int16</DataType>
    <CreateFormat>smallint</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>int</TypeName>
    <ProviderDbType>11</ProviderDbType>
    <ColumnSize>10</ColumnSize>
    <DataType>System.Int32</DataType>
    <CreateFormat>int</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>mediumint</TypeName>
    <ProviderDbType>11</ProviderDbType>
    <ColumnSize>10</ColumnSize>
    <DataType>System.Int32</DataType>
    <CreateFormat>mediumint</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>real</TypeName>
    <ProviderDbType>8</ProviderDbType>
    <ColumnSize>6</ColumnSize>
    <DataType>System.Double</DataType>
    <CreateFormat>real</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>single</TypeName>
    <ProviderDbType>15</ProviderDbType>
    <ColumnSize>7</ColumnSize>
    <DataType>System.Single</DataType>
    <CreateFormat>single</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>float</TypeName>
    <ProviderDbType>8</ProviderDbType>
    <ColumnSize>6</ColumnSize>
    <DataType>System.Double</DataType>
    <CreateFormat>float</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>double</TypeName>
    <ProviderDbType>8</ProviderDbType>
    <ColumnSize>6</ColumnSize>
    <DataType>System.Double</DataType>
    <CreateFormat>double</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>money</TypeName>
    <ProviderDbType>7</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Decimal</DataType>
    <CreateFormat>money</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>currency</TypeName>
    <ProviderDbType>7</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Decimal</DataType>
    <CreateFormat>currency</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>decimal</TypeName>
    <ProviderDbType>7</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Decimal</DataType>
    <CreateFormat>decimal</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>numeric</TypeName>
    <ProviderDbType>7</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Decimal</DataType>
    <CreateFormat>numeric</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>bit</TypeName>
    <ProviderDbType>3</ProviderDbType>
    <ColumnSize>1</ColumnSize>
    <DataType>System.Boolean</DataType>
    <CreateFormat>bit</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>yesno</TypeName>
    <ProviderDbType>3</ProviderDbType>
    <ColumnSize>1</ColumnSize>
    <DataType>System.Boolean</DataType>
    <CreateFormat>yesno</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>logical</TypeName>
    <ProviderDbType>3</ProviderDbType>
    <ColumnSize>1</ColumnSize>
    <DataType>System.Boolean</DataType>
    <CreateFormat>logical</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>bool</TypeName>
    <ProviderDbType>3</ProviderDbType>
    <ColumnSize>1</ColumnSize>
    <DataType>System.Boolean</DataType>
    <CreateFormat>bool</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>boolean</TypeName>
    <ProviderDbType>3</ProviderDbType>
    <ColumnSize>1</ColumnSize>
    <DataType>System.Boolean</DataType>
    <CreateFormat>boolean</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>tinyint</TypeName>
    <ProviderDbType>2</ProviderDbType>
    <ColumnSize>3</ColumnSize>
    <DataType>System.Byte</DataType>
    <CreateFormat>tinyint</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>true</IsUnsigned>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>integer</TypeName>
    <ProviderDbType>12</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Int64</DataType>
    <CreateFormat>integer</CreateFormat>
    <IsAutoIncrementable>true</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>counter</TypeName>
    <ProviderDbType>12</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Int64</DataType>
    <CreateFormat>counter</CreateFormat>
    <IsAutoIncrementable>true</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>autoincrement</TypeName>
    <ProviderDbType>12</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Int64</DataType>
    <CreateFormat>autoincrement</CreateFormat>
    <IsAutoIncrementable>true</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>identity</TypeName>
    <ProviderDbType>12</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Int64</DataType>
    <CreateFormat>identity</CreateFormat>
    <IsAutoIncrementable>true</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>long</TypeName>
    <ProviderDbType>12</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Int64</DataType>
    <CreateFormat>long</CreateFormat>
    <IsAutoIncrementable>true</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>bigint</TypeName>
    <ProviderDbType>12</ProviderDbType>
    <ColumnSize>19</ColumnSize>
    <DataType>System.Int64</DataType>
    <CreateFormat>bigint</CreateFormat>
    <IsAutoIncrementable>true</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>true</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <IsUnsigned>false</IsUnsigned>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>binary</TypeName>
    <ProviderDbType>1</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <DataType>System.Byte[]</DataType>
    <CreateFormat>binary</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>false</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <LiteralPrefix>X'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>varbinary</TypeName>
    <ProviderDbType>1</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <DataType>System.Byte[]</DataType>
    <CreateFormat>varbinary</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>false</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <LiteralPrefix>X'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>blob</TypeName>
    <ProviderDbType>1</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <DataType>System.Byte[]</DataType>
    <CreateFormat>blob</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>false</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <LiteralPrefix>X'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>image</TypeName>
    <ProviderDbType>1</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <DataType>System.Byte[]</DataType>
    <CreateFormat>image</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>false</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <LiteralPrefix>X'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>general</TypeName>
    <ProviderDbType>1</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <DataType>System.Byte[]</DataType>
    <CreateFormat>general</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>false</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <LiteralPrefix>X'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>oleobject</TypeName>
    <ProviderDbType>1</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <DataType>System.Byte[]</DataType>
    <CreateFormat>oleobject</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>false</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <LiteralPrefix>X'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>varchar</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>varchar({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>nvarchar</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>nvarchar({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>memo</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>memo({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>longtext</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>longtext({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>note</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>note({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>text</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>text({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>ntext</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>ntext({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>string</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>string({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>char</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>char({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>nchar</TypeName>
    <ProviderDbType>16</ProviderDbType>
    <ColumnSize>2147483647</ColumnSize>
    <CreateParameters>max length</CreateParameters>
    <DataType>System.String</DataType>
    <CreateFormat>char({0})</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>false</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>datetime</TypeName>
    <ProviderDbType>6</ProviderDbType>
    <ColumnSize>23</ColumnSize>
    <DataType>System.DateTime</DataType>
    <CreateFormat>datetime</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>smalldate</TypeName>
    <ProviderDbType>6</ProviderDbType>
    <ColumnSize>23</ColumnSize>
    <DataType>System.DateTime</DataType>
    <CreateFormat>smalldate</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>timestamp</TypeName>
    <ProviderDbType>6</ProviderDbType>
    <ColumnSize>23</ColumnSize>
    <DataType>System.DateTime</DataType>
    <CreateFormat>timestamp</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>date</TypeName>
    <ProviderDbType>6</ProviderDbType>
    <ColumnSize>23</ColumnSize>
    <DataType>System.DateTime</DataType>
    <CreateFormat>date</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>time</TypeName>
    <ProviderDbType>6</ProviderDbType>
    <ColumnSize>23</ColumnSize>
    <DataType>System.DateTime</DataType>
    <CreateFormat>time</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>true</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>uniqueidentifier</TypeName>
    <ProviderDbType>9</ProviderDbType>
    <ColumnSize>16</ColumnSize>
    <DataType>System.Guid</DataType>
    <CreateFormat>uniqueidentifier</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>true</IsBestMatch>
  </DataTypes>
  <DataTypes>
    <TypeName>guid</TypeName>
    <ProviderDbType>9</ProviderDbType>
    <ColumnSize>16</ColumnSize>
    <DataType>System.Guid</DataType>
    <CreateFormat>guid</CreateFormat>
    <IsAutoIncrementable>false</IsAutoIncrementable>
    <IsCaseSensitive>false</IsCaseSensitive>
    <IsFixedLength>true</IsFixedLength>
    <IsFixedPrecisionScale>false</IsFixedPrecisionScale>
    <IsLong>false</IsLong>
    <IsNullable>true</IsNullable>
    <IsSearchable>true</IsSearchable>
    <IsSearchableWithLike>false</IsSearchableWithLike>
    <LiteralPrefix>'</LiteralPrefix>
    <LiteralSuffix>'</LiteralSuffix>
    <IsBestMatch>false</IsBestMatch>
  </DataTypes>
</DocumentElement>

Added System.Data.SQLite/Resources/MetaDataCollections.xml.





























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?xml version="1.0" encoding="utf-8" ?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<DocumentElement>
  <MetaDataCollections>
    <CollectionName>MetaDataCollections</CollectionName>
    <NumberOfRestrictions>0</NumberOfRestrictions>
    <NumberOfIdentifierParts>0</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>DataSourceInformation</CollectionName>
    <NumberOfRestrictions>0</NumberOfRestrictions>
    <NumberOfIdentifierParts>0</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>DataTypes</CollectionName>
    <NumberOfRestrictions>0</NumberOfRestrictions>
    <NumberOfIdentifierParts>0</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>ReservedWords</CollectionName>
    <NumberOfRestrictions>0</NumberOfRestrictions>
    <NumberOfIdentifierParts>0</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>Catalogs</CollectionName>
    <NumberOfRestrictions>1</NumberOfRestrictions>
    <NumberOfIdentifierParts>1</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>Columns</CollectionName>
    <NumberOfRestrictions>4</NumberOfRestrictions>
    <NumberOfIdentifierParts>4</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>Indexes</CollectionName>
    <NumberOfRestrictions>4</NumberOfRestrictions>
    <NumberOfIdentifierParts>3</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>IndexColumns</CollectionName>
    <NumberOfRestrictions>5</NumberOfRestrictions>
    <NumberOfIdentifierParts>4</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>Tables</CollectionName>
    <NumberOfRestrictions>4</NumberOfRestrictions>
    <NumberOfIdentifierParts>3</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>Views</CollectionName>
    <NumberOfRestrictions>3</NumberOfRestrictions>
    <NumberOfIdentifierParts>3</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>ViewColumns</CollectionName>
    <NumberOfRestrictions>4</NumberOfRestrictions>
    <NumberOfIdentifierParts>4</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>ForeignKeys</CollectionName>
    <NumberOfRestrictions>4</NumberOfRestrictions>
    <NumberOfIdentifierParts>3</NumberOfIdentifierParts>
  </MetaDataCollections>
  <MetaDataCollections>
    <CollectionName>Triggers</CollectionName>
    <NumberOfRestrictions>4</NumberOfRestrictions>
    <NumberOfIndentifierParts>3</NumberOfIndentifierParts>
  </MetaDataCollections>
</DocumentElement>

Added System.Data.SQLite/Resources/SQLiteCommand.bmp.

cannot compute difference between binary files

Added System.Data.SQLite/Resources/SQLiteConnection.bmp.

cannot compute difference between binary files

Added System.Data.SQLite/Resources/SQLiteDataAdapter.bmp.

cannot compute difference between binary files

Added System.Data.SQLite/Resources/SR.Designer.cs.



















































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.1
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace System.Data.SQLite {
    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
#if !NET_COMPACT_20
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
#endif
    internal sealed class SR {
        
        private static global::System.Resources.ResourceManager resourceMan;
        
        private static global::System.Globalization.CultureInfo resourceCulture;
        
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal SR() {
        }
        
        /// <summary>
        ///   Returns the cached ResourceManager instance used by this class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Data.SQLite.SR", typeof(SR).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }
        
        /// <summary>
        ///   Overrides the current thread's CurrentUICulture property for all
        ///   resource lookups using this strongly typed resource class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; standalone=&quot;yes&quot;?&gt;
        ///&lt;DocumentElement&gt;
        ///  &lt;DataTypes&gt;
        ///    &lt;TypeName&gt;smallint&lt;/TypeName&gt;
        ///    &lt;ProviderDbType&gt;10&lt;/ProviderDbType&gt;
        ///    &lt;ColumnSize&gt;5&lt;/ColumnSize&gt;
        ///    &lt;DataType&gt;System.Int16&lt;/DataType&gt;
        ///    &lt;CreateFormat&gt;smallint&lt;/CreateFormat&gt;
        ///    &lt;IsAutoIncrementable&gt;false&lt;/IsAutoIncrementable&gt;
        ///    &lt;IsCaseSensitive&gt;false&lt;/IsCaseSensitive&gt;
        ///    &lt;IsFixedLength&gt;true&lt;/IsFixedLength&gt;
        ///    &lt;IsFixedPrecisionScale&gt;true&lt;/IsFixedPrecisionScale&gt;
        ///    &lt;IsLong&gt;false&lt;/IsLong&gt;
        ///    &lt;IsNullable&gt;true&lt;/ [rest of string was truncated]&quot;;.
        /// </summary>
        internal static string DataTypes {
            get {
                return ResourceManager.GetString("DataTypes", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to ABORT,ACTION,ADD,AFTER,ALL,ALTER,ALWAYS,ANALYZE,AND,AS,ASC,ATTACH,AUTOINCREMENT,BEFORE,BEGIN,BETWEEN,BY,CASCADE,CASE,CAST,CHECK,COLLATE,COLUMN,COMMIT,CONFLICT,CONSTRAINT,CREATE,CROSS,CURRENT,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,DATABASE,DEFAULT,DEFERRABLE,DEFERRED,DELETE,DESC,DETACH,DISTINCT,DO,DROP,EACH,ELSE,END,ESCAPE,EXCEPT,EXCLUDE,EXCLUSIVE,EXISTS,EXPLAIN,FAIL,FILTER,FIRST,FOLLOWING,FOR,FOREIGN,FROM,FULL,GENERATED,GLOB,GROUP,GROUPS,HAVING,IF,IGNORE,IMMEDIATE,IN,INDEX,INDEXED,INITIALLY,INNER,INSERT,INSTEAD,INTERSECT,INTO,IS,ISNULL,JOIN,KEY,LAST,LEFT,LIKE,LIMIT,MATCH,MATERIALIZED,NATURAL,NO,NOT,NOTHING,NOTNULL,NULL,NULLS,OF,OFFSET,ON,OR,ORDER,OTHERS,OUTER,OVER,PARTITION,PLAN,PRAGMA,PRECEDING,PRIMARY,QUERY,RAISE,RANGE,RECURSIVE,REFERENCES,REGEXP,REINDEX,RELEASE,RENAME,REPLACE,RESTRICT,RETURNING,RIGHT,ROLLBACK,ROW,ROWS,SAVEPOINT,SELECT,SET,TABLE,TEMP,TEMPORARY,THEN,TIES,TO,TRANSACTION,TRIGGER,UNBOUNDED,UNION,UNIQUE,UPDATE,USING,VACUUM,VALUES,VIEW,VIRTUAL,WHEN,WHERE,WINDOW,WITH,WITHOUT.
        /// </summary>
        internal static string Keywords {
            get {
                return ResourceManager.GetString("Keywords", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
        ///&lt;DocumentElement&gt;
        ///  &lt;MetaDataCollections&gt;
        ///    &lt;CollectionName&gt;MetaDataCollections&lt;/CollectionName&gt;
        ///    &lt;NumberOfRestrictions&gt;0&lt;/NumberOfRestrictions&gt;
        ///    &lt;NumberOfIdentifierParts&gt;0&lt;/NumberOfIdentifierParts&gt;
        ///  &lt;/MetaDataCollections&gt;
        ///  &lt;MetaDataCollections&gt;
        ///    &lt;CollectionName&gt;DataSourceInformation&lt;/CollectionName&gt;
        ///    &lt;NumberOfRestrictions&gt;0&lt;/NumberOfRestrictions&gt;
        ///    &lt;NumberOfIdentifierParts&gt;0&lt;/NumberOfIdentifierParts&gt;
        ///  &lt;/MetaDataCollections&gt;
        ///  &lt;MetaDataC [rest of string was truncated]&quot;;.
        /// </summary>
        internal static string MetaDataCollections {
            get {
                return ResourceManager.GetString("MetaDataCollections", resourceCulture);
            }
        }
    }
}

Added System.Data.SQLite/Resources/SR.resx.





















































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?xml version="1.0" encoding="utf-8"?>
<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->
<root>
  <!--
    Microsoft ResX Schema

    Version 2.0

    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.

    Example:

    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>

    There are any number of "resheader" rows that contain simple
    name/value pairs.

    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.

    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:

    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.

    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  <data name="DataTypes" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>DataTypes.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
  </data>
  <data name="Keywords" xml:space="preserve">
    <value>ABORT,ACTION,ADD,AFTER,ALL,ALTER,ALWAYS,ANALYZE,AND,AS,ASC,ATTACH,AUTOINCREMENT,BEFORE,BEGIN,BETWEEN,BY,CASCADE,CASE,CAST,CHECK,COLLATE,COLUMN,COMMIT,CONFLICT,CONSTRAINT,CREATE,CROSS,CURRENT,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,DATABASE,DEFAULT,DEFERRABLE,DEFERRED,DELETE,DESC,DETACH,DISTINCT,DO,DROP,EACH,ELSE,END,ESCAPE,EXCEPT,EXCLUDE,EXCLUSIVE,EXISTS,EXPLAIN,FAIL,FILTER,FIRST,FOLLOWING,FOR,FOREIGN,FROM,FULL,GENERATED,GLOB,GROUP,GROUPS,HAVING,IF,IGNORE,IMMEDIATE,IN,INDEX,INDEXED,INITIALLY,INNER,INSERT,INSTEAD,INTERSECT,INTO,IS,ISNULL,JOIN,KEY,LAST,LEFT,LIKE,LIMIT,MATCH,MATERIALIZED,NATURAL,NO,NOT,NOTHING,NOTNULL,NULL,NULLS,OF,OFFSET,ON,OR,ORDER,OTHERS,OUTER,OVER,PARTITION,PLAN,PRAGMA,PRECEDING,PRIMARY,QUERY,RAISE,RANGE,RECURSIVE,REFERENCES,REGEXP,REINDEX,RELEASE,RENAME,REPLACE,RESTRICT,RETURNING,RIGHT,ROLLBACK,ROW,ROWS,SAVEPOINT,SELECT,SET,TABLE,TEMP,TEMPORARY,THEN,TIES,TO,TRANSACTION,TRIGGER,UNBOUNDED,UNION,UNIQUE,UPDATE,USING,VACUUM,VALUES,VIEW,VIRTUAL,WHEN,WHERE,WINDOW,WITH,WITHOUT</value>
  </data>
  <data name="MetaDataCollections" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>MetaDataCollections.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
  </data>
</root>

Changes to System.Data.SQLite/SQLite3.cs.

1
2
3
4
5
6
7
8
9
10







11
12
13


14
15





















16
17
18
19


20























21
22
23
24




25

26

27
28
29
30

31
32
33

34






35

































































36







37
38


39









































40












































41
42




43















44
45




























































46
47
48
49
50
51
52


53
54





55

56




57




























58
59












60















































61

62

63
64






65
66

























































67
68







69



















































































70
71
72
73
74
75
76
77
78
















































































79
80
81
82
83
84
85
86
87
































































































88
89
90
91
92

















































93
94
95
96
97
98
99



100

101
102
103
104
105
























































































































































































































































































106
107









108







109
110
111





112












113
114
115
116






117

118
119








120
121
122
123







124


125

126





127

128
129






130





131

132
133
134
135
136
137














138
139
140


141
142
143
144
145
146
147
148




149
150


151


152
153






154
155














156
157
158
159
160



161




















162
163
164
165
166
167
168

169
170
171
172
173
174
175
176
177
178
179
180
181
182
183














184
185

186
187







188
189
190
191


























































192


193







194

195
















196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211


212
213

214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
























































































236
237
238

239
240



241
242
243
244
245


246
247
248

249
250
251
252









253

254
255



256

257
258
259

































260





261




262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280



281

282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301






302
303
304
305
306
307
308
309
310
311
312
313





314
315
316
317
318
319
320
321
322
323
324














325
326

327
328
329
330









331




332
333
334
335






336
337
338
339
340
341
342
343
344



345





346



347





348



349





350


351



352




353









354
355



356

































357
358






359
360
361
362


















































363
364




365














366






367

368



369

370
371

372

373
374
375
376
377



378

379



380






381
382
383
384



385

386




























387
388








389

390

391

392




393
394








395




















396










































397
398

399
400

401
402

403














404
405
406
407
408
409
410

411











412
413

414












415
416
417
418
419
420
421
422
423
424
425
426
427
428







429
430
431
432
433
434
435
436
437
438
439
440

441
442
443
444
445
446
447


448
449



450
451

452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514










515





516


517
518
519
520
521
522
523
524
525
526


527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542

543








































544
545
546
547
548
549

550



551

552























553
554
555
556
557
558





559
560
561
562
563
564
565

566



567

568



569
570
571
572
573
574
575
576
577

578
579
580
581
582







583
584
585
586
587

588
589
590
591
592
593
594
595
596
597
598
599

600


601
602
603
604
605



606



607

608
609
610





611
612
613
614
615
616
617
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;







  using System.Runtime.InteropServices;
  using System.Collections.Generic;
  using System.Globalization;



  /// <summary>





















  /// This class implements SQLiteBase completely, and is the guts of the code that interop's SQLite with .NET
  /// </summary>
  internal class SQLite3 : SQLiteBase
  {


    /// <summary>























    /// The opaque pointer returned to us by the sqlite provider
    /// </summary>
    protected SQLiteConnectionHandle _sql;
    protected string _fileName;




    protected bool _usePool;

    protected int _poolVersion;


#if !PLATFORM_COMPACTFRAMEWORK
    private bool _buildingSchema;
#endif

    /// <summary>
    /// The user-defined functions registered on this connection
    /// </summary>

    protected SQLiteFunction[] _functionsArray;








































































    internal SQLite3(SQLiteDateFormats fmt)







      : base(fmt)
    {


    }






















































































    protected override void Dispose(bool bDisposing)
    {




      if (bDisposing)















        Close();
    }





























































    // It isn't necessary to cleanup any functions we've registered.  If the connection
    // goes to the pool and is resurrected later, re-registered functions will overwrite the
    // previous functions.  The SQLiteFunctionCookieHandle will take care of freeing unmanaged
    // resources belonging to the previously-registered functions.
    internal override void Close()
    {


      if (_sql != null)
      {





        if (_usePool)

        {




          SQLiteBase.ResetConnection(_sql);




























          SQLiteConnectionPool.Add(_fileName, _sql, _poolVersion);
        }












        else















































          _sql.Dispose();

      }


      _sql = null;






    }


























































    internal override void Cancel()
    {







      UnsafeNativeMethods.sqlite3_interrupt(_sql);



















































































    }

    internal override string Version
    {
      get
      {
        return SQLite3.SQLiteVersion;
      }
    }

















































































    internal static string SQLiteVersion
    {
      get
      {
        return UTF8ToString(UnsafeNativeMethods.sqlite3_libversion(), -1);
      }
    }

































































































    internal override bool AutoCommit
    {
      get
      {
        return IsAutocommit(_sql);

















































      }
    }

    internal override int Changes
    {
      get
      {



        return UnsafeNativeMethods.sqlite3_changes(_sql);

      }
    }

    internal override void Open(string strFilename, SQLiteOpenFlagsEnum flags, int maxPoolSize, bool usePool)
    {
























































































































































































































































































      if (_sql != null) return;










      _usePool = usePool;







      if (usePool)
      {
        _fileName = strFilename;





        _sql = SQLiteConnectionPool.Remove(strFilename, maxPoolSize, out _poolVersion);












      }

      if (_sql == null)
      {






        IntPtr db;


#if !SQLITE_STANDARD








        int n = UnsafeNativeMethods.sqlite3_open_interop(ToUTF8(strFilename), (int)flags, out db);
#else
        int n = UnsafeNativeMethods.sqlite3_open_v2(ToUTF8(strFilename), out db, (int)flags, IntPtr.Zero);
#endif







        if (n > 0) throw new SQLiteException(n, null);




        _sql = db;





      }

      // Bind functions to this connection.  If any previous functions of the same name
      // were already bound, then the new bindings replace the old.






      _functionsArray = SQLiteFunction.BindFunctions(this);





      SetTimeout(0);

    }

    internal override void ClearPool()
    {
      SQLiteConnectionPool.ClearPool(_fileName);
    }















    internal override void SetTimeout(int nTimeoutMS)
    {


      int n = UnsafeNativeMethods.sqlite3_busy_timeout(_sql, nTimeoutMS);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }

    internal override bool Step(SQLiteStatement stmt)
    {
      int n;
      Random rnd = null;




      uint starttick = (uint)Environment.TickCount;
      uint timeout = (uint)(stmt._command._commandTimeout * 1000);





      while (true)
      {






        n = UnsafeNativeMethods.sqlite3_step(stmt._sqlite_stmt);















        if (n == 100) return true;
        if (n == 101) return false;

        if (n > 0)
        {



          int r;





















          // An error occurred, attempt to reset the statement.  If the reset worked because the
          // schema has changed, re-try the step again.  If it errored our because the database
          // is locked, then keep retrying until the command timeout occurs.
          r = Reset(stmt);

          if (r == 0)

            throw new SQLiteException(n, SQLiteLastError());

          else if ((r == 6 || r == 5) && stmt._command != null) // SQLITE_LOCKED || SQLITE_BUSY
          {
            // Keep trying
            if (rnd == null) // First time we've encountered the lock
              rnd = new Random();

            // If we've exceeded the command's timeout, give up and throw an error
            if ((uint)Environment.TickCount - starttick > timeout)
            {
              throw new SQLiteException(r, SQLiteLastError());
            }
            else
            {














              // Otherwise sleep for a random amount of time up to 150ms
              System.Threading.Thread.Sleep(rnd.Next(1, 150));

            }
          }







        }
      }
    }



























































    internal override int Reset(SQLiteStatement stmt)


    {







      int n;


















#if !SQLITE_STANDARD
      n = UnsafeNativeMethods.sqlite3_reset_interop(stmt._sqlite_stmt);
#else
      n = UnsafeNativeMethods.sqlite3_reset(stmt._sqlite_stmt);
#endif

      // If the schema changed, try and re-prepare it
      if (n == 17) // SQLITE_SCHEMA
      {
        // Recreate a dummy statement
        string str;
        using (SQLiteStatement tmp = Prepare(null, stmt._sqlStatement, null, (uint)(stmt._command._commandTimeout * 1000), out str))
        {
          // Finalize the existing statement
          stmt._sqlite_stmt.Dispose();
          // Reassign a new statement pointer to the old statement and clear the temporary one


          stmt._sqlite_stmt = tmp._sqlite_stmt;
          tmp._sqlite_stmt = null;


          // Reapply parameters
          stmt.BindParameters();
        }
        return -1; // Reset was OK, with schema change
      }
      else if (n == 6 || n == 5) // SQLITE_LOCKED || SQLITE_BUSY
        return n;

      if (n > 0)
        throw new SQLiteException(n, SQLiteLastError());

      return 0; // We reset OK, no schema changes
    }

    internal override string SQLiteLastError()
    {
      return SQLiteBase.SQLiteLastError(_sql);
    }

    internal override SQLiteStatement Prepare(SQLiteConnection cnn, string strSql, SQLiteStatement previous, uint timeoutMS, out string strRemain)
    {
























































































      IntPtr stmt = IntPtr.Zero;
      IntPtr ptr = IntPtr.Zero;
      int len = 0;

      int n = 17;
      int retries = 0;



      byte[] b = ToUTF8(strSql);
      string typedefs = null;
      SQLiteStatement cmd = null;
      Random rnd = null;
      uint starttick = (uint)Environment.TickCount;



      GCHandle handle = GCHandle.Alloc(b, GCHandleType.Pinned);
      IntPtr psql = handle.AddrOfPinnedObject();

      try
      {
        while ((n == 17 || n == 6 || n == 5) && retries < 3)
        {









#if !SQLITE_STANDARD

          n = UnsafeNativeMethods.sqlite3_prepare_interop(_sql, psql, b.Length - 1, out stmt, out ptr, out len);
#else



          n = UnsafeNativeMethods.sqlite3_prepare(_sql, psql, b.Length - 1, out stmt, out ptr);

          len = -1;
#endif


































          if (n == 17)





            retries++;




          else if (n == 1)
          {
            if (String.Compare(SQLiteLastError(), "near \"TYPES\": syntax error", StringComparison.OrdinalIgnoreCase) == 0)
            {
              int pos = strSql.IndexOf(';');
              if (pos == -1) pos = strSql.Length - 1;

              typedefs = strSql.Substring(0, pos + 1);
              strSql = strSql.Substring(pos + 1);

              strRemain = "";

              while (cmd == null && strSql.Length > 0)
              {
                cmd = Prepare(cnn, strSql, previous, timeoutMS, out strRemain);
                strSql = strRemain;
              }

              if (cmd != null)



                cmd.SetTypes(typedefs);


              return cmd;
            }
#if !PLATFORM_COMPACTFRAMEWORK
            else if (_buildingSchema == false && String.Compare(SQLiteLastError(), 0, "no such table: TEMP.SCHEMA", 0, 26, StringComparison.OrdinalIgnoreCase) == 0)
            {
              strRemain = "";
              _buildingSchema = true;
              try
              {
                ISQLiteSchemaExtensions ext = ((IServiceProvider)SQLiteFactory.Instance).GetService(typeof(ISQLiteSchemaExtensions)) as ISQLiteSchemaExtensions;

                if (ext != null)
                  ext.BuildTempSchema(cnn);

                while (cmd == null && strSql.Length > 0)
                {
                  cmd = Prepare(cnn, strSql, previous, timeoutMS, out strRemain);
                  strSql = strRemain;
                }







                return cmd;
              }
              finally
              {
                _buildingSchema = false;
              }
            }
#endif
          }
          else if (n == 6 || n == 5) // Locked -- delay a small amount before retrying
          {





            // Keep trying
            if (rnd == null) // First time we've encountered the lock
              rnd = new Random();

            // If we've exceeded the command's timeout, give up and throw an error
            if ((uint)Environment.TickCount - starttick > timeoutMS)
            {
              throw new SQLiteException(n, SQLiteLastError());
            }
            else
            {














              // Otherwise sleep for a random amount of time up to 150ms
              System.Threading.Thread.Sleep(rnd.Next(1, 150));

            }
          }
        }










        if (n > 0) throw new SQLiteException(n, SQLiteLastError());





        strRemain = UTF8ToString(ptr, len);

        if (stmt != IntPtr.Zero) cmd = new SQLiteStatement(this, stmt, strSql.Substring(0, strSql.Length - strRemain.Length), previous);







        return cmd;
      }
      finally
      {
        handle.Free();
      }
    }




    internal override void Bind_Double(SQLiteStatement stmt, int index, double value)





    {



#if !PLATFORM_COMPACTFRAMEWORK





      int n = UnsafeNativeMethods.sqlite3_bind_double(stmt._sqlite_stmt, index, value);



#else





      int n = UnsafeNativeMethods.sqlite3_bind_double_interop(stmt._sqlite_stmt, index, ref value);


#endif



      if (n > 0) throw new SQLiteException(n, SQLiteLastError());




    }










    internal override void Bind_Int32(SQLiteStatement stmt, int index, int value)



    {

































      int n = UnsafeNativeMethods.sqlite3_bind_int(stmt._sqlite_stmt, index, value);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());






    }

    internal override void Bind_Int64(SQLiteStatement stmt, int index, long value)
    {


















































#if !PLATFORM_COMPACTFRAMEWORK
      int n = UnsafeNativeMethods.sqlite3_bind_int64(stmt._sqlite_stmt, index, value);




#else














      int n = UnsafeNativeMethods.sqlite3_bind_int64_interop(stmt._sqlite_stmt, index, ref value);






#endif

      if (n > 0) throw new SQLiteException(n, SQLiteLastError());



    }


    internal override void Bind_Text(SQLiteStatement stmt, int index, string value)

    {

      byte[] b = ToUTF8(value);
      int n = UnsafeNativeMethods.sqlite3_bind_text(stmt._sqlite_stmt, index, b, b.Length - 1, (IntPtr)(-1));
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }




    internal override void Bind_DateTime(SQLiteStatement stmt, int index, DateTime dt)

    {



      byte[] b = ToUTF8(dt);






      int n = UnsafeNativeMethods.sqlite3_bind_text(stmt._sqlite_stmt, index, b, b.Length - 1, (IntPtr)(-1));
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }




    internal override void Bind_Blob(SQLiteStatement stmt, int index, byte[] blobData)

    {




























      int n = UnsafeNativeMethods.sqlite3_bind_blob(stmt._sqlite_stmt, index, blobData, blobData.Length, (IntPtr)(-1));
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());








    }



    internal override void Bind_Null(SQLiteStatement stmt, int index)

    {




      int n = UnsafeNativeMethods.sqlite3_bind_null(stmt._sqlite_stmt, index);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());








    }































































    internal override int Bind_ParamCount(SQLiteStatement stmt)
    {

      return UnsafeNativeMethods.sqlite3_bind_parameter_count(stmt._sqlite_stmt);
    }


    internal override string Bind_ParamName(SQLiteStatement stmt, int index)

    {














#if !SQLITE_STANDARD
      int len;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_bind_parameter_name_interop(stmt._sqlite_stmt, index, out len), len);
#else
      return UTF8ToString(UnsafeNativeMethods.sqlite3_bind_parameter_name(stmt._sqlite_stmt, index), -1);
#endif
    }













    internal override int Bind_ParamIndex(SQLiteStatement stmt, string paramName)
    {

      return UnsafeNativeMethods.sqlite3_bind_parameter_index(stmt._sqlite_stmt, ToUTF8(paramName));












    }

    internal override int ColumnCount(SQLiteStatement stmt)
    {
      return UnsafeNativeMethods.sqlite3_column_count(stmt._sqlite_stmt);
    }

    internal override string ColumnName(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_name_interop(stmt._sqlite_stmt, index, out len), len);
#else
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_name(stmt._sqlite_stmt, index), -1);







#endif
    }

    internal override TypeAffinity ColumnAffinity(SQLiteStatement stmt, int index)
    {
      return UnsafeNativeMethods.sqlite3_column_type(stmt._sqlite_stmt, index);
    }

    internal override string ColumnType(SQLiteStatement stmt, int index, out TypeAffinity nAffinity)
    {
      int len;
#if !SQLITE_STANDARD

      IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype_interop(stmt._sqlite_stmt, index, out len);
#else
      len = -1;
      IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype(stmt._sqlite_stmt, index);
#endif
      nAffinity = ColumnAffinity(stmt, index);



      if (p != IntPtr.Zero) return UTF8ToString(p, len);
      else



      {
        string[] ar = stmt.TypeDefinitions;

        if (ar != null)
        {
          if (index < ar.Length && ar[index] != null)
            return ar[index];
        }
        return String.Empty;

        //switch (nAffinity)
        //{
        //  case TypeAffinity.Int64:
        //    return "BIGINT";
        //  case TypeAffinity.Double:
        //    return "DOUBLE";
        //  case TypeAffinity.Blob:
        //    return "BLOB";
        //  default:
        //    return "TEXT";
        //}
      }
    }

    internal override int ColumnIndex(SQLiteStatement stmt, string columnName)
    {
      int x = ColumnCount(stmt);

      for (int n = 0; n < x; n++)
      {
        if (String.Compare(columnName, ColumnName(stmt, n), StringComparison.OrdinalIgnoreCase) == 0)
          return n;
      }
      return -1;
    }

    internal override string ColumnOriginalName(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_origin_name_interop(stmt._sqlite_stmt, index, out len), len);
#else
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_origin_name(stmt._sqlite_stmt, index), -1);
#endif
    }

    internal override string ColumnDatabaseName(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_database_name_interop(stmt._sqlite_stmt, index, out len), len);
#else
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_database_name(stmt._sqlite_stmt, index), -1);
#endif
    }

    internal override string ColumnTableName(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_table_name_interop(stmt._sqlite_stmt, index, out len), len);
#else
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_table_name(stmt._sqlite_stmt, index), -1);
#endif
    }











    internal override void ColumnMetaData(string dataBase, string table, string column, out string dataType, out string collateSequence, out bool notNull, out bool primaryKey, out bool autoIncrement)





    {


      IntPtr dataTypePtr;
      IntPtr collSeqPtr;
      int nnotNull;
      int nprimaryKey;
      int nautoInc;
      int n;
      int dtLen;
      int csLen;

#if !SQLITE_STANDARD


      n = UnsafeNativeMethods.sqlite3_table_column_metadata_interop(_sql, ToUTF8(dataBase), ToUTF8(table), ToUTF8(column), out dataTypePtr, out collSeqPtr, out nnotNull, out nprimaryKey, out nautoInc, out dtLen, out csLen);
#else
      dtLen = -1;
      csLen = -1;

      n = UnsafeNativeMethods.sqlite3_table_column_metadata(_sql, ToUTF8(dataBase), ToUTF8(table), ToUTF8(column), out dataTypePtr, out collSeqPtr, out nnotNull, out nprimaryKey, out nautoInc);
#endif
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());

      dataType = UTF8ToString(dataTypePtr, dtLen);
      collateSequence = UTF8ToString(collSeqPtr, csLen);

      notNull = (nnotNull == 1);
      primaryKey = (nprimaryKey == 1);
      autoIncrement = (nautoInc == 1);
    }










































    internal override double GetDouble(SQLiteStatement stmt, int index)
    {
      double value;
#if !PLATFORM_COMPACTFRAMEWORK
      value = UnsafeNativeMethods.sqlite3_column_double(stmt._sqlite_stmt, index);
#else

      UnsafeNativeMethods.sqlite3_column_double_interop(stmt._sqlite_stmt, index, out value);



#endif

      return value;























    }

    internal override int GetInt32(SQLiteStatement stmt, int index)
    {
      return UnsafeNativeMethods.sqlite3_column_int(stmt._sqlite_stmt, index);
    }






    internal override long GetInt64(SQLiteStatement stmt, int index)
    {
      long value;
#if !PLATFORM_COMPACTFRAMEWORK
      value = UnsafeNativeMethods.sqlite3_column_int64(stmt._sqlite_stmt, index);
#else

      UnsafeNativeMethods.sqlite3_column_int64_interop(stmt._sqlite_stmt, index, out value);



#endif

      return value;



    }

    internal override string GetText(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_text_interop(stmt._sqlite_stmt, index, out len), len);
#else
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_text(stmt._sqlite_stmt, index), -1);

#endif
    }

    internal override DateTime GetDateTime(SQLiteStatement stmt, int index)
    {







#if !SQLITE_STANDARD
      int len;
      return ToDateTime(UnsafeNativeMethods.sqlite3_column_text_interop(stmt._sqlite_stmt, index, out len), len);
#else
      return ToDateTime(UnsafeNativeMethods.sqlite3_column_text(stmt._sqlite_stmt, index), -1);

#endif
    }

    internal override long GetBytes(SQLiteStatement stmt, int index, int nDataOffset, byte[] bDest, int nStart, int nLength)
    {
      IntPtr ptr;
      int nlen;
      int nCopied = nLength;

      nlen = UnsafeNativeMethods.sqlite3_column_bytes(stmt._sqlite_stmt, index);
      ptr = UnsafeNativeMethods.sqlite3_column_blob(stmt._sqlite_stmt, index);


      if (bDest == null) return nlen;



      if (nCopied + nStart > bDest.Length) nCopied = bDest.Length - nStart;
      if (nCopied + nDataOffset > nlen) nCopied = nlen - nDataOffset;

      if (nCopied > 0)



        Marshal.Copy((IntPtr)(ptr.ToInt64() + nDataOffset), bDest, nStart, nCopied);



      else nCopied = 0;


      return nCopied;
    }






    internal override long GetChars(SQLiteStatement stmt, int index, int nDataOffset, char[] bDest, int nStart, int nLength)
    {
      int nlen;
      int nCopied = nLength;

      string str = GetText(stmt, index);



|






>
>
>
>
>
>
>

|
|
>
>


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




>
>

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


|

>
>
>
>

>

>

|


>



>
|
>
>
>
>
>
>

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

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

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



|
<
|

>
>


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


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


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






|


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









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




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







>
>
>

>



|

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

>
>
>
>
>
>
>
>
>

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

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




>
>
>
>
>
>
|
>


>
>
>
>
>
>
>
>
|

|

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

>


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

>






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



>
>
|
|




|

>
>
>
>


>
>

>
>


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

|

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






|
>
|
|
|








|



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


>
>
>
>
>
>
>




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

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







|


|
|




>
>
|
|
>




|

|


|
|

|


|

|


|

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



>
|
|
>
>
>





>
>



>


|

>
>
>
>
>
>
>
>
>

>
|

>
>
>
|
>
|


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

|







|



|




>
>
>

>



|
|

|










|


>
>
>
>
>
>










|

>
>
>
>
>







|



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




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



|
>
>
>
>
>
>









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

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

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


|

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

|
>
>
>
>

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

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


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


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

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

|
|

|

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

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










|
|

|
>
>
>
>
>
>
>








|

|

>
|

|
|

|

>
>
|
|
>
>
>
|

>


|
|

<

<
<
<
<
<
<
<
|
<
<
<
<

















|
|








|
|








|
|





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




>
>
|




|

|







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


<

|
|
>
|
>
>
>

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






>
>
>
>
>



<

|
|
>
|
>
>
>

>
|
>
>
>





|
|

|
>





>
>
>
>
>
>
>

|
|

|
>





<
<
<
<
|
<

>

>
>





>
>
>

>
>
>
|
>



>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356

357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220

2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328

2329







2330




2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465

2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513

2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560




2561

2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Collections.Generic;

#if !NET_COMPACT_20 && (TRACE_CONNECTION || TRACE_STATEMENT)
  using System.Diagnostics;
#endif

  using System.Globalization;
  using System.Runtime.InteropServices;
  using System.Text;
  using System.Threading;
  using DefinePair = System.Collections.Generic.KeyValuePair<string, int>;
  using DefineDictionary = System.Collections.Generic.Dictionary<string, int>;

  /// <summary>
  /// This is the method signature for the SQLite core library logging callback
  /// function for use with sqlite3_log() and the SQLITE_CONFIG_LOG.
  ///
  /// WARNING: This delegate is used more-or-less directly by native code, do
  ///          not modify its type signature.
  /// </summary>
  /// <param name="pUserData">
  /// The extra data associated with this message, if any.
  /// </param>
  /// <param name="errorCode">
  /// The error code associated with this message.
  /// </param>
  /// <param name="pMessage">
  /// The message string to be logged.
  /// </param>
#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  internal delegate void SQLiteLogCallback(IntPtr pUserData, int errorCode, IntPtr pMessage);

  /// <summary>
  /// This class implements SQLiteBase completely, and is the guts of the code that interop's SQLite with .NET
  /// </summary>
  internal class SQLite3 : SQLiteBase
  {
    private static object syncRoot = new object();

    /// <summary>
    /// This field is used to refer to memory allocated for the
    /// SQLITE_DBCONFIG_MAINDBNAME value used with the native
    /// "sqlite3_db_config" API.  If allocated, the associated
    /// memeory will be freed when the underlying connection is
    /// closed.
    /// </summary>
    private IntPtr dbName = IntPtr.Zero;

    //
    // NOTE: This is the public key for the System.Data.SQLite assembly.  If you change the
    //       SNK file, you will need to change this as well.
    //
    internal const string PublicKey =
        "002400000480000094000000060200000024000052534131000400000100010005a288de5687c4e1" +
        "b621ddff5d844727418956997f475eb829429e411aff3e93f97b70de698b972640925bdd44280df0" +
        "a25a843266973704137cbb0e7441c1fe7cae4e2440ae91ab8cde3933febcb1ac48dd33b40e13c421" +
        "d8215c18a4349a436dd499e3c385cc683015f886f6c10bd90115eb2bd61b67750839e3a19941dc9c";

#if !PLATFORM_COMPACTFRAMEWORK
    internal const string DesignerVersion = "1.0.119.0";
#endif

    /// <summary>
    /// The opaque pointer returned to us by the sqlite provider
    /// </summary>
    protected internal SQLiteConnectionHandle _sql;
    protected string _fileName;
    protected string _returnToFileName;
    protected int _maxPoolSize;
    protected SQLiteConnectionFlags _flags;
    private bool _setLogCallback;
    protected bool _usePool;
    private bool _returnToPool;
    protected int _poolVersion;
    private int _cancelCount;

#if (NET_35 || NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48) && !PLATFORM_COMPACTFRAMEWORK
    private bool _buildingSchema;
#endif

    /// <summary>
    /// The user-defined functions registered on this connection
    /// </summary>
    protected Dictionary<SQLiteFunctionAttribute, SQLiteFunction> _functions;

#if INTEROP_VIRTUAL_TABLE
    /// <summary>
    /// This is the name of the native library file that contains the
    /// "vtshim" extension [wrapper].
    /// </summary>
    protected string _shimExtensionFileName = null;

    /// <summary>
    /// This is the flag indicate whether the native library file that
    /// contains the "vtshim" extension must be dynamically loaded by
    /// this class prior to use.
    /// </summary>
    protected bool? _shimIsLoadNeeded = null;

    /// <summary>
    /// This is the name of the native entry point for the "vtshim"
    /// extension [wrapper].
    /// </summary>
    protected string _shimExtensionProcName = "sqlite3_vtshim_init";

    /// <summary>
    /// The modules created using this connection.
    /// </summary>
    protected Dictionary<string, SQLiteModule> _modules;
#endif

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region Query Diagnostics Support
    /// <summary>
    /// This field is used to keep track of whether or not the
    /// "SQLite_ForceLogPrepare" environment variable has been queried.  If so,
    /// it will only be non-zero if the environment variable was present.
    /// </summary>
    private bool _forceLogPrepare;

    /// <summary>
    /// This field is used to keep track of whether or not the
    /// "SQLite_ForceLogRetry" environment variable has been queried.  If so,
    /// it will only be non-zero if the environment variable was present.
    /// </summary>
    private bool _forceLogRetry;
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Constructs the object used to interact with the SQLite core library
    /// using the UTF-8 text encoding.
    /// </summary>
    /// <param name="fmt">
    /// The DateTime format to be used when converting string values to a
    /// DateTime and binding DateTime parameters.
    /// </param>
    /// <param name="kind">
    /// The <see cref="DateTimeKind" /> to be used when creating DateTime
    /// values.
    /// </param>
    /// <param name="fmtString">
    /// The format string to be used when parsing and formatting DateTime
    /// values.
    /// </param>
    /// <param name="db">
    /// The native handle to be associated with the database connection.
    /// </param>
    /// <param name="fileName">
    /// The fully qualified file name associated with <paramref name="db "/>.
    /// </param>
    /// <param name="ownHandle">
    /// Non-zero if the newly created object instance will need to dispose
    /// of <paramref name="db" /> when it is no longer needed.
    /// </param>
    internal SQLite3(
        SQLiteDateFormats fmt,
        DateTimeKind kind,
        string fmtString,
        IntPtr db,
        string fileName,
        bool ownHandle
        )
      : base(fmt, kind, fmtString)
    {
        InitializeForceLogPrepare();
        InitializeForceLogRetry();

        SQLiteConnectionPool.CreateAndInitialize(
            null, UnsafeNativeMethods.GetSettingValue(
            "SQLite_StrongConnectionPool", null) != null, false);

        if (db != IntPtr.Zero)
        {
            _sql = new SQLiteConnectionHandle(db, ownHandle);
            _fileName = fileName;
            _returnToFileName = fileName;

            SQLiteConnection.OnChanged(null, new ConnectionEventArgs(
                SQLiteConnectionEventType.NewCriticalHandle, null,
                null, null, null, _sql, fileName, new object[] {
                typeof(SQLite3), fmt, kind, fmtString, db, fileName,
                ownHandle }));
        }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region Query Diagnostics Support
    /// <summary>
    /// Determines if all calls to prepare a SQL query will be logged,
    /// regardless of the flags for the associated connection.
    /// </summary>
    private void InitializeForceLogPrepare()
    {
        if (UnsafeNativeMethods.GetSettingValue(
                "SQLite_ForceLogPrepare", null) != null)
        {
            _forceLogPrepare = true;
        }
        else
        {
            _forceLogPrepare = false;
        }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    internal override bool ForceLogPrepare
    {
        get { return _forceLogPrepare; }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Determines if all calls to retry a SQL query will be logged,
    /// regardless of the flags for the associated connection.
    /// </summary>
    private void InitializeForceLogRetry()
    {
        if (UnsafeNativeMethods.GetSettingValue(
                "SQLite_ForceLogRetry", null) != null)
        {
            _forceLogRetry = true;
        }
        else
        {
            _forceLogRetry = false;
        }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    internal override bool ForceLogRetry
    {
        get { return _forceLogRetry; }
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable "Pattern" Members
    private bool disposed;
    private void CheckDisposed() /* throw */
    {
#if THROW_ON_DISPOSED
        if (disposed)
            throw new ObjectDisposedException(typeof(SQLite3).Name);
#endif
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    protected override void Dispose(bool disposing)
    {
        try
        {
            if (!disposed)
            {
                //if (disposing)
                //{
                //    ////////////////////////////////////
                //    // dispose managed resources here...
                //    ////////////////////////////////////
                //}

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////

#if INTEROP_VIRTUAL_TABLE
                DisposeModules();
#endif

                /* Disposing, cannot throw. */
                Close(true);
            }
        }
        finally
        {
            base.Dispose(disposing);

            //
            // NOTE: Everything should be fully disposed at this point.
            //
            disposed = true;
        }
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

#if DEBUG
    public override string ToString()
    {
        CheckDisposed();

        return HelperMethods.StringFormat(
            CultureInfo.InvariantCulture,
            "fileName = {0}, returnToFileName = {1}, flags = {2}",
            _fileName, _returnToFileName, _flags);
    }
#endif

    ///////////////////////////////////////////////////////////////////////////////////////////////

#if INTEROP_VIRTUAL_TABLE
    /// <summary>
    /// This method attempts to dispose of all the <see cref="SQLiteModule" /> derived
    /// object instances currently associated with the native database connection.
    /// </summary>
    private void DisposeModules()
    {
        //
        // NOTE: If any modules were created, attempt to dispose of
        //       them now.  This code is designed to avoid throwing
        //       exceptions unless the Dispose method of the module
        //       itself throws an exception.
        //
        if (_modules != null)
        {
            foreach (KeyValuePair<string, SQLiteModule> pair in _modules)
            {
                SQLiteModule module = pair.Value;

                if (module == null)
                    continue;

                module.Dispose();
            }

            _modules.Clear();
        }
    }
#endif

    ///////////////////////////////////////////////////////////////////////////////////////////////

    // It isn't necessary to cleanup any functions we've registered.  If the connection
    // goes to the pool and is resurrected later, re-registered functions will overwrite the
    // previous functions.

    internal override bool Close(bool disposing)
    {
      BumpCloseCount();

      if (_sql != null)
      {
          if (!_sql.OwnHandle)
          {
              _sql = null;
              return wasDisposed;
          }

          bool unbindFunctions = HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UnbindFunctionsOnClose);

      retry:

          if (_returnToPool || _usePool)
          {
              if (SQLiteBase.ResetConnection(_sql, _sql, !disposing) &&
                  UnhookNativeCallbacks(true, true, !disposing))
              {
                  if (unbindFunctions)
                  {
                      if (SQLiteFunction.UnbindAllFunctions(this, _flags, false))
                      {
#if !NET_COMPACT_20 && TRACE_CONNECTION
                          Trace.WriteLine(HelperMethods.StringFormat(
                              CultureInfo.CurrentCulture,
                              "UnbindFunctions (Pool) Success: {0}",
                              HandleToString()));
#endif
                      }
                      else
                      {
#if !NET_COMPACT_20 && TRACE_CONNECTION
                          Trace.WriteLine(HelperMethods.StringFormat(
                              CultureInfo.CurrentCulture,
                              "UnbindFunctions (Pool) Failure: {0}",
                              HandleToString()));
#endif
                      }
                  }

#if INTEROP_VIRTUAL_TABLE
                  DisposeModules();
#endif

                  SQLiteConnectionPool.Add(_returnToFileName, _sql, _poolVersion);

                  SQLiteConnection.OnChanged(null, new ConnectionEventArgs(
                      SQLiteConnectionEventType.ClosedToPool, null, null,
                      null, null, _sql, _returnToFileName, new object[] {
                      typeof(SQLite3), !disposing, _returnToFileName, _poolVersion }));

#if !NET_COMPACT_20 && TRACE_CONNECTION
                  Trace.WriteLine(HelperMethods.StringFormat(
                      CultureInfo.CurrentCulture,
                      "Close (Pool) Success: {0}",
                      HandleToString()));
#endif
              }
              else
              {
#if !NET_COMPACT_20 && TRACE_CONNECTION
                  Trace.WriteLine(HelperMethods.StringFormat(
                      CultureInfo.CurrentCulture,
                      "Close (Pool) Failure: {0}",
                      HandleToString()));
#endif

                  //
                  // NOTE: This connection cannot be added to the pool;
                  //       therefore, just use the normal disposal
                  //       procedure on it.
                  //
                  _returnToFileName = _fileName;
                  _returnToPool = false;
                  _usePool = false;

                  goto retry;
              }
          }
          else
          {
              /* IGNORED */
              UnhookNativeCallbacks(false, disposing, !disposing);

              if (unbindFunctions)
              {
                  if (SQLiteFunction.UnbindAllFunctions(this, _flags, false))
                  {
#if !NET_COMPACT_20 && TRACE_CONNECTION
                      Trace.WriteLine(HelperMethods.StringFormat(
                          CultureInfo.CurrentCulture,
                          "UnbindFunctions Success: {0}",
                          HandleToString()));
#endif
                  }
                  else
                  {
#if !NET_COMPACT_20 && TRACE_CONNECTION
                      Trace.WriteLine(HelperMethods.StringFormat(
                          CultureInfo.CurrentCulture,
                          "UnbindFunctions Failure: {0}",
                          HandleToString()));
#endif
                  }
              }

              _sql.Dispose();
              wasDisposed = true;

              FreeDbName(!disposing);
          }
          _sql = null;
      }

      if (wasDisposed)
          GC.SuppressFinalize(this);

      return wasDisposed;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

#if !NET_COMPACT_20 && TRACE_CONNECTION
    protected string HandleToString()
    {
        if (_sql == null)
            return "<null>";

        return _sql.ToString();
    }
#endif

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Returns the number of times the <see cref="Cancel" /> method has been
    /// called.
    /// </summary>
    private int GetCancelCount()
    {
        return Interlocked.CompareExchange(ref _cancelCount, 0, 0);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// This method determines whether or not a <see cref="SQLiteException" />
    /// with a return code of <see cref="SQLiteErrorCode.Interrupt" /> should
    /// be thrown after making a call into the SQLite core library.
    /// </summary>
    /// <returns>
    /// Non-zero if a <see cref="SQLiteException" /> to be thrown.  This method
    /// will only return non-zero if the <see cref="Cancel" /> method was called
    /// one or more times during a call into the SQLite core library (e.g. when
    /// the sqlite3_prepare*() or sqlite3_step() APIs are used).
    /// </returns>
    private bool ShouldThrowForCancel()
    {
        return GetCancelCount() > 0;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Resets the value of the <see cref="_cancelCount" /> field.
    /// </summary>
    private int ResetCancelCount()
    {
        return Interlocked.CompareExchange(ref _cancelCount, 0, _cancelCount);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Attempts to interrupt the query currently executing on the associated
    /// native database connection.
    /// </summary>
    internal override void Cancel()
    {
      try
      {
        // do nothing.
      }
      finally /* NOTE: Thread.Abort() protection. */
      {
        Interlocked.Increment(ref _cancelCount);
        UnsafeNativeMethods.sqlite3_interrupt(_sql);
      }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Returns non-zero if the operation for the current connection has been
    /// interrupted.
    /// </summary>
    internal override bool IsCanceled()
    {
        return UnsafeNativeMethods.sqlite3_is_interrupted(_sql) != 0;
    }

    /// <summary>
    /// This function binds a user-defined function to the connection.
    /// </summary>
    /// <param name="functionAttribute">
    /// The <see cref="SQLiteFunctionAttribute"/> object instance containing
    /// the metadata for the function to be bound.
    /// </param>
    /// <param name="function">
    /// The <see cref="SQLiteFunction"/> object instance that implements the
    /// function to be bound.
    /// </param>
    /// <param name="flags">
    /// The flags associated with the parent connection object.
    /// </param>
    internal override void BindFunction(
        SQLiteFunctionAttribute functionAttribute,
        SQLiteFunction function,
        SQLiteConnectionFlags flags
        )
    {
        if (functionAttribute == null)
            throw new ArgumentNullException("functionAttribute");

        if (function == null)
            throw new ArgumentNullException("function");

        SQLiteFunction.BindFunction(this, functionAttribute, function, flags);

        if (_functions == null)
            _functions = new Dictionary<SQLiteFunctionAttribute, SQLiteFunction>();

        _functions[functionAttribute] = function;
    }

    /// <summary>
    /// This function binds a user-defined function to the connection.
    /// </summary>
    /// <param name="functionAttribute">
    /// The <see cref="SQLiteFunctionAttribute"/> object instance containing
    /// the metadata for the function to be unbound.
    /// </param>
    /// <param name="flags">
    /// The flags associated with the parent connection object.
    /// </param>
    /// <returns>Non-zero if the function was unbound and removed.</returns>
    internal override bool UnbindFunction(
        SQLiteFunctionAttribute functionAttribute,
        SQLiteConnectionFlags flags
        )
    {
        if (functionAttribute == null)
            throw new ArgumentNullException("functionAttribute");

        if (_functions == null)
            return false;

        SQLiteFunction function;

        if (_functions.TryGetValue(functionAttribute, out function))
        {
            if (SQLiteFunction.UnbindFunction(
                    this, functionAttribute, function, flags) &&
                _functions.Remove(functionAttribute))
            {
                return true;
            }
        }

        return false;
    }

    internal override string Version
    {
      get
      {
        return SQLiteVersion;
      }
    }

    internal override int VersionNumber
    {
      get
      {
        return SQLiteVersionNumber;
      }
    }

    internal static string ProviderDefineConstants
    {
      get
      {
        return SQLiteConvert.ToString(SQLiteDefineConstants.OptionList, true);
      }
    }

    internal static string DefineConstants
    {
        get
        {
            DefineDictionary dictionary = new DefineDictionary(
                StringComparer.OrdinalIgnoreCase);

            foreach (IList<string> list in new IList<string>[] {
                    SQLiteDefineConstants.OptionList,
                    InteropCompileOptionList })
            {
                if (list == null)
                    continue;

                foreach (string item in list)
                {
                    if (item == null)
                        continue;

                    string interopItem = null;
                    int count;

                    if (dictionary.TryGetValue(item, out count))
                    {
                        count++;
                    }
                    else if (!item.StartsWith("INTEROP_",
                            StringComparison.OrdinalIgnoreCase))
                    {
                        interopItem = String.Format(
                            "INTEROP_{0}", item);

                        if (dictionary.TryGetValue(
                                interopItem, out count))
                        {
                            count++;
                        }
                        else
                        {
                            count = 1;
                        }
                    }
                    else
                    {
                        count = 1;
                    }

                    dictionary[item] = count;

                    if (interopItem != null)
                        dictionary[interopItem] = count;
                }
            }

            IList<string> result = new List<string>();

            foreach (DefinePair pair in dictionary)
                if (pair.Value >= 2)
                    result.Add(pair.Key);

            return SQLiteConvert.ToString(result, true);
        }
    }

    internal static string SQLiteVersion
    {
      get
      {
        return UTF8ToString(UnsafeNativeMethods.sqlite3_libversion(), -1);
      }
    }

    internal static int SQLiteVersionNumber
    {
      get
      {
        return UnsafeNativeMethods.sqlite3_libversion_number();
      }
    }

    internal static string SQLiteSourceId
    {
      get
      {
        return UTF8ToString(UnsafeNativeMethods.sqlite3_sourceid(), -1);
      }
    }

    internal static IList<string> SQLiteCompileOptionList
    {
        get
        {
            IList<string> result = new List<string>();
            int index = 0;
            IntPtr zValue = UnsafeNativeMethods.sqlite3_compileoption_get(index++);

            while (zValue != IntPtr.Zero)
            {
                result.Add(UTF8ToString(zValue, -1));
                zValue = UnsafeNativeMethods.sqlite3_compileoption_get(index++);
            }

            return result;
        }
    }

    internal static string SQLiteCompileOptions
    {
      get
      {
        return SQLiteConvert.ToString(SQLiteCompileOptionList, true);
      }
    }

    internal static string InteropVersion
    {
        get
        {
#if !SQLITE_STANDARD
            return UTF8ToString(UnsafeNativeMethods.interop_libversion(), -1);
#else
            return null;
#endif
        }
    }

    internal static string InteropSourceId
    {
        get
        {
#if !SQLITE_STANDARD
            return UTF8ToString(UnsafeNativeMethods.interop_sourceid(), -1);
#else
            return null;
#endif
        }
    }

    internal static IList<string> InteropCompileOptionList
    {
        get
        {
#if !SQLITE_STANDARD
            IList<string> result = new List<string>();
            int index = 0;
            IntPtr zValue = UnsafeNativeMethods.interop_compileoption_get(index++);

            while (zValue != IntPtr.Zero)
            {
                result.Add(UTF8ToString(zValue, -1));
                zValue = UnsafeNativeMethods.interop_compileoption_get(index++);
            }

            return result;
#else
            return null;
#endif
        }
    }

    internal static string InteropCompileOptions
    {
      get
      {
        return SQLiteConvert.ToString(InteropCompileOptionList, true);
      }
    }

    internal override bool AutoCommit
    {
      get
      {
        return IsAutocommit(_sql, _sql);
      }
    }

    internal override bool IsReadOnly(
        string name
        )
    {
        IntPtr pDbName = IntPtr.Zero;

        try
        {
            if (name != null)
                pDbName = SQLiteString.Utf8IntPtrFromString(name);

            int result = UnsafeNativeMethods.sqlite3_db_readonly(
                _sql, pDbName);

            if (result == -1) /* database not found */
            {
                throw new SQLiteException(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "database \"{0}\" not found", name));
            }

            return result == 0 ? false : true;
        }
        finally
        {
            if (pDbName != IntPtr.Zero)
            {
                SQLiteMemory.Free(pDbName);
                pDbName = IntPtr.Zero;
            }
        }
    }

    internal override long LastInsertRowId
    {
      get
      {
#if !PLATFORM_COMPACTFRAMEWORK
        return UnsafeNativeMethods.sqlite3_last_insert_rowid(_sql);
#elif !SQLITE_STANDARD
        long rowId = 0;
        UnsafeNativeMethods.sqlite3_last_insert_rowid_interop(_sql, ref rowId);
        return rowId;
#else
        throw new NotImplementedException();
#endif
      }
    }

    internal override int Changes
    {
      get
      {
#if !SQLITE_STANDARD
        return UnsafeNativeMethods.sqlite3_changes_interop(_sql);
#else
        return UnsafeNativeMethods.sqlite3_changes(_sql);
#endif
      }
    }

    internal override long MemoryUsed
    {
        get
        {
            return StaticMemoryUsed;
        }
    }

    internal static long StaticMemoryUsed
    {
        get
        {
#if !PLATFORM_COMPACTFRAMEWORK
            return UnsafeNativeMethods.sqlite3_memory_used();
#elif !SQLITE_STANDARD
            long bytes = 0;
            UnsafeNativeMethods.sqlite3_memory_used_interop(ref bytes);
            return bytes;
#else
            throw new NotImplementedException();
#endif
        }
    }

    internal override long MemoryHighwater
    {
        get
        {
            return StaticMemoryHighwater;
        }
    }

    internal static long StaticMemoryHighwater
    {
        get
        {
#if !PLATFORM_COMPACTFRAMEWORK
            return UnsafeNativeMethods.sqlite3_memory_highwater(0);
#elif !SQLITE_STANDARD
            long bytes = 0;
            UnsafeNativeMethods.sqlite3_memory_highwater_interop(0, ref bytes);
            return bytes;
#else
            throw new NotImplementedException();
#endif
        }
    }

    /// <summary>
    /// Returns non-zero if the underlying native connection handle is owned
    /// by this instance.
    /// </summary>
    internal override bool OwnHandle
    {
        get
        {
            if (_sql == null)
                throw new SQLiteException("no connection handle available");

            return _sql.OwnHandle;
        }
    }

    /// <summary>
    /// Returns the logical list of functions associated with this connection.
    /// </summary>
    internal override IDictionary<SQLiteFunctionAttribute, SQLiteFunction> Functions
    {
        get { return _functions; }
    }

    internal override SQLiteErrorCode SetMemoryStatus(bool value)
    {
        return StaticSetMemoryStatus(value);
    }

    internal static SQLiteErrorCode StaticSetMemoryStatus(bool value)
    {
        SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_config_int(
            SQLiteConfigOpsEnum.SQLITE_CONFIG_MEMSTATUS, value ? 1 : 0);

        return rc;
    }

    /// <summary>
    /// Attempts to free as much heap memory as possible for the database connection.
    /// </summary>
    /// <returns>A standard SQLite return code (i.e. zero for success and non-zero for failure).</returns>
    internal override SQLiteErrorCode ReleaseMemory()
    {
        SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_db_release_memory(_sql);
        return rc;
    }

    /// <summary>
    /// Attempts to free N bytes of heap memory by deallocating non-essential memory
    /// allocations held by the database library. Memory used to cache database pages
    /// to improve performance is an example of non-essential memory.  This is a no-op
    /// returning zero if the SQLite core library was not compiled with the compile-time
    /// option SQLITE_ENABLE_MEMORY_MANAGEMENT.  Optionally, attempts to reset and/or
    /// compact the Win32 native heap, if applicable.
    /// </summary>
    /// <param name="nBytes">
    /// The requested number of bytes to free.
    /// </param>
    /// <param name="reset">
    /// Non-zero to attempt a heap reset.
    /// </param>
    /// <param name="compact">
    /// Non-zero to attempt heap compaction.
    /// </param>
    /// <param name="nFree">
    /// The number of bytes actually freed.  This value may be zero.
    /// </param>
    /// <param name="resetOk">
    /// This value will be non-zero if the heap reset was successful.
    /// </param>
    /// <param name="nLargest">
    /// The size of the largest committed free block in the heap, in bytes.
    /// This value will be zero unless heap compaction is enabled.
    /// </param>
    /// <returns>
    /// A standard SQLite return code (i.e. zero for success and non-zero
    /// for failure).
    /// </returns>
    internal static SQLiteErrorCode StaticReleaseMemory(
        int nBytes,
        bool reset,
        bool compact,
        ref int nFree,
        ref bool resetOk,
        ref uint nLargest
        )
    {
        SQLiteErrorCode rc = SQLiteErrorCode.Ok;

        int nFreeLocal = UnsafeNativeMethods.sqlite3_release_memory(nBytes);
        uint nLargestLocal = 0;
        bool resetOkLocal = false;

#if !DEBUG && WINDOWS // NOTE: Should be "WIN32HEAP && !MEMDEBUG && WINDOWS"
        if (HelperMethods.IsWindows())
        {
            if ((rc == SQLiteErrorCode.Ok) && reset)
            {
                rc = UnsafeNativeMethods.sqlite3_win32_reset_heap();

                if (rc == SQLiteErrorCode.Ok)
                    resetOkLocal = true;
            }

            if ((rc == SQLiteErrorCode.Ok) && compact)
                rc = UnsafeNativeMethods.sqlite3_win32_compact_heap(ref nLargestLocal);
        }
        else
#endif
        if (reset || compact)
        {
            rc = SQLiteErrorCode.NotFound;
        }

        nFree = nFreeLocal;
        nLargest = nLargestLocal;
        resetOk = resetOkLocal;

        return rc;
    }

    /// <summary>
    /// Shutdown the SQLite engine so that it can be restarted with different
    /// configuration options.  We depend on auto initialization to recover.
    /// </summary>
    /// <returns>Returns a standard SQLite result code.</returns>
    internal override SQLiteErrorCode Shutdown()
    {
        return StaticShutdown(false);
    }

    /// <summary>
    /// Shutdown the SQLite engine so that it can be restarted with different
    /// configuration options.  We depend on auto initialization to recover.
    /// </summary>
    /// <param name="directories">
    /// Non-zero to reset the database and temporary directories to their
    /// default values, which should be null for both.  This parameter has no
    /// effect on non-Windows operating systems.
    /// </param>
    /// <returns>Returns a standard SQLite result code.</returns>
    internal static SQLiteErrorCode StaticShutdown(
        bool directories
        )
    {
        SQLiteErrorCode rc = SQLiteErrorCode.Ok;

        if (directories)
        {
#if WINDOWS
            if (HelperMethods.IsWindows())
            {
                if (rc == SQLiteErrorCode.Ok)
                    rc = UnsafeNativeMethods.sqlite3_win32_set_directory(1, null);

                if (rc == SQLiteErrorCode.Ok)
                    rc = UnsafeNativeMethods.sqlite3_win32_set_directory(2, null);
            }
            else
#endif
            {
#if !NET_COMPACT_20 && TRACE_CONNECTION
                Trace.WriteLine(
                    "Shutdown: Cannot reset directories on this platform.");
#endif
            }
        }

        if (rc == SQLiteErrorCode.Ok)
            rc = UnsafeNativeMethods.sqlite3_shutdown();

        return rc;
    }

    /// <summary>
    /// Determines if the associated native connection handle is open.
    /// </summary>
    /// <returns>
    /// Non-zero if the associated native connection handle is open.
    /// </returns>
    internal override bool IsOpen()
    {
        return (_sql != null) && !_sql.IsInvalid && !_sql.IsClosed;
    }

    /// <summary>
    /// Returns the fully qualified path and file name for the currently open
    /// database, if any.
    /// </summary>
    /// <param name="dbName">
    /// The name of the attached database to query.
    /// </param>
    /// <returns>
    /// The fully qualified path and file name for the currently open database,
    /// if any.
    /// </returns>
    internal override string GetFileName(string dbName)
    {
        if (_sql == null)
            return null;

        return UTF8ToString(UnsafeNativeMethods.sqlite3_db_filename_bytes(
            _sql, ToUTF8(dbName)), -1);
    }

    /// <summary>
    /// This method attempts to determine if a database connection opened
    /// with the specified <see cref="SQLiteOpenFlagsEnum" /> should be
    /// allowed into the connection pool.
    /// </summary>
    /// <param name="openFlags">
    /// The <see cref="SQLiteOpenFlagsEnum" /> that were specified when the
    /// connection was opened.
    /// </param>
    /// <returns>
    /// Non-zero if the connection should (eventually) be allowed into the
    /// connection pool; otherwise, zero.
    /// </returns>
    protected static bool IsAllowedToUsePool(
        SQLiteOpenFlagsEnum openFlags
        )
    {
        return openFlags == SQLiteOpenFlagsEnum.Default;
    }

    internal override void Open(string strFilename, string vfsName, SQLiteConnectionFlags connectionFlags, SQLiteOpenFlagsEnum openFlags, int maxPoolSize, bool usePool)
    {
      BumpOpenCount();

      //
      // NOTE: If the database connection is currently open, attempt to
      //       close it now.  This must be done because the file name or
      //       other parameters that may impact the underlying database
      //       connection may have changed.
      //
      if (_sql != null) Close(false);

      //
      // NOTE: If the connection was not closed successfully, throw an
      //       exception now.
      //
      if (_sql != null)
          throw new SQLiteException("connection handle is still active");

      _maxPoolSize = maxPoolSize;
      _returnToPool = false;
      _usePool = usePool;

      //
      // BUGFIX: Do not allow a connection into the pool if it was opened
      //         with flags that are incompatible with the default flags
      //         (e.g. read-only).
      //
      if (_usePool && !IsAllowedToUsePool(openFlags))
          _usePool = false;

      _fileName = strFilename;
      _returnToFileName = strFilename;
      _flags = connectionFlags;

      if (usePool)
      {
        _sql = SQLiteConnectionPool.Remove(strFilename, maxPoolSize, out _poolVersion);

        SQLiteConnection.OnChanged(null, new ConnectionEventArgs(
            SQLiteConnectionEventType.OpenedFromPool, null, null,
            null, null, _sql, strFilename, new object[] {
            typeof(SQLite3), strFilename, vfsName, connectionFlags,
            openFlags, maxPoolSize, usePool, _poolVersion }));

#if !NET_COMPACT_20 && TRACE_CONNECTION
        Trace.WriteLine(HelperMethods.StringFormat(
            CultureInfo.CurrentCulture,
            "Open (Pool): {0}", HandleToString()));
#endif
      }

      if (_sql == null)
      {
        try
        {
            // do nothing.
        }
        finally /* NOTE: Thread.Abort() protection. */
        {
          IntPtr db = IntPtr.Zero;
          SQLiteErrorCode n;

#if !SQLITE_STANDARD
          int extFuncs = 0;

          if (!HelperMethods.HasFlags(connectionFlags, SQLiteConnectionFlags.NoExtensionFunctions))
              extFuncs |= 1;

          if (HelperMethods.HasFlags(connectionFlags, SQLiteConnectionFlags.NoCoreFunctions))
              extFuncs |= 2;

          n = UnsafeNativeMethods.sqlite3_open_interop(ToUTF8(strFilename), ToUTF8(vfsName), openFlags, extFuncs, ref db);
#else
          n = UnsafeNativeMethods.sqlite3_open_v2(ToUTF8(strFilename), ref db, openFlags, ToUTF8(vfsName));
#endif

#if !NET_COMPACT_20 && TRACE_CONNECTION
          Trace.WriteLine(HelperMethods.StringFormat(
              CultureInfo.CurrentCulture,
              "Open: {0}", db));
#endif

          if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, null);
          _sql = new SQLiteConnectionHandle(db, true);
          BumpCreateCount();
        }
        lock (_sql) { /* HACK: Force the SyncBlock to be "created" now. */ }

        SQLiteConnection.OnChanged(null, new ConnectionEventArgs(
            SQLiteConnectionEventType.NewCriticalHandle, null,
            null, null, null, _sql, strFilename, new object[] {
            typeof(SQLite3), strFilename, vfsName, connectionFlags,
            openFlags, maxPoolSize, usePool }));
      }

      // Bind functions to this connection.  If any previous functions of the same name
      // were already bound, then the new bindings replace the old.
      if (!HelperMethods.HasFlags(connectionFlags, SQLiteConnectionFlags.NoBindFunctions))
      {
          if (_functions == null)
              _functions = new Dictionary<SQLiteFunctionAttribute, SQLiteFunction>();

          foreach (KeyValuePair<SQLiteFunctionAttribute, SQLiteFunction> pair
                  in SQLiteFunction.BindFunctions(this, connectionFlags))
          {
              _functions[pair.Key] = pair.Value;
          }
      }

      SetTimeout(0);
      GC.KeepAlive(_sql);
    }

    internal override void ClearPool()
    {
      SQLiteConnectionPool.ClearPool(_fileName);
    }

    internal override int CountPool()
    {
        Dictionary<string, int> counts = null;
        int openCount = 0;
        int closeCount = 0;
        int totalCount = 0;

        SQLiteConnectionPool.GetCounts(_fileName,
            ref counts, ref openCount, ref closeCount,
            ref totalCount);

        return totalCount;
    }

    internal override void SetTimeout(int nTimeoutMS)
    {
      IntPtr db = _sql;
      if (db == IntPtr.Zero) throw new SQLiteException("no connection handle available");
      SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_busy_timeout(db, nTimeoutMS);
      if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
    }

    internal override bool Step(SQLiteStatement stmt)
    {
      SQLiteErrorCode n;
      Random rnd = null;
      int schemaRetries = 0;
      int lockRetries = 0;
      int sleeps = 0;
      int maximumRetries = SQLiteCommand.GetStepRetries(stmt._command);
      uint starttick = (uint)Environment.TickCount;
      uint timeout = (uint)(stmt._command._commandTimeout * 1000);
      int maximumSleepTime = stmt._command._maximumSleepTime;
      SQLiteConnectionFlags flags = SQLiteCommand.GetFlags(stmt._command);

      ResetCancelCount();

      while (true)
      {
        try
        {
            // do nothing.
        }
        finally /* NOTE: Thread.Abort() protection. */
        {
          n = UnsafeNativeMethods.sqlite3_step(stmt._sqlite_stmt);
        }

        if (ShouldThrowForCancel())
        {
            if ((n == SQLiteErrorCode.Ok) ||
                (n == SQLiteErrorCode.Row) ||
                (n == SQLiteErrorCode.Done))
            {
                n = SQLiteErrorCode.Interrupt;
            }

            throw new SQLiteException(n, null);
        }

        if (n == SQLiteErrorCode.Interrupt) return false;
        if (n == SQLiteErrorCode.Row) return true;
        if (n == SQLiteErrorCode.Done) return false;

        if (n != SQLiteErrorCode.Ok)
        {
          if (n == SQLiteErrorCode.Schema)
          {
            schemaRetries++;

            if ((maximumRetries >= 0) && (schemaRetries > maximumRetries))
              throw new SQLiteException(n, GetLastError());

            stmt._stepSchemaRetries++;
          }
          else if (n == SQLiteErrorCode.Locked || n == SQLiteErrorCode.Busy)
          {
            lockRetries++;

            if ((maximumRetries >= 0) && (lockRetries > maximumRetries))
              throw new SQLiteException(n, GetLastError());

            stmt._stepLockRetries++;
          }
          else
          {
            throw new SQLiteException(n, GetLastError());
          }

          SQLiteErrorCode r;

          // An error occurred, attempt to reset the statement.  If the reset worked because the
          // schema has changed, re-try the step again.  If it errored our because the database
          // is locked, then keep retrying until the command timeout occurs.
          r = Reset(stmt);

          if (r == SQLiteErrorCode.Ok)
          {
            throw new SQLiteException(n, GetLastError());
          }
          else if ((r == SQLiteErrorCode.Locked || r == SQLiteErrorCode.Busy) && stmt._command != null)
          {
            // Keep trying
            if (rnd == null) // First time we've encountered the lock
              rnd = new Random();

            // If we've exceeded the command's timeout, give up and throw an error
            if ((uint)Environment.TickCount - starttick > timeout)
            {
              throw new SQLiteException(r, GetLastError());
            }
            else
            {
              int sleepMs = rnd.Next(1, maximumSleepTime);

              if (_forceLogRetry || HelperMethods.LogRetry(flags))
              {
                  string logSql = stmt._sqlStatement;

                  if ((logSql == null) || (logSql.Length == 0) || (logSql.Trim().Length == 0))
                      logSql = "<nothing>";

                  SQLiteLog.LogMessage(HelperMethods.StringFormat(
                      CultureInfo.CurrentCulture, "Will retry {0} ==> {1} step #{2}, #{3} after {4}ms ({5}): {{{6}}}",
                      n, r, schemaRetries, lockRetries, sleepMs, sleeps, logSql));
              }

              // Otherwise sleep for a random amount of time up to Xms
              System.Threading.Thread.Sleep(sleepMs);
              sleeps++;
            }
          }
          else
          {
            //
            // TODO: Can this actually be hit?
            //
            throw new SQLiteException(r, GetLastError());
          }
        }
      }
    }

    /// <summary>
    /// Has the sqlite3_errstr() core library API been checked for yet?
    /// If so, is it present?
    /// </summary>
    private static bool? have_errstr = null;

    /// <summary>
    /// Returns the error message for the specified SQLite return code using
    /// the sqlite3_errstr() function, falling back to the internal lookup
    /// table if necessary.
    ///
    /// WARNING: Do not remove this method, it is used via reflection.
    /// </summary>
    /// <param name="rc">The SQLite return code.</param>
    /// <returns>The error message or null if it cannot be found.</returns>
    internal static string GetErrorString(SQLiteErrorCode rc)
    {
        try
        {
            if (have_errstr == null)
            {
                int versionNumber = SQLiteVersionNumber;
                have_errstr = (versionNumber >= 3007015);
            }

            if ((bool)have_errstr)
            {
                IntPtr ptr = UnsafeNativeMethods.sqlite3_errstr(rc);

                if (ptr != IntPtr.Zero)
                {
#if !PLATFORM_COMPACTFRAMEWORK
                    return Marshal.PtrToStringAnsi(ptr);
#else
                    return UTF8ToString(ptr, -1);
#endif
                }
            }
        }
        catch (EntryPointNotFoundException)
        {
            // do nothing.
        }

        return FallbackGetErrorString(rc);
    }

    /// <summary>
    /// Has the sqlite3_stmt_readonly() core library API been checked for yet?
    /// If so, is it present?
    /// </summary>
    private static bool? have_stmt_readonly = null;

    /// <summary>
    /// Returns non-zero if the specified statement is read-only in nature.
    /// </summary>
    /// <param name="stmt">The statement to check.</param>
    /// <returns>True if the outer query is read-only.</returns>
    internal override bool IsReadOnly(
        SQLiteStatement stmt
        )
    {
        try
        {
            if (have_stmt_readonly == null)
            {
                int versionNumber = SQLiteVersionNumber;
                have_stmt_readonly = (versionNumber >= 3007004);
            }

            if ((bool)have_stmt_readonly)
            {
                return UnsafeNativeMethods.sqlite3_stmt_readonly(
                    stmt._sqlite_stmt) != 0;
            }
        }
        catch (EntryPointNotFoundException)
        {
            // do nothing.
        }

        return false; /* NOTE: Unknown, assume false. */
    }

    internal override SQLiteErrorCode Reset(SQLiteStatement stmt)
    {
      SQLiteErrorCode n;

#if !SQLITE_STANDARD
      n = UnsafeNativeMethods.sqlite3_reset_interop(stmt._sqlite_stmt);
#else
      n = UnsafeNativeMethods.sqlite3_reset(stmt._sqlite_stmt);
#endif

      // If the schema changed, try and re-prepare it
      if (n == SQLiteErrorCode.Schema)
      {
        // Recreate a dummy statement
        string str = null;
        using (SQLiteStatement tmp = Prepare(null, stmt._command, stmt._sqlStatement, null, (uint)(stmt._command._commandTimeout * 1000), ref str))
        {
          // Finalize the existing statement
          stmt._sqlite_stmt.Dispose();
          // Reassign a new statement pointer to the old statement and clear the temporary one
          if (tmp != null)
          {
            stmt._sqlite_stmt = tmp._sqlite_stmt;
            tmp._sqlite_stmt = null;
          }

          // Reapply parameters
          stmt.BindParameters();
        }
        return SQLiteErrorCode.Unknown; // Reset was OK, with schema change
      }
      else if (n == SQLiteErrorCode.Locked || n == SQLiteErrorCode.Busy)
        return n;

      if (n != SQLiteErrorCode.Ok)
        throw new SQLiteException(n, GetLastError());

      return n; // We reset OK, no schema changes
    }

    internal override string GetLastError()
    {
        return GetLastError(null);
    }

    internal override string GetLastError(string defValue)
    {
        string result = SQLiteBase.GetLastError(_sql, _sql);
        if (String.IsNullOrEmpty(result)) result = defValue;
        return result;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region Lifecycle Diagnostics Support
    /// <summary>
    /// This field is used to keep track of whether or not the
    /// "SQLite_ForceLogLifecycle" environment variable has been queried.  If
    /// so, it will only be non-zero if the environment variable was present.
    /// </summary>
    private static bool? forceLogLifecycle = null;

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Determines if calls into key members pertaining to the lifecycle of
    /// connections and their associated classes will be logged, regardless
    /// of the flags for the associated connection.
    /// </summary>
    /// <returns>
    /// Non-zero to log calls into key members pertaining to the lifecycle of
    /// connections and their associated classes (e.g. LINQ, EF6, etc).
    /// </returns>
    internal static bool ForceLogLifecycle()
    {
        lock (syncRoot)
        {
            if (forceLogLifecycle == null)
            {
                if (UnsafeNativeMethods.GetSettingValue(
                        "SQLite_ForceLogLifecycle", null) != null)
                {
                    forceLogLifecycle = true;
                }
                else
                {
                    forceLogLifecycle = false;
                }
            }

            return (bool)forceLogLifecycle;
        }
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    internal override SQLiteStatement Prepare(SQLiteConnection cnn, SQLiteCommand command, string strSql, SQLiteStatement previous, uint timeoutMS, ref string strRemain)
    {
      if (!String.IsNullOrEmpty(strSql)) strSql = strSql.Trim();
      if (!String.IsNullOrEmpty(strSql))
      {
        //
        // NOTE: SQLite does not support the concept of separate schemas
        //       in one database; therefore, remove the base schema name
        //       used to smooth integration with the base .NET Framework
        //       data classes.
        //
        string baseSchemaName = (cnn != null) ? cnn._baseSchemaName : null;

        if (!String.IsNullOrEmpty(baseSchemaName))
        {
          strSql = strSql.Replace(
              HelperMethods.StringFormat(CultureInfo.InvariantCulture,
              "[{0}].", baseSchemaName), String.Empty);

          strSql = strSql.Replace(
              HelperMethods.StringFormat(CultureInfo.InvariantCulture,
              "{0}.", baseSchemaName), String.Empty);
        }
      }

      SQLiteConnectionFlags flags = SQLiteConnection.GetFlags(cnn);

      if (_forceLogPrepare || HelperMethods.LogPrepare(flags))
      {
          string logSql = strSql;

          if ((logSql == null) || (logSql.Length == 0) || (logSql.Trim().Length == 0))
              logSql = "<nothing>";

          SQLiteLog.LogMessage(HelperMethods.StringFormat(
              CultureInfo.CurrentCulture, "Preparing {{{0}}}...", logSql));
      }

      IntPtr stmt = IntPtr.Zero;
      IntPtr ptr = IntPtr.Zero;
      int len = 0;
      SQLiteErrorCode n = SQLiteErrorCode.Schema;
      int schemaRetries = 0;
      int lockRetries = 0;
      int sleeps = 0;
      int maximumRetries = SQLiteCommand.GetPrepareRetries(command);
      int maximumSleepTime = SQLiteCommand.GetMaximumSleepTime(command);
      byte[] b = ToUTF8(strSql);
      string typedefs = null;
      SQLiteStatement cmd = null;
      Random rnd = null;
      uint starttick = (uint)Environment.TickCount;

      ResetCancelCount();

      GCHandle handle = GCHandle.Alloc(b, GCHandleType.Pinned);
      IntPtr psql = handle.AddrOfPinnedObject();
      SQLiteStatementHandle statementHandle = null;
      try
      {
        while (n == SQLiteErrorCode.Schema || n == SQLiteErrorCode.Locked || n == SQLiteErrorCode.Busy)
        {
          try
          {
            // do nothing.
          }
          finally /* NOTE: Thread.Abort() protection. */
          {
            stmt = IntPtr.Zero;
            ptr = IntPtr.Zero;

#if !SQLITE_STANDARD
            len = 0;
            n = UnsafeNativeMethods.sqlite3_prepare_interop(_sql, psql, b.Length - 1, ref stmt, ref ptr, ref len);
#else
#if USE_PREPARE_V2
            n = UnsafeNativeMethods.sqlite3_prepare_v2(_sql, psql, b.Length - 1, ref stmt, ref ptr);
#else
            n = UnsafeNativeMethods.sqlite3_prepare(_sql, psql, b.Length - 1, ref stmt, ref ptr);
#endif
            len = -1;
#endif

#if !NET_COMPACT_20 && TRACE_STATEMENT
            Trace.WriteLine(HelperMethods.StringFormat(
                CultureInfo.CurrentCulture,
                "Prepare ({0}): {1}", n, stmt));
#endif

            if ((n == SQLiteErrorCode.Ok) && (stmt != IntPtr.Zero))
            {
              if (statementHandle != null) statementHandle.Dispose();
              statementHandle = new SQLiteStatementHandle(_sql, stmt);
            }
          }

          if (statementHandle != null)
          {
            SQLiteConnection.OnChanged(null, new ConnectionEventArgs(
              SQLiteConnectionEventType.NewCriticalHandle, null, null,
              null, null, statementHandle, strSql, new object[] {
              typeof(SQLite3), cnn, strSql, previous, timeoutMS }));
          }

          if (ShouldThrowForCancel())
          {
              if ((n == SQLiteErrorCode.Ok) ||
                  (n == SQLiteErrorCode.Row) ||
                  (n == SQLiteErrorCode.Done))
              {
                  n = SQLiteErrorCode.Interrupt;
              }

              throw new SQLiteException(n, null);
          }

          if (n == SQLiteErrorCode.Interrupt)
          {
            break;
          }
          else if (n == SQLiteErrorCode.Schema)
          {
            schemaRetries++;

            if ((maximumRetries >= 0) && (schemaRetries > maximumRetries))
              throw new SQLiteException(n, GetLastError());
          }
          else if (n == SQLiteErrorCode.Error)
          {
            if (String.Compare(GetLastError(), "near \"TYPES\": syntax error", StringComparison.OrdinalIgnoreCase) == 0)
            {
              int pos = strSql.IndexOf(';');
              if (pos == -1) pos = strSql.Length - 1;

              typedefs = strSql.Substring(0, pos + 1);
              strSql = strSql.Substring(pos + 1);

              strRemain = String.Empty;

              while (cmd == null && strSql.Length > 0)
              {
                cmd = Prepare(cnn, command, strSql, previous, timeoutMS, ref strRemain);
                strSql = strRemain;
              }

              if (cmd != null)
              {
                cmd._prepareSchemaRetries = schemaRetries;
                cmd._prepareLockRetries = lockRetries;
                cmd.SetTypes(typedefs);
              }

              return cmd;
            }
#if (NET_35 || NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48) && !PLATFORM_COMPACTFRAMEWORK
            else if (_buildingSchema == false && String.Compare(GetLastError(), 0, "no such table: TEMP.SCHEMA", 0, 26, StringComparison.OrdinalIgnoreCase) == 0)
            {
              strRemain = String.Empty;
              _buildingSchema = true;
              try
              {
                ISQLiteSchemaExtensions ext = ((IServiceProvider)SQLiteFactory.Instance).GetService(typeof(ISQLiteSchemaExtensions)) as ISQLiteSchemaExtensions;

                if (ext != null)
                  ext.BuildTempSchema(cnn);

                while (cmd == null && strSql.Length > 0)
                {
                  cmd = Prepare(cnn, command, strSql, previous, timeoutMS, ref strRemain);
                  strSql = strRemain;
                }

                if (cmd != null)
                {
                  cmd._prepareSchemaRetries = schemaRetries;
                  cmd._prepareLockRetries = lockRetries;
                }

                return cmd;
              }
              finally
              {
                _buildingSchema = false;
              }
            }
#endif
          }
          else if (n == SQLiteErrorCode.Locked || n == SQLiteErrorCode.Busy) // Locked -- delay a small amount before retrying
          {
            lockRetries++;

            if ((maximumRetries >= 0) && (lockRetries > maximumRetries))
              throw new SQLiteException(n, GetLastError());

            // Keep trying
            if (rnd == null) // First time we've encountered the lock
              rnd = new Random();

            // If we've exceeded the command's timeout, give up and throw an error
            if ((uint)Environment.TickCount - starttick > timeoutMS)
            {
              throw new SQLiteException(n, GetLastError());
            }
            else
            {
              int sleepMs = rnd.Next(1, maximumSleepTime);

              if (_forceLogRetry || HelperMethods.LogRetry(flags))
              {
                  string logSql = strSql;

                  if ((logSql == null) || (logSql.Length == 0) || (logSql.Trim().Length == 0))
                      logSql = "<nothing>";

                  SQLiteLog.LogMessage(HelperMethods.StringFormat(
                      CultureInfo.CurrentCulture, "Will retry {0} prepare #{1} after {2}ms ({3}): {{{4}}}",
                      n, lockRetries, sleepMs, sleeps, logSql));
              }

              // Otherwise sleep for a random amount of time up to Xms
              System.Threading.Thread.Sleep(sleepMs);
              sleeps++;
            }
          }
        }

        if (ShouldThrowForCancel())
        {
            if ((n == SQLiteErrorCode.Ok) ||
                (n == SQLiteErrorCode.Row) ||
                (n == SQLiteErrorCode.Done))
            {
                n = SQLiteErrorCode.Interrupt;
            }

            throw new SQLiteException(n, null);
        }

        if (n == SQLiteErrorCode.Interrupt) return null;
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());

        strRemain = UTF8ToString(ptr, len);

        if (statementHandle != null) cmd = new SQLiteStatement(this, flags, statementHandle, strSql.Substring(0, strSql.Length - strRemain.Length), previous);

        if (cmd != null)
        {
          cmd._prepareSchemaRetries = schemaRetries;
          cmd._prepareLockRetries = lockRetries;
        }

        return cmd;
      }
      finally
      {
        handle.Free();
      }
    }

    protected static void LogBind(SQLiteStatementHandle handle, int index)
    {
        IntPtr handleIntPtr = handle;

        SQLiteLog.LogMessage(HelperMethods.StringFormat(
            CultureInfo.CurrentCulture,
            "Binding statement {0} paramter #{1} as NULL...",
            handleIntPtr, index));
    }

    protected static void LogBind(SQLiteStatementHandle handle, int index, ValueType value)
    {
        IntPtr handleIntPtr = handle;

        SQLiteLog.LogMessage(HelperMethods.StringFormat(
            CultureInfo.CurrentCulture,
            "Binding statement {0} paramter #{1} as type {2} with value {{{3}}}...",
            handleIntPtr, index, value.GetType(), value));
    }

    private static string FormatDateTime(DateTime value)
    {
        StringBuilder result = new StringBuilder();

        result.Append(value.ToString("yyyy-MM-ddTHH:mm:ss.FFFFFFFK"));
        result.Append(' ');
        result.Append(value.Kind);
        result.Append(' ');
        result.Append(value.Ticks);

        return result.ToString();
    }

    protected static void LogBind(SQLiteStatementHandle handle, int index, DateTime value)
    {
        IntPtr handleIntPtr = handle;

        SQLiteLog.LogMessage(HelperMethods.StringFormat(
            CultureInfo.CurrentCulture,
            "Binding statement {0} paramter #{1} as type {2} with value {{{3}}}...",
            handleIntPtr, index, typeof(DateTime), FormatDateTime(value)));
    }

    protected static void LogBind(SQLiteStatementHandle handle, int index, string value)
    {
        IntPtr handleIntPtr = handle;

        SQLiteLog.LogMessage(HelperMethods.StringFormat(
            CultureInfo.CurrentCulture,
            "Binding statement {0} paramter #{1} as type {2} with value {{{3}}}...",
            handleIntPtr, index, typeof(String), (value != null) ? value : "<null>"));
    }

    private static string ToHexadecimalString(
        byte[] array
        )
    {
        if (array == null)
            return null;

        StringBuilder result = new StringBuilder(array.Length * 2);

        int length = array.Length;

        for (int index = 0; index < length; index++)
            result.Append(array[index].ToString("x2"));

        return result.ToString();
    }

    protected static void LogBind(SQLiteStatementHandle handle, int index, byte[] value)
    {
        IntPtr handleIntPtr = handle;

        SQLiteLog.LogMessage(HelperMethods.StringFormat(
            CultureInfo.CurrentCulture,
            "Binding statement {0} paramter #{1} as type {2} with value {{{3}}}...",
            handleIntPtr, index, typeof(Byte[]), (value != null) ? ToHexadecimalString(value) : "<null>"));
    }

    internal override void Bind_Double(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, double value)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

        if (_forceLogPrepare || HelperMethods.LogBind(flags))
        {
            LogBind(handle, index, value);
        }

#if !PLATFORM_COMPACTFRAMEWORK
        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_double(handle, index, value);
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
#elif !SQLITE_STANDARD
        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_double_interop(handle, index, ref value);
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
#else
        throw new NotImplementedException();
#endif
    }

    internal override void Bind_Int32(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, int value)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

        if (_forceLogPrepare || HelperMethods.LogBind(flags))
        {
            LogBind(handle, index, value);
        }

        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int(handle, index, value);
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
    }

    internal override void Bind_UInt32(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, uint value)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

        if (_forceLogPrepare || HelperMethods.LogBind(flags))
        {
            LogBind(handle, index, value);
        }

        SQLiteErrorCode n;

        if (HelperMethods.HasFlags(flags, SQLiteConnectionFlags.BindUInt32AsInt64))
        {
            long value2 = value;

#if !PLATFORM_COMPACTFRAMEWORK
            n = UnsafeNativeMethods.sqlite3_bind_int64(handle, index, value2);
#elif !SQLITE_STANDARD
            n = UnsafeNativeMethods.sqlite3_bind_int64_interop(handle, index, ref value2);
#else
            throw new NotImplementedException();
#endif
        }
        else
        {
            n = UnsafeNativeMethods.sqlite3_bind_uint(handle, index, value);
        }
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
    }

    internal override void Bind_Int64(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, long value)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

        if (_forceLogPrepare || HelperMethods.LogBind(flags))
        {
            LogBind(handle, index, value);
        }

#if !PLATFORM_COMPACTFRAMEWORK
        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64(handle, index, value);
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
#elif !SQLITE_STANDARD
        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64_interop(handle, index, ref value);
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
#else
        throw new NotImplementedException();
#endif
    }

    internal override void Bind_UInt64(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, ulong value)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

        if (_forceLogPrepare || HelperMethods.LogBind(flags))
        {
            LogBind(handle, index, value);
        }

#if !PLATFORM_COMPACTFRAMEWORK
        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_uint64(handle, index, value);
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
#elif !SQLITE_STANDARD
        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_uint64_interop(handle, index, ref value);
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
#else
        throw new NotImplementedException();
#endif
    }

    internal override void Bind_Boolean(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, bool value)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

        if (_forceLogPrepare || HelperMethods.LogBind(flags))
        {
            LogBind(handle, index, value);
        }

        int value2 = value ? 1 : 0;

        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int(handle, index, value2);
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
    }

    internal override void Bind_Text(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, string value)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

        if (_forceLogPrepare || HelperMethods.LogBind(flags))
        {
            LogBind(handle, index, value);
        }

        byte[] b = ToUTF8(value);

        if (_forceLogPrepare || HelperMethods.LogBind(flags))
        {
            LogBind(handle, index, b);
        }

        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_text(handle, index, b, b.Length - 1, (IntPtr)(-1));
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
    }

    internal override void Bind_DateTime(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, DateTime dt)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

        if (_forceLogPrepare || HelperMethods.LogBind(flags))
        {
            LogBind(handle, index, dt);
        }

        if (HelperMethods.HasFlags(flags, SQLiteConnectionFlags.BindDateTimeWithKind))
        {
            if ((_datetimeKind != DateTimeKind.Unspecified) &&
                (dt.Kind != DateTimeKind.Unspecified) &&
                (dt.Kind != _datetimeKind))
            {
                if (_datetimeKind == DateTimeKind.Utc)
                    dt = dt.ToUniversalTime();
                else if (_datetimeKind == DateTimeKind.Local)
                    dt = dt.ToLocalTime();
            }
        }

        switch (_datetimeFormat)
        {
            case SQLiteDateFormats.Ticks:
                {
                    long value = dt.Ticks;

                    if (_forceLogPrepare || HelperMethods.LogBind(flags))
                    {
                        LogBind(handle, index, value);
                    }

#if !PLATFORM_COMPACTFRAMEWORK
                    SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64(handle, index, value);
                    if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
                    break;
#elif !SQLITE_STANDARD
                    SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64_interop(handle, index, ref value);
                    if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
                    break;
#else
                    throw new NotImplementedException();
#endif
                }
            case SQLiteDateFormats.JulianDay:
                {
                    double value = ToJulianDay(dt);

                    if (_forceLogPrepare || HelperMethods.LogBind(flags))
                    {
                        LogBind(handle, index, value);
                    }

#if !PLATFORM_COMPACTFRAMEWORK
                    SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_double(handle, index, value);
                    if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
                    break;
#elif !SQLITE_STANDARD
                    SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_double_interop(handle, index, ref value);
                    if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
                    break;
#else
                    throw new NotImplementedException();
#endif
                }
            case SQLiteDateFormats.UnixEpoch:
                {
                    long value = dt.Subtract(UnixEpoch).Ticks / TimeSpan.TicksPerSecond;

                    if (_forceLogPrepare || HelperMethods.LogBind(flags))
                    {
                        LogBind(handle, index, value);
                    }

#if !PLATFORM_COMPACTFRAMEWORK
                    SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64(handle, index, value);
                    if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
                    break;
#elif !SQLITE_STANDARD
                    SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_int64_interop(handle, index, ref value);
                    if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
                    break;
#else
                    throw new NotImplementedException();
#endif
                }
            default:
                {
                    byte[] b = ToUTF8(dt);

                    if (_forceLogPrepare || HelperMethods.LogBind(flags))
                    {
                        LogBind(handle, index, b);
                    }

                    SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_text(handle, index, b, b.Length - 1, (IntPtr)(-1));
                    if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
                    break;
                }
        }
    }

    internal override void Bind_Blob(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, byte[] blobData)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

        if (_forceLogPrepare || HelperMethods.LogBind(flags))
        {
            LogBind(handle, index, blobData);
        }

        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_blob(handle, index, blobData, blobData.Length, (IntPtr)(-1));
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
    }

    internal override void Bind_Null(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

        if (_forceLogPrepare || HelperMethods.LogBind(flags))
        {
            LogBind(handle, index);
        }

        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_null(handle, index);
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
    }

    internal override int Bind_ParamCount(SQLiteStatement stmt, SQLiteConnectionFlags flags)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;
        int value = UnsafeNativeMethods.sqlite3_bind_parameter_count(handle);

        if (_forceLogPrepare || HelperMethods.LogBind(flags))
        {

            IntPtr handleIntPtr = handle;

            SQLiteLog.LogMessage(HelperMethods.StringFormat(
                CultureInfo.CurrentCulture,
                "Statement {0} paramter count is {1}.",
                handleIntPtr, value));
        }

        return value;
    }

    internal override string Bind_ParamName(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;
        string name;

#if !SQLITE_STANDARD
        int len = 0;
        name = UTF8ToString(UnsafeNativeMethods.sqlite3_bind_parameter_name_interop(handle, index, ref len), len);
#else
        name = UTF8ToString(UnsafeNativeMethods.sqlite3_bind_parameter_name(handle, index), -1);
#endif

        if (_forceLogPrepare || HelperMethods.LogBind(flags))
        {
            IntPtr handleIntPtr = handle;

            SQLiteLog.LogMessage(HelperMethods.StringFormat(
                CultureInfo.CurrentCulture,
                "Statement {0} paramter #{1} name is {{{2}}}.",
                handleIntPtr, index, name));
        }

        return name;
    }

    internal override int Bind_ParamIndex(SQLiteStatement stmt, SQLiteConnectionFlags flags, string paramName)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;
        int index = UnsafeNativeMethods.sqlite3_bind_parameter_index(handle, ToUTF8(paramName));

        if (_forceLogPrepare || HelperMethods.LogBind(flags))
        {
            IntPtr handleIntPtr = handle;

            SQLiteLog.LogMessage(HelperMethods.StringFormat(
                CultureInfo.CurrentCulture,
                "Statement {0} paramter index of name {{{1}}} is #{2}.",
                handleIntPtr, paramName, index));
        }

        return index;
    }

    internal override int ColumnCount(SQLiteStatement stmt)
    {
      return UnsafeNativeMethods.sqlite3_column_count(stmt._sqlite_stmt);
    }

    internal override string ColumnName(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len = 0;
      IntPtr p = UnsafeNativeMethods.sqlite3_column_name_interop(stmt._sqlite_stmt, index, ref len);
#else
      IntPtr p = UnsafeNativeMethods.sqlite3_column_name(stmt._sqlite_stmt, index);
#endif
      if (p == IntPtr.Zero)
        throw new SQLiteException(SQLiteErrorCode.NoMem, GetLastError());
#if !SQLITE_STANDARD
      return UTF8ToString(p, len);
#else
      return UTF8ToString(p, -1);
#endif
    }

    internal override TypeAffinity ColumnAffinity(SQLiteStatement stmt, int index)
    {
      return UnsafeNativeMethods.sqlite3_column_type(stmt._sqlite_stmt, index);
    }

    internal override string ColumnType(SQLiteStatement stmt, int index, ref TypeAffinity nAffinity)
    {
        int len;
#if !SQLITE_STANDARD
        len = 0;
        IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype_interop(stmt._sqlite_stmt, index, ref len);
#else
        len = -1;
        IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype(stmt._sqlite_stmt, index);
#endif
        nAffinity = ColumnAffinity(stmt, index);

        if ((p != IntPtr.Zero) && ((len > 0) || (len == -1)))
        {
            string declType = UTF8ToString(p, len);

            if (!String.IsNullOrEmpty(declType))
                return declType;
        }

        string[] ar = stmt.TypeDefinitions;

        if (ar != null)
        {
            if (index < ar.Length && ar[index] != null)
                return ar[index];
        }









        return String.Empty;




    }

    internal override int ColumnIndex(SQLiteStatement stmt, string columnName)
    {
      int x = ColumnCount(stmt);

      for (int n = 0; n < x; n++)
      {
        if (String.Compare(columnName, ColumnName(stmt, n), StringComparison.OrdinalIgnoreCase) == 0)
          return n;
      }
      return -1;
    }

    internal override string ColumnOriginalName(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len = 0;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_origin_name_interop(stmt._sqlite_stmt, index, ref len), len);
#else
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_origin_name(stmt._sqlite_stmt, index), -1);
#endif
    }

    internal override string ColumnDatabaseName(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len = 0;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_database_name_interop(stmt._sqlite_stmt, index, ref len), len);
#else
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_database_name(stmt._sqlite_stmt, index), -1);
#endif
    }

    internal override string ColumnTableName(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len = 0;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_table_name_interop(stmt._sqlite_stmt, index, ref len), len);
#else
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_table_name(stmt._sqlite_stmt, index), -1);
#endif
    }

    internal override bool DoesTableExist(
        string dataBase,
        string table
        )
    {
        string dataType = null; /* NOT USED */
        string collateSequence = null; /* NOT USED */
        bool notNull = false; /* NOT USED */
        bool primaryKey = false; /* NOT USED */
        bool autoIncrement = false; /* NOT USED */

        return ColumnMetaData(
            dataBase, table, null, false, ref dataType,
            ref collateSequence, ref notNull, ref primaryKey,
            ref autoIncrement);
    }

    internal override bool ColumnMetaData(string dataBase, string table, string column, bool canThrow, ref string dataType, ref string collateSequence, ref bool notNull, ref bool primaryKey, ref bool autoIncrement)
    {
      IntPtr dataTypePtr = IntPtr.Zero;
      IntPtr collSeqPtr = IntPtr.Zero;
      int nnotNull = 0;
      int nprimaryKey = 0;
      int nautoInc = 0;
      SQLiteErrorCode n;
      int dtLen;
      int csLen;

#if !SQLITE_STANDARD
      dtLen = 0;
      csLen = 0;
      n = UnsafeNativeMethods.sqlite3_table_column_metadata_interop(_sql, ToUTF8(dataBase), ToUTF8(table), ToUTF8(column), ref dataTypePtr, ref collSeqPtr, ref nnotNull, ref nprimaryKey, ref nautoInc, ref dtLen, ref csLen);
#else
      dtLen = -1;
      csLen = -1;

      n = UnsafeNativeMethods.sqlite3_table_column_metadata(_sql, ToUTF8(dataBase), ToUTF8(table), ToUTF8(column), ref dataTypePtr, ref collSeqPtr, ref nnotNull, ref nprimaryKey, ref nautoInc);
#endif
      if (canThrow && (n != SQLiteErrorCode.Ok)) throw new SQLiteException(n, GetLastError());

      dataType = UTF8ToString(dataTypePtr, dtLen);
      collateSequence = UTF8ToString(collSeqPtr, csLen);

      notNull = (nnotNull == 1);
      primaryKey = (nprimaryKey == 1);
      autoIncrement = (nautoInc == 1);

      return (n == SQLiteErrorCode.Ok);
    }

    internal override object GetObject(SQLiteStatement stmt, int index)
    {
        switch (ColumnAffinity(stmt, index))
        {
            case TypeAffinity.Int64:
                {
                    return GetInt64(stmt, index);
                }
            case TypeAffinity.Double:
                {
                    return GetDouble(stmt, index);
                }
            case TypeAffinity.Text:
                {
                    return GetText(stmt, index);
                }
            case TypeAffinity.Blob:
                {
                    long size = GetBytes(stmt, index, 0, null, 0, 0);

                    if ((size > 0) && (size <= int.MaxValue))
                    {
                        byte[] bytes = new byte[(int)size];

                        GetBytes(stmt, index, 0, bytes, 0, (int)size);

                        return bytes;
                    }
                    break;
                }
            case TypeAffinity.Null:
                {
                    return DBNull.Value;
                }
        }

        throw new NotImplementedException();
    }

    internal override double GetDouble(SQLiteStatement stmt, int index)
    {

#if !PLATFORM_COMPACTFRAMEWORK
      return UnsafeNativeMethods.sqlite3_column_double(stmt._sqlite_stmt, index);
#elif !SQLITE_STANDARD
      double value = 0.0;
      UnsafeNativeMethods.sqlite3_column_double_interop(stmt._sqlite_stmt, index, ref value);
      return value;
#else
      throw new NotImplementedException();
#endif
    }

    internal override bool GetBoolean(SQLiteStatement stmt, int index)
    {
      return ToBoolean(GetObject(stmt, index), CultureInfo.InvariantCulture, false);
    }

    internal override sbyte GetSByte(SQLiteStatement stmt, int index)
    {
      return unchecked((sbyte)(GetInt32(stmt, index) & byte.MaxValue));
    }

    internal override byte GetByte(SQLiteStatement stmt, int index)
    {
      return unchecked((byte)(GetInt32(stmt, index) & byte.MaxValue));
    }

    internal override short GetInt16(SQLiteStatement stmt, int index)
    {
      return unchecked((short)(GetInt32(stmt, index) & ushort.MaxValue));
    }

    internal override ushort GetUInt16(SQLiteStatement stmt, int index)
    {
      return unchecked((ushort)(GetInt32(stmt, index) & ushort.MaxValue));
    }

    internal override int GetInt32(SQLiteStatement stmt, int index)
    {
      return UnsafeNativeMethods.sqlite3_column_int(stmt._sqlite_stmt, index);
    }

    internal override uint GetUInt32(SQLiteStatement stmt, int index)
    {
      return unchecked((uint)GetInt32(stmt, index));
    }

    internal override long GetInt64(SQLiteStatement stmt, int index)
    {

#if !PLATFORM_COMPACTFRAMEWORK
      return UnsafeNativeMethods.sqlite3_column_int64(stmt._sqlite_stmt, index);
#elif !SQLITE_STANDARD
      long value = 0;
      UnsafeNativeMethods.sqlite3_column_int64_interop(stmt._sqlite_stmt, index, ref value);
      return value;
#else
      throw new NotImplementedException();
#endif
    }

    internal override ulong GetUInt64(SQLiteStatement stmt, int index)
    {
      return unchecked((ulong)GetInt64(stmt, index));
    }

    internal override string GetText(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len = 0;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_text_interop(stmt._sqlite_stmt, index, ref len), len);
#else
      return UTF8ToString(UnsafeNativeMethods.sqlite3_column_text(stmt._sqlite_stmt, index),
        UnsafeNativeMethods.sqlite3_column_bytes(stmt._sqlite_stmt, index));
#endif
    }

    internal override DateTime GetDateTime(SQLiteStatement stmt, int index)
    {
      if (_datetimeFormat == SQLiteDateFormats.Ticks)
        return TicksToDateTime(GetInt64(stmt, index), _datetimeKind);
      else if (_datetimeFormat == SQLiteDateFormats.JulianDay)
        return ToDateTime(GetDouble(stmt, index), _datetimeKind);
      else if (_datetimeFormat == SQLiteDateFormats.UnixEpoch)
        return UnixEpochToDateTime(GetInt64(stmt, index), _datetimeKind);

#if !SQLITE_STANDARD
      int len = 0;
      return ToDateTime(UnsafeNativeMethods.sqlite3_column_text_interop(stmt._sqlite_stmt, index, ref len), len);
#else
      return ToDateTime(UnsafeNativeMethods.sqlite3_column_text(stmt._sqlite_stmt, index),
        UnsafeNativeMethods.sqlite3_column_bytes(stmt._sqlite_stmt, index));
#endif
    }

    internal override long GetBytes(SQLiteStatement stmt, int index, int nDataOffset, byte[] bDest, int nStart, int nLength)
    {




      int nlen = UnsafeNativeMethods.sqlite3_column_bytes(stmt._sqlite_stmt, index);


      // If no destination buffer, return the size needed.
      if (bDest == null) return nlen;

      int nCopied = nLength;

      if (nCopied + nStart > bDest.Length) nCopied = bDest.Length - nStart;
      if (nCopied + nDataOffset > nlen) nCopied = nlen - nDataOffset;

      if (nCopied > 0)
      {
        IntPtr ptr = UnsafeNativeMethods.sqlite3_column_blob(stmt._sqlite_stmt, index);

        Marshal.Copy((IntPtr)(ptr.ToInt64() + nDataOffset), bDest, nStart, nCopied);
      }
      else
      {
        nCopied = 0;
      }

      return nCopied;
    }

    internal override char GetChar(SQLiteStatement stmt, int index)
    {
      return Convert.ToChar(GetUInt16(stmt, index));
    }

    internal override long GetChars(SQLiteStatement stmt, int index, int nDataOffset, char[] bDest, int nStart, int nLength)
    {
      int nlen;
      int nCopied = nLength;

      string str = GetText(stmt, index);
635
636
637
638
639
640
641
642
643

644


645


646










647
648
649
650
651
652

653

654
655
656
657



658
659
660

661
662
663
664
665
666
667
    }

    internal override int AggregateCount(IntPtr context)
    {
      return UnsafeNativeMethods.sqlite3_aggregate_count(context);
    }

    internal override void CreateFunction(string strFunction, int nArgs, bool needCollSeq, SQLiteCallback func, SQLiteCallback funcstep, SQLiteFinalCallback funcfinal)
    {

      int n;





#if !SQLITE_STANDARD










      n = UnsafeNativeMethods.sqlite3_create_function_interop(_sql, ToUTF8(strFunction), nArgs, 4, IntPtr.Zero, func, funcstep, funcfinal, (needCollSeq == true) ? 1 : 0);
      if (n == 0) n = UnsafeNativeMethods.sqlite3_create_function_interop(_sql, ToUTF8(strFunction), nArgs, 1, IntPtr.Zero, func, funcstep, funcfinal, (needCollSeq == true) ? 1 : 0);
#else
      n = UnsafeNativeMethods.sqlite3_create_function(_sql, ToUTF8(strFunction), nArgs, 4, IntPtr.Zero, func, funcstep, funcfinal);
      if (n == 0) n = UnsafeNativeMethods.sqlite3_create_function(_sql, ToUTF8(strFunction), nArgs, 1, IntPtr.Zero, func, funcstep, funcfinal);
#endif

      if (n > 0) throw new SQLiteException(n, SQLiteLastError());

    }

    internal override void CreateCollation(string strCollation, SQLiteCollation func, SQLiteCollation func16)
    {



      int n = UnsafeNativeMethods.sqlite3_create_collation(_sql, ToUTF8(strCollation), 2, IntPtr.Zero, func16);
      if (n == 0) n = UnsafeNativeMethods.sqlite3_create_collation(_sql, ToUTF8(strCollation), 1, IntPtr.Zero, func);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());

    }

    internal override int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, string s1, string s2)
    {
#if !SQLITE_STANDARD
      byte[] b1;
      byte[] b2;







|

>
|
>
>

>
>

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

|
|

>
|
>


|

>
>
>
|
|
|
>







2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
    }

    internal override int AggregateCount(IntPtr context)
    {
      return UnsafeNativeMethods.sqlite3_aggregate_count(context);
    }

    internal override SQLiteErrorCode CreateFunction(FunctionType type, string strFunction, int nArgs, SQLiteFunctionFlags flags, bool needCollSeq, SQLiteCallback func, SQLiteCallback funcstep, SQLiteFinalCallback funcfinal, SQLiteFinalCallback funcvalue, SQLiteCallback funcinverse, bool canThrow)
    {
      SQLiteErrorCode n;

      SQLiteFunctionFlags flags16 = SQLiteFunctionFlags.SQLITE_UTF16 | (flags & ~SQLiteFunctionFlags.ENCODING_MASK);
      SQLiteFunctionFlags flags8 = SQLiteFunctionFlags.SQLITE_UTF8 | (flags & ~SQLiteFunctionFlags.ENCODING_MASK);

      if (type == FunctionType.Window)
      {
#if !SQLITE_STANDARD
        n = UnsafeNativeMethods.sqlite3_create_window_function_interop(_sql, ToUTF8(strFunction), nArgs, flags16, IntPtr.Zero, funcstep, funcfinal, funcvalue, funcinverse, (needCollSeq == true) ? 1 : 0);
        if (n == SQLiteErrorCode.Ok) n = UnsafeNativeMethods.sqlite3_create_window_function_interop(_sql, ToUTF8(strFunction), nArgs, flags8, IntPtr.Zero, funcstep, funcfinal, funcvalue, funcinverse, (needCollSeq == true) ? 1 : 0);
#else
        n = UnsafeNativeMethods.sqlite3_create_window_function(_sql, ToUTF8(strFunction), nArgs, flags16, IntPtr.Zero, funcstep, funcfinal, funcvalue, funcinverse, null);
        if (n == SQLiteErrorCode.Ok) n = UnsafeNativeMethods.sqlite3_create_window_function(_sql, ToUTF8(strFunction), nArgs, flags8, IntPtr.Zero, funcstep, funcfinal, funcvalue, funcinverse, null);
#endif
      }
      else
      {
#if !SQLITE_STANDARD
        n = UnsafeNativeMethods.sqlite3_create_function_interop(_sql, ToUTF8(strFunction), nArgs, flags16, IntPtr.Zero, func, funcstep, funcfinal, (needCollSeq == true) ? 1 : 0);
        if (n == SQLiteErrorCode.Ok) n = UnsafeNativeMethods.sqlite3_create_function_interop(_sql, ToUTF8(strFunction), nArgs, flags8, IntPtr.Zero, func, funcstep, funcfinal, (needCollSeq == true) ? 1 : 0);
#else
        n = UnsafeNativeMethods.sqlite3_create_function(_sql, ToUTF8(strFunction), nArgs, flags16, IntPtr.Zero, func, funcstep, funcfinal);
        if (n == SQLiteErrorCode.Ok) n = UnsafeNativeMethods.sqlite3_create_function(_sql, ToUTF8(strFunction), nArgs, flags8, IntPtr.Zero, func, funcstep, funcfinal);
#endif
      }
      if (canThrow && (n != SQLiteErrorCode.Ok)) throw new SQLiteException(n, GetLastError());
      return n;
    }

    internal override SQLiteErrorCode CreateCollation(string strCollation, SQLiteCollation func, SQLiteCollation func16, bool canThrow)
    {
      SQLiteFunctionFlags flags16 = SQLiteFunctionFlags.SQLITE_UTF16LE;
      SQLiteFunctionFlags flags8 = SQLiteFunctionFlags.SQLITE_UTF8;

      SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_create_collation(_sql, ToUTF8(strCollation), flags16, IntPtr.Zero, func16);
      if (n == SQLiteErrorCode.Ok) n = UnsafeNativeMethods.sqlite3_create_collation(_sql, ToUTF8(strCollation), flags8, IntPtr.Zero, func);
      if (canThrow && (n != SQLiteErrorCode.Ok)) throw new SQLiteException(n, GetLastError());
      return n;
    }

    internal override int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, string s1, string s2)
    {
#if !SQLITE_STANDARD
      byte[] b1;
      byte[] b2;
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
          converter = System.Text.Encoding.BigEndianUnicode;
          break;
      }

      b1 = converter.GetBytes(s1);
      b2 = converter.GetBytes(s2);

      return UnsafeNativeMethods.sqlite3_context_collcompare(context, b1, b1.Length, b2, b2.Length);
#else
      throw new NotImplementedException();
#endif
    }

    internal override int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, char[] c1, char[] c2)
    {







|







2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
          converter = System.Text.Encoding.BigEndianUnicode;
          break;
      }

      b1 = converter.GetBytes(s1);
      b2 = converter.GetBytes(s2);

      return UnsafeNativeMethods.sqlite3_context_collcompare_interop(context, b1, b1.Length, b2, b2.Length);
#else
      throw new NotImplementedException();
#endif
    }

    internal override int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, char[] c1, char[] c2)
    {
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749

750


751
752
753
754
755



756



757

758
759
760
761
762
763
764
765
766
767

768
769
770



771
772
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
800
801
802




















803
804
805
806
807
808
809
810
811
812
813
814


815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873










874
875
876
877
878
879











































































































































































































































































































































































































































































































































































































































































































































































































































































































880
881
882
883

884
885
886
887
888
889
890

891
892
893
894
895
896
897



898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918


919
920
921









922


923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967



968


          converter = System.Text.Encoding.BigEndianUnicode;
          break;
      }

      b1 = converter.GetBytes(c1);
      b2 = converter.GetBytes(c2);

      return UnsafeNativeMethods.sqlite3_context_collcompare(context, b1, b1.Length, b2, b2.Length);
#else
      throw new NotImplementedException();
#endif
    }

    internal override CollationSequence GetCollationSequence(SQLiteFunction func, IntPtr context)
    {
#if !SQLITE_STANDARD
      CollationSequence seq = new CollationSequence();
      int len;
      int type;
      int enc;
      IntPtr p = UnsafeNativeMethods.sqlite3_context_collseq(context, out type, out enc, out len);

      if (p != null) seq.Name = UTF8ToString(p, len);
      seq.Type = (CollationTypeEnum)type;
      seq._func = func;
      seq.Encoding = (CollationEncodingEnum)enc;

      return seq;
#else
      throw new NotImplementedException();
#endif
    }

    internal override long GetParamValueBytes(IntPtr p, int nDataOffset, byte[] bDest, int nStart, int nLength)
    {
      IntPtr ptr;
      int nlen;
      int nCopied = nLength;

      nlen = UnsafeNativeMethods.sqlite3_value_bytes(p);
      ptr = UnsafeNativeMethods.sqlite3_value_blob(p);


      if (bDest == null) return nlen;



      if (nCopied + nStart > bDest.Length) nCopied = bDest.Length - nStart;
      if (nCopied + nDataOffset > nlen) nCopied = nlen - nDataOffset;

      if (nCopied > 0)



        Marshal.Copy((IntPtr)(ptr.ToInt32() + nDataOffset), bDest, nStart, nCopied);



      else nCopied = 0;


      return nCopied;
    }

    internal override double GetParamValueDouble(IntPtr ptr)
    {
      double value;
#if !PLATFORM_COMPACTFRAMEWORK
      value = UnsafeNativeMethods.sqlite3_value_double(ptr);
#else

      UnsafeNativeMethods.sqlite3_value_double_interop(ptr, out value);
#endif
      return value;



    }

    internal override int GetParamValueInt32(IntPtr ptr)
    {
      return UnsafeNativeMethods.sqlite3_value_int(ptr);
    }

    internal override long GetParamValueInt64(IntPtr ptr)
    {
      Int64 value;
#if !PLATFORM_COMPACTFRAMEWORK
      value = UnsafeNativeMethods.sqlite3_value_int64(ptr);
#else

      UnsafeNativeMethods.sqlite3_value_int64_interop(ptr, out value);
#endif
      return value;



    }

    internal override string GetParamValueText(IntPtr ptr)
    {
#if !SQLITE_STANDARD
      int len;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_value_text_interop(ptr, out len), len);
#else
      return UTF8ToString(UnsafeNativeMethods.sqlite3_value_text(ptr), -1);

#endif
    }

    internal override TypeAffinity GetParamValueType(IntPtr ptr)
    {
      return UnsafeNativeMethods.sqlite3_value_type(ptr);
    }





















    internal override void ReturnBlob(IntPtr context, byte[] value)
    {
      UnsafeNativeMethods.sqlite3_result_blob(context, value, value.Length, (IntPtr)(-1));
    }

    internal override void ReturnDouble(IntPtr context, double value)
    {
#if !PLATFORM_COMPACTFRAMEWORK
      UnsafeNativeMethods.sqlite3_result_double(context, value);
#else
      UnsafeNativeMethods.sqlite3_result_double_interop(context, ref value);


#endif
    }

    internal override void ReturnError(IntPtr context, string value)
    {
      UnsafeNativeMethods.sqlite3_result_error(context, ToUTF8(value), value.Length);
    }

    internal override void ReturnInt32(IntPtr context, int value)
    {
      UnsafeNativeMethods.sqlite3_result_int(context, value);
    }

    internal override void ReturnInt64(IntPtr context, long value)
    {
#if !PLATFORM_COMPACTFRAMEWORK
      UnsafeNativeMethods.sqlite3_result_int64(context, value);
#else
      UnsafeNativeMethods.sqlite3_result_int64_interop(context, ref value);


#endif
    }

    internal override void ReturnNull(IntPtr context)
    {
      UnsafeNativeMethods.sqlite3_result_null(context);
    }

    internal override void ReturnText(IntPtr context, string value)
    {
      byte[] b = ToUTF8(value);
      UnsafeNativeMethods.sqlite3_result_text(context, ToUTF8(value), b.Length - 1, (IntPtr)(-1));
    }


































































































































    internal override IntPtr AggregateContext(IntPtr context)
    {
      return UnsafeNativeMethods.sqlite3_aggregate_context(context, 1);
    }








































































































































































































































































































































































































































































































































































































































    internal override void SetPassword(byte[] passwordBytes)






















































    {
      int n = UnsafeNativeMethods.sqlite3_key(_sql, passwordBytes, passwordBytes.Length);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }

    internal override void ChangePassword(byte[] newPasswordBytes)
    {
      int n = UnsafeNativeMethods.sqlite3_rekey(_sql, newPasswordBytes, (newPasswordBytes == null) ? 0 : newPasswordBytes.Length);
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }

    internal override void SetUpdateHook(SQLiteUpdateCallback func)
    {
      UnsafeNativeMethods.sqlite3_update_hook(_sql, func, IntPtr.Zero);
    }

    internal override void SetCommitHook(SQLiteCommitCallback func)
    {
      UnsafeNativeMethods.sqlite3_commit_hook(_sql, func, IntPtr.Zero);
    }











    internal override void SetRollbackHook(SQLiteRollbackCallback func)
    {
      UnsafeNativeMethods.sqlite3_rollback_hook(_sql, func, IntPtr.Zero);
    }












































































































































































































































































































































































































































































































































































































































































































































































































































































































    /// <summary>
    /// Helper function to retrieve a column of data from an active statement.
    /// </summary>
    /// <param name="stmt">The statement being step()'d through</param>

    /// <param name="index">The column index to retrieve</param>
    /// <param name="typ">The type of data contained in the column.  If Uninitialized, this function will retrieve the datatype information.</param>
    /// <returns>Returns the data in the column</returns>
    internal override object GetValue(SQLiteStatement stmt, int index, SQLiteType typ)
    {
      if (IsNull(stmt, index)) return DBNull.Value;
      TypeAffinity aff = typ.Affinity;

      Type t = null;

      if (typ.Type != DbType.Object)
      {
        t = SQLiteConvert.SQLiteTypeToType(typ);
        aff = TypeToAffinity(t);
      }




      switch (aff)
      {
        case TypeAffinity.Blob:
          if (typ.Type == DbType.Guid && typ.Affinity == TypeAffinity.Text)
            return new Guid(GetText(stmt, index));

          int n = (int)GetBytes(stmt, index, 0, null, 0, 0);
          byte[] b = new byte[n];
          GetBytes(stmt, index, 0, b, 0, n);

          if (typ.Type == DbType.Guid && n == 16)
            return new Guid(b);

          return b;
        case TypeAffinity.DateTime:
          return GetDateTime(stmt, index);
        case TypeAffinity.Double:
          if (t == null) return GetDouble(stmt, index);
          else
            return Convert.ChangeType(GetDouble(stmt, index), t, null);


        case TypeAffinity.Int64:
          if (t == null) return GetInt64(stmt, index);
          else









            return Convert.ChangeType(GetInt64(stmt, index), t, null);


        default:
          return GetText(stmt, index);
      }
    }

    internal override int GetCursorForTable(SQLiteStatement stmt, int db, int rootPage)
    {
#if !SQLITE_STANDARD
      return UnsafeNativeMethods.sqlite3_table_cursor(stmt._sqlite_stmt, db, rootPage);
#else
      return -1;
#endif
    }

    internal override long GetRowIdForCursor(SQLiteStatement stmt, int cursor)
    {
#if !SQLITE_STANDARD
      long rowid;
      int rc = UnsafeNativeMethods.sqlite3_cursor_rowid(stmt._sqlite_stmt, cursor, out rowid);
      if (rc == 0) return rowid;

      return 0;
#else
      return 0;
#endif
    }

    internal override void GetIndexColumnExtendedInfo(string database, string index, string column, out int sortMode, out int onError, out string collationSequence)
    {
#if !SQLITE_STANDARD
      IntPtr coll;
      int colllen;
      int rc;

      rc = UnsafeNativeMethods.sqlite3_index_column_info_interop(_sql, ToUTF8(database), ToUTF8(index), ToUTF8(column), out sortMode, out onError, out coll, out colllen);
      if (rc != 0) throw new SQLiteException(rc, "");

      collationSequence = UTF8ToString(coll, colllen);
#else
      sortMode = 0;
      onError = 2;
      collationSequence = "BINARY";
#endif
    }
  }



}









|









|
|
|
|














<
<
<
<
|
<

>

>
>





>
>
>
|
>
>
>
|
>






<

|
|
>
|
<

>
>
>









<

|
|
>
|
<

>
>
>





|
|

|
>







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










|

>
>

















|

>
>













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






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

|
<


|

|
<











>
>
>
>
>
>
>
>
>
>






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




>



|

<

>





|

>
>
>



















<
|
>
>


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








|








|
|
|







|


|
|
|

|
|








|
>
>
>
|
>
>
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741




2742

2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767

2768
2769
2770
2771
2772

2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785

2786
2787
2788
2789
2790

2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686

3687
3688
3689
3690
3691

3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603

4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634

4635
4636
4637
4638
4639

4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
          converter = System.Text.Encoding.BigEndianUnicode;
          break;
      }

      b1 = converter.GetBytes(c1);
      b2 = converter.GetBytes(c2);

      return UnsafeNativeMethods.sqlite3_context_collcompare_interop(context, b1, b1.Length, b2, b2.Length);
#else
      throw new NotImplementedException();
#endif
    }

    internal override CollationSequence GetCollationSequence(SQLiteFunction func, IntPtr context)
    {
#if !SQLITE_STANDARD
      CollationSequence seq = new CollationSequence();
      int len = 0;
      int type = 0;
      int enc = 0;
      IntPtr p = UnsafeNativeMethods.sqlite3_context_collseq_interop(context, ref type, ref enc, ref len);

      if (p != null) seq.Name = UTF8ToString(p, len);
      seq.Type = (CollationTypeEnum)type;
      seq._func = func;
      seq.Encoding = (CollationEncodingEnum)enc;

      return seq;
#else
      throw new NotImplementedException();
#endif
    }

    internal override long GetParamValueBytes(IntPtr p, int nDataOffset, byte[] bDest, int nStart, int nLength)
    {




      int nlen = UnsafeNativeMethods.sqlite3_value_bytes(p);


      // If no destination buffer, return the size needed.
      if (bDest == null) return nlen;

      int nCopied = nLength;

      if (nCopied + nStart > bDest.Length) nCopied = bDest.Length - nStart;
      if (nCopied + nDataOffset > nlen) nCopied = nlen - nDataOffset;

      if (nCopied > 0)
      {
        IntPtr ptr = UnsafeNativeMethods.sqlite3_value_blob(p);

        Marshal.Copy((IntPtr)(ptr.ToInt64() + nDataOffset), bDest, nStart, nCopied);
      }
      else
      {
        nCopied = 0;
      }

      return nCopied;
    }

    internal override double GetParamValueDouble(IntPtr ptr)
    {

#if !PLATFORM_COMPACTFRAMEWORK
      return UnsafeNativeMethods.sqlite3_value_double(ptr);
#elif !SQLITE_STANDARD
      double value = 0.0;
      UnsafeNativeMethods.sqlite3_value_double_interop(ptr, ref value);

      return value;
#else
      throw new NotImplementedException();
#endif
    }

    internal override int GetParamValueInt32(IntPtr ptr)
    {
      return UnsafeNativeMethods.sqlite3_value_int(ptr);
    }

    internal override long GetParamValueInt64(IntPtr ptr)
    {

#if !PLATFORM_COMPACTFRAMEWORK
      return UnsafeNativeMethods.sqlite3_value_int64(ptr);
#elif !SQLITE_STANDARD
      Int64 value = 0;
      UnsafeNativeMethods.sqlite3_value_int64_interop(ptr, ref value);

      return value;
#else
      throw new NotImplementedException();
#endif
    }

    internal override string GetParamValueText(IntPtr ptr)
    {
#if !SQLITE_STANDARD
      int len = 0;
      return UTF8ToString(UnsafeNativeMethods.sqlite3_value_text_interop(ptr, ref len), len);
#else
      return UTF8ToString(UnsafeNativeMethods.sqlite3_value_text(ptr),
        UnsafeNativeMethods.sqlite3_value_bytes(ptr));
#endif
    }

    internal override TypeAffinity GetParamValueType(IntPtr ptr)
    {
      return UnsafeNativeMethods.sqlite3_value_type(ptr);
    }

    internal override uint GetParamValueSubType(IntPtr ptr)
    {
      return UnsafeNativeMethods.sqlite3_value_subtype(ptr);
    }

    internal override TypeAffinity GetParamValueNumericType(IntPtr ptr)
    {
      return UnsafeNativeMethods.sqlite3_value_numeric_type(ptr);
    }

    internal override int GetParamValueNoChange(IntPtr ptr)
    {
      return UnsafeNativeMethods.sqlite3_value_nochange(ptr);
    }

    internal override int GetParamValueFromBind(IntPtr ptr)
    {
      return UnsafeNativeMethods.sqlite3_value_frombind(ptr);
    }

    internal override void ReturnBlob(IntPtr context, byte[] value)
    {
      UnsafeNativeMethods.sqlite3_result_blob(context, value, value.Length, (IntPtr)(-1));
    }

    internal override void ReturnDouble(IntPtr context, double value)
    {
#if !PLATFORM_COMPACTFRAMEWORK
      UnsafeNativeMethods.sqlite3_result_double(context, value);
#elif !SQLITE_STANDARD
      UnsafeNativeMethods.sqlite3_result_double_interop(context, ref value);
#else
      throw new NotImplementedException();
#endif
    }

    internal override void ReturnError(IntPtr context, string value)
    {
      UnsafeNativeMethods.sqlite3_result_error(context, ToUTF8(value), value.Length);
    }

    internal override void ReturnInt32(IntPtr context, int value)
    {
      UnsafeNativeMethods.sqlite3_result_int(context, value);
    }

    internal override void ReturnInt64(IntPtr context, long value)
    {
#if !PLATFORM_COMPACTFRAMEWORK
      UnsafeNativeMethods.sqlite3_result_int64(context, value);
#elif !SQLITE_STANDARD
      UnsafeNativeMethods.sqlite3_result_int64_interop(context, ref value);
#else
      throw new NotImplementedException();
#endif
    }

    internal override void ReturnNull(IntPtr context)
    {
      UnsafeNativeMethods.sqlite3_result_null(context);
    }

    internal override void ReturnText(IntPtr context, string value)
    {
      byte[] b = ToUTF8(value);
      UnsafeNativeMethods.sqlite3_result_text(context, ToUTF8(value), b.Length - 1, (IntPtr)(-1));
    }

    internal override void ReturnSubType(IntPtr context, uint value)
    {
      UnsafeNativeMethods.sqlite3_result_subtype(context, value);
    }

#if INTEROP_VIRTUAL_TABLE
    /// <summary>
    /// Determines the file name of the native library containing the native
    /// "vtshim" extension -AND- whether it should be dynamically loaded by
    /// this class.
    /// </summary>
    /// <param name="isLoadNeeded">
    /// This output parameter will be set to non-zero if the returned native
    /// library file name should be dynamically loaded prior to attempting
    /// the creation of native disposable extension modules.
    /// </param>
    /// <returns>
    /// The file name of the native library containing the native "vtshim"
    /// extension -OR- null if it cannot be determined.
    /// </returns>
    private string GetShimExtensionFileName(
        ref bool isLoadNeeded /* out */
        )
    {
        if (_shimIsLoadNeeded != null)
            isLoadNeeded = (bool)_shimIsLoadNeeded;
        else
#if SQLITE_STANDARD || USE_INTEROP_DLL || PLATFORM_COMPACTFRAMEWORK
            isLoadNeeded = HelperMethods.IsWindows(); /* COMPAT */
#else
            isLoadNeeded = false; /* mixed-mode assembly */
#endif

        string fileName = _shimExtensionFileName;

        if (fileName != null)
            return fileName;

#if (SQLITE_STANDARD || USE_INTEROP_DLL || PLATFORM_COMPACTFRAMEWORK) && PRELOAD_NATIVE_LIBRARY
        return UnsafeNativeMethods.GetNativeLibraryFileNameOnly(); /* COMPAT */
#else
        return null;
#endif
    }

    /// <summary>
    /// Calls the native SQLite core library in order to create a disposable
    /// module containing the implementation of a virtual table.
    /// </summary>
    /// <param name="module">
    /// The module object to be used when creating the native disposable module.
    /// </param>
    /// <param name="flags">
    /// The flags for the associated <see cref="SQLiteConnection" /> object instance.
    /// </param>
    internal override void CreateModule(SQLiteModule module, SQLiteConnectionFlags flags)
    {
        if (module == null)
            throw new ArgumentNullException("module");

        if (HelperMethods.NoLogModule(flags))
        {
            module.LogErrors = HelperMethods.LogModuleError(flags);
            module.LogExceptions = HelperMethods.LogModuleException(flags);
        }

        if (_sql == null)
            throw new SQLiteException("connection has an invalid handle");

        bool isLoadNeeded = false;
        string fileName = GetShimExtensionFileName(ref isLoadNeeded);

        if (isLoadNeeded)
        {
            if (fileName == null)
                throw new SQLiteException("the file name for the \"vtshim\" extension is unknown");

            if (_shimExtensionProcName == null)
                throw new SQLiteException("the entry point for the \"vtshim\" extension is unknown");

            SetLoadExtension(true);
            LoadExtension(fileName, _shimExtensionProcName);
        }

        if (module.CreateDisposableModule(_sql))
        {
            if (_modules == null)
                _modules = new Dictionary<string, SQLiteModule>();

            _modules.Add(module.Name, module);

            if (_usePool)
            {
                _usePool = false;

#if !NET_COMPACT_20 && TRACE_CONNECTION
                Trace.WriteLine(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "CreateModule (Pool) Disabled: {0}",
                    HandleToString()));
#endif
            }
        }
        else
        {
            throw new SQLiteException(GetLastError());
        }
    }

    /// <summary>
    /// Calls the native SQLite core library in order to cleanup the resources
    /// associated with a module containing the implementation of a virtual table.
    /// </summary>
    /// <param name="module">
    /// The module object previously passed to the <see cref="CreateModule" />
    /// method.
    /// </param>
    /// <param name="flags">
    /// The flags for the associated <see cref="SQLiteConnection" /> object instance.
    /// </param>
    internal override void DisposeModule(SQLiteModule module, SQLiteConnectionFlags flags)
    {
        if (module == null)
            throw new ArgumentNullException("module");

        module.Dispose();
    }
#endif

    internal override IntPtr AggregateContext(IntPtr context)
    {
      return UnsafeNativeMethods.sqlite3_aggregate_context(context, 1);
    }

#if INTEROP_VIRTUAL_TABLE
    /// <summary>
    /// Calls the native SQLite core library in order to declare a virtual table
    /// in response to a call into the <see cref="ISQLiteNativeModule.xCreate" />
    /// or <see cref="ISQLiteNativeModule.xConnect" /> virtual table methods.
    /// </summary>
    /// <param name="module">
    /// The virtual table module that is to be responsible for the virtual table
    /// being declared.
    /// </param>
    /// <param name="strSql">
    /// The string containing the SQL statement describing the virtual table to
    /// be declared.
    /// </param>
    /// <param name="error">
    /// Upon success, the contents of this parameter are undefined.  Upon failure,
    /// it should contain an appropriate error message.
    /// </param>
    /// <returns>
    /// A standard SQLite return code.
    /// </returns>
    internal override SQLiteErrorCode DeclareVirtualTable(
        SQLiteModule module,
        string strSql,
        ref string error
        )
    {
        if (_sql == null)
        {
            error = "connection has an invalid handle";
            return SQLiteErrorCode.Error;
        }

        IntPtr pSql = IntPtr.Zero;

        try
        {
            pSql = SQLiteString.Utf8IntPtrFromString(strSql);

            SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_declare_vtab(
                _sql, pSql);

            if ((n == SQLiteErrorCode.Ok) && (module != null))
                module.Declared = true;

            if (n != SQLiteErrorCode.Ok) error = GetLastError();

            return n;
        }
        finally
        {
            if (pSql != IntPtr.Zero)
            {
                SQLiteMemory.Free(pSql);
                pSql = IntPtr.Zero;
            }
        }
    }

    /// <summary>
    /// Calls the native SQLite core library in order to declare a virtual table
    /// function in response to a call into the <see cref="ISQLiteNativeModule.xCreate" />
    /// or <see cref="ISQLiteNativeModule.xConnect" /> virtual table methods.
    /// </summary>
    /// <param name="module">
    /// The virtual table module that is to be responsible for the virtual table
    /// function being declared.
    /// </param>
    /// <param name="argumentCount">
    /// The number of arguments to the function being declared.
    /// </param>
    /// <param name="name">
    /// The name of the function being declared.
    /// </param>
    /// <param name="error">
    /// Upon success, the contents of this parameter are undefined.  Upon failure,
    /// it should contain an appropriate error message.
    /// </param>
    /// <returns>
    /// A standard SQLite return code.
    /// </returns>
    internal override SQLiteErrorCode DeclareVirtualFunction(
        SQLiteModule module,
        int argumentCount,
        string name,
        ref string error
        )
    {
        if (_sql == null)
        {
            error = "connection has an invalid handle";
            return SQLiteErrorCode.Error;
        }

        IntPtr pName = IntPtr.Zero;

        try
        {
            pName = SQLiteString.Utf8IntPtrFromString(name);

            SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_overload_function(
                _sql, pName, argumentCount);

            if (n != SQLiteErrorCode.Ok) error = GetLastError();

            return n;
        }
        finally
        {
            if (pName != IntPtr.Zero)
            {
                SQLiteMemory.Free(pName);
                pName = IntPtr.Zero;
            }
        }
    }
#endif

    /// <summary>
    /// Builds an error message string fragment containing the
    /// defined values of the <see cref="SQLiteStatusOpsEnum" />
    /// enumeration.
    /// </summary>
    /// <returns>
    /// The built string fragment.
    /// </returns>
    private static string GetStatusDbOpsNames()
    {
        StringBuilder builder = new StringBuilder();

#if !PLATFORM_COMPACTFRAMEWORK
        foreach (string name in Enum.GetNames(
                typeof(SQLiteStatusOpsEnum)))
        {
            if (String.IsNullOrEmpty(name))
                continue;

            if (builder.Length > 0)
                builder.Append(", ");

            builder.Append(name);
        }
#else
        //
        // TODO: Update this list if the available values in the
        //       "SQLiteConfigDbOpsEnum" enumeration change.
        //
        builder.AppendFormat(CultureInfo.InvariantCulture,
            "{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, " +
            "{10}, {11}, {12}",
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_LOOKASIDE_USED,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_CACHE_USED,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_SCHEMA_USED,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_STMT_USED,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_LOOKASIDE_HIT,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_CACHE_HIT,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_CACHE_MISS,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_CACHE_WRITE,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_DEFERRED_FKS,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_CACHE_USED_SHARED,
            SQLiteStatusOpsEnum.SQLITE_DBSTATUS_CACHE_SPILL);
#endif

        return builder.ToString();
    }

    /// <summary>
    /// Builds an error message string fragment containing the
    /// defined values of the <see cref="SQLiteLimitOpsEnum" />
    /// enumeration.
    /// </summary>
    /// <returns>
    /// The built string fragment.
    /// </returns>
    private static string GetLimitOpsNames()
    {
        StringBuilder builder = new StringBuilder();

#if !PLATFORM_COMPACTFRAMEWORK
        foreach (string name in Enum.GetNames(
                typeof(SQLiteLimitOpsEnum)))
        {
            if (String.IsNullOrEmpty(name))
                continue;

            if (builder.Length > 0)
                builder.Append(", ");

            builder.Append(name);
        }
#else
        //
        // TODO: Update this list if the available values in the
        //       "SQLiteLimitOpsEnum" enumeration change.
        //
        builder.AppendFormat(CultureInfo.InvariantCulture,
            "{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}",
            SQLiteLimitOpsEnum.SQLITE_LIMIT_LENGTH,
            SQLiteLimitOpsEnum.SQLITE_LIMIT_SQL_LENGTH,
            SQLiteLimitOpsEnum.SQLITE_LIMIT_COLUMN,
            SQLiteLimitOpsEnum.SQLITE_LIMIT_EXPR_DEPTH,
            SQLiteLimitOpsEnum.SQLITE_LIMIT_COMPOUND_SELECT,
            SQLiteLimitOpsEnum.SQLITE_LIMIT_VDBE_OP,
            SQLiteLimitOpsEnum.SQLITE_LIMIT_FUNCTION_ARG,
            SQLiteLimitOpsEnum.SQLITE_LIMIT_ATTACHED,
            SQLiteLimitOpsEnum.SQLITE_LIMIT_LIKE_PATTERN_LENGTH,
            SQLiteLimitOpsEnum.SQLITE_LIMIT_VARIABLE_NUMBER,
            SQLiteLimitOpsEnum.SQLITE_LIMIT_TRIGGER_DEPTH,
            SQLiteLimitOpsEnum.SQLITE_LIMIT_WORKER_THREADS);
#endif

        return builder.ToString();
    }

    /// <summary>
    /// Builds an error message string fragment containing the
    /// defined values of the <see cref="SQLiteConfigDbOpsEnum" />
    /// enumeration.
    /// </summary>
    /// <returns>
    /// The built string fragment.
    /// </returns>
    private static string GetConfigDbOpsNames()
    {
        StringBuilder builder = new StringBuilder();

#if !PLATFORM_COMPACTFRAMEWORK
        foreach (string name in Enum.GetNames(
                typeof(SQLiteConfigDbOpsEnum)))
        {
            if (String.IsNullOrEmpty(name))
                continue;

            if (builder.Length > 0)
                builder.Append(", ");

            builder.Append(name);
        }
#else
        //
        // TODO: Update this list if the available values in the
        //       "SQLiteConfigDbOpsEnum" enumeration change.
        //
        builder.AppendFormat(CultureInfo.InvariantCulture,
            "{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, " +
            "{10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}",
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_NONE,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_MAINDBNAME,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_LOOKASIDE,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_FKEY,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_TRIGGER,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_QPSG,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_TRIGGER_EQP,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_RESET_DATABASE,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_DEFENSIVE,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_WRITABLE_SCHEMA,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_LEGACY_ALTER_TABLE,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_DQS_DML,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_DQS_DDL,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_VIEW,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_LEGACY_FILE_FORMAT,
            SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_TRUSTED_SCHEMA);
#endif

        return builder.ToString();
    }

    /// <summary>
    /// Returns the current and/or highwater values for the specified
    /// database status parameter.
    /// </summary>
    /// <param name="option">
    /// The database status parameter to query.
    /// </param>
    /// <param name="reset">
    /// Non-zero to reset the highwater value to the current value.
    /// </param>
    /// <param name="current">
    /// If applicable, receives the current value.
    /// </param>
    /// <param name="highwater">
    /// If applicable, receives the highwater value.
    /// </param>
    /// <returns>
    /// A standard SQLite return code.
    /// </returns>
    internal override SQLiteErrorCode GetStatusParameter(
        SQLiteStatusOpsEnum option,
        bool reset,
        ref int current,
        ref int highwater
        )
    {
        if (!Enum.IsDefined(typeof(SQLiteStatusOpsEnum), option))
        {
            throw new SQLiteException(HelperMethods.StringFormat(
                CultureInfo.CurrentCulture,
                "unrecognized status option, must be: {0}",
                GetStatusDbOpsNames()));
        }

        return UnsafeNativeMethods.sqlite3_db_status(
            _sql, option, ref current, ref highwater, reset ? 1 : 0);
    }

    /// <summary>
    /// Change a limit value for the database.
    /// </summary>
    /// <param name="option">
    /// The database limit to change.
    /// </param>
    /// <param name="value">
    /// The new value for the specified limit.
    /// </param>
    /// <returns>
    /// The old value for the specified limit -OR- negative one if an error
    /// occurs.
    /// </returns>
    internal override int SetLimitOption(
        SQLiteLimitOpsEnum option,
        int value
        )
    {
        if (!Enum.IsDefined(typeof(SQLiteLimitOpsEnum), option))
        {
            throw new SQLiteException(HelperMethods.StringFormat(
                CultureInfo.CurrentCulture,
                "unrecognized limit option, must be: {0}",
                GetLimitOpsNames()));
        }

        return UnsafeNativeMethods.sqlite3_limit(_sql, option, value);
    }

    /// <summary>
    /// Change a configuration option value for the database.
    /// </summary>
    /// <param name="option">
    /// The database configuration option to change.
    /// </param>
    /// <param name="value">
    /// The new value for the specified configuration option.
    /// </param>
    /// <returns>
    /// A standard SQLite return code.
    /// </returns>
    internal override SQLiteErrorCode SetConfigurationOption(
        SQLiteConfigDbOpsEnum option,
        object value
        )
    {
        if (!Enum.IsDefined(typeof(SQLiteConfigDbOpsEnum), option))
        {
            throw new SQLiteException(HelperMethods.StringFormat(
                CultureInfo.CurrentCulture,
                "unrecognized configuration option, must be: {0}",
                GetConfigDbOpsNames()));
        }

        switch (option)
        {
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_NONE: // nil
                {
                    //
                    // NOTE: Do nothing, return success.
                    //
                    return SQLiteErrorCode.Ok;
                }
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_MAINDBNAME: // char*
                {
                    if (value == null)
                        throw new ArgumentNullException("value");

                    if (!(value is string))
                    {
                        throw new SQLiteException(HelperMethods.StringFormat(
                            CultureInfo.CurrentCulture,
                            "configuration value type mismatch, must be of type {0}",
                            typeof(string)));
                    }

                    SQLiteErrorCode rc = SQLiteErrorCode.Error;
                    IntPtr pDbName = IntPtr.Zero;

                    try
                    {
                        pDbName = SQLiteString.Utf8IntPtrFromString(
                            (string)value);

                        if (pDbName == IntPtr.Zero)
                        {
                            throw new SQLiteException(
                                SQLiteErrorCode.NoMem,
                                "cannot allocate database name");
                        }

                        rc = UnsafeNativeMethods.sqlite3_db_config_charptr(
                            _sql, option, pDbName);

                        if (rc == SQLiteErrorCode.Ok)
                        {
                            FreeDbName(true);

                            dbName = pDbName;
                            pDbName = IntPtr.Zero;
                        }
                    }
                    finally
                    {
                        if ((rc != SQLiteErrorCode.Ok) &&
                            (pDbName != IntPtr.Zero))
                        {
                            SQLiteMemory.Free(pDbName);
                            pDbName = IntPtr.Zero;
                        }
                    }

                    return rc;
                }
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_LOOKASIDE: // void* int int
                {
                    object[] array = value as object[];

                    if (array == null)
                    {
                        throw new SQLiteException(HelperMethods.StringFormat(
                            CultureInfo.CurrentCulture,
                            "configuration value type mismatch, must be of type {0}",
                            typeof(object[])));
                    }

                    if (!(array[0] is IntPtr))
                    {
                        throw new SQLiteException(HelperMethods.StringFormat(
                            CultureInfo.CurrentCulture,
                            "configuration element zero (0) type mismatch, must be of type {0}",
                            typeof(IntPtr)));
                    }

                    if (!(array[1] is int))
                    {
                        throw new SQLiteException(HelperMethods.StringFormat(
                            CultureInfo.CurrentCulture,
                            "configuration element one (1) type mismatch, must be of type {0}",
                            typeof(int)));
                    }

                    if (!(array[2] is int))
                    {
                        throw new SQLiteException(HelperMethods.StringFormat(
                            CultureInfo.CurrentCulture,
                            "configuration element two (2) type mismatch, must be of type {0}",
                            typeof(int)));
                    }

                    return UnsafeNativeMethods.sqlite3_db_config_intptr_two_ints(
                        _sql, option, (IntPtr)array[0], (int)array[1], (int)array[2]);
                }
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_FKEY: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_TRIGGER: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_QPSG: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_TRIGGER_EQP: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_RESET_DATABASE: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_DEFENSIVE: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_WRITABLE_SCHEMA: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_LEGACY_ALTER_TABLE: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_DQS_DML: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_DQS_DDL: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_VIEW: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_LEGACY_FILE_FORMAT: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_TRUSTED_SCHEMA: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_STMT_SCANSTATUS: // int int*
            case SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_REVERSE_SCANORDER: // int int*
                {
                    if (!(value is bool))
                    {
                        throw new SQLiteException(HelperMethods.StringFormat(
                            CultureInfo.CurrentCulture,
                            "configuration value type mismatch, must be of type {0}",
                            typeof(bool)));
                    }

                    int result = 0; /* NOT USED */

                    return UnsafeNativeMethods.sqlite3_db_config_int_refint(
                        _sql, option, ((bool)value ? 1 : 0), ref result);
                }
            default:
                {
                    throw new SQLiteException(HelperMethods.StringFormat(
                        CultureInfo.CurrentCulture,
                        "unsupported configuration option {0}", option));
                }
        }
    }

    /// <summary>
    /// Enables or disables extension loading by SQLite.
    /// </summary>
    /// <param name="bOnOff">
    /// True to enable loading of extensions, false to disable.
    /// </param>
    internal override void SetLoadExtension(bool bOnOff)
    {
        SQLiteErrorCode n;

        if (SQLiteVersionNumber >= 3013000)
        {
            n = SetConfigurationOption(
                SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION,
                bOnOff);
        }
        else
        {
            n = UnsafeNativeMethods.sqlite3_enable_load_extension(
                _sql, (bOnOff ? -1 : 0));
        }

        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
    }

    /// <summary>
    /// Loads a SQLite extension library from the named file.
    /// </summary>
    /// <param name="fileName">
    /// The name of the dynamic link library file containing the extension.
    /// </param>
    /// <param name="procName">
    /// The name of the exported function used to initialize the extension.
    /// If null, the default "sqlite3_extension_init" will be used.
    /// </param>
    internal override void LoadExtension(string fileName, string procName)
    {
        if (fileName == null)
            throw new ArgumentNullException("fileName");

        IntPtr pError = IntPtr.Zero;

        try
        {
            byte[] utf8FileName = UTF8Encoding.UTF8.GetBytes(fileName + '\0');
            byte[] utf8ProcName = null;

            if (procName != null)
                utf8ProcName = UTF8Encoding.UTF8.GetBytes(procName + '\0');

            SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_load_extension(
                _sql, utf8FileName, utf8ProcName, ref pError);

            if (n != SQLiteErrorCode.Ok)
                throw new SQLiteException(n, UTF8ToString(pError, -1));
        }
        finally
        {
            if (pError != IntPtr.Zero)
            {
                UnsafeNativeMethods.sqlite3_free(pError);
                pError = IntPtr.Zero;
            }
        }
    }

    /// Enables or disables extended result codes returned by SQLite
    internal override void SetExtendedResultCodes(bool bOnOff)
    {
      SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_extended_result_codes(
          _sql, (bOnOff ? -1 : 0));

      if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
    }
    /// Gets the last SQLite error code
    internal override SQLiteErrorCode ResultCode()
    {
      return UnsafeNativeMethods.sqlite3_errcode(_sql);
    }
    /// Gets the last SQLite extended error code
    internal override SQLiteErrorCode ExtendedResultCode()
    {
      return UnsafeNativeMethods.sqlite3_extended_errcode(_sql);
    }

    /// Add a log message via the SQLite sqlite3_log interface.
    internal override void LogMessage(SQLiteErrorCode iErrCode, string zMessage)
    {
      StaticLogMessage(iErrCode, zMessage);
    }

    /// Add a log message via the SQLite sqlite3_log interface.
    internal static void StaticLogMessage(SQLiteErrorCode iErrCode, string zMessage)
    {
      UnsafeNativeMethods.sqlite3_log(iErrCode, ToUTF8(zMessage));
    }

#if INTEROP_CODEC || INTEROP_INCLUDE_SEE
    private static void ZeroPassword(byte[] passwordBytes)
    {
        if (passwordBytes == null) return;

        for (int index = 0; index < passwordBytes.Length; index++)
        {
            byte value = (byte)((index + 1) % byte.MaxValue);

            passwordBytes[index] = value;
            passwordBytes[index] ^= value;
        }
    }

    internal override void SetPassword(byte[] passwordBytes, bool asText)
    {
      int length = asText ? -1 : ((passwordBytes == null) ? 0 : passwordBytes.Length);
      SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_key(_sql, passwordBytes, length);

      if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.HidePassword))
        ZeroPassword(passwordBytes);

      if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());

      if (_usePool)
      {
        _usePool = false;

#if !NET_COMPACT_20 && TRACE_CONNECTION
        Trace.WriteLine(HelperMethods.StringFormat(
          CultureInfo.CurrentCulture,
          "SetPassword (Pool) Disabled: {0}",
          HandleToString()));
#endif
      }
    }

    internal override void ChangePassword(byte[] newPasswordBytes, bool asText)
    {
      int length = asText ? -1 : ((newPasswordBytes == null) ? 0 : newPasswordBytes.Length);
      SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_rekey(_sql, newPasswordBytes, length);

      if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.HidePassword))
        ZeroPassword(newPasswordBytes);

      if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());

      if (_usePool)
      {
        _returnToFileName = _fileName;
        _usePool = false;
        _returnToPool = false;

#if !NET_COMPACT_20 && TRACE_CONNECTION
        Trace.WriteLine(HelperMethods.StringFormat(
          CultureInfo.CurrentCulture,
          "ChangePassword (Pool) Disabled: {0}",
          HandleToString()));
#endif
      }
    }
#endif

    internal override void SetBusyHook(SQLiteBusyCallback func)
    {
        UnsafeNativeMethods.sqlite3_busy_handler(_sql, func, IntPtr.Zero);
    }

    internal override void SetProgressHook(int nOps, SQLiteProgressCallback func)
    {
        UnsafeNativeMethods.sqlite3_progress_handler(_sql, nOps, func, IntPtr.Zero);

    }

    internal override void SetAuthorizerHook(SQLiteAuthorizerCallback func)
    {
      UnsafeNativeMethods.sqlite3_set_authorizer(_sql, func, IntPtr.Zero);

    }

    internal override void SetUpdateHook(SQLiteUpdateCallback func)
    {
      UnsafeNativeMethods.sqlite3_update_hook(_sql, func, IntPtr.Zero);
    }

    internal override void SetCommitHook(SQLiteCommitCallback func)
    {
      UnsafeNativeMethods.sqlite3_commit_hook(_sql, func, IntPtr.Zero);
    }

    internal override void SetTraceCallback(SQLiteTraceCallback func)
    {
      UnsafeNativeMethods.sqlite3_trace(_sql, func, IntPtr.Zero);
    }

    internal override void SetTraceCallback2(SQLiteTraceFlags mask, SQLiteTraceCallback2 func)
    {
        UnsafeNativeMethods.sqlite3_trace_v2(_sql, mask, func, IntPtr.Zero);
    }

    internal override void SetRollbackHook(SQLiteRollbackCallback func)
    {
      UnsafeNativeMethods.sqlite3_rollback_hook(_sql, func, IntPtr.Zero);
    }

    /// <summary>
    /// Allows the setting of a logging callback invoked by SQLite when a
    /// log event occurs.  Only one callback may be set.  If NULL is passed,
    /// the logging callback is unregistered.
    /// </summary>
    /// <param name="func">The callback function to invoke.</param>
    /// <returns>Returns a result code</returns>
    internal override SQLiteErrorCode SetLogCallback(SQLiteLogCallback func)
    {
        SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_config_log(
            SQLiteConfigOpsEnum.SQLITE_CONFIG_LOG, func, IntPtr.Zero);

        if (rc == SQLiteErrorCode.Ok)
        {
            _setLogCallback = (func != null);

#if !NET_COMPACT_20 && TRACE_CONNECTION
            Trace.WriteLine(HelperMethods.StringFormat(
                CultureInfo.CurrentCulture,
                "SetLogCallback: SUCCESS ==> {0}",
                _setLogCallback ? "SET" : "UNSET"));
#endif
        }
#if !NET_COMPACT_20 && TRACE_CONNECTION
        else
        {
            Trace.WriteLine(HelperMethods.StringFormat(
                CultureInfo.CurrentCulture,
                "SetLogCallback: FAILURE ==> {0}",
                rc));
        }
#endif

        return rc;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    internal override SQLiteTransactionState GetTransactionState(
        string schema
        )
    {
        if (_sql == null)
            return SQLiteTransactionState.SQLITE_TXN_UNKNOWN;

        IntPtr pSchema = IntPtr.Zero;

        try
        {
            if (schema != null)
                pSchema = SQLiteString.Utf8IntPtrFromString(schema);

            return UnsafeNativeMethods.sqlite3_txn_state(_sql, pSchema);
        }
        finally
        {
            if (pSchema != IntPtr.Zero)
            {
                SQLiteMemory.Free(pSchema);
                pSchema = IntPtr.Zero;
            }
        }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Appends an error message and an appropriate line-ending to a <see cref="StringBuilder" />
    /// instance.  This is useful because the .NET Compact Framework has a slightly different set
    /// of supported methods for the <see cref="StringBuilder" /> class.
    /// </summary>
    /// <param name="builder">
    /// The <see cref="StringBuilder" /> instance to append to.
    /// </param>
    /// <param name="message">
    /// The message to append.  It will be followed by an appropriate line-ending.
    /// </param>
    private static void AppendError(
        StringBuilder builder,
        string message
        )
    {
        if (builder == null)
            return;

#if !PLATFORM_COMPACTFRAMEWORK
        builder.AppendLine(message);
#else
        builder.Append(message);
        builder.Append("\r\n");
#endif
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// This method attempts to cause the SQLite native library to invalidate
    /// its trace callback function pointers that refer to this instance.
    /// This is necessary to prevent calls from native code into delegates
    /// that may have been garbage collected.  Normally, these types of issues
    /// can only arise for connections that are added to the pool; howver, it
    /// is good practice to unconditionally invalidate function pointers that
    /// may refer to objects being disposed.
    /// </summary>
    /// <param name="builder">
    /// Appropriate error messages, if any, will be appended here.
    /// </param>
    /// <returns>
    /// Non-zero if this method succeeds; otherwise, zero.
    /// </returns>
    private bool UnhookTraceCallback(
        StringBuilder builder
        )
    {
        try
        {
            //
            // NOTE: When using version 3.14 (or later) of the SQLite core
            //       library, use the newer sqlite3_trace_v2() API in order
            //       to unhook the trace callback, just in case the older
            //       API is not available (e.g. SQLITE_OMIT_DEPRECATED).
            //
            if (UnsafeNativeMethods.sqlite3_libversion_number() >= 3014000)
                SetTraceCallback2(SQLiteTraceFlags.SQLITE_TRACE_NONE, null); /* throw */
            else
                SetTraceCallback(null); /* throw */

            return true;
        }
#if !NET_COMPACT_20 && TRACE_CONNECTION
        catch (Exception e)
#else
        catch (Exception)
#endif
        {
#if !NET_COMPACT_20 && TRACE_CONNECTION
            try
            {
                Trace.WriteLine(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "Failed to unset trace callback: {0}",
                    e)); /* throw */
            }
            catch
            {
                // do nothing.
            }
#endif

            AppendError(builder, "failed to unset trace callback");
            return false;
        }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// This method attempts to cause the SQLite native library to invalidate
    /// its function pointers that refer to this instance.  This is necessary
    /// to prevent calls from native code into delegates that may have been
    /// garbage collected.  Normally, these types of issues can only arise for
    /// connections that are added to the pool; howver, it is good practice to
    /// unconditionally invalidate function pointers that may refer to objects
    /// being disposed.
    /// </summary>
    /// <param name="includeTrace">
    /// Non-zero to also invalidate trace callback function pointers.
    /// </param>
    /// <param name="includeGlobal">
    /// Non-zero to also invalidate global function pointers (i.e. those that
    /// are not directly associated with this connection on the native side).
    /// </param>
    /// <param name="canThrow">
    /// Non-zero if this method is being executed within a context where it can
    /// throw an exception in the event of failure; otherwise, zero.
    /// </param>
    /// <returns>
    /// Non-zero if this method was successful; otherwise, zero.
    /// </returns>
    private bool UnhookNativeCallbacks(
        bool includeTrace,
        bool includeGlobal,
        bool canThrow
        )
    {
        //
        // NOTE: Initially, this method assumes success.  Then, if any attempt
        //       to invalidate a function pointer fails, the overall result is
        //       set to failure.  However, this will not prevent further
        //       attempts, if any, to invalidate subsequent function pointers.
        //
        bool result = true;
        SQLiteErrorCode rc = SQLiteErrorCode.Ok;
        StringBuilder builder = new StringBuilder();

        ///////////////////////////////////////////////////////////////////////////////////////////

        #region Trace Callback (Per-Connection)
        if (includeTrace && !UnhookTraceCallback(builder))
        {
            rc = SQLiteErrorCode.Error;
            result = false;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////

        #region Rollback Hook (Per-Connection)
        try
        {
            SetRollbackHook(null); /* throw */
        }
#if !NET_COMPACT_20 && TRACE_CONNECTION
        catch (Exception e)
#else
        catch (Exception)
#endif
        {
#if !NET_COMPACT_20 && TRACE_CONNECTION
            try
            {
                Trace.WriteLine(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "Failed to unset rollback hook: {0}",
                    e)); /* throw */
            }
            catch
            {
                // do nothing.
            }
#endif

            AppendError(builder, "failed to unset rollback hook");
            rc = SQLiteErrorCode.Error;

            result = false;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////

        #region Commit Hook (Per-Connection)
        try
        {
            SetCommitHook(null); /* throw */
        }
#if !NET_COMPACT_20 && TRACE_CONNECTION
        catch (Exception e)
#else
        catch (Exception)
#endif
        {
#if !NET_COMPACT_20 && TRACE_CONNECTION
            try
            {
                Trace.WriteLine(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "Failed to unset commit hook: {0}",
                    e)); /* throw */
            }
            catch
            {
                // do nothing.
            }
#endif

            AppendError(builder, "failed to unset commit hook");
            rc = SQLiteErrorCode.Error;

            result = false;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////

        #region Update Hook (Per-Connection)
        try
        {
            SetUpdateHook(null); /* throw */
        }
#if !NET_COMPACT_20 && TRACE_CONNECTION
        catch (Exception e)
#else
        catch (Exception)
#endif
        {
#if !NET_COMPACT_20 && TRACE_CONNECTION
            try
            {
                Trace.WriteLine(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "Failed to unset update hook: {0}",
                    e)); /* throw */
            }
            catch
            {
                // do nothing.
            }
#endif

            AppendError(builder, "failed to unset update hook");
            rc = SQLiteErrorCode.Error;

            result = false;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////

        #region Authorizer Hook (Per-Connection)
        try
        {
            SetAuthorizerHook(null); /* throw */
        }
#if !NET_COMPACT_20 && TRACE_CONNECTION
        catch (Exception e)
#else
        catch (Exception)
#endif
        {
#if !NET_COMPACT_20 && TRACE_CONNECTION
            try
            {
                Trace.WriteLine(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "Failed to unset authorizer hook: {0}",
                    e)); /* throw */
            }
            catch
            {
                // do nothing.
            }
#endif

            AppendError(builder, "failed to unset authorizer hook");
            rc = SQLiteErrorCode.Error;

            result = false;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////

        #region Busy Hook (Per-Connection)
        try
        {
            SetBusyHook(null); /* throw */
        }
#if !NET_COMPACT_20 && TRACE_CONNECTION
        catch (Exception e)
#else
        catch (Exception)
#endif
        {
#if !NET_COMPACT_20 && TRACE_CONNECTION
            try
            {
                Trace.WriteLine(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "Failed to unset busy hook: {0}",
                    e)); /* throw */
            }
            catch
            {
                // do nothing.
            }
#endif

            AppendError(builder, "failed to unset busy hook");
            rc = SQLiteErrorCode.Error;

            result = false;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////

        #region Progress Hook (Per-Connection)
        try
        {
            SetProgressHook(0, null); /* throw */
        }
#if !NET_COMPACT_20 && TRACE_CONNECTION
        catch (Exception e)
#else
        catch (Exception)
#endif
        {
#if !NET_COMPACT_20 && TRACE_CONNECTION
            try
            {
                Trace.WriteLine(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "Failed to unset progress hook: {0}",
                    e)); /* throw */
            }
            catch
            {
                // do nothing.
            }
#endif

            AppendError(builder, "failed to unset progress hook");
            rc = SQLiteErrorCode.Error;

            result = false;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////

        #region Log Callback (Global)
        //
        // NOTE: We have to be careful here because the log callback
        //       is not per-connection on the native side.  It should
        //       only be unset by this method if this instance was
        //       responsible for setting it.
        //
        if (includeGlobal && _setLogCallback)
        {
            try
            {
                SQLiteErrorCode rc2 = SetLogCallback(null); /* throw */

                if (rc2 != SQLiteErrorCode.Ok)
                {
                    AppendError(builder, "could not unset log callback");
                    rc = rc2;

                    result = false;
                }
            }
#if !NET_COMPACT_20 && TRACE_CONNECTION
            catch (Exception e)
#else
            catch (Exception)
#endif
            {
#if !NET_COMPACT_20 && TRACE_CONNECTION
                try
                {
                    Trace.WriteLine(HelperMethods.StringFormat(
                        CultureInfo.CurrentCulture,
                        "Failed to unset log callback: {0}",
                        e)); /* throw */
                }
                catch
                {
                    // do nothing.
                }
#endif

                AppendError(builder, "failed to unset log callback");
                rc = SQLiteErrorCode.Error;

                result = false;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////

        if (!result && canThrow)
            throw new SQLiteException(rc, builder.ToString());

        return result;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// This method attempts to free the cached database name used with the
    /// <see cref="SetConfigurationOption" /> method.
    /// </summary>
    /// <param name="canThrow">
    /// Non-zero if this method is being executed within a context where it can
    /// throw an exception in the event of failure; otherwise, zero.
    /// </param>
    /// <returns>
    /// Non-zero if this method was successful; otherwise, zero.
    /// </returns>
    private bool FreeDbName(
        bool canThrow
        )
    {
        try
        {
            if (dbName != IntPtr.Zero)
            {
                SQLiteMemory.Free(dbName);
                dbName = IntPtr.Zero;
            }

            return true;
        }
#if !NET_COMPACT_20 && TRACE_CONNECTION
        catch (Exception e)
#else
        catch (Exception)
#endif
        {
#if !NET_COMPACT_20 && TRACE_CONNECTION
            try
            {
                Trace.WriteLine(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "Failed to free database name: {0}",
                    e)); /* throw */
            }
            catch
            {
                // do nothing.
            }
#endif

            if (canThrow)
                throw;
        }

        return false;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Creates a new SQLite backup object based on the provided destination
    /// database connection.  The source database connection is the one
    /// associated with this object.  The source and destination database
    /// connections cannot be the same.
    /// </summary>
    /// <param name="destCnn">The destination database connection.</param>
    /// <param name="destName">The destination database name.</param>
    /// <param name="sourceName">The source database name.</param>
    /// <returns>The newly created backup object.</returns>
    internal override SQLiteBackup InitializeBackup(
        SQLiteConnection destCnn,
        string destName,
        string sourceName
        )
    {
        if (destCnn == null)
            throw new ArgumentNullException("destCnn");

        if (destName == null)
            throw new ArgumentNullException("destName");

        if (sourceName == null)
            throw new ArgumentNullException("sourceName");

        SQLite3 destSqlite3 = destCnn._sql as SQLite3;

        if (destSqlite3 == null)
            throw new ArgumentException(
                "Destination connection has no wrapper.",
                "destCnn");

        SQLiteConnectionHandle destHandle = destSqlite3._sql;

        if (destHandle == null)
            throw new ArgumentException(
                "Destination connection has an invalid handle.",
                "destCnn");

        SQLiteConnectionHandle sourceHandle = _sql;

        if (sourceHandle == null)
            throw new InvalidOperationException(
                "Source connection has an invalid handle.");

        byte[] zDestName = ToUTF8(destName);
        byte[] zSourceName = ToUTF8(sourceName);

        SQLiteBackupHandle backupHandle = null;

        try
        {
            // do nothing.
        }
        finally /* NOTE: Thread.Abort() protection. */
        {
            IntPtr backup = UnsafeNativeMethods.sqlite3_backup_init(
                destHandle, zDestName, sourceHandle, zSourceName);

            if (backup == IntPtr.Zero)
            {
                SQLiteErrorCode resultCode = ResultCode();

                if (resultCode != SQLiteErrorCode.Ok)
                    throw new SQLiteException(resultCode, GetLastError());
                else
                    throw new SQLiteException("failed to initialize backup");
            }

            backupHandle = new SQLiteBackupHandle(destHandle, backup);
        }

        SQLiteConnection.OnChanged(null, new ConnectionEventArgs(
            SQLiteConnectionEventType.NewCriticalHandle, null,
            null, null, null, backupHandle, null, new object[] {
            typeof(SQLite3), destCnn, destName, sourceName }));

        return new SQLiteBackup(
            this, backupHandle, destHandle, zDestName, sourceHandle,
            zSourceName);
    }

    /// <summary>
    /// Copies up to N pages from the source database to the destination
    /// database associated with the specified backup object.
    /// </summary>
    /// <param name="backup">The backup object to use.</param>
    /// <param name="nPage">
    /// The number of pages to copy, negative to copy all remaining pages.
    /// </param>
    /// <param name="retry">
    /// Set to true if the operation needs to be retried due to database
    /// locking issues; otherwise, set to false.
    /// </param>
    /// <returns>
    /// True if there are more pages to be copied, false otherwise.
    /// </returns>
    internal override bool StepBackup(
        SQLiteBackup backup,
        int nPage,
        ref bool retry
        )
    {
        retry = false;

        if (backup == null)
            throw new ArgumentNullException("backup");

        SQLiteBackupHandle handle = backup._sqlite_backup;

        if (handle == null)
            throw new InvalidOperationException(
                "Backup object has an invalid handle.");

        IntPtr handlePtr = handle;

        if (handlePtr == IntPtr.Zero)
            throw new InvalidOperationException(
                "Backup object has an invalid handle pointer.");

        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_backup_step(handlePtr, nPage);
        backup._stepResult = n; /* NOTE: Save for use by FinishBackup. */

        if (n == SQLiteErrorCode.Ok)
        {
            return true;
        }
        else if (n == SQLiteErrorCode.Busy)
        {
            retry = true;
            return true;
        }
        else if (n == SQLiteErrorCode.Locked)
        {
            retry = true;
            return true;
        }
        else if (n == SQLiteErrorCode.Done)
        {
            return false;
        }
        else
        {
            throw new SQLiteException(n, GetLastError());
        }
    }

    /// <summary>
    /// Returns the number of pages remaining to be copied from the source
    /// database to the destination database associated with the specified
    /// backup object.
    /// </summary>
    /// <param name="backup">The backup object to check.</param>
    /// <returns>The number of pages remaining to be copied.</returns>
    internal override int RemainingBackup(
        SQLiteBackup backup
        )
    {
        if (backup == null)
            throw new ArgumentNullException("backup");

        SQLiteBackupHandle handle = backup._sqlite_backup;

        if (handle == null)
            throw new InvalidOperationException(
                "Backup object has an invalid handle.");

        IntPtr handlePtr = handle;

        if (handlePtr == IntPtr.Zero)
            throw new InvalidOperationException(
                "Backup object has an invalid handle pointer.");

        return UnsafeNativeMethods.sqlite3_backup_remaining(handlePtr);
    }

    /// <summary>
    /// Returns the total number of pages in the source database associated
    /// with the specified backup object.
    /// </summary>
    /// <param name="backup">The backup object to check.</param>
    /// <returns>The total number of pages in the source database.</returns>
    internal override int PageCountBackup(
        SQLiteBackup backup
        )
    {
        if (backup == null)
            throw new ArgumentNullException("backup");

        SQLiteBackupHandle handle = backup._sqlite_backup;

        if (handle == null)
            throw new InvalidOperationException(
                "Backup object has an invalid handle.");

        IntPtr handlePtr = handle;

        if (handlePtr == IntPtr.Zero)
            throw new InvalidOperationException(
                "Backup object has an invalid handle pointer.");

        return UnsafeNativeMethods.sqlite3_backup_pagecount(handlePtr);
    }

    /// <summary>
    /// Destroys the backup object, rolling back any backup that may be in
    /// progess.
    /// </summary>
    /// <param name="backup">The backup object to destroy.</param>
    internal override void FinishBackup(
        SQLiteBackup backup
        )
    {
        if (backup == null)
            throw new ArgumentNullException("backup");

        SQLiteBackupHandle handle = backup._sqlite_backup;

        if (handle == null)
            throw new InvalidOperationException(
                "Backup object has an invalid handle.");

        IntPtr handlePtr = handle;

        if (handlePtr == IntPtr.Zero)
            throw new InvalidOperationException(
                "Backup object has an invalid handle pointer.");

#if !SQLITE_STANDARD
        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_backup_finish_interop(handlePtr);
#else
        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_backup_finish(handlePtr);
#endif
        handle.SetHandleAsInvalid();

#if COUNT_HANDLE
        if ((n == SQLiteErrorCode.Ok) || (n == backup._stepResult)) handle.WasReleasedOk();
#endif

        if ((n != SQLiteErrorCode.Ok) && (n != backup._stepResult))
            throw new SQLiteException(n, GetLastError());
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Determines if the SQLite core library has been initialized for the
    /// current process.
    /// </summary>
    /// <returns>
    /// A boolean indicating whether or not the SQLite core library has been
    /// initialized for the current process.
    /// </returns>
    internal override bool IsInitialized()
    {
        return StaticIsInitialized();
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Determines if the SQLite core library has been initialized for the
    /// current process.
    /// </summary>
    /// <returns>
    /// A boolean indicating whether or not the SQLite core library has been
    /// initialized for the current process.
    /// </returns>
    internal static bool StaticIsInitialized()
    {
        //
        // BUGFIX: Prevent races with other threads for this entire block, due
        //         to the try/finally semantics.  See ticket [72905c9a77].
        //
        lock (syncRoot)
        {
            //
            // NOTE: Save the state of the logging class and then restore it
            //       after we are done to avoid logging too many false errors.
            //
            bool savedEnabled = SQLiteLog.InternalEnabled;
            SQLiteLog.InternalEnabled = false;

            try
            {
                //
                // NOTE: This method [ab]uses the fact that SQLite will always
                //       return SQLITE_ERROR for any unknown configuration option
                //       *unless* the SQLite library has already been initialized.
                //       In that case it will always return SQLITE_MISUSE.
                //
                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_config_none(
                    SQLiteConfigOpsEnum.SQLITE_CONFIG_NONE);

                return (rc == SQLiteErrorCode.Misuse);
            }
            finally
            {
                SQLiteLog.InternalEnabled = savedEnabled;
            }
        }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

#if USE_INTEROP_DLL && INTEROP_LOG
    internal static SQLiteErrorCode ConfigureLogForInterop(
        string className
        )
    {
        SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_config_log_interop();

        if (rc == SQLiteErrorCode.Ok)
        {
            UnsafeNativeMethods.sqlite3_log(rc, SQLiteConvert.ToUTF8(
                HelperMethods.StringFormat(CultureInfo.InvariantCulture,
                    "logging initialized via \"{0}\".", className)));
        }
        else if (rc == SQLiteErrorCode.Done)
        {
            rc = SQLiteErrorCode.Ok;
        }

        return rc;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    internal static SQLiteErrorCode UnConfigureLogForInterop(
        string className
        )
    {
        SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_unconfig_log_interop();

        if (rc == SQLiteErrorCode.Ok)
        {
            UnsafeNativeMethods.sqlite3_log(rc, SQLiteConvert.ToUTF8(
                HelperMethods.StringFormat(CultureInfo.InvariantCulture,
                    "logging uninitialized via \"{0}\".", className)));
        }
        else if (rc == SQLiteErrorCode.Done)
        {
            rc = SQLiteErrorCode.Ok;
        }

        return rc;
    }
#endif

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Helper function to retrieve a column of data from an active statement.
    /// </summary>
    /// <param name="stmt">The statement being step()'d through</param>
    /// <param name="flags">The flags associated with the connection.</param>
    /// <param name="index">The column index to retrieve</param>
    /// <param name="typ">The type of data contained in the column.  If Uninitialized, this function will retrieve the datatype information.</param>
    /// <returns>Returns the data in the column</returns>
    internal override object GetValue(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, SQLiteType typ)
    {

      TypeAffinity aff = typ.Affinity;
      if (aff == TypeAffinity.Null) return DBNull.Value;
      Type t = null;

      if (typ.Type != DbType.Object)
      {
        t = SQLiteConvert.SQLiteTypeToType(typ);
        aff = TypeToAffinity(t, flags);
      }

      if (HelperMethods.HasFlags(flags, SQLiteConnectionFlags.GetAllAsText))
          return GetText(stmt, index);

      switch (aff)
      {
        case TypeAffinity.Blob:
          if (typ.Type == DbType.Guid && typ.Affinity == TypeAffinity.Text)
            return new Guid(GetText(stmt, index));

          int n = (int)GetBytes(stmt, index, 0, null, 0, 0);
          byte[] b = new byte[n];
          GetBytes(stmt, index, 0, b, 0, n);

          if (typ.Type == DbType.Guid && n == 16)
            return new Guid(b);

          return b;
        case TypeAffinity.DateTime:
          return GetDateTime(stmt, index);
        case TypeAffinity.Double:
          if (t == null) return GetDouble(stmt, index);

          return Convert.ChangeType(GetDouble(stmt, index), t,
              HelperMethods.HasFlags(flags, SQLiteConnectionFlags.GetInvariantDouble) ?
                  CultureInfo.InvariantCulture : CultureInfo.CurrentCulture);
        case TypeAffinity.Int64:
          if (t == null) return GetInt64(stmt, index);

          if (t == typeof(Boolean)) return GetBoolean(stmt, index);
          if (t == typeof(SByte)) return GetSByte(stmt, index);
          if (t == typeof(Byte)) return GetByte(stmt, index);
          if (t == typeof(Int16)) return GetInt16(stmt, index);
          if (t == typeof(UInt16)) return GetUInt16(stmt, index);
          if (t == typeof(Int32)) return GetInt32(stmt, index);
          if (t == typeof(UInt32)) return GetUInt32(stmt, index);
          if (t == typeof(Int64)) return GetInt64(stmt, index);
          if (t == typeof(UInt64)) return GetUInt64(stmt, index);
          return Convert.ChangeType(GetInt64(stmt, index), t,
              HelperMethods.HasFlags(flags, SQLiteConnectionFlags.GetInvariantInt64) ?
                  CultureInfo.InvariantCulture : CultureInfo.CurrentCulture);
        default:
          return GetText(stmt, index);
      }
    }

    internal override int GetCursorForTable(SQLiteStatement stmt, int db, int rootPage)
    {
#if !SQLITE_STANDARD
      return UnsafeNativeMethods.sqlite3_table_cursor_interop(stmt._sqlite_stmt, db, rootPage);
#else
      return -1;
#endif
    }

    internal override long GetRowIdForCursor(SQLiteStatement stmt, int cursor)
    {
#if !SQLITE_STANDARD
      long rowid = 0;
      SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_cursor_rowid_interop(stmt._sqlite_stmt, cursor, ref rowid);
      if (rc == SQLiteErrorCode.Ok) return rowid;

      return 0;
#else
      return 0;
#endif
    }

    internal override void GetIndexColumnExtendedInfo(string database, string index, string column, ref int sortMode, ref int onError, ref string collationSequence)
    {
#if !SQLITE_STANDARD
      IntPtr coll = IntPtr.Zero;
      int colllen = 0;
      SQLiteErrorCode rc;

      rc = UnsafeNativeMethods.sqlite3_index_column_info_interop(_sql, ToUTF8(database), ToUTF8(index), ToUTF8(column), ref sortMode, ref onError, ref coll, ref colllen);
      if (rc != SQLiteErrorCode.Ok) throw new SQLiteException(rc, null);

      collationSequence = UTF8ToString(coll, colllen);
#else
      sortMode = 0;
      onError = 2;
      collationSequence = "BINARY";
#endif
    }

    internal override SQLiteErrorCode FileControl(string zDbName, int op, IntPtr pArg)
    {
      return UnsafeNativeMethods.sqlite3_file_control(_sql, (zDbName != null) ? ToUTF8(zDbName) : null, op, pArg);
    }
  }
}

Changes to System.Data.SQLite/SQLite3_UTF16.cs.

1
2
3
4
5
6
7
8
9
10








11


12
13
14
15
16
17


























18







19
20
21














































22
23
24
25
26
27
28
29
30

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45








46
47








48







49
50
51





52














53
54
55
56






57

58
59








60
61






62
63
64







65
66







67


68

69













70

71


72
73





74
75





















76

77
78


79
80









81
82
83
84
85
86







87
88
89
90
91
92
93
94
95
96
97






































98
99
100
101
102
103
104
105
106

107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

147
148
149
150
151
152
153
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;








  using System.Runtime.InteropServices;



  /// <summary>
  /// Alternate SQLite3 object, overriding many text behaviors to support UTF-16 (Unicode)
  /// </summary>
  internal class SQLite3_UTF16 : SQLite3
  {


























    internal SQLite3_UTF16(SQLiteDateFormats fmt)







      : base(fmt)
    {
    }















































    /// <summary>
    /// Overrides SQLiteConvert.ToString() to marshal UTF-16 strings instead of UTF-8
    /// </summary>
    /// <param name="b">A pointer to a UTF-16 string</param>
    /// <param name="nbytelen">The length (IN BYTES) of the string</param>
    /// <returns>A .NET string</returns>
    public override string ToString(IntPtr b, int nbytelen)
    {

      return UTF16ToString(b, nbytelen);
    }

    public static string UTF16ToString(IntPtr b, int nbytelen)
    {
      if (nbytelen == 0 || b == IntPtr.Zero) return "";

      if (nbytelen == -1)
        return Marshal.PtrToStringUni(b);
      else
        return Marshal.PtrToStringUni(b, nbytelen / 2);
    }

    internal override void Open(string strFilename, SQLiteOpenFlagsEnum flags, int maxPoolSize, bool usePool)
    {








      if (_sql != null) return;









      _usePool = usePool;







      if (usePool)
      {
        _fileName = strFilename;





        _sql = SQLiteConnectionPool.Remove(strFilename, maxPoolSize, out _poolVersion);














      }

      if (_sql == null)
      {






        IntPtr db;


#if !SQLITE_STANDARD








        int n = UnsafeNativeMethods.sqlite3_open16_interop(ToUTF8(strFilename), (int)flags, out db);
#else






        if ((flags & SQLiteOpenFlagsEnum.Create) == 0 && System.IO.File.Exists(strFilename) == false)
          throw new SQLiteException((int)SQLiteErrorCode.CantOpen, strFilename);








        int n = UnsafeNativeMethods.sqlite3_open16(strFilename, out db);
#endif







        if (n > 0) throw new SQLiteException(n, null);




        _sql = db;













      }

      _functionsArray = SQLiteFunction.BindFunctions(this);


    }






    internal override void Bind_DateTime(SQLiteStatement stmt, int index, DateTime dt)
    {





















      Bind_Text(stmt, index, ToString(dt));

    }



    internal override void Bind_Text(SQLiteStatement stmt, int index, string value)
    {









      int n = UnsafeNativeMethods.sqlite3_bind_text16(stmt._sqlite_stmt, index, value, value.Length * 2, (IntPtr)(-1));
      if (n > 0) throw new SQLiteException(n, SQLiteLastError());
    }

    internal override DateTime GetDateTime(SQLiteStatement stmt, int index)
    {







      return ToDateTime(GetText(stmt, index));
    }

    internal override string ColumnName(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len;
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_name16_interop(stmt._sqlite_stmt, index, out len), len);
#else
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_name16(stmt._sqlite_stmt, index), -1);
#endif






































    }

    internal override string GetText(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len;
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_text16_interop(stmt._sqlite_stmt, index, out len), len);
#else
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_text16(stmt._sqlite_stmt, index), -1);

#endif
    }

    internal override string ColumnOriginalName(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len;
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_origin_name16_interop(stmt._sqlite_stmt, index, out len), len);
#else
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_origin_name16(stmt._sqlite_stmt, index), -1);
#endif
    }

    internal override string ColumnDatabaseName(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len;
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_database_name16_interop(stmt._sqlite_stmt, index, out len), len);
#else
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_database_name16(stmt._sqlite_stmt, index), -1);
#endif
    }

    internal override string ColumnTableName(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len;
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_table_name16_interop(stmt._sqlite_stmt, index, out len), len);
#else
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_table_name16(stmt._sqlite_stmt, index), -1);
#endif
    }

    internal override string GetParamValueText(IntPtr ptr)
    {
#if !SQLITE_STANDARD
      int len;
      return UTF16ToString(UnsafeNativeMethods.sqlite3_value_text16_interop(ptr, out len), len);
#else
      return UTF16ToString(UnsafeNativeMethods.sqlite3_value_text16(ptr), -1);

#endif
    }

    internal override void ReturnError(IntPtr context, string value)
    {
      UnsafeNativeMethods.sqlite3_result_error16(context, value, value.Length * 2);
    }



|






>
>
>
>
>
>
>
>

>
>




|

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


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









>





|







|

>
>
>
>
>
>
>
>
|

>
>
>
>
>
>
>
>

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

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




>
>
>
>
>
>
|
>


>
>
>
>
>
>
>
>
|

>
>
>
>
>
>
|
|

>
>
>
>
>
>
>
|

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

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

>
>
>
>
>
>
>
>
>
|
|




>
>
>
>
>
>
>






|
|

|

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





|
|

|
>






|
|








|
|








|
|








|
|

|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Collections.Generic;

#if !NET_COMPACT_20 && TRACE_CONNECTION
  using System.Diagnostics;
#endif

  using System.Globalization;
  using System.IO;
  using System.Runtime.InteropServices;
  using System.Threading;


  /// <summary>
  /// Alternate SQLite3 object, overriding many text behaviors to support UTF-16 (Unicode)
  /// </summary>
  internal sealed class SQLite3_UTF16 : SQLite3
  {
    /// <summary>
    /// Constructs the object used to interact with the SQLite core library
    /// using the UTF-8 text encoding.
    /// </summary>
    /// <param name="fmt">
    /// The DateTime format to be used when converting string values to a
    /// DateTime and binding DateTime parameters.
    /// </param>
    /// <param name="kind">
    /// The <see cref="DateTimeKind" /> to be used when creating DateTime
    /// values.
    /// </param>
    /// <param name="fmtString">
    /// The format string to be used when parsing and formatting DateTime
    /// values.
    /// </param>
    /// <param name="db">
    /// The native handle to be associated with the database connection.
    /// </param>
    /// <param name="fileName">
    /// The fully qualified file name associated with <paramref name="db" />.
    /// </param>
    /// <param name="ownHandle">
    /// Non-zero if the newly created object instance will need to dispose
    /// of <paramref name="db" /> when it is no longer needed.
    /// </param>
    internal SQLite3_UTF16(
        SQLiteDateFormats fmt,
        DateTimeKind kind,
        string fmtString,
        IntPtr db,
        string fileName,
        bool ownHandle
        )
        : base(fmt, kind, fmtString, db, fileName, ownHandle)
    {
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable "Pattern" Members
    private bool disposed;
    private void CheckDisposed() /* throw */
    {
#if THROW_ON_DISPOSED
        if (disposed)
            throw new ObjectDisposedException(typeof(SQLite3_UTF16).Name);
#endif
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    protected override void Dispose(bool disposing)
    {
        try
        {
            if (!disposed)
            {
                //if (disposing)
                //{
                //    ////////////////////////////////////
                //    // dispose managed resources here...
                //    ////////////////////////////////////
                //}

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////
            }
        }
        finally
        {
            base.Dispose(disposing);

            //
            // NOTE: Everything should be fully disposed at this point.
            //
            disposed = true;
        }
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Overrides SQLiteConvert.ToString() to marshal UTF-16 strings instead of UTF-8
    /// </summary>
    /// <param name="b">A pointer to a UTF-16 string</param>
    /// <param name="nbytelen">The length (IN BYTES) of the string</param>
    /// <returns>A .NET string</returns>
    public override string ToString(IntPtr b, int nbytelen)
    {
      CheckDisposed();
      return UTF16ToString(b, nbytelen);
    }

    public static string UTF16ToString(IntPtr b, int nbytelen)
    {
      if (nbytelen == 0 || b == IntPtr.Zero) return String.Empty;

      if (nbytelen == -1)
        return Marshal.PtrToStringUni(b);
      else
        return Marshal.PtrToStringUni(b, nbytelen / 2);
    }

    internal override void Open(string strFilename, string vfsName, SQLiteConnectionFlags connectionFlags, SQLiteOpenFlagsEnum openFlags, int maxPoolSize, bool usePool)
    {
      BumpOpenCount();

      //
      // NOTE: If the database connection is currently open, attempt to
      //       close it now.  This must be done because the file name or
      //       other parameters that may impact the underlying database
      //       connection may have changed.
      //
      if (_sql != null) Close(false);

      //
      // NOTE: If the connection was not closed successfully, throw an
      //       exception now.
      //
      if (_sql != null)
          throw new SQLiteException("connection handle is still active");

      _maxPoolSize = maxPoolSize;
      _usePool = usePool;

      //
      // BUGFIX: Do not allow a connection into the pool if it was opened
      //         with flags that are incompatible with the default flags
      //         (e.g. read-only).
      //
      if (_usePool && !IsAllowedToUsePool(openFlags))
          _usePool = false;

      _fileName = strFilename;
      _returnToFileName = strFilename;
      _flags = connectionFlags;

      if (usePool)
      {
        _sql = SQLiteConnectionPool.Remove(strFilename, maxPoolSize, out _poolVersion);

        SQLiteConnection.OnChanged(null, new ConnectionEventArgs(
            SQLiteConnectionEventType.OpenedFromPool, null, null,
            null, null, _sql, strFilename, new object[] {
            typeof(SQLite3_UTF16), strFilename, vfsName,
            connectionFlags, openFlags, maxPoolSize, usePool,
            _poolVersion }));

#if !NET_COMPACT_20 && TRACE_CONNECTION
        Trace.WriteLine(HelperMethods.StringFormat(
            CultureInfo.CurrentCulture,
            "Open16 (Pool): {0}",
            HandleToString()));
#endif
      }

      if (_sql == null)
      {
        try
        {
            // do nothing.
        }
        finally /* NOTE: Thread.Abort() protection. */
        {
          IntPtr db = IntPtr.Zero;
          SQLiteErrorCode n;

#if !SQLITE_STANDARD
          int extFuncs = 0;

          if (!HelperMethods.HasFlags(connectionFlags, SQLiteConnectionFlags.NoExtensionFunctions))
              extFuncs |= 1;

          if (HelperMethods.HasFlags(connectionFlags, SQLiteConnectionFlags.NoCoreFunctions))
              extFuncs |= 2;

          n = UnsafeNativeMethods.sqlite3_open16_interop(ToUTF8(strFilename), ToUTF8(vfsName), openFlags, extFuncs, ref db);
#else
          //
          // NOTE: This flag check is designed to enforce the constraint that opening
          //       a database file that does not already exist requires specifying the
          //       "Create" flag, even when a native API is used that does not accept
          //       a flags parameter.
          //
          if (((openFlags & SQLiteOpenFlagsEnum.Create) != SQLiteOpenFlagsEnum.Create) && !File.Exists(strFilename))
            throw new SQLiteException(SQLiteErrorCode.CantOpen, strFilename);

          if (vfsName != null)
          {
            throw new SQLiteException(SQLiteErrorCode.CantOpen, HelperMethods.StringFormat(
              CultureInfo.CurrentCulture,
              "cannot open using UTF-16 and VFS \"{0}\": need interop assembly", vfsName));
          }

          n = UnsafeNativeMethods.sqlite3_open16(strFilename, ref db);
#endif

#if !NET_COMPACT_20 && TRACE_CONNECTION
          Trace.WriteLine(HelperMethods.StringFormat(
              CultureInfo.CurrentCulture,
              "Open16: {0}", db));
#endif

          if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, null);
          _sql = new SQLiteConnectionHandle(db, true);
          BumpCreateCount();
        }
        lock (_sql) { /* HACK: Force the SyncBlock to be "created" now. */ }

        SQLiteConnection.OnChanged(null, new ConnectionEventArgs(
            SQLiteConnectionEventType.NewCriticalHandle, null,
            null, null, null, _sql, strFilename, new object[] {
            typeof(SQLite3_UTF16), strFilename, vfsName,
            connectionFlags, openFlags, maxPoolSize, usePool }));
      }

      // Bind functions to this connection.  If any previous functions of the same name
      // were already bound, then the new bindings replace the old.
      if (!HelperMethods.HasFlags(connectionFlags, SQLiteConnectionFlags.NoBindFunctions))
      {
          if (_functions == null)
              _functions = new Dictionary<SQLiteFunctionAttribute, SQLiteFunction>();

          foreach (KeyValuePair<SQLiteFunctionAttribute, SQLiteFunction> pair
                  in SQLiteFunction.BindFunctions(this, connectionFlags))
          {
              _functions[pair.Key] = pair.Value;
          }
      }

      SetTimeout(0);
      GC.KeepAlive(_sql);
    }

    internal override void Bind_DateTime(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, DateTime dt)
    {
        switch (_datetimeFormat)
        {
            case SQLiteDateFormats.Ticks:
            case SQLiteDateFormats.JulianDay:
            case SQLiteDateFormats.UnixEpoch:
                {
                    base.Bind_DateTime(stmt, flags, index, dt);
                    break;
                }
            default:
                {
#if !PLATFORM_COMPACTFRAMEWORK
                    if (HelperMethods.LogBind(flags))
                    {
                        SQLiteStatementHandle handle =
                            (stmt != null) ? stmt._sqlite_stmt : null;

                        LogBind(handle, index, dt);
                    }
#endif

                    Bind_Text(stmt, flags, index, ToString(dt));
                    break;
                }
        }
    }

    internal override void Bind_Text(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, string value)
    {
        SQLiteStatementHandle handle = stmt._sqlite_stmt;

#if !PLATFORM_COMPACTFRAMEWORK
        if (HelperMethods.LogBind(flags))
        {
            LogBind(handle, index, value);
        }
#endif

        SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_bind_text16(handle, index, value, value.Length * 2, (IntPtr)(-1));
        if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError());
    }

    internal override DateTime GetDateTime(SQLiteStatement stmt, int index)
    {
      if (_datetimeFormat == SQLiteDateFormats.Ticks)
        return TicksToDateTime(GetInt64(stmt, index), _datetimeKind);
      else if (_datetimeFormat == SQLiteDateFormats.JulianDay)
        return ToDateTime(GetDouble(stmt, index), _datetimeKind);
      else if (_datetimeFormat == SQLiteDateFormats.UnixEpoch)
        return UnixEpochToDateTime(GetInt64(stmt, index), _datetimeKind);

      return ToDateTime(GetText(stmt, index));
    }

    internal override string ColumnName(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len = 0;
      IntPtr p = UnsafeNativeMethods.sqlite3_column_name16_interop(stmt._sqlite_stmt, index, ref len);
#else
      IntPtr p = UnsafeNativeMethods.sqlite3_column_name16(stmt._sqlite_stmt, index);
#endif
      if (p == IntPtr.Zero)
        throw new SQLiteException(SQLiteErrorCode.NoMem, GetLastError());
#if !SQLITE_STANDARD
      return UTF16ToString(p, len);
#else
      return UTF16ToString(p, -1);
#endif
    }

    internal override string ColumnType(SQLiteStatement stmt, int index, ref TypeAffinity nAffinity)
    {
        int len;
#if !SQLITE_STANDARD
        len = 0;
        IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype16_interop(stmt._sqlite_stmt, index, ref len);
#else
        len = -1;
        IntPtr p = UnsafeNativeMethods.sqlite3_column_decltype16(stmt._sqlite_stmt, index);
#endif
        nAffinity = ColumnAffinity(stmt, index);

        if ((p != IntPtr.Zero) && ((len > 0) || (len == -1)))
        {
            string declType = UTF16ToString(p, len);

            if (!String.IsNullOrEmpty(declType))
                return declType;
        }

        string[] ar = stmt.TypeDefinitions;

        if (ar != null)
        {
            if (index < ar.Length && ar[index] != null)
                return ar[index];
        }

        return String.Empty;
    }

    internal override string GetText(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len = 0;
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_text16_interop(stmt._sqlite_stmt, index, ref len), len);
#else
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_text16(stmt._sqlite_stmt, index),
        UnsafeNativeMethods.sqlite3_column_bytes16(stmt._sqlite_stmt, index));
#endif
    }

    internal override string ColumnOriginalName(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len = 0;
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_origin_name16_interop(stmt._sqlite_stmt, index, ref len), len);
#else
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_origin_name16(stmt._sqlite_stmt, index), -1);
#endif
    }

    internal override string ColumnDatabaseName(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len = 0;
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_database_name16_interop(stmt._sqlite_stmt, index, ref len), len);
#else
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_database_name16(stmt._sqlite_stmt, index), -1);
#endif
    }

    internal override string ColumnTableName(SQLiteStatement stmt, int index)
    {
#if !SQLITE_STANDARD
      int len = 0;
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_table_name16_interop(stmt._sqlite_stmt, index, ref len), len);
#else
      return UTF16ToString(UnsafeNativeMethods.sqlite3_column_table_name16(stmt._sqlite_stmt, index), -1);
#endif
    }

    internal override string GetParamValueText(IntPtr ptr)
    {
#if !SQLITE_STANDARD
      int len = 0;
      return UTF16ToString(UnsafeNativeMethods.sqlite3_value_text16_interop(ptr, ref len), len);
#else
      return UTF16ToString(UnsafeNativeMethods.sqlite3_value_text16(ptr),
        UnsafeNativeMethods.sqlite3_value_bytes16(ptr));
#endif
    }

    internal override void ReturnError(IntPtr context, string value)
    {
      UnsafeNativeMethods.sqlite3_result_error16(context, value, value.Length * 2);
    }

Added System.Data.SQLite/SQLiteBackup.cs.











































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Joe Mistachkin (joe@mistachkin.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
    using System;

    /// <summary>
    /// Represents a single SQL backup in SQLite.
    /// </summary>
    internal sealed class SQLiteBackup : IDisposable
    {
        /// <summary>
        /// The underlying SQLite object this backup is bound to.
        /// </summary>
        internal SQLiteBase _sql;

        /// <summary>
        /// The actual backup handle.
        /// </summary>
        internal SQLiteBackupHandle _sqlite_backup;

        /// <summary>
        /// The destination database for the backup.
        /// </summary>
        internal IntPtr _destDb;

        /// <summary>
        /// The destination database name for the backup.
        /// </summary>
        internal byte[] _zDestName;

        /// <summary>
        /// The source database for the backup.
        /// </summary>
        internal IntPtr _sourceDb;

        /// <summary>
        /// The source database name for the backup.
        /// </summary>
        internal byte[] _zSourceName;

        /// <summary>
        /// The last result from the StepBackup method of the SQLite3 class.
        /// This is used to determine if the call to the FinishBackup method of
        /// the SQLite3 class should throw an exception when it receives a non-Ok
        /// return code from the core SQLite library.
        /// </summary>
        internal SQLiteErrorCode _stepResult;

        /// <summary>
        /// Initializes the backup.
        /// </summary>
        /// <param name="sqlbase">The base SQLite object.</param>
        /// <param name="backup">The backup handle.</param>
        /// <param name="destDb">The destination database for the backup.</param>
        /// <param name="zDestName">The destination database name for the backup.</param>
        /// <param name="sourceDb">The source database for the backup.</param>
        /// <param name="zSourceName">The source database name for the backup.</param>
        internal SQLiteBackup(
            SQLiteBase sqlbase,
            SQLiteBackupHandle backup,
            IntPtr destDb,
            byte[] zDestName,
            IntPtr sourceDb,
            byte[] zSourceName
            )
        {
            _sql = sqlbase;
            _sqlite_backup = backup;
            _destDb = destDb;
            _zDestName = zDestName;
            _sourceDb = sourceDb;
            _zSourceName = zSourceName;
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region IDisposable Members
        /// <summary>
        /// Disposes and finalizes the backup.
        /// </summary>
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        private bool disposed;
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
        if (disposed)
            throw new ObjectDisposedException(typeof(SQLiteBackup).Name);
#endif
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        private void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    ////////////////////////////////////
                    // dispose managed resources here...
                    ////////////////////////////////////

                    if (_sqlite_backup != null)
                    {
                        _sqlite_backup.Dispose();
                        _sqlite_backup = null;
                    }

                    _zSourceName = null;
                    _sourceDb = IntPtr.Zero;
                    _zDestName = null;
                    _destDb = IntPtr.Zero;
                    _sql = null;
                }

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////

                disposed = true;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region Destructor
        ~SQLiteBackup()
        {
            Dispose(false);
        }
        #endregion
    }
}

Changes to System.Data.SQLite/SQLiteBase.cs.

1
2
3
4
5
6
7
8
9
10
11


12


13
14
15
16
17
18
19
20





21

22

23
24

25
26
27
28
29
30












31
32
33
34































































35
36
37
38
39
40
41


42
43
44
45
46
47
48
49
50
51
52


53
54
55
56
57
58
59
60
61
62
63












64
65
66
67
68
69






70
71
72
73

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88






89
90
91
92
93
94





95
96



































97
98

99


100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116

117
118
119

120





121

122

123
124

125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143




144
145
146
147
148
149
150
151

152







































































































































































153
154

155



156
157


158











159
160
161
162
163
164





165
166
167
168
169

170













171
















172








173








































































































































































174
175
176
177
178






















































179
180
181
182
183
184

185































186

187

















188

189
190

191


192


193

194




































195
196











197

198
199
200
201
202
203
204







205



206

207










































208
209











210

211
212
213
214
215

216
217
218
219
220
221































222
223













224

225








226

227
228
229
230
231
232
233
234
235
236
237
238
239
240



241
242




243









244
245
246
247
248





249
250

















251
252
253


254





255
256






257
258
259
260
261
262
263
264
265

































































































































































































































































































































































































































































































266










































































































































































































































267






268





































































































































































































































269
270
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Data;


  using System.Runtime.InteropServices;


  using System.Collections.Generic;

  /// <summary>
  /// This internal class provides the foundation of SQLite support.  It defines all the abstract members needed to implement
  /// a SQLite data provider, and inherits from SQLiteConvert which allows for simple translations of string to and from SQLite.
  /// </summary>
  internal abstract class SQLiteBase : SQLiteConvert, IDisposable
  {





    internal SQLiteBase(SQLiteDateFormats fmt)

      : base(fmt) { }


    static internal object _lock = new object();


    /// <summary>
    /// Returns a string representing the active version of SQLite
    /// </summary>
    internal abstract string Version { get; }
    /// <summary>












    /// Returns the number of changes the last executing insert/update caused.
    /// </summary>
    internal abstract int Changes { get; }
    /// <summary>































































    /// Opens a database.
    /// </summary>
    /// <remarks>
    /// Implementers should call SQLiteFunction.BindFunctions() and save the array after opening a connection
    /// to bind all attributed user-defined functions and collating sequences to the new connection.
    /// </remarks>
    /// <param name="strFilename">The filename of the database to open.  SQLite automatically creates it if it doesn't exist.</param>


    /// <param name="flags">The open flags to use when creating the connection</param>
    /// <param name="maxPoolSize">The maximum size of the pool for the given filename</param>
    /// <param name="usePool">If true, the connection can be pulled from the connection pool</param>
    internal abstract void Open(string strFilename, SQLiteOpenFlagsEnum flags, int maxPoolSize, bool usePool);
    /// <summary>
    /// Closes the currently-open database.
    /// </summary>
    /// <remarks>
    /// After the database has been closed implemeters should call SQLiteFunction.UnbindFunctions() to deallocate all interop allocated
    /// memory associated with the user-defined functions and collating sequences tied to the closed connection.
    /// </remarks>


    internal abstract void Close();
    /// <summary>
    /// Sets the busy timeout on the connection.  SQLiteCommand will call this before executing any command.
    /// </summary>
    /// <param name="nTimeoutMS">The number of milliseconds to wait before returning SQLITE_BUSY</param>
    internal abstract void SetTimeout(int nTimeoutMS);
    /// <summary>
    /// Returns the text of the last error issued by SQLite
    /// </summary>
    /// <returns></returns>
    internal abstract string SQLiteLastError();













    /// <summary>
    /// When pooling is enabled, force this connection to be disposed rather than returned to the pool
    /// </summary>
    internal abstract void ClearPool();







    /// <summary>
    /// Prepares a SQL statement for execution.
    /// </summary>
    /// <param name="cnn">The source connection preparing the command.  Can be null for any caller except LINQ</param>

    /// <param name="strSql">The SQL command text to prepare</param>
    /// <param name="previous">The previous statement in a multi-statement command, or null if no previous statement exists</param>
    /// <param name="timeoutMS">The timeout to wait before aborting the prepare</param>
    /// <param name="strRemain">The remainder of the statement that was not processed.  Each call to prepare parses the
    /// SQL up to to either the end of the text or to the first semi-colon delimiter.  The remaining text is returned
    /// here for a subsequent call to Prepare() until all the text has been processed.</param>
    /// <returns>Returns an initialized SQLiteStatement.</returns>
    internal abstract SQLiteStatement Prepare(SQLiteConnection cnn, string strSql, SQLiteStatement previous, uint timeoutMS, out string strRemain);
    /// <summary>
    /// Steps through a prepared statement.
    /// </summary>
    /// <param name="stmt">The SQLiteStatement to step through</param>
    /// <returns>True if a row was returned, False if not.</returns>
    internal abstract bool Step(SQLiteStatement stmt);
    /// <summary>






    /// Resets a prepared statement so it can be executed again.  If the error returned is SQLITE_SCHEMA, 
    /// transparently attempt to rebuild the SQL statement and throw an error if that was not possible.
    /// </summary>
    /// <param name="stmt">The statement to reset</param>
    /// <returns>Returns -1 if the schema changed while resetting, 0 if the reset was sucessful or 6 (SQLITE_LOCKED) if the reset failed due to a lock</returns>
    internal abstract int Reset(SQLiteStatement stmt);





    internal abstract void Cancel();




































    internal abstract void Bind_Double(SQLiteStatement stmt, int index, double value);
    internal abstract void Bind_Int32(SQLiteStatement stmt, int index, Int32 value);

    internal abstract void Bind_Int64(SQLiteStatement stmt, int index, Int64 value);


    internal abstract void Bind_Text(SQLiteStatement stmt, int index, string value);
    internal abstract void Bind_Blob(SQLiteStatement stmt, int index, byte[] blobData);
    internal abstract void Bind_DateTime(SQLiteStatement stmt, int index, DateTime dt);
    internal abstract void Bind_Null(SQLiteStatement stmt, int index);

    internal abstract int Bind_ParamCount(SQLiteStatement stmt);
    internal abstract string Bind_ParamName(SQLiteStatement stmt, int index);
    internal abstract int Bind_ParamIndex(SQLiteStatement stmt, string paramName);

    internal abstract int ColumnCount(SQLiteStatement stmt);
    internal abstract string ColumnName(SQLiteStatement stmt, int index);
    internal abstract TypeAffinity ColumnAffinity(SQLiteStatement stmt, int index);
    internal abstract string ColumnType(SQLiteStatement stmt, int index, out TypeAffinity nAffinity);
    internal abstract int ColumnIndex(SQLiteStatement stmt, string columnName);
    internal abstract string ColumnOriginalName(SQLiteStatement stmt, int index);
    internal abstract string ColumnDatabaseName(SQLiteStatement stmt, int index);
    internal abstract string ColumnTableName(SQLiteStatement stmt, int index);

    internal abstract void ColumnMetaData(string dataBase, string table, string column, out string dataType, out string collateSequence, out bool notNull, out bool primaryKey, out bool autoIncrement);
    internal abstract void GetIndexColumnExtendedInfo(string database, string index, string column, out int sortMode, out int onError, out string collationSequence);


    internal abstract double GetDouble(SQLiteStatement stmt, int index);





    internal abstract Int32 GetInt32(SQLiteStatement stmt, int index);

    internal abstract Int64 GetInt64(SQLiteStatement stmt, int index);

    internal abstract string GetText(SQLiteStatement stmt, int index);
    internal abstract long GetBytes(SQLiteStatement stmt, int index, int nDataoffset, byte[] bDest, int nStart, int nLength);

    internal abstract long GetChars(SQLiteStatement stmt, int index, int nDataoffset, char[] bDest, int nStart, int nLength);
    internal abstract DateTime GetDateTime(SQLiteStatement stmt, int index);
    internal abstract bool IsNull(SQLiteStatement stmt, int index);

    internal abstract void CreateCollation(string strCollation, SQLiteCollation func, SQLiteCollation func16);
    internal abstract void CreateFunction(string strFunction, int nArgs, bool needCollSeq, SQLiteCallback func, SQLiteCallback funcstep, SQLiteFinalCallback funcfinal);
    internal abstract CollationSequence GetCollationSequence(SQLiteFunction func, IntPtr context);
    internal abstract int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, string s1, string s2);
    internal abstract int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, char[] c1, char[] c2);

    internal abstract int AggregateCount(IntPtr context);
    internal abstract IntPtr AggregateContext(IntPtr context);

    internal abstract long GetParamValueBytes(IntPtr ptr, int nDataOffset, byte[] bDest, int nStart, int nLength);
    internal abstract double GetParamValueDouble(IntPtr ptr);
    internal abstract int GetParamValueInt32(IntPtr ptr);
    internal abstract Int64 GetParamValueInt64(IntPtr ptr);
    internal abstract string GetParamValueText(IntPtr ptr);
    internal abstract TypeAffinity GetParamValueType(IntPtr ptr);





    internal abstract void ReturnBlob(IntPtr context, byte[] value);
    internal abstract void ReturnDouble(IntPtr context, double value);
    internal abstract void ReturnError(IntPtr context, string value);
    internal abstract void ReturnInt32(IntPtr context, Int32 value);
    internal abstract void ReturnInt64(IntPtr context, Int64 value);
    internal abstract void ReturnNull(IntPtr context);
    internal abstract void ReturnText(IntPtr context, string value);









































































































































































    internal abstract void SetPassword(byte[] passwordBytes);
    internal abstract void ChangePassword(byte[] newPasswordBytes);





    internal abstract void SetUpdateHook(SQLiteUpdateCallback func);
    internal abstract void SetCommitHook(SQLiteCommitCallback func);


    internal abstract void SetRollbackHook(SQLiteRollbackCallback func);












    internal abstract int GetCursorForTable(SQLiteStatement stmt, int database, int rootPage);
    internal abstract long GetRowIdForCursor(SQLiteStatement stmt, int cursor);

    internal abstract object GetValue(SQLiteStatement stmt, int index, SQLiteType typ);






    internal abstract bool AutoCommit
    {
      get;
    }


    protected virtual void Dispose(bool bDisposing)













    {
















    }

















































































































































































    public void Dispose()
    {
      Dispose(true);
      GC.SuppressFinalize(this);
    }























































    // These statics are here for lack of a better place to put them.
    // They exist here because they are called during the finalization of
    // a SQLiteStatementHandle, SQLiteConnectionHandle, and SQLiteFunctionCookieHandle.
    // Therefore these functions have to be static, and have to be low-level.


    internal static string SQLiteLastError(SQLiteConnectionHandle db)































    {

#if !SQLITE_STANDARD

















      int len;

      return UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg_interop(db, out len), len);
#else

      return UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg(db), -1);


#endif


    }






































    internal static void FinalizeStatement(SQLiteStatementHandle stmt)
    {











      lock (_lock)

      {
#if !SQLITE_STANDARD
        int n = UnsafeNativeMethods.sqlite3_finalize_interop(stmt);
#else
      int n = UnsafeNativeMethods.sqlite3_finalize(stmt);
#endif
        if (n > 0) throw new SQLiteException(n, null);







      }



    }












































    internal static void CloseConnection(SQLiteConnectionHandle db)
    {











      lock (_lock)

      {
#if !SQLITE_STANDARD
        int n = UnsafeNativeMethods.sqlite3_close_interop(db);
#else
      ResetConnection(db);

      int n = UnsafeNativeMethods.sqlite3_close(db);
#endif
        if (n > 0) throw new SQLiteException(n, SQLiteLastError(db));
      }
    }
































    internal static void ResetConnection(SQLiteConnectionHandle db)
    {













      lock (_lock)

      {








        IntPtr stmt = IntPtr.Zero;

        int n;
        do
        {
          stmt = UnsafeNativeMethods.sqlite3_next_stmt(db, stmt);
          if (stmt != IntPtr.Zero)
          {
#if !SQLITE_STANDARD
            n = UnsafeNativeMethods.sqlite3_reset_interop(stmt);
#else
            n = UnsafeNativeMethods.sqlite3_reset(stmt);
#endif
          }
        } while (stmt != IntPtr.Zero);




        if (IsAutocommit(db) == false) // a transaction is pending on the connection
        {




          n = UnsafeNativeMethods.sqlite3_exec(db, ToUTF8("ROLLBACK"), IntPtr.Zero, IntPtr.Zero, out stmt);









          if (n > 0) throw new SQLiteException(n, SQLiteLastError(db));
        }
      }
    }






    internal static bool IsAutocommit(SQLiteConnectionHandle hdl)
    {

















      return (UnsafeNativeMethods.sqlite3_get_autocommit(hdl) == 1);
    }
  }








  internal interface ISQLiteSchemaExtensions
  {






    void BuildTempSchema(SQLiteConnection cnn);
  }

  [Flags]
  internal enum SQLiteOpenFlagsEnum
  {
    None = 0,
    ReadOnly = 0x01,
    ReadWrite = 0x02,

































































































































































































































































































































































































































































































    Create = 0x04,










































































































































































































































    SharedCache = 0x01000000,






    Default = 0x06,





































































































































































































































  }
}



|






|
>
>

>
>
|







>
>
>
>
>
|
>
|
>

|
>






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




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







>
>
|


|







>
>
|









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






>
>
>
>
>
>




>







|







>
>
>
>
>
>
|




|
>
>
>
>
>


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

|
|
|




|




>
|
|

>

>
>
>
>
>

>

>


>




|
|













>
>
>
>








>

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

>
>
>


>
>

>
>
>
>
>
>
>
>
>
>
>




|

>
>
>
>
>





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

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


|
|

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



|


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

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

|

|

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

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

|

|
>
|

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

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

|

|

|
|

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

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

>
>
>
>
>
>
|






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


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Collections.Generic;

#if !PLATFORM_COMPACTFRAMEWORK
  using System.Runtime.InteropServices;
#endif

  using System.Threading;

  /// <summary>
  /// This internal class provides the foundation of SQLite support.  It defines all the abstract members needed to implement
  /// a SQLite data provider, and inherits from SQLiteConvert which allows for simple translations of string to and from SQLite.
  /// </summary>
  internal abstract class SQLiteBase : SQLiteConvert, IDisposable
  {
    #region Private Constants
    /// <summary>
    /// The error code used for logging exceptions caught in user-provided
    /// code.
    /// </summary>
    internal const int COR_E_EXCEPTION = unchecked((int)0x80131500);
    #endregion

    /////////////////////////////////////////////////////////////////////////

    internal SQLiteBase(SQLiteDateFormats fmt, DateTimeKind kind, string fmtString)
      : base(fmt, kind, fmtString) { }

    /// <summary>
    /// Returns a string representing the active version of SQLite
    /// </summary>
    internal abstract string Version { get; }
    /// <summary>
    /// Returns an integer representing the active version of SQLite
    /// </summary>
    internal abstract int VersionNumber { get; }
    /// <summary>
    /// Returns non-zero if this connection to the database is read-only.
    /// </summary>
    internal abstract bool IsReadOnly(string name);
    /// <summary>
    /// Returns the rowid of the most recent successful INSERT into the database from this connection.
    /// </summary>
    internal abstract long LastInsertRowId { get; }
    /// <summary>
    /// Returns the number of changes the last executing insert/update caused.
    /// </summary>
    internal abstract int Changes { get; }
    /// <summary>
    /// Returns the amount of memory (in bytes) currently in use by the SQLite core library.  This is not really a per-connection
    /// value, it is global to the process.
    /// </summary>
    internal abstract long MemoryUsed { get; }
    /// <summary>
    /// Returns the maximum amount of memory (in bytes) used by the SQLite core library since the high-water mark was last reset.
    /// This is not really a per-connection value, it is global to the process.
    /// </summary>
    internal abstract long MemoryHighwater { get; }
    /// <summary>
    /// Returns non-zero if the underlying native connection handle is owned by this instance.
    /// </summary>
    internal abstract bool OwnHandle { get; }
    /// <summary>
    /// Non-zero to log all calls to prepare a SQL query.
    /// </summary>
    internal abstract bool ForceLogPrepare { get; }
    /// <summary>
    /// Non-zero to log all calls to retry a SQL query.
    /// </summary>
    internal abstract bool ForceLogRetry { get; }
    /// <summary>
    /// Returns the logical list of functions associated with this connection.
    /// </summary>
    internal abstract IDictionary<SQLiteFunctionAttribute, SQLiteFunction> Functions { get; }
    /// <summary>
    /// Sets the status of the memory usage tracking subsystem in the SQLite core library.  By default, this is enabled.
    /// If this is disabled, memory usage tracking will not be performed.  This is not really a per-connection value, it is
    /// global to the process.
    /// </summary>
    /// <param name="value">Non-zero to enable memory usage tracking, zero otherwise.</param>
    /// <returns>A standard SQLite return code (i.e. zero for success and non-zero for failure).</returns>
    internal abstract SQLiteErrorCode SetMemoryStatus(bool value);
    /// <summary>
    /// Attempts to free as much heap memory as possible for the database connection.
    /// </summary>
    /// <returns>A standard SQLite return code (i.e. zero for success and non-zero for failure).</returns>
    internal abstract SQLiteErrorCode ReleaseMemory();
    /// <summary>
    /// Shutdown the SQLite engine so that it can be restarted with different config options.
    /// We depend on auto initialization to recover.
    /// </summary>
    internal abstract SQLiteErrorCode Shutdown();
    /// <summary>
    /// Determines if the associated native connection handle is open.
    /// </summary>
    /// <returns>
    /// Non-zero if a database connection is open.
    /// </returns>
    internal abstract bool IsOpen();
    /// <summary>
    /// Returns the fully qualified path and file name for the currently open
    /// database, if any.
    /// </summary>
    /// <param name="dbName">
    /// The name of the attached database to query.
    /// </param>
    /// <returns>
    /// The fully qualified path and file name for the currently open database,
    /// if any.
    /// </returns>
    internal abstract string GetFileName(string dbName);
    /// <summary>
    /// Opens a database.
    /// </summary>
    /// <remarks>
    /// Implementers should call SQLiteFunction.BindFunctions() and save the array after opening a connection
    /// to bind all attributed user-defined functions and collating sequences to the new connection.
    /// </remarks>
    /// <param name="strFilename">The filename of the database to open.  SQLite automatically creates it if it doesn't exist.</param>
    /// <param name="vfsName">The name of the VFS to use -OR- null to use the default VFS.</param>
    /// <param name="connectionFlags">The flags associated with the parent connection object</param>
    /// <param name="openFlags">The open flags to use when creating the connection</param>
    /// <param name="maxPoolSize">The maximum size of the pool for the given filename</param>
    /// <param name="usePool">If true, the connection can be pulled from the connection pool</param>
    internal abstract void Open(string strFilename, string vfsName, SQLiteConnectionFlags connectionFlags, SQLiteOpenFlagsEnum openFlags, int maxPoolSize, bool usePool);
    /// <summary>
    /// Closes the currently-open database.
    /// </summary>
    /// <remarks>
    /// After the database has been closed implemeters should call SQLiteFunction.UnbindFunctions() to deallocate all interop allocated
    /// memory associated with the user-defined functions and collating sequences tied to the closed connection.
    /// </remarks>
    /// <param name="disposing">Non-zero if connection is being disposed, zero otherwise.</param>
    /// <returns>Returns non-zero if the connection was actually closed (i.e. and not simply returned to a pool, etc).</returns>
    internal abstract bool Close(bool disposing);
    /// <summary>
    /// Sets the busy timeout on the connection.  SQLiteCommand will call this before executing any command.
    /// </summary>
    /// <param name="nTimeoutMS">The number of milliseconds to wait before returning SQLITE_BUSY</param>
    internal abstract void SetTimeout(int nTimeoutMS);
    /// <summary>
    /// Returns the text of the last error issued by SQLite
    /// </summary>
    /// <returns></returns>
    internal abstract string GetLastError();

    /// <summary>
    /// Returns the text of the last error issued by SQLite -OR- the specified default error text if
    /// none is available from the SQLite core library.
    /// </summary>
    /// <param name="defValue">
    /// The error text to return in the event that one is not available from the SQLite core library.
    /// </param>
    /// <returns>
    /// The error text.
    /// </returns>
    internal abstract string GetLastError(string defValue);

    /// <summary>
    /// When pooling is enabled, force this connection to be disposed rather than returned to the pool
    /// </summary>
    internal abstract void ClearPool();

    /// <summary>
    /// When pooling is enabled, returns the number of pool entries matching the current file name.
    /// </summary>
    /// <returns>The number of pool entries matching the current file name.</returns>
    internal abstract int CountPool();

    /// <summary>
    /// Prepares a SQL statement for execution.
    /// </summary>
    /// <param name="cnn">The source connection preparing the command.  Can be null for any caller except LINQ</param>
    /// <param name="command">The source command.</param>
    /// <param name="strSql">The SQL command text to prepare</param>
    /// <param name="previous">The previous statement in a multi-statement command, or null if no previous statement exists</param>
    /// <param name="timeoutMS">The timeout to wait before aborting the prepare</param>
    /// <param name="strRemain">The remainder of the statement that was not processed.  Each call to prepare parses the
    /// SQL up to to either the end of the text or to the first semi-colon delimiter.  The remaining text is returned
    /// here for a subsequent call to Prepare() until all the text has been processed.</param>
    /// <returns>Returns an initialized SQLiteStatement.</returns>
    internal abstract SQLiteStatement Prepare(SQLiteConnection cnn, SQLiteCommand command, string strSql, SQLiteStatement previous, uint timeoutMS, ref string strRemain);
    /// <summary>
    /// Steps through a prepared statement.
    /// </summary>
    /// <param name="stmt">The SQLiteStatement to step through</param>
    /// <returns>True if a row was returned, False if not.</returns>
    internal abstract bool Step(SQLiteStatement stmt);
    /// <summary>
    /// Returns non-zero if the specified statement is read-only in nature.
    /// </summary>
    /// <param name="stmt">The statement to check.</param>
    /// <returns>True if the outer query is read-only.</returns>
    internal abstract bool IsReadOnly(SQLiteStatement stmt);
    /// <summary>
    /// Resets a prepared statement so it can be executed again.  If the error returned is SQLITE_SCHEMA,
    /// transparently attempt to rebuild the SQL statement and throw an error if that was not possible.
    /// </summary>
    /// <param name="stmt">The statement to reset</param>
    /// <returns>Returns -1 if the schema changed while resetting, 0 if the reset was sucessful or 6 (SQLITE_LOCKED) if the reset failed due to a lock</returns>
    internal abstract SQLiteErrorCode Reset(SQLiteStatement stmt);

    /// <summary>
    /// Attempts to interrupt the query currently executing on the associated
    /// native database connection.
    /// </summary>
    internal abstract void Cancel();

    /// <summary>
    /// Returns non-zero if the operation for the current connection has been
    /// interrupted.
    /// </summary>
    internal abstract bool IsCanceled();

    /// <summary>
    /// This function binds a user-defined function to the connection.
    /// </summary>
    /// <param name="functionAttribute">
    /// The <see cref="SQLiteFunctionAttribute"/> object instance containing
    /// the metadata for the function to be bound.
    /// </param>
    /// <param name="function">
    /// The <see cref="SQLiteFunction"/> object instance that implements the
    /// function to be bound.
    /// </param>
    /// <param name="flags">
    /// The flags associated with the parent connection object.
    /// </param>
    internal abstract void BindFunction(SQLiteFunctionAttribute functionAttribute, SQLiteFunction function, SQLiteConnectionFlags flags);

    /// <summary>
    /// This function unbinds a user-defined function from the connection.
    /// </summary>
    /// <param name="functionAttribute">
    /// The <see cref="SQLiteFunctionAttribute"/> object instance containing
    /// the metadata for the function to be unbound.
    /// </param>
    /// <param name="flags">
    /// The flags associated with the parent connection object.
    /// </param>
    /// <returns>Non-zero if the function was unbound.</returns>
    internal abstract bool UnbindFunction(SQLiteFunctionAttribute functionAttribute, SQLiteConnectionFlags flags);

    internal abstract void Bind_Double(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, double value);
    internal abstract void Bind_Int32(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, Int32 value);
    internal abstract void Bind_UInt32(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, UInt32 value);
    internal abstract void Bind_Int64(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, Int64 value);
    internal abstract void Bind_UInt64(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, UInt64 value);
    internal abstract void Bind_Boolean(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, bool value);
    internal abstract void Bind_Text(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, string value);
    internal abstract void Bind_Blob(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, byte[] blobData);
    internal abstract void Bind_DateTime(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, DateTime dt);
    internal abstract void Bind_Null(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index);

    internal abstract int Bind_ParamCount(SQLiteStatement stmt, SQLiteConnectionFlags flags);
    internal abstract string Bind_ParamName(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index);
    internal abstract int Bind_ParamIndex(SQLiteStatement stmt, SQLiteConnectionFlags flags, string paramName);

    internal abstract int ColumnCount(SQLiteStatement stmt);
    internal abstract string ColumnName(SQLiteStatement stmt, int index);
    internal abstract TypeAffinity ColumnAffinity(SQLiteStatement stmt, int index);
    internal abstract string ColumnType(SQLiteStatement stmt, int index, ref TypeAffinity nAffinity);
    internal abstract int ColumnIndex(SQLiteStatement stmt, string columnName);
    internal abstract string ColumnOriginalName(SQLiteStatement stmt, int index);
    internal abstract string ColumnDatabaseName(SQLiteStatement stmt, int index);
    internal abstract string ColumnTableName(SQLiteStatement stmt, int index);
    internal abstract bool DoesTableExist(string dataBase, string table);
    internal abstract bool ColumnMetaData(string dataBase, string table, string column, bool canThrow, ref string dataType, ref string collateSequence, ref bool notNull, ref bool primaryKey, ref bool autoIncrement);
    internal abstract void GetIndexColumnExtendedInfo(string database, string index, string column, ref int sortMode, ref int onError, ref string collationSequence);

    internal abstract object GetObject(SQLiteStatement stmt, int index);
    internal abstract double GetDouble(SQLiteStatement stmt, int index);
    internal abstract Boolean GetBoolean(SQLiteStatement stmt, int index);
    internal abstract SByte GetSByte(SQLiteStatement stmt, int index);
    internal abstract Byte GetByte(SQLiteStatement stmt, int index);
    internal abstract Int16 GetInt16(SQLiteStatement stmt, int index);
    internal abstract UInt16 GetUInt16(SQLiteStatement stmt, int index);
    internal abstract Int32 GetInt32(SQLiteStatement stmt, int index);
    internal abstract UInt32 GetUInt32(SQLiteStatement stmt, int index);
    internal abstract Int64 GetInt64(SQLiteStatement stmt, int index);
    internal abstract UInt64 GetUInt64(SQLiteStatement stmt, int index);
    internal abstract string GetText(SQLiteStatement stmt, int index);
    internal abstract long GetBytes(SQLiteStatement stmt, int index, int nDataoffset, byte[] bDest, int nStart, int nLength);
    internal abstract char GetChar(SQLiteStatement stmt, int index);
    internal abstract long GetChars(SQLiteStatement stmt, int index, int nDataoffset, char[] bDest, int nStart, int nLength);
    internal abstract DateTime GetDateTime(SQLiteStatement stmt, int index);
    internal abstract bool IsNull(SQLiteStatement stmt, int index);

    internal abstract SQLiteErrorCode CreateCollation(string strCollation, SQLiteCollation func, SQLiteCollation func16, bool @throw);
    internal abstract SQLiteErrorCode CreateFunction(FunctionType type, string strFunction, int nArgs, SQLiteFunctionFlags flags, bool needCollSeq, SQLiteCallback func, SQLiteCallback funcstep, SQLiteFinalCallback funcfinal, SQLiteFinalCallback funcvalue, SQLiteCallback funcinverse, bool @throw);
    internal abstract CollationSequence GetCollationSequence(SQLiteFunction func, IntPtr context);
    internal abstract int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, string s1, string s2);
    internal abstract int ContextCollateCompare(CollationEncodingEnum enc, IntPtr context, char[] c1, char[] c2);

    internal abstract int AggregateCount(IntPtr context);
    internal abstract IntPtr AggregateContext(IntPtr context);

    internal abstract long GetParamValueBytes(IntPtr ptr, int nDataOffset, byte[] bDest, int nStart, int nLength);
    internal abstract double GetParamValueDouble(IntPtr ptr);
    internal abstract int GetParamValueInt32(IntPtr ptr);
    internal abstract Int64 GetParamValueInt64(IntPtr ptr);
    internal abstract string GetParamValueText(IntPtr ptr);
    internal abstract TypeAffinity GetParamValueType(IntPtr ptr);
    internal abstract uint GetParamValueSubType(IntPtr ptr);
    internal abstract TypeAffinity GetParamValueNumericType(IntPtr ptr);
    internal abstract int GetParamValueNoChange(IntPtr ptr);
    internal abstract int GetParamValueFromBind(IntPtr ptr);

    internal abstract void ReturnBlob(IntPtr context, byte[] value);
    internal abstract void ReturnDouble(IntPtr context, double value);
    internal abstract void ReturnError(IntPtr context, string value);
    internal abstract void ReturnInt32(IntPtr context, Int32 value);
    internal abstract void ReturnInt64(IntPtr context, Int64 value);
    internal abstract void ReturnNull(IntPtr context);
    internal abstract void ReturnText(IntPtr context, string value);
    internal abstract void ReturnSubType(IntPtr context, uint value);

#if INTEROP_VIRTUAL_TABLE
    /// <summary>
    /// Calls the native SQLite core library in order to create a disposable
    /// module containing the implementation of a virtual table.
    /// </summary>
    /// <param name="module">
    /// The module object to be used when creating the native disposable module.
    /// </param>
    /// <param name="flags">
    /// The flags for the associated <see cref="SQLiteConnection" /> object instance.
    /// </param>
    internal abstract void CreateModule(SQLiteModule module, SQLiteConnectionFlags flags);

    /// <summary>
    /// Calls the native SQLite core library in order to cleanup the resources
    /// associated with a module containing the implementation of a virtual table.
    /// </summary>
    /// <param name="module">
    /// The module object previously passed to the <see cref="CreateModule" />
    /// method.
    /// </param>
    /// <param name="flags">
    /// The flags for the associated <see cref="SQLiteConnection" /> object instance.
    /// </param>
    internal abstract void DisposeModule(SQLiteModule module, SQLiteConnectionFlags flags);

    /// <summary>
    /// Calls the native SQLite core library in order to declare a virtual table
    /// in response to a call into the <see cref="ISQLiteNativeModule.xCreate" />
    /// or <see cref="ISQLiteNativeModule.xConnect" /> virtual table methods.
    /// </summary>
    /// <param name="module">
    /// The virtual table module that is to be responsible for the virtual table
    /// being declared.
    /// </param>
    /// <param name="strSql">
    /// The string containing the SQL statement describing the virtual table to
    /// be declared.
    /// </param>
    /// <param name="error">
    /// Upon success, the contents of this parameter are undefined.  Upon failure,
    /// it should contain an appropriate error message.
    /// </param>
    /// <returns>
    /// A standard SQLite return code.
    /// </returns>
    internal abstract SQLiteErrorCode DeclareVirtualTable(SQLiteModule module, string strSql, ref string error);

    /// <summary>
    /// Calls the native SQLite core library in order to declare a virtual table
    /// function in response to a call into the <see cref="ISQLiteNativeModule.xCreate" />
    /// or <see cref="ISQLiteNativeModule.xConnect" /> virtual table methods.
    /// </summary>
    /// <param name="module">
    /// The virtual table module that is to be responsible for the virtual table
    /// function being declared.
    /// </param>
    /// <param name="argumentCount">
    /// The number of arguments to the function being declared.
    /// </param>
    /// <param name="name">
    /// The name of the function being declared.
    /// </param>
    /// <param name="error">
    /// Upon success, the contents of this parameter are undefined.  Upon failure,
    /// it should contain an appropriate error message.
    /// </param>
    /// <returns>
    /// A standard SQLite return code.
    /// </returns>
    internal abstract SQLiteErrorCode DeclareVirtualFunction(SQLiteModule module, int argumentCount, string name, ref string error);
#endif

    /// <summary>
    /// Returns the current and/or highwater values for the specified database status parameter.
    /// </summary>
    /// <param name="option">
    /// The database status parameter to query.
    /// </param>
    /// <param name="reset">
    /// Non-zero to reset the highwater value to the current value.
    /// </param>
    /// <param name="current">
    /// If applicable, receives the current value.
    /// </param>
    /// <param name="highwater">
    /// If applicable, receives the highwater value.
    /// </param>
    /// <returns>
    /// A standard SQLite return code.
    /// </returns>
    internal abstract SQLiteErrorCode GetStatusParameter(SQLiteStatusOpsEnum option, bool reset, ref int current, ref int highwater);
    /// <summary>
    /// Change a limit value for the database.
    /// </summary>
    /// <param name="option">
    /// The database limit to change.
    /// </param>
    /// <param name="value">
    /// The new value for the specified limit.
    /// </param>
    /// <returns>
    /// The old value for the specified limit -OR- negative one if an error
    /// occurs.
    /// </returns>
    internal abstract int SetLimitOption(SQLiteLimitOpsEnum option, int value);
    /// <summary>
    /// Change a configuration option value for the database.
    /// </summary>
    /// <param name="option">
    /// The database configuration option to change.
    /// </param>
    /// <param name="value">
    /// The new value for the specified configuration option.
    /// </param>
    /// <returns>
    /// A standard SQLite return code.
    /// </returns>
    internal abstract SQLiteErrorCode SetConfigurationOption(SQLiteConfigDbOpsEnum option, object value);
    /// <summary>
    /// Enables or disables extension loading by SQLite.
    /// </summary>
    /// <param name="bOnOff">
    /// True to enable loading of extensions, false to disable.
    /// </param>
    internal abstract void SetLoadExtension(bool bOnOff);
    /// <summary>
    /// Loads a SQLite extension library from the named file.
    /// </summary>
    /// <param name="fileName">
    /// The name of the dynamic link library file containing the extension.
    /// </param>
    /// <param name="procName">
    /// The name of the exported function used to initialize the extension.
    /// If null, the default "sqlite3_extension_init" will be used.
    /// </param>
    internal abstract void LoadExtension(string fileName, string procName);
    /// <summary>
    /// Enables or disables extened result codes returned by SQLite
    /// </summary>
    /// <param name="bOnOff">true to enable extended result codes, false to disable.</param>
    /// <returns></returns>
    internal abstract void SetExtendedResultCodes(bool bOnOff);
    /// <summary>
    /// Returns the numeric result code for the most recent failed SQLite API call
    /// associated with the database connection.
    /// </summary>
    /// <returns>Result code</returns>
    internal abstract SQLiteErrorCode ResultCode();
    /// <summary>
    /// Returns the extended numeric result code for the most recent failed SQLite API call
    /// associated with the database connection.
    /// </summary>
    /// <returns>Extended result code</returns>
    internal abstract SQLiteErrorCode ExtendedResultCode();

    /// <summary>
    /// Add a log message via the SQLite sqlite3_log interface.
    /// </summary>
    /// <param name="iErrCode">Error code to be logged with the message.</param>
    /// <param name="zMessage">String to be logged.  Unlike the SQLite sqlite3_log()
    /// interface, this should be pre-formatted.  Consider using the
    /// String.Format() function.</param>
    /// <returns></returns>
    internal abstract void LogMessage(SQLiteErrorCode iErrCode, string zMessage);

#if INTEROP_CODEC || INTEROP_INCLUDE_SEE
    internal abstract void SetPassword(byte[] passwordBytes, bool asText);
    internal abstract void ChangePassword(byte[] newPasswordBytes, bool asText);
#endif

    internal abstract void SetBusyHook(SQLiteBusyCallback func);
    internal abstract void SetProgressHook(int nOps, SQLiteProgressCallback func);
    internal abstract void SetAuthorizerHook(SQLiteAuthorizerCallback func);
    internal abstract void SetUpdateHook(SQLiteUpdateCallback func);
    internal abstract void SetCommitHook(SQLiteCommitCallback func);
    internal abstract void SetTraceCallback(SQLiteTraceCallback func);
    internal abstract void SetTraceCallback2(SQLiteTraceFlags mask, SQLiteTraceCallback2 func);
    internal abstract void SetRollbackHook(SQLiteRollbackCallback func);
    internal abstract SQLiteErrorCode SetLogCallback(SQLiteLogCallback func);
    internal abstract SQLiteTransactionState GetTransactionState(string schema);

    /// <summary>
    /// Checks if the SQLite core library has been initialized in the current process.
    /// </summary>
    /// <returns>
    /// Non-zero if the SQLite core library has been initialized in the current process,
    /// zero otherwise.
    /// </returns>
    internal abstract bool IsInitialized();

    internal abstract int GetCursorForTable(SQLiteStatement stmt, int database, int rootPage);
    internal abstract long GetRowIdForCursor(SQLiteStatement stmt, int cursor);

    internal abstract object GetValue(SQLiteStatement stmt, SQLiteConnectionFlags flags, int index, SQLiteType typ);

    /// <summary>
    /// Returns non-zero if the given database connection is in autocommit mode.
    /// Autocommit mode is on by default.  Autocommit mode is disabled by a BEGIN
    /// statement.  Autocommit mode is re-enabled by a COMMIT or ROLLBACK.
    /// </summary>
    internal abstract bool AutoCommit
    {
      get;
    }

    internal abstract SQLiteErrorCode FileControl(string zDbName, int op, IntPtr pArg);

    /// <summary>
    /// Creates a new SQLite backup object based on the provided destination
    /// database connection.  The source database connection is the one
    /// associated with this object.  The source and destination database
    /// connections cannot be the same.
    /// </summary>
    /// <param name="destCnn">The destination database connection.</param>
    /// <param name="destName">The destination database name.</param>
    /// <param name="sourceName">The source database name.</param>
    /// <returns>The newly created backup object.</returns>
    internal abstract SQLiteBackup InitializeBackup(
        SQLiteConnection destCnn, string destName,
        string sourceName);

    /// <summary>
    /// Copies up to N pages from the source database to the destination
    /// database associated with the specified backup object.
    /// </summary>
    /// <param name="backup">The backup object to use.</param>
    /// <param name="nPage">
    /// The number of pages to copy or negative to copy all remaining pages.
    /// </param>
    /// <param name="retry">
    /// Set to true if the operation needs to be retried due to database
    /// locking issues.
    /// </param>
    /// <returns>
    /// True if there are more pages to be copied, false otherwise.
    /// </returns>
    internal abstract bool StepBackup(SQLiteBackup backup, int nPage, ref bool retry);

    /// <summary>
    /// Returns the number of pages remaining to be copied from the source
    /// database to the destination database associated with the specified
    /// backup object.
    /// </summary>
    /// <param name="backup">The backup object to check.</param>
    /// <returns>The number of pages remaining to be copied.</returns>
    internal abstract int RemainingBackup(SQLiteBackup backup);

    /// <summary>
    /// Returns the total number of pages in the source database associated
    /// with the specified backup object.
    /// </summary>
    /// <param name="backup">The backup object to check.</param>
    /// <returns>The total number of pages in the source database.</returns>
    internal abstract int PageCountBackup(SQLiteBackup backup);

    /// <summary>
    /// Destroys the backup object, rolling back any backup that may be in
    /// progess.
    /// </summary>
    /// <param name="backup">The backup object to destroy.</param>
    internal abstract void FinishBackup(SQLiteBackup backup);

    ///////////////////////////////////////////////////////////////////////////////////////////////

#if PLATFORM_COMPACTFRAMEWORK
    protected static int BumpCreateCount()
    {
        return Interlocked.Increment(ref _createCount);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    protected static int BumpOpenCount()
    {
        return Interlocked.Increment(ref _openCount);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    protected static int BumpCloseCount()
    {
        return Interlocked.Increment(ref _closeCount);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    protected static int BumpDisposeCount()
    {
        return Interlocked.Increment(ref _disposeCount);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    protected static int BumpFinalizeCount()
    {
        return Interlocked.Increment(ref _finalizeCount);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private static int _createCount;
    internal static int CreateCount
    {
        get { return Interlocked.CompareExchange(ref _createCount, 0, 0); }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private static int _openCount;
    internal static int OpenCount
    {
        get { return Interlocked.CompareExchange(ref _openCount, 0, 0); }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private static int _closeCount;
    internal static int CloseCount
    {
        get { return Interlocked.CompareExchange(ref _closeCount, 0, 0); }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private static int _disposeCount;
    internal static int DisposeCount
    {
        get { return Interlocked.CompareExchange(ref _disposeCount, 0, 0); }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private static int _finalizeCount;
    internal static int FinalizeCount
    {
        get { return Interlocked.CompareExchange(ref _finalizeCount, 0, 0); }
    }
#else
    protected static long BumpCreateCount()
    {
        return Interlocked.Increment(ref _createCount);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    protected static long BumpOpenCount()
    {
        return Interlocked.Increment(ref _openCount);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    protected static long BumpCloseCount()
    {
        return Interlocked.Increment(ref _closeCount);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    protected static long BumpDisposeCount()
    {
        return Interlocked.Increment(ref _disposeCount);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    protected static long BumpFinalizeCount()
    {
        return Interlocked.Increment(ref _finalizeCount);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private static long _createCount;
    internal static long CreateCount
    {
        get { return Interlocked.CompareExchange(ref _createCount, 0, 0); }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private static long _openCount;
    internal static long OpenCount
    {
        get { return Interlocked.CompareExchange(ref _openCount, 0, 0); }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private static long _closeCount;
    internal static long CloseCount
    {
        get { return Interlocked.CompareExchange(ref _closeCount, 0, 0); }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private static long _disposeCount;
    internal static long DisposeCount
    {
        get { return Interlocked.CompareExchange(ref _disposeCount, 0, 0); }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private static long _finalizeCount;
    internal static long FinalizeCount
    {
        get { return Interlocked.CompareExchange(ref _finalizeCount, 0, 0); }
    }
#endif

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable Members
    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable "Pattern" Members
    private bool disposed;
    private void CheckDisposed() /* throw */
    {
#if THROW_ON_DISPOSED
        if (disposed)
            throw new ObjectDisposedException(typeof(SQLiteBase).Name);
#endif
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    protected bool wasDisposed;
    protected virtual void Dispose(bool disposing)
    {
        if (wasDisposed)
        {
            /* IGNORED */
            BumpDisposeCount();
        }

        if (!disposed)
        {
            //if (disposing)
            //{
            //    ////////////////////////////////////
            //    // dispose managed resources here...
            //    ////////////////////////////////////
            //}

            //////////////////////////////////////
            // release unmanaged resources here...
            //////////////////////////////////////

            disposed = true;
        }
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region Destructor
    ~SQLiteBase()
    {
        BumpFinalizeCount();
        Dispose(false);
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    // These statics are here for lack of a better place to put them.
    // They exist here because they are called during the finalization of
    // SQLiteStatementHandle and SQLiteConnectionHandle, etc.
    // Therefore these functions have to be static, and have to be low-level.

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private static string[] _errorMessages = {
        /* SQLITE_OK          */ "not an error",
        /* SQLITE_ERROR       */ "SQL logic error",
        /* SQLITE_INTERNAL    */ "internal logic error",
        /* SQLITE_PERM        */ "access permission denied",
        /* SQLITE_ABORT       */ "query aborted",
        /* SQLITE_BUSY        */ "database is locked",
        /* SQLITE_LOCKED      */ "database table is locked",
        /* SQLITE_NOMEM       */ "out of memory",
        /* SQLITE_READONLY    */ "attempt to write a readonly database",
        /* SQLITE_INTERRUPT   */ "interrupted",
        /* SQLITE_IOERR       */ "disk I/O error",
        /* SQLITE_CORRUPT     */ "database disk image is malformed",
        /* SQLITE_NOTFOUND    */ "unknown operation",
        /* SQLITE_FULL        */ "database or disk is full",
        /* SQLITE_CANTOPEN    */ "unable to open database file",
        /* SQLITE_PROTOCOL    */ "locking protocol",
        /* SQLITE_EMPTY       */ "table contains no data",
        /* SQLITE_SCHEMA      */ "database schema has changed",
        /* SQLITE_TOOBIG      */ "string or blob too big",
        /* SQLITE_CONSTRAINT  */ "constraint failed",
        /* SQLITE_MISMATCH    */ "datatype mismatch",
        /* SQLITE_MISUSE      */ "bad parameter or other API misuse",
        /* SQLITE_NOLFS       */ "large file support is disabled",
        /* SQLITE_AUTH        */ "authorization denied",
        /* SQLITE_FORMAT      */ "auxiliary database format error",
        /* SQLITE_RANGE       */ "column index out of range",
        /* SQLITE_NOTADB      */ "file is not a database",
        /* SQLITE_NOTICE      */ "notification message",
        /* SQLITE_WARNING     */ "warning message"
    };

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Returns the error message for the specified SQLite return code using
    /// the internal static lookup table.
    /// </summary>
    /// <param name="rc">The SQLite return code.</param>
    /// <returns>The error message or null if it cannot be found.</returns>
    protected static string FallbackGetErrorString(SQLiteErrorCode rc)
    {
        switch (rc)
        {
            case SQLiteErrorCode.Abort_Rollback:
                return "abort due to ROLLBACK";
            case SQLiteErrorCode.Row:
                return "another row available";
            case SQLiteErrorCode.Done:
                return "no more rows available";
        }

        if (_errorMessages == null)
            return null;

        int index = (int)(rc & SQLiteErrorCode.NonExtendedMask);

        if ((index < 0) || (index >= _errorMessages.Length))
            index = (int)SQLiteErrorCode.Error; /* Make into generic error. */

        return _errorMessages[index];
    }

    internal static string GetLastError(SQLiteConnectionHandle hdl, IntPtr db)
    {
        if ((hdl == null) || (db == IntPtr.Zero))
            return "null connection or database handle";

        string result = null;

        try
        {
            // do nothing.
        }
        finally /* NOTE: Thread.Abort() protection. */
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (hdl.syncRoot)
#else
            lock (hdl)
#endif
            {
                if (!hdl.IsInvalid && !hdl.IsClosed)
                {
#if !SQLITE_STANDARD
                    int len = 0;
                    result = UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg_interop(db, ref len), len);
#else
                    result = UTF8ToString(UnsafeNativeMethods.sqlite3_errmsg(db), -1);
#endif
                }
                else
                {
                    result = "closed or invalid connection handle";
                }
            }
        }
        GC.KeepAlive(hdl);
        return result;
    }

    internal static void FinishBackup(SQLiteConnectionHandle hdl, IntPtr backup)
    {
        if ((hdl == null) || (backup == IntPtr.Zero)) return;

        try
        {
            // do nothing.
        }
        finally /* NOTE: Thread.Abort() protection. */
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (hdl.syncRoot)
#else
            lock (hdl)
#endif
            {
#if !SQLITE_STANDARD
                SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_backup_finish_interop(backup);
#else
                SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_backup_finish(backup);
#endif
                if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, null);
            }
        }
    }

    internal static void CloseBlob(SQLiteConnectionHandle hdl, IntPtr blob)
    {
        if ((hdl == null) || (blob == IntPtr.Zero)) return;

        try
        {
            // do nothing.
        }
        finally /* NOTE: Thread.Abort() protection. */
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (hdl.syncRoot)
#else
            lock (hdl)
#endif
            {
#if !SQLITE_STANDARD
                SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_blob_close_interop(blob);
#else
                SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_blob_close(blob);
#endif
                if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, null);
            }
        }
    }

    internal static void FinalizeStatement(SQLiteConnectionHandle hdl, IntPtr stmt)
    {
        if ((hdl == null) || (stmt == IntPtr.Zero)) return;

        try
        {
            // do nothing.
        }
        finally /* NOTE: Thread.Abort() protection. */
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (hdl.syncRoot)
#else
            lock (hdl)
#endif
            {
#if !SQLITE_STANDARD
                SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_finalize_interop(stmt);
#else
                SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_finalize(stmt);
#endif
                if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, null);
            }
        }
    }

    internal static void CloseConnection(SQLiteConnectionHandle hdl, IntPtr db)
    {
        if ((hdl == null) || (db == IntPtr.Zero)) return;

        try
        {
            // do nothing.
        }
        finally /* NOTE: Thread.Abort() protection. */
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (hdl.syncRoot)
#else
            lock (hdl)
#endif
            {
#if !SQLITE_STANDARD
                SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_close_interop(db);
#else
                ResetConnection(hdl, db, false);

                SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_close(db);
#endif
                if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError(hdl, db));
            }
        }
    }

#if !INTEROP_LEGACY_CLOSE
    internal static void CloseConnectionV2(SQLiteConnectionHandle hdl, IntPtr db)
    {
        if ((hdl == null) || (db == IntPtr.Zero)) return;

        try
        {
            // do nothing.
        }
        finally /* NOTE: Thread.Abort() protection. */
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (hdl.syncRoot)
#else
            lock (hdl)
#endif
            {
#if !SQLITE_STANDARD
                SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_close_interop(db);
#else
                ResetConnection(hdl, db, false);

                SQLiteErrorCode n = UnsafeNativeMethods.sqlite3_close_v2(db);
#endif
                if (n != SQLiteErrorCode.Ok) throw new SQLiteException(n, GetLastError(hdl, db));
            }
        }
    }
#endif

    internal static bool ResetConnection(SQLiteConnectionHandle hdl, IntPtr db, bool canThrow)
    {
        if ((hdl == null) || (db == IntPtr.Zero)) return false;

        bool result = false;

        try
        {
            // do nothing.
        }
        finally /* NOTE: Thread.Abort() protection. */
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (hdl.syncRoot)
#else
            lock (hdl)
#endif
            {
                if (canThrow && hdl.IsInvalid)
                    throw new InvalidOperationException("The connection handle is invalid.");

                if (canThrow && hdl.IsClosed)
                    throw new InvalidOperationException("The connection handle is closed.");

                if (!hdl.IsInvalid && !hdl.IsClosed)
                {
                    IntPtr stmt = IntPtr.Zero;
                    SQLiteErrorCode n;

                    do
                    {
                        stmt = UnsafeNativeMethods.sqlite3_next_stmt(db, stmt);
                        if (stmt != IntPtr.Zero)
                        {
#if !SQLITE_STANDARD
                            n = UnsafeNativeMethods.sqlite3_reset_interop(stmt);
#else
                            n = UnsafeNativeMethods.sqlite3_reset(stmt);
#endif
                        }
                    } while (stmt != IntPtr.Zero);

                    //
                    // NOTE: Is a transaction NOT pending on the connection?
                    //
                    if (IsAutocommit(hdl, db))
                    {
                        result = true;
                    }
                    else
                    {
                        n = UnsafeNativeMethods.sqlite3_exec(
                            db, ToUTF8("ROLLBACK"), IntPtr.Zero, IntPtr.Zero,
                            ref stmt);

                        if (n == SQLiteErrorCode.Ok)
                        {
                            result = true;
                        }
                        else if (canThrow)
                        {
                            throw new SQLiteException(n, GetLastError(hdl, db));
                        }
                    }
                }
            }
        }
        GC.KeepAlive(hdl);
        return result;
    }

    internal static bool IsAutocommit(SQLiteConnectionHandle hdl, IntPtr db)
    {
        if ((hdl == null) || (db == IntPtr.Zero)) return false;

        bool result = false;

        try
        {
            // do nothing.
        }
        finally /* NOTE: Thread.Abort() protection. */
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (hdl.syncRoot)
#else
            lock (hdl)
#endif
            {
                if (!hdl.IsInvalid && !hdl.IsClosed)
                    result = (UnsafeNativeMethods.sqlite3_get_autocommit(db) == 1);
            }
        }
        GC.KeepAlive(hdl); /* NOTE: Unreachable code. */
        return result;
    }
  }

  /// <summary>
  ///
  /// </summary>
  public interface ISQLiteSchemaExtensions
  {
      /// <summary>
      /// Creates temporary tables on the connection so schema information can be queried.
      /// </summary>
      /// <param name="connection">
      /// The connection upon which to build the schema tables.
      /// </param>
      void BuildTempSchema(SQLiteConnection connection);
  }

  [Flags]
  internal enum SQLiteOpenFlagsEnum
  {
    None = 0,
    ReadOnly = 0x1,
    ReadWrite = 0x2,
    Create = 0x4,
    Uri = 0x40,
    Memory = 0x80,
    Default = ReadWrite | Create,
  }

  /// <summary>
  /// The extra behavioral flags that can be applied to a connection.
  /// </summary>
  [Flags()]
  public enum SQLiteConnectionFlags : long
  {
      /// <summary>
      /// No extra flags.
      /// </summary>
      None = 0x0,

      /// <summary>
      /// Enable logging of all SQL statements to be prepared.
      /// </summary>
      LogPrepare = 0x1,

      /// <summary>
      /// Enable logging of all bound parameter types and raw values.
      /// </summary>
      LogPreBind = 0x2,

      /// <summary>
      /// Enable logging of all bound parameter strongly typed values.
      /// </summary>
      LogBind = 0x4,

      /// <summary>
      /// Enable logging of all exceptions caught from user-provided
      /// managed code called from native code via delegates.
      /// </summary>
      LogCallbackException = 0x8,

      /// <summary>
      /// Enable logging of backup API errors.
      /// </summary>
      LogBackup = 0x10,

      /// <summary>
      /// Skip adding the extension functions provided by the native
      /// interop assembly.
      /// </summary>
      NoExtensionFunctions = 0x20,

      /// <summary>
      /// When binding parameter values with the <see cref="UInt32" />
      /// type, use the interop method that accepts an <see cref="Int64" />
      /// value.
      /// </summary>
      BindUInt32AsInt64 = 0x40,

      /// <summary>
      /// When binding parameter values, always bind them as though they were
      /// plain text (i.e. no numeric, date/time, or other conversions should
      /// be attempted).
      /// </summary>
      BindAllAsText = 0x80,

      /// <summary>
      /// When returning column values, always return them as though they were
      /// plain text (i.e. no numeric, date/time, or other conversions should
      /// be attempted).
      /// </summary>
      GetAllAsText = 0x100,

      /// <summary>
      /// Prevent this <see cref="SQLiteConnection" /> object instance from
      /// loading extensions.
      /// </summary>
      NoLoadExtension = 0x200,

#if INTEROP_VIRTUAL_TABLE
      /// <summary>
      /// Prevent this <see cref="SQLiteConnection" /> object instance from
      /// creating virtual table modules.
      /// </summary>
      NoCreateModule = 0x400,
#endif

      /// <summary>
      /// Skip binding any functions provided by other managed assemblies when
      /// opening the connection.
      /// </summary>
      NoBindFunctions = 0x800,

#if INTEROP_VIRTUAL_TABLE
      /// <summary>
      /// Skip setting the logging related properties of the
      /// <see cref="SQLiteModule" /> object instance that was passed to
      /// the <see cref="SQLiteConnection.CreateModule" /> method.
      /// </summary>
      NoLogModule = 0x1000,

      /// <summary>
      /// Enable logging of all virtual table module errors seen by the
      /// <see cref="SQLiteModule.SetTableError(IntPtr,String)" /> method.
      /// </summary>
      LogModuleError = 0x2000,

      /// <summary>
      /// Enable logging of certain virtual table module exceptions that cannot
      /// be easily discovered via other means.
      /// </summary>
      LogModuleException = 0x4000,
#endif

      /// <summary>
      /// Enable tracing of potentially important [non-fatal] error conditions
      /// that cannot be easily reported through other means.
      /// </summary>
      TraceWarning = 0x8000,

      /// <summary>
      /// When binding parameter values, always use the invariant culture when
      /// converting their values from strings.
      /// </summary>
      ConvertInvariantText = 0x10000,

      /// <summary>
      /// When binding parameter values, always use the invariant culture when
      /// converting their values to strings.
      /// </summary>
      BindInvariantText = 0x20000,

      /// <summary>
      /// Disable using the connection pool by default.  If the "Pooling"
      /// connection string property is specified, its value will override
      /// this flag.  The precise outcome of combining this flag with the
      /// <see cref="UseConnectionPool" /> flag is unspecified; however,
      /// one of the flags will be in effect.
      /// </summary>
      NoConnectionPool = 0x40000,

      /// <summary>
      /// Enable using the connection pool by default.  If the "Pooling"
      /// connection string property is specified, its value will override
      /// this flag.  The precise outcome of combining this flag with the
      /// <see cref="NoConnectionPool" /> flag is unspecified; however,
      /// one of the flags will be in effect.
      /// </summary>
      UseConnectionPool = 0x80000,

      /// <summary>
      /// Enable using per-connection mappings between type names and
      /// <see cref="DbType" /> values.  Also see the
      /// <see cref="SQLiteConnection.ClearTypeMappings" />,
      /// <see cref="SQLiteConnection.GetTypeMappings" />, and
      /// <see cref="SQLiteConnection.AddTypeMapping" /> methods.  These
      /// per-connection mappings, when present, override the corresponding
      /// global mappings.
      /// </summary>
      UseConnectionTypes = 0x100000,

      /// <summary>
      /// Disable using global mappings between type names and
      /// <see cref="DbType" /> values.  This may be useful in some very narrow
      /// cases; however, if there are no per-connection type mappings, the
      /// fallback defaults will be used for both type names and their
      /// associated <see cref="DbType" /> values.  Therefore, use of this flag
      /// is not recommended.
      /// </summary>
      NoGlobalTypes = 0x200000,

      /// <summary>
      /// When the <see cref="SQLiteDataReader.HasRows" /> property is used, it
      /// should return non-zero if there were ever any rows in the associated
      /// result sets.
      /// </summary>
      StickyHasRows = 0x400000,

      /// <summary>
      /// Enable "strict" transaction enlistment semantics.  Setting this flag
      /// will cause an exception to be thrown if an attempt is made to enlist
      /// in a transaction with an unavailable or unsupported isolation level.
      /// In the future, more extensive checks may be enabled by this flag as
      /// well.
      /// </summary>
      StrictEnlistment = 0x800000,

      /// <summary>
      /// Enable mapping of unsupported transaction isolation levels to the
      /// closest supported transaction isolation level.
      /// </summary>
      MapIsolationLevels = 0x1000000,

      /// <summary>
      /// When returning column values, attempt to detect the affinity of
      /// textual values by checking if they fully conform to those of the
      /// <see cref="TypeAffinity.Null" />,
      /// <see cref="TypeAffinity.Int64" />,
      /// <see cref="TypeAffinity.Double" />,
      /// or <see cref="TypeAffinity.DateTime" /> types.
      /// </summary>
      DetectTextAffinity = 0x2000000,

      /// <summary>
      /// When returning column values, attempt to detect the type of
      /// string values by checking if they fully conform to those of
      /// the <see cref="TypeAffinity.Null" />,
      /// <see cref="TypeAffinity.Int64" />,
      /// <see cref="TypeAffinity.Double" />,
      /// or <see cref="TypeAffinity.DateTime" /> types.
      /// </summary>
      DetectStringType = 0x4000000,

      /// <summary>
      /// Skip querying runtime configuration settings for use by the
      /// <see cref="SQLiteConvert" /> class, including the default
      /// <see cref="DbType" /> value and default database type name.
      /// <b>NOTE: If the <see cref="SQLiteConnection.DefaultDbType" />
      /// and/or <see cref="SQLiteConnection.DefaultTypeName" />
      /// properties are not set explicitly nor set via their connection
      /// string properties and repeated calls to determine these runtime
      /// configuration settings are seen to be a problem, this flag
      /// should be set.</b>
      /// </summary>
      NoConvertSettings = 0x8000000,

      /// <summary>
      /// When binding parameter values with the <see cref="DateTime" />
      /// type, take their <see cref="DateTimeKind" /> into account as
      /// well as that of the associated <see cref="SQLiteConnection" />.
      /// </summary>
      BindDateTimeWithKind = 0x10000000,

      /// <summary>
      /// If an exception is caught when raising the
      /// <see cref="SQLiteConnection.Commit" /> event, the transaction
      /// should be rolled back.  If this is not specified, the transaction
      /// will continue the commit process instead.
      /// </summary>
      RollbackOnException = 0x20000000,

      /// <summary>
      /// If an exception is caught when raising the
      /// <see cref="SQLiteConnection.Authorize" /> event, the action should
      /// should be denied.  If this is not specified, the action will be
      /// allowed instead.
      /// </summary>
      DenyOnException = 0x40000000,

      /// <summary>
      /// If an exception is caught when raising the
      /// <see cref="SQLiteConnection.Progress" /> event, the operation
      /// should be interrupted.  If this is not specified, the operation
      /// will simply continue.
      /// </summary>
      InterruptOnException = 0x80000000,

      /// <summary>
      /// Attempt to unbind all functions provided by other managed assemblies
      /// when closing the connection.
      /// </summary>
      UnbindFunctionsOnClose = 0x100000000,

      /// <summary>
      /// When returning column values as a <see cref="String" />, skip
      /// verifying their affinity.
      /// </summary>
      NoVerifyTextAffinity = 0x200000000,

      /// <summary>
      /// Enable using per-connection mappings between type names and
      /// <see cref="SQLiteBindValueCallback" /> values.  Also see the
      /// <see cref="SQLiteConnection.ClearTypeCallbacks" />,
      /// <see cref="SQLiteConnection.TryGetTypeCallbacks" />, and
      /// <see cref="SQLiteConnection.SetTypeCallbacks" /> methods.
      /// </summary>
      UseConnectionBindValueCallbacks = 0x400000000,

      /// <summary>
      /// Enable using per-connection mappings between type names and
      /// <see cref="SQLiteReadValueCallback" /> values.  Also see the
      /// <see cref="SQLiteConnection.ClearTypeCallbacks" />,
      /// <see cref="SQLiteConnection.TryGetTypeCallbacks" />, and
      /// <see cref="SQLiteConnection.SetTypeCallbacks" /> methods.
      /// </summary>
      UseConnectionReadValueCallbacks = 0x800000000,

      /// <summary>
      /// If the database type name has not been explicitly set for the
      /// parameter specified, fallback to using the parameter name.
      /// </summary>
      UseParameterNameForTypeName = 0x1000000000,

      /// <summary>
      /// If the database type name has not been explicitly set for the
      /// parameter specified, fallback to using the database type name
      /// associated with the <see cref="DbType" /> value.
      /// </summary>
      UseParameterDbTypeForTypeName = 0x2000000000,

      /// <summary>
      /// When returning column values, skip verifying their affinity.
      /// </summary>
      NoVerifyTypeAffinity = 0x4000000000,

      /// <summary>
      /// Allow transactions to be nested.  The outermost transaction still
      /// controls whether or not any changes are ultimately committed or
      /// rolled back.  All non-outermost transactions are implemented using
      /// the SAVEPOINT construct.
      /// </summary>
      AllowNestedTransactions = 0x8000000000,

      /// <summary>
      /// When binding parameter values, always bind <see cref="Decimal" />
      /// values as though they were plain text (i.e. not <see cref="Decimal" />,
      /// which is the legacy behavior).
      /// </summary>
      BindDecimalAsText = 0x10000000000,

      /// <summary>
      /// When returning column values, always return <see cref="Decimal" />
      /// values as though they were plain text (i.e. not <see cref="Double" />,
      /// which is the legacy behavior).
      /// </summary>
      GetDecimalAsText = 0x20000000000,

      /// <summary>
      /// When binding <see cref="Decimal" /> parameter values, always use
      /// the invariant culture when converting their values to strings.
      /// </summary>
      BindInvariantDecimal = 0x40000000000,

      /// <summary>
      /// When returning <see cref="Decimal" /> column values, always use
      /// the invariant culture when converting their values from strings.
      /// </summary>
      GetInvariantDecimal = 0x80000000000,

      /// <summary>
      /// <b>EXPERIMENTAL</b> --
      /// Enable waiting for the enlistment to be reset prior to attempting
      /// to create a new enlistment.  This may be necessary due to the
      /// semantics used by distributed transactions, which complete
      /// asynchronously.
      /// </summary>
      WaitForEnlistmentReset = 0x100000000000,

      /// <summary>
      /// When returning <see cref="Int64" /> column values, always use
      /// the invariant culture when converting their values from strings.
      /// </summary>
      GetInvariantInt64 = 0x200000000000,

      /// <summary>
      /// When returning <see cref="Double" /> column values, always use
      /// the invariant culture when converting their values from strings.
      /// </summary>
      GetInvariantDouble = 0x400000000000,

      /// <summary>
      /// <b>EXPERIMENTAL</b> --
      /// Enable strict conformance to the ADO.NET standard, e.g. use of
      /// thrown exceptions to indicate common error conditions.
      /// </summary>
      StrictConformance = 0x800000000000,

      /// <summary>
      /// <b>EXPERIMENTAL</b> --
      /// When opening a connection, attempt to hide the password from the
      /// connection string, etc.  Given the memory architecture of the CLR,
      /// (and P/Invoke) this is not 100% reliable and should not be relied
      /// upon for security critical uses or applications.
      /// </summary>
      HidePassword = 0x1000000000000,

      /// <summary>
      /// Skip adding the extension functions provided by the native interop
      /// assembly if they would conflict with a function provided by the
      /// SQLite core library.
      /// </summary>
      NoCoreFunctions = 0x2000000000000,

      /// <summary>
      /// If an exception is caught when raising the
      /// <see cref="SQLiteConnection.Busy" /> event, the operation
      /// should be stopped.  If this is not specified, the operation
      /// will be retried.
      /// </summary>
      StopOnException = 0x4000000000000,

      /// <summary>
      /// Enable logging of internal retries during statment preparation
      /// and stepping.
      /// </summary>
      LogRetry = 0x8000000000000,

      /// <summary>
      /// When binding parameter values or returning column values, always
      /// treat them as though they were plain text (i.e. no numeric,
      /// date/time, or other conversions should be attempted).
      /// </summary>
      BindAndGetAllAsText = BindAllAsText | GetAllAsText,

      /// <summary>
      /// When binding parameter values, always use the invariant culture when
      /// converting their values to strings or from strings.
      /// </summary>
      ConvertAndBindInvariantText = ConvertInvariantText | BindInvariantText,

      /// <summary>
      /// When binding parameter values or returning column values, always
      /// treat them as though they were plain text (i.e. no numeric,
      /// date/time, or other conversions should be attempted) and always
      /// use the invariant culture when converting their values to strings.
      /// </summary>
      BindAndGetAllAsInvariantText = BindAndGetAllAsText | BindInvariantText,

      /// <summary>
      /// When binding parameter values or returning column values, always
      /// treat them as though they were plain text (i.e. no numeric,
      /// date/time, or other conversions should be attempted) and always
      /// use the invariant culture when converting their values to strings
      /// or from strings.
      /// </summary>
      ConvertAndBindAndGetAllAsInvariantText = BindAndGetAllAsText |
                                               ConvertAndBindInvariantText,

      /// <summary>
      /// Enables use of all per-connection value handling callbacks.
      /// </summary>
      UseConnectionAllValueCallbacks = UseConnectionBindValueCallbacks |
                                       UseConnectionReadValueCallbacks,

      /// <summary>
      /// Enables use of all applicable <see cref="SQLiteParameter" />
      /// properties as fallbacks for the database type name.
      /// </summary>
      UseParameterAnythingForTypeName = UseParameterNameForTypeName |
                                        UseParameterDbTypeForTypeName,

      /// <summary>
      /// Enable all logging.
      /// </summary>
#if INTEROP_VIRTUAL_TABLE
      LogAll = LogRetry | LogPrepare | LogPreBind | LogBind |
               LogCallbackException | LogBackup | LogModuleError |
               LogModuleException,
#else
      LogAll = LogRetry | LogPrepare | LogPreBind | LogBind |
               LogCallbackException | LogBackup,
#endif

      /// <summary>
      /// The default logging related flags for new connections.
      /// </summary>
#if INTEROP_VIRTUAL_TABLE
      LogDefault = LogCallbackException | LogModuleException,
#else
      LogDefault = LogCallbackException,
#endif

      /// <summary>
      /// The default extra flags for new connections.
      /// </summary>
      Default = LogDefault | BindInvariantDecimal | GetInvariantDecimal,

      /// <summary>
      /// The default extra flags for new connections with all logging enabled.
      /// </summary>
      DefaultAndLogAll = Default | LogAll
  }

  /// <summary>
  /// These are the supported status parameters for use with the native
  /// SQLite library.
  /// </summary>
  internal enum SQLiteStatusOpsEnum
  {
      /// <summary>
      /// This parameter returns the number of lookaside memory slots
      /// currently checked out.
      /// </summary>
      SQLITE_DBSTATUS_LOOKASIDE_USED = 0,

      /// <summary>
      /// This parameter returns the approximate number of bytes of
      /// heap memory used by all pager caches associated with the
      /// database connection. The highwater mark associated with
      /// SQLITE_DBSTATUS_CACHE_USED is always 0.
      /// </summary>
      SQLITE_DBSTATUS_CACHE_USED = 1,

      /// <summary>
      /// This parameter returns the approximate number of bytes of
      /// heap memory used to store the schema for all databases
      /// associated with the connection - main, temp, and any ATTACH-ed
      /// databases. The full amount of memory used by the schemas is
      /// reported, even if the schema memory is shared with other
      /// database connections due to shared cache mode being enabled.
      /// The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED
      /// is always 0.
      /// </summary>
      SQLITE_DBSTATUS_SCHEMA_USED = 2,

      /// <summary>
      /// This parameter returns the number malloc attempts that might
      /// have been satisfied using lookaside memory but failed due to
      /// all lookaside memory already being in use. Only the high-water
      /// value is meaningful; the current value is always zero.
      /// </summary>
      SQLITE_DBSTATUS_STMT_USED = 3,

      /// <summary>
      /// This parameter returns the number malloc attempts that were
      /// satisfied using lookaside memory. Only the high-water value
      /// is meaningful; the current value is always zero.
      /// </summary>
      SQLITE_DBSTATUS_LOOKASIDE_HIT = 4,

      /// <summary>
      /// This parameter returns the number malloc attempts that might
      /// have been satisfied using lookaside memory but failed due to
      /// the amount of memory requested being larger than the lookaside
      /// slot size. Only the high-water value is meaningful; the current
      /// value is always zero.
      /// </summary>
      SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE = 5,

      /// <summary>
      /// This parameter returns the number malloc attempts that might
      /// have been satisfied using lookaside memory but failed due to
      /// the amount of memory requested being larger than the lookaside
      /// slot size. Only the high-water value is meaningful; the current
      /// value is always zero.
      /// </summary>
      SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL = 6,

      /// <summary>
      /// This parameter returns the number of pager cache hits that
      /// have occurred. The highwater mark associated with
      /// SQLITE_DBSTATUS_CACHE_HIT is always 0.
      /// </summary>
      SQLITE_DBSTATUS_CACHE_HIT = 7,

      /// <summary>
      /// This parameter returns the number of pager cache misses that
      /// have occurred. The highwater mark associated with
      /// SQLITE_DBSTATUS_CACHE_MISS is always 0.
      /// </summary>
      SQLITE_DBSTATUS_CACHE_MISS = 8,

      /// <summary>
      /// This parameter returns the number of dirty cache entries that
      /// have been written to disk. Specifically, the number of pages
      /// written to the wal file in wal mode databases, or the number
      /// of pages written to the database file in rollback mode
      /// databases. Any pages written as part of transaction rollback
      /// or database recovery operations are not included. If an IO or
      /// other error occurs while writing a page to disk, the effect
      /// on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is
      /// undefined. The highwater mark associated with
      /// SQLITE_DBSTATUS_CACHE_WRITE is always 0.
      /// </summary>
      SQLITE_DBSTATUS_CACHE_WRITE = 9,

      /// <summary>
      /// This parameter returns zero for the current value if and only
      /// if all foreign key constraints (deferred or immediate) have
      /// been resolved. The highwater mark is always 0.
      /// </summary>
      SQLITE_DBSTATUS_DEFERRED_FKS = 10,

      /// <summary>
      /// This parameter is similar to DBSTATUS_CACHE_USED, except that
      /// if a pager cache is shared between two or more connections the
      /// bytes of heap memory used by that pager cache is divided evenly
      /// between the attached connections. In other words, if none of
      /// the pager caches associated with the database connection are
      /// shared, this request returns the same value as DBSTATUS_CACHE_USED.
      /// Or, if one or more or the pager caches are shared, the value
      /// returned by this call will be smaller than that returned by
      /// DBSTATUS_CACHE_USED. The highwater mark associated with
      /// SQLITE_DBSTATUS_CACHE_USED_SHARED is always 0.
      /// </summary>
      SQLITE_DBSTATUS_CACHE_USED_SHARED = 11,

      /// <summary>
      /// This parameter returns the number of dirty cache entries that have
      /// been written to disk in the middle of a transaction due to the page
      /// cache overflowing. Transactions are more efficient if they are
      /// written to disk all at once. When pages spill mid-transaction, that
      /// introduces additional overhead. This parameter can be used help
      /// identify inefficiencies that can be resolved by increasing the cache
      /// size.
      /// </summary>
      SQLITE_DBSTATUS_CACHE_SPILL = 12
  }

  /// <summary>
  /// These are the supported configuration verbs for use with the native
  /// SQLite library.  They are used with the
  /// <see cref="SQLiteConnection.SetConfigurationOption" /> method.
  /// </summary>
  public enum SQLiteConfigDbOpsEnum
  {
      /// <summary>
      /// This value represents an unknown (or invalid) option, do not use it.
      /// </summary>
      SQLITE_DBCONFIG_NONE = 0, // nil

      /// <summary>
      /// This option is used to change the name of the "main" database
      /// schema.  The sole argument is a pointer to a constant UTF8 string
      /// which will become the new schema name in place of "main".
      /// </summary>
      SQLITE_DBCONFIG_MAINDBNAME = 1000, // char*

      /// <summary>
      /// This option is used to configure the lookaside memory allocator.
      /// The value must be an array with three elements.  The second element
      /// must be an <see cref="Int32" /> containing the size of each buffer
      /// slot.  The third element must be an <see cref="Int32" /> containing
      /// the number of slots.  The first element must be an <see cref="IntPtr" />
      /// that points to a native memory buffer of bytes equal to or greater
      /// than the product of the second and third element values.
      /// </summary>
      SQLITE_DBCONFIG_LOOKASIDE = 1001, // void* int int

      /// <summary>
      /// This option is used to enable or disable the enforcement of
      /// foreign key constraints.
      /// </summary>
      SQLITE_DBCONFIG_ENABLE_FKEY = 1002, // int int*

      /// <summary>
      /// This option is used to enable or disable triggers.
      /// </summary>
      SQLITE_DBCONFIG_ENABLE_TRIGGER = 1003, // int int*

      /// <summary>
      /// This option is used to enable or disable the two-argument version
      /// of the fts3_tokenizer() function which is part of the FTS3 full-text
      /// search engine extension.
      /// </summary>
      SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER = 1004, // int int*

      /// <summary>
      /// This option is used to enable or disable the loading of extensions.
      /// </summary>
      SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION = 1005, // int int*

      /// <summary>
      /// This option is used to enable or disable the automatic checkpointing
      /// when a WAL database is closed.
      /// </summary>
      SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE = 1006, // int int*

      /// <summary>
      /// This option is used to enable or disable the query planner stability
      /// guarantee (QPSG).
      /// </summary>
      SQLITE_DBCONFIG_ENABLE_QPSG = 1007, // int int*

      /// <summary>
      /// This option is used to enable or disable the extra EXPLAIN QUERY PLAN
      /// output for trigger programs.
      /// </summary>
      SQLITE_DBCONFIG_TRIGGER_EQP = 1008, // int int*

      /// <summary>
      /// This option is used as part of the process to reset a database back
      /// to an empty state.  Because resetting a database is destructive and
      /// irreversible, the process requires the use of this obscure flag and
      /// multiple steps to help ensure that it does not happen by accident.
      /// </summary>
      SQLITE_DBCONFIG_RESET_DATABASE = 1009, // int int*

      /// <summary>
      /// This option activates or deactivates the "defensive" flag for a
      /// database connection.  When the defensive flag is enabled, language
      /// features that allow ordinary SQL to deliberately corrupt the database
      /// file are disabled.  The disabled features include but are not limited
      /// to the following:
      /// <![CDATA[<ul>]]>
      /// <![CDATA[<li>]]>
      /// The PRAGMA writable_schema=ON statement.
      /// <![CDATA[</li>]]>
      /// <![CDATA[<li>]]>
      /// The PRAGMA journal_mode=OFF statement.
      /// <![CDATA[</li>]]>
      /// <![CDATA[<li>]]>
      /// Writes to the sqlite_dbpage virtual table.
      /// <![CDATA[</li>]]>
      /// <![CDATA[<li>]]>
      /// Direct writes to shadow tables.
      /// <![CDATA[</li>]]>
      /// <![CDATA[</ul>]]>
      /// </summary>
      SQLITE_DBCONFIG_DEFENSIVE = 1010, // int int*

      /// <summary>
      /// This option activates or deactivates the "writable_schema" flag.
      /// </summary>
      SQLITE_DBCONFIG_WRITABLE_SCHEMA = 1011, // int int*

      /// <summary>
      /// This option activates or deactivates the legacy behavior of the ALTER
      /// TABLE RENAME command such it behaves as it did prior to version 3.24.0
      /// (2018-06-04).
      /// </summary>
      SQLITE_DBCONFIG_LEGACY_ALTER_TABLE = 1012, // int int*

      /// <summary>
      /// This option activates or deactivates the legacy double-quoted string
      /// literal misfeature for DML statement only, that is DELETE, INSERT,
      /// SELECT, and UPDATE statements.
      /// </summary>
      SQLITE_DBCONFIG_DQS_DML = 1013, // int int*

      /// <summary>
      /// This option activates or deactivates the legacy double-quoted string
      /// literal misfeature for DDL statements, such as CREATE TABLE and CREATE
      /// INDEX.
      /// </summary>
      SQLITE_DBCONFIG_DQS_DDL = 1014, // int int*

      /// <summary>
      /// This option is used to enable or disable CREATE VIEW.
      /// </summary>
      SQLITE_DBCONFIG_ENABLE_VIEW = 1015, // int int*

      /// <summary>
      /// This option activates or deactivates the legacy file format flag.
      /// </summary>
      SQLITE_DBCONFIG_LEGACY_FILE_FORMAT = 1016, // int int*

      /// <summary>
      /// This option tells SQLite to assume that database schemas (i.e. the
      /// contents of the sqlite_master tables) are untainted by malicious
      /// content.  When the trusted schema option is disabled, SQLite takes
      /// additional defensive steps to protect the application from harm
      /// including:
      /// <![CDATA[<ul>]]>
      /// <![CDATA[<li>]]>
      /// Prohibit the use of SQL functions inside triggers, views, CHECK
      /// constraints, DEFAULT clauses, expression indexes, partial indexes,
      /// or generated columns unless those functions are tagged with
      /// SQLITE_INNOCUOUS.
      /// <![CDATA[</li>]]>
      /// <![CDATA[<li>]]>
      /// Prohibit the use of virtual tables inside of triggers or views
      /// unless those virtual tables are tagged with SQLITE_VTAB_INNOCUOUS.
      /// <![CDATA[</ul>]]>
      /// This setting defaults to "on" for legacy compatibility, however
      /// all applications are advised to turn it off if possible.  This
      /// setting can also be controlled using the PRAGMA trusted_schema
      /// statement.
      /// </summary>
      SQLITE_DBCONFIG_TRUSTED_SCHEMA = 1017, // int int*

      /// <summary>
      /// This option is only useful in SQLITE_ENABLE_STMT_SCANSTATUS builds.
      /// In this case, it sets or clears a flag that enables collection of
      /// the sqlite3_stmt_scanstatus_v2() statistics. For statistics to be
      /// collected, the flag must be set on the database handle both when
      /// the SQL statement is prepared and when it is stepped. The flag is
      /// set (collection of statistics is enabled) by default.
      /// </summary>
      SQLITE_DBCONFIG_STMT_SCANSTATUS = 1018, // int int*

      /// <summary>
      /// The SQLITE_DBCONFIG_REVERSE_SCANORDER option change the default
      /// order in which tables and indexes are scanned so that the scans
      /// start at the end and work toward the beginning rather than
      /// starting at the beginning and working toward the end.  Setting
      /// SQLITE_DBCONFIG_REVERSE_SCANORDER is the same as setting [PRAGMA
      /// reverse_unordered_selects].  This configuration option is useful
      /// for application testing.
      /// </summary>
      SQLITE_DBCONFIG_REVERSE_SCANORDER = 1019 // int int*
  }

  // These are the options to the internal sqlite3_config call.
  internal enum SQLiteConfigOpsEnum
  {
    SQLITE_CONFIG_NONE = 0, // nil
    SQLITE_CONFIG_SINGLETHREAD = 1, // nil
    SQLITE_CONFIG_MULTITHREAD = 2, // nil
    SQLITE_CONFIG_SERIALIZED = 3, // nil
    SQLITE_CONFIG_MALLOC = 4, // sqlite3_mem_methods*
    SQLITE_CONFIG_GETMALLOC = 5, // sqlite3_mem_methods*
    SQLITE_CONFIG_SCRATCH = 6, // void*, int sz, int N
    SQLITE_CONFIG_PAGECACHE = 7, // void*, int sz, int N
    SQLITE_CONFIG_HEAP = 8, // void*, int nByte, int min
    SQLITE_CONFIG_MEMSTATUS = 9, // boolean
    SQLITE_CONFIG_MUTEX = 10, // sqlite3_mutex_methods*
    SQLITE_CONFIG_GETMUTEX = 11, // sqlite3_mutex_methods*
    // previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused
    SQLITE_CONFIG_LOOKASIDE = 13, // int int
    SQLITE_CONFIG_PCACHE = 14, // sqlite3_pcache_methods*
    SQLITE_CONFIG_GETPCACHE = 15, // sqlite3_pcache_methods*
    SQLITE_CONFIG_LOG = 16, // xFunc, void*
    SQLITE_CONFIG_URI = 17, // int
    SQLITE_CONFIG_PCACHE2 = 18, // sqlite3_pcache_methods2*
    SQLITE_CONFIG_GETPCACHE2 = 19, // sqlite3_pcache_methods2*
    SQLITE_CONFIG_COVERING_INDEX_SCAN = 20, // int
    SQLITE_CONFIG_SQLLOG = 21, // xSqllog, void*
    SQLITE_CONFIG_MMAP_SIZE = 22, // sqlite3_int64, sqlite3_int64
    SQLITE_CONFIG_WIN32_HEAPSIZE = 23, // int nByte
    SQLITE_CONFIG_PCACHE_HDRSZ = 24, // int *psz
    SQLITE_CONFIG_PMASZ = 25, // unsigned int szPma
    SQLITE_CONFIG_STMTJRNL_SPILL = 26, // int nByte
    SQLITE_CONFIG_SMALL_MALLOC = 27, // boolean
    SQLITE_CONFIG_SORTERREF_SIZE = 28, // int nByte
    SQLITE_CONFIG_MEMDB_MAXSIZE = 29, // sqlite3_int64
    SQLITE_CONFIG_ROWID_IN_VIEW = 30 // int*
  }

  /// <summary>
  /// These constants are returned by the sqlite3_txn_state() API.
  /// </summary>
  internal enum SQLiteTransactionState
  {
      SQLITE_TXN_UNKNOWN = -1,
      SQLITE_TXN_NONE = 0,
      SQLITE_TXN_READ = 1,
      SQLITE_TXN_WRITE = 2
  }

  /// <summary>
  /// These constants are used with the sqlite3_trace_v2() API and the
  /// callbacks registered by it.
  /// </summary>
  [Flags()]
  public enum SQLiteTraceFlags
  {
      /// <summary>
      /// This value represents a mask where no trace events should be
      /// generated.
      /// </summary>
      SQLITE_TRACE_NONE = 0x0, // nil

      /// <summary>
      /// The trace event invoked when a prepared statement first begins
      /// running and possibly at other times during the execution of
      /// the prepared statement, such as at the start of each trigger
      /// subprogram.
      /// </summary>
      SQLITE_TRACE_STMT = 0x1, // pStmt, zSql

      /// <summary>
      /// The trace event invoked when a prepared statement finishes.
      /// It provides a 64-bit integer which is the estimated of the
      /// number of nanosecond that the prepared statement took to run.
      /// </summary>
      SQLITE_TRACE_PROFILE = 0x2, // pStmt, piNsec64

      /// <summary>
      /// The trace event invoked when a prepared statement generates
      /// a single row of result.
      /// </summary>
      SQLITE_TRACE_ROW = 0x4, // pStmt

      /// <summary>
      /// The trace event invoked when a database connection closes.
      /// </summary>
      SQLITE_TRACE_CLOSE = 0x8, // pDb

      /// <summary>
      /// This value represents a mask where all supported trace events
      /// should be generated.  This value is subject to change, e.g.
      /// when additional trace events are added by the SQLite core
      /// library.
      /// </summary>
      SQLITE_TRACE_ALL = SQLITE_TRACE_STMT | SQLITE_TRACE_PROFILE |
                         SQLITE_TRACE_ROW | SQLITE_TRACE_CLOSE,
  }

  /// <summary>
  /// These constants are used with the sqlite3_limit() API.
  /// </summary>
  public enum SQLiteLimitOpsEnum
  {
      /// <summary>
      /// This value represents an unknown (or invalid) limit, do not use it.
      /// </summary>
      SQLITE_LIMIT_NONE = -1,

      /// <summary>
      /// The maximum size of any string or BLOB or table row, in bytes.
      /// </summary>
      SQLITE_LIMIT_LENGTH = 0,

      /// <summary>
      /// The maximum length of an SQL statement, in bytes.
      /// </summary>
      SQLITE_LIMIT_SQL_LENGTH = 1,

      /// <summary>
      /// The maximum number of columns in a table definition or in the
      /// result set of a SELECT or the maximum number of columns in an
      /// index or in an ORDER BY or GROUP BY clause.
      /// </summary>
      SQLITE_LIMIT_COLUMN = 2,

      /// <summary>
      /// The maximum depth of the parse tree on any expression.
      /// </summary>
      SQLITE_LIMIT_EXPR_DEPTH = 3,

      /// <summary>
      /// The maximum number of terms in a compound SELECT statement.
      /// </summary>
      SQLITE_LIMIT_COMPOUND_SELECT = 4,

      /// <summary>
      /// The maximum number of instructions in a virtual machine program
      /// used to implement an SQL statement. If sqlite3_prepare_v2() or
      /// the equivalent tries to allocate space for more than this many
      /// opcodes in a single prepared statement, an SQLITE_NOMEM error
      /// is returned.
      /// </summary>
      SQLITE_LIMIT_VDBE_OP = 5,

      /// <summary>
      /// The maximum number of arguments on a function.
      /// </summary>
      SQLITE_LIMIT_FUNCTION_ARG = 6,

      /// <summary>
      /// The maximum number of attached databases.
      /// </summary>
      SQLITE_LIMIT_ATTACHED = 7,

      /// <summary>
      /// The maximum length of the pattern argument to the LIKE or GLOB
      /// operators.
      /// </summary>
      SQLITE_LIMIT_LIKE_PATTERN_LENGTH = 8,

      /// <summary>
      /// The maximum index number of any parameter in an SQL statement.
      /// </summary>
      SQLITE_LIMIT_VARIABLE_NUMBER = 9,

      /// <summary>
      /// The maximum depth of recursion for triggers.
      /// </summary>
      SQLITE_LIMIT_TRIGGER_DEPTH = 10,

      /// <summary>
      /// The maximum number of auxiliary worker threads that a single
      /// prepared statement may start.
      /// </summary>
      SQLITE_LIMIT_WORKER_THREADS = 11
  }
}

Added System.Data.SQLite/SQLiteBlob.cs.





















































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Joe Mistachkin (joe@mistachkin.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
    using System;

    /// <summary>
    /// Represents a single SQL blob in SQLite.
    /// </summary>
    public sealed class SQLiteBlob : IDisposable
    {
        #region Private Data
        /// <summary>
        /// The underlying SQLite object this blob is bound to.
        /// </summary>
        internal SQLiteBase _sql;

        /// <summary>
        /// The actual blob handle.
        /// </summary>
        internal SQLiteBlobHandle _sqlite_blob;
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region Private Constructors
        /// <summary>
        /// Initializes the blob.
        /// </summary>
        /// <param name="sqlbase">The base SQLite object.</param>
        /// <param name="blob">The blob handle.</param>
        private SQLiteBlob(
            SQLiteBase sqlbase,
            SQLiteBlobHandle blob
            )
        {
            _sql = sqlbase;
            _sqlite_blob = blob;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region Static "Factory" Methods
        /// <summary>
        /// Creates a <see cref="SQLiteBlob" /> object.  This will not work
        /// for tables that were created WITHOUT ROWID -OR- if the query
        /// does not include the "rowid" column or one of its aliases -OR-
        /// if the <see cref="SQLiteDataReader" /> was not created with the
        /// <see cref="CommandBehavior.KeyInfo" /> flag.
        /// </summary>
        /// <param name="dataReader">
        /// The <see cref="SQLiteDataReader" /> instance with a result set
        /// containing the desired blob column.
        /// </param>
        /// <param name="i">
        /// The index of the blob column.
        /// </param>
        /// <param name="readOnly">
        /// Non-zero to open the blob object for read-only access.
        /// </param>
        /// <returns>
        /// The newly created <see cref="SQLiteBlob" /> instance -OR- null
        /// if an error occurs.
        /// </returns>
        public static SQLiteBlob Create(
            SQLiteDataReader dataReader,
            int i,
            bool readOnly
            )
        {
            if (dataReader == null)
                throw new ArgumentNullException("dataReader");

            long? rowId = dataReader.GetRowId(i);

            if (rowId == null)
                throw new InvalidOperationException("No RowId is available");

            return Create(
                SQLiteDataReader.GetConnection(dataReader),
                dataReader.GetDatabaseName(i), dataReader.GetTableName(i),
                dataReader.GetName(i), (long)rowId, readOnly);
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Creates a <see cref="SQLiteBlob" /> object.  This will not work
        /// for tables that were created WITHOUT ROWID.
        /// </summary>
        /// <param name="connection">
        /// The connection to use when opening the blob object.
        /// </param>
        /// <param name="databaseName">
        /// The name of the database containing the blob object.
        /// </param>
        /// <param name="tableName">
        /// The name of the table containing the blob object.
        /// </param>
        /// <param name="columnName">
        /// The name of the column containing the blob object.
        /// </param>
        /// <param name="rowId">
        /// The integer identifier for the row associated with the desired
        /// blob object.
        /// </param>
        /// <param name="readOnly">
        /// Non-zero to open the blob object for read-only access.
        /// </param>
        /// <returns>
        /// The newly created <see cref="SQLiteBlob" /> instance -OR- null
        /// if an error occurs.
        /// </returns>
        public static SQLiteBlob Create(
            SQLiteConnection connection,
            string databaseName,
            string tableName,
            string columnName,
            long rowId,
            bool readOnly
            )
        {
            if (connection == null)
                throw new ArgumentNullException("connection");

            SQLite3 sqlite3 = connection._sql as SQLite3;

            if (sqlite3 == null)
                throw new InvalidOperationException("Connection has no wrapper");

            SQLiteConnectionHandle handle = sqlite3._sql;

            if (handle == null)
                throw new InvalidOperationException("Connection has an invalid handle.");

            SQLiteBlobHandle blob = null;

            try
            {
                // do nothing.
            }
            finally /* NOTE: Thread.Abort() protection. */
            {
                IntPtr ptrBlob = IntPtr.Zero;

                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_blob_open(
                    handle, SQLiteConvert.ToUTF8(databaseName),
                    SQLiteConvert.ToUTF8(tableName), SQLiteConvert.ToUTF8(
                    columnName), rowId, readOnly ? 0 : 1, ref ptrBlob);

                if (rc != SQLiteErrorCode.Ok)
                    throw new SQLiteException(rc, null);

                blob = new SQLiteBlobHandle(handle, ptrBlob);
            }

            SQLiteConnection.OnChanged(connection, new ConnectionEventArgs(
                SQLiteConnectionEventType.NewCriticalHandle, null, null,
                null, null, blob, null, new object[] { typeof(SQLiteBlob),
                databaseName, tableName, columnName, rowId, readOnly }));

            return new SQLiteBlob(sqlite3, blob);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region Private Methods
        /// <summary>
        /// Throws an exception if the blob object does not appear to be open.
        /// </summary>
        private void CheckOpen()
        {
            if (_sqlite_blob == IntPtr.Zero)
                throw new InvalidOperationException("Blob is not open");
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Throws an exception if an invalid read/write parameter is detected.
        /// </summary>
        /// <param name="buffer">
        /// When reading, this array will be populated with the bytes read from
        /// the underlying database blob.  When writing, this array contains new
        /// values for the specified portion of the underlying database blob.
        /// </param>
        /// <param name="count">
        /// The number of bytes to read or write.
        /// </param>
        /// <param name="offset">
        /// The byte offset, relative to the start of the underlying database
        /// blob, where the read or write operation will begin.
        /// </param>
        private void VerifyParameters(
            byte[] buffer,
            int count,
            int offset
            )
        {
            if (buffer == null)
                throw new ArgumentNullException("buffer");

            if (offset < 0)
                throw new ArgumentException("Negative offset not allowed.");

            if (count < 0)
                throw new ArgumentException("Negative count not allowed.");

            if (count > buffer.Length)
                throw new ArgumentException("Buffer is too small.");
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region Public Methods
        /// <summary>
        /// Retargets this object to an underlying database blob for a
        /// different row; the database, table, and column remain exactly
        /// the same.  If this operation fails for any reason, this blob
        /// object is automatically disposed.
        /// </summary>
        /// <param name="rowId">
        /// The integer identifier for the new row.
        /// </param>
        public void Reopen(
            long rowId
            )
        {
            CheckDisposed();
            CheckOpen();

            SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_blob_reopen(
                _sqlite_blob, rowId);

            if (rc != SQLiteErrorCode.Ok)
            {
                Dispose();
                throw new SQLiteException(rc, null);
            }
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Queries the total number of bytes for the underlying database blob.
        /// </summary>
        /// <returns>
        /// The total number of bytes for the underlying database blob.
        /// </returns>
        public int GetCount()
        {
            CheckDisposed();
            CheckOpen();

            return UnsafeNativeMethods.sqlite3_blob_bytes(_sqlite_blob);
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Reads data from the underlying database blob.
        /// </summary>
        /// <param name="buffer">
        /// This array will be populated with the bytes read from the
        /// underlying database blob.
        /// </param>
        /// <param name="count">
        /// The number of bytes to read.
        /// </param>
        /// <param name="offset">
        /// The byte offset, relative to the start of the underlying
        /// database blob, where the read operation will begin.
        /// </param>
        public void Read(
            byte[] buffer,
            int count,
            int offset
            )
        {
            CheckDisposed();
            CheckOpen();
            VerifyParameters(buffer, count, offset);

            SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_blob_read(
                _sqlite_blob, buffer, count, offset);

            if (rc != SQLiteErrorCode.Ok)
                throw new SQLiteException(rc, null);
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Writes data into the underlying database blob.
        /// </summary>
        /// <param name="buffer">
        /// This array contains the new values for the specified portion of
        /// the underlying database blob.
        /// </param>
        /// <param name="count">
        /// The number of bytes to write.
        /// </param>
        /// <param name="offset">
        /// The byte offset, relative to the start of the underlying
        /// database blob, where the write operation will begin.
        /// </param>
        public void Write(
            byte[] buffer,
            int count,
            int offset
            )
        {
            CheckDisposed();
            CheckOpen();
            VerifyParameters(buffer, count, offset);

            SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_blob_write(
                _sqlite_blob, buffer, count, offset);

            if (rc != SQLiteErrorCode.Ok)
                throw new SQLiteException(rc, null);
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Closes the blob, freeing the associated resources.
        /// </summary>
        public void Close()
        {
            Dispose();
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region IDisposable Members
        /// <summary>
        /// Disposes and finalizes the blob.
        /// </summary>
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        private bool disposed;
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
        if (disposed)
            throw new ObjectDisposedException(typeof(SQLiteBlob).Name);
#endif
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        private void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    ////////////////////////////////////
                    // dispose managed resources here...
                    ////////////////////////////////////

                    if (_sqlite_blob != null)
                    {
                        _sqlite_blob.Dispose();
                        _sqlite_blob = null;
                    }

                    _sql = null;
                }

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////

                disposed = true;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region Destructor
        /// <summary>
        /// The destructor.
        /// </summary>
        ~SQLiteBlob()
        {
            Dispose(false);
        }
        #endregion
    }
}

Deleted System.Data.SQLite/SQLiteCommand.bmp.

cannot compute difference between binary files

Changes to System.Data.SQLite/SQLiteCommand.cs.

1
2
3
4
5
6
7
8
9
10
11
12

13
14


15
16
17
18
19
20
21
22
23
















24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43




44
45
46
47
48
49
50
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Data;
  using System.Data.Common;

  using System.Collections.Generic;
  using System.ComponentModel;



  /// <summary>
  /// SQLite implementation of DbCommand.
  /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
  [Designer("SQLite.Designer.SQLiteCommandDesigner, SQLite.Designer, Version=1.0.37.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"), ToolboxItem(true)]
#endif
  public sealed class SQLiteCommand : DbCommand, ICloneable
  {
















    /// <summary>
    /// The command text this command is based on
    /// </summary>
    private string _commandText;
    /// <summary>
    /// The connection the command is associated with
    /// </summary>
    private SQLiteConnection _cnn;
    /// <summary>
    /// The version of the connection the command is associated with
    /// </summary>
    private long _version;
    /// <summary>
    /// Indicates whether or not a DataReader is active on the command.
    /// </summary>
    private WeakReference _activeReader;
    /// <summary>
    /// The timeout for the command, kludged because SQLite doesn't support per-command timeout values
    /// </summary>
    internal int _commandTimeout;




    /// <summary>
    /// Designer support
    /// </summary>
    private bool _designTimeVisible;
    /// <summary>
    /// Used by DbDataAdapter to determine updating behavior
    /// </summary>



|








>


>
>





|



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











|








>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Data;
  using System.Data.Common;
  using System.Diagnostics;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Globalization;
  using System.Text;

  /// <summary>
  /// SQLite implementation of DbCommand.
  /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
  [Designer("SQLite.Designer.SQLiteCommandDesigner, SQLite.Designer, Version=" + SQLite3.DesignerVersion + ", Culture=neutral, PublicKeyToken=db937bc2d44ff139"), ToolboxItem(true)]
#endif
  public sealed class SQLiteCommand : DbCommand, ICloneable
  {
    /// <summary>
    /// These are the extra command behavior flags that should be used for all calls
    /// into the <see cref="ExecuteNonQuery()" />, <see cref="ExecuteScalar()" />,
    /// and <see cref="ExecuteReader()" /> methods.
    /// </summary>
    public static CommandBehavior? GlobalCommandBehaviors = null;

    /// <summary>
    /// The default connection string to be used when creating a temporary
    /// connection to execute a command via the static
    /// <see cref="Execute(string,SQLiteExecuteType,string,object[])" /> or
    /// <see cref="Execute(string,SQLiteExecuteType,CommandBehavior,string,object[])" />
    /// methods.
    /// </summary>
    internal static readonly string DefaultConnectionString = "Data Source=:memory:;";

    /// <summary>
    /// The command text this command is based on
    /// </summary>
    private string _commandText;
    /// <summary>
    /// The connection the command is associated with
    /// </summary>
    private SQLiteConnection _cnn;
    /// <summary>
    /// The version of the connection the command is associated with
    /// </summary>
    private int _version;
    /// <summary>
    /// Indicates whether or not a DataReader is active on the command.
    /// </summary>
    private WeakReference _activeReader;
    /// <summary>
    /// The timeout for the command, kludged because SQLite doesn't support per-command timeout values
    /// </summary>
    internal int _commandTimeout;
    /// <summary>
    /// The maximum amount of time to sleep when retrying a call to prepare or step for the current command.
    /// </summary>
    internal int _maximumSleepTime;
    /// <summary>
    /// Designer support
    /// </summary>
    private bool _designTimeVisible;
    /// <summary>
    /// Used by DbDataAdapter to determine updating behavior
    /// </summary>
61
62
63
64
65
66
67





68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
    /// Unprocessed SQL text that has not been executed
    /// </summary>
    internal string _remainingText;
    /// <summary>
    /// Transaction associated with this command
    /// </summary>
    private SQLiteTransaction _transaction;






    ///<overloads>
    /// Constructs a new SQLiteCommand
    /// </overloads>
    /// <summary>
    /// Default constructor
    /// </summary>
    public SQLiteCommand() :this(null, null)
    {
    }

    /// <summary>
    /// Initializes the command with the given command text
    /// </summary>
    /// <param name="commandText">The SQL command text</param>
    public SQLiteCommand(string commandText) 
      : this(commandText, null, null)
    {
    }

    /// <summary>
    /// Initializes the command with the given SQL command text and attach the command to the specified
    /// connection.
    /// </summary>
    /// <param name="commandText">The SQL command text</param>
    /// <param name="connection">The connection to associate with the command</param>
    public SQLiteCommand(string commandText, SQLiteConnection connection)
      : this(commandText, connection, null)
    {
    }

    /// <summary>
    /// Initializes the command and associates it with the specified connection.
    /// </summary>
    /// <param name="connection">The connection to associate with the command</param>
    public SQLiteCommand(SQLiteConnection connection) 
      : this(null, connection, null)
    {
    }

    private SQLiteCommand(SQLiteCommand source) : this(source.CommandText, source.Connection, source.Transaction)
    {
      CommandTimeout = source.CommandTimeout;







>
>
>
>
>















|



















|







84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
    /// Unprocessed SQL text that has not been executed
    /// </summary>
    internal string _remainingText;
    /// <summary>
    /// Transaction associated with this command
    /// </summary>
    private SQLiteTransaction _transaction;

    static SQLiteCommand()
    {
        InitializeGlobalCommandBehaviors();
    }

    ///<overloads>
    /// Constructs a new SQLiteCommand
    /// </overloads>
    /// <summary>
    /// Default constructor
    /// </summary>
    public SQLiteCommand() :this(null, null)
    {
    }

    /// <summary>
    /// Initializes the command with the given command text
    /// </summary>
    /// <param name="commandText">The SQL command text</param>
    public SQLiteCommand(string commandText)
      : this(commandText, null, null)
    {
    }

    /// <summary>
    /// Initializes the command with the given SQL command text and attach the command to the specified
    /// connection.
    /// </summary>
    /// <param name="commandText">The SQL command text</param>
    /// <param name="connection">The connection to associate with the command</param>
    public SQLiteCommand(string commandText, SQLiteConnection connection)
      : this(commandText, connection, null)
    {
    }

    /// <summary>
    /// Initializes the command and associates it with the specified connection.
    /// </summary>
    /// <param name="connection">The connection to associate with the command</param>
    public SQLiteCommand(SQLiteConnection connection)
      : this(null, connection, null)
    {
    }

    private SQLiteCommand(SQLiteCommand source) : this(source.CommandText, source.Connection, source.Transaction)
    {
      CommandTimeout = source.CommandTimeout;
122
123
124
125
126
127
128

129
130
131
132
133
134
135
136
137
138
139

140
141
142
143
144






























145
146
147
148
149
150
151



152

153




154
155




156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172

173
174
175
176
177
178
179
180



181






182








183

184









185





























































186


























































































187
188
189

190
191
192
193
194
195

196
197
198
199
200
201
202
203
204

205
206
207
208


209

210
211
212
213
214
215
216
217
218
219
220
221
222
223


224
225
226
227

228
229
230

231
232
233
234
235
236
237
238

239
240
241
242
243
244
245
246
247
248
249
250
251
252
    /// </summary>
    /// <param name="commandText">The SQL command text</param>
    /// <param name="connection">The connection to associate with the command</param>
    /// <param name="transaction">The transaction the command should be associated with</param>
    public SQLiteCommand(string commandText, SQLiteConnection connection, SQLiteTransaction transaction)
    {
      _commandTimeout = 30;

      _parameterCollection = new SQLiteParameterCollection(this);
      _designTimeVisible = true;
      _updateRowSource = UpdateRowSource.None;

      if (commandText != null)
        CommandText = commandText;

      if (connection != null)
      {
        DbConnection = connection;
        _commandTimeout = connection.DefaultTimeout;

      }

      if (transaction != null)
        Transaction = transaction;
    }































    /// <summary>
    /// Disposes of the command and clears all member variables
    /// </summary>
    /// <param name="disposing">Whether or not the class is being explicitly or implicitly disposed</param>
    protected override void Dispose(bool disposing)
    {



      base.Dispose(disposing);






      if (disposing)
      {




        // If a reader is active on this command, don't destroy the command, instead let the reader do it
        SQLiteDataReader reader = null;
        if (_activeReader != null)
        {
          try
          {
            reader = _activeReader.Target as SQLiteDataReader;
          }
          catch(InvalidOperationException)
          {
          }
        }

        if (reader != null)
        {
          reader._disposeCommand = true;
          _activeReader = null;

          return;
        }

        Connection = null;
        _parameterCollection.Clear();
        _commandText = null;
      }
    }










    /// <summary>








    /// Clears and destroys all statements currently prepared

    /// </summary>









    internal void ClearCommands()





























































    {


























































































      if (_activeReader != null)
      {
        SQLiteDataReader reader = null;

        try
        {
          reader = _activeReader.Target as SQLiteDataReader;
        }
        catch(InvalidOperationException)
        {

        }

        if (reader != null)
          reader.Close();

        _activeReader = null;
      }

      if (_statementList == null) return;


      int x = _statementList.Count;
      for (int n = 0; n < x; n++)
        _statementList[n].Dispose();




      _statementList = null;

      _parameterCollection.Unbind();
    }

    /// <summary>
    /// Builds an array of prepared statements for each complete SQL statement in the command text
    /// </summary>
    internal SQLiteStatement BuildNextCommand()
    {
      SQLiteStatement stmt = null;

      try
      {


        if (_statementList == null)
          _remainingText = _commandText;

        stmt = _cnn._sql.Prepare(_cnn, _remainingText, (_statementList == null) ? null : _statementList[_statementList.Count - 1], (uint)(_commandTimeout * 1000), out _remainingText);

        if (stmt != null)
        {
          stmt._command = this;

          if (_statementList == null)
            _statementList = new List<SQLiteStatement>();

          _statementList.Add(stmt);

          _parameterCollection.MapParameters(stmt);
          stmt.BindParameters();
        }        

        return stmt;
      }
      catch (Exception)
      {
        if (stmt != null)
        {
          if (_statementList.Contains(stmt))
            _statementList.Remove(stmt);

          stmt.Dispose();
        }

        // If we threw an error compiling the statement, we cannot continue on so set the remaining text to null.
        _remainingText = null;







>











>




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







>
>
>
|
>

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

|
|
|
|
>
|
|

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



>






>



|



|
|
>

<
|
|
>
>
|
>
|













>
>
|
|

|
>
|
|
|
>
|
|

|

|
|
|
>






|







150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459

460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
    /// </summary>
    /// <param name="commandText">The SQL command text</param>
    /// <param name="connection">The connection to associate with the command</param>
    /// <param name="transaction">The transaction the command should be associated with</param>
    public SQLiteCommand(string commandText, SQLiteConnection connection, SQLiteTransaction transaction)
    {
      _commandTimeout = 30;
      _maximumSleepTime = 150;
      _parameterCollection = new SQLiteParameterCollection(this);
      _designTimeVisible = true;
      _updateRowSource = UpdateRowSource.None;

      if (commandText != null)
        CommandText = commandText;

      if (connection != null)
      {
        DbConnection = connection;
        _commandTimeout = connection.DefaultTimeout;
        _maximumSleepTime = connection.DefaultMaximumSleepTime;
      }

      if (transaction != null)
        Transaction = transaction;

      SQLiteConnection.OnChanged(connection, new ConnectionEventArgs(
          SQLiteConnectionEventType.NewCommand, null, transaction, this,
          null, null, null, null));
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    [Conditional("CHECK_STATE")]
    internal static void Check(SQLiteCommand command)
    {
        if (command == null)
            throw new ArgumentNullException("command");

        command.CheckDisposed();
        SQLiteConnection.Check(command._cnn);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable "Pattern" Members
    private bool disposed;
    private void CheckDisposed() /* throw */
    {
#if THROW_ON_DISPOSED
        if (disposed)
            throw new ObjectDisposedException(typeof(SQLiteCommand).Name);
#endif
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Disposes of the command and clears all member variables
    /// </summary>
    /// <param name="disposing">Whether or not the class is being explicitly or implicitly disposed</param>
    protected override void Dispose(bool disposing)
    {
        SQLiteConnection.OnChanged(_cnn, new ConnectionEventArgs(
            SQLiteConnectionEventType.DisposingCommand, null, _transaction, this,
            null, null, null, new object[] { disposing, disposed }));

        bool skippedDispose = false;

        try
        {
            if (!disposed)
            {
                if (disposing)
                {
                    ////////////////////////////////////
                    // dispose managed resources here...
                    ////////////////////////////////////

                    // If a reader is active on this command, don't destroy the command, instead let the reader do it
                    SQLiteDataReader reader = null;
                    if (_activeReader != null)
                    {
                        try
                        {
                            reader = _activeReader.Target as SQLiteDataReader;
                        }
                        catch (InvalidOperationException)
                        {
                        }
                    }

                    if (reader != null)
                    {
                        reader._disposeCommand = true;
                        _activeReader = null;
                        skippedDispose = true;
                        return;
                    }

                    Connection = null;
                    _parameterCollection.Clear();
                    _commandText = null;
                }

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////
            }
        }
        finally
        {
            if (!skippedDispose)
            {
                base.Dispose(disposing);

                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    internal static SQLiteConnectionFlags GetFlags(
        SQLiteCommand command
        )
    {
        try
        {
            if (command != null)
            {
                SQLiteConnection cnn = command._cnn;

                if (cnn != null)
                    return cnn.Flags;
            }
        }
        catch (ObjectDisposedException)
        {
            // do nothing.
        }

        return SQLiteConnectionFlags.Default;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    internal static int GetPrepareRetries(
        SQLiteCommand command
        )
    {
        try
        {
            if (command != null)
            {
                SQLiteConnection cnn = command._cnn;

                if (cnn != null)
                    return cnn.PrepareRetries;
            }
        }
        catch (ObjectDisposedException)
        {
            // do nothing.
        }

        return SQLiteConnection.DefaultPrepareRetries;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    internal static int GetStepRetries(
        SQLiteCommand command
        )
    {
        try
        {
            if (command != null)
            {
                SQLiteConnection cnn = command._cnn;

                if (cnn != null)
                    return cnn.StepRetries;
            }
        }
        catch (ObjectDisposedException)
        {
            // do nothing.
        }

        return SQLiteConnection.DefaultStepRetries;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    internal static int GetMaximumSleepTime(
        SQLiteCommand command
        )
    {
        try
        {
            if (command != null)
                return command._maximumSleepTime;
        }
        catch (ObjectDisposedException)
        {
            // do nothing.
        }

        return SQLiteConnection.DefaultConnectionMaximumSleepTime;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Modifies the specified <see cref="CommandBehavior" /> to include
    /// the global command behavior flags, if any.
    /// </summary>
    /// <param name="behavior">
    /// The <see cref="CommandBehavior" /> as it was originally passed into
    /// the <see cref="ExecuteNonQuery()" />, <see cref="ExecuteScalar()" />,
    /// or <see cref="ExecuteReader()" /> methods.
    /// </param>
    private void MaybeAddGlobalCommandBehaviors(
        ref CommandBehavior behavior /* in, out */
        )
    {
        CommandBehavior? globalBehaviors = GlobalCommandBehaviors;

        if (globalBehaviors != null)
            behavior |= (CommandBehavior)globalBehaviors;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private static void InitializeGlobalCommandBehaviors()
    {
        string value = UnsafeNativeMethods.GetSettingValue(
            "SQLite_GlobalCommandBehaviors", null);

        if (value != null)
        {
            CommandBehavior? behavior;
            string error = null;

            behavior = CombineBehaviors(
                GlobalCommandBehaviors, value, out error);

            if (behavior != null)
            {
                GlobalCommandBehaviors = behavior;
            }
#if !NET_COMPACT_20 && TRACE_WARNING
            else
            {
                Trace.WriteLine(HelperMethods.StringFormat(CultureInfo.CurrentCulture,
                    "WARNING: Could not initialize global command behaviors: {0}",
                    error));
            }
#endif
        }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private void DisposeStatements()
    {
        if (_statementList == null) return;

        int x = _statementList.Count;

        for (int n = 0; n < x; n++)
        {
            SQLiteStatement stmt = _statementList[n];
            if (stmt == null) continue;
            stmt.Dispose();
        }

        _statementList = null;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private void ClearDataReader()
    {
      if (_activeReader != null)
      {
        SQLiteDataReader reader = null;

        try
        {
          reader = _activeReader.Target as SQLiteDataReader;
        }
        catch(InvalidOperationException)
        {
          // do nothing.
        }

        if (reader != null)
          reader.Close(); /* Dispose */

        _activeReader = null;
      }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////


    /// <summary>
    /// Clears and destroys all statements currently prepared
    /// </summary>
    internal void ClearCommands()
    {
      ClearDataReader();
      DisposeStatements();

      _parameterCollection.Unbind();
    }

    /// <summary>
    /// Builds an array of prepared statements for each complete SQL statement in the command text
    /// </summary>
    internal SQLiteStatement BuildNextCommand()
    {
      SQLiteStatement stmt = null;

      try
      {
        if ((_cnn != null) && (_cnn._sql != null))
        {
          if (_statementList == null)
            _remainingText = _commandText;

          stmt = _cnn._sql.Prepare(_cnn, this, _remainingText, (_statementList == null) ? null : _statementList[_statementList.Count - 1], (uint)(_commandTimeout * 1000), ref _remainingText);

          if (stmt != null)
          {
            stmt._command = this;

            if (_statementList == null)
              _statementList = new List<SQLiteStatement>();

            _statementList.Add(stmt);

            _parameterCollection.MapParameters(stmt);
            stmt.BindParameters();
          }
        }
        return stmt;
      }
      catch (Exception)
      {
        if (stmt != null)
        {
          if ((_statementList != null) && _statementList.Contains(stmt))
            _statementList.Remove(stmt);

          stmt.Dispose();
        }

        // If we threw an error compiling the statement, we cannot continue on so set the remaining text to null.
        _remainingText = null;
274
275
276
277
278
279
280


281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298


299
300
301
302












303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326

327
328
329
330

331
332
333





















334
335
336
337
338
339
340
341
342
343
344

345
346
347
348


349
350
351
352
353
354
355
    }

    /// <summary>
    /// Not implemented
    /// </summary>
    public override void Cancel()
    {


      if (_activeReader != null)
      {
        SQLiteDataReader reader = _activeReader.Target as SQLiteDataReader;
        if (reader != null)
          reader.Cancel();
      }
    }

    /// <summary>
    /// The SQL command text associated with the command
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue(""), RefreshProperties(RefreshProperties.All), Editor("Microsoft.VSDesigner.Data.SQL.Design.SqlCommandTextEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
    public override string CommandText
    {
      get
      {


        return _commandText;
      }
      set
      {












        if (_commandText == value) return;

        if (_activeReader != null && _activeReader.IsAlive)
        {
          throw new InvalidOperationException("Cannot set CommandText while a DataReader is active");
        }

        ClearCommands();
        _commandText = value;

        if (_cnn == null) return;
      }
    }

    /// <summary>
    /// The amount of time to wait for the connection to become available before erroring out
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue((int)30)]
#endif
    public override int CommandTimeout
    {
      get
      {

        return _commandTimeout;
      }
      set
      {

        _commandTimeout = value;
      }
    }






















    /// <summary>
    /// The type of the command.  SQLite only supports CommandType.Text
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [RefreshProperties(RefreshProperties.All), DefaultValue(CommandType.Text)]
#endif
    public override CommandType CommandType
    {
      get
      {

        return CommandType.Text;
      }
      set
      {


        if (value != CommandType.Text)
        {
          throw new NotSupportedException();
        }
      }
    }








>
>


















>
>




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







|















>




>



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











>




>
>







535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
    }

    /// <summary>
    /// Not implemented
    /// </summary>
    public override void Cancel()
    {
      CheckDisposed();

      if (_activeReader != null)
      {
        SQLiteDataReader reader = _activeReader.Target as SQLiteDataReader;
        if (reader != null)
          reader.Cancel();
      }
    }

    /// <summary>
    /// The SQL command text associated with the command
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue(""), RefreshProperties(RefreshProperties.All), Editor("Microsoft.VSDesigner.Data.SQL.Design.SqlCommandTextEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
    public override string CommandText
    {
      get
      {
        CheckDisposed();

        return _commandText;
      }
      set
      {
        CheckDisposed();

        string newCommandText = value;

        ConnectionEventArgs previewEventArgs = new ConnectionEventArgs(
            SQLiteConnectionEventType.SqlStringPreview,
            null, null, null, null, null, null, null, null);

        previewEventArgs.Result = newCommandText;
        SQLiteConnection.OnChanged(_cnn, previewEventArgs);
        newCommandText = previewEventArgs.Result;

        if (_commandText == newCommandText) return;

        if (_activeReader != null && _activeReader.IsAlive)
        {
          throw new InvalidOperationException("Cannot set CommandText while a DataReader is active");
        }

        ClearCommands();
        _commandText = newCommandText;

        if (_cnn == null) return;
      }
    }

    /// <summary>
    /// The amount of time to wait for the connection to become available before erroring out
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue((int)30)]
#endif
    public override int CommandTimeout
    {
      get
      {
        CheckDisposed();
        return _commandTimeout;
      }
      set
      {
        CheckDisposed();
        _commandTimeout = value;
      }
    }

    /// <summary>
    /// The maximum amount of time to sleep when retrying a call to prepare or step for the
    /// current command.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue((int)150)]
#endif
    public int MaximumSleepTime
    {
      get
      {
        CheckDisposed();
        return _maximumSleepTime;
      }
      set
      {
        CheckDisposed();
        _maximumSleepTime = value;
      }
    }

    /// <summary>
    /// The type of the command.  SQLite only supports CommandType.Text
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [RefreshProperties(RefreshProperties.All), DefaultValue(CommandType.Text)]
#endif
    public override CommandType CommandType
    {
      get
      {
        CheckDisposed();
        return CommandType.Text;
      }
      set
      {
        CheckDisposed();

        if (value != CommandType.Text)
        {
          throw new NotSupportedException();
        }
      }
    }

364
365
366
367
368
369
370

371
372
373
374
375
376
377
378
379
380
381
382
383
384


385
386
387
388

389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406

    /// <summary>
    /// Create a new parameter
    /// </summary>
    /// <returns></returns>
    public new SQLiteParameter CreateParameter()
    {

      return new SQLiteParameter();
    }

    /// <summary>
    /// The connection associated with this command
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DbConnectionEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
    public new SQLiteConnection Connection
    {
      get { return _cnn; }
      set
      {


        if (_activeReader != null && _activeReader.IsAlive)
          throw new InvalidOperationException("Cannot set Connection while a DataReader is active");

        if (_cnn != null)

        {
          ClearCommands();
          //_cnn.RemoveCommand(this);
        }

        _cnn = value;
        if (_cnn != null)
          _version = _cnn._version;

        //if (_cnn != null)
        //  _cnn.AddCommand(this);
      }
    }

    /// <summary>
    /// Forwards to the local Connection property
    /// </summary>
    protected override DbConnection DbConnection







>
|










|


>
>



|
>
|
|
<
|
<

<
<

|
|







667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697

698

699


700
701
702
703
704
705
706
707
708
709

    /// <summary>
    /// Create a new parameter
    /// </summary>
    /// <returns></returns>
    public new SQLiteParameter CreateParameter()
    {
      CheckDisposed();
      return new SQLiteParameter(this);
    }

    /// <summary>
    /// The connection associated with this command
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DbConnectionEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
    public new SQLiteConnection Connection
    {
      get { CheckDisposed(); return _cnn; }
      set
      {
        CheckDisposed();

        if (_activeReader != null && _activeReader.IsAlive)
          throw new InvalidOperationException("Cannot set Connection while a DataReader is active");

        if (Object.ReferenceEquals(_cnn, value))
          return;

        ClearCommands();



        _cnn = value;



        if (_cnn != null)
          _version = _cnn._version;
      }
    }

    /// <summary>
    /// Forwards to the local Connection property
    /// </summary>
    protected override DbConnection DbConnection
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
    /// Returns the SQLiteParameterCollection for the given command
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
#endif
    public new SQLiteParameterCollection Parameters
    {
      get { return _parameterCollection; }
    }

    /// <summary>
    /// Forwards to the local Parameters property
    /// </summary>
    protected override DbParameterCollection DbParameterCollection
    {







|







722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
    /// Returns the SQLiteParameterCollection for the given command
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
#endif
    public new SQLiteParameterCollection Parameters
    {
      get { CheckDisposed(); return _parameterCollection; }
    }

    /// <summary>
    /// Forwards to the local Parameters property
    /// </summary>
    protected override DbParameterCollection DbParameterCollection
    {
442
443
444
445
446
447
448
449
450
451


452
453
454
455
456
457
458
    /// command's underlying connection.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#endif
    public new SQLiteTransaction Transaction
    {
      get { return _transaction; }
      set
      {


        if (_cnn != null)
        {
          if (_activeReader != null && _activeReader.IsAlive)
            throw new InvalidOperationException("Cannot set Transaction while a DataReader is active");

          if (value != null)
          {







|


>
>







745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
    /// command's underlying connection.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#endif
    public new SQLiteTransaction Transaction
    {
      get { CheckDisposed(); return _transaction; }
      set
      {
        CheckDisposed();

        if (_cnn != null)
        {
          if (_activeReader != null && _activeReader.IsAlive)
            throw new InvalidOperationException("Cannot set Transaction while a DataReader is active");

          if (value != null)
          {
479
480
481
482
483
484
485






































































486
487
488
489
490
491
492
        return Transaction;
      }
      set
      {
        Transaction = (SQLiteTransaction)value;
      }
    }







































































    /// <summary>
    /// This function ensures there are no active readers, that we have a valid connection,
    /// that the connection is open, that all statements are prepared and all parameters are assigned
    /// in preparation for allocating a data reader.
    /// </summary>
    private void InitializeForReader()







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







784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
        return Transaction;
      }
      set
      {
        Transaction = (SQLiteTransaction)value;
      }
    }

    /// <summary>
    /// Verifies that all SQL queries associated with the current command text
    /// can be successfully compiled.  A <see cref="SQLiteException" /> will be
    /// raised if any errors occur.
    /// </summary>
    public void VerifyOnly()
    {
        CheckDisposed();

        SQLiteConnection connection = _cnn;
        SQLiteConnection.Check(connection); /* throw */
        SQLiteBase sqlBase = connection._sql;

        if ((connection == null) || (sqlBase == null))
            throw new SQLiteException("invalid or unusable connection");

        List<SQLiteStatement> statements = null;
        SQLiteStatement currentStatement = null;

        try
        {
            string text = _commandText;
            uint timeout = (uint)(_commandTimeout * 1000);
            SQLiteStatement previousStatement = null;

            while ((text != null) && (text.Length > 0))
            {
                currentStatement = sqlBase.Prepare(
                    connection, this, text, previousStatement, timeout,
                    ref text); /* throw */

                previousStatement = currentStatement;

                if (currentStatement != null)
                {
                    if (statements == null)
                        statements = new List<SQLiteStatement>();

                    statements.Add(currentStatement);
                    currentStatement = null;
                }

                if (text == null) continue;
                text = text.Trim();
            }
        }
        finally
        {
            if (currentStatement != null)
            {
                currentStatement.Dispose();
                currentStatement = null;
            }

            if (statements != null)
            {
                foreach (SQLiteStatement statement in statements)
                {
                    if (statement == null)
                        continue;

                    statement.Dispose();
                }

                statements.Clear();
                statements = null;
            }
        }
    }

    /// <summary>
    /// This function ensures there are no active readers, that we have a valid connection,
    /// that the connection is open, that all statements are prepared and all parameters are assigned
    /// in preparation for allocating a data reader.
    /// </summary>
    private void InitializeForReader()
519
520
521
522
523
524
525












































































































































































































































































526
527
528
529
530
531
532
533


534


535
536
537
538
539
540
541
542
543
544
545
546
547


548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564



















565

566





567
568
569
570























































































































































































































































































































571
572
573
574
575

576
577


578







579

580


581









582
583








































584

























585
586
587
588
589
590
591


592
593
594
595
596
597
598
599
600
601

602
603
604
605

606
607
608
609
610
611
612
613
614
615
616
617
618
619

620
621
622
623


624
625
626
627
628
629
630
631
632
633
634
635
636

637
638
639













640
























































    /// </summary>
    /// <param name="behavior">The behavior the data reader should adopt</param>
    /// <returns>Returns a SQLiteDataReader object</returns>
    protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
    {
      return ExecuteReader(behavior);
    }













































































































































































































































































    /// <summary>
    /// Overrides the default behavior to return a SQLiteDataReader specialization class
    /// </summary>
    /// <param name="behavior">The flags to be associated with the reader</param>
    /// <returns>A SQLiteDataReader</returns>
    public new SQLiteDataReader ExecuteReader(CommandBehavior behavior)
    {


      InitializeForReader();



      SQLiteDataReader rd = new SQLiteDataReader(this, behavior);
      _activeReader = new WeakReference(rd, false);

      return rd;
    }

    /// <summary>
    /// Overrides the default behavior of DbDataReader to return a specialized SQLiteDataReader class
    /// </summary>
    /// <returns>A SQLiteDataReader</returns>
    public new SQLiteDataReader ExecuteReader()
    {


      return ExecuteReader(CommandBehavior.Default);
    }

    /// <summary>
    /// Called by the SQLiteDataReader when the data reader is closed.
    /// </summary>
    internal void ClearDataReader()
    {
      _activeReader = null;
    }

    /// <summary>
    /// Execute the command and return the number of rows inserted/updated affected by it.
    /// </summary>
    /// <returns></returns>
    public override int ExecuteNonQuery()
    {



















      using (SQLiteDataReader reader = ExecuteReader(CommandBehavior.SingleRow | CommandBehavior.SingleResult))

      {





        while (reader.NextResult()) ;
        return reader.RecordsAffected;
      }
    }
























































































































































































































































































































    /// <summary>
    /// Execute the command and return the first column of the first row of the resultset
    /// (if present), or null if no resultset was returned.
    /// </summary>

    /// <returns>The first column of the first row of the first resultset from the query</returns>
    public override object ExecuteScalar()


    {







      using (SQLiteDataReader reader = ExecuteReader(CommandBehavior.SingleRow | CommandBehavior.SingleResult))

      {


        if (reader.Read())









          return reader[0];
      }








































      return null;

























    }

    /// <summary>
    /// Does nothing.  Commands are prepared as they are executed the first time, and kept in prepared state afterwards.
    /// </summary>
    public override void Prepare()
    {


    }

    /// <summary>
    /// Sets the method the SQLiteCommandBuilder uses to determine how to update inserted or updated rows in a DataTable.
    /// </summary>
    [DefaultValue(UpdateRowSource.None)]
    public override UpdateRowSource UpdatedRowSource
    {
      get
      {

        return _updateRowSource;
      }
      set
      {

        _updateRowSource = value;
      }
    }

    /// <summary>
    /// Determines if the command is visible at design time.  Defaults to True.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DesignOnly(true), Browsable(false), DefaultValue(true), EditorBrowsable(EditorBrowsableState.Never)]
#endif
    public override bool DesignTimeVisible
    {
      get
      {

        return _designTimeVisible;
      }
      set
      {


        _designTimeVisible = value;
#if !PLATFORM_COMPACTFRAMEWORK
        TypeDescriptor.Refresh(this);
#endif
      }
    }

    /// <summary>
    /// Clones a command, including all its parameters
    /// </summary>
    /// <returns>A new SQLiteCommand with the same commandtext, connection and parameters</returns>
    public object Clone()
    {

      return new SQLiteCommand(this);
    }
  }













}































































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




|



>
>

>
>













>
>






|







|


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

>
>
>
>
>




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





>
|
|
>
>

>
>
>
>
>
>
>
|
>

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







>
>










>




>














>




>
>













>


|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
    /// </summary>
    /// <param name="behavior">The behavior the data reader should adopt</param>
    /// <returns>Returns a SQLiteDataReader object</returns>
    protected override DbDataReader ExecuteDbDataReader(CommandBehavior behavior)
    {
      return ExecuteReader(behavior);
    }

    /// <summary>
    /// This method creates a new connection, executes the query using the given
    /// execution type, closes the connection, and returns the results.  If the
    /// connection string is null, a temporary in-memory database connection will
    /// be used.
    /// </summary>
    /// <param name="commandText">
    /// The text of the command to be executed.
    /// </param>
    /// <param name="executeType">
    /// The execution type for the command.  This is used to determine which method
    /// of the command object to call, which then determines the type of results
    /// returned, if any.
    /// </param>
    /// <param name="connectionString">
    /// The connection string to the database to be opened, used, and closed.  If
    /// this parameter is null, a temporary in-memory database will be used.
    /// </param>
    /// <param name="args">
    /// The SQL parameter values to be used when building the command object to be
    /// executed, if any.
    /// </param>
    /// <returns>
    /// The results of the query -OR- null if no results were produced from the
    /// given execution type.
    /// </returns>
    public static object Execute(
        string commandText,
        SQLiteExecuteType executeType,
        string connectionString,
        params object[] args
        )
    {
        return Execute(
            commandText, executeType, CommandBehavior.Default,
            connectionString, args);
    }

    /// <summary>
    /// This method creates a new connection, executes the query using the given
    /// execution type and command behavior, closes the connection unless a data
    /// reader is created, and returns the results.  If the connection string is
    /// null, a temporary in-memory database connection will be used.
    /// </summary>
    /// <param name="commandText">
    /// The text of the command to be executed.
    /// </param>
    /// <param name="executeType">
    /// The execution type for the command.  This is used to determine which method
    /// of the command object to call, which then determines the type of results
    /// returned, if any.
    /// </param>
    /// <param name="commandBehavior">
    /// The command behavior flags for the command.
    /// </param>
    /// <param name="connectionString">
    /// The connection string to the database to be opened, used, and closed.  If
    /// this parameter is null, a temporary in-memory database will be used.
    /// </param>
    /// <param name="args">
    /// The SQL parameter values to be used when building the command object to be
    /// executed, if any.
    /// </param>
    /// <returns>
    /// The results of the query -OR- null if no results were produced from the
    /// given execution type.
    /// </returns>
    public static object Execute(
        string commandText,
        SQLiteExecuteType executeType,
        CommandBehavior commandBehavior,
        string connectionString,
        params object[] args
        )
    {
        SQLiteConnection connection = null;

        try
        {
            if (connectionString == null)
                connectionString = DefaultConnectionString;

            using (connection = new SQLiteConnection(connectionString))
            {
                connection.Open();

                using (SQLiteCommand command = connection.CreateCommand())
                {
                    command.CommandText = commandText;

                    if (args != null)
                    {
                        foreach (object arg in args)
                        {
                            SQLiteParameter parameter = arg as SQLiteParameter;

                            if (parameter == null)
                            {
                                parameter = command.CreateParameter();
                                parameter.DbType = DbType.Object;
                                parameter.Value = arg;
                            }

                            command.Parameters.Add(parameter);
                        }
                    }

                    switch (executeType)
                    {
                        case SQLiteExecuteType.None:
                            {
                                //
                                // NOTE: Do nothing.
                                //
                                break;
                            }
                        case SQLiteExecuteType.NonQuery:
                            {
                                return command.ExecuteNonQuery(commandBehavior);
                            }
                        case SQLiteExecuteType.Scalar:
                            {
                                return command.ExecuteScalar(commandBehavior);
                            }
                        case SQLiteExecuteType.Reader:
                            {
                                bool success = true;

                                try
                                {
                                    //
                                    // NOTE: The CloseConnection flag is being added here.
                                    //       This should force the returned data reader to
                                    //       close the connection when it is disposed.  In
                                    //       order to prevent the containing using block
                                    //       from disposing the connection prematurely,
                                    //       the innermost finally block sets the internal
                                    //       no-disposal flag to true.  The outer finally
                                    //       block will reset the internal no-disposal flag
                                    //       to false so that the data reader will be able
                                    //       to (eventually) dispose of the connection.
                                    //
                                    return command.ExecuteReader(
                                        commandBehavior | CommandBehavior.CloseConnection);
                                }
                                catch
                                {
                                    success = false;
                                    throw;
                                }
                                finally
                                {
                                    //
                                    // NOTE: If an exception was not thrown, that can only
                                    //       mean the data reader was successfully created
                                    //       and now owns the connection.  Therefore, set
                                    //       the internal no-disposal flag (temporarily)
                                    //       in order to exit the containing using block
                                    //       without disposing it.
                                    //
                                    if (success)
                                        connection._noDispose = true;
                                }
                            }
                    }
                }
            }
        }
        finally
        {
            //
            // NOTE: Now that the using block has been exited, reset the
            //       internal disposal flag for the connection.  This is
            //       always done if the connection was created because
            //       it will be harmless whether or not the data reader
            //       now owns it.
            //
            if (connection != null)
                connection._noDispose = false;
        }

        return null;
    }

    /// <summary>
    /// This method executes a query using the given execution type and command
    /// behavior and returns the results.
    /// </summary>
    /// <param name="commandText">
    /// The text of the command to be executed.
    /// </param>
    /// <param name="executeType">
    /// The execution type for the command.  This is used to determine which method
    /// of the command object to call, which then determines the type of results
    /// returned, if any.
    /// </param>
    /// <param name="commandBehavior">
    /// The command behavior flags for the command.
    /// </param>
    /// <param name="connection">
    /// The connection used to create and execute the command.
    /// </param>
    /// <param name="args">
    /// The SQL parameter values to be used when building the command object to be
    /// executed, if any.
    /// </param>
    /// <returns>
    /// The results of the query -OR- null if no results were produced from the
    /// given execution type.
    /// </returns>
    public static object Execute(
        string commandText,
        SQLiteExecuteType executeType,
        CommandBehavior commandBehavior,
        SQLiteConnection connection,
        params object[] args
        )
    {
        SQLiteConnection.Check(connection);

        using (SQLiteCommand command = connection.CreateCommand())
        {
            command.CommandText = commandText;

            if (args != null)
            {
                foreach (object arg in args)
                {
                    SQLiteParameter parameter = arg as SQLiteParameter;

                    if (parameter == null)
                    {
                        parameter = command.CreateParameter();
                        parameter.DbType = DbType.Object;
                        parameter.Value = arg;
                    }

                    command.Parameters.Add(parameter);
                }
            }

            switch (executeType)
            {
                case SQLiteExecuteType.None:
                    {
                        //
                        // NOTE: Do nothing.
                        //
                        break;
                    }
                case SQLiteExecuteType.NonQuery:
                    {
                        return command.ExecuteNonQuery(commandBehavior);
                    }
                case SQLiteExecuteType.Scalar:
                    {
                        return command.ExecuteScalar(commandBehavior);
                    }
                case SQLiteExecuteType.Reader:
                    {
                        return command.ExecuteReader(commandBehavior);
                    }
            }
        }

        return null;
    }

    /// <summary>
    /// Overrides the default behavior to return a SQLiteDataReader specialization class
    /// </summary>
    /// <param name="behavior">The flags to be associated with the reader.</param>
    /// <returns>A SQLiteDataReader</returns>
    public new SQLiteDataReader ExecuteReader(CommandBehavior behavior)
    {
      CheckDisposed();
      SQLiteConnection.Check(_cnn);
      InitializeForReader();

      MaybeAddGlobalCommandBehaviors(ref behavior);

      SQLiteDataReader rd = new SQLiteDataReader(this, behavior);
      _activeReader = new WeakReference(rd, false);

      return rd;
    }

    /// <summary>
    /// Overrides the default behavior of DbDataReader to return a specialized SQLiteDataReader class
    /// </summary>
    /// <returns>A SQLiteDataReader</returns>
    public new SQLiteDataReader ExecuteReader()
    {
      CheckDisposed();
      SQLiteConnection.Check(_cnn);
      return ExecuteReader(CommandBehavior.Default);
    }

    /// <summary>
    /// Called by the SQLiteDataReader when the data reader is closed.
    /// </summary>
    internal void ResetDataReader()
    {
      _activeReader = null;
    }

    /// <summary>
    /// Execute the command and return the number of rows inserted/updated affected by it.
    /// </summary>
    /// <returns>The number of rows inserted/updated affected by it.</returns>
    public override int ExecuteNonQuery()
    {
        CheckDisposed();
        SQLiteConnection.Check(_cnn);
        return ExecuteNonQuery(CommandBehavior.Default);
    }

    /// <summary>
    /// Execute the command and return the number of rows inserted/updated affected by it.
    /// </summary>
    /// <param name="behavior">The flags to be associated with the reader.</param>
    /// <returns>The number of rows inserted/updated affected by it.</returns>
    public int ExecuteNonQuery(
        CommandBehavior behavior
        )
    {
      CheckDisposed();
      SQLiteConnection.Check(_cnn);

      MaybeAddGlobalCommandBehaviors(ref behavior);

      using (SQLiteDataReader reader = ExecuteReader(behavior |
          CommandBehavior.SingleRow | CommandBehavior.SingleResult))
      {
        //
        // BUGFIX: See PrivateMaybeReadRemaining comments.
        //
        PrivateMaybeReadRemaining(reader, behavior);

        while (reader.NextResult()) ;
        return reader.RecordsAffected;
      }
    }

    ///////////////////////////////////////////////////////////////////////

    /// <summary>
    /// This integer value is used with <see cref="CommandBehavior" />
    /// values.  When set, extra <see cref="SQLiteDataReader.Read" />
    /// calls are not performed within the <see cref="ExecuteScalar()" />
    /// methods for write transactions.  This value should be used with
    /// extreme care because it can cause unusual behavior.  It is
    /// intended for use only by legacy applications that rely on the
    /// old, incorrect behavior.
    /// </summary>
    public const CommandBehavior SkipExtraReads =
        (CommandBehavior)0x10000000;

    /// <summary>
    /// This integer value is used with <see cref="CommandBehavior" />
    /// values.  When set, extra <see cref="SQLiteDataReader.Read" />
    /// calls are performed within the <see cref="ExecuteScalar()" />
    /// methods for all transactions.  This value should be used with
    /// extreme care because it can cause unusual behavior.
    /// </summary>
    public const CommandBehavior ForceExtraReads =
        (CommandBehavior)0x20000000;

    /// <summary>
    /// Checks to see if the extra <see cref="SQLiteDataReader.Read" />
    /// calls within the <see cref="ExecuteScalar()" /> methods should
    /// be skipped.
    /// </summary>
    /// <param name="behavior">
    /// The behavior flags, exactly as they were passed into the
    /// <see cref="ExecuteScalar()" /> methods.
    /// </param>
    /// <returns>
    /// Non-zero if the extra reads should be skipped; otherwise, zero.
    /// </returns>
    private bool ShouldSkipExtraReads(
        CommandBehavior behavior /* in */
        )
    {
        return (behavior & SkipExtraReads) == SkipExtraReads;
    }

    /// <summary>
    /// Checks to see if the extra <see cref="SQLiteDataReader.Read" />
    /// calls within the <see cref="ExecuteScalar()" /> methods should
    /// be forced.
    /// </summary>
    /// <param name="behavior">
    /// The behavior flags, exactly as they were passed into the
    /// <see cref="ExecuteScalar()" /> methods.
    /// </param>
    /// <returns>
    /// Non-zero if the extra reads should be forced; otherwise, zero.
    /// </returns>
    private bool ShouldForceExtraReads(
        CommandBehavior behavior /* in */
        )
    {
        return (behavior & ForceExtraReads) == ForceExtraReads;
    }

    ///////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Attempts to combine an original <see cref="CommandBehavior" />
    /// value with a list of new <see cref="CommandBehavior" /> values.
    /// </summary>
    /// <param name="behavior">
    /// The original <see cref="CommandBehavior" /> value, if any.  If
    /// this value is null, a suitable default value will be used.
    /// </param>
    /// <param name="flags">
    /// The list of new <see cref="CommandBehavior" /> values delimited
    /// by spaces or commas.  Each value may have an optional prefix, a
    /// '+' or '-' sign.  If the prefix is a '+', the value is added to
    /// the original <see cref="CommandBehavior" /> value.  If the
    /// prefix is a '-', the value is removed from the original
    /// <see cref="CommandBehavior" /> value.  In addition to the values
    /// formally defined for <see cref="CommandBehavior" />, the extra
    /// values "SkipExtraReads" and "ForceExtraReads" are recognized.
    /// Other extra values may be added in the future.
    /// </param>
    /// <param name="error">
    /// Upon success, this will be set to null.  Upon failure, this will
    /// be set to an appropriate error message.
    /// </param>
    /// <returns>
    /// The resulting <see cref="CommandBehavior" /> value -OR- null
    /// if it cannot be determined due to an error -OR- null if the
    /// original <see cref="CommandBehavior" /> value and list of new
    /// <see cref="CommandBehavior" /> value are both null.  The way to
    /// differentiate between these two null return scenarios is to
    /// check the error message against null.  If the error message is
    /// not null, an error was encountered; otherwise, the null was the
    /// natural return value.
    /// </returns>
    public static CommandBehavior? CombineBehaviors(
        CommandBehavior? behavior, /* in: OPTIONAL */
        string flags,              /* in: OPTIONAL */
        out string error           /* out */
        )
    {
        error = null;

        if (String.IsNullOrEmpty(flags))
            return behavior;

        string[] parts = flags.Split(' ', ',');

        if (parts == null)
        {
            error = "could not split flags into parts";
            return null;
        }

        CommandBehavior localBehavior = (behavior != null) ?
            (CommandBehavior)behavior : (CommandBehavior)0;

        int length = parts.Length;
        bool add = true;

        for (int index = 0; index < length; index++)
        {
            string part = parts[index];

            if (part != null)
                part = part.Trim();

            if (String.IsNullOrEmpty(part))
                continue;

            char subPart = part[0];

            if ((subPart == '+') || (subPart == '-'))
            {
                add = (subPart == '+');
                part = part.Substring(1).Trim();
            }

            if (String.IsNullOrEmpty(part))
                continue;

            object enumValue;

            if (String.Equals(
                    part, "SkipExtraReads",
                    StringComparison.OrdinalIgnoreCase))
            {
                enumValue = SkipExtraReads;
            }
            else if (String.Equals(
                    part, "ForceExtraReads",
                    StringComparison.OrdinalIgnoreCase))
            {
                enumValue = ForceExtraReads;
            }
            else
            {
                try
                {
                    enumValue = Enum.Parse( /* CLRv2+ */
                        typeof(CommandBehavior), part,
                        true); /* throw */
                }
                catch (Exception e)
                {
                    error = e.ToString();
                    return null;
                }
            }

            CommandBehavior flag = (CommandBehavior)enumValue;

            if (add)
                localBehavior |= flag;
            else
                localBehavior &= ~flag;
        }

        return localBehavior;
    }

    ///////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Checks if extra calls to the <see cref="SQLiteDataReader.Read" />
    /// method are necessary.  If so, it attempts to perform them.  If
    /// not, nothing is done.
    /// </summary>
    /// <param name="reader">
    /// The data reader instance as it was received from one of the
    /// <see cref="ExecuteReader()" /> methods.
    /// </param>
    /// <param name="behavior">
    /// The original command behavior flags as passed into one of the
    /// query execution methods.
    /// </param>
    /// <returns>
    /// The number of extra calls to <see cref="SQLiteDataReader.Read" />
    /// that were performed -OR- negative one to indicate they were not
    /// enabled.
    /// </returns>
    public int MaybeReadRemaining(
        SQLiteDataReader reader, /* in */
        CommandBehavior behavior /* in */
        )
    {
        CheckDisposed();

        return PrivateMaybeReadRemaining(reader, behavior);
    }

    ///////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Checks if extra calls to the <see cref="SQLiteDataReader.Read" />
    /// method are necessary.  If so, it attempts to perform them.  If
    /// not, nothing is done.
    /// </summary>
    /// <param name="reader">
    /// The data reader instance as it was received from one of the
    /// <see cref="ExecuteReader()" /> methods.
    /// </param>
    /// <param name="behavior">
    /// The original command behavior flags as passed into one of the
    /// query execution methods.
    /// </param>
    /// <returns>
    /// The number of extra calls to <see cref="SQLiteDataReader.Read" />
    /// that were performed -OR- negative one to indicate they were not
    /// enabled.
    /// </returns>
    private int PrivateMaybeReadRemaining(
        SQLiteDataReader reader, /* in */
        CommandBehavior behavior /* in */
        )
    {
        //
        // BUGFIX: There are SQL statements that cause a write transaction
        //         to be started and that always require more than one step
        //         to be successfully completed, e.g. INSERT with RETURNING
        //         clause.  Therefore, if there is a write transaction in
        //         progress, keep stepping until done unless forbidden from
        //         doing so by the caller.
        //
        if (!ShouldSkipExtraReads(behavior) &&
            (ShouldForceExtraReads(behavior) ||
            MatchTransactionState(SQLiteTransactionState.SQLITE_TXN_WRITE)))
        {
            int count = 0;

            while (reader.PrivateRead(true))
                count++;

            return count;
        }

        return -1;
    }

    ///////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Checks transaction state of the associated database connection.
    /// </summary>
    /// <param name="transactionState">
    /// The desired transaction state.
    /// </param>
    /// <returns>
    /// Non-zero if current transaction state of the associated database
    /// connection matches the desired transaction state.
    /// </returns>
    private bool MatchTransactionState(
        SQLiteTransactionState transactionState /* in */
        )
    {
        //
        // NOTE: The underlying sqlite3_txn_state() core library API
        //       is not available until release 3.34.1.
        //
        if (UnsafeNativeMethods.sqlite3_libversion_number() < 3034001)
            return false;

        SQLiteConnection cnn = _cnn;

        if (cnn == null)
            return false;

        SQLiteBase sql = _cnn._sql;

        if (sql == null)
            return false;

        return sql.GetTransactionState(null) == transactionState;
    }

    ///////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Execute the command and return the first column of the first row of the resultset
    /// (if present), or null if no resultset was returned.
    /// </summary>
    /// <returns>The first column of the first row of the first resultset from the query.</returns>
    public override object ExecuteScalar()
    {
      CheckDisposed();
      SQLiteConnection.Check(_cnn);
      return ExecuteScalar(CommandBehavior.Default);
    }

    /// <summary>
    /// Execute the command and return the first column of the first row of the resultset
    /// (if present), or null if no resultset was returned.
    /// </summary>
    /// <param name="behavior">The flags to be associated with the reader.</param>
    /// <returns>The first column of the first row of the first resultset from the query.</returns>
    public object ExecuteScalar(
        CommandBehavior behavior
        )
    {
      CheckDisposed();
      SQLiteConnection.Check(_cnn);

      MaybeAddGlobalCommandBehaviors(ref behavior);

      object result = null;

      using (SQLiteDataReader reader = ExecuteReader(behavior |
          CommandBehavior.SingleRow | CommandBehavior.SingleResult))
      {
        if (reader.PrivateRead(false))
        {
          if (reader.FieldCount > 0)
            result = reader[0];

          //
          // BUGFIX: See PrivateMaybeReadRemaining comments.
          //
          PrivateMaybeReadRemaining(reader, behavior);
        }
      }

      return result;
    }

    /// <summary>
    /// This method resets all the prepared statements held by this instance
    /// back to their initial states, ready to be re-executed.
    /// </summary>
    public void Reset()
    {
        CheckDisposed();
        SQLiteConnection.Check(_cnn);

        Reset(true, false);
    }

    /// <summary>
    /// This method resets all the prepared statements held by this instance
    /// back to their initial states, ready to be re-executed.
    /// </summary>
    /// <param name="clearBindings">
    /// Non-zero if the parameter bindings should be cleared as well.
    /// </param>
    /// <param name="ignoreErrors">
    /// If this is zero, a <see cref="SQLiteException" /> may be thrown for
    /// any unsuccessful return codes from the native library; otherwise, a
    /// <see cref="SQLiteException" /> will only be thrown if the connection
    /// or its state is invalid.
    /// </param>
    public void Reset(
        bool clearBindings,
        bool ignoreErrors
        )
    {
        CheckDisposed();
        SQLiteConnection.Check(_cnn);

        if (clearBindings && (_parameterCollection != null))
            _parameterCollection.Unbind();

        ClearDataReader();

        if (_statementList == null)
            return;

        SQLiteBase sqlBase = _cnn._sql;
        SQLiteErrorCode rc;

        foreach (SQLiteStatement item in _statementList)
        {
            if (item == null)
                continue;

            SQLiteStatementHandle stmt = item._sqlite_stmt;

            if (stmt == null)
                continue;

            rc = sqlBase.Reset(item);

            if ((rc == SQLiteErrorCode.Ok) && clearBindings &&
                (SQLite3.SQLiteVersionNumber >= 3003007))
            {
                rc = UnsafeNativeMethods.sqlite3_clear_bindings(stmt);
            }

            if (!ignoreErrors && (rc != SQLiteErrorCode.Ok))
                throw new SQLiteException(rc, sqlBase.GetLastError());
        }
    }

    /// <summary>
    /// Does nothing.  Commands are prepared as they are executed the first time, and kept in prepared state afterwards.
    /// </summary>
    public override void Prepare()
    {
      CheckDisposed();
      SQLiteConnection.Check(_cnn);
    }

    /// <summary>
    /// Sets the method the SQLiteCommandBuilder uses to determine how to update inserted or updated rows in a DataTable.
    /// </summary>
    [DefaultValue(UpdateRowSource.None)]
    public override UpdateRowSource UpdatedRowSource
    {
      get
      {
        CheckDisposed();
        return _updateRowSource;
      }
      set
      {
        CheckDisposed();
        _updateRowSource = value;
      }
    }

    /// <summary>
    /// Determines if the command is visible at design time.  Defaults to True.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DesignOnly(true), Browsable(false), DefaultValue(true), EditorBrowsable(EditorBrowsableState.Never)]
#endif
    public override bool DesignTimeVisible
    {
      get
      {
        CheckDisposed();
        return _designTimeVisible;
      }
      set
      {
        CheckDisposed();

        _designTimeVisible = value;
#if !PLATFORM_COMPACTFRAMEWORK
        TypeDescriptor.Refresh(this);
#endif
      }
    }

    /// <summary>
    /// Clones a command, including all its parameters
    /// </summary>
    /// <returns>A new SQLiteCommand with the same commandtext, connection and parameters</returns>
    public object Clone()
    {
      CheckDisposed();
      return new SQLiteCommand(this);
    }

    /// <summary>
    /// This method attempts to build and return a string containing diagnostic
    /// information for use by the test suite.  This method should not be used
    /// by application code.  It is designed for use by the test suite only and
    /// may be modified or removed at any time.
    /// </summary>
    /// <returns>
    /// A string containing information for use by the test suite -OR- null if
    /// that information is not available.
    /// </returns>
    public string GetDiagnostics()
    {
        CheckDisposed();

        StringBuilder builder = new StringBuilder();

        if (_statementList != null)
        {
            for (int index = 0; index < _statementList.Count; index++)
            {
                SQLiteStatement statement = _statementList[index];

                if (statement == null)
                    continue;

                builder.AppendFormat(CultureInfo.CurrentCulture,
                    "#{0}, sql = {{{1}}}", index,
                    statement._sqlStatement);

                if (statement._prepareSchemaRetries > 0)
                {
                    builder.AppendFormat(CultureInfo.CurrentCulture,
                        ", prepareSchemaRetries = {0}",
                        statement._prepareSchemaRetries);
                }

                if (statement._prepareLockRetries > 0)
                {
                    builder.AppendFormat(CultureInfo.CurrentCulture,
                        ", prepareLockRetries = {0}",
                        statement._prepareLockRetries);
                }

                if (statement._stepSchemaRetries > 0)
                {
                    builder.AppendFormat(CultureInfo.CurrentCulture,
                        ", stepSchemaRetries = {0}",
                        statement._stepSchemaRetries);
                }

                if (statement._stepLockRetries > 0)
                {
                    builder.AppendFormat(CultureInfo.CurrentCulture,
                        ", stepLockRetries = {0}",
                        statement._stepLockRetries);
                }

#if !NET_COMPACT_20
                builder.AppendLine();
#else
                builder.AppendFormat(CultureInfo.CurrentCulture,
                    "\r\n");
#endif
            }
        }

        return builder.ToString();
    }
  }
}

Changes to System.Data.SQLite/SQLiteCommandBuilder.cs.

1
2
3
4
5
6
7
8
9
10
11
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Data;



|







1
2
3
4
5
6
7
8
9
10
11
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Data;
32
33
34
35
36
37
38




















































39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
    public SQLiteCommandBuilder(SQLiteDataAdapter adp)
    {
      QuotePrefix = "[";
      QuoteSuffix = "]";
      DataAdapter = adp;
    }





















































    /// <summary>
    /// Minimal amount of parameter processing.  Primarily sets the DbType for the parameter equal to the provider type in the schema
    /// </summary>
    /// <param name="parameter">The parameter to use in applying custom behaviors to a row</param>
    /// <param name="row">The row to apply the parameter to</param>
    /// <param name="statementType">The type of statement</param>
    /// <param name="whereClause">Whether the application of the parameter is part of a WHERE clause</param>
    protected override void ApplyParameterInfo(DbParameter parameter, DataRow row, StatementType statementType, bool whereClause)
    {
      SQLiteParameter param = (SQLiteParameter)parameter;
      param.DbType = (DbType)row[SchemaTableColumn.ProviderType];
    }

    /// <summary>
    /// Returns a valid named parameter
    /// </summary>
    /// <param name="parameterName">The name of the parameter</param>
    /// <returns>Error</returns>
    protected override string GetParameterName(string parameterName)
    {
      return String.Format(CultureInfo.InvariantCulture, "@{0}", parameterName);
    }

    /// <summary>
    /// Returns a named parameter for the given ordinal
    /// </summary>
    /// <param name="parameterOrdinal">The i of the parameter</param>
    /// <returns>Error</returns>
    protected override string GetParameterName(int parameterOrdinal)
    {
      return String.Format(CultureInfo.InvariantCulture, "@param{0}", parameterOrdinal);
    }

    /// <summary>
    /// Returns a placeholder character for the specified parameter i.
    /// </summary>
    /// <param name="parameterOrdinal">The index of the parameter to provide a placeholder for</param>
    /// <returns>Returns a named parameter</returns>







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




















|









|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
    public SQLiteCommandBuilder(SQLiteDataAdapter adp)
    {
      QuotePrefix = "[";
      QuoteSuffix = "]";
      DataAdapter = adp;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable "Pattern" Members
    private bool disposed;
    private void CheckDisposed() /* throw */
    {
#if THROW_ON_DISPOSED
        if (disposed)
            throw new ObjectDisposedException(typeof(SQLiteCommandBuilder).Name);
#endif
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Cleans up resources (native and managed) associated with the current instance.
    /// </summary>
    /// <param name="disposing">
    /// Zero when being disposed via garbage collection; otherwise, non-zero.
    /// </param>
    protected override void Dispose(bool disposing)
    {
        try
        {
            if (!disposed)
            {
                //if (disposing)
                //{
                //    ////////////////////////////////////
                //    // dispose managed resources here...
                //    ////////////////////////////////////
                //}

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////
            }
        }
        finally
        {
            base.Dispose(disposing);

            //
            // NOTE: Everything should be fully disposed at this point.
            //
            disposed = true;
        }
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Minimal amount of parameter processing.  Primarily sets the DbType for the parameter equal to the provider type in the schema
    /// </summary>
    /// <param name="parameter">The parameter to use in applying custom behaviors to a row</param>
    /// <param name="row">The row to apply the parameter to</param>
    /// <param name="statementType">The type of statement</param>
    /// <param name="whereClause">Whether the application of the parameter is part of a WHERE clause</param>
    protected override void ApplyParameterInfo(DbParameter parameter, DataRow row, StatementType statementType, bool whereClause)
    {
      SQLiteParameter param = (SQLiteParameter)parameter;
      param.DbType = (DbType)row[SchemaTableColumn.ProviderType];
    }

    /// <summary>
    /// Returns a valid named parameter
    /// </summary>
    /// <param name="parameterName">The name of the parameter</param>
    /// <returns>Error</returns>
    protected override string GetParameterName(string parameterName)
    {
      return HelperMethods.StringFormat(CultureInfo.InvariantCulture, "@{0}", parameterName);
    }

    /// <summary>
    /// Returns a named parameter for the given ordinal
    /// </summary>
    /// <param name="parameterOrdinal">The i of the parameter</param>
    /// <returns>Error</returns>
    protected override string GetParameterName(int parameterOrdinal)
    {
      return HelperMethods.StringFormat(CultureInfo.InvariantCulture, "@param{0}", parameterOrdinal);
    }

    /// <summary>
    /// Returns a placeholder character for the specified parameter i.
    /// </summary>
    /// <param name="parameterOrdinal">The index of the parameter to provide a placeholder for</param>
    /// <returns>Returns a named parameter</returns>
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118

119
120
121
122
123
124
125
126
127
128

129
130
131
132
133
134
135
136
137

138
139
140
141
142
143
144
145
146
147

148
149
150
151
152
153
154
155
156

157
158
159
160
161
162
163
164
165
166

167
168
169
170
171
172
173
174
175
176
177
178
179

180
181
182
183

184
185
186
187
188
189
190
191
192
193
194
195
196
197

198
199
200
201

202
203
204
205
206
207
208
209
210
211
212
213
214
215
216

217
218
219
220

221
222
223
224
225
226
227
228
229
230
231
232
233
234

235
236
237
238

239
240
241
242
243
244
245
246
247
248
249


250
251
252
253
254
255
256
257
258
259
260
261
262
263
264


265
266
267
268
269
270
271
    }

    /// <summary>
    /// Gets/sets the DataAdapter for this CommandBuilder
    /// </summary>
    public new SQLiteDataAdapter DataAdapter
    {
      get { return (SQLiteDataAdapter)base.DataAdapter; }
      set { base.DataAdapter = value; }
    }

    /// <summary>
    /// Returns the automatically-generated SQLite command to delete rows from the database
    /// </summary>
    /// <returns></returns>
    public new SQLiteCommand GetDeleteCommand()
    {

      return (SQLiteCommand)base.GetDeleteCommand();
    }

    /// <summary>
    /// Returns the automatically-generated SQLite command to delete rows from the database
    /// </summary>
    /// <param name="useColumnsForParameterNames"></param>
    /// <returns></returns>
    public new SQLiteCommand GetDeleteCommand(bool useColumnsForParameterNames)
    {

      return (SQLiteCommand)base.GetDeleteCommand(useColumnsForParameterNames);
    }

    /// <summary>
    /// Returns the automatically-generated SQLite command to update rows in the database
    /// </summary>
    /// <returns></returns>
    public new SQLiteCommand GetUpdateCommand()
    {

      return (SQLiteCommand)base.GetUpdateCommand();
    }

    /// <summary>
    /// Returns the automatically-generated SQLite command to update rows in the database
    /// </summary>
    /// <param name="useColumnsForParameterNames"></param>
    /// <returns></returns>
    public new SQLiteCommand GetUpdateCommand(bool useColumnsForParameterNames)
    {

      return (SQLiteCommand)base.GetUpdateCommand(useColumnsForParameterNames);
    }

    /// <summary>
    /// Returns the automatically-generated SQLite command to insert rows into the database
    /// </summary>
    /// <returns></returns>
    public new SQLiteCommand GetInsertCommand()
    {

      return (SQLiteCommand)base.GetInsertCommand();
    }

    /// <summary>
    /// Returns the automatically-generated SQLite command to insert rows into the database
    /// </summary>
    /// <param name="useColumnsForParameterNames"></param>
    /// <returns></returns>
    public new SQLiteCommand GetInsertCommand(bool useColumnsForParameterNames)
    {

      return (SQLiteCommand)base.GetInsertCommand(useColumnsForParameterNames);
    }

    /// <summary>
    /// Overridden to hide its property from the designer
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false)]
#endif
    public override CatalogLocation CatalogLocation
    {
      get
      {

        return base.CatalogLocation;
      }
      set
      {

        base.CatalogLocation = value;
      }
    }

    /// <summary>
    /// Overridden to hide its property from the designer
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false)]
#endif
    public override string CatalogSeparator
    {
      get
      {

        return base.CatalogSeparator;
      }
      set
      {

        base.CatalogSeparator = value;
      }
    }

    /// <summary>
    /// Overridden to hide its property from the designer
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false)]
#endif
    [DefaultValue("[")]
    public override string QuotePrefix
    {
      get
      {

        return base.QuotePrefix;
      }
      set
      {

        base.QuotePrefix = value;
      }
    }

    /// <summary>
    /// Overridden to hide its property from the designer
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false)]
#endif
    public override string QuoteSuffix
    {
      get
      {

        return base.QuoteSuffix;
      }
      set
      {

        base.QuoteSuffix = value;
      }
    }

    /// <summary>
    /// Places brackets around an identifier
    /// </summary>
    /// <param name="unquotedIdentifier">The identifier to quote</param>
    /// <returns>The bracketed identifier</returns>
    public override string QuoteIdentifier(string unquotedIdentifier)
    {


      if (String.IsNullOrEmpty(QuotePrefix)
        || String.IsNullOrEmpty(QuoteSuffix)
        || String.IsNullOrEmpty(unquotedIdentifier))
        return unquotedIdentifier;

      return QuotePrefix + unquotedIdentifier.Replace(QuoteSuffix, QuoteSuffix + QuoteSuffix) + QuoteSuffix;
    }

    /// <summary>
    /// Removes brackets around an identifier
    /// </summary>
    /// <param name="quotedIdentifier">The quoted (bracketed) identifier</param>
    /// <returns>The undecorated identifier</returns>
    public override string UnquoteIdentifier(string quotedIdentifier)
    {


      if (String.IsNullOrEmpty(QuotePrefix)
        || String.IsNullOrEmpty(QuoteSuffix)
        || String.IsNullOrEmpty(quotedIdentifier))
        return quotedIdentifier;

      if (quotedIdentifier.StartsWith(QuotePrefix, StringComparison.OrdinalIgnoreCase) == false
        || quotedIdentifier.EndsWith(QuoteSuffix, StringComparison.OrdinalIgnoreCase) == false)







|
|








>










>









>










>









>










>













>




>














>




>















>




>














>




>











>
>















>
>







154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
    }

    /// <summary>
    /// Gets/sets the DataAdapter for this CommandBuilder
    /// </summary>
    public new SQLiteDataAdapter DataAdapter
    {
      get { CheckDisposed(); return (SQLiteDataAdapter)base.DataAdapter; }
      set { CheckDisposed(); base.DataAdapter = value; }
    }

    /// <summary>
    /// Returns the automatically-generated SQLite command to delete rows from the database
    /// </summary>
    /// <returns></returns>
    public new SQLiteCommand GetDeleteCommand()
    {
      CheckDisposed();
      return (SQLiteCommand)base.GetDeleteCommand();
    }

    /// <summary>
    /// Returns the automatically-generated SQLite command to delete rows from the database
    /// </summary>
    /// <param name="useColumnsForParameterNames"></param>
    /// <returns></returns>
    public new SQLiteCommand GetDeleteCommand(bool useColumnsForParameterNames)
    {
      CheckDisposed();
      return (SQLiteCommand)base.GetDeleteCommand(useColumnsForParameterNames);
    }

    /// <summary>
    /// Returns the automatically-generated SQLite command to update rows in the database
    /// </summary>
    /// <returns></returns>
    public new SQLiteCommand GetUpdateCommand()
    {
      CheckDisposed();
      return (SQLiteCommand)base.GetUpdateCommand();
    }

    /// <summary>
    /// Returns the automatically-generated SQLite command to update rows in the database
    /// </summary>
    /// <param name="useColumnsForParameterNames"></param>
    /// <returns></returns>
    public new SQLiteCommand GetUpdateCommand(bool useColumnsForParameterNames)
    {
      CheckDisposed();
      return (SQLiteCommand)base.GetUpdateCommand(useColumnsForParameterNames);
    }

    /// <summary>
    /// Returns the automatically-generated SQLite command to insert rows into the database
    /// </summary>
    /// <returns></returns>
    public new SQLiteCommand GetInsertCommand()
    {
      CheckDisposed();
      return (SQLiteCommand)base.GetInsertCommand();
    }

    /// <summary>
    /// Returns the automatically-generated SQLite command to insert rows into the database
    /// </summary>
    /// <param name="useColumnsForParameterNames"></param>
    /// <returns></returns>
    public new SQLiteCommand GetInsertCommand(bool useColumnsForParameterNames)
    {
      CheckDisposed();
      return (SQLiteCommand)base.GetInsertCommand(useColumnsForParameterNames);
    }

    /// <summary>
    /// Overridden to hide its property from the designer
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false)]
#endif
    public override CatalogLocation CatalogLocation
    {
      get
      {
        CheckDisposed();
        return base.CatalogLocation;
      }
      set
      {
        CheckDisposed();
        base.CatalogLocation = value;
      }
    }

    /// <summary>
    /// Overridden to hide its property from the designer
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false)]
#endif
    public override string CatalogSeparator
    {
      get
      {
        CheckDisposed();
        return base.CatalogSeparator;
      }
      set
      {
        CheckDisposed();
        base.CatalogSeparator = value;
      }
    }

    /// <summary>
    /// Overridden to hide its property from the designer
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false)]
#endif
    [DefaultValue("[")]
    public override string QuotePrefix
    {
      get
      {
        CheckDisposed();
        return base.QuotePrefix;
      }
      set
      {
        CheckDisposed();
        base.QuotePrefix = value;
      }
    }

    /// <summary>
    /// Overridden to hide its property from the designer
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false)]
#endif
    public override string QuoteSuffix
    {
      get
      {
        CheckDisposed();
        return base.QuoteSuffix;
      }
      set
      {
        CheckDisposed();
        base.QuoteSuffix = value;
      }
    }

    /// <summary>
    /// Places brackets around an identifier
    /// </summary>
    /// <param name="unquotedIdentifier">The identifier to quote</param>
    /// <returns>The bracketed identifier</returns>
    public override string QuoteIdentifier(string unquotedIdentifier)
    {
      CheckDisposed();

      if (String.IsNullOrEmpty(QuotePrefix)
        || String.IsNullOrEmpty(QuoteSuffix)
        || String.IsNullOrEmpty(unquotedIdentifier))
        return unquotedIdentifier;

      return QuotePrefix + unquotedIdentifier.Replace(QuoteSuffix, QuoteSuffix + QuoteSuffix) + QuoteSuffix;
    }

    /// <summary>
    /// Removes brackets around an identifier
    /// </summary>
    /// <param name="quotedIdentifier">The quoted (bracketed) identifier</param>
    /// <returns>The undecorated identifier</returns>
    public override string UnquoteIdentifier(string quotedIdentifier)
    {
      CheckDisposed();

      if (String.IsNullOrEmpty(QuotePrefix)
        || String.IsNullOrEmpty(QuoteSuffix)
        || String.IsNullOrEmpty(quotedIdentifier))
        return quotedIdentifier;

      if (quotedIdentifier.StartsWith(QuotePrefix, StringComparison.OrdinalIgnoreCase) == false
        || quotedIdentifier.EndsWith(QuoteSuffix, StringComparison.OrdinalIgnoreCase) == false)
280
281
282
283
284
285
286

287
288
289
290

291
292
293
294
295
296
297
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false)]
#endif
    public override string SchemaSeparator
    {
      get
      {

        return base.SchemaSeparator;
      }
      set
      {

        base.SchemaSeparator = value;
      }
    }

    /// <summary>
    /// Override helper, which can help the base command builder choose the right keys for the given query
    /// </summary>







>




>







350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false)]
#endif
    public override string SchemaSeparator
    {
      get
      {
        CheckDisposed();
        return base.SchemaSeparator;
      }
      set
      {
        CheckDisposed();
        base.SchemaSeparator = value;
      }
    }

    /// <summary>
    /// Override helper, which can help the base command builder choose the right keys for the given query
    /// </summary>
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
        return schema;
      }
    }

    private bool HasSchemaPrimaryKey(DataTable schema)
    {
      DataColumn IsKeyColumn = schema.Columns[SchemaTableColumn.IsKey];
      
      foreach (DataRow schemaRow in schema.Rows)
      {
        if ((bool)schemaRow[IsKeyColumn] == true)
          return true;
      }

      return false;







|







384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
        return schema;
      }
    }

    private bool HasSchemaPrimaryKey(DataTable schema)
    {
      DataColumn IsKeyColumn = schema.Columns[SchemaTableColumn.IsKey];

      foreach (DataRow schemaRow in schema.Rows)
      {
        if ((bool)schemaRow[IsKeyColumn] == true)
          return true;
      }

      return false;

Deleted System.Data.SQLite/SQLiteConnection.bmp.

cannot compute difference between binary files

Changes to System.Data.SQLite/SQLiteConnection.cs.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18









































































































































































































































































































































































































































































































































































































































































































































































































































































































































































19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34





35
36
37
38



















39
40
41
42
43
44
45
46














































47
48
49
50






















51
52







53
54
55
56
































57

58



59
60
61
62
63
64







65
66
67
68
69

70





71
72
73
74
75
76
77




78








79
80

81












82






83
84
85
86













87

88



89
90
91
92
93


94





95
96
97
98
99

100



101
102
103
104
105
106
107
108
109
110
111



112

113
114
115
116
117
118
119
120
121
122






















123



124

















125
126
127
128
129



130

131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147












148



149

















































150
151
152
153
154
155












































































156
157




158

159



160









































161
162
163

164
165
166
167











168
169
170
171
172


















173
174
175
176
177
178






179
180
181
182
183













184
185
186
187
188
189
190
191


192
193
194
195
196
197































































198
199
200

















































201
202
203
204
205



206
207


208
209



210
211


212












































































213
214
215
216
217


218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234

235


























































































































236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252

253

254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277






























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































278
279
280
281
282
283
284
285
286

287
288
289
290
291
292
293
294
295
296
297
298

299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328




329



330
331

332
333
334
335

336

337
338

339
340

341

























342
343
344
345
346
347
348
349
350
351

352
353
354
355
356
357
358
359
360
361
362
363
364

365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383

384
385
386
387

388
389
390
391
392

393
394
395
396
397
398
399
400
401
402
403
404
405
406

407
408
409
410





411












412
413
414
415

416
417
418
419






420
421
422
423
424
425
426
427









428
429
430





431
432
433
434
435
436









437
438

439
440
441
442



443

444

445
446

447
448
449
450
451
452
453

454

455








456
















































457
458
459
460
461
462
463
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Data;
  using System.Data.Common;

  using System.Collections.Generic;
  using System.Globalization;
  using System.ComponentModel;
  using System.Text;
  using System.Runtime.InteropServices;
  using System.IO;










































































































































































































































































































































































































































































































































































































































































































































































































































































































































































  /// <summary>
  /// SQLite implentation of DbConnection.
  /// </summary>
  /// <remarks>
  /// The <see cref="ConnectionString">ConnectionString</see> property of the SQLiteConnection class can contain the following parameter(s), delimited with a semi-colon:
  /// <list type="table">
  /// <listheader>
  /// <term>Parameter</term>
  /// <term>Values</term>
  /// <term>Required</term>
  /// <term>Default</term>
  /// </listheader>
  /// <item>
  /// <description>Data Source</description>
  /// <description>{filename}</description>





  /// <description>Y</description>
  /// <description></description>
  /// </item>
  /// <item>



















  /// <description>Version</description>
  /// <description>3</description>
  /// <description>N</description>
  /// <description>3</description>
  /// </item>
  /// <item>
  /// <description>UseUTF16Encoding</description>
  /// <description><b>True</b><br/><b>False</b></description>














































  /// <description>N</description>
  /// <description>False</description>
  /// </item>
  /// <item>






















  /// <description>DateTimeFormat</description>
  /// <description><b>Ticks</b> - Use DateTime.Ticks<br/><b>ISO8601</b> - Use ISO8601 DateTime format</description>







  /// <description>N</description>
  /// <description>ISO8601</description>
  /// </item>
  /// <item>
































  /// <description>BinaryGUID</description>

  /// <description><b>True</b> - Store GUID columns in binary form<br/><b>False</b> - Store GUID columns as text</description>



  /// <description>N</description>
  /// <description>True</description>
  /// </item>
  /// <item>
  /// <description>Cache Size</description>
  /// <description>{size in bytes}</description>







  /// <description>N</description>
  /// <description>2000</description>
  /// </item>
  /// <item>
  /// <description>Synchronous</description>

  /// <description><b>Normal</b> - Normal file flushing behavior<br/><b>Full</b> - Full flushing after all writes<br/><b>Off</b> - Underlying OS flushes I/O's</description>





  /// <description>N</description>
  /// <description>Normal</description>
  /// </item>
  /// <item>
  /// <description>Page Size</description>
  /// <description>{size in bytes}</description>
  /// <description>N</description>




  /// <description>1024</description>








  /// </item>
  /// <item>

  /// <description>Password</description>












  /// <description>{password}</description>






  /// <description>N</description>
  /// <description></description>
  /// </item>
  /// <item>













  /// <description>Enlist</description>

  /// <description><b>Y</b> - Automatically enlist in distributed transactions<br/><b>N</b> - No automatic enlistment</description>



  /// <description>N</description>
  /// <description>Y</description>
  /// </item>
  /// <item>
  /// <description>Pooling</description>


  /// <description><b>True</b> - Use connection pooling<br/><b>False</b> - Do not use connection pooling</description>





  /// <description>N</description>
  /// <description>False</description>
  /// </item>
  /// <item>
  /// <description>FailIfMissing</description>

  /// <description><b>True</b> - Don't create the database if it does not exist, throw an error instead<br/><b>False</b> - Automatically create the database if it does not exist</description>



  /// <description>N</description>
  /// <description>False</description>
  /// </item>
  /// <item>
  /// <description>Max Page Count</description>
  /// <description>{size in pages} - Limits the maximum number of pages (limits the size) of the database</description>
  /// <description>N</description>
  /// <description>0</description>
  /// </item>
  /// <item>
  /// <description>Legacy Format</description>



  /// <description><b>True</b> - Use the more compatible legacy 3.x database format<br/><b>False</b> - Use the newer 3.3x database format which compresses numbers more effectively</description>

  /// <description>N</description>
  /// <description>False</description>
  /// </item>
  /// <item>
  /// <description>Default Timeout</description>
  /// <description>{time in seconds}<br/>The default command timeout</description>
  /// <description>N</description>
  /// <description>30</description>
  /// </item>
  /// <item>






















  /// <description>Journal Mode</description>



  /// <description><b>Delete</b> - Delete the journal file after a commit<br/><b>Persist</b> - Zero out and leave the journal file on disk after a commit<br/><b>Off</b> - Disable the rollback journal entirely</description>

















  /// <description>N</description>
  /// <description>Delete</description>
  /// </item>
  /// <item>
  /// <description>Read Only</description>



  /// <description><b>True</b> - Open the database for read only access<br/><b>False</b> - Open the database for normal read/write access</description>

  /// <description>N</description>
  /// <description>False</description>
  /// </item>
  /// <item>
  /// <description>Max Pool Size</description>
  /// <description>The maximum number of connections for the given connection string that can be in the connection pool</description>
  /// <description>N</description>
  /// <description>100</description>
  /// </item>
  /// <item>
  /// <description>Default IsolationLevel</description>
  /// <description>The default transaciton isolation level</description>
  /// <description>N</description>
  /// <description>Serializable</description>
  /// </item>
  /// <item>
  /// <description>Foreign Keys</description>












  /// <description><b>True</b> - Enables foreign key enforcement<br/><b>False</b> - Disables foreign key enforcement</description>



  /// <description>N</description>

















































  /// <description>False</description>
  /// </item>
  /// </list>
  /// </remarks>
  public sealed partial class SQLiteConnection : DbConnection, ICloneable
  {












































































    private const string _dataDirectory = "|DataDirectory|";
    private const string _masterdb = "sqlite_master";




    private const string _tempmasterdb = "sqlite_temp_master";





    /// <summary>









































    /// State of the current connection
    /// </summary>
    private ConnectionState _connectionState;

    /// <summary>
    /// The connection string
    /// </summary>
    private string _connectionString;











    /// <summary>
    /// Nesting level of the transactions open on the connection
    /// </summary>
    internal int _transactionLevel;



















    /// <summary>
    /// The default isolation level for new transactions
    /// </summary>
    private IsolationLevel _defaultIsolation;

#if !PLATFORM_COMPACTFRAMEWORK






    /// <summary>
    /// Whether or not the connection is enlisted in a distrubuted transaction
    /// </summary>
    internal SQLiteEnlistment _enlistment;
#endif













    /// <summary>
    /// The base SQLite object to interop with
    /// </summary>
    internal SQLiteBase _sql;
    /// <summary>
    /// The database filename minus path and extension
    /// </summary>
    private string _dataSource;


    /// <summary>
    /// Temporary password storage, emptied after the database has been opened
    /// </summary>
    private byte[] _password;

    /// <summary>































































    /// Default command timeout
    /// </summary>
    private int _defaultTimeout = 30;


















































    internal bool _binaryGuid;

    internal long _version;




    private event SQLiteUpdateEventHandler _updateHandler;
    private event SQLiteCommitHandler _commitHandler;


    private event EventHandler _rollbackHandler;




    private SQLiteUpdateCallback _updateCallback;
    private SQLiteCommitCallback _commitCallback;


    private SQLiteRollbackCallback _rollbackCallback;













































































    /// <summary>
    /// This event is raised whenever the database is opened or closed.
    /// </summary>
    public override event StateChangeEventHandler StateChange;



    ///<overloads>
    /// Constructs a new SQLiteConnection object
    /// </overloads>
    /// <summary>
    /// Default constructor
    /// </summary>
    public SQLiteConnection()
      : this("")
    {
    }

    /// <summary>
    /// Initializes the connection with the specified connection string
    /// </summary>
    /// <param name="connectionString">The connection string to use on the connection</param>
    public SQLiteConnection(string connectionString)

    {


























































































































      _connectionState = ConnectionState.Closed;
      _connectionString = "";
      //_commandList = new List<WeakReference>();

      if (connectionString != null)
        ConnectionString = connectionString;
    }

    /// <summary>
    /// Clones the settings and connection string from an existing connection.  If the existing connection is already open, this
    /// function will open its own connection, enumerate any attached databases of the original connection, and automatically
    /// attach to them.
    /// </summary>
    /// <param name="connection"></param>
    public SQLiteConnection(SQLiteConnection connection)
      : this(connection.ConnectionString)
    {

      string str;


      if (connection.State == ConnectionState.Open)
      {
        Open();

        // Reattach all attached databases from the existing connection
        using (DataTable tbl = connection.GetSchema("Catalogs"))
        {
          foreach (DataRow row in tbl.Rows)
          {
            str = row[0].ToString();
            if (String.Compare(str, "main", StringComparison.OrdinalIgnoreCase) != 0
              && String.Compare(str, "temp", StringComparison.OrdinalIgnoreCase) != 0)
            {
              using (SQLiteCommand cmd = CreateCommand())
              {
                cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "ATTACH DATABASE '{0}' AS [{1}]", row[1], row[0]);
                cmd.ExecuteNonQuery();
              }
            }
          }
        }
      }
    }































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































#if PLATFORM_COMPACTFRAMEWORK
    /// <summary>
    /// Obsolete
    /// </summary>
    public override int ConnectionTimeout
    {
      get
      {

        return 30;
      }
    }
#endif

    /// <summary>
    /// Creates a clone of the connection.  All attached databases and user-defined functions are cloned.  If the existing connection is open, the cloned connection 
    /// will also be opened.
    /// </summary>
    /// <returns></returns>
    public object Clone()
    {

      return new SQLiteConnection(this);
    }

    /// <summary>
    /// Disposes of the SQLiteConnection, closing it if it is active.
    /// </summary>
    /// <param name="disposing">True if the connection is being explicitly closed.</param>
    protected override void Dispose(bool disposing)
    {
      base.Dispose(disposing);

      if (disposing)
        Close();
    }

    /// <summary>
    /// Creates a database file.  This just creates a zero-byte file which SQLite
    /// will turn into a database when the file is opened properly.
    /// </summary>
    /// <param name="databaseFileName">The file to create</param>
    static public void CreateFile(string databaseFileName)
    {
      FileStream fs = File.Create(databaseFileName);
      fs.Close();
    }

    /// <summary>
    /// Raises the state change event when the state of the connection changes
    /// </summary>
    /// <param name="newState">The new state.  If it is different from the previous state, an event is raised.</param>




    internal void OnStateChange(ConnectionState newState)



    {
      ConnectionState oldState = _connectionState;

      _connectionState = newState;

      if (StateChange != null && oldState != newState)
      {

        StateChangeEventArgs e = new StateChangeEventArgs(oldState, newState);

        StateChange(this, e);
      }

    }


    /// <summary>

























    /// OBSOLETE.  Creates a new SQLiteTransaction if one isn't already active on the connection.
    /// </summary>
    /// <param name="isolationLevel">This parameter is ignored.</param>
    /// <param name="deferredLock">When TRUE, SQLite defers obtaining a write lock until a write operation is requested.
    /// When FALSE, a writelock is obtained immediately.  The default is TRUE, but in a multi-threaded multi-writer 
    /// environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock.</param>
    /// <returns>Returns a SQLiteTransaction object.</returns>
    [Obsolete("Use one of the standard BeginTransaction methods, this one will be removed soon")]
    public SQLiteTransaction BeginTransaction(IsolationLevel isolationLevel, bool deferredLock)
    {

      return (SQLiteTransaction)BeginDbTransaction(deferredLock == false ? IsolationLevel.Serializable : IsolationLevel.ReadCommitted);
    }

    /// <summary>
    /// OBSOLETE.  Creates a new SQLiteTransaction if one isn't already active on the connection.
    /// </summary>
    /// <param name="deferredLock">When TRUE, SQLite defers obtaining a write lock until a write operation is requested.
    /// When FALSE, a writelock is obtained immediately.  The default is false, but in a multi-threaded multi-writer 
    /// environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock.</param>
    /// <returns>Returns a SQLiteTransaction object.</returns>
    [Obsolete("Use one of the standard BeginTransaction methods, this one will be removed soon")]
    public SQLiteTransaction BeginTransaction(bool deferredLock)
    {

      return (SQLiteTransaction)BeginDbTransaction(deferredLock == false ? IsolationLevel.Serializable : IsolationLevel.ReadCommitted);
    }

    /// <summary>
    /// Creates a new SQLiteTransaction if one isn't already active on the connection.
    /// </summary>
    /// <param name="isolationLevel">Supported isolation levels are Serializable, ReadCommitted and Unspecified.</param>
    /// <remarks>
    /// Unspecified will use the default isolation level specified in the connection string.  If no isolation level is specified in the 
    /// connection string, Serializable is used.
    /// Serializable transactions are the default.  In this mode, the engine gets an immediate lock on the database, and no other threads
    /// may begin a transaction.  Other threads may read from the database, but not write.
    /// With a ReadCommitted isolation level, locks are deferred and elevated as needed.  It is possible for multiple threads to start
    /// a transaction in ReadCommitted mode, but if a thread attempts to commit a transaction while another thread
    /// has a ReadCommitted lock, it may timeout or cause a deadlock on both threads until both threads' CommandTimeout's are reached.
    /// </remarks>
    /// <returns>Returns a SQLiteTransaction object.</returns>
    public new SQLiteTransaction BeginTransaction(IsolationLevel isolationLevel)
    {

      return (SQLiteTransaction)BeginDbTransaction(isolationLevel);
    }

    /// <summary>

    /// Creates a new SQLiteTransaction if one isn't already active on the connection.
    /// </summary>
    /// <returns>Returns a SQLiteTransaction object.</returns>
    public new SQLiteTransaction BeginTransaction()
    {

      return (SQLiteTransaction)BeginDbTransaction(_defaultIsolation);
    }

    /// <summary>
    /// Forwards to the local BeginTransaction() function
    /// </summary>
    /// <param name="isolationLevel">Supported isolation levels are Unspecified, Serializable, and ReadCommitted</param>
    /// <returns></returns>
    protected override DbTransaction BeginDbTransaction(IsolationLevel isolationLevel)
    {
      if (_connectionState != ConnectionState.Open)
        throw new InvalidOperationException();

      if (isolationLevel == IsolationLevel.Unspecified) isolationLevel = _defaultIsolation;


      if (isolationLevel != IsolationLevel.Serializable && isolationLevel != IsolationLevel.ReadCommitted)
        throw new ArgumentException("isolationLevel");






      return new SQLiteTransaction(this, isolationLevel != IsolationLevel.Serializable);












    }

    /// <summary>
    /// Not implemented

    /// </summary>
    /// <param name="databaseName"></param>
    public override void ChangeDatabase(string databaseName)
    {






      throw new NotImplementedException();
    }

    /// <summary>
    /// When the database connection is closed, all commands linked to this connection are automatically reset.
    /// </summary>
    public override void Close()
    {









      if (_sql != null)
      {
#if !PLATFORM_COMPACTFRAMEWORK





        if (_enlistment != null)
        {
          // If the connection is enlisted in a transaction scope and the scope is still active,
          // we cannot truly shut down this connection until the scope has completed.  Therefore make a 
          // hidden connection temporarily to hold open the connection until the scope has completed.
          SQLiteConnection cnn = new SQLiteConnection();









          cnn._sql = _sql;
          cnn._transactionLevel = _transactionLevel;

          cnn._enlistment = _enlistment;
          cnn._connectionState = _connectionState;
          cnn._version = _version;




          cnn._enlistment._transaction._cnn = cnn;

          cnn._enlistment._disposeConnection = true;

          _sql = null;
          _enlistment = null;

        }
#endif
        if (_sql != null)
        {
          _sql.Close();
        }
        _sql = null;

        _transactionLevel = 0;

      }








      OnStateChange(ConnectionState.Closed);
















































    }

    /// <summary>
    /// Clears the connection pool associated with the connection.  Any other active connections using the same database file
    /// will be discarded instead of returned to the pool when they are closed.
    /// </summary>
    /// <param name="connection"></param>



|








>



|


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





|









|
>
>
>
>
>




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







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




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

|
>
>
>
>
>
>
>




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

>
|
>
>
>





|
>
>
>
>
>
>
>

|



>
|
>
>
>
>
>

|





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


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




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

>
|
>
>
>





>
>
|
>
>
>
>
>





>
|
>
>
>











>
>
>
|
>










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

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





>
>
>
|
>

















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

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




|

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

|
>
>
>
>
|
>

>
>
>

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



>




>
>
>
>
>
>
>
>
>
>
>





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






>
>
>
>
>
>





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








>
>






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


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



|

>
>
>


>
>


>
>
>


>
>

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





>
>








|




|

|

>

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

|
<










|

|

>
|
>










|
|
|



|







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









>
|





|





>



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














|
>
>
>
>
|
>
>
>

|
>
|

|
|
>
|
>
|
|
>
|
|
>

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




|





>
|






|





>
|



|



|










>




>
|

|


>




|









>

|


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



|
>




>
>
>
>
>
>
|







>
>
>
>
>
>
>
>
>



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

>
>
>
|
>
|
>
|
<
>




|
<
|
>

>

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







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995

1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212












3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440

3441
3442
3443
3444
3445
3446

3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Data;
  using System.Data.Common;
  using System.Diagnostics;
  using System.Collections.Generic;
  using System.Globalization;
  using System.ComponentModel;
  using System.Reflection;
  using System.Runtime.InteropServices;
  using System.IO;
  using System.Text;
  using System.Threading;

  /////////////////////////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// This class represents a single value to be returned
  /// from the <see cref="SQLiteDataReader" /> class via
  /// its <see cref="SQLiteDataReader.GetBlob" />,
  /// <see cref="SQLiteDataReader.GetBoolean" />,
  /// <see cref="SQLiteDataReader.GetByte" />,
  /// <see cref="SQLiteDataReader.GetBytes" />,
  /// <see cref="SQLiteDataReader.GetChar" />,
  /// <see cref="SQLiteDataReader.GetChars" />,
  /// <see cref="SQLiteDataReader.GetDateTime" />,
  /// <see cref="SQLiteDataReader.GetDecimal" />,
  /// <see cref="SQLiteDataReader.GetDouble" />,
  /// <see cref="SQLiteDataReader.GetFloat" />,
  /// <see cref="SQLiteDataReader.GetGuid" />,
  /// <see cref="SQLiteDataReader.GetInt16" />,
  /// <see cref="SQLiteDataReader.GetInt32" />,
  /// <see cref="SQLiteDataReader.GetInt64" />,
  /// <see cref="SQLiteDataReader.GetString" />, or
  /// <see cref="SQLiteDataReader.GetValue" /> method.  If the value of the
  /// associated public field of this class is null upon returning from the
  /// callback, the null value will only be used if the return type for the
  /// <see cref="SQLiteDataReader" /> method called is not a value type.
  /// If the value to be returned from the <see cref="SQLiteDataReader" />
  /// method is unsuitable (e.g. null with a value type), an exception will
  /// be thrown.
  /// </summary>
  public sealed class SQLiteDataReaderValue
  {
      /// <summary>
      /// The value to be returned from the
      /// <see cref="SQLiteDataReader.GetBlob" /> method -OR- null to
      /// indicate an error.
      /// </summary>
      public SQLiteBlob BlobValue;

      /// <summary>
      /// The value to be returned from the
      /// <see cref="SQLiteDataReader.GetBoolean" /> method -OR- null to
      /// indicate an error.
      /// </summary>
      public bool? BooleanValue;

      /// <summary>
      /// The value to be returned from the
      /// <see cref="SQLiteDataReader.GetByte" /> method -OR- null to
      /// indicate an error.
      /// </summary>
      public byte? ByteValue;

      /// <summary>
      /// The value to be returned from the
      /// <see cref="SQLiteDataReader.GetBytes" /> method.
      /// </summary>
      public byte[] BytesValue;

      /// <summary>
      /// The value to be returned from the
      /// <see cref="SQLiteDataReader.GetChar" /> method -OR- null to
      /// indicate an error.
      /// </summary>
      public char? CharValue;

      /// <summary>
      /// The value to be returned from the
      /// <see cref="SQLiteDataReader.GetChars" /> method.
      /// </summary>
      public char[] CharsValue;

      /// <summary>
      /// The value to be returned from the
      /// <see cref="SQLiteDataReader.GetDateTime" /> method -OR- null to
      /// indicate an error.
      /// </summary>
      public DateTime? DateTimeValue;

      /// <summary>
      /// The value to be returned from the
      /// <see cref="SQLiteDataReader.GetDecimal" /> method -OR- null to
      /// indicate an error.
      /// </summary>
      public decimal? DecimalValue;

      /// <summary>
      /// The value to be returned from the
      /// <see cref="SQLiteDataReader.GetDouble" /> method -OR- null to
      /// indicate an error.
      /// </summary>
      public double? DoubleValue;

      /// <summary>
      /// The value to be returned from the
      /// <see cref="SQLiteDataReader.GetFloat" /> method -OR- null to
      /// indicate an error.
      /// </summary>
      public float? FloatValue;

      /// <summary>
      /// The value to be returned from the
      /// <see cref="SQLiteDataReader.GetGuid" /> method -OR- null to
      /// indicate an error.
      /// </summary>
      public Guid? GuidValue;

      /// <summary>
      /// The value to be returned from the
      /// <see cref="SQLiteDataReader.GetInt16" /> method -OR- null to
      /// indicate an error.
      /// </summary>
      public short? Int16Value;

      /// <summary>
      /// The value to be returned from the
      /// <see cref="SQLiteDataReader.GetInt32" /> method -OR- null to
      /// indicate an error.
      /// </summary>
      public int? Int32Value;

      /// <summary>
      /// The value to be returned from the
      /// <see cref="SQLiteDataReader.GetInt64" /> method -OR- null to
      /// indicate an error.
      /// </summary>
      public long? Int64Value;

      /// <summary>
      /// The value to be returned from the
      /// <see cref="SQLiteDataReader.GetString" /> method.
      /// </summary>
      public string StringValue;

      /// <summary>
      /// The value to be returned from the
      /// <see cref="SQLiteDataReader.GetValue" /> method.
      /// </summary>
      public object Value;
  }

  /////////////////////////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// This class represents the parameters that are provided
  /// to the <see cref="SQLiteDataReader" /> methods, with
  /// the exception of the column index (provided separately).
  /// </summary>
  public abstract class SQLiteReadEventArgs : EventArgs
  {
      // nothing.
  }

  /////////////////////////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// This class represents the parameters that are provided to
  /// the <see cref="SQLiteDataReader.GetBlob" /> method, with
  /// the exception of the column index (provided separately).
  /// </summary>
  public class SQLiteReadBlobEventArgs : SQLiteReadEventArgs
  {
      #region Private Data
      /// <summary>
      /// Provides the underlying storage for the
      /// <see cref="ReadOnly" /> property.
      /// </summary>
      private bool readOnly;
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Private Constructors
      /// <summary>
      /// Constructs an instance of this class to pass into a user-defined
      /// callback associated with the <see cref="SQLiteDataReader.GetBlob" />
      /// method.
      /// </summary>
      /// <param name="readOnly">
      /// The value that was originally specified for the "readOnly"
      /// parameter to the <see cref="SQLiteDataReader.GetBlob" /> method.
      /// </param>
      internal SQLiteReadBlobEventArgs(
          bool readOnly
          )
      {
          this.readOnly = readOnly;
      }
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Public Properties
      /// <summary>
      /// The value that was originally specified for the "readOnly"
      /// parameter to the <see cref="SQLiteDataReader.GetBlob" /> method.
      /// </summary>
      public bool ReadOnly
      {
          get { return readOnly; }
          set { readOnly = value; }
      }
      #endregion
  }

  /////////////////////////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// This class represents the parameters that are provided
  /// to the <see cref="SQLiteDataReader.GetBytes" /> and
  /// <see cref="SQLiteDataReader.GetChars" /> methods, with
  /// the exception of the column index (provided separately).
  /// </summary>
  public class SQLiteReadArrayEventArgs : SQLiteReadEventArgs
  {
      #region Private Data
      /// <summary>
      /// Provides the underlying storage for the
      /// <see cref="DataOffset" /> property.
      /// </summary>
      private long dataOffset;

      /// <summary>
      /// Provides the underlying storage for the
      /// <see cref="ByteBuffer" /> property.
      /// </summary>
      private byte[] byteBuffer;

      /// <summary>
      /// Provides the underlying storage for the
      /// <see cref="CharBuffer" /> property.
      /// </summary>
      private char[] charBuffer;

      /// <summary>
      /// Provides the underlying storage for the
      /// <see cref="BufferOffset" /> property.
      /// </summary>
      private int bufferOffset;

      /// <summary>
      /// Provides the underlying storage for the
      /// <see cref="Length" /> property.
      /// </summary>
      private int length;
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Private Constructors
      /// <summary>
      /// Constructs an instance of this class to pass into a user-defined
      /// callback associated with the <see cref="SQLiteDataReader.GetBytes" />
      /// method.
      /// </summary>
      /// <param name="dataOffset">
      /// The value that was originally specified for the "dataOffset"
      /// parameter to the <see cref="SQLiteDataReader.GetBytes" /> or
      /// <see cref="SQLiteDataReader.GetChars" /> methods.
      /// </param>
      /// <param name="byteBuffer">
      /// The value that was originally specified for the "buffer"
      /// parameter to the <see cref="SQLiteDataReader.GetBytes" />
      /// method.
      /// </param>
      /// <param name="bufferOffset">
      /// The value that was originally specified for the "bufferOffset"
      /// parameter to the <see cref="SQLiteDataReader.GetBytes" /> or
      /// <see cref="SQLiteDataReader.GetChars" /> methods.
      /// </param>
      /// <param name="length">
      /// The value that was originally specified for the "length"
      /// parameter to the <see cref="SQLiteDataReader.GetBytes" /> or
      /// <see cref="SQLiteDataReader.GetChars" /> methods.
      /// </param>
      internal SQLiteReadArrayEventArgs(
          long dataOffset,
          byte[] byteBuffer,
          int bufferOffset,
          int length
          )
      {
          this.dataOffset = dataOffset;
          this.byteBuffer = byteBuffer;
          this.bufferOffset = bufferOffset;
          this.length = length;
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Constructs an instance of this class to pass into a user-defined
      /// callback associated with the <see cref="SQLiteDataReader.GetChars" />
      /// method.
      /// </summary>
      /// <param name="dataOffset">
      /// The value that was originally specified for the "dataOffset"
      /// parameter to the <see cref="SQLiteDataReader.GetBytes" /> or
      /// <see cref="SQLiteDataReader.GetChars" /> methods.
      /// </param>
      /// <param name="charBuffer">
      /// The value that was originally specified for the "buffer"
      /// parameter to the <see cref="SQLiteDataReader.GetChars" />
      /// method.
      /// </param>
      /// <param name="bufferOffset">
      /// The value that was originally specified for the "bufferOffset"
      /// parameter to the <see cref="SQLiteDataReader.GetBytes" /> or
      /// <see cref="SQLiteDataReader.GetChars" /> methods.
      /// </param>
      /// <param name="length">
      /// The value that was originally specified for the "length"
      /// parameter to the <see cref="SQLiteDataReader.GetBytes" /> or
      /// <see cref="SQLiteDataReader.GetChars" /> methods.
      /// </param>
      internal SQLiteReadArrayEventArgs(
          long dataOffset,
          char[] charBuffer,
          int bufferOffset,
          int length
          )
      {
          this.dataOffset = dataOffset;
          this.charBuffer = charBuffer;
          this.bufferOffset = bufferOffset;
          this.length = length;
      }
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Public Properties
      /// <summary>
      /// The value that was originally specified for the "dataOffset"
      /// parameter to the <see cref="SQLiteDataReader.GetBytes" /> or
      /// <see cref="SQLiteDataReader.GetChars" /> methods.
      /// </summary>
      public long DataOffset
      {
          get { return dataOffset; }
          set { dataOffset = value; }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// The value that was originally specified for the "buffer"
      /// parameter to the <see cref="SQLiteDataReader.GetBytes" />
      /// method.
      /// </summary>
      public byte[] ByteBuffer
      {
          get { return byteBuffer; }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// The value that was originally specified for the "buffer"
      /// parameter to the <see cref="SQLiteDataReader.GetChars" />
      /// method.
      /// </summary>
      public char[] CharBuffer
      {
          get { return charBuffer; }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// The value that was originally specified for the "bufferOffset"
      /// parameter to the <see cref="SQLiteDataReader.GetBytes" /> or
      /// <see cref="SQLiteDataReader.GetChars" /> methods.
      /// </summary>
      public int BufferOffset
      {
          get { return bufferOffset; }
          set { bufferOffset = value; }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// The value that was originally specified for the "length"
      /// parameter to the <see cref="SQLiteDataReader.GetBytes" /> or
      /// <see cref="SQLiteDataReader.GetChars" /> methods.
      /// </summary>
      public int Length
      {
          get { return length; }
          set { length = value; }
      }
      #endregion
  }

  /////////////////////////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// This class represents the parameters and return values for the
  /// <see cref="SQLiteDataReader.GetBlob" />,
  /// <see cref="SQLiteDataReader.GetBoolean" />,
  /// <see cref="SQLiteDataReader.GetByte" />,
  /// <see cref="SQLiteDataReader.GetBytes" />,
  /// <see cref="SQLiteDataReader.GetChar" />,
  /// <see cref="SQLiteDataReader.GetChars" />,
  /// <see cref="SQLiteDataReader.GetDateTime" />,
  /// <see cref="SQLiteDataReader.GetDecimal" />,
  /// <see cref="SQLiteDataReader.GetDouble" />,
  /// <see cref="SQLiteDataReader.GetFloat" />,
  /// <see cref="SQLiteDataReader.GetGuid" />,
  /// <see cref="SQLiteDataReader.GetInt16" />,
  /// <see cref="SQLiteDataReader.GetInt32" />,
  /// <see cref="SQLiteDataReader.GetInt64" />,
  /// <see cref="SQLiteDataReader.GetString" />, and
  /// <see cref="SQLiteDataReader.GetValue" /> methods.
  /// </summary>
  public class SQLiteReadValueEventArgs : SQLiteReadEventArgs
  {
      #region Private Data
      /// <summary>
      /// Provides the underlying storage for the
      /// <see cref="MethodName" /> property.
      /// </summary>
      private string methodName;

      /// <summary>
      /// Provides the underlying storage for the
      /// <see cref="ExtraEventArgs" /> property.
      /// </summary>
      private SQLiteReadEventArgs extraEventArgs;

      /// <summary>
      /// Provides the underlying storage for the
      /// <see cref="Value" /> property.
      /// </summary>
      private SQLiteDataReaderValue value;
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Private Constructors
      /// <summary>
      /// Constructs a new instance of this class.  Depending on the method
      /// being called, the <paramref name="extraEventArgs" /> and/or
      /// <paramref name="value" /> parameters may be null.
      /// </summary>
      /// <param name="methodName">
      /// The name of the <see cref="SQLiteDataReader" /> method that was
      /// responsible for invoking this callback.
      /// </param>
      /// <param name="extraEventArgs">
      /// If the <see cref="SQLiteDataReader.GetBytes" /> or
      /// <see cref="SQLiteDataReader.GetChars" /> method is being called,
      /// this object will contain the array related parameters for that
      /// method.  If the <see cref="SQLiteDataReader.GetBlob" /> method is
      /// being called, this object will contain the blob related parameters
      /// for that method.
      /// </param>
      /// <param name="value">
      /// This may be used by the callback to set the return value for the
      /// called <see cref="SQLiteDataReader" /> method.
      /// </param>
      internal SQLiteReadValueEventArgs(
          string methodName,
          SQLiteReadEventArgs extraEventArgs,
          SQLiteDataReaderValue value
          )
      {
          this.methodName = methodName;
          this.extraEventArgs = extraEventArgs;
          this.value = value;
      }
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Public Properties
      /// <summary>
      /// The name of the <see cref="SQLiteDataReader" /> method that was
      /// responsible for invoking this callback.
      /// </summary>
      public string MethodName
      {
          get { return methodName; }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// If the <see cref="SQLiteDataReader.GetBytes" /> or
      /// <see cref="SQLiteDataReader.GetChars" /> method is being called,
      /// this object will contain the array related parameters for that
      /// method.  If the <see cref="SQLiteDataReader.GetBlob" /> method is
      /// being called, this object will contain the blob related parameters
      /// for that method.
      /// </summary>
      public SQLiteReadEventArgs ExtraEventArgs
      {
          get { return extraEventArgs; }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// This may be used by the callback to set the return value for the
      /// called <see cref="SQLiteDataReader" /> method.
      /// </summary>
      public SQLiteDataReaderValue Value
      {
          get { return value; }
      }
      #endregion
  }

  /////////////////////////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// This represents a method that will be called in response to a request to
  /// bind a parameter to a command.  If an exception is thrown, it will cause
  /// the parameter binding operation to fail -AND- it will continue to unwind
  /// the call stack.
  /// </summary>
  /// <param name="convert">
  /// The <see cref="SQLiteConvert" /> instance in use.
  /// </param>
  /// <param name="command">
  /// The <see cref="SQLiteCommand" /> instance in use.
  /// </param>
  /// <param name="flags">
  /// The flags associated with the <see cref="SQLiteConnection" /> instance
  /// in use.
  /// </param>
  /// <param name="parameter">
  /// The <see cref="SQLiteParameter" /> instance being bound to the command.
  /// </param>
  /// <param name="typeName">
  /// The database type name associated with this callback.
  /// </param>
  /// <param name="index">
  /// The ordinal of the parameter being bound to the command.
  /// </param>
  /// <param name="userData">
  /// The data originally used when registering this callback.
  /// </param>
  /// <param name="complete">
  /// Non-zero if the default handling for the parameter binding call should
  /// be skipped (i.e. the parameter should not be bound at all).  Great care
  /// should be used when setting this to non-zero.
  /// </param>
  public delegate void SQLiteBindValueCallback(
      SQLiteConvert convert,
      SQLiteCommand command,
      SQLiteConnectionFlags flags,
      SQLiteParameter parameter,
      string typeName,
      int index,
      object userData,
      out bool complete
  );

  /////////////////////////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// This represents a method that will be called in response to a request
  /// to read a value from a data reader.  If an exception is thrown, it will
  /// cause the data reader operation to fail -AND- it will continue to unwind
  /// the call stack.
  /// </summary>
  /// <param name="convert">
  /// The <see cref="SQLiteConvert" /> instance in use.
  /// </param>
  /// <param name="dataReader">
  /// The <see cref="SQLiteDataReader" /> instance in use.
  /// </param>
  /// <param name="flags">
  /// The flags associated with the <see cref="SQLiteConnection" /> instance
  /// in use.
  /// </param>
  /// <param name="eventArgs">
  /// The parameter and return type data for the column being read from the
  /// data reader.
  /// </param>
  /// <param name="typeName">
  /// The database type name associated with this callback.
  /// </param>
  /// <param name="index">
  /// The zero based index of the column being read from the data reader.
  /// </param>
  /// <param name="userData">
  /// The data originally used when registering this callback.
  /// </param>
  /// <param name="complete">
  /// Non-zero if the default handling for the data reader call should be
  /// skipped.  If this is set to non-zero and the necessary return value
  /// is unavailable or unsuitable, an exception will be thrown.
  /// </param>
  public delegate void SQLiteReadValueCallback(
      SQLiteConvert convert,
      SQLiteDataReader dataReader,
      SQLiteConnectionFlags flags,
      SQLiteReadEventArgs eventArgs,
      string typeName,
      int index,
      object userData,
      out bool complete
  );

  /////////////////////////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// This class represents the custom data type handling callbacks
  /// for a single type name.
  /// </summary>
  public sealed class SQLiteTypeCallbacks
  {
      #region Private Data
      /// <summary>
      /// Provides the underlying storage for the
      /// <see cref="TypeName" /> property.
      /// </summary>
      private string typeName;

      /// <summary>
      /// Provides the underlying storage for the
      /// <see cref="BindValueCallback" /> property.
      /// </summary>
      private SQLiteBindValueCallback bindValueCallback;

      /// <summary>
      /// Provides the underlying storage for the
      /// <see cref="ReadValueCallback" /> property.
      /// </summary>
      private SQLiteReadValueCallback readValueCallback;

      /// <summary>
      /// Provides the underlying storage for the
      /// <see cref="BindValueUserData" /> property.
      /// </summary>
      private object bindValueUserData;

      /// <summary>
      /// Provides the underlying storage for the
      /// <see cref="ReadValueUserData" /> property.
      /// </summary>
      private object readValueUserData;
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Private Constructors
      /// <summary>
      /// Constructs an instance of this class.
      /// </summary>
      /// <param name="bindValueCallback">
      /// The custom paramater binding callback.  This parameter may be null.
      /// </param>
      /// <param name="readValueCallback">
      /// The custom data reader value callback.  This parameter may be null.
      /// </param>
      /// <param name="bindValueUserData">
      /// The extra data to pass into the parameter binding callback.  This
      /// parameter may be null.
      /// </param>
      /// <param name="readValueUserData">
      /// The extra data to pass into the data reader value callback.  This
      /// parameter may be null.
      /// </param>
      private SQLiteTypeCallbacks(
          SQLiteBindValueCallback bindValueCallback,
          SQLiteReadValueCallback readValueCallback,
          object bindValueUserData,
          object readValueUserData
          )
      {
          this.bindValueCallback = bindValueCallback;
          this.readValueCallback = readValueCallback;
          this.bindValueUserData = bindValueUserData;
          this.readValueUserData = readValueUserData;
      }
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Static "Factory" Methods
      /// <summary>
      /// Creates an instance of the <see cref="SQLiteTypeCallbacks" /> class.
      /// </summary>
      /// <param name="bindValueCallback">
      /// The custom paramater binding callback.  This parameter may be null.
      /// </param>
      /// <param name="readValueCallback">
      /// The custom data reader value callback.  This parameter may be null.
      /// </param>
      /// <param name="bindValueUserData">
      /// The extra data to pass into the parameter binding callback.  This
      /// parameter may be null.
      /// </param>
      /// <param name="readValueUserData">
      /// The extra data to pass into the data reader value callback.  This
      /// parameter may be null.
      /// </param>
      public static SQLiteTypeCallbacks Create(
          SQLiteBindValueCallback bindValueCallback,
          SQLiteReadValueCallback readValueCallback,
          object bindValueUserData,
          object readValueUserData
          )
      {
          return new SQLiteTypeCallbacks(
              bindValueCallback, readValueCallback, bindValueUserData,
              readValueUserData);
      }
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Public Properties
      /// <summary>
      /// The database type name that the callbacks contained in this class
      /// will apply to.  This value may not be null.
      /// </summary>
      public string TypeName
      {
          get { return typeName; }
          internal set { typeName = value; }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// The custom paramater binding callback.  This value may be null.
      /// </summary>
      public SQLiteBindValueCallback BindValueCallback
      {
          get { return bindValueCallback; }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// The custom data reader value callback.  This value may be null.
      /// </summary>
      public SQLiteReadValueCallback ReadValueCallback
      {
          get { return readValueCallback; }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// The extra data to pass into the parameter binding callback.  This
      /// value may be null.
      /// </summary>
      public object BindValueUserData
      {
          get { return bindValueUserData; }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// The extra data to pass into the data reader value callback.  This
      /// value may be null.
      /// </summary>
      public object ReadValueUserData
      {
          get { return readValueUserData; }
      }
      #endregion
  }

  /////////////////////////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// This class represents the mappings between database type names
  /// and their associated custom data type handling callbacks.
  /// </summary>
  internal sealed class SQLiteTypeCallbacksMap
      : Dictionary<string, SQLiteTypeCallbacks>
  {
      /// <summary>
      /// Constructs an (empty) instance of this class.
      /// </summary>
      public SQLiteTypeCallbacksMap()
          : base(new TypeNameStringComparer())
      {
          // do nothing.
      }
  }

  /////////////////////////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// Event data for connection event handlers.
  /// </summary>
  public class ConnectionEventArgs : EventArgs
  {
      /// <summary>
      /// The type of event being raised.
      /// </summary>
      public readonly SQLiteConnectionEventType EventType;

      /// <summary>
      /// The <see cref="StateChangeEventArgs" /> associated with this event, if any.
      /// </summary>
      public readonly StateChangeEventArgs EventArgs;

      /// <summary>
      /// The transaction associated with this event, if any.
      /// </summary>
      public readonly IDbTransaction Transaction;

      /// <summary>
      /// The command associated with this event, if any.
      /// </summary>
      public readonly IDbCommand Command;

      /// <summary>
      /// The data reader associated with this event, if any.
      /// </summary>
      public readonly IDataReader DataReader;

      /// <summary>
      /// The critical handle associated with this event, if any.
      /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
      public readonly CriticalHandle CriticalHandle;
#else
      public readonly object CriticalHandle;
#endif

      /// <summary>
      /// Command or message text associated with this event, if any.
      /// </summary>
      public readonly string Text;

      /// <summary>
      /// Extra data associated with this event, if any.
      /// </summary>
      public readonly object Data;

      /////////////////////////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Constructs the object.
      /// </summary>
      /// <param name="eventType">The type of event being raised.</param>
      /// <param name="eventArgs">The base <see cref="EventArgs" /> associated
      /// with this event, if any.</param>
      /// <param name="transaction">The transaction associated with this event, if any.</param>
      /// <param name="command">The command associated with this event, if any.</param>
      /// <param name="dataReader">The data reader associated with this event, if any.</param>
      /// <param name="criticalHandle">The critical handle associated with this event, if any.</param>
      /// <param name="text">The command or message text, if any.</param>
      /// <param name="data">The extra data, if any.</param>
      internal ConnectionEventArgs(
          SQLiteConnectionEventType eventType,
          StateChangeEventArgs eventArgs,
          IDbTransaction transaction,
          IDbCommand command,
          IDataReader dataReader,
#if !PLATFORM_COMPACTFRAMEWORK
          CriticalHandle criticalHandle,
#else
          object criticalHandle,
#endif
          string text,
          object data
          )
          : this(eventType, eventArgs, transaction, command, dataReader, criticalHandle, text, data, null)
      {
          // do nothing.
      }

      /////////////////////////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Constructs the object.
      /// </summary>
      /// <param name="eventType">The type of event being raised.</param>
      /// <param name="eventArgs">The base <see cref="EventArgs" /> associated
      /// with this event, if any.</param>
      /// <param name="transaction">The transaction associated with this event, if any.</param>
      /// <param name="command">The command associated with this event, if any.</param>
      /// <param name="dataReader">The data reader associated with this event, if any.</param>
      /// <param name="criticalHandle">The critical handle associated with this event, if any.</param>
      /// <param name="text">The command or message text, if any.</param>
      /// <param name="data">The extra data, if any.</param>
      /// <param name="result">The optional event result, if any.</param>
      internal ConnectionEventArgs(
          SQLiteConnectionEventType eventType,
          StateChangeEventArgs eventArgs,
          IDbTransaction transaction,
          IDbCommand command,
          IDataReader dataReader,
#if !PLATFORM_COMPACTFRAMEWORK
          CriticalHandle criticalHandle,
#else
          object criticalHandle,
#endif
          string text,
          object data,
          string result
          )
      {
          EventType = eventType;
          EventArgs = eventArgs;
          Transaction = transaction;
          Command = command;
          DataReader = dataReader;
          CriticalHandle = criticalHandle;
          Text = text;
          Data = data;
          Result = result;
      }

      /////////////////////////////////////////////////////////////////////////////////////////////

      private string result;
      public string Result
      {
          get { return result; }
          set { result = value; }
      }
  }

  /////////////////////////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// Raised when an event pertaining to a connection occurs.
  /// </summary>
  /// <param name="sender">The connection involved.</param>
  /// <param name="e">Extra information about the event.</param>
  public delegate void SQLiteConnectionEventHandler(object sender, ConnectionEventArgs e);

  /////////////////////////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// SQLite implentation of DbConnection.
  /// </summary>
  /// <remarks>
  /// The <see cref="ConnectionString" /> property can contain the following parameter(s), delimited with a semi-colon:
  /// <list type="table">
  /// <listheader>
  /// <term>Parameter</term>
  /// <term>Values</term>
  /// <term>Required</term>
  /// <term>Default</term>
  /// </listheader>
  /// <item>
  /// <description>Data Source</description>
  /// <description>
  /// This may be a file name, the string ":memory:", or any supported URI (starting with SQLite 3.7.7).
  /// Starting with release 1.0.86.0, in order to use more than one consecutive backslash (e.g. for a
  /// UNC path), each of the adjoining backslash characters must be doubled (e.g. "\\Network\Share\test.db"
  /// would become "\\\\Network\Share\test.db").
  /// </description>
  /// <description>Y</description>
  /// <description></description>
  /// </item>
  /// <item>
  /// <description>Uri</description>
  /// <description>
  /// If specified, this must be a file name that starts with "file://", "file:", or "/".  Any leading
  /// "file://" or "file:" prefix will be stripped off and the resulting file name will be used to open
  /// the database.
  /// </description>
  /// <description>N</description>
  /// <description>null</description>
  /// </item>
  /// <item>
  /// <description>FullUri</description>
  /// <description>
  /// If specified, this must be a URI in a format recognized by the SQLite core library (starting with
  /// SQLite 3.7.7).  It will be passed verbatim to the SQLite core library.
  /// </description>
  /// <description>N</description>
  /// <description>null</description>
  /// </item>
  /// <item>
  /// <description>Version</description>
  /// <description>3</description>
  /// <description>N</description>
  /// <description>3</description>
  /// </item>
  /// <item>
  /// <description>UseUTF16Encoding</description>
  /// <description>
  /// <b>True</b> - The UTF-16 encoding should be used.
  /// <br/>
  /// <b>False</b> - The UTF-8 encoding should be used.
  /// </description>
  /// <description>N</description>
  /// <description>False</description>
  /// </item>
  /// <item>
  /// <description>DefaultDbType</description>
  /// <description>
  /// This is the default <see cref="DbType" /> to use when one cannot be determined based on the
  /// column metadata and the configured type mappings.
  /// </description>
  /// <description>N</description>
  /// <description>null</description>
  /// </item>
  /// <item>
  /// <description>DefaultTypeName</description>
  /// <description>
  /// This is the default type name to use when one cannot be determined based on the column metadata
  /// and the configured type mappings.
  /// </description>
  /// <description>N</description>
  /// <description>null</description>
  /// </item>
  /// <item>
  /// <description>NoDefaultFlags</description>
  /// <description>
  /// <b>True</b> - Do not combine the specified (or existing) connection flags with the value of the
  /// <see cref="DefaultFlags" /> property.
  /// <br/>
  /// <b>False</b> - Combine the specified (or existing) connection flags with the value of the
  /// <see cref="DefaultFlags" /> property.
  /// </description>
  /// <description>N</description>
  /// <description>False</description>
  /// </item>
  /// <item>
  /// <description>NoSharedFlags</description>
  /// <description>
  /// <b>True</b> - Do not combine the specified (or existing) connection flags with the value of the
  /// <see cref="SharedFlags" /> property.
  /// <br/>
  /// <b>False</b> - Combine the specified (or existing) connection flags with the value of the
  /// <see cref="SharedFlags" /> property.
  /// </description>
  /// <description>N</description>
  /// <description>False</description>
  /// </item>
  /// <item>
  /// <description>VfsName</description>
  /// <description>
  /// The name of the VFS to use when opening the database connection.
  /// If this is not specified, the default VFS will be used.
  /// </description>
  /// <description>N</description>
  /// <description>null</description>
  /// </item>
  /// <item>
  /// <description>ZipVfsVersion</description>
  /// <description>
  /// If non-null, this is the "version" of ZipVFS to use.  This requires
  /// the System.Data.SQLite interop assembly -AND- primary managed assembly
  /// to be compiled with the INTEROP_INCLUDE_ZIPVFS option; otherwise, this
  /// property does nothing.  The valid values are "v2" and "v3".  Using
  /// anyother value will cause an exception to be thrown.  Please see the
  /// ZipVFS documentation for more information on how to use this parameter.
  /// </description>
  /// <description>N</description>
  /// <description>null</description>
  /// </item>
  /// <item>
  /// <description>DateTimeFormat</description>
  /// <description>
  /// <b>Ticks</b> - Use the value of DateTime.Ticks.<br/>
  /// <b>ISO8601</b> - Use the ISO-8601 format.  Uses the "yyyy-MM-dd HH:mm:ss.FFFFFFFK" format for UTC
  /// DateTime values and "yyyy-MM-dd HH:mm:ss.FFFFFFF" format for local DateTime values).<br/>
  /// <b>JulianDay</b> - The interval of time in days and fractions of a day since January 1, 4713 BC.<br/>
  /// <b>UnixEpoch</b> - The whole number of seconds since the Unix epoch (January 1, 1970).<br/>
  /// <b>InvariantCulture</b> - Any culture-independent string value that the .NET Framework can interpret as a valid DateTime.<br/>
  /// <b>CurrentCulture</b> - Any string value that the .NET Framework can interpret as a valid DateTime using the current culture.</description>
  /// <description>N</description>
  /// <description>ISO8601</description>
  /// </item>
  /// <item>
  /// <description>DateTimeKind</description>
  /// <description>
  /// <b>Unspecified</b> - Not specified as either UTC or local time.
  /// <br/>
  /// <b>Utc</b> - The time represented is UTC.
  /// <br/>
  /// <b>Local</b> - The time represented is local time.
  /// </description>
  /// <description>N</description>
  /// <description>Unspecified</description>
  /// </item>
  /// <item>
  /// <description>DateTimeFormatString</description>
  /// <description>
  /// The exact DateTime format string to use for all formatting and parsing of all DateTime
  /// values for this connection.
  /// </description>
  /// <description>N</description>
  /// <description>null</description>
  /// </item>
  /// <item>
  /// <description>BaseSchemaName</description>
  /// <description>
  /// Some base data classes in the framework (e.g. those that build SQL queries dynamically)
  /// assume that an ADO.NET provider cannot support an alternate catalog (i.e. database) without supporting
  /// alternate schemas as well; however, SQLite does not fit into this model.  Therefore, this value is used
  /// as a placeholder and removed prior to preparing any SQL statements that may contain it.
  /// </description>
  /// <description>N</description>
  /// <description>sqlite_default_schema</description>
  /// </item>
  /// <item>
  /// <description>BinaryGUID</description>
  /// <description>
  /// <b>True</b> - Store GUID columns in binary form
  /// <br/>
  /// <b>False</b> - Store GUID columns as text
  /// </description>
  /// <description>N</description>
  /// <description>True</description>
  /// </item>
  /// <item>
  /// <description>Cache Size</description>
  /// <description>
  /// If the argument N is positive then the suggested cache size is set to N.
  /// If the argument N is negative, then the number of cache pages is adjusted
  /// to use approximately abs(N*4096) bytes of memory. Backwards compatibility
  /// note: The behavior of cache_size with a negative N was different in SQLite
  /// versions prior to 3.7.10. In version 3.7.9 and earlier, the number of
  /// pages in the cache was set to the absolute value of N.
  /// </description>
  /// <description>N</description>
  /// <description>-2000</description>
  /// </item>
  /// <item>
  /// <description>Synchronous</description>
  /// <description>
  /// <b>Normal</b> - Normal file flushing behavior
  /// <br/>
  /// <b>Full</b> - Full flushing after all writes
  /// <br/>
  /// <b>Off</b> - Underlying OS flushes I/O's
  /// </description>
  /// <description>N</description>
  /// <description>Full</description>
  /// </item>
  /// <item>
  /// <description>Page Size</description>
  /// <description>{size in bytes}</description>
  /// <description>N</description>
  /// <description>4096</description>
  /// </item>
  /// <item>
  /// <description>Password</description>
  /// <description>
  /// {password} - Using this parameter requires that the legacy CryptoAPI-based
  /// (RC4) codec (or the SQLite Encryption Extension) be enabled at compile-time for
  /// both the native interop assembly and the core managed assemblies; otherwise,
  /// using this parameter may result in an exception being thrown when attempting
  /// to open the connection.
  /// </description>
  /// <description>N</description>
  /// <description></description>
  /// </item>
  /// <item>
  /// <description>HexPassword</description>
  /// <description>
  /// {hexPassword} - Must contain a sequence of zero or more hexadecimal encoded
  /// byte values without a leading "0x" prefix.  Using this parameter requires
  /// that the legacy CryptoAPI-based (RC4) codec (or the SQLite Encryption Extension)
  /// be enabled at compile-time for both the native interop assembly and the
  /// core managed assemblies; otherwise, using this parameter may result in an
  /// exception being thrown when attempting to open the connection.
  /// </description>
  /// <description>N</description>
  /// <description></description>
  /// </item>
  /// <item>
  /// <description>TextPassword</description>
  /// <description>
  /// {password} - Using this parameter requires that the legacy CryptoAPI-based
  /// (RC4) codec (or the SQLite Encryption Extension) be enabled at compile-time for
  /// both the native interop assembly and the core managed assemblies; otherwise,
  /// using this parameter may result in an exception being thrown when attempting
  /// to open the connection.
  /// </description>
  /// <description>N</description>
  /// <description></description>
  /// </item>
  /// <item>
  /// <description>TextHexPassword</description>
  /// <description>
  /// {hexPassword} - Must contain a sequence of zero or more hexadecimal encoded
  /// byte values without a leading "0x" prefix.  Using this parameter requires
  /// that the legacy CryptoAPI-based (RC4) codec (or the SQLite Encryption Extension)
  /// be enabled at compile-time for both the native interop assembly and the
  /// core managed assemblies; otherwise, using this parameter may result in an
  /// exception being thrown when attempting to open the connection.
  /// </description>
  /// <description>N</description>
  /// <description></description>
  /// </item>
  /// <item>
  /// <description>Enlist</description>
  /// <description>
  /// <b>Y</b> - Automatically enlist in distributed transactions
  /// <br/>
  /// <b>N</b> - No automatic enlistment
  /// </description>
  /// <description>N</description>
  /// <description>Y</description>
  /// </item>
  /// <item>
  /// <description>Pooling</description>
  /// <description>
  /// <b>True</b> - Use connection pooling.<br/>
  /// <b>False</b> - Do not use connection pooling.<br/><br/>
  /// <b>WARNING:</b> When using the default connection pool implementation,
  /// setting this property to True should be avoided by applications that make
  /// use of COM (either directly or indirectly) due to possible deadlocks that
  /// can occur during the finalization of some COM objects.
  /// </description>
  /// <description>N</description>
  /// <description>False</description>
  /// </item>
  /// <item>
  /// <description>FailIfMissing</description>
  /// <description>
  /// <b>True</b> - Don't create the database if it does not exist, throw an error instead
  /// <br/>
  /// <b>False</b> - Automatically create the database if it does not exist
  /// </description>
  /// <description>N</description>
  /// <description>False</description>
  /// </item>
  /// <item>
  /// <description>Max Page Count</description>
  /// <description>{size in pages} - Limits the maximum number of pages (limits the size) of the database</description>
  /// <description>N</description>
  /// <description>0</description>
  /// </item>
  /// <item>
  /// <description>Legacy Format</description>
  /// <description>
  /// <b>True</b> - Use the more compatible legacy 3.x database format
  /// <br/>
  /// <b>False</b> - Use the newer 3.3x database format which compresses numbers more effectively
  /// </description>
  /// <description>N</description>
  /// <description>False</description>
  /// </item>
  /// <item>
  /// <description>Default Timeout</description>
  /// <description>{time in seconds}<br/>The default command timeout</description>
  /// <description>N</description>
  /// <description>30</description>
  /// </item>
  /// <item>
  /// <description>DefaultMaximumSleepTime</description>
  /// <description>{time in milliseconds}<br/>The default maximum sleep time for new commands</description>
  /// <description>N</description>
  /// <description>150</description>
  /// </item>
  /// <item>
  /// <description>BusyTimeout</description>
  /// <description>{time in milliseconds}<br/>Sets the busy timeout for the core library.</description>
  /// <description>N</description>
  /// <description>0</description>
  /// </item>
  /// <item>
  /// <description>WaitTimeout</description>
  /// <description>{time in milliseconds}<br/>
  /// <b>EXPERIMENTAL</b> -- The wait timeout to use with
  /// <see cref="WaitForEnlistmentReset" /> method.  This is only used when
  /// waiting for the enlistment to be reset prior to enlisting in a transaction,
  /// and then only when the appropriate connection flag is set.</description>
  /// <description>N</description>
  /// <description>30000</description>
  /// </item>
  /// <item>
  /// <description>Journal Mode</description>
  /// <description>
  /// <b>Delete</b> - Delete the journal file after a commit.
  /// <br/>
  /// <b>Persist</b> - Zero out and leave the journal file on disk after a
  /// commit.
  /// <br/>
  /// <b>Off</b> - Disable the rollback journal entirely.  This saves disk I/O
  /// but at the expense of database safety and integrity.  If the application
  /// using SQLite crashes in the middle of a transaction when this journaling
  /// mode is set, then the database file will very likely go corrupt.
  /// <br/>
  /// <b>Truncate</b> - Truncate the journal file to zero-length instead of
  /// deleting it.
  /// <br/>
  /// <b>Memory</b> - Store the journal in volatile RAM.  This saves disk I/O
  /// but at the expense of database safety and integrity.  If the application
  /// using SQLite crashes in the middle of a transaction when this journaling
  /// mode is set, then the database file will very likely go corrupt.
  /// <br/>
  /// <b>Wal</b> - Use a write-ahead log instead of a rollback journal.
  /// </description>
  /// <description>N</description>
  /// <description>Delete</description>
  /// </item>
  /// <item>
  /// <description>Read Only</description>
  /// <description>
  /// <b>True</b> - Open the database for read only access
  /// <br/>
  /// <b>False</b> - Open the database for normal read/write access
  /// </description>
  /// <description>N</description>
  /// <description>False</description>
  /// </item>
  /// <item>
  /// <description>Max Pool Size</description>
  /// <description>The maximum number of connections for the given connection string that can be in the connection pool</description>
  /// <description>N</description>
  /// <description>100</description>
  /// </item>
  /// <item>
  /// <description>Default IsolationLevel</description>
  /// <description>The default transaciton isolation level</description>
  /// <description>N</description>
  /// <description>Serializable</description>
  /// </item>
  /// <item>
  /// <description>Foreign Keys</description>
  /// <description>Enable foreign key constraints</description>
  /// <description>N</description>
  /// <description>False</description>
  /// </item>
  /// <item>
  /// <description>Flags</description>
  /// <description>Extra behavioral flags for the connection.  See the <see cref="SQLiteConnectionFlags" /> enumeration for possible values.</description>
  /// <description>N</description>
  /// <description>Default</description>
  /// </item>
  /// <item>
  /// <description>SetDefaults</description>
  /// <description>
  /// <b>True</b> - Apply the default connection settings to the opened database.<br/>
  /// <b>False</b> - Skip applying the default connection settings to the opened database.
  /// </description>
  /// <description>N</description>
  /// <description>True</description>
  /// </item>
  /// <item>
  /// <description>ToFullPath</description>
  /// <description>
  /// <b>True</b> - Attempt to expand the data source file name to a fully qualified path before opening.
  /// <br/>
  /// <b>False</b> - Skip attempting to expand the data source file name to a fully qualified path before opening.
  /// </description>
  /// <description>N</description>
  /// <description>True</description>
  /// </item>
  /// <item>
  /// <description>PrepareRetries</description>
  /// <description>
  /// The maximum number of retries when preparing SQL to be executed.  This
  /// normally only applies to preparation errors resulting from the database
  /// schema being changed.
  /// </description>
  /// <description>N</description>
  /// <description>3</description>
  /// </item>
  /// <item>
  /// <description>StepRetries</description>
  /// <description>
  /// The maximum number of retries when stepping a SQL statement.  This
  /// normally only applies to stepping errors resulting from the database
  /// being locked or its schema being changed.
  /// </description>
  /// <description>N</description>
  /// <description>40</description>
  /// </item>
  /// <item>
  /// <description>ProgressOps</description>
  /// <description>
  /// The approximate number of virtual machine instructions between progress
  /// events.  In order for progress events to actually fire, the event handler
  /// must be added to the <see cref="Progress" /> event as well.
  /// </description>
  /// <description>N</description>
  /// <description>0</description>
  /// </item>
  /// <item>
  /// <description>Recursive Triggers</description>
  /// <description>
  /// <b>True</b> - Enable the recursive trigger capability.
  /// <b>False</b> - Disable the recursive trigger capability.
  /// </description>
  /// <description>N</description>
  /// <description>False</description>
  /// </item>
  /// </list>
  /// </remarks>
  public sealed partial class SQLiteConnection : DbConnection, ICloneable, IDisposable
  {
    #region Private Constants
    /// <summary>
    /// The "invalid value" for the <see cref="DbType" /> enumeration used
    /// by the <see cref="DefaultDbType" /> property.  This constant is shared
    /// by this class and the SQLiteConnectionStringBuilder class.
    /// </summary>
    internal const DbType BadDbType = (DbType)(-1);

    /// <summary>
    /// The default "stub" (i.e. placeholder) base schema name to use when
    /// returning column schema information.  Used as the initial value of
    /// the BaseSchemaName property.  This should start with "sqlite_*"
    /// because those names are reserved for use by SQLite (i.e. they cannot
    /// be confused with the names of user objects).
    /// </summary>
    internal const string DefaultBaseSchemaName = "sqlite_default_schema";

    private const string MemoryFileName = ":memory:";

    internal const IsolationLevel DeferredIsolationLevel = IsolationLevel.ReadCommitted;
    internal const IsolationLevel ImmediateIsolationLevel = IsolationLevel.Serializable;

    private const SQLiteConnectionFlags FallbackDefaultFlags = SQLiteConnectionFlags.Default;
    private const SQLiteSynchronousEnum DefaultSynchronous = SQLiteSynchronousEnum.Default;
    private const SQLiteJournalModeEnum DefaultJournalMode = SQLiteJournalModeEnum.Default;
    private const IsolationLevel DefaultIsolationLevel = IsolationLevel.Serializable;
    internal const SQLiteDateFormats DefaultDateTimeFormat = SQLiteDateFormats.Default;
    internal const DateTimeKind DefaultDateTimeKind = DateTimeKind.Unspecified;
    internal const string DefaultDateTimeFormatString = null;
    private const string DefaultDataSource = null;
    private const string DefaultUri = null;
    private const string DefaultFullUri = null;
    private const string DefaultTextPassword = null;
    private const string DefaultTextHexPassword = null;
    private const string DefaultHexPassword = null;
    private const string DefaultPassword = null;
    private const int DefaultVersion = 3;
    private const int DefaultPageSize = 4096;
    private const int DefaultMaxPageCount = 0;
    private const int DefaultCacheSize = -2000;
    private const int DefaultMaxPoolSize = 100;
    private const int DefaultConnectionTimeout = 30;
    internal const int DefaultConnectionMaximumSleepTime = 150;
    private const int DefaultBusyTimeout = 0;
    private const int DefaultWaitTimeout = 30000;
    private const bool DefaultNoDefaultFlags = false;
    private const bool DefaultNoSharedFlags = false;
    private const bool DefaultFailIfMissing = false;
    private const bool DefaultReadOnly = false;
    internal const bool DefaultBinaryGUID = true;
    private const bool DefaultUseUTF16Encoding = false;
    private const bool DefaultToFullPath = true;
    private const bool DefaultPooling = false; // TODO: Maybe promote this to static property?
    private const bool DefaultLegacyFormat = false;
    private const bool DefaultForeignKeys = false;
    private const bool DefaultRecursiveTriggers = false;
    private const bool DefaultEnlist = true;
    private const bool DefaultSetDefaults = true;
    internal const int DefaultPrepareRetries = 3;
    internal const int DefaultStepRetries = 40;
    private static readonly DbType? _DefaultDbType = null;
    private const string _DefaultTypeName = null;
    private const string DefaultVfsName = null;
    private const int DefaultProgressOps = 0;

#if INTEROP_INCLUDE_ZIPVFS
    private const string ZipVfs_Automatic = "automatic";
    private const string ZipVfs_V2 = "v2";
    private const string ZipVfs_V3 = "v3";

    private const string DefaultZipVfsVersion = null;
#endif

    private const int SQLITE_FCNTL_CHUNK_SIZE = 6;
    private const int SQLITE_FCNTL_WIN32_AV_RETRY = 9;

    private const string _dataDirectory = "|DataDirectory|";

    private static string _defaultCatalogName = "main";
    private static string _defaultMasterTableName = "sqlite_master";

    private static string _temporaryCatalogName = "temp";
    private static string _temporaryMasterTableName = "sqlite_temp_master";
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region Private Static Data
    /// <summary>
    /// The managed assembly containing this type.
    /// </summary>
    private static readonly Assembly _assembly = typeof(SQLiteConnection).Assembly;

    /// <summary>
    /// Object used to synchronize access to the static instance data
    /// for this class.
    /// </summary>
    private static readonly object _syncRoot = new object();

    /// <summary>
    /// Static variable to store the connection event handlers to call.
    /// </summary>
    private static event SQLiteConnectionEventHandler _handlers;

    /// <summary>
    /// The extra connection flags to be used for all opened connections.
    /// </summary>
    private static SQLiteConnectionFlags _sharedFlags;

    /// <summary>
    /// The <see cref="SQLiteConnection" /> instance (for this thread) that
    /// had the most recent call to <see cref="SQLiteConnection.Open" />.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [ThreadStatic()]
#endif
    private static SQLiteConnection _lastConnectionInOpen;

#if SQLITE_STANDARD && !PLATFORM_COMPACTFRAMEWORK
    /// <summary>
    /// Used to hold the active library version number of SQLite.
    /// </summary>
    private static int _versionNumber;
#endif
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region Private Data
    /// <summary>
    /// State of the current connection
    /// </summary>
    private ConnectionState _connectionState;

    /// <summary>
    /// The connection string
    /// </summary>
    private string _connectionString;

#if DEBUG
    /// <summary>
    /// This string will contain enough information to identify this connection,
    /// e.g. the database file name, original thread, etc.  It is not currently
    /// exposed via the public interface as it is intended for use only when
    /// debugging this library.
    /// </summary>
    private string _debugString;
#endif

    /// <summary>
    /// Nesting level of the transactions open on the connection
    /// </summary>
    internal int _transactionLevel;

    /// <summary>
    /// Transaction counter for the connection.  Currently, this is only used
    /// to build SAVEPOINT names.
    /// </summary>
    internal int _transactionSequence;

    /// <summary>
    /// If this flag is non-zero, the <see cref="Dispose()" /> method will have
    /// no effect; however, the <see cref="Close" /> method will continue to
    /// behave as normal.
    /// </summary>
    internal bool _noDispose;

    /// <summary>
    /// If set, then the connection is currently being disposed.
    /// </summary>
    private bool _disposing;

    /// <summary>
    /// The default isolation level for new transactions
    /// </summary>
    private IsolationLevel _defaultIsolation;

#if !PLATFORM_COMPACTFRAMEWORK
    /// <summary>
    /// This object is used with lock statements to synchronize access to the
    /// <see cref="_enlistment" /> field, below.
    /// </summary>
    internal readonly object _enlistmentSyncRoot = new object();

    /// <summary>
    /// Whether or not the connection is enlisted in a distrubuted transaction
    /// </summary>
    internal SQLiteEnlistment _enlistment;
#endif

    /// <summary>
    /// The per-connection mappings between type names and <see cref="DbType" />
    /// values.  These mappings override the corresponding global mappings.
    /// </summary>
    internal SQLiteDbTypeMap _typeNames;

    /// <summary>
    /// The per-connection mappings between type names and optional callbacks
    /// for parameter binding and value reading.
    /// </summary>
    private SQLiteTypeCallbacksMap _typeCallbacks;

    /// <summary>
    /// The base SQLite object to interop with
    /// </summary>
    internal SQLiteBase _sql;
    /// <summary>
    /// The database filename minus path and extension
    /// </summary>
    private string _dataSource;

#if INTEROP_CODEC || INTEROP_INCLUDE_SEE
    /// <summary>
    /// Temporary password storage, emptied after the database has been opened
    /// </summary>
    private byte[] _password;

    /// <summary>
    /// This will be non-zero if the "TextPassword" or "TextHexPassword"
    /// connection string properties were used.  When this value is non-zero,
    /// <see cref="ChangePassword(Byte[])" /> will retain treatment of the
    /// password as a NUL-terminated text string.
    /// </summary>
    private bool _passwordWasText;

    /// <summary>
    /// This will be non-zero if the "HexPassword" or "TextHexPassword"
    /// connection string properties were used.  When this value is non-zero,
    /// <see cref="ChangePassword(String)" /> will retain treatment of the
    /// password as a hexadecimal encoded string of byte values.
    /// </summary>
    private bool _passwordWasHex;
#endif

    /// <summary>
    /// The "stub" (i.e. placeholder) base schema name to use when returning
    /// column schema information.
    /// </summary>
    internal string _baseSchemaName;

    /// <summary>
    /// The extra behavioral flags for this connection, if any.  See the
    /// <see cref="SQLiteConnectionFlags" /> enumeration for a list of
    /// possible values.
    /// </summary>
    private SQLiteConnectionFlags _flags;

    /// <summary>
    /// The mask of zero or more <see cref="SQLiteTraceFlags" /> values that
    /// determine which events may be raised from the <see cref="Trace2" />
    /// event.
    /// </summary>
    private SQLiteTraceFlags _traceFlags;

    /// <summary>
    /// The cached values for all settings that have been fetched on behalf
    /// of this connection.  This cache may be cleared by calling the
    /// <see cref="ClearCachedSettings" /> method.
    /// </summary>
    private Dictionary<string, object> _cachedSettings;

    /// <summary>
    /// The default database type for this connection.  This value will only
    /// be used if the <see cref="SQLiteConnectionFlags.UseConnectionTypes" />
    /// flag is set.
    /// </summary>
    private DbType? _defaultDbType;

    /// <summary>
    /// The default database type name for this connection.  This value will only
    /// be used if the <see cref="SQLiteConnectionFlags.UseConnectionTypes" />
    /// flag is set.
    /// </summary>
    private string _defaultTypeName;

    /// <summary>
    /// The name of the VFS to be used when opening the database connection.
    /// </summary>
    private string _vfsName;

    /// <summary>
    /// Default command timeout
    /// </summary>
    private int _defaultTimeout;

    /// <summary>
    /// Default command maximum sleep time.
    /// </summary>
    internal int _defaultMaximumSleepTime;

    /// <summary>
    /// The default busy timeout to use with the SQLite core library.  This is
    /// only used when opening a connection.
    /// </summary>
    private int _busyTimeout;

#if !PLATFORM_COMPACTFRAMEWORK
    /// <summary>
    /// The default wait timeout to use with <see cref="WaitForEnlistmentReset" />
    /// method.  This is only used when waiting for the enlistment to be reset
    /// prior to enlisting in a transaction, and then only when the appropriate
    /// connection flag is set.
    /// </summary>
    private int _waitTimeout;
#endif

    /// <summary>
    /// The maximum number of retries when preparing SQL to be executed.  This
    /// normally only applies to preparation errors resulting from the database
    /// schema being changed.
    /// </summary>
    internal int _prepareRetries;

    /// <summary>
    /// The maximum number of retries when stepping SQL to be executed.  This
    /// normally only applies to stepping errors resulting from the database
    /// being locked.
    /// </summary>
    internal int _stepRetries;

    /// <summary>
    /// The approximate number of virtual machine instructions between progress
    /// events.  In order for progress events to actually fire, the event handler
    /// must be added to the <see cref="SQLiteConnection.Progress" /> event as
    /// well.  This value will only be used when opening the database.
    /// </summary>
    private int _progressOps;

    /// <summary>
    /// Non-zero if the built-in (i.e. framework provided) connection string
    /// parser should be used when opening the connection.
    /// </summary>
    private bool _parseViaFramework;

    internal bool _binaryGuid;

    internal int _version;

    private event SQLiteBusyEventHandler _busyHandler;
    private event SQLiteProgressEventHandler _progressHandler;
    private event SQLiteAuthorizerEventHandler _authorizerHandler;
    private event SQLiteUpdateEventHandler _updateHandler;
    private event SQLiteCommitHandler _commitHandler;
    private event SQLiteTraceEventHandler _traceHandler;
    private event SQLiteTraceEventHandler _traceHandler2;
    private event EventHandler _rollbackHandler;

    private SQLiteBusyCallback _busyCallback;
    private SQLiteProgressCallback _progressCallback;
    private SQLiteAuthorizerCallback _authorizerCallback;
    private SQLiteUpdateCallback _updateCallback;
    private SQLiteCommitCallback _commitCallback;
    private SQLiteTraceCallback _traceCallback;
    private SQLiteTraceCallback2 _traceCallback2;
    private SQLiteRollbackCallback _rollbackCallback;
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// This method attempts to query the flags associated with the database
    /// connection.  If the database connection is disposed, the default flags
    /// will be returned.
    /// </summary>
    /// <param name="connection">
    /// The database connection to query the flags from.
    /// </param>
    /// <returns>
    /// The connection flags value.
    /// </returns>
    internal static SQLiteConnectionFlags GetFlags(
        SQLiteConnection connection
        )
    {
        try
        {
            if (connection != null)
                return connection.Flags;
        }
        catch (ObjectDisposedException)
        {
            // do nothing.
        }

        return SQLiteConnectionFlags.Default;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private static string GetDefaultCatalogName()
    {
        return _defaultCatalogName;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private static bool IsDefaultCatalogName(
        string catalogName
        )
    {
        return String.Compare(catalogName, GetDefaultCatalogName(),
            StringComparison.OrdinalIgnoreCase) == 0;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private static string GetTemporaryCatalogName()
    {
        return _temporaryCatalogName;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private static bool IsTemporaryCatalogName(
        string catalogName
        )
    {
        return String.Compare(catalogName, GetTemporaryCatalogName(),
            StringComparison.OrdinalIgnoreCase) == 0;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private static string GetMasterTableName(
        bool temporary
        )
    {
        return temporary ? _temporaryMasterTableName : _defaultMasterTableName;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// This event is raised whenever the database is opened or closed.
    /// </summary>
    public override event StateChangeEventHandler StateChange;

    ///////////////////////////////////////////////////////////////////////////////////////////////

    ///<overloads>
    /// Constructs a new SQLiteConnection object
    /// </overloads>
    /// <summary>
    /// Default constructor
    /// </summary>
    public SQLiteConnection()
      : this((string)null)
    {
    }

    /// <summary>
    /// Initializes the connection with the specified connection string.
    /// </summary>
    /// <param name="connectionString">The connection string to use.</param>
    public SQLiteConnection(string connectionString)
        : this(connectionString, false)
    {
        // do nothing.
    }

#if INTEROP_VIRTUAL_TABLE
    /// <summary>
    /// Initializes the connection with a pre-existing native connection handle.
    /// This constructor overload is intended to be used only by the private
    /// <see cref="SQLiteModule.CreateOrConnect" /> method.
    /// </summary>
    /// <param name="db">
    /// The native connection handle to use.
    /// </param>
    /// <param name="fileName">
    /// The file name corresponding to the native connection handle.
    /// </param>
    /// <param name="ownHandle">
    /// Non-zero if this instance owns the native connection handle and
    /// should dispose of it when it is no longer needed.
    /// </param>
    internal SQLiteConnection(IntPtr db, string fileName, bool ownHandle)
        : this()
    {
        _sql = new SQLite3(
            SQLiteDateFormats.Default, DateTimeKind.Unspecified, null,
            db, fileName, ownHandle);

        _flags = SQLiteConnectionFlags.None;
        _traceFlags = SQLiteTraceFlags.SQLITE_TRACE_NONE;

        _connectionState = (db != IntPtr.Zero) ?
            ConnectionState.Open : ConnectionState.Closed;

        _connectionString = null; /* unknown */

#if DEBUG
        _debugString = HelperMethods.StringFormat(
            CultureInfo.InvariantCulture,
            "db = {0}, fileName = {1}, ownHandle = {2}",
            db, fileName, ownHandle);
#endif
    }
#endif

    /// <summary>
    /// Initializes user-settable properties with their default values.
    /// This method is only intended to be used from the constructor.
    /// </summary>
    private void InitializeDefaults()
    {
        _defaultDbType = _DefaultDbType;
        _defaultTypeName = _DefaultTypeName;
        _vfsName = DefaultVfsName;
        _defaultTimeout = DefaultConnectionTimeout;
        _defaultMaximumSleepTime = DefaultConnectionMaximumSleepTime;
        _busyTimeout = DefaultBusyTimeout;

#if !PLATFORM_COMPACTFRAMEWORK
        _waitTimeout = DefaultWaitTimeout;
#endif

        _prepareRetries = DefaultPrepareRetries;
        _stepRetries = DefaultStepRetries;
        _progressOps = DefaultProgressOps;
        _defaultIsolation = DefaultIsolationLevel;
        _baseSchemaName = DefaultBaseSchemaName;
        _binaryGuid = DefaultBinaryGUID;
    }

    /// <summary>
    /// Initializes the connection with the specified connection string.
    /// </summary>
    /// <param name="connectionString">
    /// The connection string to use.
    /// </param>
    /// <param name="parseViaFramework">
    /// Non-zero to parse the connection string using the built-in (i.e.
    /// framework provided) parser when opening the connection.
    /// </param>
    public SQLiteConnection(string connectionString, bool parseViaFramework)
    {
      _noDispose = false;

#if (SQLITE_STANDARD || USE_INTEROP_DLL || PLATFORM_COMPACTFRAMEWORK) && PRELOAD_NATIVE_LIBRARY
      UnsafeNativeMethods.Initialize();
#endif

      SQLiteLog.Initialize(typeof(SQLiteConnection).Name);

#if !PLATFORM_COMPACTFRAMEWORK && !INTEROP_LEGACY_CLOSE && SQLITE_STANDARD
      //
      // NOTE: Check if the sqlite3_close_v2() native API should be available
      //       to use.  This must be done dynamically because the delegate set
      //       here is used by the SQLiteConnectionHandle class, which is a
      //       CriticalHandle derived class (i.e. protected by a constrained
      //       execution region).  Therefore, if the underlying native entry
      //       point is unavailable, an exception will be raised even if it is
      //       never actually called (i.e. because the runtime eagerly prepares
      //       all the methods in the call graph of the constrained execution
      //       region).
      //
      lock (_syncRoot)
      {
          if (_versionNumber == 0)
          {
              _versionNumber = SQLite3.SQLiteVersionNumber;

              if (_versionNumber >= 3007014)
                  SQLiteConnectionHandle.closeConnection = SQLiteBase.CloseConnectionV2;
          }
      }
#endif

      _cachedSettings = new Dictionary<string, object>(
          new TypeNameStringComparer());

      _typeNames = new SQLiteDbTypeMap();
      _typeCallbacks = new SQLiteTypeCallbacksMap();
      _parseViaFramework = parseViaFramework;
      _flags = SQLiteConnectionFlags.None;

      InitializeDefaults();

      _connectionState = ConnectionState.Closed;
      _connectionString = null;


      if (connectionString != null)
        ConnectionString = connectionString;
    }

    /// <summary>
    /// Clones the settings and connection string from an existing connection.  If the existing connection is already open, this
    /// function will open its own connection, enumerate any attached databases of the original connection, and automatically
    /// attach to them.
    /// </summary>
    /// <param name="connection">The connection to copy the settings from.</param>
    public SQLiteConnection(SQLiteConnection connection)
      : this(connection.ConnectionString, connection.ParseViaFramework)
    {
#if DEBUG
      _debugString = connection._debugString;
#endif

      if (connection.State == ConnectionState.Open)
      {
        Open();

        // Reattach all attached databases from the existing connection
        using (DataTable tbl = connection.GetSchema("Catalogs"))
        {
          foreach (DataRow row in tbl.Rows)
          {
            string str = row[0].ToString();

            if (!IsDefaultCatalogName(str) && !IsTemporaryCatalogName(str))
            {
              using (SQLiteCommand cmd = CreateCommand())
              {
                cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "ATTACH DATABASE '{0}' AS [{1}]", row[1], row[0]);
                cmd.ExecuteNonQuery();
              }
            }
          }
        }
      }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Attempts to lookup the native handle associated with the connection.  An exception will
    /// be thrown if this cannot be accomplished.
    /// </summary>
    /// <param name="connection">
    /// The connection associated with the desired native handle.
    /// </param>
    /// <returns>
    /// The native handle associated with the connection or <see cref="IntPtr.Zero" /> if it
    /// cannot be determined.
    /// </returns>
    private static SQLiteConnectionHandle GetCriticalHandle(
        SQLiteConnection connection
        )
    {
        if (connection == null)
            throw new ArgumentNullException("connection");

        SQLite3 sqlite3 = connection._sql as SQLite3;

        if (sqlite3 == null)
            throw new InvalidOperationException("Connection has no wrapper");

        SQLiteConnectionHandle handle = sqlite3._sql;

        if (handle == null)
            throw new InvalidOperationException("Connection has an invalid handle.");

        IntPtr handlePtr = handle;

        if (handlePtr == IntPtr.Zero)
        {
            throw new InvalidOperationException(
                "Connection has an invalid handle pointer.");
        }

        return handle;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Attempts to obtain and return the underlying <see cref="CriticalHandle" />
    /// derived object associated with this connection.  This method should only be
    /// used by the thread that created this connection; otherwise, the results are
    /// undefined.
    /// <code>
    /// WARNING: This method is not officially supported for external callers and
    ///          should be considered "experimental", even though it is "public".
    /// </code>
    /// </summary>
    /// <returns>
    /// The underlying <see cref="CriticalHandle" /> derived object associated with
    /// this connection -OR- null if it is unavailable.
    /// </returns>
    public object GetCriticalHandle()
    {
        CheckDisposed();

        return GetCriticalHandle(this);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Attempts to create and return the specified built-in implementation
    /// of the <see cref="ISQLiteConnectionPool" /> interface.  If there is
    /// no such built-in implementation, <see cref="NotImplementedException" />
    /// will be thrown.
    /// </summary>
    /// <param name="typeName">
    /// The short name of the <see cref="ISQLiteConnectionPool" /> interface
    /// implementation to create.
    /// </param>
    /// <param name="argument">
    /// The single argument to pass into the constructor of the
    /// <see cref="ISQLiteConnectionPool" /> interface implementation to
    /// create, if any.
    /// </param>
    /// <returns>
    /// The built-in implementation of the <see cref="ISQLiteConnectionPool" />
    /// interface -OR- null if it cannot be created.
    /// </returns>
    public static ISQLiteConnectionPool CreatePool(
        string typeName,
        object argument
        )
    {
        if (typeName == null)
            return null;

        switch (typeName)
        {
#if !PLATFORM_COMPACTFRAMEWORK && DEBUG
            case "null":
                {
                    return new NullConnectionPool(argument != null);
                }
#endif
            case "weak":
                {
                    return new WeakConnectionPool();
                }
            case "strong":
                {
                    return new StrongConnectionPool();
                }
            default:
                {
                    throw new NotImplementedException();
                }
        }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Raises the <see cref="Changed" /> event.
    /// </summary>
    /// <param name="connection">
    /// The connection associated with this event.  If this parameter is not
    /// null and the specified connection cannot raise events, then the
    /// registered event handlers will not be invoked.
    /// </param>
    /// <param name="e">
    /// A <see cref="ConnectionEventArgs" /> that contains the event data.
    /// </param>
    internal static void OnChanged(
        SQLiteConnection connection,
        ConnectionEventArgs e
        )
    {
#if !PLATFORM_COMPACTFRAMEWORK
        if ((connection != null) &&
            !connection.disposed && !connection.CanRaiseEvents)
        {
            return;
        }
#endif

        SQLiteConnectionEventHandler handlers;

        lock (_syncRoot)
        {
            if (_handlers != null)
                handlers = _handlers.Clone() as SQLiteConnectionEventHandler;
            else
                handlers = null;
        }

        if (handlers != null) handlers(connection, e);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// This event is raised when events related to the lifecycle of a
    /// SQLiteConnection object occur.
    /// </summary>
    public static event SQLiteConnectionEventHandler Changed
    {
        add
        {
            lock (_syncRoot)
            {
                // Remove any copies of this event handler from registered
                // list.  This essentially means that a handler will be
                // called only once no matter how many times it is added.
                _handlers -= value;

                // Add this to the list of event handlers.
                _handlers += value;
            }
        }
        remove
        {
            lock (_syncRoot)
            {
                _handlers -= value;
            }
        }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// This property is used to obtain or set the custom connection pool
    /// implementation to use, if any.  Setting this property to null will
    /// cause the default connection pool implementation to be used.
    /// </summary>
    public static ISQLiteConnectionPool ConnectionPool
    {
        get { return SQLiteConnectionPool.GetConnectionPool(); }
        set { SQLiteConnectionPool.SetConnectionPool(value); }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Creates and returns a new managed database connection handle.  This
    /// method is intended to be used by implementations of the
    /// <see cref="ISQLiteConnectionPool" /> interface only.  In theory, it
    /// could be used by other classes; however, that usage is not supported.
    /// </summary>
    /// <param name="nativeHandle">
    /// This must be a native database connection handle returned by the
    /// SQLite core library and it must remain valid and open during the
    /// entire duration of the calling method.
    /// </param>
    /// <returns>
    /// The new managed database connection handle or null if it cannot be
    /// created.
    /// </returns>
    public static object CreateHandle(
        IntPtr nativeHandle
        )
    {
        SQLiteConnectionHandle result;

        try
        {
            // do nothing.
        }
        finally /* NOTE: Thread.Abort() protection. */
        {
            result = (nativeHandle != IntPtr.Zero) ?
                new SQLiteConnectionHandle(nativeHandle, true) : null;
        }

        if (result != null)
        {
            SQLiteConnection.OnChanged(null, new ConnectionEventArgs(
                SQLiteConnectionEventType.NewCriticalHandle, null,
                null, null, null, result, null, new object[] {
                typeof(SQLiteConnection), nativeHandle }));
        }

        return result;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region Backup API Members
    /// <summary>
    /// Backs up the database, using the specified database connection as the
    /// destination.
    /// </summary>
    /// <param name="destination">The destination database connection.</param>
    /// <param name="destinationName">The destination database name.</param>
    /// <param name="sourceName">The source database name.</param>
    /// <param name="pages">
    /// The number of pages to copy at a time -OR- a negative value to copy all
    /// pages.  When a negative value is used, the <paramref name="callback" />
    /// may never be invoked.
    /// </param>
    /// <param name="callback">
    /// The method to invoke between each step of the backup process.  This
    /// parameter may be null (i.e. no callbacks will be performed).  If the
    /// callback returns false -OR- throws an exception, the backup is canceled.
    /// </param>
    /// <param name="retryMilliseconds">
    /// The number of milliseconds to sleep after encountering a locking error
    /// during the backup process.  A value less than zero means that no sleep
    /// should be performed.
    /// </param>
    public void BackupDatabase(
        SQLiteConnection destination,
        string destinationName,
        string sourceName,
        int pages,
        SQLiteBackupCallback callback,
        int retryMilliseconds
        )
    {
        CheckDisposed();

        if (_connectionState != ConnectionState.Open)
            throw new InvalidOperationException(
                "Source database is not open.");

        if (destination == null)
            throw new ArgumentNullException("destination");

        if (destination._connectionState != ConnectionState.Open)
            throw new ArgumentException(
                "Destination database is not open.", "destination");

        if (destinationName == null)
            throw new ArgumentNullException("destinationName");

        if (sourceName == null)
            throw new ArgumentNullException("sourceName");

        SQLiteBase sqliteBase = _sql;

        if (sqliteBase == null)
            throw new InvalidOperationException(
                "Connection object has an invalid handle.");

        SQLiteBackup backup = null;

        try
        {
            backup = sqliteBase.InitializeBackup(
                destination, destinationName, sourceName); /* throw */

            bool retry = false;

            while (sqliteBase.StepBackup(backup, pages, ref retry)) /* throw */
            {
                //
                // NOTE: If a callback was supplied by our caller, call it.
                //       If it returns false, halt the backup process.
                //
                if ((callback != null) && !callback(this, sourceName,
                        destination, destinationName, pages,
                        sqliteBase.RemainingBackup(backup),
                        sqliteBase.PageCountBackup(backup), retry))
                {
                    break;
                }

                //
                // NOTE: If we need to retry the previous operation, wait for
                //       the number of milliseconds specified by our caller
                //       unless the caller used a negative number, in that case
                //       skip sleeping at all because we do not want to block
                //       this thread forever.
                //
                if (retry && (retryMilliseconds >= 0))
                    Thread.Sleep(retryMilliseconds);

                //
                // NOTE: There is no point in calling the native API to copy
                //       zero pages as it does nothing; therefore, stop now.
                //
                if (pages == 0)
                    break;
            }
        }
        catch (Exception e)
        {
            if (HelperMethods.LogBackup(_flags))
            {
                SQLiteLog.LogMessage(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "Caught exception while backing up database: {0}", e));
            }

            throw;
        }
        finally
        {
            if (backup != null)
                sqliteBase.FinishBackup(backup); /* throw */
        }
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region Per-Connection Settings
    /// <summary>
    /// Clears the per-connection cached settings.
    /// </summary>
    /// <returns>
    /// The total number of per-connection settings cleared.
    /// </returns>
    public int ClearCachedSettings()
    {
        CheckDisposed();

        int result = -1; /* NO SETTINGS */

        if (_cachedSettings != null)
        {
            result = _cachedSettings.Count;
            _cachedSettings.Clear();
        }

        return result;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Queries and returns the value of the specified setting, using the
    /// cached setting names and values for this connection, when available.
    /// </summary>
    /// <param name="name">
    /// The name of the setting.
    /// </param>
    /// <param name="default">
    /// The value to be returned if the setting has not been set explicitly
    /// or cannot be determined.
    /// </param>
    /// <param name="value">
    /// The value of the cached setting is stored here if found; otherwise,
    /// the value of <paramref name="default" /> is stored here.
    /// </param>
    /// <returns>
    /// Non-zero if the cached setting was found; otherwise, zero.
    /// </returns>
    internal bool TryGetCachedSetting(
        string name,     /* in */
        object @default, /* in */
        out object value /* out */
        )
    {
        if ((name == null) || (_cachedSettings == null))
        {
            value = @default;
            return false;
        }

        return _cachedSettings.TryGetValue(name, out value);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Adds or sets the cached setting specified by <paramref name="name" />
    /// to the value specified by <paramref name="value" />.
    /// </summary>
    /// <param name="name">
    /// The name of the cached setting to add or replace.
    /// </param>
    /// <param name="value">
    /// The new value of the cached setting.
    /// </param>
    internal void SetCachedSetting(
        string name, /* in */
        object value /* in */
        )
    {
        if ((name == null) || (_cachedSettings == null))
            return;

        _cachedSettings[name] = value;
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region Per-Connection Type Mappings
    /// <summary>
    /// Clears the per-connection type mappings.
    /// </summary>
    /// <returns>
    /// The total number of per-connection type mappings cleared.
    /// </returns>
    public int ClearTypeMappings()
    {
        CheckDisposed();

        int result = -1; /* NO MAPPINGS */

        if (_typeNames != null)
            result = _typeNames.Clear();

        return result;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Returns the per-connection type mappings.
    /// </summary>
    /// <returns>
    /// The per-connection type mappings -OR- null if they are unavailable.
    /// </returns>
    public Dictionary<string, object> GetTypeMappings()
    {
        CheckDisposed();

        Dictionary<string, object> result = null;

        if (_typeNames != null)
        {
            result = new Dictionary<string, object>(_typeNames.Count, _typeNames.Comparer);

            foreach (KeyValuePair<string, SQLiteDbTypeMapping> pair in _typeNames)
            {
                SQLiteDbTypeMapping mapping = pair.Value;

                object typeName = null; /* System.String */
                object dataType = null; /* System.Data.DbType */
                object primary = null;  /* System.Boolean */

                if (mapping != null)
                {
                    typeName = mapping.typeName;
                    dataType = mapping.dataType;
                    primary = mapping.primary;
                }

                result.Add(pair.Key, new object[] { typeName, dataType, primary });
            }
        }

        return result;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Adds a per-connection type mapping, possibly replacing one or more
    /// that already exist.
    /// </summary>
    /// <param name="typeName">
    /// The case-insensitive database type name (e.g. "MYDATE").  The value
    /// of this parameter cannot be null.  Using an empty string value (or
    /// a string value consisting entirely of whitespace) for this parameter
    /// is not recommended.
    /// </param>
    /// <param name="dataType">
    /// The <see cref="DbType" /> value that should be associated with the
    /// specified type name.
    /// </param>
    /// <param name="primary">
    /// Non-zero if this mapping should be considered to be the primary one
    /// for the specified <see cref="DbType" />.
    /// </param>
    /// <returns>
    /// A negative value if nothing was done.  Zero if no per-connection type
    /// mappings were replaced (i.e. it was a pure add operation).  More than
    /// zero if some per-connection type mappings were replaced.
    /// </returns>
    public int AddTypeMapping(
        string typeName,
        DbType dataType,
        bool primary
        )
    {
        CheckDisposed();

        if (typeName == null)
            throw new ArgumentNullException("typeName");

        int result = -1; /* NO MAPPINGS */

        if (_typeNames != null)
        {
            result = 0;

            if (primary && _typeNames.ContainsKey(dataType))
                result += _typeNames.Remove(dataType) ? 1 : 0;

            if (_typeNames.ContainsKey(typeName))
                result += _typeNames.Remove(typeName) ? 1 : 0;

            _typeNames.Add(new SQLiteDbTypeMapping(typeName, dataType, primary));
        }

        return result;
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region Per-Connection Type Callbacks
    /// <summary>
    /// Clears the per-connection type callbacks.
    /// </summary>
    /// <returns>
    /// The total number of per-connection type callbacks cleared.
    /// </returns>
    public int ClearTypeCallbacks()
    {
        CheckDisposed();

        int result = -1; /* NO CALLBACKS */

        if (_typeCallbacks != null)
        {
            result = _typeCallbacks.Count;
            _typeCallbacks.Clear();
        }

        return result;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Attempts to get the per-connection type callbacks for the specified
    /// database type name.
    /// </summary>
    /// <param name="typeName">
    /// The database type name.
    /// </param>
    /// <param name="callbacks">
    /// Upon success, this parameter will contain the object holding the
    /// callbacks for the database type name.  Upon failure, this parameter
    /// will be null.
    /// </param>
    /// <returns>
    /// Non-zero upon success; otherwise, zero.
    /// </returns>
    public bool TryGetTypeCallbacks(
        string typeName,
        out SQLiteTypeCallbacks callbacks
        )
    {
        CheckDisposed();

        if (typeName == null)
            throw new ArgumentNullException("typeName");

        if (_typeCallbacks == null)
        {
            callbacks = null;
            return false;
        }

        return _typeCallbacks.TryGetValue(typeName, out callbacks);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Sets, resets, or clears the per-connection type callbacks for the
    /// specified database type name.
    /// </summary>
    /// <param name="typeName">
    /// The database type name.
    /// </param>
    /// <param name="callbacks">
    /// The object holding the callbacks for the database type name.  If
    /// this parameter is null, any callbacks for the database type name
    /// will be removed if they are present.
    /// </param>
    /// <returns>
    /// Non-zero if callbacks were set or removed; otherwise, zero.
    /// </returns>
    public bool SetTypeCallbacks(
        string typeName,
        SQLiteTypeCallbacks callbacks
        )
    {
        CheckDisposed();

        if (typeName == null)
            throw new ArgumentNullException("typeName");

        if (_typeCallbacks == null)
            return false;

        if (callbacks == null)
            return _typeCallbacks.Remove(typeName);

        callbacks.TypeName = typeName;
        _typeCallbacks[typeName] = callbacks;

        return true;
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Attempts to bind the specified <see cref="SQLiteFunction" /> object
    /// instance to this connection.
    /// </summary>
    /// <param name="functionAttribute">
    /// The <see cref="SQLiteFunctionAttribute" /> object instance containing
    /// the metadata for the function to be bound.
    /// </param>
    /// <param name="function">
    /// The <see cref="SQLiteFunction" /> object instance that implements the
    /// function to be bound.
    /// </param>
    public void BindFunction(
        SQLiteFunctionAttribute functionAttribute,
        SQLiteFunction function
        )
    {
        CheckDisposed();

        if (_sql == null)
            throw new InvalidOperationException(
                "Database connection not valid for binding functions.");

        _sql.BindFunction(functionAttribute, function, _flags);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Attempts to bind the specified <see cref="SQLiteFunction" /> object
    /// instance to this connection.
    /// </summary>
    /// <param name="functionAttribute">
    /// The <see cref="SQLiteFunctionAttribute" /> object instance containing
    /// the metadata for the function to be bound.
    /// </param>
    /// <param name="callback1">
    /// A <see cref="Delegate" /> object instance that helps implement the
    /// function to be bound.  For scalar functions, this corresponds to the
    /// <see cref="SQLiteInvokeDelegate" /> type.  For aggregate functions,
    /// this corresponds to the <see cref="SQLiteStepDelegate" /> type.  For
    /// collation functions, this corresponds to the
    /// <see cref="SQLiteCompareDelegate" /> type.
    /// </param>
    /// <param name="callback2">
    /// A <see cref="Delegate" /> object instance that helps implement the
    /// function to be bound.  For aggregate functions, this corresponds to the
    /// <see cref="SQLiteFinalDelegate" /> type.  For other callback types, it
    /// is not used and must be null.
    /// </param>
    public void BindFunction(
        SQLiteFunctionAttribute functionAttribute,
        Delegate callback1,
        Delegate callback2
        )
    {
        CheckDisposed();

        if (_sql == null)
            throw new InvalidOperationException(
                "Database connection not valid for binding functions.");

        _sql.BindFunction(functionAttribute,
            new SQLiteDelegateFunction(callback1, callback2), _flags);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Attempts to unbind the specified <see cref="SQLiteFunction" /> object
    /// instance to this connection.
    /// </summary>
    /// <param name="functionAttribute">
    /// The <see cref="SQLiteFunctionAttribute" /> object instance containing
    /// the metadata for the function to be unbound.
    /// </param>
    /// <returns>Non-zero if the function was unbound.</returns>
    public bool UnbindFunction(
        SQLiteFunctionAttribute functionAttribute
        )
    {
        CheckDisposed();

        if (_sql == null)
            throw new InvalidOperationException(
                "Database connection not valid for unbinding functions.");

        return _sql.UnbindFunction(functionAttribute, _flags);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// This method unbinds all registered (known) functions -OR- all previously
    /// bound user-defined functions from this connection.
    /// </summary>
    /// <param name="registered">
    /// Non-zero to unbind all registered (known) functions -OR- zero to unbind
    /// all functions currently bound to the connection.
    /// </param>
    /// <returns>
    /// Non-zero if all the specified user-defined functions were unbound.
    /// </returns>
    public bool UnbindAllFunctions(
        bool registered
        )
    {
        CheckDisposed();

        if (_sql == null)
            throw new InvalidOperationException(
                "Database connection not valid for unbinding functions.");

        return SQLiteFunction.UnbindAllFunctions(_sql, _flags, registered);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    [Conditional("CHECK_STATE")]
    internal static void Check(SQLiteConnection connection)
    {
        if (connection == null)
            throw new ArgumentNullException("connection");

        connection.CheckDisposed();

        if (connection._connectionState != ConnectionState.Open)
            throw new InvalidOperationException("The connection is not open.");

        SQLite3 sql = connection._sql as SQLite3;

        if (sql == null)
            throw new InvalidOperationException("The connection handle wrapper is null.");

        SQLiteConnectionHandle handle = sql._sql;

        if (handle == null)
            throw new InvalidOperationException("The connection handle is null.");

        if (handle.IsInvalid)
            throw new InvalidOperationException("The connection handle is invalid.");

        if (handle.IsClosed)
            throw new InvalidOperationException("The connection handle is closed.");
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Parses a connection string into component parts using the custom
    /// connection string parser.  An exception may be thrown if the syntax
    /// of the connection string is incorrect.
    /// </summary>
    /// <param name="connectionString">
    /// The connection string to parse.
    /// </param>
    /// <param name="parseViaFramework">
    /// Non-zero to parse the connection string using the algorithm provided
    /// by the framework itself.  This is not applicable when running on the
    /// .NET Compact Framework.
    /// </param>
    /// <param name="allowNameOnly">
    /// Non-zero if names are allowed without values.
    /// </param>
    /// <param name="strict">
    /// Non-zero to throw an exception if any connection string values are not of
    /// the <see cref="String" /> type.  This is not applicable when running on
    /// the .NET Compact Framework.
    /// </param>
    /// <returns>
    /// The list of key/value pairs corresponding to the parameters specified
    /// within the connection string.
    /// </returns>
    internal static SortedList<string, string> ParseConnectionString(
        string connectionString,
        bool parseViaFramework,
        bool allowNameOnly,
        bool strict
        )
    {
        return ParseConnectionString(
            null, connectionString, parseViaFramework, allowNameOnly, strict);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Parses a connection string into component parts using the custom
    /// connection string parser.  An exception may be thrown if the syntax
    /// of the connection string is incorrect.
    /// </summary>
    /// <param name="connection">
    /// The connection that will be using the parsed connection string.
    /// </param>
    /// <param name="connectionString">
    /// The connection string to parse.
    /// </param>
    /// <param name="parseViaFramework">
    /// Non-zero to parse the connection string using the algorithm provided
    /// by the framework itself.  This is not applicable when running on the
    /// .NET Compact Framework.
    /// </param>
    /// <param name="allowNameOnly">
    /// Non-zero if names are allowed without values.
    /// </param>
    /// <param name="strict">
    /// Non-zero to throw an exception if any connection string values are not of
    /// the <see cref="String" /> type.  This is not applicable when running on
    /// the .NET Compact Framework.
    /// </param>
    /// <returns>
    /// The list of key/value pairs corresponding to the parameters specified
    /// within the connection string.
    /// </returns>
    public static SortedList<string, string> ParseConnectionString(
        SQLiteConnection connection,
        string connectionString,
        bool parseViaFramework,
        bool allowNameOnly,
        bool strict
        )
    {
        return parseViaFramework ?
            ParseConnectionStringViaFramework(connection, connectionString, strict) :
            ParseConnectionString(connection, connectionString, allowNameOnly);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

#if INTEROP_CODEC || INTEROP_INCLUDE_SEE
    /// <summary>
    /// Attempts to escape the specified connection string property name or
    /// value in a way that is compatible with the connection string parser.
    /// </summary>
    /// <param name="value">
    /// The connection string property name or value to escape.
    /// </param>
    /// <param name="allowEquals">
    /// Non-zero if the equals sign is permitted in the string.  If this is
    /// zero and the string contains an equals sign, an exception will be
    /// thrown.
    /// </param>
    /// <returns>
    /// The original string, with all special characters escaped.  If the
    /// original string contains equals signs, they will not be escaped.
    /// Instead, they will be preserved verbatim.
    /// </returns>
    private static string EscapeForConnectionString(
        string value,
        bool allowEquals
        )
    {
        if (String.IsNullOrEmpty(value))
            return value;

        if (value.IndexOfAny(SQLiteConvert.SpecialChars) == -1)
            return value;

        int length = value.Length;
        StringBuilder builder = new StringBuilder(length);

        for (int index = 0; index < length; index++)
        {
            char character = value[index];

            switch (character)
            {
                case SQLiteConvert.QuoteChar:
                case SQLiteConvert.AltQuoteChar:
                case SQLiteConvert.PairChar:
                case SQLiteConvert.EscapeChar:
                    {
                        builder.Append(SQLiteConvert.EscapeChar);
                        builder.Append(character);
                        break;
                    }
                case SQLiteConvert.ValueChar:
                    {
                        if (allowEquals)
                        {
                            //
                            // HACK: The connection string parser allows
                            //       connection string property values
                            //       to contain equals signs; however,
                            //       they cannot be escaped.
                            //
                            // builder.Append(SQLiteConvert.EscapeChar);
                            builder.Append(character);
                        }
                        else
                        {
                            throw new ArgumentException(
                                "equals sign character is not allowed here");
                        }
                        break;
                    }
                default:
                    {
                        builder.Append(character);
                        break;
                    }
            }
        }

        return builder.ToString();
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Builds a connection string from a list of key/value pairs.
    /// </summary>
    /// <param name="opts">
    /// The list of key/value pairs corresponding to the parameters to be
    /// specified within the connection string.
    /// </param>
    /// <returns>
    /// The connection string.  Depending on how the connection string was
    /// originally parsed, the returned connection string value may not be
    /// usable in a subsequent call to the <see cref="Open" /> method.
    /// </returns>
    private static string BuildConnectionString(
        SortedList<string, string> opts
        )
    {
        if (opts == null) return null;
        StringBuilder builder = new StringBuilder();

        foreach (KeyValuePair<string, string> pair in opts)
        {
#if NET_COMPACT_20
            builder.Append(HelperMethods.StringFormat(
                CultureInfo.InvariantCulture, "{0}{1}{2}{3}",
                EscapeForConnectionString(pair.Key, false),
                SQLiteConvert.ValueChar,
                EscapeForConnectionString(pair.Value, true),
                SQLiteConvert.PairChar));
#else
            builder.AppendFormat("{0}{1}{2}{3}",
                EscapeForConnectionString(pair.Key, false),
                SQLiteConvert.ValueChar,
                EscapeForConnectionString(pair.Value, true),
                SQLiteConvert.PairChar);
#endif
        }

        return builder.ToString();
    }
#endif

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private void SetupSQLiteBase(SortedList<string, string> opts)
    {
        object enumValue;

        enumValue = TryParseEnum(
            typeof(SQLiteDateFormats), FindKey(opts, "DateTimeFormat",
            DefaultDateTimeFormat.ToString()), true);

        SQLiteDateFormats dateFormat = (enumValue is SQLiteDateFormats) ?
            (SQLiteDateFormats)enumValue : DefaultDateTimeFormat;

        enumValue = TryParseEnum(
            typeof(DateTimeKind), FindKey(opts, "DateTimeKind",
            DefaultDateTimeKind.ToString()), true);

        DateTimeKind kind = (enumValue is DateTimeKind) ?
            (DateTimeKind)enumValue : DefaultDateTimeKind;

        string dateTimeFormat = FindKey(opts, "DateTimeFormatString",
            DefaultDateTimeFormatString);

        //
        // NOTE: SQLite automatically sets the encoding of the database
        //       to UTF16 if called from sqlite3_open16().
        //
        if (SQLiteConvert.ToBoolean(FindKey(opts, "UseUTF16Encoding",
                  DefaultUseUTF16Encoding.ToString())))
        {
            _sql = new SQLite3_UTF16(
                dateFormat, kind, dateTimeFormat, IntPtr.Zero, null,
                false);
        }
        else
        {
            _sql = new SQLite3(
                dateFormat, kind, dateTimeFormat, IntPtr.Zero, null,
                false);
        }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable Members
    /// <summary>
    /// Disposes and finalizes the connection, if applicable.
    /// </summary>
    public new void Dispose()
    {
        if (_noDispose)
            return;

        base.Dispose();
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable "Pattern" Members
    private bool disposed;
    private void CheckDisposed() /* throw */
    {
#if THROW_ON_DISPOSED
        if (disposed)
            throw new ObjectDisposedException(typeof(SQLiteConnection).Name);
#endif
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Cleans up resources (native and managed) associated with the current instance.
    /// </summary>
    /// <param name="disposing">
    /// Zero when being disposed via garbage collection; otherwise, non-zero.
    /// </param>
    protected override void Dispose(bool disposing)
    {
        OnChanged(this, new ConnectionEventArgs(
            disposing ?
                SQLiteConnectionEventType.DisposingConnection :
                SQLiteConnectionEventType.FinalizingConnection,
            null, null, null, null, null, null, null));

#if !NET_COMPACT_20 && TRACE_WARNING
        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.TraceWarning))
        {
            if (_noDispose)
            {
                System.Diagnostics.Trace.WriteLine(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "WARNING: Disposing of connection \"{0}\" with the no-dispose flag set.",
                    _connectionString));
            }
        }
#endif

        _disposing = true;

        try
        {
            if (!disposed)
            {
                //if (disposing)
                //{
                //    ////////////////////////////////////
                //    // dispose managed resources here...
                //    ////////////////////////////////////
                //}

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////

                Close();
            }
        }
        finally
        {
            base.Dispose(disposing);

            //
            // NOTE: Everything should be fully disposed at this point.
            //
            disposed = true;

            OnChanged(this, new ConnectionEventArgs(
                disposing ?
                    SQLiteConnectionEventType.DisposedConnection :
                    SQLiteConnectionEventType.FinalizedConnection,
                null, null, null, null, null, null, null));
        }
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

#if PLATFORM_COMPACTFRAMEWORK
    /// <summary>
    /// Obsolete
    /// </summary>
    public override int ConnectionTimeout
    {
      get
      {
        CheckDisposed();
        return DefaultConnectionTimeout;
      }
    }
#endif

    /// <summary>
    /// Creates a clone of the connection.  All attached databases and user-defined functions are cloned.  If the existing connection is open, the cloned connection
    /// will also be opened.
    /// </summary>
    /// <returns></returns>
    public object Clone()
    {
      CheckDisposed();
      return new SQLiteConnection(this);
    }













    /// <summary>
    /// Creates a database file.  This just creates a zero-byte file which SQLite
    /// will turn into a database when the file is opened properly.
    /// </summary>
    /// <param name="databaseFileName">The file to create</param>
    static public void CreateFile(string databaseFileName)
    {
      FileStream fs = File.Create(databaseFileName);
      fs.Close();
    }

    /// <summary>
    /// Raises the state change event when the state of the connection changes
    /// </summary>
    /// <param name="newState">The new connection state.  If this is different
    /// from the previous state, the <see cref="StateChange" /> event is
    /// raised.</param>
    /// <param name="eventArgs">The event data created for the raised event, if
    /// it was actually raised.</param>
    internal void OnStateChange(
        ConnectionState newState,
        ref StateChangeEventArgs eventArgs
        )
    {
        ConnectionState oldState = _connectionState;

        _connectionState = newState;

        if ((StateChange != null) && (newState != oldState))
        {
            StateChangeEventArgs localEventArgs =
                new StateChangeEventArgs(oldState, newState);

            StateChange(this, localEventArgs);

            eventArgs = localEventArgs;
        }
    }

    /// <summary>
    /// Determines and returns the fallback default isolation level when one cannot be
    /// obtained from an existing connection instance.
    /// </summary>
    /// <returns>
    /// The fallback default isolation level for this connection instance -OR-
    /// <see cref="IsolationLevel.Unspecified" /> if it cannot be determined.
    /// </returns>
    private static IsolationLevel GetFallbackDefaultIsolationLevel()
    {
        return DefaultIsolationLevel;
    }

    /// <summary>
    /// Determines and returns the default isolation level for this connection instance.
    /// </summary>
    /// <returns>
    /// The default isolation level for this connection instance -OR-
    /// <see cref="IsolationLevel.Unspecified" /> if it cannot be determined.
    /// </returns>
    internal IsolationLevel GetDefaultIsolationLevel()
    {
        return _defaultIsolation;
    }

    /// <summary>
    /// OBSOLETE.  Creates a new SQLiteTransaction if one isn't already active on the connection.
    /// </summary>
    /// <param name="isolationLevel">This parameter is ignored.</param>
    /// <param name="deferredLock">When TRUE, SQLite defers obtaining a write lock until a write operation is requested.
    /// When FALSE, a writelock is obtained immediately.  The default is TRUE, but in a multi-threaded multi-writer
    /// environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock.</param>
    /// <returns>Returns a SQLiteTransaction object.</returns>
    [Obsolete("Use one of the standard BeginTransaction methods, this one will be removed soon")]
    public SQLiteTransaction BeginTransaction(IsolationLevel isolationLevel, bool deferredLock)
    {
      CheckDisposed();
      return (SQLiteTransaction)BeginDbTransaction(deferredLock == false ? ImmediateIsolationLevel : DeferredIsolationLevel);
    }

    /// <summary>
    /// OBSOLETE.  Creates a new SQLiteTransaction if one isn't already active on the connection.
    /// </summary>
    /// <param name="deferredLock">When TRUE, SQLite defers obtaining a write lock until a write operation is requested.
    /// When FALSE, a writelock is obtained immediately.  The default is false, but in a multi-threaded multi-writer
    /// environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock.</param>
    /// <returns>Returns a SQLiteTransaction object.</returns>
    [Obsolete("Use one of the standard BeginTransaction methods, this one will be removed soon")]
    public SQLiteTransaction BeginTransaction(bool deferredLock)
    {
      CheckDisposed();
      return (SQLiteTransaction)BeginDbTransaction(deferredLock == false ? ImmediateIsolationLevel : DeferredIsolationLevel);
    }

    /// <summary>
    /// Creates a new <see cref="SQLiteTransaction" /> if one isn't already active on the connection.
    /// </summary>
    /// <param name="isolationLevel">Supported isolation levels are Serializable, ReadCommitted and Unspecified.</param>
    /// <remarks>
    /// Unspecified will use the default isolation level specified in the connection string.  If no isolation level is specified in the
    /// connection string, Serializable is used.
    /// Serializable transactions are the default.  In this mode, the engine gets an immediate lock on the database, and no other threads
    /// may begin a transaction.  Other threads may read from the database, but not write.
    /// With a ReadCommitted isolation level, locks are deferred and elevated as needed.  It is possible for multiple threads to start
    /// a transaction in ReadCommitted mode, but if a thread attempts to commit a transaction while another thread
    /// has a ReadCommitted lock, it may timeout or cause a deadlock on both threads until both threads' CommandTimeout's are reached.
    /// </remarks>
    /// <returns>Returns a SQLiteTransaction object.</returns>
    public new SQLiteTransaction BeginTransaction(IsolationLevel isolationLevel)
    {
      CheckDisposed();
      return (SQLiteTransaction)BeginDbTransaction(isolationLevel);
    }

    /// <summary>
    /// Creates a new <see cref="SQLiteTransaction" /> if one isn't already
    /// active on the connection.
    /// </summary>
    /// <returns>Returns the new transaction object.</returns>
    public new SQLiteTransaction BeginTransaction()
    {
      CheckDisposed();
      return (SQLiteTransaction)BeginDbTransaction(_defaultIsolation);
    }

    /// <summary>
    /// Forwards to the local <see cref="BeginTransaction(IsolationLevel)" /> function
    /// </summary>
    /// <param name="isolationLevel">Supported isolation levels are Unspecified, Serializable, and ReadCommitted</param>
    /// <returns></returns>
    protected override DbTransaction BeginDbTransaction(IsolationLevel isolationLevel)
    {
      if (_connectionState != ConnectionState.Open)
        throw new InvalidOperationException();

      if (isolationLevel == IsolationLevel.Unspecified) isolationLevel = _defaultIsolation;
      isolationLevel = GetEffectiveIsolationLevel(isolationLevel);

      if (isolationLevel != ImmediateIsolationLevel && isolationLevel != DeferredIsolationLevel)
        throw new ArgumentException("isolationLevel");

      SQLiteTransaction transaction;

      if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.AllowNestedTransactions))
      {
          transaction = new SQLiteTransaction2(
              this, isolationLevel != ImmediateIsolationLevel);
      }
      else
      {
          transaction = new SQLiteTransaction(
              this, isolationLevel != ImmediateIsolationLevel);
      }

      OnChanged(this, new ConnectionEventArgs(
          SQLiteConnectionEventType.NewTransaction, null, transaction,
          null, null, null, null, null));

      return transaction;
    }

    /// <summary>
    /// This method is not implemented; however, the <see cref="Changed" />
    /// event will still be raised.
    /// </summary>
    /// <param name="databaseName"></param>
    public override void ChangeDatabase(string databaseName)
    {
      CheckDisposed();

      OnChanged(this, new ConnectionEventArgs(
          SQLiteConnectionEventType.ChangeDatabase, null, null, null, null,
          null, databaseName, null));

      throw new NotImplementedException(); // NOTE: For legacy compatibility.
    }

    /// <summary>
    /// When the database connection is closed, all commands linked to this connection are automatically reset.
    /// </summary>
    public override void Close()
    {
      CheckDisposed();

      if (Object.ReferenceEquals(_lastConnectionInOpen, this))
          _lastConnectionInOpen = null; /* THREAD-SAFE: per-thread datum. */

      OnChanged(this, new ConnectionEventArgs(
          SQLiteConnectionEventType.Closing, null, null, null, null, null,
          null, null));

      if (_sql != null)
      {
#if !PLATFORM_COMPACTFRAMEWORK
        lock (_enlistmentSyncRoot) /* TRANSACTIONAL */
        {
          SQLiteEnlistment enlistment = _enlistment;
          _enlistment = null;

          if (enlistment != null)
          {
            // If the connection is enlisted in a transaction scope and the scope is still active,
            // we cannot truly shut down this connection until the scope has completed.  Therefore make a
            // hidden connection temporarily to hold open the connection until the scope has completed.
            SQLiteConnection cnn = new SQLiteConnection();

#if DEBUG
            cnn._debugString = HelperMethods.StringFormat(
                CultureInfo.InvariantCulture,
                "closeThreadId = {0}, {1}{2}{2}{3}",
                HelperMethods.GetThreadId(), _sql,
                Environment.NewLine, _debugString);
#endif

            cnn._sql = _sql;
            cnn._transactionLevel = _transactionLevel;
            cnn._transactionSequence = _transactionSequence;
            cnn._enlistment = enlistment;
            cnn._connectionState = _connectionState;
            cnn._version = _version;

            SQLiteTransaction transaction = enlistment._transaction;

            if (transaction != null)
                transaction._cnn = cnn;

            enlistment._disposeConnection = true;

            _sql = null;

          }
        }
#endif
        if (_sql != null)
        {
          _sql.Close(_disposing);

          _sql = null;
        }
        _transactionLevel = 0;
        _transactionSequence = 0;
      }
      else
      {
          OnChanged(this, new ConnectionEventArgs(
              SQLiteConnectionEventType.NothingToDo,
              null, null, null, null, null, null, null));
      }

      StateChangeEventArgs eventArgs = null;
      OnStateChange(ConnectionState.Closed, ref eventArgs);

      OnChanged(this, new ConnectionEventArgs(
          SQLiteConnectionEventType.Closed, eventArgs, null, null, null,
          null, null, null));
    }

    /// <summary>
    /// Returns the number of pool entries for the file name associated with this connection.
    /// </summary>
    public int PoolCount
    {
        get
        {
            if (_sql == null) return 0;
            return _sql.CountPool();
        }
    }

    /// <summary>
    /// Returns the total number of created connections.
    /// </summary>
    public static long CreateCount
    {
        get { return SQLiteBase.CreateCount; }
    }

    /// <summary>
    /// Returns the total number of <see cref="Open" /> method calls for all connections.
    /// </summary>
    public static long OpenCount
    {
        get { return SQLiteBase.OpenCount; }
    }

    /// <summary>
    /// Returns the total number of <see cref="Close" /> method calls for all connections.
    /// </summary>
    public static long CloseCount
    {
        get { return SQLiteBase.CloseCount; }
    }

    /// <summary>
    /// Returns the total number of disposed connections.
    /// </summary>
    public static long DisposeCount
    {
        get { return SQLiteBase.DisposeCount; }
    }

    /// <summary>
    /// Clears the connection pool associated with the connection.  Any other active connections using the same database file
    /// will be discarded instead of returned to the pool when they are closed.
    /// </summary>
    /// <param name="connection"></param>
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618

619
620
621
622


623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638

639
640
641
642
643
644
645
646
647
648
649
650

651




































































































































652
653
654
655
656
657
658
659
660

661
662
663
664
665





















666
667
668
669
670
671
672
673
674

675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691






































692


693
694




















695














696




697
698
699
700
701
702


703

704


705

706





707

708
709
710
711

712

713


714

715





716
717
718
719





































































720
721
722
723
724
725
726
727

728


729

730












731
732
733
734
735








736


737
































































































































































738

739
740
741
742
743
744
745
746
747
748
749
750

751


752
753
754
755
756
















































































































































































































































































































































































































































757
758
759
760








761
762
763
764
765








766


767

768

769




770













771




772

















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





800






























801
802









803
804

805


806




807

808


809


810


811



812
813
814
815
816
817

818






































819


820

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


860

861
862
863
864
865

866





867












868
869


870
871
872



873
874
875
876

877







878




879
880
881


882


883
884
885

886
887
888
889
890

891





892
893
894












895
896
897
898
899
900
901
902
903
904
905



906

907

908
909
910


911












912
913
914
915
916
917
918
919
920
921
922
923
924
925
926









927
928
929
930
931
932
933
934










































































































































935
936
937
938
939
940
941
942
943
944
945
946

947
948
949
950
951
952
953
954
955

















































































































































































































































































956
957
958
959
960
961
962
















































































































































































































































963
964
965
966
967
968
969
970
971
972

973
974
975
976
977
















































































































978
979
980
981

982
983
984


985
986



987


988

989

































990




991
992
993
994

995
996
997


998
999



1000
1001
1002
1003






1004
1005
1006





1007
1008


1009
1010


1011
1012



1013



1014

1015












1016





1017
1018


1019
1020


1021
1022



1023
1024
1025
1026
1027
1028







1029






1030
1031
1032


























































































































































1033

1034
1035




1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062

1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
      SQLiteConnectionPool.ClearAllPools();
    }

    /// <summary>
    /// The connection string containing the parameters for the connection
    /// </summary>
    /// <remarks>
    /// <list type="table">
    /// <listheader>
    /// <term>Parameter</term>
    /// <term>Values</term>
    /// <term>Required</term>
    /// <term>Default</term>
    /// </listheader>
    /// <item>
    /// <description>Data Source</description>
    /// <description>{filename}</description>
    /// <description>Y</description>
    /// <description></description>
    /// </item>
    /// <item>
    /// <description>Version</description>
    /// <description>3</description>
    /// <description>N</description>
    /// <description>3</description>
    /// </item>
    /// <item>
    /// <description>UseUTF16Encoding</description>
    /// <description><b>True</b><br/><b>False</b></description>
    /// <description>N</description>
    /// <description>False</description>
    /// </item>
    /// <item>
    /// <description>DateTimeFormat</description>
    /// <description><b>Ticks</b> - Use DateTime.Ticks<br/><b>ISO8601</b> - Use ISO8601 DateTime format<br/><b>JulianDay</b> - Use JulianDay format</description>
    /// <description>N</description>
    /// <description>ISO8601</description>
    /// </item>
    /// <item>
    /// <description>BinaryGUID</description>
    /// <description><b>Yes/On/1</b> - Store GUID columns in binary form<br/><b>No/Off/0</b> - Store GUID columns as text</description>
    /// <description>N</description>
    /// <description>On</description>
    /// </item>
    /// <item>
    /// <description>Cache Size</description>
    /// <description>{size in bytes}</description>
    /// <description>N</description>
    /// <description>2000</description>
    /// </item>
    /// <item>
    /// <description>Synchronous</description>
    /// <description><b>Normal</b> - Normal file flushing behavior<br/><b>Full</b> - Full flushing after all writes<br/><b>Off</b> - Underlying OS flushes I/O's</description>
    /// <description>N</description>
    /// <description>Normal</description>
    /// </item>
    /// <item>
    /// <description>Page Size</description>
    /// <description>{size in bytes}</description>
    /// <description>N</description>
    /// <description>1024</description>
    /// </item>
    /// <item>
    /// <description>Password</description>
    /// <description>{password}</description>
    /// <description>N</description>
    /// <description></description>
    /// </item>
    /// <item>
    /// <description>Enlist</description>
    /// <description><B>Y</B> - Automatically enlist in distributed transactions<br/><b>N</b> - No automatic enlistment</description>
    /// <description>N</description>
    /// <description>Y</description>
    /// </item>
    /// <item>
    /// <description>Pooling</description>
    /// <description><b>True</b> - Use connection pooling<br/><b>False</b> - Do not use connection pooling</description>
    /// <description>N</description>
    /// <description>False</description>
    /// </item>
    /// <item>
    /// <description>FailIfMissing</description>
    /// <description><b>True</b> - Don't create the database if it does not exist, throw an error instead<br/><b>False</b> - Automatically create the database if it does not exist</description>
    /// <description>N</description>
    /// <description>False</description>
    /// </item>
    /// <item>
    /// <description>Max Page Count</description>
    /// <description>{size in pages} - Limits the maximum number of pages (limits the size) of the database</description>
    /// <description>N</description>
    /// <description>0</description>
    /// </item>
    /// <item>
    /// <description>Legacy Format</description>
    /// <description><b>True</b> - Use the more compatible legacy 3.x database format<br/><b>False</b> - Use the newer 3.3x database format which compresses numbers more effectively</description>
    /// <description>N</description>
    /// <description>False</description>
    /// </item>
    /// <item>
    /// <description>Default Timeout</description>
    /// <description>{time in seconds}<br/>The default command timeout</description>
    /// <description>N</description>
    /// <description>30</description>
    /// </item>
    /// <item>
    /// <description>Journal Mode</description>
    /// <description><b>Delete</b> - Delete the journal file after a commit<br/><b>Persist</b> - Zero out and leave the journal file on disk after a commit<br/><b>Off</b> - Disable the rollback journal entirely</description>
    /// <description>N</description>
    /// <description>Delete</description>
    /// </item>
    /// <item>
    /// <description>Read Only</description>
    /// <description><b>True</b> - Open the database for read only access<br/><b>False</b> - Open the database for normal read/write access</description>
    /// <description>N</description>
    /// <description>False</description>
    /// </item>
    /// <item>
    /// <description>Max Pool Size</description>
    /// <description>The maximum number of connections for the given connection string that can be in the connection pool</description>
    /// <description>N</description>
    /// <description>100</description>
    /// </item>
    /// <item>
    /// <description>Default IsolationLevel</description>
    /// <description>The default transaciton isolation level</description>
    /// <description>N</description>
    /// <description>Serializable</description>
    /// </item>
    /// <item>
    /// <description>Foreign Keys</description>
    /// <description><b>True</b> - Enables foreign key enforcement<br/><b>False</b> - Disables foreign key enforcement</description>
    /// <description>N</description>
    /// <description>False</description>
    /// </item>
    /// </list>
    /// </remarks>
#if !PLATFORM_COMPACTFRAMEWORK
    [RefreshProperties(RefreshProperties.All), DefaultValue("")]
    [Editor("SQLite.Designer.SQLiteConnectionStringEditor, SQLite.Designer, Version=1.0.37.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
    public override string ConnectionString
    {
      get
      {

        return _connectionString;
      }
      set
      {


        if (value == null)
          throw new ArgumentNullException();

        else if (_connectionState != ConnectionState.Closed)
          throw new InvalidOperationException();

        _connectionString = value;
      }
    }

    /// <summary>
    /// Create a new SQLiteCommand and associate it with this connection.
    /// </summary>
    /// <returns>Returns an instantiated SQLiteCommand object already assigned to this connection.</returns>
    public new SQLiteCommand CreateCommand()
    {

      return new SQLiteCommand(this);
    }

    /// <summary>
    /// Forwards to the local CreateCommand() function
    /// </summary>
    /// <returns></returns>
    protected override DbCommand CreateDbCommand()
    {
      return CreateCommand();
    }


    /// <summary>




































































































































    /// Returns the filename without extension or path
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#endif
    public override string DataSource
    {
      get
      {

        return _dataSource;
      }
    }

    /// <summary>





















    /// Returns an empty string
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#endif
    public override string Database
    {
      get
      {

        return "main";
      }
    }

    internal static string MapUriPath(string path)
    {
	    if (path.StartsWith ("file://", StringComparison.OrdinalIgnoreCase))
		    return path.Substring (7);
      else if (path.StartsWith ("file:", StringComparison.OrdinalIgnoreCase))
		    return path.Substring (5);
      else if (path.StartsWith ("/", StringComparison.OrdinalIgnoreCase))
		    return path;
      else
		    throw new InvalidOperationException ("Invalid connection string: invalid URI");
    }
    
    /// <summary>






































    /// Parses the connection string into component parts


    /// </summary>
    /// <param name="connectionString">The connection string to parse</param>




















    /// <returns>An array of key-value pairs representing each parameter of the connection string</returns>














    internal static SortedList<string, string> ParseConnectionString(string connectionString)




    {
      string s = connectionString;
      int n;
      SortedList<string, string> ls = new SortedList<string, string>(StringComparer.OrdinalIgnoreCase);

      // First split into semi-colon delimited values.  The Split() function of SQLiteBase accounts for and properly


      // skips semi-colons in quoted strings

      string[] arParts = SQLiteConvert.Split(s, ';');


      string[] arPiece;







      int x = arParts.Length;

      // For each semi-colon piece, split into key and value pairs by the presence of the = sign
      for (n = 0; n < x; n++)
      {
        arPiece = SQLiteConvert.Split(arParts[n], '=');

        if (arPiece.Length == 2)

        {


          ls.Add(arPiece[0], arPiece[1]);

        }





        else throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "Invalid ConnectionString format for parameter \"{0}\"", (arPiece.Length > 0) ? arPiece[0] : "null"));
      }
      return ls;
    }






































































#if !PLATFORM_COMPACTFRAMEWORK
    /// <summary>
    /// Manual distributed transaction enlistment support
    /// </summary>
    /// <param name="transaction">The distributed transaction to enlist in</param>
    public override void EnlistTransaction(System.Transactions.Transaction transaction)
    {

      if (_transactionLevel > 0 && transaction != null)


        throw new ArgumentException("Unable to enlist in transaction, a local transaction already exists");














      if (_enlistment != null && transaction == _enlistment._scope)
        return;
      else if (_enlistment != null)
        throw new ArgumentException("Already enlisted in a transaction");









      _enlistment = new SQLiteEnlistment(this, transaction);


    }
































































































































































#endif


    /// <summary>
    /// Looks for a key in the array of key/values of the parameter string.  If not found, return the specified default value
    /// </summary>
    /// <param name="items">The list to look in</param>
    /// <param name="key">The key to find</param>
    /// <param name="defValue">The default value to return if the key is not found</param>
    /// <returns>The value corresponding to the specified key, or the default value if not found.</returns>
    static internal string FindKey(SortedList<string, string> items, string key, string defValue)
    {
      string ret;


      if (items.TryGetValue(key, out ret)) return ret;



      return defValue;
    }

    /// <summary>
















































































































































































































































































































































































































































    /// Opens the connection using the parameters found in the <see cref="ConnectionString">ConnectionString</see>
    /// </summary>
    public override void Open()
    {








      if (_connectionState != ConnectionState.Closed)
        throw new InvalidOperationException();

      Close();









      SortedList<string, string> opts = ParseConnectionString(_connectionString);


      string fileName;



      if (Convert.ToInt32(FindKey(opts, "Version", "3"), CultureInfo.InvariantCulture) != 3)




        throw new NotSupportedException("Only SQLite Version 3 is supported at this time");


















      fileName = FindKey(opts, "Data Source", "");


















      if (String.IsNullOrEmpty(fileName))


      {


        fileName = FindKey(opts, "Uri", "");
        if (String.IsNullOrEmpty(fileName))





          throw new ArgumentException("Data Source cannot be empty.  Use :memory: to open an in-memory database");






        else






          fileName = MapUriPath(fileName);

      }





























      if (String.Compare(fileName, ":MEMORY:", StringComparison.OrdinalIgnoreCase) == 0)







        fileName = ":memory:";











































      else



      {
































#if PLATFORM_COMPACTFRAMEWORK
       if (fileName.StartsWith(".\\"))
         fileName = Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().GetName().CodeBase) + fileName.Substring(1);
#endif

       fileName = ExpandFileName(fileName);
      }


      try
      {
        bool usePooling = (SQLiteConvert.ToBoolean(FindKey(opts, "Pooling", Boolean.FalseString)) == true);
        bool bUTF16 = (SQLiteConvert.ToBoolean(FindKey(opts, "UseUTF16Encoding", Boolean.FalseString)) == true);
        int maxPoolSize = Convert.ToInt32(FindKey(opts, "Max Pool Size", "100"), CultureInfo.InvariantCulture);

        _defaultTimeout = Convert.ToInt32(FindKey(opts, "Default Timeout", "30"), CultureInfo.CurrentCulture);




































        _defaultIsolation = (IsolationLevel)Enum.Parse(typeof(IsolationLevel), FindKey(opts, "Default IsolationLevel", "Serializable"), true);
        if (_defaultIsolation != IsolationLevel.Serializable && _defaultIsolation != IsolationLevel.ReadCommitted)









          throw new NotSupportedException("Invalid Default IsolationLevel specified");


        SQLiteDateFormats dateFormat = (SQLiteDateFormats)Enum.Parse(typeof(SQLiteDateFormats), FindKey(opts, "DateTimeFormat", "ISO8601"), true);


        //string temp = FindKey(opts, "DateTimeFormat", "ISO8601");




        //if (String.Compare(temp, "ticks", StringComparison.OrdinalIgnoreCase) == 0) dateFormat = SQLiteDateFormats.Ticks;

        //else if (String.Compare(temp, "julianday", StringComparison.OrdinalIgnoreCase) == 0) dateFormat = SQLiteDateFormats.JulianDay;





        if (bUTF16) // SQLite automatically sets the encoding of the database to UTF16 if called from sqlite3_open16()


          _sql = new SQLite3_UTF16(dateFormat);



        else
          _sql = new SQLite3(dateFormat);

        SQLiteOpenFlagsEnum flags = SQLiteOpenFlagsEnum.None;

        if (SQLiteConvert.ToBoolean(FindKey(opts, "FailIfMissing", Boolean.FalseString)) == false)

          flags |= SQLiteOpenFlagsEnum.Create;









































        if (SQLiteConvert.ToBoolean(FindKey(opts, "Read Only", Boolean.FalseString)) == true)

          flags |= SQLiteOpenFlagsEnum.ReadOnly;




        else


          flags |= SQLiteOpenFlagsEnum.ReadWrite;



        _sql.Open(fileName, flags, maxPoolSize, usePooling);










        _binaryGuid = (SQLiteConvert.ToBoolean(FindKey(opts, "BinaryGUID", Boolean.TrueString)) == true);






























        string password = FindKey(opts, "Password", null);




        if (String.IsNullOrEmpty(password) == false)


          _sql.SetPassword(System.Text.UTF8Encoding.UTF8.GetBytes(password));


        else if (_password != null)


          _sql.SetPassword(_password);










        _password = null;


























        _dataSource = Path.GetFileNameWithoutExtension(fileName);



        _version++;

        ConnectionState oldstate = _connectionState;
        _connectionState = ConnectionState.Open;

        try
        {











          using (SQLiteCommand cmd = CreateCommand())
          {






            string defValue;

            if (fileName != ":memory:")
            {
              defValue = FindKey(opts, "Page Size", "1024");


              if (Convert.ToInt32(defValue, CultureInfo.InvariantCulture) != 1024)

              {
                cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA page_size={0}", defValue);
                cmd.ExecuteNonQuery();

              }
            }

            defValue = FindKey(opts, "Max Page Count", "0");


            if (Convert.ToInt32(defValue, CultureInfo.InvariantCulture) != 0)

            {
              cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA max_page_count={0}", defValue);
              cmd.ExecuteNonQuery();
            }


            defValue = FindKey(opts, "Legacy Format", Boolean.FalseString);





            cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA legacy_file_format={0}", SQLiteConvert.ToBoolean(defValue) == true ? "ON" : "OFF");












            cmd.ExecuteNonQuery();



            defValue = FindKey(opts, "Synchronous", "Normal");
            if (String.Compare(defValue, "Full", StringComparison.OrdinalIgnoreCase) != 0)
            {



              cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA synchronous={0}", defValue);
              cmd.ExecuteNonQuery();
            }


            defValue = FindKey(opts, "Cache Size", "2000");







            if (Convert.ToInt32(defValue, CultureInfo.InvariantCulture) != 2000)




            {
              cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA cache_size={0}", defValue);
              cmd.ExecuteNonQuery();


            }



            defValue = FindKey(opts, "Journal Mode", "Delete");
            if (String.Compare(defValue, "Delete", StringComparison.OrdinalIgnoreCase) != 0)

            {
              cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA journal_mode={0}", defValue);
              cmd.ExecuteNonQuery();
            }


            defValue = FindKey(opts, "Foreign Keys", Boolean.FalseString);





            cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA foreign_keys={0}", SQLiteConvert.ToBoolean(defValue) == true ? "ON" : "OFF");
            cmd.ExecuteNonQuery();
          }













          if (_commitHandler != null)
            _sql.SetCommitHook(_commitCallback);

          if (_updateHandler != null)
            _sql.SetUpdateHook(_updateCallback);

          if (_rollbackHandler != null)
            _sql.SetRollbackHook(_rollbackCallback);

#if !PLATFORM_COMPACTFRAMEWORK



          if (Transactions.Transaction.Current != null && SQLiteConvert.ToBoolean(FindKey(opts, "Enlist", Boolean.TrueString)) == true)

            EnlistTransaction(Transactions.Transaction.Current);

#endif

          _connectionState = oldstate;


          OnStateChange(ConnectionState.Open);












        }
        catch
        {
          _connectionState = oldstate;
          throw;
        }
      }
      catch (SQLiteException)
      {
        Close();
        throw;
      }
    }

    /// <summary>









    /// Gets/sets the default command timeout for newly-created commands.  This is especially useful for 
    /// commands used internally such as inside a SQLiteTransaction, where setting the timeout is not possible.
    /// This can also be set in the ConnectionString with "Default Timeout"
    /// </summary>
    public int DefaultTimeout
    {
      get { return _defaultTimeout; }
      set { _defaultTimeout = value; }










































































































































    }

    /// <summary>
    /// Returns the version of the underlying SQLite database engine
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#endif
    public override string ServerVersion
    {
      get
      {

        return SQLiteVersion;
        //if (_connectionState != ConnectionState.Open)
        //  throw new InvalidOperationException();

        //return _sql.Version;
      }
    }

    /// <summary>

















































































































































































































































































    /// Returns the version of the underlying SQLite database engine
    /// </summary>
    public static string SQLiteVersion
    {
      get { return SQLite3.SQLiteVersion; }
    }

















































































































































































































































    /// <summary>
    /// Returns the state of the connection.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#endif
    public override ConnectionState State
    {
      get
      {

        return _connectionState;
      }
    }

    /// <summary>
















































































































    /// Change the password (or assign a password) to an open database.
    /// </summary>
    /// <remarks>
    /// No readers or writers may be active for this process.  The database must already be open

    /// and if it already was password protected, the existing password must already have been supplied.
    /// </remarks>
    /// <param name="newPassword">The new password to assign to the database</param>


    public void ChangePassword(string newPassword)
    {



      ChangePassword(String.IsNullOrEmpty(newPassword) ? null : System.Text.UTF8Encoding.UTF8.GetBytes(newPassword));


    }



































    /// <summary>




    /// Change the password (or assign a password) to an open database.
    /// </summary>
    /// <remarks>
    /// No readers or writers may be active for this process.  The database must already be open

    /// and if it already was password protected, the existing password must already have been supplied.
    /// </remarks>
    /// <param name="newPassword">The new password to assign to the database</param>


    public void ChangePassword(byte[] newPassword)
    {



      if (_connectionState != ConnectionState.Open)
        throw new InvalidOperationException("Database must be opened before changing the password.");

      _sql.ChangePassword(newPassword);






    }

    /// <summary>





    /// Sets the password for a password-protected database.  A password-protected database is
    /// unusable for any operation until the password has been set.


    /// </summary>
    /// <param name="databasePassword">The password for the database</param>


    public void SetPassword(string databasePassword)
    {



      SetPassword(String.IsNullOrEmpty(databasePassword) ? null : System.Text.UTF8Encoding.UTF8.GetBytes(databasePassword));



    }














    /// <summary>





    /// Sets the password for a password-protected database.  A password-protected database is
    /// unusable for any operation until the password has been set.


    /// </summary>
    /// <param name="databasePassword">The password for the database</param>


    public void SetPassword(byte[] databasePassword)
    {



      if (_connectionState != ConnectionState.Closed)
        throw new InvalidOperationException("Password can only be set before the database is opened.");

      if (databasePassword != null)
        if (databasePassword.Length == 0) databasePassword = null;








      _password = databasePassword;






    }

    /// <summary>


























































































































































    /// Expand the filename of the data source, resolving the |DataDirectory| macro as appropriate.

    /// </summary>
    /// <param name="sourceFile">The database filename to expand</param>




    /// <returns>The expanded path and filename of the filename</returns>
    private string ExpandFileName(string sourceFile)
    {
      if (String.IsNullOrEmpty(sourceFile)) return sourceFile;

      if (sourceFile.StartsWith(_dataDirectory, StringComparison.OrdinalIgnoreCase))
      {
        string dataDirectory;

#if PLATFORM_COMPACTFRAMEWORK
        dataDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().GetName().CodeBase);
#else
        dataDirectory = AppDomain.CurrentDomain.GetData("DataDirectory") as string;
        if (String.IsNullOrEmpty(dataDirectory))
          dataDirectory = AppDomain.CurrentDomain.BaseDirectory;
#endif

        if (sourceFile.Length > _dataDirectory.Length)
        {
          if (sourceFile[_dataDirectory.Length] == Path.DirectorySeparatorChar ||
              sourceFile[_dataDirectory.Length] == Path.AltDirectorySeparatorChar)
            sourceFile = sourceFile.Remove(_dataDirectory.Length, 1);
        }
        sourceFile = Path.Combine(dataDirectory, sourceFile.Substring(_dataDirectory.Length));
      }

#if !PLATFORM_COMPACTFRAMEWORK

      sourceFile = Path.GetFullPath(sourceFile);
#endif

      return sourceFile;
    }

    ///<overloads>
    /// The following commands are used to extract schema information out of the database.  Valid schema types are:
    /// <list type="bullet">
    /// <item>
    /// <description>MetaDataCollections</description>







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<



|





>




>
>











|

|


>




|







>

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








>





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








>
|





|
|

|

|

|

|

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

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





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



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



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








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

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

>












>

>
>





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



>
>
>
>
>
>
>
>





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

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

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

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

|
|

>
|
|
>
>


|
<
|

|
>
>
>
>
>

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

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

>
>
|
>
>
|
>
>
>

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

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

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





>


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

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

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











>
>
>
|
>
|
>



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







|







>
>
>
>
>
>
>
>
>
|





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












>









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






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










>





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


|
>
|

|
>
>


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

>
>
>
>
|


|
>
|

|
>
>


>
>
>



|
>
>
>
>
>
>



>
>
>
>
>
|
|
>
>

|
>
>


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

>
>
>
>
>
|
|
>
>

|
>
>


>
>
>






>
>
>
>
>
>
>

>
>
>
>
>
>



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


>
>
>
>

|

|

|
|
|

<
<
<
<
<
<
<
<
|
|
|
|
|
|
|
|


>
|


|







3527
3528
3529
3530
3531
3532
3533















































































































3534


3535













3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868

4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945

4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214

5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455








6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
      SQLiteConnectionPool.ClearAllPools();
    }

    /// <summary>
    /// The connection string containing the parameters for the connection
    /// </summary>
    /// <remarks>















































































































    /// For the complete list of supported connection string properties,


    /// please see <see cref="SQLiteConnection" />.













    /// </remarks>
#if !PLATFORM_COMPACTFRAMEWORK
    [RefreshProperties(RefreshProperties.All), DefaultValue("")]
    [Editor("SQLite.Designer.SQLiteConnectionStringEditor, SQLite.Designer, Version=" + SQLite3.DesignerVersion + ", Culture=neutral, PublicKeyToken=db937bc2d44ff139", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
    public override string ConnectionString
    {
      get
      {
        CheckDisposed();
        return _connectionString;
      }
      set
      {
        CheckDisposed();

        if (value == null)
          throw new ArgumentNullException();

        else if (_connectionState != ConnectionState.Closed)
          throw new InvalidOperationException();

        _connectionString = value;
      }
    }

    /// <summary>
    /// Create a new <see cref="SQLiteCommand" /> and associate it with this connection.
    /// </summary>
    /// <returns>Returns a new command object already assigned to this connection.</returns>
    public new SQLiteCommand CreateCommand()
    {
      CheckDisposed();
      return new SQLiteCommand(this);
    }

    /// <summary>
    /// Forwards to the local <see cref="CreateCommand" /> function.
    /// </summary>
    /// <returns></returns>
    protected override DbCommand CreateDbCommand()
    {
      return CreateCommand();
    }

#if INTEROP_SESSION_EXTENSION
    /// <summary>
    /// Attempts to create a new <see cref="ISQLiteSession" /> object instance
    /// using this connection and the specified database name.
    /// </summary>
    /// <param name="databaseName">
    /// The name of the database for the newly created session.
    /// </param>
    /// <returns>
    /// The newly created session -OR- null if it cannot be created.
    /// </returns>
    public ISQLiteSession CreateSession(
        string databaseName
        )
    {
        CheckDisposed();

        return new SQLiteSession(GetCriticalHandle(this), _flags, databaseName);
    }

    /// <summary>
    /// Attempts to create a new <see cref="ISQLiteChangeSet" /> object instance
    /// using this connection and the specified raw data.
    /// </summary>
    /// <param name="rawData">
    /// The raw data that contains a change set (or patch set).
    /// </param>
    /// <returns>
    /// The newly created change set -OR- null if it cannot be created.
    /// </returns>
    public ISQLiteChangeSet CreateChangeSet(
        byte[] rawData
        )
    {
        CheckDisposed();

        return new SQLiteMemoryChangeSet(rawData, GetCriticalHandle(this), _flags);
    }

    /// <summary>
    /// Attempts to create a new <see cref="ISQLiteChangeSet" /> object instance
    /// using this connection and the specified raw data.
    /// </summary>
    /// <param name="rawData">
    /// The raw data that contains a change set (or patch set).
    /// </param>
    /// <param name="flags">
    /// The flags used to create the change set iterator.
    /// </param>
    /// <returns>
    /// The newly created change set -OR- null if it cannot be created.
    /// </returns>
    public ISQLiteChangeSet CreateChangeSet(
        byte[] rawData,
        SQLiteChangeSetStartFlags flags
        )
    {
        CheckDisposed();

        return new SQLiteMemoryChangeSet(rawData, GetCriticalHandle(this), _flags, flags);
    }

    /// <summary>
    /// Attempts to create a new <see cref="ISQLiteChangeSet" /> object instance
    /// using this connection and the specified stream.
    /// </summary>
    /// <param name="inputStream">
    /// The stream where the raw data that contains a change set (or patch set)
    /// may be read.
    /// </param>
    /// <param name="outputStream">
    /// The stream where the raw data that contains a change set (or patch set)
    /// may be written.
    /// </param>
    /// <returns>
    /// The newly created change set -OR- null if it cannot be created.
    /// </returns>
    public ISQLiteChangeSet CreateChangeSet(
        Stream inputStream,
        Stream outputStream
        )
    {
        CheckDisposed();

        return new SQLiteStreamChangeSet(
            inputStream, outputStream, GetCriticalHandle(this), _flags);
    }

    /// <summary>
    /// Attempts to create a new <see cref="ISQLiteChangeSet" /> object instance
    /// using this connection and the specified stream.
    /// </summary>
    /// <param name="inputStream">
    /// The stream where the raw data that contains a change set (or patch set)
    /// may be read.
    /// </param>
    /// <param name="outputStream">
    /// The stream where the raw data that contains a change set (or patch set)
    /// may be written.
    /// </param>
    /// <param name="flags">
    /// The flags used to create the change set iterator.
    /// </param>
    /// <returns>
    /// The newly created change set -OR- null if it cannot be created.
    /// </returns>
    public ISQLiteChangeSet CreateChangeSet(
        Stream inputStream,
        Stream outputStream,
        SQLiteChangeSetStartFlags flags
        )
    {
        CheckDisposed();

        return new SQLiteStreamChangeSet(
            inputStream, outputStream, GetCriticalHandle(this), _flags, flags);
    }

    /// <summary>
    /// Attempts to create a new <see cref="ISQLiteChangeGroup" /> object
    /// instance using this connection.
    /// </summary>
    /// <returns>
    /// The newly created change group -OR- null if it cannot be created.
    /// </returns>
    public ISQLiteChangeGroup CreateChangeGroup()
    {
        CheckDisposed();

        return new SQLiteChangeGroup(_flags);
    }
#endif

    /// <summary>
    /// Returns the data source file name without extension or path.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#endif
    public override string DataSource
    {
      get
      {
        CheckDisposed();
        return _dataSource;
      }
    }

    /// <summary>
    /// Returns the fully qualified path and file name for the currently open
    /// database, if any.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#endif
    public string FileName
    {
        get
        {
            CheckDisposed();

            if (_sql == null)
                throw new InvalidOperationException(
                    "Database connection not valid for getting file name.");

            return _sql.GetFileName(GetDefaultCatalogName());
        }
    }

    /// <summary>
    /// Returns the string "main".
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#endif
    public override string Database
    {
      get
      {
        CheckDisposed();
        return GetDefaultCatalogName();
      }
    }

    internal static string MapUriPath(string path)
    {
        if (path.StartsWith ("file://", StringComparison.OrdinalIgnoreCase))
            return path.Substring (7);
      else if (path.StartsWith ("file:", StringComparison.OrdinalIgnoreCase))
            return path.Substring (5);
      else if (path.StartsWith ("/", StringComparison.OrdinalIgnoreCase))
            return path;
      else
            throw new InvalidOperationException ("Invalid connection string: invalid URI");
    }

    /// <summary>
    /// Determines if the legacy connection string parser should be used.
    /// </summary>
    /// <param name="connection">
    /// The connection that will be using the parsed connection string.
    /// </param>
    /// <returns>
    /// Non-zero if the legacy connection string parser should be used.
    /// </returns>
    private static bool ShouldUseLegacyConnectionStringParser(
        SQLiteConnection connection
        )
    {
        string name = "No_SQLiteConnectionNewParser";
        object value;

        if ((connection != null) &&
            connection.TryGetCachedSetting(name, null, out value))
        {
            return (value != null);
        }

        if ((connection == null) &&
            TryGetLastCachedSetting(name, null, out value))
        {
            return (value != null);
        }

        value = UnsafeNativeMethods.GetSettingValue(name, null);

        if (connection != null)
            connection.SetCachedSetting(name, value);
        else
            SetLastCachedSetting(name, value);

        return (value != null);
    }

    /// <summary>
    /// Parses a connection string into component parts using the custom
    /// connection string parser.  An exception may be thrown if the syntax
    /// of the connection string is incorrect.
    /// </summary>
    /// <param name="connectionString">
    /// The connection string to parse.
    /// </param>
    /// <param name="allowNameOnly">
    /// Non-zero if names are allowed without values.
    /// </param>
    /// <returns>
    /// The list of key/value pairs corresponding to the parameters specified
    /// within the connection string.
    /// </returns>
    private static SortedList<string, string> ParseConnectionString(
        string connectionString,
        bool allowNameOnly
        )
    {
        return ParseConnectionString(null, connectionString, allowNameOnly);
    }

    /// <summary>
    /// Parses a connection string into component parts using the custom
    /// connection string parser.  An exception may be thrown if the syntax
    /// of the connection string is incorrect.
    /// </summary>
    /// <param name="connection">
    /// The connection that will be using the parsed connection string.
    /// </param>
    /// <param name="connectionString">
    /// The connection string to parse.
    /// </param>
    /// <param name="allowNameOnly">
    /// Non-zero if names are allowed without values.
    /// </param>
    /// <returns>
    /// The list of key/value pairs corresponding to the parameters specified
    /// within the connection string.
    /// </returns>
    private static SortedList<string, string> ParseConnectionString(
        SQLiteConnection connection,
        string connectionString,
        bool allowNameOnly
        )
    {
      string s = connectionString;
      int n;
      SortedList<string, string> ls = new SortedList<string, string>(StringComparer.OrdinalIgnoreCase);

      // First split into semi-colon delimited values.
      string error = null;
      string[] arParts;

      if (ShouldUseLegacyConnectionStringParser(connection))
          arParts = SQLiteConvert.Split(s, SQLiteConvert.PairChar);
      else
          arParts = SQLiteConvert.NewSplit(s, SQLiteConvert.PairChar, true, ref error);

      if (arParts == null)
      {
          throw new ArgumentException(HelperMethods.StringFormat(
              CultureInfo.CurrentCulture,
              "Invalid ConnectionString format, cannot parse: {0}", (error != null) ?
              error : "could not split connection string into properties"));
      }

      int x = (arParts != null) ? arParts.Length : 0;
      // For each semi-colon piece, split into key and value pairs by the presence of the = sign
      for (n = 0; n < x; n++)
      {
        if (arParts[n] == null)
          continue;

        arParts[n] = arParts[n].Trim();

        if (arParts[n].Length == 0)
          continue;

        int indexOf = arParts[n].IndexOf(SQLiteConvert.ValueChar);

        if (indexOf != -1)
          ls.Add(UnwrapString(arParts[n].Substring(0, indexOf).Trim()), UnwrapString(arParts[n].Substring(indexOf + 1).Trim()));
        else if (allowNameOnly)
          ls.Add(UnwrapString(arParts[n].Trim()), String.Empty);
        else
          throw new ArgumentException(HelperMethods.StringFormat(CultureInfo.CurrentCulture, "Invalid ConnectionString format for part \"{0}\", no equal sign found", arParts[n]));
      }
      return ls;
    }

    /// <summary>
    /// Parses a connection string using the built-in (i.e. framework provided)
    /// connection string parser class and returns the key/value pairs.  An
    /// exception may be thrown if the connection string is invalid or cannot be
    /// parsed.  When compiled for the .NET Compact Framework, the custom
    /// connection string parser is always used instead because the framework
    /// provided one is unavailable there.
    /// </summary>
    /// <param name="connection">
    /// The connection that will be using the parsed connection string.
    /// </param>
    /// <param name="connectionString">
    /// The connection string to parse.
    /// </param>
    /// <param name="strict">
    /// Non-zero to throw an exception if any connection string values are not of
    /// the <see cref="String" /> type.  This is not applicable when running on
    /// the .NET Compact Framework.
    /// </param>
    /// <returns>The list of key/value pairs.</returns>
    private static SortedList<string, string> ParseConnectionStringViaFramework(
        SQLiteConnection connection,
        string connectionString,
        bool strict
        )
    {
#if !PLATFORM_COMPACTFRAMEWORK
        DbConnectionStringBuilder connectionStringBuilder
            = new DbConnectionStringBuilder();

        connectionStringBuilder.ConnectionString = connectionString; /* throw */

        SortedList<string, string> result =
            new SortedList<string, string>(StringComparer.OrdinalIgnoreCase);

        foreach (string keyName in connectionStringBuilder.Keys)
        {
            object value = connectionStringBuilder[keyName];
            string keyValue = null;

            if (value is string)
            {
                keyValue = (string)value;
            }
            else if (strict)
            {
                throw new ArgumentException(
                    "connection property value is not a string",
                    keyName);
            }
            else if (value != null)
            {
                keyValue = value.ToString();
            }

            result.Add(keyName, keyValue);
        }

        return result;
#else
        //
        // NOTE: On the .NET Compact Framework, always use our custom connection
        //       string parser as the built-in (i.e. framework provided) one is
        //       unavailable.
        //
        return ParseConnectionString(connection, connectionString, false);
#endif
    }

#if !PLATFORM_COMPACTFRAMEWORK
    /// <summary>
    /// Manual distributed transaction enlistment support
    /// </summary>
    /// <param name="transaction">The distributed transaction to enlist in</param>
    public override void EnlistTransaction(System.Transactions.Transaction transaction)
    {
        CheckDisposed();

        bool waitForEnlistmentReset;
        int waitTimeout;

        lock (_enlistmentSyncRoot) /* TRANSACTIONAL */
        {
            waitForEnlistmentReset = HelperMethods.HasFlags(
                _flags, SQLiteConnectionFlags.WaitForEnlistmentReset);

            waitTimeout = _waitTimeout;
        }

        if (waitForEnlistmentReset)
            /* IGNORED */
            WaitForEnlistmentReset(waitTimeout, null);

        lock (_enlistmentSyncRoot) /* TRANSACTIONAL */
        {
            if (_enlistment != null && transaction == _enlistment._scope)
                return;
            else if (_enlistment != null)
                throw new ArgumentException("Already enlisted in a transaction");

            if (_transactionLevel > 0 && transaction != null)
                throw new ArgumentException("Unable to enlist in transaction, a local transaction already exists");
            else if (transaction == null)
                throw new ArgumentNullException("Unable to enlist in transaction, it is null");

            bool strictEnlistment = HelperMethods.HasFlags(
                _flags, SQLiteConnectionFlags.StrictEnlistment);

            _enlistment = new SQLiteEnlistment(this, transaction,
                GetFallbackDefaultIsolationLevel(), strictEnlistment,
                strictEnlistment);

            OnChanged(this, new ConnectionEventArgs(
                SQLiteConnectionEventType.EnlistTransaction, null, null, null, null,
                null, null, new object[] { _enlistment }));
        }
    }
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    /// <summary>
    /// <b>EXPERIMENTAL</b> --
    /// Waits for the enlistment associated with this connection to be reset.
    /// This method always throws <see cref="NotImplementedException" /> when
    /// running on the .NET Compact Framework.
    /// </summary>
    /// <param name="timeoutMilliseconds">
    /// The approximate maximum number of milliseconds to wait before timing
    /// out the wait operation.
    /// </param>
    /// <param name="returnOnDisposed">
    /// The return value to use if the connection has been disposed; if this
    /// value is null, <see cref="ObjectDisposedException" /> will be raised
    /// if the connection has been disposed.
    /// </param>
    /// <returns>
    /// Non-zero if the enlistment assciated with this connection was reset;
    /// otherwise, zero.  It should be noted that this method returning a
    /// non-zero value does not necessarily guarantee that the connection
    /// can enlist in a new transaction (i.e. due to potentical race with
    /// other threads); therefore, callers should generally use try/catch
    /// when calling the <see cref="EnlistTransaction" /> method.
    /// </returns>
#else
    /// <summary>
    /// <b>EXPERIMENTAL</b> --
    /// Waits for the enlistment associated with this connection to be reset.
    /// This method always throws <see cref="NotImplementedException" /> when
    /// running on the .NET Compact Framework.
    /// </summary>
    /// <param name="timeoutMilliseconds">
    /// The approximate maximum number of milliseconds to wait before timing
    /// out the wait operation.
    /// </param>
    /// <param name="returnOnDisposed">
    /// The return value to use if the connection has been disposed; if this
    /// value is null, <see cref="ObjectDisposedException" /> will be raised
    /// if the connection has been disposed.
    /// </param>
    /// <returns>
    /// Non-zero if the enlistment assciated with this connection was reset;
    /// otherwise, zero.  It should be noted that this method returning a
    /// non-zero value does not necessarily guarantee that the connection
    /// can enlist in a new transaction (i.e. due to potentical race with
    /// other threads); therefore, callers should generally use try/catch
    /// when calling the EnlistTransaction method.
    /// </returns>
#endif
    public bool WaitForEnlistmentReset(
        int timeoutMilliseconds,
        bool? returnOnDisposed
        )
    {
        if (returnOnDisposed == null)
            CheckDisposed();
        else if(disposed)
            return (bool)returnOnDisposed;

#if !PLATFORM_COMPACTFRAMEWORK
        if (timeoutMilliseconds < 0)
            throw new ArgumentException("timeout cannot be negative");

        const int defaultMilliseconds = 100;
        int sleepMilliseconds;

        if (timeoutMilliseconds == 0)
        {
            sleepMilliseconds = 0;
        }
        else
        {
            sleepMilliseconds = Math.Min(
                timeoutMilliseconds / 10, defaultMilliseconds);

            if (sleepMilliseconds == 0)
                sleepMilliseconds = defaultMilliseconds;
        }

        DateTime start = DateTime.UtcNow;

        while (true)
        {
            //
            // NOTE: Attempt to acquire the necessary lock without blocking.
            //       This method will treat a failure to obtain the lock the
            //       same as the enlistment not being reset yet.  Both will
            //       advance toward the timeout.
            //
            bool locked = Monitor.TryEnter(_enlistmentSyncRoot);

            try
            {
                if (locked)
                {
                    //
                    // NOTE: Is there still an enlistment?  If not, we are
                    //       done.  There is a potential race condition in
                    //       the caller if another thread is able to setup
                    //       a new enlistment at any point prior to our
                    //       caller fully dealing with the result of this
                    //       method.  However, that should generally never
                    //       happen because this class is not intended to
                    //       be used by multiple concurrent threads, with
                    //       the notable exception of an active enlistment
                    //       being asynchronously committed or rolled back
                    //       by the .NET Framework.
                    //
                    if (_enlistment == null)
                        return true;
                }
            }
            finally
            {
                if (locked)
                {
                    Monitor.Exit(_enlistmentSyncRoot);
                    locked = false;
                }
            }

            //
            // NOTE: A timeout value of zero is special.  It means never
            //       sleep.
            //
            if (sleepMilliseconds == 0)
                return false;

            //
            // NOTE: How much time has elapsed since we first starting
            //       waiting?
            //
            DateTime now = DateTime.UtcNow;
            TimeSpan elapsed = now.Subtract(start);

            //
            // NOTE: Are we done wait?
            //
            double totalMilliseconds = elapsed.TotalMilliseconds;

            if ((totalMilliseconds < 0) || /* Time went backward? */
                (totalMilliseconds >= (double)timeoutMilliseconds))
            {
                return false;
            }

            //
            // NOTE: Sleep for a bit and then try again.
            //
            Thread.Sleep(sleepMilliseconds);
        }
#else
        throw new NotImplementedException();
#endif
    }

    /// <summary>
    /// Looks for a key in the array of key/values of the parameter string.  If not found, return the specified default value
    /// </summary>
    /// <param name="items">The list to look in</param>
    /// <param name="key">The key to find</param>
    /// <param name="defValue">The default value to return if the key is not found</param>
    /// <returns>The value corresponding to the specified key, or the default value if not found.</returns>
    static internal string FindKey(SortedList<string, string> items, string key, string defValue)
    {
      string ret;

      if (String.IsNullOrEmpty(key)) return defValue;
      if (items.TryGetValue(key, out ret)) return ret;
      if (items.TryGetValue(key.Replace(" ", String.Empty), out ret)) return ret;
      if (items.TryGetValue(key.Replace(" ", "_"), out ret)) return ret;

      return defValue;
    }

    /// <summary>
    /// Attempts to convert the string value to an enumerated value of the specified type.
    /// </summary>
    /// <param name="type">The enumerated type to convert the string value to.</param>
    /// <param name="value">The string value to be converted.</param>
    /// <param name="ignoreCase">Non-zero to make the conversion case-insensitive.</param>
    /// <returns>The enumerated value upon success or null upon error.</returns>
    internal static object TryParseEnum(
        Type type,
        string value,
        bool ignoreCase
        )
    {
        if (!String.IsNullOrEmpty(value))
        {
            try
            {
                return Enum.Parse(type, value, ignoreCase);
            }
            catch
            {
                // do nothing.
            }
        }

        return null;
    }

    /// <summary>
    /// Attempts to convert an input string into a byte value.
    /// </summary>
    /// <param name="value">
    /// The string value to be converted.
    /// </param>
    /// <param name="style">
    /// The number styles to use for the conversion.
    /// </param>
    /// <param name="result">
    /// Upon sucess, this will contain the parsed byte value.
    /// Upon failure, the value of this parameter is undefined.
    /// </param>
    /// <returns>
    /// Non-zero upon success; zero on failure.
    /// </returns>
    private static bool TryParseByte(
        string value,
        NumberStyles style,
        out byte result
        )
    {
#if !PLATFORM_COMPACTFRAMEWORK
        return byte.TryParse(value, style, null, out result);
#else
        try
        {
            result = byte.Parse(value, style);
            return true;
        }
        catch
        {
            result = 0;
            return false;
        }
#endif
    }

    /// <summary>
    /// Change a limit value for the database.
    /// </summary>
    /// <param name="option">
    /// The database limit to change.
    /// </param>
    /// <param name="value">
    /// The new value for the specified limit.
    /// </param>
    /// <returns>
    /// The old value for the specified limit -OR- negative one if an error
    /// occurs.
    /// </returns>
    public int SetLimitOption(
        SQLiteLimitOpsEnum option,
        int value
        )
    {
        CheckDisposed();

        if (_sql == null)
        {
            throw new InvalidOperationException(
                "Database connection not valid for changing a limit option.");
        }

        return _sql.SetLimitOption(option, value);
    }

    /// <summary>
    /// Change a configuration option value for the database.
    /// </summary>
    /// <param name="option">
    /// The database configuration option to change.
    /// </param>
    /// <param name="value">
    /// The new value for the specified configuration option.
    /// </param>
    public void SetConfigurationOption(
        SQLiteConfigDbOpsEnum option,
        object value
        )
    {
        CheckDisposed();

        if (_sql == null)
        {
            throw new InvalidOperationException(
                "Database connection not valid for changing a configuration option.");
        }

        if ((option == SQLiteConfigDbOpsEnum.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION) &&
            HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.NoLoadExtension))
        {
            throw new SQLiteException("Loading extensions is disabled for this database connection.");
        }

        SQLiteErrorCode rc = _sql.SetConfigurationOption(option, value);

        if (rc != SQLiteErrorCode.Ok)
            throw new SQLiteException(rc, null);
    }

    /// <summary>
    /// Enables or disables extension loading.
    /// </summary>
    /// <param name="enable">
    /// True to enable loading of extensions, false to disable.
    /// </param>
    public void EnableExtensions(
        bool enable
        )
    {
        CheckDisposed();

        if (_sql == null)
            throw new InvalidOperationException(HelperMethods.StringFormat(
                CultureInfo.CurrentCulture,
                "Database connection not valid for {0} extensions.",
                enable ? "enabling" : "disabling"));

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.NoLoadExtension))
            throw new SQLiteException("Loading extensions is disabled for this database connection.");

        _sql.SetLoadExtension(enable);
    }

    /// <summary>
    /// Loads a SQLite extension library from the named dynamic link library file.
    /// </summary>
    /// <param name="fileName">
    /// The name of the dynamic link library file containing the extension.
    /// </param>
    public void LoadExtension(
        string fileName
        )
    {
        CheckDisposed();

        LoadExtension(fileName, null);
    }

    /// <summary>
    /// Loads a SQLite extension library from the named dynamic link library file.
    /// </summary>
    /// <param name="fileName">
    /// The name of the dynamic link library file containing the extension.
    /// </param>
    /// <param name="procName">
    /// The name of the exported function used to initialize the extension.
    /// If null, the default "sqlite3_extension_init" will be used.
    /// </param>
    public void LoadExtension(
        string fileName,
        string procName
        )
    {
        CheckDisposed();

        if (_sql == null)
            throw new InvalidOperationException(
                "Database connection not valid for loading extensions.");

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.NoLoadExtension))
            throw new SQLiteException("Loading extensions is disabled for this database connection.");

        _sql.LoadExtension(fileName, procName);
    }

#if INTEROP_VIRTUAL_TABLE
    /// <summary>
    /// Creates a disposable module containing the implementation of a virtual
    /// table.
    /// </summary>
    /// <param name="module">
    /// The module object to be used when creating the disposable module.
    /// </param>
    public void CreateModule(
        SQLiteModule module
        )
    {
        CheckDisposed();

        if (_sql == null)
            throw new InvalidOperationException(
                "Database connection not valid for creating modules.");

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.NoCreateModule))
            throw new SQLiteException("Creating modules is disabled for this database connection.");

        _sql.CreateModule(module, _flags);
    }
#endif

    /// <summary>
    /// Parses a string containing a sequence of zero or more hexadecimal
    /// encoded byte values and returns the resulting byte array.  The
    /// "0x" prefix is not allowed on the input string.
    /// </summary>
    /// <param name="text">
    /// The input string containing zero or more hexadecimal encoded byte
    /// values.
    /// </param>
    /// <returns>
    /// A byte array containing the parsed byte values or null if an error
    /// was encountered.
    /// </returns>
    internal static byte[] FromHexString(
        string text
        )
    {
        string error = null;

        return FromHexString(text, true, ref error);
    }

    /// <summary>
    /// Creates and returns a string containing the hexadecimal encoded byte
    /// values from the input array.
    /// </summary>
    /// <param name="array">
    /// The input array of bytes.
    /// </param>
    /// <returns>
    /// The resulting string or null upon failure.
    /// </returns>
    internal static string ToHexString(
        byte[] array
        )
    {
        if (array == null)
            return null;

        StringBuilder result = new StringBuilder();

        int length = array.Length;

        for (int index = 0; index < length; index++)
#if NET_COMPACT_20
            result.Append(HelperMethods.StringFormat(
                CultureInfo.InvariantCulture,
                "{0:x2}", array[index]));
#else
            result.AppendFormat("{0:x2}", array[index]);
#endif

        return result.ToString();
    }

    /// <summary>
    /// Parses a string containing a sequence of zero or more hexadecimal
    /// encoded byte values and returns the resulting byte array.  The
    /// "0x" prefix is not allowed on the input string.
    /// </summary>
    /// <param name="text">
    /// The input string containing zero or more hexadecimal encoded byte
    /// values.
    /// </param>
    /// <param name="allowNul">
    /// When zero, byte values of zero are not allowed and will be changed
    /// to <see cref="Byte.MaxValue" /> instead.
    /// </param>
    /// <param name="error">
    /// Upon failure, this will contain an appropriate error message.
    /// </param>
    /// <returns>
    /// A byte array containing the parsed byte values or null if an error
    /// was encountered.
    /// </returns>
    private static byte[] FromHexString(
        string text,
        bool allowNul,
        ref string error
        )
    {
        if (text == null)
        {
            error = "string is null";
            return null;
        }

        int length = text.Length;

        if (length == 0)
            return new byte[0];

        int startIndex = text.IndexOf(':');

        if (startIndex != -1)
            startIndex++;
        else
            startIndex = 0;

        if ((length - startIndex) % 2 != 0)
        {
            error = "string contains an odd number of characters";
            return null;
        }

        byte[] result = new byte[((length - startIndex) / 2) + startIndex];
        int outIndex = 0;

        if (startIndex > 0)
        {
            for (int index = 0; index < startIndex; index++)
            {
                result[outIndex++] = (byte)(text[index] & byte.MaxValue);
            }
        }

        for (int index = startIndex; index < length; index += 2)
        {
            string value = text.Substring(index, 2);

            if (!TryParseByte(value,
                    NumberStyles.HexNumber, out result[outIndex]))
            {
                error = HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "string contains \"{0}\", which cannot be converted to a byte value",
                    value);

                return null;
            }

            if (!allowNul && (result[outIndex] == 0))
                result[outIndex] = byte.MaxValue;

            outIndex++;
        }

        return result;
    }

    /// <summary>
    /// This method figures out what the default connection pool setting should
    /// be based on the connection flags.  When present, the "Pooling" connection
    /// string property value always overrides the value returned by this method.
    /// </summary>
    /// <returns>
    /// Non-zero if the connection pool should be enabled by default; otherwise,
    /// zero.
    /// </returns>
    private bool GetDefaultPooling()
    {
        bool result = DefaultPooling;

        if (result) /* NOTE: True branch not reached in the default build. */
        {
            if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.NoConnectionPool))
                result = false;

            if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionPool))
                result = true;
        }
        else
        {
            if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionPool))
                result = true;

            if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.NoConnectionPool))
                result = false;
        }

        return result;
    }

    /// <summary>
    /// Determines the transaction isolation level that should be used by
    /// the caller, primarily based upon the one specified by the caller.
    /// If mapping of transaction isolation levels is enabled, the returned
    /// transaction isolation level may be significantly different than the
    /// originally specified one.
    /// </summary>
    /// <param name="isolationLevel">
    /// The originally specified transaction isolation level.
    /// </param>
    /// <returns>
    /// The transaction isolation level that should be used.
    /// </returns>
    private IsolationLevel GetEffectiveIsolationLevel(
        IsolationLevel isolationLevel
        )
    {
        if (!HelperMethods.HasFlags(
                _flags, SQLiteConnectionFlags.MapIsolationLevels))
        {
            return isolationLevel;
        }

        switch (isolationLevel)
        {
            case IsolationLevel.Unspecified:
            case IsolationLevel.Chaos:
            case IsolationLevel.ReadUncommitted:
            case IsolationLevel.ReadCommitted:
                return DeferredIsolationLevel;
            case IsolationLevel.RepeatableRead:
            case IsolationLevel.Serializable:
            case IsolationLevel.Snapshot:
                return ImmediateIsolationLevel;
            default:
                return GetFallbackDefaultIsolationLevel();
        }
    }

    /// <summary>
    /// Opens the connection using the parameters found in the <see cref="ConnectionString" />.
    /// </summary>
    public override void Open()
    {
      CheckDisposed();

      _lastConnectionInOpen = this; /* THREAD-SAFE: per-thread datum. */

      OnChanged(this, new ConnectionEventArgs(
          SQLiteConnectionEventType.Opening, null, null, null, null, null,
          null, null));

      if (_connectionState != ConnectionState.Closed)
        throw new InvalidOperationException();

      Close();

      ConnectionEventArgs previewEventArgs = new ConnectionEventArgs(
          SQLiteConnectionEventType.ConnectionStringPreview,
          null, null, null, null, null, null, null, null);

      previewEventArgs.Result = _connectionString;
      OnChanged(this, previewEventArgs);
      _connectionString = previewEventArgs.Result;

      SortedList<string, string> opts = ParseConnectionString(
          this, _connectionString, _parseViaFramework, false, false);

      string stringValue;
      object enumValue;

      stringValue = FindKey(opts, "Flags", null);

      if (stringValue != null)
          enumValue = TryParseEnum(typeof(SQLiteConnectionFlags), stringValue, true);
      else
          enumValue = null;

      //
      // BUGFIX: Always preserve the pre-existing instance flags.  This is OK
      //         because when the connection object is initially created, they
      //         are "None"; therefore, OR-ing the connection string property
      //         flags with the instance flags would produce exactly the same
      //         result.  If the "Flags" connection string property is absent,
      //         OR-ing the the instance flags with the static DefaultFlags is
      //         done instead.  This is OK for the same reason as before: when
      //         the connection object is initially created, they are "None"
      //         by default.  If they are different now, they must have been
      //         manually set by the application.
      //
      bool noDefaultFlags = SQLiteConvert.ToBoolean(FindKey(opts, "NoDefaultFlags", DefaultNoDefaultFlags.ToString()));

      if (enumValue is SQLiteConnectionFlags)
          _flags |= (SQLiteConnectionFlags)enumValue;
      else if (!noDefaultFlags)
          _flags |= DefaultFlags;

      bool noSharedFlags = SQLiteConvert.ToBoolean(FindKey(opts, "NoSharedFlags", DefaultNoSharedFlags.ToString()));
      if (!noSharedFlags) { lock (_syncRoot) { _flags |= _sharedFlags; } }

#if INTEROP_CODEC || INTEROP_INCLUDE_SEE
      bool hidePassword = HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.HidePassword);
#endif

      SortedList<string, string> eventArgOpts = opts;
      string eventArgConnectionString = _connectionString;

#if INTEROP_CODEC || INTEROP_INCLUDE_SEE
      if (hidePassword)
      {
          eventArgOpts = new SortedList<string, string>(
              StringComparer.OrdinalIgnoreCase);

          foreach (KeyValuePair<string, string> pair in opts)
          {
              if (String.Equals(
                    pair.Key, "Password",
                    StringComparison.OrdinalIgnoreCase))
              {
                  continue;
              }

              if (String.Equals(
                    pair.Key, "HexPassword",
                    StringComparison.OrdinalIgnoreCase))
              {
                  continue;
              }

              if (String.Equals(
                    pair.Key, "TextPassword",
                    StringComparison.OrdinalIgnoreCase))
              {
                  continue;
              }

              if (String.Equals(
                    pair.Key, "TextHexPassword",
                    StringComparison.OrdinalIgnoreCase))
              {
                  continue;
              }

              eventArgOpts.Add(pair.Key, pair.Value);
          }

          eventArgConnectionString = BuildConnectionString(
              eventArgOpts);
      }
#endif

      OnChanged(this, new ConnectionEventArgs(
          SQLiteConnectionEventType.ConnectionString, null, null, null, null,
          null, eventArgConnectionString, new object[] { eventArgOpts }));

      stringValue = FindKey(opts, "DefaultDbType", null);

      if (stringValue != null)
      {
          enumValue = TryParseEnum(typeof(DbType), stringValue, true);
          _defaultDbType = (enumValue is DbType) ? (DbType)enumValue : (DbType?)null;
      }

      //
      // NOTE: Nullable values types are not supported by the .NET Framework
      //       ADO.NET support components that work with the connection string
      //       builder; therefore, translate the "invalid value" used by the
      //       SQLiteConnectionStringBuilder.DefaultDbType property to null
      //       here.
      //
      if ((_defaultDbType != null) && ((DbType)_defaultDbType == BadDbType))
        _defaultDbType = null;

      stringValue = FindKey(opts, "DefaultTypeName", null);

      if (stringValue != null)
        _defaultTypeName = stringValue;

#if !NET_COMPACT_20 && TRACE_WARNING
      bool uri = false;
#endif
      bool fullUri = false;
      string fileName;

      if (Convert.ToInt32(FindKey(opts, "Version", SQLiteConvert.ToString(DefaultVersion)), CultureInfo.InvariantCulture) != DefaultVersion)
        throw new NotSupportedException(HelperMethods.StringFormat(CultureInfo.CurrentCulture, "Only SQLite Version {0} is supported at this time", DefaultVersion));

#if INTEROP_INCLUDE_ZIPVFS
      bool useZipVfs = false;
      string zipVfsVersion = FindKey(opts, "ZipVfsVersion", DefaultZipVfsVersion);

      if (zipVfsVersion != null)
      {
          if (String.Compare(zipVfsVersion, ZipVfs_Automatic) == 0)
          {
              useZipVfs = true;
          }
          else if (String.Compare(zipVfsVersion, ZipVfs_V2) == 0)
          {
              UnsafeNativeMethods.zipvfsInit_v2();
              useZipVfs = true;
          }
          else if (String.Compare(zipVfsVersion, ZipVfs_V3) == 0)
          {
              UnsafeNativeMethods.zipvfsInit_v3(0);
              useZipVfs = true;
          }
          else
          {
              throw new NotSupportedException(HelperMethods.StringFormat(
                  CultureInfo.CurrentCulture, "Only ZipVFS versions {0}, {1}, and {2} are supported at this time",
                  ZipVfs_Automatic, ZipVfs_V2, ZipVfs_V3));
          }
      }
#endif

      fileName = FindKey(opts, "Data Source", DefaultDataSource);

      if (String.IsNullOrEmpty(fileName))
      {
        fileName = FindKey(opts, "Uri", DefaultUri);
        if (String.IsNullOrEmpty(fileName))
        {
          fileName = FindKey(opts, "FullUri", DefaultFullUri);
          if (String.IsNullOrEmpty(fileName))
            throw new ArgumentException(HelperMethods.StringFormat(CultureInfo.CurrentCulture, "Data Source cannot be empty.  Use {0} to open an in-memory database", MemoryFileName));
          else
            fullUri = true;
        }
        else
        {
          fileName = MapUriPath(fileName);
#if !NET_COMPACT_20 && TRACE_WARNING
          uri = true;
#endif
        }
      }

      bool isMemory = (String.Compare(fileName, MemoryFileName, StringComparison.OrdinalIgnoreCase) == 0);

#if !NET_COMPACT_20 && TRACE_WARNING
      if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.TraceWarning))
      {
          if (!uri && !fullUri && !isMemory && !String.IsNullOrEmpty(fileName) &&
              fileName.StartsWith("\\", StringComparison.OrdinalIgnoreCase) &&
              !fileName.StartsWith("\\\\", StringComparison.OrdinalIgnoreCase))
          {
              System.Diagnostics.Trace.WriteLine(HelperMethods.StringFormat(
                  CultureInfo.CurrentCulture,
                  "WARNING: Detected a possibly malformed UNC database file name \"{0}\" that " +
                  "may have originally started with two backslashes; however, four leading " +
                  "backslashes may be required, e.g.: \"Data Source=\\\\\\{0};\"",
                  fileName));
          }
      }
#endif

      if (!fullUri)
      {
        if (isMemory)
          fileName = MemoryFileName;
        else
        {
#if PLATFORM_COMPACTFRAMEWORK
          if (fileName.StartsWith("./") || fileName.StartsWith(".\\"))
            fileName = Path.GetDirectoryName(Assembly.GetCallingAssembly().GetName().CodeBase) + fileName.Substring(1);
#endif
          bool toFullPath = SQLiteConvert.ToBoolean(FindKey(opts, "ToFullPath", DefaultToFullPath.ToString()));
          fileName = ExpandFileName(fileName, toFullPath);
        }
      }

      try
      {
        bool usePooling = SQLiteConvert.ToBoolean(FindKey(opts, "Pooling", GetDefaultPooling().ToString()));

        int maxPoolSize = Convert.ToInt32(FindKey(opts, "Max Pool Size", SQLiteConvert.ToString(DefaultMaxPoolSize)), CultureInfo.InvariantCulture);

        stringValue = FindKey(opts, "Default Timeout", null);

        if (stringValue != null)
            _defaultTimeout = Convert.ToInt32(stringValue, CultureInfo.InvariantCulture);

        stringValue = FindKey(opts, "DefaultMaximumSleepTime", null);

        if (stringValue != null)
            _defaultMaximumSleepTime = Convert.ToInt32(stringValue, CultureInfo.InvariantCulture);

        stringValue = FindKey(opts, "BusyTimeout", null);

        if (stringValue != null)
            _busyTimeout = Convert.ToInt32(stringValue, CultureInfo.InvariantCulture);

#if !PLATFORM_COMPACTFRAMEWORK
        stringValue = FindKey(opts, "WaitTimeout", null);

        if (stringValue != null)
            _waitTimeout = Convert.ToInt32(stringValue, CultureInfo.InvariantCulture);
#endif

        stringValue = FindKey(opts, "PrepareRetries", null);

        if (stringValue != null)
            _prepareRetries = Convert.ToInt32(stringValue, CultureInfo.InvariantCulture);

        stringValue = FindKey(opts, "StepRetries", null);

        if (stringValue != null)
            _stepRetries = Convert.ToInt32(stringValue, CultureInfo.InvariantCulture);

        stringValue = FindKey(opts, "ProgressOps", null);

        if (stringValue != null)
            _progressOps = Convert.ToInt32(stringValue, CultureInfo.InvariantCulture);

        stringValue = FindKey(opts, "Default IsolationLevel", null);

        if (stringValue != null)
        {
            enumValue = TryParseEnum(typeof(IsolationLevel), stringValue, true);
            _defaultIsolation = (enumValue is IsolationLevel) ? (IsolationLevel)enumValue : DefaultIsolationLevel;
        }

        IsolationLevel isolationLevel = GetEffectiveIsolationLevel(_defaultIsolation);

        if (isolationLevel != ImmediateIsolationLevel && isolationLevel != DeferredIsolationLevel)
            throw new NotSupportedException("Invalid Default IsolationLevel specified");

        stringValue = FindKey(opts, "BaseSchemaName", null);

        if (stringValue != null)
            _baseSchemaName = stringValue;

        if (_sql == null)
        {
            SetupSQLiteBase(opts);
        }

        stringValue = FindKey(opts, "VfsName", null);

        string vfsName = (stringValue != null) ? vfsName = stringValue : vfsName = _vfsName;
        SQLiteOpenFlagsEnum flags = SQLiteOpenFlagsEnum.None;

        if (!SQLiteConvert.ToBoolean(FindKey(opts, "FailIfMissing", DefaultFailIfMissing.ToString())))
          flags |= SQLiteOpenFlagsEnum.Create;

        if (SQLiteConvert.ToBoolean(FindKey(opts, "Read Only", DefaultReadOnly.ToString())))
        {
          flags |= SQLiteOpenFlagsEnum.ReadOnly;
          // SQLite will return SQLITE_MISUSE on ReadOnly and Create
          flags &= ~SQLiteOpenFlagsEnum.Create;
        }
        else

        {
          flags |= SQLiteOpenFlagsEnum.ReadWrite;
        }

        if (fullUri)
            flags |= SQLiteOpenFlagsEnum.Uri;

        _sql.Open(fileName, vfsName, _flags, flags, maxPoolSize, usePooling);

        stringValue = FindKey(opts, "BinaryGUID", null);

        if (stringValue != null)
            _binaryGuid = SQLiteConvert.ToBoolean(stringValue);

#if INTEROP_CODEC || INTEROP_INCLUDE_SEE
        string error; /* REUSED */
        string textHexPassword = FindKey(opts, "TextHexPassword", DefaultTextHexPassword);

        if (textHexPassword != null)
        {
            byte[] textHexPasswordBytes;

            error = null;
            textHexPasswordBytes = FromHexString(textHexPassword, false, ref error);

            if (textHexPasswordBytes == null)
            {
                throw new FormatException(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "Cannot parse 'TextHexPassword' property value into byte values: {0}",
                    error));
            }

            Array.Resize(ref textHexPasswordBytes, textHexPasswordBytes.Length + 1);

            _sql.SetPassword(textHexPasswordBytes, true);
            _passwordWasText = true;
            _passwordWasHex = true;
        }
        else
        {
            string textPassword = FindKey(opts, "TextPassword", DefaultTextPassword);

            if (textPassword != null)
            {
                byte[] textPasswordBytes = UTF8Encoding.UTF8.GetBytes(
                    textPassword); /* throw */

                Array.Resize(ref textPasswordBytes, textPasswordBytes.Length + 1);

                _sql.SetPassword(textPasswordBytes, true);
                _passwordWasText = true;
                _passwordWasHex = false;
            }
            else
            {
                string hexPassword = FindKey(opts, "HexPassword", DefaultHexPassword);

                if (hexPassword != null)
                {
                    byte[] hexPasswordBytes;

                    error = null;
                    hexPasswordBytes = FromHexString(hexPassword, true, ref error);

                    if (hexPasswordBytes == null)
                    {
                        throw new FormatException(HelperMethods.StringFormat(
                            CultureInfo.CurrentCulture,
                            "Cannot parse 'HexPassword' property value into byte values: {0}",
                            error));
                    }

                    _sql.SetPassword(hexPasswordBytes, false);
                    _passwordWasText = false;
                    _passwordWasHex = true;
                }
                else
                {
                    string password = FindKey(opts, "Password", DefaultPassword);

                    if (password != null)
                    {
                        byte[] passwordBytes = UTF8Encoding.UTF8.GetBytes(
                            password); /* throw */

                        _sql.SetPassword(passwordBytes, false);
                        _passwordWasText = false;
                        _passwordWasHex = false;
                    }
                    else if (_password != null)
                    {
                        _sql.SetPassword(_password, _passwordWasText);
                    }

                    password = null; /* IMMUTABLE */
                }

                hexPassword = null; /* IMMUTABLE */
            }
        }

        _password = null; /* IMMUTABLE */

        if (hidePassword)
        {
            if (opts.ContainsKey("TextHexPassword"))
                opts["TextHexPassword"] = String.Empty;

            if (opts.ContainsKey("TextPassword"))
                opts["TextPassword"] = String.Empty;

            if (opts.ContainsKey("HexPassword"))
                opts["HexPassword"] = String.Empty;

            if (opts.ContainsKey("Password"))
                opts["Password"] = String.Empty;

            _connectionString = BuildConnectionString(opts);
        }
#else
        if (FindKey(opts, "TextHexPassword", null) != null)
        {
            throw new SQLiteException(SQLiteErrorCode.Error,
                "Cannot use \"TextHexPassword\" connection string property: " +
                "library was not built with encryption support, please " +
                "see \"https://www.sqlite.org/see\" for more information");
        }

        if (FindKey(opts, "TextPassword", null) != null)
        {
            throw new SQLiteException(SQLiteErrorCode.Error,
                "Cannot use \"TextPassword\" connection string property: " +
                "library was not built with encryption support, please " +
                "see \"https://www.sqlite.org/see\" for more information");
        }

        if (FindKey(opts, "HexPassword", null) != null)
        {
            throw new SQLiteException(SQLiteErrorCode.Error,
                "Cannot use \"HexPassword\" connection string property: " +
                "library was not built with encryption support, please " +
                "see \"https://www.sqlite.org/see\" for more information");
        }

        if (FindKey(opts, "Password", null) != null)
        {
            throw new SQLiteException(SQLiteErrorCode.Error,
                "Cannot use \"Password\" connection string property: " +
                "library was not built with encryption support, please " +
                "see \"https://www.sqlite.org/see\" for more information");
        }
#endif

        if (!fullUri)
          _dataSource = Path.GetFileNameWithoutExtension(fileName);
        else
          _dataSource = fileName;

        _version++;

        ConnectionState oldstate = _connectionState;
        _connectionState = ConnectionState.Open;

        try
        {
          bool boolValue;

          stringValue = FindKey(opts, "SetDefaults", null);

          if (stringValue != null)
              boolValue = SQLiteConvert.ToBoolean(stringValue);
          else
              boolValue = DefaultSetDefaults;

          if (boolValue)
          {
              using (SQLiteCommand cmd = CreateCommand())
              {
                  if (_busyTimeout != DefaultBusyTimeout)
                  {
                      cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA busy_timeout={0}", _busyTimeout);
                      cmd.ExecuteNonQuery();
                  }

                  int intValue;

                  if (!fullUri && !isMemory)
                  {
                      stringValue = FindKey(opts, "Page Size", null);
                      if (stringValue != null)
                      {
                          intValue = Convert.ToInt32(stringValue, CultureInfo.InvariantCulture);
                          if (intValue != DefaultPageSize)
                          {
                              cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA page_size={0}", intValue);
                              cmd.ExecuteNonQuery();
                          }
                      }
                  }

                  stringValue = FindKey(opts, "Max Page Count", null);
                  if (stringValue != null)
                  {
                      intValue = Convert.ToInt32(stringValue, CultureInfo.InvariantCulture);
                      if (intValue != DefaultMaxPageCount)
                      {
                          cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA max_page_count={0}", intValue);
                          cmd.ExecuteNonQuery();
                      }
                  }

                  stringValue = FindKey(opts, "Legacy Format", null);
                  if (stringValue != null)
                  {
                      boolValue = SQLiteConvert.ToBoolean(stringValue);
                      if (boolValue != DefaultLegacyFormat)
                      {
                          cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA legacy_file_format={0}", boolValue ? "ON" : "OFF");
                          cmd.ExecuteNonQuery();
                      }
                  }

                  stringValue = FindKey(opts, "Synchronous", null);
                  if (stringValue != null)
                  {
                      enumValue = TryParseEnum(typeof(SQLiteSynchronousEnum), stringValue, true);
                      if (!(enumValue is SQLiteSynchronousEnum) ||
                          ((SQLiteSynchronousEnum)enumValue != DefaultSynchronous))
                      {
                          cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA synchronous={0}", stringValue);
                          cmd.ExecuteNonQuery();
                      }
                  }

                  stringValue = FindKey(opts, "Cache Size", null);
                  if (stringValue != null)
                  {
                      intValue = Convert.ToInt32(stringValue, CultureInfo.InvariantCulture);
                      if (intValue != DefaultCacheSize)
                      {
                          cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA cache_size={0}", intValue);
                          cmd.ExecuteNonQuery();
                      }
                  }

                  stringValue = FindKey(opts, "Journal Mode", null);
                  if (stringValue != null)
                  {
                      enumValue = TryParseEnum(typeof(SQLiteJournalModeEnum), stringValue, true);
                      if (!(enumValue is SQLiteJournalModeEnum) ||
                          ((SQLiteJournalModeEnum)enumValue != DefaultJournalMode))
                      {
                          string pragmaStr = "PRAGMA journal_mode={0}";

#if INTEROP_INCLUDE_ZIPVFS
                          if (useZipVfs)
                              pragmaStr = "PRAGMA zipvfs_journal_mode={0}";
#endif

                          cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, pragmaStr, stringValue);
                          cmd.ExecuteNonQuery();
                      }
                  }

                  stringValue = FindKey(opts, "Foreign Keys", null);
                  if (stringValue != null)
                  {
                      boolValue = SQLiteConvert.ToBoolean(stringValue);

                      if (boolValue != DefaultForeignKeys)
                      {
                          cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA foreign_keys={0}", boolValue ? "ON" : "OFF");
                          cmd.ExecuteNonQuery();
                      }
                  }

                  stringValue = FindKey(opts, "Recursive Triggers", null);
                  if (stringValue != null)
                  {
                      boolValue = SQLiteConvert.ToBoolean(stringValue);
                      if (boolValue != DefaultRecursiveTriggers)
                      {
                          cmd.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA recursive_triggers={0}", boolValue ? "ON" : "OFF");
                          cmd.ExecuteNonQuery();
                      }
                  }
              }
          }

          if (_busyHandler != null)
              _sql.SetBusyHook(_busyCallback);

          if (_progressHandler != null)
              _sql.SetProgressHook(_progressOps, _progressCallback);

          if (_authorizerHandler != null)
              _sql.SetAuthorizerHook(_authorizerCallback);

          if (_commitHandler != null)
            _sql.SetCommitHook(_commitCallback);

          if (_updateHandler != null)
            _sql.SetUpdateHook(_updateCallback);

          if (_rollbackHandler != null)
            _sql.SetRollbackHook(_rollbackCallback);

#if !PLATFORM_COMPACTFRAMEWORK
          System.Transactions.Transaction transaction = Transactions.Transaction.Current;

          if (transaction != null &&
              SQLiteConvert.ToBoolean(FindKey(opts, "Enlist", DefaultEnlist.ToString())))
          {
              EnlistTransaction(transaction);
          }
#endif

          _connectionState = oldstate;

          StateChangeEventArgs eventArgs = null;
          OnStateChange(ConnectionState.Open, ref eventArgs);

          OnChanged(this, new ConnectionEventArgs(
              SQLiteConnectionEventType.Opened, eventArgs, null, null, null,
              null, eventArgConnectionString, new object[] { eventArgOpts }));

#if DEBUG
          _debugString = HelperMethods.StringFormat(
              CultureInfo.InvariantCulture,
              "openThreadId = {0}, connectionString = {1}",
              HelperMethods.GetThreadId(),
              eventArgConnectionString);
#endif
        }
        catch
        {
          _connectionState = oldstate;
          throw;
        }
      }
      catch (Exception) /* NOTE: Must catch ALL. */
      {
        Close();
        throw;
      }
    }

    /// <summary>
    /// Opens the connection using the parameters found in the <see cref="ConnectionString" /> and then returns it.
    /// </summary>
    /// <returns>The current connection object.</returns>
    public SQLiteConnection OpenAndReturn()
    {
        CheckDisposed(); Open(); return this;
    }

    /// <summary>
    /// Gets/sets the default command timeout for newly-created commands.  This is especially useful for
    /// commands used internally such as inside a SQLiteTransaction, where setting the timeout is not possible.
    /// This can also be set in the ConnectionString with "Default Timeout"
    /// </summary>
    public int DefaultTimeout
    {
      get { CheckDisposed(); return _defaultTimeout; }
      set { CheckDisposed(); _defaultTimeout = value; }
    }

    /// <summary>
    /// Gets/sets the default maximum sleep time for newly-created commands.
    /// This can also be set in the ConnectionString with "DefaultMaximumSleepTime"
    /// </summary>
    public int DefaultMaximumSleepTime
    {
        get { CheckDisposed(); return _defaultMaximumSleepTime; }
        set { CheckDisposed(); _defaultMaximumSleepTime = value; }
    }

    /// <summary>
    /// Gets/sets the default busy timeout to use with the SQLite core library.  This is only used when
    /// opening a connection.
    /// </summary>
    public int BusyTimeout
    {
        get { CheckDisposed(); return _busyTimeout; }
        set { CheckDisposed(); _busyTimeout = value; }
    }

#if !PLATFORM_COMPACTFRAMEWORK
    /// <summary>
    /// <b>EXPERIMENTAL</b> --
    /// The wait timeout to use with <see cref="WaitForEnlistmentReset" /> method.
    /// This is only used when waiting for the enlistment to be reset prior to
    /// enlisting in a transaction, and then only when the appropriate connection
    /// flag is set.
    /// </summary>
    public int WaitTimeout
    {
        get { CheckDisposed(); return _waitTimeout; }
        set { CheckDisposed(); _waitTimeout = value; }
    }
#endif

    /// <summary>
    /// The maximum number of retries when preparing SQL to be executed.  This
    /// normally only applies to preparation errors resulting from the database
    /// schema being changed.
    /// </summary>
    public int PrepareRetries
    {
        get { CheckDisposed(); return _prepareRetries; }
        set { CheckDisposed(); _prepareRetries = value; }
    }

    /// <summary>
    /// The maximum number of retries when stepping SQL to be executed.  This
    /// normally only applies to stepping errors resulting from the database
    /// being locked.
    /// </summary>
    public int StepRetries
    {
        get { CheckDisposed(); return _stepRetries; }
        set { CheckDisposed(); _stepRetries = value; }
    }

    /// <summary>
    /// The approximate number of virtual machine instructions between progress
    /// events.  In order for progress events to actually fire, the event handler
    /// must be added to the <see cref="SQLiteConnection.Progress" /> event as
    /// well.  This value will only be used when the underlying native progress
    /// callback needs to be changed.
    /// </summary>
    public int ProgressOps
    {
        get { CheckDisposed(); return _progressOps; }
        set { CheckDisposed(); _progressOps = value; }
    }

    /// <summary>
    /// Non-zero if the built-in (i.e. framework provided) connection string
    /// parser should be used when opening the connection.
    /// </summary>
    public bool ParseViaFramework
    {
        get { CheckDisposed(); return _parseViaFramework; }
        set { CheckDisposed(); _parseViaFramework = value; }
    }

    /// <summary>
    /// Gets/sets the extra behavioral flags for this connection.  See the
    /// <see cref="SQLiteConnectionFlags" /> enumeration for a list of
    /// possible values.
    /// </summary>
    public SQLiteConnectionFlags Flags
    {
      get { CheckDisposed(); return _flags; }
      set { CheckDisposed(); _flags = value; }
    }

    /// <summary>
    /// Gets/sets the default database type for this connection.  This value
    /// will only be used when not null.
    /// </summary>
    public DbType? DefaultDbType
    {
      get { CheckDisposed(); return _defaultDbType; }
      set { CheckDisposed(); _defaultDbType = value; }
    }

    /// <summary>
    /// Gets/sets the default database type name for this connection.  This
    /// value will only be used when not null.
    /// </summary>
    public string DefaultTypeName
    {
      get { CheckDisposed(); return _defaultTypeName; }
      set { CheckDisposed(); _defaultTypeName = value; }
    }

    /// <summary>
    /// Gets/sets the VFS name for this connection.  This value will only be
    /// used when opening the database.
    /// </summary>
    public string VfsName
    {
      get { CheckDisposed(); return _vfsName; }
      set { CheckDisposed(); _vfsName = value; }
    }

    /// <summary>
    /// Returns non-zero if the underlying native connection handle is
    /// owned by this instance.
    /// </summary>
    public bool OwnHandle
    {
        get
        {
            CheckDisposed();

            if (_sql == null)
                throw new InvalidOperationException("Database connection not valid for checking handle.");

            return _sql.OwnHandle;
        }
    }

    /// <summary>
    /// Returns the version of the underlying SQLite database engine
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#endif
    public override string ServerVersion
    {
      get
      {
        CheckDisposed();
        return SQLiteVersion;
        //if (_connectionState != ConnectionState.Open)
        //  throw new InvalidOperationException();

        //return _sql.Version;
      }
    }

    /// <summary>
    /// Returns the rowid of the most recent successful INSERT into the database from this connection.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#endif
    public long LastInsertRowId
    {
      get
      {
        CheckDisposed();

        if (_sql == null)
          throw new InvalidOperationException("Database connection not valid for getting last insert rowid.");

        return _sql.LastInsertRowId;
      }
    }

    /// <summary>
    /// This method causes any pending database operation to abort and return at
    /// its earliest opportunity.  This routine is typically called in response
    /// to a user action such as pressing "Cancel" or Ctrl-C where the user wants
    /// a long query operation to halt immediately.  It is safe to call this
    /// routine from any thread.  However, it is not safe to call this routine
    /// with a database connection that is closed or might close before this method
    /// returns.
    /// </summary>
    public void Cancel()
    {
        CheckDisposed();

        if (_sql == null)
            throw new InvalidOperationException("Database connection not valid for query cancellation.");

        _sql.Cancel(); /* throw */

        OnChanged(this, new ConnectionEventArgs(
            SQLiteConnectionEventType.Canceled,
            null, null, null, null, null, null, null));
    }

    /// <summary>
    /// This method checks if the database operation for this connection has been
    /// interrupted.
    /// </summary>
    /// <returns>
    /// Non-zero if the database operation for this connection has been interrupted;
    /// otherwise, zero.
    /// </returns>
    public bool IsCanceled()
    {
        CheckDisposed();

        if (_sql == null)
            throw new InvalidOperationException("Database connection not valid for checking cancellation.");

        return _sql.IsCanceled(); /* throw */
    }

    /// <summary>
    /// Returns the number of rows changed by the last INSERT, UPDATE, or DELETE statement executed on
    /// this connection.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#endif
    public int Changes
    {
      get
      {
        CheckDisposed();

        if (_sql == null)
          throw new InvalidOperationException("Database connection not valid for getting number of changes.");

        return _sql.Changes;
      }
    }

    /// <summary>
    /// Checks if this connection to the specified database should be considered
    /// read-only.  An exception will be thrown if the database name specified
    /// via <paramref name="name" /> cannot be found.
    /// </summary>
    /// <param name="name">
    /// The name of a database associated with this connection -OR- null for the
    /// main database.
    /// </param>
    /// <returns>
    /// Non-zero if this connection to the specified database should be considered
    /// read-only.
    /// </returns>
    public bool IsReadOnly(
        string name
        )
    {
        CheckDisposed();

        if (_sql == null)
            throw new InvalidOperationException("Database connection not valid for checking read-only status.");

        return _sql.IsReadOnly(name);
    }

    /// <summary>
    /// Returns non-zero if the given database connection is in autocommit mode.
    /// Autocommit mode is on by default.  Autocommit mode is disabled by a BEGIN
    /// statement.  Autocommit mode is re-enabled by a COMMIT or ROLLBACK.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#endif
    public bool AutoCommit
    {
        get
        {
            CheckDisposed();

            if (_sql == null)
                throw new InvalidOperationException("Database connection not valid for getting autocommit mode.");

            return _sql.AutoCommit;
        }
    }

    /// <summary>
    /// Returns the amount of memory (in bytes) currently in use by the SQLite core library.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#endif
    public long MemoryUsed
    {
      get
      {
        CheckDisposed();

        if (_sql == null)
          throw new InvalidOperationException("Database connection not valid for getting memory used.");

        return _sql.MemoryUsed;
      }
    }

    /// <summary>
    /// Returns the maximum amount of memory (in bytes) used by the SQLite core library since the high-water mark was last reset.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#endif
    public long MemoryHighwater
    {
      get
      {
        CheckDisposed();

        if (_sql == null)
          throw new InvalidOperationException("Database connection not valid for getting maximum memory used.");

          return _sql.MemoryHighwater;
      }
    }

    /// <summary>
    /// Returns various global memory statistics for the SQLite core library via
    /// a dictionary of key/value pairs.  Currently, only the "MemoryUsed" and
    /// "MemoryHighwater" keys are returned and they have values that correspond
    /// to the values that could be obtained via the <see cref="MemoryUsed" />
    /// and <see cref="MemoryHighwater" /> connection properties.
    /// </summary>
    /// <param name="statistics">
    /// This dictionary will be populated with the global memory statistics.  It
    /// will be created if necessary.
    /// </param>
    public static void GetMemoryStatistics(
        ref IDictionary<string, long> statistics
        )
    {
        if (statistics == null)
            statistics = new Dictionary<string, long>();

        statistics["MemoryUsed"] = SQLite3.StaticMemoryUsed;
        statistics["MemoryHighwater"] = SQLite3.StaticMemoryHighwater;
    }

    /// <summary>
    /// Attempts to free as much heap memory as possible for this database connection.
    /// </summary>
    public void ReleaseMemory()
    {
        CheckDisposed();

        if (_sql == null)
            throw new InvalidOperationException("Database connection not valid for releasing memory.");

        SQLiteErrorCode rc = _sql.ReleaseMemory();

        if (rc != SQLiteErrorCode.Ok)
        {
            throw new SQLiteException(rc,
                _sql.GetLastError("Could not release connection memory."));
        }
    }

    /// <summary>
    /// Attempts to free N bytes of heap memory by deallocating non-essential memory
    /// allocations held by the database library. Memory used to cache database pages
    /// to improve performance is an example of non-essential memory.  This is a no-op
    /// returning zero if the SQLite core library was not compiled with the compile-time
    /// option SQLITE_ENABLE_MEMORY_MANAGEMENT.  Optionally, attempts to reset and/or
    /// compact the Win32 native heap, if applicable.
    /// </summary>
    /// <param name="nBytes">
    /// The requested number of bytes to free.
    /// </param>
    /// <param name="reset">
    /// Non-zero to attempt a heap reset.
    /// </param>
    /// <param name="compact">
    /// Non-zero to attempt heap compaction.
    /// </param>
    /// <param name="nFree">
    /// The number of bytes actually freed.  This value may be zero.
    /// </param>
    /// <param name="resetOk">
    /// This value will be non-zero if the heap reset was successful.
    /// </param>
    /// <param name="nLargest">
    /// The size of the largest committed free block in the heap, in bytes.
    /// This value will be zero unless heap compaction is enabled.
    /// </param>
    /// <returns>
    /// A standard SQLite return code (i.e. zero for success and non-zero
    /// for failure).
    /// </returns>
    #pragma warning disable 3001
    public static SQLiteErrorCode ReleaseMemory(
        int nBytes,
        bool reset,
        bool compact,
        ref int nFree,
        ref bool resetOk,
        ref uint nLargest
        )
    {
        return SQLite3.StaticReleaseMemory(
            nBytes, reset, compact, ref nFree, ref resetOk, ref nLargest);
    }
    #pragma warning restore 3001

    /// <summary>
    /// Sets the status of the memory usage tracking subsystem in the SQLite core library.  By default, this is enabled.
    /// If this is disabled, memory usage tracking will not be performed.  This is not really a per-connection value, it is
    /// global to the process.
    /// </summary>
    /// <param name="value">Non-zero to enable memory usage tracking, zero otherwise.</param>
    /// <returns>A standard SQLite return code (i.e. zero for success and non-zero for failure).</returns>
    public static SQLiteErrorCode SetMemoryStatus(bool value)
    {
        return SQLite3.StaticSetMemoryStatus(value);
    }

    /// <summary>
    /// Returns a string containing the list of unified define constants
    /// (i.e. compile-time options) used to compile the core managed and
    /// interop assemblies, delimited with spaces.
    /// </summary>
    public static string DefineConstants
    {
      get { return SQLite3.DefineConstants; }
    }

    /// <summary>
    /// Returns the version of the underlying SQLite core library.
    /// </summary>
    public static string SQLiteVersion
    {
      get { return SQLite3.SQLiteVersion; }
    }

    /// <summary>
    /// This method returns the string whose value is the same as the
    /// SQLITE_SOURCE_ID C preprocessor macro used when compiling the
    /// SQLite core library.
    /// </summary>
    public static string SQLiteSourceId
    {
      get { return SQLite3.SQLiteSourceId; }
    }

    /// <summary>
    /// Returns a string containing the compile-time options used to
    /// compile the SQLite core native library, delimited with spaces.
    /// </summary>
    public static string SQLiteCompileOptions
    {
      get { return SQLite3.SQLiteCompileOptions; }
    }

    /// <summary>
    /// This method returns the version of the interop SQLite assembly
    /// used.  If the SQLite interop assembly is not in use or the
    /// necessary information cannot be obtained for any reason, a null
    /// value may be returned.
    /// </summary>
    public static string InteropVersion
    {
      get { return SQLite3.InteropVersion; }
    }

    /// <summary>
    /// This method returns the string whose value contains the unique
    /// identifier for the source checkout used to build the interop
    /// assembly.  If the SQLite interop assembly is not in use or the
    /// necessary information cannot be obtained for any reason, a null
    /// value may be returned.
    /// </summary>
    public static string InteropSourceId
    {
      get { return SQLite3.InteropSourceId; }
    }

    /// <summary>
    /// Returns a string containing the compile-time options used to
    /// compile the SQLite interop assembly, delimited with spaces.
    /// </summary>
    public static string InteropCompileOptions
    {
      get { return SQLite3.InteropCompileOptions; }
    }

    /// <summary>
    /// This method returns the version of the managed components used
    /// to interact with the SQLite core library.  If the necessary
    /// information cannot be obtained for any reason, a null value may
    /// be returned.
    /// </summary>
    public static string ProviderVersion
    {
        get
        {
            return (_assembly != null) ?
                _assembly.GetName().Version.ToString() : null;
        }
    }

    /// <summary>
    /// This method returns the string whose value contains the unique
    /// identifier for the source checkout used to build the managed
    /// components currently executing.  If the necessary information
    /// cannot be obtained for any reason, a null value may be returned.
    /// </summary>
    public static string ProviderSourceId
    {
        get
        {
            if (_assembly == null)
                return null;

            string sourceId = null;

            if (_assembly.IsDefined(typeof(AssemblySourceIdAttribute), false))
            {
                AssemblySourceIdAttribute attribute =
                    (AssemblySourceIdAttribute)_assembly.GetCustomAttributes(
                        typeof(AssemblySourceIdAttribute), false)[0];

                sourceId = attribute.SourceId;
            }

            string sourceTimeStamp = null;

            if (_assembly.IsDefined(typeof(AssemblySourceTimeStampAttribute), false))
            {
                AssemblySourceTimeStampAttribute attribute =
                    (AssemblySourceTimeStampAttribute)_assembly.GetCustomAttributes(
                        typeof(AssemblySourceTimeStampAttribute), false)[0];

                sourceTimeStamp = attribute.SourceTimeStamp;
            }

            if ((sourceId != null) || (sourceTimeStamp != null))
            {
                if (sourceId == null)
                    sourceId = "0000000000000000000000000000000000000000";

                if (sourceTimeStamp == null)
                    sourceTimeStamp = "0000-00-00 00:00:00 UTC";

                return HelperMethods.StringFormat(
                    CultureInfo.InvariantCulture,
                    "{0} {1}", sourceId, sourceTimeStamp);
            }
            else
            {
                return null;
            }
        }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Returns a string containing the define constants (i.e. compile-time
    /// options) used to compile the core managed assembly, delimited with
    /// spaces.
    /// </summary>
    public static string ProviderDefineConstants
    {
      get { return SQLite3.ProviderDefineConstants; }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Queries and returns the value of the specified setting, using the
    /// cached setting names and values for the last connection that used
    /// the <see cref="SQLiteConnection.Open" /> method, when available.
    /// </summary>
    /// <param name="name">
    /// The name of the setting.
    /// </param>
    /// <param name="default">
    /// The value to be returned if the setting has not been set explicitly
    /// or cannot be determined.
    /// </param>
    /// <param name="value">
    /// The value of the cached setting is stored here if found; otherwise,
    /// the value of <paramref name="default" /> is stored here.
    /// </param>
    /// <returns>
    /// Non-zero if the cached setting was found; otherwise, zero.
    /// </returns>
    private static bool TryGetLastCachedSetting(
        string name,
        object @default,
        out object value
        )
    {
        if (_lastConnectionInOpen == null)
        {
            value = @default;
            return false;
        }

        return _lastConnectionInOpen.TryGetCachedSetting(
            name, @default, out value);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Adds or sets the cached setting specified by <paramref name="name" />
    /// to the value specified by <paramref name="value" /> using the cached
    /// setting names and values for the last connection that used the
    /// <see cref="SQLiteConnection.Open" /> method, when available.
    /// </summary>
    /// <param name="name">
    /// The name of the cached setting to add or replace.
    /// </param>
    /// <param name="value">
    /// The new value of the cached setting.
    /// </param>
    private static void SetLastCachedSetting(
        string name, /* in */
        object value /* in */
        )
    {
        if (_lastConnectionInOpen == null)
            return;

        _lastConnectionInOpen.SetCachedSetting(name, value);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// The default connection flags to be used for all opened connections
    /// when they are not present in the connection string.
    /// </summary>
    public static SQLiteConnectionFlags DefaultFlags
    {
        get
        {
            string name = "DefaultFlags_SQLiteConnection";
            object value;

            if (!TryGetLastCachedSetting(name, null, out value))
            {
                value = UnsafeNativeMethods.GetSettingValue(name, null);
                SetLastCachedSetting(name, value);
            }

            if (value == null)
                return FallbackDefaultFlags;

            object enumValue = TryParseEnum(
                typeof(SQLiteConnectionFlags), value.ToString(), true);

            if (enumValue is SQLiteConnectionFlags)
                return (SQLiteConnectionFlags)enumValue;

            return FallbackDefaultFlags;
        }
    }


    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// The extra connection flags to be used for all opened connections.
    /// </summary>
    public static SQLiteConnectionFlags SharedFlags
    {
        get { lock (_syncRoot) { return _sharedFlags; } }
        set { lock (_syncRoot) { _sharedFlags = value; } }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Returns the state of the connection.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
#endif
    public override ConnectionState State
    {
      get
      {
        CheckDisposed();
        return _connectionState;
      }
    }

    /// <summary>
    /// Passes a shutdown request to the SQLite core library.  Does not throw
    /// an exception if the shutdown request fails.
    /// </summary>
    /// <returns>
    /// A standard SQLite return code (i.e. zero for success and non-zero for
    /// failure).
    /// </returns>
    public SQLiteErrorCode Shutdown()
    {
        CheckDisposed();

        if (_sql == null)
            throw new InvalidOperationException("Database connection not valid for shutdown.");

        _sql.Close(false); /* NOTE: MUST be closed before shutdown. */
        SQLiteErrorCode rc = _sql.Shutdown();

#if !NET_COMPACT_20 && TRACE_CONNECTION
        if (rc != SQLiteErrorCode.Ok)
            System.Diagnostics.Trace.WriteLine(HelperMethods.StringFormat(
                CultureInfo.CurrentCulture,
                "Shutdown (Instance) Failed: {0}", rc));
#endif

        return rc;
    }

    /// <summary>
    /// Passes a shutdown request to the SQLite core library.  Throws an
    /// exception if the shutdown request fails and the no-throw parameter
    /// is non-zero.
    /// </summary>
    /// <param name="directories">
    /// Non-zero to reset the database and temporary directories to their
    /// default values, which should be null for both.
    /// </param>
    /// <param name="noThrow">
    /// When non-zero, throw an exception if the shutdown request fails.
    /// </param>
    public static void Shutdown(
        bool directories,
        bool noThrow
        )
    {
        SQLiteErrorCode rc = SQLite3.StaticShutdown(directories);

        if (rc != SQLiteErrorCode.Ok)
        {
#if !NET_COMPACT_20 && TRACE_CONNECTION
            System.Diagnostics.Trace.WriteLine(HelperMethods.StringFormat(
                CultureInfo.CurrentCulture,
                "Shutdown (Static) Failed: {0}", rc));
#endif

            if (!noThrow)
                throw new SQLiteException(rc, null);
        }
    }

    /// Enables or disables extended result codes returned by SQLite
    public void SetExtendedResultCodes(bool bOnOff)
    {
      CheckDisposed();

      if (_sql != null) _sql.SetExtendedResultCodes(bOnOff);
    }
    /// Enables or disables extended result codes returned by SQLite
    public SQLiteErrorCode ResultCode()
    {
      CheckDisposed();

      if (_sql == null)
        throw new InvalidOperationException("Database connection not valid for getting result code.");
      return _sql.ResultCode();
    }
    /// Enables or disables extended result codes returned by SQLite
    public SQLiteErrorCode ExtendedResultCode()
    {
      CheckDisposed();

      if (_sql == null)
        throw new InvalidOperationException("Database connection not valid for getting extended result code.");
      return _sql.ExtendedResultCode();
    }

    /// Add a log message via the SQLite sqlite3_log interface.
    public void LogMessage(SQLiteErrorCode iErrCode, string zMessage)
    {
      CheckDisposed();

      if (_sql == null)
          throw new InvalidOperationException("Database connection not valid for logging message.");

      _sql.LogMessage(iErrCode, zMessage);
    }

    /// Add a log message via the SQLite sqlite3_log interface.
    public void LogMessage(int iErrCode, string zMessage)
    {
      CheckDisposed();

      if (_sql == null)
          throw new InvalidOperationException("Database connection not valid for logging message.");

      _sql.LogMessage((SQLiteErrorCode)iErrCode, zMessage);
    }

    /// <summary>
    /// <code>
    /// WARNING: This method always throws an exception unless the library
    ///          has been built with encryption support.
    /// </code>
    /// Change the password (or assign a password) to the open database.
    /// </summary>
    /// <remarks>
    /// No readers or writers may be active for this process.  The database
    /// must already be open and if it already was password protected, the
    /// existing password must already have been supplied.
    /// </remarks>
    /// <param name="newPassword">
    /// The new password to assign to the open database.
    /// </param>
    public void ChangePassword(string newPassword)
    {
        CheckDisposed();

#if INTEROP_CODEC || INTEROP_INCLUDE_SEE
        if (!String.IsNullOrEmpty(newPassword))
        {
            byte[] newPasswordBytes;

            if (_passwordWasHex)
            {
                string error = null;

                newPasswordBytes = FromHexString(
                    newPassword, false, ref error);

                if (newPasswordBytes == null)
                {
                    throw new FormatException(HelperMethods.StringFormat(
                        CultureInfo.CurrentCulture,
                        "Cannot parse new password value into byte values: {0}",
                        error));
                }
            }
            else
            {
                newPasswordBytes = UTF8Encoding.UTF8.GetBytes(
                    newPassword); /* throw */
            }

            ChangePassword(newPasswordBytes);
        }
        else
        {
            ChangePassword((byte[])null);
        }
#else
        throw new SQLiteException(SQLiteErrorCode.Error,
            "Cannot use \"ChangePassword\" connection method: " +
            "library was not built with encryption support, please " +
            "see \"https://www.sqlite.org/see\" for more information");
#endif
    }

    /// <summary>
    /// <code>
    /// WARNING: This method always throws an exception unless the library
    ///          has been built with encryption support.
    /// </code>
    /// Change the password (or assign a password) to the open database.
    /// </summary>
    /// <remarks>
    /// No readers or writers may be active for this process.  The database
    /// must already be open and if it already was password protected, the
    /// existing password must already have been supplied.
    /// </remarks>
    /// <param name="newPassword">
    /// The new password to assign to the open database.
    /// </param>
    public void ChangePassword(byte[] newPassword)
    {
      CheckDisposed();

#if INTEROP_CODEC || INTEROP_INCLUDE_SEE
      if (_connectionState != ConnectionState.Open)
        throw new InvalidOperationException("Database must be opened before changing the password.");

      _sql.ChangePassword(newPassword, _passwordWasText);
#else
      throw new SQLiteException(SQLiteErrorCode.Error,
          "Cannot use \"ChangePassword\" connection method: " +
          "library was not built with encryption support, please " +
          "see \"https://www.sqlite.org/see\" for more information");
#endif
    }

    /// <summary>
    /// <code>
    /// WARNING: This method always throws an exception unless the library
    ///          has been built with encryption support.
    /// </code>
    /// Sets existing password for a closed password-protected database.
    /// Password-protected databases are unusable for any other operation
    /// until the password has been set.  Generally, this is accomplished
    /// via setting one of the "*Password" connection string properties,
    /// because it must be done prior to opening the database.
    /// </summary>
    /// <param name="databasePassword">
    /// The password for the database.
    /// </param>
    public void SetPassword(string databasePassword)
    {
        CheckDisposed();

#if INTEROP_CODEC || INTEROP_INCLUDE_SEE
        if (!String.IsNullOrEmpty(databasePassword))
        {
            byte[] databasePasswordBytes = UTF8Encoding.UTF8.GetBytes(
                databasePassword); /* throw */

            SetPassword(databasePasswordBytes);
        }
        else
        {
            SetPassword((byte[])null);
        }
#else
        throw new SQLiteException(SQLiteErrorCode.Error,
            "Cannot use \"SetPassword\" connection method: " +
            "library was not built with encryption support, please " +
            "see \"https://www.sqlite.org/see\" for more information");
#endif
    }

    /// <summary>
    /// <code>
    /// WARNING: This method always throws an exception unless the library
    ///          has been built with encryption support.
    /// </code>
    /// Sets existing password for a closed password-protected database.
    /// Password-protected databases are unusable for any other operation
    /// until the password has been set.  Generally, this is accomplished
    /// via setting one of the "*Password" connection string properties,
    /// because it must be done prior to opening the database.
    /// </summary>
    /// <param name="databasePassword">
    /// The password for the database.
    /// </param>
    public void SetPassword(byte[] databasePassword)
    {
      CheckDisposed();

#if INTEROP_CODEC || INTEROP_INCLUDE_SEE
      if (_connectionState != ConnectionState.Closed)
        throw new InvalidOperationException("Password can only be set before the database is opened.");

      if (databasePassword != null)
        if (databasePassword.Length == 0) databasePassword = null;

      if ((databasePassword != null) &&
          HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.HidePassword))
      {
          throw new InvalidOperationException(
              "With 'HidePassword' enabled, passwords can only be set via the connection string.");
      }

      _password = databasePassword;
#else
      throw new SQLiteException(SQLiteErrorCode.Error,
          "Cannot use \"SetPassword\" connection method: " +
          "library was not built with encryption support, please " +
          "see \"https://www.sqlite.org/see\" for more information");
#endif
    }

    /// <summary>
    /// Queries or modifies the number of retries or the retry interval (in milliseconds) for
    /// certain I/O operations that may fail due to anti-virus software.
    /// </summary>
    /// <param name="count">The number of times to retry the I/O operation.  A negative value
    /// will cause the current count to be queried and replace that negative value.</param>
    /// <param name="interval">The number of milliseconds to wait before retrying the I/O
    /// operation.  This number is multiplied by the number of retry attempts so far to come
    /// up with the final number of milliseconds to wait.  A negative value will cause the
    /// current interval to be queried and replace that negative value.</param>
    /// <returns>Zero for success, non-zero for error.</returns>
    public SQLiteErrorCode SetAvRetry(ref int count, ref int interval)
    {
        CheckDisposed();

        if (_connectionState != ConnectionState.Open)
            throw new InvalidOperationException(
                "Database must be opened before changing the AV retry parameters.");

        SQLiteErrorCode rc;
        IntPtr pArg = IntPtr.Zero;

        try
        {
            pArg = Marshal.AllocHGlobal(sizeof(int) * 2);

            Marshal.WriteInt32(pArg, 0, count);
            Marshal.WriteInt32(pArg, sizeof(int), interval);

            rc = _sql.FileControl(null, SQLITE_FCNTL_WIN32_AV_RETRY, pArg);

            if (rc == SQLiteErrorCode.Ok)
            {
                count = Marshal.ReadInt32(pArg, 0);
                interval = Marshal.ReadInt32(pArg, sizeof(int));
            }
        }
        finally
        {
            if (pArg != IntPtr.Zero)
                Marshal.FreeHGlobal(pArg);
        }

        return rc;
    }

    /// <summary>
    /// Sets the chunk size for the primary file associated with this database
    /// connection.
    /// </summary>
    /// <param name="size">
    /// The new chunk size for the main database, in bytes.
    /// </param>
    /// <returns>
    /// Zero for success, non-zero for error.
    /// </returns>
    public SQLiteErrorCode SetChunkSize(int size)
    {
        CheckDisposed();

        if (_connectionState != ConnectionState.Open)
            throw new InvalidOperationException(
                "Database must be opened before changing the chunk size.");

        IntPtr pArg = IntPtr.Zero;

        try
        {
            pArg = Marshal.AllocHGlobal(sizeof(int) * 1);

            Marshal.WriteInt32(pArg, 0, size);

            return _sql.FileControl(null, SQLITE_FCNTL_CHUNK_SIZE, pArg);
        }
        finally
        {
            if (pArg != IntPtr.Zero)
                Marshal.FreeHGlobal(pArg);
        }
    }

    /// <summary>
    /// Removes one set of surrounding single -OR- double quotes from the string
    /// value and returns the resulting string value.  If the string is null, empty,
    /// or contains quotes that are not balanced, nothing is done and the original
    /// string value will be returned.
    /// </summary>
    /// <param name="value">The string value to process.</param>
    /// <returns>
    /// The string value, modified to remove one set of surrounding single -OR-
    /// double quotes, if applicable.
    /// </returns>
    private static string UnwrapString(string value)
    {
        if (String.IsNullOrEmpty(value))
        {
            //
            // NOTE: The string is null or empty, return it verbatim.
            //
            return value;
        }

        int length = value.Length;

        if ((value[0] == SQLiteConvert.QuoteChar) &&
            (value[length - 1] == SQLiteConvert.QuoteChar))
        {
            //
            // NOTE: Remove the first and last character, which are
            //       both double quotes.
            //
            return value.Substring(1, length - 2);
        }

        if ((value[0] == SQLiteConvert.AltQuoteChar) &&
            (value[length - 1] == SQLiteConvert.AltQuoteChar))
        {
            //
            // NOTE: Remove the first and last character, which are
            //       both single quotes.
            //
            return value.Substring(1, length - 2);
        }

        //
        // NOTE: No match, return the input string verbatim.
        //
        return value;
    }

    /// <summary>
    /// Determines the directory to be used when dealing with the "|DataDirectory|"
    /// macro in a database file name.
    /// </summary>
    /// <returns>
    /// The directory to use in place of the "|DataDirectory|" macro -OR- null if it
    /// cannot be determined.
    /// </returns>
    private static string GetDataDirectory()
    {
#if PLATFORM_COMPACTFRAMEWORK
        string result = Path.GetDirectoryName(
            Assembly.GetCallingAssembly().GetName().CodeBase);
#else
        string result = AppDomain.CurrentDomain.GetData(
            "DataDirectory") as string;

        if (String.IsNullOrEmpty(result))
            result = AppDomain.CurrentDomain.BaseDirectory;
#endif

        return result;
    }

    /// <summary>
    /// Expand the filename of the data source, resolving the |DataDirectory|
    /// macro as appropriate.
    /// </summary>
    /// <param name="sourceFile">The database filename to expand</param>
    /// <param name="toFullPath">
    /// Non-zero if the returned file name should be converted to a full path
    /// (except when using the .NET Compact Framework).
    /// </param>
    /// <returns>The expanded path and filename of the filename</returns>
    private static string ExpandFileName(string sourceFile, bool toFullPath)
    {
        if (String.IsNullOrEmpty(sourceFile)) return sourceFile;

        if (sourceFile.StartsWith(_dataDirectory, StringComparison.OrdinalIgnoreCase))
        {
            string dataDirectory = GetDataDirectory();









            if (sourceFile.Length > _dataDirectory.Length)
            {
                if (sourceFile[_dataDirectory.Length] == Path.DirectorySeparatorChar ||
                    sourceFile[_dataDirectory.Length] == Path.AltDirectorySeparatorChar)
                    sourceFile = sourceFile.Remove(_dataDirectory.Length, 1);
            }
            sourceFile = Path.Combine(dataDirectory, sourceFile.Substring(_dataDirectory.Length));
        }

#if !PLATFORM_COMPACTFRAMEWORK
        if (toFullPath)
            sourceFile = Path.GetFullPath(sourceFile);
#endif

        return sourceFile;
    }

    ///<overloads>
    /// The following commands are used to extract schema information out of the database.  Valid schema types are:
    /// <list type="bullet">
    /// <item>
    /// <description>MetaDataCollections</description>
1103
1104
1105
1106
1107
1108
1109

1110
1111
1112
1113
1114
1115
1116
1117
1118
1119

1120
1121
1122
1123
1124
1125
1126
1127


































1128
1129
1130


1131
1132
1133
1134
1135
1136
1137
    /// </overloads>
    /// <summary>
    /// Returns the MetaDataCollections schema
    /// </summary>
    /// <returns>A DataTable of the MetaDataCollections schema</returns>
    public override DataTable GetSchema()
    {

      return GetSchema("MetaDataCollections", null);
    }

    /// <summary>
    /// Returns schema information of the specified collection
    /// </summary>
    /// <param name="collectionName">The schema collection to retrieve</param>
    /// <returns>A DataTable of the specified collection</returns>
    public override DataTable GetSchema(string collectionName)
    {

      return GetSchema(collectionName, new string[0]);
    }

    /// <summary>
    /// Retrieves schema information using the specified constraint(s) for the specified collection
    /// </summary>
    /// <param name="collectionName">The collection to retrieve</param>
    /// <param name="restrictionValues">The restrictions to impose</param>


































    /// <returns>A DataTable of the specified collection</returns>
    public override DataTable GetSchema(string collectionName, string[] restrictionValues)
    {


      if (_connectionState != ConnectionState.Open)
        throw new InvalidOperationException();

      string[] parms = new string[5];

      if (restrictionValues == null) restrictionValues = new string[0];
      restrictionValues.CopyTo(parms, 0);







>










>






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



>
>







6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
    /// </overloads>
    /// <summary>
    /// Returns the MetaDataCollections schema
    /// </summary>
    /// <returns>A DataTable of the MetaDataCollections schema</returns>
    public override DataTable GetSchema()
    {
      CheckDisposed();
      return GetSchema("MetaDataCollections", null);
    }

    /// <summary>
    /// Returns schema information of the specified collection
    /// </summary>
    /// <param name="collectionName">The schema collection to retrieve</param>
    /// <returns>A DataTable of the specified collection</returns>
    public override DataTable GetSchema(string collectionName)
    {
      CheckDisposed();
      return GetSchema(collectionName, new string[0]);
    }

    /// <summary>
    /// Retrieves schema information using the specified constraint(s) for the specified collection
    /// </summary>
    /// <param name="collectionName">The collection to retrieve.</param>
    /// <param name="restrictionValues">
    /// The restrictions to impose.  Typically, this may include:
    /// <list type="table">
    /// <listheader>
    /// <term>restrictionValues element index</term>
    /// <term>usage</term>
    /// </listheader>
    /// <item>
    /// <description>0</description>
    /// <description>The database (or catalog) name, if applicable.</description>
    /// </item>
    /// <item>
    /// <description>1</description>
    /// <description>The schema name.  This is not used by this provider.</description>
    /// </item>
    /// <item>
    /// <description>2</description>
    /// <description>The table name, if applicable.</description>
    /// </item>
    /// <item>
    /// <description>3</description>
    /// <description>
    /// Depends on <paramref name="collectionName" />.
    /// When "IndexColumns", it is the index name; otherwise, it is the column name.
    /// </description>
    /// </item>
    /// <item>
    /// <description>4</description>
    /// <description>
    /// Depends on <paramref name="collectionName" />.
    /// When "IndexColumns", it is the column name; otherwise, it is not used.
    /// </description>
    /// </item>
    /// </list>
    /// </param>
    /// <returns>A DataTable of the specified collection</returns>
    public override DataTable GetSchema(string collectionName, string[] restrictionValues)
    {
      CheckDisposed();

      if (_connectionState != ConnectionState.Open)
        throw new InvalidOperationException();

      string[] parms = new string[5];

      if (restrictionValues == null) restrictionValues = new string[0];
      restrictionValues.CopyTo(parms, 0);
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
      return tbl;
    }

    /// <summary>
    /// Build a Columns schema
    /// </summary>
    /// <param name="strCatalog">The catalog (attached database) to query, can be null</param>
    /// <param name="strTable">The table to retrieve schema information for, must not be null</param>
    /// <param name="strColumn">The column to retrieve schema information for, can be null</param>
    /// <returns>DataTable</returns>
    private DataTable Schema_Columns(string strCatalog, string strTable, string strColumn)
    {
      DataTable tbl = new DataTable("Columns");
      DataRow row;








|







6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
      return tbl;
    }

    /// <summary>
    /// Build a Columns schema
    /// </summary>
    /// <param name="strCatalog">The catalog (attached database) to query, can be null</param>
    /// <param name="strTable">The table to retrieve schema information for, can be null</param>
    /// <param name="strColumn">The column to retrieve schema information for, can be null</param>
    /// <returns>DataTable</returns>
    private DataTable Schema_Columns(string strCatalog, string strTable, string strColumn)
    {
      DataTable tbl = new DataTable("Columns");
      DataRow row;

1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
      tbl.Columns.Add("PRIMARY_KEY", typeof(bool));
      tbl.Columns.Add("EDM_TYPE", typeof(string));
      tbl.Columns.Add("AUTOINCREMENT", typeof(bool));
      tbl.Columns.Add("UNIQUE", typeof(bool));

      tbl.BeginLoadData();

      if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";

      string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb;

      using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table' OR [type] LIKE 'view'", strCatalog, master), this))
      using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())
      {
        while (rdTables.Read())
        {
          if (String.IsNullOrEmpty(strTable) || String.Compare(strTable, rdTables.GetString(2), StringComparison.OrdinalIgnoreCase) == 0)
          {
            try
            {
              using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdTables.GetString(2)), this))
              using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader(CommandBehavior.SchemaOnly))
              using (DataTable tblSchema = rd.GetSchemaTable(true, true))
              {
                foreach (DataRow schemaRow in tblSchema.Rows)
                {
                  if (String.Compare(schemaRow[SchemaTableColumn.ColumnName].ToString(), strColumn, StringComparison.OrdinalIgnoreCase) == 0
                    || strColumn == null)
                  {
                    row = tbl.NewRow();

                    row["NUMERIC_PRECISION"] = schemaRow[SchemaTableColumn.NumericPrecision];
                    row["NUMERIC_SCALE"] = schemaRow[SchemaTableColumn.NumericScale];
                    row["TABLE_NAME"] = rdTables.GetString(2);
                    row["COLUMN_NAME"] = schemaRow[SchemaTableColumn.ColumnName];
                    row["TABLE_CATALOG"] = strCatalog;
                    row["ORDINAL_POSITION"] = schemaRow[SchemaTableColumn.ColumnOrdinal];
                    row["COLUMN_HASDEFAULT"] = (schemaRow[SchemaTableOptionalColumn.DefaultValue] != DBNull.Value);
                    row["COLUMN_DEFAULT"] = schemaRow[SchemaTableOptionalColumn.DefaultValue];
                    row["IS_NULLABLE"] = schemaRow[SchemaTableColumn.AllowDBNull];
                    row["DATA_TYPE"] = schemaRow["DataTypeName"].ToString().ToLower(CultureInfo.InvariantCulture);
                    row["EDM_TYPE"] = SQLiteConvert.DbTypeToTypeName((DbType)schemaRow[SchemaTableColumn.ProviderType]).ToString().ToLower(CultureInfo.InvariantCulture);
                    row["CHARACTER_MAXIMUM_LENGTH"] = schemaRow[SchemaTableColumn.ColumnSize];
                    row["TABLE_SCHEMA"] = schemaRow[SchemaTableColumn.BaseSchemaName];
                    row["PRIMARY_KEY"] = schemaRow[SchemaTableColumn.IsKey];
                    row["AUTOINCREMENT"] = schemaRow[SchemaTableOptionalColumn.IsAutoIncrement];
                    row["COLLATION_NAME"] = schemaRow["CollationType"];
                    row["UNIQUE"] = schemaRow[SchemaTableColumn.IsUnique];
                    tbl.Rows.Add(row);







|

|

|








|




















|







6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
      tbl.Columns.Add("PRIMARY_KEY", typeof(bool));
      tbl.Columns.Add("EDM_TYPE", typeof(string));
      tbl.Columns.Add("AUTOINCREMENT", typeof(bool));
      tbl.Columns.Add("UNIQUE", typeof(bool));

      tbl.BeginLoadData();

      if (String.IsNullOrEmpty(strCatalog)) strCatalog = GetDefaultCatalogName();

      string master = GetMasterTableName(IsTemporaryCatalogName(strCatalog));

      using (SQLiteCommand cmdTables = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table' OR [type] LIKE 'view'", strCatalog, master), this))
      using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())
      {
        while (rdTables.Read())
        {
          if (String.IsNullOrEmpty(strTable) || String.Compare(strTable, rdTables.GetString(2), StringComparison.OrdinalIgnoreCase) == 0)
          {
            try
            {
              using (SQLiteCommand cmd = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdTables.GetString(2)), this))
              using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader(CommandBehavior.SchemaOnly))
              using (DataTable tblSchema = rd.GetSchemaTable(true, true))
              {
                foreach (DataRow schemaRow in tblSchema.Rows)
                {
                  if (String.Compare(schemaRow[SchemaTableColumn.ColumnName].ToString(), strColumn, StringComparison.OrdinalIgnoreCase) == 0
                    || strColumn == null)
                  {
                    row = tbl.NewRow();

                    row["NUMERIC_PRECISION"] = schemaRow[SchemaTableColumn.NumericPrecision];
                    row["NUMERIC_SCALE"] = schemaRow[SchemaTableColumn.NumericScale];
                    row["TABLE_NAME"] = rdTables.GetString(2);
                    row["COLUMN_NAME"] = schemaRow[SchemaTableColumn.ColumnName];
                    row["TABLE_CATALOG"] = strCatalog;
                    row["ORDINAL_POSITION"] = schemaRow[SchemaTableColumn.ColumnOrdinal];
                    row["COLUMN_HASDEFAULT"] = (schemaRow[SchemaTableOptionalColumn.DefaultValue] != DBNull.Value);
                    row["COLUMN_DEFAULT"] = schemaRow[SchemaTableOptionalColumn.DefaultValue];
                    row["IS_NULLABLE"] = schemaRow[SchemaTableColumn.AllowDBNull];
                    row["DATA_TYPE"] = schemaRow["DataTypeName"].ToString().ToLower(CultureInfo.InvariantCulture);
                    row["EDM_TYPE"] = SQLiteConvert.DbTypeToTypeName(this, (DbType)schemaRow[SchemaTableColumn.ProviderType], _flags).ToString().ToLower(CultureInfo.InvariantCulture);
                    row["CHARACTER_MAXIMUM_LENGTH"] = schemaRow[SchemaTableColumn.ColumnSize];
                    row["TABLE_SCHEMA"] = schemaRow[SchemaTableColumn.BaseSchemaName];
                    row["PRIMARY_KEY"] = schemaRow[SchemaTableColumn.IsKey];
                    row["AUTOINCREMENT"] = schemaRow[SchemaTableOptionalColumn.IsAutoIncrement];
                    row["COLLATION_NAME"] = schemaRow["CollationType"];
                    row["UNIQUE"] = schemaRow[SchemaTableColumn.IsUnique];
                    tbl.Rows.Add(row);
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
      tbl.Columns.Add("PAGES", typeof(int));
      tbl.Columns.Add("FILTER_CONDITION", typeof(string));
      tbl.Columns.Add("INTEGRATED", typeof(bool));
      tbl.Columns.Add("INDEX_DEFINITION", typeof(string));

      tbl.BeginLoadData();

      if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";

      string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb;
      
      using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
      using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())
      {
        while (rdTables.Read())
        {
          maybeRowId = false;
          primaryKeys.Clear();
          if (String.IsNullOrEmpty(strTable) || String.Compare(rdTables.GetString(2), strTable, StringComparison.OrdinalIgnoreCase) == 0)
          {
            // First, look for any rowid indexes -- which sqlite defines are INTEGER PRIMARY KEY columns.
            // Such indexes are not listed in the indexes list but count as indexes just the same.
            try
            {
              using (SQLiteCommand cmdTable = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].table_info([{1}])", strCatalog, rdTables.GetString(2)), this))
              using (SQLiteDataReader rdTable = cmdTable.ExecuteReader())
              {
                while (rdTable.Read())
                {
                  if (rdTable.GetInt32(5) == 1)
                  {
                    primaryKeys.Add(rdTable.GetInt32(0));

                    // If the primary key is of type INTEGER, then its a rowid and we need to make a fake index entry for it.
                    if (String.Compare(rdTable.GetString(2), "INTEGER", StringComparison.OrdinalIgnoreCase) == 0)
                      maybeRowId = true;
                  }







|

|
|
|












|




|







6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
      tbl.Columns.Add("PAGES", typeof(int));
      tbl.Columns.Add("FILTER_CONDITION", typeof(string));
      tbl.Columns.Add("INTEGRATED", typeof(bool));
      tbl.Columns.Add("INDEX_DEFINITION", typeof(string));

      tbl.BeginLoadData();

      if (String.IsNullOrEmpty(strCatalog)) strCatalog = GetDefaultCatalogName();

      string master = GetMasterTableName(IsTemporaryCatalogName(strCatalog));

      using (SQLiteCommand cmdTables = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
      using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())
      {
        while (rdTables.Read())
        {
          maybeRowId = false;
          primaryKeys.Clear();
          if (String.IsNullOrEmpty(strTable) || String.Compare(rdTables.GetString(2), strTable, StringComparison.OrdinalIgnoreCase) == 0)
          {
            // First, look for any rowid indexes -- which sqlite defines are INTEGER PRIMARY KEY columns.
            // Such indexes are not listed in the indexes list but count as indexes just the same.
            try
            {
              using (SQLiteCommand cmdTable = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].table_info([{1}])", strCatalog, rdTables.GetString(2)), this))
              using (SQLiteDataReader rdTable = cmdTable.ExecuteReader())
              {
                while (rdTable.Read())
                {
                  if (rdTable.GetInt32(5) != 0)
                  {
                    primaryKeys.Add(rdTable.GetInt32(0));

                    // If the primary key is of type INTEGER, then its a rowid and we need to make a fake index entry for it.
                    if (String.Compare(rdTable.GetString(2), "INTEGER", StringComparison.OrdinalIgnoreCase) == 0)
                      maybeRowId = true;
                  }
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
            {
              row = tbl.NewRow();

              row["TABLE_CATALOG"] = strCatalog;
              row["TABLE_NAME"] = rdTables.GetString(2);
              row["INDEX_CATALOG"] = strCatalog;
              row["PRIMARY_KEY"] = true;
              row["INDEX_NAME"] = String.Format(CultureInfo.InvariantCulture, "{1}_PK_{0}", rdTables.GetString(2), master);
              row["UNIQUE"] = true;

              if (String.Compare((string)row["INDEX_NAME"], strIndex, StringComparison.OrdinalIgnoreCase) == 0
              || strIndex == null)
              {
                tbl.Rows.Add(row);
              }

              primaryKeys.Clear();
            }

            // Now fetch all the rest of the indexes.
            try
            {
              using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_list([{1}])", strCatalog, rdTables.GetString(2)), this))
              using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader())
              {
                while (rd.Read())
                {
                  if (String.Compare(rd.GetString(1), strIndex, StringComparison.OrdinalIgnoreCase) == 0
                  || strIndex == null)
                  {
                    row = tbl.NewRow();

                    row["TABLE_CATALOG"] = strCatalog;
                    row["TABLE_NAME"] = rdTables.GetString(2);
                    row["INDEX_CATALOG"] = strCatalog;
                    row["INDEX_NAME"] = rd.GetString(1);
                    row["UNIQUE"] = rd.GetBoolean(2);
                    row["PRIMARY_KEY"] = false;

                    // get the index definition
                    using (SQLiteCommand cmdIndexes = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{2}] WHERE [type] LIKE 'index' AND [name] LIKE '{1}'", strCatalog, rd.GetString(1).Replace("'", "''"), master), this))
                    using (SQLiteDataReader rdIndexes = cmdIndexes.ExecuteReader())
                    {
                      while (rdIndexes.Read())
                      {
                        if (rdIndexes.IsDBNull(4) == false)
                          row["INDEX_DEFINITION"] = rdIndexes.GetString(4);
                        break;
                      }
                    }

                    // Now for the really hard work.  Figure out which index is the primary key index.
                    // The only way to figure it out is to check if the index was an autoindex and if we have a non-rowid
                    // primary key, and all the columns in the given index match the primary key columns
                    if (primaryKeys.Count > 0 && rd.GetString(1).StartsWith("sqlite_autoindex_" + rdTables.GetString(2), StringComparison.InvariantCultureIgnoreCase) == true)
                    {
                      using (SQLiteCommand cmdDetails = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_info([{1}])", strCatalog, rd.GetString(1)), this))
                      using (SQLiteDataReader rdDetails = cmdDetails.ExecuteReader())
                      {
                        int nMatches = 0;
                        while (rdDetails.Read())
                        {
                          if (primaryKeys.Contains(rdDetails.GetInt32(1)) == false)
                          {







|














|













|



|















|







6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
            {
              row = tbl.NewRow();

              row["TABLE_CATALOG"] = strCatalog;
              row["TABLE_NAME"] = rdTables.GetString(2);
              row["INDEX_CATALOG"] = strCatalog;
              row["PRIMARY_KEY"] = true;
              row["INDEX_NAME"] = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "{1}_PK_{0}", rdTables.GetString(2), master);
              row["UNIQUE"] = true;

              if (String.Compare((string)row["INDEX_NAME"], strIndex, StringComparison.OrdinalIgnoreCase) == 0
              || strIndex == null)
              {
                tbl.Rows.Add(row);
              }

              primaryKeys.Clear();
            }

            // Now fetch all the rest of the indexes.
            try
            {
              using (SQLiteCommand cmd = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_list([{1}])", strCatalog, rdTables.GetString(2)), this))
              using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader())
              {
                while (rd.Read())
                {
                  if (String.Compare(rd.GetString(1), strIndex, StringComparison.OrdinalIgnoreCase) == 0
                  || strIndex == null)
                  {
                    row = tbl.NewRow();

                    row["TABLE_CATALOG"] = strCatalog;
                    row["TABLE_NAME"] = rdTables.GetString(2);
                    row["INDEX_CATALOG"] = strCatalog;
                    row["INDEX_NAME"] = rd.GetString(1);
                    row["UNIQUE"] = SQLiteConvert.ToBoolean(rd.GetValue(2), CultureInfo.InvariantCulture, false);
                    row["PRIMARY_KEY"] = false;

                    // get the index definition
                    using (SQLiteCommand cmdIndexes = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{2}] WHERE [type] LIKE 'index' AND [name] LIKE '{1}'", strCatalog, rd.GetString(1).Replace("'", "''"), master), this))
                    using (SQLiteDataReader rdIndexes = cmdIndexes.ExecuteReader())
                    {
                      while (rdIndexes.Read())
                      {
                        if (rdIndexes.IsDBNull(4) == false)
                          row["INDEX_DEFINITION"] = rdIndexes.GetString(4);
                        break;
                      }
                    }

                    // Now for the really hard work.  Figure out which index is the primary key index.
                    // The only way to figure it out is to check if the index was an autoindex and if we have a non-rowid
                    // primary key, and all the columns in the given index match the primary key columns
                    if (primaryKeys.Count > 0 && rd.GetString(1).StartsWith("sqlite_autoindex_" + rdTables.GetString(2), StringComparison.InvariantCultureIgnoreCase) == true)
                    {
                      using (SQLiteCommand cmdDetails = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_info([{1}])", strCatalog, rd.GetString(1)), this))
                      using (SQLiteDataReader rdDetails = cmdDetails.ExecuteReader())
                      {
                        int nMatches = 0;
                        while (rdDetails.Read())
                        {
                          if (primaryKeys.Contains(rdDetails.GetInt32(1)) == false)
                          {
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
      tbl.Columns.Add("TABLE_NAME", typeof(string));
      tbl.Columns.Add("TRIGGER_NAME", typeof(string));
      tbl.Columns.Add("TRIGGER_DEFINITION", typeof(string));

      tbl.BeginLoadData();

      if (String.IsNullOrEmpty(table)) table = null;
      if (String.IsNullOrEmpty(catalog)) catalog = "main";
      string master = (String.Compare(catalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb;

      using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT [type], [name], [tbl_name], [rootpage], [sql], [rowid] FROM [{0}].[{1}] WHERE [type] LIKE 'trigger'", catalog, master), this))
      using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader())
      {
        while (rd.Read())
        {
          if (String.Compare(rd.GetString(1), triggerName, StringComparison.OrdinalIgnoreCase) == 0
            || triggerName == null)
          {







|
|

|







7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
      tbl.Columns.Add("TABLE_NAME", typeof(string));
      tbl.Columns.Add("TRIGGER_NAME", typeof(string));
      tbl.Columns.Add("TRIGGER_DEFINITION", typeof(string));

      tbl.BeginLoadData();

      if (String.IsNullOrEmpty(table)) table = null;
      if (String.IsNullOrEmpty(catalog)) catalog = GetDefaultCatalogName();
      string master = GetMasterTableName(IsTemporaryCatalogName(catalog));

      using (SQLiteCommand cmd = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT [type], [name], [tbl_name], [rootpage], [sql], [rowid] FROM [{0}].[{1}] WHERE [type] LIKE 'trigger'", catalog, master), this))
      using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader())
      {
        while (rd.Read())
        {
          if (String.Compare(rd.GetString(1), triggerName, StringComparison.OrdinalIgnoreCase) == 0
            || triggerName == null)
          {
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
      tbl.Columns.Add("TABLE_NAME", typeof(string));
      tbl.Columns.Add("TABLE_TYPE", typeof(string));
      tbl.Columns.Add("TABLE_ID", typeof(long));
      tbl.Columns.Add("TABLE_ROOTPAGE", typeof(int));
      tbl.Columns.Add("TABLE_DEFINITION", typeof(string));
      tbl.BeginLoadData();

      if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";

      string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb;

      using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT [type], [name], [tbl_name], [rootpage], [sql], [rowid] FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
      using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader())
      {
        while (rd.Read())
        {
          strItem = rd.GetString(0);
          if (String.Compare(rd.GetString(2), 0, "SQLITE_", 0, 7, StringComparison.OrdinalIgnoreCase) == 0)
            strItem = "SYSTEM_TABLE";







|

|

|







7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
      tbl.Columns.Add("TABLE_NAME", typeof(string));
      tbl.Columns.Add("TABLE_TYPE", typeof(string));
      tbl.Columns.Add("TABLE_ID", typeof(long));
      tbl.Columns.Add("TABLE_ROOTPAGE", typeof(int));
      tbl.Columns.Add("TABLE_DEFINITION", typeof(string));
      tbl.BeginLoadData();

      if (String.IsNullOrEmpty(strCatalog)) strCatalog = GetDefaultCatalogName();

      string master = GetMasterTableName(IsTemporaryCatalogName(strCatalog));

      using (SQLiteCommand cmd = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT [type], [name], [tbl_name], [rootpage], [sql], [rowid] FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
      using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader())
      {
        while (rd.Read())
        {
          strItem = rd.GetString(0);
          if (String.Compare(rd.GetString(2), 0, "SQLITE_", 0, 7, StringComparison.OrdinalIgnoreCase) == 0)
            strItem = "SYSTEM_TABLE";
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
      tbl.Columns.Add("IS_UPDATABLE", typeof(bool));
      tbl.Columns.Add("DESCRIPTION", typeof(string));
      tbl.Columns.Add("DATE_CREATED", typeof(DateTime));
      tbl.Columns.Add("DATE_MODIFIED", typeof(DateTime));

      tbl.BeginLoadData();

      if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";

      string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb;

      using (SQLiteCommand cmd = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this))
      using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader())
      {
        while (rd.Read())
        {
          if (String.Compare(rd.GetString(1), strView, StringComparison.OrdinalIgnoreCase) == 0
            || String.IsNullOrEmpty(strView))
          {







|

|

|







7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
      tbl.Columns.Add("IS_UPDATABLE", typeof(bool));
      tbl.Columns.Add("DESCRIPTION", typeof(string));
      tbl.Columns.Add("DATE_CREATED", typeof(DateTime));
      tbl.Columns.Add("DATE_MODIFIED", typeof(DateTime));

      tbl.BeginLoadData();

      if (String.IsNullOrEmpty(strCatalog)) strCatalog = GetDefaultCatalogName();

      string master = GetMasterTableName(IsTemporaryCatalogName(strCatalog));

      using (SQLiteCommand cmd = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this))
      using (SQLiteDataReader rd = (SQLiteDataReader)cmd.ExecuteReader())
      {
        while (rd.Read())
        {
          if (String.Compare(rd.GetString(1), strView, StringComparison.OrdinalIgnoreCase) == 0
            || String.IsNullOrEmpty(strView))
          {
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
      tbl.Columns.Add("COLUMN_NAME", typeof(string));
      tbl.Columns.Add("ORDINAL_POSITION", typeof(int));
      tbl.Columns.Add("INDEX_NAME", typeof(string));
      tbl.Columns.Add("COLLATION_NAME", typeof(string));
      tbl.Columns.Add("SORT_MODE", typeof(string));
      tbl.Columns.Add("CONFLICT_OPTION", typeof(int));

      if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";

      string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb;

      tbl.BeginLoadData();

      using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
      using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())
      {
        while (rdTables.Read())
        {
          maybeRowId = false;
          primaryKeys.Clear();
          if (String.IsNullOrEmpty(strTable) || String.Compare(rdTables.GetString(2), strTable, StringComparison.OrdinalIgnoreCase) == 0)
          {
            try
            {
              using (SQLiteCommand cmdTable = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].table_info([{1}])", strCatalog, rdTables.GetString(2)), this))
              using (SQLiteDataReader rdTable = cmdTable.ExecuteReader())
              {
                while (rdTable.Read())
                {
                  if (rdTable.GetInt32(5) == 1) // is a primary key
                  {
                    primaryKeys.Add(new KeyValuePair<int, string>(rdTable.GetInt32(0), rdTable.GetString(1)));







|

|



|










|







7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
      tbl.Columns.Add("COLUMN_NAME", typeof(string));
      tbl.Columns.Add("ORDINAL_POSITION", typeof(int));
      tbl.Columns.Add("INDEX_NAME", typeof(string));
      tbl.Columns.Add("COLLATION_NAME", typeof(string));
      tbl.Columns.Add("SORT_MODE", typeof(string));
      tbl.Columns.Add("CONFLICT_OPTION", typeof(int));

      if (String.IsNullOrEmpty(strCatalog)) strCatalog = GetDefaultCatalogName();

      string master = GetMasterTableName(IsTemporaryCatalogName(strCatalog));

      tbl.BeginLoadData();

      using (SQLiteCommand cmdTables = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
      using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())
      {
        while (rdTables.Read())
        {
          maybeRowId = false;
          primaryKeys.Clear();
          if (String.IsNullOrEmpty(strTable) || String.Compare(rdTables.GetString(2), strTable, StringComparison.OrdinalIgnoreCase) == 0)
          {
            try
            {
              using (SQLiteCommand cmdTable = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].table_info([{1}])", strCatalog, rdTables.GetString(2)), this))
              using (SQLiteDataReader rdTable = cmdTable.ExecuteReader())
              {
                while (rdTable.Read())
                {
                  if (rdTable.GetInt32(5) == 1) // is a primary key
                  {
                    primaryKeys.Add(new KeyValuePair<int, string>(rdTable.GetInt32(0), rdTable.GetString(1)));
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911


1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923


1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
            {
            }
            // This is a rowid row
            if (primaryKeys.Count == 1 && maybeRowId == true)
            {
              row = tbl.NewRow();
              row["CONSTRAINT_CATALOG"] = strCatalog;
              row["CONSTRAINT_NAME"] = String.Format(CultureInfo.InvariantCulture, "{1}_PK_{0}", rdTables.GetString(2), master);
              row["TABLE_CATALOG"] = strCatalog;
              row["TABLE_NAME"] = rdTables.GetString(2);
              row["COLUMN_NAME"] = primaryKeys[0].Value;
              row["INDEX_NAME"] = row["CONSTRAINT_NAME"];
              row["ORDINAL_POSITION"] = 0; // primaryKeys[0].Key;
              row["COLLATION_NAME"] = "BINARY";
              row["SORT_MODE"] = "ASC";
              row["CONFLICT_OPTION"] = 2;

              if (String.IsNullOrEmpty(strIndex) || String.Compare(strIndex, (string)row["INDEX_NAME"], StringComparison.OrdinalIgnoreCase) == 0)
                tbl.Rows.Add(row);
            }

            using (SQLiteCommand cmdIndexes = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{2}] WHERE [type] LIKE 'index' AND [tbl_name] LIKE '{1}'", strCatalog, rdTables.GetString(2).Replace("'", "''"), master), this))
            using (SQLiteDataReader rdIndexes = cmdIndexes.ExecuteReader())
            {
              while (rdIndexes.Read())
              {
                int ordinal = 0;
                if (String.IsNullOrEmpty(strIndex) || String.Compare(strIndex, rdIndexes.GetString(1), StringComparison.OrdinalIgnoreCase) == 0)
                {
                  try
                  {
                    using (SQLiteCommand cmdIndex = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_info([{1}])", strCatalog, rdIndexes.GetString(1)), this))
                    using (SQLiteDataReader rdIndex = cmdIndex.ExecuteReader())
                    {
                      while (rdIndex.Read())
                      {


                        row = tbl.NewRow();
                        row["CONSTRAINT_CATALOG"] = strCatalog;
                        row["CONSTRAINT_NAME"] = rdIndexes.GetString(1);
                        row["TABLE_CATALOG"] = strCatalog;
                        row["TABLE_NAME"] = rdIndexes.GetString(2);
                        row["COLUMN_NAME"] = rdIndex.GetString(2);
                        row["INDEX_NAME"] = rdIndexes.GetString(1);
                        row["ORDINAL_POSITION"] = ordinal; // rdIndex.GetInt32(1);

                        string collationSequence;
                        int sortMode;
                        int onError;


                        _sql.GetIndexColumnExtendedInfo(strCatalog, rdIndexes.GetString(1), rdIndex.GetString(2), out sortMode, out onError, out collationSequence);

                        if (String.IsNullOrEmpty(collationSequence) == false)
                          row["COLLATION_NAME"] = collationSequence;

                        row["SORT_MODE"] = (sortMode == 0) ? "ASC" : "DESC";
                        row["CONFLICT_OPTION"] = onError;

                        ordinal++;

                        if (String.IsNullOrEmpty(strColumn) || String.Compare(strColumn, row["COLUMN_NAME"].ToString(), StringComparison.OrdinalIgnoreCase) == 0)
                          tbl.Rows.Add(row);
                      }
                    }
                  }
                  catch (SQLiteException)
                  {
                  }







|













|









|




>
>





|



|
|
|
>
>
|









|







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
            {
            }
            // This is a rowid row
            if (primaryKeys.Count == 1 && maybeRowId == true)
            {
              row = tbl.NewRow();
              row["CONSTRAINT_CATALOG"] = strCatalog;
              row["CONSTRAINT_NAME"] = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "{1}_PK_{0}", rdTables.GetString(2), master);
              row["TABLE_CATALOG"] = strCatalog;
              row["TABLE_NAME"] = rdTables.GetString(2);
              row["COLUMN_NAME"] = primaryKeys[0].Value;
              row["INDEX_NAME"] = row["CONSTRAINT_NAME"];
              row["ORDINAL_POSITION"] = 0; // primaryKeys[0].Key;
              row["COLLATION_NAME"] = "BINARY";
              row["SORT_MODE"] = "ASC";
              row["CONFLICT_OPTION"] = 2;

              if (String.IsNullOrEmpty(strIndex) || String.Compare(strIndex, (string)row["INDEX_NAME"], StringComparison.OrdinalIgnoreCase) == 0)
                tbl.Rows.Add(row);
            }

            using (SQLiteCommand cmdIndexes = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{2}] WHERE [type] LIKE 'index' AND [tbl_name] LIKE '{1}'", strCatalog, rdTables.GetString(2).Replace("'", "''"), master), this))
            using (SQLiteDataReader rdIndexes = cmdIndexes.ExecuteReader())
            {
              while (rdIndexes.Read())
              {
                int ordinal = 0;
                if (String.IsNullOrEmpty(strIndex) || String.Compare(strIndex, rdIndexes.GetString(1), StringComparison.OrdinalIgnoreCase) == 0)
                {
                  try
                  {
                    using (SQLiteCommand cmdIndex = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_info([{1}])", strCatalog, rdIndexes.GetString(1)), this))
                    using (SQLiteDataReader rdIndex = cmdIndex.ExecuteReader())
                    {
                      while (rdIndex.Read())
                      {
                        string columnName = rdIndex.IsDBNull(2) ? null : rdIndex.GetString(2);

                        row = tbl.NewRow();
                        row["CONSTRAINT_CATALOG"] = strCatalog;
                        row["CONSTRAINT_NAME"] = rdIndexes.GetString(1);
                        row["TABLE_CATALOG"] = strCatalog;
                        row["TABLE_NAME"] = rdIndexes.GetString(2);
                        row["COLUMN_NAME"] = columnName;
                        row["INDEX_NAME"] = rdIndexes.GetString(1);
                        row["ORDINAL_POSITION"] = ordinal; // rdIndex.GetInt32(1);

                        string collationSequence = null;
                        int sortMode = 0;
                        int onError = 0;

                        if (columnName != null)
                          _sql.GetIndexColumnExtendedInfo(strCatalog, rdIndexes.GetString(1), columnName, ref sortMode, ref onError, ref collationSequence);

                        if (String.IsNullOrEmpty(collationSequence) == false)
                          row["COLLATION_NAME"] = collationSequence;

                        row["SORT_MODE"] = (sortMode == 0) ? "ASC" : "DESC";
                        row["CONFLICT_OPTION"] = onError;

                        ordinal++;

                        if ((strColumn == null) || String.Compare(strColumn, columnName, StringComparison.OrdinalIgnoreCase) == 0)
                          tbl.Rows.Add(row);
                      }
                    }
                  }
                  catch (SQLiteException)
                  {
                  }
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
      tbl.Columns.Add("COLLATION_SCHEMA", typeof(string));
      tbl.Columns.Add("COLLATION_NAME", typeof(string));
      tbl.Columns.Add("PRIMARY_KEY", typeof(bool));
      tbl.Columns.Add("EDM_TYPE", typeof(string));
      tbl.Columns.Add("AUTOINCREMENT", typeof(bool));
      tbl.Columns.Add("UNIQUE", typeof(bool));

      if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";

      string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb;
      
      tbl.BeginLoadData();

      using (SQLiteCommand cmdViews = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this))
      using (SQLiteDataReader rdViews = cmdViews.ExecuteReader())
      {
        while (rdViews.Read())
        {
          if (String.IsNullOrEmpty(strView) || String.Compare(strView, rdViews.GetString(2), StringComparison.OrdinalIgnoreCase) == 0)
          {
            using (SQLiteCommand cmdViewSelect = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdViews.GetString(2)), this))
            {
              strSql = rdViews.GetString(4).Replace('\r', ' ').Replace('\n', ' ').Replace('\t', ' ');
              n = CultureInfo.InvariantCulture.CompareInfo.IndexOf(strSql, " AS ", CompareOptions.IgnoreCase);
              if (n < 0)
                continue;

              strSql = strSql.Substring(n + 4);







|

|
|


|






|







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
      tbl.Columns.Add("COLLATION_SCHEMA", typeof(string));
      tbl.Columns.Add("COLLATION_NAME", typeof(string));
      tbl.Columns.Add("PRIMARY_KEY", typeof(bool));
      tbl.Columns.Add("EDM_TYPE", typeof(string));
      tbl.Columns.Add("AUTOINCREMENT", typeof(bool));
      tbl.Columns.Add("UNIQUE", typeof(bool));

      if (String.IsNullOrEmpty(strCatalog)) strCatalog = GetDefaultCatalogName();

      string master = GetMasterTableName(IsTemporaryCatalogName(strCatalog));

      tbl.BeginLoadData();

      using (SQLiteCommand cmdViews = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'view'", strCatalog, master), this))
      using (SQLiteDataReader rdViews = cmdViews.ExecuteReader())
      {
        while (rdViews.Read())
        {
          if (String.IsNullOrEmpty(strView) || String.Compare(strView, rdViews.GetString(2), StringComparison.OrdinalIgnoreCase) == 0)
          {
            using (SQLiteCommand cmdViewSelect = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdViews.GetString(2)), this))
            {
              strSql = rdViews.GetString(4).Replace('\r', ' ').Replace('\n', ' ').Replace('\t', ' ');
              n = CultureInfo.InvariantCulture.CompareInfo.IndexOf(strSql, " AS ", CompareOptions.IgnoreCase);
              if (n < 0)
                continue;

              strSql = strSql.Substring(n + 4);
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
                    row["COLUMN_NAME"] = schemaRow[SchemaTableColumn.BaseColumnName];
                    row["VIEW_COLUMN_NAME"] = viewRow[SchemaTableColumn.ColumnName];
                    row["COLUMN_HASDEFAULT"] = (viewRow[SchemaTableOptionalColumn.DefaultValue] != DBNull.Value);
                    row["COLUMN_DEFAULT"] = viewRow[SchemaTableOptionalColumn.DefaultValue];
                    row["ORDINAL_POSITION"] = viewRow[SchemaTableColumn.ColumnOrdinal];
                    row["IS_NULLABLE"] = viewRow[SchemaTableColumn.AllowDBNull];
                    row["DATA_TYPE"] = viewRow["DataTypeName"]; // SQLiteConvert.DbTypeToType((DbType)viewRow[SchemaTableColumn.ProviderType]).ToString();
                    row["EDM_TYPE"] = SQLiteConvert.DbTypeToTypeName((DbType)viewRow[SchemaTableColumn.ProviderType]).ToString().ToLower(CultureInfo.InvariantCulture);
                    row["CHARACTER_MAXIMUM_LENGTH"] = viewRow[SchemaTableColumn.ColumnSize];
                    row["TABLE_SCHEMA"] = viewRow[SchemaTableColumn.BaseSchemaName];
                    row["PRIMARY_KEY"] = viewRow[SchemaTableColumn.IsKey];
                    row["AUTOINCREMENT"] = viewRow[SchemaTableOptionalColumn.IsAutoIncrement];
                    row["COLLATION_NAME"] = viewRow["CollationType"];
                    row["UNIQUE"] = viewRow[SchemaTableColumn.IsUnique];
                    tbl.Rows.Add(row);







|







7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
                    row["COLUMN_NAME"] = schemaRow[SchemaTableColumn.BaseColumnName];
                    row["VIEW_COLUMN_NAME"] = viewRow[SchemaTableColumn.ColumnName];
                    row["COLUMN_HASDEFAULT"] = (viewRow[SchemaTableOptionalColumn.DefaultValue] != DBNull.Value);
                    row["COLUMN_DEFAULT"] = viewRow[SchemaTableOptionalColumn.DefaultValue];
                    row["ORDINAL_POSITION"] = viewRow[SchemaTableColumn.ColumnOrdinal];
                    row["IS_NULLABLE"] = viewRow[SchemaTableColumn.AllowDBNull];
                    row["DATA_TYPE"] = viewRow["DataTypeName"]; // SQLiteConvert.DbTypeToType((DbType)viewRow[SchemaTableColumn.ProviderType]).ToString();
                    row["EDM_TYPE"] = SQLiteConvert.DbTypeToTypeName(this, (DbType)viewRow[SchemaTableColumn.ProviderType], _flags).ToString().ToLower(CultureInfo.InvariantCulture);
                    row["CHARACTER_MAXIMUM_LENGTH"] = viewRow[SchemaTableColumn.ColumnSize];
                    row["TABLE_SCHEMA"] = viewRow[SchemaTableColumn.BaseSchemaName];
                    row["PRIMARY_KEY"] = viewRow[SchemaTableColumn.IsKey];
                    row["AUTOINCREMENT"] = viewRow[SchemaTableOptionalColumn.IsAutoIncrement];
                    row["COLLATION_NAME"] = viewRow["CollationType"];
                    row["UNIQUE"] = viewRow[SchemaTableColumn.IsUnique];
                    tbl.Rows.Add(row);
2088
2089
2090
2091
2092
2093
2094

2095
2096
2097
2098
2099
2100



2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132

2133
2134
2135
2136
2137



2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157






































































































2158
2159
2160
2161
2162
2163
2164


2165
2166
2167
2168
2169
2170
2171
2172
2173


2174
2175
2176
2177
2178
2179
2180
2181
2182

















































































































































2183






2184


2185
2186
2187
2188
2189
2190

2191

















2192
2193
2194
2195
2196
2197
2198
2199


2200
2201
2202
2203
2204
2205
2206
2207
2208


2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219







2220






























































































































































































2221
2222
2223
2224
2225


2226
2227
2228
2229
2230
2231
2232
2233
2234


2235
2236
2237
2238
2239
2240
2241
2242
2243


2244

2245
2246
2247


2248

2249
2250

2251






























2252


2253



2254


















2255
2256
2257
2258
2259
2260
2261
      tbl.Columns.Add("CONSTRAINT_NAME", typeof(string));
      tbl.Columns.Add("TABLE_CATALOG", typeof(string));
      tbl.Columns.Add("TABLE_SCHEMA", typeof(string));
      tbl.Columns.Add("TABLE_NAME", typeof(string));
      tbl.Columns.Add("CONSTRAINT_TYPE", typeof(string));
      tbl.Columns.Add("IS_DEFERRABLE", typeof(bool));
      tbl.Columns.Add("INITIALLY_DEFERRED", typeof(bool));

      tbl.Columns.Add("FKEY_FROM_COLUMN", typeof(string));
      tbl.Columns.Add("FKEY_FROM_ORDINAL_POSITION", typeof(int));
      tbl.Columns.Add("FKEY_TO_CATALOG", typeof(string));
      tbl.Columns.Add("FKEY_TO_SCHEMA", typeof(string));
      tbl.Columns.Add("FKEY_TO_TABLE", typeof(string));
      tbl.Columns.Add("FKEY_TO_COLUMN", typeof(string));




      if (String.IsNullOrEmpty(strCatalog)) strCatalog = "main";

      string master = (String.Compare(strCatalog, "temp", StringComparison.OrdinalIgnoreCase) == 0) ? _tempmasterdb : _masterdb;

      tbl.BeginLoadData();

      using (SQLiteCommand cmdTables = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
      using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())
      {
        while (rdTables.Read())
        {
          if (String.IsNullOrEmpty(strTable) || String.Compare(strTable, rdTables.GetString(2), StringComparison.OrdinalIgnoreCase) == 0)
          {
            try
            {
              using (SQLiteCommandBuilder builder = new SQLiteCommandBuilder())
              //using (SQLiteCommand cmdTable = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}]", strCatalog, rdTables.GetString(2)), this))
              //using (SQLiteDataReader rdTable = cmdTable.ExecuteReader(CommandBehavior.SchemaOnly))
              using (SQLiteCommand cmdKey = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].foreign_key_list([{1}])", strCatalog, rdTables.GetString(2)), this))
              using (SQLiteDataReader rdKey = cmdKey.ExecuteReader())
              {
                while (rdKey.Read())
                {
                  row = tbl.NewRow();
                  row["CONSTRAINT_CATALOG"] = strCatalog;
                  row["CONSTRAINT_NAME"] = String.Format(CultureInfo.InvariantCulture, "FK_{0}_{1}", rdTables[2], rdKey.GetInt32(0));
                  row["TABLE_CATALOG"] = strCatalog;
                  row["TABLE_NAME"] = builder.UnquoteIdentifier(rdTables.GetString(2));
                  row["CONSTRAINT_TYPE"] = "FOREIGN KEY";
                  row["IS_DEFERRABLE"] = false;
                  row["INITIALLY_DEFERRED"] = false;

                  row["FKEY_FROM_COLUMN"] = builder.UnquoteIdentifier(rdKey[3].ToString());
                  row["FKEY_TO_CATALOG"] = strCatalog;
                  row["FKEY_TO_TABLE"] = builder.UnquoteIdentifier(rdKey[2].ToString());
                  row["FKEY_TO_COLUMN"] = builder.UnquoteIdentifier(rdKey[4].ToString());
                  row["FKEY_FROM_ORDINAL_POSITION"] = rdKey[1];




                  if (String.IsNullOrEmpty(strKeyName) || String.Compare(strKeyName, row["CONSTRAINT_NAME"].ToString(), StringComparison.OrdinalIgnoreCase) == 0)
                    tbl.Rows.Add(row);
                }
              }
            }
            catch (SQLiteException)
            {
            }
          }
        }
      }

      tbl.EndLoadData();
      tbl.AcceptChanges();

      return tbl;
    }

    /// <summary>






































































































    /// This event is raised whenever SQLite makes an update/delete/insert into the database on
    /// this connection.  It only applies to the given connection.
    /// </summary>
    public event SQLiteUpdateEventHandler Update
    {
      add
      {


        if (_updateHandler == null)
        {
          _updateCallback = new SQLiteUpdateCallback(UpdateCallback);
          if (_sql != null) _sql.SetUpdateHook(_updateCallback);
        }
        _updateHandler += value;
      }
      remove
      {


        _updateHandler -= value;
        if (_updateHandler == null)
        {
          if (_sql != null) _sql.SetUpdateHook(null);
          _updateCallback = null;
        }
      }
    }


















































































































































    private void UpdateCallback(IntPtr puser, int type, IntPtr database, IntPtr table, Int64 rowid)






    {


      _updateHandler(this, new UpdateEventArgs(
        SQLiteBase.UTF8ToString(database, -1),
        SQLiteBase.UTF8ToString(table, -1),
        (UpdateEventType)type,
        rowid));
    }



















    /// <summary>
    /// This event is raised whenever SQLite is committing a transaction.
    /// Return non-zero to trigger a rollback
    /// </summary>
    public event SQLiteCommitHandler Commit
    {
      add
      {


        if (_commitHandler == null)
        {
          _commitCallback = new SQLiteCommitCallback(CommitCallback);
          if (_sql != null) _sql.SetCommitHook(_commitCallback);
        }
        _commitHandler += value;
      }
      remove
      {


        _commitHandler -= value;
        if (_commitHandler == null)
        {
          if (_sql != null) _sql.SetCommitHook(null);
          _commitCallback = null;
        }
      }
    }

    /// <summary>
    /// This event is raised whenever SQLite is committing a transaction.







    /// Return non-zero to trigger a rollback






























































































































































































    /// </summary>
    public event EventHandler RollBack
    {
      add
      {


        if (_rollbackHandler == null)
        {
          _rollbackCallback = new SQLiteRollbackCallback(RollbackCallback);
          if (_sql != null) _sql.SetRollbackHook(_rollbackCallback);
        }
        _rollbackHandler += value;
      }
      remove
      {


        _rollbackHandler -= value;
        if (_rollbackHandler == null)
        {
          if (_sql != null) _sql.SetRollbackHook(null);
          _rollbackCallback = null;
        }
      }
    }





    private int CommitCallback(IntPtr parg)
    {
      CommitEventArgs e = new CommitEventArgs();


      _commitHandler(this, e);

      return (e.AbortTransaction == true) ? 1 : 0;
    }
































    private void RollbackCallback(IntPtr parg)


    {



      _rollbackHandler(this, EventArgs.Empty);


















    }
  }

  /// <summary>
  /// The I/O file cache flushing behavior for the connection
  /// </summary>
  public enum SynchronizationModes







>






>
>
>

|

|



|









<
<
|






|





>





>
>
>




















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







>
>









>
>









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

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


|





>
>









>
>










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





>
>









>
>









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

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







7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567


7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
      tbl.Columns.Add("CONSTRAINT_NAME", typeof(string));
      tbl.Columns.Add("TABLE_CATALOG", typeof(string));
      tbl.Columns.Add("TABLE_SCHEMA", typeof(string));
      tbl.Columns.Add("TABLE_NAME", typeof(string));
      tbl.Columns.Add("CONSTRAINT_TYPE", typeof(string));
      tbl.Columns.Add("IS_DEFERRABLE", typeof(bool));
      tbl.Columns.Add("INITIALLY_DEFERRED", typeof(bool));
      tbl.Columns.Add("FKEY_ID", typeof(int));
      tbl.Columns.Add("FKEY_FROM_COLUMN", typeof(string));
      tbl.Columns.Add("FKEY_FROM_ORDINAL_POSITION", typeof(int));
      tbl.Columns.Add("FKEY_TO_CATALOG", typeof(string));
      tbl.Columns.Add("FKEY_TO_SCHEMA", typeof(string));
      tbl.Columns.Add("FKEY_TO_TABLE", typeof(string));
      tbl.Columns.Add("FKEY_TO_COLUMN", typeof(string));
      tbl.Columns.Add("FKEY_ON_UPDATE", typeof(string));
      tbl.Columns.Add("FKEY_ON_DELETE", typeof(string));
      tbl.Columns.Add("FKEY_MATCH", typeof(string));

      if (String.IsNullOrEmpty(strCatalog)) strCatalog = GetDefaultCatalogName();

      string master = GetMasterTableName(IsTemporaryCatalogName(strCatalog));

      tbl.BeginLoadData();

      using (SQLiteCommand cmdTables = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT * FROM [{0}].[{1}] WHERE [type] LIKE 'table'", strCatalog, master), this))
      using (SQLiteDataReader rdTables = cmdTables.ExecuteReader())
      {
        while (rdTables.Read())
        {
          if (String.IsNullOrEmpty(strTable) || String.Compare(strTable, rdTables.GetString(2), StringComparison.OrdinalIgnoreCase) == 0)
          {
            try
            {
              using (SQLiteCommandBuilder builder = new SQLiteCommandBuilder())


              using (SQLiteCommand cmdKey = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].foreign_key_list([{1}])", strCatalog, rdTables.GetString(2)), this))
              using (SQLiteDataReader rdKey = cmdKey.ExecuteReader())
              {
                while (rdKey.Read())
                {
                  row = tbl.NewRow();
                  row["CONSTRAINT_CATALOG"] = strCatalog;
                  row["CONSTRAINT_NAME"] = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "FK_{0}_{1}_{2}", rdTables[2], rdKey.GetInt32(0), rdKey.GetInt32(1));
                  row["TABLE_CATALOG"] = strCatalog;
                  row["TABLE_NAME"] = builder.UnquoteIdentifier(rdTables.GetString(2));
                  row["CONSTRAINT_TYPE"] = "FOREIGN KEY";
                  row["IS_DEFERRABLE"] = false;
                  row["INITIALLY_DEFERRED"] = false;
                  row["FKEY_ID"] = rdKey[0];
                  row["FKEY_FROM_COLUMN"] = builder.UnquoteIdentifier(rdKey[3].ToString());
                  row["FKEY_TO_CATALOG"] = strCatalog;
                  row["FKEY_TO_TABLE"] = builder.UnquoteIdentifier(rdKey[2].ToString());
                  row["FKEY_TO_COLUMN"] = builder.UnquoteIdentifier(rdKey[4].ToString());
                  row["FKEY_FROM_ORDINAL_POSITION"] = rdKey[1];
                  row["FKEY_ON_UPDATE"] = (rdKey.FieldCount > 5) ? rdKey[5] : String.Empty;
                  row["FKEY_ON_DELETE"] = (rdKey.FieldCount > 6) ? rdKey[6] : String.Empty;
                  row["FKEY_MATCH"] = (rdKey.FieldCount > 7) ? rdKey[7] : String.Empty;

                  if (String.IsNullOrEmpty(strKeyName) || String.Compare(strKeyName, row["CONSTRAINT_NAME"].ToString(), StringComparison.OrdinalIgnoreCase) == 0)
                    tbl.Rows.Add(row);
                }
              }
            }
            catch (SQLiteException)
            {
            }
          }
        }
      }

      tbl.EndLoadData();
      tbl.AcceptChanges();

      return tbl;
    }

    /// <summary>
    /// This event is raised periodically during long running queries.  Changing
    /// the value of the <see cref="BusyEventArgs.ReturnCode" /> property will
    /// determine if the database operation will be retried or stopped.  For the
    /// entire duration of the event, the associated connection and statement
    /// objects must not be modified, either directly or indirectly, by the
    /// called code.
    /// </summary>
    public event SQLiteBusyEventHandler Busy
    {
        add
        {
            CheckDisposed();

            if (_busyHandler == null)
            {
                _busyCallback = new SQLiteBusyCallback(BusyCallback);
                if (_sql != null) _sql.SetBusyHook(_busyCallback);
            }
            _busyHandler += value;
        }
        remove
        {
            CheckDisposed();

            _busyHandler -= value;
            if (_busyHandler == null)
            {
                if (_sql != null) _sql.SetBusyHook(null);
                _busyCallback = null;
            }
        }
    }

    /// <summary>
    /// This event is raised periodically during long running queries.  Changing
    /// the value of the <see cref="ProgressEventArgs.ReturnCode" /> property will
    /// determine if the operation in progress will continue or be interrupted.
    /// For the entire duration of the event, the associated connection and
    /// statement objects must not be modified, either directly or indirectly, by
    /// the called code.
    /// </summary>
    public event SQLiteProgressEventHandler Progress
    {
        add
        {
            CheckDisposed();

            if (_progressHandler == null)
            {
                _progressCallback = new SQLiteProgressCallback(ProgressCallback);
                if (_sql != null) _sql.SetProgressHook(_progressOps, _progressCallback);
            }
            _progressHandler += value;
        }
        remove
        {
            CheckDisposed();

            _progressHandler -= value;
            if (_progressHandler == null)
            {
                if (_sql != null) _sql.SetProgressHook(0, null);
                _progressCallback = null;
            }
        }
    }

    /// <summary>
    /// This event is raised whenever SQLite encounters an action covered by the
    /// authorizer during query preparation.  Changing the value of the
    /// <see cref="AuthorizerEventArgs.ReturnCode" /> property will determine if
    /// the specific action will be allowed, ignored, or denied.  For the entire
    /// duration of the event, the associated connection and statement objects
    /// must not be modified, either directly or indirectly, by the called code.
    /// </summary>
    public event SQLiteAuthorizerEventHandler Authorize
    {
        add
        {
            CheckDisposed();

            if (_authorizerHandler == null)
            {
                _authorizerCallback = new SQLiteAuthorizerCallback(AuthorizerCallback);
                if (_sql != null) _sql.SetAuthorizerHook(_authorizerCallback);
            }
            _authorizerHandler += value;
        }
        remove
        {
            CheckDisposed();

            _authorizerHandler -= value;
            if (_authorizerHandler == null)
            {
                if (_sql != null) _sql.SetAuthorizerHook(null);
                _authorizerCallback = null;
            }
        }
    }

    /// <summary>
    /// This event is raised whenever SQLite makes an update/delete/insert into the database on
    /// this connection.  It only applies to the given connection.
    /// </summary>
    public event SQLiteUpdateEventHandler Update
    {
      add
      {
        CheckDisposed();

        if (_updateHandler == null)
        {
          _updateCallback = new SQLiteUpdateCallback(UpdateCallback);
          if (_sql != null) _sql.SetUpdateHook(_updateCallback);
        }
        _updateHandler += value;
      }
      remove
      {
        CheckDisposed();

        _updateHandler -= value;
        if (_updateHandler == null)
        {
          if (_sql != null) _sql.SetUpdateHook(null);
          _updateCallback = null;
        }
      }
    }

    private SQLiteBusyReturnCode BusyCallback(
        IntPtr pUserData, /* NOT USED: Always IntPtr.Zero. */
        int count
        )
    {
        try
        {
            BusyEventArgs eventArgs = new BusyEventArgs(
                pUserData, count, SQLiteBusyReturnCode.Retry);

            if (_busyHandler != null)
                _busyHandler(this, eventArgs);

            return eventArgs.ReturnCode;
        }
        catch (Exception e) /* NOTE: Must catch ALL. */
        {
            try
            {
                if (HelperMethods.LogCallbackExceptions(_flags))
                {
                    SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
                        UnsafeNativeMethods.ExceptionMessageFormat,
                        "Busy", e)); /* throw */
                }
            }
            catch
            {
                // do nothing.
            }
        }

        //
        // NOTE: Should throwing an exception interrupt the operation?
        //
        if (HelperMethods.HasFlags(
                _flags, SQLiteConnectionFlags.StopOnException))
        {
            return SQLiteBusyReturnCode.Stop;
        }
        else
        {
            return SQLiteBusyReturnCode.Retry;
        }
    }

    private SQLiteProgressReturnCode ProgressCallback(
        IntPtr pUserData /* NOT USED: Always IntPtr.Zero. */
        )
    {
        try
        {
            ProgressEventArgs eventArgs = new ProgressEventArgs(
                pUserData, SQLiteProgressReturnCode.Continue);

            if (_progressHandler != null)
                _progressHandler(this, eventArgs);

            return eventArgs.ReturnCode;
        }
        catch (Exception e) /* NOTE: Must catch ALL. */
        {
            try
            {
                if (HelperMethods.LogCallbackExceptions(_flags))
                {
                    SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
                        UnsafeNativeMethods.ExceptionMessageFormat,
                        "Progress", e)); /* throw */
                }
            }
            catch
            {
                // do nothing.
            }
        }

        //
        // NOTE: Should throwing an exception interrupt the operation?
        //
        if (HelperMethods.HasFlags(
                _flags, SQLiteConnectionFlags.InterruptOnException))
        {
            return SQLiteProgressReturnCode.Interrupt;
        }
        else
        {
            return SQLiteProgressReturnCode.Continue;
        }
    }

    private SQLiteAuthorizerReturnCode AuthorizerCallback(
        IntPtr pUserData, /* NOT USED: Always IntPtr.Zero. */
        SQLiteAuthorizerActionCode actionCode,
        IntPtr pArgument1,
        IntPtr pArgument2,
        IntPtr pDatabase,
        IntPtr pAuthContext)
    {
        try
        {
            AuthorizerEventArgs eventArgs = new AuthorizerEventArgs(pUserData, actionCode,
                SQLiteBase.UTF8ToString(pArgument1, -1), SQLiteBase.UTF8ToString(pArgument2, -1),
                SQLiteBase.UTF8ToString(pDatabase, -1), SQLiteBase.UTF8ToString(pAuthContext, -1),
                SQLiteAuthorizerReturnCode.Ok);

            if (_authorizerHandler != null)
                _authorizerHandler(this, eventArgs);

            return eventArgs.ReturnCode;
        }
        catch (Exception e) /* NOTE: Must catch ALL. */
        {
            try
            {
                if (HelperMethods.LogCallbackExceptions(_flags))
                {
                    SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
                        UnsafeNativeMethods.ExceptionMessageFormat,
                        "Authorize", e)); /* throw */
                }
            }
            catch
            {
                // do nothing.
            }
        }

        //
        // NOTE: Should throwing an exception deny the action?
        //
        if (HelperMethods.HasFlags(
                _flags, SQLiteConnectionFlags.DenyOnException))
        {
            return SQLiteAuthorizerReturnCode.Deny;
        }
        else
        {
            return SQLiteAuthorizerReturnCode.Ok;
        }
    }

    private void UpdateCallback(
        IntPtr puser, /* NOT USED */
        int type,
        IntPtr database,
        IntPtr table,
        Int64 rowid
        )
    {
        try
        {
            _updateHandler(this, new UpdateEventArgs(
              SQLiteBase.UTF8ToString(database, -1),
              SQLiteBase.UTF8ToString(table, -1),
              (UpdateEventType)type,
              rowid));
        }
        catch (Exception e) /* NOTE: Must catch ALL. */
        {
            try
            {
                if (HelperMethods.LogCallbackExceptions(_flags))
                {
                    SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
                        UnsafeNativeMethods.ExceptionMessageFormat,
                        "Update", e)); /* throw */
                }
            }
            catch
            {
                // do nothing.
            }
        }
    }

    /// <summary>
    /// This event is raised whenever SQLite is committing a transaction.
    /// Return non-zero to trigger a rollback.
    /// </summary>
    public event SQLiteCommitHandler Commit
    {
      add
      {
        CheckDisposed();

        if (_commitHandler == null)
        {
          _commitCallback = new SQLiteCommitCallback(CommitCallback);
          if (_sql != null) _sql.SetCommitHook(_commitCallback);
        }
        _commitHandler += value;
      }
      remove
      {
        CheckDisposed();

        _commitHandler -= value;
        if (_commitHandler == null)
        {
          if (_sql != null) _sql.SetCommitHook(null);
          _commitCallback = null;
        }
      }
    }

    /// <summary>
    /// This event is raised whenever SQLite statement first begins executing on
    /// this connection.  It only applies to the given connection.
    /// </summary>
    public event SQLiteTraceEventHandler Trace
    {
      add
      {
        CheckDisposed();

        if (_traceHandler == null)
        {
          _traceCallback = new SQLiteTraceCallback(TraceCallback);
          if (_sql != null) _sql.SetTraceCallback(_traceCallback);
        }
        _traceHandler += value;
      }
      remove
      {
        CheckDisposed();

        _traceHandler -= value;
        if (_traceHandler == null)
        {
          if (_sql != null) _sql.SetTraceCallback(null);
            _traceCallback = null;
        }
      }
    }

    /// <summary>
    /// This event is raised when events matching the configured mask are
    /// raised for this connection.
    /// </summary>
    public event SQLiteTraceEventHandler Trace2
    {
        add
        {
            CheckDisposed();

            if (_traceHandler2 == null)
            {
                if (_traceFlags == SQLiteTraceFlags.SQLITE_TRACE_NONE)
                {
                    throw new InvalidOperationException(
                        "cannot add trace2 event handler with no flags set");
                }

                _traceCallback2 = new SQLiteTraceCallback2(TraceCallback2);
                if (_sql != null) _sql.SetTraceCallback2(_traceFlags, _traceCallback2);
            }
            _traceHandler2 += value;
        }
        remove
        {
            CheckDisposed();

            _traceHandler2 -= value;
            if (_traceHandler2 == null)
            {
                if (_traceFlags == SQLiteTraceFlags.SQLITE_TRACE_NONE)
                {
                    throw new InvalidOperationException(
                        "cannot remove trace2 event handler with no flags set");
                }

                if (_sql != null) _sql.SetTraceCallback2(_traceFlags, null);
                _traceCallback2 = null;
            }
        }
    }

    private void TraceCallback(
        IntPtr pUser, /* NOT USED */
        IntPtr statement
        )
    {
        try
        {
            if (_traceHandler != null)
                _traceHandler(this, new TraceEventArgs(
                  SQLiteBase.UTF8ToString(statement, -1)));
        }
        catch (Exception e) /* NOTE: Must catch ALL. */
        {
            try
            {
                if (HelperMethods.LogCallbackExceptions(_flags))
                {
                    SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
                        UnsafeNativeMethods.ExceptionMessageFormat,
                        "Trace", e)); /* throw */
                }
            }
            catch
            {
                // do nothing.
            }
        }
    }

    private void TraceCallback2(
        SQLiteTraceFlags flags,
        IntPtr pUser, /* NOT USED */
        IntPtr pCtx1,
        IntPtr pCtx2
        )
    {
        try
        {
            if (_traceHandler2 != null)
            {
                TraceEventArgs eventArgs = null;

                switch (flags)
                {
                    case SQLiteTraceFlags.SQLITE_TRACE_NONE:
                        {
                            // nothing, no data
                            break;
                        }
                    case SQLiteTraceFlags.SQLITE_TRACE_STMT:
                        {
                            eventArgs = new TraceEventArgs(
                                flags, null, pCtx1, SQLiteBase.UTF8ToString(
                                pCtx2, -1), null);

                            break;
                        }
                    case SQLiteTraceFlags.SQLITE_TRACE_PROFILE:
                        {
                            eventArgs = new TraceEventArgs(
                                flags, null, pCtx1, null, Marshal.ReadInt64(
                                pCtx2));

                            break;
                        }
                    case SQLiteTraceFlags.SQLITE_TRACE_ROW:
                        {
                            eventArgs = new TraceEventArgs(
                                flags, null, pCtx1, null, null);

                            break;
                        }
                    case SQLiteTraceFlags.SQLITE_TRACE_CLOSE:
                        {
                            eventArgs = new TraceEventArgs(
                                flags, pCtx1, null, null, null);

                            break;
                        }
                }

                _traceHandler2(this, eventArgs);
            }
        }
        catch (Exception e) /* NOTE: Must catch ALL. */
        {
            try
            {
                if (HelperMethods.LogCallbackExceptions(_flags))
                {
                    SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
                        UnsafeNativeMethods.ExceptionMessageFormat,
                        "Trace2", e)); /* throw */
                }
            }
            catch
            {
                // do nothing.
            }
        }
    }

    /// <summary>
    /// This property is used to configure the set of events that may be raised
    /// from the <see cref="Trace2" /> event.  The value of this property cannot
    /// be changed while an event handler is registered.
    /// </summary>
    public SQLiteTraceFlags TraceFlags
    {
        get { CheckDisposed(); return _traceFlags; }
        set
        {
            CheckDisposed();

            if (_traceCallback2 != null)
            {
                throw new InvalidOperationException(
                    "cannot change trace flags while an event handler is registered");
            }

            _traceFlags = value;
        }
    }

    /// <summary>
    /// This event is raised whenever SQLite is rolling back a transaction.
    /// </summary>
    public event EventHandler RollBack
    {
      add
      {
        CheckDisposed();

        if (_rollbackHandler == null)
        {
          _rollbackCallback = new SQLiteRollbackCallback(RollbackCallback);
          if (_sql != null) _sql.SetRollbackHook(_rollbackCallback);
        }
        _rollbackHandler += value;
      }
      remove
      {
        CheckDisposed();

        _rollbackHandler -= value;
        if (_rollbackHandler == null)
        {
          if (_sql != null) _sql.SetRollbackHook(null);
          _rollbackCallback = null;
        }
      }
    }

    private int CommitCallback(
        IntPtr parg /* NOT USED */
        )
    {
        try
        {
            CommitEventArgs e = new CommitEventArgs();

            if (_commitHandler != null)
                _commitHandler(this, e);

            return (e.AbortTransaction == true) ? 1 : 0;
        }
        catch (Exception e) /* NOTE: Must catch ALL. */
        {
            try
            {
                if (HelperMethods.LogCallbackExceptions(_flags))
                {
                    SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
                        UnsafeNativeMethods.ExceptionMessageFormat,
                        "Commit", e)); /* throw */
                }
            }
            catch
            {
                // do nothing.
            }
        }

        //
        // NOTE: Should throwing an exception rollback the transaction?
        //
        if (HelperMethods.HasFlags(
                _flags, SQLiteConnectionFlags.RollbackOnException))
        {
            return 1; // rollback
        }
        else
        {
            return 0; // commit
        }
    }

    private void RollbackCallback(
        IntPtr parg /* NOT USED */
        )
    {
        try
        {
            if (_rollbackHandler != null)
                _rollbackHandler(this, EventArgs.Empty);
        }
        catch (Exception e) /* NOTE: Must catch ALL. */
        {
            try
            {
                if (HelperMethods.LogCallbackExceptions(_flags))
                {
                    SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
                        UnsafeNativeMethods.ExceptionMessageFormat,
                        "Rollback", e)); /* throw */
                }
            }
            catch
            {
                // do nothing.
            }
        }
    }
  }

  /// <summary>
  /// The I/O file cache flushing behavior for the connection
  /// </summary>
  public enum SynchronizationModes
2272
2273
2274
2275
2276
2277
2278
2279






















2280

2281
2282
2283
2284











2285
2286
2287
2288
2289
2290


























2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
























































































































































































































































































2305
2306
2307
2308
2309
2310
2311
    /// Use the default operating system's file flushing, SQLite does not explicitly flush the file buffers after writing
    /// </summary>
    Off = 2,
  }

#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif






















  internal delegate void SQLiteUpdateCallback(IntPtr puser, int type, IntPtr database, IntPtr table, Int64 rowid);

#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  internal delegate int SQLiteCommitCallback(IntPtr puser);











#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  internal delegate void SQLiteRollbackCallback(IntPtr puser);

  /// <summary>


























  /// Raised when a transaction is about to be committed.  To roll back a transaction, set the 
  /// rollbackTrans boolean value to true.
  /// </summary>
  /// <param name="sender">The connection committing the transaction</param>
  /// <param name="e">Event arguments on the transaction</param>
  public delegate void SQLiteCommitHandler(object sender, CommitEventArgs e);

  /// <summary>
  /// Raised when data is inserted, updated and deleted on a given connection
  /// </summary>
  /// <param name="sender">The connection committing the transaction</param>
  /// <param name="e">The event parameters which triggered the event</param>
  public delegate void SQLiteUpdateEventHandler(object sender, UpdateEventArgs e);

























































































































































































































































































  /// <summary>
  /// Whenever an update event is triggered on a connection, this enum will indicate
  /// exactly what type of operation is being performed.
  /// </summary>
  public enum UpdateEventType
  {
    /// <summary>








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

>




>
>
>
>
>
>
>
>
>
>
>






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













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







8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
    /// Use the default operating system's file flushing, SQLite does not explicitly flush the file buffers after writing
    /// </summary>
    Off = 2,
  }

#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  internal delegate SQLiteBusyReturnCode SQLiteBusyCallback(IntPtr pUserData, int count);

#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  internal delegate SQLiteProgressReturnCode SQLiteProgressCallback(IntPtr pUserData);

#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  internal delegate SQLiteAuthorizerReturnCode SQLiteAuthorizerCallback(
    IntPtr pUserData,
    SQLiteAuthorizerActionCode actionCode,
    IntPtr pArgument1,
    IntPtr pArgument2,
    IntPtr pDatabase,
    IntPtr pAuthContext
    );

#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  internal delegate void SQLiteUpdateCallback(IntPtr puser, int type, IntPtr database, IntPtr table, Int64 rowid);

#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  internal delegate int SQLiteCommitCallback(IntPtr puser);

#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  internal delegate void SQLiteTraceCallback(IntPtr puser, IntPtr statement);

#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  internal delegate void SQLiteTraceCallback2(SQLiteTraceFlags type, IntPtr puser, IntPtr pCtx1, IntPtr pCtx2);

#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  internal delegate void SQLiteRollbackCallback(IntPtr puser);

  /// <summary>
  /// </summary>
  /// <param name="sender">The connection performing the operation.</param>
  /// <param name="e">A <see cref="BusyEventArgs" /> that contains the event
  /// data.</param>
  public delegate void SQLiteBusyEventHandler(object sender, BusyEventArgs e);

  /// <summary>
  /// Raised each time the number of virtual machine instructions is
  /// approximately equal to the value of the
  /// <see cref="SQLiteConnection.ProgressOps" /> property.
  /// </summary>
  /// <param name="sender">The connection performing the operation.</param>
  /// <param name="e">A <see cref="ProgressEventArgs" /> that contains the
  /// event data.</param>
  public delegate void SQLiteProgressEventHandler(object sender, ProgressEventArgs e);

  /// <summary>
  /// Raised when authorization is required to perform an action contained
  /// within a SQL query.
  /// </summary>
  /// <param name="sender">The connection performing the action.</param>
  /// <param name="e">A <see cref="AuthorizerEventArgs" /> that contains the
  /// event data.</param>
  public delegate void SQLiteAuthorizerEventHandler(object sender, AuthorizerEventArgs e);

  /// <summary>
  /// Raised when a transaction is about to be committed.  To roll back a transaction, set the
  /// rollbackTrans boolean value to true.
  /// </summary>
  /// <param name="sender">The connection committing the transaction</param>
  /// <param name="e">Event arguments on the transaction</param>
  public delegate void SQLiteCommitHandler(object sender, CommitEventArgs e);

  /// <summary>
  /// Raised when data is inserted, updated and deleted on a given connection
  /// </summary>
  /// <param name="sender">The connection committing the transaction</param>
  /// <param name="e">The event parameters which triggered the event</param>
  public delegate void SQLiteUpdateEventHandler(object sender, UpdateEventArgs e);

  /// <summary>
  /// Raised when a statement first begins executing on a given connection
  /// </summary>
  /// <param name="sender">The connection executing the statement</param>
  /// <param name="e">Event arguments of the trace</param>
  public delegate void SQLiteTraceEventHandler(object sender, TraceEventArgs e);

  ///////////////////////////////////////////////////////////////////////////////////////////////

  #region Backup API Members
  /// <summary>
  /// Raised between each backup step.
  /// </summary>
  /// <param name="source">
  /// The source database connection.
  /// </param>
  /// <param name="sourceName">
  /// The source database name.
  /// </param>
  /// <param name="destination">
  /// The destination database connection.
  /// </param>
  /// <param name="destinationName">
  /// The destination database name.
  /// </param>
  /// <param name="pages">
  /// The number of pages copied with each step.
  /// </param>
  /// <param name="remainingPages">
  /// The number of pages remaining to be copied.
  /// </param>
  /// <param name="totalPages">
  /// The total number of pages in the source database.
  /// </param>
  /// <param name="retry">
  /// Set to true if the operation needs to be retried due to database
  /// locking issues; otherwise, set to false.
  /// </param>
  /// <returns>
  /// True to continue with the backup process or false to halt the backup
  /// process, rolling back any changes that have been made so far.
  /// </returns>
  public delegate bool SQLiteBackupCallback(
    SQLiteConnection source,
    string sourceName,
    SQLiteConnection destination,
    string destinationName,
    int pages,
    int remainingPages,
    int totalPages,
    bool retry
  );
  #endregion

  ///////////////////////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// The event data associated with "database is busy" events.
  /// </summary>
  public class BusyEventArgs : EventArgs
  {
      /// <summary>
      /// The user-defined native data associated with this event.  Currently,
      /// this will always contain the value of <see cref="IntPtr.Zero" />.
      /// </summary>
      public readonly IntPtr UserData;

      /// <summary>
      /// The number of times the current database operation has been retried
      /// so far.
      /// </summary>
      public readonly int Count;

      /// <summary>
      /// The return code for the current call into the busy callback.
      /// </summary>
      public SQLiteBusyReturnCode ReturnCode;

      /// <summary>
      /// Constructs an instance of this class with default property values.
      /// </summary>
      private BusyEventArgs()
      {
          this.UserData = IntPtr.Zero;
          this.Count = 0;
          this.ReturnCode = SQLiteBusyReturnCode.Retry;
      }

      /// <summary>
      /// Constructs an instance of this class with specific property values.
      /// </summary>
      /// <param name="pUserData">
      /// The user-defined native data associated with this event.
      /// </param>
      /// <param name="count">
      /// The number of times the current database operation has been retried
      /// so far.
      /// </param>
      /// <param name="returnCode">
      /// The busy return code.
      /// </param>
      internal BusyEventArgs(
          IntPtr pUserData,
          int count,
          SQLiteBusyReturnCode returnCode
          )
          : this()
      {
          this.UserData = pUserData;
          this.Count = count;
          this.ReturnCode = returnCode;
      }
  }

  ///////////////////////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// The event data associated with progress reporting events.
  /// </summary>
  public class ProgressEventArgs : EventArgs
  {
      /// <summary>
      /// The user-defined native data associated with this event.  Currently,
      /// this will always contain the value of <see cref="IntPtr.Zero" />.
      /// </summary>
      public readonly IntPtr UserData;

      /// <summary>
      /// The return code for the current call into the progress callback.
      /// </summary>
      public SQLiteProgressReturnCode ReturnCode;

      /// <summary>
      /// Constructs an instance of this class with default property values.
      /// </summary>
      private ProgressEventArgs()
      {
          this.UserData = IntPtr.Zero;
          this.ReturnCode = SQLiteProgressReturnCode.Continue;
      }

      /// <summary>
      /// Constructs an instance of this class with specific property values.
      /// </summary>
      /// <param name="pUserData">
      /// The user-defined native data associated with this event.
      /// </param>
      /// <param name="returnCode">
      /// The progress return code.
      /// </param>
      internal ProgressEventArgs(
          IntPtr pUserData,
          SQLiteProgressReturnCode returnCode
          )
          : this()
      {
          this.UserData = pUserData;
          this.ReturnCode = returnCode;
      }
  }

  ///////////////////////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// The data associated with a call into the authorizer.
  /// </summary>
  public class AuthorizerEventArgs : EventArgs
  {
      /// <summary>
      /// The user-defined native data associated with this event.  Currently,
      /// this will always contain the value of <see cref="IntPtr.Zero" />.
      /// </summary>
      public readonly IntPtr UserData;

      /// <summary>
      /// The action code responsible for the current call into the authorizer.
      /// </summary>
      public readonly SQLiteAuthorizerActionCode ActionCode;

      /// <summary>
      /// The first string argument for the current call into the authorizer.
      /// The exact value will vary based on the action code, see the
      /// <see cref="SQLiteAuthorizerActionCode" /> enumeration for possible
      /// values.
      /// </summary>
      public readonly string Argument1;

      /// <summary>
      /// The second string argument for the current call into the authorizer.
      /// The exact value will vary based on the action code, see the
      /// <see cref="SQLiteAuthorizerActionCode" /> enumeration for possible
      /// values.
      /// </summary>
      public readonly string Argument2;

      /// <summary>
      /// The database name for the current call into the authorizer, if
      /// applicable.
      /// </summary>
      public readonly string Database;

      /// <summary>
      /// The name of the inner-most trigger or view that is responsible for
      /// the access attempt or a null value if this access attempt is directly
      /// from top-level SQL code.
      /// </summary>
      public readonly string Context;

      /// <summary>
      /// The return code for the current call into the authorizer.
      /// </summary>
      public SQLiteAuthorizerReturnCode ReturnCode;

      ///////////////////////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Constructs an instance of this class with default property values.
      /// </summary>
      private AuthorizerEventArgs()
      {
          this.UserData = IntPtr.Zero;
          this.ActionCode = SQLiteAuthorizerActionCode.None;
          this.Argument1 = null;
          this.Argument2 = null;
          this.Database = null;
          this.Context = null;
          this.ReturnCode = SQLiteAuthorizerReturnCode.Ok;
      }

      ///////////////////////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Constructs an instance of this class with specific property values.
      /// </summary>
      /// <param name="pUserData">
      /// The user-defined native data associated with this event.
      /// </param>
      /// <param name="actionCode">
      /// The authorizer action code.
      /// </param>
      /// <param name="argument1">
      /// The first authorizer argument.
      /// </param>
      /// <param name="argument2">
      /// The second authorizer argument.
      /// </param>
      /// <param name="database">
      /// The database name, if applicable.
      /// </param>
      /// <param name="context">
      /// The name of the inner-most trigger or view that is responsible for
      /// the access attempt or a null value if this access attempt is directly
      /// from top-level SQL code.
      /// </param>
      /// <param name="returnCode">
      /// The authorizer return code.
      /// </param>
      internal AuthorizerEventArgs(
          IntPtr pUserData,
          SQLiteAuthorizerActionCode actionCode,
          string argument1,
          string argument2,
          string database,
          string context,
          SQLiteAuthorizerReturnCode returnCode
          )
          : this()
      {
          this.UserData = pUserData;
          this.ActionCode = actionCode;
          this.Argument1 = argument1;
          this.Argument2 = argument2;
          this.Database = database;
          this.Context = context;
          this.ReturnCode = returnCode;
      }
  }

  ///////////////////////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// Whenever an update event is triggered on a connection, this enum will indicate
  /// exactly what type of operation is being performed.
  /// </summary>
  public enum UpdateEventType
  {
    /// <summary>
2368
2369
2370
2371
2372
2373
2374









2375










































    /// <summary>
    /// Set to true to abort the transaction and trigger a rollback
    /// </summary>
    public bool AbortTransaction;
  }










}
















































>
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759

    /// <summary>
    /// Set to true to abort the transaction and trigger a rollback
    /// </summary>
    public bool AbortTransaction;
  }

  /// <summary>
  /// Passed during an Trace callback, these event arguments contain the UTF-8 rendering of the SQL statement text
  /// </summary>
  public class TraceEventArgs : EventArgs
  {
    /// <summary>
    /// The flags associated with this trace event.
    /// </summary>
    public readonly SQLiteTraceFlags? Flags;

    /// <summary>
    /// Database connection associated with this event.
    /// </summary>
    public readonly IntPtr? DatabaseConnection;

    /// <summary>
    /// Prepared statement associated with this event.
    /// </summary>
    public readonly IntPtr? PreparedStatement;

    /// <summary>
    /// SQL statement text as the statement first begins executing
    /// </summary>
    public readonly string Statement;

    /// <summary>
    /// Elapsed time in nanoseconds associated with the prepared statement.
    /// </summary>
    public readonly long? Elapsed;

    internal TraceEventArgs(string statement)
    {
      Statement = statement;
    }

    internal TraceEventArgs(
        SQLiteTraceFlags? flags,
        IntPtr? databaseConnection,
        IntPtr? preparedStatement,
        string statement,
        long? elapsed
        )
    {
      Flags = flags;
      DatabaseConnection = databaseConnection;
      PreparedStatement = preparedStatement;
      Elapsed = elapsed;
      Statement = statement;
    }
  }
}

Changes to System.Data.SQLite/SQLiteConnectionPool.cs.

1
2
3
4
5
6
7
8
9
10
11









































































12


























13





14
15
16






17


18


19


20
21


22








23





24

25

26
















27

28






29

30







































































































31



32










33




































34









35









36


37






38



39

40



















































41



42

















43






44








































45

46






47

48







49

50








51












52
53

54
55

56
























57





58

59







60

61



62


63

64





















































65





66

67









68



69

70







71























72



73


































































74





75

76







77






78

79





80

81





82

83




















84
85
86

87










88

89




90

91


























































































































92


































93


94



95

96


97

98






99


100


101









102















































103

104






105

106
107



























































































































































































































108

















































109


110
111
112


113


114

115
116


117
118
119

















































































































































































120
121
122
123
124
125
126
127





128
129
130




131
132




133
134
135
136


137




138
139

140

141











142
143

144
145


































































































































146

147




148





149


































150


151


152

153

154
155




156





157
158
159


160








161

162















































163



164

165


166


167



168

169

























170
171
172






173
174
















175
176
177
178



179


180



















181




182


183










184


























185



186


































































187



188
189
190



191

















































192


193

194







195
196
197

198
























































199
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Collections.Generic;




































































































  internal static class SQLiteConnectionPool





  {
    /// <summary>
    /// Keeps track of connections made on a specified file.  The PoolVersion dictates whether old objects get






    /// returned to the pool or discarded when no longer in use.


    /// </summary>


    internal class Pool


    {
      internal readonly Queue<WeakReference> Queue = new Queue<WeakReference>();


      internal int PoolVersion;








      internal int MaxPoolSize;







      internal Pool(int version, int maxSize)

      {
















        PoolVersion = version;

        MaxPoolSize = maxSize;






      }

    }











































































































    /// <summary>










    /// The connection pool object




































    /// </summary>









    private static SortedList<string, Pool> _connections = new SortedList<string, Pool>(StringComparer.OrdinalIgnoreCase);












    /// <summary>






    /// The default version number new pools will get



    /// </summary>

    private static int _poolVersion = 1;























































    /// <summary>

















    /// Attempt to pull a pooled connection out of the queue for active duty






    /// </summary>








































    /// <param name="fileName">The filename for a desired connection</param>

    /// <param name="maxPoolSize">The maximum size the connection pool for the filename can be</param>






    /// <param name="version">The pool version the returned connection will belong to</param>

    /// <returns>Returns NULL if no connections were available.  Even if none are, the poolversion will still be a valid pool version</returns>







    internal static SQLiteConnectionHandle Remove(string fileName, int maxPoolSize, out int version)

    {








      lock (_connections)












      {
        Pool queue;


        // Default to the highest pool version

        version = _poolVersion;






























        // If we didn't find a pool for this file, create one even though it will be empty.

        // We have to do this here because otherwise calling ClearPool() on the file will not work for active connections







        // that have never seen the pool yet.

        if (_connections.TryGetValue(fileName, out queue) == false)



        {


          queue = new Pool(_poolVersion, maxPoolSize);

          _connections.Add(fileName, queue);



























































          return null;

        }













        // We found a pool for this file, so use its version number

        version = queue.PoolVersion;







        queue.MaxPoolSize = maxPoolSize;



























        ResizePool(queue, false);








































































        // Try and get a pooled connection from the queue

        while (queue.Queue.Count > 0)







        {






          WeakReference cnn = queue.Queue.Dequeue();

          SQLiteConnectionHandle hdl = cnn.Target as SQLiteConnectionHandle;





          if (hdl != null)

          {





            return hdl;

          }




















        }
        return null;
      }

    }












    /// <summary>




    /// Clears out all pooled connections and rev's up the default pool version to force all old active objects

    /// not in the pool to get discarded rather than returned to their pools.


























































































































    /// </summary>


































    internal static void ClearAllPools()


    {



      lock (_connections)

      {


        foreach (KeyValuePair<string, Pool> pair in _connections)

        {






          while (pair.Value.Queue.Count > 0)


          {


            WeakReference cnn = pair.Value.Queue.Dequeue();









            SQLiteConnectionHandle hdl = cnn.Target as SQLiteConnectionHandle;















































            if (hdl != null)

            {






              hdl.Dispose();

            }
          }



























































































































































































































          

















































          // Keep track of the highest revision so we can go one higher when we're finished


          if (_poolVersion <= pair.Value.PoolVersion)
            _poolVersion = pair.Value.PoolVersion + 1;
        }


        // All pools are cleared and we have a new highest version number to force all old version active items to get discarded


        // instead of going back to the queue when they are closed.

        // We can get away with this because we've pumped up the _poolVersion out of range of all active connections, so they
        // will all get discarded when they try to put themselves back in their pool.


        _connections.Clear();
      }
    }


















































































































































































    /// <summary>
    /// Clear a given pool for a given filename.  Discards anything in the pool for the given file, and revs the pool
    /// version so current active objects on the old version of the pool will get discarded rather than be returned to the pool.
    /// </summary>
    /// <param name="fileName">The filename of the pool to clear</param>
    internal static void ClearPool(string fileName)
    {





      lock (_connections)
      {
        Pool queue;




        if (_connections.TryGetValue(fileName, out queue) == true)
        {




          queue.PoolVersion++;
          while (queue.Queue.Count > 0)
          {
            WeakReference cnn = queue.Queue.Dequeue();


            SQLiteConnectionHandle hdl = cnn.Target as SQLiteConnectionHandle;




            if (hdl != null)
            {

              hdl.Dispose();

            }











          }
        }

      }
    }




































































































































    /// <summary>




    /// Return a connection to the pool for someone else to use.





    /// </summary>


































    /// <param name="fileName">The filename of the pool to use</param>


    /// <param name="hdl">The connection handle to pool</param>


    /// <param name="version">The pool version the handle was created under</param>

    /// <remarks>

    /// If the version numbers don't match between the connection and the pool, then the handle is discarded.
    /// </remarks>




    internal static void Add(string fileName, SQLiteConnectionHandle hdl, int version)





    {
      lock (_connections)
      {


        // If the queue doesn't exist in the pool, then it must've been cleared sometime after the connection was created.








        Pool queue;

        if (_connections.TryGetValue(fileName, out queue) == true && version == queue.PoolVersion)















































        {



          ResizePool(queue, true);

          queue.Queue.Enqueue(new WeakReference(hdl, false));


          GC.KeepAlive(hdl);


        }



        else

        {

























          hdl.Close();
        }
      }






    }

















    /// <summary>
    /// We don't have to thread-lock anything in this function, because it's only called by other functions above
    /// which already have a thread-safe lock.
    /// </summary>



    /// <param name="queue">The queue to resize</param>


    /// <param name="forAdding">If a function intends to add to the pool, this is true, which forces the resize



















    /// to take one more than it needs from the pool</param>




    private static void ResizePool(Pool queue, bool forAdding)


    {










      int target = queue.MaxPoolSize;






























      if (forAdding && target > 0) target--;






































































      while (queue.Queue.Count > target)
      {
        WeakReference cnn = queue.Queue.Dequeue();



        SQLiteConnectionHandle hdl = cnn.Target as SQLiteConnectionHandle;

















































        if (hdl != null)


        {

          hdl.Dispose();







        }
      }
    }

  }
























































}



|





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

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

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

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

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

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

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

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136

137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411

1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590





1591
1592
1593
1594
1595
1596
1597

1598
1599
1600
1601
1602
1603

1604
1605
1606
1607
1608

1609

1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
    using System;
    using System.Collections.Generic;

#if !NET_COMPACT_20 && TRACE_CONNECTION
    using System.Diagnostics;
    using System.Globalization;
#endif

#if !PLATFORM_COMPACTFRAMEWORK && DEBUG
    using System.Text;
#endif

    using System.Threading;

    ///////////////////////////////////////////////////////////////////////////

    #region Public ISQLiteConnectionPool Interface
    /// <summary>
    /// This interface represents a custom connection pool implementation
    /// usable by System.Data.SQLite.
    /// </summary>
    public interface ISQLiteConnectionPool
    {
        /// <summary>
        /// Counts the number of pool entries matching the specified file name.
        /// </summary>
        /// <param name="fileName">
        /// The file name to match or null to match all files.
        /// </param>
        /// <param name="counts">
        /// The pool entry counts for each matching file.
        /// </param>
        /// <param name="openCount">
        /// The total number of connections successfully opened from any pool.
        /// </param>
        /// <param name="closeCount">
        /// The total number of connections successfully closed from any pool.
        /// </param>
        /// <param name="totalCount">
        /// The total number of pool entries for all matching files.
        /// </param>
        void GetCounts(string fileName, ref Dictionary<string, int> counts,
            ref int openCount, ref int closeCount, ref int totalCount);

        /// <summary>
        /// Disposes of all pooled connections associated with the specified
        /// database file name.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        void ClearPool(string fileName);

        /// <summary>
        /// Disposes of all pooled connections.
        /// </summary>
        void ClearAllPools();

        /// <summary>
        /// Adds a connection to the pool of those associated with the
        /// specified database file name.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        /// <param name="handle">
        /// The database connection handle.
        /// </param>
        /// <param name="version">
        /// The connection pool version at the point the database connection
        /// handle was received from the connection pool.  This is also the
        /// connection pool version that the database connection handle was
        /// created under.
        /// </param>
        void Add(string fileName, object handle, int version);

        /// <summary>
        /// Removes a connection from the pool of those associated with the
        /// specified database file name with the intent of using it to
        /// interact with the database.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        /// <param name="maxPoolSize">
        /// The new maximum size of the connection pool for the specified
        /// database file name.
        /// </param>
        /// <param name="version">
        /// The connection pool version associated with the returned database
        /// connection handle, if any.
        /// </param>
        /// <returns>
        /// The database connection handle associated with the specified
        /// database file name or null if it cannot be obtained.
        /// </returns>
        object Remove(string fileName, int maxPoolSize, out int version);
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region Public ISQLiteConnectionPool2 Interface
    /// <summary>
    /// This interface represents a custom connection pool implementation
    /// usable by System.Data.SQLite.
    /// </summary>
    public interface ISQLiteConnectionPool2 : ISQLiteConnectionPool
    {
        /// <summary>
        /// Initialize the connection pool.
        /// </summary>
        /// <param name="argument">
        /// Optional single argument used during the connection pool
        /// initialization process.
        /// </param>
        void Initialize(object argument);

        /// <summary>
        /// Terminate the connection pool.
        /// </summary>
        /// <param name="argument">
        /// Optional single argument used during the connection pool
        /// termination process.
        /// </param>
        void Terminate(object argument);


        /// <summary>
        /// Gets the total number of connections successfully opened and
        /// closed from any pool.
        /// </summary>
        /// <param name="openCount">
        /// The total number of connections successfully opened from any pool.
        /// </param>
        /// <param name="closeCount">
        /// The total number of connections successfully closed from any pool.
        /// </param>
        void GetCounts(ref int openCount, ref int closeCount);

        /// <summary>
        /// Resets the total number of connections successfully opened and
        /// closed from any pool to zero.
        /// </summary>
        void ResetCounts();
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region Private Built-In Null ISQLiteConnectionPool Class
#if !PLATFORM_COMPACTFRAMEWORK && DEBUG
    /// <summary>
    /// This class implements a connection pool where all methods of the
    /// <see cref="ISQLiteConnectionPool" /> interface are NOPs.  This class
    /// is used for testing purposes only.
    /// </summary>
    internal sealed class NullConnectionPool : ISQLiteConnectionPool2
    {
        #region Private Data
        /// <summary>
        /// This field keeps track of all method calls made into the
        /// <see cref="ISQLiteConnectionPool" /> interface methods of this
        /// class.
        /// </summary>
        private StringBuilder log;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Non-zero to dispose of database connection handles received via the
        /// <see cref="Add" /> method.
        /// </summary>
        private bool dispose;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Constructors
        /// <summary>
        /// Constructs a connection pool object where all methods of the
        /// <see cref="ISQLiteConnectionPool" /> interface are NOPs.  This
        /// class is used for testing purposes only.
        /// </summary>
        private NullConnectionPool()
        {
            log = new StringBuilder();
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        /// <summary>
        /// Constructs a connection pool object where all methods of the
        /// <see cref="ISQLiteConnectionPool" /> interface are NOPs.  This
        /// class is used for testing purposes only.
        /// </summary>
        /// <param name="dispose">
        /// Non-zero to dispose of database connection handles received via the
        /// <see cref="Add" /> method.
        /// </param>
        public NullConnectionPool(
            bool dispose
            )
            : this()
        {
            this.dispose = dispose;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteConnectionPool Members
        /// <summary>
        /// Counts the number of pool entries matching the specified file name.
        /// </summary>
        /// <param name="fileName">
        /// The file name to match or null to match all files.
        /// </param>
        /// <param name="counts">
        /// The pool entry counts for each matching file.
        /// </param>
        /// <param name="openCount">
        /// The total number of connections successfully opened from any pool.
        /// </param>
        /// <param name="closeCount">
        /// The total number of connections successfully closed from any pool.
        /// </param>
        /// <param name="totalCount">
        /// The total number of pool entries for all matching files.
        /// </param>
        public void GetCounts(
            string fileName,
            ref Dictionary<string, int> counts,
            ref int openCount,
            ref int closeCount,
            ref int totalCount
            )
        {
            if (log != null)
            {
                log.AppendFormat(
                    "GetCounts(\"{0}\", {1}, {2}, {3}, {4}){5}", fileName,
                    counts, openCount, closeCount, totalCount,
                    Environment.NewLine);
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of all pooled connections associated with the specified
        /// database file name.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        public void ClearPool(
            string fileName
            )
        {
            if (log != null)
            {
                log.AppendFormat(
                    "ClearPool(\"{0}\"){1}", fileName, Environment.NewLine);
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of all pooled connections.
        /// </summary>
        public void ClearAllPools()
        {
            if (log != null)
            {
                log.AppendFormat(
                    "ClearAllPools(){0}", Environment.NewLine);
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Adds a connection to the pool of those associated with the
        /// specified database file name.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        /// <param name="handle">
        /// The database connection handle.
        /// </param>
        /// <param name="version">
        /// The connection pool version at the point the database connection
        /// handle was received from the connection pool.  This is also the
        /// connection pool version that the database connection handle was
        /// created under.
        /// </param>
        public void Add(
            string fileName,
            object handle,
            int version
            )
        {
            if (log != null)
            {
                log.AppendFormat(
                    "Add(\"{0}\", {1}, {2}){3}", fileName, handle, version,
                    Environment.NewLine);
            }

            //
            // NOTE: If configured to do so, dispose of the received connection
            //       handle now.
            //
            if (dispose)
            {
                IDisposable disposable = handle as IDisposable;

                if (disposable != null)
                    disposable.Dispose();
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Removes a connection from the pool of those associated with the
        /// specified database file name with the intent of using it to
        /// interact with the database.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        /// <param name="maxPoolSize">
        /// The new maximum size of the connection pool for the specified
        /// database file name.
        /// </param>
        /// <param name="version">
        /// The connection pool version associated with the returned database
        /// connection handle, if any.
        /// </param>
        /// <returns>
        /// The database connection handle associated with the specified
        /// database file name or null if it cannot be obtained.
        /// </returns>
        public object Remove(
            string fileName,
            int maxPoolSize,
            out int version
            )
        {
            version = 0;

            if (log != null)
            {
                log.AppendFormat(
                    "Remove(\"{0}\", {1}, {2}){3}", fileName, maxPoolSize,
                    version, Environment.NewLine);
            }

            return null;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteConnectionPool2 Members
        public void Initialize(
            object argument
            )
        {
            if (log != null)
            {
                log.AppendFormat(
                    "Initialize(\"{0}\"){1}", argument, Environment.NewLine);
            }
        }

        ///////////////////////////////////////////////////////////////////////

        public void Terminate(
            object argument
            )
        {
            if (log != null)
            {
                log.AppendFormat(
                    "Terminate(\"{0}\"){1}", argument, Environment.NewLine);
            }
        }

        ///////////////////////////////////////////////////////////////////////

        public void GetCounts(
            ref int openCount,
            ref int closeCount
            )
        {
            if (log != null)
            {
                log.AppendFormat(
                    "GetCounts({0}, {1}){2}", openCount, closeCount,
                    Environment.NewLine);
            }
        }

        ///////////////////////////////////////////////////////////////////////

        public void ResetCounts()
        {
            if (log != null)
            {
                log.AppendFormat(
                    "ResetCounts(){0}", Environment.NewLine);
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region System.Object Overrides
        /// <summary>
        /// Overrides the default <see cref="System.Object.ToString" /> method
        /// to provide a log of all methods called on the
        /// <see cref="ISQLiteConnectionPool" /> interface.
        /// </summary>
        /// <returns>
        /// A string containing a log of all method calls into the
        /// <see cref="ISQLiteConnectionPool" /> interface, along with their
        /// parameters, delimited by <see cref="Environment.NewLine" />.
        /// </returns>
        public override string ToString()
        {
            return (log != null) ? log.ToString() : String.Empty;
        }
        #endregion
    }
#endif
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region Private Built-In Weak ISQLiteConnectionPool Class
    /// <summary>
    /// This class implements a connection pool using the built-in static
    /// method implementations.
    /// </summary>
    internal sealed class WeakConnectionPool : ISQLiteConnectionPool2
    {
        #region ISQLiteConnectionPool Members
        /// <summary>
        /// Counts the number of pool entries matching the specified file name.
        /// </summary>
        /// <param name="fileName">
        /// The file name to match or null to match all files.
        /// </param>
        /// <param name="counts">
        /// The pool entry counts for each matching file.
        /// </param>
        /// <param name="openCount">
        /// The total number of connections successfully opened from any pool.
        /// </param>
        /// <param name="closeCount">
        /// The total number of connections successfully closed from any pool.
        /// </param>
        /// <param name="totalCount">
        /// The total number of pool entries for all matching files.
        /// </param>
        public void GetCounts(
            string fileName,
            ref Dictionary<string, int> counts,
            ref int openCount,
            ref int closeCount,
            ref int totalCount
            )
        {
            StaticWeakConnectionPool<WeakReference>.GetCounts(
                fileName, ref counts, ref openCount, ref closeCount,
                ref totalCount);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of all pooled connections associated with the specified
        /// database file name.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        public void ClearPool(
            string fileName
            )
        {
            StaticWeakConnectionPool<WeakReference>.ClearPool(fileName);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of all pooled connections.
        /// </summary>
        public void ClearAllPools()
        {
            StaticWeakConnectionPool<WeakReference>.ClearAllPools();
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Adds a connection to the pool of those associated with the
        /// specified database file name.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        /// <param name="handle">
        /// The database connection handle.
        /// </param>
        /// <param name="version">
        /// The connection pool version at the point the database connection
        /// handle was received from the connection pool.  This is also the
        /// connection pool version that the database connection handle was
        /// created under.
        /// </param>
        public void Add(
            string fileName,
            object handle,
            int version
            )
        {
            StaticWeakConnectionPool<WeakReference>.Add(
                fileName, handle as SQLiteConnectionHandle, version);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Removes a connection from the pool of those associated with the
        /// specified database file name with the intent of using it to
        /// interact with the database.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        /// <param name="maxPoolSize">
        /// The new maximum size of the connection pool for the specified
        /// database file name.
        /// </param>
        /// <param name="version">
        /// The connection pool version associated with the returned database
        /// connection handle, if any.
        /// </param>
        /// <returns>
        /// The database connection handle associated with the specified
        /// database file name or null if it cannot be obtained.
        /// </returns>
        public object Remove(
            string fileName,
            int maxPoolSize,
            out int version
            )
        {
            return StaticWeakConnectionPool<WeakReference>.Remove(
                fileName, maxPoolSize, out version);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteConnectionPool2 Members
        public void Initialize(
            object argument
            )
        {
            // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////

        public void Terminate(
            object argument
            )
        {
            // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////

        public void GetCounts(
            ref int openCount,
            ref int closeCount
            )
        {
            StaticWeakConnectionPool<WeakReference>.GetCounts(
                ref openCount, ref closeCount);
        }

        ///////////////////////////////////////////////////////////////////////

        public void ResetCounts()
        {
            StaticWeakConnectionPool<WeakReference>.ResetCounts();
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region Private Built-In Strong ISQLiteConnectionPool Class
    /// <summary>
    /// This class implements a naive connection pool where the underlying
    /// connections are never disposed automatically.
    /// </summary>
    internal sealed class StrongConnectionPool : ISQLiteConnectionPool2
    {
        #region ISQLiteConnectionPool Members
        /// <summary>
        /// Counts the number of pool entries matching the specified file name.
        /// </summary>
        /// <param name="fileName">
        /// The file name to match or null to match all files.
        /// </param>
        /// <param name="counts">
        /// The pool entry counts for each matching file.
        /// </param>
        /// <param name="openCount">
        /// The total number of connections successfully opened from any pool.
        /// </param>
        /// <param name="closeCount">
        /// The total number of connections successfully closed from any pool.
        /// </param>
        /// <param name="totalCount">
        /// The total number of pool entries for all matching files.
        /// </param>
        public void GetCounts(
            string fileName,
            ref Dictionary<string, int> counts,
            ref int openCount,
            ref int closeCount,
            ref int totalCount
            )
        {
            StaticStrongConnectionPool<object>.GetCounts(
                fileName, ref counts, ref openCount, ref closeCount,
                ref totalCount);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of all pooled connections associated with the specified
        /// database file name.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        public void ClearPool(
            string fileName
            )
        {
            StaticStrongConnectionPool<object>.ClearPool(fileName);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of all pooled connections.
        /// </summary>
        public void ClearAllPools()
        {
            StaticStrongConnectionPool<object>.ClearAllPools();
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Adds a connection to the pool of those associated with the
        /// specified database file name.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        /// <param name="handle">
        /// The database connection handle.
        /// </param>
        /// <param name="version">
        /// The connection pool version at the point the database connection
        /// handle was received from the connection pool.  This is also the
        /// connection pool version that the database connection handle was
        /// created under.
        /// </param>
        public void Add(
            string fileName,
            object handle,
            int version
            )
        {
            StaticStrongConnectionPool<object>.Add(
                fileName, handle as SQLiteConnectionHandle, version);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Removes a connection from the pool of those associated with the
        /// specified database file name with the intent of using it to
        /// interact with the database.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        /// <param name="maxPoolSize">
        /// The new maximum size of the connection pool for the specified
        /// database file name.
        /// </param>
        /// <param name="version">
        /// The connection pool version associated with the returned database
        /// connection handle, if any.
        /// </param>
        /// <returns>
        /// The database connection handle associated with the specified
        /// database file name or null if it cannot be obtained.
        /// </returns>
        public object Remove(
            string fileName,
            int maxPoolSize,
            out int version
            )
        {
            return StaticStrongConnectionPool<object>.Remove(
                fileName, maxPoolSize, out version);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteConnectionPool2 Members
        public void Initialize(
            object argument
            )
        {
            // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////

        public void Terminate(
            object argument
            )
        {
            // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////

        public void GetCounts(
            ref int openCount,
            ref int closeCount
            )
        {
            StaticStrongConnectionPool<object>.GetCounts(
                ref openCount, ref closeCount);
        }

        ///////////////////////////////////////////////////////////////////////

        public void ResetCounts()
        {
            StaticStrongConnectionPool<object>.ResetCounts();
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region Private PoolQueue<T> Class
    /// <summary>
    /// Keeps track of connections made on a specified file.  The PoolVersion
    /// dictates whether old objects get returned to the pool or discarded
    /// when no longer in use.
    /// </summary>
    internal sealed class PoolQueue<T>
    {
        #region Private Data
        /// <summary>
        /// The queue of weak references to the actual database connection
        /// handles.
        /// </summary>
        internal readonly Queue<T> Queue = new Queue<T>();

        ///////////////////////////////////////////////////////////////////

        /// <summary>
        /// This pool version associated with the database connection
        /// handles in this pool queue.
        /// </summary>
        internal int PoolVersion;

        ///////////////////////////////////////////////////////////////////

        /// <summary>
        /// The maximum size of this pool queue.
        /// </summary>
        internal int MaxPoolSize;
        #endregion

        ///////////////////////////////////////////////////////////////////

        #region Private Constructors
        /// <summary>
        /// Constructs a connection pool queue using the specified version
        /// and maximum size.  Normally, all the database connection
        /// handles in this pool are associated with a single database file
        /// name.
        /// </summary>
        /// <param name="version">
        /// The initial pool version for this connection pool queue.
        /// </param>
        /// <param name="maxSize">
        /// The initial maximum size for this connection pool queue.
        /// </param>
        internal PoolQueue(
            int version,
            int maxSize
            )
        {
            PoolVersion = version;
            MaxPoolSize = maxSize;
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region Private Connection Pool Subsystem Interface
    /// <summary>
    /// This default method implementations in this class should not be used by
    /// applications that make use of COM (either directly or indirectly) due
    /// to possible deadlocks that can occur during finalization of some COM
    /// objects.
    /// </summary>
    internal static class SQLiteConnectionPool
    {
        #region Private Static Data
        /// <summary>
        /// This field is used to synchronize access to the private static
        /// data in this class.
        /// </summary>
        private static readonly object _syncRoot = new object();

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// When this field is non-null, it will be used to provide the
        /// implementation of all the connection pool methods; otherwise,
        /// the default method implementations will be used.
        /// </summary>
        private static ISQLiteConnectionPool _connectionPool = null;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteConnectionPool Members (Static, Non-Formal)
        /// <summary>
        /// Counts the number of pool entries matching the specified file name.
        /// </summary>
        /// <param name="fileName">
        /// The file name to match or null to match all files.
        /// </param>
        /// <param name="counts">
        /// The pool entry counts for each matching file.
        /// </param>
        /// <param name="openCount">
        /// The total number of connections successfully opened from any pool.
        /// </param>
        /// <param name="closeCount">
        /// The total number of connections successfully closed from any pool.
        /// </param>
        /// <param name="totalCount">
        /// The total number of pool entries for all matching files.
        /// </param>
        public static void GetCounts(
            string fileName,
            ref Dictionary<string, int> counts,
            ref int openCount,
            ref int closeCount,
            ref int totalCount
            )
        {
            ISQLiteConnectionPool connectionPool = GetConnectionPool();

            if (connectionPool == null)
                return;

            connectionPool.GetCounts(
                fileName, ref counts, ref openCount, ref closeCount,
                ref totalCount);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of all pooled connections associated with the specified
        /// database file name.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        public static void ClearPool(string fileName)
        {
            ISQLiteConnectionPool connectionPool = GetConnectionPool();

            if (connectionPool == null)
                return;

            connectionPool.ClearPool(fileName);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of all pooled connections.
        /// </summary>
        public static void ClearAllPools()
        {
            ISQLiteConnectionPool connectionPool = GetConnectionPool();

            if (connectionPool == null)
                return;

            connectionPool.ClearAllPools();
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Adds a connection to the pool of those associated with the
        /// specified database file name.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        /// <param name="handle">
        /// The database connection handle.
        /// </param>
        /// <param name="version">
        /// The connection pool version at the point the database connection
        /// handle was received from the connection pool.  This is also the
        /// connection pool version that the database connection handle was
        /// created under.
        /// </param>
        public static void Add(
            string fileName,
            SQLiteConnectionHandle handle,
            int version
            )
        {
            ISQLiteConnectionPool connectionPool = GetConnectionPool();

            if (connectionPool == null)
                return;

            connectionPool.Add(fileName, handle, version);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Removes a connection from the pool of those associated with the
        /// specified database file name with the intent of using it to
        /// interact with the database.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        /// <param name="maxPoolSize">
        /// The new maximum size of the connection pool for the specified
        /// database file name.
        /// </param>
        /// <param name="version">
        /// The connection pool version associated with the returned database
        /// connection handle, if any.
        /// </param>
        /// <returns>
        /// The database connection handle associated with the specified
        /// database file name or null if it cannot be obtained.
        /// </returns>
        public static SQLiteConnectionHandle Remove(
            string fileName,
            int maxPoolSize,
            out int version
            )
        {
            ISQLiteConnectionPool connectionPool = GetConnectionPool();

            if (connectionPool == null)
            {
                version = 0;
                return null;
            }

            return connectionPool.Remove(fileName, maxPoolSize,
                out version) as SQLiteConnectionHandle;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteConnectionPool2 Members (Static, Non-Formal)
        public static void Initialize(
            object argument
            )
        {
            ISQLiteConnectionPool2 connectionPool =
                GetConnectionPool() as ISQLiteConnectionPool2;

            if (connectionPool == null)
                return;

            connectionPool.Initialize(argument);
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Terminate(
            object argument
            )
        {
            ISQLiteConnectionPool2 connectionPool =
                GetConnectionPool() as ISQLiteConnectionPool2;

            if (connectionPool == null)
                return;

            connectionPool.Terminate(argument);
        }

        ///////////////////////////////////////////////////////////////////////

        public static void GetCounts(
            ref int openCount,
            ref int closeCount
            )
        {
            ISQLiteConnectionPool2 connectionPool =
                GetConnectionPool() as ISQLiteConnectionPool2;

            if (connectionPool == null)
                return;

            connectionPool.GetCounts(ref openCount, ref closeCount);
        }

        ///////////////////////////////////////////////////////////////////////

        public static void ResetCounts()
        {
            ISQLiteConnectionPool2 connectionPool =
                GetConnectionPool() as ISQLiteConnectionPool2;

            if (connectionPool == null)
                return;

            connectionPool.ResetCounts();
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Static Methods
        public static void CreateAndInitialize(
            object argument,
            bool strong,
            bool force
            )
        {
            lock (_syncRoot)
            {
                if (force || (_connectionPool == null))
                {
                    //
                    // NOTE: *LEGACY* By default, use a connection pool
                    //       that keeps track of WeakReference objects.
                    //
                    ISQLiteConnectionPool connectionPool;

                    if (strong)
                        connectionPool = new StrongConnectionPool();
                    else
                        connectionPool = new WeakConnectionPool();

                    ISQLiteConnectionPool2 connectionPool2 =
                        connectionPool as ISQLiteConnectionPool2;

                    if (connectionPool2 != null)
                        connectionPool2.Initialize(argument);

#if !NET_COMPACT_20 && TRACE_CONNECTION
                    Trace.WriteLine(HelperMethods.StringFormat(
                        CultureInfo.CurrentCulture,
                        "ConnectionPool: Initialized {0}",
                        connectionPool));
#endif

                    _connectionPool = connectionPool;
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        public static void TerminateAndReset(
            object argument
            )
        {
            lock (_syncRoot)
            {
                if (_connectionPool != null)
                {
                    ISQLiteConnectionPool2 connectionPool2 =
                        _connectionPool as ISQLiteConnectionPool2;

                    if (connectionPool2 != null)
                        connectionPool2.Terminate(argument);

#if !NET_COMPACT_20 && TRACE_CONNECTION
                    Trace.WriteLine(HelperMethods.StringFormat(
                        CultureInfo.CurrentCulture,
                        "ConnectionPool: Terminated {0}",
                        _connectionPool));
#endif

                    _connectionPool = null;
                }
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Helper Methods
        /// <summary>
        /// This method is used to obtain a reference to the custom connection
        /// pool implementation currently in use, if any.
        /// </summary>
        /// <returns>
        /// The custom connection pool implementation or null if the default
        /// connection pool implementation should be used.
        /// </returns>
        public static ISQLiteConnectionPool GetConnectionPool()
        {
            lock (_syncRoot)
            {
                return _connectionPool;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is used to set the reference to the custom connection
        /// pool implementation to use, if any.
        /// </summary>
        /// <param name="connectionPool">
        /// The custom connection pool implementation to use or null if the
        /// default connection pool implementation should be used.
        /// </param>
        public static void SetConnectionPool(
            ISQLiteConnectionPool connectionPool
            )
        {
            lock (_syncRoot)
            {
                _connectionPool = connectionPool;
            }
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region Private Static Built-In Connection Pool for WeakReference
    /// <summary>
    /// This default method implementations in this class should not be used
    /// by applications that make use of COM (either directly or indirectly)
    /// due to possible deadlocks that can occur during finalization of some
    /// COM objects.
    /// </summary>
    internal static class StaticWeakConnectionPool<T> where T : WeakReference
    {
        #region Private Static Data
        /// <summary>
        /// This field is used to synchronize access to the private static
        /// data in this class.
        /// </summary>
        private static readonly object _syncRoot = new object();

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The dictionary of connection pools, based on the normalized file
        /// name of the SQLite database.
        /// </summary>
        private static SortedList<string, PoolQueue<T>>
            _queueList = new SortedList<string, PoolQueue<T>>(
                StringComparer.OrdinalIgnoreCase);

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The default version number new pools will get.
        /// </summary>
        private static int _poolVersion = 1;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The number of connections successfully opened from any pool.
        /// This value is incremented by the Remove method.
        /// </summary>
        private static int _poolOpened = 0;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The number of connections successfully closed from any pool.
        /// This value is incremented by the Add method.
        /// </summary>
        private static int _poolClosed = 0;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteConnectionPool Members (Static, Non-Formal)
        /// <summary>
        /// Counts the number of pool entries matching the specified file name.
        /// </summary>
        /// <param name="fileName">
        /// The file name to match or null to match all files.
        /// </param>
        /// <param name="counts">
        /// The pool entry counts for each matching file.
        /// </param>
        /// <param name="openCount">
        /// The total number of connections successfully opened from any pool.
        /// </param>
        /// <param name="closeCount">
        /// The total number of connections successfully closed from any pool.
        /// </param>
        /// <param name="totalCount">
        /// The total number of pool entries for all matching files.
        /// </param>
        public static void GetCounts(
            string fileName,
            ref Dictionary<string, int> counts,
            ref int openCount,
            ref int closeCount,
            ref int totalCount
            )
        {
            lock (_syncRoot)
            {
                openCount = _poolOpened;
                closeCount = _poolClosed;

                if (counts == null)
                {
                    counts = new Dictionary<string, int>(
                        StringComparer.OrdinalIgnoreCase);
                }

                if (fileName != null)
                {
                    PoolQueue<T> queue;

                    if (_queueList.TryGetValue(fileName, out queue))
                    {
                        Queue<T> poolQueue = queue.Queue;
                        int count = (poolQueue != null) ? poolQueue.Count : 0;

                        counts.Add(fileName, count);
                        totalCount += count;
                    }
                }
                else
                {
                    foreach (KeyValuePair<string, PoolQueue<T>> pair
                            in _queueList)
                    {
                        if (pair.Value == null)
                            continue;

                        Queue<T> poolQueue = pair.Value.Queue;
                        int count = (poolQueue != null) ? poolQueue.Count : 0;

                        counts.Add(pair.Key, count);
                        totalCount += count;
                    }
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of all pooled connections associated with the specified
        /// database file name.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        public static void ClearPool(string fileName)
        {
            lock (_syncRoot)
            {
                PoolQueue<T> queue;

                if (_queueList.TryGetValue(fileName, out queue))
                {
                    queue.PoolVersion++;

                    Queue<T> poolQueue = queue.Queue;
                    if (poolQueue == null) return;

                    while (poolQueue.Count > 0)
                    {
                        T connection = poolQueue.Dequeue();

                        if (connection == null) continue;

                        SQLiteConnectionHandle handle =
                            connection.Target as SQLiteConnectionHandle;

                        if (handle != null)
                            handle.Dispose();

                        GC.KeepAlive(handle);
                    }
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of all pooled connections.
        /// </summary>
        public static void ClearAllPools()
        {
            lock (_syncRoot)
            {
                foreach (KeyValuePair<string, PoolQueue<T>> pair
                        in _queueList)
                {
                    if (pair.Value == null)
                        continue;

                    Queue<T> poolQueue = pair.Value.Queue;

                    while (poolQueue.Count > 0)
                    {
                        T connection = poolQueue.Dequeue();

                        if (connection == null) continue;

                        SQLiteConnectionHandle handle =
                            connection.Target as SQLiteConnectionHandle;

                        if (handle != null)
                            handle.Dispose();

                        GC.KeepAlive(handle);
                    }

                    //
                    // NOTE: Keep track of the highest revision so we can
                    //       go one higher when we are finished.
                    //
                    if (_poolVersion <= pair.Value.PoolVersion)
                        _poolVersion = pair.Value.PoolVersion + 1;
                }

                //
                // NOTE: All pools are cleared and we have a new highest
                //       version number to force all old version active
                //       items to get discarded instead of going back to
                //       the queue when they are closed.  We can get away
                //       with this because we have pumped up the pool
                //       version out of range of all active connections,
                //       so they will all get discarded when they try to
                //       put themselves back into their pools.
                //
                _queueList.Clear();
            }

        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Adds a connection to the pool of those associated with the
        /// specified database file name.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        /// <param name="handle">
        /// The database connection handle.
        /// </param>
        /// <param name="version">
        /// The connection pool version at the point the database connection
        /// handle was received from the connection pool.  This is also the
        /// connection pool version that the database connection handle was
        /// created under.
        /// </param>
        public static void Add(
            string fileName,
            SQLiteConnectionHandle handle,
            int version
            )
        {
            lock (_syncRoot)
            {
                //
                // NOTE: If the queue does not exist in the pool, then it
                //       must have been cleared sometime after the
                //       connection was created.
                //
                PoolQueue<T> queue;

                if (_queueList.TryGetValue(fileName, out queue) &&
                    (version == queue.PoolVersion))
                {
                    ResizePool(queue, true);

                    Queue<T> poolQueue = queue.Queue;
                    if (poolQueue == null) return;

                    poolQueue.Enqueue((T)new WeakReference(handle, false));
                    Interlocked.Increment(ref _poolClosed);
                }
                else
                {
                    if (handle != null)
                        handle.Close();
                }

                GC.KeepAlive(handle);
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Removes a connection from the pool of those associated with the
        /// specified database file name with the intent of using it to
        /// interact with the database.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        /// <param name="maxPoolSize">
        /// The new maximum size of the connection pool for the specified
        /// database file name.
        /// </param>
        /// <param name="version">
        /// The connection pool version associated with the returned database
        /// connection handle, if any.
        /// </param>
        /// <returns>
        /// The database connection handle associated with the specified
        /// database file name or null if it cannot be obtained.
        /// </returns>
        public static SQLiteConnectionHandle Remove(
            string fileName,
            int maxPoolSize,
            out int version
            )
        {
            int localVersion;
            Queue<T> poolQueue;

            //
            // NOTE: This lock cannot be held while checking the queue for
            //       available connections because other methods of this
            //       class are called from the GC finalizer thread and we
            //       use the WaitForPendingFinalizers method (below).
            //       Holding this lock while calling that method would
            //       therefore result in a deadlock.  Instead, this lock
            //       is held only while a temporary copy of the queue is
            //       created, and if necessary, when committing changes
            //       back to that original queue prior to returning from
            //       this method.
            //
            lock (_syncRoot)
            {
                PoolQueue<T> queue;

                //
                // NOTE: Default to the highest pool version.
                //
                version = _poolVersion;

                //
                // NOTE: If we didn't find a pool for this file, create one
                //       even though it will be empty.  We have to do this
                //       here because otherwise calling ClearPool() on the
                //       file will not work for active connections that have
                //       never seen the pool yet.
                //
                if (!_queueList.TryGetValue(fileName, out queue))
                {
                    queue = new PoolQueue<T>(
                        _poolVersion, maxPoolSize);

                    _queueList.Add(fileName, queue);

                    return null;
                }

                //
                // NOTE: We found a pool for this file, so use its version
                //       number.
                //
                version = localVersion = queue.PoolVersion;
                queue.MaxPoolSize = maxPoolSize;

                //
                // NOTE: Now, resize the pool to the new maximum size, if
                //       necessary.
                //
                ResizePool(queue, false);

                //
                // NOTE: Try and get a pooled connection from the queue.
                //
                poolQueue = queue.Queue;
                if (poolQueue == null) return null;

                //
                // NOTE: Temporarily tranfer the queue for this file into
                //       a local variable.  The queue for this file will
                //       be modified and then committed back to the real
                //       pool list (below) prior to returning from this
                //       method.
                //
                _queueList.Remove(fileName);
                poolQueue = new Queue<T>(poolQueue);
            }

            try
            {
                while (poolQueue.Count > 0)
                {
                    T connection = poolQueue.Dequeue();

                    if (connection == null) continue;

                    SQLiteConnectionHandle handle =
                        connection.Target as SQLiteConnectionHandle;

                    if (handle == null) continue;

                    //
                    // BUGFIX: For ticket [996d13cd87], step #1.  After
                    //         this point, make sure that the finalizer for
                    //         the connection handle just obtained from the
                    //         queue cannot START running (i.e. it may
                    //         still be pending but it will no longer start
                    //         after this point).
                    //
                    GC.SuppressFinalize(handle);

                    try





                    {
                        //
                        // BUGFIX: For ticket [996d13cd87], step #2.  Now,
                        //         we must wait for all pending finalizers
                        //         which have STARTED running and have not
                        //         yet COMPLETED.  This must be done just
                        //         in case the finalizer for the connection

                        //         handle just obtained from the queue has
                        //         STARTED running at some point before
                        //         SuppressFinalize was called on it.
                        //
                        //         After this point, checking properties of
                        //         the connection handle (e.g. IsClosed)

                        //         should work reliably without having to
                        //         worry that they will (due to the
                        //         finalizer) change out from under us.
                        //
                        GC.WaitForPendingFinalizers();



                        //
                        // BUGFIX: For ticket [996d13cd87], step #3.  Next,
                        //         verify that the connection handle is
                        //         actually valid and [still?] not closed
                        //         prior to actually returning it to our
                        //         caller.
                        //
                        if (!handle.IsInvalid && !handle.IsClosed)
                        {
                            Interlocked.Increment(ref _poolOpened);
                            return handle;
                        }
                    }
                    finally
                    {
                        //
                        // BUGFIX: For ticket [996d13cd87], step #4.  Next,
                        //         we must re-register the connection
                        //         handle for finalization now that we have
                        //         a strong reference to it (i.e. the
                        //         finalizer will not run at least until
                        //         the connection is subsequently closed).
                        //
                        GC.ReRegisterForFinalize(handle);
                    }

                    GC.KeepAlive(handle);
                }
            }
            finally
            {
                //
                // BUGFIX: For ticket [996d13cd87], step #5.  Finally,
                //         commit any changes to the pool/queue for this
                //         database file.
                //
                lock (_syncRoot)
                {
                    //
                    // NOTE: We must check [again] if a pool exists for
                    //       this file because one may have been added
                    //       while the search for an available connection
                    //       was in progress (above).
                    //
                    PoolQueue<T> queue;
                    Queue<T> newPoolQueue;
                    bool addPool;

                    if (_queueList.TryGetValue(fileName, out queue))
                    {
                        addPool = false;
                    }
                    else
                    {
                        addPool = true;

                        queue = new PoolQueue<T>(
                            localVersion, maxPoolSize);
                    }

                    newPoolQueue = queue.Queue;

                    while (poolQueue.Count > 0)
                        newPoolQueue.Enqueue(poolQueue.Dequeue());

                    ResizePool(queue, false);

                    if (addPool)
                        _queueList.Add(fileName, queue);
                }
            }

            return null;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteConnectionPool2 Members (Static, Non-Formal)
        public static void ResetCounts()
        {
            lock (_syncRoot)
            {
                _poolOpened = 0;
                _poolClosed = 0;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        public static void GetCounts(
            ref int openCount,
            ref int closeCount
            )
        {
            lock (_syncRoot)
            {
                openCount = _poolOpened;
                closeCount = _poolClosed;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Helper Methods
        /// <summary>
        /// We do not have to thread-lock anything in this function, because
        /// it is only called by other functions above which already take the
        /// lock.
        /// </summary>
        /// <param name="queue">
        /// The pool queue to resize.
        /// </param>
        /// <param name="add">
        /// If a function intends to add to the pool, this is true, which
        /// forces the resize to take one more than it needs from the pool.
        /// </param>
        private static void ResizePool(
            PoolQueue<T> queue,
            bool add
            )
        {
            int target = queue.MaxPoolSize;

            if (add && target > 0) target--;

            Queue<T> poolQueue = queue.Queue;
            if (poolQueue == null) return;

            while (poolQueue.Count > target)
            {
                T connection = poolQueue.Dequeue();

                if (connection == null) continue;

                SQLiteConnectionHandle handle =
                    connection.Target as SQLiteConnectionHandle;

                if (handle != null)
                    handle.Dispose();

                GC.KeepAlive(handle);
            }
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region Private Static Built-In Connection Pool for Object
    /// <summary>
    /// This default method implementations in this class should not be used
    /// by applications that make use of COM (either directly or indirectly)
    /// due to possible deadlocks that can occur during finalization of some
    /// COM objects.
    /// </summary>
    internal static class StaticStrongConnectionPool<T> where T : class
    {
        #region Private Static Data
        /// <summary>
        /// This field is used to synchronize access to the private static
        /// data in this class.
        /// </summary>
        private static readonly object _syncRoot = new object();

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The dictionary of connection pools, based on the normalized file
        /// name of the SQLite database.
        /// </summary>
        private static SortedList<string, PoolQueue<T>>
            _queueList = new SortedList<string, PoolQueue<T>>(
                StringComparer.OrdinalIgnoreCase);

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The default version number new pools will get.
        /// </summary>
        private static int _poolVersion = 1;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The number of connections successfully opened from any pool.
        /// This value is incremented by the Remove method.
        /// </summary>
        private static int _poolOpened = 0;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The number of connections successfully closed from any pool.
        /// This value is incremented by the Add method.
        /// </summary>
        private static int _poolClosed = 0;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteConnectionPool Members (Static, Non-Formal)
        /// <summary>
        /// Counts the number of pool entries matching the specified file name.
        /// </summary>
        /// <param name="fileName">
        /// The file name to match or null to match all files.
        /// </param>
        /// <param name="counts">
        /// The pool entry counts for each matching file.
        /// </param>
        /// <param name="openCount">
        /// The total number of connections successfully opened from any pool.
        /// </param>
        /// <param name="closeCount">
        /// The total number of connections successfully closed from any pool.
        /// </param>
        /// <param name="totalCount">
        /// The total number of pool entries for all matching files.
        /// </param>
        public static void GetCounts(
            string fileName,
            ref Dictionary<string, int> counts,
            ref int openCount,
            ref int closeCount,
            ref int totalCount
            )
        {
            lock (_syncRoot)
            {
                openCount = _poolOpened;
                closeCount = _poolClosed;

                if (counts == null)
                {
                    counts = new Dictionary<string, int>(
                        StringComparer.OrdinalIgnoreCase);
                }

                if (fileName != null)
                {
                    PoolQueue<T> queue;

                    if (_queueList.TryGetValue(fileName, out queue))
                    {
                        Queue<T> poolQueue = queue.Queue;
                        int count = (poolQueue != null) ? poolQueue.Count : 0;

                        counts.Add(fileName, count);
                        totalCount += count;
                    }
                }
                else
                {
                    foreach (KeyValuePair<string, PoolQueue<T>> pair
                            in _queueList)
                    {
                        if (pair.Value == null)
                            continue;

                        Queue<T> poolQueue = pair.Value.Queue;
                        int count = (poolQueue != null) ? poolQueue.Count : 0;

                        counts.Add(pair.Key, count);
                        totalCount += count;
                    }
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of all pooled connections associated with the specified
        /// database file name.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        public static void ClearPool(string fileName)
        {
            lock (_syncRoot)
            {
                PoolQueue<T> queue;

                if (_queueList.TryGetValue(fileName, out queue))
                {
                    queue.PoolVersion++;

                    Queue<T> poolQueue = queue.Queue;
                    if (poolQueue == null) return;

                    while (poolQueue.Count > 0)
                    {
                        T connection = poolQueue.Dequeue();

                        if (connection == null) continue;

                        SQLiteConnectionHandle handle =
                            connection as SQLiteConnectionHandle;

                        if (handle != null)
                            handle.Dispose();
                    }
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of all pooled connections.
        /// </summary>
        public static void ClearAllPools()
        {
            lock (_syncRoot)
            {
                foreach (KeyValuePair<string, PoolQueue<T>> pair
                        in _queueList)
                {
                    if (pair.Value == null)
                        continue;

                    Queue<T> poolQueue = pair.Value.Queue;

                    while (poolQueue.Count > 0)
                    {
                        object connection = poolQueue.Dequeue();

                        if (connection == null) continue;

                        SQLiteConnectionHandle handle =
                            connection as SQLiteConnectionHandle;

                        if (handle != null)
                            handle.Dispose();
                    }

                    //
                    // NOTE: Keep track of the highest revision so we can
                    //       go one higher when we are finished.
                    //
                    if (_poolVersion <= pair.Value.PoolVersion)
                        _poolVersion = pair.Value.PoolVersion + 1;
                }

                //
                // NOTE: All pools are cleared and we have a new highest
                //       version number to force all old version active
                //       items to get discarded instead of going back to
                //       the queue when they are closed.  We can get away
                //       with this because we have pumped up the pool
                //       version out of range of all active connections,
                //       so they will all get discarded when they try to
                //       put themselves back into their pools.
                //
                _queueList.Clear();
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Adds a connection to the pool of those associated with the
        /// specified database file name.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        /// <param name="handle">
        /// The database connection handle.
        /// </param>
        /// <param name="version">
        /// The connection pool version at the point the database connection
        /// handle was received from the connection pool.  This is also the
        /// connection pool version that the database connection handle was
        /// created under.
        /// </param>
        public static void Add(
            string fileName,
            SQLiteConnectionHandle handle,
            int version
            )
        {
            lock (_syncRoot)
            {
                //
                // NOTE: If the queue does not exist in the pool, then it
                //       must have been cleared sometime after the
                //       connection was created.
                //
                PoolQueue<T> queue;

                if (_queueList.TryGetValue(fileName, out queue) &&
                    (version == queue.PoolVersion))
                {
                    ResizePool(queue, true);

                    Queue<T> poolQueue = queue.Queue;
                    if (poolQueue == null) return;

                    poolQueue.Enqueue(handle as T);
                    Interlocked.Increment(ref _poolClosed);
                }
                else
                {
                    if (handle != null)
                        handle.Close();
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Removes a connection from the pool of those associated with the
        /// specified database file name with the intent of using it to
        /// interact with the database.
        /// </summary>
        /// <param name="fileName">
        /// The database file name.
        /// </param>
        /// <param name="maxPoolSize">
        /// The new maximum size of the connection pool for the specified
        /// database file name.
        /// </param>
        /// <param name="version">
        /// The connection pool version associated with the returned database
        /// connection handle, if any.
        /// </param>
        /// <returns>
        /// The database connection handle associated with the specified
        /// database file name or null if it cannot be obtained.
        /// </returns>
        public static SQLiteConnectionHandle Remove(
            string fileName,
            int maxPoolSize,
            out int version
            )
        {
            int localVersion;
            Queue<T> poolQueue;

            //
            // NOTE: This lock cannot be held while checking the queue for
            //       available connections because other methods of this
            //       class are called from the GC finalizer thread and we
            //       use the WaitForPendingFinalizers method (below).
            //       Holding this lock while calling that method would
            //       therefore result in a deadlock.  Instead, this lock
            //       is held only while a temporary copy of the queue is
            //       created, and if necessary, when committing changes
            //       back to that original queue prior to returning from
            //       this method.
            //
            lock (_syncRoot)
            {
                PoolQueue<T> queue;

                //
                // NOTE: Default to the highest pool version.
                //
                version = _poolVersion;

                //
                // NOTE: If we didn't find a pool for this file, create one
                //       even though it will be empty.  We have to do this
                //       here because otherwise calling ClearPool() on the
                //       file will not work for active connections that have
                //       never seen the pool yet.
                //
                if (!_queueList.TryGetValue(fileName, out queue))
                {
                    queue = new PoolQueue<T>(
                        _poolVersion, maxPoolSize);

                    _queueList.Add(fileName, queue);

                    return null;
                }

                //
                // NOTE: We found a pool for this file, so use its version
                //       number.
                //
                version = localVersion = queue.PoolVersion;
                queue.MaxPoolSize = maxPoolSize;

                //
                // NOTE: Now, resize the pool to the new maximum size, if
                //       necessary.
                //
                ResizePool(queue, false);

                //
                // NOTE: Try and get a pooled connection from the queue.
                //
                poolQueue = queue.Queue;
                if (poolQueue == null) return null;

                //
                // NOTE: Temporarily tranfer the queue for this file into
                //       a local variable.  The queue for this file will
                //       be modified and then committed back to the real
                //       pool list (below) prior to returning from this
                //       method.
                //
                _queueList.Remove(fileName);
                poolQueue = new Queue<T>(poolQueue);
            }

            try
            {
                while (poolQueue.Count > 0)
                {
                    object connection = poolQueue.Dequeue();

                    if (connection == null) continue;

                    SQLiteConnectionHandle handle =
                        connection as SQLiteConnectionHandle;

                    if (handle == null) continue;

                    if (!handle.IsInvalid && !handle.IsClosed)
                    {
                        Interlocked.Increment(ref _poolOpened);
                        return handle;
                    }
                }
            }
            finally
            {
                lock (_syncRoot)
                {
                    //
                    // NOTE: We must check [again] if a pool exists for
                    //       this file because one may have been added
                    //       while the search for an available connection
                    //       was in progress (above).
                    //
                    PoolQueue<T> queue;
                    Queue<T> newPoolQueue;
                    bool addPool;

                    if (_queueList.TryGetValue(fileName, out queue))
                    {
                        addPool = false;
                    }
                    else
                    {
                        addPool = true;

                        queue = new PoolQueue<T>(
                            localVersion, maxPoolSize);
                    }

                    newPoolQueue = queue.Queue;

                    while (poolQueue.Count > 0)
                        newPoolQueue.Enqueue(poolQueue.Dequeue());

                    ResizePool(queue, false);

                    if (addPool)
                        _queueList.Add(fileName, queue);
                }
            }

            return null;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteConnectionPool2 Members (Static, Non-Formal)
        public static void ResetCounts()
        {
            lock (_syncRoot)
            {
                _poolOpened = 0;
                _poolClosed = 0;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        public static void GetCounts(
            ref int openCount,
            ref int closeCount
            )
        {
            lock (_syncRoot)
            {
                openCount = _poolOpened;
                closeCount = _poolClosed;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Helper Methods
        /// <summary>
        /// We do not have to thread-lock anything in this function, because
        /// it is only called by other functions above which already take the
        /// lock.
        /// </summary>
        /// <param name="queue">
        /// The pool queue to resize.
        /// </param>
        /// <param name="add">
        /// If a function intends to add to the pool, this is true, which
        /// forces the resize to take one more than it needs from the pool.
        /// </param>
        private static void ResizePool(
            PoolQueue<T> queue,
            bool add
            )
        {
            int target = queue.MaxPoolSize;

            if (add && target > 0) target--;

            Queue<T> poolQueue = queue.Queue;
            if (poolQueue == null) return;

            while (poolQueue.Count > target)
            {
                object connection = poolQueue.Dequeue();

                if (connection == null) continue;

                SQLiteConnectionHandle handle =
                    connection as SQLiteConnectionHandle;

                if (handle != null)
                    handle.Dispose();
            }
        }
        #endregion
    }
    #endregion
}

Changes to System.Data.SQLite/SQLiteConnectionStringBuilder.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Data.Common;
  using System.ComponentModel;
  using System.Collections;
  using System.Globalization;
  using System.Reflection;

#if !PLATFORM_COMPACTFRAMEWORK
  using System.ComponentModel.Design;

  /// <summary>
  /// SQLite implementation of DbConnectionStringBuilder.
  /// </summary>
  [DefaultProperty("DataSource")]
  [DefaultMember("Item")]
  public sealed class SQLiteConnectionStringBuilder : DbConnectionStringBuilder
  {



|













<
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17


18
19
20
21
22
23
24
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Data.Common;
  using System.ComponentModel;
  using System.Collections;
  using System.Globalization;
  using System.Reflection;

#if !PLATFORM_COMPACTFRAMEWORK


  /// <summary>
  /// SQLite implementation of DbConnectionStringBuilder.
  /// </summary>
  [DefaultProperty("DataSource")]
  [DefaultMember("Item")]
  public sealed class SQLiteConnectionStringBuilder : DbConnectionStringBuilder
  {
112
113
114
115
116
117
118

119
120
121
122
123
124
125
        this["synchronous"] = value;
      }
    }

    /// <summary>
    /// Gets/Sets the encoding for the connection string.  The default is "False" which indicates UTF-8 encoding.
    /// </summary>

    [Browsable(true)]
    [DefaultValue(false)]
    public bool UseUTF16Encoding
    {
      get
      {
        object value;







>







110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
        this["synchronous"] = value;
      }
    }

    /// <summary>
    /// Gets/Sets the encoding for the connection string.  The default is "False" which indicates UTF-8 encoding.
    /// </summary>
    [DisplayName("Use UTF-16 Encoding")]
    [Browsable(true)]
    [DefaultValue(false)]
    public bool UseUTF16Encoding
    {
      get
      {
        object value;
151
152
153
154
155
156
157

158
159
160
161
162
163
164
      }
    }

    /// <summary>
    /// Gets/Sets whethor not to store GUID's in binary format.  The default is True
    /// which saves space in the database.
    /// </summary>

    [Browsable(true)]
    [DefaultValue(true)]
    public bool BinaryGUID
    {
      get
      {
        object value;







>







150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
      }
    }

    /// <summary>
    /// Gets/Sets whethor not to store GUID's in binary format.  The default is True
    /// which saves space in the database.
    /// </summary>
    [DisplayName("Binary GUID")]
    [Browsable(true)]
    [DefaultValue(true)]
    public bool BinaryGUID
    {
      get
      {
        object value;
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196

197

198
199
200
201
202
203
204
205
206
207
208
209
210
211
212




















213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231




































































































































232
233
234
235
236
237
238
    [DefaultValue("")]
    public string DataSource
    {
      get
      {
        object value;
        TryGetValue("data source", out value);
        return value.ToString();
      }
      set
      {
        this["data source"] = value;
      }
    }

    /// <summary>
    /// An alternate to the data source property
    /// </summary>

    [Browsable(false)]

    public string Uri
    {
      get
      {
        object value;
        TryGetValue("uri", out value);
        return value.ToString();
      }
      set
      {
        this["uri"] = value;
      }
    }

    /// <summary>




















    /// Gets/sets the default command timeout for newly-created commands.  This is especially useful for 
    /// commands used internally such as inside a SQLiteTransaction, where setting the timeout is not possible.
    /// </summary>
    [DisplayName("Default Timeout")]
    [Browsable(true)]
    [DefaultValue(30)]
    public int DefaultTimeout
    {
      get
      {
        object value;
        TryGetValue("default timeout", out value);
        return Convert.ToInt32(value, CultureInfo.CurrentCulture);
      }
      set
      {
        this["default timeout"] = value;
      }
    }





































































































































    /// <summary>
    /// Determines whether or not the connection will automatically participate
    /// in the current distributed transaction (if one exists)
    /// </summary>
    [Browsable(true)]
    [DefaultValue(true)]







|










>
|
>






|








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


















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







179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
    [DefaultValue("")]
    public string DataSource
    {
      get
      {
        object value;
        TryGetValue("data source", out value);
        return (value != null) ? value.ToString() : null;
      }
      set
      {
        this["data source"] = value;
      }
    }

    /// <summary>
    /// An alternate to the data source property
    /// </summary>
    [DisplayName("URI")]
    [Browsable(true)]
    [DefaultValue(null)]
    public string Uri
    {
      get
      {
        object value;
        TryGetValue("uri", out value);
        return (value != null) ? value.ToString() : null;
      }
      set
      {
        this["uri"] = value;
      }
    }

    /// <summary>
    /// An alternate to the data source property that uses the SQLite URI syntax.
    /// </summary>
    [DisplayName("Full URI")]
    [Browsable(true)]
    [DefaultValue(null)]
    public string FullUri
    {
      get
      {
        object value;
        TryGetValue("fulluri", out value);
        return (value != null) ? value.ToString() : null;
      }
      set
      {
        this["fulluri"] = value;
      }
    }

    /// <summary>
    /// Gets/sets the default command timeout for newly-created commands.  This is especially useful for
    /// commands used internally such as inside a SQLiteTransaction, where setting the timeout is not possible.
    /// </summary>
    [DisplayName("Default Timeout")]
    [Browsable(true)]
    [DefaultValue(30)]
    public int DefaultTimeout
    {
      get
      {
        object value;
        TryGetValue("default timeout", out value);
        return Convert.ToInt32(value, CultureInfo.CurrentCulture);
      }
      set
      {
        this["default timeout"] = value;
      }
    }

    /// <summary>
    /// Gets/sets the default maximum sleep time for newly-created commands.
    /// </summary>
    [DisplayName("Default Maximum Sleep Time")]
    [Browsable(true)]
    [DefaultValue(150)]
    public int DefaultMaximumSleepTime
    {
      get
      {
        object value;
        TryGetValue("defaultmaximumsleeptime", out value);
        return Convert.ToInt32(value, CultureInfo.CurrentCulture);
      }
      set
      {
        this["defaultmaximumsleeptime"] = value;
      }
    }

    /// <summary>
    /// Gets/sets the busy timeout to use with the SQLite core library.
    /// </summary>
    [DisplayName("Busy Timeout")]
    [Browsable(true)]
    [DefaultValue(0)]
    public int BusyTimeout
    {
      get
      {
        object value;
        TryGetValue("busytimeout", out value);
        return Convert.ToInt32(value, CultureInfo.CurrentCulture);
      }
      set
      {
        this["busytimeout"] = value;
      }
    }

    /// <summary>
    /// <b>EXPERIMENTAL</b> --
    /// The wait timeout to use with
    /// <see cref="SQLiteConnection.WaitForEnlistmentReset" /> method.
    /// This is only used when waiting for the enlistment to be reset
    /// prior to enlisting in a transaction, and then only when the
    /// appropriate connection flag is set.
    /// </summary>
    [DisplayName("Wait Timeout")]
    [Browsable(true)]
    [DefaultValue(30000)]
    public int WaitTimeout
    {
      get
      {
        object value;
        TryGetValue("waittimeout", out value);
        return Convert.ToInt32(value, CultureInfo.CurrentCulture);
      }
      set
      {
        this["waittimeout"] = value;
      }
    }

    /// <summary>
    /// Gets/sets the maximum number of retries when preparing SQL to be executed.
    /// This normally only applies to preparation errors resulting from the database
    /// schema being changed.
    /// </summary>
    [DisplayName("Prepare Retries")]
    [Browsable(true)]
    [DefaultValue(3)]
    public int PrepareRetries
    {
        get
        {
            object value;
            TryGetValue("prepareretries", out value);
            return Convert.ToInt32(value, CultureInfo.CurrentCulture);
        }
        set
        {
            this["prepareretries"] = value;
        }
    }

    /// <summary>
    /// Gets/sets the maximum number of retries when stepping SQL to be executed.
    /// This normally only applies to stepping errors resulting from the database
    /// being locked.
    /// </summary>
    [DisplayName("Step Retries")]
    [Browsable(true)]
    [DefaultValue(40)]
    public int StepRetries
    {
        get
        {
            object value;
            TryGetValue("stepretries", out value);
            return Convert.ToInt32(value, CultureInfo.CurrentCulture);
        }
        set
        {
            this["stepretries"] = value;
        }
    }

    /// <summary>
    /// Gets/sets the approximate number of virtual machine instructions between
    /// progress events.  In order for progress events to actually fire, the event
    /// handler must be added to the <see cref="SQLiteConnection.Progress" /> event
    /// as well.
    /// </summary>
    [DisplayName("Progress Ops")]
    [Browsable(true)]
    [DefaultValue(0)]
    public int ProgressOps
    {
        get
        {
            object value;
            TryGetValue("progressops", out value);
            return Convert.ToInt32(value, CultureInfo.CurrentCulture);
        }
        set
        {
            this["progressops"] = value;
        }
    }

    /// <summary>
    /// Determines whether or not the connection will automatically participate
    /// in the current distributed transaction (if one exists)
    /// </summary>
    [Browsable(true)]
    [DefaultValue(true)]
250
251
252
253
254
255
256

257
258
259
260
261
262
263
      }
    }

    /// <summary>
    /// If set to true, will throw an exception if the database specified in the connection
    /// string does not exist.  If false, the database will be created automatically.
    /// </summary>

    [Browsable(true)]
    [DefaultValue(false)]
    public bool FailIfMissing
    {
      get
      {
        object value;







>







404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
      }
    }

    /// <summary>
    /// If set to true, will throw an exception if the database specified in the connection
    /// string does not exist.  If false, the database will be created automatically.
    /// </summary>
    [DisplayName("Fail If Missing")]
    [Browsable(true)]
    [DefaultValue(false)]
    public bool FailIfMissing
    {
      get
      {
        object value;
319
320
321
322
323
324
325
326
327
328
329
330
331
332


















































































333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
    [DefaultValue("")]
    public string Password
    {
      get
      {
        object value;
        TryGetValue("password", out value);
        return value.ToString();
      }
      set
      {
        this["password"] = value;
      }
    }



















































































    /// <summary>
    /// Gets/Sets the page size for the connection.
    /// </summary>
    [DisplayName("Page Size")]
    [Browsable(true)]
    [DefaultValue(1024)]
    public int PageSize
    {
      get
      {
        object value;
        TryGetValue("page size", out value);
        return Convert.ToInt32(value, CultureInfo.CurrentCulture);
      }
      set
      {
        this["page size"] = value;
      }
    }

    /// <summary>
    /// Gets/Sets the maximum number of pages the database may hold
    /// </summary>
    [DisplayName("Max Page Count")]
    [Browsable(true)]
    [DefaultValue(0)]
    public int MaxPageCount
    {
      get
      {
        object value;







|






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






|

















|







474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
    [DefaultValue("")]
    public string Password
    {
      get
      {
        object value;
        TryGetValue("password", out value);
        return (value != null) ? value.ToString() : null;
      }
      set
      {
        this["password"] = value;
      }
    }

    /// <summary>
    /// Gets/sets the database encryption hexadecimal password
    /// </summary>
    [DisplayName("Hexadecimal Password")]
    [Browsable(true)]
    [PasswordPropertyText(true)]
    [DefaultValue(null)]
    public byte[] HexPassword
    {
        get
        {
            object value;

            if (TryGetValue("hexpassword", out value))
            {
                if (value is string)
                    return SQLiteConnection.FromHexString((string)value);
                else if (value != null)
                    return (byte[])value;
            }

            return null;
        }
        set
        {
            this["hexpassword"] = SQLiteConnection.ToHexString(value);
        }
    }

    /// <summary>
    /// Gets/sets the database encryption textual password
    /// </summary>
    [DisplayName("Textual Password")]
    [Browsable(true)]
    [PasswordPropertyText(true)]
    [DefaultValue(null)]
    public string TextPassword
    {
        get
        {
            object value;

            if (TryGetValue("textpassword", out value))
                return (value != null) ? value.ToString() : null;

            return null;
        }
        set
        {
            this["textpassword"] = value;
        }
    }

    /// <summary>
    /// Gets/sets the database encryption textual password in hexadecimal
    /// </summary>
    [DisplayName("Textual Hexadecimal Password")]
    [Browsable(true)]
    [PasswordPropertyText(true)]
    [DefaultValue(null)]
    public byte[] TextHexPassword
    {
        get
        {
            object value;

            if (TryGetValue("texthexpassword", out value))
            {
                if (value is string)
                    return SQLiteConnection.FromHexString((string)value);
                else if (value != null)
                    return (byte[])value;
            }

            return null;
        }
        set
        {
            this["texthexpassword"] = SQLiteConnection.ToHexString(value);
        }
    }

    /// <summary>
    /// Gets/Sets the page size for the connection.
    /// </summary>
    [DisplayName("Page Size")]
    [Browsable(true)]
    [DefaultValue(4096)]
    public int PageSize
    {
      get
      {
        object value;
        TryGetValue("page size", out value);
        return Convert.ToInt32(value, CultureInfo.CurrentCulture);
      }
      set
      {
        this["page size"] = value;
      }
    }

    /// <summary>
    /// Gets/Sets the maximum number of pages the database may hold
    /// </summary>
    [DisplayName("Maximum Page Count")]
    [Browsable(true)]
    [DefaultValue(0)]
    public int MaxPageCount
    {
      get
      {
        object value;
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396

397
398
399
400
401
402
403

404

405


406



407
408
409
410
411
412























































































413
414
415
416
417
418
419
420
421
422
423
424
425
426
    }

    /// <summary>
    /// Gets/Sets the cache size for the connection.
    /// </summary>
    [DisplayName("Cache Size")]
    [Browsable(true)]
    [DefaultValue(2000)]
    public int CacheSize
    {
      get
      {
        object value;
        TryGetValue("cache size", out value);
        return Convert.ToInt32(value, CultureInfo.CurrentCulture);
      }
      set
      {
        this["cache size"] = value;
      }
    }

    /// <summary>
    /// Gets/Sets the datetime format for the connection.
    /// </summary>

    [Browsable(true)]
    [DefaultValue(SQLiteDateFormats.ISO8601)]
    public SQLiteDateFormats DateTimeFormat
    {
      get
      {
        object value;

        TryGetValue("datetimeformat", out value);

        if (value is string)


          return (SQLiteDateFormats)TypeDescriptor.GetConverter(typeof(SQLiteDateFormats)).ConvertFrom(value);



        else return (SQLiteDateFormats)value;
      }
      set
      {
        this["datetimeformat"] = value;
      }























































































    }

    /// <summary>
    /// Determines how SQLite handles the transaction journal file.
    /// </summary>
    [Browsable(true)]
    [DefaultValue(SQLiteJournalModeEnum.Delete)]
    [DisplayName("Journal Mode")]
    public SQLiteJournalModeEnum JournalMode
    {
      get
      {
        object value;
        TryGetValue("journal mode", out value);







|















|

>

|


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






|







609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
    }

    /// <summary>
    /// Gets/Sets the cache size for the connection.
    /// </summary>
    [DisplayName("Cache Size")]
    [Browsable(true)]
    [DefaultValue(-2000)]
    public int CacheSize
    {
      get
      {
        object value;
        TryGetValue("cache size", out value);
        return Convert.ToInt32(value, CultureInfo.CurrentCulture);
      }
      set
      {
        this["cache size"] = value;
      }
    }

    /// <summary>
    /// Gets/Sets the DateTime format for the connection.
    /// </summary>
    [DisplayName("DateTime Format")]
    [Browsable(true)]
    [DefaultValue(SQLiteDateFormats.Default)]
    public SQLiteDateFormats DateTimeFormat
    {
        get
        {
            object value;

            if (TryGetValue("datetimeformat", out value))
            {
                if (value is SQLiteDateFormats)
                    return (SQLiteDateFormats)value;
                else if (value != null)
                    return (SQLiteDateFormats)TypeDescriptor.GetConverter(
                        typeof(SQLiteDateFormats)).ConvertFrom(value);
            }

            return SQLiteDateFormats.Default;
        }
        set
        {
            this["datetimeformat"] = value;
        }
    }

    /// <summary>
    /// Gets/Sets the DateTime kind for the connection.
    /// </summary>
    [DisplayName("DateTime Kind")]
    [Browsable(true)]
    [DefaultValue(DateTimeKind.Unspecified)]
    public DateTimeKind DateTimeKind
    {
        get
        {
            object value;

            if (TryGetValue("datetimekind", out value))
            {
                if (value is DateTimeKind)
                    return (DateTimeKind)value;
                else if (value != null)
                    return (DateTimeKind)TypeDescriptor.GetConverter(
                        typeof(DateTimeKind)).ConvertFrom(value);
            }

            return DateTimeKind.Unspecified;
        }
        set
        {
            this["datetimekind"] = value;
        }
    }

    /// <summary>
    /// Gets/sets the DateTime format string used for formatting
    /// and parsing purposes.
    /// </summary>
    [DisplayName("DateTime Format String")]
    [Browsable(true)]
    [DefaultValue(null)]
    public string DateTimeFormatString
    {
        get
        {
            object value;

            if (TryGetValue("datetimeformatstring", out value))
            {
                if (value is string)
                    return (string)value;
                else if (value != null)
                    return value.ToString();
            }

            return null;
        }
        set
        {
            this["datetimeformatstring"] = value;
        }
    }

    /// <summary>
    /// Gets/Sets the placeholder base schema name used for
    /// .NET Framework compatibility purposes.
    /// </summary>
    [DisplayName("Base Schema Name")]
    [Browsable(true)]
    [DefaultValue(SQLiteConnection.DefaultBaseSchemaName)]
    public string BaseSchemaName
    {
        get
        {
            object value;

            if (TryGetValue("baseschemaname", out value))
            {
                if (value is string)
                    return (string)value;
                else if (value != null)
                    return value.ToString();
            }

            return null;
        }
        set
        {
            this["baseschemaname"] = value;
        }
    }

    /// <summary>
    /// Determines how SQLite handles the transaction journal file.
    /// </summary>
    [Browsable(true)]
    [DefaultValue(SQLiteJournalModeEnum.Default)]
    [DisplayName("Journal Mode")]
    public SQLiteJournalModeEnum JournalMode
    {
      get
      {
        object value;
        TryGetValue("journal mode", out value);
453
454
455
456
457
458
459





































































460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
























































































































































480
481
482
483
484
485
486
          return (IsolationLevel)value;
      }
      set
      {
        this["default isolationlevel"] = value;
      }
    }






































































    /// <summary>
    /// If enabled, use foreign key constraints
    /// </summary>
    [DisplayName("Foreign Keys")]
    [Browsable(true)]
    [DefaultValue(false)]
    public bool ForeignKeys
    {
        get
        {
            object value;
            TryGetValue("foreign keys", out value);
            return SQLiteConvert.ToBoolean(value);
        }
        set
        {
            this["foreign keys"] = value;
        }
    }

























































































































































    /// <summary>
    /// Helper function for retrieving values from the connectionstring
    /// </summary>
    /// <param name="keyword">The keyword to retrieve settings for</param>
    /// <param name="value">The resulting parameter value</param>
    /// <returns>Returns true if the value was found and returned</returns>







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




















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







785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
          return (IsolationLevel)value;
      }
      set
      {
        this["default isolationlevel"] = value;
      }
    }

    /// <summary>
    /// Gets/sets the default database type for the connection.
    /// </summary>
    [DisplayName("Default Database Type")]
    [Browsable(true)]
    [DefaultValue(SQLiteConnection.BadDbType)]
    public DbType DefaultDbType
    {
        get
        {
            object value;

            if (TryGetValue("defaultdbtype", out value))
            {
                if (value is string)
                    return (DbType)TypeDescriptor.GetConverter(
                        typeof(DbType)).ConvertFrom(value);
                else if (value != null)
                    return (DbType)value;
            }

            return SQLiteConnection.BadDbType;
        }
        set
        {
            this["defaultdbtype"] = value;
        }
    }

    /// <summary>
    /// Gets/sets the default type name for the connection.
    /// </summary>
    [DisplayName("Default Type Name")]
    [Browsable(true)]
    [DefaultValue(null)]
    public string DefaultTypeName
    {
        get
        {
            object value;
            TryGetValue("defaulttypename", out value);
            return (value != null) ? value.ToString() : null;
        }
        set
        {
            this["defaulttypename"] = value;
        }
    }

    /// <summary>
    /// Gets/sets the VFS name for the connection.
    /// </summary>
    [DisplayName("VFS Name")]
    [Browsable(true)]
    [DefaultValue(null)]
    public string VfsName
    {
        get
        {
            object value;
            TryGetValue("vfsname", out value);
            return (value != null) ? value.ToString() : null;
        }
        set
        {
            this["vfsname"] = value;
        }
    }

    /// <summary>
    /// If enabled, use foreign key constraints
    /// </summary>
    [DisplayName("Foreign Keys")]
    [Browsable(true)]
    [DefaultValue(false)]
    public bool ForeignKeys
    {
        get
        {
            object value;
            TryGetValue("foreign keys", out value);
            return SQLiteConvert.ToBoolean(value);
        }
        set
        {
            this["foreign keys"] = value;
        }
    }

    /// <summary>
    /// Enable or disable the recursive trigger capability.
    /// </summary>
    [DisplayName("Recursive Triggers")]
    [Browsable(true)]
    [DefaultValue(false)]
    public bool RecursiveTriggers
    {
        get
        {
            object value;
            TryGetValue("recursive triggers", out value);
            return SQLiteConvert.ToBoolean(value);
        }
        set
        {
            this["recursive triggers"] = value;
        }
    }

    /// <summary>
    /// If non-null, this is the version of ZipVFS to use.  This requires the
    /// System.Data.SQLite interop assembly -AND- primary managed assembly to
    /// be compiled with the INTEROP_INCLUDE_ZIPVFS option; otherwise, this
    /// property does nothing.
    /// </summary>
    [DisplayName("ZipVFS Version")]
    [Browsable(true)]
    [DefaultValue(null)]
    public string ZipVfsVersion
    {
        get
        {
            object value;
            TryGetValue("zipvfsversion", out value);
            return (value != null) ? value.ToString() : null;
        }
        set
        {
            this["zipvfsversion"] = value;
        }
    }

    /// <summary>
    /// Gets/Sets the extra behavioral flags.
    /// </summary>
    [Browsable(true)]
    [DefaultValue(SQLiteConnectionFlags.Default)]
    public SQLiteConnectionFlags Flags
    {
        get
        {
            object value;

            if (TryGetValue("flags", out value))
            {
                if (value is SQLiteConnectionFlags)
                    return (SQLiteConnectionFlags)value;
                else if (value != null)
                    return (SQLiteConnectionFlags)TypeDescriptor.GetConverter(
                        typeof(SQLiteConnectionFlags)).ConvertFrom(value);
            }

            return SQLiteConnectionFlags.Default;
        }
        set
        {
            this["flags"] = value;
        }
    }

    /// <summary>
    /// If enabled, apply the default connection settings to opened databases.
    /// </summary>
    [DisplayName("Set Defaults")]
    [Browsable(true)]
    [DefaultValue(true)]
    public bool SetDefaults
    {
        get
        {
            object value;
            TryGetValue("setdefaults", out value);
            return SQLiteConvert.ToBoolean(value);
        }
        set
        {
            this["setdefaults"] = value;
        }
    }

    /// <summary>
    /// If enabled, attempt to resolve the provided data source file name to a
    /// full path before opening.
    /// </summary>
    [DisplayName("To Full Path")]
    [Browsable(true)]
    [DefaultValue(true)]
    public bool ToFullPath
    {
        get
        {
            object value;
            TryGetValue("tofullpath", out value);
            return SQLiteConvert.ToBoolean(value);
        }
        set
        {
            this["tofullpath"] = value;
        }
    }

    /// <summary>
    /// If enabled, skip using the configured default connection flags.
    /// </summary>
    [DisplayName("No Default Flags")]
    [Browsable(true)]
    [DefaultValue(false)]
    public bool NoDefaultFlags
    {
        get
        {
            object value;
            TryGetValue("nodefaultflags", out value);
            return SQLiteConvert.ToBoolean(value);
        }
        set
        {
            this["nodefaultflags"] = value;
        }
    }

    /// <summary>
    /// If enabled, skip using the configured shared connection flags.
    /// </summary>
    [DisplayName("No Shared Flags")]
    [Browsable(true)]
    [DefaultValue(false)]
    public bool NoSharedFlags
    {
        get
        {
            object value;
            TryGetValue("nosharedflags", out value);
            return SQLiteConvert.ToBoolean(value);
        }
        set
        {
            this["nosharedflags"] = value;
        }
    }

    /// <summary>
    /// Helper function for retrieving values from the connectionstring
    /// </summary>
    /// <param name="keyword">The keyword to retrieve settings for</param>
    /// <param name="value">The resulting parameter value</param>
    /// <returns>Returns true if the value was found and returned</returns>
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
      if (pd == null) return b;

      // Attempt to coerce the value into something more solid
      if (b)
      {
        if (pd.PropertyType == typeof(Boolean))
          value = SQLiteConvert.ToBoolean(value);
        else
          value = TypeDescriptor.GetConverter(pd.PropertyType).ConvertFrom(value);
      }
      else
      {
        DefaultValueAttribute att = pd.Attributes[typeof(DefaultValueAttribute)] as DefaultValueAttribute;
        if (att != null)
        {







|







1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
      if (pd == null) return b;

      // Attempt to coerce the value into something more solid
      if (b)
      {
        if (pd.PropertyType == typeof(Boolean))
          value = SQLiteConvert.ToBoolean(value);
        else if (pd.PropertyType != typeof(byte[]))
          value = TypeDescriptor.GetConverter(pd.PropertyType).ConvertFrom(value);
      }
      else
      {
        DefaultValueAttribute att = pd.Attributes[typeof(DefaultValueAttribute)] as DefaultValueAttribute;
        if (att != null)
        {

Changes to System.Data.SQLite/SQLiteConvert.cs.

1
2
3
4
5
6
7
8
9
10





11
12
13
14
15
16










17







18







19








20
21





22



23



24





25
26




27

































28
29
30
31
32
33
34


35


36








37
38
39
40
41
42
43
44
45

46

47
48












49
50
51
52
53
54
55
56








57
58
59
60


61




62
63


64
65
66
67
68
69
70
71
72
73

74
75
76
77
78
79
80
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;





  using System.Runtime.InteropServices;
  using System.Collections.Generic;
  using System.ComponentModel;
  using System.Globalization;
  using System.Text;











#if !PLATFORM_COMPACTFRAMEWORK 







  using System.ComponentModel.Design;







#endif









  /// <summary>





  /// This base class provides datatype conversion services for the SQLite provider.



  /// </summary>



  public abstract class SQLiteConvert





  {
    /// <summary>




    /// An array of ISO8601 datetime formats we support conversion from

































    /// </summary>
    private static string[] _datetimeFormats = new string[] {
      "THHmmss",
      "THHmm",
      "HH:mm:ss",
      "HH:mm",
      "HH:mm:ss.FFFFFFF",


      "yy-MM-dd",


      "yyyy-MM-dd",








      "yyyy-MM-dd HH:mm:ss.FFFFFFF",
      "yyyy-MM-dd HH:mm:ss",
      "yyyy-MM-dd HH:mm",                               
      "yyyy-MM-ddTHH:mm:ss.FFFFFFF",
      "yyyy-MM-ddTHH:mm",
      "yyyy-MM-ddTHH:mm:ss",
      "yyyyMMddHHmmss",
      "yyyyMMddHHmm",
      "yyyyMMddTHHmmssFFFFFFF",

      "yyyyMMdd"

    };













    /// <summary>
    /// An UTF-8 Encoding instance, so we can convert strings to and from UTF-8
    /// </summary>
    private static Encoding _utf8 = new UTF8Encoding();
    /// <summary>
    /// The default DateTime format for this instance
    /// </summary>
    internal SQLiteDateFormats _datetimeFormat;








    /// <summary>
    /// Initializes the conversion class
    /// </summary>
    /// <param name="fmt">The default date/time format to use for this instance</param>


    internal SQLiteConvert(SQLiteDateFormats fmt)




    {
      _datetimeFormat = fmt;


    }

    #region UTF-8 Conversion Functions
    /// <summary>
    /// Converts a string to a UTF-8 encoded byte array sized to include a null-terminating character.
    /// </summary>
    /// <param name="sourceText">The string to convert to UTF-8</param>
    /// <returns>A byte array containing the converted string plus an extra 0 terminating byte at the end of the array.</returns>
    public static byte[] ToUTF8(string sourceText)
    {

      Byte[] byteArray;
      int nlen = _utf8.GetByteCount(sourceText) + 1;

      byteArray = new byte[nlen];
      nlen = _utf8.GetBytes(sourceText, 0, sourceText.Length, byteArray, 0);
      byteArray[nlen] = 0;




|






>
>
>
>
>


<



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

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

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


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

|






>
|
>


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





|


>
>
>
>
>
>
>
>




>
>
|
>
>
>
>


>
>










>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;

#if !NET_COMPACT_20 && TRACE_WARNING
  using System.Diagnostics;
#endif

  using System.Runtime.InteropServices;
  using System.Collections.Generic;

  using System.Globalization;
  using System.Text;

  /// <summary>
  /// This base class provides datatype conversion services for the SQLite provider.
  /// </summary>
  public abstract class SQLiteConvert
  {
    /// <summary>
    /// This character is used to escape other characters, including itself, in
    /// connection string property names and values.
    /// </summary>
    internal const char EscapeChar = '\\';

    /// <summary>
    /// This character can be used to wrap connection string property names and
    /// values.  Normally, it is optional; however, when used, it must be the
    /// first -AND- last character of that connection string property name -OR-
    /// value.
    /// </summary>
    internal const char QuoteChar = '"';

    /// <summary>
    /// This character can be used to wrap connection string property names and
    /// values.  Normally, it is optional; however, when used, it must be the
    /// first -AND- last character of that connection string property name -OR-
    /// value.
    /// </summary>
    internal const char AltQuoteChar = '\'';

    /// <summary>
    /// The character is used to separate the name and value for a connection
    /// string property.  This character cannot be present in any connection
    /// string property name.  This character can be present in a connection
    /// string property value; however, this should be avoided unless deemed
    /// absolutely necessary.
    /// </summary>
    internal const char ValueChar = '=';

    /// <summary>
    /// This character is used to separate connection string properties.  When
    /// the "No_SQLiteConnectionNewParser" setting is enabled, this character
    /// may not appear in connection string property names -OR- values.
    /// </summary>
    internal const char PairChar = ';';

    /// <summary>
    /// These are the characters that are special to the connection string
    /// parser.
    /// </summary>
    internal static readonly char[] SpecialChars = {
        QuoteChar, AltQuoteChar, PairChar, ValueChar, EscapeChar
    };

    /// <summary>
    /// The fallback default database type when one cannot be obtained from an
    /// existing connection instance.
    /// </summary>
    private const DbType FallbackDefaultDbType = DbType.Object;

    /// <summary>
    /// The fallback default database type name when one cannot be obtained from
    /// an existing connection instance.
    /// </summary>
    private static readonly string FallbackDefaultTypeName = String.Empty;

    /// <summary>
    /// The value for the Unix epoch (e.g. January 1, 1970 at midnight, in UTC).
    /// </summary>
    protected static readonly DateTime UnixEpoch =
        new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

    #pragma warning disable 414
    /// <summary>
    /// The value of the OLE Automation epoch represented as a Julian day.  This
    /// field cannot be removed as the test suite relies upon it.
    /// </summary>
    private static readonly double OleAutomationEpochAsJulianDay = 2415018.5;
    #pragma warning restore 414

    /// <summary>
    /// The format string for DateTime values when using the InvariantCulture or CurrentCulture formats.
    /// </summary>
    private const string FullFormat = "yyyy-MM-ddTHH:mm:ss.fffffffK";

    /// <summary>
    /// This is the minimum Julian Day value supported by this library
    /// (148731163200000).
    /// </summary>
    private static readonly long MinimumJd = computeJD(DateTime.MinValue);

    /// <summary>
    /// This is the maximum Julian Day value supported by this library
    /// (464269060799000).
    /// </summary>
    private static readonly long MaximumJd = computeJD(DateTime.MaxValue);

    /// <summary>
    /// An array of ISO-8601 DateTime formats that we support parsing.
    /// </summary>
    private static string[] _datetimeFormats = new string[] {
      "THHmmssK",
      "THHmmK",
      "HH:mm:ss.FFFFFFFK",
      "HH:mm:ssK",
      "HH:mmK",
      "yyyy-MM-dd HH:mm:ss.FFFFFFFK", /* NOTE: UTC default (5). */
      "yyyy-MM-dd HH:mm:ssK",
      "yyyy-MM-dd HH:mmK",
      "yyyy-MM-ddTHH:mm:ss.FFFFFFFK",
      "yyyy-MM-ddTHH:mmK",
      "yyyy-MM-ddTHH:mm:ssK",
      "yyyyMMddHHmmssK",
      "yyyyMMddHHmmK",
      "yyyyMMddTHHmmssFFFFFFFK",
      "THHmmss",
      "THHmm",
      "HH:mm:ss.FFFFFFF",
      "HH:mm:ss",
      "HH:mm",
      "yyyy-MM-dd HH:mm:ss.FFFFFFF", /* NOTE: Non-UTC default (19). */
      "yyyy-MM-dd HH:mm:ss",
      "yyyy-MM-dd HH:mm",
      "yyyy-MM-ddTHH:mm:ss.FFFFFFF",
      "yyyy-MM-ddTHH:mm",
      "yyyy-MM-ddTHH:mm:ss",
      "yyyyMMddHHmmss",
      "yyyyMMddHHmm",
      "yyyyMMddTHHmmssFFFFFFF",
      "yyyy-MM-dd",
      "yyyyMMdd",
      "yy-MM-dd"
    };

    /// <summary>
    /// The internal default format for UTC DateTime values when converting
    /// to a string.
    /// </summary>
    private static readonly string _datetimeFormatUtc = _datetimeFormats[5];

    /// <summary>
    /// The internal default format for local DateTime values when converting
    /// to a string.
    /// </summary>
    private static readonly string _datetimeFormatLocal = _datetimeFormats[19];

    /// <summary>
    /// An UTF-8 Encoding instance, so we can convert strings to and from UTF-8
    /// </summary>
    private static Encoding _utf8 = new UTF8Encoding();
    /// <summary>
    /// The default DateTime format for this instance.
    /// </summary>
    internal SQLiteDateFormats _datetimeFormat;
    /// <summary>
    /// The default DateTimeKind for this instance.
    /// </summary>
    internal DateTimeKind _datetimeKind;
    /// <summary>
    /// The default DateTime format string for this instance.
    /// </summary>
    internal string _datetimeFormatString = null;
    /// <summary>
    /// Initializes the conversion class
    /// </summary>
    /// <param name="fmt">The default date/time format to use for this instance</param>
    /// <param name="kind">The DateTimeKind to use.</param>
    /// <param name="fmtString">The DateTime format string to use.</param>
    internal SQLiteConvert(
        SQLiteDateFormats fmt,
        DateTimeKind kind,
        string fmtString
        )
    {
      _datetimeFormat = fmt;
      _datetimeKind = kind;
      _datetimeFormatString = fmtString;
    }

    #region UTF-8 Conversion Functions
    /// <summary>
    /// Converts a string to a UTF-8 encoded byte array sized to include a null-terminating character.
    /// </summary>
    /// <param name="sourceText">The string to convert to UTF-8</param>
    /// <returns>A byte array containing the converted string plus an extra 0 terminating byte at the end of the array.</returns>
    public static byte[] ToUTF8(string sourceText)
    {
      if (sourceText == null) return null;
      Byte[] byteArray;
      int nlen = _utf8.GetByteCount(sourceText) + 1;

      byteArray = new byte[nlen];
      nlen = _utf8.GetBytes(sourceText, 0, sourceText.Length, byteArray, 0);
      byteArray[nlen] = 0;

110
111
112
113
114
115
116
117





118
119
120

121

122
123

124
125
126
127
128
129
130
131
132
133
134


135
136

137















































































































































































































































































138

139
140
141







142




143

144






145







146
147

148


149
150
151



152
153
154





























































155
156
157


158

159

160











































161




162












163

164
165
166
167
168
169
170
171
172


173














174




175

176




































177
178
179
180
181



















































182

183



184

185





















186

187
188
189
190


191
192





















193
194
195
196
197
198








199





200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
    /// Converts a UTF-8 encoded IntPtr of the specified length into a .NET string
    /// </summary>
    /// <param name="nativestring">The pointer to the memory where the UTF-8 string is encoded</param>
    /// <param name="nativestringlen">The number of bytes to decode</param>
    /// <returns>A string containing the translated character(s)</returns>
    public static string UTF8ToString(IntPtr nativestring, int nativestringlen)
    {
      if (nativestringlen == 0 || nativestring == IntPtr.Zero) return "";





      if (nativestringlen == -1)
      {
        do

        {

          nativestringlen++;
        } while (Marshal.ReadByte(nativestring, nativestringlen) != 0);

      }

      byte[] byteArray = new byte[nativestringlen];
      
      Marshal.Copy(nativestring, byteArray, 0, nativestringlen);

      return _utf8.GetString(byteArray, 0, nativestringlen);
    }


    #endregion



    #region DateTime Conversion Functions

    /// <summary>















































































































































































































































































    /// Converts a string into a DateTime, using the current DateTimeFormat specified for the connection when it was opened.

    /// </summary>
    /// <remarks>
    /// Acceptable ISO8601 DateTime formats are:







    ///   yyyy-MM-dd HH:mm:ss




    ///   yyyyMMddHHmmss

    ///   yyyyMMddTHHmmssfffffff






    ///   yyyy-MM-dd







    ///   yy-MM-dd
    ///   yyyyMMdd

    ///   HH:mm:ss


    ///   THHmmss
    /// </remarks>
    /// <param name="dateText">The string containing either a Tick value, a JulianDay double, or an ISO8601-format string</param>



    /// <returns>A DateTime value</returns>
    public DateTime ToDateTime(string dateText)
    {





























































      switch (_datetimeFormat)
      {
        case SQLiteDateFormats.Ticks:


          return new DateTime(Convert.ToInt64(dateText, CultureInfo.InvariantCulture));

        case SQLiteDateFormats.JulianDay:

          return ToDateTime(Convert.ToDouble(dateText, CultureInfo.InvariantCulture));











































        default:




          return DateTime.ParseExact(dateText, _datetimeFormats, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None);












      }

    }

    /// <summary>
    /// Converts a julianday value into a DateTime
    /// </summary>
    /// <param name="julianDay">The value to convert</param>
    /// <returns>A .NET DateTime</returns>
    public DateTime ToDateTime(double julianDay)
    {


      return DateTime.FromOADate(julianDay - 2415018.5);














    }






    /// <summary>




































    /// Converts a DateTime struct to a JulianDay double
    /// </summary>
    /// <param name="value">The DateTime to convert</param>
    /// <returns>The JulianDay value the Datetime represents</returns>
    public double ToJulianDay(DateTime value)



















































    {

      return value.ToOADate() + 2415018.5;



    }























    /// <summary>

    /// Converts a DateTime to a string value, using the current DateTimeFormat specified for the connection when it was opened.
    /// </summary>
    /// <param name="dateValue">The DateTime value to convert</param>
    /// <returns>Either a string consisting of the tick count for DateTimeFormat.Ticks, a JulianDay double, or a date/time in ISO8601 format.</returns>


    public string ToString(DateTime dateValue)
    {





















      switch (_datetimeFormat)
      {
        case SQLiteDateFormats.Ticks:
          return dateValue.Ticks.ToString(CultureInfo.InvariantCulture);
        case SQLiteDateFormats.JulianDay:
          return ToJulianDay(dateValue).ToString(CultureInfo.InvariantCulture);








        default:





          return dateValue.ToString(_datetimeFormats[7], CultureInfo.InvariantCulture);
      }
    }

    /// <summary>
    /// Internal function to convert a UTF-8 encoded IntPtr of the specified length to a DateTime.
    /// </summary>
    /// <remarks>
    /// This is a convenience function, which first calls ToString() on the IntPtr to convert it to a string, then calls
    /// ToDateTime() on the string to return a DateTime.
    /// </remarks>
    /// <param name="ptr">A pointer to the UTF-8 encoded string</param>
    /// <param name="len">The length in bytes of the string</param>
    /// <returns>The parsed DateTime value</returns>
    internal DateTime ToDateTime(IntPtr ptr, int len)
    {
      return ToDateTime(ToString(ptr, len));
    }

    #endregion

    /// <summary>
    /// Smart method of splitting a string.  Skips quoted elements, removes the quotes.
    /// </summary>
    /// <remarks>
    /// This split function works somewhat like the String.Split() function in that it breaks apart a string into







|
>
>
>
>
>
|

<
>
|
>

|
>



|



<
|
|

>
>


>

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



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

|
>
>
>



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









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

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




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

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

>
|


|
>
>


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
















<







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
268
269

270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957

958
959
960
961
962
963
964
    /// Converts a UTF-8 encoded IntPtr of the specified length into a .NET string
    /// </summary>
    /// <param name="nativestring">The pointer to the memory where the UTF-8 string is encoded</param>
    /// <param name="nativestringlen">The number of bytes to decode</param>
    /// <returns>A string containing the translated character(s)</returns>
    public static string UTF8ToString(IntPtr nativestring, int nativestringlen)
    {
      if (nativestring == IntPtr.Zero || nativestringlen == 0) return String.Empty;
#if NET_STANDARD_21
      return (nativestringlen < 0) ?
        Marshal.PtrToStringUTF8(nativestring) :
        Marshal.PtrToStringUTF8(nativestring, nativestringlen);
#else
      if (nativestringlen < 0)
      {

        nativestringlen = 0;

        while (Marshal.ReadByte(nativestring, nativestringlen) != 0)
          nativestringlen++;

        if (nativestringlen == 0) return String.Empty;
      }

      byte[] byteArray = new byte[nativestringlen];

      Marshal.Copy(nativestring, byteArray, 0, nativestringlen);

      return _utf8.GetString(byteArray, 0, nativestringlen);

#endif
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region DateTime Conversion Functions
    #region New Julian Day Conversion Methods
    /// <summary>
    /// Checks if the specified <see cref="Int64" /> is within the
    /// supported range for a Julian Day value.
    /// </summary>
    /// <param name="jd">
    /// The Julian Day value to check.
    /// </param>
    /// <returns>
    /// Non-zero if the specified Julian Day value is in the supported
    /// range; otherwise, zero.
    /// </returns>
    private static bool isValidJd(
        long jd
        )
    {
        return ((jd >= MinimumJd) && (jd <= MaximumJd));
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Converts a Julian Day value from a <see cref="Double" /> to an
    /// <see cref="Int64" />.
    /// </summary>
    /// <param name="julianDay">
    /// The Julian Day <see cref="Double" /> value to convert.
    /// </param>
    /// <returns>
    /// The resulting Julian Day <see cref="Int64" /> value.
    /// </returns>
    private static long DoubleToJd(
        double julianDay
        )
    {
        return (long)Math.Round(julianDay * 86400000.0);
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Converts a Julian Day value from an <see cref="Int64" /> to a
    /// <see cref="Double" />.
    /// </summary>
    /// <param name="jd">
    /// The Julian Day <see cref="Int64" /> value to convert.
    /// </param>
    /// <returns>
    /// The resulting Julian Day <see cref="Double" /> value.
    /// </returns>
    private static double JdToDouble(
        long jd
        )
    {
        return (double)(jd / 86400000.0);
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Converts a Julian Day value to a <see cref="DateTime" />.
    /// This method was translated from the "computeYMD" function in the
    /// "date.c" file belonging to the SQLite core library.
    /// </summary>
    /// <param name="jd">
    /// The Julian Day value to convert.
    /// </param>
    /// <param name="badValue">
    /// The <see cref="DateTime" /> value to return in the event that the
    /// Julian Day is out of the supported range.  If this value is null,
    /// an exception will be thrown instead.
    /// </param>
    /// <returns>
    /// A <see cref="DateTime" /> value that contains the year, month, and
    /// day values that are closest to the specified Julian Day value.
    /// </returns>
    private static DateTime computeYMD(
        long jd,
        DateTime? badValue
        )
    {
        if (!isValidJd(jd))
        {
            if (badValue == null)
            {
                throw new ArgumentException(
                    "Not a supported Julian Day value.");
            }

            return (DateTime)badValue;
        }

        int Z, A, B, C, D, E, X1;

        Z = (int)((jd + 43200000) / 86400000);
        A = (int)((Z - 1867216.25) / 36524.25);
        A = Z + 1 + A - (A / 4);
        B = A + 1524;
        C = (int)((B - 122.1) / 365.25);
        D = (36525 * C) / 100;
        E = (int)((B - D) / 30.6001);
        X1 = (int)(30.6001 * E);

        int day, month, year;

        day = B - D - X1;
        month = E < 14 ? E - 1 : E - 13;
        year = month > 2 ? C - 4716 : C - 4715;

        try
        {
            return new DateTime(year, month, day);
        }
        catch
        {
            if (badValue == null)
                throw;

            return (DateTime)badValue;
        }
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Converts a Julian Day value to a <see cref="DateTime" />.
    /// This method was translated from the "computeHMS" function in the
    /// "date.c" file belonging to the SQLite core library.
    /// </summary>
    /// <param name="jd">
    /// The Julian Day value to convert.
    /// </param>
    /// <param name="badValue">
    /// The <see cref="DateTime" /> value to return in the event that the
    /// Julian Day value is out of the supported range.  If this value is
    /// null, an exception will be thrown instead.
    /// </param>
    /// <returns>
    /// A <see cref="DateTime" /> value that contains the hour, minute, and
    /// second, and millisecond values that are closest to the specified
    /// Julian Day value.
    /// </returns>
    private static DateTime computeHMS(
        long jd,
        DateTime? badValue
        )
    {
        if (!isValidJd(jd))
        {
            if (badValue == null)
            {
                throw new ArgumentException(
                    "Not a supported Julian Day value.");
            }

            return (DateTime)badValue;
        }

        int si;

        si = (int)((jd + 43200000) % 86400000);

        decimal sd;

        sd = si / 1000.0M;
        si = (int)sd;

        int millisecond = (int)((sd - si) * 1000.0M);

        sd -= si;

        int hour;

        hour = si / 3600;
        si -= hour * 3600;

        int minute;

        minute = si / 60;
        sd += si - minute * 60;

        int second = (int)sd;

        try
        {
            DateTime minValue = DateTime.MinValue;

            return new DateTime(
                minValue.Year, minValue.Month, minValue.Day,
                hour, minute, second, millisecond);
        }
        catch
        {
            if (badValue == null)
                throw;

            return (DateTime)badValue;
        }
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Converts a <see cref="DateTime" /> to a Julian Day value.
    /// This method was translated from the "computeJD" function in
    /// the "date.c" file belonging to the SQLite core library.
    /// Since the range of Julian Day values supported by this method
    /// includes all possible (valid) values of a <see cref="DateTime" />
    /// value, it should be extremely difficult for this method to
    /// raise an exception or return an undefined result.
    /// </summary>
    /// <param name="dateTime">
    /// The <see cref="DateTime" /> value to convert.  This value
    /// will be within the range of <see cref="DateTime.MinValue" />
    /// (00:00:00.0000000, January 1, 0001) to
    /// <see cref="DateTime.MaxValue" /> (23:59:59.9999999, December
    /// 31, 9999).
    /// </param>
    /// <returns>
    /// The nearest Julian Day value corresponding to the specified
    /// <see cref="DateTime" /> value.
    /// </returns>
    private static long computeJD(
        DateTime? dateTime
        )
    {
        DateTime localDateTime;

        if (dateTime != null)
        {
            localDateTime = (DateTime)dateTime;
        }
        else
        {
            localDateTime = new DateTime(
                2000, 1, 1, 0, 0, 0, DateTimeKind.Utc);
        }

        int Y, M, D;

        Y = localDateTime.Year;
        M = localDateTime.Month;
        D = localDateTime.Day;

        if (M <= 2)
        {
            Y--;
            M += 12;
        }

        int A, B, X1, X2;

        A = Y / 100;
        B = 2 - A + (A / 4);
        X1 = 36525 * (Y + 4716) / 100;
        X2 = 306001 * (M + 1) / 10000;

        long jd;

        jd = (long)((X1 + X2 + D + B - 1524.5) * 86400000);

        jd += (localDateTime.Hour * 3600000);
        jd += (localDateTime.Minute * 60000);
        jd += (localDateTime.Second * 1000);
        jd += (localDateTime.Millisecond);

        return jd;
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Converts a string into a DateTime, using the DateTimeFormat, DateTimeKind,
    /// and DateTimeFormatString specified for the connection when it was opened.
    /// </summary>
    /// <remarks>
    /// Acceptable ISO8601 DateTime formats are:
    /// <list type="bullet">
    /// <item><description>THHmmssK</description></item>
    /// <item><description>THHmmK</description></item>
    /// <item><description>HH:mm:ss.FFFFFFFK</description></item>
    /// <item><description>HH:mm:ssK</description></item>
    /// <item><description>HH:mmK</description></item>
    /// <item><description>yyyy-MM-dd HH:mm:ss.FFFFFFFK</description></item>
    /// <item><description>yyyy-MM-dd HH:mm:ssK</description></item>
    /// <item><description>yyyy-MM-dd HH:mmK</description></item>
    /// <item><description>yyyy-MM-ddTHH:mm:ss.FFFFFFFK</description></item>
    /// <item><description>yyyy-MM-ddTHH:mmK</description></item>
    /// <item><description>yyyy-MM-ddTHH:mm:ssK</description></item>
    /// <item><description>yyyyMMddHHmmssK</description></item>
    /// <item><description>yyyyMMddHHmmK</description></item>
    /// <item><description>yyyyMMddTHHmmssFFFFFFFK</description></item>
    /// <item><description>THHmmss</description></item>
    /// <item><description>THHmm</description></item>
    /// <item><description>HH:mm:ss.FFFFFFF</description></item>
    /// <item><description>HH:mm:ss</description></item>
    /// <item><description>HH:mm</description></item>
    /// <item><description>yyyy-MM-dd HH:mm:ss.FFFFFFF</description></item>
    /// <item><description>yyyy-MM-dd HH:mm:ss</description></item>
    /// <item><description>yyyy-MM-dd HH:mm</description></item>
    /// <item><description>yyyy-MM-ddTHH:mm:ss.FFFFFFF</description></item>
    /// <item><description>yyyy-MM-ddTHH:mm</description></item>
    /// <item><description>yyyy-MM-ddTHH:mm:ss</description></item>
    /// <item><description>yyyyMMddHHmmss</description></item>
    /// <item><description>yyyyMMddHHmm</description></item>
    /// <item><description>yyyyMMddTHHmmssFFFFFFF</description></item>
    /// <item><description>yyyy-MM-dd</description></item>
    /// <item><description>yyyyMMdd</description></item>
    /// <item><description>yy-MM-dd</description></item>
    /// </list>
    /// If the string cannot be matched to one of the above formats -OR-
    /// the DateTimeFormatString if one was provided, an exception will
    /// be thrown.
    /// </remarks>
    /// <param name="dateText">The string containing either a long integer number of 100-nanosecond units since
    /// System.DateTime.MinValue, a Julian day double, an integer number of seconds since the Unix epoch, a
    /// culture-independent formatted date and time string, a formatted date and time string in the current
    /// culture, or an ISO8601-format string.</param>
    /// <returns>A DateTime value</returns>
    public DateTime ToDateTime(string dateText)
    {
      return ToDateTime(dateText, _datetimeFormat, _datetimeKind, _datetimeFormatString);
    }

    /// <summary>
    /// Converts a string into a DateTime, using the specified DateTimeFormat,
    /// DateTimeKind and DateTimeFormatString.
    /// </summary>
    /// <remarks>
    /// Acceptable ISO8601 DateTime formats are:
    /// <list type="bullet">
    /// <item><description>THHmmssK</description></item>
    /// <item><description>THHmmK</description></item>
    /// <item><description>HH:mm:ss.FFFFFFFK</description></item>
    /// <item><description>HH:mm:ssK</description></item>
    /// <item><description>HH:mmK</description></item>
    /// <item><description>yyyy-MM-dd HH:mm:ss.FFFFFFFK</description></item>
    /// <item><description>yyyy-MM-dd HH:mm:ssK</description></item>
    /// <item><description>yyyy-MM-dd HH:mmK</description></item>
    /// <item><description>yyyy-MM-ddTHH:mm:ss.FFFFFFFK</description></item>
    /// <item><description>yyyy-MM-ddTHH:mmK</description></item>
    /// <item><description>yyyy-MM-ddTHH:mm:ssK</description></item>
    /// <item><description>yyyyMMddHHmmssK</description></item>
    /// <item><description>yyyyMMddHHmmK</description></item>
    /// <item><description>yyyyMMddTHHmmssFFFFFFFK</description></item>
    /// <item><description>THHmmss</description></item>
    /// <item><description>THHmm</description></item>
    /// <item><description>HH:mm:ss.FFFFFFF</description></item>
    /// <item><description>HH:mm:ss</description></item>
    /// <item><description>HH:mm</description></item>
    /// <item><description>yyyy-MM-dd HH:mm:ss.FFFFFFF</description></item>
    /// <item><description>yyyy-MM-dd HH:mm:ss</description></item>
    /// <item><description>yyyy-MM-dd HH:mm</description></item>
    /// <item><description>yyyy-MM-ddTHH:mm:ss.FFFFFFF</description></item>
    /// <item><description>yyyy-MM-ddTHH:mm</description></item>
    /// <item><description>yyyy-MM-ddTHH:mm:ss</description></item>
    /// <item><description>yyyyMMddHHmmss</description></item>
    /// <item><description>yyyyMMddHHmm</description></item>
    /// <item><description>yyyyMMddTHHmmssFFFFFFF</description></item>
    /// <item><description>yyyy-MM-dd</description></item>
    /// <item><description>yyyyMMdd</description></item>
    /// <item><description>yy-MM-dd</description></item>
    /// </list>
    /// If the string cannot be matched to one of the above formats -OR-
    /// the DateTimeFormatString if one was provided, an exception will
    /// be thrown.
    /// </remarks>
    /// <param name="dateText">The string containing either a long integer number of 100-nanosecond units since
    /// System.DateTime.MinValue, a Julian day double, an integer number of seconds since the Unix epoch, a
    /// culture-independent formatted date and time string, a formatted date and time string in the current
    /// culture, or an ISO8601-format string.</param>
    /// <param name="format">The SQLiteDateFormats to use.</param>
    /// <param name="kind">The DateTimeKind to use.</param>
    /// <param name="formatString">The DateTime format string to use.</param>
    /// <returns>A DateTime value</returns>
    public static DateTime ToDateTime(
        string dateText,
        SQLiteDateFormats format,
        DateTimeKind kind,
        string formatString
        )
    {
        switch (format)
        {
            case SQLiteDateFormats.Ticks:
                {
                    return TicksToDateTime(Convert.ToInt64(
                        dateText, CultureInfo.InvariantCulture), kind);
                }
            case SQLiteDateFormats.JulianDay:
                {
                    return ToDateTime(Convert.ToDouble(
                        dateText, CultureInfo.InvariantCulture), kind);
                }
            case SQLiteDateFormats.UnixEpoch:
                {
                    return UnixEpochToDateTime(Convert.ToInt64(
                        dateText, CultureInfo.InvariantCulture), kind);
                }
            case SQLiteDateFormats.InvariantCulture:
                {
                    if (formatString != null)
                        return DateTime.SpecifyKind(DateTime.ParseExact(
                            dateText, formatString,
                            DateTimeFormatInfo.InvariantInfo,
                            kind == DateTimeKind.Utc ?
                                DateTimeStyles.AdjustToUniversal :
                                DateTimeStyles.None),
                            kind);
                    else
                        return DateTime.SpecifyKind(DateTime.Parse(
                            dateText, DateTimeFormatInfo.InvariantInfo,
                            kind == DateTimeKind.Utc ?
                                DateTimeStyles.AdjustToUniversal :
                                DateTimeStyles.None),
                            kind);
                }
            case SQLiteDateFormats.CurrentCulture:
                {
                    if (formatString != null)
                        return DateTime.SpecifyKind(DateTime.ParseExact(
                            dateText, formatString,
                            DateTimeFormatInfo.CurrentInfo,
                            kind == DateTimeKind.Utc ?
                                DateTimeStyles.AdjustToUniversal :
                                DateTimeStyles.None),
                            kind);
                    else
                        return DateTime.SpecifyKind(DateTime.Parse(
                            dateText, DateTimeFormatInfo.CurrentInfo,
                            kind == DateTimeKind.Utc ?
                                DateTimeStyles.AdjustToUniversal :
                                DateTimeStyles.None),
                            kind);
                }
            default: /* ISO-8601 */
                {
                    if (formatString != null)
                        return DateTime.SpecifyKind(DateTime.ParseExact(
                            dateText, formatString,
                            DateTimeFormatInfo.InvariantInfo,
                            kind == DateTimeKind.Utc ?
                                DateTimeStyles.AdjustToUniversal :
                                DateTimeStyles.None),
                            kind);
                    else
                        return DateTime.SpecifyKind(DateTime.ParseExact(
                            dateText, _datetimeFormats,
                            DateTimeFormatInfo.InvariantInfo,
                            kind == DateTimeKind.Utc ?
                                DateTimeStyles.AdjustToUniversal :
                                DateTimeStyles.None),
                            kind);
                }
        }
    }

    /// <summary>
    /// Converts a julianday value into a DateTime
    /// </summary>
    /// <param name="julianDay">The value to convert</param>
    /// <returns>A .NET DateTime</returns>
    public DateTime ToDateTime(double julianDay)
    {
      return ToDateTime(julianDay, _datetimeKind);
    }

    /// <summary>
    /// Converts a julianday value into a DateTime
    /// </summary>
    /// <param name="julianDay">The value to convert</param>
    /// <param name="kind">The DateTimeKind to use.</param>
    /// <returns>A .NET DateTime</returns>
    public static DateTime ToDateTime(
        double julianDay,
        DateTimeKind kind
        )
    {
        long jd = DoubleToJd(julianDay);
        DateTime dateTimeYMD = computeYMD(jd, null);
        DateTime dateTimeHMS = computeHMS(jd, null);

        return new DateTime(
            dateTimeYMD.Year, dateTimeYMD.Month, dateTimeYMD.Day,
            dateTimeHMS.Hour, dateTimeHMS.Minute, dateTimeHMS.Second,
            dateTimeHMS.Millisecond, kind);
    }

    /// <summary>
    /// Converts the specified number of seconds from the Unix epoch into a
    /// <see cref="DateTime" /> value.
    /// </summary>
    /// <param name="seconds">
    /// The number of whole seconds since the Unix epoch.
    /// </param>
    /// <param name="kind">
    /// Either Utc or Local time.
    /// </param>
    /// <returns>
    /// The new <see cref="DateTime" /> value.
    /// </returns>
    internal static DateTime UnixEpochToDateTime(long seconds, DateTimeKind kind)
    {
        return DateTime.SpecifyKind(UnixEpoch.AddSeconds(seconds), kind);
    }

    /// <summary>
    /// Converts the specified number of ticks since the epoch into a
    /// <see cref="DateTime" /> value.
    /// </summary>
    /// <param name="ticks">
    /// The number of whole ticks since the epoch.
    /// </param>
    /// <param name="kind">
    /// Either Utc or Local time.
    /// </param>
    /// <returns>
    /// The new <see cref="DateTime" /> value.
    /// </returns>
    internal static DateTime TicksToDateTime(long ticks, DateTimeKind kind)
    {
        return new DateTime(ticks, kind);
    }

    /// <summary>
    /// Converts a DateTime struct to a JulianDay double
    /// </summary>
    /// <param name="value">The DateTime to convert</param>
    /// <returns>The JulianDay value the Datetime represents</returns>
    public static double ToJulianDay(DateTime? value)
    {
        return JdToDouble(computeJD(value));
    }

    /// <summary>
    /// Converts a DateTime struct to the whole number of seconds since the
    /// Unix epoch.
    /// </summary>
    /// <param name="value">The DateTime to convert</param>
    /// <returns>The whole number of seconds since the Unix epoch</returns>
    public static long ToUnixEpoch(DateTime value)
    {
        return (value.Subtract(UnixEpoch).Ticks / TimeSpan.TicksPerSecond);
    }

    /// <summary>
    /// Returns the DateTime format string to use for the specified DateTimeKind.
    /// If <paramref name="formatString" /> is not null, it will be returned verbatim.
    /// </summary>
    /// <param name="kind">The DateTimeKind to use.</param>
    /// <param name="formatString">The DateTime format string to use.</param>
    /// <returns>
    /// The DateTime format string to use for the specified DateTimeKind.
    /// </returns>
    private static string GetDateTimeKindFormat(
        DateTimeKind kind,
        string formatString
        )
    {
        if (formatString != null) return formatString;
        return (kind == DateTimeKind.Utc) ? _datetimeFormatUtc : _datetimeFormatLocal;
    }

    /// <summary>
    /// Build list-formatted string from a list of string elements.
    /// </summary>
    /// <param name="list">
    /// The list of strings to process.
    /// </param>
    /// <param name="emptyOnNull">
    /// Non-zero if this method should avoid returning a null value
    /// when the input list is null.
    /// </param>
    /// <returns>
    /// Either the list-formatted string -OR- null if it cannot be
    /// determined.
    /// </returns>
    internal static string ToString(
        IList<string> list,
        bool emptyOnNull
        )
    {
        StringBuilder result;

        if (list != null)
        {
            result = new StringBuilder();

            foreach (string element in list)
            {
                if (element == null)
                    continue;

                if (result.Length > 0)
                    result.Append(' ');

                result.Append(element);
            }
        }
        else if (emptyOnNull)
        {
            result = new StringBuilder();
        }
        else
        {
            result = null;
        }

        return result.ToString();
    }

    /// <summary>
    /// Converts a string into a DateTime, using the DateTimeFormat, DateTimeKind,
    /// and DateTimeFormatString specified for the connection when it was opened.
    /// </summary>
    /// <param name="dateValue">The DateTime value to convert</param>
    /// <returns>Either a string containing the long integer number of 100-nanosecond units since System.DateTime.MinValue, a
    /// Julian day double, an integer number of seconds since the Unix epoch, a culture-independent formatted date and time
    /// string, a formatted date and time string in the current culture, or an ISO8601-format date/time string.</returns>
    public string ToString(DateTime dateValue)
    {
        return ToString(dateValue, _datetimeFormat, _datetimeKind, _datetimeFormatString);
    }

    /// <summary>
    /// Converts a string into a DateTime, using the DateTimeFormat, DateTimeKind,
    /// and DateTimeFormatString specified for the connection when it was opened.
    /// </summary>
    /// <param name="dateValue">The DateTime value to convert</param>
    /// <param name="format">The SQLiteDateFormats to use.</param>
    /// <param name="kind">The DateTimeKind to use.</param>
    /// <param name="formatString">The DateTime format string to use.</param>
    /// <returns>Either a string containing the long integer number of 100-nanosecond units since System.DateTime.MinValue, a
    /// Julian day double, an integer number of seconds since the Unix epoch, a culture-independent formatted date and time
    /// string, a formatted date and time string in the current culture, or an ISO8601-format date/time string.</returns>
    public static string ToString(
        DateTime dateValue,
        SQLiteDateFormats format,
        DateTimeKind kind,
        string formatString
        )
    {
        switch (format)
        {
            case SQLiteDateFormats.Ticks:
                return dateValue.Ticks.ToString(CultureInfo.InvariantCulture);
            case SQLiteDateFormats.JulianDay:
                return ToJulianDay(dateValue).ToString(CultureInfo.InvariantCulture);
            case SQLiteDateFormats.UnixEpoch:
                return ((long)(dateValue.Subtract(UnixEpoch).Ticks / TimeSpan.TicksPerSecond)).ToString();
            case SQLiteDateFormats.InvariantCulture:
                return dateValue.ToString((formatString != null) ?
                    formatString : FullFormat, CultureInfo.InvariantCulture);
            case SQLiteDateFormats.CurrentCulture:
                return dateValue.ToString((formatString != null) ?
                    formatString : FullFormat, CultureInfo.CurrentCulture);
            default:
                return (dateValue.Kind == DateTimeKind.Unspecified) ?
                    DateTime.SpecifyKind(dateValue, kind).ToString(
                        GetDateTimeKindFormat(kind, formatString),
                            CultureInfo.InvariantCulture) : dateValue.ToString(
                        GetDateTimeKindFormat(dateValue.Kind, formatString),
                            CultureInfo.InvariantCulture);
        }
    }

    /// <summary>
    /// Internal function to convert a UTF-8 encoded IntPtr of the specified length to a DateTime.
    /// </summary>
    /// <remarks>
    /// This is a convenience function, which first calls ToString() on the IntPtr to convert it to a string, then calls
    /// ToDateTime() on the string to return a DateTime.
    /// </remarks>
    /// <param name="ptr">A pointer to the UTF-8 encoded string</param>
    /// <param name="len">The length in bytes of the string</param>
    /// <returns>The parsed DateTime value</returns>
    internal DateTime ToDateTime(IntPtr ptr, int len)
    {
      return ToDateTime(ToString(ptr, len));
    }

    #endregion

    /// <summary>
    /// Smart method of splitting a string.  Skips quoted elements, removes the quotes.
    /// </summary>
    /// <remarks>
    /// This split function works somewhat like the String.Split() function in that it breaks apart a string into
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
    /// Note that the leading and trailing spaces were removed from each item during the split.
    /// </remarks>
    /// <param name="source">Source string to split apart</param>
    /// <param name="separator">Separator character</param>
    /// <returns>A string array of the split up elements</returns>
    public static string[] Split(string source, char separator)
    {
      char[] toks = new char[2] { '\"', separator };
      char[] quot = new char[1] { '\"' };
      int n = 0;
      List<string> ls = new List<string>();
      string s;

      while (source.Length > 0)
      {
        n = source.IndexOfAny(toks, n);







|
|







979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
    /// Note that the leading and trailing spaces were removed from each item during the split.
    /// </remarks>
    /// <param name="source">Source string to split apart</param>
    /// <param name="separator">Separator character</param>
    /// <returns>A string array of the split up elements</returns>
    public static string[] Split(string source, char separator)
    {
      char[] toks = new char[2] { QuoteChar, separator };
      char[] quot = new char[1] { QuoteChar };
      int n = 0;
      List<string> ls = new List<string>();
      string s;

      while (source.Length > 0)
      {
        n = source.IndexOfAny(toks, n);
286
287
288
289
290
291
292
















































































































































































































































293
294
295
296
297
298
299
300
301
302
303

304
305


306














307




308
309


310


311
312


313
314
315
316

317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348

349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368




369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447


448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478


479
480
481

482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498




499
500














501
















502





503
504

505
506
507
508

509




510
511
512








513
514

515




























516














517



518
519

520
521



522
523
524

525














526







527



528




529





530


531
532
533

534



535
536

537


538






539


540

541



542
543

544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581










582
583
584
585
586
587

588
589



590
591
592
593
594
595
596
597
598





599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
























































































625


626
627






























































































































































































































































































628
629




630

631

632








633


634

635





636



637
638




639




















































640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
      }

      string[] ar = new string[ls.Count];
      ls.CopyTo(ar, 0);

      return ar;
    }

















































































































































































































































    /// <summary>
    /// Convert a value to true or false.
    /// </summary>
    /// <param name="source">A string or number representing true or false</param>
    /// <returns></returns>
    public static bool ToBoolean(object source)
    {
      if (source is bool) return (bool)source;

      return ToBoolean(source.ToString());

    }



    /// <summary>














    /// Convert a string to true or false.




    /// </summary>
    /// <param name="source">A string representing true or false</param>


    /// <returns></returns>


    /// <remarks>
    /// "yes", "no", "y", "n", "0", "1", "on", "off" as well as Boolean.FalseString and Boolean.TrueString will all be


    /// converted to a proper boolean value.
    /// </remarks>
    public static bool ToBoolean(string source)
    {

      if (String.Compare(source, bool.TrueString, StringComparison.OrdinalIgnoreCase) == 0) return true;
      else if (String.Compare(source, bool.FalseString, StringComparison.OrdinalIgnoreCase) == 0) return false;

      switch(source.ToLower(CultureInfo.InvariantCulture))
      {
        case "yes":
        case "y":
        case "1":
        case "on":
          return true;
        case "no":
        case "n":
        case "0":
        case "off":
          return false;
        default:
          throw new ArgumentException("source");
      }
    }

    #region Type Conversions
    /// <summary>
    /// Determines the data type of a column in a statement
    /// </summary>
    /// <param name="stmt">The statement to retrieve information for</param>
    /// <param name="i">The column to retrieve type information on</param>
    /// <param name="typ">The SQLiteType to receive the affinity for the given column</param>
    internal static void ColumnToType(SQLiteStatement stmt, int i, SQLiteType typ)
    {
      typ.Type = TypeNameToDbType(stmt._sql.ColumnType(stmt, i, out typ.Affinity));
    }


    /// <summary>
    /// Converts a SQLiteType to a .NET Type object
    /// </summary>
    /// <param name="t">The SQLiteType to convert</param>
    /// <returns>Returns a .NET Type object</returns>
    internal static Type SQLiteTypeToType(SQLiteType t)
    {
      if (t.Type == DbType.Object)
        return _affinitytotype[(int)t.Affinity];
      else
        return SQLiteConvert.DbTypeToType(t.Type);
    }

    private static Type[] _affinitytotype = {
      typeof(object),
      typeof(Int64),
      typeof(Double),
      typeof(string),
      typeof(byte[]),
      typeof(object),




      typeof(DateTime),
      typeof(object)
    };

    /// <summary>
    /// For a given intrinsic type, return a DbType
    /// </summary>
    /// <param name="typ">The native type to convert</param>
    /// <returns>The corresponding (closest match) DbType</returns>
    internal static DbType TypeToDbType(Type typ)
    {
      TypeCode tc = Type.GetTypeCode(typ);
      if (tc == TypeCode.Object)
      {
        if (typ == typeof(byte[])) return DbType.Binary;
        if (typ == typeof(Guid)) return DbType.Guid;
        return DbType.String;
      }
      return _typetodbtype[(int)tc];
    }

    private static DbType[] _typetodbtype = {
      DbType.Object,
      DbType.Binary,
      DbType.Object,
      DbType.Boolean,
      DbType.SByte,
      DbType.SByte,
      DbType.Byte,
      DbType.Int16, // 7
      DbType.UInt16,
      DbType.Int32,
      DbType.UInt32,
      DbType.Int64, // 11
      DbType.UInt64,
      DbType.Single,
      DbType.Double,
      DbType.Decimal,
      DbType.DateTime,
      DbType.Object,
      DbType.String,
    };

    /// <summary>
    /// Returns the ColumnSize for the given DbType
    /// </summary>
    /// <param name="typ">The DbType to get the size of</param>
    /// <returns></returns>
    internal static int DbTypeToColumnSize(DbType typ)
    {
      return _dbtypetocolumnsize[(int)typ];
    }

    private static int[] _dbtypetocolumnsize = {
      2147483647,   // 0
      2147483647,   // 1
      1,     // 2
      1,     // 3
      8,  // 4
      8, // 5
      8, // 6
      8,  // 7
      8,   // 8
      16,     // 9
      2,
      4,
      8,
      2147483647,
      1,
      4,
      2147483647,
      8,
      2,
      4,
      8,
      8,
      2147483647,
      2147483647,
      2147483647,


      2147483647,   // 25 (Xml)
    };

    internal static object DbTypeToNumericPrecision(DbType typ)
    {
      return _dbtypetonumericprecision[(int)typ];
    }

    private static object[] _dbtypetonumericprecision = {
      DBNull.Value, // 0
      DBNull.Value, // 1
      3,
      DBNull.Value,
      19,
      DBNull.Value, // 5
      DBNull.Value, // 6
      53,
      53,
      DBNull.Value,
      5,
      10,
      19,
      DBNull.Value,
      3,
      24,
      DBNull.Value,
      DBNull.Value,
      5,
      10,
      19,
      53,


      DBNull.Value,
      DBNull.Value,
      DBNull.Value

    };

    internal static object DbTypeToNumericScale(DbType typ)
    {
      return _dbtypetonumericscale[(int)typ];
    }

    private static object[] _dbtypetonumericscale = {
      DBNull.Value, // 0
      DBNull.Value, // 1
      0,
      DBNull.Value,
      4,
      DBNull.Value, // 5
      DBNull.Value, // 6
      DBNull.Value,
      DBNull.Value,




      DBNull.Value,
      0,














      0,
















      0,





      DBNull.Value,
      0,

      DBNull.Value,
      DBNull.Value,
      DBNull.Value,
      0,

      0,




      0,
      0,
      DBNull.Value,








      DBNull.Value,
      DBNull.Value

    };











































    internal static string DbTypeToTypeName(DbType typ)



    {
      for (int n = 0; n < _dbtypeNames.Length; n++)

      {
        if (_dbtypeNames[n].dataType == typ)



          return _dbtypeNames[n].typeName;
      }


      return String.Empty;














    }











    private static SQLiteTypeNames[] _dbtypeNames = {




      new SQLiteTypeNames("INTEGER", DbType.Int64),





      new SQLiteTypeNames("TINYINT", DbType.Byte),


      new SQLiteTypeNames("INT", DbType.Int32),
      new SQLiteTypeNames("VARCHAR", DbType.AnsiString),
      new SQLiteTypeNames("NVARCHAR", DbType.String),

      new SQLiteTypeNames("CHAR", DbType.AnsiStringFixedLength),



      new SQLiteTypeNames("NCHAR", DbType.StringFixedLength),
      new SQLiteTypeNames("FLOAT", DbType.Double),

      new SQLiteTypeNames("REAL", DbType.Single),          


      new SQLiteTypeNames("BIT", DbType.Boolean),






      new SQLiteTypeNames("DECIMAL", DbType.Decimal),


      new SQLiteTypeNames("DATETIME", DbType.DateTime),

      new SQLiteTypeNames("BLOB", DbType.Binary),



      new SQLiteTypeNames("UNIQUEIDENTIFIER", DbType.Guid),
      new SQLiteTypeNames("SMALLINT", DbType.Int16),

    };
    /// <summary>
    /// Convert a DbType to a Type
    /// </summary>
    /// <param name="typ">The DbType to convert from</param>
    /// <returns>The closest-match .NET type</returns>
    internal static Type DbTypeToType(DbType typ)
    {
      return _dbtypeToType[(int)typ];
    }

    private static Type[] _dbtypeToType = {
      typeof(string),   // 0
      typeof(byte[]),   // 1
      typeof(byte),     // 2
      typeof(bool),     // 3
      typeof(decimal),  // 4
      typeof(DateTime), // 5
      typeof(DateTime), // 6
      typeof(decimal),  // 7
      typeof(double),   // 8
      typeof(Guid),     // 9
      typeof(Int16),
      typeof(Int32),
      typeof(Int64),
      typeof(object),
      typeof(sbyte),
      typeof(float),
      typeof(string),
      typeof(DateTime),
      typeof(UInt16),
      typeof(UInt32),
      typeof(UInt64),
      typeof(double),
      typeof(string),
      typeof(string),
      typeof(string),
      typeof(string),   // 25 (Xml)










    };

    /// <summary>
    /// For a given type, return the closest-match SQLite TypeAffinity, which only understands a very limited subset of types.
    /// </summary>
    /// <param name="typ">The type to evaluate</param>

    /// <returns>The SQLite type affinity for that type.</returns>
    internal static TypeAffinity TypeToAffinity(Type typ)



    {
      TypeCode tc = Type.GetTypeCode(typ);
      if (tc == TypeCode.Object)
      {
        if (typ == typeof(byte[]) || typ == typeof(Guid))
          return TypeAffinity.Blob;
        else
          return TypeAffinity.Text;
      }





      return _typecodeAffinities[(int)tc];
    }

    private static TypeAffinity[] _typecodeAffinities = {
      TypeAffinity.Null,
      TypeAffinity.Blob,
      TypeAffinity.Null,
      TypeAffinity.Int64,
      TypeAffinity.Int64,
      TypeAffinity.Int64,
      TypeAffinity.Int64,
      TypeAffinity.Int64, // 7
      TypeAffinity.Int64,
      TypeAffinity.Int64,
      TypeAffinity.Int64,
      TypeAffinity.Int64, // 11
      TypeAffinity.Int64,
      TypeAffinity.Double,
      TypeAffinity.Double,
      TypeAffinity.Double,
      TypeAffinity.DateTime,
      TypeAffinity.Null,
      TypeAffinity.Text,
    };

    /// <summary>
























































































    /// For a given type name, return a closest-match .NET type


    /// </summary>
    /// <param name="Name">The name of the type to match</param>






























































































































































































































































































    /// <returns>The .NET DBType the text evaluates to.</returns>
    internal static DbType TypeNameToDbType(string Name)




    {

      if (String.IsNullOrEmpty(Name)) return DbType.Object;










      int x = _typeNames.Length;


      for (int n = 0; n < x; n++)

      {





        if (String.Compare(Name, 0, _typeNames[n].typeName, 0, _typeNames[n].typeName.Length, StringComparison.OrdinalIgnoreCase) == 0)



          return _typeNames[n].dataType; 
      }




      return DbType.Object;




















































    }
    #endregion

    private static SQLiteTypeNames[] _typeNames = {
      new SQLiteTypeNames("COUNTER", DbType.Int64),
      new SQLiteTypeNames("AUTOINCREMENT", DbType.Int64),
      new SQLiteTypeNames("IDENTITY", DbType.Int64),
      new SQLiteTypeNames("LONGTEXT", DbType.String),
      new SQLiteTypeNames("LONGCHAR", DbType.String),
      new SQLiteTypeNames("LONGVARCHAR", DbType.String),
      new SQLiteTypeNames("LONG", DbType.Int64),
      new SQLiteTypeNames("TINYINT", DbType.Byte),
      new SQLiteTypeNames("INTEGER", DbType.Int64),
      new SQLiteTypeNames("INT", DbType.Int32),
      new SQLiteTypeNames("VARCHAR", DbType.String),
      new SQLiteTypeNames("NVARCHAR", DbType.String),
      new SQLiteTypeNames("CHAR", DbType.String),
      new SQLiteTypeNames("NCHAR", DbType.String),
      new SQLiteTypeNames("TEXT", DbType.String),
      new SQLiteTypeNames("NTEXT", DbType.String),
      new SQLiteTypeNames("STRING", DbType.String),
      new SQLiteTypeNames("DOUBLE", DbType.Double),
      new SQLiteTypeNames("FLOAT", DbType.Double),
      new SQLiteTypeNames("REAL", DbType.Single),          
      new SQLiteTypeNames("BIT", DbType.Boolean),
      new SQLiteTypeNames("YESNO", DbType.Boolean),
      new SQLiteTypeNames("LOGICAL", DbType.Boolean),
      new SQLiteTypeNames("BOOL", DbType.Boolean),
      new SQLiteTypeNames("NUMERIC", DbType.Decimal),
      new SQLiteTypeNames("DECIMAL", DbType.Decimal),
      new SQLiteTypeNames("MONEY", DbType.Decimal),
      new SQLiteTypeNames("CURRENCY", DbType.Decimal),
      new SQLiteTypeNames("TIME", DbType.DateTime),
      new SQLiteTypeNames("DATE", DbType.DateTime),
      new SQLiteTypeNames("SMALLDATE", DbType.DateTime),
      new SQLiteTypeNames("BLOB", DbType.Binary),
      new SQLiteTypeNames("BINARY", DbType.Binary),
      new SQLiteTypeNames("VARBINARY", DbType.Binary),
      new SQLiteTypeNames("IMAGE", DbType.Binary),
      new SQLiteTypeNames("GENERAL", DbType.Binary),
      new SQLiteTypeNames("OLEOBJECT", DbType.Binary),
      new SQLiteTypeNames("GUID", DbType.Guid),
      new SQLiteTypeNames("UNIQUEIDENTIFIER", DbType.Guid),
      new SQLiteTypeNames("MEMO", DbType.String),
      new SQLiteTypeNames("NOTE", DbType.String),
      new SQLiteTypeNames("SMALLINT", DbType.Int16),
      new SQLiteTypeNames("BIGINT", DbType.Int64),
    };
  }

  /// <summary>
  /// SQLite has very limited types, and is inherently text-based.  The first 5 types below represent the sum of all types SQLite
  /// understands.  The DateTime extension to the spec is for internal use only.
  /// </summary>
  public enum TypeAffinity







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










|
>


>
>

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

|
>
>
|
>
>

|
>
>
|



>
|
|

|
|
|
|
|
|
|
|
|
|
|
|
<
<
|
|
|
<
<
<
<
<
<
<
<
<
<


>














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




















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













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








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








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

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

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

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











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






>

|
>
>
>









>
>
>
>
>




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



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

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

|
>
>
>
>

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



|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338


1339
1340
1341










1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547

1548
1549
1550
1551

1552
1553
1554
1555
1556
1557
1558

1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622

1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279












































2280
2281
2282
2283
2284
2285
2286
      }

      string[] ar = new string[ls.Count];
      ls.CopyTo(ar, 0);

      return ar;
    }

    /// <summary>
    /// Splits the specified string into multiple strings based on a separator
    /// and returns the result as an array of strings.
    /// </summary>
    /// <param name="value">
    /// The string to split into pieces based on the separator character.  If
    /// this string is null, null will always be returned.  If this string is
    /// empty, an array of zero strings will always be returned.
    /// </param>
    /// <param name="separator">
    /// The character used to divide the original string into sub-strings.
    /// This character cannot be a backslash or a double-quote; otherwise, no
    /// work will be performed and null will be returned.
    /// </param>
    /// <param name="keepQuote">
    /// If this parameter is non-zero, all double-quote characters will be
    /// retained in the returned list of strings; otherwise, they will be
    /// dropped.
    /// </param>
    /// <param name="error">
    /// Upon failure, this parameter will be modified to contain an appropriate
    /// error message.
    /// </param>
    /// <returns>
    /// The new array of strings or null if the input string is null -OR- the
    /// separator character is a backslash or a double-quote -OR- the string
    /// contains an unbalanced backslash or double-quote character.
    /// </returns>
    internal static string[] NewSplit(
        string value,
        char separator,
        bool keepQuote,
        ref string error
        )
    {
        //
        // NOTE: It is illegal for the separator character to be either a
        //       backslash or a double-quote because both of those characters
        //       are used for escaping other characters (e.g. the separator
        //       character).
        //
        if ((separator == EscapeChar) || (separator == QuoteChar))
        {
            error = "separator character cannot be the escape or quote characters";
            return null;
        }

        if (value == null)
        {
            error = "string value to split cannot be null";
            return null;
        }

        int length = value.Length;

        if (length == 0)
            return new string[0];

        List<string> list = new List<string>();
        StringBuilder element = new StringBuilder();
        int index = 0;
        bool escape = false;
        bool quote = false;

        while (index < length)
        {
            char character = value[index++];

            if (escape)
            {
                //
                // HACK: Only consider the escape character to be an actual
                //       "escape" if it is followed by a reserved character;
                //       otherwise, emit the original escape character and
                //       the current character in an effort to help preserve
                //       the original string content.
                //
                if ((character != EscapeChar) &&
                    (character != QuoteChar) &&
                    (character != separator))
                {
                    element.Append(EscapeChar);
                }

                element.Append(character);
                escape = false;
            }
            else if (character == EscapeChar)
            {
                escape = true;
            }
            else if (character == QuoteChar)
            {
                if (keepQuote)
                    element.Append(character);

                quote = !quote;
            }
            else if (character == separator)
            {
                if (quote)
                {
                    element.Append(character);
                }
                else
                {
                    list.Add(element.ToString());
                    element.Length = 0;
                }
            }
            else
            {
                element.Append(character);
            }
        }

        //
        // NOTE: An unbalanced escape or quote character in the string is
        //       considered to be a fatal error; therefore, return null.
        //
        if (escape || quote)
        {
            error = "unbalanced escape or quote character found";
            return null;
        }

        if (element.Length > 0)
            list.Add(element.ToString());

        return list.ToArray();
    }

    /// <summary>
    /// Queries and returns the string representation for an object, using the
    /// specified (or current) format provider.
    /// </summary>
    /// <param name="obj">
    /// The object instance to return the string representation for.
    /// </param>
    /// <param name="provider">
    /// The format provider to use -OR- null if the current format provider for
    /// the thread should be used instead.
    /// </param>
    /// <returns>
    /// The string representation for the object instance -OR- null if the
    /// object instance is also null.
    /// </returns>
    public static string ToStringWithProvider(
        object obj,
        IFormatProvider provider
        )
    {
        if (obj == null)
            return null; /* null --> null */

        if (obj is string)
            return (string)obj; /* identity */

        IConvertible convertible = obj as IConvertible;

        if (convertible != null)
            return convertible.ToString(provider);

        return obj.ToString(); /* not IConvertible */
    }

    /// <summary>
    /// Attempts to convert an arbitrary object to the Boolean data type.
    /// Null object values are converted to false.  Throws an exception
    /// upon failure.
    /// </summary>
    /// <param name="obj">
    /// The object value to convert.
    /// </param>
    /// <param name="provider">
    /// The format provider to use.
    /// </param>
    /// <param name="viaFramework">
    /// If non-zero, a string value will be converted using the
    /// <see cref="Convert.ToBoolean(Object, IFormatProvider)" />
    /// method; otherwise, the <see cref="ToBoolean(String)" />
    /// method will be used.
    /// </param>
    /// <returns>
    /// The converted boolean value.
    /// </returns>
    internal static bool ToBoolean(
        object obj,
        IFormatProvider provider,
        bool viaFramework
        )
    {
        if (obj == null)
            return false;

        TypeCode typeCode = Type.GetTypeCode(obj.GetType());

        switch (typeCode)
        {
            case TypeCode.Empty:
            case TypeCode.DBNull:
                return false;
            case TypeCode.Boolean:
                return (bool)obj;
            case TypeCode.Char:
                return ((char)obj) != (char)0 ? true : false;
            case TypeCode.SByte:
                return ((sbyte)obj) != (sbyte)0 ? true : false;
            case TypeCode.Byte:
                return ((byte)obj) != (byte)0 ? true : false;
            case TypeCode.Int16:
                return ((short)obj) != (short)0 ? true : false;
            case TypeCode.UInt16:
                return ((ushort)obj) != (ushort)0 ? true : false;
            case TypeCode.Int32:
                return ((int)obj) != (int)0 ? true : false;
            case TypeCode.UInt32:
                return ((uint)obj) != (uint)0 ? true : false;
            case TypeCode.Int64:
                return ((long)obj) != (long)0 ? true : false;
            case TypeCode.UInt64:
                return ((ulong)obj) != (ulong)0 ? true : false;
            case TypeCode.Single:
                return ((float)obj) != (float)0.0 ? true : false;
            case TypeCode.Double:
                return ((double)obj) != (double)0.0 ? true : false;
            case TypeCode.Decimal:
                return ((decimal)obj) != Decimal.Zero ? true : false;
            case TypeCode.String:
                return viaFramework ?
                    Convert.ToBoolean(obj, provider) :
                    ToBoolean(ToStringWithProvider(obj, provider));
            default:
                throw new SQLiteException(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "Cannot convert type {0} to boolean",
                    typeCode));
        }
    }

    /// <summary>
    /// Convert a value to true or false.
    /// </summary>
    /// <param name="source">A string or number representing true or false</param>
    /// <returns></returns>
    public static bool ToBoolean(object source)
    {
      if (source is bool) return (bool)source;

      return ToBoolean(ToStringWithProvider(
          source, CultureInfo.InvariantCulture));
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Converts an integer to a string that can be round-tripped using the
    /// invariant culture.
    /// </summary>
    /// <param name="value">
    /// The integer value to return the string representation for.
    /// </param>
    /// <returns>
    /// The string representation of the specified integer value, using the
    /// invariant culture.
    /// </returns>
    internal static string ToString(int value)
    {
        return value.ToString(CultureInfo.InvariantCulture);
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Attempts to convert a <see cref="String" /> into a <see cref="Boolean" />.
    /// </summary>
    /// <param name="source">
    /// The <see cref="String" /> to convert, cannot be null.
    /// </param>
    /// <returns>
    /// The converted <see cref="Boolean" /> value.
    /// </returns>
    /// <remarks>
    /// The supported strings are "yes", "no", "y", "n", "on", "off", "0", "1",
    /// as well as any prefix of the strings <see cref="Boolean.FalseString" />
    /// and <see cref="Boolean.TrueString" />.  All strings are treated in a
    /// case-insensitive manner.
    /// </remarks>
    public static bool ToBoolean(string source)
    {
        if (source == null) throw new ArgumentNullException("source");
        if (String.Compare(source, 0, bool.TrueString, 0, source.Length, StringComparison.OrdinalIgnoreCase) == 0) return true;
        else if (String.Compare(source, 0, bool.FalseString, 0, source.Length, StringComparison.OrdinalIgnoreCase) == 0) return false;

        switch (source.ToLower(CultureInfo.InvariantCulture))
        {
            case "y":
            case "yes":
            case "on":
            case "1":
                return true;
            case "n":
            case "no":
            case "off":
            case "0":
                return false;


        }

        throw new ArgumentException("source");










    }

    #region Type Conversions
    /// <summary>
    /// Converts a SQLiteType to a .NET Type object
    /// </summary>
    /// <param name="t">The SQLiteType to convert</param>
    /// <returns>Returns a .NET Type object</returns>
    internal static Type SQLiteTypeToType(SQLiteType t)
    {
      if (t.Type == DbType.Object)
        return _affinitytotype[(int)t.Affinity];
      else
        return SQLiteConvert.DbTypeToType(t.Type);
    }

    private static Type[] _affinitytotype = {
      typeof(object),   // Uninitialized (0)
      typeof(Int64),    // Int64 (1)
      typeof(Double),   // Double (2)
      typeof(string),   // Text (3)
      typeof(byte[]),   // Blob (4)
      typeof(object),   // Null (5)
      null,             // Undefined (6)
      null,             // Undefined (7)
      null,             // Undefined (8)
      null,             // Undefined (9)
      typeof(DateTime), // DateTime (10)
      typeof(object)    // None (11)
    };

    /// <summary>
    /// For a given intrinsic type, return a DbType
    /// </summary>
    /// <param name="typ">The native type to convert</param>
    /// <returns>The corresponding (closest match) DbType</returns>
    internal static DbType TypeToDbType(Type typ)
    {
      TypeCode tc = Type.GetTypeCode(typ);
      if (tc == TypeCode.Object)
      {
        if (typ == typeof(byte[])) return DbType.Binary;
        if (typ == typeof(Guid)) return DbType.Guid;
        return DbType.String;
      }
      return _typetodbtype[(int)tc];
    }

    private static DbType[] _typetodbtype = {
      DbType.Object,   // Empty (0)
      DbType.Binary,   // Object (1)
      DbType.Object,   // DBNull (2)
      DbType.Boolean,  // Boolean (3)
      DbType.SByte,    // Char (4)
      DbType.SByte,    // SByte (5)
      DbType.Byte,     // Byte (6)
      DbType.Int16,    // Int16 (7)
      DbType.UInt16,   // UInt16 (8)
      DbType.Int32,    // Int32 (9)
      DbType.UInt32,   // UInt32 (10)
      DbType.Int64,    // Int64 (11)
      DbType.UInt64,   // UInt64 (12)
      DbType.Single,   // Single (13)
      DbType.Double,   // Double (14)
      DbType.Decimal,  // Decimal (15)
      DbType.DateTime, // DateTime (16)
      DbType.Object,   // ?? (17)
      DbType.String    // String (18)
    };

    /// <summary>
    /// Returns the ColumnSize for the given DbType
    /// </summary>
    /// <param name="typ">The DbType to get the size of</param>
    /// <returns></returns>
    internal static int DbTypeToColumnSize(DbType typ)
    {
      return _dbtypetocolumnsize[(int)typ];
    }

    private static int[] _dbtypetocolumnsize = {
      int.MaxValue, // AnsiString (0)
      int.MaxValue, // Binary (1)
      1,            // Byte (2)
      1,            // Boolean (3)
      8,            // Currency (4)
      8,            // Date (5)
      8,            // DateTime (6)
      8,            // Decimal (7)
      8,            // Double (8)
      16,           // Guid (9)
      2,            // Int16 (10)
      4,            // Int32 (11)
      8,            // Int64 (12)
      int.MaxValue, // Object (13)
      1,            // SByte (14)
      4,            // Single (15)
      int.MaxValue, // String (16)
      8,            // Time (17)
      2,            // UInt16 (18)
      4,            // UInt32 (19)
      8,            // UInt64 (20)
      8,            // VarNumeric (21)
      int.MaxValue, // AnsiStringFixedLength (22)
      int.MaxValue, // StringFixedLength (23)
      int.MaxValue, // ?? (24)
      int.MaxValue, // Xml (25)
      8,            // DateTime2 (26)
      10            // DateTimeOffset (27)
    };

    internal static object DbTypeToNumericPrecision(DbType typ)
    {
      return _dbtypetonumericprecision[(int)typ];
    }

    private static object[] _dbtypetonumericprecision = {
      DBNull.Value, // AnsiString (0)
      DBNull.Value, // Binary (1)
      3,            // Byte (2)
      DBNull.Value, // Boolean (3)
      19,           // Currency (4)
      DBNull.Value, // Date (5)
      DBNull.Value, // DateTime (6)
      53,           // Decimal (7)
      53,           // Double (8)
      DBNull.Value, // Guid (9)
      5,            // Int16 (10)
      10,           // Int32 (11)
      19,           // Int64 (12)
      DBNull.Value, // Object (13)
      3,            // SByte (14)
      24,           // Single (15)
      DBNull.Value, // String (16)
      DBNull.Value, // Time (17)
      5,            // UInt16 (18)
      10,           // UInt32 (19)
      19,           // UInt64 (20)
      53,           // VarNumeric (21)
      DBNull.Value, // AnsiStringFixedLength (22)
      DBNull.Value, // StringFixedLength (23)
      DBNull.Value, // ?? (24)
      DBNull.Value, // Xml (25)
      DBNull.Value, // DateTime2 (26)
      DBNull.Value  // DateTimeOffset (27)
    };

    internal static object DbTypeToNumericScale(DbType typ)
    {
      return _dbtypetonumericscale[(int)typ];
    }

    private static object[] _dbtypetonumericscale = {
      DBNull.Value, // AnsiString (0)
      DBNull.Value, // Binary (1)
      0,            // Byte (2)
      DBNull.Value, // Boolean (3)
      4,            // Currency (4)
      DBNull.Value, // Date (5)
      DBNull.Value, // DateTime (6)
      DBNull.Value, // Decimal (7)
      DBNull.Value, // Double (8)
      DBNull.Value, // Guid (9)
      0,            // Int16 (10)
      0,            // Int32 (11)
      0,            // Int64 (12)
      DBNull.Value, // Object (13)
      0,            // SByte (14)
      DBNull.Value, // Single (15)
      DBNull.Value, // String (16)
      DBNull.Value, // Time (17)
      0,            // UInt16 (18)
      0,            // UInt32 (19)
      0,            // UInt64 (20)
      0,            // VarNumeric (21)
      DBNull.Value, // AnsiStringFixedLength (22)
      DBNull.Value, // StringFixedLength (23)
      DBNull.Value, // ?? (24)
      DBNull.Value, // Xml (25)
      DBNull.Value, // DateTime2 (26)
      DBNull.Value  // DateTimeOffset (27)
    };

    /// <summary>
    /// Determines the default database type name to be used when a
    /// per-connection value is not available.
    /// </summary>
    /// <param name="connection">
    /// The connection context for type mappings, if any.
    /// </param>
    /// <returns>
    /// The default database type name to use.
    /// </returns>
    private static string GetDefaultTypeName(
        SQLiteConnection connection
        )
    {
        SQLiteConnectionFlags flags = (connection != null) ?
            connection.Flags : SQLiteConnectionFlags.None;

        if (HelperMethods.HasFlags(
                flags, SQLiteConnectionFlags.NoConvertSettings))
        {
            return FallbackDefaultTypeName;
        }


        string name = "Use_SQLiteConvert_DefaultTypeName";
        object value = null;
        string @default = null;


        if ((connection == null) ||
            !connection.TryGetCachedSetting(name, @default, out value))
        {
            try
            {
                value = UnsafeNativeMethods.GetSettingValue(name, @default);


                if (value == null)
                    value = FallbackDefaultTypeName;
            }
            finally
            {
                if (connection != null)
                    connection.SetCachedSetting(name, value);
            }
        }

        return SettingValueToString(value);
    }

#if !NET_COMPACT_20 && TRACE_WARNING
    /// <summary>
    /// If applicable, issues a trace log message warning about falling back to
    /// the default database type name.
    /// </summary>
    /// <param name="dbType">
    /// The database value type.
    /// </param>
    /// <param name="flags">
    /// The flags associated with the parent connection object.
    /// </param>
    /// <param name="typeName">
    /// The textual name of the database type.
    /// </param>
    private static void DefaultTypeNameWarning(
        DbType dbType,
        SQLiteConnectionFlags flags,
        string typeName
        )
    {
        if (HelperMethods.HasFlags(flags, SQLiteConnectionFlags.TraceWarning))
        {
            Trace.WriteLine(HelperMethods.StringFormat(
                CultureInfo.CurrentCulture,
                "WARNING: Type mapping failed, returning default name \"{0}\" for type {1}.",
                typeName, dbType));
        }
    }

    /// <summary>
    /// If applicable, issues a trace log message warning about falling back to
    /// the default database value type.
    /// </summary>
    /// <param name="typeName">
    /// The textual name of the database type.
    /// </param>
    /// <param name="flags">
    /// The flags associated with the parent connection object.
    /// </param>
    /// <param name="dbType">
    /// The database value type.
    /// </param>
    private static void DefaultDbTypeWarning(
        string typeName,
        SQLiteConnectionFlags flags,
        DbType? dbType
        )
    {
        if (!String.IsNullOrEmpty(typeName) &&
            HelperMethods.HasFlags(flags, SQLiteConnectionFlags.TraceWarning))
        {

            Trace.WriteLine(HelperMethods.StringFormat(
                CultureInfo.CurrentCulture,
                "WARNING: Type mapping failed, returning default type {0} for name \"{1}\".",
                dbType, typeName));
        }
    }
#endif

    /// <summary>
    /// For a given database value type, return the "closest-match" textual database type name.
    /// </summary>
    /// <param name="connection">The connection context for custom type mappings, if any.</param>
    /// <param name="dbType">The database value type.</param>
    /// <param name="flags">The flags associated with the parent connection object.</param>
    /// <returns>The type name or an empty string if it cannot be determined.</returns>
    internal static string DbTypeToTypeName(
        SQLiteConnection connection,
        DbType dbType,
        SQLiteConnectionFlags flags
        )
    {
        string defaultTypeName = null;

        if (connection != null)
        {
            flags |= connection.Flags;

            if (HelperMethods.HasFlags(flags, SQLiteConnectionFlags.UseConnectionTypes))
            {
                SQLiteDbTypeMap connectionTypeNames = connection._typeNames;

                if (connectionTypeNames != null)
                {
                    SQLiteDbTypeMapping value;

                    if (connectionTypeNames.TryGetValue(dbType, out value))
                        return value.typeName;
                }
            }

            //
            // NOTE: Use the default database type name for the connection.
            //
            defaultTypeName = connection.DefaultTypeName;
        }

        if (HelperMethods.HasFlags(flags, SQLiteConnectionFlags.NoGlobalTypes))
        {
            if (defaultTypeName != null)
                return defaultTypeName;

            defaultTypeName = GetDefaultTypeName(connection);

#if !NET_COMPACT_20 && TRACE_WARNING
            DefaultTypeNameWarning(dbType, flags, defaultTypeName);
#endif

            return defaultTypeName;
        }

        {
            SQLiteDbTypeMapping value;

            if ((_typeNames != null) &&
                _typeNames.TryGetValue(dbType, out value))
            {
                return value.typeName;
            }
        }

        if (defaultTypeName != null)
            return defaultTypeName;

        defaultTypeName = GetDefaultTypeName(connection);

#if !NET_COMPACT_20 && TRACE_WARNING
        DefaultTypeNameWarning(dbType, flags, defaultTypeName);
#endif

        return defaultTypeName;
    }

    /// <summary>
    /// Convert a DbType to a Type
    /// </summary>
    /// <param name="typ">The DbType to convert from</param>
    /// <returns>The closest-match .NET type</returns>
    internal static Type DbTypeToType(DbType typ)
    {
      return _dbtypeToType[(int)typ];
    }

    private static Type[] _dbtypeToType = {
      typeof(string),        // AnsiString (0)
      typeof(byte[]),        // Binary (1)
      typeof(byte),          // Byte (2)
      typeof(bool),          // Boolean (3)
      typeof(decimal),       // Currency (4)
      typeof(DateTime),      // Date (5)
      typeof(DateTime),      // DateTime (6)
      typeof(decimal),       // Decimal (7)
      typeof(double),        // Double (8)
      typeof(Guid),          // Guid (9)
      typeof(Int16),         // Int16 (10)
      typeof(Int32),         // Int32 (11)
      typeof(Int64),         // Int64 (12)
      typeof(object),        // Object (13)
      typeof(sbyte),         // SByte (14)
      typeof(float),         // Single (15)
      typeof(string),        // String (16)
      typeof(DateTime),      // Time (17)
      typeof(UInt16),        // UInt16 (18)
      typeof(UInt32),        // UInt32 (19)
      typeof(UInt64),        // UInt64 (20)
      typeof(double),        // VarNumeric (21)
      typeof(string),        // AnsiStringFixedLength (22)
      typeof(string),        // StringFixedLength (23)
      typeof(string),        // ?? (24)
      typeof(string),        // Xml (25)
      typeof(DateTime),      // DateTime2 (26)
#if !PLATFORM_COMPACTFRAMEWORK && (NET_35 || NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_20 || NET_STANDARD_21)
      //
      // NOTE: This type is only available on the
      //       .NET Framework 2.0 SP1 and later.
      //
      typeof(DateTimeOffset) // DateTimeOffset (27)
#else
      typeof(DateTime)       // DateTimeOffset (27)
#endif
    };

    /// <summary>
    /// For a given type, return the closest-match SQLite TypeAffinity, which only understands a very limited subset of types.
    /// </summary>
    /// <param name="typ">The type to evaluate</param>
    /// <param name="flags">The flags associated with the connection.</param>
    /// <returns>The SQLite type affinity for that type.</returns>
    internal static TypeAffinity TypeToAffinity(
        Type typ,
        SQLiteConnectionFlags flags
        )
    {
      TypeCode tc = Type.GetTypeCode(typ);
      if (tc == TypeCode.Object)
      {
        if (typ == typeof(byte[]) || typ == typeof(Guid))
          return TypeAffinity.Blob;
        else
          return TypeAffinity.Text;
      }
      if ((tc == TypeCode.Decimal) &&
          HelperMethods.HasFlags(flags, SQLiteConnectionFlags.GetDecimalAsText))
      {
          return TypeAffinity.Text;
      }
      return _typecodeAffinities[(int)tc];
    }

    private static TypeAffinity[] _typecodeAffinities = {
      TypeAffinity.Null,     // Empty (0)
      TypeAffinity.Blob,     // Object (1)
      TypeAffinity.Null,     // DBNull (2)
      TypeAffinity.Int64,    // Boolean (3)
      TypeAffinity.Int64,    // Char (4)
      TypeAffinity.Int64,    // SByte (5)
      TypeAffinity.Int64,    // Byte (6)
      TypeAffinity.Int64,    // Int16 (7)
      TypeAffinity.Int64,    // UInt16 (8)
      TypeAffinity.Int64,    // Int32 (9)
      TypeAffinity.Int64,    // UInt32 (10)
      TypeAffinity.Int64,    // Int64 (11)
      TypeAffinity.Int64,    // UInt64 (12)
      TypeAffinity.Double,   // Single (13)
      TypeAffinity.Double,   // Double (14)
      TypeAffinity.Double,   // Decimal (15)
      TypeAffinity.DateTime, // DateTime (16)
      TypeAffinity.Null,     // ?? (17)
      TypeAffinity.Text      // String (18)
    };

    /// <summary>
    /// Builds and returns a map containing the database column types
    /// recognized by this provider.
    /// </summary>
    /// <returns>
    /// A map containing the database column types recognized by this
    /// provider.
    /// </returns>
    private static SQLiteDbTypeMap GetSQLiteDbTypeMap()
    {
        return new SQLiteDbTypeMap(new SQLiteDbTypeMapping[] {
            new SQLiteDbTypeMapping("BIGINT", DbType.Int64, false),
            new SQLiteDbTypeMapping("BIGUINT", DbType.UInt64, false),
            new SQLiteDbTypeMapping("BINARY", DbType.Binary, false),
            new SQLiteDbTypeMapping("BIT", DbType.Boolean, true),
            new SQLiteDbTypeMapping("BLOB", DbType.Binary, true),
            new SQLiteDbTypeMapping("BOOL", DbType.Boolean, false),
            new SQLiteDbTypeMapping("BOOLEAN", DbType.Boolean, false),
            new SQLiteDbTypeMapping("CHAR", DbType.AnsiStringFixedLength, true),
            new SQLiteDbTypeMapping("CLOB", DbType.String, false),
            new SQLiteDbTypeMapping("COUNTER", DbType.Int64, false),
            new SQLiteDbTypeMapping("CURRENCY", DbType.Decimal, false),
            new SQLiteDbTypeMapping("DATE", DbType.DateTime, false),
            new SQLiteDbTypeMapping("DATETIME", DbType.DateTime, true),
            new SQLiteDbTypeMapping("DECIMAL", DbType.Decimal, true),
            new SQLiteDbTypeMapping("DECIMALTEXT", DbType.Decimal, false),
            new SQLiteDbTypeMapping("DOUBLE", DbType.Double, false),
            new SQLiteDbTypeMapping("FLOAT", DbType.Double, false),
            new SQLiteDbTypeMapping("GENERAL", DbType.Binary, false),
            new SQLiteDbTypeMapping("GUID", DbType.Guid, false),
            new SQLiteDbTypeMapping("IDENTITY", DbType.Int64, false),
            new SQLiteDbTypeMapping("IMAGE", DbType.Binary, false),
            new SQLiteDbTypeMapping("INT", DbType.Int32, true),
            new SQLiteDbTypeMapping("INT8", DbType.SByte, false),
            new SQLiteDbTypeMapping("INT16", DbType.Int16, false),
            new SQLiteDbTypeMapping("INT32", DbType.Int32, false),
            new SQLiteDbTypeMapping("INT64", DbType.Int64, false),
            new SQLiteDbTypeMapping("INTEGER", DbType.Int64, true),
            new SQLiteDbTypeMapping("INTEGER8", DbType.SByte, false),
            new SQLiteDbTypeMapping("INTEGER16", DbType.Int16, false),
            new SQLiteDbTypeMapping("INTEGER32", DbType.Int32, false),
            new SQLiteDbTypeMapping("INTEGER64", DbType.Int64, false),
            new SQLiteDbTypeMapping("LOGICAL", DbType.Boolean, false),
            new SQLiteDbTypeMapping("LONG", DbType.Int64, false),
            new SQLiteDbTypeMapping("LONGCHAR", DbType.String, false),
            new SQLiteDbTypeMapping("LONGTEXT", DbType.String, false),
            new SQLiteDbTypeMapping("LONGVARCHAR", DbType.String, false),
            new SQLiteDbTypeMapping("MEDIUMINT", DbType.Int32, false),
            new SQLiteDbTypeMapping("MEDIUMUINT", DbType.UInt32, false),
            new SQLiteDbTypeMapping("MEMO", DbType.String, false),
            new SQLiteDbTypeMapping("MONEY", DbType.Decimal, false),
            new SQLiteDbTypeMapping("NCHAR", DbType.StringFixedLength, true),
            new SQLiteDbTypeMapping("NOTE", DbType.String, false),
            new SQLiteDbTypeMapping("NTEXT", DbType.String, false),
            new SQLiteDbTypeMapping("NUMBER", DbType.Decimal, false),
            new SQLiteDbTypeMapping("NUMERIC", DbType.Decimal, false),
            new SQLiteDbTypeMapping("NUMERICTEXT", DbType.Decimal, false),
            new SQLiteDbTypeMapping("NVARCHAR", DbType.String, true),
            new SQLiteDbTypeMapping("OLEOBJECT", DbType.Binary, false),
            new SQLiteDbTypeMapping("RAW", DbType.Binary, false),
            new SQLiteDbTypeMapping("REAL", DbType.Double, true),
            new SQLiteDbTypeMapping("SINGLE", DbType.Single, true),
            new SQLiteDbTypeMapping("SMALLDATE", DbType.DateTime, false),
            new SQLiteDbTypeMapping("SMALLINT", DbType.Int16, true),
            new SQLiteDbTypeMapping("SMALLUINT", DbType.UInt16, true),
            new SQLiteDbTypeMapping("STRING", DbType.String, false),
            new SQLiteDbTypeMapping("TEXT", DbType.String, false),
            new SQLiteDbTypeMapping("TIME", DbType.DateTime, false),
            new SQLiteDbTypeMapping("TIMESTAMP", DbType.DateTime, false),
            new SQLiteDbTypeMapping("TINYINT", DbType.Byte, true),
            new SQLiteDbTypeMapping("TINYSINT", DbType.SByte, true),
            new SQLiteDbTypeMapping("UINT", DbType.UInt32, true),
            new SQLiteDbTypeMapping("UINT8", DbType.Byte, false),
            new SQLiteDbTypeMapping("UINT16", DbType.UInt16, false),
            new SQLiteDbTypeMapping("UINT32", DbType.UInt32, false),
            new SQLiteDbTypeMapping("UINT64", DbType.UInt64, false),
            new SQLiteDbTypeMapping("ULONG", DbType.UInt64, false),
            new SQLiteDbTypeMapping("UNIQUEIDENTIFIER", DbType.Guid, true),
            new SQLiteDbTypeMapping("UNSIGNEDINTEGER", DbType.UInt64, true),
            new SQLiteDbTypeMapping("UNSIGNEDINTEGER8", DbType.Byte, false),
            new SQLiteDbTypeMapping("UNSIGNEDINTEGER16", DbType.UInt16, false),
            new SQLiteDbTypeMapping("UNSIGNEDINTEGER32", DbType.UInt32, false),
            new SQLiteDbTypeMapping("UNSIGNEDINTEGER64", DbType.UInt64, false),
            new SQLiteDbTypeMapping("VARBINARY", DbType.Binary, false),
            new SQLiteDbTypeMapping("VARCHAR", DbType.AnsiString, true),
            new SQLiteDbTypeMapping("VARCHAR2", DbType.AnsiString, false),
            new SQLiteDbTypeMapping("YESNO", DbType.Boolean, false)
        });
    }

    /// <summary>
    /// Determines if a database type is considered to be a string.
    /// </summary>
    /// <param name="type">
    /// The database type to check.
    /// </param>
    /// <returns>
    /// Non-zero if the database type is considered to be a string, zero
    /// otherwise.
    /// </returns>
    internal static bool IsStringDbType(
        DbType type
        )
    {
        switch (type)
        {
            case DbType.AnsiString:
            case DbType.String:
            case DbType.AnsiStringFixedLength:
            case DbType.StringFixedLength:
                return true;
            default:
                return false;
        }
    }

    /// <summary>
    /// Determines and returns the runtime configuration setting string that
    /// should be used in place of the specified object value.
    /// </summary>
    /// <param name="value">
    /// The object value to convert to a string.
    /// </param>
    /// <returns>
    /// Either the string to use in place of the object value -OR- null if it
    /// cannot be determined.
    /// </returns>
    private static string SettingValueToString(
        object value
        )
    {
        if (value is string)
            return (string)value;

        if (value != null)
            return value.ToString();

        return null;
    }

    /// <summary>
    /// Determines the default <see cref="DbType" /> value to be used when a
    /// per-connection value is not available.
    /// </summary>
    /// <param name="connection">
    /// The connection context for type mappings, if any.
    /// </param>
    /// <returns>
    /// The default <see cref="DbType" /> value to use.
    /// </returns>
    private static DbType GetDefaultDbType(
        SQLiteConnection connection
        )
    {
        SQLiteConnectionFlags flags = (connection != null) ?
            connection.Flags : SQLiteConnectionFlags.None;

        if (HelperMethods.HasFlags(
                flags, SQLiteConnectionFlags.NoConvertSettings))
        {
            return FallbackDefaultDbType;
        }

        bool found = false;
        string name = "Use_SQLiteConvert_DefaultDbType";
        object value = null;
        string @default = null;

        if ((connection == null) ||
            !connection.TryGetCachedSetting(name, @default, out value))
        {
            value = UnsafeNativeMethods.GetSettingValue(name, @default);

            if (value == null)
                value = FallbackDefaultDbType;
        }
        else
        {
            found = true;
        }

        try
        {
            if (!(value is DbType))
            {
                value = SQLiteConnection.TryParseEnum(
                    typeof(DbType), SettingValueToString(value), true);

                if (!(value is DbType))
                    value = FallbackDefaultDbType;
            }

            return (DbType)value;
        }
        finally
        {
            if (!found && (connection != null))
                connection.SetCachedSetting(name, value);
        }
    }

    /// <summary>
    /// Converts the object value, which is assumed to have originated
    /// from a <see cref="DataRow" />, to a string value.
    /// </summary>
    /// <param name="value">
    /// The value to be converted to a string.
    /// </param>
    /// <returns>
    /// A null value will be returned if the original value is null -OR-
    /// the original value is <see cref="DBNull.Value" />.  Otherwise,
    /// the original value will be converted to a string, using its
    /// (possibly overridden) <see cref="Object.ToString" /> method and
    /// then returned.
    /// </returns>
    public static string GetStringOrNull(
        object value
        )
    {
        if (value == null)
            return null;

        if (value is string)
            return (string)value;

        if (value == DBNull.Value)
            return null;

        return value.ToString();
    }

    /// <summary>
    /// Determines if the specified textual value appears to be a
    /// <see cref="DBNull" /> value.
    /// </summary>
    /// <param name="text">
    /// The textual value to inspect.
    /// </param>
    /// <returns>
    /// Non-zero if the text looks like a <see cref="DBNull" /> value,
    /// zero otherwise.
    /// </returns>
    internal static bool LooksLikeNull(
        string text
        )
    {
        return (text == null);
    }

    /// <summary>
    /// Determines if the specified textual value appears to be an
    /// <see cref="Int64" /> value.
    /// </summary>
    /// <param name="text">
    /// The textual value to inspect.
    /// </param>
    /// <returns>
    /// Non-zero if the text looks like an <see cref="Int64" /> value,
    /// zero otherwise.
    /// </returns>
    internal static bool LooksLikeInt64(
        string text
        )
    {
        long longValue;

#if !PLATFORM_COMPACTFRAMEWORK
        if (!long.TryParse(
                text, NumberStyles.Integer, CultureInfo.InvariantCulture,
                out longValue))
        {
            return false;
        }
#else
        try
        {
            longValue = long.Parse(
                text, NumberStyles.Integer, CultureInfo.InvariantCulture);
        }
        catch
        {
            return false;
        }
#endif

        return String.Equals(
            longValue.ToString(CultureInfo.InvariantCulture), text,
            StringComparison.Ordinal);
    }

    /// <summary>
    /// Determines if the specified textual value appears to be a
    /// <see cref="Double" /> value.
    /// </summary>
    /// <param name="text">
    /// The textual value to inspect.
    /// </param>
    /// <returns>
    /// Non-zero if the text looks like a <see cref="Double" /> value,
    /// zero otherwise.
    /// </returns>
    internal static bool LooksLikeDouble(
        string text
        )
    {
        double doubleValue;

#if !PLATFORM_COMPACTFRAMEWORK
        if (!double.TryParse(
                text, NumberStyles.Float | NumberStyles.AllowThousands,
                CultureInfo.InvariantCulture, out doubleValue))
        {
            return false;
        }
#else
        try
        {
            doubleValue = double.Parse(text, CultureInfo.InvariantCulture);
        }
        catch
        {
            return false;
        }
#endif

        return String.Equals(
            doubleValue.ToString(CultureInfo.InvariantCulture), text,
            StringComparison.Ordinal);
    }

    /// <summary>
    /// Determines if the specified textual value appears to be a
    /// <see cref="DateTime" /> value.
    /// </summary>
    /// <param name="convert">
    /// The <see cref="SQLiteConvert" /> object instance configured with
    /// the chosen <see cref="DateTime" /> format.
    /// </param>
    /// <param name="text">
    /// The textual value to inspect.
    /// </param>
    /// <returns>
    /// Non-zero if the text looks like a <see cref="DateTime" /> in the
    /// configured format, zero otherwise.
    /// </returns>
    internal static bool LooksLikeDateTime(
        SQLiteConvert convert,
        string text
        )
    {
        if (convert == null)
            return false;

        try
        {
            DateTime dateTimeValue = convert.ToDateTime(text);

            if (String.Equals(
                    convert.ToString(dateTimeValue),
                    text, StringComparison.Ordinal))
            {
                return true;
            }
        }
        catch
        {
            // do nothing.
        }

        return false;
    }

    /// <summary>
    /// For a given textual database type name, return the "closest-match" database type.
    /// This method is called during query result processing; therefore, its performance
    /// is critical.
    /// </summary>
    /// <param name="connection">The connection context for custom type mappings, if any.</param>
    /// <param name="typeName">The textual name of the database type to match.</param>
    /// <param name="flags">The flags associated with the parent connection object.</param>
    /// <returns>The .NET DBType the text evaluates to.</returns>
    internal static DbType TypeNameToDbType(
        SQLiteConnection connection,
        string typeName,
        SQLiteConnectionFlags flags
        )
    {
        DbType? defaultDbType = null;

        if (connection != null)
        {
            flags |= connection.Flags;

            if (HelperMethods.HasFlags(flags, SQLiteConnectionFlags.UseConnectionTypes))
            {
                SQLiteDbTypeMap connectionTypeNames = connection._typeNames;

                if (connectionTypeNames != null)
                {
                    if (typeName != null)
                    {
                        SQLiteDbTypeMapping value;

                        if (connectionTypeNames.TryGetValue(typeName, out value))
                        {
                            return value.dataType;
                        }
                        else
                        {
                            int index = typeName.IndexOf('(');

                            if ((index > 0) &&
                                connectionTypeNames.TryGetValue(typeName.Substring(0, index).TrimEnd(), out value))
                            {
                                return value.dataType;
                            }
                        }
                    }
                }
            }

            //
            // NOTE: Use the default database type for the connection.
            //
            defaultDbType = connection.DefaultDbType;
        }

        if (HelperMethods.HasFlags(flags, SQLiteConnectionFlags.NoGlobalTypes))
        {
            if (defaultDbType != null)
                return (DbType)defaultDbType;

            defaultDbType = GetDefaultDbType(connection);

#if !NET_COMPACT_20 && TRACE_WARNING
            DefaultDbTypeWarning(typeName, flags, defaultDbType);
#endif

            return (DbType)defaultDbType;
        }

        {
            if ((_typeNames != null) && (typeName != null))
            {
                SQLiteDbTypeMapping value;

                if (_typeNames.TryGetValue(typeName, out value))
                {
                    return value.dataType;
                }
                else
                {
                    int index = typeName.IndexOf('(');

                    if ((index > 0) &&
                        _typeNames.TryGetValue(typeName.Substring(0, index).TrimEnd(), out value))
                    {
                        return value.dataType;
                    }
                }
            }
        }

        if (defaultDbType != null)
            return (DbType)defaultDbType;

        defaultDbType = GetDefaultDbType(connection);

#if !NET_COMPACT_20 && TRACE_WARNING
        DefaultDbTypeWarning(typeName, flags, defaultDbType);
#endif

        return (DbType)defaultDbType;
    }
    #endregion

    private static readonly SQLiteDbTypeMap _typeNames = GetSQLiteDbTypeMap();












































  }

  /// <summary>
  /// SQLite has very limited types, and is inherently text-based.  The first 5 types below represent the sum of all types SQLite
  /// understands.  The DateTime extension to the spec is for internal use only.
  /// </summary>
  public enum TypeAffinity
718
719
720
721
722
723
724
725
726
727
728
729
730














































































































































731
732
733
734
735

736

737
738





739
740
741
742
743
744
745
746
747
748
749

750
751
752
753
754
755
756
















757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772




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
800
801
802
803
804
805
806

807



















808




809





























































































































810




811
812
813

814
815
816
817

818
819


















































    /// </summary>
    Null = 5,
    /// <summary>
    /// Used internally by this provider
    /// </summary>
    DateTime = 10,
    /// <summary>
    /// Used internally
    /// </summary>
    None = 11,
  }

  /// <summary>














































































































































  /// This implementation of SQLite for ADO.NET can process date/time fields in databases in only one of three formats.  Ticks, ISO8601
  /// and JulianDay.
  /// </summary>
  /// <remarks>
  /// ISO8601 is more compatible, readable, fully-processable, but less accurate as it doesn't provide time down to fractions of a second.

  /// JulianDay is the numeric format the SQLite uses internally and is arguably the most compatible with 3rd party tools.  It is

  /// not readable as text without post-processing.
  /// Ticks less compatible with 3rd party tools that query the database, and renders the DateTime field unreadable as text without post-processing.





  /// 
  /// The preferred order of choosing a datetime format is JulianDay, ISO8601, and then Ticks.  Ticks is mainly present for legacy 
  /// code support.
  /// </remarks>
  public enum SQLiteDateFormats
  {
    /// <summary>
    /// Using ticks is not recommended and is not well supported with LINQ.
    /// </summary>
    Ticks = 0,
    /// <summary>

    /// The default format for this provider.
    /// </summary>
    ISO8601 = 1,
    /// <summary>
    /// JulianDay format, which is what SQLite uses internally
    /// </summary>
    JulianDay = 2
















  }

  /// <summary>
  /// This enum determines how SQLite treats its journal file.
  /// </summary>
  /// <remarks>
  /// By default SQLite will create and delete the journal file when needed during a transaction.
  /// However, for some computers running certain filesystem monitoring tools, the rapid
  /// creation and deletion of the journal file can cause those programs to fail, or to interfere with SQLite.
  /// 
  /// If a program or virus scanner is interfering with SQLite's journal file, you may receive errors like "unable to open database file"
  /// when starting a transaction.  If this is happening, you may want to change the default journal mode to Persist.
  /// </remarks>
  public enum SQLiteJournalModeEnum
  {
    /// <summary>




    /// The default mode, this causes SQLite to create and destroy the journal file as-needed.
    /// </summary>
    Delete = 0,
    /// <summary>
    /// When this is set, SQLite will keep the journal file even after a transaction has completed.  It's contents will be erased,
    /// and the journal re-used as often as needed.  If it is deleted, it will be recreated the next time it is needed.
    /// </summary>
    Persist = 1,
    /// <summary>
    /// This option disables the rollback journal entirely.  Interrupted transactions or a program crash can cause database
    /// corruption in this mode!
    /// </summary>
    Off = 2,
    /// <summary>
    /// This option commits transactions by truncating the rollback journal to zero-length instead of deleting it. On many systems,
    /// truncating a file is much faster than deleting the file since the containing directory does not need to be changed.
    /// </summary>
    Truncate = 3,



















































































































































































































































































































































































  }

  /// <summary>
  /// Struct used internally to determine the datatype of a column in a resultset
  /// </summary>
  internal class SQLiteType
  {
    /// <summary>
    /// The DbType of the column, or DbType.Object if it cannot be determined
    /// </summary>
    internal DbType Type;
    /// <summary>
    /// The affinity of a column, used for expressions or when Type is DbType.Object
    /// </summary>
    internal TypeAffinity Affinity;
  }





















  internal struct SQLiteTypeNames




  {





























































































































    internal SQLiteTypeNames(string newtypeName, DbType newdataType)




    {
      typeName = newtypeName;
      dataType = newdataType;

    }

    internal string typeName;
    internal DbType dataType;

  }
}

























































|





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


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




|



>
|



|

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









|






>
>
>
>
|













|
<


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



|

|









|
>

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

|
|
>




>

|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549

2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
    /// </summary>
    Null = 5,
    /// <summary>
    /// Used internally by this provider
    /// </summary>
    DateTime = 10,
    /// <summary>
    /// Used internally by this provider
    /// </summary>
    None = 11,
  }

  /// <summary>
  /// These are the event types associated with the
  /// <see cref="SQLiteConnectionEventHandler" />
  /// delegate (and its corresponding event) and the
  /// <see cref="ConnectionEventArgs" /> class.
  /// </summary>
  public enum SQLiteConnectionEventType
  {
      /// <summary>
      /// Not used.
      /// </summary>
      Invalid = -1,

      /// <summary>
      /// Not used.
      /// </summary>
      Unknown = 0,

      /// <summary>
      /// The connection is being opened.
      /// </summary>
      Opening = 1,

      /// <summary>
      /// The connection string has been parsed.
      /// </summary>
      ConnectionString = 2,

      /// <summary>
      /// The connection was opened.
      /// </summary>
      Opened = 3,

      /// <summary>
      /// The <see cref="ChangeDatabase" /> method was called on the
      /// connection.
      /// </summary>
      ChangeDatabase = 4,

      /// <summary>
      /// A transaction was created using the connection.
      /// </summary>
      NewTransaction = 5,

      /// <summary>
      /// The connection was enlisted into a transaction.
      /// </summary>
      EnlistTransaction = 6,

      /// <summary>
      /// A command was created using the connection.
      /// </summary>
      NewCommand = 7,

      /// <summary>
      /// A data reader was created using the connection.
      /// </summary>
      NewDataReader = 8,

      /// <summary>
      /// An instance of a <see cref="CriticalHandle" /> derived class has
      /// been created to wrap a native resource.
      /// </summary>
      NewCriticalHandle = 9,

      /// <summary>
      /// The connection is being closed.
      /// </summary>
      Closing = 10,

      /// <summary>
      /// The connection was closed.
      /// </summary>
      Closed = 11,

      /// <summary>
      /// A command is being disposed.
      /// </summary>
      DisposingCommand = 12,

      /// <summary>
      /// A data reader is being disposed.
      /// </summary>
      DisposingDataReader = 13,

      /// <summary>
      /// A data reader is being closed.
      /// </summary>
      ClosingDataReader = 14,

      /// <summary>
      /// A native resource was opened (i.e. obtained) from the pool.
      /// </summary>
      OpenedFromPool = 15,

      /// <summary>
      /// A native resource was closed (i.e. released) to the pool.
      /// </summary>
      ClosedToPool = 16,

      /// <summary>
      /// The connection is being disposed.
      /// </summary>
      DisposingConnection = 17,

      /// <summary>
      /// The connection was disposed.
      /// </summary>
      DisposedConnection = 18,

      /// <summary>
      /// The connection is being finalized.
      /// </summary>
      FinalizingConnection = 19,

      /// <summary>
      /// The connection was finalized.
      /// </summary>
      FinalizedConnection = 20,

      /// <summary>
      /// The closing of the object had no effect, e.g. because the
      /// underlying resource was not actually allocated or opened.
      /// </summary>
      NothingToDo = 21,

      /// <summary>
      /// The connection string may be changed.
      /// </summary>
      ConnectionStringPreview = 22,

      /// <summary>
      /// The SQL string may be changed.
      /// </summary>
      SqlStringPreview = 23,

      /// <summary>
      /// The <see cref="SQLiteConnection.Cancel" /> method was invoked.
      /// </summary>
      Canceled = 24
  }

  /// <summary>
  /// This implementation of SQLite for ADO.NET can process date/time fields in
  /// databases in one of six formats.
  /// </summary>
  /// <remarks>
  /// ISO8601 format is more compatible, readable, fully-processable, but less
  /// accurate as it does not provide time down to fractions of a second.
  /// JulianDay is the numeric format the SQLite uses internally and is arguably
  /// the most compatible with 3rd party tools.  It is not readable as text
  /// without post-processing.  Ticks less compatible with 3rd party tools that
  /// query the database, and renders the DateTime field unreadable as text
  /// without post-processing.  UnixEpoch is more compatible with Unix systems.
  /// InvariantCulture allows the configured format for the invariant culture
  /// format to be used and is human readable.  CurrentCulture allows the
  /// configured format for the current culture to be used and is also human
  /// readable.
  ///
  /// The preferred order of choosing a DateTime format is JulianDay, ISO8601,
  /// and then Ticks.  Ticks is mainly present for legacy code support.
  /// </remarks>
  public enum SQLiteDateFormats
  {
    /// <summary>
    /// Use the value of DateTime.Ticks.  This value is not recommended and is not well supported with LINQ.
    /// </summary>
    Ticks = 0,
    /// <summary>
    /// Use the ISO-8601 format.  Uses the "yyyy-MM-dd HH:mm:ss.FFFFFFFK" format for UTC DateTime values and
    /// "yyyy-MM-dd HH:mm:ss.FFFFFFF" format for local DateTime values).
    /// </summary>
    ISO8601 = 1,
    /// <summary>
    /// The interval of time in days and fractions of a day since January 1, 4713 BC.
    /// </summary>
    JulianDay = 2,
    /// <summary>
    /// The whole number of seconds since the Unix epoch (January 1, 1970).
    /// </summary>
    UnixEpoch = 3,
    /// <summary>
    /// Any culture-independent string value that the .NET Framework can interpret as a valid DateTime.
    /// </summary>
    InvariantCulture = 4,
    /// <summary>
    /// Any string value that the .NET Framework can interpret as a valid DateTime using the current culture.
    /// </summary>
    CurrentCulture = 5,
    /// <summary>
    /// The default format for this provider.
    /// </summary>
    Default = ISO8601
  }

  /// <summary>
  /// This enum determines how SQLite treats its journal file.
  /// </summary>
  /// <remarks>
  /// By default SQLite will create and delete the journal file when needed during a transaction.
  /// However, for some computers running certain filesystem monitoring tools, the rapid
  /// creation and deletion of the journal file can cause those programs to fail, or to interfere with SQLite.
  ///
  /// If a program or virus scanner is interfering with SQLite's journal file, you may receive errors like "unable to open database file"
  /// when starting a transaction.  If this is happening, you may want to change the default journal mode to Persist.
  /// </remarks>
  public enum SQLiteJournalModeEnum
  {
    /// <summary>
    /// The default mode, this causes SQLite to use the existing journaling mode for the database.
    /// </summary>
    Default = -1,
    /// <summary>
    /// SQLite will create and destroy the journal file as-needed.
    /// </summary>
    Delete = 0,
    /// <summary>
    /// When this is set, SQLite will keep the journal file even after a transaction has completed.  It's contents will be erased,
    /// and the journal re-used as often as needed.  If it is deleted, it will be recreated the next time it is needed.
    /// </summary>
    Persist = 1,
    /// <summary>
    /// This option disables the rollback journal entirely.  Interrupted transactions or a program crash can cause database
    /// corruption in this mode!
    /// </summary>
    Off = 2,
    /// <summary>
    /// SQLite will truncate the journal file to zero-length instead of deleting it.

    /// </summary>
    Truncate = 3,
    /// <summary>
    /// SQLite will store the journal in volatile RAM.  This saves disk I/O but at the expense of database safety and integrity.
    /// If the application using SQLite crashes in the middle of a transaction when the MEMORY journaling mode is set, then the
    /// database file will very likely go corrupt.
    /// </summary>
    Memory = 4,
    /// <summary>
    /// SQLite uses a write-ahead log instead of a rollback journal to implement transactions.  The WAL journaling mode is persistent;
    /// after being set it stays in effect across multiple database connections and after closing and reopening the database. A database
    /// in WAL journaling mode can only be accessed by SQLite version 3.7.0 or later.
    /// </summary>
    Wal = 5
  }

  /// <summary>
  /// Possible values for the "synchronous" database setting.  This setting determines
  /// how often the database engine calls the xSync method of the VFS.
  /// </summary>
  internal enum SQLiteSynchronousEnum
  {
      /// <summary>
      /// Use the default "synchronous" database setting.  Currently, this should be
      /// the same as using the FULL mode.
      /// </summary>
      Default = -1,

      /// <summary>
      /// The database engine continues without syncing as soon as it has handed
      /// data off to the operating system.  If the application running SQLite
      /// crashes, the data will be safe, but the database might become corrupted
      /// if the operating system crashes or the computer loses power before that
      /// data has been written to the disk surface.
      /// </summary>
      Off = 0,

      /// <summary>
      /// The database engine will still sync at the most critical moments, but
      /// less often than in FULL mode.  There is a very small (though non-zero)
      /// chance that a power failure at just the wrong time could corrupt the
      /// database in NORMAL mode.
      /// </summary>
      Normal = 1,

      /// <summary>
      /// The database engine will use the xSync method of the VFS to ensure that
      /// all content is safely written to the disk surface prior to continuing.
      /// This ensures that an operating system crash or power failure will not
      /// corrupt the database.  FULL synchronous is very safe, but it is also
      /// slower.
      /// </summary>
      Full = 2
  }

  /// <summary>
  /// The requested command execution type.  This controls which method of the
  /// <see cref="SQLiteCommand" /> object will be called.
  /// </summary>
  public enum SQLiteExecuteType
  {
      /// <summary>
      /// Do nothing.  No method will be called.
      /// </summary>
      None = 0,

      /// <summary>
      /// The command is not expected to return a result -OR- the result is not
      /// needed.  The <see cref="SQLiteCommand.ExecuteNonQuery()" /> or
      /// <see cref="SQLiteCommand.ExecuteNonQuery(CommandBehavior)" />  method
      /// will be called.
      /// </summary>
      NonQuery = 1,

      /// <summary>
      /// The command is expected to return a scalar result -OR- the result should
      /// be limited to a scalar result.  The <see cref="SQLiteCommand.ExecuteScalar()" />
      /// or <see cref="SQLiteCommand.ExecuteScalar(CommandBehavior)" /> method will
      /// be called.
      /// </summary>
      Scalar = 2,

      /// <summary>
      /// The command is expected to return <see cref="SQLiteDataReader" /> result.
      /// The <see cref="SQLiteCommand.ExecuteReader()" /> or
      /// <see cref="SQLiteCommand.ExecuteReader(CommandBehavior)" /> method will
      /// be called.
      /// </summary>
      Reader = 3,

      /// <summary>
      /// Use the default command execution type.  Using this value is the same
      /// as using the <see cref="SQLiteExecuteType.NonQuery" /> value.
      /// </summary>
      Default = NonQuery /* TODO: Good default? */
  }

  /// <summary>
  /// The action code responsible for the current call into the authorizer.
  /// </summary>
  public enum SQLiteAuthorizerActionCode
  {
      /// <summary>
      /// No action is being performed.  This value should not be used from
      /// external code.
      /// </summary>
      None = -1,

      /// <summary>
      /// No longer used.
      /// </summary>
      Copy = 0,

      /// <summary>
      /// An index will be created.  The action-specific arguments are the
      /// index name and the table name.
      ///
      /// </summary>
      CreateIndex = 1,

      /// <summary>
      /// A table will be created.  The action-specific arguments are the
      /// table name and a null value.
      /// </summary>
      CreateTable = 2,

      /// <summary>
      /// A temporary index will be created.  The action-specific arguments
      /// are the index name and the table name.
      /// </summary>
      CreateTempIndex = 3,

      /// <summary>
      /// A temporary table will be created.  The action-specific arguments
      /// are the table name and a null value.
      /// </summary>
      CreateTempTable = 4,

      /// <summary>
      /// A temporary trigger will be created.  The action-specific arguments
      /// are the trigger name and the table name.
      /// </summary>
      CreateTempTrigger = 5,

      /// <summary>
      /// A temporary view will be created.  The action-specific arguments are
      /// the view name and a null value.
      /// </summary>
      CreateTempView = 6,

      /// <summary>
      /// A trigger will be created.  The action-specific arguments are the
      /// trigger name and the table name.
      /// </summary>
      CreateTrigger = 7,

      /// <summary>
      /// A view will be created.  The action-specific arguments are the view
      /// name and a null value.
      /// </summary>
      CreateView = 8,

      /// <summary>
      /// A DELETE statement will be executed.  The action-specific arguments
      /// are the table name and a null value.
      /// </summary>
      Delete = 9,

      /// <summary>
      /// An index will be dropped.  The action-specific arguments are the
      /// index name and the table name.
      /// </summary>
      DropIndex = 10,

      /// <summary>
      /// A table will be dropped.  The action-specific arguments are the tables
      /// name and a null value.
      /// </summary>
      DropTable = 11,

      /// <summary>
      /// A temporary index will be dropped.  The action-specific arguments are
      /// the index name and the table name.
      /// </summary>
      DropTempIndex = 12,

      /// <summary>
      /// A temporary table will be dropped.  The action-specific arguments are
      /// the table name and a null value.
      /// </summary>
      DropTempTable = 13,

      /// <summary>
      /// A temporary trigger will be dropped.  The action-specific arguments
      /// are the trigger name and the table name.
      /// </summary>
      DropTempTrigger = 14,

      /// <summary>
      /// A temporary view will be dropped.  The action-specific arguments are
      /// the view name and a null value.
      /// </summary>
      DropTempView = 15,

      /// <summary>
      /// A trigger will be dropped.  The action-specific arguments are the
      /// trigger name and the table name.
      /// </summary>
      DropTrigger = 16,

      /// <summary>
      /// A view will be dropped.  The action-specific arguments are the view
      /// name and a null value.
      /// </summary>
      DropView = 17,

      /// <summary>
      /// An INSERT statement will be executed.  The action-specific arguments
      /// are the table name and a null value.
      /// </summary>
      Insert = 18,

      /// <summary>
      /// A PRAGMA statement will be executed.  The action-specific arguments
      /// are the name of the PRAGMA and the new value or a null value.
      /// </summary>
      Pragma = 19,

      /// <summary>
      /// A table column will be read.  The action-specific arguments are the
      /// table name and the column name.
      /// </summary>
      Read = 20,

      /// <summary>
      /// A SELECT statement will be executed.  The action-specific arguments
      /// are both null values.
      /// </summary>
      Select = 21,

      /// <summary>
      /// A transaction will be started, committed, or rolled back.  The
      /// action-specific arguments are the name of the operation (BEGIN,
      /// COMMIT, or ROLLBACK) and a null value.
      /// </summary>
      Transaction = 22,

      /// <summary>
      /// An UPDATE statement will be executed.  The action-specific arguments
      /// are the table name and the column name.
      /// </summary>
      Update = 23,

      /// <summary>
      /// A database will be attached to the connection.  The action-specific
      /// arguments are the database file name and a null value.
      /// </summary>
      Attach = 24,

      /// <summary>
      /// A database will be detached from the connection.  The action-specific
      /// arguments are the database name and a null value.
      /// </summary>
      Detach = 25,

      /// <summary>
      /// The schema of a table will be altered.  The action-specific arguments
      /// are the database name and the table name.
      /// </summary>
      AlterTable = 26,

      /// <summary>
      /// An index will be deleted and then recreated.  The action-specific
      /// arguments are the index name and a null value.
      /// </summary>
      Reindex = 27,

      /// <summary>
      /// A table will be analyzed to gathers statistics about it.  The
      /// action-specific arguments are the table name and a null value.
      /// </summary>
      Analyze = 28,

      /// <summary>
      /// A virtual table will be created.  The action-specific arguments are
      /// the table name and the module name.
      /// </summary>
      CreateVtable = 29,

      /// <summary>
      /// A virtual table will be dropped.  The action-specific arguments are
      /// the table name and the module name.
      /// </summary>
      DropVtable = 30,

      /// <summary>
      /// A SQL function will be called.  The action-specific arguments are a
      /// null value and the function name.
      /// </summary>
      Function = 31,

      /// <summary>
      /// A savepoint will be created, released, or rolled back.  The
      /// action-specific arguments are the name of the operation (BEGIN,
      /// RELEASE, or ROLLBACK) and the savepoint name.
      /// </summary>
      Savepoint = 32,

      /// <summary>
      /// A recursive query will be executed.  The action-specific arguments
      /// are two null values.
      /// </summary>
      Recursive = 33
  }

  /// <summary>
  /// The possible return codes for the busy callback.
  /// </summary>
  public enum SQLiteBusyReturnCode /* int */
  {
      /// <summary>
      /// Stop invoking the busy callback and return
      /// <see cref="SQLiteErrorCode.Busy" /> to the
      /// caller.
      /// </summary>
      Stop = 0,

      /// <summary>
      /// Retry the associated operation and invoke
      /// the busy callback again, if necessary.
      /// </summary>
      Retry = 1
  }

  /// <summary>
  /// The possible return codes for the progress callback.
  /// </summary>
  public enum SQLiteProgressReturnCode /* int */
  {
      /// <summary>
      /// The operation should continue.
      /// </summary>
      Continue = 0,

      /// <summary>
      /// The operation should be interrupted.
      /// </summary>
      Interrupt = 1
  }

  /// <summary>
  /// The return code for the current call into the authorizer.
  /// </summary>
  public enum SQLiteAuthorizerReturnCode
  {
      /// <summary>
      /// The action will be allowed.
      /// </summary>
      Ok = 0,

      /// <summary>
      /// The overall action will be disallowed and an error message will be
      /// returned from the query preparation method.
      /// </summary>
      Deny = 1,

      /// <summary>
      /// The specific action will be disallowed; however, the overall action
      /// will continue.  The exact effects of this return code vary depending
      /// on the specific action, please refer to the SQLite core library
      /// documentation for futher details.
      /// </summary>
      Ignore = 2
  }

  /// <summary>
  /// Class used internally to determine the datatype of a column in a resultset
  /// </summary>
  internal sealed class SQLiteType
  {
    /// <summary>
    /// The DbType of the column, or DbType.Object if it cannot be determined
    /// </summary>
    internal DbType Type;
    /// <summary>
    /// The affinity of a column, used for expressions or when Type is DbType.Object
    /// </summary>
    internal TypeAffinity Affinity;

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Constructs a default instance of this type.
    /// </summary>
    public SQLiteType()
    {
      // do nothing.
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Constructs an instance of this type with the specified field values.
    /// </summary>
    /// <param name="affinity">
    /// The type affinity to use for the new instance.
    /// </param>
    /// <param name="type">
    /// The database type to use for the new instance.
    /// </param>
    public SQLiteType(
      TypeAffinity affinity,
      DbType type
      )
      : this()
    {
      this.Affinity = affinity;
      this.Type = type;
    }
  }

  /////////////////////////////////////////////////////////////////////////////

  internal sealed class SQLiteDbTypeMap
      : Dictionary<string, SQLiteDbTypeMapping>
  {
      #region Private Data
      private Dictionary<DbType, SQLiteDbTypeMapping> reverse;
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Public Constructors
      public SQLiteDbTypeMap()
          : base(new TypeNameStringComparer())
      {
          reverse = new Dictionary<DbType, SQLiteDbTypeMapping>();
      }

      /////////////////////////////////////////////////////////////////////////

      public SQLiteDbTypeMap(
          IEnumerable<SQLiteDbTypeMapping> collection
          )
          : this()
      {
          Add(collection);
      }
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region System.Collections.Generic.Dictionary "Overrides"
      public new int Clear()
      {
          int result = 0;

          if (reverse != null)
          {
              result += reverse.Count;
              reverse.Clear();
          }

          result += base.Count;
          base.Clear();

          return result;
      }
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region SQLiteDbTypeMapping Helper Methods
      public void Add(
          IEnumerable<SQLiteDbTypeMapping> collection
          )
      {
          if (collection == null)
              throw new ArgumentNullException("collection");

          foreach (SQLiteDbTypeMapping item in collection)
              Add(item);
      }

      /////////////////////////////////////////////////////////////////////////

      public void Add(SQLiteDbTypeMapping item)
      {
          if (item == null)
              throw new ArgumentNullException("item");

          if (item.typeName == null)
              throw new ArgumentException("item type name cannot be null");

          base.Add(item.typeName, item);

          if (item.primary)
              reverse.Add(item.dataType, item);
      }
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region DbType Helper Methods
      public bool ContainsKey(DbType key)
      {
          if (reverse == null)
              return false;

          return reverse.ContainsKey(key);
      }

      /////////////////////////////////////////////////////////////////////////

      public bool TryGetValue(DbType key, out SQLiteDbTypeMapping value)
      {
          if (reverse == null)
          {
              value = null;
              return false;
          }

          return reverse.TryGetValue(key, out value);
      }

      /////////////////////////////////////////////////////////////////////////

      public bool Remove(DbType key)
      {
          if (reverse == null)
              return false;

          return reverse.Remove(key);
      }
      #endregion
  }

  /////////////////////////////////////////////////////////////////////////////

  internal sealed class SQLiteDbTypeMapping
  {
    internal SQLiteDbTypeMapping(
        string newTypeName,
        DbType newDataType,
        bool newPrimary
        )
    {
      typeName = newTypeName;
      dataType = newDataType;
      primary = newPrimary;
    }

    internal string typeName;
    internal DbType dataType;
    internal bool primary;
  }

  internal sealed class TypeNameStringComparer : IEqualityComparer<string>, IComparer<string>
  {
    #region IEqualityComparer<string> Members
    public bool Equals(
      string left,
      string right
      )
    {
      return String.Equals(left, right, StringComparison.OrdinalIgnoreCase);
    }

    ///////////////////////////////////////////////////////////////////////////

    public int GetHashCode(
      string value
      )
    {
      //
      // NOTE: The only thing that we must guarantee here, according
      //       to the MSDN documentation for IEqualityComparer, is
      //       that for two given strings, if Equals return true then
      //       the two strings must hash to the same value.
      //
      if (value != null)
        return StringComparer.OrdinalIgnoreCase.GetHashCode(value);
      else
        throw new ArgumentNullException("value");
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region IComparer<string> Members
    public int Compare(
      string x,
      string y
      )
    {
      if ((x == null) && (y == null))
        return 0;
      else if (x == null)
        return -1;
      else if (y == null)
        return 1;
      else
        return x.CompareTo(y);
    }
    #endregion
  }
}

Deleted System.Data.SQLite/SQLiteDataAdapter.bmp.

cannot compute difference between binary files

Changes to System.Data.SQLite/SQLiteDataAdapter.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24




25
26
27



28
29

30
31
32
33
34
35
36
37


38
39
40

41

42
43
44

45
46


47
48

49

50

51


52
53
54
55
56


57
58

59

60


61


62




63


























64


65
66

67














68






























































69
70
71
72
73
74


75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Data;
  using System.Data.Common;
  using System.ComponentModel;

  /// <summary>
  /// SQLite implementation of DbDataAdapter.
  /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
  [DefaultEvent("RowUpdated")]
  [ToolboxItem("SQLite.Designer.SQLiteDataAdapterToolboxItem, SQLite.Designer, Version=1.0.37.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139")]
  [Designer("Microsoft.VSDesigner.Data.VS.SqlDataAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
  public sealed class SQLiteDataAdapter : DbDataAdapter
  {




    private static object _updatingEventPH = new object();
    private static object _updatedEventPH = new object();




    /// <overloads>
    /// This class is just a shell around the DbDataAdapter.  Nothing from DbDataAdapter is overridden here, just a few constructors are defined.

    /// </overloads>
    /// <summary>
    /// Default constructor.
    /// </summary>
    public SQLiteDataAdapter()
    {
    }



    /// <summary>
    /// Constructs a data adapter using the specified select command.
    /// </summary>

    /// <param name="cmd">The select command to associate with the adapter.</param>

    public SQLiteDataAdapter(SQLiteCommand cmd)
    {
      SelectCommand = cmd;

    }



    /// <summary>
    /// Constructs a data adapter with the supplied select command text and associated with the specified connection.

    /// </summary>

    /// <param name="commandText">The select command text to associate with the data adapter.</param>

    /// <param name="connection">The connection to associate with the select command.</param>


    public SQLiteDataAdapter(string commandText, SQLiteConnection connection)
    {
      SelectCommand = new SQLiteCommand(commandText, connection);
    }



    /// <summary>
    /// Constructs a data adapter with the specified select command text, and using the specified database connection string.

    /// </summary>

    /// <param name="commandText">The select command text to use to construct a select command.</param>


    /// <param name="connectionString">A connection string suitable for passing to a new SQLiteConnection, which is associated with the select command.</param>


    public SQLiteDataAdapter(string commandText, string connectionString)




    {


























      SQLiteConnection cnn = new SQLiteConnection(connectionString);


      SelectCommand = new SQLiteCommand(commandText, cnn);
    }
















    /// <summary>






























































    /// Row updating event handler
    /// </summary>
    public event EventHandler<RowUpdatingEventArgs> RowUpdating
    {
      add
      {


#if !PLATFORM_COMPACTFRAMEWORK
        EventHandler<RowUpdatingEventArgs> previous = (EventHandler<RowUpdatingEventArgs>)base.Events[_updatingEventPH];
        if ((previous != null) && (value.Target is DbCommandBuilder))
        {
          EventHandler<RowUpdatingEventArgs> handler = (EventHandler<RowUpdatingEventArgs>)FindBuilder(previous);
          if (handler != null)
          {
            base.Events.RemoveHandler(_updatingEventPH, handler);
          }
        }
#endif
        base.Events.AddHandler(_updatingEventPH, value); 
      }
      remove { base.Events.RemoveHandler(_updatingEventPH, value); }
    }

#if !PLATFORM_COMPACTFRAMEWORK
    internal static Delegate FindBuilder(MulticastDelegate mcd)
    {
      if (mcd != null)
      {










<








|




>
>
>
>



>
>
>

|
>








>
>



>
|
>



>


>
>

|
>

>
|
>
|
>
>





>
>

|
>

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

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


>

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

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






>
>













|







1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;

  using System.Data.Common;
  using System.ComponentModel;

  /// <summary>
  /// SQLite implementation of DbDataAdapter.
  /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
  [DefaultEvent("RowUpdated")]
  [ToolboxItem("SQLite.Designer.SQLiteDataAdapterToolboxItem, SQLite.Designer, Version=" + SQLite3.DesignerVersion + ", Culture=neutral, PublicKeyToken=db937bc2d44ff139")]
  [Designer("Microsoft.VSDesigner.Data.VS.SqlDataAdapterDesigner, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
  public sealed class SQLiteDataAdapter : DbDataAdapter
  {
    private bool disposeSelect = true;

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private static object _updatingEventPH = new object();
    private static object _updatedEventPH = new object();

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region Public Constructors
    /// <overloads>
    /// This class is just a shell around the DbDataAdapter.  Nothing from
    /// DbDataAdapter is overridden here, just a few constructors are defined.
    /// </overloads>
    /// <summary>
    /// Default constructor.
    /// </summary>
    public SQLiteDataAdapter()
    {
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Constructs a data adapter using the specified select command.
    /// </summary>
    /// <param name="cmd">
    /// The select command to associate with the adapter.
    /// </param>
    public SQLiteDataAdapter(SQLiteCommand cmd)
    {
      SelectCommand = cmd;
      disposeSelect = false;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Constructs a data adapter with the supplied select command text and
    /// associated with the specified connection.
    /// </summary>
    /// <param name="commandText">
    /// The select command text to associate with the data adapter.
    /// </param>
    /// <param name="connection">
    /// The connection to associate with the select command.
    /// </param>
    public SQLiteDataAdapter(string commandText, SQLiteConnection connection)
    {
      SelectCommand = new SQLiteCommand(commandText, connection);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Constructs a data adapter with the specified select command text,
    /// and using the specified database connection string.
    /// </summary>
    /// <param name="commandText">
    /// The select command text to use to construct a select command.
    /// </param>
    /// <param name="connectionString">
    /// A connection string suitable for passing to a new SQLiteConnection,
    /// which is associated with the select command.
    /// </param>
    public SQLiteDataAdapter(
        string commandText,
        string connectionString
        )
        : this(commandText, connectionString, false)
    {
        // do nothing.
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Constructs a data adapter with the specified select command text,
    /// and using the specified database connection string.
    /// </summary>
    /// <param name="commandText">
    /// The select command text to use to construct a select command.
    /// </param>
    /// <param name="connectionString">
    /// A connection string suitable for passing to a new SQLiteConnection,
    /// which is associated with the select command.
    /// </param>
    /// <param name="parseViaFramework">
    /// Non-zero to parse the connection string using the built-in (i.e.
    /// framework provided) parser when opening the connection.
    /// </param>
    public SQLiteDataAdapter(
        string commandText,
        string connectionString,
        bool parseViaFramework
        )
    {
      SQLiteConnection cnn = new SQLiteConnection(
          connectionString, parseViaFramework);

      SelectCommand = new SQLiteCommand(commandText, cnn);
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable "Pattern" Members
    private bool disposed;
    private void CheckDisposed() /* throw */
    {
#if THROW_ON_DISPOSED
        if (disposed)
            throw new ObjectDisposedException(typeof(SQLiteDataAdapter).Name);
#endif
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Cleans up resources (native and managed) associated with the current instance.
    /// </summary>
    /// <param name="disposing">
    /// Zero when being disposed via garbage collection; otherwise, non-zero.
    /// </param>
    protected override void Dispose(bool disposing)
    {
        try
        {
            if (!disposed)
            {
                if (disposing)
                {
                    ////////////////////////////////////
                    // dispose managed resources here...
                    ////////////////////////////////////

                    if (disposeSelect && (SelectCommand != null))
                    {
                        SelectCommand.Dispose();
                        SelectCommand = null;
                    }

                    if (InsertCommand != null)
                    {
                        InsertCommand.Dispose();
                        InsertCommand = null;
                    }

                    if (UpdateCommand != null)
                    {
                        UpdateCommand.Dispose();
                        UpdateCommand = null;
                    }

                    if (DeleteCommand != null)
                    {
                        DeleteCommand.Dispose();
                        DeleteCommand = null;
                    }
                }

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////
            }
        }
        finally
        {
            base.Dispose(disposing);

            //
            // NOTE: Everything should be fully disposed at this point.
            //
            disposed = true;
        }
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Row updating event handler
    /// </summary>
    public event EventHandler<RowUpdatingEventArgs> RowUpdating
    {
      add
      {
        CheckDisposed();

#if !PLATFORM_COMPACTFRAMEWORK
        EventHandler<RowUpdatingEventArgs> previous = (EventHandler<RowUpdatingEventArgs>)base.Events[_updatingEventPH];
        if ((previous != null) && (value.Target is DbCommandBuilder))
        {
          EventHandler<RowUpdatingEventArgs> handler = (EventHandler<RowUpdatingEventArgs>)FindBuilder(previous);
          if (handler != null)
          {
            base.Events.RemoveHandler(_updatingEventPH, handler);
          }
        }
#endif
        base.Events.AddHandler(_updatingEventPH, value); 
      }
      remove { CheckDisposed(); base.Events.RemoveHandler(_updatingEventPH, value); }
    }

#if !PLATFORM_COMPACTFRAMEWORK
    internal static Delegate FindBuilder(MulticastDelegate mcd)
    {
      if (mcd != null)
      {
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#endif

    /// <summary>
    /// Row updated event handler
    /// </summary>
    public event EventHandler<RowUpdatedEventArgs> RowUpdated
    {
      add { base.Events.AddHandler(_updatedEventPH, value); }
      remove { base.Events.RemoveHandler(_updatedEventPH, value); }
    }

    /// <summary>
    /// Raised by the underlying DbDataAdapter when a row is being updated
    /// </summary>
    /// <param name="value">The event's specifics</param>
    protected override void OnRowUpdating(RowUpdatingEventArgs value)







|
|







245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
#endif

    /// <summary>
    /// Row updated event handler
    /// </summary>
    public event EventHandler<RowUpdatedEventArgs> RowUpdated
    {
      add { CheckDisposed(); base.Events.AddHandler(_updatedEventPH, value); }
      remove { CheckDisposed(); base.Events.RemoveHandler(_updatedEventPH, value); }
    }

    /// <summary>
    /// Raised by the underlying DbDataAdapter when a row is being updated
    /// </summary>
    /// <param name="value">The event's specifics</param>
    protected override void OnRowUpdating(RowUpdatingEventArgs value)
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
    /// Gets/sets the select command for this DataAdapter
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
    public new SQLiteCommand SelectCommand
    {
      get { return (SQLiteCommand)base.SelectCommand; }
      set { base.SelectCommand = value; }
    }

    /// <summary>
    /// Gets/sets the insert command for this DataAdapter
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
    public new SQLiteCommand InsertCommand
    {
      get { return (SQLiteCommand)base.InsertCommand; }
      set { base.InsertCommand = value; }
    }

    /// <summary>
    /// Gets/sets the update command for this DataAdapter
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
    public new SQLiteCommand UpdateCommand
    {
      get { return (SQLiteCommand)base.UpdateCommand; }
      set { base.UpdateCommand = value; }
    }

    /// <summary>
    /// Gets/sets the delete command for this DataAdapter
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
    public new SQLiteCommand DeleteCommand
    {
      get { return (SQLiteCommand)base.DeleteCommand; }
      set { base.DeleteCommand = value; }
    }
  }
}







|
|










|
|










|
|










|
|



281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
    /// Gets/sets the select command for this DataAdapter
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
    public new SQLiteCommand SelectCommand
    {
      get { CheckDisposed(); return (SQLiteCommand)base.SelectCommand; }
      set { CheckDisposed(); base.SelectCommand = value; }
    }

    /// <summary>
    /// Gets/sets the insert command for this DataAdapter
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
    public new SQLiteCommand InsertCommand
    {
      get { CheckDisposed(); return (SQLiteCommand)base.InsertCommand; }
      set { CheckDisposed(); base.InsertCommand = value; }
    }

    /// <summary>
    /// Gets/sets the update command for this DataAdapter
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
    public new SQLiteCommand UpdateCommand
    {
      get { CheckDisposed(); return (SQLiteCommand)base.UpdateCommand; }
      set { CheckDisposed(); base.UpdateCommand = value; }
    }

    /// <summary>
    /// Gets/sets the delete command for this DataAdapter
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue((string)null), Editor("Microsoft.VSDesigner.Data.Design.DBCommandEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#endif
    public new SQLiteCommand DeleteCommand
    {
      get { CheckDisposed(); return (SQLiteCommand)base.DeleteCommand; }
      set { CheckDisposed(); base.DeleteCommand = value; }
    }
  }
}

Changes to System.Data.SQLite/SQLiteDataReader.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25




26
27
28
29
30
31
32
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Data;
  using System.Data.Common;
  using System.Collections.Generic;
  using System.Globalization;
  using System.Reflection;

  /// <summary>
  /// SQLite implementation of DbDataReader.
  /// </summary>
  public sealed class SQLiteDataReader : DbDataReader
  {
    /// <summary>
    /// Underlying command this reader is attached to
    /// </summary>
    private SQLiteCommand _command;




    /// <summary>
    /// Index of the current statement in the command being processed
    /// </summary>
    private int _activeStatementIndex;
    /// <summary>
    /// Current statement being Read()
    /// </summary>



|






|
|
|
|
|










>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Collections.Generic;
  using System.Collections.Specialized;
  using System.Data;
  using System.Data.Common;
  using System.Globalization;

  /// <summary>
  /// SQLite implementation of DbDataReader.
  /// </summary>
  public sealed class SQLiteDataReader : DbDataReader
  {
    /// <summary>
    /// Underlying command this reader is attached to
    /// </summary>
    private SQLiteCommand _command;
    /// <summary>
    /// The flags pertaining to the associated connection (via the command).
    /// </summary>
    private SQLiteConnectionFlags _flags;
    /// <summary>
    /// Index of the current statement in the command being processed
    /// </summary>
    private int _activeStatementIndex;
    /// <summary>
    /// Current statement being Read()
    /// </summary>
43
44
45
46
47
48
49









50
51
52
53
54
55
56
57
58
59
60
61
62
63
64





65
66
67
68
69

70









71
72
73
74
75
76
77
78

79
80

81
82
83
84
85






86
87
88






























































89
90
91
92
93
94
95
96
97
98
99








100
101
102
103
104
105
106
    /// Number of records affected by the insert/update statements executed on the command
    /// </summary>
    private int _rowsAffected;
    /// <summary>
    /// Count of fields (columns) in the row-returning statement currently being processed
    /// </summary>
    private int _fieldCount;









    /// <summary>
    /// Datatypes of active fields (columns) in the current statement, used for type-restricting data
    /// </summary>
    private SQLiteType[] _fieldTypeArray;

    /// <summary>
    /// The behavior of the datareader
    /// </summary>
    private CommandBehavior _commandBehavior;

    /// <summary>
    /// If set, then dispose of the command object when the reader is finished
    /// </summary>
    internal bool _disposeCommand;






    /// <summary>
    /// An array of rowid's for the active statement if CommandBehavior.KeyInfo is specified
    /// </summary>
    private SQLiteKeyReader _keyInfo;


    internal long _version; // Matches the version of the connection










    /// <summary>
    /// Internal constructor, initializes the datareader and sets up to begin executing statements
    /// </summary>
    /// <param name="cmd">The SQLiteCommand this data reader is for</param>
    /// <param name="behave">The expected behavior of the data reader</param>
    internal SQLiteDataReader(SQLiteCommand cmd, CommandBehavior behave)
    {

      _command = cmd;
      _version = _command.Connection._version;


      _commandBehavior = behave;
      _activeStatementIndex = -1;
      _rowsAffected = -1;







      if (_command != null)
        NextResult();
    }































































    internal void Cancel()
    {
      _version = 0;
    }

    /// <summary>
    /// Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified.
    /// </summary>
    public override void Close()
    {








      try
      {
        if (_command != null)
        {
          try
          {
            try







>
>
>
>
>
>
>
>
>















>
>
>
>
>





>
|
>
>
>
>
>
>
>
>
>








>


>





>
>
>
>
>
>

|

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











>
>
>
>
>
>
>
>







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
    /// Number of records affected by the insert/update statements executed on the command
    /// </summary>
    private int _rowsAffected;
    /// <summary>
    /// Count of fields (columns) in the row-returning statement currently being processed
    /// </summary>
    private int _fieldCount;
    /// <summary>
    /// The number of calls to Step() that have returned true (i.e. the number of rows that
    /// have been read in the current result set).
    /// </summary>
    private int _stepCount;
    /// <summary>
    /// Maps the field (column) names to their corresponding indexes within the results.
    /// </summary>
    private Dictionary<string, int> _fieldIndexes;
    /// <summary>
    /// Datatypes of active fields (columns) in the current statement, used for type-restricting data
    /// </summary>
    private SQLiteType[] _fieldTypeArray;

    /// <summary>
    /// The behavior of the datareader
    /// </summary>
    private CommandBehavior _commandBehavior;

    /// <summary>
    /// If set, then dispose of the command object when the reader is finished
    /// </summary>
    internal bool _disposeCommand;

    /// <summary>
    /// If set, then raise an exception when the object is accessed after being disposed.
    /// </summary>
    internal bool _throwOnDisposed;

    /// <summary>
    /// An array of rowid's for the active statement if CommandBehavior.KeyInfo is specified
    /// </summary>
    private SQLiteKeyReader _keyInfo;

    /// <summary>
    /// Matches the version of the connection.
    /// </summary>
    internal int _version;

    /// <summary>
    /// The "stub" (i.e. placeholder) base schema name to use when returning
    /// column schema information.  Matches the base schema name used by the
    /// associated connection.
    /// </summary>
    private string _baseSchemaName;

    /// <summary>
    /// Internal constructor, initializes the datareader and sets up to begin executing statements
    /// </summary>
    /// <param name="cmd">The SQLiteCommand this data reader is for</param>
    /// <param name="behave">The expected behavior of the data reader</param>
    internal SQLiteDataReader(SQLiteCommand cmd, CommandBehavior behave)
    {
      _throwOnDisposed = true;
      _command = cmd;
      _version = _command.Connection._version;
      _baseSchemaName = _command.Connection._baseSchemaName;

      _commandBehavior = behave;
      _activeStatementIndex = -1;
      _rowsAffected = -1;

      RefreshFlags();

      SQLiteConnection.OnChanged(GetConnection(this),
          new ConnectionEventArgs(SQLiteConnectionEventType.NewDataReader,
          null, null, _command, this, null, null, new object[] { behave }));

      if (_command != null)
          NextResult();
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable "Pattern" Members
    private bool disposed;
    private void CheckDisposed() /* throw */
    {
#if THROW_ON_DISPOSED
        if (disposed && _throwOnDisposed)
            throw new ObjectDisposedException(typeof(SQLiteDataReader).Name);
#endif
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Dispose of all resources used by this datareader.
    /// </summary>
    /// <param name="disposing"></param>
    protected override void Dispose(bool disposing)
    {
        SQLiteConnection.OnChanged(GetConnection(this),
            new ConnectionEventArgs(SQLiteConnectionEventType.DisposingDataReader,
            null, null, _command, this, null, null, new object[] { disposing,
            disposed, _commandBehavior, _readingState, _rowsAffected, _stepCount,
            _fieldCount, _disposeCommand, _throwOnDisposed }));

        try
        {
            if (!disposed)
            {
                //if (disposing)
                //{
                //    ////////////////////////////////////
                //    // dispose managed resources here...
                //    ////////////////////////////////////
                //}

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////

                //
                // NOTE: Fix for ticket [e1b2e0f769], do NOT throw exceptions
                //       while we are being disposed.
                //
                _throwOnDisposed = false;
            }
        }
        finally
        {
            base.Dispose(disposing);

            //
            // NOTE: Everything should be fully disposed at this point.
            //
            disposed = true;
        }
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    internal void Cancel()
    {
      _version = 0;
    }

    /// <summary>
    /// Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified.
    /// </summary>
    public override void Close()
    {
      CheckDisposed();

      SQLiteConnection.OnChanged(GetConnection(this),
          new ConnectionEventArgs(SQLiteConnectionEventType.ClosingDataReader,
          null, null, _command, this, null, null, new object[] { _commandBehavior,
          _readingState, _rowsAffected, _stepCount, _fieldCount, _disposeCommand,
          _throwOnDisposed }));

      try
      {
        if (_command != null)
        {
          try
          {
            try
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138

139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155



156
157
158
159
160
161


162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180

181
182
183
184
185
186
187
188
189
190

191
192
193
194
195
196
197
198
199
200
201
202

203

204
205
206
207
208
209
210
211






























212
213
214
215
216
217

218
219
220









221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238

239
240
241
242
243
244
245
246
247
248
249


250
251
252

253
254
255
256
257

258
259
260
261
262
263
264
265
266
267
268
269
270
271
272

273
274
275
276






































































































































277
278
279
280
281
282
283
284
285




















286
287
288
289
290
291
292
293
294
295
296
297
298
299




















300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320







































321
322
323
324
325
326
327
328
329
330
331
332
333
334




















335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355







































356
357
358

359

360
361
362
363
364
365
366
367
368
369


370
371
372
373
374
375
376
377
378
379
380
381
382
383
384




















385
386
387
388
389
390
391
392
393
394
395
396
397
398




















399
400
401
402






403
404
405
406
407
408
409
410
411
412




















413
414
415
416
417
418
419
420





















421
422
423
424
425
426


427
428
429
430
431
432
433
434
435
436
437
438
439




















440
441
442
443
444
445
446
447
448
449
450
451
452
453




















454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474




















475
476
477
478
479
480
481
482
483
484
485
486
487
488




















489
490
491
492
493
494
495
496
497
498
499
500
501
502




















503
504
505
506
507
508
509
510
511
512
513
514
515
516


517
518
519
520













































521
522
523
524
525
526
527
528
529
530






















531

532
533
534
535









536
537
538
539
540
541
542
543
544
545
546
547

548
549
































































































































































550
551
552
553

554




















555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594


595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614

615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631

















632
633
634
635
636
637
638
639
640
641
642

643
644
645

646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709

710
711
712
713
714
715
716
717
718
719
720
721
722
723
724






725
726
727
728
729
730
731
732
733
734
735

736

737
738
739
740
741
742
743
744

745
746
747
748
749
750
751
752
753

754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772















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
800
801


802
803
804
805
806
807
808
809
810
811































812
813
814
815
816
817
818
819

820





















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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
                  {
                  }
                }
                catch(SQLiteException)
                {
                }
              }
              _command.ClearDataReader();
            }
            finally
            {
              // If the datareader's behavior includes closing the connection, then do so here.
              if ((_commandBehavior & CommandBehavior.CloseConnection) != 0 && _command.Connection != null)
                _command.Connection.Close();
            }
          }
          finally
          {
            if (_disposeCommand)
              _command.Dispose();
          }
        }

        _command = null;
        _activeStatement = null;

        _fieldTypeArray = null;
      }
      finally
      {
        if (_keyInfo != null)
        {
          _keyInfo.Dispose();
          _keyInfo = null;
        }
      }
    }

    /// <summary>
    /// Throw an error if the datareader is closed
    /// </summary>
    private void CheckClosed()
    {



      if (_command == null)
        throw new InvalidOperationException("DataReader has been closed");

      if (_version == 0)
        throw new SQLiteException((int)SQLiteErrorCode.Abort, "Execution was aborted by the user");



      if (_command.Connection.State != ConnectionState.Open || _command.Connection._version != _version)
        throw new InvalidOperationException("Connection was closed, statement was terminated");
    }

    /// <summary>
    /// Throw an error if a row is not loaded
    /// </summary>
    private void CheckValidRow()
    {
      if (_readingState != 0)
        throw new InvalidOperationException("No current row");
    }

    /// <summary>
    /// Enumerator support
    /// </summary>
    /// <returns>Returns a DbEnumerator object.</returns>
    public override Collections.IEnumerator GetEnumerator()
    {

      return new DbEnumerator(this, ((_commandBehavior & CommandBehavior.CloseConnection) == CommandBehavior.CloseConnection));
    }

    /// <summary>
    /// Not implemented.  Returns 0
    /// </summary>
    public override int Depth
    {
      get
      {

        CheckClosed();
        return 0;
      }
    }

    /// <summary>
    /// Returns the number of columns in the current resultset
    /// </summary>
    public override int FieldCount
    {
      get
      {

        CheckClosed();

        if (_keyInfo == null)
          return _fieldCount;

        return _fieldCount + _keyInfo.Count;
      }
    }

    /// <summary>






























    /// Returns the number of visible fielsd in the current resultset
    /// </summary>
    public override int VisibleFieldCount
    {
      get
      {

        CheckClosed();
        return _fieldCount;
      }









    }

    /// <summary>
    /// SQLite is inherently un-typed.  All datatypes in SQLite are natively strings.  The definition of the columns of a table
    /// and the affinity of returned types are all we have to go on to type-restrict data in the reader.
    /// 
    /// This function attempts to verify that the type of data being requested of a column matches the datatype of the column.  In
    /// the case of columns that are not backed into a table definition, we attempt to match up the affinity of a column (int, double, string or blob)
    /// to a set of known types that closely match that affinity.  It's not an exact science, but its the best we can do.
    /// </summary>
    /// <returns>
    /// This function throws an InvalidTypeCast() exception if the requested type doesn't match the column's definition or affinity.
    /// </returns>
    /// <param name="i">The index of the column to type-check</param>
    /// <param name="typ">The type we want to get out of the column</param>
    private TypeAffinity VerifyType(int i, DbType typ)
    {
      CheckClosed();

      CheckValidRow();
      TypeAffinity affinity = GetSQLiteType(i).Affinity;

      switch (affinity)
      {
        case TypeAffinity.Int64:
          if (typ == DbType.Int16) return affinity;
          if (typ == DbType.Int32) return affinity;
          if (typ == DbType.Int64) return affinity;
          if (typ == DbType.Boolean) return affinity;
          if (typ == DbType.Byte) return affinity;


          if (typ == DbType.DateTime) return affinity;
          if (typ == DbType.Single) return affinity;
          if (typ == DbType.Double) return affinity;

          if (typ == DbType.Decimal) return affinity;
          break;
        case TypeAffinity.Double:
          if (typ == DbType.Single) return affinity;
          if (typ == DbType.Double) return affinity;

          if (typ == DbType.Decimal) return affinity;
          if (typ == DbType.DateTime) return affinity;
          break;
        case TypeAffinity.Text:
          if (typ == DbType.SByte) return affinity;
          if (typ == DbType.String) return affinity;
          if (typ == DbType.SByte) return affinity;
          if (typ == DbType.Guid) return affinity;
          if (typ == DbType.DateTime) return affinity;
          if (typ == DbType.Decimal) return affinity;
          break;
        case TypeAffinity.Blob:
          if (typ == DbType.Guid) return affinity;
          if (typ == DbType.String) return affinity;
          if (typ == DbType.Binary) return affinity;

          break;
      }

      throw new InvalidCastException();






































































































































    }

    /// <summary>
    /// Retrieves the column as a boolean value
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>bool</returns>
    public override bool GetBoolean(int i)
    {




















      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetBoolean(i - VisibleFieldCount);

      VerifyType(i, DbType.Boolean);
      return Convert.ToBoolean(GetValue(i), CultureInfo.CurrentCulture);
    }

    /// <summary>
    /// Retrieves the column as a single byte value
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>byte</returns>
    public override byte GetByte(int i)
    {




















      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetByte(i - VisibleFieldCount);

      VerifyType(i, DbType.Byte);
      return Convert.ToByte(_activeStatement._sql.GetInt32(_activeStatement, i));
    }

    /// <summary>
    /// Retrieves a column as an array of bytes (blob)
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <param name="fieldOffset">The zero-based index of where to begin reading the data</param>
    /// <param name="buffer">The buffer to write the bytes into</param>
    /// <param name="bufferoffset">The zero-based index of where to begin writing into the array</param>
    /// <param name="length">The number of bytes to retrieve</param>
    /// <returns>The actual number of bytes written into the array</returns>
    /// <remarks>
    /// To determine the number of bytes in the column, pass a null value for the buffer.  The total length will be returned.
    /// </remarks>
    public override long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)
    {







































      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetBytes(i - VisibleFieldCount, fieldOffset, buffer, bufferoffset, length);

      VerifyType(i, DbType.Binary);
      return _activeStatement._sql.GetBytes(_activeStatement, i, (int)fieldOffset, buffer, bufferoffset, length);
    }

    /// <summary>
    /// Returns the column as a single character
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>char</returns>
    public override char GetChar(int i)
    {




















      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetChar(i - VisibleFieldCount);

      VerifyType(i, DbType.SByte);
      return Convert.ToChar(_activeStatement._sql.GetInt32(_activeStatement, i));
    }

    /// <summary>
    /// Retrieves a column as an array of chars (blob)
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <param name="fieldoffset">The zero-based index of where to begin reading the data</param>
    /// <param name="buffer">The buffer to write the characters into</param>
    /// <param name="bufferoffset">The zero-based index of where to begin writing into the array</param>
    /// <param name="length">The number of bytes to retrieve</param>
    /// <returns>The actual number of characters written into the array</returns>
    /// <remarks>
    /// To determine the number of characters in the column, pass a null value for the buffer.  The total length will be returned.
    /// </remarks>
    public override long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length)
    {







































      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetChars(i - VisibleFieldCount, fieldoffset, buffer, bufferoffset, length);


      VerifyType(i, DbType.String);

      return _activeStatement._sql.GetChars(_activeStatement, i, (int)fieldoffset, buffer, bufferoffset, length);
    }

    /// <summary>
    /// Retrieves the name of the back-end datatype of the column
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>string</returns>
    public override string GetDataTypeName(int i)
    {


      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetDataTypeName(i - VisibleFieldCount);

      SQLiteType typ = GetSQLiteType(i);
      if (typ.Type == DbType.Object) return SQLiteConvert.SQLiteTypeToType(typ).Name;
      return _activeStatement._sql.ColumnType(_activeStatement, i, out typ.Affinity);
    }

    /// <summary>
    /// Retrieve the column as a date/time value
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>DateTime</returns>
    public override DateTime GetDateTime(int i)
    {




















      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetDateTime(i - VisibleFieldCount);

      VerifyType(i, DbType.DateTime);
      return _activeStatement._sql.GetDateTime(_activeStatement, i);
    }

    /// <summary>
    /// Retrieve the column as a decimal value
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>decimal</returns>
    public override decimal GetDecimal(int i)
    {




















      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetDecimal(i - VisibleFieldCount);

      VerifyType(i, DbType.Decimal);






      return Decimal.Parse(_activeStatement._sql.GetText(_activeStatement, i), NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent | NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture);
    }

    /// <summary>
    /// Returns the column as a double
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>double</returns>
    public override double GetDouble(int i)
    {




















      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetDouble(i - VisibleFieldCount);

      VerifyType(i, DbType.Double);
      return _activeStatement._sql.GetDouble(_activeStatement, i);
    }

    /// <summary>





















    /// Returns the .NET type of a given column
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>Type</returns>
    public override Type GetFieldType(int i)
    {


      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetFieldType(i - VisibleFieldCount);

      return SQLiteConvert.SQLiteTypeToType(GetSQLiteType(i));
    }

    /// <summary>
    /// Returns a column as a float value
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>float</returns>
    public override float GetFloat(int i)
    {




















      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetFloat(i - VisibleFieldCount);

      VerifyType(i, DbType.Single);
      return Convert.ToSingle(_activeStatement._sql.GetDouble(_activeStatement, i));
    }

    /// <summary>
    /// Returns the column as a Guid
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>Guid</returns>
    public override Guid GetGuid(int i)
    {




















      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetGuid(i - VisibleFieldCount);

      TypeAffinity affinity = VerifyType(i, DbType.Guid);
      if (affinity == TypeAffinity.Blob)
      {
        byte[] buffer = new byte[16];
        _activeStatement._sql.GetBytes(_activeStatement, i, 0, buffer, 0, 16);
        return new Guid(buffer);
      }
      else
        return new Guid(_activeStatement._sql.GetText(_activeStatement, i));
    }

    /// <summary>
    /// Returns the column as a short
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>Int16</returns>
    public override Int16 GetInt16(int i)
    {




















      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetInt16(i - VisibleFieldCount);

      VerifyType(i, DbType.Int16);
      return Convert.ToInt16(_activeStatement._sql.GetInt32(_activeStatement, i));
    }

    /// <summary>
    /// Retrieves the column as an int
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>Int32</returns>
    public override Int32 GetInt32(int i)
    {




















      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetInt32(i - VisibleFieldCount);

      VerifyType(i, DbType.Int32);
      return _activeStatement._sql.GetInt32(_activeStatement, i);
    }

    /// <summary>
    /// Retrieves the column as a long
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>Int64</returns>
    public override Int64 GetInt64(int i)
    {




















      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetInt64(i - VisibleFieldCount);

      VerifyType(i, DbType.Int64);
      return _activeStatement._sql.GetInt64(_activeStatement, i);
    }

    /// <summary>
    /// Retrieves the name of the column
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>string</returns>
    public override string GetName(int i)
    {


      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetName(i - VisibleFieldCount);

      return _activeStatement._sql.ColumnName(_activeStatement, i);













































    }

    /// <summary>
    /// Retrieves the i of a column, given its name
    /// </summary>
    /// <param name="name">The name of the column to retrieve</param>
    /// <returns>The int i of the column</returns>
    public override int GetOrdinal(string name)
    {
      CheckClosed();






















      int r = _activeStatement._sql.ColumnIndex(_activeStatement, name);

      if (r == -1 && _keyInfo != null)
      {
        r = _keyInfo.GetOrdinal(name);
        if (r > -1) r += VisibleFieldCount;









      }

      return r;
    }

    /// <summary>
    /// Schema information in SQLite is difficult to map into .NET conventions, so a lot of work must be done
    /// to gather the necessary information so it can be represented in an ADO.NET manner.
    /// </summary>
    /// <returns>Returns a DataTable containing the schema information for the active SELECT statement being processed.</returns>
    public override DataTable GetSchemaTable()
    {

      return GetSchemaTable(true, false);
    }

































































































































































    internal DataTable GetSchemaTable(bool wantUniqueInfo, bool wantDefaultValue)
    {
      CheckClosed();






















      DataTable tbl = new DataTable("SchemaTable");
      DataTable tblIndexes = null;
      DataTable tblIndexColumns;
      DataRow row;
      string temp;
      string strCatalog = "";
      string strTable = "";
      string strColumn = "";

      tbl.Locale = CultureInfo.InvariantCulture;
      tbl.Columns.Add(SchemaTableColumn.ColumnName, typeof(String));
      tbl.Columns.Add(SchemaTableColumn.ColumnOrdinal, typeof(int));
      tbl.Columns.Add(SchemaTableColumn.ColumnSize, typeof(int));
      tbl.Columns.Add(SchemaTableColumn.NumericPrecision, typeof(short));
      tbl.Columns.Add(SchemaTableColumn.NumericScale, typeof(short));
      tbl.Columns.Add(SchemaTableColumn.IsUnique, typeof(Boolean));
      tbl.Columns.Add(SchemaTableColumn.IsKey, typeof(Boolean));
      tbl.Columns.Add(SchemaTableOptionalColumn.BaseServerName, typeof(string));
      tbl.Columns.Add(SchemaTableOptionalColumn.BaseCatalogName, typeof(String));
      tbl.Columns.Add(SchemaTableColumn.BaseColumnName, typeof(String));
      tbl.Columns.Add(SchemaTableColumn.BaseSchemaName, typeof(String));
      tbl.Columns.Add(SchemaTableColumn.BaseTableName, typeof(String));
      tbl.Columns.Add(SchemaTableColumn.DataType, typeof(Type));
      tbl.Columns.Add(SchemaTableColumn.AllowDBNull, typeof(Boolean));
      tbl.Columns.Add(SchemaTableColumn.ProviderType, typeof(int));
      tbl.Columns.Add(SchemaTableColumn.IsAliased, typeof(Boolean));
      tbl.Columns.Add(SchemaTableColumn.IsExpression, typeof(Boolean));
      tbl.Columns.Add(SchemaTableOptionalColumn.IsAutoIncrement, typeof(Boolean));
      tbl.Columns.Add(SchemaTableOptionalColumn.IsRowVersion, typeof(Boolean));
      tbl.Columns.Add(SchemaTableOptionalColumn.IsHidden, typeof(Boolean));
      tbl.Columns.Add(SchemaTableColumn.IsLong, typeof(Boolean));
      tbl.Columns.Add(SchemaTableOptionalColumn.IsReadOnly, typeof(Boolean));
      tbl.Columns.Add(SchemaTableOptionalColumn.ProviderSpecificDataType, typeof(Type));
      tbl.Columns.Add(SchemaTableOptionalColumn.DefaultValue, typeof(object));
      tbl.Columns.Add("DataTypeName", typeof(string));
      tbl.Columns.Add("CollationType", typeof(string));
      tbl.BeginLoadData();

      for (int n = 0; n < _fieldCount; n++)
      {


        row = tbl.NewRow();

        DbType typ = GetSQLiteType(n).Type;

        // Default settings for the column
        row[SchemaTableColumn.ColumnName] = GetName(n);
        row[SchemaTableColumn.ColumnOrdinal] = n;
        row[SchemaTableColumn.ColumnSize] = SQLiteConvert.DbTypeToColumnSize(typ);
        row[SchemaTableColumn.NumericPrecision] = SQLiteConvert.DbTypeToNumericPrecision(typ);
        row[SchemaTableColumn.NumericScale] = SQLiteConvert.DbTypeToNumericScale(typ);
        row[SchemaTableColumn.ProviderType] = GetSQLiteType(n).Type;
        row[SchemaTableColumn.IsLong] = false;
        row[SchemaTableColumn.AllowDBNull] = true;
        row[SchemaTableOptionalColumn.IsReadOnly] = false;
        row[SchemaTableOptionalColumn.IsRowVersion] = false;
        row[SchemaTableColumn.IsUnique] = false;
        row[SchemaTableColumn.IsKey] = false;
        row[SchemaTableOptionalColumn.IsAutoIncrement] = false;
        row[SchemaTableColumn.DataType] = GetFieldType(n);
        row[SchemaTableOptionalColumn.IsHidden] = false;


        strColumn = _command.Connection._sql.ColumnOriginalName(_activeStatement, n);
        if (String.IsNullOrEmpty(strColumn) == false) row[SchemaTableColumn.BaseColumnName] = strColumn;

        row[SchemaTableColumn.IsExpression] = String.IsNullOrEmpty(strColumn);
        row[SchemaTableColumn.IsAliased] = (String.Compare(GetName(n), strColumn, StringComparison.OrdinalIgnoreCase) != 0);

        temp = _command.Connection._sql.ColumnTableName(_activeStatement, n);
        if (String.IsNullOrEmpty(temp) == false) row[SchemaTableColumn.BaseTableName] = temp;

        temp = _command.Connection._sql.ColumnDatabaseName(_activeStatement, n);
        if (String.IsNullOrEmpty(temp) == false) row[SchemaTableOptionalColumn.BaseCatalogName] = temp;

        string dataType = null;
        // If we have a table-bound column, extract the extra information from it
        if (String.IsNullOrEmpty(strColumn) == false)
        {

















          string collSeq;
          bool bNotNull;
          bool bPrimaryKey;
          bool bAutoIncrement;
          string[] arSize;

          // Get the column meta data
          _command.Connection._sql.ColumnMetaData(
            (string)row[SchemaTableOptionalColumn.BaseCatalogName],
            (string)row[SchemaTableColumn.BaseTableName],
            strColumn,

            out dataType, out collSeq, out bNotNull, out bPrimaryKey, out bAutoIncrement);

          if (bNotNull || bPrimaryKey) row[SchemaTableColumn.AllowDBNull] = false;


          row[SchemaTableColumn.IsKey] = bPrimaryKey;
          row[SchemaTableOptionalColumn.IsAutoIncrement] = bAutoIncrement;
          row["CollationType"] = collSeq;

          // For types like varchar(50) and such, extract the size
          arSize = dataType.Split('(');
          if (arSize.Length > 1)
          {
            dataType = arSize[0];
            arSize = arSize[1].Split(')');
            if (arSize.Length > 1)
            {
              arSize = arSize[0].Split(',', '.');
              if (GetSQLiteType(n).Type == DbType.String || GetSQLiteType(n).Type == DbType.Binary)
              {
                row[SchemaTableColumn.ColumnSize] = Convert.ToInt32(arSize[0], CultureInfo.InvariantCulture);
              }
              else
              {
                row[SchemaTableColumn.NumericPrecision] = Convert.ToInt32(arSize[0], CultureInfo.InvariantCulture);
                if (arSize.Length > 1)
                  row[SchemaTableColumn.NumericScale] = Convert.ToInt32(arSize[1], CultureInfo.InvariantCulture);
              }
            }
          }

          if (wantDefaultValue)
          {
            // Determine the default value for the column, which sucks because we have to query the schema for each column
            using (SQLiteCommand cmdTable = new SQLiteCommand(String.Format(CultureInfo.InvariantCulture, "PRAGMA [{0}].TABLE_INFO([{1}])",
              row[SchemaTableOptionalColumn.BaseCatalogName],
              row[SchemaTableColumn.BaseTableName]
              ), _command.Connection))
            using (DbDataReader rdTable = cmdTable.ExecuteReader())
            {
              // Find the matching column
              while (rdTable.Read())
              {
                if (String.Compare((string)row[SchemaTableColumn.BaseColumnName], rdTable.GetString(1), StringComparison.OrdinalIgnoreCase) == 0)
                {
                  if (rdTable.IsDBNull(4) == false)
                    row[SchemaTableOptionalColumn.DefaultValue] = rdTable[4];

                  break;
                }
              }
            }
          }

          // Determine IsUnique properly, which is a pain in the butt!
          if (wantUniqueInfo)
          {
            if ((string)row[SchemaTableOptionalColumn.BaseCatalogName] != strCatalog
              || (string)row[SchemaTableColumn.BaseTableName] != strTable)
            {
              strCatalog = (string)row[SchemaTableOptionalColumn.BaseCatalogName];
              strTable = (string)row[SchemaTableColumn.BaseTableName];

              tblIndexes = _command.Connection.GetSchema("Indexes", new string[] {
                (string)row[SchemaTableOptionalColumn.BaseCatalogName],
                null,
                (string)row[SchemaTableColumn.BaseTableName],
                null });

            }

            foreach (DataRow rowIndexes in tblIndexes.Rows)
            {
              tblIndexColumns = _command.Connection.GetSchema("IndexColumns", new string[] {
                (string)row[SchemaTableOptionalColumn.BaseCatalogName],
                null,
                (string)row[SchemaTableColumn.BaseTableName],
                (string)rowIndexes["INDEX_NAME"],
                null
                });
              foreach (DataRow rowColumnIndex in tblIndexColumns.Rows)
              {
                if (String.Compare((string)rowColumnIndex["COLUMN_NAME"], strColumn, StringComparison.OrdinalIgnoreCase) == 0)
                {






                  if (tblIndexColumns.Rows.Count == 1 && (bool)row[SchemaTableColumn.AllowDBNull] == false)
                    row[SchemaTableColumn.IsUnique] = rowIndexes["UNIQUE"];

                  // If its an integer primary key and the only primary key in the table, then its a rowid alias and is autoincrement
                  // NOTE:  Currently commented out because this is not always the desired behavior.  For example, a 1:1 relationship with
                  //        another table, where the other table is autoincrement, but this one is not, and uses the rowid from the other.
                  //        It is safer to only set Autoincrement on tables where we're SURE the user specified AUTOINCREMENT, even if its a rowid column.

                  if (tblIndexColumns.Rows.Count == 1 && (bool)rowIndexes["PRIMARY_KEY"] == true && String.IsNullOrEmpty(dataType) == false &&
                    String.Compare(dataType, "integer", StringComparison.OrdinalIgnoreCase) == 0)
                  {

                    //  row[SchemaTableOptionalColumn.IsAutoIncrement] = true;

                  }

                  break;
                }
              }
            }
          }


          if (String.IsNullOrEmpty(dataType))
          {
            TypeAffinity affin;
            dataType = _activeStatement._sql.ColumnType(_activeStatement, n, out affin);
          }

          if (String.IsNullOrEmpty(dataType) == false)
            row["DataTypeName"] = dataType;
        }

        tbl.Rows.Add(row);
      }

      if (_keyInfo != null)
        _keyInfo.AppendSchemaTable(tbl);

      tbl.AcceptChanges();
      tbl.EndLoadData();

      return tbl;
    }

    /// <summary>
    /// Retrieves the column as a string
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>string</returns>
    public override string GetString(int i)
    {















      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetString(i - VisibleFieldCount);


      VerifyType(i, DbType.String);

      return _activeStatement._sql.GetText(_activeStatement, i);
    }

    /// <summary>
    /// Retrieves the column as an object corresponding to the underlying datatype of the column
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>object</returns>
    public override object GetValue(int i)
    {















      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.GetValue(i - VisibleFieldCount);

      SQLiteType typ = GetSQLiteType(i);
















      return _activeStatement._sql.GetValue(_activeStatement, i, typ);
    }

    /// <summary>
    /// Retreives the values of multiple columns, up to the size of the supplied array
    /// </summary>
    /// <param name="values">The array to fill with values from the columns in the current resultset</param>
    /// <returns>The number of columns retrieved</returns>
    public override int GetValues(object[] values)
    {


      int nMax = FieldCount;
      if (values.Length < nMax) nMax = values.Length;

      for (int n = 0; n < nMax; n++)
      {
        values[n] = GetValue(n);
      }

      return nMax;
    }
































    /// <summary>
    /// Returns True if the resultset has rows that can be fetched
    /// </summary>
    public override bool HasRows
    {
      get
      {

        CheckClosed();





















        return (_readingState != 1);
      }
    }

    /// <summary>
    /// Returns True if the data reader is closed
    /// </summary>
    public override bool IsClosed
    {
      get { return (_command == null); }
    }

    /// <summary>
    /// Returns True if the specified column is null
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>True or False</returns>
    public override bool IsDBNull(int i)
    {



      if (i >= VisibleFieldCount && _keyInfo != null)
        return _keyInfo.IsDBNull(i - VisibleFieldCount);

      return _activeStatement._sql.IsNull(_activeStatement, i);



















































    }

    /// <summary>
    /// Moves to the next resultset in multiple row-returning SQL command.
    /// </summary>
    /// <returns>True if the command was successful and a new resultset is available, False otherwise.</returns>
    public override bool NextResult()
    {

      CheckClosed();


      SQLiteStatement stmt = null;
      int fieldCount;


      while (true)
      {
        if (_activeStatement != null && stmt == null)
        {
          // Reset the previously-executed statement
          _activeStatement._sql.Reset(_activeStatement);

          // If we're only supposed to return a single rowset, step through all remaining statements once until
          // they are all done and return false to indicate no more resultsets exist.
          if ((_commandBehavior & CommandBehavior.SingleResult) != 0)
          {
            for (; ; )
            {
              stmt = _command.GetStatement(_activeStatementIndex + 1);
              if (stmt == null) break;
              _activeStatementIndex++;

              stmt._sql.Step(stmt);
              if (stmt._sql.ColumnCount(stmt) == 0)
              {
                if (_rowsAffected == -1) _rowsAffected = 0;
                _rowsAffected += stmt._sql.Changes;
              }
              stmt._sql.Reset(stmt); // Gotta reset after every step to release any locks and such!
            }
            return false;
          }
        }

        // Get the next statement to execute
        stmt = _command.GetStatement(_activeStatementIndex + 1);







|

















>

















>
>
>




|

>
>
|


















>










>












>

>








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





>

|

>
>
>
>
>
>
>
>
>





|











|
>
|
|

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

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





|



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

|
|





|



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

|
|





|










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

|
|





|



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

|
|





|










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

>
|
>
|





|



>
>
|
|

|
<
|





|



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

|
|





|



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

|
>
>
>
>
>
>
|





|



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

|
|



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


|



>
>
|
|

|





|



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

|
|





|



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

|
|
|
|
|
|
|
|
|





|



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

|
|





|



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

|
|





|



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

|
|





|



>
>
|
|

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









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












>


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



|
>

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

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

|
|
>
>
|

|

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

|
|

|
|

|
|

|
|

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

|
|
|
|
|
>
|

|
>

|
|
|

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

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

|
|
|
|
|

|
|
|
|
<
|
|
|

|
|
|
|
|
>
|

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

|
|
|
|

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

|
|
|
>
|
|

|
|

|
|

|





|



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

>
|
>
|





|



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

|

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









>
>










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








>

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









|





|



>
>
>
|
|

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








>

>



>



|


|










|
<
<
<
<
<
<
|







220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404

405
406
407
408

409
410
411
412
413

414
415
416
417
418
419

420

421
422
423
424
425
426

427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805

806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602

1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643

1644
1645
1646
1647

1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943






1944
1945
1946
1947
1948
1949
1950
1951
                  {
                  }
                }
                catch(SQLiteException)
                {
                }
              }
              _command.ResetDataReader();
            }
            finally
            {
              // If the datareader's behavior includes closing the connection, then do so here.
              if ((_commandBehavior & CommandBehavior.CloseConnection) != 0 && _command.Connection != null)
                _command.Connection.Close();
            }
          }
          finally
          {
            if (_disposeCommand)
              _command.Dispose();
          }
        }

        _command = null;
        _activeStatement = null;
        _fieldIndexes = null;
        _fieldTypeArray = null;
      }
      finally
      {
        if (_keyInfo != null)
        {
          _keyInfo.Dispose();
          _keyInfo = null;
        }
      }
    }

    /// <summary>
    /// Throw an error if the datareader is closed
    /// </summary>
    private void CheckClosed()
    {
      if (!_throwOnDisposed)
        return;

      if (_command == null)
        throw new InvalidOperationException("DataReader has been closed");

      if (_version == 0)
        throw new SQLiteException("Execution was aborted by the user");

      SQLiteConnection connection = _command.Connection;

      if (connection._version != _version || connection.State != ConnectionState.Open)
        throw new InvalidOperationException("Connection was closed, statement was terminated");
    }

    /// <summary>
    /// Throw an error if a row is not loaded
    /// </summary>
    private void CheckValidRow()
    {
      if (_readingState != 0)
        throw new InvalidOperationException("No current row");
    }

    /// <summary>
    /// Enumerator support
    /// </summary>
    /// <returns>Returns a DbEnumerator object.</returns>
    public override Collections.IEnumerator GetEnumerator()
    {
      CheckDisposed();
      return new DbEnumerator(this, ((_commandBehavior & CommandBehavior.CloseConnection) == CommandBehavior.CloseConnection));
    }

    /// <summary>
    /// Not implemented.  Returns 0
    /// </summary>
    public override int Depth
    {
      get
      {
        CheckDisposed();
        CheckClosed();
        return 0;
      }
    }

    /// <summary>
    /// Returns the number of columns in the current resultset
    /// </summary>
    public override int FieldCount
    {
      get
      {
        CheckDisposed();
        CheckClosed();

        if (_keyInfo == null)
          return _fieldCount;

        return _fieldCount + _keyInfo.Count;
      }
    }

    /// <summary>
    /// Forces the connection flags cached by this data reader to be refreshed
    /// from the underlying connection.
    /// </summary>
    public void RefreshFlags()
    {
        CheckDisposed();

        _flags = SQLiteCommand.GetFlags(_command);
    }

    /// <summary>
    /// Returns the number of rows seen so far in the current result set.
    /// </summary>
    public int StepCount
    {
        get
        {
            CheckDisposed();
            CheckClosed();

            return _stepCount;
        }
    }

    private int PrivateVisibleFieldCount
    {
        get { return _fieldCount; }
    }

    /// <summary>
    /// Returns the number of visible fields in the current resultset
    /// </summary>
    public override int VisibleFieldCount
    {
      get
      {
        CheckDisposed();
        CheckClosed();
        return PrivateVisibleFieldCount;
      }
    }

    /// <summary>
    /// This method is used to make sure the result set is open and a row is currently available.
    /// </summary>
    private void VerifyForGet()
    {
        CheckClosed();
        CheckValidRow();
    }

    /// <summary>
    /// SQLite is inherently un-typed.  All datatypes in SQLite are natively strings.  The definition of the columns of a table
    /// and the affinity of returned types are all we have to go on to type-restrict data in the reader.
    ///
    /// This function attempts to verify that the type of data being requested of a column matches the datatype of the column.  In
    /// the case of columns that are not backed into a table definition, we attempt to match up the affinity of a column (int, double, string or blob)
    /// to a set of known types that closely match that affinity.  It's not an exact science, but its the best we can do.
    /// </summary>
    /// <returns>
    /// This function throws an InvalidTypeCast() exception if the requested type doesn't match the column's definition or affinity.
    /// </returns>
    /// <param name="i">The index of the column to type-check</param>
    /// <param name="typ">The type we want to get out of the column</param>
    private TypeAffinity VerifyType(int i, DbType typ)
    {
        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.NoVerifyTypeAffinity))
            return TypeAffinity.None;

        TypeAffinity affinity = GetSQLiteType(_flags, i).Affinity;

        switch (affinity)
        {
            case TypeAffinity.Int64:
                if (typ == DbType.Int64) return affinity;
                if (typ == DbType.Int32) return affinity;
                if (typ == DbType.Int16) return affinity;

                if (typ == DbType.Byte) return affinity;
                if (typ == DbType.SByte) return affinity;
                if (typ == DbType.Boolean) return affinity;
                if (typ == DbType.DateTime) return affinity;

                if (typ == DbType.Double) return affinity;
                if (typ == DbType.Single) return affinity;
                if (typ == DbType.Decimal) return affinity;
                break;
            case TypeAffinity.Double:

                if (typ == DbType.Double) return affinity;
                if (typ == DbType.Single) return affinity;
                if (typ == DbType.Decimal) return affinity;
                if (typ == DbType.DateTime) return affinity;
                break;
            case TypeAffinity.Text:

                if (typ == DbType.String) return affinity;

                if (typ == DbType.Guid) return affinity;
                if (typ == DbType.DateTime) return affinity;
                if (typ == DbType.Decimal) return affinity;
                break;
            case TypeAffinity.Blob:
                if (typ == DbType.Guid) return affinity;

                if (typ == DbType.Binary) return affinity;
                if (typ == DbType.String) return affinity;
                break;
        }

        throw new InvalidCastException();
    }

    /// <summary>
    /// Invokes the data reader value callback configured for the database
    /// type name associated with the specified column.  If no data reader
    /// value callback is available for the database type name, do nothing.
    /// </summary>
    /// <param name="index">
    /// The index of the column being read.
    /// </param>
    /// <param name="eventArgs">
    /// The extra event data to pass into the callback.
    /// </param>
    /// <param name="complete">
    /// Non-zero if the default handling for the data reader call should be
    /// skipped.  If this is set to non-zero and the necessary return value
    /// is unavailable or unsuitable, an exception will be thrown.
    /// </param>
    private void InvokeReadValueCallback(
        int index,
        SQLiteReadEventArgs eventArgs,
        out bool complete
        )
    {
        complete = false;
        SQLiteConnectionFlags oldFlags = _flags;
        _flags &= ~SQLiteConnectionFlags.UseConnectionReadValueCallbacks;

        try
        {
            string typeName = GetDataTypeName(index);

            if (typeName == null)
                return;

            SQLiteConnection connection = GetConnection(this);

            if (connection == null)
                return;

            SQLiteTypeCallbacks callbacks;

            if (!connection.TryGetTypeCallbacks(typeName, out callbacks) ||
                (callbacks == null))
            {
                return;
            }

            SQLiteReadValueCallback callback = callbacks.ReadValueCallback;

            if (callback == null)
                return;

            object userData = callbacks.ReadValueUserData;

            callback(
                _activeStatement._sql, this, oldFlags, eventArgs, typeName,
                index, userData, out complete); /* throw */
        }
        finally
        {
            _flags |= SQLiteConnectionFlags.UseConnectionReadValueCallbacks;
        }
    }

    /// <summary>
    /// Attempts to query the integer identifier for the current row.  This
    /// will not work for tables that were created WITHOUT ROWID -OR- if the
    /// query does not include the "rowid" column or one of its aliases -OR-
    /// if the <see cref="SQLiteDataReader" /> was not created with the
    /// <see cref="CommandBehavior.KeyInfo"/> flag.
    /// </summary>
    /// <param name="i">
    /// The index of the BLOB column.
    /// </param>
    /// <returns>
    /// The integer identifier for the current row -OR- null if it could not
    /// be determined.
    /// </returns>
    internal long? GetRowId(
        int i
        )
    {
        // CheckDisposed();
        VerifyForGet();

        if (_keyInfo == null)
            return null;

        string databaseName = GetDatabaseName(i);
        string tableName = GetTableName(i);
        int iRowId = _keyInfo.GetRowIdIndex(databaseName, tableName);

        if (iRowId != -1)
            return GetInt64(iRowId);

        return _keyInfo.GetRowId(databaseName, tableName);
    }

    /// <summary>
    /// Retrieves the column as a <see cref="SQLiteBlob" /> object.
    /// This will not work for tables that were created WITHOUT ROWID
    /// -OR- if the query does not include the "rowid" column or one
    /// of its aliases -OR- if the <see cref="SQLiteDataReader" /> was
    /// not created with the <see cref="CommandBehavior.KeyInfo" />
    /// flag.
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <param name="readOnly">
    /// Non-zero to open the blob object for read-only access.
    /// </param>
    /// <returns>A new <see cref="SQLiteBlob" /> object.</returns>
    public SQLiteBlob GetBlob(int i, bool readOnly)
    {
        CheckDisposed();
        VerifyForGet();

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks))
        {
            SQLiteDataReaderValue value = new SQLiteDataReaderValue();
            bool complete;

            InvokeReadValueCallback(i, new SQLiteReadValueEventArgs(
                "GetBlob", new SQLiteReadBlobEventArgs(readOnly), value),
                out complete);

            if (complete)
                return (SQLiteBlob)value.BlobValue;
        }

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetBlob(i - PrivateVisibleFieldCount, readOnly);

        return SQLiteBlob.Create(this, i, readOnly);
    }

    /// <summary>
    /// Retrieves the column as a boolean value
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>bool</returns>
    public override bool GetBoolean(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks))
        {
            SQLiteDataReaderValue value = new SQLiteDataReaderValue();
            bool complete;

            InvokeReadValueCallback(i, new SQLiteReadValueEventArgs(
                "GetBoolean", null, value), out complete);

            if (complete)
            {
                if (value.BooleanValue == null)
                    throw new SQLiteException("missing boolean return value");

                return (bool)value.BooleanValue;
            }
        }

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetBoolean(i - PrivateVisibleFieldCount);

        VerifyType(i, DbType.Boolean);
        return Convert.ToBoolean(GetValue(i), CultureInfo.CurrentCulture);
    }

    /// <summary>
    /// Retrieves the column as a single byte value
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>byte</returns>
    public override byte GetByte(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks))
        {
            SQLiteDataReaderValue value = new SQLiteDataReaderValue();
            bool complete;

            InvokeReadValueCallback(i, new SQLiteReadValueEventArgs(
                "GetByte", null, value), out complete);

            if (complete)
            {
                if (value.ByteValue == null)
                    throw new SQLiteException("missing byte return value");

                return (byte)value.ByteValue;
            }
        }

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetByte(i - PrivateVisibleFieldCount);

        VerifyType(i, DbType.Byte);
        return _activeStatement._sql.GetByte(_activeStatement, i);
    }

    /// <summary>
    /// Retrieves a column as an array of bytes (blob)
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <param name="fieldOffset">The zero-based index of where to begin reading the data</param>
    /// <param name="buffer">The buffer to write the bytes into</param>
    /// <param name="bufferoffset">The zero-based index of where to begin writing into the array</param>
    /// <param name="length">The number of bytes to retrieve</param>
    /// <returns>The actual number of bytes written into the array</returns>
    /// <remarks>
    /// To determine the number of bytes in the column, pass a null value for the buffer.  The total length will be returned.
    /// </remarks>
    public override long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)
    {
        CheckDisposed();
        VerifyForGet();

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks))
        {
            SQLiteReadArrayEventArgs eventArgs = new SQLiteReadArrayEventArgs(
                fieldOffset, buffer, bufferoffset, length);

            SQLiteDataReaderValue value = new SQLiteDataReaderValue();
            bool complete;

            InvokeReadValueCallback(i, new SQLiteReadValueEventArgs(
                "GetBytes", eventArgs, value), out complete);

            if (complete)
            {
                byte[] bytes = value.BytesValue;

                if (bytes != null)
                {
#if !PLATFORM_COMPACTFRAMEWORK
                    Array.Copy(bytes, /* throw */
                        eventArgs.DataOffset, eventArgs.ByteBuffer,
                        eventArgs.BufferOffset, eventArgs.Length);
#else
                    Array.Copy(bytes, /* throw */
                        (int)eventArgs.DataOffset, eventArgs.ByteBuffer,
                        eventArgs.BufferOffset, eventArgs.Length);
#endif

                    return eventArgs.Length;
                }
                else
                {
                    return -1;
                }
            }
        }

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetBytes(i - PrivateVisibleFieldCount, fieldOffset, buffer, bufferoffset, length);

        VerifyType(i, DbType.Binary);
        return _activeStatement._sql.GetBytes(_activeStatement, i, (int)fieldOffset, buffer, bufferoffset, length);
    }

    /// <summary>
    /// Returns the column as a single character
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>char</returns>
    public override char GetChar(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks))
        {
            SQLiteDataReaderValue value = new SQLiteDataReaderValue();
            bool complete;

            InvokeReadValueCallback(i, new SQLiteReadValueEventArgs(
                "GetChar", null, value), out complete);

            if (complete)
            {
                if (value.CharValue == null)
                    throw new SQLiteException("missing character return value");

                return (char)value.CharValue;
            }
        }

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetChar(i - PrivateVisibleFieldCount);

        VerifyType(i, DbType.SByte);
        return _activeStatement._sql.GetChar(_activeStatement, i);
    }

    /// <summary>
    /// Retrieves a column as an array of chars (blob)
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <param name="fieldoffset">The zero-based index of where to begin reading the data</param>
    /// <param name="buffer">The buffer to write the characters into</param>
    /// <param name="bufferoffset">The zero-based index of where to begin writing into the array</param>
    /// <param name="length">The number of bytes to retrieve</param>
    /// <returns>The actual number of characters written into the array</returns>
    /// <remarks>
    /// To determine the number of characters in the column, pass a null value for the buffer.  The total length will be returned.
    /// </remarks>
    public override long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length)
    {
        CheckDisposed();
        VerifyForGet();

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks))
        {
            SQLiteReadArrayEventArgs eventArgs = new SQLiteReadArrayEventArgs(
                fieldoffset, buffer, bufferoffset, length);

            SQLiteDataReaderValue value = new SQLiteDataReaderValue();
            bool complete;

            InvokeReadValueCallback(i, new SQLiteReadValueEventArgs(
                "GetChars", eventArgs, value), out complete);

            if (complete)
            {
                char[] chars = value.CharsValue;

                if (chars != null)
                {
#if !PLATFORM_COMPACTFRAMEWORK
                    Array.Copy(chars, /* throw */
                        eventArgs.DataOffset, eventArgs.CharBuffer,
                        eventArgs.BufferOffset, eventArgs.Length);
#else
                    Array.Copy(chars, /* throw */
                        (int)eventArgs.DataOffset, eventArgs.CharBuffer,
                        eventArgs.BufferOffset, eventArgs.Length);
#endif

                    return eventArgs.Length;
                }
                else
                {
                    return -1;
                }
            }
        }

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetChars(i - PrivateVisibleFieldCount, fieldoffset, buffer, bufferoffset, length);

        if (!HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.NoVerifyTextAffinity))
            VerifyType(i, DbType.String);

        return _activeStatement._sql.GetChars(_activeStatement, i, (int)fieldoffset, buffer, bufferoffset, length);
    }

    /// <summary>
    /// Retrieves the name of the back-end datatype of the column
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>string</returns>
    public override string GetDataTypeName(int i)
    {
        CheckDisposed();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetDataTypeName(i - PrivateVisibleFieldCount);

        TypeAffinity affin = TypeAffinity.Uninitialized;

        return _activeStatement._sql.ColumnType(_activeStatement, i, ref affin);
    }

    /// <summary>
    /// Retrieve the column as a date/time value
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>DateTime</returns>
    public override DateTime GetDateTime(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks))
        {
            SQLiteDataReaderValue value = new SQLiteDataReaderValue();
            bool complete;

            InvokeReadValueCallback(i, new SQLiteReadValueEventArgs(
                "GetDateTime", null, value), out complete);

            if (complete)
            {
                if (value.DateTimeValue == null)
                    throw new SQLiteException("missing date/time return value");

                return (DateTime)value.DateTimeValue;
            }
        }

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetDateTime(i - PrivateVisibleFieldCount);

        VerifyType(i, DbType.DateTime);
        return _activeStatement._sql.GetDateTime(_activeStatement, i);
    }

    /// <summary>
    /// Retrieve the column as a decimal value
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>decimal</returns>
    public override decimal GetDecimal(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks))
        {
            SQLiteDataReaderValue value = new SQLiteDataReaderValue();
            bool complete;

            InvokeReadValueCallback(i, new SQLiteReadValueEventArgs(
                "GetDecimal", null, value), out complete);

            if (complete)
            {
                if (value.DecimalValue == null)
                    throw new SQLiteException("missing decimal return value");

                return (decimal)value.DecimalValue;
            }
        }

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetDecimal(i - PrivateVisibleFieldCount);

        VerifyType(i, DbType.Decimal);

        CultureInfo cultureInfo = CultureInfo.CurrentCulture;

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.GetInvariantDecimal))
            cultureInfo = CultureInfo.InvariantCulture;

        return Decimal.Parse(_activeStatement._sql.GetText(_activeStatement, i), NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent | NumberStyles.AllowLeadingSign, cultureInfo);
    }

    /// <summary>
    /// Returns the column as a double
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>double</returns>
    public override double GetDouble(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks))
        {
            SQLiteDataReaderValue value = new SQLiteDataReaderValue();
            bool complete;

            InvokeReadValueCallback(i, new SQLiteReadValueEventArgs(
                "GetDouble", null, value), out complete);

            if (complete)
            {
                if (value.DoubleValue == null)
                    throw new SQLiteException("missing double return value");

                return (double)value.DoubleValue;
            }
        }

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetDouble(i - PrivateVisibleFieldCount);

        VerifyType(i, DbType.Double);
        return _activeStatement._sql.GetDouble(_activeStatement, i);
    }

    /// <summary>
    /// Determines and returns the <see cref="TypeAffinity" /> of the
    /// specified column.
    /// </summary>
    /// <param name="i">
    /// The index of the column.
    /// </param>
    /// <returns>
    /// The <see cref="TypeAffinity" /> associated with the specified
    /// column, if any.
    /// </returns>
    public TypeAffinity GetFieldAffinity(int i)
    {
        CheckDisposed();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetFieldAffinity(i - PrivateVisibleFieldCount);

        return GetSQLiteType(_flags, i).Affinity;
    }

    /// <summary>
    /// Returns the .NET type of a given column
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>Type</returns>
    public override Type GetFieldType(int i)
    {
        CheckDisposed();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetFieldType(i - PrivateVisibleFieldCount);

        return SQLiteConvert.SQLiteTypeToType(GetSQLiteType(_flags, i));
    }

    /// <summary>
    /// Returns a column as a float value
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>float</returns>
    public override float GetFloat(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks))
        {
            SQLiteDataReaderValue value = new SQLiteDataReaderValue();
            bool complete;

            InvokeReadValueCallback(i, new SQLiteReadValueEventArgs(
                "GetFloat", null, value), out complete);

            if (complete)
            {
                if (value.FloatValue == null)
                    throw new SQLiteException("missing float return value");

                return (float)value.FloatValue;
            }
        }

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetFloat(i - PrivateVisibleFieldCount);

        VerifyType(i, DbType.Single);
        return Convert.ToSingle(_activeStatement._sql.GetDouble(_activeStatement, i));
    }

    /// <summary>
    /// Returns the column as a Guid
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>Guid</returns>
    public override Guid GetGuid(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks))
        {
            SQLiteDataReaderValue value = new SQLiteDataReaderValue();
            bool complete;

            InvokeReadValueCallback(i, new SQLiteReadValueEventArgs(
                "GetGuid", null, value), out complete);

            if (complete)
            {
                if (value.GuidValue == null)
                    throw new SQLiteException("missing guid return value");

                return (Guid)value.GuidValue;
            }
        }

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetGuid(i - PrivateVisibleFieldCount);

        TypeAffinity affinity = VerifyType(i, DbType.Guid);
        if (affinity == TypeAffinity.Blob)
        {
            byte[] buffer = new byte[16];
            _activeStatement._sql.GetBytes(_activeStatement, i, 0, buffer, 0, 16);
            return new Guid(buffer);
        }
        else
            return new Guid(_activeStatement._sql.GetText(_activeStatement, i));
    }

    /// <summary>
    /// Returns the column as a short
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>Int16</returns>
    public override Int16 GetInt16(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks))
        {
            SQLiteDataReaderValue value = new SQLiteDataReaderValue();
            bool complete;

            InvokeReadValueCallback(i, new SQLiteReadValueEventArgs(
                "GetInt16", null, value), out complete);

            if (complete)
            {
                if (value.Int16Value == null)
                    throw new SQLiteException("missing int16 return value");

                return (Int16)value.Int16Value;
            }
        }

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetInt16(i - PrivateVisibleFieldCount);

        VerifyType(i, DbType.Int16);
        return _activeStatement._sql.GetInt16(_activeStatement, i);
    }

    /// <summary>
    /// Retrieves the column as an int
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>Int32</returns>
    public override Int32 GetInt32(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks))
        {
            SQLiteDataReaderValue value = new SQLiteDataReaderValue();
            bool complete;

            InvokeReadValueCallback(i, new SQLiteReadValueEventArgs(
                "GetInt32", null, value), out complete);

            if (complete)
            {
                if (value.Int32Value == null)
                    throw new SQLiteException("missing int32 return value");

                return (Int32)value.Int32Value;
            }
        }

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetInt32(i - PrivateVisibleFieldCount);

        VerifyType(i, DbType.Int32);
        return _activeStatement._sql.GetInt32(_activeStatement, i);
    }

    /// <summary>
    /// Retrieves the column as a long
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>Int64</returns>
    public override Int64 GetInt64(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks))
        {
            SQLiteDataReaderValue value = new SQLiteDataReaderValue();
            bool complete;

            InvokeReadValueCallback(i, new SQLiteReadValueEventArgs(
                "GetInt64", null, value), out complete);

            if (complete)
            {
                if (value.Int64Value == null)
                    throw new SQLiteException("missing int64 return value");

                return (Int64)value.Int64Value;
            }
        }

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetInt64(i - PrivateVisibleFieldCount);

        VerifyType(i, DbType.Int64);
        return _activeStatement._sql.GetInt64(_activeStatement, i);
    }

    /// <summary>
    /// Retrieves the name of the column
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>string</returns>
    public override string GetName(int i)
    {
        CheckDisposed();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetName(i - PrivateVisibleFieldCount);

        return _activeStatement._sql.ColumnName(_activeStatement, i);
    }

    /// <summary>
    /// Returns the name of the database associated with the specified column.
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>string</returns>
    public string GetDatabaseName(int i)
    {
        CheckDisposed();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetDatabaseName(i - PrivateVisibleFieldCount);

        return _activeStatement._sql.ColumnDatabaseName(_activeStatement, i);
    }

    /// <summary>
    /// Returns the name of the table associated with the specified column.
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>string</returns>
    public string GetTableName(int i)
    {
        CheckDisposed();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetTableName(i - PrivateVisibleFieldCount);

        return _activeStatement._sql.ColumnTableName(_activeStatement, i);
    }

    /// <summary>
    /// Returns the original name of the specified column.
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>string</returns>
    public string GetOriginalName(int i)
    {
        CheckDisposed();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetName(i - PrivateVisibleFieldCount);

        return _activeStatement._sql.ColumnOriginalName(_activeStatement, i);
    }

    /// <summary>
    /// Retrieves the i of a column, given its name
    /// </summary>
    /// <param name="name">The name of the column to retrieve</param>
    /// <returns>The int i of the column</returns>
    public override int GetOrdinal(string name)
    {
      CheckDisposed();

      if (_throwOnDisposed) SQLiteCommand.Check(_command);

      //
      // NOTE: First, check if the column name cache has been initialized yet.
      //       If not, do it now.
      //
      if (_fieldIndexes == null)
      {
          _fieldIndexes = new Dictionary<string, int>(
              StringComparer.OrdinalIgnoreCase);
      }

      //
      // NOTE: Next, see if the index for the requested column name has been
      //       cached already.  If so, return the cached value.  Otherwise,
      //       lookup the value and then cache the result for future use.
      //
      int r;

      if (!_fieldIndexes.TryGetValue(name, out r))
      {
          r = _activeStatement._sql.ColumnIndex(_activeStatement, name);

          if (r == -1 && _keyInfo != null)
          {
              r = _keyInfo.GetOrdinal(name);
              if (r > -1) r += PrivateVisibleFieldCount;
          }

          _fieldIndexes.Add(name, r);
      }

      if (r == -1 && HelperMethods.HasFlags(
            _flags, SQLiteConnectionFlags.StrictConformance))
      {
          throw new IndexOutOfRangeException();
      }

      return r;
    }

    /// <summary>
    /// Schema information in SQLite is difficult to map into .NET conventions, so a lot of work must be done
    /// to gather the necessary information so it can be represented in an ADO.NET manner.
    /// </summary>
    /// <returns>Returns a DataTable containing the schema information for the active SELECT statement being processed.</returns>
    public override DataTable GetSchemaTable()
    {
      CheckDisposed();
      return GetSchemaTable(true, false);
    }

    ///////////////////////////////////////////////////////////////////////////

    #region ColumnParent Class
    private sealed class ColumnParent : IEqualityComparer<ColumnParent>
    {
        #region Public Fields
        public string DatabaseName;
        public string TableName;
        public string ColumnName;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        public ColumnParent()
        {
            // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////

        public ColumnParent(
            string databaseName,
            string tableName,
            string columnName
            )
            : this()
        {
            this.DatabaseName = databaseName;
            this.TableName = tableName;
            this.ColumnName = columnName;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IEqualityComparer<ColumnParent> Members
        public bool Equals(ColumnParent x, ColumnParent y)
        {
            if ((x == null) && (y == null))
            {
                return true;
            }
            else if ((x == null) || (y == null))
            {
                return false;
            }
            else
            {
                if (!String.Equals(x.DatabaseName, y.DatabaseName,
                        StringComparison.OrdinalIgnoreCase))
                {
                    return false;
                }

                if (!String.Equals(x.TableName, y.TableName,
                        StringComparison.OrdinalIgnoreCase))
                {
                    return false;
                }

                if (!String.Equals(x.ColumnName, y.ColumnName,
                        StringComparison.OrdinalIgnoreCase))
                {
                    return false;
                }

                return true;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        public int GetHashCode(ColumnParent obj)
        {
            int result = 0;

            if ((obj != null) && (obj.DatabaseName != null))
                result ^= obj.DatabaseName.GetHashCode();

            if ((obj != null) && (obj.TableName != null))
                result ^= obj.TableName.GetHashCode();

            if ((obj != null) && (obj.ColumnName != null))
                result ^= obj.ColumnName.GetHashCode();

            return result;
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    private static void GetStatementColumnParents(
        SQLiteBase sql,
        SQLiteStatement stmt,
        int fieldCount,
        ref Dictionary<ColumnParent, List<int>> parentToColumns,
        ref Dictionary<int, ColumnParent> columnToParent
        )
    {
        if (parentToColumns == null)
            parentToColumns = new Dictionary<ColumnParent, List<int>>(
                new ColumnParent());

        if (columnToParent == null)
            columnToParent = new Dictionary<int, ColumnParent>();

        for (int n = 0; n < fieldCount; n++)
        {
            string databaseName = sql.ColumnDatabaseName(stmt, n);
            string tableName = sql.ColumnTableName(stmt, n);
            string columnName = sql.ColumnOriginalName(stmt, n);

            ColumnParent key = new ColumnParent(databaseName, tableName, null);
            ColumnParent value = new ColumnParent(databaseName, tableName, columnName);

            List<int> indexList;

            if (!parentToColumns.TryGetValue(key, out indexList))
                parentToColumns.Add(key, new List<int>(new int[] { n }));
            else if (indexList != null)
                indexList.Add(n);
            else
                parentToColumns[key] = new List<int>(new int[] { n });

            columnToParent.Add(n, value);
        }
    }

    ///////////////////////////////////////////////////////////////////////////

    private static int CountParents(
        Dictionary<ColumnParent, List<int>> parentToColumns
        )
    {
        int result = 0;

        if (parentToColumns != null)
        {
            foreach (ColumnParent key in parentToColumns.Keys)
            {
                if (key == null)
                    continue;

                string tableName = key.TableName;

                if (String.IsNullOrEmpty(tableName))
                    continue;

                result++;
            }
        }

        return result;
    }

    ///////////////////////////////////////////////////////////////////////////

    internal DataTable GetSchemaTable(bool wantUniqueInfo, bool wantDefaultValue)
    {
        CheckClosed();
        if (_throwOnDisposed) SQLiteCommand.Check(_command);

        //
        // BUGFIX: We need to quickly scan all the fields in the current
        //         "result set" to see how many distinct tables are actually
        //         involved.  This information is necessary so that some
        //         intelligent decisions can be made when constructing the
        //         metadata below.  For example, we need to be very careful
        //         about flagging a particular column as "unique" just
        //         because it was in its original underlying database table
        //         if there are now multiple tables involved in the
        //         "result set".  See ticket [7e3fa93744] for more detailed
        //         information.
        //
        Dictionary<ColumnParent, List<int>> parentToColumns = null;
        Dictionary<int, ColumnParent> columnToParent = null;
        SQLiteBase sql = _command.Connection._sql;

        GetStatementColumnParents(
            sql, _activeStatement, _fieldCount,
            ref parentToColumns, ref columnToParent);

        DataTable tbl = new DataTable("SchemaTable");
        DataTable tblIndexes = null;
        DataTable tblIndexColumns;
        DataRow row;
        string temp;
        string strCatalog = String.Empty;
        string strTable = String.Empty;
        string strColumn = String.Empty;

        tbl.Locale = CultureInfo.InvariantCulture;
        tbl.Columns.Add(SchemaTableColumn.ColumnName, typeof(String));
        tbl.Columns.Add(SchemaTableColumn.ColumnOrdinal, typeof(int));
        tbl.Columns.Add(SchemaTableColumn.ColumnSize, typeof(int));
        tbl.Columns.Add(SchemaTableColumn.NumericPrecision, typeof(int));
        tbl.Columns.Add(SchemaTableColumn.NumericScale, typeof(int));
        tbl.Columns.Add(SchemaTableColumn.IsUnique, typeof(Boolean));
        tbl.Columns.Add(SchemaTableColumn.IsKey, typeof(Boolean));
        tbl.Columns.Add(SchemaTableOptionalColumn.BaseServerName, typeof(string));
        tbl.Columns.Add(SchemaTableOptionalColumn.BaseCatalogName, typeof(String));
        tbl.Columns.Add(SchemaTableColumn.BaseColumnName, typeof(String));
        tbl.Columns.Add(SchemaTableColumn.BaseSchemaName, typeof(String));
        tbl.Columns.Add(SchemaTableColumn.BaseTableName, typeof(String));
        tbl.Columns.Add(SchemaTableColumn.DataType, typeof(Type));
        tbl.Columns.Add(SchemaTableColumn.AllowDBNull, typeof(Boolean));
        tbl.Columns.Add(SchemaTableColumn.ProviderType, typeof(int));
        tbl.Columns.Add(SchemaTableColumn.IsAliased, typeof(Boolean));
        tbl.Columns.Add(SchemaTableColumn.IsExpression, typeof(Boolean));
        tbl.Columns.Add(SchemaTableOptionalColumn.IsAutoIncrement, typeof(Boolean));
        tbl.Columns.Add(SchemaTableOptionalColumn.IsRowVersion, typeof(Boolean));
        tbl.Columns.Add(SchemaTableOptionalColumn.IsHidden, typeof(Boolean));
        tbl.Columns.Add(SchemaTableColumn.IsLong, typeof(Boolean));
        tbl.Columns.Add(SchemaTableOptionalColumn.IsReadOnly, typeof(Boolean));
        tbl.Columns.Add(SchemaTableOptionalColumn.ProviderSpecificDataType, typeof(Type));
        tbl.Columns.Add(SchemaTableOptionalColumn.DefaultValue, typeof(object));
        tbl.Columns.Add("DataTypeName", typeof(string));
        tbl.Columns.Add("CollationType", typeof(string));
        tbl.BeginLoadData();

        for (int n = 0; n < _fieldCount; n++)
        {
            SQLiteType sqlType = GetSQLiteType(_flags, n);

            row = tbl.NewRow();

            DbType typ = sqlType.Type;

            // Default settings for the column
            row[SchemaTableColumn.ColumnName] = GetName(n);
            row[SchemaTableColumn.ColumnOrdinal] = n;
            row[SchemaTableColumn.ColumnSize] = SQLiteConvert.DbTypeToColumnSize(typ);
            row[SchemaTableColumn.NumericPrecision] = SQLiteConvert.DbTypeToNumericPrecision(typ);
            row[SchemaTableColumn.NumericScale] = SQLiteConvert.DbTypeToNumericScale(typ);
            row[SchemaTableColumn.ProviderType] = sqlType.Type;
            row[SchemaTableColumn.IsLong] = false;
            row[SchemaTableColumn.AllowDBNull] = true;
            row[SchemaTableOptionalColumn.IsReadOnly] = false;
            row[SchemaTableOptionalColumn.IsRowVersion] = false;
            row[SchemaTableColumn.IsUnique] = false;
            row[SchemaTableColumn.IsKey] = false;
            row[SchemaTableOptionalColumn.IsAutoIncrement] = false;
            row[SchemaTableColumn.DataType] = GetFieldType(n);
            row[SchemaTableOptionalColumn.IsHidden] = false;
            row[SchemaTableColumn.BaseSchemaName] = _baseSchemaName;

            strColumn = columnToParent[n].ColumnName;
            if (String.IsNullOrEmpty(strColumn) == false) row[SchemaTableColumn.BaseColumnName] = strColumn;

            row[SchemaTableColumn.IsExpression] = String.IsNullOrEmpty(strColumn);
            row[SchemaTableColumn.IsAliased] = (String.Compare(GetName(n), strColumn, StringComparison.OrdinalIgnoreCase) != 0);

            temp = columnToParent[n].TableName;
            if (String.IsNullOrEmpty(temp) == false) row[SchemaTableColumn.BaseTableName] = temp;

            temp = columnToParent[n].DatabaseName;
            if (String.IsNullOrEmpty(temp) == false) row[SchemaTableOptionalColumn.BaseCatalogName] = temp;

            string dataType = null;
            // If we have a table-bound column, extract the extra information from it
            if (String.IsNullOrEmpty(strColumn) == false)
            {
                string baseCatalogName = String.Empty;

                if (row[SchemaTableOptionalColumn.BaseCatalogName] != DBNull.Value)
                    baseCatalogName = (string)row[SchemaTableOptionalColumn.BaseCatalogName];

                string baseTableName = String.Empty;

                if (row[SchemaTableColumn.BaseTableName] != DBNull.Value)
                    baseTableName = (string)row[SchemaTableColumn.BaseTableName];

                if (sql.DoesTableExist(baseCatalogName, baseTableName))
                {
                    string baseColumnName = String.Empty;

                    if (row[SchemaTableColumn.BaseColumnName] != DBNull.Value)
                        baseColumnName = (string)row[SchemaTableColumn.BaseColumnName];

                    string collSeq = null;
                    bool bNotNull = false;
                    bool bPrimaryKey = false;
                    bool bAutoIncrement = false;
                    string[] arSize;

                    // Get the column meta data
                    _command.Connection._sql.ColumnMetaData(
                        baseCatalogName,
                        baseTableName,
                        strColumn,
                        true,
                        ref dataType, ref collSeq, ref bNotNull, ref bPrimaryKey, ref bAutoIncrement);

                    if (bNotNull || bPrimaryKey) row[SchemaTableColumn.AllowDBNull] = false;
                    bool allowDbNull = (bool)row[SchemaTableColumn.AllowDBNull];

                    row[SchemaTableColumn.IsKey] = bPrimaryKey && CountParents(parentToColumns) <= 1;
                    row[SchemaTableOptionalColumn.IsAutoIncrement] = bAutoIncrement;
                    row["CollationType"] = collSeq;

                    // For types like varchar(50) and such, extract the size
                    arSize = dataType.Split('(');
                    if (arSize.Length > 1)
                    {
                        dataType = arSize[0];
                        arSize = arSize[1].Split(')');
                        if (arSize.Length > 1)
                        {
                            arSize = arSize[0].Split(',', '.');
                            if (sqlType.Type == DbType.Binary || SQLiteConvert.IsStringDbType(sqlType.Type))
                            {
                                row[SchemaTableColumn.ColumnSize] = Convert.ToInt32(arSize[0], CultureInfo.InvariantCulture);
                            }
                            else
                            {
                                row[SchemaTableColumn.NumericPrecision] = Convert.ToInt32(arSize[0], CultureInfo.InvariantCulture);
                                if (arSize.Length > 1)
                                    row[SchemaTableColumn.NumericScale] = Convert.ToInt32(arSize[1], CultureInfo.InvariantCulture);
                            }
                        }
                    }

                    if (wantDefaultValue)
                    {
                        // Determine the default value for the column, which sucks because we have to query the schema for each column
                        using (SQLiteCommand cmdTable = new SQLiteCommand(HelperMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].TABLE_INFO([{1}])",
                            baseCatalogName,
                            baseTableName
                        ), _command.Connection))
                        using (DbDataReader rdTable = cmdTable.ExecuteReader())
                        {
                            // Find the matching column
                            while (rdTable.Read())
                            {
                                if (String.Compare(baseColumnName, rdTable.GetString(1), StringComparison.OrdinalIgnoreCase) == 0)
                                {
                                    if (rdTable.IsDBNull(4) == false)
                                        row[SchemaTableOptionalColumn.DefaultValue] = rdTable[4];

                                    break;
                                }
                            }
                        }
                    }

                    // Determine IsUnique properly, which is a pain in the butt!
                    if (wantUniqueInfo)
                    {
                        if (baseCatalogName != strCatalog || baseTableName != strTable)

                        {
                            strCatalog = baseCatalogName;
                            strTable = baseTableName;

                            tblIndexes = _command.Connection.GetSchema("Indexes", new string[] {
                                baseCatalogName,
                                null,
                                baseTableName,
                                null
                            });
                        }

                        foreach (DataRow rowIndexes in tblIndexes.Rows)
                        {
                            tblIndexColumns = _command.Connection.GetSchema("IndexColumns", new string[] {
                                baseCatalogName,
                                null,
                                baseTableName,
                                (string)rowIndexes["INDEX_NAME"],
                                null
                            });
                            foreach (DataRow rowColumnIndex in tblIndexColumns.Rows)
                            {
                                if (String.Compare(SQLiteConvert.GetStringOrNull(rowColumnIndex["COLUMN_NAME"]), strColumn, StringComparison.OrdinalIgnoreCase) == 0)
                                {
                                    //
                                    // BUGFIX: Make sure that we only flag this column as "unique"
                                    //         if we are not processing of some kind of multi-table
                                    //         construct (i.e. a join) because in that case we must
                                    //         allow duplicate values (refer to ticket [7e3fa93744]).
                                    //
                                    if (parentToColumns.Count == 1 && tblIndexColumns.Rows.Count == 1 && allowDbNull == false)
                                        row[SchemaTableColumn.IsUnique] = rowIndexes["UNIQUE"];

                                    // If its an integer primary key and the only primary key in the table, then its a rowid alias and is autoincrement
                                    // NOTE:  Currently commented out because this is not always the desired behavior.  For example, a 1:1 relationship with
                                    //        another table, where the other table is autoincrement, but this one is not, and uses the rowid from the other.
                                    //        It is safer to only set Autoincrement on tables where we're SURE the user specified AUTOINCREMENT, even if its a rowid column.

                                    //if (tblIndexColumns.Rows.Count == 1 && (bool)rowIndexes["PRIMARY_KEY"] == true && String.IsNullOrEmpty(dataType) == false &&
                                    //  String.Compare(dataType, "integer", StringComparison.OrdinalIgnoreCase) == 0)

                                    //{
                                    //    //  row[SchemaTableOptionalColumn.IsAutoIncrement] = true;
                                    //}


                                    break;
                                }
                            }
                        }
                    }
                }

                if (String.IsNullOrEmpty(dataType))
                {
                    TypeAffinity affin = TypeAffinity.Uninitialized;
                    dataType = _activeStatement._sql.ColumnType(_activeStatement, n, ref affin);
                }

                if (String.IsNullOrEmpty(dataType) == false)
                    row["DataTypeName"] = dataType;
            }

            tbl.Rows.Add(row);
        }

        if (_keyInfo != null)
            _keyInfo.AppendSchemaTable(tbl);

        tbl.AcceptChanges();
        tbl.EndLoadData();

        return tbl;
    }

    /// <summary>
    /// Retrieves the column as a string
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>string</returns>
    public override string GetString(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks))
        {
            SQLiteDataReaderValue value = new SQLiteDataReaderValue();
            bool complete;

            InvokeReadValueCallback(i, new SQLiteReadValueEventArgs(
                "GetString", null, value), out complete);

            if (complete)
                return value.StringValue;
        }

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetString(i - PrivateVisibleFieldCount);

        if (!HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.NoVerifyTextAffinity))
            VerifyType(i, DbType.String);

        return _activeStatement._sql.GetText(_activeStatement, i);
    }

    /// <summary>
    /// Retrieves the column as an object corresponding to the underlying datatype of the column
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>object</returns>
    public override object GetValue(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (HelperMethods.HasFlags(_flags, SQLiteConnectionFlags.UseConnectionReadValueCallbacks))
        {
            SQLiteDataReaderValue value = new SQLiteDataReaderValue();
            bool complete;

            InvokeReadValueCallback(i, new SQLiteReadValueEventArgs(
                "GetValue", null, value), out complete);

            if (complete)
                return value.Value;
        }

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.GetValue(i - PrivateVisibleFieldCount);

        SQLiteType typ = GetSQLiteType(_flags, i);

        if (HelperMethods.HasFlags(
                _flags, SQLiteConnectionFlags.DetectTextAffinity) &&
            ((typ == null) || (typ.Affinity == TypeAffinity.Text)))
        {
            typ = GetSQLiteType(
                typ, _activeStatement._sql.GetText(_activeStatement, i));
        }
        else if (HelperMethods.HasFlags(
                _flags, SQLiteConnectionFlags.DetectStringType) &&
            ((typ == null) || SQLiteConvert.IsStringDbType(typ.Type)))
        {
            typ = GetSQLiteType(
                typ, _activeStatement._sql.GetText(_activeStatement, i));
        }

        return _activeStatement._sql.GetValue(_activeStatement, _flags, i, typ);
    }

    /// <summary>
    /// Retreives the values of multiple columns, up to the size of the supplied array
    /// </summary>
    /// <param name="values">The array to fill with values from the columns in the current resultset</param>
    /// <returns>The number of columns retrieved</returns>
    public override int GetValues(object[] values)
    {
      CheckDisposed();

      int nMax = FieldCount;
      if (values.Length < nMax) nMax = values.Length;

      for (int n = 0; n < nMax; n++)
      {
        values[n] = GetValue(n);
      }

      return nMax;
    }

    /// <summary>
    /// Returns a collection containing all the column names and values for the
    /// current row of data in the current resultset, if any.  If there is no
    /// current row or no current resultset, an exception may be thrown.
    /// </summary>
    /// <returns>
    /// The collection containing the column name and value information for the
    /// current row of data in the current resultset or null if this information
    /// cannot be obtained.
    /// </returns>
    public NameValueCollection GetValues()
    {
        CheckDisposed();

        if ((_activeStatement == null) || (_activeStatement._sql == null))
            throw new InvalidOperationException();

        int nMax = PrivateVisibleFieldCount;
        NameValueCollection result = new NameValueCollection(nMax);

        for (int n = 0; n < nMax; n++)
        {
            string name = _activeStatement._sql.ColumnName(_activeStatement, n);
            string value = _activeStatement._sql.GetText(_activeStatement, n);

            result.Add(name, value);
        }

        return result;
    }

    /// <summary>
    /// Returns True if the resultset has rows that can be fetched
    /// </summary>
    public override bool HasRows
    {
      get
      {
        CheckDisposed();
        CheckClosed();

        //
        // NOTE: If the "sticky" flag has been set, use the new behavior,
        //       which returns non-zero if there were ever any rows in
        //       the associated result sets.  Generally, this flag is only
        //       useful when it is necessary to retain compatibility with
        //       other ADO.NET providers that use these same semantics for
        //       the HasRows property.
        //
        if (HelperMethods.HasFlags(
                _flags, SQLiteConnectionFlags.StickyHasRows))
        {
          return ((_readingState != 1) || (_stepCount > 0));
        }

        //
        // NOTE: This is the default behavior.  It returns non-zero only if
        //       more rows are available (i.e. a call to the Read method is
        //       expected to succeed).  Prior to the introduction of the
        //       "sticky" flag, this is how this property has always worked.
        //
        return (_readingState != 1);
      }
    }

    /// <summary>
    /// Returns True if the data reader is closed
    /// </summary>
    public override bool IsClosed
    {
      get { CheckDisposed(); return (_command == null); }
    }

    /// <summary>
    /// Returns True if the specified column is null
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>True or False</returns>
    public override bool IsDBNull(int i)
    {
        CheckDisposed();
        VerifyForGet();

        if (i >= PrivateVisibleFieldCount && _keyInfo != null)
            return _keyInfo.IsDBNull(i - PrivateVisibleFieldCount);

        return _activeStatement._sql.IsNull(_activeStatement, i);
    }

    /// <summary>
    /// Checks if the specified statement appears to have impacted
    /// one or more rows.  If so, updates the appropriate count(s).
    /// </summary>
    /// <param name="statement">
    /// The statement in progress to be checked.
    /// </param>
    private void CheckForRowsAffected(
        SQLiteStatement statement
        )
    {
        int changes = 0;
        bool readOnly = false;

        if (statement.TryGetChanges(ref changes, ref readOnly))
        {
            if (!readOnly)
            {
                if (_rowsAffected == -1)
                    _rowsAffected = 0;

                _rowsAffected += changes;
            }
        }
    }

    /// <summary>
    /// Single steps the specified statment and checks the number
    /// of rows affected, if applicable.
    /// </summary>
    /// <param name="statement">
    /// The statement to be stepped.
    /// </param>
    /// <returns>
    /// Non-zero if the specified statement appears to have more
    /// rows within it; otherwise, zero.
    /// </returns>
    private bool Step(
        SQLiteStatement statement
        )
    {
        bool result = statement._sql.Step(statement);

        if (result)
            _stepCount++;
        else
            CheckForRowsAffected(statement);

        return result;
    }

    /// <summary>
    /// Moves to the next resultset in multiple row-returning SQL command.
    /// </summary>
    /// <returns>True if the command was successful and a new resultset is available, False otherwise.</returns>
    public override bool NextResult()
    {
      CheckDisposed();
      CheckClosed();
      if (_throwOnDisposed) SQLiteCommand.Check(_command);

      SQLiteStatement stmt = null;
      int fieldCount;
      bool schemaOnly = ((_commandBehavior & CommandBehavior.SchemaOnly) != 0);

      while (true)
      {
        if (stmt == null && _activeStatement != null && _activeStatement._sql != null && _activeStatement._sql.IsOpen())
        {
          // Reset the previously-executed statement
          if (!schemaOnly) _activeStatement._sql.Reset(_activeStatement);

          // If we're only supposed to return a single rowset, step through all remaining statements once until
          // they are all done and return false to indicate no more resultsets exist.
          if ((_commandBehavior & CommandBehavior.SingleResult) != 0)
          {
            for (; ; )
            {
              stmt = _command.GetStatement(_activeStatementIndex + 1);
              if (stmt == null) break;
              _activeStatementIndex++;
              if (!schemaOnly && Step(stmt)) { /* do nothing. */ }






              if (!schemaOnly) stmt._sql.Reset(stmt); // Gotta reset after every step to release any locks and such!
            }
            return false;
          }
        }

        // Get the next statement to execute
        stmt = _command.GetStatement(_activeStatementIndex + 1);
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923

924
925
926
927
928
929
930
931
932
933






































































934
935

936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953

954



955

956

957

958
959
960
961
962













963





964


965
966
967




968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995





996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024

1025

1026

1027
1028
1029
1030
          _readingState = 1;

        _activeStatementIndex++;

        fieldCount = stmt._sql.ColumnCount(stmt);

        // If the statement is not a select statement or we're not retrieving schema only, then perform the initial step
        if ((_commandBehavior & CommandBehavior.SchemaOnly) == 0 || fieldCount == 0)
        {
          if (stmt._sql.Step(stmt))
          {
            _readingState = -1;
          }
          else if (fieldCount == 0) // No rows returned, if fieldCount is zero, skip to the next statement
          {
            if (_rowsAffected == -1) _rowsAffected = 0;
            _rowsAffected += stmt._sql.Changes;
            stmt._sql.Reset(stmt);
            continue; // Skip this command and move to the next, it was not a row-returning resultset
          }
          else // No rows, fieldCount is non-zero so stop here
          {
            _readingState = 1; // This command returned columns but no rows, so return true, but HasRows = false and Read() returns false
          }
        }

        // Ahh, we found a row-returning resultset eligible to be returned!
        _activeStatement = stmt;
        _fieldCount = fieldCount;

        _fieldTypeArray = null;

        if ((_commandBehavior & CommandBehavior.KeyInfo) != 0)
          LoadKeyInfo();

        return true;
      }
    }

    /// <summary>






































































    /// Retrieves the SQLiteType for a given column, and caches it to avoid repetetive interop calls.
    /// </summary>

    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>A SQLiteType structure</returns>
    private SQLiteType GetSQLiteType(int i)
    {
      SQLiteType typ;

      // Initialize the field types array if not already initialized
      if (_fieldTypeArray == null)
        _fieldTypeArray = new SQLiteType[VisibleFieldCount];

      // Initialize this column's field type instance
      if (_fieldTypeArray[i] == null) _fieldTypeArray[i] = new SQLiteType();

      typ = _fieldTypeArray[i];

      // If not initialized, then fetch the declared column datatype and attempt to convert it 
      // to a known DbType.
      if (typ.Affinity == TypeAffinity.Uninitialized)

        typ.Type = SQLiteConvert.TypeNameToDbType(_activeStatement._sql.ColumnType(_activeStatement, i, out typ.Affinity));



      else

        typ.Affinity = _activeStatement._sql.ColumnAffinity(_activeStatement, i);



      return typ;
    }

    /// <summary>
    /// Reads the next row from the resultset













    /// </summary>





    /// <returns>True if a new row was successfully loaded and is ready for processing</returns>


    public override bool Read()
    {
      CheckClosed();





      if (_readingState == -1) // First step was already done at the NextResult() level, so don't step again, just return true.
      {
        _readingState = 0;
        return true;
      }
      else if (_readingState == 0) // Actively reading rows
      {
        // Don't read a new row if the command behavior dictates SingleRow.  We've already read the first row.
        if ((_commandBehavior & CommandBehavior.SingleRow) == 0)
        {
          if (_activeStatement._sql.Step(_activeStatement) == true)
          {
            if (_keyInfo != null)
              _keyInfo.Reset();

            return true;
          }
        }

        _readingState = 1; // Finished reading rows
      }

      return false;
    }

    /// <summary>
    /// Retrieve the count of records affected by an update/insert command.  Only valid once the data reader is closed!





    /// </summary>
    public override int RecordsAffected
    {
      get { return (_rowsAffected < 0) ? 0 : _rowsAffected; }
    }

    /// <summary>
    /// Indexer to retrieve data from a column given its name
    /// </summary>
    /// <param name="name">The name of the column to retrieve data for</param>
    /// <returns>The value contained in the column</returns>
    public override object this[string name]
    {
      get { return GetValue(GetOrdinal(name)); }
    }

    /// <summary>
    /// Indexer to retrieve data from a column given its i
    /// </summary>
    /// <param name="i">The index of the column to retrieve</param>
    /// <returns>The value contained in the column</returns>
    public override object this[int i]
    {
      get { return GetValue(i); }
    }

    private void LoadKeyInfo()
    {
      if (_keyInfo != null)

        _keyInfo.Dispose();



      _keyInfo = new SQLiteKeyReader(_command.Connection, this, _activeStatement);
    }
  }
}







|

|





<
<
|











>
|









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


>
|

|

|

<
|
<
|
|
|
|
<

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



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

>
>
>
>
>
|
>
>
|


>
>
>
>









|

|















|
>
>
>
>
>



|









|





|



|




|
>
|
>
|
>
|



1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973


1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075

2076

2077
2078
2079
2080

2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
          _readingState = 1;

        _activeStatementIndex++;

        fieldCount = stmt._sql.ColumnCount(stmt);

        // If the statement is not a select statement or we're not retrieving schema only, then perform the initial step
        if (!schemaOnly || (fieldCount == 0))
        {
          if (!schemaOnly && Step(stmt))
          {
            _readingState = -1;
          }
          else if (fieldCount == 0) // No rows returned, if fieldCount is zero, skip to the next statement
          {


            if (!schemaOnly) stmt._sql.Reset(stmt);
            continue; // Skip this command and move to the next, it was not a row-returning resultset
          }
          else // No rows, fieldCount is non-zero so stop here
          {
            _readingState = 1; // This command returned columns but no rows, so return true, but HasRows = false and Read() returns false
          }
        }

        // Ahh, we found a row-returning resultset eligible to be returned!
        _activeStatement = stmt;
        _fieldCount = fieldCount;
        _fieldIndexes = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);
        _fieldTypeArray = new SQLiteType[PrivateVisibleFieldCount];

        if ((_commandBehavior & CommandBehavior.KeyInfo) != 0)
          LoadKeyInfo();

        return true;
      }
    }

    /// <summary>
    /// This method attempts to query the database connection associated with
    /// the data reader in use.  If the underlying command or connection is
    /// unavailable, a null value will be returned.
    /// </summary>
    /// <returns>
    /// The connection object -OR- null if it is unavailable.
    /// </returns>
    internal static SQLiteConnection GetConnection(
        SQLiteDataReader dataReader
        )
    {
        try
        {
            if (dataReader != null)
            {
                SQLiteCommand command = dataReader._command;

                if (command != null)
                {
                    SQLiteConnection connection = command.Connection;

                    if (connection != null)
                        return connection;
                }
            }
        }
        catch (ObjectDisposedException)
        {
            // do nothing.
        }

        return null;
    }

    /// <summary>
    /// Retrieves the SQLiteType for a given column and row value.
    /// </summary>
    /// <param name="oldType">
    /// The original SQLiteType structure, based only on the column.
    /// </param>
    /// <param name="text">
    /// The textual value of the column for a given row.
    /// </param>
    /// <returns>
    /// The SQLiteType structure.
    /// </returns>
    private SQLiteType GetSQLiteType(
        SQLiteType oldType, /* PASS-THROUGH */
        string text
        )
    {
        if (SQLiteConvert.LooksLikeNull(text))
            return new SQLiteType(TypeAffinity.Null, DbType.Object);

        if (SQLiteConvert.LooksLikeInt64(text))
            return new SQLiteType(TypeAffinity.Int64, DbType.Int64);

        if (SQLiteConvert.LooksLikeDouble(text))
            return new SQLiteType(TypeAffinity.Double, DbType.Double);

        if ((_activeStatement != null) &&
            SQLiteConvert.LooksLikeDateTime(_activeStatement._sql, text))
        {
            return new SQLiteType(TypeAffinity.DateTime, DbType.DateTime);
        }

        return oldType;
    }

    /// <summary>
    /// Retrieves the SQLiteType for a given column, and caches it to avoid repetetive interop calls.
    /// </summary>
    /// <param name="flags">The flags associated with the parent connection object.</param>
    /// <param name="i">The index of the column.</param>
    /// <returns>A SQLiteType structure</returns>
    private SQLiteType GetSQLiteType(SQLiteConnectionFlags flags, int i)
    {
        SQLiteType typ = _fieldTypeArray[i];


        if (typ == null)

        {
            // Initialize this column's field type instance
            typ = _fieldTypeArray[i] = new SQLiteType();
        }


        // If not initialized, then fetch the declared column datatype and attempt to convert it
        // to a known DbType.
        if (typ.Affinity == TypeAffinity.Uninitialized)
        {
            typ.Type = SQLiteConvert.TypeNameToDbType(
                GetConnection(this), _activeStatement._sql.ColumnType(
                _activeStatement, i, ref typ.Affinity), flags);
        }
        else
        {
            typ.Affinity = _activeStatement._sql.ColumnAffinity(
                _activeStatement, i);
        }

        return typ;
    }

    /// <summary>
    /// Attempts to read the next row from the current result set.
    /// </summary>
    /// <returns>
    /// Non-zero if a new row was successfully loaded and is ready
    /// for processing; otherwise, zero.
    /// </returns>
    public override bool Read()
    {
      CheckDisposed();
      return PrivateRead(false);
    }

    /// <summary>
    /// Attempts to read the next row from the current result set.
    /// </summary>
    /// <param name="ignoreSingleRow">
    /// When this parameter is non-zero, the SingleRow command
    /// behavior flag will be ignored.
    /// </param>
    /// <returns>
    /// Non-zero if a new row was successfully loaded and is ready
    /// for processing; otherwise, zero.
    /// </returns>
    internal bool PrivateRead(bool ignoreSingleRow)
    {
      CheckClosed();
      if (_throwOnDisposed) SQLiteCommand.Check(_command);

      if ((_commandBehavior & CommandBehavior.SchemaOnly) != 0)
        return false;

      if (_readingState == -1) // First step was already done at the NextResult() level, so don't step again, just return true.
      {
        _readingState = 0;
        return true;
      }
      else if (_readingState == 0) // Actively reading rows
      {
        // Don't read a new row if the command behavior dictates SingleRow.  We've already read the first row.
        if (ignoreSingleRow || (_commandBehavior & CommandBehavior.SingleRow) == 0)
        {
          if (Step(_activeStatement) == true)
          {
            if (_keyInfo != null)
              _keyInfo.Reset();

            return true;
          }
        }

        _readingState = 1; // Finished reading rows
      }

      return false;
    }

    /// <summary>
    /// Returns the number of rows affected by the statement being executed.
    /// The value returned may not be accurate for DDL statements.  Also, it
    /// will be -1 for any statement that does not modify the database (e.g.
    /// SELECT).  If an otherwise read-only statement modifies the database
    /// indirectly (e.g. via a virtual table or user-defined function), the
    /// value returned is undefined.
    /// </summary>
    public override int RecordsAffected
    {
      get { CheckDisposed(); return _rowsAffected; }
    }

    /// <summary>
    /// Indexer to retrieve data from a column given its name
    /// </summary>
    /// <param name="name">The name of the column to retrieve data for</param>
    /// <returns>The value contained in the column</returns>
    public override object this[string name]
    {
      get { CheckDisposed(); return GetValue(GetOrdinal(name)); }
    }

    /// <summary>
    /// Indexer to retrieve data from a column given its i
    /// </summary>
    /// <param name="i">The index of the column.</param>
    /// <returns>The value contained in the column</returns>
    public override object this[int i]
    {
      get { CheckDisposed(); return GetValue(i); }
    }

    private void LoadKeyInfo()
    {
        if (_keyInfo != null)
        {
            _keyInfo.Dispose();
            _keyInfo = null;
        }

        _keyInfo = new SQLiteKeyReader(_command.Connection, this, _activeStatement);
    }
  }
}

Added System.Data.SQLite/SQLiteDefineConstants.cs.





































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System.Collections.Generic;

namespace System.Data.SQLite
{
    internal static class SQLiteDefineConstants
    {
        public static readonly IList<string> OptionList = new List<string>(new string[] {
#if CHECK_STATE
            "CHECK_STATE",
#endif

#if COUNT_HANDLE
            "COUNT_HANDLE",
#endif

#if DEBUG
            "DEBUG",
#endif

#if INTEROP_CODEC
            "INTEROP_CODEC",
#endif

#if INTEROP_DEBUG
            "INTEROP_DEBUG",
#endif

#if INTEROP_EXTENSION_FUNCTIONS
            "INTEROP_EXTENSION_FUNCTIONS",
#endif

#if INTEROP_FTS5_EXTENSION
            "INTEROP_FTS5_EXTENSION",
#endif

#if INTEROP_INCLUDE_CEROD
            "INTEROP_INCLUDE_CEROD",
#endif

#if INTEROP_INCLUDE_EXTRA
            "INTEROP_INCLUDE_EXTRA",
#endif

#if INTEROP_INCLUDE_SEE
            "INTEROP_INCLUDE_SEE",
#endif

#if INTEROP_INCLUDE_ZIPVFS
            "INTEROP_INCLUDE_ZIPVFS",
#endif

#if INTEROP_JSON1_EXTENSION
            "INTEROP_JSON1_EXTENSION",
#endif

#if INTEROP_LEGACY_CLOSE
            "INTEROP_LEGACY_CLOSE",
#endif

#if INTEROP_LOG
            "INTEROP_LOG",
#endif

#if INTEROP_PERCENTILE_EXTENSION
            "INTEROP_PERCENTILE_EXTENSION",
#endif

#if INTEROP_REGEXP_EXTENSION
            "INTEROP_REGEXP_EXTENSION",
#endif

#if INTEROP_SESSION_EXTENSION
            "INTEROP_SESSION_EXTENSION",
#endif

#if INTEROP_SHA1_EXTENSION
            "INTEROP_SHA1_EXTENSION",
#endif

#if INTEROP_SHA3_EXTENSION
            "INTEROP_SHA3_EXTENSION",
#endif

#if INTEROP_TEST_EXTENSION
            "INTEROP_TEST_EXTENSION",
#endif

#if INTEROP_TOTYPE_EXTENSION
            "INTEROP_TOTYPE_EXTENSION",
#endif

#if INTEROP_VIRTUAL_TABLE
            "INTEROP_VIRTUAL_TABLE",
#endif

#if NET_20
            "NET_20",
#endif

#if NET_35
            "NET_35",
#endif

#if NET_40
            "NET_40",
#endif

#if NET_45
            "NET_45",
#endif

#if NET_451
            "NET_451",
#endif

#if NET_452
            "NET_452",
#endif

#if NET_46
            "NET_46",
#endif

#if NET_461
            "NET_461",
#endif

#if NET_462
            "NET_462",
#endif

#if NET_47
            "NET_47",
#endif

#if NET_471
            "NET_471",
#endif

#if NET_472
            "NET_472",
#endif

#if NET_48
            "NET_48",
#endif

#if NET_COMPACT_20
            "NET_COMPACT_20",
#endif

#if NET_STANDARD_20
            "NET_STANDARD_20",
#endif

#if NET_STANDARD_21
            "NET_STANDARD_21",
#endif

#if PLATFORM_COMPACTFRAMEWORK
            "PLATFORM_COMPACTFRAMEWORK",
#endif

#if PRELOAD_NATIVE_LIBRARY
            "PRELOAD_NATIVE_LIBRARY",
#endif

#if RETARGETABLE
            "RETARGETABLE",
#endif

#if SQLITE_STANDARD
            "SQLITE_STANDARD",
#endif

#if THROW_ON_DISPOSED
            "THROW_ON_DISPOSED",
#endif

#if TRACE
            "TRACE",
#endif

#if TRACE_CONNECTION
            "TRACE_CONNECTION",
#endif

#if TRACE_DETECTION
            "TRACE_DETECTION",
#endif

#if TRACE_HANDLE
            "TRACE_HANDLE",
#endif

#if TRACE_PRELOAD
            "TRACE_PRELOAD",
#endif

#if TRACE_SHARED
            "TRACE_SHARED",
#endif

#if TRACE_STATEMENT
            "TRACE_STATEMENT",
#endif

#if TRACE_WARNING
            "TRACE_WARNING",
#endif

#if TRACK_MEMORY_BYTES
            "TRACK_MEMORY_BYTES",
#endif

#if USE_ENTITY_FRAMEWORK_6
            "USE_ENTITY_FRAMEWORK_6",
#endif

#if USE_INTEROP_DLL
            "USE_INTEROP_DLL",
#endif

#if USE_PREPARE_V2
            "USE_PREPARE_V2",
#endif

#if WINDOWS
            "WINDOWS",
#endif

            null
        });
    }
}

Changes to System.Data.SQLite/SQLiteEnlistment.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






23
24



25
26
27
28






































































29
30
31
32
33
34
35
36
37

38



























































39
40







41
42


43
44
45
46
47





















48
49
50
51




52
53
54
55
56
57
58
59


60
61

62
63
64


65
66


67
68
69
70
71
72


73
74


75
76
77
78
79





















80





81
82
83
84
85
86
87
88
89
90
91
92
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

#if !PLATFORM_COMPACTFRAMEWORK
namespace System.Data.SQLite
{
  using System;
  using System.Data;
  using System.Data.Common;
  using System.Transactions;

  internal class SQLiteEnlistment : IEnlistmentNotification
  {
    internal SQLiteTransaction _transaction;
    internal Transaction _scope;
    internal bool _disposeConnection;

    internal SQLiteEnlistment(SQLiteConnection cnn, Transaction scope)






    {
      _transaction = cnn.BeginTransaction();



      _scope = scope;

      _scope.EnlistVolatile(this, System.Transactions.EnlistmentOptions.None);
    }







































































    private void Cleanup(SQLiteConnection cnn)
    {
      if (_disposeConnection)
        cnn.Dispose();

      _transaction = null;
      _scope = null;
    }





























































    #region IEnlistmentNotification Members








    public void Commit(Enlistment enlistment)
    {


      SQLiteConnection cnn = _transaction.Connection;
      cnn._enlistment = null;

      try
      {





















        _transaction.IsValid(true);
        _transaction.Connection._transactionLevel = 1;
        _transaction.Commit();





        enlistment.Done();
      }
      finally
      {
        Cleanup(cnn);
      }
    }



    public void InDoubt(Enlistment enlistment)
    {

      enlistment.Done();
    }



    public void Prepare(PreparingEnlistment preparingEnlistment)
    {


      if (_transaction.IsValid(false) == false)
        preparingEnlistment.ForceRollback();
      else
        preparingEnlistment.Prepared();
    }



    public void Rollback(Enlistment enlistment)
    {


      SQLiteConnection cnn = _transaction.Connection;
      cnn._enlistment = null;

      try
      {





















        _transaction.Rollback();





        enlistment.Done();
      }
      finally
      {
        Cleanup(cnn);
      }
    }

    #endregion
  }
}
#endif // !PLATFORM_COMPACT_FRAMEWORK



|






|
<
<
|

|





|
>
>
>
>
>
>

|
>
>
>


|

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



|
|

|
|

>

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


>
>
|
<

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

>
>
>
>
|
|
|
|
|
|


>
>


>



>
>


>
>






>
>


>
>
|
<

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

<




1
2
3
4
5
6
7
8
9
10
11


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189

190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256

257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293

294
295
296
297
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

#if !PLATFORM_COMPACTFRAMEWORK
namespace System.Data.SQLite
{
    using System.Globalization;


    using System.Transactions;

  internal sealed class SQLiteEnlistment : IDisposable, IEnlistmentNotification
  {
    internal SQLiteTransaction _transaction;
    internal Transaction _scope;
    internal bool _disposeConnection;

    internal SQLiteEnlistment(
        SQLiteConnection cnn,
        Transaction scope,
        System.Data.IsolationLevel defaultIsolationLevel,
        bool throwOnUnavailable,
        bool throwOnUnsupported
        )
    {
      _transaction = cnn.BeginTransaction(GetSystemDataIsolationLevel(
          cnn, scope, defaultIsolationLevel, throwOnUnavailable,
          throwOnUnsupported));

      _scope = scope;

      _scope.EnlistVolatile(this, EnlistmentOptions.None);
    }

    ///////////////////////////////////////////////////////////////////////////

    #region Private Methods
    private System.Data.IsolationLevel GetSystemDataIsolationLevel(
        SQLiteConnection connection,
        Transaction transaction,
        System.Data.IsolationLevel defaultIsolationLevel,
        bool throwOnUnavailable,
        bool throwOnUnsupported
        )
    {
        if (transaction == null)
        {
            //
            // NOTE: If neither the transaction nor connection isolation
            //       level is available, throw an exception if instructed
            //       by the caller.
            //
            if (connection != null)
                return connection.GetDefaultIsolationLevel();

            if (throwOnUnavailable)
            {
                throw new InvalidOperationException(
                    "isolation level is unavailable");
            }

            return defaultIsolationLevel;
        }

        IsolationLevel isolationLevel = transaction.IsolationLevel;

        //
        // TODO: Are these isolation level mappings actually correct?
        //
        switch (isolationLevel)
        {
            case IsolationLevel.Unspecified:
                return System.Data.IsolationLevel.Unspecified;
            case IsolationLevel.Chaos:
                return System.Data.IsolationLevel.Chaos;
            case IsolationLevel.ReadUncommitted:
                return System.Data.IsolationLevel.ReadUncommitted;
            case IsolationLevel.ReadCommitted:
                return System.Data.IsolationLevel.ReadCommitted;
            case IsolationLevel.RepeatableRead:
                return System.Data.IsolationLevel.RepeatableRead;
            case IsolationLevel.Serializable:
                return System.Data.IsolationLevel.Serializable;
            case IsolationLevel.Snapshot:
                return System.Data.IsolationLevel.Snapshot;
        }

        //
        // NOTE: When in "strict" mode, throw an exception if the isolation
        //       level is not recognized; otherwise, fallback to the default
        //       isolation level specified by the caller.
        //
        if (throwOnUnsupported)
        {
            throw new InvalidOperationException(
                HelperMethods.StringFormat(CultureInfo.CurrentCulture,
                "unsupported isolation level {0}", isolationLevel));
        }

        return defaultIsolationLevel;
    }

    ///////////////////////////////////////////////////////////////////////////

    private void Cleanup(SQLiteConnection cnn)
    {
        if (_disposeConnection && (cnn != null))
            cnn.Dispose();

        _transaction = null;
        _scope = null;
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region IDisposable Members
    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region IDisposable "Pattern" Members
    private bool disposed;
    private void CheckDisposed() /* throw */
    {
#if THROW_ON_DISPOSED
        if (disposed)
            throw new ObjectDisposedException(typeof(SQLiteEnlistment).Name);
#endif
    }

    ///////////////////////////////////////////////////////////////////////////

    private /* protected virtual */ void Dispose(bool disposing)
    {
        if (!disposed)
        {
            if (disposing)
            {
                ////////////////////////////////////
                // dispose managed resources here...
                ////////////////////////////////////

                if (_transaction != null)
                {
                    _transaction.Dispose();
                    _transaction = null;
                }

                if (_scope != null)
                {
                    // _scope.Dispose(); // NOTE: Not "owned" by us.
                    _scope = null;
                }
            }

            //////////////////////////////////////
            // release unmanaged resources here...
            //////////////////////////////////////

            disposed = true;
        }
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region Destructor
    ~SQLiteEnlistment()
    {
        Dispose(false);
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region IEnlistmentNotification Members
    public void Commit(Enlistment enlistment)
    {
        CheckDisposed();

        SQLiteConnection cnn = null;


        try
        {
            while (true)
            {
                cnn = _transaction.Connection;

                if (cnn == null)
                    break;

                lock (cnn._enlistmentSyncRoot) /* TRANSACTIONAL */
                {
                    //
                    // NOTE: This check is necessary to detect the case where
                    //       the SQLiteConnection.Close() method changes the
                    //       connection associated with our transaction (i.e.
                    //       to avoid a race (condition) between grabbing the
                    //       Connection property and locking its enlistment).
                    //
                    if (!Object.ReferenceEquals(cnn, _transaction.Connection))
                        continue;

                    cnn._enlistment = null;

                    _transaction.IsValid(true); /* throw */
                    cnn._transactionLevel = 1;
                    _transaction.Commit();

                    break;
                }
            }

            enlistment.Done();
        }
        finally
        {
            Cleanup(cnn);
        }
    }

    ///////////////////////////////////////////////////////////////////////////

    public void InDoubt(Enlistment enlistment)
    {
      CheckDisposed();
      enlistment.Done();
    }

    ///////////////////////////////////////////////////////////////////////////

    public void Prepare(PreparingEnlistment preparingEnlistment)
    {
      CheckDisposed();

      if (_transaction.IsValid(false) == false)
        preparingEnlistment.ForceRollback();
      else
        preparingEnlistment.Prepared();
    }

    ///////////////////////////////////////////////////////////////////////////

    public void Rollback(Enlistment enlistment)
    {
        CheckDisposed();

        SQLiteConnection cnn = null;


        try
        {
            while (true)
            {
                cnn = _transaction.Connection;

                if (cnn == null)
                    break;

                lock (cnn._enlistmentSyncRoot) /* TRANSACTIONAL */
                {
                    //
                    // NOTE: This check is necessary to detect the case where
                    //       the SQLiteConnection.Close() method changes the
                    //       connection associated with our transaction (i.e.
                    //       to avoid a race (condition) between grabbing the
                    //       Connection property and locking its enlistment).
                    //
                    if (!Object.ReferenceEquals(cnn, _transaction.Connection))
                        continue;

                    cnn._enlistment = null;

                    _transaction.Rollback();

                    break;
                }
            }

            enlistment.Done();
        }
        finally
        {
            Cleanup(cnn);
        }
    }

    #endregion
  }
}
#endif // !PLATFORM_COMPACT_FRAMEWORK

Changes to System.Data.SQLite/SQLiteException.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

16

17
18
19
20
21
22
23
24
25
26
27
28














29
30


31









32
33
34




35
36
37


38
39

40
41


42


43
44
45

46

47
48


49
50

51
52
53
54
55

56
57


58
59
60
61

62

63
64


65
66
67
68
69


70
71
72

73
74



75
76


77















78



79

80





81
82
83
84
85
86
























































































87
88


89
90


















91


92


93


94


95

















96

97

98
99


100







101
102


103


104























































105
106











107



108







109
110
111



112



113
114
115
116
117
118



119



120
121
122
123
124
125
126






127
128

129

130






131







132
133
134






135





136



137



































138



139
140
141
142





143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249








250
251
252
253
254
255
256





257























































































































































































































































































































258
259
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Collections.Generic;
  using System.Text;
  using System.Data.Common;

#if !PLATFORM_COMPACTFRAMEWORK

  using System.Runtime.Serialization;

#endif

  /// <summary>
  /// SQLite exception class.
  /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
  [Serializable]
  public sealed class SQLiteException : DbException
#else
  public sealed class SQLiteException : Exception
#endif
  {














    private SQLiteErrorCode _errorCode;



#if !PLATFORM_COMPACTFRAMEWORK









    private SQLiteException(SerializationInfo info, StreamingContext context)
      : base(info, context)
    {




    }
#endif



    /// <summary>
    /// Public constructor for generating a SQLite error given the base error code

    /// </summary>
    /// <param name="errorCode">The SQLite error code to report</param>


    /// <param name="extendedInformation">Extra text to go along with the error message text</param>


    public SQLiteException(int errorCode, string extendedInformation)
      : base(GetStockErrorMessage(errorCode, extendedInformation))
    {

      _errorCode = (SQLiteErrorCode)errorCode;

    }



    /// <summary>
    /// Various public constructors that just pass along to the base Exception

    /// </summary>
    /// <param name="message">Passed verbatim to Exception</param>
    public SQLiteException(string message)
      : base(message)
    {

    }



    /// <summary>
    /// Various public constructors that just pass along to the base Exception
    /// </summary>
    public SQLiteException()

    {

    }



    /// <summary>
    /// Various public constructors that just pass along to the base Exception
    /// <param name="message">Passed to Exception</param>
    /// <param name="innerException">Passed to Exception</param>
    /// </summary>


    public SQLiteException(string message, Exception innerException)
      : base(message, innerException)
    {

    }




    /// <summary>
    /// Retrieves the underlying SQLite error code for this exception


    /// </summary>















#if !PLATFORM_COMPACTFRAMEWORK



    public new SQLiteErrorCode ErrorCode

#else





    public SQLiteErrorCode ErrorCode
#endif
    {
      get { return _errorCode; }
    }

























































































    /// <summary>
    /// Initializes the exception class with the SQLite error code.


    /// </summary>
    /// <param name="errorCode">The SQLite error code</param>


















    /// <param name="errorMessage">A detailed error message</param>


    /// <returns>An error message string</returns>


    private static string GetStockErrorMessage(int errorCode, string errorMessage)


    {


      if (errorMessage == null) errorMessage = "";



















      if (errorMessage.Length > 0)

        errorMessage = "\r\n" + errorMessage;



      if (errorCode < 0 || errorCode >= _errorMessages.Length)







        errorCode = 1;



      return _errorMessages[errorCode] + errorMessage;


    }
























































    private static string[] _errorMessages = {











      "SQLite OK",



      "SQLite error",







      "An internal logic error in SQLite",
      "Access permission denied",
      "Callback routine requested an abort",



      "The database file is locked",



      "A table in the database is locked",
      "malloc() failed",
      "Attempt to write a read-only database",
      "Operation terminated by sqlite3_interrupt()",
      "Some kind of disk I/O error occurred",
      "The database disk image is malformed",



      "Table or record not found",



      "Insertion failed because the database is full",
      "Unable to open the database file",
      "Database lock protocol error",
      "Database is empty",
      "The database schema changed",
      "Too much data for one row of a table",
      "Abort due to constraint violation",






      "Data type mismatch",
      "Library used incorrectly",

      "Uses OS features not supported on host",

      "Authorization denied",






      "Auxiliary database format error",







      "2nd parameter to sqlite3_bind() out of range",
      "File opened that is not a database file",
    };






  }









  /// <summary>



































  /// SQLite error codes



  /// </summary>
  public enum SQLiteErrorCode
  {
    /// <summary>





    /// Success
    /// </summary>
    Ok = 0,
    /// <summary>
    /// SQL error or missing database
    /// </summary>
    Error,
    /// <summary>
    /// Internal logic error in SQLite
    /// </summary>
    Internal,
    /// <summary>
    /// Access permission denied
    /// </summary>
    Perm,
    /// <summary>
    /// Callback routine requested an abort
    /// </summary>
    Abort,
    /// <summary>
    /// The database file is locked
    /// </summary>
    Busy,
    /// <summary>
    /// A table in the database is locked
    /// </summary>
    Locked,
    /// <summary>
    /// malloc() failed
    /// </summary>
    NoMem,
    /// <summary>
    /// Attempt to write a read-only database
    /// </summary>
    ReadOnly,
    /// <summary>
    /// Operation terminated by sqlite3_interrupt()
    /// </summary>
    Interrupt,
    /// <summary>
    /// Some kind of disk I/O error occurred
    /// </summary>
    IOErr,
    /// <summary>
    /// The database disk image is malformed
    /// </summary>
    Corrupt,
    /// <summary>
    /// Table or record not found
    /// </summary>
    NotFound,
    /// <summary>
    /// Insertion failed because database is full
    /// </summary>
    Full,
    /// <summary>
    /// Unable to open the database file
    /// </summary>
    CantOpen,
    /// <summary>
    /// Database lock protocol error
    /// </summary>
    Protocol,
    /// <summary>
    /// Database is empty
    /// </summary>
    Empty,
    /// <summary>
    /// The database schema changed
    /// </summary>
    Schema,
    /// <summary>
    /// Too much data for one row of a table
    /// </summary>
    TooBig,
    /// <summary>
    /// Abort due to constraint violation
    /// </summary>
    Constraint,
    /// <summary>
    /// Data type mismatch
    /// </summary>
    Mismatch,
    /// <summary>
    /// Library used incorrectly
    /// </summary>
    Misuse,
    /// <summary>
    /// Uses OS features not supported on host
    /// </summary>
    NOLFS,
    /// <summary>
    /// Authorization denied
    /// </summary>
    Auth,
    /// <summary>
    /// Auxiliary database format error
    /// </summary>
    Format,
    /// <summary>
    /// 2nd parameter to sqlite3_bind out of range
    /// </summary>
    Range,
    /// <summary>
    /// File opened that is not a database file
    /// </summary>
    NotADatabase,








    /// <summary>
    /// sqlite3_step() has another row ready
    /// </summary>
    Row = 100,
    /// <summary>
    /// sqlite3_step() has finished executing
    /// </summary>





    Done = 101,























































































































































































































































































































  }
}



|






<
|
|


>

>






|
|




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


>
>

>
>
>
>
>
>
>
>
>

|

>
>
>
>



>
>

|
>

|
>
>
|
>
>
|
|

>
|
>


>
>

|
>

|

|

>


>
>

|


>

>


>
>

|
|
<

>
>



>


>
>
>

<
>
>

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




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

|
>
>

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

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



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


1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116

117
118
119
120
121
122
123
124
125
126
127
128
129

130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160

161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411


412
413
414
415
416
417
418
419



420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462


463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;

  using System.Data.Common;
  using System.Globalization;

#if !PLATFORM_COMPACTFRAMEWORK
  using System.Reflection;
  using System.Runtime.Serialization;
  using System.Security.Permissions;
#endif

  /// <summary>
  /// SQLite exception class.
  /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
  [Serializable()]
  public sealed class SQLiteException : DbException, ISerializable
#else
  public sealed class SQLiteException : Exception
#endif
  {
    #region Private Constants
    /// <summary>
    /// This value was copied from the "WinError.h" file included with the
    /// Platform SDK for Windows 10.
    /// </summary>
    private const int FACILITY_SQLITE = 1967;
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// This field contains the SQLite (or Win32?) error code associated
    /// with this exception.
    /// </summary>
    private SQLiteErrorCode _errorCode;

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    /// <summary>
    /// Private constructor for use with serialization.
    /// </summary>
    /// <param name="info">
    /// Holds the serialized object data about the exception being thrown.
    /// </param>
    /// <param name="context">
    /// Contains contextual information about the source or destination.
    /// </param>
    private SQLiteException(SerializationInfo info, StreamingContext context)
        : base(info, context)
    {
        _errorCode = (SQLiteErrorCode)MaybeMutateErrorCode(
            info.GetInt32("errorCode"));

        Initialize();
    }
#endif

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Public constructor for generating a SQLite exception given the error
    /// code and message.
    /// </summary>
    /// <param name="errorCode">
    /// The SQLite return code to report.
    /// </param>
    /// <param name="message">
    /// Message text to go along with the return code message text.
    /// </param>
    public SQLiteException(SQLiteErrorCode errorCode, string message)
        : base(GetStockErrorMessage(MaybeMutateErrorCode(errorCode), message))
    {
        _errorCode = MaybeMutateErrorCode(errorCode);

        Initialize();
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Public constructor that uses the base class constructor for the error
    /// message.
    /// </summary>
    /// <param name="message">Error message text.</param>
    public SQLiteException(string message)
      : this(SQLiteErrorCode.Unknown, message)
    {
        // do nothing.
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Public constructor that uses the default base class constructor.
    /// </summary>
    public SQLiteException()
        : base()
    {
        Initialize();
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Public constructor that uses the base class constructor for the error
    /// message and inner exception.

    /// </summary>
    /// <param name="message">Error message text.</param>
    /// <param name="innerException">The original (inner) exception.</param>
    public SQLiteException(string message, Exception innerException)
      : base(message, innerException)
    {
        Initialize();
    }

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    /// <summary>

    /// Adds extra information to the serialized object data specific to this
    /// class type.  This is only used for serialization.
    /// </summary>
    /// <param name="info">
    /// Holds the serialized object data about the exception being thrown.
    /// </param>
    /// <param name="context">
    /// Contains contextual information about the source or destination.
    /// </param>
    [SecurityPermission(
      SecurityAction.LinkDemand,
      Flags = SecurityPermissionFlag.SerializationFormatter)]
    public override void GetObjectData(
      SerializationInfo info,
      StreamingContext context)
    {
      if (info != null)
        info.AddValue("errorCode", _errorCode);

      base.GetObjectData(info, context);
    }
#endif

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Gets the associated SQLite result code for this exception as a
    /// <see cref="SQLiteErrorCode" />.  This property returns the same
    /// underlying value as the <see cref="ErrorCode" /> property.
    /// </summary>
    public SQLiteErrorCode ResultCode

    {
      get { return _errorCode; }
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Gets the associated SQLite return code for this exception as an
    /// <see cref="Int32" />.  For desktop versions of the .NET Framework,
    /// this property overrides the property of the same name within the
    /// <see cref="System.Runtime.InteropServices.ExternalException" />
    /// class.  This property returns the same underlying value as the
    /// <see cref="ResultCode" /> property.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    public override int ErrorCode
#else
    public int ErrorCode
#endif
    {
      get { return (int)_errorCode; }
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// This method performs extra initialization tasks.  It may be called by
    /// any of the constructors of this class.  It must not throw exceptions.
    /// </summary>
    private void Initialize()
    {
        if (HResult == unchecked((int)0x80004005)) /* E_FAIL */
        {
            int? localHResult;

            if (ErrorCode < 0) /* FAILED(hResult) */
                localHResult = ErrorCode; /* hResult */
            else
                localHResult = GetHResultForErrorCode(ResultCode);

            if (localHResult != null)
                HResult = (int)localHResult;
        }
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Maps a Win32 error code to an HRESULT.
    /// </summary>
    /// <param name="errorCode">
    /// The specified Win32 error code.  It must be within the range of zero
    /// (0) to 0xFFFF (65535).
    /// </param>
    /// <param name="success">
    /// Non-zero if the HRESULT should indicate success; otherwise, zero.
    /// </param>
    /// <returns>
    /// The integer value of the HRESULT.
    /// </returns>
    private static int MakeHResult(
        int errorCode,
        bool success
        )
    {
        return (errorCode & ushort.MaxValue) | (FACILITY_SQLITE << 16) |
            (success ? 0 : unchecked((int)0x80000000));
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Determines if an integer error code is really a failure HRESULT.
    /// If so, extracts the error code from it; otherwise, returns the
    /// value verbatim.
    /// </summary>
    /// <param name="value">
    /// Either a failure HRESULT or a Win32 error code.
    /// </param>
    /// <returns>
    /// Either an extracted Win32 error code -OR- the origianl value
    /// verbatim.
    /// </returns>
    private static int MaybeMutateErrorCode(
        int value
        )
    {
        return (value < 0) ? GetErrorCodeForHResult(value) : value;
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Determines if an integer error code is really a failure HRESULT.
    /// If so, extracts the error code from it; otherwise, returns the
    /// value verbatim.
    /// </summary>
    /// <param name="value">
    /// Either a failure HRESULT or a Win32 error code.
    /// </param>
    /// <returns>
    /// Either an extracted Win32 error code -OR- the origianl value
    /// verbatim.
    /// </returns>
    private static SQLiteErrorCode MaybeMutateErrorCode(
        SQLiteErrorCode value
        )
    {
        return (SQLiteErrorCode)MaybeMutateErrorCode((int)value);
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Maps an HRESULT to a Win32 error code.
    /// </summary>
    /// <param name="hResult">
    /// The specified HRESULT.
    /// </param>
    /// <returns>
    /// The integer value of the Win32 error code.
    /// </returns>
    private static int GetErrorCodeForHResult(
        int hResult
        )
    {
        return (hResult & ushort.MaxValue);
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Attempts to map the specified <see cref="SQLiteErrorCode" /> onto an
    /// existing HRESULT -OR- a Win32 error code wrapped in an HRESULT.  The
    /// mappings may not have perfectly matching semantics; however, they do
    /// have the benefit of being unique within the context of this exception
    /// type.
    /// </summary>
    /// <param name="errorCode">
    /// The <see cref="SQLiteErrorCode" /> to map.
    /// </param>
    /// <returns>
    /// The integer HRESULT value -OR- null if there is no known mapping.
    /// </returns>
    private static int? GetHResultForErrorCode(
        SQLiteErrorCode errorCode
        )
    {
        switch (errorCode & SQLiteErrorCode.NonExtendedMask)
        {
            case SQLiteErrorCode.Ok:
                {
                    return 0; /* S_OK */
                }
            case SQLiteErrorCode.Error:
                {
                    return MakeHResult(0x001F, false); /* ERROR_GEN_FAILURE */
                }
            case SQLiteErrorCode.Internal:
                {
                    return unchecked((int)0x8000FFFF); /* E_UNEXPECTED */
                }
            case SQLiteErrorCode.Perm:
                {
                    return MakeHResult(0x0005, false); /* ERROR_ACCESS_DENIED */
                }
            case SQLiteErrorCode.Abort:
                {
                    return unchecked((int)0x80004004); /* E_ABORT */
                }
            case SQLiteErrorCode.Busy:
                {
                    return MakeHResult(0x00AA, false); /* ERROR_BUSY */
                }
            case SQLiteErrorCode.Locked:
                {
                    return MakeHResult(0x00D4, false); /* ERROR_LOCKED */
                }
            case SQLiteErrorCode.NoMem:
                {
                    return MakeHResult(0x000E, false); /* ERROR_OUTOFMEMORY */
                }
            case SQLiteErrorCode.ReadOnly:
                {
                    return MakeHResult(0x1779, false); /* ERROR_FILE_READ_ONLY */
                }
            case SQLiteErrorCode.Interrupt:
                {
                    return MakeHResult(0x04C7, false); /* ERROR_CANCELLED */
                }
            case SQLiteErrorCode.IoErr:
                {
                    return MakeHResult(0x045D, false); /* ERROR_IO_DEVICE */
                }
            case SQLiteErrorCode.Corrupt:
                {
                    return MakeHResult(0x054E, false); /* ERROR_INTERNAL_DB_CORRUPTION */
                }
            case SQLiteErrorCode.NotFound:
                {
                    return MakeHResult(0x0032, false); /* ERROR_NOT_SUPPORTED */
                }
            case SQLiteErrorCode.Full:
                {
                    return MakeHResult(0x0070, false); /* ERROR_DISK_FULL */
                }
            case SQLiteErrorCode.CantOpen:
                {
                    return MakeHResult(0x03F3, false); /* ERROR_CANTOPEN */
                }
            case SQLiteErrorCode.Protocol:
                {
                    return MakeHResult(0x05B4, false); /* ERROR_TIMEOUT */
                }
            case SQLiteErrorCode.Empty:
                {
                    return MakeHResult(0x10D2, false); /* ERROR_EMPTY */
                }
            case SQLiteErrorCode.Schema:
                {
                    return MakeHResult(0x078B, false); /* ERROR_CONTEXT_EXPIRED */
                }
            case SQLiteErrorCode.TooBig:
                {
                    return unchecked((int)0x800288C5); /* TYPE_E_SIZETOOBIG */
                }
            case SQLiteErrorCode.Constraint:
                {
                    return MakeHResult(0x202F, false); /* ERROR_DS_CONSTRAINT_VIOLATION */
                }
            case SQLiteErrorCode.Mismatch:
                {
                    return MakeHResult(0x065D, false); /* ERROR_DATATYPE_MISMATCH */
                }
            case SQLiteErrorCode.Misuse:
                {
                    return MakeHResult(0x0649, false); /* ERROR_INVALID_HANDLE_STATE */
                }
            case SQLiteErrorCode.NoLfs:
                {
                    return MakeHResult(0x0646, false); /* ERROR_UNKNOWN_FEATURE */
                }
            case SQLiteErrorCode.Auth:
                {
                    return MakeHResult(0x078F, false); /* ERROR_AUTHENTICATION_FIREWALL_FAILED */
                }
            case SQLiteErrorCode.Format:
                {
                    return MakeHResult(0x000B, false); /* ERROR_BAD_FORMAT */
                }
            case SQLiteErrorCode.Range:


                {
                    return unchecked((int)0x80028CA1); /* TYPE_E_OUTOFBOUNDS */
                }
            case SQLiteErrorCode.NotADb:
                {
                    return MakeHResult(0x0570, false); /* ERROR_FILE_CORRUPT */
                }
            case SQLiteErrorCode.Notice:



            case SQLiteErrorCode.Warning:
            case SQLiteErrorCode.Row:
            case SQLiteErrorCode.Done:
                {
                    //
                    // NOTE: These result codes are not errors, per se;
                    //       therefore, mask off all HRESULT bits that
                    //       are not part of the "code" portion (e.g.
                    //       the severity, facility, etc).  This will
                    //       have the effect of creating an HRESULT
                    //       that indicates success, while (hopefully)
                    //       preserving the specified result code.  At
                    //       the time this method was written (2018-02),
                    //       no SQLite result codes were outside of the
                    //       supported range for HRESULT codes (e.g.
                    //       0x0000 to 0xFFFF, inclusive), which made
                    //       the following masking operation a harmless
                    //       NOOP.
                    //
                    return MakeHResult((int)errorCode, true);
                }
        }

        return null;
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Returns the error message for the specified SQLite return code.
    /// </summary>
    /// <param name="errorCode">The SQLite return code.</param>
    /// <returns>The error message or null if it cannot be found.</returns>
    private static string GetErrorString(
        SQLiteErrorCode errorCode
        )
    {
#if !PLATFORM_COMPACTFRAMEWORK
        //
        // HACK: This must be done via reflection in order to prevent
        //       the RuntimeHelpers.PrepareDelegate method from over-
        //       eagerly attempting to locate the new (and optional)
        //       sqlite3_errstr() function in the SQLite core library


        //       because it happens to be in the static call graph for
        //       the AppDomain.DomainUnload event handler registered
        //       by the SQLiteLog class.
        //
        BindingFlags flags = BindingFlags.Static |
            BindingFlags.NonPublic | BindingFlags.InvokeMethod;

        return typeof(SQLite3).InvokeMember("GetErrorString",
            flags, null, null, new object[] { errorCode }) as string;
#else
        return SQLite3.GetErrorString(errorCode);
#endif
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Returns the composite error message based on the SQLite return code
    /// and the optional detailed error message.
    /// </summary>
    /// <param name="errorCode">The SQLite return code.</param>
    /// <param name="message">Optional detailed error message.</param>
    /// <returns>Error message text for the return code.</returns>
    private static string GetStockErrorMessage(
        SQLiteErrorCode errorCode,
        string message
        )
    {
        return HelperMethods.StringFormat(
            CultureInfo.CurrentCulture,
            "{0}{1}{2}",
            GetErrorString(errorCode),
#if !NET_COMPACT_20
            Environment.NewLine, message).Trim();
#else
            "\r\n", message).Trim();
#endif
    }

    ///////////////////////////////////////////////////////////////////////////

    #region System.Object Overrides
    public override string ToString()
    {
        return HelperMethods.StringFormat(
            CultureInfo.CurrentCulture, "code = {0} ({1}), message = {2}",
            _errorCode, (int)_errorCode, base.ToString());
    }
    #endregion
  }

  /// <summary>
  /// SQLite error codes.  Actually, this enumeration represents a return code,
  /// which may also indicate success in one of several ways (e.g. SQLITE_OK,
  /// SQLITE_ROW, and SQLITE_DONE).  Therefore, the name of this enumeration is
  /// something of a misnomer.
  /// </summary>
  public enum SQLiteErrorCode
  {
      /// <summary>
      /// The error code is unknown.  This error code
      /// is only used by the managed wrapper itself.
      /// </summary>
      Unknown = -1,
      /// <summary>
      /// Successful result
      /// </summary>
      Ok /* 0 */,
      /// <summary>
      /// SQL error or missing database
      /// </summary>
      Error /* 1 */,
      /// <summary>
      /// Internal logic error in SQLite
      /// </summary>
      Internal /* 2 */,
      /// <summary>
      /// Access permission denied
      /// </summary>
      Perm /* 3 */,
      /// <summary>
      /// Callback routine requested an abort
      /// </summary>
      Abort /* 4 */,
      /// <summary>
      /// The database file is locked
      /// </summary>
      Busy /* 5 */,
      /// <summary>
      /// A table in the database is locked
      /// </summary>
      Locked /* 6 */,
      /// <summary>
      /// A malloc() failed
      /// </summary>
      NoMem /* 7 */,
      /// <summary>
      /// Attempt to write a readonly database
      /// </summary>
      ReadOnly /* 8 */,
      /// <summary>
      /// Operation terminated by sqlite3_interrupt()
      /// </summary>
      Interrupt /* 9 */,
      /// <summary>
      /// Some kind of disk I/O error occurred
      /// </summary>
      IoErr /* 10 */,
      /// <summary>
      /// The database disk image is malformed
      /// </summary>
      Corrupt /* 11 */,
      /// <summary>
      /// Unknown opcode in sqlite3_file_control()
      /// </summary>
      NotFound /* 12 */,
      /// <summary>
      /// Insertion failed because database is full
      /// </summary>
      Full /* 13 */,
      /// <summary>
      /// Unable to open the database file
      /// </summary>
      CantOpen /* 14 */,
      /// <summary>
      /// Database lock protocol error
      /// </summary>
      Protocol /* 15 */,
      /// <summary>
      /// Database is empty
      /// </summary>
      Empty /* 16 */,
      /// <summary>
      /// The database schema changed
      /// </summary>
      Schema /* 17 */,
      /// <summary>
      /// String or BLOB exceeds size limit
      /// </summary>
      TooBig /* 18 */,
      /// <summary>
      /// Abort due to constraint violation
      /// </summary>
      Constraint /* 19 */,
      /// <summary>
      /// Data type mismatch
      /// </summary>
      Mismatch /* 20 */,
      /// <summary>
      /// Library used incorrectly
      /// </summary>
      Misuse /* 21 */,
      /// <summary>
      /// Uses OS features not supported on host
      /// </summary>
      NoLfs /* 22 */,
      /// <summary>
      /// Authorization denied
      /// </summary>
      Auth /* 23 */,
      /// <summary>
      /// Auxiliary database format error
      /// </summary>
      Format /* 24 */,
      /// <summary>
      /// 2nd parameter to sqlite3_bind out of range
      /// </summary>
      Range /* 25 */,
      /// <summary>
      /// File opened that is not a database file
      /// </summary>
      NotADb /* 26 */,
      /// <summary>
      /// Notifications from sqlite3_log()
      /// </summary>
      Notice /* 27 */,
      /// <summary>
      /// Warnings from sqlite3_log()
      /// </summary>
      Warning /* 28 */,
      /// <summary>
      /// sqlite3_step() has another row ready
      /// </summary>
      Row = 100,
      /// <summary>
      /// sqlite3_step() has finished executing
      /// </summary>
      Done, /* 101 */
      /// <summary>
      /// Used to mask off extended result codes
      /// </summary>
      NonExtendedMask = 0xFF,

      /////////////////////////////////////////////////////////////////////////
      // BEGIN EXTENDED RESULT CODES
      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// A collation sequence was referenced by a schema and it cannot be
      /// found.
      /// </summary>
      Error_Missing_CollSeq = (Error | (1 << 8)),
      /// <summary>
      /// An internal operation failed and it may succeed if retried.
      /// </summary>
      Error_Retry = (Error | (2 << 8)),
      /// <summary>
      /// The specified snapshot has been overwritten by a checkpoint.
      /// </summary>
      Error_Snapshot = (Error | (3 << 8)),
      /// <summary>
      /// A file read operation failed.
      /// </summary>
      IoErr_Read = (IoErr | (1 << 8)),
      /// <summary>
      /// A file read operation returned less data than requested.
      /// </summary>
      IoErr_Short_Read = (IoErr | (2 << 8)),
      /// <summary>
      /// A file write operation failed.
      /// </summary>
      IoErr_Write = (IoErr | (3 << 8)),
      /// <summary>
      /// A file synchronization operation failed.
      /// </summary>
      IoErr_Fsync = (IoErr | (4 << 8)),
      /// <summary>
      /// A directory synchronization operation failed.
      /// </summary>
      IoErr_Dir_Fsync = (IoErr | (5 << 8)),
      /// <summary>
      /// A file truncate operation failed.
      /// </summary>
      IoErr_Truncate = (IoErr | (6 << 8)),
      /// <summary>
      /// A file metadata operation failed.
      /// </summary>
      IoErr_Fstat = (IoErr | (7 << 8)),
      /// <summary>
      /// A file unlock operation failed.
      /// </summary>
      IoErr_Unlock = (IoErr | (8 << 8)),
      /// <summary>
      /// A file lock operation failed.
      /// </summary>
      IoErr_RdLock = (IoErr | (9 << 8)),
      /// <summary>
      /// A file delete operation failed.
      /// </summary>
      IoErr_Delete = (IoErr | (10 << 8)),
      /// <summary>
      /// Not currently used.
      /// </summary>
      IoErr_Blocked = (IoErr | (11 << 8)),
      /// <summary>
      /// Out-of-memory during a file operation.
      /// </summary>
      IoErr_NoMem = (IoErr | (12 << 8)),
      /// <summary>
      /// A file existence/status operation failed.
      /// </summary>
      IoErr_Access = (IoErr | (13 << 8)),
      /// <summary>
      /// A check for a reserved lock failed.
      /// </summary>
      IoErr_CheckReservedLock = (IoErr | (14 << 8)),
      /// <summary>
      /// A file lock operation failed.
      /// </summary>
      IoErr_Lock = (IoErr | (15 << 8)),
      /// <summary>
      /// A file close operation failed.
      /// </summary>
      IoErr_Close = (IoErr | (16 << 8)),
      /// <summary>
      /// A directory close operation failed.
      /// </summary>
      IoErr_Dir_Close = (IoErr | (17 << 8)),
      /// <summary>
      /// A shared memory open operation failed.
      /// </summary>
      IoErr_ShmOpen = (IoErr | (18 << 8)),
      /// <summary>
      /// A shared memory size operation failed.
      /// </summary>
      IoErr_ShmSize = (IoErr | (19 << 8)),
      /// <summary>
      /// A shared memory lock operation failed.
      /// </summary>
      IoErr_ShmLock = (IoErr | (20 << 8)),
      /// <summary>
      /// A shared memory map operation failed.
      /// </summary>
      IoErr_ShmMap = (IoErr | (21 << 8)),
      /// <summary>
      /// A file seek operation failed.
      /// </summary>
      IoErr_Seek = (IoErr | (22 << 8)),
      /// <summary>
      /// A file delete operation failed because it does not exist.
      /// </summary>
      IoErr_Delete_NoEnt = (IoErr | (23 << 8)),
      /// <summary>
      /// A file memory mapping operation failed.
      /// </summary>
      IoErr_Mmap = (IoErr | (24 << 8)),
      /// <summary>
      /// The temporary directory path could not be obtained.
      /// </summary>
      IoErr_GetTempPath = (IoErr | (25 << 8)),
      /// <summary>
      /// A path string conversion operation failed.
      /// </summary>
      IoErr_ConvPath = (IoErr | (26 << 8)),
      /// <summary>
      /// Reserved.
      /// </summary>
      IoErr_VNode = (IoErr | (27 << 8)),
      /// <summary>
      /// An attempt to authenticate failed.
      /// </summary>
      IoErr_Auth = (IoErr | (28 << 8)),
      /// <summary>
      /// An attempt to begin a file system transaction failed.
      /// </summary>
      IoErr_Begin_Atomic = (IoErr | (29 << 8)),
      /// <summary>
      /// An attempt to commit a file system transaction failed.
      /// </summary>
      IoErr_Commit_Atomic = (IoErr | (30 << 8)),
      /// <summary>
      /// An attempt to rollback a file system transaction failed.
      /// </summary>
      IoErr_Rollback_Atomic = (IoErr | (31 << 8)),
      /// <summary>
      /// Data read from the file system appears to be incorrect.
      /// </summary>
      IoErr_Data = (IoErr | (32 << 8)),
      /// <summary>
      /// File system corruption was detected during a read or write.
      /// </summary>
      IoErr_CorruptFs = (IoErr | (33 << 8)),
      /// <summary>
      /// A database table is locked in shared-cache mode.
      /// </summary>
      Locked_SharedCache = (Locked | (1 << 8)),
      /// <summary>
      /// A virtual table in the database is locked.
      /// </summary>
      Locked_Vtab = (Locked | (2 << 8)),
      /// <summary>
      /// A database file is locked due to a recovery operation.
      /// </summary>
      Busy_Recovery = (Busy | (1 << 8)),
      /// <summary>
      /// A database file is locked due to snapshot semantics.
      /// </summary>
      Busy_Snapshot = (Busy | (2 << 8)),
      /// <summary>
      /// An internal timeout was encountered while waiting for a database lock.
      /// </summary>
      Busy_Timeout = (Busy | (3 << 8)),
      /// <summary>
      /// A database file cannot be opened because no temporary directory is available.
      /// </summary>
      CantOpen_NoTempDir = (CantOpen | (1 << 8)),
      /// <summary>
      /// A database file cannot be opened because its path represents a directory.
      /// </summary>
      CantOpen_IsDir = (CantOpen | (2 << 8)),
      /// <summary>
      /// A database file cannot be opened because its full path could not be obtained.
      /// </summary>
      CantOpen_FullPath = (CantOpen | (3 << 8)),
      /// <summary>
      /// A database file cannot be opened because a path string conversion operation failed.
      /// </summary>
      CantOpen_ConvPath = (CantOpen | (4 << 8)),
      /// <summary>
      /// No longer used.
      /// </summary>
      CantOpen_DirtyWal = (CantOpen | (5 << 8)),
      /// <summary>
      /// A database file is a symbolic link and cannot be opened.
      /// </summary>
      CantOpen_SymLink = (CantOpen | (6 << 8)),
      /// <summary>
      /// A virtual table is malformed.
      /// </summary>
      Corrupt_Vtab = (Corrupt | (1 << 8)),
      /// <summary>
      /// A required sequence table is missing or corrupt.
      /// </summary>
      Corrupt_Sequence = (Corrupt | (2 << 8)),
      /// <summary>
      /// An index entry that should be present is missing.
      /// </summary>
      Corrupt_Index = (Corrupt | (3 << 8)),
      /// <summary>
      /// A database file is read-only due to a recovery operation.
      /// </summary>
      ReadOnly_Recovery = (ReadOnly | (1 << 8)),
      /// <summary>
      /// A database file is read-only because a lock could not be obtained.
      /// </summary>
      ReadOnly_CantLock = (ReadOnly | (2 << 8)),
      /// <summary>
      /// A database file is read-only because it needs rollback processing.
      /// </summary>
      ReadOnly_Rollback = (ReadOnly | (3 << 8)),
      /// <summary>
      /// A database file is read-only because it was moved while open.
      /// </summary>
      ReadOnly_DbMoved = (ReadOnly | (4 << 8)),
      /// <summary>
      /// The shared-memory file is read-only and it should be read-write.
      /// </summary>
      ReadOnly_CantInit = (ReadOnly | (5 << 8)),
      /// <summary>
      /// Unable to create journal file because the directory is read-only.
      /// </summary>
      ReadOnly_Directory = (ReadOnly | (6 << 8)),
      /// <summary>
      /// An operation is being aborted due to rollback processing.
      /// </summary>
      Abort_Rollback = (Abort | (2 << 8)),
      /// <summary>
      /// A CHECK constraint failed.
      /// </summary>
      Constraint_Check = (Constraint | (1 << 8)),
      /// <summary>
      /// A commit hook produced a unsuccessful return code.
      /// </summary>
      Constraint_CommitHook = (Constraint | (2 << 8)),
      /// <summary>
      /// A FOREIGN KEY constraint failed.
      /// </summary>
      Constraint_ForeignKey = (Constraint | (3 << 8)),
      /// <summary>
      /// Not currently used.
      /// </summary>
      Constraint_Function = (Constraint | (4 << 8)),
      /// <summary>
      /// A NOT NULL constraint failed.
      /// </summary>
      Constraint_NotNull = (Constraint | (5 << 8)),
      /// <summary>
      /// A PRIMARY KEY constraint failed.
      /// </summary>
      Constraint_PrimaryKey = (Constraint | (6 << 8)),
      /// <summary>
      /// The RAISE function was used by a trigger-program.
      /// </summary>
      Constraint_Trigger = (Constraint | (7 << 8)),
      /// <summary>
      /// A UNIQUE constraint failed.
      /// </summary>
      Constraint_Unique = (Constraint | (8 << 8)),
      /// <summary>
      /// Not currently used.
      /// </summary>
      Constraint_Vtab = (Constraint | (9 << 8)),
      /// <summary>
      /// A ROWID constraint failed.
      /// </summary>
      Constraint_RowId = (Constraint | (10 << 8)),
      /// <summary>
      /// A database cursor is busy and cannot be moved.
      /// </summary>
      Constraint_Pinned = (Constraint |(11 << 8)),
      /// <summary>
      /// Value does not conform to specified data type.
      /// </summary>
      Constraint_DataType = (Constraint | (12 << 8)),
      /// <summary>
      /// Frames were recovered from the WAL log file.
      /// </summary>
      Notice_Recover_Wal = (Notice | (1 << 8)),
      /// <summary>
      /// Pages were recovered from the journal file.
      /// </summary>
      Notice_Recover_Rollback = (Notice | (2 << 8)),
      /// <summary>
      /// May be returned for spurious errors that can occur when applying
      /// an RBU update.
      /// </summary>
      Notice_Rbu = (Notice | (3 << 8)),
      /// <summary>
      /// An automatic index was created to process a query.
      /// </summary>
      Warning_AutoIndex = (Warning | (1 << 8)),
      /// <summary>
      /// User authentication failed.
      /// </summary>
      Auth_User = (Auth | (1 << 8)),
      /// <summary>
      /// Success.  Prevents the extension from unloading until the process
      /// terminates.
      /// </summary>
      Ok_Load_Permanently = (Ok | (1 << 8)),
      /// <summary>
      /// Success.  The specified file name refers to a symbolic link.
      /// </summary>
      Ok_SymLink = (Ok | (2 << 8))
  }
}

Changes to System.Data.SQLite/SQLiteFactory.cs.

8
9
10
11
12
13
14
15
16
17
18
19




















































































20
21
22
23
24
25
26
27
28
29

30
31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
46
47

48
49
50
51
52
53
54
55
56

57
58
59
60
61
62
63
64
65

66
67
68
69
70
71
72
73
74

75
76
77
78
79
namespace System.Data.SQLite
{
  using System;
  using System.Data.Common;

#if !PLATFORM_COMPACTFRAMEWORK
  /// <summary>
  /// SQLite implementation of DbProviderFactory.
  /// </summary>
  public sealed partial class SQLiteFactory : DbProviderFactory
  {
    /// <summary>




















































































    /// Static instance member which returns an instanced SQLiteFactory class.
    /// </summary>
    public static readonly SQLiteFactory Instance = new SQLiteFactory();

    /// <summary>
    /// Returns a new SQLiteCommand object.
    /// </summary>
    /// <returns>A SQLiteCommand object.</returns>
    public override DbCommand CreateCommand()
    {

      return new SQLiteCommand();
    }

    /// <summary>
    /// Returns a new SQLiteCommandBuilder object.
    /// </summary>
    /// <returns>A SQLiteCommandBuilder object.</returns>
    public override DbCommandBuilder CreateCommandBuilder()
    {

      return new SQLiteCommandBuilder();
    }

    /// <summary>
    /// Creates a new SQLiteConnection.
    /// </summary>
    /// <returns>A SQLiteConnection object.</returns>
    public override DbConnection CreateConnection()
    {

      return new SQLiteConnection();
    }

    /// <summary>
    /// Creates a new SQLiteConnectionStringBuilder.
    /// </summary>
    /// <returns>A SQLiteConnectionStringBuilder object.</returns>
    public override DbConnectionStringBuilder CreateConnectionStringBuilder()
    {

      return new SQLiteConnectionStringBuilder();
    }

    /// <summary>
    /// Creates a new SQLiteDataAdapter.
    /// </summary>
    /// <returns>A SQLiteDataAdapter object.</returns>
    public override DbDataAdapter CreateDataAdapter()
    {

      return new SQLiteDataAdapter();
    }

    /// <summary>
    /// Creates a new SQLiteParameter.
    /// </summary>
    /// <returns>A SQLiteParameter object.</returns>
    public override DbParameter CreateParameter()
    {

      return new SQLiteParameter();
    }
  }
#endif
}







|

|


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




|

|


>




|

|


>




|

|


>




|

|


>




|

|


>




|

|


>





8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
namespace System.Data.SQLite
{
  using System;
  using System.Data.Common;

#if !PLATFORM_COMPACTFRAMEWORK
  /// <summary>
  /// SQLite implementation of <see cref="DbProviderFactory" />.
  /// </summary>
  public sealed partial class SQLiteFactory : DbProviderFactory, IDisposable
  {
    /// <summary>
    /// Constructs a new instance.
    /// </summary>
    public SQLiteFactory()
    {
        //
        // NOTE: Do nothing here now.  All the logging setup related code has
        //       been moved to the new SQLiteLog static class.
        //
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable Members
    /// <summary>
    /// Cleans up resources (native and managed) associated with the current instance.
    /// </summary>
    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable "Pattern" Members
    private bool disposed;
    private void CheckDisposed() /* throw */
    {
#if THROW_ON_DISPOSED
        if (disposed)
            throw new ObjectDisposedException(typeof(SQLiteFactory).Name);
#endif
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private void Dispose(bool disposing)
    {
        if (!disposed)
        {
            //if (disposing)
            //{
            //    ////////////////////////////////////
            //    // dispose managed resources here...
            //    ////////////////////////////////////
            //}

            //////////////////////////////////////
            // release unmanaged resources here...
            //////////////////////////////////////

            disposed = true;
        }
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region Destructor
    /// <summary>
    /// Cleans up resources associated with the current instance.
    /// </summary>
    ~SQLiteFactory()
    {
        Dispose(false);
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// This event is raised whenever SQLite raises a logging event.
    /// Note that this should be set as one of the first things in the
    /// application.  This event is provided for backward compatibility only.
    /// New code should use the <see cref="SQLiteLog" /> class instead.
    /// </summary>
    public event SQLiteLogEventHandler Log
    {
      add { CheckDisposed(); SQLiteLog.Log += value; }
      remove { CheckDisposed(); SQLiteLog.Log -= value; }
    }

    /// <summary>
    /// Static instance member which returns an instanced <see cref="SQLiteFactory" /> class.
    /// </summary>
    public static readonly SQLiteFactory Instance = new SQLiteFactory();

    /// <summary>
    /// Creates and returns a new <see cref="SQLiteCommand" /> object.
    /// </summary>
    /// <returns>The new object.</returns>
    public override DbCommand CreateCommand()
    {
      CheckDisposed();
      return new SQLiteCommand();
    }

    /// <summary>
    /// Creates and returns a new <see cref="SQLiteCommandBuilder" /> object.
    /// </summary>
    /// <returns>The new object.</returns>
    public override DbCommandBuilder CreateCommandBuilder()
    {
      CheckDisposed();
      return new SQLiteCommandBuilder();
    }

    /// <summary>
    /// Creates and returns a new <see cref="SQLiteConnection" /> object.
    /// </summary>
    /// <returns>The new object.</returns>
    public override DbConnection CreateConnection()
    {
      CheckDisposed();
      return new SQLiteConnection();
    }

    /// <summary>
    /// Creates and returns a new <see cref="SQLiteConnectionStringBuilder" /> object.
    /// </summary>
    /// <returns>The new object.</returns>
    public override DbConnectionStringBuilder CreateConnectionStringBuilder()
    {
      CheckDisposed();
      return new SQLiteConnectionStringBuilder();
    }

    /// <summary>
    /// Creates and returns a new <see cref="SQLiteDataAdapter" /> object.
    /// </summary>
    /// <returns>The new object.</returns>
    public override DbDataAdapter CreateDataAdapter()
    {
      CheckDisposed();
      return new SQLiteDataAdapter();
    }

    /// <summary>
    /// Creates and returns a new <see cref="SQLiteParameter" /> object.
    /// </summary>
    /// <returns>The new object.</returns>
    public override DbParameter CreateParameter()
    {
      CheckDisposed();
      return new SQLiteParameter();
    }
  }
#endif
}

Changes to System.Data.SQLite/SQLiteFunction.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14


























































































15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

37
38


39
40
41
42
43
44
45
46
47
48






49
50
51
52
53
54
55
56
57
58
59
60
61
62
63









64
65
66
67









68
69
70
71
72
73
74

75

76
77
78
79
80
81
82
83
84
85

























































































































86
87
88
89
90
91
92
93
94

95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112

113
114
115
116
117
118
119
120
121
122
123
124
125
126

127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
















147
148
149
150













151
152
153
154
155
156
157

158
159































































































































160
161
162
163
164
165
166
167
168
169
170

171
172








173
174
175
176
177
178
179
180






181
182
183
184
185
186
187
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Collections;
  using System.Collections.Generic;
  using System.Runtime.InteropServices;
  using System.Globalization;



























































































  /// <summary>
  /// This abstract class is designed to handle user-defined functions easily.  An instance of the derived class is made for each
  /// connection to the database.
  /// </summary>
  /// <remarks>
  /// Although there is one instance of a class derived from SQLiteFunction per database connection, the derived class has no access
  /// to the underlying connection.  This is necessary to deter implementers from thinking it would be a good idea to make database
  /// calls during processing.
  /// 
  /// It is important to distinguish between a per-connection instance, and a per-SQL statement context.  One instance of this class
  /// services all SQL statements being stepped through on that connection, and there can be many.  One should never store per-statement
  /// information in member variables of user-defined function classes.
  /// 
  /// For aggregate functions, always create and store your per-statement data in the contextData object on the 1st step.  This data will
  /// be automatically freed for you (and Dispose() called if the item supports IDisposable) when the statement completes.
  /// </remarks>
  public abstract class SQLiteFunction : IDisposable
  {
    private class AggregateData
    {
      internal int _count = 1;

      internal object _data;
    }



    /// <summary>
    /// The base connection this function is attached to
    /// </summary>
    internal SQLiteBase              _base;

    /// <summary>
    /// Internal array used to keep track of aggregate function context data
    /// </summary>
    private Dictionary<long, AggregateData> _contextDataList;







    /// <summary>
    /// Holds a reference to the callback function for user functions
    /// </summary>
    private SQLiteCallback  _InvokeFunc;
    /// <summary>
    /// Holds a reference to the callbakc function for stepping in an aggregate function
    /// </summary>
    private SQLiteCallback  _StepFunc;
    /// <summary>
    /// Holds a reference to the callback function for finalizing an aggregate function
    /// </summary>
    private SQLiteFinalCallback  _FinalFunc;
    /// <summary>
    /// Holds a reference to the callback function for collation sequences









    /// </summary>
    private SQLiteCollation _CompareFunc;

    private SQLiteCollation _CompareFunc16;










    /// <summary>
    /// Current context of the current callback.  Only valid during a callback
    /// </summary>
    internal IntPtr _context;

    /// <summary>

    /// This static list contains all the user-defined functions declared using the proper attributes.

    /// </summary>
    private static List<SQLiteFunctionAttribute> _registeredFunctions;

    /// <summary>
    /// Internal constructor, initializes the function's internal variables.
    /// </summary>
    protected SQLiteFunction()
    {
      _contextDataList = new Dictionary<long, AggregateData>();
    }


























































































































    /// <summary>
    /// Returns a reference to the underlying connection's SQLiteConvert class, which can be used to convert
    /// strings and DateTime's into the current connection's encoding schema.
    /// </summary>
    public SQLiteConvert SQLiteConvert
    {
      get
      {

        return _base;
      }
    }

    /// <summary>
    /// Scalar functions override this method to do their magic.
    /// </summary>
    /// <remarks>
    /// Parameters passed to functions have only an affinity for a certain data type, there is no underlying schema available
    /// to force them into a certain type.  Therefore the only types you will ever see as parameters are
    /// DBNull.Value, Int64, Double, String or byte[] array.
    /// </remarks>
    /// <param name="args">The arguments for the command to process</param>
    /// <returns>You may return most simple types as a return value, null or DBNull.Value to return null, DateTime, or
    /// you may return an Exception-derived class if you wish to return an error to SQLite.  Do not actually throw the error,
    /// just return it!</returns>
    public virtual object Invoke(object[] args)
    {

      return null;
    }

    /// <summary>
    /// Aggregate functions override this method to do their magic.
    /// </summary>
    /// <remarks>
    /// Typically you'll be updating whatever you've placed in the contextData field and returning as quickly as possible.
    /// </remarks>
    /// <param name="args">The arguments for the command to process</param>
    /// <param name="stepNumber">The 1-based step number.  This is incrememted each time the step method is called.</param>
    /// <param name="contextData">A placeholder for implementers to store contextual data pertaining to the current context.</param>
    public virtual void Step(object[] args, int stepNumber, ref object contextData)
    {

    }

    /// <summary>
    /// Aggregate functions override this method to finish their aggregate processing.
    /// </summary>
    /// <remarks>
    /// If you implemented your aggregate function properly,
    /// you've been recording and keeping track of your data in the contextData object provided, and now at this stage you should have
    /// all the information you need in there to figure out what to return.
    /// NOTE:  It is possible to arrive here without receiving a previous call to Step(), in which case the contextData will
    /// be null.  This can happen when no rows were returned.  You can either return null, or 0 or some other custom return value
    /// if that is the case.
    /// </remarks>
    /// <param name="contextData">Your own assigned contextData, provided for you so you can return your final results.</param>
    /// <returns>You may return most simple types as a return value, null or DBNull.Value to return null, DateTime, or
    /// you may return an Exception-derived class if you wish to return an error to SQLite.  Do not actually throw the error,
    /// just return it!
    /// </returns>
    public virtual object Final(object contextData)
    {
















      return null;
    }

    /// <summary>













    /// User-defined collation sequences override this method to provide a custom string sorting algorithm.
    /// </summary>
    /// <param name="param1">The first string to compare</param>
    /// <param name="param2">The second strnig to compare</param>
    /// <returns>1 if param1 is greater than param2, 0 if they are equal, or -1 if param1 is less than param2</returns>
    public virtual int Compare(string param1, string param2)
    {

      return 0;
    }
































































































































    /// <summary>
    /// Converts an IntPtr array of context arguments to an object array containing the resolved parameters the pointers point to.
    /// </summary>
    /// <remarks>
    /// Parameters passed to functions have only an affinity for a certain data type, there is no underlying schema available
    /// to force them into a certain type.  Therefore the only types you will ever see as parameters are
    /// DBNull.Value, Int64, Double, String or byte[] array.
    /// </remarks>
    /// <param name="nArgs">The number of arguments</param>
    /// <param name="argsptr">A pointer to the array of arguments</param>

    /// <returns>An object array of the arguments once they've been converted to .NET values</returns>
    internal object[] ConvertParams(int nArgs, IntPtr argsptr)








    {
      object[] parms = new object[nArgs];
#if !PLATFORM_COMPACTFRAMEWORK
      IntPtr[] argint = new IntPtr[nArgs];
#else
      int[] argint = new int[nArgs];
#endif
      Marshal.Copy(argsptr, argint, 0, nArgs);







      for (int n = 0; n < nArgs; n++)
      {
        switch (_base.GetParamValueType((IntPtr)argint[n]))
        {
          case TypeAffinity.Null:
            parms[n] = DBNull.Value;



|






<



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









|



|







|
>


>
>









|
>
>
>
>
>
>






|







|
>
>
>
>
>
>
>
>
>




>
>
>
>
>
>
>
>
>







>
|
>

|






|

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









>


















>














>




















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




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

|
|
|


>


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











>

|
>
>
>
>
>
>
>
>








>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;

  using System.Collections.Generic;
  using System.Runtime.InteropServices;
  using System.Globalization;

  /// <summary>
  /// These constants are used with the sqlite3_create_function() API, et al.
  /// </summary>
  [Flags()]
  public enum SQLiteFunctionFlags
  {
    /// <summary>
    /// Initial flags value, no flags set.
    /// </summary>
    NONE = 0x0,
    /// <summary>
    /// The function uses UTF-8.
    /// </summary>
    SQLITE_UTF8 = 0x1,
    /// <summary>
    /// The function uses little-endian UTF-16.
    /// </summary>
    SQLITE_UTF16LE = 0x2,
    /// <summary>
    /// The function uses big-endian UTF-16.
    /// </summary>
    SQLITE_UTF16BE = 0x3,
    /// <summary>
    /// The function uses UTF-16 in native byte order.
    /// </summary>
    SQLITE_UTF16 = 0x4,
    /// <summary>
    /// Deprecated, do not use.
    /// </summary>
    SQLITE_ANY = 0x5,
    /// <summary>
    /// For sqlite3_create_collation() only, do not use.
    /// </summary>
    SQLITE_UTF16_ALIGNED = 0x8,
    /// <summary>
    /// Used to mask off the flags related to encodings.
    /// </summary>
    ENCODING_MASK = SQLITE_UTF8 | SQLITE_UTF16LE | SQLITE_UTF16BE |
                    SQLITE_UTF16 | SQLITE_ANY | SQLITE_UTF16_ALIGNED, /* 0xF */
    /// <summary>
    /// The new function always gives the same output when the input parameters
    /// are the same. The abs() function is deterministic, for example, but
    /// randomblob() is not. Functions must be deterministic in order to be used
    /// in certain contexts such as with the WHERE clause of partial indexes or
    /// in generated columns. SQLite might also optimize deterministic functions
    /// by factoring them out of inner loops.
    /// </summary>
    SQLITE_DETERMINISTIC = 0x800,
    /// <summary>
    /// The function may only be invoked from top-level SQL, and cannot be used
    /// in VIEWs or TRIGGERs nor in schema structures such as CHECK constraints,
    /// DEFAULT clauses, expression indexes, partial indexes, or generated columns.
    /// The SQLITE_DIRECTONLY flags is a security feature which is recommended for
    /// all application-defined SQL functions, and especially for functions that
    /// have side-effects or that could potentially leak sensitive information.
    /// </summary>
    SQLITE_DIRECTONLY = 0x80000,
    /// <summary>
    /// The function may call sqlite3_value_subtype() to inspect the sub-types of
    /// its arguments. Specifying this flag makes no difference for scalar or
    /// aggregate user functions. However, if it is not specified for a user-defined
    /// window function, then any sub-types belonging to arguments passed to the
    /// window function may be discarded before the window function is called
    /// (i.e. sqlite3_value_subtype() will always return 0).
    /// </summary>
    SQLITE_SUBTYPE = 0x100000,
    /// <summary>
    /// The function is unlikely to cause problems even if misused. An innocuous
    /// function should have no side effects and should not depend on any values
    /// other than its input parameters. The abs() function is an example of an
    /// innocuous function. The load_extension() SQL function is not innocuous
    /// because of its side effects.
    ///
    /// SQLITE_INNOCUOUS is similar to SQLITE_DETERMINISTIC, but is not exactly
    /// the same. The random() function is an example of a function that is
    /// innocuous but not deterministic.
    ///
    /// Some heightened security settings (SQLITE_DBCONFIG_TRUSTED_SCHEMA and
    /// PRAGMA trusted_schema=OFF) disable the use of SQL functions inside views
    /// and triggers and in schema structures such as CHECK constraints, DEFAULT
    /// clauses, expression indexes, partial indexes, and generated columns unless
    /// the function is tagged with SQLITE_INNOCUOUS. Most built-in functions are
    /// innocuous. Developers are advised to avoid using the SQLITE_INNOCUOUS flag
    /// for application-defined functions unless the function has been carefully
    /// audited and found to be free of potentially security-adverse side-effects
    /// and information-leaks.
    /// </summary>
    SQLITE_INNOCUOUS = 0x200000
  }

  /// <summary>
  /// This abstract class is designed to handle user-defined functions easily.  An instance of the derived class is made for each
  /// connection to the database.
  /// </summary>
  /// <remarks>
  /// Although there is one instance of a class derived from SQLiteFunction per database connection, the derived class has no access
  /// to the underlying connection.  This is necessary to deter implementers from thinking it would be a good idea to make database
  /// calls during processing.
  ///
  /// It is important to distinguish between a per-connection instance, and a per-SQL statement context.  One instance of this class
  /// services all SQL statements being stepped through on that connection, and there can be many.  One should never store per-statement
  /// information in member variables of user-defined function classes.
  ///
  /// For aggregate functions, always create and store your per-statement data in the contextData object on the 1st step.  This data will
  /// be automatically freed for you (and Dispose() called if the item supports IDisposable) when the statement completes.
  /// </remarks>
  public abstract class SQLiteFunction : IDisposable
  {
    private class AggregateData
    {
      internal int _stepCount = 1;
      internal int _inverseCount = 1;
      internal object _data;
    }

    /////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// The base connection this function is attached to
    /// </summary>
    internal SQLiteBase              _base;

    /// <summary>
    /// Internal array used to keep track of aggregate function context data
    /// </summary>
    private Dictionary<IntPtr, AggregateData> _contextDataList;

    /// <summary>
    /// The connection flags associated with this object (this should be the
    /// same value as the flags associated with the parent connection object).
    /// </summary>
    private SQLiteConnectionFlags _flags;

    /// <summary>
    /// Holds a reference to the callback function for user functions
    /// </summary>
    private SQLiteCallback  _InvokeFunc;
    /// <summary>
    /// Holds a reference to the callback function for stepping in an aggregate function
    /// </summary>
    private SQLiteCallback  _StepFunc;
    /// <summary>
    /// Holds a reference to the callback function for finalizing an aggregate function
    /// </summary>
    private SQLiteFinalCallback  _FinalFunc;
    /// <summary>
    /// Holds a reference to the callback function for getting a window function value
    /// </summary>
    private SQLiteFinalCallback _ValueFunc;
    /// <summary>
    /// Holds a reference to the callback function for inverse in a window function
    /// </summary>
    private SQLiteCallback _InverseFunc;

    /// <summary>
    /// Holds a reference to the callback function for collating sequences
    /// </summary>
    private SQLiteCollation _CompareFunc;

    private SQLiteCollation _CompareFunc16;

    /// <summary>
    /// Raw parameter pointers for the current callback.  Only valid during a callback.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    private IntPtr[] _params;
#else
    private int[] _params;
#endif

    /// <summary>
    /// Current context of the current callback.  Only valid during a callback
    /// </summary>
    internal IntPtr _context;

    /// <summary>
    /// This static dictionary contains all the registered (known) user-defined
    /// functions declared using the proper attributes.  The contained dictionary
    /// values are always null and are not currently used.
    /// </summary>
    private static IDictionary<SQLiteFunctionAttribute, object> _registeredFunctions;

    /// <summary>
    /// Internal constructor, initializes the function's internal variables.
    /// </summary>
    protected SQLiteFunction()
    {
      _contextDataList = new Dictionary<IntPtr, AggregateData>();
    }

    /// <summary>
    /// Constructs an instance of this class using the specified data-type
    /// conversion parameters.
    /// </summary>
    /// <param name="format">
    /// The DateTime format to be used when converting string values to a
    /// DateTime and binding DateTime parameters.
    /// </param>
    /// <param name="kind">
    /// The <see cref="DateTimeKind" /> to be used when creating DateTime
    /// values.
    /// </param>
    /// <param name="formatString">
    /// The format string to be used when parsing and formatting DateTime
    /// values.
    /// </param>
    /// <param name="utf16">
    /// Non-zero to create a UTF-16 data-type conversion context; otherwise,
    /// a UTF-8 data-type conversion context will be created.
    /// </param>
    protected SQLiteFunction(
        SQLiteDateFormats format,
        DateTimeKind kind,
        string formatString,
        bool utf16
        )
        : this()
    {
        if (utf16)
            _base = new SQLite3_UTF16(format, kind, formatString, IntPtr.Zero, null, false);
        else
            _base = new SQLite3(format, kind, formatString, IntPtr.Zero, null, false);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable Members
    /// <summary>
    /// Disposes of any active contextData variables that were not automatically cleaned up.  Sometimes this can happen if
    /// someone closes the connection while a DataReader is open.
    /// </summary>
    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable "Pattern" Members
    private bool disposed;
    private void CheckDisposed() /* throw */
    {
#if THROW_ON_DISPOSED
        if (disposed)
            throw new ObjectDisposedException(typeof(SQLiteFunction).Name);
#endif
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Placeholder for a user-defined disposal routine
    /// </summary>
    /// <param name="disposing">True if the object is being disposed explicitly</param>
    protected virtual void Dispose(bool disposing)
    {
        if (!disposed)
        {
            if (disposing)
            {
                ////////////////////////////////////
                // dispose managed resources here...
                ////////////////////////////////////

                IDisposable disp;

                foreach (KeyValuePair<IntPtr, AggregateData> kv in _contextDataList)
                {
                    disp = kv.Value._data as IDisposable;
                    if (disp != null)
                        disp.Dispose();
                }
                _contextDataList.Clear();
                _contextDataList = null;

                _flags = SQLiteConnectionFlags.None;

                _InvokeFunc = null;
                _StepFunc = null;
                _FinalFunc = null;
                _ValueFunc = null;
                _InverseFunc = null;
                _CompareFunc = null;
                _base = null;
            }

            //////////////////////////////////////
            // release unmanaged resources here...
            //////////////////////////////////////

            disposed = true;
        }
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region Destructor
    /// <summary>
    /// Cleans up resources associated with the current instance.
    /// </summary>
    ~SQLiteFunction()
    {
        Dispose(false);
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Returns a reference to the underlying connection's SQLiteConvert class, which can be used to convert
    /// strings and DateTime's into the current connection's encoding schema.
    /// </summary>
    public SQLiteConvert SQLiteConvert
    {
      get
      {
        CheckDisposed();
        return _base;
      }
    }

    /// <summary>
    /// Scalar functions override this method to do their magic.
    /// </summary>
    /// <remarks>
    /// Parameters passed to functions have only an affinity for a certain data type, there is no underlying schema available
    /// to force them into a certain type.  Therefore the only types you will ever see as parameters are
    /// DBNull.Value, Int64, Double, String or byte[] array.
    /// </remarks>
    /// <param name="args">The arguments for the command to process</param>
    /// <returns>You may return most simple types as a return value, null or DBNull.Value to return null, DateTime, or
    /// you may return an Exception-derived class if you wish to return an error to SQLite.  Do not actually throw the error,
    /// just return it!</returns>
    public virtual object Invoke(object[] args)
    {
      CheckDisposed();
      return null;
    }

    /// <summary>
    /// Aggregate functions override this method to do their magic.
    /// </summary>
    /// <remarks>
    /// Typically you'll be updating whatever you've placed in the contextData field and returning as quickly as possible.
    /// </remarks>
    /// <param name="args">The arguments for the command to process</param>
    /// <param name="stepNumber">The 1-based step number.  This is incrememted each time the step method is called.</param>
    /// <param name="contextData">A placeholder for implementers to store contextual data pertaining to the current context.</param>
    public virtual void Step(object[] args, int stepNumber, ref object contextData)
    {
      CheckDisposed();
    }

    /// <summary>
    /// Aggregate functions override this method to finish their aggregate processing.
    /// </summary>
    /// <remarks>
    /// If you implemented your aggregate function properly,
    /// you've been recording and keeping track of your data in the contextData object provided, and now at this stage you should have
    /// all the information you need in there to figure out what to return.
    /// NOTE:  It is possible to arrive here without receiving a previous call to Step(), in which case the contextData will
    /// be null.  This can happen when no rows were returned.  You can either return null, or 0 or some other custom return value
    /// if that is the case.
    /// </remarks>
    /// <param name="contextData">Your own assigned contextData, provided for you so you can return your final results.</param>
    /// <returns>You may return most simple types as a return value, null or DBNull.Value to return null, DateTime, or
    /// you may return an Exception-derived class if you wish to return an error to SQLite.  Do not actually throw the error,
    /// just return it!
    /// </returns>
    public virtual object Final(object contextData)
    {
      CheckDisposed();
      return null;
    }

    /// <summary>
    /// This method is only required window aggregate functions, not legacy aggregate function implementations. It is invoked to
    /// return the current value of the aggregate. Unlike xFinal, the implementation should not delete any context.
    /// </summary>
    /// <param name="contextData">Your own assigned contextData, provided for you so you can return your final results.</param>
    /// <returns>You may return most simple types as a return value, null or DBNull.Value to return null, DateTime, or
    /// you may return an Exception-derived class if you wish to return an error to SQLite.  Do not actually throw the error,
    /// just return it!
    /// </returns>
    public virtual object Value(object contextData)
    {
      CheckDisposed();
      return null;
    }

    /// <summary>
    /// This method is only required for window aggregate functions, not legacy aggregate function implementations. It is invoked
    /// to remove the oldest presently aggregated result of xStep from the current window. The function arguments, if any, are
    /// those passed to xStep for the row being removed.
    /// </summary>
    /// <param name="args">The arguments for the command to process</param>
    /// <param name="stepNumber">The 1-based step number.  This is incrememted each time the step method is called.</param>
    /// <param name="contextData">A placeholder for implementers to store contextual data pertaining to the current context.</param>
    public virtual void Inverse(object[] args, int stepNumber, ref object contextData)
    {
      CheckDisposed();
    }

    /// <summary>
    /// User-defined collating sequences override this method to provide a custom string sorting algorithm.
    /// </summary>
    /// <param name="param1">The first string to compare.</param>
    /// <param name="param2">The second strnig to compare.</param>
    /// <returns>1 if param1 is greater than param2, 0 if they are equal, or -1 if param1 is less than param2.</returns>
    public virtual int Compare(string param1, string param2)
    {
      CheckDisposed();
      return 0;
    }

    /// <summary>
    /// Gets and returns the sub-type associated with the specified function parameter.
    /// </summary>
    /// <param name="index">
    /// The parameter index to check.
    /// </param>
    /// <returns>
    /// The sub-type associated with the specified function parameter.
    /// </returns>
#pragma warning disable 3002
    public uint GetParameterSubType(int index)
    {
      CheckDisposed();
      CheckParameterIndex(index);
      return _base.GetParamValueSubType((IntPtr)_params[index]);
    }
#pragma warning restore 3002

    /// <summary>
    /// Attempts to convert the specified function parameter to numeric and
    /// then gets and returns the new type affinity associated with this
    /// value.
    /// </summary>
    /// <param name="index">
    /// The parameter index to check.
    /// </param>
    /// <returns>
    /// The new type affinity associated with this value.
    /// </returns>
    public TypeAffinity GetParameterNumericType(int index)
    {
      CheckDisposed();
      CheckParameterIndex(index);
      return _base.GetParamValueNumericType((IntPtr)_params[index]);
    }

    /// <summary>
    /// Gets and returns the "no change" flag associated with the specified
    /// function parameter.  This method can only be used while within a call
    /// to the <see cref="ISQLiteNativeModule.xUpdate" /> method of a virtual
    /// table implementation.
    /// </summary>
    /// <param name="index">
    /// The parameter index to check.
    /// </param>
    /// <returns>
    /// Non-zero if the column associated with the function parameter is
    /// unchanged in an UPDATE against a virtual table.
    /// </returns>
    public int GetParameterNoChange(int index)
    {
      CheckDisposed();
      CheckParameterIndex(index);
      return _base.GetParamValueNoChange((IntPtr)_params[index]);
    }

    /// <summary>
    /// Gets and returns the "from bind" flag associated with the specified
    /// function parameter.
    /// </summary>
    /// <param name="index">
    /// The parameter index to check.
    /// </param>
    /// <returns>
    /// Non-zero if the function parameter at the specified index was
    /// originally specified via a bound parameter.
    /// </returns>
    public int GetParameterFromBind(int index)
    {
      CheckDisposed();
      CheckParameterIndex(index);
      return _base.GetParamValueFromBind((IntPtr)_params[index]);
    }

    /// <summary>
    /// Arranges for the specified sub-type value to be associated
    /// with the function result.
    /// </summary>
    /// <param name="value">
    /// The desired sub-type of the function result.
    /// </param>
    public void SetReturnSubType(uint value)
    {
      CheckDisposed();
      _base.ReturnSubType(_context, value);
    }

    /// <summary>
    /// Performs some sanity checks on the index and how it relates
    /// to the current function parameters.
    /// </summary>
    /// <param name="index">
    /// The parameter index to be checked for bounds, etc.
    /// </param>
    private void CheckParameterIndex(int index)
    {
      if (_params == null)
      {
        throw new InvalidOperationException(
          "parameters are unavailable");
      }

      int length = _params.Length;

      if ((index <= 0) || (index >= length))
      {
        throw new ArgumentException(String.Format(
          "parameter index {0} is out-of-bounds",
          index));
      }

#if !PLATFORM_COMPACTFRAMEWORK
      IntPtr value = _params[index];

      if (value == IntPtr.Zero)
#else
      int value = _params[index];

      if (value == 0)
#endif
      {
        throw new ArgumentException(String.Format(
          "parameter {0} value cannot be null",
          index));
      }
    }

    /// <summary>
    /// Converts an IntPtr array of context arguments to an object array containing the resolved parameters the pointers point to.
    /// </summary>
    /// <remarks>
    /// Parameters passed to functions have only an affinity for a certain data type, there is no underlying schema available
    /// to force them into a certain type.  Therefore the only types you will ever see as parameters are
    /// DBNull.Value, Int64, Double, String or byte[] array.
    /// </remarks>
    /// <param name="nArgs">The number of arguments</param>
    /// <param name="argsptr">A pointer to the array of arguments</param>
    /// <param name="paramptrs">Pointer values for the arguments</param>
    /// <returns>An object array of the arguments once they've been converted to .NET values</returns>
    internal object[] ConvertParams(
        int nArgs,
        IntPtr argsptr,
#if !PLATFORM_COMPACTFRAMEWORK
        out IntPtr[] paramptrs
#else
        out int[] paramptrs
#endif
        )
    {
      object[] parms = new object[nArgs];
#if !PLATFORM_COMPACTFRAMEWORK
      IntPtr[] argint = new IntPtr[nArgs];
#else
      int[] argint = new int[nArgs];
#endif
      Marshal.Copy(argsptr, argint, 0, nArgs);
#if !PLATFORM_COMPACTFRAMEWORK
      paramptrs = new IntPtr[nArgs];
#else
      paramptrs = new int[nArgs];
#endif
      Array.Copy(argint, paramptrs, nArgs);

      for (int n = 0; n < nArgs; n++)
      {
        switch (_base.GetParamValueType((IntPtr)argint[n]))
        {
          case TypeAffinity.Null:
            parms[n] = DBNull.Value;
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
    }

    /// <summary>
    /// Takes the return value from Invoke() and Final() and figures out how to return it to SQLite's context.
    /// </summary>
    /// <param name="context">The context the return value applies to</param>
    /// <param name="returnValue">The parameter to return to SQLite</param>
    void SetReturnValue(IntPtr context, object returnValue)
    {
      if (returnValue == null || returnValue == DBNull.Value)
      {
        _base.ReturnNull(context);
        return;
      }








|







629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
    }

    /// <summary>
    /// Takes the return value from Invoke() and Final() and figures out how to return it to SQLite's context.
    /// </summary>
    /// <param name="context">The context the return value applies to</param>
    /// <param name="returnValue">The parameter to return to SQLite</param>
    private void SetReturnValue(IntPtr context, object returnValue)
    {
      if (returnValue == null || returnValue == DBNull.Value)
      {
        _base.ReturnNull(context);
        return;
      }

240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
        if (r != null)
        {
          _base.ReturnError(context, r.Message);
          return;
        }
      }

      switch (SQLiteConvert.TypeToAffinity(t))
      {
        case TypeAffinity.Null:
          _base.ReturnNull(context);
          return;
        case TypeAffinity.Int64:
          _base.ReturnInt64(context, Convert.ToInt64(returnValue, CultureInfo.CurrentCulture));
          return;







|







654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
        if (r != null)
        {
          _base.ReturnError(context, r.Message);
          return;
        }
      }

      switch (SQLiteConvert.TypeToAffinity(t, _flags))
      {
        case TypeAffinity.Null:
          _base.ReturnNull(context);
          return;
        case TypeAffinity.Int64:
          _base.ReturnInt64(context, Convert.ToInt64(returnValue, CultureInfo.CurrentCulture));
          return;
262
263
264
265
266
267
268

269
270
271
272
273
274


275


276

277

278






















279
280















































281
282
283
284
285
286
287
288
289
290


291

292

293















294






295
296
297
298
299
300

301
302
303
304
305
306
307
308
309
310
311
312


313
314


315


316
317
318
319
320
321




322
323
324


325

326
327
328
329
330























331
332
333
334

335
336
337
338
339

340
341





342

343
344
345
346
347



348


349






















350
351



352

353
354

355
356


357
358





359

360


361


362



363















364
365


366
367
368
369
370
371
372
373

374
375


376
















377
378
379



380









381

382


383
384
385



386




387





388














389




390
391
392
393
394
395
396
397
398
399
400
401
402
403
404







405
406
407
408
409
410
411
412
413
414
415
          _base.ReturnBlob(context, (byte[])returnValue);
          return;
      }
    }

    /// <summary>
    /// Internal scalar callback function, which wraps the raw context pointer and calls the virtual Invoke() method.

    /// </summary>
    /// <param name="context">A raw context pointer</param>
    /// <param name="nArgs">Number of arguments passed in</param>
    /// <param name="argsptr">A pointer to the array of arguments</param>
    internal void ScalarCallback(IntPtr context, int nArgs, IntPtr argsptr)
    {


      _context = context;


      SetReturnValue(context, Invoke(ConvertParams(nArgs, argsptr)));

    }
























    /// <summary>
    /// Internal collation sequence function, which wraps up the raw string pointers and executes the Compare() virtual function.















































    /// </summary>
    /// <param name="ptr">Not used</param>
    /// <param name="len1">Length of the string pv1</param>
    /// <param name="ptr1">Pointer to the first string to compare</param>
    /// <param name="len2">Length of the string pv2</param>
    /// <param name="ptr2">Pointer to the second string to compare</param>
    /// <returns>Returns -1 if the first string is less than the second.  0 if they are equal, or 1 if the first string is greater
    /// than the second.</returns>
    internal int CompareCallback(IntPtr ptr, int len1, IntPtr ptr1, int len2, IntPtr ptr2)
    {


      return Compare(SQLiteConvert.UTF8ToString(ptr1, len1), SQLiteConvert.UTF8ToString(ptr2, len2));

    }

















    internal int CompareCallback16(IntPtr ptr, int len1, IntPtr ptr1, int len2, IntPtr ptr2)






    {
      return Compare(SQLite3_UTF16.UTF16ToString(ptr1, len1), SQLite3_UTF16.UTF16ToString(ptr2, len2));
    }

    /// <summary>
    /// The internal aggregate Step function callback, which wraps the raw context pointer and calls the virtual Step() method.

    /// </summary>
    /// <remarks>
    /// This function takes care of doing the lookups and getting the important information put together to call the Step() function.
    /// That includes pulling out the user's contextData and updating it after the call is made.  We use a sorted list for this so
    /// binary searches can be done to find the data.
    /// </remarks>
    /// <param name="context">A raw context pointer</param>
    /// <param name="nArgs">Number of arguments passed in</param>
    /// <param name="argsptr">A pointer to the array of arguments</param>
    internal void StepCallback(IntPtr context, int nArgs, IntPtr argsptr)
    {
      long nAux;


      AggregateData data;



      nAux = (long)_base.AggregateContext(context);


      if (_contextDataList.TryGetValue(nAux, out data) == false)
      {
        data = new AggregateData();
        _contextDataList[nAux] = data;
      }





      try
      {
        _context = context;


        Step(ConvertParams(nArgs, argsptr), data._count, ref data._data);

      }
      finally
      {
        data._count++;
      }























    }

    /// <summary>
    /// An internal aggregate Final function callback, which wraps the context pointer and calls the virtual Final() method.

    /// </summary>
    /// <param name="context">A raw context pointer</param>
    internal void FinalCallback(IntPtr context)
    {
      long n = (long)_base.AggregateContext(context);

      object obj = null;






      if (_contextDataList.ContainsKey(n))

      {
        obj = _contextDataList[n]._data;
        _contextDataList.Remove(n);
      }




      _context = context;


      SetReturnValue(context, Final(obj));























      IDisposable disp = obj as IDisposable;



      if (disp != null) disp.Dispose();

    }


    /// <summary>
    /// Placeholder for a user-defined disposal routine


    /// </summary>
    /// <param name="disposing">True if the object is being disposed explicitly</param>





    protected virtual void Dispose(bool disposing)

    {


      if (disposing)


      {



        IDisposable disp;
















        foreach (KeyValuePair<long, AggregateData> kv in _contextDataList)


        {
          disp = kv.Value._data as IDisposable;
          if (disp != null)
            disp.Dispose();
        }
        _contextDataList.Clear();

        _InvokeFunc = null;

        _StepFunc = null;
        _FinalFunc = null;


        _CompareFunc = null;
















        _base = null;
        _contextDataList = null;
      }



    }











    /// <summary>


    /// Disposes of any active contextData variables that were not automatically cleaned up.  Sometimes this can happen if
    /// someone closes the connection while a DataReader is open.
    /// </summary>



    public void Dispose()




    {





      Dispose(true);














      GC.SuppressFinalize(this);




    }

    /// <summary>
    /// Using reflection, enumerate all assemblies in the current appdomain looking for classes that
    /// have a SQLiteFunctionAttribute attribute, and registering them accordingly.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [Security.Permissions.FileIOPermission(Security.Permissions.SecurityAction.Assert, AllFiles = Security.Permissions.FileIOPermissionAccess.PathDiscovery)]
#endif
    static SQLiteFunction()
    {
      _registeredFunctions = new List<SQLiteFunctionAttribute>();
      try
      {
#if !PLATFORM_COMPACTFRAMEWORK







        SQLiteFunctionAttribute at;
        System.Reflection.Assembly[] arAssemblies = System.AppDomain.CurrentDomain.GetAssemblies();
        int w = arAssemblies.Length;
        System.Reflection.AssemblyName sqlite = System.Reflection.Assembly.GetCallingAssembly().GetName();

        for (int n = 0; n < w; n++)
        {
          Type[] arTypes;
          bool found = false;
          System.Reflection.AssemblyName[] references;
          try







>






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

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







|
|

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




>











<
>
>
|

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




>




|
>
|

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

<
>
>

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






|




|



>
>
>
>
>
>
>



|







676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936

937
938
939
940
941
942
943
944
945

946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983

984
985
986

987

988

989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013

1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033

1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
          _base.ReturnBlob(context, (byte[])returnValue);
          return;
      }
    }

    /// <summary>
    /// Internal scalar callback function, which wraps the raw context pointer and calls the virtual Invoke() method.
    /// WARNING: Must not throw exceptions.
    /// </summary>
    /// <param name="context">A raw context pointer</param>
    /// <param name="nArgs">Number of arguments passed in</param>
    /// <param name="argsptr">A pointer to the array of arguments</param>
    internal void ScalarCallback(IntPtr context, int nArgs, IntPtr argsptr)
    {
        try
        {
            _context = context;
            _params = null;

            SetReturnValue(context,
                Invoke(ConvertParams(nArgs, argsptr, out _params))); /* throw */
        }
        catch (Exception e) /* NOTE: Must catch ALL. */
        {
            try
            {
                if (HelperMethods.LogCallbackExceptions(_flags))
                {
                    SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
                        UnsafeNativeMethods.ExceptionMessageFormat,
                        "Invoke", e)); /* throw */
                }
            }
            catch
            {
                // do nothing.
            }
        }
        finally
        {
            _params = null;
            _context = IntPtr.Zero;
        }
    }

    /// <summary>
    /// Internal collating sequence function, which wraps up the raw string pointers and executes the Compare() virtual function.
    /// WARNING: Must not throw exceptions.
    /// </summary>
    /// <param name="ptr">Not used</param>
    /// <param name="len1">Length of the string pv1</param>
    /// <param name="ptr1">Pointer to the first string to compare</param>
    /// <param name="len2">Length of the string pv2</param>
    /// <param name="ptr2">Pointer to the second string to compare</param>
    /// <returns>Returns -1 if the first string is less than the second.  0 if they are equal, or 1 if the first string is greater
    /// than the second.  Returns 0 if an exception is caught.</returns>
    internal int CompareCallback(IntPtr ptr, int len1, IntPtr ptr1, int len2, IntPtr ptr2)
    {
        try
        {
            return Compare(SQLiteConvert.UTF8ToString(ptr1, len1),
                SQLiteConvert.UTF8ToString(ptr2, len2)); /* throw */
        }
        catch (Exception e) /* NOTE: Must catch ALL. */
        {
            try
            {
                if (HelperMethods.LogCallbackExceptions(_flags))
                {
                    SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
                        UnsafeNativeMethods.ExceptionMessageFormat,
                        "Compare", e)); /* throw */
                }
            }
            catch
            {
                // do nothing.
            }
        }

        //
        // NOTE: This must be done to prevent the core SQLite library from
        //       using our (invalid) result.
        //
        if ((_base != null) && _base.IsOpen())
            _base.Cancel();

        return 0;
    }

    /// <summary>
    /// Internal collating sequence function, which wraps up the raw string pointers and executes the Compare() virtual function.
    /// WARNING: Must not throw exceptions.
    /// </summary>
    /// <param name="ptr">Not used</param>
    /// <param name="len1">Length of the string pv1</param>
    /// <param name="ptr1">Pointer to the first string to compare</param>
    /// <param name="len2">Length of the string pv2</param>
    /// <param name="ptr2">Pointer to the second string to compare</param>
    /// <returns>Returns -1 if the first string is less than the second.  0 if they are equal, or 1 if the first string is greater
    /// than the second.  Returns 0 if an exception is caught.</returns>
    internal int CompareCallback16(IntPtr ptr, int len1, IntPtr ptr1, int len2, IntPtr ptr2)
    {
        try
        {
            return Compare(SQLite3_UTF16.UTF16ToString(ptr1, len1),
                SQLite3_UTF16.UTF16ToString(ptr2, len2)); /* throw */
        }
        catch (Exception e) /* NOTE: Must catch ALL. */
        {
            try
            {
                if (HelperMethods.LogCallbackExceptions(_flags))
                {
                    SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
                        UnsafeNativeMethods.ExceptionMessageFormat,
                        "Compare (UTF16)", e)); /* throw */
                }
            }
            catch
            {
                // do nothing.
            }
        }

        //
        // NOTE: This must be done to prevent the core SQLite library from
        //       using our (invalid) result.
        //
        if ((_base != null) && _base.IsOpen())
            _base.Cancel();

        return 0;
    }

    /// <summary>
    /// The internal aggregate Step function callback, which wraps the raw context pointer and calls the virtual Step() method.
    /// WARNING: Must not throw exceptions.
    /// </summary>
    /// <remarks>
    /// This function takes care of doing the lookups and getting the important information put together to call the Step() function.
    /// That includes pulling out the user's contextData and updating it after the call is made.  We use a sorted list for this so
    /// binary searches can be done to find the data.
    /// </remarks>
    /// <param name="context">A raw context pointer</param>
    /// <param name="nArgs">Number of arguments passed in</param>
    /// <param name="argsptr">A pointer to the array of arguments</param>
    internal void StepCallback(IntPtr context, int nArgs, IntPtr argsptr)
    {

        try
        {
            AggregateData data = null;

            if (_base != null)
            {
                IntPtr nAux = _base.AggregateContext(context);

                if ((_contextDataList != null) &&
                    !_contextDataList.TryGetValue(nAux, out data))
                {
                    data = new AggregateData();
                    _contextDataList[nAux] = data;
                }
            }

            if (data == null)
                data = new AggregateData();

            try
            {
                _context = context;
                _params = null;

                Step(ConvertParams(nArgs, argsptr, out _params),
                    data._stepCount, ref data._data); /* throw */
            }
            finally
            {
                data._stepCount++;
            }
        }
        catch (Exception e) /* NOTE: Must catch ALL. */
        {
            try
            {
                if (HelperMethods.LogCallbackExceptions(_flags))
                {
                    SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
                        UnsafeNativeMethods.ExceptionMessageFormat,
                        "Step", e)); /* throw */
                }
            }
            catch
            {
                // do nothing.
            }
        }
        finally
        {
            _params = null;
            _context = IntPtr.Zero;
        }
    }

    /// <summary>
    /// An internal aggregate Final function callback, which wraps the context pointer and calls the virtual Final() method.
    /// WARNING: Must not throw exceptions.
    /// </summary>
    /// <param name="context">A raw context pointer</param>
    internal void FinalCallback(IntPtr context)
    {
        try
        {
            object obj = null;

            if (_base != null)
            {
                IntPtr n = _base.AggregateContext(context);
                AggregateData aggData;

                if ((_contextDataList != null) &&
                    _contextDataList.TryGetValue(n, out aggData))
                {
                    obj = aggData._data;
                    _contextDataList.Remove(n);
                }
            }

            try
            {
                _context = context;
                _params = null;

                SetReturnValue(context, Final(obj)); /* throw */
            }
            finally
            {
                IDisposable disp = obj as IDisposable;
                if (disp != null) disp.Dispose(); /* throw */
            }
        }
        catch (Exception e) /* NOTE: Must catch ALL. */
        {
            try
            {
                if (HelperMethods.LogCallbackExceptions(_flags))
                {
                    SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
                        UnsafeNativeMethods.ExceptionMessageFormat,
                        "Final", e)); /* throw */
                }
            }
            catch
            {
                // do nothing.
            }

        }
        finally
        {
            _params = null;
            _context = IntPtr.Zero;
        }
    }

    /// <summary>

    /// An internal aggregate Value function callback, which wraps the context pointer and calls the virtual Value() method.
    /// WARNING: Must not throw exceptions.
    /// </summary>
    /// <param name="context">A raw context pointer</param>
    internal void ValueCallback(IntPtr context)
    {
        try
        {
            object obj = null;

            if (_base != null)
            {
                IntPtr n = _base.AggregateContext(context);
                AggregateData aggData;

                if ((_contextDataList != null) &&
                    _contextDataList.TryGetValue(n, out aggData))
                {
                    obj = aggData._data;
                }
            }

            _context = context;
            _params = null;

            SetReturnValue(context, Value(obj)); /* throw */
        }
        catch (Exception e) /* NOTE: Must catch ALL. */
        {
            try
            {
                if (HelperMethods.LogCallbackExceptions(_flags))
                {
                    SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
                        UnsafeNativeMethods.ExceptionMessageFormat,
                        "Value", e)); /* throw */
                }

            }
            catch
            {

                // do nothing.

            }

        }
        finally
        {
            _params = null;
            _context = IntPtr.Zero;
        }
    }

    /// <summary>
    /// The internal aggregate Inverse function callback, which wraps the raw context pointer and calls the virtual Inverse() method.
    /// WARNING: Must not throw exceptions.
    /// </summary>
    /// <remarks>
    /// This function takes care of doing the lookups and getting the important information put together to call the Inverse() function.
    /// That includes pulling out the user's contextData and updating it after the call is made.  We use a sorted list for this so
    /// binary searches can be done to find the data.
    /// </remarks>
    /// <param name="context">A raw context pointer</param>
    /// <param name="nArgs">Number of arguments passed in</param>
    /// <param name="argsptr">A pointer to the array of arguments</param>
    internal void InverseCallback(IntPtr context, int nArgs, IntPtr argsptr)
    {
        try
        {
            AggregateData data = null;


            if (_base != null)
            {
                IntPtr nAux = _base.AggregateContext(context);

                if ((_contextDataList != null) &&
                    !_contextDataList.TryGetValue(nAux, out data))
                {
                    //
                    // TODO: This should not be required here since
                    //       Step should have already been called?
                    //
                    data = new AggregateData();
                    _contextDataList[nAux] = data;
                }
            }

            if (data == null)
                data = new AggregateData();


            try
            {
                _context = context;
                _params = null;

                Inverse(ConvertParams(nArgs, argsptr, out _params),
                    data._inverseCount, ref data._data); /* throw */
            }
            finally
            {
                data._inverseCount++;
            }
        }
        catch (Exception e) /* NOTE: Must catch ALL. */
        {
            try
            {
                if (HelperMethods.LogCallbackExceptions(_flags))
                {
                    SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
                        UnsafeNativeMethods.ExceptionMessageFormat,
                        "Inverse", e)); /* throw */
                }
            }
            catch
            {
                // do nothing.
            }
        }
        finally
        {
            _params = null;
            _context = IntPtr.Zero;
        }
    }

    /// <summary>
    /// Using reflection, enumerate all assemblies in the current appdomain looking for classes that
    /// have a SQLiteFunctionAttribute attribute, and registering them accordingly.
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK && !NET_STANDARD_20 && !NET_STANDARD_21
    [Security.Permissions.FileIOPermission(Security.Permissions.SecurityAction.Assert, AllFiles = Security.Permissions.FileIOPermissionAccess.PathDiscovery)]
#endif
    static SQLiteFunction()
    {
      _registeredFunctions = new Dictionary<SQLiteFunctionAttribute, object>();
      try
      {
#if !PLATFORM_COMPACTFRAMEWORK
        //
        // NOTE: If the "No_SQLiteFunctions" environment variable is set,
        //       skip all our special code and simply return.
        //
        if (UnsafeNativeMethods.GetSettingValue("No_SQLiteFunctions", null) != null)
          return;

        SQLiteFunctionAttribute at;
        System.Reflection.Assembly[] arAssemblies = System.AppDomain.CurrentDomain.GetAssemblies();
        int w = arAssemblies.Length;
        System.Reflection.AssemblyName sqlite = System.Reflection.Assembly.GetExecutingAssembly().GetName();

        for (int n = 0; n < w; n++)
        {
          Type[] arTypes;
          bool found = false;
          System.Reflection.AssemblyName[] references;
          try
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471


472




















































473































































474



475





476


















477









478
479



480
481

482




483



















































484
485
486
487
488
489
490
491
492
493
494
495









496




































497































































































498














































































499





500














































































































































































































































































501
502
503

504


505


506

507

































508


509


510


























511


512
513


514

515








































































































































516
517

518




519
































































































































520















521

522




























































































































523


























































































524

















525
526






























527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543


















































544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565




566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586








587
588
589
590
591
592
593
594
            object[] arAtt = arTypes[x].GetCustomAttributes(typeof(SQLiteFunctionAttribute), false);
            int u = arAtt.Length;
            for (int y = 0; y < u; y++)
            {
              at = arAtt[y] as SQLiteFunctionAttribute;
              if (at != null)
              {
                at._instanceType = arTypes[x];
                _registeredFunctions.Add(at);
              }
            }
          }
        }
#endif
      }
      catch // SQLite provider can continue without being able to find built-in functions
      {
      }
    }

    /// <summary>
    /// Manual method of registering a function.  The type must still have the SQLiteFunctionAttributes in order to work
    /// properly, but this is a workaround for the Compact Framework where enumerating assemblies is not currently supported.
    /// </summary>
    /// <param name="typ">The type of the function to register</param>
    public static void RegisterFunction(Type typ)
    {
      object[] arAtt = typ.GetCustomAttributes(typeof(SQLiteFunctionAttribute), false);


      int u = arAtt.Length;




















































      SQLiteFunctionAttribute at;



































































      for (int y = 0; y < u; y++)





      {


















        at = arAtt[y] as SQLiteFunctionAttribute;









        if (at != null)
        {



          at._instanceType = typ;
          _registeredFunctions.Add(at);

        }




      }



















































    }

    /// <summary>
    /// Called by SQLiteBase derived classes, this function binds all user-defined functions to a connection.
    /// It is done this way so that all user-defined functions will access the database using the same encoding scheme
    /// as the connection (UTF-8 or UTF-16).
    /// </summary>
    /// <remarks>
    /// The wrapper functions that interop with SQLite will create a unique cookie value, which internally is a pointer to
    /// all the wrapped callback functions.  The interop function uses it to map CDecl callbacks to StdCall callbacks.
    /// </remarks>
    /// <param name="sqlbase">The base object on which the functions are to bind</param>









    /// <returns>Returns an array of functions which the connection object should retain until the connection is closed.</returns>




































    internal static SQLiteFunction[] BindFunctions(SQLiteBase sqlbase)































































































    {














































































      SQLiteFunction f;





      List<SQLiteFunction> lFunctions = new List<SQLiteFunction>();















































































































































































































































































      foreach (SQLiteFunctionAttribute pr in _registeredFunctions)
      {

        f = (SQLiteFunction)Activator.CreateInstance(pr._instanceType);


        f._base = sqlbase;


        f._InvokeFunc = (pr.FuncType == FunctionType.Scalar) ? new SQLiteCallback(f.ScalarCallback) : null;

        f._StepFunc = (pr.FuncType == FunctionType.Aggregate) ? new SQLiteCallback(f.StepCallback) : null;

































        f._FinalFunc = (pr.FuncType == FunctionType.Aggregate) ? new SQLiteFinalCallback(f.FinalCallback) : null;


        f._CompareFunc = (pr.FuncType == FunctionType.Collation) ? new SQLiteCollation(f.CompareCallback) : null;


        f._CompareFunc16 = (pr.FuncType == FunctionType.Collation) ? new SQLiteCollation(f.CompareCallback16) : null;





























        if (pr.FuncType != FunctionType.Collation)
          sqlbase.CreateFunction(pr.Name, pr.Arguments, (f is SQLiteFunctionEx), f._InvokeFunc, f._StepFunc, f._FinalFunc);


        else

          sqlbase.CreateCollation(pr.Name, f._CompareFunc, f._CompareFunc16);











































































































































        lFunctions.Add(f);




      }
















































































































































      SQLiteFunction[] arFunctions = new SQLiteFunction[lFunctions.Count];

      lFunctions.CopyTo(arFunctions, 0);























































































































































































































      return arFunctions;

















    }
  }































  /// <summary>
  /// Extends SQLiteFunction and allows an inherited class to obtain the collating sequence associated with a function call.
  /// </summary>
  /// <remarks>
  /// User-defined functions can call the GetCollationSequence() method in this class and use it to compare strings and char arrays.
  /// </remarks>
  public class SQLiteFunctionEx : SQLiteFunction
  {
    /// <summary>
    /// Obtains the collating sequence in effect for the given function.
    /// </summary>
    /// <returns></returns>
    protected CollationSequence GetCollationSequence()
    {
      return _base.GetCollationSequence(this, _context);
    }


















































  }

  /// <summary>
  /// The type of user-defined function to declare
  /// </summary>
  public enum FunctionType
  {
    /// <summary>
    /// Scalar functions are designed to be called and return a result immediately.  Examples include ABS(), Upper(), Lower(), etc.
    /// </summary>
    Scalar = 0,
    /// <summary>
    /// Aggregate functions are designed to accumulate data until the end of a call and then return a result gleaned from the accumulated data.
    /// Examples include SUM(), COUNT(), AVG(), etc.
    /// </summary>
    Aggregate = 1,
    /// <summary>
    /// Collation sequences are used to sort textual data in a custom manner, and appear in an ORDER BY clause.  Typically text in an ORDER BY is
    /// sorted using a straight case-insensitive comparison function.  Custom collating sequences can be used to alter the behavior of text sorting
    /// in a user-defined manner.
    /// </summary>
    Collation = 2,




  }

  /// <summary>
  /// An internal callback delegate declaration.
  /// </summary>
  /// <param name="context">Raw context pointer for the user function</param>
  /// <param name="nArgs">Count of arguments to the function</param>
  /// <param name="argsptr">A pointer to the array of argument pointers</param>
#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  internal delegate void SQLiteCallback(IntPtr context, int nArgs, IntPtr argsptr);
  /// <summary>
  /// An internal final callback delegate declaration.
  /// </summary>
  /// <param name="context">Raw context pointer for the user function</param>
#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  internal delegate void SQLiteFinalCallback(IntPtr context);
  /// <summary>








  /// Internal callback delegate for implementing collation sequences
  /// </summary>
  /// <param name="puser">Not used</param>
  /// <param name="len1">Length of the string pv1</param>
  /// <param name="pv1">Pointer to the first string to compare</param>
  /// <param name="len2">Length of the string pv2</param>
  /// <param name="pv2">Pointer to the second string to compare</param>
  /// <returns>Returns -1 if the first string is less than the second.  0 if they are equal, or 1 if the first string is greater







|
|


















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

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



|







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

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

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

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

















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

















|




>
>
>
>





|
|
|



|









>
>
>
>
>
>
>
>
|







1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891

1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972

1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
            object[] arAtt = arTypes[x].GetCustomAttributes(typeof(SQLiteFunctionAttribute), false);
            int u = arAtt.Length;
            for (int y = 0; y < u; y++)
            {
              at = arAtt[y] as SQLiteFunctionAttribute;
              if (at != null)
              {
                at.InstanceType = arTypes[x];
                ReplaceFunction(at, null);
              }
            }
          }
        }
#endif
      }
      catch // SQLite provider can continue without being able to find built-in functions
      {
      }
    }

    /// <summary>
    /// Manual method of registering a function.  The type must still have the SQLiteFunctionAttributes in order to work
    /// properly, but this is a workaround for the Compact Framework where enumerating assemblies is not currently supported.
    /// </summary>
    /// <param name="typ">The type of the function to register</param>
    public static void RegisterFunction(Type typ)
    {
        object[] arAtt = typ.GetCustomAttributes(
            typeof(SQLiteFunctionAttribute), false);

        for (int y = 0; y < arAtt.Length; y++)
        {
            SQLiteFunctionAttribute at = arAtt[y] as SQLiteFunctionAttribute;

            if (at == null)
                continue;

            RegisterFunction(
                at.Name, at.Arguments, at.FuncType, at.FuncFlags, typ,
                at.Callback1, at.Callback2, at.Callback3, at.Callback4);
        }
    }

    /// <summary>
    /// Alternative method of registering a function.  This method
    /// does not require the specified type to be annotated with
    /// <see cref="SQLiteFunctionAttribute" />.
    /// </summary>
    /// <param name="name">
    /// The name of the function to register.
    /// </param>
    /// <param name="argumentCount">
    /// The number of arguments accepted by the function.
    /// </param>
    /// <param name="functionType">
    /// The type of SQLite function being registered (e.g. scalar,
    /// aggregate, or collating sequence).
    /// </param>
    /// <param name="instanceType">
    /// The <see cref="Type" /> that actually implements the function.
    /// This will only be used if the <paramref name="callback1" />
    /// and <paramref name="callback2" /> parameters are null.
    /// </param>
    /// <param name="callback1">
    /// The <see cref="Delegate" /> to be used for all calls into the
    /// <see cref="SQLiteFunction.Invoke" />,
    /// <see cref="SQLiteFunction.Step" />,
    /// and <see cref="SQLiteFunction.Compare" /> virtual methods.
    /// </param>
    /// <param name="callback2">
    /// The <see cref="Delegate" /> to be used for all calls into the
    /// <see cref="SQLiteFunction.Final" /> virtual method.  This
    /// parameter is only necessary for aggregate functions.
    /// </param>
    public static void RegisterFunction(
        string name,
        int argumentCount,
        FunctionType functionType,
        Type instanceType,
        Delegate callback1,
        Delegate callback2
        )
    {
        SQLiteFunctionAttribute at = new SQLiteFunctionAttribute(
            name, argumentCount, functionType);

        at.InstanceType = instanceType;
        at.Callback1 = callback1;
        at.Callback2 = callback2;

        ReplaceFunction(at, null);
    }

    /// <summary>
    /// Alternative method of registering a function.  This method
    /// does not require the specified type to be annotated with
    /// <see cref="SQLiteFunctionAttribute" />.
    /// </summary>
    /// <param name="name">
    /// The name of the function to register.
    /// </param>
    /// <param name="argumentCount">
    /// The number of arguments accepted by the function.
    /// </param>
    /// <param name="functionType">
    /// The type of SQLite function being registered (e.g. scalar,
    /// aggregate, or collating sequence).
    /// </param>
    /// <param name="functionFlags">
    /// The extra flags for the function being registered.
    /// </param>
    /// <param name="instanceType">
    /// The <see cref="Type" /> that actually implements the function.
    /// This will only be used if the <paramref name="callback1" />
    /// and <paramref name="callback2" /> parameters are null.
    /// </param>
    /// <param name="callback1">
    /// The <see cref="Delegate" /> to be used for all calls into the
    /// <see cref="SQLiteFunction.Invoke" />,
    /// <see cref="SQLiteFunction.Step" />,
    /// and <see cref="SQLiteFunction.Compare" /> virtual methods.
    /// </param>
    /// <param name="callback2">
    /// The <see cref="Delegate" /> to be used for all calls into the
    /// <see cref="SQLiteFunction.Final" /> virtual method.  This
    /// parameter is only necessary for aggregate functions.
    /// </param>
    /// <param name="callback3">
    /// The <see cref="Delegate" /> to be used for all calls into the
    /// <see cref="SQLiteFunction.Value" /> virtual method.  This
    /// parameter is only necessary for window functions.
    /// </param>
    /// <param name="callback4">
    /// The <see cref="Delegate" /> to be used for all calls into the
    /// <see cref="SQLiteFunction.Inverse" /> virtual method.  This
    /// parameter is only necessary for window functions.
    /// </param>
    public static void RegisterFunction(
        string name,
        int argumentCount,
        FunctionType functionType,
        SQLiteFunctionFlags functionFlags,
        Type instanceType,
        Delegate callback1,
        Delegate callback2,
        Delegate callback3,
        Delegate callback4
        )
    {
        SQLiteFunctionAttribute at = new SQLiteFunctionAttribute(
            name, argumentCount, functionType, functionFlags);

        at.InstanceType = instanceType;
        at.Callback1 = callback1;
        at.Callback2 = callback2;
        at.Callback3 = callback3;
        at.Callback4 = callback4;

        ReplaceFunction(at, null);
    }

    /// <summary>
    /// Replaces a registered function, disposing of the associated (old)
    /// value if necessary.
    /// </summary>
    /// <param name="at">
    /// The attribute that describes the function to replace.
    /// </param>
    /// <param name="newValue">
    /// The new value to use.
    /// </param>
    /// <returns>
    /// Non-zero if an existing registered function was replaced; otherwise,
    /// zero.
    /// </returns>
    private static bool ReplaceFunction(
        SQLiteFunctionAttribute at,
        object newValue
        )
    {
        object oldValue;

        if (_registeredFunctions.TryGetValue(at, out oldValue))
        {
            IDisposable disposable = oldValue as IDisposable;

            if (disposable != null)
            {
                disposable.Dispose();
                disposable = null;
            }

            _registeredFunctions[at] = newValue;
            return true;
        }
        else
        {
            _registeredFunctions.Add(at, newValue);
            return false;
        }
    }

    /// <summary>
    /// Creates a <see cref="SQLiteFunction" /> instance based on the specified
    /// <see cref="SQLiteFunctionAttribute" />.
    /// </summary>
    /// <param name="functionAttribute">
    /// The <see cref="SQLiteFunctionAttribute" /> containing the metadata about
    /// the function to create.
    /// </param>
    /// <param name="function">
    /// The created function -OR- null if the function could not be created.
    /// </param>
    /// <returns>
    /// Non-zero if the function was created; otherwise, zero.
    /// </returns>
    private static bool CreateFunction(
        SQLiteFunctionAttribute functionAttribute,
        out SQLiteFunction function
        )
    {
        if (functionAttribute == null)
        {
            function = null;
            return false;
        }
        else if ((functionAttribute.Callback1 != null) ||
                 (functionAttribute.Callback2 != null) ||
                 (functionAttribute.Callback3 != null) ||
                 (functionAttribute.Callback4 != null))
        {
            function = new SQLiteDelegateFunction(
                functionAttribute.Callback1,
                functionAttribute.Callback2,
                functionAttribute.Callback3,
                functionAttribute.Callback4);

            return true;
        }
        else if (functionAttribute.InstanceType != null)
        {
            function = (SQLiteFunction)Activator.CreateInstance(
                functionAttribute.InstanceType);

            return true;
        }
        else
        {
            function = null;
            return false;
        }
    }

    /// <summary>
    /// Called by the SQLiteBase derived classes, this method binds all registered (known) user-defined functions to a connection.
    /// It is done this way so that all user-defined functions will access the database using the same encoding scheme
    /// as the connection (UTF-8 or UTF-16).
    /// </summary>
    /// <remarks>
    /// The wrapper functions that interop with SQLite will create a unique cookie value, which internally is a pointer to
    /// all the wrapped callback functions.  The interop function uses it to map CDecl callbacks to StdCall callbacks.
    /// </remarks>
    /// <param name="sqlbase">The base object on which the functions are to bind.</param>
    /// <param name="flags">The flags associated with the parent connection object.</param>
    /// <returns>Returns a logical list of functions which the connection should retain until it is closed.</returns>
    internal static IDictionary<SQLiteFunctionAttribute, SQLiteFunction> BindFunctions(
        SQLiteBase sqlbase,
        SQLiteConnectionFlags flags
        )
    {
        IDictionary<SQLiteFunctionAttribute, SQLiteFunction> lFunctions =
            new Dictionary<SQLiteFunctionAttribute, SQLiteFunction>();

        foreach (KeyValuePair<SQLiteFunctionAttribute, object> pair
                in _registeredFunctions)
        {
            SQLiteFunctionAttribute pr = pair.Key;

            if (pr == null)
                continue;

            SQLiteFunction f;

            if (CreateFunction(pr, out f))
            {
                BindFunction(sqlbase, pr, f, flags);
                lFunctions[pr] = f;
            }
            else
            {
                lFunctions[pr] = null;
            }
        }

        return lFunctions;
    }

    /// <summary>
    /// Called by the SQLiteBase derived classes, this method unbinds all registered (known)
    /// functions -OR- all previously bound user-defined functions from a connection.
    /// </summary>
    /// <param name="sqlbase">The base object from which the functions are to be unbound.</param>
    /// <param name="flags">The flags associated with the parent connection object.</param>
    /// <param name="registered">
    /// Non-zero to unbind all registered (known) functions -OR- zero to unbind all functions
    /// currently bound to the connection.
    /// </param>
    /// <returns>Non-zero if all the specified user-defined functions were unbound.</returns>
    internal static bool UnbindAllFunctions(
        SQLiteBase sqlbase,
        SQLiteConnectionFlags flags,
        bool registered
        )
    {
        if (sqlbase == null)
            return false;

        IDictionary<SQLiteFunctionAttribute, SQLiteFunction> lFunctions =
            sqlbase.Functions;

        if (lFunctions == null)
            return false;

        bool result = true;

        if (registered)
        {
            foreach (KeyValuePair<SQLiteFunctionAttribute, object> pair
                    in _registeredFunctions)
            {
                SQLiteFunctionAttribute pr = pair.Key;

                if (pr == null)
                    continue;

                SQLiteFunction f;

                if (!lFunctions.TryGetValue(pr, out f) ||
                    (f == null) ||
                    !UnbindFunction(sqlbase, pr, f, flags))
                {
                    result = false;
                }
            }
        }
        else
        {
            //
            // NOTE: Need to use a copy of the function dictionary in this method
            //       because the dictionary is modified within the UnbindFunction
            //       method, which is called inside the loop.
            //
            lFunctions = new Dictionary<SQLiteFunctionAttribute, SQLiteFunction>(
                lFunctions);

            foreach (KeyValuePair<SQLiteFunctionAttribute, SQLiteFunction> pair
                    in lFunctions)
            {
                SQLiteFunctionAttribute pr = pair.Key;

                if (pr == null)
                    continue;

                SQLiteFunction f = pair.Value;

                if ((f != null) &&
                    UnbindFunction(sqlbase, pr, f, flags))
                {
                    /* IGNORED */
                    sqlbase.Functions.Remove(pr);
                }
                else
                {
                    result = false;
                }
            }
        }

        return result;
    }

    /// <summary>
    /// This function binds a user-defined function to a connection.
    /// </summary>
    /// <param name="sqliteBase">
    /// The <see cref="SQLiteBase" /> object instance associated with the
    /// <see cref="SQLiteConnection" /> that the function should be bound to.
    /// </param>
    /// <param name="functionAttribute">
    /// The <see cref="SQLiteFunctionAttribute"/> object instance containing
    /// the metadata for the function to be bound.
    /// </param>
    /// <param name="function">
    /// The <see cref="SQLiteFunction"/> object instance that implements the
    /// function to be bound.
    /// </param>
    /// <param name="flags">
    /// The flags associated with the parent connection object.
    /// </param>
    internal static void BindFunction(
        SQLiteBase sqliteBase,
        SQLiteFunctionAttribute functionAttribute,
        SQLiteFunction function,
        SQLiteConnectionFlags flags
        )
    {
        if (sqliteBase == null)
            throw new ArgumentNullException("sqliteBase");

        if (functionAttribute == null)
            throw new ArgumentNullException("functionAttribute");

        if (function == null)
            throw new ArgumentNullException("function");

        FunctionType functionType = functionAttribute.FuncType;

        function._base = sqliteBase;
        function._flags = flags;

        function._InvokeFunc = (functionType == FunctionType.Scalar) ?
            new SQLiteCallback(function.ScalarCallback) : null;

        function._StepFunc = (functionType == FunctionType.Aggregate) || (functionType == FunctionType.Window) ?
            new SQLiteCallback(function.StepCallback) : null;

        function._FinalFunc = (functionType == FunctionType.Aggregate) || (functionType == FunctionType.Window) ?
            new SQLiteFinalCallback(function.FinalCallback) : null;

        function._ValueFunc = (functionType == FunctionType.Window) ?
            new SQLiteFinalCallback(function.ValueCallback) : null;

        function._InverseFunc = (functionType == FunctionType.Window) ?
            new SQLiteCallback(function.InverseCallback) : null;

        function._CompareFunc = (functionType == FunctionType.Collation) ?
            new SQLiteCollation(function.CompareCallback) : null;

        function._CompareFunc16 = (functionType == FunctionType.Collation) ?
            new SQLiteCollation(function.CompareCallback16) : null;

        string name = functionAttribute.Name;

        if (functionType != FunctionType.Collation)
        {
            bool needCollSeq = (function is SQLiteFunctionEx);

            sqliteBase.CreateFunction(
                functionType, name, functionAttribute.Arguments,
                functionAttribute.FuncFlags, needCollSeq,
                function._InvokeFunc, function._StepFunc,
                function._FinalFunc, function._ValueFunc,
                function._InverseFunc, true);
        }
        else
        {
            sqliteBase.CreateCollation(
                name, function._CompareFunc, function._CompareFunc16,
                true);
        }
    }

    /// <summary>
    /// This function unbinds a user-defined functions from a connection.
    /// </summary>
    /// <param name="sqliteBase">
    /// The <see cref="SQLiteBase" /> object instance associated with the
    /// <see cref="SQLiteConnection" /> that the function should be bound to.
    /// </param>
    /// <param name="functionAttribute">
    /// The <see cref="SQLiteFunctionAttribute"/> object instance containing
    /// the metadata for the function to be bound.
    /// </param>
    /// <param name="function">
    /// The <see cref="SQLiteFunction"/> object instance that implements the
    /// function to be bound.
    /// </param>
    /// <param name="flags">
    /// The flags associated with the parent connection object.
    /// </param>
    /// <returns>Non-zero if the function was unbound.</returns>
    internal static bool UnbindFunction(
        SQLiteBase sqliteBase,
        SQLiteFunctionAttribute functionAttribute,
        SQLiteFunction function,
        SQLiteConnectionFlags flags /* NOT USED */
        )
    {
        if (sqliteBase == null)
            throw new ArgumentNullException("sqliteBase");

        if (functionAttribute == null)
            throw new ArgumentNullException("functionAttribute");

        if (function == null)
            throw new ArgumentNullException("function");

        FunctionType functionType = functionAttribute.FuncType;
        string name = functionAttribute.Name;

        if (functionType != FunctionType.Collation)
        {
            bool needCollSeq = (function is SQLiteFunctionEx);

            return sqliteBase.CreateFunction(
                functionType, name, functionAttribute.Arguments,
                functionAttribute.FuncFlags, needCollSeq, null,
                null, null, null, null, false) == SQLiteErrorCode.Ok;
        }
        else
        {
            return sqliteBase.CreateCollation(
                name, null, null, false) == SQLiteErrorCode.Ok;
        }
    }
  }

  /////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// This <see cref="Delegate" /> type is used with the
  /// <see cref="SQLiteDelegateFunction.Invoke" /> method.
  /// </summary>
  /// <param name="param0">
  /// This is always the string literal "Invoke".
  /// </param>
  /// <param name="args">
  /// The arguments for the scalar function.
  /// </param>
  /// <returns>
  /// The result of the scalar function.
  /// </returns>
  public delegate object SQLiteInvokeDelegate(
    string param0,
    object[] args
  );

  /////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// This <see cref="Delegate" /> type is used with the
  /// <see cref="SQLiteDelegateFunction.Step" /> method.
  /// </summary>
  /// <param name="param0">
  /// This is always the string literal "Step".
  /// </param>
  /// <param name="args">
  /// The arguments for the aggregate function.
  /// </param>
  /// <param name="stepNumber">
  /// The step number (one based).  This is incrememted each time the
  /// <see cref="SQLiteDelegateFunction.Step" /> method is called.
  /// </param>
  /// <param name="contextData">
  /// A placeholder for implementers to store contextual data pertaining
  /// to the current context.
  /// </param>
  public delegate void SQLiteStepDelegate(
    string param0,
    object[] args,
    int stepNumber,
    ref object contextData
  );

  /////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// This <see cref="Delegate" /> type is used with the
  /// <see cref="SQLiteDelegateFunction.Final" /> method.
  /// </summary>
  /// <param name="param0">
  /// This is always the string literal "Final".
  /// </param>
  /// <param name="contextData">
  /// A placeholder for implementers to store contextual data pertaining
  /// to the current context.
  /// </param>
  /// <returns>
  /// The result of the aggregate function.
  /// </returns>
  public delegate object SQLiteFinalDelegate(
    string param0,
    object contextData
  );

  /////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// This <see cref="Delegate" /> type is used with the
  /// <see cref="SQLiteDelegateFunction.Compare" /> method.
  /// </summary>
  /// <param name="param0">
  /// This is always the string literal "Compare".
  /// </param>
  /// <param name="param1">
  /// The first string to compare.
  /// </param>
  /// <param name="param2">
  /// The second strnig to compare.
  /// </param>
  /// <returns>
  /// A positive integer if the <paramref name="param1" /> parameter is
  /// greater than the <paramref name="param2" /> parameter, a negative
  /// integer if the <paramref name="param1" /> parameter is less than
  /// the <paramref name="param2" /> parameter, or zero if they are
  /// equal.
  /// </returns>
  public delegate int SQLiteCompareDelegate(
    string param0,
    string param1,
    string param2
  );

  /////////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
  /// <summary>
  /// This class implements a SQLite function using a <see cref="Delegate" />.
  /// All the virtual methods of the <see cref="SQLiteFunction" /> class are
  /// implemented using calls to the <see cref="SQLiteInvokeDelegate" />,
  /// <see cref="SQLiteStepDelegate" />, <see cref="SQLiteFinalDelegate" />,
  /// and <see cref="SQLiteCompareDelegate" /> strongly typed delegate types
  /// or via the <see cref="Delegate.DynamicInvoke" /> method.
  /// The arguments are presented in the same order they appear in
  /// the associated <see cref="SQLiteFunction" /> methods with one exception:
  /// the first argument is the name of the virtual method being implemented.
  /// </summary>
#else
  /// <summary>
  /// This class implements a SQLite function using a <see cref="Delegate" />.
  /// All the virtual methods of the <see cref="SQLiteFunction" /> class are
  /// implemented using calls to the <see cref="SQLiteInvokeDelegate" />,
  /// <see cref="SQLiteStepDelegate" />, <see cref="SQLiteFinalDelegate" />,
  /// and <see cref="SQLiteCompareDelegate" /> strongly typed delegate types.
  /// The arguments are presented in the same order they appear in
  /// the associated <see cref="SQLiteFunction" /> methods with one exception:
  /// the first argument is the name of the virtual method being implemented.
  /// </summary>
#endif
  public class SQLiteDelegateFunction : SQLiteFunction
  {
      #region Private Constants
      /// <summary>
      /// This error message is used by the overridden virtual methods when
      /// a required <see cref="Delegate" /> property (e.g.
      /// <see cref="Callback1" /> or <see cref="Callback2" />) has not been
      /// set.
      /// </summary>
      private const string NoCallbackError = "No \"{0}\" callback is set.";

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// This error message is used by the overridden <see cref="Compare" />
      /// method when the result does not have a type of <see cref="Int32" />.
      /// </summary>
      private const string ResultInt32Error = "\"{0}\" result must be Int32.";
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Public Constructors
      /// <summary>
      /// Constructs an empty instance of this class.
      /// </summary>
      public SQLiteDelegateFunction()
          : this(null, null, null, null)
      {
          // do nothing.
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Constructs an instance of this class using the specified
      /// <see cref="Delegate" /> as the <see cref="SQLiteFunction" />
      /// implementation.
      /// </summary>
      /// <param name="callback1">
      /// The <see cref="Delegate" /> to be used for all calls into the
      /// <see cref="Invoke" />, <see cref="Step" />, and
      /// <see cref="Compare" /> virtual methods needed by the
      /// <see cref="SQLiteFunction" /> base class.
      /// </param>
      /// <param name="callback2">
      /// The <see cref="Delegate" /> to be used for all calls into the
      /// <see cref="Final" /> virtual methods needed by the
      /// <see cref="SQLiteFunction" /> base class.
      /// </param>
      public SQLiteDelegateFunction(
          Delegate callback1,
          Delegate callback2
          )
      {
          this.callback1 = callback1;
          this.callback2 = callback2;
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Constructs an instance of this class using the specified
      /// <see cref="Delegate" /> as the <see cref="SQLiteFunction" />
      /// implementation.
      /// </summary>
      /// <param name="callback1">
      /// The <see cref="Delegate" /> to be used for all calls into the
      /// <see cref="Invoke" />, <see cref="Step" />, and
      /// <see cref="Compare" /> virtual methods needed by the
      /// <see cref="SQLiteFunction" /> base class.
      /// </param>
      /// <param name="callback2">
      /// The <see cref="Delegate" /> to be used for all calls into the
      /// <see cref="Final" /> virtual methods needed by the
      /// <see cref="SQLiteFunction" /> base class.
      /// </param>
      /// <param name="callback3">
      /// The <see cref="Delegate" /> to be used for all calls into the
      /// <see cref="Value" /> virtual method needed by the
      /// <see cref="SQLiteFunction" /> base class.
      /// </param>
      /// <param name="callback4">
      /// The <see cref="Delegate" /> to be used for all calls into the
      /// <see cref="Inverse" /> virtual method needed by the
      /// <see cref="SQLiteFunction" /> base class.
      /// </param>
      public SQLiteDelegateFunction(
          Delegate callback1,
          Delegate callback2,
          Delegate callback3,
          Delegate callback4
          )
      {
          this.callback1 = callback1;
          this.callback2 = callback2;
          this.callback3 = callback3;
          this.callback4 = callback4;
      }
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Protected Methods
      /// <summary>
      /// Returns the list of arguments for the <see cref="Invoke" /> method,
      /// as an <see cref="Array" /> of <see cref="Object" />.  The first
      /// argument is always the literal string "Invoke".
      /// </summary>
      /// <param name="args">
      /// The original arguments received by the <see cref="Invoke" /> method.
      /// </param>
      /// <param name="earlyBound">
      /// Non-zero if the returned arguments are going to be used with the
      /// <see cref="SQLiteInvokeDelegate" /> type; otherwise, zero.
      /// </param>
      /// <returns>
      /// The arguments to pass to the configured <see cref="Delegate" />.
      /// </returns>
      protected virtual object[] GetInvokeArgs(
          object[] args,
          bool earlyBound
          )

      {
          object[] newArgs = new object[] { "Invoke", args };

          if (!earlyBound)
              newArgs = new object[] { newArgs }; // WRAP

          return newArgs;
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Returns the list of arguments for the <see cref="Step" /> method,
      /// as an <see cref="Array" /> of <see cref="Object" />.  The first
      /// argument is always the literal string "Step".
      /// </summary>
      /// <param name="args">
      /// The original arguments received by the <see cref="Step" /> method.
      /// </param>
      /// <param name="stepNumber">
      /// The step number (one based).  This is incrememted each time the
      /// <see cref="Step" /> method is called.
      /// </param>
      /// <param name="contextData">
      /// A placeholder for implementers to store contextual data pertaining
      /// to the current context.
      /// </param>
      /// <param name="earlyBound">
      /// Non-zero if the returned arguments are going to be used with the
      /// <see cref="SQLiteStepDelegate" /> type; otherwise, zero.
      /// </param>
      /// <returns>
      /// The arguments to pass to the configured <see cref="Delegate" />.
      /// </returns>
      protected virtual object[] GetStepArgs(
          object[] args,
          int stepNumber,
          object contextData,
          bool earlyBound
          )
      {
          object[] newArgs = new object[] {
              "Step", args, stepNumber, contextData
          };

          if (!earlyBound)
              newArgs = new object[] { newArgs }; // WRAP

          return newArgs;
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Updates the output arguments for the <see cref="Step" /> method,
      /// using an <see cref="Array" /> of <see cref="Object" />.  The first
      /// argument is always the literal string "Step".  Currently, only the
      /// <paramref name="contextData" /> parameter is updated.
      /// </summary>
      /// <param name="args">
      /// The original arguments received by the <see cref="Step" /> method.
      /// </param>
      /// <param name="contextData">
      /// A placeholder for implementers to store contextual data pertaining
      /// to the current context.
      /// </param>
      /// <param name="earlyBound">
      /// Non-zero if the returned arguments are going to be used with the
      /// <see cref="SQLiteStepDelegate" /> type; otherwise, zero.
      /// </param>
      /// <returns>
      /// The arguments to pass to the configured <see cref="Delegate" />.
      /// </returns>
      protected virtual void UpdateStepArgs(
          object[] args,
          ref object contextData,
          bool earlyBound
          )
      {
          object[] newArgs;


          if (earlyBound)
              newArgs = args;
          else
              newArgs = args[0] as object[];

          if (newArgs == null)
              return;

          contextData = newArgs[newArgs.Length - 1];
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Returns the list of arguments for the <see cref="Final" /> method,
      /// as an <see cref="Array" /> of <see cref="Object" />.  The first
      /// argument is always the literal string "Final".
      /// </summary>
      /// <param name="contextData">
      /// A placeholder for implementers to store contextual data pertaining
      /// to the current context.
      /// </param>
      /// <param name="earlyBound">
      /// Non-zero if the returned arguments are going to be used with the
      /// <see cref="SQLiteFinalDelegate" /> type; otherwise, zero.
      /// </param>
      /// <returns>
      /// The arguments to pass to the configured <see cref="Delegate" />.
      /// </returns>
      protected virtual object[] GetFinalArgs(
          object contextData,
          bool earlyBound
          )
      {
          object[] newArgs = new object[] { "Final", contextData };

          if (!earlyBound)
              newArgs = new object[] { newArgs }; // WRAP

          return newArgs;
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Returns the list of arguments for the <see cref="Value" /> method,
      /// as an <see cref="Array" /> of <see cref="Object" />.  The first
      /// argument is always the literal string "Value".
      /// </summary>
      /// <param name="contextData">
      /// A placeholder for implementers to store contextual data pertaining
      /// to the current context.
      /// </param>
      /// <param name="earlyBound">
      /// Non-zero if the returned arguments are going to be used with the
      /// <see cref="SQLiteFinalDelegate" /> type; otherwise, zero.
      /// </param>
      /// <returns>
      /// The arguments to pass to the configured <see cref="Delegate" />.
      /// </returns>
      protected virtual object[] GetValueArgs(
          object contextData,
          bool earlyBound
          )
      {
          object[] newArgs = new object[] { "Value", contextData };

          if (!earlyBound)
              newArgs = new object[] { newArgs }; // WRAP

          return newArgs;
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Returns the list of arguments for the <see cref="Inverse" /> method,
      /// as an <see cref="Array" /> of <see cref="Object" />.  The first
      /// argument is always the literal string "Inverse".
      /// </summary>
      /// <param name="args">
      /// The original arguments received by the <see cref="Inverse" /> method.
      /// </param>
      /// <param name="stepNumber">
      /// The step number (one based).  This is incrememted each time the
      /// <see cref="Inverse" /> method is called.
      /// </param>
      /// <param name="contextData">
      /// A placeholder for implementers to store contextual data pertaining
      /// to the current context.
      /// </param>
      /// <param name="earlyBound">
      /// Non-zero if the returned arguments are going to be used with the
      /// <see cref="SQLiteStepDelegate" /> type; otherwise, zero.
      /// </param>
      /// <returns>
      /// The arguments to pass to the configured <see cref="Delegate" />.
      /// </returns>
      protected virtual object[] GetInverseArgs(
          object[] args,
          int stepNumber,
          object contextData,
          bool earlyBound
          )
      {
          object[] newArgs = new object[] {
              "Inverse", args, stepNumber, contextData
          };

          if (!earlyBound)
              newArgs = new object[] { newArgs }; // WRAP

          return newArgs;
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Updates the output arguments for the <see cref="Inverse" /> method,
      /// using an <see cref="Array" /> of <see cref="Object" />.  The first
      /// argument is always the literal string "Inverse".  Currently, only the
      /// <paramref name="contextData" /> parameter is updated.
      /// </summary>
      /// <param name="args">
      /// The original arguments received by the <see cref="Inverse" /> method.
      /// </param>
      /// <param name="contextData">
      /// A placeholder for implementers to store contextual data pertaining
      /// to the current context.
      /// </param>
      /// <param name="earlyBound">
      /// Non-zero if the returned arguments are going to be used with the
      /// <see cref="SQLiteStepDelegate" /> type; otherwise, zero.
      /// </param>
      /// <returns>
      /// The arguments to pass to the configured <see cref="Delegate" />.
      /// </returns>
      protected virtual void UpdateInverseArgs(
          object[] args,
          ref object contextData,
          bool earlyBound
          )
      {
          object[] newArgs;

          if (earlyBound)
              newArgs = args;
          else
              newArgs = args[0] as object[];

          if (newArgs == null)
              return;

          contextData = newArgs[newArgs.Length - 1];
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Returns the list of arguments for the <see cref="Compare" /> method,
      /// as an <see cref="Array" /> of <see cref="Object" />.  The first
      /// argument is always the literal string "Compare".
      /// </summary>
      /// <param name="param1">
      /// The first string to compare.
      /// </param>
      /// <param name="param2">
      /// The second strnig to compare.
      /// </param>
      /// <param name="earlyBound">
      /// Non-zero if the returned arguments are going to be used with the
      /// <see cref="SQLiteCompareDelegate" /> type; otherwise, zero.
      /// </param>
      /// <returns>
      /// The arguments to pass to the configured <see cref="Delegate" />.
      /// </returns>
      protected virtual object[] GetCompareArgs(
          string param1,
          string param2,
          bool earlyBound
          )
      {
          object[] newArgs = new object[] { "Compare", param1, param2 };

          if (!earlyBound)
              newArgs = new object[] { newArgs }; // WRAP

          return newArgs;
      }
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Public Properties
      private Delegate callback1;
      /// <summary>
      /// The <see cref="Delegate" /> to be used for all calls into the
      /// <see cref="Invoke" />, <see cref="Step" />, and
      /// <see cref="Compare" /> virtual methods needed by the
      /// <see cref="SQLiteFunction" /> base class.
      /// </summary>
      public virtual Delegate Callback1
      {
          get { return callback1; }
          set { callback1 = value; }
      }

      /////////////////////////////////////////////////////////////////////////

      private Delegate callback2;
      /// <summary>
      /// The <see cref="Delegate" /> to be used for all calls into the
      /// <see cref="Final" /> virtual methods needed by the
      /// <see cref="SQLiteFunction" /> base class.
      /// </summary>
      public virtual Delegate Callback2
      {
          get { return callback2; }
          set { callback2 = value; }
      }

      /////////////////////////////////////////////////////////////////////////

      private Delegate callback3;
      /// <summary>
      /// The <see cref="Delegate" /> to be used for all calls into the
      /// <see cref="Value" /> virtual methods needed by the
      /// <see cref="SQLiteFunction" /> base class.
      /// </summary>
      public virtual Delegate Callback3
      {
          get { return callback3; }
          set { callback3 = value; }
      }

      /////////////////////////////////////////////////////////////////////////

      private Delegate callback4;
      /// <summary>
      /// The <see cref="Delegate" /> to be used for all calls into the
      /// <see cref="Inverse" /> virtual methods needed by the
      /// <see cref="SQLiteFunction" /> base class.
      /// </summary>
      public virtual Delegate Callback4
      {
          get { return callback4; }
          set { callback4 = value; }
      }
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region System.Data.SQLite.SQLiteFunction Overrides
      /// <summary>
      /// This virtual method is the implementation for scalar functions.
      /// See the <see cref="SQLiteFunction.Invoke" /> method for more
      /// details.
      /// </summary>
      /// <param name="args">
      /// The arguments for the scalar function.
      /// </param>
      /// <returns>
      /// The result of the scalar function.
      /// </returns>
      public override object Invoke(
          object[] args /* in */
          )
      {
          if (callback1 == null)
          {
              throw new InvalidOperationException(
                  HelperMethods.StringFormat(
                  CultureInfo.CurrentCulture,
                  NoCallbackError, "Invoke"));
          }

          SQLiteInvokeDelegate invokeDelegate =
              callback1 as SQLiteInvokeDelegate;

          if (invokeDelegate != null)
          {
              return invokeDelegate.Invoke(
                  "Invoke", args); /* throw */
          }
          else
          {
#if !PLATFORM_COMPACTFRAMEWORK
              return callback1.DynamicInvoke(
                  GetInvokeArgs(args, false)); /* throw */
#else
              throw new NotImplementedException();
#endif
          }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// This virtual method is part of the implementation for aggregate
      /// functions.  See the <see cref="SQLiteFunction.Step" /> method
      /// for more details.
      /// </summary>
      /// <param name="args">
      /// The arguments for the aggregate function.
      /// </param>
      /// <param name="stepNumber">
      /// The step number (one based).  This is incrememted each time the
      /// <see cref="Step" /> method is called.
      /// </param>
      /// <param name="contextData">
      /// A placeholder for implementers to store contextual data pertaining
      /// to the current context.
      /// </param>
      public override void Step(
          object[] args,         /* in */
          int stepNumber,        /* in */
          ref object contextData /* in, out */
          )
      {
          if (callback1 == null)
          {
              throw new InvalidOperationException(
                  HelperMethods.StringFormat(
                  CultureInfo.CurrentCulture,
                  NoCallbackError, "Step"));
          }

          SQLiteStepDelegate stepDelegate =
              callback1 as SQLiteStepDelegate;

          if (stepDelegate != null)
          {
              stepDelegate.Invoke(
                  "Step", args, stepNumber,
                  ref contextData); /* throw */
          }
          else
          {
#if !PLATFORM_COMPACTFRAMEWORK
              object[] newArgs = GetStepArgs(
                  args, stepNumber, contextData, false);

              /* IGNORED */
              callback1.DynamicInvoke(newArgs); /* throw */

              UpdateStepArgs(newArgs, ref contextData, false);
#else
              throw new NotImplementedException();
#endif
          }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// This virtual method is part of the implementation for aggregate
      /// functions.  See the <see cref="SQLiteFunction.Final" /> method
      /// for more details.
      /// </summary>
      /// <param name="contextData">
      /// A placeholder for implementers to store contextual data pertaining
      /// to the current context.
      /// </param>
      /// <returns>
      /// The result of the aggregate function.
      /// </returns>
      public override object Final(
          object contextData /* in */
          )
      {
          if (callback2 == null)
          {
              throw new InvalidOperationException(
                  HelperMethods.StringFormat(
                  CultureInfo.CurrentCulture,
                  NoCallbackError, "Final"));
          }

          SQLiteFinalDelegate finalDelegate =
              callback2 as SQLiteFinalDelegate;

          if (finalDelegate != null)
          {
              return finalDelegate.Invoke(
                  "Final", contextData); /* throw */
          }
          else
          {
#if !PLATFORM_COMPACTFRAMEWORK
              return callback2.DynamicInvoke(GetFinalArgs(
                  contextData, false)); /* throw */
#else
              throw new NotImplementedException();
#endif
          }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// This virtual method is part of the implementation for aggregate
      /// functions.  See the <see cref="SQLiteFunction.Value" /> method
      /// for more details.
      /// </summary>
      /// <param name="contextData">
      /// A placeholder for implementers to store contextual data pertaining
      /// to the current context.
      /// </param>
      /// <returns>
      /// The result of the aggregate function.
      /// </returns>
      public override object Value(
          object contextData /* in */
          )
      {
          if (callback3 == null)
          {
              throw new InvalidOperationException(
                  HelperMethods.StringFormat(
                  CultureInfo.CurrentCulture,
                  NoCallbackError, "Value"));
          }

          SQLiteFinalDelegate valueDelegate =
              callback3 as SQLiteFinalDelegate;

          if (valueDelegate != null)
          {
              return valueDelegate.Invoke(
                  "Value", contextData); /* throw */
          }
          else
          {
#if !PLATFORM_COMPACTFRAMEWORK
              return callback3.DynamicInvoke(GetValueArgs(
                  contextData, false)); /* throw */
#else
              throw new NotImplementedException();
#endif
          }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// This virtual method is part of the implementation for aggregate
      /// functions.  See the <see cref="SQLiteFunction.Inverse" /> method
      /// for more details.
      /// </summary>
      /// <param name="args">
      /// The arguments for the aggregate function.
      /// </param>
      /// <param name="stepNumber">
      /// The step number (one based).  This is incrememted each time the
      /// <see cref="Inverse" /> method is called.
      /// </param>
      /// <param name="contextData">
      /// A placeholder for implementers to store contextual data pertaining
      /// to the current context.
      /// </param>
      public override void Inverse(
          object[] args,         /* in */
          int stepNumber,        /* in */
          ref object contextData /* in, out */
          )
      {
          if (callback4 == null)
          {
              throw new InvalidOperationException(
                  HelperMethods.StringFormat(
                  CultureInfo.CurrentCulture,
                  NoCallbackError, "Inverse"));
          }

          SQLiteStepDelegate inverseDelegate =
              callback4 as SQLiteStepDelegate;

          if (inverseDelegate != null)
          {
              inverseDelegate.Invoke(
                  "Inverse", args, stepNumber,
                  ref contextData); /* throw */
          }
          else
          {
#if !PLATFORM_COMPACTFRAMEWORK
              object[] newArgs = GetInverseArgs(
                  args, stepNumber, contextData, false);

              /* IGNORED */
              callback4.DynamicInvoke(newArgs); /* throw */

              UpdateInverseArgs(newArgs, ref contextData, false);
#else
              throw new NotImplementedException();
#endif
          }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// This virtual method is part of the implementation for collating
      /// sequences.  See the <see cref="SQLiteFunction.Compare" /> method
      /// for more details.
      /// </summary>
      /// <param name="param1">
      /// The first string to compare.
      /// </param>
      /// <param name="param2">
      /// The second strnig to compare.
      /// </param>
      /// <returns>
      /// A positive integer if the <paramref name="param1" /> parameter is
      /// greater than the <paramref name="param2" /> parameter, a negative
      /// integer if the <paramref name="param1" /> parameter is less than
      /// the <paramref name="param2" /> parameter, or zero if they are
      /// equal.
      /// </returns>
      public override int Compare(
          string param1, /* in */
          string param2  /* in */
          )
      {
          if (callback1 == null)
          {
              throw new InvalidOperationException(
                  HelperMethods.StringFormat(
                  CultureInfo.CurrentCulture,
                  NoCallbackError, "Compare"));
          }

          SQLiteCompareDelegate compareDelegate =
              callback1 as SQLiteCompareDelegate;

          if (compareDelegate != null)
          {
              return compareDelegate.Invoke(
                  "Compare", param1, param2); /* throw */
          }
          else
          {
#if !PLATFORM_COMPACTFRAMEWORK
              object result = callback1.DynamicInvoke(GetCompareArgs(
                  param1, param2, false)); /* throw */

              if (result is int)
                  return (int)result;

              throw new InvalidOperationException(
                  HelperMethods.StringFormat(
                  CultureInfo.CurrentCulture,
                  ResultInt32Error, "Compare"));
#else
              throw new NotImplementedException();
#endif
          }
      }
      #endregion
  }

  /////////////////////////////////////////////////////////////////////////////

  /// <summary>
  /// Extends SQLiteFunction and allows an inherited class to obtain the collating sequence associated with a function call.
  /// </summary>
  /// <remarks>
  /// User-defined functions can call the GetCollationSequence() method in this class and use it to compare strings and char arrays.
  /// </remarks>
  public class SQLiteFunctionEx : SQLiteFunction
  {
    /// <summary>
    /// Obtains the collating sequence in effect for the given function.
    /// </summary>
    /// <returns></returns>
    protected CollationSequence GetCollationSequence()
    {
      return _base.GetCollationSequence(this, _context);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable "Pattern" Members
    private bool disposed;
    private void CheckDisposed() /* throw */
    {
#if THROW_ON_DISPOSED
        if (disposed)
            throw new ObjectDisposedException(typeof(SQLiteFunctionEx).Name);
#endif
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Cleans up resources (native and managed) associated with the current instance.
    /// </summary>
    /// <param name="disposing">
    /// Zero when being disposed via garbage collection; otherwise, non-zero.
    /// </param>
    protected override void Dispose(bool disposing)
    {
        try
        {
            if (!disposed)
            {
                //if (disposing)
                //{
                //    ////////////////////////////////////
                //    // dispose managed resources here...
                //    ////////////////////////////////////
                //}

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////
            }
        }
        finally
        {
            base.Dispose(disposing);

            //
            // NOTE: Everything should be fully disposed at this point.
            //
            disposed = true;
        }
    }
    #endregion
  }

  /// <summary>
  /// The type of user-defined function to declare
  /// </summary>
  public enum FunctionType
  {
    /// <summary>
    /// Scalar functions are designed to be called and return a result immediately.  Examples include ABS(), Upper(), Lower(), etc.
    /// </summary>
    Scalar = 0,
    /// <summary>
    /// Aggregate functions are designed to accumulate data until the end of a call and then return a result gleaned from the accumulated data.
    /// Examples include SUM(), COUNT(), AVG(), etc.
    /// </summary>
    Aggregate = 1,
    /// <summary>
    /// Collating sequences are used to sort textual data in a custom manner, and appear in an ORDER BY clause.  Typically text in an ORDER BY is
    /// sorted using a straight case-insensitive comparison function.  Custom collating sequences can be used to alter the behavior of text sorting
    /// in a user-defined manner.
    /// </summary>
    Collation = 2,
    /// <summary>
    /// Window functions are designed to apply aggregate and ranking functions over a particular set of rows.
    /// </summary>
    Window = 3
  }

  /// <summary>
  /// An internal callback delegate declaration.
  /// </summary>
  /// <param name="context">Raw native context pointer for the user function.</param>
  /// <param name="argc">Total number of arguments to the user function.</param>
  /// <param name="argv">Raw native pointer to the array of raw native argument pointers.</param>
#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  public delegate void SQLiteCallback(IntPtr context, int argc, IntPtr argv);
  /// <summary>
  /// An internal final callback delegate declaration.
  /// </summary>
  /// <param name="context">Raw context pointer for the user function</param>
#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  internal delegate void SQLiteFinalCallback(IntPtr context);
  /// <summary>
  /// An internal destroy callback delegate declaration.
  /// </summary>
  /// <param name="pUserData">Raw pointer to the data to free.</param>
#if !PLATFORM_COMPACTFRAMEWORK
  [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
  internal delegate void SQLiteDestroyCallback(IntPtr pUserData);
  /// <summary>
  /// Internal callback delegate for implementing collating sequences
  /// </summary>
  /// <param name="puser">Not used</param>
  /// <param name="len1">Length of the string pv1</param>
  /// <param name="pv1">Pointer to the first string to compare</param>
  /// <param name="len2">Length of the string pv2</param>
  /// <param name="pv2">Pointer to the second string to compare</param>
  /// <returns>Returns -1 if the first string is less than the second.  0 if they are equal, or 1 if the first string is greater

Changes to System.Data.SQLite/SQLiteFunctionAttribute.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

23




24
25
26
27
28

29





















































30
31
32






33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61







62


























































/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Runtime.InteropServices;

  /// <summary>
  /// A simple custom attribute to enable us to easily find user-defined functions in
  /// the loaded assemblies and initialize them in SQLite as connections are made.
  /// </summary>
  [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
  public sealed class SQLiteFunctionAttribute : Attribute
  {
    private string       _name;
    private int          _arguments;
    private FunctionType _functionType;

    internal Type        _instanceType;





    /// <summary>
    /// Default constructor, initializes the internal variables for the function.
    /// </summary>
    public SQLiteFunctionAttribute()

    {





















































      Name = "";
      Arguments = -1;
      FuncType = FunctionType.Scalar;






    }

    /// <summary>
    /// The function's name as it will be used in SQLite command text.
    /// </summary>
    public string Name
    {
      get { return _name; }
      set { _name = value; }
    }

    /// <summary>
    /// The number of arguments this function expects.  -1 if the number of arguments is variable.
    /// </summary>
    public int Arguments
    {
      get { return _arguments; }
      set { _arguments = value; }
    }

    /// <summary>
    /// The type of function this implementation will be.
    /// </summary>
    public FunctionType FuncType
    {
      get { return _functionType; }
      set { _functionType = value; }
    }
  }







}





























































|






<









|

>
|
>
>
>
>





>

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
















|
|










|
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;


  /// <summary>
  /// A simple custom attribute to enable us to easily find user-defined functions in
  /// the loaded assemblies and initialize them in SQLite as connections are made.
  /// </summary>
  [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = true)]
  public sealed class SQLiteFunctionAttribute : Attribute
  {
    private string       _name;
    private int          _argumentCount;
    private FunctionType _functionType;
    private SQLiteFunctionFlags _functionFlags;
    private Type         _instanceType;
    private Delegate     _callback1;
    private Delegate     _callback2;
    private Delegate     _callback3;
    private Delegate     _callback4;

    /// <summary>
    /// Default constructor, initializes the internal variables for the function.
    /// </summary>
    public SQLiteFunctionAttribute()
        : this(null, -1, FunctionType.Scalar)
    {
        // do nothing.
    }

    /// <summary>
    /// Constructs an instance of this class.  This sets the initial
    /// <see cref="InstanceType" />, <see cref="Callback1" />, and
    /// <see cref="Callback2" /> properties to null.
    /// </summary>
    /// <param name="name">
    /// The name of the function, as seen by the SQLite core library.
    /// </param>
    /// <param name="argumentCount">
    /// The number of arguments that the function will accept.
    /// </param>
    /// <param name="functionType">
    /// The type of function being declared.  This will either be Scalar,
    /// Aggregate, or Collation.
    /// </param>
    public SQLiteFunctionAttribute(
        string name,
        int argumentCount,
        FunctionType functionType
        )
        : this(name, argumentCount, functionType, SQLiteFunctionFlags.NONE)
    {
        // do nothing.
    }

    /// <summary>
    /// Constructs an instance of this class.  This sets the initial
    /// <see cref="InstanceType" />, <see cref="Callback1" />, and
    /// <see cref="Callback2" /> properties to null.
    /// </summary>
    /// <param name="name">
    /// The name of the function, as seen by the SQLite core library.
    /// </param>
    /// <param name="argumentCount">
    /// The number of arguments that the function will accept.
    /// </param>
    /// <param name="functionType">
    /// The type of function being declared.  This will either be Scalar,
    /// Aggregate, or Collation.
    /// </param>
    /// <param name="functionFlags">
    /// The extra flags for the function being declared.
    /// </param>
    public SQLiteFunctionAttribute(
        string name,
        int argumentCount,
        FunctionType functionType,
        SQLiteFunctionFlags functionFlags
        )
    {
        _name = name;
        _argumentCount = argumentCount;
        _functionType = functionType;
        _functionFlags = functionFlags;
        _instanceType = null;
        _callback1 = null;
        _callback2 = null;
        _callback3 = null;
        _callback4 = null;
    }

    /// <summary>
    /// The function's name as it will be used in SQLite command text.
    /// </summary>
    public string Name
    {
      get { return _name; }
      set { _name = value; }
    }

    /// <summary>
    /// The number of arguments this function expects.  -1 if the number of arguments is variable.
    /// </summary>
    public int Arguments
    {
      get { return _argumentCount; }
      set { _argumentCount = value; }
    }

    /// <summary>
    /// The type of function this implementation will be.
    /// </summary>
    public FunctionType FuncType
    {
      get { return _functionType; }
      set { _functionType = value; }
    }

    /// <summary>
    /// The flags for this function.
    /// </summary>
    public SQLiteFunctionFlags FuncFlags
    {
        get { return _functionFlags; }
        set { _functionFlags = value; }
    }

    /// <summary>
    /// The <see cref="System.Type" /> object instance that describes the class
    /// containing the implementation for the associated function.  The value of
    /// this property will not be used if either the <see cref="Callback1" /> or
    /// <see cref="Callback2" /> property values are set to non-null.
    /// </summary>
    internal Type InstanceType
    {
        get { return _instanceType; }
        set { _instanceType = value; }
    }

    /// <summary>
    /// The <see cref="Delegate" /> that refers to the implementation for the
    /// associated function.  If this property value is set to non-null, it will
    /// be used instead of the <see cref="InstanceType" /> property value.
    /// </summary>
    internal Delegate Callback1
    {
        get { return _callback1; }
        set { _callback1 = value; }
    }

    /// <summary>
    /// The <see cref="Delegate" /> that refers to the implementation for the
    /// associated function.  If this property value is set to non-null, it will
    /// be used instead of the <see cref="InstanceType" /> property value.
    /// </summary>
    internal Delegate Callback2
    {
        get { return _callback2; }
        set { _callback2 = value; }
    }

    /// <summary>
    /// The <see cref="Delegate" /> that refers to the implementation for the
    /// associated function.  If this property value is set to non-null, it will
    /// be used instead of the <see cref="InstanceType" /> property value.
    /// </summary>
    internal Delegate Callback3
    {
        get { return _callback3; }
        set { _callback3 = value; }
    }

    /// <summary>
    /// The <see cref="Delegate" /> that refers to the implementation for the
    /// associated function.  If this property value is set to non-null, it will
    /// be used instead of the <see cref="InstanceType" /> property value.
    /// </summary>
    internal Delegate Callback4
    {
        get { return _callback4; }
        set { _callback4 = value; }
    }
  }
}

Changes to System.Data.SQLite/SQLiteKeyReader.cs.

1
2
3
4
5
6
7
8
9
10
11
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Data;



|







1
2
3
4
5
6
7
8
9
10
11
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Data;
20
21
22
23
24
25
26

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41










42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85



86
87





























88
89
90
91
92


















93
94
95
96
97
98
99
100
101
102
103
104
105
106
107

108
109
110
111
112
113
114
  /// </remarks>
  /// </summary>
  internal sealed class SQLiteKeyReader : IDisposable
  {
    private KeyInfo[] _keyInfo;
    private SQLiteStatement _stmt;
    private bool _isValid;


    /// <summary>
    /// Used to support CommandBehavior.KeyInfo
    /// </summary>
    private struct KeyInfo
    {
      internal string databaseName;
      internal string tableName;
      internal string columnName;
      internal int database;
      internal int rootPage;
      internal int cursor;
      internal KeyQuery query;
      internal int column;
    }











    /// <summary>
    /// A single sub-query for a given table/database.
    /// </summary>
    private sealed class KeyQuery : IDisposable
    {
      private SQLiteCommand _command;
      internal SQLiteDataReader _reader;

      internal KeyQuery(SQLiteConnection cnn, string database, string table, params string[] columns)
      {
        using (SQLiteCommandBuilder builder = new SQLiteCommandBuilder())
        {
          _command = cnn.CreateCommand();
          for (int n = 0; n < columns.Length; n++)
          {
            columns[n] = builder.QuoteIdentifier(columns[n]);
          }
        }
        _command.CommandText = String.Format(CultureInfo.InvariantCulture, "SELECT {0} FROM [{1}].[{2}] WHERE ROWID = ?", String.Join(",", columns), database, table);
        _command.Parameters.AddWithValue(null, (long)0);
      }

      internal bool IsValid
      {
        set
        {
          if (value != false) throw new ArgumentException();
          if (_reader != null)
          {
            _reader.Dispose();
            _reader = null;
          }
        }
      }

      internal void Sync(long rowid)
      {
        IsValid = false;
        _command.Parameters[0].Value = rowid;
        _reader = _command.ExecuteReader();
        _reader.Read();
      }




      public void Dispose()
      {





























        IsValid = false;

        if (_command != null) _command.Dispose();
        _command = null;
      }


















    }

    /// <summary>
    /// This function does all the nasty work at determining what keys need to be returned for
    /// a given statement.
    /// </summary>
    /// <param name="cnn"></param>
    /// <param name="reader"></param>
    /// <param name="stmt"></param>
    internal SQLiteKeyReader(SQLiteConnection cnn, SQLiteDataReader reader, SQLiteStatement stmt)
    {
      Dictionary<string, int> catalogs = new Dictionary<string, int>();
      Dictionary<string, List<string>> tables = new Dictionary<string, List<string>>();
      List<string> list;
      List<KeyInfo> keys = new List<KeyInfo>();


      // Record the statement so we can use it later for sync'ing
      _stmt = stmt;

      // Fetch all the attached databases on this connection
      using (DataTable tbl = cnn.GetSchema("Catalogs"))
      {







>















>
>
>
>
>
>
>
>
>
>






|
|

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

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

|
|
|
|
|
|
|

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

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















>







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
  /// </remarks>
  /// </summary>
  internal sealed class SQLiteKeyReader : IDisposable
  {
    private KeyInfo[] _keyInfo;
    private SQLiteStatement _stmt;
    private bool _isValid;
    private RowIdInfo[] _rowIdInfo;

    /// <summary>
    /// Used to support CommandBehavior.KeyInfo
    /// </summary>
    private struct KeyInfo
    {
      internal string databaseName;
      internal string tableName;
      internal string columnName;
      internal int database;
      internal int rootPage;
      internal int cursor;
      internal KeyQuery query;
      internal int column;
    }

    /// <summary>
    /// Used to keep track of the per-table RowId column metadata.
    /// </summary>
    private struct RowIdInfo
    {
        internal string databaseName;
        internal string tableName;
        internal int column;
    }

    /// <summary>
    /// A single sub-query for a given table/database.
    /// </summary>
    private sealed class KeyQuery : IDisposable
    {
        private SQLiteCommand _command;
        internal SQLiteDataReader _reader;

        internal KeyQuery(SQLiteConnection cnn, string database, string table, params string[] columns)
        {
            using (SQLiteCommandBuilder builder = new SQLiteCommandBuilder())
            {
                _command = cnn.CreateCommand();
                for (int n = 0; n < columns.Length; n++)
                {
                    columns[n] = builder.QuoteIdentifier(columns[n]);
                }
            }
            _command.CommandText = HelperMethods.StringFormat(CultureInfo.InvariantCulture, "SELECT {0} FROM [{1}].[{2}] WHERE ROWID = ?", String.Join(",", columns), database, table);
            _command.Parameters.AddWithValue(null, (long)0);
        }

        internal bool IsValid
        {
            set
            {
                if (value != false) throw new ArgumentException();
                if (_reader != null)
                {
                    _reader.Dispose();
                    _reader = null;
                }
            }
        }

        internal void Sync(long rowid)
        {
            IsValid = false;
            _command.Parameters[0].Value = rowid;
            _reader = _command.ExecuteReader();
            _reader.Read();
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region IDisposable Members
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        private bool disposed;
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
                throw new ObjectDisposedException(typeof(KeyQuery).Name);
#endif
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        private void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    ////////////////////////////////////
                    // dispose managed resources here...
                    ////////////////////////////////////

                    IsValid = false;

                    if (_command != null) _command.Dispose();
                    _command = null;
                }

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////

                disposed = true;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region Destructor
        ~KeyQuery()
        {
            Dispose(false);
        }
        #endregion
    }

    /// <summary>
    /// This function does all the nasty work at determining what keys need to be returned for
    /// a given statement.
    /// </summary>
    /// <param name="cnn"></param>
    /// <param name="reader"></param>
    /// <param name="stmt"></param>
    internal SQLiteKeyReader(SQLiteConnection cnn, SQLiteDataReader reader, SQLiteStatement stmt)
    {
      Dictionary<string, int> catalogs = new Dictionary<string, int>();
      Dictionary<string, List<string>> tables = new Dictionary<string, List<string>>();
      List<string> list;
      List<KeyInfo> keys = new List<KeyInfo>();
      List<RowIdInfo> rowIds = new List<RowIdInfo>();

      // Record the statement so we can use it later for sync'ing
      _stmt = stmt;

      // Fetch all the attached databases on this connection
      using (DataTable tbl = cnn.GetSchema("Catalogs"))
      {
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
        {
          for (int i = 0; i < pair.Value.Count; i++)
          {
            string table = pair.Value[i];
            DataRow preferredRow = null;
            using (DataTable tbl = cnn.GetSchema("Indexes", new string[] { pair.Key, null, table }))
            {
              // Loop twice.  The first time looking for a primary key index, 
              // the second time looking for a unique index
              for (int n = 0; n < 2 && preferredRow == null; n++)
              {
                foreach (DataRow row in tbl.Rows)
                {
                  if (n == 0 && (bool)row["PRIMARY_KEY"] == true)
                  {







|







211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
        {
          for (int i = 0; i < pair.Value.Count; i++)
          {
            string table = pair.Value[i];
            DataRow preferredRow = null;
            using (DataTable tbl = cnn.GetSchema("Indexes", new string[] { pair.Key, null, table }))
            {
              // Loop twice.  The first time looking for a primary key index,
              // the second time looking for a unique index
              for (int n = 0; n < 2 && preferredRow == null; n++)
              {
                foreach (DataRow row in tbl.Rows)
                {
                  if (n == 0 && (bool)row["PRIMARY_KEY"] == true)
                  {
184
185
186
187
188
189
190





191
192
193
194
195



196
197
198
199
200
201
202
203
204
205
206










207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
                  int database = catalogs[pair.Key];
                  int rootPage = Convert.ToInt32(tblTables.Rows[0]["TABLE_ROOTPAGE"], CultureInfo.InvariantCulture);
                  int cursor = stmt._sql.GetCursorForTable(stmt, database, rootPage);

                  // Now enumerate the members of the index we're going to use
                  using (DataTable indexColumns = cnn.GetSchema("IndexColumns", new string[] { pair.Key, null, table, (string)preferredRow["INDEX_NAME"] }))
                  {





                    KeyQuery query = null;

                    List<string> cols = new List<string>();
                    for (int x = 0; x < indexColumns.Rows.Count; x++)
                    {



                      bool addKey = true;
                      // If the column in the index already appears in the query, skip it
                      foreach (DataRow row in schema.Rows)
                      {
                        if (row.IsNull(SchemaTableColumn.BaseColumnName))
                          continue;

                        if ((string)row[SchemaTableColumn.BaseColumnName] == (string)indexColumns.Rows[x]["COLUMN_NAME"] &&
                            (string)row[SchemaTableColumn.BaseTableName] == table &&
                            (string)row[SchemaTableOptionalColumn.BaseCatalogName] == pair.Key)
                        {










                          indexColumns.Rows.RemoveAt(x);
                          x--;
                          addKey = false;
                          break;
                        }
                      }
                      if (addKey == true)
                        cols.Add((string)indexColumns.Rows[x]["COLUMN_NAME"]);
                    }

                    // If the index is not a rowid alias, record all the columns
                    // needed to make up the unique index and construct a SQL query for it
                    if ((string)preferredRow["INDEX_NAME"] != "sqlite_master_PK_" + table)
                    {
                      // Whatever remains of the columns we need that make up the index that are not
                      // already in the query need to be queried separately, so construct a subquery
                      if (cols.Count > 0)
                      {
                        string[] querycols = new string[cols.Count];
                        cols.CopyTo(querycols);
                        query = new KeyQuery(cnn, pair.Key, table, querycols);
                      }
                    }

                    // Create a KeyInfo struct for each column of the index
                    for (int x = 0; x < indexColumns.Rows.Count; x++)
                    {
                      string columnName = (string)indexColumns.Rows[x]["COLUMN_NAME"];
                      KeyInfo key = new KeyInfo();

                      key.rootPage = rootPage;
                      key.cursor = cursor;
                      key.database = database;
                      key.databaseName = pair.Key;
                      key.tableName = table;







>
>
>
>
>





>
>
>







|



>
>
>
>
>
>
>
>
>
>







|




|














|







246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
                  int database = catalogs[pair.Key];
                  int rootPage = Convert.ToInt32(tblTables.Rows[0]["TABLE_ROOTPAGE"], CultureInfo.InvariantCulture);
                  int cursor = stmt._sql.GetCursorForTable(stmt, database, rootPage);

                  // Now enumerate the members of the index we're going to use
                  using (DataTable indexColumns = cnn.GetSchema("IndexColumns", new string[] { pair.Key, null, table, (string)preferredRow["INDEX_NAME"] }))
                  {
                    //
                    // NOTE: If this is actually a RowId (or alias), record that now.  There should
                    //       be exactly one index column in that case.
                    //
                    bool isRowId = (string)preferredRow["INDEX_NAME"] == "sqlite_master_PK_" + table;
                    KeyQuery query = null;

                    List<string> cols = new List<string>();
                    for (int x = 0; x < indexColumns.Rows.Count; x++)
                    {
                      string columnName = SQLiteConvert.GetStringOrNull(
                          indexColumns.Rows[x]["COLUMN_NAME"]);

                      bool addKey = true;
                      // If the column in the index already appears in the query, skip it
                      foreach (DataRow row in schema.Rows)
                      {
                        if (row.IsNull(SchemaTableColumn.BaseColumnName))
                          continue;

                        if ((string)row[SchemaTableColumn.BaseColumnName] == columnName &&
                            (string)row[SchemaTableColumn.BaseTableName] == table &&
                            (string)row[SchemaTableOptionalColumn.BaseCatalogName] == pair.Key)
                        {
                          if (isRowId)
                          {
                            RowIdInfo rowId = new RowIdInfo();

                            rowId.databaseName = pair.Key;
                            rowId.tableName = table;
                            rowId.column = (int)row[SchemaTableColumn.ColumnOrdinal];

                            rowIds.Add(rowId);
                          }
                          indexColumns.Rows.RemoveAt(x);
                          x--;
                          addKey = false;
                          break;
                        }
                      }
                      if (addKey == true)
                        cols.Add(columnName);
                    }

                    // If the index is not a rowid alias, record all the columns
                    // needed to make up the unique index and construct a SQL query for it
                    if (!isRowId)
                    {
                      // Whatever remains of the columns we need that make up the index that are not
                      // already in the query need to be queried separately, so construct a subquery
                      if (cols.Count > 0)
                      {
                        string[] querycols = new string[cols.Count];
                        cols.CopyTo(querycols);
                        query = new KeyQuery(cnn, pair.Key, table, querycols);
                      }
                    }

                    // Create a KeyInfo struct for each column of the index
                    for (int x = 0; x < indexColumns.Rows.Count; x++)
                    {
                      string columnName = SQLiteConvert.GetStringOrNull(indexColumns.Rows[x]["COLUMN_NAME"]);
                      KeyInfo key = new KeyInfo();

                      key.rootPage = rootPage;
                      key.cursor = cursor;
                      key.database = database;
                      key.databaseName = pair.Key;
                      key.tableName = table;
253
254
255
256
257
258
259
260


























































































































261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
        }
      }

      // Now we have all the additional columns we have to return in order to support
      // CommandBehavior.KeyInfo
      _keyInfo = new KeyInfo[keys.Count];
      keys.CopyTo(_keyInfo);
    }



























































































































    /// <summary>
    /// How many additional columns of keyinfo we're holding
    /// </summary>
    internal int Count
    {
      get { return (_keyInfo == null) ? 0 : _keyInfo.Length; }
    }

    internal void Sync(int i)
    {
      Sync();
      if (_keyInfo[i].cursor == -1)
        throw new InvalidCastException();
    }

    /// <summary>
    /// Make sure all the subqueries are open and ready and sync'd with the current rowid
    /// of the table they're supporting
    /// </summary>
    internal void Sync()
    {
      if (_isValid == true) return;

      KeyQuery last = null;

      for (int n = 0; n < _keyInfo.Length; n++)
      {







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









|










|







333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
        }
      }

      // Now we have all the additional columns we have to return in order to support
      // CommandBehavior.KeyInfo
      _keyInfo = new KeyInfo[keys.Count];
      keys.CopyTo(_keyInfo);

      _rowIdInfo = new RowIdInfo[rowIds.Count];
      rowIds.CopyTo(_rowIdInfo);
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    internal int GetRowIdIndex(
        string databaseName,
        string tableName
        )
    {
        if ((_rowIdInfo != null) &&
            (databaseName != null) &&
            (tableName != null))
        {
            for (int i = 0; i < _rowIdInfo.Length; i++)
            {
                if (_rowIdInfo[i].databaseName == databaseName &&
                    _rowIdInfo[i].tableName == tableName)
                {
                    return _rowIdInfo[i].column;
                }
            }
        }

        return -1;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    internal long? GetRowId(
        string databaseName,
        string tableName
        )
    {
        if ((_keyInfo != null) &&
            (databaseName != null) &&
            (tableName != null))
        {
            for (int i = 0; i < _keyInfo.Length; i++)
            {
                if (_keyInfo[i].databaseName == databaseName &&
                    _keyInfo[i].tableName == tableName)
                {
                    long rowid = _stmt._sql.GetRowIdForCursor(_stmt, _keyInfo[i].cursor);

                    if (rowid != 0)
                        return rowid;
                }
            }
        }

        return null;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable Members
    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable "Pattern" Members
    private bool disposed;
    private void CheckDisposed() /* throw */
    {
#if THROW_ON_DISPOSED
        if (disposed)
            throw new ObjectDisposedException(typeof(SQLiteKeyReader).Name);
#endif
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private void Dispose(bool disposing)
    {
        if (!disposed)
        {
            if (disposing)
            {
                ////////////////////////////////////
                // dispose managed resources here...
                ////////////////////////////////////

                _stmt = null;

                if (_keyInfo != null)
                {
                    for (int n = 0; n < _keyInfo.Length; n++)
                    {
                        if (_keyInfo[n].query != null)
                            _keyInfo[n].query.Dispose();
                    }

                    _keyInfo = null;
                }
            }

            //////////////////////////////////////
            // release unmanaged resources here...
            //////////////////////////////////////

            disposed = true;
        }
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region Destructor
    ~SQLiteKeyReader()
    {
        Dispose(false);
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// How many additional columns of keyinfo we're holding
    /// </summary>
    internal int Count
    {
      get { return (_keyInfo == null) ? 0 : _keyInfo.Length; }
    }

    private void Sync(int i)
    {
      Sync();
      if (_keyInfo[i].cursor == -1)
        throw new InvalidCastException();
    }

    /// <summary>
    /// Make sure all the subqueries are open and ready and sync'd with the current rowid
    /// of the table they're supporting
    /// </summary>
    private void Sync()
    {
      if (_isValid == true) return;

      KeyQuery last = null;

      for (int n = 0; n < _keyInfo.Length; n++)
      {
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336







337
338
339
340
341
342
343










344
345
346
347
348
349
350
351
352
353
354
355
356
357







358
359
360
361
362
363
364
      for (int n = 0; n < _keyInfo.Length; n++)
      {
        if (_keyInfo[n].query != null)
          _keyInfo[n].query.IsValid = false;
      }
    }

    public void Dispose()
    {
      _stmt = null;

      if (_keyInfo == null) return;

      for (int n = 0; n < _keyInfo.Length; n++)
      {
        if (_keyInfo[n].query != null)
          _keyInfo[n].query.Dispose();
      }
      _keyInfo = null;
    }

    internal string GetDataTypeName(int i)
    {
      Sync();
      if (_keyInfo[i].query != null) return _keyInfo[i].query._reader.GetDataTypeName(_keyInfo[i].column);
      else return "integer";
    }








    internal Type GetFieldType(int i)
    {
      Sync();
      if (_keyInfo[i].query != null) return _keyInfo[i].query._reader.GetFieldType(_keyInfo[i].column);
      else return typeof(Int64);
    }











    internal string GetName(int i)
    {
      return _keyInfo[i].columnName;
    }

    internal int GetOrdinal(string name)
    {
      for (int n = 0; n < _keyInfo.Length; n++)
      {
        if (String.Compare(name, _keyInfo[n].columnName, StringComparison.OrdinalIgnoreCase) == 0) return n;
      }
      return -1;
    }








    internal bool GetBoolean(int i)
    {
      Sync(i);
      if (_keyInfo[i].query != null) return _keyInfo[i].query._reader.GetBoolean(_keyInfo[i].column);
      else throw new InvalidCastException();
    }







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






>
>
>
>
>
>
>







>
>
>
>
>
>
>
>
>
>














>
>
>
>
>
>
>







512
513
514
515
516
517
518














519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
      for (int n = 0; n < _keyInfo.Length; n++)
      {
        if (_keyInfo[n].query != null)
          _keyInfo[n].query.IsValid = false;
      }
    }















    internal string GetDataTypeName(int i)
    {
      Sync();
      if (_keyInfo[i].query != null) return _keyInfo[i].query._reader.GetDataTypeName(_keyInfo[i].column);
      else return "integer";
    }

    internal TypeAffinity GetFieldAffinity(int i)
    {
      Sync();
      if (_keyInfo[i].query != null) return _keyInfo[i].query._reader.GetFieldAffinity(_keyInfo[i].column);
      else return TypeAffinity.Uninitialized;
    }

    internal Type GetFieldType(int i)
    {
      Sync();
      if (_keyInfo[i].query != null) return _keyInfo[i].query._reader.GetFieldType(_keyInfo[i].column);
      else return typeof(Int64);
    }

    internal string GetDatabaseName(int i)
    {
        return _keyInfo[i].databaseName;
    }

    internal string GetTableName(int i)
    {
        return _keyInfo[i].tableName;
    }

    internal string GetName(int i)
    {
      return _keyInfo[i].columnName;
    }

    internal int GetOrdinal(string name)
    {
      for (int n = 0; n < _keyInfo.Length; n++)
      {
        if (String.Compare(name, _keyInfo[n].columnName, StringComparison.OrdinalIgnoreCase) == 0) return n;
      }
      return -1;
    }

    internal SQLiteBlob GetBlob(int i, bool readOnly)
    {
      Sync(i);
      if (_keyInfo[i].query != null) return _keyInfo[i].query._reader.GetBlob(_keyInfo[i].column, readOnly);
      else throw new InvalidCastException();
    }

    internal bool GetBoolean(int i)
    {
      Sync(i);
      if (_keyInfo[i].query != null) return _keyInfo[i].query._reader.GetBoolean(_keyInfo[i].column);
      else throw new InvalidCastException();
    }
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
    {
      Sync(i);
      if (_keyInfo[i].query != null) return _keyInfo[i].query._reader.GetInt64(_keyInfo[i].column);
      else
      {
        long rowid = _stmt._sql.GetRowIdForCursor(_stmt, _keyInfo[i].cursor);
        if (rowid == 0) throw new InvalidCastException();
        return Convert.ToInt64(rowid);
      }
    }

    internal string GetString(int i)
    {
      Sync(i);
      if (_keyInfo[i].query != null) return _keyInfo[i].query._reader.GetString(_keyInfo[i].column);







|







666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
    {
      Sync(i);
      if (_keyInfo[i].query != null) return _keyInfo[i].query._reader.GetInt64(_keyInfo[i].column);
      else
      {
        long rowid = _stmt._sql.GetRowIdForCursor(_stmt, _keyInfo[i].cursor);
        if (rowid == 0) throw new InvalidCastException();
        return rowid;
      }
    }

    internal string GetString(int i)
    {
      Sync(i);
      if (_keyInfo[i].query != null) return _keyInfo[i].query._reader.GetString(_keyInfo[i].column);

Added System.Data.SQLite/SQLiteLog.cs.











































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

#if PLATFORM_COMPACTFRAMEWORK
using EventWaitHandle = System.Threading.ManualResetEvent;
#endif

namespace System.Data.SQLite
{
    using System;
    using System.Data.Common;
    using System.Diagnostics;
    using System.Globalization;
    using System.Threading;

    /// <summary>
    /// Event data for logging event handlers.
    /// </summary>
    public class LogEventArgs : EventArgs
    {
        /// <summary>
        /// The error code.  The type of this object value should be
        /// <see cref="Int32" /> or <see cref="SQLiteErrorCode" />.
        /// </summary>
        public readonly object ErrorCode;

        /// <summary>
        /// SQL statement text as the statement first begins executing
        /// </summary>
        public readonly string Message;

        /// <summary>
        /// Extra data associated with this event, if any.
        /// </summary>
        public readonly object Data;

        /// <summary>
        /// Constructs the object.
        /// </summary>
        /// <param name="pUserData">Should be null.</param>
        /// <param name="errorCode">
        /// The error code.  The type of this object value should be
        /// <see cref="Int32" /> or <see cref="SQLiteErrorCode" />.
        /// </param>
        /// <param name="message">The error message, if any.</param>
        /// <param name="data">The extra data, if any.</param>
        internal LogEventArgs(
            IntPtr pUserData,
            object errorCode,
            string message,
            object data
            )
        {
            ErrorCode = errorCode;
            Message = message;
            Data = data;
        }
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Raised when a log event occurs.
    /// </summary>
    /// <param name="sender">The current connection</param>
    /// <param name="e">Event arguments of the trace</param>
    public delegate void SQLiteLogEventHandler(object sender, LogEventArgs e);

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Manages the SQLite custom logging functionality and the associated
    /// callback for the whole process.
    /// </summary>
    public static class SQLiteLog
    {
        #region Private Constants
        /// <summary>
        /// Maximum number of milliseconds a non-primary thread should wait
        /// for the <see cref="PrivateInitialize" /> method to be completed.
        /// </summary>
        private const int _initializeTimeout = 1000;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Data
        /// <summary>
        /// Object used to synchronize access to the static instance data
        /// for this class.
        /// </summary>
        private static object syncRoot = new object();

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This will be signaled when the <see cref="PrivateInitialize" />
        /// method has been completed.
        /// </summary>
        private static EventWaitHandle _initializeEvent;

        ///////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
        /// <summary>
        /// Member variable to store the AppDomain.DomainUnload event handler.
        /// </summary>
        private static EventHandler _domainUnload;
#endif

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Member variable to store the application log handler to call.
        /// </summary>
        private static event SQLiteLogEventHandler _handlers;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The default log event handler.
        /// </summary>
        private static SQLiteLogEventHandler _defaultHandler;

        ///////////////////////////////////////////////////////////////////////

#if !USE_INTEROP_DLL || !INTEROP_LOG
        /// <summary>
        /// The log callback passed to native SQLite engine.  This must live
        /// as long as the SQLite library has a pointer to it.
        /// </summary>
        private static SQLiteLogCallback _callback;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The base SQLite object to interop with.
        /// </summary>
        private static SQLiteBase _sql;
#endif

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The number of times that the <see cref="Initialize(string)" />
        /// method has been called when the logging subystem was actually
        /// eligible to be initialized (i.e. without the "No_SQLiteLog"
        /// environment variable being set).
        /// </summary>
        private static int _initializeCallCount;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The number of times that the <see cref="Uninitialize()" /> method
        /// has been called.
        /// </summary>
        private static int _uninitializeCallCount;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The number of times that the <see cref="Initialize(string)" />
        /// method has been completed (i.e. without the "No_SQLiteLog"
        /// environment variable being set).
        /// </summary>
        private static int _initializeDoneCount;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This will be non-zero if an attempt was already made to initialize
        /// the (managed) logging subsystem.
        /// </summary>
        private static int _attemptedInitialize;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This will be non-zero if logging is currently enabled.
        /// </summary>
        private static bool _enabled;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Creates the <see cref="EventWaitHandle" /> that will be used to
        /// signal completion of the <see cref="PrivateInitialize" /> method,
        /// if necessary, and then returns it.
        /// </summary>
        /// <returns>
        /// The <see cref="EventWaitHandle" /> that will be used to signal
        /// completion of the <see cref="PrivateInitialize" /> method.
        /// </returns>
        private static EventWaitHandle CreateAndOrGetTheEvent()
        {
            bool created = false;
            EventWaitHandle newEvent = null;

            try
            {
                EventWaitHandle oldEvent;

                oldEvent = Interlocked.CompareExchange(
                    ref _initializeEvent, null, null);

                if (oldEvent == null)
                {
                    newEvent = new ManualResetEvent(false);

                    oldEvent = Interlocked.CompareExchange(
                        ref _initializeEvent, newEvent, null);
                }

                if (oldEvent == null)
                {
                    oldEvent = newEvent;
                    created = true;
                }

                return oldEvent;
            }
            finally
            {
                if (!created && (newEvent != null))
                {
                    newEvent.Close();
                    newEvent = null;
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method checks to see if the SQLite core library allows its
        /// native logging callback to be changed when it has already been
        /// initialized, either explicitly or implicitly.
        /// </summary>
        /// <returns>
        /// Non-zero if the SQLite core library initialization state can be
        /// safely ignored when setting up logging; otherwise, zero.
        /// </returns>
        private static bool CanIgnoreIsInitialized()
        {
            try
            {
                if (UnsafeNativeMethods.sqlite3_libversion_number() >= 3042000)
                    return true;
            }
            catch
            {
                // do nothing.
            }

            return false;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes the SQLite logging facilities.
        /// </summary>
        public static void Initialize()
        {
            Initialize(null);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes the SQLite logging facilities -OR- waits for the
        /// SQLite logging facilities to be initialized by another thread.
        /// </summary>
        /// <param name="className">
        /// The name of the managed class that called this method.  This
        /// parameter may be null.
        /// </param>
        internal static void Initialize(
            string className
            )
        {
            //
            // NOTE: See if the logging subsystem has been totally disabled.
            //       If so, do nothing.
            //
            if (UnsafeNativeMethods.GetSettingValue(
                    "No_SQLiteLog", null) != null)
            {
                return;
            }

            ///////////////////////////////////////////////////////////////////

            //
            // NOTE: Before doing anything else, see if this method was
            //       fully completed before.  If so, do nothing.
            //
            EventWaitHandle theEvent = CreateAndOrGetTheEvent();

            if (Interlocked.Increment(ref _initializeDoneCount) == 1)
            {
                bool success = false;

                try
                {
                    success = PrivateInitialize(className);
                }
                finally
                {
                    if (theEvent != null)
                        theEvent.Set();

                    if (!success)
                        Interlocked.Decrement(ref _initializeDoneCount);
                }
            }
            else
            {
                Interlocked.Decrement(ref _initializeDoneCount);
            }

            if ((theEvent != null) &&
                !theEvent.WaitOne(_initializeTimeout, false))
            {
#if !NET_COMPACT_20
                Trace.WriteLine(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "TIMED OUT ({0}) waiting for logging subsystem",
                    _initializeTimeout));
#endif
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Initializes the SQLite logging facilities.
        /// </summary>
        /// <param name="className">
        /// The name of the managed class that called this method.  This
        /// parameter may be null.
        /// </param>
        /// <returns>
        /// Non-zero if everything was fully initialized successfully.
        /// </returns>
        private static bool PrivateInitialize(
            string className
            )
        {
            //
            // NOTE: Keep track of exactly how many times this method is
            //       called (i.e. per-AppDomain, of course).
            //
            Interlocked.Increment(ref _initializeCallCount);

            ///////////////////////////////////////////////////////////////////

            //
            // NOTE: First, check if the managed logging subsystem is always
            //       supposed to at least attempt to initialize itself.  In
            //       order to do this, several fairly complex steps must be
            //       taken, including calling a P/Invoke (interop) method;
            //       therefore, by default, attempt to perform these steps
            //       once.
            //
            if (UnsafeNativeMethods.GetSettingValue(
                    "Initialize_SQLiteLog", null) == null)
            {
                if (Interlocked.Increment(ref _attemptedInitialize) > 1)
                {
                    Interlocked.Decrement(ref _attemptedInitialize);
                    return false;
                }
            }

            ///////////////////////////////////////////////////////////////////

            //
            // BUFXIX: Cannot initialize the logging interface if the SQLite
            //         core library has already been initialized anywhere in
            //         the process (see ticket [2ce0870fad]).
            //
            if (!CanIgnoreIsInitialized() && SQLite3.StaticIsInitialized())
                return false;

            ///////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
            //
            // BUGFIX: To avoid nasty situations where multiple AppDomains are
            //         attempting to initialize and/or shutdown what is really
            //         a shared native resource (i.e. the SQLite core library
            //         is loaded per-process and has only one logging callback,
            //         not one per-AppDomain, which it knows nothing about),
            //         prevent all non-default AppDomains from registering a
            //         log handler unless the "Force_SQLiteLog" environment
            //         variable is used to manually override this safety check.
            //
            if (!AppDomain.CurrentDomain.IsDefaultAppDomain() &&
                UnsafeNativeMethods.GetSettingValue("Force_SQLiteLog", null) == null)
            {
                return false;
            }
#endif

            ///////////////////////////////////////////////////////////////////

            lock (syncRoot)
            {
                //
                // BUFXIX: In order to prevent a subtle race condition within
                //         this method, check (again) if the core library has
                //         already been initialized anywhere in the process,
                //         this time while holding the lock.
                //
                if (!CanIgnoreIsInitialized() && SQLite3.StaticIsInitialized())
                    return false;

                ///////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
                //
                // NOTE: Add an event handler for the DomainUnload event so
                //       that we can unhook our logging managed function
                //       pointer from the native SQLite code prior to it
                //       being invalidated.
                //
                // BUGFIX: Make sure this event handler is only added one
                //         time (per-AppDomain).
                //
                if (_domainUnload == null)
                {
                    _domainUnload = new EventHandler(DomainUnload);
                    AppDomain.CurrentDomain.DomainUnload += _domainUnload;
                }
#endif

                ///////////////////////////////////////////////////////////////

#if USE_INTEROP_DLL && INTEROP_LOG
                //
                // NOTE: Attempt to setup interop assembly log callback.
                //       This may fail, e.g. if the SQLite core library
                //       has somehow been initialized.  An exception will
                //       be raised in that case.
                //
                SQLiteErrorCode rc = SQLite3.ConfigureLogForInterop(
                    className);

                if (rc != SQLiteErrorCode.Ok)
                {
                    throw new SQLiteException(rc,
                        "Failed to configure interop assembly logging.");
                }
#else
                //
                // NOTE: Create an instance of the SQLite wrapper class.
                //
                if (_sql == null)
                {
                    _sql = new SQLite3(
                        SQLiteDateFormats.Default, DateTimeKind.Unspecified,
                        null, IntPtr.Zero, null, false);
                }

                //
                // NOTE: Create a single "global" (i.e. per-process) callback
                //       to register with SQLite.  This callback will pass the
                //       event on to any registered handler.  We only want to
                //       do this once.
                //
                if (_callback == null)
                {
                    _callback = new SQLiteLogCallback(LogCallback);

                    SQLiteErrorCode rc = _sql.SetLogCallback(_callback);

                    if (rc != SQLiteErrorCode.Ok)
                    {
                        _callback = null; /* UNDO */

                        throw new SQLiteException(rc,
                            "Failed to configure managed assembly logging.");
                    }
                }
#endif

                ///////////////////////////////////////////////////////////////

                //
                // NOTE: Logging is enabled by default unless the configuration
                //       setting "Disable_SQLiteLog" is present.
                //
                if (UnsafeNativeMethods.GetSettingValue(
                        "Disable_SQLiteLog", null) == null)
                {
                    _enabled = true;
                }

                ///////////////////////////////////////////////////////////////

                //
                // NOTE: For now, always setup the default log event handler.
                //
                AddDefaultHandler();
            }

            ///////////////////////////////////////////////////////////////////

            return true;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Uninitializes the SQLite logging facilities.
        /// </summary>
        public static void Uninitialize()
        {
            Uninitialize(null, false);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Uninitializes the SQLite logging facilities.
        /// </summary>
        /// <param name="className">
        /// The name of the managed class that called this method.  This
        /// parameter may be null.
        /// </param>
        /// <param name="shutdown">
        /// Non-zero if the native SQLite library should be shutdown prior
        /// to attempting to unset its logging callback.
        /// </param>
        internal static void Uninitialize(
            string className,
            bool shutdown
            )
        {
            //
            // NOTE: Keep track of exactly how many times this method is
            //       called (i.e. per-AppDomain, of course).
            //
            Interlocked.Increment(ref _uninitializeCallCount);

            ///////////////////////////////////////////////////////////////////

            lock (syncRoot)
            {
                //
                // NOTE: Remove the default log event handler.
                //
                RemoveDefaultHandler();

                ///////////////////////////////////////////////////////////////

                //
                // NOTE: Disable logging.  If necessary, it can be re-enabled
                //       later by the Initialize method.
                //
                _enabled = false;

                ///////////////////////////////////////////////////////////////

#if USE_INTEROP_DLL && INTEROP_LOG
                //
                // NOTE: Attempt to unset interop assembly log callback.
                //       This may fail, e.g. if the SQLite core library
                //       has somehow been initialized.  An exception will
                //       be raised in that case.
                //
                SQLiteErrorCode rc = SQLite3.UnConfigureLogForInterop(
                    className);

                if (rc != SQLiteErrorCode.Ok)
                {
                    throw new SQLiteException(rc,
                        "Failed to unconfigure interop assembly logging.");
                }
#else
                //
                // BUGBUG: This may cause serious problems if other AppDomains
                //         have any open SQLite connections; however, there is
                //         currently no way around this limitation.
                //
                if (_sql != null)
                {
                    SQLiteErrorCode rc;

                    if (shutdown)
                    {
                        rc = _sql.Shutdown();

                        if (rc != SQLiteErrorCode.Ok)
                            throw new SQLiteException(rc,
                                "Failed to shutdown interface.");
                    }

                    rc = _sql.SetLogCallback(null);

                    if (rc != SQLiteErrorCode.Ok)
                        throw new SQLiteException(rc,
                            "Failed to shutdown logging.");
                }

                ///////////////////////////////////////////////////////////////

                //
                // BUGFIX: Make sure to reset the callback for next time.  This
                //         must be done after it has been succesfully removed
                //         as logging callback by the SQLite core library as we
                //         cannot allow native code to refer to a delegate that
                //         has been garbage collected.
                //
                if (_callback != null)
                {
                    _callback = null;
                }
#endif

                ///////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
                //
                // NOTE: Remove the event handler for the DomainUnload event
                //       that we added earlier.
                //
                if (_domainUnload != null)
                {
                    AppDomain.CurrentDomain.DomainUnload -= _domainUnload;
                    _domainUnload = null;
                }
#endif

                ///////////////////////////////////////////////////////////////

                //
                // NOTE: Reset the event for this AppDomain so that future
                //       (non-primary) threads will once again wait for the
                //       PrivateInitialize method to be completed.
                //
                EventWaitHandle theEvent = CreateAndOrGetTheEvent();

                if (theEvent != null)
                    theEvent.Reset();

            }
        }

        ///////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
        /// <summary>
        /// Handles the AppDomain being unloaded.
        /// </summary>
        /// <param name="sender">Should be null.</param>
        /// <param name="e">The data associated with this event.</param>
        private static void DomainUnload(
            object sender,
            EventArgs e
            )
        {
            Uninitialize(null, true);
        }
#endif

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This event is raised whenever SQLite raises a logging event.
        /// Note that this should be set as one of the first things in the
        /// application.
        /// </summary>
        public static event SQLiteLogEventHandler Log
        {
            add
            {
                lock (syncRoot)
                {
                    // Remove any copies of this event handler from registered
                    // list.  This essentially means that a handler will be
                    // called only once no matter how many times it is added.
                    _handlers -= value;

                    // Add this to the list of event handlers.
                    _handlers += value;
                }
            }
            remove
            {
                lock (syncRoot)
                {
                    _handlers -= value;
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// If this property is true, logging is enabled; otherwise, logging is
        /// disabled.  When logging is disabled, no logging events will fire.
        /// </summary>
        public static bool Enabled
        {
            get { lock (syncRoot) { return InternalEnabled; } }
            set { lock (syncRoot) { InternalEnabled = value; } }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// If this property is true, logging is enabled; otherwise, logging is
        /// disabled.  When logging is disabled, no logging events will fire.
        /// For internal use only.
        /// </summary>
        internal static bool InternalEnabled
        {
            get { return _enabled; }
            set { _enabled = value; }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Log a message to all the registered log event handlers without going
        /// through the SQLite library.
        /// </summary>
        /// <param name="message">The message to be logged.</param>
        public static void LogMessage(
            string message
            )
        {
            LogMessage(null, message);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Log a message to all the registered log event handlers without going
        /// through the SQLite library.
        /// </summary>
        /// <param name="errorCode">The SQLite error code.</param>
        /// <param name="message">The message to be logged.</param>
        public static void LogMessage(
            SQLiteErrorCode errorCode,
            string message
            )
        {
            LogMessage((object)errorCode, message);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Log a message to all the registered log event handlers without going
        /// through the SQLite library.
        /// </summary>
        /// <param name="errorCode">The integer error code.</param>
        /// <param name="message">The message to be logged.</param>
        public static void LogMessage(
            int errorCode,
            string message
            )
        {
            LogMessage((object)errorCode, message);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Log a message to all the registered log event handlers without going
        /// through the SQLite library.
        /// </summary>
        /// <param name="errorCode">
        /// The error code.  The type of this object value should be
        /// System.Int32 or SQLiteErrorCode.
        /// </param>
        /// <param name="message">The message to be logged.</param>
        private static void LogMessage(
            object errorCode,
            string message
            )
        {
            bool enabled;
            SQLiteLogEventHandler handlers;

            lock (syncRoot)
            {
                if (_enabled && (_handlers != null))
                {
                    enabled = true;
                    handlers = _handlers.Clone() as SQLiteLogEventHandler;
                }
                else
                {
                    enabled = false;
                    handlers = null;
                }
            }

            if (enabled && (handlers != null))
                handlers(null, new LogEventArgs(
                    IntPtr.Zero, errorCode, message, null));
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Creates and initializes the default log event handler.
        /// </summary>
        private static void InitializeDefaultHandler()
        {
            lock (syncRoot)
            {
                if (_defaultHandler == null)
                    _defaultHandler = new SQLiteLogEventHandler(LogEventHandler);
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Adds the default log event handler to the list of handlers.
        /// </summary>
        public static void AddDefaultHandler()
        {
            lock (syncRoot)
            {
                InitializeDefaultHandler();
                Log += _defaultHandler;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Removes the default log event handler from the list of handlers.
        /// </summary>
        public static void RemoveDefaultHandler()
        {
            lock (syncRoot)
            {
                InitializeDefaultHandler();
                Log -= _defaultHandler;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Internal proxy function that calls any registered application log
        /// event handlers.
        ///
        /// WARNING: This method is used more-or-less directly by native code,
        ///          do not modify its type signature.
        /// </summary>
        /// <param name="pUserData">
        /// The extra data associated with this message, if any.
        /// </param>
        /// <param name="errorCode">
        /// The error code associated with this message.
        /// </param>
        /// <param name="pMessage">
        /// The message string to be logged.
        /// </param>
        private static void LogCallback(
            IntPtr pUserData,
            int errorCode,
            IntPtr pMessage
            )
        {
            bool enabled;
            SQLiteLogEventHandler handlers;

            lock (syncRoot)
            {
                if (_enabled && (_handlers != null))
                {
                    enabled = true;
                    handlers = _handlers.Clone() as SQLiteLogEventHandler;
                }
                else
                {
                    enabled = false;
                    handlers = null;
                }
            }

            if (enabled && (handlers != null))
                handlers(null, new LogEventArgs(pUserData, errorCode,
                    SQLiteBase.UTF8ToString(pMessage, -1), null));
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Default logger.  Currently, uses the Trace class (i.e. sends events
        /// to the current trace listeners, if any).
        /// </summary>
        /// <param name="sender">Should be null.</param>
        /// <param name="e">The data associated with this event.</param>
        private static void LogEventHandler(
            object sender,
            LogEventArgs e
            )
        {
#if !NET_COMPACT_20
            if (e == null)
                return;

            string message = e.Message;

            if (message == null)
            {
                message = "<null>";
            }
            else
            {
                message = message.Trim();

                if (message.Length == 0)
                    message = "<empty>";
            }

            object errorCode = e.ErrorCode;
            string type = "error";

            if ((errorCode is SQLiteErrorCode) || (errorCode is int))
            {
                SQLiteErrorCode rc = (SQLiteErrorCode)(int)errorCode;

                rc &= SQLiteErrorCode.NonExtendedMask;

                if (rc == SQLiteErrorCode.Ok)
                {
                    type = "message";
                }
                else if (rc == SQLiteErrorCode.Notice)
                {
                    type = "notice";
                }
                else if (rc == SQLiteErrorCode.Warning)
                {
                    type = "warning";
                }
                else if ((rc == SQLiteErrorCode.Row) ||
                    (rc == SQLiteErrorCode.Done))
                {
                    type = "data";
                }
            }
            else if (errorCode == null)
            {
                type = "trace";
            }

            if ((errorCode != null) &&
                !Object.ReferenceEquals(errorCode, String.Empty))
            {
                Trace.WriteLine(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture, "SQLite {0} ({1}): {2}",
                    type, errorCode, message));
            }
            else
            {
                Trace.WriteLine(HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture, "SQLite {0}: {1}",
                    type, message));
            }
#endif
        }
    }
}

Changes to System.Data.SQLite/SQLiteMetaDataCollectionNames.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;

  /// <summary>
  /// MetaDataCollections specific to SQLite
  /// </summary>
  public static class SQLiteMetaDataCollectionNames
  {
    /// <summary>
    /// Returns a list of databases attached to the connection









<
<







1
2
3
4
5
6
7
8
9


10
11
12
13
14
15
16
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{


  /// <summary>
  /// MetaDataCollections specific to SQLite
  /// </summary>
  public static class SQLiteMetaDataCollectionNames
  {
    /// <summary>
    /// Returns a list of databases attached to the connection

Added System.Data.SQLite/SQLiteModule.cs.







































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
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
7464
7465
7466
7467
7468
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
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Joe Mistachkin (joe@mistachkin.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System.Collections.Generic;
using System.Globalization;

#if !PLATFORM_COMPACTFRAMEWORK
using System.Runtime.CompilerServices;
#endif

using System.Runtime.InteropServices;
using System.Text;

namespace System.Data.SQLite
{
    #region SQLiteContext Helper Class
    /// <summary>
    /// This class represents a context from the SQLite core library that can
    /// be passed to the sqlite3_result_*() and associated functions.
    /// </summary>
    public sealed class SQLiteContext : ISQLiteNativeHandle
    {
        #region Private Data
        /// <summary>
        /// The native context handle.
        /// </summary>
        private IntPtr pContext;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Constructors
        /// <summary>
        /// Constructs an instance of this class using the specified native
        /// context handle.
        /// </summary>
        /// <param name="pContext">
        /// The native context handle to use.
        /// </param>
        internal SQLiteContext(IntPtr pContext)
        {
            this.pContext = pContext;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteNativeHandle Members
        /// <summary>
        /// Returns the underlying SQLite native handle associated with this
        /// object instance.
        /// </summary>
        public IntPtr NativeHandle
        {
            get { return pContext; }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Methods
        /// <summary>
        /// Attempts to determine if a specific column being fetched via the
        /// <see cref="ISQLiteNativeModule.xColumn" /> method as part of an
        /// UPDATE operation will not change.  Use of this method is invalid
        /// in any other context.
        /// </summary>
        /// <returns>
        /// Non-zero if the column being fetched via a pending call to the
        /// <see cref="ISQLiteNativeModule.xColumn" /> method as part of an
        /// UPDATE operation during which the column value will not change.
        /// The virtual table implementation can use this hint as permission
        /// to substitute a return value that is less expensive to compute
        /// and that the corresponding xUpdate method understands as a
        /// "no-change" value.
        /// </returns>
        public int NoChange()
        {
            if (pContext == IntPtr.Zero)
                throw new InvalidOperationException();

            return UnsafeNativeMethods.sqlite3_vtab_nochange(pContext);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Sets the context result to NULL.
        /// </summary>
        public void SetNull()
        {
            if (pContext == IntPtr.Zero)
                throw new InvalidOperationException();

            UnsafeNativeMethods.sqlite3_result_null(pContext);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Sets the context result to the specified <see cref="Double" />
        /// value.
        /// </summary>
        /// <param name="value">
        /// The <see cref="Double" /> value to use.
        /// </param>
        public void SetDouble(double value)
        {
            if (pContext == IntPtr.Zero)
                throw new InvalidOperationException();

#if !PLATFORM_COMPACTFRAMEWORK
            UnsafeNativeMethods.sqlite3_result_double(pContext, value);
#elif !SQLITE_STANDARD
            UnsafeNativeMethods.sqlite3_result_double_interop(pContext, ref value);
#else
            throw new NotImplementedException();
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Sets the context result to the specified <see cref="Int32" />
        /// value.
        /// </summary>
        /// <param name="value">
        /// The <see cref="Int32" /> value to use.
        /// </param>
        public void SetInt(int value)
        {
            if (pContext == IntPtr.Zero)
                throw new InvalidOperationException();

            UnsafeNativeMethods.sqlite3_result_int(pContext, value);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Sets the context result to the specified <see cref="Int64" />
        /// value.
        /// </summary>
        /// <param name="value">
        /// The <see cref="Int64" /> value to use.
        /// </param>
        public void SetInt64(long value)
        {
            if (pContext == IntPtr.Zero)
                throw new InvalidOperationException();

#if !PLATFORM_COMPACTFRAMEWORK
            UnsafeNativeMethods.sqlite3_result_int64(pContext, value);
#elif !SQLITE_STANDARD
            UnsafeNativeMethods.sqlite3_result_int64_interop(pContext, ref value);
#else
            throw new NotImplementedException();
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Sets the context result to the specified <see cref="String" />
        /// value.
        /// </summary>
        /// <param name="value">
        /// The <see cref="String" /> value to use.  This value will be
        /// converted to the UTF-8 encoding prior to being used.
        /// </param>
        public void SetString(string value)
        {
            if (pContext == IntPtr.Zero)
                throw new InvalidOperationException();

            byte[] bytes = SQLiteString.GetUtf8BytesFromString(value);

            if (bytes == null)
                throw new ArgumentNullException("value");

            UnsafeNativeMethods.sqlite3_result_text(
                pContext, bytes, bytes.Length, (IntPtr)(-1));
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Sets the context result to the specified <see cref="String" />
        /// value containing an error message.
        /// </summary>
        /// <param name="value">
        /// The <see cref="String" /> value containing the error message text.
        /// This value will be converted to the UTF-8 encoding prior to being
        /// used.
        /// </param>
        public void SetError(string value)
        {
            if (pContext == IntPtr.Zero)
                throw new InvalidOperationException();

            byte[] bytes = SQLiteString.GetUtf8BytesFromString(value);

            if (bytes == null)
                throw new ArgumentNullException("value");

            UnsafeNativeMethods.sqlite3_result_error(
                pContext, bytes, bytes.Length);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Sets the context result to the specified <see cref="SQLiteErrorCode" />
        /// value.
        /// </summary>
        /// <param name="value">
        /// The <see cref="SQLiteErrorCode" /> value to use.
        /// </param>
        public void SetErrorCode(SQLiteErrorCode value)
        {
            if (pContext == IntPtr.Zero)
                throw new InvalidOperationException();

            UnsafeNativeMethods.sqlite3_result_error_code(pContext, value);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Sets the context result to contain the error code SQLITE_TOOBIG.
        /// </summary>
        public void SetErrorTooBig()
        {
            if (pContext == IntPtr.Zero)
                throw new InvalidOperationException();

            UnsafeNativeMethods.sqlite3_result_error_toobig(pContext);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Sets the context result to contain the error code SQLITE_NOMEM.
        /// </summary>
        public void SetErrorNoMemory()
        {
            if (pContext == IntPtr.Zero)
                throw new InvalidOperationException();

            UnsafeNativeMethods.sqlite3_result_error_nomem(pContext);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Sets the context result to the specified <see cref="Byte" /> array
        /// value.
        /// </summary>
        /// <param name="value">
        /// The <see cref="Byte" /> array value to use.
        /// </param>
        public void SetBlob(byte[] value)
        {
            if (pContext == IntPtr.Zero)
                throw new InvalidOperationException();

            if (value == null)
                throw new ArgumentNullException("value");

            UnsafeNativeMethods.sqlite3_result_blob(
                pContext, value, value.Length, (IntPtr)(-1));
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Sets the context result to a BLOB of zeros of the specified size.
        /// </summary>
        /// <param name="value">
        /// The number of zero bytes to use for the BLOB context result.
        /// </param>
        public void SetZeroBlob(int value)
        {
            if (pContext == IntPtr.Zero)
                throw new InvalidOperationException();

            UnsafeNativeMethods.sqlite3_result_zeroblob(pContext, value);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Sets the context result sub-type to the desired value.
        /// </summary>
        /// <param name="value">
        /// The sub-type value to use.
        /// </param>
        public void SetSubType(uint value)
        {
            if (pContext == IntPtr.Zero)
                throw new InvalidOperationException();

            UnsafeNativeMethods.sqlite3_result_subtype(pContext, value);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Sets the context result to the specified <see cref="SQLiteValue" />.
        /// </summary>
        /// <param name="value">
        /// The <see cref="SQLiteValue" /> to use.
        /// </param>
        public void SetValue(SQLiteValue value)
        {
            if (pContext == IntPtr.Zero)
                throw new InvalidOperationException();

            if (value == null)
                throw new ArgumentNullException("value");

            UnsafeNativeMethods.sqlite3_result_value(
                pContext, value.NativeHandle);
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteValue Helper Class
    /// <summary>
    /// This class represents a value from the SQLite core library that can be
    /// passed to the sqlite3_value_*() and associated functions.
    /// </summary>
    public sealed class SQLiteValue : ISQLiteNativeHandle
    {
        #region Private Data
        /// <summary>
        /// The native value handle.
        /// </summary>
        private IntPtr pValue;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Constructors
        /// <summary>
        /// Constructs an instance of this class using the specified native
        /// value handle.
        /// </summary>
        /// <param name="pValue">
        /// The native value handle to use.
        /// </param>
        private SQLiteValue(IntPtr pValue)
        {
            this.pValue = pValue;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Methods
        /// <summary>
        /// Invalidates the native value handle, thereby preventing further
        /// access to it from this object instance.
        /// </summary>
        private void PreventNativeAccess()
        {
            pValue = IntPtr.Zero;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Internal Marshal Helper Methods
        /// <summary>
        /// Converts a native pointer to a native sqlite3_value structure into
        /// a managed <see cref="SQLiteValue" /> object instance.
        /// </summary>
        /// <param name="pValue">
        /// The native pointer to a native sqlite3_value structure to convert.
        /// </param>
        /// <returns>
        /// The managed <see cref="SQLiteValue" /> object instance or null upon
        /// failure.
        /// </returns>
        internal static SQLiteValue FromIntPtr(
            IntPtr pValue
            )
        {
            if (pValue == IntPtr.Zero) return null;
            return new SQLiteValue(pValue);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Converts a logical array of native pointers to native sqlite3_value
        /// structures into a managed array of <see cref="SQLiteValue" />
        /// object instances.
        /// </summary>
        /// <param name="argc">
        /// The number of elements in the logical array of native sqlite3_value
        /// structures.
        /// </param>
        /// <param name="argv">
        /// The native pointer to the logical array of native sqlite3_value
        /// structures to convert.
        /// </param>
        /// <returns>
        /// The managed array of <see cref="SQLiteValue" /> object instances or
        /// null upon failure.
        /// </returns>
        internal static SQLiteValue[] ArrayFromSizeAndIntPtr(
            int argc,
            IntPtr argv
            )
        {
            if (argc < 0)
                return null;

            if (argv == IntPtr.Zero)
                return null;

            SQLiteValue[] result = new SQLiteValue[argc];

            for (int index = 0, offset = 0;
                    index < result.Length;
                    index++, offset += IntPtr.Size)
            {
                IntPtr pArg = SQLiteMarshal.ReadIntPtr(argv, offset);

                result[index] = (pArg != IntPtr.Zero) ?
                    new SQLiteValue(pArg) : null;
            }

            return result;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteNativeHandle Members
        /// <summary>
        /// Returns the underlying SQLite native handle associated with this
        /// object instance.
        /// </summary>
        public IntPtr NativeHandle
        {
            get { return pValue; }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Properties
        private bool persisted;
        /// <summary>
        /// Returns non-zero if the native SQLite value has been successfully
        /// persisted as a managed value within this object instance (i.e. the
        /// <see cref="Value" /> property may then be read successfully).
        /// </summary>
        public bool Persisted
        {
            get { return persisted; }
        }

        ///////////////////////////////////////////////////////////////////////

        private object value;
        /// <summary>
        /// If the managed value for this object instance is available (i.e. it
        /// has been previously persisted via the <see cref="Persist" />) method,
        /// that value is returned; otherwise, an exception is thrown.  The
        /// returned value may be null.
        /// </summary>
        public object Value
        {
            get
            {
                if (!persisted)
                {
                    throw new InvalidOperationException(
                        "value was not persisted");
                }

                return value;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        private uint subType;
        /// <summary>
        /// If the managed value for this object instance is available (i.e. it
        /// has been previously persisted via the <see cref="Persist" />) method,
        /// that sub-type is returned; otherwise, an exception is thrown.
        /// </summary>
#pragma warning disable 3003
        public uint SubType
        {
            get
            {
                if (!persisted)
                {
                    throw new InvalidOperationException(
                        "value was not persisted");
                }

                return subType;
            }
        }
#pragma warning restore 3003

        ///////////////////////////////////////////////////////////////////////

        private int noChange;
        /// <summary>
        /// If the managed value for this object instance is available (i.e. it
        /// has been previously persisted via the <see cref="Persist" />) method,
        /// that "no change" flag is returned; otherwise, an exception is thrown.
        /// </summary>
        public int NoChange
        {
            get
            {
                if (!persisted)
                {
                    throw new InvalidOperationException(
                        "value was not persisted");
                }

                return noChange;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        private int fromBind;
        /// <summary>
        /// If the managed value for this object instance is available (i.e. it
        /// has been previously persisted via the <see cref="Persist" />) method,
        /// that "from bind" flag is returned; otherwise, an exception is thrown.
        /// </summary>
        public int FromBind
        {
            get
            {
                if (!persisted)
                {
                    throw new InvalidOperationException(
                        "value was not persisted");
                }

                return fromBind;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Methods
        /// <summary>
        /// Gets and returns the sub-type associated with this value.
        /// </summary>
        /// <returns>
        /// The sub-type associated with this value.
        /// </returns>
#pragma warning disable 3002
        public uint GetSubType()
        {
            if (pValue == IntPtr.Zero) return default(uint);
            return UnsafeNativeMethods.sqlite3_value_subtype(pValue);
        }
#pragma warning restore 3002

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets and returns the "no change" flag associated with this value.
        /// </summary>
        /// <returns>
        /// The "no change" flag associated with this value.
        /// </returns>
        public int GetNoChange()
        {
            if (pValue == IntPtr.Zero) return default(int);
            return UnsafeNativeMethods.sqlite3_value_nochange(pValue);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets and returns the "from bind" flag associated with this value.
        /// </summary>
        /// <returns>
        /// The "from bind" flag associated with this value.
        /// </returns>
        public int GetFromBind()
        {
            if (pValue == IntPtr.Zero) return default(int);
            return UnsafeNativeMethods.sqlite3_value_frombind(pValue);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to convert this value to numeric and then gets and
        /// returns the new type affinity associated with this value.
        /// </summary>
        /// <returns>
        /// The new type affinity associated with this value.
        /// </returns>
        public TypeAffinity GetNumericType()
        {
            if (pValue == IntPtr.Zero) return TypeAffinity.None;
            return UnsafeNativeMethods.sqlite3_value_numeric_type(pValue);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets and returns the type affinity associated with this value.
        /// </summary>
        /// <returns>
        /// The type affinity associated with this value.
        /// </returns>
        public TypeAffinity GetTypeAffinity()
        {
            if (pValue == IntPtr.Zero) return TypeAffinity.None;
            return UnsafeNativeMethods.sqlite3_value_type(pValue);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets and returns the number of bytes associated with this value, if
        /// it refers to a UTF-8 encoded string.
        /// </summary>
        /// <returns>
        /// The number of bytes associated with this value.  The returned value
        /// may be zero.
        /// </returns>
        public int GetBytes()
        {
            if (pValue == IntPtr.Zero) return 0;
            return UnsafeNativeMethods.sqlite3_value_bytes(pValue);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets and returns the <see cref="Int32" /> associated with this
        /// value.
        /// </summary>
        /// <returns>
        /// The <see cref="Int32" /> associated with this value.
        /// </returns>
        public int GetInt()
        {
            if (pValue == IntPtr.Zero) return default(int);
            return UnsafeNativeMethods.sqlite3_value_int(pValue);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets and returns the <see cref="Int64" /> associated with
        /// this value.
        /// </summary>
        /// <returns>
        /// The <see cref="Int64" /> associated with this value.
        /// </returns>
        public long GetInt64()
        {
            if (pValue == IntPtr.Zero) return default(long);

#if !PLATFORM_COMPACTFRAMEWORK
            return UnsafeNativeMethods.sqlite3_value_int64(pValue);
#elif !SQLITE_STANDARD
            long value = 0;
            UnsafeNativeMethods.sqlite3_value_int64_interop(pValue, ref value);
            return value;
#else
            throw new NotImplementedException();
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets and returns the <see cref="Double" /> associated with this
        /// value.
        /// </summary>
        /// <returns>
        /// The <see cref="Double" /> associated with this value.
        /// </returns>
        public double GetDouble()
        {
            if (pValue == IntPtr.Zero) return default(double);

#if !PLATFORM_COMPACTFRAMEWORK
            return UnsafeNativeMethods.sqlite3_value_double(pValue);
#elif !SQLITE_STANDARD
            double value = 0.0;
            UnsafeNativeMethods.sqlite3_value_double_interop(pValue, ref value);
            return value;
#else
            throw new NotImplementedException();
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets and returns the <see cref="String" /> associated with this
        /// value.
        /// </summary>
        /// <returns>
        /// The <see cref="String" /> associated with this value.  The value is
        /// converted from the UTF-8 encoding prior to being returned.
        /// </returns>
        public string GetString()
        {
            if (pValue == IntPtr.Zero) return null;

            int length;
            IntPtr pString;

#if SQLITE_STANDARD
            length = UnsafeNativeMethods.sqlite3_value_bytes(pValue);
            pString = UnsafeNativeMethods.sqlite3_value_text(pValue);
#else
            length = 0;

            pString = UnsafeNativeMethods.sqlite3_value_text_interop(
                pValue, ref length);
#endif

            return SQLiteString.StringFromUtf8IntPtr(pString, length);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets and returns the <see cref="Byte" /> array associated with this
        /// value.
        /// </summary>
        /// <returns>
        /// The <see cref="Byte" /> array associated with this value.
        /// </returns>
        public byte[] GetBlob()
        {
            if (pValue == IntPtr.Zero) return null;

            return SQLiteBytes.FromIntPtr(
                UnsafeNativeMethods.sqlite3_value_blob(pValue), GetBytes());
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets and returns an <see cref="Object" /> instance associated with
        /// this value.
        /// </summary>
        /// <returns>
        /// The <see cref="Object" /> associated with this value.  If the type
        /// affinity of the object is unknown or cannot be determined, a null
        /// value will be returned.
        /// </returns>
        public object GetObject()
        {
            switch (GetTypeAffinity())
            {
                case TypeAffinity.Uninitialized:
                    {
                        return null;
                    }
                case TypeAffinity.Int64:
                    {
                        return GetInt64();
                    }
                case TypeAffinity.Double:
                    {
                        return GetDouble();
                    }
                case TypeAffinity.Text:
                    {
                        return GetString();
                    }
                case TypeAffinity.Blob:
                    {
                        return GetBytes();
                    }
                case TypeAffinity.Null:
                    {
                        return DBNull.Value;
                    }
                default:
                    {
                        return null;
                    }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Uses the native value handle to obtain and store the managed value
        /// for this object instance, thus saving it for later use.  The type
        /// of the managed value is determined by the type affinity of the
        /// native value.  If the type affinity is not recognized by this
        /// method, no work is done and false is returned.
        /// </summary>
        /// <returns>
        /// Non-zero if the native value was persisted successfully.
        /// </returns>
        public bool Persist()
        {
            switch (GetTypeAffinity())
            {
                case TypeAffinity.Uninitialized:
                    {
                        value = null;
                        subType = 0;
                        noChange = 0;
                        fromBind = 0;

                        PreventNativeAccess();

                        return (persisted = true);
                    }
                case TypeAffinity.Int64:
                    {
                        value = GetInt64();
                        subType = GetSubType();
                        noChange = GetNoChange();
                        fromBind = GetFromBind();

                        PreventNativeAccess();

                        return (persisted = true);
                    }
                case TypeAffinity.Double:
                    {
                        value = GetDouble();
                        subType = GetSubType();
                        noChange = GetNoChange();
                        fromBind = GetFromBind();

                        PreventNativeAccess();

                        return (persisted = true);
                    }
                case TypeAffinity.Text:
                    {
                        value = GetString();
                        subType = GetSubType();
                        noChange = GetNoChange();
                        fromBind = GetFromBind();

                        PreventNativeAccess();

                        return (persisted = true);
                    }
                case TypeAffinity.Blob:
                    {
                        value = GetBytes();
                        subType = GetSubType();
                        noChange = GetNoChange();
                        fromBind = GetFromBind();

                        PreventNativeAccess();

                        return (persisted = true);
                    }
                case TypeAffinity.Null:
                    {
                        value = DBNull.Value;
                        subType = GetSubType();
                        noChange = GetNoChange();
                        fromBind = GetFromBind();

                        PreventNativeAccess();

                        return (persisted = true);
                    }
                default:
                    {
                        return false;
                    }
            }
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteIndexConstraintOp Enumeration
    /// <summary>
    /// These are the allowed values for the operators that are part of a
    /// constraint term in the WHERE clause of a query that uses a virtual
    /// table.
    /// </summary>
    public enum SQLiteIndexConstraintOp : byte
    {
        /// <summary>
        /// This value represents the equality operator.
        /// </summary>
        EqualTo = 2,

        /// <summary>
        /// This value represents the greater than operator.
        /// </summary>
        GreaterThan = 4,

        /// <summary>
        /// This value represents the less than or equal to operator.
        /// </summary>
        LessThanOrEqualTo = 8,

        /// <summary>
        /// This value represents the less than operator.
        /// </summary>
        LessThan = 16,

        /// <summary>
        /// This value represents the greater than or equal to operator.
        /// </summary>
        GreaterThanOrEqualTo = 32,

        /// <summary>
        /// This value represents the MATCH operator.
        /// </summary>
        Match = 64,

        /// <summary>
        /// This value represents the LIKE operator.
        /// </summary>
        Like = 65,

        /// <summary>
        /// This value represents the GLOB operator.
        /// </summary>
        Glob = 66,

        /// <summary>
        /// This value represents the REGEXP operator.
        /// </summary>
        Regexp = 67,

        /// <summary>
        /// This value represents the inequality operator.
        /// </summary>
        NotEqualTo = 68,

        /// <summary>
        /// This value represents the IS NOT operator.
        /// </summary>
        IsNot = 69,

        /// <summary>
        /// This value represents the IS NOT NULL operator.
        /// </summary>
        IsNotNull = 70,

        /// <summary>
        /// This value represents the IS NULL operator.
        /// </summary>
        IsNull = 71,

        /// <summary>
        /// This value represents the IS operator.
        /// </summary>
        Is = 72
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteIndexFlags Enumeration
    /// <summary>
    /// These are the allowed values for the index flags from the
    /// <see cref="ISQLiteManagedModule.BestIndex" /> method.
    /// </summary>
    [Flags()]
    public enum SQLiteIndexFlags
    {
        /// <summary>
        /// No special handling.  This is the default.
        /// </summary>
        None = 0x0,

        /// <summary>
        /// This value indicates that the scan of the index will visit at
        /// most one row.
        /// </summary>
        ScanUnique = 0x1
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteIndexConstraint Helper Class
    /// <summary>
    /// This class represents the native sqlite3_index_constraint structure
    /// from the SQLite core library.
    /// </summary>
    public sealed class SQLiteIndexConstraint
    {
        #region Internal Constructors
        /// <summary>
        /// Constructs an instance of this class using the specified native
        /// sqlite3_index_constraint structure.
        /// </summary>
        /// <param name="constraint">
        /// The native sqlite3_index_constraint structure to use.
        /// </param>
        internal SQLiteIndexConstraint(
            UnsafeNativeMethods.sqlite3_index_constraint constraint
            )
            : this(constraint.iColumn, constraint.op, constraint.usable,
                   constraint.iTermOffset)
        {
            // do nothing.
        }
        #endregion

        //////////////////////////////////////////////////////////////////////

        #region Private Constructors
        /// <summary>
        /// Constructs an instance of this class using the specified field
        /// values.
        /// </summary>
        /// <param name="iColumn">
        /// Column on left-hand side of constraint.
        /// </param>
        /// <param name="op">
        /// Constraint operator (<see cref="SQLiteIndexConstraintOp" />).
        /// </param>
        /// <param name="usable">
        /// True if this constraint is usable.
        /// </param>
        /// <param name="iTermOffset">
        /// Used internally - <see cref="ISQLiteManagedModule.BestIndex" />
        /// should ignore.
        /// </param>
        private SQLiteIndexConstraint(
            int iColumn,
            SQLiteIndexConstraintOp op,
            byte usable,
            int iTermOffset
            )
        {
            this.iColumn = iColumn;
            this.op = op;
            this.usable = usable;
            this.iTermOffset = iTermOffset;
        }
        #endregion

        //////////////////////////////////////////////////////////////////////

        #region Public Fields
        /// <summary>
        /// Column on left-hand side of constraint.
        /// </summary>
        public int iColumn;

        //////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Constraint operator (<see cref="SQLiteIndexConstraintOp" />).
        /// </summary>
        public SQLiteIndexConstraintOp op;

        //////////////////////////////////////////////////////////////////////

        /// <summary>
        /// True if this constraint is usable.
        /// </summary>
        public byte usable;

        //////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Used internally - <see cref="ISQLiteManagedModule.BestIndex" />
        /// should ignore.
        /// </summary>
        public int iTermOffset;
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteIndexOrderBy Helper Class
    /// <summary>
    /// This class represents the native sqlite3_index_orderby structure from
    /// the SQLite core library.
    /// </summary>
    public sealed class SQLiteIndexOrderBy
    {
        #region Internal Constructors
        /// <summary>
        /// Constructs an instance of this class using the specified native
        /// sqlite3_index_orderby structure.
        /// </summary>
        /// <param name="orderBy">
        /// The native sqlite3_index_orderby structure to use.
        /// </param>
        internal SQLiteIndexOrderBy(
            UnsafeNativeMethods.sqlite3_index_orderby orderBy
            )
            : this(orderBy.iColumn, orderBy.desc)
        {
            // do nothing.
        }
        #endregion

        //////////////////////////////////////////////////////////////////////

        #region Private Constructors
        /// <summary>
        /// Constructs an instance of this class using the specified field
        /// values.
        /// </summary>
        /// <param name="iColumn">
        /// Column number.
        /// </param>
        /// <param name="desc">
        /// True for DESC.  False for ASC.
        /// </param>
        private SQLiteIndexOrderBy(
            int iColumn,
            byte desc
            )
        {
            this.iColumn = iColumn;
            this.desc = desc;
        }
        #endregion

        //////////////////////////////////////////////////////////////////////

        #region Public Fields
        /// <summary>
        /// Column number.
        /// </summary>
        public int iColumn;

        //////////////////////////////////////////////////////////////////////

        /// <summary>
        /// True for DESC.  False for ASC.
        /// </summary>
        public byte desc;
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteIndexConstraintUsage Helper Class
    /// <summary>
    /// This class represents the native sqlite3_index_constraint_usage
    /// structure from the SQLite core library.
    /// </summary>
    public sealed class SQLiteIndexConstraintUsage
    {
        #region Internal Constructors
        /// <summary>
        /// Constructs a default instance of this class.
        /// </summary>
        internal SQLiteIndexConstraintUsage()
        {
            // do nothing.
        }

        //////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Constructs an instance of this class using the specified native
        /// sqlite3_index_constraint_usage structure.
        /// </summary>
        /// <param name="constraintUsage">
        /// The native sqlite3_index_constraint_usage structure to use.
        /// </param>
        internal SQLiteIndexConstraintUsage(
            UnsafeNativeMethods.sqlite3_index_constraint_usage constraintUsage
            )
            : this(constraintUsage.argvIndex, constraintUsage.omit)
        {
            // do nothing.
        }
        #endregion

        //////////////////////////////////////////////////////////////////////

        #region Private Constructors
        /// <summary>
        /// Constructs an instance of this class using the specified field
        /// values.
        /// </summary>
        /// <param name="argvIndex">
        /// If greater than 0, constraint is part of argv to xFilter.
        /// </param>
        /// <param name="omit">
        /// Do not code a test for this constraint.
        /// </param>
        private SQLiteIndexConstraintUsage(
            int argvIndex,
            byte omit
            )
        {
            this.argvIndex = argvIndex;
            this.omit = omit;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Fields
        /// <summary>
        /// If greater than 0, constraint is part of argv to xFilter.
        /// </summary>
        public int argvIndex;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Do not code a test for this constraint.
        /// </summary>
        public byte omit;
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteIndexInputs Helper Class
    /// <summary>
    /// This class represents the various inputs provided by the SQLite core
    /// library to the <see cref="ISQLiteManagedModule.BestIndex" /> method.
    /// </summary>
    public sealed class SQLiteIndexInputs
    {
        #region Internal Constructors
        /// <summary>
        /// Constructs an instance of this class.
        /// </summary>
        /// <param name="nConstraint">
        /// The number of <see cref="SQLiteIndexConstraint" /> instances to
        /// pre-allocate space for.
        /// </param>
        /// <param name="nOrderBy">
        /// The number of <see cref="SQLiteIndexOrderBy" /> instances to
        /// pre-allocate space for.
        /// </param>
        internal SQLiteIndexInputs(int nConstraint, int nOrderBy)
        {
            constraints = new SQLiteIndexConstraint[nConstraint];
            orderBys = new SQLiteIndexOrderBy[nOrderBy];
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Properties
        private SQLiteIndexConstraint[] constraints;
        /// <summary>
        /// An array of <see cref="SQLiteIndexConstraint" /> object instances,
        /// each containing information supplied by the SQLite core library.
        /// </summary>
        public SQLiteIndexConstraint[] Constraints
        {
            get { return constraints; }
        }

        ///////////////////////////////////////////////////////////////////////

        private SQLiteIndexOrderBy[] orderBys;
        /// <summary>
        /// An array of <see cref="SQLiteIndexOrderBy" /> object instances,
        /// each containing information supplied by the SQLite core library.
        /// </summary>
        public SQLiteIndexOrderBy[] OrderBys
        {
            get { return orderBys; }
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteIndexOutputs Helper Class
    /// <summary>
    /// This class represents the various outputs provided to the SQLite core
    /// library by the <see cref="ISQLiteManagedModule.BestIndex" /> method.
    /// </summary>
    public sealed class SQLiteIndexOutputs
    {
        #region Internal Constructors
        /// <summary>
        /// Constructs an instance of this class.
        /// </summary>
        /// <param name="nConstraint">
        /// The number of <see cref="SQLiteIndexConstraintUsage" /> instances
        /// to pre-allocate space for.
        /// </param>
        internal SQLiteIndexOutputs(int nConstraint)
        {
            constraintUsages = new SQLiteIndexConstraintUsage[nConstraint];

            //
            // BUGFIX: Create the [empty] constraint usages now so they can be
            //         used by the xBestIndex callback.
            //
            for (int iConstraint = 0; iConstraint < nConstraint; iConstraint++)
                constraintUsages[iConstraint] = new SQLiteIndexConstraintUsage();
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Determines if the native estimatedRows field can be used, based on
        /// the available version of the SQLite core library.
        /// </summary>
        /// <returns>
        /// Non-zero if the <see cref="EstimatedRows" /> property is supported
        /// by the SQLite core library.
        /// </returns>
        public bool CanUseEstimatedRows()
        {
            if (UnsafeNativeMethods.sqlite3_libversion_number() >= 3008002)
                return true;

            return false;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Determines if the native flags field can be used, based on the
        /// available version of the SQLite core library.
        /// </summary>
        /// <returns>
        /// Non-zero if the <see cref="IndexFlags" /> property is supported by
        /// the SQLite core library.
        /// </returns>
        public bool CanUseIndexFlags()
        {
            if (UnsafeNativeMethods.sqlite3_libversion_number() >= 3009000)
                return true;

            return false;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Determines if the native flags field can be used, based on the
        /// available version of the SQLite core library.
        /// </summary>
        /// <returns>
        /// Non-zero if the <see cref="ColumnsUsed" /> property is supported by
        /// the SQLite core library.
        /// </returns>
        public bool CanUseColumnsUsed()
        {
            if (UnsafeNativeMethods.sqlite3_libversion_number() >= 3010000)
                return true;

            return false;
        }

        ///////////////////////////////////////////////////////////////////////

        #region Public Properties
        private SQLiteIndexConstraintUsage[] constraintUsages;
        /// <summary>
        /// An array of <see cref="SQLiteIndexConstraintUsage" /> object
        /// instances, each containing information to be supplied to the SQLite
        /// core library.
        /// </summary>
        public SQLiteIndexConstraintUsage[] ConstraintUsages
        {
            get { return constraintUsages; }
        }

        ///////////////////////////////////////////////////////////////////////

        private int indexNumber;
        /// <summary>
        /// Number used to help identify the selected index.  This value will
        /// later be provided to the <see cref="ISQLiteManagedModule.Filter" />
        /// method.
        /// </summary>
        public int IndexNumber
        {
            get { return indexNumber; }
            set { indexNumber = value; }
        }

        ///////////////////////////////////////////////////////////////////////

        private string indexString;
        /// <summary>
        /// String used to help identify the selected index.  This value will
        /// later be provided to the <see cref="ISQLiteManagedModule.Filter" />
        /// method.
        /// </summary>
        public string IndexString
        {
            get { return indexString; }
            set { indexString = value; }
        }

        ///////////////////////////////////////////////////////////////////////

        private int needToFreeIndexString;
        /// <summary>
        /// Non-zero if the index string must be freed by the SQLite core
        /// library.
        /// </summary>
        public int NeedToFreeIndexString
        {
            get { return needToFreeIndexString; }
            set { needToFreeIndexString = value; }
        }

        ///////////////////////////////////////////////////////////////////////

        private int orderByConsumed;
        /// <summary>
        /// True if output is already ordered.
        /// </summary>
        public int OrderByConsumed
        {
            get { return orderByConsumed; }
            set { orderByConsumed = value; }
        }

        ///////////////////////////////////////////////////////////////////////

        private double? estimatedCost;
        /// <summary>
        /// Estimated cost of using this index.  Using a null value here
        /// indicates that a default estimated cost value should be used.
        /// </summary>
        public double? EstimatedCost
        {
            get { return estimatedCost; }
            set { estimatedCost = value; }
        }

        ///////////////////////////////////////////////////////////////////////

        private long? estimatedRows;
        /// <summary>
        /// Estimated number of rows returned.  Using a null value here
        /// indicates that a default estimated rows value should be used.
        /// This property has no effect if the SQLite core library is not at
        /// least version 3.8.2.
        /// </summary>
        public long? EstimatedRows
        {
            get { return estimatedRows; }
            set { estimatedRows = value; }
        }

        ///////////////////////////////////////////////////////////////////////

        private SQLiteIndexFlags? indexFlags;
        /// <summary>
        /// The flags that should be used with this index.  Using a null value
        /// here indicates that a default flags value should be used.  This
        /// property has no effect if the SQLite core library is not at least
        /// version 3.9.0.
        /// </summary>
        public SQLiteIndexFlags? IndexFlags
        {
            get { return indexFlags; }
            set { indexFlags = value; }
        }

        ///////////////////////////////////////////////////////////////////////

        private long? columnsUsed;
        /// <summary>
        /// <para>
        /// Indicates which columns of the virtual table may be required by the
        /// current scan.  Virtual table columns are numbered from zero in the
        /// order in which they appear within the CREATE TABLE statement passed
        /// to sqlite3_declare_vtab().  For the first 63 columns (columns 0-62),
        /// the corresponding bit is set within the bit mask if the column may
        /// be required by SQLite.  If the table has at least 64 columns and
        /// any column to the right of the first 63 is required, then bit 63 of
        /// colUsed is also set.  In other words, column iCol may be required
        /// if the expression
        /// </para>
        /// <para><code>
        /// (colUsed &amp; ((sqlite3_uint64)1 &lt;&lt; (iCol&gt;=63 ? 63 : iCol)))
        /// </code></para>
        /// <para>
        /// evaluates to non-zero.  Using a null value here indicates that a
        /// default flags value should be used.  This property has no effect if
        /// the SQLite core library is not at least version 3.10.0.
        /// </para>
        /// </summary>
        public long? ColumnsUsed
        {
            get { return columnsUsed; }
            set { columnsUsed = value; }
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteIndex Helper Class
    /// <summary>
    /// This class represents the various inputs and outputs used with the
    /// <see cref="ISQLiteManagedModule.BestIndex" /> method.
    /// </summary>
    public sealed class SQLiteIndex
    {
        #region Internal Constructors
        /// <summary>
        /// Constructs an instance of this class.
        /// </summary>
        /// <param name="nConstraint">
        /// The number of <see cref="SQLiteIndexConstraint" /> (and
        /// <see cref="SQLiteIndexConstraintUsage" />) instances to
        /// pre-allocate space for.
        /// </param>
        /// <param name="nOrderBy">
        /// The number of <see cref="SQLiteIndexOrderBy" /> instances to
        /// pre-allocate space for.
        /// </param>
        internal SQLiteIndex(
            int nConstraint,
            int nOrderBy
            )
        {
            inputs = new SQLiteIndexInputs(nConstraint, nOrderBy);
            outputs = new SQLiteIndexOutputs(nConstraint);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Marshal Helper Methods (For Test Use Only)
        /// <summary>
        /// Attempts to determine the structure sizes needed to create and
        /// populate a native
        /// <see cref="UnsafeNativeMethods.sqlite3_index_info" />
        /// structure.
        /// </summary>
        /// <param name="sizeOfInfoType">
        /// The size of the native
        /// <see cref="UnsafeNativeMethods.sqlite3_index_info" />
        /// structure is stored here.
        /// </param>
        /// <param name="sizeOfConstraintType">
        /// The size of the native
        /// <see cref="UnsafeNativeMethods.sqlite3_index_constraint" />
        /// structure is stored here.
        /// </param>
        /// <param name="sizeOfOrderByType">
        /// The size of the native
        /// <see cref="UnsafeNativeMethods.sqlite3_index_orderby" />
        /// structure is stored here.
        /// </param>
        /// <param name="sizeOfConstraintUsageType">
        /// The size of the native
        /// <see cref="UnsafeNativeMethods.sqlite3_index_constraint_usage" />
        /// structure is stored here.
        /// </param>
        private static void SizeOfNative(
            out int sizeOfInfoType,
            out int sizeOfConstraintType,
            out int sizeOfOrderByType,
            out int sizeOfConstraintUsageType
            )
        {
            sizeOfInfoType = Marshal.SizeOf(typeof(
                UnsafeNativeMethods.sqlite3_index_info));

            sizeOfConstraintType = Marshal.SizeOf(typeof(
                UnsafeNativeMethods.sqlite3_index_constraint));

            sizeOfOrderByType = Marshal.SizeOf(typeof(
                UnsafeNativeMethods.sqlite3_index_orderby));

            sizeOfConstraintUsageType = Marshal.SizeOf(typeof(
                UnsafeNativeMethods.sqlite3_index_constraint_usage));
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to allocate and initialize a native
        /// <see cref="UnsafeNativeMethods.sqlite3_index_info" />
        /// structure.
        /// </summary>
        /// <param name="nConstraint">
        /// The number of <see cref="SQLiteIndexConstraint" /> instances to
        /// pre-allocate space for.
        /// </param>
        /// <param name="nOrderBy">
        /// The number of <see cref="SQLiteIndexOrderBy" /> instances to
        /// pre-allocate space for.
        /// </param>
        /// <returns>
        /// The newly allocated native
        /// <see cref="UnsafeNativeMethods.sqlite3_index_info" /> structure
        /// -OR- <see cref="IntPtr.Zero" /> if it could not be fully allocated.
        /// </returns>
        private static IntPtr AllocateAndInitializeNative(
            int nConstraint,
            int nOrderBy
            )
        {
            IntPtr pIndex = IntPtr.Zero;
            IntPtr pInfo = IntPtr.Zero;
            IntPtr pConstraint = IntPtr.Zero;
            IntPtr pOrderBy = IntPtr.Zero;
            IntPtr pConstraintUsage = IntPtr.Zero;

            try
            {
                int sizeOfInfoType;
                int sizeOfOrderByType;
                int sizeOfConstraintType;
                int sizeOfConstraintUsageType;

                SizeOfNative(out sizeOfInfoType, out sizeOfConstraintType,
                    out sizeOfOrderByType, out sizeOfConstraintUsageType);

                if ((sizeOfInfoType > 0) &&
                    (sizeOfConstraintType > 0) &&
                    (sizeOfOrderByType > 0) &&
                    (sizeOfConstraintUsageType > 0))
                {
                    pInfo = SQLiteMemory.Allocate(sizeOfInfoType);

                    pConstraint = SQLiteMemory.Allocate(
                        sizeOfConstraintType * nConstraint);

                    pOrderBy = SQLiteMemory.Allocate(
                        sizeOfOrderByType * nOrderBy);

                    pConstraintUsage = SQLiteMemory.Allocate(
                        sizeOfConstraintUsageType * nConstraint);

                    if ((pInfo != IntPtr.Zero) &&
                        (pConstraint != IntPtr.Zero) &&
                        (pOrderBy != IntPtr.Zero) &&
                        (pConstraintUsage != IntPtr.Zero))
                    {
                        int offset = 0;

                        SQLiteMarshal.WriteInt32(
                            pInfo, offset, nConstraint);

                        offset = SQLiteMarshal.NextOffsetOf(
                            offset, sizeof(int), IntPtr.Size);

                        SQLiteMarshal.WriteIntPtr(
                            pInfo, offset, pConstraint);

                        offset = SQLiteMarshal.NextOffsetOf(
                            offset, IntPtr.Size, sizeof(int));

                        SQLiteMarshal.WriteInt32(
                            pInfo, offset, nOrderBy);

                        offset = SQLiteMarshal.NextOffsetOf(
                            offset, sizeof(int), IntPtr.Size);

                        SQLiteMarshal.WriteIntPtr(
                            pInfo, offset, pOrderBy);

                        offset = SQLiteMarshal.NextOffsetOf(
                            offset, IntPtr.Size, IntPtr.Size);

                        SQLiteMarshal.WriteIntPtr(
                            pInfo, offset, pConstraintUsage);

                        pIndex = pInfo; /* NOTE: Success. */
                    }
                }
            }
            finally
            {
                if (pIndex == IntPtr.Zero) /* NOTE: Failure? */
                {
                    if (pConstraintUsage != IntPtr.Zero)
                    {
                        SQLiteMemory.Free(pConstraintUsage);
                        pConstraintUsage = IntPtr.Zero;
                    }

                    if (pOrderBy != IntPtr.Zero)
                    {
                        SQLiteMemory.Free(pOrderBy);
                        pOrderBy = IntPtr.Zero;
                    }

                    if (pConstraint != IntPtr.Zero)
                    {
                        SQLiteMemory.Free(pConstraint);
                        pConstraint = IntPtr.Zero;
                    }

                    if (pInfo != IntPtr.Zero)
                    {
                        SQLiteMemory.Free(pInfo);
                        pInfo = IntPtr.Zero;
                    }
                }
            }

            return pIndex;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Frees all the memory associated with a native
        /// <see cref="UnsafeNativeMethods.sqlite3_index_info" />
        /// structure.
        /// </summary>
        /// <param name="pIndex">
        /// The native pointer to the native sqlite3_index_info structure to
        /// free.
        /// </param>
        private static void FreeNative(
            IntPtr pIndex
            )
        {
            if (pIndex == IntPtr.Zero)
                return;

            int offset = 0;

            offset = SQLiteMarshal.NextOffsetOf(
                offset, sizeof(int), IntPtr.Size);

            IntPtr pConstraint = SQLiteMarshal.ReadIntPtr(
                pIndex, offset);

            int constraintOffset = offset;

            offset = SQLiteMarshal.NextOffsetOf(
                offset, IntPtr.Size, sizeof(int));

            offset = SQLiteMarshal.NextOffsetOf(
                offset, sizeof(int), IntPtr.Size);

            IntPtr pOrderBy = SQLiteMarshal.ReadIntPtr(
                pIndex, offset);

            int orderByOffset = offset;

            offset = SQLiteMarshal.NextOffsetOf(
                offset, IntPtr.Size, IntPtr.Size);

            IntPtr pConstraintUsage = SQLiteMarshal.ReadIntPtr(
                pIndex, offset);

            int constraintUsageOffset = offset;

            if (pConstraintUsage != IntPtr.Zero)
            {
                SQLiteMemory.Free(pConstraintUsage);
                pConstraintUsage = IntPtr.Zero;

                SQLiteMarshal.WriteIntPtr(
                    pIndex, constraintUsageOffset, pConstraintUsage);
            }

            if (pOrderBy != IntPtr.Zero)
            {
                SQLiteMemory.Free(pOrderBy);
                pOrderBy = IntPtr.Zero;

                SQLiteMarshal.WriteIntPtr(
                    pIndex, orderByOffset, pOrderBy);
            }

            if (pConstraint != IntPtr.Zero)
            {
                SQLiteMemory.Free(pConstraint);
                pConstraint = IntPtr.Zero;

                SQLiteMarshal.WriteIntPtr(
                    pIndex, constraintOffset, pConstraint);
            }

            if (pIndex != IntPtr.Zero)
            {
                SQLiteMemory.Free(pIndex);
                pIndex = IntPtr.Zero;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Internal Marshal Helper Methods
        /// <summary>
        /// Converts a native pointer to a native sqlite3_index_info structure
        /// into a new <see cref="SQLiteIndex" /> object instance.
        /// </summary>
        /// <param name="pIndex">
        /// The native pointer to the native sqlite3_index_info structure to
        /// convert.
        /// </param>
        /// <param name="includeOutput">
        /// Non-zero to include fields from the outputs portion of the native
        /// structure; otherwise, the "output" fields will not be read.
        /// </param>
        /// <param name="index">
        /// Upon success, this parameter will be modified to contain the newly
        /// created <see cref="SQLiteIndex" /> object instance.
        /// </param>
        internal static void FromIntPtr(
            IntPtr pIndex,
            bool includeOutput,
            ref SQLiteIndex index
            )
        {
            if (pIndex == IntPtr.Zero)
                return;

            int offset = 0;

            int nConstraint = SQLiteMarshal.ReadInt32(
                pIndex, offset);

            offset = SQLiteMarshal.NextOffsetOf(
                offset, sizeof(int), IntPtr.Size);

            IntPtr pConstraint = SQLiteMarshal.ReadIntPtr(
                pIndex, offset);

            offset = SQLiteMarshal.NextOffsetOf(
                offset, IntPtr.Size, sizeof(int));

            int nOrderBy = SQLiteMarshal.ReadInt32(
                pIndex, offset);

            offset = SQLiteMarshal.NextOffsetOf(
                offset, sizeof(int), IntPtr.Size);

            IntPtr pOrderBy = SQLiteMarshal.ReadIntPtr(
                pIndex, offset);

            IntPtr pConstraintUsage = IntPtr.Zero;

            if (includeOutput)
            {
                offset = SQLiteMarshal.NextOffsetOf(
                    offset, IntPtr.Size, IntPtr.Size);

                pConstraintUsage = SQLiteMarshal.ReadIntPtr(
                    pIndex, offset);
            }

            index = new SQLiteIndex(nConstraint, nOrderBy);
            SQLiteIndexInputs inputs = index.Inputs;

            if (inputs == null)
                return;

            SQLiteIndexConstraint[] constraints = inputs.Constraints;

            if (constraints == null)
                return;

            SQLiteIndexOrderBy[] orderBys = inputs.OrderBys;

            if (orderBys == null)
                return;

            Type constraintType = typeof(
                UnsafeNativeMethods.sqlite3_index_constraint);

            int sizeOfConstraintType = Marshal.SizeOf(
                constraintType);

            for (int iConstraint = 0; iConstraint < nConstraint; iConstraint++)
            {
                IntPtr pOffset = SQLiteMarshal.IntPtrForOffset(
                    pConstraint, iConstraint * sizeOfConstraintType);

                UnsafeNativeMethods.sqlite3_index_constraint constraint =
                    (UnsafeNativeMethods.sqlite3_index_constraint)
                        Marshal.PtrToStructure(pOffset, constraintType);

                constraints[iConstraint] = new SQLiteIndexConstraint(
                    constraint);
            }

            Type orderByType = typeof(
                UnsafeNativeMethods.sqlite3_index_orderby);

            int sizeOfOrderByType = Marshal.SizeOf(orderByType);

            for (int iOrderBy = 0; iOrderBy < nOrderBy; iOrderBy++)
            {
                IntPtr pOffset = SQLiteMarshal.IntPtrForOffset(
                    pOrderBy, iOrderBy * sizeOfOrderByType);

                UnsafeNativeMethods.sqlite3_index_orderby orderBy =
                    (UnsafeNativeMethods.sqlite3_index_orderby)
                        Marshal.PtrToStructure(pOffset, orderByType);

                orderBys[iOrderBy] = new SQLiteIndexOrderBy(orderBy);
            }

            if (includeOutput)
            {
                SQLiteIndexOutputs outputs = index.Outputs;

                if (outputs == null)
                    return;

                SQLiteIndexConstraintUsage[] constraintUsages =
                    outputs.ConstraintUsages;

                if (constraintUsages == null)
                    return;

                Type constraintUsageType = typeof(
                    UnsafeNativeMethods.sqlite3_index_constraint_usage);

                int sizeOfConstraintUsageType = Marshal.SizeOf(
                    constraintUsageType);

                for (int iConstraint = 0; iConstraint < nConstraint; iConstraint++)
                {
                    IntPtr pOffset = SQLiteMarshal.IntPtrForOffset(
                        pConstraintUsage, iConstraint * sizeOfConstraintUsageType);

                    UnsafeNativeMethods.sqlite3_index_constraint_usage constraintUsage =
                        (UnsafeNativeMethods.sqlite3_index_constraint_usage)
                            Marshal.PtrToStructure(pOffset, constraintUsageType);

                    constraintUsages[iConstraint] = new SQLiteIndexConstraintUsage(
                        constraintUsage);
                }

                offset = SQLiteMarshal.NextOffsetOf(
                    offset, IntPtr.Size, sizeof(int));

                outputs.IndexNumber = SQLiteMarshal.ReadInt32(
                    pIndex, offset);

                offset = SQLiteMarshal.NextOffsetOf(
                    offset, sizeof(int), IntPtr.Size);

                outputs.IndexString = SQLiteString.StringFromUtf8IntPtr(
                    SQLiteMarshal.ReadIntPtr(pIndex, offset));

                offset = SQLiteMarshal.NextOffsetOf(
                    offset, IntPtr.Size, sizeof(int));

                outputs.NeedToFreeIndexString = SQLiteMarshal.ReadInt32(
                    pIndex, offset);

                offset = SQLiteMarshal.NextOffsetOf(
                    offset, sizeof(int), sizeof(int));

                outputs.OrderByConsumed = SQLiteMarshal.ReadInt32(
                    pIndex, offset);

                offset = SQLiteMarshal.NextOffsetOf(
                    offset, sizeof(int), sizeof(double));

                outputs.EstimatedCost = SQLiteMarshal.ReadDouble(
                    pIndex, offset);

                offset = SQLiteMarshal.NextOffsetOf(
                    offset, sizeof(double), sizeof(long));

                if (outputs.CanUseEstimatedRows())
                {
                    outputs.EstimatedRows = SQLiteMarshal.ReadInt64(
                        pIndex, offset);
                }

                offset = SQLiteMarshal.NextOffsetOf(
                    offset, sizeof(long), sizeof(int));

                if (outputs.CanUseIndexFlags())
                {
                    outputs.IndexFlags = (SQLiteIndexFlags)
                        SQLiteMarshal.ReadInt32(pIndex, offset);
                }

                offset = SQLiteMarshal.NextOffsetOf(
                    offset, sizeof(int), sizeof(long));

                if (outputs.CanUseColumnsUsed())
                {
                    outputs.ColumnsUsed = SQLiteMarshal.ReadInt64(
                        pIndex, offset);
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Populates the outputs of a pre-allocated native sqlite3_index_info
        /// structure using an existing <see cref="SQLiteIndex" /> object
        /// instance.
        /// </summary>
        /// <param name="index">
        /// The existing <see cref="SQLiteIndex" /> object instance containing
        /// the output data to use.
        /// </param>
        /// <param name="pIndex">
        /// The native pointer to the pre-allocated native sqlite3_index_info
        /// structure.
        /// </param>
        /// <param name="includeInput">
        /// Non-zero to include fields from the inputs portion of the native
        /// structure; otherwise, the "input" fields will not be written.
        /// </param>
        internal static void ToIntPtr(
            SQLiteIndex index,
            IntPtr pIndex,
            bool includeInput
            )
        {
            if (index == null)
                return;

            SQLiteIndexOutputs outputs = index.Outputs;

            if (outputs == null)
                return;

            SQLiteIndexConstraintUsage[] constraintUsages =
                outputs.ConstraintUsages;

            if (constraintUsages == null)
                return;

            SQLiteIndexInputs inputs = null;
            SQLiteIndexConstraint[] constraints = null;
            SQLiteIndexOrderBy[] orderBys = null;

            if (includeInput)
            {
                inputs = index.Inputs;

                if (inputs == null)
                    return;

                constraints = inputs.Constraints;

                if (constraints == null)
                    return;

                orderBys = inputs.OrderBys;

                if (orderBys == null)
                    return;
            }

            if (pIndex == IntPtr.Zero)
                return;

            int offset = 0;

            int nConstraint = SQLiteMarshal.ReadInt32(pIndex, offset);

            if (includeInput && (nConstraint != constraints.Length))
                return;

            if (nConstraint != constraintUsages.Length)
                return;

            offset = SQLiteMarshal.NextOffsetOf(
                offset, sizeof(int), IntPtr.Size);

            if (includeInput)
            {
                IntPtr pConstraint = SQLiteMarshal.ReadIntPtr(
                    pIndex, offset);

                int sizeOfConstraintType = Marshal.SizeOf(typeof(
                    UnsafeNativeMethods.sqlite3_index_constraint));

                for (int iConstraint = 0; iConstraint < nConstraint; iConstraint++)
                {
                    UnsafeNativeMethods.sqlite3_index_constraint constraint =
                        new UnsafeNativeMethods.sqlite3_index_constraint(
                            constraints[iConstraint]);

                    Marshal.StructureToPtr(
                        constraint, SQLiteMarshal.IntPtrForOffset(
                        pConstraint, iConstraint * sizeOfConstraintType),
                        false);
                }
            }

            offset = SQLiteMarshal.NextOffsetOf(
                offset, IntPtr.Size, sizeof(int));

            int nOrderBy = includeInput ?
                SQLiteMarshal.ReadInt32(pIndex, offset) : 0;

            if (includeInput && (nOrderBy != orderBys.Length))
                return;

            offset = SQLiteMarshal.NextOffsetOf(
                offset, sizeof(int), IntPtr.Size);

            if (includeInput)
            {
                IntPtr pOrderBy = SQLiteMarshal.ReadIntPtr(pIndex, offset);

                int sizeOfOrderByType = Marshal.SizeOf(typeof(
                    UnsafeNativeMethods.sqlite3_index_orderby));

                for (int iOrderBy = 0; iOrderBy < nOrderBy; iOrderBy++)
                {
                    UnsafeNativeMethods.sqlite3_index_orderby orderBy =
                        new UnsafeNativeMethods.sqlite3_index_orderby(
                            orderBys[iOrderBy]);

                    Marshal.StructureToPtr(
                        orderBy, SQLiteMarshal.IntPtrForOffset(
                        pOrderBy, iOrderBy * sizeOfOrderByType),
                        false);
                }
            }

            offset = SQLiteMarshal.NextOffsetOf(
                offset, IntPtr.Size, IntPtr.Size);

            IntPtr pConstraintUsage = SQLiteMarshal.ReadIntPtr(
                pIndex, offset);

            int sizeOfConstraintUsageType = Marshal.SizeOf(typeof(
                UnsafeNativeMethods.sqlite3_index_constraint_usage));

            for (int iConstraint = 0; iConstraint < nConstraint; iConstraint++)
            {
                UnsafeNativeMethods.sqlite3_index_constraint_usage constraintUsage =
                    new UnsafeNativeMethods.sqlite3_index_constraint_usage(
                        constraintUsages[iConstraint]);

                Marshal.StructureToPtr(
                    constraintUsage, SQLiteMarshal.IntPtrForOffset(
                    pConstraintUsage, iConstraint * sizeOfConstraintUsageType),
                    false);
            }

            offset = SQLiteMarshal.NextOffsetOf(
                offset, IntPtr.Size, sizeof(int));

            SQLiteMarshal.WriteInt32(pIndex, offset,
                outputs.IndexNumber);

            offset = SQLiteMarshal.NextOffsetOf(
                offset, sizeof(int), IntPtr.Size);

            SQLiteMarshal.WriteIntPtr(pIndex, offset,
                SQLiteString.Utf8IntPtrFromString(
                    outputs.IndexString, false)); /* OK: FREED BY CORE*/

            offset = SQLiteMarshal.NextOffsetOf(
                offset, IntPtr.Size, sizeof(int));

            //
            // NOTE: We just allocated the IndexString field; therefore, we
            //       need to set make sure the NeedToFreeIndexString field
            //       is non-zero; however, we are not picky about the exact
            //       value.
            //
            int needToFreeIndexString = outputs.NeedToFreeIndexString != 0 ?
                outputs.NeedToFreeIndexString : 1;

            SQLiteMarshal.WriteInt32(pIndex, offset,
                needToFreeIndexString);

            offset = SQLiteMarshal.NextOffsetOf(
                offset, sizeof(int), sizeof(int));

            SQLiteMarshal.WriteInt32(pIndex, offset,
                outputs.OrderByConsumed);

            offset = SQLiteMarshal.NextOffsetOf(
                offset, sizeof(int), sizeof(double));

            if (outputs.EstimatedCost.HasValue)
            {
                SQLiteMarshal.WriteDouble(pIndex, offset,
                    outputs.EstimatedCost.GetValueOrDefault());
            }

            offset = SQLiteMarshal.NextOffsetOf(
                offset, sizeof(double), sizeof(long));

            if (outputs.CanUseEstimatedRows() &&
                outputs.EstimatedRows.HasValue)
            {
                SQLiteMarshal.WriteInt64(pIndex, offset,
                    outputs.EstimatedRows.GetValueOrDefault());
            }

            offset = SQLiteMarshal.NextOffsetOf(
                offset, sizeof(long), sizeof(int));

            if (outputs.CanUseIndexFlags() &&
                outputs.IndexFlags.HasValue)
            {
                SQLiteMarshal.WriteInt32(pIndex, offset,
                   (int)outputs.IndexFlags.GetValueOrDefault());
            }

            offset = SQLiteMarshal.NextOffsetOf(
                offset, sizeof(int), sizeof(long));

            if (outputs.CanUseColumnsUsed() &&
                outputs.ColumnsUsed.HasValue)
            {
                SQLiteMarshal.WriteInt64(pIndex, offset,
                    outputs.ColumnsUsed.GetValueOrDefault());
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Properties
        private SQLiteIndexInputs inputs;
        /// <summary>
        /// The <see cref="SQLiteIndexInputs" /> object instance containing
        /// the inputs to the <see cref="ISQLiteManagedModule.BestIndex" />
        /// method.
        /// </summary>
        public SQLiteIndexInputs Inputs
        {
            get { return inputs; }
        }

        ///////////////////////////////////////////////////////////////////////

        private SQLiteIndexOutputs outputs;
        /// <summary>
        /// The <see cref="SQLiteIndexOutputs" /> object instance containing
        /// the outputs from the <see cref="ISQLiteManagedModule.BestIndex" />
        /// method.
        /// </summary>
        public SQLiteIndexOutputs Outputs
        {
            get { return outputs; }
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteVirtualTable Base Class
    /// <summary>
    /// This class represents a managed virtual table implementation.  It is
    /// not sealed and should be used as the base class for any user-defined
    /// virtual table classes implemented in managed code.
    /// </summary>
    public class SQLiteVirtualTable :
            ISQLiteNativeHandle, IDisposable /* NOT SEALED */
    {
        #region Private Constants
        /// <summary>
        /// The index within the array of strings provided to the
        /// <see cref="ISQLiteManagedModule.Create" /> and
        /// <see cref="ISQLiteManagedModule.Connect" /> methods containing the
        /// name of the module implementing this virtual table.
        /// </summary>
        private const int ModuleNameIndex = 0;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The index within the array of strings provided to the
        /// <see cref="ISQLiteManagedModule.Create" /> and
        /// <see cref="ISQLiteManagedModule.Connect" /> methods containing the
        /// name of the database containing this virtual table.
        /// </summary>
        private const int DatabaseNameIndex = 1;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The index within the array of strings provided to the
        /// <see cref="ISQLiteManagedModule.Create" /> and
        /// <see cref="ISQLiteManagedModule.Connect" /> methods containing the
        /// name of the virtual table.
        /// </summary>
        private const int TableNameIndex = 2;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        /// <summary>
        /// Constructs an instance of this class.
        /// </summary>
        /// <param name="arguments">
        /// The original array of strings provided to the
        /// <see cref="ISQLiteManagedModule.Create" /> and
        /// <see cref="ISQLiteManagedModule.Connect" /> methods.
        /// </param>
        public SQLiteVirtualTable(
            string[] arguments
            )
        {
            this.arguments = arguments;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Properties
        private string[] arguments;
        /// <summary>
        /// The original array of strings provided to the
        /// <see cref="ISQLiteManagedModule.Create" /> and
        /// <see cref="ISQLiteManagedModule.Connect" /> methods.
        /// </summary>
        public virtual string[] Arguments
        {
            get { CheckDisposed(); return arguments; }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The name of the module implementing this virtual table.
        /// </summary>
        public virtual string ModuleName
        {
            get
            {
                CheckDisposed();

                string[] arguments = Arguments;

                if ((arguments != null) &&
                    (arguments.Length > ModuleNameIndex))
                {
                    return arguments[ModuleNameIndex];
                }
                else
                {
                    return null;
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The name of the database containing this virtual table.
        /// </summary>
        public virtual string DatabaseName
        {
            get
            {
                CheckDisposed();

                string[] arguments = Arguments;

                if ((arguments != null) &&
                    (arguments.Length > DatabaseNameIndex))
                {
                    return arguments[DatabaseNameIndex];
                }
                else
                {
                    return null;
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The name of the virtual table.
        /// </summary>
        public virtual string TableName
        {
            get
            {
                CheckDisposed();

                string[] arguments = Arguments;

                if ((arguments != null) &&
                    (arguments.Length > TableNameIndex))
                {
                    return arguments[TableNameIndex];
                }
                else
                {
                    return null;
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        private SQLiteIndex index;
        /// <summary>
        /// The <see cref="SQLiteIndex" /> object instance containing all the
        /// data for the inputs and outputs relating to the most recent index
        /// selection.
        /// </summary>
        public virtual SQLiteIndex Index
        {
            get { CheckDisposed(); return index; }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Methods
        /// <summary>
        /// This method should normally be used by the
        /// <see cref="ISQLiteManagedModule.BestIndex" /> method in order to
        /// perform index selection based on the constraints provided by the
        /// SQLite core library.
        /// </summary>
        /// <param name="index">
        /// The <see cref="SQLiteIndex" /> object instance containing all the
        /// data for the inputs and outputs relating to index selection.
        /// </param>
        /// <returns>
        /// Non-zero upon success.
        /// </returns>
        public virtual bool BestIndex(
            SQLiteIndex index
            )
        {
            CheckDisposed();

            this.index = index;

            return true;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to record the renaming of the virtual table associated
        /// with this object instance.
        /// </summary>
        /// <param name="name">
        /// The new name for the virtual table.
        /// </param>
        /// <returns>
        /// Non-zero upon success.
        /// </returns>
        public virtual bool Rename(
            string name
            )
        {
            CheckDisposed();

            if ((arguments != null) &&
                (arguments.Length > TableNameIndex))
            {
                arguments[TableNameIndex] = name;
                return true;
            }

            return false;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteNativeHandle Members
        private IntPtr nativeHandle;
        /// <summary>
        /// Returns the underlying SQLite native handle associated with this
        /// object instance.
        /// </summary>
        public virtual IntPtr NativeHandle
        {
            get { CheckDisposed(); return nativeHandle; }
            internal set { nativeHandle = value; }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable Members
        /// <summary>
        /// Disposes of this object instance.
        /// </summary>
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        private bool disposed;
        /// <summary>
        /// Throws an <see cref="ObjectDisposedException" /> if this object
        /// instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteVirtualTable).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this method is being called from the
        /// <see cref="Dispose()" /> method.  Zero if this method is being called
        /// from the finalizer.
        /// </param>
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                //if (disposing)
                //{
                //    ////////////////////////////////////
                //    // dispose managed resources here...
                //    ////////////////////////////////////
                //}

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////

                disposed = true;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Destructor
        /// <summary>
        /// Finalizes this object instance.
        /// </summary>
        ~SQLiteVirtualTable()
        {
            Dispose(false);
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteVirtualTableCursor Base Class
    /// <summary>
    /// This class represents a managed virtual table cursor implementation.
    /// It is not sealed and should be used as the base class for any
    /// user-defined virtual table cursor classes implemented in managed code.
    /// </summary>
    public class SQLiteVirtualTableCursor :
            ISQLiteNativeHandle, IDisposable /* NOT SEALED */
    {
        #region Protected Constants
        /// <summary>
        /// This value represents an invalid integer row sequence number.
        /// </summary>
        protected static readonly int InvalidRowIndex = 0;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Data
        /// <summary>
        /// The field holds the integer row sequence number for the current row
        /// pointed to by this cursor object instance.
        /// </summary>
        private int rowIndex;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        /// <summary>
        /// Constructs an instance of this class.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this object instance.
        /// </param>
        public SQLiteVirtualTableCursor(
            SQLiteVirtualTable table
            )
            : this()
        {
            this.table = table;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Constructors
        /// <summary>
        /// Constructs an instance of this class.
        /// </summary>
        private SQLiteVirtualTableCursor()
        {
            rowIndex = InvalidRowIndex;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Properties
        private SQLiteVirtualTable table;
        /// <summary>
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this object instance.
        /// </summary>
        public virtual SQLiteVirtualTable Table
        {
            get { CheckDisposed(); return table; }
        }

        ///////////////////////////////////////////////////////////////////////

        private int indexNumber;
        /// <summary>
        /// Number used to help identify the selected index.  This value will
        /// be set via the <see cref="Filter" /> method.
        /// </summary>
        public virtual int IndexNumber
        {
            get { CheckDisposed(); return indexNumber; }
        }

        ///////////////////////////////////////////////////////////////////////

        private string indexString;
        /// <summary>
        /// String used to help identify the selected index.  This value will
        /// be set via the <see cref="Filter" /> method.
        /// </summary>
        public virtual string IndexString
        {
            get { CheckDisposed(); return indexString; }
        }

        ///////////////////////////////////////////////////////////////////////

        private SQLiteValue[] values;
        /// <summary>
        /// The values used to filter the rows returned via this cursor object
        /// instance.  This value will be set via the <see cref="Filter" />
        /// method.
        /// </summary>
        public virtual SQLiteValue[] Values
        {
            get { CheckDisposed(); return values; }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Protected Methods
        /// <summary>
        /// Attempts to persist the specified <see cref="SQLiteValue" /> object
        /// instances in order to make them available after the
        /// <see cref="ISQLiteManagedModule.Filter" /> method returns.
        /// </summary>
        /// <param name="values">
        /// The array of <see cref="SQLiteValue" /> object instances to be
        /// persisted.
        /// </param>
        /// <returns>
        /// The number of <see cref="SQLiteValue" /> object instances that were
        /// successfully persisted.
        /// </returns>
        protected virtual int TryPersistValues(
            SQLiteValue[] values
            )
        {
            int result = 0;

            if (values != null)
            {
                foreach (SQLiteValue value in values)
                {
                    if (value == null)
                        continue;

                    if (value.Persist())
                        result++;
                }
            }

            return result;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Methods
        /// <summary>
        /// This method should normally be used by the
        /// <see cref="ISQLiteManagedModule.Filter" /> method in order to
        /// perform filtering of the result rows and/or to record the filtering
        /// criteria provided by the SQLite core library.
        /// </summary>
        /// <param name="indexNumber">
        /// Number used to help identify the selected index.
        /// </param>
        /// <param name="indexString">
        /// String used to help identify the selected index.
        /// </param>
        /// <param name="values">
        /// The values corresponding to each column in the selected index.
        /// </param>
        public virtual void Filter(
            int indexNumber,
            string indexString,
            SQLiteValue[] values
            )
        {
            CheckDisposed();

            if ((values != null) &&
                (TryPersistValues(values) != values.Length))
            {
                throw new SQLiteException(
                    "failed to persist one or more values");
            }

            this.indexNumber = indexNumber;
            this.indexString = indexString;
            this.values = values;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Determines the integer row sequence number for the current row.
        /// </summary>
        /// <returns>
        /// The integer row sequence number for the current row -OR- zero if
        /// it cannot be determined.
        /// </returns>
        public virtual int GetRowIndex()
        {
            return rowIndex;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Adjusts the integer row sequence number so that it refers to the
        /// next row.
        /// </summary>
        public virtual void NextRowIndex()
        {
            rowIndex++;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteNativeHandle Members
        private IntPtr nativeHandle;
        /// <summary>
        /// Returns the underlying SQLite native handle associated with this
        /// object instance.
        /// </summary>
        public virtual IntPtr NativeHandle
        {
            get { CheckDisposed(); return nativeHandle; }
            internal set { nativeHandle = value; }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable Members
        /// <summary>
        /// Disposes of this object instance.
        /// </summary>
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        private bool disposed;
        /// <summary>
        /// Throws an <see cref="ObjectDisposedException" /> if this object
        /// instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteVirtualTableCursor).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this method is being called from the
        /// <see cref="Dispose()" /> method.  Zero if this method is being called
        /// from the finalizer.
        /// </param>
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                //if (disposing)
                //{
                //    ////////////////////////////////////
                //    // dispose managed resources here...
                //    ////////////////////////////////////
                //}

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////

                disposed = true;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Destructor
        /// <summary>
        /// Finalizes this object instance.
        /// </summary>
        ~SQLiteVirtualTableCursor()
        {
            Dispose(false);
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region ISQLiteNativeHandle Interface
    /// <summary>
    /// This interface represents a native handle provided by the SQLite core
    /// library.
    /// </summary>
    public interface ISQLiteNativeHandle
    {
        /// <summary>
        /// The native handle value.
        /// </summary>
        IntPtr NativeHandle { get; }
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region ISQLiteManagedModule Interface
    /// <summary>
    /// This interface represents a virtual table implementation written in
    /// managed code.
    /// </summary>
    public interface ISQLiteManagedModule
    {
        /// <summary>
        /// Returns non-zero if the schema for the virtual table has been
        /// declared.
        /// </summary>
        bool Declared { get; }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Returns the name of the module as it was registered with the SQLite
        /// core library.
        /// </summary>
        string Name { get; }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xCreate" /> method.
        /// </summary>
        /// <param name="connection">
        /// The <see cref="SQLiteConnection" /> object instance associated with
        /// the virtual table.
        /// </param>
        /// <param name="pClientData">
        /// The native user-data pointer associated with this module, as it was
        /// provided to the SQLite core library when the native module instance
        /// was created.
        /// </param>
        /// <param name="arguments">
        /// The module name, database name, virtual table name, and all other
        /// arguments passed to the CREATE VIRTUAL TABLE statement.
        /// </param>
        /// <param name="table">
        /// Upon success, this parameter must be modified to contain the
        /// <see cref="SQLiteVirtualTable" /> object instance associated with
        /// the virtual table.
        /// </param>
        /// <param name="error">
        /// Upon failure, this parameter must be modified to contain an error
        /// message.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode Create(
            SQLiteConnection connection,  /* in */
            IntPtr pClientData,           /* in */
            string[] arguments,           /* in */
            ref SQLiteVirtualTable table, /* out */
            ref string error              /* out */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xConnect" /> method.
        /// </summary>
        /// <param name="connection">
        /// The <see cref="SQLiteConnection" /> object instance associated with
        /// the virtual table.
        /// </param>
        /// <param name="pClientData">
        /// The native user-data pointer associated with this module, as it was
        /// provided to the SQLite core library when the native module instance
        /// was created.
        /// </param>
        /// <param name="arguments">
        /// The module name, database name, virtual table name, and all other
        /// arguments passed to the CREATE VIRTUAL TABLE statement.
        /// </param>
        /// <param name="table">
        /// Upon success, this parameter must be modified to contain the
        /// <see cref="SQLiteVirtualTable" /> object instance associated with
        /// the virtual table.
        /// </param>
        /// <param name="error">
        /// Upon failure, this parameter must be modified to contain an error
        /// message.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode Connect(
            SQLiteConnection connection,  /* in */
            IntPtr pClientData,           /* in */
            string[] arguments,           /* in */
            ref SQLiteVirtualTable table, /* out */
            ref string error              /* out */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xBestIndex" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <param name="index">
        /// The <see cref="SQLiteIndex" /> object instance containing all the
        /// data for the inputs and outputs relating to index selection.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode BestIndex(
            SQLiteVirtualTable table, /* in */
            SQLiteIndex index         /* in, out */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xDisconnect" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode Disconnect(
            SQLiteVirtualTable table /* in */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xDestroy" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode Destroy(
            SQLiteVirtualTable table /* in */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xOpen" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <param name="cursor">
        /// Upon success, this parameter must be modified to contain the
        /// <see cref="SQLiteVirtualTableCursor" /> object instance associated
        /// with the newly opened virtual table cursor.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode Open(
            SQLiteVirtualTable table,           /* in */
            ref SQLiteVirtualTableCursor cursor /* out */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xClose" /> method.
        /// </summary>
        /// <param name="cursor">
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance
        /// associated with the previously opened virtual table cursor to be
        /// used.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode Close(
            SQLiteVirtualTableCursor cursor /* in */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xFilter" /> method.
        /// </summary>
        /// <param name="cursor">
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance
        /// associated with the previously opened virtual table cursor to be
        /// used.
        /// </param>
        /// <param name="indexNumber">
        /// Number used to help identify the selected index.
        /// </param>
        /// <param name="indexString">
        /// String used to help identify the selected index.
        /// </param>
        /// <param name="values">
        /// The values corresponding to each column in the selected index.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode Filter(
            SQLiteVirtualTableCursor cursor, /* in */
            int indexNumber,                 /* in */
            string indexString,              /* in */
            SQLiteValue[] values             /* in */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xNext" /> method.
        /// </summary>
        /// <param name="cursor">
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance
        /// associated with the previously opened virtual table cursor to be
        /// used.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode Next(
            SQLiteVirtualTableCursor cursor /* in */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xEof" /> method.
        /// </summary>
        /// <param name="cursor">
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance
        /// associated with the previously opened virtual table cursor to be
        /// used.
        /// </param>
        /// <returns>
        /// Non-zero if no more rows are available; zero otherwise.
        /// </returns>
        bool Eof(
            SQLiteVirtualTableCursor cursor /* in */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xColumn" /> method.
        /// </summary>
        /// <param name="cursor">
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance
        /// associated with the previously opened virtual table cursor to be
        /// used.
        /// </param>
        /// <param name="context">
        /// The <see cref="SQLiteContext" /> object instance to be used for
        /// returning the specified column value to the SQLite core library.
        /// </param>
        /// <param name="index">
        /// The zero-based index corresponding to the column containing the
        /// value to be returned.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode Column(
            SQLiteVirtualTableCursor cursor, /* in */
            SQLiteContext context,           /* in */
            int index                        /* in */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xRowId" /> method.
        /// </summary>
        /// <param name="cursor">
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance
        /// associated with the previously opened virtual table cursor to be
        /// used.
        /// </param>
        /// <param name="rowId">
        /// Upon success, this parameter must be modified to contain the unique
        /// integer row identifier for the current row for the specified cursor.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode RowId(
            SQLiteVirtualTableCursor cursor, /* in */
            ref long rowId                   /* out */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xUpdate" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <param name="values">
        /// The array of <see cref="SQLiteValue" /> object instances containing
        /// the new or modified column values, if any.
        /// </param>
        /// <param name="rowId">
        /// Upon success, this parameter must be modified to contain the unique
        /// integer row identifier for the row that was inserted, if any.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode Update(
            SQLiteVirtualTable table, /* in */
            SQLiteValue[] values,     /* in */
            ref long rowId            /* out */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xBegin" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode Begin(
            SQLiteVirtualTable table /* in */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xSync" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode Sync(
            SQLiteVirtualTable table /* in */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xCommit" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode Commit(
            SQLiteVirtualTable table /* in */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xRollback" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode Rollback(
            SQLiteVirtualTable table /* in */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xFindFunction" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <param name="argumentCount">
        /// The number of arguments to the function being sought.
        /// </param>
        /// <param name="name">
        /// The name of the function being sought.
        /// </param>
        /// <param name="function">
        /// Upon success, this parameter must be modified to contain the
        /// <see cref="SQLiteFunction" /> object instance responsible for
        /// implementing the specified function.
        /// </param>
        /// <param name="pClientData">
        /// Upon success, this parameter must be modified to contain the
        /// native user-data pointer associated with
        /// <paramref name="function" />.
        /// </param>
        /// <returns>
        /// Non-zero if the specified function was found; zero otherwise.
        /// </returns>
        bool FindFunction(
            SQLiteVirtualTable table,    /* in */
            int argumentCount,           /* in */
            string name,                 /* in */
            ref SQLiteFunction function, /* out */
            ref IntPtr pClientData       /* out */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xRename" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <param name="newName">
        /// The new name for the virtual table.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode Rename(
            SQLiteVirtualTable table, /* in */
            string newName            /* in */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xSavepoint" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <param name="savepoint">
        /// This is an integer identifier under which the the current state of
        /// the virtual table should be saved.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode Savepoint(
            SQLiteVirtualTable table, /* in */
            int savepoint             /* in */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xRelease" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <param name="savepoint">
        /// This is an integer used to indicate that any saved states with an
        /// identifier greater than or equal to this should be deleted by the
        /// virtual table.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode Release(
            SQLiteVirtualTable table, /* in */
            int savepoint             /* in */
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xRollbackTo" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <param name="savepoint">
        /// This is an integer identifier used to specify a specific saved
        /// state for the virtual table for it to restore itself back to, which
        /// should also have the effect of deleting all saved states with an
        /// integer identifier greater than this one.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        SQLiteErrorCode RollbackTo(
            SQLiteVirtualTable table, /* in */
            int savepoint             /* in */
            );
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteMemory Static Class
    /// <summary>
    /// This class contains static methods that are used to allocate,
    /// manipulate, and free native memory provided by the SQLite core library.
    /// </summary>
    internal static class SQLiteMemory
    {
        #region Private Data
#if TRACK_MEMORY_BYTES
        /// <summary>
        /// This object instance is used to synchronize access to the other
        /// static fields of this class.
        /// </summary>
        private static object syncRoot = new object();

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The total number of outstanding memory bytes allocated by this
        /// class using the SQLite core library.
        /// </summary>
        private static ulong bytesAllocated;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The maximum number of outstanding memory bytes ever allocated by
        /// this class using the SQLite core library.
        /// </summary>
        private static ulong maximumBytesAllocated;
#endif
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Memory Tracking Helper Methods
#if TRACK_MEMORY_BYTES
        /// <summary>
        /// Attempts to determine the size of the specified memory block.  If
        /// the <see cref="Size64" /> method can be used, the returned value
        /// may be larger than <see cref="Int32.MaxValue" />.  A message may
        /// be sent to the logging subsystem if an error is encountered.
        /// </summary>
        /// <param name="pMemory">
        /// The native pointer to the memory block previously obtained from
        /// the <see cref="Allocate" />, <see cref="Allocate64" />,
        /// <see cref="AllocateUntracked" />, or
        /// <see cref="Allocate64Untracked" /> methods or directly from the
        /// SQLite core library.
        /// </param>
        /// <returns>
        /// The size of the specified memory block -OR- zero if the 32-bit
        /// signed value reported from the native API was less than zero.
        /// </returns>
        private static ulong GetBlockSize(
            IntPtr pMemory
            )
        {
            ulong ulongSize = 0;

            if (CanUseSize64())
            {
                ulongSize = Size64(pMemory);
            }
            else
            {
                int intSize = Size(pMemory);

                if (intSize > 0)
                {
                    ulongSize = (ulong)intSize;
                }
#if DEBUG
                else if (intSize < 0)
                {
                    SQLiteLog.LogMessage(SQLiteErrorCode.Warning,
                        HelperMethods.StringFormat(CultureInfo.CurrentCulture,
                        "pointer {0} size {1} appears to be negative: {2}",
                        pMemory, intSize,
#if !PLATFORM_COMPACTFRAMEWORK
                        Environment.StackTrace
#else
                        null
#endif
                    ));
                }
#endif
            }

            return ulongSize;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Adjusts the total number of (tracked) bytes that are currently
        /// considered to be allocated by this class.  The total number is
        /// increased by the total size of the memory block pointed to by
        /// <paramref name="pMemory" />.  If the new total number exceeds
        /// the previously seen maximum, the maximum will be reset.
        /// </summary>
        /// <param name="pMemory">
        /// A native pointer to newly allocated memory.
        /// </param>
        private static void MemoryWasAllocated(
            IntPtr pMemory
            )
        {
            if (pMemory != IntPtr.Zero)
            {
                ulong blockSize = GetBlockSize(pMemory);

                if (blockSize > 0)
                {
                    lock (syncRoot)
                    {
                        bytesAllocated += blockSize;

                        if (bytesAllocated > maximumBytesAllocated)
                            maximumBytesAllocated = bytesAllocated;
                    }
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Adjusts the total number of (tracked) bytes that are currently
        /// considered to be allocated by this class.  The total number is
        /// decreased by the total size of the memory block pointed to by
        /// <paramref name="pMemory" />.
        /// </summary>
        /// <param name="pMemory">
        /// A native pointer to allocated memory that is going to be freed.
        /// </param>
        private static void MemoryIsBeingFreed(
            IntPtr pMemory
            )
        {
            if (pMemory != IntPtr.Zero)
            {
                ulong blockSize = GetBlockSize(pMemory);

                if (blockSize > 0)
                {
                    lock (syncRoot)
                    {
                        bytesAllocated -= blockSize;
                    }
                }
            }
        }
#endif
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Memory Version Helper Methods
        /// <summary>
        /// Determines if the native sqlite3_msize() API can be used, based on
        /// the available version of the SQLite core library.
        /// </summary>
        /// <returns>
        /// Non-zero if the native sqlite3_msize() API is supported by the
        /// SQLite core library.
        /// </returns>
        private static bool CanUseSize64()
        {
#if !PLATFORM_COMPACTFRAMEWORK || !SQLITE_STANDARD
            if (UnsafeNativeMethods.sqlite3_libversion_number() >= 3008007)
                return true;
#endif

            return false;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Memory Allocation Helper Methods
        /// <summary>
        /// Allocates at least the specified number of bytes of native memory
        /// via the SQLite core library sqlite3_malloc() function and returns
        /// the resulting native pointer.  If the TRACK_MEMORY_BYTES option
        /// was enabled at compile-time, adjusts the number of bytes currently
        /// allocated by this class.
        /// </summary>
        /// <param name="size">
        /// The number of bytes to allocate.
        /// </param>
        /// <returns>
        /// The native pointer that points to a block of memory of at least the
        /// specified size -OR- <see cref="IntPtr.Zero" /> if the memory could
        /// not be allocated.
        /// </returns>
        public static IntPtr Allocate(int size)
        {
            IntPtr pMemory = UnsafeNativeMethods.sqlite3_malloc(size);

#if TRACK_MEMORY_BYTES
            MemoryWasAllocated(pMemory);
#endif

            return pMemory;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Allocates at least the specified number of bytes of native memory
        /// via the SQLite core library sqlite3_malloc64() function and returns
        /// the resulting native pointer.  If the TRACK_MEMORY_BYTES option
        /// was enabled at compile-time, adjusts the number of bytes currently
        /// allocated by this class.
        /// </summary>
        /// <param name="size">
        /// The number of bytes to allocate.
        /// </param>
        /// <returns>
        /// The native pointer that points to a block of memory of at least the
        /// specified size -OR- <see cref="IntPtr.Zero" /> if the memory could
        /// not be allocated.
        /// </returns>
        public static IntPtr Allocate64(ulong size)
        {
            IntPtr pMemory = UnsafeNativeMethods.sqlite3_malloc64(size);

#if TRACK_MEMORY_BYTES
            MemoryWasAllocated(pMemory);
#endif

            return pMemory;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Allocates at least the specified number of bytes of native memory
        /// via the SQLite core library sqlite3_malloc() function and returns
        /// the resulting native pointer without adjusting the number of
        /// allocated bytes currently tracked by this class.  This is useful
        /// when dealing with blocks of memory that will be freed directly by
        /// the SQLite core library.
        /// </summary>
        /// <param name="size">
        /// The number of bytes to allocate.
        /// </param>
        /// <returns>
        /// The native pointer that points to a block of memory of at least the
        /// specified size -OR- <see cref="IntPtr.Zero" /> if the memory could
        /// not be allocated.
        /// </returns>
        public static IntPtr AllocateUntracked(int size)
        {
            return UnsafeNativeMethods.sqlite3_malloc(size);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Allocates at least the specified number of bytes of native memory
        /// via the SQLite core library sqlite3_malloc64() function and returns
        /// the resulting native pointer without adjusting the number of
        /// allocated bytes currently tracked by this class.  This is useful
        /// when dealing with blocks of memory that will be freed directly by
        /// the SQLite core library.
        /// </summary>
        /// <param name="size">
        /// The number of bytes to allocate.
        /// </param>
        /// <returns>
        /// The native pointer that points to a block of memory of at least the
        /// specified size -OR- <see cref="IntPtr.Zero" /> if the memory could
        /// not be allocated.
        /// </returns>
        public static IntPtr Allocate64Untracked(ulong size)
        {
            return UnsafeNativeMethods.sqlite3_malloc64(size);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets and returns the actual size of the specified memory block
        /// that was previously obtained from the <see cref="Allocate" />,
        /// <see cref="Allocate64" />, <see cref="AllocateUntracked" />, or
        /// <see cref="Allocate64Untracked" /> methods or directly from the
        /// SQLite core library.
        /// </summary>
        /// <param name="pMemory">
        /// The native pointer to the memory block previously obtained from
        /// the <see cref="Allocate" />, <see cref="Allocate64" />,
        /// <see cref="AllocateUntracked" />, or
        /// <see cref="Allocate64Untracked" /> methods or directly from the
        /// SQLite core library.
        /// </param>
        /// <returns>
        /// The actual size, in bytes, of the memory block specified via the
        /// native pointer.
        /// </returns>
        public static int Size(IntPtr pMemory)
        {
#if DEBUG
            SQLiteMarshal.CheckAlignment("Size", pMemory, 0, IntPtr.Size);
#endif

#if !SQLITE_STANDARD
            return UnsafeNativeMethods.sqlite3_malloc_size_interop(pMemory);
#elif TRACK_MEMORY_BYTES
            //
            // HACK: Ok, we cannot determine the size of the memory block;
            //       therefore, just track number of allocations instead.
            //
            return (pMemory != IntPtr.Zero) ? 1 : 0;
#else
            return 0;
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets and returns the actual size of the specified memory block
        /// that was previously obtained from the <see cref="Allocate" />,
        /// <see cref="Allocate64" />, <see cref="AllocateUntracked" />, or
        /// <see cref="Allocate64Untracked" /> methods or directly from the
        /// SQLite core library.
        /// </summary>
        /// <param name="pMemory">
        /// The native pointer to the memory block previously obtained from
        /// the <see cref="Allocate" />, <see cref="Allocate64" />,
        /// <see cref="AllocateUntracked" />, or
        /// <see cref="Allocate64Untracked" /> methods or directly from the
        /// SQLite core library.
        /// </param>
        /// <returns>
        /// The actual size, in bytes, of the memory block specified via the
        /// native pointer.
        /// </returns>
        public static ulong Size64(IntPtr pMemory)
        {
#if DEBUG
            SQLiteMarshal.CheckAlignment("Size64", pMemory, 0, IntPtr.Size);
#endif

#if !PLATFORM_COMPACTFRAMEWORK
            return UnsafeNativeMethods.sqlite3_msize(pMemory);
#elif !SQLITE_STANDARD
            ulong size = 0;
            UnsafeNativeMethods.sqlite3_msize_interop(pMemory, ref size);
            return size;
#else
            throw new NotImplementedException();
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Frees a memory block previously obtained from the
        /// <see cref="Allocate" /> or <see cref="Allocate64" /> methods.  If
        /// the TRACK_MEMORY_BYTES option was enabled at compile-time, adjusts
        /// the number of bytes currently allocated by this class.
        /// </summary>
        /// <param name="pMemory">
        /// The native pointer to the memory block previously obtained from the
        /// <see cref="Allocate" /> or <see cref="Allocate64" /> methods.
        /// </param>
        public static void Free(IntPtr pMemory)
        {
#if DEBUG
            SQLiteMarshal.CheckAlignment("Free", pMemory, 0, IntPtr.Size);
#endif

#if TRACK_MEMORY_BYTES
            MemoryIsBeingFreed(pMemory);
#endif

            UnsafeNativeMethods.sqlite3_free(pMemory);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Frees a memory block previously obtained from the SQLite core
        /// library without adjusting the number of allocated bytes currently
        /// tracked by this class.  This is useful when dealing with blocks of
        /// memory that were not allocated using this class.
        /// </summary>
        /// <param name="pMemory">
        /// The native pointer to the memory block previously obtained from the
        /// SQLite core library.
        /// </param>
        public static void FreeUntracked(IntPtr pMemory)
        {
#if DEBUG
            SQLiteMarshal.CheckAlignment(
                "FreeUntracked", pMemory, 0, IntPtr.Size);
#endif

            UnsafeNativeMethods.sqlite3_free(pMemory);
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteString Static Class
    /// <summary>
    /// This class contains static methods that are used to deal with native
    /// UTF-8 string pointers to be used with the SQLite core library.
    /// </summary>
    internal static class SQLiteString
    {
        #region Private Constants
        /// <summary>
        /// This is the maximum possible length for the native UTF-8 encoded
        /// strings used with the SQLite core library.
        /// </summary>
        private static int ThirtyBits = 0x3fffffff;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This is the <see cref="Encoding" /> object instance used to handle
        /// conversions from/to UTF-8.
        /// </summary>
        private static readonly Encoding Utf8Encoding = Encoding.UTF8;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region UTF-8 Encoding Helper Methods
        /// <summary>
        /// Converts the specified managed string into the UTF-8 encoding and
        /// returns the array of bytes containing its representation in that
        /// encoding.
        /// </summary>
        /// <param name="value">
        /// The managed string to convert.
        /// </param>
        /// <returns>
        /// The array of bytes containing the representation of the managed
        /// string in the UTF-8 encoding or null upon failure.
        /// </returns>
        public static byte[] GetUtf8BytesFromString(
            string value
            )
        {
            if (value == null)
                return null;

            return Utf8Encoding.GetBytes(value);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Converts the specified array of bytes representing a string in the
        /// UTF-8 encoding and returns a managed string.
        /// </summary>
        /// <param name="bytes">
        /// The array of bytes to convert.
        /// </param>
        /// <returns>
        /// The managed string or null upon failure.
        /// </returns>
        public static string GetStringFromUtf8Bytes(
            byte[] bytes
            )
        {
            if (bytes == null)
                return null;

#if !PLATFORM_COMPACTFRAMEWORK
            return Utf8Encoding.GetString(bytes);
#else
            return Utf8Encoding.GetString(bytes, 0, bytes.Length);
#endif
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region UTF-8 String Helper Methods
        /// <summary>
        /// Probes a native pointer to a string in the UTF-8 encoding for its
        /// terminating NUL character, within the specified length limit.
        /// </summary>
        /// <param name="pValue">
        /// The native NUL-terminated string pointer.
        /// </param>
        /// <param name="limit">
        /// The maximum length of the native string, in bytes.
        /// </param>
        /// <returns>
        /// The length of the native string, in bytes -OR- zero if the length
        /// could not be determined.
        /// </returns>
        public static int ProbeForUtf8ByteLength(
            IntPtr pValue,
            int limit
            )
        {
            int length = 0;

            if ((pValue != IntPtr.Zero) && (limit > 0))
            {
                do
                {
                    if (Marshal.ReadByte(pValue, length) == 0)
                        break;

                    if (length >= limit)
                        break;

                    length++;
                } while (true);
            }

            return length;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Converts the specified native NUL-terminated UTF-8 string pointer
        /// into a managed string.
        /// </summary>
        /// <param name="pValue">
        /// The native NUL-terminated UTF-8 string pointer.
        /// </param>
        /// <returns>
        /// The managed string or null upon failure.
        /// </returns>
        public static string StringFromUtf8IntPtr(
            IntPtr pValue
            )
        {
            return StringFromUtf8IntPtr(pValue,
                ProbeForUtf8ByteLength(pValue, ThirtyBits));
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Converts the specified native UTF-8 string pointer of the specified
        /// length into a managed string.
        /// </summary>
        /// <param name="pValue">
        /// The native UTF-8 string pointer.
        /// </param>
        /// <param name="length">
        /// The length of the native string, in bytes.
        /// </param>
        /// <returns>
        /// The managed string or null upon failure.
        /// </returns>
        public static string StringFromUtf8IntPtr(
            IntPtr pValue,
            int length
            )
        {
            if (pValue == IntPtr.Zero)
                return null;

            if (length > 0)
            {
                byte[] bytes = new byte[length];

                Marshal.Copy(pValue, bytes, 0, length);

                return GetStringFromUtf8Bytes(bytes);
            }

            return String.Empty;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Converts the specified managed string into a native NUL-terminated
        /// UTF-8 string pointer using memory obtained from the SQLite core
        /// library.
        /// </summary>
        /// <param name="value">
        /// The managed string to convert.
        /// </param>
        /// <returns>
        /// The native NUL-terminated UTF-8 string pointer or
        /// <see cref="IntPtr.Zero" /> upon failure.
        /// </returns>
        public static IntPtr Utf8IntPtrFromString(
            string value
            )
        {
            return Utf8IntPtrFromString(value, true);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Converts the specified managed string into a native NUL-terminated
        /// UTF-8 string pointer using memory obtained from the SQLite core
        /// library.
        /// </summary>
        /// <param name="value">
        /// The managed string to convert.
        /// </param>
        /// <param name="tracked">
        /// Non-zero to obtain memory from the SQLite core library without
        /// adjusting the number of allocated bytes currently being tracked
        /// by the <see cref="SQLiteMemory" /> class.
        /// </param>
        /// <returns>
        /// The native NUL-terminated UTF-8 string pointer or
        /// <see cref="IntPtr.Zero" /> upon failure.
        /// </returns>
        public static IntPtr Utf8IntPtrFromString(
            string value,
            bool tracked
            )
        {
            int length = 0;

            return Utf8IntPtrFromString(value, tracked, ref length);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Converts the specified managed string into a native NUL-terminated
        /// UTF-8 string pointer using memory obtained from the SQLite core
        /// library.
        /// </summary>
        /// <param name="value">
        /// The managed string to convert.
        /// </param>
        /// <param name="length">
        /// The length of the native string, in bytes.
        /// </param>
        /// <returns>
        /// The native NUL-terminated UTF-8 string pointer or
        /// <see cref="IntPtr.Zero" /> upon failure.
        /// </returns>
        public static IntPtr Utf8IntPtrFromString(
            string value,
            ref int length
            )
        {
            return Utf8IntPtrFromString(value, true, ref length);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Converts the specified managed string into a native NUL-terminated
        /// UTF-8 string pointer using memory obtained from the SQLite core
        /// library.
        /// </summary>
        /// <param name="value">
        /// The managed string to convert.
        /// </param>
        /// <param name="tracked">
        /// Non-zero to obtain memory from the SQLite core library without
        /// adjusting the number of allocated bytes currently being tracked
        /// by the <see cref="SQLiteMemory" /> class.
        /// </param>
        /// <param name="length">
        /// The length of the native string, in bytes.
        /// </param>
        /// <returns>
        /// The native NUL-terminated UTF-8 string pointer or
        /// <see cref="IntPtr.Zero" /> upon failure.
        /// </returns>
        public static IntPtr Utf8IntPtrFromString(
            string value,
            bool tracked,
            ref int length
            )
        {
            if (value == null)
                return IntPtr.Zero;

            IntPtr result = IntPtr.Zero;
            byte[] bytes = GetUtf8BytesFromString(value);

            if (bytes == null)
                return IntPtr.Zero;

            length = bytes.Length;

            if (tracked)
                result = SQLiteMemory.Allocate(length + 1);
            else
                result = SQLiteMemory.AllocateUntracked(length + 1);

            if (result == IntPtr.Zero)
                return IntPtr.Zero;

            Marshal.Copy(bytes, 0, result, length);
            Marshal.WriteByte(result, length, 0);

            return result;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region UTF-8 String Array Helper Methods
        /// <summary>
        /// Converts a logical array of native NUL-terminated UTF-8 string
        /// pointers into an array of managed strings.
        /// </summary>
        /// <param name="argc">
        /// The number of elements in the logical array of native
        /// NUL-terminated UTF-8 string pointers.
        /// </param>
        /// <param name="argv">
        /// The native pointer to the logical array of native NUL-terminated
        /// UTF-8 string pointers to convert.
        /// </param>
        /// <returns>
        /// The array of managed strings or null upon failure.
        /// </returns>
        public static string[] StringArrayFromUtf8SizeAndIntPtr(
            int argc,
            IntPtr argv
            )
        {
            if (argc < 0)
                return null;

            if (argv == IntPtr.Zero)
                return null;

            string[] result = new string[argc];

            for (int index = 0, offset = 0;
                    index < result.Length;
                    index++, offset += IntPtr.Size)
            {
                IntPtr pArg = SQLiteMarshal.ReadIntPtr(argv, offset);

                result[index] = (pArg != IntPtr.Zero) ?
                    StringFromUtf8IntPtr(pArg) : null;
            }

            return result;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Converts an array of managed strings into an array of native
        /// NUL-terminated UTF-8 string pointers.
        /// </summary>
        /// <param name="values">
        /// The array of managed strings to convert.
        /// </param>
        /// <param name="tracked">
        /// Non-zero to obtain memory from the SQLite core library without
        /// adjusting the number of allocated bytes currently being tracked
        /// by the <see cref="SQLiteMemory" /> class.
        /// </param>
        /// <returns>
        /// The array of native NUL-terminated UTF-8 string pointers or null
        /// upon failure.
        /// </returns>
        public static IntPtr[] Utf8IntPtrArrayFromStringArray(
            string[] values,
            bool tracked
            )
        {
            if (values == null)
                return null;

            IntPtr[] result = new IntPtr[values.Length];

            for (int index = 0; index < result.Length; index++)
                result[index] = Utf8IntPtrFromString(values[index], tracked);

            return result;
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteBytes Static Class
    /// <summary>
    /// This class contains static methods that are used to deal with native
    /// pointers to memory blocks that logically contain arrays of bytes to be
    /// used with the SQLite core library.
    /// </summary>
    internal static class SQLiteBytes
    {
        #region Byte Array Helper Methods
        /// <summary>
        /// Converts a native pointer to a logical array of bytes of the
        /// specified length into a managed byte array.
        /// </summary>
        /// <param name="pValue">
        /// The native pointer to the logical array of bytes to convert.
        /// </param>
        /// <param name="length">
        /// The length, in bytes, of the logical array of bytes to convert.
        /// </param>
        /// <returns>
        /// The managed byte array or null upon failure.
        /// </returns>
        public static byte[] FromIntPtr(
            IntPtr pValue,
            int length
            )
        {
            if (pValue == IntPtr.Zero)
                return null;

            if (length == 0)
                return new byte[0];

            byte[] result = new byte[length];

            Marshal.Copy(pValue, result, 0, length);

            return result;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Converts a managed byte array into a native pointer to a logical
        /// array of bytes.
        /// </summary>
        /// <param name="value">
        /// The managed byte array to convert.
        /// </param>
        /// <returns>
        /// The native pointer to a logical byte array or null upon failure.
        /// </returns>
        public static IntPtr ToIntPtr(
            byte[] value
            )
        {
            int length = 0;

            return ToIntPtr(value, ref length);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Converts a managed byte array into a native pointer to a logical
        /// array of bytes.
        /// </summary>
        /// <param name="value">
        /// The managed byte array to convert.
        /// </param>
        /// <param name="length">
        /// The length, in bytes, of the converted logical array of bytes.
        /// </param>
        /// <returns>
        /// The native pointer to a logical byte array or null upon failure.
        /// </returns>
        public static IntPtr ToIntPtr(
            byte[] value,
            ref int length
            )
        {
            if (value == null)
                return IntPtr.Zero;

            length = value.Length;

            if (length == 0)
                return IntPtr.Zero;

            IntPtr result = SQLiteMemory.Allocate(length);

            if (result == IntPtr.Zero)
                return IntPtr.Zero;

            Marshal.Copy(value, 0, result, length);

            return result;
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteMarshal Static Class
    /// <summary>
    /// This class contains static methods that are used to perform several
    /// low-level data marshalling tasks between native and managed code.
    /// </summary>
    internal static class SQLiteMarshal
    {
        #region IntPtr Helper Methods
        /// <summary>
        /// Returns a new <see cref="IntPtr" /> object instance based on the
        /// specified <see cref="IntPtr" /> object instance and an integer
        /// offset.
        /// </summary>
        /// <param name="pointer">
        /// The <see cref="IntPtr" /> object instance representing the base
        /// memory location.
        /// </param>
        /// <param name="offset">
        /// The integer offset from the base memory location that the new
        /// <see cref="IntPtr" /> object instance should point to.
        /// </param>
        /// <returns>
        /// The new <see cref="IntPtr" /> object instance.
        /// </returns>
        public static IntPtr IntPtrForOffset(
            IntPtr pointer,
            int offset
            )
        {
            return new IntPtr(pointer.ToInt64() + offset);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Rounds up an integer size to the next multiple of the alignment.
        /// </summary>
        /// <param name="size">
        /// The size, in bytes, to be rounded up.
        /// </param>
        /// <param name="alignment">
        /// The required alignment for the return value.
        /// </param>
        /// <returns>
        /// The size, in bytes, rounded up to the next multiple of the
        /// alignment.  This value may end up being the same as the original
        /// size.
        /// </returns>
        public static int RoundUp(
            int size,
            int alignment
            )
        {
            int alignmentMinusOne = alignment - 1;
            return ((size + alignmentMinusOne) & ~alignmentMinusOne);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Determines the offset, in bytes, of the next structure member.
        /// </summary>
        /// <param name="offset">
        /// The offset, in bytes, of the current structure member.
        /// </param>
        /// <param name="size">
        /// The size, in bytes, of the current structure member.
        /// </param>
        /// <param name="alignment">
        /// The alignment, in bytes, of the next structure member.
        /// </param>
        /// <returns>
        /// The offset, in bytes, of the next structure member.
        /// </returns>
        public static int NextOffsetOf(
            int offset,
            int size,
            int alignment
            )
        {
            return RoundUp(offset + size, alignment);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Marshal Read Helper Methods
        /// <summary>
        /// Reads a <see cref="Int32" /> value from the specified memory
        /// location.
        /// </summary>
        /// <param name="pointer">
        /// The <see cref="IntPtr" /> object instance representing the base
        /// memory location.
        /// </param>
        /// <param name="offset">
        /// The integer offset from the base memory location where the
        /// <see cref="Int32" /> value to be read is located.
        /// </param>
        /// <returns>
        /// The <see cref="Int32" /> value at the specified memory location.
        /// </returns>
        public static int ReadInt32(
            IntPtr pointer,
            int offset
            )
        {
#if DEBUG
            CheckAlignment("ReadInt32", pointer, offset, sizeof(int));
#endif

#if !PLATFORM_COMPACTFRAMEWORK
            return Marshal.ReadInt32(pointer, offset);
#else
            return Marshal.ReadInt32(IntPtrForOffset(pointer, offset));
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Reads a <see cref="Int64" /> value from the specified memory
        /// location.
        /// </summary>
        /// <param name="pointer">
        /// The <see cref="IntPtr" /> object instance representing the base
        /// memory location.
        /// </param>
        /// <param name="offset">
        /// The integer offset from the base memory location where the
        /// <see cref="Int64" /> value to be read is located.
        /// </param>
        /// <returns>
        /// The <see cref="Int64" /> value at the specified memory location.
        /// </returns>
        public static long ReadInt64(
            IntPtr pointer,
            int offset
            )
        {
#if DEBUG
            CheckAlignment("ReadInt64", pointer, offset, sizeof(long));
#endif

#if !PLATFORM_COMPACTFRAMEWORK
            return Marshal.ReadInt64(pointer, offset);
#else
            return Marshal.ReadInt64(IntPtrForOffset(pointer, offset));
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Reads a <see cref="Double" /> value from the specified memory
        /// location.
        /// </summary>
        /// <param name="pointer">
        /// The <see cref="IntPtr" /> object instance representing the base
        /// memory location.
        /// </param>
        /// <param name="offset">
        /// The integer offset from the base memory location where the
        /// <see cref="Double" /> to be read is located.
        /// </param>
        /// <returns>
        /// The <see cref="Double" /> value at the specified memory location.
        /// </returns>
        public static double ReadDouble(
            IntPtr pointer,
            int offset
            )
        {
#if DEBUG
            CheckAlignment("ReadDouble", pointer, offset, sizeof(double));
#endif

#if !PLATFORM_COMPACTFRAMEWORK
            return BitConverter.Int64BitsToDouble(Marshal.ReadInt64(
                pointer, offset));
#else
            return BitConverter.ToDouble(BitConverter.GetBytes(
                Marshal.ReadInt64(IntPtrForOffset(pointer, offset))), 0);
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Reads an <see cref="IntPtr" /> value from the specified memory
        /// location.
        /// </summary>
        /// <param name="pointer">
        /// The <see cref="IntPtr" /> object instance representing the base
        /// memory location.
        /// </param>
        /// <param name="offset">
        /// The integer offset from the base memory location where the
        /// <see cref="IntPtr" /> value to be read is located.
        /// </param>
        /// <returns>
        /// The <see cref="IntPtr" /> value at the specified memory location.
        /// </returns>
        public static IntPtr ReadIntPtr(
            IntPtr pointer,
            int offset
            )
        {
#if DEBUG
            CheckAlignment("ReadIntPtr", pointer, offset, IntPtr.Size);
#endif

#if !PLATFORM_COMPACTFRAMEWORK
            return Marshal.ReadIntPtr(pointer, offset);
#else
            return Marshal.ReadIntPtr(IntPtrForOffset(pointer, offset));
#endif
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Marshal Write Helper Methods
        /// <summary>
        /// Writes an <see cref="Int32" /> value to the specified memory
        /// location.
        /// </summary>
        /// <param name="pointer">
        /// The <see cref="IntPtr" /> object instance representing the base
        /// memory location.
        /// </param>
        /// <param name="offset">
        /// The integer offset from the base memory location where the
        /// <see cref="Int32" /> value to be written is located.
        /// </param>
        /// <param name="value">
        /// The <see cref="Int32" /> value to write.
        /// </param>
        public static void WriteInt32(
            IntPtr pointer,
            int offset,
            int value
            )
        {
#if DEBUG
            CheckAlignment("WriteInt32", pointer, offset, sizeof(int));
#endif

#if !PLATFORM_COMPACTFRAMEWORK
            Marshal.WriteInt32(pointer, offset, value);
#else
            Marshal.WriteInt32(IntPtrForOffset(pointer, offset), value);
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Writes an <see cref="Int64" /> value to the specified memory
        /// location.
        /// </summary>
        /// <param name="pointer">
        /// The <see cref="IntPtr" /> object instance representing the base
        /// memory location.
        /// </param>
        /// <param name="offset">
        /// The integer offset from the base memory location where the
        /// <see cref="Int64" /> value to be written is located.
        /// </param>
        /// <param name="value">
        /// The <see cref="Int64" /> value to write.
        /// </param>
        public static void WriteInt64(
            IntPtr pointer,
            int offset,
            long value
            )
        {
#if DEBUG
            CheckAlignment("WriteInt64", pointer, offset, sizeof(long));
#endif

#if !PLATFORM_COMPACTFRAMEWORK
            Marshal.WriteInt64(pointer, offset, value);
#else
            Marshal.WriteInt64(IntPtrForOffset(pointer, offset), value);
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Writes a <see cref="Double" /> value to the specified memory
        /// location.
        /// </summary>
        /// <param name="pointer">
        /// The <see cref="IntPtr" /> object instance representing the base
        /// memory location.
        /// </param>
        /// <param name="offset">
        /// The integer offset from the base memory location where the
        /// <see cref="Double" /> value to be written is located.
        /// </param>
        /// <param name="value">
        /// The <see cref="Double" /> value to write.
        /// </param>
        public static void WriteDouble(
            IntPtr pointer,
            int offset,
            double value
            )
        {
#if DEBUG
            CheckAlignment("WriteDouble", pointer, offset, sizeof(double));
#endif

#if !PLATFORM_COMPACTFRAMEWORK
            Marshal.WriteInt64(pointer, offset,
                BitConverter.DoubleToInt64Bits(value));
#else
            Marshal.WriteInt64(IntPtrForOffset(pointer, offset),
                BitConverter.ToInt64(BitConverter.GetBytes(value), 0));
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Writes a <see cref="IntPtr" /> value to the specified memory
        /// location.
        /// </summary>
        /// <param name="pointer">
        /// The <see cref="IntPtr" /> object instance representing the base
        /// memory location.
        /// </param>
        /// <param name="offset">
        /// The integer offset from the base memory location where the
        /// <see cref="IntPtr" /> value to be written is located.
        /// </param>
        /// <param name="value">
        /// The <see cref="IntPtr" /> value to write.
        /// </param>
        public static void WriteIntPtr(
            IntPtr pointer,
            int offset,
            IntPtr value
            )
        {
#if DEBUG
            CheckAlignment(
                "WriteIntPtr(pointer)", pointer, offset, IntPtr.Size);

            CheckAlignment("WriteIntPtr(value)", value, 0, IntPtr.Size);
#endif

#if !PLATFORM_COMPACTFRAMEWORK
            Marshal.WriteIntPtr(pointer, offset, value);
#else
            Marshal.WriteIntPtr(IntPtrForOffset(pointer, offset), value);
#endif
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Object Helper Methods
        /// <summary>
        /// Generates a hash code value for the object.
        /// </summary>
        /// <param name="value">
        /// The object instance used to calculate the hash code.
        /// </param>
        /// <param name="identity">
        /// Non-zero if different object instances with the same value should
        /// generate different hash codes, where applicable.  This parameter
        /// has no effect on the .NET Compact Framework.
        /// </param>
        /// <returns>
        /// The hash code value -OR- zero if the object is null.
        /// </returns>
        public static int GetHashCode(
            object value,
            bool identity
            )
        {
#if !PLATFORM_COMPACTFRAMEWORK
            if (identity)
                return RuntimeHelpers.GetHashCode(value);
#endif

            if (value == null) return 0;
            return value.GetHashCode();
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Methods
#if DEBUG
        /// <summary>
        /// Attempts to verify that the specified native pointer is properly
        /// aligned for the size of the data value.  If that is not the case,
        /// a message will be sent to the logging subsystem.
        /// </summary>
        /// <param name="type">
        /// The type of operation being performed by the caller.  This value
        /// may be used within diagnostic messages.
        /// </param>
        /// <param name="pointer">
        /// The <see cref="IntPtr" /> object instance representing the base
        /// memory location.
        /// </param>
        /// <param name="offset">
        /// The integer offset from the base memory location where the data
        /// value to be read or written.
        /// </param>
        /// <param name="size">
        /// The size, in bytes, of the data value.
        /// </param>
        internal static void CheckAlignment(
            string type,
            IntPtr pointer,
            int offset,
            int size
            )
        {
            IntPtr savedPointer = pointer;

            if (offset != 0)
                pointer = new IntPtr(pointer.ToInt64() + offset);

            if ((pointer.ToInt64() % size) != 0)
            {
                SQLiteLog.LogMessage(SQLiteErrorCode.Warning,
                    HelperMethods.StringFormat(CultureInfo.CurrentCulture,
                    "{0}: pointer {1} and offset {2} not aligned to {3}: {4}",
                    type, savedPointer, offset, size,
#if !PLATFORM_COMPACTFRAMEWORK
                    Environment.StackTrace
#else
                    null
#endif
                    ));
            }
        }
#endif
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteModule Base Class
    /// <summary>
    /// This class represents a managed virtual table module implementation.
    /// It is not sealed and must be used as the base class for any
    /// user-defined virtual table module classes implemented in managed code.
    /// </summary>
    public abstract class SQLiteModule :
            ISQLiteManagedModule, /*ISQLiteNativeModule,*/
            IDisposable /* NOT SEALED */
    {
        #region SQLiteNativeModule Private Class
        /// <summary>
        /// This class implements the <see cref="ISQLiteNativeModule" />
        /// interface by forwarding those method calls to the
        /// <see cref="SQLiteModule" /> object instance it contains.  If the
        /// contained <see cref="SQLiteModule" /> object instance is null, all
        /// the <see cref="ISQLiteNativeModule" /> methods simply generate an
        /// error.
        /// </summary>
        private sealed class SQLiteNativeModule :
                ISQLiteNativeModule, IDisposable
        {
            #region Private Constants
            /// <summary>
            /// This is the value that is always used for the "logErrors"
            /// parameter to the various static error handling methods provided
            /// by the <see cref="SQLiteModule" /> class.
            /// </summary>
            private const bool DefaultLogErrors = true;

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// This is the value that is always used for the "logExceptions"
            /// parameter to the various static error handling methods provided
            /// by the <see cref="SQLiteModule" /> class.
            /// </summary>
            private const bool DefaultLogExceptions = true;

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// This is the error message text used when the contained
            /// <see cref="SQLiteModule" /> object instance is not available
            /// for any reason.
            /// </summary>
            private const string ModuleNotAvailableErrorMessage =
                "native module implementation not available";
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Private Data
            /// <summary>
            /// The <see cref="SQLiteModule" /> object instance used to provide
            /// an implementation of the <see cref="ISQLiteNativeModule" />
            /// interface.
            /// </summary>
            private SQLiteModule module;
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Constructors
            /// <summary>
            /// Constructs an instance of this class.
            /// </summary>
            /// <param name="module">
            /// The <see cref="SQLiteModule" /> object instance used to provide
            /// an implementation of the <see cref="ISQLiteNativeModule" />
            /// interface.
            /// </param>
            public SQLiteNativeModule(
                SQLiteModule module
                )
            {
                this.module = module;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Private Static Methods
            /// <summary>
            /// Sets the table error message to one that indicates the native
            /// module implementation is not available.
            /// </summary>
            /// <param name="pVtab">
            /// The native pointer to the sqlite3_vtab derived structure.
            /// </param>
            /// <returns>
            /// The value of <see cref="SQLiteErrorCode.Error" />.
            /// </returns>
            private static SQLiteErrorCode ModuleNotAvailableTableError(
                IntPtr pVtab
                )
            {
                SetTableError(null, pVtab, DefaultLogErrors,
                    DefaultLogExceptions, ModuleNotAvailableErrorMessage);

                return SQLiteErrorCode.Error;
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// Sets the table error message to one that indicates the native
            /// module implementation is not available.
            /// </summary>
            /// <param name="pCursor">
            /// The native pointer to the sqlite3_vtab_cursor derived
            /// structure.
            /// </param>
            /// <returns>
            /// The value of <see cref="SQLiteErrorCode.Error" />.
            /// </returns>
            private static SQLiteErrorCode ModuleNotAvailableCursorError(
                IntPtr pCursor
                )
            {
                SetCursorError(null, pCursor, DefaultLogErrors,
                    DefaultLogExceptions, ModuleNotAvailableErrorMessage);

                return SQLiteErrorCode.Error;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region ISQLiteNativeModule Members
            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xCreate" /> method.
            /// </summary>
            /// <param name="pDb">
            /// See the <see cref="ISQLiteNativeModule.xCreate" /> method.
            /// </param>
            /// <param name="pAux">
            /// See the <see cref="ISQLiteNativeModule.xCreate" /> method.
            /// </param>
            /// <param name="argc">
            /// See the <see cref="ISQLiteNativeModule.xCreate" /> method.
            /// </param>
            /// <param name="argv">
            /// See the <see cref="ISQLiteNativeModule.xCreate" /> method.
            /// </param>
            /// <param name="pVtab">
            /// See the <see cref="ISQLiteNativeModule.xCreate" /> method.
            /// </param>
            /// <param name="pError">
            /// See the <see cref="ISQLiteNativeModule.xCreate" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xCreate" /> method.
            /// </returns>
            public SQLiteErrorCode xCreate(
                IntPtr pDb,
                IntPtr pAux,
                int argc,
                IntPtr argv,
                ref IntPtr pVtab,
                ref IntPtr pError
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                {
                    pError = SQLiteString.Utf8IntPtrFromString(
                        ModuleNotAvailableErrorMessage);

                    return SQLiteErrorCode.Error;
                }

                return module.xCreate(
                    pDb, pAux, argc, argv, ref pVtab, ref pError);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xConnect" /> method.
            /// </summary>
            /// <param name="pDb">
            /// See the <see cref="ISQLiteNativeModule.xConnect" /> method.
            /// </param>
            /// <param name="pAux">
            /// See the <see cref="ISQLiteNativeModule.xConnect" /> method.
            /// </param>
            /// <param name="argc">
            /// See the <see cref="ISQLiteNativeModule.xConnect" /> method.
            /// </param>
            /// <param name="argv">
            /// See the <see cref="ISQLiteNativeModule.xConnect" /> method.
            /// </param>
            /// <param name="pVtab">
            /// See the <see cref="ISQLiteNativeModule.xConnect" /> method.
            /// </param>
            /// <param name="pError">
            /// See the <see cref="ISQLiteNativeModule.xConnect" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xConnect" /> method.
            /// </returns>
            public SQLiteErrorCode xConnect(
                IntPtr pDb,
                IntPtr pAux,
                int argc,
                IntPtr argv,
                ref IntPtr pVtab,
                ref IntPtr pError
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                {
                    pError = SQLiteString.Utf8IntPtrFromString(
                        ModuleNotAvailableErrorMessage);

                    return SQLiteErrorCode.Error;
                }

                return module.xConnect(
                    pDb, pAux, argc, argv, ref pVtab, ref pError);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xBestIndex" /> method.
            /// </summary>
            /// <param name="pVtab">
            /// See the <see cref="ISQLiteNativeModule.xBestIndex" /> method.
            /// </param>
            /// <param name="pIndex">
            /// See the <see cref="ISQLiteNativeModule.xBestIndex" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xBestIndex" /> method.
            /// </returns>
            public SQLiteErrorCode xBestIndex(
                IntPtr pVtab,
                IntPtr pIndex
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                    return ModuleNotAvailableTableError(pVtab);

                return module.xBestIndex(pVtab, pIndex);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xDisconnect" /> method.
            /// </summary>
            /// <param name="pVtab">
            /// See the <see cref="ISQLiteNativeModule.xDisconnect" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xDisconnect" /> method.
            /// </returns>
            public SQLiteErrorCode xDisconnect(
                IntPtr pVtab
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                    return ModuleNotAvailableTableError(pVtab);

                return module.xDisconnect(pVtab);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xDestroy" /> method.
            /// </summary>
            /// <param name="pVtab">
            /// See the <see cref="ISQLiteNativeModule.xDestroy" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xDestroy" /> method.
            /// </returns>
            public SQLiteErrorCode xDestroy(
                IntPtr pVtab
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                    return ModuleNotAvailableTableError(pVtab);

                return module.xDestroy(pVtab);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xOpen" /> method.
            /// </summary>
            /// <param name="pVtab">
            /// See the <see cref="ISQLiteNativeModule.xOpen" /> method.
            /// </param>
            /// <param name="pCursor">
            /// See the <see cref="ISQLiteNativeModule.xOpen" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xOpen" /> method.
            /// </returns>
            public SQLiteErrorCode xOpen(
                IntPtr pVtab,
                ref IntPtr pCursor
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                    return ModuleNotAvailableTableError(pVtab);

                return module.xOpen(pVtab, ref pCursor);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xClose" /> method.
            /// </summary>
            /// <param name="pCursor">
            /// See the <see cref="ISQLiteNativeModule.xClose" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xClose" /> method.
            /// </returns>
            public SQLiteErrorCode xClose(
                IntPtr pCursor
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                    return ModuleNotAvailableCursorError(pCursor);

                return module.xClose(pCursor);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xFilter" /> method.
            /// </summary>
            /// <param name="pCursor">
            /// See the <see cref="ISQLiteNativeModule.xFilter" /> method.
            /// </param>
            /// <param name="idxNum">
            /// See the <see cref="ISQLiteNativeModule.xFilter" /> method.
            /// </param>
            /// <param name="idxStr">
            /// See the <see cref="ISQLiteNativeModule.xFilter" /> method.
            /// </param>
            /// <param name="argc">
            /// See the <see cref="ISQLiteNativeModule.xFilter" /> method.
            /// </param>
            /// <param name="argv">
            /// See the <see cref="ISQLiteNativeModule.xFilter" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xFilter" /> method.
            /// </returns>
            public SQLiteErrorCode xFilter(
                IntPtr pCursor,
                int idxNum,
                IntPtr idxStr,
                int argc,
                IntPtr argv
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                    return ModuleNotAvailableCursorError(pCursor);

                return module.xFilter(pCursor, idxNum, idxStr, argc, argv);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xNext" /> method.
            /// </summary>
            /// <param name="pCursor">
            /// See the <see cref="ISQLiteNativeModule.xNext" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xNext" /> method.
            /// </returns>
            public SQLiteErrorCode xNext(
                IntPtr pCursor
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                    return ModuleNotAvailableCursorError(pCursor);

                return module.xNext(pCursor);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xEof" /> method.
            /// </summary>
            /// <param name="pCursor">
            /// See the <see cref="ISQLiteNativeModule.xEof" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xEof" /> method.
            /// </returns>
            public int xEof(
                IntPtr pCursor
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                {
                    ModuleNotAvailableCursorError(pCursor);
                    return 1;
                }

                return module.xEof(pCursor);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xColumn" /> method.
            /// </summary>
            /// <param name="pCursor">
            /// See the <see cref="ISQLiteNativeModule.xColumn" /> method.
            /// </param>
            /// <param name="pContext">
            /// See the <see cref="ISQLiteNativeModule.xColumn" /> method.
            /// </param>
            /// <param name="index">
            /// See the <see cref="ISQLiteNativeModule.xColumn" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xColumn" /> method.
            /// </returns>
            public SQLiteErrorCode xColumn(
                IntPtr pCursor,
                IntPtr pContext,
                int index
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                    return ModuleNotAvailableCursorError(pCursor);

                return module.xColumn(pCursor, pContext, index);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xRowId" /> method.
            /// </summary>
            /// <param name="pCursor">
            /// See the <see cref="ISQLiteNativeModule.xRowId" /> method.
            /// </param>
            /// <param name="rowId">
            /// See the <see cref="ISQLiteNativeModule.xRowId" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xRowId" /> method.
            /// </returns>
            public SQLiteErrorCode xRowId(
                IntPtr pCursor,
                ref long rowId
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                    return ModuleNotAvailableCursorError(pCursor);

                return module.xRowId(pCursor, ref rowId);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xUpdate" /> method.
            /// </summary>
            /// <param name="pVtab">
            /// See the <see cref="ISQLiteNativeModule.xUpdate" /> method.
            /// </param>
            /// <param name="argc">
            /// See the <see cref="ISQLiteNativeModule.xUpdate" /> method.
            /// </param>
            /// <param name="argv">
            /// See the <see cref="ISQLiteNativeModule.xUpdate" /> method.
            /// </param>
            /// <param name="rowId">
            /// See the <see cref="ISQLiteNativeModule.xUpdate" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xUpdate" /> method.
            /// </returns>
            public SQLiteErrorCode xUpdate(
                IntPtr pVtab,
                int argc,
                IntPtr argv,
                ref long rowId
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                    return ModuleNotAvailableTableError(pVtab);

                return module.xUpdate(pVtab, argc, argv, ref rowId);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xBegin" /> method.
            /// </summary>
            /// <param name="pVtab">
            /// See the <see cref="ISQLiteNativeModule.xBegin" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xBegin" /> method.
            /// </returns>
            public SQLiteErrorCode xBegin(
                IntPtr pVtab
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                    return ModuleNotAvailableTableError(pVtab);

                return module.xBegin(pVtab);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xSync" /> method.
            /// </summary>
            /// <param name="pVtab">
            /// See the <see cref="ISQLiteNativeModule.xSync" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xSync" /> method.
            /// </returns>
            public SQLiteErrorCode xSync(
                IntPtr pVtab
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                    return ModuleNotAvailableTableError(pVtab);

                return module.xSync(pVtab);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xCommit" /> method.
            /// </summary>
            /// <param name="pVtab">
            /// See the <see cref="ISQLiteNativeModule.xCommit" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xCommit" /> method.
            /// </returns>
            public SQLiteErrorCode xCommit(
                IntPtr pVtab
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                    return ModuleNotAvailableTableError(pVtab);

                return module.xCommit(pVtab);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xRollback" /> method.
            /// </summary>
            /// <param name="pVtab">
            /// See the <see cref="ISQLiteNativeModule.xRollback" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xRollback" /> method.
            /// </returns>
            public SQLiteErrorCode xRollback(
                IntPtr pVtab
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                    return ModuleNotAvailableTableError(pVtab);

                return module.xRollback(pVtab);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xFindFunction" /> method.
            /// </summary>
            /// <param name="pVtab">
            /// See the <see cref="ISQLiteNativeModule.xFindFunction" /> method.
            /// </param>
            /// <param name="nArg">
            /// See the <see cref="ISQLiteNativeModule.xFindFunction" /> method.
            /// </param>
            /// <param name="zName">
            /// See the <see cref="ISQLiteNativeModule.xFindFunction" /> method.
            /// </param>
            /// <param name="callback">
            /// See the <see cref="ISQLiteNativeModule.xFindFunction" /> method.
            /// </param>
            /// <param name="pClientData">
            /// See the <see cref="ISQLiteNativeModule.xFindFunction" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xFindFunction" /> method.
            /// </returns>
            public int xFindFunction(
                IntPtr pVtab,
                int nArg,
                IntPtr zName,
                ref SQLiteCallback callback,
                ref IntPtr pClientData
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                {
                    ModuleNotAvailableTableError(pVtab);
                    return 0;
                }

                return module.xFindFunction(
                    pVtab, nArg, zName, ref callback, ref pClientData);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xRename" /> method.
            /// </summary>
            /// <param name="pVtab">
            /// See the <see cref="ISQLiteNativeModule.xRename" /> method.
            /// </param>
            /// <param name="zNew">
            /// See the <see cref="ISQLiteNativeModule.xRename" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xRename" /> method.
            /// </returns>
            public SQLiteErrorCode xRename(
                IntPtr pVtab,
                IntPtr zNew
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                    return ModuleNotAvailableTableError(pVtab);

                return module.xRename(pVtab, zNew);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xSavepoint" /> method.
            /// </summary>
            /// <param name="pVtab">
            /// See the <see cref="ISQLiteNativeModule.xSavepoint" /> method.
            /// </param>
            /// <param name="iSavepoint">
            /// See the <see cref="ISQLiteNativeModule.xSavepoint" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xSavepoint" /> method.
            /// </returns>
            public SQLiteErrorCode xSavepoint(
                IntPtr pVtab,
                int iSavepoint
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                    return ModuleNotAvailableTableError(pVtab);

                return module.xSavepoint(pVtab, iSavepoint);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xRelease" /> method.
            /// </summary>
            /// <param name="pVtab">
            /// See the <see cref="ISQLiteNativeModule.xRelease" /> method.
            /// </param>
            /// <param name="iSavepoint">
            /// See the <see cref="ISQLiteNativeModule.xRelease" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xRelease" /> method.
            /// </returns>
            public SQLiteErrorCode xRelease(
                IntPtr pVtab,
                int iSavepoint
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                    return ModuleNotAvailableTableError(pVtab);

                return module.xRelease(pVtab, iSavepoint);
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// See the <see cref="ISQLiteNativeModule.xRollbackTo" /> method.
            /// </summary>
            /// <param name="pVtab">
            /// See the <see cref="ISQLiteNativeModule.xRollbackTo" /> method.
            /// </param>
            /// <param name="iSavepoint">
            /// See the <see cref="ISQLiteNativeModule.xRollbackTo" /> method.
            /// </param>
            /// <returns>
            /// See the <see cref="ISQLiteNativeModule.xRollbackTo" /> method.
            /// </returns>
            public SQLiteErrorCode xRollbackTo(
                IntPtr pVtab,
                int iSavepoint
                )
            {
                //
                // NOTE: Called by native code.
                //
                // CheckDisposed(); /* EXEMPT */

                if (module == null)
                    return ModuleNotAvailableTableError(pVtab);

                return module.xRollbackTo(pVtab, iSavepoint);
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region IDisposable Members
            /// <summary>
            /// Disposes of this object instance.
            /// </summary>
            public void Dispose()
            {
                Dispose(true);
                GC.SuppressFinalize(this);
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region IDisposable "Pattern" Members
            private bool disposed;
            /// <summary>
            /// Throws an <see cref="ObjectDisposedException" /> if this object
            /// instance has been disposed.
            /// </summary>
            private void CheckDisposed() /* throw */
            {
#if THROW_ON_DISPOSED
                if (disposed)
                {
                    throw new ObjectDisposedException(
                        typeof(SQLiteNativeModule).Name);
                }
#endif
            }

            ///////////////////////////////////////////////////////////////////

            /// <summary>
            /// Disposes of this object instance.
            /// </summary>
            /// <param name="disposing">
            /// Non-zero if this method is being called from the
            /// <see cref="Dispose()" /> method.  Zero if this method is being
            /// called from the finalizer.
            /// </param>
            private /* protected virtual */ void Dispose(bool disposing)
            {
                if (!disposed)
                {
                    //if (disposing)
                    //{
                    //    ////////////////////////////////////
                    //    // dispose managed resources here...
                    //    ////////////////////////////////////
                    //}

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////

                    //
                    // NOTE: The module is not owned by us; therefore, do not
                    //       dispose it.
                    //
                    if (module != null)
                        module = null;

                    disposed = true;
                }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Destructor
            /// <summary>
            /// Finalizes this object instance.
            /// </summary>
            ~SQLiteNativeModule()
            {
                Dispose(false);
            }
            #endregion
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Constants
        /// <summary>
        /// The default version of the native sqlite3_module structure in use.
        /// </summary>
        private static readonly int DefaultModuleVersion = 2;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Data
        /// <summary>
        /// This field is used to store the native sqlite3_module structure
        /// associated with this object instance.
        /// </summary>
        private UnsafeNativeMethods.sqlite3_module nativeModule;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This field is used to store the destructor delegate to be passed to
        /// the SQLite core library via the sqlite3_create_disposable_module()
        /// function.
        /// </summary>
        private UnsafeNativeMethods.xDestroyModule destroyModule;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This field is used to store a pointer to the native sqlite3_module
        /// structure returned by the sqlite3_create_disposable_module
        /// function.
        /// </summary>
        private IntPtr disposableModule;

        ///////////////////////////////////////////////////////////////////////

#if PLATFORM_COMPACTFRAMEWORK
        /// <summary>
        /// This field is used to hold the block of native memory that contains
        /// the native sqlite3_module structure associated with this object
        /// instance when running on the .NET Compact Framework.
        /// </summary>
        private IntPtr pNativeModule;
#endif

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This field is used to store the virtual table instances associated
        /// with this module.  The native pointer to the sqlite3_vtab derived
        /// structure is used to key into this collection.
        /// </summary>
        private Dictionary<IntPtr, SQLiteVirtualTable> tables;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This field is used to store the virtual table cursor instances
        /// associated with this module.  The native pointer to the
        /// sqlite3_vtab_cursor derived structure is used to key into this
        /// collection.
        /// </summary>
        private Dictionary<IntPtr, SQLiteVirtualTableCursor> cursors;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This field is used to store the virtual table function instances
        /// associated with this module.  The case-insensitive function name
        /// and the number of arguments (with -1 meaning "any") are used to
        /// construct the string that is used to key into this collection.
        /// </summary>
        private Dictionary<string, SQLiteFunction> functions;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        /// <summary>
        /// Constructs an instance of this class.
        /// </summary>
        /// <param name="name">
        /// The name of the module.  This parameter cannot be null.
        /// </param>
        public SQLiteModule(string name)
        {
            if (name == null)
                throw new ArgumentNullException("name");

            this.name = name;
            this.tables = new Dictionary<IntPtr, SQLiteVirtualTable>();
            this.cursors = new Dictionary<IntPtr, SQLiteVirtualTableCursor>();
            this.functions = new Dictionary<string, SQLiteFunction>();
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Internal Methods
        /// <summary>
        /// Calls the native SQLite core library in order to create a new
        /// disposable module containing the implementation of a virtual table.
        /// </summary>
        /// <param name="pDb">
        /// The native database connection pointer to use.
        /// </param>
        /// <returns>
        /// Non-zero upon success.
        /// </returns>
        internal bool CreateDisposableModule(
            IntPtr pDb
            )
        {
            if (disposableModule != IntPtr.Zero)
                return true;

            IntPtr pName = IntPtr.Zero;

            try
            {
                pName = SQLiteString.Utf8IntPtrFromString(name);

                UnsafeNativeMethods.sqlite3_module nativeModule =
                    AllocateNativeModule();

                destroyModule = new UnsafeNativeMethods.xDestroyModule(
                    xDestroyModule);

#if !PLATFORM_COMPACTFRAMEWORK
                disposableModule =
                    UnsafeNativeMethods.sqlite3_create_disposable_module(
                        pDb, pName, ref nativeModule, IntPtr.Zero, destroyModule);

                return (disposableModule != IntPtr.Zero);
#elif !SQLITE_STANDARD
                disposableModule =
                    UnsafeNativeMethods.sqlite3_create_disposable_module_interop(
                       pDb, pName, AllocateNativeModuleInterop(),
                       nativeModule.iVersion, nativeModule.xCreate,
                       nativeModule.xConnect, nativeModule.xBestIndex,
                       nativeModule.xDisconnect, nativeModule.xDestroy,
                       nativeModule.xOpen, nativeModule.xClose,
                       nativeModule.xFilter, nativeModule.xNext,
                       nativeModule.xEof, nativeModule.xColumn,
                       nativeModule.xRowId, nativeModule.xUpdate,
                       nativeModule.xBegin, nativeModule.xSync,
                       nativeModule.xCommit, nativeModule.xRollback,
                       nativeModule.xFindFunction, nativeModule.xRename,
                       nativeModule.xSavepoint, nativeModule.xRelease,
                       nativeModule.xRollbackTo, IntPtr.Zero, destroyModule);

                return (disposableModule != IntPtr.Zero);
#else
                throw new NotImplementedException();
#endif
            }
            finally
            {
                if (pName != IntPtr.Zero)
                {
                    SQLiteMemory.Free(pName);
                    pName = IntPtr.Zero;
                }
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Methods
        /// <summary>
        /// This method is called by the SQLite core library when the native
        /// module associated with this object instance is being destroyed due
        /// to its parent connection being closed.  It may also be called by
        /// the "vtshim" module if/when the sqlite3_dispose_module() function
        /// is called.
        /// </summary>
        /// <param name="pClientData">
        /// The native user-data pointer associated with this module, as it was
        /// provided to the SQLite core library when the native module instance
        /// was created.
        /// </param>
        private void xDestroyModule(
            IntPtr pClientData /* NOT USED */
            )
        {
            //
            // NOTE: At this point, just make sure that this native module
            //       handle is not reused, nor passed into the native
            //       sqlite3_dispose_module() function later (i.e. if/when
            //       the Dispose() method of this object instance is called).
            //
            disposableModule = IntPtr.Zero;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Creates and returns the native sqlite_module structure using the
        /// configured (or default) <see cref="ISQLiteNativeModule" />
        /// interface implementation.
        /// </summary>
        /// <returns>
        /// The native sqlite_module structure using the configured (or
        /// default) <see cref="ISQLiteNativeModule" /> interface
        /// implementation.
        /// </returns>
        private UnsafeNativeMethods.sqlite3_module AllocateNativeModule()
        {
            return AllocateNativeModule(GetNativeModuleImpl());
        }

        ///////////////////////////////////////////////////////////////////////

#if PLATFORM_COMPACTFRAMEWORK
        /// <summary>
        /// Creates and returns a memory block obtained from the SQLite core
        /// library used to store the native sqlite3_module structure for this
        /// object instance when running on the .NET Compact Framework.
        /// </summary>
        /// <returns>
        /// The native pointer to the native sqlite3_module structure.
        /// </returns>
        private IntPtr AllocateNativeModuleInterop()
        {
            if (pNativeModule == IntPtr.Zero)
            {
                //
                // HACK: No easy way to determine the size of the native
                //       sqlite_module structure when running on the .NET
                //       Compact Framework; therefore, just base the size
                //       on what we know:
                //
                //       There is one integer member.
                //       There are 22 function pointer members.
                //
                pNativeModule = SQLiteMemory.Allocate(23 * IntPtr.Size);

                if (pNativeModule == IntPtr.Zero)
                    throw new OutOfMemoryException("sqlite3_module");
            }

            return pNativeModule;
        }
#endif

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Creates and returns the native sqlite_module structure using the
        /// specified <see cref="ISQLiteNativeModule" /> interface
        /// implementation.
        /// </summary>
        /// <param name="module">
        /// The <see cref="ISQLiteNativeModule" /> interface implementation to
        /// use.
        /// </param>
        /// <returns>
        /// The native sqlite_module structure using the specified
        /// <see cref="ISQLiteNativeModule" /> interface implementation.
        /// </returns>
        private UnsafeNativeMethods.sqlite3_module AllocateNativeModule(
            ISQLiteNativeModule module
            )
        {
            nativeModule = new UnsafeNativeMethods.sqlite3_module();
            nativeModule.iVersion = DefaultModuleVersion;

            if (module != null)
            {
                nativeModule.xCreate = new UnsafeNativeMethods.xCreate(
                   module.xCreate);

                nativeModule.xConnect = new UnsafeNativeMethods.xConnect(
                    module.xConnect);

                nativeModule.xBestIndex = new UnsafeNativeMethods.xBestIndex(
                    module.xBestIndex);

                nativeModule.xDisconnect = new UnsafeNativeMethods.xDisconnect(
                    module.xDisconnect);

                nativeModule.xDestroy = new UnsafeNativeMethods.xDestroy(
                    module.xDestroy);

                nativeModule.xOpen = new UnsafeNativeMethods.xOpen(
                    module.xOpen);

                nativeModule.xClose = new UnsafeNativeMethods.xClose(
                    module.xClose);

                nativeModule.xFilter = new UnsafeNativeMethods.xFilter(
                    module.xFilter);

                nativeModule.xNext = new UnsafeNativeMethods.xNext(
                    module.xNext);

                nativeModule.xEof = new UnsafeNativeMethods.xEof(module.xEof);

                nativeModule.xColumn = new UnsafeNativeMethods.xColumn(
                    module.xColumn);

                nativeModule.xRowId = new UnsafeNativeMethods.xRowId(
                    module.xRowId);

                nativeModule.xUpdate = new UnsafeNativeMethods.xUpdate(
                    module.xUpdate);

                nativeModule.xBegin = new UnsafeNativeMethods.xBegin(
                    module.xBegin);

                nativeModule.xSync = new UnsafeNativeMethods.xSync(
                    module.xSync);

                nativeModule.xCommit = new UnsafeNativeMethods.xCommit(
                    module.xCommit);

                nativeModule.xRollback = new UnsafeNativeMethods.xRollback(
                    module.xRollback);

                nativeModule.xFindFunction = new UnsafeNativeMethods.xFindFunction(
                    module.xFindFunction);

                nativeModule.xRename = new UnsafeNativeMethods.xRename(
                    module.xRename);

                nativeModule.xSavepoint = new UnsafeNativeMethods.xSavepoint(
                    module.xSavepoint);

                nativeModule.xRelease = new UnsafeNativeMethods.xRelease(
                    module.xRelease);

                nativeModule.xRollbackTo = new UnsafeNativeMethods.xRollbackTo(
                    module.xRollbackTo);
            }
            else
            {
                nativeModule.xCreate = new UnsafeNativeMethods.xCreate(
                    xCreate);

                nativeModule.xConnect = new UnsafeNativeMethods.xConnect(
                    xConnect);

                nativeModule.xBestIndex = new UnsafeNativeMethods.xBestIndex(
                    xBestIndex);

                nativeModule.xDisconnect = new UnsafeNativeMethods.xDisconnect(
                    xDisconnect);

                nativeModule.xDestroy = new UnsafeNativeMethods.xDestroy(
                    xDestroy);

                nativeModule.xOpen = new UnsafeNativeMethods.xOpen(xOpen);
                nativeModule.xClose = new UnsafeNativeMethods.xClose(xClose);

                nativeModule.xFilter = new UnsafeNativeMethods.xFilter(
                    xFilter);

                nativeModule.xNext = new UnsafeNativeMethods.xNext(xNext);
                nativeModule.xEof = new UnsafeNativeMethods.xEof(xEof);

                nativeModule.xColumn = new UnsafeNativeMethods.xColumn(
                    xColumn);

                nativeModule.xRowId = new UnsafeNativeMethods.xRowId(xRowId);

                nativeModule.xUpdate = new UnsafeNativeMethods.xUpdate(
                    xUpdate);

                nativeModule.xBegin = new UnsafeNativeMethods.xBegin(xBegin);
                nativeModule.xSync = new UnsafeNativeMethods.xSync(xSync);

                nativeModule.xCommit = new UnsafeNativeMethods.xCommit(
                    xCommit);

                nativeModule.xRollback = new UnsafeNativeMethods.xRollback(
                    xRollback);

                nativeModule.xFindFunction = new UnsafeNativeMethods.xFindFunction(
                    xFindFunction);

                nativeModule.xRename = new UnsafeNativeMethods.xRename(
                    xRename);

                nativeModule.xSavepoint = new UnsafeNativeMethods.xSavepoint(
                    xSavepoint);

                nativeModule.xRelease = new UnsafeNativeMethods.xRelease(
                    xRelease);

                nativeModule.xRollbackTo = new UnsafeNativeMethods.xRollbackTo(
                    xRollbackTo);
            }

            return nativeModule;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Creates a copy of the specified
        /// <see cref="UnsafeNativeMethods.sqlite3_module" /> object instance,
        /// using default implementations for the contained delegates when
        /// necessary.
        /// </summary>
        /// <param name="module">
        /// The <see cref="UnsafeNativeMethods.sqlite3_module" /> object
        /// instance to copy.
        /// </param>
        /// <returns>
        /// The new <see cref="UnsafeNativeMethods.sqlite3_module" /> object
        /// instance.
        /// </returns>
        private UnsafeNativeMethods.sqlite3_module CopyNativeModule(
            UnsafeNativeMethods.sqlite3_module module
            )
        {
            UnsafeNativeMethods.sqlite3_module newModule =
                new UnsafeNativeMethods.sqlite3_module();

            newModule.iVersion = module.iVersion;

            newModule.xCreate = new UnsafeNativeMethods.xCreate(
                (module.xCreate != null) ? module.xCreate : xCreate);

            newModule.xConnect = new UnsafeNativeMethods.xConnect(
                (module.xConnect != null) ? module.xConnect : xConnect);

            newModule.xBestIndex = new UnsafeNativeMethods.xBestIndex(
                (module.xBestIndex != null) ? module.xBestIndex : xBestIndex);

            newModule.xDisconnect = new UnsafeNativeMethods.xDisconnect(
                (module.xDisconnect != null) ? module.xDisconnect :
                xDisconnect);

            newModule.xDestroy = new UnsafeNativeMethods.xDestroy(
                (module.xDestroy != null) ? module.xDestroy : xDestroy);

            newModule.xOpen = new UnsafeNativeMethods.xOpen(
                (module.xOpen != null) ? module.xOpen : xOpen);

            newModule.xClose = new UnsafeNativeMethods.xClose(
                (module.xClose != null) ? module.xClose : xClose);

            newModule.xFilter = new UnsafeNativeMethods.xFilter(
                (module.xFilter != null) ? module.xFilter : xFilter);

            newModule.xNext = new UnsafeNativeMethods.xNext(
                (module.xNext != null) ? module.xNext : xNext);

            newModule.xEof = new UnsafeNativeMethods.xEof(
                (module.xEof != null) ? module.xEof : xEof);

            newModule.xColumn = new UnsafeNativeMethods.xColumn(
                (module.xColumn != null) ? module.xColumn : xColumn);

            newModule.xRowId = new UnsafeNativeMethods.xRowId(
                (module.xRowId != null) ? module.xRowId : xRowId);

            newModule.xUpdate = new UnsafeNativeMethods.xUpdate(
                (module.xUpdate != null) ? module.xUpdate : xUpdate);

            newModule.xBegin = new UnsafeNativeMethods.xBegin(
                (module.xBegin != null) ? module.xBegin : xBegin);

            newModule.xSync = new UnsafeNativeMethods.xSync(
                (module.xSync != null) ? module.xSync : xSync);

            newModule.xCommit = new UnsafeNativeMethods.xCommit(
                (module.xCommit != null) ? module.xCommit : xCommit);

            newModule.xRollback = new UnsafeNativeMethods.xRollback(
                (module.xRollback != null) ? module.xRollback : xRollback);

            newModule.xFindFunction = new UnsafeNativeMethods.xFindFunction(
                (module.xFindFunction != null) ? module.xFindFunction :
                xFindFunction);

            newModule.xRename = new UnsafeNativeMethods.xRename(
                (module.xRename != null) ? module.xRename : xRename);

            newModule.xSavepoint = new UnsafeNativeMethods.xSavepoint(
                (module.xSavepoint != null) ? module.xSavepoint : xSavepoint);

            newModule.xRelease = new UnsafeNativeMethods.xRelease(
                (module.xRelease != null) ? module.xRelease : xRelease);

            newModule.xRollbackTo = new UnsafeNativeMethods.xRollbackTo(
                (module.xRollbackTo != null) ? module.xRollbackTo :
                xRollbackTo);

            return newModule;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Calls one of the virtual table initialization methods.
        /// </summary>
        /// <param name="create">
        /// Non-zero to call the <see cref="ISQLiteManagedModule.Create" />
        /// method; otherwise, the <see cref="ISQLiteManagedModule.Connect" />
        /// method will be called.
        /// </param>
        /// <param name="pDb">
        /// The native database connection handle.
        /// </param>
        /// <param name="pAux">
        /// The original native pointer value that was provided to the
        /// sqlite3_create_module(), sqlite3_create_module_v2() or
        /// sqlite3_create_disposable_module() functions.
        /// </param>
        /// <param name="argc">
        /// The number of arguments from the CREATE VIRTUAL TABLE statement.
        /// </param>
        /// <param name="argv">
        /// The array of string arguments from the CREATE VIRTUAL TABLE
        /// statement.
        /// </param>
        /// <param name="pVtab">
        /// Upon success, this parameter must be modified to point to the newly
        /// created native sqlite3_vtab derived structure.
        /// </param>
        /// <param name="pError">
        /// Upon failure, this parameter must be modified to point to the error
        /// message, with the underlying memory having been obtained from the
        /// sqlite3_malloc() function.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        private SQLiteErrorCode CreateOrConnect(
            bool create,
            IntPtr pDb,
            IntPtr pAux,
            int argc,
            IntPtr argv,
            ref IntPtr pVtab,
            ref IntPtr pError
            )
        {
            try
            {
                string fileName = SQLiteString.StringFromUtf8IntPtr(
                    UnsafeNativeMethods.sqlite3_db_filename(pDb, IntPtr.Zero));

                using (SQLiteConnection connection = new SQLiteConnection(
                        pDb, fileName, false))
                {
                    SQLiteVirtualTable table = null;
                    string error = null;

                    if ((create && Create(connection, pAux,
                            SQLiteString.StringArrayFromUtf8SizeAndIntPtr(argc,
                            argv), ref table, ref error) == SQLiteErrorCode.Ok) ||
                        (!create && Connect(connection, pAux,
                            SQLiteString.StringArrayFromUtf8SizeAndIntPtr(argc,
                            argv), ref table, ref error) == SQLiteErrorCode.Ok))
                    {
                        if (table != null)
                        {
                            pVtab = TableToIntPtr(table);
                            return SQLiteErrorCode.Ok;
                        }
                        else
                        {
                            pError = SQLiteString.Utf8IntPtrFromString(
                                "no table was created");
                        }
                    }
                    else
                    {
                        pError = SQLiteString.Utf8IntPtrFromString(error);
                    }
                }
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                pError = SQLiteString.Utf8IntPtrFromString(e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Calls one of the virtual table finalization methods.
        /// </summary>
        /// <param name="destroy">
        /// Non-zero to call the <see cref="ISQLiteManagedModule.Destroy" />
        /// method; otherwise, the
        /// <see cref="ISQLiteManagedModule.Disconnect" /> method will be
        /// called.
        /// </param>
        /// <param name="pVtab">
        /// The native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        private SQLiteErrorCode DestroyOrDisconnect(
            bool destroy,
            IntPtr pVtab
            )
        {
            try
            {
                SQLiteVirtualTable table = TableFromIntPtr(pVtab);

                if (table != null)
                {
                    if ((destroy && (Destroy(table) == SQLiteErrorCode.Ok)) ||
                        (!destroy && (Disconnect(table) == SQLiteErrorCode.Ok)))
                    {
                        if (tables != null)
                            tables.Remove(pVtab);

                        return SQLiteErrorCode.Ok;
                    }
                }
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                //
                // NOTE: At this point, there is no way to report the error
                //       condition back to the caller; therefore, use the
                //       logging facility instead.
                //
                try
                {
                    if (LogExceptionsNoThrow)
                    {
                        /* throw */
                        SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
                            HelperMethods.StringFormat(
                            CultureInfo.CurrentCulture,
                            UnsafeNativeMethods.ExceptionMessageFormat,
                            destroy ? "xDestroy" : "xDisconnect", e));
                    }
                }
                catch
                {
                    // do nothing.
                }
            }
            finally
            {
                FreeTable(pVtab);
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        #region Static Error Handling Helper Methods
        /// <summary>
        /// Arranges for the specified error message to be placed into the
        /// zErrMsg field of a sqlite3_vtab derived structure, freeing the
        /// existing error message, if any.
        /// </summary>
        /// <param name="module">
        /// The <see cref="SQLiteModule" /> object instance to be used.
        /// </param>
        /// <param name="pVtab">
        /// The native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <param name="logErrors">
        /// Non-zero if this error message should also be logged using the
        /// <see cref="SQLiteLog" /> class.
        /// </param>
        /// <param name="logExceptions">
        /// Non-zero if caught exceptions should be logged using the
        /// <see cref="SQLiteLog" /> class.
        /// </param>
        /// <param name="error">
        /// The error message.
        /// </param>
        /// <returns>
        /// Non-zero upon success.
        /// </returns>
        private static bool SetTableError(
            SQLiteModule module,
            IntPtr pVtab,
            bool logErrors,
            bool logExceptions,
            string error
            )
        {
            try
            {
                if (logErrors && (error != null))
                {
                    SQLiteLog.LogMessage(SQLiteErrorCode.Error,
                        HelperMethods.StringFormat(
                        CultureInfo.CurrentCulture,
                        "Virtual table error: {0}", error)); /* throw */
                }
            }
            catch
            {
                // do nothing.
            }

            bool success = false;
            IntPtr pNewError = IntPtr.Zero;

            try
            {
                if (pVtab == IntPtr.Zero)
                    return false;

                int offset = 0;

                offset = SQLiteMarshal.NextOffsetOf(
                    offset, IntPtr.Size, sizeof(int));

                offset = SQLiteMarshal.NextOffsetOf(
                    offset, sizeof(int), IntPtr.Size);

                IntPtr pOldError = SQLiteMarshal.ReadIntPtr(pVtab, offset);

                if (pOldError != IntPtr.Zero)
                {
                    SQLiteMemory.Free(pOldError); pOldError = IntPtr.Zero;
                    SQLiteMarshal.WriteIntPtr(pVtab, offset, pOldError);
                }

                if (error == null)
                    return true;

                pNewError = SQLiteString.Utf8IntPtrFromString(error);
                SQLiteMarshal.WriteIntPtr(pVtab, offset, pNewError);
                success = true;
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                try
                {
                    if (logExceptions)
                    {
                        SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
                            HelperMethods.StringFormat(
                            CultureInfo.CurrentCulture,
                            UnsafeNativeMethods.ExceptionMessageFormat,
                            "SetTableError", e)); /* throw */
                    }
                }
                catch
                {
                    // do nothing.
                }
            }
            finally
            {
                if (!success && (pNewError != IntPtr.Zero))
                {
                    SQLiteMemory.Free(pNewError);
                    pNewError = IntPtr.Zero;
                }
            }

            return success;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Arranges for the specified error message to be placed into the
        /// zErrMsg field of a sqlite3_vtab derived structure, freeing the
        /// existing error message, if any.
        /// </summary>
        /// <param name="module">
        /// The <see cref="SQLiteModule" /> object instance to be used.
        /// </param>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance used to
        /// lookup the native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <param name="logErrors">
        /// Non-zero if this error message should also be logged using the
        /// <see cref="SQLiteLog" /> class.
        /// </param>
        /// <param name="logExceptions">
        /// Non-zero if caught exceptions should be logged using the
        /// <see cref="SQLiteLog" /> class.
        /// </param>
        /// <param name="error">
        /// The error message.
        /// </param>
        /// <returns>
        /// Non-zero upon success.
        /// </returns>
        private static bool SetTableError(
            SQLiteModule module,
            SQLiteVirtualTable table,
            bool logErrors,
            bool logExceptions,
            string error
            )
        {
            if (table == null)
                return false;

            IntPtr pVtab = table.NativeHandle;

            if (pVtab == IntPtr.Zero)
                return false;

            return SetTableError(
                module, pVtab, logErrors, logExceptions, error);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Arranges for the specified error message to be placed into the
        /// zErrMsg field of a sqlite3_vtab derived structure, freeing the
        /// existing error message, if any.
        /// </summary>
        /// <param name="module">
        /// The <see cref="SQLiteModule" /> object instance to be used.
        /// </param>
        /// <param name="pCursor">
        /// The native pointer to the sqlite3_vtab_cursor derived structure
        /// used to get the native pointer to the sqlite3_vtab derived
        /// structure.
        /// </param>
        /// <param name="logErrors">
        /// Non-zero if this error message should also be logged using the
        /// <see cref="SQLiteLog" /> class.
        /// </param>
        /// <param name="logExceptions">
        /// Non-zero if caught exceptions should be logged using the
        /// <see cref="SQLiteLog" /> class.
        /// </param>
        /// <param name="error">
        /// The error message.
        /// </param>
        /// <returns>
        /// Non-zero upon success.
        /// </returns>
        private static bool SetCursorError(
            SQLiteModule module,
            IntPtr pCursor,
            bool logErrors,
            bool logExceptions,
            string error
            )
        {
            if (pCursor == IntPtr.Zero)
                return false;

            IntPtr pVtab = TableFromCursor(module, pCursor);

            if (pVtab == IntPtr.Zero)
                return false;

            return SetTableError(
                module, pVtab, logErrors, logExceptions, error);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Arranges for the specified error message to be placed into the
        /// zErrMsg field of a sqlite3_vtab derived structure, freeing the
        /// existing error message, if any.
        /// </summary>
        /// <param name="module">
        /// The <see cref="SQLiteModule" /> object instance to be used.
        /// </param>
        /// <param name="cursor">
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance used to
        /// lookup the native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <param name="logErrors">
        /// Non-zero if this error message should also be logged using the
        /// <see cref="SQLiteLog" /> class.
        /// </param>
        /// <param name="logExceptions">
        /// Non-zero if caught exceptions should be logged using the
        /// <see cref="SQLiteLog" /> class.
        /// </param>
        /// <param name="error">
        /// The error message.
        /// </param>
        /// <returns>
        /// Non-zero upon success.
        /// </returns>
        private static bool SetCursorError(
            SQLiteModule module,
            SQLiteVirtualTableCursor cursor,
            bool logErrors,
            bool logExceptions,
            string error
            )
        {
            if (cursor == null)
                return false;

            IntPtr pCursor = cursor.NativeHandle;

            if (pCursor == IntPtr.Zero)
                return false;

            return SetCursorError(
                module, pCursor, logErrors, logExceptions, error);
        }
        #endregion
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Protected Members
        #region Module Helper Methods
        /// <summary>
        /// Gets and returns the <see cref="ISQLiteNativeModule" /> interface
        /// implementation to be used when creating the native sqlite3_module
        /// structure.  Derived classes may override this method to supply an
        /// alternate implementation for the <see cref="ISQLiteNativeModule" />
        /// interface.
        /// </summary>
        /// <returns>
        /// The <see cref="ISQLiteNativeModule" /> interface implementation to
        /// be used when populating the native sqlite3_module structure.  If
        /// the returned value is null, the private methods provided by the
        /// <see cref="SQLiteModule" /> class and relating to the
        /// <see cref="ISQLiteNativeModule" /> interface  will be used to
        /// create the necessary delegates.
        /// </returns>
        protected virtual ISQLiteNativeModule GetNativeModuleImpl()
        {
            return null; /* NOTE: Use the built-in default delegates. */
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Creates and returns the <see cref="ISQLiteNativeModule" />
        /// interface implementation corresponding to the current
        /// <see cref="SQLiteModule" /> object instance.
        /// </summary>
        /// <returns>
        /// The <see cref="ISQLiteNativeModule" /> interface implementation
        /// corresponding to the current <see cref="SQLiteModule" /> object
        /// instance.
        /// </returns>
        protected virtual ISQLiteNativeModule CreateNativeModuleImpl()
        {
            return new SQLiteNativeModule(this);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Native Table Helper Methods
        /// <summary>
        /// Allocates a native sqlite3_vtab derived structure and returns a
        /// native pointer to it.
        /// </summary>
        /// <returns>
        /// A native pointer to a native sqlite3_vtab derived structure.
        /// </returns>
        protected virtual IntPtr AllocateTable()
        {
            int size = Marshal.SizeOf(typeof(
                UnsafeNativeMethods.sqlite3_vtab));

            return SQLiteMemory.Allocate(size);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Zeros out the fields of a native sqlite3_vtab derived structure.
        /// </summary>
        /// <param name="pVtab">
        /// The native pointer to the native sqlite3_vtab derived structure to
        /// zero.
        /// </param>
        protected virtual void ZeroTable(
            IntPtr pVtab
            )
        {
            if (pVtab == IntPtr.Zero)
                return;

            int offset = 0;

            SQLiteMarshal.WriteIntPtr(pVtab, offset, IntPtr.Zero);

            offset = SQLiteMarshal.NextOffsetOf(
                offset, IntPtr.Size, sizeof(int));

            SQLiteMarshal.WriteInt32(pVtab, offset, 0);

            offset = SQLiteMarshal.NextOffsetOf(
                offset, sizeof(int), IntPtr.Size);

            SQLiteMarshal.WriteIntPtr(pVtab, offset, IntPtr.Zero);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Frees a native sqlite3_vtab structure using the provided native
        /// pointer to it.
        /// </summary>
        /// <param name="pVtab">
        /// A native pointer to a native sqlite3_vtab derived structure.
        /// </param>
        protected virtual void FreeTable(
            IntPtr pVtab
            )
        {
            SetTableError(pVtab, null);
            SQLiteMemory.Free(pVtab);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Native Cursor Helper Methods
        /// <summary>
        /// Allocates a native sqlite3_vtab_cursor derived structure and
        /// returns a native pointer to it.
        /// </summary>
        /// <returns>
        /// A native pointer to a native sqlite3_vtab_cursor derived structure.
        /// </returns>
        protected virtual IntPtr AllocateCursor()
        {
            int size = Marshal.SizeOf(typeof(
                UnsafeNativeMethods.sqlite3_vtab_cursor));

            return SQLiteMemory.Allocate(size);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Frees a native sqlite3_vtab_cursor structure using the provided
        /// native pointer to it.
        /// </summary>
        /// <param name="pCursor">
        /// A native pointer to a native sqlite3_vtab_cursor derived structure.
        /// </param>
        protected virtual void FreeCursor(
            IntPtr pCursor
            )
        {
            SQLiteMemory.Free(pCursor);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Static Table Lookup Methods
        /// <summary>
        /// Reads and returns the native pointer to the sqlite3_vtab derived
        /// structure based on the native pointer to the sqlite3_vtab_cursor
        /// derived structure.
        /// </summary>
        /// <param name="module">
        /// The <see cref="SQLiteModule" /> object instance to be used.
        /// </param>
        /// <param name="pCursor">
        /// The native pointer to the sqlite3_vtab_cursor derived structure
        /// from which to read the native pointer to the sqlite3_vtab derived
        /// structure.
        /// </param>
        /// <returns>
        /// The native pointer to the sqlite3_vtab derived structure -OR-
        /// <see cref="IntPtr.Zero" /> if it cannot be determined.
        /// </returns>
        private static IntPtr TableFromCursor(
            SQLiteModule module,
            IntPtr pCursor
            )
        {
            if (pCursor == IntPtr.Zero)
                return IntPtr.Zero;

            return Marshal.ReadIntPtr(pCursor);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Table Lookup Methods
        /// <summary>
        /// Reads and returns the native pointer to the sqlite3_vtab derived
        /// structure based on the native pointer to the sqlite3_vtab_cursor
        /// derived structure.
        /// </summary>
        /// <param name="pCursor">
        /// The native pointer to the sqlite3_vtab_cursor derived structure
        /// from which to read the native pointer to the sqlite3_vtab derived
        /// structure.
        /// </param>
        /// <returns>
        /// The native pointer to the sqlite3_vtab derived structure -OR-
        /// <see cref="IntPtr.Zero" /> if it cannot be determined.
        /// </returns>
        protected virtual IntPtr TableFromCursor(
            IntPtr pCursor
            )
        {
            return TableFromCursor(this, pCursor);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Looks up and returns the <see cref="SQLiteVirtualTable" /> object
        /// instance based on the native pointer to the sqlite3_vtab derived
        /// structure.
        /// </summary>
        /// <param name="pVtab">
        /// The native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <returns>
        /// The <see cref="SQLiteVirtualTable" /> object instance or null if
        /// the corresponding one cannot be found.
        /// </returns>
        protected virtual SQLiteVirtualTable TableFromIntPtr(
            IntPtr pVtab
            )
        {
            if (pVtab == IntPtr.Zero)
            {
                SetTableError(pVtab, "invalid native table");
                return null;
            }

            SQLiteVirtualTable table;

            if ((tables != null) &&
                tables.TryGetValue(pVtab, out table))
            {
                return table;
            }

            SetTableError(pVtab, HelperMethods.StringFormat(
                CultureInfo.CurrentCulture,
                "managed table for {0} not found", pVtab));

            return null;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Allocates and returns a native pointer to a sqlite3_vtab derived
        /// structure and creates an association between it and the specified
        /// <see cref="SQLiteVirtualTable" /> object instance.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance to be used
        /// when creating the association.
        /// </param>
        /// <returns>
        /// The native pointer to a sqlite3_vtab derived structure or
        /// <see cref="IntPtr.Zero" /> if the method fails for any reason.
        /// </returns>
        protected virtual IntPtr TableToIntPtr(
            SQLiteVirtualTable table
            )
        {
            if ((table == null) || (tables == null))
                return IntPtr.Zero;

            IntPtr pVtab = IntPtr.Zero;
            bool success = false;

            try
            {
                pVtab = AllocateTable();

                if (pVtab != IntPtr.Zero)
                {
                    ZeroTable(pVtab);
                    table.NativeHandle = pVtab;
                    tables.Add(pVtab, table);
                    success = true;
                }
            }
            finally
            {
                if (!success && (pVtab != IntPtr.Zero))
                {
                    FreeTable(pVtab);
                    pVtab = IntPtr.Zero;
                }
            }

            return pVtab;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Cursor Lookup Methods
        /// <summary>
        /// Looks up and returns the <see cref="SQLiteVirtualTableCursor" />
        /// object instance based on the native pointer to the
        /// sqlite3_vtab_cursor derived structure.
        /// </summary>
        /// <param name="pVtab">
        /// The native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <param name="pCursor">
        /// The native pointer to the sqlite3_vtab_cursor derived structure.
        /// </param>
        /// <returns>
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance or null
        /// if the corresponding one cannot be found.
        /// </returns>
        protected virtual SQLiteVirtualTableCursor CursorFromIntPtr(
            IntPtr pVtab,
            IntPtr pCursor
            )
        {
            if (pCursor == IntPtr.Zero)
            {
                SetTableError(pVtab, "invalid native cursor");
                return null;
            }

            SQLiteVirtualTableCursor cursor;

            if ((cursors != null) &&
                cursors.TryGetValue(pCursor, out cursor))
            {
                return cursor;
            }

            SetTableError(pVtab, HelperMethods.StringFormat(
                CultureInfo.CurrentCulture,
                "managed cursor for {0} not found", pCursor));

            return null;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Allocates and returns a native pointer to a sqlite3_vtab_cursor
        /// derived structure and creates an association between it and the
        /// specified <see cref="SQLiteVirtualTableCursor" /> object instance.
        /// </summary>
        /// <param name="cursor">
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance to be
        /// used when creating the association.
        /// </param>
        /// <returns>
        /// The native pointer to a sqlite3_vtab_cursor derived structure or
        /// <see cref="IntPtr.Zero" /> if the method fails for any reason.
        /// </returns>
        protected virtual IntPtr CursorToIntPtr(
            SQLiteVirtualTableCursor cursor
            )
        {
            if ((cursor == null) || (cursors == null))
                return IntPtr.Zero;

            IntPtr pCursor = IntPtr.Zero;
            bool success = false;

            try
            {
                pCursor = AllocateCursor();

                if (pCursor != IntPtr.Zero)
                {
                    cursor.NativeHandle = pCursor;
                    cursors.Add(pCursor, cursor);
                    success = true;
                }
            }
            finally
            {
                if (!success && (pCursor != IntPtr.Zero))
                {
                    FreeCursor(pCursor);
                    pCursor = IntPtr.Zero;
                }
            }

            return pCursor;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Function Lookup Methods
        /// <summary>
        /// Deterimines the key that should be used to identify and store the
        /// <see cref="SQLiteFunction" /> object instance for the virtual table
        /// (i.e. to be returned via the
        /// <see cref="ISQLiteNativeModule.xFindFunction" /> method).
        /// </summary>
        /// <param name="argumentCount">
        /// The number of arguments to the virtual table function.
        /// </param>
        /// <param name="name">
        /// The name of the virtual table function.
        /// </param>
        /// <param name="function">
        /// The <see cref="SQLiteFunction" /> object instance associated with
        /// this virtual table function.
        /// </param>
        /// <returns>
        /// The string that should be used to identify and store the virtual
        /// table function instance.  This method cannot return null.  If null
        /// is returned from this method, the behavior is undefined.
        /// </returns>
        protected virtual string GetFunctionKey(
            int argumentCount,
            string name,
            SQLiteFunction function
            )
        {
            return HelperMethods.StringFormat(
                CultureInfo.InvariantCulture,
                "{0}:{1}", argumentCount, name);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Table Declaration Helper Methods
        /// <summary>
        /// Attempts to declare the schema for the virtual table using the
        /// specified database connection.
        /// </summary>
        /// <param name="connection">
        /// The <see cref="SQLiteConnection" /> object instance to use when
        /// declaring the schema of the virtual table.  This parameter may not
        /// be null.
        /// </param>
        /// <param name="sql">
        /// The string containing the CREATE TABLE statement that completely
        /// describes the schema for the virtual table.  This parameter may not
        /// be null.
        /// </param>
        /// <param name="error">
        /// Upon failure, this parameter must be modified to contain an error
        /// message.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        protected virtual SQLiteErrorCode DeclareTable(
            SQLiteConnection connection,
            string sql,
            ref string error
            )
        {
            if (connection == null)
            {
                error = "invalid connection";
                return SQLiteErrorCode.Error;
            }

            SQLiteBase sqliteBase = connection._sql;

            if (sqliteBase == null)
            {
                error = "connection has invalid handle";
                return SQLiteErrorCode.Error;
            }

            if (sql == null)
            {
                error = "invalid SQL statement";
                return SQLiteErrorCode.Error;
            }

            return sqliteBase.DeclareVirtualTable(this, sql, ref error);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Function Declaration Helper Methods
        /// <summary>
        /// Calls the native SQLite core library in order to declare a virtual
        /// table function in response to a call into the
        /// <see cref="ISQLiteNativeModule.xCreate" />
        /// or <see cref="ISQLiteNativeModule.xConnect" /> virtual table
        /// methods.
        /// </summary>
        /// <param name="connection">
        /// The <see cref="SQLiteConnection" /> object instance to use when
        /// declaring the schema of the virtual table.
        /// </param>
        /// <param name="argumentCount">
        /// The number of arguments to the function being declared.
        /// </param>
        /// <param name="name">
        /// The name of the function being declared.
        /// </param>
        /// <param name="error">
        /// Upon success, the contents of this parameter are undefined.  Upon
        /// failure, it should contain an appropriate error message.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        protected virtual SQLiteErrorCode DeclareFunction(
            SQLiteConnection connection,
            int argumentCount,
            string name,
            ref string error
            )
        {
            if (connection == null)
            {
                error = "invalid connection";
                return SQLiteErrorCode.Error;
            }

            SQLiteBase sqliteBase = connection._sql;

            if (sqliteBase == null)
            {
                error = "connection has invalid handle";
                return SQLiteErrorCode.Error;
            }

            return sqliteBase.DeclareVirtualFunction(
                this, argumentCount, name, ref error);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Error Handling Properties
        private bool logErrors;
        /// <summary>
        /// Returns or sets a boolean value indicating whether virtual table
        /// errors should be logged using the <see cref="SQLiteLog" /> class.
        /// </summary>
        protected virtual bool LogErrorsNoThrow
        {
            get { return logErrors; }
            set { logErrors = value; }
        }

        ///////////////////////////////////////////////////////////////////////

        private bool logExceptions;
        /// <summary>
        /// Returns or sets a boolean value indicating whether exceptions
        /// caught in the
        /// <see cref="ISQLiteNativeModule.xDisconnect" /> method,
        /// the <see cref="ISQLiteNativeModule.xDestroy" /> method,
        /// the <see cref="SetTableError(IntPtr,string)" /> method,
        /// the <see cref="SetTableError(SQLiteVirtualTable,string)" /> method,
        /// and the <see cref="Dispose()" /> method should be logged using the
        /// <see cref="SQLiteLog" /> class.
        /// </summary>
        protected virtual bool LogExceptionsNoThrow
        {
            get { return logExceptions; }
            set { logExceptions = value; }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Error Handling Helper Methods
        /// <summary>
        /// Arranges for the specified error message to be placed into the
        /// zErrMsg field of a sqlite3_vtab derived structure, freeing the
        /// existing error message, if any.
        /// </summary>
        /// <param name="pVtab">
        /// The native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <param name="error">
        /// The error message.
        /// </param>
        /// <returns>
        /// Non-zero upon success.
        /// </returns>
        protected virtual bool SetTableError(
            IntPtr pVtab,
            string error
            )
        {
            return SetTableError(
                this, pVtab, LogErrorsNoThrow, LogExceptionsNoThrow, error);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Arranges for the specified error message to be placed into the
        /// zErrMsg field of a sqlite3_vtab derived structure, freeing the
        /// existing error message, if any.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance used to
        /// lookup the native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <param name="error">
        /// The error message.
        /// </param>
        /// <returns>
        /// Non-zero upon success.
        /// </returns>
        protected virtual bool SetTableError(
            SQLiteVirtualTable table,
            string error
            )
        {
            return SetTableError(
                this, table, LogErrorsNoThrow, LogExceptionsNoThrow, error);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Arranges for the specified error message to be placed into the
        /// zErrMsg field of a sqlite3_vtab derived structure, freeing the
        /// existing error message, if any.
        /// </summary>
        /// <param name="cursor">
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance used to
        /// lookup the native pointer to the sqlite3_vtab derived structure.
        /// </param>
        /// <param name="error">
        /// The error message.
        /// </param>
        /// <returns>
        /// Non-zero upon success.
        /// </returns>
        protected virtual bool SetCursorError(
            SQLiteVirtualTableCursor cursor,
            string error
            )
        {
            return SetCursorError(
                this, cursor, LogErrorsNoThrow, LogExceptionsNoThrow, error);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Index Handling Helper Methods
        /// <summary>
        /// Modifies the specified <see cref="SQLiteIndex" /> object instance
        /// to contain the specified estimated cost.
        /// </summary>
        /// <param name="index">
        /// The <see cref="SQLiteIndex" /> object instance to modify.
        /// </param>
        /// <param name="estimatedCost">
        /// The estimated cost value to use.  Using a null value means that the
        /// default value provided by the SQLite core library should be used.
        /// </param>
        /// <returns>
        /// Non-zero upon success.
        /// </returns>
        protected virtual bool SetEstimatedCost(
            SQLiteIndex index,
            double? estimatedCost
            )
        {
            if ((index == null) || (index.Outputs == null))
                return false;

            index.Outputs.EstimatedCost = estimatedCost;
            return true;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Modifies the specified <see cref="SQLiteIndex" /> object instance
        /// to contain the default estimated cost.
        /// </summary>
        /// <param name="index">
        /// The <see cref="SQLiteIndex" /> object instance to modify.
        /// </param>
        /// <returns>
        /// Non-zero upon success.
        /// </returns>
        protected virtual bool SetEstimatedCost(
            SQLiteIndex index
            )
        {
            return SetEstimatedCost(index, null);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Modifies the specified <see cref="SQLiteIndex" /> object instance
        /// to contain the specified estimated rows.
        /// </summary>
        /// <param name="index">
        /// The <see cref="SQLiteIndex" /> object instance to modify.
        /// </param>
        /// <param name="estimatedRows">
        /// The estimated rows value to use.  Using a null value means that the
        /// default value provided by the SQLite core library should be used.
        /// </param>
        /// <returns>
        /// Non-zero upon success.
        /// </returns>
        protected virtual bool SetEstimatedRows(
            SQLiteIndex index,
            long? estimatedRows
            )
        {
            if ((index == null) || (index.Outputs == null))
                return false;

            index.Outputs.EstimatedRows = estimatedRows;
            return true;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Modifies the specified <see cref="SQLiteIndex" /> object instance
        /// to contain the default estimated rows.
        /// </summary>
        /// <param name="index">
        /// The <see cref="SQLiteIndex" /> object instance to modify.
        /// </param>
        /// <returns>
        /// Non-zero upon success.
        /// </returns>
        protected virtual bool SetEstimatedRows(
            SQLiteIndex index
            )
        {
            return SetEstimatedRows(index, null);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Modifies the specified <see cref="SQLiteIndex" /> object instance
        /// to contain the specified flags.
        /// </summary>
        /// <param name="index">
        /// The <see cref="SQLiteIndex" /> object instance to modify.
        /// </param>
        /// <param name="indexFlags">
        /// The index flags value to use.  Using a null value means that the
        /// default value provided by the SQLite core library should be used.
        /// </param>
        /// <returns>
        /// Non-zero upon success.
        /// </returns>
        protected virtual bool SetIndexFlags(
            SQLiteIndex index,
            SQLiteIndexFlags? indexFlags
            )
        {
            if ((index == null) || (index.Outputs == null))
                return false;

            index.Outputs.IndexFlags = indexFlags;
            return true;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Modifies the specified <see cref="SQLiteIndex" /> object instance
        /// to contain the default index flags.
        /// </summary>
        /// <param name="index">
        /// The <see cref="SQLiteIndex" /> object instance to modify.
        /// </param>
        /// <returns>
        /// Non-zero upon success.
        /// </returns>
        protected virtual bool SetIndexFlags(
            SQLiteIndex index
            )
        {
            return SetIndexFlags(index, null);
        }
        #endregion
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Properties
        /// <summary>
        /// Returns or sets a boolean value indicating whether virtual table
        /// errors should be logged using the <see cref="SQLiteLog" /> class.
        /// </summary>
        public virtual bool LogErrors
        {
            get { CheckDisposed(); return LogErrorsNoThrow; }
            set { CheckDisposed(); LogErrorsNoThrow = value; }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Returns or sets a boolean value indicating whether exceptions
        /// caught in the
        /// <see cref="ISQLiteNativeModule.xDisconnect" /> method,
        /// <see cref="ISQLiteNativeModule.xDestroy" /> method, and the
        /// <see cref="Dispose()" /> method should be logged using the
        /// <see cref="SQLiteLog" /> class.
        /// </summary>
        public virtual bool LogExceptions
        {
            get { CheckDisposed(); return LogExceptionsNoThrow; }
            set { CheckDisposed(); LogExceptionsNoThrow = value; }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteNativeModule Members
        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xCreate" /> method.
        /// </summary>
        /// <param name="pDb">
        /// See the <see cref="ISQLiteNativeModule.xCreate" /> method.
        /// </param>
        /// <param name="pAux">
        /// See the <see cref="ISQLiteNativeModule.xCreate" /> method.
        /// </param>
        /// <param name="argc">
        /// See the <see cref="ISQLiteNativeModule.xCreate" /> method.
        /// </param>
        /// <param name="argv">
        /// See the <see cref="ISQLiteNativeModule.xCreate" /> method.
        /// </param>
        /// <param name="pVtab">
        /// See the <see cref="ISQLiteNativeModule.xCreate" /> method.
        /// </param>
        /// <param name="pError">
        /// See the <see cref="ISQLiteNativeModule.xCreate" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xCreate" /> method.
        /// </returns>
        private SQLiteErrorCode xCreate(
            IntPtr pDb,
            IntPtr pAux,
            int argc,
            IntPtr argv,
            ref IntPtr pVtab,
            ref IntPtr pError
            )
        {
            return CreateOrConnect(
                true, pDb, pAux, argc, argv, ref pVtab, ref pError);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xConnect" /> method.
        /// </summary>
        /// <param name="pDb">
        /// See the <see cref="ISQLiteNativeModule.xConnect" /> method.
        /// </param>
        /// <param name="pAux">
        /// See the <see cref="ISQLiteNativeModule.xConnect" /> method.
        /// </param>
        /// <param name="argc">
        /// See the <see cref="ISQLiteNativeModule.xConnect" /> method.
        /// </param>
        /// <param name="argv">
        /// See the <see cref="ISQLiteNativeModule.xConnect" /> method.
        /// </param>
        /// <param name="pVtab">
        /// See the <see cref="ISQLiteNativeModule.xConnect" /> method.
        /// </param>
        /// <param name="pError">
        /// See the <see cref="ISQLiteNativeModule.xConnect" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xConnect" /> method.
        /// </returns>
        private SQLiteErrorCode xConnect(
            IntPtr pDb,
            IntPtr pAux,
            int argc,
            IntPtr argv,
            ref IntPtr pVtab,
            ref IntPtr pError
            )
        {
            return CreateOrConnect(
                false, pDb, pAux, argc, argv, ref pVtab, ref pError);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xBestIndex" /> method.
        /// </summary>
        /// <param name="pVtab">
        /// See the <see cref="ISQLiteNativeModule.xBestIndex" /> method.
        /// </param>
        /// <param name="pIndex">
        /// See the <see cref="ISQLiteNativeModule.xBestIndex" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xBestIndex" /> method.
        /// </returns>
        private SQLiteErrorCode xBestIndex(
            IntPtr pVtab,
            IntPtr pIndex
            )
        {
            try
            {
                SQLiteVirtualTable table = TableFromIntPtr(pVtab);

                if (table != null)
                {
                    SQLiteIndex index = null;

                    SQLiteIndex.FromIntPtr(pIndex, true, ref index);

                    if (BestIndex(table, index) == SQLiteErrorCode.Ok)
                    {
                        SQLiteIndex.ToIntPtr(index, pIndex, true);
                        return SQLiteErrorCode.Ok;
                    }
                }
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xDisconnect" /> method.
        /// </summary>
        /// <param name="pVtab">
        /// See the <see cref="ISQLiteNativeModule.xDisconnect" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xDisconnect" /> method.
        /// </returns>
        private SQLiteErrorCode xDisconnect(
            IntPtr pVtab
            )
        {
            return DestroyOrDisconnect(false, pVtab);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xDestroy" /> method.
        /// </summary>
        /// <param name="pVtab">
        /// See the <see cref="ISQLiteNativeModule.xDestroy" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xDestroy" /> method.
        /// </returns>
        private SQLiteErrorCode xDestroy(
            IntPtr pVtab
            )
        {
            return DestroyOrDisconnect(true, pVtab);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xOpen" /> method.
        /// </summary>
        /// <param name="pVtab">
        /// See the <see cref="ISQLiteNativeModule.xOpen" /> method.
        /// </param>
        /// <param name="pCursor">
        /// See the <see cref="ISQLiteNativeModule.xOpen" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xOpen" /> method.
        /// </returns>
        private SQLiteErrorCode xOpen(
            IntPtr pVtab,
            ref IntPtr pCursor
            )
        {
            try
            {
                SQLiteVirtualTable table = TableFromIntPtr(pVtab);

                if (table != null)
                {
                    SQLiteVirtualTableCursor cursor = null;

                    if (Open(table, ref cursor) == SQLiteErrorCode.Ok)
                    {
                        if (cursor != null)
                        {
                            pCursor = CursorToIntPtr(cursor);

                            if (pCursor != IntPtr.Zero)
                            {
                                return SQLiteErrorCode.Ok;
                            }
                            else
                            {
                                SetTableError(pVtab,
                                    "no native cursor was created");
                            }
                        }
                        else
                        {
                            SetTableError(pVtab,
                                "no managed cursor was created");
                        }
                    }
                }
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xClose" /> method.
        /// </summary>
        /// <param name="pCursor">
        /// See the <see cref="ISQLiteNativeModule.xClose" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xClose" /> method.
        /// </returns>
        private SQLiteErrorCode xClose(
            IntPtr pCursor
            )
        {
            IntPtr pVtab = IntPtr.Zero;

            try
            {
                pVtab = TableFromCursor(pCursor);

                SQLiteVirtualTableCursor cursor = CursorFromIntPtr(
                    pVtab, pCursor);

                if (cursor != null)
                {
                    if (Close(cursor) == SQLiteErrorCode.Ok)
                    {
                        if (cursors != null)
                            cursors.Remove(pCursor);

                        return SQLiteErrorCode.Ok;
                    }
                }
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }
            finally
            {
                FreeCursor(pCursor);
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xFilter" /> method.
        /// </summary>
        /// <param name="pCursor">
        /// See the <see cref="ISQLiteNativeModule.xFilter" /> method.
        /// </param>
        /// <param name="idxNum">
        /// See the <see cref="ISQLiteNativeModule.xFilter" /> method.
        /// </param>
        /// <param name="idxStr">
        /// See the <see cref="ISQLiteNativeModule.xFilter" /> method.
        /// </param>
        /// <param name="argc">
        /// See the <see cref="ISQLiteNativeModule.xFilter" /> method.
        /// </param>
        /// <param name="argv">
        /// See the <see cref="ISQLiteNativeModule.xFilter" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xFilter" /> method.
        /// </returns>
        private SQLiteErrorCode xFilter(
            IntPtr pCursor,
            int idxNum,
            IntPtr idxStr,
            int argc,
            IntPtr argv
            )
        {
            IntPtr pVtab = IntPtr.Zero;

            try
            {
                pVtab = TableFromCursor(pCursor);

                SQLiteVirtualTableCursor cursor = CursorFromIntPtr(
                    pVtab, pCursor);

                if (cursor != null)
                {
                    if (Filter(cursor, idxNum,
                            SQLiteString.StringFromUtf8IntPtr(idxStr),
                            SQLiteValue.ArrayFromSizeAndIntPtr(argc,
                                argv)) == SQLiteErrorCode.Ok)
                    {
                        return SQLiteErrorCode.Ok;
                    }
                }
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xNext" /> method.
        /// </summary>
        /// <param name="pCursor">
        /// See the <see cref="ISQLiteNativeModule.xNext" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xNext" /> method.
        /// </returns>
        private SQLiteErrorCode xNext(
            IntPtr pCursor
            )
        {
            IntPtr pVtab = IntPtr.Zero;

            try
            {
                pVtab = TableFromCursor(pCursor);

                SQLiteVirtualTableCursor cursor = CursorFromIntPtr(
                    pVtab, pCursor);

                if (cursor != null)
                {
                    if (Next(cursor) == SQLiteErrorCode.Ok)
                        return SQLiteErrorCode.Ok;
                }
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xEof" /> method.
        /// </summary>
        /// <param name="pCursor">
        /// See the <see cref="ISQLiteNativeModule.xEof" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xEof" /> method.
        /// </returns>
        private int xEof(
            IntPtr pCursor
            )
        {
            IntPtr pVtab = IntPtr.Zero;

            try
            {
                pVtab = TableFromCursor(pCursor);

                SQLiteVirtualTableCursor cursor = CursorFromIntPtr(
                    pVtab, pCursor);

                if (cursor != null)
                    return Eof(cursor) ? 1 : 0;
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return 1; /* NOTE: On any error, return "no more rows". */
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xColumn" /> method.
        /// </summary>
        /// <param name="pCursor">
        /// See the <see cref="ISQLiteNativeModule.xColumn" /> method.
        /// </param>
        /// <param name="pContext">
        /// See the <see cref="ISQLiteNativeModule.xColumn" /> method.
        /// </param>
        /// <param name="index">
        /// See the <see cref="ISQLiteNativeModule.xColumn" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xColumn" /> method.
        /// </returns>
        private SQLiteErrorCode xColumn(
            IntPtr pCursor,
            IntPtr pContext,
            int index
            )
        {
            IntPtr pVtab = IntPtr.Zero;

            try
            {
                pVtab = TableFromCursor(pCursor);

                SQLiteVirtualTableCursor cursor = CursorFromIntPtr(
                    pVtab, pCursor);

                if (cursor != null)
                {
                    SQLiteContext context = new SQLiteContext(pContext);

                    return Column(cursor, context, index);
                }
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xRowId" /> method.
        /// </summary>
        /// <param name="pCursor">
        /// See the <see cref="ISQLiteNativeModule.xRowId" /> method.
        /// </param>
        /// <param name="rowId">
        /// See the <see cref="ISQLiteNativeModule.xRowId" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xRowId" /> method.
        /// </returns>
        private SQLiteErrorCode xRowId(
            IntPtr pCursor,
            ref long rowId
            )
        {
            IntPtr pVtab = IntPtr.Zero;

            try
            {
                pVtab = TableFromCursor(pCursor);

                SQLiteVirtualTableCursor cursor = CursorFromIntPtr(
                    pVtab, pCursor);

                if (cursor != null)
                    return RowId(cursor, ref rowId);
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xUpdate" /> method.
        /// </summary>
        /// <param name="pVtab">
        /// See the <see cref="ISQLiteNativeModule.xUpdate" /> method.
        /// </param>
        /// <param name="argc">
        /// See the <see cref="ISQLiteNativeModule.xUpdate" /> method.
        /// </param>
        /// <param name="argv">
        /// See the <see cref="ISQLiteNativeModule.xUpdate" /> method.
        /// </param>
        /// <param name="rowId">
        /// See the <see cref="ISQLiteNativeModule.xUpdate" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xUpdate" /> method.
        /// </returns>
        private SQLiteErrorCode xUpdate(
            IntPtr pVtab,
            int argc,
            IntPtr argv,
            ref long rowId
            )
        {
            try
            {
                SQLiteVirtualTable table = TableFromIntPtr(pVtab);

                if (table != null)
                {
                    return Update(table,
                        SQLiteValue.ArrayFromSizeAndIntPtr(argc, argv),
                        ref rowId);
                }
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xBegin" /> method.
        /// </summary>
        /// <param name="pVtab">
        /// See the <see cref="ISQLiteNativeModule.xBegin" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xBegin" /> method.
        /// </returns>
        private SQLiteErrorCode xBegin(
            IntPtr pVtab
            )
        {
            try
            {
                SQLiteVirtualTable table = TableFromIntPtr(pVtab);

                if (table != null)
                    return Begin(table);
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xSync" /> method.
        /// </summary>
        /// <param name="pVtab">
        /// See the <see cref="ISQLiteNativeModule.xSync" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xSync" /> method.
        /// </returns>
        private SQLiteErrorCode xSync(
            IntPtr pVtab
            )
        {
            try
            {
                SQLiteVirtualTable table = TableFromIntPtr(pVtab);

                if (table != null)
                    return Sync(table);
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xCommit" /> method.
        /// </summary>
        /// <param name="pVtab">
        /// See the <see cref="ISQLiteNativeModule.xCommit" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xCommit" /> method.
        /// </returns>
        private SQLiteErrorCode xCommit(
            IntPtr pVtab
            )
        {
            try
            {
                SQLiteVirtualTable table = TableFromIntPtr(pVtab);

                if (table != null)
                    return Commit(table);
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xRollback" /> method.
        /// </summary>
        /// <param name="pVtab">
        /// See the <see cref="ISQLiteNativeModule.xRollback" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xRollback" /> method.
        /// </returns>
        private SQLiteErrorCode xRollback(
            IntPtr pVtab
            )
        {
            try
            {
                SQLiteVirtualTable table = TableFromIntPtr(pVtab);

                if (table != null)
                    return Rollback(table);
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xFindFunction" /> method.
        /// </summary>
        /// <param name="pVtab">
        /// See the <see cref="ISQLiteNativeModule.xFindFunction" /> method.
        /// </param>
        /// <param name="nArg">
        /// See the <see cref="ISQLiteNativeModule.xFindFunction" /> method.
        /// </param>
        /// <param name="zName">
        /// See the <see cref="ISQLiteNativeModule.xFindFunction" /> method.
        /// </param>
        /// <param name="callback">
        /// See the <see cref="ISQLiteNativeModule.xFindFunction" /> method.
        /// </param>
        /// <param name="pClientData">
        /// See the <see cref="ISQLiteNativeModule.xFindFunction" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xFindFunction" /> method.
        /// </returns>
        private int xFindFunction(
            IntPtr pVtab,
            int nArg,
            IntPtr zName,
            ref SQLiteCallback callback,
            ref IntPtr pClientData
            )
        {
            try
            {
                SQLiteVirtualTable table = TableFromIntPtr(pVtab);

                if (table != null)
                {
                    string name = SQLiteString.StringFromUtf8IntPtr(zName);
                    SQLiteFunction function = null;

                    if (FindFunction(
                            table, nArg, name, ref function, ref pClientData))
                    {
                        if (function != null)
                        {
                            string key = GetFunctionKey(nArg, name, function);

                            functions[key] = function;
                            callback = function.ScalarCallback;

                            return 1;
                        }
                        else
                        {
                            SetTableError(pVtab, "no function was created");
                        }
                    }
                }
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return 0; /* NOTE: On any error, return "no such function". */
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xRename" /> method.
        /// </summary>
        /// <param name="pVtab">
        /// See the <see cref="ISQLiteNativeModule.xRename" /> method.
        /// </param>
        /// <param name="zNew">
        /// See the <see cref="ISQLiteNativeModule.xRename" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xRename" /> method.
        /// </returns>
        private SQLiteErrorCode xRename(
            IntPtr pVtab,
            IntPtr zNew
            )
        {
            try
            {
                SQLiteVirtualTable table = TableFromIntPtr(pVtab);

                if (table != null)
                {
                    return Rename(table,
                        SQLiteString.StringFromUtf8IntPtr(zNew));
                }
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xSavepoint" /> method.
        /// </summary>
        /// <param name="pVtab">
        /// See the <see cref="ISQLiteNativeModule.xSavepoint" /> method.
        /// </param>
        /// <param name="iSavepoint">
        /// See the <see cref="ISQLiteNativeModule.xSavepoint" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xSavepoint" /> method.
        /// </returns>
        private SQLiteErrorCode xSavepoint(
            IntPtr pVtab,
            int iSavepoint
            )
        {
            try
            {
                SQLiteVirtualTable table = TableFromIntPtr(pVtab);

                if (table != null)
                    return Savepoint(table, iSavepoint);
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xRelease" /> method.
        /// </summary>
        /// <param name="pVtab">
        /// See the <see cref="ISQLiteNativeModule.xRelease" /> method.
        /// </param>
        /// <param name="iSavepoint">
        /// See the <see cref="ISQLiteNativeModule.xRelease" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xRelease" /> method.
        /// </returns>
        private SQLiteErrorCode xRelease(
            IntPtr pVtab,
            int iSavepoint
            )
        {
            try
            {
                SQLiteVirtualTable table = TableFromIntPtr(pVtab);

                if (table != null)
                    return Release(table, iSavepoint);
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteNativeModule.xRollbackTo" /> method.
        /// </summary>
        /// <param name="pVtab">
        /// See the <see cref="ISQLiteNativeModule.xRollbackTo" /> method.
        /// </param>
        /// <param name="iSavepoint">
        /// See the <see cref="ISQLiteNativeModule.xRollbackTo" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteNativeModule.xRollbackTo" /> method.
        /// </returns>
        private SQLiteErrorCode xRollbackTo(
            IntPtr pVtab,
            int iSavepoint
            )
        {
            try
            {
                SQLiteVirtualTable table = TableFromIntPtr(pVtab);

                if (table != null)
                    return RollbackTo(table, iSavepoint);
            }
            catch (Exception e) /* NOTE: Must catch ALL. */
            {
                SetTableError(pVtab, e.ToString());
            }

            return SQLiteErrorCode.Error;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteManagedModule Members
        private bool declared;
        /// <summary>
        /// Returns non-zero if the schema for the virtual table has been
        /// declared.
        /// </summary>
        public virtual bool Declared
        {
            get { CheckDisposed(); return declared; }
            internal set { declared = value; }
        }

        ///////////////////////////////////////////////////////////////////////

        private string name;
        /// <summary>
        /// Returns the name of the module as it was registered with the SQLite
        /// core library.
        /// </summary>
        public virtual string Name
        {
            get { CheckDisposed(); return name; }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xCreate" /> method.
        /// </summary>
        /// <param name="connection">
        /// The <see cref="SQLiteConnection" /> object instance associated with
        /// the virtual table.
        /// </param>
        /// <param name="pClientData">
        /// The native user-data pointer associated with this module, as it was
        /// provided to the SQLite core library when the native module instance
        /// was created.
        /// </param>
        /// <param name="arguments">
        /// The module name, database name, virtual table name, and all other
        /// arguments passed to the CREATE VIRTUAL TABLE statement.
        /// </param>
        /// <param name="table">
        /// Upon success, this parameter must be modified to contain the
        /// <see cref="SQLiteVirtualTable" /> object instance associated with
        /// the virtual table.
        /// </param>
        /// <param name="error">
        /// Upon failure, this parameter must be modified to contain an error
        /// message.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode Create(
            SQLiteConnection connection,
            IntPtr pClientData,
            string[] arguments,
            ref SQLiteVirtualTable table,
            ref string error
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xConnect" /> method.
        /// </summary>
        /// <param name="connection">
        /// The <see cref="SQLiteConnection" /> object instance associated with
        /// the virtual table.
        /// </param>
        /// <param name="pClientData">
        /// The native user-data pointer associated with this module, as it was
        /// provided to the SQLite core library when the native module instance
        /// was created.
        /// </param>
        /// <param name="arguments">
        /// The module name, database name, virtual table name, and all other
        /// arguments passed to the CREATE VIRTUAL TABLE statement.
        /// </param>
        /// <param name="table">
        /// Upon success, this parameter must be modified to contain the
        /// <see cref="SQLiteVirtualTable" /> object instance associated with
        /// the virtual table.
        /// </param>
        /// <param name="error">
        /// Upon failure, this parameter must be modified to contain an error
        /// message.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode Connect(
            SQLiteConnection connection,
            IntPtr pClientData,
            string[] arguments,
            ref SQLiteVirtualTable table,
            ref string error
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xBestIndex" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <param name="index">
        /// The <see cref="SQLiteIndex" /> object instance containing all the
        /// data for the inputs and outputs relating to index selection.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode BestIndex(
            SQLiteVirtualTable table,
            SQLiteIndex index
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xDisconnect" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode Disconnect(
            SQLiteVirtualTable table
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xDestroy" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode Destroy(
            SQLiteVirtualTable table
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xOpen" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <param name="cursor">
        /// Upon success, this parameter must be modified to contain the
        /// <see cref="SQLiteVirtualTableCursor" /> object instance associated
        /// with the newly opened virtual table cursor.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode Open(
            SQLiteVirtualTable table,
            ref SQLiteVirtualTableCursor cursor
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xClose" /> method.
        /// </summary>
        /// <param name="cursor">
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance
        /// associated with the previously opened virtual table cursor to be
        /// used.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode Close(
            SQLiteVirtualTableCursor cursor
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xFilter" /> method.
        /// </summary>
        /// <param name="cursor">
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance
        /// associated with the previously opened virtual table cursor to be
        /// used.
        /// </param>
        /// <param name="indexNumber">
        /// Number used to help identify the selected index.
        /// </param>
        /// <param name="indexString">
        /// String used to help identify the selected index.
        /// </param>
        /// <param name="values">
        /// The values corresponding to each column in the selected index.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode Filter(
            SQLiteVirtualTableCursor cursor,
            int indexNumber,
            string indexString,
            SQLiteValue[] values
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xNext" /> method.
        /// </summary>
        /// <param name="cursor">
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance
        /// associated with the previously opened virtual table cursor to be
        /// used.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode Next(
            SQLiteVirtualTableCursor cursor
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xEof" /> method.
        /// </summary>
        /// <param name="cursor">
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance
        /// associated with the previously opened virtual table cursor to be
        /// used.
        /// </param>
        /// <returns>
        /// Non-zero if no more rows are available; zero otherwise.
        /// </returns>
        public abstract bool Eof(
            SQLiteVirtualTableCursor cursor
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xColumn" /> method.
        /// </summary>
        /// <param name="cursor">
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance
        /// associated with the previously opened virtual table cursor to be
        /// used.
        /// </param>
        /// <param name="context">
        /// The <see cref="SQLiteContext" /> object instance to be used for
        /// returning the specified column value to the SQLite core library.
        /// </param>
        /// <param name="index">
        /// The zero-based index corresponding to the column containing the
        /// value to be returned.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode Column(
            SQLiteVirtualTableCursor cursor,
            SQLiteContext context,
            int index
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xRowId" /> method.
        /// </summary>
        /// <param name="cursor">
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance
        /// associated with the previously opened virtual table cursor to be
        /// used.
        /// </param>
        /// <param name="rowId">
        /// Upon success, this parameter must be modified to contain the unique
        /// integer row identifier for the current row for the specified cursor.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode RowId(
            SQLiteVirtualTableCursor cursor,
            ref long rowId
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xUpdate" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <param name="values">
        /// The array of <see cref="SQLiteValue" /> object instances containing
        /// the new or modified column values, if any.
        /// </param>
        /// <param name="rowId">
        /// Upon success, this parameter must be modified to contain the unique
        /// integer row identifier for the row that was inserted, if any.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode Update(
            SQLiteVirtualTable table,
            SQLiteValue[] values,
            ref long rowId
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xBegin" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode Begin(
            SQLiteVirtualTable table
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xSync" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode Sync(
            SQLiteVirtualTable table
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xCommit" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode Commit(
            SQLiteVirtualTable table
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xRollback" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode Rollback(
            SQLiteVirtualTable table
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xFindFunction" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <param name="argumentCount">
        /// The number of arguments to the function being sought.
        /// </param>
        /// <param name="name">
        /// The name of the function being sought.
        /// </param>
        /// <param name="function">
        /// Upon success, this parameter must be modified to contain the
        /// <see cref="SQLiteFunction" /> object instance responsible for
        /// implementing the specified function.
        /// </param>
        /// <param name="pClientData">
        /// Upon success, this parameter must be modified to contain the
        /// native user-data pointer associated with
        /// <paramref name="function" />.
        /// </param>
        /// <returns>
        /// Non-zero if the specified function was found; zero otherwise.
        /// </returns>
        public abstract bool FindFunction(
            SQLiteVirtualTable table,
            int argumentCount,
            string name,
            ref SQLiteFunction function,
            ref IntPtr pClientData
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xRename" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <param name="newName">
        /// The new name for the virtual table.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode Rename(
            SQLiteVirtualTable table,
            string newName
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xSavepoint" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <param name="savepoint">
        /// This is an integer identifier under which the the current state of
        /// the virtual table should be saved.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode Savepoint(
            SQLiteVirtualTable table,
            int savepoint
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xRelease" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <param name="savepoint">
        /// This is an integer used to indicate that any saved states with an
        /// identifier greater than or equal to this should be deleted by the
        /// virtual table.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode Release(
            SQLiteVirtualTable table,
            int savepoint
            );

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is called in response to the
        /// <see cref="ISQLiteNativeModule.xRollbackTo" /> method.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this virtual table.
        /// </param>
        /// <param name="savepoint">
        /// This is an integer identifier used to specify a specific saved
        /// state for the virtual table for it to restore itself back to, which
        /// should also have the effect of deleting all saved states with an
        /// integer identifier greater than this one.
        /// </param>
        /// <returns>
        /// A standard SQLite return code.
        /// </returns>
        public abstract SQLiteErrorCode RollbackTo(
            SQLiteVirtualTable table,
            int savepoint
            );
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable Members
        /// <summary>
        /// Disposes of this object instance.
        /// </summary>
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        private bool disposed;
        /// <summary>
        /// Throws an <see cref="ObjectDisposedException" /> if this object
        /// instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteModule).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this method is being called from the
        /// <see cref="Dispose()" /> method.  Zero if this method is being
        /// called from the finalizer.
        /// </param>
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    ////////////////////////////////////
                    // dispose managed resources here...
                    ////////////////////////////////////

                    if (functions != null)
                        functions.Clear();
                }

                //////////////////////////////////////
                // release unmanaged resources here...
                //////////////////////////////////////

                try
                {
                    if (disposableModule != IntPtr.Zero)
                    {
                        UnsafeNativeMethods.sqlite3_dispose_module(
                            disposableModule);

                        disposableModule = IntPtr.Zero;
                    }
                }
                catch (Exception e)
                {
                    try
                    {
                        if (LogExceptionsNoThrow)
                        {
                            SQLiteLog.LogMessage(SQLiteBase.COR_E_EXCEPTION,
                                HelperMethods.StringFormat(
                                CultureInfo.CurrentCulture,
                                UnsafeNativeMethods.ExceptionMessageFormat,
                                "Dispose", e)); /* throw */
                        }
                    }
                    catch
                    {
                        // do nothing.
                    }
                }
#if PLATFORM_COMPACTFRAMEWORK
                finally
                {
                    if (pNativeModule != IntPtr.Zero)
                    {
                        SQLiteMemory.Free(pNativeModule);
                        pNativeModule = IntPtr.Zero;
                    }
                }
#endif

                disposed = true;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Destructor
        /// <summary>
        /// Finalizes this object instance.
        /// </summary>
        ~SQLiteModule()
        {
            Dispose(false);
        }
        #endregion
    }
    #endregion
}

Added System.Data.SQLite/SQLiteModuleCommon.cs.





























































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Joe Mistachkin (joe@mistachkin.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System.Globalization;

#region Non-Generic Classes
namespace System.Data.SQLite
{
    #region SQLiteModuleCommon Class
    /// <summary>
    /// This class contains some virtual methods that may be useful for other
    /// virtual table classes.  It specifically does NOT implement any of the
    /// <see cref="ISQLiteManagedModule" /> interface methods.
    /// </summary>
    public class SQLiteModuleCommon : SQLiteModuleNoop /* NOT SEALED */
    {
        #region Private Constants
        /// <summary>
        /// The CREATE TABLE statement used to declare the schema for the
        /// virtual table.
        /// </summary>
        private static readonly string declareSql =
            HelperMethods.StringFormat(
                CultureInfo.InvariantCulture, "CREATE TABLE {0}(x);",
                typeof(SQLiteModuleCommon).Name);
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Data
        /// <summary>
        /// Non-zero if different object instances with the same value should
        /// generate different row identifiers, where applicable.  This has no
        /// effect on the .NET Compact Framework.
        /// </summary>
        private bool objectIdentity;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        /// <summary>
        /// Constructs an instance of this class.
        /// </summary>
        /// <param name="name">
        /// The name of the module.  This parameter cannot be null.
        /// </param>
        public SQLiteModuleCommon(
            string name
            )
            : this(name, false)
        {
            // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Constructs an instance of this class.
        /// </summary>
        /// <param name="name">
        /// The name of the module.  This parameter cannot be null.
        /// </param>
        /// <param name="objectIdentity">
        /// Non-zero if different object instances with the same value should
        /// generate different row identifiers, where applicable.  This
        /// parameter has no effect on the .NET Compact Framework.
        /// </param>
        public SQLiteModuleCommon(
            string name,
            bool objectIdentity
            )
            : base(name)
        {
            this.objectIdentity = objectIdentity;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Protected Methods
        /// <summary>
        /// Determines the SQL statement used to declare the virtual table.
        /// This method should be overridden in derived classes if they require
        /// a custom virtual table schema.
        /// </summary>
        /// <returns>
        /// The SQL statement used to declare the virtual table -OR- null if it
        /// cannot be determined.
        /// </returns>
        protected virtual string GetSqlForDeclareTable()
        {
            return declareSql;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Sets the table error message to one that indicates the virtual
        /// table cursor is of the wrong type.
        /// </summary>
        /// <param name="cursor">
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance.
        /// </param>
        /// <param name="type">
        /// The <see cref="Type" /> that the virtual table cursor should be.
        /// </param>
        /// <returns>
        /// The value of <see cref="SQLiteErrorCode.Error" />.
        /// </returns>
        protected virtual SQLiteErrorCode CursorTypeMismatchError(
            SQLiteVirtualTableCursor cursor,
            Type type
            )
        {
            if (type != null)
            {
                SetCursorError(cursor, HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture, "not a \"{0}\" cursor",
                    type));
            }
            else
            {
                SetCursorError(cursor, "cursor type mismatch");
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Determines the string to return as the column value for the object
        /// instance value.
        /// </summary>
        /// <param name="cursor">
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance
        /// associated with the previously opened virtual table cursor to be
        /// used.
        /// </param>
        /// <param name="value">
        /// The object instance to return a string representation for.
        /// </param>
        /// <returns>
        /// The string representation of the specified object instance or null
        /// upon failure.
        /// </returns>
        protected virtual string GetStringFromObject(
            SQLiteVirtualTableCursor cursor,
            object value
            )
        {
            if (value == null)
                return null;

            if (value is string)
                return (string)value;

            return value.ToString();
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Constructs an <see cref="Int64" /> unique row identifier from two
        /// <see cref="Int32" /> values.  The first <see cref="Int32" /> value
        /// must contain the row sequence number for the current row and the
        /// second value must contain the hash code of the key column value
        /// for the current row.
        /// </summary>
        /// <param name="rowIndex">
        /// The integer row sequence number for the current row.
        /// </param>
        /// <param name="hashCode">
        /// The hash code of the key column value for the current row.
        /// </param>
        /// <returns>
        /// The unique row identifier or zero upon failure.
        /// </returns>
        protected virtual long MakeRowId(
            int rowIndex,
            int hashCode
            )
        {
            long result = rowIndex;

            result <<= 32; /* typeof(int) bits */
            result |= (long)(uint)hashCode;

            return result;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Determines the unique row identifier for the current row.
        /// </summary>
        /// <param name="cursor">
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance
        /// associated with the previously opened virtual table cursor to be
        /// used.
        /// </param>
        /// <param name="value">
        /// The object instance to return a unique row identifier for.
        /// </param>
        /// <returns>
        /// The unique row identifier or zero upon failure.
        /// </returns>
        protected virtual long GetRowIdFromObject(
            SQLiteVirtualTableCursor cursor,
            object value
            )
        {
            int rowIndex = (cursor != null) ? cursor.GetRowIndex() : 0;
            int hashCode = SQLiteMarshal.GetHashCode(value, objectIdentity);

            return MakeRowId(rowIndex, hashCode);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        private bool disposed;
        /// <summary>
        /// Throws an <see cref="ObjectDisposedException" /> if this object
        /// instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteModuleCommon).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this method is being called from the
        /// <see cref="IDisposable.Dispose" /> method.  Zero if this method is
        /// being called from the finalizer.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    //if (disposing)
                    //{
                    //    ////////////////////////////////////
                    //    // dispose managed resources here...
                    //    ////////////////////////////////////
                    //}

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////
                }
            }
            finally
            {
                base.Dispose(disposing);

                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion
    }
    #endregion
}
#endregion

Added System.Data.SQLite/SQLiteModuleEnumerable.cs.

























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Joe Mistachkin (joe@mistachkin.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System.Collections;
using System.Collections.Generic;
using System.Globalization;

#region Non-Generic Classes
namespace System.Data.SQLite
{
    #region SQLiteVirtualTableCursorEnumerator Class
    /// <summary>
    /// This class represents a virtual table cursor to be used with the
    /// <see cref="SQLiteModuleEnumerable" /> class.  It is not sealed and may
    /// be used as the base class for any user-defined virtual table cursor
    /// class that wraps an <see cref="IEnumerator" /> object instance.
    /// </summary>
    public class SQLiteVirtualTableCursorEnumerator :
            SQLiteVirtualTableCursor, IEnumerator /* NOT SEALED */
    {
        #region Private Data
        /// <summary>
        /// The <see cref="IEnumerator" /> instance provided when this cursor
        /// was created.
        /// </summary>
        private IEnumerator enumerator;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This value will be non-zero if false has been returned from the
        /// <see cref="IEnumerator.MoveNext" /> method.
        /// </summary>
        private bool endOfEnumerator;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        /// <summary>
        /// Constructs an instance of this class.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this object instance.
        /// </param>
        /// <param name="enumerator">
        /// The <see cref="IEnumerator" /> instance to expose as a virtual
        /// table cursor.
        /// </param>
        public SQLiteVirtualTableCursorEnumerator(
            SQLiteVirtualTable table,
            IEnumerator enumerator
            )
            : base(table)
        {
            this.enumerator = enumerator;
            this.endOfEnumerator = true;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Members
        /// <summary>
        /// Advances to the next row of the virtual table cursor using the
        /// <see cref="IEnumerator.MoveNext" /> method of the
        /// <see cref="IEnumerator" /> object instance.
        /// </summary>
        /// <returns>
        /// Non-zero if the current row is valid; zero otherwise.  If zero is
        /// returned, no further rows are available.
        /// </returns>
        public virtual bool MoveNext()
        {
            CheckDisposed();
            CheckClosed();

            if (enumerator == null)
                return false;

            endOfEnumerator = !enumerator.MoveNext();

            if (!endOfEnumerator)
                NextRowIndex();

            return !endOfEnumerator;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Returns the value for the current row of the virtual table cursor
        /// using the <see cref="IEnumerator.Current" /> property of the
        /// <see cref="IEnumerator" /> object instance.
        /// </summary>
        public virtual object Current
        {
            get
            {
                CheckDisposed();
                CheckClosed();

                if (enumerator == null)
                    return null;

                return enumerator.Current;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Resets the virtual table cursor position, also invalidating the
        /// current row, using the <see cref="IEnumerator.Reset" /> method of
        /// the <see cref="IEnumerator" /> object instance.
        /// </summary>
        public virtual void Reset()
        {
            CheckDisposed();
            CheckClosed();

            if (enumerator == null)
                return;

            enumerator.Reset();
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Returns non-zero if the end of the virtual table cursor has been
        /// seen (i.e. no more rows are available, including the current one).
        /// </summary>
        public virtual bool EndOfEnumerator
        {
            get { CheckDisposed(); CheckClosed(); return endOfEnumerator; }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Returns non-zero if the virtual table cursor is open.
        /// </summary>
        public virtual bool IsOpen
        {
            get { CheckDisposed(); return (enumerator != null); }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Closes the virtual table cursor.  This method must not throw any
        /// exceptions.
        /// </summary>
        public virtual void Close()
        {
            // CheckDisposed();
            // CheckClosed();

            if (enumerator != null)
                enumerator = null;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Throws an <see cref="InvalidOperationException" /> if the virtual
        /// table cursor has been closed.
        /// </summary>
        public virtual void CheckClosed()
        {
            CheckDisposed();

            if (!IsOpen)
            {
                throw new InvalidOperationException(
                    "virtual table cursor is closed");
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        private bool disposed;
        /// <summary>
        /// Throws an <see cref="ObjectDisposedException" /> if this object
        /// instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteVirtualTableCursorEnumerator).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this method is being called from the
        /// <see cref="IDisposable.Dispose" /> method.  Zero if this method is
        /// being called from the finalizer.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    //if (disposing)
                    //{
                    //    ////////////////////////////////////
                    //    // dispose managed resources here...
                    //    ////////////////////////////////////
                    //}

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////

                    Close();
                }
            }
            finally
            {
                base.Dispose(disposing);

                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteModuleEnumerable Class
    /// <summary>
    /// This class implements a virtual table module that exposes an
    /// <see cref="IEnumerable" /> object instance as a read-only virtual
    /// table.  It is not sealed and may be used as the base class for any
    /// user-defined virtual table class that wraps an
    /// <see cref="IEnumerable" /> object instance.  The following short
    /// example shows it being used to treat an array of strings as a table
    /// data source:
    /// <code>
    ///   public static class Sample
    ///   {
    ///     public static void Main()
    ///     {
    ///       using (SQLiteConnection connection = new SQLiteConnection(
    ///           "Data Source=:memory:;"))
    ///       {
    ///         connection.Open();
    ///
    ///         connection.CreateModule(new SQLiteModuleEnumerable(
    ///           "sampleModule", new string[] { "one", "two", "three" }));
    ///
    ///         using (SQLiteCommand command = connection.CreateCommand())
    ///         {
    ///           command.CommandText =
    ///               "CREATE VIRTUAL TABLE t1 USING sampleModule;";
    ///
    ///           command.ExecuteNonQuery();
    ///         }
    ///
    ///         using (SQLiteCommand command = connection.CreateCommand())
    ///         {
    ///           command.CommandText = "SELECT * FROM t1;";
    ///
    ///           using (SQLiteDataReader dataReader = command.ExecuteReader())
    ///           {
    ///             while (dataReader.Read())
    ///               Console.WriteLine(dataReader[0].ToString());
    ///           }
    ///         }
    ///
    ///         connection.Close();
    ///       }
    ///     }
    ///   }
    /// </code>
    /// </summary>
    public class SQLiteModuleEnumerable : SQLiteModuleCommon /* NOT SEALED */
    {
        #region Private Data
        /// <summary>
        /// The <see cref="IEnumerable" /> instance containing the backing data
        /// for the virtual table.
        /// </summary>
        private IEnumerable enumerable;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        /// <summary>
        /// Constructs an instance of this class.
        /// </summary>
        /// <param name="name">
        /// The name of the module.  This parameter cannot be null.
        /// </param>
        /// <param name="enumerable">
        /// The <see cref="IEnumerable" /> instance to expose as a virtual
        /// table.  This parameter cannot be null.
        /// </param>
        public SQLiteModuleEnumerable(
            string name,
            IEnumerable enumerable
            )
            : this(name, enumerable, false)
        {
            // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Constructs an instance of this class.
        /// </summary>
        /// <param name="name">
        /// The name of the module.  This parameter cannot be null.
        /// </param>
        /// <param name="enumerable">
        /// The <see cref="IEnumerable" /> instance to expose as a virtual
        /// table.  This parameter cannot be null.
        /// </param>
        /// <param name="objectIdentity">
        /// Non-zero if different object instances with the same value should
        /// generate different row identifiers, where applicable.  This
        /// parameter has no effect on the .NET Compact Framework.
        /// </param>
        public SQLiteModuleEnumerable(
            string name,
            IEnumerable enumerable,
            bool objectIdentity
            )
            : base(name, objectIdentity)
        {
            if (enumerable == null)
                throw new ArgumentNullException("enumerable");

            this.enumerable = enumerable;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Protected Methods
        /// <summary>
        /// Sets the table error message to one that indicates the virtual
        /// table cursor has no current row.
        /// </summary>
        /// <param name="cursor">
        /// The <see cref="SQLiteVirtualTableCursor" /> object instance.
        /// </param>
        /// <returns>
        /// The value of <see cref="SQLiteErrorCode.Error" />.
        /// </returns>
        protected virtual SQLiteErrorCode CursorEndOfEnumeratorError(
            SQLiteVirtualTableCursor cursor
            )
        {
            SetCursorError(cursor, "already hit end of enumerator");
            return SQLiteErrorCode.Error;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteManagedModule Members
        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Create" /> method.
        /// </summary>
        /// <param name="connection">
        /// See the <see cref="ISQLiteManagedModule.Create" /> method.
        /// </param>
        /// <param name="pClientData">
        /// See the <see cref="ISQLiteManagedModule.Create" /> method.
        /// </param>
        /// <param name="arguments">
        /// See the <see cref="ISQLiteManagedModule.Create" /> method.
        /// </param>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Create" /> method.
        /// </param>
        /// <param name="error">
        /// See the <see cref="ISQLiteManagedModule.Create" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Create" /> method.
        /// </returns>
        public override SQLiteErrorCode Create(
            SQLiteConnection connection,
            IntPtr pClientData,
            string[] arguments,
            ref SQLiteVirtualTable table,
            ref string error
            )
        {
            CheckDisposed();

            if (DeclareTable(
                    connection, GetSqlForDeclareTable(),
                    ref error) == SQLiteErrorCode.Ok)
            {
                table = new SQLiteVirtualTable(arguments);
                return SQLiteErrorCode.Ok;
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Connect" /> method.
        /// </summary>
        /// <param name="connection">
        /// See the <see cref="ISQLiteManagedModule.Connect" /> method.
        /// </param>
        /// <param name="pClientData">
        /// See the <see cref="ISQLiteManagedModule.Connect" /> method.
        /// </param>
        /// <param name="arguments">
        /// See the <see cref="ISQLiteManagedModule.Connect" /> method.
        /// </param>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Connect" /> method.
        /// </param>
        /// <param name="error">
        /// See the <see cref="ISQLiteManagedModule.Connect" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Connect" /> method.
        /// </returns>
        public override SQLiteErrorCode Connect(
            SQLiteConnection connection,
            IntPtr pClientData,
            string[] arguments,
            ref SQLiteVirtualTable table,
            ref string error
            )
        {
            CheckDisposed();

            if (DeclareTable(
                    connection, GetSqlForDeclareTable(),
                    ref error) == SQLiteErrorCode.Ok)
            {
                table = new SQLiteVirtualTable(arguments);
                return SQLiteErrorCode.Ok;
            }

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method.
        /// </param>
        /// <param name="index">
        /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method.
        /// </returns>
        public override SQLiteErrorCode BestIndex(
            SQLiteVirtualTable table,
            SQLiteIndex index
            )
        {
            CheckDisposed();

            if (!table.BestIndex(index))
            {
                SetTableError(table, HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "failed to select best index for virtual table \"{0}\"",
                    table.TableName));

                return SQLiteErrorCode.Error;
            }

            return SQLiteErrorCode.Ok;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Disconnect" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Disconnect" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Disconnect" /> method.
        /// </returns>
        public override SQLiteErrorCode Disconnect(
            SQLiteVirtualTable table
            )
        {
            CheckDisposed();

            table.Dispose();
            return SQLiteErrorCode.Ok;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Destroy" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Destroy" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Destroy" /> method.
        /// </returns>
        public override SQLiteErrorCode Destroy(
            SQLiteVirtualTable table
            )
        {
            CheckDisposed();

            table.Dispose();
            return SQLiteErrorCode.Ok;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Open" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Open" /> method.
        /// </param>
        /// <param name="cursor">
        /// See the <see cref="ISQLiteManagedModule.Open" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Open" /> method.
        /// </returns>
        public override SQLiteErrorCode Open(
            SQLiteVirtualTable table,
            ref SQLiteVirtualTableCursor cursor
            )
        {
            CheckDisposed();

            cursor = new SQLiteVirtualTableCursorEnumerator(
                table, enumerable.GetEnumerator());

            return SQLiteErrorCode.Ok;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Close" /> method.
        /// </summary>
        /// <param name="cursor">
        /// See the <see cref="ISQLiteManagedModule.Close" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Close" /> method.
        /// </returns>
        public override SQLiteErrorCode Close(
            SQLiteVirtualTableCursor cursor
            )
        {
            CheckDisposed();

            SQLiteVirtualTableCursorEnumerator enumeratorCursor =
                cursor as SQLiteVirtualTableCursorEnumerator;

            if (enumeratorCursor == null)
            {
                return CursorTypeMismatchError(cursor,
                    typeof(SQLiteVirtualTableCursorEnumerator));
            }

            enumeratorCursor.Close();
            return SQLiteErrorCode.Ok;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Filter" /> method.
        /// </summary>
        /// <param name="cursor">
        /// See the <see cref="ISQLiteManagedModule.Filter" /> method.
        /// </param>
        /// <param name="indexNumber">
        /// See the <see cref="ISQLiteManagedModule.Filter" /> method.
        /// </param>
        /// <param name="indexString">
        /// See the <see cref="ISQLiteManagedModule.Filter" /> method.
        /// </param>
        /// <param name="values">
        /// See the <see cref="ISQLiteManagedModule.Filter" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Filter" /> method.
        /// </returns>
        public override SQLiteErrorCode Filter(
            SQLiteVirtualTableCursor cursor,
            int indexNumber,
            string indexString,
            SQLiteValue[] values
            )
        {
            CheckDisposed();

            SQLiteVirtualTableCursorEnumerator enumeratorCursor =
                cursor as SQLiteVirtualTableCursorEnumerator;

            if (enumeratorCursor == null)
            {
                return CursorTypeMismatchError(cursor,
                    typeof(SQLiteVirtualTableCursorEnumerator));
            }

            enumeratorCursor.Filter(indexNumber, indexString, values);
            enumeratorCursor.Reset(); /* NO RESULT */
            enumeratorCursor.MoveNext(); /* IGNORED */

            return SQLiteErrorCode.Ok;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Next" /> method.
        /// </summary>
        /// <param name="cursor">
        /// See the <see cref="ISQLiteManagedModule.Next" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Next" /> method.
        /// </returns>
        public override SQLiteErrorCode Next(
            SQLiteVirtualTableCursor cursor
            )
        {
            CheckDisposed();

            SQLiteVirtualTableCursorEnumerator enumeratorCursor =
                cursor as SQLiteVirtualTableCursorEnumerator;

            if (enumeratorCursor == null)
            {
                return CursorTypeMismatchError(cursor,
                    typeof(SQLiteVirtualTableCursorEnumerator));
            }

            if (enumeratorCursor.EndOfEnumerator)
                return CursorEndOfEnumeratorError(cursor);

            enumeratorCursor.MoveNext(); /* IGNORED */
            return SQLiteErrorCode.Ok;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Eof" /> method.
        /// </summary>
        /// <param name="cursor">
        /// See the <see cref="ISQLiteManagedModule.Eof" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Eof" /> method.
        /// </returns>
        public override bool Eof(
            SQLiteVirtualTableCursor cursor
            )
        {
            CheckDisposed();

            SQLiteVirtualTableCursorEnumerator enumeratorCursor =
                cursor as SQLiteVirtualTableCursorEnumerator;

            if (enumeratorCursor == null)
            {
                return ResultCodeToEofResult(CursorTypeMismatchError(
                    cursor, typeof(SQLiteVirtualTableCursorEnumerator)));
            }

            return enumeratorCursor.EndOfEnumerator;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </summary>
        /// <param name="cursor">
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </param>
        /// <param name="context">
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </param>
        /// <param name="index">
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </returns>
        public override SQLiteErrorCode Column(
            SQLiteVirtualTableCursor cursor,
            SQLiteContext context,
            int index
            )
        {
            CheckDisposed();

            SQLiteVirtualTableCursorEnumerator enumeratorCursor =
                cursor as SQLiteVirtualTableCursorEnumerator;

            if (enumeratorCursor == null)
            {
                return CursorTypeMismatchError(cursor,
                    typeof(SQLiteVirtualTableCursorEnumerator));
            }

            if (enumeratorCursor.EndOfEnumerator)
                return CursorEndOfEnumeratorError(cursor);

            object current = enumeratorCursor.Current;

            if (current != null)
                context.SetString(GetStringFromObject(cursor, current));
            else
                context.SetNull();

            return SQLiteErrorCode.Ok;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.RowId" /> method.
        /// </summary>
        /// <param name="cursor">
        /// See the <see cref="ISQLiteManagedModule.RowId" /> method.
        /// </param>
        /// <param name="rowId">
        /// See the <see cref="ISQLiteManagedModule.RowId" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.RowId" /> method.
        /// </returns>
        public override SQLiteErrorCode RowId(
            SQLiteVirtualTableCursor cursor,
            ref long rowId
            )
        {
            CheckDisposed();

            SQLiteVirtualTableCursorEnumerator enumeratorCursor =
                cursor as SQLiteVirtualTableCursorEnumerator;

            if (enumeratorCursor == null)
            {
                return CursorTypeMismatchError(cursor,
                    typeof(SQLiteVirtualTableCursorEnumerator));
            }

            if (enumeratorCursor.EndOfEnumerator)
                return CursorEndOfEnumeratorError(cursor);

            object current = enumeratorCursor.Current;

            rowId = GetRowIdFromObject(cursor, current);
            return SQLiteErrorCode.Ok;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Update" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Update" /> method.
        /// </param>
        /// <param name="values">
        /// See the <see cref="ISQLiteManagedModule.Update" /> method.
        /// </param>
        /// <param name="rowId">
        /// See the <see cref="ISQLiteManagedModule.Update" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Update" /> method.
        /// </returns>
        public override SQLiteErrorCode Update(
            SQLiteVirtualTable table,
            SQLiteValue[] values,
            ref long rowId
            )
        {
            CheckDisposed();

            SetTableError(table, HelperMethods.StringFormat(
                CultureInfo.CurrentCulture,
                "virtual table \"{0}\" is read-only", table.TableName));

            return SQLiteErrorCode.Error;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Rename" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Rename" /> method.
        /// </param>
        /// <param name="newName">
        /// See the <see cref="ISQLiteManagedModule.Rename" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Rename" /> method.
        /// </returns>
        public override SQLiteErrorCode Rename(
            SQLiteVirtualTable table,
            string newName
            )
        {
            CheckDisposed();

            if (!table.Rename(newName))
            {
                SetTableError(table, HelperMethods.StringFormat(
                    CultureInfo.CurrentCulture,
                    "failed to rename virtual table from \"{0}\" to \"{1}\"",
                    table.TableName, newName));

                return SQLiteErrorCode.Error;
            }

            return SQLiteErrorCode.Ok;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        private bool disposed;
        /// <summary>
        /// Throws an <see cref="ObjectDisposedException" /> if this object
        /// instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteModuleEnumerable).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this method is being called from the
        /// <see cref="IDisposable.Dispose" /> method.  Zero if this method is
        /// being called from the finalizer.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    //if (disposing)
                    //{
                    //    ////////////////////////////////////
                    //    // dispose managed resources here...
                    //    ////////////////////////////////////
                    //}

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////
                }
            }
            finally
            {
                base.Dispose(disposing);

                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion
    }
    #endregion
}
#endregion

///////////////////////////////////////////////////////////////////////////////

#region Generic Classes
namespace System.Data.SQLite.Generic
{
    #region SQLiteVirtualTableCursorEnumerator<T> Class
    /// <summary>
    /// This class represents a virtual table cursor to be used with the
    /// <see cref="SQLiteModuleEnumerable" /> class.  It is not sealed and may
    /// be used as the base class for any user-defined virtual table cursor
    /// class that wraps an <see cref="IEnumerator{T}" /> object instance.
    /// </summary>
    public class SQLiteVirtualTableCursorEnumerator<T> :
            SQLiteVirtualTableCursorEnumerator, IEnumerator<T> /* NOT SEALED */
    {
        #region Private Data
        /// <summary>
        /// The <see cref="IEnumerator{T}" /> instance provided when this
        /// cursor was created.
        /// </summary>
        private IEnumerator<T> enumerator;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        /// <summary>
        /// Constructs an instance of this class.
        /// </summary>
        /// <param name="table">
        /// The <see cref="SQLiteVirtualTable" /> object instance associated
        /// with this object instance.
        /// </param>
        /// <param name="enumerator">
        /// The <see cref="IEnumerator{T}" /> instance to expose as a virtual
        /// table cursor.
        /// </param>
        public SQLiteVirtualTableCursorEnumerator(
            SQLiteVirtualTable table,
            IEnumerator<T> enumerator
            )
            : base(table, enumerator as IEnumerator)
        {
            this.enumerator = enumerator;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Members
        /// <summary>
        /// Returns the value for the current row of the virtual table cursor
        /// using the <see cref="IEnumerator{T}.Current" /> property of the
        /// <see cref="IEnumerator{T}" /> object instance.
        /// </summary>
        T IEnumerator<T>.Current
        {
            get
            {
                CheckDisposed();
                CheckClosed();

                if (enumerator == null)
                    return default(T);

                return enumerator.Current;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Closes the virtual table cursor.  This method must not throw any
        /// exceptions.
        /// </summary>
        public override void Close()
        {
            // CheckDisposed();
            // CheckClosed();

            if (enumerator != null)
                enumerator = null;

            base.Close();
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        private bool disposed;
        /// <summary>
        /// Throws an <see cref="ObjectDisposedException" /> if this object
        /// instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteVirtualTableCursorEnumerator<T>).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this method is being called from the
        /// <see cref="IDisposable.Dispose" /> method.  Zero if this method is
        /// being called from the finalizer.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    //if (disposing)
                    //{
                    //    ////////////////////////////////////
                    //    // dispose managed resources here...
                    //    ////////////////////////////////////
                    //}

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////

                    Close();
                }
            }
            finally
            {
                base.Dispose(disposing);

                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteModuleEnumerable<T> Class
    /// <summary>
    /// This class implements a virtual table module that exposes an
    /// <see cref="IEnumerable{T}" /> object instance as a read-only virtual
    /// table.  It is not sealed and may be used as the base class for any
    /// user-defined virtual table class that wraps an
    /// <see cref="IEnumerable{T}" /> object instance.
    /// </summary>
    public class SQLiteModuleEnumerable<T> :
            SQLiteModuleEnumerable /* NOT SEALED */
    {
        #region Private Data
        /// <summary>
        /// The <see cref="IEnumerable{T}" /> instance containing the backing
        /// data for the virtual table.
        /// </summary>
        private IEnumerable<T> enumerable;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        /// <summary>
        /// Constructs an instance of this class.
        /// </summary>
        /// <param name="name">
        /// The name of the module.  This parameter cannot be null.
        /// </param>
        /// <param name="enumerable">
        /// The <see cref="IEnumerable{T}" /> instance to expose as a virtual
        /// table.  This parameter cannot be null.
        /// </param>
        public SQLiteModuleEnumerable(
            string name,
            IEnumerable<T> enumerable
            )
            : base(name, enumerable as IEnumerable)
        {
            this.enumerable = enumerable;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteManagedModule Members
        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Open" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Open" /> method.
        /// </param>
        /// <param name="cursor">
        /// See the <see cref="ISQLiteManagedModule.Open" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Open" /> method.
        /// </returns>
        public override SQLiteErrorCode Open(
            SQLiteVirtualTable table,
            ref SQLiteVirtualTableCursor cursor
            )
        {
            CheckDisposed();

            cursor = new SQLiteVirtualTableCursorEnumerator<T>(
                table, enumerable.GetEnumerator());

            return SQLiteErrorCode.Ok;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </summary>
        /// <param name="cursor">
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </param>
        /// <param name="context">
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </param>
        /// <param name="index">
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </returns>
        public override SQLiteErrorCode Column(
            SQLiteVirtualTableCursor cursor,
            SQLiteContext context,
            int index
            )
        {
            CheckDisposed();

            SQLiteVirtualTableCursorEnumerator<T> enumeratorCursor =
                cursor as SQLiteVirtualTableCursorEnumerator<T>;

            if (enumeratorCursor == null)
            {
                return CursorTypeMismatchError(cursor,
                    typeof(SQLiteVirtualTableCursorEnumerator));
            }

            if (enumeratorCursor.EndOfEnumerator)
                return CursorEndOfEnumeratorError(cursor);

            T current = ((IEnumerator<T>)enumeratorCursor).Current;

            if (current != null)
                context.SetString(GetStringFromObject(cursor, current));
            else
                context.SetNull();

            return SQLiteErrorCode.Ok;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        private bool disposed;
        /// <summary>
        /// Throws an <see cref="ObjectDisposedException" /> if this object
        /// instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteModuleEnumerable<T>).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this method is being called from the
        /// <see cref="IDisposable.Dispose" /> method.  Zero if this method is
        /// being called from the finalizer.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    //if (disposing)
                    //{
                    //    ////////////////////////////////////
                    //    // dispose managed resources here...
                    //    ////////////////////////////////////
                    //}

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////
                }
            }
            finally
            {
                base.Dispose(disposing);

                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion
    }
    #endregion
}
#endregion

Added System.Data.SQLite/SQLiteModuleNoop.cs.





































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Joe Mistachkin (joe@mistachkin.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System.Collections.Generic;

namespace System.Data.SQLite
{
    /// <summary>
    /// This class implements a virtual table module that does nothing by
    /// providing "empty" implementations for all of the
    /// <see cref="ISQLiteManagedModule" /> interface methods.  The result
    /// codes returned by these "empty" method implementations may be
    /// controlled on a per-method basis by using and/or overriding the
    /// <see cref="GetDefaultResultCode" />,
    /// <see cref="ResultCodeToEofResult" />,
    /// <see cref="ResultCodeToFindFunctionResult" />,
    /// <see cref="GetMethodResultCode" />, and
    /// <see cref="SetMethodResultCode" /> methods from within derived classes.
    /// </summary>
    public class SQLiteModuleNoop : SQLiteModule /* NOT SEALED */
    {
        #region Private Data
        /// <summary>
        /// This field is used to store the <see cref="SQLiteErrorCode" />
        /// values to return, on a per-method basis, for all methods that are
        /// part of the <see cref="ISQLiteManagedModule" /> interface.
        /// </summary>
        private Dictionary<string, SQLiteErrorCode> resultCodes;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        /// <summary>
        /// Constructs an instance of this class.
        /// </summary>
        /// <param name="name">
        /// The name of the module.  This parameter cannot be null.
        /// </param>
        public SQLiteModuleNoop(
            string name
            )
            : base(name)
        {
            resultCodes = new Dictionary<string, SQLiteErrorCode>();
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Protected Methods
        /// <summary>
        /// Determines the default <see cref="SQLiteErrorCode" /> value to be
        /// returned by methods of the <see cref="ISQLiteManagedModule" />
        /// interface that lack an overridden implementation in all classes
        /// derived from the <see cref="SQLiteModuleNoop" /> class.
        /// </summary>
        /// <returns>
        /// The <see cref="SQLiteErrorCode" /> value that should be returned
        /// by all <see cref="ISQLiteManagedModule" /> interface methods unless
        /// a more specific result code has been set for that interface method.
        /// </returns>
        protected virtual SQLiteErrorCode GetDefaultResultCode()
        {
            return SQLiteErrorCode.Ok;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Converts a <see cref="SQLiteErrorCode" /> value into a boolean
        /// return value for use with the
        /// <see cref="ISQLiteManagedModule.Eof" /> method.
        /// </summary>
        /// <param name="resultCode">
        /// The <see cref="SQLiteErrorCode" /> value to convert.
        /// </param>
        /// <returns>
        /// The <see cref="Boolean" /> value.
        /// </returns>
        protected virtual bool ResultCodeToEofResult(
            SQLiteErrorCode resultCode
            )
        {
            return (resultCode == SQLiteErrorCode.Ok) ? false : true;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Converts a <see cref="SQLiteErrorCode" /> value into a boolean
        /// return value for use with the
        /// <see cref="ISQLiteManagedModule.FindFunction" /> method.
        /// </summary>
        /// <param name="resultCode">
        /// The <see cref="SQLiteErrorCode" /> value to convert.
        /// </param>
        /// <returns>
        /// The <see cref="Boolean" /> value.
        /// </returns>
        protected virtual bool ResultCodeToFindFunctionResult(
            SQLiteErrorCode resultCode
            )
        {
            return (resultCode == SQLiteErrorCode.Ok) ? true : false;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Determines the <see cref="SQLiteErrorCode" /> value that should be
        /// returned by the specified <see cref="ISQLiteManagedModule" />
        /// interface method if it lack an overridden implementation.  If no
        /// specific <see cref="SQLiteErrorCode" /> value is available (or set)
        /// for the specified method, the <see cref="SQLiteErrorCode" /> value
        /// returned by the <see cref="GetDefaultResultCode" /> method will be
        /// returned instead.
        /// </summary>
        /// <param name="methodName">
        /// The name of the method.  Currently, this method must be part of
        /// the <see cref="ISQLiteManagedModule" /> interface.
        /// </param>
        /// <returns>
        /// The <see cref="SQLiteErrorCode" /> value that should be returned
        /// by the <see cref="ISQLiteManagedModule" /> interface method.
        /// </returns>
        protected virtual SQLiteErrorCode GetMethodResultCode(
            string methodName
            )
        {
            if ((methodName == null) || (resultCodes == null))
                return GetDefaultResultCode();

            SQLiteErrorCode resultCode;

            if ((resultCodes != null) &&
                resultCodes.TryGetValue(methodName, out resultCode))
            {
                return resultCode;
            }

            return GetDefaultResultCode();
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Sets the <see cref="SQLiteErrorCode" /> value that should be
        /// returned by the specified <see cref="ISQLiteManagedModule" />
        /// interface method if it lack an overridden implementation.
        /// </summary>
        /// <param name="methodName">
        /// The name of the method.  Currently, this method must be part of
        /// the <see cref="ISQLiteManagedModule" /> interface.
        /// </param>
        /// <param name="resultCode">
        /// The <see cref="SQLiteErrorCode" /> value that should be returned
        /// by the <see cref="ISQLiteManagedModule" /> interface method.
        /// </param>
        /// <returns>
        /// Non-zero upon success.
        /// </returns>
        protected virtual bool SetMethodResultCode(
            string methodName,
            SQLiteErrorCode resultCode
            )
        {
            if ((methodName == null) || (resultCodes == null))
                return false;

            resultCodes[methodName] = resultCode;
            return true;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteManagedModule Members
        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Create" /> method.
        /// </summary>
        /// <param name="connection">
        /// See the <see cref="ISQLiteManagedModule.Create" /> method.
        /// </param>
        /// <param name="pClientData">
        /// See the <see cref="ISQLiteManagedModule.Create" /> method.
        /// </param>
        /// <param name="arguments">
        /// See the <see cref="ISQLiteManagedModule.Create" /> method.
        /// </param>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Create" /> method.
        /// </param>
        /// <param name="error">
        /// See the <see cref="ISQLiteManagedModule.Create" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Create" /> method.
        /// </returns>
        public override SQLiteErrorCode Create(
            SQLiteConnection connection,
            IntPtr pClientData,
            string[] arguments,
            ref SQLiteVirtualTable table,
            ref string error
            )
        {
            CheckDisposed();

            return GetMethodResultCode("Create");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Connect" /> method.
        /// </summary>
        /// <param name="connection">
        /// See the <see cref="ISQLiteManagedModule.Connect" /> method.
        /// </param>
        /// <param name="pClientData">
        /// See the <see cref="ISQLiteManagedModule.Connect" /> method.
        /// </param>
        /// <param name="arguments">
        /// See the <see cref="ISQLiteManagedModule.Connect" /> method.
        /// </param>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Connect" /> method.
        /// </param>
        /// <param name="error">
        /// See the <see cref="ISQLiteManagedModule.Connect" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Connect" /> method.
        /// </returns>
        public override SQLiteErrorCode Connect(
            SQLiteConnection connection,
            IntPtr pClientData,
            string[] arguments,
            ref SQLiteVirtualTable table,
            ref string error
            )
        {
            CheckDisposed();

            return GetMethodResultCode("Connect");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method.
        /// </param>
        /// <param name="index">
        /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.BestIndex" /> method.
        /// </returns>
        public override SQLiteErrorCode BestIndex(
            SQLiteVirtualTable table,
            SQLiteIndex index
            )
        {
            CheckDisposed();

            return GetMethodResultCode("BestIndex");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Disconnect" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Disconnect" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Disconnect" /> method.
        /// </returns>
        public override SQLiteErrorCode Disconnect(
            SQLiteVirtualTable table
            )
        {
            CheckDisposed();

            return GetMethodResultCode("Disconnect");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Destroy" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Destroy" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Destroy" /> method.
        /// </returns>
        public override SQLiteErrorCode Destroy(
            SQLiteVirtualTable table
            )
        {
            CheckDisposed();

            return GetMethodResultCode("Destroy");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Open" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Open" /> method.
        /// </param>
        /// <param name="cursor">
        /// See the <see cref="ISQLiteManagedModule.Open" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Open" /> method.
        /// </returns>
        public override SQLiteErrorCode Open(
            SQLiteVirtualTable table,
            ref SQLiteVirtualTableCursor cursor
            )
        {
            CheckDisposed();

            return GetMethodResultCode("Open");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Close" /> method.
        /// </summary>
        /// <param name="cursor">
        /// See the <see cref="ISQLiteManagedModule.Close" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Close" /> method.
        /// </returns>
        public override SQLiteErrorCode Close(
            SQLiteVirtualTableCursor cursor
            )
        {
            CheckDisposed();

            return GetMethodResultCode("Close");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Filter" /> method.
        /// </summary>
        /// <param name="cursor">
        /// See the <see cref="ISQLiteManagedModule.Filter" /> method.
        /// </param>
        /// <param name="indexNumber">
        /// See the <see cref="ISQLiteManagedModule.Filter" /> method.
        /// </param>
        /// <param name="indexString">
        /// See the <see cref="ISQLiteManagedModule.Filter" /> method.
        /// </param>
        /// <param name="values">
        /// See the <see cref="ISQLiteManagedModule.Filter" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Filter" /> method.
        /// </returns>
        public override SQLiteErrorCode Filter(
            SQLiteVirtualTableCursor cursor,
            int indexNumber,
            string indexString,
            SQLiteValue[] values
            )
        {
            CheckDisposed();

            return GetMethodResultCode("Filter");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Next" /> method.
        /// </summary>
        /// <param name="cursor">
        /// See the <see cref="ISQLiteManagedModule.Next" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Next" /> method.
        /// </returns>
        public override SQLiteErrorCode Next(
            SQLiteVirtualTableCursor cursor
            )
        {
            CheckDisposed();

            return GetMethodResultCode("Next");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Eof" /> method.
        /// </summary>
        /// <param name="cursor">
        /// See the <see cref="ISQLiteManagedModule.Eof" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Eof" /> method.
        /// </returns>
        public override bool Eof(
            SQLiteVirtualTableCursor cursor
            )
        {
            CheckDisposed();

            return ResultCodeToEofResult(GetMethodResultCode("Eof"));
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </summary>
        /// <param name="cursor">
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </param>
        /// <param name="context">
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </param>
        /// <param name="index">
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Column" /> method.
        /// </returns>
        public override SQLiteErrorCode Column(
            SQLiteVirtualTableCursor cursor,
            SQLiteContext context,
            int index
            )
        {
            CheckDisposed();

            return GetMethodResultCode("Column");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.RowId" /> method.
        /// </summary>
        /// <param name="cursor">
        /// See the <see cref="ISQLiteManagedModule.RowId" /> method.
        /// </param>
        /// <param name="rowId">
        /// See the <see cref="ISQLiteManagedModule.RowId" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.RowId" /> method.
        /// </returns>
        public override SQLiteErrorCode RowId(
            SQLiteVirtualTableCursor cursor,
            ref long rowId
            )
        {
            CheckDisposed();

            return GetMethodResultCode("RowId");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Update" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Update" /> method.
        /// </param>
        /// <param name="values">
        /// See the <see cref="ISQLiteManagedModule.Update" /> method.
        /// </param>
        /// <param name="rowId">
        /// See the <see cref="ISQLiteManagedModule.Update" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Update" /> method.
        /// </returns>
        public override SQLiteErrorCode Update(
            SQLiteVirtualTable table,
            SQLiteValue[] values,
            ref long rowId
            )
        {
            CheckDisposed();

            return GetMethodResultCode("Update");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Begin" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Begin" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Begin" /> method.
        /// </returns>
        public override SQLiteErrorCode Begin(
            SQLiteVirtualTable table
            )
        {
            CheckDisposed();

            return GetMethodResultCode("Begin");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Sync" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Sync" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Sync" /> method.
        /// </returns>
        public override SQLiteErrorCode Sync(
            SQLiteVirtualTable table
            )
        {
            CheckDisposed();

            return GetMethodResultCode("Sync");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Commit" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Commit" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Commit" /> method.
        /// </returns>
        public override SQLiteErrorCode Commit(
            SQLiteVirtualTable table
            )
        {
            CheckDisposed();

            return GetMethodResultCode("Commit");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Rollback" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Rollback" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Rollback" /> method.
        /// </returns>
        public override SQLiteErrorCode Rollback(
            SQLiteVirtualTable table
            )
        {
            CheckDisposed();

            return GetMethodResultCode("Rollback");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method.
        /// </param>
        /// <param name="argumentCount">
        /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method.
        /// </param>
        /// <param name="name">
        /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method.
        /// </param>
        /// <param name="function">
        /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method.
        /// </param>
        /// <param name="pClientData">
        /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.FindFunction" /> method.
        /// </returns>
        public override bool FindFunction(
            SQLiteVirtualTable table,
            int argumentCount,
            string name,
            ref SQLiteFunction function,
            ref IntPtr pClientData
            )
        {
            CheckDisposed();

            return ResultCodeToFindFunctionResult(GetMethodResultCode(
                "FindFunction"));
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Rename" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Rename" /> method.
        /// </param>
        /// <param name="newName">
        /// See the <see cref="ISQLiteManagedModule.Rename" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Rename" /> method.
        /// </returns>
        public override SQLiteErrorCode Rename(
            SQLiteVirtualTable table,
            string newName
            )
        {
            CheckDisposed();

            return GetMethodResultCode("Rename");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Savepoint" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Savepoint" /> method.
        /// </param>
        /// <param name="savepoint">
        /// See the <see cref="ISQLiteManagedModule.Savepoint" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Savepoint" /> method.
        /// </returns>
        public override SQLiteErrorCode Savepoint(
            SQLiteVirtualTable table,
            int savepoint
            )
        {
            CheckDisposed();

            return GetMethodResultCode("Savepoint");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.Release" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.Release" /> method.
        /// </param>
        /// <param name="savepoint">
        /// See the <see cref="ISQLiteManagedModule.Release" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.Release" /> method.
        /// </returns>
        public override SQLiteErrorCode Release(
            SQLiteVirtualTable table,
            int savepoint
            )
        {
            CheckDisposed();

            return GetMethodResultCode("Release");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// See the <see cref="ISQLiteManagedModule.RollbackTo" /> method.
        /// </summary>
        /// <param name="table">
        /// See the <see cref="ISQLiteManagedModule.RollbackTo" /> method.
        /// </param>
        /// <param name="savepoint">
        /// See the <see cref="ISQLiteManagedModule.RollbackTo" /> method.
        /// </param>
        /// <returns>
        /// See the <see cref="ISQLiteManagedModule.RollbackTo" /> method.
        /// </returns>
        public override SQLiteErrorCode RollbackTo(
            SQLiteVirtualTable table,
            int savepoint
            )
        {
            CheckDisposed();

            return GetMethodResultCode("RollbackTo");
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        private bool disposed;
        /// <summary>
        /// Throws an <see cref="ObjectDisposedException" /> if this object
        /// instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteModuleNoop).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this method is being called from the
        /// <see cref="IDisposable.Dispose" /> method.  Zero if this method is
        /// being called from the finalizer.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    //if (disposing)
                    //{
                    //    ////////////////////////////////////
                    //    // dispose managed resources here...
                    //    ////////////////////////////////////
                    //}

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////
                }
            }
            finally
            {
                base.Dispose(disposing);

                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion
    }
}

Changes to System.Data.SQLite/SQLiteParameter.cs.

13
14
15
16
17
18
19









20
21
22
23
24
25
26
27
28
29
30
  using System.ComponentModel;

  /// <summary>
  /// SQLite implementation of DbParameter.
  /// </summary>
  public sealed class SQLiteParameter : DbParameter, ICloneable
  {









    /// <summary>
    /// The data type of the parameter
    /// </summary>
    internal int            _dbType;
    /// <summary>
    /// The version information for mapping the parameter
    /// </summary>
    private DataRowVersion _rowVersion;
    /// <summary>
    /// The value of the data in the parameter
    /// </summary>







>
>
>
>
>
>
>
>
>



|







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
  using System.ComponentModel;

  /// <summary>
  /// SQLite implementation of DbParameter.
  /// </summary>
  public sealed class SQLiteParameter : DbParameter, ICloneable
  {
    /// <summary>
    /// This value represents an "unknown" <see cref="DbType" />.
    /// </summary>
    private const DbType UnknownDbType = (DbType)(-1);

    /// <summary>
    /// The command associated with this parameter.
    /// </summary>
    private IDbCommand     _command;
    /// <summary>
    /// The data type of the parameter
    /// </summary>
    internal DbType        _dbType;
    /// <summary>
    /// The version information for mapping the parameter
    /// </summary>
    private DataRowVersion _rowVersion;
    /// <summary>
    /// The value of the data in the parameter
    /// </summary>
40
41
42
43
44
45
46



















47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
    /// <summary>
    /// The data size, unused by SQLite
    /// </summary>
    private int            _dataSize;

    private bool           _nullable;
    private bool           _nullMapping;




















    /// <summary>
    /// Default constructor
    /// </summary>
    public SQLiteParameter() 
      : this(null, (DbType)(-1), 0, null, DataRowVersion.Current)
    {
    }

    /// <summary>
    /// Constructs a named parameter given the specified parameter name
    /// </summary>
    /// <param name="parameterName">The parameter name</param>
    public SQLiteParameter(string parameterName)
      : this(parameterName, (DbType)(-1), 0, null, DataRowVersion.Current)
    {
    }

    /// <summary>
    /// Constructs a named parameter given the specified parameter name and initial value
    /// </summary>
    /// <param name="parameterName">The parameter name</param>
    /// <param name="value">The initial value of the parameter</param>
    public SQLiteParameter(string parameterName, object value)
      : this(parameterName, (DbType)(-1), 0, null, DataRowVersion.Current)
    {
      Value = value;
    }

    /// <summary>
    /// Constructs a named parameter of the specified type
    /// </summary>







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





|








|









|







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
    /// <summary>
    /// The data size, unused by SQLite
    /// </summary>
    private int            _dataSize;

    private bool           _nullable;
    private bool           _nullMapping;

    /// <summary>
    /// The database type name associated with this parameter, if any.
    /// </summary>
    private string         _typeName;

    /// <summary>
    /// Constructor used when creating for use with a specific command.
    /// </summary>
    /// <param name="command">
    /// The command associated with this parameter.
    /// </param>
    internal SQLiteParameter(
        IDbCommand command
        )
        : this()
    {
        _command = command;
    }

    /// <summary>
    /// Default constructor
    /// </summary>
    public SQLiteParameter() 
      : this(null, UnknownDbType, 0, null, DataRowVersion.Current)
    {
    }

    /// <summary>
    /// Constructs a named parameter given the specified parameter name
    /// </summary>
    /// <param name="parameterName">The parameter name</param>
    public SQLiteParameter(string parameterName)
      : this(parameterName, UnknownDbType, 0, null, DataRowVersion.Current)
    {
    }

    /// <summary>
    /// Constructs a named parameter given the specified parameter name and initial value
    /// </summary>
    /// <param name="parameterName">The parameter name</param>
    /// <param name="value">The initial value of the parameter</param>
    public SQLiteParameter(string parameterName, object value)
      : this(parameterName, UnknownDbType, 0, null, DataRowVersion.Current)
    {
      Value = value;
    }

    /// <summary>
    /// Constructs a named parameter of the specified type
    /// </summary>
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
    /// <param name="parameterType">The data type</param>
    /// <param name="parameterSize">The size of the parameter</param>
    /// <param name="sourceColumn">The source column</param>
    /// <param name="rowVersion">The row version information</param>
    public SQLiteParameter(string parameterName, DbType parameterType, int parameterSize, string sourceColumn, DataRowVersion rowVersion)      
    {
      _parameterName = parameterName;
      _dbType = (int)parameterType;
      _sourceColumn = sourceColumn;
      _rowVersion = rowVersion;
      _dataSize = parameterSize;
      _nullable = true;
    }

    private SQLiteParameter(SQLiteParameter source)
      : this(source.ParameterName, (DbType)source._dbType, 0, source.Direction, source.IsNullable, 0, 0, source.SourceColumn, source.SourceVersion, source.Value)
    {
      _nullMapping = source._nullMapping;
    }

    /// <summary>
    /// Constructs a named parameter of the specified type, size, source column and row version
    /// </summary>







|







|







205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
    /// <param name="parameterType">The data type</param>
    /// <param name="parameterSize">The size of the parameter</param>
    /// <param name="sourceColumn">The source column</param>
    /// <param name="rowVersion">The row version information</param>
    public SQLiteParameter(string parameterName, DbType parameterType, int parameterSize, string sourceColumn, DataRowVersion rowVersion)      
    {
      _parameterName = parameterName;
      _dbType = parameterType;
      _sourceColumn = sourceColumn;
      _rowVersion = rowVersion;
      _dataSize = parameterSize;
      _nullable = true;
    }

    private SQLiteParameter(SQLiteParameter source)
      : this(source.ParameterName, source._dbType, 0, source.Direction, source.IsNullable, 0, 0, source.SourceColumn, source.SourceVersion, source.Value)
    {
      _nullMapping = source._nullMapping;
    }

    /// <summary>
    /// Constructs a named parameter of the specified type, size, source column and row version
    /// </summary>
270
271
272
273
274
275
276















277
278
279
280
281
282
283
    /// <param name="parameterSize">The size of the parameter</param>
    /// <param name="sourceColumn">The source column</param>
    /// <param name="rowVersion">The row version information</param>
    public SQLiteParameter(DbType parameterType, int parameterSize, string sourceColumn, DataRowVersion rowVersion)
      : this(null, parameterType, parameterSize, sourceColumn, rowVersion)
    {
    }
















    /// <summary>
    /// Whether or not the parameter can contain a null value
    /// </summary>
    public override bool IsNullable
    {
      get







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







298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
    /// <param name="parameterSize">The size of the parameter</param>
    /// <param name="sourceColumn">The source column</param>
    /// <param name="rowVersion">The row version information</param>
    public SQLiteParameter(DbType parameterType, int parameterSize, string sourceColumn, DataRowVersion rowVersion)
      : this(null, parameterType, parameterSize, sourceColumn, rowVersion)
    {
    }

    /// <summary>
    /// The command associated with this parameter.
    /// </summary>
    public IDbCommand Command
    {
      get
      {
        return _command;
      }
      set 
      {
        _command = value;
      }
    }

    /// <summary>
    /// Whether or not the parameter can contain a null value
    /// </summary>
    public override bool IsNullable
    {
      get
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
    [DbProviderSpecificTypeProperty(true)]
    [RefreshProperties(RefreshProperties.All)]
#endif
    public override DbType DbType
    {
      get
      {
        if (_dbType == -1)
        {
          if (_objValue != null && _objValue != DBNull.Value)
          {
            return SQLiteConvert.TypeToDbType(_objValue.GetType());
          }
          return DbType.String; // Unassigned default value is String
        }
        return (DbType)_dbType;
      }
      set
      {
        _dbType = (int)value;
      }
    }

    /// <summary>
    /// Supports only input parameters
    /// </summary>
    public override ParameterDirection Direction







|







|



|







340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
    [DbProviderSpecificTypeProperty(true)]
    [RefreshProperties(RefreshProperties.All)]
#endif
    public override DbType DbType
    {
      get
      {
        if (_dbType == UnknownDbType)
        {
          if (_objValue != null && _objValue != DBNull.Value)
          {
            return SQLiteConvert.TypeToDbType(_objValue.GetType());
          }
          return DbType.String; // Unassigned default value is String
        }
        return _dbType;
      }
      set
      {
        _dbType = value;
      }
    }

    /// <summary>
    /// Supports only input parameters
    /// </summary>
    public override ParameterDirection Direction
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
    }

    /// <summary>
    /// Resets the DbType of the parameter so it can be inferred from the value
    /// </summary>
    public override void ResetDbType()
    {
      _dbType = -1;
    }

    /// <summary>
    /// Returns the size of the parameter
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue((int)0)]







|







392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
    }

    /// <summary>
    /// Resets the DbType of the parameter so it can be inferred from the value
    /// </summary>
    public override void ResetDbType()
    {
      _dbType = UnknownDbType;
    }

    /// <summary>
    /// Returns the size of the parameter
    /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
    [DefaultValue((int)0)]
430
431
432
433
434
435
436
437
438
439
440















441
442
443
444
445
446
447
448
449
450
451
452
453
      get
      {
        return _objValue;
      }
      set
      {
        _objValue = value;
        if (_dbType == -1 && _objValue != null && _objValue != DBNull.Value) // If the DbType has never been assigned, try to glean one from the value's datatype 
          _dbType = (int)SQLiteConvert.TypeToDbType(_objValue.GetType());
      }
    }
















    /// <summary>
    /// Clones a parameter
    /// </summary>
    /// <returns>A new, unassociated SQLiteParameter</returns>
    public object Clone()
    {
      SQLiteParameter newparam = new SQLiteParameter(this);

      return newparam;
    }
  }
}







|
|


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













473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
      get
      {
        return _objValue;
      }
      set
      {
        _objValue = value;
        if (_dbType == UnknownDbType && _objValue != null && _objValue != DBNull.Value) // If the DbType has never been assigned, try to glean one from the value's datatype
          _dbType = SQLiteConvert.TypeToDbType(_objValue.GetType());
      }
    }

    /// <summary>
    /// The database type name associated with this parameter, if any.
    /// </summary>
    public string TypeName
    {
        get
        {
            return _typeName;
        }
        set
        {
            _typeName = value;
        }
    }

    /// <summary>
    /// Clones a parameter
    /// </summary>
    /// <returns>A new, unassociated SQLiteParameter</returns>
    public object Clone()
    {
      SQLiteParameter newparam = new SQLiteParameter(this);

      return newparam;
    }
  }
}

Changes to System.Data.SQLite/SQLiteParameterCollection.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14


15


16
17
18
19
20
21
22
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Data;
  using System.Data.Common;
  using System.Collections.Generic;
  using System.Globalization;


  using System.ComponentModel;


  using System.Reflection;

  /// <summary>
  /// SQLite implementation of DbParameterCollection.
  /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
  [Editor("Microsoft.VSDesigner.Data.Design.DBParametersEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), ListBindable(false)]



|










>
>

>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Data;
  using System.Data.Common;
  using System.Collections.Generic;
  using System.Globalization;

#if !PLATFORM_COMPACTFRAMEWORK
  using System.ComponentModel;
#endif

  using System.Reflection;

  /// <summary>
  /// SQLite implementation of DbParameterCollection.
  /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
  [Editor("Microsoft.VSDesigner.Data.Design.DBParametersEditor, Microsoft.VSDesigner, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), ListBindable(false)]
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
    {
      _command = cmd;
      _parameterList = new List<SQLiteParameter>();
      _unboundFlag = true;
    }

    /// <summary>
    /// Returns true
    /// </summary>
    public override bool IsSynchronized
    {
      get { return true; }
    }

    /// <summary>
    /// Returns false
    /// </summary>
    public override bool IsFixedSize
    {







|



|







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
    {
      _command = cmd;
      _parameterList = new List<SQLiteParameter>();
      _unboundFlag = true;
    }

    /// <summary>
    /// Returns false
    /// </summary>
    public override bool IsSynchronized
    {
      get { return false; }
    }

    /// <summary>
    /// Returns false
    /// </summary>
    public override bool IsFixedSize
    {
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
    /// <param name="parameterName">The name of the parameter to find</param>
    /// <returns>-1 if not found, otherwise a zero-based index of the parameter</returns>
    public override int IndexOf(string parameterName)
    {
      int x = _parameterList.Count;
      for (int n = 0; n < x; n++)
      {
        if (String.Compare(parameterName, _parameterList[n].ParameterName, StringComparison.OrdinalIgnoreCase) == 0)
          return n;
      }
      return -1;
    }

    /// <summary>
    /// Returns the index of a parameter







|







317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
    /// <param name="parameterName">The name of the parameter to find</param>
    /// <returns>-1 if not found, otherwise a zero-based index of the parameter</returns>
    public override int IndexOf(string parameterName)
    {
      int x = _parameterList.Count;
      for (int n = 0; n < x; n++)
      {
        if (String.Compare(parameterName, _parameterList[n].ParameterName, StringComparison.Ordinal) == 0)
          return n;
      }
      return -1;
    }

    /// <summary>
    /// Returns the index of a parameter
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433

      foreach(SQLiteParameter p in _parameterList)
      {
        y ++;
        s = p.ParameterName;
        if (s == null)
        {
          s = String.Format(CultureInfo.InvariantCulture, ";{0}", nUnnamed);
          nUnnamed++;
        }

        int x;
        bool isMapped = false;

        if (activeStatement == null)







|







423
424
425
426
427
428
429
430
431
432
433
434
435
436
437

      foreach(SQLiteParameter p in _parameterList)
      {
        y ++;
        s = p.ParameterName;
        if (s == null)
        {
          s = HelperMethods.StringFormat(CultureInfo.InvariantCulture, ";{0}", nUnnamed);
          nUnnamed++;
        }

        int x;
        bool isMapped = false;

        if (activeStatement == null)
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
          stmt = null;
        }

        // If the parameter has a name, but the SQL statement uses unnamed references, this can happen -- attempt to map
        // the parameter by its index in the collection
        if (isMapped == false)
        {
          s = String.Format(CultureInfo.InvariantCulture, ";{0}", y);

          stmt = activeStatement;
          for (n = 0; n < x; n++)
          {
            if (stmt == null) stmt = _command._statementList[n];
            if (stmt._paramNames != null)
            {







|







452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
          stmt = null;
        }

        // If the parameter has a name, but the SQL statement uses unnamed references, this can happen -- attempt to map
        // the parameter by its index in the collection
        if (isMapped == false)
        {
          s = HelperMethods.StringFormat(CultureInfo.InvariantCulture, ";{0}", y);

          stmt = activeStatement;
          for (n = 0; n < x; n++)
          {
            if (stmt == null) stmt = _command._statementList[n];
            if (stmt._paramNames != null)
            {

Added System.Data.SQLite/SQLitePatchLevel.cs.

































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Joe Mistachkin (joe@mistachkin.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System.Data.SQLite;

///////////////////////////////////////////////////////////////////////////////

[assembly: AssemblySourceId(null)]

///////////////////////////////////////////////////////////////////////////////

[assembly: AssemblySourceTimeStamp(null)]

Added System.Data.SQLite/SQLiteSession.cs.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Joe Mistachkin (joe@mistachkin.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System.Collections;
using System.Collections.Generic;

#if DEBUG
using System.Diagnostics;
#endif

using System.IO;
using System.Globalization;
using System.Runtime.InteropServices;

namespace System.Data.SQLite
{
    #region Session Extension Enumerations
    /// <summary>
    /// This enumerated type represents a type of conflict seen when apply
    /// changes from a change set or patch set.
    /// </summary>
    public enum SQLiteChangeSetConflictType
    {
        /// <summary>
        /// This value is seen when processing a DELETE or UPDATE change if a
        /// row with the required PRIMARY KEY fields is present in the
        /// database, but one or more other (non primary-key) fields modified
        /// by the update do not contain the expected "before" values.
        /// </summary>
        Data = 1,

        /// <summary>
        /// This value is seen when processing a DELETE or UPDATE change if a
        /// row with the required PRIMARY KEY fields is not present in the
        /// database.  There is no conflicting row in this case.
        ///
        /// The results of invoking the
        /// <see cref="ISQLiteChangeSetMetadataItem.GetConflictValue" />
        /// method are undefined.
        /// </summary>
        NotFound = 2,

        /// <summary>
        /// This value is seen when processing an INSERT change if the
        /// operation would result in duplicate primary key values.
        /// The conflicting row in this case is the database row with the
        /// matching primary key.
        /// </summary>
        Conflict = 3,

        /// <summary>
        /// If a non-foreign key constraint violation occurs while applying a
        /// change (i.e. a UNIQUE, CHECK or NOT NULL constraint), the conflict
        /// callback will see this value.
        ///
        /// There is no conflicting row in this case. The results of invoking
        /// the <see cref="ISQLiteChangeSetMetadataItem.GetConflictValue" />
        /// method are undefined.
        /// </summary>
        Constraint = 4,

        /// <summary>
        /// If foreign key handling is enabled, and applying a changes leaves
        /// the database in a state containing foreign key violations, this
        /// value will be seen exactly once before the changes are committed.
        /// If the conflict handler
        /// <see cref="SQLiteChangeSetConflictResult.Omit" />, the changes,
        /// including those that caused the foreign key constraint violation,
        /// are committed. Or, if it returns
        /// <see cref="SQLiteChangeSetConflictResult.Abort" />, the changes are
        /// rolled back.
        ///
        /// No current or conflicting row information is provided. The only
        /// method it is possible to call on the supplied
        /// <see cref="ISQLiteChangeSetMetadataItem" /> object is
        /// <see cref="ISQLiteChangeSetMetadataItem.NumberOfForeignKeyConflicts" />.
        /// </summary>
        ForeignKey = 5
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// This enumerated type represents the result of a user-defined conflict
    /// resolution callback.
    /// </summary>
    public enum SQLiteChangeSetConflictResult
    {
        /// <summary>
        /// If a conflict callback returns this value no special action is
        /// taken. The change that caused the conflict is not applied. The
        /// application of changes continues with the next change.
        /// </summary>
        Omit = 0,

        /// <summary>
        /// This value may only be returned from a conflict callback if the
        /// type of conflict was <see cref="SQLiteChangeSetConflictType.Data" />
        /// or <see cref="SQLiteChangeSetConflictType.Conflict" />. If this is
        /// not the case, any changes applied so far are rolled back and the
        /// call to
        /// <see cref="ISQLiteChangeSet.Apply(SessionConflictCallback,SessionTableFilterCallback,object)" />
        /// will raise a <see cref="SQLiteException" /> with an error code of
        /// <see cref="SQLiteErrorCode.Misuse" />.
        ///
        /// If this value is returned for a
        /// <see cref="SQLiteChangeSetConflictType.Data" /> conflict, then the
        /// conflicting row is either updated or deleted, depending on the type
        /// of change.
        ///
        /// If this value is returned for a
        /// <see cref="SQLiteChangeSetConflictType.Conflict" /> conflict, then
        /// the conflicting row is removed from the database and a second
        /// attempt to apply the change is made. If this second attempt fails,
        /// the original row is restored to the database before continuing.
        /// </summary>
        Replace = 1,

        /// <summary>
        /// If this value is returned, any changes applied so far are rolled
        /// back and the call to
        /// <see cref="ISQLiteChangeSet.Apply(SessionConflictCallback,SessionTableFilterCallback,object)" />
        /// will raise a <see cref="SQLiteException" /> with an error code of
        /// <see cref="SQLiteErrorCode.Abort" />.
        /// </summary>
        Abort = 2
    }

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// This enumerated type represents possible flags that may be passed
    /// to the appropriate overloads of various change set creation methods.
    /// </summary>
    public enum SQLiteChangeSetStartFlags
    {
        /// <summary>
        /// No special handling.
        /// </summary>
        None = 0x0,

        /// <summary>
        /// Invert the change set while iterating through it.
        /// This is equivalent to inverting a change set using
        /// <see cref="ISQLiteChangeSet.Invert" /> before
        /// applying it. It is an error to specify this flag
        /// with a patch set.
        /// </summary>
        Invert = 0x2
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region Session Extension Delegates
    /// <summary>
    /// This callback is invoked when a determination must be made about
    /// whether changes to a specific table should be tracked -OR- applied.
    /// It will not be called for tables that are already attached to a
    /// <see cref="ISQLiteSession" />.
    /// </summary>
    /// <param name="clientData">
    /// The optional application-defined context data that was originally
    /// passed to the <see cref="ISQLiteSession.SetTableFilter" /> or
    /// <see cref="ISQLiteChangeSet.Apply(SessionConflictCallback,SessionTableFilterCallback,object)" />
    /// methods.  This value may be null.
    /// </param>
    /// <param name="name">
    /// The name of the table.
    /// </param>
    /// <returns>
    /// Non-zero if changes to the table should be considered; otherwise,
    /// zero.  Throwing an exception from this callback will result in
    /// undefined behavior.
    /// </returns>
    public delegate bool SessionTableFilterCallback(
        object clientData,
        string name
    );

    ///////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// This callback is invoked when there is a conflict while apply changes
    /// to a database.
    /// </summary>
    /// <param name="clientData">
    /// The optional application-defined context data that was originally
    /// passed to the
    /// <see cref="ISQLiteChangeSet.Apply(SessionConflictCallback,SessionTableFilterCallback,object)" />
    /// method.  This value may be null.
    /// </param>
    /// <param name="type">
    /// The type of this conflict.
    /// </param>
    /// <param name="item">
    /// The <see cref="ISQLiteChangeSetMetadataItem" /> object associated with
    /// this conflict.  This value may not be null; however, only properties
    /// that are applicable to the conflict type will be available.  Further
    /// information on this is available within the descriptions of the
    /// available <see cref="SQLiteChangeSetConflictType" /> values.
    /// </param>
    /// <returns>
    /// A <see cref="SQLiteChangeSetConflictResult" /> value that indicates the
    /// action to be taken in order to resolve the conflict.  Throwing an
    /// exception from this callback will result in undefined behavior.
    /// </returns>
    public delegate SQLiteChangeSetConflictResult SessionConflictCallback(
        object clientData,
        SQLiteChangeSetConflictType type,
        ISQLiteChangeSetMetadataItem item
    );
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region ISQLiteChangeSet Interface
    /// <summary>
    /// This interface contains methods used to manipulate a set of changes for
    /// a database.
    /// </summary>
    public interface ISQLiteChangeSet :
        IEnumerable<ISQLiteChangeSetMetadataItem>, IDisposable
    {
        /// <summary>
        /// This method "inverts" the set of changes within this instance.
        /// Applying an inverted set of changes to a database reverses the
        /// effects of applying the uninverted changes.  Specifically:
        /// <![CDATA[<ul>]]><![CDATA[<li>]]>
        /// Each DELETE change is changed to an INSERT, and
        /// <![CDATA[</li>]]><![CDATA[<li>]]>
        /// Each INSERT change is changed to a DELETE, and
        /// <![CDATA[</li>]]><![CDATA[<li>]]>
        /// For each UPDATE change, the old.* and new.* values are exchanged.
        /// <![CDATA[</li>]]><![CDATA[</ul>]]>
        /// This method does not change the order in which changes appear
        /// within the set of changes. It merely reverses the sense of each
        /// individual change.
        /// </summary>
        /// <returns>
        /// The new <see cref="ISQLiteChangeSet" /> instance that represents
        /// the resulting set of changes -OR- null if it is not available.
        /// </returns>
        ISQLiteChangeSet Invert();

        /// <summary>
        /// This method combines the specified set of changes with the ones
        /// contained in this instance.
        /// </summary>
        /// <param name="changeSet">
        /// The changes to be combined with those in this instance.
        /// </param>
        /// <returns>
        /// The new <see cref="ISQLiteChangeSet" /> instance that represents
        /// the resulting set of changes -OR- null if it is not available.
        /// </returns>
        ISQLiteChangeSet CombineWith(ISQLiteChangeSet changeSet);

        /// <summary>
        /// Attempts to apply the set of changes in this instance to the
        /// associated database.
        /// </summary>
        /// <param name="conflictCallback">
        /// The <see cref="SessionConflictCallback" /> delegate that will need
        /// to handle any conflicting changes that may arise.
        /// </param>
        /// <param name="clientData">
        /// The optional application-defined context data.  This value may be
        /// null.
        /// </param>
        void Apply(
            SessionConflictCallback conflictCallback,
            object clientData
        );

        /// <summary>
        /// Attempts to apply the set of changes in this instance to the
        /// associated database.
        /// </summary>
        /// <param name="conflictCallback">
        /// The <see cref="SessionConflictCallback" /> delegate that will need
        /// to handle any conflicting changes that may arise.
        /// </param>
        /// <param name="tableFilterCallback">
        /// The optional <see cref="SessionTableFilterCallback" /> delegate
        /// that can be used to filter the list of tables impacted by the set
        /// of changes.
        /// </param>
        /// <param name="clientData">
        /// The optional application-defined context data.  This value may be
        /// null.
        /// </param>
        void Apply(
            SessionConflictCallback conflictCallback,
            SessionTableFilterCallback tableFilterCallback,
            object clientData
        );
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region ISQLiteChangeGroup Interface
    /// <summary>
    /// This interface contains methods used to manipulate multiple sets of
    /// changes for a database.
    /// </summary>
    public interface ISQLiteChangeGroup : IDisposable
    {
        /// <summary>
        /// Attempts to add a change set (or patch set) to this change group
        /// instance.  The underlying data must be contained entirely within
        /// the <paramref name="rawData" /> byte array.
        /// </summary>
        /// <param name="rawData">
        /// The raw byte data for the specified change set (or patch set).
        /// </param>
        void AddChangeSet(byte[] rawData);

        /// <summary>
        /// Attempts to add a change set (or patch set) to this change group
        /// instance.  The underlying data will be read from the specified
        /// <see cref="Stream" />.
        /// </summary>
        /// <param name="stream">
        /// The <see cref="Stream" /> instance containing the raw change set
        /// (or patch set) data to read.
        /// </param>
        void AddChangeSet(Stream stream);

        /// <summary>
        /// Attempts to create and return, via <paramref name="rawData" />, the
        /// combined set of changes represented by this change group instance.
        /// </summary>
        /// <param name="rawData">
        /// Upon success, this will contain the raw byte data for all the
        /// changes in this change group instance.
        /// </param>
        void CreateChangeSet(ref byte[] rawData);

        /// <summary>
        /// Attempts to create and write, via <paramref name="stream" />, the
        /// combined set of changes represented by this change group instance.
        /// </summary>
        /// <param name="stream">
        /// Upon success, the raw byte data for all the changes in this change
        /// group instance will be written to this <see cref="Stream" />.
        /// </param>
        void CreateChangeSet(Stream stream);
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region ISQLiteChangeSetMetadataItem Interface
    /// <summary>
    /// This interface contains properties and methods used to fetch metadata
    /// about one change within a set of changes for a database.
    /// </summary>
    public interface ISQLiteChangeSetMetadataItem : IDisposable
    {
        /// <summary>
        /// The name of the table the change was made to.
        /// </summary>
        string TableName { get; }

        /// <summary>
        /// The number of columns impacted by this change.  This value can be
        /// used to determine the highest valid column index that may be used
        /// with the <see cref="GetOldValue" />, <see cref="GetNewValue" />,
        /// and <see cref="GetConflictValue" /> methods of this interface.  It
        /// will be this value minus one.
        /// </summary>
        int NumberOfColumns { get; }

        /// <summary>
        /// This will contain the value
        /// <see cref="SQLiteAuthorizerActionCode.Insert" />,
        /// <see cref="SQLiteAuthorizerActionCode.Update" />, or
        /// <see cref="SQLiteAuthorizerActionCode.Delete" />, corresponding to
        /// the overall type of change this item represents.
        /// </summary>
        SQLiteAuthorizerActionCode OperationCode { get; }

        /// <summary>
        /// Non-zero if this change is considered to be indirect (i.e. as
        /// though they were made via a trigger or foreign key action).
        /// </summary>
        bool Indirect { get; }

        /// <summary>
        /// This array contains a <see cref="Boolean" /> for each column in
        /// the table associated with this change.  The element will be zero
        /// if the column is not part of the primary key; otherwise, it will
        /// be non-zero.
        /// </summary>
        bool[] PrimaryKeyColumns { get; }

        /// <summary>
        /// This method may only be called from within a
        /// <see cref="SessionConflictCallback" /> delegate when the conflict
        /// type is <see cref="SQLiteChangeSetConflictType.ForeignKey" />.  It
        /// returns the total number of known foreign key violations in the
        /// destination database.
        /// </summary>
        int NumberOfForeignKeyConflicts { get; }

        /// <summary>
        /// Queries and returns the original value of a given column for this
        /// change.  This method may only be called when the
        /// <see cref="OperationCode" /> has a value of
        /// <see cref="SQLiteAuthorizerActionCode.Update" /> or
        /// <see cref="SQLiteAuthorizerActionCode.Delete" />.
        /// </summary>
        /// <param name="columnIndex">
        /// The index for the column.  This value must be between zero and one
        /// less than the total number of columns for this table.
        /// </param>
        /// <returns>
        /// The original value of a given column for this change.
        /// </returns>
        SQLiteValue GetOldValue(int columnIndex);

        /// <summary>
        /// Queries and returns the updated value of a given column for this
        /// change.  This method may only be called when the
        /// <see cref="OperationCode" /> has a value of
        /// <see cref="SQLiteAuthorizerActionCode.Insert" /> or
        /// <see cref="SQLiteAuthorizerActionCode.Update" />.
        /// </summary>
        /// <param name="columnIndex">
        /// The index for the column.  This value must be between zero and one
        /// less than the total number of columns for this table.
        /// </param>
        /// <returns>
        /// The updated value of a given column for this change.
        /// </returns>
        SQLiteValue GetNewValue(int columnIndex);

        /// <summary>
        /// Queries and returns the conflicting value of a given column for
        /// this change.  This method may only be called from within a
        /// <see cref="SessionConflictCallback" /> delegate when the conflict
        /// type is <see cref="SQLiteChangeSetConflictType.Data" /> or
        /// <see cref="SQLiteChangeSetConflictType.Conflict" />.
        /// </summary>
        /// <param name="columnIndex">
        /// The index for the column.  This value must be between zero and one
        /// less than the total number of columns for this table.
        /// </param>
        /// <returns>
        /// The conflicting value of a given column for this change.
        /// </returns>
        SQLiteValue GetConflictValue(int columnIndex);
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region ISQLiteSession Interface
    /// <summary>
    /// This interface contains methods to query and manipulate the state of a
    /// change tracking session for a database.
    /// </summary>
    public interface ISQLiteSession : IDisposable
    {
        /// <summary>
        /// Determines if this session is currently tracking changes to its
        /// associated database.
        /// </summary>
        /// <returns>
        /// Non-zero if changes to the associated database are being trakced;
        /// otherwise, zero.
        /// </returns>
        bool IsEnabled();

        /// <summary>
        /// Enables tracking of changes to the associated database.
        /// </summary>
        void SetToEnabled();

        /// <summary>
        /// Disables tracking of changes to the associated database.
        /// </summary>
        void SetToDisabled();

        /// <summary>
        /// Determines if this session is currently set to mark changes as
        /// indirect (i.e. as though they were made via a trigger or foreign
        /// key action).
        /// </summary>
        /// <returns>
        /// Non-zero if changes to the associated database are being marked as
        /// indirect; otherwise, zero.
        /// </returns>
        bool IsIndirect();

        /// <summary>
        /// Sets the indirect flag for this session.  Subsequent changes will
        /// be marked as indirect until this flag is changed again.
        /// </summary>
        void SetToIndirect();

        /// <summary>
        /// Clears the indirect flag for this session.  Subsequent changes will
        /// be marked as direct until this flag is changed again.
        /// </summary>
        void SetToDirect();

        /// <summary>
        /// Determines if there are any tracked changes currently within the
        /// data for this session.
        /// </summary>
        /// <returns>
        /// Non-zero if there are no changes within the data for this session;
        /// otherwise, zero.
        /// </returns>
        bool IsEmpty();

        /// <summary>
        /// This method attempts to determine the amount of memory used by the
        /// session.
        /// </summary>
        /// <returns>
        /// Number of bytes used by the session -OR- negative one if its value
        /// cannot be obtained.
        /// </returns>
        long GetMemoryBytesInUse();

        /// <summary>
        /// Upon success, causes changes to the specified table(s) to start
        /// being tracked.  Any tables impacted by calls to this method will
        /// not cause the <see cref="SessionTableFilterCallback" /> callback
        /// to be invoked.
        /// </summary>
        /// <param name="name">
        /// The name of the table to be tracked -OR- null to track all
        /// applicable tables within this database.
        /// </param>
        void AttachTable(string name);

        /// <summary>
        /// This method is used to set the table filter for this instance.
        /// </summary>
        /// <param name="callback">
        /// The table filter callback -OR- null to clear any existing table
        /// filter callback.
        /// </param>
        /// <param name="clientData">
        /// The optional application-defined context data.  This value may be
        /// null.
        /// </param>
        void SetTableFilter(
            SessionTableFilterCallback callback,
            object clientData
        );

        /// <summary>
        /// Attempts to create and return, via <paramref name="rawData" />, the
        /// combined set of changes represented by this session instance.
        /// </summary>
        /// <param name="rawData">
        /// Upon success, this will contain the raw byte data for all the
        /// changes in this session instance.
        /// </param>
        void CreateChangeSet(ref byte[] rawData);

        /// <summary>
        /// Attempts to create and write, via <paramref name="stream" />, the
        /// combined set of changes represented by this session instance.
        /// </summary>
        /// <param name="stream">
        /// Upon success, the raw byte data for all the changes in this session
        /// instance will be written to this <see cref="Stream" />.
        /// </param>
        void CreateChangeSet(Stream stream);

        /// <summary>
        /// Attempts to create and return, via <paramref name="rawData" />, the
        /// combined set of changes represented by this session instance as a
        /// patch set.
        /// </summary>
        /// <param name="rawData">
        /// Upon success, this will contain the raw byte data for all the
        /// changes in this session instance.
        /// </param>
        void CreatePatchSet(ref byte[] rawData);

        /// <summary>
        /// Attempts to create and write, via <paramref name="stream" />, the
        /// combined set of changes represented by this session instance as a
        /// patch set.
        /// </summary>
        /// <param name="stream">
        /// Upon success, the raw byte data for all the changes in this session
        /// instance will be written to this <see cref="Stream" />.
        /// </param>
        void CreatePatchSet(Stream stream);

        /// <summary>
        /// This method loads the differences between two tables [with the same
        /// name, set of columns, and primary key definition] into this session
        /// instance.
        /// </summary>
        /// <param name="fromDatabaseName">
        /// The name of the database containing the table with the original
        /// data (i.e. it will need updating in order to be identical to the
        /// one within the database associated with this session instance).
        /// </param>
        /// <param name="tableName">
        /// The name of the table.
        /// </param>
        void LoadDifferencesFromTable(
            string fromDatabaseName,
            string tableName
        );
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteSessionHelpers Class
    /// <summary>
    /// This class contains some static helper methods for use within this
    /// subsystem.
    /// </summary>
    internal static class SQLiteSessionHelpers
    {
        #region Public Methods
        /// <summary>
        /// This method checks the byte array specified by the caller to make
        /// sure it will be usable.
        /// </summary>
        /// <param name="rawData">
        /// A byte array provided by the caller into one of the public methods
        /// for the classes that belong to this subsystem.  This value cannot
        /// be null or represent an empty array; otherwise, an appropriate
        /// exception will be thrown.
        /// </param>
        public static void CheckRawData(
            byte[] rawData
            )
        {
            if (rawData == null)
                throw new ArgumentNullException("rawData");

            if (rawData.Length == 0)
            {
                throw new ArgumentException(
                    "empty change set data", "rawData");
            }
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteConnectionLock Class
    /// <summary>
    /// This class is used to hold the native connection handle associated with
    /// a <see cref="SQLiteConnection" /> open until this subsystem is totally
    /// done with it.  This class is for internal use by this subsystem only.
    /// </summary>
    internal abstract class SQLiteConnectionLock : IDisposable
    {
        #region Private Constants
        /// <summary>
        /// The SQL statement used when creating the native statement handle.
        /// There are no special requirements for this other than counting as
        /// an "open statement handle".
        /// </summary>
        private const string LockNopSql = "SELECT 1;";

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The format of the error message used when reporting, during object
        /// disposal, that the statement handle is still open (i.e. because
        /// this situation is considered a fairly serious programming error).
        /// </summary>
        private const string StatementMessageFormat =
            "Connection lock object was {0} with statement {1}";
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Data
        /// <summary>
        /// The wrapped native connection handle associated with this lock.
        /// </summary>
        private SQLiteConnectionHandle handle;

        /// <summary>
        /// The flags associated with the connection represented by the
        /// <see cref="handle" /> value.
        /// </summary>
        private SQLiteConnectionFlags flags;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The native statement handle for this lock.  The garbage collector
        /// cannot cause this statement to be finalized; therefore, it will
        /// serve to hold the associated native connection open until it is
        /// freed manually using the <see cref="Unlock" /> method.
        /// </summary>
        private IntPtr statement;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        /// <summary>
        /// Constructs a new instance of this class using the specified wrapped
        /// native connection handle and associated flags.
        /// </summary>
        /// <param name="handle">
        /// The wrapped native connection handle to be associated with this
        /// lock.
        /// </param>
        /// <param name="flags">
        /// The flags associated with the connection represented by the
        /// <paramref name="handle" /> value.
        /// </param>
        /// <param name="autoLock">
        /// Non-zero if the <see cref="Lock" /> method should be called prior
        /// to returning from this constructor.
        /// </param>
        public SQLiteConnectionLock(
            SQLiteConnectionHandle handle,
            SQLiteConnectionFlags flags,
            bool autoLock
            )
        {
            this.handle = handle;
            this.flags = flags;

            if (autoLock)
                Lock();
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Protected Methods
        /// <summary>
        /// Queries and returns the wrapped native connection handle for this
        /// instance.
        /// </summary>
        /// <returns>
        /// The wrapped native connection handle for this instance -OR- null
        /// if it is unavailable.
        /// </returns>
        protected SQLiteConnectionHandle GetHandle()
        {
            return handle;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Queries and returns the flags associated with the connection for
        /// this instance.
        /// </summary>
        /// <returns>
        /// The <see cref="SQLiteConnectionFlags" /> value.  There is no return
        /// value reserved to indicate an error.
        /// </returns>
        protected SQLiteConnectionFlags GetFlags()
        {
            return flags;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Queries and returns the native connection handle for this instance.
        /// </summary>
        /// <returns>
        /// The native connection handle for this instance.  If this value is
        /// unavailable or invalid an exception will be thrown.
        /// </returns>
        protected IntPtr GetIntPtr()
        {
            if (handle == null)
            {
                throw new InvalidOperationException(
                    "Connection lock object has an invalid handle.");
            }

            IntPtr handlePtr = handle;

            if (handlePtr == IntPtr.Zero)
            {
                throw new InvalidOperationException(
                    "Connection lock object has an invalid handle pointer.");
            }

            return handlePtr;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Methods
        /// <summary>
        /// This method attempts to "lock" the associated native connection
        /// handle by preparing a SQL statement that will not be finalized
        /// until the <see cref="Unlock" /> method is called (i.e. and which
        /// cannot be done by the garbage collector).  If the statement is
        /// already prepared, nothing is done.  If the statement cannot be
        /// prepared for any reason, an exception will be thrown.
        /// </summary>
        public void Lock()
        {
            CheckDisposed();

            if (statement != IntPtr.Zero)
                return;

            IntPtr pSql = IntPtr.Zero;

            try
            {
                int nSql = 0;

                pSql = SQLiteString.Utf8IntPtrFromString(LockNopSql, ref nSql);

                IntPtr pRemain = IntPtr.Zero;

#if !SQLITE_STANDARD
                int nRemain = 0;
                string functionName = "sqlite3_prepare_interop";

                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_prepare_interop(
                    GetIntPtr(), pSql, nSql, ref statement, ref pRemain,
                    ref nRemain);
#else
#if USE_PREPARE_V2
                string functionName = "sqlite3_prepare_v2";

                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_prepare_v2(
                    GetIntPtr(), pSql, nSql, ref statement, ref pRemain);
#else
                string functionName = "sqlite3_prepare";

                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_prepare(
                    GetIntPtr(), pSql, nSql, ref statement, ref pRemain);
#endif
#endif

                if (rc != SQLiteErrorCode.Ok)
                    throw new SQLiteException(rc, functionName);
            }
            finally
            {
                if (pSql != IntPtr.Zero)
                {
                    SQLiteMemory.Free(pSql);
                    pSql = IntPtr.Zero;
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method attempts to "unlock" the associated native connection
        /// handle by finalizing the previously prepared statement.  If the
        /// statement is already finalized, nothing is done.  If the statement
        /// cannot be finalized for any reason, an exception will be thrown.
        /// </summary>
        public void Unlock()
        {
            CheckDisposed();

            if (statement == IntPtr.Zero)
                return;

#if !SQLITE_STANDARD
            string functionName = "sqlite3_finalize_interop";

            SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_finalize_interop(
                statement);
#else
            string functionName = "sqlite3_finalize";

            SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3_finalize(
                statement);
#endif

            if (rc != SQLiteErrorCode.Ok)
                throw new SQLiteException(rc, functionName);

            statement = IntPtr.Zero;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable Members
        /// <summary>
        /// Disposes of this object instance.
        /// </summary>
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        /// <summary>
        /// Non-zero if this object instance has been disposed.
        /// </summary>
        private bool disposed;

        /// <summary>
        /// Throws an exception if this object instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteConnectionLock).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes or finalizes this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this object is being disposed; otherwise, this object
        /// is being finalized.
        /// </param>
        protected virtual void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    //if (disposing)
                    //{
                    //    ////////////////////////////////////
                    //    // dispose managed resources here...
                    //    ////////////////////////////////////
                    //}

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////

                    if (statement != IntPtr.Zero)
                    {
                        //
                        // NOTE: This should never happen.  This object was
                        //       disposed (or finalized) without the Unlock
                        //       method being called first.
                        //
                        try
                        {
                            if (HelperMethods.LogPrepare(GetFlags()))
                            {
                                /* throw */
                                SQLiteLog.LogMessage(
                                    SQLiteErrorCode.Misuse,
                                    HelperMethods.StringFormat(
                                    CultureInfo.CurrentCulture,
                                    StatementMessageFormat, disposing ?
                                        "disposed" : "finalized",
                                    statement));
                            }
                        }
                        catch
                        {
                            // do nothing.
                        }

#if DEBUG
                        Debugger.Break();
#endif
                    }
                }
            }
            finally
            {
                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Destructor
        /// <summary>
        /// Finalizes this object instance.
        /// </summary>
        ~SQLiteConnectionLock()
        {
            Dispose(false);
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteChangeSetIterator Class
    /// <summary>
    /// This class manages the native change set iterator.  It is used as the
    /// base class for the <see cref="SQLiteMemoryChangeSetIterator" /> and
    /// <see cref="SQLiteStreamChangeSetIterator" /> classes.  It knows how to
    /// advance the native iterator handle as well as finalize it.
    /// </summary>
    internal class SQLiteChangeSetIterator : IDisposable
    {
        #region Private Data
        /// <summary>
        /// The native change set (a.k.a. iterator) handle.
        /// </summary>
        private IntPtr iterator;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Non-zero if this instance owns the native iterator handle in the
        /// <see cref="iterator" /> field.  In that case, this instance will
        /// finalize the native iterator handle upon being disposed or
        /// finalized.
        /// </summary>
        private bool ownHandle;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Protected Constructors
        /// <summary>
        /// Constructs a new instance of this class using the specified native
        /// iterator handle.
        /// </summary>
        /// <param name="iterator">
        /// The native iterator handle to use.
        /// </param>
        /// <param name="ownHandle">
        /// Non-zero if this instance is to take ownership of the native
        /// iterator handle specified by <paramref name="iterator" />.
        /// </param>
        protected SQLiteChangeSetIterator(
            IntPtr iterator,
            bool ownHandle
            )
        {
            this.iterator = iterator;
            this.ownHandle = ownHandle;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Methods
        /// <summary>
        /// Throws an exception if the native iterator handle is invalid.
        /// </summary>
        internal void CheckHandle()
        {
            if (iterator == IntPtr.Zero)
                throw new InvalidOperationException("iterator is not open");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Used to query the native iterator handle.  This method is only used
        /// by the <see cref="SQLiteChangeSetMetadataItem" /> class.
        /// </summary>
        /// <returns>
        /// The native iterator handle -OR- <see cref="IntPtr.Zero" /> if it
        /// is not available.
        /// </returns>
        internal IntPtr GetIntPtr()
        {
            return iterator;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Methods
        /// <summary>
        /// Attempts to advance the native iterator handle to its next item.
        /// </summary>
        /// <returns>
        /// Non-zero if the native iterator handle was advanced and contains
        /// more data; otherwise, zero.  If the underlying native API returns
        /// an unexpected value then an exception will be thrown.
        /// </returns>
        public bool Next()
        {
            CheckDisposed();
            CheckHandle();

            SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changeset_next(
                iterator);

            switch (rc)
            {
                case SQLiteErrorCode.Ok:
                    {
                        throw new SQLiteException(SQLiteErrorCode.Ok,
                            "sqlite3changeset_next: unexpected result Ok");
                    }
                case SQLiteErrorCode.Row:
                    {
                        return true;
                    }
                case SQLiteErrorCode.Done:
                    {
                        return false;
                    }
                default:
                    {
                        throw new SQLiteException(rc, "sqlite3changeset_next");
                    }
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Static "Factory" Methods
        /// <summary>
        /// Attempts to create an instance of this class that is associated
        /// with the specified native iterator handle.  Ownership of the
        /// native iterator handle is NOT transferred to the new instance of
        /// this class.
        /// </summary>
        /// <param name="iterator">
        /// The native iterator handle to use.
        /// </param>
        /// <returns>
        /// The new instance of this class.  No return value is reserved to
        /// indicate an error; however, if the native iterator handle is not
        /// valid, any subsequent attempt to make use of it via the returned
        /// instance of this class may throw exceptions.
        /// </returns>
        public static SQLiteChangeSetIterator Attach(
            IntPtr iterator
            )
        {
            return new SQLiteChangeSetIterator(iterator, false);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable Members
        /// <summary>
        /// Disposes of this object instance.
        /// </summary>
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        /// <summary>
        /// Non-zero if this object instance has been disposed.
        /// </summary>
        private bool disposed;

        /// <summary>
        /// Throws an exception if this object instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteChangeSetIterator).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes or finalizes this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this object is being disposed; otherwise, this object
        /// is being finalized.
        /// </param>
        protected virtual void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    //if (disposing)
                    //{
                    //    ////////////////////////////////////
                    //    // dispose managed resources here...
                    //    ////////////////////////////////////
                    //}

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////

                    if (iterator != IntPtr.Zero)
                    {
                        if (ownHandle)
                        {
                            UnsafeNativeMethods.sqlite3changeset_finalize(
                                iterator);
                        }

                        iterator = IntPtr.Zero;
                    }
                }
            }
            finally
            {
                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Destructor
        /// <summary>
        /// Finalizes this object instance.
        /// </summary>
        ~SQLiteChangeSetIterator()
        {
            Dispose(false);
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteMemoryChangeSetIterator Class
    /// <summary>
    /// This class manages the native change set iterator for a set of changes
    /// contained entirely in memory.
    /// </summary>
    internal sealed class SQLiteMemoryChangeSetIterator :
        SQLiteChangeSetIterator
    {
        #region Private Data
        /// <summary>
        /// The native memory buffer allocated to contain the set of changes
        /// associated with this instance.  This will always be freed when this
        /// instance is disposed or finalized.
        /// </summary>
        private IntPtr pData;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Constructors
        /// <summary>
        /// Constructs an instance of this class using the specified native
        /// memory buffer and native iterator handle.
        /// </summary>
        /// <param name="pData">
        /// The native memory buffer to use.
        /// </param>
        /// <param name="iterator">
        /// The native iterator handle to use.
        /// </param>
        /// <param name="ownHandle">
        /// Non-zero if this instance is to take ownership of the native
        /// iterator handle specified by <paramref name="iterator" />.
        /// </param>
        private SQLiteMemoryChangeSetIterator(
            IntPtr pData,
            IntPtr iterator,
            bool ownHandle
            )
            : base(iterator, ownHandle)
        {
            this.pData = pData;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Static "Factory" Methods
        /// <summary>
        /// Attempts to create an instance of this class using the specified
        /// raw byte data.
        /// </summary>
        /// <param name="rawData">
        /// The raw byte data containing the set of changes for this native
        /// iterator.
        /// </param>
        /// <returns>
        /// The new instance of this class -OR- null if it cannot be created.
        /// </returns>
        public static SQLiteMemoryChangeSetIterator Create(
            byte[] rawData
            )
        {
            SQLiteSessionHelpers.CheckRawData(rawData);

            SQLiteMemoryChangeSetIterator result = null;
            IntPtr pData = IntPtr.Zero;
            IntPtr iterator = IntPtr.Zero;

            try
            {
                int nData = 0;

                pData = SQLiteBytes.ToIntPtr(rawData, ref nData);

                if (pData == IntPtr.Zero)
                    throw new SQLiteException(SQLiteErrorCode.NoMem, null);

                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changeset_start(
                    ref iterator, nData, pData);

                if (rc != SQLiteErrorCode.Ok)
                    throw new SQLiteException(rc, "sqlite3changeset_start");

                result = new SQLiteMemoryChangeSetIterator(
                    pData, iterator, true);
            }
            finally
            {
                if (result == null)
                {
                    if (iterator != IntPtr.Zero)
                    {
                        UnsafeNativeMethods.sqlite3changeset_finalize(
                            iterator);

                        iterator = IntPtr.Zero;
                    }

                    if (pData != IntPtr.Zero)
                    {
                        SQLiteMemory.Free(pData);
                        pData = IntPtr.Zero;
                    }
                }
            }

            return result;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to create an instance of this class using the specified
        /// raw byte data.
        /// </summary>
        /// <param name="rawData">
        /// The raw byte data containing the set of changes for this native
        /// iterator.
        /// </param>
        /// <param name="flags">
        /// The flags used to create the change set iterator.
        /// </param>
        /// <returns>
        /// The new instance of this class -OR- null if it cannot be created.
        /// </returns>
        public static SQLiteMemoryChangeSetIterator Create(
            byte[] rawData,
            SQLiteChangeSetStartFlags flags
            )
        {
            SQLiteSessionHelpers.CheckRawData(rawData);

            SQLiteMemoryChangeSetIterator result = null;
            IntPtr pData = IntPtr.Zero;
            IntPtr iterator = IntPtr.Zero;

            try
            {
                int nData = 0;

                pData = SQLiteBytes.ToIntPtr(rawData, ref nData);

                if (pData == IntPtr.Zero)
                    throw new SQLiteException(SQLiteErrorCode.NoMem, null);

                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changeset_start_v2(
                    ref iterator, nData, pData, flags);

                if (rc != SQLiteErrorCode.Ok)
                    throw new SQLiteException(rc, "sqlite3changeset_start_v2");

                result = new SQLiteMemoryChangeSetIterator(
                    pData, iterator, true);
            }
            finally
            {
                if (result == null)
                {
                    if (iterator != IntPtr.Zero)
                    {
                        UnsafeNativeMethods.sqlite3changeset_finalize(
                            iterator);

                        iterator = IntPtr.Zero;
                    }

                    if (pData != IntPtr.Zero)
                    {
                        SQLiteMemory.Free(pData);
                        pData = IntPtr.Zero;
                    }
                }
            }

            return result;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        /// <summary>
        /// Non-zero if this object instance has been disposed.
        /// </summary>
        private bool disposed;

        /// <summary>
        /// Throws an exception if this object instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteMemoryChangeSetIterator).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes or finalizes this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this object is being disposed; otherwise, this object
        /// is being finalized.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            //
            // NOTE: Must dispose of the base class first (leaky abstraction)
            //       because it contains the iterator handle, which must be
            //       closed *prior* to freeing the underlying memory.
            //
            base.Dispose(disposing);

            try
            {
                if (!disposed)
                {
                    //if (disposing)
                    //{
                    //    ////////////////////////////////////
                    //    // dispose managed resources here...
                    //    ////////////////////////////////////
                    //}

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////

                    if (pData != IntPtr.Zero)
                    {
                        SQLiteMemory.Free(pData);
                        pData = IntPtr.Zero;
                    }
                }
            }
            finally
            {
                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteStreamChangeSetIterator Class
    /// <summary>
    /// This class manages the native change set iterator for a set of changes
    /// backed by a <see cref="Stream" /> instance.
    /// </summary>
    internal sealed class SQLiteStreamChangeSetIterator :
        SQLiteChangeSetIterator
    {
        #region Private Data
        /// <summary>
        /// The <see cref="SQLiteStreamAdapter" /> instance that is managing
        /// the underlying <see cref="Stream" /> used as the backing store for
        /// the set of changes associated with this native change set iterator.
        /// </summary>
        private SQLiteStreamAdapter streamAdapter;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Constructors
        /// <summary>
        /// Constructs an instance of this class using the specified native
        /// iterator handle and <see cref="SQLiteStreamAdapter" />.
        /// </summary>
        /// <param name="streamAdapter">
        /// The <see cref="SQLiteStreamAdapter" /> instance to use.
        /// </param>
        /// <param name="iterator">
        /// The native iterator handle to use.
        /// </param>
        /// <param name="ownHandle">
        /// Non-zero if this instance is to take ownership of the native
        /// iterator handle specified by <paramref name="iterator" />.
        /// </param>
        private SQLiteStreamChangeSetIterator(
            SQLiteStreamAdapter streamAdapter,
            IntPtr iterator,
            bool ownHandle
            )
            : base(iterator, ownHandle)
        {
            this.streamAdapter = streamAdapter;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Static "Factory" Methods
        /// <summary>
        /// Attempts to create an instance of this class using the specified
        /// <see cref="Stream" />.
        /// </summary>
        /// <param name="stream">
        /// The <see cref="Stream" /> where the raw byte data for the set of
        /// changes may be read.
        /// </param>
        /// <param name="connectionFlags">
        /// The flags associated with the parent connection.
        /// </param>
        /// <returns>
        /// The new instance of this class -OR- null if it cannot be created.
        /// </returns>
        public static SQLiteStreamChangeSetIterator Create(
            Stream stream,
            SQLiteConnectionFlags connectionFlags
            )
        {
            if (stream == null)
                throw new ArgumentNullException("stream");

            SQLiteStreamAdapter streamAdapter = null;
            SQLiteStreamChangeSetIterator result = null;
            IntPtr iterator = IntPtr.Zero;

            try
            {
                streamAdapter = new SQLiteStreamAdapter(stream, connectionFlags);

                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changeset_start_strm(
                    ref iterator, streamAdapter.GetInputDelegate(), IntPtr.Zero);

                if (rc != SQLiteErrorCode.Ok)
                {
                    throw new SQLiteException(
                        rc, "sqlite3changeset_start_strm");
                }

                result = new SQLiteStreamChangeSetIterator(
                    streamAdapter, iterator, true);
            }
            finally
            {
                if (result == null)
                {
                    if (iterator != IntPtr.Zero)
                    {
                        UnsafeNativeMethods.sqlite3changeset_finalize(
                            iterator);

                        iterator = IntPtr.Zero;
                    }

                    if (streamAdapter != null)
                    {
                        streamAdapter.Dispose();
                        streamAdapter = null;
                    }
                }
            }

            return result;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to create an instance of this class using the specified
        /// <see cref="Stream" />.
        /// </summary>
        /// <param name="stream">
        /// The <see cref="Stream" /> where the raw byte data for the set of
        /// changes may be read.
        /// </param>
        /// <param name="connectionFlags">
        /// The flags associated with the parent connection.
        /// </param>
        /// <param name="startFlags">
        /// The flags used to create the change set iterator.
        /// </param>
        /// <returns>
        /// The new instance of this class -OR- null if it cannot be created.
        /// </returns>
        public static SQLiteStreamChangeSetIterator Create(
            Stream stream,
            SQLiteConnectionFlags connectionFlags,
            SQLiteChangeSetStartFlags startFlags
            )
        {
            if (stream == null)
                throw new ArgumentNullException("stream");

            SQLiteStreamAdapter streamAdapter = null;
            SQLiteStreamChangeSetIterator result = null;
            IntPtr iterator = IntPtr.Zero;

            try
            {
                streamAdapter = new SQLiteStreamAdapter(stream, connectionFlags);

                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changeset_start_v2_strm(
                    ref iterator, streamAdapter.GetInputDelegate(), IntPtr.Zero,
                    startFlags);

                if (rc != SQLiteErrorCode.Ok)
                {
                    throw new SQLiteException(
                        rc, "sqlite3changeset_start_v2_strm");
                }

                result = new SQLiteStreamChangeSetIterator(
                    streamAdapter, iterator, true);
            }
            finally
            {
                if (result == null)
                {
                    if (iterator != IntPtr.Zero)
                    {
                        UnsafeNativeMethods.sqlite3changeset_finalize(
                            iterator);

                        iterator = IntPtr.Zero;
                    }

                    if (streamAdapter != null)
                    {
                        streamAdapter.Dispose();
                        streamAdapter = null;
                    }
                }
            }

            return result;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        /// <summary>
        /// Non-zero if this object instance has been disposed.
        /// </summary>
        private bool disposed;

        /// <summary>
        /// Throws an exception if this object instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteStreamChangeSetIterator).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes or finalizes this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this object is being disposed; otherwise, this object
        /// is being finalized.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    //if (disposing)
                    //{
                    //    ////////////////////////////////////
                    //    // dispose managed resources here...
                    //    ////////////////////////////////////
                    //}

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////
                }
            }
            finally
            {
                base.Dispose(disposing);

                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteStreamAdapter Class
    /// <summary>
    /// This class is used to act as a bridge between a <see cref="Stream" />
    /// instance and the delegates used with the native streaming API.
    /// </summary>
    internal sealed class SQLiteStreamAdapter : IDisposable
    {
        #region Private Data
        /// <summary>
        /// The managed stream instance used to in order to service the native
        /// delegates for both input and output.
        /// </summary>
        private Stream stream;

        /// <summary>
        /// The flags associated with the connection.
        /// </summary>
        private SQLiteConnectionFlags flags;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The delegate used to provide input to the native streaming API.
        /// It will be null -OR- point to the <see cref="Input" /> method.
        /// </summary>
        private UnsafeNativeMethods.xSessionInput xInput;

        /// <summary>
        /// The delegate used to provide output to the native streaming API.
        /// It will be null -OR- point to the <see cref="Output" /> method.
        /// </summary>
        private UnsafeNativeMethods.xSessionOutput xOutput;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        /// <summary>
        /// Constructs a new instance of this class using the specified managed
        /// stream and connection flags.
        /// </summary>
        /// <param name="stream">
        /// The managed stream instance to be used in order to service the
        /// native delegates for both input and output.
        /// </param>
        /// <param name="flags">
        /// The flags associated with the parent connection.
        /// </param>
        public SQLiteStreamAdapter(
            Stream stream,
            SQLiteConnectionFlags flags
            )
        {
            this.stream = stream;
            this.flags = flags;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Methods
        /// <summary>
        /// Queries and returns the flags associated with the connection for
        /// this instance.
        /// </summary>
        /// <returns>
        /// The <see cref="SQLiteConnectionFlags" /> value.  There is no return
        /// value reserved to indicate an error.
        /// </returns>
        private SQLiteConnectionFlags GetFlags()
        {
            return flags;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Methods
        /// <summary>
        /// Returns a delegate that wraps the <see cref="Input" /> method,
        /// creating it first if necessary.
        /// </summary>
        /// <returns>
        /// A delegate that refers to the <see cref="Input" /> method.
        /// </returns>
        public UnsafeNativeMethods.xSessionInput GetInputDelegate()
        {
            CheckDisposed();

            if (xInput == null)
                xInput = new UnsafeNativeMethods.xSessionInput(Input);

            return xInput;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Returns a delegate that wraps the <see cref="Output" /> method,
        /// creating it first if necessary.
        /// </summary>
        /// <returns>
        /// A delegate that refers to the <see cref="Output" /> method.
        /// </returns>
        public UnsafeNativeMethods.xSessionOutput GetOutputDelegate()
        {
            CheckDisposed();

            if (xOutput == null)
                xOutput = new UnsafeNativeMethods.xSessionOutput(Output);

            return xOutput;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Native Callback Methods
        /// <summary>
        /// This method attempts to read <paramref name="nData" /> bytes from
        /// the managed stream, writing them to the <paramref name="pData"/>
        /// buffer.
        /// </summary>
        /// <param name="context">
        /// Optional extra context information.  Currently, this will always
        /// have a value of <see cref="IntPtr.Zero" />.
        /// </param>
        /// <param name="pData">
        /// A preallocated native buffer to receive the requested input bytes.
        /// It must be at least <paramref name="nData" /> bytes in size.
        /// </param>
        /// <param name="nData">
        /// Upon entry, the number of bytes to read.  Upon exit, the number of
        /// bytes actually read.  This value may be zero upon exit.
        /// </param>
        /// <returns>
        /// The value <see cref="SQLiteErrorCode.Ok" /> upon success -OR- an
        /// appropriate error code upon failure.
        /// </returns>
        private SQLiteErrorCode Input(
            IntPtr context,
            IntPtr pData,
            ref int nData
            )
        {
            try
            {
                Stream localStream = stream;

                if (localStream == null)
                    return SQLiteErrorCode.Misuse;

                if (nData > 0)
                {
                    byte[] bytes = new byte[nData];
                    int nRead = localStream.Read(bytes, 0, nData);

                    if ((nRead > 0) && (pData != IntPtr.Zero))
                        Marshal.Copy(bytes, 0, pData, nRead);

                    nData = nRead;
                }

                return SQLiteErrorCode.Ok;
            }
            catch (Exception e)
            {
                try
                {
                    if (HelperMethods.LogCallbackExceptions(GetFlags()))
                    {
                        SQLiteLog.LogMessage(
                            SQLiteBase.COR_E_EXCEPTION,
                            HelperMethods.StringFormat(
                            CultureInfo.CurrentCulture,
                            UnsafeNativeMethods.ExceptionMessageFormat,
                            "xSessionInput", e)); /* throw */
                    }
                }
                catch
                {
                    // do nothing.
                }
            }

            return SQLiteErrorCode.IoErr_Read;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method attempts to write <paramref name="nData" /> bytes to
        /// the managed stream, reading them from the <paramref name="pData"/>
        /// buffer.
        /// </summary>
        /// <param name="context">
        /// Optional extra context information.  Currently, this will always
        /// have a value of <see cref="IntPtr.Zero" />.
        /// </param>
        /// <param name="pData">
        /// A preallocated native buffer containing the requested output
        /// bytes.  It must be at least <paramref name="nData" /> bytes in
        /// size.
        /// </param>
        /// <param name="nData">
        /// The number of bytes to write.
        /// </param>
        /// <returns>
        /// The value <see cref="SQLiteErrorCode.Ok" /> upon success -OR- an
        /// appropriate error code upon failure.
        /// </returns>
        private SQLiteErrorCode Output(
            IntPtr context,
            IntPtr pData,
            int nData
            )
        {
            try
            {
                Stream localStream = stream;

                if (localStream == null)
                    return SQLiteErrorCode.Misuse;

                if (nData > 0)
                {
                    byte[] bytes = new byte[nData];

                    if (pData != IntPtr.Zero)
                        Marshal.Copy(pData, bytes, 0, nData);

                    localStream.Write(bytes, 0, nData);
                }

                localStream.Flush();

                return SQLiteErrorCode.Ok;
            }
            catch (Exception e)
            {
                try
                {
                    if (HelperMethods.LogCallbackExceptions(GetFlags()))
                    {
                        SQLiteLog.LogMessage(
                            SQLiteBase.COR_E_EXCEPTION,
                            HelperMethods.StringFormat(
                            CultureInfo.CurrentCulture,
                            UnsafeNativeMethods.ExceptionMessageFormat,
                            "xSessionOutput", e)); /* throw */
                    }
                }
                catch
                {
                    // do nothing.
                }
            }

            return SQLiteErrorCode.IoErr_Write;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable Members
        /// <summary>
        /// Disposes of this object instance.
        /// </summary>
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        /// <summary>
        /// Non-zero if this object instance has been disposed.
        /// </summary>
        private bool disposed;

        /// <summary>
        /// Throws an exception if this object instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteStreamAdapter).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes or finalizes this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this object is being disposed; otherwise, this object
        /// is being finalized.
        /// </param>
        private /* protected virtual */ void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        if (xInput != null)
                            xInput = null;

                        if (xOutput != null)
                            xOutput = null;

                        if (stream != null)
                            stream = null; /* NOT OWNED */
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////
                }
            }
            finally
            {
                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Destructor
        /// <summary>
        /// Finalizes this object instance.
        /// </summary>
        ~SQLiteStreamAdapter()
        {
            Dispose(false);
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteSessionStreamManager Class
    /// <summary>
    /// This class manages a collection of <see cref="SQLiteStreamAdapter"/>
    /// instances. When used, it takes responsibility for creating, returning,
    /// and disposing of its <see cref="SQLiteStreamAdapter"/> instances.
    /// </summary>
    internal sealed class SQLiteSessionStreamManager : IDisposable
    {
        #region Private Data
        /// <summary>
        /// The managed collection of <see cref="SQLiteStreamAdapter" />
        /// instances, keyed by their associated <see cref="Stream" />
        /// instance.
        /// </summary>
        private Dictionary<Stream, SQLiteStreamAdapter> streamAdapters;

        /// <summary>
        /// The flags associated with the connection.
        /// </summary>
        private SQLiteConnectionFlags flags;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        /// <summary>
        /// Constructs a new instance of this class using the specified
        /// connection flags.
        /// </summary>
        /// <param name="flags">
        /// The flags associated with the parent connection.
        /// </param>
        public SQLiteSessionStreamManager(
            SQLiteConnectionFlags flags
            )
        {
            this.flags = flags;

            InitializeStreamAdapters();
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Methods
        /// <summary>
        /// Makes sure the collection of <see cref="SQLiteStreamAdapter" />
        /// is created.
        /// </summary>
        private void InitializeStreamAdapters()
        {
            if (streamAdapters != null)
                return;

            streamAdapters = new Dictionary<Stream, SQLiteStreamAdapter>();
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Makes sure the collection of <see cref="SQLiteStreamAdapter" />
        /// is disposed.
        /// </summary>
        private void DisposeStreamAdapters()
        {
            if (streamAdapters == null)
                return;

            foreach (KeyValuePair<Stream, SQLiteStreamAdapter> pair
                    in streamAdapters)
            {
                SQLiteStreamAdapter streamAdapter = pair.Value;

                if (streamAdapter == null)
                    continue;

                streamAdapter.Dispose();
            }

            streamAdapters.Clear();
            streamAdapters = null;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Methods
        /// <summary>
        /// Attempts to return a <see cref="SQLiteStreamAdapter" /> instance
        /// suitable for the specified <see cref="Stream" />.
        /// </summary>
        /// <param name="stream">
        /// The <see cref="Stream" /> instance.  If this value is null, a null
        /// value will be returned.
        /// </param>
        /// <returns>
        /// A <see cref="SQLiteStreamAdapter" /> instance.  Typically, these
        /// are always freshly created; however, this method is designed to
        /// return the existing <see cref="SQLiteStreamAdapter" /> instance
        /// associated with the specified stream, should one exist.
        /// </returns>
        public SQLiteStreamAdapter GetAdapter(
            Stream stream
            )
        {
            CheckDisposed();

            if (stream == null)
                return null;

            SQLiteStreamAdapter streamAdapter;

            if (streamAdapters.TryGetValue(stream, out streamAdapter))
                return streamAdapter;

            streamAdapter = new SQLiteStreamAdapter(stream, flags);
            streamAdapters.Add(stream, streamAdapter);

            return streamAdapter;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable Members
        /// <summary>
        /// Disposes of this object instance.
        /// </summary>
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        /// <summary>
        /// Non-zero if this object instance has been disposed.
        /// </summary>
        private bool disposed;

        /// <summary>
        /// Throws an exception if this object instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteSessionStreamManager).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes or finalizes this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this object is being disposed; otherwise, this object
        /// is being finalized.
        /// </param>
        private /* protected virtual */ void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        DisposeStreamAdapters();
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////
                }
            }
            finally
            {
                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Destructor
        /// <summary>
        /// Finalizes this object instance.
        /// </summary>
        ~SQLiteSessionStreamManager()
        {
            Dispose(false);
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteChangeGroup Class
    /// <summary>
    /// This class represents a group of change sets (or patch sets).
    /// </summary>
    internal sealed class SQLiteChangeGroup : ISQLiteChangeGroup
    {
        #region Private Data
        /// <summary>
        /// The <see cref="SQLiteSessionStreamManager" /> instance associated
        /// with this change group.
        /// </summary>
        private SQLiteSessionStreamManager streamManager;

        /// <summary>
        /// The flags associated with the connection.
        /// </summary>
        private SQLiteConnectionFlags flags;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The native handle for this change group.  This will be deleted when
        /// this instance is disposed or finalized.
        /// </summary>
        private IntPtr changeGroup;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        /// <summary>
        /// Constructs a new instance of this class using the specified
        /// connection flags.
        /// </summary>
        /// <param name="flags">
        /// The flags associated with the parent connection.
        /// </param>
        public SQLiteChangeGroup(
            SQLiteConnectionFlags flags
            )
        {
            this.flags = flags;

            InitializeHandle();
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Methods
        /// <summary>
        /// Throws an exception if the native change group handle is invalid.
        /// </summary>
        private void CheckHandle()
        {
            if (changeGroup == IntPtr.Zero)
                throw new InvalidOperationException("change group not open");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Makes sure the native change group handle is valid, creating it if
        /// necessary.
        /// </summary>
        private void InitializeHandle()
        {
            if (changeGroup != IntPtr.Zero)
                return;

            SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changegroup_new(
                ref changeGroup);

            if (rc != SQLiteErrorCode.Ok)
                throw new SQLiteException(rc, "sqlite3changegroup_new");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Makes sure the <see cref="SQLiteSessionStreamManager" /> instance
        /// is available, creating it if necessary.
        /// </summary>
        private void InitializeStreamManager()
        {
            if (streamManager != null)
                return;

            streamManager = new SQLiteSessionStreamManager(flags);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to return a <see cref="SQLiteStreamAdapter" /> instance
        /// suitable for the specified <see cref="Stream" />.
        /// </summary>
        /// <param name="stream">
        /// The <see cref="Stream" /> instance.  If this value is null, a null
        /// value will be returned.
        /// </param>
        /// <returns>
        /// A <see cref="SQLiteStreamAdapter" /> instance.  Typically, these
        /// are always freshly created; however, this method is designed to
        /// return the existing <see cref="SQLiteStreamAdapter" /> instance
        /// associated with the specified stream, should one exist.
        /// </returns>
        private SQLiteStreamAdapter GetStreamAdapter(
            Stream stream
            )
        {
            InitializeStreamManager();

            return streamManager.GetAdapter(stream);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteChangeGroup Members
        /// <summary>
        /// Attempts to add a change set (or patch set) to this change group
        /// instance.  The underlying data must be contained entirely within
        /// the <paramref name="rawData" /> byte array.
        /// </summary>
        /// <param name="rawData">
        /// The raw byte data for the specified change set (or patch set).
        /// </param>
        public void AddChangeSet(
            byte[] rawData
            )
        {
            CheckDisposed();
            CheckHandle();

            SQLiteSessionHelpers.CheckRawData(rawData);

            IntPtr pData = IntPtr.Zero;

            try
            {
                int nData = 0;

                pData = SQLiteBytes.ToIntPtr(rawData, ref nData);

                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changegroup_add(
                    changeGroup, nData, pData);

                if (rc != SQLiteErrorCode.Ok)
                    throw new SQLiteException(rc, "sqlite3changegroup_add");
            }
            finally
            {
                if (pData != IntPtr.Zero)
                {
                    SQLiteMemory.Free(pData);
                    pData = IntPtr.Zero;
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to add a change set (or patch set) to this change group
        /// instance.  The underlying data will be read from the specified
        /// <see cref="Stream" />.
        /// </summary>
        /// <param name="stream">
        /// The <see cref="Stream" /> instance containing the raw change set
        /// (or patch set) data to read.
        /// </param>
        public void AddChangeSet(
            Stream stream
            )
        {
            CheckDisposed();
            CheckHandle();

            if (stream == null)
                throw new ArgumentNullException("stream");

            SQLiteStreamAdapter streamAdapter = GetStreamAdapter(stream);

            if (streamAdapter == null)
            {
                throw new SQLiteException(
                    "could not get or create adapter for input stream");
            }

            SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changegroup_add_strm(
                changeGroup, streamAdapter.GetInputDelegate(), IntPtr.Zero);

            if (rc != SQLiteErrorCode.Ok)
                throw new SQLiteException(rc, "sqlite3changegroup_add_strm");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to create and return, via <paramref name="rawData" />, the
        /// combined set of changes represented by this change group instance.
        /// </summary>
        /// <param name="rawData">
        /// Upon success, this will contain the raw byte data for all the
        /// changes in this change group instance.
        /// </param>
        public void CreateChangeSet(
            ref byte[] rawData
            )
        {
            CheckDisposed();
            CheckHandle();

            IntPtr pData = IntPtr.Zero;

            try
            {
                int nData = 0;

                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changegroup_output(
                    changeGroup, ref nData, ref pData);

                if (rc != SQLiteErrorCode.Ok)
                    throw new SQLiteException(rc, "sqlite3changegroup_output");

                rawData = SQLiteBytes.FromIntPtr(pData, nData);
            }
            finally
            {
                if (pData != IntPtr.Zero)
                {
                    SQLiteMemory.FreeUntracked(pData);
                    pData = IntPtr.Zero;
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to create and write, via <paramref name="stream" />, the
        /// combined set of changes represented by this change group instance.
        /// </summary>
        /// <param name="stream">
        /// Upon success, the raw byte data for all the changes in this change
        /// group instance will be written to this <see cref="Stream" />.
        /// </param>
        public void CreateChangeSet(
            Stream stream
            )
        {
            CheckDisposed();
            CheckHandle();

            if (stream == null)
                throw new ArgumentNullException("stream");

            SQLiteStreamAdapter streamAdapter = GetStreamAdapter(stream);

            if (streamAdapter == null)
            {
                throw new SQLiteException(
                    "could not get or create adapter for output stream");
            }

            SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changegroup_output_strm(
                changeGroup, streamAdapter.GetOutputDelegate(), IntPtr.Zero);

            if (rc != SQLiteErrorCode.Ok)
                throw new SQLiteException(rc, "sqlite3changegroup_output_strm");
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable Members
        /// <summary>
        /// Disposes of this object instance.
        /// </summary>
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        /// <summary>
        /// Non-zero if this object instance has been disposed.
        /// </summary>
        private bool disposed;

        /// <summary>
        /// Throws an exception if this object instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteChangeGroup).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes or finalizes this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this object is being disposed; otherwise, this object
        /// is being finalized.
        /// </param>
        private /* protected virtual */ void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        if (streamManager != null)
                        {
                            streamManager.Dispose();
                            streamManager = null;
                        }
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////

                    if (changeGroup != IntPtr.Zero)
                    {
                        UnsafeNativeMethods.sqlite3changegroup_delete(
                            changeGroup);

                        changeGroup = IntPtr.Zero;
                    }
                }
            }
            finally
            {
                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Destructor
        /// <summary>
        /// Finalizes this object instance.
        /// </summary>
        ~SQLiteChangeGroup()
        {
            Dispose(false);
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteSession Class
    /// <summary>
    /// This class represents the change tracking session associated with a
    /// database.
    /// </summary>
    internal sealed class SQLiteSession : SQLiteConnectionLock, ISQLiteSession
    {
        #region Private Data
        /// <summary>
        /// The <see cref="SQLiteSessionStreamManager" /> instance associated
        /// with this session.
        /// </summary>
        private SQLiteSessionStreamManager streamManager;

        /// <summary>
        /// The name of the database (e.g. "main") for this session.
        /// </summary>
        private string databaseName;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The native handle for this session.  This will be deleted when
        /// this instance is disposed or finalized.
        /// </summary>
        private IntPtr session;

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// The delegate used to provide table filtering to the native API.
        /// It will be null -OR- point to the <see cref="Filter" /> method.
        /// </summary>
        private UnsafeNativeMethods.xSessionFilter xFilter;

        /// <summary>
        /// The managed callback used to filter tables for this session.  Set
        /// via the <see cref="SetTableFilter" /> method.
        /// </summary>
        private SessionTableFilterCallback tableFilterCallback;

        /// <summary>
        /// The optional application-defined context data that was passed to
        /// the <see cref="SetTableFilter" /> method.  This value may be null.
        /// </summary>
        private object tableFilterClientData;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        /// <summary>
        /// Constructs a new instance of this class using the specified wrapped
        /// native connection handle and associated flags.
        /// </summary>
        /// <param name="handle">
        /// The wrapped native connection handle to be associated with this
        /// session.
        /// </param>
        /// <param name="flags">
        /// The flags associated with the connection represented by the
        /// <paramref name="handle" /> value.
        /// </param>
        /// <param name="databaseName">
        /// The name of the database (e.g. "main") for this session.
        /// </param>
        public SQLiteSession(
            SQLiteConnectionHandle handle,
            SQLiteConnectionFlags flags,
            string databaseName
            )
            : base(handle, flags, true)
        {
            this.databaseName = databaseName;

            InitializeHandle();
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Methods
        /// <summary>
        /// Throws an exception if the native session handle is invalid.
        /// </summary>
        private void CheckHandle()
        {
            if (session == IntPtr.Zero)
                throw new InvalidOperationException("session is not open");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Makes sure the native session handle is valid, creating it if
        /// necessary.
        /// </summary>
        private void InitializeHandle()
        {
            if (session != IntPtr.Zero)
                return;

            SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3session_create(
                GetIntPtr(), SQLiteString.GetUtf8BytesFromString(databaseName),
                ref session);

            if (rc != SQLiteErrorCode.Ok)
                throw new SQLiteException(rc, "sqlite3session_create");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method sets up the internal table filtering associated state
        /// of this instance.
        /// </summary>
        /// <param name="callback">
        /// The table filter callback -OR- null to clear any existing table
        /// filter callback.
        /// </param>
        /// <param name="clientData">
        /// The optional application-defined context data.  This value may be
        /// null.
        /// </param>
        /// <returns>
        /// The <see cref="UnsafeNativeMethods.xSessionFilter" /> native
        /// delegate -OR- null to clear any existing table filter.
        /// </returns>
        private UnsafeNativeMethods.xSessionFilter ApplyTableFilter(
            SessionTableFilterCallback callback, /* in: NULL OK */
            object clientData                    /* in: NULL OK */
            )
        {
            tableFilterCallback = callback;
            tableFilterClientData = clientData;

            if (callback == null)
            {
                if (xFilter != null)
                    xFilter = null;

                return null;
            }

            if (xFilter == null)
                xFilter = new UnsafeNativeMethods.xSessionFilter(Filter);

            return xFilter;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Makes sure the <see cref="SQLiteSessionStreamManager" /> instance
        /// is available, creating it if necessary.
        /// </summary>
        private void InitializeStreamManager()
        {
            if (streamManager != null)
                return;

            streamManager = new SQLiteSessionStreamManager(GetFlags());
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to return a <see cref="SQLiteStreamAdapter" /> instance
        /// suitable for the specified <see cref="Stream" />.
        /// </summary>
        /// <param name="stream">
        /// The <see cref="Stream" /> instance.  If this value is null, a null
        /// value will be returned.
        /// </param>
        /// <returns>
        /// A <see cref="SQLiteStreamAdapter" /> instance.  Typically, these
        /// are always freshly created; however, this method is designed to
        /// return the existing <see cref="SQLiteStreamAdapter" /> instance
        /// associated with the specified stream, should one exist.
        /// </returns>
        private SQLiteStreamAdapter GetStreamAdapter(
            Stream stream
            )
        {
            InitializeStreamManager();

            return streamManager.GetAdapter(stream);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Native Callback Methods
        /// <summary>
        /// This method is called when determining if a table needs to be
        /// included in the tracked changes for the associated database.
        /// </summary>
        /// <param name="context">
        /// Optional extra context information.  Currently, this will always
        /// have a value of <see cref="IntPtr.Zero" />.
        /// </param>
        /// <param name="pTblName">
        /// The native pointer to the name of the table.
        /// </param>
        /// <returns>
        /// Non-zero if changes to the specified table should be considered;
        /// otherwise, zero.
        /// </returns>
        private int Filter(
            IntPtr context, /* NOT USED */
            IntPtr pTblName
            )
        {
            try
            {
                return tableFilterCallback(tableFilterClientData,
                    SQLiteString.StringFromUtf8IntPtr(pTblName)) ? 1 : 0;
            }
            catch (Exception e)
            {
                try
                {
                    if (HelperMethods.LogCallbackExceptions(GetFlags()))
                    {
                        SQLiteLog.LogMessage( /* throw */
                            SQLiteBase.COR_E_EXCEPTION,
                            HelperMethods.StringFormat(
                            CultureInfo.CurrentCulture,
                            UnsafeNativeMethods.ExceptionMessageFormat,
                            "xSessionFilter", e));
                    }
                }
                catch
                {
                    // do nothing.
                }
            }

            return 0;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteSession Members
        /// <summary>
        /// Determines if this session is currently tracking changes to its
        /// associated database.
        /// </summary>
        /// <returns>
        /// Non-zero if changes to the associated database are being trakced;
        /// otherwise, zero.
        /// </returns>
        public bool IsEnabled()
        {
            CheckDisposed();
            CheckHandle();

            return UnsafeNativeMethods.sqlite3session_enable(session, -1) != 0;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Enables tracking of changes to the associated database.
        /// </summary>
        public void SetToEnabled()
        {
            CheckDisposed();
            CheckHandle();

            UnsafeNativeMethods.sqlite3session_enable(session, 1);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disables tracking of changes to the associated database.
        /// </summary>
        public void SetToDisabled()
        {
            CheckDisposed();
            CheckHandle();

            UnsafeNativeMethods.sqlite3session_enable(session, 0);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Determines if this session is currently set to mark changes as
        /// indirect (i.e. as though they were made via a trigger or foreign
        /// key action).
        /// </summary>
        /// <returns>
        /// Non-zero if changes to the associated database are being marked as
        /// indirect; otherwise, zero.
        /// </returns>
        public bool IsIndirect()
        {
            CheckDisposed();
            CheckHandle();

            return UnsafeNativeMethods.sqlite3session_indirect(session, -1) != 0;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Sets the indirect flag for this session.  Subsequent changes will
        /// be marked as indirect until this flag is changed again.
        /// </summary>
        public void SetToIndirect()
        {
            CheckDisposed();
            CheckHandle();

            UnsafeNativeMethods.sqlite3session_indirect(session, 1);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Clears the indirect flag for this session.  Subsequent changes will
        /// be marked as direct until this flag is changed again.
        /// </summary>
        public void SetToDirect()
        {
            CheckDisposed();
            CheckHandle();

            UnsafeNativeMethods.sqlite3session_indirect(session, 0);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Determines if there are any tracked changes currently within the
        /// data for this session.
        /// </summary>
        /// <returns>
        /// Non-zero if there are no changes within the data for this session;
        /// otherwise, zero.
        /// </returns>
        public bool IsEmpty()
        {
            CheckDisposed();
            CheckHandle();

            return UnsafeNativeMethods.sqlite3session_isempty(session) != 0;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method attempts to determine the amount of memory used by the
        /// session.
        /// </summary>
        /// <returns>
        /// The number of bytes used by the session.
        /// </returns>
        public long GetMemoryBytesInUse()
        {
            CheckDisposed();
            CheckHandle();

            return UnsafeNativeMethods.sqlite3session_memory_used(session);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Upon success, causes changes to the specified table(s) to start
        /// being tracked.  Any tables impacted by calls to this method will
        /// not cause the <see cref="SessionTableFilterCallback" /> callback
        /// to be invoked.
        /// </summary>
        /// <param name="name">
        /// The name of the table to be tracked -OR- null to track all
        /// applicable tables within this database.
        /// </param>
        public void AttachTable(
            string name /* in: NULL OK */
            )
        {
            CheckDisposed();
            CheckHandle();

            SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3session_attach(
                session, SQLiteString.GetUtf8BytesFromString(name));

            if (rc != SQLiteErrorCode.Ok)
                throw new SQLiteException(rc, "sqlite3session_attach");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method is used to set the table filter for this instance.
        /// </summary>
        /// <param name="callback">
        /// The table filter callback -OR- null to clear any existing table
        /// filter callback.
        /// </param>
        /// <param name="clientData">
        /// The optional application-defined context data.  This value may be
        /// null.
        /// </param>
        public void SetTableFilter(
            SessionTableFilterCallback callback, /* in: NULL OK */
            object clientData                    /* in: NULL OK */
            )
        {
            CheckDisposed();
            CheckHandle();

            UnsafeNativeMethods.sqlite3session_table_filter(
                session, ApplyTableFilter(callback, clientData), IntPtr.Zero);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to create and return, via <paramref name="rawData" />, the
        /// set of changes represented by this session instance.
        /// </summary>
        /// <param name="rawData">
        /// Upon success, this will contain the raw byte data for all the
        /// changes in this session instance.
        /// </param>
        public void CreateChangeSet(
            ref byte[] rawData
            )
        {
            CheckDisposed();
            CheckHandle();

            IntPtr pData = IntPtr.Zero;

            try
            {
                int nData = 0;

                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3session_changeset(
                    session, ref nData, ref pData);

                if (rc != SQLiteErrorCode.Ok)
                    throw new SQLiteException(rc, "sqlite3session_changeset");

                rawData = SQLiteBytes.FromIntPtr(pData, nData);
            }
            finally
            {
                if (pData != IntPtr.Zero)
                {
                    SQLiteMemory.FreeUntracked(pData);
                    pData = IntPtr.Zero;
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to create and write, via <paramref name="stream" />, the
        /// set of changes represented by this session instance.
        /// </summary>
        /// <param name="stream">
        /// Upon success, the raw byte data for all the changes in this session
        /// instance will be written to this <see cref="Stream" />.
        /// </param>
        public void CreateChangeSet(
            Stream stream
            )
        {
            CheckDisposed();
            CheckHandle();

            if (stream == null)
                throw new ArgumentNullException("stream");

            SQLiteStreamAdapter streamAdapter = GetStreamAdapter(stream);

            if (streamAdapter == null)
            {
                throw new SQLiteException(
                    "could not get or create adapter for output stream");
            }

            SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3session_changeset_strm(
                session, streamAdapter.GetOutputDelegate(), IntPtr.Zero);

            if (rc != SQLiteErrorCode.Ok)
                throw new SQLiteException(rc, "sqlite3session_changeset_strm");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to create and return, via <paramref name="rawData" />, the
        /// set of changes represented by this session instance as a patch set.
        /// </summary>
        /// <param name="rawData">
        /// Upon success, this will contain the raw byte data for all the
        /// changes in this session instance.
        /// </param>
        public void CreatePatchSet(
            ref byte[] rawData
            )
        {
            CheckDisposed();
            CheckHandle();

            IntPtr pData = IntPtr.Zero;

            try
            {
                int nData = 0;

                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3session_patchset(
                    session, ref nData, ref pData);

                if (rc != SQLiteErrorCode.Ok)
                    throw new SQLiteException(rc, "sqlite3session_patchset");

                rawData = SQLiteBytes.FromIntPtr(pData, nData);
            }
            finally
            {
                if (pData != IntPtr.Zero)
                {
                    SQLiteMemory.FreeUntracked(pData);
                    pData = IntPtr.Zero;
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to create and write, via <paramref name="stream" />, the
        /// set of changes represented by this session instance as a patch set.
        /// </summary>
        /// <param name="stream">
        /// Upon success, the raw byte data for all the changes in this session
        /// instance will be written to this <see cref="Stream" />.
        /// </param>
        public void CreatePatchSet(
            Stream stream
            )
        {
            CheckDisposed();
            CheckHandle();

            if (stream == null)
                throw new ArgumentNullException("stream");

            SQLiteStreamAdapter streamAdapter = GetStreamAdapter(stream);

            if (streamAdapter == null)
            {
                throw new SQLiteException(
                    "could not get or create adapter for output stream");
            }

            SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3session_patchset_strm(
                session, streamAdapter.GetOutputDelegate(), IntPtr.Zero);

            if (rc != SQLiteErrorCode.Ok)
                throw new SQLiteException(rc, "sqlite3session_patchset_strm");
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method loads the differences between two tables [with the same
        /// name, set of columns, and primary key definition] into this session
        /// instance.
        /// </summary>
        /// <param name="fromDatabaseName">
        /// The name of the database containing the table with the original
        /// data (i.e. it will need updating in order to be identical to the
        /// one within the database associated with this session instance).
        /// </param>
        /// <param name="tableName">
        /// The name of the table.
        /// </param>
        public void LoadDifferencesFromTable(
            string fromDatabaseName,
            string tableName
            )
        {
            CheckDisposed();
            CheckHandle();

            if (fromDatabaseName == null)
                throw new ArgumentNullException("fromDatabaseName");

            if (tableName == null)
                throw new ArgumentNullException("tableName");

            IntPtr pError = IntPtr.Zero;

            try
            {
                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3session_diff(
                    session, SQLiteString.GetUtf8BytesFromString(fromDatabaseName),
                    SQLiteString.GetUtf8BytesFromString(tableName), ref pError);

                if (rc != SQLiteErrorCode.Ok)
                {
                    string error = null;

                    if (pError != IntPtr.Zero)
                    {
                        error = SQLiteString.StringFromUtf8IntPtr(pError);

                        if (!String.IsNullOrEmpty(error))
                        {
                            error = HelperMethods.StringFormat(
                                CultureInfo.CurrentCulture, ": {0}", error);
                        }
                    }

                    throw new SQLiteException(rc, HelperMethods.StringFormat(
                        CultureInfo.CurrentCulture, "{0}{1}",
                        "sqlite3session_diff", error));
                }
            }
            finally
            {
                if (pError != IntPtr.Zero)
                {
                    SQLiteMemory.FreeUntracked(pError);
                    pError = IntPtr.Zero;
                }
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        /// <summary>
        /// Non-zero if this object instance has been disposed.
        /// </summary>
        private bool disposed;

        /// <summary>
        /// Throws an exception if this object instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
                throw new ObjectDisposedException(typeof(SQLiteSession).Name);
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes or finalizes this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this object is being disposed; otherwise, this object
        /// is being finalized.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        if (xFilter != null)
                            xFilter = null;

                        if (streamManager != null)
                        {
                            streamManager.Dispose();
                            streamManager = null;
                        }
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////

                    if (session != IntPtr.Zero)
                    {
                        UnsafeNativeMethods.sqlite3session_delete(session);
                        session = IntPtr.Zero;
                    }

                    Unlock();
                }
            }
            finally
            {
                base.Dispose(disposing);

                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteChangeSetBase Class
    /// <summary>
    /// This class represents the abstract concept of a set of changes.  It
    /// acts as the base class for the <see cref="SQLiteMemoryChangeSet" />
    /// and <see cref="SQLiteStreamChangeSet" /> classes.  It derives from
    /// the <see cref="SQLiteConnectionLock" /> class, which is used to hold
    /// the underlying native connection handle open until the instances of
    /// this class are disposed or finalized.  It also provides the ability
    /// to construct wrapped native delegates of the
    /// <see cref="UnsafeNativeMethods.xSessionFilter" /> and
    /// <see cref="UnsafeNativeMethods.xSessionConflict" /> types.
    /// </summary>
    internal class SQLiteChangeSetBase : SQLiteConnectionLock
    {
        #region Private Constructors
        /// <summary>
        /// Constructs an instance of this class using the specified wrapped
        /// native connection handle.
        /// </summary>
        /// <param name="handle">
        /// The wrapped native connection handle to be associated with this
        /// change set.
        /// </param>
        /// <param name="flags">
        /// The flags associated with the connection represented by the
        /// <paramref name="handle" /> value.
        /// </param>
        internal SQLiteChangeSetBase(
            SQLiteConnectionHandle handle,
            SQLiteConnectionFlags flags
            )
            : base(handle, flags, true)
        {
            // do nothing.
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Methods
        /// <summary>
        /// Creates and returns a concrete implementation of the
        /// <see cref="ISQLiteChangeSetMetadataItem" /> interface.
        /// </summary>
        /// <param name="iterator">
        /// The native iterator handle to use.
        /// </param>
        /// <returns>
        /// An instance of the <see cref="ISQLiteChangeSetMetadataItem"/>
        /// interface, which can be used to fetch metadata associated with
        /// the current item in this set of changes.
        /// </returns>
        private ISQLiteChangeSetMetadataItem CreateMetadataItem(
            IntPtr iterator
            )
        {
            return new SQLiteChangeSetMetadataItem(
                SQLiteChangeSetIterator.Attach(iterator));
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Protected Methods
        /// <summary>
        /// Attempts to create a
        /// <see cref="UnsafeNativeMethods.xSessionFilter" /> native delegate
        /// that invokes the specified
        /// <see cref="SessionTableFilterCallback" /> delegate.
        /// </summary>
        /// <param name="tableFilterCallback">
        /// The <see cref="SessionTableFilterCallback" /> to invoke when the
        /// <see cref="UnsafeNativeMethods.xSessionFilter" /> native delegate
        /// is called.  If this value is null then null is returned.
        /// </param>
        /// <param name="clientData">
        /// The optional application-defined context data.  This value may be
        /// null.
        /// </param>
        /// <returns>
        /// The created <see cref="UnsafeNativeMethods.xSessionFilter" />
        /// native delegate -OR- null if it cannot be created.
        /// </returns>
        protected UnsafeNativeMethods.xSessionFilter GetDelegate(
            SessionTableFilterCallback tableFilterCallback,
            object clientData
            )
        {
            if (tableFilterCallback == null)
                return null;

            UnsafeNativeMethods.xSessionFilter xFilter;

            xFilter = new UnsafeNativeMethods.xSessionFilter(
                delegate(IntPtr context, IntPtr pTblName)
            {
                try
                {
                    string name = SQLiteString.StringFromUtf8IntPtr(
                        pTblName);

                    return tableFilterCallback(clientData, name) ? 1 : 0;
                }
                catch (Exception e)
                {
                    try
                    {
                        if (HelperMethods.LogCallbackExceptions(GetFlags()))
                        {
                            SQLiteLog.LogMessage( /* throw */
                                SQLiteBase.COR_E_EXCEPTION,
                                HelperMethods.StringFormat(
                                CultureInfo.CurrentCulture,
                                UnsafeNativeMethods.ExceptionMessageFormat,
                                "xSessionFilter", e));
                        }
                    }
                    catch
                    {
                        // do nothing.
                    }
                }

                return 0;
            });

            return xFilter;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to create a
        /// <see cref="UnsafeNativeMethods.xSessionConflict" /> native delegate
        /// that invokes the specified
        /// <see cref="SessionConflictCallback" /> delegate.
        /// </summary>
        /// <param name="conflictCallback">
        /// The <see cref="SessionConflictCallback" /> to invoke when the
        /// <see cref="UnsafeNativeMethods.xSessionConflict" /> native delegate
        /// is called.  If this value is null then null is returned.
        /// </param>
        /// <param name="clientData">
        /// The optional application-defined context data.  This value may be
        /// null.
        /// </param>
        /// <returns>
        /// The created <see cref="UnsafeNativeMethods.xSessionConflict" />
        /// native delegate -OR- null if it cannot be created.
        /// </returns>
        protected UnsafeNativeMethods.xSessionConflict GetDelegate(
            SessionConflictCallback conflictCallback,
            object clientData
            )
        {
            if (conflictCallback == null)
                return null;

            UnsafeNativeMethods.xSessionConflict xConflict;

            xConflict = new UnsafeNativeMethods.xSessionConflict(
                delegate(IntPtr context,
                         SQLiteChangeSetConflictType type,
                         IntPtr iterator)
            {
                try
                {
                    ISQLiteChangeSetMetadataItem item = CreateMetadataItem(
                        iterator);

                    if (item == null)
                    {
                        throw new SQLiteException(
                            "could not create metadata item");
                    }

                    return conflictCallback(clientData, type, item);
                }
                catch (Exception e)
                {
                    try
                    {
                        if (HelperMethods.LogCallbackExceptions(GetFlags()))
                        {
                            SQLiteLog.LogMessage( /* throw */
                                SQLiteBase.COR_E_EXCEPTION,
                                HelperMethods.StringFormat(
                                CultureInfo.CurrentCulture,
                                UnsafeNativeMethods.ExceptionMessageFormat,
                                "xSessionConflict", e));
                        }
                    }
                    catch
                    {
                        // do nothing.
                    }
                }

                return SQLiteChangeSetConflictResult.Abort;
            });

            return xConflict;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        /// <summary>
        /// Non-zero if this object instance has been disposed.
        /// </summary>
        private bool disposed;

        /// <summary>
        /// Throws an exception if this object instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteChangeSetBase).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes or finalizes this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this object is being disposed; otherwise, this object
        /// is being finalized.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////

                    Unlock();
                }
            }
            finally
            {
                base.Dispose(disposing);

                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteMemoryChangeSet Class
    /// <summary>
    /// This class represents a set of changes contained entirely in memory.
    /// </summary>
    internal sealed class SQLiteMemoryChangeSet :
        SQLiteChangeSetBase, ISQLiteChangeSet
    {
        #region Private Data
        /// <summary>
        /// The raw byte data for this set of changes.  Since this data must
        /// be marshalled to a native memory buffer before being used, there
        /// must be enough memory available to store at least two times the
        /// amount of data contained within it.
        /// </summary>
        private byte[] rawData;

        /// <summary>
        /// The flags used to create the change set iterator.
        /// </summary>
        private SQLiteChangeSetStartFlags startFlags;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Constructors
        /// <summary>
        /// Constructs an instance of this class using the specified raw byte
        /// data and wrapped native connection handle.
        /// </summary>
        /// <param name="rawData">
        /// The raw byte data for the specified change set (or patch set).
        /// </param>
        /// <param name="handle">
        /// The wrapped native connection handle to be associated with this
        /// set of changes.
        /// </param>
        /// <param name="connectionFlags">
        /// The flags associated with the connection represented by the
        /// <paramref name="handle" /> value.
        /// </param>
        internal SQLiteMemoryChangeSet(
            byte[] rawData,
            SQLiteConnectionHandle handle,
            SQLiteConnectionFlags connectionFlags
            )
            : base(handle, connectionFlags)
        {
            this.rawData = rawData;
            this.startFlags = SQLiteChangeSetStartFlags.None;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Constructs an instance of this class using the specified raw byte
        /// data and wrapped native connection handle.
        /// </summary>
        /// <param name="rawData">
        /// The raw byte data for the specified change set (or patch set).
        /// </param>
        /// <param name="handle">
        /// The wrapped native connection handle to be associated with this
        /// set of changes.
        /// </param>
        /// <param name="connectionFlags">
        /// The flags associated with the connection represented by the
        /// <paramref name="handle" /> value.
        /// </param>
        /// <param name="startFlags">
        /// The flags used to create the change set iterator.
        /// </param>
        internal SQLiteMemoryChangeSet(
            byte[] rawData,
            SQLiteConnectionHandle handle,
            SQLiteConnectionFlags connectionFlags,
            SQLiteChangeSetStartFlags startFlags
            )
            : base(handle, connectionFlags)
        {
            this.rawData = rawData;
            this.startFlags = startFlags;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteChangeSet Members
        /// <summary>
        /// This method "inverts" the set of changes within this instance.
        /// Applying an inverted set of changes to a database reverses the
        /// effects of applying the uninverted changes.  Specifically:
        /// <![CDATA[<ul>]]><![CDATA[<li>]]>
        /// Each DELETE change is changed to an INSERT, and
        /// <![CDATA[</li>]]><![CDATA[<li>]]>
        /// Each INSERT change is changed to a DELETE, and
        /// <![CDATA[</li>]]><![CDATA[<li>]]>
        /// For each UPDATE change, the old.* and new.* values are exchanged.
        /// <![CDATA[</li>]]><![CDATA[</ul>]]>
        /// This method does not change the order in which changes appear
        /// within the set of changes. It merely reverses the sense of each
        /// individual change.
        /// </summary>
        /// <returns>
        /// The new <see cref="ISQLiteChangeSet" /> instance that represents
        /// the resulting set of changes.
        /// </returns>
        public ISQLiteChangeSet Invert()
        {
            CheckDisposed();

            SQLiteSessionHelpers.CheckRawData(rawData);

            IntPtr pInData = IntPtr.Zero;
            IntPtr pOutData = IntPtr.Zero;

            try
            {
                int nInData = 0;

                pInData = SQLiteBytes.ToIntPtr(rawData, ref nInData);

                int nOutData = 0;

                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changeset_invert(
                    nInData, pInData, ref nOutData, ref pOutData);

                if (rc != SQLiteErrorCode.Ok)
                    throw new SQLiteException(rc, "sqlite3changeset_invert");

                byte[] newData = SQLiteBytes.FromIntPtr(pOutData, nOutData);

                return new SQLiteMemoryChangeSet(
                    newData, GetHandle(), GetFlags());
            }
            finally
            {
                if (pOutData != IntPtr.Zero)
                {
                    SQLiteMemory.FreeUntracked(pOutData);
                    pOutData = IntPtr.Zero;
                }

                if (pInData != IntPtr.Zero)
                {
                    SQLiteMemory.Free(pInData);
                    pInData = IntPtr.Zero;
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method combines the specified set of changes with the ones
        /// contained in this instance.
        /// </summary>
        /// <param name="changeSet">
        /// The changes to be combined with those in this instance.
        /// </param>
        /// <returns>
        /// The new <see cref="ISQLiteChangeSet" /> instance that represents
        /// the resulting set of changes.
        /// </returns>
        public ISQLiteChangeSet CombineWith(
            ISQLiteChangeSet changeSet
            )
        {
            CheckDisposed();

            SQLiteSessionHelpers.CheckRawData(rawData);

            SQLiteMemoryChangeSet memoryChangeSet =
                changeSet as SQLiteMemoryChangeSet;

            if (memoryChangeSet == null)
            {
                throw new ArgumentException(
                    "not a memory based change set", "changeSet");
            }

            SQLiteSessionHelpers.CheckRawData(memoryChangeSet.rawData);

            IntPtr pInData1 = IntPtr.Zero;
            IntPtr pInData2 = IntPtr.Zero;
            IntPtr pOutData = IntPtr.Zero;

            try
            {
                int nInData1 = 0;

                pInData1 = SQLiteBytes.ToIntPtr(rawData, ref nInData1);

                int nInData2 = 0;

                pInData2 = SQLiteBytes.ToIntPtr(
                    memoryChangeSet.rawData, ref nInData2);

                int nOutData = 0;

                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changeset_concat(
                    nInData1, pInData1, nInData2, pInData2, ref nOutData,
                    ref pOutData);

                if (rc != SQLiteErrorCode.Ok)
                    throw new SQLiteException(rc, "sqlite3changeset_concat");

                byte[] newData = SQLiteBytes.FromIntPtr(pOutData, nOutData);

                return new SQLiteMemoryChangeSet(
                    newData, GetHandle(), GetFlags());
            }
            finally
            {
                if (pOutData != IntPtr.Zero)
                {
                    SQLiteMemory.FreeUntracked(pOutData);
                    pOutData = IntPtr.Zero;
                }

                if (pInData2 != IntPtr.Zero)
                {
                    SQLiteMemory.Free(pInData2);
                    pInData2 = IntPtr.Zero;
                }

                if (pInData1 != IntPtr.Zero)
                {
                    SQLiteMemory.Free(pInData1);
                    pInData1 = IntPtr.Zero;
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to apply the set of changes in this instance to the
        /// associated database.
        /// </summary>
        /// <param name="conflictCallback">
        /// The <see cref="SessionConflictCallback" /> delegate that will need
        /// to handle any conflicting changes that may arise.
        /// </param>
        /// <param name="clientData">
        /// The optional application-defined context data.  This value may be
        /// null.
        /// </param>
        public void Apply(
            SessionConflictCallback conflictCallback,
            object clientData
            )
        {
            CheckDisposed();

            Apply(conflictCallback, null, clientData);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to apply the set of changes in this instance to the
        /// associated database.
        /// </summary>
        /// <param name="conflictCallback">
        /// The <see cref="SessionConflictCallback" /> delegate that will need
        /// to handle any conflicting changes that may arise.
        /// </param>
        /// <param name="tableFilterCallback">
        /// The optional <see cref="SessionTableFilterCallback" /> delegate
        /// that can be used to filter the list of tables impacted by the set
        /// of changes.
        /// </param>
        /// <param name="clientData">
        /// The optional application-defined context data.  This value may be
        /// null.
        /// </param>
        public void Apply(
            SessionConflictCallback conflictCallback,
            SessionTableFilterCallback tableFilterCallback,
            object clientData
            )
        {
            CheckDisposed();

            SQLiteSessionHelpers.CheckRawData(rawData);

            if (conflictCallback == null)
                throw new ArgumentNullException("conflictCallback");

            UnsafeNativeMethods.xSessionFilter xFilter = GetDelegate(
                tableFilterCallback, clientData);

            UnsafeNativeMethods.xSessionConflict xConflict = GetDelegate(
                conflictCallback, clientData);

            IntPtr pData = IntPtr.Zero;

            try
            {
                int nData = 0;

                pData = SQLiteBytes.ToIntPtr(rawData, ref nData);

                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changeset_apply(
                    GetIntPtr(), nData, pData, xFilter, xConflict, IntPtr.Zero);

                if (rc != SQLiteErrorCode.Ok)
                    throw new SQLiteException(rc, "sqlite3changeset_apply");
            }
            finally
            {
                if (pData != IntPtr.Zero)
                {
                    SQLiteMemory.Free(pData);
                    pData = IntPtr.Zero;
                }
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IEnumerable<ISQLiteChangeSetMetadataItem> Members
        /// <summary>
        /// Creates an <see cref="IEnumerator" /> capable of iterating over the
        /// items within this set of changes.
        /// </summary>
        /// <returns>
        /// The new <see cref="IEnumerator{ISQLiteChangeSetMetadataItem}" />
        /// instance.
        /// </returns>
        public IEnumerator<ISQLiteChangeSetMetadataItem> GetEnumerator()
        {
            if (startFlags != SQLiteChangeSetStartFlags.None)
            {
                return new SQLiteMemoryChangeSetEnumerator(
                    rawData, startFlags);
            }
            else
            {
                return new SQLiteMemoryChangeSetEnumerator(rawData);
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IEnumerable Members
        /// <summary>
        /// Creates an <see cref="IEnumerator" /> capable of iterating over the
        /// items within this set of changes.
        /// </summary>
        /// <returns>
        /// The new <see cref="IEnumerator" /> instance.
        /// </returns>
        IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        /// <summary>
        /// Non-zero if this object instance has been disposed.
        /// </summary>
        private bool disposed;

        /// <summary>
        /// Throws an exception if this object instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteMemoryChangeSet).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes or finalizes this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this object is being disposed; otherwise, this object
        /// is being finalized.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        if (rawData != null)
                            rawData = null;
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////
                }
            }
            finally
            {
                base.Dispose(disposing);

                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteStreamChangeSet Class
    /// <summary>
    /// This class represents a set of changes that are backed by a
    /// <see cref="Stream" /> instance.
    /// </summary>
    internal sealed class SQLiteStreamChangeSet :
        SQLiteChangeSetBase, ISQLiteChangeSet
    {
        #region Private Data
        /// <summary>
        /// The <see cref="SQLiteStreamAdapter" /> instance that is managing
        /// the underlying input <see cref="Stream" /> used as the backing
        /// store for the set of changes associated with this instance.
        /// </summary>
        private SQLiteStreamAdapter inputStreamAdapter;

        /// <summary>
        /// The <see cref="SQLiteStreamAdapter" /> instance that is managing
        /// the underlying output <see cref="Stream" /> used as the backing
        /// store for the set of changes generated by the <see cref="Invert" />
        /// or <see cref="CombineWith" /> methods.
        /// </summary>
        private SQLiteStreamAdapter outputStreamAdapter;

        /// <summary>
        /// The <see cref="Stream" /> instance used as the backing store for
        /// the set of changes associated with this instance.
        /// </summary>
        private Stream inputStream;

        /// <summary>
        /// The <see cref="Stream" /> instance used as the backing store for
        /// the set of changes generated by the <see cref="Invert" /> or
        /// <see cref="CombineWith" /> methods.
        /// </summary>
        private Stream outputStream;

        /// <summary>
        /// The flags used to create the change set iterator.
        /// </summary>
        private SQLiteChangeSetStartFlags startFlags;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Constructors
        /// <summary>
        /// Constructs an instance of this class using the specified streams
        /// and wrapped native connection handle.
        /// </summary>
        /// <param name="inputStream">
        /// The <see cref="Stream" /> where the raw byte data for the set of
        /// changes may be read.
        /// </param>
        /// <param name="outputStream">
        /// The <see cref="Stream" /> where the raw byte data for resulting
        /// sets of changes may be written.
        /// </param>
        /// <param name="handle">
        /// The wrapped native connection handle to be associated with this
        /// set of changes.
        /// </param>
        /// <param name="connectionFlags">
        /// The flags associated with the connection represented by the
        /// <paramref name="handle" /> value.
        /// </param>
        internal SQLiteStreamChangeSet(
            Stream inputStream,
            Stream outputStream,
            SQLiteConnectionHandle handle,
            SQLiteConnectionFlags connectionFlags
            )
            : base(handle, connectionFlags)
        {
            this.inputStream = inputStream;
            this.outputStream = outputStream;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Constructs an instance of this class using the specified streams
        /// and wrapped native connection handle.
        /// </summary>
        /// <param name="inputStream">
        /// The <see cref="Stream" /> where the raw byte data for the set of
        /// changes may be read.
        /// </param>
        /// <param name="outputStream">
        /// The <see cref="Stream" /> where the raw byte data for resulting
        /// sets of changes may be written.
        /// </param>
        /// <param name="handle">
        /// The wrapped native connection handle to be associated with this
        /// set of changes.
        /// </param>
        /// <param name="connectionFlags">
        /// The flags associated with the connection represented by the
        /// <paramref name="handle" /> value.
        /// </param>
        /// <param name="startFlags">
        /// The flags used to create the change set iterator.
        /// </param>
        internal SQLiteStreamChangeSet(
            Stream inputStream,
            Stream outputStream,
            SQLiteConnectionHandle handle,
            SQLiteConnectionFlags connectionFlags,
            SQLiteChangeSetStartFlags startFlags
            )
            : base(handle, connectionFlags)
        {
            this.inputStream = inputStream;
            this.outputStream = outputStream;
            this.startFlags = startFlags;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Methods
        /// <summary>
        /// Throws an exception if the input stream or its associated stream
        /// adapter are invalid.
        /// </summary>
        private void CheckInputStream()
        {
            if (inputStream == null)
            {
                throw new InvalidOperationException(
                    "input stream unavailable");
            }

            if (inputStreamAdapter == null)
            {
                inputStreamAdapter = new SQLiteStreamAdapter(
                    inputStream, GetFlags());
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Throws an exception if the output stream or its associated stream
        /// adapter are invalid.
        /// </summary>
        private void CheckOutputStream()
        {
            if (outputStream == null)
            {
                throw new InvalidOperationException(
                    "output stream unavailable");
            }

            if (outputStreamAdapter == null)
            {
                outputStreamAdapter = new SQLiteStreamAdapter(
                    outputStream, GetFlags());
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteChangeSet Members
        /// <summary>
        /// This method "inverts" the set of changes within this instance.
        /// Applying an inverted set of changes to a database reverses the
        /// effects of applying the uninverted changes.  Specifically:
        /// <![CDATA[<ul>]]><![CDATA[<li>]]>
        /// Each DELETE change is changed to an INSERT, and
        /// <![CDATA[</li>]]><![CDATA[<li>]]>
        /// Each INSERT change is changed to a DELETE, and
        /// <![CDATA[</li>]]><![CDATA[<li>]]>
        /// For each UPDATE change, the old.* and new.* values are exchanged.
        /// <![CDATA[</li>]]><![CDATA[</ul>]]>
        /// This method does not change the order in which changes appear
        /// within the set of changes. It merely reverses the sense of each
        /// individual change.
        /// </summary>
        /// <returns>
        /// Since the resulting set of changes is written to the output stream,
        /// this method always returns null.
        /// </returns>
        public ISQLiteChangeSet Invert()
        {
            CheckDisposed();
            CheckInputStream();
            CheckOutputStream();

            SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changeset_invert_strm(
                inputStreamAdapter.GetInputDelegate(), IntPtr.Zero,
                outputStreamAdapter.GetOutputDelegate(), IntPtr.Zero);

            if (rc != SQLiteErrorCode.Ok)
                throw new SQLiteException(rc, "sqlite3changeset_invert_strm");

            return null;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// This method combines the specified set of changes with the ones
        /// contained in this instance.
        /// </summary>
        /// <param name="changeSet">
        /// The changes to be combined with those in this instance.
        /// </param>
        /// <returns>
        /// Since the resulting set of changes is written to the output stream,
        /// this method always returns null.
        /// </returns>
        public ISQLiteChangeSet CombineWith(
            ISQLiteChangeSet changeSet
            )
        {
            CheckDisposed();
            CheckInputStream();
            CheckOutputStream();

            SQLiteStreamChangeSet streamChangeSet =
                changeSet as SQLiteStreamChangeSet;

            if (streamChangeSet == null)
            {
                throw new ArgumentException(
                    "not a stream based change set", "changeSet");
            }

            streamChangeSet.CheckInputStream();

            SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changeset_concat_strm(
                inputStreamAdapter.GetInputDelegate(), IntPtr.Zero,
                streamChangeSet.inputStreamAdapter.GetInputDelegate(),
                IntPtr.Zero, outputStreamAdapter.GetOutputDelegate(),
                IntPtr.Zero);

            if (rc != SQLiteErrorCode.Ok)
                throw new SQLiteException(rc, "sqlite3changeset_concat_strm");

            return null;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to apply the set of changes in this instance to the
        /// associated database.
        /// </summary>
        /// <param name="conflictCallback">
        /// The <see cref="SessionConflictCallback" /> delegate that will need
        /// to handle any conflicting changes that may arise.
        /// </param>
        /// <param name="clientData">
        /// The optional application-defined context data.  This value may be
        /// null.
        /// </param>
        public void Apply(
            SessionConflictCallback conflictCallback,
            object clientData
            )
        {
            CheckDisposed();

            Apply(conflictCallback, null, clientData);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to apply the set of changes in this instance to the
        /// associated database.
        /// </summary>
        /// <param name="conflictCallback">
        /// The <see cref="SessionConflictCallback" /> delegate that will need
        /// to handle any conflicting changes that may arise.
        /// </param>
        /// <param name="tableFilterCallback">
        /// The optional <see cref="SessionTableFilterCallback" /> delegate
        /// that can be used to filter the list of tables impacted by the set
        /// of changes.
        /// </param>
        /// <param name="clientData">
        /// The optional application-defined context data.  This value may be
        /// null.
        /// </param>
        public void Apply(
            SessionConflictCallback conflictCallback,
            SessionTableFilterCallback tableFilterCallback,
            object clientData
            )
        {
            CheckDisposed();
            CheckInputStream();

            if (conflictCallback == null)
                throw new ArgumentNullException("conflictCallback");

            UnsafeNativeMethods.xSessionFilter xFilter = GetDelegate(
                tableFilterCallback, clientData);

            UnsafeNativeMethods.xSessionConflict xConflict = GetDelegate(
                conflictCallback, clientData);

            SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changeset_apply_strm(
                GetIntPtr(), inputStreamAdapter.GetInputDelegate(), IntPtr.Zero,
                xFilter, xConflict, IntPtr.Zero);

            if (rc != SQLiteErrorCode.Ok)
                throw new SQLiteException(rc, "sqlite3changeset_apply_strm");
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IEnumerable<ISQLiteChangeSetMetadataItem> Members
        /// <summary>
        /// Creates an <see cref="IEnumerator" /> capable of iterating over the
        /// items within this set of changes.
        /// </summary>
        /// <returns>
        /// The new <see cref="IEnumerator{ISQLiteChangeSetMetadataItem}" />
        /// instance.
        /// </returns>
        public IEnumerator<ISQLiteChangeSetMetadataItem> GetEnumerator()
        {
            if (startFlags != SQLiteChangeSetStartFlags.None)
            {
                return new SQLiteStreamChangeSetEnumerator(
                    inputStream, GetFlags(), startFlags);
            }
            else
            {
                return new SQLiteStreamChangeSetEnumerator(
                    inputStream, GetFlags());
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IEnumerable Members
        /// <summary>
        /// Creates an <see cref="IEnumerator" /> capable of iterating over the
        /// items within this set of changes.
        /// </summary>
        /// <returns>
        /// The new <see cref="IEnumerator" /> instance.
        /// </returns>
        IEnumerator System.Collections.IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        /// <summary>
        /// Non-zero if this object instance has been disposed.
        /// </summary>
        private bool disposed;

        /// <summary>
        /// Throws an exception if this object instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteStreamChangeSet).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes or finalizes this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this object is being disposed; otherwise, this object
        /// is being finalized.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        if (outputStreamAdapter != null)
                        {
                            outputStreamAdapter.Dispose();
                            outputStreamAdapter = null;
                        }

                        if (inputStreamAdapter != null)
                        {
                            inputStreamAdapter.Dispose();
                            inputStreamAdapter = null;
                        }

                        if (outputStream != null)
                            outputStream = null; /* NOT OWNED */

                        if (inputStream != null)
                            inputStream = null; /* NOT OWNED */
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////
                }
            }
            finally
            {
                base.Dispose(disposing);

                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteChangeSetEnumerator Class
    /// <summary>
    /// This class represents an <see cref="IEnumerator" /> that is capable of
    /// enumerating over a set of changes.  It serves as the base class for the
    /// <see cref="SQLiteMemoryChangeSetEnumerator" /> and
    /// <see cref="SQLiteStreamChangeSetEnumerator" /> classes.  It manages and
    /// owns an instance of the <see cref="SQLiteChangeSetIterator" /> class.
    /// </summary>
    internal abstract class SQLiteChangeSetEnumerator :
        IEnumerator<ISQLiteChangeSetMetadataItem>
    {
        #region Private Data
        /// <summary>
        /// This managed change set iterator is managed and owned by this
        /// class.  It will be disposed when this class is disposed.
        /// </summary>
        private SQLiteChangeSetIterator iterator;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        /// <summary>
        /// Constructs an instance of this class using the specified managed
        /// change set iterator.
        /// </summary>
        /// <param name="iterator">
        /// The managed iterator instance to use.
        /// </param>
        public SQLiteChangeSetEnumerator(
            SQLiteChangeSetIterator iterator
            )
        {
            SetIterator(iterator);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Methods
        /// <summary>
        /// Throws an exception if the managed iterator instance is invalid.
        /// </summary>
        private void CheckIterator()
        {
            if (iterator == null)
                throw new InvalidOperationException("iterator unavailable");

            iterator.CheckHandle();
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Sets the managed iterator instance to a new value.
        /// </summary>
        /// <param name="iterator">
        /// The new managed iterator instance to use.
        /// </param>
        private void SetIterator(
            SQLiteChangeSetIterator iterator
            )
        {
            this.iterator = iterator;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes of the managed iterator instance and sets its value to
        /// null.
        /// </summary>
        private void CloseIterator()
        {
            if (iterator != null)
            {
                iterator.Dispose();
                iterator = null;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Protected Methods
        /// <summary>
        /// Disposes of the existing managed iterator instance and then sets it
        /// to a new value.
        /// </summary>
        /// <param name="iterator">
        /// The new managed iterator instance to use.
        /// </param>
        protected void ResetIterator(
            SQLiteChangeSetIterator iterator
            )
        {
            CloseIterator();
            SetIterator(iterator);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IEnumerator<ISQLiteChangeSetMetadataItem> Members
        /// <summary>
        /// Returns the current change within the set of changes, represented
        /// by a <see cref="ISQLiteChangeSetMetadataItem" /> instance.
        /// </summary>
        public ISQLiteChangeSetMetadataItem Current
        {
            get
            {
                CheckDisposed();

                return new SQLiteChangeSetMetadataItem(iterator);
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IEnumerator Members
        /// <summary>
        /// Returns the current change within the set of changes, represented
        /// by a <see cref="ISQLiteChangeSetMetadataItem" /> instance.
        /// </summary>
        object Collections.IEnumerator.Current
        {
            get
            {
                CheckDisposed();

                return Current;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to advance to the next item in the set of changes.
        /// </summary>
        /// <returns>
        /// Non-zero if more items are available; otherwise, zero.
        /// </returns>
        public bool MoveNext()
        {
            CheckDisposed();
            CheckIterator();

            return iterator.Next();
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Throws <see cref="NotImplementedException" /> because not all the
        /// derived classes are able to support reset functionality.
        /// </summary>
        public virtual void Reset()
        {
            CheckDisposed();

            throw new NotImplementedException();
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable Members
        /// <summary>
        /// Disposes of this object instance.
        /// </summary>
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        /// <summary>
        /// Non-zero if this object instance has been disposed.
        /// </summary>
        private bool disposed;

        /// <summary>
        /// Throws an exception if this object instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteChangeSetEnumerator).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes or finalizes this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this object is being disposed; otherwise, this object
        /// is being finalized.
        /// </param>
        protected virtual void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        CloseIterator();
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////
                }
            }
            finally
            {
                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Destructor
        /// <summary>
        /// Finalizes this object instance.
        /// </summary>
        ~SQLiteChangeSetEnumerator()
        {
            Dispose(false);
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteMemoryChangeSetEnumerator Class
    /// <summary>
    /// This class represents an <see cref="IEnumerator" /> that is capable of
    /// enumerating over a set of changes contained entirely in memory.
    /// </summary>
    internal sealed class SQLiteMemoryChangeSetEnumerator :
        SQLiteChangeSetEnumerator
    {
        #region Private Data
        /// <summary>
        /// The raw byte data for this set of changes.  Since this data must
        /// be marshalled to a native memory buffer before being used, there
        /// must be enough memory available to store at least two times the
        /// amount of data contained within it.
        /// </summary>
        private byte[] rawData;

        /// <summary>
        /// The flags used to create the change set iterator.
        /// </summary>
        private SQLiteChangeSetStartFlags flags;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        /// <summary>
        /// Constructs an instance of this class using the specified raw byte
        /// data.
        /// </summary>
        /// <param name="rawData">
        /// The raw byte data containing the set of changes for this
        /// enumerator.
        /// </param>
        public SQLiteMemoryChangeSetEnumerator(
            byte[] rawData
            )
            : base(SQLiteMemoryChangeSetIterator.Create(rawData))
        {
            this.rawData = rawData;
            this.flags = SQLiteChangeSetStartFlags.None;
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Constructs an instance of this class using the specified raw byte
        /// data.
        /// </summary>
        /// <param name="rawData">
        /// The raw byte data containing the set of changes for this
        /// enumerator.
        /// </param>
        /// <param name="flags">
        /// The flags used to create the change set iterator.
        /// </param>
        public SQLiteMemoryChangeSetEnumerator(
            byte[] rawData,
            SQLiteChangeSetStartFlags flags
            )
            : base(SQLiteMemoryChangeSetIterator.Create(rawData, flags))
        {
            this.rawData = rawData;
            this.flags = flags;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IEnumerator Overrides
        /// <summary>
        /// Resets the enumerator to its initial position.
        /// </summary>
        public override void Reset()
        {
            CheckDisposed();

            SQLiteMemoryChangeSetIterator result;

            if (flags != SQLiteChangeSetStartFlags.None)
                result = SQLiteMemoryChangeSetIterator.Create(rawData, flags);
            else
                result = SQLiteMemoryChangeSetIterator.Create(rawData);

            ResetIterator(result);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        /// <summary>
        /// Non-zero if this object instance has been disposed.
        /// </summary>
        private bool disposed;

        /// <summary>
        /// Throws an exception if this object instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteMemoryChangeSetEnumerator).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes or finalizes this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this object is being disposed; otherwise, this object
        /// is being finalized.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////
                }
            }
            finally
            {
                base.Dispose(disposing);

                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteStreamChangeSetEnumerator Class
    /// <summary>
    /// This class represents an <see cref="IEnumerator" /> that is capable of
    /// enumerating over a set of changes backed by a <see cref="Stream" />
    /// instance.
    /// </summary>
    internal sealed class SQLiteStreamChangeSetEnumerator :
        SQLiteChangeSetEnumerator
    {
        #region Public Constructors
        /// <summary>
        /// Constructs an instance of this class using the specified stream.
        /// </summary>
        /// <param name="stream">
        /// The <see cref="Stream" /> where the raw byte data for the set of
        /// changes may be read.
        /// </param>
        /// <param name="connectionFlags">
        /// The flags associated with the parent connection.
        /// </param>
        public SQLiteStreamChangeSetEnumerator(
            Stream stream,
            SQLiteConnectionFlags connectionFlags
            )
            : base(SQLiteStreamChangeSetIterator.Create(
                stream, connectionFlags))
        {
            // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Constructs an instance of this class using the specified stream.
        /// </summary>
        /// <param name="stream">
        /// The <see cref="Stream" /> where the raw byte data for the set of
        /// changes may be read.
        /// </param>
        /// <param name="connectionFlags">
        /// The flags associated with the parent connection.
        /// </param>
        /// <param name="startFlags">
        /// The flags used to create the change set iterator.
        /// </param>
        public SQLiteStreamChangeSetEnumerator(
            Stream stream,
            SQLiteConnectionFlags connectionFlags,
            SQLiteChangeSetStartFlags startFlags
            )
            : base(SQLiteStreamChangeSetIterator.Create(
                stream, connectionFlags, startFlags))
        {
            // do nothing.
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        /// <summary>
        /// Non-zero if this object instance has been disposed.
        /// </summary>
        private bool disposed;

        /// <summary>
        /// Throws an exception if this object instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteStreamChangeSetEnumerator).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes or finalizes this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this object is being disposed; otherwise, this object
        /// is being finalized.
        /// </param>
        protected override void Dispose(bool disposing)
        {
            try
            {
                //if (!disposed)
                //{
                //    if (disposing)
                //    {
                //        ////////////////////////////////////
                //        // dispose managed resources here...
                //        ////////////////////////////////////
                //    }

                //    //////////////////////////////////////
                //    // release unmanaged resources here...
                //    //////////////////////////////////////
                //}
            }
            finally
            {
                base.Dispose(disposing);

                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteChangeSetMetadataItem Class
    /// <summary>
    /// This interface implements properties and methods used to fetch metadata
    /// about one change within a set of changes for a database.
    /// </summary>
    internal sealed class SQLiteChangeSetMetadataItem :
        ISQLiteChangeSetMetadataItem
    {
        #region Private Data
        /// <summary>
        /// The <see cref="SQLiteChangeSetIterator" /> instance to use.  This
        /// will NOT be owned by this class and will not be disposed upon this
        /// class being disposed or finalized.
        /// </summary>
        private SQLiteChangeSetIterator iterator;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Constructors
        /// <summary>
        /// Constructs an instance of this class using the specified iterator
        /// instance.
        /// </summary>
        /// <param name="iterator">
        /// The managed iterator instance to use.
        /// </param>
        public SQLiteChangeSetMetadataItem(
            SQLiteChangeSetIterator iterator
            )
        {
            this.iterator = iterator;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Methods
        /// <summary>
        /// Throws an exception if the managed iterator instance is invalid.
        /// </summary>
        private void CheckIterator()
        {
            if (iterator == null)
                throw new InvalidOperationException("iterator unavailable");

            iterator.CheckHandle();
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Populates the underlying data for the <see cref="TableName" />,
        /// <see cref="NumberOfColumns" />, <see cref="OperationCode" />, and
        /// <see cref="Indirect" /> properties, using the appropriate native
        /// API.
        /// </summary>
        private void PopulateOperationMetadata()
        {
            if ((tableName == null) || (numberOfColumns == null) ||
                (operationCode == null) || (indirect == null))
            {
                CheckIterator();

                IntPtr pTblName = IntPtr.Zero;
                SQLiteAuthorizerActionCode op = SQLiteAuthorizerActionCode.None;
                int bIndirect = 0;
                int nColumns = 0;

                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changeset_op(
                    iterator.GetIntPtr(), ref pTblName, ref nColumns, ref op,
                    ref bIndirect);

                if (rc != SQLiteErrorCode.Ok)
                    throw new SQLiteException(rc, "sqlite3changeset_op");

                tableName = SQLiteString.StringFromUtf8IntPtr(pTblName);
                numberOfColumns = nColumns;
                operationCode = op;
                indirect = (bIndirect != 0);
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Populates the underlying data for the
        /// <see cref="PrimaryKeyColumns" /> property using the appropriate
        /// native API.
        /// </summary>
        private void PopulatePrimaryKeyColumns()
        {
            if (primaryKeyColumns == null)
            {
                CheckIterator();

                IntPtr pPrimaryKeys = IntPtr.Zero;
                int nColumns = 0;

                SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changeset_pk(
                    iterator.GetIntPtr(), ref pPrimaryKeys, ref nColumns);

                if (rc != SQLiteErrorCode.Ok)
                    throw new SQLiteException(rc, "sqlite3changeset_pk");

                byte[] bytes = SQLiteBytes.FromIntPtr(pPrimaryKeys, nColumns);

                if (bytes != null)
                {
                    primaryKeyColumns = new bool[nColumns];

                    for (int index = 0; index < bytes.Length; index++)
                        primaryKeyColumns[index] = (bytes[index] != 0);
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Populates the underlying data for the
        /// <see cref="NumberOfForeignKeyConflicts" /> property using the
        /// appropriate native API.
        /// </summary>
        private void PopulateNumberOfForeignKeyConflicts()
        {
            if (numberOfForeignKeyConflicts == null)
            {
                CheckIterator();

                int conflicts = 0;

                SQLiteErrorCode rc =
                    UnsafeNativeMethods.sqlite3changeset_fk_conflicts(
                        iterator.GetIntPtr(), ref conflicts);

                if (rc != SQLiteErrorCode.Ok)
                {
                    throw new SQLiteException(rc,
                        "sqlite3changeset_fk_conflicts");
                }

                numberOfForeignKeyConflicts = conflicts;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region ISQLiteChangeSetMetadataItem Members
        /// <summary>
        /// Backing field for the <see cref="TableName" /> property. This value
        /// will be null if this field has not yet been populated via the
        /// underlying native API.
        /// </summary>
        private string tableName;

        /// <summary>
        /// The name of the table the change was made to.
        /// </summary>
        public string TableName
        {
            get
            {
                CheckDisposed();
                PopulateOperationMetadata();

                return tableName;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Backing field for the <see cref="NumberOfColumns" /> property. This
        /// value will be null if this field has not yet been populated via the
        /// underlying native API.
        /// </summary>
        private int? numberOfColumns;

        /// <summary>
        /// The number of columns impacted by this change.  This value can be
        /// used to determine the highest valid column index that may be used
        /// with the <see cref="GetOldValue" />, <see cref="GetNewValue" />,
        /// and <see cref="GetConflictValue" /> methods of this interface.  It
        /// will be this value minus one.
        /// </summary>
        public int NumberOfColumns
        {
            get
            {
                CheckDisposed();
                PopulateOperationMetadata();

                return (int)numberOfColumns;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Backing field for the <see cref="OperationCode" /> property.  This
        /// value will be null if this field has not yet been populated via the
        /// underlying native API.
        /// </summary>
        private SQLiteAuthorizerActionCode? operationCode;

        /// <summary>
        /// This will contain the value
        /// <see cref="SQLiteAuthorizerActionCode.Insert" />,
        /// <see cref="SQLiteAuthorizerActionCode.Update" />, or
        /// <see cref="SQLiteAuthorizerActionCode.Delete" />, corresponding to
        /// the overall type of change this item represents.
        /// </summary>
        public SQLiteAuthorizerActionCode OperationCode
        {
            get
            {
                CheckDisposed();
                PopulateOperationMetadata();

                return (SQLiteAuthorizerActionCode)operationCode;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Backing field for the <see cref="Indirect" /> property.  This value
        /// will be null if this field has not yet been populated via the
        /// underlying native API.
        /// </summary>
        private bool? indirect;

        /// <summary>
        /// Non-zero if this change is considered to be indirect (i.e. as
        /// though they were made via a trigger or foreign key action).
        /// </summary>
        public bool Indirect
        {
            get
            {
                CheckDisposed();
                PopulateOperationMetadata();

                return (bool)indirect;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Backing field for the <see cref="PrimaryKeyColumns" /> property.
        /// This value will be null if this field has not yet been populated
        /// via the underlying native API.
        /// </summary>
        private bool[] primaryKeyColumns;

        /// <summary>
        /// This array contains a <see cref="Boolean" /> for each column in
        /// the table associated with this change.  The element will be zero
        /// if the column is not part of the primary key; otherwise, it will
        /// be non-zero.
        /// </summary>
        public bool[] PrimaryKeyColumns
        {
            get
            {
                CheckDisposed();
                PopulatePrimaryKeyColumns();

                return primaryKeyColumns;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Backing field for the <see cref="NumberOfForeignKeyConflicts" />
        /// property.  This value will be null if this field has not yet been
        /// populated via the underlying native API.
        /// </summary>
        private int? numberOfForeignKeyConflicts;

        /// <summary>
        /// This method may only be called from within a
        /// <see cref="SessionConflictCallback" /> delegate when the conflict
        /// type is <see cref="SQLiteChangeSetConflictType.ForeignKey" />.  It
        /// returns the total number of known foreign key violations in the
        /// destination database.
        /// </summary>
        public int NumberOfForeignKeyConflicts
        {
            get
            {
                CheckDisposed();
                PopulateNumberOfForeignKeyConflicts();

                return (int)numberOfForeignKeyConflicts;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Queries and returns the original value of a given column for this
        /// change.  This method may only be called when the
        /// <see cref="OperationCode" /> has a value of
        /// <see cref="SQLiteAuthorizerActionCode.Update" /> or
        /// <see cref="SQLiteAuthorizerActionCode.Delete" />.
        /// </summary>
        /// <param name="columnIndex">
        /// The index for the column.  This value must be between zero and one
        /// less than the total number of columns for this table.
        /// </param>
        /// <returns>
        /// The original value of a given column for this change.
        /// </returns>
        public SQLiteValue GetOldValue(
            int columnIndex
            )
        {
            CheckDisposed();
            CheckIterator();

            IntPtr pValue = IntPtr.Zero;

            SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changeset_old(
                iterator.GetIntPtr(), columnIndex, ref pValue);

            return SQLiteValue.FromIntPtr(pValue);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Queries and returns the updated value of a given column for this
        /// change.  This method may only be called when the
        /// <see cref="OperationCode" /> has a value of
        /// <see cref="SQLiteAuthorizerActionCode.Insert" /> or
        /// <see cref="SQLiteAuthorizerActionCode.Update" />.
        /// </summary>
        /// <param name="columnIndex">
        /// The index for the column.  This value must be between zero and one
        /// less than the total number of columns for this table.
        /// </param>
        /// <returns>
        /// The updated value of a given column for this change.
        /// </returns>
        public SQLiteValue GetNewValue(
            int columnIndex
            )
        {
            CheckDisposed();
            CheckIterator();

            IntPtr pValue = IntPtr.Zero;

            SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changeset_new(
                iterator.GetIntPtr(), columnIndex, ref pValue);

            return SQLiteValue.FromIntPtr(pValue);
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Queries and returns the conflicting value of a given column for
        /// this change.  This method may only be called from within a
        /// <see cref="SessionConflictCallback" /> delegate when the conflict
        /// type is <see cref="SQLiteChangeSetConflictType.Data" /> or
        /// <see cref="SQLiteChangeSetConflictType.Conflict" />.
        /// </summary>
        /// <param name="columnIndex">
        /// The index for the column.  This value must be between zero and one
        /// less than the total number of columns for this table.
        /// </param>
        /// <returns>
        /// The conflicting value of a given column for this change.
        /// </returns>
        public SQLiteValue GetConflictValue(
            int columnIndex
            )
        {
            CheckDisposed();
            CheckIterator();

            IntPtr pValue = IntPtr.Zero;

            SQLiteErrorCode rc = UnsafeNativeMethods.sqlite3changeset_conflict(
                iterator.GetIntPtr(), columnIndex, ref pValue);

            return SQLiteValue.FromIntPtr(pValue);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable Members
        /// <summary>
        /// Disposes of this object instance.
        /// </summary>
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        /// <summary>
        /// Non-zero if this object instance has been disposed.
        /// </summary>
        private bool disposed;

        /// <summary>
        /// Throws an exception if this object instance has been disposed.
        /// </summary>
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteChangeSetMetadataItem).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes or finalizes this object instance.
        /// </summary>
        /// <param name="disposing">
        /// Non-zero if this object is being disposed; otherwise, this object
        /// is being finalized.
        /// </param>
        private /* protected virtual */ void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        if (iterator != null)
                            iterator = null; /* NOT OWNED */
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////
                }
            }
            finally
            {
                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Destructor
        /// <summary>
        /// Finalizes this object instance.
        /// </summary>
        ~SQLiteChangeSetMetadataItem()
        {
            Dispose(false);
        }
        #endregion
    }
    #endregion
}

Changes to System.Data.SQLite/SQLiteStatement.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Collections.Generic;
  using System.Globalization;

  /// <summary>
  /// Represents a single SQL statement in SQLite.
  /// </summary>
  internal sealed class SQLiteStatement : IDisposable
  {



|






<







1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;

  using System.Globalization;

  /// <summary>
  /// Represents a single SQL statement in SQLite.
  /// </summary>
  internal sealed class SQLiteStatement : IDisposable
  {
41
42
43
44
45
46
47






















48
49
50
51
52
53

54
55
56
57
58
59
60
61





62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91



92

































































































93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152







































































































































153
154
155
156
157
158
159
160
161
162











163
164
165
166













167
168
169
170
171
172

173


174








































175
176
177
178
179
180



181


182
183


184
185
186
187


188


189


190


191


192


193
194
195
196
197
198
199
200
201
202
203
204
205
206

207

208

209


210
211
212


213
214
215
216


217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
    /// </summary>
    internal SQLiteParameter[] _paramValues;
    /// <summary>
    /// Command this statement belongs to (if any)
    /// </summary>
    internal SQLiteCommand     _command;























    private string[] _types;

    /// <summary>
    /// Initializes the statement and attempts to get all information about parameters in the statement
    /// </summary>
    /// <param name="sqlbase">The base SQLite object</param>

    /// <param name="stmt">The statement</param>
    /// <param name="strCommand">The command text for this statement</param>
    /// <param name="previous">The previous command in a multi-statement command</param>
    internal SQLiteStatement(SQLiteBase sqlbase, SQLiteStatementHandle stmt, string strCommand, SQLiteStatement previous)
    {
      _sql     = sqlbase;
      _sqlite_stmt = stmt;
      _sqlStatement  = strCommand;






      // Determine parameters for this statement (if any) and prepare space for them.
      int nCmdStart = 0;
      int n = _sql.Bind_ParamCount(this);
      int x;
      string s;

      if (n > 0)
      {
        if (previous != null)
          nCmdStart = previous._unnamedParameters;

        _paramNames = new string[n];
        _paramValues = new SQLiteParameter[n];

        for (x = 0; x < n; x++)
        {
          s = _sql.Bind_ParamName(this, x + 1);
          if (String.IsNullOrEmpty(s))
          {
            s = String.Format(CultureInfo.InvariantCulture, ";{0}", nCmdStart);
            nCmdStart++;
            _unnamedParameters++;
          }
          _paramNames[x] = s;
          _paramValues[x] = null;
        }
      }
    }




    /// <summary>

































































































    /// Called by SQLiteParameterCollection, this function determines if the specified parameter name belongs to
    /// this statement, and if so, keeps a reference to the parameter so it can be bound later.
    /// </summary>
    /// <param name="s">The parameter name to map</param>
    /// <param name="p">The parameter to assign it</param>
    internal bool MapParameter(string s, SQLiteParameter p)
    {
      if (_paramNames == null) return false;
      
      int startAt = 0;
      if (s.Length > 0)
      {
        if (":$@;".IndexOf(s[0]) == -1)
          startAt = 1;
      }

      int x = _paramNames.Length;
      for (int n = 0; n < x; n++)
      {
        if (String.Compare(_paramNames[n], startAt, s, 0, Math.Max(_paramNames[n].Length - startAt, s.Length), StringComparison.OrdinalIgnoreCase) == 0)
        {
          _paramValues[n] = p;
          return true;
        }
      }
      return false;
    }

    #region IDisposable Members
    /// <summary>
    /// Disposes and finalizes the statement
    /// </summary>
    public void Dispose()
    {
      if (_sqlite_stmt != null)
      {
        _sqlite_stmt.Dispose();
      }
      _sqlite_stmt = null;
      
      _paramNames = null;
      _paramValues = null;
      _sql = null;
      _sqlStatement = null;
    }
    #endregion
    
    /// <summary>
    ///  Bind all parameters, making sure the caller didn't miss any
    /// </summary>
    internal void BindParameters()
    {
      if (_paramNames == null) return;

      int x = _paramNames.Length;
      for (int n = 0; n < x; n++)
      {
        BindParameter(n + 1, _paramValues[n]);
      }
    }








































































































































    /// <summary>
    /// Perform the bind operation for an individual parameter
    /// </summary>
    /// <param name="index">The index of the parameter to bind</param>
    /// <param name="param">The parameter we're binding</param>
    private void BindParameter(int index, SQLiteParameter param)
    {
      if (param == null)
        throw new SQLiteException((int)SQLiteErrorCode.Error, "Insufficient parameters supplied to the command");












      object obj = param.Value;
      DbType objType = param.DbType;














      if (Convert.IsDBNull(obj) || obj == null)
      {
        _sql.Bind_Null(this, index);
        return;
      }


      if (objType == DbType.Object)


        objType = SQLiteConvert.TypeToDbType(obj.GetType());









































      switch (objType)
      {
        case DbType.Date:
        case DbType.Time:
        case DbType.DateTime:



          _sql.Bind_DateTime(this, index, Convert.ToDateTime(obj, CultureInfo.CurrentCulture));


          break;
        case DbType.Int64:


        case DbType.UInt64:
          _sql.Bind_Int64(this, index, Convert.ToInt64(obj, CultureInfo.CurrentCulture));
          break;
        case DbType.Boolean:


        case DbType.Int16:


        case DbType.Int32:


        case DbType.UInt16:


        case DbType.UInt32:


        case DbType.SByte:


        case DbType.Byte:
          _sql.Bind_Int32(this, index, Convert.ToInt32(obj, CultureInfo.CurrentCulture));
          break;
        case DbType.Single:
        case DbType.Double:
        case DbType.Currency:
        //case DbType.Decimal: // Dont store decimal as double ... loses precision
          _sql.Bind_Double(this, index, Convert.ToDouble(obj, CultureInfo.CurrentCulture));
          break;
        case DbType.Binary:
          _sql.Bind_Blob(this, index, (byte[])obj);
          break;
        case DbType.Guid:
          if (_command.Connection._binaryGuid == true)

            _sql.Bind_Blob(this, index, ((Guid)obj).ToByteArray());

          else

            _sql.Bind_Text(this, index, obj.ToString());



          break;
        case DbType.Decimal: // Dont store decimal as double ... loses precision


          _sql.Bind_Text(this, index, Convert.ToDecimal(obj, CultureInfo.CurrentCulture).ToString(CultureInfo.InvariantCulture));
          break;
        default:
          _sql.Bind_Text(this, index, obj.ToString());


          break;
      }
    }

    internal string[] TypeDefinitions
    {
      get { return _types; }
    }

    internal void SetTypes(string typedefs)
    {
      int pos = typedefs.IndexOf("TYPES", 0, StringComparison.OrdinalIgnoreCase);
      if (pos == -1) throw new ArgumentOutOfRangeException();

      string[] types = typedefs.Substring(pos + 6).Replace(" ", "").Replace(";", "").Replace("\"", "").Replace("[", "").Replace("]", "").Replace("`","").Split(',', '\r', '\n', '\t');

      int n;
      for (n = 0; n < types.Length; n++)
      {
        if (String.IsNullOrEmpty(types[n]) == true)
          types[n] = null;
      }
      _types = types;
    }
  }
}







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






>



|




>
>
>
>
>



|













|


|









>
>
>

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








|










|








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













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









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




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

|



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






>
>
>
|
>
>

|
>
>
|
|

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




<
|


|



>
|
>

>
|
>
>
|


>
>
|


|
>
>














|











40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247



















248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527

528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
    /// </summary>
    internal SQLiteParameter[] _paramValues;
    /// <summary>
    /// Command this statement belongs to (if any)
    /// </summary>
    internal SQLiteCommand     _command;

    /// <summary>
    /// The total number of schema retries during preparation.
    /// </summary>
    internal int _prepareSchemaRetries;
    /// <summary>
    /// The total number of locking retries during preparation.
    /// </summary>
    internal int _prepareLockRetries;
    /// <summary>
    /// The total number of schema retries during stepping.
    /// </summary>
    internal int _stepSchemaRetries;
    /// <summary>
    /// The total number of retries during stepping.
    /// </summary>
    internal int _stepLockRetries;

    /// <summary>
    /// The flags associated with the parent connection object.
    /// </summary>
    private SQLiteConnectionFlags _flags;

    private string[] _types;

    /// <summary>
    /// Initializes the statement and attempts to get all information about parameters in the statement
    /// </summary>
    /// <param name="sqlbase">The base SQLite object</param>
    /// <param name="flags">The flags associated with the parent connection object</param>
    /// <param name="stmt">The statement</param>
    /// <param name="strCommand">The command text for this statement</param>
    /// <param name="previous">The previous command in a multi-statement command</param>
    internal SQLiteStatement(SQLiteBase sqlbase, SQLiteConnectionFlags flags, SQLiteStatementHandle stmt, string strCommand, SQLiteStatement previous)
    {
      _sql     = sqlbase;
      _sqlite_stmt = stmt;
      _sqlStatement  = strCommand;
      _prepareSchemaRetries = 0;
      _prepareLockRetries = 0;
      _stepSchemaRetries = 0;
      _stepLockRetries = 0;
      _flags = flags;

      // Determine parameters for this statement (if any) and prepare space for them.
      int nCmdStart = 0;
      int n = _sql.Bind_ParamCount(this, _flags);
      int x;
      string s;

      if (n > 0)
      {
        if (previous != null)
          nCmdStart = previous._unnamedParameters;

        _paramNames = new string[n];
        _paramValues = new SQLiteParameter[n];

        for (x = 0; x < n; x++)
        {
          s = _sql.Bind_ParamName(this, _flags, x + 1);
          if (String.IsNullOrEmpty(s))
          {
            s = HelperMethods.StringFormat(CultureInfo.InvariantCulture, ";{0}", nCmdStart);
            nCmdStart++;
            _unnamedParameters++;
          }
          _paramNames[x] = s;
          _paramValues[x] = null;
        }
      }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable Members
    /// <summary>
    /// Disposes and finalizes the statement
    /// </summary>
    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region IDisposable "Pattern" Members
    private bool disposed;
    private void CheckDisposed() /* throw */
    {
#if THROW_ON_DISPOSED
        if (disposed)
            throw new ObjectDisposedException(typeof(SQLiteStatement).Name);
#endif
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    private void Dispose(bool disposing)
    {
        if (!disposed)
        {
            if (disposing)
            {
                ////////////////////////////////////
                // dispose managed resources here...
                ////////////////////////////////////

                if (_sqlite_stmt != null)
                {
                    _sqlite_stmt.Dispose();
                    _sqlite_stmt = null;
                }

                _paramNames = null;
                _paramValues = null;
                _sql = null;
                _sqlStatement = null;
            }

            //////////////////////////////////////
            // release unmanaged resources here...
            //////////////////////////////////////

            disposed = true;
        }
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    #region Destructor
    ~SQLiteStatement()
    {
        Dispose(false);
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// If the underlying database connection is open, fetches the number of changed rows
    /// resulting from the most recent query; otherwise, does nothing.
    /// </summary>
    /// <param name="changes">
    /// The number of changes when true is returned.
    /// Undefined if false is returned.
    /// </param>
    /// <param name="readOnly">
    /// The read-only flag when true is returned.
    /// Undefined if false is returned.
    /// </param>
    /// <returns>Non-zero if the number of changed rows was fetched.</returns>
    internal bool TryGetChanges(
        ref int changes,
        ref bool readOnly
        )
    {
        if ((_sql != null) && _sql.IsOpen())
        {
            changes = _sql.Changes;
            readOnly = _sql.IsReadOnly(this);

            return true;
        }

        return false;
    }

    ///////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Called by SQLiteParameterCollection, this function determines if the specified parameter name belongs to
    /// this statement, and if so, keeps a reference to the parameter so it can be bound later.
    /// </summary>
    /// <param name="s">The parameter name to map</param>
    /// <param name="p">The parameter to assign it</param>
    internal bool MapParameter(string s, SQLiteParameter p)
    {
      if (_paramNames == null) return false;

      int startAt = 0;
      if (s.Length > 0)
      {
        if (":$@;".IndexOf(s[0]) == -1)
          startAt = 1;
      }

      int x = _paramNames.Length;
      for (int n = 0; n < x; n++)
      {
        if (String.Compare(_paramNames[n], startAt, s, 0, Math.Max(_paramNames[n].Length - startAt, s.Length), StringComparison.Ordinal) == 0)
        {
          _paramValues[n] = p;
          return true;
        }
      }
      return false;
    }




















    /// <summary>
    ///  Bind all parameters, making sure the caller didn't miss any
    /// </summary>
    internal void BindParameters()
    {
      if (_paramNames == null) return;

      int x = _paramNames.Length;
      for (int n = 0; n < x; n++)
      {
        BindParameter(n + 1, _paramValues[n]);
      }
    }

    /// <summary>
    /// This method attempts to query the database connection associated with
    /// the statement in use.  If the underlying command or connection is
    /// unavailable, a null value will be returned.
    /// </summary>
    /// <returns>
    /// The connection object -OR- null if it is unavailable.
    /// </returns>
    private static SQLiteConnection GetConnection(
        SQLiteStatement statement
        )
    {
        try
        {
            if (statement != null)
            {
                SQLiteCommand command = statement._command;

                if (command != null)
                {
                    SQLiteConnection connection = command.Connection;

                    if (connection != null)
                        return connection;
                }
            }
        }
        catch (ObjectDisposedException)
        {
            // do nothing.
        }

        return null;
    }

    /// <summary>
    /// Invokes the parameter binding callback configured for the database
    /// type name associated with the specified column.  If no parameter
    /// binding callback is available for the database type name, do
    /// nothing.
    /// </summary>
    /// <param name="index">
    /// The index of the column being read.
    /// </param>
    /// <param name="parameter">
    /// The <see cref="SQLiteParameter" /> instance being bound to the
    /// command.
    /// </param>
    /// <param name="complete">
    /// Non-zero if the default handling for the parameter binding call
    /// should be skipped (i.e. the parameter should not be bound at all).
    /// Great care should be used when setting this to non-zero.
    /// </param>
    private void InvokeBindValueCallback(
        int index,
        SQLiteParameter parameter,
        out bool complete
        )
    {
        complete = false;
        SQLiteConnectionFlags oldFlags = _flags;
        _flags &= ~SQLiteConnectionFlags.UseConnectionBindValueCallbacks;

        try
        {
            if (parameter == null)
                return;

            SQLiteConnection connection = GetConnection(this);

            if (connection == null)
                return;

            //
            // NOTE: First, always look for an explicitly set database type
            //       name.
            //
            string typeName = parameter.TypeName;

            if (typeName == null)
            {
                //
                // NOTE: Are we allowed to fallback to using the parameter name
                //       as the basis for looking up the binding callback?
                //
                if (HelperMethods.HasFlags(
                        _flags, SQLiteConnectionFlags.UseParameterNameForTypeName))
                {
                    typeName = parameter.ParameterName;
                }
            }

            if (typeName == null)
            {
                //
                // NOTE: Are we allowed to fallback to using the database type
                //       name translated from the DbType as the basis for looking
                //       up the binding callback?
                //
                if (HelperMethods.HasFlags(
                        _flags, SQLiteConnectionFlags.UseParameterDbTypeForTypeName))
                {
                    typeName = SQLiteConvert.DbTypeToTypeName(
                        connection, parameter.DbType, _flags);
                }
            }

            if (typeName == null)
                return;

            SQLiteTypeCallbacks callbacks;

            if (!connection.TryGetTypeCallbacks(typeName, out callbacks) ||
                (callbacks == null))
            {
                return;
            }

            SQLiteBindValueCallback callback = callbacks.BindValueCallback;

            if (callback == null)
                return;

            object userData = callbacks.BindValueUserData;

            callback(
                _sql, _command, oldFlags, parameter, typeName, index,
                userData, out complete); /* throw */
        }
        finally
        {
            _flags |= SQLiteConnectionFlags.UseConnectionBindValueCallbacks;
        }
    }

    /// <summary>
    /// Perform the bind operation for an individual parameter
    /// </summary>
    /// <param name="index">The index of the parameter to bind</param>
    /// <param name="param">The parameter we're binding</param>
    private void BindParameter(int index, SQLiteParameter param)
    {
      if (param == null)
        throw new SQLiteException("Insufficient parameters supplied to the command");

      if (HelperMethods.HasFlags(
            _flags, SQLiteConnectionFlags.UseConnectionBindValueCallbacks))
      {
          bool complete;

          InvokeBindValueCallback(index, param, out complete);

          if (complete)
              return;
      }

      object obj = param.Value;
      DbType objType = param.DbType;

      if ((obj != null) && (objType == DbType.Object))
          objType = SQLiteConvert.TypeToDbType(obj.GetType());

      if (_sql.ForceLogPrepare || HelperMethods.LogPreBind(_flags))
      {
          IntPtr handle = _sqlite_stmt;

          SQLiteLog.LogMessage(HelperMethods.StringFormat(
              CultureInfo.CurrentCulture,
              "Binding statement {0} paramter #{1} with database type {2} and raw value {{{3}}}...",
              handle, index, objType, obj));
      }

      if ((obj == null) || Convert.IsDBNull(obj))
      {
          _sql.Bind_Null(this, _flags, index);
        return;
      }

      CultureInfo invariantCultureInfo = CultureInfo.InvariantCulture;

      bool invariantText = HelperMethods.HasFlags(
          _flags, SQLiteConnectionFlags.BindInvariantText);

      CultureInfo cultureInfo = CultureInfo.CurrentCulture;

      if (HelperMethods.HasFlags(
            _flags, SQLiteConnectionFlags.ConvertInvariantText))
      {
          cultureInfo = invariantCultureInfo;
      }

      if (HelperMethods.HasFlags(
            _flags, SQLiteConnectionFlags.BindAllAsText))
      {
          if (obj is DateTime)
          {
              _sql.Bind_DateTime(this, _flags, index, (DateTime)obj);
          }
          else
          {
              _sql.Bind_Text(this, _flags, index, invariantText ?
                  SQLiteConvert.ToStringWithProvider(obj, invariantCultureInfo) :
                  SQLiteConvert.ToStringWithProvider(obj, cultureInfo));
          }

          return;
      }

      bool invariantDecimal = HelperMethods.HasFlags(
          _flags, SQLiteConnectionFlags.BindInvariantDecimal);

      if (HelperMethods.HasFlags(
            _flags, SQLiteConnectionFlags.BindDecimalAsText))
      {
          if (obj is Decimal)
          {
              _sql.Bind_Text(this, _flags, index, invariantText || invariantDecimal ?
                  SQLiteConvert.ToStringWithProvider(obj, invariantCultureInfo) :
                  SQLiteConvert.ToStringWithProvider(obj, cultureInfo));

              return;
          }
      }

      switch (objType)
      {
        case DbType.Date:
        case DbType.Time:
        case DbType.DateTime:
          //
          // NOTE: The old method (commented below) does not honor the selected date format
          //       for the connection.
          // _sql.Bind_DateTime(this, index, Convert.ToDateTime(obj, cultureInfo));
            _sql.Bind_DateTime(this, _flags, index, (obj is string) ?
              _sql.ToDateTime((string)obj) : Convert.ToDateTime(obj, cultureInfo));
          break;
        case DbType.Boolean:
          _sql.Bind_Boolean(this, _flags, index, SQLiteConvert.ToBoolean(obj, cultureInfo, true));
          break;
        case DbType.SByte:
          _sql.Bind_Int32(this, _flags, index, Convert.ToSByte(obj, cultureInfo));
          break;
        case DbType.Int16:
          _sql.Bind_Int32(this, _flags, index, Convert.ToInt16(obj, cultureInfo));
          break;
        case DbType.Int32:
          _sql.Bind_Int32(this, _flags, index, Convert.ToInt32(obj, cultureInfo));
          break;
        case DbType.Int64:
          _sql.Bind_Int64(this, _flags, index, Convert.ToInt64(obj, cultureInfo));
          break;
        case DbType.Byte:
          _sql.Bind_UInt32(this, _flags, index, Convert.ToByte(obj, cultureInfo));
          break;
        case DbType.UInt16:
          _sql.Bind_UInt32(this, _flags, index, Convert.ToUInt16(obj, cultureInfo));
          break;
        case DbType.UInt32:
          _sql.Bind_UInt32(this, _flags, index, Convert.ToUInt32(obj, cultureInfo));
          break;
        case DbType.UInt64:
          _sql.Bind_UInt64(this, _flags, index, Convert.ToUInt64(obj, cultureInfo));
          break;
        case DbType.Single:
        case DbType.Double:
        case DbType.Currency:

          _sql.Bind_Double(this, _flags, index, Convert.ToDouble(obj, cultureInfo));
          break;
        case DbType.Binary:
          _sql.Bind_Blob(this, _flags, index, (byte[])obj);
          break;
        case DbType.Guid:
          if (_command.Connection._binaryGuid == true)
          {
            _sql.Bind_Blob(this, _flags, index, ((Guid)obj).ToByteArray());
          }
          else
          {
            _sql.Bind_Text(this, _flags, index, invariantText ?
              SQLiteConvert.ToStringWithProvider(obj, invariantCultureInfo) :
              SQLiteConvert.ToStringWithProvider(obj, cultureInfo));
          }
          break;
        case DbType.Decimal: // Dont store decimal as double ... loses precision
          _sql.Bind_Text(this, _flags, index, invariantText || invariantDecimal ?
            SQLiteConvert.ToStringWithProvider(Convert.ToDecimal(obj, cultureInfo), invariantCultureInfo) :
            SQLiteConvert.ToStringWithProvider(Convert.ToDecimal(obj, cultureInfo), cultureInfo));
          break;
        default:
          _sql.Bind_Text(this, _flags, index, invariantText ?
              SQLiteConvert.ToStringWithProvider(obj, invariantCultureInfo) :
              SQLiteConvert.ToStringWithProvider(obj, cultureInfo));
          break;
      }
    }

    internal string[] TypeDefinitions
    {
      get { return _types; }
    }

    internal void SetTypes(string typedefs)
    {
      int pos = typedefs.IndexOf("TYPES", 0, StringComparison.OrdinalIgnoreCase);
      if (pos == -1) throw new ArgumentOutOfRangeException();

      string[] types = typedefs.Substring(pos + 6).Replace(" ", String.Empty).Replace(";", String.Empty).Replace("\"", String.Empty).Replace("[", String.Empty).Replace("]", String.Empty).Replace("`", String.Empty).Split(',', '\r', '\n', '\t');

      int n;
      for (n = 0; n < types.Length; n++)
      {
        if (String.IsNullOrEmpty(types[n]) == true)
          types[n] = null;
      }
      _types = types;
    }
  }
}

Changes to System.Data.SQLite/SQLiteTransaction.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13

14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

33











































































34

35

36






37
38

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134


135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Data;
  using System.Data.Common;
  using System.Threading;


  /// <summary>
  /// SQLite implementation of DbTransaction.
  /// </summary>
  public sealed class SQLiteTransaction : DbTransaction
  {
    /// <summary>
    /// The connection to which this transaction is bound
    /// </summary>
    internal SQLiteConnection _cnn;
    internal long _version; // Matches the version of the connection
    private IsolationLevel _level;

    /// <summary>
    /// Constructs the transaction object, binding it to the supplied connection
    /// </summary>
    /// <param name="connection">The connection to open a transaction on</param>
    /// <param name="deferredLock">TRUE to defer the writelock, or FALSE to lock immediately</param>
    internal SQLiteTransaction(SQLiteConnection connection, bool deferredLock)

    {











































































      _cnn = connection;

      _version = _cnn._version;








      _level = (deferredLock == true) ? IsolationLevel.ReadCommitted : IsolationLevel.Serializable;


      if (_cnn._transactionLevel++ == 0)
      {
        try
        {
          using (SQLiteCommand cmd = _cnn.CreateCommand())
          {
            if (!deferredLock)
              cmd.CommandText = "BEGIN IMMEDIATE";
            else
              cmd.CommandText = "BEGIN";

            cmd.ExecuteNonQuery();
          }
        }
        catch (SQLiteException)
        {
          _cnn._transactionLevel--;
          _cnn = null;

          throw;
        }
      }
    }

    /// <summary>
    /// Commits the current transaction.
    /// </summary>
    public override void Commit()
    {
      IsValid(true);

      if (_cnn._transactionLevel - 1 == 0)
      {
        using (SQLiteCommand cmd = _cnn.CreateCommand())
        {
          cmd.CommandText = "COMMIT";
          cmd.ExecuteNonQuery();
        }
      }
      _cnn._transactionLevel--;
      _cnn = null;
    }

    /// <summary>
    /// Returns the underlying connection to which this transaction applies.
    /// </summary>
    public new SQLiteConnection Connection
    {
      get { return _cnn; }
    }

    /// <summary>
    /// Forwards to the local Connection property
    /// </summary>
    protected override DbConnection DbConnection
    {
      get { return Connection; }
    }

    /// <summary>
    /// Disposes the transaction.  If it is currently active, any changes are rolled back.
    /// </summary>
    protected override void Dispose(bool disposing)
    {
      if (disposing)
      {
        if (IsValid(false))
        {
          IssueRollback();
        }
      }
      base.Dispose(disposing);
    }

    /// <summary>
    /// Gets the isolation level of the transaction.  SQLite only supports Serializable transactions.
    /// </summary>
    public override IsolationLevel IsolationLevel
    {
      get { return _level; }
    }

    /// <summary>
    /// Rolls back the active transaction.
    /// </summary>
    public override void Rollback()
    {
      IsValid(true);
      IssueRollback();
    }

    internal void IssueRollback()
    {
      SQLiteConnection cnn = Interlocked.Exchange(ref _cnn, null);

      if (cnn != null)
      {


        using (SQLiteCommand cmd = cnn.CreateCommand())
        {
          cmd.CommandText = "ROLLBACK";
          cmd.ExecuteNonQuery();
        }
        cnn._transactionLevel = 0;
      }
    }

    internal bool IsValid(bool throwError)
    {
      if (_cnn == null)
      {
        if (throwError == true) throw new ArgumentNullException("No connection associated with this transaction");
        else return false;
      }

      if (_cnn._version != _version)
      {
        if (throwError == true) throw new SQLiteException((int)SQLiteErrorCode.Misuse, "The connection was closed and re-opened, changes were already rolled back");
        else return false;
      }
      if (_cnn.State != ConnectionState.Open)
      {
        if (throwError == true) throw new SQLiteException((int)SQLiteErrorCode.Misuse, "Connection was closed");
        else return false;
      }

      if (_cnn._transactionLevel == 0 || _cnn._sql.AutoCommit == true)
      {
        _cnn._transactionLevel = 0; // Make sure the transaction level is reset before returning
        if (throwError == true) throw new SQLiteException((int)SQLiteErrorCode.Misuse, "No transaction is active on this connection");
        else return false;
      }

      return true;
    }
  }
}



|





|
|
|
<
>

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

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

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

<
<
<
<
<
<
|
<
|
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
|
|
<
|
<
<
<
<
|
|
<
|
|
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
|
|

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

<

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18
19







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140






141

142










143






144
145

146




147
148

149
150










151







152










153
154
155
156
157
158
159
160
161
162
163
164

165

166

167


168


169




170






171




172
173

174

175
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
    using System;
    using System.Threading;


    ///////////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// SQLite implementation of DbTransaction that does not support nested transactions.
    /// </summary>
    public class SQLiteTransaction : SQLiteTransactionBase
    {







        /// <summary>
        /// Constructs the transaction object, binding it to the supplied connection
        /// </summary>
        /// <param name="connection">The connection to open a transaction on</param>
        /// <param name="deferredLock">TRUE to defer the writelock, or FALSE to lock immediately</param>
        internal SQLiteTransaction(SQLiteConnection connection, bool deferredLock)
            : base(connection, deferredLock)
        {
            // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        private bool disposed;
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
                throw new ObjectDisposedException(typeof(SQLiteTransaction).Name);
#endif
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes the transaction.  If it is currently active, any changes are rolled back.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        if (IsValid(false))
                        {
                            IssueRollback(false);
                        }
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////
                }
            }
            finally
            {
                base.Dispose(disposing);

                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Commits the current transaction.
        /// </summary>
        public override void Commit()
        {
            CheckDisposed();
            SQLiteConnection.Check(_cnn);
            IsValid(true);

            if (_cnn._transactionLevel - 1 == 0)
            {
                using (SQLiteCommand cmd = _cnn.CreateCommand())
                {
                    cmd.CommandText = "COMMIT;";
                    cmd.ExecuteNonQuery();
                }
            }
            _cnn._transactionLevel--;
            _cnn = null;
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to start a transaction.  An exception will be thrown if the transaction cannot
        /// be started for any reason.
        /// </summary>
        /// <param name="deferredLock">TRUE to defer the writelock, or FALSE to lock immediately</param>
        protected override void Begin(
            bool deferredLock
            )
        {
            if (_cnn._transactionLevel++ == 0)
            {
                try
                {
                    using (SQLiteCommand cmd = _cnn.CreateCommand())
                    {
                        if (!deferredLock)
                            cmd.CommandText = "BEGIN IMMEDIATE;";
                        else
                            cmd.CommandText = "BEGIN;";

                        cmd.ExecuteNonQuery();
                    }
                }
                catch (SQLiteException)
                {
                    _cnn._transactionLevel--;
                    _cnn = null;

                    throw;
                }
            }
        }







        ///////////////////////////////////////////////////////////////////////////////////////////////












        /// <summary>






        /// Issue a ROLLBACK command against the database connection,
        /// optionally re-throwing any caught exception.

        /// </summary>




        /// <param name="throwError">
        /// Non-zero to re-throw caught exceptions.

        /// </param>
        protected override void IssueRollback(










            bool throwError







            )










        {
            SQLiteConnection cnn = Interlocked.Exchange(ref _cnn, null);

            if (cnn != null)
            {
                try
                {
                    using (SQLiteCommand cmd = cnn.CreateCommand())
                    {
                        cmd.CommandText = "ROLLBACK;";
                        cmd.ExecuteNonQuery();
                    }

                }

                catch

                {


                    if (throwError)


                        throw;




                }






                cnn._transactionLevel = 0;




            }
        }

    }

}

Added System.Data.SQLite/SQLiteTransaction2.cs.









































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
    using System;
    using System.Threading;

    ///////////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// SQLite implementation of DbTransaction that does support nested transactions.
    /// </summary>
    public sealed class SQLiteTransaction2 : SQLiteTransaction
    {
        /// <summary>
        /// The original transaction level for the associated connection
        /// when this transaction was created (i.e. begun).
        /// </summary>
        private int _beginLevel;

        /// <summary>
        /// The SAVEPOINT name for this transaction, if any.  This will
        /// only be non-null if this transaction is a nested one.
        /// </summary>
        private string _savePointName;

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Constructs the transaction object, binding it to the supplied connection
        /// </summary>
        /// <param name="connection">The connection to open a transaction on</param>
        /// <param name="deferredLock">TRUE to defer the writelock, or FALSE to lock immediately</param>
        internal SQLiteTransaction2(SQLiteConnection connection, bool deferredLock)
            : base(connection, deferredLock)
        {
            // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        private bool disposed;
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
                throw new ObjectDisposedException(typeof(SQLiteTransaction2).Name);
#endif
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes the transaction.  If it is currently active, any changes are rolled back.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        if (IsValid(false))
                        {
                            IssueRollback(false);
                        }
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////
                }
            }
            finally
            {
                base.Dispose(disposing);

                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Commits the current transaction.
        /// </summary>
        public override void Commit()
        {
            CheckDisposed();
            SQLiteConnection.Check(_cnn);
            IsValid(true);

            if (_beginLevel == 0)
            {
                using (SQLiteCommand cmd = _cnn.CreateCommand())
                {
                    cmd.CommandText = "COMMIT;";
                    cmd.ExecuteNonQuery();
                }

                _cnn._transactionLevel = 0;
                _cnn = null;
            }
            else
            {
                using (SQLiteCommand cmd = _cnn.CreateCommand())
                {
                    if (String.IsNullOrEmpty(_savePointName))
                        throw new SQLiteException("Cannot commit, unknown SAVEPOINT");

                    cmd.CommandText = String.Format(
                        "RELEASE {0};", _savePointName);

                    cmd.ExecuteNonQuery();
                }

                _cnn._transactionLevel--;
                _cnn = null;
            }
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to start a transaction.  An exception will be thrown if the transaction cannot
        /// be started for any reason.
        /// </summary>
        /// <param name="deferredLock">TRUE to defer the writelock, or FALSE to lock immediately</param>
        protected override void Begin(
            bool deferredLock
            )
        {
            int transactionLevel;

            if ((transactionLevel = _cnn._transactionLevel++) == 0)
            {
                try
                {
                    using (SQLiteCommand cmd = _cnn.CreateCommand())
                    {
                        if (!deferredLock)
                            cmd.CommandText = "BEGIN IMMEDIATE;";
                        else
                            cmd.CommandText = "BEGIN;";

                        cmd.ExecuteNonQuery();

                        _beginLevel = transactionLevel;
                    }
                }
                catch (SQLiteException)
                {
                    _cnn._transactionLevel--;
                    _cnn = null;

                    throw;
                }
            }
            else
            {
                try
                {
                    using (SQLiteCommand cmd = _cnn.CreateCommand())
                    {
                        _savePointName = GetSavePointName();

                        cmd.CommandText = String.Format(
                            "SAVEPOINT {0};", _savePointName);

                        cmd.ExecuteNonQuery();

                        _beginLevel = transactionLevel;
                    }
                }
                catch (SQLiteException)
                {
                    _cnn._transactionLevel--;
                    _cnn = null;

                    throw;
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Issue a ROLLBACK command against the database connection,
        /// optionally re-throwing any caught exception.
        /// </summary>
        /// <param name="throwError">
        /// Non-zero to re-throw caught exceptions.
        /// </param>
        protected override void IssueRollback(bool throwError)
        {
            SQLiteConnection cnn = Interlocked.Exchange(ref _cnn, null);

            if (cnn != null)
            {
                if (_beginLevel == 0)
                {
                    try
                    {
                        using (SQLiteCommand cmd = cnn.CreateCommand())
                        {
                            cmd.CommandText = "ROLLBACK;";
                            cmd.ExecuteNonQuery();
                        }

                        cnn._transactionLevel = 0;
                    }
                    catch
                    {
                        if (throwError)
                            throw;
                    }
                }
                else
                {
                    try
                    {
                        using (SQLiteCommand cmd = cnn.CreateCommand())
                        {
                            if (String.IsNullOrEmpty(_savePointName))
                                throw new SQLiteException("Cannot rollback, unknown SAVEPOINT");

                            cmd.CommandText = String.Format(
                                "ROLLBACK TO {0};", _savePointName);

                            cmd.ExecuteNonQuery();
                        }

                        cnn._transactionLevel--;
                    }
                    catch
                    {
                        if (throwError)
                            throw;
                    }
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Constructs the name of a new savepoint for this transaction.  It
        /// should only be called from the constructor of this class.
        /// </summary>
        /// <returns>
        /// The name of the new savepoint -OR- null if it cannot be constructed.
        /// </returns>
        private string GetSavePointName()
        {
            int sequence = ++_cnn._transactionSequence;

            return String.Format(
                "sqlite_dotnet_savepoint_{0}", sequence);
        }
    }
}

Added System.Data.SQLite/SQLiteTransactionBase.cs.













































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
    using System;
    using System.Data;
    using System.Data.Common;

    ///////////////////////////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// Base class used by to implement DbTransaction for SQLite.
    /// </summary>
    public abstract class SQLiteTransactionBase : DbTransaction
    {
        /// <summary>
        /// The connection to which this transaction is bound.
        /// </summary>
        internal SQLiteConnection _cnn;

        /// <summary>
        /// Matches the version of the connection.
        /// </summary>
        internal int _version;

        /// <summary>
        /// The isolation level for this transaction.
        /// </summary>
        private IsolationLevel _level;

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Constructs the transaction object, binding it to the supplied connection
        /// </summary>
        /// <param name="connection">The connection to open a transaction on</param>
        /// <param name="deferredLock">TRUE to defer the writelock, or FALSE to lock immediately</param>
        internal SQLiteTransactionBase(SQLiteConnection connection, bool deferredLock)
        {
            _cnn = connection;
            _version = _cnn._version;

            _level = (deferredLock == true) ?
                SQLiteConnection.DeferredIsolationLevel :
                SQLiteConnection.ImmediateIsolationLevel;

            Begin(deferredLock);
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Gets the isolation level of the transaction.  SQLite only supports Serializable transactions.
        /// </summary>
        public override IsolationLevel IsolationLevel
        {
            get { CheckDisposed(); return _level; }
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        #region IDisposable "Pattern" Members
        private bool disposed;
        private void CheckDisposed() /* throw */
        {
#if THROW_ON_DISPOSED
            if (disposed)
            {
                throw new ObjectDisposedException(
                    typeof(SQLiteTransactionBase).Name);
            }
#endif
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Disposes the transaction.  If it is currently active, any changes are rolled back.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        if (IsValid(false))
                        {
                            IssueRollback(false);
                        }
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////
                }
            }
            finally
            {
                base.Dispose(disposing);

                //
                // NOTE: Everything should be fully disposed at this point.
                //
                disposed = true;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Returns the underlying connection to which this transaction applies.
        /// </summary>
        public new SQLiteConnection Connection
        {
            get { CheckDisposed(); return _cnn; }
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Forwards to the local Connection property
        /// </summary>
        protected override DbConnection DbConnection
        {
            get { return Connection; }
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Rolls back the active transaction.
        /// </summary>
        public override void Rollback()
        {
            CheckDisposed();
            SQLiteConnection.Check(_cnn);
            IsValid(true);
            IssueRollback(true);
        }

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Attempts to start a transaction.  An exception will be thrown if the transaction cannot
        /// be started for any reason.
        /// </summary>
        /// <param name="deferredLock">TRUE to defer the writelock, or FALSE to lock immediately</param>
        protected abstract void Begin(bool deferredLock);

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Issue a ROLLBACK command against the database connection,
        /// optionally re-throwing any caught exception.
        /// </summary>
        /// <param name="throwError">
        /// Non-zero to re-throw caught exceptions.
        /// </param>
        protected abstract void IssueRollback(bool throwError);

        ///////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Checks the state of this transaction, optionally throwing an exception if a state
        /// inconsistency is found.
        /// </summary>
        /// <param name="throwError">
        /// Non-zero to throw an exception if a state inconsistency is found.
        /// </param>
        /// <returns>
        /// Non-zero if this transaction is valid; otherwise, false.
        /// </returns>
        internal bool IsValid(bool throwError)
        {
            if (_cnn == null)
            {
                if (throwError == true) throw new ArgumentNullException("No connection associated with this transaction");
                else return false;
            }

            if (_cnn._version != _version)
            {
                if (throwError == true) throw new SQLiteException("The connection was closed and re-opened, changes were already rolled back");
                else return false;
            }
            if (_cnn.State != ConnectionState.Open)
            {
                if (throwError == true) throw new SQLiteException("Connection was closed");
                else return false;
            }

            if (_cnn._transactionLevel == 0 || _cnn._sql.AutoCommit == true)
            {
                _cnn._transactionLevel = 0; // Make sure the transaction level is reset before returning
                if (throwError == true) throw new SQLiteException("No transaction is active on this connection");
                else return false;
            }

            return true;
        }
    }
}

Deleted System.Data.SQLite/SR.Designer.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.3053
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace System.Data.SQLite {
    using System;
    
    
    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    internal class SR {
        
        private static global::System.Resources.ResourceManager resourceMan;
        
        private static global::System.Globalization.CultureInfo resourceCulture;
        
        internal SR() {
        }
        
        /// <summary>
        ///   Returns the cached ResourceManager instance used by this class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("System.Data.SQLite.SR", typeof(SR).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }
        
        /// <summary>
        ///   Overrides the current thread's CurrentUICulture property for all
        ///   resource lookups using this strongly typed resource class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; standalone=&quot;yes&quot;?&gt;
        ///&lt;DocumentElement&gt;
        ///  &lt;DataTypes&gt;
        ///    &lt;TypeName&gt;smallint&lt;/TypeName&gt;
        ///    &lt;ProviderDbType&gt;10&lt;/ProviderDbType&gt;
        ///    &lt;ColumnSize&gt;5&lt;/ColumnSize&gt;
        ///    &lt;DataType&gt;System.Int16&lt;/DataType&gt;
        ///    &lt;CreateFormat&gt;smallint&lt;/CreateFormat&gt;
        ///    &lt;IsAutoIncrementable&gt;false&lt;/IsAutoIncrementable&gt;
        ///    &lt;IsCaseSensitive&gt;false&lt;/IsCaseSensitive&gt;
        ///    &lt;IsFixedLength&gt;true&lt;/IsFixedLength&gt;
        ///    &lt;IsFixedPrecisionScale&gt;true&lt;/IsFixedPrecisionScale&gt;
        ///    &lt;IsLong&gt;false&lt;/IsLong&gt;
        ///    &lt;IsNullable&gt;true&lt;/ [rest of string was truncated]&quot;;.
        /// </summary>
        internal static string DataTypes {
            get {
                return ResourceManager.GetString("DataTypes", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to ALL,ALTER,AND,AS,AUTOINCREMENT,BETWEEN,BY,CASE,CHECK,COLLATE,COMMIT,CONSTRAINT,CREATE,CROSS,DEFAULT,DEFERRABLE,DELETE,DISTINCT,DROP,ELSE,ESCAPE,EXCEPT,FOREIGN,FROM,FULL,GROUP,HAVING,IN,INDEX,INNER,INSERT,INTERSECT,INTO,IS,ISNULL,JOIN,LEFT,LIMIT,NATURAL,NOT,NOTNULL,NULL,ON,OR,ORDER,OUTER,PRIMARY,REFERENCES,RIGHT,ROLLBACK,SELECT,SET,TABLE,THEN,TO,TRANSACTION,UNION,UNIQUE,UPDATE,USING,VALUES,WHEN,WHERE.
        /// </summary>
        internal static string Keywords {
            get {
                return ResourceManager.GetString("Keywords", resourceCulture);
            }
        }
        
        /// <summary>
        ///   Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
        ///&lt;DocumentElement&gt;
        ///  &lt;MetaDataCollections&gt;
        ///    &lt;CollectionName&gt;MetaDataCollections&lt;/CollectionName&gt;
        ///    &lt;NumberOfRestrictions&gt;0&lt;/NumberOfRestrictions&gt;
        ///    &lt;NumberOfIdentifierParts&gt;0&lt;/NumberOfIdentifierParts&gt;
        ///  &lt;/MetaDataCollections&gt;
        ///  &lt;MetaDataCollections&gt;
        ///    &lt;CollectionName&gt;DataSourceInformation&lt;/CollectionName&gt;
        ///    &lt;NumberOfRestrictions&gt;0&lt;/NumberOfRestrictions&gt;
        ///    &lt;NumberOfIdentifierParts&gt;0&lt;/NumberOfIdentifierParts&gt;
        ///  &lt;/MetaDataCollections&gt;
        ///  &lt;MetaDataC [rest of string was truncated]&quot;;.
        /// </summary>
        internal static string MetaDataCollections {
            get {
                return ResourceManager.GetString("MetaDataCollections", resourceCulture);
            }
        }
    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































































































































Deleted System.Data.SQLite/SR.resx.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!-- 
    Microsoft ResX Schema 
    
    Version 2.0
    
    The primary goals of this format is to allow a simple XML format 
    that is mostly human readable. The generation and parsing of the 
    various data types are done through the TypeConverter classes 
    associated with the data types.
    
    Example:
    
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
                
    There are any number of "resheader" rows that contain simple 
    name/value pairs.
    
    Each data row contains a name, and value. The row also contains a 
    type or mimetype. Type corresponds to a .NET class that support 
    text/value conversion through the TypeConverter architecture. 
    Classes that don't support this are serialized and stored with the 
    mimetype set.
    
    The mimetype is used for serialized objects, and tells the 
    ResXResourceReader how to depersist the object. This is currently not 
    extensible. For a given mimetype the value must be set accordingly:
    
    Note - application/x-microsoft.net.object.binary.base64 is the format 
    that the ResXResourceWriter will generate, however the reader can 
    read any of the formats listed below.
    
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array 
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  <data name="DataTypes" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>datatypes.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
  </data>
  <data name="Keywords" xml:space="preserve">
    <value>ALL,ALTER,AND,AS,AUTOINCREMENT,BETWEEN,BY,CASE,CHECK,COLLATE,COMMIT,CONSTRAINT,CREATE,CROSS,DEFAULT,DEFERRABLE,DELETE,DISTINCT,DROP,ELSE,ESCAPE,EXCEPT,FOREIGN,FROM,FULL,GROUP,HAVING,IN,INDEX,INNER,INSERT,INTERSECT,INTO,IS,ISNULL,JOIN,LEFT,LIMIT,NATURAL,NOT,NOTNULL,NULL,ON,OR,ORDER,OUTER,PRIMARY,REFERENCES,RIGHT,ROLLBACK,SELECT,SET,TABLE,THEN,TO,TRANSACTION,UNION,UNIQUE,UPDATE,USING,VALUES,WHEN,WHERE</value>
  </data>
  <data name="MetaDataCollections" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>metadatacollections.xml;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
  </data>
</root>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































Deleted System.Data.SQLite/System.Data.SQLite.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{AC139952-261A-4463-B6FA-AEBC25283A66}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
    <SignAssembly>true</SignAssembly>
    <AssemblyOriginatorKeyFile>System.Data.SQLite.snk</AssemblyOriginatorKeyFile>
    <RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
    <FileUpgradeFlags>
    </FileUpgradeFlags>
    <OldToolsVersion>2.0</OldToolsVersion>
    <UpgradeBackupLocation>
    </UpgradeBackupLocation>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>..\bin\</OutputPath>
    <DefineConstants>TRACE;DEBUG;USE_INTEROP_DLL</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <DocumentationFile>
    </DocumentationFile>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
    <FileAlignment>512</FileAlignment>
    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
    <PlatformTarget>x86</PlatformTarget>
    <UseVSHostingProcess>false</UseVSHostingProcess>
    <RunCodeAnalysis>false</RunCodeAnalysis>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugSymbols>false</DebugSymbols>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>
    </DefineConstants>
    <DebugType>none</DebugType>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
    <ErrorReport>prompt</ErrorReport>
    <FileAlignment>512</FileAlignment>
    <DocumentationFile>..\bin\System.Data.SQLite.XML</DocumentationFile>
    <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
    <Optimize>true</Optimize>
    <UseVSHostingProcess>false</UseVSHostingProcess>
    <RunCodeAnalysis>false</RunCodeAnalysis>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'StockDebug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>..\bin\ManagedOnly\</OutputPath>
    <DefineConstants>TRACE;DEBUG;SQLITE_STANDARD</DefineConstants>
    <DebugType>full</DebugType>
    <PlatformTarget>x86</PlatformTarget>
    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
    <ErrorReport>prompt</ErrorReport>
    <UseVSHostingProcess>false</UseVSHostingProcess>
    <CodeAnalysisRules>-Microsoft.Design#CA1003;-Microsoft.Naming#CA1709;-Microsoft.Naming#CA1704;-Microsoft.Naming#CA1711;-Microsoft.Performance#CA1822</CodeAnalysisRules>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'StockRelease|AnyCPU' ">
    <OutputPath>..\bin\ManagedOnly\</OutputPath>
    <DocumentationFile>..\bin\ManagedOnly\System.Data.SQLite.XML</DocumentationFile>
    <Optimize>true</Optimize>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
    <ErrorReport>prompt</ErrorReport>
    <DefineConstants>SQLITE_STANDARD</DefineConstants>
    <UseVSHostingProcess>false</UseVSHostingProcess>
    <RunCodeAnalysis>false</RunCodeAnalysis>
    <CodeAnalysisRules>-Microsoft.Design#CA1008;-Microsoft.Design#CA1003;-Microsoft.Globalization#CA1308;-Microsoft.Globalization#CA1309;-Microsoft.Maintainability#CA1502;-Microsoft.Naming#CA1709;-Microsoft.Naming#CA1704;-Microsoft.Naming#CA1711;-Microsoft.Naming#CA1717;-Microsoft.Performance#CA1822;-Microsoft.Usage#CA1801</CodeAnalysisRules>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Transactions" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="LINQ\SQLiteConnection_Linq.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="LINQ\SQLiteFactory_Linq.cs">
      <SubType>Code</SubType>
    </Compile>
    <Compile Include="SQLite3.cs" />
    <Compile Include="SQLite3_UTF16.cs" />
    <Compile Include="SQLiteBase.cs" />
    <Compile Include="SQLiteCommand.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteCommandBuilder.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteConnection.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteConnectionPool.cs" />
    <Compile Include="SQLiteConnectionStringBuilder.cs" />
    <Compile Include="SQLiteConvert.cs" />
    <Compile Include="SQLiteDataAdapter.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteDataReader.cs" />
    <Compile Include="SQLiteEnlistment.cs" />
    <Compile Include="SQLiteException.cs" />
    <Compile Include="SQLiteFactory.cs" />
    <Compile Include="SQLiteFunction.cs" />
    <Compile Include="SQLiteFunctionAttribute.cs" />
    <Compile Include="SQLiteKeyReader.cs" />
    <Compile Include="SQLiteMetaDataCollectionNames.cs" />
    <Compile Include="SQLiteParameter.cs" />
    <Compile Include="SQLiteParameterCollection.cs" />
    <Compile Include="SQLiteStatement.cs" />
    <Compile Include="SQLiteTransaction.cs" />
    <Compile Include="SR.Designer.cs">
      <DependentUpon>SR.resx</DependentUpon>
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
    </Compile>
    <Compile Include="UnsafeNativeMethods.cs" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="SR.resx">
      <SubType>Designer</SubType>
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>SR.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="System.Data.SQLite.snk" />
  </ItemGroup>
  <ItemGroup>
    <None Include="DataTypes.xml" />
  </ItemGroup>
  <ItemGroup>
    <None Include="MetaDataCollections.xml" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="SQLiteCommand.bmp" />
    <EmbeddedResource Include="SQLiteConnection.bmp" />
    <EmbeddedResource Include="SQLiteDataAdapter.bmp" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Properties\" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
  <PropertyGroup>
    <PostBuildEvent>
    </PostBuildEvent>
  </PropertyGroup>
</Project>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































































Added System.Data.SQLite/System.Data.SQLite.2005.csproj.





































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.2005.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{AC139952-261A-4463-B6FA-AEBC25283A66}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx20>true</NetFx20>
    <ConfigurationYear>2005</ConfigurationYear>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.References.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Files.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite/System.Data.SQLite.2008.csproj.







































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.2008.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{AC139952-261A-4463-B6FA-AEBC25283A66}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <OldToolsVersion>2.0</OldToolsVersion>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx35>true</NetFx35>
    <ConfigurationYear>2008</ConfigurationYear>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.References.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Files.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite/System.Data.SQLite.2010.csproj.









































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.2010.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>10.0.30319</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{AC139952-261A-4463-B6FA-AEBC25283A66}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <OldToolsVersion>3.5</OldToolsVersion>
    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx40>true</NetFx40>
    <ConfigurationYear>2010</ConfigurationYear>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.References.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Files.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite/System.Data.SQLite.2012.csproj.





































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.2012.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{AC139952-261A-4463-B6FA-AEBC25283A66}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx45>true</NetFx45>
    <ConfigurationYear>2012</ConfigurationYear>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.References.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Files.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite/System.Data.SQLite.2013.csproj.





































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.2013.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{AC139952-261A-4463-B6FA-AEBC25283A66}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx451>true</NetFx451>
    <ConfigurationYear>2013</ConfigurationYear>
    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.References.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Files.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite/System.Data.SQLite.2015.csproj.





































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.2015.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{AC139952-261A-4463-B6FA-AEBC25283A66}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx46>true</NetFx46>
    <ConfigurationYear>2015</ConfigurationYear>
    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.References.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Files.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite/System.Data.SQLite.2017.csproj.





































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.2017.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{AC139952-261A-4463-B6FA-AEBC25283A66}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx47>true</NetFx47>
    <ConfigurationYear>2017</ConfigurationYear>
    <TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.References.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Files.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Deleted System.Data.SQLite/System.Data.SQLite.CF.snk.

cannot compute difference between binary files

Added System.Data.SQLite/System.Data.SQLite.Compact.2005.csproj.











































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Compact.2005.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{AC139951-261A-4463-B6FA-AEBC25283A66}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <ProjectTypeGuids>{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <PlatformFamilyName>WindowsCE</PlatformFamilyName>
    <PlatformID>E2BECB1F-8C8C-41ba-B736-9BE7D946A398</PlatformID>
    <OSVersion>5.0</OSVersion>
    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
    <NativePlatformName>Windows CE</NativePlatformName>
    <FormFactorID></FormFactorID>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx20>true</NetFx20>
    <UseInteropDll>false</UseInteropDll>
    <UseSqliteStandard>false</UseSqliteStandard>
    <IsCompactFramework>true</IsCompactFramework>
    <ConfigurationYear>2005</ConfigurationYear>
    <ConfigurationSuffix>Compact</ConfigurationSuffix>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE;$(PlatformFamilyName)</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE;$(PlatformFamilyName)</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.References.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Files.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v1.0' And Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets')" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v2.0' And Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets')" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v3.5' And Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets')" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}">
        <HostingProcess disable="1" />
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
</Project>

Added System.Data.SQLite/System.Data.SQLite.Compact.2008.csproj.













































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Compact.2008.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{AC139951-261A-4463-B6FA-AEBC25283A66}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <ProjectTypeGuids>{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <PlatformFamilyName>WindowsCE</PlatformFamilyName>
    <PlatformID>E2BECB1F-8C8C-41ba-B736-9BE7D946A398</PlatformID>
    <OSVersion>5.0</OSVersion>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    <OldToolsVersion>2.0</OldToolsVersion>
    <NativePlatformName>Windows CE</NativePlatformName>
    <FormFactorID></FormFactorID>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx35>true</NetFx35>
    <UseInteropDll>false</UseInteropDll>
    <UseSqliteStandard>false</UseSqliteStandard>
    <IsCompactFramework>true</IsCompactFramework>
    <ConfigurationYear>2008</ConfigurationYear>
    <ConfigurationSuffix>Compact</ConfigurationSuffix>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE;$(PlatformFamilyName)</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE;$(PlatformFamilyName)</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.References.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Files.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v1.0' And Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets')" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v2.0' And Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets')" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v3.5' And Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets')" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}">
        <HostingProcess disable="1" />
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
</Project>

Added System.Data.SQLite/System.Data.SQLite.Compact.2012.csproj.







































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Compact.2012.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{AC139951-261A-4463-B6FA-AEBC25283A66}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <ProjectTypeGuids>{6AFDAB0D-95EF-424D-8A49-099ECD40B0FF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <TargetFrameworkIdentifier>WindowsEmbeddedCompact</TargetFrameworkIdentifier>
    <TargetFrameworkVersion>v3.9</TargetFrameworkVersion>
    <TargetFrameworkTargetsVersion>v8.0</TargetFrameworkTargetsVersion>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx35>true</NetFx35>
    <NetFx35Settings>false</NetFx35Settings>
    <UseInteropDll>false</UseInteropDll>
    <UseSqliteStandard>false</UseSqliteStandard>
    <IsCompactFramework>true</IsCompactFramework>
    <ConfigurationYear>2012</ConfigurationYear>
    <ConfigurationSuffix>Compact</ConfigurationSuffix>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.References.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Files.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v1.0' And Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets')" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v2.0' And Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets')" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v3.5' And Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets')" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
  <Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkTargetsVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}">
        <HostingProcess disable="1" />
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
</Project>

Added System.Data.SQLite/System.Data.SQLite.Module.2005.csproj.













































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Module.2005.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{AC139952-261A-4463-B6FA-AEBC25284A66}</ProjectGuid>
    <OutputType>Module</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <SignAssembly>false</SignAssembly>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx20>true</NetFx20>
    <ConfigurationYear>2005</ConfigurationYear>
    <ConfigurationSuffix>Module</ConfigurationSuffix>
    <UseInteropDll>false</UseInteropDll>
    <UseSqliteStandard>false</UseSqliteStandard>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.References.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Files.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite/System.Data.SQLite.Module.2008.csproj.















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Module.2008.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{AC139952-261A-4463-B6FA-AEBC25284A66}</ProjectGuid>
    <OutputType>Module</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <OldToolsVersion>2.0</OldToolsVersion>
    <SignAssembly>false</SignAssembly>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx35>true</NetFx35>
    <ConfigurationYear>2008</ConfigurationYear>
    <ConfigurationSuffix>Module</ConfigurationSuffix>
    <UseInteropDll>false</UseInteropDll>
    <UseSqliteStandard>false</UseSqliteStandard>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.References.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Files.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite/System.Data.SQLite.Module.2010.csproj.

















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Module.2010.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>10.0.30319</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{AC139952-261A-4463-B6FA-AEBC25284A66}</ProjectGuid>
    <OutputType>Module</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <OldToolsVersion>3.5</OldToolsVersion>
    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
    <SignAssembly>false</SignAssembly>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx40>true</NetFx40>
    <ConfigurationYear>2010</ConfigurationYear>
    <ConfigurationSuffix>Module</ConfigurationSuffix>
    <UseInteropDll>false</UseInteropDll>
    <UseSqliteStandard>false</UseSqliteStandard>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.References.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Files.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite/System.Data.SQLite.Module.2012.csproj.













































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Module.2012.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{AC139952-261A-4463-B6FA-AEBC25284A66}</ProjectGuid>
    <OutputType>Module</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <SignAssembly>false</SignAssembly>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx45>true</NetFx45>
    <ConfigurationYear>2012</ConfigurationYear>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <ConfigurationSuffix>Module</ConfigurationSuffix>
    <UseInteropDll>false</UseInteropDll>
    <UseSqliteStandard>false</UseSqliteStandard>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.References.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Files.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite/System.Data.SQLite.Module.2013.csproj.













































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Module.2013.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{AC139952-261A-4463-B6FA-AEBC25284A66}</ProjectGuid>
    <OutputType>Module</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <SignAssembly>false</SignAssembly>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx451>true</NetFx451>
    <ConfigurationYear>2013</ConfigurationYear>
    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
    <ConfigurationSuffix>Module</ConfigurationSuffix>
    <UseInteropDll>false</UseInteropDll>
    <UseSqliteStandard>false</UseSqliteStandard>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.References.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Files.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite/System.Data.SQLite.Module.2015.csproj.













































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Module.2015.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{AC139952-261A-4463-B6FA-AEBC25284A66}</ProjectGuid>
    <OutputType>Module</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <SignAssembly>false</SignAssembly>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx46>true</NetFx46>
    <ConfigurationYear>2015</ConfigurationYear>
    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
    <ConfigurationSuffix>Module</ConfigurationSuffix>
    <UseInteropDll>false</UseInteropDll>
    <UseSqliteStandard>false</UseSqliteStandard>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.References.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Files.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite/System.Data.SQLite.Module.2017.csproj.













































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.Module.2017.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{AC139952-261A-4463-B6FA-AEBC25284A66}</ProjectGuid>
    <OutputType>Module</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <SignAssembly>false</SignAssembly>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx47>true</NetFx47>
    <ConfigurationYear>2017</ConfigurationYear>
    <TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
    <ConfigurationSuffix>Module</ConfigurationSuffix>
    <UseInteropDll>false</UseInteropDll>
    <UseSqliteStandard>false</UseSqliteStandard>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.References.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Files.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite/System.Data.SQLite.NetStandard20.csproj.





















































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.NetStandard20.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="15.0">
  <!--
  ******************************************************************************
  **                     Import .NET Core SDK Properties                      **
  ******************************************************************************
  -->

  <!--
      WARNING: This project cannot use the recommended pattern of having the
               "Project" element simply include the "Sdk" attribute, due to
               the "BuildDependsOn" property not being honored, see:

               https://github.com/Microsoft/msbuild/issues/1680

               Instead, the .NET Core SDK properties file is imported here
               and the corresponding targets file is imported right before
               resetting the "BuildDependsOn" property to include targets
               necessary for this project.
  -->
  <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

  <!--
  ******************************************************************************
  **                       Project Specific Properties                        **
  ******************************************************************************
  -->

  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <IsDotNetStandard>true</IsDotNetStandard>
    <ConfigurationYear>NetStandard20</ConfigurationYear>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **             Project / .NET Standard 2.0 Specific Properties              **
  ******************************************************************************
  -->

  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <Deterministic>False</Deterministic>
    <EnableDefaultItems>false</EnableDefaultItems>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **    .NET Standard 2.0 Specific Strong Name Signing Property Overrides     **
  ******************************************************************************
  -->

  <PropertyGroup>
    <!--
        NOTE: Apparently, the .NET Core build system sets the SignAssembly
              property to false; therefore, reset it to true.  Also, delay
              signing is currently non-functional due to the inability to
              run the strong name signing tool (sn.exe).  It behaves badly
              when run against a .NET Core assembly.
    -->
    <SignAssembly>true</SignAssembly>
    <DelaySign>false</DelaySign>

    <!--
        TODO: Why is this needed?  It seems that public signing is quite
              similar to delay signing.  Why is this necessary when not
              running on Windows?
    -->
    <PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                    .NET Standard 2.0 Specific Targets                    **
  ******************************************************************************
  -->

  <Target Name="GenerateResourcesForNetStandard20"
          Condition="'$(GenerateResourcesForNetStandard20)' != 'false' And
                     '$(BuildTool)' == 'DotNetCore' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(MSBuildProjectDirectory)' != '' And
                     !HasTrailingSlash('$(MSBuildProjectDirectory)') And
                     Exists('$(MSBuildProjectDirectory)\..\Externals\ResGen\ResGen.exe')"
          Inputs="Resources\SR.resx"
          Outputs="Generated\SR.resources">
    <MakeDir Directories="Generated" />

    <Exec Command="&quot;$(MSBuildProjectDirectory)\..\Externals\ResGen\ResGen.exe&quot; Resources\SR.resx Generated\SR.resources &quot;$(MSBuildProjectDirectory)\Resources&quot;" />
  </Target>

  <!--
  ******************************************************************************
  **                     Import Project Default Settings                      **
  ******************************************************************************
  -->

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />

  <!--
  ******************************************************************************
  **                       Import Project Build Targets                       **
  ******************************************************************************
  -->

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />

  <!--
  ******************************************************************************
  **               Convert Project Settings To MSBuild Settings               **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)netstandard2.0\System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                Project Configuration Specific Properties                 **
  ******************************************************************************
  -->

  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                        Import Assembly References                        **
  ******************************************************************************
  -->

  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.References.targets" />

  <!--
  ******************************************************************************
  **       Import Project Compile-Time Options (i.e. Define Constants)        **
  ******************************************************************************
  -->

  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Properties.targets" />

  <!--
  ******************************************************************************
  **                     Import Project Source Code Files                     **
  ******************************************************************************
  -->

  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Files.targets" />

  <!--
  ******************************************************************************
  **                     Project Embedded Resource Files                      **
  ******************************************************************************
  -->

  <ItemGroup>
    <EmbeddedResource Include="Generated\SR.resources">
      <LogicalName>System.Data.SQLite.SR.resources</LogicalName>
    </EmbeddedResource>
  </ItemGroup>

  <!--
  ******************************************************************************
  **                       Import .NET Core SDK Targets                       **
  ******************************************************************************
  -->

  <!--
      WARNING: This project cannot use the recommended pattern of having the
               "Project" element simply include the "Sdk" attribute, see the
               comment at the top of this file for more information.
  -->
  <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

  <!--
  ******************************************************************************
  **                  Add Targets To BuildDependsOn Property                  **
  ******************************************************************************
  -->

  <PropertyGroup>
    <BuildDependsOn>
      DetectBuildTool;
      DetectOperatingSystem;
      GenerateResourcesForNetStandard20;
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added System.Data.SQLite/System.Data.SQLite.NetStandard21.csproj.





















































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * System.Data.SQLite.NetStandard21.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="16.0">
  <!--
  ******************************************************************************
  **                     Import .NET Core SDK Properties                      **
  ******************************************************************************
  -->

  <!--
      WARNING: This project cannot use the recommended pattern of having the
               "Project" element simply include the "Sdk" attribute, due to
               the "BuildDependsOn" property not being honored, see:

               https://github.com/Microsoft/msbuild/issues/1680

               Instead, the .NET Core SDK properties file is imported here
               and the corresponding targets file is imported right before
               resetting the "BuildDependsOn" property to include targets
               necessary for this project.
  -->
  <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

  <!--
  ******************************************************************************
  **                       Project Specific Properties                        **
  ******************************************************************************
  -->

  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{77BE07F7-8183-4A83-8AEC-D46A0C2C026D}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>System.Data.SQLite</RootNamespace>
    <AssemblyName>System.Data.SQLite</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <IsDotNetStandard>true</IsDotNetStandard>
    <ConfigurationYear>NetStandard21</ConfigurationYear>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **             Project / .NET Standard 2.1 Specific Properties              **
  ******************************************************************************
  -->

  <PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <Deterministic>False</Deterministic>
    <EnableDefaultItems>false</EnableDefaultItems>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **    .NET Standard 2.1 Specific Strong Name Signing Property Overrides     **
  ******************************************************************************
  -->

  <PropertyGroup>
    <!--
        NOTE: Apparently, the .NET Core build system sets the SignAssembly
              property to false; therefore, reset it to true.  Also, delay
              signing is currently non-functional due to the inability to
              run the strong name signing tool (sn.exe).  It behaves badly
              when run against a .NET Core assembly.
    -->
    <SignAssembly>true</SignAssembly>
    <DelaySign>false</DelaySign>

    <!--
        TODO: Why is this needed?  It seems that public signing is quite
              similar to delay signing.  Why is this necessary when not
              running on Windows?
    -->
    <PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                    .NET Standard 2.1 Specific Targets                    **
  ******************************************************************************
  -->

  <Target Name="GenerateResourcesForNetStandard21"
          Condition="'$(GenerateResourcesForNetStandard21)' != 'false' And
                     '$(BuildTool)' == 'DotNetCore' And
                     '$(OperatingSystem)' == 'Windows' And
                     '$(MSBuildProjectDirectory)' != '' And
                     !HasTrailingSlash('$(MSBuildProjectDirectory)') And
                     Exists('$(MSBuildProjectDirectory)\..\Externals\ResGen\ResGen.exe')"
          Inputs="Resources\SR.resx"
          Outputs="Generated\SR.resources">
    <MakeDir Directories="Generated" />

    <Exec Command="&quot;$(MSBuildProjectDirectory)\..\Externals\ResGen\ResGen.exe&quot; Resources\SR.resx Generated\SR.resources &quot;$(MSBuildProjectDirectory)\Resources&quot;" />
  </Target>

  <!--
  ******************************************************************************
  **                     Import Project Default Settings                      **
  ******************************************************************************
  -->

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />

  <!--
  ******************************************************************************
  **                       Import Project Build Targets                       **
  ******************************************************************************
  -->

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />

  <!--
  ******************************************************************************
  **               Convert Project Settings To MSBuild Settings               **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
    <DocumentationFile>$(BinaryOutputPath)netstandard2.1\System.Data.SQLite.xml</DocumentationFile>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                Project Configuration Specific Properties                 **
  ******************************************************************************
  -->

  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                        Import Assembly References                        **
  ******************************************************************************
  -->

  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.References.targets" />

  <!--
  ******************************************************************************
  **       Import Project Compile-Time Options (i.e. Define Constants)        **
  ******************************************************************************
  -->

  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Properties.targets" />

  <!--
  ******************************************************************************
  **                     Import Project Source Code Files                     **
  ******************************************************************************
  -->

  <Import Project="$(MSBuildProjectDirectory)\Targets\System.Data.SQLite.Files.targets" />

  <!--
  ******************************************************************************
  **                     Project Embedded Resource Files                      **
  ******************************************************************************
  -->

  <ItemGroup>
    <EmbeddedResource Include="Generated\SR.resources">
      <LogicalName>System.Data.SQLite.SR.resources</LogicalName>
    </EmbeddedResource>
  </ItemGroup>

  <!--
  ******************************************************************************
  **                       Import .NET Core SDK Targets                       **
  ******************************************************************************
  -->

  <!--
      WARNING: This project cannot use the recommended pattern of having the
               "Project" element simply include the "Sdk" attribute, see the
               comment at the top of this file for more information.
  -->
  <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

  <!--
  ******************************************************************************
  **                  Add Targets To BuildDependsOn Property                  **
  ******************************************************************************
  -->

  <PropertyGroup>
    <BuildDependsOn>
      DetectBuildTool;
      DetectOperatingSystem;
      GenerateResourcesForNetStandard21;
      $(BuildDependsOn);
      CopyConfigurations;
    </BuildDependsOn>
    <CleanDependsOn>
      $(CleanDependsOn);
      CleanConfigurations;
    </CleanDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Deleted System.Data.SQLite/System.Data.SQLite.snk.

cannot compute difference between binary files

Added System.Data.SQLite/Targets/System.Data.SQLite.Files.targets.





































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!--
 *
 * System.Data.SQLite.Files.targets -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **                    Project Source Code Files (Common)                    **
  ******************************************************************************
  -->

  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="AssemblySourceIdAttribute.cs" />
    <Compile Include="AssemblySourceTimeStampAttribute.cs" />
    <Compile Include="SQLite3.cs" />
    <Compile Include="SQLite3_UTF16.cs" />
    <Compile Include="SQLiteBackup.cs" />
    <Compile Include="SQLiteBase.cs" />
    <Compile Include="SQLiteBlob.cs" />
    <Compile Include="SQLiteCommand.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteCommandBuilder.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteConnection.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteConnectionPool.cs" />
    <Compile Include="SQLiteConnectionStringBuilder.cs" />
    <Compile Include="SQLiteConvert.cs" />
    <Compile Include="SQLiteDataAdapter.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Include="SQLiteDataReader.cs" />
    <Compile Include="SQLiteDefineConstants.cs" />
    <Compile Include="SQLiteException.cs" />
    <Compile Include="SQLiteFactory.cs" />
    <Compile Include="SQLiteFunction.cs" />
    <Compile Include="SQLiteFunctionAttribute.cs" />
    <Compile Include="SQLiteKeyReader.cs" />
    <Compile Include="SQLiteLog.cs" />
    <Compile Include="SQLiteMetaDataCollectionNames.cs" />
    <Compile Include="SQLiteParameter.cs" />
    <Compile Include="SQLiteParameterCollection.cs" />
    <Compile Include="SQLitePatchLevel.cs" />
    <Compile Include="SQLiteStatement.cs" />
    <Compile Include="SQLiteTransaction.cs" />
    <Compile Include="SQLiteTransaction2.cs" />
    <Compile Include="SQLiteTransactionBase.cs" />
    <Compile Include="UnsafeNativeMethods.cs" />
    <Compile Include="Resources\SR.Designer.cs">
      <DependentUpon>SR.resx</DependentUpon>
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
    </Compile>
    <None Include="Configurations\System.Data.SQLite.dll.config" />
  </ItemGroup>

  <!--
  ******************************************************************************
  **                     Project Embedded Resource Files                      **
  ******************************************************************************
  -->

  <ItemGroup Condition="'$(IsDotNetStandard)' == 'false'">
    <EmbeddedResource Include="Resources\SR.resx">
      <SubType>Designer</SubType>
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>SR.Designer.cs</LastGenOutput>
      <LogicalName>System.Data.SQLite.SR.resources</LogicalName>
    </EmbeddedResource>
  </ItemGroup>

  <!--
  ******************************************************************************
  **                Project Source Code Files (Full Framework)                **
  ******************************************************************************
  -->

  <ItemGroup Condition="'$(IsCompactFramework)' == 'false'">
    <Compile Include="SQLiteEnlistment.cs" />
    <Compile Condition="'$(NetFx35)' != 'false' Or
                        '$(NetFx40)' != 'false' Or
                        '$(NetFx45)' != 'false' Or
                        '$(NetFx451)' != 'false' Or
                        '$(NetFx452)' != 'false' Or
                        '$(NetFx46)' != 'false' Or
                        '$(NetFx461)' != 'false' Or
                        '$(NetFx462)' != 'false' Or
                        '$(NetFx47)' != 'false' Or
                        '$(NetFx471)' != 'false' Or
                        '$(NetFx472)' != 'false' Or
                        '$(NetStandard21)' != 'false'"
             Include="LINQ\SQLiteConnection_Linq.cs">
      <SubType>Component</SubType>
    </Compile>
    <Compile Condition="'$(NetFx35)' != 'false' Or
                        '$(NetFx40)' != 'false' Or
                        '$(NetFx45)' != 'false' Or
                        '$(NetFx451)' != 'false' Or
                        '$(NetFx452)' != 'false' Or
                        '$(NetFx46)' != 'false' Or
                        '$(NetFx461)' != 'false' Or
                        '$(NetFx462)' != 'false' Or
                        '$(NetFx47)' != 'false' Or
                        '$(NetFx471)' != 'false' Or
                        '$(NetFx472)' != 'false' Or
                        '$(NetStandard21)' != 'false'"
             Include="LINQ\SQLiteFactory_Linq.cs">
      <SubType>Code</SubType>
    </Compile>
    <EmbeddedResource Include="Resources\SQLiteCommand.bmp" />
    <EmbeddedResource Include="Resources\SQLiteConnection.bmp" />
    <EmbeddedResource Include="Resources\SQLiteDataAdapter.bmp" />
  </ItemGroup>

  <!--
  ******************************************************************************
  **                     Virtual Table Source Code Files                      **
  ******************************************************************************
  -->

  <ItemGroup Condition="'$(InteropVirtualTable)' != 'false'">
    <Compile Include="ISQLiteNativeModule.cs" />
    <Compile Include="SQLiteModule.cs" />
    <Compile Include="SQLiteModuleCommon.cs" />
    <Compile Include="SQLiteModuleEnumerable.cs" />
    <Compile Include="SQLiteModuleNoop.cs" />
  </ItemGroup>

  <!--
  ******************************************************************************
  **                   Session Extension Source Code Files                    **
  ******************************************************************************
  -->

  <ItemGroup Condition="'$(InteropSessionExtension)' != 'false'">
    <Compile Include="SQLiteSession.cs" />
  </ItemGroup>
</Project>

Added System.Data.SQLite/Targets/System.Data.SQLite.Properties.targets.



























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
<!--
 *
 * System.Data.SQLite.Properties.targets -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **                           Platform Properties                            **
  ******************************************************************************
  -->

  <PropertyGroup>
    <NetStandard21 Condition="'$(NetStandard21)' == '' And ('$(IsDotNetStandard)' == 'false' Or ('$(TargetFramework)' != 'netstandard2.1' And '$(TargetFramework)' != 'netcoreapp3.0'))">false</NetStandard21>
    <NetStandard21 Condition="'$(NetStandard21)' == '' And ('$(IsDotNetStandard)' != 'false' And ('$(TargetFramework)' == 'netstandard2.1' Or '$(TargetFramework)' == 'netcoreapp3.0'))">true</NetStandard21>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                        Platform Define Constants                         **
  ******************************************************************************
  -->

  <!--
      NOTE: Only use functionality available in the .NET Framework 2.0?  By
            default, this is disabled.  This must be enabled to successfully
            build the project using Visual Studio 2005 and/or the .NET
            Framework 2.0 (if necessary, it will typically be enabled from
            within the project file itself).
  -->
  <PropertyGroup Condition="'$(NetFx20)' != 'false'">
    <DefineConstants>$(DefineConstants);NET_20</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Only use functionality available in the .NET Framework 3.5?  By
            default, this is disabled.  This must be enabled to successfully
            build the project using Visual Studio 2008 and/or the .NET
            Framework 3.5 (if necessary, it will typically be enabled from
            within the project file itself).
  -->
  <PropertyGroup Condition="'$(NetFx35)' != 'false'">
    <DefineConstants>$(DefineConstants);NET_35</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Only use functionality available in the .NET Framework 4.0?  By
            default, this is disabled.  This must be enabled to successfully
            build the project using Visual Studio 2010 and/or the .NET
            Framework 4.0 (if necessary, it will typically be enabled from
            within the project file itself).
  -->
  <PropertyGroup Condition="'$(NetFx40)' != 'false'">
    <DefineConstants>$(DefineConstants);NET_40</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Only use functionality available in the .NET Framework 4.5?  By
            default, this is disabled.  This must be enabled to successfully
            build the project using Visual Studio 2012 and/or the .NET
            Framework 4.5 (if necessary, it will typically be enabled from
            within the project file itself).
  -->
  <PropertyGroup Condition="'$(NetFx45)' != 'false'">
    <DefineConstants>$(DefineConstants);NET_45</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Only use functionality available in the .NET Framework 4.5.1?  By
            default, this is disabled.  This must be enabled to successfully
            build the project using Visual Studio 2013 and/or the .NET
            Framework 4.5.1 (if necessary, it will typically be enabled from
            within the project file itself).
  -->
  <PropertyGroup Condition="'$(NetFx451)' != 'false'">
    <DefineConstants>$(DefineConstants);NET_451</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Only use functionality available in the .NET Framework 4.5.2?  By
            default, this is disabled.  This must be enabled to successfully
            build the project using Visual Studio 2013 and/or the .NET
            Framework 4.5.2 (if necessary, it will typically be enabled from
            within the project file itself).
  -->
  <PropertyGroup Condition="'$(NetFx452)' != 'false'">
    <DefineConstants>$(DefineConstants);NET_452</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Only use functionality available in the .NET Framework 4.6?  By
            default, this is disabled.  This must be enabled to successfully
            build the project using Visual Studio 2015 and/or the .NET
            Framework 4.6 (if necessary, it will typically be enabled from
            within the project file itself).
  -->
  <PropertyGroup Condition="'$(NetFx46)' != 'false'">
    <DefineConstants>$(DefineConstants);NET_46</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Only use functionality available in the .NET Framework 4.6.1?  By
            default, this is disabled.  This must be enabled to successfully
            build the project using Visual Studio 2015 and/or the .NET
            Framework 4.6.1 (if necessary, it will typically be enabled from
            within the project file itself).
  -->
  <PropertyGroup Condition="'$(NetFx461)' != 'false'">
    <DefineConstants>$(DefineConstants);NET_461</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Only use functionality available in the .NET Framework 4.6.2?  By
            default, this is disabled.  This must be enabled to successfully
            build the project using Visual Studio 2015 and/or the .NET
            Framework 4.6.2 (if necessary, it will typically be enabled from
            within the project file itself).
  -->
  <PropertyGroup Condition="'$(NetFx462)' != 'false'">
    <DefineConstants>$(DefineConstants);NET_462</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Only use functionality available in the .NET Framework 4.7?  By
            default, this is disabled.  This must be enabled to successfully
            build the project using Visual Studio 2017 and/or the .NET
            Framework 4.7 (if necessary, it will typically be enabled from
            within the project file itself).
  -->
  <PropertyGroup Condition="'$(NetFx47)' != 'false'">
    <DefineConstants>$(DefineConstants);NET_47</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Only use functionality available in the .NET Framework 4.7.1?  By
            default, this is disabled.  This must be enabled to successfully
            build the project using Visual Studio 2017 and/or the .NET
            Framework 4.7.1 (if necessary, it will typically be enabled from
            within the project file itself).
  -->
  <PropertyGroup Condition="'$(NetFx471)' != 'false'">
    <DefineConstants>$(DefineConstants);NET_471</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Only use functionality available in the .NET Framework 4.7.2?  By
            default, this is disabled.  This must be enabled to successfully
            build the project using Visual Studio 2017 and/or the .NET
            Framework 4.7.2 (if necessary, it will typically be enabled from
            within the project file itself).
  -->
  <PropertyGroup Condition="'$(NetFx472)' != 'false'">
    <DefineConstants>$(DefineConstants);NET_472</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Only use functionality available in the .NET Framework 4.8?  By
            default, this is disabled.  This must be enabled to successfully
            build the project using Visual Studio 2017 and/or the .NET
            Framework 4.8 (if necessary, it will typically be enabled from
            within the project file itself).
  -->
  <PropertyGroup Condition="'$(NetFx48)' != 'false'">
    <DefineConstants>$(DefineConstants);NET_48</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Only use functionality available in the .NET Compact Framework 2.0?
            By default, this is disabled.  This must be enabled to successfully
            build the project using Visual Studio 2005 and/or the .NET Compact
            Framework 2.0 (if necessary, it will typically be enabled from
            within the project file itself).
  -->
  <PropertyGroup Condition="'$(IsCompactFramework)' != 'false' And
                            '$(TargetFrameworkVersion)' == 'v2.0'">
    <DefineConstants>$(DefineConstants);NET_COMPACT_20</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Only use functionality available in .NET Standard 2.0?  By default,
            this is disabled.  This must be enabled to successfully build the
            project using .NET Core 2.0 SDK (if necessary, it will typically
            be enabled from within the project file itself).
  -->
  <PropertyGroup Condition="'$(IsDotNetStandard)' != 'false' And
                            ('$(TargetFramework)' == 'netstandard2.0' Or
                             '$(TargetFramework)' == 'netcoreapp2.0' Or
                             '$(TargetFramework)' == 'netcoreapp2.1' Or
                             '$(TargetFramework)' == 'netcoreapp2.2')">
    <DefineConstants>$(DefineConstants);NET_STANDARD_20</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Only use functionality available in .NET Standard 2.1?  By default,
            this is disabled.  This must be enabled to successfully build the
            project using .NET Core 3.0 SDK (if necessary, it will typically
            be enabled from within the project file itself).
  -->
  <PropertyGroup Condition="'$(IsDotNetStandard)' != 'false' And
                            ('$(TargetFramework)' == 'netstandard2.1' Or
                             '$(TargetFramework)' == 'netcoreapp3.0')">
    <DefineConstants>$(DefineConstants);NET_STANDARD_21</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable extra internal state checking?
  -->
  <PropertyGroup Condition="'$(CheckState)' != 'false'">
    <DefineConstants>$(DefineConstants);CHECK_STATE</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable counting of the CriticalHandle derived object instances?
  -->
  <PropertyGroup Condition="'$(CountHandle)' != 'false'">
    <DefineConstants>$(DefineConstants);COUNT_HANDLE</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable tracking of bytes allocated by the SQLiteMemory class?
  -->
  <PropertyGroup Condition="'$(TrackMemoryBytes)' != 'false'">
    <DefineConstants>$(DefineConstants);TRACK_MEMORY_BYTES</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: For interaction with the native SQLite implementation, use the
            custom built interop DLL (i.e. "SQLite.Interop.DLL")?
  -->
  <PropertyGroup Condition="'$(UseInteropDll)' != 'false'">
    <DefineConstants>$(DefineConstants);USE_INTEROP_DLL</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: For interaction with the native SQLite implementation, use the
            sqlite3_prepare_v2() function when preparing queries?
  -->
  <PropertyGroup Condition="'$(UsePrepareV2)' != 'false'">
    <DefineConstants>$(DefineConstants);USE_PREPARE_V2</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: For interaction with the native SQLite implementation, use the
            standard DLL (i.e. "sqlite3.dll")?
  -->
  <PropertyGroup Condition="'$(UseSqliteStandard)' != 'false'">
    <DefineConstants>$(DefineConstants);SQLITE_STANDARD</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Is the project being built to support the .NET Compact Framework?
  -->
  <PropertyGroup Condition="'$(IsCompactFramework)' != 'false'">
    <DefineConstants>$(DefineConstants);PLATFORM_COMPACTFRAMEWORK</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Emit an AssemblyFlags attribute that includes the Retargetable
            flag from the AssemblyNameFlags enumeration?
  -->
  <PropertyGroup Condition="'$(IsRetargetable)' != 'false'">
    <DefineConstants>$(DefineConstants);RETARGETABLE</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Throw an exception when somebody tries to access a disposed object?
  -->
  <PropertyGroup Condition="'$(ThrowOnDisposed)' != 'false'">
    <DefineConstants>$(DefineConstants);THROW_ON_DISPOSED</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Attempt to pre-load the native SQLite library?
  -->
  <PropertyGroup Condition="'$(PreLoadNativeLibrary)' != 'false'">
    <DefineConstants>$(DefineConstants);PRELOAD_NATIVE_LIBRARY</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable support (in the managed assemblies) for encrypted databases
            using the CryptoAPI-based (RC4) codec?
  -->
  <PropertyGroup Condition="'$(InteropCodec)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_CODEC</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable support (in the managed assemblies) for encrypted databases
            using SEE?
  -->
  <PropertyGroup Condition="'$(InteropIncludeSee)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_INCLUDE_SEE</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable support (in the managed assemblies) for compressed and
            encrypted databases using CEROD?
  -->
  <PropertyGroup Condition="'$(InteropIncludeCerod)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_INCLUDE_CEROD</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable support (in the managed assemblies) for compressed databases
            (read/write) using ZipVFS?
  -->
  <PropertyGroup Condition="'$(InteropIncludeZipVfs)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_INCLUDE_ZIPVFS</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable support (in the managed assemblies) for whatever "extra"
            code (e.g. "extensions") may be included by the custom built
            interop DLL (i.e. "SQLite.Interop.DLL")?
  -->
  <PropertyGroup Condition="'$(InteropIncludeExtra)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_INCLUDE_EXTRA</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable extra diagnostics from the custom built interop DLL (see the
            "SQLite.NET.Settings.targets" file for more information)?
  -->
  <PropertyGroup Condition="'$(InteropDebug)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_DEBUG</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable support (in the managed assemblies) for the custom extension
            functions?
  -->
  <PropertyGroup Condition="'$(InteropExtensionFunctions)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_EXTENSION_FUNCTIONS</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable support (in the managed assemblies) for the FTS5 extension?
  -->
  <PropertyGroup Condition="'$(InteropFts5Extension)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_FTS5_EXTENSION</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable support (in the managed assemblies) for the JSON extension?
  -->
  <PropertyGroup Condition="'$(InteropJson1Extension)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_JSON1_EXTENSION</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Disable all use of the sqlite3_close_v2() native API and use the
            legacy System.Data.SQLite connection closing algorithm instead.
  -->
  <PropertyGroup Condition="'$(InteropLegacyClose)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_LEGACY_CLOSE</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable the logging callback in the custom built interop DLL (see
            the "SQLite.NET.Settings.targets" file for more information)?
  -->
  <PropertyGroup Condition="'$(InteropLog)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_LOG</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable support (in the managed assemblies) for the percentile
            extension?
  -->
  <PropertyGroup Condition="'$(InteropPercentileExtension)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_PERCENTILE_EXTENSION</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable support (in the managed assemblies) for the regular
            expression extension?
  -->
  <PropertyGroup Condition="'$(InteropRegExpExtension)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_REGEXP_EXTENSION</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable support (in the managed assemblies) for the SHA1 extension?
  -->
  <PropertyGroup Condition="'$(InteropSha1Extension)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_SHA1_EXTENSION</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable support (in the managed assemblies) for the SHA3 extension?
  -->
  <PropertyGroup Condition="'$(InteropSha3Extension)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_SHA3_EXTENSION</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable support (in the managed assemblies) for the test extension?
  -->
  <PropertyGroup Condition="'$(InteropTestExtension)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_TEST_EXTENSION</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable support (in the managed assemblies) for the numeric type
            checking extension?
  -->
  <PropertyGroup Condition="'$(InteropToTypeExtension)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_TOTYPE_EXTENSION</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable including the "vtshim" module as a statically available
            extension?  This will allow virtual tables to be implemented in
            managed code.
  -->
  <PropertyGroup Condition="'$(InteropVirtualTable)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_VIRTUAL_TABLE</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable including the "session" module as a statically available
            extension?
  -->
  <PropertyGroup Condition="'$(InteropSessionExtension)' != 'false'">
    <DefineConstants>$(DefineConstants);INTEROP_SESSION_EXTENSION</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable various Trace.WriteLine statements included in the code,
            based on several criteria (see the "SQLite.NET.Settings.targets"
            file for more information)?
  -->
  <PropertyGroup Condition="'$(TraceConnection)' != 'false'">
    <DefineConstants>$(DefineConstants);TRACE_CONNECTION</DefineConstants>
  </PropertyGroup>

  <PropertyGroup Condition="'$(TraceDetection)' != 'false'">
    <DefineConstants>$(DefineConstants);TRACE_DETECTION</DefineConstants>
  </PropertyGroup>

  <PropertyGroup Condition="'$(TraceHandle)' != 'false'">
    <DefineConstants>$(DefineConstants);TRACE_HANDLE</DefineConstants>
  </PropertyGroup>

  <PropertyGroup Condition="'$(TracePreLoad)' != 'false'">
    <DefineConstants>$(DefineConstants);TRACE_PRELOAD</DefineConstants>
  </PropertyGroup>

  <PropertyGroup Condition="'$(TraceShared)' != 'false'">
    <DefineConstants>$(DefineConstants);TRACE_SHARED</DefineConstants>
  </PropertyGroup>

  <PropertyGroup Condition="'$(TraceStatement)' != 'false'">
    <DefineConstants>$(DefineConstants);TRACE_STATEMENT</DefineConstants>
  </PropertyGroup>

  <PropertyGroup Condition="'$(TraceWarning)' != 'false'">
    <DefineConstants>$(DefineConstants);TRACE_WARNING</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable the use of native Windows APIs, when available?
  -->
  <PropertyGroup Condition="'$(UseWindows)' != 'false'">
    <DefineConstants>$(DefineConstants);WINDOWS</DefineConstants>
  </PropertyGroup>

  <!--
      NOTE: Enable the use of Entity Framework 6 or higher?
  -->
  <PropertyGroup Condition="'$(UseEntityFramework6)' != 'false'">
    <DefineConstants>$(DefineConstants);USE_ENTITY_FRAMEWORK_6</DefineConstants>
  </PropertyGroup>
</Project>

Added System.Data.SQLite/Targets/System.Data.SQLite.References.targets.





















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!--
 *
 * System.Data.SQLite.References.targets -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **                     Core References (Full Framework)                     **
  ******************************************************************************
  -->

  <ItemGroup Condition="'$(IsCompactFramework)' == 'false' And
                        '$(IsDotNetStandard)' == 'false'">
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Transactions" />
    <Reference Include="System.Xml" />
  </ItemGroup>

  <!--
  ******************************************************************************
  **                    Core References (Compact Framework)                   **
  ******************************************************************************
  -->

  <ItemGroup Condition="'$(IsCompactFramework)' != 'false'">
    <Reference Include="mscorlib" />
    <Reference Include="System">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Data">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Xml">
      <Private>False</Private>
    </Reference>
  </ItemGroup>
</Project>

Changes to System.Data.SQLite/UnsafeNativeMethods.cs.

1
2
3
4
5
6
7
8
9
10











11


12
13
























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































14









































































































































































































































































































































































































































































15
16
17
18
































































































































































19


































































































20





































21






















































































































































































































































































































































































































































































































































































































































22

23











24















25

26







27











































































































































































































































































































































28






























29



30

































31



























































































































































































32



























































































33







34
















































































35














































































36































































































































































































































































37
38

39
40
41

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67






68
69
70
71
72
73
74
75
76
77
78

79


80
81
82
83
84
85
86
87
88
89

90
91
92
93
94
95


96
97
98
99
100
101
102
103

104












105
106
107
108
109
110



111
112
113

114


115
116



117
118
119
120
121


122

123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169












































170
171
172
173
174
175
176
177
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;











  using System.Security;


  using System.Runtime.InteropServices;

























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































#if !PLATFORM_COMPACTFRAMEWORK && !DEBUG









































































































































































































































































































































































































































































  [SuppressUnmanagedCodeSecurity]
#endif
  internal static class UnsafeNativeMethods
  {
































































































































































#if !SQLITE_STANDARD








































































































































#if !USE_INTEROP_DLL
























































































































































































































































































































































































































































































































































































































































#if !PLATFORM_COMPACTFRAMEWORK











    private const string SQLITE_DLL = "System.Data.SQLite.DLL";















#else

    internal const string SQLITE_DLL = "SQLite.Interop.067.DLL";







#endif // PLATFORM_COMPACTFRAMEWORK










































































































































































































































































































































































#else



    private const string SQLITE_DLL = "SQLite.Interop.DLL";

































#endif // USE_INTEROP_DLL























































































































































































































































































#else







    private const string SQLITE_DLL = "sqlite3";
















































































#endif














































































































































































































































































































































    // This section uses interop calls that also fetch text length to optimize conversion.  
    // When using the standard dll, we can replace these calls with normal sqlite calls and do unoptimized conversions instead afterwards

    #region interop added textlength calls

#if !SQLITE_STANDARD

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_bind_parameter_name_interop(IntPtr stmt, int index, out int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_database_name_interop(IntPtr stmt, int index, out int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_database_name16_interop(IntPtr stmt, int index, out int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_decltype_interop(IntPtr stmt, int index, out int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_decltype16_interop(IntPtr stmt, int index, out int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_name_interop(IntPtr stmt, int index, out int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_name16_interop(IntPtr stmt, int index, out int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_origin_name_interop(IntPtr stmt, int index, out int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_origin_name16_interop(IntPtr stmt, int index, out int len);







    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_table_name_interop(IntPtr stmt, int index, out int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_table_name16_interop(IntPtr stmt, int index, out int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_text_interop(IntPtr stmt, int index, out int len);

    [DllImport(SQLITE_DLL)]

    internal static extern IntPtr sqlite3_column_text16_interop(IntPtr stmt, int index, out int len);



    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_errmsg_interop(IntPtr db, out int len);

    [DllImport(SQLITE_DLL)]
    internal static extern int sqlite3_prepare_interop(IntPtr db, IntPtr pSql, int nBytes, out IntPtr stmt, out IntPtr ptrRemain, out int nRemain);

    [DllImport(SQLITE_DLL)]
    internal static extern int sqlite3_table_column_metadata_interop(IntPtr db, byte[] dbName, byte[] tblName, byte[] colName, out IntPtr ptrDataType, out IntPtr ptrCollSeq, out int notNull, out int primaryKey, out int autoInc, out int dtLen, out int csLen);


    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_value_text_interop(IntPtr p, out int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_value_text16_interop(IntPtr p, out int len);
#endif



    #endregion

    // These functions add existing functionality on top of SQLite and require a little effort to
    // get working when using the standard SQLite library.
    #region interop added functionality

#if !SQLITE_STANDARD

    [DllImport(SQLITE_DLL)]












    internal static extern int sqlite3_close_interop(IntPtr db);

    [DllImport(SQLITE_DLL)]
    internal static extern int sqlite3_create_function_interop(IntPtr db, byte[] strName, int nArgs, int nType, IntPtr pvUser, SQLiteCallback func, SQLiteCallback fstep, SQLiteFinalCallback ffinal, int needCollSeq);

    [DllImport(SQLITE_DLL)]



    internal static extern int sqlite3_finalize_interop(IntPtr stmt);

    [DllImport(SQLITE_DLL)]

    internal static extern int sqlite3_open_interop(byte[] utf8Filename, int flags, out IntPtr db);



    [DllImport(SQLITE_DLL)]



    internal static extern int sqlite3_open16_interop(byte[] utf8Filename, int flags, out IntPtr db);

    [DllImport(SQLITE_DLL)]
    internal static extern int sqlite3_reset_interop(IntPtr stmt);



#endif


    #endregion

    // The standard api call equivalents of the above interop calls
    #region standard versions of interop functions

#if SQLITE_STANDARD
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_close(IntPtr db);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_create_function(IntPtr db, byte[] strName, int nArgs, int nType, IntPtr pvUser, SQLiteCallback func, SQLiteCallback fstep, SQLiteFinalCallback ffinal);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_finalize(IntPtr stmt);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_open_v2(byte[] utf8Filename, out IntPtr db, int flags, IntPtr vfs);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
#else
    [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)]
#endif
    internal static extern int sqlite3_open16(string fileName, out IntPtr db);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif












































    internal static extern int sqlite3_reset(IntPtr stmt);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_bind_parameter_name(IntPtr stmt, int index);



|






>
>
>
>
>
>
>
>
>
>
>

>
>


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




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

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

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

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

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

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

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



>

|


|


|


|


|


|


|


|


|
>
>
>
>
>
>


|


|


|


>
|
>
>


|


|


|

>

|


|

>
>








>

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


|


>
>
>
|


>
|
>
>


>
>
>
|


|

>
>

>







<
<
<
<
<
<






<
|
<
<
<
<
<
<
<
<
<
<
<
<
<






|






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







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677






3678
3679
3680
3681
3682
3683

3684













3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace System.Data.SQLite
{
  using System;
  using System.Globalization;

#if TRACE_DETECTION || TRACE_SHARED || TRACE_PRELOAD || TRACE_HANDLE
  using System.Diagnostics;
#endif

  using System.Collections.Generic;
  using System.IO;
  using System.Reflection;

#if !PLATFORM_COMPACTFRAMEWORK
  using System.Security;
#endif

  using System.Runtime.InteropServices;

#if (NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_20 || NET_STANDARD_21) && !PLATFORM_COMPACTFRAMEWORK
  using System.Runtime.Versioning;
#endif

  using System.Text;

#if !PLATFORM_COMPACTFRAMEWORK || COUNT_HANDLE
  using System.Threading;
#endif

  using System.Xml;

  #region Debug Data Static Class
#if COUNT_HANDLE || DEBUG
  /// <summary>
  /// This class encapsulates some tracking data that is used for debugging
  /// and testing purposes.
  /// </summary>
  internal static class DebugData
  {
      #region Private Data
#if DEBUG
      /// <summary>
      /// This lock is used to protect several static fields.
      /// </summary>
      private static readonly object staticSyncRoot = new object();
#endif

      /////////////////////////////////////////////////////////////////////////

      #region Critical Handle Counts (Debug Build Only)
#if COUNT_HANDLE
      //
      // NOTE: These counts represent the total number of outstanding
      //       (non-disposed) CriticalHandle derived object instances
      //       created by this library and are primarily for use by
      //       the test suite.  These counts are incremented by the
      //       associated constructors and are decremented upon the
      //       successful completion of the associated ReleaseHandle
      //       methods.
      //
      internal static int connectionCount;
      internal static int statementCount;
      internal static int backupCount;
      internal static int blobCount;
#endif
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Settings Read Counts (Debug Build Only)
#if DEBUG
      /// <summary>
      /// This dictionary stores the read counts for the runtime configuration
      /// settings.  This information is only recorded when compiled in the
      /// "Debug" build configuration.
      /// </summary>
      private static Dictionary<string, int> settingReadCounts;

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// This dictionary stores the read counts for the runtime configuration
      /// settings via the XML configuration file.  This information is only
      /// recorded when compiled in the "Debug" build configuration.
      /// </summary>
      private static Dictionary<string, int> settingFileReadCounts;
#endif
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Other Counts (Debug Build Only)
#if DEBUG
      /// <summary>
      /// This dictionary stores miscellaneous counts used for debugging
      /// purposes.  This information is only recorded when compiled in the
      /// "Debug" build configuration.
      /// </summary>
      private static Dictionary<string, int> otherCounts;
#endif
      #endregion
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Public Methods
#if DEBUG
      /// <summary>
      /// Creates dictionaries used to store the read counts for each of
      /// the runtime configuration settings.  These numbers are used for
      /// debugging and testing purposes only.
      /// </summary>
      public static void Initialize()
      {
          lock (staticSyncRoot)
          {
              //
              // NOTE: Create the dictionaries of statistics that will
              //       contain the number of times each setting value
              //       has been read.
              //
              if (settingReadCounts == null)
                  settingReadCounts = new Dictionary<string, int>();

              if (settingFileReadCounts == null)
                  settingFileReadCounts = new Dictionary<string, int>();

              if (otherCounts == null)
                  otherCounts = new Dictionary<string, int>();
          }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Queries the read counts for the runtime configuration settings.
      /// These numbers are used for debugging and testing purposes only.
      /// </summary>
      /// <param name="viaFile">
      /// Non-zero if the specified settings were read from the XML
      /// configuration file.
      /// </param>
      /// <returns>
      /// A copy of the statistics for the specified runtime configuration
      /// settings -OR- null if they are not available.
      /// </returns>
      public static object GetSettingReadCounts(
          bool viaFile
          )
      {
          lock (staticSyncRoot)
          {
              if (viaFile)
              {
                  if (settingFileReadCounts == null)
                      return null;

                  return new Dictionary<string, int>(settingFileReadCounts);
              }
              else
              {
                  if (settingReadCounts == null)
                      return null;

                  return new Dictionary<string, int>(settingReadCounts);
              }
          }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Clears the read counts for the runtime configuration settings.
      /// These numbers are used for debugging and testing purposes only.
      /// </summary>
      /// <param name="viaFile">
      /// Non-zero if the specified settings were read from the XML
      /// configuration file.
      /// </param>
      public static void ClearSettingReadCounts(
          bool viaFile
          )
      {
          lock (staticSyncRoot)
          {
              if (viaFile)
              {
                  if (settingFileReadCounts != null)
                      settingFileReadCounts.Clear();
              }
              else
              {
                  if (settingReadCounts != null)
                      settingReadCounts.Clear();
              }
          }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Increments the read count for the specified runtime configuration
      /// setting.  These numbers are used for debugging and testing purposes
      /// only.
      /// </summary>
      /// <param name="name">
      /// The name of the setting being read.
      /// </param>
      /// <param name="viaFile">
      /// Non-zero if the specified setting is being read from the XML
      /// configuration file.
      /// </param>
      public static void IncrementSettingReadCount(
          string name,
          bool viaFile
          )
      {
          lock (staticSyncRoot)
          {
              //
              // NOTE: Update statistics for this setting value.
              //
              if (viaFile)
              {
                  if (settingFileReadCounts != null)
                  {
                      int count;

                      if (settingFileReadCounts.TryGetValue(name, out count))
                          settingFileReadCounts[name] = count + 1;
                      else
                          settingFileReadCounts.Add(name, 1);
                  }
              }
              else
              {
                  if (settingReadCounts != null)
                  {
                      int count;

                      if (settingReadCounts.TryGetValue(name, out count))
                          settingReadCounts[name] = count + 1;
                      else
                          settingReadCounts.Add(name, 1);
                  }
              }
          }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Queries the counters.  These numbers are used for debugging and
      /// testing purposes only.
      /// </summary>
      /// <returns>
      /// A copy of the counters -OR- null if they are not available.
      /// </returns>
      public static object GetOtherCounts()
      {
          lock (staticSyncRoot)
          {
              if (otherCounts == null)
                  return null;

              return new Dictionary<string, int>(otherCounts);
          }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Clears the counters.  These numbers are used for debugging and
      /// testing purposes only.
      /// </summary>
      public static void ClearOtherCounts()
      {
          lock (staticSyncRoot)
          {
              if (otherCounts != null)
                  otherCounts.Clear();
          }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Increments the specified counter.
      /// </summary>
      /// <param name="name">
      /// The name of the counter being incremented.
      /// </param>
      public static void IncrementOtherCount(
          string name
          )
      {
          lock (staticSyncRoot)
          {
              if (otherCounts != null)
              {
                  int count;

                  if (otherCounts.TryGetValue(name, out count))
                      otherCounts[name] = count + 1;
                  else
                      otherCounts.Add(name, 1);
              }
          }
      }
#endif
      #endregion
  }
#endif
  #endregion

  /////////////////////////////////////////////////////////////////////////////

  #region Helper Methods Static Class
  /// <summary>
  /// This static class provides some methods that are shared between the
  /// native library pre-loader and other classes.
  /// </summary>
  internal static class HelperMethods
  {
      #region Private Constants
      private const string DisplayNullObject = "<nullObject>";
      private const string DisplayEmptyString = "<emptyString>";
      private const string DisplayStringFormat = "\"{0}\"";

      /////////////////////////////////////////////////////////////////////////

      private const string DisplayNullArray = "<nullArray>";
      private const string DisplayEmptyArray = "<emptyArray>";

      /////////////////////////////////////////////////////////////////////////

      private const char ArrayOpen = '[';
      private const string ElementSeparator = ", ";
      private const char ArrayClose = ']';

      /////////////////////////////////////////////////////////////////////////

      private static readonly char[] SpaceChars = {
          '\t', '\n', '\r', '\v', '\f', ' '
      };
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Private Data
      /// <summary>
      /// This lock is used to protect the static <see cref="isMono" /> and
      /// <see cref="isDotNetCore" /> fields.
      /// </summary>
      private static readonly object staticSyncRoot = new object();

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This type is only present when running on Mono.
      /// </summary>
      private static readonly string MonoRuntimeType = "Mono.Runtime";

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This type is only present when running on .NET Core.
      /// </summary>
      private static readonly string DotNetCoreLibType = "System.CoreLib";

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Keeps track of whether we are running on Mono.  Initially null, it is
      /// set by the <see cref="IsMono" /> method on its first call.  Later, it
      /// is returned verbatim by the <see cref="IsMono" /> method.
      /// </summary>
      private static bool? isMono = null;

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Keeps track of whether we are running on .NET Core.  Initially null,
      /// it is set by the <see cref="IsDotNetCore" /> method on its first
      /// call.  Later, it is returned verbatim by the
      /// <see cref="IsDotNetCore" /> method.
      /// </summary>
      private static bool? isDotNetCore = null;

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Keeps track of whether we successfully invoked the
      /// <see cref="Debugger.Break" /> method.  Initially null, it is set by
      /// the <see cref="MaybeBreakIntoDebugger" /> method on its first call.
      /// </summary>
      private static bool? debuggerBreak = null;
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Private Methods
      /// <summary>
      /// Determines the ID of the current process.  Only used for debugging.
      /// </summary>
      /// <returns>
      /// The ID of the current process -OR- zero if it cannot be determined.
      /// </returns>
      private static int GetProcessId()
      {
          Process process = Process.GetCurrentProcess();

          if (process == null)
              return 0;

          return process.Id;
      }

      ///////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Determines whether or not this assembly is running on Mono.
      /// </summary>
      /// <returns>
      /// Non-zero if this assembly is running on Mono.
      /// </returns>
      private static bool IsMono()
      {
          try
          {
              lock (staticSyncRoot)
              {
                  if (isMono == null)
                      isMono = (Type.GetType(MonoRuntimeType) != null);

                  return (bool)isMono;
              }
          }
          catch
          {
              // do nothing.
          }

          return false;
      }

      ///////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Determines whether or not this assembly is running on .NET Core.
      /// </summary>
      /// <returns>
      /// Non-zero if this assembly is running on .NET Core.
      /// </returns>
      public static bool IsDotNetCore()
      {
          try
          {
              lock (staticSyncRoot)
              {
                  if (isDotNetCore == null)
                  {
                      isDotNetCore = (Type.GetType(
                          DotNetCoreLibType) != null);
                  }

                  return (bool)isDotNetCore;
              }
          }
          catch
          {
              // do nothing.
          }

          return false;
      }
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Internal Methods
      /// <summary>
      /// Resets the cached value for the "PreLoadSQLite_BreakIntoDebugger"
      /// configuration setting.
      /// </summary>
      internal static void ResetBreakIntoDebugger()
      {
          lock (staticSyncRoot)
          {
              debuggerBreak = null;
          }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// If the "PreLoadSQLite_BreakIntoDebugger" configuration setting is
      /// present (e.g. via the environment), give the interactive user an
      /// opportunity to attach a debugger to the current process; otherwise,
      /// do nothing.
      /// </summary>
      internal static void MaybeBreakIntoDebugger()
      {
          lock (staticSyncRoot)
          {
              if (debuggerBreak != null)
                  return;
          }

          if (UnsafeNativeMethods.GetSettingValue(
                "PreLoadSQLite_BreakIntoDebugger", null) != null)
          {
              //
              // NOTE: Attempt to use the Console in order to prompt the
              //       interactive user (if any).  This may fail for any
              //       number of reasons.  Even in those cases, we still
              //       want to issue the actual request to break into the
              //       debugger.
              //
              try
              {
                  Console.WriteLine(StringFormat(
                      CultureInfo.CurrentCulture,
                      "Attach a debugger to process {0} " +
                      "and press any key to continue.",
                      GetProcessId()));

#if PLATFORM_COMPACTFRAMEWORK
                  Console.ReadLine();
#else
                  Console.ReadKey();
#endif
              }
#if !NET_COMPACT_20 && TRACE_SHARED
              catch (Exception e)
#else
              catch (Exception)
#endif
              {
#if !NET_COMPACT_20 && TRACE_SHARED
                  try
                  {
                      Trace.WriteLine(HelperMethods.StringFormat(
                          CultureInfo.CurrentCulture,
                          "Failed to issue debugger prompt, " +
                          "{0} may be unusable: {1}",
                          typeof(Console), e)); /* throw */
                  }
                  catch
                  {
                      // do nothing.
                  }
#endif
              }

              try
              {
                  Debugger.Break();

                  lock (staticSyncRoot)
                  {
                      debuggerBreak = true;
                  }
              }
              catch
              {
                  lock (staticSyncRoot)
                  {
                      debuggerBreak = false;
                  }

                  throw;
              }
          }
          else
          {
              //
              // BUGFIX: There is (almost) no point in checking for the
              //         associated configuration setting repeatedly.
              //         Prevent that here by setting the cached value
              //         to false.
              //
              lock (staticSyncRoot)
              {
                  debuggerBreak = false;
              }
          }
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Determines the ID of the current thread.  Only used for debugging.
      /// </summary>
      /// <returns>
      /// The ID of the current thread -OR- zero if it cannot be determined.
      /// </returns>
      internal static int GetThreadId()
      {
#if !PLATFORM_COMPACTFRAMEWORK
          return AppDomain.GetCurrentThreadId();
#else
          return 0;
#endif
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Determines if the specified flags are present within the flags
      /// associated with the parent connection object.
      /// </summary>
      /// <param name="flags">
      /// The flags associated with the parent connection object.
      /// </param>
      /// <param name="hasFlags">
      /// The flags to check for.
      /// </param>
      /// <returns>
      /// Non-zero if the specified flag or flags were present; otherwise,
      /// zero.
      /// </returns>
      internal static bool HasFlags(
          SQLiteConnectionFlags flags,
          SQLiteConnectionFlags hasFlags
          )
      {
          return ((flags & hasFlags) == hasFlags);
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Determines if preparing a query should be logged.
      /// </summary>
      /// <param name="flags">
      /// The flags associated with the parent connection object.
      /// </param>
      /// <returns>
      /// Non-zero if the query preparation should be logged; otherwise, zero.
      /// </returns>
      internal static bool LogPrepare(
          SQLiteConnectionFlags flags
          )
      {
          return HasFlags(flags, SQLiteConnectionFlags.LogPrepare);
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Determines if pre-parameter binding should be logged.
      /// </summary>
      /// <param name="flags">
      /// The flags associated with the parent connection object.
      /// </param>
      /// <returns>
      /// Non-zero if the pre-parameter binding should be logged; otherwise,
      /// zero.
      /// </returns>
      internal static bool LogPreBind(
          SQLiteConnectionFlags flags
          )
      {
          return HasFlags(flags, SQLiteConnectionFlags.LogPreBind);
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Determines if parameter binding should be logged.
      /// </summary>
      /// <param name="flags">
      /// The flags associated with the parent connection object.
      /// </param>
      /// <returns>
      /// Non-zero if the parameter binding should be logged; otherwise, zero.
      /// </returns>
      internal static bool LogBind(
          SQLiteConnectionFlags flags
          )
      {
          return HasFlags(flags, SQLiteConnectionFlags.LogBind);
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Determines if an exception in a native callback should be logged.
      /// </summary>
      /// <param name="flags">
      /// The flags associated with the parent connection object.
      /// </param>
      /// <returns>
      /// Non-zero if the exception should be logged; otherwise, zero.
      /// </returns>
      internal static bool LogCallbackExceptions(
          SQLiteConnectionFlags flags
          )
      {
          return HasFlags(flags, SQLiteConnectionFlags.LogCallbackException);
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Determines if backup API errors should be logged.
      /// </summary>
      /// <param name="flags">
      /// The flags associated with the parent connection object.
      /// </param>
      /// <returns>
      /// Non-zero if the backup API error should be logged; otherwise, zero.
      /// </returns>
      internal static bool LogBackup(
          SQLiteConnectionFlags flags
          )
      {
          return HasFlags(flags, SQLiteConnectionFlags.LogBackup);
      }

#if INTEROP_VIRTUAL_TABLE
      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Determines if logging for the <see cref="SQLiteModule" /> class is
      /// disabled.
      /// </summary>
      /// <param name="flags">
      /// The flags associated with the parent connection object.
      /// </param>
      /// <returns>
      /// Non-zero if logging for the <see cref="SQLiteModule" /> class is
      /// disabled; otherwise, zero.
      /// </returns>
      internal static bool NoLogModule(
          SQLiteConnectionFlags flags
          )
      {
          return HasFlags(flags, SQLiteConnectionFlags.NoLogModule);
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Determines if <see cref="SQLiteModule" /> errors should be logged.
      /// </summary>
      /// <param name="flags">
      /// The flags associated with the parent connection object.
      /// </param>
      /// <returns>
      /// Non-zero if the <see cref="SQLiteModule" /> error should be logged;
      /// otherwise, zero.
      /// </returns>
      internal static bool LogModuleError(
          SQLiteConnectionFlags flags
          )
      {
          return HasFlags(flags, SQLiteConnectionFlags.LogModuleError);
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Determines if <see cref="SQLiteModule" /> exceptions should be
      /// logged.
      /// </summary>
      /// <param name="flags">
      /// The flags associated with the parent connection object.
      /// </param>
      /// <returns>
      /// Non-zero if the <see cref="SQLiteModule" /> exception should be
      /// logged; otherwise, zero.
      /// </returns>
      internal static bool LogModuleException(
          SQLiteConnectionFlags flags
          )
      {
          return HasFlags(flags, SQLiteConnectionFlags.LogModuleException);
      }
#endif

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Determines if retrying a query should be logged.
      /// </summary>
      /// <param name="flags">
      /// The flags associated with the parent connection object.
      /// </param>
      /// <returns>
      /// Non-zero if the query preparation should be logged; otherwise, zero.
      /// </returns>
      internal static bool LogRetry(
          SQLiteConnectionFlags flags
          )
      {
          return HasFlags(flags, SQLiteConnectionFlags.LogRetry);
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Determines if the current process is running on one of the Windows
      /// [sub-]platforms.
      /// </summary>
      /// <returns>
      /// Non-zero when running on Windows; otherwise, zero.
      /// </returns>
      internal static bool IsWindows()
      {
          PlatformID platformId = Environment.OSVersion.Platform;

          if ((platformId == PlatformID.Win32S) ||
              (platformId == PlatformID.Win32Windows) ||
              (platformId == PlatformID.Win32NT) ||
              (platformId == PlatformID.WinCE))
          {
              return true;
          }

          return false;
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This is a wrapper around the
      /// <see cref="String.Format(IFormatProvider,String,Object[])" /> method.
      /// On Mono, it has to call the method overload without the
      /// <see cref="IFormatProvider" /> parameter, due to a bug in Mono.
      /// </summary>
      /// <param name="provider">
      /// This is used for culture-specific formatting.
      /// </param>
      /// <param name="format">
      /// The format string.
      /// </param>
      /// <param name="args">
      /// An array the objects to format.
      /// </param>
      /// <returns>
      /// The resulting string.
      /// </returns>
      internal static string StringFormat(
          IFormatProvider provider,
          string format,
          params object[] args
          )
      {
          if (IsMono())
              return String.Format(format, args);
          else
              return String.Format(provider, format, args);
      }
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Public Methods
      public static string ToDisplayString(
          object value
          )
      {
          if (value == null)
              return DisplayNullObject;

          string stringValue = value.ToString();

          if (stringValue.Length == 0)
              return DisplayEmptyString;

          if (stringValue.IndexOfAny(SpaceChars) < 0)
              return stringValue;

          return HelperMethods.StringFormat(
              CultureInfo.InvariantCulture, DisplayStringFormat,
              stringValue);
      }

      /////////////////////////////////////////////////////////////////////////

      public static string ToDisplayString(
          Array array
          )
      {
          if (array == null)
              return DisplayNullArray;

          if (array.Length == 0)
              return DisplayEmptyArray;

          StringBuilder result = new StringBuilder();

          foreach (object value in array)
          {
              if (result.Length > 0)
                  result.Append(ElementSeparator);

              result.Append(ToDisplayString(value));
          }

          if (result.Length > 0)
          {
#if PLATFORM_COMPACTFRAMEWORK
              result.Insert(0, ArrayOpen.ToString());
#else
              result.Insert(0, ArrayOpen);
#endif

              result.Append(ArrayClose);
          }

          return result.ToString();
      }
      #endregion
  }
  #endregion

  /////////////////////////////////////////////////////////////////////////////

  #region Native Library Helper Class
  /// <summary>
  /// This static class provides a thin wrapper around the native library
  /// loading features of the underlying platform.
  /// </summary>
  internal static class NativeLibraryHelper
  {
      #region Private Delegates
      /// <summary>
      /// This delegate is used to wrap the concept of loading a native
      /// library, based on a file name, and returning the loaded module
      /// handle.
      /// </summary>
      /// <param name="fileName">
      /// The file name of the native library to load.
      /// </param>
      /// <returns>
      /// The native module handle upon success -OR- IntPtr.Zero on failure.
      /// </returns>
      private delegate IntPtr LoadLibraryCallback(
          string fileName
      );

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// This delegate is used to wrap the concept of querying the machine
      /// name of the current process.
      /// </summary>
      /// <returns>
      /// The machine name for the current process -OR- null on failure.
      /// </returns>
      private delegate string GetMachineCallback();
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Private Methods
      /// <summary>
      /// Attempts to load the specified native library file using the Win32
      /// API.
      /// </summary>
      /// <param name="fileName">
      /// The file name of the native library to load.
      /// </param>
      /// <returns>
      /// The native module handle upon success -OR- IntPtr.Zero on failure.
      /// </returns>
      private static IntPtr LoadLibraryWin32(
          string fileName
          )
      {
          return UnsafeNativeMethodsWin32.LoadLibrary(fileName);
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Attempts to determine the machine name of the current process using
      /// the Win32 API.
      /// </summary>
      /// <returns>
      /// The machine name for the current process -OR- null on failure.
      /// </returns>
      private static string GetMachineWin32()
      {
          //
          // NOTE: When running on Windows, attempt to use the native Win32
          //       API function (via P/Invoke) that can provide us with the
          //       processor architecture.
          //
          try
          {
              UnsafeNativeMethodsWin32.SYSTEM_INFO systemInfo;

              //
              // NOTE: Query the system information via P/Invoke, thus
              //       filling the structure.
              //
              UnsafeNativeMethodsWin32.GetSystemInfo(out systemInfo);

              //
              // NOTE: Return the processor architecture value as a string.
              //
              return systemInfo.wProcessorArchitecture.ToString();
          }
          catch
          {
              // do nothing.
          }

          return null;
      }

      /////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
      /// <summary>
      /// Attempts to load the specified native library file using the POSIX
      /// API.
      /// </summary>
      /// <param name="fileName">
      /// The file name of the native library to load.
      /// </param>
      /// <returns>
      /// The native module handle upon success -OR- IntPtr.Zero on failure.
      /// </returns>
      private static IntPtr LoadLibraryPosix(
          string fileName
          )
      {
          return UnsafeNativeMethodsPosix.dlopen(
              fileName, UnsafeNativeMethodsPosix.RTLD_DEFAULT);
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Attempts to determine the machine name of the current process using
      /// the POSIX API.
      /// </summary>
      /// <returns>
      /// The machine name for the current process -OR- null on failure.
      /// </returns>
      private static string GetMachinePosix()
      {
          //
          // NOTE: When running on POSIX (non-Windows), attempt to query the
          //       machine from the operating system via uname().
          //
          try
          {
              UnsafeNativeMethodsPosix.utsname utsName = null;

              if (UnsafeNativeMethodsPosix.GetOsVersionInfo(ref utsName) &&
                  (utsName != null))
              {
                  return utsName.machine;
              }
          }
          catch
          {
              // do nothing.
          }

          return null;
      }
#endif
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Public Methods
      /// <summary>
      /// Attempts to load the specified native library file.
      /// </summary>
      /// <param name="fileName">
      /// The file name of the native library to load.
      /// </param>
      /// <returns>
      /// The native module handle upon success -OR- IntPtr.Zero on failure.
      /// </returns>
      public static IntPtr LoadLibrary(
          string fileName
          )
      {
          LoadLibraryCallback callback = LoadLibraryWin32;

#if !PLATFORM_COMPACTFRAMEWORK
          if (!HelperMethods.IsWindows())
              callback = LoadLibraryPosix;
#endif

          return callback(fileName);
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Attempts to determine the machine name of the current process.
      /// </summary>
      /// <returns>
      /// The machine name for the current process -OR- null on failure.
      /// </returns>
      public static string GetMachine()
      {
          GetMachineCallback callback = GetMachineWin32;

#if !PLATFORM_COMPACTFRAMEWORK
          if (!HelperMethods.IsWindows())
              callback = GetMachinePosix;
#endif

          return callback();
      }
      #endregion
  }
  #endregion

  /////////////////////////////////////////////////////////////////////////////

  #region Unmanaged Interop Methods Static Class (POSIX)
#if !PLATFORM_COMPACTFRAMEWORK
  /// <summary>
  /// This class declares P/Invoke methods to call native POSIX APIs.
  /// </summary>
  [SuppressUnmanagedCodeSecurity]
  internal static class UnsafeNativeMethodsPosix
  {
      /// <summary>
      /// This structure is used when running on POSIX operating systems
      /// to store information about the current machine, including the
      /// human readable name of the operating system as well as that of
      /// the underlying hardware.
      /// </summary>
      internal sealed class utsname
      {
          public string sysname;  /* Name of this implementation of
                                   * the operating system. */
          public string nodename; /* Name of this node within the
                                   * communications network to which
                                   * this node is attached, if any. */
          public string release;  /* Current release level of this
                                   * implementation. */
          public string version;  /* Current version level of this
                                   * release. */
          public string machine;  /* Name of the hardware type on
                                   * which the system is running. */
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// This structure is passed directly to the P/Invoke method to
      /// obtain the information about the current machine, including
      /// the human readable name of the operating system as well as
      /// that of the underlying hardware.
      /// </summary>
      [StructLayout(LayoutKind.Sequential)]
      private struct utsname_interop
      {
          //
          // NOTE: The following string fields should be present in
          //       this buffer, all of which will be zero-terminated:
          //
          //                      sysname
          //                      nodename
          //                      release
          //                      version
          //                      machine
          //
          [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4096)]
          public byte[] buffer;
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// This is the P/Invoke method that wraps the native Unix uname
      /// function.  See the POSIX documentation for full details on what it
      /// does.
      /// </summary>
      /// <param name="name">
      /// Structure containing a preallocated byte buffer to fill with the
      /// requested information.
      /// </param>
      /// <returns>
      /// Zero for success and less than zero upon failure.
      /// </returns>
#if NET_STANDARD_20 || NET_STANDARD_21
      [DllImport("libc",
#else
      [DllImport("__Internal",
#endif
          CallingConvention = CallingConvention.Cdecl)]
      private static extern int uname(out utsname_interop name);

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This is the P/Invoke method that wraps the native Unix dlopen
      /// function.  See the POSIX documentation for full details on what it
      /// does.
      /// </summary>
      /// <param name="fileName">
      /// The name of the executable library.
      /// </param>
      /// <param name="mode">
      /// This must be a combination of the individual bit flags RTLD_LAZY,
      /// RTLD_NOW, RTLD_GLOBAL, and/or RTLD_LOCAL.
      /// </param>
      /// <returns>
      /// The native module handle upon success -OR- IntPtr.Zero on failure.
      /// </returns>
#if NET_STANDARD_20 || NET_STANDARD_21
      [DllImport("libdl",
#else
      [DllImport("__Internal",
#endif
          EntryPoint = "dlopen",
          CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi,
          BestFitMapping = false, ThrowOnUnmappableChar = true,
          SetLastError = true)]
      internal static extern IntPtr dlopen(string fileName, int mode);

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This is the P/Invoke method that wraps the native Unix dlclose
      /// function.  See the POSIX documentation for full details on what it
      /// does.
      /// </summary>
      /// <param name="module">
      /// The handle to the loaded native library.
      /// </param>
      /// <returns>
      /// Zero upon success -OR- non-zero on failure.
      /// </returns>
#if NET_STANDARD_20 || NET_STANDARD_21
      [DllImport("libdl",
#else
      [DllImport("__Internal",
#endif
          EntryPoint = "dlclose",
          CallingConvention = CallingConvention.Cdecl, SetLastError = true)]
      internal static extern int dlclose(IntPtr module);

      /////////////////////////////////////////////////////////////////////////

      #region Private Constants
      /// <summary>
      /// For use with dlopen(), bind function calls lazily.
      /// </summary>
      internal const int RTLD_LAZY = 0x1;

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// For use with dlopen(), bind function calls immediately.
      /// </summary>
      internal const int RTLD_NOW = 0x2;

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// For use with dlopen(), make symbols globally available.
      /// </summary>
      internal const int RTLD_GLOBAL = 0x100;

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// For use with dlopen(), opposite of RTLD_GLOBAL, and the default.
      /// </summary>
      internal const int RTLD_LOCAL = 0x000;

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// For use with dlopen(), the defaults used by this class.
      /// </summary>
      internal const int RTLD_DEFAULT = RTLD_NOW | RTLD_GLOBAL;
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Private Data
      /// <summary>
      /// These are the characters used to separate the string fields within
      /// the raw buffer returned by the <see cref="uname" /> P/Invoke method.
      /// </summary>
      private static readonly char[] utsNameSeparators = { '\0' };
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Private Methods
      /// <summary>
      /// This method is a wrapper around the <see cref="uname" /> P/Invoke
      /// method that extracts and returns the human readable strings from
      /// the raw buffer.
      /// </summary>
      /// <param name="utsName">
      /// This structure, which contains strings, will be filled based on the
      /// data placed in the raw buffer returned by the <see cref="uname" />
      /// P/Invoke method.
      /// </param>
      /// <returns>
      /// Non-zero upon success; otherwise, zero.
      /// </returns>
      internal static bool GetOsVersionInfo(
          ref utsname utsName
          )
      {
          try
          {
              utsname_interop utfNameInterop;

              if (uname(out utfNameInterop) < 0)
                  return false;

              if (utfNameInterop.buffer == null)
                  return false;

              string bufferAsString = Encoding.UTF8.GetString(
                  utfNameInterop.buffer);

              if ((bufferAsString == null) || (utsNameSeparators == null))
                  return false;

              bufferAsString = bufferAsString.Trim(utsNameSeparators);

              string[] parts = bufferAsString.Split(
                  utsNameSeparators, StringSplitOptions.RemoveEmptyEntries);

              if (parts == null)
                  return false;

              utsname localUtsName = new utsname();

              if (parts.Length >= 1)
                  localUtsName.sysname = parts[0];

              if (parts.Length >= 2)
                  localUtsName.nodename = parts[1];

              if (parts.Length >= 3)
                  localUtsName.release = parts[2];

              if (parts.Length >= 4)
                  localUtsName.version = parts[3];

              if (parts.Length >= 5)
                  localUtsName.machine = parts[4];

              utsName = localUtsName;
              return true;
          }
          catch
          {
              // do nothing.
          }

          return false;
      }
      #endregion
  }
#endif
  #endregion

  /////////////////////////////////////////////////////////////////////////////

  #region Unmanaged Interop Methods Static Class (Win32)
  /// <summary>
  /// This class declares P/Invoke methods to call native Win32 APIs.
  /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
  [SuppressUnmanagedCodeSecurity]
#endif
  internal static class UnsafeNativeMethodsWin32
  {
      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This is the P/Invoke method that wraps the native Win32 LoadLibrary
      /// function.  See the MSDN documentation for full details on what it
      /// does.
      /// </summary>
      /// <param name="fileName">
      /// The name of the executable library.
      /// </param>
      /// <returns>
      /// The native module handle upon success -OR- IntPtr.Zero on failure.
      /// </returns>
#if !PLATFORM_COMPACTFRAMEWORK
      [DllImport("kernel32",
#else
      [DllImport("coredll",
#endif
          CallingConvention = CallingConvention.Winapi, CharSet = CharSet.Auto,
#if !PLATFORM_COMPACTFRAMEWORK
          BestFitMapping = false, ThrowOnUnmappableChar = true,
#endif
          SetLastError = true)]
      internal static extern IntPtr LoadLibrary(string fileName);

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// This is the P/Invoke method that wraps the native Win32 GetSystemInfo
      /// function.  See the MSDN documentation for full details on what it
      /// does.
      /// </summary>
      /// <param name="systemInfo">
      /// The system information structure to be filled in by the function.
      /// </param>
#if !PLATFORM_COMPACTFRAMEWORK
      [DllImport("kernel32",
#else
      [DllImport("coredll",
#endif
          CallingConvention = CallingConvention.Winapi)]
      internal static extern void GetSystemInfo(out SYSTEM_INFO systemInfo);

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This enumeration contains the possible values for the processor
      /// architecture field of the system information structure.
      /// </summary>
      internal enum ProcessorArchitecture : ushort /* COMPAT: Win32. */
      {
          Intel = 0,
          MIPS = 1,
          Alpha = 2,
          PowerPC = 3,
          SHx = 4,
          ARM = 5,
          IA64 = 6,
          Alpha64 = 7,
          MSIL = 8,
          AMD64 = 9,
          IA32_on_Win64 = 10,
          Neutral = 11,
          ARM64 = 12,
          Unknown = 0xFFFF
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This structure contains information about the current computer. This
      /// includes the processor type, page size, memory addresses, etc.
      /// </summary>
      [StructLayout(LayoutKind.Sequential)]
      internal struct SYSTEM_INFO
      {
          public ProcessorArchitecture wProcessorArchitecture;
          public ushort wReserved; /* NOT USED */
          public uint dwPageSize; /* NOT USED */
          public IntPtr lpMinimumApplicationAddress; /* NOT USED */
          public IntPtr lpMaximumApplicationAddress; /* NOT USED */
#if PLATFORM_COMPACTFRAMEWORK
          public uint dwActiveProcessorMask; /* NOT USED */
#else
          public IntPtr dwActiveProcessorMask; /* NOT USED */
#endif
          public uint dwNumberOfProcessors; /* NOT USED */
          public uint dwProcessorType; /* NOT USED */
          public uint dwAllocationGranularity; /* NOT USED */
          public ushort wProcessorLevel; /* NOT USED */
          public ushort wProcessorRevision; /* NOT USED */
      }
  }
  #endregion

  /////////////////////////////////////////////////////////////////////////////

  #region Unmanaged Interop Methods Static Class (SQLite)
  /// <summary>
  /// This class declares P/Invoke methods to call native SQLite APIs.
  /// </summary>
#if !PLATFORM_COMPACTFRAMEWORK
  [SuppressUnmanagedCodeSecurity]
#endif
  internal static class UnsafeNativeMethods
  {
      public const string ExceptionMessageFormat =
          "Caught exception in \"{0}\" method: {1}";

      /////////////////////////////////////////////////////////////////////////

      #region Shared Native SQLite Library Pre-Loading Code
      #region Private Constants
      /// <summary>
      /// The file extension used for dynamic link libraries.
      /// </summary>
      private static readonly string DllFileExtension = ".dll";

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// The primary file extension used for the XML configuration file.
      /// </summary>
      private static readonly string ConfigFileExtension = ".config";

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// The secondary file extension used for the XML configuration file.
      /// </summary>
      private static readonly string AltConfigFileExtension = ".altconfig";

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This is the name of the primary XML configuration file specific
      /// to the System.Data.SQLite assembly.
      /// </summary>
      private static readonly string XmlConfigFileName =
          typeof(UnsafeNativeMethods).Namespace + DllFileExtension +
          ConfigFileExtension;

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This is the name of the secondary XML configuration file specific
      /// to the System.Data.SQLite assembly.
      /// </summary>
      private static readonly string XmlAltConfigFileName =
          typeof(UnsafeNativeMethods).Namespace + DllFileExtension +
          AltConfigFileExtension;

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This is the XML configuratrion file token that will be replaced with
      /// the qualified path to the directory containing the XML configuration
      /// file.
      /// </summary>
      private static readonly string XmlConfigDirectoryToken =
          "%PreLoadSQLite_XmlConfigDirectory%";
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Private Constants (Desktop Framework Only)
#if !PLATFORM_COMPACTFRAMEWORK
      /// <summary>
      /// This is the environment variable token that will be replaced with
      /// the qualified path to the directory containing this assembly.
      /// </summary>
      private static readonly string AssemblyDirectoryToken =
          "%PreLoadSQLite_AssemblyDirectory%";

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This is the environment variable token that will be replaced with an
      /// abbreviation of the target framework attribute value associated with
      /// this assembly.
      /// </summary>
      private static readonly string TargetFrameworkToken =
          "%PreLoadSQLite_TargetFramework%";
#endif
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Private Data
      /// <summary>
      /// This lock is used to protect the static _SQLiteNativeModuleFileName,
      /// _SQLiteNativeModuleHandle, and processorArchitecturePlatforms fields.
      /// </summary>
      private static readonly object staticSyncRoot = new object();

      /////////////////////////////////////////////////////////////////////////
#if !PLATFORM_COMPACTFRAMEWORK
      /// <summary>
      /// This dictionary stores the mappings between target framework names
      /// and their associated (NuGet) abbreviations.  These mappings are only
      /// used by the <see cref="AbbreviateTargetFramework" /> method.
      /// </summary>
      private static Dictionary<string, string> targetFrameworkAbbreviations;
#endif

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This dictionary stores the mappings between processor architecture
      /// names and platform names.  These mappings are now used for two
      /// purposes.  First, they are used to determine if the assembly code
      /// base should be used instead of the location, based upon whether one
      /// or more of the named sub-directories exist within the assembly code
      /// base.  Second, they are used to assist in loading the appropriate
      /// SQLite interop assembly into the current process.
      /// </summary>
      private static Dictionary<string, string> processorArchitecturePlatforms;

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This is the cached return value from the
      /// <see cref="GetAssemblyDirectory" /> method -OR- null if that method
      /// has never returned a valid value.
      /// </summary>
      private static string cachedAssemblyDirectory;

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// When this field is non-zero, it indicates the
      /// <see cref="GetAssemblyDirectory" /> method was not able to locate a
      /// suitable assembly directory.  The
      /// <see cref="GetCachedAssemblyDirectory" /> method will check this
      /// field and skips calls into the <see cref="GetAssemblyDirectory" />
      /// method whenever it is non-zero.
      /// </summary>
      private static bool noAssemblyDirectory;

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// This is the cached return value from the
      /// <see cref="GetXmlConfigFileName" /> method -OR- null if that method
      /// has never returned a valid value.
      /// </summary>
      private static string cachedXmlConfigFileName;

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// When this field is non-zero, it indicates the
      /// <see cref="GetXmlConfigFileName" /> method was not able to locate a
      /// suitable XML configuration file name.  The
      /// <see cref="GetCachedXmlConfigFileName" /> method will check this
      /// field and skips calls into the <see cref="GetXmlConfigFileName" />
      /// method whenever it is non-zero.
      /// </summary>
      private static bool noXmlConfigFileName;
      #endregion

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// For now, this method simply calls the Initialize method.
      /// </summary>
      static UnsafeNativeMethods()
      {
          Initialize();
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Attempts to initialize this class by pre-loading the native SQLite
      /// library for the processor architecture of the current process.
      /// </summary>
      internal static void Initialize()
      {
#if SQLITE_STANDARD || USE_INTEROP_DLL || PLATFORM_COMPACTFRAMEWORK
#if PRELOAD_NATIVE_LIBRARY
          //
          // NOTE: If this method has already fully completed at least once
          //       (and pre-loaded a native library), there is no reason to
          //       continue.
          //
          lock (staticSyncRoot)
          {
              if (_SQLiteNativeModuleHandle != IntPtr.Zero)
                  return;
          }
#endif
#endif

          /////////////////////////////////////////////////////////////////////

          #region Debug Build Only
#if DEBUG
          //
          // NOTE: Create the lists of statistics that will contain
          //       various counts used in debugging, including the
          //       number of times each setting value has been read.
          //
          DebugData.Initialize();
#endif
          #endregion

          /////////////////////////////////////////////////////////////////////

          //
          // NOTE: Check if a debugger needs to be attached before doing any
          //       real work.
          //
          HelperMethods.MaybeBreakIntoDebugger();

#if SQLITE_STANDARD || USE_INTEROP_DLL || PLATFORM_COMPACTFRAMEWORK
#if PRELOAD_NATIVE_LIBRARY
          //
          // NOTE: If the "No_PreLoadSQLite" environment variable is set (to
          //       anything), skip all of our special code and simply return.
          //
          if (GetSettingValue("No_PreLoadSQLite", null) != null)
              return;
#endif
#endif

          /////////////////////////////////////////////////////////////////////

          lock (staticSyncRoot)
          {
#if !PLATFORM_COMPACTFRAMEWORK
              //
              // TODO: Make sure to keep these lists updated when the
              //       target framework names (or their abbreviations)
              //       -OR- the processor architecture names (or their
              //       platform names) change.
              //
              if (targetFrameworkAbbreviations == null)
              {
                  targetFrameworkAbbreviations =
                      new Dictionary<string, string>(
                          StringComparer.OrdinalIgnoreCase);

                  targetFrameworkAbbreviations.Add(
                      ".NETFramework,Version=v2.0", "net20");

                  targetFrameworkAbbreviations.Add(
                      ".NETFramework,Version=v3.5", "net35");

                  targetFrameworkAbbreviations.Add(
                      ".NETFramework,Version=v4.0", "net40");

                  targetFrameworkAbbreviations.Add(
                      ".NETFramework,Version=v4.5", "net45");

                  targetFrameworkAbbreviations.Add(
                      ".NETFramework,Version=v4.5.1", "net451");

                  targetFrameworkAbbreviations.Add(
                      ".NETFramework,Version=v4.5.2", "net452");

                  targetFrameworkAbbreviations.Add(
                      ".NETFramework,Version=v4.6", "net46");

                  targetFrameworkAbbreviations.Add(
                      ".NETFramework,Version=v4.6.1", "net461");

                  targetFrameworkAbbreviations.Add(
                      ".NETFramework,Version=v4.6.2", "net462");

                  targetFrameworkAbbreviations.Add(
                      ".NETFramework,Version=v4.7", "net47");

                  targetFrameworkAbbreviations.Add(
                      ".NETFramework,Version=v4.7.1", "net471");

                  targetFrameworkAbbreviations.Add(
                      ".NETFramework,Version=v4.7.2", "net472");

                  targetFrameworkAbbreviations.Add(
                      ".NETFramework,Version=v4.8", "net48");

                  targetFrameworkAbbreviations.Add(
                      ".NETStandard,Version=v2.0", "netstandard2.0");

                  targetFrameworkAbbreviations.Add(
                      ".NETStandard,Version=v2.1", "netstandard2.1");
              }
#endif

              /////////////////////////////////////////////////////////////////

              if (processorArchitecturePlatforms == null)
              {
                  //
                  // NOTE: Create the map of processor architecture names
                  //       to platform names using a case-insensitive string
                  //       comparer.
                  //
                  processorArchitecturePlatforms =
                      new Dictionary<string, string>(
                          StringComparer.OrdinalIgnoreCase);

                  //
                  // NOTE: Setup the list of platform names associated with
                  //       the supported processor architectures.
                  //
                  processorArchitecturePlatforms.Add("x86", "Win32");
                  processorArchitecturePlatforms.Add("x86_64", "x64");
                  processorArchitecturePlatforms.Add("AMD64", "x64");
                  processorArchitecturePlatforms.Add("IA64", "Itanium");
                  processorArchitecturePlatforms.Add("ARM", "WinCE");
              }

              /////////////////////////////////////////////////////////////////

#if SQLITE_STANDARD || USE_INTEROP_DLL || PLATFORM_COMPACTFRAMEWORK
#if PRELOAD_NATIVE_LIBRARY
              //
              // BUGBUG: What about other application domains?
              //
              if (_SQLiteNativeModuleHandle == IntPtr.Zero)
              {
                  string baseDirectory = null;
                  string processorArchitecture = null;
                  bool allowBaseDirectoryOnly = false;

                  /* IGNORED */
                  SearchForDirectory(
                      ref baseDirectory, ref processorArchitecture,
                      ref allowBaseDirectoryOnly);

                  //
                  // NOTE: Attempt to pre-load the SQLite core library (or
                  //       interop assembly) and store both the file name
                  //       and native module handle for later usage.
                  //
                  /* IGNORED */
                  PreLoadSQLiteDll(baseDirectory,
                      processorArchitecture, allowBaseDirectoryOnly,
                      ref _SQLiteNativeModuleFileName,
                      ref _SQLiteNativeModuleHandle);
              }
#endif
#endif
          }
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Combines two path strings.
      /// </summary>
      /// <param name="path1">
      /// The first path -OR- null.
      /// </param>
      /// <param name="path2">
      /// The second path -OR- null.
      /// </param>
      /// <returns>
      /// The combined path string -OR- null if both of the original path
      /// strings are null.
      /// </returns>
      private static string MaybeCombinePath(
          string path1,
          string path2
          )
      {
          if (path1 != null)
          {
              if (path2 != null)
                  return Path.Combine(path1, path2);
              else
                  return path1;
          }
          else
          {
              if (path2 != null)
                  return path2;
              else
                  return null;
          }
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Resets the cached XML configuration file name value, thus forcing the
      /// next call to <see cref="GetCachedXmlConfigFileName" /> method to rely
      /// upon the <see cref="GetXmlConfigFileName" /> method to fetch the
      /// XML configuration file name.
      /// </summary>
      private static void ResetCachedXmlConfigFileName()
      {
          #region Debug Build Only
#if DEBUG
          DebugData.IncrementOtherCount("Method_ResetCachedXmlConfigFileName");
#endif
          #endregion

          lock (staticSyncRoot)
          {
              cachedXmlConfigFileName = null;
              noXmlConfigFileName = false;
          }
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Queries and returns the cached XML configuration file name for the
      /// assembly containing the managed System.Data.SQLite components, if
      /// available.  If the cached XML configuration file name value is not
      /// available, the <see cref="GetXmlConfigFileName" /> method will
      /// be used to obtain the XML configuration file name.
      /// </summary>
      /// <returns>
      /// The XML configuration file name -OR- null if it cannot be determined
      /// or does not exist.
      /// </returns>
      private static string GetCachedXmlConfigFileName()
      {
          #region Debug Build Only
#if DEBUG
          DebugData.IncrementOtherCount("Method_GetCachedXmlConfigFileName");
#endif
          #endregion

          lock (staticSyncRoot)
          {
              if (cachedXmlConfigFileName != null)
                  return cachedXmlConfigFileName;

              if (noXmlConfigFileName)
                  return null;
          }

          return GetXmlConfigFileName();
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Queries and returns the XML configuration file name for the assembly
      /// containing the managed System.Data.SQLite components.
      /// </summary>
      /// <returns>
      /// The XML configuration file name -OR- null if it cannot be determined
      /// or does not exist.
      /// </returns>
      private static string GetXmlConfigFileName()
      {
          #region Debug Build Only
#if DEBUG
          DebugData.IncrementOtherCount("Method_GetXmlConfigFileName");
#endif
          #endregion

          string directory;
          string fileName;

#if !PLATFORM_COMPACTFRAMEWORK
          directory = AppDomain.CurrentDomain.BaseDirectory;
          fileName = MaybeCombinePath(directory, XmlConfigFileName);

          if (File.Exists(fileName))
          {
              lock (staticSyncRoot)
              {
                  cachedXmlConfigFileName = fileName;
              }

              return fileName;
          }

          fileName = MaybeCombinePath(directory, XmlAltConfigFileName);

          if (File.Exists(fileName))
          {
              lock (staticSyncRoot)
              {
                  cachedXmlConfigFileName = fileName;
              }

              return fileName;
          }
#endif

          directory = GetCachedAssemblyDirectory();
          fileName = MaybeCombinePath(directory, XmlConfigFileName);

          if (File.Exists(fileName))
          {
              lock (staticSyncRoot)
              {
                  cachedXmlConfigFileName = fileName;
              }

              return fileName;
          }

          fileName = MaybeCombinePath(directory, XmlAltConfigFileName);

          if (File.Exists(fileName))
          {
              lock (staticSyncRoot)
              {
                  cachedXmlConfigFileName = fileName;
              }

              return fileName;
          }

          lock (staticSyncRoot)
          {
              noXmlConfigFileName = true;
          }

          return null;
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// If necessary, replaces all supported XML configuration file tokens
      /// with their associated values.
      /// </summary>
      /// <param name="fileName">
      /// The name of the XML configuration file being read.
      /// </param>
      /// <param name="value">
      /// A setting value read from the XML configuration file.
      /// </param>
      /// <returns>
      /// The value of the <paramref name="value" /> will all supported XML
      /// configuration file tokens replaced.  No return value is reserved
      /// to indicate an error.  This method cannot fail.
      /// </returns>
      private static string ReplaceXmlConfigFileTokens(
          string fileName,
          string value
          )
      {
          if (!String.IsNullOrEmpty(value))
          {
              if (!String.IsNullOrEmpty(fileName))
              {
                  if (value.IndexOf(XmlConfigDirectoryToken) != -1)
                  {
                      try
                      {
                          string directory = Path.GetDirectoryName(fileName);

                          if (!String.IsNullOrEmpty(directory))
                          {
                              value = value.Replace(
                                  XmlConfigDirectoryToken, directory);
                          }
                      }
#if !NET_COMPACT_20 && TRACE_SHARED
                      catch (Exception e)
#else
                      catch (Exception)
#endif
                      {
#if !NET_COMPACT_20 && TRACE_SHARED
                          try
                          {
                              Trace.WriteLine(HelperMethods.StringFormat(
                                  CultureInfo.CurrentCulture, "Native " +
                                  "library pre-loader failed to replace XML " +
                                  "configuration file \"{0}\" tokens: {1}",
                                  fileName, e)); /* throw */
                          }
                          catch
                          {
                              // do nothing.
                          }
#endif
                      }
                  }
              }
          }

          return value;
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Queries and returns the value of the specified setting, using the
      /// specified XML configuration file.
      /// </summary>
      /// <param name="fileName">
      /// The name of the XML configuration file to read.
      /// </param>
      /// <param name="name">
      /// The name of the setting.
      /// </param>
      /// <param name="default">
      /// The value to be returned if the setting has not been set explicitly
      /// or cannot be determined.
      /// </param>
      /// <param name="expand">
      /// Non-zero to expand any environment variable references contained in
      /// the setting value to be returned.  This has no effect on the .NET
      /// Compact Framework.
      /// </param>
      /// <param name="tokens">
      /// Non-zero to replace any special token references contained in the
      /// setting value to be returned.  This has no effect on the .NET Compact
      /// Framework.
      /// </param>
      /// <returns>
      /// The value of the setting -OR- the default value specified by
      /// <paramref name="default" /> if it has not been set explicitly or
      /// cannot be determined.
      /// </returns>
      private static string GetSettingValueViaXmlConfigFile(
          string fileName, /* in */
          string name,     /* in */
          string @default, /* in */
          bool expand,     /* in */
          bool tokens      /* in */
          )
      {
          try
          {
              if ((fileName == null) || (name == null))
                  return @default;

              XmlDocument document = new XmlDocument();

              document.Load(fileName); /* throw */

              XmlElement element = document.SelectSingleNode(
                  HelperMethods.StringFormat(CultureInfo.InvariantCulture,
                  "/configuration/appSettings/add[@key='{0}']", name)) as
                  XmlElement; /* throw */

              if (element != null)
              {
                  string value = null;

                  if (element.HasAttribute("value"))
                      value = element.GetAttribute("value");

                  if (!String.IsNullOrEmpty(value))
                  {
#if !PLATFORM_COMPACTFRAMEWORK
                      if (expand)
                          value = Environment.ExpandEnvironmentVariables(value);

                      if (tokens)
                          value = ReplaceEnvironmentVariableTokens(value);
#endif

                      if (tokens)
                          value = ReplaceXmlConfigFileTokens(fileName, value);
                  }

                  if (value != null)
                      return value;
              }
          }
#if !NET_COMPACT_20 && TRACE_SHARED
          catch (Exception e)
#else
          catch (Exception)
#endif
          {
#if !NET_COMPACT_20 && TRACE_SHARED
              try
              {
                  Trace.WriteLine(HelperMethods.StringFormat(
                      CultureInfo.CurrentCulture, "Native library " +
                      "pre-loader failed to get setting \"{0}\" value " +
                      "from XML configuration file \"{1}\": {2}", name,
                      fileName, e)); /* throw */
              }
              catch
              {
                  // do nothing.
              }
#endif
          }

          return @default;
      }

      /////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
      /// <summary>
      /// Attempts to determine the target framework attribute value that is
      /// associated with the specified managed assembly, if applicable.
      /// </summary>
      /// <param name="assembly">
      /// The managed assembly to read the target framework attribute value
      /// from.
      /// </param>
      /// <returns>
      /// The value of the target framework attribute value for the specified
      /// managed assembly -OR- null if it cannot be determined.  If this
      /// assembly was compiled with a version of the .NET Framework prior to
      /// version 4.0, the value returned MAY reflect that version of the .NET
      /// Framework instead of the one associated with the specified managed
      /// assembly.
      /// </returns>
      private static string GetAssemblyTargetFramework(
          Assembly assembly
          )
      {
          if (assembly != null)
          {
#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_20 || NET_STANDARD_21
              try
              {
                  if (assembly.IsDefined(
                          typeof(TargetFrameworkAttribute), false))
                  {
                      TargetFrameworkAttribute targetFramework =
                          (TargetFrameworkAttribute)
                          assembly.GetCustomAttributes(
                              typeof(TargetFrameworkAttribute), false)[0];

                      return targetFramework.FrameworkName;
                  }
              }
              catch
              {
                  // do nothing.
              }
#elif NET_35
              return ".NETFramework,Version=v3.5";
#elif NET_20
              return ".NETFramework,Version=v2.0";
#endif
          }

          return null;
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// Accepts a long target framework attribute value and makes it into a
      /// much shorter version, suitable for use with NuGet packages.
      /// </summary>
      /// <param name="targetFramework">
      /// The long target framework attribute value to convert.
      /// </param>
      /// <returns>
      /// The short target framework attribute value -OR- null if it cannot
      /// be determined or converted.
      /// </returns>
      private static string AbbreviateTargetFramework(
          string targetFramework
          )
      {
          if (!String.IsNullOrEmpty(targetFramework))
          {
              string abbreviation;

              lock (staticSyncRoot)
              {
                  if (targetFrameworkAbbreviations != null)
                  {
                      if (targetFrameworkAbbreviations.TryGetValue(
                              targetFramework, out abbreviation))
                      {
                          return abbreviation;
                      }
                  }
              }

              //
              // HACK: *LEGACY* Fallback to the old method of
              //       abbreviating target framework names.
              //
              int index = targetFramework.IndexOf(
                  ".NETFramework,Version=v");

              if (index != -1)
              {
                  abbreviation = targetFramework;

                  abbreviation = abbreviation.Replace(
                      ".NETFramework,Version=v", "net");

                  abbreviation = abbreviation.Replace(
                      ".", String.Empty);

                  index = abbreviation.IndexOf(',');

                  if (index != -1)
                      return abbreviation.Substring(0, index);
                  else
                      return abbreviation;
              }
          }

          return targetFramework;
      }

      /////////////////////////////////////////////////////////////////////////

      /// <summary>
      /// If necessary, replaces all supported environment variable tokens
      /// with their associated values.
      /// </summary>
      /// <param name="value">
      /// A setting value read from an environment variable.
      /// </param>
      /// <returns>
      /// The value of the <paramref name="value" /> will all supported
      /// environment variable tokens replaced.  No return value is reserved
      /// to indicate an error.  This method cannot fail.
      /// </returns>
      private static string ReplaceEnvironmentVariableTokens(
          string value
          )
      {
          if (!String.IsNullOrEmpty(value))
          {
              if (value.IndexOf(AssemblyDirectoryToken) != -1)
              {
                  string directory = GetCachedAssemblyDirectory();

                  if (!String.IsNullOrEmpty(directory))
                  {
                      try
                      {
                          value = value.Replace(
                              AssemblyDirectoryToken, directory);
                      }
#if !NET_COMPACT_20 && TRACE_SHARED
                      catch (Exception e)
#else
                      catch (Exception)
#endif
                      {
#if !NET_COMPACT_20 && TRACE_SHARED
                          try
                          {
                              Trace.WriteLine(HelperMethods.StringFormat(
                                  CultureInfo.CurrentCulture, "Native library " +
                                  "pre-loader failed to replace assembly " +
                                  "directory token: {0}", e)); /* throw */
                          }
                          catch
                          {
                              // do nothing.
                          }
#endif
                      }
                  }
              }

              if (value.IndexOf(TargetFrameworkToken) != -1)
              {
                  Assembly assembly = null;

                  try
                  {
                      assembly = Assembly.GetExecutingAssembly();
                  }
#if !NET_COMPACT_20 && TRACE_SHARED
                  catch (Exception e)
#else
                  catch (Exception)
#endif
                  {
#if !NET_COMPACT_20 && TRACE_SHARED
                      try
                      {
                          Trace.WriteLine(HelperMethods.StringFormat(
                              CultureInfo.CurrentCulture, "Native library " +
                              "pre-loader failed to obtain executing " +
                              "assembly: {0}", e)); /* throw */
                      }
                      catch
                      {
                          // do nothing.
                      }
#endif
                  }

                  string targetFramework = AbbreviateTargetFramework(
                      GetAssemblyTargetFramework(assembly));

                  if (!String.IsNullOrEmpty(targetFramework))
                  {
                      try
                      {
                          value = value.Replace(
                              TargetFrameworkToken, targetFramework);
                      }
#if !NET_COMPACT_20 && TRACE_SHARED
                      catch (Exception e)
#else
                      catch (Exception)
#endif
                      {
#if !NET_COMPACT_20 && TRACE_SHARED
                          try
                          {
                              Trace.WriteLine(HelperMethods.StringFormat(
                                  CultureInfo.CurrentCulture, "Native library " +
                                  "pre-loader failed to replace target " +
                                  "framework token: {0}", e)); /* throw */
                          }
                          catch
                          {
                              // do nothing.
                          }
#endif
                      }
                  }
              }
          }

          return value;
      }
#endif

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Queries and returns the value of the specified setting, using the XML
      /// configuration file and/or the environment variables for the current
      /// process and/or the current system, when available.
      /// </summary>
      /// <param name="name">
      /// The name of the setting.
      /// </param>
      /// <param name="default">
      /// The value to be returned if the setting has not been set explicitly
      /// or cannot be determined.
      /// </param>
      /// <returns>
      /// The value of the setting -OR- the default value specified by
      /// <paramref name="default" /> if it has not been set explicitly or
      /// cannot be determined.  By default, all references to existing
      /// environment variables will be expanded to their corresponding values
      /// within the value to be returned unless either the "No_Expand" or
      /// "No_Expand_<paramref name="name" />" environment variable is set [to
      /// anything].
      /// </returns>
      internal static string GetSettingValue(
          string name,    /* in */
          string @default /* in */
          )
      {
#if !PLATFORM_COMPACTFRAMEWORK
          //
          // NOTE: If the special "No_SQLiteGetSettingValue" environment
          //       variable is set [to anything], this method will always
          //       return the default value.
          //
          if (Environment.GetEnvironmentVariable(
                "No_SQLiteGetSettingValue") != null)
          {
              return @default;
          }
#endif

          /////////////////////////////////////////////////////////////////////

          if (name == null)
              return @default;

          /////////////////////////////////////////////////////////////////////

          #region Debug Build Only
#if DEBUG
          //
          // NOTE: We are about to read a setting value from the environment
          //       or possibly from the XML configuration file; create or
          //       increment the appropriate statistic now.
          //
          DebugData.IncrementSettingReadCount(name, false);
#endif
          #endregion

          /////////////////////////////////////////////////////////////////////

          bool expand = true; /* SHARED: Environment -AND- XML config file. */
          bool tokens = true; /* SHARED: Environment -AND- XML config file. */

          /////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
          string value = null;

          if (Environment.GetEnvironmentVariable("No_Expand") != null)
          {
              expand = false;
          }
          else if (Environment.GetEnvironmentVariable(
                  HelperMethods.StringFormat(CultureInfo.InvariantCulture,
                  "No_Expand_{0}", name)) != null)
          {
              expand = false;
          }

          if (Environment.GetEnvironmentVariable("No_Tokens") != null)
          {
              tokens = false;
          }
          else if (Environment.GetEnvironmentVariable(
                  HelperMethods.StringFormat(CultureInfo.InvariantCulture,
                  "No_Tokens_{0}", name)) != null)
          {
              tokens = false;
          }

          value = Environment.GetEnvironmentVariable(name);

          if (!String.IsNullOrEmpty(value))
          {
              if (expand)
                  value = Environment.ExpandEnvironmentVariables(value);

              if (tokens)
                  value = ReplaceEnvironmentVariableTokens(value);
          }

          if (value != null)
              return value;

          //
          // NOTE: If the "No_SQLiteXmlConfigFile" environment variable is
          //       set [to anything], this method will NEVER read from the
          //       XML configuration file.
          //
          if (Environment.GetEnvironmentVariable(
                "No_SQLiteXmlConfigFile") != null)
          {
              return @default;
          }
#endif

          /////////////////////////////////////////////////////////////////////

          #region Debug Build Only
#if DEBUG
          //
          // NOTE: We are about to read a setting value from the XML
          //       configuration file; create or increment the appropriate
          //       statistic now.
          //
          DebugData.IncrementSettingReadCount(name, true);
#endif
          #endregion

          /////////////////////////////////////////////////////////////////////

          return GetSettingValueViaXmlConfigFile(
              GetCachedXmlConfigFileName(), name, @default, expand, tokens);
      }

      /////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
      private static string ListToString(IList<string> list)
      {
          if (list == null)
              return null;

          StringBuilder result = new StringBuilder();

          foreach (string element in list)
          {
              if (element == null)
                  continue;

              if (result.Length > 0)
                  result.Append(' ');

              result.Append(element);
          }

          return result.ToString();
      }

      /////////////////////////////////////////////////////////////////////////

      private static int CheckForArchitecturesAndPlatforms(
          string directory,
          ref List<string> matches
          )
      {
          int result = 0;

          if (matches == null)
              matches = new List<string>();

          lock (staticSyncRoot)
          {
              if (!String.IsNullOrEmpty(directory) &&
                  (processorArchitecturePlatforms != null))
              {
                  foreach (KeyValuePair<string, string> pair
                            in processorArchitecturePlatforms)
                  {
                      if (Directory.Exists(MaybeCombinePath(directory, pair.Key)))
                      {
                          matches.Add(pair.Key);
                          result++;
                      }

                      string value = pair.Value;

                      if (value == null)
                          continue;

                      if (Directory.Exists(MaybeCombinePath(directory, value)))
                      {
                          matches.Add(value);
                          result++;
                      }
                  }
              }
          }

          return result;
      }

      /////////////////////////////////////////////////////////////////////////

      private static bool CheckAssemblyCodeBase(
          Assembly assembly,
          ref string fileName
          )
      {
          try
          {
              if (assembly == null)
                  return false;

              string codeBase = assembly.CodeBase;

              if (String.IsNullOrEmpty(codeBase))
                  return false;

              Uri uri = new Uri(codeBase);
              string localFileName = uri.LocalPath;

              if (!File.Exists(localFileName))
                  return false;

              string directory = Path.GetDirectoryName(
                  localFileName); /* throw */

              string xmlConfigFileName = MaybeCombinePath(
                  directory, XmlConfigFileName);

              if (File.Exists(xmlConfigFileName))
              {
#if !NET_COMPACT_20 && TRACE_DETECTION
                  try
                  {
                      Trace.WriteLine(HelperMethods.StringFormat(
                          CultureInfo.CurrentCulture,
                          "Native library pre-loader found primary XML " +
                          "configuration file via code base for currently " +
                          "executing assembly: \"{0}\"",
                          xmlConfigFileName)); /* throw */
                  }
                  catch
                  {
                      // do nothing.
                  }
#endif

                  fileName = localFileName;
                  return true;
              }

              string xmlAltConfigFileName = MaybeCombinePath(
                  directory, XmlAltConfigFileName);

              if (File.Exists(xmlAltConfigFileName))
              {
#if !NET_COMPACT_20 && TRACE_DETECTION
                  try
                  {
                      Trace.WriteLine(HelperMethods.StringFormat(
                          CultureInfo.CurrentCulture,
                          "Native library pre-loader found secondary XML " +
                          "configuration file via code base for currently " +
                          "executing assembly: \"{0}\"",
                          xmlAltConfigFileName)); /* throw */
                  }
                  catch
                  {
                      // do nothing.
                  }
#endif

                  fileName = localFileName;
                  return true;
              }

              List<string> matches = null;

              if (CheckForArchitecturesAndPlatforms(directory, ref matches) > 0)
              {
#if !NET_COMPACT_20 && TRACE_DETECTION
                  try
                  {
                      Trace.WriteLine(HelperMethods.StringFormat(
                          CultureInfo.CurrentCulture,
                          "Native library pre-loader found native sub-directories " +
                          "via code base for currently executing assembly: \"{0}\"",
                          ListToString(matches))); /* throw */
                  }
                  catch
                  {
                      // do nothing.
                  }
#endif

                  fileName = localFileName;
                  return true;
              }

              return false;
          }
#if !NET_COMPACT_20 && TRACE_SHARED
          catch (Exception e)
#else
          catch (Exception)
#endif
          {
#if !NET_COMPACT_20 && TRACE_SHARED
              try
              {
                  Trace.WriteLine(HelperMethods.StringFormat(
                      CultureInfo.CurrentCulture,
                      "Native library pre-loader failed to check code base " +
                      "for currently executing assembly: {0}", e)); /* throw */
              }
              catch
              {
                  // do nothing.
              }
#endif
          }

          return false;
      }
#endif

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Resets the cached assembly directory value, thus forcing the next
      /// call to <see cref="GetCachedAssemblyDirectory" /> method to rely
      /// upon the <see cref="GetAssemblyDirectory" /> method to fetch the
      /// assembly directory.
      /// </summary>
      private static void ResetCachedAssemblyDirectory()
      {
          #region Debug Build Only
#if DEBUG
          DebugData.IncrementOtherCount("Method_ResetCachedAssemblyDirectory");
#endif
          #endregion

          lock (staticSyncRoot)
          {
              cachedAssemblyDirectory = null;
              noAssemblyDirectory = false;
          }
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Queries and returns the cached directory for the assembly currently
      /// being executed, if available.  If the cached assembly directory value
      /// is not available, the <see cref="GetAssemblyDirectory" /> method will
      /// be used to obtain the assembly directory.
      /// </summary>
      /// <returns>
      /// The directory for the assembly currently being executed -OR- null if
      /// it cannot be determined.
      /// </returns>
      public static string GetCachedAssemblyDirectory()
      {
          #region Debug Build Only
#if DEBUG
          DebugData.IncrementOtherCount("Method_GetCachedAssemblyDirectory");
#endif
          #endregion

          lock (staticSyncRoot)
          {
              if (cachedAssemblyDirectory != null)
                  return cachedAssemblyDirectory;

              if (noAssemblyDirectory)
                  return null;
          }

          return GetAssemblyDirectory();
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Queries and returns the directory for the assembly currently being
      /// executed.
      /// </summary>
      /// <returns>
      /// The directory for the assembly currently being executed -OR- null if
      /// it cannot be determined.
      /// </returns>
      private static string GetAssemblyDirectory()
      {
          #region Debug Build Only
#if DEBUG
          DebugData.IncrementOtherCount("Method_GetAssemblyDirectory");
#endif
          #endregion

          try
          {
              Assembly assembly = Assembly.GetExecutingAssembly();

              if (assembly == null)
              {
                  lock (staticSyncRoot)
                  {
                      noAssemblyDirectory = true;
                  }

                  return null;
              }

              string fileName = null;

#if PLATFORM_COMPACTFRAMEWORK
              AssemblyName assemblyName = assembly.GetName();

              if (assemblyName == null)
              {
                  lock (staticSyncRoot)
                  {
                      noAssemblyDirectory = true;
                  }

                  return null;
              }

              fileName = assemblyName.CodeBase;
#else
              if (!CheckAssemblyCodeBase(assembly, ref fileName))
                  fileName = assembly.Location;
#endif

              if (String.IsNullOrEmpty(fileName))
              {
                  lock (staticSyncRoot)
                  {
                      noAssemblyDirectory = true;
                  }

                  return null;
              }

              string directory = Path.GetDirectoryName(fileName);

              if (String.IsNullOrEmpty(directory))
              {
                  lock (staticSyncRoot)
                  {
                      noAssemblyDirectory = true;
                  }

                  return null;
              }

              lock (staticSyncRoot)
              {
                  cachedAssemblyDirectory = directory;
              }

              return directory;
          }
#if !NET_COMPACT_20 && TRACE_SHARED
          catch (Exception e)
#else
          catch (Exception)
#endif
          {
#if !NET_COMPACT_20 && TRACE_SHARED
              try
              {
                  Trace.WriteLine(HelperMethods.StringFormat(
                      CultureInfo.CurrentCulture,
                      "Native library pre-loader failed to get directory " +
                      "for currently executing assembly: {0}", e)); /* throw */
              }
              catch
              {
                  // do nothing.
              }
#endif
          }

          lock (staticSyncRoot)
          {
              noAssemblyDirectory = true;
          }

          return null;
      }
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Native SQLite Library Helper Methods
      /// <summary>
      /// Determines the (possibly fully qualified) file name for the native
      /// SQLite library that was loaded by this class.
      /// </summary>
      /// <returns>
      /// The file name for the native SQLite library that was loaded by
      /// this class -OR- null if its value cannot be determined.
      /// </returns>
      internal static string GetNativeModuleFileName()
      {
#if SQLITE_STANDARD || USE_INTEROP_DLL || PLATFORM_COMPACTFRAMEWORK
#if PRELOAD_NATIVE_LIBRARY
          lock (staticSyncRoot)
          {
              if (_SQLiteNativeModuleFileName != null)
                  return _SQLiteNativeModuleFileName;
          }
#endif
#endif

          return SQLITE_DLL; /* COMPAT */
      }
      #endregion

      /////////////////////////////////////////////////////////////////////////

      #region Optional Native SQLite Library Pre-Loading Code
      //
      // NOTE: If we are looking for the standard SQLite DLL ("sqlite3.dll"),
      //       the interop DLL ("SQLite.Interop.dll"), or we are running on the
      //       .NET Compact Framework, we should include this code (only if the
      //       feature has actually been enabled).  This code would be totally
      //       redundant if this module has been bundled into the mixed-mode
      //       assembly.
      //
#if SQLITE_STANDARD || USE_INTEROP_DLL || PLATFORM_COMPACTFRAMEWORK

      //
      // NOTE: Only compile in the native library pre-load code if the feature
      //       has been enabled for this build.
      //
#if PRELOAD_NATIVE_LIBRARY
      /// <summary>
      /// The name of the environment variable containing the processor
      /// architecture of the current process.
      /// </summary>
      private static readonly string PROCESSOR_ARCHITECTURE =
          "PROCESSOR_ARCHITECTURE";

      /////////////////////////////////////////////////////////////////////////

      #region Private Data
      /// <summary>
      /// The native module file name for the native SQLite library or null.
      /// </summary>
      private static string _SQLiteNativeModuleFileName = null;

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// The native module handle for the native SQLite library or the value
      /// IntPtr.Zero.
      /// </summary>
      private static IntPtr _SQLiteNativeModuleHandle = IntPtr.Zero;
      #endregion

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Determines the base file name (without any directory information)
      /// for the native SQLite library to be pre-loaded by this class.
      /// </summary>
      /// <returns>
      /// The base file name for the native SQLite library to be pre-loaded by
      /// this class -OR- null if its value cannot be determined.
      /// </returns>
      internal static string GetNativeLibraryFileNameOnly()
      {
          string fileNameOnly = GetSettingValue(
              "PreLoadSQLite_LibraryFileNameOnly", null);

          if (fileNameOnly != null)
              return fileNameOnly;

          return SQLITE_DLL; /* COMPAT */
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Searches for the native SQLite library in the directory containing
      /// the assembly currently being executed as well as the base directory
      /// for the current application domain.
      /// </summary>
      /// <param name="baseDirectory">
      /// Upon success, this parameter will be modified to refer to the base
      /// directory containing the native SQLite library.
      /// </param>
      /// <param name="processorArchitecture">
      /// Upon success, this parameter will be modified to refer to the name
      /// of the immediate directory (i.e. the offset from the base directory)
      /// containing the native SQLite library.
      /// </param>
      /// <param name="allowBaseDirectoryOnly">
      /// Upon success, this parameter will be modified to non-zero only if
      /// the base directory itself should be allowed for loading the native
      /// library.
      /// </param>
      /// <returns>
      /// Non-zero (success) if the native SQLite library was found; otherwise,
      /// zero (failure).
      /// </returns>
      private static bool SearchForDirectory(
          ref string baseDirectory,         /* out */
          ref string processorArchitecture, /* out */
          ref bool allowBaseDirectoryOnly   /* out */
          )
      {
          if (GetSettingValue(
                "PreLoadSQLite_NoSearchForDirectory", null) != null)
          {
              return false; /* DISABLED */
          }

          //
          // NOTE: Determine the base file name for the native SQLite library.
          //       If this is not known by this class, we cannot continue.
          //
          string fileNameOnly = GetNativeLibraryFileNameOnly();

          if (fileNameOnly == null)
              return false;

          //
          // NOTE: Build the list of base directories and processor/platform
          //       names.  These lists will be used to help locate the native
          //       SQLite core library (or interop assembly) to pre-load into
          //       this process.
          //
          string[] directories = {
              GetAssemblyDirectory(),
#if !PLATFORM_COMPACTFRAMEWORK
              AppDomain.CurrentDomain.BaseDirectory,
#endif
          };

          string extraSubDirectory = null;

          if ((GetSettingValue(
                  "PreLoadSQLite_AllowBaseDirectoryOnly", null) != null) ||
              (HelperMethods.IsDotNetCore() && !HelperMethods.IsWindows()))
          {
              extraSubDirectory = String.Empty; /* .NET Core on POSIX */
          }

          string[] subDirectories = {
              GetProcessorArchitecture(), /* e.g. "x86" */
              GetPlatformName(null),      /* e.g. "Win32" */
              extraSubDirectory           /* base directory only? */
          };

          foreach (string directory in directories)
          {
              if (directory == null)
                  continue;

              foreach (string subDirectory in subDirectories)
              {
                  if (subDirectory == null)
                      continue;

                  string fileName = FixUpDllFileName(MaybeCombinePath(
                      MaybeCombinePath(directory, subDirectory),
                      fileNameOnly));

                  //
                  // NOTE: If the SQLite DLL file exists, return success.
                  //       Prior to returning, set the base directory and
                  //       processor architecture to reflect the location
                  //       where it was found.
                  //
                  if (File.Exists(fileName))
                  {
#if !NET_COMPACT_20 && TRACE_DETECTION
                      try
                      {
                          Trace.WriteLine(HelperMethods.StringFormat(
                              CultureInfo.CurrentCulture,
                              "Native library pre-loader found native file " +
                              "name \"{0}\", returning directory \"{1}\" and " +
                              "sub-directory \"{2}\"...", fileName, directory,
                              subDirectory)); /* throw */
                      }
                      catch
                      {
                          // do nothing.
                      }
#endif

                      baseDirectory = directory;
                      processorArchitecture = subDirectory;
                      allowBaseDirectoryOnly = (subDirectory.Length == 0);

                      return true; /* FOUND */
                  }
              }
          }

          return false; /* NOT FOUND */
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Queries and returns the base directory of the current application
      /// domain.
      /// </summary>
      /// <returns>
      /// The base directory for the current application domain -OR- null if it
      /// cannot be determined.
      /// </returns>
      private static string GetBaseDirectory()
      {
          //
          // NOTE: If the "PreLoadSQLite_BaseDirectory" environment variable
          //       is set, use it verbatim for the base directory.
          //
          string directory = GetSettingValue("PreLoadSQLite_BaseDirectory",
              null);

          if (directory != null)
              return directory;

#if !PLATFORM_COMPACTFRAMEWORK
          //
          // NOTE: If the "PreLoadSQLite_UseAssemblyDirectory" environment
          //       variable is set (to anything), then attempt to use the
          //       directory containing the currently executing assembly
          //       (i.e. System.Data.SQLite) intsead of the application
          //       domain base directory.
          //
          if (GetSettingValue(
                  "PreLoadSQLite_UseAssemblyDirectory", null) != null)
          {
              directory = GetAssemblyDirectory();

              if (directory != null)
                  return directory;
          }

          //
          // NOTE: Otherwise, fallback on using the base directory of the
          //       current application domain.
          //
          return AppDomain.CurrentDomain.BaseDirectory;
#else
          //
          // NOTE: Otherwise, fallback on using the directory containing
          //       the currently executing assembly.
          //
          return GetAssemblyDirectory();
#endif
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Determines if the dynamic link library file name requires a suffix
      /// and adds it if necessary.
      /// </summary>
      /// <param name="fileName">
      /// The original dynamic link library file name to inspect.
      /// </param>
      /// <returns>
      /// The dynamic link library file name, possibly modified to include an
      /// extension.
      /// </returns>
      private static string FixUpDllFileName(
          string fileName /* in */
          )
      {
          if (!String.IsNullOrEmpty(fileName))
          {
              if (HelperMethods.IsWindows())
              {
                  if (!fileName.EndsWith(DllFileExtension,
                          StringComparison.OrdinalIgnoreCase))
                  {
                      return fileName + DllFileExtension;
                  }
              }
          }

          return fileName;
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Queries and returns the processor architecture of the current
      /// process.
      /// </summary>
      /// <returns>
      /// The processor architecture of the current process -OR- null if it
      /// cannot be determined.
      /// </returns>
      private static string GetProcessorArchitecture()
      {
          //
          // NOTE: If the "PreLoadSQLite_ProcessorArchitecture" environment
          //       variable is set, use it verbatim for the current processor
          //       architecture.
          //
          string processorArchitecture = GetSettingValue(
              "PreLoadSQLite_ProcessorArchitecture", null);

          if (processorArchitecture != null)
              return processorArchitecture;

          //
          // BUGBUG: Will this always be reliable?
          //
          processorArchitecture = GetSettingValue(PROCESSOR_ARCHITECTURE, null);

          /////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
          //
          // HACK: Check for an "impossible" situation.  If the pointer size
          //       is 32-bits, the processor architecture cannot be "AMD64".
          //       In that case, we are almost certainly hitting a bug in the
          //       operating system and/or Visual Studio that causes the
          //       PROCESSOR_ARCHITECTURE environment variable to contain the
          //       wrong value in some circumstances.  Please refer to ticket
          //       [9ac9862611] for further information.
          //
          if ((IntPtr.Size == sizeof(int)) &&
              String.Equals(processorArchitecture, "AMD64",
                  StringComparison.OrdinalIgnoreCase))
          {
#if !NET_COMPACT_20 && TRACE_DETECTION
              //
              // NOTE: When tracing is enabled, save the originally detected
              //       processor architecture before changing it.
              //
              string savedProcessorArchitecture = processorArchitecture;
#endif

              //
              // NOTE: We know that operating systems that return "AMD64" as
              //       the processor architecture are actually a superset of
              //       the "x86" processor architecture; therefore, return
              //       "x86" when the pointer size is 32-bits.
              //
              processorArchitecture = "x86";

#if !NET_COMPACT_20 && TRACE_DETECTION
              try
              {
                  //
                  // NOTE: Show that we hit a fairly unusual situation (i.e.
                  //       the "wrong" processor architecture was detected).
                  //
                  Trace.WriteLine(HelperMethods.StringFormat(
                      CultureInfo.CurrentCulture,
                      "Native library pre-loader detected {0}-bit pointer " +
                      "size with processor architecture \"{1}\", using " +
                      "processor architecture \"{2}\" instead...",
                      IntPtr.Size * 8 /* bits */, savedProcessorArchitecture,
                      processorArchitecture)); /* throw */
              }
              catch
              {
                  // do nothing.
              }
#endif
          }
#endif

          /////////////////////////////////////////////////////////////////////

          if (processorArchitecture == null)
          {
              //
              // NOTE: Default to the processor architecture reported by the
              //       appropriate native operating system API, if any.
              //
              processorArchitecture = NativeLibraryHelper.GetMachine();

              //
              // NOTE: Upon failure, return empty string.  This will prevent
              //       the calling method from considering this method call
              //       a "failure".
              //
              if (processorArchitecture == null)
                  processorArchitecture = String.Empty;
          }

          /////////////////////////////////////////////////////////////////////

          return processorArchitecture;
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Given the processor architecture, returns the name of the platform.
      /// </summary>
      /// <param name="processorArchitecture">
      /// The processor architecture to be translated to a platform name.
      /// </param>
      /// <returns>
      /// The platform name for the specified processor architecture -OR- null
      /// if it cannot be determined.
      /// </returns>
      private static string GetPlatformName(
          string processorArchitecture /* in */
          )
      {
          if (processorArchitecture == null)
              processorArchitecture = GetProcessorArchitecture();

          if (String.IsNullOrEmpty(processorArchitecture))
              return null;

          lock (staticSyncRoot)
          {
              if (processorArchitecturePlatforms == null)
                  return null;

              string platformName;

              if (processorArchitecturePlatforms.TryGetValue(
                      processorArchitecture, out platformName))
              {
                  return platformName;
              }
          }

          return null;
      }

      /////////////////////////////////////////////////////////////////////////
      /// <summary>
      /// Attempts to load the native SQLite library based on the specified
      /// directory and processor architecture.
      /// </summary>
      /// <param name="baseDirectory">
      /// The base directory to use, null for default (the base directory of
      /// the current application domain).  This directory should contain the
      /// processor architecture specific sub-directories.
      /// </param>
      /// <param name="processorArchitecture">
      /// The requested processor architecture, null for default (the
      /// processor architecture of the current process).  This caller should
      /// almost always specify null for this parameter.
      /// </param>
      /// <param name="allowBaseDirectoryOnly">
      /// Non-zero indicates that the native SQLite library can be loaded
      /// from the base directory itself.
      /// </param>
      /// <param name="nativeModuleFileName">
      /// The candidate native module file name to load will be stored here,
      /// if necessary.
      /// </param>
      /// <param name="nativeModuleHandle">
      /// The native module handle as returned by LoadLibrary will be stored
      /// here, if necessary.  This value will be IntPtr.Zero if the call to
      /// LoadLibrary fails.
      /// </param>
      /// <returns>
      /// Non-zero if the native module was loaded successfully; otherwise,
      /// zero.
      /// </returns>
      private static bool PreLoadSQLiteDll(
          string baseDirectory,            /* in */
          string processorArchitecture,    /* in */
          bool allowBaseDirectoryOnly,     /* in */
          ref string nativeModuleFileName, /* out */
          ref IntPtr nativeModuleHandle    /* out */
          )
      {
          //
          // NOTE: If the specified base directory is null, use the default
          //       (i.e. attempt to automatically detect it).
          //
          if (baseDirectory == null)
              baseDirectory = GetBaseDirectory();

          //
          // NOTE: If we failed to query the base directory, stop now.
          //
          if (baseDirectory == null)
              return false;

          //
          // NOTE: Determine the base file name for the native SQLite library.
          //       If this is not known by this class, we cannot continue.
          //
          string fileNameOnly = GetNativeLibraryFileNameOnly();

          if (fileNameOnly == null)
              return false;

          //
          // NOTE: If the native SQLite library exists in the base directory
          //       itself, possibly stop now.
          //
          string fileName = FixUpDllFileName(MaybeCombinePath(baseDirectory,
              fileNameOnly));

          if (File.Exists(fileName))
          {
              //
              // NOTE: If the caller is allowing the base directory itself
              //       to be used, also make sure a processor architecture
              //       was not specified; if either condition is false just
              //       stop now and return failure.
              //
              if (allowBaseDirectoryOnly &&
                  String.IsNullOrEmpty(processorArchitecture))
              {
                  goto baseDirOnly;
              }
              else
              {
                  return false;
              }
          }

          //
          // NOTE: If the specified processor architecture is null, use the
          //       default.
          //
          if (processorArchitecture == null)
              processorArchitecture = GetProcessorArchitecture();

          //
          // NOTE: If we failed to query the processor architecture, stop now.
          //
          if (processorArchitecture == null)
              return false;

          //
          // NOTE: Build the full path and file name for the native SQLite
          //       library using the processor architecture name.
          //
          fileName = FixUpDllFileName(MaybeCombinePath(MaybeCombinePath(
              baseDirectory, processorArchitecture), fileNameOnly));

          //
          // NOTE: If the file name based on the processor architecture name
          // is not found, try using the associated platform name.
          //
          if (!File.Exists(fileName))
          {
              //
              // NOTE: Attempt to translate the processor architecture to a
              //       platform name.
              //
              string platformName = GetPlatformName(processorArchitecture);

              //
              // NOTE: If we failed to translate the platform name, stop now.
              //
              if (platformName == null)
                  return false;

              //
              // NOTE: Build the full path and file name for the native SQLite
              //       library using the platform name.
              //
              fileName = FixUpDllFileName(MaybeCombinePath(MaybeCombinePath(
                  baseDirectory, platformName), fileNameOnly));

              //
              // NOTE: If the file does not exist, skip trying to load it.
              //
              if (!File.Exists(fileName))
                  return false;
          }

      baseDirOnly:

          try
          {
#if !NET_COMPACT_20 && TRACE_PRELOAD
              try
              {
                  //
                  // NOTE: Show exactly where we are trying to load the native
                  //       SQLite library from.
                  //
                  Trace.WriteLine(HelperMethods.StringFormat(
                      CultureInfo.CurrentCulture,
                      "Native library pre-loader is trying to load native " +
                      "SQLite library \"{0}\"...", fileName)); /* throw */
              }
              catch
              {
                  // do nothing.
              }
#endif

              //
              // NOTE: Attempt to load the native library.  This will either
              //       return a valid native module handle, return IntPtr.Zero,
              //       or throw an exception.  This must use the appropriate
              //       P/Invoke method for the current operating system.
              //
              nativeModuleFileName = fileName;
              nativeModuleHandle = NativeLibraryHelper.LoadLibrary(fileName);

              return (nativeModuleHandle != IntPtr.Zero);
          }
#if !NET_COMPACT_20 && TRACE_PRELOAD
          catch (Exception e)
#else
          catch (Exception)
#endif
          {
#if !NET_COMPACT_20 && TRACE_PRELOAD
              try
              {
                  //
                  // NOTE: First, grab the last Win32 error number.
                  //
                  int lastError = Marshal.GetLastWin32Error(); /* throw */

                  //
                  // NOTE: Show where we failed to load the native SQLite
                  //       library from along with the Win32 error code and
                  //       exception information.
                  //
                  Trace.WriteLine(HelperMethods.StringFormat(
                      CultureInfo.CurrentCulture,
                      "Native library pre-loader failed to load native " +
                      "SQLite library \"{0}\" (getLastError = {1}): {2}",
                      fileName, lastError, e)); /* throw */
              }
              catch
              {
                  // do nothing.
              }
#endif
          }

          return false;
      }
#endif
#endif
      #endregion

      /////////////////////////////////////////////////////////////////////////

#if PLATFORM_COMPACTFRAMEWORK
    //
    // NOTE: On the .NET Compact Framework, the native interop assembly must
    //       be used because it provides several workarounds to .NET Compact
    //       Framework limitations important for proper operation of the core
    //       System.Data.SQLite functionality (e.g. being able to bind
    //       parameters and handle column values of types Int64 and Double).
    //
    internal const string SQLITE_DLL = "SQLite.Interop.119.dll";
#elif SQLITE_STANDARD
    //
    // NOTE: Otherwise, if the standard SQLite library is enabled, use it.
    //
    internal const string SQLITE_DLL = "sqlite3";
#elif USE_INTEROP_DLL
    //
    // NOTE: Otherwise, if the native SQLite interop assembly is enabled,
    //       use it.
    //
    internal const string SQLITE_DLL = "SQLite.Interop.dll";
#else
    //
    // NOTE: Finally, assume that the mixed-mode assembly is being used.
    //
    internal const string SQLITE_DLL = "System.Data.SQLite.dll";
#endif

    // This section uses interop calls that also fetch text length to optimize conversion.
    // When using the standard dll, we can replace these calls with normal sqlite calls and
    // do unoptimized conversions instead afterwards
    #region interop added textlength calls

#if !SQLITE_STANDARD

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_bind_parameter_name_interop(IntPtr stmt, int index, ref int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_database_name_interop(IntPtr stmt, int index, ref int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_database_name16_interop(IntPtr stmt, int index, ref int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_decltype_interop(IntPtr stmt, int index, ref int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_decltype16_interop(IntPtr stmt, int index, ref int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_name_interop(IntPtr stmt, int index, ref int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_name16_interop(IntPtr stmt, int index, ref int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_origin_name_interop(IntPtr stmt, int index, ref int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_origin_name16_interop(IntPtr stmt, int index, ref int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_table_name_interop(IntPtr stmt, int index, ref int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_table_name16_interop(IntPtr stmt, int index, ref int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_text_interop(IntPtr stmt, int index, ref int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_column_text16_interop(IntPtr stmt, int index, ref int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_errmsg_interop(IntPtr db, ref int len);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_prepare_interop(IntPtr db, IntPtr pSql, int nBytes, ref IntPtr stmt, ref IntPtr ptrRemain, ref int nRemain);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_table_column_metadata_interop(IntPtr db, byte[] dbName, byte[] tblName, byte[] colName, ref IntPtr ptrDataType, ref IntPtr ptrCollSeq, ref int notNull, ref int primaryKey, ref int autoInc, ref int dtLen, ref int csLen);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_value_text_interop(IntPtr p, ref int len);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_value_text16_interop(IntPtr p, ref int len);

    [DllImport(SQLITE_DLL)]
    internal static extern int sqlite3_malloc_size_interop(IntPtr p);

#if INTEROP_LOG
    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_config_log_interop();

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_unconfig_log_interop();
#endif
#endif
// !SQLITE_STANDARD

    #endregion

    // These functions add existing functionality on top of SQLite and require a little effort to
    // get working when using the standard SQLite library.
    #region interop added functionality

#if !SQLITE_STANDARD

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr interop_libversion();

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr interop_sourceid();

    [DllImport(SQLITE_DLL)]
    internal static extern int interop_compileoption_used(IntPtr zOptName);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr interop_compileoption_get(int N);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_close_interop(IntPtr db);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_create_function_interop(IntPtr db, byte[] strName, int nArgs, SQLiteFunctionFlags nType, IntPtr pvUser, SQLiteCallback func, SQLiteCallback fstep, SQLiteFinalCallback ffinal, int needCollSeq);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_create_window_function_interop(IntPtr db, byte[] strName, int nArgs, SQLiteFunctionFlags nType, IntPtr pvUser, SQLiteCallback fstep, SQLiteFinalCallback ffinal, SQLiteFinalCallback fvalue, SQLiteCallback finverse, int needCollSeq);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_finalize_interop(IntPtr stmt);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_backup_finish_interop(IntPtr backup);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_blob_close_interop(IntPtr blob);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_open_interop(byte[] utf8Filename, byte[] vfsName, SQLiteOpenFlagsEnum flags, int extFuncs, ref IntPtr db);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_open16_interop(byte[] utf8Filename, byte[] vfsName, SQLiteOpenFlagsEnum flags, int extFuncs, ref IntPtr db);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_reset_interop(IntPtr stmt);

    [DllImport(SQLITE_DLL)]
    internal static extern int sqlite3_changes_interop(IntPtr db);
#endif
// !SQLITE_STANDARD

    #endregion

    // The standard api call equivalents of the above interop calls
    #region standard versions of interop functions

#if SQLITE_STANDARD







#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif

    internal static extern SQLiteErrorCode sqlite3_open_v2(byte[] utf8Filename, ref IntPtr db, SQLiteOpenFlagsEnum flags, byte[] vfsName);














#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
#else
    [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)]
#endif
    internal static extern SQLiteErrorCode sqlite3_open16(string fileName, ref IntPtr db);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_close(IntPtr db);

#if !INTEROP_LEGACY_CLOSE
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_close_v2(IntPtr db); /* 3.7.14+ */
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_create_function(IntPtr db, byte[] strName, int nArgs, SQLiteFunctionFlags nType, IntPtr pvUser, SQLiteCallback func, SQLiteCallback fstep, SQLiteFinalCallback ffinal);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_create_window_function(IntPtr db, byte[] strName, int nArgs, SQLiteFunctionFlags nType, IntPtr pvUser, SQLiteCallback fstep, SQLiteFinalCallback ffinal, SQLiteFinalCallback fvalue, SQLiteCallback finverse, SQLiteDestroyCallback fdestroy);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_finalize(IntPtr stmt);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_backup_finish(IntPtr backup);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_reset(IntPtr stmt);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_bind_parameter_name(IntPtr stmt, int index);
268
269
270
271
272
273
274
275









276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296

297

298
299
300
301
302
303
304
305

306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323

324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
















































































































































343












344
345
346
347
348
349
350
351
352
353










354
355
356







357



















358
359
360
361
362
363
364
365




366
367
368
369
370


371












372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
    internal static extern IntPtr sqlite3_errmsg(IntPtr db);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_prepare(IntPtr db, IntPtr pSql, int nBytes, out IntPtr stmt, out IntPtr ptrRemain);










#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_table_column_metadata(IntPtr db, byte[] dbName, byte[] tblName, byte[] colName, out IntPtr ptrDataType, out IntPtr ptrCollSeq, out int notNull, out int primaryKey, out int autoInc);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_value_text(IntPtr p);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_value_text16(IntPtr p);

#endif


    #endregion

    // These functions are custom and have no equivalent standard library method.
    // All of them are "nice to haves" and not necessarily "need to haves".
    #region no equivalent standard method

#if !SQLITE_STANDARD

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_context_collseq(IntPtr context, out int type, out int enc, out int len);

    [DllImport(SQLITE_DLL)]
    internal static extern int sqlite3_context_collcompare(IntPtr context, byte[] p1, int p1len, byte[] p2, int p2len);

    [DllImport(SQLITE_DLL)]
    internal static extern int sqlite3_cursor_rowid(IntPtr stmt, int cursor, out long rowid);

    [DllImport(SQLITE_DLL)]
    internal static extern int sqlite3_index_column_info_interop(IntPtr db, byte[] catalog, byte[] IndexName, byte[] ColumnName, out int sortOrder, out int onError, out IntPtr Collation, out int colllen);

    [DllImport(SQLITE_DLL)]
    internal static extern void sqlite3_resetall_interop(IntPtr db);

    [DllImport(SQLITE_DLL)]
    internal static extern int sqlite3_table_cursor(IntPtr stmt, int db, int tableRootPage);
#endif


    #endregion

    // Standard API calls global across versions.  There are a few instances of interop calls
    // scattered in here, but they are only active when PLATFORM_COMPACTFRAMEWORK is declared.
    #region standard sqlite api calls

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_libversion();

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
















































































































































    internal static extern void sqlite3_interrupt(IntPtr db);













#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_changes(IntPtr db);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]










#else
    [DllImport(SQLITE_DLL)]
#endif







    internal static extern int sqlite3_busy_timeout(IntPtr db, int ms);




















#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_bind_blob(IntPtr stmt, int index, Byte[] value, int nSize, IntPtr nTransient);





#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int sqlite3_bind_double(IntPtr stmt, int index, double value);
#else
    [DllImport(SQLITE_DLL)]


    internal static extern int sqlite3_bind_double_interop(IntPtr stmt, int index, ref double value);












#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_bind_int(IntPtr stmt, int index, int value);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern int sqlite3_bind_int64(IntPtr stmt, int index, long value);
#else
    [DllImport(SQLITE_DLL)]
    internal static extern int sqlite3_bind_int64_interop(IntPtr stmt, int index, ref long value);
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_bind_null(IntPtr stmt, int index);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_bind_text(IntPtr stmt, int index, byte[] value, int nlen, IntPtr pvReserved);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_bind_parameter_count(IntPtr stmt);







|
>
>
>
>
>
>
>
>
>






|














>

>








>

|


|


|


|


|

<
<

>



















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

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










>
>
>
>
>
>
>
>
>
>



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






|

>
>
>
>

|
<

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







<
|
<
<
<
<
<
<
<






<
<
<
<
<
<
<
|







3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904


3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146

4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170

4171







4172
4173
4174
4175
4176
4177







4178
4179
4180
4181
4182
4183
4184
4185
    internal static extern IntPtr sqlite3_errmsg(IntPtr db);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_prepare(IntPtr db, IntPtr pSql, int nBytes, ref IntPtr stmt, ref IntPtr ptrRemain);

#if USE_PREPARE_V2
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_prepare_v2(IntPtr db, IntPtr pSql, int nBytes, ref IntPtr stmt, ref IntPtr ptrRemain);
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_table_column_metadata(IntPtr db, byte[] dbName, byte[] tblName, byte[] colName, ref IntPtr ptrDataType, ref IntPtr ptrCollSeq, ref int notNull, ref int primaryKey, ref int autoInc);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_value_text(IntPtr p);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_value_text16(IntPtr p);

#endif
    // SQLITE_STANDARD

    #endregion

    // These functions are custom and have no equivalent standard library method.
    // All of them are "nice to haves" and not necessarily "need to haves".
    #region no equivalent standard method

#if !SQLITE_STANDARD

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_context_collseq_interop(IntPtr context, ref int type, ref int enc, ref int len);

    [DllImport(SQLITE_DLL)]
    internal static extern int sqlite3_context_collcompare_interop(IntPtr context, byte[] p1, int p1len, byte[] p2, int p2len);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_cursor_rowid_interop(IntPtr stmt, int cursor, ref long rowid);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_index_column_info_interop(IntPtr db, byte[] catalog, byte[] IndexName, byte[] ColumnName, ref int sortOrder, ref int onError, ref IntPtr Collation, ref int colllen);

    [DllImport(SQLITE_DLL)]
    internal static extern int sqlite3_table_cursor_interop(IntPtr stmt, int db, int tableRootPage);



#endif
// !SQLITE_STANDARD

    #endregion

    // Standard API calls global across versions.  There are a few instances of interop calls
    // scattered in here, but they are only active when PLATFORM_COMPACTFRAMEWORK is declared.
    #region standard sqlite api calls

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_libversion();

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_libversion_number();

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_sourceid();

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_compileoption_used(IntPtr zOptName);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_compileoption_get(int N);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_enable_shared_cache(
        int enable);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_enable_load_extension(
        IntPtr db, int enable);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_load_extension(
        IntPtr db, byte[] fileName, byte[] procName, ref IntPtr pError);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_overload_function(IntPtr db, IntPtr zName, int nArgs);

#if WINDOWS
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
#else
    [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)]
#endif
    //
    // NOTE: The "sqlite3_win32_set_directory" SQLite core library function is
    //       only supported on Windows.
    //
    internal static extern SQLiteErrorCode sqlite3_win32_set_directory(uint type, string value);

#if !DEBUG // NOTE: Should be "WIN32HEAP && !MEMDEBUG"
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    //
    // NOTE: The "sqlite3_win32_reset_heap" SQLite core library function is
    //       only supported on Windows when the Win32 native allocator is in
    //       use (i.e. by default, in "Release" builds of System.Data.SQLite
    //       only).  By default, in "Debug" builds of System.Data.SQLite, the
    //       MEMDEBUG allocator is used.
    //
    internal static extern SQLiteErrorCode sqlite3_win32_reset_heap();

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    //
    // NOTE: The "sqlite3_win32_compact_heap" SQLite core library function is
    //       only supported on Windows when the Win32 native allocator is in
    //       use (i.e. by default, in "Release" builds of System.Data.SQLite
    //       only).  By default, in "Debug" builds of System.Data.SQLite, the
    //       MEMDEBUG allocator is used.
    //
    internal static extern SQLiteErrorCode sqlite3_win32_compact_heap(ref uint largest);
#endif
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_malloc(int n);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_malloc64(ulong n);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_realloc(IntPtr p, int n);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_realloc64(IntPtr p, ulong n);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern ulong sqlite3_msize(IntPtr p);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_free(IntPtr p);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_interrupt(IntPtr db);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_is_interrupted(IntPtr db);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern long sqlite3_last_insert_rowid(IntPtr db);
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_changes(IntPtr db);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern long sqlite3_memory_used();
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern long sqlite3_memory_highwater(int resetFlag);
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_shutdown();

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_busy_timeout(IntPtr db, int ms);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_clear_bindings(IntPtr stmt);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_bind_blob(IntPtr stmt, int index, Byte[] value, int nSize, IntPtr nTransient);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern SQLiteErrorCode sqlite3_bind_double(IntPtr stmt, int index, double value);
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_bind_int(IntPtr stmt, int index, int value);

    //
    // NOTE: This really just calls "sqlite3_bind_int"; however, it has the
    //       correct type signature for an unsigned (32-bit) integer.
    //
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_bind_int", CallingConvention = CallingConvention.Cdecl)]

#else
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_bind_int")]
#endif
    internal static extern SQLiteErrorCode sqlite3_bind_uint(IntPtr stmt, int index, uint value);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern SQLiteErrorCode sqlite3_bind_int64(IntPtr stmt, int index, long value);
#endif

    //
    // NOTE: This really just calls "sqlite3_bind_int64"; however, it has the
    //       correct type signature for an unsigned long (64-bit) integer.
    //
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_bind_int64", CallingConvention = CallingConvention.Cdecl)]
    internal static extern SQLiteErrorCode sqlite3_bind_uint64(IntPtr stmt, int index, ulong value);
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif

    internal static extern SQLiteErrorCode sqlite3_bind_null(IntPtr stmt, int index);








#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif







    internal static extern SQLiteErrorCode sqlite3_bind_text(IntPtr stmt, int index, byte[] value, int nlen, IntPtr pvReserved);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_bind_parameter_count(IntPtr stmt);
422
423
424
425
426
427
428







429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470







471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
    internal static extern int sqlite3_column_count(IntPtr stmt);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif







    internal static extern int sqlite3_step(IntPtr stmt);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern double sqlite3_column_double(IntPtr stmt, int index);
#else
    [DllImport(SQLITE_DLL)]
    internal static extern void sqlite3_column_double_interop(IntPtr stmt, int index, out double value);
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_column_int(IntPtr stmt, int index);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern long sqlite3_column_int64(IntPtr stmt, int index);
#else
    [DllImport(SQLITE_DLL)]
    internal static extern void sqlite3_column_int64_interop(IntPtr stmt, int index, out long value);
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_column_blob(IntPtr stmt, int index);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_column_bytes(IntPtr stmt, int index);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else







    [DllImport(SQLITE_DLL)]
#endif
    internal static extern TypeAffinity sqlite3_column_type(IntPtr stmt, int index);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_create_collation(IntPtr db, byte[] strName, int nType, IntPtr pvUser, SQLiteCollation func);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_aggregate_count(IntPtr context);







>
>
>
>
>
>
>
|




<
<
<












<
<
<



















>
>
>
>
>
>
>









|







4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217



4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229



4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
    internal static extern int sqlite3_column_count(IntPtr stmt);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_step(IntPtr stmt);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_stmt_readonly(IntPtr stmt); /* 3.7.4+ */

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern double sqlite3_column_double(IntPtr stmt, int index);



#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_column_int(IntPtr stmt, int index);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern long sqlite3_column_int64(IntPtr stmt, int index);



#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_column_blob(IntPtr stmt, int index);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_column_bytes(IntPtr stmt, int index);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_column_bytes16(IntPtr stmt, int index);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern TypeAffinity sqlite3_column_type(IntPtr stmt, int index);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_create_collation(IntPtr db, byte[] strName, SQLiteFunctionFlags nType, IntPtr pvUser, SQLiteCollation func);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_aggregate_count(IntPtr context);
498
499
500
501
502
503
504
505
506
507


508



509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535



































536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557



































558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586







587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611

612
613
614
615
616
617
618
619
620
621
622
623
624






































625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642








































































643
644
645
646
647
648
649
650
651
652
653
654
655
656




























657
658
659
660
661
662
663
664
665
666







667
668
669
670
671
672
673
674



























































































































































































































































































































































































































































































































































































































































































































































































































































































































675
676

677



678
679
680
681
682
683
684
685
686
687
688
689
690
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_value_bytes(IntPtr p);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern double sqlite3_value_double(IntPtr p);
#else
    [DllImport(SQLITE_DLL)]


    internal static extern void sqlite3_value_double_interop(IntPtr p, out double value);



#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_value_int(IntPtr p);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern long sqlite3_value_int64(IntPtr p);
#else
    [DllImport(SQLITE_DLL)]
    internal static extern void sqlite3_value_int64_interop(IntPtr p, out Int64 value);
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern TypeAffinity sqlite3_value_type(IntPtr p);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else



































    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_result_blob(IntPtr context, byte[] value, int nSize, IntPtr pvReserved);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void sqlite3_result_double(IntPtr context, double value);
#else
    [DllImport(SQLITE_DLL)]
    internal static extern void sqlite3_result_double_interop(IntPtr context, ref double value);
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_result_error(IntPtr context, byte[] strErr, int nLen);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else



































    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_result_int(IntPtr context, int value);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void sqlite3_result_int64(IntPtr context, long value);
#else
    [DllImport(SQLITE_DLL)]
    internal static extern void sqlite3_result_int64_interop(IntPtr context, ref Int64 value);
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_result_null(IntPtr context);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_result_text(IntPtr context, byte[] value, int nLen, IntPtr pvReserved);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else







    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_aggregate_context(IntPtr context, int nBytes);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
#else
    [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)]
#endif
    internal static extern int sqlite3_bind_text16(IntPtr stmt, int index, string value, int nlen, IntPtr pvReserved);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
#else
    [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)]
#endif
    internal static extern void sqlite3_result_error16(IntPtr context, string strName, int nLen);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
#else
    [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)]
#endif
    internal static extern void sqlite3_result_text16(IntPtr context, string strName, int nLen, IntPtr pvReserved);


#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_key(IntPtr db, byte[] key, int keylen);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_rekey(IntPtr db, byte[] key, int keylen);







































#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_update_hook(IntPtr db, SQLiteUpdateCallback func, IntPtr pvUser);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_commit_hook(IntPtr db, SQLiteCommitCallback func, IntPtr pvUser);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else








































































    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_rollback_hook(IntPtr db, SQLiteRollbackCallback func, IntPtr pvUser);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_db_handle(IntPtr stmt);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else




























    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_next_stmt(IntPtr db, IntPtr stmt);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_exec(IntPtr db, byte[] strSql, IntPtr pvCallback, IntPtr pvParam, out IntPtr errMsg);








#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_get_autocommit(IntPtr db);




























































































































































































































































































































































































































































































































































































































































































































































































































































































































    #endregion
  }





#if PLATFORM_COMPACTFRAMEWORK
  internal abstract class CriticalHandle : IDisposable
  {
    private bool _isClosed;
    protected IntPtr handle;
    
    protected CriticalHandle(IntPtr invalidHandleValue)
    {
      handle = invalidHandleValue;
      _isClosed = false;
    }

    ~CriticalHandle()







<


>
>
|
>
>
>












<
<
<












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







<
<
<












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







<
<
<



















>
>
>
>
>
>
>









|















>





|






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


















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














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









|
>
>
>
>
>
>
>








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


>

>
>
>





|







4283
4284
4285
4286
4287
4288
4289

4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309



4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363



4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417



4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_value_bytes(IntPtr p);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]

#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_value_bytes16(IntPtr p);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern double sqlite3_value_double(IntPtr p);
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_value_int(IntPtr p);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern long sqlite3_value_int64(IntPtr p);



#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern TypeAffinity sqlite3_value_type(IntPtr p);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern uint sqlite3_value_subtype(IntPtr p);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern TypeAffinity sqlite3_value_numeric_type(IntPtr p);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_value_nochange(IntPtr p);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_vtab_nochange(IntPtr context);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_value_frombind(IntPtr p);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_result_blob(IntPtr context, byte[] value, int nSize, IntPtr pvReserved);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void sqlite3_result_double(IntPtr context, double value);



#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_result_error(IntPtr context, byte[] strErr, int nLen);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_result_error_code(IntPtr context, SQLiteErrorCode value);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_result_error_toobig(IntPtr context);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_result_error_nomem(IntPtr context);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_result_value(IntPtr context, IntPtr value);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_result_zeroblob(IntPtr context, int nLen);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_result_int(IntPtr context, int value);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
    internal static extern void sqlite3_result_int64(IntPtr context, long value);



#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_result_null(IntPtr context);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_result_text(IntPtr context, byte[] value, int nLen, IntPtr pvReserved);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_result_subtype(IntPtr context, uint subType);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_aggregate_context(IntPtr context, int nBytes);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
#else
    [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)]
#endif
    internal static extern SQLiteErrorCode sqlite3_bind_text16(IntPtr stmt, int index, string value, int nlen, IntPtr pvReserved);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
#else
    [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)]
#endif
    internal static extern void sqlite3_result_error16(IntPtr context, string strName, int nLen);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
#else
    [DllImport(SQLITE_DLL, CharSet = CharSet.Unicode)]
#endif
    internal static extern void sqlite3_result_text16(IntPtr context, string strName, int nLen, IntPtr pvReserved);

#if INTEROP_CODEC || INTEROP_INCLUDE_SEE
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_key(IntPtr db, byte[] key, int keylen);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_rekey(IntPtr db, byte[] key, int keylen);
#endif

#if INTEROP_INCLUDE_ZIPVFS
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void zipvfsInit_v2();

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void zipvfsInit_v3(int regDflt);
#endif

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_busy_handler(IntPtr db, SQLiteBusyCallback func, IntPtr pvUser);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_progress_handler(IntPtr db, int ops, SQLiteProgressCallback func, IntPtr pvUser);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_set_authorizer(IntPtr db, SQLiteAuthorizerCallback func, IntPtr pvUser);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_update_hook(IntPtr db, SQLiteUpdateCallback func, IntPtr pvUser);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_commit_hook(IntPtr db, SQLiteCommitCallback func, IntPtr pvUser);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_trace(IntPtr db, SQLiteTraceCallback func, IntPtr pvUser);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_trace_v2(IntPtr db, SQLiteTraceFlags mask, SQLiteTraceCallback2 func, IntPtr pvUser);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_limit(IntPtr db, SQLiteLimitOpsEnum op, int value);

    // Since sqlite3_config() takes a variable argument list, we have to overload declarations
    // for all possible calls that we want to use.
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_config", CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_config")]
#endif
    internal static extern SQLiteErrorCode sqlite3_config_none(SQLiteConfigOpsEnum op);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_config", CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_config")]
#endif
    internal static extern SQLiteErrorCode sqlite3_config_int(SQLiteConfigOpsEnum op, int value);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_config", CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_config")]
#endif
    internal static extern SQLiteErrorCode sqlite3_config_log(SQLiteConfigOpsEnum op, SQLiteLogCallback func, IntPtr pvUser);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_db_config", CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_db_config")]
#endif
    internal static extern SQLiteErrorCode sqlite3_db_config_charptr(IntPtr db, SQLiteConfigDbOpsEnum op, IntPtr charPtr);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_db_config", CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_db_config")]
#endif
    internal static extern SQLiteErrorCode sqlite3_db_config_int_refint(IntPtr db, SQLiteConfigDbOpsEnum op, int value, ref int result);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_db_config", CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_db_config")]
#endif
    internal static extern SQLiteErrorCode sqlite3_db_config_intptr_two_ints(IntPtr db, SQLiteConfigDbOpsEnum op, IntPtr ptr, int int0, int int1);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_db_status(IntPtr db, SQLiteStatusOpsEnum op, ref int current, ref int highwater, int resetFlag);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_rollback_hook(IntPtr db, SQLiteRollbackCallback func, IntPtr pvUser);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_db_handle(IntPtr stmt);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_db_release_memory(IntPtr db);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_db_filename(IntPtr db, IntPtr dbName);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_db_readonly(IntPtr db, IntPtr dbName);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_db_filename", CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_db_filename")]
#endif
    internal static extern IntPtr sqlite3_db_filename_bytes(IntPtr db, byte[] dbName);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_next_stmt(IntPtr db, IntPtr stmt);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_exec(IntPtr db, byte[] strSql, IntPtr pvCallback, IntPtr pvParam, ref IntPtr errMsg);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_release_memory(int nBytes);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_get_autocommit(IntPtr db);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_extended_result_codes(IntPtr db, int onoff);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_errcode(IntPtr db);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_extended_errcode(IntPtr db);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_errstr(SQLiteErrorCode rc); /* 3.7.15+ */

    // Since sqlite3_log() takes a variable argument list, we have to overload declarations
    // for all possible calls.  For now, we are only exposing a single string, and
    // depend on the caller to format the string.
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_log(SQLiteErrorCode iErrCode, byte[] zFormat);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_file_control(IntPtr db, byte[] zDbName, int op, IntPtr pArg);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_backup_init(IntPtr destDb, byte[] zDestName, IntPtr sourceDb, byte[] zSourceName);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_backup_step(IntPtr backup, int nPage);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_backup_remaining(IntPtr backup);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_backup_pagecount(IntPtr backup);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_blob_close(IntPtr blob);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3_blob_bytes(IntPtr blob);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_blob_open(IntPtr db, byte[] dbName, byte[] tblName, byte[] colName, long rowId, int flags, ref IntPtr ptrBlob);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_blob_read(IntPtr blob, [MarshalAs(UnmanagedType.LPArray)] byte[] buffer, int count, int offset);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_blob_reopen(IntPtr blob, long rowId);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_blob_write(IntPtr blob, [MarshalAs(UnmanagedType.LPArray)] byte[] buffer, int count, int offset);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3_declare_vtab(IntPtr db, IntPtr zSQL);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_mprintf(IntPtr format, __arglist);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteTransactionState sqlite3_txn_state(IntPtr db, IntPtr zSchema);
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    // SQLite API calls that are provided by "well-known" extensions that may be statically
    // linked with the SQLite core native library currently in use.
    #region extension sqlite api calls
    #region virtual table
#if INTEROP_VIRTUAL_TABLE
#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern IntPtr sqlite3_create_disposable_module(IntPtr db, IntPtr name, ref sqlite3_module module, IntPtr pClientData, xDestroyModule xDestroy);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3_dispose_module(IntPtr pModule);
#endif
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region session extension
#if INTEROP_SESSION_EXTENSION
#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    internal delegate int xSessionFilter(IntPtr context, IntPtr pTblName);

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    internal delegate SQLiteChangeSetConflictResult xSessionConflict(IntPtr context, SQLiteChangeSetConflictType type, IntPtr iterator);

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    internal delegate SQLiteErrorCode xSessionInput(IntPtr context, IntPtr pData, ref int nData);

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    internal delegate SQLiteErrorCode xSessionOutput(IntPtr context, IntPtr pData, int nData);

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern long sqlite3session_memory_used(IntPtr session);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3session_create(IntPtr db, byte[] dbName, ref IntPtr session);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3session_delete(IntPtr session);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3session_enable(IntPtr session, int enable);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3session_indirect(IntPtr session, int indirect);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3session_attach(IntPtr session, byte[] tblName);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3session_table_filter(IntPtr session, xSessionFilter xFilter, IntPtr context);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3session_changeset(IntPtr session, ref int nChangeSet, ref IntPtr pChangeSet);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3session_diff(IntPtr session, byte[] fromDbName, byte[] tblName, ref IntPtr errMsg);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3session_patchset(IntPtr session, ref int nPatchSet, ref IntPtr pPatchSet);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern int sqlite3session_isempty(IntPtr session);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changeset_start(ref IntPtr iterator, int nChangeSet, IntPtr pChangeSet);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changeset_start_v2(ref IntPtr iterator, int nChangeSet, IntPtr pChangeSet, SQLiteChangeSetStartFlags flags);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changeset_next(IntPtr iterator);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changeset_op(IntPtr iterator, ref IntPtr pTblName, ref int nColumns, ref SQLiteAuthorizerActionCode op, ref int bIndirect);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changeset_pk(IntPtr iterator, ref IntPtr pPrimaryKeys, ref int nColumns);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changeset_old(IntPtr iterator, int columnIndex, ref IntPtr pValue);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changeset_new(IntPtr iterator, int columnIndex, ref IntPtr pValue);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changeset_conflict(IntPtr iterator, int columnIndex, ref IntPtr pValue);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changeset_fk_conflicts(IntPtr iterator, ref int conflicts);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changeset_finalize(IntPtr iterator);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changeset_invert(int nIn, IntPtr pIn, ref int nOut, ref IntPtr pOut);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changeset_concat(int nA, IntPtr pA, int nB, IntPtr pB, ref int nOut, ref IntPtr pOut);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changegroup_new(ref IntPtr changeGroup);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changegroup_add(IntPtr changeGroup, int nData, IntPtr pData);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changegroup_output(IntPtr changeGroup, ref int nData, ref IntPtr pData);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern void sqlite3changegroup_delete(IntPtr changeGroup);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changeset_apply(IntPtr db, int nChangeSet, IntPtr pChangeSet, xSessionFilter xFilter, xSessionConflict xConflict, IntPtr context);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changeset_apply_strm(IntPtr db, xSessionInput xInput, IntPtr pIn, xSessionFilter xFilter, xSessionConflict xConflict, IntPtr context);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changeset_concat_strm(xSessionInput xInputA, IntPtr pInA, xSessionInput xInputB, IntPtr pInB, xSessionOutput xOutput, IntPtr pOut);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changeset_invert_strm(xSessionInput xInput, IntPtr pIn, xSessionOutput xOutput, IntPtr pOut);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changeset_start_strm(ref IntPtr iterator, xSessionInput xInput, IntPtr pIn);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changeset_start_v2_strm(ref IntPtr iterator, xSessionInput xInput, IntPtr pIn, SQLiteChangeSetStartFlags flags);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3session_changeset_strm(IntPtr session, xSessionOutput xOutput, IntPtr pOut);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3session_patchset_strm(IntPtr session, xSessionOutput xOutput, IntPtr pOut);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changegroup_add_strm(IntPtr changeGroup, xSessionInput xInput, IntPtr pIn);

#if !PLATFORM_COMPACTFRAMEWORK
    [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
#else
    [DllImport(SQLITE_DLL)]
#endif
    internal static extern SQLiteErrorCode sqlite3changegroup_output_strm(IntPtr changeGroup, xSessionOutput xOutput, IntPtr pOut);
#endif
    #endregion
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region sqlite interop api calls (.NET Compact Framework only)
#if PLATFORM_COMPACTFRAMEWORK && !SQLITE_STANDARD
    [DllImport(SQLITE_DLL)]
    internal static extern void sqlite3_last_insert_rowid_interop(IntPtr db, ref long rowId);

    [DllImport(SQLITE_DLL)]
    internal static extern void sqlite3_memory_used_interop(ref long bytes);

    [DllImport(SQLITE_DLL)]
    internal static extern void sqlite3_memory_highwater_interop(int resetFlag, ref long bytes);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_bind_double_interop(IntPtr stmt, int index, ref double value);

    [DllImport(SQLITE_DLL)]
    internal static extern SQLiteErrorCode sqlite3_bind_int64_interop(IntPtr stmt, int index, ref long value);

    [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_bind_int64_interop")]
    internal static extern SQLiteErrorCode sqlite3_bind_uint64_interop(IntPtr stmt, int index, ref ulong value);

    [DllImport(SQLITE_DLL)]
    internal static extern void sqlite3_column_double_interop(IntPtr stmt, int index, ref double value);

    [DllImport(SQLITE_DLL)]
    internal static extern void sqlite3_column_int64_interop(IntPtr stmt, int index, ref long value);

    [DllImport(SQLITE_DLL)]
    internal static extern void sqlite3_value_double_interop(IntPtr p, ref double value);

    [DllImport(SQLITE_DLL)]
    internal static extern void sqlite3_value_int64_interop(IntPtr p, ref Int64 value);

    [DllImport(SQLITE_DLL)]
    internal static extern void sqlite3_result_double_interop(IntPtr context, ref double value);

    [DllImport(SQLITE_DLL)]
    internal static extern void sqlite3_result_int64_interop(IntPtr context, ref Int64 value);

    [DllImport(SQLITE_DLL)]
    internal static extern void sqlite3_msize_interop(IntPtr p, ref ulong size);

    [DllImport(SQLITE_DLL)]
    internal static extern IntPtr sqlite3_create_disposable_module_interop(
        IntPtr db, IntPtr name, IntPtr pModule, int iVersion, xCreate xCreate,
        xConnect xConnect, xBestIndex xBestIndex, xDisconnect xDisconnect,
        xDestroy xDestroy, xOpen xOpen, xClose xClose, xFilter xFilter,
        xNext xNext, xEof xEof, xColumn xColumn, xRowId xRowId, xUpdate xUpdate,
        xBegin xBegin, xSync xSync, xCommit xCommit, xRollback xRollback,
        xFindFunction xFindFunction, xRename xRename, xSavepoint xSavepoint,
        xRelease xRelease, xRollbackTo xRollbackTo, IntPtr pClientData,
        xDestroyModule xDestroyModule);
#endif
    // PLATFORM_COMPACTFRAMEWORK && !SQLITE_STANDARD
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region Native Delegates
#if INTEROP_VIRTUAL_TABLE
#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xCreate(
        IntPtr pDb,
        IntPtr pAux,
        int argc,
        IntPtr argv,
        ref IntPtr pVtab,
        ref IntPtr pError
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xConnect(
        IntPtr pDb,
        IntPtr pAux,
        int argc,
        IntPtr argv,
        ref IntPtr pVtab,
        ref IntPtr pError
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xBestIndex(
        IntPtr pVtab,
        IntPtr pIndex
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xDisconnect(
        IntPtr pVtab
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xDestroy(
        IntPtr pVtab
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xOpen(
        IntPtr pVtab,
        ref IntPtr pCursor
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xClose(
        IntPtr pCursor
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xFilter(
        IntPtr pCursor,
        int idxNum,
        IntPtr idxStr,
        int argc,
        IntPtr argv
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xNext(
        IntPtr pCursor
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate int xEof(
        IntPtr pCursor
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xColumn(
        IntPtr pCursor,
        IntPtr pContext,
        int index
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xRowId(
        IntPtr pCursor,
        ref long rowId
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xUpdate(
        IntPtr pVtab,
        int argc,
        IntPtr argv,
        ref long rowId
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xBegin(
        IntPtr pVtab
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xSync(
        IntPtr pVtab
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xCommit(
        IntPtr pVtab
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xRollback(
        IntPtr pVtab
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate int xFindFunction(
        IntPtr pVtab,
        int nArg,
        IntPtr zName,
        ref SQLiteCallback callback,
        ref IntPtr pUserData
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xRename(
        IntPtr pVtab,
        IntPtr zNew
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xSavepoint(
        IntPtr pVtab,
        int iSavepoint
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xRelease(
        IntPtr pVtab,
        int iSavepoint
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate SQLiteErrorCode xRollbackTo(
        IntPtr pVtab,
        int iSavepoint
    );

    ///////////////////////////////////////////////////////////////////////////

#if !PLATFORM_COMPACTFRAMEWORK
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
#endif
    public delegate void xDestroyModule(IntPtr pClientData);
#endif
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region Native Structures
#if INTEROP_VIRTUAL_TABLE
    [StructLayout(LayoutKind.Sequential)]
    internal struct sqlite3_module
    {
        /*   0 */ public int iVersion;
        /*   8 */ public xCreate xCreate;
        /*  16 */ public xConnect xConnect;
        /*  24 */ public xBestIndex xBestIndex;
        /*  32 */ public xDisconnect xDisconnect;
        /*  40 */ public xDestroy xDestroy;
        /*  48 */ public xOpen xOpen;
        /*  56 */ public xClose xClose;
        /*  64 */ public xFilter xFilter;
        /*  72 */ public xNext xNext;
        /*  80 */ public xEof xEof;
        /*  88 */ public xColumn xColumn;
        /*  96 */ public xRowId xRowId;
        /* 104 */ public xUpdate xUpdate;
        /* 112 */ public xBegin xBegin;
        /* 120 */ public xSync xSync;
        /* 128 */ public xCommit xCommit;
        /* 136 */ public xRollback xRollback;
        /* 144 */ public xFindFunction xFindFunction;
        /* 152 */ public xRename xRename;
        /* The methods above are in version 1 of the sqlite3_module
         * object.  Those below are for version 2 and greater. */
        /* 160 */ public xSavepoint xSavepoint;
        /* 168 */ public xRelease xRelease;
        /* 176 */ public xRollbackTo xRollbackTo;
    }

    ///////////////////////////////////////////////////////////////////////////

    [StructLayout(LayoutKind.Sequential)]
    internal struct sqlite3_vtab
    {
        /*  0 */ public IntPtr pModule;
        /*  8 */ public int nRef; /* NO LONGER USED */
        /* 16 */ public IntPtr zErrMsg;
    }

    ///////////////////////////////////////////////////////////////////////////

    [StructLayout(LayoutKind.Sequential)]
    internal struct sqlite3_vtab_cursor
    {
        /* 0 */ public IntPtr pVTab;
    }

    ///////////////////////////////////////////////////////////////////////////

    [StructLayout(LayoutKind.Sequential)]
    internal struct sqlite3_index_constraint
    {
        public sqlite3_index_constraint(
            SQLiteIndexConstraint constraint
            )
            : this()
        {
            if (constraint != null)
            {
                iColumn = constraint.iColumn;
                op = constraint.op;
                usable = constraint.usable;
                iTermOffset = constraint.iTermOffset;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /* 0 */ public int iColumn;
        /* 4 */ public SQLiteIndexConstraintOp op;
        /* 5 */ public byte usable;
        /* 8 */ public int iTermOffset;
    }

    ///////////////////////////////////////////////////////////////////////////

    [StructLayout(LayoutKind.Sequential)]
    internal struct sqlite3_index_orderby
    {
        public sqlite3_index_orderby(
            SQLiteIndexOrderBy orderBy
            )
            : this()
        {
            if (orderBy != null)
            {
                iColumn = orderBy.iColumn;
                desc = orderBy.desc;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        /* 0 */ public int iColumn; /* Column number */
        /* 4 */ public byte desc;   /* True for DESC.  False for ASC. */
    }

    ///////////////////////////////////////////////////////////////////////////

    [StructLayout(LayoutKind.Sequential)]
    internal struct sqlite3_index_constraint_usage
    {
        public sqlite3_index_constraint_usage(
            SQLiteIndexConstraintUsage constraintUsage
            )
            : this()
        {
            if (constraintUsage != null)
            {
                argvIndex = constraintUsage.argvIndex;
                omit = constraintUsage.omit;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        public int argvIndex; /* if >0, constraint is part of argv to xFilter */
        public byte omit;     /* Do not code a test for this constraint */
    }

    ///////////////////////////////////////////////////////////////////////////

    [StructLayout(LayoutKind.Sequential)]
    internal struct sqlite3_index_info
    {
        /* Inputs */
        /*  0 */ public int nConstraint; /* Number of entries in aConstraint */
        /*  8 */ public IntPtr aConstraint;
        /* 16 */ public int nOrderBy;    /* Number of entries in aOrderBy */
        /* 24 */ public IntPtr aOrderBy;
        /* Outputs */
        /* 32 */ public IntPtr aConstraintUsage;
        /* 40 */ public int idxNum;           /* Number used to identify the index */
        /* 48 */ public string idxStr;        /* String, possibly obtained from sqlite3_malloc */
        /* 56 */ public int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */
        /* 60 */ public int orderByConsumed;  /* True if output is already ordered */
        /* 64 */ public double estimatedCost; /* Estimated cost of using this index */
        /* 72 */ public long estimatedRows;   /* Estimated number of rows returned */
        /* 80 */ public SQLiteIndexFlags idxFlags; /* Mask of SQLITE_INDEX_SCAN_* flags */
        /* 88 */ public long colUsed;         /* Input: Mask of columns used by statement */
    }
#endif
    #endregion
  }
  #endregion

  /////////////////////////////////////////////////////////////////////////////

  #region .NET Compact Framework (only) CriticalHandle Class
#if PLATFORM_COMPACTFRAMEWORK
  internal abstract class CriticalHandle : IDisposable
  {
    private bool _isClosed;
    protected IntPtr handle;

    protected CriticalHandle(IntPtr invalidHandleValue)
    {
      handle = invalidHandleValue;
      _isClosed = false;
    }

    ~CriticalHandle()
740
741
742
743
744
745
746


747













748
749

750


















































751

752





753

754






755

756






















































757


































758

759

































































760
761





































762




763






764

765


















































































766
767










































768





















































769












































770
771



772


































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






































800
801






802
803
804


805



806
807





808
809



810

811



812
813



814


































815
816
817
818
819



820










821
822
823
824




































825

826








827





































828
829






830
831
832

















833

    public abstract bool IsInvalid
    {
      get;
    }

  }
















#endif


  // Handles the unmanaged database pointer, and provides finalization support for it.


















































  internal class SQLiteConnectionHandle : CriticalHandle

  {





    public static implicit operator IntPtr(SQLiteConnectionHandle db)

    {






      return db.handle;

    }

























































































    public static implicit operator SQLiteConnectionHandle(IntPtr db)

    {

































































      return new SQLiteConnectionHandle(db);
    }










































    private SQLiteConnectionHandle(IntPtr db)






      : this()

    {


















































































      SetHandle(db);
    }
































































































    internal SQLiteConnectionHandle()












































      : base(IntPtr.Zero)
    {



    }



































    protected override bool ReleaseHandle()
    {
      try
      {



        SQLiteBase.CloseConnection(this);










      }
      catch (SQLiteException)
      {
      }




































      return true;

    }



















    public override bool IsInvalid
    {




      get { return (handle == IntPtr.Zero); }
    }
  }






  // Provides finalization support for unmanaged SQLite statements.

  internal class SQLiteStatementHandle : CriticalHandle


  {



    public static implicit operator IntPtr(SQLiteStatementHandle stmt)

    {








      return stmt.handle;


    }







































    public static implicit operator SQLiteStatementHandle(IntPtr stmt)
    {






      return new SQLiteStatementHandle(stmt);
    }



    private SQLiteStatementHandle(IntPtr stmt)



      : this()
    {





      SetHandle(stmt);
    }





    internal SQLiteStatementHandle()



      : base(IntPtr.Zero)
    {



    }



































    protected override bool ReleaseHandle()
    {
      try
      {



        SQLiteBase.FinalizeStatement(this);










      }
      catch (SQLiteException)
      {
      }




































      return true;

    }














































    public override bool IsInvalid
    {






      get { return (handle == IntPtr.Zero); }
    }
  }

















}







>
>

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


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

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

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

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

5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581

    public abstract bool IsInvalid
    {
      get;
    }

  }
#endif
  #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteConnectionHandle Class
    // Handles the unmanaged database pointer, and provides finalization
    // support for it.
    internal sealed class SQLiteConnectionHandle : CriticalHandle
    {
#if SQLITE_STANDARD && !PLATFORM_COMPACTFRAMEWORK
        internal delegate void CloseConnectionCallback(
            SQLiteConnectionHandle hdl, IntPtr db);

        internal static CloseConnectionCallback closeConnection =
            SQLiteBase.CloseConnection;
#endif

        ///////////////////////////////////////////////////////////////////////

#if PLATFORM_COMPACTFRAMEWORK
        internal readonly object syncRoot = new object();
#endif

        ///////////////////////////////////////////////////////////////////////

        private bool ownHandle;

        ///////////////////////////////////////////////////////////////////////

#if INTEROP_LEGACY_CLOSE
        internal int version;
#endif

        ///////////////////////////////////////////////////////////////////////

        public static implicit operator IntPtr(SQLiteConnectionHandle db)
        {
            if (db != null)
            {
#if PLATFORM_COMPACTFRAMEWORK
                lock (db.syncRoot)
#endif
                {
                    return db.handle;
                }
            }
            return IntPtr.Zero;
        }

        ///////////////////////////////////////////////////////////////////////

        internal SQLiteConnectionHandle(IntPtr db, bool ownHandle)
            : this(ownHandle)
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (syncRoot)
#endif
            {
                this.ownHandle = ownHandle;
                SetHandle(db);

#if INTEROP_LEGACY_CLOSE
                BumpVersion();
#endif
            }
        }

        ///////////////////////////////////////////////////////////////////////

        private SQLiteConnectionHandle(bool ownHandle)
            : base(IntPtr.Zero)
        {
#if COUNT_HANDLE
            if (ownHandle)
                Interlocked.Increment(ref DebugData.connectionCount);
#endif
        }

        ///////////////////////////////////////////////////////////////////////

#if INTEROP_LEGACY_CLOSE
        private void BumpVersion()
        {
            Interlocked.Increment(ref version);
        }
#endif

        ///////////////////////////////////////////////////////////////////////

        protected override bool ReleaseHandle()
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (syncRoot)
#endif
            {
                if (!ownHandle) return true;
            }

            try
            {
#if INTEROP_LEGACY_CLOSE
                BumpVersion();
#endif

#if !PLATFORM_COMPACTFRAMEWORK
                IntPtr localHandle = Interlocked.Exchange(
                    ref handle, IntPtr.Zero);

#if SQLITE_STANDARD
                if (localHandle != IntPtr.Zero)
                    closeConnection(this, localHandle);
#else
                if (localHandle != IntPtr.Zero)
                    SQLiteBase.CloseConnection(this, localHandle);
#endif

#if !NET_COMPACT_20 && TRACE_HANDLE
                try
                {
                    Trace.WriteLine(HelperMethods.StringFormat(
                        CultureInfo.CurrentCulture,
                        "CloseConnection: {0}", localHandle)); /* throw */
                }
                catch
                {
                }
#endif
#else
                lock (syncRoot)
                {
                    if (handle != IntPtr.Zero)
                    {
                        SQLiteBase.CloseConnection(this, handle);
                        SetHandle(IntPtr.Zero);
                    }
                }
#endif
#if COUNT_HANDLE
                Interlocked.Decrement(ref DebugData.connectionCount);
#endif
#if DEBUG
                return true;
#endif
            }
#if !NET_COMPACT_20 && TRACE_HANDLE
            catch (SQLiteException e)
#else
            catch (SQLiteException)
#endif
            {
#if !NET_COMPACT_20 && TRACE_HANDLE
                try
                {
                    Trace.WriteLine(HelperMethods.StringFormat(
                        CultureInfo.CurrentCulture,
                        "CloseConnection: {0}, exception: {1}",
                        handle, e)); /* throw */
                }
                catch
                {
                }
#endif
            }
            finally
            {
#if PLATFORM_COMPACTFRAMEWORK
                lock (syncRoot)
#endif
                {
                    SetHandleAsInvalid();
                }
            }
#if DEBUG
            return false;
#else
            return true;
#endif
        }

        ///////////////////////////////////////////////////////////////////////

#if COUNT_HANDLE
        public int WasReleasedOk()
        {
            return Interlocked.Decrement(ref DebugData.connectionCount);
        }
#endif

        ///////////////////////////////////////////////////////////////////////

        public bool OwnHandle
        {
            get
            {
#if PLATFORM_COMPACTFRAMEWORK
                lock (syncRoot)
#endif
                {
                    return ownHandle;
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        public override bool IsInvalid
        {
            get
            {
#if PLATFORM_COMPACTFRAMEWORK
                lock (syncRoot)
#endif
                {
                    return (handle == IntPtr.Zero);
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

#if DEBUG
        public override string ToString()
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (syncRoot)
#endif
            {
                return handle.ToString();
            }
        }
#endif
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteStatementHandle Class
    // Provides finalization support for unmanaged SQLite statements.
    internal sealed class SQLiteStatementHandle : CriticalHandle
    {
#if PLATFORM_COMPACTFRAMEWORK
        internal readonly object syncRoot = new object();
#endif

        ///////////////////////////////////////////////////////////////////////

        private SQLiteConnectionHandle cnn;

        ///////////////////////////////////////////////////////////////////////

#if INTEROP_LEGACY_CLOSE
        private int version;
#endif

        ///////////////////////////////////////////////////////////////////////

        public static implicit operator IntPtr(SQLiteStatementHandle stmt)
        {
            if (stmt != null)
            {
#if PLATFORM_COMPACTFRAMEWORK
                lock (stmt.syncRoot)
#endif
                {
                    return stmt.handle;
                }
            }
            return IntPtr.Zero;
        }

        ///////////////////////////////////////////////////////////////////////

        internal SQLiteStatementHandle(SQLiteConnectionHandle cnn, IntPtr stmt)
            : this()
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (syncRoot)
#endif
            {
                this.cnn = cnn;
                SetHandle(stmt);

#if INTEROP_LEGACY_CLOSE
                SetVersion();
#endif
            }
        }

        ///////////////////////////////////////////////////////////////////////

        private SQLiteStatementHandle()
            : base(IntPtr.Zero)
        {
#if COUNT_HANDLE
            Interlocked.Increment(ref DebugData.statementCount);
#endif
        }

        ///////////////////////////////////////////////////////////////////////

#if INTEROP_LEGACY_CLOSE
        private bool MatchVersion()
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (syncRoot)
#endif
            {
                return (cnn != null) ? (version == cnn.version) : false;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        private bool SetVersion()
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (syncRoot)
#endif
            {
                if (cnn != null)
                {
                    version = cnn.version;
                    return true;
                }

                return false;
            }
        }
#endif

        ///////////////////////////////////////////////////////////////////////

        protected override bool ReleaseHandle()
        {
            try
            {
#if !PLATFORM_COMPACTFRAMEWORK
                IntPtr localHandle = Interlocked.Exchange(
                    ref handle, IntPtr.Zero);

#if INTEROP_LEGACY_CLOSE
                if (!MatchVersion())
                {
#if !NET_COMPACT_20 && TRACE_HANDLE
                    try
                    {
                        Trace.WriteLine(HelperMethods.StringFormat(
                            CultureInfo.CurrentCulture,
                            "MatchVersion: {0} (statement handle)",
                            localHandle)); /* throw */
                    }
                    catch
                    {
                    }
#endif
#if COUNT_HANDLE
                    Interlocked.Decrement(ref DebugData.statementCount);
#endif
                    return false;
                }
#endif

                if (localHandle != IntPtr.Zero)
                    SQLiteBase.FinalizeStatement(cnn, localHandle);

#if !NET_COMPACT_20 && TRACE_HANDLE
                try
                {
                    Trace.WriteLine(HelperMethods.StringFormat(
                        CultureInfo.CurrentCulture,
                        "FinalizeStatement: {0}", localHandle)); /* throw */
                }
                catch
                {
                }
#endif
#else
                lock (syncRoot)
                {
                    if (handle != IntPtr.Zero)
                    {
                        SQLiteBase.FinalizeStatement(cnn, handle);
                        SetHandle(IntPtr.Zero);
                    }
                }
#endif
#if COUNT_HANDLE
                Interlocked.Decrement(ref DebugData.statementCount);
#endif
#if DEBUG
                return true;
#endif
            }
#if !NET_COMPACT_20 && TRACE_HANDLE
            catch (SQLiteException e)
#else
            catch (SQLiteException)
#endif
            {
#if !NET_COMPACT_20 && TRACE_HANDLE
                try
                {
                    Trace.WriteLine(HelperMethods.StringFormat(
                        CultureInfo.CurrentCulture,
                        "FinalizeStatement: {0}, exception: {1}",
                        handle, e)); /* throw */
                }
                catch
                {
                }
#endif
            }
            finally
            {
#if PLATFORM_COMPACTFRAMEWORK
                lock (syncRoot)
#endif
                {
                    SetHandleAsInvalid();
                }
            }
#if DEBUG
            return false;
#else
            return true;
#endif
        }

        ///////////////////////////////////////////////////////////////////////

#if COUNT_HANDLE
        public int WasReleasedOk()
        {
            return Interlocked.Decrement(ref DebugData.statementCount);
        }
#endif

        ///////////////////////////////////////////////////////////////////////

        public override bool IsInvalid
        {
            get
            {
#if PLATFORM_COMPACTFRAMEWORK
                lock (syncRoot)
#endif
                {
                    return (handle == IntPtr.Zero);
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

#if DEBUG
        public override string ToString()
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (syncRoot)
#endif
            {
                return handle.ToString();
            }
        }
#endif
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteBackupHandle Class
    // Provides finalization support for unmanaged SQLite backup objects.
    internal sealed class SQLiteBackupHandle : CriticalHandle
    {
#if PLATFORM_COMPACTFRAMEWORK
        internal readonly object syncRoot = new object();
#endif

        ///////////////////////////////////////////////////////////////////////

        private SQLiteConnectionHandle cnn;

        ///////////////////////////////////////////////////////////////////////

#if INTEROP_LEGACY_CLOSE
        private int version;
#endif

        ///////////////////////////////////////////////////////////////////////

        public static implicit operator IntPtr(SQLiteBackupHandle backup)
        {
            if (backup != null)
            {
#if PLATFORM_COMPACTFRAMEWORK
                lock (backup.syncRoot)
#endif
                {
                    return backup.handle;
                }
            }
            return IntPtr.Zero;
        }

        ///////////////////////////////////////////////////////////////////////

        internal SQLiteBackupHandle(SQLiteConnectionHandle cnn, IntPtr backup)
            : this()
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (syncRoot)
#endif
            {
                this.cnn = cnn;
                SetHandle(backup);

#if INTEROP_LEGACY_CLOSE
                SetVersion();
#endif
            }
        }

        ///////////////////////////////////////////////////////////////////////

        private SQLiteBackupHandle()
            : base(IntPtr.Zero)
        {
#if COUNT_HANDLE
            Interlocked.Increment(ref DebugData.backupCount);
#endif
        }

        ///////////////////////////////////////////////////////////////////////

#if INTEROP_LEGACY_CLOSE
        private bool MatchVersion()
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (syncRoot)
#endif
            {
                return (cnn != null) ? (version == cnn.version) : false;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        private bool SetVersion()
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (syncRoot)
#endif
            {
                if (cnn != null)
                {
                    version = cnn.version;
                    return true;
                }

                return false;
            }
        }
#endif

        ///////////////////////////////////////////////////////////////////////

        protected override bool ReleaseHandle()
        {
            try
            {
#if !PLATFORM_COMPACTFRAMEWORK
                IntPtr localHandle = Interlocked.Exchange(
                    ref handle, IntPtr.Zero);

#if INTEROP_LEGACY_CLOSE
                if (!MatchVersion())
                {
#if !NET_COMPACT_20 && TRACE_HANDLE
                    try
                    {
                        Trace.WriteLine(HelperMethods.StringFormat(
                            CultureInfo.CurrentCulture,
                            "MatchVersion: {0} (backup handle)",
                            localHandle)); /* throw */
                    }
                    catch
                    {
                    }
#endif
#if COUNT_HANDLE
                    Interlocked.Decrement(ref DebugData.backupCount);
#endif
                    return false;
                }
#endif

                if (localHandle != IntPtr.Zero)
                    SQLiteBase.FinishBackup(cnn, localHandle);

#if !NET_COMPACT_20 && TRACE_HANDLE
                try
                {
                    Trace.WriteLine(HelperMethods.StringFormat(
                        CultureInfo.CurrentCulture,
                        "FinishBackup: {0}", localHandle)); /* throw */
                }
                catch
                {
                }
#endif
#else
                lock (syncRoot)
                {
                    if (handle != IntPtr.Zero)
                    {
                        SQLiteBase.FinishBackup(cnn, handle);
                        SetHandle(IntPtr.Zero);
                    }
                }
#endif
#if COUNT_HANDLE
                Interlocked.Decrement(ref DebugData.backupCount);
#endif
#if DEBUG
                return true;
#endif
            }
#if !NET_COMPACT_20 && TRACE_HANDLE
            catch (SQLiteException e)
#else
            catch (SQLiteException)
#endif
            {
#if !NET_COMPACT_20 && TRACE_HANDLE
                try
                {
                    Trace.WriteLine(HelperMethods.StringFormat(
                        CultureInfo.CurrentCulture,
                        "FinishBackup: {0}, exception: {1}",
                        handle, e)); /* throw */
                }
                catch
                {
                }
#endif
            }
            finally
            {
#if PLATFORM_COMPACTFRAMEWORK
                lock (syncRoot)
#endif
                {
                    SetHandleAsInvalid();
                }
            }
#if DEBUG
            return false;
#else
            return true;
#endif
        }

        ///////////////////////////////////////////////////////////////////////

#if COUNT_HANDLE
        public int WasReleasedOk()
        {
            return Interlocked.Decrement(ref DebugData.backupCount);
        }
#endif

        ///////////////////////////////////////////////////////////////////////

        public override bool IsInvalid
        {
            get
            {
#if PLATFORM_COMPACTFRAMEWORK
                lock (syncRoot)
#endif
                {
                    return (handle == IntPtr.Zero);
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

#if DEBUG
        public override string ToString()
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (syncRoot)
#endif
            {
                return handle.ToString();
            }
        }
#endif
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region SQLiteBlobHandle Class
    // Provides finalization support for unmanaged SQLite blob objects.
    internal sealed class SQLiteBlobHandle : CriticalHandle
    {
#if PLATFORM_COMPACTFRAMEWORK
        internal readonly object syncRoot = new object();
#endif

        ///////////////////////////////////////////////////////////////////////

        private SQLiteConnectionHandle cnn;

        ///////////////////////////////////////////////////////////////////////

#if INTEROP_LEGACY_CLOSE
        private int version;
#endif

        ///////////////////////////////////////////////////////////////////////

        public static implicit operator IntPtr(SQLiteBlobHandle blob)
        {
            if (blob != null)
            {
#if PLATFORM_COMPACTFRAMEWORK
                lock (blob.syncRoot)
#endif
                {
                    return blob.handle;
                }
            }
            return IntPtr.Zero;
        }

        ///////////////////////////////////////////////////////////////////////

        internal SQLiteBlobHandle(SQLiteConnectionHandle cnn, IntPtr blob)
            : this()
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (syncRoot)
#endif
            {
                this.cnn = cnn;
                SetHandle(blob);

#if INTEROP_LEGACY_CLOSE
                SetVersion();
#endif
            }
        }

        ///////////////////////////////////////////////////////////////////////

        private SQLiteBlobHandle()
            : base(IntPtr.Zero)
        {
#if COUNT_HANDLE
            Interlocked.Increment(ref DebugData.blobCount);
#endif
        }

        ///////////////////////////////////////////////////////////////////////

#if INTEROP_LEGACY_CLOSE
        private bool MatchVersion()
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (syncRoot)
#endif
            {
                return (cnn != null) ? (version == cnn.version) : false;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        private bool SetVersion()
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (syncRoot)
#endif
            {
                if (cnn != null)
                {
                    version = cnn.version;
                    return true;
                }

                return false;
            }
        }
#endif

        ///////////////////////////////////////////////////////////////////////

        protected override bool ReleaseHandle()
        {
            try
            {
#if !PLATFORM_COMPACTFRAMEWORK
                IntPtr localHandle = Interlocked.Exchange(
                    ref handle, IntPtr.Zero);

#if INTEROP_LEGACY_CLOSE
                if (!MatchVersion())
                {
#if !NET_COMPACT_20 && TRACE_HANDLE
                    try
                    {
                        Trace.WriteLine(HelperMethods.StringFormat(
                            CultureInfo.CurrentCulture,
                            "MatchVersion: {0} (blob handle)",
                            localHandle)); /* throw */
                    }
                    catch
                    {
                    }
#endif
#if COUNT_HANDLE
                    Interlocked.Decrement(ref DebugData.blobCount);
#endif
                    return false;
                }
#endif

                if (localHandle != IntPtr.Zero)
                    SQLiteBase.CloseBlob(cnn, localHandle);

#if !NET_COMPACT_20 && TRACE_HANDLE
                try
                {
                    Trace.WriteLine(HelperMethods.StringFormat(
                        CultureInfo.CurrentCulture,
                        "CloseBlob: {0}", localHandle)); /* throw */
                }
                catch
                {
                }
#endif
#else
                lock (syncRoot)
                {
                    if (handle != IntPtr.Zero)
                    {
                        SQLiteBase.CloseBlob(cnn, handle);
                        SetHandle(IntPtr.Zero);
                    }
                }
#endif
#if COUNT_HANDLE
                Interlocked.Decrement(ref DebugData.blobCount);
#endif
#if DEBUG
                return true;
#endif
            }
#if !NET_COMPACT_20 && TRACE_HANDLE
            catch (SQLiteException e)
#else
            catch (SQLiteException)
#endif
            {
#if !NET_COMPACT_20 && TRACE_HANDLE
                try
                {
                    Trace.WriteLine(HelperMethods.StringFormat(
                        CultureInfo.CurrentCulture,
                        "CloseBlob: {0}, exception: {1}",
                        handle, e)); /* throw */
                }
                catch
                {
                }
#endif
            }
            finally
            {
#if PLATFORM_COMPACTFRAMEWORK
                lock (syncRoot)
#endif
                {
                    SetHandleAsInvalid();
                }
            }
#if DEBUG
            return false;
#else
            return true;
#endif
        }

        ///////////////////////////////////////////////////////////////////////

#if COUNT_HANDLE
        public int WasReleasedOk()
        {
            return Interlocked.Decrement(ref DebugData.blobCount);
        }
#endif

        ///////////////////////////////////////////////////////////////////////

        public override bool IsInvalid
        {
            get
            {
#if PLATFORM_COMPACTFRAMEWORK
                lock (syncRoot)
#endif
                {
                    return (handle == IntPtr.Zero);
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

#if DEBUG
        public override string ToString()
        {
#if PLATFORM_COMPACTFRAMEWORK
            lock (syncRoot)
#endif
            {
                return handle.ToString();
            }
        }
#endif
    }
    #endregion
}

Added Targets/SQLite.NET.Mono.Settings.targets.



























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!--
 *
 * SQLite.NET.Mono.Settings.targets -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **                     Mono-Specific Settings (Common)                      **
  ******************************************************************************
  -->

  <PropertyGroup>
    <!--
        TODO: This list of properties must be kept synchronized with the common
              list in the "build_mono.bat" file.
    -->
    <ConfigurationSuffix Condition="'$(ConfigurationSuffix)' == ''">MonoOnPosix</ConfigurationSuffix>
    <InteropCodec Condition="'$(InteropCodec)' == ''">false</InteropCodec>
    <InteropLog Condition="'$(InteropLog)' == ''">false</InteropLog>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                      Mono-Specific Settings (Debug)                      **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <!--
        TODO: This list of properties must be kept synchronized with the debug
              list in the "build_mono.bat" file.
    -->
    <CheckState Condition="'$(CheckState)' == ''">true</CheckState>
    <CountHandle Condition="'$(CountHandle)' == ''">true</CountHandle>
    <TraceConnection Condition="'$(TraceConnection)' == ''">true</TraceConnection>
    <TraceDetection Condition="'$(TraceDetection)' == ''">true</TraceDetection>
    <TraceHandle Condition="'$(TraceHandle)' == ''">true</TraceHandle>
    <TraceStatement Condition="'$(TraceStatement)' == ''">true</TraceStatement>
    <TrackMemoryBytes Condition="'$(TrackMemoryBytes)' == ''">true</TrackMemoryBytes>
  </PropertyGroup>
</Project>

Added Targets/SQLite.NET.NetStandard20.Settings.targets.



























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!--
 *
 * SQLite.NET.NetStandard20.Settings.targets -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **               .NET Standard 2.0 Specific Settings (Common)               **
  ******************************************************************************
  -->

  <PropertyGroup>
    <!--
        TODO: This list of properties must be kept synchronized with the common
              list in the "build_net_standard_20.bat" file.
    -->
    <ConfigurationSuffix Condition="'$(ConfigurationSuffix)' == ''">NetStandard20</ConfigurationSuffix>
    <InteropCodec Condition="'$(InteropCodec)' == ''">false</InteropCodec>
    <InteropLog Condition="'$(InteropLog)' == ''">false</InteropLog>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **               .NET Standard 2.0 Specific Settings (Debug)                **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <!--
        TODO: This list of properties must be kept synchronized with the debug
              list in the "build_net_standard_20.bat" file.
    -->
    <CheckState Condition="'$(CheckState)' == ''">true</CheckState>
    <CountHandle Condition="'$(CountHandle)' == ''">true</CountHandle>
    <TraceConnection Condition="'$(TraceConnection)' == ''">true</TraceConnection>
    <TraceDetection Condition="'$(TraceDetection)' == ''">true</TraceDetection>
    <TraceHandle Condition="'$(TraceHandle)' == ''">true</TraceHandle>
    <TraceStatement Condition="'$(TraceStatement)' == ''">true</TraceStatement>
    <TrackMemoryBytes Condition="'$(TrackMemoryBytes)' == ''">true</TrackMemoryBytes>
  </PropertyGroup>
</Project>

Added Targets/SQLite.NET.NetStandard21.Settings.targets.



























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!--
 *
 * SQLite.NET.NetStandard21.Settings.targets -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **               .NET Standard 2.1 Specific Settings (Common)               **
  ******************************************************************************
  -->

  <PropertyGroup>
    <!--
        TODO: This list of properties must be kept synchronized with the common
              list in the "build_net_standard_21.bat" file.
    -->
    <ConfigurationSuffix Condition="'$(ConfigurationSuffix)' == ''">NetStandard21</ConfigurationSuffix>
    <InteropCodec Condition="'$(InteropCodec)' == ''">false</InteropCodec>
    <InteropLog Condition="'$(InteropLog)' == ''">false</InteropLog>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **               .NET Standard 2.1 Specific Settings (Debug)                **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <!--
        TODO: This list of properties must be kept synchronized with the debug
              list in the "build_net_standard_21.bat" file.
    -->
    <CheckState Condition="'$(CheckState)' == ''">true</CheckState>
    <CountHandle Condition="'$(CountHandle)' == ''">true</CountHandle>
    <TraceConnection Condition="'$(TraceConnection)' == ''">true</TraceConnection>
    <TraceDetection Condition="'$(TraceDetection)' == ''">true</TraceDetection>
    <TraceHandle Condition="'$(TraceHandle)' == ''">true</TraceHandle>
    <TraceStatement Condition="'$(TraceStatement)' == ''">true</TraceStatement>
    <TrackMemoryBytes Condition="'$(TrackMemoryBytes)' == ''">true</TrackMemoryBytes>
  </PropertyGroup>
</Project>

Added Targets/SQLite.NET.Platform.Settings.targets.









































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!--
 *
 * SQLite.NET.Platform.Settings.targets -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **                        Platform-Specific Imports                         **
  ******************************************************************************
  -->

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Mono.Settings.targets"
          Condition="Exists('$(SQLiteNetDir)\Targets\SQLite.NET.Mono.Settings.targets') And
                     (('$(MonoBuild)' != '' And '$(MonoBuild)' != 'false') Or
                      Exists('$(MSBuildBinPath)\xbuild.exe'))" />

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.NetStandard20.Settings.targets"
          Condition="Exists('$(SQLiteNetDir)\Targets\SQLite.NET.NetStandard20.Settings.targets') And
                     ((('$(DotNetCoreBuild)' != '' And '$(DotNetCoreBuild)' != 'false') Or
                       Exists('$(MSBuildBinPath)\MSBuild.dll')) And
                      ('$(TargetFramework)' == 'netstandard2.0' Or
                       '$(TargetFramework)' == 'netcoreapp2.0' Or
                       '$(TargetFramework)' == 'netcoreapp2.1' Or
                       '$(TargetFramework)' == 'netcoreapp2.2'))" />

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.NetStandard21.Settings.targets"
          Condition="Exists('$(SQLiteNetDir)\Targets\SQLite.NET.NetStandard21.Settings.targets') And
                     ((('$(DotNetCoreBuild)' != '' And '$(DotNetCoreBuild)' != 'false') Or
                       Exists('$(MSBuildBinPath)\MSBuild.dll')) And
                      ('$(TargetFramework)' == 'netstandard2.1' Or
                       '$(TargetFramework)' == 'netcoreapp3.0'))" />
</Project>

Added Targets/SQLite.NET.Settings.targets.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
<!--
 *
 * SQLite.NET.Settings.targets -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **                          Load Per-User Settings                          **
  ******************************************************************************
  -->

  <!--
      NOTE: If the per-user settings file exists, import it now.  The contained
            settings, if any, will override the default ones provided below.
  -->
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.user"
          Condition="Exists('$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.user')" />

  <!--
  ******************************************************************************
  **                           Load Extra Settings                            **
  ******************************************************************************
  -->

  <!--
      NOTE: If the "extra" settings file exists, import it now.  The contained
            settings, if any, will override the default ones provided below.
  -->
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.extra"
          Condition="Exists('$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.extra')" />

  <!--
  ******************************************************************************
  **                        Load Per-Framework Settings                       **
  ******************************************************************************
  -->

  <!--
      NOTE: If the per-framework settings files exist, import them now.  The
            contained settings, if any, will override the default ones provided
            below.
  -->
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx20"
          Condition="'$(NetFx20)' != '' And '$(NetFx20)' != 'false' And
                     ('$(NetFx20Settings)' == '' Or '$(NetFx20Settings)' != 'false') And
                     Exists('$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx20')" />

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx35"
          Condition="'$(NetFx35)' != '' And '$(NetFx35)' != 'false' And
                     ('$(NetFx35Settings)' == '' Or '$(NetFx35Settings)' != 'false') And
                     Exists('$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx35')" />

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx40"
          Condition="'$(NetFx40)' != '' And '$(NetFx40)' != 'false' And
                     ('$(NetFx40Settings)' == '' Or '$(NetFx40Settings)' != 'false') And
                     Exists('$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx40')" />

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx45"
          Condition="'$(NetFx45)' != '' And '$(NetFx45)' != 'false' And
                     ('$(NetFx45Settings)' == '' Or '$(NetFx45Settings)' != 'false') And
                     Exists('$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx45')" />

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx451"
          Condition="'$(NetFx451)' != '' And '$(NetFx451)' != 'false' And
                     ('$(NetFx451Settings)' == '' Or '$(NetFx451Settings)' != 'false') And
                     Exists('$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx451')" />

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx452"
          Condition="'$(NetFx452)' != '' And '$(NetFx452)' != 'false' And
                     ('$(NetFx452Settings)' == '' Or '$(NetFx452Settings)' != 'false') And
                     Exists('$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx452')" />

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx46"
          Condition="'$(NetFx46)' != '' And '$(NetFx46)' != 'false' And
                     ('$(NetFx46Settings)' == '' Or '$(NetFx46Settings)' != 'false') And
                     Exists('$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx46')" />

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx461"
          Condition="'$(NetFx461)' != '' And '$(NetFx461)' != 'false' And
                     ('$(NetFx461Settings)' == '' Or '$(NetFx461Settings)' != 'false') And
                     Exists('$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx461')" />

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx462"
          Condition="'$(NetFx462)' != '' And '$(NetFx462)' != 'false' And
                     ('$(NetFx462Settings)' == '' Or '$(NetFx462Settings)' != 'false') And
                     Exists('$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx462')" />

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx47"
          Condition="'$(NetFx47)' != '' And '$(NetFx47)' != 'false' And
                     ('$(NetFx47Settings)' == '' Or '$(NetFx47Settings)' != 'false') And
                     Exists('$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx47')" />

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx471"
          Condition="'$(NetFx471)' != '' And '$(NetFx471)' != 'false' And
                     ('$(NetFx471Settings)' == '' Or '$(NetFx471Settings)' != 'false') And
                     Exists('$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx471')" />

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx472"
          Condition="'$(NetFx472)' != '' And '$(NetFx472)' != 'false' And
                     ('$(NetFx472Settings)' == '' Or '$(NetFx472Settings)' != 'false') And
                     Exists('$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx472')" />

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx48"
          Condition="'$(NetFx48)' != '' And '$(NetFx48)' != 'false' And
                     ('$(NetFx48Settings)' == '' Or '$(NetFx48Settings)' != 'false') And
                     Exists('$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx48')" />

  <!--
  ******************************************************************************
  **                       [Fairly] Generic Properties                        **
  ******************************************************************************
  -->

  <PropertyGroup>
    <!--
        NOTE: *UNCONDITIONAL* We never want to use the hosting process for
              debugging.  It causes problems.
    -->
    <UseVSHostingProcess>false</UseVSHostingProcess>

    <!--
        NOTE: *UNCONDITIONAL* We never want to use the fast up-to-date check
              that Visual Studio provides.
    -->
    <DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>

    <!--
        HACK: *UNCONDITIONAL* The Visual Studio IDE ignores the
              BaseIntermediateOutputPath property and creates empty "bin" and
              "obj" directories for every project whenever the project is opened
              or built.  Also, the Visual Studio IDE will occasionally fail to
              rebuild the project due to this confusion.  The situation appears
              to improve somewhat when this is set to false.  Please note that
              even if this is set to false, things still do not work 100%
              correctly; however, at least there appears to be less build
              failures.

              Please see Microsoft Connect FeedbackID 105854 for their official
              list of excuses, on this now more than 3 year old bug.
    -->
    <UseHostCompilerIfAvailable>false</UseHostCompilerIfAvailable>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                       Framework Version Properties                       **
  ******************************************************************************
  -->

  <PropertyGroup>
    <!--
        NOTE: Only use functionality available in the .NET Framework 2.0?  By
              default, this is disabled.  This must be enabled to successfully
              build the project using Visual Studio 2005 and/or the .NET
              Framework 2.0 (if necessary, it will typically be enabled from
              within the project file itself).
    -->
    <NetFx20 Condition="'$(NetFx20)' == ''">false</NetFx20>

    <!--
        NOTE: Only use functionality available in the .NET Framework 3.5?  By
              default, this is disabled.  This must be enabled to successfully
              build the project using Visual Studio 2008 and/or the .NET
              Framework 3.5 (if necessary, it will typically be enabled from
              within the project file itself).
    -->
    <NetFx35 Condition="'$(NetFx35)' == ''">false</NetFx35>

    <!--
        NOTE: Only use functionality available in the .NET Framework 4.0?  By
              default, this is disabled.  This must be enabled to successfully
              build the project using Visual Studio 2010 and/or the .NET
              Framework 4.0 (if necessary, it will typically be enabled from
              within the project file itself).
    -->
    <NetFx40 Condition="'$(NetFx40)' == ''">false</NetFx40>

    <!--
        NOTE: Only use functionality available in the .NET Framework 4.5?  By
              default, this is disabled.  This must be enabled to successfully
              build the project using Visual Studio 2012 and/or the .NET
              Framework 4.5 (if necessary, it will typically be enabled from
              within the project file itself).
    -->
    <NetFx45 Condition="'$(NetFx45)' == ''">false</NetFx45>

    <!--
        NOTE: Only use functionality available in the .NET Framework 4.5.1?  By
              default, this is disabled.  This must be enabled to successfully
              build the project using Visual Studio 2013 and/or the .NET
              Framework 4.5.1 (if necessary, it will typically be enabled from
              within the project file itself).
    -->
    <NetFx451 Condition="'$(NetFx451)' == ''">false</NetFx451>

    <!--
        NOTE: Only use functionality available in the .NET Framework 4.5.2?  By
              default, this is disabled.  This must be enabled to successfully
              build the project using Visual Studio 2013 and/or the .NET
              Framework 4.5.2 (if necessary, it will typically be enabled from
              within the project file itself).
    -->
    <NetFx452 Condition="'$(NetFx452)' == ''">false</NetFx452>

    <!--
        NOTE: Only use functionality available in the .NET Framework 4.6?  By
              default, this is disabled.  This must be enabled to successfully
              build the project using Visual Studio 2015 and/or the .NET
              Framework 4.6 (if necessary, it will typically be enabled from
              within the project file itself).
    -->
    <NetFx46 Condition="'$(NetFx46)' == ''">false</NetFx46>

    <!--
        NOTE: Only use functionality available in the .NET Framework 4.6.1?  By
              default, this is disabled.  This must be enabled to successfully
              build the project using Visual Studio 2015 and/or the .NET
              Framework 4.6.1 (if necessary, it will typically be enabled from
              within the project file itself).
    -->
    <NetFx461 Condition="'$(NetFx461)' == ''">false</NetFx461>

    <!--
        NOTE: Only use functionality available in the .NET Framework 4.6.2?  By
              default, this is disabled.  This must be enabled to successfully
              build the project using Visual Studio 2015 and/or the .NET
              Framework 4.6.2 (if necessary, it will typically be enabled from
              within the project file itself).
    -->
    <NetFx462 Condition="'$(NetFx462)' == ''">false</NetFx462>

    <!--
        NOTE: Only use functionality available in the .NET Framework 4.7?  By
              default, this is disabled.  This must be enabled to successfully
              build the project using Visual Studio 2017 and/or the .NET
              Framework 4.7 (if necessary, it will typically be enabled from
              within the project file itself).
    -->
    <NetFx47 Condition="'$(NetFx47)' == ''">false</NetFx47>

    <!--
        NOTE: Only use functionality available in the .NET Framework 4.7.1?  By
              default, this is disabled.  This must be enabled to successfully
              build the project using Visual Studio 2017 and/or the .NET
              Framework 4.7.1 (if necessary, it will typically be enabled from
              within the project file itself).
    -->
    <NetFx471 Condition="'$(NetFx471)' == ''">false</NetFx471>

    <!--
        NOTE: Only use functionality available in the .NET Framework 4.7.2?  By
              default, this is disabled.  This must be enabled to successfully
              build the project using Visual Studio 2017 and/or the .NET
              Framework 4.7.2 (if necessary, it will typically be enabled from
              within the project file itself).
    -->
    <NetFx472 Condition="'$(NetFx472)' == ''">false</NetFx472>

    <!--
        NOTE: Only use functionality available in the .NET Framework 4.8?  By
              default, this is disabled.  This must be enabled to successfully
              build the project using Visual Studio 2017 and/or the .NET
              Framework 4.8 (if necessary, it will typically be enabled from
              within the project file itself).
    -->
    <NetFx48 Condition="'$(NetFx48)' == ''">false</NetFx48>

    <!--
        NOTE: Load the version-specific settings for the .NET Framework 2.0?
              By default, this is disabled.  If this is enabled when compiling
              for the .NET Framework 2.0, the version-specific settings file
              "SQLite.NET.Settings.targets.netFx20" will be loaded if it is
              actually present, before any other settings in this file are
              processed.
    -->
    <NetFx20Settings Condition="'$(NetFx20Settings)' == ''">false</NetFx20Settings>

    <!--
        NOTE: Load the version-specific settings for the .NET Framework 3.5?
              By default, this is disabled.  If this is enabled when compiling
              for the .NET Framework 3.5, the version-specific settings file
              "SQLite.NET.Settings.targets.netFx35" will be loaded if it is
              actually present, before any other settings in this file are
              processed.
    -->
    <NetFx35Settings Condition="'$(NetFx35Settings)' == ''">false</NetFx35Settings>

    <!--
        NOTE: Load the version-specific settings for the .NET Framework 4.0?
              By default, this is disabled.  If this is enabled when compiling
              for the .NET Framework 4.0, the version-specific settings file
              "SQLite.NET.Settings.targets.netFx40" will be loaded if it is
              actually present, before any other settings in this file are
              processed.
    -->
    <NetFx40Settings Condition="'$(NetFx40Settings)' == ''">false</NetFx40Settings>

    <!--
        NOTE: Load the version-specific settings for the .NET Framework 4.5?
              By default, this is disabled.  If this is enabled when compiling
              for the .NET Framework 4.5, the version-specific settings file
              "SQLite.NET.Settings.targets.netFx45" will be loaded if it is
              actually present, before any other settings in this file are
              processed.
    -->
    <NetFx45Settings Condition="'$(NetFx45Settings)' == ''">false</NetFx45Settings>

    <!--
        NOTE: Load the version-specific settings for the .NET Framework 4.5.1?
              By default, this is disabled.  If this is enabled when compiling
              for the .NET Framework 4.5.1, the version-specific settings file
              "SQLite.NET.Settings.targets.netFx451" will be loaded if it is
              actually present, before any other settings in this file are
              processed.
    -->
    <NetFx451Settings Condition="'$(NetFx451Settings)' == ''">false</NetFx451Settings>

    <!--
        NOTE: Load the version-specific settings for the .NET Framework 4.5.2?
              By default, this is disabled.  If this is enabled when compiling
              for the .NET Framework 4.5.2, the version-specific settings file
              "SQLite.NET.Settings.targets.netFx452" will be loaded if it is
              actually present, before any other settings in this file are
              processed.
    -->
    <NetFx452Settings Condition="'$(NetFx452Settings)' == ''">false</NetFx452Settings>

    <!--
        NOTE: Load the version-specific settings for the .NET Framework 4.6?
              By default, this is disabled.  If this is enabled when compiling
              for the .NET Framework 4.6, the version-specific settings file
              "SQLite.NET.Settings.targets.netFx46" will be loaded if it is
              actually present, before any other settings in this file are
              processed.
    -->
    <NetFx46Settings Condition="'$(NetFx46Settings)' == ''">false</NetFx46Settings>

    <!--
        NOTE: Load the version-specific settings for the .NET Framework 4.6.1?
              By default, this is disabled.  If this is enabled when compiling
              for the .NET Framework 4.6.1, the version-specific settings file
              "SQLite.NET.Settings.targets.netFx461" will be loaded if it is
              actually present, before any other settings in this file are
              processed.
    -->
    <NetFx461Settings Condition="'$(NetFx461Settings)' == ''">false</NetFx461Settings>

    <!--
        NOTE: Load the version-specific settings for the .NET Framework 4.6.2?
              By default, this is disabled.  If this is enabled when compiling
              for the .NET Framework 4.6.2, the version-specific settings file
              "SQLite.NET.Settings.targets.netFx462" will be loaded if it is
              actually present, before any other settings in this file are
              processed.
    -->
    <NetFx462Settings Condition="'$(NetFx462Settings)' == ''">false</NetFx462Settings>

    <!--
        NOTE: Load the version-specific settings for the .NET Framework 4.7?
              By default, this is disabled.  If this is enabled when compiling
              for the .NET Framework 4.7, the version-specific settings file
              "SQLite.NET.Settings.targets.netFx47" will be loaded if it is
              actually present, before any other settings in this file are
              processed.
    -->
    <NetFx47Settings Condition="'$(NetFx47Settings)' == ''">false</NetFx47Settings>

    <!--
        NOTE: Load the version-specific settings for the .NET Framework 4.7.1?
              By default, this is disabled.  If this is enabled when compiling
              for the .NET Framework 4.7.1, the version-specific settings file
              "SQLite.NET.Settings.targets.netFx471" will be loaded if it is
              actually present, before any other settings in this file are
              processed.
    -->
    <NetFx471Settings Condition="'$(NetFx471Settings)' == ''">false</NetFx471Settings>

    <!--
        NOTE: Load the version-specific settings for the .NET Framework 4.7.2?
              By default, this is disabled.  If this is enabled when compiling
              for the .NET Framework 4.7.2, the version-specific settings file
              "SQLite.NET.Settings.targets.netFx472" will be loaded if it is
              actually present, before any other settings in this file are
              processed.
    -->
    <NetFx472Settings Condition="'$(NetFx472Settings)' == ''">false</NetFx472Settings>

    <!--
        NOTE: Load the version-specific settings for the .NET Framework 4.8?
              By default, this is disabled.  If this is enabled when compiling
              for the .NET Framework 4.8, the version-specific settings file
              "SQLite.NET.Settings.targets.netFx48" will be loaded if it is
              actually present, before any other settings in this file are
              processed.
    -->
    <NetFx48Settings Condition="'$(NetFx48Settings)' == ''">false</NetFx48Settings>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                            Feature Properties                            **
  ******************************************************************************
  -->

  <PropertyGroup>
    <!--
        NOTE: Enable extra internal state checking for the public members of
              several key classes that use a connection.  By default, this is
              disabled.
    -->
    <CheckState Condition="'$(CheckState)' == ''">false</CheckState>

    <!--
        NOTE: Enable counting of all object instances for the CriticalHandle
              derived classes?  By default, this is disabled.  If this is
              enabled, this library will keep count of all non-disposed object
              instances for all the CriticalHandle derived classes.  Each
              counter will be incremented when an instance of the associated
              critical handle class is constructed and decremented when the
              ReleaseHandle method is completed successfully on an instance.
              These counts are intended to be used by the test suite to detect
              possible resource leaks.
    -->
    <CountHandle Condition="'$(CountHandle)' == ''">false</CountHandle>

    <!--
        NOTE: Enable tracking of all outstanding bytes allocated by the
              SQLiteMemory class.  By default, this is disabled.  If this is
              enabled, this library will keep track of all outstanding bytes
              allocated by the SQLiteMemory class.  This has the potential to
              slow down the library a bit.
    -->
    <TrackMemoryBytes Condition="'$(TrackMemoryBytes)' == ''">false</TrackMemoryBytes>

    <!--
        NOTE: For interaction with the native SQLite implementation, use the
              custom built interop DLL (i.e. "SQLite.Interop.dll")?  By default,
              this is enabled.  This property is mutually exclusive with the
              "UseSqliteStandard" one, below.  This should always be disabled in
              the project file that builds the NetModule target.
    -->
    <UseInteropDll Condition="'$(UseInteropDll)' == ''">true</UseInteropDll>

    <!--
        NOTE: For interaction with the native SQLite implementation, use the
              sqlite3_prepare_v2() function when preparing queries?  By default,
              this is enabled.  When using a native SQLite implementation prior
              to version 3.3.9, this must be disabled.
    -->
    <UsePrepareV2 Condition="'$(UsePrepareV2)' == ''">true</UsePrepareV2>

    <!--
        NOTE: For interaction with the native SQLite implementation, use the
              standard DLL (i.e. "sqlite3.dll")?  By default, this is disabled.
              This property is mutually exclusive with the "UseInteropDll" one,
              above.  This should always be disabled in the project file that
              builds the NetModule target.
    -->
    <UseSqliteStandard Condition="'$(UseSqliteStandard)' == ''">false</UseSqliteStandard>

    <!--
        NOTE: Is the project being built to support the .NET Compact Framework?
    -->
    <IsCompactFramework Condition="'$(IsCompactFramework)' == ''">false</IsCompactFramework>

    <!--
        NOTE: Is the project being built to support .NET Standard 2.0 / 2.1?
    -->
    <IsDotNetStandard Condition="'$(IsDotNetStandard)' == ''">false</IsDotNetStandard>

    <!--
        NOTE: Emit an AssemblyFlags attribute that includes the Retargetable
              flag from the AssemblyNameFlags enumeration?
    -->
    <IsRetargetable Condition="'$(IsRetargetable)' == ''">false</IsRetargetable>

    <!--
        NOTE: Throw an exception if an object has already been disposed?  By
              default, this is enabled.  If this is disabled, an exception will
              not be thrown when a SQLite object which has already been disposed
              is accessed.
    -->
    <ThrowOnDisposed Condition="'$(ThrowOnDisposed)' == ''">true</ThrowOnDisposed>

    <!--
        NOTE: *EXPERIMENTAL* Attempt to pre-load the native SQLite library?  By
              default, this is enabled.  If this is disabled, no attempt will be
              made to pre-load the native SQLite library appropriate to the
              processor architecture of the currently running process upon using
              the component.  This feature is experimental and may be modified
              or removed in a future release.
    -->
    <PreLoadNativeLibrary Condition="'$(PreLoadNativeLibrary)' == ''">true</PreLoadNativeLibrary>

    <!--
        NOTE: Enable using the "well-known" extension functions from the custom
              built interop DLL (i.e. "SQLite.Interop.dll")?  By default, this
              is enabled.  If this is disabled, the "well-known" extension
              functions will be unavailable.  If this is enabled, it must also
              be enabled via the "INTEROP_EXTENSION_FUNCTIONS=1" preprocessor
              define being present in the "INTEROP_EXTRA_DEFINES" macro in the
              build properties file:

                  "SQLite.Interop\props\SQLite.Interop.20YY.[vs]props"

              for the corresponding version(s) of Visual Studio.
    -->
    <InteropExtensionFunctions Condition="'$(InteropExtensionFunctions)' == ''">true</InteropExtensionFunctions>

    <!--
        NOTE: Enable the FTS5 extension from the custom built interop DLL
              (i.e. "SQLite.Interop.dll")?  By default, this is enabled.  If
              this is disabled, the FTS5 extension will be unavailable.  If
              this is enabled, it must also be enabled via the
              "INTEROP_FTS5_EXTENSION=1" preprocessor define being
              present in the "INTEROP_EXTRA_DEFINES" macro in the build
              properties file:

                  "SQLite.Interop\props\SQLite.Interop.20YY.[vs]props"

              for the corresponding version(s) of Visual Studio.
    -->
    <InteropFts5Extension Condition="'$(InteropFts5Extension)' == ''">true</InteropFts5Extension>

    <!--
        NOTE: Enable the JSON extension from the custom built interop DLL
              (i.e. "SQLite.Interop.dll")?  By default, this is enabled.  If
              this is disabled, the JSON extension will be unavailable.  If
              this is enabled, it must also be enabled via the
              "INTEROP_JSON1_EXTENSION=1" preprocessor define being
              present in the "INTEROP_EXTRA_DEFINES" macro in the build
              properties file:

                  "SQLite.Interop\props\SQLite.Interop.20YY.[vs]props"

              for the corresponding version(s) of Visual Studio.
    -->
    <InteropJson1Extension Condition="'$(InteropJson1Extension)' == ''">true</InteropJson1Extension>

    <!--
        NOTE: Enable the percentile extension from the custom built interop DLL
              (i.e. "SQLite.Interop.dll")?  By default, this is enabled.  If
              this is disabled, the percentile extension will be unavailable.
              If this is enabled, it must also be enabled via the
              "INTEROP_PERCENTILE_EXTENSION=1" preprocessor define being
              present in the "INTEROP_EXTRA_DEFINES" macro in the build
              properties file:

                  "SQLite.Interop\props\SQLite.Interop.20YY.[vs]props"

              for the corresponding version(s) of Visual Studio.
    -->
    <InteropPercentileExtension Condition="'$(InteropPercentileExtension)' == ''">true</InteropPercentileExtension>

    <!--
        NOTE: Enable the regular expression extension from the custom built
              interop DLL (i.e. "SQLite.Interop.dll")?  By default, this is
              enabled.  If this is disabled, the regular expression extension
              will be unavailable.  If this is enabled, it must also be enabled
              via the "INTEROP_REGEXP_EXTENSION=1" preprocessor define being
              present in the "INTEROP_EXTRA_DEFINES" macro in the build
              properties file:

                  "SQLite.Interop\props\SQLite.Interop.20YY.[vs]props"

              for the corresponding version(s) of Visual Studio.
    -->
    <InteropRegExpExtension Condition="'$(InteropRegExpExtension)' == ''">true</InteropRegExpExtension>

    <!--
        NOTE: Enable the SHA1 extension from the custom built interop DLL
              (i.e. "SQLite.Interop.dll")?  By default, this is enabled.  If
              this is disabled, the SHA1 extension will be unavailable.  If
              this is enabled, it must also be enabled via the
              "INTEROP_SHA1_EXTENSION=1" preprocessor define being
              present in the "INTEROP_EXTRA_DEFINES" macro in the build
              properties file:

                  "SQLite.Interop\props\SQLite.Interop.20YY.[vs]props"

              for the corresponding version(s) of Visual Studio.
    -->
    <InteropSha1Extension Condition="'$(InteropSha1Extension)' == ''">true</InteropSha1Extension>

    <!--
        NOTE: Enable the SHA3 extension from the custom built interop DLL
              (i.e. "SQLite.Interop.dll")?  By default, this is enabled.  If
              this is disabled, the SHA3 extension will be unavailable.  If
              this is enabled, it must also be enabled via the
              "INTEROP_SHA3_EXTENSION=1" preprocessor define being
              present in the "INTEROP_EXTRA_DEFINES" macro in the build
              properties file:

                  "SQLite.Interop\props\SQLite.Interop.20YY.[vs]props"

              for the corresponding version(s) of Visual Studio.
    -->
    <InteropSha3Extension Condition="'$(InteropSha3Extension)' == ''">true</InteropSha3Extension>

    <!--
        NOTE: Enable the test extension from the custom built interop DLL (i.e.
              "SQLite.Interop.dll")?  By default, this is enabled only in the
              Debug build configuration.  If this is disabled, the test
              extension will be unavailable.  If this is enabled, it must also
              be enabled via the "INTEROP_TEST_EXTENSION=1" preprocessor define
              being present in the "INTEROP_DEBUG_DEFINES" macro in the build
              properties file:

                  "SQLite.Interop\props\SQLite.Interop.20YY.[vs]props"

              for the corresponding version(s) of Visual Studio.
    -->
    <InteropTestExtension Condition="'$(InteropTestExtension)' == '' And '$(Configuration)' == 'Debug'">true</InteropTestExtension>
    <InteropTestExtension Condition="'$(InteropTestExtension)' == '' And '$(Configuration)' != 'Debug'">false</InteropTestExtension>

    <!--
        NOTE: Enable the numeric type checking extension from the custom built
              interop DLL (i.e. "SQLite.Interop.dll")?  By default, this is
              enabled.  If this is disabled, the numeric type checking
              extension will be unavailable.  If this is enabled, it must also
              be enabled via the "INTEROP_TOTYPE_EXTENSION=1" preprocessor
              define being present in the "INTEROP_EXTRA_DEFINES" macro in the
              build properties file:

                  "SQLite.Interop\props\SQLite.Interop.20YY.[vs]props"

              for the corresponding version(s) of Visual Studio.
    -->
    <InteropToTypeExtension Condition="'$(InteropToTypeExtension)' == ''">true</InteropToTypeExtension>

    <!--
        NOTE: Enable exposing the CryptoAPI-based (RC4) codec from the custom
              built interop DLL (i.e. "SQLite.Interop.dll")?  By default, this
              is now disabled.  If this is disabled, support for databases
              encrypted using the CryptoAPI-based (RC4) codec will be
              unavailable.  If this is enabled, it must also be enabled via the
              "SQLITE_HAS_CODEC=1" preprocessor define being present in the
              "SQLITE_EXTRA_DEFINES" macro in the build properties file:

                  "SQLite.Interop\props\sqlite3.[vs]props"

              AND via the "INTEROP_CODEC=1" preprocessor define being present in
              the "INTEROP_EXTRA_DEFINES" macro in the build properties file:

                  "SQLite.Interop\props\SQLite.Interop.20YY.[vs]props"

              both for the corresponding version(s) of Visual Studio.
    -->
    <InteropCodec Condition="'$(InteropCodec)' == ''">false</InteropCodec>

    <!--
        NOTE: Enable including SEE with the custom built interop DLL (i.e.
              "SQLite.Interop.dll")?  By default, this is disabled.  If this is
              enabled, the "see.c" file will be included from the extensions
              directory.  If this is enabled, it must also be enabled via the
              "SQLITE_HAS_CODEC=1" preprocessor define being present in the
              "SQLITE_EXTRA_DEFINES" macro in the build properties file:

                  "SQLite.Interop\props\sqlite3.[vs]props"

              AND via the "INTEROP_INCLUDE_SEE=1" preprocessor define being
              present in the "INTEROP_EXTRA_DEFINES" macro in the build
              properties file:

                  "SQLite.Interop\props\SQLite.Interop.20YY.[vs]props"

              both for the corresponding version(s) of Visual Studio.
    -->
    <InteropIncludeSee Condition="'$(InteropIncludeSee)' == ''">false</InteropIncludeSee>

    <!--
        NOTE: Enable including CEROD with the custom built interop DLL (i.e.
              "SQLite.Interop.dll")?  By default, this is disabled.  If this is
              enabled, the "cerod.c" file will be included from the extensions
              directory.  If this is enabled, it must also be enabled via the
              "SQLITE_ENABLE_CEROD=1" preprocessor define being present in the
              "SQLITE_EXTRA_DEFINES" macro in the build properties file:

                  "SQLite.Interop\props\sqlite3.[vs]props"

              AND via the "INTEROP_INCLUDE_CEROD=1" preprocessor define being
              present in the "INTEROP_EXTRA_DEFINES" macro in the build
              properties file:

                  "SQLite.Interop\props\SQLite.Interop.20YY.[vs]props"

              both for the corresponding version(s) of Visual Studio.
    -->
    <InteropIncludeCerod Condition="'$(InteropIncludeCerod)' == ''">false</InteropIncludeCerod>

    <!--
        NOTE: Enable including ZipVFS with the custom built interop DLL (i.e.
              "SQLite.Interop.dll")?  By default, this is disabled.  If this is
              enabled, the "zipvfs.c" file will be included from the extensions
              directory.  If this is enabled, it must also be enabled via the
              "SQLITE_ENABLE_ZIPVFS=1" preprocessor define being present in the
              "SQLITE_EXTRA_DEFINES" macro in the build properties file:

                  "SQLite.Interop\props\sqlite3.[vs]props"

              AND via the "INTEROP_INCLUDE_ZIPVFS=1" preprocessor define being
              present in the "INTEROP_EXTRA_DEFINES" macro in the build
              properties file:

                  "SQLite.Interop\props\SQLite.Interop.20YY.[vs]props"

              both for the corresponding version(s) of Visual Studio.
    -->
    <InteropIncludeZipVfs Condition="'$(InteropIncludeZipVfs)' == ''">false</InteropIncludeZipVfs>

    <!--
        NOTE: Enable including "extra" code with the custom built interop DLL
              (i.e. "SQLite.Interop.dll")?  By default, this is disabled.  If
              this is enabled, the "extra.c" file will be included from the
              extensions directory.  If this is enabled, it must also be
              enabled via the "INTEROP_INCLUDE_EXTRA=1" preprocessor define
              being present in the "INTEROP_EXTRA_DEFINES" macro in the build
              properties file:

                  "SQLite.Interop\props\SQLite.Interop.20YY.[vs]props"

              for the corresponding version(s) of Visual Studio.
    -->
    <InteropIncludeExtra Condition="'$(InteropIncludeExtra)' == ''">false</InteropIncludeExtra>

    <!--
        NOTE: Enable extra diagnostics from the custom built interop DLL (i.e.
              "SQLite.Interop.dll")?  By default, this is enabled in the Debug
              build configuration.  If this is disabled, no extra diagnostics
              will be emitted.  If this is enabled, it must also be enabled via
              the "INTEROP_DEBUG=XX" preprocessor define being present in the
              "INTEROP_DEBUG_DEFINES" macro in the build properties file:

                  "SQLite.Interop\props\SQLite.Interop.20YY.[vs]props"

              for the corresponding version(s) of Visual Studio where the XX is
              an integer value that represents a combination of one or more of
              the following bit flags values (i.e. to enable extra diagnostics
              for a particular native function call):

                  INTEROP_DEBUG_CLOSE          (0x0001)
                  INTEROP_DEBUG_FINALIZE       (0x0002)
                  INTEROP_DEBUG_BACKUP_FINISH  (0x0004)
                  INTEROP_DEBUG_OPEN           (0x0008)
                  INTEROP_DEBUG_OPEN16         (0x0010)
                  INTEROP_DEBUG_PREPARE        (0x0020)
                  INTEROP_DEBUG_PREPARE16      (0x0040)
                  INTEROP_DEBUG_RESET          (0x0080)
                  INTEROP_DEBUG_CHANGES        (0x0100)
                  INTEROP_DEBUG_BREAK          (0x0200)
    -->
    <InteropDebug Condition="'$(InteropDebug)' == '' And '$(Configuration)' == 'Debug'">true</InteropDebug>
    <InteropDebug Condition="'$(InteropDebug)' == '' And '$(Configuration)' != 'Debug'">false</InteropDebug>

    <!--
        NOTE: Disable all use of the sqlite3_close_v2() native API and use the
              legacy System.Data.SQLite connection closing algorithm instead.
              By default, this is disabled.  If this is enabled, it must also
              be enabled via the "INTEROP_LEGACY_CLOSE=1" preprocessor define
              being present in the "INTEROP_EXTRA_DEFINES" macro in the build
              properties file:

                  "SQLite.Interop\props\SQLite.Interop.20YY.[vs]props"

              for the corresponding version(s) of Visual Studio.
    -->
    <InteropLegacyClose Condition="'$(InteropLegacyClose)' == ''">false</InteropLegacyClose>

    <!--
        NOTE: Enable the logging callback in the custom built interop DLL (i.e.
              "SQLite.Interop.dll")?  By default, this is enabled in the Debug
              build configuration.  If this is disabled, the logging callback
              will be unavailable and diagnostic messages may not be seen if
              another native logging callback is not configured.  If this is
              enabled, it must also be enabled via the "INTEROP_LOG=1"
              preprocessor define being present in the "INTEROP_DEBUG_DEFINES"
              macro in the build properties file:

                  "SQLite.Interop\props\SQLite.Interop.20YY.[vs]props"

              for the corresponding version(s) of Visual Studio.
    -->
    <InteropLog Condition="'$(InteropLog)' == '' And '$(Configuration)' == 'Debug'">true</InteropLog>
    <InteropLog Condition="'$(InteropLog)' == '' And '$(Configuration)' != 'Debug'">false</InteropLog>

    <!--
        NOTE: Enable including the vtshim module as a statically available
              extension?  This will allow virtual tables to be implemented in
              managed code.  By default, this is enabled.  If this is disabled,
              support for implementing virtual tables in managed code will be
              unavailable.  If this is enabled, it must also be enabled via
              the "INTEROP_VIRTUAL_TABLE=1" preprocessor define being present
              in the "INTEROP_EXTRA_DEFINES" macro in the build properties
              file:

                  "SQLite.Interop\props\SQLite.Interop.20YY.[vs]props"

              both for the corresponding version(s) of Visual Studio.
    -->
    <InteropVirtualTable Condition="'$(InteropVirtualTable)' == ''">true</InteropVirtualTable>

    <!--
        NOTE: Enable including the session module as a statically available
              extension?  By default, this is enabled.  If this is disabled,
              support for using the session module in managed code will be
              unavailable.  If this is enabled, it must also be enabled via
              the "INTEROP_SESSION_EXTENSION=1" preprocessor define being
              present in the "INTEROP_EXTRA_DEFINES" macro in the build
              properties file:

                  "SQLite.Interop\props\SQLite.Interop.20YY.[vs]props"

              both for the corresponding version(s) of Visual Studio.
    -->
    <InteropSessionExtension Condition="'$(InteropSessionExtension)' == ''">true</InteropSessionExtension>

    <!--
        NOTE: Enable the use of native Windows APIs, when available?  By
              default, this is enabled.  If this is disabled, all features
              that require the use of native Windows APIs will be unavailable.
    -->
    <UseWindows Condition="'$(UseWindows)' == ''">true</UseWindows>

    <!--
        NOTE: For interaction with the Entity Framework, assume version 6 or
              higher?  By default, this is disabled.  If this is enabled, the
              "System.Data.SQLite.Linq" assembly will not work with any Entity
              Framework prior to version 6.
    -->
    <UseEntityFramework6 Condition="'$(UseEntityFramework6)' == ''">false</UseEntityFramework6>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                             Trace Properties                             **
  ******************************************************************************
  -->

  <PropertyGroup>
    <!--
        NOTE: Enable tracing of events related to connection handling?  By
              default, this is disabled.
    -->
    <TraceConnection Condition="'$(TraceConnection)' == ''">false</TraceConnection>

    <!--
        NOTE: Enable tracing of events related to automatic detection of the
              native library directory within the native library pre-loading
              code?  By default, this is disabled.
    -->
    <TraceDetection Condition="'$(TraceDetection)' == ''">false</TraceDetection>

    <!--
        NOTE: Enable tracing of events related to CriticalHandle handling?  By
              default, this is disabled.
    -->
    <TraceHandle Condition="'$(TraceHandle)' == ''">false</TraceHandle>

    <!--
        NOTE: Enable tracing of events related to the native library pre-loading
              code?  By default, this is enabled.
    -->
    <TracePreLoad Condition="'$(TracePreLoad)' == ''">true</TracePreLoad>

    <!--
        NOTE: Enable tracing of events related to the shared native library
              pre-loading code?  By default, this is enabled.
    -->
    <TraceShared Condition="'$(TraceShared)' == ''">true</TraceShared>

    <!--
        NOTE: Enable tracing of events related to the prepared statements?  By
              default, this is disabled.
    -->
    <TraceStatement Condition="'$(TraceStatement)' == ''">false</TraceStatement>

    <!--
        NOTE: Enable tracing of potentially important, but non-fatal error
              conditions that cannot be reported another way?  By default, this
              is enabled.
    -->
    <TraceWarning Condition="'$(TraceWarning)' == ''">true</TraceWarning>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                            Warning Properties                            **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <!--
        NOTE: Debug build.  Set the warning level to maximum.  Also, disable
              warnings that tend to cause too much noise.
    -->
    <WarningLevel>4</WarningLevel>
    <NoWarn>618,1591;3001</NoWarn>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)' == 'Release'">
    <!--
        NOTE: Release build.  Set the warning level to maximum.  Also, disable
              warnings that tend to cause too much noise.
    -->
    <WarningLevel>4</WarningLevel>
    <NoWarn>618,1591;3001</NoWarn>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                      Build Configuration Properties                      **
  ******************************************************************************
  -->

  <PropertyGroup>
    <!--
        NOTE: The suffix for the name of the build configuration directory .  By
              default, this is an empty string.
    -->
    <ConfigurationSuffix Condition="'$(ConfigurationSuffix)' == ''"></ConfigurationSuffix>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                         Relative Path Properties                         **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(SQLiteNetDir)' != '' And '$(IsDotNetStandard)' == 'false'">
    <!--
        NOTE: Keep all the intermediate files in one place.  The Visual Studio
              IDE seems to have a nasty habit of ignoring this setting.  The
              Visual Studio IDE then fails to build the project(s) properly when
              the output does not end up where it expects the output to be.  The
              value of this property must have a trailing backslash.
    -->
    <BaseIntermediateOutputPath Condition="'$(ConfigurationSuffix)' == ''">$(SQLiteNetDir)\obj\$(ConfigurationYear)\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
    <BaseIntermediateOutputPath Condition="'$(ConfigurationSuffix)' != ''">$(SQLiteNetDir)\obj\$(ConfigurationYear)\$(MSBuildProjectName)\$(ConfigurationSuffix)\</BaseIntermediateOutputPath>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                Per-Configuration Relative Path Properties                **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(SQLiteNetDir)' != '' And '$(Configuration)' != ''">
    <!--
        NOTE: The final output files need to end up in one place.  The value of
              this property must have a trailing backslash.
    -->
    <BinaryOutputPath Condition="'$(BinaryOutputPath)' == ''">$(SQLiteNetDir)\bin\$(ConfigurationYear)\$(Configuration)$(ConfigurationSuffix)\bin\</BinaryOutputPath>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                      Strong Name Signing Properties                      **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(SQLiteStrongNameSign)' != 'false' And
                            '$(SQLiteNetDir)' != '' And
                            !HasTrailingSlash('$(SQLiteNetDir)') And
                            (('$(IsCompactFramework)' == 'false' And Exists('$(SQLiteNetDir)\Keys\System.Data.SQLite.snk')) Or
                             ('$(IsCompactFramework)' != 'false' And Exists('$(SQLiteNetDir)\Keys\System.Data.SQLite.CF.snk')))">
    <!--
        NOTE: Sign the assembly?  By default, this is enabled.
    -->
    <SignAssembly Condition="'$(SignAssembly)' == ''">true</SignAssembly>

    <!--
        NOTE: Use delay signing?  By default, this is disabled because the
              default strong name key pair is included with the source code.
    -->
    <DelaySign Condition="'$(DelaySign)' == ''">false</DelaySign>

    <!--
        NOTE: The full path and file name for the strong name key pair to use.
    -->
    <AssemblyOriginatorKeyFile Condition="'$(AssemblyOriginatorKeyFile)' == '' And '$(IsCompactFramework)' == 'false'">$(SQLiteNetDir)\Keys\System.Data.SQLite.snk</AssemblyOriginatorKeyFile>
    <AssemblyOriginatorKeyFile Condition="'$(AssemblyOriginatorKeyFile)' == '' And '$(IsCompactFramework)' != 'false'">$(SQLiteNetDir)\Keys\System.Data.SQLite.CF.snk</AssemblyOriginatorKeyFile>
  </PropertyGroup>
</Project>

Added Targets/SQLite.NET.Settings.targets.netFx35.







































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!--
 *
 * SQLite.NET.Settings.targets.netFx35 -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **                          Load Per-User Settings                          **
  ******************************************************************************
  -->

  <!--
      NOTE: If the per-user settings file exists, import it now.  The contained
            settings, if any, will override the default ones provided below.
  -->
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx35.user"
          Condition="'$(ConfigurationYear)' != '' And
                     '$(ConfigurationYear)' != '2005' And
                     '$(ConfigurationYear)' != '2008' And
                     Exists('$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx35.user')" />

  <!--
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(ConfigurationYear)' != '' And
                            '$(ConfigurationYear)' != '2005' And
                            '$(ConfigurationYear)' != '2008'">
    <NetFx20>true</NetFx20>
    <NetFx35>true</NetFx35>
    <NetFx40>false</NetFx40>
    <NetFx45>false</NetFx45>
    <NetFx451>false</NetFx451>
    <NetFx452>false</NetFx452>
    <NetFx46>false</NetFx46>
    <NetFx461>false</NetFx461>
    <NetFx462>false</NetFx462>
    <NetFx47>false</NetFx47>
    <NetFx471>false</NetFx471>
    <NetFx472>false</NetFx472>
    <NetFx48>false</NetFx48>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    <TargetFrameworkProfile></TargetFrameworkProfile>
    <Prefer32Bit>false</Prefer32Bit>
    <!-- <PlatformToolset>v110</PlatformToolset> -->
  </PropertyGroup>
</Project>

Added Targets/SQLite.NET.Settings.targets.netFx40.













































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!--
 *
 * SQLite.NET.Settings.targets.netFx40 -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **                          Load Per-User Settings                          **
  ******************************************************************************
  -->

  <!--
      NOTE: If the per-user settings file exists, import it now.  The contained
            settings, if any, will override the default ones provided below.
  -->
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx40.user"
          Condition="('$(ConfigurationYear)' == '2010' Or
                      '$(ConfigurationYear)' == '2012' Or
                      '$(ConfigurationYear)' == '2013' Or
                      '$(ConfigurationYear)' == '2015' Or
                      '$(ConfigurationYear)' == '2017') And
                     Exists('$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets.netFx40.user')" />

  <!--
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(ConfigurationYear)' == '2010' Or
                            '$(ConfigurationYear)' == '2012' Or
                            '$(ConfigurationYear)' == '2013' Or
                            '$(ConfigurationYear)' == '2015' Or
                            '$(ConfigurationYear)' == '2017'">
    <NetFx20>false</NetFx20>
    <NetFx35>false</NetFx35>
    <NetFx40>true</NetFx40>
    <NetFx45>false</NetFx45>
    <NetFx451>false</NetFx451>
    <NetFx452>false</NetFx452>
    <NetFx46>false</NetFx46>
    <NetFx461>false</NetFx461>
    <NetFx462>false</NetFx462>
    <NetFx47>false</NetFx47>
    <NetFx471>false</NetFx471>
    <NetFx472>false</NetFx472>
    <NetFx48>false</NetFx48>
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
    <Prefer32Bit>false</Prefer32Bit>
    <!-- <PlatformToolset>v100</PlatformToolset> -->
  </PropertyGroup>
</Project>

Added Targets/SQLite.NET.targets.

















































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
<!--
 *
 * SQLite.NET.targets -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <!--
  ******************************************************************************
  **                          Load Per-User Settings                          **
  ******************************************************************************
  -->

  <!--
      NOTE: If the per-user settings file exists, import it now.  The contained
            settings, if any, will override the default ones provided below.
  -->
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets.user"
          Condition="Exists('$(SQLiteNetDir)\Targets\SQLite.NET.targets.user')" />

  <!--
  ******************************************************************************
  **                         [Fairly] Generic Targets                         **
  ******************************************************************************
  -->

  <Target Name="EmbedExeManifest"
          Condition="'$(EmbedExeManifest)' != 'false' And
                     '$(MSBuildProjectDirectory)' != '' And
                     Exists('$(MSBuildProjectDirectory)\Resources\manifest.xml')"
          Inputs="$(TargetPath);$(MSBuildProjectDirectory)\Resources\manifest.xml"
          Outputs="$(TargetPath).EmbedExeManifest.done">
    <GetFrameworkSDKPath>
      <Output TaskParameter="Path"
              PropertyName="DirForManifestTool" />
    </GetFrameworkSDKPath>

    <Exec Condition="'$(DirForManifestTool)' != '' And
                     HasTrailingSlash('$(DirForManifestTool)') And
                     Exists('$(DirForManifestTool)bin\mt.exe')"
          Command="&quot;$(DirForManifestTool)bin\mt.exe&quot; -manifest &quot;$(MSBuildProjectDirectory)\Resources\manifest.xml&quot; -outputresource:&quot;$(TargetPath)&quot;;1" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).EmbedExeManifest.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="StrongNameSignFrameworkTargetPath"
          Condition="'$(StrongNameSignFrameworkTargetPath)' != 'false' And
                     '$(SignAssembly)' != 'false' And
                     Exists('$(AssemblyOriginatorKeyFile)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).StrongNameSign.done">
    <GetFrameworkSDKPath>
      <Output TaskParameter="Path"
              PropertyName="DirForStrongName" />
    </GetFrameworkSDKPath>

    <Exec Condition="'$(DirForStrongName)' != '' And
                     HasTrailingSlash('$(DirForStrongName)') And
                     Exists('$(DirForStrongName)bin\sn.exe')"
          Command="&quot;$(DirForStrongName)bin\sn.exe&quot; -Ra &quot;$(TargetPath)&quot; &quot;$(AssemblyOriginatorKeyFile)&quot;" />

    <Touch Condition="'$(DirForStrongName)' != '' And
                      HasTrailingSlash('$(DirForStrongName)') And
                      Exists('$(DirForStrongName)bin\sn.exe')"
           AlwaysCreate="true"
           Files="$(TargetPath).StrongNameSign.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="StrongNameSignSdkToolsTargetPath"
          Condition="'$(StrongNameSignSdkToolsTargetPath)' != 'false' And
                     '$(SignAssembly)' != 'false' And
                     Exists('$(AssemblyOriginatorKeyFile)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).StrongNameSign.done">
    <Exec Condition="'$(TargetFrameworkSDKToolsDirectory)' != '' And
                     HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And
                     Exists('$(TargetFrameworkSDKToolsDirectory)sn.exe')"
          Command="&quot;$(TargetFrameworkSDKToolsDirectory)sn.exe&quot; -Ra &quot;$(TargetPath)&quot; &quot;$(AssemblyOriginatorKeyFile)&quot;" />

    <Touch Condition="'$(TargetFrameworkSDKToolsDirectory)' != '' And
                      HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And
                      Exists('$(TargetFrameworkSDKToolsDirectory)sn.exe')"
           AlwaysCreate="true"
           Files="$(TargetPath).StrongNameSign.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CloneAndMark32BitOnlyFrameworkTargetName32"
          Condition="'$(CloneAndMark32BitOnlyFrameworkTargetName32)' != 'false'"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CloneAndMark32BitOnly.done">
    <GetFrameworkSDKPath>
      <Output TaskParameter="Path"
              PropertyName="DirForCloneAndMark32BitOnly" />
    </GetFrameworkSDKPath>

    <Copy SourceFiles="$(TargetPath)"
          DestinationFiles="$(TargetDir)$(TargetName)32$(TargetExt)" />

    <Copy SourceFiles="$(TargetPath).config"
          DestinationFiles="$(TargetDir)$(TargetName)32$(TargetExt).config"
          Condition="Exists('$(TargetPath).config')" />

    <Exec Condition="'$(DirForCloneAndMark32BitOnly)' != '' And
                     HasTrailingSlash('$(DirForCloneAndMark32BitOnly)') And
                     Exists('$(DirForCloneAndMark32BitOnly)bin\CorFlags.exe')"
          Command="&quot;$(DirForCloneAndMark32BitOnly)bin\CorFlags.exe&quot; &quot;$(TargetDir)$(TargetName)32$(TargetExt)&quot; /32BIT+ /Force 1&gt;NUL" />

    <Exec Condition="'$(DirForCloneAndMark32BitOnly)' != '' And
                     HasTrailingSlash('$(DirForCloneAndMark32BitOnly)') And
                     Exists('$(DirForCloneAndMark32BitOnly)bin\sn.exe')"
          Command="&quot;$(DirForCloneAndMark32BitOnly)bin\sn.exe&quot; -Ra &quot;$(TargetDir)$(TargetName)32$(TargetExt)&quot; &quot;$(AssemblyOriginatorKeyFile)&quot;" />

    <Touch Condition="'$(DirForCloneAndMark32BitOnly)' != '' And
                      HasTrailingSlash('$(DirForCloneAndMark32BitOnly)') And
                      Exists('$(DirForCloneAndMark32BitOnly)bin\CorFlags.exe') And
                      Exists('$(DirForCloneAndMark32BitOnly)bin\sn.exe')"
           AlwaysCreate="true"
           Files="$(TargetPath).CloneAndMark32BitOnly.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CloneAndMark32BitOnlySdkToolsTargetName32"
          Condition="'$(CloneAndMark32BitOnlySdkToolsTargetName32)' != 'false'"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CloneAndMark32BitOnly.done">
    <Copy SourceFiles="$(TargetPath)"
          DestinationFiles="$(TargetDir)$(TargetName)32$(TargetExt)" />

    <Copy SourceFiles="$(TargetPath).config"
          DestinationFiles="$(TargetDir)$(TargetName)32$(TargetExt).config"
          Condition="Exists('$(TargetPath).config')" />

    <Exec Condition="'$(TargetFrameworkSDKToolsDirectory)' != '' And
                     HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And
                     Exists('$(TargetFrameworkSDKToolsDirectory)CorFlags.exe')"
          Command="&quot;$(TargetFrameworkSDKToolsDirectory)CorFlags.exe&quot; &quot;$(TargetDir)$(TargetName)32$(TargetExt)&quot; /32BIT+ /Force 1&gt;NUL" />

    <Exec Condition="'$(TargetFrameworkSDKToolsDirectory)' != '' And
                     HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And
                     Exists('$(TargetFrameworkSDKToolsDirectory)sn.exe')"
          Command="&quot;$(TargetFrameworkSDKToolsDirectory)sn.exe&quot; -Ra &quot;$(TargetDir)$(TargetName)32$(TargetExt)&quot; &quot;$(AssemblyOriginatorKeyFile)&quot;" />

    <Touch Condition="'$(TargetFrameworkSDKToolsDirectory)' != '' And
                      HasTrailingSlash('$(TargetFrameworkSDKToolsDirectory)') And
                      Exists('$(TargetFrameworkSDKToolsDirectory)CorFlags.exe') And
                      Exists('$(TargetFrameworkSDKToolsDirectory)sn.exe')"
           AlwaysCreate="true"
           Files="$(TargetPath).CloneAndMark32BitOnly.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CleanConfigurations"
          Condition="'$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')">
    <CreateItem Include="$(OutputPath)*.config">
      <Output ItemName="CleanConfigurationsItem" TaskParameter="Include" />
    </CreateItem>

    <Delete Condition="'@(CleanConfigurationsItem)' != ''"
            Files="@(CleanConfigurationsItem)" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CopyConfigurations"
          Condition="'$(CopyConfigurations)' != 'false' And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyConfigurations.done">
    <CreateItem Include="Configurations\*.config" Exclude="Configurations\no_*">
      <Output ItemName="CopyConfigurationsItem" TaskParameter="Include" />
    </CreateItem>

    <Copy SourceFiles="@(CopyConfigurationsItem)"
          DestinationFolder="$(OutputPath)" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyConfigurations.done" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="WrongNetFx"
          Condition="'$(ProjectName)' != ''">
    <Warning Text="Version mismatch for the .NET Framework, skipping project &quot;$(ProjectName)&quot;..." />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="MissingVsSdk"
          Condition="'$(ProjectName)' != ''">
    <Warning Text="The Visual Studio SDK is missing, skipping project &quot;$(ProjectName)&quot;..." />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="ReSignMixedModeAssembly"
          Condition="'$(ReSignMixedModeAssembly)' != 'false' And
                     '$(TargetPath)' != '' And
                     Exists('$(TargetPath)') And
                     '$(INTEROP_KEY_FILE)' != '' And
                     Exists('$(INTEROP_KEY_FILE)')">
    <Exec Condition="'$(TargetFrameworkSDKToolsDirectory)' == '' And
                     '$(FrameworkSDKDir)' != '' And
                     Exists('$(FrameworkSDKDir)Bin\sn.exe')"
          Command="&quot;$(FrameworkSDKDir)Bin\sn.exe&quot; -Ra &quot;$(TargetPath)&quot; &quot;$(INTEROP_KEY_FILE)&quot;" />

    <Exec Condition="'$(TargetFrameworkSDKToolsDirectory)' != '' And
                     Exists('$(TargetFrameworkSDKToolsDirectory)sn.exe')"
          Command="&quot;$(TargetFrameworkSDKToolsDirectory)sn.exe&quot; -Ra &quot;$(TargetPath)&quot; &quot;$(INTEROP_KEY_FILE)&quot;" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="CopyInteropAssembly"
          Condition="'$(CopyInteropAssembly)' != 'false' And
                     '$(OutDir)' != '' And
                     HasTrailingSlash('$(OutDir)') And
                     '$(TargetName)' != '' And
                     '$(BaseConfiguration)' != '' And
                     '$(Platform)' != ''">
    <Exec Command="XCOPY &quot;$(OutDir)$(TargetName).*&quot; &quot;$(OutDir)..\..\$(BaseConfiguration)\bin\$(Platform)\&quot; /D /E /V /I /F /H /Y" />

    <Exec Condition="'$(DoesMachineMatchPlatform)' != 'false'"
          Command="XCOPY &quot;$(OutDir)$(TargetName).*&quot; &quot;$(OutDir)..\..\$(BaseConfiguration)\bin\&quot; /D /E /V /I /F /H /Y" />
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="DetectBuildTool"
          Condition="'$(DetectBuildTool)' != 'false' And
                     '$(MSBuildBinPath)' != '' And
                     !HasTrailingSlash('$(MSBuildBinPath)')">
    <CreateProperty Condition="Exists('$(MSBuildBinPath)\MSBuild.exe')"
                    Value="MSBuild">
      <Output TaskParameter="Value" PropertyName="BuildTool" />
    </CreateProperty>

    <CreateProperty Condition="Exists('$(MSBuildBinPath)\xbuild.exe')"
                    Value="XBuild">
      <Output TaskParameter="Value" PropertyName="BuildTool" />
    </CreateProperty>

    <CreateProperty Condition="Exists('$(MSBuildBinPath)\MSBuild.dll')"
                    Value="DotNetCore">
      <Output TaskParameter="Value" PropertyName="BuildTool" />
    </CreateProperty>

    <CreateProperty Condition="!Exists('$(MSBuildBinPath)\MSBuild.exe') And
                               !Exists('$(MSBuildBinPath)\xbuild.exe') And
                               !Exists('$(MSBuildBinPath)\MSBuild.dll')"
                    Value="Unknown">
      <Output TaskParameter="Value" PropertyName="BuildTool" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="DetectOperatingSystem"
          Condition="'$(DetectOperatingSystem)' != 'false'">
    <CreateProperty Condition="'$(OS)' == 'Windows_NT'" Value="Windows">
      <Output TaskParameter="Value" PropertyName="OperatingSystem" />
    </CreateProperty>

    <CreateProperty Condition="'$(OS)' == 'Unix'" Value="Unix">
      <Output TaskParameter="Value" PropertyName="OperatingSystem" />
    </CreateProperty>

    <CreateProperty Condition="'$(OS)' == 'OSX'" Value="MacOSX">
      <Output TaskParameter="Value" PropertyName="OperatingSystem" />
    </CreateProperty>

    <CreateProperty Condition="'$(OS)' != 'Windows_NT' And
                               '$(OS)' != 'Unix' And
                               '$(OS)' != 'OSX'"
                    Value="Unknown">
      <Output TaskParameter="Value" PropertyName="OperatingSystem" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  **                        Visual Studio 2017 Targets                        **
  ******************************************************************************
  -->

  <Target Name="MaybeFindVsSdk2017"
          Condition="'$(MaybeFindVsSdk2017)' != 'false' And
                     '$(MSBuildProjectDirectory)' != '' And
                     !HasTrailingSlash('$(MSBuildProjectDirectory)') And
                     Exists('$(MSBuildProjectDirectory)\..\Externals\vswhere\vswhere.exe')">
    <!--
        HACK: Use a couple undocumented properties of the Exec task in order
              to capture the console output of the "vswhere" command.  This
              is needed to locate the SDK for Visual Studio 2017.  For more
              information, see:

              https://stackoverflow.com/questions/8938679
    -->
    <Exec ConsoleToMSBuild="true" Command="&quot;$(MSBuildProjectDirectory)\..\Externals\vswhere\vswhere.exe&quot; -version 15.0 -products * -requires Microsoft.VisualStudio.Component.VSSDK -property installationPath -latest"
          WorkingDirectory="$(MSBuildProjectDirectory)\..\Externals\vswhere">
      <Output TaskParameter="ConsoleOutput" PropertyName="VS150INSTALLATIONPATH" />
    </Exec>

    <CreateProperty Condition="'$(VS150INSTALLATIONPATH)' != '' And
                               !HasTrailingSlash('$(VS150INSTALLATIONPATH)') And
                               Exists('$(VS150INSTALLATIONPATH)\VSSDK')"
                    Value="$(VS150INSTALLATIONPATH)\VSSDK\">
      <Output TaskParameter="Value" PropertyName="VSSDK150Install" />
    </CreateProperty>
  </Target>

  <!--
  ******************************************************************************
  -->

  <Target Name="MaybeMissingVsSdk2017"
          Condition="'$(MaybeMissingVsSdk2017)' != 'false' And
                     ('$(VSSDK150Install)' == '' Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.Data.ConnectionUI.dll') Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.dll') Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Data.Services.dll') Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.OLE.Interop.dll') Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Shell.15.0.dll') Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.dll') Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.8.0.dll') Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.9.0.dll') Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v2.0\Microsoft.VisualStudio.Shell.Interop.10.0.dll') Or
                      !Exists('$(VSSDK150Install)VisualStudioIntegration\Common\Assemblies\v4.0\Microsoft.VisualStudio.Shell.Interop.15.3.DesignTime.dll'))">
    <!--
        NOTE: We cannot build this project without the necessary reference
              assemblies; therefore, skip building it altogether.
    -->
    <CreateProperty Value="MissingVsSdk">
      <Output TaskParameter="Value" PropertyName="BuildDependsOn" />
    </CreateProperty>
  </Target>
</Project>

Added Tests/all.eagle.





























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
###############################################################################
#
# all.eagle --
#
# This file contains a top-level script to run all of the tests.
# Execute it by invoking "source all.eagle".
#
# Extensible Adaptable Generalized Logic Engine (Eagle)
# Test Suite File
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

#
# NOTE: Pre-load the assembly and the necessary helper procedures now, so that
#       they do not count as being "leaked" (i.e. the test framework has no way
#       to know who procedures actually belong to).
#
package require System.Data.SQLite.Test
runSQLiteTestPrologue
runSQLiteTestFilesPrologue
runSQLiteTestExtraPrologue

###############################################################################

set no(prologue.eagle) true
set no(epilogue.eagle) true

#
# NOTE: Run the local test prologue, if any.
#
if {[file exists [file join $path prologue.eagle]]} then {
  source [file join $path prologue.eagle]
}

#
# NOTE: Run all the unit tests.
#
set test_time [time {
  runAllTests $test_channel $path \
      [getTestFiles [list $path test_extra_paths] \
      $test_flags(-file) $test_flags(-notFile)] \
      [list [file tail [info script]] \
      *.tcl epilogue.eagle prologue.eagle] \
      $test_flags(-startFile) $test_flags(-stopFile)
}]

#
# NOTE: Run the local test epilogue, if any.
#
if {[file exists [file join $path epilogue.eagle]]} then {
  source [file join $path epilogue.eagle]
}

tputs $test_channel [appendArgs "---- all tests completed in " $test_time \n]
unset test_time

unset no(epilogue.eagle)
unset no(prologue.eagle)

if {[array size no] == 0} then {unset no}

###############################################################################

runSQLiteTestExtraEpilogue
runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue

Added Tests/authorizer.eagle.



















































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
###############################################################################
#
# authorizer.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test authorizer-1.1 {SQLiteConnection Authorize event} -setup {
  proc onAuthorize { sender e } {
    #
    # NOTE: Filter out the "noise" by allowing all standard
    #       events on the "sqlite_*" tables.
    #
    set noiseActionCodes [list \
        CreateTable CreateIndex Read Insert Update Delete]

    if {[$e ActionCode] in $noiseActionCodes && \
        [string match sqlite_* [$e Argument1]]} then {
      return
    }

    #
    # NOTE: Filter out all "non-primary" events to make the test
    #       results more deterministic in the face of different
    #       query plans.
    #
    if {[$e ActionCode] ne $::filter} then {
      return
    }

    #
    # NOTE: Record the authorizer arguments exactly as we received
    #       them.
    #
    lappend ::data [list \
        [$e UserData] [$e ActionCode] [$e Argument1] \
        [$e Argument2] [$e Database] [$e Context]]

    #
    # NOTE: Deny all attempts to create a table named "tDeny".
    #
    if {[$e ActionCode] eq "CreateTable" && \
        [$e Argument1] eq "tDeny"} then {
      $e ReturnCode Deny
    }
  }

  setupDb [set fileName authorizer-1.1.db]
} -body {
  set connection [getDbConnection]

  set callback onAuthorize
  object invoke $connection add_Authorize $callback

  set results [list]

  set sql [list \
    CreateTable       {CREATE TABLE t1(x);} \
    CreateIndex       {CREATE INDEX i1 ON t1(x);} \
    CreateTrigger     {CREATE TRIGGER tr1 BEFORE INSERT ON t1
                       BEGIN
                         SELECT RAISE(IGNORE);
                       END;} \
    CreateView        {CREATE VIEW v1 AS SELECT * FROM t1;} \
    CreateTempTable   {CREATE TEMPORARY TABLE t2(x);} \
    CreateTempIndex   {CREATE INDEX i2 ON t2(x);} \
    CreateTempTrigger {CREATE TEMPORARY TRIGGER tr2 BEFORE INSERT ON t2
                       BEGIN
                         SELECT RAISE(IGNORE);
                       END;} \
    CreateTempView    {CREATE TEMPORARY VIEW v2 AS SELECT * FROM t2;} \
    Pragma            {PRAGMA journal_mode=WAL;} \
    Function          {SELECT julianday('now');} \
    Read              {SELECT x FROM t1;} \
    Select            {SELECT * FROM t1;} \
    Insert            {INSERT INTO t1(x) VALUES(1);} \
    Update            {UPDATE t1 SET x = x - 1;} \
    Delete            {DELETE FROM t1;} \
    AlterTable        {ALTER TABLE t1 ADD COLUMN y;} \
    Reindex           {REINDEX t1;} \
    Analyze           {ANALYZE t1;} \
    DropTempView      {DROP VIEW v2;} \
    DropTempTrigger   {DROP TRIGGER tr2;} \
    DropTempIndex     {DROP INDEX i2;} \
    DropTempTable     {DROP TABLE t2;} \
    DropView          {DROP VIEW v1;} \
    DropTrigger       {DROP TRIGGER tr1;} \
    DropIndex         {DROP INDEX i1;} \
    Recursive         {WITH t4(x) AS (
                         VALUES(1)
                         UNION ALL
                         SELECT t1.x FROM t1, t4 WHERE t1.x = t4.x
                       )
                       SELECT x FROM t4;} \
    DropTable         {DROP TABLE t1;} \
    Transaction       {BEGIN; SELECT 0; COMMIT;} \
    Savepoint         {SAVEPOINT s1; RELEASE SAVEPOINT s1;} \
    Attach            {ATTACH DATABASE ':memory:' AS d1;} \
    Detach            {DETACH DATABASE d1;} \
    CreateVtable      {CREATE VIRTUAL TABLE t3 USING fts3(x TEXT);} \
    DropVtable        {DROP TABLE t3;} \
    CreateTable       {CREATE TABLE tDeny(x);}]

  foreach {name value} $sql {
    set filter $name; set data [list]
    set code [catch {sql execute $db $value} result]
    set result [extractSystemDataSQLiteExceptionMessage $result]
    set result [lindex [split [string map [list \r\n \n] $result] \n] 0]
    lappend results [list $name $data $code $result]
  }

  lappend results [isTableInDb tDeny]; set results
} -cleanup {
  catch {object invoke $connection remove_Authorize $callback}
  catch {object removecallback $callback}

  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain result code data filter value name sql results callback \
      connection db fileName

  rename onAuthorize ""
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{CreateTable {{0 CreateTable t1 {} main {}}} 0 0}\
{CreateIndex {{0 CreateIndex i1 t1 main {}}} 0 0} {CreateTrigger {{0\
CreateTrigger tr1 t1 main {}}} 0 0} {CreateView {{0 CreateView v1 {} main {}}}\
0 0} {CreateTempTable {{0 CreateTempTable t2 {} temp {}}} 0 0} {CreateTempIndex\
{{0 CreateTempIndex i2 t2 temp {}}} 0 0} {CreateTempTrigger {{0\
CreateTempTrigger tr2 t2 temp {}}} 0 0} {CreateTempView {{0 CreateTempView v2\
{} temp {}}} 0 0} {Pragma {{0 Pragma journal_mode WAL {} {}}} 0 0} {Function\
{{0 Function {} julianday {} {}}} 0 -1} {Read {{0 Read t1 x main {}}} 0 -1}\
{Select {{0 Select {} {} {} {}}} 0 -1} {Insert {{0 Insert t1 {} main {}}} 0 0}\
{Update {{0 Update t1 x main {}}} 0 0} {Delete {{0 Delete t1 {} main {}}} 0 0}\
{AlterTable {{0 AlterTable main t1 {} {}}} 0 0} {Reindex {{0 Reindex i1 {} main\
{}}} 0 0} {Analyze {{0 Analyze t1 {} main {}}} 0 0} {DropTempView {{0\
DropTempView v2 {} temp {}}} 0 0} {DropTempTrigger {{0 DropTempTrigger tr2 t2\
temp {}}} 0 0} {DropTempIndex {{0 DropTempIndex i2 t2 temp {}}} 0 0}\
{DropTempTable {{0 DropTempTable t2 {} temp {}}} 0 0} {DropView {{0 DropView v1\
{} main {}}} 0 0} {DropTrigger {{0 DropTrigger tr1 t1 main {}}} 0 0} {DropIndex\
{{0 DropIndex i1 t1 main {}}} 0 0} {Recursive {{0 Recursive {} {} {} t4}} 0 -1}\
{DropTable {{0 DropTable t1 {} main {}}} 0 0} {Transaction {{0 Transaction\
BEGIN {} {} {}} {0 Transaction COMMIT {} {} {}}} 0 -1} {Savepoint {{0 Savepoint\
BEGIN s1 {} {}} {0 Savepoint RELEASE s1 {} {}}} 0 -1} {Attach {{0 Attach\
:memory: {} {} {}}} 0 -1} {Detach {{0 Detach d1 {} {} {}}} 0 -1} {CreateVtable\
{{0 CreateVtable t3 fts3 main {}}} 0 0} {DropVtable {{0 DropVtable t3 fts3 main\
{}}} 0 0} {CreateTable {{0 CreateTable tDeny {} main {}}} 1 {authorization\
denied -- not authorized}} False}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/backup.eagle.

































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
###############################################################################
#
# backup.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

checkForSQLiteDirectories $test_channel
getSQLiteHandleCounts $test_channel
reportSQLiteResources $test_channel

###############################################################################

set params(pages) [list -1 -1 0 0 1 1 2 2 1000 1000]

set params(callbacks) [list null "new SQLiteBackupCallback(BackupCallback)" \
                            null "new SQLiteBackupCallback(BackupCallback)" \
                            null "new SQLiteBackupCallback(BackupCallback)" \
                            null "new SQLiteBackupCallback(BackupCallback)" \
                            null "new SQLiteBackupCallback(BackupCallback)"]

set params(results) [list \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} 0\$" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} 0\$" \
    "1 \\{SQL logic error( or missing database)? -- no such table: t1" \
    "1 \\{SQL logic error( or missing database)? -- no such table: t1" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} 0\$" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} 10283\$" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} 0\$" \
    "1 \\{SQL logic error( or missing database)? -- no such table: t1" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} \\{\\}\$" \
    "0 \\{1 1048576 1048576 1048576 1048576 1048576 1048576 1048576 1048576\
    1048576 1048576 10\\} \\{System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 9284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 8284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 7284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 6284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 5284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 4284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 3284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 2284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 1284 10284 False\
    System\\.Data\\.SQLite\\.SQLiteConnection main\
    System\\.Data\\.SQLite\\.SQLiteConnection main 1000 284 10284 False\\}\$"]

###############################################################################

for {set i 0} {$i < [llength $params(pages)]} {incr i} {
  set pages [lindex $params(pages) $i]
  set callback [lindex $params(callbacks) $i]

  runTest {test [appendArgs backup-1. $i] {BackupDatabase method} -setup {
    setupDb [set fileName(1) :memory:] "" "" "" "" "" \
        false false false true memDb

    useLegacyDbPageAndCacheSizes memDb

    setupDb [set fileName(2) [appendArgs backup-1. $i .db]]

    useLegacyDbPageAndCacheSizes db
  } -body {
    set id [object invoke Interpreter.GetActive NextId]
    set dataSource [file join [getDatabaseDirectory] $fileName(2)]

    sql execute $memDb {
      CREATE TABLE t1(x TEXT);
    }

    for {set index 0} {$index < 10} {incr index} {
      sql execute $memDb [subst {
        INSERT INTO t1 (x) VALUES('[string repeat ! 1048576]');
      }]
    }

    set memSource [getDbConnection memDb]

    unset -nocomplain results errors

    set code [compileCSharpWith [subst {
      using System.Data.SQLite;
      using System.Text;
      using Eagle._Components.Public;

      namespace _Dynamic${id}
      {
        public static class Test${id}
        {
          public static int count = 0;
          public static readonly StringBuilder results = new StringBuilder();

          /////////////////////////////////////////////////////////////////////

          public static bool BackupCallback(
            SQLiteConnection source,
            string sourceName,
            SQLiteConnection destination,
            string destinationName,
            int pages,
            int remainingPages,
            int totalPages,
            bool retry
            )
          {
            results.AppendFormat("{0} {1} {2} {3} {4} {5} {6} {7} ", source,
              sourceName, destination, destinationName, pages, remainingPages,
              totalPages, retry);

            count++;

            return (pages != 2);
          }

          /////////////////////////////////////////////////////////////////////

          public static string BackupAndGetData(
            Interpreter interpreter,
            SQLiteConnection source
            )
          {
            using (SQLiteConnection destination = new SQLiteConnection(
                "Data Source=${dataSource};[getTestProperties]"))
            {
              destination.Open();

              int pages = ${pages};

              source.BackupDatabase(destination, "main", "main", pages,
                ${callback}, 0);

              ReturnCode code;
              Result error = null;

              code = interpreter.SetVariableValue(
                VariableFlags.GlobalOnly, "callbackResults", (pages > 2) ?
                    results.ToString().Trim() : count.ToString(), null,
                ref error);

              if (code != ReturnCode.Ok)
                Utility.Complain(interpreter, code, error);

              using (SQLiteCommand command = new SQLiteCommand(
                  "SELECT length(x) FROM t1;", destination))
              {
                using (SQLiteDataReader dataReader = command.ExecuteReader())
                {
                  StringBuilder builder = new StringBuilder();
                  int rowCount = 0;

                  builder.Append(dataReader.FieldCount);
                  builder.Append(' ');

                  while (dataReader.Read())
                  {
                    builder.Append(dataReader.GetInt64(0));
                    builder.Append(' ');
                    rowCount++;
                  }

                  builder.Append(rowCount);
                  return builder.ToString();
                }
              }
            }
          }

          /////////////////////////////////////////////////////////////////////

          public static void Main()
          {
            // do nothing.
          }
        }
      }
    }] true false true results errors [list System.Data.SQLite.dll Eagle.dll]]

    set callbackResults [list]

    list $code $results \
        [expr {[info exists errors] ? $errors : ""}] \
        [expr {$code eq "Ok" ? [catchCSharp {
          object invoke _Dynamic${id}.Test${id} BackupAndGetData "" $memSource
        } result] : [set result ""]}] \
        [extractSystemDataSQLiteExceptionMessage $result] $callbackResults
  } -cleanup {
    cleanupDb $fileName(2)
    cleanupDb $fileName(1) memDb

    freeDbConnection memSource

    unset -nocomplain result results errors code index memSource dataSource \
        id memDb db fileName callbackResults
  } -constraints {eagle command.object monoBug28 command.sql compile.DATA\
SQLite System.Data.SQLite compileCSharp} -match regexp -result [appendArgs \
"^Ok System#CodeDom#Compiler#CompilerResults#\\d+ \\{\\} " \
[lindex $params(results) $i]]}
}

###############################################################################

unset -nocomplain i params pages callback

###############################################################################

checkForSQLiteDirectories $test_channel
getSQLiteHandleCounts $test_channel
reportSQLiteResources $test_channel

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/basic.eagle.













































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
###############################################################################
#
# basic.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue
runSQLiteTestFilesPrologue
runSQLiteTestExtraPrologue

###############################################################################

runTest {test data-1.1 {unit tests from the 'test' project} -setup {
  cleanupFile [file join [file dirname $testExeFile] Test.db3]
  set fileName [file join [getDatabaseDirectory] data-1.1.db]
} -body {
  set output ""

  set code [catch {
    #
    # NOTE: For the sake of backward compatibility, the "-autoRun" argument
    #       must be first.
    #
    testClrExec $testExeFile [list -eventflags Wait -directory \
        [file dirname $testExeFile] -stdout output -success Success] \
        -autoRun -fileName [appendArgs \" [file nativename $fileName] \"]
  } error]

  set successCount [regexp -all -- {\tSucceeded\t} $output]
  set failureCount [regexp -all -- {\tFailed\t} $output]
  set totalCount [expr {$successCount + $failureCount}]

  tputs $test_channel [appendArgs \
      "---- found and executed " $totalCount " unit tests from \"" \
      $testExeFile "\", " $successCount " passed, " $failureCount \
      " failed\n"]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  list $code [expr {$code == 0 ? "" : $error}]
} -cleanup {
  cleanupFile $fileName
  catch {info previouspid true}

  unset -nocomplain totalCount failureCount successCount code output \
      error fileName
} -constraints {eagle SQLite file_System.Data.SQLite.dll file_test.exe\
testExec winForms} -result {0 {}}}

###############################################################################

runTest {test data-1.2 {unit tests from the 'testlinq' project} -setup {
  copySampleDatabaseFiles

  #
  # NOTE: We need to make 100% sure that the console output encoding is the
  #       same as when the 'testlinq.out' file was created.
  #
  set savedEncoding [object invoke Console OutputEncoding]

  set encoding [object invoke System.Text.Encoding GetEncoding \
      [getOutputEncodingName]]

  object invoke Console OutputEncoding $encoding
} -body {
  set output ""

  set code [catch {
    testClrExec $testLinqExeFile [list -eventflags Wait -directory \
        [file dirname $testLinqExeFile] -stdout output -success Success]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  list $code [string equal [string map [list \r\n \n] $output] \
      [string map [list \r\n \n] [readFile $testLinqOutFile]]] \
      [expr {$code == 0 ? "" : $error}]
} -cleanup {
  catch {object invoke Console OutputEncoding $savedEncoding}
  catch {info previouspid true}

  unset -nocomplain code output error savedEncoding encoding
} -constraints \
{eagle command.object monoToDo SQLite file_System.Data.SQLite.dll\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db\
file_testlinq.out testExec} -result {0 True {}}}

###############################################################################

runTest {test data-1.3 {unit tests from the 'testef6' project} -setup {
  copySampleDatabaseFiles

  #
  # NOTE: We need to make 100% sure that the console output encoding is the
  #       same as when the 'testlinq.out' file was created.
  #
  set savedEncoding [object invoke Console OutputEncoding]

  set encoding [object invoke System.Text.Encoding GetEncoding \
      [getOutputEncodingName]]

  object invoke Console OutputEncoding $encoding
} -body {
  set output ""

  set code [catch {
    testClrExec $testEf6ExeFile [list -eventflags Wait -directory \
        [file dirname $testEf6ExeFile] -stdout output -success Success]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  list $code [string equal [string map [list \r\n \n] $output] \
      [string map [list \r\n \n] [readFile $testLinqOutFile]]] \
      [expr {$code == 0 ? "" : $error}]
} -cleanup {
  catch {object invoke Console OutputEncoding $savedEncoding}
  catch {info previouspid true}

  unset -nocomplain code output error savedEncoding encoding
} -constraints \
{eagle command.object monoToDo SQLite file_EntityFramework.dll\
file_System.Data.SQLite.dll file_System.Data.SQLite.EF6.dll file_testef6.exe\
file_northwindEF.db file_testlinq.out testExec} -result {0 True {}}}

###############################################################################

runTest {test data-1.4 {SELECT scalar/reader, CREATE, INSERT} -setup {
  setupDb [set fileName data-1.4.db]
} -body {
  set result [list]

  lappend result [sql execute -execute scalar $db \
      "SELECT sqlite_source_id();"]

  sql execute $db "CREATE TABLE t1(x INTEGER PRIMARY KEY ASC, y, z);"
  sql execute $db "INSERT INTO t1 (x, y, z) VALUES(1, 'foo', 1234);"

  sql execute -execute reader $db "SELECT x, y, z FROM t1;"

  foreach name [lsort [array names rows]] {
    lappend result [list $name $rows($name)]
  }

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain name rows result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
-match regexp -result {^\{\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\
[0-9a-f]{40,64}(?:alt1|alt2)?\} \{1 \{\{x 1\} \{y foo\} \{z 1234\}\}\} \{count\
1\} \{names \{x y z\}\}$}}

###############################################################################

runTest {test data-1.5 {GetSchema with ReservedWords} -setup {
  setupDb [set fileName data-1.5.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static DataTable GetReservedWords()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            return connection.GetSchema("ReservedWords");
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke -alias _Dynamic${id}.Test${id} GetReservedWords
      } result] : [set result ""]}] $result [string map [list \
      \{\{ "" \}\} ""] [string map [list "ReservedWord " "" \
      " MaximumVersion MinimumVersion" ""] [getRowsFromDataTable $result]]]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 System#Data#DataTable#\d+\
\{ABORT ACTION ADD AFTER ALL ALTER ALWAYS ANALYZE AND AS ASC ATTACH\
AUTOINCREMENT BEFORE BEGIN BETWEEN BY CASCADE CASE CAST CHECK COLLATE COLUMN\
COMMIT CONFLICT CONSTRAINT CREATE CROSS CURRENT CURRENT_DATE CURRENT_TIME\
CURRENT_TIMESTAMP DATABASE DEFAULT DEFERRABLE DEFERRED DELETE DESC DETACH\
DISTINCT DO DROP EACH ELSE END ESCAPE EXCEPT EXCLUDE EXCLUSIVE EXISTS EXPLAIN\
FAIL FILTER FIRST FOLLOWING FOR FOREIGN FROM FULL GENERATED GLOB GROUP GROUPS\
HAVING IF IGNORE IMMEDIATE IN INDEX INDEXED INITIALLY INNER INSERT INSTEAD\
INTERSECT INTO IS ISNULL JOIN KEY LAST LEFT LIKE LIMIT MATCH MATERIALIZED\
NATURAL NO NOT NOTHING NOTNULL NULL NULLS OF OFFSET ON OR ORDER OTHERS OUTER\
OVER PARTITION PLAN PRAGMA PRECEDING PRIMARY QUERY RAISE RANGE RECURSIVE\
REFERENCES REGEXP REINDEX RELEASE RENAME REPLACE RESTRICT RETURNING RIGHT\
ROLLBACK ROW ROWS SAVEPOINT SELECT SET TABLE TEMP TEMPORARY THEN TIES TO\
TRANSACTION TRIGGER UNBOUNDED UNION UNIQUE UPDATE USING VACUUM VALUES VIEW\
VIRTUAL WHEN WHERE WINDOW WITH WITHOUT\}$}}

###############################################################################

runTest {test data-1.6 {GetSchema with ForeignKeys} -setup {
  setupDb [set fileName data-1.6.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(
      x INTEGER REFERENCES t2 MATCH FULL
      ON UPDATE SET DEFAULT ON DELETE CASCADE
      DEFAULT 1
    );
  }

  sql execute $db "CREATE TABLE t2(x INTEGER REFERENCES t3);"

  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static DataRowCollection GetForeignKeys()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            return connection.GetSchema("ForeignKeys").Rows;
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        set rows [list]
        set foreignKeys [object invoke _Dynamic${id}.Test${id} GetForeignKeys]

        object foreach -alias foreignKey $foreignKeys {
          lappend rows [list \
              [$foreignKey Item CONSTRAINT_CATALOG] \
              [$foreignKey Item CONSTRAINT_NAME] \
              [$foreignKey Item TABLE_CATALOG] \
              [$foreignKey Item TABLE_NAME] \
              [$foreignKey Item CONSTRAINT_TYPE] \
              [$foreignKey Item IS_DEFERRABLE] \
              [$foreignKey Item INITIALLY_DEFERRED] \
              [$foreignKey Item FKEY_ID] \
              [$foreignKey Item FKEY_FROM_COLUMN] \
              [$foreignKey Item FKEY_TO_CATALOG] \
              [$foreignKey Item FKEY_TO_TABLE] \
              [$foreignKey Item FKEY_TO_COLUMN] \
              [$foreignKey Item FKEY_FROM_ORDINAL_POSITION] \
              [$foreignKey Item FKEY_ON_UPDATE] \
              [$foreignKey Item FKEY_ON_DELETE] \
              [$foreignKey Item FKEY_MATCH]]
        }

        set rows
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result rows foreignKey foreignKeys results errors code \
      dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\{main FK_t1_0_0 main t1\
\{FOREIGN KEY\} False False 0 x main t2 \{\} 0 \{SET DEFAULT\} CASCADE NONE\}\
\{main FK_t2_0_0 main t2 \{FOREIGN KEY\} False False 0 x main t3 \{\} 0 \{NO\
ACTION\} \{NO ACTION\} NONE\}\}$}}

###############################################################################

runTest {test data-1.7 {SQLITE_FCNTL_WIN32_AV_RETRY} -setup {
  setupDb [set fileName data-1.7.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static bool TestSetAvRetry(
          ref int count,
          ref int interval
          )
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            //
            // NOTE: Set the requested retry parameter values.
            //
            if (connection.SetAvRetry(ref count, ref interval) != 0)
              return false;

            //
            // NOTE: Query the retry parameter values.
            //
            int newCount = -1; int newInterval = -1;

            if (connection.SetAvRetry(ref newCount, ref newInterval) != 0)
              return false;

            //
            // NOTE: Make sure the retry parameter values were set.
            //
            return (newCount == count && newInterval == interval);
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        set savedCount -1; set savedInterval -1

        object invoke _Dynamic${id}.Test${id} TestSetAvRetry \
            savedCount savedInterval

        set count 5; set interval 50

        object invoke _Dynamic${id}.Test${id} TestSetAvRetry \
            count interval
      } result] : [set result ""]}] $result
} -cleanup {
  if {[info exists savedCount]} then {
    #
    # NOTE: Restore the saved retry count, if possible.
    #
    catchCSharp {
      set interval -1
      object invoke _Dynamic${id}.Test${id} TestSetAvRetry savedCount interval
    }
  }

  if {[info exists savedInterval]} then {
    #
    # NOTE: Restore the saved retry interval, if possible.
    #
    catchCSharp {
      set count -1
      object invoke _Dynamic${id}.Test${id} TestSetAvRetry count savedInterval
    }
  }

  cleanupDb $fileName

  unset -nocomplain result count interval savedCount savedInterval results \
      errors code dataSource id db fileName
} -constraints {eagle command.object windows monoBug28 command.sql compile.DATA\
SQLite System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 True$}}

###############################################################################

runTest {test data-1.8 {properly closed database file (non-query)} -setup {
  set fileName data-1.8.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    BEGIN EXCLUSIVE TRANSACTION; \
    CREATE TABLE t1(x INTEGER); \
    INSERT INTO t1 (x) VALUES(1); \
    SELECT x FROM t1; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql}",
                connection))
            {
              command.ExecuteNonQuery();
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result \
      [close [open $dataSource RDONLY 0 "" -share None]]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\} \{\}$}}

###############################################################################

runTest {test data-1.9 {properly closed database file (reader #1)} -setup {
  set fileName data-1.9.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    BEGIN EXCLUSIVE TRANSACTION; \
    CREATE TABLE t1(x INTEGER); \
    INSERT INTO t1 (x) VALUES(1); \
    SELECT x FROM t1; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql}",
                connection))
            {
              using (SQLiteDataReader dataReader = command.ExecuteReader())
              {
                // do nothing.
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result \
      [close [open $dataSource RDONLY 0 "" -share None]]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\} \{\}$}}

###############################################################################

runTest {test data-1.10 {properly closed database file (reader #2)} -setup {
  set fileName data-1.10.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    BEGIN EXCLUSIVE TRANSACTION; \
    CREATE TABLE t1(x INTEGER); \
    INSERT INTO t1 (x) VALUES(1); \
    SELECT x FROM t1; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql}",
                connection))
            {
              using (SQLiteDataReader dataReader = command.ExecuteReader(
                  CommandBehavior.CloseConnection))
              {
                // do nothing.
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result \
      [close [open $dataSource RDONLY 0 "" -share None]]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\} \{\}$}}

###############################################################################

runTest {test data-1.11 {Changes property} -setup {
  setupDb [set fileName data-1.11.db]
} -body {
  set connection [getDbConnection]

  set result [list]

  sql execute $db "CREATE TABLE t1(x INTEGER PRIMARY KEY ASC, y, z);"

  sql execute $db "INSERT INTO t1 (x, y, z) VALUES(1, 'foo', 1234);"
  sql execute $db "INSERT INTO t1 (x, y, z) VALUES(2, 'bar', 5678);"
  lappend result [object invoke $connection Changes]

  sql execute $db "UPDATE t1 SET y = 'foobar';"
  lappend result [object invoke $connection Changes]

  sql execute -execute reader $db "SELECT x, y, z FROM t1;"
  lappend result [object invoke $connection Changes]

  foreach name [lsort -integer [array names rows -regexp {^\d+$}]] {
    lappend result [list $name $rows($name)]
  }

  set result
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain name rows result connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} \
-result {1 2 2 {1 {{x 1} {y foobar} {z 1234}}} {2 {{x 2} {y foobar} {z 5678}}}}}

###############################################################################

runTest {test data-1.12 {LastInsertRowId property} -setup {
  setupDb [set fileName data-1.12.db]
} -body {
  set connection [getDbConnection]

  set result [list]

  sql execute $db "CREATE TABLE t1(x INTEGER PRIMARY KEY ASC, y, z);"

  sql execute $db "CREATE TABLE t2(x INTEGER PRIMARY KEY AUTOINCREMENT, y, z);"
  lappend result [object invoke $connection LastInsertRowId]

  sql execute $db "INSERT INTO t1 (x, y, z) VALUES(1, 'foo', 1234);"
  lappend result [object invoke $connection LastInsertRowId]

  sql execute $db "INSERT INTO t1 (x, y, z) VALUES(2, 'bar', 5678);"
  lappend result [object invoke $connection LastInsertRowId]

  sql execute $db "UPDATE t1 SET y = 'foobar';"
  lappend result [object invoke $connection LastInsertRowId]

  sql execute $db "INSERT INTO t2 (y, z) VALUES('foo', 1234);"
  lappend result [object invoke $connection LastInsertRowId]

  sql execute $db "INSERT INTO t2 (y, z) VALUES('bar', 5678);"
  lappend result [object invoke $connection LastInsertRowId]

  sql execute $db "UPDATE t2 SET y = 'foobar';"
  lappend result [object invoke $connection LastInsertRowId]

  sql execute -execute reader $db "SELECT x, y, z FROM t1;"
  lappend result [object invoke $connection LastInsertRowId]

  foreach name [lsort -integer [array names rows -regexp {^\d+$}]] {
    lappend result [list $name $rows($name)]
  }

  sql execute -execute reader $db "SELECT x, y, z FROM t2;"
  lappend result [object invoke $connection LastInsertRowId]

  foreach name [lsort -integer [array names rows -regexp {^\d+$}]] {
    lappend result [list $name $rows($name)]
  }

  set result
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain name rows result connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} \
-result {0 1 2 2 1 2 2 2 {1 {{x 1} {y foobar} {z 1234}}} {2 {{x 2} {y foobar}\
{z 5678}}} 2 {1 {{x 1} {y foobar} {z 1234}}} {2 {{x 2} {y foobar} {z 5678}}}}}

###############################################################################

runTest {test data-1.13 {DateTime using Unix epoch} -setup {
  setupDb [set fileName data-1.13.db] "" UnixEpoch Utc
} -body {
  set result [list]

  sql execute $db "CREATE TABLE t1(x INTEGER PRIMARY KEY ASC, y DATETIME);"
  sql execute $db "INSERT INTO t1 (x, y) VALUES(1, 1302825600);"
  sql execute $db "INSERT INTO t1 (x, y) VALUES(2, 1334448000);"
  sql execute $db "INSERT INTO t1 (x, y) VALUES(3, 1365984000);"

  sql execute $db "INSERT INTO t1 (x, y) VALUES(4, ?);" \
      [list param1 Int32 1302825600]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(5, ?);" \
      [list param1 Int32 1334448000]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(6, ?);" \
      [list param1 Int32 1365984000]

  sql execute -verbatim $db "INSERT INTO t1 (x, y) VALUES(7, ?);" \
      [list param1 DateTime 1302825600]

  sql execute -verbatim $db "INSERT INTO t1 (x, y) VALUES(8, ?);" \
      [list param1 DateTime 1334448000]

  sql execute -verbatim $db "INSERT INTO t1 (x, y) VALUES(9, ?);" \
      [list param1 DateTime 1365984000]

  sql execute -execute reader -datetimeformat [getDateTimeFormat] $db \
      "SELECT x, y FROM t1 ORDER BY x;"

  foreach name [lsort -integer [array names rows -regexp {^\d+$}]] {
    lappend result [list $name $rows($name)]
  }

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain name rows result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
-result {{1 {{x 1} {y {2011-04-15 00:00:00Z}}}} {2 {{x 2} {y {2012-04-15\
00:00:00Z}}}} {3 {{x 3} {y {2013-04-15 00:00:00Z}}}} {4 {{x 4} {y {2011-04-15\
00:00:00Z}}}} {5 {{x 5} {y {2012-04-15 00:00:00Z}}}} {6 {{x 6} {y {2013-04-15\
00:00:00Z}}}} {7 {{x 7} {y {2011-04-15 00:00:00Z}}}} {8 {{x 8} {y {2012-04-15\
00:00:00Z}}}} {9 {{x 9} {y {2013-04-15 00:00:00Z}}}}}}

###############################################################################

set date [clock format [clock seconds] -format yyyy-MM-dd]

###############################################################################

runTest {test data-1.14 {DateTime using invariant culture} -setup {
  setupDb [set fileName data-1.14.db] "" InvariantCulture Utc
} -body {
  set result [list]

  sql execute $db "CREATE TABLE t1(x INTEGER PRIMARY KEY ASC, y DATETIME);"

  sql execute $db \
      "INSERT INTO t1 (x, y) VALUES(1, 'Wednesday, 16 December 2009');"

  sql execute $db "INSERT INTO t1 (x, y) VALUES(2, '12:00:00');"

  sql execute $db \
      "INSERT INTO t1 (x, y) VALUES(3, 'Wednesday, 16 December 2009 12:00:00');"

  sql execute $db "INSERT INTO t1 (x, y) VALUES(4, '12/16/2009');"
  sql execute $db "INSERT INTO t1 (x, y) VALUES(5, '12:00');"
  sql execute $db "INSERT INTO t1 (x, y) VALUES(6, '12/16/2009 12:00');"

  sql execute -datetimekind Utc $db "INSERT INTO t1 (x, y) VALUES(7, ?);" \
      [list param1 DateTime "Wednesday, 16 December 2009"]

  sql execute -datetimekind Utc $db "INSERT INTO t1 (x, y) VALUES(8, ?);" \
      [list param1 DateTime 12:00:00]

  sql execute -datetimekind Utc $db "INSERT INTO t1 (x, y) VALUES(9, ?);" \
      [list param1 DateTime "Wednesday, 16 December 2009 12:00:00"]

  sql execute -datetimekind Utc $db "INSERT INTO t1 (x, y) VALUES(10, ?);" \
      [list param1 DateTime 12/16/2009]

  sql execute -datetimekind Utc $db "INSERT INTO t1 (x, y) VALUES(11, ?);" \
      [list param1 DateTime 12:00]

  sql execute -datetimekind Utc $db "INSERT INTO t1 (x, y) VALUES(12, ?);" \
      [list param1 DateTime "12/16/2009 12:00"]

  sql execute -execute reader -datetimeformat [getDateTimeFormat] $db \
      "SELECT x, CAST(y AS TEXT) AS y2 FROM t1 ORDER BY x;"

  foreach name [lsort -integer [array names rows -regexp {^\d+$}]] {
    lappend result [list $name $rows($name)]
  }

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain name rows result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
-result [subst {{1 {{x 1} {y2 {Wednesday, 16 December 2009}}}} {2 {{x 2} {y2\
12:00:00}}} {3 {{x 3} {y2 {Wednesday, 16 December 2009 12:00:00}}}} {4 {{x 4}\
{y2 12/16/2009}}} {5 {{x 5} {y2 12:00}}} {6 {{x 6} {y2 {12/16/2009 12:00}}}} {7\
{{x 7} {y2 2009-12-16T00:00:00.0000000Z}}} {8 {{x 8} {y2\
${date}T12:00:00.0000000Z}}} {9 {{x 9} {y2 2009-12-16T12:00:00.0000000Z}}}\
{10 {{x 10} {y2 2009-12-16T00:00:00.0000000Z}}} {11 {{x 11} {y2\
${date}T12:00:00.0000000Z}}} {12 {{x 12} {y2 2009-12-16T12:00:00.0000000Z}}}}]}

###############################################################################

runTest {test data-1.15 {DateTime using current culture} -setup {
  setupDb [set fileName data-1.15.db] "" CurrentCulture Utc
} -body {
  set result [list]

  sql execute $db "CREATE TABLE t1(x INTEGER PRIMARY KEY ASC, y DATETIME);"

  sql execute $db \
      "INSERT INTO t1 (x, y) VALUES(1, 'Wednesday, 16 December 2009');"

  sql execute $db "INSERT INTO t1 (x, y) VALUES(2, '12:00:00');"

  sql execute $db \
      "INSERT INTO t1 (x, y) VALUES(3, 'Wednesday, 16 December 2009 12:00:00');"

  sql execute $db "INSERT INTO t1 (x, y) VALUES(4, '12/16/2009');"
  sql execute $db "INSERT INTO t1 (x, y) VALUES(5, '12:00');"
  sql execute $db "INSERT INTO t1 (x, y) VALUES(6, '12/16/2009 12:00');"

  sql execute -datetimekind Utc $db "INSERT INTO t1 (x, y) VALUES(7, ?);" \
      [list param1 DateTime "Wednesday, 16 December 2009"]

  sql execute -datetimekind Utc $db "INSERT INTO t1 (x, y) VALUES(8, ?);" \
      [list param1 DateTime 12:00:00]

  sql execute -datetimekind Utc $db "INSERT INTO t1 (x, y) VALUES(9, ?);" \
      [list param1 DateTime "Wednesday, 16 December 2009 12:00:00"]

  sql execute -datetimekind Utc $db "INSERT INTO t1 (x, y) VALUES(10, ?);" \
      [list param1 DateTime 12/16/2009]

  sql execute -datetimekind Utc $db "INSERT INTO t1 (x, y) VALUES(11, ?);" \
      [list param1 DateTime 12:00]

  sql execute -datetimekind Utc $db "INSERT INTO t1 (x, y) VALUES(12, ?);" \
      [list param1 DateTime "12/16/2009 12:00"]

  sql execute -execute reader -datetimeformat [getDateTimeFormat] $db \
      "SELECT x, CAST(y AS TEXT) AS y2 FROM t1 ORDER BY x;"

  foreach name [lsort -integer [array names rows -regexp {^\d+$}]] {
    lappend result [list $name $rows($name)]
  }

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain name rows result db fileName
} -constraints \
{eagle culture.invariant monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result [subst {{1 {{x 1} {y2 {Wednesday, 16 December\
2009}}}} {2 {{x 2} {y2 12:00:00}}} {3 {{x 3} {y2 {Wednesday, 16 December 2009\
12:00:00}}}} {4 {{x 4} {y2 12/16/2009}}} {5 {{x 5} {y2 12:00}}} {6 {{x 6} {y2\
{12/16/2009 12:00}}}} {7 {{x 7} {y2 2009-12-16T00:00:00.0000000Z}}} {8 {{x 8}\
{y2 ${date}T12:00:00.0000000Z}}} {9 {{x 9} {y2 2009-12-16T12:00:00.0000000Z}}}\
{10 {{x 10} {y2 2009-12-16T00:00:00.0000000Z}}} {11 {{x 11} {y2\
${date}T12:00:00.0000000Z}}} {12 {{x 12} {y2 2009-12-16T12:00:00.0000000Z}}}}]}

###############################################################################

unset -nocomplain date

###############################################################################

runTest {test data-1.16 {SQLiteConnectionStringBuilder DateTime} -body {
  set id [object invoke Interpreter.GetActive NextId]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static string GetConnectionString(
          string format,
          string kind,
          string formatString
          )
        {
          SQLiteConnectionStringBuilder builder =
              new SQLiteConnectionStringBuilder();

          builder.Add("Data Source", "test.db");
          builder.Add("DateTimeFormat", format);
          builder.Add("DateTimeKind", kind);
          builder.Add("DateTimeFormatString", formatString);

          return builder.ToString();
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetConnectionString \
            null null null
      } result] : [set result ""]}] $result \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetConnectionString \
            Default null null
      } result] : [set result ""]}] $result \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetConnectionString \
            null Unspecified null
      } result] : [set result ""]}] $result \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetConnectionString \
            ISO8601 Utc null
      } result] : [set result ""]}] $result \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetConnectionString \
            Ticks Local yyyy-MM-dd
      } result] : [set result ""]}] $result
} -cleanup {
  unset -nocomplain result results errors code id
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{Data Source=test\.db\} 0\
\{Data Source=test\.db;DateTimeFormat=(?:Default|ISO8601)\} 0 \{Data\
Source=test\.db;DateTimeKind=Unspecified\} 0 \{Data\
Source=test\.db;DateTimeFormat=(?:Default|ISO8601);DateTimeKind=Utc\} 0 \{Data\
Source=test\.db;DateTimeFormat=Ticks;DateTimeKind=Local;DateTimeFormatString=yyyy-MM-dd\}$}}

###############################################################################

runTest {test data-1.17 {SQLiteConnectionStringBuilder properties} -body {
  set id [object invoke Interpreter.GetActive NextId]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using System.Reflection;
    using System.Text;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        private static string ToHexString(
          byte\[\] array
          )
        {
          if (array == null)
            return null;

          StringBuilder result = new StringBuilder();

          int length = array.Length;

          for (int index = 0; index < length; index++)
            result.AppendFormat("{0:x2}", array\[index\]);

          return result.ToString();
        }

        ///////////////////////////////////////////////////////////////////////

        public static string GetConnectionString(
          string key,
          string value,
          string propertyName
          )
        {
          SQLiteConnectionStringBuilder builder =
              new SQLiteConnectionStringBuilder();

          if (key != null)
            builder.Add(key, value);

          object propertyValue = null;

          if (propertyName != null)
          {
            propertyValue = typeof(SQLiteConnectionStringBuilder).InvokeMember(
                propertyName, BindingFlags.Instance | BindingFlags.Public |
                BindingFlags.GetProperty, null, builder, null);
          }

          return String.Format("{0}, {1}", (propertyValue is byte\[\]) ?
              ToHexString((byte\[\])propertyValue) : propertyValue, builder);
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  lappend results $code [expr {[info exists errors] ? $errors : ""}]

  if {$code eq "Ok"} then {
    set keys [list null Version Synchronous UseUTF16Encoding Pooling \
                   BinaryGUID "Data Source" Uri FullUri "Default Timeout" \
                   DefaultMaximumSleepTime \
                   Enlist FailIfMissing "Legacy Format" "Read Only" \
                   Password "Page Size" "Max Page Count" "Cache Size" \
                   DateTimeFormat DateTimeKind DateTimeFormatString \
                   BaseSchemaName "Journal Mode" "Default IsolationLevel" \
                   "Foreign Keys" Flags SetDefaults ToFullPath HexPassword \
                   DefaultDbType DefaultTypeName NoSharedFlags PrepareRetries \
                   StepRetries ZipVfsVersion VfsName BusyTimeout ProgressOps \
                   NoDefaultFlags "Recursive Triggers" WaitTimeout \
                   TextPassword TextHexPassword]

    set values [list null 3 Normal True False \
                     True test.db test.db file:test.db 60 \
                     120 False True False True \
                     secret 4096 1024 8192 \
                     UnixEpoch Utc yyyy-MM-dd \
                     sqlite_schema Memory Serializable \
                     False Default False False 736563726574 \
                     String TEXT True 20 \
                     10 v2 test 1000 2000 \
                     True True 30000 \
                     textsecret 736563726574]

    set propertyNames [list null Version SyncMode UseUTF16Encoding Pooling \
                            BinaryGUID DataSource Uri FullUri DefaultTimeout \
                            DefaultMaximumSleepTime \
                            Enlist FailIfMissing LegacyFormat ReadOnly \
                            Password PageSize MaxPageCount CacheSize \
                            DateTimeFormat DateTimeKind DateTimeFormatString \
                            BaseSchemaName JournalMode DefaultIsolationLevel \
                            ForeignKeys Flags SetDefaults ToFullPath \
                            HexPassword DefaultDbType DefaultTypeName \
                            NoSharedFlags PrepareRetries StepRetries \
                            ZipVfsVersion VfsName BusyTimeout ProgressOps \
                            NoDefaultFlags RecursiveTriggers WaitTimeout \
                            TextPassword TextHexPassword]

    foreach key $keys value $values propertyName $propertyNames {
      set code [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetConnectionString \
            $key $value $propertyName
      } result]

      lappend results $code $result
    }
  }

  set results
} -cleanup {
  unset -nocomplain propertyName propertyNames value key values keys result \
      results errors code id
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result \
{^System#CodeDom#Compiler#CompilerResults#\d+ Ok \{\} 0 \{, \} 0 \{3,\
Version=3\} 0 \{Normal, Synchronous=Normal\} 0 \{True, UseUTF16Encoding=True\}\
0 \{False, Pooling=False\} 0 \{True, BinaryGUID=True\} 0 \{test\.db, Data\
Source=test\.db\} 0 \{test\.db, Uri=test\.db\} 0 \{file:test.db,\
FullUri=file:test\.db\} 0 \{60, Default Timeout=60\} 0 \{120,\
DefaultMaximumSleepTime=120\} 0 \{False, Enlist=False\} 0 \{True,\
FailIfMissing=True\} 0 \{False, Legacy Format=False\} 0 \{True, Read\
Only=True\} 0 \{secret, Password=secret\} 0 \{4096, Page Size=4096\} 0 \{1024,\
Max Page Count=1024\} 0 \{8192, Cache Size=8192\} 0 \{UnixEpoch,\
DateTimeFormat=UnixEpoch\} 0 \{Utc, DateTimeKind=Utc\} 0 \{yyyy-MM-dd,\
DateTimeFormatString=yyyy-MM-dd\} 0 \{sqlite_schema,\
BaseSchemaName=sqlite_schema\} 0 \{Memory, Journal Mode=Memory\} 0\
\{Serializable, Default IsolationLevel=Serializable\} 0 \{False, Foreign\
Keys=False\} 0 \{(?:Default|LogCallbackException),\
Flags=(?:Default|LogCallbackException)\} 0 \{False, SetDefaults=False\} 0\
\{False, ToFullPath=False\} 0 \{736563726574, HexPassword=736563726574\} 0\
\{String, DefaultDbType=String\} 0 \{TEXT, DefaultTypeName=TEXT\} 0 \{True,\
NoSharedFlags=True\} 0 \{20, PrepareRetries=20\} 0 \{10, StepRetries=10\} 0\
\{v2, ZipVfsVersion=v2\} 0 \{test, VfsName=test\} 0 \{1000, BusyTimeout=1000\}\
0 \{2000, ProgressOps=2000\} 0 \{True, NoDefaultFlags=True\} 0 \{True,\
Recursive Triggers=True\} 0 \{30000, WaitTimeout=30000\} 0 \{textsecret,\
TextPassword=textsecret\} 0 \{736563726574, TextHexPassword=736563726574\}$}}

###############################################################################

runTest {test data-1.18 {SQLiteConvert ToDateTime (Julian Day)} -body {
  set dateTime [object invoke -create System.Data.SQLite.SQLiteConvert \
      ToDateTime 2455928.0 Utc]

  object invoke $dateTime ToString [getDateTimeFormat]
} -cleanup {
  unset -nocomplain dateTime
} -constraints {eagle command.object System.Data.SQLite} -result \
{2012-01-01 12:00:00Z}}

###############################################################################

runTest {test data-1.19 {SQLiteConvert ToJulianDay} -body {
  expr {round([object invoke System.Data.SQLite.SQLiteConvert ToJulianDay \
      "2012-01-01 12:00:00Z"])}
} -constraints {eagle command.object System.Data.SQLite} -result {2455928}}

###############################################################################

runTest {test data-1.20 {SQLiteConvert ToUnixEpoch (Utc)} -body {
  #
  # NOTE: At first, the test result here may not seem correct; however, the
  #       same result can be seen by compiling and running the following C#
  #       code fragment together with the ToUnixEpoch method:
  #
  #           DateTime dateTime;
  #           Console.WriteLine("dateTime = {0}, unixTime = {1}",
  #               dateTime = DateTime.Parse("2012-01-01 12:00:00Z"),
  #               ToUnixEpoch(dateTime));
  #
  #       The basic problem here is that the Parse [and TryParse] methods of
  #       the DateTime structure seem to always return local time, even when
  #       string value clearly indicates otherwise (i.e. the trailing "Z",
  #       indicating UTC).
  #
  expr {round([object invoke System.Data.SQLite.SQLiteConvert ToUnixEpoch \
      [set dateTime [object invoke -create -alias DateTime ParseExact \
      "2012-01-01 12:00:00Z" [getDateTimeFormat] null AdjustToUniversal]]])}
} -cleanup {
  unset -nocomplain dateTime
} -constraints {eagle command.object monoBug42 System.Data.SQLite} -result \
{1325419200}}

###############################################################################

runTest {test data-1.21 {SQLiteConvert ToUnixEpoch (Local)} -body {
  #
  # NOTE: At first, the test result here may not seem correct; however, the
  #       same result can be seen by compiling and running the following C#
  #       code fragment together with the ToUnixEpoch method:
  #
  #           DateTime dateTime;
  #           Console.WriteLine("dateTime = {0}, unixTime = {1}",
  #               dateTime = DateTime.Parse("2012-01-01 12:00:00"),
  #               ToUnixEpoch(dateTime));
  #
  #       The basic problem here is that the Parse [and TryParse] methods of
  #       the DateTime structure seem to always return local time, even when
  #       string value clearly indicates otherwise (i.e. the trailing "Z",
  #       indicating UTC).
  #
  expr {round([object invoke System.Data.SQLite.SQLiteConvert ToUnixEpoch \
      "2012-01-01 12:00:00"])}
} -constraints {eagle command.object System.Data.SQLite} -result {1325419200}}

###############################################################################

runTest {test data-1.22 {SQLiteTransaction disposal behavior} -setup {
  setupDb [set fileName data-1.22.db]
} -body {
  sql execute $db "CREATE TABLE t1(x TEXT);"

  sql execute $db {
    INSERT INTO t1 (x) VALUES('test1');
    INSERT INTO t1 (x) VALUES('test2');
    INSERT INTO t1 (x) VALUES('test3');
  }

  set sql "SELECT x FROM t1 ORDER BY x COLLATE DOTHROW;"

  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      \[SQLiteFunction(Name = "DOTHROW", FuncType = FunctionType.Collation)\]
      public class Test${id} : SQLiteFunction
      {
        public override int Compare(
          string param1,
          string param2
          )
        {
          throw new Exception("not implemented");
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          SQLiteFunction.RegisterFunction(typeof(Test${id}));

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteTransaction transaction =
                connection.BeginTransaction())
            {
              try
              {
                SQLiteCommand command = connection.CreateCommand();

                command.CommandText = "${sql}";
                command.ExecuteNonQuery();
              }
              catch
              {
                // do nothing.
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}

###############################################################################

runTest {test data-1.23 {SQLiteFunction collation exception} -setup {
  setupDb [set fileName data-1.23.db]
} -body {
  sql execute $db "CREATE TABLE t1(x TEXT);"

  sql execute $db {
    INSERT INTO t1 (x) VALUES('test1');
    INSERT INTO t1 (x) VALUES('test2');
    INSERT INTO t1 (x) VALUES('test3');
  }

  set sql "SELECT x FROM t1 ORDER BY x COLLATE DOTHROW2;"

  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      \[SQLiteFunction(Name = "DOTHROW2", FuncType = FunctionType.Collation)\]
      public class Test${id} : SQLiteFunction
      {
        public override int Compare(
          string param1,
          string param2
          )
        {
          throw new Exception("not implemented");
        }

        ///////////////////////////////////////////////////////////////////////

        public static int Main()
        {
          SQLiteFunction.RegisterFunction(typeof(Test${id}));

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteTransaction transaction =
                connection.BeginTransaction())
            {
              SQLiteCommand command = connection.CreateCommand();

              command.CommandText = "${sql}";

              using (SQLiteDataReader dataReader = command.ExecuteReader())
              {
                int count = 0;

                while (dataReader.Read())
                  count++;

                return count;
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 1 interrupted$}}

###############################################################################

runTest {test data-1.24 {LINQ SQL_CONSTRAINTCOLUMNS resource} -body {
  object invoke -flags +NonPublic \
      System.Data.SQLite.Linq.Properties.Resources SQL_CONSTRAINTCOLUMNS
} -constraints {eagle command.object System.Data.SQLite\
System.Data.SQLite.Linq} -result {
      CREATE TEMP VIEW SCHEMACONSTRAINTCOLUMNS AS
        SELECT CONSTRAINT_CATALOG,
               NULL AS CONSTRAINT_SCHEMA,
               CONSTRAINT_NAME,
               TABLE_CATALOG,
               NULL AS TABLE_SCHEMA,
               TABLE_NAME,
               COLUMN_NAME
        FROM TEMP.SCHEMAINDEXCOLUMNS
        UNION
        SELECT CONSTRAINT_CATALOG,
               NULL,
               CONSTRAINT_NAME,
               TABLE_CATALOG,
               NULL,
               TABLE_NAME,
               FKEY_FROM_COLUMN
        FROM TEMP.SCHEMAFOREIGNKEYS;
    }}

###############################################################################

runTest {test data-1.25 {EF6 SQL_CONSTRAINTCOLUMNS resource} -body {
  object invoke -flags +NonPublic \
      System.Data.SQLite.EF6.Properties.Resources SQL_CONSTRAINTCOLUMNS
} -constraints {eagle command.object System.Data.SQLite\
System.Data.SQLite.EF6} -result {
      CREATE TEMP VIEW SCHEMACONSTRAINTCOLUMNS AS
        SELECT CONSTRAINT_CATALOG,
               NULL AS CONSTRAINT_SCHEMA,
               CONSTRAINT_NAME,
               TABLE_CATALOG,
               NULL AS TABLE_SCHEMA,
               TABLE_NAME,
               COLUMN_NAME
        FROM TEMP.SCHEMAINDEXCOLUMNS
        UNION
        SELECT CONSTRAINT_CATALOG,
               NULL,
               CONSTRAINT_NAME,
               TABLE_CATALOG,
               NULL,
               TABLE_NAME,
               FKEY_FROM_COLUMN
        FROM TEMP.SCHEMAFOREIGNKEYS;
    }}

###############################################################################

runTest {test data-1.26 {LINQ SQL_CONSTRAINTS resource} -body {
  object invoke -flags +NonPublic \
      System.Data.SQLite.Linq.Properties.Resources SQL_CONSTRAINTS
} -constraints {eagle command.object System.Data.SQLite\
System.Data.SQLite.Linq} -result {
      CREATE TEMP VIEW SCHEMACONSTRAINTS AS
        SELECT INDEX_CATALOG AS CONSTRAINT_CATALOG,
               NULL AS CONSTRAINT_SCHEMA,
               INDEX_NAME AS CONSTRAINT_NAME,
               TABLE_CATALOG,
               NULL AS TABLE_SCHEMA,
               TABLE_NAME,
               'PRIMARY KEY' AS CONSTRAINT_TYPE,
               0 AS IS_DEFERRABLE,
               0 AS INITIALLY_DEFERRED,
               NULL AS CHECK_CLAUSE
        FROM TEMP.SCHEMAINDEXES
        WHERE PRIMARY_KEY = 1
        UNION
        SELECT INDEX_CATALOG,
               NULL,
               INDEX_NAME,
               TABLE_CATALOG,
               NULL,
               TABLE_NAME,
               'UNIQUE',
               0,
               0,
               NULL
        FROM TEMP.SCHEMAINDEXES
        WHERE PRIMARY_KEY = 0 AND [UNIQUE] = 1
        UNION
        SELECT CONSTRAINT_CATALOG,
               NULL,
               CONSTRAINT_NAME,
               TABLE_CATALOG,
               NULL,
               TABLE_NAME,
               CONSTRAINT_TYPE,
               IS_DEFERRABLE,
               INITIALLY_DEFERRED,
               NULL
        FROM TEMP.SCHEMAFOREIGNKEYS;
    }}

###############################################################################

runTest {test data-1.27 {EF6 SQL_CONSTRAINTS resource} -body {
  object invoke -flags +NonPublic \
      System.Data.SQLite.EF6.Properties.Resources SQL_CONSTRAINTS
} -constraints {eagle command.object System.Data.SQLite\
System.Data.SQLite.EF6} -result {
      CREATE TEMP VIEW SCHEMACONSTRAINTS AS
        SELECT INDEX_CATALOG AS CONSTRAINT_CATALOG,
               NULL AS CONSTRAINT_SCHEMA,
               INDEX_NAME AS CONSTRAINT_NAME,
               TABLE_CATALOG,
               NULL AS TABLE_SCHEMA,
               TABLE_NAME,
               'PRIMARY KEY' AS CONSTRAINT_TYPE,
               0 AS IS_DEFERRABLE,
               0 AS INITIALLY_DEFERRED,
               NULL AS CHECK_CLAUSE
        FROM TEMP.SCHEMAINDEXES
        WHERE PRIMARY_KEY = 1
        UNION
        SELECT INDEX_CATALOG,
               NULL,
               INDEX_NAME,
               TABLE_CATALOG,
               NULL,
               TABLE_NAME,
               'UNIQUE',
               0,
               0,
               NULL
        FROM TEMP.SCHEMAINDEXES
        WHERE PRIMARY_KEY = 0 AND [UNIQUE] = 1
        UNION
        SELECT CONSTRAINT_CATALOG,
               NULL,
               CONSTRAINT_NAME,
               TABLE_CATALOG,
               NULL,
               TABLE_NAME,
               CONSTRAINT_TYPE,
               IS_DEFERRABLE,
               INITIALLY_DEFERRED,
               NULL
        FROM TEMP.SCHEMAFOREIGNKEYS;
    }}

###############################################################################

runTest {test data-1.28 {SQLiteDataReader GetValues w/collection} -setup {
  setupDb [set fileName data-1.28.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER PRIMARY KEY ASC, y TEXT);
    INSERT INTO t1 (x, y) VALUES(1, 'aardvark');
    INSERT INTO t1 (x, y) VALUES(2, 'bear');
    INSERT INTO t1 (x, y) VALUES(3, 'chicken');
    INSERT INTO t1 (x, y) VALUES(4, 'duck');
    INSERT INTO t1 (x, y) VALUES(5, 'elephant');
    INSERT INTO t1 (x, y) VALUES(6, 'frog');
    INSERT INTO t1 (x, y) VALUES(7, 'goose');
    INSERT INTO t1 (x, y) VALUES(8, 'horse');
    INSERT INTO t1 (x, y) VALUES(9, 'iguana');
    INSERT INTO t1 (x, y) VALUES(10, 'jellyfish');
    INSERT INTO t1 (x, y) VALUES(11, 'kangaroo');
    INSERT INTO t1 (x, y) VALUES(12, 'llama');
    INSERT INTO t1 (x, y) VALUES(13, 'moose');
    INSERT INTO t1 (x, y) VALUES(14, 'newt');
    INSERT INTO t1 (x, y) VALUES(15, 'ostrich');
    INSERT INTO t1 (x, y) VALUES(16, 'pig');
    INSERT INTO t1 (x, y) VALUES(17, 'quail');
    INSERT INTO t1 (x, y) VALUES(18, 'rhinoceros');
    INSERT INTO t1 (x, y) VALUES(19, 'shark');
    INSERT INTO t1 (x, y) VALUES(20, 'tiger');
    INSERT INTO t1 (x, y) VALUES(21, 'unicorn');
    INSERT INTO t1 (x, y) VALUES(22, 'viper');
    INSERT INTO t1 (x, y) VALUES(23, 'weasel');
    INSERT INTO t1 (x, y) VALUES(24, 'xerus');
    INSERT INTO t1 (x, y) VALUES(25, 'yak');
    INSERT INTO t1 (x, y) VALUES(26, 'zebra');
  }

  set connection [getDbConnection]

  set command [object create -alias System.Data.SQLite.SQLiteCommand \
      "SELECT x, y, x, y FROM t1 ORDER BY y DESC;" $connection]

  set reader [$command -alias ExecuteReader]
  set collection [$reader -alias GetValues]
  set result [list]

  object foreach -alias item $collection {
    lappend result [$collection GetValues $item]
  }

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain result item collection reader command connection

  cleanupDb $fileName; # NOTE: After object disposal.

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{26 26} {zebra zebra}}}

###############################################################################

runTest {test data-1.29 {LINQ ISQLiteSchemaExtensions.BuildTempSchema} -setup {
  setupDb [set fileName data-1.29.db]
} -body {
  set connection [getDbConnection]

  set providerServices [object invoke -flags +NonPublic \
      System.Data.SQLite.Linq.SQLiteProviderServices Instance]

  object invoke -flags +NonPublic -type \
      System.Data.SQLite.ISQLiteSchemaExtensions $providerServices \
      BuildTempSchema $connection
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain providerServices connection db fileName
} -constraints {eagle command.object monoToDo SQLite System.Data.SQLite\
System.Data.SQLite.Linq} -result {}}

###############################################################################

runTest {test data-1.30 {EF6 ISQLiteSchemaExtensions.BuildTempSchema} -setup {
  setupDb [set fileName data-1.30.db]
} -body {
  set connection [getDbConnection]

  set providerServices [object invoke -flags +NonPublic \
      System.Data.SQLite.EF6.SQLiteProviderServices Instance]

  object invoke -flags +NonPublic -type \
      System.Data.SQLite.ISQLiteSchemaExtensions $providerServices \
      BuildTempSchema $connection
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain providerServices connection db fileName
} -constraints {eagle command.object monoToDo SQLite System.Data.SQLite\
System.Data.SQLite.EF6} -result {}}

###############################################################################

runTest {test data-1.31 {VARCHAR / NVARCHAR types with spaces} -body {
  list [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      TypeNameToDbType null VARCHAR None] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      TypeNameToDbType null NVARCHAR None] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      TypeNameToDbType null VARCHAR(1) None] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      TypeNameToDbType null NVARCHAR(1) None] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      TypeNameToDbType null "VARCHAR (1)" None] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      TypeNameToDbType null "NVARCHAR (1)" None] \
} -constraints {eagle command.object System.Data.SQLite} -result \
{AnsiString String AnsiString String AnsiString String}}

###############################################################################

runTest {test data-1.32 {SetMemoryStatus method} -setup {
  #
  # NOTE: Make sure that SQLite core library is completely shutdown prior to
  #       starting this test.
  #
  shutdownSQLite $test_channel

  #
  # NOTE: Create an IntPtr instance with a value of zero.
  #
  set zero [object invoke -create IntPtr Zero]

  #
  # NOTE: Create an instance of the core SQLite library interop wrapper class.
  #
  set sqlite3 [object create -flags +NonPublic System.Data.SQLite.SQLite3 \
      Default Unspecified null $zero null true]
} -body {
  set result(rc1) [object invoke -flags +NonPublic $sqlite3 SetMemoryStatus \
      false]

  set result(before) [object invoke -flags +NonPublic $sqlite3 MemoryUsed]

  set result(ptr1) [object invoke -create -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods sqlite3_malloc 100]

  set result(after1) [object invoke -flags +NonPublic $sqlite3 MemoryUsed]

  object invoke -flags +NonPublic System.Data.SQLite.UnsafeNativeMethods \
      sqlite3_free $result(ptr1)

  set result(after2) [object invoke -flags +NonPublic $sqlite3 MemoryUsed]

  set result(rc2) [object invoke -flags +NonPublic $sqlite3 SetMemoryStatus \
      true]

  set result(rc3) [object invoke -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods sqlite3_shutdown]

  set result(rc4) [object invoke -flags +NonPublic $sqlite3 SetMemoryStatus \
      true]

  set result(ptr2) [object invoke -create -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods sqlite3_malloc 100]

  set result(after3) [object invoke -flags +NonPublic $sqlite3 MemoryUsed]

  object invoke -flags +NonPublic System.Data.SQLite.UnsafeNativeMethods \
      sqlite3_free $result(ptr2)

  set result(after4) [object invoke -flags +NonPublic $sqlite3 MemoryUsed]

  list $result(rc1) $result(rc2) $result(rc3) $result(rc4) $result(ptr1) \
      $result(ptr2) $result(before) $result(after1) $result(after2) \
      $result(after3) $result(after4) \
      [expr {$result(before) == $result(after1)}] \
      [expr {$result(before) == $result(after2)}] \
      [expr {$result(after3) > 0}] \
      [expr {$result(before) < $result(after3)}] \
      [expr {$result(after1) < $result(after3)}] \
      [expr {$result(after4) < $result(after3)}]
} -cleanup {
  catch {
    #
    # NOTE: Make sure that SQLite core library is completely shutdown prior
    #       to attempting to reconfigure the memory status setting.
    #
    shutdownSQLite $test_channel

    #
    # NOTE: Attempt to make sure the default value for the process-wide
    #       memory usage tracking setting is restored.  This is not 100%
    #       reliable because we have no idea what the original value was
    #       upon entry into this test (i.e. because the underlying core
    #       library property is currently write-only).
    #
    object invoke -flags +NonPublic System.Data.SQLite.UnsafeNativeMethods \
        sqlite3_config_int SQLITE_CONFIG_MEMSTATUS 1
  }

  unset -nocomplain result sqlite3 zero
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -match regexp -result {^Ok Misuse Ok Ok System#IntPtr#\d+\
System#IntPtr#\d+ \d+ \d+ \d+ \d+ \d+ True True True True True True$}}

###############################################################################

runTest {test data-1.33 {SQLiteConnection.Open with SetDefaults=False} -setup {
  setupDb [set fileName data-1.33.db] "" "" "" "" SetDefaults=False
} -body {
  set result [list]

  lappend result [sql execute -execute scalar $db "PRAGMA page_size;"]
  lappend result [sql execute -execute scalar $db "PRAGMA max_page_count;"]
  lappend result [sql execute -execute scalar $db "PRAGMA legacy_file_format;"]
  lappend result [sql execute -execute scalar $db "PRAGMA synchronous;"]
  lappend result [sql execute -execute scalar $db "PRAGMA cache_size;"]
  lappend result [sql execute -execute scalar $db "PRAGMA journal_mode;"]
  lappend result [sql execute -execute scalar $db "PRAGMA foreign_keys;"]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result [appendArgs ^ [getDbDefaultPageSize] " 4294967294 " \
{(?:\{\}|0)} " 2 " [getDbDefaultCacheSize] " delete 0\$"]}

###############################################################################

runTest {test data-1.34 {SQLiteConnection.Open with SetDefaults=True} -setup {
  setupDb [set fileName data-1.34.db] "" "" "" "" SetDefaults=True
} -body {
  set result [list]

  lappend result [sql execute -execute scalar $db "PRAGMA page_size;"]
  lappend result [sql execute -execute scalar $db "PRAGMA max_page_count;"]
  lappend result [sql execute -execute scalar $db "PRAGMA legacy_file_format;"]
  lappend result [sql execute -execute scalar $db "PRAGMA synchronous;"]
  lappend result [sql execute -execute scalar $db "PRAGMA cache_size;"]
  lappend result [sql execute -execute scalar $db "PRAGMA journal_mode;"]
  lappend result [sql execute -execute scalar $db "PRAGMA foreign_keys;"]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result [appendArgs ^ [getDbDefaultPageSize] " 4294967294 " \
{(?:\{\}|1)} " 2 " [getDbDefaultCacheSize] " delete 0\$"]}

###############################################################################

runTest {test data-1.35 {SQLiteConnection.Open without SetDefaults} -setup {
  setupDb [set fileName data-1.35.db]
} -body {
  set result [list]

  lappend result [sql execute -execute scalar $db "PRAGMA page_size;"]
  lappend result [sql execute -execute scalar $db "PRAGMA max_page_count;"]
  lappend result [sql execute -execute scalar $db "PRAGMA legacy_file_format;"]
  lappend result [sql execute -execute scalar $db "PRAGMA synchronous;"]
  lappend result [sql execute -execute scalar $db "PRAGMA cache_size;"]
  lappend result [sql execute -execute scalar $db "PRAGMA journal_mode;"]
  lappend result [sql execute -execute scalar $db "PRAGMA foreign_keys;"]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result [appendArgs ^ [getDbDefaultPageSize] " 4294967294 " \
{(?:\{\}|0)} " 2 " [getDbDefaultCacheSize] " delete 0\$"]}

###############################################################################

runTest {test data-1.36 {SQLiteConnection.Open with PRAGMA overrides} -setup {
  #
  # NOTE: Attempt to open a connection with all available PRAGMA settings
  #       set to non-default values in the connection string.
  #
  setupDb [set fileName data-1.36.db] "" "" "" "" [join [list \
      "Page Size=4096" "Max Page Count=2048" "Legacy Format=True" \
      Synchronous=Normal "Cache Size=4096" "Journal Mode=Wal" \
      "Foreign Keys=True"] \;]
} -body {
  set result [list]

  lappend result [sql execute -execute scalar $db "PRAGMA page_size;"]
  lappend result [sql execute -execute scalar $db "PRAGMA max_page_count;"]
  lappend result [sql execute -execute scalar $db "PRAGMA legacy_file_format;"]
  lappend result [sql execute -execute scalar $db "PRAGMA synchronous;"]
  lappend result [sql execute -execute scalar $db "PRAGMA cache_size;"]
  lappend result [sql execute -execute scalar $db "PRAGMA journal_mode;"]
  lappend result [sql execute -execute scalar $db "PRAGMA foreign_keys;"]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result {^4096 2048 (?:\{\}|1) 1 4096 wal 1$}}

###############################################################################

runTest {test data-1.37 {sqlite3_win32_set_directory function} -setup {
  set directory(base) [getDatabaseDirectory]

  if {[string length $directory(base)] == 0 || \
      ![file exists $directory(base)] || \
      ![file isdirectory $directory(base)]} then {
    error [appendArgs "base directory \"" $directory(base) "\" is invalid"]
  }

  set directory(data) [file join $directory(base) \
      [appendArgs sqlite .data. [pid]]]

  file mkdir $directory(data)

  tputs $test_channel [appendArgs "---- created data directory \"" \
      $directory(data) \"\n]

  set directory(temp) [file join $directory(base) \
      [appendArgs sqlite .temp. [pid]]]

  file mkdir $directory(temp)

  tputs $test_channel [appendArgs "---- created temporary directory \"" \
      $directory(temp) \"\n]

  proc threadStart {} {
    while {$::i < 1000} {
      set ::found(temp) [expr \
          {[llength [file list $::directory(temp) etilqs_*]] > 0}]

      if {$::found(temp)} then {
        return
      }
    }
  }
} -body {
  set result [list]

  #
  # NOTE: Attempt to modify the process-wide data and temporary directory
  #       settings for the SQLite core library.
  #
  lappend result [object invoke -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods sqlite3_win32_set_directory 1 \
      $directory(data)]

  lappend result [object invoke -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods sqlite3_win32_set_directory 2 \
      $directory(temp)]

  setupDb [set fileName data-1.37.db] "" "" "" "" "" false false false false

  sql execute $db "CREATE TABLE t1(x NOT NULL);"

  for {set i 1} {$i < 100} {incr i} {
    sql execute $db "INSERT INTO t1 (x) VALUES(?);" \
        [list param1 String [expr {randstr(1024)}]]
  }

  set found(data) [expr \
      {[llength [file list $directory(data) $fileName]] == 1}]

  set t [createThread threadStart]
  sql execute $db "BEGIN TRANSACTION;"; startThread $t

  for {set i 1} {$i < 1000} {incr i} {
    #
    # NOTE: Execute a query that should force the creation of a temporary file
    #       for its statement journal.
    #
    sql execute $db "UPDATE t1 SET x = ?;" \
        [list param1 String [expr {randstr(1024)}]]

    #
    # NOTE: Give the other thread some time to notice the temporary file.
    #
    after [expr {int(rand() * 1000)}]

    #
    # NOTE: Stop when the other thread confirms that the temporary file was
    #       created in the correct directory.
    #
    if {[info exists found(temp)] && $found(temp)} then {
      break
    }
  }

  $t Join; sql execute $db "COMMIT TRANSACTION;"

  lappend result $found(data) [expr {[info exists found(temp)] ? \
      $found(temp) : False}]; set result
} -cleanup {
  #
  # NOTE: Close the database; however, do not attempt to delete the file as
  #       it is not located in the database directory known to the cleanupDb
  #       procedure (i.e. the one returned by getDatabaseDirectory).
  #
  cleanupDb $fileName db true false false

  #
  # NOTE: Attempt to restore the process-wide data and temporary directory
  #       settings for the SQLite core library.
  #
  catch {
    object invoke -flags +NonPublic System.Data.SQLite.UnsafeNativeMethods \
        sqlite3_win32_set_directory 1 null
  }

  catch {
    object invoke -flags +NonPublic System.Data.SQLite.UnsafeNativeMethods \
        sqlite3_win32_set_directory 2 null
  }

  if {[info exists directory(data)] && \
      [file exists $directory(data)] && \
      [file isdirectory $directory(data)]} then {
    file delete -recursive -force $directory(data)
  }

  if {[info exists directory(temp)] && \
      [file exists $directory(temp)] && \
      [file isdirectory $directory(temp)]} then {
    file delete -recursive -force $directory(temp)
  }

  if {[info exists t] && [cleanupThread $t]} then {
    unset t
  }

  catch {object removecallback threadStart}

  unset -nocomplain t found i db fileName result directory

  rename threadStart ""
} -constraints {eagle command.object windows monoBug28 command.sql compile.DATA\
compile.THREADING SQLite System.Data.SQLite sqlite3_win32_set_directory} \
-result {Ok Ok True True}}

###############################################################################

runTest {test data-1.38 {serialization of SQLiteException} -body {
  set serializer [object create -alias \
      System.Runtime.Serialization.Formatters.Binary.BinaryFormatter]

  set stream [object create -alias System.IO.MemoryStream]

  set exception(1) [object create -alias \
      System.Data.SQLite.SQLiteException 14 "this is a test"]; # CantOpen

  $serializer Serialize $stream $exception(1)

  $stream Seek 0 Begin

  set exception(2) [$serializer -alias Deserialize $stream]

  list [$exception(1) ResultCode] \
      [string map [list \r\n \n] [$exception(1) Message]] \
      [$exception(2) ResultCode] \
      [string map [list \r\n \n] [$exception(2) Message]] \
      [expr {[$exception(1) ResultCode] eq [$exception(2) ResultCode]}] \
      [expr {[$exception(1) Message] eq [$exception(2) Message]}]
} -cleanup {
  unset -nocomplain exception stream serializer
} -constraints {eagle command.object monoBug58 SQLite System.Data.SQLite} \
-result {CantOpen {unable to open database file
this is a test} CantOpen {unable to open database file
this is a test} True True}}

###############################################################################

runTest {test data-1.39 {unencrypted database, with password} -setup {
  setupDb [set fileName data-1.39.db]
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Password=12345;" true false

  set result [list]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "" true false

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain error result db fileName
} -constraints {eagle System.Data.SQLite.Encryption monoBug28 command.sql\
compile.DATA SQLite System.Data.SQLite} -match regexp -result {^1 \{(?:file is\
not a database|database disk image is malformed)\} 1 \{(?:file is not a\
database|database disk image is malformed)\} 0 1 0 2$}}

###############################################################################

runTest {test data-1.40 {encrypted database, wrong password} -setup {
  setupDb [set fileName data-1.40.db] "" "" "" "" "Password=12345;"
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Password=12346;" true false

  set result [list]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Password=12345;" true false

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain error result db fileName
} -constraints {eagle System.Data.SQLite.Encryption monoBug28 command.sql\
compile.DATA SQLite System.Data.SQLite} -match regexp -result {^1 \{(?:file is\
not a database|database disk image is malformed)\} 1 \{(?:file is not a\
database|database disk image is malformed)\} 0 1 0 2$}}

###############################################################################

runTest {test data-1.41 {encrypted database, password w/start-space} -setup {
  setupDb [set fileName data-1.41.db] "" "" "" "" "Password= 1234;"
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Password=1234;" true false

  set result [list]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] $error

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] $error

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Password= 1234;" true false

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] $error

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] $error

  cleanupDb $fileName db true false false

  lappend result [expr {
      [string equal [readDbFileHeader [file join \
      [getDatabaseDirectory] $fileName]] \
      [getDbFileHeader]] == ![page1MustBeEncrypted]
  }]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain error result db fileName
} -constraints {eagle System.Data.SQLite.Encryption monoBug28 command.sql\
compile.DATA SQLite System.Data.SQLite} -result {0 1 0 1 0 1 0 3 True}}

###############################################################################

runTest {test data-1.42 {encrypted database, w/quoted-start-space} -setup {
  setupDb [set fileName data-1.42.db] "" "" "" "" "Password=\" 1234\";"
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Password=1234;" true false

  set result [list]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Password=\" 1234\";" true false

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain error result db fileName
} -constraints {eagle System.Data.SQLite.Encryption monoBug28 command.sql\
compile.DATA SQLite System.Data.SQLite} -match regexp -result {^1 \{(?:file is\
not a database|database disk image is malformed)\} 1 \{(?:file is not a\
database|database disk image is malformed)\} 0 1 0 2$}}

###############################################################################

runTest {test data-1.43 {encrypted database, password w/mid-space} -setup {
  setupDb [set fileName data-1.43.db] "" "" "" "" "Password=12 45;"
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Password=1245;" true false

  set result [list]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Password=12 45;" true false

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain error result db fileName
} -constraints {eagle System.Data.SQLite.Encryption monoBug28 command.sql\
compile.DATA SQLite System.Data.SQLite} -match regexp -result {^1 \{(?:file is\
not a database|database disk image is malformed)\} 1 \{(?:file is not a\
database|database disk image is malformed)\} 0 1 0 2$}}

###############################################################################

runTest {test data-1.44 {encrypted database, password w/end-space} -setup {
  setupDb [set fileName data-1.44.db] "" "" "" "" "Password=1234 ;"
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Password=1234;" true false

  set result [list]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] $error

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] $error

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Password=1234 ;" true false

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] $error

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] $error

  cleanupDb $fileName db true false false

  lappend result [expr {
      [string equal [readDbFileHeader [file join \
      [getDatabaseDirectory] $fileName]] \
      [getDbFileHeader]] == ![page1MustBeEncrypted]
  }]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain error result db fileName
} -constraints {eagle System.Data.SQLite.Encryption monoBug28 command.sql\
compile.DATA SQLite System.Data.SQLite} -result {0 1 0 1 0 1 0 3 True}}

###############################################################################

runTest {test data-1.45 {encrypted database, w/quoted-end-space} -setup {
  setupDb [set fileName data-1.45.db] "" "" "" "" "Password=\"1234 \";"
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Password=1234;" true false

  set result [list]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Password=\"1234 \";" true false

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain error result db fileName
} -constraints {eagle System.Data.SQLite.Encryption monoBug28 command.sql\
compile.DATA SQLite System.Data.SQLite} -match regexp -result {^1 \{(?:file is\
not a database|database disk image is malformed)\} 1 \{(?:file is not a\
database|database disk image is malformed)\} 0 1 0 2$}}

###############################################################################

runTest {test data-1.46 {encrypted database, password via builder} -setup {
  setupDb [set fileName data-1.46.db] "" "" "" "" "Password=67 89;"
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  cleanupDb $fileName db true false false

  set connectionStringBuilder [object create -alias \
      System.Data.SQLite.SQLiteConnectionStringBuilder]

  $connectionStringBuilder DataSource \
      [file join [getDatabaseDirectory] $fileName]

  $connectionStringBuilder Password "67 89"

  set connection [object create -alias \
      System.Data.SQLite.SQLiteConnection \
      [$connectionStringBuilder ToString] true]

  $connection Open; addDbConnection $connection

  set result [list]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] $error

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] $error

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Password=\"67 89\";" true false

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] $error

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] $error

  cleanupDb $fileName db true false false

  lappend result [expr {
      [string equal [readDbFileHeader [file join \
      [getDatabaseDirectory] $fileName]] \
      [getDbFileHeader]] == ![page1MustBeEncrypted]
  }]

  set result
} -cleanup {
  unset -nocomplain connection

  cleanupDb $fileName; # NOTE: After object disposal.

  unset -nocomplain connectionStringBuilder error result db fileName
} -constraints {eagle command.object System.Data.SQLite.Encryption monoBug28\
command.sql compile.DATA SQLite System.Data.SQLite} -result \
{0 1 0 1 0 1 0 3 True}}

###############################################################################

runTest {test data-1.47 {quoted connection string properties} -setup {
  unset -nocomplain result list pair strings string
} -body {
  set result [list]

  set strings [list \
      "OneTwo=ThreeFour" "\"OneTwo\"=\"ThreeFour\"" \
      "One Two=Three Four" "\"One Two\"=\"Three Four\"" \
      "OneTwo=ThreeFour;" "\"OneTwo\"=\"ThreeFour\";" \
      "One Two=Three Four;" "\"One Two\"=\"Three Four\";"]

  foreach string $strings {
    set list [object invoke -flags +NonPublic \
        System.Data.SQLite.SQLiteConnection ParseConnectionString \
        $string false]

    object foreach -alias pair $list {
      lappend result [list [$pair Key] [$pair Value]]
    }
  }

  set result
} -cleanup {
  unset -nocomplain result list pair strings string
} -constraints {eagle command.object System.Data.SQLite} -result {{OneTwo\
ThreeFour} {OneTwo ThreeFour} {{One Two} {Three Four}} {{One Two} {Three Four}}\
{OneTwo ThreeFour} {OneTwo ThreeFour} {{One Two} {Three Four}} {{One Two}\
{Three Four}}}}

###############################################################################

runTest {test data-1.48 {rollback to nested savepoint} -setup {
  setupDb [set fileName data-1.48.db]
} -body {
  sql execute $db "BEGIN IMMEDIATE TRANSACTION;"
  sql execute $db "SAVEPOINT one;"

  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "SAVEPOINT two;"

  sql execute $db "INSERT INTO t1 (x) VALUES(1);"
  lappend result [sql execute -execute scalar $db "SELECT COUNT(*) FROM t1;"]
  sql execute $db "SAVEPOINT three;"

  sql execute $db "INSERT INTO t1 (x) VALUES(2);"
  lappend result [sql execute -execute scalar $db "SELECT COUNT(*) FROM t1;"]

  sql execute $db "ROLLBACK TRANSACTION TO SAVEPOINT three;"
  lappend result [sql execute -execute scalar $db "SELECT COUNT(*) FROM t1;"]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{1 2 1}}

###############################################################################

runTest {test data-1.49 {NoExtensionFunctions connection flag} -setup {
  setupDb [set fileName data-1.49.db]
} -body {
  set result [list]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT replicate('1234', 2);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  cleanupDb $fileName
  setupDb $fileName "" "" "" NoExtensionFunctions

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT replicate('1234', 3);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  cleanupDb $fileName
  setupDb $fileName

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT replicate('1234', 4);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain error result db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_EXTENSION_FUNCTIONS} -match regexp \
-result {^0 12341234 1 \{SQL logic error( or missing database)? -- no such\
function: replicate\} 0 1234123412341234$}}

###############################################################################

runTest {test data-1.50 {column name and index lookup} -setup {
  setupDb [set fileName data-1.50.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x, y, z);
    INSERT INTO t1 (x, y, z) VALUES(1, 'foo', 1234);
  }

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db "SELECT x, y, z FROM t1;"]

  set result [list]

  while {[$dataReader Read]} {
    lappend result \
        [list [$dataReader GetName 0] [$dataReader GetOrdinal x] \
            [$dataReader Item x]] \
        [list [$dataReader GetName 1] [$dataReader GetOrdinal y] \
            [$dataReader Item y]] \
        [list [$dataReader GetName 2] [$dataReader GetOrdinal z] \
            [$dataReader Item z]]
  }

  set result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{x 0 1} {y 1 foo} {z 2 1234}}}

###############################################################################

runTest {test data-1.51 {nullable value types} -setup {
  setupDb [set fileName data-1.51.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER);
    INSERT INTO t1 (x) VALUES(NULL);
    INSERT INTO t1 (x) VALUES(1);
  }

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db "SELECT x FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    foreach {a b c d e} [list "" "" "" "" ""] break

    set x [$dataReader GetOrdinal x]

    foreach {a b c e} [list \
        [$dataReader GetName $x] [$dataReader GetValue $x] \
        [catch {$dataReader GetInt64 $x} d] [$dataReader Item x]] break

    lappend result [list \
        $x $a $b $c [extractSystemDataSQLiteExceptionMessage $d] $e]
  }

  set result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain e d c b a x result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -match regexp -result {^\{0 x System#DBNull#\d+ 1\
\{System\.Reflection\.TargetInvocationException: Exception has been thrown by\
the target of an invocation\.\s+---> System\.InvalidCastException:.*\}\
System#DBNull#\d+\} \{0 x 1 0 1 1\}$}}

###############################################################################

runTest {test data-1.52 {static SQLiteCommand.Execute method} -setup {
  unset -nocomplain result sql
} -body {
  set sql(1) { \
    CREATE TABLE t1(x); \
    INSERT INTO t1 (x) VALUES (NULL); \
    SELECT x FROM t1 ORDER BY x; \
  }

  set sql(2) { \
    CREATE TABLE t1(x); \
    INSERT INTO t1 (x) VALUES (?); \
    SELECT x FROM t1 ORDER BY x; \
  }

  set result(1) [object invoke System.Data.SQLite.SQLiteCommand Execute \
      "this will not execute" None null]

  set result(2) [object invoke System.Data.SQLite.SQLiteCommand Execute \
      $sql(1) NonQuery null]

  set result(3) [object invoke System.Data.SQLite.SQLiteCommand Execute \
      $sql(1) Scalar null]

  set result(4) [object invoke System.Data.SQLite.SQLiteCommand Execute \
      $sql(1) Reader null]

  set result(5) [object invoke System.Data.SQLite.SQLiteCommand Execute \
      "this will not execute" None null 1]

  set result(6) [object invoke System.Data.SQLite.SQLiteCommand Execute \
      $sql(2) NonQuery null 1]

  set result(7) [object invoke System.Data.SQLite.SQLiteCommand Execute \
      $sql(2) Scalar null 1]

  set result(8) [object invoke System.Data.SQLite.SQLiteCommand Execute \
      $sql(2) Reader null 1]

  list $result(1) $result(2) $result(3) $result(4) $result(5) $result(6) \
      $result(7) $result(8)
} -cleanup {
  unset -nocomplain result sql
} -constraints {eagle command.object monoBug28 SQLite System.Data.SQLite} \
-match regexp -result {^\{\} 1 System#DBNull#\d+\
System#Data#SQLite#SQLiteDataReader#\d+ \{\} 1 1\
System#Data#SQLite#SQLiteDataReader#\d+$}}

###############################################################################

runTest {test data-1.53 {BindAllAsText w/DateTime} -setup {
  setupDb [set fileName data-1.53.db] "" Ticks Utc BindAllAsText
} -body {
  sql execute $db "CREATE TABLE t1(x);"

  list [sql execute $db "INSERT INTO t1 (x) VALUES(?);" \
      [list param1 DateTime [set dateTime [object invoke -create \
      DateTime ParseExact "2000-02-29 13:59:58.1234567Z" \
      [getDateTimeFormat] null AdjustToUniversal]]]] [sql execute \
      -execute reader -format list $db "SELECT x FROM t1;"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain dateTime db fileName
} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
compile.DATA SQLite System.Data.SQLite} -result {1 630874295981234567}}

###############################################################################

runTest {test data-1.54 {bind function to a connection} -setup {
  set fileName data-1.54.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    SELECT MyRandom(); \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public class Test${id} : SQLiteFunction
      {
        private Random random;

        ///////////////////////////////////////////////////////////////////////

        public Test${id}()
        {
          random = new Random();
        }

        ///////////////////////////////////////////////////////////////////////

        public override object Invoke(
          object\[\] args
          )
        {
          return random.Next();
        }

        ///////////////////////////////////////////////////////////////////////

        public static object DoTest(bool bindFunction)
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            if (bindFunction)
            {
              connection.BindFunction(new SQLiteFunctionAttribute(
                "MyRandom", 0, FunctionType.Scalar), new Test${id}());
            }

            using (SQLiteCommand command = new SQLiteCommand("${sql}",
                connection))
            {
              return command.ExecuteScalar();
            }
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} DoTest false
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} DoTest true
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} DoTest false
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 1 \{SQL logic error( or\
missing database)? -- no such function: MyRandom\} 0 (?:-)?\d+ 1 \{SQL logic\
error( or missing database)? -- no such function: MyRandom\}$}}

###############################################################################

runTest {test data-1.55 {SQLiteConvert TypeNameToDbType} -setup {
  unset -nocomplain result typeName
} -body {
  foreach typeName [list \
      BIGINT BIGUINT BINARY BIT BLOB BOOL BOOLEAN CHAR CLOB COUNTER CURRENCY \
      DATE DATETIME DECIMAL DOUBLE FLOAT GENERAL GUID IDENTITY IMAGE INT INT8 \
      INT16 INT32 INT64 INTEGER INTEGER8 INTEGER16 INTEGER32 INTEGER64 \
      LOGICAL LONG LONGCHAR LONGTEXT LONGVARCHAR MEDIUMINT MEDIUMUINT MEMO \
      MONEY NCHAR NOTE NTEXT NUMBER NUMERIC NVARCHAR OLEOBJECT RAW REAL SINGLE \
      SMALLDATE SMALLINT SMALLUINT STRING TEXT TIME TIMESTAMP TINYINT TINYSINT \
      UINT UINT8 UINT16 UINT32 UINT64 ULONG UNIQUEIDENTIFIER UNSIGNEDINTEGER \
      UNSIGNEDINTEGER8 UNSIGNEDINTEGER16 UNSIGNEDINTEGER32 UNSIGNEDINTEGER64 \
      VARBINARY VARCHAR VARCHAR2 YESNO] {
    lappend result [list $typeName [object invoke -flags +NonPublic \
        System.Data.SQLite.SQLiteConvert TypeNameToDbType null $typeName None]]
  }
  set result
} -cleanup {
  unset -nocomplain result typeName
} -constraints {eagle command.object System.Data.SQLite} -result {{BIGINT\
Int64} {BIGUINT UInt64} {BINARY Binary} {BIT Boolean} {BLOB Binary} {BOOL\
Boolean} {BOOLEAN Boolean} {CHAR AnsiStringFixedLength} {CLOB String} {COUNTER\
Int64} {CURRENCY Decimal} {DATE DateTime} {DATETIME DateTime} {DECIMAL Decimal}\
{DOUBLE Double} {FLOAT Double} {GENERAL Binary} {GUID Guid} {IDENTITY Int64}\
{IMAGE Binary} {INT Int32} {INT8 SByte} {INT16 Int16} {INT32 Int32} {INT64\
Int64} {INTEGER Int64} {INTEGER8 SByte} {INTEGER16 Int16} {INTEGER32 Int32}\
{INTEGER64 Int64} {LOGICAL Boolean} {LONG Int64} {LONGCHAR String} {LONGTEXT\
String} {LONGVARCHAR String} {MEDIUMINT Int32} {MEDIUMUINT UInt32} {MEMO\
String} {MONEY Decimal} {NCHAR StringFixedLength} {NOTE String} {NTEXT String}\
{NUMBER Decimal} {NUMERIC Decimal} {NVARCHAR String} {OLEOBJECT Binary} {RAW\
Binary} {REAL Double} {SINGLE Single} {SMALLDATE DateTime} {SMALLINT Int16}\
{SMALLUINT UInt16} {STRING String} {TEXT String} {TIME DateTime} {TIMESTAMP\
DateTime} {TINYINT Byte} {TINYSINT SByte} {UINT UInt32} {UINT8 Byte} {UINT16\
UInt16} {UINT32 UInt32} {UINT64 UInt64} {ULONG UInt64} {UNIQUEIDENTIFIER Guid}\
{UNSIGNEDINTEGER UInt64} {UNSIGNEDINTEGER8 Byte} {UNSIGNEDINTEGER16 UInt16}\
{UNSIGNEDINTEGER32 UInt32} {UNSIGNEDINTEGER64 UInt64} {VARBINARY Binary}\
{VARCHAR AnsiString} {VARCHAR2 AnsiString} {YESNO Boolean}}}

###############################################################################

runTest {test data-1.56 {totype extension} -setup {
  setupDb [set fileName data-1.56.db]
} -body {
  set connection [getDbConnection]
  set result [list]

  $connection EnableExtensions true

  $connection LoadExtension \
      [getCoreExtensionBinaryFileName null] sqlite3_totype_init

  lappend result [sql execute -execute scalar $db "SELECT tointeger('1');"]
  lappend result [sql execute -execute scalar $db "SELECT tointeger('1x');"]
  lappend result [sql execute -execute scalar $db "SELECT toreal('1.01');"]
  lappend result [sql execute -execute scalar $db "SELECT toreal('1.0x');"]

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain result connection

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
defineConstant.System.Data.SQLite.INTEROP_TOTYPE_EXTENSION\
System.Data.SQLite SQLiteInterop} -result {1 {} 1.01 {}}}

###############################################################################

runTest {test data-1.57 {regexp extension} -setup {
  setupDb [set fileName data-1.57.db]
} -body {
  unset -nocomplain pattern result

  set connection [getDbConnection]
  set result(1) [list]

  $connection EnableExtensions true

  $connection LoadExtension \
      [getCoreExtensionBinaryFileName null] sqlite3_regexp_init

  set pattern(1) {^\d+ [A-Z]{1,3}$}; # valid
  set pattern(2) {^\d+ [C]($}; # invalid

  lappend result(1) [catch {
    sql execute -execute scalar $db "SELECT REGEXP('$pattern(1)', '1 AB');"
  } result(2)] $result(2)

  lappend result(1) [catch {
    sql execute -execute scalar $db "SELECT REGEXP('$pattern(2)', '1 AB');"
  } result(2)] [string trim [lindex [split $result(2) \n] 1]]

  lappend result(1) [catch {
    sql execute -execute scalar $db "SELECT '1 AB' REGEXP '$pattern(1)';"
  } result(2)] $result(2)

  lappend result(1) [catch {
    sql execute -execute scalar $db "SELECT '1 AB' REGEXP '$pattern(2)';"
  } result(2)] [string trim [lindex [split $result(2) \n] 1]]

  lappend result(1) [catch {
    sql execute -execute scalar $db "SELECT REGEXP('$pattern(1)', '2');"
  } result(2)] $result(2)

  lappend result(1) [catch {
    sql execute -execute scalar $db "SELECT REGEXP('$pattern(2)', '2');"
  } result(2)] [string trim [lindex [split $result(2) \n] 1]]

  lappend result(1) [catch {
    sql execute -execute scalar $db "SELECT '2' REGEXP '$pattern(1)';"
  } result(2)] $result(2)

  lappend result(1) [catch {
    sql execute -execute scalar $db "SELECT '2' REGEXP '$pattern(2)';"
  } result(2)] [string trim [lindex [split $result(2) \n] 1]]

  set result(1)
} -cleanup {
  freeDbConnection

  unset -nocomplain pattern result connection

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
defineConstant.System.Data.SQLite.INTEROP_REGEXP_EXTENSION\
System.Data.SQLite SQLiteInterop} -result {0 1 1 {unmatched '('} 0 1 1\
{unmatched '('} 0 0 1 {unmatched '('} 0 0 1 {unmatched '('}}}

###############################################################################

reportSQLiteResources $test_channel

###############################################################################

runTest {test data-1.58 {SQLiteConnection.ReleaseMemory method} -setup {
  setupDb [set fileName data-1.58.db]
} -body {
  set result [list]

  set nFree 0; set resetOk false; set nLargest 0
  set code [object invoke \
      System.Data.SQLite.SQLiteConnection ReleaseMemory \
      -1 true true nFree resetOk nLargest]

  lappend result [list $code $nFree $resetOk $nLargest]

  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(RANDOMBLOB(1048576));"

  set nFree 0; set resetOk false; set nLargest 0
  set code [object invoke \
      System.Data.SQLite.SQLiteConnection ReleaseMemory \
      -1 true true nFree resetOk nLargest]

  tputs $test_channel [appendArgs \
      "---- memory released by SQLite... " $nFree " bytes\n"]

  lappend result [list $code $nFree $resetOk $nLargest]

  cleanupDb $fileName
  checkForSQLiteDirectories $test_channel true

  set nFree 0; set resetOk false; set nLargest 0
  set code [object invoke \
      System.Data.SQLite.SQLiteConnection ReleaseMemory \
      -1 true true nFree resetOk nLargest]

  tputs $test_channel [appendArgs \
      "---- largest free SQLite heap block... " $nLargest " bytes\n"]

  lappend result [list $code $nFree $resetOk $nLargest]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain nLargest resetOk nFree code result db fileName
} -constraints {eagle command.object windows monoBug28 command.sql compile.DATA\
SQLite System.Data.SQLite buildConfiguration.Release} -match regexp -result \
{^\{Busy 0 False 0\} \{Busy \d+ False 0\} \{Ok 0 True \d+\}$}}

###############################################################################

runTest {test data-1.59 {percentile extension} -setup {
  setupDb [set fileName data-1.59.db]
} -body {
  set connection [getDbConnection]
  set result [list]

  $connection EnableExtensions true

  $connection LoadExtension \
      [getCoreExtensionBinaryFileName null] sqlite3_percentile_init

  lappend result [sql execute $db "CREATE TABLE t1(x);"]
  lappend result [sql execute $db "INSERT INTO t1 VALUES(1),(2),(3),(4);"]
  lappend result [sql execute $db "SELECT percentile(x,25) FROM t1;"]

  lappend result [sql execute -execute scalar $db \
      "SELECT percentile(x,25) FROM t1;"]

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain result connection

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
defineConstant.System.Data.SQLite.INTEROP_PERCENTILE_EXTENSION\
System.Data.SQLite SQLiteInterop} -result {0 4 -1 1.75}}

###############################################################################

runTest {test data-1.60 {per-connection type mappings} -setup {
  setupDb [set fileName data-1.60.db] "" "" "" UseConnectionTypes
} -body {
  set connection [getDbConnection]
  set result [list]

  lappend result [sql execute $db \
      "CREATE TABLE t1(x DATE, y MYDATE);"]

  set dateTime [clock format [clock scan "2014-02-01 12:34:56Z"] \
      -format yyyyMMddHHmmss -gmt true]

  lappend result [sql execute $db [appendArgs \
      "INSERT INTO t1 (x, y) VALUES('" $dateTime "', '" $dateTime "');"]]

  lappend result [sql execute -verbatim -execute reader -format list \
      -datetimeformat [getDateTimeFormat] $db "SELECT x, y FROM t1;"]

  lappend result [$connection ClearTypeMappings]; # 0
  lappend result [$connection AddTypeMapping MYDATE DateTime false]; # 0
  lappend result [$connection AddTypeMapping MYDATE DateTime true]; # 1
  lappend result [$connection AddTypeMapping MYDATE DateTime false]; # 1
  lappend result [$connection AddTypeMapping MYDATE DateTime true]; # 2
  lappend result [$connection ClearTypeMappings]; # 2
  lappend result [$connection AddTypeMapping MYDATE DateTime true]; # 0

  set typeMappings [$connection GetTypeMappings]

  object foreach -alias pair $typeMappings {
    set typeMapping [$pair Value]
    lappend result [list [$pair Key] [enumerableToList $typeMapping]]
  }

  lappend result [sql execute -verbatim -execute reader -format list \
      -datetimeformat [getDateTimeFormat] $db "SELECT x, y FROM t1;"]

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain typeMapping typeMappings pair result connection

  cleanupDb $fileName

  unset -nocomplain dateTime db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {0 1 {{2014-02-01 12:34:56} 20140201123456} 0 0 1 1\
2 2 0 {MYDATE {MYDATE DateTime True}} {{2014-02-01 12:34:56} {2014-02-01\
12:34:56}}}}

###############################################################################

runTest {test data-1.61 {SELECT without TYPES} -setup {
  setupDb [set fileName data-1.61.db]
} -body {
  set values [list NULL 1 'one' 1.0 X'01']
  sql execute $db "CREATE TABLE t1(x, y);"

  foreach x $values {
    foreach y $values {
      sql execute $db [appendArgs \
          "INSERT INTO t1 (x, y) VALUES(" $x ", " $y ");"]
    }
  }

  sql execute -execute reader -format list -allownull true $db \
      "SELECT rowId, x, y FROM t1 ORDER BY rowId;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain y x values db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {1 {} {} 2 {} 1 3 {} one 4 {} 1 5 {} 1 6 1 {} 7 1 1\
8 1 one 9 1 1 10 1 1 11 one {} 12 one 1 13 one one 14 one 1 15 one 1 16 1 {} 17\
1 1 18 1 one 19 1 1 20 1 1 21 1 {} 22 1 1 23 1 one 24 1 1 25 1 1}}

###############################################################################

runTest {test data-1.62 {SELECT with TYPES} -setup {
  setupDb [set fileName data-1.62.db]
} -body {
  set values [list NULL 1 'one' 1.0 X'01']
  sql execute $db "CREATE TABLE t1(x, y);"

  foreach x $values {
    foreach y $values {
      sql execute $db [appendArgs \
          "INSERT INTO t1 (x, y) VALUES(" $x ", " $y ");"]
    }
  }

  sql execute -execute reader -format list -allownull true $db \
      "TYPES INTEGER, INTEGER, REAL; SELECT rowId, x, y FROM t1 ORDER BY rowId;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain y x values db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {1 {} {} 2 {} 1 3 {} 0 4 {} 1 5 {} 0 6 1 {} 7 1 1 8\
1 0 9 1 1 10 1 0 11 0 {} 12 0 1 13 0 0 14 0 1 15 0 0 16 1 {} 17 1 1 18 1 0 19 1\
1 20 1 0 21 0 {} 22 0 1 23 0 0 24 0 1 25 0 0}}

###############################################################################

runTest {test data-1.63 {SQLiteDataReader HasRows property} -setup {
  setupDb [set fileName data-1.63.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
    CREATE TABLE t2(x);
    INSERT INTO t2 (x) VALUES(1);
    CREATE TABLE t3(x);
    INSERT INTO t3 (x) VALUES(1);
    INSERT INTO t3 (x) VALUES(2);
  }

  set reader(1) [sql execute -execute reader -format datareader -alias \
      $db "SELECT * FROM t1;"]

  set reader(2) [sql execute -execute reader -format datareader -alias \
      $db "SELECT * FROM t2;"]

  set reader(3) [sql execute -execute reader -format datareader -alias \
      $db "SELECT * FROM t3;"]

  set noRow "*: No current row*"

  list [$reader(1) HasRows] [$reader(2) HasRows] [$reader(3) HasRows] \
      [$reader(1) Read] [$reader(2) Read] [$reader(3) Read] \
      [$reader(1) HasRows] [$reader(2) HasRows] [$reader(3) HasRows] \
      [catch {$reader(1) Item x} error] [string match $noRow $error] \
      [catch {$reader(2) Item x} error] [string match $noRow $error] \
      [catch {$reader(3) Item x} error] [string match $noRow $error] \
      [$reader(1) HasRows] [$reader(2) HasRows] [$reader(3) HasRows] \
      [$reader(1) Read] [$reader(2) Read] [$reader(3) Read] \
      [$reader(1) HasRows] [$reader(2) HasRows] [$reader(3) HasRows] \
      [catch {$reader(1) Item x} error] [string match $noRow $error] \
      [catch {$reader(2) Item x} error] [string match $noRow $error] \
      [catch {$reader(3) Item x} error] [string match $noRow $error] \
      [$reader(1) HasRows] [$reader(2) HasRows] [$reader(3) HasRows] \
      [$reader(1) Read] [$reader(2) Read] [$reader(3) Read] \
      [$reader(1) HasRows] [$reader(2) HasRows] [$reader(3) HasRows] \
      [catch {$reader(1) Item x} error] [string match $noRow $error] \
      [catch {$reader(2) Item x} error] [string match $noRow $error] \
      [catch {$reader(3) Item x} error] [string match $noRow $error]
} -cleanup {
  unset -nocomplain reader

  cleanupDb $fileName

  unset -nocomplain error noRow db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {False True True False True True False True True 1\
True 0 False 0 False False True True False False True False False True 1 True 1\
True 0 False False False True False False False False False False 1 True 1 True\
1 True}}

###############################################################################

runTest {test data-1.64 {SQLiteDataReader sticky HasRows property} -setup {
  setupDb [set fileName data-1.64.db] "" "" "" StickyHasRows
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
    CREATE TABLE t2(x);
    INSERT INTO t2 (x) VALUES(1);
    CREATE TABLE t3(x);
    INSERT INTO t3 (x) VALUES(1);
    INSERT INTO t3 (x) VALUES(2);
  }

  set reader(1) [sql execute -execute reader -format datareader -alias \
      $db "SELECT * FROM t1;"]

  set reader(2) [sql execute -execute reader -format datareader -alias \
      $db "SELECT * FROM t2;"]

  set reader(3) [sql execute -execute reader -format datareader -alias \
      $db "SELECT * FROM t3;"]

  set noRow "*: No current row*"

  list [$reader(1) HasRows] [$reader(2) HasRows] [$reader(3) HasRows] \
      [$reader(1) Read] [$reader(2) Read] [$reader(3) Read] \
      [$reader(1) HasRows] [$reader(2) HasRows] [$reader(3) HasRows] \
      [catch {$reader(1) Item x} error] [string match $noRow $error] \
      [catch {$reader(2) Item x} error] [string match $noRow $error] \
      [catch {$reader(3) Item x} error] [string match $noRow $error] \
      [$reader(1) HasRows] [$reader(2) HasRows] [$reader(3) HasRows] \
      [$reader(1) Read] [$reader(2) Read] [$reader(3) Read] \
      [$reader(1) HasRows] [$reader(2) HasRows] [$reader(3) HasRows] \
      [catch {$reader(1) Item x} error] [string match $noRow $error] \
      [catch {$reader(2) Item x} error] [string match $noRow $error] \
      [catch {$reader(3) Item x} error] [string match $noRow $error] \
      [$reader(1) HasRows] [$reader(2) HasRows] [$reader(3) HasRows] \
      [$reader(1) Read] [$reader(2) Read] [$reader(3) Read] \
      [$reader(1) HasRows] [$reader(2) HasRows] [$reader(3) HasRows] \
      [catch {$reader(1) Item x} error] [string match $noRow $error] \
      [catch {$reader(2) Item x} error] [string match $noRow $error] \
      [catch {$reader(3) Item x} error] [string match $noRow $error]
} -cleanup {
  unset -nocomplain reader

  cleanupDb $fileName

  unset -nocomplain error noRow db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {False True True False True True False True True 1\
True 0 False 0 False False True True False False True False True True 1 True 1\
True 0 False False True True False False False False True True 1 True 1 True 1\
True}}

###############################################################################

runTest {test data-1.65 {SQLiteDataReader StepCount property} -setup {
  setupDb [set fileName data-1.65.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
    CREATE TABLE t2(x);
    INSERT INTO t2 (x) VALUES(1);
    CREATE TABLE t3(x);
    INSERT INTO t3 (x) VALUES(1);
    INSERT INTO t3 (x) VALUES(2);
  }

  set reader(1) [sql execute -execute reader -format datareader -alias \
      $db "SELECT * FROM t1;"]

  set reader(2) [sql execute -execute reader -format datareader -alias \
      $db "SELECT * FROM t2;"]

  set reader(3) [sql execute -execute reader -format datareader -alias \
      $db "SELECT * FROM t3;"]

  set noRow "*: No current row*"

  list [$reader(1) StepCount] [$reader(2) StepCount] [$reader(3) StepCount] \
      [$reader(1) Read] [$reader(2) Read] [$reader(3) Read] \
      [$reader(1) StepCount] [$reader(2) StepCount] [$reader(3) StepCount] \
      [catch {$reader(1) Item x} error] [string match $noRow $error] \
      [catch {$reader(2) Item x} error] [string match $noRow $error] \
      [catch {$reader(3) Item x} error] [string match $noRow $error] \
      [$reader(1) StepCount] [$reader(2) StepCount] [$reader(3) StepCount] \
      [$reader(1) Read] [$reader(2) Read] [$reader(3) Read] \
      [$reader(1) StepCount] [$reader(2) StepCount] [$reader(3) StepCount] \
      [catch {$reader(1) Item x} error] [string match $noRow $error] \
      [catch {$reader(2) Item x} error] [string match $noRow $error] \
      [catch {$reader(3) Item x} error] [string match $noRow $error] \
      [$reader(1) StepCount] [$reader(2) StepCount] [$reader(3) StepCount] \
      [$reader(1) Read] [$reader(2) Read] [$reader(3) Read] \
      [$reader(1) StepCount] [$reader(2) StepCount] [$reader(3) StepCount] \
      [catch {$reader(1) Item x} error] [string match $noRow $error] \
      [catch {$reader(2) Item x} error] [string match $noRow $error] \
      [catch {$reader(3) Item x} error] [string match $noRow $error]
} -cleanup {
  unset -nocomplain reader

  cleanupDb $fileName

  unset -nocomplain error noRow db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {0 1 1 False True True 0 1 1 1 True 0 False 0 False\
0 1 1 False False True 0 1 2 1 True 1 True 0 False 0 1 2 False False False 0 1\
2 1 True 1 True 1 True}}

###############################################################################

runTest {test data-1.66 {SQLiteConnection.SetChunkSize default} -setup {
  setupDb [set fileName data-1.66.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(a, b);
  }

  file size [file join [getDatabaseDirectory] $fileName]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
[expr {[getDbDefaultPageSize] * 2}]}

###############################################################################

runTest {test data-1.67 {SQLiteConnection.SetChunkSize method} -setup {
  setupDb [set fileName data-1.67.db]
} -body {
  set connection [getDbConnection]

  lappend result [$connection SetChunkSize [expr {32 * 1024}]]

  sql execute $db {
    CREATE TABLE t1(a, b);
  }

  lappend result [file size [file join [getDatabaseDirectory] $fileName]]
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain result connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {Ok 32768}}

###############################################################################

runTest {test data-1.68 {unset env(DefaultFlags_SQLiteConnection)} -setup {
  saveSQLiteConnectionEnvironment

  unset -nocomplain env(DefaultFlags_SQLiteConnection)
  unset -nocomplain ::connection_flags

  setupDb [set fileName data-1.68.db]
} -body {
  set connection [getDbConnection]

  list [object invoke System.Data.SQLite.SQLiteConnection DefaultFlags] \
      [$connection Flags]
} -cleanup {
  cleanupDb $fileName
  restoreSQLiteConnectionEnvironment

  freeDbConnection

  unset -nocomplain connection db fileName savedEnv
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -match regexp -result \
{^Default Default|LogCallbackException LogCallbackException$}}

###############################################################################

runTest {test data-1.69 {set env(DefaultFlags_SQLiteConnection)} -setup {
  saveSQLiteConnectionEnvironment

  set env(DefaultFlags_SQLiteConnection) "DetectTextAffinity, DetectStringType"
  unset -nocomplain ::connection_flags

  setupDb [set fileName data-1.69.db]
} -body {
  set connection [getDbConnection]

  list [object invoke System.Data.SQLite.SQLiteConnection DefaultFlags] \
      [$connection Flags]
} -cleanup {
  cleanupDb $fileName
  restoreSQLiteConnectionEnvironment

  freeDbConnection

  unset -nocomplain connection db fileName savedEnv
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{DetectTextAffinity, DetectStringType}\
{DetectTextAffinity, DetectStringType}}}

###############################################################################

runTest {test data-1.70 {LINQ w/String.Substring Method} -body {
  copySampleDatabaseFiles

  set result [list]
  set output ""

  set code [catch {
    testClrExec $testLinqExeFile [list -eventflags Wait -directory \
        [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
        -success Success] -substring
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  lappend result $code

  if {$code == 0} then {
    lappend result [string trim $output]
  } else {
    lappend result [string trim $error]
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result
} -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll testExec\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db} \
-result {0 {True True True True True True True True True True True True True\
True True True True True True True True True True True True True True True True\
True True True True True True True True True True True True True True True True\
True True True True True True True True True True True True True True True True\
True True True True True True True True True True True True True True True True\
True True True True True True True True True True True True True True}}}

###############################################################################

runTest {test data-1.71 {fts5 extension} -setup {
  setupDb [set fileName data-1.71.db]
} -body {
  set connection [getDbConnection]
  set result [list]

  $connection EnableExtensions true

  $connection LoadExtension \
      [getCoreExtensionBinaryFileName null] sqlite3_fts5_init

  lappend result [sql execute -execute scalar $db "SELECT fts5_source_id();"]

  lappend result [sql execute -execute scalar $db \
      "CREATE VIRTUAL TABLE t1 USING fts5(x, prefix=\"1\");"]

  foreach x [list cat dog horse house] {
    lappend result [sql execute -execute scalar $db \
        [appendArgs "INSERT INTO t1(x) VALUES('" $x "');"]]
  }

  lappend result [sql execute -execute reader -format dictionary $db \
      "SELECT rowid, x FROM t1 WHERE t1 MATCH 'h*';"]

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain x result connection

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
defineConstant.System.Data.SQLite.INTEROP_FTS5_EXTENSION\
System.Data.SQLite SQLiteInterop} -match regexp -result \
{^\{fts5: \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} [0-9a-f]{40,64}(?:alt1|alt2)?\}\
\{\} \{\} \{\} \{\} \{\} \{rowid 3 x horse rowid 4 x house\}$}}

###############################################################################

runTest {test data-1.72 {unbind function from a connection} -setup {
  set fileName data-1.72.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    SELECT MyRandom(); \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public class Test${id} : SQLiteFunction
      {
        private Random random;
        private static SQLiteFunctionAttribute functionAttribute;
        private static SQLiteConnection connection;

        ///////////////////////////////////////////////////////////////////////

        public Test${id}()
        {
          random = new Random();
        }

        ///////////////////////////////////////////////////////////////////////

        public override object Invoke(
          object\[\] args
          )
        {
          return random.Next();
        }

        ///////////////////////////////////////////////////////////////////////

        private static void Initialize()
        {
          if (functionAttribute == null)
          {
            functionAttribute = new SQLiteFunctionAttribute(
                "MyRandom", 0, FunctionType.Scalar);
          }

          if (connection == null)
          {
            connection = new SQLiteConnection(
                "Data Source=${dataSource};[getTestProperties]");

            connection.Open();
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static void BindFunction()
        {
          Initialize();

          connection.BindFunction(functionAttribute, new Test${id}());
        }

        ///////////////////////////////////////////////////////////////////////

        public static object CallFunction()
        {
          Initialize();

          using (SQLiteCommand command = new SQLiteCommand("${sql}",
              connection))
          {
            return command.ExecuteScalar();
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static bool UnbindFunction()
        {
          Initialize();

          return connection.UnbindFunction(functionAttribute);
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Uninitialize()
        {
          if (connection != null)
          {
            connection.Close();
            connection = null;
          }

          if (functionAttribute != null)
            functionAttribute = null;
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} BindFunction
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} CallFunction
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} UnbindFunction
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} CallFunction
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} BindFunction
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} CallFunction
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Uninitialize
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\} 0 (?:-)?\d+ 0 True 1\
\{SQL logic error( or missing database)? -- no such function: MyRandom\} 0 \{\}\
0 (?:-)?\d+ 0 \{\}$}}

###############################################################################

runTest {test data-1.73 {unbind functions from a connection on close} -setup {
  set fileName data-1.73.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    SELECT MyRandom(); \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public class Test${id} : SQLiteFunction
      {
        private Random random;
        private static SQLiteFunctionAttribute functionAttribute;
        private static SQLiteConnection connection;

        ///////////////////////////////////////////////////////////////////////

        public Test${id}()
        {
          random = new Random();
        }

        ///////////////////////////////////////////////////////////////////////

        public override object Invoke(
          object\[\] args
          )
        {
          return random.Next();
        }

        ///////////////////////////////////////////////////////////////////////

        private static void Initialize()
        {
          if (functionAttribute == null)
          {
            functionAttribute = new SQLiteFunctionAttribute(
                "MyRandom", 0, FunctionType.Scalar);
          }

          if (connection == null)
          {
            connection = new SQLiteConnection(
                "Data Source=${dataSource};Pooling=True;" +
                "[getTestProperties UnbindFunctionsOnClose]");

            connection.Open();
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static void BindFunction()
        {
          Initialize();

          connection.BindFunction(functionAttribute, new Test${id}());
        }

        ///////////////////////////////////////////////////////////////////////

        public static object CallFunction()
        {
          Initialize();

          using (SQLiteCommand command = new SQLiteCommand("${sql}",
              connection))
          {
            return command.ExecuteScalar();
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static void CloseAndReopen()
        {
          Initialize();

          connection.Close();
          connection.Open();
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Uninitialize()
        {
          if (connection != null)
          {
            connection.Close();
            connection = null;
          }

          if (functionAttribute != null)
            functionAttribute = null;
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} BindFunction
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} CallFunction
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} CloseAndReopen
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} CallFunction
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} BindFunction
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} CallFunction
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Uninitialize
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\} 0 (?:-)?\d+ 0 \{\} 1\
\{SQL logic error( or missing database)? -- no such function: MyRandom\} 0 \{\}\
0 (?:-)?\d+ 0 \{\}$}}

###############################################################################

runTest {test data-1.74 {bind functions using delegate} -setup {
  proc getMyFuncArgs { argumentCount } {
    set result [list]

    for {set index 0} {$index < $argumentCount} {incr index} {
      lappend result [appendArgs 'myFuncArg [expr {$index + 1}] ']
    }

    return $result
  }

  proc getHashCode { value } {
    if {[isNonNullObjectHandle $value]} then {
      return [object invoke $value GetHashCode]
    } else {
      if {[string length $value] == 0 || $value eq "null"} then {
        return 0
      } else {
        set string [object create String $value]

        return [object invoke $string GetHashCode]
      }
    }
  }

  proc hashManagedArray { array } {
    set data ""

    if {[isNonNullObjectHandle $array]} then {
      if {[object invoke $array GetType.IsArray]} then {
        for {set index 0} {$index < [$array Length]} {incr index} {
          set element [$array -create -alias GetValue $index]

          if {[string length $element] > 0} then {
            append data [$element ToString]
          } else {
            append data null
          }
        }
      }
    }

    return [getHashCode [hash normal sha1 $data]]
  }

  proc myFuncCallback { args } {
    if {[llength $args] == 0} then {
      error "no function arguments"
    }

    set name [lindex $args 0]

    if {[isNonNullObjectHandle $name]} then {
      set name [object invoke $name ToString]
    }

    switch -exact -- $name {
      Invoke {
        return [hashManagedArray [lindex $args end]]
      }
      Step {
        set varName [lindex $args end]

        if {[string length $varName] == 0} then {
          error "invalid aggregate context variable name"
        }

        upvar 1 $varName ctx

        if {![info exists ctx] || [string length $ctx] == 0} then {
          set ctx [pid]
        }

        set hashCtx [getHashCode $ctx]
        set hashArgs [hashManagedArray [lindex $args end-2]]

        if {[info exists ::aggregateData($hashCtx)]} then {
          incr ::aggregateData($hashCtx) $hashArgs
        } else {
          set ::aggregateData($hashCtx) $hashArgs
        }
      }
      Final {
        set ctx [lindex $args end]

        if {[string length $ctx] == 0} then {
          error "invalid aggregate context"
        }

        set hashCtx [getHashCode $ctx]

        if {[info exists ::aggregateData($hashCtx)]} then {
          return $::aggregateData($hashCtx)
        } else {
          error "missing aggregate context data"
        }
      }
      Compare {
        lappend ::compareResults [object invoke -create \
            Int32 Parse [string compare [lindex $args 1] \
            [lindex $args 2]]]

        return [lindex $::compareResults end]
      }
      default {
        error [appendArgs "unknown function callback \"" $name \"]
      }
    }
  }

  proc myFuncInvokeCallback { param0 objs } {
    return [myFuncCallback $param0 $objs]
  }

  proc myFuncStepCallback { param0 objs stepNumber contextDataVarName } {
    upvar 1 $contextDataVarName $contextDataVarName
    return [myFuncCallback $param0 $objs $stepNumber $contextDataVarName]
  }

  proc myFuncFinalCallback { param0 contextData } {
    return [myFuncCallback $param0 $contextData ]
  }

  proc myFuncCompareCallback { param0 param1 param2 } {
    return [myFuncCallback $param0 $param1 $param2]
  }

  setupDb [set fileName data-1.74.db]
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"
  sql execute $db "INSERT INTO t1 (x) VALUES(2);"
  sql execute $db "INSERT INTO t1 (x) VALUES(3);"
  sql execute $db "INSERT INTO t1 (x) VALUES('A');"
  sql execute $db "INSERT INTO t1 (x) VALUES('a');"
  sql execute $db "INSERT INTO t1 (x) VALUES('M');"
  sql execute $db "INSERT INTO t1 (x) VALUES('m');"
  sql execute $db "INSERT INTO t1 (x) VALUES('Z');"
  sql execute $db "INSERT INTO t1 (x) VALUES('z');"

  set connection [getDbConnection]

  for {set argumentCount 0} {$argumentCount < 3} {incr argumentCount} {
    set attribute(1,$argumentCount) [object create \
        System.Data.SQLite.SQLiteFunctionAttribute [appendArgs \
        myFunc1_74_1_ $argumentCount] $argumentCount Scalar]

    $connection -marshalflags \
        {-StrictMatchType +DynamicCallback ForceParameterType} \
        -parametertypes [list System.Data.SQLite.SQLiteFunctionAttribute \
            System.Data.SQLite.SQLiteInvokeDelegate Delegate] \
        BindFunction $attribute(1,$argumentCount) \
        myFuncInvokeCallback null

    set attribute(2,$argumentCount) [object create \
        System.Data.SQLite.SQLiteFunctionAttribute [appendArgs \
        myFunc1_74_2_ $argumentCount] $argumentCount Aggregate]

    $connection -marshalflags \
        {-StrictMatchType +DynamicCallback ForceParameterType} \
        -parametertypes [list System.Data.SQLite.SQLiteFunctionAttribute \
            System.Data.SQLite.SQLiteStepDelegate \
            System.Data.SQLite.SQLiteFinalDelegate] \
        BindFunction $attribute(2,$argumentCount) \
        myFuncStepCallback myFuncFinalCallback
  }

  set attribute(3,0) [object create \
      System.Data.SQLite.SQLiteFunctionAttribute myFunc1_74_3 0 \
      Collation]

  $connection -marshalflags \
      {-StrictMatchType +DynamicCallback ForceParameterType} \
      -parametertypes [list System.Data.SQLite.SQLiteFunctionAttribute \
          System.Data.SQLite.SQLiteCompareDelegate Delegate] \
      BindFunction $attribute(3,0) \
      myFuncCompareCallback null

  for {set argumentCount 0} {$argumentCount < 3} {incr argumentCount} {
    lappend result [catch {
      sql execute $db [appendArgs \
          "SELECT " myFunc1_74_1_ $argumentCount ( \
          [join [getMyFuncArgs $argumentCount] ,] )\;]
    } error] $error

    lappend result [catch {
      sql execute $db [appendArgs \
          "SELECT " myFunc1_74_2_ $argumentCount ( \
          [join [getMyFuncArgs $argumentCount] ,] )\;]
    } error] $error
  }

  lappend result [catch {
    sql execute -execute reader -format list $db \
        "SELECT x FROM t1 ORDER BY x COLLATE myFunc1_74_3;"
  } error] $error

  lappend result [$connection UnbindAllFunctions false]

  for {set argumentCount 0} {$argumentCount < 3} {incr argumentCount} {
    lappend result [catch {
      sql execute $db [appendArgs \
          "SELECT " myFunc1_74_1_ $argumentCount ( \
          [join [getMyFuncArgs $argumentCount] ,] )\;]
    } error] [expr {[string first [appendArgs \
        "no such function: myFunc1_74_1_" $argumentCount] $error] != -1}]

    lappend result [catch {
      sql execute $db [appendArgs \
          "SELECT " myFunc1_74_2_ $argumentCount ( \
          [join [getMyFuncArgs $argumentCount] ,] )\;]
    } error] [expr {[string first [appendArgs \
        "no such function: myFunc1_74_2_" $argumentCount] $error] != -1}]
  }

  lappend result [catch {
    sql execute -execute reader -format list $db \
        "SELECT x FROM t1 ORDER BY x COLLATE myFunc1_74_3;"
  } error] [expr {[string first "no such collation sequence: myFunc1_74_3" \
      $error] != -1}]

  lappend result [array size aggregateData]
  lappend result [testArrayGet aggregateData]

  set result
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  catch {object removecallback myFuncCompareCallback}
  catch {object removecallback myFuncFinalCallback}
  catch {object removecallback myFuncStepCallback}
  catch {object removecallback myFuncInvokeCallback}

  catch {
    foreach compareResult $compareResults {
      catch {object dispose $compareResult}
    }
  }

  unset -nocomplain result error compareResult compareResults \
      aggregateData argumentCount attribute connection db fileName

  rename myFuncCompareCallback ""
  rename myFuncFinalCallback ""
  rename myFuncStepCallback ""
  rename myFuncInvokeCallback ""
  rename myFuncCallback ""
  rename hashManagedArray ""
  rename getHashCode ""
  rename getMyFuncArgs ""
} -constraints {eagle command.object monoBug28 command.sql compile.DATA\
compile.EMIT SQLite System.Data.SQLite} -match regexp -result {^0 -1 0 -1 0 -1\
0 -1 0 -1 0 -1 0 \{1 2 3 A a M m Z z\} True 1 True 1 True 1 True 1 True 1 True\
1 True 1 True 1 \{(?:-)?\d+ (?:-)?\d+\}$}}

###############################################################################

runTest {test data-1.75 {SQLiteCommand.Reset method} -setup {
  setupDb [set fileName data-1.75.db]
} -body {
  set connection [getDbConnection]

  set result [list]

  sql execute $db {
    CREATE TABLE t1(x);
    INSERT INTO t1 (x) VALUES(1);
    INSERT INTO t1 (x) VALUES(2);
    INSERT INTO t1 (x) VALUES(3);
    INSERT INTO t1 (x) VALUES(4);
  }

  set command [$connection -alias CreateCommand]
  set parameter [$command -alias CreateParameter]

  $parameter ParameterName param1
  $parameter DbType Int32
  $parameter Value 4

  $command CommandText "SELECT x FROM t1 WHERE x < ? ORDER BY x;"
  $command Parameters.Add $parameter

  set dataReader(1) [$command -alias ExecuteReader]

  $dataReader(1) Read; lappend result [$dataReader(1) Item x]
  $dataReader(1) Read; lappend result [$dataReader(1) Item x]
  $dataReader(1) Dispose

  $command Reset; set dataReader(2) [$command -alias ExecuteReader]
  $dataReader(2) Read; lappend result [$dataReader(2) Item x]
  $dataReader(2) Read; lappend result [$dataReader(2) Item x]
  $dataReader(2) Dispose

  $command Reset; set dataReader(3) [$command -alias ExecuteReader]
  $dataReader(3) Read; lappend result [$dataReader(3) Item x]
  $dataReader(3) Read; lappend result [$dataReader(3) Item x]
  $dataReader(3) Dispose

  set result
} -cleanup {
  unset -nocomplain dataReader parameter command

  freeDbConnection

  cleanupDb $fileName

  unset -nocomplain result connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {1 2 1 2 1 2}}

###############################################################################

set fileName(1) [file nativename \
    [file join [getDatabaseDirectory] data-1.76.db]]

###############################################################################

runTest {test data-1.76 {SQLiteConnection.FileName property} -setup {
  setupDb [set fileName(2) data-1.76.db]
} -body {
  set connection [getDbConnection]
  $connection FileName
} -cleanup {
  freeDbConnection

  unset -nocomplain connection

  cleanupDb $fileName(2)

  unset -nocomplain db
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result $fileName(1)}

###############################################################################

unset -nocomplain fileName

###############################################################################

runTest {test data-1.77 {json1 extension} -setup {
  setupDb [set fileName data-1.77.db]
} -body {
  sql execute $db {
    CREATE TABLE big(json JSON);
    INSERT INTO big (json) VALUES(2);
    INSERT INTO big (json) VALUES(3.5);
    INSERT INTO big (json) VALUES('true');
    INSERT INTO big (json) VALUES('false');
    INSERT INTO big (json) VALUES('null');
    INSERT INTO big (json) VALUES('"x"');
    INSERT INTO big (json) VALUES('[4, 5.7, true, false, null, "x"]');
    INSERT INTO big (json) VALUES('{"a" : [8, 9.1, true, false, null, "y"]}');
  }

  set connection [getDbConnection]
  set result [list]

  lappend result [sql execute -execute scalar $db \
      {SELECT json('{ "this" : "is", "a": [ "test" ] }');}]

  lappend result [sql execute -execute reader -format list $db \
      "SELECT rowid, json_type(json) FROM big;"]

  lappend result [sql execute -execute reader -format list $db {
    SELECT big.rowid, fullkey, value
      FROM big, json_tree(big.json)
     WHERE json_tree.type NOT IN ('object', 'array');
  }]

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain result connection

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
defineConstant.System.Data.SQLite.INTEROP_JSON1_EXTENSION\
System.Data.SQLite SQLiteInterop} -result {{{"this":"is","a":["test"]}} {1\
integer 2 real 3 true 4 false 5 null 6 text 7 array 8 object} {1 {$} 2 2 {$}\
3.5 3 {$} 1 4 {$} 0 5 {$} 6 {$} x 7 {$[0]} 4 7 {$[1]} 5.7 7 {$[2]} 1 7 {$[3]} 0\
7 {$[4]} 7 {$[5]} x 8 {$.a[0]} 8 8 {$.a[1]} 9.1 8 {$.a[2]} 1 8 {$.a[3]} 0 8\
{$.a[4]} 8 {$.a[5]} y}}}

###############################################################################

runTest {test data-1.78 {basic and extended column metadata} -setup {
  setupDb [set fileName data-1.78.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y TEXT, z MYTYPE);
    INSERT INTO t1 (x, y, z) VALUES(1, 'foo', 1234);
    INSERT INTO t1 (x, y, z) VALUES(1, 5678, 'bar');
  }

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db "SELECT x, y, z FROM t1;"]

  set result [list]

  while {[$dataReader Read]} {
    lappend result \
        [list [$dataReader GetOrdinal x] [$dataReader GetName 0] \
        [$dataReader GetValue 0] [$dataReader GetDatabaseName 0] \
        [$dataReader GetTableName 0] [$dataReader GetOriginalName 0] \
        [$dataReader GetDataTypeName 0] \
        [$dataReader -tostring GetFieldType 0]] \
        [list [$dataReader GetOrdinal y] [$dataReader GetName 1] \
        [$dataReader GetValue 1] [$dataReader GetDatabaseName 1] \
        [$dataReader GetTableName 1] [$dataReader GetOriginalName 1] \
        [$dataReader GetDataTypeName 1] \
        [$dataReader -tostring GetFieldType 1]] \
        [list [$dataReader GetOrdinal z] [$dataReader GetName 2] \
        [$dataReader GetValue 2] [$dataReader GetDatabaseName 2] \
        [$dataReader GetTableName 2] [$dataReader GetOriginalName 2] \
        [$dataReader GetDataTypeName 2] \
        [$dataReader -tostring GetFieldType 2]]
  }

  set result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{0 x 1 main t1 x INTEGER System.Int64} {1 y foo\
main t1 y TEXT System.String} {2 z 1234 main t1 z MYTYPE System.Int64} {0 x 1\
main t1 x INTEGER System.Int64} {1 y 5678 main t1 y TEXT System.String} {2 z\
bar main t1 z MYTYPE System.String}}}

###############################################################################

runTest {test data-1.79 {DateTime using Int64} -setup {
  setupDb [set fileName data-1.79.db] "" UnixEpoch
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y DATETIME);
    INSERT INTO t1 (x, y) VALUES(1, strftime('%s', '2038-01-20'));
  }

  sql execute -execute reader -format list -datetimeformat \
      [getDateTimeFormat] $db "SELECT x, y FROM t1;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{1 {2038-01-20 00:00:00}}}

###############################################################################

runTest {test data-1.80 {page size using PRAGMA} -setup {
  setupDb [set fileName data-1.80.db]
} -body {
  set result [list]

  sql execute $db {
    CREATE TABLE t1(x);
    INSERT INTO t1 (x) VALUES(RANDOMBLOB(1048576));
  }

  lappend result [sql execute -execute scalar $db {
    PRAGMA page_size;
  }]

  lappend result [sql execute $db {
    PRAGMA page_size=8192;
  }]

  lappend result [sql execute $db {
    VACUUM;
  }]

  lappend result [sql execute -execute scalar $db {
    PRAGMA page_size;
  }]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
[list [getDbDefaultPageSize] -1 1 8192]}

###############################################################################

runTest {test data-1.81 {SQLiteCommand.VerifyOnly method} -setup {
  setupDb [set fileName data-1.81.db]
} -body {
  set connection [getDbConnection]

  sql execute $db {
    CREATE TABLE t1(x);
    INSERT INTO t1 (x) VALUES(1);
    INSERT INTO t1 (x) VALUES(2);
    INSERT INTO t1 (x) VALUES(3);
  }

  set command [$connection -alias CreateCommand]

  set code(1) [catch {
    $command CommandText null
    $command VerifyOnly
  } result(1)]

  set code(2) [catch {
    $command CommandText ""
    $command VerifyOnly
  } result(2)]

  set code(3) [catch {
    $command CommandText "SELECT * FROM t1;"
    $command VerifyOnly
  } result(3)]

  set code(4) [catch {
    $command CommandText "SELECT * FROM t2;"
    $command VerifyOnly; # throw
  } result(4)]

  set code(5) [catch {
    $command CommandText "BAD COMMAND;"
    $command VerifyOnly; # throw
  } result(5)]

  set code(6) [catch {
    $command CommandText "INSERT INTO t1 (x) VALUES(4); SELECT * FROM t1;"
    $command VerifyOnly
  } result(6)]

  set code(7) [catch {
    $command CommandText "INSERT INTO t1 (x) VALUES(5); SELECT * FROM t2;"
    $command VerifyOnly; # throw
  } result(7)]

  set code(8) [catch {
    $command CommandText "BAD COMMAND; INSERT INTO t1 (x) VALUES(6);"
    $command VerifyOnly; # throw
  } result(8)]

  set code(9) [catch {
    $command CommandText "SELECT * FROM t2; INSERT INTO t1 (x) VALUES(7);"
    $command VerifyOnly; # throw
  } result(9)]

  set result(10) [sql execute -execute reader -format list $db {
    SELECT * FROM t1 ORDER BY x;
  }]

  list $code(1) [extractSystemDataSQLiteExceptionMessage $result(1)] \
      $code(2) [extractSystemDataSQLiteExceptionMessage $result(2)] \
      $code(3) [extractSystemDataSQLiteExceptionMessage $result(3)] \
      $code(4) [extractSystemDataSQLiteExceptionMessage $result(4)] \
      $code(5) [extractSystemDataSQLiteExceptionMessage $result(5)] \
      $code(6) [extractSystemDataSQLiteExceptionMessage $result(6)] \
      $code(7) [extractSystemDataSQLiteExceptionMessage $result(7)] \
      $code(8) [extractSystemDataSQLiteExceptionMessage $result(8)] \
      $code(9) [extractSystemDataSQLiteExceptionMessage $result(9)] \
      $result(10)
} -cleanup {
  freeDbConnection

  cleanupDb $fileName

  unset -nocomplain result code command connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -match regexp -result {^0 \{\} 0 \{\} 0 \{\} 1 \{SQL logic\
error( or missing database)? -- no such table: t2\} 1 \{SQL logic error( or\
missing database)? -- near "BAD": syntax error\} 0 \{\} 1 \{SQL logic error( or\
missing database)? -- no such table: t2\} 1 \{SQL logic error( or missing\
database)? -- near "BAD": syntax error\} 1 \{SQL logic error( or missing\
database)? -- no such table: t2\} \{1 2 3\}$}}

###############################################################################

runTest {test data-1.82 {IsReadOnly method} -setup {
  set fileName data-1.82.db
} -body {
  set result [list]

  setupDb $fileName
  set connection [getDbConnection]

  lappend result [catch {$connection IsReadOnly null} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {$connection IsReadOnly wrong} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  sql execute $db {
    SELECT * FROM sqlite_master WHERE 1 = 0;
  }; # NOTE: Force file creation.

  freeDbConnection
  cleanupDb $fileName db true false false

  setupDb $fileName "" "" "" "" "Read Only=True;" true false
  set connection [getDbConnection]

  lappend result [catch {$connection IsReadOnly null} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {$connection IsReadOnly wrong} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  freeDbConnection
  cleanupDb $fileName db true false false

  setupDb $fileName "" "" "" "" "Read Only=False;" true false
  set connection [getDbConnection]

  lappend result [catch {$connection IsReadOnly null} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {$connection IsReadOnly wrong} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  freeDbConnection
  cleanupDb $fileName db true false false

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain connection

  cleanupDb $fileName

  unset -nocomplain error result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {0 False 1 {unknown error -- database "wrong" not\
found} 0 True 1 {unknown error -- database "wrong" not found} 0 False 1\
{unknown error -- database "wrong" not found}}}

###############################################################################

runTest {test data-1.83 {bind and use REGEXP function} -setup {
  set fileName data-1.83.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql(1) { \
    SELECT 'test' REGEXP '^t.?.?t$'; \
  }

  set sql(2) { \
    SELECT 'no' REGEXP '^nope$'; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using System.Text.RegularExpressions;

    namespace _Dynamic${id}
    {
      public class Test${id} : SQLiteFunction
      {
        private static SQLiteFunctionAttribute functionAttribute;
        private static SQLiteConnection connection;

        ///////////////////////////////////////////////////////////////////////

        public override object Invoke(
          object\[\] args
          )
        {
          if (args == null)
            return new ArgumentNullException("args");

          if (args.Length != 2)
            return new ArgumentException(String.Format(
              "need exactly two arguments, got {0}", args.Length));

          string pattern = (args\[0\] != null) ? args\[0\].ToString() : null;

          if (pattern == null)
            return new ArgumentNullException("pattern");

          string input = (args\[1\] != null) ? args\[1\].ToString() : null;

          if (input == null)
            return new ArgumentNullException("input");

          return Regex.IsMatch(input, pattern);
        }

        ///////////////////////////////////////////////////////////////////////

        private static void Initialize()
        {
          if (functionAttribute == null)
          {
            functionAttribute = new SQLiteFunctionAttribute(
                "regexp", 2, FunctionType.Scalar);
          }

          if (connection == null)
          {
            connection = new SQLiteConnection(
                "Data Source=${dataSource};[getTestProperties]");

            connection.Open();
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static void BindFunction()
        {
          Initialize();

          connection.BindFunction(functionAttribute, new Test${id}());
        }

        ///////////////////////////////////////////////////////////////////////

        public static object CallFunction1()
        {
          Initialize();

          using (SQLiteCommand command = new SQLiteCommand("${sql(1)}",
              connection))
          {
            return command.ExecuteScalar();
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static object CallFunction2()
        {
          Initialize();

          using (SQLiteCommand command = new SQLiteCommand("${sql(2)}",
              connection))
          {
            return command.ExecuteScalar();
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static bool UnbindFunction()
        {
          Initialize();

          return connection.UnbindFunction(functionAttribute);
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Uninitialize()
        {
          if (connection != null)
          {
            connection.Close();
            connection = null;
          }

          if (functionAttribute != null)
            functionAttribute = null;
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} CallFunction1
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} CallFunction2
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} BindFunction
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} CallFunction1
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} CallFunction2
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} UnbindFunction
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} CallFunction1
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} CallFunction2
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Uninitialize
      } result] : [set result ""]}] \
      [extractSystemDataSQLiteExceptionMessage $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 1 \{SQL logic error( or\
missing database)? -- no such function: REGEXP\} 1 \{SQL logic error( or\
missing database)? -- no such function: REGEXP\} 0 \{\} 0 1 0 0 0 True 1 \{SQL\
logic error( or missing database)? -- no such function: REGEXP\} 1 \{SQL logic\
error( or missing database)? -- no such function: REGEXP\} 0 \{\}$}}

###############################################################################

runTest {test data-1.84 {GetBlob method and SQLiteBlob class} -setup {
  proc getBytesAsList { bytes } {
    #
    # HACK: *MONO* Mono does not choose the right ByteList constructor
    #       overload here.  Therefore, attempt to force the issue.
    #
    set byteList [object create -parametertypes [list \
        System.Collections.Generic.IEnumerable`1\[System.Byte\]] \
        -alias ByteList $bytes]

    return [$byteList ToString]
  }

  setupDb [set fileName data-1.84.db] "" "" "" NoVerifyTypeAffinity
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER PRIMARY KEY, y);
    INSERT INTO t1 (x, y) VALUES(1, 'nope');
    INSERT INTO t1 (x, y) VALUES(2, '1984');
  }

  set dataReader [sql execute -execute reader -format datareader \
      -behavior +KeyInfo -alias $db "SELECT x, y FROM t1;"]

  set size 4
  set bytes(1) [object create -alias Byte\[\] $size]
  set bytes(2) [object create -alias Byte\[\] $size]
  set result [list]

  while {[$dataReader Read]} {
    set blob [$dataReader -alias GetBlob 1 false]
    lappend result [$blob GetCount]
    $blob Read $bytes(1) $size 0
    lappend result [getBytesAsList $bytes(1)]

    for {set i 0} {$i < $size} {incr i} {
      set byte [$bytes(1) GetValue $i]
      incr byte; set byte [object invoke -create Byte Parse $byte]
      $bytes(1) SetValue $byte $i
    }

    $blob Write $bytes(1) $size 0

    if {[$dataReader GetInt64 0] == 1} then {
      $blob Reopen 2
      $blob Read $bytes(2) $size 0
      lappend result [getBytesAsList $bytes(2)]
    }

    $blob Close
  }

  $dataReader Close; unset dataReader

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db "SELECT x, y FROM t1;"]

  while {[$dataReader Read]} {
    lappend result [$dataReader GetInt64 0]
    lappend result [$dataReader GetString 0]
    lappend result [$dataReader GetInt64 1]
    lappend result [$dataReader GetString 1]
  }

  $dataReader Close; unset dataReader

  set result
} -cleanup {
  unset -nocomplain blob
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain byte i bytes size result db fileName

  rename getBytesAsList ""
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {4 {110 111 112 101} {49 57 56 52} 4 {49 57 56 52}\
1 1 0 opqf 2 2 2 2:95}}

###############################################################################

runTest {test data-1.85.1 {sha1 extension} -setup {
  setupDb [set fileName data-1.85.1.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
    INSERT INTO t1 (x) VALUES(NULL);
    INSERT INTO t1 (x) VALUES(1);
    INSERT INTO t1 (x) VALUES('zero');
    INSERT INTO t1 (x) VALUES(1.23);
    INSERT INTO t1 (x) VALUES(x'45');
  }

  set connection [getDbConnection]
  set result [list]

  $connection EnableExtensions true

  $connection LoadExtension \
      [getCoreExtensionBinaryFileName null] sqlite3_sha_init

  lappend result [sql execute -execute scalar $db \
      {SELECT sha1('groundhog');}]

  lappend result [sql execute -execute scalar $db \
      {SELECT sha1_query('SELECT x FROM t1 ORDER BY x;');}]

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain result connection

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
defineConstant.System.Data.SQLite.INTEROP_SHA1_EXTENSION\
System.Data.SQLite SQLiteInterop} -result \
{5578139b470e35a3c231a499d06589215e46e8df\
a27f5e6f85a3872ed2e4e4018c8fd7dfaff052bc}}

###############################################################################

runTest {test data-1.85.2 {sha3 extension} -setup {
  setupDb [set fileName data-1.85.2.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
    INSERT INTO t1 (x) VALUES(NULL);
    INSERT INTO t1 (x) VALUES(1);
    INSERT INTO t1 (x) VALUES('zero');
    INSERT INTO t1 (x) VALUES(1.23);
    INSERT INTO t1 (x) VALUES(x'45');
  }

  set connection [getDbConnection]
  set result [list]

  $connection EnableExtensions true

  $connection LoadExtension \
      [getCoreExtensionBinaryFileName null] sqlite3_shathree_init

  lappend result [sql execute -execute scalar $db \
      {SELECT hex(sha3('groundhog'));}]

  lappend result [sql execute -execute scalar $db \
      {SELECT hex(sha3_query('SELECT x FROM t1 ORDER BY x;'));}]

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain result connection

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
defineConstant.System.Data.SQLite.INTEROP_SHA3_EXTENSION\
System.Data.SQLite SQLiteInterop} -result \
{2EB66C04C691A426EDED9DDD02BC6E2468B574D86EB0869BA134B7F0EA8FD465\
658FEDE13AEF1ED773A7C98DC588216E0D1E96F1D4436E172479517A43B87973}}

###############################################################################

runTest {test data-1.86 {connection string integer parsing} -setup {
  object import System.Globalization
  object import System.Threading

  set culture [object create -alias CultureInfo en-US]
  $culture NumberFormat.NegativeSign /

  set savedCulture [object invoke Thread.CurrentThread CurrentCulture]
  object invoke Thread.CurrentThread CurrentCulture $culture
} -body {
  setupDb [set fileName data-1.86.db]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName

  catch {object invoke Thread.CurrentThread CurrentCulture $savedCulture}
  unset -nocomplain savedCulture culture

  object unimport -importpattern System.Threading
  object unimport -importpattern System.Globalization
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
defineConstant.System.Data.SQLite.INTEROP_SHA1_EXTENSION System.Data.SQLite\
SQLiteInterop} -match regexp -result \
{^System#Data#SQLite#SQLiteConnection#\d+$}}

###############################################################################

reportSQLiteResources $test_channel true

###############################################################################

runTest {test data-1.87 {GetSettingValue cached directory/file name} -setup {
  moveSystemDataSQLiteDllConfig false
} -body {
  object invoke -flags +NonPublic System.Data.SQLite.UnsafeNativeMethods \
      GetSettingValue setting_for_data-1.87 null

  expr {[getOtherCount Method_ResetCachedAssemblyDirectory] == -1 && \
      [getOtherCount Method_ResetCachedXmlConfigFileName] == -1 && \
      [getOtherCount Method_GetAssemblyDirectory] == 1 && \
      [getOtherCount Method_GetXmlConfigFileName] == 1 && \
      [getOtherCount Method_GetCachedAssemblyDirectory] >= 1 && \
      [getOtherCount Method_GetCachedXmlConfigFileName] >= 1}
} -cleanup {
  moveSystemDataSQLiteDllConfig true
} -constraints {eagle command.object monoBug28 System.Data.SQLite\
buildConfiguration.Debug} -result {True}}

###############################################################################

reportSQLiteResources $test_channel true

###############################################################################

runTest {test data-1.88 {GetSettingValue cached directory/file name} -setup {
  moveSystemDataSQLiteDllConfig false
} -body {
  object invoke -flags +NonPublic System.Data.SQLite.UnsafeNativeMethods \
      GetSettingValue setting_for_data-1.88 null

  object invoke -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods ResetCachedAssemblyDirectory

  object invoke -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods ResetCachedXmlConfigFileName

  object invoke -flags +NonPublic System.Data.SQLite.UnsafeNativeMethods \
      GetSettingValue setting_for_data-1.88 null

  expr {[getOtherCount Method_ResetCachedAssemblyDirectory] == 1 && \
      [getOtherCount Method_ResetCachedXmlConfigFileName] == 1 && \
      [getOtherCount Method_GetAssemblyDirectory] == 2 && \
      [getOtherCount Method_GetXmlConfigFileName] == 2 && \
      [getOtherCount Method_GetCachedAssemblyDirectory] >= 2 && \
      [getOtherCount Method_GetCachedXmlConfigFileName] >= 2}
} -cleanup {
  moveSystemDataSQLiteDllConfig true
} -constraints {eagle command.object monoBug28 System.Data.SQLite\
buildConfiguration.Debug} -result {True}}

###############################################################################

runTest {test data-1.89 {using SQLiteBlob without rowid PK index} -setup {
  setupDb [set fileName data-1.89.db]
} -body {
  sql execute $db {
    CREATE TABLE t1 (x GUID UNIQUE NOT NULL, y BLOB NOT NULL);
    INSERT INTO t1 (x, y) VALUES(
      '12345678-0000-0000-0000-000000000000',
      X'010203040506070809'
    );
    INSERT INTO t1 (x, y) VALUES(
      '12345679-0000-0000-0000-000000000000',
      X'0102030405060708090A0B0C0D0E0F101113'
    );
  }

  set sql(1) { \
    SELECT y FROM t1 \
    WHERE x = '12345678-0000-0000-0000-000000000000'; \
  }

  set sql(2) { \
    SELECT y FROM t1 \
    WHERE x = '12345679-0000-0000-0000-000000000000'; \
  }

  set dataReader [sql execute -execute reader -format datareader \
      -behavior +KeyInfo -alias $db $sql(1)]

  while {[$dataReader Read]} {
    set blob [object invoke -alias \
        System.Data.SQLite.SQLiteBlob Create $dataReader 0 true]

    lappend result [$blob GetCount]

    $blob Close
  }

  $dataReader Close; unset dataReader

  set dataReader [sql execute -execute reader -format datareader \
      -behavior +KeyInfo -alias $db $sql(2)]

  while {[$dataReader Read]} {
    set blob [object invoke -alias \
        System.Data.SQLite.SQLiteBlob Create $dataReader 0 true]

    lappend result [$blob GetCount]

    $blob Close
  }

  $dataReader Close; unset dataReader

  set result
} -cleanup {
  unset -nocomplain blob
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain result sql db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite SQLiteInterop} -result {9 18}}

###############################################################################

runTest {test data-1.90 {stmt extension / 'sqlite_stmt' virtual table} -setup {
  setupDb [set fileName data-1.90.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
    INSERT INTO t1 (x) VALUES(1);
  }

  set result [list]

  set reader(1) [sql execute -execute reader -format datareader -alias \
      $db "SELECT * FROM t1;"]

  lappend result [sql execute -execute reader -format list -alias \
      $db "SELECT * FROM sqlite_stmt;"]

  $reader(1) Close; unset -nocomplain $reader(1)

  lappend result [sql execute -execute reader -format list -alias \
      $db "SELECT * FROM sqlite_stmt;"]

  set result
} -cleanup {
  unset -nocomplain reader

  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite SQLiteInterop} -match regexp -result {^\{\{SELECT \* FROM\
sqlite_stmt;\} 11 1 1 0 0 0 0 0 1 \d+ \{SELECT \* FROM t1;\} 1 1 1 0 0 0\
(?:7|9) 0 1 \d+\} \{\{SELECT \* FROM sqlite_stmt;\} 11 1 1 0 0 0 0 0 1 \d+\}$}}

###############################################################################

runTest {test data-1.91 {Password error (no encryption support)} -body {
  list [catch {
    setupDb [set fileName data-1.91.db] "" "" "" "" "Password=1234;"
  } msg] [extractSystemDataSQLiteExceptionMessage $msg]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain msg db fileName
} -constraints [fixConstraints {eagle !System.Data.SQLite.Encryption monoBug28\
command.sql compile.DATA SQLite System.Data.SQLite}] -result {1 {SQL logic\
error -- Cannot use "Password" connection string property: library was not\
built with encryption support, please see "https://www.sqlite.org/see" for more\
information}}}

###############################################################################

runTest {test data-1.92 {HexPassword error (no encryption support)} -body {
  list [catch {
    setupDb [set fileName data-1.92.db] "" "" "" "" "HexPassword=1234;"
  } msg] [extractSystemDataSQLiteExceptionMessage $msg]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain msg db fileName
} -constraints [fixConstraints {eagle !System.Data.SQLite.Encryption monoBug28\
command.sql compile.DATA SQLite System.Data.SQLite}] -result {1 {SQL logic\
error -- Cannot use "HexPassword" connection string property: library was not\
built with encryption support, please see "https://www.sqlite.org/see" for more\
information}}}

###############################################################################

runTest {test data-1.93 {extended error code messages} -setup {
  #
  # HACK: Temporarily disable automatic detection (and use) of the
  #       native sqlite3_errstr() API.
  #
  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLite3 have_errstr false

  setupDb [set fileName data-1.93.db]
} -body {
  set errCodes [list]

  lappend errCodes 256; # SQLITE_OK_LOAD_PERMANENTLY
  lappend errCodes 513; # SQLITE_ERROR_RETRY
  lappend errCodes 522; # SQLITE_IOERR_SHORT_READ
  lappend errCodes 270; # SQLITE_CANTOPEN_NOTEMPDIR
  lappend errCodes 539; # SQLITE_NOTICE_RECOVER_ROLLBACK
  lappend errCodes 284; # SQLITE_WARNING_AUTOINDEX
  lappend errCodes 999; # unknown error

  set connection [getDbConnection]

  lappend result [catchAndReturn {$connection EnableExtensions true}]

  lappend result [catchAndReturn {$connection LoadExtension \
      [getCoreExtensionBinaryFileName null] interop_test_extension_init}]

  lappend result [catchAndReturn {$connection SetExtendedResultCodes false}]

  foreach errCode $errCodes {
    #
    # HACK: Without extended error codes, SQLITE_OK_* cannot be handled via
    #       the semantics in the System.Data.SQLite.SQLite3.Prepare method;
    #       it will always assume that more results are available when the
    #       error code is Ok, thereby looping forever.
    #
    if {($errCode & 0xFF) == 0} then {continue}

    resetException; catchAndSetException {
      sql execute -execute scalar $db \
          "SELECT interopError(?);" [list param1 Int32 $errCode]
    } exception

    lappend result [$exception ResultCode] \
        [normalizeExceptionMessage [$exception Message]]
  }

  lappend result [catchAndReturn {$connection SetExtendedResultCodes true}]

  foreach errCode $errCodes {
    resetException; catchAndSetException {
      sql execute -execute scalar $db \
          "SELECT interopError(?);" [list param1 Int32 $errCode]
    } exception

    lappend result [$exception ResultCode] \
        [normalizeExceptionMessage [$exception Message]]
  }

  set result
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  catch {
    #
    # HACK: Restore automatic detection (and use) of the native
    #       sqlite3_errstr() API.
    #
    object invoke -flags +NonPublic \
        System.Data.SQLite.SQLite3 have_errstr null
  }

  unset -nocomplain result exception errCode errCodes
  unset -nocomplain connection db fileName
} -constraints {eagle command.object monoBug28\
compile.DATA defineConstant.System.Data.SQLite.INTEROP_TEST_EXTENSION\
command.sql SQLite System.Data.SQLite} -constraintExpression \
{[info exists core_library_version] && \
[package vcompare $core_library_version 3.23] >= 0} -result {{0 {}} {0 {}} {0\
{}} Error {SQL logic error ==> SQL logic error} IoErr {disk I/O error ==> disk\
I/O error} CantOpen {unable to open database file ==> unable to open database\
file} Notice {notification message ==> notification message} Warning {warning\
message ==> warning message} 231 {SQL logic error ==> unknown error} {0 {}}\
Ok_Load_Permanently {not an error ==> not an error} Error_Retry {SQL logic\
error ==> SQL logic error} IoErr_Short_Read {disk I/O error ==> disk I/O error}\
CantOpen_NoTempDir {unable to open database file ==> unable to open database\
file} Notice_Recover_Rollback {notification message ==> notification message}\
Warning_AutoIndex {warning message ==> warning message} 999 {SQL logic error\
==> unknown error}}}

###############################################################################

runTest {test data-1.94 {extended error code messages} -setup {
  setupDb [set fileName data-1.94.db]
} -body {
  set errCodes [list]

  lappend errCodes 256; # SQLITE_OK_LOAD_PERMANENTLY
  lappend errCodes 513; # SQLITE_ERROR_RETRY
  lappend errCodes 522; # SQLITE_IOERR_SHORT_READ
  lappend errCodes 270; # SQLITE_CANTOPEN_NOTEMPDIR
  lappend errCodes 539; # SQLITE_NOTICE_RECOVER_ROLLBACK
  lappend errCodes 284; # SQLITE_WARNING_AUTOINDEX
  lappend errCodes 999; # unknown error

  set connection [getDbConnection]

  lappend result [catchAndReturn {$connection EnableExtensions true}]

  lappend result [catchAndReturn {$connection LoadExtension \
      [getCoreExtensionBinaryFileName null] interop_test_extension_init}]

  lappend result [catchAndReturn {$connection SetExtendedResultCodes false}]

  foreach errCode $errCodes {
    #
    # HACK: Without extended error codes, SQLITE_OK_* cannot be handled via
    #       the semantics in the System.Data.SQLite.SQLite3.Prepare method;
    #       it will always assume that more results are available when the
    #       error code is Ok, thereby looping forever.
    #
    if {($errCode & 0xFF) == 0} then {continue}

    resetException; catchAndSetException {
      sql execute -execute scalar $db \
          "SELECT interopError(?);" [list param1 Int32 $errCode]
    } exception

    lappend result [$exception ResultCode] \
        [normalizeExceptionMessage [$exception Message]]
  }

  lappend result [catchAndReturn {$connection SetExtendedResultCodes true}]

  foreach errCode $errCodes {
    resetException; catchAndSetException {
      sql execute -execute scalar $db \
          "SELECT interopError(?);" [list param1 Int32 $errCode]
    } exception

    lappend result [$exception ResultCode] \
        [normalizeExceptionMessage [$exception Message]]
  }

  set result
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain result exception errCode errCodes
  unset -nocomplain connection db fileName
} -constraints {eagle command.object monoBug28\
compile.DATA defineConstant.System.Data.SQLite.INTEROP_TEST_EXTENSION\
command.sql SQLite System.Data.SQLite} -constraintExpression \
{[info exists core_library_version] && \
[package vcompare $core_library_version 3.23] >= 0} -result {{0 {}} {0 {}} {0\
{}} Error {SQL logic error ==> SQL logic error} IoErr {disk I/O error ==> disk\
I/O error} CantOpen {unable to open database file ==> unable to open database\
file} Notice {notification message ==> notification message} Warning {warning\
message ==> warning message} 231 {unknown error ==> unknown error} {0 {}}\
Ok_Load_Permanently {not an error ==> not an error} Error_Retry {SQL logic\
error ==> SQL logic error} IoErr_Short_Read {disk I/O error ==> disk I/O error}\
CantOpen_NoTempDir {unable to open database file ==> unable to open database\
file} Notice_Recover_Rollback {notification message ==> notification message}\
Warning_AutoIndex {warning message ==> warning message} 999 {unknown error ==>\
unknown error}}}

###############################################################################

runTest {test data-1.95 {SetConfigurationOption method} -setup {
  setupDb [set fileName data-1.95.db] "" "" "" \
      "NoExtensionFunctions NoBindFunctions"
} -body {
  set dbConfigs [list]

  lappend dbConfigs SQLITE_DBCONFIG_NONE; # nil
  lappend dbConfigs SQLITE_DBCONFIG_MAINDBNAME; # char*
  lappend dbConfigs SQLITE_DBCONFIG_LOOKASIDE; # void* int int

  lappend dbConfigs SQLITE_DBCONFIG_ENABLE_FKEY; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_ENABLE_TRIGGER; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_ENABLE_QPSG; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_TRIGGER_EQP; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_RESET_DATABASE; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_DEFENSIVE; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_WRITABLE_SCHEMA; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_LEGACY_ALTER_TABLE; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_DQS_DML; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_DQS_DDL; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_ENABLE_VIEW; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_LEGACY_FILE_FORMAT; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_TRUSTED_SCHEMA; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_STMT_SCANSTATUS; # int int*
  lappend dbConfigs SQLITE_DBCONFIG_REVERSE_SCANORDER; # int int*

  set connection [getDbConnection]

  foreach dbConfig $dbConfigs {
    switch -exact -- $dbConfig {
      SQLITE_DBCONFIG_NONE {
        set value null
      }
      SQLITE_DBCONFIG_MAINDBNAME {
        set value [object create String test]
      }
      SQLITE_DBCONFIG_LOOKASIDE {
        if {[info exists ptr]} then {
          error "pointer value should not exist yet"
        }

        set size 100; set count 100

        set ptr [object invoke -create \
            System.Runtime.InteropServices.Marshal \
            AllocCoTaskMem [expr {$size * $count}]]

        set ints(0) [object invoke -create Int32 Parse $size]
        set ints(1) [object invoke -create Int32 Parse $count]

        set value [object create -alias Object\[\] 3]

        $value SetValue $ptr 0
        $value SetValue $ints(0) 1
        $value SetValue $ints(1) 2
      }
      default {
        set value [object invoke -create System.Boolean Parse true]
      }
    }

    lappend result [$connection SetConfigurationOption $dbConfig $value]
  }

  set current(0) 0; set highwater(0) 0

  lappend result [$connection -flags +NonPublic \
      _sql.GetStatusParameter SQLITE_DBSTATUS_LOOKASIDE_USED \
      false current(0) highwater(0)]

  lappend result $current(0) $highwater(0)

  sql execute $db {CREATE TABLE test.t1(x);}; # use some lookaside memory?

  set current(1) 0; set highwater(1) 0

  lappend result [$connection -flags +NonPublic \
      _sql.GetStatusParameter SQLITE_DBSTATUS_LOOKASIDE_USED \
      false current(1) highwater(1)]

  lappend result $current(1) $highwater(1)

  lappend result [expr {$highwater(1) > 0}]
  lappend result [expr {$highwater(1) >= $current(1)}]
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  if {[info exists ptr]} then {
    object invoke System.Runtime.InteropServices.Marshal \
        FreeCoTaskMem $ptr
  }

  unset -nocomplain current highwater ints count size ptr value
  unset -nocomplain result dbConfig dbConfigs
  unset -nocomplain connection db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -match regexp -result {^\{\} \{\} \{\} \{\} \{\} \{\} \{\}\
\{\} \{\} \{\} \{\} \{\} \{\} \{\} \{\} \{\} \{\} \{\} \{\} \{\} \{\} Ok 0 0 Ok\
\d+ \d+ True True$}}

###############################################################################

runTest {test data-1.96 {connection pool interaction with read-only} -setup {
  catch {
    object invoke -flags +NonPublic \
        System.Data.SQLite.SQLiteConnectionPool ResetCounts
  }

  proc getPoolCounts {} {
    set opened 0
    set closed 0

    if {[catch {
      object invoke -flags +NonPublic \
          System.Data.SQLite.SQLiteConnectionPool GetCounts \
          opened closed
    }] == 0} then {
      return [list $opened $closed]
    } else {
      tputs $::test_channel \
          "==== WARNING: connection pool counts are not available\n"

      return [list 0 0]
    }
  }

  setupDb [set fileName data-1.96.db]
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Read Only=True;Pooling=True;" true false

  set code(1) [catch {
    sql execute $db "INSERT INTO t1 (x) VALUES(2);"
  } error(1)]

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Read Only=True;Pooling=True;" true false

  set code(2) [catch {
    sql execute $db "INSERT INTO t1 (x) VALUES(3);"
  } error(2)]

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "" true false

  list [getPoolCounts] \
      $code(1) [extractSystemDataSQLiteExceptionMessage $error(1)] \
      $code(2) [extractSystemDataSQLiteExceptionMessage $error(2)] \
      [sql execute -execute scalar $db "SELECT SUM(x) FROM t1;"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain error code db fileName

  rename getPoolCounts ""
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{{0 0} 1 {attempt to write a readonly database} 1 {attempt to write a readonly\
database} 1}}

###############################################################################

runTest {test data-1.97 {connection pool interaction with read-only} -setup {
  setupDb [set fileName data-1.97.db]
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Read Only=True;Pooling=True;" true false

  set code(1) [catch {
    sql execute $db "INSERT INTO t1 (x) VALUES(2);"
  } error(1)]

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Pooling=True;" true false

  set code(2) [catch {
    sql execute $db "INSERT INTO t1 (x) VALUES(3);"
  } error(2)]

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "" true false

  list $code(1) [extractSystemDataSQLiteExceptionMessage $error(1)] \
      $code(2) [extractSystemDataSQLiteExceptionMessage $error(2)] \
      [sql execute -execute scalar $db "SELECT SUM(x) FROM t1;"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain error code db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{1 {attempt to write a readonly database} 0 1 4}}

###############################################################################

runTest {test data-1.98 {SQLiteLog initialize (enabled)} -setup {
  #
  # NOTE: Make sure that SQLite core library is completely shutdown prior to
  #       starting this test.
  #
  shutdownSQLite $test_channel

  proc threadStart {} {
    for {set i 0} {$i < 1000} {incr i} {
      set c($i) [object create System.Data.SQLite.SQLiteConnection]
      incr ::count(0)
    }
  }

  saveEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv

  unset -nocomplain env(No_SQLiteLog)
  unset -nocomplain env(Initialize_SQLiteLog)
} -body {
  set count(1) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount]

  set count(2) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _attemptedInitialize]

  set count(3) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeDoneCount]

  tputs $test_channel [appendArgs "---- starting with call count " \
      $count(1) ", attempt count " $count(2) ", and done count " \
      $count(3) \n]

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount 0

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _attemptedInitialize 0

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeDoneCount 0

  for {set i 0} {$i < 20} {incr i} {
    set thread($i) [createThread threadStart false 1048576]
    $thread($i) Name [appendArgs "test data-1.98 #" $i]
  }

  set count(0) 0

  foreach i [array names thread] {
    startThread $thread($i)
  }

  foreach i [array names thread] {
    $thread($i) Join
  }

  list $count(0) [expr {[object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount] > 0}] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteLog \
      _attemptedInitialize] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteLog \
      _initializeDoneCount]
} -cleanup {
  restoreEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv

  if {[info exists thread]} then {
    foreach i [array names thread] {
      if {[info exists thread($i)] && [cleanupThread $thread($i)]} then {
        unset -nocomplain thread($i)
      }
    }
  }

  catch {object removecallback threadStart}

  unset -nocomplain thread i count

  rename threadStart ""
} -constraints \
{eagle command.object SQLite System.Data.SQLite compile.THREADING} -result \
{20000 True 1 1}}

###############################################################################

runTest {test data-1.99 {SQLiteLog initialize (disabled)} -setup {
  #
  # NOTE: Make sure that SQLite core library is completely shutdown prior to
  #       starting this test.
  #
  shutdownSQLite $test_channel

  proc threadStart {} {
    for {set i 0} {$i < 1000} {incr i} {
      set c($i) [object create System.Data.SQLite.SQLiteConnection]
      incr ::count(0)
    }
  }

  saveEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv

  set env(No_SQLiteLog) 1
  unset -nocomplain env(Initialize_SQLiteLog)
} -body {
  set count(1) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount]

  set count(2) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _attemptedInitialize]

  set count(3) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeDoneCount]

  tputs $test_channel [appendArgs "---- starting with call count " \
      $count(1) ", attempt count " $count(2) ", and done count " \
      $count(3) \n]

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount 0

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _attemptedInitialize 0

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeDoneCount 0

  for {set i 0} {$i < 20} {incr i} {
    set thread($i) [createThread threadStart false 1048576]
    $thread($i) Name [appendArgs "test data-1.99 #" $i]
  }

  set count(0) 0

  foreach i [array names thread] {
    startThread $thread($i)
  }

  foreach i [array names thread] {
    $thread($i) Join
  }

  list $count(0) [expr {[object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount] > 0}] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteLog \
      _attemptedInitialize] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteLog \
      _initializeDoneCount]
} -cleanup {
  restoreEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv

  if {[info exists thread]} then {
    foreach i [array names thread] {
      if {[info exists thread($i)] && [cleanupThread $thread($i)]} then {
        unset -nocomplain thread($i)
      }
    }
  }

  catch {object removecallback threadStart}

  unset -nocomplain thread i count

  rename threadStart ""
} -constraints \
{eagle command.object SQLite System.Data.SQLite compile.THREADING} -result \
{20000 False 0 0}}

###############################################################################

runTest {test data-1.100 {SQLiteLog forced initialize (enabled)} -setup {
  #
  # NOTE: Make sure that SQLite core library is completely shutdown prior to
  #       starting this test.
  #
  shutdownSQLite $test_channel

  proc threadStart {} {
    for {set i 0} {$i < 1000} {incr i} {
      set c($i) [object create System.Data.SQLite.SQLiteConnection]
      incr ::count(0)
    }
  }

  saveEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv

  unset -nocomplain env(No_SQLiteLog)
  set env(Initialize_SQLiteLog) 1
} -body {
  set count(1) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount]

  set count(2) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _attemptedInitialize]

  set count(3) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeDoneCount]

  tputs $test_channel [appendArgs "---- starting with call count " \
      $count(1) ", attempt count " $count(2) ", and done count " \
      $count(3) \n]

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount 0

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _attemptedInitialize 0

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeDoneCount 0

  for {set i 0} {$i < 20} {incr i} {
    set thread($i) [createThread threadStart false 1048576]
    $thread($i) Name [appendArgs "test data-1.100 #" $i]
  }

  set count(0) 0

  foreach i [array names thread] {
    startThread $thread($i)
  }

  foreach i [array names thread] {
    $thread($i) Join
  }

  list $count(0) [expr {[object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount] > 0}] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteLog \
      _attemptedInitialize] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteLog \
      _initializeDoneCount]
} -cleanup {
  restoreEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv

  if {[info exists thread]} then {
    foreach i [array names thread] {
      if {[info exists thread($i)] && [cleanupThread $thread($i)]} then {
        unset -nocomplain thread($i)
      }
    }
  }

  catch {object removecallback threadStart}

  unset -nocomplain thread i count

  rename threadStart ""
} -constraints \
{eagle command.object SQLite System.Data.SQLite compile.THREADING} -result \
{20000 True 0 1}}

###############################################################################

runTest {test data-1.101 {SQLiteLog forced initialize (disabled)} -setup {
  #
  # NOTE: Make sure that SQLite core library is completely shutdown prior to
  #       starting this test.
  #
  shutdownSQLite $test_channel

  proc threadStart {} {
    for {set i 0} {$i < 1000} {incr i} {
      set c($i) [object create System.Data.SQLite.SQLiteConnection]
      incr ::count(0)
    }
  }

  saveEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv

  set env(No_SQLiteLog) 1
  set env(Initialize_SQLiteLog) 1
} -body {
  set count(1) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount]

  set count(2) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _attemptedInitialize]

  set count(3) [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeDoneCount]

  tputs $test_channel [appendArgs "---- starting with call count " \
      $count(1) ", attempt count " $count(2) ", and done count " \
      $count(3) \n]

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount 0

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _attemptedInitialize 0

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeDoneCount 0

  for {set i 0} {$i < 20} {incr i} {
    set thread($i) [createThread threadStart false 1048576]
    $thread($i) Name [appendArgs "test data-1.101 #" $i]
  }

  set count(0) 0

  foreach i [array names thread] {
    startThread $thread($i)
  }

  foreach i [array names thread] {
    $thread($i) Join
  }

  list $count(0) [expr {[object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteLog _initializeCallCount] > 0}] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteLog \
      _attemptedInitialize] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteLog \
      _initializeDoneCount]
} -cleanup {
  restoreEnvironmentVariables [list No_SQLiteLog Initialize_SQLiteLog] savedEnv

  if {[info exists thread]} then {
    foreach i [array names thread] {
      if {[info exists thread($i)] && [cleanupThread $thread($i)]} then {
        unset -nocomplain thread($i)
      }
    }
  }

  catch {object removecallback threadStart}

  unset -nocomplain thread i count

  rename threadStart ""
} -constraints \
{eagle command.object SQLite System.Data.SQLite compile.THREADING} -result \
{20000 False 0 0}}

###############################################################################

runTest {test data-1.102 {Target Framework Abbreviations} -body {
  set targetFrameworkNames [list \
      null "" bad 1.0 2.0 3.0 X.X \
      .NETFramework,Version=v2.0 \
      .NETFramework,Version=v3.5 \
      .NETFramework,Version=v4.0 \
      .NETFramework,Version=v4.5 \
      .NETFramework,Version=v4.5.1 \
      .NETFramework,Version=v4.5.2 \
      .NETFramework,Version=v4.6 \
      .NETFramework,Version=v4.6.1 \
      .NETFramework,Version=v4.6.2 \
      .NETFramework,Version=v4.7 \
      .NETFramework,Version=v4.7.1 \
      .NETFramework,Version=v4.7.2 \
      .NETFramework,Version=v4.8 \
      .NETFramework,Version=vX.X \
      .NETStandard,Version=v2.0 \
      .NETStandard,Version=v2.1 \
      .NETStandard,Version=vX.X]

  set targetFrameworkAbbreviations [list]

  foreach targetFrameworkName $targetFrameworkNames {
    set targetFrameworkAbbreviation [object invoke -flags +NonPublic \
        System.Data.SQLite.UnsafeNativeMethods AbbreviateTargetFramework \
        $targetFrameworkName]

    lappend targetFrameworkAbbreviations $targetFrameworkAbbreviation
  }

  appendArgs ( [join $targetFrameworkAbbreviations )\n(] )
} -cleanup {
  unset -nocomplain targetFrameworkName targetFrameworkAbbreviation
  unset -nocomplain targetFrameworkNames targetFrameworkAbbreviations
} -constraints {eagle command.object System.Data.SQLite} -result {()
()
(bad)
(1.0)
(2.0)
(3.0)
(X.X)
(net20)
(net35)
(net40)
(net45)
(net451)
(net452)
(net46)
(net461)
(net462)
(net47)
(net471)
(net472)
(net48)
(netXX)
(netstandard2.0)
(netstandard2.1)
(.NETStandard,Version=vX.X)}}

###############################################################################

runTest {test data-1.103 {SetLimitOption method} -setup {
  setupDb [set fileName data-1.103.db]
} -body {
  set limits [list]

  lappend limits SQLITE_LIMIT_NONE
  lappend limits SQLITE_LIMIT_LENGTH
  lappend limits SQLITE_LIMIT_SQL_LENGTH
  lappend limits SQLITE_LIMIT_COLUMN
  lappend limits SQLITE_LIMIT_EXPR_DEPTH
  lappend limits SQLITE_LIMIT_COMPOUND_SELECT
  lappend limits SQLITE_LIMIT_VDBE_OP
  lappend limits SQLITE_LIMIT_FUNCTION_ARG
  lappend limits SQLITE_LIMIT_ATTACHED
  lappend limits SQLITE_LIMIT_LIKE_PATTERN_LENGTH
  lappend limits SQLITE_LIMIT_VARIABLE_NUMBER
  lappend limits SQLITE_LIMIT_TRIGGER_DEPTH
  lappend limits SQLITE_LIMIT_WORKER_THREADS

  set connection [getDbConnection]

  foreach limit $limits {
    lappend result [$connection SetLimitOption $limit 1]
    lappend result [$connection SetLimitOption $limit 2]
  }

  set result
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain value result limit limits
  unset -nocomplain connection db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {-1 -1 1000000000 1 1000000000 1 2000 1 1000 1 500\
1 250000000 1 127 1 30 1 50000 1 32766 1 1000 1 0 1}}

###############################################################################

runTest {test data-1.104 {TextPassword error (no encryption support)} -body {
  list [catch {
    setupDb [set fileName data-1.104.db] "" "" "" "" "TextPassword=1234;"
  } msg] [extractSystemDataSQLiteExceptionMessage $msg]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain msg db fileName
} -constraints [fixConstraints {eagle !System.Data.SQLite.Encryption monoBug28\
command.sql compile.DATA SQLite System.Data.SQLite}] -result {1 {SQL logic\
error -- Cannot use "TextPassword" connection string property: library was not\
built with encryption support, please see "https://www.sqlite.org/see" for more\
information}}}

###############################################################################

runTest {test data-1.105 {encrypted database, w/TextPassword} -setup {
  setupDb [set fileName data-1.105.db] "" "" "" "" "TextPassword=1234;"
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Password=1234;" true false

  set result [list]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "TextPassword=1234;" true false

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain error result db fileName
} -constraints {eagle System.Data.SQLite.Encryption monoBug28 command.sql\
compile.DATA SQLite System.Data.SQLite} -match regexp -result {^1 \{(?:file is\
not a database|database disk image is malformed)\} 1 \{(?:file is not a\
database|database disk image is malformed)\} 0 1 0 2$}}

###############################################################################

runTest {test data-1.106 {TextHexPassword error (no encryption support)} -body {
  list [catch {
    setupDb [set fileName data-1.106.db] "" "" "" "" "TextHexPassword=1234;"
  } msg] [extractSystemDataSQLiteExceptionMessage $msg]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain msg db fileName
} -constraints [fixConstraints {eagle !System.Data.SQLite.Encryption monoBug28\
command.sql compile.DATA SQLite System.Data.SQLite}] -result {1 {SQL logic\
error -- Cannot use "TextHexPassword" connection string property: library was\
not built with encryption support, please see "https://www.sqlite.org/see" for\
more information}}}

###############################################################################

runTest {test data-1.107 {encrypted database, w/TextHexPassword} -setup {
  setupDb [set fileName data-1.107.db] "" "" "" "" "TextHexPassword=1234;"
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Password=1234;" true false

  set result [list]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "TextHexPassword=1234;" true false

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain error result db fileName
} -constraints {eagle System.Data.SQLite.Encryption monoBug28 command.sql\
compile.DATA SQLite System.Data.SQLite} -match regexp -result {^1 \{(?:file is\
not a database|database disk image is malformed)\} 1 \{(?:file is not a\
database|database disk image is malformed)\} 0 1 0 2$}}

###############################################################################

runTest {test data-1.108 {contrib math functions} -setup {
  setupDb [set fileName data-1.108.db]
} -body {
  set results [list]

  set functionCalls [list \
      acos(0) acosh(1) asin(0) asinh(0) \
      atan(0) atan2(0,0) atn2(0,0) \
      atanh(0) ceil(0) ceiling(0) cos(0) \
      cosh(0) cot(1) coth(1) degrees(0) \
      exp(0) floor(0) log(1) log10(1) \
      pi() power(0,0) radians(0) sign(0) \
      sin(0) sinh(0) sqrt(0) square(0) \
      tan(0) tanh(0)]

  foreach functionCall $functionCalls {
    set code [catch {
      sql execute -execute scalar $db \
          [appendArgs "SELECT " $functionCall \;]
    } result]

    lappend results $code $result
  }

  set results
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain results result code
  unset -nocomplain functionCall functionCalls
  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result {^0 1\.5707\d* 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0\
0\.6420\d* 0 1\.3130\d* 0 0 0 1 0 0 0 0 0 0 0 3\.1415\d* 0 1 0 0 0 0 0 0 0 0 0\
0 0 0 0 0 0 0$}}

###############################################################################

runTest {test data-1.109 {contrib math functions w/NoCoreFunctions} -setup {
  setupDb [set fileName data-1.109.db] "" "" "" NoCoreFunctions
} -body {
  set results [list]

  set functionCalls [list \
      acos(0) acosh(1) asin(0) asinh(0) \
      atan(0) atan2(0,0) atn2(0,0) \
      atanh(0) ceil(0) ceiling(0) cos(0) \
      cosh(0) cot(1) coth(1) degrees(0) \
      exp(0) floor(0) log(1) log10(1) \
      pi() power(0,0) radians(0) sign(0) \
      sin(0) sinh(0) sqrt(0) square(0) \
      tan(0) tanh(0)]

  foreach functionCall $functionCalls {
    set code [catch {
      sql execute -execute scalar $db \
          [appendArgs "SELECT " $functionCall \;]
    } result]

    lappend results $code $result
  }

  set results
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain results result code
  unset -nocomplain functionCall functionCalls
  unset -nocomplain db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite sqlite3_c99_math} -match regexp -result {^0 1\.5707\d* 0 0 0\
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0\.6420\d* 0 1\.3130\d* 0 0 0 1 0 0 0 0\
0 0 0 3\.1415\d* 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0$}}

###############################################################################

runTest {test data-1.110 {core-only math functions} -setup {
  setupDb [set fileName data-1.110.db]
} -body {
  set results [list]

  set functionCalls [list \
      ln(1) log(2,1) log2(1) mod(1,1) \
      pow(0,0) trunc(0)]

  foreach functionCall $functionCalls {
    set code [catch {
      sql execute -execute scalar $db \
          [appendArgs "SELECT " $functionCall \;]
    } result]

    lappend results $code $result
  }

  set results
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain results result code
  unset -nocomplain functionCall functionCalls
  unset -nocomplain db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite sqlite3_c99_math} -result {0 0 0 0 0 0 0 0 0 1 0 0}}

###############################################################################

runTest {test data-1.111 {core-only math functions w/NoCoreFunctions} -setup {
  setupDb [set fileName data-1.111.db] "" "" "" NoCoreFunctions
} -body {
  set results [list]

  set functionCalls [list \
      ln(1) log(2,1) log2(1) mod(1,1) \
      pow(0,0) trunc(0)]

  foreach functionCall $functionCalls {
    set code [catch {
      sql execute -execute scalar $db \
          [appendArgs "SELECT " $functionCall \;]
    } result]

    lappend results $code $result
  }

  set results
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain results result code
  unset -nocomplain functionCall functionCalls
  unset -nocomplain db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite sqlite3_c99_math} -result {0 0 0 0 0 0 0 0 0 1 0 0}}

###############################################################################

reportSQLiteResources $test_channel

###############################################################################

runSQLiteTestExtraEpilogue
runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue

Added Tests/busy.eagle.



























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
###############################################################################
#
# busy.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test busy-1.1 {busy with retry} -setup {
  setupDb [set fileName busy-1.1.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  sql execute $db {
    CREATE TABLE t1(x INTEGER);
    INSERT INTO t1 (x) VALUES(1);
    INSERT INTO t1 (x) VALUES(2);
    INSERT INTO t1 (x) VALUES(3);
    INSERT INTO t1 (x) VALUES(4);
    SELECT x FROM t1 ORDER BY x;
  }

  set sql(1) { \
    BEGIN EXCLUSIVE TRANSACTION; \
    INSERT INTO t1 (x) VALUES(5); \
    INSERT INTO t1 (x) VALUES(6); \
    INSERT INTO t1 (x) VALUES(7); \
    INSERT INTO t1 (x) VALUES(8); \
    COMMIT TRANSACTION; \
  }

  set sql(2) { \
    SELECT x FROM t1 ORDER BY x; \
  }

  set count(1) 1500; # main thread lock milliseconds
  set count(2) [expr {($count(1) * 1.25) / 1000.0}]; # timeout in seconds
  set count(3) 100; # event loop sleep milliseconds

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using System.Threading;
    using Eagle._Components.Public;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        private static int count = 0;

        ///////////////////////////////////////////////////////////////////////

        public static void MyBusyHandler(
          object sender,
          BusyEventArgs e
          )
        {
          Interlocked.Increment(ref count);
        }

        ///////////////////////////////////////////////////////////////////////

        private static void BusyWaitCallback(
          object state
          )
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Busy += MyBusyHandler;
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql(1)}",
                connection))
            {
              command.CommandTimeout = 0;
              command.ExecuteNonQuery();
            }
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static int Start(
          Interpreter interpreter
          )
        {
          ThreadPool.QueueUserWorkItem(
              new WaitCallback(BusyWaitCallback));

          DateTime start = DateTime.UtcNow;

          while (true)
          {
            if (DateTime.UtcNow.Subtract(start).TotalSeconds >= ${count(2)})
              break;

            Result result = null;

            if ((interpreter != null) && (interpreter.EvaluateScript(
                "update", ref result) != ReturnCode.Ok))
            {
              Utility.Complain(interpreter, ReturnCode.Error, result);
              break;
            }

            Thread.Sleep(${count(3)});
          }

          return Interlocked.CompareExchange(ref count, 0, 0);
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll Eagle.dll]]

  sql execute $db {BEGIN EXCLUSIVE TRANSACTION;}
  after $count(1) [list sql execute $db {COMMIT TRANSACTION;}]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Start ""
      } result] : [set result ""]}] $result \
      [expr {[string is integer -strict $result] && $result > 0 ? 1 : 0}] \
      [llength [after info]] \
      [vwait -force -timeout $test_timeout -- forever] \
      [sql execute -execute reader -format list $db $sql(2)]
} -cleanup {
  catch {foreach i [after info] {after cancel $i}}

  cleanupDb $fileName

  unset -nocomplain result results errors code i count sql
  unset -nocomplain dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \d+ 1 0 False \{1 2 3 4 5 6\
7 8\}$}}

###############################################################################

runTest {test busy-1.2 {busy with stop} -setup {
  setupDb [set fileName busy-1.2.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  sql execute $db {
    CREATE TABLE t1(x INTEGER);
    INSERT INTO t1 (x) VALUES(1);
    INSERT INTO t1 (x) VALUES(2);
    INSERT INTO t1 (x) VALUES(3);
    INSERT INTO t1 (x) VALUES(4);
    SELECT x FROM t1 ORDER BY x;
  }

  set sql(1) { \
    BEGIN EXCLUSIVE TRANSACTION; \
    INSERT INTO t1 (x) VALUES(5); \
    INSERT INTO t1 (x) VALUES(6); \
    INSERT INTO t1 (x) VALUES(7); \
    INSERT INTO t1 (x) VALUES(8); \
    COMMIT TRANSACTION; \
  }

  set sql(2) { \
    SELECT x FROM t1 ORDER BY x; \
  }

  set count(1) 1500; # main thread lock milliseconds
  set count(2) [expr {($count(1) * 0.5) / 1000.0}]; # timeout in seconds
  set count(3) 100; # event loop sleep milliseconds

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using System.Threading;
    using Eagle._Components.Public;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        private static int count = 0;

        ///////////////////////////////////////////////////////////////////////

        public static void MyBusyHandler(
          object sender,
          BusyEventArgs e
          )
        {
          Interlocked.Increment(ref count);
          e.ReturnCode = SQLiteBusyReturnCode.Stop;
        }

        ///////////////////////////////////////////////////////////////////////

        private static void BusyWaitCallback(
          object state
          )
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Busy += MyBusyHandler;
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql(1)}",
                connection))
            {
              command.CommandTimeout = 0;

              try
              {
                command.ExecuteNonQuery();
              }
              catch (SQLiteException)
              {
                // do nothing.
              }
            }
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static int Start(
          Interpreter interpreter
          )
        {
          ThreadPool.QueueUserWorkItem(
              new WaitCallback(BusyWaitCallback));

          DateTime start = DateTime.UtcNow;

          while (true)
          {
            if (DateTime.UtcNow.Subtract(start).TotalSeconds >= ${count(2)})
              break;

            Result result = null;

            if ((interpreter != null) && (interpreter.EvaluateScript(
                "update", ref result) != ReturnCode.Ok))
            {
              Utility.Complain(interpreter, ReturnCode.Error, result);
              break;
            }

            Thread.Sleep(${count(3)});
          }

          return Interlocked.CompareExchange(ref count, 0, 0);
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll Eagle.dll]]

  sql execute $db {BEGIN EXCLUSIVE TRANSACTION;}
  after $count(1) [list sql execute $db {COMMIT TRANSACTION;}]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Start ""
      } result] : [set result ""]}] $result \
      [expr {[string is integer -strict $result] && $result > 0 ? 1 : 0}] \
      [llength [after info]] \
      [vwait -force -timeout $test_timeout -- forever] \
      [sql execute -execute reader -format list $db $sql(2)]
} -cleanup {
  catch {foreach i [after info] {after cancel $i}}

  cleanupDb $fileName

  unset -nocomplain result results errors code i count sql
  unset -nocomplain dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \d+ 1 1 False \{1 2 3 4\}$}}

###############################################################################

runTest {test busy-1.3 {busy with exception (retry)} -setup {
  setupDb [set fileName busy-1.3.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  sql execute $db {
    CREATE TABLE t1(x INTEGER);
    INSERT INTO t1 (x) VALUES(1);
    INSERT INTO t1 (x) VALUES(2);
    INSERT INTO t1 (x) VALUES(3);
    INSERT INTO t1 (x) VALUES(4);
    SELECT x FROM t1 ORDER BY x;
  }

  set sql(1) { \
    BEGIN EXCLUSIVE TRANSACTION; \
    INSERT INTO t1 (x) VALUES(5); \
    INSERT INTO t1 (x) VALUES(6); \
    INSERT INTO t1 (x) VALUES(7); \
    INSERT INTO t1 (x) VALUES(8); \
    COMMIT TRANSACTION; \
  }

  set sql(2) { \
    SELECT x FROM t1 ORDER BY x; \
  }

  set count(1) 1500; # main thread lock milliseconds
  set count(2) [expr {($count(1) * 1.25) / 1000.0}]; # timeout in seconds
  set count(3) 100; # event loop sleep milliseconds

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using System.Threading;
    using Eagle._Components.Public;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        private static int count = 0;

        ///////////////////////////////////////////////////////////////////////

        public static void MyBusyHandler(
          object sender,
          BusyEventArgs e
          )
        {
          Interlocked.Increment(ref count);
          throw new Exception();
        }

        ///////////////////////////////////////////////////////////////////////

        private static void BusyWaitCallback(
          object state
          )
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Busy += MyBusyHandler;
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql(1)}",
                connection))
            {
              command.CommandTimeout = 0;
              command.ExecuteNonQuery();
            }
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static int Start(
          Interpreter interpreter
          )
        {
          ThreadPool.QueueUserWorkItem(
              new WaitCallback(BusyWaitCallback));

          DateTime start = DateTime.UtcNow;

          while (true)
          {
            if (DateTime.UtcNow.Subtract(start).TotalSeconds >= ${count(2)})
              break;

            Result result = null;

            if ((interpreter != null) && (interpreter.EvaluateScript(
                "update", ref result) != ReturnCode.Ok))
            {
              Utility.Complain(interpreter, ReturnCode.Error, result);
              break;
            }

            Thread.Sleep(${count(3)});
          }

          return Interlocked.CompareExchange(ref count, 0, 0);
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll Eagle.dll]]

  sql execute $db {BEGIN EXCLUSIVE TRANSACTION;}
  after $count(1) [list sql execute $db {COMMIT TRANSACTION;}]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Start ""
      } result] : [set result ""]}] $result \
      [expr {[string is integer -strict $result] && $result > 0 ? 1 : 0}] \
      [llength [after info]] \
      [vwait -force -timeout $test_timeout -- forever] \
      [sql execute -execute reader -format list $db $sql(2)]
} -cleanup {
  catch {foreach i [after info] {after cancel $i}}

  cleanupDb $fileName

  unset -nocomplain result results errors code i count sql
  unset -nocomplain dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \d+ 1 0 False \{1 2 3 4 5 6\
7 8\}$}}

###############################################################################

runTest {test busy-1.4 {busy with exception (stop)} -setup {
  setupDb [set fileName busy-1.4.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  sql execute $db {
    CREATE TABLE t1(x INTEGER);
    INSERT INTO t1 (x) VALUES(1);
    INSERT INTO t1 (x) VALUES(2);
    INSERT INTO t1 (x) VALUES(3);
    INSERT INTO t1 (x) VALUES(4);
    SELECT x FROM t1 ORDER BY x;
  }

  set sql(1) { \
    BEGIN EXCLUSIVE TRANSACTION; \
    INSERT INTO t1 (x) VALUES(5); \
    INSERT INTO t1 (x) VALUES(6); \
    INSERT INTO t1 (x) VALUES(7); \
    INSERT INTO t1 (x) VALUES(8); \
    COMMIT TRANSACTION; \
  }

  set sql(2) { \
    SELECT x FROM t1 ORDER BY x; \
  }

  set count(1) 1500; # main thread lock milliseconds
  set count(2) [expr {($count(1) * 0.5) / 1000.0}]; # timeout in seconds
  set count(3) 100; # event loop sleep milliseconds

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using System.Threading;
    using Eagle._Components.Public;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        private static int count = 0;

        ///////////////////////////////////////////////////////////////////////

        public static void MyBusyHandler(
          object sender,
          BusyEventArgs e
          )
        {
          Interlocked.Increment(ref count);
          throw new Exception();
        }

        ///////////////////////////////////////////////////////////////////////

        private static void BusyWaitCallback(
          object state
          )
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties StopOnException]"))
          {
            connection.Busy += MyBusyHandler;
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql(1)}",
                connection))
            {
              command.CommandTimeout = 0;

              try
              {
                command.ExecuteNonQuery();
              }
              catch (SQLiteException)
              {
                // do nothing.
              }
            }
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static int Start(
          Interpreter interpreter
          )
        {
          ThreadPool.QueueUserWorkItem(
              new WaitCallback(BusyWaitCallback));

          DateTime start = DateTime.UtcNow;

          while (true)
          {
            if (DateTime.UtcNow.Subtract(start).TotalSeconds >= ${count(2)})
              break;

            Result result = null;

            if ((interpreter != null) && (interpreter.EvaluateScript(
                "update", ref result) != ReturnCode.Ok))
            {
              Utility.Complain(interpreter, ReturnCode.Error, result);
              break;
            }

            Thread.Sleep(${count(3)});
          }

          return Interlocked.CompareExchange(ref count, 0, 0);
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll Eagle.dll]]

  sql execute $db {BEGIN EXCLUSIVE TRANSACTION;}
  after $count(1) [list sql execute $db {COMMIT TRANSACTION;}]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Start ""
      } result] : [set result ""]}] $result \
      [expr {[string is integer -strict $result] && $result > 0 ? 1 : 0}] \
      [llength [after info]] \
      [vwait -force -timeout $test_timeout -- forever] \
      [sql execute -execute reader -format list $db $sql(2)]
} -cleanup {
  catch {foreach i [after info] {after cancel $i}}

  cleanupDb $fileName

  unset -nocomplain result results errors code i count sql
  unset -nocomplain dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \d+ 1 1 False \{1 2 3 4\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/data/Installer_Test_Vs2005.log.









































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
Installer.exe: #[getLineNumber]: Configuration.Process: No actual changes will be made to this system because "what-if" mode is enabled.
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v2.0.50727", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx", subKeyName = "SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx", subKeyName = "System.Data.SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\System.Data.SQLite", name = <null>, value = "[file nativename [getBuildDirectory true]]"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v2.0.50727", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework", name = "InstallRoot", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.RemoveDbProviderFactory: addElement = <null>, removeElement = <null>
Installer.exe: #[getLineNumber]: Installer.AddDbProviderFactory: addElement = <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=[file version $systemDataSQLiteDllFile], Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\8.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\8.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0", subKeyName = "Packages", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\Packages", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = <null>, value = "System.Data.SQLite Designer Package"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "Class", value = "SQLite.Designer.SQLitePackage"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "CodeBase", value = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "ID", value = 400
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "InprocServer32", value = "[file nativename [file join $::env(windir) [expr {$is64 ? "SysWOW64" : "system32"}] mscoree.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "CompanyName", value = "https://system.data.sqlite.org/"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "MinEdition", value = "standard"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "ProductName", value = "System.Data.SQLite Designer Package"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "ProductVersion", value = "1.0"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", subKeyName = "Toolbox"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}\Toolbox", name = "Default Items", value = 3
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0", subKeyName = "Menus", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\Menus", name = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", value = ", 1000, 3"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0", subKeyName = "Services", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\Services", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\Services\{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}", name = <null>, value = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\Services\{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}", name = "Name", value = "System.Data.SQLite Designer Service"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\8.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\8.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0", subKeyName = "DataSources", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\DataSources", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\DataSources\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}", name = <null>, value = "System.Data.SQLite Database File"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\DataSources\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}", name = "DefaultProvider", value = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\DataSources\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}", subKeyName = "SupportingProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\8.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\8.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0", subKeyName = "DataProviders", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\DataProviders", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = <null>, value = ".NET Framework Data Provider for SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "Assembly", value = "SQLite.Designer, Version=[file version $sqliteDesignerDllFile], Culture=neutral, PublicKeyToken=db937bc2d44ff139"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "AssociatedSource", value = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "InvariantName", value = "System.Data.SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "Technology", value = "{77ab9a9d-78b9-4ba7-91ac-873f5338f1d2}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "CodeBase", value = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "FactoryService", value = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataConnectionUIControl"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataConnectionProperties"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataConnectionSupport"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataObjectSupport"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataViewSupport"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\8.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.AddVsDevEnvSetup: fileName = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 8} Common7 IDE devenv.exe]]", arguments = "/setup", workingDirectory = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 8} Common7 IDE]]\", useShellExecute = False, redirectStandardOutput = True, redirectStandardError = True
Installer.exe: #[getLineNumber]: Installer.Main: subKeysCreated = 12, subKeysDeleted = 1, keyValuesRead = 5, keyValuesWritten = 23, keyValuesDeleted = 0
Installer.exe: #[getLineNumber]: Installer.Main: filesCreated = 1, filesModified = 2, filesDeleted = 0
Installer.exe: #[getLineNumber]: RegistryHelper.WriteOperationList: Operation log file name not set.
Installer.exe: #[getLineNumber]: Installer.Main: Success.

Added Tests/data/Installer_Test_Vs2008.log.





























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Installer.exe: #[getLineNumber]: Configuration.Process: No actual changes will be made to this system because "what-if" mode is enabled.
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.Linq.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v2.0.50727", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx", subKeyName = "SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx", subKeyName = "System.Data.SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\System.Data.SQLite", name = <null>, value = "[file nativename [getBuildDirectory true]]"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v3.5", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v3.5\AssemblyFoldersEx", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v3.5\AssemblyFoldersEx", subKeyName = "SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v3.5\AssemblyFoldersEx", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v3.5\AssemblyFoldersEx", subKeyName = "System.Data.SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v3.5\AssemblyFoldersEx\System.Data.SQLite", name = <null>, value = "[file nativename [getBuildDirectory true]]"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v2.0.50727", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework", name = "InstallRoot", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.RemoveDbProviderFactory: addElement = <null>, removeElement = <null>
Installer.exe: #[getLineNumber]: Installer.AddDbProviderFactory: addElement = <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=[file version $systemDataSQLiteDllFile], Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v3.5", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework", name = "InstallRoot", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\9.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\9.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0", subKeyName = "Packages", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\Packages", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = <null>, value = "System.Data.SQLite Designer Package"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "Class", value = "SQLite.Designer.SQLitePackage"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "CodeBase", value = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "ID", value = 400
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "InprocServer32", value = "[file nativename [file join $::env(windir) [expr {$is64 ? "SysWOW64" : "system32"}] mscoree.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "CompanyName", value = "https://system.data.sqlite.org/"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "MinEdition", value = "standard"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "ProductName", value = "System.Data.SQLite Designer Package"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "ProductVersion", value = "1.0"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", subKeyName = "Toolbox"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}\Toolbox", name = "Default Items", value = 3
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0", subKeyName = "Menus", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\Menus", name = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", value = ", 1000, 3"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0", subKeyName = "Services", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\Services", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\Services\{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}", name = <null>, value = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\Services\{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}", name = "Name", value = "System.Data.SQLite Designer Service"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\9.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\9.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0", subKeyName = "DataSources", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\DataSources", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\DataSources\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}", name = <null>, value = "System.Data.SQLite Database File"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\DataSources\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}", name = "DefaultProvider", value = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\DataSources\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}", subKeyName = "SupportingProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\9.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\9.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0", subKeyName = "DataProviders", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\DataProviders", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = <null>, value = ".NET Framework Data Provider for SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "Assembly", value = "SQLite.Designer, Version=[file version $sqliteDesignerDllFile], Culture=neutral, PublicKeyToken=db937bc2d44ff139"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "AssociatedSource", value = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "InvariantName", value = "System.Data.SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "Technology", value = "{77ab9a9d-78b9-4ba7-91ac-873f5338f1d2}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "CodeBase", value = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "FactoryService", value = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataConnectionUIControl"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataConnectionProperties"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataConnectionSupport"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataObjectSupport"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataViewSupport"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\9.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.AddVsDevEnvSetup: fileName = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 9.0} Common7 IDE devenv.exe]]", arguments = "/setup", workingDirectory = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 9.0} Common7 IDE]]\", useShellExecute = False, redirectStandardOutput = True, redirectStandardError = True
Installer.exe: #[getLineNumber]: Installer.Main: subKeysCreated = 13, subKeysDeleted = 2, keyValuesRead = 6, keyValuesWritten = 24, keyValuesDeleted = 0
Installer.exe: #[getLineNumber]: Installer.Main: filesCreated = 1, filesModified = 2, filesDeleted = 0
Installer.exe: #[getLineNumber]: RegistryHelper.WriteOperationList: Operation log file name not set.
Installer.exe: #[getLineNumber]: Installer.Main: Success.

Added Tests/data/Installer_Test_Vs2010.log.















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Installer.exe: #[getLineNumber]: Configuration.Process: No actual changes will be made to this system because "what-if" mode is enabled.
Installer.exe: #[getLineNumber]: Configuration.IsSystemEf6AssemblyAvailable: Entity Framework 6 assembly was resolved to "[file nativename [file join [getBuildDirectory true] EntityFramework.dll]]".
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.Linq.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.EF6.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.0.30319", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx", subKeyName = "SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx", subKeyName = "System.Data.SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\System.Data.SQLite", name = <null>, value = "[file nativename [getBuildDirectory true]]"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.0.30319", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework", name = "InstallRoot", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.RemoveDbProviderFactory: addElement = <null>, removeElement = <null>
Installer.exe: #[getLineNumber]: Installer.AddDbProviderFactory: addElement = <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=[file version $systemDataSQLiteDllFile], Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\10.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\10.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0", subKeyName = "Packages", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\Packages", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = <null>, value = "System.Data.SQLite Designer Package"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "Class", value = "SQLite.Designer.SQLitePackage"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "CodeBase", value = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "ID", value = 400
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "InprocServer32", value = "[file nativename [file join $::env(windir) [expr {$is64 ? "SysWOW64" : "system32"}] mscoree.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "CompanyName", value = "https://system.data.sqlite.org/"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "MinEdition", value = "standard"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "ProductName", value = "System.Data.SQLite Designer Package"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "ProductVersion", value = "1.0"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", subKeyName = "Toolbox"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}\Toolbox", name = "Default Items", value = 3
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0", subKeyName = "Menus", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\Menus", name = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", value = ", 1000, 3"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0", subKeyName = "Services", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\Services", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\Services\{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}", name = <null>, value = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\Services\{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}", name = "Name", value = "System.Data.SQLite Designer Service"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\10.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\10.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0", subKeyName = "DataSources", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\DataSources", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\DataSources\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}", name = <null>, value = "System.Data.SQLite Database File"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\DataSources\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}", name = "DefaultProvider", value = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\DataSources\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}", subKeyName = "SupportingProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\10.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\10.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0", subKeyName = "DataProviders", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\DataProviders", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = <null>, value = ".NET Framework Data Provider for SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "Assembly", value = "SQLite.Designer, Version=[file version $sqliteDesignerDllFile], Culture=neutral, PublicKeyToken=db937bc2d44ff139"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "AssociatedSource", value = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "InvariantName", value = "System.Data.SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "Technology", value = "{77ab9a9d-78b9-4ba7-91ac-873f5338f1d2}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "CodeBase", value = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "FactoryService", value = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataConnectionUIControl"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataConnectionProperties"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataConnectionSupport"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataObjectSupport"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataViewSupport"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\10.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.AddVsDevEnvSetup: fileName = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 10.0} Common7 IDE devenv.exe]]", arguments = "/setup", workingDirectory = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 10.0} Common7 IDE]]\", useShellExecute = False, redirectStandardOutput = True, redirectStandardError = True
Installer.exe: #[getLineNumber]: Installer.Main: subKeysCreated = 12, subKeysDeleted = 1, keyValuesRead = 5, keyValuesWritten = 23, keyValuesDeleted = 0
Installer.exe: #[getLineNumber]: Installer.Main: filesCreated = 1, filesModified = 2, filesDeleted = 0
Installer.exe: #[getLineNumber]: RegistryHelper.WriteOperationList: Operation log file name not set.
Installer.exe: #[getLineNumber]: Installer.Main: Success.

Added Tests/data/Installer_Test_Vs2012.log.















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Installer.exe: #[getLineNumber]: Configuration.Process: No actual changes will be made to this system because "what-if" mode is enabled.
Installer.exe: #[getLineNumber]: Configuration.IsSystemEf6AssemblyAvailable: Entity Framework 6 assembly was resolved to "[file nativename [file join [getBuildDirectory true] EntityFramework.dll]]".
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.Linq.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.EF6.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.5.50709", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.5.50709\AssemblyFoldersEx", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v4.5.50709\AssemblyFoldersEx", subKeyName = "SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.5.50709\AssemblyFoldersEx", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v4.5.50709\AssemblyFoldersEx", subKeyName = "System.Data.SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v4.5.50709\AssemblyFoldersEx\System.Data.SQLite", name = <null>, value = "[file nativename [getBuildDirectory true]]"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.0.30319", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework", name = "InstallRoot", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.RemoveDbProviderFactory: addElement = <null>, removeElement = <null>
Installer.exe: #[getLineNumber]: Installer.AddDbProviderFactory: addElement = <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=[file version $systemDataSQLiteDllFile], Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\11.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\11.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0", subKeyName = "Packages", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\Packages", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = <null>, value = "System.Data.SQLite Designer Package"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "Class", value = "SQLite.Designer.SQLitePackage"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "CodeBase", value = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "ID", value = 400
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "InprocServer32", value = "[file nativename [file join $::env(windir) [expr {$is64 ? "SysWOW64" : "system32"}] mscoree.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "CompanyName", value = "https://system.data.sqlite.org/"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "MinEdition", value = "standard"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "ProductName", value = "System.Data.SQLite Designer Package"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "ProductVersion", value = "1.0"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", subKeyName = "Toolbox"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}\Toolbox", name = "Default Items", value = 3
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0", subKeyName = "Menus", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\Menus", name = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", value = ", 1000, 3"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0", subKeyName = "Services", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\Services", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\Services\{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}", name = <null>, value = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\Services\{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}", name = "Name", value = "System.Data.SQLite Designer Service"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\11.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\11.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0", subKeyName = "DataSources", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\DataSources", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\DataSources\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}", name = <null>, value = "System.Data.SQLite Database File"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\DataSources\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}", name = "DefaultProvider", value = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\DataSources\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}", subKeyName = "SupportingProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\11.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\11.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0", subKeyName = "DataProviders", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\DataProviders", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = <null>, value = ".NET Framework Data Provider for SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "Assembly", value = "SQLite.Designer, Version=[file version $sqliteDesignerDllFile], Culture=neutral, PublicKeyToken=db937bc2d44ff139"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "AssociatedSource", value = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "InvariantName", value = "System.Data.SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "Technology", value = "{77ab9a9d-78b9-4ba7-91ac-873f5338f1d2}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "CodeBase", value = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "FactoryService", value = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataConnectionUIControl"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataConnectionProperties"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataConnectionSupport"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataObjectSupport"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataViewSupport"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\11.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.AddVsDevEnvSetup: fileName = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 11.0} Common7 IDE devenv.exe]]", arguments = "/setup", workingDirectory = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 11.0} Common7 IDE]]\", useShellExecute = False, redirectStandardOutput = True, redirectStandardError = True
Installer.exe: #[getLineNumber]: Installer.Main: subKeysCreated = 12, subKeysDeleted = 1, keyValuesRead = 5, keyValuesWritten = 23, keyValuesDeleted = 0
Installer.exe: #[getLineNumber]: Installer.Main: filesCreated = 1, filesModified = 2, filesDeleted = 0
Installer.exe: #[getLineNumber]: RegistryHelper.WriteOperationList: Operation log file name not set.
Installer.exe: #[getLineNumber]: Installer.Main: Success.

Added Tests/data/Installer_Test_Vs2013.log.















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Installer.exe: #[getLineNumber]: Configuration.Process: No actual changes will be made to this system because "what-if" mode is enabled.
Installer.exe: #[getLineNumber]: Configuration.IsSystemEf6AssemblyAvailable: Entity Framework 6 assembly was resolved to "[file nativename [file join [getBuildDirectory true] EntityFramework.dll]]".
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.Linq.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.EF6.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.5.1", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.5.1\AssemblyFoldersEx", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v4.5.1\AssemblyFoldersEx", subKeyName = "SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.5.1\AssemblyFoldersEx", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v4.5.1\AssemblyFoldersEx", subKeyName = "System.Data.SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v4.5.1\AssemblyFoldersEx\System.Data.SQLite", name = <null>, value = "[file nativename [getBuildDirectory true]]"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.0.30319", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework", name = "InstallRoot", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.RemoveDbProviderFactory: addElement = <null>, removeElement = <null>
Installer.exe: #[getLineNumber]: Installer.AddDbProviderFactory: addElement = <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=[file version $systemDataSQLiteDllFile], Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\12.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\12.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0", subKeyName = "Packages", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\Packages", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = <null>, value = "System.Data.SQLite Designer Package"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "Class", value = "SQLite.Designer.SQLitePackage"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "CodeBase", value = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "ID", value = 400
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "InprocServer32", value = "[file nativename [file join $::env(windir) [expr {$is64 ? "SysWOW64" : "system32"}] mscoree.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "CompanyName", value = "https://system.data.sqlite.org/"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "MinEdition", value = "standard"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "ProductName", value = "System.Data.SQLite Designer Package"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "ProductVersion", value = "1.0"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", subKeyName = "Toolbox"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}\Toolbox", name = "Default Items", value = 3
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0", subKeyName = "Menus", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\Menus", name = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", value = ", 1000, 3"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0", subKeyName = "Services", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\Services", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\Services\{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}", name = <null>, value = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\Services\{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}", name = "Name", value = "System.Data.SQLite Designer Service"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\12.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\12.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0", subKeyName = "DataSources", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\DataSources", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\DataSources\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}", name = <null>, value = "System.Data.SQLite Database File"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\DataSources\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}", name = "DefaultProvider", value = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\DataSources\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}", subKeyName = "SupportingProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\12.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\12.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0", subKeyName = "DataProviders", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\DataProviders", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = <null>, value = ".NET Framework Data Provider for SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "Assembly", value = "SQLite.Designer, Version=[file version $sqliteDesignerDllFile], Culture=neutral, PublicKeyToken=db937bc2d44ff139"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "AssociatedSource", value = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "InvariantName", value = "System.Data.SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "Technology", value = "{77ab9a9d-78b9-4ba7-91ac-873f5338f1d2}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "CodeBase", value = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "FactoryService", value = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataConnectionUIControl"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataConnectionProperties"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataConnectionSupport"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataObjectSupport"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataViewSupport"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\12.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.AddVsDevEnvSetup: fileName = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 12.0} Common7 IDE devenv.exe]]", arguments = "/setup", workingDirectory = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 12.0} Common7 IDE]]\", useShellExecute = False, redirectStandardOutput = True, redirectStandardError = True
Installer.exe: #[getLineNumber]: Installer.Main: subKeysCreated = 12, subKeysDeleted = 1, keyValuesRead = 5, keyValuesWritten = 23, keyValuesDeleted = 0
Installer.exe: #[getLineNumber]: Installer.Main: filesCreated = 1, filesModified = 2, filesDeleted = 0
Installer.exe: #[getLineNumber]: RegistryHelper.WriteOperationList: Operation log file name not set.
Installer.exe: #[getLineNumber]: Installer.Main: Success.

Added Tests/data/Installer_Test_Vs2015.log.





































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Installer.exe: #[getLineNumber]: Configuration.Process: No actual changes will be made to this system because "what-if" mode is enabled.
Installer.exe: #[getLineNumber]: Configuration.IsSystemEf6AssemblyAvailable: Entity Framework 6 assembly was resolved to "[file nativename [file join [getBuildDirectory true] EntityFramework.dll]]".
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.Linq.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.EF6.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacInstall: assemblyPath = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.6", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.0.30319", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework", name = "InstallRoot", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.RemoveDbProviderFactory: addElement = <null>, removeElement = <null>
Installer.exe: #[getLineNumber]: Installer.AddDbProviderFactory: addElement = <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=[file version $systemDataSQLiteDllFile], Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\14.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\14.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0", subKeyName = "Packages", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\Packages", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = <null>, value = "System.Data.SQLite Designer Package"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "Class", value = "SQLite.Designer.SQLitePackage"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "CodeBase", value = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "ID", value = 400
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "InprocServer32", value = "[file nativename [file join $::env(windir) [expr {$is64 ? "SysWOW64" : "system32"}] mscoree.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "CompanyName", value = "https://system.data.sqlite.org/"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "MinEdition", value = "standard"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "ProductName", value = "System.Data.SQLite Designer Package"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", name = "ProductVersion", value = "1.0"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", subKeyName = "Toolbox"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\Packages\{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}\Toolbox", name = "Default Items", value = 3
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0", subKeyName = "Menus", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\Menus", name = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}", value = ", 1000, 3"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0", subKeyName = "Services", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\Services", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\Services\{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}", name = <null>, value = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\Services\{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}", name = "Name", value = "System.Data.SQLite Designer Service"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\14.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\14.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0", subKeyName = "DataSources", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\DataSources", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\DataSources\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}", name = <null>, value = "System.Data.SQLite Database File"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\DataSources\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}", name = "DefaultProvider", value = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\DataSources\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}", subKeyName = "SupportingProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\14.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\14.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0", subKeyName = "DataProviders", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\DataProviders", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = <null>, value = ".NET Framework Data Provider for SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "Assembly", value = "SQLite.Designer, Version=[file version $sqliteDesignerDllFile], Culture=neutral, PublicKeyToken=db937bc2d44ff139"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "AssociatedSource", value = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "InvariantName", value = "System.Data.SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "Technology", value = "{77ab9a9d-78b9-4ba7-91ac-873f5338f1d2}"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "CodeBase", value = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.SetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", name = "FactoryService", value = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataConnectionUIControl"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataConnectionProperties"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataConnectionSupport"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataObjectSupport"
Installer.exe: #[getLineNumber]: RegistryHelper.CreateSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\DataProviders\{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}", subKeyName = "SupportedObjects\DataViewSupport"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\14.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.AddVsDevEnvSetup: fileName = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 14.0} Common7 IDE devenv.exe]]", arguments = "/setup", workingDirectory = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 14.0} Common7 IDE]]\", useShellExecute = False, redirectStandardOutput = True, redirectStandardError = True
Installer.exe: #[getLineNumber]: Installer.Main: subKeysCreated = 11, subKeysDeleted = 0, keyValuesRead = 5, keyValuesWritten = 22, keyValuesDeleted = 0
Installer.exe: #[getLineNumber]: Installer.Main: filesCreated = 1, filesModified = 2, filesDeleted = 0
Installer.exe: #[getLineNumber]: RegistryHelper.WriteOperationList: Operation log file name not set.
Installer.exe: #[getLineNumber]: Installer.Main: Success.

Added Tests/data/Uninstaller_Test_Vs2005.log.











































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Installer.exe: #[getLineNumber]: Configuration.Process: No actual changes will be made to this system because "what-if" mode is enabled.
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v2.0.50727", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx", subKeyName = "System.Data.SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v2.0.50727", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework", name = "InstallRoot", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.RemoveDbProviderFactory: addElement = <null>, removeElement = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\8.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\8.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0", subKeyName = "Packages", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\Packages", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0", subKeyName = "Menus", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\Menus", name = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0", subKeyName = "Services", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\Services", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\8.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\8.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0", subKeyName = "DataSources", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\DataSources", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\8.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\8.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0", subKeyName = "DataProviders", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0\DataProviders", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\8.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\8.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.RemoveVsDevEnvSetup: Preparing to run Visual Studio v8.0 'setup' mode to refresh its configuration.
Installer.exe: #[getLineNumber]: Installer.AddVsDevEnvSetup: fileName = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 8} Common7 IDE devenv.exe]]", arguments = "/setup", workingDirectory = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 8} Common7 IDE]]\", useShellExecute = False, redirectStandardOutput = True, redirectStandardError = True
Installer.exe: #[getLineNumber]: Installer.Main: subKeysCreated = 0, subKeysDeleted = 5, keyValuesRead = 5, keyValuesWritten = 0, keyValuesDeleted = 1
Installer.exe: #[getLineNumber]: Installer.Main: filesCreated = 1, filesModified = 1, filesDeleted = 0
Installer.exe: #[getLineNumber]: RegistryHelper.WriteOperationList: Operation log file name not set.
Installer.exe: #[getLineNumber]: Installer.Main: Success.

Added Tests/data/Uninstaller_Test_Vs2008.log.

























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Installer.exe: #[getLineNumber]: Configuration.Process: No actual changes will be made to this system because "what-if" mode is enabled.
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.Linq.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v2.0.50727", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx", subKeyName = "System.Data.SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v3.5", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v3.5\AssemblyFoldersEx", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v3.5\AssemblyFoldersEx", subKeyName = "System.Data.SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v2.0.50727", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework", name = "InstallRoot", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.RemoveDbProviderFactory: addElement = <null>, removeElement = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v3.5", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework", name = "InstallRoot", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\9.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\9.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0", subKeyName = "Packages", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\Packages", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0", subKeyName = "Menus", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\Menus", name = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0", subKeyName = "Services", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\Services", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\9.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\9.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0", subKeyName = "DataSources", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\DataSources", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\9.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\9.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0", subKeyName = "DataProviders", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0\DataProviders", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\9.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\9.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.RemoveVsDevEnvSetup: Preparing to run Visual Studio v9.0 'setup' mode to refresh its configuration.
Installer.exe: #[getLineNumber]: Installer.AddVsDevEnvSetup: fileName = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 9.0} Common7 IDE devenv.exe]]", arguments = "/setup", workingDirectory = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 9.0} Common7 IDE]]\", useShellExecute = False, redirectStandardOutput = True, redirectStandardError = True
Installer.exe: #[getLineNumber]: Installer.Main: subKeysCreated = 0, subKeysDeleted = 6, keyValuesRead = 6, keyValuesWritten = 0, keyValuesDeleted = 1
Installer.exe: #[getLineNumber]: Installer.Main: filesCreated = 1, filesModified = 1, filesDeleted = 0
Installer.exe: #[getLineNumber]: RegistryHelper.WriteOperationList: Operation log file name not set.
Installer.exe: #[getLineNumber]: Installer.Main: Success.

Added Tests/data/Uninstaller_Test_Vs2010.log.

















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Installer.exe: #[getLineNumber]: Configuration.Process: No actual changes will be made to this system because "what-if" mode is enabled.
Installer.exe: #[getLineNumber]: Configuration.IsSystemEf6AssemblyAvailable: Entity Framework 6 assembly was resolved to "[file nativename [file join [getBuildDirectory true] EntityFramework.dll]]".
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.EF6.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.Linq.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.0.30319", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx", subKeyName = "System.Data.SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.0.30319", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework", name = "InstallRoot", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.RemoveDbProviderFactory: addElement = <null>, removeElement = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\10.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\10.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0", subKeyName = "Packages", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\Packages", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0", subKeyName = "Menus", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\Menus", name = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0", subKeyName = "Services", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\Services", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\10.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\10.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0", subKeyName = "DataSources", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\DataSources", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\10.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\10.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0", subKeyName = "DataProviders", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0\DataProviders", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\10.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\10.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.RemoveVsDevEnvSetup: Preparing to run Visual Studio v10.0 'setup' mode to refresh its configuration.
Installer.exe: #[getLineNumber]: Installer.AddVsDevEnvSetup: fileName = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 10.0} Common7 IDE devenv.exe]]", arguments = "/setup", workingDirectory = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 10.0} Common7 IDE]]\", useShellExecute = False, redirectStandardOutput = True, redirectStandardError = True
Installer.exe: #[getLineNumber]: Installer.Main: subKeysCreated = 0, subKeysDeleted = 5, keyValuesRead = 5, keyValuesWritten = 0, keyValuesDeleted = 1
Installer.exe: #[getLineNumber]: Installer.Main: filesCreated = 1, filesModified = 1, filesDeleted = 0
Installer.exe: #[getLineNumber]: RegistryHelper.WriteOperationList: Operation log file name not set.
Installer.exe: #[getLineNumber]: Installer.Main: Success.

Added Tests/data/Uninstaller_Test_Vs2012.log.

















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Installer.exe: #[getLineNumber]: Configuration.Process: No actual changes will be made to this system because "what-if" mode is enabled.
Installer.exe: #[getLineNumber]: Configuration.IsSystemEf6AssemblyAvailable: Entity Framework 6 assembly was resolved to "[file nativename [file join [getBuildDirectory true] EntityFramework.dll]]".
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.EF6.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.Linq.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.5.50709", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.5.50709\AssemblyFoldersEx", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v4.5.50709\AssemblyFoldersEx", subKeyName = "System.Data.SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.0.30319", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework", name = "InstallRoot", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.RemoveDbProviderFactory: addElement = <null>, removeElement = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\11.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\11.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0", subKeyName = "Packages", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\Packages", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0", subKeyName = "Menus", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\Menus", name = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0", subKeyName = "Services", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\Services", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\11.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\11.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0", subKeyName = "DataSources", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\DataSources", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\11.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\11.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0", subKeyName = "DataProviders", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0\DataProviders", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\11.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\11.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.RemoveVsDevEnvSetup: Preparing to run Visual Studio v11.0 'setup' mode to refresh its configuration.
Installer.exe: #[getLineNumber]: Installer.AddVsDevEnvSetup: fileName = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 11.0} Common7 IDE devenv.exe]]", arguments = "/setup", workingDirectory = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 11.0} Common7 IDE]]\", useShellExecute = False, redirectStandardOutput = True, redirectStandardError = True
Installer.exe: #[getLineNumber]: Installer.Main: subKeysCreated = 0, subKeysDeleted = 5, keyValuesRead = 5, keyValuesWritten = 0, keyValuesDeleted = 1
Installer.exe: #[getLineNumber]: Installer.Main: filesCreated = 1, filesModified = 1, filesDeleted = 0
Installer.exe: #[getLineNumber]: RegistryHelper.WriteOperationList: Operation log file name not set.
Installer.exe: #[getLineNumber]: Installer.Main: Success.

Added Tests/data/Uninstaller_Test_Vs2013.log.

















































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Installer.exe: #[getLineNumber]: Configuration.Process: No actual changes will be made to this system because "what-if" mode is enabled.
Installer.exe: #[getLineNumber]: Configuration.IsSystemEf6AssemblyAvailable: Entity Framework 6 assembly was resolved to "[file nativename [file join [getBuildDirectory true] EntityFramework.dll]]".
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.EF6.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.Linq.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.5.1", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.5.1\AssemblyFoldersEx", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework\v4.5.1\AssemblyFoldersEx", subKeyName = "System.Data.SQLite"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.0.30319", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework", name = "InstallRoot", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.RemoveDbProviderFactory: addElement = <null>, removeElement = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\12.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\12.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0", subKeyName = "Packages", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\Packages", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0", subKeyName = "Menus", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\Menus", name = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0", subKeyName = "Services", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\Services", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\12.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\12.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0", subKeyName = "DataSources", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\DataSources", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\12.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\12.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0", subKeyName = "DataProviders", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0\DataProviders", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\12.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\12.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.RemoveVsDevEnvSetup: Preparing to run Visual Studio v12.0 'setup' mode to refresh its configuration.
Installer.exe: #[getLineNumber]: Installer.AddVsDevEnvSetup: fileName = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 12.0} Common7 IDE devenv.exe]]", arguments = "/setup", workingDirectory = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 12.0} Common7 IDE]]\", useShellExecute = False, redirectStandardOutput = True, redirectStandardError = True
Installer.exe: #[getLineNumber]: Installer.Main: subKeysCreated = 0, subKeysDeleted = 5, keyValuesRead = 5, keyValuesWritten = 0, keyValuesDeleted = 1
Installer.exe: #[getLineNumber]: Installer.Main: filesCreated = 1, filesModified = 1, filesDeleted = 0
Installer.exe: #[getLineNumber]: RegistryHelper.WriteOperationList: Operation log file name not set.
Installer.exe: #[getLineNumber]: Installer.Main: Success.

Added Tests/data/Uninstaller_Test_Vs2015.log.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Installer.exe: #[getLineNumber]: Configuration.Process: No actual changes will be made to this system because "what-if" mode is enabled.
Installer.exe: #[getLineNumber]: Configuration.IsSystemEf6AssemblyAvailable: Entity Framework 6 assembly was resolved to "[file nativename [file join [getBuildDirectory true] EntityFramework.dll]]".
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] SQLite.Designer.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.EF6.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.Linq.dll]]"
Installer.exe: #[getLineNumber]: Installer.Main: GacRemove: assemblyPath = "[file nativename [file join [getBuildDirectory true] System.Data.SQLite.dll]]"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.6", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework\v4.0.30319", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\.NETFramework", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\.NETFramework", name = "InstallRoot", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.RemoveDbProviderFactory: addElement = <null>, removeElement = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\14.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\14.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0", subKeyName = "Packages", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\Packages", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0", subKeyName = "Menus", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\Menus", name = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9c}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0", subKeyName = "Services", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\Services", subKeyName = "{dcbe6c8d-0e57-4099-a183-98ff74c64d9d}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\14.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\14.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0", subKeyName = "DataSources", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\DataSources", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c71}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\14.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\14.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0", subKeyName = "DataProviders", writable = True
Installer.exe: #[getLineNumber]: RegistryHelper.DeleteSubKeyTree: rootKey = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0\DataProviders", subKeyName = "{0ebaab6e-ca80-4b4a-8ddf-cbe6bf058c70}"
Installer.exe: #[getLineNumber]: RegistryHelper.OpenSubKey: rootKey = "HKEY_LOCAL_MACHINE", subKeyName = "Software${wow64}\Microsoft\VisualStudio\14.0", writable = False
Installer.exe: #[getLineNumber]: RegistryHelper.GetValue: key = "HKEY_LOCAL_MACHINE\Software${wow64}\Microsoft\VisualStudio\14.0", name = "InstallDir", defaultValue = <null>
Installer.exe: #[getLineNumber]: Installer.RemoveVsDevEnvSetup: Preparing to run Visual Studio v14.0 'setup' mode to refresh its configuration.
Installer.exe: #[getLineNumber]: Installer.AddVsDevEnvSetup: fileName = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 14.0} Common7 IDE devenv.exe]]", arguments = "/setup", workingDirectory = "[file nativename [file join [expr {$is64 ? ${::env(ProgramFiles(x86))} : $::env(ProgramFiles)}] {Microsoft Visual Studio 14.0} Common7 IDE]]\", useShellExecute = False, redirectStandardOutput = True, redirectStandardError = True
Installer.exe: #[getLineNumber]: Installer.Main: subKeysCreated = 0, subKeysDeleted = 4, keyValuesRead = 5, keyValuesWritten = 0, keyValuesDeleted = 1
Installer.exe: #[getLineNumber]: Installer.Main: filesCreated = 1, filesModified = 1, filesDeleted = 0
Installer.exe: #[getLineNumber]: RegistryHelper.WriteOperationList: Operation log file name not set.
Installer.exe: #[getLineNumber]: Installer.Main: Success.

Added Tests/data/nonWal.db.

cannot compute difference between binary files

Added Tests/data/testlinq.out.

























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
WX3 6FW
87110
8010
8010
24100
4980
05487-020
50739
59000
1010
T2F 8M4
T2F 8M4
90110
31000
05442-030
97827
90110
1734
01307
1204
08737-363
02389-673
10100
04876-786
H1J 1C3
31000
8022
5020
42100

8010
T2F 8M4
82520
1756
S-844 67
WX1 6LT
67000
90110
44087
H1J 1C3
83720
99508
8010
42100
S-958 22
S-958 22
44087
02389-890
1010
67000
69004
01307
83720
CO7 6JX
31000
90110
14776
14776
B-6000
69004
S-844 67
3508
WX1 6LT
B-6000
1675
8200
05432-043
24100
14776
98124
13008
EC2 5NT
OX15 4NB
PO31 7PJ
05033
B-6000
5022
1756
69004
87110
59000
02389-890
99362
98124
EC2 5NT
4980
5022
05487-020
80805
5020
5022
1675
T2F 8M4
31000
05432-043
V3F 2K1
05634-030
60528
5022
3508
31000
68306
05033

98124
H1J 1C3
14776
05023
50739
68306
83720
13008
05442-030
70563
8010
01307

SW7 1RZ
05033
3012
4110
1010
60528
OX15 4NB
S-958 22
13008
90110
01307
97403
B-1180
5020
1010
WX3 6FW
S-844 67
60528
05023
60528
1204
EC2 5NT
EC2 5NT
01307
05454-876
14776
3508
97219
99362
69004
OX15 4NB
44087
01307
41101
1675
5022
90110
50739
83720
1734
60528
CO7 6JX
67000
80805
S-844 67
42100
02389-890
87110
H1J 1C3
67000

8022
87110
H1J 1C3
8010
S-958 22
05023
98034
04179
05033
98034
EC2 5NT
94117
50739
05442-030
68306
90110
67000
08737-363
42100
02389-673
01307
97403
H1J 1C3
8200
60528
60528
99508
8010
98124
5020
87110
EC2 5NT
97827
5022
8200
83720
1675
H1J 1C3
05634-030
83720
44087
44000
31000
01-012
83720
5022
68306
21240
97403
97403
H1J 1C3
H1J 1C3
V3F 2K1
PO31 7PJ
02389-890
80805
59801
05021
S-958 22
83720
67000
41101
14776
31000
70563
8010
59000
24100
90110
05487-020
4980
4110
70563
5022
1734
12209
08737-363
05454-876

02389-673
02389-890
B-1180
05442-030
70563
04876-786
80805
S-958 22
42100
97403
83720
01307
05487-020
97827

97219
13008
1675
97219
1204
8010
70563
1734
80805
44000
S-958 22
21240
PO31 7PJ
80805
05033
05023
83720
67000
99508
97403
05023
44000
50739
04876-786
5020

8200
S-958 22
05454-876
01307
12209
98124
01307
21240
98124
4980
8010
04179
83720

12209
S-844 67
05487-020
5022
99508
CO7 6JX
97201
04876-786
10100
83720

83720
83720
13008
1010
80805
14776
94117
02389-673
01307
83720
98124
H1J 1C3
05442-030
WX3 6FW
42100
05487-020
4980
13008
3012
13008
S-958 22
04876-786
94117

51100
75016
51100
98124
CO7 6JX
T2F 8M4
CO7 6JX
8200
01307
3012
5020
83720
PO31 7PJ
90110
1204
SW7 1RZ
10100
24100
13008
82520
83720
1204
05021
B-1180
87110
S-844 67
59000
8010
01307
50739
B-6000
CO7 6JX
8200
05454-876
8010
60528
8010
S-844 67
59801
8010
04876-786
S-958 22
04179
3508
90110
1010
05454-876
24100
1081
05487-020
31000
01307
59000
04876-786
80805
01-012
CO7 6JX
02389-673
8010
5022
52066
PO31 7PJ
14776
OX15 4NB
28023
1734
08737-363
OX15 4NB
97201
69004
10100
Around the Horn
B's Beverages
Consolidated Holdings
Eastern Connection
North/South
Seven Seas Imports
Around the Horn
7/4/1996 12:00:00 AM
7/5/1996 12:00:00 AM
7/8/1996 12:00:00 AM
7/8/1996 12:00:00 AM
7/9/1996 12:00:00 AM
7/10/1996 12:00:00 AM
7/11/1996 12:00:00 AM
7/12/1996 12:00:00 AM
7/15/1996 12:00:00 AM
7/16/1996 12:00:00 AM
7/17/1996 12:00:00 AM
7/18/1996 12:00:00 AM
7/19/1996 12:00:00 AM
7/19/1996 12:00:00 AM
7/22/1996 12:00:00 AM
7/23/1996 12:00:00 AM
7/24/1996 12:00:00 AM
7/25/1996 12:00:00 AM
7/26/1996 12:00:00 AM
7/29/1996 12:00:00 AM
7/30/1996 12:00:00 AM
7/31/1996 12:00:00 AM
8/1/1996 12:00:00 AM
8/1/1996 12:00:00 AM
8/2/1996 12:00:00 AM
8/5/1996 12:00:00 AM
8/6/1996 12:00:00 AM
8/7/1996 12:00:00 AM
8/8/1996 12:00:00 AM
8/9/1996 12:00:00 AM
8/12/1996 12:00:00 AM
8/13/1996 12:00:00 AM
8/14/1996 12:00:00 AM
8/14/1996 12:00:00 AM
8/15/1996 12:00:00 AM
8/16/1996 12:00:00 AM
8/19/1996 12:00:00 AM
8/20/1996 12:00:00 AM
8/21/1996 12:00:00 AM
8/22/1996 12:00:00 AM
8/23/1996 12:00:00 AM
8/26/1996 12:00:00 AM
8/27/1996 12:00:00 AM
8/27/1996 12:00:00 AM
8/28/1996 12:00:00 AM
8/29/1996 12:00:00 AM
8/30/1996 12:00:00 AM
9/2/1996 12:00:00 AM
9/3/1996 12:00:00 AM
9/4/1996 12:00:00 AM
9/5/1996 12:00:00 AM
9/6/1996 12:00:00 AM
9/9/1996 12:00:00 AM
9/9/1996 12:00:00 AM
9/10/1996 12:00:00 AM
9/11/1996 12:00:00 AM
9/12/1996 12:00:00 AM
9/13/1996 12:00:00 AM
9/16/1996 12:00:00 AM
9/17/1996 12:00:00 AM
9/18/1996 12:00:00 AM
9/19/1996 12:00:00 AM
9/20/1996 12:00:00 AM
9/20/1996 12:00:00 AM
9/23/1996 12:00:00 AM
9/24/1996 12:00:00 AM
9/25/1996 12:00:00 AM
9/26/1996 12:00:00 AM
9/27/1996 12:00:00 AM
9/30/1996 12:00:00 AM
10/1/1996 12:00:00 AM
10/2/1996 12:00:00 AM
10/3/1996 12:00:00 AM
10/3/1996 12:00:00 AM
10/4/1996 12:00:00 AM
10/7/1996 12:00:00 AM
10/8/1996 12:00:00 AM
10/9/1996 12:00:00 AM
10/10/1996 12:00:00 AM
10/11/1996 12:00:00 AM
10/14/1996 12:00:00 AM
10/15/1996 12:00:00 AM
10/16/1996 12:00:00 AM
10/16/1996 12:00:00 AM
10/17/1996 12:00:00 AM
10/18/1996 12:00:00 AM
10/21/1996 12:00:00 AM
10/22/1996 12:00:00 AM
10/23/1996 12:00:00 AM
10/24/1996 12:00:00 AM
10/25/1996 12:00:00 AM
10/28/1996 12:00:00 AM
10/29/1996 12:00:00 AM
10/29/1996 12:00:00 AM
10/30/1996 12:00:00 AM
10/31/1996 12:00:00 AM
11/1/1996 12:00:00 AM
11/4/1996 12:00:00 AM
11/5/1996 12:00:00 AM
11/6/1996 12:00:00 AM
11/7/1996 12:00:00 AM
11/8/1996 12:00:00 AM
11/11/1996 12:00:00 AM
11/11/1996 12:00:00 AM
11/12/1996 12:00:00 AM
11/13/1996 12:00:00 AM
11/14/1996 12:00:00 AM
11/15/1996 12:00:00 AM
11/18/1996 12:00:00 AM
11/19/1996 12:00:00 AM
11/20/1996 12:00:00 AM
11/21/1996 12:00:00 AM
11/22/1996 12:00:00 AM
11/22/1996 12:00:00 AM
11/25/1996 12:00:00 AM
11/26/1996 12:00:00 AM
11/26/1996 12:00:00 AM
11/27/1996 12:00:00 AM
11/28/1996 12:00:00 AM
11/28/1996 12:00:00 AM
11/29/1996 12:00:00 AM
12/2/1996 12:00:00 AM
12/3/1996 12:00:00 AM
12/3/1996 12:00:00 AM
12/4/1996 12:00:00 AM
12/5/1996 12:00:00 AM
12/5/1996 12:00:00 AM
12/6/1996 12:00:00 AM
12/9/1996 12:00:00 AM
12/9/1996 12:00:00 AM
12/10/1996 12:00:00 AM
12/11/1996 12:00:00 AM
12/12/1996 12:00:00 AM
12/12/1996 12:00:00 AM
12/13/1996 12:00:00 AM
12/16/1996 12:00:00 AM
12/16/1996 12:00:00 AM
12/17/1996 12:00:00 AM
12/18/1996 12:00:00 AM
12/18/1996 12:00:00 AM
12/19/1996 12:00:00 AM
12/20/1996 12:00:00 AM
12/23/1996 12:00:00 AM
12/23/1996 12:00:00 AM
12/24/1996 12:00:00 AM
12/25/1996 12:00:00 AM
12/25/1996 12:00:00 AM
12/26/1996 12:00:00 AM
12/27/1996 12:00:00 AM
12/27/1996 12:00:00 AM
12/30/1996 12:00:00 AM
12/31/1996 12:00:00 AM
26
26.78
70.29
9.8
41.89
24.39
257.26
18.44
13.55
27.36
145.04
55.92
299.09
69.19
65.06
176.48
27.2
65.53
Alfreds Futterkiste
Ana Trujillo Emparedados y helados
Antonio Moreno Taquería
Around the Horn
Berglunds snabbköp
Blauer See Delikatessen
Blondesddsl père et fils
Bólido Comidas preparadas
Bon app'
Bottom-Dollar Markets
B's Beverages
Cactus Comidas para llevar
Chop-suey Chinese
Comércio Mineiro
Consolidated Holdings
Drachenblut Delikatessen
Du monde entier
Eastern Connection
Ernst Handel
Familia Arquibaldo
Folies gourmandes
Folk och fä HB
Frankenversand
France restauration
Franchi S.p.A.
Furia Bacalhau e Frutos do Mar
Galería del gastrónomo
Godos Cocina Típica
Gourmet Lanchonetes
Great Lakes Food Market
GROSELLA-Restaurante
Hanari Carnes
HILARION-Abastos
Hungry Coyote Import Store
Hungry Owl All-Night Grocers
Island Trading
Königlich Essen
La maison d'Asie
Laughing Bacchus Wine Cellars
Lazy K Kountry Store
Lehmanns Marktstand
Let's Stop N Shop
LILA-Supermercado
LINO-Delicateses
Lonesome Pine Restaurant
Magazzini Alimentari Riuniti
Maison Dewey
Mère Paillarde
Morgenstern Gesundkost
North/South
Océano Atlántico Ltda.
Old World Delicatessen
Ottilies Käseladen
Pericles Comidas clásicas
Piccolo und mehr
Princesa Isabel Vinhos
Que Delícia
Queen Cozinha
QUICK-Stop
Rancho grande
Rattlesnake Canyon Grocery
Reggiani Caseifici
Ricardo Adocicados
Richter Supermarkt
Santé Gourmet
Save-a-lot Markets
Seven Seas Imports
Simons bistro
Spécialités du monde
Split Rail Beer & Ale
Suprêmes délices
The Big Cheese
The Cracker Box
Toms Spezialitäten
Tortuga Restaurante
Tradição Hipermercados
Trail's Head Gourmet Provisioners
Vaffeljernet
Victuailles en stock
Vins et alcools Chevalier
Die Wandernde Kuh
Wartian Herkku
Wellington Importadora
White Clover Markets
Wilman Kala
87110
8010
8010
24100
4980
05487-020
50739
59000
1010
T2F 8M4
T2F 8M4
90110
31000
05442-030
97827
90110
1734
01307
1204
08737-363
02389-673
10100
04876-786
H1J 1C3
31000
8022
5020
42100

8010
T2F 8M4
82520
1756
S-844 67
67000
90110
44087
H1J 1C3
83720
99508
8010
42100
S-958 22
S-958 22
44087
02389-890
1010
67000
69004
01307
83720
31000
90110
14776
14776
B-6000
69004
S-844 67
3508
B-6000
1675
8200
05432-043
24100
14776
98124
13008
B-6000
5022
1756
69004
87110
59000
02389-890
99362
98124
4980
5022
05487-020
80805
5020
5022
1675
T2F 8M4
31000
05432-043
V3F 2K1
05634-030
60528
5022
3508
31000
68306

98124
H1J 1C3
14776
50739
68306
83720
13008
05442-030
70563
8010
01307

3012
4110
1010
60528
S-958 22
13008
90110
01307
97403
B-1180
5020
1010
S-844 67
60528
60528
1204
01307
05454-876
14776
3508
97219
99362
69004
44087
01307
41101
1675
5022
90110
50739
83720
1734
60528
67000
80805
S-844 67
42100
02389-890
87110
H1J 1C3
67000

8022
87110
H1J 1C3
8010
S-958 22
98034
04179
98034
94117
50739
05442-030
68306
90110
67000
08737-363
42100
02389-673
01307
97403
H1J 1C3
8200
60528
60528
99508
8010
98124
5020
87110
97827
5022
8200
83720
1675
H1J 1C3
05634-030
83720
44087
44000
31000
83720
5022
68306
21240
97403
97403
H1J 1C3
H1J 1C3
V3F 2K1
02389-890
80805
59801
S-958 22
83720
67000
41101
14776
31000
70563
8010
59000
24100
90110
05487-020
4980
4110
70563
5022
1734
12209
08737-363
05454-876

02389-673
02389-890
B-1180
05442-030
70563
04876-786
80805
S-958 22
42100
97403
83720
01307
05487-020
97827

97219
13008
1675
97219
1204
8010
70563
1734
80805
44000
S-958 22
21240
80805
83720
67000
99508
97403
44000
50739
04876-786
5020

8200
S-958 22
05454-876
01307
12209
98124
01307
21240
98124
4980
8010
04179
83720

12209
S-844 67
05487-020
5022
99508
97201
04876-786
10100
83720

83720
83720
13008
1010
80805
14776
94117
02389-673
01307
83720
98124
H1J 1C3
05442-030
42100
05487-020
4980
13008
3012
13008
S-958 22
04876-786
94117

51100
75016
51100
98124
T2F 8M4
8200
01307
3012
5020
83720
90110
1204
10100
24100
13008
82520
83720
1204
B-1180
87110
S-844 67
59000
8010
01307
50739
B-6000
8200
05454-876
8010
60528
8010
S-844 67
59801
8010
04876-786
S-958 22
04179
3508
90110
1010
05454-876
24100
1081
05487-020
31000
01307
59000
04876-786
80805
02389-673
8010
5022
52066
14776
28023
1734
08737-363
97201
69004
10100
51100
44087
05454-876
69004
B-6000
05454-876
3012
1204
08737-363
5022
8010
05022
50739
02389-673
87110
8010
S-844 67
67000
90110
80805
1081
98124
90110
82520
87110
01307
51100
24100
05033
04179
S-958 22
60528
S-958 22
28001
28001
3508
60528
01307
01307
02389-890
42100
EC2 5NT
05432-043
02389-673
05634-030
05033
87110
51100
3508
67000

02389-890
24100
70563
B-6000
41101
05033
99508
28001
97219
05021

97201
44000
70563
01307
87110
PO31 7PJ
87110
97219
PO31 7PJ
05033
90110
PO31 7PJ
05033
14776
83720
14776
28023
S-844 67
1675
82520
3508
13008
H1J 1C3
90110
69004

1756
80805
99508
H1J 1C3
13008
1734
80805
60528
98124
01307
87110
05442-030
70563
82520
31000
8010
1675
5020
05033
CO7 6JX
70563
3508
31000
OX15 4NB
67000
01307
13008
52066
WX3 6FW
05023
8022
8200
8010
82520
3012
31000
05487-020

01-012
97827
H1J 1C3
OX15 4NB
S-844 67
02389-673

3508
8010
CO7 6JX
S-958 22
82520
05442-030
4110
OX15 4NB
T2F 8M4
8010
52066
5020
83720
97827
5022
80805
1756
83720
8200
WX3 6FW
87110
8010
8010
24100
4980
05487-020
50739
59000
1010
T2F 8M4
T2F 8M4
90110
31000
05442-030
97827
90110
1734
01307
1204
08737-363
02389-673
10100
04876-786
H1J 1C3
31000
8022
5020
42100

8010
T2F 8M4
82520
1756
S-844 67
WX1 6LT
67000
90110
44087
H1J 1C3
83720
99508
8010
42100
S-958 22
S-958 22
44087
02389-890
1010
67000
69004
01307
83720
CO7 6JX
31000
90110
14776
14776
B-6000
69004
S-844 67
3508
WX1 6LT
B-6000
1675
8200
05432-043
24100
14776
98124
13008
EC2 5NT
OX15 4NB
PO31 7PJ
05033
B-6000
5022
1756
69004
87110
59000
02389-890
99362
98124
EC2 5NT
4980
5022
05487-020
80805
5020
5022
1675
T2F 8M4
31000
05432-043
V3F 2K1
05634-030
60528
5022
3508
31000
68306
05033

98124
H1J 1C3
14776
05023
50739
68306
83720
13008
05442-030
70563
8010
01307

SW7 1RZ
05033
3012
4110
1010
60528
OX15 4NB
S-958 22
13008
90110
01307
97403
B-1180
5020
1010
WX3 6FW
S-844 67
60528
05023
60528
1204
EC2 5NT
EC2 5NT
01307
05454-876
14776
3508
97219
99362
69004
OX15 4NB
44087
01307
41101
1675
5022
90110
50739
83720
1734
60528
CO7 6JX
67000
80805
S-844 67
42100
02389-890
87110
H1J 1C3
67000

8022
87110
H1J 1C3
8010
S-958 22
05023
98034
04179
05033
98034
EC2 5NT
94117
50739
05442-030
68306
90110
67000
08737-363
42100
02389-673
01307
97403
H1J 1C3
8200
60528
60528
99508
8010
98124
5020
87110
EC2 5NT
97827
5022
8200
83720
1675
H1J 1C3
05634-030
83720
44087
44000
31000
01-012
83720
5022
68306
21240
97403
97403
H1J 1C3
H1J 1C3
V3F 2K1
PO31 7PJ
02389-890
80805
59801
05021
S-958 22
83720
67000
41101
14776
31000
70563
8010
59000
24100
90110
05487-020
4980
4110
70563
5022
1734
12209
08737-363
05454-876

02389-673
02389-890
B-1180
05442-030
70563
04876-786
80805
S-958 22
42100
97403
83720
01307
05487-020
97827

97219
13008
1675
97219
1204
8010
70563
1734
80805
44000
S-958 22
21240
PO31 7PJ
80805
05033
05023
83720
67000
99508
97403
05023
44000
50739
04876-786
5020

8200
S-958 22
05454-876
01307
12209
98124
01307
21240
98124
4980
8010
04179
83720

12209
S-844 67
05487-020
5022
99508
CO7 6JX
97201
04876-786
10100
83720

83720
83720
13008
1010
80805
14776
94117
02389-673
01307
83720
98124
H1J 1C3
05442-030
WX3 6FW
42100
05487-020
4980
13008
3012
13008
S-958 22
04876-786
94117

51100
75016
51100
98124
CO7 6JX
T2F 8M4
CO7 6JX
8200
01307
3012
5020
83720
PO31 7PJ
90110
1204
SW7 1RZ
10100
24100
13008
82520
83720
1204
05021
B-1180
87110
S-844 67
59000
8010
01307
50739
B-6000
CO7 6JX
8200
05454-876
8010
60528
8010
S-844 67
59801
8010
04876-786
S-958 22
04179
3508
90110
1010
05454-876
24100
1081
05487-020
31000
01307
59000
04876-786
80805
01-012
CO7 6JX
02389-673
8010
5022
52066
PO31 7PJ
14776
OX15 4NB
28023
1734
08737-363
OX15 4NB
97201
69004
10100
99508
08737-363
V3F 2K1
4980
42100
02389-890
69004
83720
97403
14776
24100
1010
87110
82520
98034
3508
S-844 67
52066
67000
13008
1010
PO31 7PJ
05634-030
4110
31000
50739
05634-030
12209
8010
S-958 22
4980
05634-030
4980
B-6000
05033
69004
5020
01307
B-6000
83720
WX1 6LT
14776
69004
02389-890
87110
68306
8010
99508
05023
S-958 22
78000
80805
44000
98124
60528
5022
CO7 6JX
01307
S-958 22
97219
05487-020
OX15 4NB
01-012
13008
41101
21240
41101
S-958 22
13008
02389-890
01307
21240
S-844 67
1010
83720
97219
94117
B-6000
05454-876
8022
41101
87110
44000
60528
B-1180
14776
83720
8010
B-1180

1010
3508
08737-363
5022
S-844 67
05454-876
98124
08737-363
01-012
75016
42100
4110
21240
41101

05487-020
05487-020
05033
1010
28001
T2F 8M4
4980
CO7 6JX
8200
05454-876
31000
S-958 22
05454-876
05021
78000
8022
80805
B-6000
1204
13008
PO31 7PJ
60528
08737-363
97403
1010
01307
24100
13008
83720
42100
EC2 5NT
T2F 8M4
04179
8200
EC2 5NT
41101
T2F 8M4
24100
1204
12209
CO7 6JX
4980
S-844 67
68306
5022
1010
04876-786
5022
05487-020
01307
1675
75016
99508
3012
44087
8010
05432-043
28023
44000
78000
78000
82520
T2F 8M4
5022
S-844 67
B-1180
8010
S-844 67
05454-876
T2F 8M4
83720
83720

1010
WX3 6FW
87110
02389-673
8010
01307
97201
S-844 67
8200
05033
01307
3508
01-012
50739
87110
S-844 67
83720
59801
B-1180
21240
97403
1756
8010
41101
42100
12209
80805
28001
4980
4110
CO7 6JX
8010
97219
1010
50739
01307
05454-876
EC2 5NT
WX3 6FW
90110
10100
T2F 8M4
14776
3012
83720
83720
98124
1204
99508
B-6000
52066
41101
B-6000
4980
97403
3012
05432-043
75016
01-012
T2F 8M4
70563
WX3 6FW
T2F 8M4
04876-786
S-844 67
31000
05454-876
5020
1010
5022
WX3 6FW
SW7 1RZ
68306
02389-890
10100
97403
42100

83720
3508
98124
52066
05487-020
05033
60528
3508
8010
05033
1734
1204
13008
87110
Chai
Chang
Chef Anton's Cajun Seasoning
Chef Anton's Gumbo Mix
Uncle Bob's Organic Dried Pears
Guaraná Fantástica
Gumbär Gummibärchen
Rössle Sauerkraut
Thüringer Rostbratwurst
Nord-Ost Matjeshering
Sasquatch Ale
Steeleye Stout
Boston Crab Meat
Jack's New England Clam Chowder
Tarte au sucre
Wimmers gute Semmelknödel
Louisiana Fiery Hot Pepper Sauce
Röd Kaviar
Rhönbräu Klosterbier
Original Frankfurter grüne Soße

Added Tests/data/wal.db.

cannot compute difference between binary files

Added Tests/function.eagle.

















































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
###############################################################################
#
# function.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test function-1.1 {custom window function} -setup {
  set fileName function-1.1.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      internal sealed class Test${id}Context
      {
        public long Sum;
      }

      /////////////////////////////////////////////////////////////////////////

      \[SQLiteFunction(Name = "sumint", FuncType = FunctionType.Window)\]
      public class Test${id} : SQLiteFunction
      {
        public override void Step(
          object\[\] args,
          int stepNumber,
          ref object contextData
          )
        {
          if (args == null)
            throw new ArgumentException("missing arguments");

          if (args.Length != 1)
            throw new ArgumentException(String.Format(
              "need exactly one argument, got {0}", args.Length));

          object arg = args\[0\];

          if (arg == null)
            return;

          Type type = arg.GetType();

          if (type == typeof(DBNull))
            return;

          if (type != typeof(long))
            throw new ArgumentException(String.Format(
              "argument must be integer, got {0}", type));

          Test${id}Context context = contextData as Test${id}Context;

          if (context == null)
          {
            context = new Test${id}Context();
            contextData = context;
          }

          context.Sum += (long)arg;
        }

        ///////////////////////////////////////////////////////////////////////

        public override object Final(
          object contextData
          )
        {
          Test${id}Context context = contextData as Test${id}Context;

          if (context == null)
            return DBNull.Value;

          return context.Sum;
        }

        ///////////////////////////////////////////////////////////////////////

        public override object Value(
          object contextData
          )
        {
          Test${id}Context context = contextData as Test${id}Context;

          if (context == null)
            return DBNull.Value;

          return context.Sum;
        }

        ///////////////////////////////////////////////////////////////////////

        public override void Inverse(
          object\[\] args,
          int stepNumber,
          ref object contextData
          )
        {
          if (args == null)
            throw new ArgumentException("missing arguments");

          if (args.Length != 1)
            throw new ArgumentException(String.Format(
              "need exactly one argument, got {0}", args.Length));

          object arg = args\[0\];

          if (arg == null)
            return;

          Type type = arg.GetType();

          if (type == typeof(DBNull))
            return;

          if (type != typeof(long))
            throw new ArgumentException(String.Format(
              "argument must be integer, got {0}", type));

          Test${id}Context context = contextData as Test${id}Context;

          if (context == null)
          {
            context = new Test${id}Context();
            contextData = context;
          }

          context.Sum -= (long)arg;
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          SQLiteFunction.RegisterFunction(typeof(Test${id}));
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  #
  # NOTE: Compile the C# code (above) to register the custom SQLite function
  #       and then open the database for this test case and attempt to execute
  #       the function.  Normally, we would open the database in the test setup
  #       phase; however, that will not work correctly because newly registered
  #       functions are only picked up and used by databases opened after they
  #       have been registered.
  #
  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result [setupDb $fileName] \
      [sql execute $db {
        CREATE TABLE t3(x, y);
        INSERT INTO t3 VALUES('a', 4),
                             ('b', 5),
                             ('c', 3),
                             ('d', 8),
                             ('e', 1);
      }] [sql execute -execute reader -format list $db {
        SELECT x, sumint(y) OVER (
          ORDER BY x ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING
        ) AS sum_y
        FROM t3 ORDER BY x;
      }]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result \
{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}\
System#Data#SQLite#SQLiteConnection#\d+ 5 \{a 9 b 12 c 16 d 12 e 9\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/installer.eagle.













































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
###############################################################################
#
# installer.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue
runSQLiteTestFilesPrologue

###############################################################################

proc getLineNumber {} {
  return [incr ::lineNumber]
}

###############################################################################

runTest {test installer-1.1 {installer tool / Visual Studio 2005} -setup {
  set fileName [file join [getTemporaryDirectory] [file tail [string map \
      [list .log [appendArgs _ [pid] .log]] $testInstallVs2005LogFile]]]

  cleanupFile $fileName
} -body {
  set output ""

  set code [catch {
    testClrExec $installerExeFile [list -eventflags Wait -stdout output \
        -success Success] -debugPriority Lowest -tracePriority MediumHigh \
        -noRuntimeVersion true -noCompact true -noNetFx35 true \
        -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true \
        -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true \
        -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2008 true \
        -noVs2010 true -noVs2012 true -noVs2013 true -noVs2015 true \
        -noVs2017 true -whatIf true -verbose true -confirm true \
        -install true -debug true -wow64 true -directory \
        [file nativename [getBuildDirectory true]] \
        -logFileName [appendArgs \" [file nativename $fileName] \"] \
        -traceFormat [appendArgs \" "#{0}: {2}" \"]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  set lineNumber 0
  set is64 [haveConstraint amd64.64bit]
  set wow64 [expr {$is64 ? "\\Wow6432Node" : ""}]

  list $code [expr {$code == 0 ? [string equal -nocase [readFile $fileName] \
      [subst -nobackslashes [readFile $testInstallVs2005LogFile]]] : $error}]
} -cleanup {
  cleanupFile $fileName
  catch {info previouspid true}

  unset -nocomplain wow64 is64 lineNumber code output error fileName
} -constraints [fixConstraints {eagle administrator !wow64 buildYear.2005\
visualStudio2005 System.Data.SQLite.dll_v2.0.50727 file_Installer.exe testExec\
file_System.Data.SQLite.dll file_SQLite.Designer.dll\
file_Installer_Test_Vs2005.log}] -result {0 True}}

###############################################################################

runTest {test installer-1.2 {uninstaller tool / Visual Studio 2005} -setup {
  set fileName [file join [getTemporaryDirectory] [file tail [string map \
      [list .log [appendArgs _ [pid] .log]] $testUninstallVs2005LogFile]]]

  cleanupFile $fileName
} -body {
  set output ""

  set code [catch {
    testClrExec $installerExeFile [list -eventflags Wait -stdout output \
        -success Success] -debugPriority Lowest -tracePriority MediumHigh \
        -noRuntimeVersion true -noCompact true -noNetFx35 true \
        -noNetFx40 true -noNetFx45 true -noNetFx451 true -noNetFx452 true \
        -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true \
        -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2008 true \
        -noVs2010 true -noVs2012 true -noVs2013 true -noVs2015 true \
        -noVs2017 true -whatIf true -verbose true -confirm true \
        -install false -debug true -wow64 true -directory \
        [file nativename [getBuildDirectory true]] \
        -logFileName [appendArgs \" [file nativename $fileName] \"] \
        -traceFormat [appendArgs \" "#{0}: {2}" \"]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  set lineNumber 0
  set is64 [haveConstraint amd64.64bit]
  set wow64 [expr {$is64 ? "\\Wow6432Node" : ""}]

  list $code [expr {$code == 0 ? [string equal -nocase [readFile $fileName] \
      [subst -nobackslashes [readFile $testUninstallVs2005LogFile]]] : $error}]
} -cleanup {
  cleanupFile $fileName
  catch {info previouspid true}

  unset -nocomplain wow64 is64 lineNumber code output error fileName
} -constraints [fixConstraints {eagle administrator !wow64 buildYear.2005\
visualStudio2005 System.Data.SQLite.dll_v2.0.50727 file_Installer.exe testExec\
file_System.Data.SQLite.dll file_SQLite.Designer.dll\
file_Uninstaller_Test_Vs2005.log}] -result {0 True}}

###############################################################################

runTest {test installer-1.3 {installer tool / Visual Studio 2008} -setup {
  set fileName [file join [getTemporaryDirectory] [file tail [string map \
      [list .log [appendArgs _ [pid] .log]] $testInstallVs2008LogFile]]]

  cleanupFile $fileName
} -body {
  set output ""

  set code [catch {
    testClrExec $installerExeFile [list -eventflags Wait -stdout output \
        -success Success] -debugPriority Lowest -tracePriority MediumHigh \
        -noRuntimeVersion true -noCompact true -noNetFx40 true \
        -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true \
        -noNetFx461 true -noNetFx462 true -noNetFx47 true -noNetFx471 true \
        -noNetFx472 true -noNetFx48 true -noVs2005 true -noVs2010 true \
        -noVs2012 true -noVs2013 true -noVs2015 true -noVs2017 true \
        -whatIf true -verbose true -confirm true -install true -debug true \
        -wow64 true -directory [file nativename [getBuildDirectory true]] \
        -logFileName [appendArgs \" [file nativename $fileName] \"] \
        -traceFormat [appendArgs \" "#{0}: {2}" \"]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  set lineNumber 0
  set is64 [haveConstraint amd64.64bit]
  set wow64 [expr {$is64 ? "\\Wow6432Node" : ""}]

  list $code [expr {$code == 0 ? [string equal -nocase [readFile $fileName] \
      [subst -nobackslashes [readFile $testInstallVs2008LogFile]]] : $error}]
} -cleanup {
  cleanupFile $fileName
  catch {info previouspid true}

  unset -nocomplain wow64 is64 lineNumber code output error fileName
} -constraints [fixConstraints {eagle administrator !wow64 buildYear.2008\
visualStudio2008 System.Data.SQLite.dll_v2.0.50727 file_Installer.exe testExec\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll\
file_SQLite.Designer.dll file_Installer_Test_Vs2008.log}] -result {0 True}}

###############################################################################

runTest {test installer-1.4 {uninstaller tool / Visual Studio 2008} -setup {
  set fileName [file join [getTemporaryDirectory] [file tail [string map \
      [list .log [appendArgs _ [pid] .log]] $testUninstallVs2008LogFile]]]

  cleanupFile $fileName
} -body {
  set output ""

  set code [catch {
    testClrExec $installerExeFile [list -eventflags Wait -stdout output \
        -success Success] -debugPriority Lowest -tracePriority MediumHigh \
        -noRuntimeVersion true -noCompact true -noNetFx40 true \
        -noNetFx45 true -noNetFx451 true -noNetFx452 true -noNetFx46 true \
        -noNetFx461 true -noNetFx462 true -noNetFx47 true -noNetFx471 true \
        -noNetFx472 true -noNetFx48 true -noVs2005 true -noVs2010 true \
        -noVs2012 true -noVs2013 true -noVs2015 true -noVs2017 true \
        -whatIf true -verbose true -confirm true -install false -debug true \
        -wow64 true -directory [file nativename [getBuildDirectory true]] \
        -logFileName [appendArgs \" [file nativename $fileName] \"] \
        -traceFormat [appendArgs \" "#{0}: {2}" \"]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  set lineNumber 0
  set is64 [haveConstraint amd64.64bit]
  set wow64 [expr {$is64 ? "\\Wow6432Node" : ""}]

  list $code [expr {$code == 0 ? [string equal -nocase [readFile $fileName] \
      [subst -nobackslashes [readFile $testUninstallVs2008LogFile]]] : $error}]
} -cleanup {
  cleanupFile $fileName
  catch {info previouspid true}

  unset -nocomplain wow64 is64 lineNumber code output error fileName
} -constraints [fixConstraints {eagle administrator !wow64 buildYear.2008\
visualStudio2008 System.Data.SQLite.dll_v2.0.50727 file_Installer.exe testExec\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll\
file_SQLite.Designer.dll file_Uninstaller_Test_Vs2008.log}] -result {0 True}}

###############################################################################

runTest {test installer-1.5 {installer tool / Visual Studio 2010} -setup {
  set fileName [file join [getTemporaryDirectory] [file tail [string map \
      [list .log [appendArgs _ [pid] .log]] $testInstallVs2010LogFile]]]

  cleanupFile $fileName
} -body {
  set output ""

  set code [catch {
    testClrExec $installerExeFile [list -eventflags Wait -stdout output \
        -success Success] -debugPriority Lowest -tracePriority MediumHigh \
        -noRuntimeVersion true -noCompact true -noNetFx20 true \
        -noNetFx35 true -noNetFx45 true -noNetFx451 true -noNetFx452 true \
        -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true \
        -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true \
        -noVs2008 true -noVs2012 true -noVs2013 true -noVs2015 true \
        -noVs2017 true -whatIf true -verbose true -confirm true \
        -install true -debug true -wow64 true -directory \
        [file nativename [getBuildDirectory true]] \
        -logFileName [appendArgs \" [file nativename $fileName] \"] \
        -traceFormat [appendArgs \" "#{0}: {2}" \"]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  set lineNumber 0
  set is64 [haveConstraint amd64.64bit]
  set wow64 [expr {$is64 ? "\\Wow6432Node" : ""}]

  list $code [expr {$code == 0 ? [string equal -nocase [readFile $fileName] \
      [subst -nobackslashes [readFile $testInstallVs2010LogFile]]] : $error}]
} -cleanup {
  cleanupFile $fileName
  catch {info previouspid true}

  unset -nocomplain wow64 is64 lineNumber code output error fileName
} -constraints [fixConstraints {eagle administrator !wow64 buildYear.2010\
visualStudio2010 System.Data.SQLite.dll_v4.0.30319 file_Installer.exe testExec\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll\
file_System.Data.SQLite.EF6.dll file_SQLite.Designer.dll\
file_Installer_Test_Vs2010.log}] -result {0 True}}

###############################################################################

runTest {test installer-1.6 {uninstaller tool / Visual Studio 2010} -setup {
  set fileName [file join [getTemporaryDirectory] [file tail [string map \
      [list .log [appendArgs _ [pid] .log]] $testUninstallVs2010LogFile]]]

  cleanupFile $fileName
} -body {
  set output ""

  set code [catch {
    testClrExec $installerExeFile [list -eventflags Wait -stdout output \
        -success Success] -debugPriority Lowest -tracePriority MediumHigh \
        -noRuntimeVersion true -noCompact true -noNetFx20 true \
        -noNetFx35 true -noNetFx45 true -noNetFx451 true -noNetFx452 true \
        -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true \
        -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true \
        -noVs2008 true -noVs2012 true -noVs2013 true -noVs2015 true \
        -noVs2017 true -whatIf true -verbose true -confirm true \
        -install false -debug true -wow64 true -directory \
        [file nativename [getBuildDirectory true]] \
        -logFileName [appendArgs \" [file nativename $fileName] \"] \
        -traceFormat [appendArgs \" "#{0}: {2}" \"]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  set lineNumber 0
  set is64 [haveConstraint amd64.64bit]
  set wow64 [expr {$is64 ? "\\Wow6432Node" : ""}]

  list $code [expr {$code == 0 ? [string equal -nocase [readFile $fileName] \
      [subst -nobackslashes [readFile $testUninstallVs2010LogFile]]] : $error}]
} -cleanup {
  cleanupFile $fileName
  catch {info previouspid true}

  unset -nocomplain wow64 is64 lineNumber code output error fileName
} -constraints [fixConstraints {eagle administrator !wow64 buildYear.2010\
visualStudio2010 System.Data.SQLite.dll_v4.0.30319 file_Installer.exe testExec\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll\
file_System.Data.SQLite.EF6.dll file_SQLite.Designer.dll\
file_Uninstaller_Test_Vs2010.log}] -result {0 True}}

###############################################################################

runTest {test installer-1.7 {installer tool / Visual Studio 2012} -setup {
  set fileName [file join [getTemporaryDirectory] [file tail [string map \
      [list .log [appendArgs _ [pid] .log]] $testInstallVs2012LogFile]]]

  cleanupFile $fileName
} -body {
  set output ""

  set code [catch {
    testClrExec $installerExeFile [list -eventflags Wait -stdout output \
        -success Success] -debugPriority Lowest -tracePriority MediumHigh \
        -noRuntimeVersion true -noCompact true -noNetFx20 true \
        -noNetFx35 true -noNetFx40 true -noNetFx451 true -noNetFx452 true \
        -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true \
        -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true \
        -noVs2008 true -noVs2010 true -noVs2013 true -noVs2015 true \
        -noVs2017 true -whatIf true -verbose true -confirm true \
        -install true -debug true -wow64 true -configVersion 4.0.30319 \
        -directory [file nativename [getBuildDirectory true]] \
        -logFileName [appendArgs \" [file nativename $fileName] \"] \
        -traceFormat [appendArgs \" "#{0}: {2}" \"]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  set lineNumber 0
  set is64 [haveConstraint amd64.64bit]
  set wow64 [expr {$is64 ? "\\Wow6432Node" : ""}]

  list $code [expr {$code == 0 ? [string equal -nocase [readFile $fileName] \
      [subst -nobackslashes [readFile $testInstallVs2012LogFile]]] : $error}]
} -cleanup {
  cleanupFile $fileName
  catch {info previouspid true}

  unset -nocomplain wow64 is64 lineNumber code output error fileName
} -constraints [fixConstraints {eagle administrator !wow64 buildYear.2012\
visualStudio2012 System.Data.SQLite.dll_v4.0.30319 file_Installer.exe testExec\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll\
file_System.Data.SQLite.EF6.dll file_SQLite.Designer.dll\
file_Installer_Test_Vs2012.log}] -result {0 True}}

###############################################################################

runTest {test installer-1.8 {uninstaller tool / Visual Studio 2012} -setup {
  set fileName [file join [getTemporaryDirectory] [file tail [string map \
      [list .log [appendArgs _ [pid] .log]] $testUninstallVs2012LogFile]]]

  cleanupFile $fileName
} -body {
  set output ""

  set code [catch {
    testClrExec $installerExeFile [list -eventflags Wait -stdout output \
        -success Success] -debugPriority Lowest -tracePriority MediumHigh \
        -noRuntimeVersion true -noCompact true -noNetFx20 true \
        -noNetFx35 true -noNetFx40 true -noNetFx451 true -noNetFx452 true \
        -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true \
        -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true \
        -noVs2008 true -noVs2010 true -noVs2013 true -noVs2015 true \
        -noVs2017 true -whatIf true -verbose true -confirm true \
        -install false -debug true -wow64 true -configVersion 4.0.30319 \
        -directory [file nativename [getBuildDirectory true]] \
        -logFileName [appendArgs \" [file nativename $fileName] \"] \
        -traceFormat [appendArgs \" "#{0}: {2}" \"]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  set lineNumber 0
  set is64 [haveConstraint amd64.64bit]
  set wow64 [expr {$is64 ? "\\Wow6432Node" : ""}]

  list $code [expr {$code == 0 ? [string equal -nocase [readFile $fileName] \
      [subst -nobackslashes [readFile $testUninstallVs2012LogFile]]] : $error}]
} -cleanup {
  cleanupFile $fileName
  catch {info previouspid true}

  unset -nocomplain wow64 is64 lineNumber code output error fileName
} -constraints [fixConstraints {eagle administrator !wow64 buildYear.2012\
visualStudio2012 System.Data.SQLite.dll_v4.0.30319 file_Installer.exe testExec\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll\
file_System.Data.SQLite.EF6.dll file_SQLite.Designer.dll\
file_Uninstaller_Test_Vs2012.log}] -result {0 True}}

###############################################################################

runTest {test installer-1.9 {installer tool / Visual Studio 2013} -setup {
  set fileName [file join [getTemporaryDirectory] [file tail [string map \
      [list .log [appendArgs _ [pid] .log]] $testInstallVs2013LogFile]]]

  cleanupFile $fileName
} -body {
  set output ""

  set code [catch {
    testClrExec $installerExeFile [list -eventflags Wait -stdout output \
        -success Success] -debugPriority Lowest -tracePriority MediumHigh \
        -noRuntimeVersion true -noCompact true -noNetFx20 true \
        -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx452 true \
        -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true \
        -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true \
        -noVs2008 true -noVs2010 true -noVs2012 true -noVs2015 true \
        -noVs2017 true -whatIf true -verbose true -confirm true \
        -install true -debug true -wow64 true -configVersion 4.0.30319 \
        -directory [file nativename [getBuildDirectory true]] \
        -logFileName [appendArgs \" [file nativename $fileName] \"] \
        -traceFormat [appendArgs \" "#{0}: {2}" \"]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  set lineNumber 0
  set is64 [haveConstraint amd64.64bit]
  set wow64 [expr {$is64 ? "\\Wow6432Node" : ""}]

  list $code [expr {$code == 0 ? [string equal -nocase [readFile $fileName] \
      [subst -nobackslashes [readFile $testInstallVs2013LogFile]]] : $error}]
} -cleanup {
  cleanupFile $fileName
  catch {info previouspid true}

  unset -nocomplain wow64 is64 lineNumber code output error fileName
} -constraints [fixConstraints {eagle administrator !wow64 buildYear.2013\
visualStudio2013 System.Data.SQLite.dll_v4.0.30319 file_Installer.exe testExec\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll\
file_System.Data.SQLite.EF6.dll file_SQLite.Designer.dll\
file_Installer_Test_Vs2013.log}] -result {0 True}}

###############################################################################

runTest {test installer-1.10 {uninstaller tool / Visual Studio 2013} -setup {
  set fileName [file join [getTemporaryDirectory] [file tail [string map \
      [list .log [appendArgs _ [pid] .log]] $testUninstallVs2013LogFile]]]

  cleanupFile $fileName
} -body {
  set output ""

  set code [catch {
    testClrExec $installerExeFile [list -eventflags Wait -stdout output \
        -success Success] -debugPriority Lowest -tracePriority MediumHigh \
        -noRuntimeVersion true -noCompact true -noNetFx20 true \
        -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx452 true \
        -noNetFx46 true -noNetFx461 true -noNetFx462 true -noNetFx47 true \
        -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true \
        -noVs2008 true -noVs2010 true -noVs2012 true -noVs2015 true \
        -noVs2017 true -whatIf true -verbose true -confirm true \
        -install false -debug true -wow64 true -configVersion 4.0.30319 \
        -directory [file nativename [getBuildDirectory true]] \
        -logFileName [appendArgs \" [file nativename $fileName] \"] \
        -traceFormat [appendArgs \" "#{0}: {2}" \"]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  set lineNumber 0
  set is64 [haveConstraint amd64.64bit]
  set wow64 [expr {$is64 ? "\\Wow6432Node" : ""}]

  list $code [expr {$code == 0 ? [string equal -nocase [readFile $fileName] \
      [subst -nobackslashes [readFile $testUninstallVs2013LogFile]]] : $error}]
} -cleanup {
  cleanupFile $fileName
  catch {info previouspid true}

  unset -nocomplain wow64 is64 lineNumber code output error fileName
} -constraints [fixConstraints {eagle administrator !wow64 buildYear.2013\
visualStudio2013 System.Data.SQLite.dll_v4.0.30319 file_Installer.exe testExec\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll\
file_System.Data.SQLite.EF6.dll file_SQLite.Designer.dll\
file_Uninstaller_Test_Vs2013.log}] -result {0 True}}

###############################################################################

runTest {test installer-1.11 {installer tool / Visual Studio 2015} -setup {
  set fileName [file join [getTemporaryDirectory] [file tail [string map \
      [list .log [appendArgs _ [pid] .log]] $testInstallVs2015LogFile]]]

  cleanupFile $fileName
} -body {
  set output ""

  set code [catch {
    testClrExec $installerExeFile [list -eventflags Wait -stdout output \
        -success Success] -debugPriority Lowest -tracePriority MediumHigh \
        -noRuntimeVersion true -noCompact true -noNetFx20 true \
        -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx451 true \
        -noNetFx452 true -noNetFx461 true -noNetFx462 true -noNetFx47 true \
        -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true \
        -noVs2008 true -noVs2010 true -noVs2012 true -noVs2013 true \
        -noVs2017 true -whatIf true -verbose true -confirm true \
        -install true -debug true -wow64 true -configVersion 4.0.30319 \
        -directory [file nativename [getBuildDirectory true]] \
        -logFileName [appendArgs \" [file nativename $fileName] \"] \
        -traceFormat [appendArgs \" "#{0}: {2}" \"]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  set lineNumber 0
  set is64 [haveConstraint amd64.64bit]
  set wow64 [expr {$is64 ? "\\Wow6432Node" : ""}]

  list $code [expr {$code == 0 ? [string equal -nocase [readFile $fileName] \
      [subst -nobackslashes [readFile $testInstallVs2015LogFile]]] : $error}]
} -cleanup {
  cleanupFile $fileName
  catch {info previouspid true}

  unset -nocomplain wow64 is64 lineNumber code output error fileName
} -constraints [fixConstraints {eagle administrator !wow64 buildYear.2015\
visualStudio2015 System.Data.SQLite.dll_v4.0.30319 file_Installer.exe testExec\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll\
file_System.Data.SQLite.EF6.dll file_SQLite.Designer.dll\
file_Installer_Test_Vs2015.log}] -result {0 True}}

###############################################################################

runTest {test installer-1.12 {uninstaller tool / Visual Studio 2015} -setup {
  set fileName [file join [getTemporaryDirectory] [file tail [string map \
      [list .log [appendArgs _ [pid] .log]] $testUninstallVs2015LogFile]]]

  cleanupFile $fileName
} -body {
  set output ""

  set code [catch {
    testClrExec $installerExeFile [list -eventflags Wait -stdout output \
        -success Success] -debugPriority Lowest -tracePriority MediumHigh \
        -noRuntimeVersion true -noCompact true -noNetFx20 true \
        -noNetFx35 true -noNetFx40 true -noNetFx45 true -noNetFx451 true \
        -noNetFx452 true -noNetFx461 true -noNetFx462 true -noNetFx47 true \
        -noNetFx471 true -noNetFx472 true -noNetFx48 true -noVs2005 true \
        -noVs2008 true -noVs2010 true -noVs2012 true -noVs2013 true \
        -noVs2017 true -whatIf true -verbose true -confirm true \
        -install false -debug true -wow64 true -configVersion 4.0.30319 \
        -directory [file nativename [getBuildDirectory true]] \
        -logFileName [appendArgs \" [file nativename $fileName] \"] \
        -traceFormat [appendArgs \" "#{0}: {2}" \"]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  set lineNumber 0
  set is64 [haveConstraint amd64.64bit]
  set wow64 [expr {$is64 ? "\\Wow6432Node" : ""}]

  list $code [expr {$code == 0 ? [string equal -nocase [readFile $fileName] \
      [subst -nobackslashes [readFile $testUninstallVs2015LogFile]]] : $error}]
} -cleanup {
  cleanupFile $fileName
  catch {info previouspid true}

  unset -nocomplain wow64 is64 lineNumber code output error fileName
} -constraints [fixConstraints {eagle administrator !wow64 buildYear.2015\
visualStudio2015 System.Data.SQLite.dll_v4.0.30319 file_Installer.exe testExec\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll\
file_System.Data.SQLite.EF6.dll file_SQLite.Designer.dll\
file_Uninstaller_Test_Vs2015.log}] -result {0 True}}

###############################################################################

rename getLineNumber ""

###############################################################################

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue

Added Tests/linq.eagle.







































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
###############################################################################
#
# linq.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue
runSQLiteTestFilesPrologue

###############################################################################

runTest {test linq-1.1 {DbUpdateCommandTree with UPDATE and SELECT} -body {
  copySampleDatabaseFiles

  set result [list]
  set output ""

  set code [catch {
    testClrExec $testLinqExeFile [list -eventflags Wait -directory \
        [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
        -success Success] -update
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  lappend result $code

  if {$code == 0} then {
    lappend result [string trim $output]
  } else {
    lappend result [string trim $error]
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result
} -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll testExec\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db} \
-result {0 {inserted 1 updated 1}}}

###############################################################################

runTest {test linq-1.2 {ROUND function with two arguments} -body {
  copySampleDatabaseFiles

  set result [list]
  set output ""

  set code [catch {
    testClrExec $testLinqExeFile [list -eventflags Wait -directory \
        [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
        -success Success] -round
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  lappend result $code

  if {$code == 0} then {
    lappend result [string trim $output]
  } else {
    lappend result [string trim $error]
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result
} -constraints {eagle System.Data.SQLite.dll_v4.0.30319 monoToDo SQLite\
file_System.Data.SQLite.dll testExec file_System.Data.SQLite.Linq.dll\
file_testlinq.exe file_northwindEF.db} -result {0 {{ NewUnitPrice = 21.0 } {\
NewUnitPrice = 21.1 } { NewUnitPrice = 21.05 } { NewUnitPrice = 23.0 } {\
NewUnitPrice = 23.3 } { NewUnitPrice = 23.25 } { NewUnitPrice = 21.0 } {\
NewUnitPrice = 21.4 } { NewUnitPrice = 21.35 }}}}

###############################################################################

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue

Added Tests/memory.eagle.









































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
###############################################################################
#
# memory.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

#
# NOTE: Report before test, before shutdown.
#
checkForSQLiteDirectories $test_channel
getSQLiteHandleCounts $test_channel
reportSQLiteResources $test_channel

###############################################################################

#
# NOTE: Make sure that SQLite core library is completely shutdown prior to
#       starting any of the tests in this file.
#
shutdownSQLite $test_channel

###############################################################################

#
# NOTE: Report before test, after shutdown.
#
checkForSQLiteDirectories $test_channel
getSQLiteHandleCounts $test_channel
reportSQLiteResources $test_channel

###############################################################################

#
# NOTE: This test is disabled for .NET Core due to its lack of support for
#       performance counters.
#
runTest {test memory-1.1 {SQLiteDataReader memory testing} -setup {
  setupMemoryCounters counter
  reportMemoryCounters $test_channel counter initial

  setupDb [set fileName $test_repository_file] \
      "" "" "" "" "Read Only=True" false false
} -body {
  set connection [getDbConnection]

  set sql "SELECT rid, rcvid, size, uuid, content FROM blob ORDER BY rid;"

  set working(rowCount) 0
  set working(contentLength) 0

  set working(time) [time {
    set dataReader [sql execute -execute reader -format datareader \
        -alias $db $sql]

    while {[$dataReader Read]} {
      incr working(rowCount)

      set working(rid) [$dataReader GetValue \
          [$dataReader GetOrdinal rid]]

      set working(rcvid) [$dataReader GetValue \
          [$dataReader GetOrdinal rcvid]]

      set working(size) [$dataReader GetValue \
          [$dataReader GetOrdinal size]]

      set working(uuid) [$dataReader GetValue \
          [$dataReader GetOrdinal uuid]]

      set working(content) [$dataReader -create -alias GetValue \
          [$dataReader GetOrdinal content]]

      incr working(contentLength) [$working(content) Length]

      set working(counter1Cur) [$counter(1) RawValue]
      set working(counter2Cur) [$counter(2) RawValue]
      set working(counter3Cur) [$counter(3) RawValue]

      if {![info exists working(counter1Max)] || \
          $working(counter1Cur) > $working(counter1Max)} then {
        set working(counter1Max) $working(counter1Cur)
        reportMemoryCounters $test_channel counter current
        cleanupMemory connection
      }

      if {![info exists working(counter2Max)] || \
          $working(counter2Cur) > $working(counter2Max)} then {
        set working(counter2Max) $working(counter2Cur)
        reportMemoryCounters $test_channel counter current
        cleanupMemory connection
      }

      if {![info exists working(counter3Max)] || \
          $working(counter3Cur) > $working(counter3Max)} then {
        set working(counter3Max) $working(counter3Cur)
        reportMemoryCounters $test_channel counter current
        cleanupMemory connection
      }
    }
  }]

  reportMemoryCounters $test_channel counter final

  tputs $test_channel [appendArgs \
      "---- found " $working(rowCount) " rows with " \
      $working(contentLength) " bytes of content in " \
      $working(time) \n]
} -cleanup {
  freeDbConnection

  unset -nocomplain dataReader connection

  cleanupDb $fileName db true false false

  unset -nocomplain working sql counter db fileName
} -constraints [fixConstraints {eagle command.object !dotNetCore windows\
monoBug28 command.sql compile.DATA SQLite System.Data.SQLite\
fossil_repository_file variable_test_repository_file}] -result {}}

###############################################################################

#
# NOTE: Report after test.
#
checkForSQLiteDirectories $test_channel
getSQLiteHandleCounts $test_channel
reportSQLiteResources $test_channel

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/pool.eagle.





































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
###############################################################################
#
# pool.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test pool-1.1 {dispose connection with weak pool} -setup {
  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteConnectionPool CreateAndInitialize \
      null false true
} -body {
  setupDb [set fileName pool-1.1.db] "" "" "" "" "Pooling=True;"

  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(NULL);"

  cleanupDb $fileName db true false false false false

  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    INSERT INTO t1 (x) VALUES(?); \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main(string\[\] args)
        {
          int iteration = int.Parse(args\[0\]);

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};Pooling=True;" +
              "[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql}",
                connection))
            {
              command.Parameters.Add(new SQLiteParameter("", iteration));
              command.ExecuteNonQuery();
            }
          }

          GC.Collect();
          GC.WaitForPendingFinalizers();
          GC.Collect();
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  if {$code ne "Ok"} then {
    error [expr {[info exists errors] ? $errors : "C# compilation failed"}]
  }

  set m 100
  set counts(rows) 0
  set counts(create,before) [getCreateCount]
  set counts(dispose,before) [getDisposeCount]

  set time [time {
    set args [object create -alias String\[\] 1]

    for {set i 0} {$i < $m} {incr i} {
      $args SetValue $i 0

      object invoke -alias _Dynamic${id}.Test${id} Main $args

      setupDb $fileName "" "" "" "" "Pooling=True;" true false

      incr counts(rows) [sql execute -execute \
          scalar $db "SELECT COUNT(*) FROM t1;"]

      cleanupDb $fileName db false false false false false
    }
  }]

  tputs $test_channel [appendArgs \
      "---- attempted to open / close " $m " pooled connections in " \
      $time \n]

  set counts(create,after) [getCreateCount]
  set counts(dispose,after) [getDisposeCount]

  set counts(create,diff) [expr {
    $counts(create,after) - $counts(create,before)
  }]

  set counts(dispose,diff) [expr {
    $counts(dispose,after) - $counts(dispose,before)
  }]

  tputs $test_channel [appendArgs \
      "---- created extra connections " $counts(create,diff) \
      " times in this test\n"]

  tputs $test_channel [appendArgs \
      "---- disposed extra connections " $counts(dispose,diff) \
      " times in this test\n"]

  list $counts(rows) [expr {
    $counts(create,after) >= $counts(create,before)
  }]
} -cleanup {
  catch {
    object invoke -flags +NonPublic \
        System.Data.SQLite.SQLiteConnectionPool ClearAllPools
  }

  catch {
    object invoke -flags +NonPublic \
        System.Data.SQLite.SQLiteConnectionPool TerminateAndReset \
        null
  }

  cleanupDb $fileName

  unset -nocomplain results errors code sql dataSource id
  unset -nocomplain args time i m counts db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -result {5150 True}}

###############################################################################

runTest {test pool-1.2 {dispose connection with strong pool} -setup {
  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteConnectionPool CreateAndInitialize \
      null true true
} -body {
  setupDb [set fileName pool-1.2.db] "" "" "" "" "Pooling=True;"

  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(NULL);"

  cleanupDb $fileName db true false false false false

  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    INSERT INTO t1 (x) VALUES(?); \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main(string\[\] args)
        {
          int iteration = int.Parse(args\[0\]);

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};Pooling=True;" +
              "[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql}",
                connection))
            {
              command.Parameters.Add(new SQLiteParameter("", iteration));
              command.ExecuteNonQuery();
            }
          }

          GC.Collect();
          GC.WaitForPendingFinalizers();
          GC.Collect();
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  if {$code ne "Ok"} then {
    error [expr {[info exists errors] ? $errors : "C# compilation failed"}]
  }

  set m 100
  set counts(rows) 0
  set counts(create,before) [getCreateCount]
  set counts(dispose,before) [getDisposeCount]

  set time [time {
    set args [object create -alias String\[\] 1]

    for {set i 0} {$i < $m} {incr i} {
      $args SetValue $i 0

      object invoke -alias _Dynamic${id}.Test${id} Main $args

      setupDb $fileName "" "" "" "" "Pooling=True;" true false

      incr counts(rows) [sql execute -execute \
          scalar $db "SELECT COUNT(*) FROM t1;"]

      cleanupDb $fileName db false false false false false
    }
  }]

  tputs $test_channel [appendArgs \
      "---- attempted to open / close " $m " pooled connections in " \
      $time \n]

  set counts(create,after) [getCreateCount]
  set counts(dispose,after) [getDisposeCount]

  set counts(create,diff) [expr {
    $counts(create,after) - $counts(create,before)
  }]

  set counts(dispose,diff) [expr {
    $counts(dispose,after) - $counts(dispose,before)
  }]

  tputs $test_channel [appendArgs \
      "---- created extra connections " $counts(create,diff) \
      " times in this test\n"]

  tputs $test_channel [appendArgs \
      "---- disposed extra connections " $counts(dispose,diff) \
      " times in this test\n"]

  list $counts(rows) [expr {
    $counts(create,after) == $counts(create,before)
  }]
} -cleanup {
  catch {
    object invoke -flags +NonPublic \
        System.Data.SQLite.SQLiteConnectionPool ClearAllPools
  }

  catch {
    object invoke -flags +NonPublic \
        System.Data.SQLite.SQLiteConnectionPool TerminateAndReset \
        null
  }

  cleanupDb $fileName

  unset -nocomplain results errors code sql dataSource id
  unset -nocomplain args time i m counts db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -result {5150 True}}

###############################################################################

runTest {test pool-1.3 {dispose connection with legacy pool} -setup {
  catch {
    object invoke -flags +NonPublic \
        System.Data.SQLite.SQLiteConnectionPool ClearAllPools
  }

  catch {
    object invoke -flags +NonPublic \
        System.Data.SQLite.SQLiteConnectionPool TerminateAndReset \
        null
  }
} -body {
  setupDb [set fileName pool-1.3.db] "" "" "" "" "Pooling=True;"

  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(NULL);"

  cleanupDb $fileName db true false false false false

  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    INSERT INTO t1 (x) VALUES(?); \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main(string\[\] args)
        {
          int iteration = int.Parse(args\[0\]);

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};" +
              "[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql}",
                connection))
            {
              command.Parameters.Add(new SQLiteParameter("", iteration));
              command.ExecuteNonQuery();
            }
          }

          GC.Collect();
          GC.WaitForPendingFinalizers();
          GC.Collect();
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  if {$code ne "Ok"} then {
    error [expr {[info exists errors] ? $errors : "C# compilation failed"}]
  }

  set m 100
  set counts(rows) 0
  set counts(create,before) [getCreateCount]
  set counts(dispose,before) [getDisposeCount]

  set time [time {
    set args [object create -alias String\[\] 1]

    for {set i 0} {$i < $m} {incr i} {
      $args SetValue $i 0

      object invoke -alias _Dynamic${id}.Test${id} Main $args

      setupDb $fileName "" "" "" "" "" true false

      incr counts(rows) [sql execute -execute \
          scalar $db "SELECT COUNT(*) FROM t1;"]

      cleanupDb $fileName db false false false false false
    }
  }]

  tputs $test_channel [appendArgs \
      "---- attempted to open / close " $m " pooled connections in " \
      $time \n]

  set counts(create,after) [getCreateCount]
  set counts(dispose,after) [getDisposeCount]

  set counts(create,diff) [expr {
    $counts(create,after) - $counts(create,before)
  }]

  set counts(dispose,diff) [expr {
    $counts(dispose,after) - $counts(dispose,before)
  }]

  tputs $test_channel [appendArgs \
      "---- created extra connections " $counts(create,diff) \
      " times in this test\n"]

  tputs $test_channel [appendArgs \
      "---- disposed extra connections " $counts(dispose,diff) \
      " times in this test\n"]

  list $counts(rows) [expr {
    $counts(create,after) >= $counts(create,before)
  }]
} -cleanup {
  catch {
    object invoke -flags +NonPublic \
        System.Data.SQLite.SQLiteConnectionPool ClearAllPools
  }

  catch {
    object invoke -flags +NonPublic \
        System.Data.SQLite.SQLiteConnectionPool TerminateAndReset \
        null
  }

  cleanupDb $fileName

  unset -nocomplain results errors code sql dataSource id
  unset -nocomplain args time i m counts db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -result {5150 True}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/progress.eagle.















































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
###############################################################################
#
# progress.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test progress-1.1 {no progress without ProgressOps} -setup {
  setupDb [set fileName progress-1.1.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    CREATE TABLE t1(x INTEGER); \
    INSERT INTO t1 (x) VALUES(1); \
    INSERT INTO t1 (x) VALUES(2); \
    INSERT INTO t1 (x) VALUES(3); \
    INSERT INTO t1 (x) VALUES(4); \
    SELECT x FROM t1 ORDER BY x; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        private static int count = 0;

        ///////////////////////////////////////////////////////////////////////

        public static void MyProgressHandler(
          object sender,
          ProgressEventArgs e
          )
        {
          count++;
        }

        ///////////////////////////////////////////////////////////////////////

        public static int Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Progress += MyProgressHandler;
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql}",
                connection))
            {
              command.ExecuteNonQuery();
            }
          }

          return count;
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result \
      [expr {[string is integer -strict $result] && $result == 0 ? 1 : 0}]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 0 1$}}

###############################################################################

runTest {test progress-1.2 {simple progress counter} -setup {
  setupDb [set fileName progress-1.2.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    CREATE TABLE t1(x INTEGER); \
    INSERT INTO t1 (x) VALUES(1); \
    INSERT INTO t1 (x) VALUES(2); \
    INSERT INTO t1 (x) VALUES(3); \
    INSERT INTO t1 (x) VALUES(4); \
    SELECT x FROM t1 ORDER BY x; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        private static int count = 0;

        ///////////////////////////////////////////////////////////////////////

        public static void MyProgressHandler(
          object sender,
          ProgressEventArgs e
          )
        {
          count++;
        }

        ///////////////////////////////////////////////////////////////////////

        public static int Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};ProgressOps=1;[getTestProperties]"))
          {
            connection.Progress += MyProgressHandler;
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql}",
                connection))
            {
              command.ExecuteNonQuery();
            }
          }

          return count;
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result \
      [expr {[string is integer -strict $result] && $result > 0 ? 1 : 0}]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \d+ 1$}}

###############################################################################

runTest {test progress-1.3 {progress with interrupt} -setup {
  setupDb [set fileName progress-1.3.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    CREATE TABLE t1(x INTEGER); \
    INSERT INTO t1 (x) VALUES(1); \
    INSERT INTO t1 (x) VALUES(2); \
    INSERT INTO t1 (x) VALUES(3); \
    INSERT INTO t1 (x) VALUES(4); \
    SELECT x FROM t1 ORDER BY x; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        private static int count = 0;

        ///////////////////////////////////////////////////////////////////////

        public static void MyProgressHandler(
          object sender,
          ProgressEventArgs e
          )
        {
          count++;
          e.ReturnCode = SQLiteProgressReturnCode.Interrupt;
        }

        ///////////////////////////////////////////////////////////////////////

        public static int Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};ProgressOps=1;[getTestProperties]"))
          {
            connection.Progress += MyProgressHandler;
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql}",
                connection))
            {
              command.ExecuteNonQuery();
            }
          }

          return count;
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result \
      [expr {[string is integer -strict $result] && $result > 0 ? 1 : 0}]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \d+ 1$}}

###############################################################################

runTest {test progress-1.4 {progress with exception} -setup {
  setupDb [set fileName progress-1.4.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    CREATE TABLE t1(x INTEGER); \
    INSERT INTO t1 (x) VALUES(1); \
    INSERT INTO t1 (x) VALUES(2); \
    INSERT INTO t1 (x) VALUES(3); \
    INSERT INTO t1 (x) VALUES(4); \
    SELECT x FROM t1 ORDER BY x; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        private static int count = 0;

        ///////////////////////////////////////////////////////////////////////

        public static void MyProgressHandler(
          object sender,
          ProgressEventArgs e
          )
        {
          count++;
          throw new Exception();
        }

        ///////////////////////////////////////////////////////////////////////

        public static int Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};ProgressOps=1;[getTestProperties]"))
          {
            connection.Progress += MyProgressHandler;
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql}",
                connection))
            {
              command.ExecuteNonQuery();
            }
          }

          return count;
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result \
      [expr {[string is integer -strict $result] && $result > 0 ? 1 : 0}]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \d+ 1$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/pst-4db2934c2e.eagle.











































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
###############################################################################
#
# pst-4db2934c2e.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test pst-4db2934c2e-1.1 {Trace2 event} -setup {
  setupDb [set fileName pst-4db2934c2e-1.1.db]

  proc traceCallback { sender e } {
    set result [list [$e Flags]]
    set databaseConnection [$e DatabaseConnection]

    if {[string length $databaseConnection] > 0} then {
      lappend result [format %lx $databaseConnection]
    }

    set preparedStatement [$e PreparedStatement]

    if {[string length $preparedStatement] > 0} then {
      lappend result [format %lx $preparedStatement]
    }

    lappend result [$e Statement] [$e Elapsed]
    lappend ::results $result
  }

  sql execute $db {
    CREATE TABLE t1(x);
    INSERT INTO t1 (x) VALUES(1);
    INSERT INTO t1 (x) VALUES(2);
    INSERT INTO t1 (x) VALUES(3);
  }
} -body {
  set connection [getDbConnection]
  $connection TraceFlags SQLITE_TRACE_ALL
  $connection add_Trace2 traceCallback

  # SQLITE_TRACE_STMT, SQLITE_TRACE_ROW, SQLITE_TRACE_PROFILE
  lappend results [sql execute -execute reader -format list $db {
    SELECT * FROM t1 WHERE x < ? ORDER BY x;
  } [list param1 Int32 4]]

  $connection Close; $connection Open; # SQLITE_TRACE_CLOSE
  $connection remove_Trace2 traceCallback

  set results
} -cleanup {
  catch {object removecallback traceCallback}

  freeDbConnection connection false
  unset -nocomplain connection

  cleanupDb $fileName

  unset -nocomplain results fileName

  rename traceCallback ""
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -match regexp -result {^\{SQLITE_TRACE_STMT [0-9a-f]+\
\{SELECT \* FROM t1 WHERE x < \? ORDER BY x;\} \{\}\} \{SQLITE_TRACE_ROW\
[0-9a-f]+ \{\} \{\}\} \{SQLITE_TRACE_ROW [0-9a-f]+ \{\} \{\}\}\
\{SQLITE_TRACE_ROW [0-9a-f]+ \{\} \{\}\} \{SQLITE_TRACE_PROFILE [0-9a-f]+ \{\}\
\d+\} \{1 2 3\} \{SQLITE_TRACE_CLOSE [0-9a-f]+ \{\} \{\}\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/pst-eeaefb84ec.eagle.



























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
###############################################################################
#
# pst-eeaefb84ec.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

set character(1) \U1F5FD; # NOTE: This is little-endian.
set character(2) \U1F409; # NOTE: This is little-endian.

###############################################################################

runTest {test pst-eeaefb84ec-1.1 {UTF-16 string lengths} -setup {
  set fileName pst-eeaefb84ec-1.1.db
  setupDb $fileName "" "" "" "" UseUTF16Encoding=True
} -body {
  sql execute $db [appendArgs \
      "CREATE TABLE t1(x TEXT, \"" $character(1) "\" \"" \
      $character(2) "\");"]

  sql execute $db [appendArgs \
      "INSERT INTO t1 (x, \"" $character(1) "\") VALUES(?, ?);"] \
      [list param1 String $character(1)] [list param2 String x]

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db [appendArgs "SELECT x, \"" $character(1) "\" FROM t1;"]]

  set result [list]

  lappend result [sql execute -execute scalar $db "PRAGMA encoding;"]

  while {[$dataReader Read]} {
    lappend result \
        [list [$dataReader GetName 0] [$dataReader GetOrdinal x] \
            [$dataReader GetDataTypeName 0] [$dataReader GetDatabaseName 0] \
            [$dataReader GetTableName 0] [$dataReader GetOriginalName 0] \
            [$dataReader Item x]] \
        [list [$dataReader GetName 1] [$dataReader GetOrdinal $character(1)] \
            [$dataReader GetDataTypeName 1] [$dataReader GetDatabaseName 1] \
            [$dataReader GetTableName 1] [$dataReader GetOriginalName 1] \
            [$dataReader Item $character(1)]]
  }

  set result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result [list UTF-16le [list x 0 TEXT main t1 x \
$character(1)] [list $character(1) 1 $character(2) main t1 $character(1) x]]}

###############################################################################

unset -nocomplain character

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/pst-f4e718891d.eagle.





















































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
###############################################################################
#
# pst-f4e718891d.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test pst-f4e718891d-1.1 {ExecuteScalar multi-step write} -setup {
  setupDb [set fileName pst-f4e718891d-1.1.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  sql execute $db {
    CREATE TABLE t1(x INTEGER);
  }

  set sql(1) { \
    INSERT INTO t1 (x) VALUES (1) RETURNING x; \
  }

  set sql(2) { \
    SELECT COUNT(*) FROM t1; \
  }

  set count(1) 250; # number of rows to insert, one per thread.

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using System.Threading;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        private static int insertExceptionCount = 0;
        private static int selectExceptionCount = 0;

        ///////////////////////////////////////////////////////////////////////

        private static void InsertRow()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql(1)}",
                connection))
            {
              try
              {
                command.ExecuteScalar();
              }
              catch (SQLiteException)
              {
                Interlocked.Increment(ref insertExceptionCount);
              }
            }
          }
        }

        ///////////////////////////////////////////////////////////////////////

        private static void CountRows()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql(2)}",
                connection))
            {
              try
              {
                command.ExecuteScalar();
              }
              catch (SQLiteException)
              {
                Interlocked.Increment(ref selectExceptionCount);
              }
            }
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          for (int index = 0; index < ${count(1)}; index++)
          {
            Thread one = new Thread(InsertRow);
            Thread two = new Thread(CountRows);

            one.Start();
            two.Start();

            one.Join();
            two.Join();
          }
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll]]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result \
      insert [expr {$code eq "Ok" ? [catchCSharp {
        object invoke -flags +NonPublic \
            _Dynamic${id}.Test${id} insertExceptionCount
      } count(iec)] : [set count(iec) -1]}] $count(iec) \
      select [expr {$code eq "Ok" ? [catchCSharp {
        object invoke -flags +NonPublic \
            _Dynamic${id}.Test${id} selectExceptionCount
      } count(sec)] : [set count(sec) -1]}] $count(sec) \
      [expr {
        $count(iec) + [set count(rows) \
            [sql execute -execute scalar $db $sql(2)]]
      }] [expr {
        [tputs $test_channel [appendArgs \
            "---- test counts: " [testArrayGet count] \n]]
      }]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code count sql
  unset -nocomplain dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result \
{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\} insert 0 \d+\
select 0 \d+ 250 \{\}$}}

###############################################################################

runTest {test pst-f4e718891d-1.2 {ExecuteNonQuery multi-step write} -setup {
  setupDb [set fileName pst-f4e718891d-1.2.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  sql execute $db {
    CREATE TABLE t1(x INTEGER);
  }

  set sql(1) { \
    INSERT INTO t1 (x) VALUES (1) RETURNING x; \
  }

  set sql(2) { \
    SELECT COUNT(*) FROM t1; \
  }

  set count(1) 250; # number of rows to insert, one per thread.

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using System.Threading;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        private static int totalRecordsAffected = 0;
        private static int insertExceptionCount = 0;
        private static int selectExceptionCount = 0;

        ///////////////////////////////////////////////////////////////////////

        private static void InsertRow()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql(1)}",
                connection))
            {
              try
              {
                Interlocked.Add(
                    ref totalRecordsAffected, command.ExecuteNonQuery());
              }
              catch (SQLiteException)
              {
                Interlocked.Increment(ref insertExceptionCount);
              }
            }
          }
        }

        ///////////////////////////////////////////////////////////////////////

        private static void CountRows()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql(2)}",
                connection))
            {
              try
              {
                command.ExecuteNonQuery();
              }
              catch (SQLiteException)
              {
                Interlocked.Increment(ref selectExceptionCount);
              }
            }
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          for (int index = 0; index < ${count(1)}; index++)
          {
            Thread one = new Thread(InsertRow);
            Thread two = new Thread(CountRows);

            one.Start();
            two.Start();

            one.Join();
            two.Join();
          }
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll]]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result \
      insert1 [expr {$code eq "Ok" ? [catchCSharp {
        object invoke -flags +NonPublic \
            _Dynamic${id}.Test${id} insertExceptionCount
      } count(iec)] : [set count(iec) -1]}] $count(iec) \
      insert2 [expr {$code eq "Ok" ? [catchCSharp {
        object invoke -flags +NonPublic \
            _Dynamic${id}.Test${id} totalRecordsAffected
      } count(tra)] : [set count(tra) -1]}] $count(tra) \
      select [expr {$code eq "Ok" ? [catchCSharp {
        object invoke -flags +NonPublic \
            _Dynamic${id}.Test${id} selectExceptionCount
      } count(sec)] : [set count(sec) -1]}] $count(sec) \
      [expr {
        $count(iec) + [set count(rows) \
            [sql execute -execute scalar $db $sql(2)]]
      }] [expr {
        [tputs $test_channel [appendArgs \
            "---- test counts: " [testArrayGet count] \n]]
      }]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code count sql
  unset -nocomplain dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result \
{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\} insert1 0 \d+\
insert2 0 250 select 0 \d+ 250 \{\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/session.eagle.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
###############################################################################
#
# session.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

#
# HACK: When running on Mono, always insert a "-parametertypes" option when
#       calling method overloads that require a Stream, due to their broken
#       (as of 5.0) implementation of the Type.IsAssignableFrom method.
#       Without this option, the Eagle core marshaller will select the wrong
#       method overload, which will cause all tests that use a stream-based
#       method overload to fail.
#
proc useStreamMaybeWithMono { args } {
  if {[isMono]} then {
    set args [linsert $args 1 -parametertypes [list System.IO.Stream]]
  }

  return [uplevel 1 $args]
}

###############################################################################

proc getSomeText { random count } {
  set items [list \
      Alpha Bravo Charlie Delta Echo Foxtrot Golf Hotel \
      India Juliet Kilo Lima Mike November Oscar Papa \
      Quebec Romeo Sierra Tango Uniform Victor Whiskey X-ray \
      Yankee Zulu]

  if {!$random} then {
    variable some_text_index

    if {![info exists some_text_index]} then {
      set some_text_index 0
    }
  }

  set length [llength $items]
  set result [list]

  for {set i 0} {$i < $count} {incr i} {
    if {$random} then {
      set item [lindex $items [expr {int(rand() * $length)}]]
    } else {
      set item [lindex $items $some_text_index]
      incr some_text_index

      if {$some_text_index >= $length} then {
        set some_text_index 0
      }
    }

    lappend result $item
  }

  return $result
}

###############################################################################

proc cleanupSomeText {} {
  variable some_text_index
  unset -nocomplain some_text_index
}

###############################################################################

proc forDisplay { object member } {
  set isArray false

  if {[isNonNullObjectHandle $object]} then {
    set value [object invoke -create -- $object $member]

    if {[isNonNullObjectHandle $value]} then {
      set isArray [object invoke -- $value GetType.IsArray]
    }
  } else {
    set value null
  }

  if {$isArray} then {
    return [object invoke -flags +NonPublic \
        -parametertypes Array System.Data.SQLite.HelperMethods \
        ToDisplayString $value]
  } else {
    return [object invoke -flags +NonPublic \
        System.Data.SQLite.HelperMethods ToDisplayString $value]
  }
}

###############################################################################

proc createMemoryChangeSetForConnection { connection rawData flags } {
  if {[isNonNullObjectHandle $connection]} then {
    return [$connection -alias CreateChangeSet $rawData $flags]
  }

  return null
}

###############################################################################

proc createMemoryChangeSetForObject { object {patch false} } {
  if {[isNonNullObjectHandle $object]} then {
    set byteArray null

    if {$patch} then {
      $object CreatePatchSet byteArray
    } else {
      $object CreateChangeSet byteArray
    }

    set rawData [createByteArray [arrayToList byteArray]]
    object removeref $rawData

    return $rawData
  }

  return null
}

###############################################################################

proc writeRawDataToFile { fileName rawData } {
  if {[isNonNullObjectHandle $rawData]} then {
    set stream [object create -alias \
        System.IO.FileStream $fileName Create Write]

    $stream Write $rawData 0 [$rawData Length]
    $stream Flush; $stream Close

    return true
  }

  return false
}

###############################################################################

proc openStreamChangeSetForConnection {
        connection inputFileName outputFileName flags {varName ""} } {
  if {[isNonNullObjectHandle $connection]} then {
    if {[string length $varName] > 0} then {
      upvar 1 $varName state
    }

    if {[string length $inputFileName] > 0} then {
      set state(inputStream) [object create -alias \
          System.IO.FileStream $inputFileName Open Read]
    } else {
      set state(inputStream) null
    }

    if {[string length $outputFileName] > 0} then {
      set state(outputStream) [object create -alias \
          System.IO.FileStream $outputFileName Create Write]
    } else {
      set state(outputStream) null
    }

    set state(changeSet) [$connection -alias \
        CreateChangeSet $state(inputStream) $state(outputStream) \
        $flags]

    return true
  }

  return false
}

###############################################################################

proc addStreamChangeSetForObject { object fileName } {
  if {[isNonNullObjectHandle $object]} then {
    set stream [object create -alias \
        System.IO.FileStream $fileName Open Read]

    useStreamMaybeWithMono $object AddChangeSet $stream

    return true
  }

  return false
}

###############################################################################

proc writeStreamChangeSetForObject { object fileName {patch false} } {
  if {[isNonNullObjectHandle $object]} then {
    set stream [object create -alias \
        System.IO.FileStream $fileName Create Write]

    if {$patch} then {
      useStreamMaybeWithMono $object CreatePatchSet $stream
    } else {
      useStreamMaybeWithMono $object CreateChangeSet $stream
    }

    $stream Flush; $stream Close

    return true
  }

  return false
}

###############################################################################

proc changeSetFileToString { connection fileName flags includeValues } {
  set result [list]

  if {[isNonNullObjectHandle $connection]} then {
    if {[openStreamChangeSetForConnection \
        $connection $fileName "" $flags state]} then {
      return [changeSetToString $state(changeSet) $includeValues]
    }
  }

  return $result
}

###############################################################################

proc metadataItemToString { item includeValues } {
  set result [list]

  if {[isNonNullObjectHandle $item]} then {
    lappend result TableName [$item TableName]
    lappend result NumberOfColumns [$item NumberOfColumns]
    lappend result OperationCode [$item OperationCode]
    lappend result Indirect [$item Indirect]

    lappend result PrimaryKeyColumns \
        [forDisplay $item PrimaryKeyColumns]

    if {$includeValues} then {
      set numberOfColumns [$item NumberOfColumns]

      for {set index 0} {$index < $numberOfColumns} {incr index} {
        set oldValue [$item GetOldValue $index]

        lappend result OldValue $index \
            [forDisplay $oldValue GetObject]

        set newValue [$item GetNewValue $index]

        lappend result NewValue $index \
            [forDisplay $newValue GetObject]

        set conflictValue [$item GetConflictValue $index]

        lappend result ConflictValue $index \
            [forDisplay $conflictValue GetObject]
      }
    }
  }

  return $result
}

###############################################################################

proc changeSetToString { changeSet includeValues } {
  set result [list]

  if {[isNonNullObjectHandle $changeSet]} then {
    object foreach -alias item $changeSet {
      lappend result [metadataItemToString $item $includeValues]
    }
  }

  return $result
}

###############################################################################

proc matchSession { connection session flags expr } {
  if {[isNonNullObjectHandle $session]} then {
    if {![$session IsEmpty]} then {
      set rawData [createMemoryChangeSetForObject $session]
      object removeref $rawData

      if {[isNonNullObjectHandle $rawData]} then {
        return [matchChangeSet [set changeSet \
            [$connection -alias CreateChangeSet $rawData $flags]] $expr]
      }
    }
  }

  return false
}

###############################################################################

proc matchChangeSet { changeSet expr } {
  if {[isNonNullObjectHandle $changeSet]} then {
    object foreach -alias item $changeSet {
      if {[expr $expr]} then {return true}
    }
  }

  return false
}

###############################################################################

proc createTheSchema { db databaseName } {
  sql execute $db [subst {
    CREATE TABLE ${databaseName}.t1(x INTEGER PRIMARY KEY, y TEXT);
    CREATE TABLE ${databaseName}.t2(x INTEGER PRIMARY KEY, y TEXT);
  }]
}

###############################################################################

proc makeSomeChanges { db table types {rowId ""} {count 5} } {
  foreach type $types {
    switch -nocase -- $type {
      insert {
        set text [appendArgs "inserted: " [getSomeText false $count]]

        if {[string is integer -strict $rowId]} then {
          sql execute $db [subst {
            INSERT INTO ${table}(x, y) VALUES(?, ?);
          }] [list param1 Int32 $rowId] [list param2 String $text]
        } else {
          sql execute $db [subst {
            INSERT INTO ${table}(y) VALUES(?);
          }] [list param1 String $text]
        }
      }
      update {
        set text [appendArgs "updated: " [getSomeText false $count]]

        if {[string is integer -strict $rowId]} then {
          sql execute $db [subst {
            UPDATE ${table} SET y = ? WHERE x = ?;
          }] [list param1 String $text] [list param2 Int32 $rowId]
        } else {
          sql execute $db [subst {
            UPDATE ${table} SET y = ? WHERE x NOT IN (
              (SELECT MIN(x) FROM ${table}), (SELECT MAX(x) FROM ${table})
            );
          }] [list param1 String $text]
        }
      }
      delete {
        if {[string is integer -strict $rowId]} then {
          sql execute $db [subst {
            DELETE FROM ${table} WHERE x = ?;
          }] [list param1 Int32 $rowId]
        } else {
          sql execute $db [subst {
            DELETE FROM ${table} WHERE x = (SELECT MIN(x) FROM ${table});
          }]
        }
      }
    }
  }
}

###############################################################################

proc captureChangeSetRawData {
        connection databaseName tableName script {patch false} } {
  if {![isNonNullObjectHandle $connection]} then {
    error "connection is invalid"
  }

  set session [$connection -alias CreateSession $databaseName]
  $session AttachTable $tableName

  if {![isNonNullObjectHandle $session]} then {
    error "cannot create session"
  }

  catch {uplevel 1 $script}
  set rawData [createMemoryChangeSetForObject $session $patch]
  object removeref $rawData

  return $rawData
}

###############################################################################

proc captureChangeSetFile {
        connection databaseName tableName script fileName {patch false} } {
  if {![isNonNullObjectHandle $connection]} then {
    error "connection is invalid"
  }

  set session [$connection -alias CreateSession $databaseName]
  $session AttachTable $tableName

  if {![isNonNullObjectHandle $session]} then {
    error "cannot create session"
  }

  catch {uplevel 1 $script}
  writeStreamChangeSetForObject $session $fileName $patch
}

###############################################################################

proc getChangeSetFileName { {suffix ""} } {
  return [file join \
      [getTemporaryDirectory] [appendArgs changes $suffix .bin]]
}

###############################################################################

proc arrayToList { varName } {
  set result [list]

  upvar 1 $varName array

  if {[array exists array]} then {
    foreach name [lsort -integer [array names array]] {
      lappend result $array($name)
    }
  }

  return $result
}

###############################################################################

proc createByteArray { list } {
  set length [llength $list]
  set result [object create -alias System.Byte\[\] $length]

  for {set index 0} {$index < $length} {incr index} {
    set element [lindex $list $index]
    set value [object invoke -create Byte Parse $element]
    $result SetValue $value $index
  }

  return $result
}

###############################################################################

proc tableFilterCallbackT1 { clientData name } {
  lappend ::callbackResults [object invoke -create \
      System.Boolean Parse [expr {[$name ToString] in [list t1]}]]

  return [lindex $::callbackResults end]
}

###############################################################################

proc conflictCallback { clientData type item } {
  set result Abort

  if {[isNonNullObjectHandle $item]} then {
    set result Omit

    if {[$item OperationCode] ne "Delete"} then {
      if {[isNonNullObjectHandle $type] && \
          [$type ToString] in [list Data Conflict]} then {
        set result Replace
      }
    }
  }

  lappend ::callbackResults [object invoke -create Enum Parse \
      System.Data.SQLite.SQLiteChangeSetConflictResult $result false]

  return [lindex $::callbackResults end]
}

###############################################################################

runTest {test session-1.1 {basic extension usage} -setup {
  setupDb [set fileName(0) session-1.1.db]

  set fileName(1) [getChangeSetFileName 1.1]
  set fileName(2) [getChangeSetFileName 1.2]

  cleanupSomeText
} -body {
  createTheSchema $db main
  makeSomeChanges $db t1 [list insert insert]

  set connection [getDbConnection]

  set session [$connection -alias CreateSession main]
  $session AttachTable null

  makeSomeChanges $db t1 [list insert update delete]

  set rawData [createMemoryChangeSetForObject $session]
  object removeref $rawData

  writeRawDataToFile $fileName(1) $rawData
  writeStreamChangeSetForObject $session $fileName(2)
  openStreamChangeSetForConnection $connection $fileName(2) "" None state

  list [expr {[file size $fileName(1)] > 0}] \
      [string equal [readFile $fileName(1)] [readFile $fileName(2)]] \
      [changeSetToString $state(changeSet) true]
} -cleanup {
  cleanupSomeText

  unset -nocomplain state rawData byteArray session

  freeDbConnection

  unset -nocomplain connection

  cleanupFile $fileName(2)
  cleanupFile $fileName(1)

  cleanupDb $fileName(0)

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_SESSION_EXTENSION} -result {True True\
{{TableName t1 NumberOfColumns 2 OperationCode Delete Indirect False\
PrimaryKeyColumns {[True, False]} OldValue 0 1 NewValue 0 <nullObject>\
ConflictValue 0 <nullObject> OldValue 1 {"inserted: Alpha Bravo Charlie Delta\
Echo"} NewValue 1 <nullObject> ConflictValue 1 <nullObject>} {TableName t1\
NumberOfColumns 2 OperationCode Update Indirect False PrimaryKeyColumns {[True,\
False]} OldValue 0 2 NewValue 0 <nullObject> ConflictValue 0 <nullObject>\
OldValue 1 {"inserted: Foxtrot Golf Hotel India Juliet"} NewValue 1 {"updated:\
Papa Quebec Romeo Sierra Tango"} ConflictValue 1 <nullObject>} {TableName t1\
NumberOfColumns 2 OperationCode Insert Indirect False PrimaryKeyColumns {[True,\
False]} OldValue 0 <nullObject> NewValue 0 3 ConflictValue 0 <nullObject>\
OldValue 1 <nullObject> NewValue 1 {"inserted: Kilo Lima Mike November Oscar"}\
ConflictValue 1 <nullObject>}}}}

###############################################################################

runTest {test session-1.2.1 {change set read/write/invert (memory)} -setup {
  setupDb [set fileName session-1.2.1.db]

  cleanupSomeText
} -body {
  createTheSchema $db main
  makeSomeChanges $db t1 [list insert insert insert]

  set connection [getDbConnection]

  set session [$connection -alias CreateSession main]
  $session AttachTable null

  makeSomeChanges $db t1 [list insert update delete]

  set rawData [createMemoryChangeSetForObject $session]
  object removeref $rawData

  set changeSet(1) \
      [createMemoryChangeSetForConnection $connection $rawData None]

  object removeref $changeSet(1)

  set changeSet(2) [$changeSet(1) -alias Invert]

  list [changeSetToString $changeSet(2) true]
} -cleanup {
  cleanupSomeText

  unset -nocomplain changeSet rawData byteArray session

  freeDbConnection

  unset -nocomplain connection

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_SESSION_EXTENSION} -result \
{{{TableName t1 NumberOfColumns 2 OperationCode Insert Indirect False\
PrimaryKeyColumns {[True, False]} OldValue 0 <nullObject> NewValue 0 1\
ConflictValue 0 <nullObject> OldValue 1 <nullObject> NewValue 1 {"inserted:\
Alpha Bravo Charlie Delta Echo"} ConflictValue 1 <nullObject>} {TableName t1\
NumberOfColumns 2 OperationCode Update Indirect False PrimaryKeyColumns {[True,\
False]} OldValue 0 2 NewValue 0 <nullObject> ConflictValue 0 <nullObject>\
OldValue 1 {"updated: Uniform Victor Whiskey X-ray Yankee"} NewValue 1\
{"inserted: Foxtrot Golf Hotel India Juliet"} ConflictValue 1 <nullObject>}\
{TableName t1 NumberOfColumns 2 OperationCode Update Indirect False\
PrimaryKeyColumns {[True, False]} OldValue 0 3 NewValue 0 <nullObject>\
ConflictValue 0 <nullObject> OldValue 1 {"updated: Uniform Victor Whiskey X-ray\
Yankee"} NewValue 1 {"inserted: Kilo Lima Mike November Oscar"} ConflictValue 1\
<nullObject>} {TableName t1 NumberOfColumns 2 OperationCode Delete Indirect\
False PrimaryKeyColumns {[True, False]} OldValue 0 4 NewValue 0 <nullObject>\
ConflictValue 0 <nullObject> OldValue 1 {"inserted: Papa Quebec Romeo Sierra\
Tango"} NewValue 1 <nullObject> ConflictValue 1 <nullObject>}}}}

###############################################################################

runTest {test session-1.2.2 {change set read/write/invert (stream)} -setup {
  setupDb [set fileName(0) session-1.2.2.db]

  set fileName(1) [getChangeSetFileName 2.2.1]
  set fileName(2) [getChangeSetFileName 2.2.2]

  cleanupSomeText
} -body {
  createTheSchema $db main
  makeSomeChanges $db t1 [list insert insert insert]

  set connection [getDbConnection]

  set session [$connection -alias CreateSession main]
  $session AttachTable null

  makeSomeChanges $db t1 [list insert update delete]

  writeStreamChangeSetForObject $session $fileName(1)

  openStreamChangeSetForConnection \
      $connection $fileName(1) $fileName(2) None state

  $state(changeSet) -alias Invert; unset state
  list [changeSetFileToString $connection $fileName(2) None true]
} -cleanup {
  cleanupSomeText

  unset -nocomplain state byteArray session

  freeDbConnection

  unset -nocomplain connection

  cleanupFile $fileName(2)
  cleanupFile $fileName(1)

  cleanupDb $fileName(0)

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_SESSION_EXTENSION} -result \
{{{TableName t1 NumberOfColumns 2 OperationCode Insert Indirect False\
PrimaryKeyColumns {[True, False]} OldValue 0 <nullObject> NewValue 0 1\
ConflictValue 0 <nullObject> OldValue 1 <nullObject> NewValue 1 {"inserted:\
Alpha Bravo Charlie Delta Echo"} ConflictValue 1 <nullObject>} {TableName t1\
NumberOfColumns 2 OperationCode Update Indirect False PrimaryKeyColumns {[True,\
False]} OldValue 0 2 NewValue 0 <nullObject> ConflictValue 0 <nullObject>\
OldValue 1 {"updated: Uniform Victor Whiskey X-ray Yankee"} NewValue 1\
{"inserted: Foxtrot Golf Hotel India Juliet"} ConflictValue 1 <nullObject>}\
{TableName t1 NumberOfColumns 2 OperationCode Update Indirect False\
PrimaryKeyColumns {[True, False]} OldValue 0 3 NewValue 0 <nullObject>\
ConflictValue 0 <nullObject> OldValue 1 {"updated: Uniform Victor Whiskey X-ray\
Yankee"} NewValue 1 {"inserted: Kilo Lima Mike November Oscar"} ConflictValue 1\
<nullObject>} {TableName t1 NumberOfColumns 2 OperationCode Delete Indirect\
False PrimaryKeyColumns {[True, False]} OldValue 0 4 NewValue 0 <nullObject>\
ConflictValue 0 <nullObject> OldValue 1 {"inserted: Papa Quebec Romeo Sierra\
Tango"} NewValue 1 <nullObject> ConflictValue 1 <nullObject>}}}}

###############################################################################

runTest {test session-1.2.3 {change set read/write/invert (memory)} -setup {
  setupDb [set fileName session-1.2.3.db]

  cleanupSomeText
} -body {
  createTheSchema $db main
  makeSomeChanges $db t1 [list insert insert insert]

  set connection [getDbConnection]

  set session [$connection -alias CreateSession main]
  $session AttachTable null

  makeSomeChanges $db t1 [list insert update delete]

  set rawData [createMemoryChangeSetForObject $session]
  object removeref $rawData

  set changeSet(1) \
      [createMemoryChangeSetForConnection $connection $rawData Invert]

  object removeref $changeSet(1)

  list [changeSetToString $changeSet(1) true]
} -cleanup {
  cleanupSomeText

  unset -nocomplain changeSet rawData byteArray session

  freeDbConnection

  unset -nocomplain connection

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_SESSION_EXTENSION} -result \
{{{TableName t1 NumberOfColumns 2 OperationCode Insert Indirect False\
PrimaryKeyColumns {[True, False]} OldValue 0 <nullObject> NewValue 0 1\
ConflictValue 0 <nullObject> OldValue 1 <nullObject> NewValue 1 {"inserted:\
Alpha Bravo Charlie Delta Echo"} ConflictValue 1 <nullObject>} {TableName t1\
NumberOfColumns 2 OperationCode Update Indirect False PrimaryKeyColumns {[True,\
False]} OldValue 0 2 NewValue 0 <nullObject> ConflictValue 0 <nullObject>\
OldValue 1 {"updated: Uniform Victor Whiskey X-ray Yankee"} NewValue 1\
{"inserted: Foxtrot Golf Hotel India Juliet"} ConflictValue 1 <nullObject>}\
{TableName t1 NumberOfColumns 2 OperationCode Update Indirect False\
PrimaryKeyColumns {[True, False]} OldValue 0 3 NewValue 0 <nullObject>\
ConflictValue 0 <nullObject> OldValue 1 {"updated: Uniform Victor Whiskey X-ray\
Yankee"} NewValue 1 {"inserted: Kilo Lima Mike November Oscar"} ConflictValue 1\
<nullObject>} {TableName t1 NumberOfColumns 2 OperationCode Delete Indirect\
False PrimaryKeyColumns {[True, False]} OldValue 0 4 NewValue 0 <nullObject>\
ConflictValue 0 <nullObject> OldValue 1 {"inserted: Papa Quebec Romeo Sierra\
Tango"} NewValue 1 <nullObject> ConflictValue 1 <nullObject>}}}}

###############################################################################

runTest {test session-1.2.4 {change set read/write/invert (stream)} -setup {
  setupDb [set fileName(0) session-1.2.4.db]

  set fileName(1) [getChangeSetFileName 2.4.1]

  cleanupSomeText
} -body {
  createTheSchema $db main
  makeSomeChanges $db t1 [list insert insert insert]

  set connection [getDbConnection]

  set session [$connection -alias CreateSession main]
  $session AttachTable null

  makeSomeChanges $db t1 [list insert update delete]

  writeStreamChangeSetForObject $session $fileName(1)

  list [changeSetFileToString $connection $fileName(1) Invert true]
} -cleanup {
  cleanupSomeText

  unset -nocomplain state byteArray session

  freeDbConnection

  unset -nocomplain connection

  cleanupFile $fileName(1)

  cleanupDb $fileName(0)

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_SESSION_EXTENSION} -result \
{{{TableName t1 NumberOfColumns 2 OperationCode Insert Indirect False\
PrimaryKeyColumns {[True, False]} OldValue 0 <nullObject> NewValue 0 1\
ConflictValue 0 <nullObject> OldValue 1 <nullObject> NewValue 1 {"inserted:\
Alpha Bravo Charlie Delta Echo"} ConflictValue 1 <nullObject>} {TableName t1\
NumberOfColumns 2 OperationCode Update Indirect False PrimaryKeyColumns {[True,\
False]} OldValue 0 2 NewValue 0 <nullObject> ConflictValue 0 <nullObject>\
OldValue 1 {"updated: Uniform Victor Whiskey X-ray Yankee"} NewValue 1\
{"inserted: Foxtrot Golf Hotel India Juliet"} ConflictValue 1 <nullObject>}\
{TableName t1 NumberOfColumns 2 OperationCode Update Indirect False\
PrimaryKeyColumns {[True, False]} OldValue 0 3 NewValue 0 <nullObject>\
ConflictValue 0 <nullObject> OldValue 1 {"updated: Uniform Victor Whiskey X-ray\
Yankee"} NewValue 1 {"inserted: Kilo Lima Mike November Oscar"} ConflictValue 1\
<nullObject>} {TableName t1 NumberOfColumns 2 OperationCode Delete Indirect\
False PrimaryKeyColumns {[True, False]} OldValue 0 4 NewValue 0 <nullObject>\
ConflictValue 0 <nullObject> OldValue 1 {"inserted: Papa Quebec Romeo Sierra\
Tango"} NewValue 1 <nullObject> ConflictValue 1 <nullObject>}}}}

###############################################################################

runTest {test session-1.3 {enabled/disabled state} -setup {
  setupDb [set fileName session-1.3.db]

  cleanupSomeText
} -body {
  createTheSchema $db main
  makeSomeChanges $db t1 [list insert]

  set connection [getDbConnection]

  set session [$connection -alias CreateSession main]
  lappend result IsEnabled [$session IsEnabled]

  $session AttachTable null
  lappend result IsEnabled [$session IsEnabled]

  $session SetToDisabled
  lappend result IsEnabled [$session IsEnabled]

  makeSomeChanges $db t1 [list insert]
  lappend result IsEmpty [$session IsEmpty]

  set rawData [createMemoryChangeSetForObject $session]
  object removeref $rawData

  lappend result Length [$rawData Length]

  $session SetToEnabled
  lappend result IsEnabled [$session IsEnabled]

  makeSomeChanges $db t1 [list insert]
  lappend result IsEmpty [$session IsEmpty]

  set rawData [createMemoryChangeSetForObject $session]
  object removeref $rawData

  set changeSet(1) \
      [createMemoryChangeSetForConnection $connection $rawData None]

  object removeref $changeSet(1)

  lappend result [changeSetToString $changeSet(1) false]
} -cleanup {
  cleanupSomeText

  unset -nocomplain result changeSet rawData byteArray session

  freeDbConnection

  unset -nocomplain connection

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_SESSION_EXTENSION} -result {IsEnabled\
True IsEnabled True IsEnabled False IsEmpty True Length 0 IsEnabled True\
IsEmpty False {{TableName t1 NumberOfColumns 2 OperationCode Insert Indirect\
False PrimaryKeyColumns {[True, False]}}}}}

###############################################################################

runTest {test session-1.4 {direct/indirect state} -setup {
  setupDb [set fileName session-1.4.db]

  cleanupSomeText
} -body {
  createTheSchema $db main
  makeSomeChanges $db t1 [list insert]

  set connection [getDbConnection]

  set session [$connection -alias CreateSession main]
  lappend result IsIndirect [$session IsIndirect]

  $session AttachTable null
  lappend result IsIndirect [$session IsIndirect]

  $session SetToIndirect
  lappend result IsIndirect [$session IsIndirect]

  makeSomeChanges $db t1 [list insert]
  lappend result IsEmpty [$session IsEmpty]

  set rawData [createMemoryChangeSetForObject $session]
  object removeref $rawData

  $session SetToDirect
  lappend result IsIndirect [$session IsIndirect]

  makeSomeChanges $db t1 [list insert]
  lappend result IsEmpty [$session IsEmpty]

  set rawData [createMemoryChangeSetForObject $session]
  object removeref $rawData

  set changeSet(1) \
      [createMemoryChangeSetForConnection $connection $rawData None]

  object removeref $changeSet(1)

  lappend result [changeSetToString $changeSet(1) false]
} -cleanup {
  cleanupSomeText

  unset -nocomplain result changeSet rawData byteArray session

  freeDbConnection

  unset -nocomplain connection

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_SESSION_EXTENSION} -result \
{IsIndirect False IsIndirect False IsIndirect True IsEmpty False IsIndirect\
False IsEmpty False {{TableName t1 NumberOfColumns 2 OperationCode Insert\
Indirect True PrimaryKeyColumns {[True, False]}} {TableName t1 NumberOfColumns\
2 OperationCode Insert Indirect False PrimaryKeyColumns {[True, False]}}}}}

###############################################################################

runTest {test session-1.5 {table filter} -setup {
  setupDb [set fileName session-1.5.db]

  cleanupSomeText
} -body {
  createTheSchema $db main
  makeSomeChanges $db t1 [list insert]

  set connection [getDbConnection]

  set session [$connection -alias CreateSession main]

  $session -marshalflags +DynamicCallback \
      SetTableFilter tableFilterCallbackT1 null

  makeSomeChanges $db t2 [list insert]
  lappend result IsEmpty [$session IsEmpty]

  lappend result MatchT2 [matchSession $connection $session None {
    [$item TableName] eq "t2"
  }]

  makeSomeChanges $db t1 [list insert]
  lappend result IsEmpty [$session IsEmpty]

  lappend result MatchT1 [matchSession $connection $session None {
    [$item TableName] eq "t1"
  }]

  $session SetTableFilter null null

  makeSomeChanges $db t2 [list insert]
  lappend result IsEmpty [$session IsEmpty]

  lappend result MatchT2 [matchSession $connection $session None {
    [$item TableName] eq "t2"
  }]

  makeSomeChanges $db t1 [list insert]
  lappend result IsEmpty [$session IsEmpty]

  lappend result MatchT1 [matchSession $connection $session None {
    [$item TableName] eq "t1"
  }]

  set result
} -cleanup {
  cleanupSomeText

  unset -nocomplain result session

  freeDbConnection

  unset -nocomplain connection

  cleanupDb $fileName

  catch {object removecallback tableFilterCallbackT1}

  catch {
    foreach callbackResult $callbackResults {
      catch {object dispose $callbackResult}
    }
  }

  unset -nocomplain callbackResult callbackResults db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA\
compile.EMIT SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_SESSION_EXTENSION} -result {IsEmpty\
True MatchT2 false IsEmpty False MatchT1 true IsEmpty False MatchT2 true\
IsEmpty False MatchT1 true}}

###############################################################################

runTest {test session-1.6.1 {combine/apply change sets (memory)} -setup {
  setupDb [set fileName session-1.6.1.db]

  cleanupSomeText
} -body {
  createTheSchema $db main
  makeSomeChanges $db t1 [list insert insert]

  set connection [getDbConnection]

  set rawData(1) [captureChangeSetRawData $connection main null {
    makeSomeChanges $db t1 [list delete] 1
  }]; object removeref $rawData(1)

  makeSomeChanges $db t1 [list insert] 1

  set rawData(2) [captureChangeSetRawData $connection main null {
    makeSomeChanges $db t1 [list insert]
  }]; object removeref $rawData(2)

  set changeSet(1) \
      [createMemoryChangeSetForConnection $connection $rawData(1) None]

  object removeref $changeSet(1)

  set changeSet(2) \
      [createMemoryChangeSetForConnection $connection $rawData(2) None]

  object removeref $changeSet(2)

  set changeSet(3) [$changeSet(1) -alias CombineWith $changeSet(2)]

  $changeSet(3) -marshalflags +DynamicCallback \
      Apply conflictCallback null

  list [changeSetToString $changeSet(3) true] Data \
      [sql execute -execute reader -format list $db \
      {SELECT x, y FROM t1 ORDER BY x;}]
} -cleanup {
  cleanupSomeText

  unset -nocomplain changeSet rawData

  freeDbConnection

  unset -nocomplain connection

  cleanupDb $fileName

  catch {object removecallback conflictCallback}

  catch {
    foreach callbackResult $callbackResults {
      catch {object dispose $callbackResult}
    }
  }

  unset -nocomplain callbackResult callbackResults db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA\
compile.EMIT SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_SESSION_EXTENSION} -result \
{{{TableName t1 NumberOfColumns 2 OperationCode Delete Indirect False\
PrimaryKeyColumns {[True, False]} OldValue 0 1 NewValue 0 <nullObject>\
ConflictValue 0 <nullObject> OldValue 1 {"inserted: Alpha Bravo Charlie Delta\
Echo"} NewValue 1 <nullObject> ConflictValue 1 <nullObject>} {TableName t1\
NumberOfColumns 2 OperationCode Insert Indirect False PrimaryKeyColumns {[True,\
False]} OldValue 0 <nullObject> NewValue 0 3 ConflictValue 0 <nullObject>\
OldValue 1 <nullObject> NewValue 1 {"inserted: Papa Quebec Romeo Sierra Tango"}\
ConflictValue 1 <nullObject>}} Data {1 {inserted: Kilo Lima Mike November\
Oscar} 2 {inserted: Foxtrot Golf Hotel India Juliet} 3 {inserted: Papa Quebec\
Romeo Sierra Tango}}}}

###############################################################################

runTest {test session-1.6.2 {combine/apply change sets (stream)} -setup {
  setupDb [set fileName(0) session-1.6.2.db]

  set fileName(1) [getChangeSetFileName 6.2.1]
  set fileName(2) [getChangeSetFileName 6.2.2]
  set fileName(3) [getChangeSetFileName 6.2.3]

  cleanupSomeText
} -body {
  createTheSchema $db main
  makeSomeChanges $db t1 [list insert insert]

  set connection [getDbConnection]

  captureChangeSetFile $connection main null {
    makeSomeChanges $db t1 [list delete] 1
  } $fileName(1)

  makeSomeChanges $db t1 [list insert] 1

  captureChangeSetFile $connection main null {
    makeSomeChanges $db t1 [list insert]
  } $fileName(2)

  openStreamChangeSetForConnection \
      $connection $fileName(1) $fileName(3) None state1

  openStreamChangeSetForConnection \
      $connection $fileName(2) "" None state2

  $state1(changeSet) CombineWith $state2(changeSet); unset state2 state1

  openStreamChangeSetForConnection \
      $connection $fileName(3) "" None state3

  $state3(changeSet) -marshalflags +DynamicCallback \
      Apply conflictCallback null; unset state3

  openStreamChangeSetForConnection \
      $connection $fileName(3) "" None state4

  list [changeSetToString $state4(changeSet) true] Data \
      [sql execute -execute reader -format list $db \
      {SELECT x, y FROM t1 ORDER BY x;}]
} -cleanup {
  cleanupSomeText

  unset -nocomplain state4 state3 state2 state1

  freeDbConnection

  unset -nocomplain connection

  cleanupFile $fileName(3)
  cleanupFile $fileName(2)
  cleanupFile $fileName(1)

  cleanupDb $fileName(0)

  catch {object removecallback conflictCallback}

  catch {
    foreach callbackResult $callbackResults {
      catch {object dispose $callbackResult}
    }
  }

  unset -nocomplain callbackResult callbackResults db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA\
compile.EMIT SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_SESSION_EXTENSION} -result \
{{{TableName t1 NumberOfColumns 2 OperationCode Delete Indirect False\
PrimaryKeyColumns {[True, False]} OldValue 0 1 NewValue 0 <nullObject>\
ConflictValue 0 <nullObject> OldValue 1 {"inserted: Alpha Bravo Charlie Delta\
Echo"} NewValue 1 <nullObject> ConflictValue 1 <nullObject>} {TableName t1\
NumberOfColumns 2 OperationCode Insert Indirect False PrimaryKeyColumns {[True,\
False]} OldValue 0 <nullObject> NewValue 0 3 ConflictValue 0 <nullObject>\
OldValue 1 <nullObject> NewValue 1 {"inserted: Papa Quebec Romeo Sierra Tango"}\
ConflictValue 1 <nullObject>}} Data {1 {inserted: Kilo Lima Mike November\
Oscar} 2 {inserted: Foxtrot Golf Hotel India Juliet} 3 {inserted: Papa Quebec\
Romeo Sierra Tango}}}}

###############################################################################

runTest {test session-1.7.1 {combine/apply patch sets (memory)} -setup {
  setupDb [set fileName session-1.7.1.db]

  cleanupSomeText
} -body {
  createTheSchema $db main
  makeSomeChanges $db t1 [list insert insert]

  set connection [getDbConnection]

  set rawData(1) [captureChangeSetRawData $connection main null {
    makeSomeChanges $db t1 [list delete] 1
  } true]; object removeref $rawData(1)

  makeSomeChanges $db t1 [list insert] 1

  set rawData(2) [captureChangeSetRawData $connection main null {
    makeSomeChanges $db t1 [list insert]
  } true]; object removeref $rawData(2)

  set changeSet(1) \
      [createMemoryChangeSetForConnection $connection $rawData(1) None]

  object removeref $changeSet(1)

  set changeSet(2) \
      [createMemoryChangeSetForConnection $connection $rawData(2) None]

  object removeref $changeSet(2)

  set changeSet(3) [$changeSet(1) -alias CombineWith $changeSet(2)]

  $changeSet(3) -marshalflags +DynamicCallback \
      Apply conflictCallback null

  list [changeSetToString $changeSet(3) true] Data \
      [sql execute -execute reader -format list $db \
      {SELECT x, y FROM t1 ORDER BY x;}]
} -cleanup {
  cleanupSomeText

  unset -nocomplain changeSet rawData

  freeDbConnection

  unset -nocomplain connection

  cleanupDb $fileName

  catch {object removecallback conflictCallback}

  catch {
    foreach callbackResult $callbackResults {
      catch {object dispose $callbackResult}
    }
  }

  unset -nocomplain callbackResult callbackResults db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA\
compile.EMIT SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_SESSION_EXTENSION} -result \
{{{TableName t1 NumberOfColumns 2 OperationCode Delete Indirect False\
PrimaryKeyColumns {[True, False]} OldValue 0 1 NewValue 0 <nullObject>\
ConflictValue 0 <nullObject> OldValue 1 <nullObject> NewValue 1 <nullObject>\
ConflictValue 1 <nullObject>} {TableName t1 NumberOfColumns 2 OperationCode\
Insert Indirect False PrimaryKeyColumns {[True, False]} OldValue 0 <nullObject>\
NewValue 0 3 ConflictValue 0 <nullObject> OldValue 1 <nullObject> NewValue 1\
{"inserted: Papa Quebec Romeo Sierra Tango"} ConflictValue 1 <nullObject>}}\
Data {2 {inserted: Foxtrot Golf Hotel India Juliet} 3 {inserted: Papa Quebec\
Romeo Sierra Tango}}}}

###############################################################################

runTest {test session-1.7.2 {combine/apply patch sets (stream)} -setup {
  setupDb [set fileName(0) session-1.7.2.db]

  set fileName(1) [getChangeSetFileName 7.2.1]
  set fileName(2) [getChangeSetFileName 7.2.2]
  set fileName(3) [getChangeSetFileName 7.2.3]

  cleanupSomeText
} -body {
  createTheSchema $db main
  makeSomeChanges $db t1 [list insert insert]

  set connection [getDbConnection]

  captureChangeSetFile $connection main null {
    makeSomeChanges $db t1 [list delete] 1
  } $fileName(1) true

  makeSomeChanges $db t1 [list insert] 1

  captureChangeSetFile $connection main null {
    makeSomeChanges $db t1 [list insert]
  } $fileName(2) true

  openStreamChangeSetForConnection \
      $connection $fileName(1) $fileName(3) None state1

  openStreamChangeSetForConnection \
      $connection $fileName(2) "" None state2

  $state1(changeSet) CombineWith $state2(changeSet); unset state1

  openStreamChangeSetForConnection \
      $connection $fileName(3) "" None state3

  $state3(changeSet) -marshalflags +DynamicCallback \
      Apply conflictCallback null; unset state3

  openStreamChangeSetForConnection \
      $connection $fileName(3) "" None state4

  list [changeSetToString $state4(changeSet) true] Data \
      [sql execute -execute reader -format list $db \
      {SELECT x, y FROM t1 ORDER BY x;}]
} -cleanup {
  cleanupSomeText

  unset -nocomplain state4 state3 state2 state1

  freeDbConnection

  unset -nocomplain connection

  cleanupFile $fileName(3)
  cleanupFile $fileName(2)
  cleanupFile $fileName(1)

  cleanupDb $fileName(0)

  catch {object removecallback conflictCallback}

  catch {
    foreach callbackResult $callbackResults {
      catch {object dispose $callbackResult}
    }
  }

  unset -nocomplain callbackResult callbackResults db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA\
compile.EMIT SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_SESSION_EXTENSION} -result \
{{{TableName t1 NumberOfColumns 2 OperationCode Delete Indirect False\
PrimaryKeyColumns {[True, False]} OldValue 0 1 NewValue 0 <nullObject>\
ConflictValue 0 <nullObject> OldValue 1 <nullObject> NewValue 1 <nullObject>\
ConflictValue 1 <nullObject>} {TableName t1 NumberOfColumns 2 OperationCode\
Insert Indirect False PrimaryKeyColumns {[True, False]} OldValue 0 <nullObject>\
NewValue 0 3 ConflictValue 0 <nullObject> OldValue 1 <nullObject> NewValue 1\
{"inserted: Papa Quebec Romeo Sierra Tango"} ConflictValue 1 <nullObject>}}\
Data {2 {inserted: Foxtrot Golf Hotel India Juliet} 3 {inserted: Papa Quebec\
Romeo Sierra Tango}}}}

###############################################################################

runTest {test session-1.8 {differences between tables} -setup {
  setupDb [set fileName session-1.8.db]

  cleanupSomeText
} -body {
  createTheSchema $db main
  makeSomeChanges $db t1 [list insert insert]

  set result [list]

  lappend result [sql execute -execute reader -format list $db \
      {SELECT x, y FROM t1 ORDER BY x;}]

  createTheSchema $db temp
  sql execute $db {INSERT INTO temp.t1 SELECT * FROM main.t1;}
  makeSomeChanges $db temp.t1 [list insert insert]

  set connection [getDbConnection]

  set session [$connection -alias CreateSession main]
  $session AttachTable null
  $session LoadDifferencesFromTable temp t1

  lappend result [sql execute -execute reader -format list $db \
      {SELECT x, y FROM t1 ORDER BY x;}]
} -cleanup {
  cleanupSomeText

  unset -nocomplain result session

  freeDbConnection

  unset -nocomplain connection

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_SESSION_EXTENSION} -result {{1\
{inserted: Alpha Bravo Charlie Delta Echo} 2 {inserted: Foxtrot Golf Hotel\
India Juliet}} {1 {inserted: Alpha Bravo Charlie Delta Echo} 2 {inserted:\
Foxtrot Golf Hotel India Juliet} 3 {inserted: Kilo Lima Mike November Oscar} 4\
{inserted: Papa Quebec Romeo Sierra Tango}}}}

###############################################################################

runTest {test session-1.9 {apply change set (remote stream)} -setup {
  setupDb [set fileName session-1.9.db]

  cleanupSomeText
} -body {
  createTheSchema $db main

  set connection [getDbConnection]

  set webClient [object create -alias System.Net.WebClient]

  set stream [$webClient -alias OpenRead \
      https://system.data.sqlite.org/tests/session-1.9.bin]

  set changeSet [$connection -alias CreateChangeSet $stream null]

  $changeSet -marshalflags +DynamicCallback \
      Apply conflictCallback null; unset changeSet

  string tolower [hash normal sha1 [sql execute -execute reader \
      -format list $db {SELECT x, y FROM t1 ORDER BY x;}]]
} -cleanup {
  cleanupSomeText

  unset -nocomplain changeSet stream webClient

  freeDbConnection

  unset -nocomplain connection

  cleanupDb $fileName

  catch {object removecallback conflictCallback}

  catch {
    foreach callbackResult $callbackResults {
      catch {object dispose $callbackResult}
    }
  }

  unset -nocomplain callbackResult callbackResults db fileName
} -constraints {eagle sdsTlsOk command.object monoBug28 command.sql\
compile.DATA compile.EMIT SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_SESSION_EXTENSION} -result \
{7f0f0571ab843fe81543780c92a009b4abc90837}}

###############################################################################

runTest {test session-1.10.1 {change group (memory)} -setup {
  setupDb [set fileName session-1.10.1.db]

  cleanupSomeText
} -body {
  createTheSchema $db main
  makeSomeChanges $db t1 [list insert insert]

  set connection [getDbConnection]

  set rawData(1) [captureChangeSetRawData $connection main null {
    makeSomeChanges $db t1 [list delete] 1
  }]; object removeref $rawData(1)

  set rawData(2) [captureChangeSetRawData $connection main null {
    makeSomeChanges $db t1 [list insert]
  }]; object removeref $rawData(2)

  set changeGroup [$connection -alias CreateChangeGroup]

  $changeGroup AddChangeSet $rawData(1)
  $changeGroup AddChangeSet $rawData(2)

  set rawData(3) [createMemoryChangeSetForObject $changeGroup]
  object removeref $rawData(3)

  set changeSet \
      [createMemoryChangeSetForConnection $connection $rawData(3) None]

  object removeref $changeSet

  changeSetToString $changeSet true
} -cleanup {
  cleanupSomeText

  unset -nocomplain changeSet changeGroup rawData

  freeDbConnection

  unset -nocomplain connection

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_SESSION_EXTENSION} -result \
{{TableName t1 NumberOfColumns 2 OperationCode Delete Indirect False\
PrimaryKeyColumns {[True, False]} OldValue 0 1 NewValue 0 <nullObject>\
ConflictValue 0 <nullObject> OldValue 1 {"inserted: Alpha Bravo Charlie Delta\
Echo"} NewValue 1 <nullObject> ConflictValue 1 <nullObject>} {TableName t1\
NumberOfColumns 2 OperationCode Insert Indirect False PrimaryKeyColumns {[True,\
False]} OldValue 0 <nullObject> NewValue 0 3 ConflictValue 0 <nullObject>\
OldValue 1 <nullObject> NewValue 1 {"inserted: Kilo Lima Mike November Oscar"}\
ConflictValue 1 <nullObject>}}}

###############################################################################

runTest {test session-1.10.2 {change group (stream)} -setup {
  setupDb [set fileName(0) session-1.10.2.db]

  set fileName(1) [getChangeSetFileName 10.2.1]
  set fileName(2) [getChangeSetFileName 10.2.2]
  set fileName(3) [getChangeSetFileName 10.2.3]

  cleanupSomeText
} -body {
  createTheSchema $db main
  makeSomeChanges $db t1 [list insert insert]

  set connection [getDbConnection]

  captureChangeSetFile $connection main null {
    makeSomeChanges $db t1 [list delete] 1
  } $fileName(1)

  captureChangeSetFile $connection main null {
    makeSomeChanges $db t1 [list insert]
  } $fileName(2)

  set changeGroup [$connection -alias CreateChangeGroup]

  addStreamChangeSetForObject $changeGroup $fileName(1)
  addStreamChangeSetForObject $changeGroup $fileName(2)
  writeStreamChangeSetForObject $changeGroup $fileName(3)

  openStreamChangeSetForConnection \
      $connection $fileName(3) "" None state

  changeSetToString $state(changeSet) true
} -cleanup {
  cleanupSomeText

  unset -nocomplain state changeGroup

  freeDbConnection

  unset -nocomplain connection

  cleanupFile $fileName(3)
  cleanupFile $fileName(2)
  cleanupFile $fileName(1)

  cleanupDb $fileName(0)

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_SESSION_EXTENSION} -result \
{{TableName t1 NumberOfColumns 2 OperationCode Delete Indirect False\
PrimaryKeyColumns {[True, False]} OldValue 0 1 NewValue 0 <nullObject>\
ConflictValue 0 <nullObject> OldValue 1 {"inserted: Alpha Bravo Charlie Delta\
Echo"} NewValue 1 <nullObject> ConflictValue 1 <nullObject>} {TableName t1\
NumberOfColumns 2 OperationCode Insert Indirect False PrimaryKeyColumns {[True,\
False]} OldValue 0 <nullObject> NewValue 0 3 ConflictValue 0 <nullObject>\
OldValue 1 <nullObject> NewValue 1 {"inserted: Kilo Lima Mike November Oscar"}\
ConflictValue 1 <nullObject>}}}

###############################################################################

rename conflictCallback ""
rename tableFilterCallbackT1 ""
rename createByteArray ""
rename arrayToList ""
rename getChangeSetFileName ""
rename captureChangeSetFile ""
rename captureChangeSetRawData ""
rename makeSomeChanges ""
rename createTheSchema ""
rename matchChangeSet ""
rename matchSession ""
rename changeSetToString ""
rename metadataItemToString ""
rename changeSetFileToString ""
rename writeStreamChangeSetForObject ""
rename addStreamChangeSetForObject ""
rename openStreamChangeSetForConnection ""
rename writeRawDataToFile ""
rename createMemoryChangeSetForObject ""
rename createMemoryChangeSetForConnection ""
rename forDisplay ""
rename cleanupSomeText ""
rename getSomeText ""
rename useStreamMaybeWithMono ""

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/speed.eagle.





























































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
###############################################################################
#
# speed.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

set times [list]

###############################################################################

#
# NOTE: Report before test, before shutdown.
#
checkForSQLiteDirectories $test_channel
getSQLiteHandleCounts $test_channel
reportSQLiteResources $test_channel

###############################################################################

#
# NOTE: Make sure that SQLite core library is completely shutdown prior to
#       starting any of the tests in this file.
#
shutdownSQLite $test_channel

###############################################################################

#
# NOTE: Report before test, after shutdown.
#
checkForSQLiteDirectories $test_channel
getSQLiteHandleCounts $test_channel
reportSQLiteResources $test_channel

###############################################################################

runTest {test speed-1.1 {SQLiteDataReader speed testing} -setup {
  setupDb [set fileName [appendArgs speed-1.1- [pid] .db]]

  sql execute $db "CREATE TABLE t1(w INTEGER);"
  sql execute $db "CREATE TABLE t2(x REAL);"
  sql execute $db "CREATE TABLE t3(y TEXT);"
  sql execute $db "CREATE TABLE t4(z BLOB);"

  sql execute $db "INSERT INTO t1 (w) VALUES(NULL);"
  sql execute $db "INSERT INTO t1 (w) VALUES(-9223372036854775808);"
  sql execute $db "INSERT INTO t1 (w) VALUES(0);"
  sql execute $db "INSERT INTO t1 (w) VALUES(9223372036854775807);"

  sql execute $db "INSERT INTO t2 (x) VALUES(NULL);"
  sql execute $db "INSERT INTO t2 (x) VALUES(-1.7976931348623157e+308);"
  sql execute $db "INSERT INTO t2 (x) VALUES(0.0);"
  sql execute $db "INSERT INTO t2 (x) VALUES(1.7976931348623157e+308);"

  sql execute $db "INSERT INTO t3 (y) VALUES(NULL);"
  sql execute $db "INSERT INTO t3 (y) VALUES('1');"
  sql execute $db "INSERT INTO t3 (y) VALUES('1.1');"

  set char [expr {int(rand() * 0x7F) + 1}]; # NOTE: Skip NUL.

  tputs $test_channel [appendArgs \
      "---- using random character 0x" [format %X $char] ...\n]

  sql execute $db [appendArgs \
      "INSERT INTO t3 (y) VALUES('" [string map [list ' ''] [string \
      repeat [format %c $char] 1048576]] "');"]

  sql execute $db "INSERT INTO t4 (z) VALUES(NULL);"
  sql execute $db "INSERT INTO t4 (z) VALUES(X'01');"
  sql execute $db "INSERT INTO t4 (z) VALUES(X'0123456789');"
  sql execute $db "INSERT INTO t4 (z) VALUES(randomblob(1048576));"
} -body {
  set result [list]

  foreach sql [list \
      {SELECT CASE length(w) = 1048576
              WHEN 1 THEN length(w) ELSE w END FROM t1;} \
      {SELECT CASE length(x) = 1048576
              WHEN 1 THEN length(x) ELSE x END FROM t2;} \
      {SELECT CASE length(y) = 1048576
              WHEN 1 THEN length(y) ELSE y END FROM t3;} \
      {SELECT CASE length(z) = 1048576
              WHEN 1 THEN length(z) ELSE z END FROM t4;}] {
    set time [time {
      lappend result [sql execute -execute reader -format list $db $sql]
    }]

    tputs $test_channel [appendArgs \
        "---- executed query \"" [string map [list "\n              " " "] \
        $sql] "\" in " $time \n]

    lappend times [lindex $time 0]
  }

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain time sql result char db fileName
} -time true -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -match regexp -result "^\\\{-9223372036854775808 0\
9223372036854775807\\\}\
\\\{-(?:Infinity|\u221E|1\\.7976931348623157(?:E|e)\\+308) 0\
(?:Infinity|\u221E|1\\.7976931348623157(?:E|e)\\+308)\\\} \\\{1 1\\.1\
1048576\\\} \\\{1 \\\{1 35 69 103 137\\\} 1048576\\\}$"}

###############################################################################

runTest {test speed-1.2 {SQLiteDataReader speed testing} -setup {
  setupDb [set fileName [appendArgs speed-1.2- [pid] .db]]

  sql execute $db "CREATE TABLE t1(w INTEGER);"
  sql execute $db "CREATE TABLE t2(x REAL);"
  sql execute $db "CREATE TABLE t3(y TEXT);"
  sql execute $db "CREATE TABLE t4(z BLOB);"

  sql execute $db "INSERT INTO t1 (w) VALUES(NULL);"
  sql execute $db "INSERT INTO t1 (w) VALUES(-9223372036854775808);"
  sql execute $db "INSERT INTO t1 (w) VALUES(0);"
  sql execute $db "INSERT INTO t1 (w) VALUES(9223372036854775807);"

  sql execute $db "INSERT INTO t2 (x) VALUES(NULL);"
  sql execute $db "INSERT INTO t2 (x) VALUES(-1.7976931348623157e+308);"
  sql execute $db "INSERT INTO t2 (x) VALUES(0.0);"
  sql execute $db "INSERT INTO t2 (x) VALUES(1.7976931348623157e+308);"

  sql execute $db "INSERT INTO t3 (y) VALUES(NULL);"
  sql execute $db "INSERT INTO t3 (y) VALUES('1');"
  sql execute $db "INSERT INTO t3 (y) VALUES('1.1');"

  set char [expr {int(rand() * 0x7F) + 1}]; # NOTE: Skip NUL.

  tputs $test_channel [appendArgs \
      "---- using random character 0x" [format %X $char] ...\n]

  sql execute $db [appendArgs \
      "INSERT INTO t3 (y) VALUES('" [string map [list ' ''] [string \
      repeat [format %c $char] 1048576]] "');"]

  sql execute $db "INSERT INTO t4 (z) VALUES(NULL);"
  sql execute $db "INSERT INTO t4 (z) VALUES(X'01');"
  sql execute $db "INSERT INTO t4 (z) VALUES(X'0123456789');"
  sql execute $db "INSERT INTO t4 (z) VALUES(randomblob(1048576));"
} -body {
  set result [list]

  foreach {column table} [list w t1 x t2 y t3 z t4] {
    set sql [appendArgs "SELECT " $column " FROM " $table \;]

    set time [time {
      lappend result [llength \
          [sql execute -execute reader -format list $db $sql]]
    }]

    tputs $test_channel [appendArgs \
        "---- executed query \"" $sql "\" in " $time \n]

    lappend times [lindex $time 0]
  }

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain time sql table column result char db fileName
} -time true -constraints {eagle monoBug40 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {3 3 3 3}}

###############################################################################

#
# NOTE: Report after test.
#
checkForSQLiteDirectories $test_channel
getSQLiteHandleCounts $test_channel
reportSQLiteResources $test_channel

###############################################################################

tputs $test_channel [appendArgs \
    "---- overall performance results " $times \n]

###############################################################################

unset -nocomplain times

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/stress.eagle.



























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
###############################################################################
#
# stress.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

#
# NOTE: Report before test, before shutdown.
#
checkForSQLiteDirectories $test_channel
getSQLiteHandleCounts $test_channel
reportSQLiteResources $test_channel

###############################################################################

#
# NOTE: Make sure that SQLite core library is completely shutdown prior to
#       starting any of the tests in this file.
#
shutdownSQLite $test_channel

###############################################################################

#
# NOTE: Report before test, after shutdown.
#
checkForSQLiteDirectories $test_channel
getSQLiteHandleCounts $test_channel
reportSQLiteResources $test_channel

###############################################################################

runTest {test stress-1.1 {multithreaded stress testing} -setup {
  unset -nocomplain result thread index workload priority journalMode \
      pageSize noWorkload priorities srcDb db fileName compiled options \
      count times logFileName logListener event timeout connection \
      indicators iterations exitOnFail coTaskMem noTrace noProgress \
      beginTransaction endTransaction errorTransaction failures status \
      workloadNames workloadCallbacks

  #############################################################################

  proc setupWorkloadMemDb { fileName varName } {
    #
    # NOTE: This should be an in-memory database; therefore, skip attempting
    #       to delete the underlying database file as that would not make any
    #       sense.  Also, disable use of "PRAGMA temp_store_directory" when
    #       setting up the new connection because it is not thread-safe.
    #
    uplevel 1 [list setupDb \
        $fileName "" "" "" "" "" false false true false \
        $varName true]

    if {[string length $::pageSize] > 0} then {
      sql execute [uplevel 1 set $varName] [appendArgs \
          "PRAGMA page_size=" $::pageSize \;]
    }
  }

  #############################################################################

  proc setupWorkloadFileDb { fileName varName } {
    #
    # NOTE: Skip attempting to delete the underlying database file.  Also,
    #       disable use of "PRAGMA temp_store_directory" when setting up
    #       the new connection because it is not thread-safe.
    #
    uplevel 1 [list setupDb \
        $fileName $::journalMode "" "" "" "" true false \
        false false $varName true]

    if {[string length $::pageSize] > 0} then {
      sql execute [uplevel 1 set $varName] [appendArgs \
          "PRAGMA page_size=" $::pageSize \;]
    }
  }

  #############################################################################

  proc beginTransaction { db } {
    set sql $::beginTransaction

    if {[string length $sql] > 0} then {
      sql execute $db $sql
    }
  }

  #############################################################################

  proc endTransaction { db } {
    set sql $::endTransaction

    if {[string length $sql] > 0} then {
      sql execute $db $sql
    }
  }

  #############################################################################

  proc errorTransaction { db } {
    set sql $::errorTransaction

    if {[string length $sql] > 0} then {
      sql execute $db $sql
    }
  }

  #############################################################################

  proc formatWorkloadResult { index } {
    set result [appendArgs "---- iterations for workload (" $index "): "]

    append result [expr {[info exists ::iterations($index,total)] ? \
        $::iterations($index,total) : 0}] " total, "

    append result [expr {[info exists ::iterations($index,ok)] ? \
        $::iterations($index,ok) : 0}] " ok, "

    append result [expr {[info exists ::iterations($index,error)] ? \
        $::iterations($index,error) : 0}] " error, "

    #
    # NOTE: Translate the workload index to the corresponding iteration
    #       error indicator so that we can easily lookup the number of
    #       failures (i.e. "unexpected errors") for the workload.
    #
    set indicator [string character [expr {[string ordinal a 0] + $index - 1}]]

    append result [expr {[info exists ::failures($indicator)] ? \
        $::failures($indicator) : 0}] " failed\n"

    return $result
  }

  #############################################################################

  proc formatWorkloadTime { index } {
    if {[info exists ::times($index)]} then {
      set length [llength $::times($index)]

      if {$length > 0} then {
        set sum [expr [join $::times($index) +]]

        return [appendArgs "---- average time for workload (" $index \
            ") is about " [expr {int($sum / $length / 1000.0)}] \
            " milliseconds (" [expr {int($sum / ([info exists \
            ::iterations($index,total)] ? $::iterations($index,total) : \
            $length) / 1000.0)}] " milliseconds per iteration)\n"]
      }
    }

    return [appendArgs "---- no times for workload (" $index )\n]
  }

  #############################################################################

  proc isExpectedError { error } {
    return [expr {[regexp -- {\sno such table: t1\s} $error] || \
        [regexp -- {\sdatabase is locked\s} $error] || \
        [regexp -- {\sdatabase table is locked\s} $error]}]
  }

  #############################################################################

  proc initTest { indicator } {
    set ::eagle_tests(Constraints) $::test_constraints
  }

  #############################################################################

  proc delayTest { base extra } {
    if {$base < 0} then {
      set base 1000
    }
    if {$base > 0 || $extra > 0} then {
      after [expr {int((rand() * $base) + $extra)}]
    }
  }

  #############################################################################

  proc waitTest { indicator } {
    if {![$::event WaitOne $::timeout]} then {
      error [appendArgs "timeout while starting workload #" \
          [expr {[string ordinal $indicator 0] - [string ordinal A 0] + 1}]]
    }
  }

  #############################################################################

  proc showTest { indicator } {
    showTestWithDelay $indicator -1 $::count(2)
  }

  #############################################################################

  proc showTestWithDelay { indicator base extra } {
    if {!$::noProgress} then {
      tputs $::test_channel $indicator
    }
    append ::indicators $indicator
    delayTest $base $extra
  }

  #############################################################################

  proc doneTest { {indicator ""} } {
    if {[string length $indicator] > 0} then {
      lappend ::status(done) $indicator
    }
    if {[info exists ::status(done)]} then {
      host title $::status(done)
    } else {
      host title ""
    }
  }

  #############################################################################

  proc failTest { indicator error } {
    #
    # NOTE: Halt all testing and exit the process now
    #       -OR- just record the failure and continue?
    #
    set level [expr {[info level] - 1}]

    if {$::exitOnFail} then {
      tputs $::test_channel [appendArgs \
          \n [info level $level] ": " \n\t $error \n]

      exit failure
    } else {
      tlog [appendArgs \
          "\n---- BEGIN TEST FAILURE OUTPUT\n" \
          \n [info level $level] ": " \n\t $error \n \
          "\n---- END TEST FAILURE OUTPUT\n"]

      if {!$::noProgress} then {
        tputs $::test_channel $indicator
      }

      if {![info exists ::failures($indicator)]} then {
        set ::failures($indicator) 0
      }

      incr ::failures($indicator)
      delayTest -1 $::count(2)
    }
  }

  #############################################################################

  proc allocMem { size } {
    if {$::coTaskMem} then {
      return [object invoke -create \
          System.Runtime.InteropServices.Marshal \
          AllocCoTaskMem $size]; # throw
    } else {
      set ptr [object invoke -create -flags +NonPublic \
          System.Data.SQLite.UnsafeNativeMethods \
          sqlite3_malloc $size]

      if {[object invoke $ptr ToInt64] != 0} then {
        return $ptr
      } else {
        error [appendArgs "sqlite3_malloc(" $size ") failed"]
      }
    }
  }

  #############################################################################

  proc useMem { ptr size } {
    #
    # NOTE: This procedure does nothing on non-Windows operating systems.  It
    #       also does nothing when running on Mono or .NET Core, due to their
    #       lack of the (internal, undocumented) ZeroMemory method.
    #
    if {[isWindows] && ![isMono] && ![isDotNetCore]} then {
      #
      # HACK: The type signature of the ZeroMemory method changed as of the
      #       .NET Framework 4.5.  The second argument went from being of
      #       type UInt to type UIntPtr.
      #
      if {[haveConstraint dotNet40] && \
          [haveConstraint dotNet45OrHigher]} then {
        set newSize [object create UIntPtr $size]
      } else {
        set newSize $size
      }

      object invoke -flags +NonPublic Microsoft.Win32.Win32Native \
          ZeroMemory $ptr $newSize
    }
  }

  #############################################################################

  proc freeMem { ptr } {
    if {$::coTaskMem} then {
      object invoke System.Runtime.InteropServices.Marshal \
          FreeCoTaskMem $ptr
    } else {
      object invoke -flags +NonPublic \
          System.Data.SQLite.UnsafeNativeMethods \
          sqlite3_free $ptr
    }

    #
    # NOTE: Free extra opaque object handle reference added by the
    #       [return] command in [allocMem].
    #
    object dispose $ptr
  }

  #############################################################################

  proc releaseMem { size } {
    set nFree 0; set resetOk false; set nLargest 0

    set code [object invoke \
        System.Data.SQLite.SQLiteConnection ReleaseMemory \
        $size true true nFree resetOk nLargest]

    return [list $code $nFree $resetOk $nLargest]
  }

  #############################################################################

  proc setupLogging { fileName } {
    if {![info exists ::logListener]} then {
      set ::logListener [object create -alias \
          System.Diagnostics.TextWriterTraceListener $fileName]
    }

    object invoke System.Diagnostics.Trace.Listeners Add $::logListener
    object invoke System.Data.SQLite.SQLiteLog Initialize

    tputs $::test_channel [appendArgs \
        "---- enabled SQLite trace logging to file \"" $fileName \"\n]
  }

  #############################################################################

  proc cleanupLogging { fileName } {
    if {[info exists ::logListener]} then {
      object invoke System.Diagnostics.Trace.Listeners Remove $::logListener
      $::logListener Close
    }

    #
    # NOTE: Copy the trace listener log file to the main test log file.
    #
    if {[file exists $fileName]} then {
      tlog "---- BEGIN TRACE LISTENER OUTPUT\n"
      tlog [readFile $fileName]
      tlog "\n---- END TRACE LISTENER OUTPUT\n"
    }

    #
    # NOTE: Delete the trace listener log file because its contents have
    #       been copied to the main test log file.
    #
    cleanupFile $fileName

    tputs $::test_channel [appendArgs \
        "---- disabled SQLite trace logging to file \"" $fileName \"\n]
  }

  #############################################################################

  #
  # NOTE: Setup the default values for the tunable workload parameters.  Any,
  #       all, or none of these may be overriden via the command line.
  #
  set count(0) 3;          # Workload repeat count (i.e. total full runs).
  set count(1) 5;          # Workload iteration count (within a run).
  set count(2) 200;        # Workload iteration delay (milliseconds).
  set count(3) 57;         # Workload "small" data chunk size, in bytes.
  set count(4) 10000;      # Workload "big" data chunk size, in bytes.
  set count(5) 209715200;  # Maximum heap memory to exclude at one time.
  set count(6) 15;         # Workload auxiliary iteration count (within a run).
  set count(7) 100;        # Workload auxiliary iteration delay (milliseconds).
  set count(8) 5000;       # Workload auxiliary data value (for use by run).
  set journalMode "";      # Initial journal mode for database files.
  set pageSize "";         # Initial page size for database files.
  set noWorkload [list];   # Workloads to be omitted from the run, by index.
  set priorities [list];   # Dictionary of workload thread priorities.
  set exitOnFail false;    # Halt testing and exit process on test failure?
  set coTaskMem true;      # Use AllocCoTaskMem/FreeCoTaskMem for memory?
  set noTrace false;       # Disable SQLite trace logging to a file?
  set noProgress false;    # Disable emitting of progress indicators?
  set beginTransaction ""; # SQL just before modifying the database.
  set endTransaction "";   # SQL just after modifying the database.
  set errorTransaction ""; # SQL just after a database modification error.

  #############################################################################

  #
  # NOTE: If command line arguments to the test suite are available, process
  #       them for any options that are applicable to this test (i.e. any of
  #       the tunable workload parameters listed above).
  #
  if {[info exists argv] && [llength $argv] > 0} then {
    parse options -flags \
        {-StopOnUnknownOption +IgnoreOnUnknownOption SkipOnUnknownOption} -- \
        [list [list null MustHaveIntegerValue -1 -1 -count0 $count(0)] \
        [list null MustHaveIntegerValue -1 -1 -count1 $count(1)] \
        [list null MustHaveIntegerValue -1 -1 -count2 $count(2)] \
        [list null MustHaveIntegerValue -1 -1 -count3 $count(3)] \
        [list null MustHaveIntegerValue -1 -1 -count4 $count(4)] \
        [list null MustHaveIntegerValue -1 -1 -count5 $count(5)] \
        [list null MustHaveIntegerValue -1 -1 -count6 $count(6)] \
        [list null MustHaveIntegerValue -1 -1 -count7 $count(7)] \
        [list null MustHaveIntegerValue -1 -1 -count8 $count(8)] \
        [list null MustHaveValue -1 -1 -journalMode $journalMode] \
        [list null MustHaveIntegerValue -1 -1 -pageSize $pageSize] \
        [list null MustHaveListValue -1 -1 -noWorkload $noWorkload] \
        [list null MustHaveListValue -1 -1 -priorities $priorities] \
        [list null MustHaveBooleanValue -1 -1 -exitOnFail $exitOnFail] \
        [list null MustHaveBooleanValue -1 -1 -coTaskMem $coTaskMem] \
        [list null MustHaveBooleanValue -1 -1 -noTrace $noTrace] \
        [list null MustHaveBooleanValue -1 -1 -noProgress $noProgress] \
        [list null MustHaveValue -1 -1 -beginTransaction $beginTransaction] \
        [list null MustHaveValue -1 -1 -endTransaction $endTransaction] \
        [list null MustHaveValue -1 -1 -errorTransaction $errorTransaction]] \
        $argv

    set count(0) $options(-count0,value)
    set count(1) $options(-count1,value)
    set count(2) $options(-count2,value)
    set count(3) $options(-count3,value)
    set count(4) $options(-count4,value)
    set count(5) $options(-count5,value)
    set count(6) $options(-count6,value)
    set count(7) $options(-count7,value)
    set count(8) $options(-count8,value)
    set journalMode $options(-journalMode,value)
    set pageSize $options(-pageSize,value)
    set noWorkload $options(-noWorkload,value)
    set priorities $options(-priorities,value)
    set exitOnFail $options(-exitOnFail,value)
    set coTaskMem $options(-coTaskMem,value)
    set noTrace $options(-noTrace,value)
    set noProgress $options(-noProgress,value)
    set beginTransaction $options(-beginTransaction,value)
    set endTransaction $options(-endTransaction,value)
    set errorTransaction $options(-errorTransaction,value)
  }

  #############################################################################

  #
  # NOTE: Load custom per-user and/or per-host test settings.  Currently, this
  #       is done after processing the command line options.  The settings file
  #       should take into account the existing workload parameters and avoid
  #       changing any that may have already been overridden.
  #
  loadSQLiteTestSettings $test_channel .stress

  #############################################################################

  #
  # NOTE: The trace listener used with the SQLiteLog class to capture output
  #       from the core SQLite library requires its own log file because the
  #       TextWriterTraceListener class opens and locks the log file it uses
  #       as the basis of the output stream.  Before this test is complete,
  #       the entire contents of this trace log file will be copied into the
  #       main test log file and then deleted.
  #
  if {!$noTrace} then {
    set logFileName [appendArgs [file rootname $test_log] .trace.log]
    setupLogging $logFileName
  }

  #############################################################################

  #
  # HACK: Make sure the effective connection flags for this test are logged.
  #
  getConnectionFlags "stress test" "" false; # IGNORED

  #############################################################################

  #
  # NOTE: In shared-cache mode, skip the backup tests.  The SQLite core library
  #       documentation states:
  #
  #       "If running in shared cache mode, the application must guarantee
  #        that the shared cache used by the destination database is not
  #        accessed while the backup is running. In practice this means that
  #        the application must guarantee that the disk file being backed up
  #        to is not accessed by any connection within the process, not just
  #        the specific connection that was passed to sqlite3_backup_init()."
  #
  #       The only reasonable way that this test can guarantee this condition
  #       is to disable the backup tests when shared-cache mode is being used
  #       for testing.
  #
  # TODO: Update these if the workload numbers change.
  #
  if {[hasRuntimeOption sharedCache] || [hasRuntimeOption dmlOnly]} then {
    lappend noWorkload 12; # NOTE: Backup to in-memory database.
    lappend noWorkload 13; # NOTE: Backup from in-memory database.
  }

  #
  # NOTE: Omit some workloads if we are only interested in data manipulation
  #       (DML) statements.
  #
  # TODO: Update these if the workload numbers change.
  #
  if {[hasRuntimeOption dmlOnly]} then {
    lappend noWorkload  1; # NOTE: CREATE TABLE
    lappend noWorkload  2; # NOTE: DROP TABLE
    lappend noWorkload 17; # NOTE: PRAGMA journal_mode
    lappend noWorkload 22; # NOTE: PRAGMA default_cache_size
  }

  #############################################################################

  tputs $test_channel [appendArgs \
      "---- workloads will repeat " $count(0) " time(s)\n"]

  tputs $test_channel [appendArgs \
      "---- workloads will have " $count(1) " iteration(s)\n"]

  tputs $test_channel [appendArgs \
      "---- workloads will wait at least " $count(2) \
      " millisecond(s) after each iteration\n"]

  tputs $test_channel [appendArgs \
      "---- small chunk size is " $count(3) " byte(s)\n"]

  tputs $test_channel [appendArgs \
      "---- big chunk size is " $count(4) " byte(s)\n"]

  tputs $test_channel [appendArgs \
      "---- maximum excluded heap memory is " $count(5) " byte(s)\n"]

  tputs $test_channel [appendArgs \
      "---- workloads will have an auxiliary iteration count of " \
      $count(6) \n]

  tputs $test_channel [appendArgs \
      "---- workloads will have an auxiliary iteration delay of " \
      $count(7) " millisecond(s)\n"]

  tputs $test_channel [appendArgs \
      "---- workloads will have an auxiliary data value of " \
      $count(8) \n]

  tputs $test_channel [appendArgs \
      "---- the initial journal mode is " \
      [expr {[string length $journalMode] > 0 ? $journalMode : "none"}] \n]

  tputs $test_channel [appendArgs \
      "---- the initial page size is " \
      [expr {[string length $pageSize] > 0 ? $pageSize : "none"}] \n]

  tputs $test_channel [appendArgs \
      "---- workloads to be skipped... " \
      [expr {[llength $noWorkload] > 0 ? $noWorkload : "none"}] \n]

  tputs $test_channel [appendArgs \
      "---- workloads priority overrides... " \
      [expr {[llength $priorities] > 0 ? $priorities : "none"}] \n]

  tputs $test_channel [appendArgs \
      "---- unexpected errors " \
      [expr {$exitOnFail ? "will" : "will not"}] \
      " halt testing and exit the process\n"]

  tputs $test_channel [appendArgs \
      "---- the " [expr {$coTaskMem ? "CoTaskMem" : "SQLite"}] \
      " allocator will be used to exclude heap memory\n"]

  tputs $test_channel [appendArgs \
      "---- trace logging to a file is " \
      [expr {$noTrace ? "disabled" : "enabled"}] \n]

  tputs $test_channel [appendArgs \
      "---- progress indicators are " \
      [expr {$noProgress ? "disabled" : "enabled"}] \n]

  tputs $test_channel [appendArgs \
      "---- begin transaction SQL is " \
      [expr {[string length $beginTransaction] > 0 ? \
      [appendArgs \" $beginTransaction \"] : "none"}] \n]

  tputs $test_channel [appendArgs \
      "---- end transaction SQL is " \
      [expr {[string length $endTransaction] > 0 ? \
      [appendArgs \" $endTransaction \"] : "none"}] \n]

  tputs $test_channel [appendArgs \
      "---- error transaction SQL is " \
      [expr {[string length $errorTransaction] > 0 ? \
      [appendArgs \" $errorTransaction \"] : "none"}] \n]

  #############################################################################

  #
  # NOTE: Create the workload priority array based on the priority list seen
  #       on the command line, if any.
  #
  array set priority $priorities

  #############################################################################

  #
  # NOTE: Workloads #12 and #13 contain C# code that should be compiled, but
  #       only once.  These variables keep track of that state information.
  #       An integer value in one of these variables means the compilation was
  #       completed and the resulting compiled method may be invoked using the
  #       following command (where ${id} is the value of the variable):
  #
  #           object invoke _Dynamic${id}.Test${id} BackupAndGetData
  #
  set compiled(12) ""
  set compiled(13) ""

  #############################################################################

  #
  # NOTE: This is an in-memory database with shared cache enabled.
  #
  set fileName(1) file::memory:?cache=shared

  #############################################################################

  #
  # NOTE: This is a normal on-disk database.
  #
  set fileName(2) [file join [getDatabaseDirectory] [appendArgs \
      stress- [pid] - [string trim [clock seconds] -] .db]]

  #############################################################################

  setupWorkloadMemDb $fileName(1) srcDb
  setupWorkloadFileDb $fileName(2) db

  #############################################################################

  #
  # NOTE: This serves two purposes.  First, it allows us to verify the trace
  #       logging subsystem is working properly.  Second, it places the file
  #       name for the associated database file into the trace log file.
  #
  set connection [getDbConnection]

  $connection LogMessage 0 [appendArgs \
      "starting stress test using database \"" $fileName(2) \"...]

  #############################################################################

  set timeout [object invoke -flags +NonPublic \
      Eagle._Components.Private.ThreadOps DefaultJoinTimeout]

  tputs $test_channel [appendArgs \
      "---- workloads will start before or timeout after " $timeout \
      " millisecond(s)\n"]

  #############################################################################

  set event [object create -alias \
      System.Threading.EventWaitHandle false ManualReset]

  #############################################################################
  #                              WORKLOAD #1 (A)                              #
  #############################################################################

  set workload(1) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #1, CREATE TABLE statements.
    #
    waitTest A
    lappend ::times(1) [lindex [time {
      initTest A
      setupWorkloadFileDb $dstFileName db
      for {set index 4} {$index <= $count1} {incr index} {
        if {[catch {
          sql execute $db [appendArgs \
              "CREATE TABLE IF NOT EXISTS t" \
              $index "(x PRIMARY KEY, y, z);"]
          showTest A
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest a
          } else {
            failTest a $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest A
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #2 (B)                              #
  #############################################################################

  set workload(2) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #2, DROP TABLE statements.
    #
    waitTest B
    lappend ::times(2) [lindex [time {
      initTest B
      setupWorkloadFileDb $dstFileName db
      for {set index 4} {$index <= $count1} {incr index} {
        if {[catch {
          sql execute $db [appendArgs \
              "DROP TABLE IF EXISTS t" $index \;]
          showTest B
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest b
          } else {
            failTest b $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest B
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #3 (C)                              #
  #############################################################################

  set workload(3) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #3, "small" SELECT statements.
    #
    waitTest C
    lappend ::times(3) [lindex [time {
      initTest C
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          set reader [sql execute -execute reader \
              -format dataReader -alias $db [appendArgs \
              "SELECT x, y FROM " $table " WHERE z = 'small';"]]
          while {[$reader Read]} {
            #
            # NOTE: Do nothing.
            #
          }
          unset -nocomplain reader
          showTest C
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest c
          } else {
            failTest c $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest C
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #4 (D)                              #
  #############################################################################

  set workload(4) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #4, "big" SELECT statements.
    #
    waitTest D
    lappend ::times(4) [lindex [time {
      initTest D
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          set reader [sql execute -execute reader \
              -format dataReader -alias $db [appendArgs \
              "SELECT x, y FROM " $table " WHERE z = 'big';"]]
          while {[$reader Read]} {
            #
            # NOTE: Do nothing.
            #
          }
          unset -nocomplain reader
          showTest D
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest d
          } else {
            failTest d $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest D
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #5 (E)                              #
  #############################################################################

  set workload(5) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #5, "small" INSERT statements.
    #
    waitTest E
    lappend ::times(5) [lindex [time {
      initTest E
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          beginTransaction $db
          sql execute $db [appendArgs "INSERT INTO " $table \
              "(x, y, z) VALUES('" [format %lX [expr {random()}]] \
              "', '" [base64 encode -- [expr {randstr($count2)}]] \
              "', 'small');"]
          endTransaction $db
          showTest E
        } error]} then {
          catch {errorTransaction $db}
          if {[isExpectedError $error]} then {
            showTest e
          } else {
            failTest e $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest E
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #6 (F)                              #
  #############################################################################

  set workload(6) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #6, "big" INSERT statements.
    #
    waitTest F
    lappend ::times(6) [lindex [time {
      initTest F
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          beginTransaction $db
          sql execute $db [appendArgs "INSERT INTO " $table \
              "(x, y, z) VALUES('" [format %lX [expr {random()}]] \
              "', RANDOMBLOB(" $count3 "), 'big');"]
          endTransaction $db
          showTest F
        } error]} then {
          catch {errorTransaction $db}
          if {[isExpectedError $error]} then {
            showTest f
          } else {
            failTest f $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest F
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #7 (G)                              #
  #############################################################################

  set workload(7) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #7, "small" UPDATE statements.
    #
    waitTest G
    lappend ::times(7) [lindex [time {
      initTest G
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          beginTransaction $db
          sql execute $db [appendArgs "UPDATE " $table \
              " SET y = '" [base64 encode -- [expr {randstr($count2)}]] \
              "' WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
          endTransaction $db
          showTest G
        } error]} then {
          catch {errorTransaction $db}
          if {[isExpectedError $error]} then {
            showTest g
          } else {
            failTest g $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest G
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #8 (H)                              #
  #############################################################################

  set workload(8) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #8, "big" UPDATE statements.
    #
    waitTest H
    lappend ::times(8) [lindex [time {
      initTest H
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          beginTransaction $db
          sql execute $db [appendArgs "UPDATE " $table \
              " SET y = RANDOMBLOB(" $count3 ") WHERE x LIKE '" \
              [format %X $index] "%' AND z = 'big';"]
          endTransaction $db
          showTest H
        } error]} then {
          catch {errorTransaction $db}
          if {[isExpectedError $error]} then {
            showTest h
          } else {
            failTest h $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest H
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #9 (I)                              #
  #############################################################################

  set workload(9) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #9, "small" DELETE statements.
    #
    waitTest I
    lappend ::times(9) [lindex [time {
      initTest I
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          beginTransaction $db
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
          endTransaction $db
          showTest I
        } error]} then {
          catch {errorTransaction $db}
          if {[isExpectedError $error]} then {
            showTest i
          } else {
            failTest i $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest I
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #10 (J)                             #
  #############################################################################

  set workload(10) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #10, "big" DELETE statements.
    #
    waitTest J
    lappend ::times(10) [lindex [time {
      initTest J
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          beginTransaction $db
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'big';"]
          endTransaction $db
          showTest J
        } error]} then {
          catch {errorTransaction $db}
          if {[isExpectedError $error]} then {
            showTest j
          } else {
            failTest j $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest J
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #11 (K)                             #
  #############################################################################

  set workload(11) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #11, VACUUM statement.
    #
    waitTest K
    lappend ::times(11) [lindex [time {
      initTest K
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          sql execute $db "VACUUM;"
          showTest K
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest k
          } else {
            failTest k $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest K
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #12 (L)                             #
  #############################################################################

  set workload(12) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #12, backup to in-memory database.
    #
    waitTest L
    lappend ::times(12) [lindex [time {
      initTest L
      for {set index 1} {$index <= $count1} {incr index} {
        if {[string is integer -strict $::compiled(12)]} then {
          set id $::compiled(12); # NOTE: Already compiled.
          if {[catchCSharp {
            object invoke _Dynamic${id}.Test${id} BackupAndGetData
            showTest L
          } error "" false]} then {
            if {[isExpectedError $error]} then {
              showTest l
            } else {
              failTest l $error
            }
          }
        } else {
          set id [object invoke Interpreter.GetActive NextId]
          set code [compileCSharpWith [subst {
            using System.Data.SQLite;

            namespace _Dynamic${id}
            {
              public static class Test${id}
              {
                public static void BackupAndGetData()
                {
                  using (SQLiteConnection source = new SQLiteConnection(
                      "FullUri=${dstFileName};[getTestProperties {} {} true]"))
                  {
                    source.Open();

                    using (SQLiteConnection destination = new SQLiteConnection(
                        "FullUri=${srcFileName};[getTestProperties {} {} true]"))
                    {
                      destination.Open();

                      source.BackupDatabase(
                          destination, "main", "main", -1, null, 0);
                    }
                  }
                }

                ///////////////////////////////////////////////////////////////

                public static void Main()
                {
                  // do nothing.
                }
              }
            }
          }] true false true results errors System.Data.SQLite.dll]
          if {$code eq "Ok"} then {
            set ::compiled(12) $id; # NOTE: Compiled OK.
            if {[catchCSharp {
              object invoke _Dynamic${id}.Test${id} BackupAndGetData
              showTest L
            } error "" false]} then {
              if {[isExpectedError $error]} then {
                showTest l
              } else {
                failTest l $error
              }
            }
          } else {
            error $errors
          }
        }
      }
      doneTest L
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #13 (M)                             #
  #############################################################################

  set workload(13) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #13, backup from an in-memory database.
    #
    waitTest M
    lappend ::times(13) [lindex [time {
      initTest M
      for {set index 1} {$index <= $count1} {incr index} {
        if {[string is integer -strict $::compiled(13)]} then {
          set id $::compiled(13); # NOTE: Already compiled.
          if {[catchCSharp {
            object invoke _Dynamic${id}.Test${id} BackupAndGetData
            showTest M
          } error "" false]} then {
            if {[isExpectedError $error]} then {
              showTest m
            } else {
              failTest m $error
            }
          }
        } else {
          set id [object invoke Interpreter.GetActive NextId]
          set code [compileCSharpWith [subst {
            using System.Data.SQLite;

            namespace _Dynamic${id}
            {
              public static class Test${id}
              {
                public static void BackupAndGetData()
                {
                  using (SQLiteConnection source = new SQLiteConnection(
                      "FullUri=${srcFileName};[getTestProperties {} {} true]"))
                  {
                    source.Open();

                    using (SQLiteConnection destination = new SQLiteConnection(
                        "FullUri=${dstFileName};[getTestProperties {} {} true]"))
                    {
                      destination.Open();

                      source.BackupDatabase(
                          destination, "main", "main", -1, null, 0);
                    }
                  }
                }

                ///////////////////////////////////////////////////////////////

                public static void Main()
                {
                  // do nothing.
                }
              }
            }
          }] true false true results errors System.Data.SQLite.dll]
          if {$code eq "Ok"} then {
            set ::compiled(13) $id; # NOTE: Compiled OK.
            if {[catchCSharp {
              object invoke _Dynamic${id}.Test${id} BackupAndGetData
              showTest M
            } error "" false]} then {
              if {[isExpectedError $error]} then {
                showTest m
              } else {
                failTest m $error
              }
            }
          } else {
            error $errors
          }
        }
      }
      doneTest M
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #14 (N)                             #
  #############################################################################

  set workload(14) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #14, PRAGMA integrity check statement.
    #
    waitTest N
    lappend ::times(14) [lindex [time {
      initTest N
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          set result [sql execute -execute scalar $db \
              "PRAGMA integrity_check;"]
          if {$result ne "ok"} then {
            error [appendArgs "integrity check failed: " $result]
          }
          showTest N
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest n
          } else {
            failTest n $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest N
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #15 (O)                             #
  #############################################################################

  set workload(15) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #15, force managed garbage collection
    #
    waitTest O
    lappend ::times(15) [lindex [time {
      initTest O
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          collectGarbage $::test_channel
          showTest O
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest o
          } else {
            failTest o $error
          }
        }
      }
      doneTest O
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #16 (P)                             #
  #############################################################################

  set workload(16) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #16, allocate (exclude) some native heap memory
    #
    waitTest P
    lappend ::times(16) [lindex [time {
      initTest P
      set maxSize $count4
      object invoke GC AddMemoryPressure $maxSize
      try {
        for {set index 1} {$index <= $count1} {incr index} {
          if {[catch {
            set size [expr {int(min($maxSize, abs($count3 * $index * 5.0)))}]
            set ptr [allocMem $size]; # throw
            useMem $ptr $size; delayTest -1 $count2
            freeMem $ptr; unset -nocomplain ptr
            showTest P
          } error]} then {
            if {[isExpectedError $error]} then {
              showTest p
            } else {
              failTest p $error
            }
          }
        }
      } finally {
        if {[info exists ptr]} then {
          freeMem $ptr; unset -nocomplain ptr
        }
        object invoke GC RemoveMemoryPressure $maxSize
      }
      doneTest P
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #17 (Q)                             #
  #############################################################################

  set workload(17) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #17, change the database journal mode
    #
    waitTest Q
    lappend ::times(17) [lindex [time {
      initTest Q
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          sql execute $db [appendArgs "PRAGMA journal_mode = \"" \
              [expr {$index % 2 == 0 ? "delete" : "wal"}] \"\;]
          showTest Q
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest q
          } else {
            failTest q $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest Q
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #18 (R)                             #
  #############################################################################

  set workload(18) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #18, execute queries against the in-memory database
    #
    waitTest R
    lappend ::times(18) [lindex [time {
      initTest R
      setupWorkloadMemDb $srcFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          #
          # NOTE: Maybe start a new transaction.
          #
          beginTransaction $db
          #
          # NOTE: Workload #18.3, "small" SELECT statements.
          #
          set reader [sql execute -execute reader \
              -format dataReader -alias $db [appendArgs \
              "SELECT x, y FROM " $table " WHERE z = 'small';"]]
          while {[$reader Read]} {
            #
            # NOTE: Do nothing.
            #
          }
          unset -nocomplain reader
          #
          # NOTE: Workload #18.4, "big" SELECT statements.
          #
          set reader [sql execute -execute reader \
              -format dataReader -alias $db [appendArgs \
              "SELECT x, y FROM " $table " WHERE z = 'big';"]]
          while {[$reader Read]} {
            #
            # NOTE: Do nothing.
            #
          }
          unset -nocomplain reader
          #
          # NOTE: Workload #18.5, "small" INSERT statements.
          #
          sql execute $db [appendArgs "INSERT INTO " $table \
              "(x, y, z) VALUES('" [format %lX [expr {random()}]] \
              "', '" [base64 encode -- [expr {randstr($count2)}]] \
              "', 'small');"]
          #
          # NOTE: Workload #18.6, "big" INSERT statements.
          #
          sql execute $db [appendArgs "INSERT INTO " $table \
              "(x, y, z) VALUES('" [format %lX [expr {random()}]] \
              "', RANDOMBLOB(" $count3 "), 'big');"]
          #
          # NOTE: Workload #18.7, "small" UPDATE statements.
          #
          sql execute $db [appendArgs "UPDATE " $table \
              " SET y = '" [base64 encode -- [expr {randstr($count2)}]] \
              "' WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
          #
          # NOTE: Workload #18.8, "big" UPDATE statements.
          #
          sql execute $db [appendArgs "UPDATE " $table \
              " SET y = RANDOMBLOB(" $count3 ") WHERE x LIKE '" \
              [format %X $index] "%' AND z = 'big';"]
          #
          # NOTE: Workload #18.9, "small" DELETE statements.
          #
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'small';"]
          #
          # NOTE: Workload #18.10, "big" DELETE statements.
          #
          sql execute $db [appendArgs "DELETE FROM " $table \
              " WHERE x LIKE '" [format %X $index] "%' AND z = 'big';"]
          #
          # NOTE: Maybe end the current transaction.
          #
          endTransaction $db
          #
          # NOTE: Workload #18.11, VACUUM statement.
          #
          sql execute $db "VACUUM;"
          #
          # NOTE: Workload #18.14, PRAGMA integrity check statement.
          #
          set result [sql execute -execute scalar $db \
              "PRAGMA integrity_check;"]
          if {$result ne "ok"} then {
            error [appendArgs "integrity check failed: " $result]
          }
          showTest R
        } error]} then {
          catch {errorTransaction $db}
          if {[isExpectedError $error]} then {
            showTest r
          } else {
            failTest r $error
          }
        }
      }
      cleanupDb $srcFileName db false true false
      doneTest R
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #19 (S)                             #
  #############################################################################

  set workload(19) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #19, rapidly open/close connections, thread #1.
    #
    waitTest S
    lappend ::times(19) [lindex [time {
      initTest S
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          setupWorkloadFileDb $dstFileName db
          cleanupDb $dstFileName db false true false
          showTest S
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest s
          } else {
            failTest s $error
          }
        }
      }
      doneTest S
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #20 (T)                             #
  #############################################################################

  set workload(20) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #20, rapidly open/close connections, thread #2.
    #
    waitTest T
    lappend ::times(20) [lindex [time {
      initTest T
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          setupWorkloadFileDb $dstFileName db
          cleanupDb $dstFileName db false true false
          showTest T
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest t
          } else {
            failTest t $error
          }
        }
      }
      doneTest T
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #21 (U)                             #
  #############################################################################

  set workload(21) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #21, rapidly try to release all non-essential memory.
    #
    waitTest U
    lappend ::times(21) [lindex [time {
      initTest U
      for {set index 1} {$index <= $count5} {incr index} {
        if {[catch {
          releaseMem -1
          showTestWithDelay U 0 $count6
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest u
          } else {
            failTest u $error
          }
        }
      }
      doneTest U
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #22 (V)                             #
  #############################################################################

  set workload(22) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #22, rapidly try to change the default cache size.
    #
    waitTest V
    lappend ::times(22) [lindex [time {
      initTest V
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count5} {incr index} {
        if {[catch {
          sql execute $db [appendArgs \
              "PRAGMA default_cache_size=" \
              [expr {int(rand() * $count7)}] \;]
          showTestWithDelay V 0 $count6
        } error]} then {
          if {[isExpectedError $error]} then {
            showTest v
          } else {
            failTest v $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest V
    }] 0]
  }]

  #############################################################################
  #                              WORKLOAD #23 (W)                             #
  #############################################################################

  set workload(23) [list \
      [list srcFileName dstFileName table count1 count2 count3 \
            count4 count5 count6 count7] {
    #
    # NOTE: Workload #23, "big" INSERT and DELETE statements.
    #
    waitTest W
    lappend ::times(23) [lindex [time {
      initTest W
      setupWorkloadFileDb $dstFileName db
      for {set index 1} {$index <= $count1} {incr index} {
        if {[catch {
          beginTransaction $db
          sql execute $db [appendArgs \
              "WITH s(i) AS " \
              "(SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<" \
              $count5 ") INSERT INTO t2 SELECT RANDOMBLOB(" $count3 \
              ") FROM s; WITH s(i) AS " \
              "(SELECT 1 UNION ALL SELECT i+1 FROM s WHERE i<" \
              $count5 ") INSERT INTO t3 SELECT RANDOMBLOB(" $count3 \
              ") FROM s; DELETE FROM t3;"]
          endTransaction $db
          showTest W
        } error]} then {
          catch {errorTransaction $db}
          if {[isExpectedError $error]} then {
            showTest w
          } else {
            failTest w $error
          }
        }
      }
      cleanupDb $dstFileName db false true false
      doneTest W
    }] 0]
  }]
} -body {
  set workloadNames(all) [array names workload]

  tputs $test_channel [appendArgs \
      "---- there are " [llength $workloadNames(all)] \
      " total workloads, their names are: " $workloadNames(all) \n]

  set workloadNames(enabled) [list]

  foreach index(0) [lsort -integer $workloadNames(all)] {
    if {[lsearch -exact $noWorkload $index(0)] == -1} then {
      lappend workloadNames(enabled) $index(0)
    }
  }

  tputs $test_channel [appendArgs \
      "---- there are " [llength $workloadNames(enabled)] \
      " enabled workloads, their names are: " $workloadNames(enabled) \n]

  tputs $test_channel [appendArgs \
      "==== WARNING: this stress test may take several minutes...\n"]

  for {set index(0) 1} {$index(0) <= $count(0)} {incr index(0)} {
    if {!$noProgress && $index(0) > 1} then {
      #
      # NOTE: Advance output to the next line due to the workload
      #       iteration progress indicators from the previous run.
      #
      tputs $test_channel \n
    }

    tputs $test_channel [appendArgs \
        "---- starting workload run #" $index(0) ...\n]

    unset -nocomplain thread status; doneTest

    sql execute $srcDb "CREATE TABLE IF NOT EXISTS t1(x PRIMARY KEY, y, z);"
    sql execute $srcDb "CREATE TABLE IF NOT EXISTS t2(x);"
    sql execute $srcDb "CREATE TABLE IF NOT EXISTS t3(x);"
    sql execute $db "CREATE TABLE IF NOT EXISTS t1(x PRIMARY KEY, y, z);"
    sql execute $db "CREATE TABLE IF NOT EXISTS t2(x);"
    sql execute $db "CREATE TABLE IF NOT EXISTS t3(x);"

    sql execute $srcDb "CREATE INDEX IF NOT EXISTS i1 ON t1(y);"
    sql execute $db "CREATE INDEX IF NOT EXISTS i1 ON t1(y);"

    foreach index(1) [lsort -integer $workloadNames(enabled)] {
      set workloadCallbacks($index(1)) [list \
          apply $workload($index(1)) $fileName(1) $fileName(2) t1 \
          $count(1) $count(3) $count(4) $count(5) $count(6) $count(7) \
          $count(8)]

      set thread($index(1)) [createThread $workloadCallbacks($index(1)) \
          false 1048576]

      $thread($index(1)) Name [appendArgs \
          [file rootname [file tail $fileName(2)]] " #" $index(1)]

      if {[info exists priority($index(1))]} then {
        $thread($index(1)) Priority $priority($index(1))
      }
    }

    foreach index(1) [array names thread] {
      startThread $thread($index(1))
    }

    $event Set; # GO

    foreach index(1) [array names thread] {
      $thread($index(1)) Join
    }

    foreach index(1) [array names thread] {
      if {[info exists thread($index(1))] && \
          [cleanupThread $thread($index(1))]} then {
        unset -nocomplain thread($index(1))
      }
    }

    unset -nocomplain thread status; doneTest
  }

  #############################################################################

  foreach index(0) [split $indicators ""] {
    #
    # NOTE: See if this workload iteration raised an error.  If so, the
    #       indicator letter will be in lower case; otherwise, it will
    #       be in upper case.
    #
    set index(1) [string is upper -strict $index(0)]

    set index(2) [expr {[string ordinal $index(0) 0] - \
        [string ordinal [expr {$index(1) ? "A" : "a"}] 0] + 1}]

    set index(3) [expr {$index(1) ? "ok" : "error"}]

    if {![info exists iterations($index(2),$index(3))]} then {
      set iterations($index(2),$index(3)) 0
    }

    if {![info exists iterations($index(2),total)]} then {
      set iterations($index(2),total) 0
    }

    incr iterations($index(2),$index(3))
    incr iterations($index(2),total)
  }

  #############################################################################

  if {!$noProgress} then {
    #
    # NOTE: Advance output to the next line due to the workload
    #       iteration progress indicators from the final run.
    #
    tputs $test_channel \n
  }

  #############################################################################

  foreach index(0) [lsort -integer $workloadNames(enabled)] {
    tputs $test_channel [formatWorkloadResult $index(0)]
  }

  #############################################################################

  foreach index(0) [lsort -integer [array names times]] {
    tputs $test_channel [formatWorkloadTime $index(0)]
  }

  #############################################################################

  set result [sql execute -execute scalar $srcDb "PRAGMA integrity_check;"]

  if {$result eq "ok"} then {
    tputs $test_channel "---- integrity check ok (srcDb)\n"
  } else {
    error [appendArgs "integrity check failed (srcDb): " $result]
  }

  #############################################################################

  set result [sql execute -execute scalar $db "PRAGMA integrity_check;"]

  if {$result eq "ok"} then {
    tputs $test_channel "---- integrity check ok (db)\n"
  } else {
    error [appendArgs "integrity check failed (db): " $result]
  }

  #############################################################################

  #
  # NOTE: The overall test result is the total number of failures (i.e.
  #       "unexpected errors") encountered during a workload iteration.
  #
  expr {[array size failures] > 0 ? \
      [expr [join [array values failures] +]] : 0}
} -cleanup {
  foreach index(0) [array names thread] {
    if {[info exists thread($index(0))] && \
        [cleanupThread $thread($index(0))]} then {
      unset -nocomplain thread($index(0))
    }
  }

  rename releaseMem ""
  rename freeMem ""
  rename useMem ""
  rename allocMem ""
  rename failTest ""
  rename doneTest ""
  rename showTestWithDelay ""
  rename showTest ""
  rename waitTest ""
  rename delayTest ""
  rename initTest ""
  rename isExpectedError ""
  rename formatWorkloadTime ""
  rename formatWorkloadResult ""
  rename errorTransaction ""
  rename endTransaction ""
  rename beginTransaction ""
  rename setupWorkloadFileDb ""
  rename setupWorkloadMemDb ""

  catch {
    #
    # NOTE: We must clear the connection pool now because we intend
    #       to delete the databases for this test.
    #
    object invoke System.Data.SQLite.SQLiteConnection ClearAllPools
  }

  cleanupDb $fileName(2)
  cleanupDb $fileName(1) srcDb

  foreach index(0) [array names workloadCallbacks] {
    catch {
      object removecallback $workloadCallbacks($index(0))
    }
  }

  freeDbConnection

  if {!$noTrace} then {
    cleanupLogging $logFileName
  }

  rename cleanupLogging ""
  rename setupLogging ""

  unset -nocomplain result thread index workload priority journalMode \
      pageSize noWorkload priorities srcDb db fileName compiled options \
      count times logFileName logListener event timeout connection \
      indicators iterations exitOnFail coTaskMem noTrace noProgress \
      beginTransaction endTransaction errorTransaction failures status \
      workloadNames workloadCallbacks
} -time true -constraints {eagle command.object monoBug40 command.sql\
compile.DATA compile.THREADING SQLite System.Data.SQLite compileCSharp} \
-result {0}}

###############################################################################

#
# NOTE: Report after test.
#
checkForSQLiteDirectories $test_channel
getSQLiteHandleCounts $test_channel
reportSQLiteResources $test_channel

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/template/empty.eagle.













































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
###############################################################################
#
# empty.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

#
# NOTE: There are no unit tests in this file.  This file exists to serve two
#       purposes:
#
#       1. Provide a "template" script file that can be used when creating new
#          unit test files.
#
#       2. Provide a script file that can be evaluated to setup an interactive
#          environment for ad-hoc testing of System.Data.SQLite using the Eagle
#          Shell.
#

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/thread.eagle.









































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
###############################################################################
#
# thread.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

checkForSQLiteDirectories $test_channel true
set handle_counts [getSQLiteHandleCounts $test_channel]
set memory_used [reportSQLiteResources $test_channel]

###############################################################################

#
# NOTE: How many test threads should be created and used for these tests?  This
#       value must be at least two.  The first test thread (at index 0) is
#       always the "master thread" and just repeatedly calls the Thread.Abort()
#       method on other random test threads that appear to be alive until all
#       test threads appear to have died.  All other test threads will attempt
#       to open a connection, execute one or more queries against it, and then
#       close it.
#
if {![info exists count(1)]} then {
  set count(1) 10
}

#
# NOTE: How many milliseconds should the master thread initially wait until it
#       starts to abort the other test threads?
#
if {![info exists count(2)]} then {
  set count(2) 1000
}

#
# NOTE: How many milliseconds (maximum) should the master thread wait between
#       aborting other random test threads?
#
if {![info exists count(3)]} then {
  set count(3) 1000
}

#
# NOTE: How many bytes should be used for the five random data blobs contained
#       in the test database?
#
if {![info exists count(4)]} then {
  set count(4) 1000
}

###############################################################################

#
# NOTE: This test is disabled for .NET Core due to its lack of support for
#       the Thread.Abort method (i.e. throws PlatformNotSupportedException
#       when called).
#
runTest {test thread-1.1 {Thread.Abort() impact on native resources} -setup {
  setupDb [set fileName thread-1.1.db]

  tputs $test_channel [appendArgs \
      "---- using " $count(1) " test threads (with one master thread)\n"]

  tputs $test_channel [appendArgs \
      "---- initial wait will be " $count(2) " milliseconds\n"]

  tputs $test_channel [appendArgs \
      "---- subsequent maximum wait will be " $count(3) " milliseconds\n"]

  tputs $test_channel [appendArgs \
      "---- random data blob size will be " $count(4) " bytes\n"]
} -body {
  sql execute $db [subst {
    CREATE TABLE t1(x INTEGER PRIMARY KEY, y BLOB);
    INSERT INTO t1 (y) VALUES(RANDOMBLOB(${count(4)}));
    INSERT INTO t1 (y) VALUES(RANDOMBLOB(${count(4)}));
    INSERT INTO t1 (y) VALUES(RANDOMBLOB(${count(4)}));
    INSERT INTO t1 (y) VALUES(RANDOMBLOB(${count(4)}));
    INSERT INTO t1 (y) VALUES(RANDOMBLOB(${count(4)}));
  }]

  #
  # NOTE: The data and temporary directories must be reset here (after the
  #       setupDb call above) because they allocate some SQLite memory and
  #       this test requires an extremely accurate reading.
  #
  sql execute $db {
    PRAGMA data_store_directory = "";
    PRAGMA temp_store_directory = "";
  }

  #
  # NOTE: Close the database now, freeing any native SQLite memory and/or
  #       resources that it may be using at this point; however, do not
  #       actually delete the database file because it is needed in the C#
  #       code for this test.
  #
  cleanupDb $fileName db true false false; unset -nocomplain db

  #
  # NOTE: Setup the variables used in the dynamically substituted C# code
  #       for the main body of this test (below).
  #
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    SELECT x, y FROM t1 ORDER BY x; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Collections.Generic;
    using System.Data.SQLite;
    using System.Diagnostics;
    using System.Threading;
    using Eagle._Containers.Public;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static LongList RunTestThreads()
        {
          //
          // NOTE: This is the total number of data bytes seen in the second
          //       column of the query result rows seen by all test threads.
          //       This value will vary greatly based upon how many loop
          //       iterations are performed prior to each test thread being
          //       aborted.
          //
          long sum = 0;

          //
          // NOTE: This is the total number of query result rows seen by all
          //       the test threads.
          //
          long rows = 0;

          //
          // NOTE: This is the total number of exceptions caught by all the
          //       test threads.
          //
          long errors = 0;

          //
          // NOTE: This is the total number of test threads to create.
          //
          int count = ${count(1)};

          //
          // NOTE: Create the array of thread objects.
          //
          Thread\[\] thread = new Thread\[count\];

          //
          // NOTE: Create a random number generator suitable for waiting a
          //       random number of milliseconds between each loop iteration
          //       and then selecting a random thread index.
          //
          Random random = new Random();

          //
          // NOTE: Create the event that will be used to synchronize all the
          //       created threads so that they start doing their actual test
          //       "work" at approximately the same time.  This is also used
          //       to make sure that all test threads are inside of a try
          //       block before attempting to abort them.
          //
          using (ManualResetEvent goEvent = new ManualResetEvent(false))
          {
            //
            // NOTE: Create a (reusable) delegate that will contain the code
            //       that most of the created test threads are to execute.
            //       This code will open, use, and close a single database
            //       connection.  Multiple commands and data readers will also
            //       be used.
            //
            ThreadStart threadStart1 = delegate()
            {
              try
              {
                //
                // NOTE: Wait forever for the "GO" signal so that all threads
                //       can start working at approximately the same time.
                //       This is also used to make sure that all test threads
                //       are inside of a try block before attempting to abort
                //       them.
                //
                goEvent.WaitOne();

                //
                // NOTE: Create a new connection object.  We purposely avoid
                //       putting this inside a "using" block to help test our
                //       cleanup via the garbage collector.
                //
                SQLiteConnection connection = new SQLiteConnection(
                    "Data Source=${dataSource};[getTestProperties]");

                //
                // NOTE: Open the connection.  After this point, native memory
                //       and resources have been allocated by this thread.
                //
                connection.Open();

                //
                // NOTE: Loop forever until the first thread signals us to stop
                //       via calling Thread.Abort() method on our associated
                //       thread object.
                //
                while (true)
                {
                  //
                  // NOTE: Create a dictionary to temporarily hold the values
                  //       from the data reader for this loop iteration.
                  //
                  Dictionary<long, byte\[\]> results =
                      new Dictionary<long, byte\[\]>();

                  //
                  // NOTE: Create a new command object using the connection
                  //       object for this thread.  Again, avoid putting this
                  //       inside a "using" block to help test our cleanup via
                  //       the garbage collector.
                  //
                  SQLiteCommand command = new SQLiteCommand("${sql}",
                      connection);

                  //
                  // NOTE: Execute the query and get the resulting data reader
                  //       object.  Again, avoid putting this inside a "using"
                  //       block to help test our cleanup via the garbage
                  //       collector.
                  //
                  SQLiteDataReader reader = command.ExecuteReader();

                  //
                  // NOTE: Start processing each available query result row.
                  //       This processing (or any of the above processing)
                  //       may be stopped at any time due to this test thread
                  //       being aborted.
                  //
                  while (reader.Read())
                  {
                    results.Add((long)reader\["x"\],
                        reader\["y"\] as byte\[\]);

                    Interlocked.Add(ref sum,
                        results\[(long)reader\["x"\]\].Length);

                    Interlocked.Increment(ref rows);
                  }

                  //
                  // NOTE: Close the data reader for this loop iteration as we
                  //       are done with it.
                  //
                  reader.Close();
                  reader = null;

                  //
                  // NOTE: Dispose the command for this loop iteration as we
                  //       are done with it.
                  //
                  command.Dispose();
                  command = null;
                }

                //
                // NOTE: Close the connection for this test thread as we are
                //       done with it.  Since the above loop is infinite, it
                //       should only be exited via this test thread being
                //       aborted; therefore, execution should never reach this
                //       point.
                //
                connection.Close();
                connection = null;
              }
              catch (Exception e)
              {
                Interlocked.Increment(ref errors);
                Trace.WriteLine(e);
              }
            };

            //
            // NOTE: Create a (reusable) delegate that will contain the code
            //       that half the created threads are to execute.  This code
            //       will repeatedly call the Thread.Abort() method on all the
            //       other test threads until they all appear to be dead.
            //
            ThreadStart threadStart2 = delegate()
            {
              try
              {
                //
                // NOTE: Wait forever for the "GO" signal so that all threads
                //       can start working at approximately the same time.
                //       This is also used to make sure that all test threads
                //       are inside of a try block before attempting to abort
                //       them.
                //
                goEvent.WaitOne();

                //
                // NOTE: Give the other test threads a slight head start to
                //       make sure that they are fully alive prior to trying
                //       to abort any of them.
                //
                Thread.Sleep(${count(2)});

                //
                // NOTE: Loop forever until all test threads appear to be dead.
                //
                while (true)
                {
                  //
                  // NOTE: Wait a random number of milliseconds, up to a full
                  //       second.
                  //
                  Thread.Sleep(random.Next(0, ${count(3)}));

                  //
                  // NOTE: Select a random thread to abort.
                  //
                  int index = random.Next(1, count);

                  //
                  // NOTE: If the thread appears to be alive, try to abort
                  //       it.
                  //
                  try
                  {
                    if (thread\[index\].IsAlive)
                      thread\[index\].Abort();
                  }
                  catch (Exception e)
                  {
                    Trace.WriteLine(e);
                  }

                  //
                  // NOTE: If all the other threads are dead, presumably due
                  //       to being aborted, stop now.  This check is simpler,
                  //       and possibly more reliable, than checking if any of
                  //       the test threads are still alive via their IsAlive
                  //       property.
                  //
                  if (Interlocked.Increment(ref errors) == count)
                    break;
                  else
                    Interlocked.Decrement(ref errors);
                }
              }
              catch (Exception e)
              {
                Interlocked.Increment(ref errors);
                Trace.WriteLine(e);
              }
            };

            //
            // NOTE: Create each of the test threads with a suitable stack
            //       size.  We must specify a stack size here because the
            //       default one for the process would be the same as the
            //       parent executable (the Eagle shell), which is 16MB,
            //       too large to be useful.
            //
            for (int index = 0; index < count; index++)
            {
              //
              // NOTE: Figure out what kind of thread to create (i.e. one
              //       that uses a connection or one that calls the GC).
              //
              ThreadStart threadStart;

              if (index == 0)
                threadStart = threadStart2;
              else
                threadStart = threadStart1;

              thread\[index\] = new Thread(threadStart, 1048576);

              //
              // NOTE: Name each thread for a better debugging experience.
              //
              thread\[index\].Name = String.Format(
                  "[file rootname ${fileName}] #{0}", index);
            }

            //
            // NOTE: Start all the threads now.  They should not actually do
            //       any of the test "work" until we signal the event.
            //
            for (int index = 0; index < count; index++)
              thread\[index\].Start();

            //
            // NOTE: Send the signal that all threads should start doing
            //       their test "work" now.
            //
            goEvent.Set(); /* GO */

            //
            // NOTE: Wait forever for each thread to finish its test "work"
            //       and then die.
            //
            for (int index = 0; index < count; index++)
              thread\[index\].Join();
          }

          //
          // NOTE: Return a list of integers with total number of data bytes
          //       seen, total number of query result rows seen, and the total
          //       number of exceptions caught by all the test threads.
          //
          LongList counts = new LongList();

          counts.Add(sum);
          counts.Add(rows);
          counts.Add(errors);

          return counts;
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll Eagle.dll] \
      WarningLevel 0]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} RunTestThreads
      } result] : [set result ""]}] $result \
      [collectGarbage $test_channel [expr {$count(1) * 1000}] false] \
      [getSQLiteHandleCounts $test_channel] \
      [reportSQLiteResources $test_channel]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -time true -constraints [fixConstraints {eagle command.object monoBug28\
monoCrash211 monoCrash42 monoBug46 monoBug66 monoCrash68 command.sql\
compile.DATA SQLite System.Data.SQLite compileCSharp !dotNetCore}] -match \
regexp -result [appendArgs "^Ok System#CodeDom#Compiler#CompilerResults#" \
"\\d+ \\{\\} 0 \\{\\d+ \\d+ " $count(1) "\\} \\{\\} \\{" $handle_counts \
"\\} " $memory_used \$]}

###############################################################################

unset -nocomplain count

###############################################################################

unset -nocomplain memory_used handle_counts

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-00f86f9739.eagle.





























































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
###############################################################################
#
# tkt-00f86f9739.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue
runSQLiteTestFilesPrologue

###############################################################################

runTest {test tkt-00f86f9739-1.1 {LINQ with StartsWith} -body {
  copySampleDatabaseFiles

  set result [list]

  foreach value [list "" a b z 1+1 don notthere] {
    set output ""

    set code [catch {
      testClrExec $testLinqExeFile [list -eventflags Wait -directory \
          [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
          -success Success] -startsWith $value
    } error]

    tlog "---- BEGIN STDOUT OUTPUT\n"
    tlog $output
    tlog "\n---- END STDOUT OUTPUT\n"

    lappend result $code

    if {$code == 0} then {
      lappend result [string trim $output]
    } else {
      lappend result [string trim $error]
    }
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result value
} -constraints \
{eagle monoToDo defineConstant.System.Data.SQLite.USE_INTEROP_DLL\
defineConstant.System.Data.SQLite.INTEROP_EXTENSION_FUNCTIONS SQLite testExec\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll file_testlinq.exe\
file_northwindEF.db} -result {0 {} 0 {DRACD OLDWO RATTC} 0 {ALFKI CACTU CHOPS\
FOLKO GALED KOENE LILAS MAGAA MAISD OCEAN RANCH SAVEA THECR} 0 {} 0 {} 0 {} 0\
{}}}

###############################################################################

runTest {test tkt-00f86f9739-1.2 {EF6 with StartsWith} -body {
  copySampleDatabaseFiles

  set result [list]

  foreach value [list "" a b z 1+1 don notthere] {
    set output ""

    set code [catch {
      testClrExec $testEf6ExeFile [list -eventflags Wait -directory \
          [file dirname $testEf6ExeFile] -nocarriagereturns -stdout output \
          -success Success] -startsWith $value
    } error]

    tlog "---- BEGIN STDOUT OUTPUT\n"
    tlog $output
    tlog "\n---- END STDOUT OUTPUT\n"

    lappend result $code

    if {$code == 0} then {
      lappend result [string trim $output]
    } else {
      lappend result [string trim $error]
    }
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result value
} -constraints \
{eagle monoToDo defineConstant.System.Data.SQLite.USE_INTEROP_DLL\
defineConstant.System.Data.SQLite.INTEROP_EXTENSION_FUNCTIONS SQLite testExec\
file_EntityFramework.dll file_System.Data.SQLite.dll\
file_System.Data.SQLite.EF6.dll file_testef6.exe file_northwindEF.db} -result \
{0 {} 0 {DRACD OLDWO RATTC} 0 {ALFKI CACTU CHOPS FOLKO GALED KOENE LILAS MAGAA\
MAISD OCEAN RANCH SAVEA THECR} 0 {} 0 {} 0 {} 0 {}}}

###############################################################################

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-0a32885109.eagle.



























































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
###############################################################################
#
# tkt-0a32885109.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue
runSQLiteTestFilesPrologue

###############################################################################

runTest {test tkt-0a32885109-1.1 {LINQ compound-operator handling} -body {
  copySampleDatabaseFiles

  set result [list]
  set output ""

  set code [catch {
    testClrExec $testLinqExeFile [list -eventflags Wait -directory \
        [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
        -success Success] -unionall
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  lappend result $code

  if {$code == 0} then {
    lappend result [string trim $output]
  } else {
    lappend result [string trim $error]
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result
} -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll testExec\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db} \
-result {0 {WHITC ANATR BERGS WHITC ANATR WHITC ANATR BERGS}}}

###############################################################################

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-0d5b1ef362.eagle.













































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
###############################################################################
#
# tkt-0d5b1ef362.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

#
# HACK: This test reads the private "_domainUnload" field of the AppDomain
#       class.  This is non-portable and will not work on Mono.  Also, this
#       may not work on versions of the .NET Framework after 4.0.
#
runTest {test tkt-0d5b1ef362-1.1 {SQLiteLog.DomainUnload event} -setup \
    [getAppDomainPreamble] -body {
  #
  # NOTE: Grab the number of DomainUnload handlers prior to doing anything
  #       else.
  #
  set x [object invoke -flags +NonPublic \
      AppDomain.CurrentDomain._domainUnload.GetInvocationList Length]

  package require Eagle.Library
  package require Eagle.Test
  package require System.Data.SQLite.Test

  object load -loadtype File [file join [getBinaryDirectory] \
      System.Data.SQLite.dll]

  for {set i 1} {$i < 3} {incr i} {
    set connection($i) [object create System.Data.SQLite.SQLiteConnection ""]
  }

  #
  # NOTE: Now, grab the number of DomainUnload handlers after creating the
  #       connections.
  #
  set y [object invoke -flags +NonPublic \
      AppDomain.CurrentDomain._domainUnload.GetInvocationList Length]

  #
  # NOTE: Make sure that no DomainUnload handlers were actually added while we
  #       created the two connections (i.e. because we are not in the default
  #       application domain).
  #
  expr {$x == $y}
} -cleanup {
  unset -nocomplain connection i x y
} -constraints {eagle command.object dotNet monoBug28\
compile.ISOLATED_INTERPRETERS SQLite System.Data.SQLite} -isolationLevel \
AppDomain -result {True}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-0e48e80333.eagle.





























































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
###############################################################################
#
# tkt-0e48e80333.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

#
# HACK: This test is non-portable (e.g. to Mono) due to its use of Managed
#       Debugging Assistants (MDAs), which are only implemented by the full
#       .NET Framework.
#
runTest {test tkt-0e48e80333-1.1 {unhook delegates on pooled close} -setup {
  moveEagleShellMdaConfig false

  saveEagleShellEnvironment
  saveMdaConfigEnvironment
} -body {
  set configFileName [writeEagleShellMdaConfig [string trim {
    <?xml version="1.0" encoding="UTF-8" ?>
    <mdaConfig xmlns="http://schemas.microsoft.com/CLR/2004/10/mda">
      <assistants>
        <callbackOnCollectedDelegate listSize="50" />
      </assistants>
    </mdaConfig>
  }]]

  set scriptFileName [file tempname]

  writeFile $scriptFileName [string trim {
    package require Eagle
    package require Eagle.Library
    package require Eagle.Test
    package require System.Data.SQLite.Test

    proc traceCallback { sender e } {
      lappend ::result [$e Statement]
      lappend ::result [$sender IsReadOnly null]
    }

    object load System.Data.SQLite
    set test_channel stdout

    setupDb [set fileName tkt-0e48e80333-1.1.db]
    sql execute $db {CREATE TABLE t1(x);}
    cleanupDb $fileName db true false false

    set result ""

    set count 10

    set sql [string trim { \
      INSERT INTO t1 (x) VALUES(1); \
    }]

    for {set i 0} {$i < $count} {incr i} {
      setupDb $fileName \
          "" "" "" "" "Pooling=True;" true false

      set connection [getDbConnection]
      $connection add_Trace traceCallback

      sql execute $db $sql

      freeDbConnection
      cleanupDb $fileName db true false false
    }

    if {$result eq [lrepeat $count $sql False]} then {
      exit Success
    } else {
      exit Failure
    }
  }]

  set env(NoMutexes) 1; # ignore Eagle mutexes.
  set env(COMPLUS_MDA) 1; # enable MDA config file.

  set code [catch {
    execTestShell [list \
        -eventflags Wait -success Success -stdout output] \
        -preInitialize [appendArgs \" "set no(logFileName) 1" \"] \
        -file [appendArgs \" $scriptFileName \"] \
        -logFile [appendArgs \" [getTestLog] \"]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  set code
} -cleanup {
  cleanupDb tkt-0e48e80333-1.1.db

  catch {cleanupFile $scriptFileName}
  catch {cleanupFile $configFileName}

  catch {info previouspid true}

  unset -nocomplain code output error scriptFileName configFileName

  restoreMdaConfigEnvironment
  restoreEagleShellEnvironment

  moveEagleShellMdaConfig true
} -constraints {eagle dotNet testExec command.object monoBug28 command.sql\
compile.DATA SQLite System.Data.SQLite} -result {0}}

###############################################################################

#
# HACK: This test is non-portable (e.g. to Mono) due to its use of Managed
#       Debugging Assistants (MDAs), which are only implemented by the full
#       .NET Framework.
#
runTest {test tkt-0e48e80333-1.2 {delegate MDA on pooled close} -setup {
  moveEagleShellMdaConfig false

  saveEagleShellEnvironment
  saveMdaConfigEnvironment

  setupDb [set fileName tkt-0e48e80333-1.2.db]
} -body {
  set configFileName [writeEagleShellMdaConfig [string trim {
    <?xml version="1.0" encoding="UTF-8" ?>
    <mdaConfig xmlns="http://schemas.microsoft.com/CLR/2004/10/mda">
      <assistants>
        <callbackOnCollectedDelegate listSize="50" />
      </assistants>
    </mdaConfig>
  }]]

  set scriptFileName [file tempname]

  writeFile $scriptFileName [string trim {
    package require Eagle
    package require Eagle.Library
    package require Eagle.Test
    package require System.Data.SQLite.Test

    set test_channel ""; # disable [tputs]

    set id [object invoke Interpreter.GetActive NextId]
    set dataSource [file join [getDatabaseDirectory] $fileName]

    set count(1) 1000; # thread work-item count
    set count(2) 1000; # per-thread query count
    set count(3) [expr {$count(1) * $count(2)}]; # total query count
    set count(4) [expr {0.00002 * $count(3)}]; # timeout in seconds
    set count(5) 10; # busy loop sleep milliseconds
    set count(6) 120; # connection default command timeout

    set sql { \
      SELECT 1; \
    }

    unset -nocomplain results errors

    set code [compileCSharpWith [subst {
      using System;
      using System.Data;
      using System.Data.SQLite;
      using System.Threading;

      namespace _Dynamic${id}
      {
        public static class Test${id}
        {
          #region Private Static Data
          private static long count;

          /////////////////////////////////////////////////////////////////////

          private static SQLiteTraceEventHandler handler;
          #endregion

          /////////////////////////////////////////////////////////////////////

          #region Public Static Methods
          public static void TraceEventHandler(
            object sender,
            TraceEventArgs e
            )
          {
            /* IGNORED */
            Interlocked.Increment(ref count);
          }

          /////////////////////////////////////////////////////////////////////

          public static SQLiteConnection MakeConnection()
          {
            SQLiteConnection connection = new SQLiteConnection(
                "Data Source=${dataSource};Journal Mode=Wal;Pooling=true;" +
                "Default Timeout=${count(6)};" +
                "[getTestProperties AllowNestedTransactions]");

            connection.Open();
            connection.Trace += handler;

            return connection;
          }

          /////////////////////////////////////////////////////////////////////

          public static long ThreadedPoolTraceTest()
          {
            for (int index1 = 0; index1 < ${count(1)}; index1++)
            {
              ThreadPool.QueueUserWorkItem(delegate(object state) {
                using (SQLiteConnection connection = MakeConnection())
                {
                  for (int index2 = 0; index2 < ${count(2)}; index2++)
                  {
                    using (SQLiteTransaction transaction =
                        connection.BeginTransaction())
                    {
                      using (SQLiteCommand command =
                          connection.CreateCommand())
                      {
                        command.CommandText = "[subst ${sql}]";
                        command.ExecuteNonQuery();
                      }
                    }
                  }
                }
              });

              GC.Collect();
            }

            DateTime start = DateTime.UtcNow;

            while (true)
            {
              if (Interlocked.CompareExchange(ref count, 0, 0) >= ${count(3)})
                break;

              if (DateTime.UtcNow.Subtract(start).TotalSeconds >= ${count(4)})
                break;

              Thread.Sleep(${count(5)});
            }

            return Interlocked.CompareExchange(ref count, 0, 0);
          }

          /////////////////////////////////////////////////////////////////////

          public static void Main()
          {
            handler = new SQLiteTraceEventHandler(TraceEventHandler);
          }
          #endregion
        }
      }
    }] true false true results errors System.Data.SQLite.dll]

    puts stdout [list $code $results \
        [expr {[info exists errors] ? $errors : ""}] \
        [expr {$code eq "Ok" ? [catchCSharp {
          object invoke _Dynamic${id}.Test${id} Main
        } result] : [set result ""]}] $result \
        [expr {$code eq "Ok" ? [catchCSharp {
          object invoke _Dynamic${id}.Test${id} ThreadedPoolTraceTest
        } result] : [set result ""]}] $result]
  }]

  set env(NoMutexes) 1; # ignore Eagle mutexes.
  set env(COMPLUS_MDA) 1; # enable MDA config file.

  set code [catch {
    execTestShell [list \
        -eventflags Wait -success Success -stdout output] \
        -preInitialize [appendArgs \" "set fileName {" $fileName }\"] \
        -preInitialize [appendArgs \" "set no(logFileName) 1" \"] \
        -file [appendArgs \" $scriptFileName \"] \
        -logFile [appendArgs \" [getTestLog] \"]
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  set error [lindex \
      [split [string map [list \r\n \n] [string trim $error]] \n] end]

  if {![regexp -- {0 (\d+)$} $error dummy count]} then {
    set count <unknown>
  }

  tputs $test_channel [appendArgs \
      "---- executed a total of " $count " queries\n"]

  list $code $error
} -cleanup {
  cleanupDb $fileName

  catch {cleanupFile $scriptFileName}
  catch {cleanupFile $configFileName}

  catch {info previouspid true}

  unset -nocomplain dummy count
  unset -nocomplain code output error scriptFileName configFileName
  unset -nocomplain db fileName

  restoreMdaConfigEnvironment
  restoreEagleShellEnvironment

  moveEagleShellMdaConfig true
} -constraints {eagle dotNet command.object monoBug28 command.sql compile.DATA\
SQLite System.Data.SQLite compileCSharp sdsTiming} -match regexp -result {^0\
\{Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\} 0 \d+\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-0ed01c447c.eagle.















































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
###############################################################################
#
# tkt-0ed01c447c.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-0ed01c447c-1.1 {ProviderDbType for DataTypes} -setup {
  setupDb [set fileName tkt-0ed01c447c-1.1.db]
} -body {
  set connection [getDbConnection]
  set dataTable [$connection -alias GetSchema DATATYPES]
  set results [list]

  object foreach -alias dataRow [set dataRows [$dataTable -alias Rows]] {
    lappend results [list \
        [$dataRow Item TypeName] [$dataRow Item ProviderDbType]]
  }

  lsort $results
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain dataRow dataRows dataTable results connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{autoincrement 12} {bigint 12} {binary 1} {bit 3}\
{blob 1} {bool 3} {boolean 3} {char 16} {counter 12} {currency 7} {date 6}\
{datetime 6} {decimal 7} {double 8} {float 8} {general 1} {guid 9} {identity\
12} {image 1} {int 11} {integer 12} {logical 3} {long 12} {longtext 16}\
{mediumint 11} {memo 16} {money 7} {nchar 16} {note 16} {ntext 16} {numeric 7}\
{nvarchar 16} {oleobject 1} {real 8} {single 15} {smalldate 6} {smallint 10}\
{string 16} {text 16} {time 6} {timestamp 6} {tinyint 2} {uniqueidentifier 9}\
{varbinary 1} {varchar 16} {yesno 3}}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-17045010df.eagle.























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
###############################################################################
#
# tkt-17045010df.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-17045010df-1.1 {EnableExtensions & LoadExtension} -setup {
  setupDb [set fileName tkt-17045010df-1.1.db]
} -body {
  set connection [getDbConnection]

  lappend result [catchAndReturn {$connection EnableExtensions false}]

  lappend result [catchAndReturn {$connection LoadExtension \
      [getCoreExtensionBinaryFileName null] interop_test_extension_init}]

  lappend result [catchAndReturn {sql execute -execute scalar $db \
      "SELECT interopTest('test1');"}]
  lappend result [catchAndReturn {sql execute -execute scalar $db \
      "SELECT interopTest('test1', '1234');"}]

  lappend result [catchAndReturn {$connection EnableExtensions true}]

  lappend result [catchAndReturn {$connection LoadExtension \
      [getCoreExtensionBinaryFileName null] interop_test_extension_init}]

  lappend result [catchAndReturn {sql execute -execute scalar $db \
      "SELECT interopTest('test2');"}]
  lappend result [catchAndReturn {sql execute -execute scalar $db \
      "SELECT interopTest('test2', '5678');"}]

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain result connection

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28\
defineConstant.System.Data.SQLite.INTEROP_TEST_EXTENSION command.sql\
compile.DATA SQLite System.Data.SQLite SQLiteInterop} -match regexp -result \
{^\{0 \{\}\} \{1 \{EXCEPTION System\.Data\.SQLite\.SQLiteException\
System\.Data\.SQLite\.SQLite3\.LoadExtension\} \{SQL logic error( or missing\
database)? -- not authorized\}\} \{1 \{EXCEPTION\
System\.Data\.SQLite\.SQLiteException System\.Data\.SQLite\.SQLite3\.Prepare\}\
\{SQL logic error( or missing database)? -- no such function: interopTest\}\}\
\{1 \{EXCEPTION System\.Data\.SQLite\.SQLiteException\
System\.Data\.SQLite\.SQLite3\.Prepare\} \{SQL logic error( or missing\
database)? -- no such function: interopTest\}\} \{0 \{\}\} \{0 \{\}\} \{0\
test2\} \{1 \{EXCEPTION System\.Data\.SQLite\.SQLiteException\
System\.Data\.SQLite\.SQLite3\.(?:Reset|Step)\} \{SQL logic error( or missing\
database)? -- need exactly one argument\}\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-1c456ae75f.eagle.















































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
###############################################################################
#
# tkt-1c456ae75f.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-1c456ae75f-1.1 {unencrypted database, hex password} -setup {
  setupDb [set fileName tkt-1c456ae75f-1.1.db]
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "HexPassword=3132333435;" true false

  set result [list]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "" true false

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain error result db fileName
} -constraints {eagle System.Data.SQLite.Encryption monoBug28 command.sql\
compile.DATA SQLite System.Data.SQLite} -match regexp -result {^1 \{(?:file is\
not a database|database disk image is malformed)\} 1 \{(?:file is not a\
database|database disk image is malformed)\} 0 1 0 2$}}

###############################################################################

runTest {test tkt-1c456ae75f-1.2 {database, hex password} -setup {
  setupDb [set fileName tkt-1c456ae75f-1.2.db] "" "" "" "" \
      "HexPassword=3132333435;"
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Password=12345;" true false

  set result [list]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] $error

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] $error

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "HexPassword=3132333435;" true false

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] $error

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] $error

  cleanupDb $fileName db true false false

  lappend result [expr {
      [string equal [readDbFileHeader [file join \
      [getDatabaseDirectory] $fileName]] \
      [getDbFileHeader]] == ![page1MustBeEncrypted]
  }]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain error result db fileName
} -constraints {eagle System.Data.SQLite.Encryption monoBug28 command.sql\
compile.DATA SQLite System.Data.SQLite} -result {0 1 0 1 0 1 0 3 True}}

###############################################################################

runTest {test tkt-1c456ae75f-1.3 {database, wrong hex password} -setup {
  setupDb [set fileName tkt-1c456ae75f-1.3.db] "" "" "" "" \
      "HexPassword=3132333435;"
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "HexPassword=3132333436;" true false

  set result [list]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "HexPassword=3132333435;" true false

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain error result db fileName
} -constraints {eagle System.Data.SQLite.Encryption monoBug28 command.sql\
compile.DATA SQLite System.Data.SQLite} -match regexp -result {^1 \{(?:file is\
not a database|database disk image is malformed)\} 1 \{(?:file is not a\
database|database disk image is malformed)\} 0 1 0 2$}}

###############################################################################

runTest {test tkt-1c456ae75f-1.4 {database, hex password via builder} -setup {
  setupDb [set fileName tkt-1c456ae75f-1.4.db] "" "" "" "" \
      "HexPassword=3132333435;"
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  cleanupDb $fileName db true false false

  set connectionStringBuilder [object create -alias \
      System.Data.SQLite.SQLiteConnectionStringBuilder]

  $connectionStringBuilder DataSource \
      [file join [getDatabaseDirectory] $fileName]

  $connectionStringBuilder HexPassword [list 0x31 0x32 0x33 0x34 0x35]

  set connection [object create -alias \
      System.Data.SQLite.SQLiteConnection \
      [$connectionStringBuilder ToString] true]

  $connection Open; addDbConnection $connection

  set result [list]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] $error

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] $error

  cleanupDb $fileName db true false false
  setupDb $fileName "" "" "" "" "Password=\"12345\";" true false

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] $error

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] $error

  cleanupDb $fileName db true false false

  lappend result [expr {
      [string equal [readDbFileHeader [file join \
      [getDatabaseDirectory] $fileName]] \
      [getDbFileHeader]] == ![page1MustBeEncrypted]
  }]

  set result
} -cleanup {
  unset -nocomplain connection

  cleanupDb $fileName; # NOTE: After object disposal.

  unset -nocomplain connectionStringBuilder error result db fileName
} -constraints {eagle command.object System.Data.SQLite.Encryption monoBug28\
command.sql compile.DATA SQLite System.Data.SQLite} -result \
{0 1 0 1 0 1 0 3 True}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-1f7bfff467.eagle.



























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
###############################################################################
#
# tkt-1f7bfff467.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-1f7bfff467-1.0 {rollback nested transaction} -setup {
  setupDb [set fileName tkt-1f7bfff467-1.0.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
    INSERT INTO t1(x) VALUES(1);
    INSERT INTO t1(x) VALUES(2);
    INSERT INTO t1(x) VALUES(3);
  }

  catch {
    set result [list]

    lappend result [sql execute \
        -execute scalar $db "SELECT COUNT(*) FROM t1;"]

    set transaction(1) [sql transaction begin $db]

    sql execute -transaction $transaction(1) $db \
        "INSERT INTO t1(x) VALUES(4);"

    lappend result [sql execute -transaction $transaction(1) \
        -execute reader -format list $db \
        "SELECT x FROM t1 ORDER BY x;"]

    set transaction(2) [sql transaction begin $db]

    sql execute -transaction $transaction(2) $db \
        "DELETE FROM t1 WHERE x = 2;"

    lappend result [sql execute -transaction $transaction(2) \
        -execute reader -format list $db \
        "SELECT x FROM t1 ORDER BY x;"]

    sql transaction rollback $transaction(2)

    sql execute -transaction $transaction(1) $db \
        "UPDATE t1 SET x = 9 WHERE x = 3;"

    sql transaction commit $transaction(1)

    lappend result [sql execute \
        -execute reader -format list $db \
        "SELECT x FROM t1 ORDER BY x;"]

    set result
  } error

  extractSystemDataSQLiteExceptionMessage $error
} -cleanup {
  catch {sql transaction rollback $transaction(2)}
  catch {sql transaction rollback $transaction(1)}

  cleanupDb $fileName

  catch {removeDbTransaction $transaction(2)}
  catch {removeDbTransaction $transaction(1)}

  unset -nocomplain error result transaction db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {unknown error -- No transaction is active on this\
connection}}

###############################################################################

runTest {test tkt-1f7bfff467-1.1 {rollback nested transaction} -setup {
  setupDb [set fileName tkt-1f7bfff467-1.1.db] "" "" "" AllowNestedTransactions
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
    INSERT INTO t1(x) VALUES(1);
    INSERT INTO t1(x) VALUES(2);
    INSERT INTO t1(x) VALUES(3);
  }

  set result [list]

  lappend result [sql execute \
      -execute scalar $db "SELECT COUNT(*) FROM t1;"]

  set transaction(1) [sql transaction begin $db]

  sql execute -transaction $transaction(1) $db \
      "INSERT INTO t1(x) VALUES(4);"

  lappend result [sql execute -transaction $transaction(1) \
      -execute reader -format list $db \
      "SELECT x FROM t1 ORDER BY x;"]

  set transaction(2) [sql transaction begin $db]

  sql execute -transaction $transaction(2) $db \
      "DELETE FROM t1 WHERE x = 2;"

  lappend result [sql execute -transaction $transaction(2) \
      -execute reader -format list $db \
      "SELECT x FROM t1 ORDER BY x;"]

  sql transaction rollback $transaction(2)

  sql execute -transaction $transaction(1) $db \
      "UPDATE t1 SET x = 9 WHERE x = 3;"

  sql transaction commit $transaction(1)

  lappend result [sql execute \
      -execute reader -format list $db \
      "SELECT x FROM t1 ORDER BY x;"]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result transaction db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {3 {1 2 3 4} {1 3 4} {1 2 4 9}}}

###############################################################################

runTest {test tkt-1f7bfff467-1.2 {commit outer transaction} -setup {
  setupDb [set fileName tkt-1f7bfff467-1.2.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
    INSERT INTO t1(x) VALUES(1);
  }

  set sql(1) { \
    INSERT INTO t1(x) VALUES(2); \
  }

  set sql(2) { \
    INSERT INTO t1(x) VALUES(3); \
  }

  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]
  set flags AllowNestedTransactions

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties ${flags}]"))
          {
            connection.Open();

            using (SQLiteTransaction transaction1 =
                connection.BeginTransaction())
            {
              using (SQLiteCommand command1 = new SQLiteCommand(
                  "${sql(1)}", connection))
              {
                command1.Transaction = transaction1;
                command1.ExecuteNonQuery();
              }

              using (SQLiteTransaction transaction2 =
                  connection.BeginTransaction())
              {
                using (SQLiteCommand command2 = new SQLiteCommand(
                    "${sql(2)}", connection))
                {
                  command2.Transaction = transaction2;
                  command2.ExecuteNonQuery();

                  transaction1.Commit();
                }
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result \
      [sql execute -execute reader -format list $db \
          "SELECT x FROM t1 ORDER BY x;"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code
  unset -nocomplain sql flags dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\} \{1 2 3\}$}}

###############################################################################

runTest {test tkt-1f7bfff467-1.3 {rollback outer transaction} -setup {
  setupDb [set fileName tkt-1f7bfff467-1.3.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
    INSERT INTO t1(x) VALUES(1);
  }

  set sql(1) { \
    INSERT INTO t1(x) VALUES(2); \
  }

  set sql(2) { \
    INSERT INTO t1(x) VALUES(3); \
  }

  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]
  set flags AllowNestedTransactions

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties ${flags}]"))
          {
            connection.Open();

            using (SQLiteTransaction transaction1 =
                connection.BeginTransaction())
            {
              using (SQLiteCommand command1 = new SQLiteCommand(
                  "${sql(1)}", connection))
              {
                command1.Transaction = transaction1;
                command1.ExecuteNonQuery();
              }

              using (SQLiteTransaction transaction2 =
                  connection.BeginTransaction())
              {
                using (SQLiteCommand command2 = new SQLiteCommand(
                    "${sql(2)}", connection))
                {
                  command2.Transaction = transaction2;
                  command2.ExecuteNonQuery();

                  transaction1.Rollback();
                }
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result \
      [sql execute -execute reader -format list $db \
          "SELECT x FROM t1 ORDER BY x;"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code
  unset -nocomplain sql flags dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\} 1$}}

###############################################################################

runTest {test tkt-1f7bfff467-1.4 {commit middle transaction} -setup {
  setupDb [set fileName tkt-1f7bfff467-1.4.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
    INSERT INTO t1(x) VALUES(1);
  }

  set sql(1) { \
    INSERT INTO t1(x) VALUES(2); \
  }

  set sql(2) { \
    INSERT INTO t1(x) VALUES(3); \
  }

  set sql(3) { \
    INSERT INTO t1(x) VALUES(4); \
  }

  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]
  set flags AllowNestedTransactions

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties ${flags}]"))
          {
            connection.Open();

            using (SQLiteTransaction transaction1 =
                connection.BeginTransaction())
            {
              using (SQLiteCommand command1 = new SQLiteCommand(
                  "${sql(1)}", connection))
              {
                command1.Transaction = transaction1;
                command1.ExecuteNonQuery();
              }

              using (SQLiteTransaction transaction2 =
                  connection.BeginTransaction())
              {
                using (SQLiteCommand command2 = new SQLiteCommand(
                    "${sql(2)}", connection))
                {
                  command2.Transaction = transaction2;
                  command2.ExecuteNonQuery();
                }

                using (SQLiteTransaction transaction3 =
                    connection.BeginTransaction())
                {
                  using (SQLiteCommand command3 = new SQLiteCommand(
                      "${sql(3)}", connection))
                  {
                    command3.Transaction = transaction3;
                    command3.ExecuteNonQuery();

                    transaction2.Commit();
                  }
                }
              }

              transaction1.Commit();
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result \
      [sql execute -execute reader -format list $db \
          "SELECT x FROM t1 ORDER BY x;"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code
  unset -nocomplain sql flags dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\} \{1 2 3 4\}$}}

###############################################################################

runTest {test tkt-1f7bfff467-1.5 {rollback middle transaction} -setup {
  setupDb [set fileName tkt-1f7bfff467-1.5.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
    INSERT INTO t1(x) VALUES(1);
  }

  set sql(1) { \
    INSERT INTO t1(x) VALUES(2); \
  }

  set sql(2) { \
    INSERT INTO t1(x) VALUES(3); \
  }

  set sql(3) { \
    INSERT INTO t1(x) VALUES(4); \
  }

  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]
  set flags AllowNestedTransactions

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties ${flags}]"))
          {
            connection.Open();

            using (SQLiteTransaction transaction1 =
                connection.BeginTransaction())
            {
              using (SQLiteCommand command1 = new SQLiteCommand(
                  "${sql(1)}", connection))
              {
                command1.Transaction = transaction1;
                command1.ExecuteNonQuery();
              }

              using (SQLiteTransaction transaction2 =
                  connection.BeginTransaction())
              {
                using (SQLiteCommand command2 = new SQLiteCommand(
                    "${sql(2)}", connection))
                {
                  command2.Transaction = transaction2;
                  command2.ExecuteNonQuery();
                }

                using (SQLiteTransaction transaction3 =
                    connection.BeginTransaction())
                {
                  using (SQLiteCommand command3 = new SQLiteCommand(
                      "${sql(3)}", connection))
                  {
                    command3.Transaction = transaction3;
                    command3.ExecuteNonQuery();

                    transaction2.Rollback();
                  }
                }
              }

              transaction1.Commit();
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result \
      [sql execute -execute reader -format list $db \
          "SELECT x FROM t1 ORDER BY x;"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code
  unset -nocomplain sql flags dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\} \{1 2\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-201128cc88.eagle.



















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
###############################################################################
#
# tkt-201128cc88.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-201128cc88-1.1 {custom function with byte[] arg} -setup {
  set fileName tkt-201128cc88-1.1.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      \[SQLiteFunction(Name = "Base64", FuncType = FunctionType.Scalar)\]
      public class Test${id} : SQLiteFunction
      {
        public override object Invoke(
          object\[\] args
          )
        {
          if (args == null)
            return null;

          if (args.Length != 1)
            return new ArgumentException(String.Format(
              "need exactly one argument, got {0}", args.Length));

          object arg = args\[0\];

          if (arg == null)
            return String.Empty;

          Type type = arg.GetType();

          if (type == typeof(DBNull))
            return String.Empty;

          if (type != typeof(byte\[\]))
            return new ArgumentException(String.Format(
              "argument must be byte array, got {0}", type));

          return Convert.ToBase64String((byte\[\]) arg);
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          SQLiteFunction.RegisterFunction(typeof(Test${id}));
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  #
  # NOTE: Compile the C# code (above) to register the custom SQLite function
  #       and then open the database for this test case and attempt to execute
  #       the function.  Normally, we would open the database in the test setup
  #       phase; however, that will not work correctly because newly registered
  #       functions are only picked up and used by databases opened after they
  #       have been registered.
  #
  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result [setupDb $fileName] \
      [sql execute -execute scalar $db "SELECT Base64(CAST(NULL AS BLOB));"] \
      [sql execute -execute scalar $db "SELECT Base64(CAST('' AS BLOB));"] \
      [sql execute -execute scalar $db "SELECT Base64(CAST('foo' AS BLOB));"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}\
System#Data#SQLite#SQLiteConnection#\d+ \{\} \{\} Zm9v$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-23d8d6171e.eagle.

















































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
###############################################################################
#
# tkt-23d8d6171e.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-23d8d6171e-1.1 {HidePassword flag w/Password} -setup {
  setupDb [set fileName tkt-23d8d6171e-1.1.db] "" "" "" HidePassword \
      "Password=1234;"
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  set result [list]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  set connection [getDbConnection]

  lappend result [$connection -flags +NonPublic _password]

  lappend result [expr {
    [string first 1234 [$connection ConnectionString]] != -1
  }]

  lappend result [expr {
    [string first ";Password=;" [$connection ConnectionString]] != -1
  }]

  lappend result [expr {
    [string first ";HexPassword=;" [$connection ConnectionString]] != -1
  }]

  lappend result [expr {
    [string first ";TextPassword=;" [$connection ConnectionString]] != -1
  }]

  lappend result [expr {
    [string first ";TextHexPassword=;" [$connection ConnectionString]] != -1
  }]

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain connection

  cleanupDb $fileName

  unset -nocomplain error result db fileName
} -constraints {eagle System.Data.SQLite.Encryption monoBug28 command.sql\
compile.DATA SQLite System.Data.SQLite} -result \
{0 1 0 1 0 2 {} False True False False False}}

###############################################################################

runTest {test tkt-23d8d6171e-1.2 {HidePassword flag w/HexPassword} -setup {
  setupDb [set fileName tkt-23d8d6171e-1.2.db] "" "" "" HidePassword \
      "HexPassword=1234;"
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  set result [list]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  set connection [getDbConnection]

  lappend result [$connection -flags +NonPublic _password]

  lappend result [expr {
    [string first 1234 [$connection ConnectionString]] != -1
  }]

  lappend result [expr {
    [string first ";Password=;" [$connection ConnectionString]] != -1
  }]

  lappend result [expr {
    [string first ";HexPassword=;" [$connection ConnectionString]] != -1
  }]

  lappend result [expr {
    [string first ";TextPassword=;" [$connection ConnectionString]] != -1
  }]

  lappend result [expr {
    [string first ";TextHexPassword=;" [$connection ConnectionString]] != -1
  }]

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain connection

  cleanupDb $fileName

  unset -nocomplain error result db fileName
} -constraints {eagle System.Data.SQLite.Encryption monoBug28 command.sql\
compile.DATA SQLite System.Data.SQLite} -result \
{0 1 0 1 0 2 {} False False True False False}}

###############################################################################

runTest {test tkt-23d8d6171e-1.3 {HidePassword flag w/TextPassword} -setup {
  setupDb [set fileName tkt-23d8d6171e-1.3.db] "" "" "" HidePassword \
      "TextPassword=1234;"
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  set result [list]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  set connection [getDbConnection]

  lappend result [$connection -flags +NonPublic _password]

  lappend result [expr {
    [string first 1234 [$connection ConnectionString]] != -1
  }]

  lappend result [expr {
    [string first ";Password=;" [$connection ConnectionString]] != -1
  }]

  lappend result [expr {
    [string first ";HexPassword=;" [$connection ConnectionString]] != -1
  }]

  lappend result [expr {
    [string first ";TextPassword=;" [$connection ConnectionString]] != -1
  }]

  lappend result [expr {
    [string first ";TextHexPassword=;" [$connection ConnectionString]] != -1
  }]

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain connection

  cleanupDb $fileName

  unset -nocomplain error result db fileName
} -constraints {eagle System.Data.SQLite.Encryption monoBug28 command.sql\
compile.DATA SQLite System.Data.SQLite} -result \
{0 1 0 1 0 2 {} False False False True False}}

###############################################################################

runTest {test tkt-23d8d6171e-1.4 {HidePassword flag w/TextHexPassword} -setup {
  setupDb [set fileName tkt-23d8d6171e-1.4.db] "" "" "" HidePassword \
      "TextHexPassword=1234;"
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  set result [list]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute $db \
      "INSERT INTO t1 (x) VALUES(1);"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {sql execute -execute scalar $db \
      "SELECT COUNT(*) FROM t1;"} error] \
      [extractSystemDataSQLiteExceptionMessage $error]

  set connection [getDbConnection]

  lappend result [$connection -flags +NonPublic _password]

  lappend result [expr {
    [string first 1234 [$connection ConnectionString]] != -1
  }]

  lappend result [expr {
    [string first ";Password=;" [$connection ConnectionString]] != -1
  }]

  lappend result [expr {
    [string first ";HexPassword=;" [$connection ConnectionString]] != -1
  }]

  lappend result [expr {
    [string first ";TextPassword=;" [$connection ConnectionString]] != -1
  }]

  lappend result [expr {
    [string first ";TextHexPassword=;" [$connection ConnectionString]] != -1
  }]

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain connection

  cleanupDb $fileName

  unset -nocomplain error result db fileName
} -constraints {eagle System.Data.SQLite.Encryption monoBug28 command.sql\
compile.DATA SQLite System.Data.SQLite} -result \
{0 1 0 1 0 2 {} False False False False True}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-2556655d1b.eagle.





















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
###############################################################################
#
# tkt-2556655d1b.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-2556655d1b-1.1 {duplicate functions} -setup {
  set fileName tkt-2556655d1b-1.1.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      \[SQLiteFunction(Name = "Base64", FuncType = FunctionType.Scalar)\]
      public class Test${id} : SQLiteFunction
      {
        public override object Invoke(
          object\[\] args
          )
        {
          if (args == null)
            return null;

          if (args.Length != 1)
            return new ArgumentException(String.Format(
              "need exactly one argument, got {0}", args.Length));

          object arg = args\[0\];

          if (arg == null)
            return String.Empty;

          Type type = arg.GetType();

          if (type == typeof(DBNull))
            return String.Empty;

          if (type != typeof(byte\[\]))
            return new ArgumentException(String.Format(
              "argument must be byte array, got {0}", type));

          return Convert.ToBase64String((byte\[\]) arg);
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          SQLiteFunction.RegisterFunction(typeof(Test${id}));
          SQLiteFunction.RegisterFunction(typeof(Test${id}));
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  #
  # NOTE: Compile the C# code (above) to register the custom SQLite function
  #       and then open the database for this test case and attempt to execute
  #       the function.  Normally, we would open the database in the test setup
  #       phase; however, that will not work correctly because newly registered
  #       functions are only picked up and used by databases opened after they
  #       have been registered.
  #
  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result [setupDb $fileName] \
      [sql execute -execute scalar $db "SELECT Base64(CAST(NULL AS BLOB));"] \
      [sql execute -execute scalar $db "SELECT Base64(CAST('' AS BLOB));"] \
      [sql execute -execute scalar $db "SELECT Base64(CAST('foo' AS BLOB));"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}\
System#Data#SQLite#SQLiteConnection#\d+ \{\} \{\} Zm9v$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-2abbf2c244.eagle.





















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
###############################################################################
#
# tkt-2abbf2c244.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-2abbf2c244-1.1 {PRAGMA incremental_vacuum} -setup {
  setupDb [set fileName tkt-2abbf2c244-1.1.db]
} -body {
  set result [list]

  lappend result [sql execute $db {PRAGMA page_size = 4096;}]
  lappend result [sql execute $db {PRAGMA auto_vacuum = INCREMENTAL;}]
  lappend result [sql execute -execute scalar $db {PRAGMA auto_vacuum;}]
  lappend result [file size [file join [getDatabaseDirectory] $fileName]]

  lappend result [sql execute $db {
    CREATE TABLE t1(x INTEGER, y TEXT);
    INSERT INTO t1 (x, y) VALUES(1, RANDOMBLOB(1048576));
    INSERT INTO t1 (x, y) VALUES(2, RANDOMBLOB(1048576));
    INSERT INTO t1 (x, y) VALUES(3, RANDOMBLOB(1048576));
    INSERT INTO t1 (x, y) VALUES(4, RANDOMBLOB(1048576));
    INSERT INTO t1 (x, y) VALUES(5, RANDOMBLOB(1048576));
    INSERT INTO t1 (x, y) VALUES(6, RANDOMBLOB(1048576));
    INSERT INTO t1 (x, y) VALUES(7, RANDOMBLOB(1048576));
    INSERT INTO t1 (x, y) VALUES(8, RANDOMBLOB(1048576));
    INSERT INTO t1 (x, y) VALUES(9, RANDOMBLOB(1048576));
  }]

  lappend result [file size [file join [getDatabaseDirectory] $fileName]]

  lappend result [sql execute -execute scalar $db {
    SELECT COUNT(*) FROM t1;
  }]

  lappend result [sql execute -execute scalar $db {
    PRAGMA freelist_count;
  }]

  lappend result [sql execute $db {
    DELETE FROM t1 WHERE x < 5;
  }]

  lappend result [sql execute -execute scalar $db {
    SELECT COUNT(*) FROM t1;
  }]

  lappend result [sql execute -execute scalar $db {
    PRAGMA freelist_count;
  }]

  lappend result [file size [file join [getDatabaseDirectory] $fileName]]

  lappend result [sql execute -execute scalar $db {
    PRAGMA incremental_vacuum;
  }]

  lappend result [file size [file join [getDatabaseDirectory] $fileName]]
  lappend result [expr {[lindex $result end] < [lindex $result end-2]}]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result {^-1 (?:-1|0) 2 4096 9 9469952 9 0 4 5 1025 9469952 \{\} 5267456\
True$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-2c630bffa7.eagle.





































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
###############################################################################
#
# tkt-2c630bffa7.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

set y [list -1.79769e308 -3.40282e038 -1 0 1 3.40282e038 1.79769e308]

###############################################################################

runTest {test tkt-2c630bffa7-1.1 {range of REAL type} -setup {
  setupDb [set fileName tkt-2c630bffa7-1.1.db]
} -body {
  sql execute $db "CREATE TABLE t1(x INTEGER, y REAL);"

  for {set x 0} {$x < [llength $y]} {incr x} {
    sql execute $db \
        "INSERT INTO t1 (x, y) VALUES($x, [lindex $y $x]);"
  }

  set result [sql execute -execute reader -format list $db \
      "SELECT x, y FROM t1 ORDER BY x;"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain x result db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -match regexp -result {^0 (?:-1\.79769E\+308|-Infinity) 1\
-3\.40282E\+38 2 -1 3 0 4 1 5 3\.40282E\+38 6 (?:1\.79769E\+308|Infinity)$}}

###############################################################################

runTest {test tkt-2c630bffa7-1.2 {range of FLOAT type} -setup {
  setupDb [set fileName tkt-2c630bffa7-1.2.db]
} -body {
  sql execute $db "CREATE TABLE t2(x INTEGER, y FLOAT);"

  for {set x 0} {$x < [llength $y]} {incr x} {
    sql execute $db \
        "INSERT INTO t2 (x, y) VALUES($x, [lindex $y $x]);"
  }

  set result [sql execute -execute reader -format list $db \
      "SELECT x, y FROM t2 ORDER BY x;"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain x result db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -match regexp -result {^0 (?:-1\.79769E\+308|-Infinity) 1\
-3\.40282E\+38 2 -1 3 0 4 1 5 3\.40282E\+38 6 (?:1\.79769E\+308|Infinity)$}}

###############################################################################

runTest {test tkt-2c630bffa7-1.3 {range of DOUBLE type} -setup {
  setupDb [set fileName tkt-2c630bffa7-1.3.db]
} -body {
  sql execute $db "CREATE TABLE t3(x INTEGER, y DOUBLE);"

  for {set x 0} {$x < [llength $y]} {incr x} {
    sql execute $db \
        "INSERT INTO t3 (x, y) VALUES($x, [lindex $y $x]);"
  }

  set result [sql execute -execute reader -format list $db \
      "SELECT x, y FROM t3 ORDER BY x;"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain x result db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -match regexp -result {^0 (?:-1\.79769E\+308|-Infinity) 1\
-3\.40282E\+38 2 -1 3 0 4 1 5 3\.40282E\+38 6 (?:1\.79769E\+308|Infinity)$}}

###############################################################################

unset -nocomplain y

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-2ce0870fad.eagle.











































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
###############################################################################
#
# tkt-2ce0870fad.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

#
# NOTE: Make sure that SQLite core library is completely shutdown prior to
#       starting any of the tests in this file.
#
shutdownSQLite $test_channel

###############################################################################

for {set i 1} {$i < 3} {incr i} {
  runTest {test [appendArgs tkt-2ce0870fad-1. $i] {logging setup} -setup \
      [getAppDomainPreamble {
    proc haveSQLiteObjectCommand {[info args haveSQLiteObjectCommand]} {
      [info body haveSQLiteObjectCommand]
    }

    set i {$i}

    set appDomainId($i) {[expr {[haveSQLiteObjectCommand] ? \
        [object invoke AppDomain.CurrentDomain Id] : [info appdomain]}]}

    set fileName {[appendArgs tkt-2ce0870fad-1. $i .db]}
  }] -body {
    set appDomainId(3) [object invoke AppDomain.CurrentDomain Id]

    package require Eagle.Library
    package require Eagle.Test
    package require System.Data.SQLite.Test

    set assembly [object load -loadtype File [file join [getBinaryDirectory] \
        System.Data.SQLite.dll]]

    object invoke System.Data.SQLite.SQLiteLog Initialize

    list $appDomainId($i) $appDomainId(3) [expr {$i == 1 ? \
        $appDomainId($i) != $appDomainId(3) : \
        $appDomainId($i) == $appDomainId(3)}] [setupDb $fileName]
  } -cleanup {
    cleanupDb $fileName

    #
    # NOTE: If this is the primary application domain, skip unsetting the
    #       loop variable because the surrounding [for] command still needs
    #       it.
    #
    if {$i <= 1} then {
      unset -nocomplain i
    }

    unset -nocomplain assembly appDomainId db fileName
  } -constraints {eagle command.object monoBug28 command.sql compile.DATA\
compile.ISOLATED_INTERPRETERS SQLite System.Data.SQLite} -isolationLevel \
[expr {$i == 1 ? "AppDomain" : "Default"}] -match regexp -result \
{^\d+ \d+ True System#Data#SQLite#SQLiteConnection#\d+$}}
}

###############################################################################

unset -nocomplain i

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-3113734605.eagle.

















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
###############################################################################
#
# tkt-3113734605.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-3113734605-1.1 {ColumnSize and NumericPrecision} -setup {
  setupDb [set fileName tkt-3113734605-1.1.db]
} -body {
  set connection [getDbConnection]

  set result [list]

  sql execute $db {
    CREATE TABLE t1(
      v BINARY(12), w CHAR(23), x NCHAR(34), y VARCHAR(45), z NVARCHAR(56)
    );
  }

  sql execute $db "CREATE VIEW v1 AS SELECT * FROM t1;"

  foreach collectionName [list TABLECOLUMNS VIEWCOLUMNS] {
    set dataTable [object invoke -alias $connection GetSchema $collectionName]

    if {[isNonNullObjectHandle $dataTable]} then {
      set dataRows [$dataTable Rows]

      object foreach -alias dataRow $dataRows {
        lappend result [set value [$dataRow get_Item TABLE_NAME]]
        lappend result [set value [$dataRow get_Item COLUMN_NAME]]
        lappend result [set value [$dataRow get_Item CHARACTER_MAXIMUM_LENGTH]]
        lappend result [set value [$dataRow get_Item NUMERIC_PRECISION]]
      }
    }
  }

  set result
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain value dataRow dataRows dataTable collectionName result \
      connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -match regexp -result {^t1 v 12 System#DBNull#\d+ t1 w 23\
System#DBNull#\d+ t1 x 34 System#DBNull#\d+ t1 y 45 System#DBNull#\d+ t1 z 56\
System#DBNull#\d+ v1 v 12 System#DBNull#\d+ v1 w 23 System#DBNull#\d+ v1 x 34\
System#DBNull#\d+ v1 y 45 System#DBNull#\d+ v1 z 56 System#DBNull#\d+ t1 v 12\
System#DBNull#\d+ t1 w 23 System#DBNull#\d+ t1 x 34 System#DBNull#\d+ t1 y 45\
System#DBNull#\d+ t1 z 56 System#DBNull#\d+$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-343d392b51.eagle.























































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
###############################################################################
#
# tkt-343d392b51.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

set dateTimeFormats [list "" Ticks ISO8601 JulianDay UnixEpoch]

for {set i 1} {$i < 5} {incr i} {
  set dateTimeFormat [lindex $dateTimeFormats $i]

  runTest {test [appendArgs tkt-343d392b51-1. $i] [subst {DateTime\
      binding $dateTimeFormat format}] -setup {
    setupDb [set fileName [appendArgs tkt-343d392b51-1. $i .db]] "" \
        $dateTimeFormat Utc

    set dateTime "4 October, 2011 3:27:50 PM GMT"
  } -body {
    sql execute $db "CREATE TABLE t1(x DATETIME);"

    set paramDateTime1 [clock format [clock scan $dateTime] -format \
        [getDateTimeFormat] -gmt true]

    switch -exact -- $dateTimeFormat {
      Ticks {
        set paramDateTime1 [object invoke \
            -create -alias DateTime Parse $paramDateTime1]

        set paramDateTime1 [$paramDateTime1 ToUniversalTime.Ticks]
        set paramDateTime2 $paramDateTime1
      }
      ISO8601 {
        set paramDateTime2 [appendArgs ' $paramDateTime1 ']
      }
      JulianDay {
        set paramDateTime1 [object invoke \
            -create -alias DateTime Parse $paramDateTime1]

        set paramDateTime1 [$paramDateTime1 -create -alias ToUniversalTime]

        set paramDateTime1 [expr {[$paramDateTime1 ToOADate] + \
            [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
            OleAutomationEpochAsJulianDay]}]

        set paramDateTime2 $paramDateTime1
      }
      UnixEpoch {
        set paramDateTime1 [clock scan $dateTime]
        set paramDateTime2 $paramDateTime1
      }
    }

    sql execute $db [appendArgs "INSERT INTO t1 (x) VALUES(" $paramDateTime2 \
        ");"]

    list [sql execute -verbatim -execute reader -format list -datetimeformat \
        [getDateTimeFormat] $db "SELECT x FROM t1 WHERE x = ?;" \
        [list param1 String $paramDateTime1]] \
        [sql execute -verbatim -execute reader -format list -datetimeformat \
        [getDateTimeFormat] $db "SELECT x FROM t1 WHERE x = ?;" \
        [list param1 DateTime $paramDateTime1]]
  } -cleanup {
    cleanupDb $fileName

    unset -nocomplain paramDateTime2 paramDateTime1 dateTime db fileName
  } -constraints {eagle command.object threadCulture.en_US monoBug28\
command.sql compile.DATA SQLite System.Data.SQLite} -result \
{{{2011-10-04 15:27:50Z}} {{2011-10-04 15:27:50Z}}}}
}

###############################################################################

unset -nocomplain dateTimeFormat i dateTimeFormats

###############################################################################

runTest {test tkt-343d392b51-2.1 {SQLiteDataAdapter update fail} -setup {
  setupDb [set fileName tkt-343d392b51-2.1.db]
  set otherFileName tkt-343d392b51-2.1-otherDb.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]
  set otherDataSource [file join [getDatabaseDirectory] $otherFileName]
  set otherDbName otherDb
  set otherTable [appendArgs $otherDbName .t1]

  set sql(inserts) ""
  set sql(1) [subst { \
    ATTACH DATABASE '${otherDataSource}' AS ${otherDbName}; \
    CREATE TABLE ${otherTable}(x INTEGER PRIMARY KEY, y DATETIME); \
    [for {set i 1} {$i < 3} {incr i} {
      append sql(inserts) [appendArgs \
          "INSERT INTO " ${otherTable} " (x, y) VALUES(" $i ", '" \
          [clock format $i -format [getDateTimeFormat]] "'); "]
    }; return [expr {[info exists sql(inserts)] ? $sql(inserts) : ""}]] \
  }]

  set sql(2) [subst { \
    SELECT x, y FROM ${otherTable} ORDER BY x; \
  }]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "${sql(1)}";
              command.ExecuteNonQuery();
            }

            using (SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(
                "${sql(2)}", connection))
            {
              using (DataSet dataSet = new DataSet())
              {
                dataAdapter.Fill(dataSet, "${otherTable}");

                DataTable dataTable = dataSet.Tables\["${otherTable}"\];

                dataTable.Columns\["x"\].Unique = true;
                dataTable.PrimaryKey = new DataColumn\[\] {
                  dataTable.Columns\["x"\]
                };

                [expr {[isMono] ? "#pragma warning disable 219" : ""}]
                SQLiteCommandBuilder commandBuilder =
                    new SQLiteCommandBuilder(dataAdapter);
                [expr {[isMono] ? "#pragma warning restore 219" : ""}]

                foreach (DataRow dataRow in dataTable.Rows)
                {
                  //
                  // NOTE: Update even rows and delete odd rows.
                  //
                  if ((long)dataRow\["x"\] % 2 == 0)
                    dataRow\["y"\] =
                        DateTime.UtcNow.ToString("[getDateTimeFormat]");
                  else
                    dataRow.Delete();
                }

                dataAdapter.Update(dataTable); // DBConcurrencyException (?)
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName; unset -nocomplain db fileName
  cleanupDb $otherFileName

  unset -nocomplain result code results errors i sql otherTable otherDbName \
      otherDataSource dataSource id otherFileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match glob -result {*\
System.Data.DBConcurrencyException: *}}

###############################################################################

runTest {test tkt-343d392b51-2.2 {SQLiteDataAdapter update success} -setup {
  setupDb [set fileName tkt-343d392b51-2.2.db] "" JulianDay
  set otherFileName tkt-343d392b51-2.2-otherDb.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]
  set otherDataSource [file join [getDatabaseDirectory] $otherFileName]
  set otherDbName otherDb
  set otherTable [appendArgs $otherDbName .t1]

  set sql(inserts) ""
  set sql(1) [subst { \
    ATTACH DATABASE '${otherDataSource}' AS ${otherDbName}; \
    CREATE TABLE ${otherTable}(x INTEGER PRIMARY KEY, y DATETIME); \
    [for {set i 1} {$i < 3} {incr i} {
      append sql(inserts) [appendArgs \
          "INSERT INTO " ${otherTable} " (x, y) VALUES(" $i ", JULIANDAY('" \
          [clock format $i -format [getDateTimeFormat]] "')); "]
    }; return [expr {[info exists sql(inserts)] ? $sql(inserts) : ""}]] \
  }]

  set sql(2) [subst { \
    SELECT x, y FROM ${otherTable} ORDER BY x; \
  }]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};DateTimeFormat=JulianDay;" +
              "[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "${sql(1)}";
              command.ExecuteNonQuery();
            }

            using (SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(
                "${sql(2)}", connection))
            {
              using (DataSet dataSet = new DataSet())
              {
                dataAdapter.Fill(dataSet, "${otherTable}");

                DataTable dataTable = dataSet.Tables\["${otherTable}"\];

                dataTable.Columns\["x"\].Unique = true;
                dataTable.PrimaryKey = new DataColumn\[\] {
                  dataTable.Columns\["x"\]
                };

                [expr {[isMono] ? "#pragma warning disable 219" : ""}]
                SQLiteCommandBuilder commandBuilder =
                    new SQLiteCommandBuilder(dataAdapter);
                [expr {[isMono] ? "#pragma warning restore 219" : ""}]

                foreach (DataRow dataRow in dataTable.Rows)
                {
                  //
                  // NOTE: Update even rows and delete odd rows.
                  //
                  if ((long)dataRow\["x"\] % 2 == 0)
                    dataRow\["y"\] =
                        DateTime.UtcNow.ToString("[getDateTimeFormat]");
                  else
                    dataRow.Delete();
                }

                dataAdapter.Update(dataTable); // DBConcurrencyException (?)
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName; unset -nocomplain db fileName
  cleanupDb $otherFileName

  unset -nocomplain result code results errors i sql otherTable otherDbName \
      otherDataSource dataSource id otherFileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}

###############################################################################

runTest {test tkt-343d392b51-3.1 {attached database, same table name} -setup {
  setupDb [set fileName tkt-343d392b51-3.1.db]
  set otherFileName tkt-343d392b51-3.1-otherDb.db
} -body {
  set otherDataSource [file join [getDatabaseDirectory] $otherFileName]
  set otherDbName otherDb
  set otherTable [appendArgs $otherDbName .t1]

  set sql(inserts) ""
  set sql(1) [subst { \
    CREATE TABLE t1(x INTEGER PRIMARY KEY); \
    ATTACH DATABASE '${otherDataSource}' AS ${otherDbName}; \
    CREATE TABLE ${otherTable}(x INTEGER PRIMARY KEY); \
    [for {set i 1} {$i < 3} {incr i} {
      append sql(inserts) [appendArgs \
          "INSERT INTO t1 (x) VALUES(" $i "); "]

      append sql(inserts) [appendArgs \
          "INSERT INTO " ${otherTable} " (x) VALUES(" [expr {$i * 2}] "); "]
    }; return [expr {[info exists sql(inserts)] ? $sql(inserts) : ""}]] \
  }]

  sql execute $db $sql(1)

  list [sql execute -execute reader -format list $db "SELECT x FROM t1;"] \
      [sql execute -execute reader -format list $db [appendArgs \
      "SELECT x FROM " ${otherTable} ";"]]
} -cleanup {
  cleanupDb $fileName; unset -nocomplain db fileName
  cleanupDb $otherFileName

  unset -nocomplain i sql otherTable otherDbName otherDataSource otherFileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{{1 2} {2 4}}}

###############################################################################

runTest {test tkt-343d392b51-3.2 {adapter, attached db, table names} -setup {
  setupDb [set fileName tkt-343d392b51-3.2.db]
  set otherFileName tkt-343d392b51-3.2-otherDb.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]
  set otherDataSource [file join [getDatabaseDirectory] $otherFileName]
  set otherDbName otherDb
  set otherTable [appendArgs $otherDbName .t1]

  set sql(inserts) ""
  set sql(1) [subst { \
    CREATE TABLE t1(x INTEGER PRIMARY KEY); \
    ATTACH DATABASE '${otherDataSource}' AS ${otherDbName}; \
    CREATE TABLE ${otherTable}(x INTEGER PRIMARY KEY); \
    [for {set i 1} {$i < 3} {incr i} {
      append sql(inserts) [appendArgs \
          "INSERT INTO t1 (x) VALUES(" $i ");"]
      append sql(inserts) [appendArgs \
          "INSERT INTO " ${otherTable} " (x) VALUES(" [expr {$i * 2}] "); "]
    }; return [expr {[info exists sql(inserts)] ? $sql(inserts) : ""}]] \
  }]

  set sql(2) [subst { \
    SELECT x FROM ${otherTable} ORDER BY x; \
  }]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "${sql(1)}";
              command.ExecuteNonQuery();
            }

            using (SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(
                "${sql(2)}", connection))
            {
              using (DataSet dataSet = new DataSet())
              {
                dataAdapter.Fill(dataSet, "${otherTable}");

                DataTable dataTable = dataSet.Tables\["${otherTable}"\];

                dataTable.Columns\["x"\].Unique = true;
                dataTable.PrimaryKey = new DataColumn\[\] {
                  dataTable.Columns\["x"\]
                };

                [expr {[isMono] ? "#pragma warning disable 219" : ""}]
                SQLiteCommandBuilder commandBuilder =
                    new SQLiteCommandBuilder(dataAdapter);
                [expr {[isMono] ? "#pragma warning restore 219" : ""}]

                foreach (DataRow dataRow in dataTable.Rows)
                  dataRow.Delete();

                dataAdapter.Update(dataTable); // DBConcurrencyException (?)
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName; unset -nocomplain db fileName
  cleanupDb $otherFileName

  unset -nocomplain result code results errors i sql otherTable otherDbName \
      otherDataSource dataSource id otherFileName
} -constraints {eagle command.object monoBug28 monoBug211 command.sql\
compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-3567020edf.eagle.































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
###############################################################################
#
# tkt-3567020edf.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-3567020edf-1.1 {embedded NUL characters (UTF-8)} -setup {
  setupDb [set fileName tkt-3567020edf-1.1.db]
} -body {
  sql execute $db "CREATE TABLE t1(x);"

  sql execute $db "INSERT INTO t1 (x) VALUES(?);" \
      [list param1 String one\x00two]

  sql execute -execute reader -format list $db "SELECT x FROM t1;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
"one\x00two"}

###############################################################################

runTest {test tkt-3567020edf-1.2 {embedded NUL characters (UTF-16)} -setup {
  setupDb [set fileName tkt-3567020edf-1.2.db] "" "" "" "" \
      UseUTF16Encoding=True
} -body {
  sql execute $db "CREATE TABLE t1(x);"

  sql execute $db "INSERT INTO t1 (x) VALUES(?);" \
      [list param1 String one\x00two]

  sql execute -execute reader -format list $db "SELECT x FROM t1;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
"one\x00two"}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-393d954be0.eagle.



















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
###############################################################################
#
# tkt-393d954be0.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-393d954be0-1.1 {custom connection pool} -setup {
  set nullPool [object create -flags +NonPublic -alias \
      System.Data.SQLite.NullConnectionPool true]

  object invoke System.Data.SQLite.SQLiteConnection ConnectionPool $nullPool

  setupDb [set fileName tkt-393d954be0-1.1.db] "" "" "" "" "Pooling=True;"
} -body {
  set exists(0) [file exists [file join [getDatabaseDirectory] [file tail \
      $fileName]]]

  cleanupDb $fileName

  set exists(1) [file exists [file join [getDatabaseDirectory] [file tail \
      $fileName]]]

  set counts null; set openCount 0; set closeCount 0; set totalCount 0
  object invoke -flags +NonPublic System.Data.SQLite.SQLiteConnectionPool \
      GetCounts $fileName counts openCount closeCount totalCount

  object invoke -flags +NonPublic System.Data.SQLite.SQLiteConnectionPool \
      ClearPool $fileName

  object invoke -flags +NonPublic System.Data.SQLite.SQLiteConnectionPool \
      ClearAllPools

  list $exists(0) $exists(1) $counts $openCount $closeCount $totalCount \
      [string map [list \r\n \n] [object invoke $nullPool ToString]]
} -cleanup {
  cleanupDb $fileName

  catch {object invoke System.Data.SQLite.SQLiteConnection ConnectionPool null}

  unset -nocomplain db fileName exists counts openCount closeCount totalCount \
      nullPool
} -constraints {eagle command.object monoBug28 buildConfiguration.Debug\
command.sql compile.DATA SQLite System.Data.SQLite} -match regexp -result \
{^True False \{\} 0 0 0\
\{Remove\(".*?[/\\]tkt-393d954be0-1\.1\.db",\
100, 0\)
ClearAllPools\(\)
Add\(".*?[/\\]tkt-393d954be0-1\.1\.db", -?\d+, 0\)
GetCounts\("tkt-393d954be0-1\.1\.db", , 0, 0, 0\)
ClearPool\("tkt-393d954be0-1\.1\.db"\)
ClearAllPools\(\)
\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-3aa50d8413.eagle.













































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
###############################################################################
#
# tkt-3aa50d8413.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-3aa50d8413-1.1 {FillSchema with multiple result sets} -setup {
  setupDb [set fileName tkt-3aa50d8413-1.1.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  sql execute $db {
    CREATE TABLE t1(x);
    CREATE TABLE t2(x);
  }

  set sql { \
    SELECT * FROM t1; \
    SELECT * FROM t2; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(
                "${sql}", connection))
            {
              using (DataSet dataSet = new DataSet())
              {
                dataAdapter.FillSchema(dataSet, SchemaType.Source);
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-3c00ec5b52.eagle.



















































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
###############################################################################
#
# tkt-3c00ec5b52.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-3c00ec5b52-1.1 {default types, via connection} -setup {
  setupDb [set fileName tkt-3c00ec5b52-1.1.db] "" "" "" UseConnectionTypes \
      "DefaultDbType=String;DefaultTypeName=TEXT;"
} -body {
  set connection [getDbConnection]
  set result [list]

  lappend result [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteConvert TypeNameToDbType $connection "" None]

  lappend result [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteConvert DbTypeToTypeName $connection Object None]

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain result connection

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {String TEXT}}

###############################################################################

runTest {test tkt-3c00ec5b52-1.2 {fallback default types w/flag} -setup {
  setupDb [set fileName tkt-3c00ec5b52-1.2.db] "" "" "" UseConnectionTypes
} -body {
  set connection [getDbConnection]
  set result [list]

  lappend result [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteConvert TypeNameToDbType $connection "" None]

  lappend result [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteConvert DbTypeToTypeName $connection Object None]

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain result connection

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {Object {}}}

###############################################################################

runTest {test tkt-3c00ec5b52-1.3 {fallback default types w/o flag} -setup {
  setupDb [set fileName tkt-3c00ec5b52-1.3.db]
} -body {
  set connection [getDbConnection]
  set result [list]

  lappend result [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteConvert TypeNameToDbType $connection "" None]

  lappend result [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteConvert DbTypeToTypeName $connection Object None]

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain result connection

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {Object {}}}

###############################################################################

runTest {test tkt-3c00ec5b52-1.4 {default types, via environment} -setup {
  saveSQLiteConvertEnvironment

  set env(Use_SQLiteConvert_DefaultDbType) String
  set env(Use_SQLiteConvert_DefaultTypeName) TEXT

  setupDb [set fileName tkt-3c00ec5b52-1.4.db]
} -body {
  set connection [getDbConnection]
  set result [list]

  lappend result [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteConvert TypeNameToDbType $connection "" None]

  lappend result [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteConvert DbTypeToTypeName $connection Object None]

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain result connection

  cleanupDb $fileName
  restoreSQLiteConvertEnvironment

  unset -nocomplain db fileName savedEnv
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {String TEXT}}

###############################################################################

runTest {test tkt-3c00ec5b52-1.5 {default types, with unique index} -setup {
  saveSQLiteConvertEnvironment

  set env(Use_SQLiteConvert_DefaultDbType) String
  set env(Use_SQLiteConvert_DefaultTypeName) TEXT

  setupDb [set fileName tkt-3c00ec5b52-1.5.db]
} -body {
  sql execute $db "CREATE TABLE t1(x UNIQUE);"

  set connection [getDbConnection]
  set dataTable [$connection -alias GetSchema INDEXES]
  set results [list]

  object foreach -alias dataRow [set dataRows [$dataTable -alias Rows]] {
    lappend results [list [$dataRow Item TABLE_NAME] \
        [$dataRow Item INDEX_NAME] [$dataRow Item UNIQUE]]
  }

  set results
} -cleanup {
  freeDbConnection

  unset -nocomplain results dataRow dataRows dataTable connection

  cleanupDb $fileName
  restoreSQLiteConvertEnvironment

  unset -nocomplain db fileName savedEnv
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{t1 sqlite_autoindex_t1_1 True}}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-3e783eecbe.eagle.





















































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
###############################################################################
#
# tkt-3e783eecbe.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-3e783eecbe-1.1 {To Julian Day w/o OLE Automation} -setup {
  set minDateTime [object invoke -create -alias DateTime MinValue]
  set maxDateTime [object invoke -create -alias DateTime MaxValue]

  set dateTimeValues [list $minDateTime "0099-12-31 00:00:00" \
      "0100-01-01 00:00:00" $maxDateTime]
} -body {
  set results [list]

  foreach dateTimeValue $dateTimeValues {
    if {$dateTimeValue ni [info objects]} then {
      set dateTimeValue [object invoke \
          -create DateTime ParseExact $dateTimeValue \
          [getDateTimeFormat] null]

      set dateTimeValue [object invoke -create -alias \
          DateTime SpecifyKind $dateTimeValue Utc]
    }

    set code [catch {
      object invoke System.Data.SQLite.SQLiteConvert ToJulianDay \
          $dateTimeValue
    } result]

    if {$code != 0} then {
      regexp -- {---> (.*?):} $result result result
      regexp -- {(System\..*?):} $result result result
    }

    lappend results [list [$dateTimeValue ToString [getDateTimeFormat]] \
        $code $result]
  }

  set results
} -cleanup {
  unset -nocomplain code result results dateTimeValue dateTimeValues \
      maxDateTime minDateTime
} -constraints {eagle command.object System.Data.SQLite} -match regexp \
-result {^\{\{0001-01-01 00:00:00\} 0 1721425\.5\} \{\{0099-12-31 00:00:00Z\}\
0 1757583\.5\} \{\{0100-01-01 00:00:00Z\} 0 1757584\.5\} \{\{9999-12-31\
23:59:59\.9999999\} 0 (?:5373484\.49999999|5373484\.499999989)\}$}}

###############################################################################

runTest {test tkt-3e783eecbe-1.2 {From Julian Day w/o OLE Automation} -setup {
  set minDoubleValue [object invoke -create -alias Double MinValue]
  set maxDoubleValue [object invoke -create -alias Double MaxValue]

  set doubleValues [list \
      $minDoubleValue -1.0 0.0 1.0 1721425.5 1757583.5 2451910.5 \
      2456962.0 5373484.49999998 5373484.49999999 $maxDoubleValue]
} -body {
  set results [list]

  foreach doubleValue $doubleValues {
    if {$doubleValue ni [info objects]} then {
      set doubleValue [object invoke \
          -create -alias Double Parse $doubleValue]
    }

    set code [catch {
      set dateTimeValue [object invoke -create -alias \
          System.Data.SQLite.SQLiteConvert ToDateTime $doubleValue Utc]

      $dateTimeValue ToString [getDateTimeFormat]
    } result]

    if {$code != 0} then {
      regexp -- {---> (.*?):} $result result result
      regexp -- {(System\..*?):} $result result result
    }

    lappend results [list [$doubleValue ToString] $code $result]
  }

  set results
} -cleanup {
  unset -nocomplain code result results dateTimeValue doubleValue \
      doubleValues maxDoubleValue minDoubleValue
} -constraints {eagle command.object System.Data.SQLite} -match regexp \
-result {^\{-1\.79769313486232E\+308|-1\.7976931348623157E\+308 1\
System\.ArgumentException\} \{-1 1 System\.ArgumentException\} \{0 1\
System\.ArgumentException\} \{1 1 System\.ArgumentException\} \{1721425\.5 0\
\{0001-01-01 00:00:00Z\}\} \{1757583\.5 0 \{0099-12-31 00:00:00Z\}\}\
\{2451910\.5 0 \{2001-01-01 00:00:00Z\}\} \{2456962 0 \{2014-10-31\
12:00:00Z\}\} \{5373484\.49999998 0 \{9999-12-31 23:59:59\.998Z\}\}\
\{5373484\.49999999 0 \{9999-12-31 23:59:59.999Z\}\}\
\{1\.79769313486232E\+308|1\.7976931348623157E\+308 1\
System\.ArgumentException\}$}}

###############################################################################

runTest {test tkt-3e783eecbe-1.3 {Julian Day storage} -setup {
  set doubleValues [list \
      -1.0 0.0 1.0 1721425.5 1757583.5 2451910.5 2456962.0 \
      5373484.49999998 5373484.49999999]

  setupDb [set fileName tkt-3e783eecbe-1.3.db] "" JulianDay
} -body {
  sql execute $db "CREATE TABLE t1(x INTEGER, y DATETIME);"

  set i 1
  set results [list]

  foreach doubleValue $doubleValues {
    if {$doubleValue ni [info objects]} then {
      set doubleValue [object invoke \
          -create -alias Double Parse $doubleValue]
    }

    set code [catch {
      sql execute $db "INSERT INTO t1 (x, y) VALUES(?, ?);" \
          [list param1 Int32 $i] [list param2 Double $doubleValue]

      sql execute -execute reader -format list -datetimeformat \
          [getDateTimeFormat] $db "SELECT y FROM t1 WHERE x = ?;" \
          [list param1 Int32 $i]
    } result]

    if {$code != 0} then {
      regexp -- {---> (.*?):} $result result result
      regexp -- {(System\..*?):} $result result result
    }

    lappend results [list [$doubleValue ToString] $code $result]
    incr i
  }

  set results
} -cleanup {
  unset -nocomplain code result results i dateTimeValue doubleValue \
      doubleValues maxDoubleValue minDoubleValue

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{-1 1 System.ArgumentException} {0 1\
System.ArgumentException} {1 1 System.ArgumentException} {1721425.5 0\
{{0001-01-01 00:00:00}}} {1757583.5 0 {{0099-12-31 00:00:00}}} {2451910.5 0\
{{2001-01-01 00:00:00}}} {2456962 0 {{2014-10-31 12:00:00}}} {5373484.49999998\
0 {{9999-12-31 23:59:59.998}}} {5373484.49999999 0\
{{9999-12-31 23:59:59.999}}}}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-41aea496e0.eagle.





























































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
###############################################################################
#
# tkt-41aea496e0.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue
runSQLiteTestFilesPrologue

###############################################################################

runTest {test tkt-41aea496e0-1.1 {LINQ non-rowid primary key support} -body {
  copySampleDatabaseFiles

  set result [list]
  set output ""

  set code [catch {
    testClrExec $testLinqExeFile [list -eventflags Wait -directory \
        [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
        -success Success] -complexprimarykey
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  lappend result $code

  if {$code == 0} then {
    lappend result [string trim $output]
  } else {
    lappend result [string trim $error]
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result
} -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll testExec\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db} \
-result {0 {inserted 2
updated 2}}}

###############################################################################

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-448d663d11.eagle.























































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
###############################################################################
#
# tkt-448d663d11.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue
runSQLiteTestFilesPrologue

###############################################################################

runTest {test tkt-448d663d11-1.1 {missing journal mode, new db} -body {
  setupDb [set fileName tkt-448d663d11-1.1.db]
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{delete}}

###############################################################################

runTest {test tkt-448d663d11-1.2 {missing journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.2.db
  file copy -force $walDbFile [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName "" "" "" "" "" true false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite file_wal.db} -result {wal}}

###############################################################################

runTest {test tkt-448d663d11-1.3 {missing journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.3.db
  file copy -force $nonWalDbFile [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName "" "" "" "" "" true false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite file_nonWal.db} -result {delete}}

###############################################################################

runTest {test tkt-448d663d11-1.4 {'Default' journal mode, new db} -body {
  setupDb [set fileName tkt-448d663d11-1.4.db] Default
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{delete}}

###############################################################################

runTest {test tkt-448d663d11-1.5 {'Default' journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.5.db
  file copy -force $walDbFile [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Default "" "" "" "" true false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite file_wal.db} -result {wal}}

###############################################################################

runTest {test tkt-448d663d11-1.6 {'Default' journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.6.db
  file copy -force $nonWalDbFile [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Default "" "" "" "" true false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite file_nonWal.db} -result {delete}}

###############################################################################

runTest {test tkt-448d663d11-1.7 {'Delete' journal mode, new db} -body {
  setupDb [set fileName tkt-448d663d11-1.7.db] Delete
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{delete}}

###############################################################################

runTest {test tkt-448d663d11-1.8 {'Delete' journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.8.db
  file copy -force $walDbFile [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Delete "" "" "" "" true false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite file_wal.db} -result {delete}}

###############################################################################

runTest {test tkt-448d663d11-1.9 {'Delete' journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.9.db
  file copy -force $nonWalDbFile [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Delete "" "" "" "" true false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite file_nonWal.db} -result {delete}}

###############################################################################

runTest {test tkt-448d663d11-1.10 {'Persist' journal mode, new db} -body {
  setupDb [set fileName tkt-448d663d11-1.10.db] Persist
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{persist}}

###############################################################################

runTest {test tkt-448d663d11-1.11 {'Off' journal mode, new db} -body {
  setupDb [set fileName tkt-448d663d11-1.11.db] Off
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{off}}

###############################################################################

runTest {test tkt-448d663d11-1.12 {'Truncate' journal mode, new db} -body {
  setupDb [set fileName tkt-448d663d11-1.12.db] Truncate
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{truncate}}

###############################################################################

runTest {test tkt-448d663d11-1.13 {'Memory' journal mode, new db} -body {
  setupDb [set fileName tkt-448d663d11-1.13.db] Memory
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{memory}}

###############################################################################

runTest {test tkt-448d663d11-1.14 {'Wal' journal mode, new db} -body {
  setupDb [set fileName tkt-448d663d11-1.14.db] Wal
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{wal}}

###############################################################################

runTest {test tkt-448d663d11-1.15 {'Wal' journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.15.db
  file copy -force $nonWalDbFile [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Wal "" "" "" "" true false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite file_nonWal.db} -result {wal}}

###############################################################################

runTest {test tkt-448d663d11-1.16 {'Wal' journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.16.db
  file copy -force $walDbFile [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Wal "" "" "" "" true false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite file_wal.db} -result {wal}}

###############################################################################

runTest {test tkt-448d663d11-1.17 {'Bad' journal mode, new db} -body {
  setupDb [set fileName tkt-448d663d11-1.17.db] Bad
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{delete}}

###############################################################################

runTest {test tkt-448d663d11-1.18 {'Bad' journal mode, non-WAL db} -body {
  set fileName tkt-448d663d11-1.18.db
  file copy -force $nonWalDbFile [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Bad "" "" "" "" true false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite file_nonWal.db} -result {delete}}

###############################################################################

runTest {test tkt-448d663d11-1.19 {'Bad' journal mode, WAL db} -body {
  set fileName tkt-448d663d11-1.19.db
  file copy -force $walDbFile [file join [getDatabaseDirectory] $fileName]
  setupDb $fileName Bad "" "" "" "" true false
  sql execute -execute scalar $db "PRAGMA journal_mode;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite file_wal.db} -result {wal}}

###############################################################################

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-47c6fa04d3.eagle.



































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
###############################################################################
#
# tkt-47c6fa04d3.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-47c6fa04d3-1.1 {loading DataTable with JOIN} -setup {
  setupDb [set fileName tkt-47c6fa04d3-1.1.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(
      t1x INTEGER PRIMARY KEY NOT NULL,
      t1y TEXT NOT NULL
    );

    INSERT INTO t1 (t1x, t1y) VALUES(1, 'one_t1');
    INSERT INTO t1 (t1x, t1y) VALUES(2, 'two_t1');
    INSERT INTO t1 (t1x, t1y) VALUES(3, 'three_t1');

    CREATE TABLE t2(
      t2x INTEGER PRIMARY KEY NOT NULL,
      t2t1x INTEGER NOT NULL,
      t2y TEXT,
      t2z INTEGER NOT NULL DEFAULT(0)
    );

    INSERT INTO t2 (t2x, t2t1x, t2y, t2z) VALUES(1, 2, 'one_t2', 1);
    INSERT INTO t2 (t2x, t2t1x, t2y, t2z) VALUES(2, 2, 'two_t2', 2);
    INSERT INTO t2 (t2x, t2t1x, t2y, t2z) VALUES(3, 2, 'three_t2', 3);

    CREATE TABLE t3(
      t3x INTEGER PRIMARY KEY NOT NULL,
      t3y INTEGER NOT NULL,
      t3z INTEGER NOT NULL
    );

    INSERT INTO t3 (t3x, t3y, t3z) VALUES(1, 2, 3);
    INSERT INTO t3 (t3x, t3y, t3z) VALUES(2, 1, 2);
  }

  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql {
    SELECT t1.t1x AS id, t3.t3y AS min, t3.t3z AS max,
           SUM(t2.t2z) AS sum
    FROM t1 t1 INNER JOIN t3 t3 INNER JOIN t2 t2
    ON t2.t2t1x = t1.t1x AND t2.t2z BETWEEN t3.t3y AND t3.t3z
    GROUP BY t1.t1x, t3.t3x, t3.t3y, t3.t3z;
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static DataTable GetDataTable()
        {
          DataTable dataTable;

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand(@"${sql}",
                connection))
            {
              using (SQLiteDataReader dataReader = command.ExecuteReader())
              {
                dataTable = new DataTable();
                dataTable.Load(dataReader);

                return dataTable;
              }
            }
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke -alias _Dynamic${id}.Test${id} GetDataTable
      } result] : [set result ""]}] $result [getRowsFromDataTable $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints {eagle command.object monoBug211 monoBug40 command.sql\
compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0\
System#Data#DataTable#\d+ \{\{\{id 2\} \{min 2\} \{max 3\} \{sum 5\}\} \{\{id\
2\} \{min 1\} \{max 2\} \{sum 3\}\}\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-47f4bac575.eagle.

































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
###############################################################################
#
# tkt-47f4bac575.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-47f4bac575-1.1 {SQLiteConvert DbTypeToTypeName} -setup {
  unset -nocomplain result dbType
} -body {
  foreach dbType [list \
      AnsiString Binary Byte Boolean Currency Date DateTime Decimal \
      Double Guid Int16 Int32 Int64 Object SByte Single String Time \
      UInt16 UInt32 UInt64 VarNumeric AnsiStringFixedLength \
      StringFixedLength Xml DateTime2 DateTimeOffset] {
    lappend result [list $dbType [object invoke -flags +NonPublic \
        System.Data.SQLite.SQLiteConvert DbTypeToTypeName null $dbType None]]
  }
  set result
} -cleanup {
  unset -nocomplain result dbType
} -constraints {eagle command.object System.Data.SQLite} -result {{AnsiString\
VARCHAR} {Binary BLOB} {Byte TINYINT} {Boolean BIT} {Currency {}} {Date {}}\
{DateTime DATETIME} {Decimal DECIMAL} {Double REAL} {Guid UNIQUEIDENTIFIER}\
{Int16 SMALLINT} {Int32 INT} {Int64 INTEGER} {Object {}} {SByte TINYSINT}\
{Single SINGLE} {String NVARCHAR} {Time {}} {UInt16 SMALLUINT} {UInt32 UINT}\
{UInt64 UNSIGNEDINTEGER} {VarNumeric {}} {AnsiStringFixedLength CHAR}\
{StringFixedLength NCHAR} {Xml {}} {DateTime2 {}} {DateTimeOffset {}}}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-48a6b8e4ca.eagle.

















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
###############################################################################
#
# tkt-48a6b8e4ca.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-48a6b8e4ca-1.1 {SQLiteTypeToType with NULL values} -setup {
  setupDb [set fileName tkt-48a6b8e4ca-1.1.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  sql execute $db {
    CREATE TABLE t1(x);
  }

  set sql { \
    PRAGMA table_info(t1); \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql}",
                connection))
            {
              using (SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(
                  command))
              {
                using (DataSet dataSet = new DataSet())
                {
                  dataAdapter.Fill(dataSet);
                }
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-4a791e70ab.eagle.



































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
###############################################################################
#
# tkt-4a791e70ab.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-4a791e70ab-1.1 {SQLiteDataAdapter w/SelectCommand} -setup {
  setupDb [set fileName tkt-4a791e70ab-1.1.db]
} -body {
  sql execute $db "CREATE TABLE t1(x);"

  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "SELECT x FROM t1 ORDER BY x;";

              using (SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(
                  command))
              {
                // do nothing.
              }

              string sql = command.CommandText; /* ObjectDisposedException? */
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll WarningLevel 0]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code dataSource id db fileName
} -constraints {eagle command.object monoBug211 monoBug40 command.sql\
compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-5251bd0878.eagle.





























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
###############################################################################
#
# tkt-5251bd0878.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-5251bd0878-1.1 {indexed expressions schema} -setup {
  setupDb [set fileName tkt-5251bd0878-1.1.db]
} -body {
  set connection [getDbConnection]

  sql execute $db {
    CREATE TABLE t1(x INTEGER PRIMARY KEY, y INTEGER);
    INSERT INTO t1 (y) VALUES (-2000);
    INSERT INTO t1 (y) VALUES (-1000);
    INSERT INTO t1 (y) VALUES (-200);
    INSERT INTO t1 (y) VALUES (-100);
    INSERT INTO t1 (y) VALUES (-20);
    INSERT INTO t1 (y) VALUES (-10);
    INSERT INTO t1 (y) VALUES (0);
    INSERT INTO t1 (y) VALUES (10);
    INSERT INTO t1 (y) VALUES (20);
    INSERT INTO t1 (y) VALUES (100);
    INSERT INTO t1 (y) VALUES (200);
    INSERT INTO t1 (y) VALUES (1000);
    INSERT INTO t1 (y) VALUES (2000);
    INSERT INTO t1 (y) VALUES (10000);
    INSERT INTO t1 (y) VALUES (20000);
    CREATE INDEX i1 ON t1(x, abs(y));
  }

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db "SELECT x, y FROM t1;"]

  set dataTable [$dataReader -alias GetSchemaTable]
  set result [list]

  foreach row [getRowsFromDataTable $dataTable] {
    foreach column $row {
      if {[lindex $column 0] in [list ColumnName IsKey]} then {
        lappend result $column
      }
    }
  }

  set result
} -cleanup {
  unset -nocomplain dataTable dataReader

  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain column row result connection db fileName
} -constraints {eagle command.object monoBug28 monoBug211 command.sql\
compile.DATA SQLite System.Data.SQLite} -result {{ColumnName x} {IsKey True}\
{ColumnName y} {IsKey False}}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-53633bbe39.eagle.





















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
###############################################################################
#
# tkt-53633bbe39.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-53633bbe39-1.1 {column affinity overrides} -setup {
  saveSQLiteConnectionEnvironment
  saveSQLiteConvertEnvironment

  set env(DefaultFlags_SQLiteConnection) \
      "DetectTextAffinity, DetectStringType, NoVerifyTextAffinity"

  set env(Use_SQLiteConvert_DefaultDbType) String
  set env(Use_SQLiteConvert_DefaultTypeName) TEXT

  setupDb [set fileName tkt-53633bbe39-1.1.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
    INSERT INTO t1 (x) VALUES(NULL);
    INSERT INTO t1 (x) VALUES(1);
    INSERT INTO t1 (x) VALUES(2.0);
    INSERT INTO t1 (x) VALUES(3.14159);
  }

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db "SELECT x FROM t1 ORDER BY x;"]

  set results [list]

  while {[$dataReader Read]} {
    set result(0) [list]

    lappend result(0) [catch {$dataReader GetString 0} result(1)] $result(1)
    lappend result(0) [catch {$dataReader GetValue 0} result(1)] $result(1)

    lappend results $result(0)
  }

  set results
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName
  restoreSQLiteConvertEnvironment
  restoreSQLiteConnectionEnvironment

  unset -nocomplain result results db fileName savedEnv
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result {^\{0 \{\} 0 System#DBNull#\d+\} \{0 1 0 1\} \{0 2\.0 0 2\.0\}\
\{0 3\.14159 0 3\.14159\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-53962f9eff.eagle.























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
###############################################################################
#
# tkt-53962f9eff.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-53962f9eff-1.1 {SQLiteException ToString IoErr} -body {
  set errCode [object invoke -create Enum Parse \
      System.Data.SQLite.SQLiteErrorCode IoErr_Delete_NoEnt false]

  set exception [object create -alias \
      System.Data.SQLite.SQLiteException $errCode "ioerr message."]

  normalizeExceptionMessage [$exception ToString]
} -cleanup {
  unset -nocomplain exception errCode
} -constraints {eagle command.object SQLite System.Data.SQLite} -match \
regexp -result {^code = IoErr_Delete_NoEnt \(5898\), message =\
System\.Data\.SQLite\.SQLiteException(?: \(0x8[0-9A-Fa-f]{7}\))?: disk I/O\
error ==> ioerr message\.$}}

###############################################################################

runTest {test tkt-53962f9eff-1.2 {SQLiteException ToString Ok} -body {
  set errCode [object invoke -create Enum Parse \
      System.Data.SQLite.SQLiteErrorCode Ok_Load_Permanently false]

  set exception [object create -alias \
      System.Data.SQLite.SQLiteException $errCode "ok message."]

  normalizeExceptionMessage [$exception ToString]
} -cleanup {
  unset -nocomplain exception errCode
} -constraints {eagle command.object SQLite System.Data.SQLite} -match \
regexp -result {^code = Ok_Load_Permanently \(256\), message =\
System\.Data\.SQLite\.SQLiteException(?: \(0x0[0-9A-Fa-f]{7}\))?: not an\
error ==> ok message.$}}

###############################################################################

runTest {test tkt-53962f9eff-1.3 {SQLiteException ToString unknown} -body {
  set errCode [object invoke -create Enum Parse \
      System.Data.SQLite.SQLiteErrorCode 999 false]

  set exception [object create -alias \
      System.Data.SQLite.SQLiteException $errCode "unknown message."]

  normalizeExceptionMessage [$exception ToString]
} -cleanup {
  unset -nocomplain exception errCode
} -constraints {eagle command.object SQLite System.Data.SQLite} -match \
regexp -result {^code = 999 \(999\), message =\
System\.Data\.SQLite\.SQLiteException(?: \(0x8[0-9A-Fa-f]{7}\))?: unknown\
error ==> unknown message\.$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-544dba0a2f.eagle.



























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
###############################################################################
#
# tkt-544dba0a2f.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-544dba0a2f-1.1 {BOOL versus BOOLEAN} -setup {
  setupDb [set fileName tkt-544dba0a2f-1.1.db]
} -body {
  sql execute $db "CREATE TABLE t1(x BOOL, y BOOLEAN);"
  sql execute $db "INSERT INTO t1 (x, y) VALUES(0, 0);"
  sql execute $db "INSERT INTO t1 (x, y) VALUES(0, 1);"
  sql execute $db "INSERT INTO t1 (x, y) VALUES(1, 0);"
  sql execute $db "INSERT INTO t1 (x, y) VALUES(1, 1);"

  sql execute -execute reader -format list $db \
      "SELECT x, y FROM t1 ORDER BY rowid;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{False False False True True False True True}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-5535448538.eagle.



































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
###############################################################################
#
# tkt-5535448538.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-5535448538-1.1 {reading oversize integer values} -setup {
  setupDb [set fileName tkt-5535448538-1.1.db] "" "" "" NoVerifyTypeAffinity
} -body {
  set result [list]

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db "SELECT ?, 0x10FFFFFFF, 0x1FFFFFFFF;" [list param1 \
      String 0xFFFFFFFF]]

  while {[$dataReader Read]} {
    lappend result [$dataReader GetByte 0]
    lappend result [$dataReader GetInt16 0]
    lappend result [$dataReader GetInt32 0]
    lappend result [$dataReader GetInt64 0]

    lappend result [$dataReader GetByte 1]
    lappend result [$dataReader GetInt16 1]
    lappend result [$dataReader GetInt32 1]
    lappend result [$dataReader GetInt64 1]

    lappend result [$dataReader GetByte 2]
    lappend result [$dataReader GetInt16 2]
    lappend result [$dataReader GetInt32 2]
    lappend result [$dataReader GetInt64 2]
  }

  $dataReader Close; unset dataReader

  set result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {255 -1 -1 4294967295 255 -1 268435455 4563402751\
255 -1 -1 8589934591}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-56b42d99c1.eagle.





































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
###############################################################################
#
# tkt-56b42d99c1.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-56b42d99c1-1.1 {enlisted transaction isolation} -setup {
  setupDb [set fileName tkt-56b42d99c1-1.1.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;
    using System.Reflection;
    using System.Transactions;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static bool TryEnlistInTransaction()
        {
          TransactionOptions transactionOptions = new TransactionOptions();
          transactionOptions.IsolationLevel = IsolationLevel.ReadCommitted;

          using (TransactionScope transactionScope = new TransactionScope(
              TransactionScopeOption.Required, transactionOptions))
          {
            using (SQLiteConnection connection1 = new SQLiteConnection(
                "Data Source=${dataSource};[getTestProperties]"))
            {
              connection1.Open();

              using (SQLiteConnection connection2 = new SQLiteConnection(
                  "Data Source=${dataSource};[getTestProperties]"))
              {
                connection2.Open();

                BindingFlags bindingFlags = BindingFlags.Instance |
                  BindingFlags.NonPublic | BindingFlags.GetField;

                FieldInfo fieldInfo1 = connection1.GetType().GetField(
                  "_enlistment", bindingFlags);

                object enlistment1 = fieldInfo1.GetValue(connection1);
                object enlistment2 = fieldInfo1.GetValue(connection2);

                FieldInfo fieldInfo2 = enlistment1.GetType().GetField(
                  "_transaction", bindingFlags);

                SQLiteTransaction transaction1 =
                  (SQLiteTransaction)fieldInfo2.GetValue(enlistment1);

                SQLiteTransaction transaction2 =
                  (SQLiteTransaction)fieldInfo2.GetValue(enlistment2);

                return (transaction1.IsolationLevel ==
                        transaction2.IsolationLevel);
              }
            }
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} TryEnlistInTransaction
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code dataSource id db fileName
} -constraints {eagle command.object monoBug211 monoBug64 command.sql\
compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 True$}}

###############################################################################

runTest {test tkt-56b42d99c1-1.2 {enlisted transaction isolation} -setup {
  setupDb [set fileName tkt-56b42d99c1-1.2.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set sql(1) { \
    CREATE TABLE t1(x); \
    INSERT INTO t1 (x) VALUES(1); \
  }

  set sql(2) { \
    SELECT COUNT(*) FROM sqlite_master WHERE type = 'table'; \
  }

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;
    using System.Transactions;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static int Main()
        {
          TransactionOptions transactionOptions = new TransactionOptions();
          transactionOptions.IsolationLevel = IsolationLevel.ReadCommitted;

          using (TransactionScope transactionScope = new TransactionScope(
              TransactionScopeOption.Required, transactionOptions))
          {
            using (SQLiteConnection connection1 = new SQLiteConnection(
                "Data Source=${dataSource};[getTestProperties]"))
            {
              connection1.Open();

              using (SQLiteConnection connection2 = new SQLiteConnection(
                  "Data Source=${dataSource};[getTestProperties]"))
              {
                connection2.Open();

                using (SQLiteCommand command1 = connection1.CreateCommand())
                {
                  command1.CommandText = "${sql(1)}";
                  command1.ExecuteNonQuery();

                  using (SQLiteCommand command2 = connection2.CreateCommand())
                  {
                    command2.CommandText = "${sql(2)}";
                    return (int)(long)command2.ExecuteScalar();
                  }
                }
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints {eagle command.object monoBug211 monoBug64 command.sql\
compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 0$}}

###############################################################################

runTest {test tkt-56b42d99c1-1.3 {enlisted transaction isolation} -setup {
  setupDb [set fileName tkt-56b42d99c1-1.3.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set sql(1) { \
    CREATE TABLE t1(x); \
    INSERT INTO t1 (x) VALUES(1); \
  }

  set sql(2) { \
    SELECT COUNT(*) FROM sqlite_master WHERE type = 'table'; \
  }

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;
    using System.Transactions;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static int Main()
        {
          TransactionOptions transactionOptions = new TransactionOptions();
          transactionOptions.IsolationLevel = IsolationLevel.ReadCommitted;

          using (TransactionScope transactionScope = new TransactionScope(
              TransactionScopeOption.Required, transactionOptions))
          {
            using (SQLiteConnection connection1 = new SQLiteConnection(
                "Data Source=${dataSource};Enlist=False;[getTestProperties]"))
            {
              connection1.Open();

              using (SQLiteConnection connection2 = new SQLiteConnection(
                  "Data Source=${dataSource};Enlist=False;[getTestProperties]"))
              {
                connection2.Open();

                using (SQLiteCommand command1 = connection1.CreateCommand())
                {
                  command1.CommandText = "${sql(1)}";
                  command1.ExecuteNonQuery();

                  using (SQLiteCommand command2 = connection2.CreateCommand())
                  {
                    command2.CommandText = "${sql(2)}";
                    return (int)(long)command2.ExecuteScalar();
                  }
                }
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 1$}}

###############################################################################

runTest {test tkt-56b42d99c1-1.4 {enlisted transaction isolation} -setup {
  setupDb [set fileName tkt-56b42d99c1-1.4.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set sql(1) { \
    CREATE TABLE t1(x); \
    INSERT INTO t1 (x) VALUES(1); \
  }

  set sql(2) { \
    SELECT COUNT(*) FROM sqlite_master WHERE type = 'table'; \
  }

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;
    using System.Transactions;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static int Main()
        {
          TransactionOptions transactionOptions = new TransactionOptions();
          transactionOptions.IsolationLevel = IsolationLevel.ReadCommitted;

          using (TransactionScope transactionScope = new TransactionScope(
              TransactionScopeOption.Required, transactionOptions))
          {
            using (SQLiteConnection connection1 = new SQLiteConnection(
                "Data Source=${dataSource};[getTestProperties]"))
            {
              connection1.Open();

              using (SQLiteConnection connection2 = new SQLiteConnection(
                  "Data Source=${dataSource};Enlist=False;[getTestProperties]"))
              {
                connection2.Open();

                using (SQLiteCommand command1 = connection1.CreateCommand())
                {
                  command1.CommandText = "${sql(1)}";
                  command1.ExecuteNonQuery();

                  using (SQLiteCommand command2 = connection2.CreateCommand())
                  {
                    command2.CommandText = "${sql(2)}";
                    return (int)(long)command2.ExecuteScalar();
                  }
                }
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 0$}}

###############################################################################

runTest {test tkt-56b42d99c1-1.5 {enlisted transaction isolation} -setup {
  setupDb [set fileName tkt-56b42d99c1-1.5.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set sql(1) { \
    CREATE TABLE t1(x); \
    INSERT INTO t1 (x) VALUES(1); \
  }

  set sql(2) { \
    SELECT COUNT(*) FROM sqlite_master WHERE type = 'table'; \
  }

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;
    using System.Transactions;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static int Main()
        {
          TransactionOptions transactionOptions = new TransactionOptions();
          transactionOptions.IsolationLevel = IsolationLevel.ReadCommitted;

          using (TransactionScope transactionScope = new TransactionScope(
              TransactionScopeOption.Required, transactionOptions))
          {
            using (SQLiteConnection connection1 = new SQLiteConnection(
                "Data Source=${dataSource};Enlist=False;[getTestProperties]"))
            {
              connection1.Open();

              using (SQLiteConnection connection2 = new SQLiteConnection(
                  "Data Source=${dataSource};[getTestProperties]"))
              {
                connection2.Open();

                using (SQLiteCommand command1 = connection1.CreateCommand())
                {
                  command1.CommandText = "${sql(1)}";
                  command1.ExecuteNonQuery();

                  using (SQLiteCommand command2 = connection2.CreateCommand())
                  {
                    command2.CommandText = "${sql(2)}";
                    return (int)(long)command2.ExecuteScalar();
                  }
                }
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints {eagle command.object monoBug211 monoBug64 command.sql\
compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 1$}}

###############################################################################

set flags MapIsolationLevels

###############################################################################

runTest {test tkt-56b42d99c1-1.6 {enlisted transaction isolation} -setup {
  setupDb [set fileName tkt-56b42d99c1-1.6.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;
    using System.Reflection;
    using System.Transactions;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static bool TryEnlistInTransaction()
        {
          TransactionOptions transactionOptions = new TransactionOptions();
          transactionOptions.IsolationLevel = IsolationLevel.ReadUncommitted;

          using (TransactionScope transactionScope = new TransactionScope(
              TransactionScopeOption.Required, transactionOptions))
          {
            using (SQLiteConnection connection1 = new SQLiteConnection(
                "Data Source=${dataSource};[getTestProperties $flags]"))
            {
              connection1.Open();

              using (SQLiteConnection connection2 = new SQLiteConnection(
                  "Data Source=${dataSource};[getTestProperties $flags]"))
              {
                connection2.Open();

                BindingFlags bindingFlags = BindingFlags.Instance |
                  BindingFlags.NonPublic | BindingFlags.GetField;

                FieldInfo fieldInfo1 = connection1.GetType().GetField(
                  "_enlistment", bindingFlags);

                object enlistment1 = fieldInfo1.GetValue(connection1);
                object enlistment2 = fieldInfo1.GetValue(connection2);

                FieldInfo fieldInfo2 = enlistment1.GetType().GetField(
                  "_transaction", bindingFlags);

                SQLiteTransaction transaction1 =
                  (SQLiteTransaction)fieldInfo2.GetValue(enlistment1);

                SQLiteTransaction transaction2 =
                  (SQLiteTransaction)fieldInfo2.GetValue(enlistment2);

                return (transaction1.IsolationLevel ==
                        transaction2.IsolationLevel);
              }
            }
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} TryEnlistInTransaction
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code dataSource id db fileName
} -constraints {eagle command.object monoBug28 monoBug211 monoBug64 command.sql\
compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 True$}}

###############################################################################

runTest {test tkt-56b42d99c1-1.7 {enlisted transaction isolation} -setup {
  setupDb [set fileName tkt-56b42d99c1-1.7.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set sql(1) { \
    CREATE TABLE t1(x); \
    INSERT INTO t1 (x) VALUES(1); \
  }

  set sql(2) { \
    SELECT COUNT(*) FROM sqlite_master WHERE type = 'table'; \
  }

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;
    using System.Transactions;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static int Main()
        {
          TransactionOptions transactionOptions = new TransactionOptions();
          transactionOptions.IsolationLevel = IsolationLevel.ReadUncommitted;

          using (TransactionScope transactionScope = new TransactionScope(
              TransactionScopeOption.Required, transactionOptions))
          {
            using (SQLiteConnection connection1 = new SQLiteConnection(
                "Data Source=${dataSource};[getTestProperties $flags]"))
            {
              connection1.Open();

              using (SQLiteConnection connection2 = new SQLiteConnection(
                  "Data Source=${dataSource};[getTestProperties $flags]"))
              {
                connection2.Open();

                using (SQLiteCommand command1 = connection1.CreateCommand())
                {
                  command1.CommandText = "${sql(1)}";
                  command1.ExecuteNonQuery();

                  using (SQLiteCommand command2 = connection2.CreateCommand())
                  {
                    command2.CommandText = "${sql(2)}";
                    return (int)(long)command2.ExecuteScalar();
                  }
                }
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints {eagle command.object monoBug28 monoBug211 monoBug64 command.sql\
compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 0$}}

###############################################################################

runTest {test tkt-56b42d99c1-1.8 {enlisted transaction isolation} -setup {
  setupDb [set fileName tkt-56b42d99c1-1.8.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set sql(1) { \
    CREATE TABLE t1(x); \
    INSERT INTO t1 (x) VALUES(1); \
  }

  set sql(2) { \
    SELECT COUNT(*) FROM sqlite_master WHERE type = 'table'; \
  }

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;
    using System.Transactions;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static int Main()
        {
          TransactionOptions transactionOptions = new TransactionOptions();
          transactionOptions.IsolationLevel = IsolationLevel.ReadUncommitted;

          using (TransactionScope transactionScope = new TransactionScope(
              TransactionScopeOption.Required, transactionOptions))
          {
            using (SQLiteConnection connection1 = new SQLiteConnection(
                "Data Source=${dataSource};Enlist=False;[getTestProperties $flags]"))
            {
              connection1.Open();

              using (SQLiteConnection connection2 = new SQLiteConnection(
                  "Data Source=${dataSource};Enlist=False;[getTestProperties $flags]"))
              {
                connection2.Open();

                using (SQLiteCommand command1 = connection1.CreateCommand())
                {
                  command1.CommandText = "${sql(1)}";
                  command1.ExecuteNonQuery();

                  using (SQLiteCommand command2 = connection2.CreateCommand())
                  {
                    command2.CommandText = "${sql(2)}";
                    return (int)(long)command2.ExecuteScalar();
                  }
                }
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 1$}}

###############################################################################

runTest {test tkt-56b42d99c1-1.9 {enlisted transaction isolation} -setup {
  setupDb [set fileName tkt-56b42d99c1-1.9.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set sql(1) { \
    CREATE TABLE t1(x); \
    INSERT INTO t1 (x) VALUES(1); \
  }

  set sql(2) { \
    SELECT COUNT(*) FROM sqlite_master WHERE type = 'table'; \
  }

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;
    using System.Transactions;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static int Main()
        {
          TransactionOptions transactionOptions = new TransactionOptions();
          transactionOptions.IsolationLevel = IsolationLevel.ReadUncommitted;

          using (TransactionScope transactionScope = new TransactionScope(
              TransactionScopeOption.Required, transactionOptions))
          {
            using (SQLiteConnection connection1 = new SQLiteConnection(
                "Data Source=${dataSource};[getTestProperties $flags]"))
            {
              connection1.Open();

              using (SQLiteConnection connection2 = new SQLiteConnection(
                  "Data Source=${dataSource};Enlist=False;[getTestProperties $flags]"))
              {
                connection2.Open();

                using (SQLiteCommand command1 = connection1.CreateCommand())
                {
                  command1.CommandText = "${sql(1)}";
                  command1.ExecuteNonQuery();

                  using (SQLiteCommand command2 = connection2.CreateCommand())
                  {
                    command2.CommandText = "${sql(2)}";
                    return (int)(long)command2.ExecuteScalar();
                  }
                }
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 0$}}

###############################################################################

runTest {test tkt-56b42d99c1-1.10 {enlisted transaction isolation} -setup {
  setupDb [set fileName tkt-56b42d99c1-1.10.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set sql(1) { \
    CREATE TABLE t1(x); \
    INSERT INTO t1 (x) VALUES(1); \
  }

  set sql(2) { \
    SELECT COUNT(*) FROM sqlite_master WHERE type = 'table'; \
  }

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;
    using System.Transactions;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static int Main()
        {
          TransactionOptions transactionOptions = new TransactionOptions();
          transactionOptions.IsolationLevel = IsolationLevel.ReadUncommitted;

          using (TransactionScope transactionScope = new TransactionScope(
              TransactionScopeOption.Required, transactionOptions))
          {
            using (SQLiteConnection connection1 = new SQLiteConnection(
                "Data Source=${dataSource};Enlist=False;[getTestProperties $flags]"))
            {
              connection1.Open();

              using (SQLiteConnection connection2 = new SQLiteConnection(
                  "Data Source=${dataSource};[getTestProperties $flags]"))
              {
                connection2.Open();

                using (SQLiteCommand command1 = connection1.CreateCommand())
                {
                  command1.CommandText = "${sql(1)}";
                  command1.ExecuteNonQuery();

                  using (SQLiteCommand command2 = connection2.CreateCommand())
                  {
                    command2.CommandText = "${sql(2)}";
                    return (int)(long)command2.ExecuteScalar();
                  }
                }
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints {eagle command.object monoBug28 monoBug211 monoBug64 command.sql\
compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
{^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 1$}}

###############################################################################

unset -nocomplain flags

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-58ed318f2f.eagle.

























































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
###############################################################################
#
# tkt-58ed318f2f.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

reportSQLiteResources $test_channel true

###############################################################################

runTest {test tkt-58ed318f2f-1.1 {standard GetDefaultDbType usage} -setup {
  setupDb [set fileName tkt-58ed318f2f-1.1.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x, y);
    INSERT INTO t1 (x, y) VALUES(0, 1);
    INSERT INTO t1 (x, y) VALUES('0', '1');
  }

  sql execute -execute reader -format list $db "SELECT x, y FROM t1;"

  expr {[getSettingReadCount Use_SQLiteConvert_DefaultDbType] == 1}
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite buildConfiguration.Debug} -result {True}}

###############################################################################

reportSQLiteResources $test_channel true

###############################################################################

runTest {test tkt-58ed318f2f-1.2 {no property GetDefaultDbType usage} -setup {
  setupDb [set fileName tkt-58ed318f2f-1.2.db] "" "" "" UseConnectionTypes
} -body {
  sql execute $db {
    CREATE TABLE t1(x, y);
    INSERT INTO t1 (x, y) VALUES(0, 1);
    INSERT INTO t1 (x, y) VALUES('0', '1');
  }

  sql execute -execute reader -format list $db "SELECT x, y FROM t1;"

  expr {[getSettingReadCount Use_SQLiteConvert_DefaultDbType] == 1}
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite buildConfiguration.Debug} -result {True}}

###############################################################################

reportSQLiteResources $test_channel true

###############################################################################

runTest {test tkt-58ed318f2f-1.3 {no flag GetDefaultDbType usage} -setup {
  setupDb [set fileName tkt-58ed318f2f-1.3.db] "" "" "" "" \
      "DefaultDbType=String;"
} -body {
  sql execute $db {
    CREATE TABLE t1(x, y);
    INSERT INTO t1 (x, y) VALUES(0, 1);
    INSERT INTO t1 (x, y) VALUES('0', '1');
  }

  sql execute -execute reader -format list $db "SELECT x, y FROM t1;"

  expr {[getSettingReadCount Use_SQLiteConvert_DefaultDbType] == -1}
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite buildConfiguration.Debug} -result {True}}

###############################################################################

reportSQLiteResources $test_channel true

###############################################################################

runTest {test tkt-58ed318f2f-1.4 {zero GetDefaultDbType usage} -setup {
  setupDb [set fileName tkt-58ed318f2f-1.4.db] "" "" "" UseConnectionTypes \
      "DefaultDbType=String;"
} -body {
  sql execute $db {
    CREATE TABLE t1(x, y);
    INSERT INTO t1 (x, y) VALUES(0, 1);
    INSERT INTO t1 (x, y) VALUES('0', '1');
  }

  sql execute -execute reader -format list $db "SELECT x, y FROM t1;"

  expr {[getSettingReadCount Use_SQLiteConvert_DefaultDbType] == -1}
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite buildConfiguration.Debug} -result {True}}

###############################################################################

reportSQLiteResources $test_channel true

###############################################################################

runTest {test tkt-58ed318f2f-1.5 {standard GetDefaultTypeName usage} -setup {
  setupDb [set fileName tkt-58ed318f2f-1.5.db]
} -body {
  set connection [getDbConnection]

  sql execute $db {
    CREATE TABLE t1(x, y);
    INSERT INTO t1 (x, y) VALUES(0, 1);
    INSERT INTO t1 (x, y) VALUES('0', '1');
  }

  set columns [$connection GetSchema COLUMNS]

  expr {[getSettingReadCount Use_SQLiteConvert_DefaultTypeName] == 1}
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain columns connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite buildConfiguration.Debug} -result {True}}

###############################################################################

reportSQLiteResources $test_channel true

###############################################################################

runTest {test tkt-58ed318f2f-1.6 {no property GetDefaultTypeName usage} -setup {
  setupDb [set fileName tkt-58ed318f2f-1.6.db] "" "" "" UseConnectionTypes
} -body {
  set connection [getDbConnection]

  sql execute $db {
    CREATE TABLE t1(x, y);
    INSERT INTO t1 (x, y) VALUES(0, 1);
    INSERT INTO t1 (x, y) VALUES('0', '1');
  }

  set columns [$connection GetSchema COLUMNS]

  expr {[getSettingReadCount Use_SQLiteConvert_DefaultTypeName] == 1}
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain columns connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite buildConfiguration.Debug} -result {True}}

###############################################################################

reportSQLiteResources $test_channel true

###############################################################################

runTest {test tkt-58ed318f2f-1.7 {no flag GetDefaultTypeName usage} -setup {
  setupDb [set fileName tkt-58ed318f2f-1.7.db] "" "" "" "" \
      "DefaultDbType=String;"
} -body {
  set connection [getDbConnection]

  sql execute $db {
    CREATE TABLE t1(x, y);
    INSERT INTO t1 (x, y) VALUES(0, 1);
    INSERT INTO t1 (x, y) VALUES('0', '1');
  }

  set columns [$connection GetSchema COLUMNS]

  expr {[getSettingReadCount Use_SQLiteConvert_DefaultTypeName] == -1}
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain columns connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite buildConfiguration.Debug} -result {True}}

###############################################################################

reportSQLiteResources $test_channel true

###############################################################################

runTest {test tkt-58ed318f2f-1.8 {zero GetDefaultTypeName usage} -setup {
  setupDb [set fileName tkt-58ed318f2f-1.8.db] "" "" "" UseConnectionTypes \
      "DefaultTypeName=TEXT;"
} -body {
  set connection [getDbConnection]

  sql execute $db {
    CREATE TABLE t1(x, y);
    INSERT INTO t1 (x, y) VALUES(0, 1);
    INSERT INTO t1 (x, y) VALUES('0', '1');
  }

  set columns [$connection GetSchema COLUMNS]

  expr {[getSettingReadCount Use_SQLiteConvert_DefaultTypeName] == -1}
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain columns connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite buildConfiguration.Debug} -result {True}}

###############################################################################

reportSQLiteResources $test_channel true

###############################################################################

runTest {test tkt-58ed318f2f-1.9 {zero DefaultDbType settings read} -setup {
  setupDb [set fileName tkt-58ed318f2f-1.9.db] "" "" "" NoConvertSettings
} -body {
  sql execute $db {
    CREATE TABLE t1(x, y);
    INSERT INTO t1 (x, y) VALUES(0, 1);
    INSERT INTO t1 (x, y) VALUES('0', '1');
  }

  sql execute -execute reader -format list $db "SELECT x, y FROM t1;"

  expr {[getSettingReadCount Use_SQLiteConvert_DefaultDbType] == -1}
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite buildConfiguration.Debug} -result {True}}

###############################################################################

reportSQLiteResources $test_channel true

###############################################################################

runTest {test tkt-58ed318f2f-1.10 {zero DefaultTypeName settings read} -setup {
  setupDb [set fileName tkt-58ed318f2f-1.10.db] "" "" "" NoConvertSettings
} -body {
  set connection [getDbConnection]

  sql execute $db {
    CREATE TABLE t1(x, y);
    INSERT INTO t1 (x, y) VALUES(0, 1);
    INSERT INTO t1 (x, y) VALUES('0', '1');
  }

  set columns [$connection GetSchema COLUMNS]

  expr {[getSettingReadCount Use_SQLiteConvert_DefaultTypeName] == -1}
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain columns connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite buildConfiguration.Debug} -result {True}}

###############################################################################

reportSQLiteResources $test_channel true

###############################################################################

runTest {test tkt-58ed318f2f-1.11 {normal SQLiteConvert settings usage} -setup {
  setupDb [set fileName tkt-58ed318f2f-1.11.db]
} -body {
  set connection [getDbConnection]

  sql execute $db {
    CREATE TABLE t1(x, y);
    INSERT INTO t1 (x, y) VALUES(0, 1);
    INSERT INTO t1 (x, y) VALUES('0', '1');
  }

  sql execute -execute reader -format list $db "SELECT x, y FROM t1;"
  set columns [$connection GetSchema COLUMNS]

  #
  # TODO: These counts may need to be updated in future versions.
  #
  expr {[getSettingReadCount Use_SQLiteConvert_DefaultDbType] == 1 && \
      [getSettingReadCount Use_SQLiteConvert_DefaultTypeName] == 1}
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain columns connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite buildConfiguration.Debug} -result {True}}

###############################################################################

reportSQLiteResources $test_channel true

###############################################################################

runTest {test tkt-58ed318f2f-1.12 {zero SQLiteConvert settings usage} -setup {
  setupDb [set fileName tkt-58ed318f2f-1.12.db] "" "" "" NoConvertSettings
} -body {
  set connection [getDbConnection]

  sql execute $db {
    CREATE TABLE t1(x, y);
    INSERT INTO t1 (x, y) VALUES(0, 1);
    INSERT INTO t1 (x, y) VALUES('0', '1');
  }

  sql execute -execute reader -format list $db "SELECT x, y FROM t1;"
  set columns [$connection GetSchema COLUMNS]

  expr {[getSettingReadCount Use_SQLiteConvert_DefaultDbType] == -1 && \
      [getSettingReadCount Use_SQLiteConvert_DefaultTypeName] == -1}
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain columns connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite buildConfiguration.Debug} -result {True}}

###############################################################################

reportSQLiteResources $test_channel true

###############################################################################

runTest {test tkt-58ed318f2f-1.13 {zero settings usage} -setup {
  saveGetSettingValueEnvironment

  set env(No_SQLiteGetSettingValue) 1

  setupDb [set fileName tkt-58ed318f2f-1.13.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
    INSERT INTO t1 (x) VALUES(0);
  }

  sql execute -execute reader -format list $db "SELECT x FROM t1;"

  expr {[getSettingReadCount ""] eq "0 0"}
} -cleanup {
  cleanupDb $fileName
  restoreGetSettingValueEnvironment

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite buildConfiguration.Debug} -result {True}}

###############################################################################

reportSQLiteResources $test_channel true

###############################################################################

runTest {test tkt-58ed318f2f-1.14 {zero XML configuration file usage} -setup {
  saveGetSettingValueEnvironment

  set env(No_SQLiteXmlConfigFile) 1

  setupDb [set fileName tkt-58ed318f2f-1.14.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
    INSERT INTO t1 (x) VALUES(0);
  }

  sql execute -execute reader -format list $db "SELECT x FROM t1;"

  set counts [getSettingReadCount ""]

  expr {[lindex $counts 0] > 0 && [lindex $counts 1] > 0 && \
      [getSettingReadCount "" true] eq "0 0"}
} -cleanup {
  cleanupDb $fileName
  restoreGetSettingValueEnvironment

  unset -nocomplain counts db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite buildConfiguration.Debug} -result {True}}

###############################################################################

reportSQLiteResources $test_channel true

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-59edc1018b.eagle.



























































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
###############################################################################
#
# tkt-59edc1018b.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue
runSQLiteTestFilesPrologue

###############################################################################

runTest {test tkt-59edc1018b-1.1 {LINQ with EndsWith} -body {
  copySampleDatabaseFiles

  set result [list]

  foreach value [list "" a b z 1+1 don notthere] {
    set output ""

    set code [catch {
      testClrExec $testLinqExeFile [list -eventflags Wait -directory \
          [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
          -success Success] -endsWith $value
    } error]

    tlog "---- BEGIN STDOUT OUTPUT\n"
    tlog $output
    tlog "\n---- END STDOUT OUTPUT\n"

    lappend result $code

    if {$code == 0} then {
      lappend result [string trim $output]
    } else {
      lappend result [string trim $error]
    }
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result value
} -constraints \
{eagle monoToDo defineConstant.System.Data.SQLite.USE_INTEROP_DLL\
defineConstant.System.Data.SQLite.INTEROP_EXTENSION_FUNCTIONS SQLite testExec\
file_System.Data.SQLite.dll file_System.Data.SQLite.Linq.dll file_testlinq.exe\
file_northwindEF.db} -result {0 {} 0 {FURIB GALED GODOS LAZYK LINOD PRINI REGGC\
WOLZA} 0 {} 0 ERNSH 0 {} 0 {AROUT BSBEV CONSH EASTC NORTS SEVES} 0 {}}}

###############################################################################

runTest {test tkt-59edc1018b-1.2 {EF6 with EndsWith} -body {
  copySampleDatabaseFiles

  set result [list]

  foreach value [list "" a b z 1+1 don notthere] {
    set output ""

    set code [catch {
      testClrExec $testEf6ExeFile [list -eventflags Wait -directory \
          [file dirname $testEf6ExeFile] -nocarriagereturns -stdout output \
          -success Success] -endsWith $value
    } error]

    tlog "---- BEGIN STDOUT OUTPUT\n"
    tlog $output
    tlog "\n---- END STDOUT OUTPUT\n"

    lappend result $code

    if {$code == 0} then {
      lappend result [string trim $output]
    } else {
      lappend result [string trim $error]
    }
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result value
} -constraints \
{eagle monoToDo defineConstant.System.Data.SQLite.USE_INTEROP_DLL\
defineConstant.System.Data.SQLite.INTEROP_EXTENSION_FUNCTIONS SQLite testExec\
file_EntityFramework.dll file_System.Data.SQLite.dll\
file_System.Data.SQLite.EF6.dll file_testef6.exe file_northwindEF.db} -result \
{0 {} 0 {FURIB GALED GODOS LAZYK LINOD PRINI REGGC WOLZA} 0 {} 0 ERNSH 0 {} 0\
{AROUT BSBEV CONSH EASTC NORTS SEVES} 0 {}}}

###############################################################################

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-5cee5409f8.eagle.

































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
###############################################################################
#
# tkt-5cee5409f8.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

#
# NOTE: This test is disabled for .NET Core due to its lack of support for
#       distributed transactions.
#
runTest {test tkt-5cee5409f8-1.1 {asynchronous transaction handling} -setup {
  setupDb [set fileName tkt-5cee5409f8-1.1.db]
} -body {
  sql execute $db "CREATE TABLE t1(x INTEGER);"

  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using System.Threading;
    using System.Transactions;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        #region Private EnlistmentNotification Class
        private sealed class EnlistmentNotification : IEnlistmentNotification
        {
          #region Private Data
          private bool forceRollback;
          #endregion

          /////////////////////////////////////////////////////////////////////

          #region Private Constructors
          private EnlistmentNotification(bool forceRollback)
          {
            this.forceRollback = forceRollback;
          }
          #endregion

          /////////////////////////////////////////////////////////////////////

          #region IEnlistmentNotification Members
          public void Commit(Enlistment enlistment)
          {
            enlistment.Done();
          }

          /////////////////////////////////////////////////////////////////////

          public void InDoubt(Enlistment enlistment)
          {
            enlistment.Done();
          }

          /////////////////////////////////////////////////////////////////////

          public void Prepare(PreparingEnlistment preparingEnlistment)
          {
            if (forceRollback)
              preparingEnlistment.ForceRollback();
            else
              preparingEnlistment.Prepared();
          }

          /////////////////////////////////////////////////////////////////////

          public void Rollback(Enlistment enlistment)
          {
            enlistment.Done();
          }
          #endregion

          /////////////////////////////////////////////////////////////////////

          #region Public Static Methods
          public static void UseDistributedTransaction(bool forceRollback)
          {
            Transaction.Current.EnlistDurable(
                Guid.NewGuid(), new EnlistmentNotification(forceRollback),
                EnlistmentOptions.None);
          }
          #endregion
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Static Data
        private static int resetCount;
        private static int timeoutCount;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Static Methods
        private static void DoTransactions(SQLiteConnection connection)
        {
          Random random = new Random();

          for (int iteration = 0; iteration < 10000; iteration++)
          {
            using (TransactionScope transactionScope = new TransactionScope())
            {
              EnlistmentNotification.UseDistributedTransaction(false);

              TransactionInformation transactionInformation =
                  Transaction.Current.TransactionInformation;

              if (transactionInformation.DistributedIdentifier.Equals(
                  Guid.Empty))
              {
                throw new Exception("distributed identifier is empty");
              }

              connection.EnlistTransaction(Transaction.Current);

              using (SQLiteCommand command = connection.CreateCommand())
              {
                command.CommandText = "INSERT INTO t1(x) VALUES(?);";
                command.Parameters.Add(new SQLiteParameter("", iteration));
                command.ExecuteNonQuery();
              }

              transactionScope.Complete();
            }

            Thread.Sleep(random.Next(10));
          }
        }

        ///////////////////////////////////////////////////////////////////////

        private static void WaitOnEnlistments(object state)
        {
          SQLiteConnection connection = (SQLiteConnection)state;
          Random random = new Random();

          for (int iteration = 0; iteration < 1000; iteration++)
          {
            if (connection.WaitForEnlistmentReset(1, false))
              Interlocked.Increment(ref resetCount);
            else
              Interlocked.Increment(ref timeoutCount);

            Thread.Sleep(random.Next(100));
          }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Public Static Methods
        public static string DoTest()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            ThreadPool.QueueUserWorkItem(WaitOnEnlistments, connection);

            connection.Open();

            DoTransactions(connection);
          }

          int count1 = Interlocked.CompareExchange(ref resetCount, 0, 0);
          int count2 = Interlocked.CompareExchange(ref timeoutCount, 0, 0);

          return String.Format("{0} {1}", count1, count2);
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
        #endregion
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} DoTest
      } result] : [set result ""]}] \
      [expr {[lindex $result 0] > 0}] \
      [expr {[lindex $result 1] > 0}]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code dataSource id db fileName
} -constraints [fixConstraints {eagle command.object monoBug211 monoBug68\
command.sql compile.DATA SQLite System.Data.SQLite compileCSharp !dotNetCore}] \
-match regexp -result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0\
True True$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-6434e23a0f.eagle.













































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
###############################################################################
#
# tkt-6434e23a0f.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-6434e23a0f-1.1 {SQLiteDataAdapter command disposal} -setup {
  setupDb [set fileName tkt-6434e23a0f-1.1.db]
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"
  sql execute $db "INSERT INTO t1 (x) VALUES(2);"

  cleanupDb $fileName db true false false

  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    SELECT x FROM t1; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;
    using System.IO;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(
                "${sql}", connection))
            {
              dataAdapter.Fill(new DataSet());
            }
          }

          File.Delete("${dataSource}");
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-647d282d11.eagle.























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
###############################################################################
#
# tkt-647d282d11.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-647d282d11-1.1 {Open with PrepareRetries} -setup {
  setupDb [set fileName tkt-647d282d11-1.1.db] "" "" "" "" PrepareRetries=10
} -body {
  set connection [getDbConnection]

  list [object invoke $connection PrepareRetries] \
      [object invoke $connection PrepareRetries 20] \
      [object invoke $connection PrepareRetries]
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {10 {} 20}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-69cf6e5dc8.eagle.

























































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
###############################################################################
#
# tkt-69cf6e5dc8.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-69cf6e5dc8-1.1 {Julian DateTime precision} -setup {
  setupDb [set fileName tkt-69cf6e5dc8-1.1.db] "" JulianDay Utc \
      BindDateTimeWithKind [appendArgs DateTimeFormatString= \
      [getDateTimeFormat] \;]
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
  }

  set dateTime(0) [object create DateTime 2016 11 20 0 46 3 0 Utc]

  sql execute -execute scalar $db \
      "INSERT INTO t1 (x) VALUES(?);" [list param1 DateTime $dateTime(0)]

  set dataReader [sql execute -execute reader -format datareader -alias \
      $db "SELECT x FROM t1;"]

  while {[$dataReader Read]} {
    lappend result [$dataReader GetValue 0]
    set dateTime(1) [$dataReader -create -alias GetDateTime 0]
    lappend result [$dateTime(1) ToString [getDateTimeFormat]]
  }

  set result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain dateTime result db fileName
} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
compile.DATA SQLite System.Data.SQLite} -match regexp -result \
{^(?:2457712\.53197917|2457712\.5319791664) \{2016-11-20 00:46:03Z\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-6c6ecccc5f.eagle.



































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
###############################################################################
#
# tkt-6c6ecccc5f.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-6c6ecccc5f-1.1 {CloseConnection with extensions} -setup {
  setupDb [set fileName tkt-6c6ecccc5f-1.1.db]
} -body {
  sql execute $db {
    CREATE VIRTUAL TABLE t1 USING fts4(x TEXT);
    INSERT INTO t1 (x) VALUES('one');
    INSERT INTO t1 (x) VALUES('two');
  }

  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]
  set sql "SELECT x FROM t1 WHERE x MATCH 'one';"

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteCommand command = new SQLiteCommand("${sql}",
                connection))
            {
              /* IGNORED */
              command.ExecuteReader(CommandBehavior.CloseConnection);
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-71bedaca19.eagle.





















































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
###############################################################################
#
# tkt-71bedaca19.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-71bedaca19-1.1 {SQLiteErrorCode names and values} -setup {
  object import System.Data.SQLite
} -body {
  set result [list]

  foreach name [lsort [object invoke Enum GetNames SQLiteErrorCode]] {
    if {$name ni [list NonExtendedMask Unknown]} then {
      set convertible [object invoke -create -alias \
          -flags {:Static Public GetField} -returntype IConvertible \
          SQLiteErrorCode $name]

      lappend result [list $name [$convertible ToUInt64 null]]
    }
  }

  join $result \n
} -cleanup {
  object unimport -importpattern System.Data.SQLite

  unset -nocomplain result convertible name
} -constraints {eagle command.object System.Data.SQLite} -result {Abort 4
Abort_Rollback 516
Auth 23
Auth_User 279
Busy 5
Busy_Recovery 261
Busy_Snapshot 517
Busy_Timeout 773
CantOpen 14
CantOpen_ConvPath 1038
CantOpen_DirtyWal 1294
CantOpen_FullPath 782
CantOpen_IsDir 526
CantOpen_NoTempDir 270
CantOpen_SymLink 1550
Constraint 19
Constraint_Check 275
Constraint_CommitHook 531
Constraint_DataType 3091
Constraint_ForeignKey 787
Constraint_Function 1043
Constraint_NotNull 1299
Constraint_Pinned 2835
Constraint_PrimaryKey 1555
Constraint_RowId 2579
Constraint_Trigger 1811
Constraint_Unique 2067
Constraint_Vtab 2323
Corrupt 11
Corrupt_Index 779
Corrupt_Sequence 523
Corrupt_Vtab 267
Done 101
Empty 16
Error 1
Error_Missing_CollSeq 257
Error_Retry 513
Error_Snapshot 769
Format 24
Full 13
Internal 2
Interrupt 9
IoErr 10
IoErr_Access 3338
IoErr_Auth 7178
IoErr_Begin_Atomic 7434
IoErr_Blocked 2826
IoErr_CheckReservedLock 3594
IoErr_Close 4106
IoErr_Commit_Atomic 7690
IoErr_ConvPath 6666
IoErr_CorruptFs 8458
IoErr_Data 8202
IoErr_Delete 2570
IoErr_Delete_NoEnt 5898
IoErr_Dir_Close 4362
IoErr_Dir_Fsync 1290
IoErr_Fstat 1802
IoErr_Fsync 1034
IoErr_GetTempPath 6410
IoErr_Lock 3850
IoErr_Mmap 6154
IoErr_NoMem 3082
IoErr_RdLock 2314
IoErr_Read 266
IoErr_Rollback_Atomic 7946
IoErr_Seek 5642
IoErr_ShmLock 5130
IoErr_ShmMap 5386
IoErr_ShmOpen 4618
IoErr_ShmSize 4874
IoErr_Short_Read 522
IoErr_Truncate 1546
IoErr_Unlock 2058
IoErr_VNode 6922
IoErr_Write 778
Locked 6
Locked_SharedCache 262
Locked_Vtab 518
Mismatch 20
Misuse 21
NoLfs 22
NoMem 7
NotADb 26
NotFound 12
Notice 27
Notice_Rbu 795
Notice_Recover_Rollback 539
Notice_Recover_Wal 283
Ok 0
Ok_Load_Permanently 256
Ok_SymLink 512
Perm 3
Protocol 15
Range 25
ReadOnly 8
ReadOnly_CantInit 1288
ReadOnly_CantLock 520
ReadOnly_DbMoved 1032
ReadOnly_Directory 1544
ReadOnly_Recovery 264
ReadOnly_Rollback 776
Row 100
Schema 17
TooBig 18
Warning 28
Warning_AutoIndex 284}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-72905c9a77.eagle.























































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
###############################################################################
#
# tkt-72905c9a77.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

#
# NOTE: Make sure that SQLite core library is completely shutdown prior to
#       starting any of the tests in this file.
#
shutdownSQLite $test_channel

###############################################################################

#
# NOTE: This value is needed as part of the test result; therefore, it must be
#       set outside of the test setup.
#
if {[haveSQLiteObjectCommand]} then {
  set id [object invoke Interpreter.GetActive NextId]
} else {
  set id [clock seconds]
}

###############################################################################

#
# NOTE: *WARNING* This test has been extremely carefully designed; however, it
#       is still quite sensitive to machine timing, resource availability, etc.
#       This test MAY pass even if the bug under test has not been fixed (or
#       has been regressed somehow).  However, due to the unpredictable nature
#       of race conditions, it really is the best that can be done.  This test
#       will only work as intended if the version of System.Data.SQLite being
#       tested is 1.0.77.0 or higher.
#
runTest {test tkt-72905c9a77-1.1 {StaticIsInitialized race condition} -setup {
  set fileName tkt-72905c9a77-1.1.db
} -body {
  set dataSource [file join [getDatabaseDirectory] $fileName]

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using System.Diagnostics;
    using System.IO;
    using System.Reflection;
    using System.Text;
    using System.Threading;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static string GetTraceOutput()
        {
          //
          // NOTE: Create a memory stream to capture all the trace output for
          //       this test.
          //
          MemoryStream memoryStream = new MemoryStream();

          //
          // NOTE: Create the trace listener using the memory stream we just
          //       created.
          //
          using (TraceListener listener = new TextWriterTraceListener(
              memoryStream))
          {
            //
            // NOTE: Add the trace listener to the collection of active trace
            //       listeners (for this application domain).
            //
            Trace.Listeners.Add(listener);

            //
            // NOTE: Attempt to lookup the type for the private SQLite3 class
            //       in the System.Data.SQLite assembly.  We need the type in
            //       order to lookup the primary method used for this test (via
            //       reflection).  This is only necessary because the method
            //       under test is private and cannot normally be executed from
            //       C# directly.  If this fails, the following statement will
            //       throw a NullReferenceException, which is fine as that will
            //       cause the whole test to fail.
            //
            Type type = Type.GetType(
                "System.Data.SQLite.SQLite3, System.Data.SQLite");

            //
            // NOTE: Attempt to lookup the method object for the private method
            //       we need for this test.  If this fails, the first attempt
            //       to invoke the method using this variable will throw a
            //       NullReferenceException, which is fine as that will cause
            //       the whole test to fail.
            //
            MethodInfo methodInfo = type.GetMethod("StaticIsInitialized",
                BindingFlags.Static | BindingFlags.NonPublic);

            //
            // NOTE: Create the event that will be used to synchronize all the
            //       created threads so that they start doing their actual test
            //       "work" at approximately the same time.
            //
            using (ManualResetEvent goEvent = new ManualResetEvent(false))
            {
              //
              // NOTE: Create 4 threads for each processor on the machine.
              //       Under normal circumstances, this should give us a good
              //       chance of triggering the race condition being tested.
              //       However, since this test was originally designed on a
              //       machine with 4 processors, limit the total number of
              //       threads to 16.
              //
              int count = Math.Min(4 * Environment.ProcessorCount, 16);

              //
              // NOTE: Create a (reusable) delegate that will contain the code
              //       that each created thread is to execute.
              //
              ThreadStart threadStart = delegate()
              {
                try
                {
                  //
                  // NOTE: Wait forever for the "GO" signal so that all threads
                  //       can start working at approximately the same time.
                  //
                  goEvent.WaitOne();

                  //
                  // NOTE: Create a pseudorandom number generator suitable for
                  //       waiting a random number of milliseconds between each
                  //       attempt to cause the race condition being tested on
                  //       a given thread.
                  //
                  Random random = new Random();

                  //
                  // NOTE: Force the SQLiteLog.StaticIsInitialized method to
                  //       be repeatedly called on every thread right away to
                  //       thoroughly test its locking semantics.  Also, use a
                  //       random delay, in milliseconds, between zero and the
                  //       number of test threads squared after each attempt.
                  //
                  for (int index = 0; index < (count * count); index++)
                  {
                    methodInfo.Invoke(null, null);
                    Thread.Sleep(random.Next(0, (count * count)));
                  }

                  //
                  // NOTE: Create and open a connection and use it to log a
                  //       test message just to make sure that the logging
                  //       system is initialized and in working order.
                  //
                  using (SQLiteConnection connection = new SQLiteConnection(
                      "Data Source=${dataSource};[getTestProperties]"))
                  {
                    connection.Open();
                    connection.LogMessage(0, "TEST ${id}");
                  }
                }
                catch (Exception e)
                {
                  //
                  // NOTE: We caught an exception.  Since this will impact the
                  //       captured trace output, this will cause the test to
                  //       fail (just as it should).
                  //
                  Trace.WriteLine(String.Format("CAUGHT: {0}", e));
                }
              };

              //
              // NOTE: Create the array of thread objects.
              //
              Thread\[\] thread = new Thread\[count\];

              //
              // NOTE: Create each of the test threads with a suitable stack
              //       size.  We must specify a stack size here because the
              //       default one for the process would be the same as the
              //       parent executable (the Eagle shell), which is 16MB,
              //       too large to be useful.
              //
              for (int index = 0; index < count; index++)
              {
                thread\[index\] = new Thread(threadStart, 1048576);

                //
                // NOTE: Name each thread for a better debugging experience.
                //
                thread\[index\].Name = String.Format(
                    "[file rootname ${fileName}] #{0}", index);
              }

              //
              // NOTE: Force logging to be initialized now; otherwise, there is
              //       no way for the native SQLite library to impact the trace
              //       listener we are monitoring for output.
              //
              SQLiteLog.Initialize();

              //
              // NOTE: Start all the threads now.  They should not actually do
              //       any of the test "work" until we signal the event.
              //
              for (int index = 0; index < count; index++)
                thread\[index\].Start();

              //
              // NOTE: Send the signal that all threads should start doing
              //       their test "work" now.
              //
              goEvent.Set(); /* GO */

              //
              // NOTE: Wait forever for each thread to finish its test "work"
              //       and then die.
              //
              for (int index = 0; index < count; index++)
                thread\[index\].Join();
            }

            //
            // NOTE: *REQUIRED* Force all the trace listeners to be flushed to
            //       disk now so that we do not lose any output.  Without this
            //       method call, loss of trace output was observed.
            //
            Trace.Flush();

            //
            // NOTE: The trace listener used by this test can be removed now
            //       as all the trace output should have been flushed to the
            //       memory stream now.
            //
            Trace.Listeners.Remove(listener);

            //
            // NOTE: Return a string containing all the trace output we saw
            //       (from all threads) during the above test code.
            //
            return Encoding.UTF8.GetString(memoryStream.ToArray());
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetTraceOutput
      } result] : [set result ""]}] [string map [list \r\n \n] $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors dataSource fileName
} -constraints \
[fixConstraints {fail.false eagle command.object monoBug28\
buildConfiguration.Release !defineConstant.System.Data.SQLite.INTEROP_LOG\
command.sql compile.DATA SQLite System.Data.SQLite compileCSharp}] -match \
regexp -result [appendArgs \
"^Ok System#CodeDom#Compiler#CompilerResults#\\d+ \\{\\} 0 \\{" \
[string repeat "SQLite message \\(0\\): TEST $id\\n" \
[expr {min(4 * [info processors], 16)}]] "\\}\$"]}

###############################################################################

unset -nocomplain id

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-74542e702e.eagle.













































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
###############################################################################
#
# tkt-74542e702e.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-74542e702e-1.1 {RecordsAffected return values} -setup {
  setupDb [set fileName tkt-74542e702e-1.1.db]
} -body {
  lappend result [sql execute $db "CREATE TABLE t1(x);"]

  lappend result [sql execute $db {
    INSERT INTO t1 VALUES(1);
    INSERT INTO t1 VALUES(2);
    INSERT INTO t1 VALUES(3);
    INSERT INTO t1 VALUES(4);
  }]

  lappend result [sql execute $db "UPDATE t1 SET x = x + 99;"]
  lappend result [sql execute $db "SELECT x FROM t1;"]
  lappend result [sql execute $db "DELETE FROM t1;"]
  lappend result [sql execute $db "SELECT x FROM t1;"]
  lappend result [sql execute $db "DELETE FROM t1;"]
  lappend result [sql execute $db "DROP TABLE t1;"]

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{0 4 4 -1 4 -1 0 0}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-7714b60d61.eagle.





































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
###############################################################################
#
# tkt-7714b60d61.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-7714b60d61-1.1 {SQLite3.GetValue with BOOLEAN} -setup {
  setupDb [set fileName tkt-7714b60d61-1.1.db]
} -body {
  set connection [getDbConnection]

  sql execute $db {
    CREATE TABLE t1 (x INTEGER PRIMARY KEY, y BOOLEAN);
    INSERT INTO t1 (x, y) VALUES(1, NULL);
    INSERT INTO t1 (x, y) VALUES(2, 0);
    INSERT INTO t1 (x, y) VALUES(3, 1);
    INSERT INTO t1 (x, y) VALUES(4, 0.0);
    INSERT INTO t1 (x, y) VALUES(5, 1.0);
    INSERT INTO t1 (x, y) VALUES(6, '0');
    INSERT INTO t1 (x, y) VALUES(7, '1');
    INSERT INTO t1 (x, y) VALUES(8, 'False');
    INSERT INTO t1 (x, y) VALUES(9, 'True');
  }

  set command [$connection -alias CreateCommand]
  $command CommandText {SELECT x, y FROM t1 ORDER BY x;}

  set dataAdapter [object create -alias \
      System.Data.SQLite.SQLiteDataAdapter $command]

  set dataTable [object create -alias System.Data.DataTable]

  $dataAdapter Fill $dataTable; getRowsFromDataTable $dataTable
} -cleanup {
  unset -nocomplain dataTable dataAdapter command

  freeDbConnection

  cleanupDb $fileName

  unset -nocomplain connection db fileName
} -constraints {eagle command.object monoBug28 monoBug211 command.sql\
compile.DATA SQLite System.Data.SQLite} -result {{{x 1} y} {{x 2} {y False}}\
{{x 3} {y True}} {{x 4} {y False}} {{x 5} {y True}} {{x 6} {y False}} {{x 7}\
{y True}} {{x 8} {y False}} {{x 9} {y True}}}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-7c151a2f0e.eagle.

















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
###############################################################################
#
# tkt-7c151a2f0e.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

set character \UDDFDD83D; # NOTE: This is little-endian.

###############################################################################

runTest {test tkt-7c151a2f0e-1.1 {Open with UseUTF16Encoding=False} -setup {
  set fileName tkt-7c151a2f0e-1.1.db
  setupDb $fileName "" "" "" "" UseUTF16Encoding=False
} -body {
  sql execute $db "CREATE TABLE t1(x TEXT);"

  sql execute $db [appendArgs "INSERT INTO t1 (x) VALUES(?);"] \
      [list param1 String $character]

  list [sql execute -execute scalar $db "PRAGMA encoding;"] \
      [sql execute -execute scalar $db "SELECT x FROM t1;"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result [appendArgs "UTF-8 " $character]}

###############################################################################

runTest {test tkt-7c151a2f0e-1.2 {Open with UseUTF16Encoding=True} -setup {
  set fileName tkt-7c151a2f0e-1.2.db
  setupDb $fileName "" "" "" "" UseUTF16Encoding=True
} -body {
  sql execute $db "CREATE TABLE t1(x TEXT);"

  sql execute $db [appendArgs "INSERT INTO t1 (x) VALUES(?);"] \
      [list param1 String $character]

  list [sql execute -execute scalar $db "PRAGMA encoding;"] \
      [sql execute -execute scalar $db "SELECT x FROM t1;"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result [appendArgs "UTF-16le " $character]}

###############################################################################

unset -nocomplain character

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-7e3fa93744.eagle.





















































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
###############################################################################
#
# tkt-7e3fa93744.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-7e3fa93744-1.1 {composite primary key, baseline} -setup {
  setupDb [set fileName tkt-7e3fa93744-1.1.db]
} -body {
  set sql {
    CREATE TABLE t1 (
      id1 INTEGER PRIMARY KEY
    );

    CREATE TABLE t2 (
      id1 INTEGER NOT NULL,
      id2 INTEGER NOT NULL,
      PRIMARY KEY (id1, id2)
    );

    INSERT INTO t1 (id1) VALUES (1);
    INSERT INTO t1 (id1) VALUES (2);

    INSERT INTO t2 (id1, id2) VALUES (1, 1);
    INSERT INTO t2 (id1, id2) VALUES (1, 2);
    INSERT INTO t2 (id1, id2) VALUES (2, 1);
    INSERT INTO t2 (id1, id2) VALUES (2, 2);

    SELECT t1.id1, t2.id1, t2.id2
    FROM t1, t2
    ORDER BY t1.id1, t2.id1, t2.id2;
  }

  sql execute -execute reader -format list $db $sql
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain sql db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{1 1 1 1 1 2 1 2 1 1 2 2 2 1 1 2 1 2 2 2 1 2 2 2}}

###############################################################################

runTest {test tkt-7e3fa93744-1.2 {composite primary key, DataTable} -setup {
  setupDb [set fileName tkt-7e3fa93744-1.2.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    CREATE TABLE t1 ( \
      id1 INTEGER PRIMARY KEY NOT NULL \
    ); \
    CREATE TABLE t2 ( \
      id1 INTEGER NOT NULL, \
      id2 INTEGER NOT NULL, \
      PRIMARY KEY (id1, id2) \
    ); \
    INSERT INTO t1 (id1) VALUES (1); \
    INSERT INTO t1 (id1) VALUES (2); \
    INSERT INTO t2 (id1, id2) VALUES (1, 1); \
    INSERT INTO t2 (id1, id2) VALUES (1, 2); \
    INSERT INTO t2 (id1, id2) VALUES (2, 1); \
    INSERT INTO t2 (id1, id2) VALUES (2, 2); \
    SELECT t1.id1, t2.id1, t2.id2 \
    FROM t1, t2 \
    ORDER BY t1.id1, t2.id1, t2.id2; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static int Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "${sql}";

              using (SQLiteDataReader dataReader = command.ExecuteReader())
              {
                DataTable dataTable = new DataTable();
                dataTable.Load(dataReader);

                return dataTable.Rows.Count;
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 8$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-84718e79fa.eagle.

































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
###############################################################################
#
# tkt-84718e79fa.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

set c 10

###############################################################################

runTest {test tkt-84718e79fa-1.1 {SQLiteConvert thread safety} -setup {
  proc threadStart { args } {
    lappend ::results [sql execute -execute reader -format list $::db \
        "SELECT x FROM t1;"]
  }

  setupDb [set fileName tkt-84718e79fa-1.1.db]
} -body {
  sql execute $db "CREATE TABLE t1(x INTEGER PRIMARY KEY ASC);"
  sql execute $db "INSERT INTO t1 (x) VALUES(1);"

  for {set i 0} {$i < $c} {incr i} {
    set t($i) [createThread threadStart false 1048576]
  }

  set results [list]

  for {set i 0} {$i < $c} {incr i} {
    startThread $t($i)
  }

  after 4000; # wait for other threads to do something...

  for {set i 0} {$i < $c} {incr i} {
    $t($i) Join
  }

  set results
} -cleanup {
  cleanupDb $fileName

  for {set i 0} {$i < $c} {incr i} {
    if {[info exists t($i)] && [cleanupThread $t($i)]} then {
      unset t($i)
    }
  }

  catch {object removecallback threadStart}

  unset -nocomplain results t i c db fileName

  rename threadStart ""
} -constraints {eagle command.object dotNetCoreOrShell monoBug28\
command.sql compile.DATA compile.THREADING SQLite System.Data.SQLite} -result \
[lrepeat $c 1]}

###############################################################################

unset -nocomplain c

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-8554170e09.eagle.

























































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
###############################################################################
#
# tkt-8554170e09.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-8554170e09-1.1 {default DATETIME value, NULL} -setup {
  setupDb [set fileName tkt-8554170e09-1.1.db]
} -body {
  sql execute $db "CREATE TABLE t1(x INTEGER, y DATETIME);"
  sql execute $db "INSERT INTO t1 (x, y) VALUES(1, NULL);"

  set result [sql execute -execute reader -format list $db \
      "SELECT x, y FROM t1 ORDER BY x;"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
-result {1}}

###############################################################################

runTest {test tkt-8554170e09-1.2 {default DATETIME value, empty} -setup {
  setupDb [set fileName tkt-8554170e09-1.2.db]
} -body {
  sql execute $db "CREATE TABLE t1(x INTEGER, y DATETIME);"
  sql execute $db "INSERT INTO t1 (x, y) VALUES(1, '');"

  set result [sql execute -execute reader -format list $db \
      "SELECT x, y FROM t1 ORDER BY x;"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
-returnCodes 1 -match glob -result {*.SQLiteConvert.ToDateTime*}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-85b824b736.eagle.













































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
###############################################################################
#
# tkt-85b824b736.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-85b824b736-1.1 {SQLiteValue.GetString return value} -setup {
  set fileName tkt-85b824b736-1.1.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql(1) { \
    CREATE VIRTUAL TABLE u${id} USING mod${id}; \
  }

  set sql(2) { \
    UPDATE u${id} SET x = x || '-string' WHERE x IN ('one', 'two'); \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Collections;
    using System.Data.SQLite;
    using Eagle._Containers.Public;

    namespace _Dynamic${id}
    {
      public sealed class SQLiteModuleTest${id} : SQLiteModuleEnumerable
      {
        public string Result = String.Empty;

        ///////////////////////////////////////////////////////////////////////

        public SQLiteModuleTest${id}(
          string name,
          IEnumerable enumerable
          )
          : base(name, enumerable)
        {
          // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////

        public override SQLiteErrorCode Update(
          SQLiteVirtualTable table,
          SQLiteValue\[\] values,
          ref long rowId
          )
        {
          if ((values != null) && (values.Length > 0))
            Result += " " + values\[values.Length - 1\].GetString();

          return SQLiteErrorCode.Ok;
        }
      }

      /////////////////////////////////////////////////////////////////////////

      public static class Test${id}
      {
        public static StringList GetList(params string\[\] strings)
        {
          StringList result = new StringList();

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            SQLiteModuleTest${id} module = new SQLiteModuleTest${id}(
                "mod${id}", strings);

            connection.CreateModule(module);

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(1)}]";
              result.Add(command.ExecuteNonQuery().ToString());
            }

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(2)}]";
              result.Add(command.ExecuteNonQuery().ToString());
            }

            result.Add(module.Result.Trim());
            connection.Close();
          }

          return result;
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll Eagle.dll]]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetList one two three 4 5.0
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id fileName
} -constraints {eagle command.object monoBug28 monoCrash211 command.sql\
compile.DATA SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE compileCSharp} -match \
regexp -result [string map [list \n \r\n] {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{0 2 \{one-string\
two-string\}\}$}]}

###############################################################################

runTest {test tkt-85b824b736-1.2 {SQLiteValue.GetBlob return value} -setup {
  set fileName tkt-85b824b736-1.2.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql(1) { \
    CREATE VIRTUAL TABLE u${id} USING mod${id}; \
  }

  set sql(2) { \
    UPDATE u${id} SET x = x || '-blob' WHERE x IN ('one', 'two'); \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Collections;
    using System.Data.SQLite;
    using Eagle._Containers.Public;

    namespace _Dynamic${id}
    {
      public sealed class SQLiteModuleTest${id} : SQLiteModuleEnumerable
      {
        public ByteList Result = new ByteList();

        ///////////////////////////////////////////////////////////////////////

        public SQLiteModuleTest${id}(
          string name,
          IEnumerable enumerable
          )
          : base(name, enumerable)
        {
          // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////

        public override SQLiteErrorCode Update(
          SQLiteVirtualTable table,
          SQLiteValue\[\] values,
          ref long rowId
          )
        {
          if ((values != null) && (values.Length > 0))
            Result.AddRange(values\[values.Length - 1\].GetBlob());

          return SQLiteErrorCode.Ok;
        }
      }

      /////////////////////////////////////////////////////////////////////////

      public static class Test${id}
      {
        public static ByteList GetList(params string\[\] strings)
        {
          ByteList result = new ByteList();

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            SQLiteModuleTest${id} module = new SQLiteModuleTest${id}(
                "mod${id}", strings);

            connection.CreateModule(module);

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(1)}]";
              result.Add((byte)command.ExecuteNonQuery());
            }

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(2)}]";
              result.Add((byte)command.ExecuteNonQuery());
            }

            result.AddRange(module.Result);
            connection.Close();
          }

          return result;
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll Eagle.dll]]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetList one two three 4 5.0
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id fileName
} -constraints {eagle command.object monoBug28 monoCrash211 command.sql\
compile.DATA SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE compileCSharp} -match \
regexp -result [string map [list \n \r\n] {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{0 2 111 110 101 45 98 108\
111 98 116 119 111 45 98 108 111 98\}$}]}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-8b7d179c3c.eagle.





































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
###############################################################################
#
# tkt-8b7d179c3c.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue
runSQLiteTestFilesPrologue

###############################################################################

runTest {test tkt-8b7d179c3c-1.1 {LINQ with Skip and Take} -body {
  copySampleDatabaseFiles

  set result [list]

  for {set pageSize 0} {$pageSize <= 2} {incr pageSize} {
    set output ""

    set code [catch {
      testClrExec $testLinqExeFile [list -eventflags Wait -directory \
          [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
          -success Success] -skip $pageSize
    } error]

    tlog "---- BEGIN STDOUT OUTPUT\n"
    tlog $output
    tlog "\n---- END STDOUT OUTPUT\n"

    lappend result $code

    if {$code == 0} then {
      lappend result [string trim $output]
    } else {
      lappend result [string trim $error]
    }
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result pageSize
} -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll testExec\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db} \
-result {0 {} 0 {DRACD RATTC OLDWO GALED LILAS MAGAA ALFKI CHOPS SAVEA KOENE\
MAISD FOLKO CACTU OCEAN RANCH THECR GOURL GROSR SUPRD HUNGO ISLAT QUICK HUNGC\
GREAL LEHMS RICSU ERNSH WILMK LINOD TRAIH SIMOB OTTIK SPLIR MORGK FOLIG FURIB\
PRINI AROUT BSBEV CONSH EASTC NORTS SEVES BERGS VICTE BOLID FISSA ROMEY BLAUS\
BONAP MEREP ANATR ANTON CENTC PERIC TORTU FRANK TOMSP DUMON FRANR WARTH PARIS\
SPECD LONEP THEBI REGGC VINET WELLI HANAR QUEDE RICAR PICCO HILAA LETSS COMMI\
FAMIA QUEEN TRADH WHITC GODOS SANTG BLONP WANDK FRANS LAMAI BOTTM LAUGB LACOR\
LAZYK WOLZA VAFFE} 0 {DRACD RATTC OLDWO GALED LILAS MAGAA ALFKI CHOPS SAVEA\
KOENE MAISD FOLKO CACTU OCEAN RANCH THECR GOURL GROSR SUPRD HUNGO ISLAT QUICK\
HUNGC GREAL LEHMS RICSU ERNSH WILMK LINOD TRAIH SIMOB OTTIK SPLIR MORGK FOLIG\
FURIB PRINI AROUT BSBEV CONSH EASTC NORTS SEVES BERGS VICTE BOLID FISSA ROMEY\
BLAUS BONAP MEREP ANATR ANTON CENTC PERIC TORTU FRANK TOMSP DUMON FRANR WARTH\
PARIS SPECD LONEP THEBI REGGC VINET WELLI HANAR QUEDE RICAR PICCO HILAA LETSS\
COMMI FAMIA QUEEN TRADH WHITC GODOS SANTG BLONP WANDK FRANS LAMAI BOTTM LAUGB\
LACOR LAZYK WOLZA VAFFE}}}

###############################################################################

runTest {test tkt-8b7d179c3c-1.2 {EF6 with Skip and Take} -body {
  copySampleDatabaseFiles

  set result [list]

  for {set pageSize 0} {$pageSize <= 2} {incr pageSize} {
    set output ""

    set code [catch {
      testClrExec $testEf6ExeFile [list -eventflags Wait -directory \
          [file dirname $testEf6ExeFile] -nocarriagereturns -stdout output \
          -success Success] -skip $pageSize
    } error]

    tlog "---- BEGIN STDOUT OUTPUT\n"
    tlog $output
    tlog "\n---- END STDOUT OUTPUT\n"

    lappend result $code

    if {$code == 0} then {
      lappend result [string trim $output]
    } else {
      lappend result [string trim $error]
    }
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result pageSize
} -constraints {eagle monoToDo SQLite file_EntityFramework.dll\
file_System.Data.SQLite.dll testExec file_System.Data.SQLite.EF6.dll\
file_testef6.exe file_northwindEF.db} -result {0 {} 0 {DRACD RATTC OLDWO GALED\
LILAS MAGAA ALFKI CHOPS SAVEA KOENE MAISD FOLKO CACTU OCEAN RANCH THECR GOURL\
GROSR SUPRD HUNGO ISLAT QUICK HUNGC GREAL LEHMS RICSU ERNSH WILMK LINOD TRAIH\
SIMOB OTTIK SPLIR MORGK FOLIG FURIB PRINI AROUT BSBEV CONSH EASTC NORTS SEVES\
BERGS VICTE BOLID FISSA ROMEY BLAUS BONAP MEREP ANATR ANTON CENTC PERIC TORTU\
FRANK TOMSP DUMON FRANR WARTH PARIS SPECD LONEP THEBI REGGC VINET WELLI HANAR\
QUEDE RICAR PICCO HILAA LETSS COMMI FAMIA QUEEN TRADH WHITC GODOS SANTG BLONP\
WANDK FRANS LAMAI BOTTM LAUGB LACOR LAZYK WOLZA VAFFE} 0 {DRACD RATTC OLDWO\
GALED LILAS MAGAA ALFKI CHOPS SAVEA KOENE MAISD FOLKO CACTU OCEAN RANCH THECR\
GOURL GROSR SUPRD HUNGO ISLAT QUICK HUNGC GREAL LEHMS RICSU ERNSH WILMK LINOD\
TRAIH SIMOB OTTIK SPLIR MORGK FOLIG FURIB PRINI AROUT BSBEV CONSH EASTC NORTS\
SEVES BERGS VICTE BOLID FISSA ROMEY BLAUS BONAP MEREP ANATR ANTON CENTC PERIC\
TORTU FRANK TOMSP DUMON FRANR WARTH PARIS SPECD LONEP THEBI REGGC VINET WELLI\
HANAR QUEDE RICAR PICCO HILAA LETSS COMMI FAMIA QUEEN TRADH WHITC GODOS SANTG\
BLONP WANDK FRANS LAMAI BOTTM LAUGB LACOR LAZYK WOLZA VAFFE}}}

###############################################################################

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-8c3bee31c8.eagle.























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
###############################################################################
#
# tkt-8c3bee31c8.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-8c3bee31c8-1.1 {built connection string quoting} -setup {
  unset -nocomplain dataSource o result
} -body {
  set o [object create -alias System.Data.SQLite.SQLiteConnectionStringBuilder]

  foreach dataSource [list \
        "C:\\test_path\\test.db" \
        "/test_path/test.db" \
        "C:\\test path\\test.db" \
        "/test path/test.db" \
        "C:\\test'path\\test.db" \
        "/test'path/test.db"] {
    $o DataSource $dataSource
    lappend result [list $dataSource [$o ToString]]
  }

  set result
} -cleanup {
  unset -nocomplain dataSource o result
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{{C:\test_path\test.db}\
{data source=C:\test_path\test.db}} {/test_path/test.db\
{data source=/test_path/test.db}} {{C:\test path\test.db} {data source="C:\test\
path\test.db"}} {{/test path/test.db} {data source="/test path/test.db"}}\
{{C:\test'path\test.db} {data source="C:\test'path\test.db"}}\
{/test'path/test.db {data source="/test'path/test.db"}}}}

###############################################################################

runTest {test tkt-8c3bee31c8-1.2 {open single quoted file name} -setup {
  unset -nocomplain fileName o
} -body {
  set fileName [appendArgs ' [file join [getDatabaseDirectory] \
      tkt-8c3bee31c8-1.2.db] ']

  set o [object create -alias System.Data.SQLite.SQLiteConnection]
  $o ConnectionString [appendArgs "Data Source=" $fileName \;]
  $o Open; # NOTE: This command may throw an exception, failing the test.
  $o Close
} -cleanup {
  cleanupFile [string trim $fileName ']

  unset -nocomplain fileName o
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {}}

###############################################################################

runTest {test tkt-8c3bee31c8-1.3 {open double quoted file name} -setup {
  unset -nocomplain fileName o
} -body {
  set fileName [appendArgs \" [file join [getDatabaseDirectory] \
      tkt-8c3bee31c8-1.3.db] \"]

  set o [object create -alias System.Data.SQLite.SQLiteConnection]
  $o ConnectionString [appendArgs "Data Source=" $fileName \;]
  $o Open; # NOTE: This command may throw an exception, failing the test.
  $o Close
} -cleanup {
  cleanupFile [string trim $fileName \"]

  unset -nocomplain fileName o
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-8d928c3e88.eagle.





























































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
###############################################################################
#
# tkt-8d928c3e88.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue
runSQLiteTestFilesPrologue

###############################################################################

runTest {test tkt-8d928c3e88-1.1 {LINQ w/BinaryGUID=false} -body {
  copySampleDatabaseFiles

  set result [list]
  set output ""

  set code [catch {
    testClrExec $testLinqExeFile [list -eventflags Wait -directory \
        [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
        -success Success] -binaryguid false
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  lappend result $code

  if {$code == 0} then {
    lappend result [string trim $output]
  } else {
    lappend result [string trim $error]
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result
} -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll testExec\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db} \
-result {0 2d3d2d3d-2d3d-2d3d-2d3d-2d3d2d3d2d3d}}

###############################################################################

runTest {test tkt-8d928c3e88-1.2 {LINQ w/BinaryGUID=true} -body {
  copySampleDatabaseFiles

  set result [list]
  set output ""

  set code [catch {
    testClrExec $testLinqExeFile [list -eventflags Wait -directory \
        [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
        -success Success] -binaryguid true
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  lappend result $code

  if {$code == 0} then {
    lappend result [string trim $output]
  } else {
    lappend result [string trim $error]
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result
} -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll testExec\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db} \
-result {0 =-=-=-=--=-=-=-=}}

###############################################################################

runTest {test tkt-8d928c3e88-2.1 {LINQ w/DateTimeFormat=Ticks} -body {
  copySampleDatabaseFiles

  set result [list]
  set output ""

  set code [catch {
    testClrExec $testLinqExeFile [list -eventflags Wait -directory \
        [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
        -success Success] -datetime2 Ticks
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  lappend result $code

  if {$code == 0} then {
    lappend result [string trim $output]
  } else {
    lappend result [string trim $error]
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result
} -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll testExec\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db} \
-match regexp -result \
{\sWHERE \[Extent1\]\.\[OrderDate\] < 629876736000000000\s}}

###############################################################################

runTest {test tkt-8d928c3e88-2.2 {LINQ w/DateTimeFormat=JulianDay} -body {
  copySampleDatabaseFiles

  set result [list]
  set output ""

  set code [catch {
    testClrExec $testLinqExeFile [list -eventflags Wait -directory \
        [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
        -success Success] -datetime2 JulianDay
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  lappend result $code

  if {$code == 0} then {
    lappend result [string trim $output]
  } else {
    lappend result [string trim $error]
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result
} -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll testExec\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db} \
-match regexp -result {\sWHERE \[Extent1\]\.\[OrderDate\] < 2450449\.5\s}}

###############################################################################

runTest {test tkt-8d928c3e88-2.3 {LINQ w/DateTimeFormat=UnixEpoch} -body {
  copySampleDatabaseFiles

  set result [list]
  set output ""

  set code [catch {
    testClrExec $testLinqExeFile [list -eventflags Wait -directory \
        [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
        -success Success] -datetime2 UnixEpoch
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  lappend result $code

  if {$code == 0} then {
    lappend result [string trim $output]
  } else {
    lappend result [string trim $error]
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result
} -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll testExec\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db} \
-match regexp -result {\sWHERE \[Extent1\]\.\[OrderDate\] < 852076800\s}}

###############################################################################

runTest {test tkt-8d928c3e88-2.4 {LINQ w/DateTimeFormat=ISO8601} -body {
  copySampleDatabaseFiles

  set result [list]
  set output ""

  set code [catch {
    testClrExec $testLinqExeFile [list -eventflags Wait -directory \
        [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
        -success Success] -datetime2 ISO8601
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  lappend result $code

  if {$code == 0} then {
    lappend result [string trim $output]
  } else {
    lappend result [string trim $error]
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result
} -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll testExec\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db} \
-match regexp -result \
{\sWHERE \[Extent1\]\.\[OrderDate\] < '1997-01-01 00:00:00'\s}}

###############################################################################

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-92dbf1229a.eagle.























































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
###############################################################################
#
# tkt-92dbf1229a.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-92dbf1229a-1.1 {GetSchemaTable w/non-table columns} -setup {
  setupDb [set fileName tkt-92dbf1229a-1.1.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y INTEGER, z TEXT, PRIMARY KEY(x, y));
  }

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db "SELECT x, y, NULL AS w, z FROM t1;"]

  set dataTable [$dataReader -alias GetSchemaTable]
  set result [list]

  foreach row [getRowsFromDataTable $dataTable] {
    foreach column $row {
      if {[lindex $column 0] in [list ColumnName IsKey]} then {
        lappend result $column
      }
    }
  }

  set result
} -cleanup {
  unset -nocomplain dataTable dataReader

  cleanupDb $fileName

  unset -nocomplain column row result db fileName
} -constraints {eagle command.object monoBug28 monoBug211 command.sql\
compile.DATA SQLite System.Data.SQLite} -result {{ColumnName x} {IsKey True}\
{ColumnName y} {IsKey True} {ColumnName w} {IsKey False} {ColumnName z} {IsKey\
False}}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-94252b9059.eagle.







































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
###############################################################################
#
# tkt-94252b9059.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-94252b9059-1.1 {GetDataTypeName with no current row} -setup {
  setupDb [set fileName tkt-94252b9059-1.1.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x SOMETYPE, y INTEGER, z);
  }

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db "SELECT x, y, z FROM t1;"]

  list [$dataReader GetDataTypeName 0] \
      [$dataReader GetDataTypeName 1] \
      [$dataReader GetDataTypeName 2] \
      [$dataReader -tostring GetFieldType 0] \
      [$dataReader -tostring GetFieldType 1] \
      [$dataReader -tostring GetFieldType 2]
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result \
{SOMETYPE INTEGER {} System.Object System.Int64 System.Object}}

###############################################################################

runTest {test tkt-94252b9059-1.2 {GetDataTypeName with current row} -setup {
  setupDb [set fileName tkt-94252b9059-1.2.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x SOMETYPE, y INTEGER, z);
    INSERT INTO t1 (x, y, z) VALUES(RANDOMBLOB(1), 1, 'z');
  }

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db "SELECT x, y, z FROM t1;"]

  $dataReader Read

  list [$dataReader GetDataTypeName 0] \
      [$dataReader GetDataTypeName 1] \
      [$dataReader GetDataTypeName 2] \
      [$dataReader -tostring GetFieldType 0] \
      [$dataReader -tostring GetFieldType 1] \
      [$dataReader -tostring GetFieldType 2]
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result \
{SOMETYPE INTEGER {} {System.Byte[]} System.Int64 System.String}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-964063da16.eagle.



















































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
###############################################################################
#
# tkt-964063da16.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-964063da16-1.1 {pre-existing connection flags} -body {
  set connection [object create -alias \
      System.Data.SQLite.SQLiteConnection \
      "Data Source=:memory:;NoDefaultFlags=False;"]

  $connection Open
  $connection Flags
} -cleanup {
  unset -nocomplain connection
} -constraints {eagle command.object SQLite System.Data.SQLite} -match regexp \
-result {^Default|LogCallbackException$}}

###############################################################################

runTest {test tkt-964063da16-1.2 {pre-existing connection flags} -body {
  set connection [object create -alias \
      System.Data.SQLite.SQLiteConnection \
      "Data Source=:memory:;NoDefaultFlags=True;"]

  $connection Open
  $connection Flags
} -cleanup {
  unset -nocomplain connection
} -constraints {eagle command.object SQLite System.Data.SQLite} -result \
{None}}

###############################################################################

runTest {test tkt-964063da16-1.3 {pre-existing connection flags} -body {
  set connection [object create -alias \
      System.Data.SQLite.SQLiteConnection \
      "Data Source=:memory:;NoDefaultFlags=False;"]

  $connection Flags NoExtensionFunctions; $connection Open
  $connection Flags
} -cleanup {
  unset -nocomplain connection
} -constraints {eagle command.object SQLite System.Data.SQLite} -match regexp \
-result {^Default, NoExtensionFunctions|NoExtensionFunctions,\
Default|LogCallbackException, NoExtensionFunctions$}}

###############################################################################

runTest {test tkt-964063da16-1.4 {pre-existing connection flags} -body {
  set connection [object create -alias \
      System.Data.SQLite.SQLiteConnection \
      "Data Source=:memory:;NoDefaultFlags=True;"]

  $connection Flags NoExtensionFunctions; $connection Open
  $connection Flags
} -cleanup {
  unset -nocomplain connection
} -constraints {eagle command.object SQLite System.Data.SQLite} -result \
{NoExtensionFunctions}}

###############################################################################

runTest {test tkt-964063da16-1.5 {pre-existing connection flags} -body {
  set connection [object create -alias \
      System.Data.SQLite.SQLiteConnection \
      "Data Source=:memory:;NoDefaultFlags=False;Flags=GetAllAsText;"]

  $connection Open
  $connection Flags
} -cleanup {
  unset -nocomplain connection
} -constraints {eagle command.object SQLite System.Data.SQLite} -result \
{GetAllAsText}}

###############################################################################

runTest {test tkt-964063da16-1.6 {pre-existing connection flags} -body {
  set connection [object create -alias \
      System.Data.SQLite.SQLiteConnection \
      "Data Source=:memory:;NoDefaultFlags=True;Flags=GetAllAsText;"]

  $connection Open
  $connection Flags
} -cleanup {
  unset -nocomplain connection
} -constraints {eagle command.object SQLite System.Data.SQLite} -result \
{GetAllAsText}}

###############################################################################

runTest {test tkt-964063da16-1.7 {pre-existing connection flags} -body {
  set connection [object create -alias \
      System.Data.SQLite.SQLiteConnection \
      "Data Source=:memory:;NoDefaultFlags=False;Flags=GetAllAsText;"]

  $connection Flags NoExtensionFunctions; $connection Open
  $connection Flags
} -cleanup {
  unset -nocomplain connection
} -constraints {eagle command.object SQLite System.Data.SQLite} -result \
{NoExtensionFunctions, GetAllAsText}}

###############################################################################

runTest {test tkt-964063da16-1.8 {pre-existing connection flags} -body {
  set connection [object create -alias \
      System.Data.SQLite.SQLiteConnection \
      "Data Source=:memory:;NoDefaultFlags=True;Flags=GetAllAsText;"]

  $connection Flags NoExtensionFunctions; $connection Open
  $connection Flags
} -cleanup {
  unset -nocomplain connection
} -constraints {eagle command.object SQLite System.Data.SQLite} -result \
{NoExtensionFunctions, GetAllAsText}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-996d13cd87.eagle.



























































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
###############################################################################
#
# tkt-996d13cd87.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

for {set i 1} {$i < 11} {incr i} {
  set pooling [expr {$i % 2 == 0 ? True : False}]
  set count [expr {$i <= 2 ? 100 : int(rand() * 100 + 1)}]

  runTest {test [appendArgs tkt-996d13cd87-1. $i] {SQLiteConnection stress} \
      -setup {
    set fileName [appendArgs tkt-996d13cd87-1. $i .db]

    tputs $test_channel [appendArgs \
        "---- using a total of " $count " threads...\n"]

    if {![haveConstraint runtime.noPoolCounts] && [catch {
        object invoke -flags +NonPublic \
            System.Data.SQLite.SQLiteConnectionPool ResetCounts
    }] == 0} then {
      set havePoolCounts true
    } else {
      set havePoolCounts false

      tputs $test_channel \
          "==== WARNING: connection pool counts are not available\n"
    }

    proc getPoolCounts {} {
      #
      # NOTE: If we have the ability to determine the opened/closed pool
      #       counts, fetch them now; otherwise, just set them to zero.
      #
      if {$::havePoolCounts} then {
        set ::poolCounts(opened) 0
        set ::poolCounts(closed) 0

        object invoke -flags +NonPublic \
            System.Data.SQLite.SQLiteConnectionPool GetCounts \
            ::poolCounts(opened) ::poolCounts(closed)

        tputs $::test_channel [appendArgs \
            "---- opened " $::poolCounts(opened) " connections from the pool\n"]

        tputs $::test_channel [appendArgs \
            "---- closed " $::poolCounts(closed) " connections to the pool\n"]
      } else {
        set ::poolCounts(opened) 0
        set ::poolCounts(closed) 0
      }

      return ""
    }
  } -body {
    set id [object invoke Interpreter.GetActive NextId]
    set dataSource [file join [getDatabaseDirectory] $fileName]

    set sql { \
      CREATE TABLE t1(x TEXT); \
      INSERT INTO t1 (x) VALUES(RANDOMBLOB(1000)); \
    }

    unset -nocomplain results errors

    set code [compileCSharpWith [subst {
      using System;
      using System.Data.SQLite;
      using System.Diagnostics;
      using System.Threading;

      namespace _Dynamic${id}
      {
        public static class Test${id}
        {
          public static int Main()
          {
            //
            // NOTE: This is the total number of exceptions caught by all the
            //       test threads.
            //
            int errors = 0;

            //
            // NOTE: This is the total number of test threads to create.
            //
            int count = ${count};

            //
            // NOTE: This is the total number of times we should force a full
            //       garbage collection.
            //
            int gcCount = 2;

            //
            // NOTE: Create a random number generator suitable for waiting a
            //       random number of milliseconds between each attempt to
            //       cause the race condition on a given thread.
            //
            Random random = new Random();

            //
            // NOTE: Create the event that will be used to synchronize all the
            //       created threads so that they start doing their actual test
            //       "work" at approximately the same time.
            //
            using (ManualResetEvent goEvent = new ManualResetEvent(false))
            {
              //
              // NOTE: Create a (reusable) delegate that will contain the code
              //       that most of the created test threads are going to
              //       execute.  The code in this delegate will create, open,
              //       use, and close a single database connection with (or
              //       without) pooling enabled.
              //
              ThreadStart threadStart1 = delegate()
              {
                try
                {
                  //
                  // NOTE: Wait forever for the "GO" signal so that all threads
                  //       can start working at approximately the same time.
                  //
                  goEvent.WaitOne();

                  //
                  // NOTE: Try to create, open, and close a database connection
                  //       and then wait a random number of milliseconds before
                  //       doing it again.
                  //
                  Thread.Sleep(random.Next(0, 500));

                  SQLiteConnection connection = new SQLiteConnection(
                      "Data Source=${dataSource};Pooling=${pooling};" +
                      "[getTestProperties]");

                  connection.Open();

                  using (SQLiteCommand command = new SQLiteCommand("${sql}",
                      connection))
                  {
                    command.ExecuteNonQuery();
                  }

                  connection.Close();
                  connection = null;
                }
                catch (Exception e)
                {
                  Interlocked.Increment(ref errors);
                  Trace.WriteLine(e);
                }
              };

              //
              // NOTE: Create a (reusable) delegate that will contain the code
              //       that the garbage collection thread is to execute.  The
              //       code in this delegate will attempt to force a full round
              //       of garbage collection several times.
              //
              ThreadStart threadStart2 = delegate()
              {
                try
                {
                  //
                  // NOTE: Wait forever for the "GO" signal so that all threads
                  //       can start working at approximately the same time.
                  //
                  goEvent.WaitOne();

                  //
                  // NOTE: Wait a random number of milliseconds before forcing
                  //       a full garbage collection.
                  //
                  for (int index = 0; index < gcCount; index++)
                  {
                    Thread.Sleep(random.Next(0, 1000));
                    GC.GetTotalMemory(true);
                  }
                }
                catch (Exception e)
                {
                  Interlocked.Increment(ref errors);
                  Trace.WriteLine(e);
                }
              };

              //
              // NOTE: Create the array of thread objects.
              //
              Thread\[\] thread = new Thread\[count\];

              //
              // NOTE: Create each of the test threads with a suitable stack
              //       size.  We must specify a stack size here because the
              //       default one for the process would be the same as the
              //       parent executable (the Eagle shell), which is 16MB,
              //       too large to be useful.
              //
              for (int index = 0; index < count; index++)
              {
                //
                // NOTE: Figure out what kind of thread to create (i.e. one
                //       that uses a connection or one that calls the GC).
                //
                ThreadStart threadStart;

                if (index == 0)
                  threadStart = threadStart2;
                else
                  threadStart = threadStart1;

                thread\[index\] = new Thread(threadStart, 1048576);

                //
                // NOTE: Name each thread for a better debugging experience.
                //
                thread\[index\].Name = String.Format(
                    "[file rootname ${fileName}] #{0}", index);
              }

              //
              // NOTE: Start all the threads now.  They should not actually do
              //       any of the test "work" until we signal the event.
              //
              for (int index = 0; index < count; index++)
                thread\[index\].Start();

              //
              // NOTE: Send the signal that all threads should start doing
              //       their test "work" now.
              //
              goEvent.Set(); /* GO */

              //
              // NOTE: Wait forever for each thread to finish its test "work"
              //       and then die.
              //
              for (int index = 0; index < count; index++)
                thread\[index\].Join();
            }

            //
            // NOTE: Return the total number of exceptions caught by the test
            //       threads.
            //
            return errors;
          }
        }
      }
    }] true false true results errors System.Data.SQLite.dll]

    list $code $results \
        [expr {[info exists errors] ? $errors : ""}] \
        [expr {$code eq "Ok" ? [catchCSharp {
          object invoke _Dynamic${id}.Test${id} Main
        } result] : [set result ""]}] $result [getPoolCounts] \
        [expr {$havePoolCounts ? $pooling ? $poolCounts(opened) > 0 : \
            $poolCounts(opened) == 0} : True] \
        [expr {$havePoolCounts ? $pooling ? $poolCounts(closed) > 0 : \
            $poolCounts(closed) == 0} : True]
  } -cleanup {
    object invoke System.Data.SQLite.SQLiteConnection ClearAllPools
    collectGarbage $test_channel

    cleanupDb $fileName

    unset -nocomplain result results errors code sql dataSource id \
        poolCounts havePoolCounts fileName

    rename getPoolCounts ""
  } -constraints {eagle command.object monoBug28 monoCrash211 command.sql\
compile.DATA SQLite System.Data.SQLite compileCSharp sdsTiming} -match regexp \
-result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \d+ \{\} True\
True$}}
}

###############################################################################

unset -nocomplain count pooling i

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-9ba9346f75.eagle.

























































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
###############################################################################
#
# tkt-9ba9346f75.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-9ba9346f75-1.1 {AutoCommit property} -setup {
  setupDb [set fileName tkt-9ba9346f75-1.1.db]
} -body {
  set connection [getDbConnection]

  set result [list]

  lappend result [object invoke $connection AutoCommit]; # True

  sql execute $db "CREATE TABLE t1(x);"
  lappend result [object invoke $connection AutoCommit]; # True

  sql execute $db "INSERT INTO t1 (x) VALUES(1);"
  lappend result [object invoke $connection AutoCommit]; # True

  sql execute $db "BEGIN TRANSACTION;"
  lappend result [object invoke $connection AutoCommit]; # False

  sql execute $db "INSERT INTO t1 (x) VALUES(1);"
  lappend result [object invoke $connection AutoCommit]; # False

  sql execute $db "COMMIT;"
  lappend result [object invoke $connection AutoCommit]; # True

  set result
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain result connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {True True True False False True}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-9d353b0bd8.eagle.



























































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
###############################################################################
#
# tkt-9d353b0bd8.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue
runSQLiteTestFilesPrologue

###############################################################################

runTest {test tkt-9d353b0bd8-1.1 {DbModificationCommandTree w/INSERT} -body {
  copySampleDatabaseFiles

  set result [list]
  set output ""

  set code [catch {
    testClrExec $testLinqExeFile [list -eventflags Wait -directory \
        [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
        -success Success] -insert
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  lappend result $code

  if {$code == 0} then {
    lappend result [string trim $output]
  } else {
    lappend result [string trim $error]
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result
} -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll testExec\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db} \
-result {0 {inserted 1}}}

###############################################################################

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-a4d9c7ee94.eagle.





























































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
###############################################################################
#
# tkt-a4d9c7ee94.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue
runSQLiteTestFilesPrologue

###############################################################################

runTest {test tkt-a4d9c7ee94-1.1 {LINQ w/BinaryGUID=false} -body {
  copySampleDatabaseFiles

  set result [list]
  set output ""

  set code [catch {
    testClrExec $testLinqExeFile [list -eventflags Wait -directory \
        [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
        -success Success] -binaryguid2 false
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  lappend result $code

  if {$code == 0} then {
    lappend result [string trim $output]
  } else {
    lappend result [string trim $error]
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result
} -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll testExec\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db} \
-constraintExpression {[haveConstraint buildFramework.netFx40] || \
[haveConstraint buildFramework.netFx45] || \
[haveConstraint buildFramework.netFx451] || \
[haveConstraint buildFramework.netFx452] || \
[haveConstraint buildFramework.netFx46] || \
[haveConstraint buildFramework.netFx461] || \
[haveConstraint buildFramework.netFx462] || \
[haveConstraint buildFramework.netFx47] || \
[haveConstraint buildFramework.netFx471] || \
[haveConstraint buildFramework.netFx472] || \
[haveConstraint buildFramework.netFx48]} \
-result {0 {1581 1730 1833 2116 2139 2184 2903 3049 3801 6897 7960 8837 10019\
10038 11747 14450 19428 19713 20852 27403 27511 29202 30346 31406 32859 33607\
40222 44122 45839 48075 48084 48304 53404 55113 55439 60179 60601 72716 75234\
78759 80202 80909 85014 85251 90405 94025 94105 95008 95054 95060 98004 98052\
98104}}}

###############################################################################

runTest {test tkt-a4d9c7ee94-1.2 {LINQ w/BinaryGUID=true} -body {
  copySampleDatabaseFiles

  set result [list]
  set output ""

  set code [catch {
    testClrExec $testLinqExeFile [list -eventflags Wait -directory \
        [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
        -success Success] -binaryguid2 true
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  lappend result $code

  if {$code == 0} then {
    lappend result [string trim $output]
  } else {
    lappend result [string trim $error]
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result
} -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll testExec\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db} \
-constraintExpression {[haveConstraint buildFramework.netFx40] || \
[haveConstraint buildFramework.netFx45] || \
[haveConstraint buildFramework.netFx451] || \
[haveConstraint buildFramework.netFx452] || \
[haveConstraint buildFramework.netFx46] || \
[haveConstraint buildFramework.netFx461] || \
[haveConstraint buildFramework.netFx462] || \
[haveConstraint buildFramework.netFx47] || \
[haveConstraint buildFramework.netFx471] || \
[haveConstraint buildFramework.netFx472] || \
[haveConstraint buildFramework.netFx48]} \
-result {0 {1581 1730 1833 2116 2139 2184 2903 3049 3801 6897 7960 8837 10019\
10038 11747 14450 19428 19713 20852 27403 27511 29202 30346 31406 32859 33607\
40222 44122 45839 48075 48084 48304 53404 55113 55439 60179 60601 72716 75234\
78759 80202 80909 85014 85251 90405 94025 94105 95008 95054 95060 98004 98052\
98104}}}

###############################################################################

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-a799e3978f.eagle.































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
###############################################################################
#
# tkt-a799e3978f.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-a799e3978f-1.1 {DateTime2 type mapping} -setup {
  setupDb [set fileName tkt-a799e3978f-1.1.db] "" "" "" UseConnectionTypes
} -body {
  set connection [getDbConnection]
  set result [list]

  lappend result [sql execute $db \
      "CREATE TABLE t1(x INTEGER PRIMARY KEY, y DATETIME2);"]

  set dateTime [clock format [clock scan "2014-02-01 12:34:56Z"] \
      -format yyyyMMddHHmmss -gmt true]

  lappend result [sql execute $db [appendArgs \
      "INSERT INTO t1 (y) VALUES('" $dateTime "');"]]

  lappend result [sql execute -verbatim -execute reader -format list \
      -datetimeformat [getDateTimeFormat] $db "SELECT x, y FROM t1;"]

  lappend result [$connection ClearTypeMappings]; # 0
  lappend result [$connection AddTypeMapping DATETIME2 DateTime false]; # 0

  lappend result [sql execute -verbatim -execute reader -format list \
      -datetimeformat [getDateTimeFormat] $db "SELECT x, y FROM t1;"]

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain result connection

  cleanupDb $fileName

  unset -nocomplain dateTime db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result \
{0 1 {1 20140201123456} 0 0 {1 {2014-02-01 12:34:56}}}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-a7d04fb111.eagle.























































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
###############################################################################
#
# tkt-a7d04fb111.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

set rawValue(0) "2015-02-18 00:00:00.0000000"

###############################################################################

set ticksValue(0) [getDateTimeTicks $rawValue(0)]
set ticksValue(1) [getDateTimeTicks $rawValue(0) false]
set ticksValue(2) [getDateTimeTicks $rawValue(0) true]

###############################################################################

set instanceValue(0) [object create -alias DateTime $ticksValue(0)]
set instanceValue(1) [object create -alias DateTime $ticksValue(1) Utc]
set instanceValue(2) [object create -alias DateTime $ticksValue(2) Local]

###############################################################################

set iso8601Value(0) [$instanceValue(0) ToString [getDateTimeFormat]]
set iso8601Value(1) [$instanceValue(1) ToString [getDateTimeFormat]]
set iso8601Value(2) [$instanceValue(2) ToString [getDateTimeFormat false false]]

###############################################################################

if {[haveConstraint System.Data.SQLite]} then {
  set julianDayValue(0) [object invoke \
      System.Data.SQLite.SQLiteConvert \
      ToJulianDay $instanceValue(0)]

  set julianDayValue(1) [object invoke \
      System.Data.SQLite.SQLiteConvert \
      ToJulianDay $instanceValue(1)]

  set julianDayValue(2) [object invoke \
      System.Data.SQLite.SQLiteConvert \
      ToJulianDay $instanceValue(2)]
} else {
  set julianDayValue(0) 0
  set julianDayValue(1) 0
  set julianDayValue(2) 0
}

###############################################################################

if {[haveConstraint System.Data.SQLite]} then {
  set unixEpochValue(0) [object invoke \
      System.Data.SQLite.SQLiteConvert \
      ToUnixEpoch $instanceValue(0)]

  set unixEpochValue(1) [object invoke \
      System.Data.SQLite.SQLiteConvert \
      ToUnixEpoch $instanceValue(1)]

  set unixEpochValue(2) [object invoke \
      System.Data.SQLite.SQLiteConvert \
      ToUnixEpoch $instanceValue(2)]
} else {
  set unixEpochValue(0) 0
  set unixEpochValue(1) 0
  set unixEpochValue(2) 0
}

###############################################################################

if {[haveConstraint System.Data.SQLite]} then {
  set invariantCultureValue(0) [object invoke \
      System.Data.SQLite.SQLiteConvert \
      ToString $instanceValue(0) InvariantCulture Unspecified null]

  set invariantCultureValue(1) [object invoke \
      System.Data.SQLite.SQLiteConvert \
      ToString $instanceValue(1) InvariantCulture Utc null]

  set invariantCultureValue(2) [object invoke \
      System.Data.SQLite.SQLiteConvert \
      ToString $instanceValue(2) InvariantCulture Local null]
} else {
  set invariantCultureValue(0) 0
  set invariantCultureValue(1) 0
  set invariantCultureValue(2) 0
}

###############################################################################

runTest {test tkt-a7d04fb111-1.1 {Bind DateTime Utc Ticks} -setup {
  setupDb [set fileName tkt-a7d04fb111-1.1.db] "" Ticks Utc \
      BindDateTimeWithKind
} -body {
  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(0)]]

  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(1)]]

  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(2)]]

  lappend result [expr {[lindex $result 0] == [lindex $result 1]}]
  lappend result [expr {[lindex $result 0] == [lindex $result 2]}]
  lappend result [expr {[lindex $result 1] == [lindex $result 2]}]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \
-nobackslashes {$ticksValue(0) $ticksValue(1) $ticksValue(1) True True True}]}

###############################################################################

runTest {test tkt-a7d04fb111-1.2 {Bind DateTime Local Ticks} -setup {
  setupDb [set fileName tkt-a7d04fb111-1.2.db] "" Ticks Local \
      BindDateTimeWithKind
} -body {
  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(0)]]

  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(1)]]

  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(2)]]

  lappend result [expr {[lindex $result 0] == [lindex $result 1]}]
  lappend result [expr {[lindex $result 0] == [lindex $result 2]}]
  lappend result [expr {[lindex $result 1] == [lindex $result 2]}]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \
-nobackslashes {$ticksValue(0) $ticksValue(2) $ticksValue(2) False False True}]}

###############################################################################

runTest {test tkt-a7d04fb111-1.3 {Bind DateTime Utc ISO8601} -setup {
  setupDb [set fileName tkt-a7d04fb111-1.3.db] "" ISO8601 Utc \
      BindDateTimeWithKind
} -body {
  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(0)]]

  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(1)]]

  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(2)]]

  lappend result [expr {[lindex $result 0] eq [lindex $result 1]}]
  lappend result [expr {[lindex $result 0] eq [lindex $result 2]}]
  lappend result [expr {[lindex $result 1] eq [lindex $result 2]}]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \
-nobackslashes {{$iso8601Value(1)} {$iso8601Value(1)} {$iso8601Value(1)} True\
True True}]}

###############################################################################

runTest {test tkt-a7d04fb111-1.4 {Bind DateTime Local ISO8601} -setup {
  setupDb [set fileName tkt-a7d04fb111-1.4.db] "" ISO8601 Local \
      BindDateTimeWithKind
} -body {
  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(0)]]

  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(1)]]

  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(2)]]

  lappend result [expr {[lindex $result 0] eq [lindex $result 1]}]
  lappend result [expr {[lindex $result 0] eq [lindex $result 2]}]
  lappend result [expr {[lindex $result 1] eq [lindex $result 2]}]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \
-nobackslashes {{$iso8601Value(0)} {$iso8601Value(2)} {$iso8601Value(2)} False\
False True}]}

###############################################################################

runTest {test tkt-a7d04fb111-1.5 {Bind DateTime Utc JulianDay} -setup {
  setupDb [set fileName tkt-a7d04fb111-1.5.db] "" JulianDay Utc \
      BindDateTimeWithKind
} -body {
  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(0)]]

  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(1)]]

  lappend result [expr {round2([sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(2)]], 2)}]

  lappend result [expr {[lindex $result 0] == [lindex $result 1]}]
  lappend result [expr {[lindex $result 0] == [lindex $result 2]}]
  lappend result [expr {[lindex $result 1] == [lindex $result 2]}]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \
-nobackslashes {$julianDayValue(0) $julianDayValue(1) $julianDayValue(1) True\
True True}]}

###############################################################################

runTest {test tkt-a7d04fb111-1.6 {Bind DateTime Local JulianDay} -setup {
  setupDb [set fileName tkt-a7d04fb111-1.6.db] "" JulianDay Local \
      BindDateTimeWithKind
} -body {
  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(0)]]

  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(1)]]

  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(2)]]

  lappend result [expr {[lindex $result 0] == [lindex $result 1]}]
  lappend result [expr {[lindex $result 0] == [lindex $result 2]}]
  lappend result [expr {[lindex $result 1] == [lindex $result 2]}]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \
-nobackslashes {$julianDayValue(0) $julianDayValue(2) $julianDayValue(2) False\
False True}]}

###############################################################################

runTest {test tkt-a7d04fb111-1.7 {Bind DateTime Utc UnixEpoch} -setup {
  setupDb [set fileName tkt-a7d04fb111-1.7.db] "" UnixEpoch Utc \
      BindDateTimeWithKind
} -body {
  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(0)]]

  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(1)]]

  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(2)]]

  lappend result [expr {[lindex $result 0] == [lindex $result 1]}]
  lappend result [expr {[lindex $result 0] == [lindex $result 2]}]
  lappend result [expr {[lindex $result 1] == [lindex $result 2]}]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \
-nobackslashes {$unixEpochValue(0) $unixEpochValue(1) $unixEpochValue(1) True\
True True}]}

###############################################################################

runTest {test tkt-a7d04fb111-1.8 {Bind DateTime Local UnixEpoch} -setup {
  setupDb [set fileName tkt-a7d04fb111-1.8.db] "" UnixEpoch Local \
      BindDateTimeWithKind
} -body {
  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(0)]]

  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(1)]]

  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(2)]]

  lappend result [expr {[lindex $result 0] == [lindex $result 1]}]
  lappend result [expr {[lindex $result 0] == [lindex $result 2]}]
  lappend result [expr {[lindex $result 1] == [lindex $result 2]}]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \
-nobackslashes {$unixEpochValue(0) $unixEpochValue(2) $unixEpochValue(2) False\
False True}]}

###############################################################################

runTest {test tkt-a7d04fb111-1.9 {Bind DateTime Utc Invariant} -setup {
  setupDb [set fileName tkt-a7d04fb111-1.9.db] "" InvariantCulture Utc \
      BindDateTimeWithKind
} -body {
  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(0)]]

  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(1)]]

  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(2)]]

  lappend result [expr {[lindex $result 0] eq [lindex $result 1]}]
  lappend result [expr {[lindex $result 0] eq [lindex $result 2]}]
  lappend result [expr {[lindex $result 1] eq [lindex $result 2]}]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \
-nobackslashes {$invariantCultureValue(0) $invariantCultureValue(1)\
$invariantCultureValue(1) False False True}]}

###############################################################################

runTest {test tkt-a7d04fb111-1.10 {Bind DateTime Local Invariant} -setup {
  setupDb [set fileName tkt-a7d04fb111-1.10.db] "" InvariantCulture Local \
      BindDateTimeWithKind
} -body {
  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(0)]]

  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(1)]]

  lappend result [sql execute -execute scalar $db "SELECT ?;" \
      [list param1 DateTime $instanceValue(2)]]

  lappend result [expr {[lindex $result 0] eq [lindex $result 1]}]
  lappend result [expr {[lindex $result 0] eq [lindex $result 2]}]
  lappend result [expr {[lindex $result 1] eq [lindex $result 2]}]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints {eagle command.object monoBug28 monoBug42 command.sql\
compile.DATA SQLite System.Data.SQLite} -result [subst -nocommands \
-nobackslashes {$invariantCultureValue(0) $invariantCultureValue(2)\
$invariantCultureValue(2) False False True}]}

###############################################################################

unset -nocomplain invariantCultureValue unixEpochValue julianDayValue \
    iso8601Value instanceValue ticksValue rawValue

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-aba4549801.eagle.





















































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
###############################################################################
#
# tkt-aba4549801.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-aba4549801-1.1 {SQLiteConnection.Changed event} -setup {
  proc onChanged { sender e } {
    set list [list]

    if {[isNonNullObjectHandle $sender] && \
        [regexp -- $::patterns(connection) $sender]} then {
      set connectionString [$sender -flags +NonPublic _connectionString]

      if {![string match "*\[/\\\]tkt-aba4549801-1.1.db\;*" \
          $connectionString]} then {
        #
        # NOTE: This is a "stray" connection (i.e. it is not
        #       part of this test); therefore, ignore events
        #       for it.
        #
        return
      }

      lappend list 1
    } elseif {[string length $sender] > 0} then {
      lappend list $sender
    }

    if {[isNonNullObjectHandle $e] > 0} then {
      lappend list [$e EventType]

      set o1 [$e -objectflags NoDispose Transaction]

      if {[isNonNullObjectHandle $o1] && \
          [regexp -- $::patterns(transaction) $o1]} then {
        lappend list 1
      } elseif {[string length $o1] > 0} then {
        lappend list $o1
      }

      set o2 [$e -objectflags NoDispose Command]

      if {[isNonNullObjectHandle $o2] && \
          [regexp -- $::patterns(command) $o2]} then {
        lappend list 1
      } elseif {[string length $o2] > 0} then {
        lappend list $o2
      }

      set o3 [$e -objectflags NoDispose DataReader]

      if {[isNonNullObjectHandle $o3] && \
          [regexp -- $::patterns(dataReader) $o3]} then {
        lappend list 1
      } elseif {[string length $o3] > 0} then {
        lappend list $o3
      }

      set o4 [$e -objectflags NoDispose CriticalHandle]

      if {[isNonNullObjectHandle $o4] && \
          ([regexp -- $::patterns(handle1) $o4] || \
           [regexp -- $::patterns(handle2) $o4])} then {
        lappend list 1
      } elseif {[string length $o4] > 0} then {
        lappend list $o4
      }
    }

    lappend ::result $list
  }

  set patterns(connection) {^System#Data#SQLite#SQLiteConnection#\d+$}
  set patterns(transaction) {^System#Data#SQLite#SQLiteTransaction#\d+$}
  set patterns(command) {^System#Data#SQLite#SQLiteCommand#\d+$}
  set patterns(dataReader) {^System#Data#SQLite#SQLiteDataReader#\d+$}
  set patterns(handle1) {^System#Data#SQLite#SQLiteConnectionHandle#\d+$}
  set patterns(handle2) {^System#Data#SQLite#SQLiteStatementHandle#\d+$}

  set callback onChanged
  object invoke System.Data.SQLite.SQLiteConnection add_Changed $callback
} -body {
  setupDb [set fileName tkt-aba4549801-1.1.db]

  sql execute $db "CREATE TABLE t1(x);"

  set transaction [sql transaction begin $db]

  sql execute -execute reader $db \
      "INSERT INTO t1(x) VALUES(1); SELECT x FROM t1;"

  sql transaction commit $transaction

  cleanupDb $fileName

  set result
} -cleanup {
  object invoke System.Data.SQLite.SQLiteConnection remove_Changed $callback
  catch {object removecallback $callback}

  unset -nocomplain rows transaction result callback patterns db fileName

  rename onChanged ""
} -constraints {eagle command.object monoBug28 monoBug211 command.sql\
compile.DATA SQLite System.Data.SQLite} -result {{1 Opening} {1 Closing} {1\
NothingToDo} {1 Closed} {1 ConnectionStringPreview} {1 ConnectionString}\
{NewCriticalHandle 1} {1 NewCommand 1} {1 DisposingCommand 1} {1 Opened} {1\
NewCommand 1} {1 SqlStringPreview} {1 NewDataReader 1 1} {NewCriticalHandle 1}\
{1 DisposingDataReader 1 1} {1 ClosingDataReader 1 1} {1 DisposingCommand 1} {1\
NewCommand 1} {1 SqlStringPreview} {1 NewDataReader 1 1} {NewCriticalHandle 1}\
{1 DisposingDataReader 1 1} {1 ClosingDataReader 1 1} {1 DisposingCommand 1} {1\
NewCommand 1} {1 SqlStringPreview} {1 NewDataReader 1 1} {NewCriticalHandle 1}\
{1 DisposingDataReader 1 1} {1 ClosingDataReader 1 1} {1 DisposingCommand 1} {1\
NewTransaction 1} {1 NewCommand 1} {1 SqlStringPreview} {1 NewDataReader 1 1}\
{NewCriticalHandle 1} {NewCriticalHandle 1} {1 ClosingDataReader 1 1} {1\
DisposingCommand 1} {1 NewCommand 1} {1 SqlStringPreview} {1 NewDataReader 1 1}\
{NewCriticalHandle 1} {1 DisposingDataReader 1 1} {1 ClosingDataReader 1 1} {1\
DisposingCommand 1} {1 Closing} {1 Closed}}}

###############################################################################

runTest {test tkt-aba4549801-1.2 {Changed "Dispose" events} -setup {
  proc onChanged { sender e } {
    if {![isNonNullObjectHandle $sender] || \
        ![regexp -- $::patterns(connection) $sender]} then {
      #
      # NOTE: Skip tracking any events that do not pertain
      #       to a connection.
      #
      return
    }

    set connectionString [$sender -flags +NonPublic _connectionString]

    if {![string match "*\[/\\\]tkt-aba4549801-1.2.db\;*" \
        $connectionString]} then {
      #
      # NOTE: This is a "stray" connection (i.e. it is not
      #       part of this test); therefore, ignore events
      #       for it.
      #
      return
    }

    if {![isNonNullObjectHandle $e]} then {
      #
      # NOTE: Skip tracking events without the appropriate
      #       metadata.
      #
      return
    }

    set eventType [$e EventType]

    if {$eventType ni [list \
        Opening ConnectionString Opened Closing Closed \
        OpenedFromPool ClosedToPool DisposingConnection \
        DisposedConnection FinalizingConnection \
        FinalizedConnection NothingToDo]} then {
      #
      # NOTE: Skip tracking events of types that we are not
      #       interested in.
      #
      return
    }

    lappend ::result $eventType
  }

  set patterns(connection) {^System#Data#SQLite#SQLiteConnection#\d+$}

  set callback onChanged
  object invoke System.Data.SQLite.SQLiteConnection add_Changed $callback
} -body {
  setupDb [set fileName tkt-aba4549801-1.2.db]
  set connection [getDbConnection]

  sql execute $db "CREATE TABLE t1(x);"

  sql execute -execute reader $db \
      "INSERT INTO t1(x) VALUES(1); SELECT x FROM t1;"

  $connection Dispose

  set result
} -cleanup {
  freeDbConnection connection false

  unset -nocomplain connection

  cleanupDb $fileName db true true true true true

  object invoke System.Data.SQLite.SQLiteConnection remove_Changed $callback
  catch {object removecallback $callback}

  unset -nocomplain rows result callback patterns db fileName

  rename onChanged ""
} -constraints {eagle command.object monoBug28 monoBug211 command.sql\
compile.DATA SQLite System.Data.SQLite} -result {Opening Closing NothingToDo\
Closed ConnectionString Opened DisposingConnection Closing Closed\
DisposedConnection}}

###############################################################################

runTest {test tkt-aba4549801-1.3 {Changed "Finalize" events} -setup {
  proc onChanged { sender e } {
    if {![isNonNullObjectHandle $sender] || \
        ![regexp -- $::patterns(connection) $sender]} then {
      #
      # NOTE: Skip tracking any events that do not pertain
      #       to a connection.
      #
      return
    }

    set connectionString [$sender -flags +NonPublic _connectionString]

    if {![string match "*\[/\\\]tkt-aba4549801-1.3.db\;*" \
        $connectionString]} then {
      #
      # NOTE: This is a "stray" connection (i.e. it is not
      #       part of this test); therefore, ignore events
      #       for it.
      #
      return
    }

    if {![isNonNullObjectHandle $e]} then {
      #
      # NOTE: Skip tracking events without the appropriate
      #       metadata.
      #
      return
    }

    set eventType [$e EventType]

    if {$eventType ni [list \
        Opening ConnectionString Opened Closing Closed \
        OpenedFromPool ClosedToPool DisposingConnection \
        DisposedConnection FinalizingConnection \
        FinalizedConnection NothingToDo]} then {
      #
      # NOTE: Skip tracking events of types that we are not
      #       interested in.
      #
      return
    }

    lappend ::result $eventType
  }

  set patterns(connection) {^System#Data#SQLite#SQLiteConnection#\d+$}

  set callback onChanged
  object invoke System.Data.SQLite.SQLiteConnection add_Changed $callback
} -body {
  setupDb [set fileName tkt-aba4549801-1.3.db]
  set connection [getDbConnection]

  sql execute $db "CREATE TABLE t1(x);"

  sql execute -execute reader $db \
      "INSERT INTO t1(x) VALUES(1); SELECT x FROM t1;"

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteConnection _lastConnectionInOpen null

  freeDbConnection connection false
  removeDbConnection

  collectGarbage $test_channel

  set result
} -cleanup {
  freeDbConnection connection true true

  unset -nocomplain connection

  cleanupDb $fileName db true true true true true

  object invoke System.Data.SQLite.SQLiteConnection remove_Changed $callback
  catch {object removecallback $callback}

  unset -nocomplain rows result callback patterns db fileName

  rename onChanged ""
} -constraints {eagle command.object monoBug28 monoBug211 command.sql\
compile.DATA SQLite System.Data.SQLite} -result {Opening Closing NothingToDo\
Closed ConnectionString Opened FinalizingConnection Closing Closed\
FinalizedConnection}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-ac47dd230a.eagle.



















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
###############################################################################
#
# tkt-ac47dd230a.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-ac47dd230a-1.1 {multiple AppDomains} -setup {
  for {set i 1} {$i < 3} {incr i} {
    set appDomain($i) [object invoke AppDomain CreateDomain \
        [appendArgs tkt-ac47dd230a-1.1. $i]]

    set interpreterSettings($i) [object invoke -alias InterpreterSettings \
        Create]

    $interpreterSettings($i) CreateFlags Default
    $interpreterSettings($i) InitializeFlags Default
    $interpreterSettings($i) ScriptFlags Default

    set result null
    set interpreterHelper($i) [object invoke -alias InterpreterHelper \
        Create $appDomain($i) $interpreterSettings($i) true result]

    if {![isNonNullObjectHandle $interpreterHelper($i)]} then {
      error [object invoke $result ToString]
    }

    set interpreter($i) [$interpreterHelper($i) -alias Interpreter]

    set result null
    set code [$interpreter($i) EvaluateScript [getAppDomainPreamble] result]

    if {$code ne "Ok"} then {
      error [object invoke $result ToString]
    }
  }
} -body {
  set results [list]

  for {set i 1} {$i < 3} {incr i} {
    set result null
    set code [$interpreter($i) EvaluateScript {
      package require Eagle.Library
      package require Eagle.Test
      package require System.Data.SQLite.Test

      object load -loadtype File [file join [getBinaryDirectory] \
          System.Data.SQLite.dll]

      setupDb tkt-ac47dd230a-1.1; cleanupDb tkt-ac47dd230a-1.1
    } result]

    lappend results $code [getStringFromObjectHandle $result]
  }

  set results
} -cleanup {
  unset -nocomplain results code result interpreter interpreterHelper \
      interpreterSettings

  for {set i 1} {$i < 3} {incr i} {
    if {[info exists appDomain($i)]} then {
      object invoke AppDomain Unload $appDomain($i)
    }
  }

  unset -nocomplain appDomain i
} -constraints {eagle command.object monoBug28 command.sql compile.DATA\
compile.ISOLATED_INTERPRETERS SQLite System.Data.SQLite} -result {Ok 0 Ok 0}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-ae5267b863.eagle.





























































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
###############################################################################
#
# tkt-ae5267b863.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

#
# NOTE: For some reason, this test does not play nicely when all the managed
#       debugging assistants are enabled.
#
runTest {test tkt-ae5267b863-1.1 {segfault during command GC} -setup {
  setupDb [set fileName tkt-ae5267b863-1.1.db]
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql(1) { \
    CREATE TABLE t1( \
      __rowid INTEGER PRIMARY KEY AUTOINCREMENT, \
      z STRING \
    ); \
  }

  set sql(2) { \
    CREATE VIRTUAL TABLE t2 USING RTREE( \
      id, minx, maxx, miny, maxy \
    ); \
  }

  set sql(3) { \
    INSERT INTO t1 VALUES({0}, \"value {0}\"); \
  }

  set sql(4) { \
    INSERT INTO t2 VALUES({0}, {0}, {0}, {0}, {0}); \
  }

  set sql(5) { \
    SELECT COUNT(*) FROM t1, t2 \
    WHERE t1.__rowid = t2.id AND \
    (t2.minx <= :xmax and t2.miny <= :ymax and \
     t2.maxx >= :xmin and t2.maxy >= :ymin); \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "${sql(1)}";
              command.ExecuteNonQuery();

              command.CommandText = "${sql(2)}";
              command.ExecuteNonQuery();
            }

            using (SQLiteCommand command = connection.CreateCommand())
            {
              using (SQLiteTransaction transaction =
                  connection.BeginTransaction())
              {
                for (int index = 0; index < 10; index++)
                {
                  command.CommandText = String.Format("${sql(3)}", index);
                  command.ExecuteNonQuery();

                  command.CommandText = String.Format("${sql(4)}", index);
                  command.ExecuteNonQuery();
                }

                transaction.Commit();
              }
            }

            //
            // NOTE: Perform a huge amount of command creation and execution
            //       cycles for a better chance to trigger the bug.
            //
            for (int index = 0; index < 100000; index++)
            {
              //
              // NOTE: Purposely omit the 'using' block here to test
              //       command disposal via the garbage collector.
              //
              SQLiteCommand command = connection.CreateCommand();

              command.CommandText = "${sql(5)}";
              command.Parameters.Add(new SQLiteParameter(":xmin", 2));
              command.Parameters.Add(new SQLiteParameter(":xmax", 8));
              command.Parameters.Add(new SQLiteParameter(":ymin", 2));
              command.Parameters.Add(new SQLiteParameter(":ymax", 8));

              using (SQLiteDataReader reader = command.ExecuteReader())
              {
                while (reader.Read()) {
                  //
                  // do nothing.
                  //
                }
              }
            }

            connection.Close();
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName
  collectGarbage $test_channel

  unset -nocomplain result code results errors sql dataSource id db fileName
} -constraints [fixConstraints {eagle command.object monoBug28 monoBug211\
command.sql compile.DATA SQLite System.Data.SQLite !mda compileCSharp\
!defineConstant.System.Data.SQLite.INTEROP_LEGACY_CLOSE}] -match regexp \
-result {^Ok System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-b167206ad3.eagle.













































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
###############################################################################
#
# tkt-b167206ad3.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-b167206ad3-1.1 {type affinity for DECIMAL} -setup {
  setupDb [set fileName tkt-b167206ad3-1.1.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y DECIMAL(38,9));
    INSERT INTO t1 (x, y) VALUES(1, 123456789123456780);
    INSERT INTO t1 (x, y) VALUES(2, '123456789123456780');
  }

  set dataReader [sql execute \
      -execute reader -format datareader \
      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]
    set y2 [$dataReader -create -alias GetValue 1]

    lappend result [list [$x ToString] [$y1 ToString] [$y2 ToString]]
  }

  set result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain y2 y1 x result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{1 123456789123456780 123456789123457000} {2\
123456789123456780 123456789123457000}}}

###############################################################################

runTest {test tkt-b167206ad3-1.2 {type affinity for DECIMAL} -setup {
  setupDb [set fileName tkt-b167206ad3-1.2.db] "" "" "" GetDecimalAsText
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y DECIMAL(38,9));
    INSERT INTO t1 (x, y) VALUES(1, 123456789123456780);
    INSERT INTO t1 (x, y) VALUES(2, '123456789123456780');
  }

  set dataReader [sql execute \
      -execute reader -format datareader \
      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]
    set y2 [$dataReader -create -alias GetValue 1]

    lappend result [list [$x ToString] [$y1 ToString] [$y2 ToString]]
  }

  set result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain y2 y1 x result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{1 123456789123456780 123456789123456780} {2\
123456789123456780 123456789123456780}}}

###############################################################################

runTest {test tkt-b167206ad3-1.3 {type affinity for NUMERIC} -setup {
  setupDb [set fileName tkt-b167206ad3-1.3.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y NUMERIC);
    INSERT INTO t1 (x, y) VALUES(1, 123456789123456780);
    INSERT INTO t1 (x, y) VALUES(2, '123456789123456780');
  }

  set dataReader [sql execute \
      -execute reader -format datareader \
      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]
    set y2 [$dataReader -create -alias GetValue 1]

    lappend result [list [$x ToString] [$y1 ToString] [$y2 ToString]]
  }

  set result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain y2 y1 x result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{1 123456789123456780 123456789123457000} {2\
123456789123456780 123456789123457000}}}

###############################################################################

runTest {test tkt-b167206ad3-1.4 {type affinity for NUMERIC} -setup {
  setupDb [set fileName tkt-b167206ad3-1.4.db] "" "" "" GetDecimalAsText
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y NUMERIC);
    INSERT INTO t1 (x, y) VALUES(1, 123456789123456780);
    INSERT INTO t1 (x, y) VALUES(2, '123456789123456780');
  }

  set dataReader [sql execute \
      -execute reader -format datareader \
      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]
    set y2 [$dataReader -create -alias GetValue 1]

    lappend result [list [$x ToString] [$y1 ToString] [$y2 ToString]]
  }

  set result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain y2 y1 x result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{1 123456789123456780 123456789123456780} {2\
123456789123456780 123456789123456780}}}

###############################################################################

runTest {test tkt-b167206ad3-2.1 {bind type for DECIMALTEXT} -setup {
  setupDb [set fileName tkt-b167206ad3-2.1.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y DECIMALTEXT(38,9));
  }

  set d(1) [object invoke -create Decimal Parse 123456789123456780]
  set d(2) [object invoke -create Decimal Parse 12345678912345.1556346]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(1, ?);" \
      [list param1 Decimal $d(1)]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(2, ?);" \
      [list param1 Decimal $d(2)]

  set dataReader [sql execute \
      -execute reader -format datareader \
      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]
    set y2 [$dataReader -create -alias GetValue 1]

    lappend result [list [$x ToString] [$y1 ToString] [$y2 ToString]]
  }

  set result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain y2 y1 x d result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{1 123456789123456780 123456789123457000} {2\
12345678912345.1556346 12345678912345.2}}}

###############################################################################

runTest {test tkt-b167206ad3-2.2 {bind type for DECIMALTEXT} -setup {
  setupDb [set fileName tkt-b167206ad3-2.2.db] "" "" "" \
      "BindDecimalAsText GetAllAsText"
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y DECIMALTEXT(38,9));
  }

  set d(1) [object invoke -create Decimal Parse 123456789123456780]
  set d(2) [object invoke -create Decimal Parse 12345678912345.1556346]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(1, ?);" \
      [list param1 Decimal $d(1)]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(2, ?);" \
      [list param1 Decimal $d(2)]

  set dataReader [sql execute \
      -execute reader -format datareader \
      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]
    set y2 [$dataReader -create -alias GetValue 1]

    lappend result [list [$x ToString] [$y1 ToString] [$y2 ToString]]
  }

  set result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain y2 y1 x d result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{1 123456789123456780 123456789123456780} {2\
12345678912345.1556346 12345678912345.1556346}}}

###############################################################################

runTest {test tkt-b167206ad3-2.3 {bind type for NUMERICTEXT} -setup {
  setupDb [set fileName tkt-b167206ad3-2.3.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y NUMERICTEXT);
  }

  set d(1) [object invoke -create Decimal Parse 123456789123456780]
  set d(2) [object invoke -create Decimal Parse 12345678912345.1556346]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(1, ?);" \
      [list param1 Decimal $d(1)]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(2, ?);" \
      [list param1 Decimal $d(2)]

  set dataReader [sql execute \
      -execute reader -format datareader \
      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]
    set y2 [$dataReader -create -alias GetValue 1]

    lappend result [list [$x ToString] [$y1 ToString] [$y2 ToString]]
  }

  set result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain y2 y1 x d result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{1 123456789123456780 123456789123457000} {2\
12345678912345.1556346 12345678912345.2}}}

###############################################################################

runTest {test tkt-b167206ad3-2.4 {bind type for NUMERICTEXT} -setup {
  setupDb [set fileName tkt-b167206ad3-2.4.db] "" "" "" \
      "BindDecimalAsText GetAllAsText"
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER, y NUMERICTEXT);
  }

  set d(1) [object invoke -create Decimal Parse 123456789123456780]
  set d(2) [object invoke -create Decimal Parse 12345678912345.1556346]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(1, ?);" \
      [list param1 Decimal $d(1)]

  sql execute $db "INSERT INTO t1 (x, y) VALUES(2, ?);" \
      [list param1 Decimal $d(2)]

  set dataReader [sql execute \
      -execute reader -format datareader \
      -alias $db "SELECT x, y FROM t1 ORDER BY x;"]

  set result [list]

  while {[$dataReader Read]} {
    set x [$dataReader -create -alias GetValue 0]
    set y1 [$dataReader -create -alias GetDecimal 1]
    set y2 [$dataReader -create -alias GetValue 1]

    lappend result [list [$x ToString] [$y1 ToString] [$y2 ToString]]
  }

  set result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain y2 y1 x d result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{1 123456789123456780 123456789123456780} {2\
12345678912345.1556346 12345678912345.1556346}}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-b4a7ddc83f.eagle.



















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
###############################################################################
#
# tkt-b4a7ddc83f.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

#
# NOTE: Make sure that SQLite core library is completely shutdown prior to
#       starting any of the tests in this file.
#
shutdownSQLite $test_channel

###############################################################################

for {set i 1} {$i < 3} {incr i} {
  runTest {test [appendArgs tkt-b4a7ddc83f-1. $i] {logging shutdown} -setup \
      [getAppDomainPreamble {
    proc haveSQLiteObjectCommand {[info args haveSQLiteObjectCommand]} {
      [info body haveSQLiteObjectCommand]
    }

    set appDomainId(1) {[expr {[haveSQLiteObjectCommand] ? \
        [object invoke AppDomain.CurrentDomain Id] : [info appdomain]}]}

    set fileName {[appendArgs tkt-b4a7ddc83f-1. $i .db]}
  }] -body {
    set appDomainId(2) [object invoke AppDomain.CurrentDomain Id]

    package require Eagle.Library
    package require Eagle.Test
    package require System.Data.SQLite.Test

    object load -loadtype File [file join [getBinaryDirectory] \
        System.Data.SQLite.dll]

    object invoke System.Data.SQLite.SQLiteLog Initialize

    list $appDomainId(1) $appDomainId(2) \
        [expr {$appDomainId(1) != $appDomainId(2)}] [setupDb $fileName]
  } -cleanup {
    cleanupDb $fileName

    unset -nocomplain appDomainId db fileName
  } -constraints {eagle command.object monoBug28 command.sql compile.DATA\
compile.ISOLATED_INTERPRETERS SQLite System.Data.SQLite} -isolationLevel \
AppDomain -match regexp -result {^\d+ \d+ True\
System#Data#SQLite#SQLiteConnection#\d+$}}
}

###############################################################################

unset -nocomplain i

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-baf42ee135.eagle.



































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
###############################################################################
#
# tkt-baf42ee135.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-baf42ee135-1.1 {GetSchemaTable, empty table name} -setup {
  setupDb [set fileName tkt-baf42ee135-1.1.db]
} -body {
  sql execute $db {
    CREATE TABLE ""(x);
  }

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db "SELECT x FROM \"\";"]

  set dataTable [$dataReader -alias GetSchemaTable]

  getRowsFromDataTable $dataTable
} -cleanup {
  unset -nocomplain dataTable dataReader

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{{ColumnName x} {ColumnOrdinal 0} {ColumnSize\
2147483647} NumericPrecision NumericScale {IsUnique False} {IsKey False}\
BaseServerName {BaseCatalogName main} {BaseColumnName x} {BaseSchemaName\
sqlite_default_schema} BaseTableName {DataType System.Object} {AllowDBNull\
True} {ProviderType 13} {IsAliased False} {IsExpression False} {IsAutoIncrement\
False} {IsRowVersion False} {IsHidden False} {IsLong False} {IsReadOnly False}\
ProviderSpecificDataType DefaultValue DataTypeName {CollationType BINARY}}}}

###############################################################################

runTest {test tkt-baf42ee135-1.2 {GetSchemaTable, via VIEW} -setup {
  setupDb [set fileName tkt-baf42ee135-1.2.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
    CREATE VIEW v1 AS SELECT * FROM t1;
  }

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db "SELECT * FROM v1;"]

  set dataTable [$dataReader -alias GetSchemaTable]

  getRowsFromDataTable $dataTable
} -cleanup {
  unset -nocomplain dataTable dataReader

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{{ColumnName x} {ColumnOrdinal 0} {ColumnSize\
2147483647} NumericPrecision NumericScale {IsUnique False} {IsKey False}\
BaseServerName {BaseCatalogName main} {BaseColumnName x} {BaseSchemaName\
sqlite_default_schema} {BaseTableName t1} {DataType System.Object} {AllowDBNull\
True} {ProviderType 13} {IsAliased False} {IsExpression False} {IsAutoIncrement\
False} {IsRowVersion False} {IsHidden False} {IsLong False} {IsReadOnly False}\
ProviderSpecificDataType DefaultValue DataTypeName {CollationType BINARY}}}}

###############################################################################

runTest {test tkt-baf42ee135-1.3 {GetSchemaTable, via VIEW} -setup {
  setupDb [set fileName tkt-baf42ee135-1.3.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
    CREATE VIEW v1 AS SELECT * FROM t1;
  }

  set connection [getDbConnection]

  set dataTable(1) [$connection -alias GetSchema COLUMNS]
  set dataTable(2) [$connection -alias GetSchema VIEWCOLUMNS]

  list [getRowsFromDataTable $dataTable(1)] \
     [getRowsFromDataTable $dataTable(2)]
} -cleanup {
  unset -nocomplain dataTable

  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{{{TABLE_CATALOG main} {TABLE_SCHEMA\
sqlite_default_schema} {TABLE_NAME t1} {COLUMN_NAME x} COLUMN_GUID\
COLUMN_PROPID {ORDINAL_POSITION 0} {COLUMN_HASDEFAULT False} COLUMN_DEFAULT\
COLUMN_FLAGS {IS_NULLABLE True} {DATA_TYPE {}} TYPE_GUID\
{CHARACTER_MAXIMUM_LENGTH 2147483647} CHARACTER_OCTET_LENGTH NUMERIC_PRECISION\
NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_CATALOG CHARACTER_SET_SCHEMA\
CHARACTER_SET_NAME COLLATION_CATALOG COLLATION_SCHEMA {COLLATION_NAME BINARY}\
DOMAIN_CATALOG DOMAIN_NAME DESCRIPTION {PRIMARY_KEY False} {EDM_TYPE {}}\
{AUTOINCREMENT False} {UNIQUE False}} {{TABLE_CATALOG main} {TABLE_SCHEMA\
sqlite_default_schema} {TABLE_NAME v1} {COLUMN_NAME x} COLUMN_GUID\
COLUMN_PROPID {ORDINAL_POSITION 0} {COLUMN_HASDEFAULT False} COLUMN_DEFAULT\
COLUMN_FLAGS {IS_NULLABLE True} {DATA_TYPE {}} TYPE_GUID\
{CHARACTER_MAXIMUM_LENGTH 2147483647} CHARACTER_OCTET_LENGTH NUMERIC_PRECISION\
NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_CATALOG CHARACTER_SET_SCHEMA\
CHARACTER_SET_NAME COLLATION_CATALOG COLLATION_SCHEMA {COLLATION_NAME BINARY}\
DOMAIN_CATALOG DOMAIN_NAME DESCRIPTION {PRIMARY_KEY False} {EDM_TYPE {}}\
{AUTOINCREMENT False} {UNIQUE False}}} {{{VIEW_CATALOG main} VIEW_SCHEMA\
{VIEW_NAME v1} {VIEW_COLUMN_NAME x} {TABLE_CATALOG main} {TABLE_SCHEMA\
sqlite_default_schema} {TABLE_NAME t1} {COLUMN_NAME x} {ORDINAL_POSITION 0}\
{COLUMN_HASDEFAULT False} COLUMN_DEFAULT COLUMN_FLAGS {IS_NULLABLE True}\
DATA_TYPE {CHARACTER_MAXIMUM_LENGTH 2147483647} NUMERIC_PRECISION NUMERIC_SCALE\
DATETIME_PRECISION CHARACTER_SET_CATALOG CHARACTER_SET_SCHEMA\
CHARACTER_SET_NAME COLLATION_CATALOG COLLATION_SCHEMA {COLLATION_NAME BINARY}\
{PRIMARY_KEY False} {EDM_TYPE {}} {AUTOINCREMENT False} {UNIQUE False}}}}}

###############################################################################

runTest {test tkt-baf42ee135-1.4 {GetSchemaTable, recursive CTE} -setup {
  setupDb [set fileName tkt-baf42ee135-1.4.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(
      c1 TEXT NOT NULL, c2 INTEGER NOT NULL, c3 INTEGER NOT NULL
    );

    CREATE VIEW v1 AS WITH RECURSIVE t2 AS(
      SELECT c2, c3, c1 FROM t1 UNION ALL
      SELECT c2 + 1, c3, c1 FROM t2 WHERE c2 < c3
    ) SELECT DISTINCT c1 AS c1, c2 AS c4 FROM t2;
  }

  set connection [getDbConnection]

  set dataTable(1) [$connection -alias GetSchema COLUMNS]
  set dataTable(2) [$connection -alias GetSchema VIEWCOLUMNS]

  list [getRowsFromDataTable $dataTable(1)] \
      [getRowsFromDataTable $dataTable(2)]
} -cleanup {
  unset -nocomplain dataTable

  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{{{TABLE_CATALOG main} {TABLE_SCHEMA\
sqlite_default_schema} {TABLE_NAME t1} {COLUMN_NAME c1} COLUMN_GUID\
COLUMN_PROPID {ORDINAL_POSITION 0} {COLUMN_HASDEFAULT False} COLUMN_DEFAULT\
COLUMN_FLAGS {IS_NULLABLE False} {DATA_TYPE text} TYPE_GUID\
{CHARACTER_MAXIMUM_LENGTH 2147483647} CHARACTER_OCTET_LENGTH NUMERIC_PRECISION\
NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_CATALOG CHARACTER_SET_SCHEMA\
CHARACTER_SET_NAME COLLATION_CATALOG COLLATION_SCHEMA {COLLATION_NAME BINARY}\
DOMAIN_CATALOG DOMAIN_NAME DESCRIPTION {PRIMARY_KEY False} {EDM_TYPE nvarchar}\
{AUTOINCREMENT False} {UNIQUE False}} {{TABLE_CATALOG main} {TABLE_SCHEMA\
sqlite_default_schema} {TABLE_NAME t1} {COLUMN_NAME c2} COLUMN_GUID\
COLUMN_PROPID {ORDINAL_POSITION 1} {COLUMN_HASDEFAULT False} COLUMN_DEFAULT\
COLUMN_FLAGS {IS_NULLABLE False} {DATA_TYPE integer} TYPE_GUID\
{CHARACTER_MAXIMUM_LENGTH 8} CHARACTER_OCTET_LENGTH {NUMERIC_PRECISION 19}\
{NUMERIC_SCALE 0} DATETIME_PRECISION CHARACTER_SET_CATALOG CHARACTER_SET_SCHEMA\
CHARACTER_SET_NAME COLLATION_CATALOG COLLATION_SCHEMA {COLLATION_NAME BINARY}\
DOMAIN_CATALOG DOMAIN_NAME DESCRIPTION {PRIMARY_KEY False} {EDM_TYPE integer}\
{AUTOINCREMENT False} {UNIQUE False}} {{TABLE_CATALOG main} {TABLE_SCHEMA\
sqlite_default_schema} {TABLE_NAME t1} {COLUMN_NAME c3} COLUMN_GUID\
COLUMN_PROPID {ORDINAL_POSITION 2} {COLUMN_HASDEFAULT False} COLUMN_DEFAULT\
COLUMN_FLAGS {IS_NULLABLE False} {DATA_TYPE integer} TYPE_GUID\
{CHARACTER_MAXIMUM_LENGTH 8} CHARACTER_OCTET_LENGTH {NUMERIC_PRECISION 19}\
{NUMERIC_SCALE 0} DATETIME_PRECISION CHARACTER_SET_CATALOG CHARACTER_SET_SCHEMA\
CHARACTER_SET_NAME COLLATION_CATALOG COLLATION_SCHEMA {COLLATION_NAME BINARY}\
DOMAIN_CATALOG DOMAIN_NAME DESCRIPTION {PRIMARY_KEY False} {EDM_TYPE integer}\
{AUTOINCREMENT False} {UNIQUE False}} {{TABLE_CATALOG main} {TABLE_SCHEMA\
sqlite_default_schema} {TABLE_NAME v1} {COLUMN_NAME c1} COLUMN_GUID\
COLUMN_PROPID {ORDINAL_POSITION 0} {COLUMN_HASDEFAULT False} COLUMN_DEFAULT\
COLUMN_FLAGS {IS_NULLABLE True} {DATA_TYPE text} TYPE_GUID\
{CHARACTER_MAXIMUM_LENGTH 2147483647} CHARACTER_OCTET_LENGTH NUMERIC_PRECISION\
NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_CATALOG CHARACTER_SET_SCHEMA\
CHARACTER_SET_NAME COLLATION_CATALOG COLLATION_SCHEMA COLLATION_NAME\
DOMAIN_CATALOG DOMAIN_NAME DESCRIPTION {PRIMARY_KEY False} {EDM_TYPE nvarchar}\
{AUTOINCREMENT False} {UNIQUE False}} {{TABLE_CATALOG main} {TABLE_SCHEMA\
sqlite_default_schema} {TABLE_NAME v1} {COLUMN_NAME c4} COLUMN_GUID\
COLUMN_PROPID {ORDINAL_POSITION 1} {COLUMN_HASDEFAULT False} COLUMN_DEFAULT\
COLUMN_FLAGS {IS_NULLABLE True} {DATA_TYPE {}} TYPE_GUID\
{CHARACTER_MAXIMUM_LENGTH 2147483647} CHARACTER_OCTET_LENGTH NUMERIC_PRECISION\
NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_CATALOG CHARACTER_SET_SCHEMA\
CHARACTER_SET_NAME COLLATION_CATALOG COLLATION_SCHEMA COLLATION_NAME\
DOMAIN_CATALOG DOMAIN_NAME DESCRIPTION {PRIMARY_KEY False} {EDM_TYPE {}}\
{AUTOINCREMENT False} {UNIQUE False}}} {{{VIEW_CATALOG main} VIEW_SCHEMA\
{VIEW_NAME v1} {VIEW_COLUMN_NAME c1} {TABLE_CATALOG main} {TABLE_SCHEMA\
sqlite_default_schema} {TABLE_NAME t2} {COLUMN_NAME c1} {ORDINAL_POSITION 0}\
{COLUMN_HASDEFAULT False} COLUMN_DEFAULT COLUMN_FLAGS {IS_NULLABLE True}\
{DATA_TYPE TEXT} {CHARACTER_MAXIMUM_LENGTH 2147483647} NUMERIC_PRECISION\
NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_CATALOG CHARACTER_SET_SCHEMA\
CHARACTER_SET_NAME COLLATION_CATALOG COLLATION_SCHEMA COLLATION_NAME\
{PRIMARY_KEY False} {EDM_TYPE nvarchar} {AUTOINCREMENT False} {UNIQUE False}}\
{{VIEW_CATALOG main} VIEW_SCHEMA {VIEW_NAME v1} {VIEW_COLUMN_NAME c4}\
{TABLE_CATALOG main} {TABLE_SCHEMA sqlite_default_schema} TABLE_NAME\
COLUMN_NAME {ORDINAL_POSITION 1} {COLUMN_HASDEFAULT False} COLUMN_DEFAULT\
COLUMN_FLAGS {IS_NULLABLE True} DATA_TYPE {CHARACTER_MAXIMUM_LENGTH 2147483647}\
NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_CATALOG\
CHARACTER_SET_SCHEMA CHARACTER_SET_NAME COLLATION_CATALOG COLLATION_SCHEMA\
COLLATION_NAME {PRIMARY_KEY False} {EDM_TYPE {}} {AUTOINCREMENT False} {UNIQUE\
False}}}}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-bb4b04d457.eagle.

































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
###############################################################################
#
# tkt-bb4b04d457.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-bb4b04d457-1.1 {TIMESTAMP column with Ticks} -setup {
  setupDb [set fileName tkt-bb4b04d457-1.1.db] "" Ticks Utc
} -body {
  set dateTime [object invoke \
      -create -alias DateTime Parse 2011-11-29T12:34:56Z]

  set dateTime [$dateTime -create -alias ToUniversalTime]

  sql execute $db "CREATE TABLE t1(x TIMESTAMP NOT NULL);"

  sql execute $db "INSERT INTO t1 (x) VALUES(?);" \
      [list param1 Int64 [$dateTime Ticks]]

  sql execute -execute reader -format list -datetimeformat \
      [getDateTimeFormat] $db "SELECT x FROM t1 ORDER BY rowid;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain dateTime db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{2011-11-29 12:34:56Z}}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-bbddfeb773.eagle.











































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
###############################################################################
#
# tkt-bbddfeb773.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-bbddfeb773-1.1 {avoid milliseconds rounding} -setup {
  setupDb [set fileName tkt-bbddfeb773-1.1.db] "" UnixEpoch
} -body {
  sql execute $db {
    CREATE TABLE t1(x);

    INSERT INTO t1 (x) VALUES(-1);
    INSERT INTO t1 (x) VALUES(0);
    INSERT INTO t1 (x) VALUES(1);

    CREATE TABLE t2(x DATETIME);

    INSERT INTO t2 (x) VALUES(-1);
    INSERT INTO t2 (x) VALUES(0);
    INSERT INTO t2 (x) VALUES(1);
  }

  set minimum(1) [object invoke \
      -create -alias DateTime MinValue]

  set maximum(1) [object invoke \
      -create -alias DateTime MaxValue]

  set minimum(2) [object invoke \
      -create -alias DateTime SpecifyKind $minimum(1) Utc]

  set maximum(2) [object invoke \
      -create -alias DateTime SpecifyKind $maximum(1) Utc]

  sql execute $db "INSERT INTO t1 (x) VALUES (?);" \
      [list param1 DateTime $minimum(1)]

  sql execute $db "INSERT INTO t2 (x) VALUES (?);" \
      [list param1 DateTime $minimum(1)]

  sql execute $db "INSERT INTO t1 (x) VALUES (?);" \
      [list param1 DateTime $minimum(2)]

  sql execute $db "INSERT INTO t2 (x) VALUES (?);" \
      [list param1 DateTime $minimum(2)]

  sql execute $db "INSERT INTO t1 (x) VALUES (?);" \
      [list param1 DateTime $maximum(1)]

  sql execute $db "INSERT INTO t2 (x) VALUES (?);" \
      [list param1 DateTime $maximum(1)]

  sql execute $db "INSERT INTO t1 (x) VALUES (?);" \
      [list param1 DateTime $maximum(2)]

  sql execute $db "INSERT INTO t2 (x) VALUES (?);" \
      [list param1 DateTime $maximum(2)]

  list [sql execute -execute reader -format list -datetimeformat \
      [getDateTimeFormat true] $db "SELECT x FROM t1 ORDER BY x;"] \
      [sql execute -execute reader -format list -datetimeformat \
      [getDateTimeFormat true] $db "SELECT x FROM t1 ORDER BY x;"] \
      [sql execute -execute reader -format list -datetimeformat \
      [getDateTimeFormat true] $db "SELECT x FROM t2 ORDER BY x;"] \
      [sql execute -execute reader -format list -datetimeformat \
      [getDateTimeFormat true] $db "SELECT x FROM t2 ORDER BY x;"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName minimum maximum
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{-62135596800 -62135596800 -1 0 1 253402300799\
253402300799} {-62135596800 -62135596800 -1 0 1 253402300799 253402300799}\
{{0001-01-01 00:00:00.0000000} {0001-01-01 00:00:00.0000000} {1969-12-31\
23:59:59.0000000} {1970-01-01 00:00:00.0000000} {1970-01-01 00:00:01.0000000}\
{9999-12-31 23:59:59.0000000} {9999-12-31 23:59:59.0000000}} {{0001-01-01\
00:00:00.0000000} {0001-01-01 00:00:00.0000000} {1969-12-31 23:59:59.0000000}\
{1970-01-01 00:00:00.0000000} {1970-01-01 00:00:01.0000000} {9999-12-31\
23:59:59.0000000} {9999-12-31 23:59:59.0000000}}}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-c010fa6584.eagle.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
###############################################################################
#
# tkt-c010fa6584.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-c010fa6584-1.1 {column "integral" type handling} -setup {
  setupDb [set fileName tkt-c010fa6584-1.1.db]
} -body {
  #
  # NOTE: Create a database table with all the integral type names that are
  #       recognized by System.Data.SQLite.  Subsequently, each column will
  #       be tested against a list of values that meet and/or exceed the
  #       bounds for the underlying primitive integral CLR type.
  #
  sql execute $db {
    CREATE TABLE t1(
      a00 SYSNAME,           -- This is the 'payload' column name.
      a01,                   -- String
      a02 TEXT,              -- String
      a03 BIGINT,            -- Int64
      a04 BIGUINT,           -- UInt64
      a05 COUNTER,           -- Int64
      a06 IDENTITY,          -- Int64
      a07 INT,               -- Int32
      a08 INT8,              -- SByte
      a09 INT16,             -- Int16
      a10 INT32,             -- Int32
      a11 INT64,             -- Int64
      a12 INTEGER,           -- Int64
      a13 INTEGER8,          -- SByte
      a14 INTEGER16,         -- Int16
      a15 INTEGER32,         -- Int32
      a16 INTEGER64,         -- Int64
      a17 LONG,              -- Int64
      a18 MEDIUMINT,         -- Int32
      a19 MEDIUMUINT,        -- UInt32
      a20 SMALLINT,          -- Int16
      a21 SMALLUINT,         -- UInt16
      a22 TINYINT,           -- Byte
      a23 TINYSINT,          -- SByte
      a24 UINT,              -- UInt32
      a25 UINT8,             -- Byte
      a26 UINT16,            -- UInt16
      a27 UINT32,            -- UInt32
      a28 UINT64,            -- UInt64
      a29 ULONG,             -- UInt64
      a30 UNSIGNEDINTEGER,   -- UInt32
      a31 UNSIGNEDINTEGER8,  -- Byte
      a32 UNSIGNEDINTEGER16, -- UInt16
      a33 UNSIGNEDINTEGER32, -- UInt32
      a34 UNSIGNEDINTEGER64  -- UInt64
    );
  }

  #
  # NOTE: These are the numeric values being tested against all the types in
  #       the database table defined above.  This list includes values that
  #       are out-of-bounds for each primitive integral type.
  #
  set values [list \
      -9223372036854775809 -9223372036854775808 \
      -2147483649 -2147483648 \
      -32769 -32768 \
      -129 -128 \
      -1 0 1 \
      127 128 \
      255 256 \
      32767 32768 \
      65535 65536 \
      2147483647 2147483648 \
      4294967295 4294967296 \
      9223372036854775807 9223372036854775808 \
      18446744073709551615 18446744073709551616]

  for {set index 1} {$index <= 34} {incr index} {
    set name [appendArgs a [format %02d $index]]
    foreach value $values {
      sql execute $db [subst {
        INSERT INTO t1 (a00, $name) VALUES('$name', $value);
      }]
    }
  }

  set results [list]

  for {set index 1} {$index <= 34} {incr index} {
    set name [appendArgs a [format %02d $index]]
    set count [sql execute -execute scalar $db [subst {
      SELECT COUNT(*) FROM t1 WHERE a00 = '$name';
    }]]
    for {set offset 0} {$offset < $count} {incr offset} {
      set code [catch {
        sql execute -execute scalar $db [subst {
          SELECT $name FROM t1 WHERE a00 = '$name' LIMIT 1 OFFSET $offset;
        }]
      } result]

      set match [expr {$result eq [lindex $values $offset]}]

      append results [list \
          $name $offset $match [lindex $values $offset] \
          $code [expr {$code == 0 ? $result : $errorCode}]] \n
    }
  }

  set results
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain match result code offset count results value name index \
      values db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result {^a01 0 False -9223372036854775809 0\
(?:-9\.22337203685478E\+18|-9\.223372036854776E\+18)
a01 1 True -9223372036854775808 0 -9223372036854775808
a01 2 True -2147483649 0 -2147483649
a01 3 True -2147483648 0 -2147483648
a01 4 True -32769 0 -32769
a01 5 True -32768 0 -32768
a01 6 True -129 0 -129
a01 7 True -128 0 -128
a01 8 True -1 0 -1
a01 9 True 0 0 0
a01 10 True 1 0 1
a01 11 True 127 0 127
a01 12 True 128 0 128
a01 13 True 255 0 255
a01 14 True 256 0 256
a01 15 True 32767 0 32767
a01 16 True 32768 0 32768
a01 17 True 65535 0 65535
a01 18 True 65536 0 65536
a01 19 True 2147483647 0 2147483647
a01 20 True 2147483648 0 2147483648
a01 21 True 4294967295 0 4294967295
a01 22 True 4294967296 0 4294967296
a01 23 True 9223372036854775807 0 9223372036854775807
a01 24 False 9223372036854775808 0\
(?:9\.22337203685478E\+18|9\.223372036854776E\+18)
a01 25 False 18446744073709551615 0\
(?:1\.84467440737096E\+19|1\.8446744073709552E\+19)
a01 26 False 18446744073709551616 0\
(?:1\.84467440737096E\+19|1\.8446744073709552E\+19)
a02 0 False -9223372036854775809 0 -9\.22337203685478e\+18
a02 1 True -9223372036854775808 0 -9223372036854775808
a02 2 True -2147483649 0 -2147483649
a02 3 True -2147483648 0 -2147483648
a02 4 True -32769 0 -32769
a02 5 True -32768 0 -32768
a02 6 True -129 0 -129
a02 7 True -128 0 -128
a02 8 True -1 0 -1
a02 9 True 0 0 0
a02 10 True 1 0 1
a02 11 True 127 0 127
a02 12 True 128 0 128
a02 13 True 255 0 255
a02 14 True 256 0 256
a02 15 True 32767 0 32767
a02 16 True 32768 0 32768
a02 17 True 65535 0 65535
a02 18 True 65536 0 65536
a02 19 True 2147483647 0 2147483647
a02 20 True 2147483648 0 2147483648
a02 21 True 4294967295 0 4294967295
a02 22 True 4294967296 0 4294967296
a02 23 True 9223372036854775807 0 9223372036854775807
a02 24 False 9223372036854775808 0 9\.22337203685478e\+18
a02 25 False 18446744073709551615 0 1\.84467440737096e\+19
a02 26 False 18446744073709551616 0 1\.84467440737096e\+19
a03 0 False -9223372036854775809 0 -9223372036854775808
a03 1 True -9223372036854775808 0 -9223372036854775808
a03 2 True -2147483649 0 -2147483649
a03 3 True -2147483648 0 -2147483648
a03 4 True -32769 0 -32769
a03 5 True -32768 0 -32768
a03 6 True -129 0 -129
a03 7 True -128 0 -128
a03 8 True -1 0 -1
a03 9 True 0 0 0
a03 10 True 1 0 1
a03 11 True 127 0 127
a03 12 True 128 0 128
a03 13 True 255 0 255
a03 14 True 256 0 256
a03 15 True 32767 0 32767
a03 16 True 32768 0 32768
a03 17 True 65535 0 65535
a03 18 True 65536 0 65536
a03 19 True 2147483647 0 2147483647
a03 20 True 2147483648 0 2147483648
a03 21 True 4294967295 0 4294967295
a03 22 True 4294967296 0 4294967296
a03 23 True 9223372036854775807 0 9223372036854775807
a03 24 False 9223372036854775808 0 9223372036854775807
a03 25 False 18446744073709551615 0 9223372036854775807
a03 26 False 18446744073709551616 0 9223372036854775807
a04 0 False -9223372036854775809 0 9223372036854775808
a04 1 False -9223372036854775808 0 9223372036854775808
a04 2 False -2147483649 0 18446744071562067967
a04 3 False -2147483648 0 18446744071562067968
a04 4 False -32769 0 18446744073709518847
a04 5 False -32768 0 18446744073709518848
a04 6 False -129 0 18446744073709551487
a04 7 False -128 0 18446744073709551488
a04 8 False -1 0 18446744073709551615
a04 9 True 0 0 0
a04 10 True 1 0 1
a04 11 True 127 0 127
a04 12 True 128 0 128
a04 13 True 255 0 255
a04 14 True 256 0 256
a04 15 True 32767 0 32767
a04 16 True 32768 0 32768
a04 17 True 65535 0 65535
a04 18 True 65536 0 65536
a04 19 True 2147483647 0 2147483647
a04 20 True 2147483648 0 2147483648
a04 21 True 4294967295 0 4294967295
a04 22 True 4294967296 0 4294967296
a04 23 True 9223372036854775807 0 9223372036854775807
a04 24 False 9223372036854775808 0 9223372036854775807
a04 25 False 18446744073709551615 0 9223372036854775807
a04 26 False 18446744073709551616 0 9223372036854775807
a05 0 False -9223372036854775809 0 -9223372036854775808
a05 1 True -9223372036854775808 0 -9223372036854775808
a05 2 True -2147483649 0 -2147483649
a05 3 True -2147483648 0 -2147483648
a05 4 True -32769 0 -32769
a05 5 True -32768 0 -32768
a05 6 True -129 0 -129
a05 7 True -128 0 -128
a05 8 True -1 0 -1
a05 9 True 0 0 0
a05 10 True 1 0 1
a05 11 True 127 0 127
a05 12 True 128 0 128
a05 13 True 255 0 255
a05 14 True 256 0 256
a05 15 True 32767 0 32767
a05 16 True 32768 0 32768
a05 17 True 65535 0 65535
a05 18 True 65536 0 65536
a05 19 True 2147483647 0 2147483647
a05 20 True 2147483648 0 2147483648
a05 21 True 4294967295 0 4294967295
a05 22 True 4294967296 0 4294967296
a05 23 True 9223372036854775807 0 9223372036854775807
a05 24 False 9223372036854775808 0 9223372036854775807
a05 25 False 18446744073709551615 0 9223372036854775807
a05 26 False 18446744073709551616 0 9223372036854775807
a06 0 False -9223372036854775809 0 -9223372036854775808
a06 1 True -9223372036854775808 0 -9223372036854775808
a06 2 True -2147483649 0 -2147483649
a06 3 True -2147483648 0 -2147483648
a06 4 True -32769 0 -32769
a06 5 True -32768 0 -32768
a06 6 True -129 0 -129
a06 7 True -128 0 -128
a06 8 True -1 0 -1
a06 9 True 0 0 0
a06 10 True 1 0 1
a06 11 True 127 0 127
a06 12 True 128 0 128
a06 13 True 255 0 255
a06 14 True 256 0 256
a06 15 True 32767 0 32767
a06 16 True 32768 0 32768
a06 17 True 65535 0 65535
a06 18 True 65536 0 65536
a06 19 True 2147483647 0 2147483647
a06 20 True 2147483648 0 2147483648
a06 21 True 4294967295 0 4294967295
a06 22 True 4294967296 0 4294967296
a06 23 True 9223372036854775807 0 9223372036854775807
a06 24 False 9223372036854775808 0 9223372036854775807
a06 25 False 18446744073709551615 0 9223372036854775807
a06 26 False 18446744073709551616 0 9223372036854775807
a07 0 False -9223372036854775809 0 0
a07 1 False -9223372036854775808 0 0
a07 2 False -2147483649 0 2147483647
a07 3 True -2147483648 0 -2147483648
a07 4 True -32769 0 -32769
a07 5 True -32768 0 -32768
a07 6 True -129 0 -129
a07 7 True -128 0 -128
a07 8 True -1 0 -1
a07 9 True 0 0 0
a07 10 True 1 0 1
a07 11 True 127 0 127
a07 12 True 128 0 128
a07 13 True 255 0 255
a07 14 True 256 0 256
a07 15 True 32767 0 32767
a07 16 True 32768 0 32768
a07 17 True 65535 0 65535
a07 18 True 65536 0 65536
a07 19 True 2147483647 0 2147483647
a07 20 False 2147483648 0 -2147483648
a07 21 False 4294967295 0 -1
a07 22 False 4294967296 0 0
a07 23 False 9223372036854775807 0 -1
a07 24 False 9223372036854775808 0 -1
a07 25 False 18446744073709551615 0 -1
a07 26 False 18446744073709551616 0 -1
a08 0 False -9223372036854775809 0 0
a08 1 False -9223372036854775808 0 0
a08 2 False -2147483649 0 -1
a08 3 False -2147483648 0 0
a08 4 False -32769 0 -1
a08 5 False -32768 0 0
a08 6 False -129 0 127
a08 7 True -128 0 -128
a08 8 True -1 0 -1
a08 9 True 0 0 0
a08 10 True 1 0 1
a08 11 True 127 0 127
a08 12 False 128 0 -128
a08 13 False 255 0 -1
a08 14 False 256 0 0
a08 15 False 32767 0 -1
a08 16 False 32768 0 0
a08 17 False 65535 0 -1
a08 18 False 65536 0 0
a08 19 False 2147483647 0 -1
a08 20 False 2147483648 0 0
a08 21 False 4294967295 0 -1
a08 22 False 4294967296 0 0
a08 23 False 9223372036854775807 0 -1
a08 24 False 9223372036854775808 0 -1
a08 25 False 18446744073709551615 0 -1
a08 26 False 18446744073709551616 0 -1
a09 0 False -9223372036854775809 0 0
a09 1 False -9223372036854775808 0 0
a09 2 False -2147483649 0 -1
a09 3 False -2147483648 0 0
a09 4 False -32769 0 32767
a09 5 True -32768 0 -32768
a09 6 True -129 0 -129
a09 7 True -128 0 -128
a09 8 True -1 0 -1
a09 9 True 0 0 0
a09 10 True 1 0 1
a09 11 True 127 0 127
a09 12 True 128 0 128
a09 13 True 255 0 255
a09 14 True 256 0 256
a09 15 True 32767 0 32767
a09 16 False 32768 0 -32768
a09 17 False 65535 0 -1
a09 18 False 65536 0 0
a09 19 False 2147483647 0 -1
a09 20 False 2147483648 0 0
a09 21 False 4294967295 0 -1
a09 22 False 4294967296 0 0
a09 23 False 9223372036854775807 0 -1
a09 24 False 9223372036854775808 0 -1
a09 25 False 18446744073709551615 0 -1
a09 26 False 18446744073709551616 0 -1
a10 0 False -9223372036854775809 0 0
a10 1 False -9223372036854775808 0 0
a10 2 False -2147483649 0 2147483647
a10 3 True -2147483648 0 -2147483648
a10 4 True -32769 0 -32769
a10 5 True -32768 0 -32768
a10 6 True -129 0 -129
a10 7 True -128 0 -128
a10 8 True -1 0 -1
a10 9 True 0 0 0
a10 10 True 1 0 1
a10 11 True 127 0 127
a10 12 True 128 0 128
a10 13 True 255 0 255
a10 14 True 256 0 256
a10 15 True 32767 0 32767
a10 16 True 32768 0 32768
a10 17 True 65535 0 65535
a10 18 True 65536 0 65536
a10 19 True 2147483647 0 2147483647
a10 20 False 2147483648 0 -2147483648
a10 21 False 4294967295 0 -1
a10 22 False 4294967296 0 0
a10 23 False 9223372036854775807 0 -1
a10 24 False 9223372036854775808 0 -1
a10 25 False 18446744073709551615 0 -1
a10 26 False 18446744073709551616 0 -1
a11 0 False -9223372036854775809 0 -9223372036854775808
a11 1 True -9223372036854775808 0 -9223372036854775808
a11 2 True -2147483649 0 -2147483649
a11 3 True -2147483648 0 -2147483648
a11 4 True -32769 0 -32769
a11 5 True -32768 0 -32768
a11 6 True -129 0 -129
a11 7 True -128 0 -128
a11 8 True -1 0 -1
a11 9 True 0 0 0
a11 10 True 1 0 1
a11 11 True 127 0 127
a11 12 True 128 0 128
a11 13 True 255 0 255
a11 14 True 256 0 256
a11 15 True 32767 0 32767
a11 16 True 32768 0 32768
a11 17 True 65535 0 65535
a11 18 True 65536 0 65536
a11 19 True 2147483647 0 2147483647
a11 20 True 2147483648 0 2147483648
a11 21 True 4294967295 0 4294967295
a11 22 True 4294967296 0 4294967296
a11 23 True 9223372036854775807 0 9223372036854775807
a11 24 False 9223372036854775808 0 9223372036854775807
a11 25 False 18446744073709551615 0 9223372036854775807
a11 26 False 18446744073709551616 0 9223372036854775807
a12 0 False -9223372036854775809 0 -9223372036854775808
a12 1 True -9223372036854775808 0 -9223372036854775808
a12 2 True -2147483649 0 -2147483649
a12 3 True -2147483648 0 -2147483648
a12 4 True -32769 0 -32769
a12 5 True -32768 0 -32768
a12 6 True -129 0 -129
a12 7 True -128 0 -128
a12 8 True -1 0 -1
a12 9 True 0 0 0
a12 10 True 1 0 1
a12 11 True 127 0 127
a12 12 True 128 0 128
a12 13 True 255 0 255
a12 14 True 256 0 256
a12 15 True 32767 0 32767
a12 16 True 32768 0 32768
a12 17 True 65535 0 65535
a12 18 True 65536 0 65536
a12 19 True 2147483647 0 2147483647
a12 20 True 2147483648 0 2147483648
a12 21 True 4294967295 0 4294967295
a12 22 True 4294967296 0 4294967296
a12 23 True 9223372036854775807 0 9223372036854775807
a12 24 False 9223372036854775808 0 9223372036854775807
a12 25 False 18446744073709551615 0 9223372036854775807
a12 26 False 18446744073709551616 0 9223372036854775807
a13 0 False -9223372036854775809 0 0
a13 1 False -9223372036854775808 0 0
a13 2 False -2147483649 0 -1
a13 3 False -2147483648 0 0
a13 4 False -32769 0 -1
a13 5 False -32768 0 0
a13 6 False -129 0 127
a13 7 True -128 0 -128
a13 8 True -1 0 -1
a13 9 True 0 0 0
a13 10 True 1 0 1
a13 11 True 127 0 127
a13 12 False 128 0 -128
a13 13 False 255 0 -1
a13 14 False 256 0 0
a13 15 False 32767 0 -1
a13 16 False 32768 0 0
a13 17 False 65535 0 -1
a13 18 False 65536 0 0
a13 19 False 2147483647 0 -1
a13 20 False 2147483648 0 0
a13 21 False 4294967295 0 -1
a13 22 False 4294967296 0 0
a13 23 False 9223372036854775807 0 -1
a13 24 False 9223372036854775808 0 -1
a13 25 False 18446744073709551615 0 -1
a13 26 False 18446744073709551616 0 -1
a14 0 False -9223372036854775809 0 0
a14 1 False -9223372036854775808 0 0
a14 2 False -2147483649 0 -1
a14 3 False -2147483648 0 0
a14 4 False -32769 0 32767
a14 5 True -32768 0 -32768
a14 6 True -129 0 -129
a14 7 True -128 0 -128
a14 8 True -1 0 -1
a14 9 True 0 0 0
a14 10 True 1 0 1
a14 11 True 127 0 127
a14 12 True 128 0 128
a14 13 True 255 0 255
a14 14 True 256 0 256
a14 15 True 32767 0 32767
a14 16 False 32768 0 -32768
a14 17 False 65535 0 -1
a14 18 False 65536 0 0
a14 19 False 2147483647 0 -1
a14 20 False 2147483648 0 0
a14 21 False 4294967295 0 -1
a14 22 False 4294967296 0 0
a14 23 False 9223372036854775807 0 -1
a14 24 False 9223372036854775808 0 -1
a14 25 False 18446744073709551615 0 -1
a14 26 False 18446744073709551616 0 -1
a15 0 False -9223372036854775809 0 0
a15 1 False -9223372036854775808 0 0
a15 2 False -2147483649 0 2147483647
a15 3 True -2147483648 0 -2147483648
a15 4 True -32769 0 -32769
a15 5 True -32768 0 -32768
a15 6 True -129 0 -129
a15 7 True -128 0 -128
a15 8 True -1 0 -1
a15 9 True 0 0 0
a15 10 True 1 0 1
a15 11 True 127 0 127
a15 12 True 128 0 128
a15 13 True 255 0 255
a15 14 True 256 0 256
a15 15 True 32767 0 32767
a15 16 True 32768 0 32768
a15 17 True 65535 0 65535
a15 18 True 65536 0 65536
a15 19 True 2147483647 0 2147483647
a15 20 False 2147483648 0 -2147483648
a15 21 False 4294967295 0 -1
a15 22 False 4294967296 0 0
a15 23 False 9223372036854775807 0 -1
a15 24 False 9223372036854775808 0 -1
a15 25 False 18446744073709551615 0 -1
a15 26 False 18446744073709551616 0 -1
a16 0 False -9223372036854775809 0 -9223372036854775808
a16 1 True -9223372036854775808 0 -9223372036854775808
a16 2 True -2147483649 0 -2147483649
a16 3 True -2147483648 0 -2147483648
a16 4 True -32769 0 -32769
a16 5 True -32768 0 -32768
a16 6 True -129 0 -129
a16 7 True -128 0 -128
a16 8 True -1 0 -1
a16 9 True 0 0 0
a16 10 True 1 0 1
a16 11 True 127 0 127
a16 12 True 128 0 128
a16 13 True 255 0 255
a16 14 True 256 0 256
a16 15 True 32767 0 32767
a16 16 True 32768 0 32768
a16 17 True 65535 0 65535
a16 18 True 65536 0 65536
a16 19 True 2147483647 0 2147483647
a16 20 True 2147483648 0 2147483648
a16 21 True 4294967295 0 4294967295
a16 22 True 4294967296 0 4294967296
a16 23 True 9223372036854775807 0 9223372036854775807
a16 24 False 9223372036854775808 0 9223372036854775807
a16 25 False 18446744073709551615 0 9223372036854775807
a16 26 False 18446744073709551616 0 9223372036854775807
a17 0 False -9223372036854775809 0 -9223372036854775808
a17 1 True -9223372036854775808 0 -9223372036854775808
a17 2 True -2147483649 0 -2147483649
a17 3 True -2147483648 0 -2147483648
a17 4 True -32769 0 -32769
a17 5 True -32768 0 -32768
a17 6 True -129 0 -129
a17 7 True -128 0 -128
a17 8 True -1 0 -1
a17 9 True 0 0 0
a17 10 True 1 0 1
a17 11 True 127 0 127
a17 12 True 128 0 128
a17 13 True 255 0 255
a17 14 True 256 0 256
a17 15 True 32767 0 32767
a17 16 True 32768 0 32768
a17 17 True 65535 0 65535
a17 18 True 65536 0 65536
a17 19 True 2147483647 0 2147483647
a17 20 True 2147483648 0 2147483648
a17 21 True 4294967295 0 4294967295
a17 22 True 4294967296 0 4294967296
a17 23 True 9223372036854775807 0 9223372036854775807
a17 24 False 9223372036854775808 0 9223372036854775807
a17 25 False 18446744073709551615 0 9223372036854775807
a17 26 False 18446744073709551616 0 9223372036854775807
a18 0 False -9223372036854775809 0 0
a18 1 False -9223372036854775808 0 0
a18 2 False -2147483649 0 2147483647
a18 3 True -2147483648 0 -2147483648
a18 4 True -32769 0 -32769
a18 5 True -32768 0 -32768
a18 6 True -129 0 -129
a18 7 True -128 0 -128
a18 8 True -1 0 -1
a18 9 True 0 0 0
a18 10 True 1 0 1
a18 11 True 127 0 127
a18 12 True 128 0 128
a18 13 True 255 0 255
a18 14 True 256 0 256
a18 15 True 32767 0 32767
a18 16 True 32768 0 32768
a18 17 True 65535 0 65535
a18 18 True 65536 0 65536
a18 19 True 2147483647 0 2147483647
a18 20 False 2147483648 0 -2147483648
a18 21 False 4294967295 0 -1
a18 22 False 4294967296 0 0
a18 23 False 9223372036854775807 0 -1
a18 24 False 9223372036854775808 0 -1
a18 25 False 18446744073709551615 0 -1
a18 26 False 18446744073709551616 0 -1
a19 0 False -9223372036854775809 0 0
a19 1 False -9223372036854775808 0 0
a19 2 False -2147483649 0 2147483647
a19 3 False -2147483648 0 2147483648
a19 4 False -32769 0 4294934527
a19 5 False -32768 0 4294934528
a19 6 False -129 0 4294967167
a19 7 False -128 0 4294967168
a19 8 False -1 0 4294967295
a19 9 True 0 0 0
a19 10 True 1 0 1
a19 11 True 127 0 127
a19 12 True 128 0 128
a19 13 True 255 0 255
a19 14 True 256 0 256
a19 15 True 32767 0 32767
a19 16 True 32768 0 32768
a19 17 True 65535 0 65535
a19 18 True 65536 0 65536
a19 19 True 2147483647 0 2147483647
a19 20 True 2147483648 0 2147483648
a19 21 True 4294967295 0 4294967295
a19 22 False 4294967296 0 0
a19 23 False 9223372036854775807 0 4294967295
a19 24 False 9223372036854775808 0 4294967295
a19 25 False 18446744073709551615 0 4294967295
a19 26 False 18446744073709551616 0 4294967295
a20 0 False -9223372036854775809 0 0
a20 1 False -9223372036854775808 0 0
a20 2 False -2147483649 0 -1
a20 3 False -2147483648 0 0
a20 4 False -32769 0 32767
a20 5 True -32768 0 -32768
a20 6 True -129 0 -129
a20 7 True -128 0 -128
a20 8 True -1 0 -1
a20 9 True 0 0 0
a20 10 True 1 0 1
a20 11 True 127 0 127
a20 12 True 128 0 128
a20 13 True 255 0 255
a20 14 True 256 0 256
a20 15 True 32767 0 32767
a20 16 False 32768 0 -32768
a20 17 False 65535 0 -1
a20 18 False 65536 0 0
a20 19 False 2147483647 0 -1
a20 20 False 2147483648 0 0
a20 21 False 4294967295 0 -1
a20 22 False 4294967296 0 0
a20 23 False 9223372036854775807 0 -1
a20 24 False 9223372036854775808 0 -1
a20 25 False 18446744073709551615 0 -1
a20 26 False 18446744073709551616 0 -1
a21 0 False -9223372036854775809 0 0
a21 1 False -9223372036854775808 0 0
a21 2 False -2147483649 0 65535
a21 3 False -2147483648 0 0
a21 4 False -32769 0 32767
a21 5 False -32768 0 32768
a21 6 False -129 0 65407
a21 7 False -128 0 65408
a21 8 False -1 0 65535
a21 9 True 0 0 0
a21 10 True 1 0 1
a21 11 True 127 0 127
a21 12 True 128 0 128
a21 13 True 255 0 255
a21 14 True 256 0 256
a21 15 True 32767 0 32767
a21 16 True 32768 0 32768
a21 17 True 65535 0 65535
a21 18 False 65536 0 0
a21 19 False 2147483647 0 65535
a21 20 False 2147483648 0 0
a21 21 False 4294967295 0 65535
a21 22 False 4294967296 0 0
a21 23 False 9223372036854775807 0 65535
a21 24 False 9223372036854775808 0 65535
a21 25 False 18446744073709551615 0 65535
a21 26 False 18446744073709551616 0 65535
a22 0 False -9223372036854775809 0 0
a22 1 False -9223372036854775808 0 0
a22 2 False -2147483649 0 255
a22 3 False -2147483648 0 0
a22 4 False -32769 0 255
a22 5 False -32768 0 0
a22 6 False -129 0 127
a22 7 False -128 0 128
a22 8 False -1 0 255
a22 9 True 0 0 0
a22 10 True 1 0 1
a22 11 True 127 0 127
a22 12 True 128 0 128
a22 13 True 255 0 255
a22 14 False 256 0 0
a22 15 False 32767 0 255
a22 16 False 32768 0 0
a22 17 False 65535 0 255
a22 18 False 65536 0 0
a22 19 False 2147483647 0 255
a22 20 False 2147483648 0 0
a22 21 False 4294967295 0 255
a22 22 False 4294967296 0 0
a22 23 False 9223372036854775807 0 255
a22 24 False 9223372036854775808 0 255
a22 25 False 18446744073709551615 0 255
a22 26 False 18446744073709551616 0 255
a23 0 False -9223372036854775809 0 0
a23 1 False -9223372036854775808 0 0
a23 2 False -2147483649 0 -1
a23 3 False -2147483648 0 0
a23 4 False -32769 0 -1
a23 5 False -32768 0 0
a23 6 False -129 0 127
a23 7 True -128 0 -128
a23 8 True -1 0 -1
a23 9 True 0 0 0
a23 10 True 1 0 1
a23 11 True 127 0 127
a23 12 False 128 0 -128
a23 13 False 255 0 -1
a23 14 False 256 0 0
a23 15 False 32767 0 -1
a23 16 False 32768 0 0
a23 17 False 65535 0 -1
a23 18 False 65536 0 0
a23 19 False 2147483647 0 -1
a23 20 False 2147483648 0 0
a23 21 False 4294967295 0 -1
a23 22 False 4294967296 0 0
a23 23 False 9223372036854775807 0 -1
a23 24 False 9223372036854775808 0 -1
a23 25 False 18446744073709551615 0 -1
a23 26 False 18446744073709551616 0 -1
a24 0 False -9223372036854775809 0 0
a24 1 False -9223372036854775808 0 0
a24 2 False -2147483649 0 2147483647
a24 3 False -2147483648 0 2147483648
a24 4 False -32769 0 4294934527
a24 5 False -32768 0 4294934528
a24 6 False -129 0 4294967167
a24 7 False -128 0 4294967168
a24 8 False -1 0 4294967295
a24 9 True 0 0 0
a24 10 True 1 0 1
a24 11 True 127 0 127
a24 12 True 128 0 128
a24 13 True 255 0 255
a24 14 True 256 0 256
a24 15 True 32767 0 32767
a24 16 True 32768 0 32768
a24 17 True 65535 0 65535
a24 18 True 65536 0 65536
a24 19 True 2147483647 0 2147483647
a24 20 True 2147483648 0 2147483648
a24 21 True 4294967295 0 4294967295
a24 22 False 4294967296 0 0
a24 23 False 9223372036854775807 0 4294967295
a24 24 False 9223372036854775808 0 4294967295
a24 25 False 18446744073709551615 0 4294967295
a24 26 False 18446744073709551616 0 4294967295
a25 0 False -9223372036854775809 0 0
a25 1 False -9223372036854775808 0 0
a25 2 False -2147483649 0 255
a25 3 False -2147483648 0 0
a25 4 False -32769 0 255
a25 5 False -32768 0 0
a25 6 False -129 0 127
a25 7 False -128 0 128
a25 8 False -1 0 255
a25 9 True 0 0 0
a25 10 True 1 0 1
a25 11 True 127 0 127
a25 12 True 128 0 128
a25 13 True 255 0 255
a25 14 False 256 0 0
a25 15 False 32767 0 255
a25 16 False 32768 0 0
a25 17 False 65535 0 255
a25 18 False 65536 0 0
a25 19 False 2147483647 0 255
a25 20 False 2147483648 0 0
a25 21 False 4294967295 0 255
a25 22 False 4294967296 0 0
a25 23 False 9223372036854775807 0 255
a25 24 False 9223372036854775808 0 255
a25 25 False 18446744073709551615 0 255
a25 26 False 18446744073709551616 0 255
a26 0 False -9223372036854775809 0 0
a26 1 False -9223372036854775808 0 0
a26 2 False -2147483649 0 65535
a26 3 False -2147483648 0 0
a26 4 False -32769 0 32767
a26 5 False -32768 0 32768
a26 6 False -129 0 65407
a26 7 False -128 0 65408
a26 8 False -1 0 65535
a26 9 True 0 0 0
a26 10 True 1 0 1
a26 11 True 127 0 127
a26 12 True 128 0 128
a26 13 True 255 0 255
a26 14 True 256 0 256
a26 15 True 32767 0 32767
a26 16 True 32768 0 32768
a26 17 True 65535 0 65535
a26 18 False 65536 0 0
a26 19 False 2147483647 0 65535
a26 20 False 2147483648 0 0
a26 21 False 4294967295 0 65535
a26 22 False 4294967296 0 0
a26 23 False 9223372036854775807 0 65535
a26 24 False 9223372036854775808 0 65535
a26 25 False 18446744073709551615 0 65535
a26 26 False 18446744073709551616 0 65535
a27 0 False -9223372036854775809 0 0
a27 1 False -9223372036854775808 0 0
a27 2 False -2147483649 0 2147483647
a27 3 False -2147483648 0 2147483648
a27 4 False -32769 0 4294934527
a27 5 False -32768 0 4294934528
a27 6 False -129 0 4294967167
a27 7 False -128 0 4294967168
a27 8 False -1 0 4294967295
a27 9 True 0 0 0
a27 10 True 1 0 1
a27 11 True 127 0 127
a27 12 True 128 0 128
a27 13 True 255 0 255
a27 14 True 256 0 256
a27 15 True 32767 0 32767
a27 16 True 32768 0 32768
a27 17 True 65535 0 65535
a27 18 True 65536 0 65536
a27 19 True 2147483647 0 2147483647
a27 20 True 2147483648 0 2147483648
a27 21 True 4294967295 0 4294967295
a27 22 False 4294967296 0 0
a27 23 False 9223372036854775807 0 4294967295
a27 24 False 9223372036854775808 0 4294967295
a27 25 False 18446744073709551615 0 4294967295
a27 26 False 18446744073709551616 0 4294967295
a28 0 False -9223372036854775809 0 9223372036854775808
a28 1 False -9223372036854775808 0 9223372036854775808
a28 2 False -2147483649 0 18446744071562067967
a28 3 False -2147483648 0 18446744071562067968
a28 4 False -32769 0 18446744073709518847
a28 5 False -32768 0 18446744073709518848
a28 6 False -129 0 18446744073709551487
a28 7 False -128 0 18446744073709551488
a28 8 False -1 0 18446744073709551615
a28 9 True 0 0 0
a28 10 True 1 0 1
a28 11 True 127 0 127
a28 12 True 128 0 128
a28 13 True 255 0 255
a28 14 True 256 0 256
a28 15 True 32767 0 32767
a28 16 True 32768 0 32768
a28 17 True 65535 0 65535
a28 18 True 65536 0 65536
a28 19 True 2147483647 0 2147483647
a28 20 True 2147483648 0 2147483648
a28 21 True 4294967295 0 4294967295
a28 22 True 4294967296 0 4294967296
a28 23 True 9223372036854775807 0 9223372036854775807
a28 24 False 9223372036854775808 0 9223372036854775807
a28 25 False 18446744073709551615 0 9223372036854775807
a28 26 False 18446744073709551616 0 9223372036854775807
a29 0 False -9223372036854775809 0 9223372036854775808
a29 1 False -9223372036854775808 0 9223372036854775808
a29 2 False -2147483649 0 18446744071562067967
a29 3 False -2147483648 0 18446744071562067968
a29 4 False -32769 0 18446744073709518847
a29 5 False -32768 0 18446744073709518848
a29 6 False -129 0 18446744073709551487
a29 7 False -128 0 18446744073709551488
a29 8 False -1 0 18446744073709551615
a29 9 True 0 0 0
a29 10 True 1 0 1
a29 11 True 127 0 127
a29 12 True 128 0 128
a29 13 True 255 0 255
a29 14 True 256 0 256
a29 15 True 32767 0 32767
a29 16 True 32768 0 32768
a29 17 True 65535 0 65535
a29 18 True 65536 0 65536
a29 19 True 2147483647 0 2147483647
a29 20 True 2147483648 0 2147483648
a29 21 True 4294967295 0 4294967295
a29 22 True 4294967296 0 4294967296
a29 23 True 9223372036854775807 0 9223372036854775807
a29 24 False 9223372036854775808 0 9223372036854775807
a29 25 False 18446744073709551615 0 9223372036854775807
a29 26 False 18446744073709551616 0 9223372036854775807
a30 0 False -9223372036854775809 0 9223372036854775808
a30 1 False -9223372036854775808 0 9223372036854775808
a30 2 False -2147483649 0 18446744071562067967
a30 3 False -2147483648 0 18446744071562067968
a30 4 False -32769 0 18446744073709518847
a30 5 False -32768 0 18446744073709518848
a30 6 False -129 0 18446744073709551487
a30 7 False -128 0 18446744073709551488
a30 8 False -1 0 18446744073709551615
a30 9 True 0 0 0
a30 10 True 1 0 1
a30 11 True 127 0 127
a30 12 True 128 0 128
a30 13 True 255 0 255
a30 14 True 256 0 256
a30 15 True 32767 0 32767
a30 16 True 32768 0 32768
a30 17 True 65535 0 65535
a30 18 True 65536 0 65536
a30 19 True 2147483647 0 2147483647
a30 20 True 2147483648 0 2147483648
a30 21 True 4294967295 0 4294967295
a30 22 True 4294967296 0 4294967296
a30 23 True 9223372036854775807 0 9223372036854775807
a30 24 False 9223372036854775808 0 9223372036854775807
a30 25 False 18446744073709551615 0 9223372036854775807
a30 26 False 18446744073709551616 0 9223372036854775807
a31 0 False -9223372036854775809 0 0
a31 1 False -9223372036854775808 0 0
a31 2 False -2147483649 0 255
a31 3 False -2147483648 0 0
a31 4 False -32769 0 255
a31 5 False -32768 0 0
a31 6 False -129 0 127
a31 7 False -128 0 128
a31 8 False -1 0 255
a31 9 True 0 0 0
a31 10 True 1 0 1
a31 11 True 127 0 127
a31 12 True 128 0 128
a31 13 True 255 0 255
a31 14 False 256 0 0
a31 15 False 32767 0 255
a31 16 False 32768 0 0
a31 17 False 65535 0 255
a31 18 False 65536 0 0
a31 19 False 2147483647 0 255
a31 20 False 2147483648 0 0
a31 21 False 4294967295 0 255
a31 22 False 4294967296 0 0
a31 23 False 9223372036854775807 0 255
a31 24 False 9223372036854775808 0 255
a31 25 False 18446744073709551615 0 255
a31 26 False 18446744073709551616 0 255
a32 0 False -9223372036854775809 0 0
a32 1 False -9223372036854775808 0 0
a32 2 False -2147483649 0 65535
a32 3 False -2147483648 0 0
a32 4 False -32769 0 32767
a32 5 False -32768 0 32768
a32 6 False -129 0 65407
a32 7 False -128 0 65408
a32 8 False -1 0 65535
a32 9 True 0 0 0
a32 10 True 1 0 1
a32 11 True 127 0 127
a32 12 True 128 0 128
a32 13 True 255 0 255
a32 14 True 256 0 256
a32 15 True 32767 0 32767
a32 16 True 32768 0 32768
a32 17 True 65535 0 65535
a32 18 False 65536 0 0
a32 19 False 2147483647 0 65535
a32 20 False 2147483648 0 0
a32 21 False 4294967295 0 65535
a32 22 False 4294967296 0 0
a32 23 False 9223372036854775807 0 65535
a32 24 False 9223372036854775808 0 65535
a32 25 False 18446744073709551615 0 65535
a32 26 False 18446744073709551616 0 65535
a33 0 False -9223372036854775809 0 0
a33 1 False -9223372036854775808 0 0
a33 2 False -2147483649 0 2147483647
a33 3 False -2147483648 0 2147483648
a33 4 False -32769 0 4294934527
a33 5 False -32768 0 4294934528
a33 6 False -129 0 4294967167
a33 7 False -128 0 4294967168
a33 8 False -1 0 4294967295
a33 9 True 0 0 0
a33 10 True 1 0 1
a33 11 True 127 0 127
a33 12 True 128 0 128
a33 13 True 255 0 255
a33 14 True 256 0 256
a33 15 True 32767 0 32767
a33 16 True 32768 0 32768
a33 17 True 65535 0 65535
a33 18 True 65536 0 65536
a33 19 True 2147483647 0 2147483647
a33 20 True 2147483648 0 2147483648
a33 21 True 4294967295 0 4294967295
a33 22 False 4294967296 0 0
a33 23 False 9223372036854775807 0 4294967295
a33 24 False 9223372036854775808 0 4294967295
a33 25 False 18446744073709551615 0 4294967295
a33 26 False 18446744073709551616 0 4294967295
a34 0 False -9223372036854775809 0 9223372036854775808
a34 1 False -9223372036854775808 0 9223372036854775808
a34 2 False -2147483649 0 18446744071562067967
a34 3 False -2147483648 0 18446744071562067968
a34 4 False -32769 0 18446744073709518847
a34 5 False -32768 0 18446744073709518848
a34 6 False -129 0 18446744073709551487
a34 7 False -128 0 18446744073709551488
a34 8 False -1 0 18446744073709551615
a34 9 True 0 0 0
a34 10 True 1 0 1
a34 11 True 127 0 127
a34 12 True 128 0 128
a34 13 True 255 0 255
a34 14 True 256 0 256
a34 15 True 32767 0 32767
a34 16 True 32768 0 32768
a34 17 True 65535 0 65535
a34 18 True 65536 0 65536
a34 19 True 2147483647 0 2147483647
a34 20 True 2147483648 0 2147483648
a34 21 True 4294967295 0 4294967295
a34 22 True 4294967296 0 4294967296
a34 23 True 9223372036854775807 0 9223372036854775807
a34 24 False 9223372036854775808 0 9223372036854775807
a34 25 False 18446744073709551615 0 9223372036854775807
a34 26 False 18446744073709551616 0 9223372036854775807
$}}

###############################################################################

runTest {test tkt-c010fa6584-1.2 {UInt32 parameter} -setup {
  setupDb [set fileName tkt-c010fa6584-1.2.db]
} -body {
  sql execute $db "CREATE TABLE t1(x UINT32);"

  sql execute $db "INSERT INTO t1 (x) VALUES(?);" \
      [list param1 UInt32 0xFFFFFFFF]

  sql execute -execute scalar $db "SELECT x FROM t1;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{4294967295}}

###############################################################################

runTest {test tkt-c010fa6584-1.3 {UInt32 parameter (Int64)} -setup {
  setupDb [set fileName tkt-c010fa6584-1.3.db]
} -body {
  sql execute $db "CREATE TABLE t1(x INTEGER);"

  sql execute $db "INSERT INTO t1 (x) VALUES(?);" \
      [list param1 UInt32 0xFFFFFFFF]

  sql execute -execute scalar $db "SELECT x FROM t1;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{-1}}

###############################################################################

runTest {test tkt-c010fa6584-1.4 {UInt32 parameter (Int64) w/flag} -setup {
  setupDb [set fileName tkt-c010fa6584-1.4.db] "" "" "" BindUInt32AsInt64
} -body {
  sql execute $db "CREATE TABLE t1(x INTEGER);"

  sql execute $db "INSERT INTO t1 (x) VALUES(?);" \
      [list param1 UInt32 0xFFFFFFFF]

  sql execute -execute scalar $db "SELECT x FROM t1;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{4294967295}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-c28d7fe915.eagle.





























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
###############################################################################
#
# tkt-c28d7fe915.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-c28d7fe915-1.1 {GetOrdinal without current row} -setup {
  setupDb [set fileName tkt-c28d7fe915-1.1.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
  }

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db "SELECT x FROM t1;"]

  list [$dataReader GetName 0] [$dataReader GetOrdinal x]
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {x 0}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-ccfa69fc32.eagle.





























































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
###############################################################################
#
# tkt-ccfa69fc32.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue
runSQLiteTestFilesPrologue

###############################################################################

runTest {test tkt-ccfa69fc32-1.1 {LINQ Transaction Scope} -body {
  copySampleDatabaseFiles

  set result [list]

  foreach add [list false true false] {
    set output ""

    set code [catch {
      testClrExec $testLinqExeFile [list -eventflags Wait -directory \
          [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
          -success Success] -efTransaction $add
    } error]

    tlog "---- BEGIN STDOUT OUTPUT\n"
    tlog $output
    tlog "\n---- END STDOUT OUTPUT\n"

    lappend result $code

    if {$code == 0} then {
      lappend result [string trim \
          [extractSystemDataSQLiteExceptionMessage $output]]
    } else {
      lappend result [string trim \
          [extractSystemDataSQLiteExceptionMessage $error]]
    }
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result add
} -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll testExec\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db} \
-result {0 {1581 1730 1833 2116 2139} 0 {constraint failed -- UNIQUE constraint\
failed: Territories.TerritoryID} 0 {1 2 3 4 5 6 7 8 9 10 1576 1577 1578 1579\
1580 1581 1730 1833 2116 2139}}}

###############################################################################

runTest {test tkt-ccfa69fc32-1.2 {EF6 Transaction Scope} -body {
  copySampleDatabaseFiles

  set result [list]

  foreach add [list false true false] {
    set output ""

    set code [catch {
      testClrExec $testEf6ExeFile [list -eventflags Wait -directory \
          [file dirname $testEf6ExeFile] -nocarriagereturns -stdout output \
          -success Success] -efTransaction $add
    } error]

    tlog "---- BEGIN STDOUT OUTPUT\n"
    tlog $output
    tlog "\n---- END STDOUT OUTPUT\n"

    lappend result $code

    if {$code == 0} then {
      lappend result [string trim \
          [extractSystemDataSQLiteExceptionMessage $output]]
    } else {
      lappend result [string trim \
          [extractSystemDataSQLiteExceptionMessage $error]]
    }
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result add
} -constraints {eagle monoToDo SQLite file_EntityFramework.dll\
file_System.Data.SQLite.dll testExec file_System.Data.SQLite.EF6.dll\
file_testef6.exe file_northwindEF.db} -result {0 {1581 1730 1833 2116 2139} 0\
{constraint failed -- UNIQUE constraint failed: Territories.TerritoryID} 0 {1 2\
3 4 5 6 7 8 9 10 1576 1577 1578 1579 1580 1581 1730 1833 2116 2139}}}

###############################################################################

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-ce4d70ea6f.eagle.













































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
###############################################################################
#
# tkt-ce4d70ea6f.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

catch {purgeAndCleanup $test_channel before}

###############################################################################

runTest {test tkt-ce4d70ea6f-1.1 {finalizer queue depth} -setup {
  set fileName tkt-ce4d70ea6f-1.1.db

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteBase _finalizeCount 0
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]
  set rootName [file rootname [file tail $bin_file]]
  set count 50000

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Diagnostics;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static int Main()
        {
          int result = 0;

          using (PerformanceCounter counter = new PerformanceCounter(
              ".NET CLR Memory", "Finalization Survivors", "${rootName}"))
          {
            GC.GetTotalMemory(true);

            for (int iteration = 0; iteration < ${count}; iteration++)
            {
              int beforeCount = (int)counter.NextValue();

              using (SQLiteConnection connection = new SQLiteConnection(
                  "Data Source=${dataSource};[getTestProperties]"))
              {
                connection.Open();
              }

              int afterCount = (int)counter.NextValue();
              if (afterCount > beforeCount) result++;
            }

            return result;
          }
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll Eagle.dll]]

  if {$code ne "Ok"} then {
    error $errors
  }

  set result [object invoke _Dynamic${id}.Test${id} Main]

  list $result [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteBase _finalizeCount] \
      [expr {$result <= 4}]; # <5 per 50K
} -cleanup {
  unset -nocomplain count rootName dataSource id fileName
  unset -nocomplain result results errors code
} -constraints [fixConstraints {fail.false eagle !mono !dotNetCore\
command.object command.sql compile.DATA SQLite System.Data.SQLite\
sdsTiming}] -match regexp -result {^\d+ 0 True$}}

###############################################################################

catch {purgeAndCleanup $test_channel after}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-d4728aecb7.eagle.





















































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
###############################################################################
#
# tkt-d4728aecb7.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

moveSystemDataSQLiteDllConfig false

###############################################################################

set d472_binary_directory [string map [list \\ /] [getBinaryDirectory]]
set d472_target_framework [string map [list Fx ""] [getBuildNetFx]]

###############################################################################

runTest {test tkt-d4728aecb7-1.1 {tokens in environment variable} -setup \
    [getAppDomainPreamble] -body {
  package require Eagle.Library
  package require Eagle.Test
  package require System.Data.SQLite.Test

  saveEnvironmentVariables [list d472_1 d472_2 d472_3] savedEnv

  set env(d472_1) {prfx1/%PreLoadSQLite_AssemblyDirectory%/sufx1}
  set env(d472_2) {prfx2/%PreLoadSQLite_TargetFramework%/sufx2}
  set env(d472_3) {prfx3/%PreLoadSQLite_XmlConfigDirectory%/sufx3}

  object load -loadtype File [file join \
      [getBinaryDirectory] System.Data.SQLite.dll]

  set result [list]

  lappend result [string map [list \\ /] [object invoke -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods GetSettingValue d472_1 null]]

  lappend result [string map [list \\ /] [object invoke -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods GetSettingValue d472_2 null]]

  lappend result [string map [list \\ /] [object invoke -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods GetSettingValue d472_3 null]]

  set result
} -cleanup {
  restoreEnvironmentVariables [list d472_1 d472_2 d472_3] savedEnv

  unset -nocomplain result
} -isolationLevel AppDomain -constraints {eagle command.object\
compile.ISOLATED_INTERPRETERS System.Data.SQLite\
defineConstant.System.Data.SQLite.USE_INTEROP_DLL} -result [list [appendArgs \
prfx1/ $d472_binary_directory /sufx1] [appendArgs prfx2/ \
$d472_target_framework /sufx2] prfx3/%PreLoadSQLite_XmlConfigDirectory%/sufx3]}

###############################################################################

#
# HACK: This test relies (indirectly) upon the CodeBase property being set on
#       the assembly loaded via its bytes to the Eagle core library assembly
#       file name (i.e. because it is the calling assembly).  This appears to
#       be non-portable and will not work on Mono.
#
runTest {test tkt-d4728aecb7-1.2 {tokens in XML configuration file} -setup \
    [getAppDomainPreamble] -body {
  package require Eagle.Library
  package require Eagle.Test
  package require System.Data.SQLite.Test

  moveSystemDataSQLiteDllConfig false

  set fileName [writeSystemDataSQLiteDllConfig [string trim {
    <?xml version="1.0"?>
    <configuration>
      <appSettings>
        <add key="d472_1"
             value="prfx1/%PreLoadSQLite_AssemblyDirectory%/sufx1" />
        <add key="d472_2"
             value="prfx2/%PreLoadSQLite_TargetFramework%/sufx2" />
        <add key="d472_3"
             value="prfx3/%PreLoadSQLite_XmlConfigDirectory%/sufx3" />
      </appSettings>
    </configuration>
  }]]

  object load -loadtype Bytes [base64 encode [readFile [file join \
      [getBinaryDirectory] System.Data.SQLite.dll]]]

  set result [list]

  lappend result [string map [list \\ /] [object invoke -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods GetSettingValue d472_1 null]]

  lappend result [string map [list \\ /] [object invoke -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods GetSettingValue d472_2 null]]

  lappend result [string map [list \\ /] [object invoke -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods GetSettingValue d472_3 null]]

  set result
} -cleanup {
  catch {cleanupFile $fileName}

  unset -nocomplain result fileName

  moveSystemDataSQLiteDllConfig true
} -isolationLevel AppDomain -constraints {eagle command.object dotNet\
compile.ISOLATED_INTERPRETERS System.Data.SQLite\
defineConstant.System.Data.SQLite.USE_INTEROP_DLL} -result [list [appendArgs \
prfx1/ $d472_binary_directory /sufx1] [appendArgs prfx2/ \
$d472_target_framework /sufx2] [appendArgs prfx3/ $d472_binary_directory \
/sufx3]]}

###############################################################################

unset -nocomplain d472_target_framework d472_binary_directory

###############################################################################

moveSystemDataSQLiteDllConfig true

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-da685c0bac.eagle.











































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
###############################################################################
#
# tkt-da685c0bac.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

moveSystemDataSQLiteDllConfig false

###############################################################################

runTest {test tkt-da685c0bac-1.1 {GetXmlConfigFileName path handling} -setup \
    [getAppDomainPreamble] -body {
  package require Eagle.Library
  package require Eagle.Test
  package require System.Data.SQLite.Test

  moveSystemDataSQLiteDllConfig false

  object load -loadtype Bytes [base64 encode [readFile [file join \
      [getBinaryDirectory] System.Data.SQLite.dll]]]

  object invoke -flags +NonPublic \
      System.Data.SQLite.UnsafeNativeMethods GetXmlConfigFileName
} -cleanup {
  moveSystemDataSQLiteDllConfig true
} -isolationLevel AppDomain -constraints \
{eagle command.object compile.ISOLATED_INTERPRETERS System.Data.SQLite\
defineConstant.System.Data.SQLite.USE_INTEROP_DLL} -result {}}

###############################################################################

moveSystemDataSQLiteDllConfig true

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-da9f18d039.eagle.









































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
###############################################################################
#
# tkt-da9f18d039.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue
runSQLiteTestFilesPrologue

###############################################################################

runTest {test tkt-da9f18d039-1.1 {LINQ DateTime handling} -body {
  copySampleDatabaseFiles

  set result [list]
  set output ""

  set code [catch {
    testClrExec $testLinqExeFile [list -eventflags Wait -directory \
        [file dirname $testLinqExeFile] -nocarriagereturns -stdout output \
        -success Success] -datetime
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  lappend result $code

  if {$code == 0} then {
    lappend result [string trim $output]
  } else {
    lappend result [string trim $error]
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result
} -constraints {eagle monoToDo SQLite file_System.Data.SQLite.dll testExec\
file_System.Data.SQLite.Linq.dll file_testlinq.exe file_northwindEF.db} \
-result {0 {}}}

###############################################################################

runTest {test tkt-da9f18d039-1.2 {EF6 DateTime handling} -body {
  #
  # NOTE: Re-copy the reference database file used for this unit test to the
  #       build directory in case it has been changed by a previous test run.
  #
  copySampleDatabaseFiles

  set result [list]
  set output ""

  set code [catch {
    testClrExec $testEf6ExeFile [list -eventflags Wait -directory \
        [file dirname $testEf6ExeFile] -nocarriagereturns -stdout output \
        -success Success] -datetime
  } error]

  tlog "---- BEGIN STDOUT OUTPUT\n"
  tlog $output
  tlog "\n---- END STDOUT OUTPUT\n"

  lappend result $code

  if {$code == 0} then {
    lappend result [string trim $output]
  } else {
    lappend result [string trim $error]
  }

  set result
} -cleanup {
  catch {info previouspid true}

  unset -nocomplain code output error result
} -constraints {eagle monoToDo SQLite file_EntityFramework.dll\
file_System.Data.SQLite.dll testExec file_System.Data.SQLite.EF6.dll\
file_testef6.exe file_northwindEF.db} -result {0 {}}}

###############################################################################

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-daeaf3150a.eagle.

























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
###############################################################################
#
# tkt-daeaf3150a.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-daeaf3150a-1.1 {static Execute connection disposal} -setup {
  unset -nocomplain result sql
} -body {
  set sql(1) { \
    CREATE TABLE t1(x); \
    INSERT INTO t1 (x) VALUES (NULL); \
    SELECT x FROM t1 ORDER BY x; \
  }

  set sql(2) { \
    CREATE TABLE t1(x); \
    INSERT INTO t1 (x) VALUES (?); \
    SELECT x FROM t1 ORDER BY x; \
  }

  set result(1) [object invoke System.Data.SQLite.SQLiteCommand Execute \
      "this will not execute" None null]

  set result(2) [object invoke System.Data.SQLite.SQLiteCommand Execute \
      $sql(1) NonQuery null]

  set result(3) [object invoke System.Data.SQLite.SQLiteCommand Execute \
      $sql(1) Scalar null]

  set result(4) [object invoke System.Data.SQLite.SQLiteCommand Execute \
      $sql(1) Reader null]

  object invoke $result(4) Read; object invoke $result(4) Close

  set result(5) [object invoke System.Data.SQLite.SQLiteCommand Execute \
      "this will not execute" None null 1]

  set result(6) [object invoke System.Data.SQLite.SQLiteCommand Execute \
      $sql(2) NonQuery null 1]

  set result(7) [object invoke System.Data.SQLite.SQLiteCommand Execute \
      $sql(2) Scalar null 1]

  set result(8) [object invoke System.Data.SQLite.SQLiteCommand Execute \
      $sql(2) Reader null 1]

  list $result(1) $result(2) $result(3) $result(4) $result(5) $result(6) \
      $result(7) $result(8)
} -cleanup {
  unset -nocomplain result sql
} -constraints {eagle command.object monoBug28 SQLite System.Data.SQLite} \
-match regexp -result {^\{\} 1 System#DBNull#\d+\
System#Data#SQLite#SQLiteDataReader#\d+ \{\} 1 1\
System#Data#SQLite#SQLiteDataReader#\d+$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-dbd65441a5.eagle.



































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
###############################################################################
#
# tkt-dbd65441a5.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-dbd65441a5-1.1 {BOOLEAN with 't' and 'f', etc} -setup {
  setupDb [set fileName tkt-dbd65441a5-1.1.db] "" "" "" NoVerifyTextAffinity
} -body {
  sql execute $db {
    CREATE TABLE t1(x BOOLEAN);
    INSERT INTO t1 (x) VALUES('true');
    INSERT INTO t1 (x) VALUES('tru');
    INSERT INTO t1 (x) VALUES('tr');
    INSERT INTO t1 (x) VALUES('t');
    INSERT INTO t1 (x) VALUES('false');
    INSERT INTO t1 (x) VALUES('fals');
    INSERT INTO t1 (x) VALUES('fal');
    INSERT INTO t1 (x) VALUES('fa');
    INSERT INTO t1 (x) VALUES('f');
    INSERT INTO t1 (x) VALUES('-0');
    INSERT INTO t1 (x) VALUES('-1');
    INSERT INTO t1 (x) VALUES('-2');
    INSERT INTO t1 (x) VALUES('-3');
    INSERT INTO t1 (x) VALUES('0');
    INSERT INTO t1 (x) VALUES('1');
    INSERT INTO t1 (x) VALUES('2');
    INSERT INTO t1 (x) VALUES('3');
  }

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db "SELECT x FROM t1 ORDER BY x;"]

  set results [list]

  while {[$dataReader Read]} {
    catch {
      list [$dataReader GetString 0] [$dataReader GetValue 0]
    } result

    lappend results $result
  }

  set results
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain result results db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{-3 True} {-2 True} {-1 True} {0 False} {0 False}\
{1 True} {2 True} {3 True} {f False} {fa False} {fal False} {fals False} {false\
False} {t True} {tr True} {tru True} {true True}}}

###############################################################################

runTest {test tkt-dbd65441a5-1.2 {BOOLEAN with 't' and 'f', etc} -setup {
  setupDb [set fileName tkt-dbd65441a5-1.1.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x BOOLEAN);
    INSERT INTO t1 (x) VALUES('true');
    INSERT INTO t1 (x) VALUES('tru');
    INSERT INTO t1 (x) VALUES('tr');
    INSERT INTO t1 (x) VALUES('t');
    INSERT INTO t1 (x) VALUES('false');
    INSERT INTO t1 (x) VALUES('fals');
    INSERT INTO t1 (x) VALUES('fal');
    INSERT INTO t1 (x) VALUES('fa');
    INSERT INTO t1 (x) VALUES('f');
    INSERT INTO t1 (x) VALUES('-0');
    INSERT INTO t1 (x) VALUES('-1');
    INSERT INTO t1 (x) VALUES('-2');
    INSERT INTO t1 (x) VALUES('-3');
    INSERT INTO t1 (x) VALUES('0');
    INSERT INTO t1 (x) VALUES('1');
    INSERT INTO t1 (x) VALUES('2');
    INSERT INTO t1 (x) VALUES('3');
  }

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db "SELECT x FROM t1 ORDER BY x;"]

  set results [list]

  while {[$dataReader Read]} {
    catch {
      list [$dataReader GetString 0] [$dataReader GetValue 0]
    } result

    lappend results $result
  }

  set results
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName

  unset -nocomplain result results db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -match glob -result {{* ---> System.InvalidCastException:\
*} {* ---> System.InvalidCastException: *} {* ---> System.InvalidCastException:\
*} {* ---> System.InvalidCastException: *} {* ---> System.InvalidCastException:\
*} {* ---> System.InvalidCastException: *} {* ---> System.InvalidCastException:\
*} {* ---> System.InvalidCastException: *} {f False} {fa False} {fal False}\
{fals False} {false False} {t True} {tr True} {tru True} {true True}}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-e06c4caff3.eagle.































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
###############################################################################
#
# tkt-e06c4caff3.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-e06c4caff3-1.1 {NaN to NULL constraint failure} -setup {
  setupDb [set fileName tkt-e06c4caff3-1.1.db]
} -body {
  sql execute $db "CREATE TABLE t1(x REAL NOT NULL);"

  list [catch {
    sql execute $db "INSERT INTO t1 (x) VALUES(?);" \
        [list param1 Double [set NaN [object invoke Double NaN]]]
  } error] [extractSystemDataSQLiteExceptionMessage $error]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain NaN error db fileName
} -constraints {eagle command.object monoBug40 command.sql compile.DATA SQLite\
System.Data.SQLite} -result \
{1 {constraint failed -- NOT NULL constraint failed: t1.x}}}

###############################################################################

runTest {test tkt-e06c4caff3-1.2 {NaN to NULL} -setup {
  setupDb [set fileName tkt-e06c4caff3-1.2.db]
} -body {
  sql execute $db "CREATE TABLE t1(x REAL);"

  sql execute $db "INSERT INTO t1 (x) VALUES(?);" \
      [list param1 Double [set NaN [object invoke Double NaN]]]

  sql execute -execute reader -format list $db "SELECT x FROM t1;"
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain NaN db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {}}

###############################################################################

runTest {test tkt-e06c4caff3-1.3 {NaN w/BindAllAsText} -setup {
  setupDb [set fileName tkt-e06c4caff3-1.3.db] "" "" "" BindAllAsText
} -body {
  sql execute $db "CREATE TABLE t1(x REAL NOT NULL);"

  list [sql execute $db "INSERT INTO t1 (x) VALUES(?);" \
      [list param1 Double [set NaN [object invoke Double NaN]]]] \
      [sql execute -execute reader -format list $db "SELECT x FROM t1;"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain NaN db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {1 0}}

###############################################################################

runTest {test tkt-e06c4caff3-1.4 {NaN w/BindAllAsText & GetAllAsText} -setup {
  setupDb [set fileName tkt-e06c4caff3-1.4.db] "" "" "" BindAndGetAllAsText
} -body {
  sql execute $db "CREATE TABLE t1(x REAL NOT NULL);"

  list [sql execute $db "INSERT INTO t1 (x) VALUES(?);" \
      [list param1 Double [set NaN [object invoke Double NaN]]]] \
      [sql execute -execute reader -format list $db "SELECT x FROM t1;"]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain NaN db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {1 NaN}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-e1b2e0f769.eagle.















































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
###############################################################################
#
# tkt-e1b2e0f769.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-e1b2e0f769-1.1 {data reader cleanup} -setup {
  setupDb [set fileName tkt-e1b2e0f769-1.1.db]
} -body {
  sql execute $db "CREATE TABLE t1(x INTEGER);"
  sql execute $db "CREATE TABLE t2(x INTEGER);"

  foreach x [list 1 2 3] {
    sql execute $db "INSERT INTO t1 (x) VALUES($x);"
  }

  set result1 [list]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  foreach table [list t1 t2] {
    set id [object invoke Interpreter.GetActive NextId]
    set sql "SELECT x FROM $table ORDER BY x;"

    unset -nocomplain results errors

    set code [compileCSharpWith [subst {
      using System.Collections.Generic;
      using System.Data.SQLite;

      namespace _Dynamic${id}
      {
        public static class Test${id}
        {
          public static List<long?> Tkt_e1b2e0f769(
            SQLiteConnection connection
            )
          {
            List<long?> result = new List<long?>();

            using (SQLiteTransaction transaction =
                connection.BeginTransaction())
            {
              using (SQLiteCommand command = connection.CreateCommand())
              {
                command.CommandText = "${sql}";

                using (SQLiteDataReader dataReader = command.ExecuteReader())
                {
                  //
                  // NOTE: If there are no rows, close the connection and
                  //       return the empty list.  In this case,  an exception
                  //       will be raised when exiting the using block for the
                  //       data reader because we are closing the connection out
                  //       from underneath it.
                  //
                  if (!dataReader.HasRows)
                  {
                    //
                    // NOTE: Closing the connection here caused an exception to
                    //       be raised when exiting the using block for the data
                    //       reader (below) because the Dispose method for the
                    //       data reader calls the Close method, which always
                    //       assumed the underlying connection was still open.
                    //
                    connection.Close();
                    return result;
                  }

                  while (dataReader.Read())
                  {
                    result.Add((long?) dataReader\[0\]);
                  }
                } // NOTE: Exception here when no data rows (see comment above).
              }
            }

            connection.Close();
            return result;
          }

          /////////////////////////////////////////////////////////////////////

          public static int Main()
          {
            using (SQLiteConnection connection = new SQLiteConnection(
                "Data Source=${dataSource};[getTestProperties]"))
            {
              connection.Open();

              return Tkt_e1b2e0f769(connection).Count;
            }
          }
        }
      }
    }] true false true results errors System.Data.SQLite.dll]

    lappend result1 $code $results \
        [expr {[info exists errors] ? $errors : ""}] \
        [expr {$code eq "Ok" ? [catchCSharp {
          object invoke _Dynamic${id}.Test${id} Main
        } result2] : [set result2 ""]}] $result2
  }

  set result1
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result2 result1 code results errors sql table dataSource \
      id x db fileName
} -constraints [fixConstraints {eagle command.object monoBug28 command.sql\
compile.DATA SQLite !defineConstant.System.Data.SQLite.CHECK_STATE\
System.Data.SQLite compileCSharp}] -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 3 Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 0$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-e22d357a21.eagle.











































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
###############################################################################
#
# tkt-e22d357a21.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-e22d357a21-1.1 {parameter name case-sensitivity} -setup {
  setupDb [set fileName tkt-e22d357a21-1.1.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x INTEGER PRIMARY KEY);
  }

  sql execute $db {
    INSERT INTO t1 (x) VALUES(1);
    INSERT INTO t1 (x) VALUES(2);
    INSERT INTO t1 (x) VALUES(3);
    INSERT INTO t1 (x) VALUES(4);
    INSERT INTO t1 (x) VALUES(5);
    INSERT INTO t1 (x) VALUES(6);
    INSERT INTO t1 (x) VALUES(7);
    INSERT INTO t1 (x) VALUES(8);
  }

  set result [list]

  catch {
    lappend result [sql execute -execute reader -format list $db \
        "SELECT x FROM t1 WHERE x IN (?, ?, ?, ?);" \
        [list param1 Int32 1] [list param2 Int32 2] \
        [list param3 Int32 3] [list param4 Int32 4]]
  }

  catch {
    lappend result [sql execute -execute reader -format list $db \
        "SELECT x FROM t1 WHERE x = :id;" [list id Int32 1] \
        [list ID Int32 2]]
  }

  catch {
    lappend result [sql execute -execute reader -format list $db \
        "SELECT x FROM t1 WHERE x = :iD;" [list id Int32 3] \
        [list iD Int32 4]]
  }

  catch {
    lappend result [sql execute -execute reader -format list $db \
        "SELECT x FROM t1 WHERE x = :Id;" [list Id Int32 5] \
        [list id Int32 6]]
  }

  catch {
    lappend result [sql execute -execute reader -format list $db \
        "SELECT x FROM t1 WHERE x = :ID;" [list id Int32 7] \
        [list ID Int32 8]]
  }

  set result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{1 2 3 4} 1 4 5 8}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-e30b820248.eagle.























































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
###############################################################################
#
# tkt-e30b820248.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

set memory_used [reportSQLiteResources $test_channel true]

###############################################################################

runTest {test tkt-e30b820248-1.1 {disposal ordering} -setup {
  set fileName tkt-e30b820248-1.1.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]
  set name [file rootname [file tail $fileName]]

  set sql { \
    CREATE TABLE t1 (id1 INTEGER); \
    INSERT INTO t1 (id1) VALUES (1); \
    INSERT INTO t1 (id1) VALUES (2); \
    INSERT INTO t1 (id1) VALUES (?); \
    INSERT INTO t1 (id1) VALUES (?); \
    INSERT INTO t1 (id1) VALUES (?); \
    SELECT id1 FROM t1 ORDER BY id1; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;
    using System.Diagnostics;
    using System.IO;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main()
        {
          using (TraceListener listener = new TextWriterTraceListener(
              new FileStream("${test_log}", FileMode.Append,
                  FileAccess.Write, FileShare.ReadWrite), "${name}"))
          {
            Trace.Listeners.Add(listener);
            Trace.WriteLine("---- START TRACE \\"${name}\\"");

            using (SQLiteConnection connection = new SQLiteConnection(
                "Data Source=${dataSource};[getTestProperties]"))
            {
              connection.Open();
              connection.LogMessage(0, "Connection opened.");

              using (SQLiteTransaction transaction =
                  connection.BeginTransaction())
              {
                connection.LogMessage(0, "Transaction started.");

                using (SQLiteCommand command = connection.CreateCommand())
                {
                  command.Transaction = transaction;
                  command.CommandText = "${sql}";

                  command.Parameters.AddWithValue("x", 3);
                  command.Parameters.AddWithValue("y", 4);
                  command.Parameters.AddWithValue("z", 5);

                  command.ExecuteNonQuery();
                  connection.LogMessage(0, "Command executed.");
                }

                transaction.Commit();
                connection.LogMessage(0, "Transaction committed.");
              }
            }

            Trace.WriteLine("---- END TRACE \\"${name}\\"");
            Trace.Listeners.Remove(listener);
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result \
      [reportSQLiteResources $test_channel true]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql name dataSource id fileName
} -constraints {eagle command.object logFile monoBug28 command.sql compile.DATA\
SQLite System.Data.SQLite compileCSharp} -match regexp -result [appendArgs "^Ok\
System#CodeDom#Compiler#CompilerResults#\\d+ \\{\\} 0 \\{\\} " $memory_used \$]}

###############################################################################

for {set i 2} {$i < 5} {incr i} {
  set memory_used [reportSQLiteResources $test_channel true]

  #############################################################################

  runTest {test [appendArgs tkt-e30b820248-1. $i] {disposal ordering} -setup {
    set fileName [appendArgs tkt-e30b820248-1. $i .db]
  } -body {
    set id [object invoke Interpreter.GetActive NextId]
    set dataSource [file join [getDatabaseDirectory] $fileName]
    set name [file rootname [file tail $fileName]]

    set sql { \
      CREATE TABLE t1 (id1 INTEGER); \
      INSERT INTO t1 (id1) VALUES (1); \
      INSERT INTO t1 (id1) VALUES (2); \
      INSERT INTO t1 (id1) VALUES (3); \
      INSERT INTO t1 (id1) VALUES (4); \
      INSERT INTO t1 (id1) VALUES (5); \
      SELECT id1 FROM t1 ORDER BY id1; \
    }

    unset -nocomplain results errors

    set code [compileCSharpWith [subst {
      using System;
      using System.Data.SQLite;
      using System.Diagnostics;
      using System.IO;

      namespace _Dynamic${id}
      {
        public static class Test${id}
        {
          #region Private Static Data
          private static SQLiteConnection connection;
          #endregion

          /////////////////////////////////////////////////////////////////////

          #region Public Static Methods
          public static void OpenConnection()
          {
            connection = new SQLiteConnection(
                "Data Source=${dataSource};[getTestProperties]");

            connection.Open();
            connection.LogMessage(0, "Connection opened.");
          }

          /////////////////////////////////////////////////////////////////////

          public static SQLiteCommand CreateCommand(
            string sql
            )
          {
            SQLiteCommand command = connection.CreateCommand();
            command.CommandText = sql;
            connection.LogMessage(0, "Command created.");
            return command;
          }

          /////////////////////////////////////////////////////////////////////

          public static SQLiteDataReader ExecuteReader(
            SQLiteCommand command
            )
          {
            SQLiteDataReader dataReader = command.ExecuteReader();
            connection.LogMessage(0, "Command executed.");
            return dataReader;
          }

          /////////////////////////////////////////////////////////////////////

          public static SQLiteDataReader ExecuteReader(
            string sql
            )
          {
            SQLiteCommand command = CreateCommand(sql);
            SQLiteDataReader dataReader = command.ExecuteReader();
            connection.LogMessage(0, "Command executed.");
            return dataReader;
          }

          /////////////////////////////////////////////////////////////////////

          public static void CloseConnection()
          {
            connection.LogMessage(0, "Closing connection...");
            connection.Close();
          }
          #endregion

          /////////////////////////////////////////////////////////////////////

          public static void Main()
          {
            using (TraceListener listener = new TextWriterTraceListener(
                new FileStream("${test_log}", FileMode.Append,
                    FileAccess.Write, FileShare.ReadWrite), "${name}"))
            {
              Trace.Listeners.Add(listener);
              Trace.WriteLine("---- START TRACE \\"${name}\\"");

              OpenConnection();
              SQLiteDataReader dataReader = ExecuteReader("${sql}");

              [expr {$i <= 2 ? {
                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();
              } : ""}]

              dataReader.Close();

              [expr {$i <= 3 ? {
                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();
              } : ""}]

              CloseConnection();

              [expr {$i <= 4 ? {
                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();
              } : ""}]

              Trace.WriteLine("---- END TRACE \\"${name}\\"");
              Trace.Listeners.Remove(listener);
            }
          }
        }
      }
    }] true false true results errors System.Data.SQLite.dll]

    list $code $results \
        [expr {[info exists errors] ? $errors : ""}] \
        [expr {$code eq "Ok" ? [catchCSharp {
          object invoke _Dynamic${id}.Test${id} Main
        } result] : [set result ""]}] $result \
        [reportSQLiteResources $test_channel true]
  } -cleanup {
    cleanupDb $fileName

    unset -nocomplain result code results errors sql name dataSource id \
        fileName
  } -constraints {eagle command.object logFile monoBug28 command.sql\
compile.DATA SQLite System.Data.SQLite compileCSharp} -match regexp -result \
[appendArgs "^Ok System#CodeDom#Compiler#CompilerResults#\\d+ \\{\\} 0 \\{\\} "\
$memory_used \$]}
}

###############################################################################

unset -nocomplain i

###############################################################################

unset -nocomplain memory_used

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-e36e05e299.eagle.

























































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
###############################################################################
#
# tkt-e36e05e299.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

proc hasIndexOutOfRangeException { value } {
  return [regexp -- { System\.IndexOutOfRangeException: } $value]
}

###############################################################################

runTest {test tkt-e36e05e299-1.1 {GetOrdinal, -1 for not found} -setup {
  setupDb [set fileName tkt-e36e05e299-1.1.db]
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
    INSERT INTO t1 (x) VALUES(NULL);
  }

  set dataReader [sql execute \
      -execute reader -format datareader \
      -alias $db "SELECT x FROM t1 ORDER BY x;"]

  lappend result(1) [catch {$dataReader GetOrdinal x} result(2)]

  if {$result(1)} then {
    set result(2) [hasIndexOutOfRangeException $result(2)]
  }

  lappend result(3) [catch {$dataReader GetOrdinal y} result(4)]

  if {$result(3)} then {
    set result(4) [hasIndexOutOfRangeException $result(4)]
  }

  testArrayGet result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName db

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{1 0 2 0 3 0 4 -1}}

###############################################################################

runTest {test tkt-e36e05e299-1.2 {GetOrdinal, throw on not found} -setup {
  setupDb [set fileName tkt-e36e05e299-1.2.db] "" "" "" StrictConformance
} -body {
  sql execute $db {
    CREATE TABLE t1(x);
    INSERT INTO t1 (x) VALUES(NULL);
  }

  set dataReader [sql execute \
      -execute reader -format datareader \
      -alias $db "SELECT x FROM t1 ORDER BY x;"]

  lappend result(1) [catch {$dataReader GetOrdinal x} result(2)]

  if {$result(1)} then {
    set result(2) [hasIndexOutOfRangeException $result(2)]
  }

  lappend result(3) [catch {$dataReader GetOrdinal y} result(4)]

  if {$result(3)} then {
    set result(4) [hasIndexOutOfRangeException $result(4)]
  }

  testArrayGet result
} -cleanup {
  unset -nocomplain dataReader

  cleanupDb $fileName db

  unset -nocomplain result db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{1 0 2 0 3 1 4 1}}

###############################################################################

rename hasIndexOutOfRangeException ""

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-e47b3d8346.eagle.



























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
###############################################################################
#
# tkt-e47b3d8346.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-e47b3d8346-1.1 {parse semi-colon in data source} -setup {
  unset -nocomplain result list pair
} -body {
  set result [list]

  set list [object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteConnection ParseConnectionString \
      {Data Source="C:\full\path\to\file.db;more.data.here";} false]

  object foreach -alias pair $list {
    lappend result [list [$pair Key] [$pair Value]]
  }

  set result
} -cleanup {
  unset -nocomplain result list pair
} -constraints {eagle command.object System.Data.SQLite} -result \
{{{Data Source} {C:\full\path\to\file.db;more.data.here}}}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-ef2216192d.eagle.



















































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
###############################################################################
#
# tkt-ef2216192d.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-ef2216192d-1.1 {GetSchemaTable w/large VARCHAR} -setup {
  setupDb [set fileName tkt-ef2216192d-1.1.db]
} -body {
  sql execute $db "CREATE TABLE t1(x INTEGER PRIMARY KEY, y VARCHAR(32768));"

  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    SELECT x, y FROM t1; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            using (SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter(
                "${sql}", connection))
            {
              using (SQLiteCommandBuilder commandBuilder =
                  new SQLiteCommandBuilder(dataAdapter))
              {
                dataAdapter.InsertCommand = commandBuilder.GetInsertCommand();
                dataAdapter.UpdateCommand = commandBuilder.GetUpdateCommand();
                dataAdapter.DeleteCommand = commandBuilder.GetDeleteCommand();

                //
                // NOTE: If we get to this point without an exception being
                //       thrown, this test has succeeded.
                //
              }
            }
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] $result
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result results errors code sql dataSource id db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite compileCSharp} -match regexp -result {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-f2c47a01eb.eagle.









































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
###############################################################################
#
# tkt-f2c47a01eb.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-f2c47a01eb-1.1 {GetSchema w/INDEXES, PK} -setup {
  setupDb [set fileName tkt-f2c47a01eb-1.1.db]
} -body {
  set connection [getDbConnection]

  sql execute $db "CREATE TABLE t1(x TEXT PRIMARY KEY, y TEXT);"
  sql execute $db "CREATE INDEX t1_1 ON t1(x, y);"
  sql execute $db "CREATE UNIQUE INDEX t1_2 ON t1(x, y);"

  set dataTable [$connection -alias GetSchema INDEXES]
  set results [list]

  object foreach -alias dataRow [set dataRows [$dataTable -alias Rows]] {
    lappend results [list [$dataRow Item TABLE_NAME] \
        [$dataRow Item INDEX_NAME] [$dataRow Item PRIMARY_KEY]]
  }

  set results
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain dataRow dataRows dataTable results connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{t1 t1_2 False} {t1 t1_1 False} {t1\
sqlite_autoindex_t1_1 True}}}

###############################################################################

runTest {test tkt-f2c47a01eb-1.2 {GetSchema w/INDEXES, composite PK} -setup {
  setupDb [set fileName tkt-f2c47a01eb-1.2.db]
} -body {
  set connection [getDbConnection]

  sql execute $db "CREATE TABLE t1(x TEXT, y TEXT, PRIMARY KEY(x, y));"
  sql execute $db "CREATE INDEX t1_1 ON t1(x, y);"
  sql execute $db "CREATE UNIQUE INDEX t1_2 ON t1(x, y);"

  set dataTable [$connection -alias GetSchema INDEXES]
  set results [list]

  object foreach -alias dataRow [set dataRows [$dataTable -alias Rows]] {
    lappend results [list [$dataRow Item TABLE_NAME] \
        [$dataRow Item INDEX_NAME] [$dataRow Item PRIMARY_KEY]]
  }

  set results
} -cleanup {
  cleanupDb $fileName

  freeDbConnection

  unset -nocomplain dataRow dataRows dataTable results connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{t1 t1_2 False} {t1 t1_1 False} {t1\
sqlite_autoindex_t1_1 True}}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-f8dbab8baf.eagle.































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
###############################################################################
#
# tkt-f8dbab8baf.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-f8dbab8baf-1.1 {SchemaOnly with CREATE TABLE} -setup {
  setupDb [set fileName tkt-f8dbab8baf-1.1.db]
} -body {
  sql execute -execute reader -format none -behavior SchemaOnly $db \
      "CREATE TABLE t1(x);"

  isTableInDb t1
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{False}}

###############################################################################

runTest {test tkt-f8dbab8baf-1.2 {SchemaOnly with ALTER TABLE} -setup {
  setupDb [set fileName tkt-f8dbab8baf-1.2.db]
} -body {
  sql execute $db "CREATE TABLE t1(x);"

  sql execute -execute reader -format none -behavior SchemaOnly $db \
      "ALTER TABLE t1 RENAME TO t2;"

  list [isTableInDb t1] [isTableInDb t2]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{True False}}

###############################################################################

runTest {test tkt-f8dbab8baf-1.3 {SchemaOnly with DROP TABLE} -setup {
  setupDb [set fileName tkt-f8dbab8baf-1.3.db]
} -body {
  sql execute $db "CREATE TABLE t1(x);"

  sql execute -execute reader -format none -behavior SchemaOnly $db \
      "DROP TABLE t1;"

  isTableInDb t1
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{True}}

###############################################################################

runTest {test tkt-f8dbab8baf-1.4 {CREATE/SELECT success} -setup {
  setupDb [set fileName tkt-f8dbab8baf-1.4.db]
} -body {
  sql execute -execute reader $db {
    CREATE TABLE t1(x);
    INSERT INTO t1 (x) VALUEs(1);
    SELECT x FROM t1;
  }

  list [isTableInDb t1] \
      [expr {[info exists rows(count)] ? $rows(count) : -1}] \
      [expr {[info exists rows(names)] ? $rows(names) : ""}]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain rows db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{True 1 x}}

###############################################################################

runTest {test tkt-f8dbab8baf-1.5 {SchemaOnly CREATE/SELECT success} -setup {
  setupDb [set fileName tkt-f8dbab8baf-1.5.db]
} -body {
  sql execute $db "CREATE TABLE t1(x);"
  sql execute $db "INSERT INTO t1 (x) VALUEs(1);"
  sql execute -execute reader -behavior SchemaOnly $db "SELECT x FROM t1;"

  list [isTableInDb t1] \
      [expr {[info exists rows(count)] ? $rows(count) : -1}] \
      [expr {[info exists rows(names)] ? $rows(names) : ""}]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain rows db fileName
} -constraints \
{eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} -result \
{True 0 x}}

###############################################################################

runTest {test tkt-f8dbab8baf-1.6 {SchemaOnly CREATE/SELECT failure} -setup {
  setupDb [set fileName tkt-f8dbab8baf-1.6.db]
} -body {
  list [catch {
    sql execute -execute reader -format none -behavior SchemaOnly $db \
        "CREATE TABLE t1(x); SELECT x FROM t1;"

    list [isTableInDb t1] \
        [expr {[info exists rows(count)] ? $rows(count) : -1}] \
        [expr {[info exists rows(names)] ? $rows(names) : ""}]
  } error] [extractSystemDataSQLiteExceptionMessage $error]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain error rows db fileName
} -constraints \
{eagle monoBug40 command.sql compile.DATA SQLite System.Data.SQLite} -match \
regexp -result {^1 \{SQL logic error( or missing database)? -- no such table:\
t1\}$}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/tkt-fe50b8c2e8.eagle.





























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
###############################################################################
#
# tkt-fe50b8c2e8.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

runTest {test tkt-fe50b8c2e8-1.1 {compatibility data types} -body {
  list [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      TypeNameToDbType null VARCHAR2 None] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      TypeNameToDbType null CLOB None] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      TypeNameToDbType null NUMBER None] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      TypeNameToDbType null RAW None] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      DbTypeToTypeName null AnsiString None] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      DbTypeToTypeName null String None] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      DbTypeToTypeName null Decimal None] \
      [object invoke -flags +NonPublic System.Data.SQLite.SQLiteConvert \
      DbTypeToTypeName null Binary None]
} -constraints {eagle command.object System.Data.SQLite} -result \
{AnsiString String Decimal Binary VARCHAR NVARCHAR DECIMAL BLOB}}

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/types.eagle.



































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
###############################################################################
#
# types.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

proc bindValueCallback1 {
        convert command flags parameter typeName index userData
        completeVarName } {
  lappend ::log(bind) [list convert [isNonNullObjectHandle $convert]]
  lappend ::log(bind) [list command [isNonNullObjectHandle $command]]
  lappend ::log(bind) [list flags [getStringFromObjectHandle $flags]]
  lappend ::log(bind) [list parameter [isNonNullObjectHandle $parameter]]
  lappend ::log(bind) [list typeName [getStringFromObjectHandle $typeName]]
  lappend ::log(bind) [list index [getStringFromObjectHandle $index]]
  lappend ::log(bind) [list userData [getStringFromObjectHandle $userData]]

  if {[getStringFromObjectHandle $userData] == 3} then {
    upvar 1 $completeVarName complete; unset complete
    error "parameter binding canceled"
  }

  if {[getStringFromObjectHandle $userData] == 2} then {
    $parameter DbType String
    $parameter Value custom
  }

  if {[getStringFromObjectHandle $userData] == 1} then {
    upvar 1 $completeVarName complete
    set complete [object invoke -create System.Boolean Parse True]
  }
}

###############################################################################

proc readValueCallback1 {
        convert dataReader flags eventArgs typeName index userData
        completeVarName } {
  lappend ::log(read) [list convert [isNonNullObjectHandle $convert]]
  lappend ::log(read) [list dataReader [isNonNullObjectHandle $dataReader]]
  lappend ::log(read) [list flags [getStringFromObjectHandle $flags]]
  lappend ::log(read) [list eventArgs [isNonNullObjectHandle $eventArgs]]
  lappend ::log(read) [list typeName [getStringFromObjectHandle $typeName]]
  lappend ::log(read) [list index [getStringFromObjectHandle $index]]
  lappend ::log(read) [list userData [getStringFromObjectHandle $userData]]

  if {[getStringFromObjectHandle $userData] == 3} then {
    upvar 1 $completeVarName complete; unset complete
    error "reading of value canceled"
  }

  if {[getStringFromObjectHandle $userData] == 1} then {
    upvar 1 $completeVarName complete
    set complete [object invoke -create System.Boolean Parse True]
  }
}

###############################################################################

runTest {test types-1.1 {type callbacks management} -setup {
  setupDb [set fileName types-1.1.db]
} -body {
  set connection [getDbConnection]

  set result [list]

  lappend result [$connection ClearTypeCallbacks]

  set typeCallbacks(1) [object invoke \
      System.Data.SQLite.SQLiteTypeCallbacks Create \
      null null null null]

  set typeCallbacks(2) null

  lappend result [$connection SetTypeCallbacks TEST $typeCallbacks(1)]
  lappend result [$connection TryGetTypeCallbacks TEST typeCallbacks(2)]
  lappend result [$connection ClearTypeCallbacks]
  lappend result [$connection SetTypeCallbacks TEST $typeCallbacks(1)]
  lappend result [expr {$typeCallbacks(1) eq $typeCallbacks(2)}]

  set result
} -cleanup {
  freeDbConnection

  cleanupDb $fileName

  unset -nocomplain typeCallbacks
  unset -nocomplain result connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {0 True True 1 True True}}

###############################################################################

set readArgs [list \
    convert dataReader flags eventArgs typeName index userData \
    completeVarName]

set params [list \
    [list Boolean         GetBoolean    false   BooleanValue    true    0] \
    [list Byte            GetByte       false   ByteValue       true    0] \
    [list Byte            GetBytes      true    BytesValue      false   0] \
    [list Char            GetChar       false   CharValue       true    0] \
    [list Char            GetChars      true    CharsValue      false   0] \
    [list DateTime        GetDateTime   false   DateTimeValue   true    0] \
    [list Decimal         GetDecimal    false   DecimalValue    true    0] \
    [list Double          GetDouble     false   DoubleValue     true    0] \
    [list Single          GetFloat      false   FloatValue      true    0] \
    [list Guid            GetGuid       false   GuidValue       true    \
        00000000-0000-0000-0000-000000000000] \
    [list Int16           GetInt16      false   Int16Value      true    0] \
    [list Int32           GetInt32      false   Int32Value      true    0] \
    [list Int64           GetInt64      false   Int64Value      true    0] \
    [list String          GetString     false   StringValue     false   none] \
    [list Object          GetValue      false   Value           false   null] \
    [list SDS.SQLiteBlob  GetBlob       false   BlobValue       false   0]]

###############################################################################

set expectedResults [list \
    {False False True False False False False False} \
    {0 0 1 0 0 0 0 0} \
    {0 1 48 1 49 3 {49 46 50} 5 {116 104 114\
        101 101} 1 4 27 {50 48 49 54 45 48 54\
        45 49 57 32 49 57 58 53 48 58 48 52 46\
        49 50 51 52 53 54 55} 36 {55 52 102 49\
        102 52 48 50 45 100 100 101 102 45 52\
        48 50 55 45 97 55 56 102 45 51 56 52 55\
        102 97 57 55 98 56 51 48}} \
    "<NUL> <NUL> \x01 <NUL> <NUL> <NUL> <NUL> <NUL>" \
    "0 1 0 1 1 3 {1 . 2} 1 t 1 \x04 1 2 1 7" \
    {{0001-01-01 00:00:00Z} {0001-01-01 00:00:00Z}\
        {0001-01-01 00:00:00Z} {0001-01-01 00:00:00Z}\
        {0001-01-01 00:00:00Z} {0001-01-01 00:00:00Z}\
        {2016-06-19 19:50:04.1234567Z} {0001-01-01\
        00:00:00Z}} \
    {0 0 1 1.2 0 0 0 0} \
    {0 0 1 1.2 0 0 0 0} \
    {0 0 1 1.2 0 0 0 0} \
    {00000000-0000-0000-0000-000000000000\
        00000000-0000-0000-0000-000000000000\
        00000000-0000-0000-0000-000000000000\
        00000000-0000-0000-0000-000000000000\
        00000000-0000-0000-0000-000000000000\
        00060504-0000-0000-0000-000000000000\
        00000000-0000-0000-0000-000000000000\
        74f1f402-ddef-4027-a78f-3847fa97b830} \
    {0 0 1 0 0 0 0 0} \
    {0 0 1 0 0 0 0 0} \
    {0 0 1 0 0 0 0 0} \
    "none none none none three \x04\x05\x06\
        {2016-06-19 19:50:04.1234567}\
        74f1f402-ddef-4027-a78f-3847fa97b830" \
    {{} 0 1 1.2 three {4 5 6} {2016-06-19\
        19:50:04.1234567}\
        74f1f402-ddef-4027-a78f-3847fa97b830} \
    {System.Data.SQLite.SQLiteBlob System.Data.SQLite.SQLiteBlob\
        System.Data.SQLite.SQLiteBlob System.Data.SQLite.SQLiteBlob\
        System.Data.SQLite.SQLiteBlob System.Data.SQLite.SQLiteBlob\
        System.Data.SQLite.SQLiteBlob System.Data.SQLite.SQLiteBlob}]

###############################################################################

set savedDateTimeFormat [object invoke Interpreter.GetActive DateTimeFormat]

if {![isNonNullObjectHandle $savedDateTimeFormat]} then {
  set savedDateTimeFormat null
}

object invoke Interpreter.GetActive DateTimeFormat [getDateTimeFormat]

set savedDateTimeKind [object invoke Interpreter.GetActive DateTimeKind]
object invoke Interpreter.GetActive DateTimeKind Utc

###############################################################################

for {set i 0} {$i < [llength $params]} {incr i} {
  foreach {
    typeName methodName isArray propertyName isRequired value
  } [lindex $params $i] break

  set typeName [string map [list SDS. System.Data.SQLite.] $typeName]
  set expectedResult [lindex $expectedResults $i]

  #############################################################################

  proc readValueCallback2 $readArgs [subst {
    if {$isArray} then {
      if {\[catch {
        set dataOffset \[\$eventArgs ExtraEventArgs.DataOffset\]

        set buffer \[\$eventArgs -create [appendArgs ExtraEventArgs. \
            $typeName Buffer]\]

        set bufferOffset \[\$eventArgs ExtraEventArgs.BufferOffset\]
        set length \[\$eventArgs ExtraEventArgs.Length\]

        set readValue \[\$dataReader \[\$eventArgs MethodName\] \
            \$index \$dataOffset \$buffer \$bufferOffset \$length\]

        \$eventArgs \[appendArgs Value. $propertyName\] \$readValue
      } error\]} then {
        set readValue \[\$dataReader -tostring GetValue \$index\]

        if {"$typeName" eq "Char"} then {
          set string \[object create -alias String \$readValue\]
          set buffer \[\$string -create -alias ToCharArray]
        } else {
          set buffer \[object invoke -create -alias \
              System.Text.Encoding.UTF8 GetBytes \$readValue\]
        }

        \$eventArgs \[appendArgs Value. $propertyName\] \$buffer
        \$eventArgs ExtraEventArgs.Length \[\$buffer Length\]
      } else {
        set buffer \[\$eventArgs -create [appendArgs ExtraEventArgs. \
            $typeName Buffer]\]

        \$eventArgs \[appendArgs Value. $propertyName\] \$buffer
      }
    } else {
      if {\[catch {
        if {"$typeName" eq "System.Data.SQLite.SQLiteBlob"} then {
          set readValue \[object create -flags +NonPublic $typeName \
              null null\]
        } else {
          set readValue \[\$dataReader \[\$eventArgs MethodName\] \$index\]

          if {"$typeName" eq "Char"} then {
            set readValue \[object invoke -create Char Parse \$readValue\]
          }
        }

        \$eventArgs \[appendArgs Value. $propertyName\] \$readValue
      } error\]} then {
        \$eventArgs \[appendArgs Value. $propertyName\] {$value}
      }
    }

    upvar 1 \$completeVarName complete
    set complete \[object invoke -create System.Boolean Parse True\]
  }]

  #############################################################################

  runTest {test [appendArgs types-2. $i] [appendArgs $methodName " callback"] \
      -setup [subst -nocommands {
    set typeName {$typeName}
    set methodName {$methodName}
    set isArray {$isArray}

    setupDb [set fileName [appendArgs types-2. $i .db]] "" "" "" \
        UseConnectionReadValueCallbacks
  }] -body {
    sql execute $db {
      CREATE TABLE t1(x INTEGER, y SPECIAL);
      INSERT INTO t1 (x, y) VALUES(1, NULL);
      INSERT INTO t1 (x, y) VALUES(2, 0);
      INSERT INTO t1 (x, y) VALUES(3, 1);
      INSERT INTO t1 (x, y) VALUES(4, 1.2);
      INSERT INTO t1 (x, y) VALUES(5, 'three');
      INSERT INTO t1 (x, y) VALUES(6, X'040506');
      INSERT INTO t1 (x, y) VALUES(7, '2016-06-19 19:50:04.1234567');
      INSERT INTO t1 (x, y) VALUES(8, '74f1f402-ddef-4027-a78f-3847fa97b830');
    }

    set callback {-callbackflags +Default readValueCallback2}
    set connection [getDbConnection]

    set result [list]

    set typeCallbacks [object invoke -marshalflags +DynamicCallback \
        System.Data.SQLite.SQLiteTypeCallbacks Create null $callback \
        null null]

    $connection SetTypeCallbacks SPECIAL $typeCallbacks

    set dataReader [sql execute -execute reader -format datareader \
        -alias $db "SELECT y FROM t1 ORDER BY x;"]

    while {[$dataReader Read]} {
      if {$isArray} then {
        set buffer [object invoke \
            -create Array CreateInstance $typeName 100]

        if {[catch {
          $dataReader $methodName 0 0 $buffer 0 1
        } value] == 0} then {
          lappend result $value

          if {$value > 0} then {
            set list [object create -alias StringList $buffer]

            lappend result [object invoke StringList GetRange \
                $list 0 [expr {$value - 1}] false]
          }
        } else {
          lappend result [list error(array) $::errorCode]
        }
      } else {
        if {[catch {
          if {$typeName eq "System.Data.SQLite.SQLiteBlob"} then {
            $dataReader $methodName 0 true; # read-only
          } else {
            $dataReader $methodName 0
          }
        } value] == 0} then {
          if {[string length $value] == 0} then {
            lappend result <EMPTY>
          } elseif {$value eq "\x00"} then {
            lappend result <NUL>
          } else {
            lappend result [getStringFromObjectHandle $value]
          }
        } else {
          lappend result [list error(value) $::errorCode]
        }
      }
    }

    set result
  } -cleanup {
    catch {object removecallback $callback}

    unset -nocomplain dataReader
    freeDbConnection

    cleanupDb $fileName

    unset -nocomplain buffer typeCallbacks callback value list
    unset -nocomplain result connection db fileName
    unset -nocomplain typeName methodName isArray
  } -constraints {eagle command.object monoBug28 command.sql compile.DATA\
compile.EMIT SQLite System.Data.SQLite} -result $expectedResult}

  rename readValueCallback2 ""
}

###############################################################################

object invoke Interpreter.GetActive DateTimeFormat $savedDateTimeFormat
unset -nocomplain savedDateTimeFormat

object invoke Interpreter.GetActive DateTimeKind $savedDateTimeKind
unset -nocomplain savedDateTimeKind

###############################################################################

unset -nocomplain i readArgs params typeName methodName isArray propertyName \
    isRequired value expectedResults expectedResult

###############################################################################

runTest {test types-3.1 {bind callback (incomplete)} -setup {
  unset -nocomplain log

  setupDb [set fileName types-3.1.db] "" "" "" \
      "UseConnectionBindValueCallbacks UseParameterNameForTypeName"
} -body {
  sql execute $db {
    CREATE TABLE t1(x SPECIAL);
  }

  set callback {-callbackflags +Default bindValueCallback1}
  set connection [getDbConnection]

  set typeCallbacks [object invoke -marshalflags +DynamicCallback \
      System.Data.SQLite.SQLiteTypeCallbacks Create $callback null \
      0 null]

  $connection SetTypeCallbacks SPECIAL $typeCallbacks

  sql execute $db {
    INSERT INTO t1 (x) VALUES(?);
  } [list Special Int64 1234]

  set result [list]

  lappend result [expr {
    [info exists log(bind)] ? $log(bind) : "<MISSING>"
  }]

  lappend result [sql execute -execute reader -format list $db \
      "SELECT * FROM t1 ORDER BY x;"]

  set result
} -cleanup {
  catch {object removecallback $callback}

  freeDbConnection

  cleanupDb $fileName

  unset -nocomplain result typeCallbacks callback log connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA\
compile.EMIT SQLite System.Data.SQLite} -result {{{convert true} {command true}\
{flags {UseConnectionBindValueCallbacks, UseParameterNameForTypeName}}\
{parameter true} {typeName Special} {index 1} {userData 0}} 1234}}

###############################################################################

runTest {test types-3.2 {bind callback (complete)} -setup {
  unset -nocomplain log

  setupDb [set fileName types-3.2.db] "" "" "" \
      "UseConnectionBindValueCallbacks UseParameterNameForTypeName"
} -body {
  sql execute $db {
    CREATE TABLE t1(x SPECIAL);
  }

  set callback {-callbackflags +Default bindValueCallback1}
  set connection [getDbConnection]

  set typeCallbacks [object invoke -marshalflags +DynamicCallback \
      System.Data.SQLite.SQLiteTypeCallbacks Create $callback null \
      1 null]

  $connection SetTypeCallbacks SPECIAL $typeCallbacks

  sql execute $db {
    INSERT INTO t1 (x) VALUES(?);
  } [list Special Int64 5678]

  set result [list]

  lappend result [expr {
    [info exists log(bind)] ? $log(bind) : "<MISSING>"
  }]

  lappend result [sql execute -execute reader -format list $db \
      "SELECT * FROM t1 ORDER BY x;"]

  set result
} -cleanup {
  catch {object removecallback $callback}

  freeDbConnection

  cleanupDb $fileName

  unset -nocomplain result typeCallbacks callback log connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA\
compile.EMIT SQLite System.Data.SQLite} -result {{{convert true} {command true}\
{flags {UseConnectionBindValueCallbacks, UseParameterNameForTypeName}}\
{parameter true} {typeName Special} {index 1} {userData 1}} {}}}

###############################################################################

runTest {test types-3.3 {bind callback (modify/incomplete)} -setup {
  unset -nocomplain log

  setupDb [set fileName types-3.3.db] "" "" "" \
      "UseConnectionBindValueCallbacks UseParameterNameForTypeName"
} -body {
  sql execute $db {
    CREATE TABLE t1(x SPECIAL);
  }

  set callback {-callbackflags +Default bindValueCallback1}
  set connection [getDbConnection]

  set typeCallbacks [object invoke -marshalflags +DynamicCallback \
      System.Data.SQLite.SQLiteTypeCallbacks Create $callback null \
      2 null]

  $connection SetTypeCallbacks SPECIAL $typeCallbacks

  sql execute $db {
    INSERT INTO t1 (x) VALUES(?);
  } [list Special Int64 9999]

  set result [list]

  lappend result [expr {
    [info exists log(bind)] ? $log(bind) : "<MISSING>"
  }]

  lappend result [sql execute -execute reader -format list $db \
      "SELECT * FROM t1 ORDER BY x;"]

  set result
} -cleanup {
  catch {object removecallback $callback}

  freeDbConnection

  cleanupDb $fileName

  unset -nocomplain result typeCallbacks callback log connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA\
compile.EMIT SQLite System.Data.SQLite} -result {{{convert true} {command true}\
{flags {UseConnectionBindValueCallbacks, UseParameterNameForTypeName}}\
{parameter true} {typeName Special} {index 1} {userData 2}} custom}}

###############################################################################

runTest {test types-4.1 {read callback (exception)} -setup {
  unset -nocomplain log

  setupDb [set fileName types-4.1.db] "" "" "" \
      UseConnectionReadValueCallbacks
} -body {
  sql execute $db {
    CREATE TABLE t1(x SPECIAL);
    INSERT INTO t1 (x) VALUES(8888);
  }

  set callback {-callbackflags {+Default ThrowOnError} readValueCallback1}
  set connection [getDbConnection]

  set typeCallbacks [object invoke -marshalflags +DynamicCallback \
      System.Data.SQLite.SQLiteTypeCallbacks Create null $callback \
      null 3]

  $connection SetTypeCallbacks SPECIAL $typeCallbacks

  set result [list]

  lappend result [catch {
    sql execute -execute reader -format list $db {SELECT * FROM t1 ORDER BY x;}
  } error]

  lappend result [extractSystemDataSQLiteExceptionMessage $error]

  lappend result [catch {
    sql execute -execute scalar $db {SELECT COUNT(*) FROM t1;}
  } error]

  lappend result [extractSystemDataSQLiteExceptionMessage $error]
  lappend result [expr {[info exists log(read)] ? $log(read) : "<MISSING>"}]

  set result
} -cleanup {
  catch {object removecallback $callback}

  freeDbConnection

  cleanupDb $fileName

  unset -nocomplain error result typeCallbacks callback log connection db \
      fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA\
compile.EMIT SQLite System.Data.SQLite} -result {1 {reading of value canceled}\
0 1 {{convert true} {dataReader true} {flags UseConnectionReadValueCallbacks}\
{eventArgs true} {typeName SPECIAL} {index 0} {userData 3}}}}

###############################################################################

runTest {test types-5.1 {bind callback (exception)} -setup {
  unset -nocomplain log

  setupDb [set fileName types-5.1.db] "" "" "" \
      "UseConnectionBindValueCallbacks UseParameterNameForTypeName"
} -body {
  sql execute $db {
    CREATE TABLE t1(x SPECIAL);
  }

  set callback {-callbackflags {+Default ThrowOnError} bindValueCallback1}
  set connection [getDbConnection]

  set typeCallbacks [object invoke -marshalflags +DynamicCallback \
      System.Data.SQLite.SQLiteTypeCallbacks Create $callback null \
      3 null]

  $connection SetTypeCallbacks SPECIAL $typeCallbacks

  catch {
    sql execute $db {
      INSERT INTO t1 (x) VALUES(?);
    } [list Special Int64 4321]
  }

  set result [list]

  lappend result [expr {
    [info exists log(bind)] ? $log(bind) : "<MISSING>"
  }]

  lappend result [sql execute -execute reader -format list $db \
      "SELECT * FROM t1 ORDER BY x;"]

  set result
} -cleanup {
  catch {object removecallback $callback}

  freeDbConnection

  cleanupDb $fileName

  unset -nocomplain result typeCallbacks callback log connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA\
compile.EMIT SQLite System.Data.SQLite} -result {{{convert true} {command true}\
{flags {UseConnectionBindValueCallbacks, UseParameterNameForTypeName}}\
{parameter true} {typeName Special} {index 1} {userData 3}} {}}}

###############################################################################

catch {eval object dispose [info objects System#Boolean#*]}

###############################################################################

rename readValueCallback1 ""
rename bindValueCallback1 ""

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Added Tests/version.eagle.

























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
###############################################################################
#
# version.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue
runSQLiteTestFilesPrologue

###############################################################################
# ******************** BEGIN VOLATILE VERSION INFORMATION *********************
###############################################################################

#
# NOTE: For these unit tests to be useful and accurate, the following version
#       numbers must be manually kept synchronized with the version numbers for
#       the source code files, the built binaries, and the release packages.
#       The revision number is reserved for NuGet package versioning.
#
set version(major)             1
set version(minor)             0
set version(build)           119; # NOTE: Normally incremented per release.
set version(revision)          0

###############################################################################

#
# NOTE: What is the full version of the included SQLite core library?  This
#       must be kept synchronized with the version numbers for the associated
#       source code and property files.
#
set version(core,full) 3.45.3.0
set version(core,short) 3.45.3
set version(core,tag) 3.45.3; # NOTE: May be "trunk" -OR- same as "short".

#
# NOTE: What is the full URI for the included SQLite core library version?
#
set version(core,uri) [appendArgs (?: \
    "https://www\\.sqlite\\.org/(?:draft/)?releaselog/" \
    [string map [list . _] $version(core,short)] "\\.html" | \
    "https://www\\.sqlite\\.org/src/info/\[0-9a-f\]{10,64}" \
    )]

###############################################################################

#
# NOTE: What is the full version of the EntityFramework NuGet package (which
#       is not [necessarily] the same version as the assembly itself) in use
#       by the System.Data.SQLite NuGet packages?
#
set version(ef6) 6.4.4

###############################################################################
# ********************* END VOLATILE VERSION INFORMATION **********************
###############################################################################

#
# NOTE: Build the full version number using the components setup above.  This
#       should not have to be changed.
#
set version(full) [appendArgs $version(major) . $version(minor) . \
                              $version(build) . $version(revision)]

###############################################################################

#
# NOTE: Build the version number regular expression used for the NuGet
#       packages.  This should be the same as the above version number,
#       with the exception of the revision, which may differ.
#
set version(nuget) [appendArgs $version(major) \\. $version(minor) \\. \
                               $version(build) \\. \\d+]

###############################################################################

set version(mm) [appendArgs $version(major) \\. $version(minor)]

###############################################################################

runTest {test version-1.1 {'System.Data.SQLite' binary version} -body {
  file version $systemDataSQLiteDllFile
} -constraints {eagle file_System.Data.SQLite.dll} -result $version(full)}

###############################################################################

runTest {test version-1.2 {'System.Data.SQLite' assembly version} -body {
  set assemblyName [object invoke -alias System.Reflection.AssemblyName \
      GetAssemblyName $systemDataSQLiteDllFile]

  $assemblyName Version.ToString
} -cleanup {
  unset -nocomplain assemblyName
} -constraints {eagle command.object file_System.Data.SQLite.dll} -result \
$version(full)}

###############################################################################

runTest {test version-1.3 {'System.Data.SQLite.Linq' binary version} -body {
  file version $systemDataSQLiteLinqDllFile
} -constraints {eagle file_System.Data.SQLite.Linq.dll} -result $version(full)}

###############################################################################

runTest {test version-1.4 {'System.Data.SQLite.Linq' assembly version} -body {
  set assemblyName [object invoke -alias System.Reflection.AssemblyName \
      GetAssemblyName $systemDataSQLiteLinqDllFile]

  $assemblyName Version.ToString
} -cleanup {
  unset -nocomplain assemblyName
} -constraints {eagle command.object file_System.Data.SQLite.Linq.dll} -result \
$version(full)}

###############################################################################

runTest {test version-1.5 {'System.Data.SQLite.EF6' binary version} -body {
  file version $systemDataSQLiteEf6DllFile
} -constraints {eagle file_System.Data.SQLite.EF6.dll} -result $version(full)}

###############################################################################

runTest {test version-1.6 {'System.Data.SQLite.EF6' assembly version} -body {
  set assemblyName [object invoke -alias System.Reflection.AssemblyName \
      GetAssemblyName $systemDataSQLiteEf6DllFile]

  $assemblyName Version.ToString
} -cleanup {
  unset -nocomplain assemblyName
} -constraints {eagle command.object file_System.Data.SQLite.EF6.dll} -result \
$version(full)}

###############################################################################

runTest {test version-1.7 {'SQLite.Designer' binary version} -body {
  file version $sqliteDesignerDllFile
} -constraints {eagle file_SQLite.Designer.dll} -result $version(full)}

###############################################################################

runTest {test version-1.8 {'SQLite.Designer' assembly version} -body {
  set assemblyName [object invoke -alias System.Reflection.AssemblyName \
      GetAssemblyName $sqliteDesignerDllFile]

  $assemblyName Version.ToString
} -cleanup {
  unset -nocomplain assemblyName
} -constraints {eagle command.object file_SQLite.Designer.dll} -result \
$version(full)}

###############################################################################

runTest {test version-1.9 {'test' binary version} -body {
  file version $testExeFile
} -constraints {eagle file_test.exe} -result $version(full)}

###############################################################################

runTest {test version-1.10 {'test' assembly version} -body {
  set assemblyName [object invoke -alias System.Reflection.AssemblyName \
      GetAssemblyName $testExeFile]

  $assemblyName Version.ToString
} -cleanup {
  unset -nocomplain assemblyName
} -constraints {eagle command.object file_test.exe} -result $version(full)}

###############################################################################

runTest {test version-1.11 {'testlinq' binary version} -body {
  file version $testLinqExeFile
} -constraints {eagle file_testlinq.exe} -result $version(full)}

###############################################################################

runTest {test version-1.12 {'testlinq' assembly version} -body {
  set assemblyName [object invoke -alias System.Reflection.AssemblyName \
      GetAssemblyName $testLinqExeFile]

  $assemblyName Version.ToString
} -cleanup {
  unset -nocomplain assemblyName
} -constraints {eagle command.object file_testlinq.exe} -result $version(full)}

###############################################################################

runTest {test version-1.13 {'testef6' binary version} -body {
  file version $testEf6ExeFile
} -constraints {eagle file_testef6.exe} -result $version(full)}

###############################################################################

runTest {test version-1.14 {'testef6' assembly version} -body {
  set assemblyName [object invoke -alias System.Reflection.AssemblyName \
      GetAssemblyName $testEf6ExeFile]

  $assemblyName Version.ToString
} -cleanup {
  unset -nocomplain assemblyName
} -constraints {eagle command.object file_testef6.exe} -result $version(full)}

###############################################################################

runTest {test version-1.15 {SQLiteVersion} -body {
  object invoke System.Data.SQLite.SQLiteConnection SQLiteVersion
} -constraints {eagle command.object SQLite System.Data.SQLite} -match regexp \
-result {^\d+\.\d+\.\d+(?:\.\d+)?$}}

###############################################################################

runTest {test version-1.16 {SQLiteSourceId} -body {
  object invoke System.Data.SQLite.SQLiteConnection SQLiteSourceId
} -constraints {eagle command.object SQLite System.Data.SQLite} -match regexp \
-result {^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} [0-9a-f]{40,64}(?:alt1|alt2)?$}}

###############################################################################

runTest {test version-1.17 {InteropVersion} -body {
  object invoke System.Data.SQLite.SQLiteConnection InteropVersion
} -constraints {eagle command.object SQLiteInterop System.Data.SQLite} -result \
$version(full)}

###############################################################################

runTest {test version-1.18 {InteropSourceId} -body {
  object invoke System.Data.SQLite.SQLiteConnection InteropSourceId
} -constraints {eagle command.object SQLiteInterop System.Data.SQLite} -match \
regexp -result {^[0-9a-f]{40,64}(?:alt1|alt2)? \d{4}-\d{2}-\d{2}\
\d{2}:\d{2}:\d{2} UTC$}}

###############################################################################

runTest {test version-1.19 {ProviderVersion} -body {
  object invoke System.Data.SQLite.SQLiteConnection ProviderVersion
} -constraints {eagle command.object System.Data.SQLite} -result $version(full)}

###############################################################################

runTest {test version-1.20 {ProviderSourceId} -body {
  #
  # NOTE: The ProviderSourceId property value may be null, which
  #       would result in an empty string being returned here.
  #
  object invoke System.Data.SQLite.SQLiteConnection ProviderSourceId
} -constraints {eagle command.object System.Data.SQLite} -match regexp -result \
{^(?:|[0-9a-f]{40,64}(?:alt1|alt2)? \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} UTC)$}}

###############################################################################

unset -nocomplain patterns

###############################################################################
# readme.htm
###############################################################################

lappend patterns \
    [appendArgs \
        "Using <a href=\"" $version(core,uri) "\">SQLite " \
        [string map [list . \\.] $version(core,tag)] \
        "(?: release branch)?" </a>] \
    [appendArgs \
        " to <a href=\"" $version(core,uri) "\">SQLite " \
        [string map [list . \\.] $version(core,tag)] \
        "(?: release branch)?" </a>] \
    [appendArgs Version " " [string map [list . \\.] $version(full)] " "] \
    [appendArgs <b> [string map [list . \\.] $version(full)] " - "] \
    [appendArgs Version= [string map [list . \\.] $version(full)] ,]

###############################################################################
# dbfactorysupport.html
###############################################################################

lappend patterns \
    [appendArgs Version= [string map [list . \\.] $version(full)] ,]

###############################################################################
# version.html
###############################################################################

lappend patterns \
    [appendArgs \
        " to <a href=\"" $version(core,uri) "\">SQLite " \
        [string map [list . \\.] $version(core,tag)] \
        "(?: release branch)?" </a>] \
    [appendArgs <b> [string map [list . \\.] $version(full)] " - "]

###############################################################################
# welcome.html
###############################################################################

lappend patterns \
    [appendArgs &quot\; [format %03d $version(build)] &quot\;]

###############################################################################
# SQLite.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>] \
    [appendArgs " targetFramework=\"net20\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.0\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.1\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net20\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.1\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\" version=\"\\\[" $version(nuget) \
        "\\\]\" "]

###############################################################################
# SQLite.Beta.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>] \
    [appendArgs " targetFramework=\"net20\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.0\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.1\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net20\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.1\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "]

###############################################################################
# SQLite.Core.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>] \
    [appendArgs " targetFramework=\"net20\".*? " \
        "id=\"Stub\\.System\\.Data\\.SQLite\\.Core\\.NetFramework\" " \
        "version=\"\\\[" $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"Stub\\.System\\.Data\\.SQLite\\.Core\\.NetFramework\" " \
        "version=\"\\\[" $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"Stub\\.System\\.Data\\.SQLite\\.Core\\.NetFramework\" " \
        "version=\"\\\[" $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"Stub\\.System\\.Data\\.SQLite\\.Core\\.NetFramework\" " \
        "version=\"\\\[" $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"Stub\\.System\\.Data\\.SQLite\\.Core\\.NetFramework\" " \
        "version=\"\\\[" $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.0\".*? " \
        "id=\"Stub\\.System\\.Data\\.SQLite\\.Core\\.NetStandard\" " \
        "version=\"\\\[" $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.1\".*? " \
        "id=\"Stub\\.System\\.Data\\.SQLite\\.Core\\.NetStandard\" " \
        "version=\"\\\[" $version(nuget) "\\\]\" "]

###############################################################################
# SQLite.Core.Beta.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>]

###############################################################################
# SQLite.Core.Test.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>]

###############################################################################
# SQLite.Core.MSIL.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>]

###############################################################################
# SQLite.Core.MSIL.Beta.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>]

###############################################################################
# SQLite.Core.MSIL.Test.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>]

###############################################################################
# SQLite.Core.NetFramework.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>]

###############################################################################
# SQLite.Core.NetStandard.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>]

###############################################################################
# SQLite.EF6.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"EntityFramework\" version=\"" [string map [list . \\.] \
        $version(ef6)] "\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"EntityFramework\" version=\"" [string map [list . \\.] \
        $version(ef6)] "\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"EntityFramework\" version=\"" [string map [list . \\.] \
        $version(ef6)] "\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"EntityFramework\" version=\"" [string map [list . \\.] \
        $version(ef6)] "\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.1\".*? " \
        "id=\"EntityFramework\" version=\"" [string map [list . \\.] \
        $version(ef6)] "\" "]

###############################################################################
# SQLite.EF6.Beta.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"EntityFramework\" version=\"" [string map [list . \\.] \
        $version(ef6)] "\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"EntityFramework\" version=\"" [string map [list . \\.] \
        $version(ef6)] "\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"EntityFramework\" version=\"" [string map [list . \\.] \
        $version(ef6)] "\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"EntityFramework\" version=\"" [string map [list . \\.] \
        $version(ef6)] "\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.1\".*? " \
        "id=\"EntityFramework\" version=\"" [string map [list . \\.] \
        $version(ef6)] "\" "]

###############################################################################
# SQLite.EF6.Test.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"EntityFramework\" version=\"" [string map [list . \\.] \
        $version(ef6)] "\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"EntityFramework\" version=\"" [string map [list . \\.] \
        $version(ef6)] "\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"EntityFramework\" version=\"" [string map [list . \\.] \
        $version(ef6)] "\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"EntityFramework\" version=\"" [string map [list . \\.] \
        $version(ef6)] "\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.1\".*? " \
        "id=\"EntityFramework\" version=\"" [string map [list . \\.] \
        $version(ef6)] "\" "]

###############################################################################
# SQLite.Linq.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>]

###############################################################################
# SQLite.Linq.Beta.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>]

###############################################################################
# SQLite.Linq.Test.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>]

###############################################################################
# SQLite.MSIL.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>] \
    [appendArgs " targetFramework=\"net20\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.0\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.1\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net20\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.1\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\" version=\"\\\[" $version(nuget) \
        "\\\]\" "]

###############################################################################
# SQLite.MSIL.Beta.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>] \
    [appendArgs " targetFramework=\"net20\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.0\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.1\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net20\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.1\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Beta\" version=\"\\\[" \
        $version(nuget) "\\\]\" "]

###############################################################################
# SQLite.MSIL.Test.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>] \
    [appendArgs " targetFramework=\"net20\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.0\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.1\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.MSIL\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net20\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.1\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "]

###############################################################################
# SQLite.Test.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>] \
    [appendArgs " targetFramework=\"net20\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.0\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.1\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Core\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net20\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.0\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "] \
    [appendArgs " targetFramework=\"netstandard2\\.1\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\\.Test\" version=\"\\\[" \
        $version(nuget) "\\\]\" "]

###############################################################################
# SQLite.x64.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>] \
    [appendArgs " targetFramework=\"net20\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\" version=\"\\\[" $version(nuget) \
        "\\\]\" "]

###############################################################################
# SQLite.x86.nuspec
###############################################################################

lappend patterns \
    [appendArgs <version> $version(nuget) </version>] \
    [appendArgs " targetFramework=\"net20\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.Linq\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net40\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net45\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net451\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\" version=\"\\\[" $version(nuget) \
        "\\\]\" "] \
    [appendArgs " targetFramework=\"net46\".*? " \
        "id=\"System\\.Data\\.SQLite\\.EF6\" version=\"\\\[" $version(nuget) \
        "\\\]\" "]

###############################################################################
# SQLite.Designer/AssemblyInfo.cs
###############################################################################

lappend patterns \
    [appendArgs AssemblyVersion\\(\" [string map [list . \\.] \
        $version(full)] \"\\)] \
    [appendArgs AssemblyFileVersion\\(\" [string map [list . \\.] \
        $version(full)] \"\\)]

###############################################################################
# source.extension.vsixmanifest
###############################################################################

lappend patterns \
    [appendArgs <Version> [string map [list . \\.] \
        $version(full)] </Version>]

###############################################################################
# SQLite.Interop.2005.vsprops
###############################################################################

lappend patterns \
    [appendArgs Value=\" [format %03d $version(build)] \"] \
    [appendArgs Value=\" [string map [list . \\.] $version(full)] \"] \
    [appendArgs Value=\" [string map [list . ,] $version(full)] \"]

###############################################################################
# SQLite.Interop.2008.vsprops
###############################################################################

lappend patterns \
    [appendArgs Value=\" [format %03d $version(build)] \"] \
    [appendArgs Value=\" [string map [list . \\.] $version(full)] \"] \
    [appendArgs Value=\" [string map [list . ,] $version(full)] \"] \

###############################################################################
# SQLite.Interop.2010.props
###############################################################################

lappend patterns \
    [appendArgs <INTEROP_BUILD_NUMBER> [format %03d $version(build)] \
        </INTEROP_BUILD_NUMBER>] \
    [appendArgs <INTEROP_MANIFEST_VERSION> [string map [list . \\.] \
        $version(full)] </INTEROP_MANIFEST_VERSION>] \
    [appendArgs <INTEROP_RC_VERSION> [string map [list . ,] \
        $version(full)] </INTEROP_RC_VERSION>]

###############################################################################
# SQLite.Interop.2012.props
###############################################################################

lappend patterns \
    [appendArgs <INTEROP_BUILD_NUMBER> [format %03d $version(build)] \
        </INTEROP_BUILD_NUMBER>] \
    [appendArgs <INTEROP_MANIFEST_VERSION> [string map [list . \\.] \
        $version(full)] </INTEROP_MANIFEST_VERSION>] \
    [appendArgs <INTEROP_RC_VERSION> [string map [list . ,] \
        $version(full)] </INTEROP_RC_VERSION>]

###############################################################################
# SQLite.Interop.2013.props
###############################################################################

lappend patterns \
    [appendArgs <INTEROP_BUILD_NUMBER> [format %03d $version(build)] \
        </INTEROP_BUILD_NUMBER>] \
    [appendArgs <INTEROP_MANIFEST_VERSION> [string map [list . \\.] \
        $version(full)] </INTEROP_MANIFEST_VERSION>] \
    [appendArgs <INTEROP_RC_VERSION> [string map [list . ,] \
        $version(full)] </INTEROP_RC_VERSION>]

###############################################################################
# SQLite.Interop.2015.props
###############################################################################

lappend patterns \
    [appendArgs <INTEROP_BUILD_NUMBER> [format %03d $version(build)] \
        </INTEROP_BUILD_NUMBER>] \
    [appendArgs <INTEROP_MANIFEST_VERSION> [string map [list . \\.] \
        $version(full)] </INTEROP_MANIFEST_VERSION>] \
    [appendArgs <INTEROP_RC_VERSION> [string map [list . ,] \
        $version(full)] </INTEROP_RC_VERSION>]

###############################################################################
# SQLite.Interop.2017.props
###############################################################################

lappend patterns \
    [appendArgs <INTEROP_BUILD_NUMBER> [format %03d $version(build)] \
        </INTEROP_BUILD_NUMBER>] \
    [appendArgs <INTEROP_MANIFEST_VERSION> [string map [list . \\.] \
        $version(full)] </INTEROP_MANIFEST_VERSION>] \
    [appendArgs <INTEROP_RC_VERSION> [string map [list . ,] \
        $version(full)] </INTEROP_RC_VERSION>]

###############################################################################
# sqlite3.props
###############################################################################

lappend patterns \
    [appendArgs <SQLITE_MANIFEST_VERSION> [string map [list . \\.] \
        $version(core,full)] </SQLITE_MANIFEST_VERSION>] \
    [appendArgs <SQLITE_RC_VERSION> [string map [list . ,] \
        $version(core,full)] </SQLITE_RC_VERSION>]

###############################################################################
# sqlite3.vsprops
###############################################################################

lappend patterns \
    [appendArgs Value=\" [string map [list . \\.] $version(core,full)] \"] \
    [appendArgs Value=\" [string map [list . ,] $version(core,full)] \"]

###############################################################################
# interop.h
###############################################################################

lappend patterns \
    [appendArgs \" [string map [list . \\.] $version(full)] \"]

###############################################################################
# System.Data.SQLite/AssemblyInfo.cs
###############################################################################

lappend patterns \
    [appendArgs AssemblyVersion\\(\" [string map [list . \\.] \
        $version(full)] \"\\)] \
    [appendArgs AssemblyFileVersion\\(\" [string map [list . \\.] \
        $version(full)] \"\\)]

###############################################################################
# SQLite3.cs
###############################################################################

lappend patterns \
    [appendArgs \" [string map [list . \\.] $version(full)] \"]

###############################################################################
# UnsafeNativeMethods.cs
###############################################################################

lappend patterns \
    [appendArgs \"SQLite.Interop. [format %03d $version(build)] .dll\"]

###############################################################################
# System.Data.SQLite.Linq/AssemblyInfo.cs
###############################################################################

lappend patterns \
    [appendArgs AssemblyVersion\\(\" [string map [list . \\.] \
        $version(full)] \"\\)] \
    [appendArgs AssemblyFileVersion\\(\" [string map [list . \\.] \
        $version(full)] \"\\)]

###############################################################################
# test/AssemblyInfo.cs
###############################################################################

lappend patterns \
    [appendArgs AssemblyVersion\\(\" [string map [list . \\.] \
        $version(full)] \"\\)] \
    [appendArgs AssemblyFileVersion\\(\" [string map [list . \\.] \
        $version(full)] \"\\)]

###############################################################################
# test/app.config
###############################################################################

lappend patterns \
    [appendArgs Version= [string map [list . \\.] $version(full)] ,]

###############################################################################
# testce/AssemblyInfo.cs
###############################################################################

lappend patterns \
    [appendArgs AssemblyVersion\\(\" [string map [list . \\.] \
        $version(full)] \"\\)] \
    [appendArgs AssemblyFileVersion\\(\" [string map [list . \\.] \
        $version(full)] \"\\)]

###############################################################################
# 2008/LINQ/App.config
###############################################################################

lappend patterns \
    [appendArgs \
        "SQLiteProviderFactory, System\\.Data\\.SQLite\\.Linq, " \
        "Version=" [string map [list . \\.] $version(full)] ,]

###############################################################################
# 2010/EF6/App.config
###############################################################################

lappend patterns \
    [appendArgs \
        "SQLiteProviderFactory, System\\.Data\\.SQLite\\.EF6, " \
        "Version=" [string map [list . \\.] $version(full)] ,] \
    [appendArgs \
        "SQLiteProviderServices, System\\.Data\\.SQLite\\.EF6, " \
        "Version=" [string map [list . \\.] $version(full)] ,]

###############################################################################
# 2010/LINQ/App.config
###############################################################################

lappend patterns \
    [appendArgs \
        "SQLiteProviderFactory, System\\.Data\\.SQLite\\.Linq, " \
        "Version=" [string map [list . \\.] $version(full)] ,]

###############################################################################
# 2012/EF6/App.config
###############################################################################

lappend patterns \
    [appendArgs \
        "SQLiteProviderFactory, System\\.Data\\.SQLite\\.EF6, " \
        "Version=" [string map [list . \\.] $version(full)] ,] \
    [appendArgs \
        "SQLiteProviderServices, System\\.Data\\.SQLite\\.EF6, " \
        "Version=" [string map [list . \\.] $version(full)] ,]

###############################################################################
# 2012/LINQ/App.config
###############################################################################

lappend patterns \
    [appendArgs \
        "SQLiteProviderFactory, System\\.Data\\.SQLite\\.Linq, " \
        "Version=" [string map [list . \\.] $version(full)] ,]

###############################################################################
# 2013/EF6/App.config
###############################################################################

lappend patterns \
    [appendArgs \
        "SQLiteProviderFactory, System\\.Data\\.SQLite\\.EF6, " \
        "Version=" [string map [list . \\.] $version(full)] ,] \
    [appendArgs \
        "SQLiteProviderServices, System\\.Data\\.SQLite\\.EF6, " \
        "Version=" [string map [list . \\.] $version(full)] ,]

###############################################################################
# 2013/LINQ/App.config
###############################################################################

lappend patterns \
    [appendArgs \
        "SQLiteProviderFactory, System\\.Data\\.SQLite\\.Linq, " \
        "Version=" [string map [list . \\.] $version(full)] ,]

###############################################################################
# 2015/EF6/App.config
###############################################################################

lappend patterns \
    [appendArgs \
        "SQLiteProviderFactory, System\\.Data\\.SQLite\\.EF6, " \
        "Version=" [string map [list . \\.] $version(full)] ,] \
    [appendArgs \
        "SQLiteProviderServices, System\\.Data\\.SQLite\\.EF6, " \
        "Version=" [string map [list . \\.] $version(full)] ,]

###############################################################################
# 2015/LINQ/App.config
###############################################################################

lappend patterns \
    [appendArgs \
        "SQLiteProviderFactory, System\\.Data\\.SQLite\\.Linq, " \
        "Version=" [string map [list . \\.] $version(full)] ,]

###############################################################################
# 2017/EF6/App.config
###############################################################################

lappend patterns \
    [appendArgs \
        "SQLiteProviderFactory, System\\.Data\\.SQLite\\.EF6, " \
        "Version=" [string map [list . \\.] $version(full)] ,] \
    [appendArgs \
        "SQLiteProviderServices, System\\.Data\\.SQLite\\.EF6, " \
        "Version=" [string map [list . \\.] $version(full)] ,]

###############################################################################
# 2017/LINQ/App.config
###############################################################################

lappend patterns \
    [appendArgs \
        "SQLiteProviderFactory, System\\.Data\\.SQLite\\.Linq, " \
        "Version=" [string map [list . \\.] $version(full)] ,]

###############################################################################
# NetStandard21/EF6/App.config
###############################################################################

lappend patterns \
    [appendArgs \
        "SQLiteProviderServices, System\\.Data\\.SQLite\\.EF6, " \
        "Version=" [string map [list . \\.] $version(full)] ,]

###############################################################################
# testlinq/Properties/AssemblyInfo.cs
###############################################################################

lappend patterns \
    [appendArgs AssemblyVersion\\(\" [string map [list . \\.] \
        $version(full)] \"\\)] \
    [appendArgs AssemblyFileVersion\\(\" [string map [list . \\.] \
        $version(full)] \"\\)]

###############################################################################
# tools/install/Properties/AssemblyInfo.cs
###############################################################################

lappend patterns \
    [appendArgs AssemblyVersion\\(\" [string map [list . \\.] \
        $version(full)] \"\\)] \
    [appendArgs AssemblyFileVersion\\(\" [string map [list . \\.] \
        $version(full)] \"\\)]

###############################################################################
# news.wiki
###############################################################################

lappend patterns \
    [appendArgs " to \\\[" $version(core,uri) "\\\|SQLite " \
        [string map [list . \\.] $version(core,tag)] \
        "(?: release branch)?" \\\]] \
    [appendArgs <b> [string map [list . \\.] $version(full)] " - "]

###############################################################################

set fileNames [list \
    readme.htm \
    readme.htm \
    readme.htm \
    readme.htm \
    readme.htm \
    [file join Doc Extra Provider dbfactorysupport.html] \
    [file join Doc Extra Provider version.html] \
    [file join Doc Extra Provider version.html] \
    [file join Doc Extra Provider welcome.html] \
    [file join NuGet SQLite.nuspec] \
    [file join NuGet SQLite.nuspec] \
    [file join NuGet SQLite.nuspec] \
    [file join NuGet SQLite.nuspec] \
    [file join NuGet SQLite.nuspec] \
    [file join NuGet SQLite.nuspec] \
    [file join NuGet SQLite.nuspec] \
    [file join NuGet SQLite.nuspec] \
    [file join NuGet SQLite.nuspec] \
    [file join NuGet SQLite.nuspec] \
    [file join NuGet SQLite.nuspec] \
    [file join NuGet SQLite.nuspec] \
    [file join NuGet SQLite.nuspec] \
    [file join NuGet SQLite.nuspec] \
    [file join NuGet SQLite.nuspec] \
    [file join NuGet SQLite.nuspec] \
    [file join NuGet SQLite.nuspec] \
    [file join NuGet SQLite.nuspec] \
    [file join NuGet SQLite.Beta.nuspec] \
    [file join NuGet SQLite.Beta.nuspec] \
    [file join NuGet SQLite.Beta.nuspec] \
    [file join NuGet SQLite.Beta.nuspec] \
    [file join NuGet SQLite.Beta.nuspec] \
    [file join NuGet SQLite.Beta.nuspec] \
    [file join NuGet SQLite.Beta.nuspec] \
    [file join NuGet SQLite.Beta.nuspec] \
    [file join NuGet SQLite.Beta.nuspec] \
    [file join NuGet SQLite.Beta.nuspec] \
    [file join NuGet SQLite.Beta.nuspec] \
    [file join NuGet SQLite.Beta.nuspec] \
    [file join NuGet SQLite.Beta.nuspec] \
    [file join NuGet SQLite.Beta.nuspec] \
    [file join NuGet SQLite.Beta.nuspec] \
    [file join NuGet SQLite.Beta.nuspec] \
    [file join NuGet SQLite.Beta.nuspec] \
    [file join NuGet SQLite.Beta.nuspec] \
    [file join NuGet SQLite.Core.nuspec] \
    [file join NuGet SQLite.Core.nuspec] \
    [file join NuGet SQLite.Core.nuspec] \
    [file join NuGet SQLite.Core.nuspec] \
    [file join NuGet SQLite.Core.nuspec] \
    [file join NuGet SQLite.Core.nuspec] \
    [file join NuGet SQLite.Core.nuspec] \
    [file join NuGet SQLite.Core.nuspec] \
    [file join NuGet SQLite.Core.Beta.nuspec] \
    [file join NuGet SQLite.Core.Test.nuspec] \
    [file join NuGet SQLite.Core.MSIL.nuspec] \
    [file join NuGet SQLite.Core.MSIL.Beta.nuspec] \
    [file join NuGet SQLite.Core.MSIL.Test.nuspec] \
    [file join NuGet SQLite.Core.NetFramework.nuspec] \
    [file join NuGet SQLite.Core.NetStandard.nuspec] \
    [file join NuGet SQLite.EF6.nuspec] \
    [file join NuGet SQLite.EF6.nuspec] \
    [file join NuGet SQLite.EF6.nuspec] \
    [file join NuGet SQLite.EF6.nuspec] \
    [file join NuGet SQLite.EF6.nuspec] \
    [file join NuGet SQLite.EF6.nuspec] \
    [file join NuGet SQLite.EF6.Beta.nuspec] \
    [file join NuGet SQLite.EF6.Beta.nuspec] \
    [file join NuGet SQLite.EF6.Beta.nuspec] \
    [file join NuGet SQLite.EF6.Beta.nuspec] \
    [file join NuGet SQLite.EF6.Beta.nuspec] \
    [file join NuGet SQLite.EF6.Beta.nuspec] \
    [file join NuGet SQLite.EF6.Test.nuspec] \
    [file join NuGet SQLite.EF6.Test.nuspec] \
    [file join NuGet SQLite.EF6.Test.nuspec] \
    [file join NuGet SQLite.EF6.Test.nuspec] \
    [file join NuGet SQLite.EF6.Test.nuspec] \
    [file join NuGet SQLite.EF6.Test.nuspec] \
    [file join NuGet SQLite.Linq.nuspec] \
    [file join NuGet SQLite.Linq.Beta.nuspec] \
    [file join NuGet SQLite.Linq.Test.nuspec] \
    [file join NuGet SQLite.MSIL.nuspec] \
    [file join NuGet SQLite.MSIL.nuspec] \
    [file join NuGet SQLite.MSIL.nuspec] \
    [file join NuGet SQLite.MSIL.nuspec] \
    [file join NuGet SQLite.MSIL.nuspec] \
    [file join NuGet SQLite.MSIL.nuspec] \
    [file join NuGet SQLite.MSIL.nuspec] \
    [file join NuGet SQLite.MSIL.nuspec] \
    [file join NuGet SQLite.MSIL.nuspec] \
    [file join NuGet SQLite.MSIL.nuspec] \
    [file join NuGet SQLite.MSIL.nuspec] \
    [file join NuGet SQLite.MSIL.nuspec] \
    [file join NuGet SQLite.MSIL.nuspec] \
    [file join NuGet SQLite.MSIL.nuspec] \
    [file join NuGet SQLite.MSIL.nuspec] \
    [file join NuGet SQLite.MSIL.nuspec] \
    [file join NuGet SQLite.MSIL.nuspec] \
    [file join NuGet SQLite.MSIL.nuspec] \
    [file join NuGet SQLite.MSIL.Beta.nuspec] \
    [file join NuGet SQLite.MSIL.Beta.nuspec] \
    [file join NuGet SQLite.MSIL.Beta.nuspec] \
    [file join NuGet SQLite.MSIL.Beta.nuspec] \
    [file join NuGet SQLite.MSIL.Beta.nuspec] \
    [file join NuGet SQLite.MSIL.Beta.nuspec] \
    [file join NuGet SQLite.MSIL.Beta.nuspec] \
    [file join NuGet SQLite.MSIL.Beta.nuspec] \
    [file join NuGet SQLite.MSIL.Beta.nuspec] \
    [file join NuGet SQLite.MSIL.Beta.nuspec] \
    [file join NuGet SQLite.MSIL.Beta.nuspec] \
    [file join NuGet SQLite.MSIL.Beta.nuspec] \
    [file join NuGet SQLite.MSIL.Beta.nuspec] \
    [file join NuGet SQLite.MSIL.Beta.nuspec] \
    [file join NuGet SQLite.MSIL.Beta.nuspec] \
    [file join NuGet SQLite.MSIL.Beta.nuspec] \
    [file join NuGet SQLite.MSIL.Beta.nuspec] \
    [file join NuGet SQLite.MSIL.Beta.nuspec] \
    [file join NuGet SQLite.MSIL.Test.nuspec] \
    [file join NuGet SQLite.MSIL.Test.nuspec] \
    [file join NuGet SQLite.MSIL.Test.nuspec] \
    [file join NuGet SQLite.MSIL.Test.nuspec] \
    [file join NuGet SQLite.MSIL.Test.nuspec] \
    [file join NuGet SQLite.MSIL.Test.nuspec] \
    [file join NuGet SQLite.MSIL.Test.nuspec] \
    [file join NuGet SQLite.MSIL.Test.nuspec] \
    [file join NuGet SQLite.MSIL.Test.nuspec] \
    [file join NuGet SQLite.MSIL.Test.nuspec] \
    [file join NuGet SQLite.MSIL.Test.nuspec] \
    [file join NuGet SQLite.MSIL.Test.nuspec] \
    [file join NuGet SQLite.MSIL.Test.nuspec] \
    [file join NuGet SQLite.MSIL.Test.nuspec] \
    [file join NuGet SQLite.MSIL.Test.nuspec] \
    [file join NuGet SQLite.MSIL.Test.nuspec] \
    [file join NuGet SQLite.MSIL.Test.nuspec] \
    [file join NuGet SQLite.MSIL.Test.nuspec] \
    [file join NuGet SQLite.Test.nuspec] \
    [file join NuGet SQLite.Test.nuspec] \
    [file join NuGet SQLite.Test.nuspec] \
    [file join NuGet SQLite.Test.nuspec] \
    [file join NuGet SQLite.Test.nuspec] \
    [file join NuGet SQLite.Test.nuspec] \
    [file join NuGet SQLite.Test.nuspec] \
    [file join NuGet SQLite.Test.nuspec] \
    [file join NuGet SQLite.Test.nuspec] \
    [file join NuGet SQLite.Test.nuspec] \
    [file join NuGet SQLite.Test.nuspec] \
    [file join NuGet SQLite.Test.nuspec] \
    [file join NuGet SQLite.Test.nuspec] \
    [file join NuGet SQLite.Test.nuspec] \
    [file join NuGet SQLite.Test.nuspec] \
    [file join NuGet SQLite.Test.nuspec] \
    [file join NuGet SQLite.Test.nuspec] \
    [file join NuGet SQLite.Test.nuspec] \
    [file join NuGet SQLite.Test.nuspec] \
    [file join NuGet SQLite.x64.nuspec] \
    [file join NuGet SQLite.x64.nuspec] \
    [file join NuGet SQLite.x64.nuspec] \
    [file join NuGet SQLite.x64.nuspec] \
    [file join NuGet SQLite.x64.nuspec] \
    [file join NuGet SQLite.x64.nuspec] \
    [file join NuGet SQLite.x64.nuspec] \
    [file join NuGet SQLite.x64.nuspec] \
    [file join NuGet SQLite.x64.nuspec] \
    [file join NuGet SQLite.x64.nuspec] \
    [file join NuGet SQLite.x86.nuspec] \
    [file join NuGet SQLite.x86.nuspec] \
    [file join NuGet SQLite.x86.nuspec] \
    [file join NuGet SQLite.x86.nuspec] \
    [file join NuGet SQLite.x86.nuspec] \
    [file join NuGet SQLite.x86.nuspec] \
    [file join NuGet SQLite.x86.nuspec] \
    [file join NuGet SQLite.x86.nuspec] \
    [file join NuGet SQLite.x86.nuspec] \
    [file join NuGet SQLite.x86.nuspec] \
    [file join SQLite.Designer AssemblyInfo.cs] \
    [file join SQLite.Designer AssemblyInfo.cs] \
    [file join SQLite.Designer source.extension.vsixmanifest] \
    [file join SQLite.Interop props SQLite.Interop.2005.vsprops] \
    [file join SQLite.Interop props SQLite.Interop.2005.vsprops] \
    [file join SQLite.Interop props SQLite.Interop.2005.vsprops] \
    [file join SQLite.Interop props SQLite.Interop.2008.vsprops] \
    [file join SQLite.Interop props SQLite.Interop.2008.vsprops] \
    [file join SQLite.Interop props SQLite.Interop.2008.vsprops] \
    [file join SQLite.Interop props SQLite.Interop.2010.props] \
    [file join SQLite.Interop props SQLite.Interop.2010.props] \
    [file join SQLite.Interop props SQLite.Interop.2010.props] \
    [file join SQLite.Interop props SQLite.Interop.2012.props] \
    [file join SQLite.Interop props SQLite.Interop.2012.props] \
    [file join SQLite.Interop props SQLite.Interop.2012.props] \
    [file join SQLite.Interop props SQLite.Interop.2013.props] \
    [file join SQLite.Interop props SQLite.Interop.2013.props] \
    [file join SQLite.Interop props SQLite.Interop.2013.props] \
    [file join SQLite.Interop props SQLite.Interop.2015.props] \
    [file join SQLite.Interop props SQLite.Interop.2015.props] \
    [file join SQLite.Interop props SQLite.Interop.2015.props] \
    [file join SQLite.Interop props SQLite.Interop.2017.props] \
    [file join SQLite.Interop props SQLite.Interop.2017.props] \
    [file join SQLite.Interop props SQLite.Interop.2017.props] \
    [file join SQLite.Interop props sqlite3.props] \
    [file join SQLite.Interop props sqlite3.props] \
    [file join SQLite.Interop props sqlite3.vsprops] \
    [file join SQLite.Interop props sqlite3.vsprops] \
    [file join SQLite.Interop src generic interop.h] \
    [file join System.Data.SQLite AssemblyInfo.cs] \
    [file join System.Data.SQLite AssemblyInfo.cs] \
    [file join System.Data.SQLite SQLite3.cs] \
    [file join System.Data.SQLite UnsafeNativeMethods.cs] \
    [file join System.Data.SQLite.Linq AssemblyInfo.cs] \
    [file join System.Data.SQLite.Linq AssemblyInfo.cs] \
    [file join test AssemblyInfo.cs] \
    [file join test AssemblyInfo.cs] \
    [file join test app.config] \
    [file join testce AssemblyInfo.cs] \
    [file join testce AssemblyInfo.cs] \
    [file join testlinq 2008 LINQ App.config] \
    [file join testlinq 2010 EF6 App.config] \
    [file join testlinq 2010 EF6 App.config] \
    [file join testlinq 2010 LINQ App.config] \
    [file join testlinq 2012 EF6 App.config] \
    [file join testlinq 2012 EF6 App.config] \
    [file join testlinq 2012 LINQ App.config] \
    [file join testlinq 2013 EF6 App.config] \
    [file join testlinq 2013 EF6 App.config] \
    [file join testlinq 2013 LINQ App.config] \
    [file join testlinq 2015 EF6 App.config] \
    [file join testlinq 2015 EF6 App.config] \
    [file join testlinq 2015 LINQ App.config] \
    [file join testlinq 2017 EF6 App.config] \
    [file join testlinq 2017 EF6 App.config] \
    [file join testlinq 2017 LINQ App.config] \
    [file join testlinq NetStandard21 EF6 App.config] \
    [file join testlinq Properties AssemblyInfo.cs] \
    [file join testlinq Properties AssemblyInfo.cs] \
    [file join tools install Properties AssemblyInfo.cs] \
    [file join tools install Properties AssemblyInfo.cs] \
    [file join www news.wiki] \
    [file join www news.wiki]]

if {[llength $patterns] == [llength $fileNames]} then {
  for {set i 1} {$i <= [llength $fileNames]} {incr i} {
    set pattern [lindex $patterns [expr {$i - 1}]]
    set fileName [lindex $fileNames [expr {$i - 1}]]
    set constraint [string map [list / _ \\ _] $fileName]
    set fileName [file nativename [file join $root_path $fileName]]

    if {![haveConstraint [appendArgs file_ $constraint]]} then {
      checkForFile $test_channel $fileName $constraint; # EXEMPT: Dynamic.
    }

    runTest {test [appendArgs version-1.21. $i] \
        [appendArgs "pattern {" $pattern "} in file \"" $fileName \"] -body {
      if {[hasRuntimeOption verbose]} then {
        tputs $test_channel [appendArgs \
            "---- checking pattern {" $pattern "} against file \"" \
            $fileName \"...\n]
      }
      regexp -- $pattern [readFile $fileName]
    } -constraints [list eagle [appendArgs file_ $constraint]] -result {1}}
  }
} else {
  tputs $test_channel [appendArgs \
      "---- number of regular expression patterns " [llength $patterns] \
      " does not match number of file names " [llength $fileNames] \n]
}

###############################################################################

unset -nocomplain constraint fileName pattern fileNames patterns i version

###############################################################################

runSQLiteTestFilesEpilogue
runSQLiteTestEpilogue
runTestEpilogue

Added Tests/vtab.eagle.























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
###############################################################################
#
# vtab.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

package require Eagle
package require Eagle.Library
package require Eagle.Test

runTestPrologue

###############################################################################

package require System.Data.SQLite.Test
runSQLiteTestPrologue

###############################################################################

proc normalizeVtabResult { value } {
  set result $value

  if {[string first \r $result] != -1} then {
    set result [string map [list \r\n \n] $result]
  }

  return [string map [list \n " -- "] $result]
}

###############################################################################

runTest {test vtab-1.1 {basic virtual table support} -setup {
  set fileName vtab-1.1.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql { \
    CREATE VIRTUAL TABLE t${id} USING mod${id}; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public sealed class SQLiteModuleTest${id} : SQLiteModuleNoop
      {
        public SQLiteModuleTest${id}(string name)
          : base(name)
        {
          // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////

        public override SQLiteErrorCode Create(
          SQLiteConnection connection,
          IntPtr pClientData,
          string\[\] arguments,
          ref SQLiteVirtualTable table,
          ref string error
          )
        {
          SQLiteErrorCode rc = DeclareTable(
            connection, "CREATE TABLE ignored(x);", ref error);

          if (rc != SQLiteErrorCode.Ok)
            return rc;

          table = new SQLiteVirtualTable(arguments);
          return SQLiteErrorCode.Ok;
        }
      }

      /////////////////////////////////////////////////////////////////////////

      public static class Test${id}
      {
        public static void Main()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();
            connection.CreateModule(new SQLiteModuleTest${id}("mod${id}"));

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql}]";
              command.ExecuteNonQuery();
            }

            connection.Close();
          }
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} Main
      } result] : [set result ""]}] [normalizeVtabResult $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id fileName
} -constraints {eagle command.object monoBug28 monoCrash211 command.sql\
compile.DATA SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE compileCSharp} -match \
regexp -result [normalizeVtabResult {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\}$}]}

###############################################################################

runTest {test vtab-1.2.1 {IEnumerable virtual table} -setup {
  set fileName vtab-1.2.1.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql(1) { \
    CREATE VIRTUAL TABLE t${id} USING mod${id}; \
  }

  set sql(2) { \
    SELECT * FROM t${id}; \
  }

  set sql(3) { \
    UPDATE t${id} SET x = 1; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using Eagle._Containers.Public;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static StringList GetList(params string\[\] strings)
        {
          StringList result = new StringList();

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            connection.CreateModule(new SQLiteModuleEnumerable(
              "mod${id}", strings));

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(1)}]";
              command.ExecuteNonQuery();
            }

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(2)}]";

              using (SQLiteDataReader dataReader = command.ExecuteReader())
              {
                while (dataReader.Read())
                  result.Add(dataReader\[0\].ToString());
              }
            }

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(3)}]";

              try
              {
                command.ExecuteNonQuery();
              }
              catch (SQLiteException e)
              {
                result.Add(e.ResultCode.ToString());
                result.Add(e.Message);
              }
            }

            connection.Close();
          }

          return result;
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll Eagle.dll]]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetList one two three 4 5.0
      } result] : [set result ""]}] [normalizeVtabResult $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id fileName
} -constraints {eagle command.object monoBug28 monoCrash211 command.sql\
compile.DATA SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE compileCSharp} -match \
regexp -result [normalizeVtabResult {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{one two three 4 5\.0 Error\
\{SQL logic error( or missing database)? -- virtual table "t\d+" is\
read-only\}\}$}]}

###############################################################################

runTest {test vtab-1.2.2 {IEnumerable virtual table} -setup {
  set fileName vtab-1.2.2.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql(1) { \
    CREATE VIRTUAL TABLE t${id} USING mod${id}; \
  }

  set sql(2) { \
    SELECT * FROM t${id}; \
  }

  set sql(3) { \
    UPDATE t${id} SET x = 1; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using Eagle._Containers.Public;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static StringList GetList(params string\[\] strings)
        {
          StringList result = new StringList();

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            SQLiteModule module = new SQLiteModuleEnumerable(
                "mod${id}", strings);

            connection.CreateModule(module);

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(1)}]";
              command.ExecuteNonQuery();
            }

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(2)}]";

              using (SQLiteDataReader dataReader = command.ExecuteReader())
              {
                while (dataReader.Read())
                  result.Add(dataReader\[0\].ToString());
              }
            }

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(3)}]";

              try
              {
                command.ExecuteNonQuery();
              }
              catch (SQLiteException e)
              {
                result.Add(e.ResultCode.ToString());
                result.Add(e.Message);
              }
            }

            module.Dispose();
            connection.Close();
          }

          return result;
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll Eagle.dll]]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetList one two three 4 5.0
      } result] : [set result ""]}] [normalizeVtabResult $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id fileName
} -constraints {eagle command.object monoBug28 monoCrash211 command.sql\
compile.DATA SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE compileCSharp} -match \
regexp -result [normalizeVtabResult {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{one two three 4 5\.0 Error\
\{SQL logic error( or missing database)? -- virtual table "t\d+" is\
read-only\}\}$}]}

###############################################################################

runTest {test vtab-1.3.1 {IEnumerable<T> virtual table} -setup {
  set fileName vtab-1.3.1.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql(1) { \
    CREATE VIRTUAL TABLE t${id} USING mod${id}; \
  }

  set sql(2) { \
    SELECT * FROM t${id}; \
  }

  set sql(3) { \
    UPDATE t${id} SET x = 1; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using System.Data.SQLite.Generic;
    using Eagle._Containers.Public;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static StringList GetList(params int\[\] integers)
        {
          StringList result = new StringList();

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            connection.CreateModule(new SQLiteModuleEnumerable<int>(
              "mod${id}", integers));

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(1)}]";
              command.ExecuteNonQuery();
            }

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(2)}]";

              using (SQLiteDataReader dataReader = command.ExecuteReader())
              {
                while (dataReader.Read())
                  result.Add(dataReader\[0\].ToString());
              }
            }

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(3)}]";

              try
              {
                command.ExecuteNonQuery();
              }
              catch (SQLiteException e)
              {
                result.Add(e.ResultCode.ToString());
                result.Add(e.Message);
              }
            }

            connection.Close();
          }

          return result;
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll Eagle.dll]]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetList 1 2 3 4 5
      } result] : [set result ""]}] [normalizeVtabResult $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id fileName
} -constraints {eagle command.object monoBug28 monoCrash211 command.sql\
compile.DATA SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE compileCSharp} -match \
regexp -result [normalizeVtabResult {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{1 2 3 4 5 Error \{SQL\
logic error( or missing database)? -- virtual table "t\d+" is read-only\}\}$}]}

###############################################################################

runTest {test vtab-1.3.2 {IEnumerable<T> virtual table} -setup {
  set fileName vtab-1.3.2.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql(1) { \
    CREATE VIRTUAL TABLE t${id} USING mod${id}; \
  }

  set sql(2) { \
    SELECT * FROM t${id}; \
  }

  set sql(3) { \
    UPDATE t${id} SET x = 1; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using System.Data.SQLite.Generic;
    using Eagle._Containers.Public;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static StringList GetList(params int\[\] integers)
        {
          StringList result = new StringList();

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            SQLiteModule module = new SQLiteModuleEnumerable<int>(
                "mod${id}", integers);

            connection.CreateModule(module);

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(1)}]";
              command.ExecuteNonQuery();
            }

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(2)}]";

              using (SQLiteDataReader dataReader = command.ExecuteReader())
              {
                while (dataReader.Read())
                  result.Add(dataReader\[0\].ToString());
              }
            }

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(3)}]";

              try
              {
                command.ExecuteNonQuery();
              }
              catch (SQLiteException e)
              {
                result.Add(e.ResultCode.ToString());
                result.Add(e.Message);
              }
            }

            module.Dispose();
            connection.Close();
          }

          return result;
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll Eagle.dll]]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetList 1 2 3 4 5
      } result] : [set result ""]}] [normalizeVtabResult $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id fileName
} -constraints {eagle command.object monoBug28 monoCrash211 command.sql\
compile.DATA SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE compileCSharp} -match \
regexp -result [normalizeVtabResult {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{1 2 3 4 5 Error \{SQL\
logic error( or missing database)? -- virtual table "t\d+" is read-only\}\}$}]}

###############################################################################

runTest {test vtab-1.4 {virtual table function support} -setup {
  set fileName vtab-1.4.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql(1) { \
    CREATE VIRTUAL TABLE t${id} USING mod${id}; \
  }

  set sql(2) { \
    SELECT Base64(x, CAST('one' AS BLOB)) FROM t${id}; \
  }

  set sql(3) { \
    SELECT Base64(x, CAST('one' AS BLOB), 'two') FROM t${id}; \
  }

  set sql(4) { \
    SELECT Base65(x, CAST('one' AS BLOB)) FROM t${id}; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using Eagle._Containers.Public;

    namespace _Dynamic${id}
    {
      public class SQLiteFunction${id} : SQLiteFunction
      {
        public SQLiteFunction${id}()
          : base(SQLiteDateFormats.Default, DateTimeKind.Unspecified,
                 null, false)
        {
          // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////

        public override object Invoke(
          object\[\] args
          )
        {
          if (args == null)
            return null;

          if (args.Length != 2)
            return new ArgumentException(String.Format(
              "need exactly two arguments, got {0}", args.Length));

          object arg = args\[1\];

          if (arg == null)
            return String.Empty;

          Type type = arg.GetType();

          if (type == typeof(DBNull))
            return String.Empty;

          if (type != typeof(byte\[\]))
            return new ArgumentException(String.Format(
              "argument must be byte array, got {0}", type));

          return Convert.ToBase64String((byte\[\]) arg);
        }
      }

      /////////////////////////////////////////////////////////////////////////

      public sealed class SQLiteModuleTest${id} : SQLiteModuleNoop
      {
        public SQLiteModuleTest${id}(string name)
          : base(name)
        {
          // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////

        public override SQLiteErrorCode Create(
          SQLiteConnection connection,
          IntPtr pClientData,
          string\[\] arguments,
          ref SQLiteVirtualTable table,
          ref string error
          )
        {
          SQLiteErrorCode rc = DeclareTable(
            connection, "CREATE TABLE ignored(x);", ref error);

          if (rc != SQLiteErrorCode.Ok)
            return rc;

          rc = DeclareFunction(connection, -1, "Base64", ref error);

          if (rc != SQLiteErrorCode.Ok)
            return rc;

          table = new SQLiteVirtualTable(arguments);
          return SQLiteErrorCode.Ok;
        }

        ///////////////////////////////////////////////////////////////////////

        public override SQLiteErrorCode Open(
          SQLiteVirtualTable table,
          ref SQLiteVirtualTableCursor cursor
          )
        {
          cursor = new SQLiteVirtualTableCursor(table);
          return SQLiteErrorCode.Ok;
        }

        ///////////////////////////////////////////////////////////////////////

        public override bool FindFunction(
          SQLiteVirtualTable table,
          int argumentCount,
          string name,
          ref SQLiteFunction function,
          ref IntPtr pClientData
          )
        {
          if (argumentCount != 2)
          {
            SetTableError(table, String.Format(
              "no \\"{0}\\" functions accept {1} argument(s)",
              base.Name, argumentCount));

            return false;
          }

          if (!String.Equals(name, "Base64",
              StringComparison.OrdinalIgnoreCase))
          {
            SetTableError(table, String.Format(
              "no \\"{0}\\" functions are named \\"{1}\\"",
              base.Name, name));

            return false;
          }

          function = new SQLiteFunction${id}();
          return true;
        }
      }

      /////////////////////////////////////////////////////////////////////////

      public static class Test${id}
      {
        public static StringList GetList()
        {
          StringList result = new StringList();

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties NoBindFunctions]"))
          {
            connection.Open();
            connection.CreateModule(new SQLiteModuleTest${id}("mod${id}"));

            try
            {
              using (SQLiteCommand command = connection.CreateCommand())
              {
                command.CommandText = "[subst ${sql(1)}]";
                result.Add(String.Format("{0}", command.ExecuteScalar()));
              }
            }
            catch (Exception e)
            {
              result.Add(e.Message);
            }

            try
            {
              using (SQLiteCommand command = connection.CreateCommand())
              {
                command.CommandText = "[subst ${sql(2)}]";
                result.Add(String.Format("{0}", command.ExecuteScalar()));
              }
            }
            catch (Exception e)
            {
              result.Add(e.Message);
            }

            try
            {
              using (SQLiteCommand command = connection.CreateCommand())
              {
                command.CommandText = "[subst ${sql(3)}]";
                result.Add(String.Format("{0}", command.ExecuteScalar()));
              }
            }
            catch (Exception e)
            {
              result.Add(e.Message);
            }

            try
            {
              using (SQLiteCommand command = connection.CreateCommand())
              {
                command.CommandText = "[subst ${sql(4)}]";
                result.Add(String.Format("{0}", command.ExecuteScalar()));
              }
            }
            catch (Exception e)
            {
              result.Add(e.Message);
            }

            connection.Close();
          }

          return result;
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll Eagle.dll]]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetList
      } result] : [set result ""]}] [normalizeVtabResult $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id fileName
} -constraints {eagle command.object monoBug28 monoCrash211 command.sql\
compile.DATA SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE compileCSharp} -match \
regexp -result [normalizeVtabResult {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\{\} b25l \{SQL logic\
error( or missing database)? -- unable to use function Base64 in the requested\
context\} \{SQL logic error( or missing database)? -- no such function:\
Base65\}\}$}]}

###############################################################################

runTest {test vtab-1.5 {virtual table function support} -setup {
  set fileName vtab-1.5.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql(1) { \
    CREATE VIRTUAL TABLE t${id} USING mod${id}; \
  }

  set sql(2) { \
    SELECT Base64(x, CAST('one' AS BLOB)) FROM t${id}; \
  }

  set sql(3) { \
    SELECT Base64(x, CAST('one' AS BLOB), 'two') FROM t${id}; \
  }

  set sql(4) { \
    SELECT Base65(x, CAST('one' AS BLOB)) FROM t${id}; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using Eagle._Containers.Public;

    namespace _Dynamic${id}
    {
      public class SQLiteFunction${id} : SQLiteFunction
      {
        public SQLiteFunction${id}()
          : base(SQLiteDateFormats.Default, DateTimeKind.Unspecified,
                 null, false)
        {
          // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////

        public override object Invoke(
          object\[\] args
          )
        {
          if (args == null)
            return null;

          if (args.Length != 2)
            return new ArgumentException(String.Format(
              "need exactly two arguments, got {0}", args.Length));

          object arg = args\[1\];

          if (arg == null)
            return String.Empty;

          Type type = arg.GetType();

          if (type == typeof(DBNull))
            return String.Empty;

          if (type != typeof(byte\[\]))
            return new ArgumentException(String.Format(
              "argument must be byte array, got {0}", type));

          return Convert.ToBase64String((byte\[\]) arg);
        }
      }

      /////////////////////////////////////////////////////////////////////////

      public sealed class SQLiteModuleTest${id} : SQLiteModuleNoop
      {
        public SQLiteModuleTest${id}(string name)
          : base(name)
        {
          // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////

        public override SQLiteErrorCode Create(
          SQLiteConnection connection,
          IntPtr pClientData,
          string\[\] arguments,
          ref SQLiteVirtualTable table,
          ref string error
          )
        {
          SQLiteErrorCode rc = DeclareTable(
            connection, "CREATE TABLE ignored(x);", ref error);

          if (rc != SQLiteErrorCode.Ok)
            return rc;

          rc = DeclareFunction(connection, -1, "Base64", ref error);

          if (rc != SQLiteErrorCode.Ok)
            return rc;

          table = new SQLiteVirtualTable(arguments);
          return SQLiteErrorCode.Ok;
        }

        ///////////////////////////////////////////////////////////////////////

        public override SQLiteErrorCode Open(
          SQLiteVirtualTable table,
          ref SQLiteVirtualTableCursor cursor
          )
        {
          cursor = new SQLiteVirtualTableCursor(table);
          return SQLiteErrorCode.Ok;
        }

        ///////////////////////////////////////////////////////////////////////

        public override bool FindFunction(
          SQLiteVirtualTable table,
          int argumentCount,
          string name,
          ref SQLiteFunction function,
          ref IntPtr pClientData
          )
        {
          if (argumentCount != 2)
          {
            SetTableError(table, String.Format(
              "no \\"{0}\\" functions accept {1} argument(s)",
              base.Name, argumentCount));

            return false;
          }

          if (!String.Equals(name, "Base64",
              StringComparison.OrdinalIgnoreCase))
          {
            SetTableError(table, String.Format(
              "no \\"{0}\\" functions are named \\"{1}\\"",
              base.Name, name));

            return false;
          }

          function = new SQLiteFunction${id}();
          return true;
        }
      }

      /////////////////////////////////////////////////////////////////////////

      public static class Test${id}
      {
        public static StringList GetList()
        {
          StringList result = new StringList();

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();
            connection.CreateModule(new SQLiteModuleTest${id}("mod${id}"));

            try
            {
              using (SQLiteCommand command = connection.CreateCommand())
              {
                command.CommandText = "[subst ${sql(1)}]";
                result.Add(String.Format("{0}", command.ExecuteScalar()));
              }
            }
            catch (Exception e)
            {
              result.Add(e.Message);
            }

            try
            {
              using (SQLiteCommand command = connection.CreateCommand())
              {
                command.CommandText = "[subst ${sql(2)}]";
                result.Add(String.Format("{0}", command.ExecuteScalar()));
              }
            }
            catch (Exception e)
            {
              result.Add(e.Message);
            }

            try
            {
              using (SQLiteCommand command = connection.CreateCommand())
              {
                command.CommandText = "[subst ${sql(3)}]";
                result.Add(String.Format("{0}", command.ExecuteScalar()));
              }
            }
            catch (Exception e)
            {
              result.Add(e.Message);
            }

            try
            {
              using (SQLiteCommand command = connection.CreateCommand())
              {
                command.CommandText = "[subst ${sql(4)}]";
                result.Add(String.Format("{0}", command.ExecuteScalar()));
              }
            }
            catch (Exception e)
            {
              result.Add(e.Message);
            }

            connection.Close();
          }

          return result;
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll Eagle.dll]]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetList
      } result] : [set result ""]}] [normalizeVtabResult $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id fileName
} -constraints {eagle command.object monoBug28 monoCrash211 command.sql\
compile.DATA SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE compileCSharp} -match \
regexp -result [normalizeVtabResult {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\{\} b25l \{SQL logic\
error( or missing database)? -- (?:unable to use function Base64 in the\
requested context|need exactly one argument, got 3)\} \{SQL logic error( or\
missing database)? -- no such function: Base65\}\}$}]}

###############################################################################

runTest {test vtab-1.6 {virtual table rename support} -setup {
  set fileName vtab-1.6.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql(1) { \
    CREATE VIRTUAL TABLE t${id} USING mod${id}; \
  }

  set sql(2) { \
    ALTER TABLE t${id} RENAME TO x${id}; \
  }

  set sql(3) { \
    SELECT name FROM sqlite_master WHERE type = 'table' ORDER BY name; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using Eagle._Containers.Public;

    namespace _Dynamic${id}
    {
      public sealed class SQLiteModuleTest${id} : SQLiteModuleNoop
      {
        public SQLiteModuleTest${id}(string name)
          : base(name)
        {
          // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////

        public override SQLiteErrorCode Create(
          SQLiteConnection connection,
          IntPtr pClientData,
          string\[\] arguments,
          ref SQLiteVirtualTable table,
          ref string error
          )
        {
          SQLiteErrorCode rc = DeclareTable(
            connection, "CREATE TABLE ignored(x);", ref error);

          if (rc != SQLiteErrorCode.Ok)
            return rc;

          table = new SQLiteVirtualTable(arguments);
          return SQLiteErrorCode.Ok;
        }

        ///////////////////////////////////////////////////////////////////////

        public override SQLiteErrorCode Open(
          SQLiteVirtualTable table,
          ref SQLiteVirtualTableCursor cursor
          )
        {
          cursor = new SQLiteVirtualTableCursor(table);
          return SQLiteErrorCode.Ok;
        }
      }

      /////////////////////////////////////////////////////////////////////////

      public static class Test${id}
      {
        public static StringList GetList()
        {
          StringList result = new StringList();

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();
            connection.CreateModule(new SQLiteModuleTest${id}("mod${id}"));

            try
            {
              using (SQLiteCommand command = connection.CreateCommand())
              {
                command.CommandText = "[subst ${sql(1)}]";
                result.Add(String.Format("{0}", command.ExecuteScalar()));
              }
            }
            catch (Exception e)
            {
              result.Add(e.Message);
            }

            try
            {
              using (SQLiteCommand command = connection.CreateCommand())
              {
                command.CommandText = "[subst ${sql(3)}]";

                using (SQLiteDataReader dataReader = command.ExecuteReader())
                {
                  while (dataReader.Read())
                    result.Add(dataReader\[0\].ToString());
                }
              }
            }
            catch (Exception e)
            {
              result.Add(e.Message);
            }

            try
            {
              using (SQLiteCommand command = connection.CreateCommand())
              {
                command.CommandText = "[subst ${sql(2)}]";
                result.Add(String.Format("{0}", command.ExecuteScalar()));
              }
            }
            catch (Exception e)
            {
              result.Add(e.Message);
            }

            try
            {
              using (SQLiteCommand command = connection.CreateCommand())
              {
                command.CommandText = "[subst ${sql(3)}]";

                using (SQLiteDataReader dataReader = command.ExecuteReader())
                {
                  while (dataReader.Read())
                    result.Add(dataReader\[0\].ToString());
                }
              }
            }
            catch (Exception e)
            {
              result.Add(e.Message);
            }

            connection.Close();
          }

          return result;
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll Eagle.dll]]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetList
      } result] : [set result ""]}] [normalizeVtabResult $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id fileName
} -constraints {eagle command.object monoBug28 monoCrash211 command.sql\
compile.DATA SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE compileCSharp} -match \
regexp -result [normalizeVtabResult {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{\{\} t\d+ \{\} x\d+\}$}]}

###############################################################################

runTest {test vtab-1.7 {virtual table xBestIndex marshalling (1)} -setup {
  set fileName vtab-1.7.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql(1) { \
    CREATE TABLE t${id}(y CHAR(10) NOT NULL PRIMARY KEY); \
    CREATE VIRTUAL TABLE u${id} USING mod${id}; \
  }

  set sql(2) { \
    INSERT INTO t${id} SELECT x FROM u${id}; \
  }

  set sql(3) { \
    SELECT v${id}.y FROM t${id} v${id} LEFT OUTER JOIN \
    u${id} ON u${id}.x = v${id}.y WHERE u${id}.x IS NOT NULL \
    ORDER BY v${id}.y DESC; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Collections;
    using System.Data.SQLite;
    using Eagle._Containers.Public;

    namespace _Dynamic${id}
    {
      public sealed class SQLiteModuleTest${id} : SQLiteModuleEnumerable
      {
        public string Result;

        ///////////////////////////////////////////////////////////////////////

        public SQLiteModuleTest${id}(
          string name,
          IEnumerable enumerable
          )
          : base(name, enumerable)
        {
          // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////

        //
        // BUGFIX: This method helps verify ticket \[56f511d268\] is fixed.
        //
        public override SQLiteErrorCode BestIndex(
          SQLiteVirtualTable table,
          SQLiteIndex index
          )
        {
          if (index.Outputs.ConstraintUsages.Length > 0)
          {
            if (index.Outputs.ConstraintUsages\[0\] == null)
              throw new ArgumentException("ConstraintUsages\[0\] is null");
            else
              Result = "ConstraintUsages is OK";
          }

          return base.BestIndex(table, index);
        }
      }

      /////////////////////////////////////////////////////////////////////////

      public static class Test${id}
      {
        public static StringList GetList(params string\[\] strings)
        {
          StringList result = new StringList();

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            SQLiteModuleTest${id} module = new SQLiteModuleTest${id}(
                "mod${id}", strings);

            connection.CreateModule(module);

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(1)}]";
              result.Add(command.ExecuteNonQuery().ToString());
            }

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(2)}]";
              result.Add(command.ExecuteNonQuery().ToString());
            }

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(3)}]";

              using (SQLiteDataReader dataReader = command.ExecuteReader())
              {
                while (dataReader.Read())
                  result.Add(dataReader\[0\].ToString());
              }
            }

            result.Add(module.Result);
            connection.Close();
          }

          return result;
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll Eagle.dll]]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetList one two three 4 5.0
      } result] : [set result ""]}] [normalizeVtabResult $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id fileName
} -constraints {eagle command.object monoBug28 monoCrash211 command.sql\
compile.DATA SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE compileCSharp} -match \
regexp -result [normalizeVtabResult {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{0 5 two three one 5\.0\
4 \{ConstraintUsages is OK\}\}$}]}

###############################################################################

runTest {test vtab-1.8 {virtual table xBestIndex marshalling (2)} -setup {
  set fileName vtab-1.8.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql(1) { \
    CREATE TABLE t${id}(y CHAR(10) NOT NULL PRIMARY KEY); \
    CREATE VIRTUAL TABLE u${id} USING mod${id}; \
  }

  set sql(2) { \
    INSERT INTO t${id} SELECT x FROM u${id}; \
  }

  set sql(3) { \
    SELECT v${id}.y FROM t${id} v${id} LEFT OUTER JOIN \
    u${id} ON u${id}.x = v${id}.y WHERE u${id}.x IS NOT NULL \
    AND u${id}.x BETWEEN 'one' and 'three' ORDER BY u${id}.x ASC, \
    u${id}.x DESC; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Collections;
    using System.Data.SQLite;
    using Eagle._Containers.Public;

    namespace _Dynamic${id}
    {
      public sealed class SQLiteModuleTest${id} : SQLiteModuleEnumerable
      {
        public string Result;

        ///////////////////////////////////////////////////////////////////////

        public SQLiteModuleTest${id}(
          string name,
          IEnumerable enumerable
          )
          : base(name, enumerable)
        {
          // do nothing.
        }

        ///////////////////////////////////////////////////////////////////////

        //
        // BUGFIX: This method helps verify ticket \[56f511d268\] is fixed.
        //
        public override SQLiteErrorCode BestIndex(
          SQLiteVirtualTable table,
          SQLiteIndex index
          )
        {
          if (index.Outputs.ConstraintUsages.Length > 0)
          {
            if (index.Outputs.ConstraintUsages\[0\] == null)
              throw new ArgumentException("ConstraintUsages\[0\] is null");
            else
              Result = "ConstraintUsages is OK";
          }

          return base.BestIndex(table, index);
        }
      }

      /////////////////////////////////////////////////////////////////////////

      public static class Test${id}
      {
        public static StringList GetList(params string\[\] strings)
        {
          StringList result = new StringList();

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            SQLiteModuleTest${id} module = new SQLiteModuleTest${id}(
                "mod${id}", strings);

            connection.CreateModule(module);

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(1)}]";
              result.Add(command.ExecuteNonQuery().ToString());
            }

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(2)}]";
              result.Add(command.ExecuteNonQuery().ToString());
            }

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(3)}]";

              using (SQLiteDataReader dataReader = command.ExecuteReader())
              {
                while (dataReader.Read())
                  result.Add(dataReader\[0\].ToString());
              }
            }

            result.Add(module.Result);
            connection.Close();
          }

          return result;
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll Eagle.dll]]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetList one two three 4 5.0
      } result] : [set result ""]}] [normalizeVtabResult $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id fileName
} -constraints {eagle command.object monoBug28 monoCrash211 command.sql\
compile.DATA SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE compileCSharp} -match \
regexp -result [normalizeVtabResult {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{0 5 one three\
\{ConstraintUsages is OK\}\}$}]}

###############################################################################

runTest {test vtab-1.9 {IEnumerable virtual table w/large byte array} -setup {
  set fileName vtab-1.9.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql(1) { \
    CREATE VIRTUAL TABLE t${id} USING mod${id}; \
  }

  set sql(2) { \
    SELECT SUM(x) FROM t${id}; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static object GetSum()
        {
          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            byte\[\] bytes = new byte\[1048576\];
            new Random().NextBytes(bytes);

            connection.CreateModule(new SQLiteModuleEnumerable(
              "mod${id}", bytes));

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(1)}]";
              command.ExecuteNonQuery();
            }

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(2)}]";
              return command.ExecuteScalar();
            }
          }
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors System.Data.SQLite.dll]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetSum
      } result] : [set result ""]}] [normalizeVtabResult $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id fileName
} -time true -constraints {eagle command.object monoBug28 monoCrash211\
command.sql compile.DATA SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE compileCSharp} -match \
regexp -result [normalizeVtabResult {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 (?:-)?\d+$}]}

###############################################################################

runTest {test vtab-1.10 {virtual table xRowId uniqueness} -setup {
  set fileName vtab-1.10.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql(1) { \
    CREATE VIRTUAL TABLE t${id} USING mod${id}; \
  }

  set sql(2) { \
    SELECT CASE WHEN 0 THEN rowId ELSE rowId END, \
           CASE WHEN 1 THEN rowId ELSE rowId END FROM t${id}; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using Eagle._Containers.Public;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static StringList GetList(params string\[\] strings)
        {
          StringList result = new StringList();

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            connection.CreateModule(new SQLiteModuleEnumerable(
              "mod${id}", strings));

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(1)}]";
              result.Add(command.ExecuteNonQuery().ToString());
            }

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(2)}]";

              using (SQLiteDataReader dataReader = command.ExecuteReader())
              {
                //
                // NOTE: Mask off the hash code portion because it differs
                //       between framework versions.
                //
                long mask = unchecked((long)0xFFFFFFFF00000000);

                while (dataReader.Read())
                {
                  result.Add((dataReader.GetInt64(0) & mask).ToString());
                  result.Add((dataReader.GetInt64(1) & mask).ToString());
                }
              }
            }

            connection.Close();
          }

          return result;
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll Eagle.dll]]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetList one one two one two two
      } result] : [set result ""]}] [normalizeVtabResult $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id fileName
} -constraints {eagle command.object monoBug28 monoCrash211 command.sql\
compile.DATA SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE compileCSharp} -match \
regexp -result [normalizeVtabResult {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{0 4294967296 4294967296\
8589934592 8589934592 12884901888 12884901888 17179869184 17179869184\
21474836480 21474836480 25769803776 25769803776\}$}]}

###############################################################################

runTest {test vtab-1.11 {IEnumerable virtual table w/object identity} -setup {
  set fileName vtab-1.11.db
} -body {
  set id [object invoke Interpreter.GetActive NextId]
  set dataSource [file join [getDatabaseDirectory] $fileName]

  set sql(1) { \
    CREATE VIRTUAL TABLE t${id} USING mod${id}; \
  }

  set sql(2) { \
    SELECT rowId, * FROM t${id}; \
  }

  unset -nocomplain results errors

  set code [compileCSharpWith [subst {
    using System;
    using System.Data.SQLite;
    using Eagle._Containers.Public;

    namespace _Dynamic${id}
    {
      public static class Test${id}
      {
        public static StringList GetList(params string\[\] strings)
        {
          StringList result = new StringList();

          using (SQLiteConnection connection = new SQLiteConnection(
              "Data Source=${dataSource};[getTestProperties]"))
          {
            connection.Open();

            connection.CreateModule(new SQLiteModuleEnumerable(
              "mod${id}", strings, true));

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(1)}]";
              command.ExecuteNonQuery();
            }

            using (SQLiteCommand command = connection.CreateCommand())
            {
              command.CommandText = "[subst ${sql(2)}]";

              using (SQLiteDataReader dataReader = command.ExecuteReader())
              {
                while (dataReader.Read())
                {
                  result.Add(dataReader\[0\].ToString());
                  result.Add(dataReader\[1\].ToString());
                }
              }
            }

            connection.Close();
          }

          return result;
        }

        ///////////////////////////////////////////////////////////////////////

        public static void Main()
        {
          // do nothing.
        }
      }
    }
  }] true false true results errors [list System.Data.SQLite.dll Eagle.dll]]

  list $code $results \
      [expr {[info exists errors] ? $errors : ""}] \
      [expr {$code eq "Ok" ? [catchCSharp {
        object invoke _Dynamic${id}.Test${id} GetList one two three 4 5.0
      } result] : [set result ""]}] [normalizeVtabResult $result]
} -cleanup {
  cleanupDb $fileName

  unset -nocomplain result code results errors sql dataSource id fileName
} -constraints {eagle command.object monoBug28 monoCrash211 command.sql\
compile.DATA SQLite System.Data.SQLite SQLiteInterop\
defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE compileCSharp} -match \
regexp -result [normalizeVtabResult {^Ok\
System#CodeDom#Compiler#CompilerResults#\d+ \{\} 0 \{-?\d+ one -?\d+ two -?\d+\
three -?\d+ 4 -?\d+ 5\.0\}$}]}

###############################################################################

runTest {test vtab-1.12 {SQLiteIndex managed-to-native-to-managed} -setup {
  set nConstraint 3; set nOrderBy 3
} -body {
  set index(1) [object create -alias -flags +NonPublic \
      System.Data.SQLite.SQLiteIndex $nConstraint $nOrderBy]

  for {set iConstraint 0} {$iConstraint < $nConstraint} {incr iConstraint} {
    set constraint(1) [object create -alias -flags +NonPublic \
        System.Data.SQLite.SQLiteIndexConstraint 0 0 0 0]

    $index(1) Inputs.Constraints.SetValue $constraint(1) $iConstraint

    $constraint(1) iColumn [expr {int(0x01234567 + $iConstraint)}]
    $constraint(1) op [expr {0xFF - $iConstraint}]
    $constraint(1) usable [expr {0xCC + $iConstraint}]
    $constraint(1) iTermOffset [expr {int(0x89ABCDEF + $iConstraint)}]
  }

  for {set iOrderBy 0} {$iOrderBy < $nOrderBy} {incr iOrderBy} {
    set orderBy(1) [object create -alias -flags +NonPublic \
        System.Data.SQLite.SQLiteIndexOrderBy 0 0]

    $index(1) Inputs.OrderBys.SetValue $orderBy(1) $iOrderBy

    $orderBy(1) iColumn [expr {int(0x23016745 + $iOrderBy)}]
    $orderBy(1) desc [expr {0xFF - $iOrderBy}]
  }

  for {set iConstraint 0} {$iConstraint < $nConstraint} {incr iConstraint} {
    set constraintUsage(1) [object create -alias -flags +NonPublic \
        System.Data.SQLite.SQLiteIndexConstraintUsage 0 0]

    $index(1) Outputs.ConstraintUsages.SetValue $constraintUsage(1) \
        $iConstraint

    $constraintUsage(1) argvIndex [expr {int(0xAB89EFCD + $iConstraint)}]
    $constraintUsage(1) omit [expr {0xCC + $iConstraint}]
  }

  $index(1) Outputs.IndexNumber [expr {int(0xAAAAAAAA)}]
  $index(1) Outputs.IndexString "\x01test index string.\xFF"
  $index(1) Outputs.NeedToFreeIndexString [expr {int(0x55555555)}]
  $index(1) Outputs.OrderByConsumed [expr {int(0x33333333)}]
  $index(1) Outputs.EstimatedCost 1.0

  if {[$index(1) Outputs.CanUseEstimatedRows]} then {
    $index(1) Outputs.EstimatedRows [expr {int(0xCCCCCCCC)}]
  }

  if {[$index(1) Outputs.CanUseIndexFlags]} then {
    $index(1) Outputs.IndexFlags [expr {int(0xEEEEEEEE)}]
  }

  if {[$index(1) Outputs.CanUseColumnsUsed]} then {
    $index(1) Outputs.ColumnsUsed [expr {wide(0xBADC0FFEE875621A)}]
  }

  set pIndex(1) [object invoke -create -flags +NonPublic \
      System.Data.SQLite.SQLiteIndex AllocateAndInitializeNative \
      $nConstraint $nOrderBy]

  object invoke -flags +NonPublic \
      System.Data.SQLite.SQLiteIndex ToIntPtr $index(1) $pIndex(1) true

  set index(2) [object create -alias -flags +NonPublic \
      System.Data.SQLite.SQLiteIndex $nConstraint $nOrderBy]

  object invoke -alias -flags +NonPublic \
      System.Data.SQLite.SQLiteIndex FromIntPtr $pIndex(1) true index(2)

  for {set iConstraint 0} {$iConstraint < $nConstraint} {incr iConstraint} {
    set constraint(1) [$index(1) \
        -alias Inputs.Constraints.GetValue $iConstraint]

    set constraint(2) [$index(2) \
        -alias Inputs.Constraints.GetValue $iConstraint]

    if {[$constraint(1) iColumn] != [$constraint(2) iColumn]} then {
      error [appendArgs \
          "iColumn at index " $iConstraint " does not match"]
    }

    if {[$constraint(1) op] != [$constraint(2) op]} then {
      error [appendArgs \
          "op at index " $iConstraint " does not match"]
    }

    if {[$constraint(1) usable] != [$constraint(2) usable]} then {
      error [appendArgs \
          "usable at index " $iConstraint " does not match"]
    }

    if {[$constraint(1) iTermOffset] != [$constraint(2) iTermOffset]} then {
      error [appendArgs \
          "iTermOffset at index " $iConstraint " does not match"]
    }
  }

  for {set iOrderBy 0} {$iOrderBy < $nOrderBy} {incr iOrderBy} {
    set orderBy(1) [$index(1) \
        -alias Inputs.OrderBys.GetValue $iOrderBy]

    set orderBy(2) [$index(2) \
        -alias Inputs.OrderBys.GetValue $iOrderBy]

    if {[$orderBy(1) iColumn] != [$orderBy(2) iColumn]} then {
      error [appendArgs \
          "iColumn at index " $iOrderBy " does not match"]
    }

    if {[$orderBy(1) desc] != [$orderBy(2) desc]} then {
      error [appendArgs \
          "desc at index " $iOrderBy " does not match"]
    }
  }

  for {set iConstraint 0} {$iConstraint < $nConstraint} {incr iConstraint} {
    set constraintUsage(1) [$index(1) \
        -alias Outputs.ConstraintUsages.GetValue $iConstraint]

    set constraintUsage(2) [$index(2) \
        -alias Outputs.ConstraintUsages.GetValue $iConstraint]

    if {[$constraintUsage(1) argvIndex] != \
        [$constraintUsage(2) argvIndex]} then {
      error [appendArgs \
          "argvIndex at index " $iConstraint " does not match"]
    }

    if {[$constraintUsage(1) omit] != [$constraintUsage(2) omit]} then {
      error [appendArgs \
          "omit at index " $iConstraint " does not match"]
    }
  }

  if {[$index(1) Outputs.IndexNumber] != \
      [$index(2) Outputs.IndexNumber]} then {
    error "IndexNumber does not match"
  }

  if {[$index(1) Outputs.IndexString] ne \
      [$index(2) Outputs.IndexString]} then {
    error "IndexString does not match"
  }

  if {[$index(1) Outputs.NeedToFreeIndexString] != \
      [$index(2) Outputs.NeedToFreeIndexString]} then {
    error "NeedToFreeIndexString does not match"
  }

  if {[$index(1) Outputs.OrderByConsumed] != \
      [$index(2) Outputs.OrderByConsumed]} then {
    error "OrderByConsumed does not match"
  }

  if {[$index(1) Outputs.EstimatedCost] != \
      [$index(2) Outputs.EstimatedCost]} then {
    error "EstimatedCost does not match"
  }

  if {[$index(1) Outputs.CanUseEstimatedRows] && \
      [$index(2) Outputs.CanUseEstimatedRows]} then {
    if {[$index(1) Outputs.EstimatedRows] != \
        [$index(2) Outputs.EstimatedRows]} then {
      error "EstimatedRows does not match"
    }

    tputs $test_channel "---- checked EstimatedRows property\n"
  }

  if {[$index(1) Outputs.CanUseIndexFlags] && \
      [$index(2) Outputs.CanUseIndexFlags]} then {
    if {[$index(1) Outputs.IndexFlags] != \
        [$index(2) Outputs.IndexFlags]} then {
      error "IndexFlags does not match"
    }

    tputs $test_channel "---- checked IndexFlags property\n"
  }

  if {[$index(1) Outputs.CanUseColumnsUsed] && \
      [$index(2) Outputs.CanUseColumnsUsed]} then {
    if {[$index(1) Outputs.ColumnsUsed] != \
        [$index(2) Outputs.ColumnsUsed]} then {
      error "ColumnsUsed does not match"
    }

    tputs $test_channel "---- checked ColumnsUsed property\n"
  }
} -cleanup {
  catch {
    object invoke -flags +NonPublic \
        System.Data.SQLite.SQLiteIndex FreeNative $pIndex(1)
  }

  unset -nocomplain constraintUsage
  unset -nocomplain orderBy nOrderBy iOrderBy
  unset -nocomplain constraint nConstraint iConstraint
  unset -nocomplain pIndex index
} -constraints {eagle command.object monoBug211 SQLite System.Data.SQLite\
SQLiteInterop defineConstant.System.Data.SQLite.INTEROP_VIRTUAL_TABLE} \
-result {}}

###############################################################################

rename normalizeVtabResult ""

###############################################################################

runSQLiteTestEpilogue
runTestEpilogue

Deleted bin/CompactFramework/System.Data.SQLite.DLL.

cannot compute difference between binary files

Deleted bin/CompactFramework/System.Data.SQLite.dll.

cannot compute difference between binary files

Deleted bin/CompactFramework/testce.exe.

cannot compute difference between binary files

Deleted bin/Designer/SQLite.Designer.dll.

cannot compute difference between binary files

Deleted bin/Designer/install.exe.

cannot compute difference between binary files

Deleted bin/ManagedOnly/System.Data.SQLite.XML.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>System.Data.SQLite</name>
    </assembly>
    <members>
        <member name="T:System.Data.SQLite.SQLiteMetaDataCollectionNames">
            <summary>
            MetaDataCollections specific to SQLite
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteMetaDataCollectionNames.Catalogs">
            <summary>
            Returns a list of databases attached to the connection
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteMetaDataCollectionNames.Columns">
            <summary>
            Returns column information for the specified table
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteMetaDataCollectionNames.Indexes">
            <summary>
            Returns index information for the optionally-specified table
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteMetaDataCollectionNames.IndexColumns">
            <summary>
            Returns base columns for the given index
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteMetaDataCollectionNames.Tables">
            <summary>
            Returns the tables in the given catalog
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteMetaDataCollectionNames.Views">
            <summary>
            Returns user-defined views in the given catalog
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteMetaDataCollectionNames.ViewColumns">
            <summary>
            Returns underlying column information on the given view
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteMetaDataCollectionNames.ForeignKeys">
            <summary>
            Returns foreign key information for the given catalog
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteMetaDataCollectionNames.Triggers">
            <summary>
            Returns the triggers on the database
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteConnectionStringBuilder">
            <summary>
            SQLite implementation of DbConnectionStringBuilder.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnectionStringBuilder._properties">
            <summary>
            Properties of this class
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionStringBuilder.#ctor">
            <overloads>
            Constructs a new instance of the class
            </overloads>
            <summary>
            Default constructor
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionStringBuilder.#ctor(System.String)">
            <summary>
            Constructs a new instance of the class using the specified connection string.
            </summary>
            <param name="connectionString">The connection string to parse</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionStringBuilder.Initialize(System.String)">
            <summary>
            Private initializer, which assigns the connection string and resets the builder
            </summary>
            <param name="cnnString">The connection string to assign</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionStringBuilder.TryGetValue(System.String,System.Object@)">
            <summary>
            Helper function for retrieving values from the connectionstring
            </summary>
            <param name="keyword">The keyword to retrieve settings for</param>
            <param name="value">The resulting parameter value</param>
            <returns>Returns true if the value was found and returned</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionStringBuilder.FallbackGetProperties(System.Collections.Hashtable)">
            <summary>
            Fallback method for MONO, which doesn't implement DbConnectionStringBuilder.GetProperties()
            </summary>
            <param name="propertyList">The hashtable to fill with property descriptors</param>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.Version">
            <summary>
            Gets/Sets the default version of the SQLite engine to instantiate.  Currently the only valid value is 3, indicating version 3 of the sqlite library.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.SyncMode">
            <summary>
            Gets/Sets the synchronization mode (file flushing) of the connection string.  Default is "Normal".
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.UseUTF16Encoding">
            <summary>
            Gets/Sets the encoding for the connection string.  The default is "False" which indicates UTF-8 encoding.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.Pooling">
            <summary>
            Gets/Sets whether or not to use connection pooling.  The default is "False"
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.BinaryGUID">
            <summary>
            Gets/Sets whethor not to store GUID's in binary format.  The default is True
            which saves space in the database.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.DataSource">
            <summary>
            Gets/Sets the filename to open on the connection string.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.Uri">
            <summary>
            An alternate to the data source property
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.DefaultTimeout">
            <summary>
            Gets/sets the default command timeout for newly-created commands.  This is especially useful for 
            commands used internally such as inside a SQLiteTransaction, where setting the timeout is not possible.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.Enlist">
            <summary>
            Determines whether or not the connection will automatically participate
            in the current distributed transaction (if one exists)
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.FailIfMissing">
            <summary>
            If set to true, will throw an exception if the database specified in the connection
            string does not exist.  If false, the database will be created automatically.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.LegacyFormat">
            <summary>
            If enabled, uses the legacy 3.xx format for maximum compatibility, but results in larger
            database sizes.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.ReadOnly">
            <summary>
            When enabled, the database will be opened for read-only access and writing will be disabled.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.Password">
            <summary>
            Gets/sets the database encryption password
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.PageSize">
            <summary>
            Gets/Sets the page size for the connection.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.MaxPageCount">
            <summary>
            Gets/Sets the maximum number of pages the database may hold
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.CacheSize">
            <summary>
            Gets/Sets the cache size for the connection.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.DateTimeFormat">
            <summary>
            Gets/Sets the datetime format for the connection.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.JournalMode">
            <summary>
            Determines how SQLite handles the transaction journal file.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.DefaultIsolationLevel">
            <summary>
            Sets the default isolation level for transactions on the connection.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteCommandBuilder">
            <summary>
            SQLite implementation of DbCommandBuilder.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.#ctor">
            <summary>
            Default constructor
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.#ctor(System.Data.SQLite.SQLiteDataAdapter)">
            <summary>
            Initializes the command builder and associates it with the specified data adapter.
            </summary>
            <param name="adp"></param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.ApplyParameterInfo(System.Data.Common.DbParameter,System.Data.DataRow,System.Data.StatementType,System.Boolean)">
            <summary>
            Minimal amount of parameter processing.  Primarily sets the DbType for the parameter equal to the provider type in the schema
            </summary>
            <param name="parameter">The parameter to use in applying custom behaviors to a row</param>
            <param name="row">The row to apply the parameter to</param>
            <param name="statementType">The type of statement</param>
            <param name="whereClause">Whether the application of the parameter is part of a WHERE clause</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetParameterName(System.String)">
            <summary>
            Returns a valid named parameter
            </summary>
            <param name="parameterName">The name of the parameter</param>
            <returns>Error</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetParameterName(System.Int32)">
            <summary>
            Returns a named parameter for the given ordinal
            </summary>
            <param name="parameterOrdinal">The i of the parameter</param>
            <returns>Error</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetParameterPlaceholder(System.Int32)">
            <summary>
            Returns a placeholder character for the specified parameter i.
            </summary>
            <param name="parameterOrdinal">The index of the parameter to provide a placeholder for</param>
            <returns>Returns a named parameter</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.SetRowUpdatingHandler(System.Data.Common.DbDataAdapter)">
            <summary>
            Sets the handler for receiving row updating events.  Used by the DbCommandBuilder to autogenerate SQL
            statements that may not have previously been generated.
            </summary>
            <param name="adapter">A data adapter to receive events on.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetDeleteCommand">
            <summary>
            Returns the automatically-generated SQLite command to delete rows from the database
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetDeleteCommand(System.Boolean)">
            <summary>
            Returns the automatically-generated SQLite command to delete rows from the database
            </summary>
            <param name="useColumnsForParameterNames"></param>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetUpdateCommand">
            <summary>
            Returns the automatically-generated SQLite command to update rows in the database
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetUpdateCommand(System.Boolean)">
            <summary>
            Returns the automatically-generated SQLite command to update rows in the database
            </summary>
            <param name="useColumnsForParameterNames"></param>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetInsertCommand">
            <summary>
            Returns the automatically-generated SQLite command to insert rows into the database
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetInsertCommand(System.Boolean)">
            <summary>
            Returns the automatically-generated SQLite command to insert rows into the database
            </summary>
            <param name="useColumnsForParameterNames"></param>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.QuoteIdentifier(System.String)">
            <summary>
            Places brackets around an identifier
            </summary>
            <param name="unquotedIdentifier">The identifier to quote</param>
            <returns>The bracketed identifier</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.UnquoteIdentifier(System.String)">
            <summary>
            Removes brackets around an identifier
            </summary>
            <param name="quotedIdentifier">The quoted (bracketed) identifier</param>
            <returns>The undecorated identifier</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetSchemaTable(System.Data.Common.DbCommand)">
            <summary>
            Override helper, which can help the base command builder choose the right keys for the given query
            </summary>
            <param name="sourceCommand"></param>
            <returns></returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommandBuilder.DataAdapter">
            <summary>
            Gets/sets the DataAdapter for this CommandBuilder
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommandBuilder.CatalogLocation">
            <summary>
            Overridden to hide its property from the designer
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommandBuilder.CatalogSeparator">
            <summary>
            Overridden to hide its property from the designer
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommandBuilder.QuotePrefix">
            <summary>
            Overridden to hide its property from the designer
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommandBuilder.QuoteSuffix">
            <summary>
            Overridden to hide its property from the designer
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommandBuilder.SchemaSeparator">
            <summary>
            Overridden to hide its property from the designer
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SR">
            <summary>
              A strongly-typed resource class, for looking up localized strings, etc.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SR.ResourceManager">
            <summary>
              Returns the cached ResourceManager instance used by this class.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SR.Culture">
            <summary>
              Overrides the current thread's CurrentUICulture property for all
              resource lookups using this strongly typed resource class.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SR.DataTypes">
             <summary>
               Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; standalone=&quot;yes&quot;?&gt;
            &lt;DocumentElement&gt;
              &lt;DataTypes&gt;
                &lt;TypeName&gt;smallint&lt;/TypeName&gt;
                &lt;ProviderDbType&gt;10&lt;/ProviderDbType&gt;
                &lt;ColumnSize&gt;5&lt;/ColumnSize&gt;
                &lt;DataType&gt;System.Int16&lt;/DataType&gt;
                &lt;CreateFormat&gt;smallint&lt;/CreateFormat&gt;
                &lt;IsAutoIncrementable&gt;false&lt;/IsAutoIncrementable&gt;
                &lt;IsCaseSensitive&gt;false&lt;/IsCaseSensitive&gt;
                &lt;IsFixedLength&gt;true&lt;/IsFixedLength&gt;
                &lt;IsFixedPrecisionScale&gt;true&lt;/IsFixedPrecisionScale&gt;
                &lt;IsLong&gt;false&lt;/IsLong&gt;
                &lt;IsNullable&gt;true&lt;/ [rest of string was truncated]&quot;;.
             </summary>
        </member>
        <member name="P:System.Data.SQLite.SR.Keywords">
            <summary>
              Looks up a localized string similar to ALL,ALTER,AND,AS,AUTOINCREMENT,BETWEEN,BY,CASE,CHECK,COLLATE,COMMIT,CONSTRAINT,CREATE,CROSS,DEFAULT,DEFERRABLE,DELETE,DISTINCT,DROP,ELSE,ESCAPE,EXCEPT,FOREIGN,FROM,FULL,GROUP,HAVING,IN,INDEX,INNER,INSERT,INTERSECT,INTO,IS,ISNULL,JOIN,LEFT,LIMIT,NATURAL,NOT,NOTNULL,NULL,ON,OR,ORDER,OUTER,PRIMARY,REFERENCES,RIGHT,ROLLBACK,SELECT,SET,TABLE,THEN,TO,TRANSACTION,UNION,UNIQUE,UPDATE,USING,VALUES,WHEN,WHERE.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SR.MetaDataCollections">
             <summary>
               Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
            &lt;DocumentElement&gt;
              &lt;MetaDataCollections&gt;
                &lt;CollectionName&gt;MetaDataCollections&lt;/CollectionName&gt;
                &lt;NumberOfRestrictions&gt;0&lt;/NumberOfRestrictions&gt;
                &lt;NumberOfIdentifierParts&gt;0&lt;/NumberOfIdentifierParts&gt;
              &lt;/MetaDataCollections&gt;
              &lt;MetaDataCollections&gt;
                &lt;CollectionName&gt;DataSourceInformation&lt;/CollectionName&gt;
                &lt;NumberOfRestrictions&gt;0&lt;/NumberOfRestrictions&gt;
                &lt;NumberOfIdentifierParts&gt;0&lt;/NumberOfIdentifierParts&gt;
              &lt;/MetaDataCollections&gt;
              &lt;MetaDataC [rest of string was truncated]&quot;;.
             </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnectionPool._connections">
            <summary>
            The connection pool object
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnectionPool._poolVersion">
            <summary>
            The default version number new pools will get
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionPool.Remove(System.String,System.Int32,System.Int32@)">
            <summary>
            Attempt to pull a pooled connection out of the queue for active duty
            </summary>
            <param name="fileName">The filename for a desired connection</param>
            <param name="maxPoolSize">The maximum size the connection pool for the filename can be</param>
            <param name="version">The pool version the returned connection will belong to</param>
            <returns>Returns NULL if no connections were available.  Even if none are, the poolversion will still be a valid pool version</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionPool.ClearAllPools">
            <summary>
            Clears out all pooled connections and rev's up the default pool version to force all old active objects
            not in the pool to get discarded rather than returned to their pools.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionPool.ClearPool(System.String)">
            <summary>
            Clear a given pool for a given filename.  Discards anything in the pool for the given file, and revs the pool
            version so current active objects on the old version of the pool will get discarded rather than be returned to the pool.
            </summary>
            <param name="fileName">The filename of the pool to clear</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionPool.Add(System.String,System.Data.SQLite.SQLiteConnectionHandle,System.Int32)">
            <summary>
            Return a connection to the pool for someone else to use.
            </summary>
            <param name="fileName">The filename of the pool to use</param>
            <param name="hdl">The connection handle to pool</param>
            <param name="version">The pool version the handle was created under</param>
            <remarks>
            If the version numbers don't match between the connection and the pool, then the handle is discarded.
            </remarks>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionPool.ResizePool(System.Data.SQLite.SQLiteConnectionPool.Pool,System.Boolean)">
            <summary>
            We don't have to thread-lock anything in this function, because it's only called by other functions above
            which already have a thread-safe lock.
            </summary>
            <param name="queue">The queue to resize</param>
            <param name="forAdding">If a function intends to add to the pool, this is true, which forces the resize
            to take one more than it needs from the pool</param>
        </member>
        <member name="T:System.Data.SQLite.SQLiteConnectionPool.Pool">
            <summary>
            Keeps track of connections made on a specified file.  The PoolVersion dictates whether old objects get
            returned to the pool or discarded when no longer in use.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteConnection">
            <summary>
            SQLite implentation of DbConnection.
            </summary>
            <remarks>
            The <see cref="P:System.Data.SQLite.SQLiteConnection.ConnectionString">ConnectionString</see> property of the SQLiteConnection class can contain the following parameter(s), delimited with a semi-colon:
            <list type="table">
            <listheader>
            <term>Parameter</term>
            <term>Values</term>
            <term>Required</term>
            <term>Default</term>
            </listheader>
            <item>
            <description>Data Source</description>
            <description>{filename}</description>
            <description>Y</description>
            <description></description>
            </item>
            <item>
            <description>Version</description>
            <description>3</description>
            <description>N</description>
            <description>3</description>
            </item>
            <item>
            <description>UseUTF16Encoding</description>
            <description><b>True</b><br/><b>False</b></description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>DateTimeFormat</description>
            <description><b>Ticks</b> - Use DateTime.Ticks<br/><b>ISO8601</b> - Use ISO8601 DateTime format</description>
            <description>N</description>
            <description>ISO8601</description>
            </item>
            <item>
            <description>BinaryGUID</description>
            <description><b>True</b> - Store GUID columns in binary form<br/><b>False</b> - Store GUID columns as text</description>
            <description>N</description>
            <description>True</description>
            </item>
            <item>
            <description>Cache Size</description>
            <description>{size in bytes}</description>
            <description>N</description>
            <description>2000</description>
            </item>
            <item>
            <description>Synchronous</description>
            <description><b>Normal</b> - Normal file flushing behavior<br/><b>Full</b> - Full flushing after all writes<br/><b>Off</b> - Underlying OS flushes I/O's</description>
            <description>N</description>
            <description>Normal</description>
            </item>
            <item>
            <description>Page Size</description>
            <description>{size in bytes}</description>
            <description>N</description>
            <description>1024</description>
            </item>
            <item>
            <description>Password</description>
            <description>{password}</description>
            <description>N</description>
            <description></description>
            </item>
            <item>
            <description>Enlist</description>
            <description><b>Y</b> - Automatically enlist in distributed transactions<br/><b>N</b> - No automatic enlistment</description>
            <description>N</description>
            <description>Y</description>
            </item>
            <item>
            <description>Pooling</description>
            <description><b>True</b> - Use connection pooling<br/><b>False</b> - Do not use connection pooling</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>FailIfMissing</description>
            <description><b>True</b> - Don't create the database if it does not exist, throw an error instead<br/><b>False</b> - Automatically create the database if it does not exist</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>Max Page Count</description>
            <description>{size in pages} - Limits the maximum number of pages (limits the size) of the database</description>
            <description>N</description>
            <description>0</description>
            </item>
            <item>
            <description>Legacy Format</description>
            <description><b>True</b> - Use the more compatible legacy 3.x database format<br/><b>False</b> - Use the newer 3.3x database format which compresses numbers more effectively</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>Default Timeout</description>
            <description>{time in seconds}<br/>The default command timeout</description>
            <description>N</description>
            <description>30</description>
            </item>
            <item>
            <description>Journal Mode</description>
            <description><b>Delete</b> - Delete the journal file after a commit<br/><b>Persist</b> - Zero out and leave the journal file on disk after a commit<br/><b>Off</b> - Disable the rollback journal entirely</description>
            <description>N</description>
            <description>Delete</description>
            </item>
            <item>
            <description>Read Only</description>
            <description><b>True</b> - Open the database for read only access<br/><b>False</b> - Open the database for normal read/write access</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>Max Pool Size</description>
            <description>The maximum number of connections for the given connection string that can be in the connection pool</description>
            <description>N</description>
            <description>100</description>
            </item>
            <item>
            <description>Default IsolationLevel</description>
            <description>The default transaciton isolation level</description>
            <description>N</description>
            <description>Serializable</description>
            </item>
            </list>
            </remarks>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._connectionState">
            <summary>
            State of the current connection
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._connectionString">
            <summary>
            The connection string
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._transactionLevel">
            <summary>
            Nesting level of the transactions open on the connection
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._defaultIsolation">
            <summary>
            The default isolation level for new transactions
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._enlistment">
            <summary>
            Whether or not the connection is enlisted in a distrubuted transaction
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._sql">
            <summary>
            The base SQLite object to interop with
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._dataSource">
            <summary>
            The database filename minus path and extension
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._password">
            <summary>
            Temporary password storage, emptied after the database has been opened
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._defaultTimeout">
            <summary>
            Default command timeout
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.#ctor">
            <overloads>
             Constructs a new SQLiteConnection object
             </overloads>
             <summary>
             Default constructor
             </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.#ctor(System.String)">
            <summary>
            Initializes the connection with the specified connection string
            </summary>
            <param name="connectionString">The connection string to use on the connection</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.#ctor(System.Data.SQLite.SQLiteConnection)">
            <summary>
            Clones the settings and connection string from an existing connection.  If the existing connection is already open, this
            function will open its own connection, enumerate any attached databases of the original connection, and automatically
            attach to them.
            </summary>
            <param name="connection"></param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Clone">
            <summary>
            Creates a clone of the connection.  All attached databases and user-defined functions are cloned.  If the existing connection is open, the cloned connection 
            will also be opened.
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Dispose(System.Boolean)">
            <summary>
            Disposes of the SQLiteConnection, closing it if it is active.
            </summary>
            <param name="disposing">True if the connection is being explicitly closed.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.CreateFile(System.String)">
            <summary>
            Creates a database file.  This just creates a zero-byte file which SQLite
            will turn into a database when the file is opened properly.
            </summary>
            <param name="databaseFileName">The file to create</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.OnStateChange(System.Data.ConnectionState)">
            <summary>
            Raises the state change event when the state of the connection changes
            </summary>
            <param name="newState">The new state.  If it is different from the previous state, an event is raised.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginTransaction(System.Data.IsolationLevel,System.Boolean)">
            <summary>
            OBSOLETE.  Creates a new SQLiteTransaction if one isn't already active on the connection.
            </summary>
            <param name="isolationLevel">This parameter is ignored.</param>
            <param name="deferredLock">When TRUE, SQLite defers obtaining a write lock until a write operation is requested.
            When FALSE, a writelock is obtained immediately.  The default is TRUE, but in a multi-threaded multi-writer 
            environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock.</param>
            <returns>Returns a SQLiteTransaction object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginTransaction(System.Boolean)">
            <summary>
            OBSOLETE.  Creates a new SQLiteTransaction if one isn't already active on the connection.
            </summary>
            <param name="deferredLock">When TRUE, SQLite defers obtaining a write lock until a write operation is requested.
            When FALSE, a writelock is obtained immediately.  The default is false, but in a multi-threaded multi-writer 
            environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock.</param>
            <returns>Returns a SQLiteTransaction object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginTransaction(System.Data.IsolationLevel)">
            <summary>
            Creates a new SQLiteTransaction if one isn't already active on the connection.
            </summary>
            <param name="isolationLevel">Supported isolation levels are Serializable, ReadCommitted and Unspecified.</param>
            <remarks>
            Unspecified will use the default isolation level specified in the connection string.  If no isolation level is specified in the 
            connection string, Serializable is used.
            Serializable transactions are the default.  In this mode, the engine gets an immediate lock on the database, and no other threads
            may begin a transaction.  Other threads may read from the database, but not write.
            With a ReadCommitted isolation level, locks are deferred and elevated as needed.  It is possible for multiple threads to start
            a transaction in ReadCommitted mode, but if a thread attempts to commit a transaction while another thread
            has a ReadCommitted lock, it may timeout or cause a deadlock on both threads until both threads' CommandTimeout's are reached.
            </remarks>
            <returns>Returns a SQLiteTransaction object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginTransaction">
            <summary>
            Creates a new SQLiteTransaction if one isn't already active on the connection.
            </summary>
            <returns>Returns a SQLiteTransaction object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginDbTransaction(System.Data.IsolationLevel)">
            <summary>
            Forwards to the local BeginTransaction() function
            </summary>
            <param name="isolationLevel">Supported isolation levels are Unspecified, Serializable, and ReadCommitted</param>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ChangeDatabase(System.String)">
            <summary>
            Not implemented
            </summary>
            <param name="databaseName"></param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Close">
            <summary>
            When the database connection is closed, all commands linked to this connection are automatically reset.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ClearPool(System.Data.SQLite.SQLiteConnection)">
            <summary>
            Clears the connection pool associated with the connection.  Any other active connections using the same database file
            will be discarded instead of returned to the pool when they are closed.
            </summary>
            <param name="connection"></param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ClearAllPools">
            <summary>
            Clears all connection pools.  Any active connections will be discarded instead of sent to the pool when they are closed.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.CreateCommand">
            <summary>
            Create a new SQLiteCommand and associate it with this connection.
            </summary>
            <returns>Returns an instantiated SQLiteCommand object already assigned to this connection.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.CreateDbCommand">
            <summary>
            Forwards to the local CreateCommand() function
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ParseConnectionString(System.String)">
            <summary>
            Parses the connection string into component parts
            </summary>
            <param name="connectionString">The connection string to parse</param>
            <returns>An array of key-value pairs representing each parameter of the connection string</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.EnlistTransaction(System.Transactions.Transaction)">
            <summary>
            Manual distributed transaction enlistment support
            </summary>
            <param name="transaction">The distributed transaction to enlist in</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.FindKey(System.Collections.Generic.SortedList{System.String,System.String},System.String,System.String)">
            <summary>
            Looks for a key in the array of key/values of the parameter string.  If not found, return the specified default value
            </summary>
            <param name="items">The list to look in</param>
            <param name="key">The key to find</param>
            <param name="defValue">The default value to return if the key is not found</param>
            <returns>The value corresponding to the specified key, or the default value if not found.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Open">
            <summary>
            Opens the connection using the parameters found in the <see cref="P:System.Data.SQLite.SQLiteConnection.ConnectionString">ConnectionString</see>
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ChangePassword(System.String)">
            <summary>
            Change the password (or assign a password) to an open database.
            </summary>
            <remarks>
            No readers or writers may be active for this process.  The database must already be open
            and if it already was password protected, the existing password must already have been supplied.
            </remarks>
            <param name="newPassword">The new password to assign to the database</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ChangePassword(System.Byte[])">
            <summary>
            Change the password (or assign a password) to an open database.
            </summary>
            <remarks>
            No readers or writers may be active for this process.  The database must already be open
            and if it already was password protected, the existing password must already have been supplied.
            </remarks>
            <param name="newPassword">The new password to assign to the database</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.SetPassword(System.String)">
            <summary>
            Sets the password for a password-protected database.  A password-protected database is
            unusable for any operation until the password has been set.
            </summary>
            <param name="databasePassword">The password for the database</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.SetPassword(System.Byte[])">
            <summary>
            Sets the password for a password-protected database.  A password-protected database is
            unusable for any operation until the password has been set.
            </summary>
            <param name="databasePassword">The password for the database</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ExpandFileName(System.String)">
            <summary>
            Expand the filename of the data source, resolving the |DataDirectory| macro as appropriate.
            </summary>
            <param name="sourceFile">The database filename to expand</param>
            <returns>The expanded path and filename of the filename</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.GetSchema">
            <overloads>
             The following commands are used to extract schema information out of the database.  Valid schema types are:
             <list type="bullet">
             <item>
             <description>MetaDataCollections</description>
             </item>
             <item>
             <description>DataSourceInformation</description>
             </item>
             <item>
             <description>Catalogs</description>
             </item>
             <item>
             <description>Columns</description>
             </item>
             <item>
             <description>ForeignKeys</description>
             </item>
             <item>
             <description>Indexes</description>
             </item>
             <item>
             <description>IndexColumns</description>
             </item>
             <item>
             <description>Tables</description>
             </item>
             <item>
             <description>Views</description>
             </item>
             <item>
             <description>ViewColumns</description>
             </item>
             </list>
             </overloads>
             <summary>
             Returns the MetaDataCollections schema
             </summary>
             <returns>A DataTable of the MetaDataCollections schema</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.GetSchema(System.String)">
            <summary>
            Returns schema information of the specified collection
            </summary>
            <param name="collectionName">The schema collection to retrieve</param>
            <returns>A DataTable of the specified collection</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.GetSchema(System.String,System.String[])">
            <summary>
            Retrieves schema information using the specified constraint(s) for the specified collection
            </summary>
            <param name="collectionName">The collection to retrieve</param>
            <param name="restrictionValues">The restrictions to impose</param>
            <returns>A DataTable of the specified collection</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_MetaDataCollections">
            <summary>
            Builds a MetaDataCollections schema datatable
            </summary>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_DataSourceInformation">
            <summary>
            Builds a DataSourceInformation datatable
            </summary>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Columns(System.String,System.String,System.String)">
            <summary>
            Build a Columns schema
            </summary>
            <param name="strCatalog">The catalog (attached database) to query, can be null</param>
            <param name="strTable">The table to retrieve schema information for, must not be null</param>
            <param name="strColumn">The column to retrieve schema information for, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Indexes(System.String,System.String,System.String)">
            <summary>
            Returns index information for the given database and catalog
            </summary>
            <param name="strCatalog">The catalog (attached database) to query, can be null</param>
            <param name="strIndex">The name of the index to retrieve information for, can be null</param>
            <param name="strTable">The table to retrieve index information for, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Tables(System.String,System.String,System.String)">
            <summary>
            Retrieves table schema information for the database and catalog
            </summary>
            <param name="strCatalog">The catalog (attached database) to retrieve tables on</param>
            <param name="strTable">The table to retrieve, can be null</param>
            <param name="strType">The table type, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Views(System.String,System.String)">
            <summary>
            Retrieves view schema information for the database
            </summary>
            <param name="strCatalog">The catalog (attached database) to retrieve views on</param>
            <param name="strView">The view name, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Catalogs(System.String)">
            <summary>
            Retrieves catalog (attached databases) schema information for the database
            </summary>
            <param name="strCatalog">The catalog to retrieve, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_IndexColumns(System.String,System.String,System.String,System.String)">
            <summary>
            Returns the base column information for indexes in a database
            </summary>
            <param name="strCatalog">The catalog to retrieve indexes for (can be null)</param>
            <param name="strTable">The table to restrict index information by (can be null)</param>
            <param name="strIndex">The index to restrict index information by (can be null)</param>
            <param name="strColumn">The source column to restrict index information by (can be null)</param>
            <returns>A DataTable containing the results</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_ViewColumns(System.String,System.String,System.String)">
            <summary>
            Returns detailed column information for a specified view
            </summary>
            <param name="strCatalog">The catalog to retrieve columns for (can be null)</param>
            <param name="strView">The view to restrict column information by (can be null)</param>
            <param name="strColumn">The source column to restrict column information by (can be null)</param>
            <returns>A DataTable containing the results</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_ForeignKeys(System.String,System.String,System.String)">
            <summary>
            Retrieves foreign key information from the specified set of filters
            </summary>
            <param name="strCatalog">An optional catalog to restrict results on</param>
            <param name="strTable">An optional table to restrict results on</param>
            <param name="strKeyName">An optional foreign key name to restrict results on</param>
            <returns>A DataTable with the results of the query</returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.DbProviderFactory">
            <summary>
            Returns a SQLiteProviderFactory object.
            </summary>
        </member>
        <member name="E:System.Data.SQLite.SQLiteConnection.StateChange">
            <summary>
            This event is raised whenever the database is opened or closed.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.ConnectionString">
            <summary>
            The connection string containing the parameters for the connection
            </summary>
            <remarks>
            <list type="table">
            <listheader>
            <term>Parameter</term>
            <term>Values</term>
            <term>Required</term>
            <term>Default</term>
            </listheader>
            <item>
            <description>Data Source</description>
            <description>{filename}</description>
            <description>Y</description>
            <description></description>
            </item>
            <item>
            <description>Version</description>
            <description>3</description>
            <description>N</description>
            <description>3</description>
            </item>
            <item>
            <description>UseUTF16Encoding</description>
            <description><b>True</b><br/><b>False</b></description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>DateTimeFormat</description>
            <description><b>Ticks</b> - Use DateTime.Ticks<br/><b>ISO8601</b> - Use ISO8601 DateTime format<br/><b>JulianDay</b> - Use JulianDay format</description>
            <description>N</description>
            <description>ISO8601</description>
            </item>
            <item>
            <description>BinaryGUID</description>
            <description><b>Yes/On/1</b> - Store GUID columns in binary form<br/><b>No/Off/0</b> - Store GUID columns as text</description>
            <description>N</description>
            <description>On</description>
            </item>
            <item>
            <description>Cache Size</description>
            <description>{size in bytes}</description>
            <description>N</description>
            <description>2000</description>
            </item>
            <item>
            <description>Synchronous</description>
            <description><b>Normal</b> - Normal file flushing behavior<br/><b>Full</b> - Full flushing after all writes<br/><b>Off</b> - Underlying OS flushes I/O's</description>
            <description>N</description>
            <description>Normal</description>
            </item>
            <item>
            <description>Page Size</description>
            <description>{size in bytes}</description>
            <description>N</description>
            <description>1024</description>
            </item>
            <item>
            <description>Password</description>
            <description>{password}</description>
            <description>N</description>
            <description></description>
            </item>
            <item>
            <description>Enlist</description>
            <description><B>Y</B> - Automatically enlist in distributed transactions<br/><b>N</b> - No automatic enlistment</description>
            <description>N</description>
            <description>Y</description>
            </item>
            <item>
            <description>Pooling</description>
            <description><b>True</b> - Use connection pooling<br/><b>False</b> - Do not use connection pooling</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>FailIfMissing</description>
            <description><b>True</b> - Don't create the database if it does not exist, throw an error instead<br/><b>False</b> - Automatically create the database if it does not exist</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>Max Page Count</description>
            <description>{size in pages} - Limits the maximum number of pages (limits the size) of the database</description>
            <description>N</description>
            <description>0</description>
            </item>
            <item>
            <description>Legacy Format</description>
            <description><b>True</b> - Use the more compatible legacy 3.x database format<br/><b>False</b> - Use the newer 3.3x database format which compresses numbers more effectively</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>Default Timeout</description>
            <description>{time in seconds}<br/>The default command timeout</description>
            <description>N</description>
            <description>30</description>
            </item>
            <item>
            <description>Journal Mode</description>
            <description><b>Delete</b> - Delete the journal file after a commit<br/><b>Persist</b> - Zero out and leave the journal file on disk after a commit<br/><b>Off</b> - Disable the rollback journal entirely</description>
            <description>N</description>
            <description>Delete</description>
            </item>
            <item>
            <description>Read Only</description>
            <description><b>True</b> - Open the database for read only access<br/><b>False</b> - Open the database for normal read/write access</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>Max Pool Size</description>
            <description>The maximum number of connections for the given connection string that can be in the connection pool</description>
            <description>N</description>
            <description>100</description>
            </item>
            <item>
            <description>Default IsolationLevel</description>
            <description>The default transaciton isolation level</description>
            <description>N</description>
            <description>Serializable</description>
            </item>
            </list>
            </remarks>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.DataSource">
            <summary>
            Returns the filename without extension or path
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.Database">
            <summary>
            Returns an empty string
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.DefaultTimeout">
            <summary>
            Gets/sets the default command timeout for newly-created commands.  This is especially useful for 
            commands used internally such as inside a SQLiteTransaction, where setting the timeout is not possible.
            This can also be set in the ConnectionString with "Default Timeout"
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.ServerVersion">
            <summary>
            Returns the version of the underlying SQLite database engine
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.SQLiteVersion">
            <summary>
            Returns the version of the underlying SQLite database engine
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.State">
            <summary>
            Returns the state of the connection.
            </summary>
        </member>
        <member name="E:System.Data.SQLite.SQLiteConnection.Update">
            <summary>
            This event is raised whenever SQLite makes an update/delete/insert into the database on
            this connection.  It only applies to the given connection.
            </summary>
        </member>
        <member name="E:System.Data.SQLite.SQLiteConnection.Commit">
            <summary>
            This event is raised whenever SQLite is committing a transaction.
            Return non-zero to trigger a rollback
            </summary>
        </member>
        <member name="E:System.Data.SQLite.SQLiteConnection.RollBack">
            <summary>
            This event is raised whenever SQLite is committing a transaction.
            Return non-zero to trigger a rollback
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SynchronizationModes">
            <summary>
            The I/O file cache flushing behavior for the connection
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SynchronizationModes.Normal">
            <summary>
            Normal file flushing at critical sections of the code
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SynchronizationModes.Full">
            <summary>
            Full file flushing after every write operation
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SynchronizationModes.Off">
            <summary>
            Use the default operating system's file flushing, SQLite does not explicitly flush the file buffers after writing
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteCommitHandler">
            <summary>
            Raised when a transaction is about to be committed.  To roll back a transaction, set the 
            rollbackTrans boolean value to true.
            </summary>
            <param name="sender">The connection committing the transaction</param>
            <param name="e">Event arguments on the transaction</param>
        </member>
        <member name="T:System.Data.SQLite.SQLiteUpdateEventHandler">
            <summary>
            Raised when data is inserted, updated and deleted on a given connection
            </summary>
            <param name="sender">The connection committing the transaction</param>
            <param name="e">The event parameters which triggered the event</param>
        </member>
        <member name="T:System.Data.SQLite.UpdateEventType">
            <summary>
            Whenever an update event is triggered on a connection, this enum will indicate
            exactly what type of operation is being performed.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.UpdateEventType.Delete">
            <summary>
            A row is being deleted from the given database and table
            </summary>
        </member>
        <member name="F:System.Data.SQLite.UpdateEventType.Insert">
            <summary>
            A row is being inserted into the table.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.UpdateEventType.Update">
            <summary>
            A row is being updated in the table.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.UpdateEventArgs">
            <summary>
            Passed during an Update callback, these event arguments detail the type of update operation being performed
            on the given connection.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.UpdateEventArgs.Database">
            <summary>
            The name of the database being updated (usually "main" but can be any attached or temporary database)
            </summary>
        </member>
        <member name="F:System.Data.SQLite.UpdateEventArgs.Table">
            <summary>
            The name of the table being updated
            </summary>
        </member>
        <member name="F:System.Data.SQLite.UpdateEventArgs.Event">
            <summary>
            The type of update being performed (insert/update/delete)
            </summary>
        </member>
        <member name="F:System.Data.SQLite.UpdateEventArgs.RowId">
            <summary>
            The RowId affected by this update.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.CommitEventArgs">
            <summary>
            Event arguments raised when a transaction is being committed
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CommitEventArgs.AbortTransaction">
            <summary>
            Set to true to abort the transaction and trigger a rollback
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteFunction">
            <summary>
            This abstract class is designed to handle user-defined functions easily.  An instance of the derived class is made for each
            connection to the database.
            </summary>
            <remarks>
            Although there is one instance of a class derived from SQLiteFunction per database connection, the derived class has no access
            to the underlying connection.  This is necessary to deter implementers from thinking it would be a good idea to make database
            calls during processing.
            
            It is important to distinguish between a per-connection instance, and a per-SQL statement context.  One instance of this class
            services all SQL statements being stepped through on that connection, and there can be many.  One should never store per-statement
            information in member variables of user-defined function classes.
            
            For aggregate functions, always create and store your per-statement data in the contextData object on the 1st step.  This data will
            be automatically freed for you (and Dispose() called if the item supports IDisposable) when the statement completes.
            </remarks>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFunction._base">
            <summary>
            The base connection this function is attached to
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFunction._contextDataList">
            <summary>
            Internal array used to keep track of aggregate function context data
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFunction._InvokeFunc">
            <summary>
            Holds a reference to the callback function for user functions
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFunction._StepFunc">
            <summary>
            Holds a reference to the callbakc function for stepping in an aggregate function
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFunction._FinalFunc">
            <summary>
            Holds a reference to the callback function for finalizing an aggregate function
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFunction._CompareFunc">
            <summary>
            Holds a reference to the callback function for collation sequences
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFunction._context">
            <summary>
            Current context of the current callback.  Only valid during a callback
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFunction._registeredFunctions">
            <summary>
            This static list contains all the user-defined functions declared using the proper attributes.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.#ctor">
            <summary>
            Internal constructor, initializes the function's internal variables.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.Invoke(System.Object[])">
            <summary>
            Scalar functions override this method to do their magic.
            </summary>
            <remarks>
            Parameters passed to functions have only an affinity for a certain data type, there is no underlying schema available
            to force them into a certain type.  Therefore the only types you will ever see as parameters are
            DBNull.Value, Int64, Double, String or byte[] array.
            </remarks>
            <param name="args">The arguments for the command to process</param>
            <returns>You may return most simple types as a return value, null or DBNull.Value to return null, DateTime, or
            you may return an Exception-derived class if you wish to return an error to SQLite.  Do not actually throw the error,
            just return it!</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.Step(System.Object[],System.Int32,System.Object@)">
            <summary>
            Aggregate functions override this method to do their magic.
            </summary>
            <remarks>
            Typically you'll be updating whatever you've placed in the contextData field and returning as quickly as possible.
            </remarks>
            <param name="args">The arguments for the command to process</param>
            <param name="stepNumber">The 1-based step number.  This is incrememted each time the step method is called.</param>
            <param name="contextData">A placeholder for implementers to store contextual data pertaining to the current context.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.Final(System.Object)">
            <summary>
            Aggregate functions override this method to finish their aggregate processing.
            </summary>
            <remarks>
            If you implemented your aggregate function properly,
            you've been recording and keeping track of your data in the contextData object provided, and now at this stage you should have
            all the information you need in there to figure out what to return.
            NOTE:  It is possible to arrive here without receiving a previous call to Step(), in which case the contextData will
            be null.  This can happen when no rows were returned.  You can either return null, or 0 or some other custom return value
            if that is the case.
            </remarks>
            <param name="contextData">Your own assigned contextData, provided for you so you can return your final results.</param>
            <returns>You may return most simple types as a return value, null or DBNull.Value to return null, DateTime, or
            you may return an Exception-derived class if you wish to return an error to SQLite.  Do not actually throw the error,
            just return it!
            </returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.Compare(System.String,System.String)">
            <summary>
            User-defined collation sequences override this method to provide a custom string sorting algorithm.
            </summary>
            <param name="param1">The first string to compare</param>
            <param name="param2">The second strnig to compare</param>
            <returns>1 if param1 is greater than param2, 0 if they are equal, or -1 if param1 is less than param2</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.ConvertParams(System.Int32,System.IntPtr)">
            <summary>
            Converts an IntPtr array of context arguments to an object array containing the resolved parameters the pointers point to.
            </summary>
            <remarks>
            Parameters passed to functions have only an affinity for a certain data type, there is no underlying schema available
            to force them into a certain type.  Therefore the only types you will ever see as parameters are
            DBNull.Value, Int64, Double, String or byte[] array.
            </remarks>
            <param name="nArgs">The number of arguments</param>
            <param name="argsptr">A pointer to the array of arguments</param>
            <returns>An object array of the arguments once they've been converted to .NET values</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.SetReturnValue(System.IntPtr,System.Object)">
            <summary>
            Takes the return value from Invoke() and Final() and figures out how to return it to SQLite's context.
            </summary>
            <param name="context">The context the return value applies to</param>
            <param name="returnValue">The parameter to return to SQLite</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.ScalarCallback(System.IntPtr,System.Int32,System.IntPtr)">
            <summary>
            Internal scalar callback function, which wraps the raw context pointer and calls the virtual Invoke() method.
            </summary>
            <param name="context">A raw context pointer</param>
            <param name="nArgs">Number of arguments passed in</param>
            <param name="argsptr">A pointer to the array of arguments</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.CompareCallback(System.IntPtr,System.Int32,System.IntPtr,System.Int32,System.IntPtr)">
            <summary>
            Internal collation sequence function, which wraps up the raw string pointers and executes the Compare() virtual function.
            </summary>
            <param name="ptr">Not used</param>
            <param name="len1">Length of the string pv1</param>
            <param name="ptr1">Pointer to the first string to compare</param>
            <param name="len2">Length of the string pv2</param>
            <param name="ptr2">Pointer to the second string to compare</param>
            <returns>Returns -1 if the first string is less than the second.  0 if they are equal, or 1 if the first string is greater
            than the second.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.StepCallback(System.IntPtr,System.Int32,System.IntPtr)">
            <summary>
            The internal aggregate Step function callback, which wraps the raw context pointer and calls the virtual Step() method.
            </summary>
            <remarks>
            This function takes care of doing the lookups and getting the important information put together to call the Step() function.
            That includes pulling out the user's contextData and updating it after the call is made.  We use a sorted list for this so
            binary searches can be done to find the data.
            </remarks>
            <param name="context">A raw context pointer</param>
            <param name="nArgs">Number of arguments passed in</param>
            <param name="argsptr">A pointer to the array of arguments</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.FinalCallback(System.IntPtr)">
            <summary>
            An internal aggregate Final function callback, which wraps the context pointer and calls the virtual Final() method.
            </summary>
            <param name="context">A raw context pointer</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.Dispose(System.Boolean)">
            <summary>
            Placeholder for a user-defined disposal routine
            </summary>
            <param name="disposing">True if the object is being disposed explicitly</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.Dispose">
            <summary>
            Disposes of any active contextData variables that were not automatically cleaned up.  Sometimes this can happen if
            someone closes the connection while a DataReader is open.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.#cctor">
            <summary>
            Using reflection, enumerate all assemblies in the current appdomain looking for classes that
            have a SQLiteFunctionAttribute attribute, and registering them accordingly.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.RegisterFunction(System.Type)">
            <summary>
            Manual method of registering a function.  The type must still have the SQLiteFunctionAttributes in order to work
            properly, but this is a workaround for the Compact Framework where enumerating assemblies is not currently supported.
            </summary>
            <param name="typ">The type of the function to register</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.BindFunctions(System.Data.SQLite.SQLiteBase)">
            <summary>
            Called by SQLiteBase derived classes, this function binds all user-defined functions to a connection.
            It is done this way so that all user-defined functions will access the database using the same encoding scheme
            as the connection (UTF-8 or UTF-16).
            </summary>
            <remarks>
            The wrapper functions that interop with SQLite will create a unique cookie value, which internally is a pointer to
            all the wrapped callback functions.  The interop function uses it to map CDecl callbacks to StdCall callbacks.
            </remarks>
            <param name="sqlbase">The base object on which the functions are to bind</param>
            <returns>Returns an array of functions which the connection object should retain until the connection is closed.</returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteFunction.SQLiteConvert">
            <summary>
            Returns a reference to the underlying connection's SQLiteConvert class, which can be used to convert
            strings and DateTime's into the current connection's encoding schema.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteFunctionEx">
            <summary>
            Extends SQLiteFunction and allows an inherited class to obtain the collating sequence associated with a function call.
            </summary>
            <remarks>
            User-defined functions can call the GetCollationSequence() method in this class and use it to compare strings and char arrays.
            </remarks>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunctionEx.GetCollationSequence">
            <summary>
            Obtains the collating sequence in effect for the given function.
            </summary>
            <returns></returns>
        </member>
        <member name="T:System.Data.SQLite.FunctionType">
            <summary>
            The type of user-defined function to declare
            </summary>
        </member>
        <member name="F:System.Data.SQLite.FunctionType.Scalar">
            <summary>
            Scalar functions are designed to be called and return a result immediately.  Examples include ABS(), Upper(), Lower(), etc.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.FunctionType.Aggregate">
            <summary>
            Aggregate functions are designed to accumulate data until the end of a call and then return a result gleaned from the accumulated data.
            Examples include SUM(), COUNT(), AVG(), etc.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.FunctionType.Collation">
            <summary>
            Collation sequences are used to sort textual data in a custom manner, and appear in an ORDER BY clause.  Typically text in an ORDER BY is
            sorted using a straight case-insensitive comparison function.  Custom collating sequences can be used to alter the behavior of text sorting
            in a user-defined manner.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteCallback">
            <summary>
            An internal callback delegate declaration.
            </summary>
            <param name="context">Raw context pointer for the user function</param>
            <param name="nArgs">Count of arguments to the function</param>
            <param name="argsptr">A pointer to the array of argument pointers</param>
        </member>
        <member name="T:System.Data.SQLite.SQLiteFinalCallback">
            <summary>
            An internal final callback delegate declaration.
            </summary>
            <param name="context">Raw context pointer for the user function</param>
        </member>
        <member name="T:System.Data.SQLite.SQLiteCollation">
            <summary>
            Internal callback delegate for implementing collation sequences
            </summary>
            <param name="puser">Not used</param>
            <param name="len1">Length of the string pv1</param>
            <param name="pv1">Pointer to the first string to compare</param>
            <param name="len2">Length of the string pv2</param>
            <param name="pv2">Pointer to the second string to compare</param>
            <returns>Returns -1 if the first string is less than the second.  0 if they are equal, or 1 if the first string is greater
            than the second.</returns>
        </member>
        <member name="T:System.Data.SQLite.CollationTypeEnum">
            <summary>
            The type of collating sequence
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationTypeEnum.Binary">
            <summary>
            The built-in BINARY collating sequence
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationTypeEnum.NoCase">
            <summary>
            The built-in NOCASE collating sequence
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationTypeEnum.Reverse">
            <summary>
            The built-in REVERSE collating sequence
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationTypeEnum.Custom">
            <summary>
            A custom user-defined collating sequence
            </summary>
        </member>
        <member name="T:System.Data.SQLite.CollationEncodingEnum">
            <summary>
            The encoding type the collation sequence uses
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationEncodingEnum.UTF8">
            <summary>
            The collation sequence is UTF8
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationEncodingEnum.UTF16LE">
            <summary>
            The collation sequence is UTF16 little-endian
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationEncodingEnum.UTF16BE">
            <summary>
            The collation sequence is UTF16 big-endian
            </summary>
        </member>
        <member name="T:System.Data.SQLite.CollationSequence">
            <summary>
            A struct describing the collating sequence a function is executing in
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationSequence.Name">
            <summary>
            The name of the collating sequence
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationSequence.Type">
            <summary>
            The type of collating sequence
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationSequence.Encoding">
            <summary>
            The text encoding of the collation sequence
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationSequence._func">
            <summary>
            Context of the function that requested the collating sequence
            </summary>
        </member>
        <member name="M:System.Data.SQLite.CollationSequence.Compare(System.String,System.String)">
            <summary>
            Calls the base collating sequence to compare two strings
            </summary>
            <param name="s1">The first string to compare</param>
            <param name="s2">The second string to compare</param>
            <returns>-1 if s1 is less than s2, 0 if s1 is equal to s2, and 1 if s1 is greater than s2</returns>
        </member>
        <member name="M:System.Data.SQLite.CollationSequence.Compare(System.Char[],System.Char[])">
            <summary>
            Calls the base collating sequence to compare two character arrays
            </summary>
            <param name="c1">The first array to compare</param>
            <param name="c2">The second array to compare</param>
            <returns>-1 if c1 is less than c2, 0 if c1 is equal to c2, and 1 if c1 is greater than c2</returns>
        </member>
        <member name="T:System.Data.SQLite.SQLiteFactory">
            <summary>
            SQLite implementation of DbProviderFactory.
            </summary>
            <summary>
            SQLite implementation of DbProviderFactory.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFactory.Instance">
            <summary>
            Static instance member which returns an instanced SQLiteFactory class.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateCommand">
            <summary>
            Returns a new SQLiteCommand object.
            </summary>
            <returns>A SQLiteCommand object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateCommandBuilder">
            <summary>
            Returns a new SQLiteCommandBuilder object.
            </summary>
            <returns>A SQLiteCommandBuilder object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateConnection">
            <summary>
            Creates a new SQLiteConnection.
            </summary>
            <returns>A SQLiteConnection object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateConnectionStringBuilder">
            <summary>
            Creates a new SQLiteConnectionStringBuilder.
            </summary>
            <returns>A SQLiteConnectionStringBuilder object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateDataAdapter">
            <summary>
            Creates a new SQLiteDataAdapter.
            </summary>
            <returns>A SQLiteDataAdapter object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateParameter">
            <summary>
            Creates a new SQLiteParameter.
            </summary>
            <returns>A SQLiteParameter object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.System#IServiceProvider#GetService(System.Type)">
            <summary>
            Will provide a DbProviderServices object in .NET 3.5
            </summary>
            <param name="serviceType">The class or interface type to query for</param>
            <returns></returns>
        </member>
        <member name="T:System.Data.SQLite.SQLiteException">
            <summary>
            SQLite exception class.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteException.#ctor(System.Int32,System.String)">
            <summary>
            Public constructor for generating a SQLite error given the base error code
            </summary>
            <param name="errorCode">The SQLite error code to report</param>
            <param name="extendedInformation">Extra text to go along with the error message text</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteException.#ctor(System.String)">
            <summary>
            Various public constructors that just pass along to the base Exception
            </summary>
            <param name="message">Passed verbatim to Exception</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteException.#ctor">
            <summary>
            Various public constructors that just pass along to the base Exception
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteException.#ctor(System.String,System.Exception)">
            <summary>
            Various public constructors that just pass along to the base Exception
            <param name="message">Passed to Exception</param>
            <param name="innerException">Passed to Exception</param>
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteException.GetStockErrorMessage(System.Int32,System.String)">
            <summary>
            Initializes the exception class with the SQLite error code.
            </summary>
            <param name="errorCode">The SQLite error code</param>
            <param name="errorMessage">A detailed error message</param>
            <returns>An error message string</returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteException.ErrorCode">
            <summary>
            Retrieves the underlying SQLite error code for this exception
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteErrorCode">
            <summary>
            SQLite error codes
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Ok">
            <summary>
            Success
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Error">
            <summary>
            SQL error or missing database
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Internal">
            <summary>
            Internal logic error in SQLite
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Perm">
            <summary>
            Access permission denied
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Abort">
            <summary>
            Callback routine requested an abort
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Busy">
            <summary>
            The database file is locked
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Locked">
            <summary>
            A table in the database is locked
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.NoMem">
            <summary>
            malloc() failed
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.ReadOnly">
            <summary>
            Attempt to write a read-only database
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Interrupt">
            <summary>
            Operation terminated by sqlite3_interrupt()
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.IOErr">
            <summary>
            Some kind of disk I/O error occurred
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Corrupt">
            <summary>
            The database disk image is malformed
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.NotFound">
            <summary>
            Table or record not found
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Full">
            <summary>
            Insertion failed because database is full
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.CantOpen">
            <summary>
            Unable to open the database file
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Protocol">
            <summary>
            Database lock protocol error
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Empty">
            <summary>
            Database is empty
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Schema">
            <summary>
            The database schema changed
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.TooBig">
            <summary>
            Too much data for one row of a table
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Constraint">
            <summary>
            Abort due to constraint violation
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Mismatch">
            <summary>
            Data type mismatch
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Misuse">
            <summary>
            Library used incorrectly
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.NOLFS">
            <summary>
            Uses OS features not supported on host
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Auth">
            <summary>
            Authorization denied
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Format">
            <summary>
            Auxiliary database format error
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Range">
            <summary>
            2nd parameter to sqlite3_bind out of range
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.NotADatabase">
            <summary>
            File opened that is not a database file
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Row">
            <summary>
            sqlite3_step() has another row ready
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Done">
            <summary>
            sqlite3_step() has finished executing
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteBase">
            <summary>
            This internal class provides the foundation of SQLite support.  It defines all the abstract members needed to implement
            a SQLite data provider, and inherits from SQLiteConvert which allows for simple translations of string to and from SQLite.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteConvert">
            <summary>
            This base class provides datatype conversion services for the SQLite provider.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConvert._datetimeFormats">
            <summary>
            An array of ISO8601 datetime formats we support conversion from
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConvert._utf8">
            <summary>
            An UTF-8 Encoding instance, so we can convert strings to and from UTF-8
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConvert._datetimeFormat">
            <summary>
            The default DateTime format for this instance
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.#ctor(System.Data.SQLite.SQLiteDateFormats)">
            <summary>
            Initializes the conversion class
            </summary>
            <param name="fmt">The default date/time format to use for this instance</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToUTF8(System.String)">
            <summary>
            Converts a string to a UTF-8 encoded byte array sized to include a null-terminating character.
            </summary>
            <param name="sourceText">The string to convert to UTF-8</param>
            <returns>A byte array containing the converted string plus an extra 0 terminating byte at the end of the array.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToUTF8(System.DateTime)">
            <summary>
            Convert a DateTime to a UTF-8 encoded, zero-terminated byte array.
            </summary>
            <remarks>
            This function is a convenience function, which first calls ToString() on the DateTime, and then calls ToUTF8() with the
            string result.
            </remarks>
            <param name="dateTimeValue">The DateTime to convert.</param>
            <returns>The UTF-8 encoded string, including a 0 terminating byte at the end of the array.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToString(System.IntPtr,System.Int32)">
            <summary>
            Converts a UTF-8 encoded IntPtr of the specified length into a .NET string
            </summary>
            <param name="nativestring">The pointer to the memory where the UTF-8 string is encoded</param>
            <param name="nativestringlen">The number of bytes to decode</param>
            <returns>A string containing the translated character(s)</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.UTF8ToString(System.IntPtr,System.Int32)">
            <summary>
            Converts a UTF-8 encoded IntPtr of the specified length into a .NET string
            </summary>
            <param name="nativestring">The pointer to the memory where the UTF-8 string is encoded</param>
            <param name="nativestringlen">The number of bytes to decode</param>
            <returns>A string containing the translated character(s)</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToDateTime(System.String)">
            <summary>
            Converts a string into a DateTime, using the current DateTimeFormat specified for the connection when it was opened.
            </summary>
            <remarks>
            Acceptable ISO8601 DateTime formats are:
              yyyy-MM-dd HH:mm:ss
              yyyyMMddHHmmss
              yyyyMMddTHHmmssfffffff
              yyyy-MM-dd
              yy-MM-dd
              yyyyMMdd
              HH:mm:ss
              THHmmss
            </remarks>
            <param name="dateText">The string containing either a Tick value, a JulianDay double, or an ISO8601-format string</param>
            <returns>A DateTime value</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToDateTime(System.Double)">
            <summary>
            Converts a julianday value into a DateTime
            </summary>
            <param name="julianDay">The value to convert</param>
            <returns>A .NET DateTime</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToJulianDay(System.DateTime)">
            <summary>
            Converts a DateTime struct to a JulianDay double
            </summary>
            <param name="value">The DateTime to convert</param>
            <returns>The JulianDay value the Datetime represents</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToString(System.DateTime)">
            <summary>
            Converts a DateTime to a string value, using the current DateTimeFormat specified for the connection when it was opened.
            </summary>
            <param name="dateValue">The DateTime value to convert</param>
            <returns>Either a string consisting of the tick count for DateTimeFormat.Ticks, a JulianDay double, or a date/time in ISO8601 format.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToDateTime(System.IntPtr,System.Int32)">
            <summary>
            Internal function to convert a UTF-8 encoded IntPtr of the specified length to a DateTime.
            </summary>
            <remarks>
            This is a convenience function, which first calls ToString() on the IntPtr to convert it to a string, then calls
            ToDateTime() on the string to return a DateTime.
            </remarks>
            <param name="ptr">A pointer to the UTF-8 encoded string</param>
            <param name="len">The length in bytes of the string</param>
            <returns>The parsed DateTime value</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.Split(System.String,System.Char)">
            <summary>
            Smart method of splitting a string.  Skips quoted elements, removes the quotes.
            </summary>
            <remarks>
            This split function works somewhat like the String.Split() function in that it breaks apart a string into
            pieces and returns the pieces as an array.  The primary differences are:
            <list type="bullet">
            <item><description>Only one character can be provided as a separator character</description></item>
            <item><description>Quoted text inside the string is skipped over when searching for the separator, and the quotes are removed.</description></item>
            </list>
            Thus, if splitting the following string looking for a comma:<br/>
            One,Two, "Three, Four", Five<br/>
            <br/>
            The resulting array would contain<br/>
            [0] One<br/>
            [1] Two<br/>
            [2] Three, Four<br/>
            [3] Five<br/>
            <br/>
            Note that the leading and trailing spaces were removed from each item during the split.
            </remarks>
            <param name="source">Source string to split apart</param>
            <param name="separator">Separator character</param>
            <returns>A string array of the split up elements</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToBoolean(System.Object)">
            <summary>
            Convert a value to true or false.
            </summary>
            <param name="source">A string or number representing true or false</param>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToBoolean(System.String)">
            <summary>
            Convert a string to true or false.
            </summary>
            <param name="source">A string representing true or false</param>
            <returns></returns>
            <remarks>
            "yes", "no", "y", "n", "0", "1", "on", "off" as well as Boolean.FalseString and Boolean.TrueString will all be
            converted to a proper boolean value.
            </remarks>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ColumnToType(System.Data.SQLite.SQLiteStatement,System.Int32,System.Data.SQLite.SQLiteType)">
            <summary>
            Determines the data type of a column in a statement
            </summary>
            <param name="stmt">The statement to retrieve information for</param>
            <param name="i">The column to retrieve type information on</param>
            <param name="typ">The SQLiteType to receive the affinity for the given column</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.SQLiteTypeToType(System.Data.SQLite.SQLiteType)">
            <summary>
            Converts a SQLiteType to a .NET Type object
            </summary>
            <param name="t">The SQLiteType to convert</param>
            <returns>Returns a .NET Type object</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.TypeToDbType(System.Type)">
            <summary>
            For a given intrinsic type, return a DbType
            </summary>
            <param name="typ">The native type to convert</param>
            <returns>The corresponding (closest match) DbType</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.DbTypeToColumnSize(System.Data.DbType)">
            <summary>
            Returns the ColumnSize for the given DbType
            </summary>
            <param name="typ">The DbType to get the size of</param>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.DbTypeToType(System.Data.DbType)">
            <summary>
            Convert a DbType to a Type
            </summary>
            <param name="typ">The DbType to convert from</param>
            <returns>The closest-match .NET type</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.TypeToAffinity(System.Type)">
            <summary>
            For a given type, return the closest-match SQLite TypeAffinity, which only understands a very limited subset of types.
            </summary>
            <param name="typ">The type to evaluate</param>
            <returns>The SQLite type affinity for that type.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.TypeNameToDbType(System.String)">
            <summary>
            For a given type name, return a closest-match .NET type
            </summary>
            <param name="Name">The name of the type to match</param>
            <returns>The .NET DBType the text evaluates to.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.Open(System.String,System.Data.SQLite.SQLiteOpenFlagsEnum,System.Int32,System.Boolean)">
            <summary>
            Opens a database.
            </summary>
            <remarks>
            Implementers should call SQLiteFunction.BindFunctions() and save the array after opening a connection
            to bind all attributed user-defined functions and collating sequences to the new connection.
            </remarks>
            <param name="strFilename">The filename of the database to open.  SQLite automatically creates it if it doesn't exist.</param>
            <param name="flags">The open flags to use when creating the connection</param>
            <param name="maxPoolSize">The maximum size of the pool for the given filename</param>
            <param name="usePool">If true, the connection can be pulled from the connection pool</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.Close">
            <summary>
            Closes the currently-open database.
            </summary>
            <remarks>
            After the database has been closed implemeters should call SQLiteFunction.UnbindFunctions() to deallocate all interop allocated
            memory associated with the user-defined functions and collating sequences tied to the closed connection.
            </remarks>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.SetTimeout(System.Int32)">
            <summary>
            Sets the busy timeout on the connection.  SQLiteCommand will call this before executing any command.
            </summary>
            <param name="nTimeoutMS">The number of milliseconds to wait before returning SQLITE_BUSY</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.SQLiteLastError">
            <summary>
            Returns the text of the last error issued by SQLite
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.ClearPool">
            <summary>
            When pooling is enabled, force this connection to be disposed rather than returned to the pool
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.Prepare(System.Data.SQLite.SQLiteConnection,System.String,System.Data.SQLite.SQLiteStatement,System.UInt32,System.String@)">
            <summary>
            Prepares a SQL statement for execution.
            </summary>
            <param name="cnn">The source connection preparing the command.  Can be null for any caller except LINQ</param>
            <param name="strSql">The SQL command text to prepare</param>
            <param name="previous">The previous statement in a multi-statement command, or null if no previous statement exists</param>
            <param name="timeoutMS">The timeout to wait before aborting the prepare</param>
            <param name="strRemain">The remainder of the statement that was not processed.  Each call to prepare parses the
            SQL up to to either the end of the text or to the first semi-colon delimiter.  The remaining text is returned
            here for a subsequent call to Prepare() until all the text has been processed.</param>
            <returns>Returns an initialized SQLiteStatement.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.Step(System.Data.SQLite.SQLiteStatement)">
            <summary>
            Steps through a prepared statement.
            </summary>
            <param name="stmt">The SQLiteStatement to step through</param>
            <returns>True if a row was returned, False if not.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.Reset(System.Data.SQLite.SQLiteStatement)">
            <summary>
            Resets a prepared statement so it can be executed again.  If the error returned is SQLITE_SCHEMA, 
            transparently attempt to rebuild the SQL statement and throw an error if that was not possible.
            </summary>
            <param name="stmt">The statement to reset</param>
            <returns>Returns -1 if the schema changed while resetting, 0 if the reset was sucessful or 6 (SQLITE_LOCKED) if the reset failed due to a lock</returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteBase.Version">
            <summary>
            Returns a string representing the active version of SQLite
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteBase.Changes">
            <summary>
            Returns the number of changes the last executing insert/update caused.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.TypeAffinity">
            <summary>
            SQLite has very limited types, and is inherently text-based.  The first 5 types below represent the sum of all types SQLite
            understands.  The DateTime extension to the spec is for internal use only.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.TypeAffinity.Uninitialized">
            <summary>
            Not used
            </summary>
        </member>
        <member name="F:System.Data.SQLite.TypeAffinity.Int64">
            <summary>
            All integers in SQLite default to Int64
            </summary>
        </member>
        <member name="F:System.Data.SQLite.TypeAffinity.Double">
            <summary>
            All floating point numbers in SQLite default to double
            </summary>
        </member>
        <member name="F:System.Data.SQLite.TypeAffinity.Text">
            <summary>
            The default data type of SQLite is text
            </summary>
        </member>
        <member name="F:System.Data.SQLite.TypeAffinity.Blob">
            <summary>
            Typically blob types are only seen when returned from a function
            </summary>
        </member>
        <member name="F:System.Data.SQLite.TypeAffinity.Null">
            <summary>
            Null types can be returned from functions
            </summary>
        </member>
        <member name="F:System.Data.SQLite.TypeAffinity.DateTime">
            <summary>
            Used internally by this provider
            </summary>
        </member>
        <member name="F:System.Data.SQLite.TypeAffinity.None">
            <summary>
            Used internally
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteDateFormats">
            <summary>
            This implementation of SQLite for ADO.NET can process date/time fields in databases in only one of three formats.  Ticks, ISO8601
            and JulianDay.
            </summary>
            <remarks>
            ISO8601 is more compatible, readable, fully-processable, but less accurate as it doesn't provide time down to fractions of a second.
            JulianDay is the numeric format the SQLite uses internally and is arguably the most compatible with 3rd party tools.  It is
            not readable as text without post-processing.
            Ticks less compatible with 3rd party tools that query the database, and renders the DateTime field unreadable as text without post-processing.
            
            The preferred order of choosing a datetime format is JulianDay, ISO8601, and then Ticks.  Ticks is mainly present for legacy 
            code support.
            </remarks>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDateFormats.Ticks">
            <summary>
            Using ticks is not recommended and is not well supported with LINQ.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDateFormats.ISO8601">
            <summary>
            The default format for this provider.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDateFormats.JulianDay">
            <summary>
            JulianDay format, which is what SQLite uses internally
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteJournalModeEnum">
            <summary>
            This enum determines how SQLite treats its journal file.
            </summary>
            <remarks>
            By default SQLite will create and delete the journal file when needed during a transaction.
            However, for some computers running certain filesystem monitoring tools, the rapid
            creation and deletion of the journal file can cause those programs to fail, or to interfere with SQLite.
            
            If a program or virus scanner is interfering with SQLite's journal file, you may receive errors like "unable to open database file"
            when starting a transaction.  If this is happening, you may want to change the default journal mode to Persist.
            </remarks>
        </member>
        <member name="F:System.Data.SQLite.SQLiteJournalModeEnum.Delete">
            <summary>
            The default mode, this causes SQLite to create and destroy the journal file as-needed.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteJournalModeEnum.Persist">
            <summary>
            When this is set, SQLite will keep the journal file even after a transaction has completed.  It's contents will be erased,
            and the journal re-used as often as needed.  If it is deleted, it will be recreated the next time it is needed.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteJournalModeEnum.Off">
            <summary>
            This option disables the rollback journal entirely.  Interrupted transactions or a program crash can cause database
            corruption in this mode!
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteType">
            <summary>
            Struct used internally to determine the datatype of a column in a resultset
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteType.Type">
            <summary>
            The DbType of the column, or DbType.Object if it cannot be determined
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteType.Affinity">
            <summary>
            The affinity of a column, used for expressions or when Type is DbType.Object
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteStatement">
            <summary>
            Represents a single SQL statement in SQLite.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteStatement._sql">
            <summary>
            The underlying SQLite object this statement is bound to
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteStatement._sqlStatement">
            <summary>
            The command text of this SQL statement
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteStatement._sqlite_stmt">
            <summary>
            The actual statement pointer
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteStatement._unnamedParameters">
            <summary>
            An index from which unnamed parameters begin
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteStatement._paramNames">
            <summary>
            Names of the parameters as SQLite understands them to be
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteStatement._paramValues">
            <summary>
            Parameters for this statement
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteStatement._command">
            <summary>
            Command this statement belongs to (if any)
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteStatement.#ctor(System.Data.SQLite.SQLiteBase,System.Data.SQLite.SQLiteStatementHandle,System.String,System.Data.SQLite.SQLiteStatement)">
            <summary>
            Initializes the statement and attempts to get all information about parameters in the statement
            </summary>
            <param name="sqlbase">The base SQLite object</param>
            <param name="stmt">The statement</param>
            <param name="strCommand">The command text for this statement</param>
            <param name="previous">The previous command in a multi-statement command</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteStatement.MapParameter(System.String,System.Data.SQLite.SQLiteParameter)">
            <summary>
            Called by SQLiteParameterCollection, this function determines if the specified parameter name belongs to
            this statement, and if so, keeps a reference to the parameter so it can be bound later.
            </summary>
            <param name="s">The parameter name to map</param>
            <param name="p">The parameter to assign it</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteStatement.Dispose">
            <summary>
            Disposes and finalizes the statement
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteStatement.BindParameters">
            <summary>
             Bind all parameters, making sure the caller didn't miss any
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteStatement.BindParameter(System.Int32,System.Data.SQLite.SQLiteParameter)">
            <summary>
            Perform the bind operation for an individual parameter
            </summary>
            <param name="index">The index of the parameter to bind</param>
            <param name="param">The parameter we're binding</param>
        </member>
        <member name="T:System.Data.SQLite.SQLiteDataReader">
            <summary>
            SQLite implementation of DbDataReader.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._command">
            <summary>
            Underlying command this reader is attached to
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._activeStatementIndex">
            <summary>
            Index of the current statement in the command being processed
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._activeStatement">
            <summary>
            Current statement being Read()
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._readingState">
            <summary>
            State of the current statement being processed.
            -1 = First Step() executed, so the first Read() will be ignored
             0 = Actively reading
             1 = Finished reading
             2 = Non-row-returning statement, no records
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._rowsAffected">
            <summary>
            Number of records affected by the insert/update statements executed on the command
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._fieldCount">
            <summary>
            Count of fields (columns) in the row-returning statement currently being processed
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._fieldTypeArray">
            <summary>
            Datatypes of active fields (columns) in the current statement, used for type-restricting data
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._commandBehavior">
            <summary>
            The behavior of the datareader
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._disposeCommand">
            <summary>
            If set, then dispose of the command object when the reader is finished
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._keyInfo">
            <summary>
            An array of rowid's for the active statement if CommandBehavior.KeyInfo is specified
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.#ctor(System.Data.SQLite.SQLiteCommand,System.Data.CommandBehavior)">
            <summary>
            Internal constructor, initializes the datareader and sets up to begin executing statements
            </summary>
            <param name="cmd">The SQLiteCommand this data reader is for</param>
            <param name="behave">The expected behavior of the data reader</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.Close">
            <summary>
            Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.CheckClosed">
            <summary>
            Throw an error if the datareader is closed
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.CheckValidRow">
            <summary>
            Throw an error if a row is not loaded
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetEnumerator">
            <summary>
            Enumerator support
            </summary>
            <returns>Returns a DbEnumerator object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.VerifyType(System.Int32,System.Data.DbType)">
            <summary>
            SQLite is inherently un-typed.  All datatypes in SQLite are natively strings.  The definition of the columns of a table
            and the affinity of returned types are all we have to go on to type-restrict data in the reader.
            
            This function attempts to verify that the type of data being requested of a column matches the datatype of the column.  In
            the case of columns that are not backed into a table definition, we attempt to match up the affinity of a column (int, double, string or blob)
            to a set of known types that closely match that affinity.  It's not an exact science, but its the best we can do.
            </summary>
            <returns>
            This function throws an InvalidTypeCast() exception if the requested type doesn't match the column's definition or affinity.
            </returns>
            <param name="i">The index of the column to type-check</param>
            <param name="typ">The type we want to get out of the column</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetBoolean(System.Int32)">
            <summary>
            Retrieves the column as a boolean value
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>bool</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetByte(System.Int32)">
            <summary>
            Retrieves the column as a single byte value
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>byte</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetBytes(System.Int32,System.Int64,System.Byte[],System.Int32,System.Int32)">
            <summary>
            Retrieves a column as an array of bytes (blob)
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <param name="fieldOffset">The zero-based index of where to begin reading the data</param>
            <param name="buffer">The buffer to write the bytes into</param>
            <param name="bufferoffset">The zero-based index of where to begin writing into the array</param>
            <param name="length">The number of bytes to retrieve</param>
            <returns>The actual number of bytes written into the array</returns>
            <remarks>
            To determine the number of bytes in the column, pass a null value for the buffer.  The total length will be returned.
            </remarks>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetChar(System.Int32)">
            <summary>
            Returns the column as a single character
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>char</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetChars(System.Int32,System.Int64,System.Char[],System.Int32,System.Int32)">
            <summary>
            Retrieves a column as an array of chars (blob)
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <param name="fieldoffset">The zero-based index of where to begin reading the data</param>
            <param name="buffer">The buffer to write the characters into</param>
            <param name="bufferoffset">The zero-based index of where to begin writing into the array</param>
            <param name="length">The number of bytes to retrieve</param>
            <returns>The actual number of characters written into the array</returns>
            <remarks>
            To determine the number of characters in the column, pass a null value for the buffer.  The total length will be returned.
            </remarks>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetDataTypeName(System.Int32)">
            <summary>
            Retrieves the name of the back-end datatype of the column
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>string</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetDateTime(System.Int32)">
            <summary>
            Retrieve the column as a date/time value
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>DateTime</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetDecimal(System.Int32)">
            <summary>
            Retrieve the column as a decimal value
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>decimal</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetDouble(System.Int32)">
            <summary>
            Returns the column as a double
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>double</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetFieldType(System.Int32)">
            <summary>
            Returns the .NET type of a given column
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>Type</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetFloat(System.Int32)">
            <summary>
            Returns a column as a float value
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>float</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetGuid(System.Int32)">
            <summary>
            Returns the column as a Guid
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>Guid</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetInt16(System.Int32)">
            <summary>
            Returns the column as a short
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>Int16</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetInt32(System.Int32)">
            <summary>
            Retrieves the column as an int
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>Int32</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetInt64(System.Int32)">
            <summary>
            Retrieves the column as a long
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>Int64</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetName(System.Int32)">
            <summary>
            Retrieves the name of the column
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>string</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetOrdinal(System.String)">
            <summary>
            Retrieves the i of a column, given its name
            </summary>
            <param name="name">The name of the column to retrieve</param>
            <returns>The int i of the column</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetSchemaTable">
            <summary>
            Schema information in SQLite is difficult to map into .NET conventions, so a lot of work must be done
            to gather the necessary information so it can be represented in an ADO.NET manner.
            </summary>
            <returns>Returns a DataTable containing the schema information for the active SELECT statement being processed.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetString(System.Int32)">
            <summary>
            Retrieves the column as a string
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>string</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetValue(System.Int32)">
            <summary>
            Retrieves the column as an object corresponding to the underlying datatype of the column
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>object</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetValues(System.Object[])">
            <summary>
            Retreives the values of multiple columns, up to the size of the supplied array
            </summary>
            <param name="values">The array to fill with values from the columns in the current resultset</param>
            <returns>The number of columns retrieved</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.IsDBNull(System.Int32)">
            <summary>
            Returns True if the specified column is null
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>True or False</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.NextResult">
            <summary>
            Moves to the next resultset in multiple row-returning SQL command.
            </summary>
            <returns>True if the command was successful and a new resultset is available, False otherwise.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetSQLiteType(System.Int32)">
            <summary>
            Retrieves the SQLiteType for a given column, and caches it to avoid repetetive interop calls.
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>A SQLiteType structure</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.Read">
            <summary>
            Reads the next row from the resultset
            </summary>
            <returns>True if a new row was successfully loaded and is ready for processing</returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataReader.Depth">
            <summary>
            Not implemented.  Returns 0
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataReader.FieldCount">
            <summary>
            Returns the number of columns in the current resultset
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataReader.VisibleFieldCount">
            <summary>
            Returns the number of visible fielsd in the current resultset
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataReader.HasRows">
            <summary>
            Returns True if the resultset has rows that can be fetched
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataReader.IsClosed">
            <summary>
            Returns True if the data reader is closed
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataReader.RecordsAffected">
            <summary>
            Retrieve the count of records affected by an update/insert command.  Only valid once the data reader is closed!
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataReader.Item(System.String)">
            <summary>
            Indexer to retrieve data from a column given its name
            </summary>
            <param name="name">The name of the column to retrieve data for</param>
            <returns>The value contained in the column</returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataReader.Item(System.Int32)">
            <summary>
            Indexer to retrieve data from a column given its i
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>The value contained in the column</returns>
        </member>
        <member name="T:System.Data.SQLite.SQLiteDataAdapter">
            <summary>
            SQLite implementation of DbDataAdapter.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataAdapter.#ctor">
            <overloads>
            This class is just a shell around the DbDataAdapter.  Nothing from DbDataAdapter is overridden here, just a few constructors are defined.
            </overloads>
            <summary>
            Default constructor.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataAdapter.#ctor(System.Data.SQLite.SQLiteCommand)">
            <summary>
            Constructs a data adapter using the specified select command.
            </summary>
            <param name="cmd">The select command to associate with the adapter.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataAdapter.#ctor(System.String,System.Data.SQLite.SQLiteConnection)">
            <summary>
            Constructs a data adapter with the supplied select command text and associated with the specified connection.
            </summary>
            <param name="commandText">The select command text to associate with the data adapter.</param>
            <param name="connection">The connection to associate with the select command.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataAdapter.#ctor(System.String,System.String)">
            <summary>
            Constructs a data adapter with the specified select command text, and using the specified database connection string.
            </summary>
            <param name="commandText">The select command text to use to construct a select command.</param>
            <param name="connectionString">A connection string suitable for passing to a new SQLiteConnection, which is associated with the select command.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataAdapter.OnRowUpdating(System.Data.Common.RowUpdatingEventArgs)">
            <summary>
            Raised by the underlying DbDataAdapter when a row is being updated
            </summary>
            <param name="value">The event's specifics</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataAdapter.OnRowUpdated(System.Data.Common.RowUpdatedEventArgs)">
            <summary>
            Raised by DbDataAdapter after a row is updated
            </summary>
            <param name="value">The event's specifics</param>
        </member>
        <member name="E:System.Data.SQLite.SQLiteDataAdapter.RowUpdating">
            <summary>
            Row updating event handler
            </summary>
        </member>
        <member name="E:System.Data.SQLite.SQLiteDataAdapter.RowUpdated">
            <summary>
            Row updated event handler
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataAdapter.SelectCommand">
            <summary>
            Gets/sets the select command for this DataAdapter
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataAdapter.InsertCommand">
            <summary>
            Gets/sets the insert command for this DataAdapter
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataAdapter.UpdateCommand">
            <summary>
            Gets/sets the update command for this DataAdapter
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataAdapter.DeleteCommand">
            <summary>
            Gets/sets the delete command for this DataAdapter
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteTransaction">
            <summary>
            SQLite implementation of DbTransaction.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteTransaction._cnn">
            <summary>
            The connection to which this transaction is bound
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteTransaction.#ctor(System.Data.SQLite.SQLiteConnection,System.Boolean)">
            <summary>
            Constructs the transaction object, binding it to the supplied connection
            </summary>
            <param name="connection">The connection to open a transaction on</param>
            <param name="deferredLock">TRUE to defer the writelock, or FALSE to lock immediately</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteTransaction.Commit">
            <summary>
            Commits the current transaction.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteTransaction.Dispose(System.Boolean)">
            <summary>
            Disposes the transaction.  If it is currently active, any changes are rolled back.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteTransaction.Rollback">
            <summary>
            Rolls back the active transaction.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteTransaction.Connection">
            <summary>
            Returns the underlying connection to which this transaction applies.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteTransaction.DbConnection">
            <summary>
            Forwards to the local Connection property
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteTransaction.IsolationLevel">
            <summary>
            Gets the isolation level of the transaction.  SQLite only supports Serializable transactions.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteParameterCollection">
            <summary>
            SQLite implementation of DbParameterCollection.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteParameterCollection._command">
            <summary>
            The underlying command to which this collection belongs
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteParameterCollection._parameterList">
            <summary>
            The internal array of parameters in this collection
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteParameterCollection._unboundFlag">
            <summary>
            Determines whether or not all parameters have been bound to their statement(s)
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.#ctor(System.Data.SQLite.SQLiteCommand)">
            <summary>
            Initializes the collection
            </summary>
            <param name="cmd">The command to which the collection belongs</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.GetEnumerator">
            <summary>
            Retrieves an enumerator for the collection
            </summary>
            <returns>An enumerator for the underlying array</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Add(System.String,System.Data.DbType,System.Int32,System.String)">
            <summary>
            Adds a parameter to the collection
            </summary>
            <param name="parameterName">The parameter name</param>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the value</param>
            <param name="sourceColumn">The source column</param>
            <returns>A SQLiteParameter object</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Add(System.String,System.Data.DbType,System.Int32)">
            <summary>
            Adds a parameter to the collection
            </summary>
            <param name="parameterName">The parameter name</param>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the value</param>
            <returns>A SQLiteParameter object</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Add(System.String,System.Data.DbType)">
            <summary>
            Adds a parameter to the collection
            </summary>
            <param name="parameterName">The parameter name</param>
            <param name="parameterType">The data type</param>
            <returns>A SQLiteParameter object</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Add(System.Data.SQLite.SQLiteParameter)">
            <summary>
            Adds a parameter to the collection
            </summary>
            <param name="parameter">The parameter to add</param>
            <returns>A zero-based index of where the parameter is located in the array</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Add(System.Object)">
            <summary>
            Adds a parameter to the collection
            </summary>
            <param name="value">The parameter to add</param>
            <returns>A zero-based index of where the parameter is located in the array</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.AddWithValue(System.String,System.Object)">
            <summary>
            Adds a named/unnamed parameter and its value to the parameter collection.
            </summary>
            <param name="parameterName">Name of the parameter, or null to indicate an unnamed parameter</param>
            <param name="value">The initial value of the parameter</param>
            <returns>Returns the SQLiteParameter object created during the call.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.AddRange(System.Data.SQLite.SQLiteParameter[])">
            <summary>
            Adds an array of parameters to the collection
            </summary>
            <param name="values">The array of parameters to add</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.AddRange(System.Array)">
            <summary>
            Adds an array of parameters to the collection
            </summary>
            <param name="values">The array of parameters to add</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Clear">
            <summary>
            Clears the array and resets the collection
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Contains(System.String)">
            <summary>
            Determines if the named parameter exists in the collection
            </summary>
            <param name="parameterName">The name of the parameter to check</param>
            <returns>True if the parameter is in the collection</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Contains(System.Object)">
            <summary>
            Determines if the parameter exists in the collection
            </summary>
            <param name="value">The SQLiteParameter to check</param>
            <returns>True if the parameter is in the collection</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.CopyTo(System.Array,System.Int32)">
            <summary>
            Not implemented
            </summary>
            <param name="array"></param>
            <param name="index"></param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.GetParameter(System.String)">
            <summary>
            Retrieve a parameter by name from the collection
            </summary>
            <param name="parameterName">The name of the parameter to fetch</param>
            <returns>A DbParameter object</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.GetParameter(System.Int32)">
            <summary>
            Retrieves a parameter by its index in the collection
            </summary>
            <param name="index">The index of the parameter to retrieve</param>
            <returns>A DbParameter object</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.IndexOf(System.String)">
            <summary>
            Returns the index of a parameter given its name
            </summary>
            <param name="parameterName">The name of the parameter to find</param>
            <returns>-1 if not found, otherwise a zero-based index of the parameter</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.IndexOf(System.Object)">
            <summary>
            Returns the index of a parameter
            </summary>
            <param name="value">The parameter to find</param>
            <returns>-1 if not found, otherwise a zero-based index of the parameter</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Insert(System.Int32,System.Object)">
            <summary>
            Inserts a parameter into the array at the specified location
            </summary>
            <param name="index">The zero-based index to insert the parameter at</param>
            <param name="value">The parameter to insert</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Remove(System.Object)">
            <summary>
            Removes a parameter from the collection
            </summary>
            <param name="value">The parameter to remove</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.RemoveAt(System.String)">
            <summary>
            Removes a parameter from the collection given its name
            </summary>
            <param name="parameterName">The name of the parameter to remove</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.RemoveAt(System.Int32)">
            <summary>
            Removes a parameter from the collection given its index
            </summary>
            <param name="index">The zero-based parameter index to remove</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.SetParameter(System.String,System.Data.Common.DbParameter)">
            <summary>
            Re-assign the named parameter to a new parameter object
            </summary>
            <param name="parameterName">The name of the parameter to replace</param>
            <param name="value">The new parameter</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.SetParameter(System.Int32,System.Data.Common.DbParameter)">
            <summary>
            Re-assign a parameter at the specified index
            </summary>
            <param name="index">The zero-based index of the parameter to replace</param>
            <param name="value">The new parameter</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Unbind">
            <summary>
            Un-binds all parameters from their statements
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.MapParameters(System.Data.SQLite.SQLiteStatement)">
            <summary>
            This function attempts to map all parameters in the collection to all statements in a Command.
            Since named parameters may span multiple statements, this function makes sure all statements are bound
            to the same named parameter.  Unnamed parameters are bound in sequence.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameterCollection.IsSynchronized">
            <summary>
            Returns true
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameterCollection.IsFixedSize">
            <summary>
            Returns false
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameterCollection.IsReadOnly">
            <summary>
            Returns false
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameterCollection.SyncRoot">
            <summary>
            Returns null
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameterCollection.Count">
            <summary>
            Returns a count of parameters in the collection
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameterCollection.Item(System.String)">
            <summary>
            Overloaded to specialize the return value of the default indexer
            </summary>
            <param name="parameterName">Name of the parameter to get/set</param>
            <returns>The specified named SQLite parameter</returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameterCollection.Item(System.Int32)">
            <summary>
            Overloaded to specialize the return value of the default indexer
            </summary>
            <param name="index">The index of the parameter to get/set</param>
            <returns>The specified SQLite parameter</returns>
        </member>
        <member name="T:System.Data.SQLite.SQLiteKeyReader">
            <summary>
            This class provides key info for a given SQLite statement.
            <remarks>
            Providing key information for a given statement is non-trivial :(
            </remarks>
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteKeyReader.#ctor(System.Data.SQLite.SQLiteConnection,System.Data.SQLite.SQLiteDataReader,System.Data.SQLite.SQLiteStatement)">
            <summary>
            This function does all the nasty work at determining what keys need to be returned for
            a given statement.
            </summary>
            <param name="cnn"></param>
            <param name="reader"></param>
            <param name="stmt"></param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteKeyReader.Sync">
            <summary>
            Make sure all the subqueries are open and ready and sync'd with the current rowid
            of the table they're supporting
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteKeyReader.Reset">
            <summary>
            Release any readers on any subqueries
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteKeyReader.AppendSchemaTable(System.Data.DataTable)">
            <summary>
            Append all the columns we've added to the original query to the schema
            </summary>
            <param name="tbl"></param>
        </member>
        <member name="P:System.Data.SQLite.SQLiteKeyReader.Count">
            <summary>
            How many additional columns of keyinfo we're holding
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteKeyReader.KeyInfo">
            <summary>
            Used to support CommandBehavior.KeyInfo
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteKeyReader.KeyQuery">
            <summary>
            A single sub-query for a given table/database.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteCommand">
            <summary>
            SQLite implementation of DbCommand.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._commandText">
            <summary>
            The command text this command is based on
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._cnn">
            <summary>
            The connection the command is associated with
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._version">
            <summary>
            The version of the connection the command is associated with
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._activeReader">
            <summary>
            Indicates whether or not a DataReader is active on the command.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._commandTimeout">
            <summary>
            The timeout for the command, kludged because SQLite doesn't support per-command timeout values
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._designTimeVisible">
            <summary>
            Designer support
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._updateRowSource">
            <summary>
            Used by DbDataAdapter to determine updating behavior
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._parameterCollection">
            <summary>
            The collection of parameters for the command
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._statementList">
            <summary>
            The SQL command text, broken into individual SQL statements as they are executed
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._remainingText">
            <summary>
            Unprocessed SQL text that has not been executed
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._transaction">
            <summary>
            Transaction associated with this command
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.#ctor">
            <overloads>
             Constructs a new SQLiteCommand
             </overloads>
             <summary>
             Default constructor
             </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.#ctor(System.String)">
            <summary>
            Initializes the command with the given command text
            </summary>
            <param name="commandText">The SQL command text</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.#ctor(System.String,System.Data.SQLite.SQLiteConnection)">
            <summary>
            Initializes the command with the given SQL command text and attach the command to the specified
            connection.
            </summary>
            <param name="commandText">The SQL command text</param>
            <param name="connection">The connection to associate with the command</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.#ctor(System.Data.SQLite.SQLiteConnection)">
            <summary>
            Initializes the command and associates it with the specified connection.
            </summary>
            <param name="connection">The connection to associate with the command</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.#ctor(System.String,System.Data.SQLite.SQLiteConnection,System.Data.SQLite.SQLiteTransaction)">
            <summary>
            Initializes a command with the given SQL, connection and transaction
            </summary>
            <param name="commandText">The SQL command text</param>
            <param name="connection">The connection to associate with the command</param>
            <param name="transaction">The transaction the command should be associated with</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.Dispose(System.Boolean)">
            <summary>
            Disposes of the command and clears all member variables
            </summary>
            <param name="disposing">Whether or not the class is being explicitly or implicitly disposed</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.ClearCommands">
            <summary>
            Clears and destroys all statements currently prepared
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.BuildNextCommand">
            <summary>
            Builds an array of prepared statements for each complete SQL statement in the command text
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.Cancel">
            <summary>
            Not implemented
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.CreateDbParameter">
            <summary>
            Forwards to the local CreateParameter() function
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.CreateParameter">
            <summary>
            Create a new parameter
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.InitializeForReader">
            <summary>
            This function ensures there are no active readers, that we have a valid connection,
            that the connection is open, that all statements are prepared and all parameters are assigned
            in preparation for allocating a data reader.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.ExecuteDbDataReader(System.Data.CommandBehavior)">
            <summary>
            Creates a new SQLiteDataReader to execute/iterate the array of SQLite prepared statements
            </summary>
            <param name="behavior">The behavior the data reader should adopt</param>
            <returns>Returns a SQLiteDataReader object</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.ExecuteReader(System.Data.CommandBehavior)">
            <summary>
            Overrides the default behavior to return a SQLiteDataReader specialization class
            </summary>
            <param name="behavior">The flags to be associated with the reader</param>
            <returns>A SQLiteDataReader</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.ExecuteReader">
            <summary>
            Overrides the default behavior of DbDataReader to return a specialized SQLiteDataReader class
            </summary>
            <returns>A SQLiteDataReader</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.ClearDataReader">
            <summary>
            Called by the SQLiteDataReader when the data reader is closed.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.ExecuteNonQuery">
            <summary>
            Execute the command and return the number of rows inserted/updated affected by it.
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.ExecuteScalar">
            <summary>
            Execute the command and return the first column of the first row of the resultset
            (if present), or null if no resultset was returned.
            </summary>
            <returns>The first column of the first row of the first resultset from the query</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.Prepare">
            <summary>
            Does nothing.  Commands are prepared as they are executed the first time, and kept in prepared state afterwards.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.Clone">
            <summary>
            Clones a command, including all its parameters
            </summary>
            <returns>A new SQLiteCommand with the same commandtext, connection and parameters</returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.CommandText">
            <summary>
            The SQL command text associated with the command
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.CommandTimeout">
            <summary>
            The amount of time to wait for the connection to become available before erroring out
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.CommandType">
            <summary>
            The type of the command.  SQLite only supports CommandType.Text
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.Connection">
            <summary>
            The connection associated with this command
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.DbConnection">
            <summary>
            Forwards to the local Connection property
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.Parameters">
            <summary>
            Returns the SQLiteParameterCollection for the given command
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.DbParameterCollection">
            <summary>
            Forwards to the local Parameters property
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.Transaction">
            <summary>
            The transaction associated with this command.  SQLite only supports one transaction per connection, so this property forwards to the
            command's underlying connection.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.DbTransaction">
            <summary>
            Forwards to the local Transaction property
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.UpdatedRowSource">
            <summary>
            Sets the method the SQLiteCommandBuilder uses to determine how to update inserted or updated rows in a DataTable.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.DesignTimeVisible">
            <summary>
            Determines if the command is visible at design time.  Defaults to True.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteFunctionAttribute">
            <summary>
            A simple custom attribute to enable us to easily find user-defined functions in
            the loaded assemblies and initialize them in SQLite as connections are made.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunctionAttribute.#ctor">
            <summary>
            Default constructor, initializes the internal variables for the function.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteFunctionAttribute.Name">
            <summary>
            The function's name as it will be used in SQLite command text.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteFunctionAttribute.Arguments">
            <summary>
            The number of arguments this function expects.  -1 if the number of arguments is variable.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteFunctionAttribute.FuncType">
            <summary>
            The type of function this implementation will be.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLite3">
            <summary>
            This class implements SQLiteBase completely, and is the guts of the code that interop's SQLite with .NET
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLite3._sql">
            <summary>
            The opaque pointer returned to us by the sqlite provider
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLite3._functionsArray">
            <summary>
            The user-defined functions registered on this connection
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLite3.GetValue(System.Data.SQLite.SQLiteStatement,System.Int32,System.Data.SQLite.SQLiteType)">
            <summary>
            Helper function to retrieve a column of data from an active statement.
            </summary>
            <param name="stmt">The statement being step()'d through</param>
            <param name="index">The column index to retrieve</param>
            <param name="typ">The type of data contained in the column.  If Uninitialized, this function will retrieve the datatype information.</param>
            <returns>Returns the data in the column</returns>
        </member>
        <member name="T:System.Data.SQLite.SQLite3_UTF16">
            <summary>
            Alternate SQLite3 object, overriding many text behaviors to support UTF-16 (Unicode)
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLite3_UTF16.ToString(System.IntPtr,System.Int32)">
            <summary>
            Overrides SQLiteConvert.ToString() to marshal UTF-16 strings instead of UTF-8
            </summary>
            <param name="b">A pointer to a UTF-16 string</param>
            <param name="nbytelen">The length (IN BYTES) of the string</param>
            <returns>A .NET string</returns>
        </member>
        <member name="T:System.Data.SQLite.SQLiteParameter">
            <summary>
            SQLite implementation of DbParameter.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteParameter._dbType">
            <summary>
            The data type of the parameter
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteParameter._rowVersion">
            <summary>
            The version information for mapping the parameter
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteParameter._objValue">
            <summary>
            The value of the data in the parameter
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteParameter._sourceColumn">
            <summary>
            The source column for the parameter
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteParameter._parameterName">
            <summary>
            The column name
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteParameter._dataSize">
            <summary>
            The data size, unused by SQLite
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor">
            <summary>
            Default constructor
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String)">
            <summary>
            Constructs a named parameter given the specified parameter name
            </summary>
            <param name="parameterName">The parameter name</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String,System.Object)">
            <summary>
            Constructs a named parameter given the specified parameter name and initial value
            </summary>
            <param name="parameterName">The parameter name</param>
            <param name="value">The initial value of the parameter</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String,System.Data.DbType)">
            <summary>
            Constructs a named parameter of the specified type
            </summary>
            <param name="parameterName">The parameter name</param>
            <param name="dbType">The datatype of the parameter</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String,System.Data.DbType,System.String)">
            <summary>
            Constructs a named parameter of the specified type and source column reference
            </summary>
            <param name="parameterName">The parameter name</param>
            <param name="dbType">The data type</param>
            <param name="sourceColumn">The source column</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String,System.Data.DbType,System.String,System.Data.DataRowVersion)">
            <summary>
            Constructs a named parameter of the specified type, source column and row version
            </summary>
            <param name="parameterName">The parameter name</param>
            <param name="dbType">The data type</param>
            <param name="sourceColumn">The source column</param>
            <param name="rowVersion">The row version information</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.Data.DbType)">
            <summary>
            Constructs an unnamed parameter of the specified data type
            </summary>
            <param name="dbType">The datatype of the parameter</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.Data.DbType,System.Object)">
            <summary>
            Constructs an unnamed parameter of the specified data type and sets the initial value
            </summary>
            <param name="dbType">The datatype of the parameter</param>
            <param name="value">The initial value of the parameter</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.Data.DbType,System.String)">
            <summary>
            Constructs an unnamed parameter of the specified data type and source column
            </summary>
            <param name="dbType">The datatype of the parameter</param>
            <param name="sourceColumn">The source column</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.Data.DbType,System.String,System.Data.DataRowVersion)">
            <summary>
            Constructs an unnamed parameter of the specified data type, source column and row version
            </summary>
            <param name="dbType">The data type</param>
            <param name="sourceColumn">The source column</param>
            <param name="rowVersion">The row version information</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String,System.Data.DbType,System.Int32)">
            <summary>
            Constructs a named parameter of the specified type and size
            </summary>
            <param name="parameterName">The parameter name</param>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the parameter</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String,System.Data.DbType,System.Int32,System.String)">
            <summary>
            Constructs a named parameter of the specified type, size and source column
            </summary>
            <param name="parameterName">The name of the parameter</param>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the parameter</param>
            <param name="sourceColumn">The source column</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String,System.Data.DbType,System.Int32,System.String,System.Data.DataRowVersion)">
            <summary>
            Constructs a named parameter of the specified type, size, source column and row version
            </summary>
            <param name="parameterName">The name of the parameter</param>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the parameter</param>
            <param name="sourceColumn">The source column</param>
            <param name="rowVersion">The row version information</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String,System.Data.DbType,System.Int32,System.Data.ParameterDirection,System.Boolean,System.Byte,System.Byte,System.String,System.Data.DataRowVersion,System.Object)">
            <summary>
            Constructs a named parameter of the specified type, size, source column and row version
            </summary>
            <param name="parameterName">The name of the parameter</param>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the parameter</param>
            <param name="direction">Only input parameters are supported in SQLite</param>
            <param name="isNullable">Ignored</param>
            <param name="precision">Ignored</param>
            <param name="scale">Ignored</param>
            <param name="sourceColumn">The source column</param>
            <param name="rowVersion">The row version information</param>
            <param name="value">The initial value to assign the parameter</param>   
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String,System.Data.DbType,System.Int32,System.Data.ParameterDirection,System.Byte,System.Byte,System.String,System.Data.DataRowVersion,System.Boolean,System.Object)">
            <summary>
            Constructs a named parameter, yet another flavor
            </summary>
            <param name="parameterName">The name of the parameter</param>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the parameter</param>
            <param name="direction">Only input parameters are supported in SQLite</param>
            <param name="precision">Ignored</param>
            <param name="scale">Ignored</param>
            <param name="sourceColumn">The source column</param>
            <param name="rowVersion">The row version information</param>
            <param name="sourceColumnNullMapping">Whether or not this parameter is for comparing NULL's</param>
            <param name="value">The intial value to assign the parameter</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.Data.DbType,System.Int32)">
            <summary>
            Constructs an unnamed parameter of the specified type and size
            </summary>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the parameter</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.Data.DbType,System.Int32,System.String)">
            <summary>
            Constructs an unnamed parameter of the specified type, size, and source column
            </summary>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the parameter</param>
            <param name="sourceColumn">The source column</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.Data.DbType,System.Int32,System.String,System.Data.DataRowVersion)">
            <summary>
            Constructs an unnamed parameter of the specified type, size, source column and row version
            </summary>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the parameter</param>
            <param name="sourceColumn">The source column</param>
            <param name="rowVersion">The row version information</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.ResetDbType">
            <summary>
            Resets the DbType of the parameter so it can be inferred from the value
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.Clone">
            <summary>
            Clones a parameter
            </summary>
            <returns>A new, unassociated SQLiteParameter</returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameter.IsNullable">
            <summary>
            Whether or not the parameter can contain a null value
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameter.DbType">
            <summary>
            Returns the datatype of the parameter
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameter.Direction">
            <summary>
            Supports only input parameters
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameter.ParameterName">
            <summary>
            Returns the parameter name
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameter.Size">
            <summary>
            Returns the size of the parameter
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameter.SourceColumn">
            <summary>
            Gets/sets the source column
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameter.SourceColumnNullMapping">
            <summary>
            Used by DbCommandBuilder to determine the mapping for nullable fields
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameter.SourceVersion">
            <summary>
            Gets and sets the row version
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameter.Value">
            <summary>
            Gets and sets the parameter value.  If no datatype was specified, the datatype will assume the type from the value given.
            </summary>
        </member>
    </members>
</doc>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted bin/ManagedOnly/System.Data.SQLite.dll.

cannot compute difference between binary files

Deleted bin/System.Data.SQLite.XML.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
<?xml version="1.0"?>
<doc>
    <members>
        <member name="T:System.Data.SQLite.SQLiteMetaDataCollectionNames">
            <summary>
            MetaDataCollections specific to SQLite
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteMetaDataCollectionNames.Catalogs">
            <summary>
            Returns a list of databases attached to the connection
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteMetaDataCollectionNames.Columns">
            <summary>
            Returns column information for the specified table
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteMetaDataCollectionNames.Indexes">
            <summary>
            Returns index information for the optionally-specified table
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteMetaDataCollectionNames.IndexColumns">
            <summary>
            Returns base columns for the given index
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteMetaDataCollectionNames.Tables">
            <summary>
            Returns the tables in the given catalog
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteMetaDataCollectionNames.Views">
            <summary>
            Returns user-defined views in the given catalog
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteMetaDataCollectionNames.ViewColumns">
            <summary>
            Returns underlying column information on the given view
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteMetaDataCollectionNames.ForeignKeys">
            <summary>
            Returns foreign key information for the given catalog
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteMetaDataCollectionNames.Triggers">
            <summary>
            Returns the triggers on the database
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteConnectionStringBuilder">
            <summary>
            SQLite implementation of DbConnectionStringBuilder.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnectionStringBuilder._properties">
            <summary>
            Properties of this class
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionStringBuilder.#ctor">
            <overloads>
            Constructs a new instance of the class
            </overloads>
            <summary>
            Default constructor
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionStringBuilder.#ctor(System.String)">
            <summary>
            Constructs a new instance of the class using the specified connection string.
            </summary>
            <param name="connectionString">The connection string to parse</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionStringBuilder.Initialize(System.String)">
            <summary>
            Private initializer, which assigns the connection string and resets the builder
            </summary>
            <param name="cnnString">The connection string to assign</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionStringBuilder.TryGetValue(System.String,System.Object@)">
            <summary>
            Helper function for retrieving values from the connectionstring
            </summary>
            <param name="keyword">The keyword to retrieve settings for</param>
            <param name="value">The resulting parameter value</param>
            <returns>Returns true if the value was found and returned</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionStringBuilder.FallbackGetProperties(System.Collections.Hashtable)">
            <summary>
            Fallback method for MONO, which doesn't implement DbConnectionStringBuilder.GetProperties()
            </summary>
            <param name="propertyList">The hashtable to fill with property descriptors</param>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.Version">
            <summary>
            Gets/Sets the default version of the SQLite engine to instantiate.  Currently the only valid value is 3, indicating version 3 of the sqlite library.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.SyncMode">
            <summary>
            Gets/Sets the synchronization mode (file flushing) of the connection string.  Default is "Normal".
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.UseUTF16Encoding">
            <summary>
            Gets/Sets the encoding for the connection string.  The default is "False" which indicates UTF-8 encoding.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.Pooling">
            <summary>
            Gets/Sets whether or not to use connection pooling.  The default is "False"
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.BinaryGUID">
            <summary>
            Gets/Sets whethor not to store GUID's in binary format.  The default is True
            which saves space in the database.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.DataSource">
            <summary>
            Gets/Sets the filename to open on the connection string.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.Uri">
            <summary>
            An alternate to the data source property
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.DefaultTimeout">
            <summary>
            Gets/sets the default command timeout for newly-created commands.  This is especially useful for 
            commands used internally such as inside a SQLiteTransaction, where setting the timeout is not possible.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.Enlist">
            <summary>
            Determines whether or not the connection will automatically participate
            in the current distributed transaction (if one exists)
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.FailIfMissing">
            <summary>
            If set to true, will throw an exception if the database specified in the connection
            string does not exist.  If false, the database will be created automatically.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.LegacyFormat">
            <summary>
            If enabled, uses the legacy 3.xx format for maximum compatibility, but results in larger
            database sizes.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.ReadOnly">
            <summary>
            When enabled, the database will be opened for read-only access and writing will be disabled.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.Password">
            <summary>
            Gets/sets the database encryption password
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.PageSize">
            <summary>
            Gets/Sets the page size for the connection.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.MaxPageCount">
            <summary>
            Gets/Sets the maximum number of pages the database may hold
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.CacheSize">
            <summary>
            Gets/Sets the cache size for the connection.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.DateTimeFormat">
            <summary>
            Gets/Sets the datetime format for the connection.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.JournalMode">
            <summary>
            Determines how SQLite handles the transaction journal file.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnectionStringBuilder.DefaultIsolationLevel">
            <summary>
            Sets the default isolation level for transactions on the connection.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteCommandBuilder">
            <summary>
            SQLite implementation of DbCommandBuilder.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.#ctor">
            <summary>
            Default constructor
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.#ctor(System.Data.SQLite.SQLiteDataAdapter)">
            <summary>
            Initializes the command builder and associates it with the specified data adapter.
            </summary>
            <param name="adp"></param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.ApplyParameterInfo(System.Data.Common.DbParameter,System.Data.DataRow,System.Data.StatementType,System.Boolean)">
            <summary>
            Minimal amount of parameter processing.  Primarily sets the DbType for the parameter equal to the provider type in the schema
            </summary>
            <param name="parameter">The parameter to use in applying custom behaviors to a row</param>
            <param name="row">The row to apply the parameter to</param>
            <param name="statementType">The type of statement</param>
            <param name="whereClause">Whether the application of the parameter is part of a WHERE clause</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetParameterName(System.String)">
            <summary>
            Returns a valid named parameter
            </summary>
            <param name="parameterName">The name of the parameter</param>
            <returns>Error</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetParameterName(System.Int32)">
            <summary>
            Returns a named parameter for the given ordinal
            </summary>
            <param name="parameterOrdinal">The i of the parameter</param>
            <returns>Error</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetParameterPlaceholder(System.Int32)">
            <summary>
            Returns a placeholder character for the specified parameter i.
            </summary>
            <param name="parameterOrdinal">The index of the parameter to provide a placeholder for</param>
            <returns>Returns a named parameter</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.SetRowUpdatingHandler(System.Data.Common.DbDataAdapter)">
            <summary>
            Sets the handler for receiving row updating events.  Used by the DbCommandBuilder to autogenerate SQL
            statements that may not have previously been generated.
            </summary>
            <param name="adapter">A data adapter to receive events on.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetDeleteCommand">
            <summary>
            Returns the automatically-generated SQLite command to delete rows from the database
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetDeleteCommand(System.Boolean)">
            <summary>
            Returns the automatically-generated SQLite command to delete rows from the database
            </summary>
            <param name="useColumnsForParameterNames"></param>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetUpdateCommand">
            <summary>
            Returns the automatically-generated SQLite command to update rows in the database
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetUpdateCommand(System.Boolean)">
            <summary>
            Returns the automatically-generated SQLite command to update rows in the database
            </summary>
            <param name="useColumnsForParameterNames"></param>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetInsertCommand">
            <summary>
            Returns the automatically-generated SQLite command to insert rows into the database
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetInsertCommand(System.Boolean)">
            <summary>
            Returns the automatically-generated SQLite command to insert rows into the database
            </summary>
            <param name="useColumnsForParameterNames"></param>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.QuoteIdentifier(System.String)">
            <summary>
            Places brackets around an identifier
            </summary>
            <param name="unquotedIdentifier">The identifier to quote</param>
            <returns>The bracketed identifier</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.UnquoteIdentifier(System.String)">
            <summary>
            Removes brackets around an identifier
            </summary>
            <param name="quotedIdentifier">The quoted (bracketed) identifier</param>
            <returns>The undecorated identifier</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommandBuilder.GetSchemaTable(System.Data.Common.DbCommand)">
            <summary>
            Override helper, which can help the base command builder choose the right keys for the given query
            </summary>
            <param name="sourceCommand"></param>
            <returns></returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommandBuilder.DataAdapter">
            <summary>
            Gets/sets the DataAdapter for this CommandBuilder
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommandBuilder.CatalogLocation">
            <summary>
            Overridden to hide its property from the designer
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommandBuilder.CatalogSeparator">
            <summary>
            Overridden to hide its property from the designer
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommandBuilder.QuotePrefix">
            <summary>
            Overridden to hide its property from the designer
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommandBuilder.QuoteSuffix">
            <summary>
            Overridden to hide its property from the designer
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommandBuilder.SchemaSeparator">
            <summary>
            Overridden to hide its property from the designer
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SR">
            <summary>
              A strongly-typed resource class, for looking up localized strings, etc.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SR.ResourceManager">
            <summary>
              Returns the cached ResourceManager instance used by this class.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SR.Culture">
            <summary>
              Overrides the current thread's CurrentUICulture property for all
              resource lookups using this strongly typed resource class.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SR.DataTypes">
             <summary>
               Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; standalone=&quot;yes&quot;?&gt;
            &lt;DocumentElement&gt;
              &lt;DataTypes&gt;
                &lt;TypeName&gt;smallint&lt;/TypeName&gt;
                &lt;ProviderDbType&gt;10&lt;/ProviderDbType&gt;
                &lt;ColumnSize&gt;5&lt;/ColumnSize&gt;
                &lt;DataType&gt;System.Int16&lt;/DataType&gt;
                &lt;CreateFormat&gt;smallint&lt;/CreateFormat&gt;
                &lt;IsAutoIncrementable&gt;false&lt;/IsAutoIncrementable&gt;
                &lt;IsCaseSensitive&gt;false&lt;/IsCaseSensitive&gt;
                &lt;IsFixedLength&gt;true&lt;/IsFixedLength&gt;
                &lt;IsFixedPrecisionScale&gt;true&lt;/IsFixedPrecisionScale&gt;
                &lt;IsLong&gt;false&lt;/IsLong&gt;
                &lt;IsNullable&gt;true&lt;/ [rest of string was truncated]&quot;;.
             </summary>
        </member>
        <member name="P:System.Data.SQLite.SR.Keywords">
            <summary>
              Looks up a localized string similar to ALL,ALTER,AND,AS,AUTOINCREMENT,BETWEEN,BY,CASE,CHECK,COLLATE,COMMIT,CONSTRAINT,CREATE,CROSS,DEFAULT,DEFERRABLE,DELETE,DISTINCT,DROP,ELSE,ESCAPE,EXCEPT,FOREIGN,FROM,FULL,GROUP,HAVING,IN,INDEX,INNER,INSERT,INTERSECT,INTO,IS,ISNULL,JOIN,LEFT,LIMIT,NATURAL,NOT,NOTNULL,NULL,ON,OR,ORDER,OUTER,PRIMARY,REFERENCES,RIGHT,ROLLBACK,SELECT,SET,TABLE,THEN,TO,TRANSACTION,UNION,UNIQUE,UPDATE,USING,VALUES,WHEN,WHERE.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SR.MetaDataCollections">
             <summary>
               Looks up a localized string similar to &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;
            &lt;DocumentElement&gt;
              &lt;MetaDataCollections&gt;
                &lt;CollectionName&gt;MetaDataCollections&lt;/CollectionName&gt;
                &lt;NumberOfRestrictions&gt;0&lt;/NumberOfRestrictions&gt;
                &lt;NumberOfIdentifierParts&gt;0&lt;/NumberOfIdentifierParts&gt;
              &lt;/MetaDataCollections&gt;
              &lt;MetaDataCollections&gt;
                &lt;CollectionName&gt;DataSourceInformation&lt;/CollectionName&gt;
                &lt;NumberOfRestrictions&gt;0&lt;/NumberOfRestrictions&gt;
                &lt;NumberOfIdentifierParts&gt;0&lt;/NumberOfIdentifierParts&gt;
              &lt;/MetaDataCollections&gt;
              &lt;MetaDataC [rest of string was truncated]&quot;;.
             </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnectionPool._connections">
            <summary>
            The connection pool object
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnectionPool._poolVersion">
            <summary>
            The default version number new pools will get
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionPool.Remove(System.String,System.Int32,System.Int32@)">
            <summary>
            Attempt to pull a pooled connection out of the queue for active duty
            </summary>
            <param name="fileName">The filename for a desired connection</param>
            <param name="maxPoolSize">The maximum size the connection pool for the filename can be</param>
            <param name="version">The pool version the returned connection will belong to</param>
            <returns>Returns NULL if no connections were available.  Even if none are, the poolversion will still be a valid pool version</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionPool.ClearAllPools">
            <summary>
            Clears out all pooled connections and rev's up the default pool version to force all old active objects
            not in the pool to get discarded rather than returned to their pools.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionPool.ClearPool(System.String)">
            <summary>
            Clear a given pool for a given filename.  Discards anything in the pool for the given file, and revs the pool
            version so current active objects on the old version of the pool will get discarded rather than be returned to the pool.
            </summary>
            <param name="fileName">The filename of the pool to clear</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionPool.Add(System.String,System.Data.SQLite.SQLiteConnectionHandle,System.Int32)">
            <summary>
            Return a connection to the pool for someone else to use.
            </summary>
            <param name="fileName">The filename of the pool to use</param>
            <param name="hdl">The connection handle to pool</param>
            <param name="version">The pool version the handle was created under</param>
            <remarks>
            If the version numbers don't match between the connection and the pool, then the handle is discarded.
            </remarks>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnectionPool.ResizePool(System.Data.SQLite.SQLiteConnectionPool.Pool,System.Boolean)">
            <summary>
            We don't have to thread-lock anything in this function, because it's only called by other functions above
            which already have a thread-safe lock.
            </summary>
            <param name="queue">The queue to resize</param>
            <param name="forAdding">If a function intends to add to the pool, this is true, which forces the resize
            to take one more than it needs from the pool</param>
        </member>
        <member name="T:System.Data.SQLite.SQLiteConnectionPool.Pool">
            <summary>
            Keeps track of connections made on a specified file.  The PoolVersion dictates whether old objects get
            returned to the pool or discarded when no longer in use.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteConnection">
            <summary>
            SQLite implentation of DbConnection.
            </summary>
            <remarks>
            The <see cref="P:System.Data.SQLite.SQLiteConnection.ConnectionString">ConnectionString</see> property of the SQLiteConnection class can contain the following parameter(s), delimited with a semi-colon:
            <list type="table">
            <listheader>
            <term>Parameter</term>
            <term>Values</term>
            <term>Required</term>
            <term>Default</term>
            </listheader>
            <item>
            <description>Data Source</description>
            <description>{filename}</description>
            <description>Y</description>
            <description></description>
            </item>
            <item>
            <description>Version</description>
            <description>3</description>
            <description>N</description>
            <description>3</description>
            </item>
            <item>
            <description>UseUTF16Encoding</description>
            <description><b>True</b><br/><b>False</b></description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>DateTimeFormat</description>
            <description><b>Ticks</b> - Use DateTime.Ticks<br/><b>ISO8601</b> - Use ISO8601 DateTime format</description>
            <description>N</description>
            <description>ISO8601</description>
            </item>
            <item>
            <description>BinaryGUID</description>
            <description><b>True</b> - Store GUID columns in binary form<br/><b>False</b> - Store GUID columns as text</description>
            <description>N</description>
            <description>True</description>
            </item>
            <item>
            <description>Cache Size</description>
            <description>{size in bytes}</description>
            <description>N</description>
            <description>2000</description>
            </item>
            <item>
            <description>Synchronous</description>
            <description><b>Normal</b> - Normal file flushing behavior<br/><b>Full</b> - Full flushing after all writes<br/><b>Off</b> - Underlying OS flushes I/O's</description>
            <description>N</description>
            <description>Normal</description>
            </item>
            <item>
            <description>Page Size</description>
            <description>{size in bytes}</description>
            <description>N</description>
            <description>1024</description>
            </item>
            <item>
            <description>Password</description>
            <description>{password}</description>
            <description>N</description>
            <description></description>
            </item>
            <item>
            <description>Enlist</description>
            <description><b>Y</b> - Automatically enlist in distributed transactions<br/><b>N</b> - No automatic enlistment</description>
            <description>N</description>
            <description>Y</description>
            </item>
            <item>
            <description>Pooling</description>
            <description><b>True</b> - Use connection pooling<br/><b>False</b> - Do not use connection pooling</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>FailIfMissing</description>
            <description><b>True</b> - Don't create the database if it does not exist, throw an error instead<br/><b>False</b> - Automatically create the database if it does not exist</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>Max Page Count</description>
            <description>{size in pages} - Limits the maximum number of pages (limits the size) of the database</description>
            <description>N</description>
            <description>0</description>
            </item>
            <item>
            <description>Legacy Format</description>
            <description><b>True</b> - Use the more compatible legacy 3.x database format<br/><b>False</b> - Use the newer 3.3x database format which compresses numbers more effectively</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>Default Timeout</description>
            <description>{time in seconds}<br/>The default command timeout</description>
            <description>N</description>
            <description>30</description>
            </item>
            <item>
            <description>Journal Mode</description>
            <description><b>Delete</b> - Delete the journal file after a commit<br/><b>Persist</b> - Zero out and leave the journal file on disk after a commit<br/><b>Off</b> - Disable the rollback journal entirely</description>
            <description>N</description>
            <description>Delete</description>
            </item>
            <item>
            <description>Read Only</description>
            <description><b>True</b> - Open the database for read only access<br/><b>False</b> - Open the database for normal read/write access</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>Max Pool Size</description>
            <description>The maximum number of connections for the given connection string that can be in the connection pool</description>
            <description>N</description>
            <description>100</description>
            </item>
            <item>
            <description>Default IsolationLevel</description>
            <description>The default transaciton isolation level</description>
            <description>N</description>
            <description>Serializable</description>
            </item>
            </list>
            </remarks>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._connectionState">
            <summary>
            State of the current connection
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._connectionString">
            <summary>
            The connection string
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._transactionLevel">
            <summary>
            Nesting level of the transactions open on the connection
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._defaultIsolation">
            <summary>
            The default isolation level for new transactions
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._enlistment">
            <summary>
            Whether or not the connection is enlisted in a distrubuted transaction
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._sql">
            <summary>
            The base SQLite object to interop with
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._dataSource">
            <summary>
            The database filename minus path and extension
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._password">
            <summary>
            Temporary password storage, emptied after the database has been opened
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConnection._defaultTimeout">
            <summary>
            Default command timeout
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.#ctor">
            <overloads>
             Constructs a new SQLiteConnection object
             </overloads>
             <summary>
             Default constructor
             </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.#ctor(System.String)">
            <summary>
            Initializes the connection with the specified connection string
            </summary>
            <param name="connectionString">The connection string to use on the connection</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.#ctor(System.Data.SQLite.SQLiteConnection)">
            <summary>
            Clones the settings and connection string from an existing connection.  If the existing connection is already open, this
            function will open its own connection, enumerate any attached databases of the original connection, and automatically
            attach to them.
            </summary>
            <param name="connection"></param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Clone">
            <summary>
            Creates a clone of the connection.  All attached databases and user-defined functions are cloned.  If the existing connection is open, the cloned connection 
            will also be opened.
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Dispose(System.Boolean)">
            <summary>
            Disposes of the SQLiteConnection, closing it if it is active.
            </summary>
            <param name="disposing">True if the connection is being explicitly closed.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.CreateFile(System.String)">
            <summary>
            Creates a database file.  This just creates a zero-byte file which SQLite
            will turn into a database when the file is opened properly.
            </summary>
            <param name="databaseFileName">The file to create</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.OnStateChange(System.Data.ConnectionState)">
            <summary>
            Raises the state change event when the state of the connection changes
            </summary>
            <param name="newState">The new state.  If it is different from the previous state, an event is raised.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginTransaction(System.Data.IsolationLevel,System.Boolean)">
            <summary>
            OBSOLETE.  Creates a new SQLiteTransaction if one isn't already active on the connection.
            </summary>
            <param name="isolationLevel">This parameter is ignored.</param>
            <param name="deferredLock">When TRUE, SQLite defers obtaining a write lock until a write operation is requested.
            When FALSE, a writelock is obtained immediately.  The default is TRUE, but in a multi-threaded multi-writer 
            environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock.</param>
            <returns>Returns a SQLiteTransaction object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginTransaction(System.Boolean)">
            <summary>
            OBSOLETE.  Creates a new SQLiteTransaction if one isn't already active on the connection.
            </summary>
            <param name="deferredLock">When TRUE, SQLite defers obtaining a write lock until a write operation is requested.
            When FALSE, a writelock is obtained immediately.  The default is false, but in a multi-threaded multi-writer 
            environment, one may instead choose to lock the database immediately to avoid any possible writer deadlock.</param>
            <returns>Returns a SQLiteTransaction object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginTransaction(System.Data.IsolationLevel)">
            <summary>
            Creates a new SQLiteTransaction if one isn't already active on the connection.
            </summary>
            <param name="isolationLevel">Supported isolation levels are Serializable, ReadCommitted and Unspecified.</param>
            <remarks>
            Unspecified will use the default isolation level specified in the connection string.  If no isolation level is specified in the 
            connection string, Serializable is used.
            Serializable transactions are the default.  In this mode, the engine gets an immediate lock on the database, and no other threads
            may begin a transaction.  Other threads may read from the database, but not write.
            With a ReadCommitted isolation level, locks are deferred and elevated as needed.  It is possible for multiple threads to start
            a transaction in ReadCommitted mode, but if a thread attempts to commit a transaction while another thread
            has a ReadCommitted lock, it may timeout or cause a deadlock on both threads until both threads' CommandTimeout's are reached.
            </remarks>
            <returns>Returns a SQLiteTransaction object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginTransaction">
            <summary>
            Creates a new SQLiteTransaction if one isn't already active on the connection.
            </summary>
            <returns>Returns a SQLiteTransaction object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.BeginDbTransaction(System.Data.IsolationLevel)">
            <summary>
            Forwards to the local BeginTransaction() function
            </summary>
            <param name="isolationLevel">Supported isolation levels are Unspecified, Serializable, and ReadCommitted</param>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ChangeDatabase(System.String)">
            <summary>
            Not implemented
            </summary>
            <param name="databaseName"></param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Close">
            <summary>
            When the database connection is closed, all commands linked to this connection are automatically reset.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ClearPool(System.Data.SQLite.SQLiteConnection)">
            <summary>
            Clears the connection pool associated with the connection.  Any other active connections using the same database file
            will be discarded instead of returned to the pool when they are closed.
            </summary>
            <param name="connection"></param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ClearAllPools">
            <summary>
            Clears all connection pools.  Any active connections will be discarded instead of sent to the pool when they are closed.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.CreateCommand">
            <summary>
            Create a new SQLiteCommand and associate it with this connection.
            </summary>
            <returns>Returns an instantiated SQLiteCommand object already assigned to this connection.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.CreateDbCommand">
            <summary>
            Forwards to the local CreateCommand() function
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ParseConnectionString(System.String)">
            <summary>
            Parses the connection string into component parts
            </summary>
            <param name="connectionString">The connection string to parse</param>
            <returns>An array of key-value pairs representing each parameter of the connection string</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.EnlistTransaction(System.Transactions.Transaction)">
            <summary>
            Manual distributed transaction enlistment support
            </summary>
            <param name="transaction">The distributed transaction to enlist in</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.FindKey(System.Collections.Generic.SortedList{System.String,System.String},System.String,System.String)">
            <summary>
            Looks for a key in the array of key/values of the parameter string.  If not found, return the specified default value
            </summary>
            <param name="items">The list to look in</param>
            <param name="key">The key to find</param>
            <param name="defValue">The default value to return if the key is not found</param>
            <returns>The value corresponding to the specified key, or the default value if not found.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Open">
            <summary>
            Opens the connection using the parameters found in the <see cref="P:System.Data.SQLite.SQLiteConnection.ConnectionString">ConnectionString</see>
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ChangePassword(System.String)">
            <summary>
            Change the password (or assign a password) to an open database.
            </summary>
            <remarks>
            No readers or writers may be active for this process.  The database must already be open
            and if it already was password protected, the existing password must already have been supplied.
            </remarks>
            <param name="newPassword">The new password to assign to the database</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ChangePassword(System.Byte[])">
            <summary>
            Change the password (or assign a password) to an open database.
            </summary>
            <remarks>
            No readers or writers may be active for this process.  The database must already be open
            and if it already was password protected, the existing password must already have been supplied.
            </remarks>
            <param name="newPassword">The new password to assign to the database</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.SetPassword(System.String)">
            <summary>
            Sets the password for a password-protected database.  A password-protected database is
            unusable for any operation until the password has been set.
            </summary>
            <param name="databasePassword">The password for the database</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.SetPassword(System.Byte[])">
            <summary>
            Sets the password for a password-protected database.  A password-protected database is
            unusable for any operation until the password has been set.
            </summary>
            <param name="databasePassword">The password for the database</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.ExpandFileName(System.String)">
            <summary>
            Expand the filename of the data source, resolving the |DataDirectory| macro as appropriate.
            </summary>
            <param name="sourceFile">The database filename to expand</param>
            <returns>The expanded path and filename of the filename</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.GetSchema">
            <overloads>
             The following commands are used to extract schema information out of the database.  Valid schema types are:
             <list type="bullet">
             <item>
             <description>MetaDataCollections</description>
             </item>
             <item>
             <description>DataSourceInformation</description>
             </item>
             <item>
             <description>Catalogs</description>
             </item>
             <item>
             <description>Columns</description>
             </item>
             <item>
             <description>ForeignKeys</description>
             </item>
             <item>
             <description>Indexes</description>
             </item>
             <item>
             <description>IndexColumns</description>
             </item>
             <item>
             <description>Tables</description>
             </item>
             <item>
             <description>Views</description>
             </item>
             <item>
             <description>ViewColumns</description>
             </item>
             </list>
             </overloads>
             <summary>
             Returns the MetaDataCollections schema
             </summary>
             <returns>A DataTable of the MetaDataCollections schema</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.GetSchema(System.String)">
            <summary>
            Returns schema information of the specified collection
            </summary>
            <param name="collectionName">The schema collection to retrieve</param>
            <returns>A DataTable of the specified collection</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.GetSchema(System.String,System.String[])">
            <summary>
            Retrieves schema information using the specified constraint(s) for the specified collection
            </summary>
            <param name="collectionName">The collection to retrieve</param>
            <param name="restrictionValues">The restrictions to impose</param>
            <returns>A DataTable of the specified collection</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_MetaDataCollections">
            <summary>
            Builds a MetaDataCollections schema datatable
            </summary>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_DataSourceInformation">
            <summary>
            Builds a DataSourceInformation datatable
            </summary>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Columns(System.String,System.String,System.String)">
            <summary>
            Build a Columns schema
            </summary>
            <param name="strCatalog">The catalog (attached database) to query, can be null</param>
            <param name="strTable">The table to retrieve schema information for, must not be null</param>
            <param name="strColumn">The column to retrieve schema information for, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Indexes(System.String,System.String,System.String)">
            <summary>
            Returns index information for the given database and catalog
            </summary>
            <param name="strCatalog">The catalog (attached database) to query, can be null</param>
            <param name="strIndex">The name of the index to retrieve information for, can be null</param>
            <param name="strTable">The table to retrieve index information for, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Tables(System.String,System.String,System.String)">
            <summary>
            Retrieves table schema information for the database and catalog
            </summary>
            <param name="strCatalog">The catalog (attached database) to retrieve tables on</param>
            <param name="strTable">The table to retrieve, can be null</param>
            <param name="strType">The table type, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Views(System.String,System.String)">
            <summary>
            Retrieves view schema information for the database
            </summary>
            <param name="strCatalog">The catalog (attached database) to retrieve views on</param>
            <param name="strView">The view name, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_Catalogs(System.String)">
            <summary>
            Retrieves catalog (attached databases) schema information for the database
            </summary>
            <param name="strCatalog">The catalog to retrieve, can be null</param>
            <returns>DataTable</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_IndexColumns(System.String,System.String,System.String,System.String)">
            <summary>
            Returns the base column information for indexes in a database
            </summary>
            <param name="strCatalog">The catalog to retrieve indexes for (can be null)</param>
            <param name="strTable">The table to restrict index information by (can be null)</param>
            <param name="strIndex">The index to restrict index information by (can be null)</param>
            <param name="strColumn">The source column to restrict index information by (can be null)</param>
            <returns>A DataTable containing the results</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_ViewColumns(System.String,System.String,System.String)">
            <summary>
            Returns detailed column information for a specified view
            </summary>
            <param name="strCatalog">The catalog to retrieve columns for (can be null)</param>
            <param name="strView">The view to restrict column information by (can be null)</param>
            <param name="strColumn">The source column to restrict column information by (can be null)</param>
            <returns>A DataTable containing the results</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConnection.Schema_ForeignKeys(System.String,System.String,System.String)">
            <summary>
            Retrieves foreign key information from the specified set of filters
            </summary>
            <param name="strCatalog">An optional catalog to restrict results on</param>
            <param name="strTable">An optional table to restrict results on</param>
            <param name="strKeyName">An optional foreign key name to restrict results on</param>
            <returns>A DataTable with the results of the query</returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.DbProviderFactory">
            <summary>
            Returns a SQLiteProviderFactory object.
            </summary>
        </member>
        <member name="E:System.Data.SQLite.SQLiteConnection.StateChange">
            <summary>
            This event is raised whenever the database is opened or closed.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.ConnectionString">
            <summary>
            The connection string containing the parameters for the connection
            </summary>
            <remarks>
            <list type="table">
            <listheader>
            <term>Parameter</term>
            <term>Values</term>
            <term>Required</term>
            <term>Default</term>
            </listheader>
            <item>
            <description>Data Source</description>
            <description>{filename}</description>
            <description>Y</description>
            <description></description>
            </item>
            <item>
            <description>Version</description>
            <description>3</description>
            <description>N</description>
            <description>3</description>
            </item>
            <item>
            <description>UseUTF16Encoding</description>
            <description><b>True</b><br/><b>False</b></description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>DateTimeFormat</description>
            <description><b>Ticks</b> - Use DateTime.Ticks<br/><b>ISO8601</b> - Use ISO8601 DateTime format<br/><b>JulianDay</b> - Use JulianDay format</description>
            <description>N</description>
            <description>ISO8601</description>
            </item>
            <item>
            <description>BinaryGUID</description>
            <description><b>Yes/On/1</b> - Store GUID columns in binary form<br/><b>No/Off/0</b> - Store GUID columns as text</description>
            <description>N</description>
            <description>On</description>
            </item>
            <item>
            <description>Cache Size</description>
            <description>{size in bytes}</description>
            <description>N</description>
            <description>2000</description>
            </item>
            <item>
            <description>Synchronous</description>
            <description><b>Normal</b> - Normal file flushing behavior<br/><b>Full</b> - Full flushing after all writes<br/><b>Off</b> - Underlying OS flushes I/O's</description>
            <description>N</description>
            <description>Normal</description>
            </item>
            <item>
            <description>Page Size</description>
            <description>{size in bytes}</description>
            <description>N</description>
            <description>1024</description>
            </item>
            <item>
            <description>Password</description>
            <description>{password}</description>
            <description>N</description>
            <description></description>
            </item>
            <item>
            <description>Enlist</description>
            <description><B>Y</B> - Automatically enlist in distributed transactions<br/><b>N</b> - No automatic enlistment</description>
            <description>N</description>
            <description>Y</description>
            </item>
            <item>
            <description>Pooling</description>
            <description><b>True</b> - Use connection pooling<br/><b>False</b> - Do not use connection pooling</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>FailIfMissing</description>
            <description><b>True</b> - Don't create the database if it does not exist, throw an error instead<br/><b>False</b> - Automatically create the database if it does not exist</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>Max Page Count</description>
            <description>{size in pages} - Limits the maximum number of pages (limits the size) of the database</description>
            <description>N</description>
            <description>0</description>
            </item>
            <item>
            <description>Legacy Format</description>
            <description><b>True</b> - Use the more compatible legacy 3.x database format<br/><b>False</b> - Use the newer 3.3x database format which compresses numbers more effectively</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>Default Timeout</description>
            <description>{time in seconds}<br/>The default command timeout</description>
            <description>N</description>
            <description>30</description>
            </item>
            <item>
            <description>Journal Mode</description>
            <description><b>Delete</b> - Delete the journal file after a commit<br/><b>Persist</b> - Zero out and leave the journal file on disk after a commit<br/><b>Off</b> - Disable the rollback journal entirely</description>
            <description>N</description>
            <description>Delete</description>
            </item>
            <item>
            <description>Read Only</description>
            <description><b>True</b> - Open the database for read only access<br/><b>False</b> - Open the database for normal read/write access</description>
            <description>N</description>
            <description>False</description>
            </item>
            <item>
            <description>Max Pool Size</description>
            <description>The maximum number of connections for the given connection string that can be in the connection pool</description>
            <description>N</description>
            <description>100</description>
            </item>
            <item>
            <description>Default IsolationLevel</description>
            <description>The default transaciton isolation level</description>
            <description>N</description>
            <description>Serializable</description>
            </item>
            </list>
            </remarks>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.DataSource">
            <summary>
            Returns the filename without extension or path
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.Database">
            <summary>
            Returns an empty string
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.DefaultTimeout">
            <summary>
            Gets/sets the default command timeout for newly-created commands.  This is especially useful for 
            commands used internally such as inside a SQLiteTransaction, where setting the timeout is not possible.
            This can also be set in the ConnectionString with "Default Timeout"
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.ServerVersion">
            <summary>
            Returns the version of the underlying SQLite database engine
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.SQLiteVersion">
            <summary>
            Returns the version of the underlying SQLite database engine
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteConnection.State">
            <summary>
            Returns the state of the connection.
            </summary>
        </member>
        <member name="E:System.Data.SQLite.SQLiteConnection.Update">
            <summary>
            This event is raised whenever SQLite makes an update/delete/insert into the database on
            this connection.  It only applies to the given connection.
            </summary>
        </member>
        <member name="E:System.Data.SQLite.SQLiteConnection.Commit">
            <summary>
            This event is raised whenever SQLite is committing a transaction.
            Return non-zero to trigger a rollback
            </summary>
        </member>
        <member name="E:System.Data.SQLite.SQLiteConnection.RollBack">
            <summary>
            This event is raised whenever SQLite is committing a transaction.
            Return non-zero to trigger a rollback
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SynchronizationModes">
            <summary>
            The I/O file cache flushing behavior for the connection
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SynchronizationModes.Normal">
            <summary>
            Normal file flushing at critical sections of the code
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SynchronizationModes.Full">
            <summary>
            Full file flushing after every write operation
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SynchronizationModes.Off">
            <summary>
            Use the default operating system's file flushing, SQLite does not explicitly flush the file buffers after writing
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteCommitHandler">
            <summary>
            Raised when a transaction is about to be committed.  To roll back a transaction, set the 
            rollbackTrans boolean value to true.
            </summary>
            <param name="sender">The connection committing the transaction</param>
            <param name="e">Event arguments on the transaction</param>
        </member>
        <member name="T:System.Data.SQLite.SQLiteUpdateEventHandler">
            <summary>
            Raised when data is inserted, updated and deleted on a given connection
            </summary>
            <param name="sender">The connection committing the transaction</param>
            <param name="e">The event parameters which triggered the event</param>
        </member>
        <member name="T:System.Data.SQLite.UpdateEventType">
            <summary>
            Whenever an update event is triggered on a connection, this enum will indicate
            exactly what type of operation is being performed.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.UpdateEventType.Delete">
            <summary>
            A row is being deleted from the given database and table
            </summary>
        </member>
        <member name="F:System.Data.SQLite.UpdateEventType.Insert">
            <summary>
            A row is being inserted into the table.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.UpdateEventType.Update">
            <summary>
            A row is being updated in the table.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.UpdateEventArgs">
            <summary>
            Passed during an Update callback, these event arguments detail the type of update operation being performed
            on the given connection.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.UpdateEventArgs.Database">
            <summary>
            The name of the database being updated (usually "main" but can be any attached or temporary database)
            </summary>
        </member>
        <member name="F:System.Data.SQLite.UpdateEventArgs.Table">
            <summary>
            The name of the table being updated
            </summary>
        </member>
        <member name="F:System.Data.SQLite.UpdateEventArgs.Event">
            <summary>
            The type of update being performed (insert/update/delete)
            </summary>
        </member>
        <member name="F:System.Data.SQLite.UpdateEventArgs.RowId">
            <summary>
            The RowId affected by this update.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.CommitEventArgs">
            <summary>
            Event arguments raised when a transaction is being committed
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CommitEventArgs.AbortTransaction">
            <summary>
            Set to true to abort the transaction and trigger a rollback
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteFunction">
            <summary>
            This abstract class is designed to handle user-defined functions easily.  An instance of the derived class is made for each
            connection to the database.
            </summary>
            <remarks>
            Although there is one instance of a class derived from SQLiteFunction per database connection, the derived class has no access
            to the underlying connection.  This is necessary to deter implementers from thinking it would be a good idea to make database
            calls during processing.
            
            It is important to distinguish between a per-connection instance, and a per-SQL statement context.  One instance of this class
            services all SQL statements being stepped through on that connection, and there can be many.  One should never store per-statement
            information in member variables of user-defined function classes.
            
            For aggregate functions, always create and store your per-statement data in the contextData object on the 1st step.  This data will
            be automatically freed for you (and Dispose() called if the item supports IDisposable) when the statement completes.
            </remarks>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFunction._base">
            <summary>
            The base connection this function is attached to
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFunction._contextDataList">
            <summary>
            Internal array used to keep track of aggregate function context data
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFunction._InvokeFunc">
            <summary>
            Holds a reference to the callback function for user functions
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFunction._StepFunc">
            <summary>
            Holds a reference to the callbakc function for stepping in an aggregate function
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFunction._FinalFunc">
            <summary>
            Holds a reference to the callback function for finalizing an aggregate function
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFunction._CompareFunc">
            <summary>
            Holds a reference to the callback function for collation sequences
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFunction._context">
            <summary>
            Current context of the current callback.  Only valid during a callback
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFunction._registeredFunctions">
            <summary>
            This static list contains all the user-defined functions declared using the proper attributes.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.#ctor">
            <summary>
            Internal constructor, initializes the function's internal variables.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.Invoke(System.Object[])">
            <summary>
            Scalar functions override this method to do their magic.
            </summary>
            <remarks>
            Parameters passed to functions have only an affinity for a certain data type, there is no underlying schema available
            to force them into a certain type.  Therefore the only types you will ever see as parameters are
            DBNull.Value, Int64, Double, String or byte[] array.
            </remarks>
            <param name="args">The arguments for the command to process</param>
            <returns>You may return most simple types as a return value, null or DBNull.Value to return null, DateTime, or
            you may return an Exception-derived class if you wish to return an error to SQLite.  Do not actually throw the error,
            just return it!</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.Step(System.Object[],System.Int32,System.Object@)">
            <summary>
            Aggregate functions override this method to do their magic.
            </summary>
            <remarks>
            Typically you'll be updating whatever you've placed in the contextData field and returning as quickly as possible.
            </remarks>
            <param name="args">The arguments for the command to process</param>
            <param name="stepNumber">The 1-based step number.  This is incrememted each time the step method is called.</param>
            <param name="contextData">A placeholder for implementers to store contextual data pertaining to the current context.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.Final(System.Object)">
            <summary>
            Aggregate functions override this method to finish their aggregate processing.
            </summary>
            <remarks>
            If you implemented your aggregate function properly,
            you've been recording and keeping track of your data in the contextData object provided, and now at this stage you should have
            all the information you need in there to figure out what to return.
            NOTE:  It is possible to arrive here without receiving a previous call to Step(), in which case the contextData will
            be null.  This can happen when no rows were returned.  You can either return null, or 0 or some other custom return value
            if that is the case.
            </remarks>
            <param name="contextData">Your own assigned contextData, provided for you so you can return your final results.</param>
            <returns>You may return most simple types as a return value, null or DBNull.Value to return null, DateTime, or
            you may return an Exception-derived class if you wish to return an error to SQLite.  Do not actually throw the error,
            just return it!
            </returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.Compare(System.String,System.String)">
            <summary>
            User-defined collation sequences override this method to provide a custom string sorting algorithm.
            </summary>
            <param name="param1">The first string to compare</param>
            <param name="param2">The second strnig to compare</param>
            <returns>1 if param1 is greater than param2, 0 if they are equal, or -1 if param1 is less than param2</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.ConvertParams(System.Int32,System.IntPtr)">
            <summary>
            Converts an IntPtr array of context arguments to an object array containing the resolved parameters the pointers point to.
            </summary>
            <remarks>
            Parameters passed to functions have only an affinity for a certain data type, there is no underlying schema available
            to force them into a certain type.  Therefore the only types you will ever see as parameters are
            DBNull.Value, Int64, Double, String or byte[] array.
            </remarks>
            <param name="nArgs">The number of arguments</param>
            <param name="argsptr">A pointer to the array of arguments</param>
            <returns>An object array of the arguments once they've been converted to .NET values</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.SetReturnValue(System.IntPtr,System.Object)">
            <summary>
            Takes the return value from Invoke() and Final() and figures out how to return it to SQLite's context.
            </summary>
            <param name="context">The context the return value applies to</param>
            <param name="returnValue">The parameter to return to SQLite</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.ScalarCallback(System.IntPtr,System.Int32,System.IntPtr)">
            <summary>
            Internal scalar callback function, which wraps the raw context pointer and calls the virtual Invoke() method.
            </summary>
            <param name="context">A raw context pointer</param>
            <param name="nArgs">Number of arguments passed in</param>
            <param name="argsptr">A pointer to the array of arguments</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.CompareCallback(System.IntPtr,System.Int32,System.IntPtr,System.Int32,System.IntPtr)">
            <summary>
            Internal collation sequence function, which wraps up the raw string pointers and executes the Compare() virtual function.
            </summary>
            <param name="ptr">Not used</param>
            <param name="len1">Length of the string pv1</param>
            <param name="ptr1">Pointer to the first string to compare</param>
            <param name="len2">Length of the string pv2</param>
            <param name="ptr2">Pointer to the second string to compare</param>
            <returns>Returns -1 if the first string is less than the second.  0 if they are equal, or 1 if the first string is greater
            than the second.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.StepCallback(System.IntPtr,System.Int32,System.IntPtr)">
            <summary>
            The internal aggregate Step function callback, which wraps the raw context pointer and calls the virtual Step() method.
            </summary>
            <remarks>
            This function takes care of doing the lookups and getting the important information put together to call the Step() function.
            That includes pulling out the user's contextData and updating it after the call is made.  We use a sorted list for this so
            binary searches can be done to find the data.
            </remarks>
            <param name="context">A raw context pointer</param>
            <param name="nArgs">Number of arguments passed in</param>
            <param name="argsptr">A pointer to the array of arguments</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.FinalCallback(System.IntPtr)">
            <summary>
            An internal aggregate Final function callback, which wraps the context pointer and calls the virtual Final() method.
            </summary>
            <param name="context">A raw context pointer</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.Dispose(System.Boolean)">
            <summary>
            Placeholder for a user-defined disposal routine
            </summary>
            <param name="disposing">True if the object is being disposed explicitly</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.Dispose">
            <summary>
            Disposes of any active contextData variables that were not automatically cleaned up.  Sometimes this can happen if
            someone closes the connection while a DataReader is open.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.#cctor">
            <summary>
            Using reflection, enumerate all assemblies in the current appdomain looking for classes that
            have a SQLiteFunctionAttribute attribute, and registering them accordingly.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.RegisterFunction(System.Type)">
            <summary>
            Manual method of registering a function.  The type must still have the SQLiteFunctionAttributes in order to work
            properly, but this is a workaround for the Compact Framework where enumerating assemblies is not currently supported.
            </summary>
            <param name="typ">The type of the function to register</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunction.BindFunctions(System.Data.SQLite.SQLiteBase)">
            <summary>
            Called by SQLiteBase derived classes, this function binds all user-defined functions to a connection.
            It is done this way so that all user-defined functions will access the database using the same encoding scheme
            as the connection (UTF-8 or UTF-16).
            </summary>
            <remarks>
            The wrapper functions that interop with SQLite will create a unique cookie value, which internally is a pointer to
            all the wrapped callback functions.  The interop function uses it to map CDecl callbacks to StdCall callbacks.
            </remarks>
            <param name="sqlbase">The base object on which the functions are to bind</param>
            <returns>Returns an array of functions which the connection object should retain until the connection is closed.</returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteFunction.SQLiteConvert">
            <summary>
            Returns a reference to the underlying connection's SQLiteConvert class, which can be used to convert
            strings and DateTime's into the current connection's encoding schema.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteFunctionEx">
            <summary>
            Extends SQLiteFunction and allows an inherited class to obtain the collating sequence associated with a function call.
            </summary>
            <remarks>
            User-defined functions can call the GetCollationSequence() method in this class and use it to compare strings and char arrays.
            </remarks>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunctionEx.GetCollationSequence">
            <summary>
            Obtains the collating sequence in effect for the given function.
            </summary>
            <returns></returns>
        </member>
        <member name="T:System.Data.SQLite.FunctionType">
            <summary>
            The type of user-defined function to declare
            </summary>
        </member>
        <member name="F:System.Data.SQLite.FunctionType.Scalar">
            <summary>
            Scalar functions are designed to be called and return a result immediately.  Examples include ABS(), Upper(), Lower(), etc.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.FunctionType.Aggregate">
            <summary>
            Aggregate functions are designed to accumulate data until the end of a call and then return a result gleaned from the accumulated data.
            Examples include SUM(), COUNT(), AVG(), etc.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.FunctionType.Collation">
            <summary>
            Collation sequences are used to sort textual data in a custom manner, and appear in an ORDER BY clause.  Typically text in an ORDER BY is
            sorted using a straight case-insensitive comparison function.  Custom collating sequences can be used to alter the behavior of text sorting
            in a user-defined manner.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteCallback">
            <summary>
            An internal callback delegate declaration.
            </summary>
            <param name="context">Raw context pointer for the user function</param>
            <param name="nArgs">Count of arguments to the function</param>
            <param name="argsptr">A pointer to the array of argument pointers</param>
        </member>
        <member name="T:System.Data.SQLite.SQLiteFinalCallback">
            <summary>
            An internal final callback delegate declaration.
            </summary>
            <param name="context">Raw context pointer for the user function</param>
        </member>
        <member name="T:System.Data.SQLite.SQLiteCollation">
            <summary>
            Internal callback delegate for implementing collation sequences
            </summary>
            <param name="puser">Not used</param>
            <param name="len1">Length of the string pv1</param>
            <param name="pv1">Pointer to the first string to compare</param>
            <param name="len2">Length of the string pv2</param>
            <param name="pv2">Pointer to the second string to compare</param>
            <returns>Returns -1 if the first string is less than the second.  0 if they are equal, or 1 if the first string is greater
            than the second.</returns>
        </member>
        <member name="T:System.Data.SQLite.CollationTypeEnum">
            <summary>
            The type of collating sequence
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationTypeEnum.Binary">
            <summary>
            The built-in BINARY collating sequence
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationTypeEnum.NoCase">
            <summary>
            The built-in NOCASE collating sequence
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationTypeEnum.Reverse">
            <summary>
            The built-in REVERSE collating sequence
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationTypeEnum.Custom">
            <summary>
            A custom user-defined collating sequence
            </summary>
        </member>
        <member name="T:System.Data.SQLite.CollationEncodingEnum">
            <summary>
            The encoding type the collation sequence uses
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationEncodingEnum.UTF8">
            <summary>
            The collation sequence is UTF8
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationEncodingEnum.UTF16LE">
            <summary>
            The collation sequence is UTF16 little-endian
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationEncodingEnum.UTF16BE">
            <summary>
            The collation sequence is UTF16 big-endian
            </summary>
        </member>
        <member name="T:System.Data.SQLite.CollationSequence">
            <summary>
            A struct describing the collating sequence a function is executing in
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationSequence.Name">
            <summary>
            The name of the collating sequence
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationSequence.Type">
            <summary>
            The type of collating sequence
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationSequence.Encoding">
            <summary>
            The text encoding of the collation sequence
            </summary>
        </member>
        <member name="F:System.Data.SQLite.CollationSequence._func">
            <summary>
            Context of the function that requested the collating sequence
            </summary>
        </member>
        <member name="M:System.Data.SQLite.CollationSequence.Compare(System.String,System.String)">
            <summary>
            Calls the base collating sequence to compare two strings
            </summary>
            <param name="s1">The first string to compare</param>
            <param name="s2">The second string to compare</param>
            <returns>-1 if s1 is less than s2, 0 if s1 is equal to s2, and 1 if s1 is greater than s2</returns>
        </member>
        <member name="M:System.Data.SQLite.CollationSequence.Compare(System.Char[],System.Char[])">
            <summary>
            Calls the base collating sequence to compare two character arrays
            </summary>
            <param name="c1">The first array to compare</param>
            <param name="c2">The second array to compare</param>
            <returns>-1 if c1 is less than c2, 0 if c1 is equal to c2, and 1 if c1 is greater than c2</returns>
        </member>
        <member name="T:System.Data.SQLite.SQLiteFactory">
            <summary>
            SQLite implementation of DbProviderFactory.
            </summary>
            <summary>
            SQLite implementation of DbProviderFactory.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteFactory.Instance">
            <summary>
            Static instance member which returns an instanced SQLiteFactory class.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateCommand">
            <summary>
            Returns a new SQLiteCommand object.
            </summary>
            <returns>A SQLiteCommand object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateCommandBuilder">
            <summary>
            Returns a new SQLiteCommandBuilder object.
            </summary>
            <returns>A SQLiteCommandBuilder object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateConnection">
            <summary>
            Creates a new SQLiteConnection.
            </summary>
            <returns>A SQLiteConnection object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateConnectionStringBuilder">
            <summary>
            Creates a new SQLiteConnectionStringBuilder.
            </summary>
            <returns>A SQLiteConnectionStringBuilder object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateDataAdapter">
            <summary>
            Creates a new SQLiteDataAdapter.
            </summary>
            <returns>A SQLiteDataAdapter object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.CreateParameter">
            <summary>
            Creates a new SQLiteParameter.
            </summary>
            <returns>A SQLiteParameter object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFactory.System#IServiceProvider#GetService(System.Type)">
            <summary>
            Will provide a DbProviderServices object in .NET 3.5
            </summary>
            <param name="serviceType">The class or interface type to query for</param>
            <returns></returns>
        </member>
        <member name="T:System.Data.SQLite.SQLiteException">
            <summary>
            SQLite exception class.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteException.#ctor(System.Int32,System.String)">
            <summary>
            Public constructor for generating a SQLite error given the base error code
            </summary>
            <param name="errorCode">The SQLite error code to report</param>
            <param name="extendedInformation">Extra text to go along with the error message text</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteException.#ctor(System.String)">
            <summary>
            Various public constructors that just pass along to the base Exception
            </summary>
            <param name="message">Passed verbatim to Exception</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteException.#ctor">
            <summary>
            Various public constructors that just pass along to the base Exception
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteException.#ctor(System.String,System.Exception)">
            <summary>
            Various public constructors that just pass along to the base Exception
            <param name="message">Passed to Exception</param>
            <param name="innerException">Passed to Exception</param>
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteException.GetStockErrorMessage(System.Int32,System.String)">
            <summary>
            Initializes the exception class with the SQLite error code.
            </summary>
            <param name="errorCode">The SQLite error code</param>
            <param name="errorMessage">A detailed error message</param>
            <returns>An error message string</returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteException.ErrorCode">
            <summary>
            Retrieves the underlying SQLite error code for this exception
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteErrorCode">
            <summary>
            SQLite error codes
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Ok">
            <summary>
            Success
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Error">
            <summary>
            SQL error or missing database
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Internal">
            <summary>
            Internal logic error in SQLite
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Perm">
            <summary>
            Access permission denied
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Abort">
            <summary>
            Callback routine requested an abort
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Busy">
            <summary>
            The database file is locked
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Locked">
            <summary>
            A table in the database is locked
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.NoMem">
            <summary>
            malloc() failed
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.ReadOnly">
            <summary>
            Attempt to write a read-only database
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Interrupt">
            <summary>
            Operation terminated by sqlite3_interrupt()
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.IOErr">
            <summary>
            Some kind of disk I/O error occurred
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Corrupt">
            <summary>
            The database disk image is malformed
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.NotFound">
            <summary>
            Table or record not found
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Full">
            <summary>
            Insertion failed because database is full
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.CantOpen">
            <summary>
            Unable to open the database file
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Protocol">
            <summary>
            Database lock protocol error
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Empty">
            <summary>
            Database is empty
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Schema">
            <summary>
            The database schema changed
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.TooBig">
            <summary>
            Too much data for one row of a table
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Constraint">
            <summary>
            Abort due to constraint violation
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Mismatch">
            <summary>
            Data type mismatch
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Misuse">
            <summary>
            Library used incorrectly
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.NOLFS">
            <summary>
            Uses OS features not supported on host
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Auth">
            <summary>
            Authorization denied
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Format">
            <summary>
            Auxiliary database format error
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Range">
            <summary>
            2nd parameter to sqlite3_bind out of range
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.NotADatabase">
            <summary>
            File opened that is not a database file
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Row">
            <summary>
            sqlite3_step() has another row ready
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteErrorCode.Done">
            <summary>
            sqlite3_step() has finished executing
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteBase">
            <summary>
            This internal class provides the foundation of SQLite support.  It defines all the abstract members needed to implement
            a SQLite data provider, and inherits from SQLiteConvert which allows for simple translations of string to and from SQLite.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteConvert">
            <summary>
            This base class provides datatype conversion services for the SQLite provider.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConvert._datetimeFormats">
            <summary>
            An array of ISO8601 datetime formats we support conversion from
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConvert._utf8">
            <summary>
            An UTF-8 Encoding instance, so we can convert strings to and from UTF-8
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteConvert._datetimeFormat">
            <summary>
            The default DateTime format for this instance
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.#ctor(System.Data.SQLite.SQLiteDateFormats)">
            <summary>
            Initializes the conversion class
            </summary>
            <param name="fmt">The default date/time format to use for this instance</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToUTF8(System.String)">
            <summary>
            Converts a string to a UTF-8 encoded byte array sized to include a null-terminating character.
            </summary>
            <param name="sourceText">The string to convert to UTF-8</param>
            <returns>A byte array containing the converted string plus an extra 0 terminating byte at the end of the array.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToUTF8(System.DateTime)">
            <summary>
            Convert a DateTime to a UTF-8 encoded, zero-terminated byte array.
            </summary>
            <remarks>
            This function is a convenience function, which first calls ToString() on the DateTime, and then calls ToUTF8() with the
            string result.
            </remarks>
            <param name="dateTimeValue">The DateTime to convert.</param>
            <returns>The UTF-8 encoded string, including a 0 terminating byte at the end of the array.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToString(System.IntPtr,System.Int32)">
            <summary>
            Converts a UTF-8 encoded IntPtr of the specified length into a .NET string
            </summary>
            <param name="nativestring">The pointer to the memory where the UTF-8 string is encoded</param>
            <param name="nativestringlen">The number of bytes to decode</param>
            <returns>A string containing the translated character(s)</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.UTF8ToString(System.IntPtr,System.Int32)">
            <summary>
            Converts a UTF-8 encoded IntPtr of the specified length into a .NET string
            </summary>
            <param name="nativestring">The pointer to the memory where the UTF-8 string is encoded</param>
            <param name="nativestringlen">The number of bytes to decode</param>
            <returns>A string containing the translated character(s)</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToDateTime(System.String)">
            <summary>
            Converts a string into a DateTime, using the current DateTimeFormat specified for the connection when it was opened.
            </summary>
            <remarks>
            Acceptable ISO8601 DateTime formats are:
              yyyy-MM-dd HH:mm:ss
              yyyyMMddHHmmss
              yyyyMMddTHHmmssfffffff
              yyyy-MM-dd
              yy-MM-dd
              yyyyMMdd
              HH:mm:ss
              THHmmss
            </remarks>
            <param name="dateText">The string containing either a Tick value, a JulianDay double, or an ISO8601-format string</param>
            <returns>A DateTime value</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToDateTime(System.Double)">
            <summary>
            Converts a julianday value into a DateTime
            </summary>
            <param name="julianDay">The value to convert</param>
            <returns>A .NET DateTime</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToJulianDay(System.DateTime)">
            <summary>
            Converts a DateTime struct to a JulianDay double
            </summary>
            <param name="value">The DateTime to convert</param>
            <returns>The JulianDay value the Datetime represents</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToString(System.DateTime)">
            <summary>
            Converts a DateTime to a string value, using the current DateTimeFormat specified for the connection when it was opened.
            </summary>
            <param name="dateValue">The DateTime value to convert</param>
            <returns>Either a string consisting of the tick count for DateTimeFormat.Ticks, a JulianDay double, or a date/time in ISO8601 format.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToDateTime(System.IntPtr,System.Int32)">
            <summary>
            Internal function to convert a UTF-8 encoded IntPtr of the specified length to a DateTime.
            </summary>
            <remarks>
            This is a convenience function, which first calls ToString() on the IntPtr to convert it to a string, then calls
            ToDateTime() on the string to return a DateTime.
            </remarks>
            <param name="ptr">A pointer to the UTF-8 encoded string</param>
            <param name="len">The length in bytes of the string</param>
            <returns>The parsed DateTime value</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.Split(System.String,System.Char)">
            <summary>
            Smart method of splitting a string.  Skips quoted elements, removes the quotes.
            </summary>
            <remarks>
            This split function works somewhat like the String.Split() function in that it breaks apart a string into
            pieces and returns the pieces as an array.  The primary differences are:
            <list type="bullet">
            <item><description>Only one character can be provided as a separator character</description></item>
            <item><description>Quoted text inside the string is skipped over when searching for the separator, and the quotes are removed.</description></item>
            </list>
            Thus, if splitting the following string looking for a comma:<br/>
            One,Two, "Three, Four", Five<br/>
            <br/>
            The resulting array would contain<br/>
            [0] One<br/>
            [1] Two<br/>
            [2] Three, Four<br/>
            [3] Five<br/>
            <br/>
            Note that the leading and trailing spaces were removed from each item during the split.
            </remarks>
            <param name="source">Source string to split apart</param>
            <param name="separator">Separator character</param>
            <returns>A string array of the split up elements</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToBoolean(System.Object)">
            <summary>
            Convert a value to true or false.
            </summary>
            <param name="source">A string or number representing true or false</param>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ToBoolean(System.String)">
            <summary>
            Convert a string to true or false.
            </summary>
            <param name="source">A string representing true or false</param>
            <returns></returns>
            <remarks>
            "yes", "no", "y", "n", "0", "1", "on", "off" as well as Boolean.FalseString and Boolean.TrueString will all be
            converted to a proper boolean value.
            </remarks>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.ColumnToType(System.Data.SQLite.SQLiteStatement,System.Int32,System.Data.SQLite.SQLiteType)">
            <summary>
            Determines the data type of a column in a statement
            </summary>
            <param name="stmt">The statement to retrieve information for</param>
            <param name="i">The column to retrieve type information on</param>
            <param name="typ">The SQLiteType to receive the affinity for the given column</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.SQLiteTypeToType(System.Data.SQLite.SQLiteType)">
            <summary>
            Converts a SQLiteType to a .NET Type object
            </summary>
            <param name="t">The SQLiteType to convert</param>
            <returns>Returns a .NET Type object</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.TypeToDbType(System.Type)">
            <summary>
            For a given intrinsic type, return a DbType
            </summary>
            <param name="typ">The native type to convert</param>
            <returns>The corresponding (closest match) DbType</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.DbTypeToColumnSize(System.Data.DbType)">
            <summary>
            Returns the ColumnSize for the given DbType
            </summary>
            <param name="typ">The DbType to get the size of</param>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.DbTypeToType(System.Data.DbType)">
            <summary>
            Convert a DbType to a Type
            </summary>
            <param name="typ">The DbType to convert from</param>
            <returns>The closest-match .NET type</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.TypeToAffinity(System.Type)">
            <summary>
            For a given type, return the closest-match SQLite TypeAffinity, which only understands a very limited subset of types.
            </summary>
            <param name="typ">The type to evaluate</param>
            <returns>The SQLite type affinity for that type.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteConvert.TypeNameToDbType(System.String)">
            <summary>
            For a given type name, return a closest-match .NET type
            </summary>
            <param name="Name">The name of the type to match</param>
            <returns>The .NET DBType the text evaluates to.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.Open(System.String,System.Data.SQLite.SQLiteOpenFlagsEnum,System.Int32,System.Boolean)">
            <summary>
            Opens a database.
            </summary>
            <remarks>
            Implementers should call SQLiteFunction.BindFunctions() and save the array after opening a connection
            to bind all attributed user-defined functions and collating sequences to the new connection.
            </remarks>
            <param name="strFilename">The filename of the database to open.  SQLite automatically creates it if it doesn't exist.</param>
            <param name="flags">The open flags to use when creating the connection</param>
            <param name="maxPoolSize">The maximum size of the pool for the given filename</param>
            <param name="usePool">If true, the connection can be pulled from the connection pool</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.Close">
            <summary>
            Closes the currently-open database.
            </summary>
            <remarks>
            After the database has been closed implemeters should call SQLiteFunction.UnbindFunctions() to deallocate all interop allocated
            memory associated with the user-defined functions and collating sequences tied to the closed connection.
            </remarks>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.SetTimeout(System.Int32)">
            <summary>
            Sets the busy timeout on the connection.  SQLiteCommand will call this before executing any command.
            </summary>
            <param name="nTimeoutMS">The number of milliseconds to wait before returning SQLITE_BUSY</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.SQLiteLastError">
            <summary>
            Returns the text of the last error issued by SQLite
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.ClearPool">
            <summary>
            When pooling is enabled, force this connection to be disposed rather than returned to the pool
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.Prepare(System.Data.SQLite.SQLiteConnection,System.String,System.Data.SQLite.SQLiteStatement,System.UInt32,System.String@)">
            <summary>
            Prepares a SQL statement for execution.
            </summary>
            <param name="cnn">The source connection preparing the command.  Can be null for any caller except LINQ</param>
            <param name="strSql">The SQL command text to prepare</param>
            <param name="previous">The previous statement in a multi-statement command, or null if no previous statement exists</param>
            <param name="timeoutMS">The timeout to wait before aborting the prepare</param>
            <param name="strRemain">The remainder of the statement that was not processed.  Each call to prepare parses the
            SQL up to to either the end of the text or to the first semi-colon delimiter.  The remaining text is returned
            here for a subsequent call to Prepare() until all the text has been processed.</param>
            <returns>Returns an initialized SQLiteStatement.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.Step(System.Data.SQLite.SQLiteStatement)">
            <summary>
            Steps through a prepared statement.
            </summary>
            <param name="stmt">The SQLiteStatement to step through</param>
            <returns>True if a row was returned, False if not.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteBase.Reset(System.Data.SQLite.SQLiteStatement)">
            <summary>
            Resets a prepared statement so it can be executed again.  If the error returned is SQLITE_SCHEMA, 
            transparently attempt to rebuild the SQL statement and throw an error if that was not possible.
            </summary>
            <param name="stmt">The statement to reset</param>
            <returns>Returns -1 if the schema changed while resetting, 0 if the reset was sucessful or 6 (SQLITE_LOCKED) if the reset failed due to a lock</returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteBase.Version">
            <summary>
            Returns a string representing the active version of SQLite
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteBase.Changes">
            <summary>
            Returns the number of changes the last executing insert/update caused.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.TypeAffinity">
            <summary>
            SQLite has very limited types, and is inherently text-based.  The first 5 types below represent the sum of all types SQLite
            understands.  The DateTime extension to the spec is for internal use only.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.TypeAffinity.Uninitialized">
            <summary>
            Not used
            </summary>
        </member>
        <member name="F:System.Data.SQLite.TypeAffinity.Int64">
            <summary>
            All integers in SQLite default to Int64
            </summary>
        </member>
        <member name="F:System.Data.SQLite.TypeAffinity.Double">
            <summary>
            All floating point numbers in SQLite default to double
            </summary>
        </member>
        <member name="F:System.Data.SQLite.TypeAffinity.Text">
            <summary>
            The default data type of SQLite is text
            </summary>
        </member>
        <member name="F:System.Data.SQLite.TypeAffinity.Blob">
            <summary>
            Typically blob types are only seen when returned from a function
            </summary>
        </member>
        <member name="F:System.Data.SQLite.TypeAffinity.Null">
            <summary>
            Null types can be returned from functions
            </summary>
        </member>
        <member name="F:System.Data.SQLite.TypeAffinity.DateTime">
            <summary>
            Used internally by this provider
            </summary>
        </member>
        <member name="F:System.Data.SQLite.TypeAffinity.None">
            <summary>
            Used internally
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteDateFormats">
            <summary>
            This implementation of SQLite for ADO.NET can process date/time fields in databases in only one of three formats.  Ticks, ISO8601
            and JulianDay.
            </summary>
            <remarks>
            ISO8601 is more compatible, readable, fully-processable, but less accurate as it doesn't provide time down to fractions of a second.
            JulianDay is the numeric format the SQLite uses internally and is arguably the most compatible with 3rd party tools.  It is
            not readable as text without post-processing.
            Ticks less compatible with 3rd party tools that query the database, and renders the DateTime field unreadable as text without post-processing.
            
            The preferred order of choosing a datetime format is JulianDay, ISO8601, and then Ticks.  Ticks is mainly present for legacy 
            code support.
            </remarks>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDateFormats.Ticks">
            <summary>
            Using ticks is not recommended and is not well supported with LINQ.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDateFormats.ISO8601">
            <summary>
            The default format for this provider.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDateFormats.JulianDay">
            <summary>
            JulianDay format, which is what SQLite uses internally
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteJournalModeEnum">
            <summary>
            This enum determines how SQLite treats its journal file.
            </summary>
            <remarks>
            By default SQLite will create and delete the journal file when needed during a transaction.
            However, for some computers running certain filesystem monitoring tools, the rapid
            creation and deletion of the journal file can cause those programs to fail, or to interfere with SQLite.
            
            If a program or virus scanner is interfering with SQLite's journal file, you may receive errors like "unable to open database file"
            when starting a transaction.  If this is happening, you may want to change the default journal mode to Persist.
            </remarks>
        </member>
        <member name="F:System.Data.SQLite.SQLiteJournalModeEnum.Delete">
            <summary>
            The default mode, this causes SQLite to create and destroy the journal file as-needed.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteJournalModeEnum.Persist">
            <summary>
            When this is set, SQLite will keep the journal file even after a transaction has completed.  It's contents will be erased,
            and the journal re-used as often as needed.  If it is deleted, it will be recreated the next time it is needed.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteJournalModeEnum.Off">
            <summary>
            This option disables the rollback journal entirely.  Interrupted transactions or a program crash can cause database
            corruption in this mode!
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteType">
            <summary>
            Struct used internally to determine the datatype of a column in a resultset
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteType.Type">
            <summary>
            The DbType of the column, or DbType.Object if it cannot be determined
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteType.Affinity">
            <summary>
            The affinity of a column, used for expressions or when Type is DbType.Object
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteStatement">
            <summary>
            Represents a single SQL statement in SQLite.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteStatement._sql">
            <summary>
            The underlying SQLite object this statement is bound to
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteStatement._sqlStatement">
            <summary>
            The command text of this SQL statement
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteStatement._sqlite_stmt">
            <summary>
            The actual statement pointer
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteStatement._unnamedParameters">
            <summary>
            An index from which unnamed parameters begin
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteStatement._paramNames">
            <summary>
            Names of the parameters as SQLite understands them to be
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteStatement._paramValues">
            <summary>
            Parameters for this statement
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteStatement._command">
            <summary>
            Command this statement belongs to (if any)
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteStatement.#ctor(System.Data.SQLite.SQLiteBase,System.Data.SQLite.SQLiteStatementHandle,System.String,System.Data.SQLite.SQLiteStatement)">
            <summary>
            Initializes the statement and attempts to get all information about parameters in the statement
            </summary>
            <param name="sqlbase">The base SQLite object</param>
            <param name="stmt">The statement</param>
            <param name="strCommand">The command text for this statement</param>
            <param name="previous">The previous command in a multi-statement command</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteStatement.MapParameter(System.String,System.Data.SQLite.SQLiteParameter)">
            <summary>
            Called by SQLiteParameterCollection, this function determines if the specified parameter name belongs to
            this statement, and if so, keeps a reference to the parameter so it can be bound later.
            </summary>
            <param name="s">The parameter name to map</param>
            <param name="p">The parameter to assign it</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteStatement.Dispose">
            <summary>
            Disposes and finalizes the statement
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteStatement.BindParameters">
            <summary>
             Bind all parameters, making sure the caller didn't miss any
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteStatement.BindParameter(System.Int32,System.Data.SQLite.SQLiteParameter)">
            <summary>
            Perform the bind operation for an individual parameter
            </summary>
            <param name="index">The index of the parameter to bind</param>
            <param name="param">The parameter we're binding</param>
        </member>
        <member name="T:System.Data.SQLite.SQLiteDataReader">
            <summary>
            SQLite implementation of DbDataReader.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._command">
            <summary>
            Underlying command this reader is attached to
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._activeStatementIndex">
            <summary>
            Index of the current statement in the command being processed
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._activeStatement">
            <summary>
            Current statement being Read()
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._readingState">
            <summary>
            State of the current statement being processed.
            -1 = First Step() executed, so the first Read() will be ignored
             0 = Actively reading
             1 = Finished reading
             2 = Non-row-returning statement, no records
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._rowsAffected">
            <summary>
            Number of records affected by the insert/update statements executed on the command
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._fieldCount">
            <summary>
            Count of fields (columns) in the row-returning statement currently being processed
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._fieldTypeArray">
            <summary>
            Datatypes of active fields (columns) in the current statement, used for type-restricting data
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._commandBehavior">
            <summary>
            The behavior of the datareader
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._disposeCommand">
            <summary>
            If set, then dispose of the command object when the reader is finished
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteDataReader._keyInfo">
            <summary>
            An array of rowid's for the active statement if CommandBehavior.KeyInfo is specified
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.#ctor(System.Data.SQLite.SQLiteCommand,System.Data.CommandBehavior)">
            <summary>
            Internal constructor, initializes the datareader and sets up to begin executing statements
            </summary>
            <param name="cmd">The SQLiteCommand this data reader is for</param>
            <param name="behave">The expected behavior of the data reader</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.Close">
            <summary>
            Closes the datareader, potentially closing the connection as well if CommandBehavior.CloseConnection was specified.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.CheckClosed">
            <summary>
            Throw an error if the datareader is closed
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.CheckValidRow">
            <summary>
            Throw an error if a row is not loaded
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetEnumerator">
            <summary>
            Enumerator support
            </summary>
            <returns>Returns a DbEnumerator object.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.VerifyType(System.Int32,System.Data.DbType)">
            <summary>
            SQLite is inherently un-typed.  All datatypes in SQLite are natively strings.  The definition of the columns of a table
            and the affinity of returned types are all we have to go on to type-restrict data in the reader.
            
            This function attempts to verify that the type of data being requested of a column matches the datatype of the column.  In
            the case of columns that are not backed into a table definition, we attempt to match up the affinity of a column (int, double, string or blob)
            to a set of known types that closely match that affinity.  It's not an exact science, but its the best we can do.
            </summary>
            <returns>
            This function throws an InvalidTypeCast() exception if the requested type doesn't match the column's definition or affinity.
            </returns>
            <param name="i">The index of the column to type-check</param>
            <param name="typ">The type we want to get out of the column</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetBoolean(System.Int32)">
            <summary>
            Retrieves the column as a boolean value
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>bool</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetByte(System.Int32)">
            <summary>
            Retrieves the column as a single byte value
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>byte</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetBytes(System.Int32,System.Int64,System.Byte[],System.Int32,System.Int32)">
            <summary>
            Retrieves a column as an array of bytes (blob)
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <param name="fieldOffset">The zero-based index of where to begin reading the data</param>
            <param name="buffer">The buffer to write the bytes into</param>
            <param name="bufferoffset">The zero-based index of where to begin writing into the array</param>
            <param name="length">The number of bytes to retrieve</param>
            <returns>The actual number of bytes written into the array</returns>
            <remarks>
            To determine the number of bytes in the column, pass a null value for the buffer.  The total length will be returned.
            </remarks>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetChar(System.Int32)">
            <summary>
            Returns the column as a single character
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>char</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetChars(System.Int32,System.Int64,System.Char[],System.Int32,System.Int32)">
            <summary>
            Retrieves a column as an array of chars (blob)
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <param name="fieldoffset">The zero-based index of where to begin reading the data</param>
            <param name="buffer">The buffer to write the characters into</param>
            <param name="bufferoffset">The zero-based index of where to begin writing into the array</param>
            <param name="length">The number of bytes to retrieve</param>
            <returns>The actual number of characters written into the array</returns>
            <remarks>
            To determine the number of characters in the column, pass a null value for the buffer.  The total length will be returned.
            </remarks>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetDataTypeName(System.Int32)">
            <summary>
            Retrieves the name of the back-end datatype of the column
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>string</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetDateTime(System.Int32)">
            <summary>
            Retrieve the column as a date/time value
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>DateTime</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetDecimal(System.Int32)">
            <summary>
            Retrieve the column as a decimal value
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>decimal</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetDouble(System.Int32)">
            <summary>
            Returns the column as a double
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>double</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetFieldType(System.Int32)">
            <summary>
            Returns the .NET type of a given column
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>Type</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetFloat(System.Int32)">
            <summary>
            Returns a column as a float value
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>float</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetGuid(System.Int32)">
            <summary>
            Returns the column as a Guid
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>Guid</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetInt16(System.Int32)">
            <summary>
            Returns the column as a short
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>Int16</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetInt32(System.Int32)">
            <summary>
            Retrieves the column as an int
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>Int32</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetInt64(System.Int32)">
            <summary>
            Retrieves the column as a long
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>Int64</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetName(System.Int32)">
            <summary>
            Retrieves the name of the column
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>string</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetOrdinal(System.String)">
            <summary>
            Retrieves the i of a column, given its name
            </summary>
            <param name="name">The name of the column to retrieve</param>
            <returns>The int i of the column</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetSchemaTable">
            <summary>
            Schema information in SQLite is difficult to map into .NET conventions, so a lot of work must be done
            to gather the necessary information so it can be represented in an ADO.NET manner.
            </summary>
            <returns>Returns a DataTable containing the schema information for the active SELECT statement being processed.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetString(System.Int32)">
            <summary>
            Retrieves the column as a string
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>string</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetValue(System.Int32)">
            <summary>
            Retrieves the column as an object corresponding to the underlying datatype of the column
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>object</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetValues(System.Object[])">
            <summary>
            Retreives the values of multiple columns, up to the size of the supplied array
            </summary>
            <param name="values">The array to fill with values from the columns in the current resultset</param>
            <returns>The number of columns retrieved</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.IsDBNull(System.Int32)">
            <summary>
            Returns True if the specified column is null
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>True or False</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.NextResult">
            <summary>
            Moves to the next resultset in multiple row-returning SQL command.
            </summary>
            <returns>True if the command was successful and a new resultset is available, False otherwise.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.GetSQLiteType(System.Int32)">
            <summary>
            Retrieves the SQLiteType for a given column, and caches it to avoid repetetive interop calls.
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>A SQLiteType structure</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataReader.Read">
            <summary>
            Reads the next row from the resultset
            </summary>
            <returns>True if a new row was successfully loaded and is ready for processing</returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataReader.Depth">
            <summary>
            Not implemented.  Returns 0
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataReader.FieldCount">
            <summary>
            Returns the number of columns in the current resultset
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataReader.VisibleFieldCount">
            <summary>
            Returns the number of visible fielsd in the current resultset
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataReader.HasRows">
            <summary>
            Returns True if the resultset has rows that can be fetched
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataReader.IsClosed">
            <summary>
            Returns True if the data reader is closed
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataReader.RecordsAffected">
            <summary>
            Retrieve the count of records affected by an update/insert command.  Only valid once the data reader is closed!
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataReader.Item(System.String)">
            <summary>
            Indexer to retrieve data from a column given its name
            </summary>
            <param name="name">The name of the column to retrieve data for</param>
            <returns>The value contained in the column</returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataReader.Item(System.Int32)">
            <summary>
            Indexer to retrieve data from a column given its i
            </summary>
            <param name="i">The index of the column to retrieve</param>
            <returns>The value contained in the column</returns>
        </member>
        <member name="T:System.Data.SQLite.SQLiteDataAdapter">
            <summary>
            SQLite implementation of DbDataAdapter.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataAdapter.#ctor">
            <overloads>
            This class is just a shell around the DbDataAdapter.  Nothing from DbDataAdapter is overridden here, just a few constructors are defined.
            </overloads>
            <summary>
            Default constructor.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataAdapter.#ctor(System.Data.SQLite.SQLiteCommand)">
            <summary>
            Constructs a data adapter using the specified select command.
            </summary>
            <param name="cmd">The select command to associate with the adapter.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataAdapter.#ctor(System.String,System.Data.SQLite.SQLiteConnection)">
            <summary>
            Constructs a data adapter with the supplied select command text and associated with the specified connection.
            </summary>
            <param name="commandText">The select command text to associate with the data adapter.</param>
            <param name="connection">The connection to associate with the select command.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataAdapter.#ctor(System.String,System.String)">
            <summary>
            Constructs a data adapter with the specified select command text, and using the specified database connection string.
            </summary>
            <param name="commandText">The select command text to use to construct a select command.</param>
            <param name="connectionString">A connection string suitable for passing to a new SQLiteConnection, which is associated with the select command.</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataAdapter.OnRowUpdating(System.Data.Common.RowUpdatingEventArgs)">
            <summary>
            Raised by the underlying DbDataAdapter when a row is being updated
            </summary>
            <param name="value">The event's specifics</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteDataAdapter.OnRowUpdated(System.Data.Common.RowUpdatedEventArgs)">
            <summary>
            Raised by DbDataAdapter after a row is updated
            </summary>
            <param name="value">The event's specifics</param>
        </member>
        <member name="E:System.Data.SQLite.SQLiteDataAdapter.RowUpdating">
            <summary>
            Row updating event handler
            </summary>
        </member>
        <member name="E:System.Data.SQLite.SQLiteDataAdapter.RowUpdated">
            <summary>
            Row updated event handler
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataAdapter.SelectCommand">
            <summary>
            Gets/sets the select command for this DataAdapter
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataAdapter.InsertCommand">
            <summary>
            Gets/sets the insert command for this DataAdapter
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataAdapter.UpdateCommand">
            <summary>
            Gets/sets the update command for this DataAdapter
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteDataAdapter.DeleteCommand">
            <summary>
            Gets/sets the delete command for this DataAdapter
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteTransaction">
            <summary>
            SQLite implementation of DbTransaction.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteTransaction._cnn">
            <summary>
            The connection to which this transaction is bound
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteTransaction.#ctor(System.Data.SQLite.SQLiteConnection,System.Boolean)">
            <summary>
            Constructs the transaction object, binding it to the supplied connection
            </summary>
            <param name="connection">The connection to open a transaction on</param>
            <param name="deferredLock">TRUE to defer the writelock, or FALSE to lock immediately</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteTransaction.Commit">
            <summary>
            Commits the current transaction.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteTransaction.Dispose(System.Boolean)">
            <summary>
            Disposes the transaction.  If it is currently active, any changes are rolled back.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteTransaction.Rollback">
            <summary>
            Rolls back the active transaction.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteTransaction.Connection">
            <summary>
            Returns the underlying connection to which this transaction applies.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteTransaction.DbConnection">
            <summary>
            Forwards to the local Connection property
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteTransaction.IsolationLevel">
            <summary>
            Gets the isolation level of the transaction.  SQLite only supports Serializable transactions.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteParameterCollection">
            <summary>
            SQLite implementation of DbParameterCollection.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteParameterCollection._command">
            <summary>
            The underlying command to which this collection belongs
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteParameterCollection._parameterList">
            <summary>
            The internal array of parameters in this collection
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteParameterCollection._unboundFlag">
            <summary>
            Determines whether or not all parameters have been bound to their statement(s)
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.#ctor(System.Data.SQLite.SQLiteCommand)">
            <summary>
            Initializes the collection
            </summary>
            <param name="cmd">The command to which the collection belongs</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.GetEnumerator">
            <summary>
            Retrieves an enumerator for the collection
            </summary>
            <returns>An enumerator for the underlying array</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Add(System.String,System.Data.DbType,System.Int32,System.String)">
            <summary>
            Adds a parameter to the collection
            </summary>
            <param name="parameterName">The parameter name</param>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the value</param>
            <param name="sourceColumn">The source column</param>
            <returns>A SQLiteParameter object</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Add(System.String,System.Data.DbType,System.Int32)">
            <summary>
            Adds a parameter to the collection
            </summary>
            <param name="parameterName">The parameter name</param>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the value</param>
            <returns>A SQLiteParameter object</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Add(System.String,System.Data.DbType)">
            <summary>
            Adds a parameter to the collection
            </summary>
            <param name="parameterName">The parameter name</param>
            <param name="parameterType">The data type</param>
            <returns>A SQLiteParameter object</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Add(System.Data.SQLite.SQLiteParameter)">
            <summary>
            Adds a parameter to the collection
            </summary>
            <param name="parameter">The parameter to add</param>
            <returns>A zero-based index of where the parameter is located in the array</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Add(System.Object)">
            <summary>
            Adds a parameter to the collection
            </summary>
            <param name="value">The parameter to add</param>
            <returns>A zero-based index of where the parameter is located in the array</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.AddWithValue(System.String,System.Object)">
            <summary>
            Adds a named/unnamed parameter and its value to the parameter collection.
            </summary>
            <param name="parameterName">Name of the parameter, or null to indicate an unnamed parameter</param>
            <param name="value">The initial value of the parameter</param>
            <returns>Returns the SQLiteParameter object created during the call.</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.AddRange(System.Data.SQLite.SQLiteParameter[])">
            <summary>
            Adds an array of parameters to the collection
            </summary>
            <param name="values">The array of parameters to add</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.AddRange(System.Array)">
            <summary>
            Adds an array of parameters to the collection
            </summary>
            <param name="values">The array of parameters to add</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Clear">
            <summary>
            Clears the array and resets the collection
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Contains(System.String)">
            <summary>
            Determines if the named parameter exists in the collection
            </summary>
            <param name="parameterName">The name of the parameter to check</param>
            <returns>True if the parameter is in the collection</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Contains(System.Object)">
            <summary>
            Determines if the parameter exists in the collection
            </summary>
            <param name="value">The SQLiteParameter to check</param>
            <returns>True if the parameter is in the collection</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.CopyTo(System.Array,System.Int32)">
            <summary>
            Not implemented
            </summary>
            <param name="array"></param>
            <param name="index"></param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.GetParameter(System.String)">
            <summary>
            Retrieve a parameter by name from the collection
            </summary>
            <param name="parameterName">The name of the parameter to fetch</param>
            <returns>A DbParameter object</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.GetParameter(System.Int32)">
            <summary>
            Retrieves a parameter by its index in the collection
            </summary>
            <param name="index">The index of the parameter to retrieve</param>
            <returns>A DbParameter object</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.IndexOf(System.String)">
            <summary>
            Returns the index of a parameter given its name
            </summary>
            <param name="parameterName">The name of the parameter to find</param>
            <returns>-1 if not found, otherwise a zero-based index of the parameter</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.IndexOf(System.Object)">
            <summary>
            Returns the index of a parameter
            </summary>
            <param name="value">The parameter to find</param>
            <returns>-1 if not found, otherwise a zero-based index of the parameter</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Insert(System.Int32,System.Object)">
            <summary>
            Inserts a parameter into the array at the specified location
            </summary>
            <param name="index">The zero-based index to insert the parameter at</param>
            <param name="value">The parameter to insert</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Remove(System.Object)">
            <summary>
            Removes a parameter from the collection
            </summary>
            <param name="value">The parameter to remove</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.RemoveAt(System.String)">
            <summary>
            Removes a parameter from the collection given its name
            </summary>
            <param name="parameterName">The name of the parameter to remove</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.RemoveAt(System.Int32)">
            <summary>
            Removes a parameter from the collection given its index
            </summary>
            <param name="index">The zero-based parameter index to remove</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.SetParameter(System.String,System.Data.Common.DbParameter)">
            <summary>
            Re-assign the named parameter to a new parameter object
            </summary>
            <param name="parameterName">The name of the parameter to replace</param>
            <param name="value">The new parameter</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.SetParameter(System.Int32,System.Data.Common.DbParameter)">
            <summary>
            Re-assign a parameter at the specified index
            </summary>
            <param name="index">The zero-based index of the parameter to replace</param>
            <param name="value">The new parameter</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.Unbind">
            <summary>
            Un-binds all parameters from their statements
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameterCollection.MapParameters(System.Data.SQLite.SQLiteStatement)">
            <summary>
            This function attempts to map all parameters in the collection to all statements in a Command.
            Since named parameters may span multiple statements, this function makes sure all statements are bound
            to the same named parameter.  Unnamed parameters are bound in sequence.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameterCollection.IsSynchronized">
            <summary>
            Returns true
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameterCollection.IsFixedSize">
            <summary>
            Returns false
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameterCollection.IsReadOnly">
            <summary>
            Returns false
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameterCollection.SyncRoot">
            <summary>
            Returns null
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameterCollection.Count">
            <summary>
            Returns a count of parameters in the collection
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameterCollection.Item(System.String)">
            <summary>
            Overloaded to specialize the return value of the default indexer
            </summary>
            <param name="parameterName">Name of the parameter to get/set</param>
            <returns>The specified named SQLite parameter</returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameterCollection.Item(System.Int32)">
            <summary>
            Overloaded to specialize the return value of the default indexer
            </summary>
            <param name="index">The index of the parameter to get/set</param>
            <returns>The specified SQLite parameter</returns>
        </member>
        <member name="T:System.Data.SQLite.SQLiteKeyReader">
            <summary>
            This class provides key info for a given SQLite statement.
            <remarks>
            Providing key information for a given statement is non-trivial :(
            </remarks>
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteKeyReader.#ctor(System.Data.SQLite.SQLiteConnection,System.Data.SQLite.SQLiteDataReader,System.Data.SQLite.SQLiteStatement)">
            <summary>
            This function does all the nasty work at determining what keys need to be returned for
            a given statement.
            </summary>
            <param name="cnn"></param>
            <param name="reader"></param>
            <param name="stmt"></param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteKeyReader.Sync">
            <summary>
            Make sure all the subqueries are open and ready and sync'd with the current rowid
            of the table they're supporting
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteKeyReader.Reset">
            <summary>
            Release any readers on any subqueries
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteKeyReader.AppendSchemaTable(System.Data.DataTable)">
            <summary>
            Append all the columns we've added to the original query to the schema
            </summary>
            <param name="tbl"></param>
        </member>
        <member name="P:System.Data.SQLite.SQLiteKeyReader.Count">
            <summary>
            How many additional columns of keyinfo we're holding
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteKeyReader.KeyInfo">
            <summary>
            Used to support CommandBehavior.KeyInfo
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteKeyReader.KeyQuery">
            <summary>
            A single sub-query for a given table/database.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteCommand">
            <summary>
            SQLite implementation of DbCommand.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._commandText">
            <summary>
            The command text this command is based on
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._cnn">
            <summary>
            The connection the command is associated with
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._version">
            <summary>
            The version of the connection the command is associated with
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._activeReader">
            <summary>
            Indicates whether or not a DataReader is active on the command.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._commandTimeout">
            <summary>
            The timeout for the command, kludged because SQLite doesn't support per-command timeout values
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._designTimeVisible">
            <summary>
            Designer support
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._updateRowSource">
            <summary>
            Used by DbDataAdapter to determine updating behavior
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._parameterCollection">
            <summary>
            The collection of parameters for the command
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._statementList">
            <summary>
            The SQL command text, broken into individual SQL statements as they are executed
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._remainingText">
            <summary>
            Unprocessed SQL text that has not been executed
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteCommand._transaction">
            <summary>
            Transaction associated with this command
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.#ctor">
            <overloads>
             Constructs a new SQLiteCommand
             </overloads>
             <summary>
             Default constructor
             </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.#ctor(System.String)">
            <summary>
            Initializes the command with the given command text
            </summary>
            <param name="commandText">The SQL command text</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.#ctor(System.String,System.Data.SQLite.SQLiteConnection)">
            <summary>
            Initializes the command with the given SQL command text and attach the command to the specified
            connection.
            </summary>
            <param name="commandText">The SQL command text</param>
            <param name="connection">The connection to associate with the command</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.#ctor(System.Data.SQLite.SQLiteConnection)">
            <summary>
            Initializes the command and associates it with the specified connection.
            </summary>
            <param name="connection">The connection to associate with the command</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.#ctor(System.String,System.Data.SQLite.SQLiteConnection,System.Data.SQLite.SQLiteTransaction)">
            <summary>
            Initializes a command with the given SQL, connection and transaction
            </summary>
            <param name="commandText">The SQL command text</param>
            <param name="connection">The connection to associate with the command</param>
            <param name="transaction">The transaction the command should be associated with</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.Dispose(System.Boolean)">
            <summary>
            Disposes of the command and clears all member variables
            </summary>
            <param name="disposing">Whether or not the class is being explicitly or implicitly disposed</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.ClearCommands">
            <summary>
            Clears and destroys all statements currently prepared
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.BuildNextCommand">
            <summary>
            Builds an array of prepared statements for each complete SQL statement in the command text
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.Cancel">
            <summary>
            Not implemented
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.CreateDbParameter">
            <summary>
            Forwards to the local CreateParameter() function
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.CreateParameter">
            <summary>
            Create a new parameter
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.InitializeForReader">
            <summary>
            This function ensures there are no active readers, that we have a valid connection,
            that the connection is open, that all statements are prepared and all parameters are assigned
            in preparation for allocating a data reader.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.ExecuteDbDataReader(System.Data.CommandBehavior)">
            <summary>
            Creates a new SQLiteDataReader to execute/iterate the array of SQLite prepared statements
            </summary>
            <param name="behavior">The behavior the data reader should adopt</param>
            <returns>Returns a SQLiteDataReader object</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.ExecuteReader(System.Data.CommandBehavior)">
            <summary>
            Overrides the default behavior to return a SQLiteDataReader specialization class
            </summary>
            <param name="behavior">The flags to be associated with the reader</param>
            <returns>A SQLiteDataReader</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.ExecuteReader">
            <summary>
            Overrides the default behavior of DbDataReader to return a specialized SQLiteDataReader class
            </summary>
            <returns>A SQLiteDataReader</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.ClearDataReader">
            <summary>
            Called by the SQLiteDataReader when the data reader is closed.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.ExecuteNonQuery">
            <summary>
            Execute the command and return the number of rows inserted/updated affected by it.
            </summary>
            <returns></returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.ExecuteScalar">
            <summary>
            Execute the command and return the first column of the first row of the resultset
            (if present), or null if no resultset was returned.
            </summary>
            <returns>The first column of the first row of the first resultset from the query</returns>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.Prepare">
            <summary>
            Does nothing.  Commands are prepared as they are executed the first time, and kept in prepared state afterwards.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteCommand.Clone">
            <summary>
            Clones a command, including all its parameters
            </summary>
            <returns>A new SQLiteCommand with the same commandtext, connection and parameters</returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.CommandText">
            <summary>
            The SQL command text associated with the command
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.CommandTimeout">
            <summary>
            The amount of time to wait for the connection to become available before erroring out
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.CommandType">
            <summary>
            The type of the command.  SQLite only supports CommandType.Text
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.Connection">
            <summary>
            The connection associated with this command
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.DbConnection">
            <summary>
            Forwards to the local Connection property
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.Parameters">
            <summary>
            Returns the SQLiteParameterCollection for the given command
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.DbParameterCollection">
            <summary>
            Forwards to the local Parameters property
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.Transaction">
            <summary>
            The transaction associated with this command.  SQLite only supports one transaction per connection, so this property forwards to the
            command's underlying connection.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.DbTransaction">
            <summary>
            Forwards to the local Transaction property
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.UpdatedRowSource">
            <summary>
            Sets the method the SQLiteCommandBuilder uses to determine how to update inserted or updated rows in a DataTable.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteCommand.DesignTimeVisible">
            <summary>
            Determines if the command is visible at design time.  Defaults to True.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLiteFunctionAttribute">
            <summary>
            A simple custom attribute to enable us to easily find user-defined functions in
            the loaded assemblies and initialize them in SQLite as connections are made.
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteFunctionAttribute.#ctor">
            <summary>
            Default constructor, initializes the internal variables for the function.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteFunctionAttribute.Name">
            <summary>
            The function's name as it will be used in SQLite command text.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteFunctionAttribute.Arguments">
            <summary>
            The number of arguments this function expects.  -1 if the number of arguments is variable.
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteFunctionAttribute.FuncType">
            <summary>
            The type of function this implementation will be.
            </summary>
        </member>
        <member name="T:System.Data.SQLite.SQLite3">
            <summary>
            This class implements SQLiteBase completely, and is the guts of the code that interop's SQLite with .NET
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLite3._sql">
            <summary>
            The opaque pointer returned to us by the sqlite provider
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLite3._functionsArray">
            <summary>
            The user-defined functions registered on this connection
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLite3.GetValue(System.Data.SQLite.SQLiteStatement,System.Int32,System.Data.SQLite.SQLiteType)">
            <summary>
            Helper function to retrieve a column of data from an active statement.
            </summary>
            <param name="stmt">The statement being step()'d through</param>
            <param name="index">The column index to retrieve</param>
            <param name="typ">The type of data contained in the column.  If Uninitialized, this function will retrieve the datatype information.</param>
            <returns>Returns the data in the column</returns>
        </member>
        <member name="T:System.Data.SQLite.SQLite3_UTF16">
            <summary>
            Alternate SQLite3 object, overriding many text behaviors to support UTF-16 (Unicode)
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLite3_UTF16.ToString(System.IntPtr,System.Int32)">
            <summary>
            Overrides SQLiteConvert.ToString() to marshal UTF-16 strings instead of UTF-8
            </summary>
            <param name="b">A pointer to a UTF-16 string</param>
            <param name="nbytelen">The length (IN BYTES) of the string</param>
            <returns>A .NET string</returns>
        </member>
        <member name="T:System.Data.SQLite.SQLiteParameter">
            <summary>
            SQLite implementation of DbParameter.
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteParameter._dbType">
            <summary>
            The data type of the parameter
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteParameter._rowVersion">
            <summary>
            The version information for mapping the parameter
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteParameter._objValue">
            <summary>
            The value of the data in the parameter
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteParameter._sourceColumn">
            <summary>
            The source column for the parameter
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteParameter._parameterName">
            <summary>
            The column name
            </summary>
        </member>
        <member name="F:System.Data.SQLite.SQLiteParameter._dataSize">
            <summary>
            The data size, unused by SQLite
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor">
            <summary>
            Default constructor
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String)">
            <summary>
            Constructs a named parameter given the specified parameter name
            </summary>
            <param name="parameterName">The parameter name</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String,System.Object)">
            <summary>
            Constructs a named parameter given the specified parameter name and initial value
            </summary>
            <param name="parameterName">The parameter name</param>
            <param name="value">The initial value of the parameter</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String,System.Data.DbType)">
            <summary>
            Constructs a named parameter of the specified type
            </summary>
            <param name="parameterName">The parameter name</param>
            <param name="dbType">The datatype of the parameter</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String,System.Data.DbType,System.String)">
            <summary>
            Constructs a named parameter of the specified type and source column reference
            </summary>
            <param name="parameterName">The parameter name</param>
            <param name="dbType">The data type</param>
            <param name="sourceColumn">The source column</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String,System.Data.DbType,System.String,System.Data.DataRowVersion)">
            <summary>
            Constructs a named parameter of the specified type, source column and row version
            </summary>
            <param name="parameterName">The parameter name</param>
            <param name="dbType">The data type</param>
            <param name="sourceColumn">The source column</param>
            <param name="rowVersion">The row version information</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.Data.DbType)">
            <summary>
            Constructs an unnamed parameter of the specified data type
            </summary>
            <param name="dbType">The datatype of the parameter</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.Data.DbType,System.Object)">
            <summary>
            Constructs an unnamed parameter of the specified data type and sets the initial value
            </summary>
            <param name="dbType">The datatype of the parameter</param>
            <param name="value">The initial value of the parameter</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.Data.DbType,System.String)">
            <summary>
            Constructs an unnamed parameter of the specified data type and source column
            </summary>
            <param name="dbType">The datatype of the parameter</param>
            <param name="sourceColumn">The source column</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.Data.DbType,System.String,System.Data.DataRowVersion)">
            <summary>
            Constructs an unnamed parameter of the specified data type, source column and row version
            </summary>
            <param name="dbType">The data type</param>
            <param name="sourceColumn">The source column</param>
            <param name="rowVersion">The row version information</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String,System.Data.DbType,System.Int32)">
            <summary>
            Constructs a named parameter of the specified type and size
            </summary>
            <param name="parameterName">The parameter name</param>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the parameter</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String,System.Data.DbType,System.Int32,System.String)">
            <summary>
            Constructs a named parameter of the specified type, size and source column
            </summary>
            <param name="parameterName">The name of the parameter</param>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the parameter</param>
            <param name="sourceColumn">The source column</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String,System.Data.DbType,System.Int32,System.String,System.Data.DataRowVersion)">
            <summary>
            Constructs a named parameter of the specified type, size, source column and row version
            </summary>
            <param name="parameterName">The name of the parameter</param>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the parameter</param>
            <param name="sourceColumn">The source column</param>
            <param name="rowVersion">The row version information</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String,System.Data.DbType,System.Int32,System.Data.ParameterDirection,System.Boolean,System.Byte,System.Byte,System.String,System.Data.DataRowVersion,System.Object)">
            <summary>
            Constructs a named parameter of the specified type, size, source column and row version
            </summary>
            <param name="parameterName">The name of the parameter</param>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the parameter</param>
            <param name="direction">Only input parameters are supported in SQLite</param>
            <param name="isNullable">Ignored</param>
            <param name="precision">Ignored</param>
            <param name="scale">Ignored</param>
            <param name="sourceColumn">The source column</param>
            <param name="rowVersion">The row version information</param>
            <param name="value">The initial value to assign the parameter</param>   
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.String,System.Data.DbType,System.Int32,System.Data.ParameterDirection,System.Byte,System.Byte,System.String,System.Data.DataRowVersion,System.Boolean,System.Object)">
            <summary>
            Constructs a named parameter, yet another flavor
            </summary>
            <param name="parameterName">The name of the parameter</param>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the parameter</param>
            <param name="direction">Only input parameters are supported in SQLite</param>
            <param name="precision">Ignored</param>
            <param name="scale">Ignored</param>
            <param name="sourceColumn">The source column</param>
            <param name="rowVersion">The row version information</param>
            <param name="sourceColumnNullMapping">Whether or not this parameter is for comparing NULL's</param>
            <param name="value">The intial value to assign the parameter</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.Data.DbType,System.Int32)">
            <summary>
            Constructs an unnamed parameter of the specified type and size
            </summary>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the parameter</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.Data.DbType,System.Int32,System.String)">
            <summary>
            Constructs an unnamed parameter of the specified type, size, and source column
            </summary>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the parameter</param>
            <param name="sourceColumn">The source column</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.#ctor(System.Data.DbType,System.Int32,System.String,System.Data.DataRowVersion)">
            <summary>
            Constructs an unnamed parameter of the specified type, size, source column and row version
            </summary>
            <param name="parameterType">The data type</param>
            <param name="parameterSize">The size of the parameter</param>
            <param name="sourceColumn">The source column</param>
            <param name="rowVersion">The row version information</param>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.ResetDbType">
            <summary>
            Resets the DbType of the parameter so it can be inferred from the value
            </summary>
        </member>
        <member name="M:System.Data.SQLite.SQLiteParameter.Clone">
            <summary>
            Clones a parameter
            </summary>
            <returns>A new, unassociated SQLiteParameter</returns>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameter.IsNullable">
            <summary>
            Whether or not the parameter can contain a null value
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameter.DbType">
            <summary>
            Returns the datatype of the parameter
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameter.Direction">
            <summary>
            Supports only input parameters
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameter.ParameterName">
            <summary>
            Returns the parameter name
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameter.Size">
            <summary>
            Returns the size of the parameter
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameter.SourceColumn">
            <summary>
            Gets/sets the source column
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameter.SourceColumnNullMapping">
            <summary>
            Used by DbCommandBuilder to determine the mapping for nullable fields
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameter.SourceVersion">
            <summary>
            Gets and sets the row version
            </summary>
        </member>
        <member name="P:System.Data.SQLite.SQLiteParameter.Value">
            <summary>
            Gets and sets the parameter value.  If no datatype was specified, the datatype will assume the type from the value given.
            </summary>
        </member>
    </members>
</doc>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted bin/System.Data.SQLite.dll.

cannot compute difference between binary files

Deleted bin/System.Data.SQLite.lib.

cannot compute difference between binary files

Deleted bin/itanium/System.Data.SQLite.DLL.

cannot compute difference between binary files

Deleted bin/itanium/System.Data.SQLite.lib.

cannot compute difference between binary files

Deleted bin/linq/northwindEF.db.

cannot compute difference between binary files

Deleted bin/linq/testlinq.exe.

cannot compute difference between binary files

Deleted bin/linq/testlinq.exe.config.

1
2
3
4
5
6
7
8
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <connectionStrings>
    <add name="northwindEntities" connectionString="metadata=res://*/NorthwindModel.csdl|res://*/NorthwindModel.ssdl|res://*/NorthwindModel.msl;provider=System.Data.SQLite;provider connection string=&quot;data source=c:\src\sqlite.net\testlinq\northwind.db&quot;" providerName="System.Data.EntityClient" />
    <add name="northwindEntities1" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SQLite;provider connection string=&quot;data source=c:\src\sqlite.net\testlinq\northwind.db&quot;" providerName="System.Data.EntityClient" />
    <add name="northwindEFEntities" connectionString="metadata=res://*/NorthwindModel.csdl|res://*/NorthwindModel.ssdl|res://*/NorthwindModel.msl;provider=System.Data.SQLite;provider connection string=&quot;data source=C:\Src\SQLite.NET\testlinq\northwindEF.db&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>
<
<
<
<
<
<
<
<
















Deleted bin/test.exe.

cannot compute difference between binary files

Deleted bin/test.exe.config.

1
2
3
4
5
6
7
8
<configuration>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite"/>
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
    </DbProviderFactories>
  </system.data>
</configuration>
<
<
<
<
<
<
<
<
















Deleted bin/x64/System.Data.SQLite.DLL.

cannot compute difference between binary files

Deleted bin/x64/System.Data.SQLite.lib.

cannot compute difference between binary files

Added data/exclude_bin.txt.





































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
*.done
*.exp
*.ilk
*.json
*.json.*
*.lib
*.log
*.manifest
*.map
*.mda.config
*.netmodule
*.txt
*32.exe
*32.exe.config
*EntityFramework.*
*EnvDTE.*
*Microsoft.*
*Newtonsoft.*
*System.CodeDom.*
*System.ComponentModel.Annotations.*
*System.Configuration.ConfigurationManager.*
*System.Data.SqlClient.*
*System.Diagnostics.DiagnosticSource.*
*System.Drawing.Common.*
*System.Runtime.CompilerServices.Unsafe.*
*System.Security.AccessControl.*
*System.Security.Cryptography.ProtectedData.*
*System.Security.Permissions.*
*System.Security.Principal.Windows.*
*System.Text.Encoding.CodePages.*
*System.Windows.Extensions.*
*System.Threading*
*stdole.*
*sni.*

Added data/exclude_full_src.txt.









































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
*.cache
*.chw
*.docstates
*.fossil
*.mistachkin.eagle
*.ncb
*.nupkg
*.pdb
*.suo
*.user
*.zip
.fossil-settings/*
_FOSSIL_
bin/*
Doc/Output/*
Externals/Eagle/bin/net5/EntityFramework.*
Externals/Eagle/bin/net5/SQLite.Interop.*
Externals/Eagle/bin/net5/sqlite3.*
Externals/Eagle/bin/net5/System.*
Externals/Eagle/bin/net5/Win32/*
Externals/Eagle/bin/net5/x64/SQLite.Interop.*
Externals/Eagle/bin/net5/x86/SQLite.Interop.*
Externals/Eagle/bin/net6/EntityFramework.*
Externals/Eagle/bin/net6/SQLite.Interop.*
Externals/Eagle/bin/net6/sqlite3.*
Externals/Eagle/bin/net6/System.*
Externals/Eagle/bin/net6/Win32/*
Externals/Eagle/bin/net6/x64/SQLite.Interop.*
Externals/Eagle/bin/net6/x86/SQLite.Interop.*
Externals/Eagle/bin/netCore20/EntityFramework.*
Externals/Eagle/bin/netCore20/SQLite.Interop.*
Externals/Eagle/bin/netCore20/sqlite3.*
Externals/Eagle/bin/netCore20/System.*
Externals/Eagle/bin/netCore20/Win32/*
Externals/Eagle/bin/netCore20/x64/SQLite.Interop.*
Externals/Eagle/bin/netCore20/x86/SQLite.Interop.*
Externals/Eagle/bin/netCore30/EntityFramework.*
Externals/Eagle/bin/netCore30/SQLite.Interop.*
Externals/Eagle/bin/netCore30/sqlite3.*
Externals/Eagle/bin/netCore30/System.*
Externals/Eagle/bin/netCore30/Win32/*
Externals/Eagle/bin/netCore30/x64/SQLite.Interop.*
Externals/Eagle/bin/netCore30/x86/SQLite.Interop.*
Externals/Eagle/bin/netFramework40/EntityFramework.*
Externals/Eagle/bin/netFramework40/SQLite.Interop.*
Externals/Eagle/bin/netFramework40/sqlite3.*
Externals/Eagle/bin/netFramework40/System.*
Externals/Eagle/bin/netFramework40/Win32/*
Externals/Eagle/bin/netFramework40/x64/SQLite.Interop.*
Externals/Eagle/bin/netFramework40/x86/SQLite.Interop.*
Externals/EntityFramework/*
Externals/HtmlHelp/*
Externals/MSVCPP/*
Externals/NDoc3/*
obj/*
Setup/Output/*
Setup/set_user_*.bat
SQLite.Designer/obj/*
SQLite.Designer/Properties/*
SQLite.Designer/VSDesign/*
System.Data.SQLite.Linq/obj/*
System.Data.SQLite/obj/*
System.Data.SQLite/Properties/*
test/obj/*
testce/obj/*
testlinq/obj/*
tools/install/obj/*
www/*

Added data/exclude_src.txt.

























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
*.cache
*.chw
*.docstates
*.fossil
*.mistachkin.eagle
*.ncb
*.nupkg
*.pdb
*.suo
*.user
*.zip
.fossil-settings/*
_FOSSIL_
bin/*
Doc/Output/*
Externals/Eagle/bin/net5/*
Externals/Eagle/bin/net6/*
Externals/Eagle/bin/netCore20/*
Externals/Eagle/bin/netCore30/*
Externals/Eagle/bin/netFramework20/Eagle.dll
Externals/Eagle/bin/netFramework20/EagleShell.exe
Externals/Eagle/bin/netFramework20/EagleShell.exe.mda.config
Externals/Eagle/bin/netFramework20/EagleShell32.exe
Externals/Eagle/bin/netFramework20/EntityFramework.*
Externals/Eagle/bin/netFramework20/SQLite.Interop.*
Externals/Eagle/bin/netFramework20/sqlite3.*
Externals/Eagle/bin/netFramework20/System.*
Externals/Eagle/bin/netFramework20/Win32/*
Externals/Eagle/bin/netFramework20/x64/*
Externals/Eagle/bin/netFramework20/x86/*
Externals/Eagle/bin/netFramework40/Eagle.dll
Externals/Eagle/bin/netFramework40/EagleShell.exe
Externals/Eagle/bin/netFramework40/EagleShell.exe.mda.config
Externals/Eagle/bin/netFramework40/EagleShell32.exe
Externals/Eagle/bin/netFramework40/EntityFramework.*
Externals/Eagle/bin/netFramework40/SQLite.Interop.*
Externals/Eagle/bin/netFramework40/sqlite3.*
Externals/Eagle/bin/netFramework40/System.*
Externals/Eagle/bin/netFramework40/Win32/*
Externals/Eagle/bin/netFramework40/x64/*
Externals/Eagle/bin/netFramework40/x86/*
Externals/Eagle/lib/Eagle1.0/auxiliary.eagle
Externals/Eagle/lib/Eagle1.0/compat.eagle
Externals/Eagle/lib/Eagle1.0/csharp.eagle
Externals/Eagle/lib/Eagle1.0/database.eagle
Externals/Eagle/lib/Eagle1.0/embed.eagle
Externals/Eagle/lib/Eagle1.0/exec.eagle
Externals/Eagle/lib/Eagle1.0/file1.eagle
Externals/Eagle/lib/Eagle1.0/file2.eagle
Externals/Eagle/lib/Eagle1.0/file3.eagle
Externals/Eagle/lib/Eagle1.0/info.eagle
Externals/Eagle/lib/Eagle1.0/init.eagle
Externals/Eagle/lib/Eagle1.0/list.eagle
Externals/Eagle/lib/Eagle1.0/object.eagle
Externals/Eagle/lib/Eagle1.0/pkgIndex.eagle
Externals/Eagle/lib/Eagle1.0/pkgIndex.tcl
Externals/Eagle/lib/Eagle1.0/pkgt.eagle
Externals/Eagle/lib/Eagle1.0/platform.eagle
Externals/Eagle/lib/Eagle1.0/process.eagle
Externals/Eagle/lib/Eagle1.0/runopt.eagle
Externals/Eagle/lib/Eagle1.0/safe.eagle
Externals/Eagle/lib/Eagle1.0/shell.eagle
Externals/Eagle/lib/Eagle1.0/shim.eagle
Externals/Eagle/lib/Eagle1.0/test.eagle
Externals/Eagle/lib/Eagle1.0/testlog.eagle
Externals/Eagle/lib/Eagle1.0/unkobj.eagle
Externals/Eagle/lib/Eagle1.0/unzip.eagle
Externals/Eagle/lib/Eagle1.0/update.eagle
Externals/Eagle/lib/Eagle1.0/word.tcl
Externals/Eagle/lib/Test1.0/*
Externals/Eagle/Targets/*
Externals/EntityFramework/*
Externals/HtmlHelp/*
Externals/MSVCPP/*
Externals/NDoc3/*
Externals/NuGet/*
Externals/ResGen/*
Externals/vswhere/*
obj/*
Setup/Output/*
Setup/set_user_*.bat
SQLite.Designer/obj/*
SQLite.Designer/Properties/*
SQLite.Designer/VSDesign/*
System.Data.SQLite.Linq/obj/*
System.Data.SQLite/obj/*
System.Data.SQLite/Properties/*
test/obj/*
testce/obj/*
testlinq/obj/*
tools/install/obj/*
www/*

Added lib/System.Data.SQLite/common.eagle.



































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
###############################################################################
#
# common.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

#
# NOTE: Use our own namespace here because even though we do not directly
#       support namespaces ourselves, we do not want to pollute the global
#       namespace if this script actually ends up being evaluated in Tcl.
#
namespace eval ::Eagle {
  if {[isEagle]} then {
    ###########################################################################
    ############################ BEGIN Eagle ONLY #############################
    ###########################################################################

    proc getSQLiteDefineConstantPrefix {} {
      #
      # NOTE: See if the define constant prefix setting has been overridden
      #       by the user (e.g. on the command line).
      #
      if {[info exists ::define_constant_prefix] && \
          [string length $::define_constant_prefix] > 0} then {
        #
        # NOTE: Use the specified define constant prefix.
        #
        return $::define_constant_prefix
      } else {
        #
        # NOTE: Use the default define constant prefix.
        #
        return defineConstant.System.Data.SQLite.
      }
    }

    proc getSQLiteCompileOptionPrefix {} {
      #
      # NOTE: See if the compile option prefix setting has been overridden
      #       by the user (e.g. on the command line).
      #
      if {[info exists ::compile_option_prefix] && \
          [string length $::compile_option_prefix] > 0} then {
        #
        # NOTE: Use the specified compile option prefix.
        #
        return $::compile_option_prefix
      } else {
        #
        # NOTE: Use the default compile option prefix.
        #
        return compileOption.SQLite.
      }
    }

    proc haveSQLiteDefineConstant { name } {
      return [haveConstraint \
          [appendArgs [getSQLiteDefineConstantPrefix] $name]]
    }

    proc haveSQLiteCompileOption { name } {
      return [haveConstraint \
          [appendArgs [getSQLiteCompileOptionPrefix] $name]]
    }

    proc getBuildNative {} {
      #
      # NOTE: Check if we are being forced to treat this as a native build.
      #       This is normally done (automatically) only when the mixed-mode
      #       assembly is in use; however, in some circumstances it is useful
      #       to force this behavior.
      #
      if {[info exists ::test_native] && \
          [string is boolean -strict $::test_native]} then {
        return $::test_native
      } else {
        return false
      }
    }

    proc getBuildYear {} {
      #
      # NOTE: See if the "year" setting has been overridden by the user (e.g.
      #       on the command line).  This helps control exactly which set of
      #       binaries we are testing, those produced using the Visual Studio
      #       2005, 2008, 2010, 2012, 2013, 2015, or 2017 build systems.  To
      #       override this value via the command line, enter a command similar
      #       to one of the following (all on one line):
      #
      #       EagleShell.exe -anyInitialize "set test_year 2005"
      #         -file .\path\to\all.eagle
      #
      #       EagleShell.exe -anyInitialize "set test_year 2008"
      #         -file .\path\to\all.eagle
      #
      #       EagleShell.exe -anyInitialize "set test_year 2010"
      #         -file .\path\to\all.eagle
      #
      #       EagleShell.exe -anyInitialize "set test_year 2012"
      #         -file .\path\to\all.eagle
      #
      #       EagleShell.exe -anyInitialize "set test_year 2013"
      #         -file .\path\to\all.eagle
      #
      #       EagleShell.exe -anyInitialize "set test_year 2015"
      #         -file .\path\to\all.eagle
      #
      #       EagleShell.exe -anyInitialize "set test_year 2017"
      #         -file .\path\to\all.eagle
      #
      #       EagleShell.exe -anyInitialize "unset -nocomplain test_year"
      #         -file .\path\to\all.eagle
      #
      if {[info exists ::test_year] && [string length $::test_year] > 0} then {
        #
        # NOTE: Use the specified test year.  If this variable is not set, the
        #       default value will be based on whether or not Eagle has been
        #       compiled against the CLR v2.0 or CLR v4.0.
        #
        return $::test_year
      } else {
        #
        # NOTE: If Eagle has been compiled against the CLR v4.0, use "2010" by
        #       default (we could use "2012", "2013", "2015", or "2017" in that
        #       case as well) as the test year; otherwise, use "2008" by default
        #       (we could use "2005" in that case as well).  If another major
        #       [incompatible] version of the CLR is released, this check will
        #       have to be changed.  The default test year to use for a
        #       particular CLR version may be overridden by setting the global
        #       variable "test_year_clr_v$X", where "$X" may [currently] be
        #       either "2" or "4".
        #
        if {[haveConstraint imageRuntime40]} then {
          if {[info exists ::test_year_clr_v4] && \
              [string length $::test_year_clr_v4] > 0} then {
            #
            # NOTE: Use the specified test year for the CLR v4.0.
            #
            return $::test_year_clr_v4
          } else {
            #
            # NOTE: Use the default test year for the CLR v4.0.
            #
            return 2010; # TODO: Good "fallback" default?
          }
        } else {
          if {[info exists ::test_year_clr_v2] && \
              [string length $::test_year_clr_v2] > 0} then {
            #
            # NOTE: Use the specified test year for the CLR v2.0.
            #
            return $::test_year_clr_v2
          } else {
            #
            # NOTE: Use the default test year for the CLR v2.0.
            #
            return 2008; # TODO: Good "fallback" default?
          }
        }
      }
    }

    proc getBuildNativeYear {} {
      if {[info exists ::test_native_year] && \
          [string length $::test_native_year] > 0} then {
        #
        # NOTE: Use the specified test year for native binaries.  If this
        #       variable is not set, the value returned by [getBuildYear]
        #       will be used.
        #
        return $::test_native_year
      } else {
        #
        # NOTE: Fallback on the (normal) build year for managed binaries.
        #
        return [getBuildYear]
      }
    }

    proc getBuildNativeYearForDotNetCore { year } {
      if {[isDotNetCore] && [isWindows]} then {
        return 2015; # HACK: Special case, use 2015 native binaries.
      } elseif {[string length $year] > 0} then {
        return $year
      } else {
        return [getBuildNativeYear]
      }
    }

    proc getBuildYears {} {
      #
      # NOTE: See if the list of test years has been overridden by the user
      #       (e.g. on the command line).
      #
      if {[info exists ::test_years] && [llength $::test_years] > 0} then {
        #
        # NOTE: Use the specified list of test years.
        #
        return $::test_years
      } elseif {[isDotNetCore]} then {
        #
        # NOTE: Running on .NET Core, prioritize its list of test years.
        #
        return [list NetStandard20 NetStandard21]
      } else {
        #
        # NOTE: Use the default list of test years (i.e. all).
        #
        return [list \
            2005 2008 2010 2012 2013 2015 2017 NetStandard20 NetStandard21]
      }
    }

    #
    # NOTE: This procedure is only used when adding shimmed test constraints.
    #
    proc getBuildClrVersion {} {
      if {[info exists ::test_clr] && [string length $::test_clr] > 0} then {
        #
        # NOTE: Use the specified test version for the CLR.  If this variable
        #       is not set, the default value will be based on whether or not
        #       Eagle has been compiled against the CLR v2.0 or CLR v4.0.
        #
        return $::test_clr
      } else {
        #
        # NOTE: Check if Eagle has been compiled against the CLR v4.0.  If so,
        #       just use that CLR version.  Otherwise, use the version for the
        #       CLR v2.0.  If another major [incompatible] version of the CLR
        #       is released, this check will have to be changed.  The default
        #       version value for a particular CLR version may be overridden
        #       by setting the global variable "test_clr_v$X", where "$X" may
        #       [currently] be either "2" or "4".
        #
        if {[haveConstraint imageRuntime40]} then {
          if {[info exists ::test_clr_v4] && \
              [string length $::test_clr_v4] > 0} then {
            #
            # NOTE: Use the specified test version for the CLR v4.0.
            #
            return $::test_clr_v4
          } else {
            #
            # NOTE: Use the default test version for the CLR v4.0.
            #
            return 4.0.30319; # TODO: Good "fallback" default?
          }
        } else {
          if {[info exists ::test_clr_v2] && \
              [string length $::test_clr_v2] > 0} then {
            #
            # NOTE: Use the specified test version for the CLR v2.0.
            #
            return $::test_clr_v2
          } else {
            #
            # NOTE: Use the default test version for the CLR v2.0.
            #
            return 2.0.50727; # TODO: Good "fallback" default?
          }
        }
      }
    }

    proc getBuildNetFx {} {
      #
      # NOTE: See if the test .NET Framework setting has been overridden by
      #       the user (e.g. on the command line).
      #
      if {[info exists ::test_net_fx] && \
          [string length $::test_net_fx] > 0} then {
        #
        # NOTE: Use the specified test .NET Framework.
        #
        return $::test_net_fx
      } else {
        set year [getBuildYear]
        set yearVarName [appendArgs ::test_net_fx_ $year]

        if {[info exists $yearVarName] && \
            [string length [set $yearVarName]] > 0} then {
          #
          # NOTE: Use the specified test .NET Framework, based on the build
          #       year.
          #
          return [set $yearVarName]
        } else {
          #
          # NOTE: Fallback to the "well known" .NET Framework version that
          #       is most closely associated with a particular version of
          #       Visual Studio.
          #
          switch -exact -- $year {
            2005 {
              return netFx20
            }
            2008 {
              return netFx35
            }
            2010 {
              return netFx40
            }
            2012 {
              return netFx45
            }
            2013 {
              return netFx451; # TODO: Or "netFx452"?
            }
            2015 {
              return netFx46; # TODO: Or "netFx461" / "netFx462"?
            }
            2017 {
              return netFx47; # TODO: Or "netFx471" / "netFx472" / "netFx48"?
            }
            NetStandard20 {
              return netStandard20
            }
            NetStandard21 {
              return netStandard21
            }
            default {
              return netFx35; # TODO: Good "fallback" default?
            }
          }
        }
      }
    }

    #
    # NOTE: This procedure should return non-zero if the configured test
    #       platform is most likely the default for this machine.
    #
    proc isDefaultBuildPlatform { {verbose true} } {
      #
      # NOTE: Running on WoW64 is never the default platform.
      #
      if {[isRunningWoW64]} then {
        if {$verbose} then {
          tputs $::test_channel \
              "---- detected non-default platform (WoW64)\n"
        }

        return false
      }

      #
      # NOTE: This has a good chance of being the default platform.
      #
      if {$verbose} then {
        tputs $::test_channel "---- detected default platform\n"
      }

      return true
    }

    proc getBuildPlatform { native } {
      if {[info exists ::test_platform] && \
          [string length $::test_platform] > 0} then {
        #
        # NOTE: Possibly use the specified test platform.  If this variable
        #       is not set, the default value will be based on the machine
        #       architecture.  Normally, this is done for builds that involve
        #       the mixed-mode assembly.
        #
        return [expr {$native ? $::test_platform : ""}]
      } elseif {[info exists ::test_machine] && \
          [string length $::test_machine] > 0} then {
        #
        # NOTE: For native builds, return the platform name corresponding to
        #       the test machine architecture; otherwise, return an empty
        #       string.  Normally, this is done for builds that involve the
        #       mixed-mode assembly.
        #
        return [expr {
          $native ? [machineToPlatform $::test_machine] : ""
        }]
      } elseif {[info exists ::tcl_platform(machine)]} then {
        #
        # NOTE: For native builds, return the platform name corresponding to
        #       the machine architecture; otherwise, return an empty string.
        #       Normally, this is done for builds that involve the mixed-mode
        #       assembly.
        #
        return [expr {
          $native ? [machineToPlatform $::tcl_platform(machine)] : ""
        }]
      } else {
        #
        # NOTE: No machine architecture is available, return an empty string.
        #       It is important to return an empty string here because the
        #       result of this procedure may be used with [file join].
        #
        return ""
      }
    }

    proc getBuildConfiguration {} {
      #
      # NOTE: See if the "configuration" setting has been overridden by the
      #       user (e.g. on the command line).  This helps control exactly
      #       which set of binaries we are testing (i.e. those built in the
      #       "Debug" or "Release" build configurations).  To override this
      #       value via the command line, enter a command similar to one of
      #       the following (all on one line):
      #
      #       EagleShell.exe -anyInitialize "set test_configuration Debug"
      #         -file .\path\to\all.eagle
      #
      #       EagleShell.exe -anyInitialize "set test_configuration Release"
      #         -file .\path\to\all.eagle
      #
      #       EagleShell.exe -file .\path\to\all.eagle -preTest
      #         "unset -nocomplain test_configuration"
      #
      if {[info exists ::test_configuration] && \
          [string length $::test_configuration] > 0} then {
        #
        # NOTE: Use the specified test configuration.  The default value used
        #       for this variable is typically "Release", as set by the test
        #       suite itself.
        #
        return $::test_configuration
      } else {
        #
        # NOTE: Normally, we will never hit this case because the value of the
        #       test configuration variable is always set by the test suite
        #       itself; however, it can be overridden using the unset command
        #       from the -preTest option to the test suite.
        #
        return $::eagle_platform(configuration)
      }
    }

    proc getBuildConfigurations {} {
      #
      # NOTE: See if the list of test configurations has been overridden by
      #       the user (e.g. on the command line).
      #
      if {[info exists ::test_configurations] && \
          [llength $::test_configurations] > 0} then {
        #
        # NOTE: Use the specified list of test configurations.
        #
        return $::test_configurations
      } else {
        #
        # NOTE: Use the default list of test configurations.
        #
        return [list Debug Release]
      }
    }

    proc getBuildConfigurationSuffix {} {
      #
      # NOTE: See if the test configuration suffix has been overridden by
      #       the user (e.g. on the command line).
      #
      if {[info exists ::test_configuration_suffix] && \
          [string length $::test_configuration_suffix] > 0} then {
        #
        # NOTE: Use the specified test configuration suffix.
        #
        return $::test_configuration_suffix
      } else {
        #
        # NOTE: Use the default test configuration suffix, which should be
        #       an empty string.
        #
        return ""
      }
    }

    proc getBuildNativeConfigurationSuffix {} {
      #
      # NOTE: See if the test native configuration suffix has been
      #       overridden by the user (e.g. on the command line).
      #
      if {[info exists ::test_native_configuration_suffix] && \
          [string length $::test_native_configuration_suffix] > 0} then {
        #
        # NOTE: Use the specified test native configuration suffix.
        #
        return $::test_native_configuration_suffix
      } else {
        #
        # NOTE: Use the default test native configuration suffix, which
        #       should be an empty string.
        #
        return ""
      }
    }

    proc getBuildNativeConfigurationSuffixForDotNetCore { suffix } {
      if {[isDotNetCore] && [isWindows]} then {
        return NativeOnly; # HACK: Special case, use 2015 native binaries.
      } elseif {[string length $suffix] > 0} then {
        return $suffix
      } else {
        return [getBuildNativeConfigurationSuffix]
      }
    }

    proc getBuildNativeExtraForDotNetCore { extra } {
      if {[isDotNetCore] && [isWindows]} then {
        return ""
      } elseif {[string length $extra] > 0} then {
        return $extra
      } else {
        return [getBuildNativeExtra]
      }
    }

    proc getBuildConfigurationSuffixes {} {
      #
      # NOTE: See if the list of test configuration suffixes has been
      #       overridden by the user (e.g. on the command line).
      #
      if {[info exists ::test_configuration_suffixes] && \
          [llength $::test_configuration_suffixes] > 0} then {
        #
        # NOTE: Use the specified list of test configurations suffixes.
        #
        return $::test_configuration_suffixes
      } elseif {[isDotNetCore]} then {
        #
        # NOTE: Running on .NET Core, prioritize its test configuration
        #       suffixes for library files.
        #
        return [list NetStandard20 NetStandard21 ""]
      } else {
        #
        # NOTE: Use the default list of test configurations suffixes.
        #
        return [list ""]
      }
    }

    proc getBuildExtra {} {
      if {[info exists ::test_extra] && \
          [string length $::test_extra] > 0} then {
        #
        # NOTE: Use the specified extra output directory.
        #
        return $::test_extra
      } elseif {[isDotNetCore]} then {
        #
        # NOTE: Running on .NET Core, use the extra output directory for
        #       (managed) library files.
        #
        if {[info exists ::eagle_platform(targetFramework)]} then {
          switch -exact -- $::eagle_platform(targetFramework) {
            .NETStandard,Version=v2.0 {
              return netstandard2.0
            }
            .NETStandard,Version=v2.1 {
              return netstandard2.1
            }
          }
        }

        return netstandard2.0; # TODO: Good "fallback" default?
      } else {
        #
        # NOTE: No extra output directory is required.
        #
        return ""
      }
    }

    proc getBuildExtras {} {
      #
      # NOTE: See if the list of extra output directories has been overridden
      #       by the user (e.g. on the command line).
      #
      if {[info exists ::test_extras] && \
          [llength $::test_extras] > 0} then {
        #
        # NOTE: Use the specified list of extra output directories.
        #
        return $::test_extras
      } elseif {[isDotNetCore]} then {
        #
        # NOTE: Running on .NET Core, prioritize its extra output directory
        #       for library files.
        #
        return [list netstandard2.0 netstandard2.1 ""]
      } else {
        #
        # NOTE: Use default list of extra output directories, which is one
        #       empty string (no-op).
        #
        return [list ""]
      }
    }

    proc getBuildNativeExtra {} {
      if {[info exists ::test_native_extra] && \
          [string length $::test_native_extra] > 0} then {
        #
        # NOTE: Use the specified native extra output directory.
        #
        return $::test_native_extra
      } else {
        #
        # NOTE: No native extra output directory is required.
        #
        return ""
      }
    }

    proc getBuildNativeExtras {} {
      if {[info exists ::test_native_extras] && \
          [llength $::test_native_extras] > 0} then {
        #
        # NOTE: Use the specified list of native extra output directories.
        #
        return $::test_native_extras
      } else {
        #
        # NOTE: Use default list of native extra output directories, which
        #       is none.
        #
        return [list]
      }
    }

    proc getBuildBaseDirectory {} {
      #
      # NOTE: Figure out the base directory where all the builds should be
      #       located.  This will be the directory that contains the actual
      #       build output directory (e.g. parent of "bin").
      #
      if {[info exists ::build_base_directory] && \
          [string length $::build_base_directory] > 0} then {
        #
        # NOTE: The location of the build base directory has been overridden;
        #       therefore, use it verbatim.
        #
        return $::build_base_directory
      } elseif {[info exists ::common_directory] && \
          [string length $::common_directory] > 0} then {
        #
        # NOTE: Next, fallback to the grandparent directory of the one
        #       containing this file (i.e. "common.eagle"), if available.
        #
        return [file dirname [file dirname $::common_directory]]
      } elseif {[info exists ::path] && \
          [string length $::path] > 0} then {
        #
        # NOTE: Finally, fallback to the parent directory of the EagleTest
        #       path.  The EagleTest package guarantees that this variable
        #       will be set to the directory containing the first file to
        #       execute the [runTestPrologue] script library procedure.
        #
        return [file dirname $::path]
      } else {
        #
        # NOTE: No path is available, return an empty string.  This point
        #       should not be reached.
        #
        return ""
      }
    }

    proc getSQLiteTestDataPath {} {
      #
      # NOTE: Figure out the directory where all the test data files should
      #       be located.  This should be the "data" directory beneath the
      #       directory containing the actual test scripts.
      #
      return [file join $::path data]
    }

    proc isRunningWoW64 {} {
      #
      # NOTE: For now, just use the existing test constraint for detecting
      #       a WoW64 process.
      #
      return [haveConstraint wow64]
    }

    proc isMixedModeAssembly { fileName {varName ""} } {
      #
      # NOTE: First, make sure the test suite infrastructure is allowed to
      #       use the [exec] command.
      #
      if {![info exists ::no(exec)] && ![info exists ::no(corFlags)]} then {
        #
        # NOTE: If the location of CorFlags is present in the environment,
        #       use it; otherwise assume it is in the PATH.
        #
        set corFlags [expr {
          [info exists ::env(CorFlags)] ? $::env(CorFlags) : "CorFlags"
        }]

        #
        # NOTE: Attempt to execute CorFlags on the specified file.
        #
        if {[catch {
          exec -- $corFlags [file nativename $fileName]
        } exec] == 0} then {
          #
          # NOTE: If requested by our caller, attempt to determine the
          #       platform for the specified file as well.
          #
          if {[string length $varName] > 0} then {
            #
            # NOTE: Store the platform in the named variable in the
            #       context of our caller.
            #
            upvar 1 $varName platform

            #
            # NOTE: Attempt to extract the PE line from the captured
            #       output.  If this value is "PE32" or "PE32+", the
            #       assembly file is 32-bit or 64-bit, respectively;
            #       otherwise, its type is unknown.
            #
            set pattern {^PE        : (PE32|PE32\+)\s+$}

            if {[regexp -line -- $pattern $exec dummy pe32]} then {
              #
              # HACK: This [switch] assumes that 32-bit executables are
              #       always x86 and that 64-bit executables are always
              #       x64.
              #
              switch -exact -- $pe32 {
                PE32 {
                  set platform Win32
                }
                PE32+ {
                  set platform x64
                }
                default {
                  set platform ""
                }
              }
            } else {
              set platform ""
            }
          }

          #
          # NOTE: Attempt to extract the ILONLY line from the captured
          #       output.  If this value is zero, the specified file must
          #       be a mixed-mode assembly; otherwise, it contains only
          #       managed components.
          #
          set pattern {^ILONLY    : (0|1)\s+$}

          if {![regexp -line -- $pattern $exec dummy ilOnly]} then {
            return false
          }

          if {!$ilOnly} then {
            return true
          }
        }
      }

      #
      # NOTE: If the test suite cannot use [exec] or execution of CorFlags
      #       failed, return false.
      #
      return false
    }

    proc isDarwin {} {
      return [expr {
        [info exists ::tcl_platform(os)] && $::tcl_platform(os) eq "Darwin"
      }]
    }

    proc getNativeLibraryFileNamesOnly {} {
      #
      # NOTE: First, check if the list of native library file names has been
      #       manually overridden.
      #
      if {[info exists ::native_library_file_names] && \
          [llength $::native_library_file_names] > 0} then {
        #
        # NOTE: The list of native library file names has been overridden;
        #       therefore, use it verbatim.
        #
        return $::native_library_file_names
      } elseif {[isWindows]} then {
        #
        # NOTE: Otherwise, on Win32, always use the standard native library
        #       file name "sqlite3.dll".
        #
        return [list sqlite3.dll]
      } elseif {[isDotNetCore]} then {
        #
        #       When running on .NET Core, return the same native library
        #       file name that is used on Windows (i.e. otherwise, assume
        #       we are running on Mono and use its P/Invoke conventions).
        #
        return [list sqlite3.dll]
      } elseif {[isDarwin]} then {
        #
        # NOTE: When running on Darwin (i.e. the kernel of iOS / Mac OS X),
        #       return the Mac OS X native library file name.  This file
        #       name is normally required for Mono.
        #
        return [list libsqlite3.dylib]
      } else {
        #
        # NOTE: Otherwise, return the generic POSIX native library file
        #       name.  This file name is normally required for Mono.
        #
        return [list libsqlite3.so]
      }
    }

    proc getInteropAssemblyFileNamesOnly {} {
      #
      # NOTE: First, check if the list of interop assembly file names has been
      #       manually overridden.
      #
      if {[info exists ::interop_assembly_file_names] && \
          [llength $::interop_assembly_file_names] > 0} then {
        #
        # NOTE: The list of interop assembly file names has been overridden;
        #       therefore, use it verbatim.
        #
        return $::interop_assembly_file_names
      } elseif {[isWindows]} then {
        #
        # NOTE: Otherwise, on Win32, always use the interop assembly file
        #       name "SQLite.Interop.dll".
        #
        return [list SQLite.Interop.dll]
      } elseif {[isDotNetCore]} then {
        #
        #       When running on .NET Core, return the same interp assembly
        #       file name that is used on Windows (i.e. otherwise, assume
        #       we are running on Mono and use its P/Invoke conventions).
        #
        return [list SQLite.Interop.dll]
      } elseif {[isDarwin]} then {
        #
        # NOTE: When running on Darwin (i.e. the kernel of iOS / Mac OS X),
        #       return the Mac OS X interp assembly file name.  This file
        #       name is normally required for Mono.
        #
        return [list libSQLite.Interop.dylib]
      } else {
        #
        # NOTE: Otherwise, return the generic POSIX interp assembly file
        #       name.  This file name is normally required for Mono.
        #
        return [list libSQLite.Interop.so]
      }
    }

    proc getCoreExtensionBinaryFileName { {default ""} } {
      set fileName [getCoreBinaryFileName]

      if {[file exists $fileName]} then {
        return $fileName
      }

      return $default
    }

    proc isBuildAvailable { native skipNative directory {varName ""} } {
      #
      # NOTE: Build the fully qualified file name for the primary assembly
      #       containing the System.Data.SQLite managed components.  It
      #       should be noted that this assembly file may also contain the
      #       native components, if a native build is in use.
      #
      set fileName [file nativename [file join $directory \
          System.Data.SQLite.dll]]

      if {![file exists $fileName]} then {
        return false
      }

      #
      # NOTE: If we are skipping looking for the native components, stop
      #       now.
      #
      if {$skipNative} then {
        return true
      }

      #
      # NOTE: Attempt to automatically detect if the primary assembly
      #       contains any native components, if necessary.
      #
      if {[string length $native] == 0} then {
        if {[string length $varName] > 0} then {
          upvar 1 $varName $varName
        }

        set native [isMixedModeAssembly $fileName $varName]
      }

      #
      # NOTE: If the primary assembly also contains the native components,
      #       we have everything we need.
      #
      if {$native} then {
        return true
      }

      #
      # NOTE: If the machine name is unavailable, there is nothing else we
      #       can do.
      #
      if {![info exists ::tcl_platform(machine)]} then {
        return false
      }

      #
      # NOTE: What is the architecture for this machine?
      #
      set architecture [machineToPlatform $::tcl_platform(machine) true]

      #
      # NOTE: What is the platform for this machine?
      #
      set platform [machineToPlatform $::tcl_platform(machine)]

      #
      # NOTE: Build the fully qualified file name for the interop assembly
      #       containing the System.Data.SQLite native components.  If this
      #       file exists, we should have everything we need.
      #
      foreach fileNameOnly [getInteropAssemblyFileNamesOnly] {
        set fileName [file nativename [file join $directory \
            $architecture $fileNameOnly]]

        if {[file exists $fileName]} then {
          return true
        }

        set fileName [file nativename [file join $directory \
            $platform $fileNameOnly]]

        if {[file exists $fileName]} then {
          return true
        }

        set fileName [file nativename [file join $directory \
            $fileNameOnly]]

        if {[file exists $fileName]} then {
          return true
        }
      }

      #
      # NOTE: Build the fully qualified file name for the SQLite core
      #       library.  If this file exists, we should have everything we
      #       need.
      #
      foreach fileNameOnly [getNativeLibraryFileNamesOnly] {
        set fileName [file nativename [file join $directory \
            $architecture $fileNameOnly]]

        if {[file exists $fileName]} then {
          return true
        }

        set fileName [file nativename [file join $directory \
            $platform $fileNameOnly]]

        if {[file exists $fileName]} then {
          return true
        }

        set fileName [file nativename [file join $directory \
            $fileNameOnly]]

        if {[file exists $fileName]} then {
          return true
        }
      }

      #
      # NOTE: One or more native components needed by System.Data.SQLite
      #       are missing.
      #
      return false
    }

    proc isReleaseAvailable { directory {varName ""} } {
      if {[string length $varName] > 0} then {
        upvar 1 $varName $varName
      }

      return [isBuildAvailable "" false $directory $varName]
    }

    proc joinBuildDirectory { native path year platform configuration extra } {
      #
      # NOTE: Figure out and then return the fully qualified path to the build
      #       directory based on all the arguments provided by our caller.
      #
      if {$native} then {
        return [file join $path bin $year $platform $configuration $extra]
      } else {
        return [file join $path bin $year $configuration bin $extra]
      }
    }

    proc getBuildDirectory { managedOnly } {
      #
      # NOTE: See if the "native" runtime option has been set.  If so, use the
      #       directory for the mixed-mode assembly (a.k.a. the native interop
      #       assembly).  To enable this option via the command line, enter a
      #       command similar to one of the following (all on one line):
      #
      #       EagleShell.exe -initialize -runtimeOption native
      #         -file .\path\to\all.eagle
      #
      #       To enable this option via the command line prior to the "beta 16"
      #       release of Eagle, the following command must be used instead
      #       (also all on one line):
      #
      #       EagleShell.exe -initialize -postInitialize
      #         "object invoke Interpreter.GetActive AddRuntimeOption native"
      #         -file .\path\to\all.eagle
      #
      if {[info exists ::build_directory] && \
          [string length $::build_directory] > 0} then {
        #
        # NOTE: The location of the build directory has been overridden;
        #       therefore, use it verbatim.
        #
        return $::build_directory
      } else {
        #
        # NOTE: If the "native" runtime option is set, the mixed-mode assembly
        #       is being tested.  In that case, the path to the build directory
        #       will contain the platform name and all the binaries under test
        #       should be present in that directory.  If the "native" runtime
        #       option is not set, the build directory will be considered to be
        #       "platform-neutral", with the notable exception of any native
        #       assembly (e.g. "SQLite.Interop.dll") copied there during the
        #       build process itself.  If the build process somehow does not
        #       copy the native assembly for this platform, most of the tests
        #       in the suite will simply be skipped.  Generally speaking, there
        #       are two ways to build the binaries when preparing to run the
        #       test suite:
        #
        #       1. Build the separate managed and native assemblies using some
        #          commands similar to:
        #
        #          CALL build.bat ${Configuration}ManagedOnly ${Platform}
        #          CALL build.bat ${Configuration}NativeOnly ${Platform}
        #
        #          Where ${Configuration} is either "Debug" or "Release" and
        #          ${Platform} is either "Win32" or "x64".
        #
        #       2. Build the mixed-mode assembly using a command similar to:
        #
        #          CALL build.bat ${Configuration} ${Platform}
        #
        #          Where ${Configuration} is either "Debug" or "Release" and
        #          ${Platform} is either "Win32" or "x64".  If this command is
        #          used, various tests that require supplementary managed
        #          assemblies (e.g. LINQ) may be skipped unless those binaries
        #          are subsequently copied into the correct directory (i.e. by
        #          "CALL test_all.bat").
        #
        #       Note that all of the build commands above will default to using
        #       the latest version of MSBuild available and the "test_year" may
        #       need to be adjusted accordingly to actually run the test suite.
        #       Refer to the comments in [getBuildYear] for more information on
        #       how to set this variable.
        #
        set native [expr {
          !$managedOnly && ([getBuildNative] || [hasRuntimeOption native])
        }]

        return [joinBuildDirectory $native [getBuildBaseDirectory] \
            [expr {$managedOnly ? [getBuildYear] : [getBuildNativeYear]}] \
            [getBuildPlatform $native] [appendArgs [getBuildConfiguration] \
            [expr {$managedOnly ? [getBuildConfigurationSuffix] : \
            [getBuildNativeConfigurationSuffix]}]] [expr {$managedOnly ? \
            [getBuildExtra] : [getBuildNativeExtra]}]]
      }
    }

    proc getReleaseVersion {} {
      #
      # NOTE: Figure out the release version for use with the build directory
      #       when checking for available releases.
      #
      if {[info exists ::release_version] && \
          [string length $::release_version] > 0} then {
        #
        # NOTE: The release version has been overridden; therefore, use it
        #       verbatim.
        #
        return $::release_version
      } else {
        #
        # NOTE: No release version is available, return an empty string.
        #       It is important to return an empty string here because the
        #       result of this procedure may be used with [file join].
        #
        return ""
      }
    }

    proc getBuildFileName { fileName managedOnly {platform ""} } {
      #
      # NOTE: Returns the specified file name as if it were located in the
      #       build directory, discarding any directory information present
      #       in the file name as provided by our caller.
      #
      set result [file nativename \
          [file join [getBuildDirectory $managedOnly] $platform \
          [file tail $fileName]]]

      #
      # HACK: When running on WoW64, assume the test executables are present
      #       with the "32" suffix on them.
      #
      if {[isRunningWoW64] && [file extension $result] eq ".exe"} then {
        set result [appendArgs [file rootname $result] 32.exe]
      }

      return $result
    }

    proc getExternalDirectory {} {
      #
      # NOTE: This procedure returns the directory where the external binary
      #       files are located.
      #
      return [file nativename \
          [file dirname [file dirname [file dirname [info binary]]]]]
    }

    proc getBinaryDirectory {} {
      #
      # NOTE: This procedure returns the directory where the test application
      #       itself (i.e. the Eagle shell) is located.  This will be used as
      #       the destination for the copied System.Data.SQLite native and
      #       managed assemblies (i.e. because this is one of the few places
      #       where the CLR will actually find and load them properly).
      #
      if {[info exists ::binary_directory] && \
          [string length $::binary_directory] > 0} then {
        #
        # NOTE: The location of the binary directory has been overridden;
        #       therefore, use it verbatim.
        #
        return $::binary_directory
      } else {
        return [info binary]
      }
    }

    proc getExternalFileName { fileName } {
      #
      # NOTE: Returns the specified file name as if it were located in the
      #       directory containing the external binaries.
      #
      return [file nativename [file join [getExternalDirectory] $fileName]]
    }

    proc getBinaryFileName { fileName {platform ""} } {
      #
      # NOTE: Returns the specified file name as if it were located in the
      #       binary directory, discarding any directory information present
      #       in the file name as provided by our caller.
      #
      return [file nativename \
          [file join [getBinaryDirectory] $platform [file tail $fileName]]]
    }

    proc getCoreBinaryFileName { {platform ""} {standard ""} } {
      #
      # NOTE: Returns the full path for the file containing the SQLite core
      #       native library code for this platform.  First, check and see if
      #       the SQLite core native library has already been loaded.  Next,
      #       fallback to what the full path should be, based on whether the
      #       mixed-mode assembly is being used and the name of the current
      #       platform.
      #
      if {[catch {
        object invoke -flags +NonPublic \
            System.Data.SQLite.UnsafeNativeMethods _SQLiteNativeModuleFileName
      } fileName] == 0 && [string length $fileName] > 0} then {
        #
        # NOTE: The SQLite core native library has already been loaded via
        #       the native library pre-loader.  Return that file name now.
        #
        return $fileName
      }

      #
      # NOTE: If the "native" runtime option has been set, always return the
      #       file name for the mixed-mode assembly.
      #
      if {[hasRuntimeOption native]} then {
        #
        # NOTE: Return the mixed-mode assembly file name.
        #
        return [file nativename \
            [file join [getBinaryDirectory] $platform System.Data.SQLite.dll]]
      }

      #
      # NOTE: Are we attempting to automatically detect whether or not the
      #       interop assembly should be used?
      #
      set automatic [expr {[string length $standard] == 0}]

      #
      # NOTE: First, in either "automatic" or "non-standard" modes, attempt
      #       to find the native-only interop assembly.
      #
      if {$automatic || !$standard} then {
        #
        # NOTE: Attempt to determine the native-only interop assembly file
        #       name for this platform and then return it.
        #
        foreach fileNameOnly [getInteropAssemblyFileNamesOnly] {
          set fileName [file nativename \
              [file join [getBinaryDirectory] $platform $fileNameOnly]]

          if {[file exists $fileName]} then {
            return $fileName
          }
        }
      }

      #
      # NOTE: Then, in either "automatic" or "standard" modes, attempt to
      #       find the standard SQLite library.
      #
      if {$automatic || $standard} then {
        #
        # NOTE: Attempt to determine the native-only standard SQLite library
        #       file name for this platform and then return it.
        #
        foreach fileNameOnly [getNativeLibraryFileNamesOnly] {
          set fileName [file nativename \
              [file join [getBinaryDirectory] $platform $fileNameOnly]]

          if {[file exists $fileName]} then {
            return $fileName
          }
        }
      }

      #
      # NOTE: Was the managed assembly compiled expecting to deal with the
      #       standard core library?
      #
      if {[haveSQLiteDefineConstant SQLITE_STANDARD]} then {
        #
        # NOTE: Fallback to returning the native-only standard SQLite library
        #       file name for the platform.
        #
        set fileNamesOnly [getNativeLibraryFileNamesOnly]

        if {[llength $fileNamesOnly] == 0} then {
          return ""
        }

        return [file nativename [file join \
            [getBinaryDirectory] $platform [lindex $fileNamesOnly 0]]]
      } else {
        #
        # NOTE: Fallback to returning the native-only interop assembly file
        #       name for the platform.
        #
        set fileNamesOnly [getInteropAssemblyFileNamesOnly]

        if {[llength $fileNamesOnly] == 0} then {
          return ""
        }

        return [file nativename [file join \
            [getBinaryDirectory] $platform [lindex $fileNamesOnly 0]]]
      }
    }

    proc getCommonDirectory {} {
      #
      # NOTE: This procedure returns the directory where the test scripts
      #       should be located.  By default, this just returns the Eagle
      #       binary directory.
      #
      if {[info exists ::common_directory] && \
          [string length $::common_directory] > 0} then {
        #
        # NOTE: The location of the common directory has been set;
        #       therefore, use it.
        #
        return $::common_directory
      } elseif {[info exists ::vendor_directory] && \
          [string length $::vendor_directory] > 0} then {
        #
        # NOTE: The location of the vendor directory has been set;
        #       therefore, use it.
        #
        return $::vendor_directory
      } elseif {[info exists ::tcl_library] && \
          [string length $::tcl_library] > 0 && \
          [file isdirectory $::tcl_library]} then {
        #
        # NOTE: The variable with the location of the script library is
        #       set and appears to be a real directory (i.e. not embedded
        #       within a file); therefore, use it.
        #
        return $::tcl_library
      } else {
        #
        # NOTE: Fallback to the directory containing the executable.
        #
        return [info binary]
      }
    }

    proc getDatabaseDirectory {} {
      #
      # NOTE: This procedure returns the directory where the test databases
      #       should be located.  By default, this just uses the temporary
      #       directory configured for this system.
      #
      if {[info exists ::database_directory] && \
          [string length $::database_directory] > 0} then {
        #
        # NOTE: The location of the database directory has been overridden;
        #       therefore, use it.
        #
        return $::database_directory
      } elseif {[info exists ::scratch_directory] && \
          [string length $::scratch_directory] > 0} then {
        #
        # NOTE: The location of the scratch directory has been overridden;
        #       therefore, use it.
        #
        return $::scratch_directory
      } else {
        return [getTemporaryPath]
      }
    }

    proc getTemporaryDirectory {} {
      #
      # NOTE: This procedure returns the directory where the temporary files
      #       should be located.  By default, this just uses the temporary
      #       directory configured for this system.
      #
      if {[info exists ::temporary_directory] && \
          [string length $::temporary_directory] > 0} then {
        #
        # NOTE: The location of the temporary directory has been overridden;
        #       therefore, use it.
        #
        return $::temporary_directory
      } elseif {[info exists ::scratch_directory] && \
          [string length $::scratch_directory] > 0} then {
        #
        # NOTE: The location of the scratch directory has been overridden;
        #       therefore, use it.
        #
        return $::scratch_directory
      } else {
        return [getTemporaryPath]
      }
    }

    proc getExecuteOnSetup {} {
      if {[info exists ::execute_on_setup] && \
          [string length $::execute_on_setup] > 0} then {
        #
        # NOTE: Return the configured SQL to execute during the connection
        #       setup procedure (i.e. for every test database connection).
        #
        return $::execute_on_setup
      } else {
        #
        # NOTE: By default, there is no SQL to execute during the connection
        #       setup procedure (i.e. for every test database connection).
        #
        return ""
      }
    }

    proc getStringMapForTclEscape {} {
      return [list \\ \\\\ \[ \\\[ \] \\\] \$ \\\$]
    }

    proc getTestOverridesPreamble { {extraVarNames ""} } {
      set varNames [list]

      #
      # NOTE: If available, start with the master list of test override
      #       variables.
      #
      if {[info exists ::test_overrides] && \
          [llength $::test_overrides] > 0} then {
        eval lappend varNames $::test_overrides
      }

      #
      # NOTE: If requested by our caller, add any additional variable
      #       names to copy now.
      #
      if {[llength $extraVarNames] > 0} then {
        eval lappend varNames $extraVarNames
      }

      #
      # NOTE: Build the script fragment to be returned by processing each
      #       variable name and adding the nececessary script fragments for
      #       each one.
      #
      set result ""

      foreach varName $varNames {
        #
        # NOTE: Build the qualified global variable name.
        #
        set fullVarName [appendArgs :: $varName]

        #
        # NOTE: Does the variable exist in this interpreter context?
        #
        if {[info exists $fullVarName]} then {
          #
          # NOTE: Append a script fragment to the result that will correctly
          #       copy any contained value to another interpreter context.
          #
          append result \n "set " $fullVarName " \{" [string map \
              [getStringMapForTclEscape] [set $fullVarName]] \}
        }
      }

      #
      # NOTE: If the result contains one or more script fragments, append a
      #       newline.
      #
      if {[string length $result] > 0} then {
        append result \n
      }

      return $result
    }

    proc moveSystemDataSQLiteDllConfig { {restore false} {verbose true} } {
      set directory [getBinaryDirectory]

      if {[string length $directory] == 0} then {
        if {$verbose} then {
          tputs $::test_channel [appendArgs \
              "---- skipped moving \"System.Data.SQLite.dll.config\", " \
              "no binary directory\n"]
        }

        return
      }

      set fileName(1) [file normalize \
          [file join $directory System.Data.SQLite.dll.config]]

      set fileName(2) [appendArgs $fileName(1) .moved]

      if {$restore} then {
        if {[file exists $fileName(2)]} then {
          file rename $fileName(2) $fileName(1)

          if {$verbose} then {
            tputs $::test_channel [appendArgs \
                "---- moved \"" $fileName(2) "\" to \"" \
                $fileName(1) \"\n]
          }
        } else {
          if {$verbose} then {
            tputs $::test_channel [appendArgs \
                "---- skipped moving \"" $fileName(2) \
                "\", it does not exist\n"]
          }
        }
      } else {
        if {[file exists $fileName(1)]} then {
          file rename $fileName(1) $fileName(2)

          if {$verbose} then {
            tputs $::test_channel [appendArgs \
                "---- moved \"" $fileName(1) "\" to \"" \
                $fileName(2) \"\n]
          }
        } else {
          if {$verbose} then {
            tputs $::test_channel [appendArgs \
                "---- skipped moving \"" $fileName(1) \
                "\", it does not exist\n"]
          }
        }
      }
    }

    proc writeSystemDataSQLiteDllConfig { data {verbose true} } {
      set directory [getBinaryDirectory]

      if {[string length $directory] == 0} then {
        if {$verbose} then {
          tputs $::test_channel [appendArgs \
              "---- skipped moving \"System.Data.SQLite.dll.config\", " \
              "no binary directory\n"]
        }

        return
      }

      set fileName [file normalize \
          [file join $directory System.Data.SQLite.dll.config]]

      writeFile $fileName $data

      if {$verbose} then {
        tputs $::test_channel \
            "---- wrote \"System.Data.SQLite.dll.config\"\n"
      }

      return $fileName
    }

    proc moveEagleShellMdaConfig { {restore false} {verbose true} } {
      set directory [getBinaryDirectory]

      if {[string length $directory] == 0} then {
        if {$verbose} then {
          tputs $::test_channel [appendArgs \
              "---- skipped moving \"EagleShell.exe.mda.config\", " \
              "no binary directory\n"]
        }

        return
      }

      set fileName(1) [file normalize \
          [file join $directory EagleShell.exe.mda.config]]

      set fileName(2) [appendArgs $fileName(1) .moved]

      if {$restore} then {
        if {[file exists $fileName(2)]} then {
          file rename $fileName(2) $fileName(1)

          if {$verbose} then {
            tputs $::test_channel [appendArgs \
                "---- moved \"" $fileName(2) "\" to \"" \
                $fileName(1) \"\n]
          }
        } else {
          if {$verbose} then {
            tputs $::test_channel [appendArgs \
                "---- skipped moving \"" $fileName(2) \
                "\", it does not exist\n"]
          }
        }
      } else {
        if {[file exists $fileName(1)]} then {
          file rename $fileName(1) $fileName(2)

          if {$verbose} then {
            tputs $::test_channel [appendArgs \
                "---- moved \"" $fileName(1) "\" to \"" \
                $fileName(2) \"\n]
          }
        } else {
          if {$verbose} then {
            tputs $::test_channel [appendArgs \
                "---- skipped moving \"" $fileName(1) \
                "\", it does not exist\n"]
          }
        }
      }
    }

    proc writeEagleShellMdaConfig { data {verbose true} } {
      set directory [getBinaryDirectory]

      if {[string length $directory] == 0} then {
        if {$verbose} then {
          tputs $::test_channel [appendArgs \
              "---- skipped moving \"EagleShell.exe.mda.config\", " \
              "no binary directory\n"]
        }

        return
      }

      set fileName [file normalize \
          [file join $directory EagleShell.exe.mda.config]]

      writeFile $fileName $data

      if {$verbose} then {
        tputs $::test_channel \
            "---- wrote \"EagleShell.exe.mda.config\"\n"
      }

      return $fileName
    }

    proc getAppDomainPreamble { {prefix ""} {suffix ""} } {
      #
      # NOTE: This procedure returns a test setup script fragment suitable for
      #       evaluation by an interpreter created in an isolated application
      #       domain.  The script fragment being returned will be surrounded by
      #       the prefix and suffix "script fragments" specified by our caller,
      #       if any.  The entire script being returned will be substituted via
      #       [subst], in the context of our caller, before being returned.
      #       This step is necessary so that some limited context information,
      #       primarily related to the testing directories, can be transferred
      #       to the interpreter in the isolated application domain, making it
      #       able to successfully run tests that require one or more of the
      #       files in one of the testing directories.  Callers should keep in
      #       mind that the test script fragment being returned cannot rely on
      #       any script library procedures that are not provided by the Eagle
      #       library package (i.e. "init.eagle"), including those provided by
      #       the Eagle test package, unless the file containing them is loaded
      #       manually via some other mechanism (e.g. by including appropriate
      #       [package require] or [source] commands in the prefix or suffix
      #       script fragments).  Also, all variable references and all nested
      #       commands (i.e. those in square brackets) contained in the final
      #       script fragment will end up being evaluated in the context of the
      #       calling interpreter and not the target interpreter created in the
      #       isolated application domain unless the dollar signs and/or square
      #       brackets are specially quoted with backslashes.
      #
      return [uplevel 1 [list subst [appendArgs $prefix {
        #
        # NOTE: The \[object\] command may be missing in some Eagle core
        #       library configurations.  Cloning and using the procedure
        #       \[changeNativeRuntimeOption\] may help to mitigate this.
        #
        proc changeNativeRuntimeOption \
            {[info args changeNativeRuntimeOption]} \
            {[info body changeNativeRuntimeOption]}

        catch {
          changeNativeRuntimeOption [hasRuntimeOption native]
        }
      } [getTestOverridesPreamble [list path test_channel]] $suffix]]]
    }

    proc tryCopyExternalFile {
            fileName {platform ""} {newFileName ""} {verbose true} } {
      set sourceFileName [getExternalFileName $fileName]

      if {![file exists $sourceFileName]} then {
        if {$verbose} then {
          tputs $::test_channel [appendArgs \
              "---- skipped copying external file \"" $sourceFileName \
              "\", it does not exist\n"]
        }

        return
      }

      if {[string length $newFileName] > 0} then {
        set targetFileName [getBinaryFileName $newFileName $platform]
      } else {
        set targetFileName [getBinaryFileName $fileName $platform]
      }

      set targetDirectory [file dirname $targetFileName]

      if {[catch {
        if {![file exists $targetDirectory]} then {
          file mkdir $targetDirectory
        }

        file copy -force $sourceFileName $targetFileName
      }] == 0} then {
        tputs $::test_channel [appendArgs \
            "---- copied external file from \"" $sourceFileName "\" to \"" \
            $targetFileName \"\n]
      } else {
        tputs $::test_channel [appendArgs \
            "---- failed to copy external file from \"" $sourceFileName \
            "\" to \"" $targetFileName \"\n]
      }
    }

    proc tryCopyBinaryFile {
            fileName managedOnly {platform ""} {newFileName ""}
            {verbose true} } {
      set sourceFileName [getBinaryFileName $fileName $platform]

      if {![file exists $sourceFileName]} then {
        if {$verbose} then {
          tputs $::test_channel [appendArgs \
              "---- skipped copying binary file \"" $sourceFileName \
              "\", it does not exist\n"]
        }

        return
      }

      if {[string length $newFileName] > 0} then {
        set targetFileName [getBuildFileName \
            $newFileName $managedOnly $platform]
      } else {
        set targetFileName [getBuildFileName \
            $fileName $managedOnly $platform]
      }

      set targetDirectory [file dirname $targetFileName]

      if {[catch {
        if {![file exists $targetDirectory]} then {
          file mkdir $targetDirectory
        }

        file copy -force $sourceFileName $targetFileName
      }] == 0} then {
        tputs $::test_channel [appendArgs \
            "---- copied binary file from \"" $sourceFileName "\" to \"" \
            $targetFileName \"\n]
      } else {
        tputs $::test_channel [appendArgs \
            "---- failed to copy binary file from \"" $sourceFileName \
            "\" to \"" $targetFileName \"\n]
      }
    }

    proc tryCopyBuildFile {
            fileName managedOnly {platform ""} {newFileName ""}
            {verbose true} } {
      set sourceFileName [getBuildFileName $fileName $managedOnly $platform]

      if {![file exists $sourceFileName]} then {
        if {$verbose} then {
          tputs $::test_channel [appendArgs \
              "---- skipped copying build file \"" $sourceFileName \
              "\", it does not exist\n"]
        }

        return
      }

      if {[string length $newFileName] > 0} then {
        set targetFileName [getBinaryFileName $newFileName $platform]
      } else {
        set targetFileName [getBinaryFileName $fileName $platform]
      }

      set targetDirectory [file dirname $targetFileName]

      if {[catch {
        if {![file exists $targetDirectory]} then {
          file mkdir $targetDirectory
        }

        file copy -force $sourceFileName $targetFileName
      }] == 0} then {
        tputs $::test_channel [appendArgs \
            "---- copied build file from \"" $sourceFileName "\" to \"" \
            $targetFileName \"\n]
      } else {
        tputs $::test_channel [appendArgs \
            "---- failed to copy build file from \"" $sourceFileName \
            "\" to \"" $targetFileName \"\n]
      }
    }

    proc tryDeleteBinaryFile { fileName {platform ""} {verbose true} } {
      set fileName [getBinaryFileName $fileName $platform]

      if {![file exists $fileName]} then {
        if {$verbose} then {
          tputs $::test_channel [appendArgs \
              "---- skipped deleting binary file \"" $fileName \
              "\", it does not exist\n"]
        }

        return
      }

      if {[catch {file delete $fileName}] == 0} then {
        tputs $::test_channel [appendArgs \
            "---- deleted binary file \"" $fileName \"\n]
      } else {
        tputs $::test_channel [appendArgs \
            "---- failed to delete binary file \"" $fileName \"\n]
      }
    }

    proc tryDeleteBuildFile {
            fileName managedOnly {platform ""} {verbose true} } {
      set fileName [getBuildFileName $fileName $managedOnly $platform]

      if {![file exists $fileName]} then {
        if {$verbose} then {
          tputs $::test_channel [appendArgs \
              "---- skipped deleting build file \"" $fileName \
              "\", it does not exist\n"]
        }

        return
      }

      if {[catch {file delete $fileName}] == 0} then {
        tputs $::test_channel [appendArgs \
            "---- deleted build file \"" $fileName \"\n]
      } else {
        tputs $::test_channel [appendArgs \
            "---- failed to delete build file \"" $fileName \"\n]
      }
    }

    proc tryCopyAssembly {
            fileName managedOnly {platform ""} {pdb true} {verbose true} } {
      tryCopyBuildFile $fileName $managedOnly $platform "" $verbose

      if {$pdb} then {
        tryCopyBuildFile [appendArgs \
            [file rootname $fileName] .pdb] $managedOnly $platform "" $verbose
      }
    }

    proc tryDeleteAssembly {
            fileName {platform ""} {pdb true} {verbose true} } {
      tryDeleteBinaryFile $fileName $platform $verbose

      if {$pdb} then {
        tryDeleteBinaryFile [appendArgs \
            [file rootname $fileName] .pdb] $platform $verbose
      }
    }

    proc tryLoadAssembly { fileName {platform ""} {initialize ""} } {
      set fileName [getBinaryFileName $fileName $platform]

      if {[catch {
        set assembly [object load -loadtype File -alias $fileName]
      }] == 0} then {
        if {[string length $initialize] == 0 || \
            [catch $initialize] == 0} then {
          #
          # NOTE: Now, add the necessary test constraint.
          #
          addConstraint [file rootname [file tail $fileName]]

          #
          # NOTE: Grab the image runtime version from the assembly
          #       because several tests rely on it having a certain
          #       value.
          #
          addConstraint [appendArgs [file tail $fileName] _ \
              [$assembly ImageRuntimeVersion]]

          #
          # NOTE: Return the full path of the loaded file.
          #
          return $fileName
        }
      }

      return ""
    }

    proc isSQLiteReady {} {
      #
      # NOTE: This procedure must return non-zero only if the SQLite native
      #       library and the System.Data.SQLite managed assembly are loaded
      #       and ready for use by the test suite.  Currently, this procedure
      #       should be called only after the [tryLoadAssembly] procedure has
      #       been called to probe for the System.Data.SQLite managed assembly
      #       and the [checkForSQLite] procedure has been called to probe for
      #       the SQLite native library; otherwise, this procedure will simply
      #       always return zero.
      #
      return [expr {
        [haveConstraint System.Data.SQLite] && [haveConstraint SQLite]
      }]
    }

    proc matchBuildPlatform { platform } {
      #
      # NOTE: An empty string for the platform means that the build is not
      #       [primarily] a native build; therefore, it always matches.
      #
      if {[string length $platform] == 0} then {
        return true
      }

      #
      # NOTE: If the machine name is unavailable, there is nothing else we
      #       can do.
      #
      if {![info exists ::tcl_platform(machine)]} then {
        return false
      }

      #
      # NOTE: Does the specified platform match up to the current process?
      #
      if {$platform eq [machineToPlatform $::tcl_platform(machine)]} then {
        return true
      }

      #
      # NOTE: The specified platform does not match up with the platform
      #       for the current process.
      #
      return false
    }

    proc haveSQLiteObjectCommand {} {
      #
      # NOTE: Is the [object] command currently available?
      #
      return [expr {[llength [info commands object]] > 0}]
    }

    proc checkForSQLiteObjectCommand { channel } {
      tputs $channel "---- checking for \"object\" command usage... "

      if {![info exists ::no(sqliteObjectCommand)] && \
          [haveSQLiteObjectCommand]} then {
        tputs $channel yes\n
      } else {
        #
        # NOTE: Unless we are forbidden from doing so, add some constraints
        #       that will allow most of the test suite to run (i.e. those
        #       tests that do not directly rely upon the [object] command).
        #
        if {![info exists ::no(shimSQLiteAssemblyConstraints)]} then {
          addConstraint SQLite
          addConstraint SQLiteInterop
          addConstraint System.Data.SQLite
          addConstraint System.Data.SQLite.Encryption
          addConstraint System.Data.SQLite.Linq

          addConstraint [appendArgs \
              System.Data.SQLite.dll_v [getBuildClrVersion]]
        }

        if {![info exists ::no(shimSQLiteDefineConstantConstraints)]} then {
          set defineConstants [list \
              INTEROP_EXTENSION_FUNCTIONS INTEROP_FTS5_EXTENSION \
              INTEROP_JSON1_EXTENSION INTEROP_PERCENTILE_EXTENSION \
              INTEROP_REGEXP_EXTENSION INTEROP_TEST_EXTENSION \
              INTEROP_SESSION_EXTENSION INTEROP_SHA1_EXTENSION \
              INTEROP_SHA3_EXTENSION INTEROP_TOTYPE_EXTENSION \
              INTEROP_VIRTUAL_TABLE USE_INTEROP_DLL]

          foreach defineConstant $defineConstants {
            addConstraint [appendArgs \
                [getSQLiteDefineConstantPrefix] $defineConstant]
          }
        }

        if {![info exists ::no(shimSQLiteVisualStudioConstraints)]} then {
          addConstraint [appendArgs visualStudio [getBuildYear]]
        }

        tputs $channel no\n
      }
    }

    proc changeNativeRuntimeOption { native } {
      if {[llength [info commands debug]] > 0 && \
          [llength [info subcommands debug runtimeoption]] > 0 && [catch {
        debug runtimeoption [expr {$native ? "add" : "remove"}] native
      }] == 0} then {
        return true
      }

      if {[haveSQLiteObjectCommand] && [catch {
        object invoke Interpreter.GetActive [expr {$native ? \
            "AddRuntimeOption" : "RemoveRuntimeOption"}] native
      }] == 0} then {
        return true
      }

      return false
    }

    proc checkForSQLiteBuilds { channel {select false} } {
      #
      # NOTE: Check for every possible valid combination of values used when
      #       locating out the build output directory, showing each available
      #       build variation along the way.
      #
      foreach native [list false true] {
        foreach year [getBuildYears] {
          foreach configuration [getBuildConfigurations] {
            foreach suffix [getBuildConfigurationSuffixes] {
              foreach extra [getBuildExtras] {
                #
                # NOTE: Figure out the effective build platform.  This is
                #       based on whether or not a [primarily] native build
                #       is being used.  For [primarily] non-native builds,
                #       this will be an empty string.
                #
                set platform [getBuildPlatform $native]

                #
                # NOTE: Build the fully qualified directory where the
                #       necessary components for System.Data.SQLite should
                #       be found.
                #
                set directory [joinBuildDirectory $native \
                    [getBuildBaseDirectory] $year $platform [appendArgs \
                    $configuration $suffix] $extra]

                tputs $channel [appendArgs \
                    "---- checking for System.Data.SQLite build \"" [expr \
                    {$native ? "native/" : ""}] [expr {[string length \
                    $platform] > 0 ? [appendArgs $platform /] : ""}] \
                    $year / [appendArgs $configuration $suffix] "\"... "]

                #
                # NOTE: Do the necessary files exist?  Currently, no other
                #       steps are taken to verify this build is actually
                #       viable.
                #
                set skipNative [expr {[isDotNetCore] && [isWindows]}]

                if {[isBuildAvailable $native $skipNative $directory]} then {
                  #
                  # NOTE: When in "select" mode, automatically select the
                  #       first available build of System.Data.SQLite and
                  #       then return immediately.
                  #
                  if {$select && [matchBuildPlatform $platform]} then {
                    #
                    # NOTE: Manually override all the build directory
                    #       selection related test settings in order to
                    #       force this build of System.Data.SQLite to be
                    #       used.
                    #
                    if {![changeNativeRuntimeOption $native]} then {
                      tputs $channel [appendArgs \
                          "no, failed to " [expr {$native ? "add" : \
                          "remove"}] " the \"native\" runtime option\n"]

                      return false
                    }

                    set ::test_native $skipNative
                    set ::test_year $year

                    set ::test_native_year \
                        [getBuildNativeYearForDotNetCore $year]

                    set ::test_platform $platform
                    set ::test_configuration $configuration
                    set ::test_configuration_suffix $suffix

                    set ::test_native_configuration_suffix \
                        [getBuildNativeConfigurationSuffixForDotNetCore \
                        $suffix]

                    set ::test_extra $extra

                    set ::test_native_extra \
                        [getBuildNativeExtraForDotNetCore $extra]

                    tputs $channel [appendArgs \
                        "yes, selected (" [expr {$native ? "native/" : ""}] \
                        [expr {[string length $platform] > 0 ? [appendArgs \
                        $platform /] : ""}] $year / [appendArgs \
                        $configuration $suffix] [expr {[string length \
                        $extra] > 0 ? [appendArgs / $extra] : ""}] ")\n"]

                    return true
                  } else {
                    tputs $channel yes\n
                  }
                } else {
                  tputs $channel no\n
                }
              }
            }
          }
        }
      }

      return false
    }

    proc checkForSQLiteReleases { channel {select false} } {
      #
      # NOTE: Check for past releases of System.Data.SQLite in the directory
      #       contained in the "System.Data.SQLite" environment variable, if
      #       present.
      #
      if {[info exists ::env(System.Data.SQLite)] && \
          [string length $::env(System.Data.SQLite)] > 0} then {
        #
        # NOTE: Build the fully qualified directory where the necessary
        #       components for System.Data.SQLite should be found.
        #
        set directory [file nativename [file join \
            $::env(System.Data.SQLite) [getReleaseVersion]]]

        tputs $channel [appendArgs \
            "---- checking for System.Data.SQLite release \"" \
            $directory "\"... "]

        if {[isReleaseAvailable $directory platform]} then {
          if {[string length $platform] == 0} then {
            set platform unknown
          }

          if {$select && [matchBuildPlatform $platform]} then {
            set ::build_directory $directory

            tputs $channel [appendArgs "yes, selected (" $platform ")\n"]

            return true
          } else {
            tputs $channel [appendArgs "yes (" $platform ")\n"]
          }
        } else {
          tputs $channel no\n

          if {![file exists $directory] || \
              ![file isdirectory $directory]} then {
            tputs $channel [appendArgs \
                "---- environment variable \"System.Data.SQLite\" is an " \
                "invalid directory, skipping check for releases...\n"]

            return false
          }

          foreach path [lsort -decreasing [file list $directory *]] {
            if {[file exists $path] && [file isdirectory $path]} then {
              tputs $channel [appendArgs \
                  "---- checking for System.Data.SQLite release \"" \
                  $path "\"... "]

              if {[isReleaseAvailable $path platform]} then {
                if {[string length $platform] == 0} then {
                  set platform unknown
                }

                if {$select && [matchBuildPlatform $platform]} then {
                  set ::build_directory $path

                  tputs $channel [appendArgs "yes, selected (" $platform ")\n"]

                  return true
                } else {
                  tputs $channel [appendArgs "yes (" $platform ")\n"]
                }
              } else {
                tputs $channel no\n
              }
            }
          }
        }
      } else {
        tputs $channel [appendArgs \
            "---- environment variable \"System.Data.SQLite\" is not " \
            "set, skipping check for releases...\n"]
      }

      return false
    }

    proc checkForSQLiteLibrary { channel } {
      tputs $channel "---- checking for SQLite core library... "

      if {[catch {
        object invoke -flags +NonPublic \
            System.Data.SQLite.SQLite3 SQLiteVersion
      } version] == 0} then {
        #
        # NOTE: Check if the returned version was null.  If so, make it easy
        #       to spot.
        #
        if {[string length $version] == 0} then {
          set version null
        }

        #
        # NOTE: Attempt to query the Fossil source identifier for the SQLite
        #       core library.
        #
        if {[catch {
          object invoke -flags +NonPublic \
              System.Data.SQLite.SQLite3 SQLiteSourceId
        } sourceId]} then {
          #
          # NOTE: We failed to query the Fossil source identifier.
          #
          set sourceId unknown
        }

        #
        # NOTE: Check if the returned Fossil source identifier was null.  If
        #       so, make it easy to spot.
        #
        if {[string length $sourceId] == 0} then {
          set sourceId null
        }

        #
        # NOTE: Yes, the SQLite core library appears to be available.
        #
        addConstraint SQLite

        #
        # NOTE: Record version of the SQLite core library for later use
        #       by test constraint expressions, etc.  If this value has
        #       already been set (or overridden), skip setting it.
        #
        if {![info exists ::core_library_version]} then {
          set ::core_library_version $version
        }

        tputs $channel [appendArgs "yes (" $version " " $sourceId ")\n"]
      } else {
        tputs $channel no\n
      }
    }

    proc checkForSQLiteInterop { channel } {
      tputs $channel "---- checking for SQLite interop assembly... "

      if {[catch {
        object invoke -flags +NonPublic \
            System.Data.SQLite.SQLite3 InteropVersion
      } version] == 0} then {
        #
        # NOTE: Check if the returned version was null.  If so, make it easy
        #       to spot.
        #
        if {[string length $version] == 0} then {
          set version null
        }

        #
        # NOTE: Attempt to query the Fossil source identifier for the SQLite
        #       core library.
        #
        if {[catch {
          object invoke -flags +NonPublic \
              System.Data.SQLite.SQLite3 InteropSourceId
        } sourceId]} then {
          #
          # NOTE: We failed to query the Fossil source identifier.
          #
          set sourceId unknown
        }

        #
        # NOTE: Check if the returned Fossil source identifier was null.  If
        #       so, make it easy to spot.
        #
        if {[string length $sourceId] == 0} then {
          set sourceId null
        }

        #
        # NOTE: Before actually adding the test constraint, make sure the
        #       version is valid (i.e. not just that we could query it).
        #
        if {$version ne "null"} then {
          #
          # NOTE: Yes, the SQLite interop assembly appears to be available.
          #
          addConstraint SQLiteInterop

          set answer yes
        } else {
          set answer no
        }

        tputs $channel [appendArgs $answer " (" $version " " $sourceId ")\n"]
      } else {
        tputs $channel no\n
      }
    }

    proc checkForSQLiteDefineConstant { channel name } {
      tputs $channel [appendArgs \
          "---- checking for System.Data.SQLite define constant \"" $name \
          "\"... "]

      if {[catch {
        if {[string match INTEROP_* $name]} then {
          #
          # HACK: Use unified define constants list that takes into
          #       account both the managed and interop assemblies.
          #
          object invoke -flags +NonPublic \
              System.Data.SQLite.SQLite3 DefineConstants
        } else {
          object invoke -flags +NonPublic \
              System.Data.SQLite.SQLite3 ProviderDefineConstants
        }
      } defineConstants] == 0} then {
        if {[lsearch -exact -nocase $defineConstants $name] != -1} then {
          #
          # NOTE: Yes, this define constant was enabled when the managed
          #       assembly was compiled.
          #
          addConstraint [appendArgs [getSQLiteDefineConstantPrefix] $name]

          tputs $channel yes\n
        } else {
          tputs $channel no\n
        }
      } else {
        tputs $channel error\n
      }
    }

    proc checkForSQLiteCompileOption { channel name } {
      tputs $channel [appendArgs \
          "---- checking for SQLite interop assembly compile option \"" \
          $name "\"... "]

      if {[catch {
        object invoke -flags +NonPublic \
            System.Data.SQLite.SQLite3 InteropCompileOptions
      } compileOptions] == 0} then {
        if {[lsearch -exact -nocase $compileOptions $name] != -1} then {
          #
          # NOTE: Yes, this compile option was enabled when the interop
          #       assembly was compiled.
          #
          addConstraint [appendArgs [getSQLiteCompileOptionPrefix] $name]

          tputs $channel yes\n
        } else {
          tputs $channel no\n
        }
      } else {
        tputs $channel error\n
      }

      tputs $channel [appendArgs \
          "---- checking for SQLite core library compile option \"" \
          $name "\"... "]

      if {[catch {
        object invoke -flags +NonPublic \
            System.Data.SQLite.SQLite3 SQLiteCompileOptions
      } compileOptions] == 0} then {
        if {[lsearch -exact -nocase $compileOptions $name] != -1} then {
          #
          # NOTE: Yes, this compile option was enabled when the SQLite
          #       core library was compiled.
          #
          addConstraint [appendArgs [getSQLiteCompileOptionPrefix] $name]

          tputs $channel yes\n
        } else {
          tputs $channel no\n
        }
      } else {
        tputs $channel error\n
      }
    }

    proc getDateTimeFormat { {milliseconds false} {timeZone true} } {
      #
      # NOTE: This procedure simply returns the "default" DateTime format used
      #       by the test suite.
      #
      if {[info exists ::datetime_format] && \
          [string length $::datetime_format] > 0} then {
        #
        # NOTE: Return the manually overridden value for the DateTime format.
        #
        return $::datetime_format
      } else {
        #
        # NOTE: Return an ISO8601 DateTime format compatible with SQLite,
        #       System.Data.SQLite, and suitable for round-tripping with the
        #       DateTime class of the framework.  If this value is changed,
        #       various tests may fail.
        #
        set result "yyyy-MM-dd HH:mm:ss."

        if {$milliseconds} then {
          append result fffffff
        } else {
          append result FFFFFFF
        }

        if {$timeZone} then {
          append result K
        }

        return $result
      }
    }

    proc getDateTimeTicks { value {local ""} {default ""} } {
      if {[string length $value] == 0} then {
        return $default
      }

      if {[catch {
        set dateTime [object invoke -create \
            -parametertypes [list String String IFormatProvider \
            System.Globalization.DateTimeStyles] DateTime ParseExact \
            $value [getDateTimeFormat] null AdjustToUniversal]
      }]} then {
        return $default
      }

      if {[string is boolean -strict $local]} then {
        set dateTime [object invoke -create DateTime SpecifyKind \
            $dateTime Utc]
      } else {
        return [object invoke $dateTime Ticks]
      }

      if {$local} then {
        return [object invoke $dateTime ToLocalTime.Ticks]
      } else {
        return [object invoke $dateTime ToUniversalTime.Ticks]
      }
    }

    proc getProperties { object varName } {
      upvar 1 $varName properties

      set count 0
      set names [list]

      if {[isNonNullObjectHandle $object]} then {
        eval lappend names [object members \
            -membertypes Property -nameonly $object]

        eval lappend names [object members \
            -membertypes Field -nameonly $object]
      }

      foreach name $names {
        if {[catch {
          object invoke -objectflags +NoDispose $object $name
        } value] == 0} then {
          if {[isNonNullObjectHandle $value]} then {
            set error null; object invoke -flags +NonPublic \
                -marshalflags +NoHandle Interpreter.GetActive \
                AddObjectReference Ok $value error

            lappend properties(objects) [list $name $value]
          } else {
            lappend properties(values) [list $name $value]
          }

          incr count
        } else {
          lappend properties(errors) [list $name $::errorCode]
        }
      }

      return $count
    }

    proc getAllProperties { object varName } {
      upvar 1 $varName properties
      set value $object

      while {true} {
        if {![info exists properties(seenObjects)] || \
            $value ni $properties(seenObjects)} then {
          getProperties $value properties
          lappend properties(seenObjects) $value
        }

        if {![info exists properties(objects)]} then {
          break
        }

        if {[llength $properties(objects)] == 0} then {
          unset properties(objects); break
        }

        set value [lindex [lindex $properties(objects) 0] end]
        set properties(objects) [lrange $properties(objects) 1 end]
      }

      if {[info exists properties(seenObjects)]} then {
        foreach value $properties(seenObjects) {
          if {$value eq $object} continue
          catch {object dispose $value}
        }

        unset properties(seenObjects)
      }
    }

    proc getVariables { varNames {objects false} } {
      set result [list]

      foreach varName $varNames {
        if {[uplevel 1 [list array exists $varName]]} then {
          set arrayName $varName

          foreach elementName [uplevel 1 [list array names $arrayName]] {
            set name [appendArgs $arrayName ( $elementName )]
            set varValue [uplevel 1 [list set $name]]

            if {$objects && [isNonNullObjectHandle $varValue]} then {
              unset -nocomplain properties
              getAllProperties $varValue properties

              lappend result [list $name [array get properties]]
            } else {
              lappend result [list $name $varValue]
            }
          }
        } else {
          set varValue [uplevel 1 [list set $varName]]

          if {$objects && [isNonNullObjectHandle $varValue]} then {
            unset -nocomplain properties
            getAllProperties $varValue properties

            lappend result [list $varName [array get properties]]
          } else {
            lappend result [list $varName $varValue]
          }
        }
      }

      return $result
    }

    proc enumerableToList { enumerable } {
      set result [list]

      if {![isNonNullObjectHandle $enumerable]} then {
        return $result
      }

      object foreach -alias item $enumerable {
        if {[isNonNullObjectHandle $item]} then {
          lappend result [$item ToString]
        }
      }

      return $result
    }

    proc catchAndReturn { script {stackTrace false} {strict true} } {
      #
      # NOTE: Evaluate the script provided by our caller in their context,
      #       capturing both the result and the return code.
      #
      set code [catch {uplevel 1 $script} result]

      #
      # NOTE: Did the script provided by our caller NOT raise an error?
      #
      if {$strict && $code == 0 || !$strict && $code != 1} then {
        #
        # NOTE: Success.  Return a list with the return code and the result.
        #
        return [list $code $result]
      } elseif {$stackTrace} then {
        #
        # NOTE: Failure.  Our caller wants a full stack trace (if applicable),
        #       return a list with the return code and the result verbatim.
        #
        return [list $code $result]
      } else {
        #
        # NOTE: Failure.  Our caller does not want a full stack trace (if
        #       applicable), return a list with the return code, the error
        #       code for the interpreter, and the error message up to the
        #       point where the stack trace should start.
        #
        return [list $code $::errorCode \
            [extractSystemDataSQLiteExceptionMessage $result]]
      }
    }

    proc resetException {} {
      #
      # NOTE: Reset exception associated with this interpreter (to null).
      #       This (private) property is maintained on a per-thread basis.
      #
      object invoke -flags +NonPublic Interpreter.GetActive Exception null
      return ""
    }

    proc catchAndSetException { script {varName ""} } {
      #
      # NOTE: Evaluate the script provided by our caller in their context.
      #
      catch {uplevel 1 $script}

      #
      # NOTE: Grab the (private) exception property from this interpreter,
      #       for this thread, and add as an opaque object handle in the
      #       context of our caller.
      #
      if {[string length $varName] > 0} then {
        upvar 1 $varName exception
      }

      set exception [object invoke \
          -alias -flags +NonPublic Interpreter.GetActive Exception]

      if {[isNonNullObjectHandle $exception] && [$exception GetType] \
              eq "Eagle._Components.Public.ScriptException"} then {
        set exception [$exception -alias InnerException]
      }

      return ""
    }

    proc compileCSharpWith {
            text memory symbols strict resultsVarName errorsVarName fileNames
            args } {
      try {
        #
        # NOTE: Since we are going to use this method name a lot, assign
        #       it to a variable first.
        #
        set add ReferencedAssemblies.Add

        #
        # NOTE: Create the base command to evaluate and add the property
        #       settings that are almost always needed by our unit tests
        #       (e.g. System and System.Data assembly references, etc).
        #
        set command [list \
            compileCSharp $text $memory $symbols $strict results errors \
            $add System.dll $add System.Data.dll $add System.Xml.dll \
            $add System.Transactions.dll]

        #
        # NOTE: Add all the provided file names as assembly references.
        #
        foreach fileName $fileNames {
          lappend command $add [getBinaryFileName $fileName]
        }

        #
        # NOTE: Add extra arguments, if any, to the command to evaluate.
        #
        eval lappend command $args

        #
        # NOTE: Alias the compiler local results and errors variables to
        #       the variable names provided by our caller.
        #
        if {[string length $resultsVarName] > 0} then {
          upvar 1 $resultsVarName results
        }

        if {[string length $errorsVarName] > 0} then {
          upvar 1 $errorsVarName errors
        }

        #
        # NOTE: Evaluate the constructed [compileCSharp] command and
        #       return the result.
        #
        eval $command
      } finally {
        #
        # NOTE: If the C# compiler was invoked using [exec], reset the
        #       previous process identifier now (i.e. that way, it does
        #       not show up as being "leaked").
        #
        if {[isDotNetCore]} then {
          catch {info previouspid true}
        }
      }
    }

    proc catchCSharp {
            script {resultVarName ""} {optionsVarName ""} {verbose true} } {
      if {[string length $resultVarName] > 0} then {
        upvar 1 $resultVarName result
      }

      if {[string length $optionsVarName] > 0} then {
        upvar 1 $optionsVarName options
      }

      set code [catch [list uplevel 1 $script] result options]

      if {$code && $verbose} then {
        set error [string map [list \r\n \n] [string trim $result]]
        set errorLine [lindex [split $error \n] 0]

        if {[regexp -- \
            { System\.Data\.SQLite\.SQLiteException: (.+?)\n} \
            $errorLine dummy message] || [regexp -nocase -- \
            { code = \w+ \(\d+\), message = (.+?)\n\s+at\s+} \
            $error dummy message]} then {
          set message [string map [list \n " ==> "] $message]

          tputs $::test_channel [appendArgs \
              "==== WARNING: SQLite error while invoking " \
              "compiled C# code: " \n\t $message \n]
        } else {
          tputs $::test_channel [appendArgs \
              "==== WARNING: other error while invoking " \
              "compiled C# code: " \n\t $result \n]
        }
      }

      return $code
    }

    proc isMemoryDb { fileName } {
      #
      # NOTE: Is the specified database file name really an in-memory database?
      #
      return [expr {$fileName eq ":memory:" || \
          [string range $fileName 0 12] eq "file::memory:"}]
    }

    proc isTableInDb { name {varName db} } {
      #
      # NOTE: Refer to the specified variable (e.g. "db") in the context of our
      #       caller.  It contains the database connection handle that will be
      #       used to execute the query used to determine if the named table is
      #       present in that database.
      #
      upvar 1 $varName db

      #
      # NOTE: Use the sqlite_master table to determine if the named table is
      #       present in the database.
      #
      set sql {
        SELECT COUNT(*) FROM sqlite_master WHERE type = 'table' AND name = ?;
      }

      #
      # NOTE: Return non-zero if the named table is present.
      #
      return [expr {
        [sql execute -execute scalar $db $sql [list param1 String $name]] > 0
      }]
    }

    proc getDbDefaultPageSize {} {
      if {[catch {executeSql "PRAGMA page_size;" scalar} result] == 0} then {
        return $result
      } else {
        return 0
      }
    }

    proc getDbDefaultCacheSize {} {
      if {[catch {executeSql "PRAGMA cache_size;" scalar} result] == 0} then {
        return $result
      } else {
        return 0
      }
    }

    proc useLegacyDbPageAndCacheSizes { varName } {
      #
      # NOTE: Refer to the specified variable (e.g. "db") in the context of our
      #       caller.  It contains the database connection handle that will be
      #       used to execute queries used to set the page and cache sizes.
      #
      upvar 1 $varName db

      sql execute $db {
        PRAGMA page_size = 1024;
        PRAGMA cache_size = 2000;
      }

      return [list \
          [sql execute -execute scalar $db "PRAGMA page_size;"] \
          [sql execute -execute scalar $db "PRAGMA cache_size;"]]
    }

    proc getOutputEncodingName {} {
      #
      # HACK: Account for differences between Console output encodings on
      #       the .NET Framework versus .NET Core, on Windows and POSIX.
      #       Mono is not supported by this procedure as it is only used
      #       by tests that do not run on Mono.
      #
      if {[isDotNetCore]} then {
        if {[isWindows]} then {
          #
          # TODO: The reported output encoding for the Console on Windows
          #       is actually "Codepage - 437".  Why?
          #
          return iso-8859-1
        } else {
          return utf-8
        }
      } else {
        return Windows-1252
      }
    }

    proc normalizeExceptionMessage { value } {
      if {[string length $value] == 0} then {return $value}
      return [string map [list \r\n " ==> " \n " ==> "] $value]
    }

    proc extractSystemDataSQLiteExceptionMessage { value } {
      #
      # NOTE: If the string conforms to format of the normal exception
      #       error strings, extract and return only the error message
      #       portion itself.
      #
      set patterns [list \
      {System\.Data\.SQLite\.SQLiteException \(0x(?:0|8)[0-9A-Fa-f]{7}\):\
          (.+?)  (?: )?at} \
      {System\.Data\.SQLite\.SQLiteException: (.+?)  (?: )?at} \
      {Eagle\._Components\.Public\.ScriptException: (.+?)  (?: )?at}]

      foreach pattern $patterns {
        if {[regexp -- $pattern $value dummy message]} then {
          set message [string map [list \r\n \n] [string trim $message]]
          set lines [split $message \n]

          if {[llength $lines] == 2} then {
            if {[lindex $lines 0] eq [lindex $lines 1]} then {
              return [lindex $lines 0]
            }

            return [appendArgs [lindex $lines 0] " -- " [lindex $lines 1]]
          }

          return $message
        }
      }

      return $value
    }

    proc trimSql { sql } {
      return [regsub -all -- {\s+} [string trim $sql] " "]
    }

    proc executeSql { sql {execute none} {format none} {fileName ""} } {
      if {[string length $fileName] == 0} then {set fileName :memory:}
      setupDb $fileName "" "" "" "" "" false false false false db true

      try {
        return [uplevel 1 [list \
            sql execute -execute $execute -format $format $db $sql]]
      } finally {
        set connection [getDbConnection]

        try {
          cleanupDb $fileName db false false false
        } finally {
          object flags $connection -NoDispose; freeDbConnection
        }
      }
    }

    proc hasNoValue { varName } {
      upvar 1 $varName extra

      if {![info exists extra]} then {
        return true
      }

      if {[string length $extra] == 0} then {
        return true
      }

      return false
    }

    proc hasNoFlags { varName none } {
      upvar 1 $varName flags

      if {[hasNoValue flags]} then {
        return true
      }

      if {$none && $flags eq "None"} then {
        return true
      }

      return false
    }

    proc combineExtra { extra1 extra2 } {
      if {[string length $extra1] > 0} then {
        if {[string length $extra2] > 0} then {
          return [appendArgs $extra1 \; $extra2]
        } else {
          return $extra1
        }
      } else {
        if {[string length $extra2] > 0} then {
          return $extra2
        } else {
          return ""
        }
      }
    }

    proc getConnectionFlags { fileName flags {quiet false} } {
      #
      # NOTE: Figure out which database file name or connection string these
      #       connection flags will actually apply to.  This is not necessary
      #       in quiet mode because this information is only used for logging
      #       and reporting purposes.
      #
      if {!$quiet} then {
        if {[string length $fileName] > 0} then {
          set database [appendArgs "file name \"" $fileName \"]
        } elseif {[info exists ::dataSource] && \
            ![array exists ::dataSource]} then {
          set database [appendArgs "data source \"" $::dataSource \"]
        } else {
          set database <unknown>
        }
      }

      #
      # NOTE: Even though there is only one source of flags so far, they
      #       must be combined using the correct syntax for enumerated
      #       flag values for the .NET Framework.
      #
      set flags [combineFlags $flags ""]

      #
      # NOTE: Show (and log) the local connection flags and the associated
      #       data source or file name.
      #
      if {!$quiet} then {
        if {![info exists ::no(emitLocalFlags)] && \
            (![info exists ::no(emitLocalFlagsIfNone)] || \
             ![hasNoFlags flags false])} then {
          tputs $::test_channel [appendArgs \
              "---- local connection flags for " $database \
              " are: " [expr {![hasNoFlags flags false] ? \
              [appendArgs \" $flags \"] : "<none>"}] \n]
        }
      }

      #
      # NOTE: Show (and log) the shared connection flags.
      #
      if {!$quiet} then {
        if {[catch {
          object invoke System.Data.SQLite.SQLiteConnection SharedFlags
        } sharedFlags] == 0} then {
          if {![info exists ::no(emitSharedFlags)] && \
              (![info exists ::no(emitSharedFlagsIfNone)] || \
               ![hasNoFlags sharedFlags true])} then {
            tputs $::test_channel [appendArgs \
                "---- shared connection flags for " $database \
                " are: " [expr {![hasNoFlags sharedFlags true] ? \
                [appendArgs \" $sharedFlags \"] : "<none>"}] \n]
          }
        } else {
          if {![info exists ::no(emitSharedFlags)] && \
              ![info exists ::no(emitSharedFlagsIfUnavailable)]} then {
            tputs $::test_channel [appendArgs \
                "---- shared connection flags for " $database \
                " are: <unavailable>\n"]
          }
        }
      }

      #
      # NOTE: Show (and log) the detected global connection flags, if any.
      #
      if {!$quiet} then {
        if {![info exists ::no(emitGlobalFlags)] && \
            (![info exists ::no(emitGlobalFlagsIfNone)] || \
             ![hasNoFlags ::connection_flags false])} then {
          tputs $::test_channel [appendArgs \
              "---- global connection flags are: " \
              [expr {![hasNoFlags ::connection_flags false] ? \
              [appendArgs \" $::connection_flags \"] : "<none>"}] \n]
        }
      }

      #
      # NOTE: If there are any global (per test run) connection flags currently
      #       set, use them now (i.e. by combining them with the ones for this
      #       connection).
      #
      if {[info exists ::connection_flags]} then {
        #
        # NOTE: Combine and/or replace the connection flags and then show the
        #       new value.
        #
        set flags [combineFlags $flags $::connection_flags]

        #
        # NOTE: Show (and log) the new effective connection flags.
        #
        if {!$quiet} then {
          if {![info exists ::no(emitCombinedFlags)] && \
              (![info exists ::no(emitCombinedFlagsIfNone)] || \
               ![hasNoFlags flags false])} then {
            tputs $::test_channel [appendArgs \
                "---- combined connection flags for " $database \
                " are: " [expr {![hasNoFlags flags false] ? \
                [appendArgs \" $flags \"] : "<none>"}] \n]
          }
        }
      }

      return $flags
    }

    proc getConnectionExtra { fileName extra {quiet false} } {
      #
      # NOTE: Figure out which database file name or connection string these
      #       connection props will actually apply to.  This is not necessary
      #       in quiet mode because this information is only used for logging
      #       and reporting purposes.
      #
      if {!$quiet} then {
        if {[string length $fileName] > 0} then {
          set database [appendArgs "file name \"" $fileName \"]
        } elseif {[info exists ::dataSource] && \
            ![array exists ::dataSource]} then {
          set database [appendArgs "data source \"" $::dataSource \"]
        } else {
          set database <unknown>
        }
      }

      #
      # NOTE: Show (and log) the local connection props and the associated
      #       data source or file name.
      #
      if {!$quiet} then {
        if {![info exists ::no(emitLocalExtra)] && \
            (![info exists ::no(emitLocalExtraIfNone)] || \
             ![hasNoValue extra])} then {
          tputs $::test_channel [appendArgs \
              "---- local connection properties for " $database \
              " are: " [expr {[string length $extra] > 0 ? \
              [appendArgs \" $extra \"] : "<none>"}] \n]
        }
      }

      #
      # NOTE: Show (and log) the detected global connection props, if any.
      #
      if {!$quiet} then {
        if {![info exists ::no(emitGlobalExtra)] && \
            (![info exists ::no(emitGlobalExtraIfNone)] || \
             ![hasNoValue ::connection_extra])} then {
          tputs $::test_channel [appendArgs \
              "---- global connection properties are: " \
              [expr {![hasNoValue ::connection_extra] ? \
              [appendArgs \" $::connection_extra \"] : "<none>"}] \n]
        }
      }

      #
      # NOTE: If there are any global (per test run) connection props currently
      #       set, use them now (i.e. by combining them with the ones for this
      #       connection).
      #
      if {[info exists ::connection_extra]} then {
        #
        # NOTE: Combine and/or replace the connection props and then show the
        #       new value.
        #
        set extra [combineExtra $::connection_extra $extra]

        #
        # NOTE: Show (and log) the new effective connection props.
        #
        if {!$quiet} then {
          if {![info exists ::no(emitCombinedExtra)] && \
              (![info exists ::no(emitCombinedExtraIfNone)] || \
               ![hasNoValue extra])} then {
            tputs $::test_channel [appendArgs \
                "---- combined connection properties for " $database \
                " are: " [expr {![hasNoValue extra] ? \
                [appendArgs \" $extra \"] : "<none>"}] \n]
          }
        }
      }

      return $extra
    }

    proc getFlagsProperty { {flags ""} {quiet false} } {
      #
      # NOTE: Determine what the combined (global and local) connection
      #       flags should be, possibly quietly.
      #
      set flags [getConnectionFlags "" $flags $quiet]

      #
      # NOTE: If no global or local connection flags were specified, the
      #       default connection flags should be used; therefore, return
      #       an empty string in that case.
      #
      if {[string length $flags] == 0} then {
        return ""
      }

      #
      # NOTE: In order to check if the default connection flags are being used
      #       it is necessary to attempt a conversion to the actual enumerated
      #       type.  Failing that, the check against the default value will be
      #       skipped.
      #
      if {[catch {
        set error null; # IGNORED

        object invoke Utility TryParseFlagsEnum "" \
            System.Data.SQLite.SQLiteConnectionFlags "" $flags null true \
            true true error
      } value]} then {
        #
        # NOTE: Attempting to parse the connection flags caused a script
        #       error.  Emit a warning to the test log file and continue
        #       using an emtpy string instead.
        #
        tlog [appendArgs \
            "==== WARNING: failed to parse connection flags, error: " \
            \n\t $value \n]

        set value ""
      }

      #
      # NOTE: If the combined flags string could not actually be converted
      #       to the enumerated type it is the default value, then just use
      #       it verbatim; otherwise, just return an empty string.  In that
      #       case, the default connection flags will be used.
      #
      if {[string length $value] == 0 || $value ne "Default"} then {
        #
        # WARNING: This returns the string value of the combined flags, not
        #          the enumerated value.  This is by design and should not
        #          be changed without careful consideration (e.g. it would
        #          prevent the SQLiteConnection class from allowing invalid
        #          ["magical"] meta-flags).
        #
        return [appendArgs "Flags=" $flags \;]
      }

      return ""
    }

    proc getExtraProperties { {extra ""} {quiet false} } {
      #
      # NOTE: Determine what the combined (global and local) connection
      #       props should be, possibly quietly.
      #
      return [getConnectionExtra "" $extra $quiet]
    }

    proc getTestProperties { {flags ""} {extra ""} {quiet false} } {
      #
      # NOTE: Initially, no (extra?) connection string properties for the
      #       test.
      #
      set result ""

      #
      # NOTE: Start with "Flags" property for the new connection, if any.
      #
      set flags [getFlagsProperty $flags $quiet]

      if {[string length $flags] > 0} then {
        append result $flags
      }

      #
      # NOTE: Next, the name of the current test file, if available.  This
      #       is only used for debugging.
      #
      if {[info exists ::test_file] && \
          [string length $::test_file] > 0} then {
        append result TestFile= $::test_file \;
      }

      #
      # NOTE: Next, the name of the current test, if available.  This is
      #       only used for debugging.
      #
      if {[info exists ::eagle_tests(CurrentName)] && \
          [string length $::eagle_tests(CurrentName)] > 0} then {
        append result TestName= $::eagle_tests(CurrentName) \;
      }

      #
      # NOTE: Finally, with the extra properties for the new connection, if
      #       any.
      #
      set extra [getExtraProperties $extra $quiet]

      if {[string length $extra] > 0} then {
        append result $extra
      }

      return $result
    }

    proc enableSharedCache { channel enable {quiet false} } {
      if {[catch {
        object invoke -flags +NonPublic \
            System.Data.SQLite.UnsafeNativeMethods \
            sqlite3_enable_shared_cache [expr int($enable)]
      } result] == 0} then {
        if {!$quiet} then {
          tputs $channel [appendArgs \
              "---- call sqlite3_enable_shared_cache(" $enable \
              ")... ok: " $result \n]
        }
      } else {
        if {!$quiet} then {
          tputs $channel [appendArgs \
              "---- call sqlite3_enable_shared_cache(" $enable \
              ")... error: " \n\t $result \n]
        }
      }
    }

    proc getDbFileHeader {} {
      return "SQLite format 3\0"
    }

    proc readDbFileHeader { fileName } {
      set channel [open $fileName RDONLY]
      makeBinaryChannel $channel
      set header [getDbFileHeader]
      set result [read $channel [string length $header]]
      close $channel
      return $result
    }

    proc page1MustBeEncrypted {} {
      if {[haveConstraint System.Data.SQLite.SEE]} then {
        return true
      }

      if {[info exists ::env(SQLite_LegacyEncryptPage1)]} then {
        return true
      }

      return false
    }

    proc setupDb {
            fileName {mode ""} {dateTimeFormat ""} {dateTimeKind ""} {flags ""}
            {extra ""} {qualify true} {delete true} {uri false}
            {temporary true} {varName db} {quiet false} } {
      #
      # NOTE: First, see if our caller has requested an in-memory database.
      #
      set isMemory [isMemoryDb $fileName]

      #
      # NOTE: For now, all test databases used by the test suite are placed
      #       into the database directory.  Each database and related files
      #       used by a test should be cleaned up by that test using the
      #       "cleanupDb" procedure, below.
      #
      if {!$isMemory && $qualify} then {
        set fileName [file join [getDatabaseDirectory] [file tail $fileName]]
      }

      #
      # NOTE: By default, delete any pre-existing database with the same file
      #       name if it currently exists.
      #
      if {!$isMemory && $delete && [file exists $fileName]} then {
        #
        # NOTE: Attempt to delete any pre-existing database with the same file
        #       name.
        #
        if {[catch {file delete $fileName} error]} then {
          #
          # NOTE: We somehow failed to delete the file, report why.
          #
          if {!$quiet} then {
            tputs $::test_channel [appendArgs \
                "==== WARNING: failed to delete database file \"" $fileName \
                "\" during setup, error: " \n\t $error \n]
          }
        }
      }

      #
      # NOTE: Refer to the specified variable (e.g. "db") in the context of our
      #       caller.  The handle to the opened database will be stored there.
      #
      upvar 1 $varName db

      #
      # NOTE: Start building the connection string.  The only required portion
      #       of the connection string is the data source, which contains the
      #       database file name itself.  If our caller wants to use a URI as
      #       the data source, use the FullUri connection string property to
      #       prevent the data source string from being mangled.
      #
      if {$uri} then {
        set connection {FullUri=${fileName}}
      } else {
        set connection {Data Source=${fileName}}
      }

      #
      # NOTE: Since this procedure has no special knowledge of what the default
      #       setting is for the ToFullPath connection string propery, always
      #       add the value we know about to the connection string.
      #
      append connection {;ToFullPath=${qualify}}

      #
      # NOTE: If our caller specified a journal mode, add the necessary portion
      #       of the connection string now.
      #
      if {[string length $mode] > 0} then {
        append connection {;Journal Mode=${mode}}
      }

      #
      # NOTE: If our caller specified a DateTime format, add the necessary
      #       portion of the connection string now.
      #
      if {[string length $dateTimeFormat] > 0} then {
        append connection {;DateTimeFormat=${dateTimeFormat}}
      }

      #
      # NOTE: If our caller specified a DateTimeKind, add the necessary portion
      #       of the connection string now.
      #
      if {[string length $dateTimeKind] > 0} then {
        append connection {;DateTimeKind=${dateTimeKind}}
      }

      #
      # NOTE: Figure out what the final flags for this connection need to be.
      #
      set flags [getConnectionFlags $fileName $flags $quiet]

      #
      # NOTE: If our caller specified some SQLiteConnectionFlags, add the
      #       necessary portion of the connection string now.
      #
      if {[string length $flags] > 0} then {
        append connection {;Flags=${flags}}
      }

      #
      # NOTE: Figure out what the final props for this connection need to be.
      #
      set extra [getConnectionExtra $fileName $extra $quiet]

      #
      # NOTE: If our caller specified an extra payload to the connection
      #       string, append it now.
      #
      if {[string length $extra] > 0} then {
        append connection \; $extra
      }

      #
      # NOTE: Add the name of the current test file, if available.  This is
      #       only used for debugging.
      #
      if {[info exists ::test_file] && \
          [string length $::test_file] > 0} then {
        append connection {;TestFile=${::test_file}}
      }

      #
      # NOTE: Add the name of the current test, if available.  This is only
      #       used for debugging.
      #
      if {[info exists ::eagle_tests(CurrentName)] && \
          [string length $::eagle_tests(CurrentName)] > 0} then {
        append connection {;TestName=${::eagle_tests(CurrentName)}}
      }

      #
      # NOTE: For clarity, append a final semicolon to the connection string.
      #
      append connection \;

      #
      # NOTE: Open the database connection now, placing the opaque handle value
      #       into the variable specified by our caller.
      #
      set db [sql open -type SQLite [subst $connection]]

      #
      # NOTE: Configure the temporary directory for the newly opened database
      #       connection now unless our caller forbids it.
      #
      if {$temporary && ![info exists ::no(setTemporaryDirectory)]} then {
        sql execute $db [appendArgs \
            "PRAGMA temp_store_directory = \"" [getTemporaryDirectory] \"\;]
      }

      #
      # NOTE: Perform any extra per-connection setup for the newly opened
      #       database now unless our caller forbids it.
      #
      set executeOnSetup [getExecuteOnSetup]

      if {[string length $executeOnSetup] > 0 && \
          ![info exists ::no(executeOnSetup)]} then {
        #
        # NOTE: This command may raise an error; if so, that is fine, as
        #       the enclosing test will then fail.  The [subst] command is
        #       used on the SQL in case it needs to refer to state in our
        #       context.
        #
        sql execute $db [subst $executeOnSetup]
      }

      #
      # NOTE: Always return the connection handle upon success.
      #
      return $db
    }

    proc getDbConnection { {varName db} } {
      #
      # NOTE: Refer to the specified variable (e.g. "db") in the context of our
      #       caller.  The handle to the database previously opened via the
      #       [setupDb] procedure should be stored there.
      #
      upvar 1 $varName db

      #
      # NOTE: This returns the ADO.NET IDbConnection object instance for the
      #       specified databse handle.  Since getting this object relies upon
      #       Eagle internals, great care should be taken to avoid disposing of
      #       this object or otherwise putting it into an invalid state.
      #
      if {[info exists db]} then {
        if {[catch {
          object invoke -flags +NonPublic -objectflags +NoDispose -alias \
              Interpreter.GetActive.connections Item $db
        } result] == 0} then {
          #
          # NOTE: Success, return the opaque object handle.
          #
          return $result
        } else {
          #
          # NOTE: Failure, report why.
          #
          tputs $::test_channel [appendArgs \
              "==== WARNING: failed to get connection handle for database \"" \
              $db "\", error: " \n\t $result \n]
        }
      }

      #
      # NOTE: Failure, return an obviously invalid opaque object handle.
      #
      return ""
    }

    proc freeDbConnection {
            {varName connection} {dispose true} {quiet false} } {
      #
      # NOTE: Refer to the specified variable (e.g. "connection") in the
      #       context of our caller.  The opaque object handle for an ADO.NET
      #       connection previously returned by [getDbConnection] should be
      #       stored there.
      #
      upvar 1 $varName connection

      #
      # NOTE: Attempt to remove the opaque object handle from the interpreter
      #       now.  This [object dispose] call will not actually dispose of
      #       the underlying object because the +NoDispose flag was set on it
      #       during creation of the opaque object handle.
      #
      if {[info exists connection] && [catch {
        set command [list object dispose]

        if {!$dispose} then {
          lappend command -nodispose
        }

        lappend command $connection; eval $command
      } error]} then {
        if {!$quiet} then {
          tputs $::test_channel [appendArgs \
              "==== WARNING: failed to remove connection object handle \"" \
              $connection "\", error: " \n\t $error \n]
        }
      }
    }

    proc addDbConnection { connection {varName db} } {
      #
      # NOTE: Refer to the specified variable (e.g. "db") in the context of our
      #       caller.
      #
      upvar 1 $varName db

      #
      # NOTE: Create a correctly formatted name for the database connection to
      #       be added to the list managed by the Eagle interpreter.
      #
      set db [object invoke -flags +NonPublic \
          Eagle._Components.Private.FormatOps DatabaseObjectName $connection \
          SQLiteConnection [object invoke Interpreter.GetActive NextId]]

      #
      # NOTE: Add the database connection provided by our caller to the list
      #       of those known to the Eagle interpreter.
      #
      object invoke -flags +NonPublic Interpreter.GetActive.connections Add \
          $db $connection
    }

    proc removeDbConnection { {varName db} } {
      upvar 1 $varName db

      object invoke -flags +NonPublic \
          Interpreter.GetActive.connections Remove $db
    }

    proc removeDbTransaction { transaction } {
      #
      # NOTE: Remove the database transaction provided by our caller from the
      #       list of those known to the Eagle interpreter.
      #
      object invoke -flags +NonPublic Interpreter.GetActive.transactions \
          Remove $transaction
    }

    proc getRowsFromDataTable { dataTable {valueCallback ""} } {
      set rows [list]
      set count [$dataTable Columns.Count]

      for {set index 0} {$index < $count} {incr index} {
        set dataColumn [$dataTable -alias Columns.get_Item $index]
        set names($index) [$dataColumn ColumnName]
      }

      #
      # NOTE: Setup some Tcl return code constants.
      #
      set Ok 0; set Error 1; set Return 2; set Break 3; set Continue 4

      object foreach -alias dataRow [set dataRows [$dataTable Rows]] {
        set row [list]

        for {set index 0} {$index < $count} {incr index} {
          set value [$dataRow -create -alias get_Item $index]

          if {[string length $valueCallback] > 0} then {
            set code [catch {
              $valueCallback $dataTable $dataRow $index $value
            } newValue]

            if {$code == $Ok} then {
              #
              # NOTE: Use the specified (new?) row value.
              #
              lappend row [list $names($index) $newValue]
            } elseif {$code == $Error} then {
              #
              # NOTE: Use the (new?) NULL row value.
              #
              lappend row [list $names($index)]
            } elseif {$code == $Return} then {
              #
              # NOTE: Skip remaining values for this row.
              #
              break
            } elseif {$code == $Break} then {
              #
              # NOTE: Skip processing this row value.
              #
            } elseif {$code == $Continue} then {
              #
              # NOTE: Use default row value handling.
              #
            }
          } else {
            set code $Continue
          }

          if {$code == $Continue} then {
            if {[isNonNullObjectHandle $value] && \
                ![object invoke Convert IsDBNull $value]} then {
              lappend row [list $names($index) [$value ToString]]
            } else {
              lappend row [list $names($index)]
            }
          }
        }

        lappend rows $row
      }

      return $rows
    }

    proc dumpRowsFromDataTable { channel rows } {
      set sequence 1

      foreach row $rows {
        tputs $channel [appendArgs \
            [expr {$sequence > 1 ? "\n" : ""}] "---- ROW #" $sequence :\n]

        foreach pair $row {
          if {[llength $pair] >= 2} then {
            tputs $channel [appendArgs \t \
                [list [lindex $pair 0]] ": " [list [lindex $pair 1]] \n]
          } elseif {[llength $pair] == 1} then {
            tputs $channel [appendArgs \t \
                [list [lindex $pair 0]] ": <null>\n"]
          } else {
            tputs $channel \t<empty>\n; # NOTE: No data?
          }
        }

        incr sequence
      }
    }

    proc cleanupDb { fileName {varName db} {collect true} {qualify true}
            {delete true} {pool true} {quiet false} } {
      #
      # NOTE: First, if requested, attempt to clear all connection pools in
      #       this application domain.
      #
      if {$pool && [catch {
        object invoke System.Data.SQLite.SQLiteConnection ClearAllPools
      } error]} then {
        if {!$quiet} then {
          tputs $::test_channel [appendArgs \
              "==== WARNING: failed to clear all pools, error: " \
              \n\t $error \n]
        }
      }

      #
      # NOTE: Attempt to force all pending "garbage" objects to be collected,
      #       including SQLite statements and backup objects; this should allow
      #       the underlying database file to be deleted.
      #
      if {$collect} then {
        collectGarbage $::test_channel
      }

      #
      # NOTE: Refer to the specified variable (e.g. "db") in the context of
      #       our caller.  The handle to the database previously opened via
      #       the [setupDb] procedure should be stored there.
      #
      upvar 1 $varName db

      #
      # NOTE: Close the connection to the database now.  This should allow us
      #       to delete the underlying database file.
      #
      if {[info exists db] && [catch {sql close $db} error]} then {
        if {!$quiet} then {
          tputs $::test_channel [appendArgs \
              "==== WARNING: failed to close database \"" $db \
              "\", error: " \n\t $error \n]
        }

        removeDbConnection
      }

      #
      # NOTE: This procecure is now done with the database connection.  The
      #       caller should be as well; therefore, unset it now.
      #
      unset -nocomplain db

      #
      # NOTE: First, see if our caller has requested an in-memory database.
      #
      set isMemory [isMemoryDb $fileName]

      #
      # NOTE: Build the full path to the database file name.  For now, all
      #       test database files are stored in the temporary directory.
      #
      if {!$isMemory && $qualify} then {
        set fileName [file join [getDatabaseDirectory] [file tail $fileName]]
      }

      #
      # NOTE: Check if the file still exists; initially, assume all files
      #       will be deleted successfully, if necessary.
      #
      set success true

      if {!$isMemory && $delete && [file exists $fileName]} then {
        #
        # NOTE: Skip deleting database files if somebody sets the global
        #       variable to prevent it.
        #
        if {![info exists ::no(cleanupDbFiles)]} then {
          #
          # NOTE: Attempt to delete the test WAL file, if any, now.
          #
          set walFileName [appendArgs $fileName -wal]

          if {[file exists $walFileName]} then {
            #
            # NOTE: If there is a WAL file, it should be zero bytes at
            #       this point.
            #
            if {[set size [file size $walFileName]] == 0} then {
              if {[catch {file delete $walFileName} error]} then {
                #
                # NOTE: We somehow failed to delete the WAL file, report
                #       why.
                #
                if {!$quiet} then {
                  tputs $::test_channel [appendArgs \
                      "==== WARNING: failed to delete WAL file \"" \
                      $walFileName "\" during cleanup, error: " \n\t \
                      $error \n]
                }

                set success false
              }
            } else {
              if {!$quiet} then {
                tputs $::test_channel [appendArgs \
                    "==== WARNING: WAL file \"" $walFileName "\" is " \
                    $size " bytes in size, skipping file deletions...\n"]
              }

              return 1; # error
            }
          }

          #
          # NOTE: Attempt to delete the test SHM file, if any, now.
          #
          set shmFileName [appendArgs $fileName -shm]

          if {[file exists $shmFileName] && \
              [catch {file delete $shmFileName} error]} then {
            if {!$quiet} then {
              tputs $::test_channel [appendArgs \
                  "==== WARNING: failed to delete SHM file \"" \
                  $shmFileName "\" during cleanup, error: " \n\t \
                  $error \n]
            }

            set success false
          }

          #
          # NOTE: Attempt to delete the test database file now.
          #
          if {[catch {file delete $fileName} error]} then {
            if {!$quiet} then {
              tputs $::test_channel [appendArgs \
                  "==== WARNING: failed to delete database file \"" \
                  $fileName "\" during cleanup, error: " \n\t \
                  $error \n]
            }

            set success false
          }
        } else {
          #
          # NOTE: Skipped deleting test database file.
          #
          if {!$quiet} then {
            tputs $::test_channel [appendArgs \
                "==== WARNING: skipped deleting database file \"" \
                $fileName "\" during cleanup\n"]
          }
        }
      }

      return [expr {$success ? 0 : 1}]
    }

    proc saveEnvironmentVariables { names {varName ""} } {
      #
      # NOTE: For each name, does the live environment variable exist?  If
      #       so, save the value for later; otherwise, make sure the saved
      #       value does not exist either.  The live environment variables
      #       ARE NOT changed by this procedure.
      #
      if {[string length $varName] == 0} then {
        set varName savedEnv
      }

      upvar 1 $varName savedEnv

      foreach name $names {
        if {[info exists ::env($name)]} then {
          set savedEnv($name) $::env($name)
        } else {
          unset -nocomplain savedEnv($name)
        }
      }

      #
      # NOTE: This is self-cleaning.  If no saved environment variables now
      #       exist, remove the array.
      #
      if {[array size savedEnv] == 0} then {
        unset -nocomplain savedEnv
      }
    }

    proc restoreEnvironmentVariables { names {varName ""} } {
      #
      # NOTE: For each name, does the saved environment variable exist?  If
      #       so, restore the saved value and unset it; otherwise, make sure
      #       the live environment variable does not exist either (i.e. it
      #       was not set to begin with).  Both saved and live environment
      #       variables ARE changed by this procedure.
      #
      if {[string length $varName] == 0} then {
        set varName savedEnv
      }

      upvar 1 $varName savedEnv

      foreach name $names {
        if {[info exists savedEnv($name)]} then {
          set ::env($name) $savedEnv($name)
          unset -nocomplain savedEnv($name)
        } else {
          unset -nocomplain ::env($name)
        }
      }

      #
      # NOTE: This is self-cleaning.  If no saved environment variables now
      #       exist, remove the array.
      #
      if {[array size savedEnv] == 0} then {
        unset -nocomplain savedEnv
      }
    }

    proc saveEagleShellEnvironment {} {
      upvar 1 savedEnv savedEnv

      saveEnvironmentVariables [list NoMutexes] savedEnv
    }

    proc restoreEagleShellEnvironment {} {
      upvar 1 savedEnv savedEnv

      restoreEnvironmentVariables [list NoMutexes] savedEnv
    }

    proc saveMdaConfigEnvironment {} {
      upvar 1 savedEnv savedEnv

      saveEnvironmentVariables [list COMPLUS_MDA] savedEnv
    }

    proc restoreMdaConfigEnvironment {} {
      upvar 1 savedEnv savedEnv

      restoreEnvironmentVariables [list COMPLUS_MDA] savedEnv
    }

    proc saveGetSettingValueEnvironment {} {
      upvar 1 savedEnv savedEnv

      saveEnvironmentVariables [list \
          No_Expand No_SQLiteGetSettingValue No_SQLiteXmlConfigFile] \
          savedEnv
    }

    proc restoreGetSettingValueEnvironment {} {
      upvar 1 savedEnv savedEnv

      restoreEnvironmentVariables [list \
          No_Expand No_SQLiteGetSettingValue No_SQLiteXmlConfigFile] \
          savedEnv
    }

    proc saveSQLiteConnectionEnvironment {} {
      upvar 1 savedEnv savedEnv

      saveEnvironmentVariables [list \
          DefaultFlags_SQLiteConnection No_SQLiteConnectionNewParser] \
          savedEnv

      upvar 1 savedConnectionFlags savedConnectionFlags

      if {[info exists ::connection_flags]} then {
        set savedConnectionFlags $::connection_flags
      } else {
        unset -nocomplain savedConnectionFlags
      }

      upvar 1 savedConnectionExtra savedConnectionExtra

      if {[info exists ::connection_extra]} then {
        set savedConnectionExtra $::connection_extra
      } else {
        unset -nocomplain savedConnectionExtra
      }
    }

    proc restoreSQLiteConnectionEnvironment {} {
      upvar 1 savedEnv savedEnv

      restoreEnvironmentVariables [list \
          DefaultFlags_SQLiteConnection No_SQLiteConnectionNewParser] \
          savedEnv

      upvar 1 savedConnectionFlags savedConnectionFlags

      if {[info exists savedConnectionFlags]} then {
        set ::connection_flags $savedConnectionFlags
        unset -nocomplain savedConnectionFlags
      } else {
        unset -nocomplain ::connection_flags
      }

      upvar 1 savedConnectionExtra savedConnectionExtra

      if {[info exists savedConnectionExtra]} then {
        set ::connection_extra $savedConnectionExtra
        unset -nocomplain savedConnectionExtra
      } else {
        unset -nocomplain ::connection_extra
      }
    }

    proc saveSQLiteConvertEnvironment {} {
      upvar 1 savedEnv savedEnv

      saveEnvironmentVariables [list \
          Use_SQLiteConvert_DefaultDbType Use_SQLiteConvert_DefaultTypeName] \
          savedEnv
    }

    proc restoreSQLiteConvertEnvironment {} {
      upvar 1 savedEnv savedEnv

      restoreEnvironmentVariables [list \
          Use_SQLiteConvert_DefaultDbType Use_SQLiteConvert_DefaultTypeName] \
          savedEnv
    }

    proc setupDbInterruptCallback { channel log } {
      tputs $channel "---- setting up debugger interrupt callback... "

      if {[catch {
        saveEnvironmentVariables [list \
            quietFindInterpreterTestPath quietSetupInterpreterTestPath]

        try {
          #
          # NOTE: Prevent the vendor script from being noisy when creating
          #       the isolated interpreter.
          #
          set ::env(quietFindInterpreterTestPath) 1
          set ::env(quietSetupInterpreterTestPath) 1

          #
          # NOTE: Make sure the script debugger and the isolated interpreter
          #       are setup and ready for use.
          #
          debug setup true true

          #
          # NOTE: Load the necessary packages into the isolated interpreter.
          #
          debug eval {
            package require Eagle
            package require Eagle.Library
            package require Eagle.Test
          }

          #
          # NOTE: Copy the necessary variables into the isolated interpreter.
          #
          debug invoke 0 set ::test_channel $channel; # NOTE: For [tputs].
          debug invoke 0 set ::test_log $log; # NOTE: For [tlog].

          #
          # NOTE: Install the callback script to be evaluated in the isolated
          #       interpreter when this interpreter is interrupted by script
          #       cancellation, etc.
          #
          debug callback apply {{sender e} {
            #
            # NOTE: Check if this debugger callback is one that we care about.
            #
            set interruptTypes [split [$e InterruptType] ", "]

            if {"Canceled" in $interruptTypes || \
                "Unwound" in $interruptTypes} then {
              #
              # NOTE: Make sure the [object] command is available.  Since
              #       this is an isolated interpreter, check for it the hard
              #       way.
              #
              if {[llength [info commands object]] > 0} then {
                #
                # NOTE: Iterate through all database connections known to the
                #       parent interpreter.
                #
                object foreach -alias pair [object invoke -flags +NonPublic \
                    $e Interpreter.connections] {
                  #
                  # NOTE: Attempt to cancel any SQL queries in progress on
                  #       this database connection.
                  #
                  if {[catch {$pair Value.Cancel} error]} then {
                    tputs $::test_channel [appendArgs \n \
                        "==== WARNING: failed to cancel query for " \
                        "connection \"" [$pair Key] "\", error: " \n\t \
                        $error \n]
                  }
                }
              } else {
                tputs $::test_channel [appendArgs \n \
                    "==== WARNING: cannot cancel any queries: " \
                    "the \"object\" command is not available\n"]
              }
            }
          }}
        } finally {
          restoreEnvironmentVariables [list \
              quietFindInterpreterTestPath quietSetupInterpreterTestPath]
        }
      } error] == 0} then {
        addConstraint interruptCallback.sqlite3

        tputs $channel yes\n
      } else {
        tputs $channel [appendArgs "no, error: " \n\t $error \n]
      }
    }

    proc cleanupFile { fileName {collect true} {force false} } {
      #
      # NOTE: Attempt to force all pending "garbage" objects to be collected,
      #       including SQLite statements and backup objects; this should allow
      #       the underlying database file to be deleted.
      #
      if {$collect} then {
        collectGarbage $::test_channel
      }

      #
      # NOTE: Check if the file still exists.
      #
      if {[file exists $fileName]} then {
        #
        # NOTE: Skip deleting test files if somebody sets the global variable
        #       to prevent it.
        #
        if {$force || ![info exists ::no(cleanupFile)]} then {
          #
          # NOTE: Attempt to delete the test file now.
          #
          if {[set code [catch {file delete $fileName} error]]} then {
            #
            # NOTE: We somehow failed to delete the file, report why.
            #
            tputs $::test_channel [appendArgs \
                "==== WARNING: failed to delete test file \"" $fileName \
                "\" during cleanup, error: " \n\t $error \n]
          }
        } else {
          #
          # NOTE: Show that we skipped deleting the file.
          #
          set code 0

          tputs $::test_channel [appendArgs \
              "==== WARNING: skipped deleting test file \"" $fileName \
              "\" during cleanup\n"]
        }
      } else {
        #
        # NOTE: The file does not exist, success!
        #
        set code 0
      }

      return $code
    }

    proc cleanupMemory { varName {quiet false} } {
      if {[haveSQLiteObjectCommand] && \
          [string length $varName] > 0} then {
        #
        # NOTE: Refer to the specified variable (e.g. "connection") in the
        #       context of our caller.  The opaque object handle for an
        #       ADO.NET connection previously returned by [getDbConnection]
        #       should be stored there.
        #
        upvar 1 $varName connection

        if {[catch {
          object invoke $connection ReleaseMemory
        } result]} then {
          if {!$quiet} then {
            tputs $::test_channel [appendArgs \
                "==== WARNING: failed to release database memory, error: " \
                \n\t $result \n]
          }
        }
      }

      if {[llength [info commands debug]] > 0} then {
        if {[catch {
          uplevel 1 [list debug purge]
        } result]} then {
          if {!$quiet} then {
            tputs $::test_channel [appendArgs \
                "==== WARNING: failed to purge call frame, error: " \
                \n\t $result \n]
          }
        }

        if {[catch {
          uplevel 1 [list debug cleanup]
        } result]} then {
          if {!$quiet} then {
            tputs $::test_channel [appendArgs \
                "==== WARNING: failed to cleanup interpreter, error: " \
                \n\t $result \n]
          }
        }

        if {[catch {
          uplevel 1 [list debug collect]
        } result]} then {
          if {!$quiet} then {
            tputs $::test_channel [appendArgs \
                "==== WARNING: failed to collect garbage, error: " \
                \n\t $result \n]
          }
        }
      }
    }

    proc setupMemoryCounters { varName } {
      if {[haveSQLiteObjectCommand]} then {
        upvar 1 $varName counter

        set counter(1) [object create -alias \
            System.Diagnostics.PerformanceCounter Process \
            "Working Set" [file rootname [file tail $::bin_file]]]

        set counter(2) [object create -alias \
            System.Diagnostics.PerformanceCounter Process \
            "Working Set Peak" [file rootname [file tail $::bin_file]]]

        set counter(3) [object create -alias \
            System.Diagnostics.PerformanceCounter Process \
            "Private Bytes" [file rootname [file tail $::bin_file]]]
      }

      return ""
    }

    proc reportMemoryCounters { channel varName prefix } {
      if {[haveSQLiteObjectCommand]} then {
        upvar 1 $varName counter

        tputs $channel [appendArgs \
            "---- " $prefix " counter \"" \
            [object invoke $counter(1) CounterName] "\" value is " \
            [object invoke $counter(1) RawValue] \n]

        tputs $channel [appendArgs \
            "---- " $prefix " counter \"" \
            [object invoke $counter(2) CounterName] "\" value is " \
            [object invoke $counter(2) RawValue] \n]

        tputs $channel [appendArgs \
            "---- " $prefix " counter \"" \
            [object invoke $counter(3) CounterName] "\" value is " \
            [object invoke $counter(3) RawValue] \n]
      }
    }

    proc collectGarbage { channel {milliseconds 1000} {quiet true} } {
      if {[haveSQLiteObjectCommand]} then {
        if {[catch {
          object invoke GC GetTotalMemory false
        } result] == 0} then {
          if {!$quiet} then {
            tputs $channel [appendArgs \
                "---- memory in use by the CLR before collection... " \
                $result " bytes\n"]
          }
        } else {
          if {!$quiet} then {
            tputs $channel [appendArgs \
                "==== WARNING: failed to get CLR memory usage, error: " \
                \n\t $result \n]
          }
        }
      }

      #########################################################################

      #
      # NOTE: Repeatedly attempt to collect garbage until the allotted number
      #       of milliseconds has elapsed.  Always attempt to collect garbage
      #       at least once.
      #
      if {[haveSQLiteObjectCommand]} then {
        set start [clock seconds]
        set stop [expr {$start + ($milliseconds / 1000)}]

        do {
          #
          # NOTE: Attempt to force a full garbage collection now.  Report any
          #       error that is encountered if we fail.
          #
          if {[catch {
            object invoke GC GetTotalMemory true
          } error]} then {
            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "==== WARNING: failed full garbage collection, error: " \
                  \n\t $error \n]
            }
          }

          set now [clock seconds]
        } while {$start <= $now && $now < $stop}
      }

      #########################################################################

      if {[haveSQLiteObjectCommand]} then {
        if {[catch {
          object invoke GC GetTotalMemory false
        } result] == 0} then {
          if {!$quiet} then {
            tputs $channel [appendArgs \
                "---- memory in use by the CLR after collection... " \
                $result " bytes\n"]
          }
        } else {
          if {!$quiet} then {
            tputs $channel [appendArgs \
                "==== WARNING: failed to get CLR memory usage, error: " \
                \n\t $result \n]
          }
        }
      }
    }

    proc getSQLiteHandleCounts { channel {quiet false} } {
      set result [list]

      if {[haveSQLiteObjectCommand] && \
          [haveSQLiteDefineConstant COUNT_HANDLE]} then {
        #
        # NOTE: Add each critical handle count to the resulting list.
        #
        foreach name [list \
            connectionCount statementCount backupCount blobCount] {
          if {[catch {
            object invoke -flags +NonPublic \
                System.Data.SQLite.DebugData $name
          } value] == 0} then {
            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "---- critical handle count \"" $name "\" is " $value \n]
            }

            lappend result $value
          } else {
            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "==== WARNING: failed to get critical handle count \"" \
                  $name "\", error: " \n\t $value \n]
            }
          }
        }
      } elseif {!$quiet} then {
        #
        # NOTE: The actual handle counts are not available; therefore, just
        #       return an empty list.
        #
        tputs $channel "---- critical handle counts unavailable\n"
      }

      return $result
    }

    proc shutdownSQLite { channel {force false} {quiet false} } {
      #
      # NOTE: Make sure that SQLite core library is completely shutdown.  This
      #       is used by tests that change configuration options and/or those
      #       that need to make sure logging is initialized (i.e. just in case
      #       the SQLite core library was initialized in the process prior to
      #       the SQLiteLog class being able to setup its logging callback).
      #       Normally, this should only be performed if SQLite is loaded and
      #       ready for use by the test suite.
      #
      if {$force || [isSQLiteReady]} then {
        #
        # BUGFIX: Make sure that any "leaked" transactions and/or connections
        #         are cleaned up before calling the native shutdown function.
        #
        foreach transaction [info transactions] {
          if {[string match \
              System#Data#SQLite#SQLiteTransaction#* $transaction]} then {
            if {[catch {
              sql transaction rollback $transaction
            } error] == 0} then {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "---- rolled back leaked transaction \"" \
                    $transaction \"\n]
              }
            } else {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "==== WARNING: failed to rollback leaked transaction \"" \
                    $transaction "\", error: " \n\t $error \n]
              }
            }
          }
        }

        foreach db [info connections] {
          if {[string match \
              System#Data#SQLite#SQLiteConnection#* $db]} then {
            if {[catch {sql close $db} error] == 0} then {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "---- closed leaked database \"" $db \"\n]
              }
            } else {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "==== WARNING: failed to close leaked database \"" \
                    $db "\", error: " \n\t $error \n]
              }
            }
          }
        }

        #
        # BUGFIX: Before calling the native shutdown function, make sure
        #         both of the PRAGMA related directory names are freed.
        #
        checkForSQLiteDirectories $channel true

        if {[catch {
          object invoke -flags +NonPublic \
              System.Data.SQLite.UnsafeNativeMethods sqlite3_shutdown
        } result] == 0} then {
          if {!$quiet} then {
            tputs $channel [appendArgs \
                "---- call sqlite3_shutdown()... ok: " $result \n]
          }
        } else {
          if {!$quiet} then {
            tputs $channel [appendArgs \
                "---- call sqlite3_shutdown()... error: " \n\t $result \n]
          }
        }
      }
    }

    proc getSettingReadCount { name {viaFile false} } {
      if {[haveConstraint buildConfiguration.Debug] && [catch {
        object invoke -flags +NonPublic -alias \
            System.Data.SQLite.DebugData GetSettingReadCounts $viaFile
      } settingReadCounts] == 0} then {
        if {[string length $name] > 0} then {
          if {[$settingReadCounts TryGetValue $name value]} then {
            tputs $::test_channel [appendArgs \
                "---- setting \"" $name "\" was read " $value " times" \
                [expr {$viaFile ? " from the configuration file" : ""}] \n]

            return $value
          }
        } else {
          set nameCount [$settingReadCounts Count]
          set valueCount 0

          object foreach -alias pair $settingReadCounts {
            incr valueCount [$pair Value]

            tputs $::test_channel [appendArgs \
                "---- setting \"" [$pair Key] "\" was read " [$pair Value] \
                " times" [expr {$viaFile ? " from the configuration file" : \
                ""}] \n]
          }

          return [list $nameCount $valueCount]
        }
      }

      if {[string length $name] > 0} then {
        tputs $::test_channel [appendArgs \
            "---- setting \"" $name "\" was not read" [expr {$viaFile ? \
            " from the configuration file" : ""}] \n]
      } else {
        tputs $::test_channel [appendArgs \
            "---- no settings were read" [expr {$viaFile ? \
            " from the configuration file" : ""}] \n]
      }

      return -1
    }

    proc getCreateCount {} {
      if {[isDotNetCore]} then {
        if {[catch {
          #
          # TODO: For reasons that are unclear, this next command will
          #       sometimes fail when running on .NET Core 2.x.
          #
          object invoke -flags +NonPublic \
              "System.Data.SQLite.SQLiteBase, System.Data.SQLite" \
              _createCount
        } result] == 0} then {
          return $result
        }
      }

      if {[catch {
        object invoke -flags +NonPublic [appendArgs \
            "System.Data.SQLite.SQLiteBase, " [lindex [object \
            load System.Data.SQLite] 0]] _createCount
      } result] == 0} then {
        return $result
      }

      error "could not figure out how to obtain create count"
    }

    proc getDisposeCount {} {
      if {[isDotNetCore]} then {
        if {[catch {
          #
          # TODO: For reasons that are unclear, this next command will
          #       sometimes fail when running on .NET Core 2.x.
          #
          object invoke -flags +NonPublic \
              "System.Data.SQLite.SQLiteBase, System.Data.SQLite" \
              _disposeCount
        } result] == 0} then {
          return $result
        }
      }

      if {[catch {
        object invoke -flags +NonPublic [appendArgs \
            "System.Data.SQLite.SQLiteBase, " [lindex [object \
            load System.Data.SQLite] 0]] _disposeCount
      } result] == 0} then {
        return $result
      }

      error "could not figure out how to obtain dispose count"
    }

    proc getOtherCount { name } {
      if {[haveConstraint buildConfiguration.Debug] && [catch {
        object invoke -flags +NonPublic -alias \
            System.Data.SQLite.DebugData GetOtherCounts
      } otherCounts] == 0} then {
        if {[string length $name] > 0} then {
          if {[$otherCounts TryGetValue $name value]} then {
            tputs $::test_channel [appendArgs \
                "---- other counter \"" $name "\" has value " $value \n]

            return $value
          }
        } else {
          set nameCount [$otherCounts Count]
          set valueCount 0

          object foreach -alias pair $otherCounts {
            incr valueCount [$pair Value]

            tputs $::test_channel [appendArgs \
                "---- other counter \"" [$pair Key] "\" has value " \
                [$pair Value] \n]
          }

          return [list $nameCount $valueCount]
        }
      }

      if {[string length $name] > 0} then {
        tputs $::test_channel [appendArgs \
            "---- other counter \"" $name "\" has no value\n"]
      } else {
        tputs $::test_channel "---- there are no other counters\n"
      }

      return -1
    }

    proc reportSQLiteResources {
            channel {quiet false} {reset true} {collect true} } {
      #
      # NOTE: If possible, always reset the cached assembly directory
      #       and the cached XML configuration file name.
      #
      if {[haveSQLiteObjectCommand]} then {
        if {[catch {
          object invoke -flags +NonPublic \
              System.Data.SQLite.UnsafeNativeMethods \
              ResetCachedAssemblyDirectory
        } error] == 0} then {
          if {!$quiet} then {
            tputs $channel "---- reset cached assembly directory\n"
          }
        } else {
          if {!$quiet} then {
            tputs $channel [appendArgs \
                "==== WARNING: failed to reset cached assembly directory, " \
                "error: " \n\t $error \n]
          }
        }

        if {[catch {
          object invoke -flags +NonPublic \
              System.Data.SQLite.UnsafeNativeMethods \
              ResetCachedXmlConfigFileName
        } error] == 0} then {
          if {!$quiet} then {
            tputs $channel "---- reset cached XML configuration file name\n"
          }
        } else {
          if {!$quiet} then {
            tputs $channel [appendArgs \
                "==== WARNING: failed to reset cached XML configuration " \
                "file name, error: " \n\t $error \n]
          }
        }
      }

      #
      # NOTE: If available, report on (and possibly reset) the runtime
      #       configuration statistics.
      #
      if {[haveSQLiteObjectCommand] && \
          [haveConstraint buildConfiguration.Debug]} then {
        if {[catch {
          object invoke -flags +NonPublic -alias \
              System.Data.SQLite.DebugData GetSettingReadCounts false
        } settingReadCounts] == 0} then {
          set nameCount [$settingReadCounts Count]
          set valueCount 0

          object foreach -alias pair $settingReadCounts {
            incr valueCount [$pair Value]

            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "---- setting \"" [$pair Key] "\" was read " \
                  [$pair Value] " times\n"]
            }
          }

          if {$reset} then {
            if {[catch {
              object invoke -flags +NonPublic -alias \
                  System.Data.SQLite.DebugData ClearSettingReadCounts false
            } error] == 0} then {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "---- reset setting statistics for the previous " \
                    $nameCount " names and " $valueCount " values read\n"]
              }
            } else {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "==== WARNING: failed to reset setting statistics for " \
                    "the previous " $nameCount " names and " $valueCount \
                    " values read, error: " \n\t $error \n]
              }
            }
          }
        }

        if {[catch {
          object invoke -flags +NonPublic -alias \
              System.Data.SQLite.DebugData GetSettingReadCounts true
        } settingFileReadCounts] == 0} then {
          set nameCount [$settingFileReadCounts Count]
          set valueCount 0

          object foreach -alias pair $settingFileReadCounts {
            incr valueCount [$pair Value]

            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "---- setting \"" [$pair Key] "\" was read " \
                  [$pair Value] " times from the configuration file\n"]
            }
          }

          if {$reset} then {
            if {[catch {
              object invoke -flags +NonPublic -alias \
                  System.Data.SQLite.DebugData ClearSettingReadCounts true
            } error] == 0} then {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "---- reset setting statistics for the previous " \
                    $nameCount " names and " $valueCount " values read " \
                    "from the configuration file\n"]
              }
            } else {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "==== WARNING: failed to reset setting statistics for " \
                    "the previous " $nameCount " names and " $valueCount \
                    " values read from the configuration file, error: " \n\t \
                    $error \n]
              }
            }
          }
        }

        if {[catch {
          object invoke -flags +NonPublic -alias \
              System.Data.SQLite.DebugData GetOtherCounts
        } otherCounts] == 0} then {
          set nameCount [$otherCounts Count]
          set valueCount 0

          object foreach -alias pair $otherCounts {
            incr valueCount [$pair Value]

            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "---- other counter \"" [$pair Key] "\" has value " \
                  [$pair Value] \n]
            }
          }

          if {$reset} then {
            if {[catch {
              object invoke -flags +NonPublic -alias \
                  System.Data.SQLite.DebugData ClearOtherCounts
            } error] == 0} then {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "---- reset other counters for the previous " \
                    $nameCount " names and " $valueCount " values\n"]
              }
            } else {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "==== WARNING: failed to reset other counters for " \
                    "the previous " $nameCount " names and " $valueCount \
                    " values, error: " \n\t $error \n]
              }
            }
          }
        }
      }

      if {[haveSQLiteObjectCommand] && \
          [haveSQLiteDefineConstant INTEROP_VIRTUAL_TABLE] && \
          [haveSQLiteDefineConstant TRACK_MEMORY_BYTES]} then {
        if {!$quiet} then {
          tputs $channel "---- current memory in use by SQLiteMemory... "
        }

        if {[catch {
          object invoke -flags +NonPublic \
              System.Data.SQLite.SQLiteMemory bytesAllocated
        } memory] == 0} then {
          if {!$quiet} then {
            tputs $channel [appendArgs $memory " bytes\n"]
          }
        } else {
          set memory unknown

          if {!$quiet} then {
            tputs $channel [appendArgs $memory \n]
          }
        }

        if {!$quiet} then {
          tputs $channel "---- maximum memory in use by SQLiteMemory... "
        }

        if {[catch {
          object invoke -flags +NonPublic \
              System.Data.SQLite.SQLiteMemory maximumBytesAllocated
        } memory] == 0} then {
          if {!$quiet} then {
            tputs $channel [appendArgs $memory " bytes\n"]
          }
        } else {
          set memory unknown

          if {!$quiet} then {
            tputs $channel [appendArgs $memory \n]
          }
        }
      }

      if {!$quiet} then {
        tputs $channel "---- current memory in use by SQLite... "
      }

      if {[haveSQLiteObjectCommand]} then {
        if {[catch {
          object invoke -flags +NonPublic \
              System.Data.SQLite.UnsafeNativeMethods sqlite3_memory_used
        } memory] == 0} then {
          if {!$quiet} then {
            tputs $channel [appendArgs $memory " bytes\n"]
          }
        } else {
          #
          # NOTE: Maybe the SQLite core library is unavailable?
          #
          set memory unknown

          if {!$quiet} then {
            tputs $channel [appendArgs $memory \n]
          }
        }
      } else {
        set memory unavailable

        if {!$quiet} then {
          tputs $channel [appendArgs $memory \n]
        }
      }

      set result $memory; # NOTE: Return memory in-use to our caller.

      if {!$quiet} then {
        tputs $channel "---- maximum memory in use by SQLite... "
      }

      if {[haveSQLiteObjectCommand]} then {
        if {[catch {
          object invoke -flags +NonPublic \
              System.Data.SQLite.UnsafeNativeMethods \
              sqlite3_memory_highwater 0
        } memory] == 0} then {
          if {!$quiet} then {
            tputs $channel [appendArgs $memory " bytes\n"]
          }
        } else {
          #
          # NOTE: Maybe the SQLite core library is unavailable?
          #
          set memory unknown

          if {!$quiet} then {
            tputs $channel [appendArgs $memory \n]
          }
        }
      } else {
        set memory unavailable

        if {!$quiet} then {
          tputs $channel [appendArgs $memory \n]
        }
      }

      if {$collect} then {
        collectGarbage $channel
      }

      if {!$quiet} then {
        tputs $channel "---- current memory in use by the CLR... "
      }

      if {[haveSQLiteObjectCommand]} then {
        if {[catch {
          object invoke GC GetTotalMemory false
        } memory] == 0} then {
          if {[string is integer -strict $memory]} then {
            if {!$quiet} then {
              tputs $channel [appendArgs $memory " bytes\n"]
            }
          } else {
            set memory invalid

            if {!$quiet} then {
              tputs $channel [appendArgs $memory \n]
            }
          }
        } else {
          set memory unknown

          if {!$quiet} then {
            tputs $channel [appendArgs $memory \n]
          }
        }
      } else {
        set memory unavailable

        if {!$quiet} then {
          tputs $channel [appendArgs $memory \n]
        }
      }

      return $result
    }

    proc resetSQLiteDirectories { channel native } {
      #
      # NOTE: Attempt to use the native API (via the managed assembly)?
      #
      if {$native} then {
        #
        # NOTE: Now make sure the database and temporary directories are
        #       reset their default values, which should be null for both.
        #       Since the sqlite3_win32_set_directory function is available,
        #       use it.
        #
        for {set index 1} {$index < 3} {incr index} {
          if {[catch {
            object invoke -flags +NonPublic \
                System.Data.SQLite.UnsafeNativeMethods \
                sqlite3_win32_set_directory $index null
          } result] == 0} then {
            tputs $channel [appendArgs \
                "---- call sqlite3_win32_set_directory(" $index \
                ", null)... ok: " $result \n]
          } else {
            tputs $channel [appendArgs \
                "---- call sqlite3_win32_set_directory(" $index \
                ", null)... error: " \n\t $result \n]
          }
        }
      } else {
        #
        # NOTE: Now make sure the database and temporary directories are
        #       reset their default values, which should be null for both.
        #       Since the sqlite3_win32_set_directory function does not
        #       appear to be available, use the associated PRAGMA commands
        #       instead.
        #
        foreach directory [list data_store_directory temp_store_directory] {
          set sql [appendArgs "PRAGMA " $directory " = \"\";"]

          if {[catch {executeSql $sql} result] == 0} then {
            tputs $channel [appendArgs \
                "---- execute PRAGMA " $directory "... ok: \"" \
                $result \"\n]
          } else {
            tputs $channel [appendArgs \
                "---- execute PRAGMA " $directory "... error: " \
                \n\t $result \n]
          }
        }
      }
    }

    proc checkForSQLiteDirectories { channel {reset false} } {
      #
      # NOTE: Check if the sqlite3_win32_set_directory function is available.
      #
      tputs $channel \
          "---- checking for function sqlite3_win32_set_directory... "

      #
      # NOTE: This call to the sqlite3_win32_set_directory function uses the
      #       invalid value 0 for the first argument.  This code is designed
      #       to check if calling the function will raise an exception (i.e.
      #       the actual result of the function does not matter as long as no
      #       directory is changed).
      #
      if {[isWindows] && [catch {
        object invoke -flags +NonPublic \
            System.Data.SQLite.UnsafeNativeMethods \
            sqlite3_win32_set_directory 0 null
      }] == 0} then {
        #
        # NOTE: Calling the sqlite3_win32_set_directory function does not
        #       cause an exception; therefore, it must be available (i.e.
        #       even though it should return a failure return code in this
        #       case).
        #
        addConstraint sqlite3_win32_set_directory

        tputs $channel yes\n

        #
        # NOTE: Does our caller want to reset the directories?
        #
        if {$reset} then {
          resetSQLiteDirectories $channel true
        }
      } else {
        tputs $channel no\n

        #
        # NOTE: Does our caller want to reset the directories?  This can only
        #       be performed if SQLite is loaded and ready for use by the test
        #       suite.
        #
        if {$reset && [isSQLiteReady]} then {
          resetSQLiteDirectories $channel false
        }
      }

      #
      # NOTE: Finally, show the current value of the database and temporary
      #       directories.  This can only be performed if SQLite is loaded
      #       and ready for use by the test suite.
      #
      if {[isSQLiteReady]} then {
        foreach directory [list data_store_directory temp_store_directory] {
          tputs $channel [appendArgs "---- checking " $directory "... "]

          set sql [appendArgs "PRAGMA " $directory \;]

          if {[catch {executeSql $sql scalar} result] == 0} then {
            tputs $channel [appendArgs "ok: \"" $result \"\n]
          } else {
            tputs $channel [appendArgs "error: " \n\t $result \n]
          }
        }
      }
    }

    proc checkForSQLiteC99MathFunctions { channel } {
      tputs $channel \
          "---- checking for SQLite C99 math functions... "

      if {[isSQLiteReady] && [catch {
        object invoke \
            System.Data.SQLite.SQLiteCommand Execute \
            "SELECT trunc(0);" NonQuery "Data Source=:memory:;"
      }] == 0} then {
        addConstraint sqlite3_c99_math

        tputs $channel yes\n
      } else {
        tputs $channel no\n
      }
    }

    proc loadSQLiteTestSettings { channel {suffix ""} {quiet false} } {
      #
      # NOTE: Skip loading the settings if their usage has been disabled.
      #
      if {![info exists ::no(sqliteTestSettings)]} then {
        #
        # NOTE: Load custom per-user and/or per-host test settings now.
        #
        if {[info exists ::tcl_platform(user)]} then {
          set userSettingsFileName [file join [getCommonDirectory] \
              [appendArgs settings $suffix . $::tcl_platform(user) .eagle]]

          if {[file exists $userSettingsFileName]} then {
            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "---- loading per-user test settings file \"" \
                  $userSettingsFileName \"...\n]
            }

            if {[catch {
              uplevel 1 [list source $userSettingsFileName]
            } error]} then {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "==== WARNING: failed to load per-user settings file \"" \
                    $userSettingsFileName "\", error: " \n\t $error \n]
              }
            }
          } else {
            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "---- skipped loading per-user test settings file \"" \
                  $userSettingsFileName "\", it does not exist\n"]
            }
          }
        }

        #######################################################################

        if {[info exists ::tcl_platform(host)]} then {
          set hostSettingsFileName [file join [getCommonDirectory] \
              [appendArgs settings $suffix . $::tcl_platform(host) .eagle]]

          if {[file exists $hostSettingsFileName]} then {
            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "---- loading per-host test settings file \"" \
                  $hostSettingsFileName \"...\n]
            }

            if {[catch {
              uplevel 1 [list source $hostSettingsFileName]
            } error]} then {
              if {!$quiet} then {
                tputs $channel [appendArgs \
                    "==== WARNING: failed to load per-host settings file \"" \
                    $hostSettingsFileName "\", error: " \n\t $error \n]
              }
            }
          } else {
            if {!$quiet} then {
              tputs $channel [appendArgs \
                  "---- skipped loading per-host test settings file \"" \
                  $hostSettingsFileName "\", it does not exist\n"]
            }
          }
        }
      }
    }

    proc copySampleDatabaseFiles {} {
      uplevel 1 {
        #
        # NOTE: Copy (or re-copy) the reference database file used for this
        #       unit test to the build directory in case it has been changed
        #       by a previous test run.
        #
        file copy -force $northwindEfDbFile \
          [file join [getBuildDirectory true] [file tail $northwindEfDbFile]]
      }
    }

    proc resetSQLiteLogSubsystem {
            channel {shutdown false} {initialize true} } {
      if {[catch {
        object invoke -flags +NonPublic System.Data.SQLite.SQLiteLog \
            Uninitialize [getTestSuite] $shutdown

        if {$shutdown} then {
          #
          # HACK: Just in case the internal SQLite database handle in
          #       the SQLiteLog class was unavailable, perform a clean
          #       shutdown of the SQLite core library now.
          #
          shutdownSQLite $channel
        }

        object invoke -flags +NonPublic System.Data.SQLite.SQLiteLog \
            _initializeDoneCount 0

        object invoke -flags +NonPublic System.Data.SQLite.SQLiteLog \
            _attemptedInitialize 0

        if {$initialize} then {
          object invoke -flags +NonPublic System.Data.SQLite.SQLiteLog \
              Initialize [getTestSuite]
        }
      } error] == 0} then {
        tputs $channel [appendArgs \
            "---- success resetting internal SQLiteLog state to " \
            [expr {$initialize ? "initialized" : "uninitialized"}] \n]
      } else {
        tputs $channel [appendArgs \
            "---- failure resetting internal SQLiteLog state to " \
            [expr {$initialize ? "initialized" : "uninitialized"}] \
            ", error: " \n\t $error \n]
      }
    }

    proc addTraceListenerForTestLogFile { channel } {
      if {[info exists ::test_log] && [file exists $::test_log]} then {
        debug trace -log true -logname [getTestSuite] -logfilename \
            $::test_log; # throw

        tputs $channel [appendArgs \
            "---- copying trace listener output to test log file \"" \
            $::test_log \"...\n]
      }
    }

    proc moveTestLogFile { path } {
      if {[info exists ::test_log] && [file exists $::test_log]} then {
        set old_test_log $::test_log
        set new_test_log [file join $path [file tail $old_test_log]]

        file copy $old_test_log $new_test_log; file delete $old_test_log
        set ::test_log $new_test_log

        if {[info exists ::test_log_path]} then {
          set ::test_log_path $path
        }

        tputs $::test_channel [appendArgs \
            "---- moved test log from \"" $old_test_log "\" to \"" \
            $new_test_log \"\n]
      }
    }

    proc showSQLiteBuildParameters { channel } {
      #
      # NOTE: Check if the native build flag has been forcibly set.
      #
      tputs $channel \
          "---- checking for System.Data.SQLite build native override... "

      set native [getBuildNative]

      if {[string length $native] > 0} then {
        addConstraint [appendArgs buildNative. $native]
        tputs $channel [appendArgs \" $native \"\n]
      } else {
        addConstraint buildNative.none
        tputs $channel <none>\n
      }

      #
      # NOTE: Check the current build year.  Basically, this indicates
      #       which version of MSBuild and/or Visual Studio was used to
      #       compile the assembly binaries under test.
      #
      tputs $channel \
          "---- checking for System.Data.SQLite build year... "

      set year [getBuildYear]

      if {[string length $year] > 0} then {
        addConstraint [appendArgs buildYear. $year]
        tputs $channel [appendArgs \" $year \"\n]
      } else {
        addConstraint buildYear.none
        tputs $channel <none>\n
      }

      tputs $channel \
          "---- checking for System.Data.SQLite build native year... "

      set year [getBuildNativeYear]

      if {[string length $year] > 0} then {
        addConstraint [appendArgs buildNativeYear. $year]
        tputs $channel [appendArgs \" $year \"\n]
      } else {
        addConstraint buildNativeYear.none
        tputs $channel <none>\n
      }

      tputs $channel \
          "---- checking for System.Data.SQLite build platform... "

      set platform [getBuildPlatform true]

      if {[string length $platform] > 0} then {
        addConstraint [appendArgs buildPlatform. $platform]
        tputs $channel [appendArgs \" $platform \"\n]
      } else {
        addConstraint buildPlatform.none
        tputs $channel <none>\n
      }

      set architecture [architectureForPlatform $platform]

      tputs $channel \
          "---- checking for System.Data.SQLite build architecture... "

      if {[string length $architecture] > 0} then {
        addConstraint [appendArgs buildArchitecture. $architecture]
        tputs $channel [appendArgs \" $architecture \"\n]
      } else {
        addConstraint buildArchitecture.none
        tputs $channel <none>\n
      }

      #
      # NOTE: Check the current build .NET Framework.  Basically, this
      #       indicates which version of the .NET Framework is being
      #       used by the assembly binaries under test.
      #
      tputs $channel \
          "---- checking for System.Data.SQLite build .NET Framework... "

      set netFx [getBuildNetFx]

      if {[string length $netFx] > 0} then {
        addConstraint [appendArgs buildFramework. $netFx]
        tputs $channel [appendArgs \" $netFx \"\n]
      } else {
        addConstraint buildFramework.none
        tputs $channel <none>\n
      }

      #
      # NOTE: Check the current build configuration.  This should normally
      #       be either "Debug" or "Release".
      #
      tputs $channel \
          "---- checking for System.Data.SQLite build configuration... "

      set configuration [getBuildConfiguration]

      if {[string length $configuration] > 0} then {
        addConstraint [appendArgs buildConfiguration. $configuration]
        tputs $channel [appendArgs \" $configuration \"\n]
      } else {
        addConstraint buildConfiguration.none
        tputs $channel <none>\n
      }

      #
      # NOTE: Check the current build configuration suffix.  This will
      #       normally be either "NetStandard20" or "NetStandard21" or
      #       an empty string.
      #
      tputs $channel \
          "---- checking for System.Data.SQLite build configuration suffix... "

      set suffix [getBuildConfigurationSuffix]

      if {[string length $suffix] > 0} then {
        addConstraint [appendArgs buildConfigurationSuffix. $suffix]
        tputs $channel [appendArgs \" $suffix \"\n]
      } else {
        addConstraint buildConfigurationSuffix.none
        tputs $channel <none>\n
      }

      tputs $channel [appendArgs \
          "---- checking for System.Data.SQLite build native configuration " \
          "suffix... "]

      set suffix [getBuildNativeConfigurationSuffix]

      if {[string length $suffix] > 0} then {
        addConstraint [appendArgs buildNativeConfigurationSuffix. $suffix]
        tputs $channel [appendArgs \" $suffix \"\n]
      } else {
        addConstraint buildNativeConfigurationSuffix.none
        tputs $channel <none>\n
      }

      #
      # NOTE: Check the current build extra directory.  This will normally
      #       be either "netstandard2.0" or an empty string.
      #
      tputs $channel \
          "---- checking for System.Data.SQLite build extra... "

      set extra [getBuildExtra]

      if {[string length $extra] > 0} then {
        addConstraint [appendArgs buildExtra. $extra]
        tputs $channel [appendArgs \" $extra \"\n]
      } else {
        addConstraint buildExtra.none
        tputs $channel <none>\n
      }

      #
      # NOTE: Check the current build native extra directory.  This will
      #       normally be an empty string.
      #
      tputs $channel \
          "---- checking for System.Data.SQLite build native extra... "

      set extra [getBuildNativeExtra]

      if {[string length $extra] > 0} then {
        addConstraint [appendArgs buildNativeExtra. $extra]
        tputs $channel [appendArgs \" $extra \"\n]
      } else {
        addConstraint buildNativeExtra.none
        tputs $channel <none>\n
      }
    }

    proc runSQLiteTestPrologue {} {
      #
      # NOTE: Skip running our custom prologue if the main one has been
      #       skipped.
      #
      if {![info exists ::no(prologue.eagle)]} then {
        #
        # NOTE: Save the environment variables that we intend to change for
        #       the test suite.
        #
        saveEnvironmentVariables \
            [list Initialize_SQLiteLog] ::testSuiteSavedEnv

        #
        # NOTE: Force the managed logging subsystem to attempt to initialize
        #       itself more than once.
        #
        set ::env(Initialize_SQLiteLog) 1

        #
        # NOTE: Load the "before-constraints" custom per-user and/or per-host
        #       test settings now.
        #
        uplevel 1 [list loadSQLiteTestSettings $::test_channel .before]

        #
        # NOTE: Check for TLS protocol support, e.g. TLS 1.2, etc.
        #
        checkForTlsOk \
            $::test_channel [list system.data.sqlite.org] $::test_timeout

        if {[haveConstraint tlsOk]} then {
          addConstraint sdsTlsOk
        }

        #
        # NOTE: Check for "reasonably" fast timing precision.
        #
        checkForTiming $::test_channel 25 sdsTiming; # 1/40th second.

        #
        # NOTE: Show (and log) the global parameters that control where the
        #       build directory should be.
        #
        showSQLiteBuildParameters $::test_channel

        #
        # NOTE: Check if the [object] command is available; if not, add some
        #       shims to make the test suite run smoother.
        #
        checkForSQLiteObjectCommand $::test_channel

        #
        # NOTE: Determine the names of the native platform and architecture.
        #
        set platform [getBuildPlatform true]
        set architecture [architectureForPlatform $platform]

        #
        # NOTE: Build a list of configuration files that we handle.
        #
        set configFileNames [list \
            System.Data.SQLite.dll.config]

        #
        # NOTE: Build a list of auxiliary Managed Debugging Assistants (MDA)
        #       configuration files that we handle.
        #
        set mdaConfigFileNames [list \
            EagleShell32.exe.mda.config Installer.exe.mda.config \
            test.exe.mda.config testlinq.exe.mda.config \
            testef6.exe.mda.config]

        #
        # NOTE: Build the list of external files that we handle.  Some of
        #       these files may be native and/or managed assemblies that
        #       are required to perform various tests.
        #
        if {[isDotNetCore]} then {
          set externalFileNames [list \
              [file join EntityFramework v6.4 lib [string map [list \
              netStandard21 netstandard2.1] [getBuildNetFx]] \
              EntityFramework.dll]]
        } else {
          set externalFileNames [list \
              [file join EntityFramework v6.2 lib [string map [list \
              Fx ""] [string map [list netFx451 netFx45 netFx452 \
              netFx45 netFx46 netFx45 netFx461 netFx45 netFx462 \
              netFx45 netFx47 netFx45 netFx471 netFx45 netFx472 \
              netFx45 netFx48 netFx45] [getBuildNetFx]]] \
              EntityFramework.dll]]
        }

        #
        # NOTE: Build the list of native assembly files that we handle.
        #
        set nativeFileNames [list]

        eval lappend nativeFileNames [getNativeLibraryFileNamesOnly]
        eval lappend nativeFileNames [getInteropAssemblyFileNamesOnly]

        #
        # NOTE: Build the list of mixed-mode assembly files that we handle.
        #
        set mixedFileNames [list]

        if {[hasRuntimeOption native]} then {
          lappend mixedFileNames System.Data.SQLite.dll
        }

        #
        # NOTE: Build the list of managed assembly files that we handle.
        #
        set managedFileNames [list \
            System.Data.SQLite.Linq.dll System.Data.SQLite.EF6.dll]

        if {![hasRuntimeOption native]} then {
          lappend managedFileNames System.Data.SQLite.dll
        }

        #
        # NOTE: Show the various lists of file names that are handled by this
        #       procedure.
        #
        tputs $::test_channel [appendArgs \
            "---- list of \"configuration\" file names is: " \
            [expr {[llength $configFileNames] > 0 ? $configFileNames : \
            "<none>"}] \n]

        tputs $::test_channel [appendArgs \
            "---- list of \"MDA configuration\" file names is: " \
            [expr {[llength $mdaConfigFileNames] > 0 ? $mdaConfigFileNames : \
            "<none>"}] \n]

        tputs $::test_channel [appendArgs \
            "---- list of \"external\" file names is: " \
            [expr {[llength $externalFileNames] > 0 ? $externalFileNames : \
            "<none>"}] \n]

        tputs $::test_channel [appendArgs \
            "---- list of \"native\" file names is: " \
            [expr {[llength $nativeFileNames] > 0 ? $nativeFileNames : \
            "<none>"}] \n]

        tputs $::test_channel [appendArgs \
            "---- list of \"mixed\" file names is: " \
            [expr {[llength $mixedFileNames] > 0 ? $mixedFileNames : \
            "<none>"}] \n]

        tputs $::test_channel [appendArgs \
            "---- list of \"managed\" file names is: " \
            [expr {[llength $managedFileNames] > 0 ? $managedFileNames : \
            "<none>"}] \n]

        #
        # NOTE: Remove any test constraints that refer to the native and/or
        #       managed assembly files that we handle unless forbidden from
        #       doing so.
        #
        if {![info exists ::no(sqliteRemoveConstraints)]} then {
          foreach fileName $configFileNames {
            removeConstraint [appendArgs file_ $fileName]
          }

          foreach fileName $mdaConfigFileNames {
            removeConstraint [appendArgs file_ $fileName]
          }

          foreach fileName $externalFileNames {
            removeConstraint [appendArgs file_ [file tail $fileName]]
          }

          foreach fileName $nativeFileNames {
            removeConstraint [appendArgs file_ $fileName]
          }

          foreach fileName $mixedFileNames {
            removeConstraint [appendArgs file_ $fileName]
          }

          foreach fileName $managedFileNames {
            removeConstraint [appendArgs file_ $fileName]
          }
        }

        #
        # NOTE: Check for the "autoSelect" runtime option.  If present,
        #       attempt to automatically select the first available
        #       build (or "release") of SQLite and System.Data.SQLite
        #       for use with the test suite.
        #
        if {[hasRuntimeOption autoSelect]} then {
          if {![checkForSQLiteBuilds $::test_channel true]} then {
            checkForSQLiteReleases $::test_channel true
          }

          #
          # NOTE: Show (and log) the global parameters that control where
          #       the build directory should be.  The auto-selection may
          #       have modified some of these parameters.
          #
          showSQLiteBuildParameters $::test_channel
        }

        #
        # NOTE: Skip all System.Data.SQLite related file handling (deleting,
        #       copying, and loading) if instructed.
        #
        if {![info exists ::no(sqliteFiles)]} then {
          #
          # NOTE: Skip trying to delete any files if instructed.
          #
          if {![info exists ::no(deleteSqliteFiles)]} then {
            if {![info exists ::no(deleteSqliteConfigFiles)]} then {
              foreach fileName $configFileNames {
                tryDeleteBinaryFile $fileName
              }
            }

            if {![info exists ::no(deleteSqliteExternalFiles)]} then {
              foreach fileName $mdaConfigFileNames {
                tryDeleteBuildFile $fileName true
              }

              foreach fileName $externalFileNames {
                tryDeleteBinaryFile $fileName
              }
            }

            if {![info exists ::no(deleteSqliteNativeFiles)]} then {
              if {![info exists ::no(deleteSqliteImplicitNativeFiles)]} then {
                foreach fileName $nativeFileNames {
                  tryDeleteAssembly $fileName
                }
              }

              if {![info exists ::no(deleteSqliteNonImplicitFiles)]} then {
                if {![info exists ::no(deleteSqlitePlatformFiles)] && \
                    [string length $platform] > 0} then {
                  foreach fileName $nativeFileNames {
                    tryDeleteAssembly $fileName $platform
                  }
                }

                if {![info exists ::no(deleteSqliteArchitectureFiles)] && \
                    [string length $architecture] > 0} then {
                  foreach fileName $nativeFileNames {
                    tryDeleteAssembly $fileName $architecture
                  }
                }
              }
            }

            if {![info exists ::no(deleteSqliteMixedFiles)]} then {
              #
              # NOTE: If the "native" runtime option is set, delete implicit
              #       mixed-mode assembly files as well.  This runtime option
              #       check is handled when building the list of mixed-mode
              #       assembly file names.
              #
              if {![info exists ::no(deleteSqliteImplicitMixedFiles)]} then {
                foreach fileName $mixedFileNames {
                  tryDeleteAssembly $fileName
                }
              }

              if {![info exists ::no(deleteSqliteNonImplicitFiles)]} then {
                if {![info exists ::no(deleteSqlitePlatformFiles)] && \
                    [string length $platform] > 0} then {
                  foreach fileName $mixedFileNames {
                    tryDeleteAssembly $fileName $platform
                  }
                }

                if {![info exists ::no(deleteSqliteArchitectureFiles)] && \
                    [string length $architecture] > 0} then {
                  foreach fileName $mixedFileNames {
                    tryDeleteAssembly $fileName $architecture
                  }
                }
              }
            }

            if {![info exists ::no(deleteSqliteManagedFiles)]} then {
              foreach fileName $managedFileNames {
                tryDeleteAssembly $fileName
              }
            }
          }

          #
          # NOTE: Show (and log) the global parameters that control where
          #       the build directory should be.
          #
          showSQLiteBuildParameters $::test_channel

          #
          # NOTE: Skip trying to verify the build directory if instructed;
          #       otherwise, make sure it actually exists or halt the entire
          #       testing process if it does not exist.
          #
          if {![info exists ::no(verifyBuildDirectory)]} then {
            #
            # NOTE: At this point, the build directories MUST exist for
            #       the testing process to continue.
            #
            set directory [getBuildDirectory false]

            if {![file exists $directory] || \
                ![file isdirectory $directory]} then {
              #
              # NOTE: Just prior to actually halting the testing process,
              #       add an error to the test log file.
              #
              tputs $::test_channel [appendArgs \
                  "---- could not verify native build directory \"" \
                  $directory "\", all testing halted\n"]

              #
              # NOTE: Raising a script error from this point should halt
              #       the testing process.
              #
              error [appendArgs \
                  "could not verify native build directory \"" \
                  $directory "\", all testing halted"]
            }

            set directory [getBuildDirectory true]

            if {![file exists $directory] || \
                ![file isdirectory $directory]} then {
              #
              # NOTE: Just prior to actually halting the testing process,
              #       add an error to the test log file.
              #
              tputs $::test_channel [appendArgs \
                  "---- could not verify managed build directory \"" \
                  $directory "\", all testing halted\n"]

              #
              # NOTE: Raising a script error from this point should halt
              #       the testing process.
              #
              error [appendArgs \
                  "could not verify managed build directory \"" \
                  $directory "\", all testing halted"]
            }

            set logDirectory $directory
          } else {
            set logDirectory [getBuildDirectory true]
          }

          #
          # NOTE: We're going to move the test log file to the directory
          #       containing the managed assemblies being tested.
          #
          moveTestLogFile $logDirectory

          #
          # NOTE: If requested, redirect captured trace listener output
          #       to the test log file.
          #
          if {[hasRuntimeOption traceToTestLogFile]} then {
            addTraceListenerForTestLogFile $::test_channel
          }

          #
          # NOTE: Skip trying to copy any files if instructed.
          #
          if {![info exists ::no(copySqliteFiles)]} then {
            if {![info exists ::no(copySqliteConfigFiles)]} then {
              tputs $::test_channel \
                  "---- copying \"configuration\" files...\n"

              foreach fileName $configFileNames {
                tryCopyBuildFile $fileName true
              }
            }

            if {![info exists ::no(copySqliteExternalFiles)]} then {
              #
              # NOTE: Copy the Managed Debugging Assistants (MDA) configuration
              #       file for the Eagle shell to the build output directory,
              #       while using each of the names of the various legacy test
              #       executables.  This will help to make sure that all the
              #       legacy tests run with exactly the same set of Managed
              #       Debugging Assistants configured.
              #
              tputs $::test_channel \
                  "---- copying \"MDA configuration\" files...\n"

              foreach fileName $mdaConfigFileNames {
                tryCopyBinaryFile EagleShell.exe.mda.config true "" $fileName
              }

              #
              # NOTE: Copy the external binaries, if any, to the directory that
              #       contains the Eagle shell.  This is typically used to make
              #       sure assemblies referenced by the ones being tested are
              #       available during the testing process.
              #
              tputs $::test_channel "---- copying \"external\" files...\n"

              foreach fileName $externalFileNames {
                tryCopyExternalFile $fileName
              }
            }

            if {![info exists ::no(copySqliteNativeFiles)]} then {
              #
              # NOTE: If the test platform is likely the default for this
              #       machine, also try to copy the native files to the
              #       binary location.
              #
              if {![info exists ::no(copySqliteImplicitNativeFiles)] && \
                  [isDefaultBuildPlatform]} then {
                tputs $::test_channel \
                    "---- copying implicit \"native\" files...\n"

                foreach fileName $nativeFileNames {
                  tryCopyAssembly $fileName false

                  if {[isDotNetCore] && ![file exists \
                      [getBuildFileName $fileName true]]} then {
                    tryCopyBinaryFile $fileName true
                  }
                }
              }

              if {![info exists ::no(copySqliteNonImplicitFiles)]} then {
                if {![info exists ::no(copySqlitePlatformFiles)] && \
                    [string length $platform] > 0} then {
                  tputs $::test_channel [appendArgs \
                      "---- copying \"native\" files for platform \"" \
                      $platform \"...\n]

                  foreach fileName $nativeFileNames {
                    tryCopyAssembly $fileName false $platform

                    if {[isDotNetCore] && ![file exists \
                        [getBuildFileName $fileName true \
                        $platform]]} then {
                      tryCopyBinaryFile $fileName true $platform
                    }
                  }
                }

                if {![info exists ::no(copySqliteArchitectureFiles)] && \
                    [string length $architecture] > 0} then {
                  tputs $::test_channel [appendArgs \
                      "---- copying \"native\" files for architecture \"" \
                      $architecture \"...\n]

                  foreach fileName $nativeFileNames {
                    tryCopyAssembly $fileName false $architecture

                    if {[isDotNetCore] && ![file exists \
                        [getBuildFileName $fileName true \
                        $architecture]]} then {
                      tryCopyBinaryFile $fileName true $architecture
                    }
                  }
                }

                if {![info exists ::no(copySqliteForcedNativeFiles)] && \
                    [getBuildNative]} then {
                  tputs $::test_channel \
                      "---- copying forced \"native\" files...\n"

                  foreach fileName $nativeFileNames {
                    tryCopyAssembly $fileName false
                  }
                }
              }
            }

            if {![info exists ::no(copySqliteMixedFiles)]} then {
              #
              # NOTE: If the "native" runtime option is set, copy implicit
              #       mixed-mode assembly files as well.  The runtime option
              #       check is handled when building the list of mixed-mode
              #       assembly file names.
              #
              if {![info exists ::no(copySqliteImplicitMixedFiles)]} then {
                tputs $::test_channel \
                    "---- copying implicit \"mixed\" files...\n"

                foreach fileName $mixedFileNames {
                  tryCopyAssembly $fileName false
                }
              }

              if {![info exists ::no(copySqliteNonImplicitFiles)]} then {
                if {![info exists ::no(copySqlitePlatformFiles)] && \
                    [string length $platform] > 0} then {
                  tputs $::test_channel [appendArgs \
                      "---- copying \"mixed\" files for platform \"" \
                      $platform \"...\n]

                  foreach fileName $mixedFileNames {
                    tryCopyAssembly $fileName false $platform
                  }
                }

                if {![info exists ::no(copySqliteArchitectureFiles)] && \
                    [string length $architecture] > 0} then {
                  tputs $::test_channel [appendArgs \
                      "---- copying \"mixed\" files for architecture \"" \
                      $architecture \"...\n]

                  foreach fileName $mixedFileNames {
                    tryCopyAssembly $fileName false $architecture
                  }
                }

                if {![info exists ::no(copySqliteForcedMixedFiles)] && \
                    [getBuildNative]} then {
                  tputs $::test_channel \
                      "---- copying forced \"mixed\" files...\n"

                  foreach fileName $mixedFileNames {
                    tryCopyAssembly $fileName false
                  }
                }
              }
            }

            if {![info exists ::no(copySqliteManagedFiles)]} then {
              tputs $::test_channel "---- copying \"managed\" files...\n"

              foreach fileName $managedFileNames {
                tryCopyAssembly $fileName true
              }
            }
          }

          #
          # NOTE: Skip trying to load any files if instructed.
          #
          if {![info exists ::no(loadSqliteFiles)]} then {
            if {![info exists ::no(loadSqliteImplicitFiles)]} then {
              tryLoadAssembly System.Data.SQLite.dll "" {
                if {![info exists \
                    ::no(initializeSqliteImplicitFiles)]} then {
                  object invoke -flags +NonPublic \
                      System.Data.SQLite.UnsafeNativeMethods \
                      Initialize
                }
              }
            }

            if {![info exists ::no(loadSqliteLinqFiles)]} then {
              tryLoadAssembly System.Data.SQLite.Linq.dll
            }

            if {![info exists ::no(loadSqliteEf6Files)]} then {
              tryLoadAssembly System.Data.SQLite.EF6.dll
            }

            if {![info exists ::no(loadSqliteNonImplicitFiles)]} then {
              if {![info exists ::no(loadSqlitePlatformFiles)] && \
                  [string length $platform] > 0} then {
                tryLoadAssembly System.Data.SQLite.dll $platform {
                  if {![info exists \
                      ::no(initializeSqlitePlatformFiles)]} then {
                    object invoke -flags +NonPublic \
                        System.Data.SQLite.UnsafeNativeMethods \
                        Initialize
                  }
                }
              }

              if {![info exists ::no(loadSqliteArchitectureFiles)] && \
                  [string length $architecture] > 0} then {
                tryLoadAssembly System.Data.SQLite.dll $architecture {
                  if {![info exists \
                      ::no(initializeSqliteArchitectureFiles)]} then {
                    object invoke -flags +NonPublic \
                        System.Data.SQLite.UnsafeNativeMethods \
                        Initialize
                  }
                }
              }
            }
          }
        }

        foreach fileNameOnly $nativeFileNames {
          catch {
            tputs $::test_channel [appendArgs \
                "---- file version of \"" native/ $fileNameOnly \
                "\"... \"" [file version [getBinaryFileName \
                $fileNameOnly]] \"\n]
          }
        }

        foreach fileNameOnly $mixedFileNames {
          catch {
            tputs $::test_channel [appendArgs \
                "---- file version of \"" mixed/ $fileNameOnly \
                "\"... \"" [file version [getBinaryFileName \
                $fileNameOnly]] \"\n]
          }
        }

        foreach fileNameOnly $managedFileNames {
          catch {
            tputs $::test_channel [appendArgs \
                "---- file version of \"" managed/ $fileNameOnly \
                "\"... \"" [file version [getBinaryFileName \
                $fileNameOnly]] \"\n]
          }
        }

        if {[string length $platform] > 0} then {
          foreach fileNameOnly $nativeFileNames {
            catch {
              tputs $::test_channel [appendArgs \
                  "---- file version of \"" native/platform/ \
                  $platform / $fileNameOnly "\"... \"" [file \
                  version [getBinaryFileName $fileNameOnly \
                  $platform]] \"\n]
            }
          }

          foreach fileNameOnly $mixedFileNames {
            catch {
              tputs $::test_channel [appendArgs \
                  "---- file version of \"" mixed/platform/ \
                  $platform / $fileNameOnly "\"... \"" [file \
                  version [getBinaryFileName $fileNameOnly \
                  $platform]] \"\n]
            }
          }
        }

        if {[string length $architecture] > 0} then {
          foreach fileNameOnly $nativeFileNames {
            catch {
              tputs $::test_channel [appendArgs \
                  "---- file version of \"" native/architecture/ \
                  $architecture / $fileNameOnly "\"... \"" [file \
                  version [getBinaryFileName $fileNameOnly \
                  $architecture]] \"\n]
            }
          }

          foreach fileNameOnly $mixedFileNames {
            catch {
              tputs $::test_channel [appendArgs \
                  "---- file version of \"" mixed/architecture/ \
                  $architecture / $fileNameOnly "\"... \"" [file \
                  version [getBinaryFileName $fileNameOnly \
                  $architecture]] \"\n]
            }
          }
        }

        #
        # NOTE: Grab the list of managed assemblies for the current process
        #       and report on the System.Data.SQLite related ones.
        #
        if {[haveSQLiteObjectCommand]} then {
          if {[catch {
            object invoke Utility GetAssemblies
          } assemblies] == 0 || [catch {
            object invoke AppDomain.CurrentDomain GetAssemblies
          } assemblies] == 0} then {
            object foreach assembly $assemblies {
              if {[string match \{System.Data.SQLite* $assembly]} then {
                tputs $::test_channel [appendArgs \
                    "---- found loaded assembly: " $assembly \n]
              }
            }
          }
        }

        catch {
          tputs $::test_channel \
              "---- define constants for \"System.Data.SQLite\"... "

          if {[catch {
            object invoke -flags +NonPublic \
                System.Data.SQLite.SQLite3 ProviderDefineConstants
          } defineConstants] == 0} then {
            tputs $::test_channel [appendArgs [formatList [lsort \
                $defineConstants] <none>] \n]
          } else {
            tputs $::test_channel unknown\n
          }
        }

        catch {
          tputs $::test_channel \
              "---- source version of \"System.Data.SQLite.dll\"... "

          if {[catch {
            object invoke -flags +NonPublic \
                System.Data.SQLite.SQLiteConnection ProviderVersion
          } version] == 0} then {
            if {[string length $version] == 0} then {
              set version null
            }
            tputs $::test_channel [appendArgs $version \n]
          } else {
            tputs $::test_channel unknown\n
          }
        }

        catch {
          tputs $::test_channel \
              "---- source checkout of \"System.Data.SQLite.dll\"... "

          if {[catch {
            object invoke -flags +NonPublic \
                System.Data.SQLite.SQLiteConnection ProviderSourceId
          } sourceId] == 0} then {
            if {[string length $sourceId] == 0} then {
              set sourceId null
            }
            tputs $::test_channel [appendArgs $sourceId \n]
          } else {
            tputs $::test_channel unknown\n
          }
        }

        #
        # NOTE: Reset cached "break into debugger" setting so that it can be
        #       used during the test file, if needed.
        #
        if {![info exists ::no(resetBreakIntoDebugger)] && \
            [haveSQLiteObjectCommand]} then {
          if {[catch {
            object invoke -flags +NonPublic \
                System.Data.SQLite.HelperMethods ResetBreakIntoDebugger
          } result] == 0} then {
            tputs $::test_channel [appendArgs \
                "---- call ResetBreakIntoDebugger()... ok\n"]
          } else {
            tputs $::test_channel [appendArgs \
                "---- call ResetBreakIntoDebugger()... error: " \
                \n\t $result \n]
          }
        }

        #
        # NOTE: Check the available builds (and "releases") of SQLite and
        #       System.Data.SQLite.
        #
        checkForSQLiteBuilds $::test_channel
        checkForSQLiteReleases $::test_channel

        #
        # NOTE: Now, we need to know if the SQLite core library is available
        #       (i.e. because the managed-only System.Data.SQLite assembly can
        #       load without it; however, it cannot do anything useful without
        #       it).  If we are using the mixed-mode assembly and we already
        #       found it (above), this should always succeed.
        #
        checkForSQLiteLibrary $::test_channel

        #
        # NOTE: Check if the SQLite interop assembly is available.
        #
        checkForSQLiteInterop $::test_channel

        #
        # NOTE: Check the SQLite database and temporary directories.
        #
        checkForSQLiteDirectories $::test_channel

        #
        # NOTE: Check if the SQLite core library was compiled with support for
        #       the math functions from the ANSI C99 standard.
        #
        checkForSQLiteC99MathFunctions $::test_channel

        #
        # NOTE: Attempt to determine if various compile-time options needed for
        #       test constraints were enabled for the managed assembly.  There
        #       are some compile-time options that must also have been enabled
        #       for the interop assembly in order to be effective.  For those
        #       options, it will be assumed that it was enabled for the interop
        #       assembly if it was enabled for the managed assembly.
        #
        set defineConstants [list \
            CHECK_STATE COUNT_HANDLE DEBUG INTEROP_CODEC INTEROP_DEBUG \
            INTEROP_EXTENSION_FUNCTIONS INTEROP_FTS5_EXTENSION \
            INTEROP_INCLUDE_CEROD INTEROP_INCLUDE_EXTRA INTEROP_INCLUDE_SEE \
            INTEROP_INCLUDE_ZIPVFS INTEROP_JSON1_EXTENSION \
            INTEROP_LEGACY_CLOSE INTEROP_LOG INTEROP_PERCENTILE_EXTENSION \
            INTEROP_REGEXP_EXTENSION INTEROP_SESSION_EXTENSION \
            INTEROP_SHA1_EXTENSION INTEROP_SHA3_EXTENSION \
            INTEROP_TEST_EXTENSION INTEROP_TOTYPE_EXTENSION \
            INTEROP_VIRTUAL_TABLE \
            NET_20 NET_35 NET_40 NET_45 NET_451 NET_452 NET_46 NET_461 \
            NET_462 NET_47 NET_471 NET_472 NET_48 NET_COMPACT_20 \
            NET_STANDARD_20 NET_STANDARD_21 PLATFORM_COMPACTFRAMEWORK \
            PRELOAD_NATIVE_LIBRARY RETARGETABLE SQLITE_STANDARD \
            THROW_ON_DISPOSED TRACE TRACE_CONNECTION TRACE_DETECTION \
            TRACE_HANDLE TRACE_PRELOAD TRACE_SHARED TRACE_STATEMENT \
            TRACE_WARNING TRACK_MEMORY_BYTES USE_ENTITY_FRAMEWORK_6 \
            USE_INTEROP_DLL USE_PREPARE_V2 WINDOWS]

        foreach defineConstant $defineConstants {
          #
          # NOTE: Check if the compile-time option is listed in the list of
          #       "define constants" kept track of by the managed assembly.
          #
          checkForSQLiteDefineConstant $::test_channel $defineConstant
        }

        #
        # NOTE: Attempt to determine if various compile-time options needed for
        #       test constraints were enabled for the interop assembly and/or
        #       for the SQLite core library.
        #
        set compileOptions [list \
            CODEC EXTENSION_FUNCTIONS HAS_CODEC INCLUDE_CEROD INCLUDE_EXTRA \
            INCLUDE_SEE INCLUDE_ZIPVFS JSON1_EXTENSION LEGACY_CLOSE LOG \
            PERCENTILE_EXTENSION REGEXP_EXTENSION SESSION_EXTENSION \
            SHA1_EXTENSION TEST_EXTENSION TOTYPE_EXTENSION VIRTUAL_TABLE]

        foreach compileOption $compileOptions {
          #
          # NOTE: Check if the compile-time option is listed in the list
          #       kept track of by the interop assembly and/or the SQLite
          #       core library.
          #
          checkForSQLiteCompileOption $::test_channel $compileOption
        }

        #
        # NOTE: Check if the System.Data.SQLite provider was compiled with
        #       support for any encrypted databases.
        #
        if {[haveSQLiteDefineConstant INTEROP_CODEC] || \
            [haveSQLiteDefineConstant INTEROP_INCLUDE_SEE]} then {
          #
          # NOTE: Now check if the interop assembly was also compiled with
          #       support for encrypted databases.
          #
          if {[haveSQLiteCompileOption CODEC] || \
              [haveSQLiteCompileOption INCLUDE_SEE]} then {
            #
            # NOTE: Next, check if the SQLite core library was compiled
            #       with support for encrypted databases.
            #
            if {[haveSQLiteCompileOption HAS_CODEC]} then {
              #
              # NOTE: Yes, add constraint for use by the test suite.
              #
              addConstraint System.Data.SQLite.Encryption

              #
              # NOTE: Next, chck if the SQLite core library was compiled
              #       with SEE.
              #
              if {[haveSQLiteDefineConstant INTEROP_INCLUDE_SEE] && \
                  [haveSQLiteCompileOption INCLUDE_SEE]} then {
                #
                # NOTE: Finally, when compiled with SEE, add the
                #       appropriate constraint.
                #
                addConstraint System.Data.SQLite.SEE
              }
            }
          }
        }

        #
        # NOTE: Try to setup an interrupt callback using the script debugger
        #       that will cancel all SQL queries in progress for all database
        #       connections known to this interpreter.
        #
        if {![info exists ::no(sqliteInterruptCallback)]} then {
          setupDbInterruptCallback $::test_channel $::test_log
        }

        #
        # NOTE: Check for the native runtime option, which would mean we are
        #       using the mixed-mode assembly.
        #
        checkForRuntimeOption $::test_channel native

        #
        # NOTE: Check if the test suite should count the number of connections
        #       "opened" and "closed" from the pool when determining if a test
        #       passed.  Disabling this behavior is sometimes necessary (e.g.
        #       during the release testing process) because there are several
        #       tests that rely on the "opened from pool" count being greater
        #       than zero.  These tests may fail due to the non-deterministic
        #       behavior of the CLR GC, even when there is no bug in the code
        #       being tested.
        #
        checkForRuntimeOption $::test_channel noPoolCounts

        #
        # NOTE: Check if the test suite should use shared-cache mode.
        #
        checkForRuntimeOption $::test_channel sharedCache

        #
        # NOTE: Report the resource usage prior to running any tests.
        #
        reportSQLiteResources $::test_channel

        #
        # NOTE: Grab the list of native modules for the current process and
        #       report on the System.Data.SQLite related ones.
        #
        if {[haveSQLiteObjectCommand]} then {
          set modules [object invoke \
              System.Diagnostics.Process.GetCurrentProcess Modules]

          object foreach -alias module $modules {
            #
            # NOTE: The module file name here must be normalized.
            #
            set fileName [file normalize [$module FileName]]
            set fileNameOnly [file tail $fileName]

            if {[lsearch -exact -nocase -- \
                [getNativeLibraryFileNamesOnly] $fileNameOnly] != -1} then {
              tputs $::test_channel [appendArgs \
                  "---- found loaded SQLite native library module: " \
                  $fileName \n]
            } elseif {[lsearch -exact -nocase -- \
                [getInteropAssemblyFileNamesOnly] $fileNameOnly] != -1} then {
              tputs $::test_channel [appendArgs \
                  "---- found loaded SQLite interop assembly module: " \
                  $fileName \n]
            }
          }
        }

        catch {
          tputs $::test_channel \
              "---- compile-time options for SQLite core library... "

          if {[catch {
            object invoke -flags +NonPublic \
                System.Data.SQLite.SQLite3 SQLiteCompileOptions
          } compileOptions] == 0} then {
            tputs $::test_channel [appendArgs [formatList [lsort \
                $compileOptions] <none>] \n]
          } else {
            tputs $::test_channel unknown\n
          }
        }

        catch {
          tputs $::test_channel \
              "---- compile-time options for SQLite interop assembly... "

          if {[catch {
            object invoke -flags +NonPublic \
                System.Data.SQLite.SQLite3 InteropCompileOptions
          } compileOptions] == 0} then {
            tputs $::test_channel [appendArgs [formatList [lsort \
                $compileOptions] <none>] \n]
          } else {
            tputs $::test_channel unknown\n
          }
        }

        catch {
          tputs $::test_channel \
              "---- shared define constants for SQLite... "

          if {[catch {
            object invoke -flags +NonPublic \
                System.Data.SQLite.SQLite3 DefineConstants
          } defineConstants] == 0} then {
            tputs $::test_channel [appendArgs [formatList [lsort \
                $defineConstants] <none>] \n]
          } else {
            tputs $::test_channel unknown\n
          }
        }

        #
        # NOTE: Show the active test constraints.
        #
        tputs $::test_channel [appendArgs "---- constraints: " \
            [formatList [lsort [getConstraints]] <none>] \n]

        #
        # NOTE: Save the test constraints for use by threads created in this
        #       application domain.  This is necessary because all the Eagle
        #       "test context" information is per-thread.
        #
        if {![info exists ::test_constraints]} then {
          set ::test_constraints $::eagle_tests(Constraints)
        }

        #
        # NOTE: Load the "after-constraints" custom per-user and/or per-host
        #       test settings now.
        #
        uplevel 1 [list loadSQLiteTestSettings $::test_channel .after]

        #
        # NOTE: If necessary, enable shared-cache mode now.
        #
        if {[hasRuntimeOption sharedCache]} then {
          enableSharedCache $::test_channel true
        }

        #
        # NOTE: Show when our tests actually began (now).
        #
        tputs $::test_channel [appendArgs \
            "---- System.Data.SQLite tests began at " \
            [clock format [clock seconds]] \n]
      }
    }

    proc runSQLiteTestFilesPrologue {} {
      #
      # NOTE: Skip running our custom files prologue if the main one has been
      #       skipped.
      #
      if {![info exists ::no(prologue.eagle)]} then {
        uplevel 1 {
          #
          # NOTE: Setup the variables that refer to the various non-data files
          #       required by the tests in this file.
          #
          set entityFrameworkDllFile \
              [getBuildFileName EntityFramework.dll true]

          set installerExeFile \
              [getBuildFileName Installer.exe true]

          set sqliteDesignerDllFile \
              [getBuildFileName SQLite.Designer.dll true]

          set systemDataSQLiteDllFile \
              [getBuildFileName System.Data.SQLite.dll true]

          set systemDataSQLiteLinqDllFile \
              [getBuildFileName System.Data.SQLite.Linq.dll true]

          set systemDataSQLiteEf6DllFile \
              [getBuildFileName System.Data.SQLite.EF6.dll true]

          set testExeFile [getBuildFileName test.exe true]
          set testLinqExeFile [getBuildFileName testlinq.exe true]

          if {[isDotNetCore]} then {
            set testEf6ExeFile [getBuildFileName testef6.dll true]
          } else {
            set testEf6ExeFile [getBuildFileName testef6.exe true]
          }

          set testEf6DepsJsonFile \
              [getBuildFileName testef6.deps.json true]

          set testEf6DepsJsonBackupFile \
              [getBuildFileName [appendArgs testef6.deps.json . \
              [generateUniqueId "" 4]] true]

          #
          # NOTE: Setup the variables that refer to the various data files
          #       required by the tests in this file.
          #
          set testLinqOutFile [file nativename [file join \
              [getSQLiteTestDataPath] testlinq.out]]

          set northwindEfDbFile [file nativename [file join \
              [file dirname [file dirname [getSQLiteTestDataPath]]] \
              testlinq northwindEF.db]]

          set nonWalDbFile [file nativename [file join \
              [getSQLiteTestDataPath] nonWal.db]]

          set walDbFile [file nativename [file join \
              [getSQLiteTestDataPath] wal.db]]

          #
          # NOTE: The various install/uninstall log files used to test the
          #       design-time component installer.
          #
          set testInstallVs2005LogFile [file nativename [file join \
              [getSQLiteTestDataPath] Installer_Test_Vs2005.log]]

          set testInstallVs2008LogFile [file nativename [file join \
              [getSQLiteTestDataPath] Installer_Test_Vs2008.log]]

          set testInstallVs2010LogFile [file nativename [file join \
              [getSQLiteTestDataPath] Installer_Test_Vs2010.log]]

          set testInstallVs2012LogFile [file nativename [file join \
              [getSQLiteTestDataPath] Installer_Test_Vs2012.log]]

          set testInstallVs2013LogFile [file nativename [file join \
              [getSQLiteTestDataPath] Installer_Test_Vs2013.log]]

          set testInstallVs2015LogFile [file nativename [file join \
              [getSQLiteTestDataPath] Installer_Test_Vs2015.log]]

          set testInstallVs2017LogFile [file nativename [file join \
              [getSQLiteTestDataPath] Installer_Test_Vs2017.log]]

          set testUninstallVs2005LogFile [file nativename [file join \
              [getSQLiteTestDataPath] Uninstaller_Test_Vs2005.log]]

          set testUninstallVs2008LogFile [file nativename [file join \
              [getSQLiteTestDataPath] Uninstaller_Test_Vs2008.log]]

          set testUninstallVs2010LogFile [file nativename [file join \
              [getSQLiteTestDataPath] Uninstaller_Test_Vs2010.log]]

          set testUninstallVs2012LogFile [file nativename [file join \
              [getSQLiteTestDataPath] Uninstaller_Test_Vs2012.log]]

          set testUninstallVs2013LogFile [file nativename [file join \
              [getSQLiteTestDataPath] Uninstaller_Test_Vs2013.log]]

          set testUninstallVs2015LogFile [file nativename [file join \
              [getSQLiteTestDataPath] Uninstaller_Test_Vs2015.log]]

          set testUninstallVs2017LogFile [file nativename [file join \
              [getSQLiteTestDataPath] Uninstaller_Test_Vs2017.log]]

          #####################################################################

          if {![info exists ::no(checkForSqliteFiles)]} then {
            if {![haveConstraint [appendArgs file_ \
                [file tail $entityFrameworkDllFile]]]} then {
              checkForFile $test_channel $entityFrameworkDllFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $installerExeFile]]]} then {
              checkForFile $test_channel $installerExeFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $sqliteDesignerDllFile]]]} then {
              checkForFile $test_channel $sqliteDesignerDllFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $systemDataSQLiteDllFile]]]} then {
              checkForFile $test_channel $systemDataSQLiteDllFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $systemDataSQLiteLinqDllFile]]]} then {
              checkForFile $test_channel $systemDataSQLiteLinqDllFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $systemDataSQLiteEf6DllFile]]]} then {
              checkForFile $test_channel $systemDataSQLiteEf6DllFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testExeFile]]]} then {
              checkForFile $test_channel $testExeFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testLinqExeFile]]]} then {
              checkForFile $test_channel $testLinqExeFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testEf6ExeFile]]]} then {
              #
              # HACK: Hard-code the constraint name here to that of .NET
              #       Framework executable.  When compiled for .NET Core
              #       this will be a DLL; however, the tests use the EXE
              #       file name as the constraint name.
              #
              checkForFile $test_channel $testEf6ExeFile testef6.exe
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testEf6DepsJsonFile]]]} then {
              checkForFile $test_channel $testEf6DepsJsonFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testEf6DepsJsonBackupFile]]]} then {
              checkForFile $test_channel $testEf6DepsJsonBackupFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testLinqOutFile]]]} then {
              checkForFile $test_channel $testLinqOutFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $northwindEfDbFile]]]} then {
              checkForFile $test_channel $northwindEfDbFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $nonWalDbFile]]]} then {
              checkForFile $test_channel $nonWalDbFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $walDbFile]]]} then {
              checkForFile $test_channel $walDbFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testInstallVs2005LogFile]]]} then {
              checkForFile $test_channel $testInstallVs2005LogFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testInstallVs2008LogFile]]]} then {
              checkForFile $test_channel $testInstallVs2008LogFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testInstallVs2010LogFile]]]} then {
              checkForFile $test_channel $testInstallVs2010LogFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testInstallVs2012LogFile]]]} then {
              checkForFile $test_channel $testInstallVs2012LogFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testInstallVs2013LogFile]]]} then {
              checkForFile $test_channel $testInstallVs2013LogFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testInstallVs2015LogFile]]]} then {
              checkForFile $test_channel $testInstallVs2015LogFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testInstallVs2017LogFile]]]} then {
              checkForFile $test_channel $testInstallVs2017LogFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testUninstallVs2005LogFile]]]} then {
              checkForFile $test_channel $testUninstallVs2005LogFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testUninstallVs2008LogFile]]]} then {
              checkForFile $test_channel $testUninstallVs2008LogFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testUninstallVs2010LogFile]]]} then {
              checkForFile $test_channel $testUninstallVs2010LogFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testUninstallVs2012LogFile]]]} then {
              checkForFile $test_channel $testUninstallVs2012LogFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testUninstallVs2013LogFile]]]} then {
              checkForFile $test_channel $testUninstallVs2013LogFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testUninstallVs2015LogFile]]]} then {
              checkForFile $test_channel $testUninstallVs2015LogFile
            }

            if {![haveConstraint [appendArgs file_ \
                [file tail $testUninstallVs2017LogFile]]]} then {
              checkForFile $test_channel $testUninstallVs2017LogFile
            }
          }
        }
      }
    }

    proc runSQLiteTestExtraPrologue {} {
      #
      # NOTE: Skip running our custom files prologue if the main one has been
      #       skipped.
      #
      if {![info exists ::no(prologue.eagle)]} then {
        uplevel 1 {
          if {![info exists ::no(saveTestEf6Files)]} then {
            if {[haveConstraint [appendArgs file_ \
                [file tail $testEf6DepsJsonFile]]] && \
                ![haveConstraint [appendArgs file_ \
                [file tail $testEf6DepsJsonBackupFile]]]} then {
              file rename $testEf6DepsJsonFile $testEf6DepsJsonBackupFile

              tputs $test_channel [appendArgs \
                  "---- moved \"" $testEf6DepsJsonFile "\" to \"" \
                  $testEf6DepsJsonBackupFile \"\n]

              removeConstraint [appendArgs \
                  file_ [file tail $testEf6DepsJsonFile]]

              removeConstraint [appendArgs \
                  file_ [file tail $testEf6DepsJsonBackupFile]]

              checkForFile $test_channel $testEf6DepsJsonFile
              checkForFile $test_channel $testEf6DepsJsonBackupFile
            }
          }
        }
      }
    }

    proc runSQLiteTestExtraEpilogue {} {
      #
      # NOTE: Skip running our custom files epilogue if the main one has been
      #       skipped.
      #
      if {![info exists ::no(epilogue.eagle)]} then {
        uplevel 1 {
          if {![info exists ::no(restoreTestEf6Files)]} then {
            if {![haveConstraint [appendArgs file_ \
                [file tail $testEf6DepsJsonFile]]] && \
                [haveConstraint [appendArgs file_ \
                [file tail $testEf6DepsJsonBackupFile]]]} then {
              file rename $testEf6DepsJsonBackupFile $testEf6DepsJsonFile

              tputs $test_channel [appendArgs \
                  "---- moved \"" $testEf6DepsJsonBackupFile "\" to \"" \
                  $testEf6DepsJsonFile \"\n]

              removeConstraint [appendArgs \
                  file_ [file tail $testEf6DepsJsonFile]]

              removeConstraint [appendArgs \
                  file_ [file tail $testEf6DepsJsonBackupFile]]

              checkForFile $test_channel $testEf6DepsJsonFile
              checkForFile $test_channel $testEf6DepsJsonBackupFile
            }
          }
        }
      }
    }

    proc runSQLiteTestFilesEpilogue {} {
      #
      # NOTE: Skip running our custom files epilogue if the main one has been
      #       skipped.
      #
      if {![info exists ::no(epilogue.eagle)]} then {
        uplevel 1 {
          unset -nocomplain \
              testUninstallVs2017LogFile testUninstallVs2015LogFile \
              testUninstallVs2013LogFile testUninstallVs2012LogFile \
              testUninstallVs2010LogFile testUninstallVs2008LogFile \
              testUninstallVs2005LogFile testInstallVs2017LogFile \
              testInstallVs2015LogFile testInstallVs2013LogFile \
              testInstallVs2012LogFile testInstallVs2010LogFile \
              testInstallVs2008LogFile testInstallVs2005LogFile

          unset -nocomplain \
              northwindEfDbFile testLinqOutFile walDbFile nonWalDbFile

          unset -nocomplain \
              testEf6DepsJsonFile testEf6DepsJsonBackupFile \
              testEf6ExeFile testLinqExeFile \
              testExeFile systemDataSQLiteEf6DllFile \
              systemDataSQLiteLinqDllFile systemDataSQLiteDllFile \
              sqliteDesignerDllFile installerExeFile \
              entityFrameworkDllFile
        }
      }
    }

    proc runSQLiteTestEpilogue {} {
      #
      # NOTE: Skip running our custom epilogue if the main one has been
      #       skipped.
      #
      if {![info exists ::no(epilogue.eagle)]} then {
        #
        # NOTE: Show when our tests actually ended (now).
        #
        tputs $::test_channel [appendArgs \
            "---- System.Data.SQLite tests ended at " \
            [clock format [clock seconds]] \n]

        #
        # NOTE: Load the "epilogue" custom per-user and/or per-host test
        #       settings now.
        #
        uplevel 1 [list loadSQLiteTestSettings $::test_channel .epilogue]

        #
        # BUGFIX: Before checking the final resources in use by SQLite, make
        #         sure both of the PRAGMA related directory names are freed.
        #
        checkForSQLiteDirectories $::test_channel true

        #
        # NOTE: Also report the resource usage after running the tests.
        #
        reportSQLiteResources $::test_channel

        #
        # NOTE: Report the critical handle counts after running the tests.
        #
        getSQLiteHandleCounts $::test_channel

        #
        # NOTE: If necessary, disable shared-cache mode now.
        #
        if {[hasRuntimeOption sharedCache]} then {
          enableSharedCache $::test_channel false
        }

        #
        # NOTE: Restore the previously saved environment variables that we
        #       changed for the test suite.
        #
        restoreEnvironmentVariables \
            [list Initialize_SQLiteLog] ::testSuiteSavedEnv
      }
    }

    ###########################################################################
    ############################# END Eagle ONLY ##############################
    ###########################################################################
  }

  #
  # NOTE: Save the name of the directory containing this file.
  #
  if {![info exists common_directory]} then {
    set common_directory [file dirname [info script]]
  }

  #
  # NOTE: Provide the System.Data.SQLite test package to the interpreter.
  #
  package provide System.Data.SQLite.Test 1.0
}

Added lib/System.Data.SQLite/pkgIndex.eagle.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
###############################################################################
#
# pkgIndex.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

if {![package vsatisfies [package provide Tcl] 8.4]} {return}
if {![package vsatisfies [package provide Eagle] 1.0]} {return}

package ifneeded System.Data.SQLite.Test 1.0 \
    [list source [file join $dir common.eagle]]

Added lib/System.Data.SQLite/settings.before.mistachkin.eagle.

































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
###############################################################################
#
# settings.before.mistachkin.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

if {[info exists ::env(TEST_ALL)]} then {
  if {[haveSQLiteObjectCommand]} then {
    catch {
      object invoke Interpreter.GetActive AddRuntimeOption noPoolCounts
    }
  }
}

Added lib/System.Data.SQLite/settings.stress.mistachkin.eagle.





















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
###############################################################################
#
# settings.stress.mistachkin.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

# set count(1) 10;        # Workload iteration count (i.e. within a run).
# set count(2) 200;       # Workload iteration delay, in milliseconds.
# set count(3) 10000;     # Workload "small" data chunk size, in bytes.
# set count(5) 209715200; # Maximum heap memory to exclude at one time.
# set journalMode WAL;    # Initial journal mode for database files.
# set pageSize 4096;      # Initial page size for database files.
# set noWorkload [list];  # Workloads to be omitted from the run, by index.
# set exitOnFail true;    # Halt testing and exit process on test failure?
# set noTrace true;       # Disable SQLite trace logging to a file?
# set noProgress true;    # Disable emitting of progress indicators?

# set beginTransaction "BEGIN";    # SQL just before modifying the database.
# set endTransaction "COMMIT";     # SQL just after modifying the database.
# set errorTransaction "ROLLBACK"; # SQL just after a database modification error.

# addRuntimeOption sharedCache
# addRuntimeOption dmlOnly

Changes to readme.htm.

1
2
3
4
5
6
7
8
9
10
11
12

13
14
15
16
17
18

19






20



21
22







23
24
25
26
27
28
29
30
31
32
33

34



35
36

37

38
39
40
41
42








43
44



45
46


47

48
49





50



51
52
53

54

55

56

57

58

59
60

61
62
63

64
65

66

67
68
69
70
71
72
73
74





75






76
77
78

79
80
81
82
83
84
85

86



87
88
89

90
91
92
93
94
95

96
97
98
99

100

101
102
103

104
105
106


































































































107















108
109





110





111



























112


113
















































114
115
















































116

















117
118
119


120






































121



122
123



124





















125













126




127

128























































129

130































131


132


































133















134
135

136










137

138

























139
140


















































141
142






143

144

145







146
147
148






























































149
150






























151






















152

153

154


155






































































































156
157
158
159
160
161

162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178

179
180
181
182
183
184
185
186
187
188
189
190

191
192

193
194

195

196

197

198
199
200
201
202
203
204
205
206
207

208
209
210
211
212

213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235

236
237
238
239
240
241
242
243

244
245
246
247
248
249

250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269

270
271
272
273
274
275
276
277
278
279
280

281
282
283
284
285
286

287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322

323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340

341
342
343
344
345
346
347
348
349
350
351
352

353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369

370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395

396
397
398
399
400
401
402
403
404
405
406
407
408
409

410
411
412

413
414
415
416
417
418
419

420
421
422
423
424
425
426
427
428
429
430
431
432
433

434
435
436
437
438
439
440
441
442
443
444
445
446
447
448

449
450
451
452

453

454
455
456

457
458
459
460

461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486

487
488
489
490
491
492
493
494

495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526

527
528
529
530
531
532
533
534
535
536
537

538
539
540
541
542
543
544
545
546
547

548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566

567
568
569
570

571
572

573

574

575
576
577
578
579
580
581
582
583

584
585
586
587
588
589
590

591
592
593
594
595
596
597
598
599
600

601
602
603

604
605
606

607
608
609
610
611
612
613
614
615
616
617

618
619
620

621
622

623

624
625
626
627

628
629
630
631
632
633
634

635
636
637
638

639
640

641
642
643
644

645
646
647
648
649
650
651
652

653
654
655
656

657
658
659
660
661
662
663
664

665
666
667
668
669
670
671

672
673
674

675
676
677
678
679
680

681
682
683
684
685
686
687
688
689
690

691
692
693
694
695
696
697
698

699
700
701
702
703
704
705
706

707
708
709

710

711


712
713

714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736

737
738
739
740
741
742
743
744

745
746
747
748
749
750
751
752
753
754
755

756
757
758
759

760
761

762
763
764

765
766

767
768
769

770
771
772
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
800
801

802
803

804
805
806
807

808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867

868
869
870

871
872
873
874
875
876

877
878
879

880
881
882

883
884
885
886
887
888

889
890
891

892
893
894

895
896
897
898

899
900
901
902
903
904
905
906

907

908
909
910
911
912
913

914
915
916
917
918
919
920
921
922
923
924

925
926
927
928

929
930
931
932
933
934

935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955


956
957
958
959
960

961
962
963
964
965
966
967
968
969

970
971
972
973
974
975
976
977
978
979
980
981
982
983

984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999




1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060

1061
1062
1063
1064
1065
1066
1067

1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087





1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109








1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131






1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152





1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title></title>
  </head>
  <body>
    ADO.NET 2.0/3.5 SQLite Data Provider<br>
    Version 1.0.67.0 August X, 2010<br>
    Using SQLite 3.7.0.1<br>
    Written by Robert Simpson (<a href="mailto:robert@blackcastlesoft.com">robert@blackcastlesoft.com</a>)<br>
    Released to the public domain, use at your own risk!<br>
    Official provider website:&nbsp; <a href="http://sqlite.phxsoftware.com">http://sqlite.phxsoftware.com</a><br />

    <br>
    The latest version can be downloaded <a href="http://sourceforge.net/projects/sqlite-dotnet2">
      here</a>
    <br>
    <br>
    <b></b>

    <h2>






      <b>Features:</b><br>



    </h2>
    <UL>







      <LI>
      Written from scratch on VS2008 specifically for ADO.NET 2.0, implementing all the
      base classes and features recently introduced in the framework, including automatic
      transaction enlistment.<li>Supports the Full
        and Compact .NET Framework, and native C/C++ development.&nbsp; 100% binary
        compatible with the original sqlite3.dll.</li>
      <li>Full support for Mono via a &quot;managed only&quot; provider that runs against the 
        official SQLite 3.6.1 or higher library.</li>
      <li>Full Entity Framework support (ADO.NET 3.5 SP1)</li>
      <LI>
      On the Compact Framework, it is faster than Sql Server 

      Mobile.  SQLite's installed size is a fraction of Sql Mobile's. It uses less memory at runtime, runs queries faster, and has a smaller database file size as well.



      <li>Encrypted database support.&nbsp; Encrypted databases are fully encrypted and
        support both binary and cleartext password types.</li>

      <LI>

      Visual Studio 2005/2008 Design-Time Support, works with all versions of VS2005/2008,
        including
      all Express Editions of VS2005.&nbsp; You can add a SQLite 
      database to the Servers list, design queries with the Query Designer, 
      drag-and-drop tables onto a Typed DataSet, etc.<LI>








        Full SQLite schema editing inside Visual Studio.&nbsp;
        You can create/edit tables, views, triggers, indexes, check constraints and foreign keys.<LI>



      Single file redistributable (except on Compact Framework).&nbsp; The core sqlite3 codebase and the ADO.NET wrapper 
      are combined into one multi-module assembly.


      <LI>

              Binaries included for Itanium, x64, x86 and ARM processors.<LI>
      DbProviderFactory support.





      <LI>



        Full support for ATTACH'ed databases.&nbsp; Exposed as <I>Catalogs</I>
      in the schema.&nbsp; When cloning a connection, all attached databases are 
      automatically re-attached to the new connection.

      <LI>

        DbConnection.GetSchema(...) support includes <I>ReservedWords, MetaDataCollections</I>, <I>DataSourceInformation</I>,

        <I>DataTypes, Columns</I>, <I>Tables</I>, <I>Views, ViewColumns, </I><I>Catalogs, </I><I>Indexes, 

          IndexColumns, </I><EM>ForeignKeys </EM>and<EM> Triggers</EM>.

      <LI>

      Enhanced DbDataReader.GetSchemaTable() functionality returns catalog, namespace 
      and detailed schema information even for complex queries.

      <LI>
      Named and unnamed parameters.
      <LI>

      Full UTF-8 and UTF-16 support, each with optimized pipelines into the native 
      database core.

      <LI>

      Multiple simultaneous DataReaders (one DataReader per Command however).
      <LI>
      Full support for user-defined scalar and aggregate functions, encapsulated into 
      an easy-to-use base class in which only a couple of overrides are necessary to 
      implement new SQL functions.
      <LI>
      Full support for user-defined collating sequences, every bit as simple to 
      implement as user-defined functions and uses the same base class.





      <LI>






        Full source for the entire engine and wrapper.&nbsp; No copyrights.&nbsp; 
        Public Domain.&nbsp; 100% free for commercial and non-commercial use.&nbsp;</LI></UL>
    <strong></strong>

    <h2>
      <strong>Design-Time Support</strong></h2>
    <P>
      In Windows Explorer, navigate to the <STRONG>SQLite.NET\bin\Designer</STRONG>
        folder and execute the <STRONG>INSTALL.EXE</STRONG>
      file.&nbsp; The program will
      automatically detect what version(s) of Visual Studio 2005/2008 are installed and allow

      you to selectively install and uninstall the designer for each edition.</P>



    <H2><STRONG>DbFactory Support (Non-Compact Framework)</STRONG></H2>
    In order to use the SQLiteFactory and have the SQLite data provider enumerated 
    in the DbProviderFactories methods, you must add the following segment into your application's app.config file:<br>

    <br>
    <pre>&lt;configuration&gt;
  &lt;system.data&gt;
    &lt;DbProviderFactories&gt;
      &lt;remove invariant="System.Data.SQLite"/&gt;
      &lt;add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite"<BR > type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /&gt;

    &lt;/DbProviderFactories&gt;
  &lt;/system.data&gt;
&lt;/configuration&gt;
</pre>

    <p>See the help documentation for further details on implementing both version-specific (GAC enabled) and version independent DBProviderFactories support.

      </p>
    <h3>
      Compiling for the Compact Framework</h3>

    <p>
      Just change the target platform from Win32 to Compact Framework and 
      recompile.&nbsp; <STRONG>The Compact Framework has no support for enumerating 


































































































        attributes in an assembly, therefore all user-defined collating sequences and 















        functions must be explicitly registered.</STRONG>&nbsp; See the <STRONG>testce</STRONG>
      sample application for an example of how to explicitly register user-defined 





      collating sequences and functions.</p>





    <h2>



























      <b><A name="redist"></A>Distributing The SQLite Engine and ADO.NET Assembly</b></h2>


    <P>
















































      On the desktop, only the <STRONG>System.Data.SQLite.DLL</STRONG> file needs to be distributed with your 
      application(s).&nbsp; This DLL contains both the managed wrapper and the native 
















































      SQLite3 codebase.&nbsp; For the Compact Framework, you will have to distribute 

















      both the CF version of System.Data.SQLite.DLL, as well as the 
      SQLite.Interop.XXX.DLL.&nbsp; This is a breaking change as of 1.0.59.0.&nbsp; 
      Recent Windows Mobile frameworks are not supporting the mixed CF assembly I was 


      building prior to this version.</P>






































    <H2><B>Development Notes Regarding the SQLite 3 Source Code</B></H2>



    <p>
      The core sqlite engine is compiled directly from the unmodified source code available



      at the sqlite.org website.&nbsp; Several additional pieces are compiled on top of





















      it to extend its functionality, but the core engine's source is not changed.</p>













    <p></p>




    <p>

      <b>Version History</b></p>























































    <p><b>1.0.67.0 - August X, 2010</b></p>

    <ul>































      <li>Code merge with SQLite 3.7.0.1</li>


      <li>Re-enabled VS2005 designer support, broken in previous versions during the 2008 transition</li>


































      <li>Implemented new forms of Take/Skip in the EF framework courtesy jlsantiago</li>















      <li>Added "Foreign Keys" to the connection string parameters</li>
      <li>Added the Truncate option to the Journal Modes enumeration</li>

    </ul>










    <p><b>1.0.66.0 - April 18, 2010</b></p>

    <ul>

























      <li>Code merge with SQLite 3.6.23.1</li>
      <li>Fixed a bug in the installer that accidentally modified the machine.config on .NET versions prior to 2.0, invaliding the config file.</li>


















































      <li>Fixed INTERSECT and EXCEPT union query generation in EF</li>
      <li>Fixed an out of memory error in the trigger designer in cases where a WHEN clause is used in the trigger</li>






    </ul>

    <p><b>1.0.65.0 - July 26, 2009</b></p>

    <ul>







      <li>Fixed a bug in the encryption module to prevent a double free() when rekeying a database.</li>
      <li>Fixed a bug in the encryption module when ATTACHing an encrypted database.</li>
      <li>Incorporated the WinCE locking fix from ticket






























































        <a href="http://www.sqlite.org/cvstrac/tktview?tn=3991">#3991</a></li>
      <li>Added &quot;bigint&quot; to the dropdown in the table designer, plus other minor table 






























        designer bugfixes.</li>






















    </ul>

    <p><b>1.0.64.0 - July 9, 2009</b></p>

    <ul>


      <li>Fixed the missing resources problem from the 63 release.</li>






































































































      <li>Added preliminary support for the Visual Studio 2010 beta.</li>
      <li>Fixed a bug in SQLiteCommand that threw a null reference exception when 
        setting the Transaction object to null.</li>
      <li>If SQLiteConnection.EnlistTransaction is called multiple times for the same 
        transaction scope, just return without throwing an error.</li>
    </ul>

    <p><b>1.0.63.0 - June 29, 2009</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.16</li>
      <li>Check the autocommit mode of the connection to which a transaction is bound 
        during the disposal of the transaction.&nbsp; If autocommit is enabled, then the 
        database has already rolled back the transaction and we don&#39;t need to do it 
        during dispose, and can quietly ignore the step without throwing an error.</li>
      <li>Eliminated the mergebin step altogether.&nbsp; It was developed primarily to 
        merge the Compact Framework binaries together, but since we&#39;re not doing that 
        anymore, its use is limited.&nbsp; Its non-standard method of merging a binary 
        on the desktop framework is redundant as well.&nbsp; The desktop binary now 
        hard-links to MSCOREE, but as of Windows XP, this was redundant as well since XP 
        and beyond automatically attempt to load MSCOREE on startup when a DLL has a 
        .NET header.</li>
      <li>More improvements to the test.exe program for running the tests against Sql 
        Server for comparison purposes.</li>
    </ul>

    <p><b>1.0.62.0 - June 19, 2009</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.15</li>
      <li>Fixed the decimal reading bug in the SQLiteDataReader</li>
      <li>Changed Join()&#39;s to Sleep()&#39;s in the statement retry code to prevent message 
        pumping</li>
      <li>Fixed a bad pointer conversion when retrieving blobs using GetBytes() in 
        64-bit land</li>
      <li>Several changes to the Test program that comes with the provider.&nbsp; Tests 
        can now be individually disabled, and the test program can run against several 
        provider back-ends</li>
    </ul>

    <p><b>1.0.61.0 - April 28, 2009</b></p>
    <ul>

      <li>Code merge with SQLite 3.6.13.  The new backup features are as yet unimplemented in the provider, but will be forthcoming in a subsequent release</li>
      <li>Fixed the default-value lookups in SQLiteConnectionStringBuilder when accessing properties</li>

      <li>Lock the SQLiteTransaction object during dispose to avoid potential race condition during cleanup</li>

      <li>Fixed SQLiteDataReader.GetDecimal() processing and parsing of decimal values for cases when SQLite returns things like "1.0e-05" instead of "0.0001"</li>

    </ul>

    <p><b>1.0.60.0 - October 3, 2008</b></p>
    <ul>
      <li>Throw a NotSupported exception in the EF Sql Gen code instead of parsing 
        illegal SQL during an update/insert/delete where no primary key is defined.</li>
      <li>Fixed the Compact Framework interop library.&nbsp; Since the linker flag 
        /subsystem had no version specified, it was causing a problem for many CE-based 
        platforms.</li>
      <li>Incorporated SQLite patch for ticket
        <a href="http://www.sqlite.org/cvstrac/tktview?tn=3387">#3387</a> and reverted 
        out the vfs override code I added in build 59 to work around this problem.</li>

      <li>Fixed a designer issue when creating a new table from the Server Explorer.&nbsp; 
        After initially saving it, if you then continued to edit it and tried to save it 
        again, it would generate the change SQL using the old temporary table name 
        rather than the new name.</li>
    </ul>

    <p><b>1.0.59.0 - September 22, 2008</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.3.&nbsp; Solves 
        a couple different EF issues that were either giving inconsistent results or 
        crashing the engine.</li>
      <li>Fixed the parsing of literal binaries in the EF SqlGen code.&nbsp; SQLite now 
        passes nearly all the testcases in 
        <a href="http://sqlite.phxsoftware.com/forums/p/1377/5921.aspx#5921">Microsoft's EF Query Samples</a> application -- 
        the exception being the <i>datetimeoffset </i>and<i> time</i> constants tests, and tests 
        that use the <i>APPLY </i>keyword which are unsupported for now.</li>
      <li>Revamped the Compact Framework mixed-mode assembly.&nbsp; Tired of playing cat 
        and mouse with the Compact Framework&#39;s support for mixed-mode assemblies.&nbsp; 
        The CF build now requires that you distribute both the System.Data.SQLite 
        library and the paired SQLite.Interop.XXX library.&nbsp;&nbsp; The XXX denotes 
        the build number of the library.</li>
      <li>Implemented a workaround for Vista&#39;s overzealous caching by turning off 
        FILE_FLAG_RANDOM_ACCESS for OS versions above XP.&nbsp; This is implemented 
        as a custom (default override) VFS in the interop.c file, so no changes are made 
        to the SQLite source code.</li>
      <li>Fixed some registry issues in the designer install.exe, which prevented some 
        design-time stuff from working on the Compact Framework when .NET 3.5 was 
        installed.</li>
    </ul>

    <p><b>1.0.58.0 - August 30, 2008</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.2.&nbsp; If only I&#39;d waited one more day to release 
        57!&nbsp; Several LINQ issues have been resolved with this engine release 
        relating to deeply-nested subqueries that the EF SqlGen creates.</li>
      <li>The Rollback SQLiteConnection event no longer requires an open connection in 
        order to subscribe to it.&nbsp; Missed this one in the 57 release.</li>
    </ul>

    <p><b>1.0.57.0 - August 29, 2008</b></p>
    <ul>
      <li>Compiled against 3.6.1 with checkin
        <a href="http://www.sqlite.org/cvstrac/tktview?tn=3300">#3300</a> resolved, 
        which fixes an Entity Framework bug I was seeing.&nbsp; I currently have 3 other 
        tickets out on the engine, which are not yet resolved and relate to EF.</li>

      <li>Fixed decimal types to store and fetch using InvariantCulture.&nbsp; If you&#39;re 
        using decimal datatypes in your database and were affected by the 56 release, 
        please issue an UPDATE &lt;table&gt; SET &lt;column&gt; = REPLACE(&lt;column&gt;, &#39;,&#39;, &#39;.&#39;);&nbsp; 
        to fix the decimal separators.&nbsp; Apologies for not testing that more 
        thoroughly before releasing 56.</li>
      <li>Too many LINQ fixes to list.&nbsp; Fixed views so they generate, 
        fixed the LIMIT clause, implemented additional functionality and removed unnecessary code.</li>
      <li>Fixed foreign key names in the designer so viewing the SQL script on a new 
        unsaved table after renaming it in the properties toolwindow will reflect in the 
        script properly.</li>
      <li>Fixed the Update and Commit events on SQLiteConnection so they don&#39;t require 
        the connection to be opened first.</li>
      <li>Fixed userdef aggregate functions so they play nice with each other when 
        appearing multiple times in the same statement.</li>
      <li>Fixed the editing and saving of default values in the table designer.</li>
      <li>Fixed ForeignKeys schema to support multi-column foreign keys.&nbsp; Also 
        hacked support for them in the table designer, provided two foreign keys in the 
        designer have the same name and reference the same foreign table and different 
        columns.&nbsp; Will implement first-class support for this in the next release.</li>
    </ul>

    <p><b>1.0.56.0 - August 11, 2008</b></p>
    <ul>
      <li>Fixed a bug in the table designer when designing new tables, wherein you had to 
        save the table first before being able to create indexes and foreign keys.</li>
      <li>Tweaks to decimal type handling.&nbsp; The &#39;decimal&#39; type can&#39;t be represented 
        by Int64 or Double (without loss of precision) in SQLite, so we have to fudge it 
        by treating it like a string and converting it back and forth in the provider.&nbsp; 
        Unfortunately backing it to the db as a string causes sorting problems.&nbsp; 
        See <a href="http://sqlite.phxsoftware.com/forums/p/1296/5595.aspx#5595">this 
        post</a> 
        for details on using a custom collation sequence to overcome the sorting issue arising from this patch.</li>

      <li>Minor tweaks and bugfixes to the test program and the provider.</li>
      <li>More adjustments to make the managed-only version of the provider run and pass 
        all tests on Mono.</li>
      <li>LINQ to Entities bits heavily updated and compiled against VS2008 SP1 RTM.&nbsp; SQLite 
        LINQ support is still considered beta.</li>
    </ul>

    <p><b>1.0.55.0 - August 6, 2008</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.1</li>
      <li>Added support for the user-contributed extension-functions at
        <a href="http://www.sqlite.org/contrib">http://www.sqlite.org/contrib</a>.&nbsp; 
        Feel free to override any of them with your own implementation.&nbsp; The new 
        functions are: <i>acos, asin, atan, atn2, atan2, acosh, asinh, atanh, 
        difference, degrees, radians, cos, sin, tan, cot, cosh, sinh, tanh, coth, exp, 
        log, log10, power, sign, sqrt, square, ceil, floor, pi, replicate, charindex, 
        leftstr, rightstr, reverse, proper, padl, padr, padc, strfilter,</i> and 
        aggregates <i>stdev, variance, mode, median, lower_quartile, upper_quartile.</i></li>
      <li>Moved the last_rows_affected() function to the C extension library.</li>
      <li>Added a new class, SQLiteFunctionEx which extends SQLiteFunction and adds the 
        ability for a user-defined function to get the collating sequence during the 
        Invoke/Step methods.&nbsp; User-defined functions can use the collating sequence 
        as a helper to compare values.</li>
      <li>When registering user-defined collation sequences and functions, the provider 
        will now register both a UTF8 and a UTF16 version instead of just UTF8.</li>
      <li>Revamped connection pooling and added static ClearPool() and ClearAllPools() 
        functions to SQLiteConnection.&nbsp; Behavior of the pool and its clearing 
        mechanics match SqlClient.</li>
      <li>Fixed connections going to the pool so that any unfinalized lingering commands 
        from un-collected datareaders are automatically reset and any lurking 
        transactions made on the connection are rolled back.</li>
      <li>Transaction isolation levels are now partially supported.&nbsp; Serializable 
        is the default, which obtains read/write locks immediately -- this is compatible 
        with previous releases of the provider.&nbsp; Unspecified will default to 
        whatever the default isolation mode is set to, and ReadCommitted will cause a 
        deferred lock to be obtained.&nbsp; No other values are legal.</li>
      <li>Revamped the test.exe program.&nbsp; It&#39;s now an interactive GUI application.&nbsp; 
        Easier for me to add tests now.</li>
      <li>Tweaks to the VS designer package and installer.</li>
      <li>More adjustments to the internal SQLite3.Prepare() method to account for both 
        kinds of lock errors when retrying.</li>
      <li>Stripped a lot of unnecessary interop() calls and replaced with base sqlite calls.&nbsp; 
        Revamped most of UnsafeNativeMethods to make it easier to port the code.</li>

      <li>Rerigged internal callbacks for userdef functions and other native to managed 
        callbacks.&nbsp; More portable this way.</li>
      <li>Source can now can be compiled with the SQLITE_STANDARD preprocessor symbol to 
        force the wrapper to use the stock sqlite3 library.&nbsp; Some functionality is 
        missing, but its minimal.&nbsp; None of the precompiled binaries are compiled 
        using this setting, but its useful for testing portability.</li>
      <li>Added &quot;boolean&quot; and a couple other missing datatypes to the &quot;DataTypes&quot; schema 
        xml file.&nbsp; Used by the VS designer when displaying tables and querying.</li>
      <li>Added a new connection string option &quot;Read Only&quot;.&nbsp; When set to True, the 
        database will be opened in read-only mode.</li>
      <li>Added a new connection string option &quot;Max Pool Size&quot; to set the maximum size 
        of the connection pool for a given db file connection.</li>
      <li>Added a new connection string option &quot;Default IsolationLevel&quot; to set the 
        default isolation level of transactions.&nbsp; Possible values are Serializable and 
        ReadCommitted.</li>
      <li>Added a new connection string option &quot;URI&quot; as an optional parameter for 
        compatibility with other ports of the provider.</li>
    </ul>

    <p><b>1.0.54.0 - July 25, 2008</b></p>
    <ul>
      <li>Fixed the setup project, which somehow &quot;forgot&quot; to include all the binaries in 
        the 53 release.</li>
      <li>Fixed a crash in the table designer when creating a new table and tabbing past 
        the &quot;Allow Nulls&quot; cell in the grid while creating a new column.</li>
      <li>Fixed a mostly-benign bug in SQLiteDataReader&#39;s GetEnumerator, which failed to 
        pass along a flag to the underyling DbEnumerator it creates.&nbsp; This one&#39;s 
        been around since day 1 and nobody&#39;s noticed it in all these years.</li>
      <li>Added a new connection string parameter &quot;Journal Mode&quot; that allows you to set 
        the SQLite journal mode to Delete, Persist or Off.</li>
    </ul>

    <p><b>1.0.53.0 - July 24, 2008</b></p>
    <ul>
      <li>Enabled sqlite_load_extension</li>
      <li>Added retry/timeout code to SQLite3.Prepare() when preparing statements for 
        execution and a SQLITE_BUSY error occurs.</li>
      <li>Added a new schema to SQLiteConnection.GetSchema() called <i>Triggers</i>.&nbsp; 
        Used to retrieve the trigger(s) associated with a database and/or table/view.</li>
      <li>Extensive updates to table/view editing capabilities inside Visual Studio&#39;s 
        Server Explorer.&nbsp; The program now parses and lets you edit CHECK constraints and 
        triggers on a table, as well as define triggers on views.&nbsp; Experimental 
        still, so e-mail me if you have issues.</li>
      <li>Minor bugfix to the ViewColumns schema to return the proper base column name 
        for a view that aliases a column.</li>
      <li>Fixed the insert/update/delete DML support in the Linq module.</li>
      <li>Changed the behavior of SQLiteCommand to allow a transaction to be set even if 
        the command hasn&#39;t been associated with a connection yet.</li>
    </ul>

    <p><b>1.0.52.0 - July 16, 2008</b></p>
    <ul>
      <li>Code merge with SQLite 3.6.0</li>
      <li>Added a lot of previously-missing exports to the DEF file for the 
        native library.</li>
      <li>Fixed SQLiteDataReader to check for an invalid connection before operating on 
        an open cursor.</li>
      <li>Implemented the Cancel() function of SQLiteCommand to cancel an active reader.</li>
      <li>Added beta table and view designers to the Visual Studio Server Explorer.&nbsp; You can now 
        edit/create tables and views, manage indexes and foreign keys from Visual Studio.&nbsp; 
        This feature is still undergoing testing so use at your own risk!</li>
      <li>Fixed the Server Explorer so VS2005 users can once again right-click tables 
        and views and open the table data.</li>
      <li>Added some new interop code to assist in returning more metadata not normally 
        available through the SQLite API.&nbsp; Specifically, index column sort modes 
        and collating sequences.&nbsp; Also added code to detect (but not parse) CHECK 
        constraints, so the table designer can pop up a warning when editing a table 
        with these constraints.&nbsp; Since I can&#39;t currently parse them.</li>
      <li>Lots of LINQ SQL generation improvements and fixes.</li>
      <li>Made some progress cleaning up and fixing up the schema definitions and 
        manifests for EdmGen.</li>
      <li>Added a built-in SQLiteFunction called last_rows_affected() which can be 
        called from SQL to get the number of rows affected by the last update/insert 
        operation on the connection.&nbsp; This is roughly equivalent to Sql Server&#39;s 
        @@ROWCOUNT variable.</li>      
    </ul>

    <p><b>1.0.51.0 - July 1, 2008</b></p>
    <ul>
      <li><b>VS2008 SP1 Beta1 LINQ Support</b></li>
      <li>Added experimental Entity Framework support in a new library, 
        System.Data.SQLite.Linq.&nbsp; Some things work, some don&#39;t.&nbsp; I haven&#39;t 
        finished rigging everything up yet.&nbsp; The core library remains stable.&nbsp; 
        All LINQ-specific code is completely separate from the core.</li>
      <li>Added some columns to several existing schemas to support some of the 
        EDM framework stuff.</li>
      <li>Minor tweaks to the factory to better support dynamic loading of the Linq 
        extension library for SQLite.</li>
      <li>SQLite&#39;s busy handler was interfering with the provider&#39;s busy handling 
        mechanism, so its been disabled.</li>
    </ul>

    <p><b>1.0.50.0 - June 27, 2008</b></p>
    <ul>
      <li>Fixed some lingering dispose issues and race conditions when some objects were finalized.</li>

      <li>Fixed the SQLiteConvert.Split() routine to be a little smarter when splitting 
        strings, which solves the quoted data source filename problem.</li>
      <li>Enhanced the mergebin utility to work around the strong name validation bug on 
        the Compact Framework.&nbsp; The old workaround kludged the DLL and caused WM6.1 
        to fail to load it.&nbsp; This new solution is permanent and no longer kludges 
        the DLL.</li>
    </ul>

    <p><b>1.0.49.0 - May 28, 2008</b></p>
    <ul>
      <li>Code merge with SQLite 3.5.9</li>
      <li>Fixed schema problems when querying the TEMP catalog.</li>
      <li>Changed BLOB datatype schema to return IsLong = False instead of True.&nbsp; This
        was preventing DbCommandBuilder from using GUID's and BLOB's as primary keys.</li>
      <li>Fix rollover issue with SQLite3.Reset() using TickCount.</li>
      <li>Fixed SQLiteDataReader to dispose of its command (if called for) before 
        closing the connection (when flagged to do so) instead of the other way around.</li>
      <li>Fixed a DbNull error when retrieving items not backed by a table schema.</li>
      <li>Fixed foreign key constraint parsing bug.</li>
      <li>Added FailIfMissing property to the SQLiteConnectionStringBuilder.</li>
      <li>Converted the source projects to Visual Studio 2008.</li>
    </ul>

    <p><b>1.0.48.0 - December 28, 2007</b></p>
    <ul>
      <li>Code merge with SQLite 3.5.4</li>
      <li>Calling SQLiteDataReader.GetFieldType() on a column with no schema information
        and whos first row is initially NULL now returns type Object instead of type DbNull.</li>
      <li>Added support for a new DateTime type, JulianDay.&nbsp; SQLite uses Julian dates
        internally.</li>
      <li>Added a new connection string parameter "Default Timeout" and a corresponding
        method on the SQLiteConnection object to change the default command timeout.&nbsp;
        This is especially useful for changing the timeout on transactions, which use SQLiteCommand
        objects internally and have no ADO.NET-friendly way to adjust the command timeout
        on those commands.</li>
      <li>FTS1 and FTS2 modules were removed from the codebase.&nbsp; Please upgrade all
        full-text indexes to use the FTS3 module.&nbsp;</li>
    </ul>

    <p><b>1.0.47.2 - December 10, 2007</b></p>
    <ul>
      <li>Fixed yet one more bug when closing a database with unfinalized command objects</li>
      <li>Fixed the DataReader's GetFieldType function when dealing with untyped SQLite affinities</li>

    </ul>

    <p><b>1.0.47.1 - December 5, 2007</b></p>
    <ul>
      <li>Fixed a leftover bug from the codemerge with SQLite 3.5.3 that failed to close a database.</li>

      <li>Fixed the broken Compact Framework distribution binary.</li>
      <li>SQLite 3.5.x changed some internal infrastructure pieces in the encryption interface
        which I didn't catch initially.&nbsp; Fixed.&nbsp;</li>
    </ul>

    <p><b>1.0.47.0 - December 4, 2007</b></p>
    <ul>
      <li>Code merge with SQLite 3.5.3</li>
      <li>Added installer support for Visual Studio 2008.&nbsp; Code is still using the
        VS2005 SDK so one or two bells and whistles are missing, but nothing significant.</li>
      <li>This is the last version that the FTS1 and FTS2 extensions will appear.&nbsp;
        Everyone should rebuild their fulltext indexes using the new FTS3 module.&nbsp;
        FTS1 and FTS2 suffer from a design flaw that could cause database corruption with
        certain vacuum operations.</li>
      <li>Fixed pooled connections so they rollback any outstanding transactions before
        going to the pool.&nbsp; </li>
      <li>Fixed the unintended breaking of the TYPES keyword, and mis-typing of untyped
        or indeterminate column types. </li>
      <li>Assert a FileIOPermission() requirement in the static SQLiteFunction constructor.
      </li>
      <li>The CE-only SQLiteFunction.RegisterFunction() is now available on the desktop
        platform for dynamic registration of functions.&nbsp; You must still close and re-open
        a connection in order for the new function to be seen by a connection.</li>
      <li>Fixed the "database is locked" errors by implementing behavioral changes in the
        interop.c file for SQLite.&nbsp; Closing a database force-finalizes any prepared
        statements on the database to ensure the connection is fully closed.&nbsp; This
        was rather tricky because the GC thread could still be finalizing statements itself.
        &nbsp;</li>
      <li>Modifed the mergebin utility to help circumvent a long-standing strong name verification
        bug in the Compact Framework.</li>
    </ul>

    <p><b>1.0.46.0 - September 30, 2007</b></p>
    <ul>
    <li>Fixed faulty logic in type discovery code when using SQLiteDataReader.GetValue().</li>
      <li>Fixed Connection.Open() bug when dealing with :memory: databases.</li>
      <li>Fixed SQLiteCommand.ExecuteScalar() to return a properly-typed value.</li>
      <li>Added support for SQLiteParameter.ResetDbType().</li>
      <li>Added test cases for rigid and flexible type testing.</li>
    </ul>

    <p><b>1.0.45.0 - September 25, 2007</b></p>
    <ul>
    <li><strong>Breaking change in GetSchema("Indexes") </strong>-- MetaDataCollections
      restrictions and identifier parts counts were wrong for this schema and I was using
      the wrong final parameter as the final restriction.&nbsp; Meaning, if you use the
      Indexes schema and are querying for a specific index the array should now be {catalog,
      null, table, index } instead of {catalog, null, table, null, index}</li>
      <li>Code merge with SQLite 3.4.2</li>
      <li>Fixed some errors in the encryption module, most notably when a non-default page
        size is specified in the connection string. </li>
      <li>Fixed SQLiteDataReader to better handle type-less usage scenarios, which also
        fixes problems with null values and datetimes.</li>
      <li>Fixed the leftover temp files problem on WinCE </li>
      <li>Added connection pooling.&nbsp; The default is disabled for now, but may change
      in the future.&nbsp; Set "Pooling=True" in the connection string to enable it. </li>
      <li>Sped up SQLiteConnection.Open() considerably.</li>
      <li>Added some more robust cleanup code regarding SQLiteFunctions.</li>
      <li>Minor additions to the code to allow for future LINQ integration into the main
        codebase.</li>
      <li>Fixed a long-standing bug in the Open() command of SQLiteConnection which failed
      to honor the documented default behavior of the SQLite.NET provider to open the
      database in "Synchronous=Normal" mode.&nbsp; The default was "Full". </li>
      <li>If Open() fails, it no longer sets the connection state to Broken.&nbsp; It instead
        reverts back to Closed, and cleans up after itself.</li>
      <li>Added several new parameters to the ConnectionString for setting max page count,
        legacy file format, and another called FailIfMissing to raise an error rather than
        create the database file automatically if it does not already exist.</li>
      <li>Fixed some designer toolbox references to the wrong version of the SQLite.Designer</li>
      <li>Fixed a bug in the mergebin utility with regards to COR20 metadata rowsize computations.&nbsp;
      </li>
      <li>Minor documentation corrections &nbsp;&nbsp;</li>
    </ul>

    <p><b>1.0.44.0 - July 21, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.4.1</li>
      <li>Fixed a bug in SQLiteConnection.Open() which threw the wrong kind of error in
        the wrong kind of way when a database file could not be opened or created.&nbsp;</li>
      <li>Small enhancements to the TYPES keyword, and added documentation for it in the
        help file.</li>
      <li>Hopefully fixed the occasional SQLITE_BUSY errors that cropped up when starting
        a transaction.&nbsp; Usually occurred in high-contention scenarios, and the underlying
        SQLite engine bypasses the busy handler in this scenario to return immediately.</li>
    </ul>

    <p><b>1.0.43.0 - June 21, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.4.0</li>
      <li>Fixed a reuse bug in the SQLiteDataAdapter in conjunction with the SQLiteCommandBuilder.&nbsp;
      It's been there unnoticed for more than a year, so it looks like most folks never
      encountered it. </li>
      <li>Fixed an event handler bug in SQLiteCommandBuilder in which it could fail to unlatch
        from the DataAdapter when reused.&nbsp; Relates to the previous bugfix.</li>
      <li>Fixed a double-dispose bug in SQLiteStatement that triggered a SQLiteException.&nbsp;</li>
    </ul>

    <p><b>1.0.42.0 - June 1, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.17</li>
      <li>Changed the SQLiteFunction static constructor so it only enumerates loaded modules
        that have referenced the SQLite assembly, which hopefully should cut down dramatically
        the time it takes for that function to execute.&nbsp;</li>
      <li>Added the FTS2 full-text search extension to the project.&nbsp; Look for FTS1
        to disappear within the next couple of revisions.&nbsp;</li>
      <li>Fixed a bug introduced with the finalizers that triggered an error when statements
        ended with a semi-colon or had other non-parsable comments at the end of a statement&nbsp;</li>
      <li>Fixed an intermittent multi-threaded race condition between the garbage collector
        thread and the main application thread which lead to an occasional SQLITE_MISUSE
        error.</li>
      <li>Fixed another issue relating to SQLite's inherent typelessness when dealing with
        aggregate functions which could return Int64 or Double or even String for a given
        row depending on what was aggregated.</li>
      <li>Remembered to recompile the DDEX portion of the engine this time, so Compact Framework
        users can once again use the design-time functionality</li>
    </ul>

    <p><b>1.0.41.0 - April 23, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.16</li>
      <li>Second go at implementing proper finalizers to cleanup after folks who've forgotten to Dispose() of the SQLite objects</li>

      <li>Enhanced GetSchema(IndexColumns) to provide numeric scale and precision values</li>
      <li>Fixed the column ordinals in GetSchema(IndexColumns) to report the ordinal of the column in the index, not the table</li>

      <li>Fixed a bug whereby parameters named with an empty string (such as String.Empty) were treated like a named parameter instead of an unnamed parameter</li>

    </ul>

    <p><b>1.0.40.0 - January 31, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.12</li>
      <li>Lots of new code to handle misuse of the library.&nbsp; Implemented finalizers
        where it made sense, fixed numerous garbage collector issues when objects are not
        disposed properly, &nbsp;fixed some object lifetime issues, etc.</li>
      <li>A failed Commit() on a transaction no longer leaves the transaction in an unusable
        state.</li>
    </ul>

    <p><b>1.0.39.1 - January 11, 2007</b></p>
    <ul>
    <li>Fixed a really dumb mistake that for some reason didn't trigger any errors in
      the testcases, whereby commands when associated with a connection were not adding
      or removing themselves from an internal list of commands for that connection --
      causing a "database is locked" error when trying to close the connection.</li>
    </ul>

    <p><b>1.0.39.0 - January 10, 2007</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.10</li>
      <li>Fixed a multi-threaded race condition bug in the garbage collector when commands
        and/or connections are not properly disposed by the user. </li>
      <li>Switched the encryption's internal deallocation code to use sqlite's built-in
        aux functions instead of modifying the pager.c source to free the crypt block.&nbsp;
        This eliminates the last of the code changes the provider makes to the original
        sqlite engine sources.&nbsp; Props to Ralf Junker for pointing that out.</li>
    </ul>

    <p><b>1.0.38.0 - November 22, 2006</b></p>
    <ul>
    <li>Fixed a bug when using CommandBehavior.KeyInfo whereby integer primary key columns may be duplicated in the results. </li>

      <li>Enhanced the CommandBuilder so that update/delete statements are optimized when the affected table contains unique constraints and
      a primary key is present.</li>
      <li>Fixed a bug in the DataReader when used in conjunction with CommandBehavior.CloseConnection.</li></ul>

    <p><b>1.0.37.0 - November 19, 2006</b></p>
    <ul>
    <li>Added support for CommandBehavior.KeyInfo.&nbsp; 
      When specified in a query, additional column(s) will be returned describing the
      key(s) defined for the table(s) selected in the query.&nbsp; This is optimized when
      INTEGER PRIMARY KEY is set for the given tables, but does additional work for other
      kinds of primary keys.</li>
      <li>Removed the default values from SQLiteDataReader.GetTableSchema(), to better follow
        Sql Server's pattern and suppress schema errors when loading the records into a
        dataset/datatable.</li>
      <li>Allow integers to implicitly convert to double/decimal/single.</li></ul>

    <p><b>1.0.36.1 - October 25, 2006</b></p>
    <ul>
    <li>Added support for LONGVARCHAR, SMALLDATE and SMALLDATETIME.  These were actually added in 1.0.36.0 but were undocumented.</li>

    <li>Fixed the embedded helpfile which was accidentally built from old sources. </li>
    <li>Fixed an unfortunate re-entry of a bug in the .36 codebase that caused the provider to "forget" about commands on a connection under certain circumstances.</li>

    </ul>

    <p><b>1.0.36.0 - October 23, 2006</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.8, including support for full-text search via the FTS1
      extension.&nbsp;</li><li>Fixed a bug retrieving data types when UseUtf16Encoding is true.  Side-effect of further merging the common code between the two base classes.</li>

      <li>Fixed a bug with System.Transactions whereby a connection closed/disposed within
        a transaction scope is rolled back and cannot be committed.</li>
      <li>Added more error checking and reporting to transactions to help user's isolate
        the source of transaction failures.</li>
      <li>Implemented a workaround for a Compact Framework issue regarding strong-named
        assemblies containing a PE section with a raw size less than the virtual size.&nbsp;</li>
    </ul>

    <p><b>1.0.35.1 - September 12, 2006</b></p>
    <ul>
    <li>Fixed the TYPES keyword to work when UseUTF16Encoding is true.</li>
    <li>Fix another bug revealed in 1.0.35.0 regarding infinite loops when the 2nd or subsequent statements of a semi-colon separated command cannot be parsed.</li>

      <li>Updated the help documentation.&nbsp;</li>
    </ul>

    <p><b>1.0.35.0 - September 10, 2006</b></p>
    <ul>
    <li>Fixed an infinite loop bug in SQLiteCommand caused when multiple semi-colon separated
      statements in a single command are executed via datareader and one of the statements

      contains a syntax error preventing it from being prepared.&nbsp;</li><li>Added the TYPES preparser keyword to be placed before a SELECT statement to
    aid the wrapper in converting expressions in a subsequent select clause into more
    robust types.&nbsp; Documentation yet to be integrated, but available on the forums.</li>
      <li>Added a new connectionstring parameter "BinaryGUID=true/false" (default is "true").&nbsp;
        When true, guid types are stored in the database as binary blobs to save space.&nbsp;
        Binary has been the default format since 1.0.32.0 but this parameter eases backward
        compatibility.</li>
    </ul>

    <p><b>1.0.34.0 - September 4, 2006</b></p>
    <ul>
    <li>Fixed a bug in SQLiteParameterCollection.RemoveAt(namedparam)</li>
    <li>Fixed a bug in SQLiteDataReader introduced in 1.0.30 that broke DateTimes using the Ticks option in the connection string.</li>

      <li>Fixed a bug in the recent changes to guid behavior wherein using a datareader's
        indexer to fetch a guid from a column containing both binary and text guids would
        sometimes return a byte array instead of a guid.</li>
      <li>Enacted a workaround involving typed datasets in Compact Framework projects in
        which it took an excessive amount of time to open a form and generated a lot of
        temporary files in the user's Local Settings\Application Data\Microsoft\VisualStudio\8.0\Assembly
        References folder.</li>
    </ul>

    <p><b>1.0.33.0 - August 21, 2006</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.7</li>
      <li>Fixed a bug in SQLiteConnection that caused it to "forget" about commands bound
      to it and occasionally throw an error when a database is closed and opened repeatedly.&nbsp;
      </li>
    </ul>

    <p><b>1.0.32.0 - August 6, 2006</b></p>
    <ul>
    <li>Added AllowPartiallyTrustedCallers attribute to the assembly</li><li>Added the missing "nchar" type</li>

      <li>Added support for binary Guid's.&nbsp; Guids are now stored as binary by default
        when using parameterized queries.&nbsp; Text guids are still fully supported.</li>
      <li>Fixed a TransactionScope() error that caused the transaction not to be completed.</li>
      <li>Enhanced parameter names so that if they are added to the Parameters collection
        without their prefix character (@ : or $) they are still properly mapped.&nbsp;</li>
    </ul>

    <p><b>1.0.31.0 - July 16, 2006</b></p>
    <ul>
    <li>Re-applied the view parsing bugfix in 1.0.29.0 that was accidentally reverted
      out of the 30 build.</li><li>Fixed SQLiteCommand.ExecuteScalar() to return null instead of DbNull.Value
    when no rows were returned.</li>
      <li>Design-time installer now installs the package-based designer on full Visual Studio
        versions.&nbsp; Express editions continue to use the packageless designer.</li>
      <li>In Visual Studio (not Express), you can now right-click a SQLite connection in
        the Server Explorer and vacuum the database and change the encryption password.</li>
    </ul>

    <p><b>1.0.30.1 - July 2, 2006</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.6</li>
      <li>Added support for the |DataDirectory| keyword in the Data Source filename string.&nbsp;
      </li>
      <li>Added hook notification support to SQLiteConnection.&nbsp; Specifically, there
      are three new events on the SQLiteConnection object which are raised when an update/insert/delete
      occurs and when transactions are committed and rolled back.</li><li>Changed SQLiteTransaction to default to BEGIN IMMEDIATE instead of just BEGIN,

    which solves a multithreaded race condition.&nbsp;</li>
      <li>Changed SQLiteDataReader to better support SQLite's typelessness.&nbsp; The data
        reader no longer caches column affinity, but re-evaluates it for each column/row.</li>
      <li>Fixed a bug in Prepare() which caused an intermittant fault due to the code accessing
        the memory of an unpinned variable.&nbsp;</li>
      <li>Fixed a multithreaded lock-retry bug in in SQLiteConnection.Open() and in
    SQLiteTransaction, which failed to use a command timeout before giving up.</li>
    </ul>

    <p><b>1.0.29.0 - May 16, 2006</b></p>
    <ul>
    <li>Fixed a bug in the Views schema information which caused multi-line view definition statements not to be parsed</li>

    <li>Fixed a parsing bug in SQLiteDataReader.GetSchemaTable() to account for numeric(x,y) datatypes with specified precision and scale</li>

    <li>Fixed a bug in SQLiteConnection.Open() which tried to automatically enlist in an ambient transaction but had not yet set the state of the database to Opened, thereby causing a transaction fault</li>


    <li>Changed SQLiteException to inherit from DbException on the full framework</li>
    </ul>

    <p><b>1.0.28.0 - April 14, 2006</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.5</li>
      <li>You can now specify a relative path in the Compact Framework's "Data Source" by
        prefixing the file with ".\".&nbsp; i.e. "Data Source=.\\mydb.db3"</li>
      <li>Several more changes and enhancements to schemas for better compatibility.</li>
      <li>Fixed several bugs with the 64-bit builds of the provider.&nbsp; The x64 binary
        is now optimized.</li>
      <li>Design-time installer now tries to install the 64-bit builds into the GAC along
        with the 32-bit build.</li>
      <li>Fixed a bug in the SQLiteDataReader.GetSchemaTable() function when used with tables
        containing apostrophes.</li>
      <li>Fixed an XSD-related bug whereby the XSD utility was unable to locate the provider
        and could not generate typed datasets.</li>
      <li>Added NTEXT and STRING datatypes to the list of recognized keywords (used for
        schema retrieval).</li>
      <li>Due to the XSD bug and other potential problems related to external build utilities,
        changes to the installation of the designer have had to be made.&nbsp; The installer
        used to write the DbProviderFactories XML into the devenv.exe.config file and its
        express cousins, but now has to write instead to the machine.config.</li>
      <li>Installer writes to both the 32-bit machine.config and the 64-bit machine.config
        if it exists.&nbsp;</li>
    </ul>

    <p><b>1.0.27.1 - February 28, 2006</b></p>
    <ul>
    <li>Fixed a bug when doing data binding in Compact Framework projects that prevented
      you from assigning a typed dataset to a bindingsource.&nbsp; It turns out, the CF
      version of the SQLite provider needs to be flagged as retargetable so it'll work
      in the design-time desktop environment.&nbsp; No changes were made to the desktop
      build, but the revision was bumped on all libraries anyway in order to keep them
      sync'd.&nbsp;</li></ul>

    <p><b>1.0.27.0 - February 27, 2006</b></p>
    <ul>
    <li>Many optimizations and a few more minor adjustments to schemas and schema retrieval
      performance.</li>
      <li>Lots of design-time attributes added to the code.&nbsp; The DbDataAdapter, DbCommand,
        and DbConnection objects now have greatly enhanced design-time capabilities when
        added to the toolbox and dropped on a form.</li>
      <li>Lots of Server Explorer enhancements.</li>
      <li>Binaries are now distributed in a setup program for easier administration and
        configuration of the provider.</li>
    </ul>

    <p><b>1.0.26.2 - February 15, 2006</b></p>
    <ul>
    <li>Yet another bugfix to index schemas, which was incorrectly marking most indexes
      as primary key indexes.</li><li>Fixed GetSchema() to accept a null string array.</li><li>Fixed a misspelled export in the core C library that prevented databases opened

    with UTF16Encoding from getting schema information and would likely cause an error
    if attempted.</li></ul>

    <p><b>1.0.26.1 - February 14, 2006</b></p>
    <ul>
    <li>Fixed even more minor schema bugs having to do with indexes.</li><li>Added two missing pieces in the SQLite designer which were preventing it from

    being used from within VS Express editions.&nbsp;</li><li>Several bugfixes to the design-time installer program, including supporting
    64-bit environments.</li></ul>

    <p><b>1.0.26.0 - February 11, 2006</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.4</li><li>Fixed an encryption bug when changing the password of databases over 1gb in

      size.&nbsp;</li><li>Fixed various designer issues related to construction of named parameters.</li>
      <li>Retooled the GetSchema() method of SQLiteDataReader to use the new 3.3.4 API functions,
        and made several enhancements and fixes to schemas.&nbsp;</li>
      <li>Implemented the SourceColumnNullMapping property of SQLiteParameter to fix
    a DbCommandBuilder code generation bug.&nbsp;</li><li>Removed the runtime dependency on MSVCR80.DLL.&nbsp; File size is somewhat

    larger for the varying desktop versions.</li><li>Created an install program to manage installation and uninstallation of the
    SQLite design-time support.</li>
      <li>Designer support now works for all Visual Studio editions, including all Express
        Editions.</li>
      <li>Design-time installer will now remove (if present) the machine.config SQLite entries
        in favor of installing the xml code into the devenv.exe.config file (or any of the
        variations for express editions).&nbsp; The officially-accepted behavior of using
        DbProviderFactories is to add the code to your app.config file, and the machine.config
        file should not be touched.</li>
    </ul>

    <p><b>1.0.25.0 - January 31, 2006</b></p>
    <ul>
    <li>Code merge with SQLite 3.3.3</li><li>Added automatic distributed transaction enlistment and implemented the DbConnection.EnlistTransaction

    method for manual enlistment.</li>
      <li>Nested transactions are now supported.</li>
      <li>Rearranged the timing of SetPassword(), which now must be called before the database
        is opened instead of afterwards.&nbsp; Optionally, the password can be supplied
        in the ConnectionString.</li>
      <li>Fixed a bug in SQLiteFunction that caused a failure when an empty resultset was
        returned and a custom user aggregate function was used in the query.</li>
      <li>The designer has had another round of cleanup applied, in preparation for moving
        to a VS package.</li>
      <li>Added SQLiteMetaDataCollectionNames class.</li>
    </ul>

    <p><b>1.0.24.6 beta - January 23, 2006</b></p>
    <ul>
    <li>This beta is built from sqlite.org's 3.3.2 beta.</li><li>Eliminated the static linking of mscoree from all binaries.&nbsp; Native projects

      can now use the library without any dependencies on the .NET framework, while managed
      projects continue to be able to use the library normally.</li></ul>

    <p><b>1.0.24.5 beta - January 20, 2006</b></p>
    <ul>
    <li>This beta is built from sqlite.org's 3.3.1 alpha and contains development-in-progress code.&nbsp; Therefore no guarantees
      can be made regarding its suitability for production use.</li>

    <li><strong>You no longer need to distribute 2 files on the CompactFramework.&nbsp;
      You can delete SQLite.Interop.DLL entirely.&nbsp; </strong>I wrote a custom tool
      called "mergebin" (available in the source zip file) which combines the two libraries
      and gets around a glaring defect in the VS2005 linker for ARM processors which doesn't
      allow you to link netmodules.</li>
      <li><strong>x64 and ia64 builds now use the same strong name as the x86 build.</strong>&nbsp;
        This means breaking backward compatibility, but it was necessary in order to allow
        you to drop any of those 3 builds onto a PC and have your .NET program run properly.&nbsp;
        Prior to this, you'd get an error if you built your program using the x86 build,
        and then installed the x64 version on a target machine and tried to run your program
        against it.</li>
      <li>The entire source project has been gone over top to bottom.&nbsp; A debug build
        no longer combines the binaries into a single module, which was preventing proper
        debugging.</li></ul>

    <p><b>1.0.24.4 beta - January 16, 2006</b></p>
    <ul>
    <li>This beta is built from sqlite.org's 3.3.1 alpha and contains development-in-progress code.&nbsp; Therefore no guarantees
      can be made regarding its suitability for production use.</li>

    <li>Fixed a bug in the UTF-16 handling code for preparing statements due to a behavioral
      change in SQLite 3.3.0.</li>
      <li>Added pager.c code necessary to cleanup after an encrypted file is closed.</li>
      <li>Fixed an encryption bug that caused a fault when an encrypted file was rolled
        back.</li>
      <li>Modified the testcase code to take advantage of optimizations regarding the use
        of a DbCommandBuilder.&nbsp; DataAdapter insert speed increased dramatically as
        a result.</li>
    </ul>

    <p><b>1.0.24.3 beta - January 10, 2006</b></p>
    <ul>
    <li>This beta is built from sqlite.org's 3.3.0 alpha and contains development-in-progress code.&nbsp; Therefore no guarantees

      can be made regarding its suitability for production use.</li><li>Added support for database encryption at the pager level.&nbsp; Databases
    are encrypted using a 128-bit RC4 stream algorithm.&nbsp; To open an existing encrypted
    database, you may now specify a "Password={password}" text in the ConnectionString,
    or you may call the SQLiteConnection.SetPassword() function to set the password
    on an open connection. &nbsp;To encrypt existing non-encrypted databases or to change
    the password on an encrypted database, you must use the SQLiteConnection.ChangePassword()
    function.&nbsp; If you use SetPassword() instead of specifying a password in the
    connection string, or call ChangePassword() you may use a binary byte array or a
    text string as the password.</li>
      <li>Rewrote the locking implementation for the Compact Framework.&nbsp; It is now
        more robust and incorporates into the SQLite codebase more efficiently than the
        previous CE adaptation.</li>
      <li>Moved some of the embedded schema XML data into a resource file to ease code readability.</li>

      <li>Automated the fixup of the original sqlite codebase's source prior to compiling,
        to ease merging with sqlite.org's source.</li>
      <li>Fixed a memory leak in SQLiteCommand due to it not removing an internal reference
        to itself in SQLiteConnection.&nbsp; </li>
    </ul>

    <p><b>1.0.24.2 - December 30, 2005</b></p>
    <ul>
    <li>Fixed the SQLiteDataReader.HasRows property to return the proper value.</li>
      <li>Implemented the inadvertently neglected RecordsAffected property on SQLiteDataReader.
      </li>
      <li>SQLiteFunction static constructor was changed to pre-filter classes with only the
        SQLiteFunctionAttribute.&nbsp; The code was throwing an exception when certain
        assemblies were referenced in a project. </li>
      <li>Fixed the SQLiteDataAdapter OnRowUpdated event, which was using the wrong variable
        to find the attached event handler and subsequently not raising the event.</li>
      <li>Small optimizations and fixes to SQLiteDataReader.NextResult().&nbsp;</li>
    </ul>

    <p><b>1.0.24.1 - December 19, 2005</b></p>
    <ul>
    <li>Update core SQLite engine to 3.2.8&nbsp;</li></ul>

    <p><b>1.0.24 - December 9, 2005</b></p>
    <ul>
    <li>Fixed the<em> Catalogs</em> schema bug that caused attached databases not to be re-attached to a cloned connection
    </li>
      <li>Enhanced transactions to allow for a deferred or immediate writelock. &nbsp;SQLiteConnection.BeginTransaction()
        now has an additional overload to support it&nbsp;</li><li>Commands are now prepared as they are executed instead of beforehand.&nbsp; This

      fixes a bug whereby a multi-statement command that alters the database and subsequently
      references the altered data would fail during Prepare().</li><li>Tightened up the SQLiteDataReader to prevent reading columns before calling
    the first Read() and to prevent reading columns after the last Read().</li>

      <li>A more descriptive error is thrown if there aren't enough parameters in the command
        to satisfy the parameters required by the statement(s).&nbsp;</li>
    </ul>

    <p><b>1.0.23 - November 21, 2005</b></p>
    <ul>
    <li>Named parameters may now begin with <strong>@</strong> to ease portability of
      the provider. SQLite's named parameters are ordinarily prefixed with a <strong>: </strong>
      or<strong> $</strong>.&nbsp; The designer will still use the <strong>$</strong>
      prefix however, since its more compatible with the default SQLite engine.</li><li>Added several alternate ISO8601 date/time formats to SQLiteConvert.cs to increase

    compatibility.</li>
      <li>Relaxed coersion restrictions to work better with SQLite's inherent typelessness.&nbsp;</li>
    </ul>

    <p><b>1.0.22 - November 11, 2005</b></p>
    <ul>
    <li>Fixed some globalization issues which resulted in incorrect case-insensitive comparisons</li>

      <li>Fixed a bug in the routine that finds all user-defined functions in a loaded assembly.&nbsp;
        It would throw an exception if any of the types in the assembly could not be loaded.&nbsp;
        The exception is now caught and handled appropriately.</li>
    </ul>

    <p><b>1.0.21 - November 4, 2005</b></p>
    <UL>
      <li>Fixed a designer bug when creating typed datasets with parameterized queries.</li>
      <li>The above fix then exposed another bug in the datareader's ability to query schema
        information on parameterized commands, which was also fixed.</li>
      <li>Compiled against the RTM version of VS2005.</li>
      <li>Rewrote the design-time install script to use the XML DOM objects when writing
        to the machine.config and to automatically register the DLL in the GAC.</li><li>Made changes to the app.config descriptions and help file to improve version-independent

        factory support.</li></UL>

    <p><b>1.0.20 - October 19, 2005</b></p>
    <UL>
      <li>
        Fixed a shortcut in SQLiteBase.GetValue which was insufficient for 
        international environments.&nbsp; The shortcut was removed and the "proper" 
        procedure put in.</li></UL>

    <p><b>1.0.19 - October 5, 2005</b></p>
    <UL>
      <li>
      Code merge with SQLite 3.2.7
      <LI>
      Fixed bugs in the CE port code (os_wince.c)&nbsp;which were brought to 
      light&nbsp;by&nbsp;recent changes in the SQLite engine.
      <LI>
        Recompiled and modified to be compatible with the September VS2005 Release 
        Candidate.<br>
        Beta 2 users should continue to use 1.0.18.1</LI></UL>

    <p><b>1.0.18.1 - September 19, 2005</b></p>
    <UL>
      <li>
        Code merge with SQLite 3.2.6</li></UL>

    <p><b>1.0.18 - September 1, 2005</b></p>
    <UL>
      <li>
        Added type-specific method calls when using the various SQLite classes that 
        would've normally returned a a generic Db base class, which aligns the code 
        better with the Microsoft-supplied data providers.</li></UL>

    <p><b>1.0.17 - August 26, 2005</b></p>
    <ul>
      <li>
      Code merge with SQLite 3.2.5
      <li>
      Added Itanium and x64 build settings to the project (needs testing)
      <li>
      Bugfixes and enhancements to several schema types
      <li>
      Additional design-time support to include index and foreign key 
      enumerations.&nbsp; Requires re-registering the designer using 
      INSTALL.CMD.&nbsp; The new designer code now allows the VS query designer and 
      typed datasets to automatically link up foreign keys, use indexes, and 
      automatically generate relationships from the schema.<li>
        Additional static methods on SQLiteConnection to create a database file, 
        encrypt a file using the Encrypted File System (EFS) on NTFS (requires NT 2K or 
        above) and NTFS file compression</li>
    </ul>
    <p><b>1.0.16 - August 24, 2005</b></p>
    <ul>
      <li>


      Code merge with SQLite 3.2.4 with the large delete bugfix in CVS (which will 
      become 3.2.5 soon)
      <li>
        Added new GetSchema() types: IndexColumns, ViewColumns, ForeignKeys</li>
    </ul>

    <p><b>1.0.15 - August 22, 2005</b><br>
    </p>
    <ul>
      <li>
      Code merge with SQLite 3.2.3
      <LI>
        Minor updates for better design-time experience. More design-time code to 
        follow in subsequent releases.</LI>
    </ul>

    <p><b>1.0.14 - August 16, 2005</b><br>
    </p>
    <ul>
      <li>
      Fixed a bug in the SQLiteDataAdapter due to insufficient implementation of the 
      class.&nbsp; The RowUpdating and RowUpdated events are now properly 
      implemented, but unfortunately inserting and updating data in a DataTable or 
      DataSet is now much slower.&nbsp; This is the proper design however, so the 
      changes are here to stay.
      <LI>
      Lots of schema changes to support Visual Studio's Data Designer architecture.<li>Added 
        Designer support for the provider.&nbsp; It's not 100%, but you can design 
        queries, add typed datasets and perform quite a number of tasks all within 
        Visual Studio now.</li></ul>

    <P><B>1.0.13 - August 8, 2005</B><BR>
    </P>
    <DIV>
      <UL>
        <LI>
        Fixed a named parameter bug in the base SQLite_UTF16 class, which of course 
        only showed up when a database connection was opened using the 
        UseUTF16Encoding=True parameter.
        <LI>
          Fixed a performance issue in SQLite_UTF16 involving string marshaling.</LI></UL>
    </DIV>
    <P><B>1.0.12 - August 5, 2005</B><BR>
    </P>
    <DIV>
      <UL>
        <LI>




          Full support for the Compact Framework.&nbsp; Each build (Debug/Release) now 
          has a&nbsp;platform, either Win32 or Compact Framework.&nbsp; The correct 
          projects are built accordingly.&nbsp; See the&nbsp;<A href="#redist">Distributing 
            SQLite</A>
        section for information on what files need to be distributed for each 
        platform.&nbsp;
        <LI>
        Modified SQLite3.Reset() and Step() functions to transparently handle timeouts 
        while waiting on the database to become available (typically when a writer is 
        waiting on a reader to finish, or a reader is waiting on a writer to finish).
        <LI>
        Lots of code cleanup&nbsp;as suggested&nbsp;by the Code Analyzer (FxCop).
        <LI>
        Lots of updates to the helpfile (as you can see).
        <LI>
          Statements&nbsp;were already prepared lazily&nbsp;in a SQLiteCommand, but now 
          its even more lazy.&nbsp; Statements are now only prepared if the statements 
          haven't been previously prepared and a Prepare() function is called (and the 
          command is associated with a connection) or just prior to the command being 
          executed.&nbsp;</LI></UL>
    </DIV>
    <P><B>1.0.11 - August 1, 2005</B><BR>
    </P>
    <UL>
      <LI>
        <STRONG>For everything except the Compact Framework, System.Data.SQLite.DLL is 
          now the <EM>only</EM> DLL required to use this provider!</STRONG>&nbsp; The 
      assembly is now a multi-module assembly, containing both the native SQLite3 
      codebase and the C# classes built on top of it.&nbsp; The Compact Framework 
      version (when completed) will not be able to support this feature, so backwards 
      compatibility with the Compact Framework has been preserved for the future.
      <LI>
        Fixed a bug in SQLiteCommand.ExecuteScalar() that caused it to stop executing 
        commands once it obtained the first column of the first row-returning 
        resultset.&nbsp; Any remaining statements after the row-returning statement was 
        ignored.
      </LI>
    </UL>
    <P><B>1.0.10 - June 10, 2005</B><BR>
    </P>
    <UL>
      <LI>
      Fixed a bug in the SQLite3.cs Prepare() function that created a statement even 
      when the SQLite engine returned a NULL pointer. Typically this occurs when 
      multiple statements are processed and there are trailing comments at the end of 
      the statement.
      <LI>
        Fixed a bug in SQLiteStatement.cs that retrieved parameter names for a 
        parameterized query.&nbsp; SQLite's parameters are 1-based, and the function 
        was starting at 0.&nbsp; This was fine when all parameters were unnamed, but 
        for named parameters it caused the parameters to be out of whack.
      </LI>
    </UL>
    <P><B>1.0.09a - May 25, 2005</B><BR>
    </P>
    <UL>
      <LI>
      Fixed a broken helpfile and corrected some obsolete help remarks in 
      SQLiteFunction.cs
      <LI>
        Added a version resource to the SQLite.Interop.DLL.&nbsp;</LI></UL>

    <P><B>1.0.09 - May 24, 2005</B><BR>
    </P>
    <UL>
      <LI>
      Code merge with the latest 3.21 version of SQLite.
      <LI>
        Removed obsolete methods and properties for Whidbey Beta 2</LI></UL>

    <P><B>1.0.08 Refresh - Mar 24, 2005<BR>
      </B>
    </P>
    <UL>
      <LI>
      Code merge with the latest 3.20 version of SQLite.
      <LI>
        Recompiled the help file to fix a build error in it.
      </LI>
    </UL>
    <P><B>1.0.08 - Mar 11, 2005<BR>
      </B>
    </P>
    <UL>
      <LI>
      Added additional #if statements to support the old beta 1 edition of VS2005.
      <LI>
        Code merged the SQLite 3.14 source.
      </LI>
    </UL>





    <P><B>1.0.07 - Mar 5, 2005</B><BR>
    </P>
    <UL>
      <LI>
      Made more optimizations to frequently-called functions, resulting in 
      significant performance gains in all tests.
      <LI>
        Recompiled the binaries using the latest VS2005 February CTP, resulting in yet 
        more significant speed gains.&nbsp; The 100k insert test used to take 3.5 
        seconds and the insertwithidentity took almost 8 seconds.&nbsp; With the above 
        two changes, those tests are now executing in 1.9 and 4.9 seconds respectively.</LI></UL>
    <P><B>1.0.06 - Mar 1, 2005<BR>
      </B>
    </P>
    <UL>
      <LI>
      Speed-ups to SQLiteDataReader.&nbsp; It was interop'ing unnecessarily every 
      time it tried to fetch a field due to a logic error.
      <LI>
      Changed/Added some code to SQLiteConvert's internal DbType, Type and 
      TypeAffinity functions.
      <LI>








      Fixed the SQLiteDataReader to obey the flags set in the optional 
      CommandBehavior flag from SQLiteCommand.ExecuteReader().
      <LI>
      Changed the default page size to 1024 to reflect the defaults of SQLite.&nbsp; 
      Ignores the "Page Size" connection string option for memory databases, as tests 
      revealed that changing it resulted in memory corruption errors.
      <LI>
        Performance enhancements to the SQLiteCommand and SQLiteStatement classes which 
        reduced the 100,000 row insert execution time as well as the various Function 
        execution times significantly.
      </LI>
    </UL>
    <P><B>1.0.05 - Feb 25, 2005</B>
    </P>
    <UL>
      <LI>
      Fixed the SQLite3 C# class step/reset functions to accomodate schema changes 
      that invalidate a prepared statement.&nbsp; Statements are recompiled 
      transparently.
      <LI>
      Moved all native DLL declarations to an UnsafeNativeMethods class.
      <LI>






      Split several classes into their own modules for readability.
      <LI>
      Renamed many internal variables, reviewed access to variables marked as 
      internal and altered their protection levels accordingly.
      <LI>
      Due to the presence of the altered sqlite3 codebase and so many added interop 
      functions, I decided to rename the sqlite3 C project and the DLL to 
      SQLite.Interop.DLL.&nbsp; This is the same core sqlite3 codebase but designed 
      specifically for this ADO.NET provider.&nbsp; This eliminates any possibility 
      of someone dropping another build of sqlite3.dll into the system and rendering 
      the provider inoperable.&nbsp; In the future if the folks at sqlite.org finally 
      introduce a method of retrieving column usage for an arbitrary prepared 
      statement, I'll retool this library to be a lightweight function call wrapper 
      around the core binary distribution.
      <LI>
      Added [SuppressUnmanagedCodeSecurity] attribute to the UnsafeNativeMethods 
      class which brings VS2005 November CTP execution speeds inline with the 
      December CTP.
      <LI>
        Added a <B>bin</B>
      directory to the project root where pre-compiled binaries can be found.





      <LI>
        Added a <B>doc</B>
      directory where preliminary documentation on the class library can be found.
      <LI>
        Documented a lot more of the classes internally.
      </LI>
    </UL>
    <P><B>1.0.04 - Feb 24, 2005</B>
    </P>
    <UL>
      <LI>
      Removed the SQLiteContext class and revamped the way UserFunctions work to 
      simplify the imlementation.
      <LI>
      Fixed a counting bug in the TestCases class, specifically in the function tests 
      where I wasn't resetting the counter and it was consequently reporting 
      intrinsic and raw select calls as being much much faster than they actually 
      were.&nbsp; The numbers are now much closer to what I expected for performance, 
      with .NET user-functions still being the slowest, but only by a small margin.
      <LI>
      Small performance tweaks to SQLiteDataReader.
      <LI>
      Added PageSize to the SQLiteConnectionStringBuilder and subsequently to the 
      SQLiteConnection
      <LI>
        Added a PRAGMA encoding=XXX execution statement to the SQLiteConnection after 
        opening a connection.
      </LI>
    </UL>
    <P><B>1.0.03 - Feb 23, 2005</B>
    </P>
    <UL>
      <LI>
      Fixed up SQLiteCommandBuilder to correct implementation errors, which resulted 
      in an enormous performance boost in the InsertMany test.&nbsp;&nbsp; 10,000 row 
      insert that executed in 1500ms now executes in 500ms.
      <LI>
      Fixed several errors in the SQLite3_UTF16 class.&nbsp; ToString() was working 
      incorrectly and the Open() method failed to register user defined functions and 
      collations.
      <LI>
      Fixed a bug in SQLiteCommand.ClearCommands() whereby only the first statement 
      was being properly cleaned up.
      <LI>
      Fixed a bug in SQLiteDataReader whereby calling NextResult() would not properly 
      reset the previously-executed command in the sequence.
      <LI>
        Added an InsertManyWithIdentityFetch test, which appends a select clause to 
        populate the ID of the last inserted row into the InsertCommand, demonstrating 
        ADO.NET's ability to auto-fetch identity columns on insert.
      </LI>
    </UL>
    <P><B>1.0.02 - Feb 21, 2005</B></P>
    <UL>
      <LI>
      Tweaks to the xxx_interop functions that return char *'s, so they also return 
      the length.&nbsp; Saves an interop call to get the UTF-8 string length during 
      conversion to a .NET string.
      <LI>
      Reworked the whole interop.c thing into interop.h and reduced the code required 
      to merge the main sqlite3 codebase.
      <LI>
        Added support for user-defined collations.
      </LI>
    </UL>
  </body>
</html>


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


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

1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40









41
42
43
44
45
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113





114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132




133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277

278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437


438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483

484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674

675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715

716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766

767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031

1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066

1067

1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079

1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095

1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109

1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142

1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155

1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241

1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504

1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855

1856
1857

1858
1859
1860

1861

1862
1863

1864

1865
1866
1867
1868

1869
1870
1871
1872

1873
1874
1875
1876
1877
1878

1879

1880

1881

1882
1883

1884
1885
1886
1887
1888
1889


1890
1891
1892
1893
1894

1895
1896
1897
1898
1899
1900

1901

1902
1903
1904
1905
1906
1907
1908

1909
1910
1911
1912


1913
1914
1915
1916
1917
1918
1919

1920
1921
1922
1923
1924

1925


1926


1927
1928
1929
1930
1931
1932
1933
1934

1935


1936
1937
1938

1939

1940

1941
1942
1943
1944
1945
1946
1947
1948
1949

1950
1951
1952
1953
1954
1955

1956
1957
1958

1959
1960
1961
1962
1963

1964
1965
1966


1967
1968
1969
1970
1971
1972
1973
1974
1975

1976


1977
1978
1979
1980
1981

1982

1983
1984
1985
1986
1987
1988

1989

1990
1991
1992
1993
1994







1995
1996
1997
1998
1999
2000
2001
2002
2003

2004
2005

2006
2007
2008
2009










2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020

2021
2022
2023

2024
2025
2026



2027







2028
2029
2030
2031
2032
2033
2034
2035

2036
2037

2038
2039
2040
2041
2042
2043

2044
2045

2046
2047



2048
2049
2050
2051
2052
2053
2054






2055
2056
2057

2058
2059

2060
2061
2062
2063
2064

2065

2066
2067

2068
2069
2070
2071
2072
2073
2074

2075
2076
2077

2078
2079
2080

2081
2082

2083
2084

2085
2086
2087
2088
2089
2090
2091

2092
2093
2094

2095
2096

2097
2098

2099
2100
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
ADO.NET SQLite Data Provider<br />
Version 1.0.119.0 - May XX, 2024 <font color="red">(release scheduled)</font><br />

Using <a href="https://www.sqlite.org/releaselog/3_45_3.html">SQLite 3.45.3</a><br />Originally written by Robert Simpson<br />
Released to the public domain, use at your own risk!<br />
Official provider website:&nbsp;<a href="https://system.data.sqlite.org/">https://system.data.sqlite.org/</a><br />
Legacy versions:&nbsp;<a href="https://sourceforge.net/projects/sqlite-dotnet2/">https://sourceforge.net/projects/sqlite-dotnet2/</a><br />
<br />
The current development version can be downloaded from <a href="https://system.data.sqlite.org/index.html/timeline?y=ci">
https://system.data.sqlite.org/index.html/timeline?y=ci</a>
<br />
<br />

<h2><b>Features</b></h2>

<ul>
  <li>
    Written from scratch on Visual Studio 2008 specifically for ADO.NET,
    implementing all the base classes and features recently introduced in the
    framework, including automatic transaction enlistment.
  </li>

  <li>
    Supports the Full and Compact .NET Framework, and native C/C++ development.
    100% binary compatible with the original sqlite3.dll.
  </li>

  <li>
    Full support for Mono via a &quot;managed only&quot; provider that runs
    against the official SQLite 3.6.1 or higher library.
  </li>

  <li>Full Entity Framework support (ADO.NET 3.5 SP1).</li>

  <li>









    On the Compact Framework, it is faster than SQL Server Mobile.  SQLite's
    installed size is a fraction of SQL Mobile's.  It uses less memory at
    runtime, runs queries faster, and has a smaller database file size as well.
  </li>

  <li>
    Encrypted database support.  Encrypted databases are fully encrypted and
    support both binary and cleartext password types.
  </li>

  <li>
    Visual Studio design-time Support, works with all versions of Visual Studio

    2005/2008/2010/2012/2013/2015.  You can add a SQLite database to the Servers
    list, design queries with the Query Designer, drag-and-drop tables onto a
    Typed DataSet, etc.
    <br />
    <font color="red">
      Due to Visual Studio licensing restrictions, the Express Editions can no
      longer be supported.
    </font>
  </li>

  <li>
    Full SQLite schema editing inside Visual Studio.  You can create/edit tables,
    views, triggers, indexes, check constraints and foreign keys.
  </li>

  <li>
    Single file redistributable (except on Compact Framework).  The core SQLite
    native code and the ADO.NET managed wrapper are combined into one mixed-mode
    assembly.
  </li>

  <li>
    Binaries included for x86, x64, Itanium, and ARM processors.

    <br />
    <font color="red">
      Itanium processor support not currently included.
    </font>
  </li>

  <li>DbProviderFactory support.</li>

  <li>
    Full support for ATTACH'ed databases.  Exposed as <i>Catalogs</i> in the
    schema.  When cloning a connection, all attached databases are automatically
    re-attached to the new connection.
  </li>

  <li>
    DbConnection.GetSchema(...) support includes <i>ReservedWords</i>,
    <i>MetaDataCollections</i>, <i>DataSourceInformation</i>, <i>DataTypes</i>,
    <i>Columns</i>, <i>Tables</i>, <i>Views</i>, <i>ViewColumns</i>,
    <i>Catalogs</i>, <i>Indexes</i>, <i>IndexColumns</i>, <i>ForeignKeys</i> and
    <i>Triggers</i>.
  </li>

  <li>
    Enhanced DbDataReader.GetSchemaTable() functionality returns catalog,
    namespace and detailed schema information even for complex queries.
  </li>

  <li>Named and unnamed parameters.</li>

  <li>
    Full UTF-8 and UTF-16 support, each with optimized pipelines into the native
    database core.
  </li>

  <li>
    Multiple simultaneous DataReaders (one DataReader per Command however).
  </li>






  <li>
    Full support for user-defined scalar and aggregate functions, encapsulated
    into an easy-to-use base class in which only a couple of overrides are
    necessary to implement new SQL functions.
  </li>

  <li>
    Full support for user-defined collating sequences, every bit as simple to
    implement as user-defined functions and uses the same base class.
  </li>

  <li>
    Full source for the entire engine and wrapper.  No copyrights.  Public
    Domain.  100% free for commercial and non-commercial use.
  </li>
</ul>

<h2><strong>Design-Time Support</strong></h2>
<p>




Download and run one of the setup packages and then select the
&quot;<b>Install the designer components for Visual Studio 20XX.</b>&quot;
option when prompted.
</p>
<h2>
<strong>DbFactory Support (Desktop Framework)</strong></h2>
In order to use the SQLiteFactory and have the SQLite data provider enumerated in
the DbProviderFactories methods, you must add the following segment into your application's
app.config file:<br />
<pre>
&lt;configuration&gt;
    &lt;system.data&gt;
        &lt;DbProviderFactories&gt;
            &lt;remove invariant="System.Data.SQLite" /&gt;
            &lt;add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite"
                 type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" /&gt;
        &lt;/DbProviderFactories&gt;
    &lt;/system.data&gt;
&lt;/configuration&gt;
</pre>
<p>
See the help documentation for further details on implementing both version-specific
(GAC enabled) and version independent DBProviderFactories support.
</p>

<h2>Compiling for the .NET Compact Framework</h2>

<p>
Just change the target platform from Win32 to Compact Framework and recompile.&nbsp;
<strong>The Compact Framework has no support for enumerating attributes in an assembly,
therefore all user-defined collating sequences and functions must be explicitly
registered.</strong>&nbsp; See the <strong>testce</strong> sample application for
an example of how to explicitly register user-defined collating sequences and functions.</p>

<h2><b><a name="redist"></a>Distributing or Deploying System.Data.SQLite</b></h2>

<p>
On the desktop, when using the statically linked mixed-mode assembly, only the
<strong>System.Data.SQLite.dll</strong> file needs to be distributed with your
application(s).  This dynamic link library contains both the managed provider
and the SQLite native library.  For other build configurations, including those
for the .NET Compact Framework, you will need to distribute both the managed
provider <strong>System.Data.SQLite.dll</strong>, as well as the associated
native library <strong>SQLite.Interop.dll</strong> (or
<strong>SQLite.Interop.XXX.dll</strong> for the .NET Compact Framework).  For
the .NET Compact Framework edition, this is a breaking change as of 1.0.59.0.
The recent versions of the .NET Compact Framework do not appear to properly
support mixed-mode assemblies.  All builds of System.Data.SQLite, except those
explicitly marked as &quot;static&quot; in their package name, will also require
the associated <a href="https://support.microsoft.com/kb/2019667">Microsoft
Visual C++ Runtime Library</a> to be installed on the target machine.  For
further details on distributing and/or deploying System.Data.SQLite, please
refer to the
<a href="https://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki">System.Data.SQLite Downloads</a>
web page.
</p>

<h2><b>Development Notes Regarding the SQLite Native Library Source Code</b></h2>

<p>
The included SQLite native library is compiled directly from the official source
code releases available from the <a href="https://www.sqlite.org/">sqlite.org</a>
website.
</p>

<p>
In addition, there are several relatively small extensions included within the
System.Data.SQLite &quot;interop assembly&quot; and some of these extensions are
specific to the System.Data.SQLite project itself; however, the included SQLite
native library source code itself is compiled verbatim, using a set of fully
supported <a href="https://www.sqlite.org/compile.html">compile-time options</a>
designed for robustness and maximum backward compatibility with previously
released versions of System.Data.SQLite.
</p>

<h2><b>Version History</b></h2>

<p>
    <b>1.0.119.0 - May XX, 2024 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_45_3.html">SQLite 3.45.3</a>.</li>
    <li>Update internal resource list of reserved SQL words.</li>
    <li>Avoid NullReferenceException from Path.Combine method when the PublishSingleFile property is enabled for a project. Pursuant to forum post [66a0d2716a].</li>
    <li>Add the VfsName connection string property.</li>
    <li>Fix rarely seen NullReferenceException in the StaticWeakConnectionPool.Add method.</li>
    <li>Revise the calculation used to bind DateTime values. Fix for [bbddfeb773].</li>
</ul>
<p>
    <b>1.0.118.0 - June 10, 2023</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_42_0.html">SQLite 3.42.0</a>.</li>
    <li>Add the ConnectionStringPreview, SqlStringPreview, and Canceled connection events.</li>
    <li>Add support for the sqlite3_is_interrupted core library API. Pursuant to forum post [b6a707bffb].</li>
    <li>Add support for the sqlite_trace_v2 core library API. Pursuant to forum post [1c418d7edc].</li>
    <li>Add TextHexPassword connection string property for use with <a href="https://www.sqlite.org/see">SEE</a>.</li>
    <li>Add SQLite_ForceLogRetry environment variable to force logging of all internal retries during statment preparation and stepping.</li>
    <li>Add StepRetries connection string property to allow the maximum number of retries when stepping a query to be overridden.</li>
    <li>Fix ExecuteScalar and ExecuteNonQuery handling of write transactions that require more than one call to step. Pursuant to forum post [f4e718891d].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Parameter names should be case-sensitive. Fix for [e22d357a21].&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.117.0 - November 28, 2022</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_40_0.html">SQLite 3.40.0</a>.</li>
    <li>Add support for creating custom window functions. Pursuant to forum post [21de219031].</li>
    <li>Suppress finalizer calls for SQLite3 objects that are closed. Fix for [ce4d70ea6f].</li>
    <li>Improvements to object disposal diagnostics. Pursuant to [ce4d70ea6f].</li>
    <li>Add MaximumSleepTime property to the SQLiteCommand class and DefaultMaximumSleepTime connection string property.</li>
    <li>Add experimental support for running the test suite using .NET 5 and .NET 6.</li>
    <li>Add experimental support for native sha3 extension.</li>
</ul>
<p>
    <b>1.0.116.0 - June 1, 2022</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_38_5.html">SQLite 3.38.5</a>.</li>
    <li>More flexible connection pooling via the new ISQLiteConnectionPool2 interface.</li>
    <li>Add SQLite_StrongConnectionPool environment variable to prevent pooled connections from being garbage collected.</li>
    <li>Improvements to object disposal handling for database connections.</li>
</ul>
<p>
    <b>1.0.115.5 - November 2, 2021</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/src/info/ca2703c339f76101">SQLite trunk</a>.</li>
    <li>Add Busy event to the SQLiteConnection class. Pursuant to forum post [08a52f61fc].</li>
    <li>Fix metadata UTF-16 string length calculations on Linux. Fix for forum post [eeaefb84ec].</li>
</ul>
<p>
    <b>1.0.115.0 - August 25, 2021</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_36_0.html">SQLite 3.36.0</a>.</li>
</ul>
<p>
    <b>1.0.114.0 - May 22, 2021</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_35_5.html">SQLite 3.35.5</a>.</li>
    <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.4.4">Entity Framework 6.4.4</a>.</li>
    <li>Add preliminary support for the .NET Framework 4.8.</li>
    <li>Add support for math functions now provided by the SQLite core library.</li>

    <li>Add support for <a href="https://www.sqlite.org/compile.html#enable_update_delete_limit">ORDER BY and LIMIT for UPDATE and DELETE</a>.</li>
    <li>Add TextPassword connection string property for use with <a href="https://www.sqlite.org/see">SEE</a>.</li>
</ul>
<p>
    <b>1.0.113.0 - June 1, 2020</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_32_1.html">SQLite 3.32.1</a>.</li>
    <li>Add SQLite_ForceLogLifecycle environment variable to force logging of calls into key members pertaining to the lifecycle of connections and their associated classes (e.g. LINQ, EF6, etc).</li>
    <li>Support automatic value conversions for columns with a declared type of MEDIUMINT or MEDIUMUINT. Pursuant to [515cb60b10].</li>
</ul>
<p>
    <b>1.0.112.3 - Xxxx XX, 2020</b>
</p>
<ul>
    <li>When using the (unsupported) legacy CryptoAPI-based (RC4) codec, skip encrypting page #1 because that can lead to database corruption and other malfunctions.</li>
    <li>Add SQLite_ForceLogLifecycle environment variable to force logging of calls into key members pertaining to the lifecycle of connections and their associated classes (e.g. LINQ, EF6, etc).</li>
    <li>Support automatic value conversions for columns with a declared type of MEDIUMINT or MEDIUMUINT. Pursuant to [515cb60b10].</li>
</ul>
<p>
    <b>1.0.112.2 - April 27, 2020</b>
</p>
<ul>
    <li>Fix NuGet packaging for .NET Standard 2.1. Fix for [7c73262e6f].</li>
</ul>
<p>
    <b>1.0.112.1 - April 6, 2020</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_31_1.html">SQLite 3.31.1</a>.</li>
    <li>Include the &quot;LINQ&quot; partial classes in the primary managed assembly for .NET Standard 2.1. Fix for [ad28d8e026].</li>
</ul>
<p>
    <b>1.0.112.0 - October 28, 2019</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_30_1.html">SQLite 3.30.1</a>.</li>
    <li>Add preliminary support for .NET Core 3.0 and the .NET Standard 2.1. Pursuant to [ce75d320d0].</li>
    <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.3.0">Entity Framework 6.3.0</a>.</li>
    <li>Add support for new DBCONFIG options from the SQLite core library. Pursuant to [03b6b0edd7].</li>
    <li>Add SetLimitOption method to the SQLiteConnection class.</li>
</ul>
<p>
    <b>1.0.111.0 - June 10, 2019</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_28_0.html">SQLite 3.28.0</a>.</li>
    <li>Add No_SQLiteLog environment variable.</li>
</ul>
<p>
    <b>1.0.110.0 - March 4, 2019</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_27_2.html">SQLite 3.27.2</a>.</li>
    <li>Add HidePassword connection flag to remove the password from the connection string once the database is opened. Pursuant to [23d8d6171e].</li>
    <li>Add experimental StrictConformance connection flag to force strict compliance to the ADO.NET standard. Pursuant to [e36e05e299].</li>
    <li>Add support for the <a href="https://www.sqlite.org/session/c_changesetstart_invert.html">sqlite3changeset_start_v2()</a> and <a href="https://www.sqlite.org/session/c_changesetstart_invert.html">sqlite3changeset_start_v2_strm()</a> interfaces.</li>
</ul>
<p>
    <b>1.0.109.0 - August 15, 2018</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_24_0.html">SQLite 3.24.0</a>.</li>
    <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.2.0">Entity Framework 6.2.0</a>.</li>
    <li>Do not attempt to initialize the logging subsystem more than once.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Prevent GetSchemaTable from throwing InvalidCastException. Fix for [baf42ee135].</li>
    <li>Add preliminary support for the .NET Framework 4.7.2.</li>
    <li>Add preliminary support for .NET Core 2.0 and the .NET Standard 2.0. Pursuant to [5c89cecd1b].</li>
    <li>Add simpler overload for the SQLiteBlob.Create method. Pursuant to [dfc8133ba2].</li>
    <li>Add GetFieldAffinity method to the SQLiteDataReader class.</li>
</ul>
<p>
    <b>1.0.108.0 - March 2, 2018</b>
</p>
<ul>
    <li>Support extended result codes when messages are looked up without the SQLite core library.</li>
    <li>Override System.Object members for the SQLiteException class to improve its ToString return value. Pursuant to [53962f9eff].</li>
    <li>More database connection configuration options for the <a href="https://www.sqlite.org/c3ref/db_config.html">sqlite3_db_config()</a> interface.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Set HResult property of SQLiteException based on the SQLite core library error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Modify experimental WaitForEnlistmentReset method to require a nullable boolean parameter for the value to return when the connection is disposed.&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.107.0 - January 30, 2018</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_22_0.html">SQLite 3.22.0</a>.</li>
    <li>Improve performance of type name lookups by removing superfluous locking and string creation.</li>
    <li>Support asynchronous completion of distributed transactions. Fix for [5cee5409f8].</li>
    <li>Add experimental WaitForEnlistmentReset method to the SQLiteConnection class. Pursuant to [7e1dd697dc].</li>
    <li>Fix some internal memory accounting present only in the debug build.</li>
    <li>Make sure inbound native delegates are unhooked before adding a connection to the pool. Fix for [0e48e80333].</li>
    <li>Add preliminary support for the .NET Framework 4.7.1.</li>
    <li>Updates to internal DbType mapping related lookup tables. Pursuant to [a799e3978f].</li>
</ul>
<p>
    <b>1.0.106.0 - November 2, 2017</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_21_0.html">SQLite 3.21.0</a>.</li>
    <li>Add full support for the native <a href="https://www.sqlite.org/sessionintro.html">session</a> extension.</li>
    <li>Add BindDecimalAsText and GetDecimalAsText connection flags to force binding and returning of decimal values as text. Pursuant to [b167206ad3].</li>
    <li>Add BindInvariantDecimal and GetInvariantDecimal connection flags, enabled by default, to force binding and returning of decimal values using the invariant culture. Pursuant to [b167206ad3].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add preliminary support for Visual Studio 2017 and the .NET Framework 4.7. This does <b>not</b> include support for the design-time components for Visual Studio, see [8292431f51].</li>
</ul>
<p>
    <b>1.0.105.2 - June 12, 2017</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_19_3.html">SQLite 3.19.3</a>.</li>
    <li>Fix issues that prevented SQLiteBlob creation from succeeding for tables that did not have an integer primary key.</li>
</ul>
<p>
    <b>1.0.105.1 - May 15, 2017</b>
</p>
<ul>
    <li>Prevent culture settings from negatively impacting integer connection string defaults.</li>
    <li>Make sure the &quot;No_SQLiteConnectionNewParser&quot; and &quot;DefaultFlags_SQLiteConnection&quot; setting values end up being cached.</li>
    <li>Cache the XML file name and assembly directory used by the configuration subsystem.</li>
</ul>
<p>
    <b>1.0.105.0 - April 9, 2017</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_18_0.html">SQLite 3.18.0</a>.</li>
    <li>Add experimental support for native sha1 extension.</li>
</ul>
<p>
    <b>1.0.104.0 - December 16, 2016</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_15_2.html">SQLite 3.15.2</a>.</li>
    <li>Add the &quot;%PreLoadSQLite_AssemblyDirectory%&quot;, &quot;%PreLoadSQLite_TargetFramework%&quot;, and &quot;%PreLoadSQLite_XmlConfigDirectory%&quot; <a href="https://system.data.sqlite.org/index.html/artifact?ci=trunk&filename=Doc/Extra/Provider/environment.html">replacement tokens</a> for use in configuration setting values. Pursuant to [d4728aecb7].</li>
    <li>Prevent the GetByte, GetChar, and GetInt16 methods of the SQLiteDataReader class from throwing exceptions for large integer values. Pursuant to [5535448538].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Use <a href="https://www.sqlite.org/lang_savepoint.html">SAVEPOINTs</a> to properly implement nested transactions when the new AllowNestedTransactions connection flag is used. Pursuant to [1f7bfff467].</li>
    <li>When converting a Julian Day value to an integer, round to the nearest millisecond first. Pursuant to [69cf6e5dc8].&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.103.0 - September 15, 2016</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_14_2.html">SQLite 3.14.2</a>.</li>
    <li>Add preliminary support for the .NET Framework 4.6.2.</li>
    <li>Change the SQLiteReadValueCallback delegate &quot;eventArgs&quot; parameter to be of type SQLiteReadEventArgs.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Make SQLiteReadValueEventArgs and SQLiteReadArrayEventArgs derive from SQLiteReadEventArgs.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Rename SQLiteReadValueEventArgs.ArrayEventArgs property to ExtraEventArgs.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add No_SQLiteGetSettingValue and No_SQLiteXmlConfigFile environment variables.</li>
    <li>Reduce the number of calls to GetSettingValue from SQLiteConnection. Pursuant to [25d53b48f6].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add NoVerifyTypeAffinity connection flag to disable all type affinity checking.</li>
    <li>Add support for <a href="https://www.sqlite.org/c3ref/blob_open.html">incremental blob I/O</a>.</li>
    <li>Improve support for the <a href="https://www.sqlite.org/c3ref/db_config.html">sqlite3_db_config()</a> interface. Pursuant to [f64f4aee95].</li>
</ul>
<p>
    <b>1.0.102.0 - June 23, 2016</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_13_0.html">SQLite 3.13.0</a>.</li>
    <li>Update the SQLiteConnection.EnableExtensions method to make use of the new SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION option, when available.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Prevent the SQLiteCommand.ExecuteScalar method from throwing an exception when there are no result columns.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Support per-connection customization for binding parameters and reading values, based on the database type name.</li>
    <li>Add TypeName property to the SQLiteParameter class.</li>


    <li>Add VerifyOnly method to the SQLiteCommand class.</li>
    <li>Add IsReadOnly method to the SQLiteConnection class.</li>
</ul>
<p>
    <b>1.0.101.0 - April 19, 2016</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_12_2.html">SQLite 3.12.2</a>.</li>
    <li>Add binary package release for Mono on POSIX.</li>
</ul>
<p>
    <b>1.0.100.0 - April 15, 2016</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_12_1.html">SQLite 3.12.1</a>.</li>
    <li>Support compiling and using the interop assembly on Linux and Mac OS X.</li>
    <li>Support running the test suite under Mono on Linux and Mac OS X.</li>
    <li>Properly handle NULL values in the &quot;name&quot; column of the results returned by PRAGMA index_info(). Fix for [5251bd0878].</li>
    <li>For column types that resolve to boolean, recognize case-insensitive prefixes of &quot;True&quot; and &quot;False&quot;. Fix for [dbd65441a5].</li>
    <li>Add NoVerifyTextAffinity connection flag to skip type affinity checking when fetching a column value as a string. Pursuant to [dbd65441a5].</li>
    <li>The UnixEpoch DateTime format should use Int64 internally, not Int32.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Avoid using Path.Combine with null values in the native library pre-loader. Fix for [da685c0bac].</li>
    <li>Fix the (unsupported) legacy CryptoAPI-based (RC4) codec so that it no longer prevents page size changes.</li>
</ul>
<p>
    <b>1.0.99.1 - March 31, 2016</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_9_3.html">SQLite 3.9.3</a>.</li>
</ul>
<p>
    <b>1.0.99.0 - December 9, 2015</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_9_2.html">SQLite 3.9.2</a>.</li>
    <li>Add preliminary support for the .NET Framework 4.6.1.</li>
    <li>Fix handling of sqlite3_index_info members not available with older versions of the SQLite core library.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Update and improve documentation comments for the native virtual table methods.</li>
    <li>Permit an existing registered function to be replaced. Fix for [2556655d1b].</li>
    <li>Make GetValue work for boolean columns with textual &quot;True&quot; and &quot;False&quot; values. Fix for [7714b60d61].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add Reset method to the SQLiteCommand class.</li>
    <li>Add FileName property to the SQLiteConnection class.</li>
    <li>Add experimental support for the native json1 and fts5 extensions.</li>
    <li>Add GetDatabaseName, GetTableName, and GetOriginalName methods to the SQLiteDataReader class.</li>
</ul>
<p>

    <b>1.0.98.0 - August 19, 2015</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_11_1.html">SQLite 3.8.11.1</a>.</li>
    <li>Add full support for Visual Studio 2015 and the .NET Framework 4.6.</li>
    <li>Add support for creating custom SQL functions using delegates.</li>
    <li>Implement the Substring method for LINQ using the &quot;substr&quot; core SQL function.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Prevent encrypted connections from being used with the connection pool. Pursuant to [89d3a159f1].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Honor the second argument to Math.Round when using LINQ.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Honor the pre-existing flags for connections during the Open method. Fix for [964063da16].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Remove errant semi-colons from the SQL used by LINQ to INSERT and then SELECT rows with composite primary keys. Fix for [9d353b0bd8].</li>
    <li>Refactor INSERT/UPDATE handling (in the LINQ assembly) so it can handle composite and non-integer primary keys. Fix for [41aea496e0].</li>
    <li>Change the base type for the SQLiteConnectionFlags enumeration to long integer.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add extended return codes to the SQLiteErrorCode enumeration. Pursuant to [71bedaca19].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Improve exception handling in all native callbacks implemented in the SQLiteConnection class.</li>
    <li>Add Progress event and ProgressOps connection string property to enable raising progress events during long-running queries.</li>
    <li>Add &quot;Recursive Triggers&quot; connection string property to enable or disable the recursive trigger capability. Pursuant to [3a82ee635b].</li>
    <li>Add NoDefaultFlags connection string property to prevent the default connection flags from being used. Pursuant to [964063da16].</li>
    <li>Add VfsName connection string property to allow a non-default VFS to be used by the SQLite core library.</li>
    <li>Add BusyTimeout connection string property to set the busy timeout to be used by the SQLite core library.</li>
    <li>Add UnbindFunction and UnbindAllFunctions methods to the SQLiteConnection class.</li>
    <li>Enable integration with the <a href="https://www.hwaci.com/sw/sqlite/zipvfs.html">ZipVFS</a> extension.</li>
</ul>
<p>
    <b>1.0.97.0 - May 26, 2015</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_10_2.html">SQLite 3.8.10.2</a>.</li>
    <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.1.3">Entity Framework 6.1.3</a>.</li>
    <li>Improve ADO.NET conformance of the SQLiteDataReader.RecordsAffected property. Fix for [74542e702e].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Prevent the IDataReader.GetDataTypeName method from throwing &quot;No current row&quot; exceptions. Fix for [94252b9059].</li>
    <li>When BinaryGUID handling is off, transform the LINQ parameter types as well. Fix for [a4d9c7ee94].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The IDataReader.GetDataTypeName method should always return the declared type name.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add DefaultFlags_SQLiteConnection environment variable to enable customization of the default connection flags.</li>
    <li>Prevent calls to sqlite3_step() and sqlite3_interrupt() from being interrupted via ThreadAbortException.</li>
    <li>Make sure enabling UseUTF16Encoding sets the schema encoding to UTF-16. Fix for [7c151a2f0e].</li>
</ul>
<p>
    <b>1.0.96.0 - March 5, 2015</b>
</p>
<ul>
    <li>Prevent the IDataReader.GetOrdinal method from throwing &quot;No current row&quot; exceptions. Fix for [c28d7fe915].</li>
    <li>When counting the number of tables in the GetSchemaTable method, do not include those that have a null or empty name. Fix for [92dbf1229a].</li>
</ul>
<p>
    <b>1.0.95.0 - March 2, 2015</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_8_3.html">SQLite 3.8.8.3</a>.</li>
    <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.1.2">Entity Framework 6.1.2</a>.</li>
    <li>Modify configuration file transforms performed by the NuGet packages to allow Entity Framework 6 design-time integration to work automatically. Fix for [2be4298631], [abad7c577d], and [417d669435].</li>
    <li>The &quot;System.Data.SQLite.EF6*&quot; and &quot;System.Data.SQLite.Linq*&quot; NuGet packages no longer depend on the &quot;System.Data.SQLite.Core*&quot; packages.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The &quot;System.Data.SQLite.MSIL*&quot; NuGet packages no longer directly include any files; they are now meta-packages.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The &quot;System.Data.SQLite.x86*&quot; and &quot;System.Data.SQLite.x64*&quot; NuGet packages now depend on the &quot;System.Data.SQLite.Linq&quot; and &quot;System.Data.SQLite.EF6&quot; NuGet packages.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Make sure SQL statements generated for DbUpdateCommandTree objects are properly delimited.</li>
    <li>Make sure SQLiteIndexOutputs.ConstraintUsages instances are created prior to calling ISQLiteManagedModule.BestIndex. Fix for [56f511d268].</li>
    <li>Correct marshalling of strings and blobs in the SQLiteValue class. Fix for [85b824b736].</li>
    <li>Various minor performance enhancements to the SQLiteDataReader class. Pursuant to [e122d26e70].</li>
    <li>Defer disposing of connections created by the static SQLiteCommand.Execute method when a data reader is returned. Fix for [daeaf3150a].</li>
    <li>Wrap SELECT statements in parenthesis if they have an ORDER BY, LIMIT, or OFFSET clause and a compound operator is involved. Fix for [0a32885109].</li>
    <li>In the SQLiteDataReader.VerifyType method, remove duplicate &quot;if&quot; statement for the DbType.SByte value and move the remaining &quot;if&quot; to the Int64 affinity. Fix for [c5cc2fb334].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Handle Julian Day values that fall outside of the supported range for OLE Automation dates. Fix for [3e783eecbe].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Make sure the interop files are copied when publishing a project that refers to a NuGet package containing them. Fix for [e796ac82c1].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Make sure the interop files are copied before the PostBuildEvent. Fix for [f16c93a932].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Modify GetSchemaTable method to avoid setting SchemaTableColumn.IsKey column to true when more than one table is referenced. Fix for [47c6fa04d3].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add AppendManifestToken_SQLiteProviderManifest environment variable to enable better integration between LINQ and the underlying store connection.</li>
    <li>Add SQLite_ForceLogPrepare environment variable to force logging of all prepared SQL regardless of the flags for the associated connection.</li>
    <li>Honor the DateTimeFormat, DateTimeKind, DateTimeFormatString, BinaryGUID connection string and/or provider manifest token properties from within the LINQ assembly. Fix for [8d928c3e88].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add PrepareRetries connection string property to allow the maximum number of retries when preparing a query to be overridden. Fix for [647d282d11].</li>
    <li>Add BindDateTimeWithKind connection flag to force DateTime parameter values to match the DateTimeKind associated with the connection, if applicable. Fix for [a7d04fb111].</li>
</ul>
<p>
    <b>1.0.94.0 - September 9, 2014</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_6.html">SQLite 3.8.6</a>.</li>
    <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.1.1">Entity Framework 6.1.1</a>.</li>
    <li>Refactor and simplify NuGet packages in order to support per-solution SQLite interop assembly files.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add RefreshFlags method to the SQLiteDataReader class to forcibly refresh its connection flags.</li>
    <li>Improve automatic detection and handling of the Entity Framework 6 assembly by the design-time components installer. Pursuant to [e634e330a6].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Improve SQLiteDataReader performance slightly by caching the connection flags.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add ClearCachedSettings method to the SQLiteConnection class.</li>
    <li>Add NoConvertSettings connection flag to disable querying of runtime configuration settings from within the SQLiteConvert class. Pursuant to [58ed318f2f].</li>
    <li>Minimize usage of the &quot;Use_SQLiteConvert_DefaultDbType&quot; and &quot;Use_SQLiteConvert_DefaultTypeName&quot; settings. Fix for [58ed318f2f].&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.93.0 - June 23, 2014</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_5.html">SQLite 3.8.5</a>.</li>
    <li>Updated to <a href="https://www.nuget.org/packages/EntityFramework/6.1">Entity Framework 6.1</a>.</li>
    <li>Add support for mapping transaction isolation levels to their legacy default values. Pursuant to [56b42d99c1].</li>
    <li>Add support for setting the default DbType and type name used for mappings on a per-connection basis. Pursuant to [3c00ec5b52].</li>
    <li>Add DetectTextAffinity and DetectStringType connection flags to enable automatic detection of column types, when necessary. Pursuant to [3c00ec5b52].</li>
    <li>Add SetChunkSize method to the SQLiteConnection class. Pursuant to [d1c008fa0a].</li>
    <li>Add SharedFlags static property to the SQLiteConnection class.</li>
    <li>Make the ISQLiteSchemaExtensions interface public.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Have the SQLiteProviderFactory class (in the System.Data.SQLite.Linq assembly) implement the IServiceProvider interface.</li>
    <li>Fix bug in documentation generator automation that prevented some internal documentation links from working.</li>
    <li>Fix DateTime constant handling in the LINQ assembly. Fix for [da9f18d039].&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.92.0 - March 19, 2014</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_4_1.html">SQLite 3.8.4.1</a>.</li>
    <li>Update the list of keywords returned by SQLiteConnection.GetSchema(&quot;ReservedWords&quot;).&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Raise the static SQLiteConnection.Changed event when any SQLiteCommand or SQLiteDataReader object is closed or disposed.</li>
    <li>Add the SQLiteDataReader.StepCount property to return the number of rows seen so far.</li>
    <li>Add StickyHasRows connection flag to cause the SQLiteDataReader.HasRows property to return non-zero if there were ever any rows in the associated result sets.</li>
    <li>When the TraceWarning connection flag is set, issue warnings about possibly malformed UNC paths. Pursuant to [283344397b].</li>
    <li>Convert the primary NuGet package, &quot;System.Data.SQLite&quot;, into a meta-package.</li>
    <li>Enhancements to the NuGet packages, including the new &quot;modular&quot; packages.</li>
</ul>
<p>
    <b>1.0.91.0 - February 12, 2014</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_3_1.html">SQLite 3.8.3.1</a>.</li>
    <li>Refresh all included SQLite core library documentation (e.g. SQL syntax).</li>
    <li>Add support for <a href="https://entityframework.codeplex.com/">Entity Framework 6</a>.</li>
    <li>Add support for per-connection mappings between type names and DbType values. Pursuant to [e87af1d06a].</li>
    <li>Modify the namespace used for all internal classes in the System.Data.SQLite.Linq assembly.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add SQLiteCompileOptions and InteropCompileOptions properties to the SQLiteConnection class to return the compile-time options for the SQLite core library and interop assembly, respectively.</li>
    <li>Add BindInvariantText and ConvertInvariantText connection flags to force the invariant culture to be used when converting parameter values to/from strings.</li>
    <li>Add NoConnectionPool and UseConnectionPool connection flags to disable or enable connection pooling by default.</li>
    <li>Modify handling of the design-time components installer to run Visual Studio <b>devenv.exe /setup</b> after installing the package. This appears to be necessary in some circumstances for Visual Studio 2013. Pursuant to [a47eff2c71].</li>
    <li>Modify the native library pre-loader to support reading settings from an XML configuration file and to be capable of checking more than one directory. Persuant to [f0246d1817].</li>
    <li>Support detecting when the native library pre-loader should use the CodeBase property instead of the Location property as the basis for locating the interop assembly.</li>
    <li>Change the default behavior for the native library pre-loader so it first searches the executing (i.e. System.Data.SQLite) assembly directory and then the application domain directory. Pursuant to [f0246d1817].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Include DbType.AnsiString in the list of types that need special ColumnSize handling. Fix for [0550f0326e].</li>
</ul>
<p>
    <b>1.0.90.0 - December 23, 2013</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_2.html">SQLite 3.8.2</a>.</li>
    <li>Add Visual Studio 2013 support to all the applicable solution/project files, their associated supporting files, and the test suite.</li>
    <li>Add Visual Studio 2013 support to the redesigned designer support installer.</li>
    <li>Add support for Windows Embedded Compact 2013.</li>
    <li>Add experimental support for the native regexp extension.</li>
    <li>Never create a new connection wrapper in the SQLiteConnection.Shutdown method.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add experimental GetMemoryStatistics, ReleaseMemory, and Shutdown methods to the SQLiteConnection class.</li>
    <li>Add memory leak detection to the test project for the .NET Compact Framework.</li>
    <li>Add SQLITE_ENABLE_MEMORY_MANAGEMENT compile-time option to the interop assembly.</li>
    <li>Use current isolation level when enlisting into an existing transaction. Fix for [56b42d99c1].</li>
    <li>Better handling of non-error log messages from the SQLite core library. Pursuant to [44df10ea90].</li>
    <li>Add TraceWarning connection flag to enable tracing of type mapping failures and disable tracing of them by default. Pursuant to [6d45c782e4].</li>
    <li>Use 32-bit values to keep track of numeric precision and scale when building the schema table for a query. Fix for [ef2216192d].</li>
</ul>
<p>
    <b>1.0.89.0 - October 28, 2013</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_8_1.html">SQLite 3.8.1</a>.</li>
    <li>Add AutoCommit property to the SQLiteConnection class. Fix for [9ba9346f75].</li>
    <li>Use declared column sizes for the AnsiStringFixedLength and StringFixedLength mapped database types. Fix for [3113734605].</li>
    <li>Check the result of sqlite3_column_name function against NULL.</li>
    <li>Return false for the SQLiteParameterCollection.IsSynchronized property because it is not thread-safe.</li>
    <li>Raise the static SQLiteConnection.Changed event when any SQLiteCommand, SQLiteDataReader, or CriticalHandle derived object instance is created. Fix for [aba4549801].</li>
    <li>Add SQLiteCommand.Execute, SQLiteCommand.ExecuteNonQuery, and SQLiteCommand.ExecuteScalar method overloads that take a CommandBehavior parameter.</li>
    <li>Revise how the extra object data is passed to the static SQLiteConnection.Changed event.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Make sure the database cannot be changed by a query when the CommandBehavior.SchemaOnly flag is used. Fix for [f8dbab8baf].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Fix bug in <a href="https://sourceforge.net/projects/ndoc3/">NDoc3</a> that was preventing some of the MSDN documentation links from working.</li>
    <li>Include the XML documentation files in the NuGet packages. Fix for [5970d5b0a6].</li>
    <li>Add InteropVersion, InteropSourceId, ProviderVersion, and ProviderSourceId properties to the SQLiteConnection class.</li>
    <li>Add experimental support for interfacing with the authorizer callback in the SQLite core library.</li>
    <li>Add experimental support for the native totype extension.</li>
</ul>
<p>
    <b>1.0.88.0 - August 7, 2013</b>
</p>
<ul>
    <li>Various fixes to managed virtual table integration infrastructure.</li>
    <li>Implement workaround for an incorrect PROCESSOR_ARCHITECTURE being reported. Fix for [9ac9862611].</li>
    <li>Modify classes that implement the IDisposable pattern to set the disposed flag after their base classes have been disposed.</li>
    <li>When automatically registering custom functions, use the executing assembly (i.e. System.Data.SQLite) for reference detection. Fix for [4e49a58c4c].</li>
</ul>
<p>
    <b>1.0.87.0 - July 8, 2013</b>
</p>
<ul>
    <li>Add all the necessary infrastructure to allow virtual tables to be implemented in managed code. Fix for [9a544991be].</li>
    <li>The DbType to type name translation needs to prioritize the Entity Framework type names. Fix for [47f4bac575].</li>
    <li>Add DateTimeFormatString connection string property to allow the DateTime format string used for all parsing and formatting to be overridden.</li>
    <li>Add NoFunctions connection flag to skip binding functions registered in the application domain.</li>
    <li>Add several data-types for compatibility purposes. Fix for [fe50b8c2e8].</li>
    <li>Add SQLiteConnection.BindFunction method to facilitate adding custom functions on a per-connection basis.</li>
    <li>When reading a DateTime value, avoid unnecessary string conversions. Fix for [4d87fbc742].</li>
    <li>Modify the index introspection code so that it does not treat PRAGMA table_info &quot;pk&quot; column values as boolean. Fix for [f2c47a01eb].</li>
    <li>Disable use of the new connection string parsing algorithm when the No_SQLiteConnectionNewParser environment variable is set. Pursuant to [bbdda6eae2].</li>

    <li>Rename the ReturnCode property of the SQLiteException class to ResultCode.&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.86.0 - May 23, 2013</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_17.html">SQLite 3.7.17</a>.</li>
    <li>Disable use of the AllowPartiallyTrustedCallers attribute when compiled for the .NET Framework 4.0/4.5.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Allow semi-colons in the data source file name. Fix for [e47b3d8346].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>NULL values should be reported as type &quot;object&quot;, not &quot;DBNull&quot;. Fix for [48a6b8e4ca].</li>
</ul>
<p>
    <b>1.0.85.0 - April 18, 2013</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_16_2.html">SQLite 3.7.16.2</a>.</li>
    <li>Properly handle embedded NUL characters in parameter and column values. Fix for [3567020edf].</li>
    <li>Make use of the sqlite3_prepare_v2 function when applicable.</li>
    <li>Check for a valid row in the SQLiteDataReader.GetValue method.</li>
    <li>Implement processor architecture detection when running on the .NET Compact Framework (via P/Invoke).</li>
    <li>Support automated testing when running on the .NET Compact Framework 2.0.</li>
    <li>Skip checking loaded assemblies for types tagged with the SQLiteFunction attribute when the No_SQLiteFunctions environment variable is set. Pursuant to [e4c8121f7b].</li>
    <li>Add HexPassword connection string property to work around the inability to include a literal semicolon in a connection string property value. Pursuant to [1c456ae75f].</li>
    <li>Add static Execute method to the SQLiteCommand class.</li>
    <li>Support custom connection pool implementations by adding the ISQLiteConnectionPool interface, the static SQLiteConnection.ConnectionPool property, and the static CreateHandle method in addition to modifying the SQLiteConnectionPool class. Pursuant to [393d954be0].</li>
    <li>Add public constructor to the SQLiteDataAdapter class that allows passing the parseViaFramework parameter to the SQLiteConnection constructor.</li>
    <li>When built with the CHECK_STATE compile-time option, skip throwing exceptions from the SQLiteDataReader class when the object is being disposed.</li>
    <li>Support automatic value conversions for columns with a declared type of BIGUINT, INTEGER8, INTEGER16, INTEGER32, INTEGER64, SMALLUINT, TINYSINT, UNSIGNEDINTEGER, UNSIGNEDINTEGER8, UNSIGNEDINTEGER16, UNSIGNEDINTEGER32, UNSIGNEDINTEGER64, INT8, INT16, INT32, INT64, UINT, UINT8, UINT16, UINT32, UINT64, or ULONG.</li>
    <li>Add BindUInt32AsInt64 connection flag to force binding of UInt32 values as Int64 instead. Pursuant to [c010fa6584].</li>
    <li>Add BindAllAsText and GetAllAsText connection flags to force binding and returning of all values as text.</li>
    <li>Remove AUTOINCREMENT from the column type name map.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Avoid throwing overflow exceptions from the SQLite3.GetValue method for integral column types. Partial fix for [c010fa6584].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Use the legacy connection closing algorithm when built with the INTEROP_LEGACY_CLOSE compile-time option.</li>
    <li>Support using the directory containing the primary managed-only assembly as the basis for native library pre-loading.</li>
    <li>Still further enhancements to the build and test automation.</li>
</ul>
<p>
    <b>1.0.84.0 - January 9, 2013</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_15_2.html">SQLite 3.7.15.2</a>.</li>

    <li>Explicitly dispose of all SQLiteCommand objects managed by the DbDataAdapter class. Fix for [6434e23a0f].</li>
    <li>Add Cancel method to the SQLiteConnection class to interrupt a long running query.</li>
    <li>Improve thread safety of the SQLiteLog.LogMessage method.</li>
</ul>
<p>
    <b>1.0.83.0 - December 29, 2012</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_15_1.html">SQLite 3.7.15.1</a>.</li>
    <li>Add Visual Studio 2012 support to all the applicable solution/project files, their associated supporting files, and the test suite.</li>
    <li>Add Visual Studio 2012 support to the redesigned designer support installer.</li>
    <li>Allow opened connections to skip adding the extension functions included in the interop assembly via the new NoExtensionFunctions connection flag.</li>
    <li>Support loading of SQLite extensions via the new EnableExtensions and LoadExtension methods of the SQLiteConnection class. Pursuant to [17045010df].</li>
    <li>Remove one set of surrounding single or double quotes from property names and values parsed from the connection string. Fix for [b4cc611998].</li>
    <li>Modify parsing of connection strings to allow property names and values to be quoted.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add ParseViaFramework property to the SQLiteConnection class to allow the built-in (i.e. framework provided) connection string parser to be used when opening a connection. Pursuant to [b4cc611998].</li>
    <li>Add notifications before and after any connection is opened and closed, as well as other related notifications, via the new static Changed event.</li>
    <li>Add an overload of the SQLiteLog.LogMessage method that takes a single string parameter.</li>
    <li>Add an overload of the SQLiteConnection.LogMessage method that takes a SQLiteErrorCode parameter.</li>
    <li>All applicable calls into the SQLite core library now return a SQLiteErrorCode instead of an integer error code.</li>
    <li>Make sure the error code of the SQLiteException class gets serialized.</li>
    <li>Make the test project for the .NET Compact Framework more flexible.</li>
    <li>When available, the new sqlite3_errstr function from the core library is used to get the error message for a specific return code.</li>
    <li>The SetMemoryStatus, Shutdown, ResultCode, ExtendedResultCode, and SetAvRetry methods of the SQLiteConnection class now return a SQLiteErrorCode instead of an integer error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The public constructor for the SQLiteException now takes a SQLiteErrorCode instead of an integer error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The ErrorCode property of the SQLiteException is now an Int32, to allow the property inherited from the base class to be properly overridden.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The ErrorCode field of the LogEventArgs is now an object instead of an integer.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The names and messages associated with the SQLiteErrorCode enumeration values have been normalized to match those in the SQLite core library.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Implement more robust locking semantics for the CriticalHandle derived classes when compiled for the .NET Compact Framework.</li>
    <li>Cache column indexes as they are looked up when using the SQLiteDataReader to improve performance.</li>
    <li>Prevent the SQLiteConnection.Close method from throwing non-fatal exceptions during its disposal.</li>
    <li>Rename the interop assembly functions sqlite3_cursor_rowid, sqlite3_context_collcompare, sqlite3_context_collseq, sqlite3_cursor_rowid, and sqlite3_table_cursor to include an &quot;_interop&quot; suffix.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Prevent the LastInsertRowId, MemoryUsed, and MemoryHighwater connection properties from throwing NotSupportedException when running on the .NET Compact Framework. Fix for [dd45aba387].</li>
    <li>Improve automatic detection of the sqlite3_close_v2 function when compiled to use the standard SQLite library.</li>
    <li>Add protection against ThreadAbortException asynchronously interrupting native resource initialization and finalization.</li>
    <li>Add native logging callback for use with the sqlite3_log function to the interop assembly, enabled via the INTEROP_LOG preprocessor definition.</li>
    <li>Add various diagnostic messages to the interop assembly, enabled via flags in the INTEROP_DEBUG preprocessor definition.</li>
    <li>Further enhancements to the build and test automation.</li>
    <li>Add test automation for the Windows CE binaries.</li>
</ul>
<p>
    <b>1.0.82.0 - September 3, 2012</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_14.html">SQLite 3.7.14</a>.</li>
    <li>Properly handle quoted data source values in the connection string. Fix for [8c3bee31c8].</li>
    <li>The <a href="https://www.nuget.org/packages/System.Data.SQLite">primary NuGet package</a> now supports x86 / x64 and the .NET Framework 2.0 / 4.0 (i.e. in a single package).</li>
    <li>Change the default value for the Synchronous connection string property to Full to match the default used by the SQLite core library itself.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add the ability to skip applying default connection settings to opened databases via the new SetDefaults connection string property.</li>
    <li>Add the ability to skip expanding data source file names to their fully qualified paths via the new ToFullPath connection string property.</li>
    <li>Fix the database cleanup ordering in the tests for ticket [343d392b51].</li>

    <li>Add support for the sqlite3_close_v2 function from the SQLite core library.</li>
    <li>Add support for <a href="https://www.sqlite.org/uri.html">URI file names</a> via the new FullUri connection string property.</li>
    <li>Improve support for the standard SQLite core library in the LINQ assembly and the test suite.</li>
    <li>Add SetMemoryStatus static method to the SQLiteConnection class.</li>
    <li>Improve threaded handling of the delegate used by the SQLiteLog class.</li>
    <li>Add define constants to support enabling or disabling individual groups of trace statements.</li>
</ul>
<p>
    <b>1.0.81.0 - May 27, 2012</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_12_1.html">SQLite 3.7.12.1</a>.</li>
    <li>Support compiling the interop assembly without support for the custom extension functions and the CryptoAPI-based (RC4) codec.</li>
    <li>Add DefineConstants property to the SQLiteConnection class to return the list of define constants used when compiling the core managed assembly.</li>
    <li>Add release archive verification tool to the release automation.</li>
    <li>Fix NullReferenceException when calling the SQLiteDataAdapter.FillSchema method on a query that returns multiple result sets. Fix for [3aa50d8413].</li>
    <li>Fix subtle race condition between threads fetching connection handles from the connection pool and any garbage collection (GC) threads that may be running. Fix for [996d13cd87].</li>
    <li>Add missing call to SetTimeout in the SQLite3_UTF16.Open method.</li>
    <li>Add checks to prevent the SQLiteConnectionPool.Remove method from returning any connection handles that are closed or invalid.</li>


    <li>Modify static SQLiteBase helper methods to prevent them from passing IntPtr.Zero to the SQLite native library.</li>
    <li>Remove static locks from the static helper methods in the SQLiteBase class, replacing them with a lock on the connection handle instance being operated upon.</li>
    <li>Revise CriticalHandle derived classes to make them more thread-safe.</li>
    <li>Add connection pool related diagnostic messages when compiled with the DEBUG define constant.</li>
    <li>Add PoolCount property to the SQLiteConnection class to return the number of pool entries for the file name associated with the connection.</li>
    <li>Rename internal SQLiteLastError methods to GetLastError.</li>
    <li>Add assembly file test constraints to all tests that execute the &quot;test.exe&quot; or &quot;testlinq.exe&quot; files.</li>
</ul>
<p>
    <b>1.0.80.0 - April 1, 2012</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_11.html">SQLite 3.7.11</a>.</li>
    <li>In the SQLiteFunction class, when calling user-provided methods from a delegate called by native code, avoid throwing exceptions, optionally tracing the caught exceptions. Fix for [8a426d12eb].</li>
    <li>Add Visual Studio 2005 support to all the applicable solution/project files, their associated supporting files, and the test suite.</li>
    <li>Add Visual Studio 2005 support to the redesigned designer support installer.</li>
    <li>Add experimental support for &quot;pre-loading&quot; the native SQLite library based on the processor architecture of the current process. This feature is now enabled by default at compile-time.</li>
    <li>Add support for the native <a href="https://www.sqlite.org/backup.html">SQLite Online Backup API</a>. Fix for [c71846ed57].</li>
    <li>Acquire and hold a static data lock while checking if the native SQLite library has been initialized to prevent a subtle race condition that can result in superfluous error messages. Fix for [72905c9a77].</li>
    <li>Support tracing of all parameter binding activity and use the connection flags to control what is traced.</li>
    <li>When converting a DateTime instance of an &quot;Unspecified&quot; kind to a string, use the same kind as the connection, if available.</li>
    <li>Add overload of the SQLiteDataReader.GetValues method that returns a NameValueCollection.</li>
    <li>Add static ToUnixEpoch method to the SQLiteConvert class to convert a DateTime value to the number of whole seconds since the Unix epoch.</li>
    <li>In the implicit conversion operators (to IntPtr) for both the SQLiteConnectionHandle and SQLiteStatementHandle classes, return IntPtr.Zero if the instance being converted is null.</li>
    <li>Write warning message to the active trace listeners (for the Debug build configuration only) if a column type or type name cannot be mapped properly. See [4bbf851fa5].</li>
    <li>When tracing SQL statements to be prepared, bypass the internal length limit of the sqlite3_log function by using the SQLiteLog class directly instead. Also, detect null and/or empty strings and emit a special message in that case.</li>
    <li>For the setup, the Visual Studio task should only be initially checked if the GAC task is available and vice-versa.</li>
    <li>Improve compatibility with custom command processors by using __ECHO instead of _ECHO in batch tools.</li>
    <li>Add OpenAndReturn method to the SQLiteConnection class to open a connection and return it.</li>
    <li>Add missing CheckDisposed calls to the SQLiteConnection class.</li>
    <li>Add missing throw statement to the SQLiteConnection class.</li>
    <li>Make sure the interop project uses /fp:precise for Windows CE.</li>
    <li>Regenerate package load key to support loading the designer package into Visual Studio 2008 without having the matching SDK installed.</li>
    <li>Modify transaction object disposal so that it can never cause an exception to be thrown.</li>
</ul>
<p>
    <b>1.0.79.0 - January 28, 2012</b>
</p>
<ul>
    <li>Use the WoW64 registry keys when installing the VS designer components on 64-bit Windows. Fix for [d8491abd0b].</li>
    <li>Correct resource name used by the LINQ assembly to locate several key string resources. Fix for [fbebb30da9].</li>
</ul>
<p>
    <b>1.0.78.0 - January 27, 2012</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_10.html">SQLite 3.7.10</a>.</li>
    <li>Redesign the VS designer support installer and integrate it into the setup packages.</li>
    <li>When emitting SQL for foreign keys in the VS designer, be sure to take all returned schema rows into account. Remainder of fix for [b226147b37].</li>
    <li>Add Flags connection string property to control extra behavioral flags for the connection.</li>
    <li>Refactor all IDisposable implementations to conform to best practices, potentially eliminating leaks in certain circumstances.</li>
    <li>Even more enhancements to the build and test automation.</li>
    <li>Support parameter binding to more primitive types, including unsigned integer types.</li>
    <li>Recognize the TIMESTAMP column data type as the DateTime type. Fix for [bb4b04d457].</li>
    <li>Prevent logging superfluous messages having to do with library initialization checking. Fix for [3fc172d1be].</li>
    <li>Support the DateTimeKind and BaseSchemaName connection string properties in the SQLiteConnectionStringBuilder class. Fix for [f3ec1e0066].</li>
    <li>Overloads of the SQLiteConvert.ToDateTime and SQLiteConvert.ToJulianDay methods that do not require an instance should be static. Partial fix for [4bbf851fa5].&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.77.0 - November 28, 2011</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_9.html">SQLite 3.7.9</a>.</li>

    <li>More enhancements to the build and test automation.</li>
    <li>Plug native memory leak when closing a database connection containing a statement that cannot be finalized for some reason.</li>
    <li>The SQLite3 class should always attempt to dispose the contained SQLiteConnectionHandle, even when called via the finalizer.</li>
    <li>When compiled with DEBUG defined, emit diagnostic information related to resource cleanup to any TraceListener objects that may be registered.</li>
    <li>Stop characterizing all log messages as errors. From now on, if the errorCode is zero, the message will not be considered an error.</li>
    <li>Never attempt to configure the native logging interface if the SQLite core library has already been initialized for the process. Fix for [2ce0870fad].</li>
    <li>Allow the SQLiteLog class to be used for logging messages without having an open connection.</li>
    <li>Support building the core System.Data.SQLite assemblies using the .NET Framework 4.0 Client Profile. Fix for [566f1ad1e4].</li>
    <li>When generating the schema based on the contents of a SQLiteDataReader, skip flagging columns as unique if the data reader is holding the result of some kind of multi-table construct (e.g. a cross join) because we must allow duplicate values in that case. Fix for [7e3fa93744].</li>
    <li>When returning schema information that may be used by the .NET Framework to construct dynamic SQL, use a fake schema name (instead of null) so that the table names will be properly qualified with the catalog name (i.e. the attached database name). Partial fix for [343d392b51].</li>
    <li>Add SQLiteSourceId property to the SQLiteConnection class to return the SQLite source identifier.</li>
    <li>Add MemoryUsed and MemoryHighwater properties to the SQLiteConnection class to help determine the memory usage of SQLite.</li>
    <li>Add DateTimeKind connection string property to control the DateTimeKind of parsed DateTime values. Partial fix for [343d392b51].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Improve the robustness of the SQLiteLog class when it will be initialized and unloaded multiple times.</li>
    <li>Fix the name of the interop assembly for Windows CE. Add unit tests to prevent this type of issue from happening again. Fix for [737ca4ff74].</li>
    <li>Formally support the SQL type name BOOLEAN in addition to BOOL. Fix for [544dba0a2f].</li>
    <li>Make sure the SQLiteConvert.TypeNameToDbType method is thread-safe. Fix for [84718e79fa].</li>
</ul>
<p>
    <b>1.0.76.0 - October 4, 2011</b>
</p>
<ul>
    <li>Prevent the domain unload event handler in SQLiteLog from being registered multiple times. Fix for [0d5b1ef362].</li>
    <li>Stop allowing non-default application domains to initialize the SQLiteLog class. Fix for [ac47dd230a].</li>
</ul>
<p>
    <b>1.0.75.0 - October 3, 2011</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_8.html">SQLite 3.7.8</a>.</li>
    <li>More enhancements to the build system.</li>
    <li>Add official <a href="https://www.nuget.org/">NuGet</a> packages for x86 and x64.</li>
    <li>Add Changes and LastInsertRowId properties to the connection class.</li>
    <li>Support more formats when converting data from/to the DateTime type.</li>
    <li>Make all the assembly versioning attributes consistent.</li>
    <li>Add unit testing infrastructure using <a href="https://eagle.to/">Eagle</a>.</li>
    <li>Integrate all legacy unit tests, including the &quot;testlinq&quot; project, into the new test suite.</li>
    <li>Add projects to build the interop assembly statically linked to the Visual C++ runtime. Fix for [53f0c5cbf6].</li>
    <li>Add SQLITE_ENABLE_STAT2 compile-time option to the interop assembly. Fix for [74807fbf27].</li>
    <li>Fix mutex issues exposed when running the test suite with the debug version of SQLite.</li>
    <li>Fix transaction enlistment when repeated attempts are made to enlist in the same transaction. Fix for [ccfa69fc32].</li>
    <li>Support the SQLITE_FCNTL_WIN32_AV_RETRY file control to mitigate the impact of file sharing violations caused by external processes.</li>
    <li>Refactor the logging interface to be thread-safe and self-initializing.</li>
    <li>Shutdown the SQLite native interface when the AppDomain is being unloaded. Fix for [b4a7ddc83f].</li>
    <li>Support Skip operation for LINQ using OFFSET. Fix for [8b7d179c3c].</li>
    <li>Support EndsWith operation for LINQ using SUBSTR. Fix for [59edc1018b].</li>
    <li>Support all SQLite journal modes. Fix for [448d663d11].</li>
    <li>Do not throw exceptions when disposing SQLiteDataReader. Fix for [e1b2e0f769].</li>
    <li>The REAL type should be mapped to System.Double. Fix for [2c630bffa7] and [b0a5990f48].</li>
    <li>Minor optimization to GetParamValueBytes(). Fix for [201128cc88].</li>
    <li>Support the ON UPDATE, ON DELETE, and MATCH clause information when generating schema metadata for foreign keys. Partial fix for [b226147b37]. VS designer changes are not yet tested.</li>
    <li>Fix incorrect resource name for SR.resx in the mixed-mode assembly.</li>
    <li>Reduce the number of String.Compare() calls in the hot path for SQLiteCommand.ExecuteReader().</li>
</ul>
<p>
    <b>1.0.74.0 - July 4, 2011</b>
</p>
<ul>
    <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_7_1.html">SQLite 3.7.7.1</a>.</li>
    <li>Fix incorrect hard-coded .NET Framework version information SQLiteFactory_Linq.cs that was causing IServiceProvider.GetService to fail when running against the .NET Framework 3.5.</li>
    <li>Fix all XML documentation warnings.</li>
    <li>Restore support for the mixed-mode assembly (i.e. the one that can be registered in the Global Assembly Cache).</li>
    <li>Restore support for the Compact Framework.</li>
    <li>Remove unused &quot;using&quot; statements from the System.Data.SQLite and System.Data.SQLite.Linq projects.</li>
    <li>Remove hard-coded System.Data.SQLite.Linq version from SQLiteFactory_Linq.cs</li>
    <li>Modify the setup to support bundled packages (i.e. with the mixed-mode assembly) and standard packages (i.e. with the managed assembly separate from the native interop library).</li>
    <li>Disable the ability to register with the Global Assembly Cache in the standard setup package (i.e. it is available in the bundled setup only).</li>
    <li>Remove PATH modification from the setup.</li>
    <li>Modify the naming scheme for the source, setup, and binary packages to allow for the necessary variants.</li>
    <li>In the build automation, attempt to automatically detect if Visual Studio 2008 and/or 2010 are installed and support building binaries for both at once, when available.</li>
    <li>Add release automation to build the source, setup, and binary packages in all supported build variants.</li>
    <li>Add the testlinq project to the new build system and make it work properly with Visual Studio 2008 and 2010.</li>
</ul>
<p>
  <b>1.0.73.0 - June 2, 2011</b>
</p>
<ul>
  <li>Updated to <a href="https://www.sqlite.org/releaselog/3_7_6_3.html">SQLite 3.7.6.3</a>.</li>
  <li>Minor optimization to GetBytes(). Fix for [8c1650482e].</li>
  <li>Update various assembly information settings.</li>
  <li>Correct System.Data.SQLite.Linq version and resource information. Fix for [6489c5a396] and [133daf50d6].</li>
  <li>Moved log handler from SQLiteConnection object to SQLiteFactory object to prevent if from being prematurely GCed.</li>
  <li>We should block x64 installs on x86 and we should install native only if the setup package itself is native. Fix for [e058ce156e].</li>
</ul>
<p>
  <b>1.0.72.0 - May 1, 2011</b>
</p>
<ul>
  <li>Add the correct directory to the path. Fix for [50515a0c8e].</li>
</ul>
<p>
  <b>1.0.71.0 - April 27, 2011</b>
</p>
<ul>
  <li>Updated to SQLite 3.7.6+ <a href="https://www.sqlite.org/src/info/1bd1484cd7">[1bd1484cd7]</a> to get additional Windows error logging.</li>
  <li>Updated setup to optionally add install directory to PATH if GAC option selected.</li>
</ul>
<p>
  <b>1.0.70.0 - April 22, 2011</b>
</p>
<ul>
  <li>Added support for sqlite3_extended_result_codes(), sqlite3_errcode(), and sqlite3_extended_errcode() via SetExtendedResultCodes(), ResultCode(), and ExtendedResultCode().</li>
  <li>Added support for SQLITE_CONFIG_LOG via SQLiteLogEventHandler().</li>
</ul>
<p>
  <b>1.0.69.0 - April 12, 2011</b>
</p>
<ul>
  <li>Code merge with <a href="https://www.sqlite.org/releaselog/3_7_6.html">SQLite 3.7.6</a>.</li>
  <li>New VS2008 and VS2010 solution files.</li>
  <li>Build and packaging automation.</li>
  <li>New Inno Setup files.</li>
  <li>Designer support currently not ready for release.</li>
</ul>
<p>
  <b>1.0.68.0 - February 2011</b>
</p>
<ul>
  <li>Code merge with <a href="https://www.sqlite.org/releaselog/3_7_5.html">SQLite 3.7.5</a>.</li>
  <li>Continuing work on supporting Visual Studio 2010.</li>
</ul>

<p>
<b>1.0.67.0 - January 3, 2011</b></p>
<ul>
<li>Code merge with <a href="https://www.sqlite.org/releaselog/3_7_4.html">SQLite 3.7.4</a>.</li>
<li>Continuing work on supporting Visual Studio 2010.</li>
</ul>
<p>
<b>1.0.66.1 - August 1, 2010</b></p>
<ul>
<li>Code merge with SQLite 3.7.0.1</li>
<li>Re-enabled VS2005 designer support, broken in previous versions during the 2008
transition</li>
<li>Implemented new forms of Take/Skip in the EF framework courtesy jlsantiago</li>
<li>Added "Foreign Keys" to the connection string parameters</li>
<li>Added the Truncate option to the Journal Modes enumeration</li>
</ul>
<p>
<b>1.0.66.0 - April 18, 2010</b></p>
<ul>
<li>Code merge with SQLite 3.6.23.1</li>
<li>Fixed a bug in the installer that accidentally modified the machine.config on
.NET versions prior to 2.0, invaliding the config file.</li>
<li>Fixed INTERSECT and EXCEPT union query generation in EF</li>
<li>Fixed an out of memory error in the trigger designer in cases where a WHEN clause
is used in the trigger</li>
</ul>
<p>
<b>1.0.65.0 - July 26, 2009</b></p>
<ul>
<li>Fixed a bug in the encryption module to prevent a double free() when rekeying
a database.</li>
<li>Fixed a bug in the encryption module when ATTACHing an encrypted database.</li>
<li>Incorporated the WinCE locking fix from ticket <a href="https://www.sqlite.org/cvstrac/tktview?tn=3991">
#3991</a></li>
<li>Added &quot;bigint&quot; to the dropdown in the table designer, plus other minor
table designer bugfixes.</li>
</ul>
<p>
<b>1.0.64.0 - July 9, 2009</b></p>
<ul>
<li>Fixed the missing resources problem from the 63 release.</li>
<li>Added preliminary support for the Visual Studio 2010 beta.</li>
<li>Fixed a bug in SQLiteCommand that threw a null reference exception when setting
the Transaction object to null.</li>
<li>If SQLiteConnection.EnlistTransaction is called multiple times for the same
transaction scope, just return without throwing an error.</li>
</ul>
<p>
<b>1.0.63.0 - June 29, 2009</b></p>
<ul>
<li>Code merge with SQLite 3.6.16</li>
<li>Check the autocommit mode of the connection to which a transaction is bound
during the disposal of the transaction.&nbsp; If autocommit is enabled, then the
database has already rolled back the transaction and we don&#39;t need to do it
during dispose, and can quietly ignore the step without throwing an error.</li>
<li>Eliminated the mergebin step altogether.&nbsp; It was developed primarily to
merge the Compact Framework binaries together, but since we&#39;re not doing that
anymore, its use is limited.&nbsp; Its non-standard method of merging a binary on
the desktop framework is redundant as well.&nbsp; The desktop binary now hard-links
to MSCOREE, but as of Windows XP, this was redundant as well since XP and beyond
automatically attempt to load MSCOREE on startup when a DLL has a .NET header.</li>

<li>More improvements to the test.exe program for running the tests against Sql
Server for comparison purposes.</li>
</ul>
<p>
<b>1.0.62.0 - June 19, 2009</b></p>
<ul>
<li>Code merge with SQLite 3.6.15</li>
<li>Fixed the decimal reading bug in the SQLiteDataReader</li>
<li>Changed Join()&#39;s to Sleep()&#39;s in the statement retry code to prevent
message pumping</li>
<li>Fixed a bad pointer conversion when retrieving blobs using GetBytes() in 64-bit
land</li>
<li>Several changes to the Test program that comes with the provider.&nbsp; Tests
can now be individually disabled, and the test program can run against several provider
back-ends</li>
</ul>
<p>
<b>1.0.61.0 - April 28, 2009</b></p>
<ul>
<li>Code merge with SQLite 3.6.13. The new backup features are as yet unimplemented
in the provider, but will be forthcoming in a subsequent release</li>
<li>Fixed the default-value lookups in SQLiteConnectionStringBuilder when accessing
properties</li>
<li>Lock the SQLiteTransaction object during dispose to avoid potential race condition
during cleanup</li>
<li>Fixed SQLiteDataReader.GetDecimal() processing and parsing of decimal values
for cases when SQLite returns things like "1.0e-05" instead of "0.0001"</li>
</ul>
<p>
<b>1.0.60.0 - October 3, 2008</b></p>
<ul>
<li>Throw a NotSupported exception in the EF Sql Gen code instead of parsing illegal
SQL during an update/insert/delete where no primary key is defined.</li>
<li>Fixed the Compact Framework interop library.&nbsp; Since the linker flag /subsystem
had no version specified, it was causing a problem for many CE-based platforms.</li>

<li>Incorporated SQLite patch for ticket <a href="https://www.sqlite.org/cvstrac/tktview?tn=3387">

#3387</a> and reverted out the vfs override code I added in build 59 to work around
this problem.</li>
<li>Fixed a designer issue when creating a new table from the Server Explorer.&nbsp;
After initially saving it, if you then continued to edit it and tried to save it
again, it would generate the change SQL using the old temporary table name rather
than the new name.</li>
</ul>
<p>
<b>1.0.59.0 - September 22, 2008</b></p>
<ul>
<li>Code merge with SQLite 3.6.3.&nbsp; Solves a couple different EF issues that
were either giving inconsistent results or crashing the engine.</li>

<li>Fixed the parsing of literal binaries in the EF SqlGen code.&nbsp; SQLite now
passes nearly all the testcases in <a href="http://sqlite.phxsoftware.com/forums/p/1377/5921.aspx#5921">
Microsoft's EF Query Samples</a> application -- the exception being the <i>datetimeoffset
</i>and<i> time</i> constants tests, and tests that use the <i>APPLY </i>keyword
which are unsupported for now.</li>
<li>Revamped the Compact Framework mixed-mode assembly.&nbsp; Tired of playing cat
and mouse with the Compact Framework&#39;s support for mixed-mode assemblies.&nbsp;
The CF build now requires that you distribute both the System.Data.SQLite library
and the paired SQLite.Interop.XXX library.&nbsp;&nbsp; The XXX denotes the build
number of the library.</li>
<li>Implemented a workaround for Vista&#39;s overzealous caching by turning off
FILE_FLAG_RANDOM_ACCESS for OS versions above XP.&nbsp; This is implemented as a
custom (default override) VFS in the interop.c file, so no changes are made to the
SQLite source code.</li>
<li>Fixed some registry issues in the designer install.exe, which prevented some
design-time stuff from working on the Compact Framework when .NET 3.5 was installed.</li>

</ul>
<p>
<b>1.0.58.0 - August 30, 2008</b></p>
<ul>
<li>Code merge with SQLite 3.6.2.&nbsp; If only I&#39;d waited one more day to release
57!&nbsp; Several LINQ issues have been resolved with this engine release relating
to deeply-nested subqueries that the EF SqlGen creates.</li>
<li>The Rollback SQLiteConnection event no longer requires an open connection in
order to subscribe to it.&nbsp; Missed this one in the 57 release.</li>
</ul>
<p>
<b>1.0.57.0 - August 29, 2008</b></p>
<ul>
<li>Compiled against 3.6.1 with checkin <a href="https://www.sqlite.org/cvstrac/tktview?tn=3300">

#3300</a> resolved, which fixes an Entity Framework bug I was seeing.&nbsp; I currently
have 3 other tickets out on the engine, which are not yet resolved and relate to
EF.</li>
<li>Fixed decimal types to store and fetch using InvariantCulture.&nbsp; If you&#39;re
using decimal datatypes in your database and were affected by the 56 release, please
issue an UPDATE &lt;table&gt; SET &lt;column&gt; = REPLACE(&lt;column&gt;, &#39;,&#39;,
&#39;.&#39;);&nbsp; to fix the decimal separators.&nbsp; Apologies for not testing
that more thoroughly before releasing 56.</li>
<li>Too many LINQ fixes to list.&nbsp; Fixed views so they generate, fixed the LIMIT
clause, implemented additional functionality and removed unnecessary code.</li>
<li>Fixed foreign key names in the designer so viewing the SQL script on a new unsaved
table after renaming it in the properties toolwindow will reflect in the script
properly.</li>
<li>Fixed the Update and Commit events on SQLiteConnection so they don&#39;t require
the connection to be opened first.</li>
<li>Fixed userdef aggregate functions so they play nice with each other when appearing
multiple times in the same statement.</li>
<li>Fixed the editing and saving of default values in the table designer.</li>
<li>Fixed ForeignKeys schema to support multi-column foreign keys.&nbsp; Also hacked
support for them in the table designer, provided two foreign keys in the designer
have the same name and reference the same foreign table and different columns.&nbsp;
Will implement first-class support for this in the next release.</li>
</ul>
<p>
<b>1.0.56.0 - August 11, 2008</b></p>
<ul>
<li>Fixed a bug in the table designer when designing new tables, wherein you had
to save the table first before being able to create indexes and foreign keys.</li>
<li>Tweaks to decimal type handling.&nbsp; The &#39;decimal&#39; type can&#39;t
be represented by Int64 or Double (without loss of precision) in SQLite, so we have
to fudge it by treating it like a string and converting it back and forth in the
provider.&nbsp; Unfortunately backing it to the db as a string causes sorting problems.&nbsp;
See <a href="http://sqlite.phxsoftware.com/forums/p/1296/5595.aspx#5595">this post</a>

for details on using a custom collation sequence to overcome the sorting issue arising
from this patch.</li>
<li>Minor tweaks and bugfixes to the test program and the provider.</li>
<li>More adjustments to make the managed-only version of the provider run and pass
all tests on Mono.</li>
<li>LINQ to Entities bits heavily updated and compiled against VS2008 SP1 RTM.&nbsp;
SQLite LINQ support is still considered beta.</li>
</ul>
<p>
<b>1.0.55.0 - August 6, 2008</b></p>
<ul>
<li>Code merge with SQLite 3.6.1</li>
<li>Added support for the user-contributed extension-functions at <a href="https://www.sqlite.org/contrib">

https://www.sqlite.org/contrib</a>.&nbsp; Feel free to override any of them with
your own implementation.&nbsp; The new functions are: <i>acos, asin, atan, atn2,
atan2, acosh, asinh, atanh, difference, degrees, radians, cos, sin, tan, cot, cosh,
sinh, tanh, coth, exp, log, log10, power, sign, sqrt, square, ceil, floor, pi, replicate,
charindex, leftstr, rightstr, reverse, proper, padl, padr, padc, strfilter,</i>
and aggregates <i>stdev, variance, mode, median, lower_quartile, upper_quartile.</i></li>
<li>Moved the last_rows_affected() function to the C extension library.</li>
<li>Added a new class, SQLiteFunctionEx which extends SQLiteFunction and adds the
ability for a user-defined function to get the collating sequence during the Invoke/Step
methods.&nbsp; User-defined functions can use the collating sequence as a helper
to compare values.</li>
<li>When registering user-defined collation sequences and functions, the provider
will now register both a UTF8 and a UTF16 version instead of just UTF8.</li>
<li>Revamped connection pooling and added static ClearPool() and ClearAllPools()
functions to SQLiteConnection.&nbsp; Behavior of the pool and its clearing mechanics
match SqlClient.</li>
<li>Fixed connections going to the pool so that any unfinalized lingering commands
from un-collected datareaders are automatically reset and any lurking transactions
made on the connection are rolled back.</li>
<li>Transaction isolation levels are now partially supported.&nbsp; Serializable
is the default, which obtains read/write locks immediately -- this is compatible
with previous releases of the provider.&nbsp; Unspecified will default to whatever
the default isolation mode is set to, and ReadCommitted will cause a deferred lock
to be obtained.&nbsp; No other values are legal.</li>
<li>Revamped the test.exe program.&nbsp; It&#39;s now an interactive GUI application.&nbsp;
Easier for me to add tests now.</li>
<li>Tweaks to the VS designer package and installer.</li>
<li>More adjustments to the internal SQLite3.Prepare() method to account for both
kinds of lock errors when retrying.</li>
<li>Stripped a lot of unnecessary interop() calls and replaced with base sqlite
calls.&nbsp; Revamped most of UnsafeNativeMethods to make it easier to port the
code.</li>
<li>Rerigged internal callbacks for userdef functions and other native to managed
callbacks.&nbsp; More portable this way.</li>
<li>Source can now can be compiled with the SQLITE_STANDARD preprocessor symbol
to force the wrapper to use the stock sqlite3 library.&nbsp; Some functionality
is missing, but its minimal.&nbsp; None of the precompiled binaries are compiled
using this setting, but its useful for testing portability.</li>
<li>Added &quot;boolean&quot; and a couple other missing datatypes to the &quot;DataTypes&quot;
schema xml file.&nbsp; Used by the VS designer when displaying tables and querying.</li>
<li>Added a new connection string option &quot;Read Only&quot;.&nbsp; When set to
True, the database will be opened in read-only mode.</li>
<li>Added a new connection string option &quot;Max Pool Size&quot; to set the maximum
size of the connection pool for a given db file connection.</li>
<li>Added a new connection string option &quot;Default IsolationLevel&quot; to set
the default isolation level of transactions.&nbsp; Possible values are Serializable
and ReadCommitted.</li>
<li>Added a new connection string option &quot;URI&quot; as an optional parameter
for compatibility with other ports of the provider.</li>
</ul>
<p>
<b>1.0.54.0 - July 25, 2008</b></p>
<ul>
<li>Fixed the setup project, which somehow &quot;forgot&quot; to include all the
binaries in the 53 release.</li>
<li>Fixed a crash in the table designer when creating a new table and tabbing past
the &quot;Allow Nulls&quot; cell in the grid while creating a new column.</li>
<li>Fixed a mostly-benign bug in SQLiteDataReader&#39;s GetEnumerator, which failed
to pass along a flag to the underyling DbEnumerator it creates.&nbsp; This one&#39;s
been around since day 1 and nobody&#39;s noticed it in all these years.</li>
<li>Added a new connection string parameter &quot;Journal Mode&quot; that allows
you to set the SQLite journal mode to Delete, Persist or Off.</li>
</ul>
<p>
<b>1.0.53.0 - July 24, 2008</b></p>
<ul>
<li>Enabled sqlite_load_extension</li>
<li>Added retry/timeout code to SQLite3.Prepare() when preparing statements for
execution and a SQLITE_BUSY error occurs.</li>
<li>Added a new schema to SQLiteConnection.GetSchema() called <i>Triggers</i>.&nbsp;
Used to retrieve the trigger(s) associated with a database and/or table/view.</li>
<li>Extensive updates to table/view editing capabilities inside Visual Studio&#39;s
Server Explorer.&nbsp; The program now parses and lets you edit CHECK constraints
and triggers on a table, as well as define triggers on views.&nbsp; Experimental
still, so e-mail me if you have issues.</li>
<li>Minor bugfix to the ViewColumns schema to return the proper base column name
for a view that aliases a column.</li>
<li>Fixed the insert/update/delete DML support in the Linq module.</li>
<li>Changed the behavior of SQLiteCommand to allow a transaction to be set even
if the command hasn&#39;t been associated with a connection yet.</li>
</ul>
<p>
<b>1.0.52.0 - July 16, 2008</b></p>
<ul>
<li>Code merge with SQLite 3.6.0</li>
<li>Added a lot of previously-missing exports to the DEF file for the native library.</li>

<li>Fixed SQLiteDataReader to check for an invalid connection before operating on
an open cursor.</li>
<li>Implemented the Cancel() function of SQLiteCommand to cancel an active reader.</li>
<li>Added beta table and view designers to the Visual Studio Server Explorer.&nbsp;
You can now edit/create tables and views, manage indexes and foreign keys from Visual
Studio.&nbsp; This feature is still undergoing testing so use at your own risk!</li>
<li>Fixed the Server Explorer so VS2005 users can once again right-click tables
and views and open the table data.</li>
<li>Added some new interop code to assist in returning more metadata not normally
available through the SQLite API.&nbsp; Specifically, index column sort modes and
collating sequences.&nbsp; Also added code to detect (but not parse) CHECK constraints,
so the table designer can pop up a warning when editing a table with these constraints.&nbsp;
Since I can&#39;t currently parse them.</li>
<li>Lots of LINQ SQL generation improvements and fixes.</li>
<li>Made some progress cleaning up and fixing up the schema definitions and manifests
for EdmGen.</li>
<li>Added a built-in SQLiteFunction called last_rows_affected() which can be called
from SQL to get the number of rows affected by the last update/insert operation
on the connection.&nbsp; This is roughly equivalent to Sql Server&#39;s @@ROWCOUNT
variable.</li>
</ul>
<p>
<b>1.0.51.0 - July 1, 2008</b></p>
<ul>
<li><b>VS2008 SP1 Beta1 LINQ Support</b></li>
<li>Added experimental Entity Framework support in a new library, System.Data.SQLite.Linq.&nbsp;
Some things work, some don&#39;t.&nbsp; I haven&#39;t finished rigging everything
up yet.&nbsp; The core library remains stable.&nbsp; All LINQ-specific code is completely
separate from the core.</li>
<li>Added some columns to several existing schemas to support some of the EDM framework
stuff.</li>
<li>Minor tweaks to the factory to better support dynamic loading of the Linq extension
library for SQLite.</li>
<li>SQLite&#39;s busy handler was interfering with the provider&#39;s busy handling
mechanism, so its been disabled.</li>
</ul>
<p>
<b>1.0.50.0 - June 27, 2008</b></p>
<ul>
<li>Fixed some lingering dispose issues and race conditions when some objects were
finalized.</li>
<li>Fixed the SQLiteConvert.Split() routine to be a little smarter when splitting
strings, which solves the quoted data source filename problem.</li>
<li>Enhanced the mergebin utility to work around the strong name validation bug
on the Compact Framework.&nbsp; The old workaround kludged the DLL and caused WM6.1
to fail to load it.&nbsp; This new solution is permanent and no longer kludges the
DLL.</li>
</ul>
<p>
<b>1.0.49.0 - May 28, 2008</b></p>
<ul>
<li>Code merge with SQLite 3.5.9</li>
<li>Fixed schema problems when querying the TEMP catalog.</li>
<li>Changed BLOB datatype schema to return IsLong = False instead of True.&nbsp;
This was preventing DbCommandBuilder from using GUID's and BLOB's as primary keys.</li>
<li>Fix rollover issue with SQLite3.Reset() using TickCount.</li>
<li>Fixed SQLiteDataReader to dispose of its command (if called for) before closing
the connection (when flagged to do so) instead of the other way around.</li>
<li>Fixed a DbNull error when retrieving items not backed by a table schema.</li>
<li>Fixed foreign key constraint parsing bug.</li>
<li>Added FailIfMissing property to the SQLiteConnectionStringBuilder.</li>
<li>Converted the source projects to Visual Studio 2008.</li>
</ul>
<p>
<b>1.0.48.0 - December 28, 2007</b></p>
<ul>
<li>Code merge with SQLite 3.5.4</li>
<li>Calling SQLiteDataReader.GetFieldType() on a column with no schema information
and whos first row is initially NULL now returns type Object instead of type DbNull.</li>
<li>Added support for a new DateTime type, JulianDay.&nbsp; SQLite uses Julian dates
internally.</li>
<li>Added a new connection string parameter "Default Timeout" and a corresponding
method on the SQLiteConnection object to change the default command timeout.&nbsp;
This is especially useful for changing the timeout on transactions, which use SQLiteCommand
objects internally and have no ADO.NET-friendly way to adjust the command timeout
on those commands.</li>
<li>FTS1 and FTS2 modules were removed from the codebase.&nbsp; Please upgrade all
full-text indexes to use the FTS3 module.&nbsp;</li>
</ul>
<p>
<b>1.0.47.2 - December 10, 2007</b></p>
<ul>
<li>Fixed yet one more bug when closing a database with unfinalized command objects</li>
<li>Fixed the DataReader's GetFieldType function when dealing with untyped SQLite
affinities</li>
</ul>
<p>
<b>1.0.47.1 - December 5, 2007</b></p>
<ul>
<li>Fixed a leftover bug from the codemerge with SQLite 3.5.3 that failed to close
a database.</li>
<li>Fixed the broken Compact Framework distribution binary.</li>
<li>SQLite 3.5.x changed some internal infrastructure pieces in the encryption interface
which I didn't catch initially.&nbsp; Fixed.&nbsp;</li>
</ul>
<p>
<b>1.0.47.0 - December 4, 2007</b></p>
<ul>
<li>Code merge with SQLite 3.5.3</li>
<li>Added installer support for Visual Studio 2008.&nbsp; Code is still using the
VS2005 SDK so one or two bells and whistles are missing, but nothing significant.</li>
<li>This is the last version that the FTS1 and FTS2 extensions will appear.&nbsp;
Everyone should rebuild their fulltext indexes using the new FTS3 module.&nbsp;
FTS1 and FTS2 suffer from a design flaw that could cause database corruption with
certain vacuum operations.</li>
<li>Fixed pooled connections so they rollback any outstanding transactions before
going to the pool.&nbsp; </li>
<li>Fixed the unintended breaking of the TYPES keyword, and mis-typing of untyped
or indeterminate column types. </li>
<li>Assert a FileIOPermission() requirement in the static SQLiteFunction constructor.
</li>
<li>The CE-only SQLiteFunction.RegisterFunction() is now available on the desktop
platform for dynamic registration of functions.&nbsp; You must still close and re-open
a connection in order for the new function to be seen by a connection.</li>
<li>Fixed the "database is locked" errors by implementing behavioral changes in
the interop.c file for SQLite.&nbsp; Closing a database force-finalizes any prepared
statements on the database to ensure the connection is fully closed.&nbsp; This
was rather tricky because the GC thread could still be finalizing statements itself.
&nbsp;</li>
<li>Modifed the mergebin utility to help circumvent a long-standing strong name
verification bug in the Compact Framework.</li>
</ul>
<p>
<b>1.0.46.0 - September 30, 2007</b></p>
<ul>
<li>Fixed faulty logic in type discovery code when using SQLiteDataReader.GetValue().</li>
<li>Fixed Connection.Open() bug when dealing with :memory: databases.</li>
<li>Fixed SQLiteCommand.ExecuteScalar() to return a properly-typed value.</li>
<li>Added support for SQLiteParameter.ResetDbType().</li>
<li>Added test cases for rigid and flexible type testing.</li>
</ul>
<p>
<b>1.0.45.0 - September 25, 2007</b></p>
<ul>
<li><strong>Breaking change in GetSchema("Indexes") </strong>-- MetaDataCollections
restrictions and identifier parts counts were wrong for this schema and I was using
the wrong final parameter as the final restriction.&nbsp; Meaning, if you use the
Indexes schema and are querying for a specific index the array should now be {catalog,
null, table, index } instead of {catalog, null, table, null, index}</li>
<li>Code merge with SQLite 3.4.2</li>
<li>Fixed some errors in the encryption module, most notably when a non-default
page size is specified in the connection string. </li>
<li>Fixed SQLiteDataReader to better handle type-less usage scenarios, which also
fixes problems with null values and datetimes.</li>
<li>Fixed the leftover temp files problem on WinCE </li>
<li>Added connection pooling.&nbsp; The default is disabled for now, but may change
in the future.&nbsp; Set "Pooling=True" in the connection string to enable it. </li>
<li>Sped up SQLiteConnection.Open() considerably.</li>
<li>Added some more robust cleanup code regarding SQLiteFunctions.</li>
<li>Minor additions to the code to allow for future LINQ integration into the main
codebase.</li>
<li>Fixed a long-standing bug in the Open() command of SQLiteConnection which failed
to honor the documented default behavior of the SQLite.NET provider to open the
database in "Synchronous=Normal" mode.&nbsp; The default was "Full". </li>
<li>If Open() fails, it no longer sets the connection state to Broken.&nbsp; It
instead reverts back to Closed, and cleans up after itself.</li>
<li>Added several new parameters to the ConnectionString for setting max page count,
legacy file format, and another called FailIfMissing to raise an error rather than
create the database file automatically if it does not already exist.</li>
<li>Fixed some designer toolbox references to the wrong version of the SQLite.Designer</li>
<li>Fixed a bug in the mergebin utility with regards to COR20 metadata rowsize computations.&nbsp;
</li>
<li>Minor documentation corrections &nbsp;&nbsp;</li>
</ul>
<p>
<b>1.0.44.0 - July 21, 2007</b></p>
<ul>
<li>Code merge with SQLite 3.4.1</li>
<li>Fixed a bug in SQLiteConnection.Open() which threw the wrong kind of error in
the wrong kind of way when a database file could not be opened or created.&nbsp;</li>
<li>Small enhancements to the TYPES keyword, and added documentation for it in the
help file.</li>
<li>Hopefully fixed the occasional SQLITE_BUSY errors that cropped up when starting
a transaction.&nbsp; Usually occurred in high-contention scenarios, and the underlying
SQLite engine bypasses the busy handler in this scenario to return immediately.</li>
</ul>
<p>
<b>1.0.43.0 - June 21, 2007</b></p>
<ul>
<li>Code merge with SQLite 3.4.0</li>
<li>Fixed a reuse bug in the SQLiteDataAdapter in conjunction with the SQLiteCommandBuilder.&nbsp;
It's been there unnoticed for more than a year, so it looks like most folks never
encountered it. </li>
<li>Fixed an event handler bug in SQLiteCommandBuilder in which it could fail to
unlatch from the DataAdapter when reused.&nbsp; Relates to the previous bugfix.</li>
<li>Fixed a double-dispose bug in SQLiteStatement that triggered a SQLiteException.&nbsp;</li>
</ul>
<p>
<b>1.0.42.0 - June 1, 2007</b></p>
<ul>
<li>Code merge with SQLite 3.3.17</li>
<li>Changed the SQLiteFunction static constructor so it only enumerates loaded modules
that have referenced the SQLite assembly, which hopefully should cut down dramatically
the time it takes for that function to execute.&nbsp;</li>
<li>Added the FTS2 full-text search extension to the project.&nbsp; Look for FTS1
to disappear within the next couple of revisions.&nbsp;</li>
<li>Fixed a bug introduced with the finalizers that triggered an error when statements
ended with a semi-colon or had other non-parsable comments at the end of a statement&nbsp;</li>
<li>Fixed an intermittent multi-threaded race condition between the garbage collector
thread and the main application thread which lead to an occasional SQLITE_MISUSE
error.</li>
<li>Fixed another issue relating to SQLite's inherent typelessness when dealing
with aggregate functions which could return Int64 or Double or even String for a
given row depending on what was aggregated.</li>
<li>Remembered to recompile the DDEX portion of the engine this time, so Compact
Framework users can once again use the design-time functionality</li>
</ul>
<p>
<b>1.0.41.0 - April 23, 2007</b></p>
<ul>
<li>Code merge with SQLite 3.3.16</li>
<li>Second go at implementing proper finalizers to cleanup after folks who've forgotten
to Dispose() of the SQLite objects</li>
<li>Enhanced GetSchema(IndexColumns) to provide numeric scale and precision values</li>
<li>Fixed the column ordinals in GetSchema(IndexColumns) to report the ordinal of
the column in the index, not the table</li>
<li>Fixed a bug whereby parameters named with an empty string (such as String.Empty)
were treated like a named parameter instead of an unnamed parameter</li>
</ul>
<p>
<b>1.0.40.0 - January 31, 2007</b></p>
<ul>
<li>Code merge with SQLite 3.3.12</li>
<li>Lots of new code to handle misuse of the library.&nbsp; Implemented finalizers
where it made sense, fixed numerous garbage collector issues when objects are not
disposed properly, &nbsp;fixed some object lifetime issues, etc.</li>
<li>A failed Commit() on a transaction no longer leaves the transaction in an unusable
state.</li>
</ul>
<p>
<b>1.0.39.1 - January 11, 2007</b></p>
<ul>
<li>Fixed a really dumb mistake that for some reason didn't trigger any errors in
the testcases, whereby commands when associated with a connection were not adding
or removing themselves from an internal list of commands for that connection --
causing a "database is locked" error when trying to close the connection.</li>
</ul>
<p>
<b>1.0.39.0 - January 10, 2007</b></p>
<ul>
<li>Code merge with SQLite 3.3.10</li>
<li>Fixed a multi-threaded race condition bug in the garbage collector when commands
and/or connections are not properly disposed by the user. </li>
<li>Switched the encryption's internal deallocation code to use sqlite's built-in
aux functions instead of modifying the pager.c source to free the crypt block.&nbsp;
This eliminates the last of the code changes the provider makes to the original
SQLite engine sources.&nbsp; Props to Ralf Junker for pointing that out.</li>
</ul>
<p>
<b>1.0.38.0 - November 22, 2006</b></p>
<ul>
<li>Fixed a bug when using CommandBehavior.KeyInfo whereby integer primary key columns
may be duplicated in the results. </li>
<li>Enhanced the CommandBuilder so that update/delete statements are optimized when
the affected table contains unique constraints and a primary key is present.</li>
<li>Fixed a bug in the DataReader when used in conjunction with CommandBehavior.CloseConnection.</li></ul>
<p>
<b>1.0.37.0 - November 19, 2006</b></p>
<ul>
<li>Added support for CommandBehavior.KeyInfo.&nbsp; When specified in a query,
additional column(s) will be returned describing the key(s) defined for the table(s)
selected in the query.&nbsp; This is optimized when INTEGER PRIMARY KEY is set for
the given tables, but does additional work for other kinds of primary keys.</li>

<li>Removed the default values from SQLiteDataReader.GetTableSchema(), to better
follow Sql Server's pattern and suppress schema errors when loading the records
into a dataset/datatable.</li>
<li>Allow integers to implicitly convert to double/decimal/single.</li></ul>
<p>
<b>1.0.36.1 - October 25, 2006</b></p>
<ul>
<li>Added support for LONGVARCHAR, SMALLDATE and SMALLDATETIME. These were actually
added in 1.0.36.0 but were undocumented.</li>
<li>Fixed the embedded helpfile which was accidentally built from old sources. </li>
<li>Fixed an unfortunate re-entry of a bug in the .36 codebase that caused the provider
to "forget" about commands on a connection under certain circumstances.</li>
</ul>
<p>
<b>1.0.36.0 - October 23, 2006</b></p>
<ul>
<li>Code merge with SQLite 3.3.8, including support for full-text search via the
FTS1 extension.&nbsp;</li><li>Fixed a bug retrieving data types when UseUtf16Encoding
is true. Side-effect of further merging the common code between the two base classes.</li>
<li>Fixed a bug with System.Transactions whereby a connection closed/disposed within
a transaction scope is rolled back and cannot be committed.</li>
<li>Added more error checking and reporting to transactions to help user's isolate
the source of transaction failures.</li>
<li>Implemented a workaround for a Compact Framework issue regarding strong-named
assemblies containing a PE section with a raw size less than the virtual size.&nbsp;</li>
</ul>
<p>
<b>1.0.35.1 - September 12, 2006</b></p>
<ul>
<li>Fixed the TYPES keyword to work when UseUTF16Encoding is true.</li>
<li>Fix another bug revealed in 1.0.35.0 regarding infinite loops when the 2nd or
subsequent statements of a semi-colon separated command cannot be parsed.</li>
<li>Updated the help documentation.&nbsp;</li>
</ul>
<p>
<b>1.0.35.0 - September 10, 2006</b></p>
<ul>
<li>Fixed an infinite loop bug in SQLiteCommand caused when multiple semi-colon
separated statements in a single command are executed via datareader and one of
the statements contains a syntax error preventing it from being prepared.&nbsp;</li><li>
Added the TYPES preparser keyword to be placed before a SELECT statement to aid
the wrapper in converting expressions in a subsequent select clause into more robust
types.&nbsp; Documentation yet to be integrated, but available on the forums.</li>
<li>Added a new connectionstring parameter "BinaryGUID=true/false" (default is "true").&nbsp;
When true, guid types are stored in the database as binary blobs to save space.&nbsp;
Binary has been the default format since 1.0.32.0 but this parameter eases backward
compatibility.</li>
</ul>
<p>
<b>1.0.34.0 - September 4, 2006</b></p>
<ul>
<li>Fixed a bug in SQLiteParameterCollection.RemoveAt(namedparam)</li>
<li>Fixed a bug in SQLiteDataReader introduced in 1.0.30 that broke DateTimes using
the Ticks option in the connection string.</li>
<li>Fixed a bug in the recent changes to guid behavior wherein using a datareader's
indexer to fetch a guid from a column containing both binary and text guids would
sometimes return a byte array instead of a guid.</li>
<li>Enacted a workaround involving typed datasets in Compact Framework projects
in which it took an excessive amount of time to open a form and generated a lot
of temporary files in the user's Local Settings\Application Data\Microsoft\VisualStudio\8.0\Assembly
References folder.</li>
</ul>
<p>
<b>1.0.33.0 - August 21, 2006</b></p>
<ul>
<li>Code merge with SQLite 3.3.7</li>
<li>Fixed a bug in SQLiteConnection that caused it to "forget" about commands bound
to it and occasionally throw an error when a database is closed and opened repeatedly.&nbsp;
</li>
</ul>
<p>
<b>1.0.32.0 - August 6, 2006</b></p>
<ul>
<li>Added AllowPartiallyTrustedCallers attribute to the assembly</li><li>Added the
missing "nchar" type</li>
<li>Added support for binary Guid's.&nbsp; Guids are now stored as binary by default
when using parameterized queries.&nbsp; Text guids are still fully supported.</li>
<li>Fixed a TransactionScope() error that caused the transaction not to be completed.</li>
<li>Enhanced parameter names so that if they are added to the Parameters collection
without their prefix character (@ : or $) they are still properly mapped.&nbsp;</li>
</ul>
<p>
<b>1.0.31.0 - July 16, 2006</b></p>
<ul>
<li>Re-applied the view parsing bugfix in 1.0.29.0 that was accidentally reverted
out of the 30 build.</li><li>Fixed SQLiteCommand.ExecuteScalar() to return null
instead of DbNull.Value when no rows were returned.</li>
<li>Design-time installer now installs the package-based designer on full Visual
Studio versions.&nbsp; Express editions continue to use the packageless designer.</li>
<li>In Visual Studio (not Express), you can now right-click a SQLite connection
in the Server Explorer and vacuum the database and change the encryption password.</li>
</ul>
<p>
<b>1.0.30.1 - July 2, 2006</b></p>
<ul>
<li>Code merge with SQLite 3.3.6</li>
<li>Added support for the |DataDirectory| keyword in the Data Source filename string.&nbsp;
</li>
<li>Added hook notification support to SQLiteConnection.&nbsp; Specifically, there
are three new events on the SQLiteConnection object which are raised when an update/insert/delete
occurs and when transactions are committed and rolled back.</li><li>Changed SQLiteTransaction
to default to BEGIN IMMEDIATE instead of just BEGIN, which solves a multithreaded
race condition.&nbsp;</li>
<li>Changed SQLiteDataReader to better support SQLite's typelessness.&nbsp; The
data reader no longer caches column affinity, but re-evaluates it for each column/row.</li>
<li>Fixed a bug in Prepare() which caused an intermittant fault due to the code
accessing the memory of an unpinned variable.&nbsp;</li>
<li>Fixed a multithreaded lock-retry bug in in SQLiteConnection.Open() and in SQLiteTransaction,
which failed to use a command timeout before giving up.</li>
</ul>
<p>
<b>1.0.29.0 - May 16, 2006</b></p>
<ul>
<li>Fixed a bug in the Views schema information which caused multi-line view definition
statements not to be parsed</li>
<li>Fixed a parsing bug in SQLiteDataReader.GetSchemaTable() to account for numeric(x,y)
datatypes with specified precision and scale</li>
<li>Fixed a bug in SQLiteConnection.Open() which tried to automatically enlist in
an ambient transaction but had not yet set the state of the database to Opened,
thereby causing a transaction fault</li>
<li>Changed SQLiteException to inherit from DbException on the full framework</li>
</ul>
<p>
<b>1.0.28.0 - April 14, 2006</b></p>
<ul>
<li>Code merge with SQLite 3.3.5</li>
<li>You can now specify a relative path in the Compact Framework's "Data Source"
by prefixing the file with ".\".&nbsp; i.e. "Data Source=.\\mydb.db3"</li>
<li>Several more changes and enhancements to schemas for better compatibility.</li>
<li>Fixed several bugs with the 64-bit builds of the provider.&nbsp; The x64 binary
is now optimized.</li>
<li>Design-time installer now tries to install the 64-bit builds into the GAC along
with the 32-bit build.</li>
<li>Fixed a bug in the SQLiteDataReader.GetSchemaTable() function when used with
tables containing apostrophes.</li>
<li>Fixed an XSD-related bug whereby the XSD utility was unable to locate the provider
and could not generate typed datasets.</li>
<li>Added NTEXT and STRING datatypes to the list of recognized keywords (used for
schema retrieval).</li>
<li>Due to the XSD bug and other potential problems related to external build utilities,
changes to the installation of the designer have had to be made.&nbsp; The installer
used to write the DbProviderFactories XML into the devenv.exe.config file and its
express cousins, but now has to write instead to the machine.config.</li>
<li>Installer writes to both the 32-bit machine.config and the 64-bit machine.config
if it exists.&nbsp;</li>
</ul>
<p>
<b>1.0.27.1 - February 28, 2006</b></p>
<ul>
<li>Fixed a bug when doing data binding in Compact Framework projects that prevented
you from assigning a typed dataset to a bindingsource.&nbsp; It turns out, the CF
version of the SQLite provider needs to be flagged as retargetable so it'll work
in the design-time desktop environment.&nbsp; No changes were made to the desktop
build, but the revision was bumped on all libraries anyway in order to keep them
sync'd.&nbsp;</li></ul>
<p>
<b>1.0.27.0 - February 27, 2006</b></p>
<ul>
<li>Many optimizations and a few more minor adjustments to schemas and schema retrieval
performance.</li>
<li>Lots of design-time attributes added to the code.&nbsp; The DbDataAdapter, DbCommand,
and DbConnection objects now have greatly enhanced design-time capabilities when
added to the toolbox and dropped on a form.</li>
<li>Lots of Server Explorer enhancements.</li>
<li>Binaries are now distributed in a setup program for easier administration and
configuration of the provider.</li>
</ul>
<p>
<b>1.0.26.2 - February 15, 2006</b></p>
<ul>
<li>Yet another bugfix to index schemas, which was incorrectly marking most indexes
as primary key indexes.</li><li>Fixed GetSchema() to accept a null string array.</li><li>
Fixed a misspelled export in the core C library that prevented databases opened
with UTF16Encoding from getting schema information and would likely cause an error
if attempted.</li></ul>
<p>
<b>1.0.26.1 - February 14, 2006</b></p>
<ul>
<li>Fixed even more minor schema bugs having to do with indexes.</li><li>Added two
missing pieces in the SQLite designer which were preventing it from being used from
within VS Express editions.&nbsp;</li><li>Several bugfixes to the design-time installer
program, including supporting 64-bit environments.</li></ul>
<p>
<b>1.0.26.0 - February 11, 2006</b></p>
<ul>
<li>Code merge with SQLite 3.3.4</li><li>Fixed an encryption bug when changing the
password of databases over 1gb in size.&nbsp;</li><li>Fixed various designer issues
related to construction of named parameters.</li>
<li>Retooled the GetSchema() method of SQLiteDataReader to use the new 3.3.4 API
functions, and made several enhancements and fixes to schemas.&nbsp;</li>
<li>Implemented the SourceColumnNullMapping property of SQLiteParameter to fix a
DbCommandBuilder code generation bug.&nbsp;</li><li>Removed the runtime dependency
on msvcr80.dll.&nbsp; File size is somewhat larger for the varying desktop versions.</li><li>
Created an install program to manage installation and uninstallation of the SQLite
design-time support.</li>
<li>Designer support now works for all Visual Studio editions, including all Express
Editions.</li>
<li>Design-time installer will now remove (if present) the machine.config SQLite
entries in favor of installing the xml code into the devenv.exe.config file (or
any of the variations for express editions).&nbsp; The officially-accepted behavior
of using DbProviderFactories is to add the code to your app.config file, and the
machine.config file should not be touched.</li>
</ul>
<p>
<b>1.0.25.0 - January 31, 2006</b></p>
<ul>
<li>Code merge with SQLite 3.3.3</li><li>Added automatic distributed transaction
enlistment and implemented the DbConnection.EnlistTransaction method for manual
enlistment.</li>
<li>Nested transactions are now supported.</li>
<li>Rearranged the timing of SetPassword(), which now must be called before the
database is opened instead of afterwards.&nbsp; Optionally, the password can be
supplied in the ConnectionString.</li>
<li>Fixed a bug in SQLiteFunction that caused a failure when an empty resultset
was returned and a custom user aggregate function was used in the query.</li>
<li>The designer has had another round of cleanup applied, in preparation for moving
to a VS package.</li>
<li>Added SQLiteMetaDataCollectionNames class.</li>
</ul>
<p>
<b>1.0.24.6 beta - January 23, 2006</b></p>
<ul>
<li>This beta is built from sqlite.org's 3.3.2 beta.</li><li>Eliminated the static
linking of mscoree from all binaries.&nbsp; Native projects can now use the library
without any dependencies on the .NET framework, while managed projects continue
to be able to use the library normally.</li></ul>
<p>
<b>1.0.24.5 beta - January 20, 2006</b></p>
<ul>
<li>This beta is built from sqlite.org's 3.3.1 alpha and contains development-in-progress
code.&nbsp; Therefore no guarantees can be made regarding its suitability for production
use.</li>
<li><strong>You no longer need to distribute 2 files on the CompactFramework.&nbsp;
You can delete SQLite.Interop.dll entirely.&nbsp; </strong>I wrote a custom tool
called "mergebin" (available in the source zip file) which combines the two libraries
and gets around a glaring defect in the VS2005 linker for ARM processors which doesn't
allow you to link netmodules.</li>
<li><strong>x64 and ia64 builds now use the same strong name as the x86 build.</strong>&nbsp;
This means breaking backward compatibility, but it was necessary in order to allow
you to drop any of those 3 builds onto a PC and have your .NET program run properly.&nbsp;
Prior to this, you'd get an error if you built your program using the x86 build,
and then installed the x64 version on a target machine and tried to run your program
against it.</li>
<li>The entire source project has been gone over top to bottom.&nbsp; A debug build
no longer combines the binaries into a single module, which was preventing proper
debugging.</li></ul>
<p>
<b>1.0.24.4 beta - January 16, 2006</b></p>
<ul>
<li>This beta is built from sqlite.org's 3.3.1 alpha and contains development-in-progress
code.&nbsp; Therefore no guarantees can be made regarding its suitability for production
use.</li>
<li>Fixed a bug in the UTF-16 handling code for preparing statements due to a behavioral
change in SQLite 3.3.0.</li>
<li>Added pager.c code necessary to cleanup after an encrypted file is closed.</li>
<li>Fixed an encryption bug that caused a fault when an encrypted file was rolled
back.</li>
<li>Modified the testcase code to take advantage of optimizations regarding the
use of a DbCommandBuilder.&nbsp; DataAdapter insert speed increased dramatically
as a result.</li>
</ul>
<p>
<b>1.0.24.3 beta - January 10, 2006</b></p>
<ul>
<li>This beta is built from sqlite.org's 3.3.0 alpha and contains development-in-progress
code.&nbsp; Therefore no guarantees can be made regarding its suitability for production
use.</li><li>Added support for database encryption at the pager level.&nbsp; Databases
are encrypted using a 128-bit RC4 stream algorithm.&nbsp; To open an existing encrypted
database, you may now specify a "Password={password}" text in the ConnectionString,
or you may call the SQLiteConnection.SetPassword() function to set the password
on an open connection. &nbsp;To encrypt existing non-encrypted databases or to change
the password on an encrypted database, you must use the SQLiteConnection.ChangePassword()
function.&nbsp; If you use SetPassword() instead of specifying a password in the
connection string, or call ChangePassword() you may use a binary byte array or a
text string as the password.</li>
<li>Rewrote the locking implementation for the Compact Framework.&nbsp; It is now
more robust and incorporates into the SQLite codebase more efficiently than the
previous CE adaptation.</li>
<li>Moved some of the embedded schema XML data into a resource file to ease code
readability.</li>
<li>Automated the fixup of the original SQLite codebase's source prior to compiling,
to ease merging with sqlite.org's source.</li>
<li>Fixed a memory leak in SQLiteCommand due to it not removing an internal reference
to itself in SQLiteConnection.&nbsp; </li>
</ul>
<p>
<b>1.0.24.2 - December 30, 2005</b></p>
<ul>
<li>Fixed the SQLiteDataReader.HasRows property to return the proper value.</li>
<li>Implemented the inadvertently neglected RecordsAffected property on SQLiteDataReader.
</li>
<li>SQLiteFunction static constructor was changed to pre-filter classes with only
the SQLiteFunctionAttribute.&nbsp; The code was throwing an exception when certain
assemblies were referenced in a project. </li>
<li>Fixed the SQLiteDataAdapter OnRowUpdated event, which was using the wrong variable
to find the attached event handler and subsequently not raising the event.</li>
<li>Small optimizations and fixes to SQLiteDataReader.NextResult().&nbsp;</li>
</ul>
<p>
<b>1.0.24.1 - December 19, 2005</b></p>
<ul>
<li>Update core SQLite engine to 3.2.8&nbsp;</li></ul>
<p>
<b>1.0.24 - December 9, 2005</b></p>
<ul>
<li>Fixed the<em> Catalogs</em> schema bug that caused attached databases not to
be re-attached to a cloned connection </li>
<li>Enhanced transactions to allow for a deferred or immediate writelock. &nbsp;SQLiteConnection.BeginTransaction()
now has an additional overload to support it&nbsp;</li><li>Commands are now prepared
as they are executed instead of beforehand.&nbsp; This fixes a bug whereby a multi-statement
command that alters the database and subsequently references the altered data would
fail during Prepare().</li><li>Tightened up the SQLiteDataReader to prevent reading
columns before calling the first Read() and to prevent reading columns after the
last Read().</li>
<li>A more descriptive error is thrown if there aren't enough parameters in the
command to satisfy the parameters required by the statement(s).&nbsp;</li>
</ul>
<p>
<b>1.0.23 - November 21, 2005</b></p>
<ul>
<li>Named parameters may now begin with <strong>@</strong> to ease portability of
the provider. SQLite's named parameters are ordinarily prefixed with a <strong>:
</strong>or<strong> $</strong>.&nbsp; The designer will still use the <strong>$</strong>
prefix however, since its more compatible with the default SQLite engine.</li><li>
Added several alternate ISO8601 date/time formats to SQLiteConvert.cs to increase
compatibility.</li>
<li>Relaxed coersion restrictions to work better with SQLite's inherent typelessness.&nbsp;</li>
</ul>
<p>
<b>1.0.22 - November 11, 2005</b></p>
<ul>
<li>Fixed some globalization issues which resulted in incorrect case-insensitive
comparisons</li>
<li>Fixed a bug in the routine that finds all user-defined functions in a loaded
assembly.&nbsp; It would throw an exception if any of the types in the assembly
could not be loaded.&nbsp; The exception is now caught and handled appropriately.</li>
</ul>
<p>
<b>1.0.21 - November 4, 2005</b></p>
<ul>
<li>Fixed a designer bug when creating typed datasets with parameterized queries.</li>
<li>The above fix then exposed another bug in the datareader's ability to query
schema information on parameterized commands, which was also fixed.</li>
<li>Compiled against the RTM version of VS2005.</li>
<li>Rewrote the design-time install script to use the XML DOM objects when writing
to the machine.config and to automatically register the DLL in the GAC.</li><li>
Made changes to the app.config descriptions and help file to improve version-independent
factory support.</li></ul>
<p>
<b>1.0.20 - October 19, 2005</b></p>
<ul>

<li>Fixed a shortcut in SQLiteBase.GetValue which was insufficient for international
environments.&nbsp; The shortcut was removed and the "proper" procedure put in.</li></ul>

<p>
<b>1.0.19 - October 5, 2005</b></p>
<ul>

<li>Code merge with SQLite 3.2.7

<li>Fixed bugs in the CE port code (os_wince.c)&nbsp;which were brought to light&nbsp;by&nbsp;recent
changes in the SQLite engine.

<li>Recompiled and modified to be compatible with the September VS2005 Release Candidate.<br />

Beta 2 users should continue to use 1.0.18.1</li></ul>
<p>
<b>1.0.18.1 - September 19, 2005</b></p>
<ul>

<li>Code merge with SQLite 3.2.6</li></ul>
<p>
<b>1.0.18 - September 1, 2005</b></p>
<ul>

<li>Added type-specific method calls when using the various SQLite classes that
would've normally returned a a generic Db base class, which aligns the code better
with the Microsoft-supplied data providers.</li></ul>
<p>
<b>1.0.17 - August 26, 2005</b></p>
<ul>

<li>Code merge with SQLite 3.2.5

<li>Added Itanium and x64 build settings to the project (needs testing)

<li>Bugfixes and enhancements to several schema types

<li>Additional design-time support to include index and foreign key enumerations.&nbsp;
Requires re-registering the designer using INSTALL.CMD.&nbsp; The new designer code

now allows the VS query designer and typed datasets to automatically link up foreign
keys, use indexes, and automatically generate relationships from the schema.<li>
Additional static methods on SQLiteConnection to create a database file, encrypt
a file using the Encrypted File System (EFS) on NTFS (requires NT 2K or above) and
NTFS file compression</li>
</ul>


<p>
<b>1.0.16 - August 24, 2005</b></p>
<ul>
<li>Code merge with SQLite 3.2.4 with the large delete bugfix in CVS (which will
become 3.2.5 soon)

<li>Added new GetSchema() types: IndexColumns, ViewColumns, ForeignKeys</li>
</ul>
<p>
<b>1.0.15 - August 22, 2005</b><br />
</p>
<ul>

<li>Code merge with SQLite 3.2.3

<li>Minor updates for better design-time experience. More design-time code to follow
in subsequent releases.</li>
</ul>
<p>
<b>1.0.14 - August 16, 2005</b><br />
</p>
<ul>

<li>Fixed a bug in the SQLiteDataAdapter due to insufficient implementation of the
class.&nbsp; The RowUpdating and RowUpdated events are now properly implemented,
but unfortunately inserting and updating data in a DataTable or DataSet is now much
slower.&nbsp; This is the proper design however, so the changes are here to stay.


<li>Lots of schema changes to support Visual Studio's Data Designer architecture.<li>
Added Designer support for the provider.&nbsp; It's not 100%, but you can design
queries, add typed datasets and perform quite a number of tasks all within Visual
Studio now.</li></ul>
<p>
<b>1.0.13 - August 8, 2005</b><br />
</p>

<div>
<ul>
<li>Fixed a named parameter bug in the base SQLite_UTF16 class, which of course
only showed up when a database connection was opened using the UseUTF16Encoding=True
parameter.

<li>Fixed a performance issue in SQLite_UTF16 involving string marshaling.</li></ul>


</div>


<p>
<b>1.0.12 - August 5, 2005</b><br />
</p>
<div>
<ul>
<li>Full support for the Compact Framework.&nbsp; Each build (Debug/Release) now
has a&nbsp;platform, either Win32 or Compact Framework.&nbsp; The correct projects
are built accordingly.&nbsp; See the&nbsp;<a href="#redist">Distributing SQLite</a>

section for information on what files need to be distributed for each platform.&nbsp;


<li>Modified SQLite3.Reset() and Step() functions to transparently handle timeouts
while waiting on the database to become available (typically when a writer is waiting
on a reader to finish, or a reader is waiting on a writer to finish).

<li>Lots of code cleanup&nbsp;as suggested&nbsp;by the Code Analyzer (FxCop).

<li>Lots of updates to the helpfile (as you can see).

<li>Statements&nbsp;were already prepared lazily&nbsp;in a SQLiteCommand, but now
its even more lazy.&nbsp; Statements are now only prepared if the statements haven't
been previously prepared and a Prepare() function is called (and the command is
associated with a connection) or just prior to the command being executed.&nbsp;</li></ul>
</div>
<p>
<b>1.0.11 - August 1, 2005</b><br />
</p>
<ul>

<li><strong>For everything except the Compact Framework, System.Data.SQLite.dll
is now the <em>only</em> DLL required to use this provider!</strong>&nbsp; The assembly
is now a multi-module assembly, containing both the native SQLite3 codebase and
the C# classes built on top of it.&nbsp; The Compact Framework version (when completed)
will not be able to support this feature, so backwards compatibility with the Compact
Framework has been preserved for the future.

<li>Fixed a bug in SQLiteCommand.ExecuteScalar() that caused it to stop executing
commands once it obtained the first column of the first row-returning resultset.&nbsp;
Any remaining statements after the row-returning statement was ignored. </li>

</ul>
<p>
<b>1.0.10 - June 10, 2005</b><br />
</p>
<ul>

<li>Fixed a bug in the SQLite3.cs Prepare() function that created a statement even
when the SQLite engine returned a NULL pointer. Typically this occurs when multiple
statements are processed and there are trailing comments at the end of the statement.


<li>Fixed a bug in SQLiteStatement.cs that retrieved parameter names for a parameterized
query.&nbsp; SQLite's parameters are 1-based, and the function was starting at 0.&nbsp;
This was fine when all parameters were unnamed, but for named parameters it caused
the parameters to be out of whack. </li>
</ul>
<p>
<b>1.0.09a - May 25, 2005</b><br />
</p>
<ul>

<li>Fixed a broken helpfile and corrected some obsolete help remarks in SQLiteFunction.cs


<li>Added a version resource to the SQLite.Interop.dll.&nbsp;</li></ul>
<p>
<b>1.0.09 - May 24, 2005</b><br />
</p>
<ul>

<li>Code merge with the latest 3.21 version of SQLite.

<li>Removed obsolete methods and properties for Whidbey Beta 2</li></ul>
<p>
<b>1.0.08 Refresh - Mar 24, 2005<br />
</b>
</p>
<ul>

<li>Code merge with the latest 3.20 version of SQLite.

<li>Recompiled the help file to fix a build error in it. </li>
</ul>
<p>
<b>1.0.08 - Mar 11, 2005<br />
</b>







</p>
<ul>
<li>Added additional #if statements to support the old beta 1 edition of VS2005.
<li>Code merged the SQLite 3.14 source. </li>
</ul>
<p>
<b>1.0.07 - Mar 5, 2005</b><br />
</p>
<ul>

<li>Made more optimizations to frequently-called functions, resulting in significant
performance gains in all tests.

<li>Recompiled the binaries using the latest VS2005 February CTP, resulting in yet
more significant speed gains.&nbsp; The 100k insert test used to take 3.5 seconds
and the insertwithidentity took almost 8 seconds.&nbsp; With the above two changes,
those tests are now executing in 1.9 and 4.9 seconds respectively.</li></ul>










<p>
<b>1.0.06 - Mar 1, 2005<br />
</b>
</p>
<ul>
<li>Speed-ups to SQLiteDataReader.&nbsp; It was interop'ing unnecessarily every
time it tried to fetch a field due to a logic error.
<li>Changed/Added some code to SQLiteConvert's internal DbType, Type and TypeAffinity
functions.
<li>Fixed the SQLiteDataReader to obey the flags set in the optional CommandBehavior
flag from SQLiteCommand.ExecuteReader().

<li>Changed the default page size to 1024 to reflect the defaults of SQLite.&nbsp;
Ignores the "Page Size" connection string option for memory databases, as tests
revealed that changing it resulted in memory corruption errors.

<li>Performance enhancements to the SQLiteCommand and SQLiteStatement classes which
reduced the 100,000 row insert execution time as well as the various Function execution
times significantly. </li>



</ul>







<p>
<b>1.0.05 - Feb 25, 2005</b>
</p>
<ul>
<li>Fixed the SQLite3 C# class step/reset functions to accomodate schema changes
that invalidate a prepared statement.&nbsp; Statements are recompiled transparently.
<li>Moved all native DLL declarations to an UnsafeNativeMethods class.
<li>Split several classes into their own modules for readability.

<li>Renamed many internal variables, reviewed access to variables marked as internal
and altered their protection levels accordingly.

<li>Due to the presence of the altered sqlite3 codebase and so many added interop
functions, I decided to rename the sqlite3 C project and the DLL to SQLite.Interop.dll.&nbsp;
This is the same core sqlite3 codebase but designed specifically for this ADO.NET
provider.&nbsp; This eliminates any possibility of someone dropping another build
of sqlite3.dll into the system and rendering the provider inoperable.&nbsp; In the
future if the folks at sqlite.org finally introduce a method of retrieving column

usage for an arbitrary prepared statement, I'll retool this library to be a lightweight
function call wrapper around the core binary distribution.

<li>Added [SuppressUnmanagedCodeSecurity] attribute to the UnsafeNativeMethods class
which brings VS2005 November CTP execution speeds inline with the December CTP.



<li>Added a <b>bin</b> directory to the project root where pre-compiled binaries
can be found.
<li>Added a <b>doc</b> directory where preliminary documentation on the class library
can be found.
<li>Documented a lot more of the classes internally. </li>
</ul>
<p>






<b>1.0.04 - Feb 24, 2005</b>
</p>
<ul>

<li>Removed the SQLiteContext class and revamped the way UserFunctions work to simplify
the imlementation.

<li>Fixed a counting bug in the TestCases class, specifically in the function tests
where I wasn't resetting the counter and it was consequently reporting intrinsic
and raw select calls as being much much faster than they actually were.&nbsp; The
numbers are now much closer to what I expected for performance, with .NET user-functions
still being the slowest, but only by a small margin.

<li>Small performance tweaks to SQLiteDataReader.

<li>Added PageSize to the SQLiteConnectionStringBuilder and subsequently to the
SQLiteConnection

<li>Added a PRAGMA encoding=XXX execution statement to the SQLiteConnection after
opening a connection. </li>
</ul>
<p>
<b>1.0.03 - Feb 23, 2005</b>
</p>
<ul>

<li>Fixed up SQLiteCommandBuilder to correct implementation errors, which resulted
in an enormous performance boost in the InsertMany test.&nbsp;&nbsp; 10,000 row
insert that executed in 1500ms now executes in 500ms.

<li>Fixed several errors in the SQLite3_UTF16 class.&nbsp; ToString() was working
incorrectly and the Open() method failed to register user defined functions and
collations.

<li>Fixed a bug in SQLiteCommand.ClearCommands() whereby only the first statement
was being properly cleaned up.

<li>Fixed a bug in SQLiteDataReader whereby calling NextResult() would not properly
reset the previously-executed command in the sequence.

<li>Added an InsertManyWithIdentityFetch test, which appends a select clause to
populate the ID of the last inserted row into the InsertCommand, demonstrating ADO.NET's
ability to auto-fetch identity columns on insert. </li>
</ul>
<p>
<b>1.0.02 - Feb 21, 2005</b></p>
<ul>

<li>Tweaks to the xxx_interop functions that return char *'s, so they also return
the length.&nbsp; Saves an interop call to get the UTF-8 string length during conversion
to a .NET string.

<li>Reworked the whole interop.c thing into interop.h and reduced the code required
to merge the main sqlite3 codebase.

<li>Added support for user-defined collations. </li>
</ul>

</body>
</html>

Changes to test/AssemblyInfo.cs.








1
2
3
4
5
6
7
8
9
10
11
12
13


14

15

16
17
18
19
20



21
22
23
24
25
26
27
28
29








using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("test")]
[assembly: AssemblyCopyright("")]


[assembly: AssemblyTrademark("")]

[assembly: AssemblyCulture("")]


///  Setting ComVisible to false makes the types in this assembly not visible 
///  to COM componenets.  If you need to access a type in this assembly from 
///  COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]




// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
[assembly: AssemblyVersion("1.0.0.*")]

>
>
>
>
>
>
>

<





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

|
|
|

>
>
>








|
>
1
2
3
4
5
6
7
8

9
10
11
12
13
14
15

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System.Reflection;

using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("System.Data.SQLite Tester")]
[assembly: AssemblyDescription("ADO.NET Data Provider for SQLite")]

[assembly: AssemblyCompany("https://system.data.sqlite.org/")]
[assembly: AssemblyProduct("System.Data.SQLite")]
[assembly: AssemblyCopyright("Public Domain")]

#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif

//  Setting ComVisible to false makes the types in this assembly not visible 
//  to COM componenets.  If you need to access a type in this assembly from 
//  COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a6adbb45-c95f-44fb-bd47-f073e79c1d4b")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
[assembly: AssemblyVersion("1.0.119.0")]
[assembly: AssemblyFileVersion("1.0.119.0")]

Changes to test/Program.cs.

1

2
3



4
5
6
7
8
9
10
11
12
13
14

15
16





17



18

19


20


21


22

23

24

25

26

27

28


29

30


31












32
using System;

using System.Data;
using System.Text;



using System.Data.Common;
using System.Data.SQLite;
using System.Threading;
using System.Transactions;
using System.Windows.Forms;
using System.IO;

namespace test
{
  class Program
  {

    static void Main()
    {





      Application.Run(new TestCasesDialog());



    }




    static void cnn_RollBack(object sender, EventArgs e)


    {


    }



    static void cnn_Commit(object sender, CommitEventArgs e)

    {

    }



    static void cnn_Updated(object sender, UpdateEventArgs e)


    {

    }


  }












}
<
>
|
|
>
>
>
|
|
|
<

<



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


1
2
3
4
5
6
7
8
9

10

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72

/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System;
using System.Diagnostics;

using System.Windows.Forms;


namespace test
{
    class Program
    {
        [STAThread()]
        static void Main(string[] args)
        {
            if (Environment.GetEnvironmentVariable("BREAK") != null)
            {
                Console.WriteLine(
                    "Attach a debugger to process {0} and press any key to continue.",
                    Process.GetCurrentProcess().Id);

                try
                {
                    Console.ReadKey(true); /* throw */
                }
                catch (InvalidOperationException) // Console.ReadKey
                {
                    // do nothing.
                }

                Debugger.Break();
            }

            string fileName = "test.db"; // NOTE: New default, was "Test.db3".
            bool autoRun = false;

            if (args != null)
            {
                int length = args.Length;

                for (int index = 0; index < length; index++)
                {
                    string arg = args[index];

                    if (arg != null)
                    {
                        arg = arg.TrimStart(new char[] { '-', '/' });

                        if (String.Equals(arg, "fileName",
                                StringComparison.OrdinalIgnoreCase))
                        {
                            index++;

                            if (index < length)
                                fileName = args[index];
                        }
                        else if (String.Equals(arg, "autoRun",
                                StringComparison.OrdinalIgnoreCase))
                        {
                            autoRun = true;
                        }
                    }
                }
            }

            Application.Run(new TestCasesDialog(fileName, autoRun));
        }
    }
}

Changes to test/Properties/Resources.Designer.cs.








1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32







//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.3031
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace test.Properties {
    using System;
    
    
    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class Resources {
        
        private static global::System.Resources.ResourceManager resourceMan;
        
        private static global::System.Globalization.CultureInfo resourceCulture;
        
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resources() {
>
>
>
>
>
>
>



|

















|


|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.1
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace test.Properties {
    using System;
    
    
    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal sealed class Resources {
        
        private static global::System.Resources.ResourceManager resourceMan;
        
        private static global::System.Globalization.CultureInfo resourceCulture;
        
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resources() {

Changes to test/Properties/Resources.resx.

Changes to test/TestCases.cs.








1
2
3
4
5
6
7
8
9
10
11
12



13
14




15
16
17
18
19
20
21







using System;
using System.Data.Common;
using System.Data;
using System.Data.SQLite;
using System.Transactions;
using System.Collections.Generic;
using System.Text;

namespace test
{
  internal class TestCases : TestCaseBase
  {



    private List<string> droptables = new List<string>();
    private List<string> maydroptable = new List<string>();





    internal TestCases()
    {
    }

    internal TestCases(DbProviderFactory factory, string connectionString)
      : base(factory, connectionString)
>
>
>
>
>
>
>










|

>
>
>


>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System;
using System.Data.Common;
using System.Data;
using System.Data.SQLite;
using System.Transactions;
using System.Collections.Generic;
using System.Text;

namespace test
{
  internal sealed class TestCases : TestCaseBase
  {
    private const int NumThreads = 8;
    private const int ThreadTimeout = 60000;

    private List<string> droptables = new List<string>();
    private List<string> maydroptable = new List<string>();

#if !USE_INTEROP_DLL || !INTEROP_LOG
    private long logevents = 0;
#endif

    internal TestCases()
    {
    }

    internal TestCases(DbProviderFactory factory, string connectionString)
      : base(factory, connectionString)
63
64
65
66
67
68
69













































































70
71
72
73
74
75
76
77
78
79
80
81
82
83
84

    internal void CheckSQLite()
    {
      if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) == -1)
        throw new InconclusiveException("Not a SQLite database");
    }














































































    [Test(Sequence=1)]
    internal string VersionTest()
    {
      CheckSQLite();
      string[] version = _cnn.ServerVersion.Split('.');
      if (Convert.ToInt32(version[0]) < 3
        || (Convert.ToInt32(version[0]) == 3 && Convert.ToInt32(version[1]) < 6)
        || (Convert.ToInt32(version[1]) == 6 && Convert.ToInt32(version[2]) < 1)
        ) throw new Exception(String.Format("SQLite Engine is {0}.  Minimum supported version is 3.6.1", _cnn.ServerVersion));

      return String.Format("SQLite Engine is {0}", _cnn.ServerVersion);
    }

    //[Test(Sequence = 1)]
    internal void ParseTest()







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







|







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175

    internal void CheckSQLite()
    {
      if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) == -1)
        throw new InconclusiveException("Not a SQLite database");
    }

/*
 * NOTE: Using SEE for this particular test case is currently unsupported
 *       because we have no easy way of executing the SQL beforehand that
 *       is needed to set it up.
 */

#if INTEROP_CODEC // || INTEROP_INCLUDE_SEE
    /// <summary>
    /// Tests changing password on an encrypted database.
    /// </summary>
    [Test]
    internal void ChangePasswordTest()
    {
        if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) > -1)
        {
            // Opens an unencrypted database
            SQLiteConnection cnn = new SQLiteConnection(_cnnstring.ConnectionString);

            cnn.Open();

            // Encrypts the database. The connection remains valid and usable afterwards.
            cnn.ChangePassword("mypassword");

            maydroptable.Add("ChangePasswordTest");
            if (cnn.State != ConnectionState.Open) cnn.Open();
            using (DbCommand cmd = cnn.CreateCommand())
            {
                cmd.CommandText = "CREATE TABLE ChangePasswordTest(ID int primary key)";
                cmd.ExecuteNonQuery();
            }

            cnn.Close();

            // Try re-opening with bad password
            cnn.SetPassword("!mypassword");
            cnn.Open();
            cnn.Close();

            // Try re-opening with good password
            cnn.SetPassword("mypassword");
            cnn.Open();

            // Decrpyt database
            cnn.ChangePassword(String.Empty);

            cnn.Close();

            ///////////////////////////////////////////////////////////////////

            cnn.Open();

            // Re-Encrypts the database. The connection remains valid and usable afterwards.
            cnn.ChangePassword("mypassword");
            cnn.ChangePassword("mynewerpassword");

            maydroptable.Add("ChangePasswordTest2");
            if (cnn.State != ConnectionState.Open) cnn.Open();
            using (DbCommand cmd = cnn.CreateCommand())
            {
                cmd.CommandText = "CREATE TABLE ChangePasswordTest2(ID int primary key)";
                cmd.ExecuteNonQuery();
            }

            // Decrpyt database
            cnn.ChangePassword(String.Empty);
            cnn.Close();

            ///////////////////////////////////////////////////////////////////

            // Try opening now without password
            cnn.Open();
            cnn.Close();

        }
    }
#endif

    [Test(Sequence=1)]
    internal string VersionTest()
    {
      CheckSQLite();
      string[] version = _cnn.ServerVersion.Split('.');
      if (Convert.ToInt32(version[0]) < 3
        || (Convert.ToInt32(version[0]) == 3 && Convert.ToInt32(version[1]) < 6)
        || (Convert.ToInt32(version[0]) == 3 && Convert.ToInt32(version[1]) == 6 && Convert.ToInt32(version[2]) < 1)
        ) throw new Exception(String.Format("SQLite Engine is {0}.  Minimum supported version is 3.6.1", _cnn.ServerVersion));

      return String.Format("SQLite Engine is {0}", _cnn.ServerVersion);
    }

    //[Test(Sequence = 1)]
    internal void ParseTest()
134
135
136
137
138
139
140

141
142
143
144
145
146
147
        using (DbDataReader reader = cmd.ExecuteReader())
        {
          reader.Read();
        }
      }
    }


    [Test(Sequence = 8)]
    internal void FunctionWithCollation()
    {
      CheckSQLite();
      using (DbCommand cmd = _cnn.CreateCommand())
      {
        cmd.CommandText = "SELECT CHARINDEX('pat', 'thepat'), CHARINDEX('pat', 'THEPAT'), CHARINDEX('pat' COLLATE NOCASE, 'THEPAT' COLLATE NOCASE)";







>







225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
        using (DbDataReader reader = cmd.ExecuteReader())
        {
          reader.Read();
        }
      }
    }

#if USE_INTEROP_DLL && INTEROP_EXTENSION_FUNCTIONS
    [Test(Sequence = 8)]
    internal void FunctionWithCollation()
    {
      CheckSQLite();
      using (DbCommand cmd = _cnn.CreateCommand())
      {
        cmd.CommandText = "SELECT CHARINDEX('pat', 'thepat'), CHARINDEX('pat', 'THEPAT'), CHARINDEX('pat' COLLATE NOCASE, 'THEPAT' COLLATE NOCASE)";
165
166
167
168
169
170
171

172
173
174
175
176
177
178
        {
          reader.Read();
          if (reader.GetInt64(0) != reader.GetInt64(2) || reader.GetInt64(1) != 1 || reader.GetInt64(0) != 0)
            throw new Exception("CharIndex returned wrong results!");
        }
      }
    }


    [Test]
    internal void DataTypesSchema()
    {
      using (DataTable tbl = _cnn.GetSchema("DataTypes"))
      {
      }







>







257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
        {
          reader.Read();
          if (reader.GetInt64(0) != reader.GetInt64(2) || reader.GetInt64(1) != 1 || reader.GetInt64(0) != 0)
            throw new Exception("CharIndex returned wrong results!");
        }
      }
    }
#endif

    [Test]
    internal void DataTypesSchema()
    {
      using (DataTable tbl = _cnn.GetSchema("DataTypes"))
      {
      }
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
                  for (int n = 0; n < 10000; n++)
                  {
                    DataRow row = tbl.NewRow();
                    row[1] = n + (50000 * ((bWithIdentity == true) ? 2 : 1));
                    tbl.Rows.Add(row);
                  }

                  //Console.WriteLine(String.Format("          Inserting using CommandBuilder and DataAdapter\r\n          ->{0} (10,000 rows) ...", (bWithIdentity == true) ? "(with identity fetch)" : ""));
                  int dtStart = Environment.TickCount;
                  adp.Update(tbl);
                  int dtEnd = Environment.TickCount;
                  dtEnd -= dtStart;
                  builder.AppendFormat("Insert Ends in {0} ms ... ", (dtEnd));

                  dtStart = Environment.TickCount;







|







609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
                  for (int n = 0; n < 10000; n++)
                  {
                    DataRow row = tbl.NewRow();
                    row[1] = n + (50000 * ((bWithIdentity == true) ? 2 : 1));
                    tbl.Rows.Add(row);
                  }

                  //Console.WriteLine(String.Format("          Inserting using CommandBuilder and DataAdapter\r\n          ->{0} (10,000 rows) ...", (bWithIdentity == true) ? "(with identity fetch)" : String.Empty));
                  int dtStart = Environment.TickCount;
                  adp.Update(tbl);
                  int dtEnd = Environment.TickCount;
                  dtEnd -= dtStart;
                  builder.AppendFormat("Insert Ends in {0} ms ... ", (dtEnd));

                  dtStart = Environment.TickCount;
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815

      using (DbCommand cmd = _cnn.CreateCommand())
      {
        foreach(string table in droptables)
        {
          try
          {
            cmd.CommandText = String.Format("DROP TABLE{1} [{0}]", table, (throwError == false) ? " IF EXISTS" : "");
            cmd.ExecuteNonQuery();
          }
          catch (Exception e)
          {
            if (throwError == true)
              errors += String.Format("{0}\r\n", e.Message);
          }
        }

        foreach (string table in maydroptable)
        {
          try
          {
            cmd.CommandText = String.Format("DROP TABLE{1} [{0}]", table, (throwError == false) ? " IF EXISTS" : "");
            cmd.ExecuteNonQuery();
          }
          catch (Exception)
          {
          }
        }
      }







|













|







880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908

      using (DbCommand cmd = _cnn.CreateCommand())
      {
        foreach(string table in droptables)
        {
          try
          {
            cmd.CommandText = String.Format("DROP TABLE{1} [{0}]", table, (throwError == false) ? " IF EXISTS" : String.Empty);
            cmd.ExecuteNonQuery();
          }
          catch (Exception e)
          {
            if (throwError == true)
              errors += String.Format("{0}\r\n", e.Message);
          }
        }

        foreach (string table in maydroptable)
        {
          try
          {
            cmd.CommandText = String.Format("DROP TABLE{1} [{0}]", table, (throwError == false) ? " IF EXISTS" : String.Empty);
            cmd.ExecuteNonQuery();
          }
          catch (Exception)
          {
          }
        }
      }
1115
1116
1117
1118
1119
1120
1121




1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137


1138
1139
1140
1141

1142
1143
1144
1145
1146
1147
1148
          using (DbDataAdapter adp = _fact.CreateDataAdapter())
          using (DbCommandBuilder builder = _fact.CreateCommandBuilder())
          {
            adp.SelectCommand = cmd;
            builder.DataAdapter = adp;
            builder.ConflictOption = ConflictOption.OverwriteChanges;





            using (DbCommand updatecmd = builder.GetUpdateCommand())
            {
              if (updatecmd.Parameters.Count != 4)
                throw new Exception("Wrong number of parameters in update command!");
            }
          }
        }
        finally
        {
        }
      }
    }

    [Test]
    internal void ConnectionStringBuilder()
    {


      DbConnectionStringBuilder builder = _fact.CreateConnectionStringBuilder();
      if (builder is SQLiteConnectionStringBuilder)
      {
        bool pool = ((SQLiteConnectionStringBuilder)builder).Pooling;

      }
    }

    [Test]
    internal void LeakyCommands()
    {
      for (int n = 0; n < 100000; n++)







>
>
>
>
















>
>
|
|
|
|
>







1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
          using (DbDataAdapter adp = _fact.CreateDataAdapter())
          using (DbCommandBuilder builder = _fact.CreateCommandBuilder())
          {
            adp.SelectCommand = cmd;
            builder.DataAdapter = adp;
            builder.ConflictOption = ConflictOption.OverwriteChanges;

            //
            // NOTE: *MONO* This test fails on all recent versions of Mono (e.g.
            //       2.10, 2.11) for reasons that are presently unknown.
            //
            using (DbCommand updatecmd = builder.GetUpdateCommand())
            {
              if (updatecmd.Parameters.Count != 4)
                throw new Exception("Wrong number of parameters in update command!");
            }
          }
        }
        finally
        {
        }
      }
    }

    [Test]
    internal void ConnectionStringBuilder()
    {
      if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) > -1)
      {
        DbConnectionStringBuilder builder = _fact.CreateConnectionStringBuilder();
        if (builder is SQLiteConnectionStringBuilder)
        {
          bool pool = ((SQLiteConnectionStringBuilder)builder).Pooling;
        }
      }
    }

    [Test]
    internal void LeakyCommands()
    {
      for (int n = 0; n < 100000; n++)
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201


1202
1203
1204
1205
1206
1207
1208
                throw new ArgumentException("Should not have allowed an execute with an open reader"); // If we got here, the test failed
              }
              catch (Exception e)
              {
                if (e is ArgumentException) throw new Exception(e.Message);

                cmdEnd = Environment.TickCount;
                if (cmdEnd - cmdStart < 2000 || cmdEnd - cmdStart > 3000)
                  throw new Exception("Did not give up the lock at the right time!"); // Didn't wait the right amount of time



              }
            }
          }
        }
      }
    }








|
<

>
>







1292
1293
1294
1295
1296
1297
1298
1299

1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
                throw new ArgumentException("Should not have allowed an execute with an open reader"); // If we got here, the test failed
              }
              catch (Exception e)
              {
                if (e is ArgumentException) throw new Exception(e.Message);

                cmdEnd = Environment.TickCount;
                int cmdElapsed = cmdEnd - cmdStart;


                if (cmdElapsed < 2000 || cmdElapsed > 3000)
                  throw new Exception(String.Format("Did not give up the lock at the right time ({0}ms)!", cmdElapsed)); // Didn't wait the right amount of time
              }
            }
          }
        }
      }
    }

1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239

1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255

1256
1257
1258
1259
1260
1261
1262
1263

1264
1265
1266
1267


1268
1269

1270
1271
1272
1273
1274
1275

1276
1277
1278

1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296

1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314


1315
1316
1317
1318
1319
1320
1321




1322
1323
1324
1325
1326
1327
1328
        {
          if (reader.Read() == false) throw new Exception("Failed to read from the table");
          if (reader.GetInt32(0) != 2) throw new Exception(String.Format("Expected {0} got {1}", 2, reader.GetInt32(0)));
        }
      }
    }

    internal class MTTest
    {
      internal DbConnection cnn;
      internal Exception e;
      internal System.Threading.Thread t;
      internal int value;

    }

    [Test(Sequence=11)]
    internal void MultithreadingTest()
    {
      using (DbCommand cmd = _cnn.CreateCommand())
      {
        droptables.Add("MultiThreadedTest");
        if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) == -1)
          cmd.CommandText = "CREATE TABLE MultiThreadedTest(ID integer identity primary key, ThreadId integer, MyValue integer)";
        else
          cmd.CommandText = "CREATE TABLE MultiThreadedTest(ID integer primary key, ThreadId integer, MyValue integer)";

        cmd.ExecuteNonQuery();
      }


      MTTest[] arr = new MTTest[8];

      for (int n = 0; n < arr.Length; n++)
      {
        arr[n] = new MTTest();
        arr[n].t = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(MultithreadedTestThread));
        arr[n].t.IsBackground = true;
        arr[n].cnn = ((ICloneable)_cnn).Clone() as DbConnection;

        arr[n].t.Start(arr[n]);
      }

      System.Threading.Thread.Sleep(8000);


      bool failed = false;
      Exception e = null;

      for (int n = 0; n < arr.Length; n++)
      {
        if (arr[n].t.Join(0) == false)
        {
          failed = true;
          arr[n].t.Abort();

        }
        if (arr[n].e != null) e = arr[n].e;
        arr[n].cnn.Dispose();

      }
      if (failed) throw new Exception("One or more threads deadlocked");
      if (e != null) 
        throw e;
    }

    internal void MultithreadedTestThread(object obj)
    {
      MTTest test = obj as MTTest;

      if (test.cnn.State != ConnectionState.Open)
        test.cnn.Open();

      int start = Environment.TickCount;
      try
      {
        using (DbCommand cmd = test.cnn.CreateCommand())
        {

          while (Environment.TickCount - start < 2000)
          {
            using (DbTransaction trans = test.cnn.BeginTransaction())
            {
              cmd.CommandText = String.Format("SELECT * FROM MultiThreadedTest WHERE ThreadId = {0}", test.t.ManagedThreadId);
              cmd.Transaction = trans;
              using (DbDataReader reader = cmd.ExecuteReader())
              {
                while (reader.Read())
                {
                  test.value += Convert.ToInt32(reader[2]);
                }
              }
              cmd.CommandText = String.Format("INSERT INTO MultiThreadedTest(ThreadId, MyValue) VALUES({0}, {1})", test.t.ManagedThreadId, Environment.TickCount);
              cmd.ExecuteNonQuery();

              trans.Commit();
            }


          }
        }
      }
      catch (Exception e)
      {
        test.e = e;
      }




    }

    [Test]
    internal void ParameterizedInsert()
    {
      using (DbCommand cmd = _cnn.CreateCommand())
      {







|





>
















>
|







>



|
>
>


>


|



>



>

|
















>
|

















>
>







>
>
>
>







1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
        {
          if (reader.Read() == false) throw new Exception("Failed to read from the table");
          if (reader.GetInt32(0) != 2) throw new Exception(String.Format("Expected {0} got {1}", 2, reader.GetInt32(0)));
        }
      }
    }

    internal sealed class MTTest
    {
      internal DbConnection cnn;
      internal Exception e;
      internal System.Threading.Thread t;
      internal int value;
      internal System.Threading.ManualResetEvent ev;
    }

    [Test(Sequence=11)]
    internal void MultithreadingTest()
    {
      using (DbCommand cmd = _cnn.CreateCommand())
      {
        droptables.Add("MultiThreadedTest");
        if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) == -1)
          cmd.CommandText = "CREATE TABLE MultiThreadedTest(ID integer identity primary key, ThreadId integer, MyValue integer)";
        else
          cmd.CommandText = "CREATE TABLE MultiThreadedTest(ID integer primary key, ThreadId integer, MyValue integer)";

        cmd.ExecuteNonQuery();
      }

      System.Threading.ManualResetEvent[] events = new System.Threading.ManualResetEvent[NumThreads];
      MTTest[] arr = new MTTest[NumThreads];

      for (int n = 0; n < arr.Length; n++)
      {
        arr[n] = new MTTest();
        arr[n].t = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(MultithreadedTestThread));
        arr[n].t.IsBackground = true;
        arr[n].cnn = ((ICloneable)_cnn).Clone() as DbConnection;
        arr[n].ev = events[n] = new System.Threading.ManualResetEvent(false);
        arr[n].t.Start(arr[n]);
      }

      System.Threading.WaitHandle.WaitAll(events, ThreadTimeout);

      int timeout = ThreadTimeout / arr.Length;
      bool failed = false;
      Exception e = null;

      for (int n = 0; n < arr.Length; n++)
      {
        if (!arr[n].t.Join(timeout))
        {
          failed = true;
          arr[n].t.Abort();
          arr[n].t.Join();
        }
        if (arr[n].e != null) e = arr[n].e;
        arr[n].cnn.Dispose();
        arr[n].ev.Close();
      }
      if (failed) throw new Exception(String.Format("One or more threads deadlocked ({0}ms)", timeout));
      if (e != null) 
        throw e;
    }

    internal void MultithreadedTestThread(object obj)
    {
      MTTest test = obj as MTTest;

      if (test.cnn.State != ConnectionState.Open)
        test.cnn.Open();

      int start = Environment.TickCount;
      try
      {
        using (DbCommand cmd = test.cnn.CreateCommand())
        {
          bool once = false;
          while (!once || ((Environment.TickCount - start) < 2000))
          {
            using (DbTransaction trans = test.cnn.BeginTransaction())
            {
              cmd.CommandText = String.Format("SELECT * FROM MultiThreadedTest WHERE ThreadId = {0}", test.t.ManagedThreadId);
              cmd.Transaction = trans;
              using (DbDataReader reader = cmd.ExecuteReader())
              {
                while (reader.Read())
                {
                  test.value += Convert.ToInt32(reader[2]);
                }
              }
              cmd.CommandText = String.Format("INSERT INTO MultiThreadedTest(ThreadId, MyValue) VALUES({0}, {1})", test.t.ManagedThreadId, Environment.TickCount);
              cmd.ExecuteNonQuery();

              trans.Commit();
            }

            once = true;
          }
        }
      }
      catch (Exception e)
      {
        test.e = e;
      }
      finally
      {
        test.ev.Set();
      }
    }

    [Test]
    internal void ParameterizedInsert()
    {
      using (DbCommand cmd = _cnn.CreateCommand())
      {
1467
1468
1469
1470
1471
1472
1473


































































































1474
1475
1476
1477
1478
1479
1480
            cmd.Transaction = trans;
            cmd.CommandText = "CREATE TABLE PoolTest(ID int primary key)";
            cmd.ExecuteNonQuery();
          }
        }
      }
    }



































































































    /// <summary>
    /// Open a reader and then attempt to write to test the writer's command timeout property
    /// SQLite doesn't allow a write when a reader is active.
    /// *** NOTE AS OF 3.3.8 this test no longer blocks because SQLite now allows you to update table(s)
    /// while a reader is active on the same connection.  Therefore the timeout test is invalid
    /// </summary>







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







1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
            cmd.Transaction = trans;
            cmd.CommandText = "CREATE TABLE PoolTest(ID int primary key)";
            cmd.ExecuteNonQuery();
          }
        }
      }
    }

    /// <summary>
    /// Checks to make sure we can open DB read only.
    /// </summary>
    [Test]
    internal void ReadOnlyTest()
    {
      string RO_connectionString = _cnnstring.ConnectionString;
      object value;
      if (_cnnstring.TryGetValue("Read Only", out value) == false)
      {
        throw new Exception("Read Only not supported by connection string");
      }
      if ((bool)value == false)
      {
        // "Read Only" not present in connection string - add it
        RO_connectionString += ";Read Only=true";
      }

      maydroptable.Add("ReadOnlyTest");

      using (DbConnection newcnn = ((ICloneable)_cnn).Clone() as DbConnection)
      {
        if (newcnn.State == ConnectionState.Open) 
        {
          newcnn.Close();
        }
        newcnn.ConnectionString = RO_connectionString;
        newcnn.Open();
        newcnn.Dispose();
      } 
    }

    /// <summary>
    /// Checks to extended error code result support.
    /// </summary>
    [Test]
    internal void ExtendedResultCodesTest()
    {
      if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) > -1)
      {
        SQLiteConnection cnn = new SQLiteConnection(_cnnstring.ConnectionString);

        cnn.Open();

        // Turn on extended result codes
        cnn.SetExtendedResultCodes(true);

        SQLiteErrorCode rc = cnn.ResultCode();
        SQLiteErrorCode xrc = cnn.ExtendedResultCode();

        cnn.Close();
      }
    }

#if !USE_INTEROP_DLL || !INTEROP_LOG
    //Logging EventHandler
    public void OnLogEvent(object sender, LogEventArgs logEvent)
    {
        object errorCode = logEvent.ErrorCode;
        string err_msg = logEvent.Message;
        logevents++;
    }

    /// <summary>
    /// Tests SQLITE_CONFIG_LOG support.
    /// </summary>
    [Test]
    internal void SetLogCallbackTest()
    {
        if (_fact.GetType().Name.IndexOf("SQLite", StringComparison.OrdinalIgnoreCase) > -1)
        {
            SQLiteConnection cnn = new SQLiteConnection(_cnnstring.ConnectionString);

            // create and add a log event handler
            SQLiteLogEventHandler logHandler = new SQLiteLogEventHandler(OnLogEvent);
            SQLiteFactory sqlite_fact = (SQLiteFactory)_fact;

            sqlite_fact.Log += logHandler;

            cnn.Open();

            logevents = 0;

            cnn.LogMessage(SQLiteErrorCode.Error, "test log event");

            if (logevents != 1)
                throw new Exception(String.Format(
                    "Log event count {0} incorrect.", logevents));

            cnn.Close();

            // remove the log handler before the connection is closed.
            sqlite_fact.Log -= logHandler;

        }
    }
#endif

    /// <summary>
    /// Open a reader and then attempt to write to test the writer's command timeout property
    /// SQLite doesn't allow a write when a reader is active.
    /// *** NOTE AS OF 3.3.8 this test no longer blocks because SQLite now allows you to update table(s)
    /// while a reader is active on the same connection.  Therefore the timeout test is invalid
    /// </summary>
1766
1767
1768
1769
1770
1771
1772














































1773
1774
1775
1776
1777
1778
1779
        {
          reader.Read();
          decimal d = (decimal)reader.GetValue(0);
          d = reader.GetDecimal(0);
        }
      }
    }















































    [Test(Sequence = 30)]
    internal void VerifyInsert()
    {
      using (DbCommand cmd = _cnn.CreateCommand())
      {
        cmd.CommandText = "SELECT Field1, Field2, [Fiëld3], [Fiæld4], Field5 FROM TestCase";







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







1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
        {
          reader.Read();
          decimal d = (decimal)reader.GetValue(0);
          d = reader.GetDecimal(0);
        }
      }
    }

    [Test(Sequence = 98)]
    internal void ScalarPreTest()
    {
      using (DbCommand cmd = _cnn.CreateCommand())
      {
        droptables.Add("SCALARTEST");

        cmd.CommandText = "CREATE TABLE SCALARTEST(x INTEGER PRIMARY KEY, y)";
        cmd.ExecuteNonQuery();

        for (int i = 1; i <= 1000; i++)
        {
          DbParameter param1 = cmd.CreateParameter();

          param1.ParameterName = "param1";
          param1.DbType = DbType.Int32;
          param1.Value = i;

          DbParameter param2 = cmd.CreateParameter();

          param2.ParameterName = "param2";
          param2.DbType = DbType.Int32;
          param2.Value = i;

          cmd.CommandText =
              "INSERT OR REPLACE INTO SCALARTEST(x, y) VALUES(?, ?)";

          cmd.Parameters.Clear();
          cmd.Parameters.Add(param1);
          cmd.Parameters.Add(param2);

          cmd.ExecuteNonQuery();
        }
      }
    }

    [Test(Sequence = 99)]
    internal void ScalarTest()
    {
      using (DbCommand cmd = _cnn.CreateCommand())
      {
        cmd.CommandText = "SELECT x FROM SCALARTEST ORDER BY x";
        cmd.ExecuteScalar();
      }
    }

    [Test(Sequence = 30)]
    internal void VerifyInsert()
    {
      using (DbCommand cmd = _cnn.CreateCommand())
      {
        cmd.CommandText = "SELECT Field1, Field2, [Fiëld3], [Fiæld4], Field5 FROM TestCase";
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
  internal enum TestResultEnum
  {
    Succeeded = 0,
    Failed = 1,
    Inconclusive = 2,
  }

  internal class InconclusiveException : Exception
  {
    internal InconclusiveException()
      : base()
    {
    }

    internal InconclusiveException(string message)







|







2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
  internal enum TestResultEnum
  {
    Succeeded = 0,
    Failed = 1,
    Inconclusive = 2,
  }

  internal sealed class InconclusiveException : Exception
  {
    internal InconclusiveException()
      : base()
    {
    }

    internal InconclusiveException(string message)

Changes to test/TestCasesDialog.Designer.cs.








1
2
3
4
5
6
7







namespace test
{
  partial class TestCasesDialog
  {
    /// <summary>
    /// Required designer variable.
    /// </summary>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace test
{
  partial class TestCasesDialog
  {
    /// <summary>
    /// Required designer variable.
    /// </summary>

Changes to test/TestCasesDialog.cs.








1
2
3
4
5
6
7
8
9
10
11
12
13












14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

38
39
40
41
42
43
44












































45
46
47
48
49
50
51
52
53
54
55

56



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76






















77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92


93
94
95
96
97
98
99







using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.Common;

namespace test
{
  public partial class TestCasesDialog : Form
  {












    private TestCases _test;
    private TestCases _testitems;

    public TestCasesDialog()
    {
      InitializeComponent();

      using (DataTable tbl = DbProviderFactories.GetFactoryClasses())
      {
        foreach (DataRow row in tbl.Rows)
        {
          string prov = row[2].ToString();

          if (prov.IndexOf("SQLite", 0, StringComparison.OrdinalIgnoreCase) != -1
            || prov.IndexOf("SqlClient", 0, StringComparison.OrdinalIgnoreCase) != -1
            )
            _provider.Items.Add(prov);
          if (prov == "System.Data.SQLite") _provider.SelectedItem = prov;
        }
      }
      _connectionString.Items.Add("Data Source=Test.db3;Pooling=true;FailIfMissing=false");
      _connectionString.Items.Add("Data Source=(local);Initial Catalog=sqlite;Integrated Security=True;Max Pool Size=10");
      _connectionString.SelectedIndex = 0;


      _testitems = new TestCases();
      foreach (KeyValuePair<string, bool> pair in _testitems.Tests)
      {
        ToolStripMenuItem item = (ToolStripMenuItem)testMenu.DropDownItems.Add(pair.Key, null, new EventHandler(_tests_Clicked));
        item.Checked = true;
        item.CheckOnClick = true;
      }












































    }

    void _tests_Clicked(object sender, EventArgs e)
    {
      ToolStripMenuItem item = sender as ToolStripMenuItem;
      if (item != null)
        _testitems.Tests[item.Text] = item.Checked;
    }

    private void runButton_Click(object sender, EventArgs e)
    {

      DbProviderFactory factory = DbProviderFactories.GetFactory(_provider.SelectedItem.ToString());



      _test = new TestCases(factory, _connectionString.Text);
      _test.Tests = _testitems.Tests;

      _test.OnTestStarting += new TestStartingEvent(_test_OnTestStarting);
      _test.OnTestFinished += new TestCompletedEvent(_test_OnTestFinished);
      _test.OnAllTestsDone += new EventHandler(_test_OnAllTestsDone);
      _grid.Rows.Clear();
      runButton.Enabled = false;

      System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(_threadFunc));
      t.IsBackground = true;
      t.Start();
    }

    void _test_OnAllTestsDone(object sender, EventArgs e)
    {
      if (InvokeRequired)
        Invoke(new EventHandler(_test_OnAllTestsDone), sender, e);
      else
        runButton.Enabled = true;






















    }

    void _threadFunc()
    {
      _test.Run();
    }

    void _test_OnTestFinished(object sender, TestEventArgs args)
    {
      if (InvokeRequired)
        Invoke(new TestCompletedEvent(_test_OnTestFinished), sender, args);
      else
      {
        _grid.Rows[_grid.Rows.Count - 1].SetValues(args.TestName, args.Result, args.Duration, (args.Exception == null) ? args.Message : args.Exception.Message);
        if (args.Result == TestResultEnum.Failed)
        {


          _grid.Rows[_grid.Rows.Count - 1].Cells[1].Style.BackColor = Color.Red;
        }
        else if (args.Result == TestResultEnum.Inconclusive)
        {
          _grid.Rows[_grid.Rows.Count - 1].Cells[1].Style.BackColor = Color.LightBlue;
        }
        //_grid.Rows[_grid.Rows.Count - 1].Height = _grid.Rows[_grid.Rows.Count - 1].GetPreferredHeight(_grid.Rows.Count - 1, DataGridViewAutoSizeRowMode.AllCells, true);
>
>
>
>
>
>
>


<










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



|
















|



>







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











>
|
>
>
>




















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
















>
>







1
2
3
4
5
6
7
8
9

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System;
using System.Collections.Generic;

using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.Common;

namespace test
{
  public partial class TestCasesDialog : Form
  {
    private delegate void DelegateWithNoArgs();

    /// <summary>
    /// The total number of tests that have failed during the previous test run.
    /// </summary>
    private int _failed;

    /// <summary>
    /// If set, then automatically run all the tests and exit.
    /// </summary>
    private bool _autoRun;

    private TestCases _test;
    private TestCases _testitems;

    public TestCasesDialog(string fileName, bool autoRun)
    {
      InitializeComponent();

      using (DataTable tbl = DbProviderFactories.GetFactoryClasses())
      {
        foreach (DataRow row in tbl.Rows)
        {
          string prov = row[2].ToString();

          if (prov.IndexOf("SQLite", 0, StringComparison.OrdinalIgnoreCase) != -1
            || prov.IndexOf("SqlClient", 0, StringComparison.OrdinalIgnoreCase) != -1
            )
            _provider.Items.Add(prov);
          if (prov == "System.Data.SQLite") _provider.SelectedItem = prov;
        }
      }
      _connectionString.Items.Add(String.Format("Data Source={0};Pooling=true;FailIfMissing=false", fileName));
      _connectionString.Items.Add("Data Source=(local);Initial Catalog=sqlite;Integrated Security=True;Max Pool Size=10");
      _connectionString.SelectedIndex = 0;

      _autoRun = autoRun;
      _testitems = new TestCases();
      foreach (KeyValuePair<string, bool> pair in _testitems.Tests)
      {
        ToolStripMenuItem item = (ToolStripMenuItem)testMenu.DropDownItems.Add(pair.Key, null, new EventHandler(_tests_Clicked));
        item.Checked = true;
        item.CheckOnClick = true;
      }

      this.Shown += new EventHandler(TestCasesDialog_Shown);
      this.FormClosing += new FormClosingEventHandler(TestCasesDialog_FormClosing);
    }

    private void TestCasesDialog_FormClosing(
        object sender,
        FormClosingEventArgs e
        )
    {
        if (_autoRun && (e.CloseReason == CloseReason.UserClosing))
            e.Cancel = true;
    }

    private StringBuilder GridToText()
    {
        StringBuilder result = new StringBuilder();

        foreach (DataGridViewRow row in _grid.Rows)
        {
            if (result.Length > 0)
                result.Append(Environment.NewLine);

            result.AppendFormat("{0}\t{1}\t{2}\t{3}", row.Cells[0].Value,
                row.Cells[1].Value, row.Cells[2].Value, row.Cells[3].Value);
        }

        return result;
    }

    void TestCasesDialog_Shown(object sender, EventArgs e)
    {
        //
        // NOTE: In "automatic" mode, run all the tests as soon as the form is
        //       fully loaded.
        //
        if (_autoRun)
        {
            BeginInvoke(new DelegateWithNoArgs(delegate()
            {
                Hide();
                runButton_Click(sender, e);
            }));
        }
    }

    void _tests_Clicked(object sender, EventArgs e)
    {
      ToolStripMenuItem item = sender as ToolStripMenuItem;
      if (item != null)
        _testitems.Tests[item.Text] = item.Checked;
    }

    private void runButton_Click(object sender, EventArgs e)
    {
      string factoryString = _provider.SelectedItem.ToString();
      DbProviderFactory factory = DbProviderFactories.GetFactory(factoryString);

      _failed = 0;

      _test = new TestCases(factory, _connectionString.Text);
      _test.Tests = _testitems.Tests;

      _test.OnTestStarting += new TestStartingEvent(_test_OnTestStarting);
      _test.OnTestFinished += new TestCompletedEvent(_test_OnTestFinished);
      _test.OnAllTestsDone += new EventHandler(_test_OnAllTestsDone);
      _grid.Rows.Clear();
      runButton.Enabled = false;

      System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(_threadFunc));
      t.IsBackground = true;
      t.Start();
    }

    void _test_OnAllTestsDone(object sender, EventArgs e)
    {
      if (InvokeRequired)
        Invoke(new EventHandler(_test_OnAllTestsDone), sender, e);
      else
        runButton.Enabled = true;

      //
      // NOTE: In "automatic" mode, check if any of the tests failed and return
      //       the appropriate error code to the operating system as we exit
      //       the process.  Also, attempt to write the entire contents of the
      //       test grid to the standard output channel via the console.  This
      //       may fail if we have no console; however, the failure will simply
      //       be ignored.
      //
      if (_autoRun)
      {
          try
          {
              Console.Write("{0}", GridToText());
          }
          catch
          {
              // do nothing, ignored.
          }

          Environment.Exit(_failed != 0 ? 1 : 0);
      }
    }

    void _threadFunc()
    {
      _test.Run();
    }

    void _test_OnTestFinished(object sender, TestEventArgs args)
    {
      if (InvokeRequired)
        Invoke(new TestCompletedEvent(_test_OnTestFinished), sender, args);
      else
      {
        _grid.Rows[_grid.Rows.Count - 1].SetValues(args.TestName, args.Result, args.Duration, (args.Exception == null) ? args.Message : args.Exception.Message);
        if (args.Result == TestResultEnum.Failed)
        {
          _failed++;

          _grid.Rows[_grid.Rows.Count - 1].Cells[1].Style.BackColor = Color.Red;
        }
        else if (args.Result == TestResultEnum.Inconclusive)
        {
          _grid.Rows[_grid.Rows.Count - 1].Cells[1].Style.BackColor = Color.LightBlue;
        }
        //_grid.Rows[_grid.Rows.Count - 1].Height = _grid.Rows[_grid.Rows.Count - 1].GetPreferredHeight(_grid.Rows.Count - 1, DataGridViewAutoSizeRowMode.AllCells, true);
109
110
111
112
113
114
115














116
117
118
119
        _grid.Rows.Add(args.TestName, "Starting", null, null);
        _grid.FirstDisplayedScrollingRowIndex = _grid.Rows.Count - 1;
      }
    }

    private void closeButton_Click(object sender, EventArgs e)
    {














      Close();
    }
  }
}







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




200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
        _grid.Rows.Add(args.TestName, "Starting", null, null);
        _grid.FirstDisplayedScrollingRowIndex = _grid.Rows.Count - 1;
      }
    }

    private void closeButton_Click(object sender, EventArgs e)
    {
      if (_autoRun)
      {
        try
        {
          Console.Write("canceled...");
        }
        catch
        {
          // do nothing, ignored.
        }

        Environment.Exit(2);
      }

      Close();
    }
  }
}

Changes to test/app.config.

1
2
3
4
5
6
7
8
<configuration>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite"/>
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".Net Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
    </DbProviderFactories>
  </system.data>
</configuration>



|
|



1
2
3
4
5
6
7
8
<configuration>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite" />
      <add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </DbProviderFactories>
  </system.data>
</configuration>

Added test/test.2005.csproj.













































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * test.2005.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace>test</RootNamespace>
    <AssemblyName>test</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx20>true</NetFx20>
    <ConfigurationYear>2005</ConfigurationYear>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.2005.csproj">
      <Project>{AC139952-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.2005</Name>
      <Private>False</Private>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Transactions" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Program.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="TestCases.cs" />
    <Compile Include="TestCasesDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="TestCasesDialog.Designer.cs">
      <DependentUpon>TestCasesDialog.cs</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <EmbeddedResource Include="TestCasesDialog.resx">
      <DependentUpon>TestCasesDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="app.config" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CloneAndMark32BitOnlyFrameworkTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added test/test.2008.csproj.















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * test.2008.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace>test</RootNamespace>
    <AssemblyName>test</AssemblyName>
    <OldToolsVersion>2.0</OldToolsVersion>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx35>true</NetFx35>
    <ConfigurationYear>2008</ConfigurationYear>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.2008.csproj">
      <Project>{AC139952-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.2008</Name>
      <Private>False</Private>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Transactions" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Program.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="TestCases.cs" />
    <Compile Include="TestCasesDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="TestCasesDialog.Designer.cs">
      <DependentUpon>TestCasesDialog.cs</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <EmbeddedResource Include="TestCasesDialog.resx">
      <DependentUpon>TestCasesDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="app.config" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CloneAndMark32BitOnlyFrameworkTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added test/test.2010.csproj.



















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * test.2010.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>10.0.30319</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace>test</RootNamespace>
    <AssemblyName>test</AssemblyName>
    <OldToolsVersion>3.5</OldToolsVersion>
    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx40>true</NetFx40>
    <ConfigurationYear>2010</ConfigurationYear>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.2010.csproj">
      <Project>{AC139952-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.2010</Name>
      <Private>False</Private>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Transactions" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Program.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="TestCases.cs" />
    <Compile Include="TestCasesDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="TestCasesDialog.Designer.cs">
      <DependentUpon>TestCasesDialog.cs</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <EmbeddedResource Include="TestCasesDialog.resx">
      <DependentUpon>TestCasesDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="app.config" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CloneAndMark32BitOnlyFrameworkTargetName32;
      CloneAndMark32BitOnlySdkToolsTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added test/test.2012.csproj.

















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * test.2012.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace>test</RootNamespace>
    <AssemblyName>test</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx45>true</NetFx45>
    <ConfigurationYear>2012</ConfigurationYear>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.2012.csproj">
      <Project>{AC139952-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.2012</Name>
      <Private>False</Private>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Transactions" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Program.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="TestCases.cs" />
    <Compile Include="TestCasesDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="TestCasesDialog.Designer.cs">
      <DependentUpon>TestCasesDialog.cs</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <EmbeddedResource Include="TestCasesDialog.resx">
      <DependentUpon>TestCasesDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="app.config" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CloneAndMark32BitOnlyFrameworkTargetName32;
      CloneAndMark32BitOnlySdkToolsTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added test/test.2013.csproj.

















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * test.2013.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace>test</RootNamespace>
    <AssemblyName>test</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx451>true</NetFx451>
    <ConfigurationYear>2013</ConfigurationYear>
    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.2013.csproj">
      <Project>{AC139952-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.2013</Name>
      <Private>False</Private>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Transactions" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Program.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="TestCases.cs" />
    <Compile Include="TestCasesDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="TestCasesDialog.Designer.cs">
      <DependentUpon>TestCasesDialog.cs</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <EmbeddedResource Include="TestCasesDialog.resx">
      <DependentUpon>TestCasesDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="app.config" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CloneAndMark32BitOnlyFrameworkTargetName32;
      CloneAndMark32BitOnlySdkToolsTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added test/test.2015.csproj.

















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * test.2015.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace>test</RootNamespace>
    <AssemblyName>test</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx46>true</NetFx46>
    <ConfigurationYear>2015</ConfigurationYear>
    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.2015.csproj">
      <Project>{AC139952-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.2015</Name>
      <Private>False</Private>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Transactions" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Program.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="TestCases.cs" />
    <Compile Include="TestCasesDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="TestCasesDialog.Designer.cs">
      <DependentUpon>TestCasesDialog.cs</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <EmbeddedResource Include="TestCasesDialog.resx">
      <DependentUpon>TestCasesDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="app.config" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CloneAndMark32BitOnlyFrameworkTargetName32;
      CloneAndMark32BitOnlySdkToolsTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added test/test.2017.csproj.

















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * test.2017.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace>test</RootNamespace>
    <AssemblyName>test</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx47>true</NetFx47>
    <ConfigurationYear>2017</ConfigurationYear>
    <TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.2017.csproj">
      <Project>{AC139952-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.2017</Name>
      <Private>False</Private>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Transactions" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Program.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="TestCases.cs" />
    <Compile Include="TestCasesDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="TestCasesDialog.Designer.cs">
      <DependentUpon>TestCasesDialog.cs</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <EmbeddedResource Include="TestCasesDialog.resx">
      <DependentUpon>TestCasesDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="app.config" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CloneAndMark32BitOnlyFrameworkTargetName32;
      CloneAndMark32BitOnlySdkToolsTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Deleted test/test.csproj.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
    <OutputPath>..\bin\x64\</OutputPath>
    <Optimize>true</Optimize>
    <FileAlignment>512</FileAlignment>
    <DebugType>
    </DebugType>
    <PlatformTarget>x64</PlatformTarget>
    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
    <UseVSHostingProcess>false</UseVSHostingProcess>
    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>..\bin\x64\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <DebugType>full</DebugType>
    <PlatformTarget>x64</PlatformTarget>
    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
    <OutputPath>..\bin\</OutputPath>
    <Optimize>true</Optimize>
    <FileAlignment>512</FileAlignment>
    <DebugType>
    </DebugType>
    <PlatformTarget>x86</PlatformTarget>
    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
    <UseVSHostingProcess>false</UseVSHostingProcess>
    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|Itanium' ">
    <OutputPath>..\bin\Itanium\</OutputPath>
    <Optimize>true</Optimize>
    <FileAlignment>512</FileAlignment>
    <DebugType>
    </DebugType>
    <PlatformTarget>Itanium</PlatformTarget>
    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
    <UseVSHostingProcess>false</UseVSHostingProcess>
    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|Itanium' ">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>..\bin\Itanium\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <DebugType>full</DebugType>
    <PlatformTarget>Itanium</PlatformTarget>
    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
  </PropertyGroup>
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{E27B1B1E-19C0-45E8-AA74-B6E1C041A130}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <RootNamespace>test</RootNamespace>
    <AssemblyName>test</AssemblyName>
    <WarningLevel>4</WarningLevel>
    <IsWebBootstrapper>true</IsWebBootstrapper>
    <PublishUrl>http://localhost/test</PublishUrl>
    <Install>true</Install>
    <InstallFrom>Web</InstallFrom>
    <UpdateEnabled>true</UpdateEnabled>
    <UpdateMode>Foreground</UpdateMode>
    <UpdateInterval>7</UpdateInterval>
    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
    <UpdatePeriodically>false</UpdatePeriodically>
    <UpdateRequired>false</UpdateRequired>
    <MapFileExtensions>false</MapFileExtensions>
    <ApplicationVersion>1.0.0.*</ApplicationVersion>
    <BootstrapperEnabled>true</BootstrapperEnabled>
    <FileUpgradeFlags>
    </FileUpgradeFlags>
    <OldToolsVersion>2.0</OldToolsVersion>
    <UpgradeBackupLocation>
    </UpgradeBackupLocation>
    <StartupObject>
    </StartupObject>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>..\bin\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <PlatformTarget>x86</PlatformTarget>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>none</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>..\bin\ManagedOnly\</OutputPath>
    <DefineConstants>
    </DefineConstants>
    <PlatformTarget>x86</PlatformTarget>
    <FileAlignment>512</FileAlignment>
    <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
    <UseVSHostingProcess>false</UseVSHostingProcess>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
    <DebugSymbols>true</DebugSymbols>
    <OutputPath>..\bin\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <DebugType>full</DebugType>
    <PlatformTarget>x86</PlatformTarget>
    <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
    <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
    <UseVSHostingProcess>false</UseVSHostingProcess>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Data.SQLite, Version=1.0.55.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86">
      <SpecificVersion>False</SpecificVersion>
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Drawing" />
    <Reference Include="System.Transactions" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <None Include="app.config" />
    <Compile Include="Program.cs" />
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <Compile Include="TestCases.cs" />
    <Compile Include="TestCasesDialog.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="TestCasesDialog.Designer.cs">
      <DependentUpon>TestCasesDialog.cs</DependentUpon>
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <BootstrapperFile Include="Microsoft.Net.Framework.2.0">
      <InProject>False</InProject>
      <ProductName>.NET Framework 2.0</ProductName>
      <Install>true</Install>
    </BootstrapperFile>
  </ItemGroup>
  <ItemGroup>
    <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
      <InProject>False</InProject>
      <ProductName>.NET Framework 2.0 Beta</ProductName>
      <Install>true</Install>
    </BootstrapperPackage>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
    <EmbeddedResource Include="TestCasesDialog.resx">
      <DependentUpon>TestCasesDialog.cs</DependentUpon>
    </EmbeddedResource>
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


















































































































































































































































































































































Changes to testce/AssemblyInfo.cs.








1
2
3
4
5
6
7
8
9
10
11
12
13


14

15

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33







using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("cetest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("cetest")]
[assembly: AssemblyCopyright("Copyright ©  2005")]


[assembly: AssemblyTrademark("")]

[assembly: AssemblyCulture("")]


// Setting ComVisible to false makes the types in this assembly not visible 
// to COM componenets.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("308969a2-e089-42db-afe3-bf564d8d62c3")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
[assembly: AssemblyVersion("1.0.0.*")]

>
>
>
>
>
>
>

<





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
















|
|
1
2
3
4
5
6
7
8

9
10
11
12
13
14
15

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System.Reflection;

using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("System.Data.SQLite Tester for Windows CE")]
[assembly: AssemblyDescription("ADO.NET Data Provider for SQLite")]

[assembly: AssemblyCompany("https://system.data.sqlite.org/")]
[assembly: AssemblyProduct("System.Data.SQLite")]
[assembly: AssemblyCopyright("Public Domain")]

#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM componenets.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("308969a2-e089-42db-afe3-bf564d8d62c3")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
[assembly: AssemblyVersion("1.0.119.0")]
// [assembly: AssemblyFileVersion("1.0.119.0")]

Changes to testce/Form1.Designer.cs.








1
2
3
4
5
6
7







namespace test
{
	partial class Form1
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace test
{
	partial class Form1
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>

Changes to testce/Form1.cs.

1

2
3



4
5
6
7
8
9
10
11
12
13
using System;

using System.Collections.Generic;
using System.ComponentModel;



using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace test
{
	public partial class Form1 : Form
	{
		public Form1()
<
>
|
|
>
>
>
|
|
<








1
2
3
4
5
6
7
8

9
10
11
12
13
14
15

/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System;

using System.Windows.Forms;

namespace test
{
	public partial class Form1 : Form
	{
		public Form1()

Changes to testce/Program.cs.








1
2
3
4
5

6
7
8
9
10















































































































11








12

13



14








15
16
17
18
19
20
21
22
23
24





25
26
27
28
29
30



31
32
33
34

35

36
37

38
39


40
41
42
43
44
45



46
47
48
49
50
51
52

53
54
55







using System;
using System.Data;
using System.Text;
using System.Data.Common;
using System.Data.SQLite;


namespace test
{
  class Program
  {















































































































    [MTAThread]








    static void Main()

    {



      DbConnection cnn;









      SQLiteFunction.RegisterFunction(typeof(TestFunc));
      SQLiteFunction.RegisterFunction(typeof(MyCount));
      SQLiteFunction.RegisterFunction(typeof(MySequence));

      try
      {
        System.IO.File.Delete("test.db3");
      }
      catch





      {
      }

      //SQLiteConnection sqlite_con = new SQLiteConnection(@"data source=""|DataDirectory|donnees.db""");

      //SQLiteDataAdapter sqlite_da = new SQLiteDataAdapter();



      //DataSet dataSet = new DataSet();

      //sqlite_da.SelectCommand = new SQLiteCommand("select * from donnees", sqlite_con);





      //sqlite_con.Open();


      //sqlite_da.Fill(dataSet);



      //sqlite_con.Close();

      using (cnn = new SQLiteConnection())
      {
        TestCases tests = new TestCases();




        cnn.ConnectionString = "Data Source=test.db3;Password=yVXL39etehPX";
        cnn.Open();
        tests.Run(cnn);

        System.Windows.Forms.Application.Run(tests.frm);
      }

    }
  }
}
>
>
>
>
>
>
>

|
|
|
|
>



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

|
|
|

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

<
|
>

>

<
>

<
>
>

|

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162

163
164
165
166
167
168

169
170
171

172
173
174
175
176

177
178
179
180
181

182
183

184
185
186
187
188
189
190
191
192
193
194
195



196

197
198
199
200
201
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System;
using System.Data.Common;
using System.Data.SQLite;
using System.IO;
using System.Reflection;
using System.Windows.Forms;

namespace test
{
    class Program
    {
        private static readonly string DefaultConnectionString =
            "Data Source={DataDirectory}\\test.db;Password=yVXL39etehPX;";

        ///////////////////////////////////////////////////////////////////////

        private static string GetConnectionString(
            string directory
            )
        {
            string connectionString = DefaultConnectionString;

            try
            {
                //
                // NOTE: Attempt to open the configuration file associated with
                //       this test executable.  It should contain *EXACTLY* one
                //       line, which will be the connection string to use for
                //       this test run.
                //
                using (StreamReader streamReader = File.OpenText(Path.Combine(
                        directory, "test.cfg")))
                {
                    connectionString = streamReader.ReadToEnd().Trim();
                }
            }
            catch
            {
                // do nothing.
            }

            return connectionString;
        }

        ///////////////////////////////////////////////////////////////////////

        private static string GetInitializationSQL(
            string directory
            )
        {
            string sql = null;

            try
            {
                //
                // NOTE: Attempt to open the SQL file associated with this test
                //       executable.  If present, it can contain SQL statements
                //       to be executed against the new connection prior to the
                //       tests running.
                //
                using (StreamReader streamReader = File.OpenText(Path.Combine(
                        directory, "test.sql")))
                {
                    sql = streamReader.ReadToEnd().Trim();
                }
            }
            catch
            {
                // do nothing.
            }

            return sql;
        }

        ///////////////////////////////////////////////////////////////////////

        internal static void ExecuteInitializationSQL(
            DbConnection connection,
            string sql,
            bool isolated
            )
        {
            if (!String.IsNullOrEmpty(sql))
            {
                if (isolated)
                {
                    using (DbConnection newConnection = NewConnection())
                    {
                        using (DbCommand command = newConnection.CreateCommand())
                        {
                            command.CommandText = sql;

                            /* IGNORED */
                            command.ExecuteNonQuery(); /* throw */
                        }
                    }
                }
                else
                {
                    if (connection == null)
                        return;

                    using (DbCommand command = connection.CreateCommand())
                    {
                        command.CommandText = sql;

                        /* IGNORED */
                        command.ExecuteNonQuery(); /* throw */
                    }
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        internal static DbConnection NewConnection()
        {
            return new SQLiteConnection();
        }

        ///////////////////////////////////////////////////////////////////////

        [MTAThread]
        static int Main(string[] args)
        {
            bool autoClose = false;
            bool isolatedSql = false;
            int exitCode = 2; /* INCOMPLETE */
            Assembly assembly = Assembly.GetExecutingAssembly();
            AssemblyName assemblyName = assembly.GetName();
            string directory = Path.GetDirectoryName(assemblyName.CodeBase);

            if (args.Length > 0)
            {
                try { autoClose = bool.Parse(args[0]); }
                catch { }
            }

            if (args.Length > 1)
            {
                try { isolatedSql = bool.Parse(args[1]); }
                catch { }
            }

            try { File.Delete(directory + "\\test.db"); }
            catch { }

            SQLiteFunction.RegisterFunction(typeof(TestFunc));
            SQLiteFunction.RegisterFunction(typeof(MyCount));
            SQLiteFunction.RegisterFunction(typeof(MySequence));

            using (DbConnection cnn = NewConnection())
            {
                string connectionString = GetConnectionString(directory);


                //
                // NOTE: If we are unable to obtain a valid connection string
                //       bail out now.
                //
                if (connectionString != null)
                {

                    //
                    // NOTE: Replace the "{DataDirectory}" token, if any, in
                    //       the connection string with the actual directory

                    //       this test assembly is executing from.
                    //
                    connectionString = connectionString.Replace(
                      "{DataDirectory}", directory);


                    cnn.ConnectionString = connectionString;
                    cnn.Open();

                    string sql = GetInitializationSQL(directory);


                    ExecuteInitializationSQL(cnn, sql, isolatedSql);


                    TestCases tests = new TestCases(
                        connectionString, cnn, sql, autoClose, isolatedSql);

                    tests.Run();

                    Application.Run(tests.frm);

                    if (tests.Succeeded())
                        exitCode = 0; /* SUCCESS */
                    else
                        exitCode = 1; /* FAILURE */
                }



            }


            return exitCode;
        }
    }
}

Changes to testce/TestCases.cs.








1

2
3
4

5
6
7
8
9
10
11
12
13
14
15
16
17







using System;

using System.Data.Common;
using System.Data;
using System.Data.SQLite;


namespace test
{

  /// <summary>
  /// Scalar user-defined function.  In this example, the same class is declared twice with 
  /// different function names to demonstrate how to use alias names for user-defined functions.
  /// </summary>
  [SQLiteFunction(Name = "Foo", Arguments = 2, FuncType = FunctionType.Scalar)]
  [SQLiteFunction(Name = "TestFunc", Arguments = 2, FuncType = FunctionType.Scalar)]
  class TestFunc : SQLiteFunction
  {
    public override object Invoke(object[] args)
>
>
>
>
>
>
>

>



>





|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data;
using System.Data.SQLite;
using System.Threading;

namespace test
{

  /// <summary>
  /// Scalar user-defined function.  In this example, the same class is declared twice with
  /// different function names to demonstrate how to use alias names for user-defined functions.
  /// </summary>
  [SQLiteFunction(Name = "Foo", Arguments = 2, FuncType = FunctionType.Scalar)]
  [SQLiteFunction(Name = "TestFunc", Arguments = 2, FuncType = FunctionType.Scalar)]
  class TestFunc : SQLiteFunction
  {
    public override object Invoke(object[] args)
58
59
60
61
62
63
64
65
66
67

68











69




70






71

72
























































































73
74







75













76
77
78

79
80
81

82
83
84

85
86
87

88
89
90

91
92
93

94
95
96

97
98
99

100
101
102

103
104

105

106
107
108

109
110
111

112
113
114

115
116
117

118

119







120

121
122
123

124

125



126


127


128



129

130
131
132

133
134
135
136











137
138
139
140
141
142
143
      // Make sure the string "Field3" is sorted out of order
      if (param1 == "Field3") return 1;
      if (param2 == "Field3") return -1;
      return String.Compare(param1, param2, true);
    }
  }

  internal class TestCases
  {
    internal Form1 frm;













    internal void Run(DbConnection cnn)




    {






      frm = new Form1();


























































































      frm.Show();








      frm.WriteLine("\r\nBeginning Test on " + cnn.GetType().ToString());













      try { CreateTable(cnn); frm.WriteLine("SUCCESS - CreateTable"); }
      catch (Exception) { frm.WriteLine("FAIL - CreateTable"); }


      try { DataTypeTest(cnn); frm.WriteLine("SUCCESS - DataType Test"); }
      catch (Exception) { frm.WriteLine("FAIL - DataType Test"); }


      try { FullTextTest(cnn); frm.WriteLine("SUCCESS - Full Text Search"); }
      catch (Exception) { frm.WriteLine("FAIL - Full Text Search"); }


      try { KeyInfoTest(cnn); frm.WriteLine("SUCCESS - KeyInfo Fetch"); }
      catch (Exception) { frm.WriteLine("FAIL - KeyInfo Fetch"); }


      try { InsertTable(cnn); frm.WriteLine("SUCCESS - InsertTable"); }
      catch (Exception) { frm.WriteLine("FAIL - InsertTable"); }


      try { VerifyInsert(cnn); frm.WriteLine("SUCCESS - VerifyInsert"); }
      catch (Exception) { frm.WriteLine("FAIL - VerifyInsert"); }


      try { CoersionTest(cnn); frm.WriteLine("FAIL - CoersionTest"); }
      catch (Exception) { frm.WriteLine("SUCCESS - CoersionTest"); }


      try { ParameterizedInsert(cnn); frm.WriteLine("SUCCESS - ParameterizedInsert"); }
      catch (Exception) { frm.WriteLine("FAIL - ParameterizedInsert"); }


      try { BinaryInsert(cnn); frm.WriteLine("SUCCESS - BinaryInsert"); }
      catch (Exception) { frm.WriteLine("FAIL - BinaryInsert"); }


      try { VerifyBinaryData(cnn); frm.WriteLine("SUCCESS - VerifyBinaryData"); }
      catch (Exception) { frm.WriteLine("FAIL - VerifyBinaryData"); }



      try { LockTest(cnn); frm.WriteLine("SUCCESS - LockTest"); }
      catch (Exception) { frm.WriteLine("FAIL - LockTest"); }


      try { ParameterizedInsertMissingParams(cnn); frm.WriteLine("FAIL - ParameterizedInsertMissingParams"); }
      catch (Exception) { frm.WriteLine("SUCCESS - ParameterizedInsertMissingParams"); }


      try { InsertMany(cnn, false); frm.WriteLine("SUCCESS - InsertMany"); }
      catch (Exception) { frm.WriteLine("FAIL - InsertMany"); }


      try { InsertMany(cnn, true); frm.WriteLine("SUCCESS - InsertManyWithIdentityFetch"); }
      catch (Exception) { frm.WriteLine("FAIL - InsertManyWithIdentityFetch"); }


      try { FastInsertMany(cnn); frm.WriteLine("SUCCESS - FastInsertMany"); }

      catch (Exception) { frm.WriteLine("FAIL - FastInsertMany"); }









      try { IterationTest(cnn); frm.WriteLine("SUCCESS - Iteration Test"); }
      catch (Exception) { frm.WriteLine("FAIL - Iteration Test"); }


      try { UserFunction(cnn); frm.WriteLine("SUCCESS - UserFunction"); }

      catch (Exception) { frm.WriteLine("FAIL - UserFunction"); }






      try { UserAggregate(cnn); frm.WriteLine("SUCCESS - UserAggregate"); }


      catch (Exception) { frm.WriteLine("FAIL - UserAggregate"); }





      try { UserCollation(cnn); frm.WriteLine("SUCCESS - UserCollation"); }
      catch (Exception) { frm.WriteLine("FAIL - UserCollation"); }


      try { DropTable(cnn); frm.WriteLine("SUCCESS - DropTable"); }
      catch (Exception) { frm.WriteLine("FAIL - DropTable"); }

      frm.WriteLine("\r\nTests Finished.");











    }

    internal static void KeyInfoTest(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        // First test against integer primary key (optimized) keyinfo fetch







|


>

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

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


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

>
|
|

>
|
|

>
|
|

>
|
|

>
|
|

>
|
|

>
|
|

>
|
|

>
|
<
>

>
|
|

>
|
|

>
|
|

>
|
|

>
|
>
|
>
>
>
>
>
>
>

>
|
|

>
|
>
|
>
>
>

>
>
|
>
>
|
>
>
>

>
|
|

>
|
|


>
>
>
>
>
>
>
>
>
>
>







67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252

253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
      // Make sure the string "Field3" is sorted out of order
      if (param1 == "Field3") return 1;
      if (param2 == "Field3") return -1;
      return String.Compare(param1, param2, true);
    }
  }

  internal sealed class TestCases
  {
    internal Form1 frm;
    internal IDictionary<string, long> statistics;

    private string connectionString;
    private DbConnection cnn;
    private string sql;
    private bool autoClose;
    private bool isolatedSql;
    private int total;
    private int passed;
    private int failed;

    internal TestCases(
        string connectionString,
        DbConnection cnn,
        string sql,
        bool autoExit,
        bool isolatedSql
        )
    {
        this.connectionString = connectionString;
        this.cnn = cnn;
        this.sql = sql;
        this.autoClose = autoExit;
        this.isolatedSql = isolatedSql;
    }

    internal bool Succeeded()
    {
        //
        // NOTE: Did all tests pass [without leaking any memory]?
        //
        long sqlBytes;

        return (failed == 0) && (passed == total) && ((statistics == null) ||
            !statistics.TryGetValue("MemoryUsed", out sqlBytes) || (sqlBytes == 0));
    }

    private static string FormatString(string value)
    {
        if (value == null)
            return "(null)";

        if (value.Length == 0)
            return "(empty)";

        if (value.Trim().Length == 0)
            return "(whitespace)";

        return value;
    }

    private void WriteMemoryStatistics(
        bool forceFullCollection
        )
    {
        long clrBytes = GC.GetTotalMemory(false);
        SQLiteConnection.GetMemoryStatistics(ref statistics);
        if (statistics != null) statistics["ClrUsedBefore"] = clrBytes;

        if (frm != null)
        {
            frm.WriteLine("\r\nMemory in use by the CLR before collection: " +
                clrBytes.ToString() + " bytes");

            if (statistics != null)
            {
                long sqlBytes;

                if (statistics.TryGetValue("MemoryUsed", out sqlBytes))
                {
                    frm.WriteLine("Current SQLite memory usage before collection: " +
                        sqlBytes.ToString() + " bytes");
                }

                if (statistics.TryGetValue("MemoryHighwater", out sqlBytes))
                {
                    frm.WriteLine("Maximum SQLite memory usage before collection: " +
                        sqlBytes.ToString() + " bytes");
                }
            }
        }

        if (forceFullCollection)
        {
            clrBytes = GC.GetTotalMemory(true);
            SQLiteConnection.GetMemoryStatistics(ref statistics);
            if (statistics != null) statistics["ClrUsedAfter"] = clrBytes;

            if (frm != null)
            {
                frm.WriteLine("\r\nMemory in use by the CLR after collection: " +
                    clrBytes.ToString() + " bytes");

                if (statistics != null)
                {
                    long sqlBytes;

                    if (statistics.TryGetValue("MemoryUsed", out sqlBytes))
                    {
                        frm.WriteLine("Current SQLite memory usage after collection: " +
                            sqlBytes.ToString() + " bytes");
                    }

                    if (statistics.TryGetValue("MemoryHighwater", out sqlBytes))
                    {
                        frm.WriteLine("Maximum SQLite memory usage after collection: " +
                            sqlBytes.ToString() + " bytes");
                    }
                }
            }
        }
    }

    internal void Run()
    {
      frm = new Form1();
      frm.Show();

      frm.WriteLine(String.Format("\r\nTest connection string:\r\n\r\n{0}",
          FormatString(connectionString)));

      frm.WriteLine(String.Format("\r\nTest initialization SQL:\r\n\r\n{0}",
          FormatString(sql)));

      Type type = cnn.GetType();
      frm.WriteLine("\r\nBeginning Test on " + type.ToString());

      SQLiteConnection cnn2 = cnn as SQLiteConnection;

      if (cnn2 != null)
      {
          frm.WriteLine("SQLite v" + SQLiteConnection.SQLiteVersion +
              " [" + SQLiteConnection.SQLiteSourceId + "]");

          WriteMemoryStatistics(false);
          frm.WriteLine(String.Empty);
      }

      total++;
      try { CreateTable(cnn); frm.WriteLine("SUCCESS - CreateTable"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - CreateTable: {0}", e)); failed++; }

      total++;
      try { DataTypeTest(cnn); frm.WriteLine("SUCCESS - DataType Test"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - DataType Test: {0}", e)); failed++; }

      total++;
      try { FullTextTest(cnn); frm.WriteLine("SUCCESS - Full Text Search"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - Full Text Search: {0}", e)); failed++; }

      total++;
      try { KeyInfoTest(cnn); frm.WriteLine("SUCCESS - KeyInfo Fetch"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - KeyInfo Fetch: {0}", e)); failed++; }

      total++;
      try { InsertTable(cnn); frm.WriteLine("SUCCESS - InsertTable"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - InsertTable: {0}", e)); failed++; }

      total++;
      try { VerifyInsert(cnn); frm.WriteLine("SUCCESS - VerifyInsert"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - VerifyInsert: {0}", e)); failed++; }

      total++;
      try { CoercionTest(cnn); frm.WriteLine("FAIL - CoercionTest"); failed++; }
      catch (Exception) { frm.WriteLine("SUCCESS - CoercionTest"); passed++; }

      total++;
      try { ParameterizedInsert(cnn); frm.WriteLine("SUCCESS - ParameterizedInsert"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - ParameterizedInsert: {0}", e)); failed++; }

      total++;
      try { BinaryInsert(cnn); frm.WriteLine("SUCCESS - BinaryInsert"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - BinaryInsert: {0}", e)); failed++; }

      total++;
      try { VerifyBinaryData(cnn); frm.WriteLine("SUCCESS - VerifyBinaryData"); passed++; }

      catch (Exception e) { frm.WriteLine(String.Format("FAIL - VerifyBinaryData: {0}", e)); failed++; }

      total++;
      try { LockTest(cnn, sql, isolatedSql); frm.WriteLine("SUCCESS - LockTest"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - LockTest: {0}", e)); failed++; }

      total++;
      try { ParameterizedInsertMissingParams(cnn); frm.WriteLine("FAIL - ParameterizedInsertMissingParams"); failed++; }
      catch (Exception) { frm.WriteLine("SUCCESS - ParameterizedInsertMissingParams"); passed++; }

      total++;
      try { InsertMany(cnn, false); frm.WriteLine("SUCCESS - InsertMany"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - InsertMany: {0}", e)); failed++; }

      total++;
      try { InsertMany(cnn, true); frm.WriteLine("SUCCESS - InsertManyWithIdentityFetch"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - InsertManyWithIdentityFetch: {0}", e)); failed++; }

      total++;
      try { FastInsertMany(cnn); frm.WriteLine("SUCCESS - FastInsertMany"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - FastInsertMany: {0}", e)); failed++; }

      total++;
      try { IterationTest(cnn); frm.WriteLine("SUCCESS - Iteration Test"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - Iteration Test: {0}", e)); failed++; }

      total++;
      try { UserFunction(cnn); frm.WriteLine("SUCCESS - UserFunction"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - UserFunction: {0}", e)); failed++; }

      total++;
      try { UserAggregate(cnn); frm.WriteLine("SUCCESS - UserAggregate"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - UserAggregate: {0}", e)); failed++; }

      total++;
      try { UserCollation(cnn); frm.WriteLine("SUCCESS - UserCollation"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - UserCollation: {0}", e)); failed++; }

      total++;
      try { Int64Properties(cnn); frm.WriteLine("SUCCESS - Int64Properties"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - Int64Properties: {0}", e)); failed++; }

#if INTEROP_VIRTUAL_TABLE
      total++;
      try { ManagedVirtualTable(cnn); frm.WriteLine("SUCCESS - ManagedVirtualTable"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - ManagedVirtualTable: {0}", e)); failed++; }
#endif

      total++;
      try { MultipleThreadStress(cnn); frm.WriteLine("SUCCESS - MultipleThreadStress"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - MultipleThreadStress: {0}", e)); failed++; }

      total++;
      try { SimpleRTree(cnn); frm.WriteLine("SUCCESS - SimpleRTree"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - SimpleRTree: {0}", e)); failed++; }

      total++;
      try { DropTable(cnn); frm.WriteLine("SUCCESS - DropTable"); passed++; }
      catch (Exception e) { frm.WriteLine(String.Format("FAIL - DropTable: {0}", e)); failed++; }

      frm.WriteLine("\r\nTests Finished.");

      if (cnn2 != null)
          cnn2.Close();

      WriteMemoryStatistics(true);

      frm.WriteLine(String.Format("\r\nCounts: {0} total, {1} passed, {2} failed", total, passed, failed));
      frm.WriteLine(String.Format("Result: {0}", Succeeded() ? "SUCCESS" : "FAILURE"));

      if (autoClose)
          frm.Close();
    }

    internal static void KeyInfoTest(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        // First test against integer primary key (optimized) keyinfo fetch
347
348
349
350
351
352
353





354
355
356
357

358
359
360
361
362
363
364
        //cmd.CommandText = "CREATE TABLE TestCase (ID bigint primary key identity, Field1 Integer, Field2 Float, Field3 VARCHAR(50), Field4 CHAR(10), Field5 DateTime, Field6 Image)";
        cmd.ExecuteNonQuery();
      }
    }

    internal void DropTable(DbConnection cnn)
    {





      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "DROP TABLE TestCase";
        cmd.ExecuteNonQuery();

      }
    }

    internal void InsertTable(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {







>
>
>
>
>
|
|
|
|
>







535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
        //cmd.CommandText = "CREATE TABLE TestCase (ID bigint primary key identity, Field1 Integer, Field2 Float, Field3 VARCHAR(50), Field4 CHAR(10), Field5 DateTime, Field6 Image)";
        cmd.ExecuteNonQuery();
      }
    }

    internal void DropTable(DbConnection cnn)
    {
      string[] tables = {
        "TestCase", "keyinfotest", "datatypetest", "TestThreads", "TestRTree"
      };
      foreach (string table in tables)
      {
        using (DbCommand cmd = cnn.CreateCommand())
        {
          cmd.CommandText = String.Format("DROP TABLE {0};", table);
          cmd.ExecuteNonQuery();
        }
      }
    }

    internal void InsertTable(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
            if (Field5.CompareTo(DateTime.Parse("2005-01-01 13:49:00")) != 0) throw new ArgumentOutOfRangeException("Non-Match on Field5");
          }
          else throw new ArgumentOutOfRangeException("No data in table");
        }
      }
    }

    internal void CoersionTest(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "SELECT Field1, Field2, Field3, Field4, Field5, 'A', 1, 1 + 1, 3.14159 FROM TestCase";
        using (DbDataReader rd = cmd.ExecuteReader())
        {
          if (rd.Read())







|







584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
            if (Field5.CompareTo(DateTime.Parse("2005-01-01 13:49:00")) != 0) throw new ArgumentOutOfRangeException("Non-Match on Field5");
          }
          else throw new ArgumentOutOfRangeException("No data in table");
        }
      }
    }

    internal void CoercionTest(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "SELECT Field1, Field2, Field3, Field4, Field5, 'A', 1, 1 + 1, 3.14159 FROM TestCase";
        using (DbDataReader rd = cmd.ExecuteReader())
        {
          if (rd.Read())
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527


528
529
530
531
532
533
534
          if (b[1000] != 3) throw new ArgumentException();
          if (b[2000] != 4) throw new ArgumentException();
          if (b[3000] != 5) throw new ArgumentException();
        }
      }
    }

    internal static void LockTest(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "SELECT Field6 FROM TestCase WHERE Field6 IS NOT NULL";
        byte[] b = new byte[4000];

        using (DbDataReader rd = cmd.ExecuteReader())
        {
          if (rd.Read() == false) throw new ArgumentOutOfRangeException();

          rd.GetBytes(0, 0, b, 0, 4000);

          if (b[0] != 1) throw new ArgumentException();
          if (b[100] != 2) throw new ArgumentException();
          if (b[1000] != 3) throw new ArgumentException();
          if (b[2000] != 4) throw new ArgumentException();
          if (b[3000] != 5) throw new ArgumentException();

          using (DbConnection clone = (DbConnection)((ICloneable)cnn).Clone())
          {


            using (DbCommand newcmd = clone.CreateCommand())
            {
              newcmd.CommandText = "DELETE FROM TestCase WHERE Field6 IS NULL";
              newcmd.CommandTimeout = 2;
              int cmdStart = Environment.TickCount;
              int cmdEnd;








|




















>
>







694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
          if (b[1000] != 3) throw new ArgumentException();
          if (b[2000] != 4) throw new ArgumentException();
          if (b[3000] != 5) throw new ArgumentException();
        }
      }
    }

    internal static void LockTest(DbConnection cnn, string sql, bool isolatedSql)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        cmd.CommandText = "SELECT Field6 FROM TestCase WHERE Field6 IS NOT NULL";
        byte[] b = new byte[4000];

        using (DbDataReader rd = cmd.ExecuteReader())
        {
          if (rd.Read() == false) throw new ArgumentOutOfRangeException();

          rd.GetBytes(0, 0, b, 0, 4000);

          if (b[0] != 1) throw new ArgumentException();
          if (b[100] != 2) throw new ArgumentException();
          if (b[1000] != 3) throw new ArgumentException();
          if (b[2000] != 4) throw new ArgumentException();
          if (b[3000] != 5) throw new ArgumentException();

          using (DbConnection clone = (DbConnection)((ICloneable)cnn).Clone())
          {
            Program.ExecuteInitializationSQL(clone, sql, isolatedSql);

            using (DbCommand newcmd = clone.CreateCommand())
            {
              newcmd.CommandText = "DELETE FROM TestCase WHERE Field6 IS NULL";
              newcmd.CommandTimeout = 2;
              int cmdStart = Environment.TickCount;
              int cmdEnd;

812
813
814
815
816
817
818
819
820
821
822
823
824
825
826




827
























































































































































































































    // Causes the user-defined collation sequence to be iterated through
    internal void UserCollation(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        // Using a default collating sequence in descending order, "Param Field3" will appear at the top
        // and "Field3" will be next, followed by a NULL.  Our user-defined collating sequence will 
        // deliberately place them out of order so Field3 is first.
        cmd.CommandText = "SELECT Field3 FROM TestCase ORDER BY Field3 COLLATE MYSEQUENCE DESC";
        string s = (string)cmd.ExecuteScalar();
        if (s != "Field3") throw new ArgumentOutOfRangeException("MySequence didn't sort properly");
      }
    }
  }




}






























































































































































































































|






|
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242

    // Causes the user-defined collation sequence to be iterated through
    internal void UserCollation(DbConnection cnn)
    {
      using (DbCommand cmd = cnn.CreateCommand())
      {
        // Using a default collating sequence in descending order, "Param Field3" will appear at the top
        // and "Field3" will be next, followed by a NULL.  Our user-defined collating sequence will
        // deliberately place them out of order so Field3 is first.
        cmd.CommandText = "SELECT Field3 FROM TestCase ORDER BY Field3 COLLATE MYSEQUENCE DESC";
        string s = (string)cmd.ExecuteScalar();
        if (s != "Field3") throw new ArgumentOutOfRangeException("MySequence didn't sort properly");
      }
    }

    // Make sure that Int64 property values can be used on the .NET Compact Framework.
    internal void Int64Properties(DbConnection cnn)
    {
        SQLiteConnection cnn2 = cnn as SQLiteConnection;

        if (cnn2 != null)
        {
            foreach (long value in new long[] {
                    cnn2.LastInsertRowId, cnn2.MemoryUsed,
                    cnn2.MemoryHighwater
                })
            {
                // do nothing.
            }

            return;
        }

        throw new NotSupportedException("not a SQLite connection");
    }

#if INTEROP_VIRTUAL_TABLE
    // Make sure that managed virtual table support works on the .NET Compact Framework.
    internal void ManagedVirtualTable(DbConnection cnn)
    {
        SQLiteConnection cnn2 = cnn as SQLiteConnection;

        if (cnn2 != null)
        {
            string[] result = new string[5];

            cnn2.CreateModule(new SQLiteModuleEnumerable("enumMod", new string[] {
                "one", "two", "three", "4", "5.0"
            }));

            using (SQLiteCommand command = cnn2.CreateCommand())
            {
                command.CommandText = "CREATE VIRTUAL TABLE enumTab USING enumMod;";
                command.ExecuteNonQuery();
            }

            using (SQLiteCommand command = cnn2.CreateCommand())
            {
                command.CommandText = "SELECT * FROM enumTab;";

                using (SQLiteDataReader dataReader = command.ExecuteReader())
                {
                    int index = 0;

                    while (dataReader.Read())
                        result[index++] = dataReader[0].ToString();

                    if (result[0] != "one") throw new ArgumentException("one");
                    if (result[1] != "two") throw new ArgumentException("two");
                    if (result[2] != "three") throw new ArgumentException("three");
                    if (result[3] != "4") throw new ArgumentException("4");
                    if (result[4] != "5.0") throw new ArgumentException("5.0");
                }
            }

            using (SQLiteCommand command = cnn2.CreateCommand())
            {
                command.CommandText = "UPDATE enumTab SET x = 1;";

                try
                {
                    command.ExecuteNonQuery();

                    throw new InvalidOperationException(
                        "UPDATE should throw exception");
                }
                catch (SQLiteException)
                {
                    // do nothing.
                }
            }

            return;
        }

        throw new NotSupportedException("not a SQLite connection");
    }
#endif

    private int nextId = 0;
    private const int MAX_THREADS = 3;
    private const int MAX_ITERATIONS = 100;
    private ManualResetEvent goEvent = new ManualResetEvent(false);

    private static int GetThreadId()
    {
        return Thread.CurrentThread.ManagedThreadId;
    }

    // Mutli-threading test.
    internal void MultipleThreadStress(DbConnection cnn)
    {
        string[] commands = {
            "CREATE TABLE TestThreads(Id INTEGER PRIMARY KEY, Data INTEGER);",
            "INSERT INTO TestThreads (Id, Data) VALUES (" +
                Interlocked.Increment(ref nextId).ToString() + ", " +
                GetThreadId().ToString() + ");"
        };

        foreach (string command in commands)
        {
            using (DbCommand cmd = cnn.CreateCommand())
            {
                cmd.CommandText = command;
                cmd.ExecuteNonQuery();
            }
        }

        Thread[] threads = new Thread[MAX_THREADS];

        for (int index = 0; index < threads.Length; index++)
            threads[index] = new Thread(TestThreadStart);

        for (int index = 0; index < threads.Length; index++)
            threads[index].Start();

        goEvent.Set(); /* GO */

        for (int index = 0; index < threads.Length; index++)
            threads[index].Join();

        int count;

        using (DbCommand cmd = cnn.CreateCommand())
        {
            cmd.CommandText = "SELECT COUNT(*) FROM TestThreads;";
            object value = cmd.ExecuteScalar();
            count = (value is int) ? (int)value : 0;
        }

        if ((count >= MAX_THREADS) &&
            (count <= (MAX_THREADS * MAX_ITERATIONS)))
        {
            throw new ArgumentOutOfRangeException("Unexpected thread count");
        }
    }

    private void TestThreadStart()
    {
        goEvent.WaitOne();

        using (DbConnection cnn = Program.NewConnection())
        {
            Random random = new Random();

            cnn.ConnectionString = this.connectionString;
            cnn.Open();

            for (int index = 0; index < MAX_ITERATIONS; index++)
            {
                try
                {
                    using (DbTransaction trans = cnn.BeginTransaction())
                    {
                        string[] commands = {
                            "INSERT INTO TestThreads (Id, Data) VALUES (" +
                                Interlocked.Increment(ref nextId).ToString() + ", " +
                                GetThreadId().ToString() + ");"
                        };

                        foreach (string command in commands)
                        {
                            using (DbCommand cmd = cnn.CreateCommand())
                            {
                                cmd.CommandText = command;
                                cmd.ExecuteNonQuery();
                            }
                        }

                        if ((index > 0) && (random.Next() % 2 == 0))
                            throw new Exception("test exception");

                        trans.Commit();
                    }
                }
                catch
                {
                    // do nothing.
                }
            }
        }
    }

    internal void SimpleRTree(DbConnection cnn)
    {
        using (DbCommand cmd = cnn.CreateCommand())
        {
            cmd.CommandText = "CREATE VIRTUAL TABLE TestRTree USING RTREE(id, minx, maxx, miny, maxy);";
            cmd.ExecuteNonQuery();
        }

        using (DbCommand cmd = cnn.CreateCommand())
        {
            cmd.CommandText = "INSERT INTO TestRTree VALUES(1, 2, 8, 2, 8);";
            cmd.ExecuteNonQuery();
        }

        using (DbCommand cmd = cnn.CreateCommand())
        {
            cmd.CommandText = "SELECT COUNT(*) FROM TestRTree;";

            if ((long)cmd.ExecuteScalar() != 1)
                throw new Exception("COUNT(*) without WHERE should return one row");
        }

        using (DbCommand cmd = cnn.CreateCommand())
        {
            cmd.CommandText = "SELECT COUNT(*) FROM TestRTree WHERE minx > 1 AND maxx < 9 AND miny < 3 AND maxy > 7;";

            if ((long)cmd.ExecuteScalar() != 1)
                throw new Exception("COUNT(*) with WHERE should return one row");
        }
    }
  }
}

Added testce/test.cfg.



>
1
Data Source={DataDirectory}\test.db;

Added testce/test.sql.

Added testce/testce.2005.csproj.



















































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * testce.2005.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>test</RootNamespace>
    <AssemblyName>testce</AssemblyName>
    <ProjectTypeGuids>{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <PlatformFamilyName>WindowsCE</PlatformFamilyName>
    <PlatformID>E2BECB1F-8C8C-41ba-B736-9BE7D946A398</PlatformID>
    <OSVersion>5.0</OSVersion>
    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
    <NativePlatformName>Windows CE</NativePlatformName>
    <FormFactorID></FormFactorID>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx20>true</NetFx20>
    <ConfigurationYear>2005</ConfigurationYear>
    <ConfigurationSuffix>Compact</ConfigurationSuffix>
    <DeployDirSuffix>testce</DeployDirSuffix>
    <DeployDirPrefix>%25CSIDL_PROGRAM_FILES%25</DeployDirPrefix>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE;$(PlatformFamilyName)</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE;$(PlatformFamilyName)</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="mscorlib" />
    <Reference Include="System">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Data">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Drawing">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Windows.Forms">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Xml">
      <Private>False</Private>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Form1.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="Form1.Designer.cs">
      <DependentUpon>Form1.cs</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="TestCases.cs">
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Form1.resx">
      <DependentUpon>Form1.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <Content Include="test.cfg">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="test.sql">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.Compact.2005.csproj">
      <Project>{AC139951-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.Compact.2005</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v1.0' And Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets')" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v2.0' And Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets')" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v3.5' And Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets')" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
  <ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}">
        <HostingProcess disable="1" />
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
</Project>

Added testce/testce.2008.csproj.





















































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * testce.2008.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>test</RootNamespace>
    <AssemblyName>testce</AssemblyName>
    <ProjectTypeGuids>{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <PlatformFamilyName>WindowsCE</PlatformFamilyName>
    <PlatformID>E2BECB1F-8C8C-41ba-B736-9BE7D946A398</PlatformID>
    <OSVersion>5.0</OSVersion>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    <OldToolsVersion>2.0</OldToolsVersion>
    <NativePlatformName>Windows CE</NativePlatformName>
    <FormFactorID></FormFactorID>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx35>true</NetFx35>
    <ConfigurationYear>2008</ConfigurationYear>
    <ConfigurationSuffix>Compact</ConfigurationSuffix>
    <DeployDirSuffix>testce</DeployDirSuffix>
    <DeployDirPrefix>%25CSIDL_PROGRAM_FILES%25</DeployDirPrefix>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE;$(PlatformFamilyName)</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE;$(PlatformFamilyName)</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="mscorlib" />
    <Reference Include="System">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Data">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Drawing">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Windows.Forms">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Xml">
      <Private>False</Private>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Form1.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="Form1.Designer.cs">
      <DependentUpon>Form1.cs</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="TestCases.cs">
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Form1.resx">
      <DependentUpon>Form1.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <Content Include="test.cfg">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="test.sql">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.Compact.2008.csproj">
      <Project>{AC139951-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.Compact.2008</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v1.0' And Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets')" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v2.0' And Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets')" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v3.5' And Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets')" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
  <ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}">
        <HostingProcess disable="1" />
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
</Project>

Added testce/testce.2012.csproj.























































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * testce.2012.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <ProjectGuid>{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>test</RootNamespace>
    <AssemblyName>testce</AssemblyName>
    <ProjectTypeGuids>{6AFDAB0D-95EF-424D-8A49-099ECD40B0FF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <TargetFrameworkIdentifier>WindowsEmbeddedCompact</TargetFrameworkIdentifier>
    <TargetFrameworkVersion>v3.9</TargetFrameworkVersion>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx35>true</NetFx35>
    <NetFx35Settings>false</NetFx35Settings>
    <ConfigurationYear>2012</ConfigurationYear>
    <ConfigurationSuffix>Compact</ConfigurationSuffix>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="mscorlib" />
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Form1.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="Form1.Designer.cs">
      <DependentUpon>Form1.cs</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="TestCases.cs">
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Form1.resx">
      <DependentUpon>Form1.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <Content Include="test.cfg">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="test.sql">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite\System.Data.SQLite.Compact.2012.csproj">
      <Project>{AC139951-261A-4463-B6FA-AEBC25283A66}</Project>
      <Name>System.Data.SQLite.Compact.2012</Name>
    </ProjectReference>
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v1.0' And Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets')" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v2.0' And Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets')" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v3.5' And Exists('$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets')" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
  <Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\v8.0\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" />
  <ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{fae04ec0-301f-11d3-bf4b-00c04f79efbc}">
        <HostingProcess disable="1" />
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
</Project>

Deleted testce/testce.csproj.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{B86CE504-C4E4-496F-A0F0-E613BCFD3DF7}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>test</RootNamespace>
    <AssemblyName>testce</AssemblyName>
    <ProjectTypeGuids>{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <PlatformFamilyName>PocketPC</PlatformFamilyName>
    <PlatformID>3C41C503-53EF-4c2a-8DD4-A8217CAD115E</PlatformID>
    <OSVersion>4.20</OSVersion>
    <DeployDirSuffix>testce</DeployDirSuffix>
    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
    <FormFactorID>
    </FormFactorID>
    <StartupObject>
    </StartupObject>
    <DeployDirPrefix>%25CSIDL_PROGRAM_FILES%25</DeployDirPrefix>
    <FileUpgradeFlags>
    </FileUpgradeFlags>
    <OldToolsVersion>2.0</OldToolsVersion>
    <NativePlatformName>Pocket PC 2003</NativePlatformName>
    <UpgradeBackupLocation>
    </UpgradeBackupLocation>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>..\bin\CompactFramework\</OutputPath>
    <DefineConstants>TRACE;DEBUG;PocketPC</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <FileAlignment>512</FileAlignment>
    <WarningLevel>4</WarningLevel>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>none</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>..\bin\CompactFramework\</OutputPath>
    <DefineConstants>PocketPC</DefineConstants>
    <NoStdLib>true</NoStdLib>
    <NoConfig>true</NoConfig>
    <ErrorReport>prompt</ErrorReport>
    <FileAlignment>512</FileAlignment>
    <WarningLevel>4</WarningLevel>
    <GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="mscorlib" />
    <Reference Include="System">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Data">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Data.SQLite, Version=1.0.47.0, Culture=neutral, PublicKeyToken=1fdb50b1b62b4c84, processorArchitecture=x86">
      <SpecificVersion>False</SpecificVersion>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.Drawing">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Windows.Forms">
      <Private>False</Private>
    </Reference>
    <Reference Include="System.Xml">
      <Private>False</Private>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Include="AssemblyInfo.cs" />
    <Compile Include="Form1.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="Form1.Designer.cs">
      <DependentUpon>Form1.cs</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="TestCases.cs">
    </Compile>
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Include="Form1.resx">
      <DependentUpon>Form1.cs</DependentUpon>
      <SubType>Designer</SubType>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Properties\" />
  </ItemGroup>
  <Import Condition="'$(TargetFrameworkVersion)' == 'v1.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.v1.targets" />
  <Import Condition="'$(TargetFrameworkVersion)' == 'v2.0'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
  <ProjectExtensions>
    <VisualStudio>
      <FlavorProperties GUID="{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}">
        <HostingProcess disable="1" />
      </FlavorProperties>
    </VisualStudio>
  </ProjectExtensions>
  <Import Condition="'$(TargetFrameworkVersion)' == 'v3.5'" Project="$(MSBuildBinPath)\Microsoft.CompactFramework.CSharp.targets" />
</Project>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































Added testlinq/2008/LINQ/App.config.

























>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
<?xml version="1.0"?>
<configuration>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.Linq" />
      <add name="SQLite Data Provider (LINQ)" invariant="System.Data.SQLite.Linq" description=".NET Framework Data Provider for SQLite (LINQ)" type="System.Data.SQLite.Linq.SQLiteProviderFactory, System.Data.SQLite.Linq, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </DbProviderFactories>
  </system.data>
  <connectionStrings>
    <add name="northwindEFEntities" connectionString="metadata=res://*/NorthwindModel.Linq.2008.csdl|res://*/NorthwindModel.Linq.2008.ssdl|res://*/NorthwindModel.Linq.2008.msl;provider=System.Data.SQLite.Linq;provider connection string=&quot;data source=.\northwindEF.db&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>

Added testlinq/2010/EF6/App.config.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </configSections>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.EF6" />
      <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </DbProviderFactories>
  </system.data>
  <connectionStrings>
    <add name="northwindEFEntities" connectionString="metadata=res://*/NorthwindModel.EF6.2010.csdl|res://*/NorthwindModel.EF6.2010.ssdl|res://*/NorthwindModel.EF6.2010.msl;provider=System.Data.SQLite.EF6;provider connection string=&quot;data source=.\northwindEF.db&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <entityFramework>
    <providers>
      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </providers>
  </entityFramework>
</configuration>

Added testlinq/2010/LINQ/App.config.

























>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
<?xml version="1.0"?>
<configuration>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.Linq" />
      <add name="SQLite Data Provider (LINQ)" invariant="System.Data.SQLite.Linq" description=".NET Framework Data Provider for SQLite (LINQ)" type="System.Data.SQLite.Linq.SQLiteProviderFactory, System.Data.SQLite.Linq, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </DbProviderFactories>
  </system.data>
  <connectionStrings>
    <add name="northwindEFEntities" connectionString="metadata=res://*/NorthwindModel.Linq.2010.csdl|res://*/NorthwindModel.Linq.2010.ssdl|res://*/NorthwindModel.Linq.2010.msl;provider=System.Data.SQLite.Linq;provider connection string=&quot;data source=.\northwindEF.db&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>

Added testlinq/2012/EF6/App.config.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </configSections>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.EF6" />
      <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </DbProviderFactories>
  </system.data>
  <connectionStrings>
    <add name="northwindEFEntities" connectionString="metadata=res://*/NorthwindModel.EF6.2012.csdl|res://*/NorthwindModel.EF6.2012.ssdl|res://*/NorthwindModel.EF6.2012.msl;provider=System.Data.SQLite.EF6;provider connection string=&quot;data source=.\northwindEF.db&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <entityFramework>
    <providers>
      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </providers>
  </entityFramework>
</configuration>

Added testlinq/2012/LINQ/App.config.

























>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
<?xml version="1.0"?>
<configuration>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.Linq" />
      <add name="SQLite Data Provider (LINQ)" invariant="System.Data.SQLite.Linq" description=".NET Framework Data Provider for SQLite (LINQ)" type="System.Data.SQLite.Linq.SQLiteProviderFactory, System.Data.SQLite.Linq, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </DbProviderFactories>
  </system.data>
  <connectionStrings>
    <add name="northwindEFEntities" connectionString="metadata=res://*/NorthwindModel.Linq.2012.csdl|res://*/NorthwindModel.Linq.2012.ssdl|res://*/NorthwindModel.Linq.2012.msl;provider=System.Data.SQLite.Linq;provider connection string=&quot;data source=.\northwindEF.db&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>

Added testlinq/2013/EF6/App.config.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </configSections>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.EF6" />
      <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </DbProviderFactories>
  </system.data>
  <connectionStrings>
    <add name="northwindEFEntities" connectionString="metadata=res://*/NorthwindModel.EF6.2013.csdl|res://*/NorthwindModel.EF6.2013.ssdl|res://*/NorthwindModel.EF6.2013.msl;provider=System.Data.SQLite.EF6;provider connection string=&quot;data source=.\northwindEF.db&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <entityFramework>
    <providers>
      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </providers>
  </entityFramework>
</configuration>

Added testlinq/2013/LINQ/App.config.

























>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
<?xml version="1.0"?>
<configuration>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.Linq" />
      <add name="SQLite Data Provider (LINQ)" invariant="System.Data.SQLite.Linq" description=".NET Framework Data Provider for SQLite (LINQ)" type="System.Data.SQLite.Linq.SQLiteProviderFactory, System.Data.SQLite.Linq, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </DbProviderFactories>
  </system.data>
  <connectionStrings>
    <add name="northwindEFEntities" connectionString="metadata=res://*/NorthwindModel.Linq.2013.csdl|res://*/NorthwindModel.Linq.2013.ssdl|res://*/NorthwindModel.Linq.2013.msl;provider=System.Data.SQLite.Linq;provider connection string=&quot;data source=.\northwindEF.db&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>

Added testlinq/2015/EF6/App.config.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </configSections>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.EF6" />
      <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </DbProviderFactories>
  </system.data>
  <connectionStrings>
    <add name="northwindEFEntities" connectionString="metadata=res://*/NorthwindModel.EF6.2015.csdl|res://*/NorthwindModel.EF6.2015.ssdl|res://*/NorthwindModel.EF6.2015.msl;provider=System.Data.SQLite.EF6;provider connection string=&quot;data source=.\northwindEF.db&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <entityFramework>
    <providers>
      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </providers>
  </entityFramework>
</configuration>

Added testlinq/2015/LINQ/App.config.

























>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
<?xml version="1.0"?>
<configuration>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.Linq" />
      <add name="SQLite Data Provider (LINQ)" invariant="System.Data.SQLite.Linq" description=".NET Framework Data Provider for SQLite (LINQ)" type="System.Data.SQLite.Linq.SQLiteProviderFactory, System.Data.SQLite.Linq, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </DbProviderFactories>
  </system.data>
  <connectionStrings>
    <add name="northwindEFEntities" connectionString="metadata=res://*/NorthwindModel.Linq.2015.csdl|res://*/NorthwindModel.Linq.2015.ssdl|res://*/NorthwindModel.Linq.2015.msl;provider=System.Data.SQLite.Linq;provider connection string=&quot;data source=.\northwindEF.db&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>

Added testlinq/2017/EF6/App.config.









































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </configSections>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.EF6" />
      <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </DbProviderFactories>
  </system.data>
  <connectionStrings>
    <add name="northwindEFEntities" connectionString="metadata=res://*/NorthwindModel.EF6.2017.csdl|res://*/NorthwindModel.EF6.2017.ssdl|res://*/NorthwindModel.EF6.2017.msl;provider=System.Data.SQLite.EF6;provider connection string=&quot;data source=.\northwindEF.db&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <entityFramework>
    <providers>
      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </providers>
  </entityFramework>
</configuration>

Added testlinq/2017/LINQ/App.config.

























>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
<?xml version="1.0"?>
<configuration>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.Linq" />
      <add name="SQLite Data Provider (LINQ)" invariant="System.Data.SQLite.Linq" description=".NET Framework Data Provider for SQLite (LINQ)" type="System.Data.SQLite.Linq.SQLiteProviderFactory, System.Data.SQLite.Linq, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </DbProviderFactories>
  </system.data>
  <connectionStrings>
    <add name="northwindEFEntities" connectionString="metadata=res://*/NorthwindModel.Linq.2017.csdl|res://*/NorthwindModel.Linq.2017.ssdl|res://*/NorthwindModel.Linq.2017.msl;provider=System.Data.SQLite.Linq;provider connection string=&quot;data source=.\northwindEF.db&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>

Deleted testlinq/App.Config.

1
2
3
4
5
6
7
8
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <connectionStrings>
    <add name="northwindEntities" connectionString="metadata=res://*/NorthwindModel.csdl|res://*/NorthwindModel.ssdl|res://*/NorthwindModel.msl;provider=System.Data.SQLite;provider connection string=&quot;data source=c:\src\sqlite.net\testlinq\northwind.db&quot;" providerName="System.Data.EntityClient" />
    <add name="northwindEntities1" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SQLite;provider connection string=&quot;data source=c:\src\sqlite.net\testlinq\northwind.db&quot;" providerName="System.Data.EntityClient" />
    <add name="northwindEFEntities" connectionString="metadata=res://*/NorthwindModel.csdl|res://*/NorthwindModel.ssdl|res://*/NorthwindModel.msl;provider=System.Data.SQLite;provider connection string=&quot;data source=C:\Src\SQLite.NET\testlinq\northwindEF.db&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
</configuration>
<
<
<
<
<
<
<
<
















Added testlinq/NetStandard21/EF6/App.config.





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </configSections>
  <connectionStrings>
    <add name="northwindEFEntities" connectionString="metadata=res://*/NorthwindModel.EF6.NetStandard21.csdl|res://*/NorthwindModel.EF6.NetStandard21.ssdl|res://*/NorthwindModel.EF6.NetStandard21.msl;provider=System.Data.SQLite.EF6;provider connection string=&quot;data source=northwindEF.db&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>
  <entityFramework>
    <providers>
      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6, Version=1.0.119.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139" />
    </providers>
  </entityFramework>
</configuration>

Deleted testlinq/NorthwindModel.Designer.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.3053
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

[assembly: global::System.Data.Objects.DataClasses.EdmSchemaAttribute()]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Categories), "Products", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Customers), "Orders", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Orders))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(testlinq.Orders), "InternationalOrders", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.InternationalOrders))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(testlinq.Orders), "OrderDetails", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(testlinq.Products), "OrderDetails", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Suppliers), "Products", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(testlinq.Regions), "Territories", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Territories))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "EmployeesTerritories", "Employees", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Employees), "Territories", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Territories))]

// Original file name:
// Generation date: 8/25/2008 8:54:05 AM
namespace testlinq
{
    
    /// <summary>
    /// There are no comments for northwindEFEntities in the schema.
    /// </summary>
    public partial class northwindEFEntities : global::System.Data.Objects.ObjectContext
    {
        /// <summary>
        /// Initializes a new northwindEFEntities object using the connection string found in the 'northwindEFEntities' section of the application configuration file.
        /// </summary>
        public northwindEFEntities() : 
                base("name=northwindEFEntities", "northwindEFEntities")
        {
            this.OnContextCreated();
        }
        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(string connectionString) : 
                base(connectionString, "northwindEFEntities")
        {
            this.OnContextCreated();
        }
        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(global::System.Data.EntityClient.EntityConnection connection) : 
                base(connection, "northwindEFEntities")
        {
            this.OnContextCreated();
        }
        partial void OnContextCreated();
        /// <summary>
        /// There are no comments for Categories in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<Categories> Categories
        {
            get
            {
                if ((this._Categories == null))
                {
                    this._Categories = base.CreateQuery<Categories>("[Categories]");
                }
                return this._Categories;
            }
        }
        private global::System.Data.Objects.ObjectQuery<Categories> _Categories;
        /// <summary>
        /// There are no comments for Customers in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<Customers> Customers
        {
            get
            {
                if ((this._Customers == null))
                {
                    this._Customers = base.CreateQuery<Customers>("[Customers]");
                }
                return this._Customers;
            }
        }
        private global::System.Data.Objects.ObjectQuery<Customers> _Customers;
        /// <summary>
        /// There are no comments for Employees in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<Employees> Employees
        {
            get
            {
                if ((this._Employees == null))
                {
                    this._Employees = base.CreateQuery<Employees>("[Employees]");
                }
                return this._Employees;
            }
        }
        private global::System.Data.Objects.ObjectQuery<Employees> _Employees;
        /// <summary>
        /// There are no comments for InternationalOrders in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<InternationalOrders> InternationalOrders
        {
            get
            {
                if ((this._InternationalOrders == null))
                {
                    this._InternationalOrders = base.CreateQuery<InternationalOrders>("[InternationalOrders]");
                }
                return this._InternationalOrders;
            }
        }
        private global::System.Data.Objects.ObjectQuery<InternationalOrders> _InternationalOrders;
        /// <summary>
        /// There are no comments for OrderDetails in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<OrderDetails> OrderDetails
        {
            get
            {
                if ((this._OrderDetails == null))
                {
                    this._OrderDetails = base.CreateQuery<OrderDetails>("[OrderDetails]");
                }
                return this._OrderDetails;
            }
        }
        private global::System.Data.Objects.ObjectQuery<OrderDetails> _OrderDetails;
        /// <summary>
        /// There are no comments for Orders in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<Orders> Orders
        {
            get
            {
                if ((this._Orders == null))
                {
                    this._Orders = base.CreateQuery<Orders>("[Orders]");
                }
                return this._Orders;
            }
        }
        private global::System.Data.Objects.ObjectQuery<Orders> _Orders;
        /// <summary>
        /// There are no comments for PreviousEmployees in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<PreviousEmployees> PreviousEmployees
        {
            get
            {
                if ((this._PreviousEmployees == null))
                {
                    this._PreviousEmployees = base.CreateQuery<PreviousEmployees>("[PreviousEmployees]");
                }
                return this._PreviousEmployees;
            }
        }
        private global::System.Data.Objects.ObjectQuery<PreviousEmployees> _PreviousEmployees;
        /// <summary>
        /// There are no comments for Products in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<Products> Products
        {
            get
            {
                if ((this._Products == null))
                {
                    this._Products = base.CreateQuery<Products>("[Products]");
                }
                return this._Products;
            }
        }
        private global::System.Data.Objects.ObjectQuery<Products> _Products;
        /// <summary>
        /// There are no comments for Regions in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<Regions> Regions
        {
            get
            {
                if ((this._Regions == null))
                {
                    this._Regions = base.CreateQuery<Regions>("[Regions]");
                }
                return this._Regions;
            }
        }
        private global::System.Data.Objects.ObjectQuery<Regions> _Regions;
        /// <summary>
        /// There are no comments for Suppliers in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<Suppliers> Suppliers
        {
            get
            {
                if ((this._Suppliers == null))
                {
                    this._Suppliers = base.CreateQuery<Suppliers>("[Suppliers]");
                }
                return this._Suppliers;
            }
        }
        private global::System.Data.Objects.ObjectQuery<Suppliers> _Suppliers;
        /// <summary>
        /// There are no comments for Territories in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<Territories> Territories
        {
            get
            {
                if ((this._Territories == null))
                {
                    this._Territories = base.CreateQuery<Territories>("[Territories]");
                }
                return this._Territories;
            }
        }
        private global::System.Data.Objects.ObjectQuery<Territories> _Territories;
        /// <summary>
        /// There are no comments for Categories in the schema.
        /// </summary>
        public void AddToCategories(Categories categories)
        {
            base.AddObject("Categories", categories);
        }
        /// <summary>
        /// There are no comments for Customers in the schema.
        /// </summary>
        public void AddToCustomers(Customers customers)
        {
            base.AddObject("Customers", customers);
        }
        /// <summary>
        /// There are no comments for Employees in the schema.
        /// </summary>
        public void AddToEmployees(Employees employees)
        {
            base.AddObject("Employees", employees);
        }
        /// <summary>
        /// There are no comments for InternationalOrders in the schema.
        /// </summary>
        public void AddToInternationalOrders(InternationalOrders internationalOrders)
        {
            base.AddObject("InternationalOrders", internationalOrders);
        }
        /// <summary>
        /// There are no comments for OrderDetails in the schema.
        /// </summary>
        public void AddToOrderDetails(OrderDetails orderDetails)
        {
            base.AddObject("OrderDetails", orderDetails);
        }
        /// <summary>
        /// There are no comments for Orders in the schema.
        /// </summary>
        public void AddToOrders(Orders orders)
        {
            base.AddObject("Orders", orders);
        }
        /// <summary>
        /// There are no comments for PreviousEmployees in the schema.
        /// </summary>
        public void AddToPreviousEmployees(PreviousEmployees previousEmployees)
        {
            base.AddObject("PreviousEmployees", previousEmployees);
        }
        /// <summary>
        /// There are no comments for Products in the schema.
        /// </summary>
        public void AddToProducts(Products products)
        {
            base.AddObject("Products", products);
        }
        /// <summary>
        /// There are no comments for Regions in the schema.
        /// </summary>
        public void AddToRegions(Regions regions)
        {
            base.AddObject("Regions", regions);
        }
        /// <summary>
        /// There are no comments for Suppliers in the schema.
        /// </summary>
        public void AddToSuppliers(Suppliers suppliers)
        {
            base.AddObject("Suppliers", suppliers);
        }
        /// <summary>
        /// There are no comments for Territories in the schema.
        /// </summary>
        public void AddToTerritories(Territories territories)
        {
            base.AddObject("Territories", territories);
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.Categories in the schema.
    /// </summary>
    /// <KeyProperties>
    /// CategoryID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Categories")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class Categories : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new Categories object.
        /// </summary>
        /// <param name="categoryID">Initial value of CategoryID.</param>
        /// <param name="categoryName">Initial value of CategoryName.</param>
        public static Categories CreateCategories(long categoryID, string categoryName)
        {
            Categories categories = new Categories();
            categories.CategoryID = categoryID;
            categories.CategoryName = categoryName;
            return categories;
        }
        /// <summary>
        /// There are no comments for Property CategoryID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long CategoryID
        {
            get
            {
                return this._CategoryID;
            }
            set
            {
                this.OnCategoryIDChanging(value);
                this.ReportPropertyChanging("CategoryID");
                this._CategoryID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("CategoryID");
                this.OnCategoryIDChanged();
            }
        }
        private long _CategoryID;
        partial void OnCategoryIDChanging(long value);
        partial void OnCategoryIDChanged();
        /// <summary>
        /// There are no comments for Property CategoryName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string CategoryName
        {
            get
            {
                return this._CategoryName;
            }
            set
            {
                this.OnCategoryNameChanging(value);
                this.ReportPropertyChanging("CategoryName");
                this._CategoryName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("CategoryName");
                this.OnCategoryNameChanged();
            }
        }
        private string _CategoryName;
        partial void OnCategoryNameChanging(string value);
        partial void OnCategoryNameChanged();
        /// <summary>
        /// There are no comments for Property Description in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Description
        {
            get
            {
                return this._Description;
            }
            set
            {
                this.OnDescriptionChanging(value);
                this.ReportPropertyChanging("Description");
                this._Description = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Description");
                this.OnDescriptionChanged();
            }
        }
        private string _Description;
        partial void OnDescriptionChanging(string value);
        partial void OnDescriptionChanged();
        /// <summary>
        /// There are no comments for Property Picture in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public byte[] Picture
        {
            get
            {
                return global::System.Data.Objects.DataClasses.StructuralObject.GetValidValue(this._Picture);
            }
            set
            {
                this.OnPictureChanging(value);
                this.ReportPropertyChanging("Picture");
                this._Picture = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Picture");
                this.OnPictureChanged();
            }
        }
        private byte[] _Picture;
        partial void OnPictureChanging(byte[] value);
        partial void OnPictureChanged();
        /// <summary>
        /// There are no comments for Products in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Products")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityCollection<Products> Products
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products", value);
                }
            }
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.Customers in the schema.
    /// </summary>
    /// <KeyProperties>
    /// CustomerID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Customers")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class Customers : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new Customers object.
        /// </summary>
        /// <param name="customerID">Initial value of CustomerID.</param>
        /// <param name="companyName">Initial value of CompanyName.</param>
        public static Customers CreateCustomers(string customerID, string companyName)
        {
            Customers customers = new Customers();
            customers.CustomerID = customerID;
            customers.CompanyName = companyName;
            return customers;
        }
        /// <summary>
        /// There are no comments for Property CustomerID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string CustomerID
        {
            get
            {
                return this._CustomerID;
            }
            set
            {
                this.OnCustomerIDChanging(value);
                this.ReportPropertyChanging("CustomerID");
                this._CustomerID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("CustomerID");
                this.OnCustomerIDChanged();
            }
        }
        private string _CustomerID;
        partial void OnCustomerIDChanging(string value);
        partial void OnCustomerIDChanged();
        /// <summary>
        /// There are no comments for Property CompanyName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string CompanyName
        {
            get
            {
                return this._CompanyName;
            }
            set
            {
                this.OnCompanyNameChanging(value);
                this.ReportPropertyChanging("CompanyName");
                this._CompanyName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("CompanyName");
                this.OnCompanyNameChanged();
            }
        }
        private string _CompanyName;
        partial void OnCompanyNameChanging(string value);
        partial void OnCompanyNameChanged();
        /// <summary>
        /// There are no comments for Property ContactName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ContactName
        {
            get
            {
                return this._ContactName;
            }
            set
            {
                this.OnContactNameChanging(value);
                this.ReportPropertyChanging("ContactName");
                this._ContactName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ContactName");
                this.OnContactNameChanged();
            }
        }
        private string _ContactName;
        partial void OnContactNameChanging(string value);
        partial void OnContactNameChanged();
        /// <summary>
        /// There are no comments for Property ContactTitle in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ContactTitle
        {
            get
            {
                return this._ContactTitle;
            }
            set
            {
                this.OnContactTitleChanging(value);
                this.ReportPropertyChanging("ContactTitle");
                this._ContactTitle = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ContactTitle");
                this.OnContactTitleChanged();
            }
        }
        private string _ContactTitle;
        partial void OnContactTitleChanging(string value);
        partial void OnContactTitleChanged();
        /// <summary>
        /// There are no comments for Property Address in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Address
        {
            get
            {
                return this._Address;
            }
            set
            {
                this.OnAddressChanging(value);
                this.ReportPropertyChanging("Address");
                this._Address = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Address");
                this.OnAddressChanged();
            }
        }
        private string _Address;
        partial void OnAddressChanging(string value);
        partial void OnAddressChanged();
        /// <summary>
        /// There are no comments for Property City in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string City
        {
            get
            {
                return this._City;
            }
            set
            {
                this.OnCityChanging(value);
                this.ReportPropertyChanging("City");
                this._City = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("City");
                this.OnCityChanged();
            }
        }
        private string _City;
        partial void OnCityChanging(string value);
        partial void OnCityChanged();
        /// <summary>
        /// There are no comments for Property Region in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Region
        {
            get
            {
                return this._Region;
            }
            set
            {
                this.OnRegionChanging(value);
                this.ReportPropertyChanging("Region");
                this._Region = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Region");
                this.OnRegionChanged();
            }
        }
        private string _Region;
        partial void OnRegionChanging(string value);
        partial void OnRegionChanged();
        /// <summary>
        /// There are no comments for Property PostalCode in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string PostalCode
        {
            get
            {
                return this._PostalCode;
            }
            set
            {
                this.OnPostalCodeChanging(value);
                this.ReportPropertyChanging("PostalCode");
                this._PostalCode = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("PostalCode");
                this.OnPostalCodeChanged();
            }
        }
        private string _PostalCode;
        partial void OnPostalCodeChanging(string value);
        partial void OnPostalCodeChanged();
        /// <summary>
        /// There are no comments for Property Country in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Country
        {
            get
            {
                return this._Country;
            }
            set
            {
                this.OnCountryChanging(value);
                this.ReportPropertyChanging("Country");
                this._Country = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Country");
                this.OnCountryChanged();
            }
        }
        private string _Country;
        partial void OnCountryChanging(string value);
        partial void OnCountryChanged();
        /// <summary>
        /// There are no comments for Property Phone in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Phone
        {
            get
            {
                return this._Phone;
            }
            set
            {
                this.OnPhoneChanging(value);
                this.ReportPropertyChanging("Phone");
                this._Phone = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Phone");
                this.OnPhoneChanged();
            }
        }
        private string _Phone;
        partial void OnPhoneChanging(string value);
        partial void OnPhoneChanged();
        /// <summary>
        /// There are no comments for Property Fax in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Fax
        {
            get
            {
                return this._Fax;
            }
            set
            {
                this.OnFaxChanging(value);
                this.ReportPropertyChanging("Fax");
                this._Fax = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Fax");
                this.OnFaxChanged();
            }
        }
        private string _Fax;
        partial void OnFaxChanging(string value);
        partial void OnFaxChanged();
        /// <summary>
        /// There are no comments for Orders in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Orders")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityCollection<Orders> Orders
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders", value);
                }
            }
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.Employees in the schema.
    /// </summary>
    /// <KeyProperties>
    /// EmployeeID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Employees")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class Employees : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new Employees object.
        /// </summary>
        /// <param name="employeeID">Initial value of EmployeeID.</param>
        /// <param name="lastName">Initial value of LastName.</param>
        /// <param name="firstName">Initial value of FirstName.</param>
        public static Employees CreateEmployees(long employeeID, string lastName, string firstName)
        {
            Employees employees = new Employees();
            employees.EmployeeID = employeeID;
            employees.LastName = lastName;
            employees.FirstName = firstName;
            return employees;
        }
        /// <summary>
        /// There are no comments for Property EmployeeID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long EmployeeID
        {
            get
            {
                return this._EmployeeID;
            }
            set
            {
                this.OnEmployeeIDChanging(value);
                this.ReportPropertyChanging("EmployeeID");
                this._EmployeeID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("EmployeeID");
                this.OnEmployeeIDChanged();
            }
        }
        private long _EmployeeID;
        partial void OnEmployeeIDChanging(long value);
        partial void OnEmployeeIDChanged();
        /// <summary>
        /// There are no comments for Property LastName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string LastName
        {
            get
            {
                return this._LastName;
            }
            set
            {
                this.OnLastNameChanging(value);
                this.ReportPropertyChanging("LastName");
                this._LastName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("LastName");
                this.OnLastNameChanged();
            }
        }
        private string _LastName;
        partial void OnLastNameChanging(string value);
        partial void OnLastNameChanged();
        /// <summary>
        /// There are no comments for Property FirstName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string FirstName
        {
            get
            {
                return this._FirstName;
            }
            set
            {
                this.OnFirstNameChanging(value);
                this.ReportPropertyChanging("FirstName");
                this._FirstName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("FirstName");
                this.OnFirstNameChanged();
            }
        }
        private string _FirstName;
        partial void OnFirstNameChanging(string value);
        partial void OnFirstNameChanged();
        /// <summary>
        /// There are no comments for Property Title in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Title
        {
            get
            {
                return this._Title;
            }
            set
            {
                this.OnTitleChanging(value);
                this.ReportPropertyChanging("Title");
                this._Title = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Title");
                this.OnTitleChanged();
            }
        }
        private string _Title;
        partial void OnTitleChanging(string value);
        partial void OnTitleChanged();
        /// <summary>
        /// There are no comments for Property TitleOfCourtesy in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string TitleOfCourtesy
        {
            get
            {
                return this._TitleOfCourtesy;
            }
            set
            {
                this.OnTitleOfCourtesyChanging(value);
                this.ReportPropertyChanging("TitleOfCourtesy");
                this._TitleOfCourtesy = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("TitleOfCourtesy");
                this.OnTitleOfCourtesyChanged();
            }
        }
        private string _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(string value);
        partial void OnTitleOfCourtesyChanged();
        /// <summary>
        /// There are no comments for Property BirthDate in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return this._BirthDate;
            }
            set
            {
                this.OnBirthDateChanging(value);
                this.ReportPropertyChanging("BirthDate");
                this._BirthDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("BirthDate");
                this.OnBirthDateChanged();
            }
        }
        private global::System.Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(global::System.Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();
        /// <summary>
        /// There are no comments for Property HireDate in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return this._HireDate;
            }
            set
            {
                this.OnHireDateChanging(value);
                this.ReportPropertyChanging("HireDate");
                this._HireDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("HireDate");
                this.OnHireDateChanged();
            }
        }
        private global::System.Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(global::System.Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();
        /// <summary>
        /// There are no comments for Property Address in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Address
        {
            get
            {
                return this._Address;
            }
            set
            {
                this.OnAddressChanging(value);
                this.ReportPropertyChanging("Address");
                this._Address = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Address");
                this.OnAddressChanged();
            }
        }
        private string _Address;
        partial void OnAddressChanging(string value);
        partial void OnAddressChanged();
        /// <summary>
        /// There are no comments for Property City in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string City
        {
            get
            {
                return this._City;
            }
            set
            {
                this.OnCityChanging(value);
                this.ReportPropertyChanging("City");
                this._City = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("City");
                this.OnCityChanged();
            }
        }
        private string _City;
        partial void OnCityChanging(string value);
        partial void OnCityChanged();
        /// <summary>
        /// There are no comments for Property Region in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Region
        {
            get
            {
                return this._Region;
            }
            set
            {
                this.OnRegionChanging(value);
                this.ReportPropertyChanging("Region");
                this._Region = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Region");
                this.OnRegionChanged();
            }
        }
        private string _Region;
        partial void OnRegionChanging(string value);
        partial void OnRegionChanged();
        /// <summary>
        /// There are no comments for Property PostalCode in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string PostalCode
        {
            get
            {
                return this._PostalCode;
            }
            set
            {
                this.OnPostalCodeChanging(value);
                this.ReportPropertyChanging("PostalCode");
                this._PostalCode = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("PostalCode");
                this.OnPostalCodeChanged();
            }
        }
        private string _PostalCode;
        partial void OnPostalCodeChanging(string value);
        partial void OnPostalCodeChanged();
        /// <summary>
        /// There are no comments for Property Country in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Country
        {
            get
            {
                return this._Country;
            }
            set
            {
                this.OnCountryChanging(value);
                this.ReportPropertyChanging("Country");
                this._Country = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Country");
                this.OnCountryChanged();
            }
        }
        private string _Country;
        partial void OnCountryChanging(string value);
        partial void OnCountryChanged();
        /// <summary>
        /// There are no comments for Property HomePhone in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string HomePhone
        {
            get
            {
                return this._HomePhone;
            }
            set
            {
                this.OnHomePhoneChanging(value);
                this.ReportPropertyChanging("HomePhone");
                this._HomePhone = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("HomePhone");
                this.OnHomePhoneChanged();
            }
        }
        private string _HomePhone;
        partial void OnHomePhoneChanging(string value);
        partial void OnHomePhoneChanged();
        /// <summary>
        /// There are no comments for Property Extension in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Extension
        {
            get
            {
                return this._Extension;
            }
            set
            {
                this.OnExtensionChanging(value);
                this.ReportPropertyChanging("Extension");
                this._Extension = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Extension");
                this.OnExtensionChanged();
            }
        }
        private string _Extension;
        partial void OnExtensionChanging(string value);
        partial void OnExtensionChanged();
        /// <summary>
        /// There are no comments for Property Photo in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public byte[] Photo
        {
            get
            {
                return global::System.Data.Objects.DataClasses.StructuralObject.GetValidValue(this._Photo);
            }
            set
            {
                this.OnPhotoChanging(value);
                this.ReportPropertyChanging("Photo");
                this._Photo = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Photo");
                this.OnPhotoChanged();
            }
        }
        private byte[] _Photo;
        partial void OnPhotoChanging(byte[] value);
        partial void OnPhotoChanged();
        /// <summary>
        /// There are no comments for Property Notes in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Notes
        {
            get
            {
                return this._Notes;
            }
            set
            {
                this.OnNotesChanging(value);
                this.ReportPropertyChanging("Notes");
                this._Notes = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Notes");
                this.OnNotesChanged();
            }
        }
        private string _Notes;
        partial void OnNotesChanging(string value);
        partial void OnNotesChanged();
        /// <summary>
        /// There are no comments for Property PhotoPath in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string PhotoPath
        {
            get
            {
                return this._PhotoPath;
            }
            set
            {
                this.OnPhotoPathChanging(value);
                this.ReportPropertyChanging("PhotoPath");
                this._PhotoPath = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("PhotoPath");
                this.OnPhotoPathChanged();
            }
        }
        private string _PhotoPath;
        partial void OnPhotoPathChanging(string value);
        partial void OnPhotoPathChanged();
        /// <summary>
        /// There are no comments for Territories in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Territories")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityCollection<Territories> Territories
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories", value);
                }
            }
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.InternationalOrders in the schema.
    /// </summary>
    /// <KeyProperties>
    /// OrderID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="InternationalOrders")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class InternationalOrders : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new InternationalOrders object.
        /// </summary>
        /// <param name="orderID">Initial value of OrderID.</param>
        /// <param name="customsDescription">Initial value of CustomsDescription.</param>
        /// <param name="exciseTax">Initial value of ExciseTax.</param>
        public static InternationalOrders CreateInternationalOrders(long orderID, string customsDescription, decimal exciseTax)
        {
            InternationalOrders internationalOrders = new InternationalOrders();
            internationalOrders.OrderID = orderID;
            internationalOrders.CustomsDescription = customsDescription;
            internationalOrders.ExciseTax = exciseTax;
            return internationalOrders;
        }
        /// <summary>
        /// There are no comments for Property OrderID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long OrderID
        {
            get
            {
                return this._OrderID;
            }
            set
            {
                this.OnOrderIDChanging(value);
                this.ReportPropertyChanging("OrderID");
                this._OrderID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("OrderID");
                this.OnOrderIDChanged();
            }
        }
        private long _OrderID;
        partial void OnOrderIDChanging(long value);
        partial void OnOrderIDChanged();
        /// <summary>
        /// There are no comments for Property CustomsDescription in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string CustomsDescription
        {
            get
            {
                return this._CustomsDescription;
            }
            set
            {
                this.OnCustomsDescriptionChanging(value);
                this.ReportPropertyChanging("CustomsDescription");
                this._CustomsDescription = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("CustomsDescription");
                this.OnCustomsDescriptionChanged();
            }
        }
        private string _CustomsDescription;
        partial void OnCustomsDescriptionChanging(string value);
        partial void OnCustomsDescriptionChanged();
        /// <summary>
        /// There are no comments for Property ExciseTax in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public decimal ExciseTax
        {
            get
            {
                return this._ExciseTax;
            }
            set
            {
                this.OnExciseTaxChanging(value);
                this.ReportPropertyChanging("ExciseTax");
                this._ExciseTax = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("ExciseTax");
                this.OnExciseTaxChanged();
            }
        }
        private decimal _ExciseTax;
        partial void OnExciseTaxChanging(decimal value);
        partial void OnExciseTaxChanged();
        /// <summary>
        /// There are no comments for Orders in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public Orders Orders
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// There are no comments for Orders in the schema.
        /// </summary>
        [global::System.ComponentModel.BrowsableAttribute(false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders", value);
                }
            }
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.OrderDetails in the schema.
    /// </summary>
    /// <KeyProperties>
    /// OrderID
    /// ProductID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="OrderDetails")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class OrderDetails : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new OrderDetails object.
        /// </summary>
        /// <param name="orderID">Initial value of OrderID.</param>
        /// <param name="productID">Initial value of ProductID.</param>
        /// <param name="unitPrice">Initial value of UnitPrice.</param>
        /// <param name="quantity">Initial value of Quantity.</param>
        /// <param name="discount">Initial value of Discount.</param>
        public static OrderDetails CreateOrderDetails(long orderID, long productID, decimal unitPrice, short quantity, float discount)
        {
            OrderDetails orderDetails = new OrderDetails();
            orderDetails.OrderID = orderID;
            orderDetails.ProductID = productID;
            orderDetails.UnitPrice = unitPrice;
            orderDetails.Quantity = quantity;
            orderDetails.Discount = discount;
            return orderDetails;
        }
        /// <summary>
        /// There are no comments for Property OrderID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long OrderID
        {
            get
            {
                return this._OrderID;
            }
            set
            {
                this.OnOrderIDChanging(value);
                this.ReportPropertyChanging("OrderID");
                this._OrderID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("OrderID");
                this.OnOrderIDChanged();
            }
        }
        private long _OrderID;
        partial void OnOrderIDChanging(long value);
        partial void OnOrderIDChanged();
        /// <summary>
        /// There are no comments for Property ProductID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long ProductID
        {
            get
            {
                return this._ProductID;
            }
            set
            {
                this.OnProductIDChanging(value);
                this.ReportPropertyChanging("ProductID");
                this._ProductID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("ProductID");
                this.OnProductIDChanged();
            }
        }
        private long _ProductID;
        partial void OnProductIDChanging(long value);
        partial void OnProductIDChanged();
        /// <summary>
        /// There are no comments for Property UnitPrice in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public decimal UnitPrice
        {
            get
            {
                return this._UnitPrice;
            }
            set
            {
                this.OnUnitPriceChanging(value);
                this.ReportPropertyChanging("UnitPrice");
                this._UnitPrice = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("UnitPrice");
                this.OnUnitPriceChanged();
            }
        }
        private decimal _UnitPrice;
        partial void OnUnitPriceChanging(decimal value);
        partial void OnUnitPriceChanged();
        /// <summary>
        /// There are no comments for Property Quantity in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public short Quantity
        {
            get
            {
                return this._Quantity;
            }
            set
            {
                this.OnQuantityChanging(value);
                this.ReportPropertyChanging("Quantity");
                this._Quantity = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("Quantity");
                this.OnQuantityChanged();
            }
        }
        private short _Quantity;
        partial void OnQuantityChanging(short value);
        partial void OnQuantityChanged();
        /// <summary>
        /// There are no comments for Property Discount in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public float Discount
        {
            get
            {
                return this._Discount;
            }
            set
            {
                this.OnDiscountChanging(value);
                this.ReportPropertyChanging("Discount");
                this._Discount = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("Discount");
                this.OnDiscountChanged();
            }
        }
        private float _Discount;
        partial void OnDiscountChanging(float value);
        partial void OnDiscountChanged();
        /// <summary>
        /// There are no comments for Orders in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public Orders Orders
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// There are no comments for Orders in the schema.
        /// </summary>
        [global::System.ComponentModel.BrowsableAttribute(false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders", value);
                }
            }
        }
        /// <summary>
        /// There are no comments for Products in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public Products Products
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value;
            }
            set
            {
                ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value = value;
            }
        }
        /// <summary>
        /// There are no comments for Products in the schema.
        /// </summary>
        [global::System.ComponentModel.BrowsableAttribute(false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityReference<Products> ProductsReference
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products", value);
                }
            }
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.Orders in the schema.
    /// </summary>
    /// <KeyProperties>
    /// OrderID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Orders")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class Orders : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new Orders object.
        /// </summary>
        /// <param name="orderID">Initial value of OrderID.</param>
        public static Orders CreateOrders(long orderID)
        {
            Orders orders = new Orders();
            orders.OrderID = orderID;
            return orders;
        }
        /// <summary>
        /// There are no comments for Property OrderID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long OrderID
        {
            get
            {
                return this._OrderID;
            }
            set
            {
                this.OnOrderIDChanging(value);
                this.ReportPropertyChanging("OrderID");
                this._OrderID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("OrderID");
                this.OnOrderIDChanged();
            }
        }
        private long _OrderID;
        partial void OnOrderIDChanging(long value);
        partial void OnOrderIDChanged();
        /// <summary>
        /// There are no comments for Property EmployeeID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<long> EmployeeID
        {
            get
            {
                return this._EmployeeID;
            }
            set
            {
                this.OnEmployeeIDChanging(value);
                this.ReportPropertyChanging("EmployeeID");
                this._EmployeeID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("EmployeeID");
                this.OnEmployeeIDChanged();
            }
        }
        private global::System.Nullable<long> _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Nullable<long> value);
        partial void OnEmployeeIDChanged();
        /// <summary>
        /// There are no comments for Property OrderDate in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<global::System.DateTime> OrderDate
        {
            get
            {
                return this._OrderDate;
            }
            set
            {
                this.OnOrderDateChanging(value);
                this.ReportPropertyChanging("OrderDate");
                this._OrderDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("OrderDate");
                this.OnOrderDateChanged();
            }
        }
        private global::System.Nullable<global::System.DateTime> _OrderDate;
        partial void OnOrderDateChanging(global::System.Nullable<global::System.DateTime> value);
        partial void OnOrderDateChanged();
        /// <summary>
        /// There are no comments for Property RequiredDate in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<global::System.DateTime> RequiredDate
        {
            get
            {
                return this._RequiredDate;
            }
            set
            {
                this.OnRequiredDateChanging(value);
                this.ReportPropertyChanging("RequiredDate");
                this._RequiredDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("RequiredDate");
                this.OnRequiredDateChanged();
            }
        }
        private global::System.Nullable<global::System.DateTime> _RequiredDate;
        partial void OnRequiredDateChanging(global::System.Nullable<global::System.DateTime> value);
        partial void OnRequiredDateChanged();
        /// <summary>
        /// There are no comments for Property ShippedDate in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<global::System.DateTime> ShippedDate
        {
            get
            {
                return this._ShippedDate;
            }
            set
            {
                this.OnShippedDateChanging(value);
                this.ReportPropertyChanging("ShippedDate");
                this._ShippedDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("ShippedDate");
                this.OnShippedDateChanged();
            }
        }
        private global::System.Nullable<global::System.DateTime> _ShippedDate;
        partial void OnShippedDateChanging(global::System.Nullable<global::System.DateTime> value);
        partial void OnShippedDateChanged();
        /// <summary>
        /// There are no comments for Property Freight in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<decimal> Freight
        {
            get
            {
                return this._Freight;
            }
            set
            {
                this.OnFreightChanging(value);
                this.ReportPropertyChanging("Freight");
                this._Freight = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("Freight");
                this.OnFreightChanged();
            }
        }
        private global::System.Nullable<decimal> _Freight;
        partial void OnFreightChanging(global::System.Nullable<decimal> value);
        partial void OnFreightChanged();
        /// <summary>
        /// There are no comments for Property ShipName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ShipName
        {
            get
            {
                return this._ShipName;
            }
            set
            {
                this.OnShipNameChanging(value);
                this.ReportPropertyChanging("ShipName");
                this._ShipName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ShipName");
                this.OnShipNameChanged();
            }
        }
        private string _ShipName;
        partial void OnShipNameChanging(string value);
        partial void OnShipNameChanged();
        /// <summary>
        /// There are no comments for Property ShipAddress in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ShipAddress
        {
            get
            {
                return this._ShipAddress;
            }
            set
            {
                this.OnShipAddressChanging(value);
                this.ReportPropertyChanging("ShipAddress");
                this._ShipAddress = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ShipAddress");
                this.OnShipAddressChanged();
            }
        }
        private string _ShipAddress;
        partial void OnShipAddressChanging(string value);
        partial void OnShipAddressChanged();
        /// <summary>
        /// There are no comments for Property ShipCity in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ShipCity
        {
            get
            {
                return this._ShipCity;
            }
            set
            {
                this.OnShipCityChanging(value);
                this.ReportPropertyChanging("ShipCity");
                this._ShipCity = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ShipCity");
                this.OnShipCityChanged();
            }
        }
        private string _ShipCity;
        partial void OnShipCityChanging(string value);
        partial void OnShipCityChanged();
        /// <summary>
        /// There are no comments for Property ShipRegion in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ShipRegion
        {
            get
            {
                return this._ShipRegion;
            }
            set
            {
                this.OnShipRegionChanging(value);
                this.ReportPropertyChanging("ShipRegion");
                this._ShipRegion = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ShipRegion");
                this.OnShipRegionChanged();
            }
        }
        private string _ShipRegion;
        partial void OnShipRegionChanging(string value);
        partial void OnShipRegionChanged();
        /// <summary>
        /// There are no comments for Property ShipPostalCode in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ShipPostalCode
        {
            get
            {
                return this._ShipPostalCode;
            }
            set
            {
                this.OnShipPostalCodeChanging(value);
                this.ReportPropertyChanging("ShipPostalCode");
                this._ShipPostalCode = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ShipPostalCode");
                this.OnShipPostalCodeChanged();
            }
        }
        private string _ShipPostalCode;
        partial void OnShipPostalCodeChanging(string value);
        partial void OnShipPostalCodeChanged();
        /// <summary>
        /// There are no comments for Property ShipCountry in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ShipCountry
        {
            get
            {
                return this._ShipCountry;
            }
            set
            {
                this.OnShipCountryChanging(value);
                this.ReportPropertyChanging("ShipCountry");
                this._ShipCountry = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ShipCountry");
                this.OnShipCountryChanged();
            }
        }
        private string _ShipCountry;
        partial void OnShipCountryChanging(string value);
        partial void OnShipCountryChanged();
        /// <summary>
        /// There are no comments for Customers in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public Customers Customers
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value;
            }
            set
            {
                ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value = value;
            }
        }
        /// <summary>
        /// There are no comments for Customers in the schema.
        /// </summary>
        [global::System.ComponentModel.BrowsableAttribute(false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityReference<Customers> CustomersReference
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers", value);
                }
            }
        }
        /// <summary>
        /// There are no comments for InternationalOrders in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "InternationalOrders")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public InternationalOrders InternationalOrders
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value;
            }
            set
            {
                ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value = value;
            }
        }
        /// <summary>
        /// There are no comments for InternationalOrders in the schema.
        /// </summary>
        [global::System.ComponentModel.BrowsableAttribute(false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityReference<InternationalOrders> InternationalOrdersReference
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders", value);
                }
            }
        }
        /// <summary>
        /// There are no comments for OrderDetails in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "OrderDetails")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails", value);
                }
            }
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.PreviousEmployees in the schema.
    /// </summary>
    /// <KeyProperties>
    /// EmployeeID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="PreviousEmployees")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class PreviousEmployees : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new PreviousEmployees object.
        /// </summary>
        /// <param name="employeeID">Initial value of EmployeeID.</param>
        /// <param name="lastName">Initial value of LastName.</param>
        /// <param name="firstName">Initial value of FirstName.</param>
        public static PreviousEmployees CreatePreviousEmployees(long employeeID, string lastName, string firstName)
        {
            PreviousEmployees previousEmployees = new PreviousEmployees();
            previousEmployees.EmployeeID = employeeID;
            previousEmployees.LastName = lastName;
            previousEmployees.FirstName = firstName;
            return previousEmployees;
        }
        /// <summary>
        /// There are no comments for Property EmployeeID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long EmployeeID
        {
            get
            {
                return this._EmployeeID;
            }
            set
            {
                this.OnEmployeeIDChanging(value);
                this.ReportPropertyChanging("EmployeeID");
                this._EmployeeID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("EmployeeID");
                this.OnEmployeeIDChanged();
            }
        }
        private long _EmployeeID;
        partial void OnEmployeeIDChanging(long value);
        partial void OnEmployeeIDChanged();
        /// <summary>
        /// There are no comments for Property LastName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string LastName
        {
            get
            {
                return this._LastName;
            }
            set
            {
                this.OnLastNameChanging(value);
                this.ReportPropertyChanging("LastName");
                this._LastName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("LastName");
                this.OnLastNameChanged();
            }
        }
        private string _LastName;
        partial void OnLastNameChanging(string value);
        partial void OnLastNameChanged();
        /// <summary>
        /// There are no comments for Property FirstName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string FirstName
        {
            get
            {
                return this._FirstName;
            }
            set
            {
                this.OnFirstNameChanging(value);
                this.ReportPropertyChanging("FirstName");
                this._FirstName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("FirstName");
                this.OnFirstNameChanged();
            }
        }
        private string _FirstName;
        partial void OnFirstNameChanging(string value);
        partial void OnFirstNameChanged();
        /// <summary>
        /// There are no comments for Property Title in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Title
        {
            get
            {
                return this._Title;
            }
            set
            {
                this.OnTitleChanging(value);
                this.ReportPropertyChanging("Title");
                this._Title = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Title");
                this.OnTitleChanged();
            }
        }
        private string _Title;
        partial void OnTitleChanging(string value);
        partial void OnTitleChanged();
        /// <summary>
        /// There are no comments for Property TitleOfCourtesy in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string TitleOfCourtesy
        {
            get
            {
                return this._TitleOfCourtesy;
            }
            set
            {
                this.OnTitleOfCourtesyChanging(value);
                this.ReportPropertyChanging("TitleOfCourtesy");
                this._TitleOfCourtesy = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("TitleOfCourtesy");
                this.OnTitleOfCourtesyChanged();
            }
        }
        private string _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(string value);
        partial void OnTitleOfCourtesyChanged();
        /// <summary>
        /// There are no comments for Property BirthDate in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return this._BirthDate;
            }
            set
            {
                this.OnBirthDateChanging(value);
                this.ReportPropertyChanging("BirthDate");
                this._BirthDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("BirthDate");
                this.OnBirthDateChanged();
            }
        }
        private global::System.Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(global::System.Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();
        /// <summary>
        /// There are no comments for Property HireDate in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return this._HireDate;
            }
            set
            {
                this.OnHireDateChanging(value);
                this.ReportPropertyChanging("HireDate");
                this._HireDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("HireDate");
                this.OnHireDateChanged();
            }
        }
        private global::System.Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(global::System.Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();
        /// <summary>
        /// There are no comments for Property Address in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Address
        {
            get
            {
                return this._Address;
            }
            set
            {
                this.OnAddressChanging(value);
                this.ReportPropertyChanging("Address");
                this._Address = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Address");
                this.OnAddressChanged();
            }
        }
        private string _Address;
        partial void OnAddressChanging(string value);
        partial void OnAddressChanged();
        /// <summary>
        /// There are no comments for Property City in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string City
        {
            get
            {
                return this._City;
            }
            set
            {
                this.OnCityChanging(value);
                this.ReportPropertyChanging("City");
                this._City = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("City");
                this.OnCityChanged();
            }
        }
        private string _City;
        partial void OnCityChanging(string value);
        partial void OnCityChanged();
        /// <summary>
        /// There are no comments for Property Region in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Region
        {
            get
            {
                return this._Region;
            }
            set
            {
                this.OnRegionChanging(value);
                this.ReportPropertyChanging("Region");
                this._Region = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Region");
                this.OnRegionChanged();
            }
        }
        private string _Region;
        partial void OnRegionChanging(string value);
        partial void OnRegionChanged();
        /// <summary>
        /// There are no comments for Property PostalCode in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string PostalCode
        {
            get
            {
                return this._PostalCode;
            }
            set
            {
                this.OnPostalCodeChanging(value);
                this.ReportPropertyChanging("PostalCode");
                this._PostalCode = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("PostalCode");
                this.OnPostalCodeChanged();
            }
        }
        private string _PostalCode;
        partial void OnPostalCodeChanging(string value);
        partial void OnPostalCodeChanged();
        /// <summary>
        /// There are no comments for Property Country in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Country
        {
            get
            {
                return this._Country;
            }
            set
            {
                this.OnCountryChanging(value);
                this.ReportPropertyChanging("Country");
                this._Country = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Country");
                this.OnCountryChanged();
            }
        }
        private string _Country;
        partial void OnCountryChanging(string value);
        partial void OnCountryChanged();
        /// <summary>
        /// There are no comments for Property HomePhone in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string HomePhone
        {
            get
            {
                return this._HomePhone;
            }
            set
            {
                this.OnHomePhoneChanging(value);
                this.ReportPropertyChanging("HomePhone");
                this._HomePhone = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("HomePhone");
                this.OnHomePhoneChanged();
            }
        }
        private string _HomePhone;
        partial void OnHomePhoneChanging(string value);
        partial void OnHomePhoneChanged();
        /// <summary>
        /// There are no comments for Property Extension in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Extension
        {
            get
            {
                return this._Extension;
            }
            set
            {
                this.OnExtensionChanging(value);
                this.ReportPropertyChanging("Extension");
                this._Extension = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Extension");
                this.OnExtensionChanged();
            }
        }
        private string _Extension;
        partial void OnExtensionChanging(string value);
        partial void OnExtensionChanged();
        /// <summary>
        /// There are no comments for Property Photo in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public byte[] Photo
        {
            get
            {
                return global::System.Data.Objects.DataClasses.StructuralObject.GetValidValue(this._Photo);
            }
            set
            {
                this.OnPhotoChanging(value);
                this.ReportPropertyChanging("Photo");
                this._Photo = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Photo");
                this.OnPhotoChanged();
            }
        }
        private byte[] _Photo;
        partial void OnPhotoChanging(byte[] value);
        partial void OnPhotoChanged();
        /// <summary>
        /// There are no comments for Property Notes in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Notes
        {
            get
            {
                return this._Notes;
            }
            set
            {
                this.OnNotesChanging(value);
                this.ReportPropertyChanging("Notes");
                this._Notes = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Notes");
                this.OnNotesChanged();
            }
        }
        private string _Notes;
        partial void OnNotesChanging(string value);
        partial void OnNotesChanged();
        /// <summary>
        /// There are no comments for Property PhotoPath in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string PhotoPath
        {
            get
            {
                return this._PhotoPath;
            }
            set
            {
                this.OnPhotoPathChanging(value);
                this.ReportPropertyChanging("PhotoPath");
                this._PhotoPath = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("PhotoPath");
                this.OnPhotoPathChanged();
            }
        }
        private string _PhotoPath;
        partial void OnPhotoPathChanging(string value);
        partial void OnPhotoPathChanged();
    }
    /// <summary>
    /// There are no comments for northwindEFModel.Products in the schema.
    /// </summary>
    /// <KeyProperties>
    /// ProductID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Products")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class Products : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new Products object.
        /// </summary>
        /// <param name="productID">Initial value of ProductID.</param>
        /// <param name="productName">Initial value of ProductName.</param>
        /// <param name="discontinued">Initial value of Discontinued.</param>
        public static Products CreateProducts(long productID, string productName, bool discontinued)
        {
            Products products = new Products();
            products.ProductID = productID;
            products.ProductName = productName;
            products.Discontinued = discontinued;
            return products;
        }
        /// <summary>
        /// There are no comments for Property ProductID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long ProductID
        {
            get
            {
                return this._ProductID;
            }
            set
            {
                this.OnProductIDChanging(value);
                this.ReportPropertyChanging("ProductID");
                this._ProductID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("ProductID");
                this.OnProductIDChanged();
            }
        }
        private long _ProductID;
        partial void OnProductIDChanging(long value);
        partial void OnProductIDChanged();
        /// <summary>
        /// There are no comments for Property ProductName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ProductName
        {
            get
            {
                return this._ProductName;
            }
            set
            {
                this.OnProductNameChanging(value);
                this.ReportPropertyChanging("ProductName");
                this._ProductName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("ProductName");
                this.OnProductNameChanged();
            }
        }
        private string _ProductName;
        partial void OnProductNameChanging(string value);
        partial void OnProductNameChanged();
        /// <summary>
        /// There are no comments for Property QuantityPerUnit in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string QuantityPerUnit
        {
            get
            {
                return this._QuantityPerUnit;
            }
            set
            {
                this.OnQuantityPerUnitChanging(value);
                this.ReportPropertyChanging("QuantityPerUnit");
                this._QuantityPerUnit = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("QuantityPerUnit");
                this.OnQuantityPerUnitChanged();
            }
        }
        private string _QuantityPerUnit;
        partial void OnQuantityPerUnitChanging(string value);
        partial void OnQuantityPerUnitChanged();
        /// <summary>
        /// There are no comments for Property UnitPrice in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<decimal> UnitPrice
        {
            get
            {
                return this._UnitPrice;
            }
            set
            {
                this.OnUnitPriceChanging(value);
                this.ReportPropertyChanging("UnitPrice");
                this._UnitPrice = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("UnitPrice");
                this.OnUnitPriceChanged();
            }
        }
        private global::System.Nullable<decimal> _UnitPrice;
        partial void OnUnitPriceChanging(global::System.Nullable<decimal> value);
        partial void OnUnitPriceChanged();
        /// <summary>
        /// There are no comments for Property UnitsInStock in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<short> UnitsInStock
        {
            get
            {
                return this._UnitsInStock;
            }
            set
            {
                this.OnUnitsInStockChanging(value);
                this.ReportPropertyChanging("UnitsInStock");
                this._UnitsInStock = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("UnitsInStock");
                this.OnUnitsInStockChanged();
            }
        }
        private global::System.Nullable<short> _UnitsInStock;
        partial void OnUnitsInStockChanging(global::System.Nullable<short> value);
        partial void OnUnitsInStockChanged();
        /// <summary>
        /// There are no comments for Property UnitsOnOrder in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<short> UnitsOnOrder
        {
            get
            {
                return this._UnitsOnOrder;
            }
            set
            {
                this.OnUnitsOnOrderChanging(value);
                this.ReportPropertyChanging("UnitsOnOrder");
                this._UnitsOnOrder = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("UnitsOnOrder");
                this.OnUnitsOnOrderChanged();
            }
        }
        private global::System.Nullable<short> _UnitsOnOrder;
        partial void OnUnitsOnOrderChanging(global::System.Nullable<short> value);
        partial void OnUnitsOnOrderChanged();
        /// <summary>
        /// There are no comments for Property ReorderLevel in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<short> ReorderLevel
        {
            get
            {
                return this._ReorderLevel;
            }
            set
            {
                this.OnReorderLevelChanging(value);
                this.ReportPropertyChanging("ReorderLevel");
                this._ReorderLevel = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("ReorderLevel");
                this.OnReorderLevelChanged();
            }
        }
        private global::System.Nullable<short> _ReorderLevel;
        partial void OnReorderLevelChanging(global::System.Nullable<short> value);
        partial void OnReorderLevelChanged();
        /// <summary>
        /// There are no comments for Property Discontinued in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public bool Discontinued
        {
            get
            {
                return this._Discontinued;
            }
            set
            {
                this.OnDiscontinuedChanging(value);
                this.ReportPropertyChanging("Discontinued");
                this._Discontinued = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("Discontinued");
                this.OnDiscontinuedChanged();
            }
        }
        private bool _Discontinued;
        partial void OnDiscontinuedChanging(bool value);
        partial void OnDiscontinuedChanged();
        /// <summary>
        /// There are no comments for Property DiscontinuedDate in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<global::System.DateTime> DiscontinuedDate
        {
            get
            {
                return this._DiscontinuedDate;
            }
            set
            {
                this.OnDiscontinuedDateChanging(value);
                this.ReportPropertyChanging("DiscontinuedDate");
                this._DiscontinuedDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("DiscontinuedDate");
                this.OnDiscontinuedDateChanged();
            }
        }
        private global::System.Nullable<global::System.DateTime> _DiscontinuedDate;
        partial void OnDiscontinuedDateChanging(global::System.Nullable<global::System.DateTime> value);
        partial void OnDiscontinuedDateChanged();
        /// <summary>
        /// There are no comments for Categories in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public Categories Categories
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value;
            }
            set
            {
                ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value = value;
            }
        }
        /// <summary>
        /// There are no comments for Categories in the schema.
        /// </summary>
        [global::System.ComponentModel.BrowsableAttribute(false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityReference<Categories> CategoriesReference
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories", value);
                }
            }
        }
        /// <summary>
        /// There are no comments for OrderDetails in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "OrderDetails")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails", value);
                }
            }
        }
        /// <summary>
        /// There are no comments for Suppliers in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public Suppliers Suppliers
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value;
            }
            set
            {
                ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value = value;
            }
        }
        /// <summary>
        /// There are no comments for Suppliers in the schema.
        /// </summary>
        [global::System.ComponentModel.BrowsableAttribute(false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityReference<Suppliers> SuppliersReference
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers", value);
                }
            }
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.Regions in the schema.
    /// </summary>
    /// <KeyProperties>
    /// RegionID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Regions")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class Regions : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new Regions object.
        /// </summary>
        /// <param name="regionID">Initial value of RegionID.</param>
        /// <param name="regionDescription">Initial value of RegionDescription.</param>
        public static Regions CreateRegions(long regionID, string regionDescription)
        {
            Regions regions = new Regions();
            regions.RegionID = regionID;
            regions.RegionDescription = regionDescription;
            return regions;
        }
        /// <summary>
        /// There are no comments for Property RegionID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long RegionID
        {
            get
            {
                return this._RegionID;
            }
            set
            {
                this.OnRegionIDChanging(value);
                this.ReportPropertyChanging("RegionID");
                this._RegionID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("RegionID");
                this.OnRegionIDChanged();
            }
        }
        private long _RegionID;
        partial void OnRegionIDChanging(long value);
        partial void OnRegionIDChanged();
        /// <summary>
        /// There are no comments for Property RegionDescription in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string RegionDescription
        {
            get
            {
                return this._RegionDescription;
            }
            set
            {
                this.OnRegionDescriptionChanging(value);
                this.ReportPropertyChanging("RegionDescription");
                this._RegionDescription = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("RegionDescription");
                this.OnRegionDescriptionChanged();
            }
        }
        private string _RegionDescription;
        partial void OnRegionDescriptionChanging(string value);
        partial void OnRegionDescriptionChanged();
        /// <summary>
        /// There are no comments for Territories in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Territories")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityCollection<Territories> Territories
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories", value);
                }
            }
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.Suppliers in the schema.
    /// </summary>
    /// <KeyProperties>
    /// SupplierID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Suppliers")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class Suppliers : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new Suppliers object.
        /// </summary>
        /// <param name="supplierID">Initial value of SupplierID.</param>
        /// <param name="companyName">Initial value of CompanyName.</param>
        public static Suppliers CreateSuppliers(long supplierID, string companyName)
        {
            Suppliers suppliers = new Suppliers();
            suppliers.SupplierID = supplierID;
            suppliers.CompanyName = companyName;
            return suppliers;
        }
        /// <summary>
        /// There are no comments for Property SupplierID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long SupplierID
        {
            get
            {
                return this._SupplierID;
            }
            set
            {
                this.OnSupplierIDChanging(value);
                this.ReportPropertyChanging("SupplierID");
                this._SupplierID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("SupplierID");
                this.OnSupplierIDChanged();
            }
        }
        private long _SupplierID;
        partial void OnSupplierIDChanging(long value);
        partial void OnSupplierIDChanged();
        /// <summary>
        /// There are no comments for Property CompanyName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string CompanyName
        {
            get
            {
                return this._CompanyName;
            }
            set
            {
                this.OnCompanyNameChanging(value);
                this.ReportPropertyChanging("CompanyName");
                this._CompanyName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("CompanyName");
                this.OnCompanyNameChanged();
            }
        }
        private string _CompanyName;
        partial void OnCompanyNameChanging(string value);
        partial void OnCompanyNameChanged();
        /// <summary>
        /// There are no comments for Property ContactName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ContactName
        {
            get
            {
                return this._ContactName;
            }
            set
            {
                this.OnContactNameChanging(value);
                this.ReportPropertyChanging("ContactName");
                this._ContactName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ContactName");
                this.OnContactNameChanged();
            }
        }
        private string _ContactName;
        partial void OnContactNameChanging(string value);
        partial void OnContactNameChanged();
        /// <summary>
        /// There are no comments for Property ContactTitle in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ContactTitle
        {
            get
            {
                return this._ContactTitle;
            }
            set
            {
                this.OnContactTitleChanging(value);
                this.ReportPropertyChanging("ContactTitle");
                this._ContactTitle = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ContactTitle");
                this.OnContactTitleChanged();
            }
        }
        private string _ContactTitle;
        partial void OnContactTitleChanging(string value);
        partial void OnContactTitleChanged();
        /// <summary>
        /// There are no comments for Property Address in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Address
        {
            get
            {
                return this._Address;
            }
            set
            {
                this.OnAddressChanging(value);
                this.ReportPropertyChanging("Address");
                this._Address = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Address");
                this.OnAddressChanged();
            }
        }
        private string _Address;
        partial void OnAddressChanging(string value);
        partial void OnAddressChanged();
        /// <summary>
        /// There are no comments for Property City in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string City
        {
            get
            {
                return this._City;
            }
            set
            {
                this.OnCityChanging(value);
                this.ReportPropertyChanging("City");
                this._City = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("City");
                this.OnCityChanged();
            }
        }
        private string _City;
        partial void OnCityChanging(string value);
        partial void OnCityChanged();
        /// <summary>
        /// There are no comments for Property Region in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Region
        {
            get
            {
                return this._Region;
            }
            set
            {
                this.OnRegionChanging(value);
                this.ReportPropertyChanging("Region");
                this._Region = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Region");
                this.OnRegionChanged();
            }
        }
        private string _Region;
        partial void OnRegionChanging(string value);
        partial void OnRegionChanged();
        /// <summary>
        /// There are no comments for Property PostalCode in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string PostalCode
        {
            get
            {
                return this._PostalCode;
            }
            set
            {
                this.OnPostalCodeChanging(value);
                this.ReportPropertyChanging("PostalCode");
                this._PostalCode = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("PostalCode");
                this.OnPostalCodeChanged();
            }
        }
        private string _PostalCode;
        partial void OnPostalCodeChanging(string value);
        partial void OnPostalCodeChanged();
        /// <summary>
        /// There are no comments for Property Country in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Country
        {
            get
            {
                return this._Country;
            }
            set
            {
                this.OnCountryChanging(value);
                this.ReportPropertyChanging("Country");
                this._Country = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Country");
                this.OnCountryChanged();
            }
        }
        private string _Country;
        partial void OnCountryChanging(string value);
        partial void OnCountryChanged();
        /// <summary>
        /// There are no comments for Property Phone in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Phone
        {
            get
            {
                return this._Phone;
            }
            set
            {
                this.OnPhoneChanging(value);
                this.ReportPropertyChanging("Phone");
                this._Phone = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Phone");
                this.OnPhoneChanged();
            }
        }
        private string _Phone;
        partial void OnPhoneChanging(string value);
        partial void OnPhoneChanged();
        /// <summary>
        /// There are no comments for Property Fax in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Fax
        {
            get
            {
                return this._Fax;
            }
            set
            {
                this.OnFaxChanging(value);
                this.ReportPropertyChanging("Fax");
                this._Fax = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Fax");
                this.OnFaxChanged();
            }
        }
        private string _Fax;
        partial void OnFaxChanging(string value);
        partial void OnFaxChanged();
        /// <summary>
        /// There are no comments for Property HomePage in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string HomePage
        {
            get
            {
                return this._HomePage;
            }
            set
            {
                this.OnHomePageChanging(value);
                this.ReportPropertyChanging("HomePage");
                this._HomePage = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("HomePage");
                this.OnHomePageChanged();
            }
        }
        private string _HomePage;
        partial void OnHomePageChanging(string value);
        partial void OnHomePageChanged();
        /// <summary>
        /// There are no comments for Products in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Products")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityCollection<Products> Products
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products", value);
                }
            }
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.Territories in the schema.
    /// </summary>
    /// <KeyProperties>
    /// TerritoryID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Territories")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class Territories : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new Territories object.
        /// </summary>
        /// <param name="territoryID">Initial value of TerritoryID.</param>
        /// <param name="territoryDescription">Initial value of TerritoryDescription.</param>
        public static Territories CreateTerritories(long territoryID, string territoryDescription)
        {
            Territories territories = new Territories();
            territories.TerritoryID = territoryID;
            territories.TerritoryDescription = territoryDescription;
            return territories;
        }
        /// <summary>
        /// There are no comments for Property TerritoryID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long TerritoryID
        {
            get
            {
                return this._TerritoryID;
            }
            set
            {
                this.OnTerritoryIDChanging(value);
                this.ReportPropertyChanging("TerritoryID");
                this._TerritoryID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("TerritoryID");
                this.OnTerritoryIDChanged();
            }
        }
        private long _TerritoryID;
        partial void OnTerritoryIDChanging(long value);
        partial void OnTerritoryIDChanged();
        /// <summary>
        /// There are no comments for Property TerritoryDescription in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string TerritoryDescription
        {
            get
            {
                return this._TerritoryDescription;
            }
            set
            {
                this.OnTerritoryDescriptionChanging(value);
                this.ReportPropertyChanging("TerritoryDescription");
                this._TerritoryDescription = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("TerritoryDescription");
                this.OnTerritoryDescriptionChanged();
            }
        }
        private string _TerritoryDescription;
        partial void OnTerritoryDescriptionChanging(string value);
        partial void OnTerritoryDescriptionChanged();
        /// <summary>
        /// There are no comments for Regions in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public Regions Regions
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value;
            }
            set
            {
                ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value = value;
            }
        }
        /// <summary>
        /// There are no comments for Regions in the schema.
        /// </summary>
        [global::System.ComponentModel.BrowsableAttribute(false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityReference<Regions> RegionsReference
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions", value);
                }
            }
        }
        /// <summary>
        /// There are no comments for Employees in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Employees")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityCollection<Employees> Employees
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees", value);
                }
            }
        }
    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Added testlinq/NorthwindModel.EF6.2010.Designer.cs.





































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

//------------------------------------------------------------------------------
// <auto-generated>
//    This code was generated from a template.
//
//    Manual changes to this file may cause unexpected behavior in your application.
//    Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.ComponentModel;
using System.Data.Entity.Core.EntityClient;
using System.Data.Entity.Core.Metadata.Edm;
using System.Data.Entity.Core.Objects;
using System.Data.Entity.Core.Objects.DataClasses;
using System.Runtime.Serialization;
using System.Xml.Serialization;

[assembly: EdmSchemaAttribute()]
#region EDM Relationship Metadata

[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Categories), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Customers), "Orders", RelationshipMultiplicity.Many, typeof(testlinq.Orders))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "InternationalOrders", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.InternationalOrders), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products", RelationshipMultiplicity.One, typeof(testlinq.Products), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Suppliers), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions", RelationshipMultiplicity.One, typeof(testlinq.Regions), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "EmployeesTerritories", "Employees", RelationshipMultiplicity.Many, typeof(testlinq.Employees), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]

#endregion

namespace testlinq
{
    #region Contexts

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    public partial class northwindEFEntities : ObjectContext
    {
        #region Constructors

        /// <summary>
        /// Initializes a new northwindEFEntities object using the connection string found in the 'northwindEFEntities' section of the application configuration file.
        /// </summary>
        public northwindEFEntities() : base("name=northwindEFEntities", "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(string connectionString) : base(connectionString, "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(EntityConnection connection) : base(connection, "northwindEFEntities")
        {
            OnContextCreated();
        }

        #endregion

        #region Partial Methods

        partial void OnContextCreated();

        #endregion

        #region ObjectSet Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Categories> Categories
        {
            get
            {
                if ((_Categories == null))
                {
                    _Categories = base.CreateObjectSet<Categories>("Categories");
                }
                return _Categories;
            }
        }
        private ObjectSet<Categories> _Categories;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Customers> Customers
        {
            get
            {
                if ((_Customers == null))
                {
                    _Customers = base.CreateObjectSet<Customers>("Customers");
                }
                return _Customers;
            }
        }
        private ObjectSet<Customers> _Customers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Employees> Employees
        {
            get
            {
                if ((_Employees == null))
                {
                    _Employees = base.CreateObjectSet<Employees>("Employees");
                }
                return _Employees;
            }
        }
        private ObjectSet<Employees> _Employees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<InternationalOrders> InternationalOrders
        {
            get
            {
                if ((_InternationalOrders == null))
                {
                    _InternationalOrders = base.CreateObjectSet<InternationalOrders>("InternationalOrders");
                }
                return _InternationalOrders;
            }
        }
        private ObjectSet<InternationalOrders> _InternationalOrders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<OrderDetails> OrderDetails
        {
            get
            {
                if ((_OrderDetails == null))
                {
                    _OrderDetails = base.CreateObjectSet<OrderDetails>("OrderDetails");
                }
                return _OrderDetails;
            }
        }
        private ObjectSet<OrderDetails> _OrderDetails;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Orders> Orders
        {
            get
            {
                if ((_Orders == null))
                {
                    _Orders = base.CreateObjectSet<Orders>("Orders");
                }
                return _Orders;
            }
        }
        private ObjectSet<Orders> _Orders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<PreviousEmployees> PreviousEmployees
        {
            get
            {
                if ((_PreviousEmployees == null))
                {
                    _PreviousEmployees = base.CreateObjectSet<PreviousEmployees>("PreviousEmployees");
                }
                return _PreviousEmployees;
            }
        }
        private ObjectSet<PreviousEmployees> _PreviousEmployees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Products> Products
        {
            get
            {
                if ((_Products == null))
                {
                    _Products = base.CreateObjectSet<Products>("Products");
                }
                return _Products;
            }
        }
        private ObjectSet<Products> _Products;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Regions> Regions
        {
            get
            {
                if ((_Regions == null))
                {
                    _Regions = base.CreateObjectSet<Regions>("Regions");
                }
                return _Regions;
            }
        }
        private ObjectSet<Regions> _Regions;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Suppliers> Suppliers
        {
            get
            {
                if ((_Suppliers == null))
                {
                    _Suppliers = base.CreateObjectSet<Suppliers>("Suppliers");
                }
                return _Suppliers;
            }
        }
        private ObjectSet<Suppliers> _Suppliers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Territories> Territories
        {
            get
            {
                if ((_Territories == null))
                {
                    _Territories = base.CreateObjectSet<Territories>("Territories");
                }
                return _Territories;
            }
        }
        private ObjectSet<Territories> _Territories;

        #endregion
        #region AddTo Methods

        /// <summary>
        /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCategories(Categories categories)
        {
            base.AddObject("Categories", categories);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Customers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCustomers(Customers customers)
        {
            base.AddObject("Customers", customers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Employees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToEmployees(Employees employees)
        {
            base.AddObject("Employees", employees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the InternationalOrders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToInternationalOrders(InternationalOrders internationalOrders)
        {
            base.AddObject("InternationalOrders", internationalOrders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the OrderDetails EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrderDetails(OrderDetails orderDetails)
        {
            base.AddObject("OrderDetails", orderDetails);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Orders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrders(Orders orders)
        {
            base.AddObject("Orders", orders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the PreviousEmployees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToPreviousEmployees(PreviousEmployees previousEmployees)
        {
            base.AddObject("PreviousEmployees", previousEmployees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToProducts(Products products)
        {
            base.AddObject("Products", products);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Regions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToRegions(Regions regions)
        {
            base.AddObject("Regions", regions);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Suppliers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToSuppliers(Suppliers suppliers)
        {
            base.AddObject("Suppliers", suppliers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Territories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToTerritories(Territories territories)
        {
            base.AddObject("Territories", territories);
        }

        #endregion
    }


    #endregion

    #region Entities

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Categories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Categories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Categories object.
        /// </summary>
        /// <param name="categoryID">Initial value of the CategoryID property.</param>
        /// <param name="categoryName">Initial value of the CategoryName property.</param>
        public static Categories CreateCategories(global::System.Int64 categoryID, global::System.String categoryName)
        {
            Categories categories = new Categories();
            categories.CategoryID = categoryID;
            categories.CategoryName = categoryName;
            return categories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 CategoryID
        {
            get
            {
                return _CategoryID;
            }
            set
            {
                if (_CategoryID != value)
                {
                    OnCategoryIDChanging(value);
                    ReportPropertyChanging("CategoryID");
                    _CategoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("CategoryID");
                    OnCategoryIDChanged();
                }
            }
        }
        private global::System.Int64 _CategoryID;
        partial void OnCategoryIDChanging(global::System.Int64 value);
        partial void OnCategoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CategoryName
        {
            get
            {
                return _CategoryName;
            }
            set
            {
                OnCategoryNameChanging(value);
                ReportPropertyChanging("CategoryName");
                _CategoryName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CategoryName");
                OnCategoryNameChanged();
            }
        }
        private global::System.String _CategoryName;
        partial void OnCategoryNameChanging(global::System.String value);
        partial void OnCategoryNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Description
        {
            get
            {
                return _Description;
            }
            set
            {
                OnDescriptionChanging(value);
                ReportPropertyChanging("Description");
                _Description = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Description");
                OnDescriptionChanged();
            }
        }
        private global::System.String _Description;
        partial void OnDescriptionChanging(global::System.String value);
        partial void OnDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Picture
        {
            get
            {
                return StructuralObject.GetValidValue(_Picture);
            }
            set
            {
                OnPictureChanging(value);
                ReportPropertyChanging("Picture");
                _Picture = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Picture");
                OnPictureChanged();
            }
        }
        private global::System.Byte[] _Picture;
        partial void OnPictureChanging(global::System.Byte[] value);
        partial void OnPictureChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Customers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Customers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Customers object.
        /// </summary>
        /// <param name="customerID">Initial value of the CustomerID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Customers CreateCustomers(global::System.String customerID, global::System.String companyName)
        {
            Customers customers = new Customers();
            customers.CustomerID = customerID;
            customers.CompanyName = companyName;
            return customers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomerID
        {
            get
            {
                return _CustomerID;
            }
            set
            {
                if (_CustomerID != value)
                {
                    OnCustomerIDChanging(value);
                    ReportPropertyChanging("CustomerID");
                    _CustomerID = StructuralObject.SetValidValue(value, false);
                    ReportPropertyChanged("CustomerID");
                    OnCustomerIDChanged();
                }
            }
        }
        private global::System.String _CustomerID;
        partial void OnCustomerIDChanging(global::System.String value);
        partial void OnCustomerIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Orders")]
        public EntityCollection<Orders> Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Employees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Employees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Employees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static Employees CreateEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            Employees employees = new Employees();
            employees.EmployeeID = employeeID;
            employees.LastName = lastName;
            employees.FirstName = firstName;
            return employees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="InternationalOrders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class InternationalOrders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new InternationalOrders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="customsDescription">Initial value of the CustomsDescription property.</param>
        /// <param name="exciseTax">Initial value of the ExciseTax property.</param>
        public static InternationalOrders CreateInternationalOrders(global::System.Int64 orderID, global::System.String customsDescription, global::System.Decimal exciseTax)
        {
            InternationalOrders internationalOrders = new InternationalOrders();
            internationalOrders.OrderID = orderID;
            internationalOrders.CustomsDescription = customsDescription;
            internationalOrders.ExciseTax = exciseTax;
            return internationalOrders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomsDescription
        {
            get
            {
                return _CustomsDescription;
            }
            set
            {
                OnCustomsDescriptionChanging(value);
                ReportPropertyChanging("CustomsDescription");
                _CustomsDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CustomsDescription");
                OnCustomsDescriptionChanged();
            }
        }
        private global::System.String _CustomsDescription;
        partial void OnCustomsDescriptionChanging(global::System.String value);
        partial void OnCustomsDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal ExciseTax
        {
            get
            {
                return _ExciseTax;
            }
            set
            {
                OnExciseTaxChanging(value);
                ReportPropertyChanging("ExciseTax");
                _ExciseTax = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ExciseTax");
                OnExciseTaxChanged();
            }
        }
        private global::System.Decimal _ExciseTax;
        partial void OnExciseTaxChanging(global::System.Decimal value);
        partial void OnExciseTaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="OrderDetails")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class OrderDetails : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new OrderDetails object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="unitPrice">Initial value of the UnitPrice property.</param>
        /// <param name="quantity">Initial value of the Quantity property.</param>
        /// <param name="discount">Initial value of the Discount property.</param>
        public static OrderDetails CreateOrderDetails(global::System.Int64 orderID, global::System.Int64 productID, global::System.Decimal unitPrice, global::System.Int16 quantity, global::System.Single discount)
        {
            OrderDetails orderDetails = new OrderDetails();
            orderDetails.OrderID = orderID;
            orderDetails.ProductID = productID;
            orderDetails.UnitPrice = unitPrice;
            orderDetails.Quantity = quantity;
            orderDetails.Discount = discount;
            return orderDetails;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private global::System.Decimal _UnitPrice;
        partial void OnUnitPriceChanging(global::System.Decimal value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int16 Quantity
        {
            get
            {
                return _Quantity;
            }
            set
            {
                OnQuantityChanging(value);
                ReportPropertyChanging("Quantity");
                _Quantity = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Quantity");
                OnQuantityChanged();
            }
        }
        private global::System.Int16 _Quantity;
        partial void OnQuantityChanging(global::System.Int16 value);
        partial void OnQuantityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Single Discount
        {
            get
            {
                return _Discount;
            }
            set
            {
                OnDiscountChanging(value);
                ReportPropertyChanging("Discount");
                _Discount = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discount");
                OnDiscountChanged();
            }
        }
        private global::System.Single _Discount;
        partial void OnDiscountChanging(global::System.Single value);
        partial void OnDiscountChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products")]
        public Products Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Products> ProductsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Orders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Orders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Orders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        public static Orders CreateOrders(global::System.Int64 orderID)
        {
            Orders orders = new Orders();
            orders.OrderID = orderID;
            return orders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int64> EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                OnEmployeeIDChanging(value);
                ReportPropertyChanging("EmployeeID");
                _EmployeeID = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("EmployeeID");
                OnEmployeeIDChanged();
            }
        }
        private Nullable<global::System.Int64> _EmployeeID;
        partial void OnEmployeeIDChanging(Nullable<global::System.Int64> value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> OrderDate
        {
            get
            {
                return _OrderDate;
            }
            set
            {
                OnOrderDateChanging(value);
                ReportPropertyChanging("OrderDate");
                _OrderDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("OrderDate");
                OnOrderDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _OrderDate;
        partial void OnOrderDateChanging(Nullable<global::System.DateTime> value);
        partial void OnOrderDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> RequiredDate
        {
            get
            {
                return _RequiredDate;
            }
            set
            {
                OnRequiredDateChanging(value);
                ReportPropertyChanging("RequiredDate");
                _RequiredDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("RequiredDate");
                OnRequiredDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _RequiredDate;
        partial void OnRequiredDateChanging(Nullable<global::System.DateTime> value);
        partial void OnRequiredDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> ShippedDate
        {
            get
            {
                return _ShippedDate;
            }
            set
            {
                OnShippedDateChanging(value);
                ReportPropertyChanging("ShippedDate");
                _ShippedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ShippedDate");
                OnShippedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _ShippedDate;
        partial void OnShippedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnShippedDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> Freight
        {
            get
            {
                return _Freight;
            }
            set
            {
                OnFreightChanging(value);
                ReportPropertyChanging("Freight");
                _Freight = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Freight");
                OnFreightChanged();
            }
        }
        private Nullable<global::System.Decimal> _Freight;
        partial void OnFreightChanging(Nullable<global::System.Decimal> value);
        partial void OnFreightChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipName
        {
            get
            {
                return _ShipName;
            }
            set
            {
                OnShipNameChanging(value);
                ReportPropertyChanging("ShipName");
                _ShipName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipName");
                OnShipNameChanged();
            }
        }
        private global::System.String _ShipName;
        partial void OnShipNameChanging(global::System.String value);
        partial void OnShipNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipAddress
        {
            get
            {
                return _ShipAddress;
            }
            set
            {
                OnShipAddressChanging(value);
                ReportPropertyChanging("ShipAddress");
                _ShipAddress = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipAddress");
                OnShipAddressChanged();
            }
        }
        private global::System.String _ShipAddress;
        partial void OnShipAddressChanging(global::System.String value);
        partial void OnShipAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCity
        {
            get
            {
                return _ShipCity;
            }
            set
            {
                OnShipCityChanging(value);
                ReportPropertyChanging("ShipCity");
                _ShipCity = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCity");
                OnShipCityChanged();
            }
        }
        private global::System.String _ShipCity;
        partial void OnShipCityChanging(global::System.String value);
        partial void OnShipCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipRegion
        {
            get
            {
                return _ShipRegion;
            }
            set
            {
                OnShipRegionChanging(value);
                ReportPropertyChanging("ShipRegion");
                _ShipRegion = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipRegion");
                OnShipRegionChanged();
            }
        }
        private global::System.String _ShipRegion;
        partial void OnShipRegionChanging(global::System.String value);
        partial void OnShipRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipPostalCode
        {
            get
            {
                return _ShipPostalCode;
            }
            set
            {
                OnShipPostalCodeChanging(value);
                ReportPropertyChanging("ShipPostalCode");
                _ShipPostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipPostalCode");
                OnShipPostalCodeChanged();
            }
        }
        private global::System.String _ShipPostalCode;
        partial void OnShipPostalCodeChanging(global::System.String value);
        partial void OnShipPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCountry
        {
            get
            {
                return _ShipCountry;
            }
            set
            {
                OnShipCountryChanging(value);
                ReportPropertyChanging("ShipCountry");
                _ShipCountry = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCountry");
                OnShipCountryChanged();
            }
        }
        private global::System.String _ShipCountry;
        partial void OnShipCountryChanging(global::System.String value);
        partial void OnShipCountryChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers")]
        public Customers Customers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Customers> CustomersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "InternationalOrders")]
        public InternationalOrders InternationalOrders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<InternationalOrders> InternationalOrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="PreviousEmployees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class PreviousEmployees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new PreviousEmployees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static PreviousEmployees CreatePreviousEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            PreviousEmployees previousEmployees = new PreviousEmployees();
            previousEmployees.EmployeeID = employeeID;
            previousEmployees.LastName = lastName;
            previousEmployees.FirstName = firstName;
            return previousEmployees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Products")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Products : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Products object.
        /// </summary>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="productName">Initial value of the ProductName property.</param>
        /// <param name="discontinued">Initial value of the Discontinued property.</param>
        public static Products CreateProducts(global::System.Int64 productID, global::System.String productName, global::System.Boolean discontinued)
        {
            Products products = new Products();
            products.ProductID = productID;
            products.ProductName = productName;
            products.Discontinued = discontinued;
            return products;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String ProductName
        {
            get
            {
                return _ProductName;
            }
            set
            {
                OnProductNameChanging(value);
                ReportPropertyChanging("ProductName");
                _ProductName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("ProductName");
                OnProductNameChanged();
            }
        }
        private global::System.String _ProductName;
        partial void OnProductNameChanging(global::System.String value);
        partial void OnProductNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String QuantityPerUnit
        {
            get
            {
                return _QuantityPerUnit;
            }
            set
            {
                OnQuantityPerUnitChanging(value);
                ReportPropertyChanging("QuantityPerUnit");
                _QuantityPerUnit = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("QuantityPerUnit");
                OnQuantityPerUnitChanged();
            }
        }
        private global::System.String _QuantityPerUnit;
        partial void OnQuantityPerUnitChanging(global::System.String value);
        partial void OnQuantityPerUnitChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private Nullable<global::System.Decimal> _UnitPrice;
        partial void OnUnitPriceChanging(Nullable<global::System.Decimal> value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsInStock
        {
            get
            {
                return _UnitsInStock;
            }
            set
            {
                OnUnitsInStockChanging(value);
                ReportPropertyChanging("UnitsInStock");
                _UnitsInStock = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsInStock");
                OnUnitsInStockChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsInStock;
        partial void OnUnitsInStockChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsInStockChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsOnOrder
        {
            get
            {
                return _UnitsOnOrder;
            }
            set
            {
                OnUnitsOnOrderChanging(value);
                ReportPropertyChanging("UnitsOnOrder");
                _UnitsOnOrder = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsOnOrder");
                OnUnitsOnOrderChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsOnOrder;
        partial void OnUnitsOnOrderChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsOnOrderChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> ReorderLevel
        {
            get
            {
                return _ReorderLevel;
            }
            set
            {
                OnReorderLevelChanging(value);
                ReportPropertyChanging("ReorderLevel");
                _ReorderLevel = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ReorderLevel");
                OnReorderLevelChanged();
            }
        }
        private Nullable<global::System.Int16> _ReorderLevel;
        partial void OnReorderLevelChanging(Nullable<global::System.Int16> value);
        partial void OnReorderLevelChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Boolean Discontinued
        {
            get
            {
                return _Discontinued;
            }
            set
            {
                OnDiscontinuedChanging(value);
                ReportPropertyChanging("Discontinued");
                _Discontinued = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discontinued");
                OnDiscontinuedChanged();
            }
        }
        private global::System.Boolean _Discontinued;
        partial void OnDiscontinuedChanging(global::System.Boolean value);
        partial void OnDiscontinuedChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> DiscontinuedDate
        {
            get
            {
                return _DiscontinuedDate;
            }
            set
            {
                OnDiscontinuedDateChanging(value);
                ReportPropertyChanging("DiscontinuedDate");
                _DiscontinuedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DiscontinuedDate");
                OnDiscontinuedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _DiscontinuedDate;
        partial void OnDiscontinuedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnDiscontinuedDateChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories")]
        public Categories Categories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Categories> CategoriesReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers")]
        public Suppliers Suppliers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Suppliers> SuppliersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Regions")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Regions : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Regions object.
        /// </summary>
        /// <param name="regionID">Initial value of the RegionID property.</param>
        /// <param name="regionDescription">Initial value of the RegionDescription property.</param>
        public static Regions CreateRegions(global::System.Int64 regionID, global::System.String regionDescription)
        {
            Regions regions = new Regions();
            regions.RegionID = regionID;
            regions.RegionDescription = regionDescription;
            return regions;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 RegionID
        {
            get
            {
                return _RegionID;
            }
            set
            {
                if (_RegionID != value)
                {
                    OnRegionIDChanging(value);
                    ReportPropertyChanging("RegionID");
                    _RegionID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("RegionID");
                    OnRegionIDChanged();
                }
            }
        }
        private global::System.Int64 _RegionID;
        partial void OnRegionIDChanging(global::System.Int64 value);
        partial void OnRegionIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String RegionDescription
        {
            get
            {
                return _RegionDescription;
            }
            set
            {
                OnRegionDescriptionChanging(value);
                ReportPropertyChanging("RegionDescription");
                _RegionDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("RegionDescription");
                OnRegionDescriptionChanged();
            }
        }
        private global::System.String _RegionDescription;
        partial void OnRegionDescriptionChanging(global::System.String value);
        partial void OnRegionDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Suppliers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Suppliers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Suppliers object.
        /// </summary>
        /// <param name="supplierID">Initial value of the SupplierID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Suppliers CreateSuppliers(global::System.Int64 supplierID, global::System.String companyName)
        {
            Suppliers suppliers = new Suppliers();
            suppliers.SupplierID = supplierID;
            suppliers.CompanyName = companyName;
            return suppliers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 SupplierID
        {
            get
            {
                return _SupplierID;
            }
            set
            {
                if (_SupplierID != value)
                {
                    OnSupplierIDChanging(value);
                    ReportPropertyChanging("SupplierID");
                    _SupplierID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("SupplierID");
                    OnSupplierIDChanged();
                }
            }
        }
        private global::System.Int64 _SupplierID;
        partial void OnSupplierIDChanging(global::System.Int64 value);
        partial void OnSupplierIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePage
        {
            get
            {
                return _HomePage;
            }
            set
            {
                OnHomePageChanging(value);
                ReportPropertyChanging("HomePage");
                _HomePage = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePage");
                OnHomePageChanged();
            }
        }
        private global::System.String _HomePage;
        partial void OnHomePageChanging(global::System.String value);
        partial void OnHomePageChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Territories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Territories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Territories object.
        /// </summary>
        /// <param name="territoryID">Initial value of the TerritoryID property.</param>
        /// <param name="territoryDescription">Initial value of the TerritoryDescription property.</param>
        public static Territories CreateTerritories(global::System.Int64 territoryID, global::System.String territoryDescription)
        {
            Territories territories = new Territories();
            territories.TerritoryID = territoryID;
            territories.TerritoryDescription = territoryDescription;
            return territories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 TerritoryID
        {
            get
            {
                return _TerritoryID;
            }
            set
            {
                if (_TerritoryID != value)
                {
                    OnTerritoryIDChanging(value);
                    ReportPropertyChanging("TerritoryID");
                    _TerritoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("TerritoryID");
                    OnTerritoryIDChanged();
                }
            }
        }
        private global::System.Int64 _TerritoryID;
        partial void OnTerritoryIDChanging(global::System.Int64 value);
        partial void OnTerritoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String TerritoryDescription
        {
            get
            {
                return _TerritoryDescription;
            }
            set
            {
                OnTerritoryDescriptionChanging(value);
                ReportPropertyChanging("TerritoryDescription");
                _TerritoryDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("TerritoryDescription");
                OnTerritoryDescriptionChanged();
            }
        }
        private global::System.String _TerritoryDescription;
        partial void OnTerritoryDescriptionChanging(global::System.String value);
        partial void OnTerritoryDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions")]
        public Regions Regions
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Regions> RegionsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Employees")]
        public EntityCollection<Employees> Employees
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees", value);
                }
            }
        }

        #endregion
    }

    #endregion

}

Added testlinq/NorthwindModel.EF6.2010.edmx.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
    <Schema Namespace="northwindEFModel.Store" Alias="Self" Provider="System.Data.SQLite.EF6" ProviderManifestToken="ISO8601" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
        <EntityContainer Name="northwindEFModelStoreContainer">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Store.Categories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Store.Customers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Store.Employees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="EmployeesTerritories" EntityType="northwindEFModel.Store.EmployeesTerritories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.Store.InternationalOrders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.Store.OrderDetails" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Store.Orders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.Store.PreviousEmployees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Store.Products" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Store.Regions" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Store.Suppliers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Store.Territories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <AssociationSet Name="FK_EmployeesTerritories_EmployeeID_EmployeeID" Association="northwindEFModel.Store.FK_EmployeesTerritories_EmployeeID_EmployeeID">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_EmployeesTerritories_TerritoryID_TerritoryID" Association="northwindEFModel.Store.FK_EmployeesTerritories_TerritoryID_TerritoryID">
            <End Role="Territories" EntitySet="Territories" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.Store.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.Store.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.Store.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.Store.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.Store.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.Store.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.Store.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
        </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CategoryName" Type="nvarchar" Nullable="false" MaxLength="15" />
          <Property Name="Description" Type="nvarchar" />
          <Property Name="Picture" Type="blob" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="nvarchar" Nullable="false" MaxLength="5" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="EmployeesTerritories">
          <Key>
            <PropertyRef Name="EmployeeID" />
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="CustomsDescription" Type="nvarchar" Nullable="false" MaxLength="100" />
          <Property Name="ExciseTax" Type="decimal" Nullable="false" Precision="53" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="ProductID" Type="integer" Nullable="false" />
          <Property Name="UnitPrice" Type="decimal" Nullable="false" Precision="53" />
          <Property Name="Quantity" Type="smallint" Nullable="false" />
          <!--
              NOTE: The "Discount" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbInsertCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Discount" Type="real" Nullable="false" StoreGeneratedPattern="Computed" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CustomerID" Type="nvarchar" MaxLength="5" />
          <Property Name="EmployeeID" Type="integer" />
          <Property Name="OrderDate" Type="datetime" />
          <Property Name="RequiredDate" Type="datetime" />
          <Property Name="ShippedDate" Type="datetime" />
          <!--
              NOTE: The "Freight" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbUpdateCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Freight" Type="decimal" Precision="53" StoreGeneratedPattern="Computed" />
          <Property Name="ShipName" Type="nvarchar" MaxLength="40" />
          <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" />
          <Property Name="ShipCity" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="ProductName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="SupplierID" Type="integer" />
          <Property Name="CategoryID" Type="integer" />
          <Property Name="QuantityPerUnit" Type="nvarchar" MaxLength="20" />
          <Property Name="UnitPrice" Type="decimal" Precision="53" />
          <Property Name="UnitsInStock" Type="smallint" />
          <Property Name="UnitsOnOrder" Type="smallint" />
          <Property Name="ReorderLevel" Type="smallint" />
          <Property Name="Discontinued" Type="bit" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="datetime" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="integer" Nullable="false" />
          <Property Name="RegionDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
          <Property Name="HomePage" Type="nvarchar" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
          <Property Name="TerritoryDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
          <Property Name="RegionID" Type="integer" Nullable="false" />
        </EntityType>
        <Association Name="FK_EmployeesTerritories_EmployeeID_EmployeeID">
          <End Role="Employees" Type="northwindEFModel.Store.Employees" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Employees">
              <PropertyRef Name="EmployeeID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="EmployeeID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_EmployeesTerritories_TerritoryID_TerritoryID">
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Territories">
              <PropertyRef Name="TerritoryID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="TerritoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.Store.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Store.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Customers">
              <PropertyRef Name="CustomerID" />
            </Principal>
            <Dependent Role="Orders">
              <PropertyRef Name="CustomerID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Store.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Categories">
              <PropertyRef Name="CategoryID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="CategoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Store.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Suppliers">
              <PropertyRef Name="SupplierID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="SupplierID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Store.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Regions">
              <PropertyRef Name="RegionID" />
            </Principal>
            <Dependent Role="Territories">
              <PropertyRef Name="RegionID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
      </Schema></edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="northwindEFModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
        <EntityContainer Name="northwindEFEntities">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Categories" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Customers" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Employees" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.InternationalOrders" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.OrderDetails" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Orders" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.PreviousEmployees" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Products" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Regions" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Suppliers" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Territories" />
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          <AssociationSet Name="EmployeesTerritories" Association="northwindEFModel.EmployeesTerritories">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="Int64" Nullable="false" />
          <Property Name="CategoryName" Type="String" Nullable="false" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Description" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="Picture" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Categories" ToRole="Products" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="String" Nullable="false" MaxLength="5" Unicode="true" FixedLength="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Customers" ToRole="Orders" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Employees" ToRole="Territories" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="CustomsDescription" Type="String" Nullable="false" MaxLength="100" Unicode="true" FixedLength="false" />
          <Property Name="ExciseTax" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="InternationalOrders" ToRole="Orders" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="UnitPrice" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <Property Name="Quantity" Type="Int16" Nullable="false" />
          <Property Name="Discount" Type="Single" Nullable="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="OrderDetails" ToRole="Orders" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="OrderDetails" ToRole="Products" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="EmployeeID" Type="Int64" />
          <Property Name="OrderDate" Type="DateTime" />
          <Property Name="RequiredDate" Type="DateTime" />
          <Property Name="ShippedDate" Type="DateTime" />
          <Property Name="Freight" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="ShipName" Type="String" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ShipAddress" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="ShipCity" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipRegion" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipPostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="ShipCountry" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Customers" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Orders" ToRole="Customers" />
          <NavigationProperty Name="InternationalOrders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="Orders" ToRole="InternationalOrders" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="Orders" ToRole="OrderDetails" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="ProductName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="QuantityPerUnit" Type="String" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="UnitPrice" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="UnitsInStock" Type="Int16" />
          <Property Name="UnitsOnOrder" Type="Int16" />
          <Property Name="ReorderLevel" Type="Int16" />
          <Property Name="Discontinued" Type="Boolean" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="DateTime" />
          <NavigationProperty Name="Categories" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Products" ToRole="Categories" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="Products" ToRole="OrderDetails" />
          <NavigationProperty Name="Suppliers" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Products" ToRole="Suppliers" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="Int64" Nullable="false" />
          <Property Name="RegionDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Regions" ToRole="Territories" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="Int64" Nullable="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="HomePage" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Suppliers" ToRole="Products" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="Int64" Nullable="false" />
          <Property Name="TerritoryDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Regions" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Territories" ToRole="Regions" />
          <NavigationProperty Name="Employees" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Territories" ToRole="Employees" />
        </EntityType>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="*" />
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        <Association Name="EmployeesTerritories">
          <End Role="Employees" Type="northwindEFModel.Employees" Multiplicity="*" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        </Schema>
    </edmx:ConceptualModels>
    <!-- C-S mapping content -->
    <edmx:Mappings>
      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
        <EntityContainerMapping StorageEntityContainer="northwindEFModelStoreContainer" CdmEntityContainer="northwindEFEntities">
          <EntitySetMapping Name="Categories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Categories)">
              <MappingFragment StoreEntitySet="Categories">
                <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
                <ScalarProperty Name="CategoryName" ColumnName="CategoryName" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="Picture" ColumnName="Picture" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Customers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Customers)">
              <MappingFragment StoreEntitySet="Customers">
                <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Employees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Employees)">
              <MappingFragment StoreEntitySet="Employees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="InternationalOrders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.InternationalOrders)">
              <MappingFragment StoreEntitySet="InternationalOrders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="CustomsDescription" ColumnName="CustomsDescription" />
                <ScalarProperty Name="ExciseTax" ColumnName="ExciseTax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="OrderDetails">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.OrderDetails)">
              <MappingFragment StoreEntitySet="OrderDetails">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="Quantity" ColumnName="Quantity" />
                <ScalarProperty Name="Discount" ColumnName="Discount" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Orders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Orders)">
              <MappingFragment StoreEntitySet="Orders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="OrderDate" ColumnName="OrderDate" />
                <ScalarProperty Name="RequiredDate" ColumnName="RequiredDate" />
                <ScalarProperty Name="ShippedDate" ColumnName="ShippedDate" />
                <ScalarProperty Name="Freight" ColumnName="Freight" />
                <ScalarProperty Name="ShipName" ColumnName="ShipName" />
                <ScalarProperty Name="ShipAddress" ColumnName="ShipAddress" />
                <ScalarProperty Name="ShipCity" ColumnName="ShipCity" />
                <ScalarProperty Name="ShipRegion" ColumnName="ShipRegion" />
                <ScalarProperty Name="ShipPostalCode" ColumnName="ShipPostalCode" />
                <ScalarProperty Name="ShipCountry" ColumnName="ShipCountry" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="PreviousEmployees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.PreviousEmployees)">
              <MappingFragment StoreEntitySet="PreviousEmployees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Products">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Products)">
              <MappingFragment StoreEntitySet="Products">
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="ProductName" ColumnName="ProductName" />
                <ScalarProperty Name="QuantityPerUnit" ColumnName="QuantityPerUnit" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="UnitsInStock" ColumnName="UnitsInStock" />
                <ScalarProperty Name="UnitsOnOrder" ColumnName="UnitsOnOrder" />
                <ScalarProperty Name="ReorderLevel" ColumnName="ReorderLevel" />
                <ScalarProperty Name="Discontinued" ColumnName="Discontinued" />
                <ScalarProperty Name="DiscontinuedDate" ColumnName="DiscontinuedDate" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Regions">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Regions)">
              <MappingFragment StoreEntitySet="Regions">
                <ScalarProperty Name="RegionID" ColumnName="RegionID" />
                <ScalarProperty Name="RegionDescription" ColumnName="RegionDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Suppliers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Suppliers)">
              <MappingFragment StoreEntitySet="Suppliers">
                <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
                <ScalarProperty Name="HomePage" ColumnName="HomePage" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Territories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Territories)">
              <MappingFragment StoreEntitySet="Territories">
                <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
                <ScalarProperty Name="TerritoryDescription" ColumnName="TerritoryDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <AssociationSetMapping Name="FK_Products_CategoryID_CategoryID" TypeName="northwindEFModel.FK_Products_CategoryID_CategoryID" StoreEntitySet="Products">
            <EndProperty Name="Categories">
              <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="CategoryID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Orders_CustomerID_CustomerID" TypeName="northwindEFModel.FK_Orders_CustomerID_CustomerID" StoreEntitySet="Orders">
            <EndProperty Name="Customers">
              <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
            </EndProperty>
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <Condition ColumnName="CustomerID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_InternationalOrders_OrderID_OrderID" TypeName="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" StoreEntitySet="InternationalOrders">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="InternationalOrders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_OrderID_OrderID" TypeName="northwindEFModel.FK_OrderDetails_OrderID_OrderID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_ProductID_ProductID" TypeName="northwindEFModel.FK_OrderDetails_ProductID_ProductID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Products_SupplierID_SupplierID" TypeName="northwindEFModel.FK_Products_SupplierID_SupplierID" StoreEntitySet="Products">
            <EndProperty Name="Suppliers">
              <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="SupplierID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Territories_RegionID_RegionID" TypeName="northwindEFModel.FK_Territories_RegionID_RegionID" StoreEntitySet="Territories">
            <EndProperty Name="Regions">
              <ScalarProperty Name="RegionID" ColumnName="RegionID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="EmployeesTerritories" TypeName="northwindEFModel.EmployeesTerritories" StoreEntitySet="EmployeesTerritories">
            <EndProperty Name="Employees">
              <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          </EntityContainerMapping>
      </Mapping>
    </edmx:Mappings>
  </edmx:Runtime>
  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
  <edmx:Designer>
    <edmx:Connection>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </edmx:Connection>
    <edmx:Options>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
      </DesignerInfoPropertySet>
    </edmx:Options>
    <!-- Diagram content (shape and connector positions) -->
    <edmx:Diagrams>
      <Diagram Name="NorthwindModel" xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <EntityTypeShape EntityType="northwindEFModel.Categories" Width="1.5" PointX="0.75" PointY="1.625" Height="1.9802864583333335" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Customers" Width="1.5" PointX="0.75" PointY="9.625" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Employees" Width="1.5" PointX="2.75" PointY="14.625" Height="4.4802050781250014" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.InternationalOrders" Width="1.5" PointX="5.25" PointY="10.375" Height="1.7879850260416674" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.OrderDetails" Width="1.5" PointX="5.25" PointY="1.5" Height="2.3648893229166656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Orders" Width="1.5" PointX="3" PointY="9.25" Height="3.9033007812499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.PreviousEmployees" Width="1.5" PointX="7.75" PointY="0.75" Height="4.2879036458333317" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Products" Width="1.5" PointX="3" PointY="1" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Regions" Width="1.5" PointX="2.75" PointY="6" Height="1.5956835937499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Suppliers" Width="1.5" PointX="0.75" PointY="4.875" Height="3.5186979166666656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Territories" Width="1.5" PointX="5" PointY="5.875" Height="1.7879850260416674" IsExpanded="true" />
        <AssociationConnector Association="northwindEFModel.FK_Products_CategoryID_CategoryID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="2.6151432291666667" />
          <ConnectorPoint PointX="3" PointY="2.6151432291666667" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Orders_CustomerID_CustomerID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="11.2881982421875" />
          <ConnectorPoint PointX="3" PointY="11.2881982421875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.010416666666667" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.177083333333333" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.25" PointY="11.268992513020834" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="3.75" PointY="9.25" />
          <ConnectorPoint PointX="3.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="2.6824446614583328" />
          <ConnectorPoint PointX="5.25" PointY="2.6824446614583328" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="2.0287223307291664" />
          <ConnectorPoint PointX="5.25" PointY="2.0287223307291664" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Products_SupplierID_SupplierID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="4.326396484375" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Territories_RegionID_RegionID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="6.797841796875" />
          <ConnectorPoint PointX="4.666666666666667" PointY="6.7978417968749989" />
          <ConnectorPoint PointX="4.833333333333333" PointY="6.797841796875" />
          <ConnectorPoint PointX="5" PointY="6.797841796875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.EmployeesTerritories" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="7.6629850260416674" /></AssociationConnector>
        </Diagram></edmx:Diagrams>
  </edmx:Designer>
</edmx:Edmx>

Added testlinq/NorthwindModel.EF6.2012.Designer.cs.





































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

//------------------------------------------------------------------------------
// <auto-generated>
//    This code was generated from a template.
//
//    Manual changes to this file may cause unexpected behavior in your application.
//    Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.ComponentModel;
using System.Data.Entity.Core.EntityClient;
using System.Data.Entity.Core.Metadata.Edm;
using System.Data.Entity.Core.Objects;
using System.Data.Entity.Core.Objects.DataClasses;
using System.Runtime.Serialization;
using System.Xml.Serialization;

[assembly: EdmSchemaAttribute()]
#region EDM Relationship Metadata

[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Categories), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Customers), "Orders", RelationshipMultiplicity.Many, typeof(testlinq.Orders))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "InternationalOrders", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.InternationalOrders), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products", RelationshipMultiplicity.One, typeof(testlinq.Products), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Suppliers), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions", RelationshipMultiplicity.One, typeof(testlinq.Regions), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "EmployeesTerritories", "Employees", RelationshipMultiplicity.Many, typeof(testlinq.Employees), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]

#endregion

namespace testlinq
{
    #region Contexts

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    public partial class northwindEFEntities : ObjectContext
    {
        #region Constructors

        /// <summary>
        /// Initializes a new northwindEFEntities object using the connection string found in the 'northwindEFEntities' section of the application configuration file.
        /// </summary>
        public northwindEFEntities() : base("name=northwindEFEntities", "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(string connectionString) : base(connectionString, "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(EntityConnection connection) : base(connection, "northwindEFEntities")
        {
            OnContextCreated();
        }

        #endregion

        #region Partial Methods

        partial void OnContextCreated();

        #endregion

        #region ObjectSet Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Categories> Categories
        {
            get
            {
                if ((_Categories == null))
                {
                    _Categories = base.CreateObjectSet<Categories>("Categories");
                }
                return _Categories;
            }
        }
        private ObjectSet<Categories> _Categories;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Customers> Customers
        {
            get
            {
                if ((_Customers == null))
                {
                    _Customers = base.CreateObjectSet<Customers>("Customers");
                }
                return _Customers;
            }
        }
        private ObjectSet<Customers> _Customers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Employees> Employees
        {
            get
            {
                if ((_Employees == null))
                {
                    _Employees = base.CreateObjectSet<Employees>("Employees");
                }
                return _Employees;
            }
        }
        private ObjectSet<Employees> _Employees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<InternationalOrders> InternationalOrders
        {
            get
            {
                if ((_InternationalOrders == null))
                {
                    _InternationalOrders = base.CreateObjectSet<InternationalOrders>("InternationalOrders");
                }
                return _InternationalOrders;
            }
        }
        private ObjectSet<InternationalOrders> _InternationalOrders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<OrderDetails> OrderDetails
        {
            get
            {
                if ((_OrderDetails == null))
                {
                    _OrderDetails = base.CreateObjectSet<OrderDetails>("OrderDetails");
                }
                return _OrderDetails;
            }
        }
        private ObjectSet<OrderDetails> _OrderDetails;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Orders> Orders
        {
            get
            {
                if ((_Orders == null))
                {
                    _Orders = base.CreateObjectSet<Orders>("Orders");
                }
                return _Orders;
            }
        }
        private ObjectSet<Orders> _Orders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<PreviousEmployees> PreviousEmployees
        {
            get
            {
                if ((_PreviousEmployees == null))
                {
                    _PreviousEmployees = base.CreateObjectSet<PreviousEmployees>("PreviousEmployees");
                }
                return _PreviousEmployees;
            }
        }
        private ObjectSet<PreviousEmployees> _PreviousEmployees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Products> Products
        {
            get
            {
                if ((_Products == null))
                {
                    _Products = base.CreateObjectSet<Products>("Products");
                }
                return _Products;
            }
        }
        private ObjectSet<Products> _Products;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Regions> Regions
        {
            get
            {
                if ((_Regions == null))
                {
                    _Regions = base.CreateObjectSet<Regions>("Regions");
                }
                return _Regions;
            }
        }
        private ObjectSet<Regions> _Regions;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Suppliers> Suppliers
        {
            get
            {
                if ((_Suppliers == null))
                {
                    _Suppliers = base.CreateObjectSet<Suppliers>("Suppliers");
                }
                return _Suppliers;
            }
        }
        private ObjectSet<Suppliers> _Suppliers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Territories> Territories
        {
            get
            {
                if ((_Territories == null))
                {
                    _Territories = base.CreateObjectSet<Territories>("Territories");
                }
                return _Territories;
            }
        }
        private ObjectSet<Territories> _Territories;

        #endregion
        #region AddTo Methods

        /// <summary>
        /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCategories(Categories categories)
        {
            base.AddObject("Categories", categories);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Customers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCustomers(Customers customers)
        {
            base.AddObject("Customers", customers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Employees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToEmployees(Employees employees)
        {
            base.AddObject("Employees", employees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the InternationalOrders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToInternationalOrders(InternationalOrders internationalOrders)
        {
            base.AddObject("InternationalOrders", internationalOrders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the OrderDetails EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrderDetails(OrderDetails orderDetails)
        {
            base.AddObject("OrderDetails", orderDetails);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Orders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrders(Orders orders)
        {
            base.AddObject("Orders", orders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the PreviousEmployees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToPreviousEmployees(PreviousEmployees previousEmployees)
        {
            base.AddObject("PreviousEmployees", previousEmployees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToProducts(Products products)
        {
            base.AddObject("Products", products);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Regions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToRegions(Regions regions)
        {
            base.AddObject("Regions", regions);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Suppliers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToSuppliers(Suppliers suppliers)
        {
            base.AddObject("Suppliers", suppliers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Territories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToTerritories(Territories territories)
        {
            base.AddObject("Territories", territories);
        }

        #endregion
    }


    #endregion

    #region Entities

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Categories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Categories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Categories object.
        /// </summary>
        /// <param name="categoryID">Initial value of the CategoryID property.</param>
        /// <param name="categoryName">Initial value of the CategoryName property.</param>
        public static Categories CreateCategories(global::System.Int64 categoryID, global::System.String categoryName)
        {
            Categories categories = new Categories();
            categories.CategoryID = categoryID;
            categories.CategoryName = categoryName;
            return categories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 CategoryID
        {
            get
            {
                return _CategoryID;
            }
            set
            {
                if (_CategoryID != value)
                {
                    OnCategoryIDChanging(value);
                    ReportPropertyChanging("CategoryID");
                    _CategoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("CategoryID");
                    OnCategoryIDChanged();
                }
            }
        }
        private global::System.Int64 _CategoryID;
        partial void OnCategoryIDChanging(global::System.Int64 value);
        partial void OnCategoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CategoryName
        {
            get
            {
                return _CategoryName;
            }
            set
            {
                OnCategoryNameChanging(value);
                ReportPropertyChanging("CategoryName");
                _CategoryName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CategoryName");
                OnCategoryNameChanged();
            }
        }
        private global::System.String _CategoryName;
        partial void OnCategoryNameChanging(global::System.String value);
        partial void OnCategoryNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Description
        {
            get
            {
                return _Description;
            }
            set
            {
                OnDescriptionChanging(value);
                ReportPropertyChanging("Description");
                _Description = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Description");
                OnDescriptionChanged();
            }
        }
        private global::System.String _Description;
        partial void OnDescriptionChanging(global::System.String value);
        partial void OnDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Picture
        {
            get
            {
                return StructuralObject.GetValidValue(_Picture);
            }
            set
            {
                OnPictureChanging(value);
                ReportPropertyChanging("Picture");
                _Picture = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Picture");
                OnPictureChanged();
            }
        }
        private global::System.Byte[] _Picture;
        partial void OnPictureChanging(global::System.Byte[] value);
        partial void OnPictureChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Customers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Customers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Customers object.
        /// </summary>
        /// <param name="customerID">Initial value of the CustomerID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Customers CreateCustomers(global::System.String customerID, global::System.String companyName)
        {
            Customers customers = new Customers();
            customers.CustomerID = customerID;
            customers.CompanyName = companyName;
            return customers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomerID
        {
            get
            {
                return _CustomerID;
            }
            set
            {
                if (_CustomerID != value)
                {
                    OnCustomerIDChanging(value);
                    ReportPropertyChanging("CustomerID");
                    _CustomerID = StructuralObject.SetValidValue(value, false);
                    ReportPropertyChanged("CustomerID");
                    OnCustomerIDChanged();
                }
            }
        }
        private global::System.String _CustomerID;
        partial void OnCustomerIDChanging(global::System.String value);
        partial void OnCustomerIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Orders")]
        public EntityCollection<Orders> Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Employees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Employees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Employees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static Employees CreateEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            Employees employees = new Employees();
            employees.EmployeeID = employeeID;
            employees.LastName = lastName;
            employees.FirstName = firstName;
            return employees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="InternationalOrders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class InternationalOrders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new InternationalOrders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="customsDescription">Initial value of the CustomsDescription property.</param>
        /// <param name="exciseTax">Initial value of the ExciseTax property.</param>
        public static InternationalOrders CreateInternationalOrders(global::System.Int64 orderID, global::System.String customsDescription, global::System.Decimal exciseTax)
        {
            InternationalOrders internationalOrders = new InternationalOrders();
            internationalOrders.OrderID = orderID;
            internationalOrders.CustomsDescription = customsDescription;
            internationalOrders.ExciseTax = exciseTax;
            return internationalOrders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomsDescription
        {
            get
            {
                return _CustomsDescription;
            }
            set
            {
                OnCustomsDescriptionChanging(value);
                ReportPropertyChanging("CustomsDescription");
                _CustomsDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CustomsDescription");
                OnCustomsDescriptionChanged();
            }
        }
        private global::System.String _CustomsDescription;
        partial void OnCustomsDescriptionChanging(global::System.String value);
        partial void OnCustomsDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal ExciseTax
        {
            get
            {
                return _ExciseTax;
            }
            set
            {
                OnExciseTaxChanging(value);
                ReportPropertyChanging("ExciseTax");
                _ExciseTax = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ExciseTax");
                OnExciseTaxChanged();
            }
        }
        private global::System.Decimal _ExciseTax;
        partial void OnExciseTaxChanging(global::System.Decimal value);
        partial void OnExciseTaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="OrderDetails")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class OrderDetails : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new OrderDetails object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="unitPrice">Initial value of the UnitPrice property.</param>
        /// <param name="quantity">Initial value of the Quantity property.</param>
        /// <param name="discount">Initial value of the Discount property.</param>
        public static OrderDetails CreateOrderDetails(global::System.Int64 orderID, global::System.Int64 productID, global::System.Decimal unitPrice, global::System.Int16 quantity, global::System.Single discount)
        {
            OrderDetails orderDetails = new OrderDetails();
            orderDetails.OrderID = orderID;
            orderDetails.ProductID = productID;
            orderDetails.UnitPrice = unitPrice;
            orderDetails.Quantity = quantity;
            orderDetails.Discount = discount;
            return orderDetails;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private global::System.Decimal _UnitPrice;
        partial void OnUnitPriceChanging(global::System.Decimal value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int16 Quantity
        {
            get
            {
                return _Quantity;
            }
            set
            {
                OnQuantityChanging(value);
                ReportPropertyChanging("Quantity");
                _Quantity = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Quantity");
                OnQuantityChanged();
            }
        }
        private global::System.Int16 _Quantity;
        partial void OnQuantityChanging(global::System.Int16 value);
        partial void OnQuantityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Single Discount
        {
            get
            {
                return _Discount;
            }
            set
            {
                OnDiscountChanging(value);
                ReportPropertyChanging("Discount");
                _Discount = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discount");
                OnDiscountChanged();
            }
        }
        private global::System.Single _Discount;
        partial void OnDiscountChanging(global::System.Single value);
        partial void OnDiscountChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products")]
        public Products Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Products> ProductsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Orders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Orders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Orders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        public static Orders CreateOrders(global::System.Int64 orderID)
        {
            Orders orders = new Orders();
            orders.OrderID = orderID;
            return orders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int64> EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                OnEmployeeIDChanging(value);
                ReportPropertyChanging("EmployeeID");
                _EmployeeID = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("EmployeeID");
                OnEmployeeIDChanged();
            }
        }
        private Nullable<global::System.Int64> _EmployeeID;
        partial void OnEmployeeIDChanging(Nullable<global::System.Int64> value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> OrderDate
        {
            get
            {
                return _OrderDate;
            }
            set
            {
                OnOrderDateChanging(value);
                ReportPropertyChanging("OrderDate");
                _OrderDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("OrderDate");
                OnOrderDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _OrderDate;
        partial void OnOrderDateChanging(Nullable<global::System.DateTime> value);
        partial void OnOrderDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> RequiredDate
        {
            get
            {
                return _RequiredDate;
            }
            set
            {
                OnRequiredDateChanging(value);
                ReportPropertyChanging("RequiredDate");
                _RequiredDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("RequiredDate");
                OnRequiredDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _RequiredDate;
        partial void OnRequiredDateChanging(Nullable<global::System.DateTime> value);
        partial void OnRequiredDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> ShippedDate
        {
            get
            {
                return _ShippedDate;
            }
            set
            {
                OnShippedDateChanging(value);
                ReportPropertyChanging("ShippedDate");
                _ShippedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ShippedDate");
                OnShippedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _ShippedDate;
        partial void OnShippedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnShippedDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> Freight
        {
            get
            {
                return _Freight;
            }
            set
            {
                OnFreightChanging(value);
                ReportPropertyChanging("Freight");
                _Freight = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Freight");
                OnFreightChanged();
            }
        }
        private Nullable<global::System.Decimal> _Freight;
        partial void OnFreightChanging(Nullable<global::System.Decimal> value);
        partial void OnFreightChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipName
        {
            get
            {
                return _ShipName;
            }
            set
            {
                OnShipNameChanging(value);
                ReportPropertyChanging("ShipName");
                _ShipName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipName");
                OnShipNameChanged();
            }
        }
        private global::System.String _ShipName;
        partial void OnShipNameChanging(global::System.String value);
        partial void OnShipNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipAddress
        {
            get
            {
                return _ShipAddress;
            }
            set
            {
                OnShipAddressChanging(value);
                ReportPropertyChanging("ShipAddress");
                _ShipAddress = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipAddress");
                OnShipAddressChanged();
            }
        }
        private global::System.String _ShipAddress;
        partial void OnShipAddressChanging(global::System.String value);
        partial void OnShipAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCity
        {
            get
            {
                return _ShipCity;
            }
            set
            {
                OnShipCityChanging(value);
                ReportPropertyChanging("ShipCity");
                _ShipCity = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCity");
                OnShipCityChanged();
            }
        }
        private global::System.String _ShipCity;
        partial void OnShipCityChanging(global::System.String value);
        partial void OnShipCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipRegion
        {
            get
            {
                return _ShipRegion;
            }
            set
            {
                OnShipRegionChanging(value);
                ReportPropertyChanging("ShipRegion");
                _ShipRegion = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipRegion");
                OnShipRegionChanged();
            }
        }
        private global::System.String _ShipRegion;
        partial void OnShipRegionChanging(global::System.String value);
        partial void OnShipRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipPostalCode
        {
            get
            {
                return _ShipPostalCode;
            }
            set
            {
                OnShipPostalCodeChanging(value);
                ReportPropertyChanging("ShipPostalCode");
                _ShipPostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipPostalCode");
                OnShipPostalCodeChanged();
            }
        }
        private global::System.String _ShipPostalCode;
        partial void OnShipPostalCodeChanging(global::System.String value);
        partial void OnShipPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCountry
        {
            get
            {
                return _ShipCountry;
            }
            set
            {
                OnShipCountryChanging(value);
                ReportPropertyChanging("ShipCountry");
                _ShipCountry = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCountry");
                OnShipCountryChanged();
            }
        }
        private global::System.String _ShipCountry;
        partial void OnShipCountryChanging(global::System.String value);
        partial void OnShipCountryChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers")]
        public Customers Customers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Customers> CustomersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "InternationalOrders")]
        public InternationalOrders InternationalOrders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<InternationalOrders> InternationalOrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="PreviousEmployees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class PreviousEmployees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new PreviousEmployees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static PreviousEmployees CreatePreviousEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            PreviousEmployees previousEmployees = new PreviousEmployees();
            previousEmployees.EmployeeID = employeeID;
            previousEmployees.LastName = lastName;
            previousEmployees.FirstName = firstName;
            return previousEmployees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Products")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Products : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Products object.
        /// </summary>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="productName">Initial value of the ProductName property.</param>
        /// <param name="discontinued">Initial value of the Discontinued property.</param>
        public static Products CreateProducts(global::System.Int64 productID, global::System.String productName, global::System.Boolean discontinued)
        {
            Products products = new Products();
            products.ProductID = productID;
            products.ProductName = productName;
            products.Discontinued = discontinued;
            return products;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String ProductName
        {
            get
            {
                return _ProductName;
            }
            set
            {
                OnProductNameChanging(value);
                ReportPropertyChanging("ProductName");
                _ProductName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("ProductName");
                OnProductNameChanged();
            }
        }
        private global::System.String _ProductName;
        partial void OnProductNameChanging(global::System.String value);
        partial void OnProductNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String QuantityPerUnit
        {
            get
            {
                return _QuantityPerUnit;
            }
            set
            {
                OnQuantityPerUnitChanging(value);
                ReportPropertyChanging("QuantityPerUnit");
                _QuantityPerUnit = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("QuantityPerUnit");
                OnQuantityPerUnitChanged();
            }
        }
        private global::System.String _QuantityPerUnit;
        partial void OnQuantityPerUnitChanging(global::System.String value);
        partial void OnQuantityPerUnitChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private Nullable<global::System.Decimal> _UnitPrice;
        partial void OnUnitPriceChanging(Nullable<global::System.Decimal> value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsInStock
        {
            get
            {
                return _UnitsInStock;
            }
            set
            {
                OnUnitsInStockChanging(value);
                ReportPropertyChanging("UnitsInStock");
                _UnitsInStock = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsInStock");
                OnUnitsInStockChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsInStock;
        partial void OnUnitsInStockChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsInStockChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsOnOrder
        {
            get
            {
                return _UnitsOnOrder;
            }
            set
            {
                OnUnitsOnOrderChanging(value);
                ReportPropertyChanging("UnitsOnOrder");
                _UnitsOnOrder = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsOnOrder");
                OnUnitsOnOrderChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsOnOrder;
        partial void OnUnitsOnOrderChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsOnOrderChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> ReorderLevel
        {
            get
            {
                return _ReorderLevel;
            }
            set
            {
                OnReorderLevelChanging(value);
                ReportPropertyChanging("ReorderLevel");
                _ReorderLevel = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ReorderLevel");
                OnReorderLevelChanged();
            }
        }
        private Nullable<global::System.Int16> _ReorderLevel;
        partial void OnReorderLevelChanging(Nullable<global::System.Int16> value);
        partial void OnReorderLevelChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Boolean Discontinued
        {
            get
            {
                return _Discontinued;
            }
            set
            {
                OnDiscontinuedChanging(value);
                ReportPropertyChanging("Discontinued");
                _Discontinued = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discontinued");
                OnDiscontinuedChanged();
            }
        }
        private global::System.Boolean _Discontinued;
        partial void OnDiscontinuedChanging(global::System.Boolean value);
        partial void OnDiscontinuedChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> DiscontinuedDate
        {
            get
            {
                return _DiscontinuedDate;
            }
            set
            {
                OnDiscontinuedDateChanging(value);
                ReportPropertyChanging("DiscontinuedDate");
                _DiscontinuedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DiscontinuedDate");
                OnDiscontinuedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _DiscontinuedDate;
        partial void OnDiscontinuedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnDiscontinuedDateChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories")]
        public Categories Categories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Categories> CategoriesReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers")]
        public Suppliers Suppliers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Suppliers> SuppliersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Regions")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Regions : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Regions object.
        /// </summary>
        /// <param name="regionID">Initial value of the RegionID property.</param>
        /// <param name="regionDescription">Initial value of the RegionDescription property.</param>
        public static Regions CreateRegions(global::System.Int64 regionID, global::System.String regionDescription)
        {
            Regions regions = new Regions();
            regions.RegionID = regionID;
            regions.RegionDescription = regionDescription;
            return regions;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 RegionID
        {
            get
            {
                return _RegionID;
            }
            set
            {
                if (_RegionID != value)
                {
                    OnRegionIDChanging(value);
                    ReportPropertyChanging("RegionID");
                    _RegionID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("RegionID");
                    OnRegionIDChanged();
                }
            }
        }
        private global::System.Int64 _RegionID;
        partial void OnRegionIDChanging(global::System.Int64 value);
        partial void OnRegionIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String RegionDescription
        {
            get
            {
                return _RegionDescription;
            }
            set
            {
                OnRegionDescriptionChanging(value);
                ReportPropertyChanging("RegionDescription");
                _RegionDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("RegionDescription");
                OnRegionDescriptionChanged();
            }
        }
        private global::System.String _RegionDescription;
        partial void OnRegionDescriptionChanging(global::System.String value);
        partial void OnRegionDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Suppliers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Suppliers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Suppliers object.
        /// </summary>
        /// <param name="supplierID">Initial value of the SupplierID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Suppliers CreateSuppliers(global::System.Int64 supplierID, global::System.String companyName)
        {
            Suppliers suppliers = new Suppliers();
            suppliers.SupplierID = supplierID;
            suppliers.CompanyName = companyName;
            return suppliers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 SupplierID
        {
            get
            {
                return _SupplierID;
            }
            set
            {
                if (_SupplierID != value)
                {
                    OnSupplierIDChanging(value);
                    ReportPropertyChanging("SupplierID");
                    _SupplierID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("SupplierID");
                    OnSupplierIDChanged();
                }
            }
        }
        private global::System.Int64 _SupplierID;
        partial void OnSupplierIDChanging(global::System.Int64 value);
        partial void OnSupplierIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePage
        {
            get
            {
                return _HomePage;
            }
            set
            {
                OnHomePageChanging(value);
                ReportPropertyChanging("HomePage");
                _HomePage = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePage");
                OnHomePageChanged();
            }
        }
        private global::System.String _HomePage;
        partial void OnHomePageChanging(global::System.String value);
        partial void OnHomePageChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Territories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Territories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Territories object.
        /// </summary>
        /// <param name="territoryID">Initial value of the TerritoryID property.</param>
        /// <param name="territoryDescription">Initial value of the TerritoryDescription property.</param>
        public static Territories CreateTerritories(global::System.Int64 territoryID, global::System.String territoryDescription)
        {
            Territories territories = new Territories();
            territories.TerritoryID = territoryID;
            territories.TerritoryDescription = territoryDescription;
            return territories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 TerritoryID
        {
            get
            {
                return _TerritoryID;
            }
            set
            {
                if (_TerritoryID != value)
                {
                    OnTerritoryIDChanging(value);
                    ReportPropertyChanging("TerritoryID");
                    _TerritoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("TerritoryID");
                    OnTerritoryIDChanged();
                }
            }
        }
        private global::System.Int64 _TerritoryID;
        partial void OnTerritoryIDChanging(global::System.Int64 value);
        partial void OnTerritoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String TerritoryDescription
        {
            get
            {
                return _TerritoryDescription;
            }
            set
            {
                OnTerritoryDescriptionChanging(value);
                ReportPropertyChanging("TerritoryDescription");
                _TerritoryDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("TerritoryDescription");
                OnTerritoryDescriptionChanged();
            }
        }
        private global::System.String _TerritoryDescription;
        partial void OnTerritoryDescriptionChanging(global::System.String value);
        partial void OnTerritoryDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions")]
        public Regions Regions
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Regions> RegionsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Employees")]
        public EntityCollection<Employees> Employees
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees", value);
                }
            }
        }

        #endregion
    }

    #endregion

}

Added testlinq/NorthwindModel.EF6.2012.edmx.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
    <Schema Namespace="northwindEFModel.Store" Alias="Self" Provider="System.Data.SQLite.EF6" ProviderManifestToken="ISO8601" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
        <EntityContainer Name="northwindEFModelStoreContainer">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Store.Categories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Store.Customers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Store.Employees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="EmployeesTerritories" EntityType="northwindEFModel.Store.EmployeesTerritories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.Store.InternationalOrders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.Store.OrderDetails" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Store.Orders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.Store.PreviousEmployees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Store.Products" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Store.Regions" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Store.Suppliers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Store.Territories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <AssociationSet Name="FK_EmployeesTerritories_EmployeeID_EmployeeID" Association="northwindEFModel.Store.FK_EmployeesTerritories_EmployeeID_EmployeeID">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_EmployeesTerritories_TerritoryID_TerritoryID" Association="northwindEFModel.Store.FK_EmployeesTerritories_TerritoryID_TerritoryID">
            <End Role="Territories" EntitySet="Territories" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.Store.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.Store.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.Store.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.Store.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.Store.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.Store.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.Store.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
        </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CategoryName" Type="nvarchar" Nullable="false" MaxLength="15" />
          <Property Name="Description" Type="nvarchar" />
          <Property Name="Picture" Type="blob" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="nvarchar" Nullable="false" MaxLength="5" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="EmployeesTerritories">
          <Key>
            <PropertyRef Name="EmployeeID" />
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="CustomsDescription" Type="nvarchar" Nullable="false" MaxLength="100" />
          <Property Name="ExciseTax" Type="decimal" Nullable="false" Precision="53" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="ProductID" Type="integer" Nullable="false" />
          <Property Name="UnitPrice" Type="decimal" Nullable="false" Precision="53" />
          <Property Name="Quantity" Type="smallint" Nullable="false" />
          <!--
              NOTE: The "Discount" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbInsertCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Discount" Type="real" Nullable="false" StoreGeneratedPattern="Computed" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CustomerID" Type="nvarchar" MaxLength="5" />
          <Property Name="EmployeeID" Type="integer" />
          <Property Name="OrderDate" Type="datetime" />
          <Property Name="RequiredDate" Type="datetime" />
          <Property Name="ShippedDate" Type="datetime" />
          <!--
              NOTE: The "Freight" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbUpdateCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Freight" Type="decimal" Precision="53" StoreGeneratedPattern="Computed" />
          <Property Name="ShipName" Type="nvarchar" MaxLength="40" />
          <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" />
          <Property Name="ShipCity" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="ProductName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="SupplierID" Type="integer" />
          <Property Name="CategoryID" Type="integer" />
          <Property Name="QuantityPerUnit" Type="nvarchar" MaxLength="20" />
          <Property Name="UnitPrice" Type="decimal" Precision="53" />
          <Property Name="UnitsInStock" Type="smallint" />
          <Property Name="UnitsOnOrder" Type="smallint" />
          <Property Name="ReorderLevel" Type="smallint" />
          <Property Name="Discontinued" Type="bit" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="datetime" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="integer" Nullable="false" />
          <Property Name="RegionDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
          <Property Name="HomePage" Type="nvarchar" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
          <Property Name="TerritoryDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
          <Property Name="RegionID" Type="integer" Nullable="false" />
        </EntityType>
        <Association Name="FK_EmployeesTerritories_EmployeeID_EmployeeID">
          <End Role="Employees" Type="northwindEFModel.Store.Employees" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Employees">
              <PropertyRef Name="EmployeeID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="EmployeeID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_EmployeesTerritories_TerritoryID_TerritoryID">
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Territories">
              <PropertyRef Name="TerritoryID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="TerritoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.Store.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Store.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Customers">
              <PropertyRef Name="CustomerID" />
            </Principal>
            <Dependent Role="Orders">
              <PropertyRef Name="CustomerID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Store.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Categories">
              <PropertyRef Name="CategoryID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="CategoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Store.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Suppliers">
              <PropertyRef Name="SupplierID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="SupplierID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Store.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Regions">
              <PropertyRef Name="RegionID" />
            </Principal>
            <Dependent Role="Territories">
              <PropertyRef Name="RegionID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
      </Schema></edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="northwindEFModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
        <EntityContainer Name="northwindEFEntities">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Categories" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Customers" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Employees" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.InternationalOrders" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.OrderDetails" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Orders" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.PreviousEmployees" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Products" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Regions" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Suppliers" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Territories" />
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          <AssociationSet Name="EmployeesTerritories" Association="northwindEFModel.EmployeesTerritories">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="Int64" Nullable="false" />
          <Property Name="CategoryName" Type="String" Nullable="false" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Description" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="Picture" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Categories" ToRole="Products" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="String" Nullable="false" MaxLength="5" Unicode="true" FixedLength="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Customers" ToRole="Orders" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Employees" ToRole="Territories" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="CustomsDescription" Type="String" Nullable="false" MaxLength="100" Unicode="true" FixedLength="false" />
          <Property Name="ExciseTax" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="InternationalOrders" ToRole="Orders" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="UnitPrice" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <Property Name="Quantity" Type="Int16" Nullable="false" />
          <Property Name="Discount" Type="Single" Nullable="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="OrderDetails" ToRole="Orders" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="OrderDetails" ToRole="Products" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="EmployeeID" Type="Int64" />
          <Property Name="OrderDate" Type="DateTime" />
          <Property Name="RequiredDate" Type="DateTime" />
          <Property Name="ShippedDate" Type="DateTime" />
          <Property Name="Freight" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="ShipName" Type="String" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ShipAddress" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="ShipCity" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipRegion" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipPostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="ShipCountry" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Customers" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Orders" ToRole="Customers" />
          <NavigationProperty Name="InternationalOrders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="Orders" ToRole="InternationalOrders" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="Orders" ToRole="OrderDetails" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="ProductName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="QuantityPerUnit" Type="String" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="UnitPrice" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="UnitsInStock" Type="Int16" />
          <Property Name="UnitsOnOrder" Type="Int16" />
          <Property Name="ReorderLevel" Type="Int16" />
          <Property Name="Discontinued" Type="Boolean" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="DateTime" />
          <NavigationProperty Name="Categories" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Products" ToRole="Categories" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="Products" ToRole="OrderDetails" />
          <NavigationProperty Name="Suppliers" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Products" ToRole="Suppliers" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="Int64" Nullable="false" />
          <Property Name="RegionDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Regions" ToRole="Territories" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="Int64" Nullable="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="HomePage" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Suppliers" ToRole="Products" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="Int64" Nullable="false" />
          <Property Name="TerritoryDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Regions" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Territories" ToRole="Regions" />
          <NavigationProperty Name="Employees" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Territories" ToRole="Employees" />
        </EntityType>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="*" />
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        <Association Name="EmployeesTerritories">
          <End Role="Employees" Type="northwindEFModel.Employees" Multiplicity="*" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        </Schema>
    </edmx:ConceptualModels>
    <!-- C-S mapping content -->
    <edmx:Mappings>
      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
        <EntityContainerMapping StorageEntityContainer="northwindEFModelStoreContainer" CdmEntityContainer="northwindEFEntities">
          <EntitySetMapping Name="Categories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Categories)">
              <MappingFragment StoreEntitySet="Categories">
                <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
                <ScalarProperty Name="CategoryName" ColumnName="CategoryName" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="Picture" ColumnName="Picture" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Customers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Customers)">
              <MappingFragment StoreEntitySet="Customers">
                <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Employees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Employees)">
              <MappingFragment StoreEntitySet="Employees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="InternationalOrders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.InternationalOrders)">
              <MappingFragment StoreEntitySet="InternationalOrders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="CustomsDescription" ColumnName="CustomsDescription" />
                <ScalarProperty Name="ExciseTax" ColumnName="ExciseTax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="OrderDetails">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.OrderDetails)">
              <MappingFragment StoreEntitySet="OrderDetails">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="Quantity" ColumnName="Quantity" />
                <ScalarProperty Name="Discount" ColumnName="Discount" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Orders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Orders)">
              <MappingFragment StoreEntitySet="Orders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="OrderDate" ColumnName="OrderDate" />
                <ScalarProperty Name="RequiredDate" ColumnName="RequiredDate" />
                <ScalarProperty Name="ShippedDate" ColumnName="ShippedDate" />
                <ScalarProperty Name="Freight" ColumnName="Freight" />
                <ScalarProperty Name="ShipName" ColumnName="ShipName" />
                <ScalarProperty Name="ShipAddress" ColumnName="ShipAddress" />
                <ScalarProperty Name="ShipCity" ColumnName="ShipCity" />
                <ScalarProperty Name="ShipRegion" ColumnName="ShipRegion" />
                <ScalarProperty Name="ShipPostalCode" ColumnName="ShipPostalCode" />
                <ScalarProperty Name="ShipCountry" ColumnName="ShipCountry" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="PreviousEmployees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.PreviousEmployees)">
              <MappingFragment StoreEntitySet="PreviousEmployees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Products">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Products)">
              <MappingFragment StoreEntitySet="Products">
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="ProductName" ColumnName="ProductName" />
                <ScalarProperty Name="QuantityPerUnit" ColumnName="QuantityPerUnit" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="UnitsInStock" ColumnName="UnitsInStock" />
                <ScalarProperty Name="UnitsOnOrder" ColumnName="UnitsOnOrder" />
                <ScalarProperty Name="ReorderLevel" ColumnName="ReorderLevel" />
                <ScalarProperty Name="Discontinued" ColumnName="Discontinued" />
                <ScalarProperty Name="DiscontinuedDate" ColumnName="DiscontinuedDate" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Regions">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Regions)">
              <MappingFragment StoreEntitySet="Regions">
                <ScalarProperty Name="RegionID" ColumnName="RegionID" />
                <ScalarProperty Name="RegionDescription" ColumnName="RegionDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Suppliers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Suppliers)">
              <MappingFragment StoreEntitySet="Suppliers">
                <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
                <ScalarProperty Name="HomePage" ColumnName="HomePage" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Territories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Territories)">
              <MappingFragment StoreEntitySet="Territories">
                <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
                <ScalarProperty Name="TerritoryDescription" ColumnName="TerritoryDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <AssociationSetMapping Name="FK_Products_CategoryID_CategoryID" TypeName="northwindEFModel.FK_Products_CategoryID_CategoryID" StoreEntitySet="Products">
            <EndProperty Name="Categories">
              <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="CategoryID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Orders_CustomerID_CustomerID" TypeName="northwindEFModel.FK_Orders_CustomerID_CustomerID" StoreEntitySet="Orders">
            <EndProperty Name="Customers">
              <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
            </EndProperty>
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <Condition ColumnName="CustomerID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_InternationalOrders_OrderID_OrderID" TypeName="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" StoreEntitySet="InternationalOrders">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="InternationalOrders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_OrderID_OrderID" TypeName="northwindEFModel.FK_OrderDetails_OrderID_OrderID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_ProductID_ProductID" TypeName="northwindEFModel.FK_OrderDetails_ProductID_ProductID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Products_SupplierID_SupplierID" TypeName="northwindEFModel.FK_Products_SupplierID_SupplierID" StoreEntitySet="Products">
            <EndProperty Name="Suppliers">
              <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="SupplierID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Territories_RegionID_RegionID" TypeName="northwindEFModel.FK_Territories_RegionID_RegionID" StoreEntitySet="Territories">
            <EndProperty Name="Regions">
              <ScalarProperty Name="RegionID" ColumnName="RegionID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="EmployeesTerritories" TypeName="northwindEFModel.EmployeesTerritories" StoreEntitySet="EmployeesTerritories">
            <EndProperty Name="Employees">
              <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          </EntityContainerMapping>
      </Mapping>
    </edmx:Mappings>
  </edmx:Runtime>
  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
  <edmx:Designer>
    <edmx:Connection>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </edmx:Connection>
    <edmx:Options>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
      </DesignerInfoPropertySet>
    </edmx:Options>
    <!-- Diagram content (shape and connector positions) -->
    <edmx:Diagrams>
      <Diagram Name="NorthwindModel" xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <EntityTypeShape EntityType="northwindEFModel.Categories" Width="1.5" PointX="0.75" PointY="1.625" Height="1.9802864583333335" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Customers" Width="1.5" PointX="0.75" PointY="9.625" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Employees" Width="1.5" PointX="2.75" PointY="14.625" Height="4.4802050781250014" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.InternationalOrders" Width="1.5" PointX="5.25" PointY="10.375" Height="1.7879850260416674" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.OrderDetails" Width="1.5" PointX="5.25" PointY="1.5" Height="2.3648893229166656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Orders" Width="1.5" PointX="3" PointY="9.25" Height="3.9033007812499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.PreviousEmployees" Width="1.5" PointX="7.75" PointY="0.75" Height="4.2879036458333317" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Products" Width="1.5" PointX="3" PointY="1" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Regions" Width="1.5" PointX="2.75" PointY="6" Height="1.5956835937499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Suppliers" Width="1.5" PointX="0.75" PointY="4.875" Height="3.5186979166666656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Territories" Width="1.5" PointX="5" PointY="5.875" Height="1.7879850260416674" IsExpanded="true" />
        <AssociationConnector Association="northwindEFModel.FK_Products_CategoryID_CategoryID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="2.6151432291666667" />
          <ConnectorPoint PointX="3" PointY="2.6151432291666667" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Orders_CustomerID_CustomerID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="11.2881982421875" />
          <ConnectorPoint PointX="3" PointY="11.2881982421875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.010416666666667" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.177083333333333" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.25" PointY="11.268992513020834" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="3.75" PointY="9.25" />
          <ConnectorPoint PointX="3.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="2.6824446614583328" />
          <ConnectorPoint PointX="5.25" PointY="2.6824446614583328" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="2.0287223307291664" />
          <ConnectorPoint PointX="5.25" PointY="2.0287223307291664" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Products_SupplierID_SupplierID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="4.326396484375" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Territories_RegionID_RegionID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="6.797841796875" />
          <ConnectorPoint PointX="4.666666666666667" PointY="6.7978417968749989" />
          <ConnectorPoint PointX="4.833333333333333" PointY="6.797841796875" />
          <ConnectorPoint PointX="5" PointY="6.797841796875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.EmployeesTerritories" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="7.6629850260416674" /></AssociationConnector>
        </Diagram></edmx:Diagrams>
  </edmx:Designer>
</edmx:Edmx>

Added testlinq/NorthwindModel.EF6.2013.Designer.cs.





































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

//------------------------------------------------------------------------------
// <auto-generated>
//    This code was generated from a template.
//
//    Manual changes to this file may cause unexpected behavior in your application.
//    Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.ComponentModel;
using System.Data.Entity.Core.EntityClient;
using System.Data.Entity.Core.Metadata.Edm;
using System.Data.Entity.Core.Objects;
using System.Data.Entity.Core.Objects.DataClasses;
using System.Runtime.Serialization;
using System.Xml.Serialization;

[assembly: EdmSchemaAttribute()]
#region EDM Relationship Metadata

[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Categories), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Customers), "Orders", RelationshipMultiplicity.Many, typeof(testlinq.Orders))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "InternationalOrders", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.InternationalOrders), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products", RelationshipMultiplicity.One, typeof(testlinq.Products), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Suppliers), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions", RelationshipMultiplicity.One, typeof(testlinq.Regions), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "EmployeesTerritories", "Employees", RelationshipMultiplicity.Many, typeof(testlinq.Employees), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]

#endregion

namespace testlinq
{
    #region Contexts

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    public partial class northwindEFEntities : ObjectContext
    {
        #region Constructors

        /// <summary>
        /// Initializes a new northwindEFEntities object using the connection string found in the 'northwindEFEntities' section of the application configuration file.
        /// </summary>
        public northwindEFEntities() : base("name=northwindEFEntities", "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(string connectionString) : base(connectionString, "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(EntityConnection connection) : base(connection, "northwindEFEntities")
        {
            OnContextCreated();
        }

        #endregion

        #region Partial Methods

        partial void OnContextCreated();

        #endregion

        #region ObjectSet Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Categories> Categories
        {
            get
            {
                if ((_Categories == null))
                {
                    _Categories = base.CreateObjectSet<Categories>("Categories");
                }
                return _Categories;
            }
        }
        private ObjectSet<Categories> _Categories;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Customers> Customers
        {
            get
            {
                if ((_Customers == null))
                {
                    _Customers = base.CreateObjectSet<Customers>("Customers");
                }
                return _Customers;
            }
        }
        private ObjectSet<Customers> _Customers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Employees> Employees
        {
            get
            {
                if ((_Employees == null))
                {
                    _Employees = base.CreateObjectSet<Employees>("Employees");
                }
                return _Employees;
            }
        }
        private ObjectSet<Employees> _Employees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<InternationalOrders> InternationalOrders
        {
            get
            {
                if ((_InternationalOrders == null))
                {
                    _InternationalOrders = base.CreateObjectSet<InternationalOrders>("InternationalOrders");
                }
                return _InternationalOrders;
            }
        }
        private ObjectSet<InternationalOrders> _InternationalOrders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<OrderDetails> OrderDetails
        {
            get
            {
                if ((_OrderDetails == null))
                {
                    _OrderDetails = base.CreateObjectSet<OrderDetails>("OrderDetails");
                }
                return _OrderDetails;
            }
        }
        private ObjectSet<OrderDetails> _OrderDetails;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Orders> Orders
        {
            get
            {
                if ((_Orders == null))
                {
                    _Orders = base.CreateObjectSet<Orders>("Orders");
                }
                return _Orders;
            }
        }
        private ObjectSet<Orders> _Orders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<PreviousEmployees> PreviousEmployees
        {
            get
            {
                if ((_PreviousEmployees == null))
                {
                    _PreviousEmployees = base.CreateObjectSet<PreviousEmployees>("PreviousEmployees");
                }
                return _PreviousEmployees;
            }
        }
        private ObjectSet<PreviousEmployees> _PreviousEmployees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Products> Products
        {
            get
            {
                if ((_Products == null))
                {
                    _Products = base.CreateObjectSet<Products>("Products");
                }
                return _Products;
            }
        }
        private ObjectSet<Products> _Products;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Regions> Regions
        {
            get
            {
                if ((_Regions == null))
                {
                    _Regions = base.CreateObjectSet<Regions>("Regions");
                }
                return _Regions;
            }
        }
        private ObjectSet<Regions> _Regions;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Suppliers> Suppliers
        {
            get
            {
                if ((_Suppliers == null))
                {
                    _Suppliers = base.CreateObjectSet<Suppliers>("Suppliers");
                }
                return _Suppliers;
            }
        }
        private ObjectSet<Suppliers> _Suppliers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Territories> Territories
        {
            get
            {
                if ((_Territories == null))
                {
                    _Territories = base.CreateObjectSet<Territories>("Territories");
                }
                return _Territories;
            }
        }
        private ObjectSet<Territories> _Territories;

        #endregion
        #region AddTo Methods

        /// <summary>
        /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCategories(Categories categories)
        {
            base.AddObject("Categories", categories);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Customers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCustomers(Customers customers)
        {
            base.AddObject("Customers", customers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Employees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToEmployees(Employees employees)
        {
            base.AddObject("Employees", employees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the InternationalOrders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToInternationalOrders(InternationalOrders internationalOrders)
        {
            base.AddObject("InternationalOrders", internationalOrders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the OrderDetails EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrderDetails(OrderDetails orderDetails)
        {
            base.AddObject("OrderDetails", orderDetails);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Orders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrders(Orders orders)
        {
            base.AddObject("Orders", orders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the PreviousEmployees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToPreviousEmployees(PreviousEmployees previousEmployees)
        {
            base.AddObject("PreviousEmployees", previousEmployees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToProducts(Products products)
        {
            base.AddObject("Products", products);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Regions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToRegions(Regions regions)
        {
            base.AddObject("Regions", regions);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Suppliers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToSuppliers(Suppliers suppliers)
        {
            base.AddObject("Suppliers", suppliers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Territories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToTerritories(Territories territories)
        {
            base.AddObject("Territories", territories);
        }

        #endregion
    }


    #endregion

    #region Entities

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Categories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Categories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Categories object.
        /// </summary>
        /// <param name="categoryID">Initial value of the CategoryID property.</param>
        /// <param name="categoryName">Initial value of the CategoryName property.</param>
        public static Categories CreateCategories(global::System.Int64 categoryID, global::System.String categoryName)
        {
            Categories categories = new Categories();
            categories.CategoryID = categoryID;
            categories.CategoryName = categoryName;
            return categories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 CategoryID
        {
            get
            {
                return _CategoryID;
            }
            set
            {
                if (_CategoryID != value)
                {
                    OnCategoryIDChanging(value);
                    ReportPropertyChanging("CategoryID");
                    _CategoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("CategoryID");
                    OnCategoryIDChanged();
                }
            }
        }
        private global::System.Int64 _CategoryID;
        partial void OnCategoryIDChanging(global::System.Int64 value);
        partial void OnCategoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CategoryName
        {
            get
            {
                return _CategoryName;
            }
            set
            {
                OnCategoryNameChanging(value);
                ReportPropertyChanging("CategoryName");
                _CategoryName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CategoryName");
                OnCategoryNameChanged();
            }
        }
        private global::System.String _CategoryName;
        partial void OnCategoryNameChanging(global::System.String value);
        partial void OnCategoryNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Description
        {
            get
            {
                return _Description;
            }
            set
            {
                OnDescriptionChanging(value);
                ReportPropertyChanging("Description");
                _Description = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Description");
                OnDescriptionChanged();
            }
        }
        private global::System.String _Description;
        partial void OnDescriptionChanging(global::System.String value);
        partial void OnDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Picture
        {
            get
            {
                return StructuralObject.GetValidValue(_Picture);
            }
            set
            {
                OnPictureChanging(value);
                ReportPropertyChanging("Picture");
                _Picture = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Picture");
                OnPictureChanged();
            }
        }
        private global::System.Byte[] _Picture;
        partial void OnPictureChanging(global::System.Byte[] value);
        partial void OnPictureChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Customers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Customers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Customers object.
        /// </summary>
        /// <param name="customerID">Initial value of the CustomerID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Customers CreateCustomers(global::System.String customerID, global::System.String companyName)
        {
            Customers customers = new Customers();
            customers.CustomerID = customerID;
            customers.CompanyName = companyName;
            return customers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomerID
        {
            get
            {
                return _CustomerID;
            }
            set
            {
                if (_CustomerID != value)
                {
                    OnCustomerIDChanging(value);
                    ReportPropertyChanging("CustomerID");
                    _CustomerID = StructuralObject.SetValidValue(value, false);
                    ReportPropertyChanged("CustomerID");
                    OnCustomerIDChanged();
                }
            }
        }
        private global::System.String _CustomerID;
        partial void OnCustomerIDChanging(global::System.String value);
        partial void OnCustomerIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Orders")]
        public EntityCollection<Orders> Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Employees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Employees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Employees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static Employees CreateEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            Employees employees = new Employees();
            employees.EmployeeID = employeeID;
            employees.LastName = lastName;
            employees.FirstName = firstName;
            return employees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="InternationalOrders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class InternationalOrders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new InternationalOrders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="customsDescription">Initial value of the CustomsDescription property.</param>
        /// <param name="exciseTax">Initial value of the ExciseTax property.</param>
        public static InternationalOrders CreateInternationalOrders(global::System.Int64 orderID, global::System.String customsDescription, global::System.Decimal exciseTax)
        {
            InternationalOrders internationalOrders = new InternationalOrders();
            internationalOrders.OrderID = orderID;
            internationalOrders.CustomsDescription = customsDescription;
            internationalOrders.ExciseTax = exciseTax;
            return internationalOrders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomsDescription
        {
            get
            {
                return _CustomsDescription;
            }
            set
            {
                OnCustomsDescriptionChanging(value);
                ReportPropertyChanging("CustomsDescription");
                _CustomsDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CustomsDescription");
                OnCustomsDescriptionChanged();
            }
        }
        private global::System.String _CustomsDescription;
        partial void OnCustomsDescriptionChanging(global::System.String value);
        partial void OnCustomsDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal ExciseTax
        {
            get
            {
                return _ExciseTax;
            }
            set
            {
                OnExciseTaxChanging(value);
                ReportPropertyChanging("ExciseTax");
                _ExciseTax = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ExciseTax");
                OnExciseTaxChanged();
            }
        }
        private global::System.Decimal _ExciseTax;
        partial void OnExciseTaxChanging(global::System.Decimal value);
        partial void OnExciseTaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="OrderDetails")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class OrderDetails : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new OrderDetails object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="unitPrice">Initial value of the UnitPrice property.</param>
        /// <param name="quantity">Initial value of the Quantity property.</param>
        /// <param name="discount">Initial value of the Discount property.</param>
        public static OrderDetails CreateOrderDetails(global::System.Int64 orderID, global::System.Int64 productID, global::System.Decimal unitPrice, global::System.Int16 quantity, global::System.Single discount)
        {
            OrderDetails orderDetails = new OrderDetails();
            orderDetails.OrderID = orderID;
            orderDetails.ProductID = productID;
            orderDetails.UnitPrice = unitPrice;
            orderDetails.Quantity = quantity;
            orderDetails.Discount = discount;
            return orderDetails;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private global::System.Decimal _UnitPrice;
        partial void OnUnitPriceChanging(global::System.Decimal value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int16 Quantity
        {
            get
            {
                return _Quantity;
            }
            set
            {
                OnQuantityChanging(value);
                ReportPropertyChanging("Quantity");
                _Quantity = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Quantity");
                OnQuantityChanged();
            }
        }
        private global::System.Int16 _Quantity;
        partial void OnQuantityChanging(global::System.Int16 value);
        partial void OnQuantityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Single Discount
        {
            get
            {
                return _Discount;
            }
            set
            {
                OnDiscountChanging(value);
                ReportPropertyChanging("Discount");
                _Discount = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discount");
                OnDiscountChanged();
            }
        }
        private global::System.Single _Discount;
        partial void OnDiscountChanging(global::System.Single value);
        partial void OnDiscountChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products")]
        public Products Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Products> ProductsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Orders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Orders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Orders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        public static Orders CreateOrders(global::System.Int64 orderID)
        {
            Orders orders = new Orders();
            orders.OrderID = orderID;
            return orders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int64> EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                OnEmployeeIDChanging(value);
                ReportPropertyChanging("EmployeeID");
                _EmployeeID = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("EmployeeID");
                OnEmployeeIDChanged();
            }
        }
        private Nullable<global::System.Int64> _EmployeeID;
        partial void OnEmployeeIDChanging(Nullable<global::System.Int64> value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> OrderDate
        {
            get
            {
                return _OrderDate;
            }
            set
            {
                OnOrderDateChanging(value);
                ReportPropertyChanging("OrderDate");
                _OrderDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("OrderDate");
                OnOrderDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _OrderDate;
        partial void OnOrderDateChanging(Nullable<global::System.DateTime> value);
        partial void OnOrderDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> RequiredDate
        {
            get
            {
                return _RequiredDate;
            }
            set
            {
                OnRequiredDateChanging(value);
                ReportPropertyChanging("RequiredDate");
                _RequiredDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("RequiredDate");
                OnRequiredDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _RequiredDate;
        partial void OnRequiredDateChanging(Nullable<global::System.DateTime> value);
        partial void OnRequiredDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> ShippedDate
        {
            get
            {
                return _ShippedDate;
            }
            set
            {
                OnShippedDateChanging(value);
                ReportPropertyChanging("ShippedDate");
                _ShippedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ShippedDate");
                OnShippedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _ShippedDate;
        partial void OnShippedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnShippedDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> Freight
        {
            get
            {
                return _Freight;
            }
            set
            {
                OnFreightChanging(value);
                ReportPropertyChanging("Freight");
                _Freight = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Freight");
                OnFreightChanged();
            }
        }
        private Nullable<global::System.Decimal> _Freight;
        partial void OnFreightChanging(Nullable<global::System.Decimal> value);
        partial void OnFreightChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipName
        {
            get
            {
                return _ShipName;
            }
            set
            {
                OnShipNameChanging(value);
                ReportPropertyChanging("ShipName");
                _ShipName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipName");
                OnShipNameChanged();
            }
        }
        private global::System.String _ShipName;
        partial void OnShipNameChanging(global::System.String value);
        partial void OnShipNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipAddress
        {
            get
            {
                return _ShipAddress;
            }
            set
            {
                OnShipAddressChanging(value);
                ReportPropertyChanging("ShipAddress");
                _ShipAddress = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipAddress");
                OnShipAddressChanged();
            }
        }
        private global::System.String _ShipAddress;
        partial void OnShipAddressChanging(global::System.String value);
        partial void OnShipAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCity
        {
            get
            {
                return _ShipCity;
            }
            set
            {
                OnShipCityChanging(value);
                ReportPropertyChanging("ShipCity");
                _ShipCity = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCity");
                OnShipCityChanged();
            }
        }
        private global::System.String _ShipCity;
        partial void OnShipCityChanging(global::System.String value);
        partial void OnShipCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipRegion
        {
            get
            {
                return _ShipRegion;
            }
            set
            {
                OnShipRegionChanging(value);
                ReportPropertyChanging("ShipRegion");
                _ShipRegion = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipRegion");
                OnShipRegionChanged();
            }
        }
        private global::System.String _ShipRegion;
        partial void OnShipRegionChanging(global::System.String value);
        partial void OnShipRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipPostalCode
        {
            get
            {
                return _ShipPostalCode;
            }
            set
            {
                OnShipPostalCodeChanging(value);
                ReportPropertyChanging("ShipPostalCode");
                _ShipPostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipPostalCode");
                OnShipPostalCodeChanged();
            }
        }
        private global::System.String _ShipPostalCode;
        partial void OnShipPostalCodeChanging(global::System.String value);
        partial void OnShipPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCountry
        {
            get
            {
                return _ShipCountry;
            }
            set
            {
                OnShipCountryChanging(value);
                ReportPropertyChanging("ShipCountry");
                _ShipCountry = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCountry");
                OnShipCountryChanged();
            }
        }
        private global::System.String _ShipCountry;
        partial void OnShipCountryChanging(global::System.String value);
        partial void OnShipCountryChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers")]
        public Customers Customers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Customers> CustomersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "InternationalOrders")]
        public InternationalOrders InternationalOrders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<InternationalOrders> InternationalOrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="PreviousEmployees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class PreviousEmployees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new PreviousEmployees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static PreviousEmployees CreatePreviousEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            PreviousEmployees previousEmployees = new PreviousEmployees();
            previousEmployees.EmployeeID = employeeID;
            previousEmployees.LastName = lastName;
            previousEmployees.FirstName = firstName;
            return previousEmployees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Products")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Products : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Products object.
        /// </summary>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="productName">Initial value of the ProductName property.</param>
        /// <param name="discontinued">Initial value of the Discontinued property.</param>
        public static Products CreateProducts(global::System.Int64 productID, global::System.String productName, global::System.Boolean discontinued)
        {
            Products products = new Products();
            products.ProductID = productID;
            products.ProductName = productName;
            products.Discontinued = discontinued;
            return products;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String ProductName
        {
            get
            {
                return _ProductName;
            }
            set
            {
                OnProductNameChanging(value);
                ReportPropertyChanging("ProductName");
                _ProductName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("ProductName");
                OnProductNameChanged();
            }
        }
        private global::System.String _ProductName;
        partial void OnProductNameChanging(global::System.String value);
        partial void OnProductNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String QuantityPerUnit
        {
            get
            {
                return _QuantityPerUnit;
            }
            set
            {
                OnQuantityPerUnitChanging(value);
                ReportPropertyChanging("QuantityPerUnit");
                _QuantityPerUnit = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("QuantityPerUnit");
                OnQuantityPerUnitChanged();
            }
        }
        private global::System.String _QuantityPerUnit;
        partial void OnQuantityPerUnitChanging(global::System.String value);
        partial void OnQuantityPerUnitChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private Nullable<global::System.Decimal> _UnitPrice;
        partial void OnUnitPriceChanging(Nullable<global::System.Decimal> value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsInStock
        {
            get
            {
                return _UnitsInStock;
            }
            set
            {
                OnUnitsInStockChanging(value);
                ReportPropertyChanging("UnitsInStock");
                _UnitsInStock = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsInStock");
                OnUnitsInStockChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsInStock;
        partial void OnUnitsInStockChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsInStockChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsOnOrder
        {
            get
            {
                return _UnitsOnOrder;
            }
            set
            {
                OnUnitsOnOrderChanging(value);
                ReportPropertyChanging("UnitsOnOrder");
                _UnitsOnOrder = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsOnOrder");
                OnUnitsOnOrderChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsOnOrder;
        partial void OnUnitsOnOrderChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsOnOrderChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> ReorderLevel
        {
            get
            {
                return _ReorderLevel;
            }
            set
            {
                OnReorderLevelChanging(value);
                ReportPropertyChanging("ReorderLevel");
                _ReorderLevel = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ReorderLevel");
                OnReorderLevelChanged();
            }
        }
        private Nullable<global::System.Int16> _ReorderLevel;
        partial void OnReorderLevelChanging(Nullable<global::System.Int16> value);
        partial void OnReorderLevelChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Boolean Discontinued
        {
            get
            {
                return _Discontinued;
            }
            set
            {
                OnDiscontinuedChanging(value);
                ReportPropertyChanging("Discontinued");
                _Discontinued = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discontinued");
                OnDiscontinuedChanged();
            }
        }
        private global::System.Boolean _Discontinued;
        partial void OnDiscontinuedChanging(global::System.Boolean value);
        partial void OnDiscontinuedChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> DiscontinuedDate
        {
            get
            {
                return _DiscontinuedDate;
            }
            set
            {
                OnDiscontinuedDateChanging(value);
                ReportPropertyChanging("DiscontinuedDate");
                _DiscontinuedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DiscontinuedDate");
                OnDiscontinuedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _DiscontinuedDate;
        partial void OnDiscontinuedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnDiscontinuedDateChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories")]
        public Categories Categories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Categories> CategoriesReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers")]
        public Suppliers Suppliers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Suppliers> SuppliersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Regions")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Regions : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Regions object.
        /// </summary>
        /// <param name="regionID">Initial value of the RegionID property.</param>
        /// <param name="regionDescription">Initial value of the RegionDescription property.</param>
        public static Regions CreateRegions(global::System.Int64 regionID, global::System.String regionDescription)
        {
            Regions regions = new Regions();
            regions.RegionID = regionID;
            regions.RegionDescription = regionDescription;
            return regions;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 RegionID
        {
            get
            {
                return _RegionID;
            }
            set
            {
                if (_RegionID != value)
                {
                    OnRegionIDChanging(value);
                    ReportPropertyChanging("RegionID");
                    _RegionID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("RegionID");
                    OnRegionIDChanged();
                }
            }
        }
        private global::System.Int64 _RegionID;
        partial void OnRegionIDChanging(global::System.Int64 value);
        partial void OnRegionIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String RegionDescription
        {
            get
            {
                return _RegionDescription;
            }
            set
            {
                OnRegionDescriptionChanging(value);
                ReportPropertyChanging("RegionDescription");
                _RegionDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("RegionDescription");
                OnRegionDescriptionChanged();
            }
        }
        private global::System.String _RegionDescription;
        partial void OnRegionDescriptionChanging(global::System.String value);
        partial void OnRegionDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Suppliers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Suppliers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Suppliers object.
        /// </summary>
        /// <param name="supplierID">Initial value of the SupplierID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Suppliers CreateSuppliers(global::System.Int64 supplierID, global::System.String companyName)
        {
            Suppliers suppliers = new Suppliers();
            suppliers.SupplierID = supplierID;
            suppliers.CompanyName = companyName;
            return suppliers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 SupplierID
        {
            get
            {
                return _SupplierID;
            }
            set
            {
                if (_SupplierID != value)
                {
                    OnSupplierIDChanging(value);
                    ReportPropertyChanging("SupplierID");
                    _SupplierID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("SupplierID");
                    OnSupplierIDChanged();
                }
            }
        }
        private global::System.Int64 _SupplierID;
        partial void OnSupplierIDChanging(global::System.Int64 value);
        partial void OnSupplierIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePage
        {
            get
            {
                return _HomePage;
            }
            set
            {
                OnHomePageChanging(value);
                ReportPropertyChanging("HomePage");
                _HomePage = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePage");
                OnHomePageChanged();
            }
        }
        private global::System.String _HomePage;
        partial void OnHomePageChanging(global::System.String value);
        partial void OnHomePageChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Territories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Territories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Territories object.
        /// </summary>
        /// <param name="territoryID">Initial value of the TerritoryID property.</param>
        /// <param name="territoryDescription">Initial value of the TerritoryDescription property.</param>
        public static Territories CreateTerritories(global::System.Int64 territoryID, global::System.String territoryDescription)
        {
            Territories territories = new Territories();
            territories.TerritoryID = territoryID;
            territories.TerritoryDescription = territoryDescription;
            return territories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 TerritoryID
        {
            get
            {
                return _TerritoryID;
            }
            set
            {
                if (_TerritoryID != value)
                {
                    OnTerritoryIDChanging(value);
                    ReportPropertyChanging("TerritoryID");
                    _TerritoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("TerritoryID");
                    OnTerritoryIDChanged();
                }
            }
        }
        private global::System.Int64 _TerritoryID;
        partial void OnTerritoryIDChanging(global::System.Int64 value);
        partial void OnTerritoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String TerritoryDescription
        {
            get
            {
                return _TerritoryDescription;
            }
            set
            {
                OnTerritoryDescriptionChanging(value);
                ReportPropertyChanging("TerritoryDescription");
                _TerritoryDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("TerritoryDescription");
                OnTerritoryDescriptionChanged();
            }
        }
        private global::System.String _TerritoryDescription;
        partial void OnTerritoryDescriptionChanging(global::System.String value);
        partial void OnTerritoryDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions")]
        public Regions Regions
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Regions> RegionsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Employees")]
        public EntityCollection<Employees> Employees
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees", value);
                }
            }
        }

        #endregion
    }

    #endregion

}

Added testlinq/NorthwindModel.EF6.2013.edmx.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
    <Schema Namespace="northwindEFModel.Store" Alias="Self" Provider="System.Data.SQLite.EF6" ProviderManifestToken="ISO8601" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
        <EntityContainer Name="northwindEFModelStoreContainer">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Store.Categories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Store.Customers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Store.Employees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="EmployeesTerritories" EntityType="northwindEFModel.Store.EmployeesTerritories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.Store.InternationalOrders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.Store.OrderDetails" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Store.Orders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.Store.PreviousEmployees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Store.Products" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Store.Regions" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Store.Suppliers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Store.Territories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <AssociationSet Name="FK_EmployeesTerritories_EmployeeID_EmployeeID" Association="northwindEFModel.Store.FK_EmployeesTerritories_EmployeeID_EmployeeID">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_EmployeesTerritories_TerritoryID_TerritoryID" Association="northwindEFModel.Store.FK_EmployeesTerritories_TerritoryID_TerritoryID">
            <End Role="Territories" EntitySet="Territories" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.Store.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.Store.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.Store.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.Store.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.Store.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.Store.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.Store.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
        </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CategoryName" Type="nvarchar" Nullable="false" MaxLength="15" />
          <Property Name="Description" Type="nvarchar" />
          <Property Name="Picture" Type="blob" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="nvarchar" Nullable="false" MaxLength="5" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="EmployeesTerritories">
          <Key>
            <PropertyRef Name="EmployeeID" />
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="CustomsDescription" Type="nvarchar" Nullable="false" MaxLength="100" />
          <Property Name="ExciseTax" Type="decimal" Nullable="false" Precision="53" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="ProductID" Type="integer" Nullable="false" />
          <Property Name="UnitPrice" Type="decimal" Nullable="false" Precision="53" />
          <Property Name="Quantity" Type="smallint" Nullable="false" />
          <!--
              NOTE: The "Discount" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbInsertCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Discount" Type="real" Nullable="false" StoreGeneratedPattern="Computed" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CustomerID" Type="nvarchar" MaxLength="5" />
          <Property Name="EmployeeID" Type="integer" />
          <Property Name="OrderDate" Type="datetime" />
          <Property Name="RequiredDate" Type="datetime" />
          <Property Name="ShippedDate" Type="datetime" />
          <!--
              NOTE: The "Freight" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbUpdateCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Freight" Type="decimal" Precision="53" StoreGeneratedPattern="Computed" />
          <Property Name="ShipName" Type="nvarchar" MaxLength="40" />
          <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" />
          <Property Name="ShipCity" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="ProductName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="SupplierID" Type="integer" />
          <Property Name="CategoryID" Type="integer" />
          <Property Name="QuantityPerUnit" Type="nvarchar" MaxLength="20" />
          <Property Name="UnitPrice" Type="decimal" Precision="53" />
          <Property Name="UnitsInStock" Type="smallint" />
          <Property Name="UnitsOnOrder" Type="smallint" />
          <Property Name="ReorderLevel" Type="smallint" />
          <Property Name="Discontinued" Type="bit" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="datetime" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="integer" Nullable="false" />
          <Property Name="RegionDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
          <Property Name="HomePage" Type="nvarchar" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
          <Property Name="TerritoryDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
          <Property Name="RegionID" Type="integer" Nullable="false" />
        </EntityType>
        <Association Name="FK_EmployeesTerritories_EmployeeID_EmployeeID">
          <End Role="Employees" Type="northwindEFModel.Store.Employees" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Employees">
              <PropertyRef Name="EmployeeID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="EmployeeID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_EmployeesTerritories_TerritoryID_TerritoryID">
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Territories">
              <PropertyRef Name="TerritoryID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="TerritoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.Store.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Store.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Customers">
              <PropertyRef Name="CustomerID" />
            </Principal>
            <Dependent Role="Orders">
              <PropertyRef Name="CustomerID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Store.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Categories">
              <PropertyRef Name="CategoryID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="CategoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Store.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Suppliers">
              <PropertyRef Name="SupplierID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="SupplierID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Store.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Regions">
              <PropertyRef Name="RegionID" />
            </Principal>
            <Dependent Role="Territories">
              <PropertyRef Name="RegionID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
      </Schema></edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="northwindEFModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
        <EntityContainer Name="northwindEFEntities">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Categories" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Customers" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Employees" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.InternationalOrders" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.OrderDetails" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Orders" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.PreviousEmployees" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Products" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Regions" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Suppliers" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Territories" />
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          <AssociationSet Name="EmployeesTerritories" Association="northwindEFModel.EmployeesTerritories">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="Int64" Nullable="false" />
          <Property Name="CategoryName" Type="String" Nullable="false" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Description" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="Picture" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Categories" ToRole="Products" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="String" Nullable="false" MaxLength="5" Unicode="true" FixedLength="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Customers" ToRole="Orders" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Employees" ToRole="Territories" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="CustomsDescription" Type="String" Nullable="false" MaxLength="100" Unicode="true" FixedLength="false" />
          <Property Name="ExciseTax" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="InternationalOrders" ToRole="Orders" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="UnitPrice" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <Property Name="Quantity" Type="Int16" Nullable="false" />
          <Property Name="Discount" Type="Single" Nullable="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="OrderDetails" ToRole="Orders" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="OrderDetails" ToRole="Products" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="EmployeeID" Type="Int64" />
          <Property Name="OrderDate" Type="DateTime" />
          <Property Name="RequiredDate" Type="DateTime" />
          <Property Name="ShippedDate" Type="DateTime" />
          <Property Name="Freight" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="ShipName" Type="String" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ShipAddress" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="ShipCity" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipRegion" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipPostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="ShipCountry" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Customers" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Orders" ToRole="Customers" />
          <NavigationProperty Name="InternationalOrders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="Orders" ToRole="InternationalOrders" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="Orders" ToRole="OrderDetails" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="ProductName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="QuantityPerUnit" Type="String" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="UnitPrice" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="UnitsInStock" Type="Int16" />
          <Property Name="UnitsOnOrder" Type="Int16" />
          <Property Name="ReorderLevel" Type="Int16" />
          <Property Name="Discontinued" Type="Boolean" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="DateTime" />
          <NavigationProperty Name="Categories" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Products" ToRole="Categories" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="Products" ToRole="OrderDetails" />
          <NavigationProperty Name="Suppliers" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Products" ToRole="Suppliers" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="Int64" Nullable="false" />
          <Property Name="RegionDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Regions" ToRole="Territories" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="Int64" Nullable="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="HomePage" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Suppliers" ToRole="Products" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="Int64" Nullable="false" />
          <Property Name="TerritoryDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Regions" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Territories" ToRole="Regions" />
          <NavigationProperty Name="Employees" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Territories" ToRole="Employees" />
        </EntityType>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="*" />
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        <Association Name="EmployeesTerritories">
          <End Role="Employees" Type="northwindEFModel.Employees" Multiplicity="*" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        </Schema>
    </edmx:ConceptualModels>
    <!-- C-S mapping content -->
    <edmx:Mappings>
      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
        <EntityContainerMapping StorageEntityContainer="northwindEFModelStoreContainer" CdmEntityContainer="northwindEFEntities">
          <EntitySetMapping Name="Categories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Categories)">
              <MappingFragment StoreEntitySet="Categories">
                <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
                <ScalarProperty Name="CategoryName" ColumnName="CategoryName" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="Picture" ColumnName="Picture" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Customers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Customers)">
              <MappingFragment StoreEntitySet="Customers">
                <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Employees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Employees)">
              <MappingFragment StoreEntitySet="Employees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="InternationalOrders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.InternationalOrders)">
              <MappingFragment StoreEntitySet="InternationalOrders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="CustomsDescription" ColumnName="CustomsDescription" />
                <ScalarProperty Name="ExciseTax" ColumnName="ExciseTax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="OrderDetails">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.OrderDetails)">
              <MappingFragment StoreEntitySet="OrderDetails">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="Quantity" ColumnName="Quantity" />
                <ScalarProperty Name="Discount" ColumnName="Discount" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Orders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Orders)">
              <MappingFragment StoreEntitySet="Orders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="OrderDate" ColumnName="OrderDate" />
                <ScalarProperty Name="RequiredDate" ColumnName="RequiredDate" />
                <ScalarProperty Name="ShippedDate" ColumnName="ShippedDate" />
                <ScalarProperty Name="Freight" ColumnName="Freight" />
                <ScalarProperty Name="ShipName" ColumnName="ShipName" />
                <ScalarProperty Name="ShipAddress" ColumnName="ShipAddress" />
                <ScalarProperty Name="ShipCity" ColumnName="ShipCity" />
                <ScalarProperty Name="ShipRegion" ColumnName="ShipRegion" />
                <ScalarProperty Name="ShipPostalCode" ColumnName="ShipPostalCode" />
                <ScalarProperty Name="ShipCountry" ColumnName="ShipCountry" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="PreviousEmployees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.PreviousEmployees)">
              <MappingFragment StoreEntitySet="PreviousEmployees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Products">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Products)">
              <MappingFragment StoreEntitySet="Products">
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="ProductName" ColumnName="ProductName" />
                <ScalarProperty Name="QuantityPerUnit" ColumnName="QuantityPerUnit" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="UnitsInStock" ColumnName="UnitsInStock" />
                <ScalarProperty Name="UnitsOnOrder" ColumnName="UnitsOnOrder" />
                <ScalarProperty Name="ReorderLevel" ColumnName="ReorderLevel" />
                <ScalarProperty Name="Discontinued" ColumnName="Discontinued" />
                <ScalarProperty Name="DiscontinuedDate" ColumnName="DiscontinuedDate" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Regions">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Regions)">
              <MappingFragment StoreEntitySet="Regions">
                <ScalarProperty Name="RegionID" ColumnName="RegionID" />
                <ScalarProperty Name="RegionDescription" ColumnName="RegionDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Suppliers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Suppliers)">
              <MappingFragment StoreEntitySet="Suppliers">
                <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
                <ScalarProperty Name="HomePage" ColumnName="HomePage" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Territories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Territories)">
              <MappingFragment StoreEntitySet="Territories">
                <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
                <ScalarProperty Name="TerritoryDescription" ColumnName="TerritoryDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <AssociationSetMapping Name="FK_Products_CategoryID_CategoryID" TypeName="northwindEFModel.FK_Products_CategoryID_CategoryID" StoreEntitySet="Products">
            <EndProperty Name="Categories">
              <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="CategoryID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Orders_CustomerID_CustomerID" TypeName="northwindEFModel.FK_Orders_CustomerID_CustomerID" StoreEntitySet="Orders">
            <EndProperty Name="Customers">
              <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
            </EndProperty>
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <Condition ColumnName="CustomerID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_InternationalOrders_OrderID_OrderID" TypeName="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" StoreEntitySet="InternationalOrders">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="InternationalOrders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_OrderID_OrderID" TypeName="northwindEFModel.FK_OrderDetails_OrderID_OrderID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_ProductID_ProductID" TypeName="northwindEFModel.FK_OrderDetails_ProductID_ProductID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Products_SupplierID_SupplierID" TypeName="northwindEFModel.FK_Products_SupplierID_SupplierID" StoreEntitySet="Products">
            <EndProperty Name="Suppliers">
              <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="SupplierID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Territories_RegionID_RegionID" TypeName="northwindEFModel.FK_Territories_RegionID_RegionID" StoreEntitySet="Territories">
            <EndProperty Name="Regions">
              <ScalarProperty Name="RegionID" ColumnName="RegionID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="EmployeesTerritories" TypeName="northwindEFModel.EmployeesTerritories" StoreEntitySet="EmployeesTerritories">
            <EndProperty Name="Employees">
              <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          </EntityContainerMapping>
      </Mapping>
    </edmx:Mappings>
  </edmx:Runtime>
  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
  <edmx:Designer>
    <edmx:Connection>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </edmx:Connection>
    <edmx:Options>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
      </DesignerInfoPropertySet>
    </edmx:Options>
    <!-- Diagram content (shape and connector positions) -->
    <edmx:Diagrams>
      <Diagram Name="NorthwindModel" xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <EntityTypeShape EntityType="northwindEFModel.Categories" Width="1.5" PointX="0.75" PointY="1.625" Height="1.9802864583333335" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Customers" Width="1.5" PointX="0.75" PointY="9.625" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Employees" Width="1.5" PointX="2.75" PointY="14.625" Height="4.4802050781250014" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.InternationalOrders" Width="1.5" PointX="5.25" PointY="10.375" Height="1.7879850260416674" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.OrderDetails" Width="1.5" PointX="5.25" PointY="1.5" Height="2.3648893229166656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Orders" Width="1.5" PointX="3" PointY="9.25" Height="3.9033007812499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.PreviousEmployees" Width="1.5" PointX="7.75" PointY="0.75" Height="4.2879036458333317" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Products" Width="1.5" PointX="3" PointY="1" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Regions" Width="1.5" PointX="2.75" PointY="6" Height="1.5956835937499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Suppliers" Width="1.5" PointX="0.75" PointY="4.875" Height="3.5186979166666656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Territories" Width="1.5" PointX="5" PointY="5.875" Height="1.7879850260416674" IsExpanded="true" />
        <AssociationConnector Association="northwindEFModel.FK_Products_CategoryID_CategoryID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="2.6151432291666667" />
          <ConnectorPoint PointX="3" PointY="2.6151432291666667" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Orders_CustomerID_CustomerID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="11.2881982421875" />
          <ConnectorPoint PointX="3" PointY="11.2881982421875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.010416666666667" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.177083333333333" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.25" PointY="11.268992513020834" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="3.75" PointY="9.25" />
          <ConnectorPoint PointX="3.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="2.6824446614583328" />
          <ConnectorPoint PointX="5.25" PointY="2.6824446614583328" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="2.0287223307291664" />
          <ConnectorPoint PointX="5.25" PointY="2.0287223307291664" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Products_SupplierID_SupplierID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="4.326396484375" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Territories_RegionID_RegionID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="6.797841796875" />
          <ConnectorPoint PointX="4.666666666666667" PointY="6.7978417968749989" />
          <ConnectorPoint PointX="4.833333333333333" PointY="6.797841796875" />
          <ConnectorPoint PointX="5" PointY="6.797841796875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.EmployeesTerritories" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="7.6629850260416674" /></AssociationConnector>
        </Diagram></edmx:Diagrams>
  </edmx:Designer>
</edmx:Edmx>

Added testlinq/NorthwindModel.EF6.2015.Designer.cs.





































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

//------------------------------------------------------------------------------
// <auto-generated>
//    This code was generated from a template.
//
//    Manual changes to this file may cause unexpected behavior in your application.
//    Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.ComponentModel;
using System.Data.Entity.Core.EntityClient;
using System.Data.Entity.Core.Metadata.Edm;
using System.Data.Entity.Core.Objects;
using System.Data.Entity.Core.Objects.DataClasses;
using System.Runtime.Serialization;
using System.Xml.Serialization;

[assembly: EdmSchemaAttribute()]
#region EDM Relationship Metadata

[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Categories), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Customers), "Orders", RelationshipMultiplicity.Many, typeof(testlinq.Orders))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "InternationalOrders", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.InternationalOrders), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products", RelationshipMultiplicity.One, typeof(testlinq.Products), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Suppliers), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions", RelationshipMultiplicity.One, typeof(testlinq.Regions), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "EmployeesTerritories", "Employees", RelationshipMultiplicity.Many, typeof(testlinq.Employees), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]

#endregion

namespace testlinq
{
    #region Contexts

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    public partial class northwindEFEntities : ObjectContext
    {
        #region Constructors

        /// <summary>
        /// Initializes a new northwindEFEntities object using the connection string found in the 'northwindEFEntities' section of the application configuration file.
        /// </summary>
        public northwindEFEntities() : base("name=northwindEFEntities", "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(string connectionString) : base(connectionString, "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(EntityConnection connection) : base(connection, "northwindEFEntities")
        {
            OnContextCreated();
        }

        #endregion

        #region Partial Methods

        partial void OnContextCreated();

        #endregion

        #region ObjectSet Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Categories> Categories
        {
            get
            {
                if ((_Categories == null))
                {
                    _Categories = base.CreateObjectSet<Categories>("Categories");
                }
                return _Categories;
            }
        }
        private ObjectSet<Categories> _Categories;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Customers> Customers
        {
            get
            {
                if ((_Customers == null))
                {
                    _Customers = base.CreateObjectSet<Customers>("Customers");
                }
                return _Customers;
            }
        }
        private ObjectSet<Customers> _Customers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Employees> Employees
        {
            get
            {
                if ((_Employees == null))
                {
                    _Employees = base.CreateObjectSet<Employees>("Employees");
                }
                return _Employees;
            }
        }
        private ObjectSet<Employees> _Employees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<InternationalOrders> InternationalOrders
        {
            get
            {
                if ((_InternationalOrders == null))
                {
                    _InternationalOrders = base.CreateObjectSet<InternationalOrders>("InternationalOrders");
                }
                return _InternationalOrders;
            }
        }
        private ObjectSet<InternationalOrders> _InternationalOrders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<OrderDetails> OrderDetails
        {
            get
            {
                if ((_OrderDetails == null))
                {
                    _OrderDetails = base.CreateObjectSet<OrderDetails>("OrderDetails");
                }
                return _OrderDetails;
            }
        }
        private ObjectSet<OrderDetails> _OrderDetails;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Orders> Orders
        {
            get
            {
                if ((_Orders == null))
                {
                    _Orders = base.CreateObjectSet<Orders>("Orders");
                }
                return _Orders;
            }
        }
        private ObjectSet<Orders> _Orders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<PreviousEmployees> PreviousEmployees
        {
            get
            {
                if ((_PreviousEmployees == null))
                {
                    _PreviousEmployees = base.CreateObjectSet<PreviousEmployees>("PreviousEmployees");
                }
                return _PreviousEmployees;
            }
        }
        private ObjectSet<PreviousEmployees> _PreviousEmployees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Products> Products
        {
            get
            {
                if ((_Products == null))
                {
                    _Products = base.CreateObjectSet<Products>("Products");
                }
                return _Products;
            }
        }
        private ObjectSet<Products> _Products;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Regions> Regions
        {
            get
            {
                if ((_Regions == null))
                {
                    _Regions = base.CreateObjectSet<Regions>("Regions");
                }
                return _Regions;
            }
        }
        private ObjectSet<Regions> _Regions;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Suppliers> Suppliers
        {
            get
            {
                if ((_Suppliers == null))
                {
                    _Suppliers = base.CreateObjectSet<Suppliers>("Suppliers");
                }
                return _Suppliers;
            }
        }
        private ObjectSet<Suppliers> _Suppliers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Territories> Territories
        {
            get
            {
                if ((_Territories == null))
                {
                    _Territories = base.CreateObjectSet<Territories>("Territories");
                }
                return _Territories;
            }
        }
        private ObjectSet<Territories> _Territories;

        #endregion
        #region AddTo Methods

        /// <summary>
        /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCategories(Categories categories)
        {
            base.AddObject("Categories", categories);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Customers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCustomers(Customers customers)
        {
            base.AddObject("Customers", customers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Employees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToEmployees(Employees employees)
        {
            base.AddObject("Employees", employees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the InternationalOrders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToInternationalOrders(InternationalOrders internationalOrders)
        {
            base.AddObject("InternationalOrders", internationalOrders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the OrderDetails EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrderDetails(OrderDetails orderDetails)
        {
            base.AddObject("OrderDetails", orderDetails);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Orders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrders(Orders orders)
        {
            base.AddObject("Orders", orders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the PreviousEmployees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToPreviousEmployees(PreviousEmployees previousEmployees)
        {
            base.AddObject("PreviousEmployees", previousEmployees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToProducts(Products products)
        {
            base.AddObject("Products", products);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Regions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToRegions(Regions regions)
        {
            base.AddObject("Regions", regions);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Suppliers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToSuppliers(Suppliers suppliers)
        {
            base.AddObject("Suppliers", suppliers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Territories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToTerritories(Territories territories)
        {
            base.AddObject("Territories", territories);
        }

        #endregion
    }


    #endregion

    #region Entities

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Categories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Categories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Categories object.
        /// </summary>
        /// <param name="categoryID">Initial value of the CategoryID property.</param>
        /// <param name="categoryName">Initial value of the CategoryName property.</param>
        public static Categories CreateCategories(global::System.Int64 categoryID, global::System.String categoryName)
        {
            Categories categories = new Categories();
            categories.CategoryID = categoryID;
            categories.CategoryName = categoryName;
            return categories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 CategoryID
        {
            get
            {
                return _CategoryID;
            }
            set
            {
                if (_CategoryID != value)
                {
                    OnCategoryIDChanging(value);
                    ReportPropertyChanging("CategoryID");
                    _CategoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("CategoryID");
                    OnCategoryIDChanged();
                }
            }
        }
        private global::System.Int64 _CategoryID;
        partial void OnCategoryIDChanging(global::System.Int64 value);
        partial void OnCategoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CategoryName
        {
            get
            {
                return _CategoryName;
            }
            set
            {
                OnCategoryNameChanging(value);
                ReportPropertyChanging("CategoryName");
                _CategoryName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CategoryName");
                OnCategoryNameChanged();
            }
        }
        private global::System.String _CategoryName;
        partial void OnCategoryNameChanging(global::System.String value);
        partial void OnCategoryNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Description
        {
            get
            {
                return _Description;
            }
            set
            {
                OnDescriptionChanging(value);
                ReportPropertyChanging("Description");
                _Description = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Description");
                OnDescriptionChanged();
            }
        }
        private global::System.String _Description;
        partial void OnDescriptionChanging(global::System.String value);
        partial void OnDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Picture
        {
            get
            {
                return StructuralObject.GetValidValue(_Picture);
            }
            set
            {
                OnPictureChanging(value);
                ReportPropertyChanging("Picture");
                _Picture = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Picture");
                OnPictureChanged();
            }
        }
        private global::System.Byte[] _Picture;
        partial void OnPictureChanging(global::System.Byte[] value);
        partial void OnPictureChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Customers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Customers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Customers object.
        /// </summary>
        /// <param name="customerID">Initial value of the CustomerID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Customers CreateCustomers(global::System.String customerID, global::System.String companyName)
        {
            Customers customers = new Customers();
            customers.CustomerID = customerID;
            customers.CompanyName = companyName;
            return customers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomerID
        {
            get
            {
                return _CustomerID;
            }
            set
            {
                if (_CustomerID != value)
                {
                    OnCustomerIDChanging(value);
                    ReportPropertyChanging("CustomerID");
                    _CustomerID = StructuralObject.SetValidValue(value, false);
                    ReportPropertyChanged("CustomerID");
                    OnCustomerIDChanged();
                }
            }
        }
        private global::System.String _CustomerID;
        partial void OnCustomerIDChanging(global::System.String value);
        partial void OnCustomerIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Orders")]
        public EntityCollection<Orders> Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Employees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Employees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Employees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static Employees CreateEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            Employees employees = new Employees();
            employees.EmployeeID = employeeID;
            employees.LastName = lastName;
            employees.FirstName = firstName;
            return employees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="InternationalOrders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class InternationalOrders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new InternationalOrders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="customsDescription">Initial value of the CustomsDescription property.</param>
        /// <param name="exciseTax">Initial value of the ExciseTax property.</param>
        public static InternationalOrders CreateInternationalOrders(global::System.Int64 orderID, global::System.String customsDescription, global::System.Decimal exciseTax)
        {
            InternationalOrders internationalOrders = new InternationalOrders();
            internationalOrders.OrderID = orderID;
            internationalOrders.CustomsDescription = customsDescription;
            internationalOrders.ExciseTax = exciseTax;
            return internationalOrders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomsDescription
        {
            get
            {
                return _CustomsDescription;
            }
            set
            {
                OnCustomsDescriptionChanging(value);
                ReportPropertyChanging("CustomsDescription");
                _CustomsDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CustomsDescription");
                OnCustomsDescriptionChanged();
            }
        }
        private global::System.String _CustomsDescription;
        partial void OnCustomsDescriptionChanging(global::System.String value);
        partial void OnCustomsDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal ExciseTax
        {
            get
            {
                return _ExciseTax;
            }
            set
            {
                OnExciseTaxChanging(value);
                ReportPropertyChanging("ExciseTax");
                _ExciseTax = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ExciseTax");
                OnExciseTaxChanged();
            }
        }
        private global::System.Decimal _ExciseTax;
        partial void OnExciseTaxChanging(global::System.Decimal value);
        partial void OnExciseTaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="OrderDetails")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class OrderDetails : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new OrderDetails object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="unitPrice">Initial value of the UnitPrice property.</param>
        /// <param name="quantity">Initial value of the Quantity property.</param>
        /// <param name="discount">Initial value of the Discount property.</param>
        public static OrderDetails CreateOrderDetails(global::System.Int64 orderID, global::System.Int64 productID, global::System.Decimal unitPrice, global::System.Int16 quantity, global::System.Single discount)
        {
            OrderDetails orderDetails = new OrderDetails();
            orderDetails.OrderID = orderID;
            orderDetails.ProductID = productID;
            orderDetails.UnitPrice = unitPrice;
            orderDetails.Quantity = quantity;
            orderDetails.Discount = discount;
            return orderDetails;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private global::System.Decimal _UnitPrice;
        partial void OnUnitPriceChanging(global::System.Decimal value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int16 Quantity
        {
            get
            {
                return _Quantity;
            }
            set
            {
                OnQuantityChanging(value);
                ReportPropertyChanging("Quantity");
                _Quantity = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Quantity");
                OnQuantityChanged();
            }
        }
        private global::System.Int16 _Quantity;
        partial void OnQuantityChanging(global::System.Int16 value);
        partial void OnQuantityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Single Discount
        {
            get
            {
                return _Discount;
            }
            set
            {
                OnDiscountChanging(value);
                ReportPropertyChanging("Discount");
                _Discount = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discount");
                OnDiscountChanged();
            }
        }
        private global::System.Single _Discount;
        partial void OnDiscountChanging(global::System.Single value);
        partial void OnDiscountChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products")]
        public Products Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Products> ProductsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Orders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Orders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Orders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        public static Orders CreateOrders(global::System.Int64 orderID)
        {
            Orders orders = new Orders();
            orders.OrderID = orderID;
            return orders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int64> EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                OnEmployeeIDChanging(value);
                ReportPropertyChanging("EmployeeID");
                _EmployeeID = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("EmployeeID");
                OnEmployeeIDChanged();
            }
        }
        private Nullable<global::System.Int64> _EmployeeID;
        partial void OnEmployeeIDChanging(Nullable<global::System.Int64> value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> OrderDate
        {
            get
            {
                return _OrderDate;
            }
            set
            {
                OnOrderDateChanging(value);
                ReportPropertyChanging("OrderDate");
                _OrderDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("OrderDate");
                OnOrderDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _OrderDate;
        partial void OnOrderDateChanging(Nullable<global::System.DateTime> value);
        partial void OnOrderDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> RequiredDate
        {
            get
            {
                return _RequiredDate;
            }
            set
            {
                OnRequiredDateChanging(value);
                ReportPropertyChanging("RequiredDate");
                _RequiredDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("RequiredDate");
                OnRequiredDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _RequiredDate;
        partial void OnRequiredDateChanging(Nullable<global::System.DateTime> value);
        partial void OnRequiredDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> ShippedDate
        {
            get
            {
                return _ShippedDate;
            }
            set
            {
                OnShippedDateChanging(value);
                ReportPropertyChanging("ShippedDate");
                _ShippedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ShippedDate");
                OnShippedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _ShippedDate;
        partial void OnShippedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnShippedDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> Freight
        {
            get
            {
                return _Freight;
            }
            set
            {
                OnFreightChanging(value);
                ReportPropertyChanging("Freight");
                _Freight = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Freight");
                OnFreightChanged();
            }
        }
        private Nullable<global::System.Decimal> _Freight;
        partial void OnFreightChanging(Nullable<global::System.Decimal> value);
        partial void OnFreightChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipName
        {
            get
            {
                return _ShipName;
            }
            set
            {
                OnShipNameChanging(value);
                ReportPropertyChanging("ShipName");
                _ShipName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipName");
                OnShipNameChanged();
            }
        }
        private global::System.String _ShipName;
        partial void OnShipNameChanging(global::System.String value);
        partial void OnShipNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipAddress
        {
            get
            {
                return _ShipAddress;
            }
            set
            {
                OnShipAddressChanging(value);
                ReportPropertyChanging("ShipAddress");
                _ShipAddress = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipAddress");
                OnShipAddressChanged();
            }
        }
        private global::System.String _ShipAddress;
        partial void OnShipAddressChanging(global::System.String value);
        partial void OnShipAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCity
        {
            get
            {
                return _ShipCity;
            }
            set
            {
                OnShipCityChanging(value);
                ReportPropertyChanging("ShipCity");
                _ShipCity = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCity");
                OnShipCityChanged();
            }
        }
        private global::System.String _ShipCity;
        partial void OnShipCityChanging(global::System.String value);
        partial void OnShipCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipRegion
        {
            get
            {
                return _ShipRegion;
            }
            set
            {
                OnShipRegionChanging(value);
                ReportPropertyChanging("ShipRegion");
                _ShipRegion = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipRegion");
                OnShipRegionChanged();
            }
        }
        private global::System.String _ShipRegion;
        partial void OnShipRegionChanging(global::System.String value);
        partial void OnShipRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipPostalCode
        {
            get
            {
                return _ShipPostalCode;
            }
            set
            {
                OnShipPostalCodeChanging(value);
                ReportPropertyChanging("ShipPostalCode");
                _ShipPostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipPostalCode");
                OnShipPostalCodeChanged();
            }
        }
        private global::System.String _ShipPostalCode;
        partial void OnShipPostalCodeChanging(global::System.String value);
        partial void OnShipPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCountry
        {
            get
            {
                return _ShipCountry;
            }
            set
            {
                OnShipCountryChanging(value);
                ReportPropertyChanging("ShipCountry");
                _ShipCountry = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCountry");
                OnShipCountryChanged();
            }
        }
        private global::System.String _ShipCountry;
        partial void OnShipCountryChanging(global::System.String value);
        partial void OnShipCountryChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers")]
        public Customers Customers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Customers> CustomersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "InternationalOrders")]
        public InternationalOrders InternationalOrders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<InternationalOrders> InternationalOrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="PreviousEmployees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class PreviousEmployees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new PreviousEmployees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static PreviousEmployees CreatePreviousEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            PreviousEmployees previousEmployees = new PreviousEmployees();
            previousEmployees.EmployeeID = employeeID;
            previousEmployees.LastName = lastName;
            previousEmployees.FirstName = firstName;
            return previousEmployees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Products")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Products : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Products object.
        /// </summary>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="productName">Initial value of the ProductName property.</param>
        /// <param name="discontinued">Initial value of the Discontinued property.</param>
        public static Products CreateProducts(global::System.Int64 productID, global::System.String productName, global::System.Boolean discontinued)
        {
            Products products = new Products();
            products.ProductID = productID;
            products.ProductName = productName;
            products.Discontinued = discontinued;
            return products;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String ProductName
        {
            get
            {
                return _ProductName;
            }
            set
            {
                OnProductNameChanging(value);
                ReportPropertyChanging("ProductName");
                _ProductName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("ProductName");
                OnProductNameChanged();
            }
        }
        private global::System.String _ProductName;
        partial void OnProductNameChanging(global::System.String value);
        partial void OnProductNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String QuantityPerUnit
        {
            get
            {
                return _QuantityPerUnit;
            }
            set
            {
                OnQuantityPerUnitChanging(value);
                ReportPropertyChanging("QuantityPerUnit");
                _QuantityPerUnit = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("QuantityPerUnit");
                OnQuantityPerUnitChanged();
            }
        }
        private global::System.String _QuantityPerUnit;
        partial void OnQuantityPerUnitChanging(global::System.String value);
        partial void OnQuantityPerUnitChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private Nullable<global::System.Decimal> _UnitPrice;
        partial void OnUnitPriceChanging(Nullable<global::System.Decimal> value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsInStock
        {
            get
            {
                return _UnitsInStock;
            }
            set
            {
                OnUnitsInStockChanging(value);
                ReportPropertyChanging("UnitsInStock");
                _UnitsInStock = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsInStock");
                OnUnitsInStockChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsInStock;
        partial void OnUnitsInStockChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsInStockChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsOnOrder
        {
            get
            {
                return _UnitsOnOrder;
            }
            set
            {
                OnUnitsOnOrderChanging(value);
                ReportPropertyChanging("UnitsOnOrder");
                _UnitsOnOrder = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsOnOrder");
                OnUnitsOnOrderChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsOnOrder;
        partial void OnUnitsOnOrderChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsOnOrderChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> ReorderLevel
        {
            get
            {
                return _ReorderLevel;
            }
            set
            {
                OnReorderLevelChanging(value);
                ReportPropertyChanging("ReorderLevel");
                _ReorderLevel = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ReorderLevel");
                OnReorderLevelChanged();
            }
        }
        private Nullable<global::System.Int16> _ReorderLevel;
        partial void OnReorderLevelChanging(Nullable<global::System.Int16> value);
        partial void OnReorderLevelChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Boolean Discontinued
        {
            get
            {
                return _Discontinued;
            }
            set
            {
                OnDiscontinuedChanging(value);
                ReportPropertyChanging("Discontinued");
                _Discontinued = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discontinued");
                OnDiscontinuedChanged();
            }
        }
        private global::System.Boolean _Discontinued;
        partial void OnDiscontinuedChanging(global::System.Boolean value);
        partial void OnDiscontinuedChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> DiscontinuedDate
        {
            get
            {
                return _DiscontinuedDate;
            }
            set
            {
                OnDiscontinuedDateChanging(value);
                ReportPropertyChanging("DiscontinuedDate");
                _DiscontinuedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DiscontinuedDate");
                OnDiscontinuedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _DiscontinuedDate;
        partial void OnDiscontinuedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnDiscontinuedDateChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories")]
        public Categories Categories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Categories> CategoriesReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers")]
        public Suppliers Suppliers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Suppliers> SuppliersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Regions")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Regions : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Regions object.
        /// </summary>
        /// <param name="regionID">Initial value of the RegionID property.</param>
        /// <param name="regionDescription">Initial value of the RegionDescription property.</param>
        public static Regions CreateRegions(global::System.Int64 regionID, global::System.String regionDescription)
        {
            Regions regions = new Regions();
            regions.RegionID = regionID;
            regions.RegionDescription = regionDescription;
            return regions;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 RegionID
        {
            get
            {
                return _RegionID;
            }
            set
            {
                if (_RegionID != value)
                {
                    OnRegionIDChanging(value);
                    ReportPropertyChanging("RegionID");
                    _RegionID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("RegionID");
                    OnRegionIDChanged();
                }
            }
        }
        private global::System.Int64 _RegionID;
        partial void OnRegionIDChanging(global::System.Int64 value);
        partial void OnRegionIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String RegionDescription
        {
            get
            {
                return _RegionDescription;
            }
            set
            {
                OnRegionDescriptionChanging(value);
                ReportPropertyChanging("RegionDescription");
                _RegionDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("RegionDescription");
                OnRegionDescriptionChanged();
            }
        }
        private global::System.String _RegionDescription;
        partial void OnRegionDescriptionChanging(global::System.String value);
        partial void OnRegionDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Suppliers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Suppliers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Suppliers object.
        /// </summary>
        /// <param name="supplierID">Initial value of the SupplierID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Suppliers CreateSuppliers(global::System.Int64 supplierID, global::System.String companyName)
        {
            Suppliers suppliers = new Suppliers();
            suppliers.SupplierID = supplierID;
            suppliers.CompanyName = companyName;
            return suppliers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 SupplierID
        {
            get
            {
                return _SupplierID;
            }
            set
            {
                if (_SupplierID != value)
                {
                    OnSupplierIDChanging(value);
                    ReportPropertyChanging("SupplierID");
                    _SupplierID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("SupplierID");
                    OnSupplierIDChanged();
                }
            }
        }
        private global::System.Int64 _SupplierID;
        partial void OnSupplierIDChanging(global::System.Int64 value);
        partial void OnSupplierIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePage
        {
            get
            {
                return _HomePage;
            }
            set
            {
                OnHomePageChanging(value);
                ReportPropertyChanging("HomePage");
                _HomePage = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePage");
                OnHomePageChanged();
            }
        }
        private global::System.String _HomePage;
        partial void OnHomePageChanging(global::System.String value);
        partial void OnHomePageChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Territories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Territories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Territories object.
        /// </summary>
        /// <param name="territoryID">Initial value of the TerritoryID property.</param>
        /// <param name="territoryDescription">Initial value of the TerritoryDescription property.</param>
        public static Territories CreateTerritories(global::System.Int64 territoryID, global::System.String territoryDescription)
        {
            Territories territories = new Territories();
            territories.TerritoryID = territoryID;
            territories.TerritoryDescription = territoryDescription;
            return territories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 TerritoryID
        {
            get
            {
                return _TerritoryID;
            }
            set
            {
                if (_TerritoryID != value)
                {
                    OnTerritoryIDChanging(value);
                    ReportPropertyChanging("TerritoryID");
                    _TerritoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("TerritoryID");
                    OnTerritoryIDChanged();
                }
            }
        }
        private global::System.Int64 _TerritoryID;
        partial void OnTerritoryIDChanging(global::System.Int64 value);
        partial void OnTerritoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String TerritoryDescription
        {
            get
            {
                return _TerritoryDescription;
            }
            set
            {
                OnTerritoryDescriptionChanging(value);
                ReportPropertyChanging("TerritoryDescription");
                _TerritoryDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("TerritoryDescription");
                OnTerritoryDescriptionChanged();
            }
        }
        private global::System.String _TerritoryDescription;
        partial void OnTerritoryDescriptionChanging(global::System.String value);
        partial void OnTerritoryDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions")]
        public Regions Regions
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Regions> RegionsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Employees")]
        public EntityCollection<Employees> Employees
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees", value);
                }
            }
        }

        #endregion
    }

    #endregion

}

Added testlinq/NorthwindModel.EF6.2015.edmx.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
    <Schema Namespace="northwindEFModel.Store" Alias="Self" Provider="System.Data.SQLite.EF6" ProviderManifestToken="ISO8601" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
        <EntityContainer Name="northwindEFModelStoreContainer">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Store.Categories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Store.Customers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Store.Employees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="EmployeesTerritories" EntityType="northwindEFModel.Store.EmployeesTerritories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.Store.InternationalOrders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.Store.OrderDetails" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Store.Orders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.Store.PreviousEmployees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Store.Products" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Store.Regions" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Store.Suppliers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Store.Territories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <AssociationSet Name="FK_EmployeesTerritories_EmployeeID_EmployeeID" Association="northwindEFModel.Store.FK_EmployeesTerritories_EmployeeID_EmployeeID">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_EmployeesTerritories_TerritoryID_TerritoryID" Association="northwindEFModel.Store.FK_EmployeesTerritories_TerritoryID_TerritoryID">
            <End Role="Territories" EntitySet="Territories" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.Store.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.Store.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.Store.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.Store.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.Store.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.Store.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.Store.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
        </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CategoryName" Type="nvarchar" Nullable="false" MaxLength="15" />
          <Property Name="Description" Type="nvarchar" />
          <Property Name="Picture" Type="blob" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="nvarchar" Nullable="false" MaxLength="5" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="EmployeesTerritories">
          <Key>
            <PropertyRef Name="EmployeeID" />
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="CustomsDescription" Type="nvarchar" Nullable="false" MaxLength="100" />
          <Property Name="ExciseTax" Type="decimal" Nullable="false" Precision="53" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="ProductID" Type="integer" Nullable="false" />
          <Property Name="UnitPrice" Type="decimal" Nullable="false" Precision="53" />
          <Property Name="Quantity" Type="smallint" Nullable="false" />
          <!--
              NOTE: The "Discount" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbInsertCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Discount" Type="real" Nullable="false" StoreGeneratedPattern="Computed" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CustomerID" Type="nvarchar" MaxLength="5" />
          <Property Name="EmployeeID" Type="integer" />
          <Property Name="OrderDate" Type="datetime" />
          <Property Name="RequiredDate" Type="datetime" />
          <Property Name="ShippedDate" Type="datetime" />
          <!--
              NOTE: The "Freight" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbUpdateCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Freight" Type="decimal" Precision="53" StoreGeneratedPattern="Computed" />
          <Property Name="ShipName" Type="nvarchar" MaxLength="40" />
          <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" />
          <Property Name="ShipCity" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="ProductName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="SupplierID" Type="integer" />
          <Property Name="CategoryID" Type="integer" />
          <Property Name="QuantityPerUnit" Type="nvarchar" MaxLength="20" />
          <Property Name="UnitPrice" Type="decimal" Precision="53" />
          <Property Name="UnitsInStock" Type="smallint" />
          <Property Name="UnitsOnOrder" Type="smallint" />
          <Property Name="ReorderLevel" Type="smallint" />
          <Property Name="Discontinued" Type="bit" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="datetime" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="integer" Nullable="false" />
          <Property Name="RegionDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
          <Property Name="HomePage" Type="nvarchar" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
          <Property Name="TerritoryDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
          <Property Name="RegionID" Type="integer" Nullable="false" />
        </EntityType>
        <Association Name="FK_EmployeesTerritories_EmployeeID_EmployeeID">
          <End Role="Employees" Type="northwindEFModel.Store.Employees" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Employees">
              <PropertyRef Name="EmployeeID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="EmployeeID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_EmployeesTerritories_TerritoryID_TerritoryID">
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Territories">
              <PropertyRef Name="TerritoryID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="TerritoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.Store.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Store.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Customers">
              <PropertyRef Name="CustomerID" />
            </Principal>
            <Dependent Role="Orders">
              <PropertyRef Name="CustomerID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Store.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Categories">
              <PropertyRef Name="CategoryID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="CategoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Store.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Suppliers">
              <PropertyRef Name="SupplierID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="SupplierID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Store.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Regions">
              <PropertyRef Name="RegionID" />
            </Principal>
            <Dependent Role="Territories">
              <PropertyRef Name="RegionID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
      </Schema></edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="northwindEFModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
        <EntityContainer Name="northwindEFEntities">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Categories" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Customers" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Employees" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.InternationalOrders" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.OrderDetails" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Orders" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.PreviousEmployees" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Products" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Regions" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Suppliers" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Territories" />
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          <AssociationSet Name="EmployeesTerritories" Association="northwindEFModel.EmployeesTerritories">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="Int64" Nullable="false" />
          <Property Name="CategoryName" Type="String" Nullable="false" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Description" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="Picture" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Categories" ToRole="Products" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="String" Nullable="false" MaxLength="5" Unicode="true" FixedLength="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Customers" ToRole="Orders" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Employees" ToRole="Territories" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="CustomsDescription" Type="String" Nullable="false" MaxLength="100" Unicode="true" FixedLength="false" />
          <Property Name="ExciseTax" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="InternationalOrders" ToRole="Orders" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="UnitPrice" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <Property Name="Quantity" Type="Int16" Nullable="false" />
          <Property Name="Discount" Type="Single" Nullable="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="OrderDetails" ToRole="Orders" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="OrderDetails" ToRole="Products" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="EmployeeID" Type="Int64" />
          <Property Name="OrderDate" Type="DateTime" />
          <Property Name="RequiredDate" Type="DateTime" />
          <Property Name="ShippedDate" Type="DateTime" />
          <Property Name="Freight" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="ShipName" Type="String" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ShipAddress" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="ShipCity" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipRegion" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipPostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="ShipCountry" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Customers" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Orders" ToRole="Customers" />
          <NavigationProperty Name="InternationalOrders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="Orders" ToRole="InternationalOrders" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="Orders" ToRole="OrderDetails" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="ProductName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="QuantityPerUnit" Type="String" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="UnitPrice" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="UnitsInStock" Type="Int16" />
          <Property Name="UnitsOnOrder" Type="Int16" />
          <Property Name="ReorderLevel" Type="Int16" />
          <Property Name="Discontinued" Type="Boolean" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="DateTime" />
          <NavigationProperty Name="Categories" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Products" ToRole="Categories" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="Products" ToRole="OrderDetails" />
          <NavigationProperty Name="Suppliers" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Products" ToRole="Suppliers" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="Int64" Nullable="false" />
          <Property Name="RegionDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Regions" ToRole="Territories" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="Int64" Nullable="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="HomePage" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Suppliers" ToRole="Products" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="Int64" Nullable="false" />
          <Property Name="TerritoryDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Regions" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Territories" ToRole="Regions" />
          <NavigationProperty Name="Employees" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Territories" ToRole="Employees" />
        </EntityType>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="*" />
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        <Association Name="EmployeesTerritories">
          <End Role="Employees" Type="northwindEFModel.Employees" Multiplicity="*" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        </Schema>
    </edmx:ConceptualModels>
    <!-- C-S mapping content -->
    <edmx:Mappings>
      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
        <EntityContainerMapping StorageEntityContainer="northwindEFModelStoreContainer" CdmEntityContainer="northwindEFEntities">
          <EntitySetMapping Name="Categories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Categories)">
              <MappingFragment StoreEntitySet="Categories">
                <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
                <ScalarProperty Name="CategoryName" ColumnName="CategoryName" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="Picture" ColumnName="Picture" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Customers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Customers)">
              <MappingFragment StoreEntitySet="Customers">
                <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Employees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Employees)">
              <MappingFragment StoreEntitySet="Employees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="InternationalOrders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.InternationalOrders)">
              <MappingFragment StoreEntitySet="InternationalOrders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="CustomsDescription" ColumnName="CustomsDescription" />
                <ScalarProperty Name="ExciseTax" ColumnName="ExciseTax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="OrderDetails">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.OrderDetails)">
              <MappingFragment StoreEntitySet="OrderDetails">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="Quantity" ColumnName="Quantity" />
                <ScalarProperty Name="Discount" ColumnName="Discount" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Orders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Orders)">
              <MappingFragment StoreEntitySet="Orders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="OrderDate" ColumnName="OrderDate" />
                <ScalarProperty Name="RequiredDate" ColumnName="RequiredDate" />
                <ScalarProperty Name="ShippedDate" ColumnName="ShippedDate" />
                <ScalarProperty Name="Freight" ColumnName="Freight" />
                <ScalarProperty Name="ShipName" ColumnName="ShipName" />
                <ScalarProperty Name="ShipAddress" ColumnName="ShipAddress" />
                <ScalarProperty Name="ShipCity" ColumnName="ShipCity" />
                <ScalarProperty Name="ShipRegion" ColumnName="ShipRegion" />
                <ScalarProperty Name="ShipPostalCode" ColumnName="ShipPostalCode" />
                <ScalarProperty Name="ShipCountry" ColumnName="ShipCountry" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="PreviousEmployees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.PreviousEmployees)">
              <MappingFragment StoreEntitySet="PreviousEmployees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Products">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Products)">
              <MappingFragment StoreEntitySet="Products">
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="ProductName" ColumnName="ProductName" />
                <ScalarProperty Name="QuantityPerUnit" ColumnName="QuantityPerUnit" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="UnitsInStock" ColumnName="UnitsInStock" />
                <ScalarProperty Name="UnitsOnOrder" ColumnName="UnitsOnOrder" />
                <ScalarProperty Name="ReorderLevel" ColumnName="ReorderLevel" />
                <ScalarProperty Name="Discontinued" ColumnName="Discontinued" />
                <ScalarProperty Name="DiscontinuedDate" ColumnName="DiscontinuedDate" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Regions">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Regions)">
              <MappingFragment StoreEntitySet="Regions">
                <ScalarProperty Name="RegionID" ColumnName="RegionID" />
                <ScalarProperty Name="RegionDescription" ColumnName="RegionDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Suppliers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Suppliers)">
              <MappingFragment StoreEntitySet="Suppliers">
                <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
                <ScalarProperty Name="HomePage" ColumnName="HomePage" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Territories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Territories)">
              <MappingFragment StoreEntitySet="Territories">
                <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
                <ScalarProperty Name="TerritoryDescription" ColumnName="TerritoryDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <AssociationSetMapping Name="FK_Products_CategoryID_CategoryID" TypeName="northwindEFModel.FK_Products_CategoryID_CategoryID" StoreEntitySet="Products">
            <EndProperty Name="Categories">
              <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="CategoryID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Orders_CustomerID_CustomerID" TypeName="northwindEFModel.FK_Orders_CustomerID_CustomerID" StoreEntitySet="Orders">
            <EndProperty Name="Customers">
              <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
            </EndProperty>
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <Condition ColumnName="CustomerID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_InternationalOrders_OrderID_OrderID" TypeName="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" StoreEntitySet="InternationalOrders">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="InternationalOrders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_OrderID_OrderID" TypeName="northwindEFModel.FK_OrderDetails_OrderID_OrderID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_ProductID_ProductID" TypeName="northwindEFModel.FK_OrderDetails_ProductID_ProductID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Products_SupplierID_SupplierID" TypeName="northwindEFModel.FK_Products_SupplierID_SupplierID" StoreEntitySet="Products">
            <EndProperty Name="Suppliers">
              <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="SupplierID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Territories_RegionID_RegionID" TypeName="northwindEFModel.FK_Territories_RegionID_RegionID" StoreEntitySet="Territories">
            <EndProperty Name="Regions">
              <ScalarProperty Name="RegionID" ColumnName="RegionID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="EmployeesTerritories" TypeName="northwindEFModel.EmployeesTerritories" StoreEntitySet="EmployeesTerritories">
            <EndProperty Name="Employees">
              <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          </EntityContainerMapping>
      </Mapping>
    </edmx:Mappings>
  </edmx:Runtime>
  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
  <edmx:Designer>
    <edmx:Connection>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </edmx:Connection>
    <edmx:Options>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
      </DesignerInfoPropertySet>
    </edmx:Options>
    <!-- Diagram content (shape and connector positions) -->
    <edmx:Diagrams>
      <Diagram Name="NorthwindModel" xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <EntityTypeShape EntityType="northwindEFModel.Categories" Width="1.5" PointX="0.75" PointY="1.625" Height="1.9802864583333335" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Customers" Width="1.5" PointX="0.75" PointY="9.625" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Employees" Width="1.5" PointX="2.75" PointY="14.625" Height="4.4802050781250014" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.InternationalOrders" Width="1.5" PointX="5.25" PointY="10.375" Height="1.7879850260416674" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.OrderDetails" Width="1.5" PointX="5.25" PointY="1.5" Height="2.3648893229166656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Orders" Width="1.5" PointX="3" PointY="9.25" Height="3.9033007812499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.PreviousEmployees" Width="1.5" PointX="7.75" PointY="0.75" Height="4.2879036458333317" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Products" Width="1.5" PointX="3" PointY="1" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Regions" Width="1.5" PointX="2.75" PointY="6" Height="1.5956835937499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Suppliers" Width="1.5" PointX="0.75" PointY="4.875" Height="3.5186979166666656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Territories" Width="1.5" PointX="5" PointY="5.875" Height="1.7879850260416674" IsExpanded="true" />
        <AssociationConnector Association="northwindEFModel.FK_Products_CategoryID_CategoryID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="2.6151432291666667" />
          <ConnectorPoint PointX="3" PointY="2.6151432291666667" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Orders_CustomerID_CustomerID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="11.2881982421875" />
          <ConnectorPoint PointX="3" PointY="11.2881982421875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.010416666666667" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.177083333333333" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.25" PointY="11.268992513020834" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="3.75" PointY="9.25" />
          <ConnectorPoint PointX="3.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="2.6824446614583328" />
          <ConnectorPoint PointX="5.25" PointY="2.6824446614583328" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="2.0287223307291664" />
          <ConnectorPoint PointX="5.25" PointY="2.0287223307291664" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Products_SupplierID_SupplierID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="4.326396484375" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Territories_RegionID_RegionID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="6.797841796875" />
          <ConnectorPoint PointX="4.666666666666667" PointY="6.7978417968749989" />
          <ConnectorPoint PointX="4.833333333333333" PointY="6.797841796875" />
          <ConnectorPoint PointX="5" PointY="6.797841796875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.EmployeesTerritories" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="7.6629850260416674" /></AssociationConnector>
        </Diagram></edmx:Diagrams>
  </edmx:Designer>
</edmx:Edmx>

Added testlinq/NorthwindModel.EF6.2017.Designer.cs.





































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

//------------------------------------------------------------------------------
// <auto-generated>
//    This code was generated from a template.
//
//    Manual changes to this file may cause unexpected behavior in your application.
//    Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.ComponentModel;
using System.Data.Entity.Core.EntityClient;
using System.Data.Entity.Core.Metadata.Edm;
using System.Data.Entity.Core.Objects;
using System.Data.Entity.Core.Objects.DataClasses;
using System.Runtime.Serialization;
using System.Xml.Serialization;

[assembly: EdmSchemaAttribute()]
#region EDM Relationship Metadata

[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Categories), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Customers), "Orders", RelationshipMultiplicity.Many, typeof(testlinq.Orders))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "InternationalOrders", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.InternationalOrders), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products", RelationshipMultiplicity.One, typeof(testlinq.Products), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Suppliers), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions", RelationshipMultiplicity.One, typeof(testlinq.Regions), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "EmployeesTerritories", "Employees", RelationshipMultiplicity.Many, typeof(testlinq.Employees), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]

#endregion

namespace testlinq
{
    #region Contexts

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    public partial class northwindEFEntities : ObjectContext
    {
        #region Constructors

        /// <summary>
        /// Initializes a new northwindEFEntities object using the connection string found in the 'northwindEFEntities' section of the application configuration file.
        /// </summary>
        public northwindEFEntities() : base("name=northwindEFEntities", "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(string connectionString) : base(connectionString, "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(EntityConnection connection) : base(connection, "northwindEFEntities")
        {
            OnContextCreated();
        }

        #endregion

        #region Partial Methods

        partial void OnContextCreated();

        #endregion

        #region ObjectSet Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Categories> Categories
        {
            get
            {
                if ((_Categories == null))
                {
                    _Categories = base.CreateObjectSet<Categories>("Categories");
                }
                return _Categories;
            }
        }
        private ObjectSet<Categories> _Categories;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Customers> Customers
        {
            get
            {
                if ((_Customers == null))
                {
                    _Customers = base.CreateObjectSet<Customers>("Customers");
                }
                return _Customers;
            }
        }
        private ObjectSet<Customers> _Customers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Employees> Employees
        {
            get
            {
                if ((_Employees == null))
                {
                    _Employees = base.CreateObjectSet<Employees>("Employees");
                }
                return _Employees;
            }
        }
        private ObjectSet<Employees> _Employees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<InternationalOrders> InternationalOrders
        {
            get
            {
                if ((_InternationalOrders == null))
                {
                    _InternationalOrders = base.CreateObjectSet<InternationalOrders>("InternationalOrders");
                }
                return _InternationalOrders;
            }
        }
        private ObjectSet<InternationalOrders> _InternationalOrders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<OrderDetails> OrderDetails
        {
            get
            {
                if ((_OrderDetails == null))
                {
                    _OrderDetails = base.CreateObjectSet<OrderDetails>("OrderDetails");
                }
                return _OrderDetails;
            }
        }
        private ObjectSet<OrderDetails> _OrderDetails;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Orders> Orders
        {
            get
            {
                if ((_Orders == null))
                {
                    _Orders = base.CreateObjectSet<Orders>("Orders");
                }
                return _Orders;
            }
        }
        private ObjectSet<Orders> _Orders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<PreviousEmployees> PreviousEmployees
        {
            get
            {
                if ((_PreviousEmployees == null))
                {
                    _PreviousEmployees = base.CreateObjectSet<PreviousEmployees>("PreviousEmployees");
                }
                return _PreviousEmployees;
            }
        }
        private ObjectSet<PreviousEmployees> _PreviousEmployees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Products> Products
        {
            get
            {
                if ((_Products == null))
                {
                    _Products = base.CreateObjectSet<Products>("Products");
                }
                return _Products;
            }
        }
        private ObjectSet<Products> _Products;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Regions> Regions
        {
            get
            {
                if ((_Regions == null))
                {
                    _Regions = base.CreateObjectSet<Regions>("Regions");
                }
                return _Regions;
            }
        }
        private ObjectSet<Regions> _Regions;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Suppliers> Suppliers
        {
            get
            {
                if ((_Suppliers == null))
                {
                    _Suppliers = base.CreateObjectSet<Suppliers>("Suppliers");
                }
                return _Suppliers;
            }
        }
        private ObjectSet<Suppliers> _Suppliers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Territories> Territories
        {
            get
            {
                if ((_Territories == null))
                {
                    _Territories = base.CreateObjectSet<Territories>("Territories");
                }
                return _Territories;
            }
        }
        private ObjectSet<Territories> _Territories;

        #endregion
        #region AddTo Methods

        /// <summary>
        /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCategories(Categories categories)
        {
            base.AddObject("Categories", categories);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Customers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCustomers(Customers customers)
        {
            base.AddObject("Customers", customers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Employees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToEmployees(Employees employees)
        {
            base.AddObject("Employees", employees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the InternationalOrders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToInternationalOrders(InternationalOrders internationalOrders)
        {
            base.AddObject("InternationalOrders", internationalOrders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the OrderDetails EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrderDetails(OrderDetails orderDetails)
        {
            base.AddObject("OrderDetails", orderDetails);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Orders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrders(Orders orders)
        {
            base.AddObject("Orders", orders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the PreviousEmployees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToPreviousEmployees(PreviousEmployees previousEmployees)
        {
            base.AddObject("PreviousEmployees", previousEmployees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToProducts(Products products)
        {
            base.AddObject("Products", products);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Regions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToRegions(Regions regions)
        {
            base.AddObject("Regions", regions);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Suppliers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToSuppliers(Suppliers suppliers)
        {
            base.AddObject("Suppliers", suppliers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Territories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToTerritories(Territories territories)
        {
            base.AddObject("Territories", territories);
        }

        #endregion
    }


    #endregion

    #region Entities

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Categories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Categories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Categories object.
        /// </summary>
        /// <param name="categoryID">Initial value of the CategoryID property.</param>
        /// <param name="categoryName">Initial value of the CategoryName property.</param>
        public static Categories CreateCategories(global::System.Int64 categoryID, global::System.String categoryName)
        {
            Categories categories = new Categories();
            categories.CategoryID = categoryID;
            categories.CategoryName = categoryName;
            return categories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 CategoryID
        {
            get
            {
                return _CategoryID;
            }
            set
            {
                if (_CategoryID != value)
                {
                    OnCategoryIDChanging(value);
                    ReportPropertyChanging("CategoryID");
                    _CategoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("CategoryID");
                    OnCategoryIDChanged();
                }
            }
        }
        private global::System.Int64 _CategoryID;
        partial void OnCategoryIDChanging(global::System.Int64 value);
        partial void OnCategoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CategoryName
        {
            get
            {
                return _CategoryName;
            }
            set
            {
                OnCategoryNameChanging(value);
                ReportPropertyChanging("CategoryName");
                _CategoryName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CategoryName");
                OnCategoryNameChanged();
            }
        }
        private global::System.String _CategoryName;
        partial void OnCategoryNameChanging(global::System.String value);
        partial void OnCategoryNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Description
        {
            get
            {
                return _Description;
            }
            set
            {
                OnDescriptionChanging(value);
                ReportPropertyChanging("Description");
                _Description = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Description");
                OnDescriptionChanged();
            }
        }
        private global::System.String _Description;
        partial void OnDescriptionChanging(global::System.String value);
        partial void OnDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Picture
        {
            get
            {
                return StructuralObject.GetValidValue(_Picture);
            }
            set
            {
                OnPictureChanging(value);
                ReportPropertyChanging("Picture");
                _Picture = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Picture");
                OnPictureChanged();
            }
        }
        private global::System.Byte[] _Picture;
        partial void OnPictureChanging(global::System.Byte[] value);
        partial void OnPictureChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Customers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Customers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Customers object.
        /// </summary>
        /// <param name="customerID">Initial value of the CustomerID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Customers CreateCustomers(global::System.String customerID, global::System.String companyName)
        {
            Customers customers = new Customers();
            customers.CustomerID = customerID;
            customers.CompanyName = companyName;
            return customers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomerID
        {
            get
            {
                return _CustomerID;
            }
            set
            {
                if (_CustomerID != value)
                {
                    OnCustomerIDChanging(value);
                    ReportPropertyChanging("CustomerID");
                    _CustomerID = StructuralObject.SetValidValue(value, false);
                    ReportPropertyChanged("CustomerID");
                    OnCustomerIDChanged();
                }
            }
        }
        private global::System.String _CustomerID;
        partial void OnCustomerIDChanging(global::System.String value);
        partial void OnCustomerIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Orders")]
        public EntityCollection<Orders> Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Employees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Employees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Employees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static Employees CreateEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            Employees employees = new Employees();
            employees.EmployeeID = employeeID;
            employees.LastName = lastName;
            employees.FirstName = firstName;
            return employees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="InternationalOrders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class InternationalOrders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new InternationalOrders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="customsDescription">Initial value of the CustomsDescription property.</param>
        /// <param name="exciseTax">Initial value of the ExciseTax property.</param>
        public static InternationalOrders CreateInternationalOrders(global::System.Int64 orderID, global::System.String customsDescription, global::System.Decimal exciseTax)
        {
            InternationalOrders internationalOrders = new InternationalOrders();
            internationalOrders.OrderID = orderID;
            internationalOrders.CustomsDescription = customsDescription;
            internationalOrders.ExciseTax = exciseTax;
            return internationalOrders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomsDescription
        {
            get
            {
                return _CustomsDescription;
            }
            set
            {
                OnCustomsDescriptionChanging(value);
                ReportPropertyChanging("CustomsDescription");
                _CustomsDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CustomsDescription");
                OnCustomsDescriptionChanged();
            }
        }
        private global::System.String _CustomsDescription;
        partial void OnCustomsDescriptionChanging(global::System.String value);
        partial void OnCustomsDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal ExciseTax
        {
            get
            {
                return _ExciseTax;
            }
            set
            {
                OnExciseTaxChanging(value);
                ReportPropertyChanging("ExciseTax");
                _ExciseTax = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ExciseTax");
                OnExciseTaxChanged();
            }
        }
        private global::System.Decimal _ExciseTax;
        partial void OnExciseTaxChanging(global::System.Decimal value);
        partial void OnExciseTaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="OrderDetails")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class OrderDetails : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new OrderDetails object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="unitPrice">Initial value of the UnitPrice property.</param>
        /// <param name="quantity">Initial value of the Quantity property.</param>
        /// <param name="discount">Initial value of the Discount property.</param>
        public static OrderDetails CreateOrderDetails(global::System.Int64 orderID, global::System.Int64 productID, global::System.Decimal unitPrice, global::System.Int16 quantity, global::System.Single discount)
        {
            OrderDetails orderDetails = new OrderDetails();
            orderDetails.OrderID = orderID;
            orderDetails.ProductID = productID;
            orderDetails.UnitPrice = unitPrice;
            orderDetails.Quantity = quantity;
            orderDetails.Discount = discount;
            return orderDetails;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private global::System.Decimal _UnitPrice;
        partial void OnUnitPriceChanging(global::System.Decimal value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int16 Quantity
        {
            get
            {
                return _Quantity;
            }
            set
            {
                OnQuantityChanging(value);
                ReportPropertyChanging("Quantity");
                _Quantity = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Quantity");
                OnQuantityChanged();
            }
        }
        private global::System.Int16 _Quantity;
        partial void OnQuantityChanging(global::System.Int16 value);
        partial void OnQuantityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Single Discount
        {
            get
            {
                return _Discount;
            }
            set
            {
                OnDiscountChanging(value);
                ReportPropertyChanging("Discount");
                _Discount = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discount");
                OnDiscountChanged();
            }
        }
        private global::System.Single _Discount;
        partial void OnDiscountChanging(global::System.Single value);
        partial void OnDiscountChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products")]
        public Products Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Products> ProductsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Orders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Orders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Orders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        public static Orders CreateOrders(global::System.Int64 orderID)
        {
            Orders orders = new Orders();
            orders.OrderID = orderID;
            return orders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int64> EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                OnEmployeeIDChanging(value);
                ReportPropertyChanging("EmployeeID");
                _EmployeeID = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("EmployeeID");
                OnEmployeeIDChanged();
            }
        }
        private Nullable<global::System.Int64> _EmployeeID;
        partial void OnEmployeeIDChanging(Nullable<global::System.Int64> value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> OrderDate
        {
            get
            {
                return _OrderDate;
            }
            set
            {
                OnOrderDateChanging(value);
                ReportPropertyChanging("OrderDate");
                _OrderDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("OrderDate");
                OnOrderDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _OrderDate;
        partial void OnOrderDateChanging(Nullable<global::System.DateTime> value);
        partial void OnOrderDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> RequiredDate
        {
            get
            {
                return _RequiredDate;
            }
            set
            {
                OnRequiredDateChanging(value);
                ReportPropertyChanging("RequiredDate");
                _RequiredDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("RequiredDate");
                OnRequiredDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _RequiredDate;
        partial void OnRequiredDateChanging(Nullable<global::System.DateTime> value);
        partial void OnRequiredDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> ShippedDate
        {
            get
            {
                return _ShippedDate;
            }
            set
            {
                OnShippedDateChanging(value);
                ReportPropertyChanging("ShippedDate");
                _ShippedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ShippedDate");
                OnShippedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _ShippedDate;
        partial void OnShippedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnShippedDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> Freight
        {
            get
            {
                return _Freight;
            }
            set
            {
                OnFreightChanging(value);
                ReportPropertyChanging("Freight");
                _Freight = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Freight");
                OnFreightChanged();
            }
        }
        private Nullable<global::System.Decimal> _Freight;
        partial void OnFreightChanging(Nullable<global::System.Decimal> value);
        partial void OnFreightChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipName
        {
            get
            {
                return _ShipName;
            }
            set
            {
                OnShipNameChanging(value);
                ReportPropertyChanging("ShipName");
                _ShipName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipName");
                OnShipNameChanged();
            }
        }
        private global::System.String _ShipName;
        partial void OnShipNameChanging(global::System.String value);
        partial void OnShipNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipAddress
        {
            get
            {
                return _ShipAddress;
            }
            set
            {
                OnShipAddressChanging(value);
                ReportPropertyChanging("ShipAddress");
                _ShipAddress = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipAddress");
                OnShipAddressChanged();
            }
        }
        private global::System.String _ShipAddress;
        partial void OnShipAddressChanging(global::System.String value);
        partial void OnShipAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCity
        {
            get
            {
                return _ShipCity;
            }
            set
            {
                OnShipCityChanging(value);
                ReportPropertyChanging("ShipCity");
                _ShipCity = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCity");
                OnShipCityChanged();
            }
        }
        private global::System.String _ShipCity;
        partial void OnShipCityChanging(global::System.String value);
        partial void OnShipCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipRegion
        {
            get
            {
                return _ShipRegion;
            }
            set
            {
                OnShipRegionChanging(value);
                ReportPropertyChanging("ShipRegion");
                _ShipRegion = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipRegion");
                OnShipRegionChanged();
            }
        }
        private global::System.String _ShipRegion;
        partial void OnShipRegionChanging(global::System.String value);
        partial void OnShipRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipPostalCode
        {
            get
            {
                return _ShipPostalCode;
            }
            set
            {
                OnShipPostalCodeChanging(value);
                ReportPropertyChanging("ShipPostalCode");
                _ShipPostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipPostalCode");
                OnShipPostalCodeChanged();
            }
        }
        private global::System.String _ShipPostalCode;
        partial void OnShipPostalCodeChanging(global::System.String value);
        partial void OnShipPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCountry
        {
            get
            {
                return _ShipCountry;
            }
            set
            {
                OnShipCountryChanging(value);
                ReportPropertyChanging("ShipCountry");
                _ShipCountry = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCountry");
                OnShipCountryChanged();
            }
        }
        private global::System.String _ShipCountry;
        partial void OnShipCountryChanging(global::System.String value);
        partial void OnShipCountryChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers")]
        public Customers Customers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Customers> CustomersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "InternationalOrders")]
        public InternationalOrders InternationalOrders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<InternationalOrders> InternationalOrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="PreviousEmployees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class PreviousEmployees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new PreviousEmployees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static PreviousEmployees CreatePreviousEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            PreviousEmployees previousEmployees = new PreviousEmployees();
            previousEmployees.EmployeeID = employeeID;
            previousEmployees.LastName = lastName;
            previousEmployees.FirstName = firstName;
            return previousEmployees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Products")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Products : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Products object.
        /// </summary>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="productName">Initial value of the ProductName property.</param>
        /// <param name="discontinued">Initial value of the Discontinued property.</param>
        public static Products CreateProducts(global::System.Int64 productID, global::System.String productName, global::System.Boolean discontinued)
        {
            Products products = new Products();
            products.ProductID = productID;
            products.ProductName = productName;
            products.Discontinued = discontinued;
            return products;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String ProductName
        {
            get
            {
                return _ProductName;
            }
            set
            {
                OnProductNameChanging(value);
                ReportPropertyChanging("ProductName");
                _ProductName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("ProductName");
                OnProductNameChanged();
            }
        }
        private global::System.String _ProductName;
        partial void OnProductNameChanging(global::System.String value);
        partial void OnProductNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String QuantityPerUnit
        {
            get
            {
                return _QuantityPerUnit;
            }
            set
            {
                OnQuantityPerUnitChanging(value);
                ReportPropertyChanging("QuantityPerUnit");
                _QuantityPerUnit = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("QuantityPerUnit");
                OnQuantityPerUnitChanged();
            }
        }
        private global::System.String _QuantityPerUnit;
        partial void OnQuantityPerUnitChanging(global::System.String value);
        partial void OnQuantityPerUnitChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private Nullable<global::System.Decimal> _UnitPrice;
        partial void OnUnitPriceChanging(Nullable<global::System.Decimal> value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsInStock
        {
            get
            {
                return _UnitsInStock;
            }
            set
            {
                OnUnitsInStockChanging(value);
                ReportPropertyChanging("UnitsInStock");
                _UnitsInStock = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsInStock");
                OnUnitsInStockChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsInStock;
        partial void OnUnitsInStockChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsInStockChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsOnOrder
        {
            get
            {
                return _UnitsOnOrder;
            }
            set
            {
                OnUnitsOnOrderChanging(value);
                ReportPropertyChanging("UnitsOnOrder");
                _UnitsOnOrder = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsOnOrder");
                OnUnitsOnOrderChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsOnOrder;
        partial void OnUnitsOnOrderChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsOnOrderChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> ReorderLevel
        {
            get
            {
                return _ReorderLevel;
            }
            set
            {
                OnReorderLevelChanging(value);
                ReportPropertyChanging("ReorderLevel");
                _ReorderLevel = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ReorderLevel");
                OnReorderLevelChanged();
            }
        }
        private Nullable<global::System.Int16> _ReorderLevel;
        partial void OnReorderLevelChanging(Nullable<global::System.Int16> value);
        partial void OnReorderLevelChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Boolean Discontinued
        {
            get
            {
                return _Discontinued;
            }
            set
            {
                OnDiscontinuedChanging(value);
                ReportPropertyChanging("Discontinued");
                _Discontinued = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discontinued");
                OnDiscontinuedChanged();
            }
        }
        private global::System.Boolean _Discontinued;
        partial void OnDiscontinuedChanging(global::System.Boolean value);
        partial void OnDiscontinuedChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> DiscontinuedDate
        {
            get
            {
                return _DiscontinuedDate;
            }
            set
            {
                OnDiscontinuedDateChanging(value);
                ReportPropertyChanging("DiscontinuedDate");
                _DiscontinuedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DiscontinuedDate");
                OnDiscontinuedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _DiscontinuedDate;
        partial void OnDiscontinuedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnDiscontinuedDateChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories")]
        public Categories Categories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Categories> CategoriesReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers")]
        public Suppliers Suppliers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Suppliers> SuppliersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Regions")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Regions : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Regions object.
        /// </summary>
        /// <param name="regionID">Initial value of the RegionID property.</param>
        /// <param name="regionDescription">Initial value of the RegionDescription property.</param>
        public static Regions CreateRegions(global::System.Int64 regionID, global::System.String regionDescription)
        {
            Regions regions = new Regions();
            regions.RegionID = regionID;
            regions.RegionDescription = regionDescription;
            return regions;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 RegionID
        {
            get
            {
                return _RegionID;
            }
            set
            {
                if (_RegionID != value)
                {
                    OnRegionIDChanging(value);
                    ReportPropertyChanging("RegionID");
                    _RegionID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("RegionID");
                    OnRegionIDChanged();
                }
            }
        }
        private global::System.Int64 _RegionID;
        partial void OnRegionIDChanging(global::System.Int64 value);
        partial void OnRegionIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String RegionDescription
        {
            get
            {
                return _RegionDescription;
            }
            set
            {
                OnRegionDescriptionChanging(value);
                ReportPropertyChanging("RegionDescription");
                _RegionDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("RegionDescription");
                OnRegionDescriptionChanged();
            }
        }
        private global::System.String _RegionDescription;
        partial void OnRegionDescriptionChanging(global::System.String value);
        partial void OnRegionDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Suppliers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Suppliers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Suppliers object.
        /// </summary>
        /// <param name="supplierID">Initial value of the SupplierID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Suppliers CreateSuppliers(global::System.Int64 supplierID, global::System.String companyName)
        {
            Suppliers suppliers = new Suppliers();
            suppliers.SupplierID = supplierID;
            suppliers.CompanyName = companyName;
            return suppliers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 SupplierID
        {
            get
            {
                return _SupplierID;
            }
            set
            {
                if (_SupplierID != value)
                {
                    OnSupplierIDChanging(value);
                    ReportPropertyChanging("SupplierID");
                    _SupplierID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("SupplierID");
                    OnSupplierIDChanged();
                }
            }
        }
        private global::System.Int64 _SupplierID;
        partial void OnSupplierIDChanging(global::System.Int64 value);
        partial void OnSupplierIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePage
        {
            get
            {
                return _HomePage;
            }
            set
            {
                OnHomePageChanging(value);
                ReportPropertyChanging("HomePage");
                _HomePage = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePage");
                OnHomePageChanged();
            }
        }
        private global::System.String _HomePage;
        partial void OnHomePageChanging(global::System.String value);
        partial void OnHomePageChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Territories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Territories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Territories object.
        /// </summary>
        /// <param name="territoryID">Initial value of the TerritoryID property.</param>
        /// <param name="territoryDescription">Initial value of the TerritoryDescription property.</param>
        public static Territories CreateTerritories(global::System.Int64 territoryID, global::System.String territoryDescription)
        {
            Territories territories = new Territories();
            territories.TerritoryID = territoryID;
            territories.TerritoryDescription = territoryDescription;
            return territories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 TerritoryID
        {
            get
            {
                return _TerritoryID;
            }
            set
            {
                if (_TerritoryID != value)
                {
                    OnTerritoryIDChanging(value);
                    ReportPropertyChanging("TerritoryID");
                    _TerritoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("TerritoryID");
                    OnTerritoryIDChanged();
                }
            }
        }
        private global::System.Int64 _TerritoryID;
        partial void OnTerritoryIDChanging(global::System.Int64 value);
        partial void OnTerritoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String TerritoryDescription
        {
            get
            {
                return _TerritoryDescription;
            }
            set
            {
                OnTerritoryDescriptionChanging(value);
                ReportPropertyChanging("TerritoryDescription");
                _TerritoryDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("TerritoryDescription");
                OnTerritoryDescriptionChanged();
            }
        }
        private global::System.String _TerritoryDescription;
        partial void OnTerritoryDescriptionChanging(global::System.String value);
        partial void OnTerritoryDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions")]
        public Regions Regions
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Regions> RegionsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Employees")]
        public EntityCollection<Employees> Employees
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees", value);
                }
            }
        }

        #endregion
    }

    #endregion

}

Added testlinq/NorthwindModel.EF6.2017.edmx.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
    <Schema Namespace="northwindEFModel.Store" Alias="Self" Provider="System.Data.SQLite.EF6" ProviderManifestToken="ISO8601" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
        <EntityContainer Name="northwindEFModelStoreContainer">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Store.Categories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Store.Customers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Store.Employees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="EmployeesTerritories" EntityType="northwindEFModel.Store.EmployeesTerritories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.Store.InternationalOrders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.Store.OrderDetails" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Store.Orders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.Store.PreviousEmployees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Store.Products" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Store.Regions" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Store.Suppliers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Store.Territories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <AssociationSet Name="FK_EmployeesTerritories_EmployeeID_EmployeeID" Association="northwindEFModel.Store.FK_EmployeesTerritories_EmployeeID_EmployeeID">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_EmployeesTerritories_TerritoryID_TerritoryID" Association="northwindEFModel.Store.FK_EmployeesTerritories_TerritoryID_TerritoryID">
            <End Role="Territories" EntitySet="Territories" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.Store.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.Store.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.Store.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.Store.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.Store.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.Store.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.Store.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
        </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CategoryName" Type="nvarchar" Nullable="false" MaxLength="15" />
          <Property Name="Description" Type="nvarchar" />
          <Property Name="Picture" Type="blob" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="nvarchar" Nullable="false" MaxLength="5" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="EmployeesTerritories">
          <Key>
            <PropertyRef Name="EmployeeID" />
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="CustomsDescription" Type="nvarchar" Nullable="false" MaxLength="100" />
          <Property Name="ExciseTax" Type="decimal" Nullable="false" Precision="53" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="ProductID" Type="integer" Nullable="false" />
          <Property Name="UnitPrice" Type="decimal" Nullable="false" Precision="53" />
          <Property Name="Quantity" Type="smallint" Nullable="false" />
          <!--
              NOTE: The "Discount" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbInsertCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Discount" Type="real" Nullable="false" StoreGeneratedPattern="Computed" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CustomerID" Type="nvarchar" MaxLength="5" />
          <Property Name="EmployeeID" Type="integer" />
          <Property Name="OrderDate" Type="datetime" />
          <Property Name="RequiredDate" Type="datetime" />
          <Property Name="ShippedDate" Type="datetime" />
          <!--
              NOTE: The "Freight" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbUpdateCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Freight" Type="decimal" Precision="53" StoreGeneratedPattern="Computed" />
          <Property Name="ShipName" Type="nvarchar" MaxLength="40" />
          <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" />
          <Property Name="ShipCity" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="ProductName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="SupplierID" Type="integer" />
          <Property Name="CategoryID" Type="integer" />
          <Property Name="QuantityPerUnit" Type="nvarchar" MaxLength="20" />
          <Property Name="UnitPrice" Type="decimal" Precision="53" />
          <Property Name="UnitsInStock" Type="smallint" />
          <Property Name="UnitsOnOrder" Type="smallint" />
          <Property Name="ReorderLevel" Type="smallint" />
          <Property Name="Discontinued" Type="bit" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="datetime" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="integer" Nullable="false" />
          <Property Name="RegionDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
          <Property Name="HomePage" Type="nvarchar" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
          <Property Name="TerritoryDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
          <Property Name="RegionID" Type="integer" Nullable="false" />
        </EntityType>
        <Association Name="FK_EmployeesTerritories_EmployeeID_EmployeeID">
          <End Role="Employees" Type="northwindEFModel.Store.Employees" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Employees">
              <PropertyRef Name="EmployeeID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="EmployeeID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_EmployeesTerritories_TerritoryID_TerritoryID">
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Territories">
              <PropertyRef Name="TerritoryID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="TerritoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.Store.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Store.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Customers">
              <PropertyRef Name="CustomerID" />
            </Principal>
            <Dependent Role="Orders">
              <PropertyRef Name="CustomerID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Store.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Categories">
              <PropertyRef Name="CategoryID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="CategoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Store.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Suppliers">
              <PropertyRef Name="SupplierID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="SupplierID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Store.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Regions">
              <PropertyRef Name="RegionID" />
            </Principal>
            <Dependent Role="Territories">
              <PropertyRef Name="RegionID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
      </Schema></edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="northwindEFModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
        <EntityContainer Name="northwindEFEntities">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Categories" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Customers" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Employees" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.InternationalOrders" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.OrderDetails" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Orders" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.PreviousEmployees" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Products" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Regions" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Suppliers" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Territories" />
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          <AssociationSet Name="EmployeesTerritories" Association="northwindEFModel.EmployeesTerritories">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="Int64" Nullable="false" />
          <Property Name="CategoryName" Type="String" Nullable="false" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Description" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="Picture" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Categories" ToRole="Products" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="String" Nullable="false" MaxLength="5" Unicode="true" FixedLength="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Customers" ToRole="Orders" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Employees" ToRole="Territories" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="CustomsDescription" Type="String" Nullable="false" MaxLength="100" Unicode="true" FixedLength="false" />
          <Property Name="ExciseTax" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="InternationalOrders" ToRole="Orders" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="UnitPrice" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <Property Name="Quantity" Type="Int16" Nullable="false" />
          <Property Name="Discount" Type="Single" Nullable="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="OrderDetails" ToRole="Orders" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="OrderDetails" ToRole="Products" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="EmployeeID" Type="Int64" />
          <Property Name="OrderDate" Type="DateTime" />
          <Property Name="RequiredDate" Type="DateTime" />
          <Property Name="ShippedDate" Type="DateTime" />
          <Property Name="Freight" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="ShipName" Type="String" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ShipAddress" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="ShipCity" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipRegion" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipPostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="ShipCountry" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Customers" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Orders" ToRole="Customers" />
          <NavigationProperty Name="InternationalOrders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="Orders" ToRole="InternationalOrders" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="Orders" ToRole="OrderDetails" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="ProductName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="QuantityPerUnit" Type="String" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="UnitPrice" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="UnitsInStock" Type="Int16" />
          <Property Name="UnitsOnOrder" Type="Int16" />
          <Property Name="ReorderLevel" Type="Int16" />
          <Property Name="Discontinued" Type="Boolean" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="DateTime" />
          <NavigationProperty Name="Categories" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Products" ToRole="Categories" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="Products" ToRole="OrderDetails" />
          <NavigationProperty Name="Suppliers" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Products" ToRole="Suppliers" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="Int64" Nullable="false" />
          <Property Name="RegionDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Regions" ToRole="Territories" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="Int64" Nullable="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="HomePage" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Suppliers" ToRole="Products" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="Int64" Nullable="false" />
          <Property Name="TerritoryDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Regions" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Territories" ToRole="Regions" />
          <NavigationProperty Name="Employees" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Territories" ToRole="Employees" />
        </EntityType>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="*" />
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        <Association Name="EmployeesTerritories">
          <End Role="Employees" Type="northwindEFModel.Employees" Multiplicity="*" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        </Schema>
    </edmx:ConceptualModels>
    <!-- C-S mapping content -->
    <edmx:Mappings>
      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
        <EntityContainerMapping StorageEntityContainer="northwindEFModelStoreContainer" CdmEntityContainer="northwindEFEntities">
          <EntitySetMapping Name="Categories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Categories)">
              <MappingFragment StoreEntitySet="Categories">
                <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
                <ScalarProperty Name="CategoryName" ColumnName="CategoryName" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="Picture" ColumnName="Picture" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Customers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Customers)">
              <MappingFragment StoreEntitySet="Customers">
                <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Employees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Employees)">
              <MappingFragment StoreEntitySet="Employees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="InternationalOrders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.InternationalOrders)">
              <MappingFragment StoreEntitySet="InternationalOrders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="CustomsDescription" ColumnName="CustomsDescription" />
                <ScalarProperty Name="ExciseTax" ColumnName="ExciseTax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="OrderDetails">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.OrderDetails)">
              <MappingFragment StoreEntitySet="OrderDetails">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="Quantity" ColumnName="Quantity" />
                <ScalarProperty Name="Discount" ColumnName="Discount" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Orders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Orders)">
              <MappingFragment StoreEntitySet="Orders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="OrderDate" ColumnName="OrderDate" />
                <ScalarProperty Name="RequiredDate" ColumnName="RequiredDate" />
                <ScalarProperty Name="ShippedDate" ColumnName="ShippedDate" />
                <ScalarProperty Name="Freight" ColumnName="Freight" />
                <ScalarProperty Name="ShipName" ColumnName="ShipName" />
                <ScalarProperty Name="ShipAddress" ColumnName="ShipAddress" />
                <ScalarProperty Name="ShipCity" ColumnName="ShipCity" />
                <ScalarProperty Name="ShipRegion" ColumnName="ShipRegion" />
                <ScalarProperty Name="ShipPostalCode" ColumnName="ShipPostalCode" />
                <ScalarProperty Name="ShipCountry" ColumnName="ShipCountry" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="PreviousEmployees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.PreviousEmployees)">
              <MappingFragment StoreEntitySet="PreviousEmployees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Products">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Products)">
              <MappingFragment StoreEntitySet="Products">
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="ProductName" ColumnName="ProductName" />
                <ScalarProperty Name="QuantityPerUnit" ColumnName="QuantityPerUnit" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="UnitsInStock" ColumnName="UnitsInStock" />
                <ScalarProperty Name="UnitsOnOrder" ColumnName="UnitsOnOrder" />
                <ScalarProperty Name="ReorderLevel" ColumnName="ReorderLevel" />
                <ScalarProperty Name="Discontinued" ColumnName="Discontinued" />
                <ScalarProperty Name="DiscontinuedDate" ColumnName="DiscontinuedDate" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Regions">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Regions)">
              <MappingFragment StoreEntitySet="Regions">
                <ScalarProperty Name="RegionID" ColumnName="RegionID" />
                <ScalarProperty Name="RegionDescription" ColumnName="RegionDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Suppliers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Suppliers)">
              <MappingFragment StoreEntitySet="Suppliers">
                <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
                <ScalarProperty Name="HomePage" ColumnName="HomePage" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Territories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Territories)">
              <MappingFragment StoreEntitySet="Territories">
                <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
                <ScalarProperty Name="TerritoryDescription" ColumnName="TerritoryDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <AssociationSetMapping Name="FK_Products_CategoryID_CategoryID" TypeName="northwindEFModel.FK_Products_CategoryID_CategoryID" StoreEntitySet="Products">
            <EndProperty Name="Categories">
              <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="CategoryID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Orders_CustomerID_CustomerID" TypeName="northwindEFModel.FK_Orders_CustomerID_CustomerID" StoreEntitySet="Orders">
            <EndProperty Name="Customers">
              <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
            </EndProperty>
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <Condition ColumnName="CustomerID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_InternationalOrders_OrderID_OrderID" TypeName="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" StoreEntitySet="InternationalOrders">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="InternationalOrders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_OrderID_OrderID" TypeName="northwindEFModel.FK_OrderDetails_OrderID_OrderID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_ProductID_ProductID" TypeName="northwindEFModel.FK_OrderDetails_ProductID_ProductID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Products_SupplierID_SupplierID" TypeName="northwindEFModel.FK_Products_SupplierID_SupplierID" StoreEntitySet="Products">
            <EndProperty Name="Suppliers">
              <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="SupplierID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Territories_RegionID_RegionID" TypeName="northwindEFModel.FK_Territories_RegionID_RegionID" StoreEntitySet="Territories">
            <EndProperty Name="Regions">
              <ScalarProperty Name="RegionID" ColumnName="RegionID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="EmployeesTerritories" TypeName="northwindEFModel.EmployeesTerritories" StoreEntitySet="EmployeesTerritories">
            <EndProperty Name="Employees">
              <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          </EntityContainerMapping>
      </Mapping>
    </edmx:Mappings>
  </edmx:Runtime>
  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
  <edmx:Designer>
    <edmx:Connection>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </edmx:Connection>
    <edmx:Options>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
      </DesignerInfoPropertySet>
    </edmx:Options>
    <!-- Diagram content (shape and connector positions) -->
    <edmx:Diagrams>
      <Diagram Name="NorthwindModel" xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <EntityTypeShape EntityType="northwindEFModel.Categories" Width="1.5" PointX="0.75" PointY="1.625" Height="1.9802864583333335" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Customers" Width="1.5" PointX="0.75" PointY="9.625" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Employees" Width="1.5" PointX="2.75" PointY="14.625" Height="4.4802050781250014" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.InternationalOrders" Width="1.5" PointX="5.25" PointY="10.375" Height="1.7879850260416674" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.OrderDetails" Width="1.5" PointX="5.25" PointY="1.5" Height="2.3648893229166656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Orders" Width="1.5" PointX="3" PointY="9.25" Height="3.9033007812499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.PreviousEmployees" Width="1.5" PointX="7.75" PointY="0.75" Height="4.2879036458333317" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Products" Width="1.5" PointX="3" PointY="1" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Regions" Width="1.5" PointX="2.75" PointY="6" Height="1.5956835937499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Suppliers" Width="1.5" PointX="0.75" PointY="4.875" Height="3.5186979166666656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Territories" Width="1.5" PointX="5" PointY="5.875" Height="1.7879850260416674" IsExpanded="true" />
        <AssociationConnector Association="northwindEFModel.FK_Products_CategoryID_CategoryID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="2.6151432291666667" />
          <ConnectorPoint PointX="3" PointY="2.6151432291666667" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Orders_CustomerID_CustomerID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="11.2881982421875" />
          <ConnectorPoint PointX="3" PointY="11.2881982421875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.010416666666667" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.177083333333333" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.25" PointY="11.268992513020834" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="3.75" PointY="9.25" />
          <ConnectorPoint PointX="3.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="2.6824446614583328" />
          <ConnectorPoint PointX="5.25" PointY="2.6824446614583328" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="2.0287223307291664" />
          <ConnectorPoint PointX="5.25" PointY="2.0287223307291664" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Products_SupplierID_SupplierID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="4.326396484375" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Territories_RegionID_RegionID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="6.797841796875" />
          <ConnectorPoint PointX="4.666666666666667" PointY="6.7978417968749989" />
          <ConnectorPoint PointX="4.833333333333333" PointY="6.797841796875" />
          <ConnectorPoint PointX="5" PointY="6.797841796875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.EmployeesTerritories" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="7.6629850260416674" /></AssociationConnector>
        </Diagram></edmx:Diagrams>
  </edmx:Designer>
</edmx:Edmx>

Added testlinq/NorthwindModel.EF6.NetStandard21.Designer.cs.





































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

//------------------------------------------------------------------------------
// <auto-generated>
//    This code was generated from a template.
//
//    Manual changes to this file may cause unexpected behavior in your application.
//    Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.ComponentModel;
using System.Data.Entity.Core.EntityClient;
using System.Data.Entity.Core.Metadata.Edm;
using System.Data.Entity.Core.Objects;
using System.Data.Entity.Core.Objects.DataClasses;
using System.Runtime.Serialization;
using System.Xml.Serialization;

[assembly: EdmSchemaAttribute()]
#region EDM Relationship Metadata

[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Categories), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Customers), "Orders", RelationshipMultiplicity.Many, typeof(testlinq.Orders))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "InternationalOrders", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.InternationalOrders), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products", RelationshipMultiplicity.One, typeof(testlinq.Products), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Suppliers), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions", RelationshipMultiplicity.One, typeof(testlinq.Regions), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "EmployeesTerritories", "Employees", RelationshipMultiplicity.Many, typeof(testlinq.Employees), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]

#endregion

namespace testlinq
{
    #region Contexts

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    public partial class northwindEFEntities : ObjectContext
    {
        #region Constructors

        /// <summary>
        /// Initializes a new northwindEFEntities object using the connection string found in the 'northwindEFEntities' section of the application configuration file.
        /// </summary>
        public northwindEFEntities() : base("name=northwindEFEntities", "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(string connectionString) : base(connectionString, "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(EntityConnection connection) : base(connection, "northwindEFEntities")
        {
            OnContextCreated();
        }

        #endregion

        #region Partial Methods

        partial void OnContextCreated();

        #endregion

        #region ObjectSet Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Categories> Categories
        {
            get
            {
                if ((_Categories == null))
                {
                    _Categories = base.CreateObjectSet<Categories>("Categories");
                }
                return _Categories;
            }
        }
        private ObjectSet<Categories> _Categories;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Customers> Customers
        {
            get
            {
                if ((_Customers == null))
                {
                    _Customers = base.CreateObjectSet<Customers>("Customers");
                }
                return _Customers;
            }
        }
        private ObjectSet<Customers> _Customers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Employees> Employees
        {
            get
            {
                if ((_Employees == null))
                {
                    _Employees = base.CreateObjectSet<Employees>("Employees");
                }
                return _Employees;
            }
        }
        private ObjectSet<Employees> _Employees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<InternationalOrders> InternationalOrders
        {
            get
            {
                if ((_InternationalOrders == null))
                {
                    _InternationalOrders = base.CreateObjectSet<InternationalOrders>("InternationalOrders");
                }
                return _InternationalOrders;
            }
        }
        private ObjectSet<InternationalOrders> _InternationalOrders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<OrderDetails> OrderDetails
        {
            get
            {
                if ((_OrderDetails == null))
                {
                    _OrderDetails = base.CreateObjectSet<OrderDetails>("OrderDetails");
                }
                return _OrderDetails;
            }
        }
        private ObjectSet<OrderDetails> _OrderDetails;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Orders> Orders
        {
            get
            {
                if ((_Orders == null))
                {
                    _Orders = base.CreateObjectSet<Orders>("Orders");
                }
                return _Orders;
            }
        }
        private ObjectSet<Orders> _Orders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<PreviousEmployees> PreviousEmployees
        {
            get
            {
                if ((_PreviousEmployees == null))
                {
                    _PreviousEmployees = base.CreateObjectSet<PreviousEmployees>("PreviousEmployees");
                }
                return _PreviousEmployees;
            }
        }
        private ObjectSet<PreviousEmployees> _PreviousEmployees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Products> Products
        {
            get
            {
                if ((_Products == null))
                {
                    _Products = base.CreateObjectSet<Products>("Products");
                }
                return _Products;
            }
        }
        private ObjectSet<Products> _Products;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Regions> Regions
        {
            get
            {
                if ((_Regions == null))
                {
                    _Regions = base.CreateObjectSet<Regions>("Regions");
                }
                return _Regions;
            }
        }
        private ObjectSet<Regions> _Regions;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Suppliers> Suppliers
        {
            get
            {
                if ((_Suppliers == null))
                {
                    _Suppliers = base.CreateObjectSet<Suppliers>("Suppliers");
                }
                return _Suppliers;
            }
        }
        private ObjectSet<Suppliers> _Suppliers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Territories> Territories
        {
            get
            {
                if ((_Territories == null))
                {
                    _Territories = base.CreateObjectSet<Territories>("Territories");
                }
                return _Territories;
            }
        }
        private ObjectSet<Territories> _Territories;

        #endregion
        #region AddTo Methods

        /// <summary>
        /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCategories(Categories categories)
        {
            base.AddObject("Categories", categories);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Customers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCustomers(Customers customers)
        {
            base.AddObject("Customers", customers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Employees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToEmployees(Employees employees)
        {
            base.AddObject("Employees", employees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the InternationalOrders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToInternationalOrders(InternationalOrders internationalOrders)
        {
            base.AddObject("InternationalOrders", internationalOrders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the OrderDetails EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrderDetails(OrderDetails orderDetails)
        {
            base.AddObject("OrderDetails", orderDetails);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Orders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrders(Orders orders)
        {
            base.AddObject("Orders", orders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the PreviousEmployees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToPreviousEmployees(PreviousEmployees previousEmployees)
        {
            base.AddObject("PreviousEmployees", previousEmployees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToProducts(Products products)
        {
            base.AddObject("Products", products);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Regions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToRegions(Regions regions)
        {
            base.AddObject("Regions", regions);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Suppliers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToSuppliers(Suppliers suppliers)
        {
            base.AddObject("Suppliers", suppliers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Territories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToTerritories(Territories territories)
        {
            base.AddObject("Territories", territories);
        }

        #endregion
    }


    #endregion

    #region Entities

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Categories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Categories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Categories object.
        /// </summary>
        /// <param name="categoryID">Initial value of the CategoryID property.</param>
        /// <param name="categoryName">Initial value of the CategoryName property.</param>
        public static Categories CreateCategories(global::System.Int64 categoryID, global::System.String categoryName)
        {
            Categories categories = new Categories();
            categories.CategoryID = categoryID;
            categories.CategoryName = categoryName;
            return categories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 CategoryID
        {
            get
            {
                return _CategoryID;
            }
            set
            {
                if (_CategoryID != value)
                {
                    OnCategoryIDChanging(value);
                    ReportPropertyChanging("CategoryID");
                    _CategoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("CategoryID");
                    OnCategoryIDChanged();
                }
            }
        }
        private global::System.Int64 _CategoryID;
        partial void OnCategoryIDChanging(global::System.Int64 value);
        partial void OnCategoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CategoryName
        {
            get
            {
                return _CategoryName;
            }
            set
            {
                OnCategoryNameChanging(value);
                ReportPropertyChanging("CategoryName");
                _CategoryName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CategoryName");
                OnCategoryNameChanged();
            }
        }
        private global::System.String _CategoryName;
        partial void OnCategoryNameChanging(global::System.String value);
        partial void OnCategoryNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Description
        {
            get
            {
                return _Description;
            }
            set
            {
                OnDescriptionChanging(value);
                ReportPropertyChanging("Description");
                _Description = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Description");
                OnDescriptionChanged();
            }
        }
        private global::System.String _Description;
        partial void OnDescriptionChanging(global::System.String value);
        partial void OnDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Picture
        {
            get
            {
                return StructuralObject.GetValidValue(_Picture);
            }
            set
            {
                OnPictureChanging(value);
                ReportPropertyChanging("Picture");
                _Picture = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Picture");
                OnPictureChanged();
            }
        }
        private global::System.Byte[] _Picture;
        partial void OnPictureChanging(global::System.Byte[] value);
        partial void OnPictureChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Customers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Customers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Customers object.
        /// </summary>
        /// <param name="customerID">Initial value of the CustomerID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Customers CreateCustomers(global::System.String customerID, global::System.String companyName)
        {
            Customers customers = new Customers();
            customers.CustomerID = customerID;
            customers.CompanyName = companyName;
            return customers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomerID
        {
            get
            {
                return _CustomerID;
            }
            set
            {
                if (_CustomerID != value)
                {
                    OnCustomerIDChanging(value);
                    ReportPropertyChanging("CustomerID");
                    _CustomerID = StructuralObject.SetValidValue(value, false);
                    ReportPropertyChanged("CustomerID");
                    OnCustomerIDChanged();
                }
            }
        }
        private global::System.String _CustomerID;
        partial void OnCustomerIDChanging(global::System.String value);
        partial void OnCustomerIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Orders")]
        public EntityCollection<Orders> Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Employees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Employees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Employees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static Employees CreateEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            Employees employees = new Employees();
            employees.EmployeeID = employeeID;
            employees.LastName = lastName;
            employees.FirstName = firstName;
            return employees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="InternationalOrders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class InternationalOrders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new InternationalOrders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="customsDescription">Initial value of the CustomsDescription property.</param>
        /// <param name="exciseTax">Initial value of the ExciseTax property.</param>
        public static InternationalOrders CreateInternationalOrders(global::System.Int64 orderID, global::System.String customsDescription, global::System.Decimal exciseTax)
        {
            InternationalOrders internationalOrders = new InternationalOrders();
            internationalOrders.OrderID = orderID;
            internationalOrders.CustomsDescription = customsDescription;
            internationalOrders.ExciseTax = exciseTax;
            return internationalOrders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomsDescription
        {
            get
            {
                return _CustomsDescription;
            }
            set
            {
                OnCustomsDescriptionChanging(value);
                ReportPropertyChanging("CustomsDescription");
                _CustomsDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CustomsDescription");
                OnCustomsDescriptionChanged();
            }
        }
        private global::System.String _CustomsDescription;
        partial void OnCustomsDescriptionChanging(global::System.String value);
        partial void OnCustomsDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal ExciseTax
        {
            get
            {
                return _ExciseTax;
            }
            set
            {
                OnExciseTaxChanging(value);
                ReportPropertyChanging("ExciseTax");
                _ExciseTax = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ExciseTax");
                OnExciseTaxChanged();
            }
        }
        private global::System.Decimal _ExciseTax;
        partial void OnExciseTaxChanging(global::System.Decimal value);
        partial void OnExciseTaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="OrderDetails")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class OrderDetails : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new OrderDetails object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="unitPrice">Initial value of the UnitPrice property.</param>
        /// <param name="quantity">Initial value of the Quantity property.</param>
        /// <param name="discount">Initial value of the Discount property.</param>
        public static OrderDetails CreateOrderDetails(global::System.Int64 orderID, global::System.Int64 productID, global::System.Decimal unitPrice, global::System.Int16 quantity, global::System.Single discount)
        {
            OrderDetails orderDetails = new OrderDetails();
            orderDetails.OrderID = orderID;
            orderDetails.ProductID = productID;
            orderDetails.UnitPrice = unitPrice;
            orderDetails.Quantity = quantity;
            orderDetails.Discount = discount;
            return orderDetails;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private global::System.Decimal _UnitPrice;
        partial void OnUnitPriceChanging(global::System.Decimal value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int16 Quantity
        {
            get
            {
                return _Quantity;
            }
            set
            {
                OnQuantityChanging(value);
                ReportPropertyChanging("Quantity");
                _Quantity = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Quantity");
                OnQuantityChanged();
            }
        }
        private global::System.Int16 _Quantity;
        partial void OnQuantityChanging(global::System.Int16 value);
        partial void OnQuantityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Single Discount
        {
            get
            {
                return _Discount;
            }
            set
            {
                OnDiscountChanging(value);
                ReportPropertyChanging("Discount");
                _Discount = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discount");
                OnDiscountChanged();
            }
        }
        private global::System.Single _Discount;
        partial void OnDiscountChanging(global::System.Single value);
        partial void OnDiscountChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products")]
        public Products Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Products> ProductsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Orders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Orders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Orders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        public static Orders CreateOrders(global::System.Int64 orderID)
        {
            Orders orders = new Orders();
            orders.OrderID = orderID;
            return orders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int64> EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                OnEmployeeIDChanging(value);
                ReportPropertyChanging("EmployeeID");
                _EmployeeID = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("EmployeeID");
                OnEmployeeIDChanged();
            }
        }
        private Nullable<global::System.Int64> _EmployeeID;
        partial void OnEmployeeIDChanging(Nullable<global::System.Int64> value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> OrderDate
        {
            get
            {
                return _OrderDate;
            }
            set
            {
                OnOrderDateChanging(value);
                ReportPropertyChanging("OrderDate");
                _OrderDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("OrderDate");
                OnOrderDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _OrderDate;
        partial void OnOrderDateChanging(Nullable<global::System.DateTime> value);
        partial void OnOrderDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> RequiredDate
        {
            get
            {
                return _RequiredDate;
            }
            set
            {
                OnRequiredDateChanging(value);
                ReportPropertyChanging("RequiredDate");
                _RequiredDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("RequiredDate");
                OnRequiredDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _RequiredDate;
        partial void OnRequiredDateChanging(Nullable<global::System.DateTime> value);
        partial void OnRequiredDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> ShippedDate
        {
            get
            {
                return _ShippedDate;
            }
            set
            {
                OnShippedDateChanging(value);
                ReportPropertyChanging("ShippedDate");
                _ShippedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ShippedDate");
                OnShippedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _ShippedDate;
        partial void OnShippedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnShippedDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> Freight
        {
            get
            {
                return _Freight;
            }
            set
            {
                OnFreightChanging(value);
                ReportPropertyChanging("Freight");
                _Freight = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Freight");
                OnFreightChanged();
            }
        }
        private Nullable<global::System.Decimal> _Freight;
        partial void OnFreightChanging(Nullable<global::System.Decimal> value);
        partial void OnFreightChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipName
        {
            get
            {
                return _ShipName;
            }
            set
            {
                OnShipNameChanging(value);
                ReportPropertyChanging("ShipName");
                _ShipName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipName");
                OnShipNameChanged();
            }
        }
        private global::System.String _ShipName;
        partial void OnShipNameChanging(global::System.String value);
        partial void OnShipNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipAddress
        {
            get
            {
                return _ShipAddress;
            }
            set
            {
                OnShipAddressChanging(value);
                ReportPropertyChanging("ShipAddress");
                _ShipAddress = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipAddress");
                OnShipAddressChanged();
            }
        }
        private global::System.String _ShipAddress;
        partial void OnShipAddressChanging(global::System.String value);
        partial void OnShipAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCity
        {
            get
            {
                return _ShipCity;
            }
            set
            {
                OnShipCityChanging(value);
                ReportPropertyChanging("ShipCity");
                _ShipCity = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCity");
                OnShipCityChanged();
            }
        }
        private global::System.String _ShipCity;
        partial void OnShipCityChanging(global::System.String value);
        partial void OnShipCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipRegion
        {
            get
            {
                return _ShipRegion;
            }
            set
            {
                OnShipRegionChanging(value);
                ReportPropertyChanging("ShipRegion");
                _ShipRegion = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipRegion");
                OnShipRegionChanged();
            }
        }
        private global::System.String _ShipRegion;
        partial void OnShipRegionChanging(global::System.String value);
        partial void OnShipRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipPostalCode
        {
            get
            {
                return _ShipPostalCode;
            }
            set
            {
                OnShipPostalCodeChanging(value);
                ReportPropertyChanging("ShipPostalCode");
                _ShipPostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipPostalCode");
                OnShipPostalCodeChanged();
            }
        }
        private global::System.String _ShipPostalCode;
        partial void OnShipPostalCodeChanging(global::System.String value);
        partial void OnShipPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCountry
        {
            get
            {
                return _ShipCountry;
            }
            set
            {
                OnShipCountryChanging(value);
                ReportPropertyChanging("ShipCountry");
                _ShipCountry = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCountry");
                OnShipCountryChanged();
            }
        }
        private global::System.String _ShipCountry;
        partial void OnShipCountryChanging(global::System.String value);
        partial void OnShipCountryChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers")]
        public Customers Customers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Customers> CustomersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "InternationalOrders")]
        public InternationalOrders InternationalOrders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<InternationalOrders> InternationalOrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="PreviousEmployees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class PreviousEmployees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new PreviousEmployees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static PreviousEmployees CreatePreviousEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            PreviousEmployees previousEmployees = new PreviousEmployees();
            previousEmployees.EmployeeID = employeeID;
            previousEmployees.LastName = lastName;
            previousEmployees.FirstName = firstName;
            return previousEmployees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Products")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Products : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Products object.
        /// </summary>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="productName">Initial value of the ProductName property.</param>
        /// <param name="discontinued">Initial value of the Discontinued property.</param>
        public static Products CreateProducts(global::System.Int64 productID, global::System.String productName, global::System.Boolean discontinued)
        {
            Products products = new Products();
            products.ProductID = productID;
            products.ProductName = productName;
            products.Discontinued = discontinued;
            return products;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String ProductName
        {
            get
            {
                return _ProductName;
            }
            set
            {
                OnProductNameChanging(value);
                ReportPropertyChanging("ProductName");
                _ProductName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("ProductName");
                OnProductNameChanged();
            }
        }
        private global::System.String _ProductName;
        partial void OnProductNameChanging(global::System.String value);
        partial void OnProductNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String QuantityPerUnit
        {
            get
            {
                return _QuantityPerUnit;
            }
            set
            {
                OnQuantityPerUnitChanging(value);
                ReportPropertyChanging("QuantityPerUnit");
                _QuantityPerUnit = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("QuantityPerUnit");
                OnQuantityPerUnitChanged();
            }
        }
        private global::System.String _QuantityPerUnit;
        partial void OnQuantityPerUnitChanging(global::System.String value);
        partial void OnQuantityPerUnitChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private Nullable<global::System.Decimal> _UnitPrice;
        partial void OnUnitPriceChanging(Nullable<global::System.Decimal> value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsInStock
        {
            get
            {
                return _UnitsInStock;
            }
            set
            {
                OnUnitsInStockChanging(value);
                ReportPropertyChanging("UnitsInStock");
                _UnitsInStock = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsInStock");
                OnUnitsInStockChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsInStock;
        partial void OnUnitsInStockChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsInStockChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsOnOrder
        {
            get
            {
                return _UnitsOnOrder;
            }
            set
            {
                OnUnitsOnOrderChanging(value);
                ReportPropertyChanging("UnitsOnOrder");
                _UnitsOnOrder = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsOnOrder");
                OnUnitsOnOrderChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsOnOrder;
        partial void OnUnitsOnOrderChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsOnOrderChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> ReorderLevel
        {
            get
            {
                return _ReorderLevel;
            }
            set
            {
                OnReorderLevelChanging(value);
                ReportPropertyChanging("ReorderLevel");
                _ReorderLevel = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ReorderLevel");
                OnReorderLevelChanged();
            }
        }
        private Nullable<global::System.Int16> _ReorderLevel;
        partial void OnReorderLevelChanging(Nullable<global::System.Int16> value);
        partial void OnReorderLevelChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Boolean Discontinued
        {
            get
            {
                return _Discontinued;
            }
            set
            {
                OnDiscontinuedChanging(value);
                ReportPropertyChanging("Discontinued");
                _Discontinued = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discontinued");
                OnDiscontinuedChanged();
            }
        }
        private global::System.Boolean _Discontinued;
        partial void OnDiscontinuedChanging(global::System.Boolean value);
        partial void OnDiscontinuedChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> DiscontinuedDate
        {
            get
            {
                return _DiscontinuedDate;
            }
            set
            {
                OnDiscontinuedDateChanging(value);
                ReportPropertyChanging("DiscontinuedDate");
                _DiscontinuedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DiscontinuedDate");
                OnDiscontinuedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _DiscontinuedDate;
        partial void OnDiscontinuedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnDiscontinuedDateChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories")]
        public Categories Categories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Categories> CategoriesReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers")]
        public Suppliers Suppliers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Suppliers> SuppliersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Regions")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Regions : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Regions object.
        /// </summary>
        /// <param name="regionID">Initial value of the RegionID property.</param>
        /// <param name="regionDescription">Initial value of the RegionDescription property.</param>
        public static Regions CreateRegions(global::System.Int64 regionID, global::System.String regionDescription)
        {
            Regions regions = new Regions();
            regions.RegionID = regionID;
            regions.RegionDescription = regionDescription;
            return regions;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 RegionID
        {
            get
            {
                return _RegionID;
            }
            set
            {
                if (_RegionID != value)
                {
                    OnRegionIDChanging(value);
                    ReportPropertyChanging("RegionID");
                    _RegionID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("RegionID");
                    OnRegionIDChanged();
                }
            }
        }
        private global::System.Int64 _RegionID;
        partial void OnRegionIDChanging(global::System.Int64 value);
        partial void OnRegionIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String RegionDescription
        {
            get
            {
                return _RegionDescription;
            }
            set
            {
                OnRegionDescriptionChanging(value);
                ReportPropertyChanging("RegionDescription");
                _RegionDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("RegionDescription");
                OnRegionDescriptionChanged();
            }
        }
        private global::System.String _RegionDescription;
        partial void OnRegionDescriptionChanging(global::System.String value);
        partial void OnRegionDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Suppliers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Suppliers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Suppliers object.
        /// </summary>
        /// <param name="supplierID">Initial value of the SupplierID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Suppliers CreateSuppliers(global::System.Int64 supplierID, global::System.String companyName)
        {
            Suppliers suppliers = new Suppliers();
            suppliers.SupplierID = supplierID;
            suppliers.CompanyName = companyName;
            return suppliers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 SupplierID
        {
            get
            {
                return _SupplierID;
            }
            set
            {
                if (_SupplierID != value)
                {
                    OnSupplierIDChanging(value);
                    ReportPropertyChanging("SupplierID");
                    _SupplierID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("SupplierID");
                    OnSupplierIDChanged();
                }
            }
        }
        private global::System.Int64 _SupplierID;
        partial void OnSupplierIDChanging(global::System.Int64 value);
        partial void OnSupplierIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePage
        {
            get
            {
                return _HomePage;
            }
            set
            {
                OnHomePageChanging(value);
                ReportPropertyChanging("HomePage");
                _HomePage = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePage");
                OnHomePageChanged();
            }
        }
        private global::System.String _HomePage;
        partial void OnHomePageChanging(global::System.String value);
        partial void OnHomePageChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Territories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Territories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Territories object.
        /// </summary>
        /// <param name="territoryID">Initial value of the TerritoryID property.</param>
        /// <param name="territoryDescription">Initial value of the TerritoryDescription property.</param>
        public static Territories CreateTerritories(global::System.Int64 territoryID, global::System.String territoryDescription)
        {
            Territories territories = new Territories();
            territories.TerritoryID = territoryID;
            territories.TerritoryDescription = territoryDescription;
            return territories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 TerritoryID
        {
            get
            {
                return _TerritoryID;
            }
            set
            {
                if (_TerritoryID != value)
                {
                    OnTerritoryIDChanging(value);
                    ReportPropertyChanging("TerritoryID");
                    _TerritoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("TerritoryID");
                    OnTerritoryIDChanged();
                }
            }
        }
        private global::System.Int64 _TerritoryID;
        partial void OnTerritoryIDChanging(global::System.Int64 value);
        partial void OnTerritoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String TerritoryDescription
        {
            get
            {
                return _TerritoryDescription;
            }
            set
            {
                OnTerritoryDescriptionChanging(value);
                ReportPropertyChanging("TerritoryDescription");
                _TerritoryDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("TerritoryDescription");
                OnTerritoryDescriptionChanged();
            }
        }
        private global::System.String _TerritoryDescription;
        partial void OnTerritoryDescriptionChanging(global::System.String value);
        partial void OnTerritoryDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions")]
        public Regions Regions
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Regions> RegionsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Employees")]
        public EntityCollection<Employees> Employees
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees", value);
                }
            }
        }

        #endregion
    }

    #endregion

}

Added testlinq/NorthwindModel.EF6.NetStandard21.edmx.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
    <Schema Namespace="northwindEFModel.Store" Alias="Self" Provider="System.Data.SQLite.EF6" ProviderManifestToken="ISO8601" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
        <EntityContainer Name="northwindEFModelStoreContainer">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Store.Categories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Store.Customers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Store.Employees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="EmployeesTerritories" EntityType="northwindEFModel.Store.EmployeesTerritories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.Store.InternationalOrders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.Store.OrderDetails" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Store.Orders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.Store.PreviousEmployees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Store.Products" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Store.Regions" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Store.Suppliers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Store.Territories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <AssociationSet Name="FK_EmployeesTerritories_EmployeeID_EmployeeID" Association="northwindEFModel.Store.FK_EmployeesTerritories_EmployeeID_EmployeeID">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_EmployeesTerritories_TerritoryID_TerritoryID" Association="northwindEFModel.Store.FK_EmployeesTerritories_TerritoryID_TerritoryID">
            <End Role="Territories" EntitySet="Territories" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.Store.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.Store.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.Store.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.Store.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.Store.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.Store.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.Store.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
        </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CategoryName" Type="nvarchar" Nullable="false" MaxLength="15" />
          <Property Name="Description" Type="nvarchar" />
          <Property Name="Picture" Type="blob" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="nvarchar" Nullable="false" MaxLength="5" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="EmployeesTerritories">
          <Key>
            <PropertyRef Name="EmployeeID" />
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="CustomsDescription" Type="nvarchar" Nullable="false" MaxLength="100" />
          <Property Name="ExciseTax" Type="decimal" Nullable="false" Precision="53" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="ProductID" Type="integer" Nullable="false" />
          <Property Name="UnitPrice" Type="decimal" Nullable="false" Precision="53" />
          <Property Name="Quantity" Type="smallint" Nullable="false" />
          <!--
              NOTE: The "Discount" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbInsertCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Discount" Type="real" Nullable="false" StoreGeneratedPattern="Computed" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CustomerID" Type="nvarchar" MaxLength="5" />
          <Property Name="EmployeeID" Type="integer" />
          <Property Name="OrderDate" Type="datetime" />
          <Property Name="RequiredDate" Type="datetime" />
          <Property Name="ShippedDate" Type="datetime" />
          <!--
              NOTE: The "Freight" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbUpdateCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Freight" Type="decimal" Precision="53" StoreGeneratedPattern="Computed" />
          <Property Name="ShipName" Type="nvarchar" MaxLength="40" />
          <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" />
          <Property Name="ShipCity" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="ProductName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="SupplierID" Type="integer" />
          <Property Name="CategoryID" Type="integer" />
          <Property Name="QuantityPerUnit" Type="nvarchar" MaxLength="20" />
          <Property Name="UnitPrice" Type="decimal" Precision="53" />
          <Property Name="UnitsInStock" Type="smallint" />
          <Property Name="UnitsOnOrder" Type="smallint" />
          <Property Name="ReorderLevel" Type="smallint" />
          <Property Name="Discontinued" Type="bit" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="datetime" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="integer" Nullable="false" />
          <Property Name="RegionDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
          <Property Name="HomePage" Type="nvarchar" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
          <Property Name="TerritoryDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
          <Property Name="RegionID" Type="integer" Nullable="false" />
        </EntityType>
        <Association Name="FK_EmployeesTerritories_EmployeeID_EmployeeID">
          <End Role="Employees" Type="northwindEFModel.Store.Employees" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Employees">
              <PropertyRef Name="EmployeeID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="EmployeeID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_EmployeesTerritories_TerritoryID_TerritoryID">
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Territories">
              <PropertyRef Name="TerritoryID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="TerritoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.Store.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Store.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Customers">
              <PropertyRef Name="CustomerID" />
            </Principal>
            <Dependent Role="Orders">
              <PropertyRef Name="CustomerID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Store.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Categories">
              <PropertyRef Name="CategoryID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="CategoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Store.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Suppliers">
              <PropertyRef Name="SupplierID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="SupplierID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Store.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Regions">
              <PropertyRef Name="RegionID" />
            </Principal>
            <Dependent Role="Territories">
              <PropertyRef Name="RegionID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
      </Schema></edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="northwindEFModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
        <EntityContainer Name="northwindEFEntities">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Categories" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Customers" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Employees" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.InternationalOrders" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.OrderDetails" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Orders" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.PreviousEmployees" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Products" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Regions" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Suppliers" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Territories" />
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          <AssociationSet Name="EmployeesTerritories" Association="northwindEFModel.EmployeesTerritories">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="Int64" Nullable="false" />
          <Property Name="CategoryName" Type="String" Nullable="false" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Description" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="Picture" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Categories" ToRole="Products" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="String" Nullable="false" MaxLength="5" Unicode="true" FixedLength="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Customers" ToRole="Orders" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Employees" ToRole="Territories" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="CustomsDescription" Type="String" Nullable="false" MaxLength="100" Unicode="true" FixedLength="false" />
          <Property Name="ExciseTax" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="InternationalOrders" ToRole="Orders" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="UnitPrice" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <Property Name="Quantity" Type="Int16" Nullable="false" />
          <Property Name="Discount" Type="Single" Nullable="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="OrderDetails" ToRole="Orders" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="OrderDetails" ToRole="Products" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="EmployeeID" Type="Int64" />
          <Property Name="OrderDate" Type="DateTime" />
          <Property Name="RequiredDate" Type="DateTime" />
          <Property Name="ShippedDate" Type="DateTime" />
          <Property Name="Freight" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="ShipName" Type="String" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ShipAddress" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="ShipCity" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipRegion" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipPostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="ShipCountry" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Customers" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Orders" ToRole="Customers" />
          <NavigationProperty Name="InternationalOrders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="Orders" ToRole="InternationalOrders" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="Orders" ToRole="OrderDetails" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="ProductName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="QuantityPerUnit" Type="String" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="UnitPrice" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="UnitsInStock" Type="Int16" />
          <Property Name="UnitsOnOrder" Type="Int16" />
          <Property Name="ReorderLevel" Type="Int16" />
          <Property Name="Discontinued" Type="Boolean" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="DateTime" />
          <NavigationProperty Name="Categories" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Products" ToRole="Categories" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="Products" ToRole="OrderDetails" />
          <NavigationProperty Name="Suppliers" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Products" ToRole="Suppliers" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="Int64" Nullable="false" />
          <Property Name="RegionDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Regions" ToRole="Territories" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="Int64" Nullable="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="HomePage" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Suppliers" ToRole="Products" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="Int64" Nullable="false" />
          <Property Name="TerritoryDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Regions" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Territories" ToRole="Regions" />
          <NavigationProperty Name="Employees" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Territories" ToRole="Employees" />
        </EntityType>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="*" />
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        <Association Name="EmployeesTerritories">
          <End Role="Employees" Type="northwindEFModel.Employees" Multiplicity="*" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        </Schema>
    </edmx:ConceptualModels>
    <!-- C-S mapping content -->
    <edmx:Mappings>
      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
        <EntityContainerMapping StorageEntityContainer="northwindEFModelStoreContainer" CdmEntityContainer="northwindEFEntities">
          <EntitySetMapping Name="Categories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Categories)">
              <MappingFragment StoreEntitySet="Categories">
                <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
                <ScalarProperty Name="CategoryName" ColumnName="CategoryName" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="Picture" ColumnName="Picture" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Customers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Customers)">
              <MappingFragment StoreEntitySet="Customers">
                <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Employees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Employees)">
              <MappingFragment StoreEntitySet="Employees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="InternationalOrders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.InternationalOrders)">
              <MappingFragment StoreEntitySet="InternationalOrders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="CustomsDescription" ColumnName="CustomsDescription" />
                <ScalarProperty Name="ExciseTax" ColumnName="ExciseTax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="OrderDetails">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.OrderDetails)">
              <MappingFragment StoreEntitySet="OrderDetails">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="Quantity" ColumnName="Quantity" />
                <ScalarProperty Name="Discount" ColumnName="Discount" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Orders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Orders)">
              <MappingFragment StoreEntitySet="Orders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="OrderDate" ColumnName="OrderDate" />
                <ScalarProperty Name="RequiredDate" ColumnName="RequiredDate" />
                <ScalarProperty Name="ShippedDate" ColumnName="ShippedDate" />
                <ScalarProperty Name="Freight" ColumnName="Freight" />
                <ScalarProperty Name="ShipName" ColumnName="ShipName" />
                <ScalarProperty Name="ShipAddress" ColumnName="ShipAddress" />
                <ScalarProperty Name="ShipCity" ColumnName="ShipCity" />
                <ScalarProperty Name="ShipRegion" ColumnName="ShipRegion" />
                <ScalarProperty Name="ShipPostalCode" ColumnName="ShipPostalCode" />
                <ScalarProperty Name="ShipCountry" ColumnName="ShipCountry" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="PreviousEmployees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.PreviousEmployees)">
              <MappingFragment StoreEntitySet="PreviousEmployees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Products">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Products)">
              <MappingFragment StoreEntitySet="Products">
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="ProductName" ColumnName="ProductName" />
                <ScalarProperty Name="QuantityPerUnit" ColumnName="QuantityPerUnit" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="UnitsInStock" ColumnName="UnitsInStock" />
                <ScalarProperty Name="UnitsOnOrder" ColumnName="UnitsOnOrder" />
                <ScalarProperty Name="ReorderLevel" ColumnName="ReorderLevel" />
                <ScalarProperty Name="Discontinued" ColumnName="Discontinued" />
                <ScalarProperty Name="DiscontinuedDate" ColumnName="DiscontinuedDate" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Regions">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Regions)">
              <MappingFragment StoreEntitySet="Regions">
                <ScalarProperty Name="RegionID" ColumnName="RegionID" />
                <ScalarProperty Name="RegionDescription" ColumnName="RegionDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Suppliers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Suppliers)">
              <MappingFragment StoreEntitySet="Suppliers">
                <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
                <ScalarProperty Name="HomePage" ColumnName="HomePage" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Territories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Territories)">
              <MappingFragment StoreEntitySet="Territories">
                <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
                <ScalarProperty Name="TerritoryDescription" ColumnName="TerritoryDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <AssociationSetMapping Name="FK_Products_CategoryID_CategoryID" TypeName="northwindEFModel.FK_Products_CategoryID_CategoryID" StoreEntitySet="Products">
            <EndProperty Name="Categories">
              <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="CategoryID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Orders_CustomerID_CustomerID" TypeName="northwindEFModel.FK_Orders_CustomerID_CustomerID" StoreEntitySet="Orders">
            <EndProperty Name="Customers">
              <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
            </EndProperty>
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <Condition ColumnName="CustomerID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_InternationalOrders_OrderID_OrderID" TypeName="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" StoreEntitySet="InternationalOrders">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="InternationalOrders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_OrderID_OrderID" TypeName="northwindEFModel.FK_OrderDetails_OrderID_OrderID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_ProductID_ProductID" TypeName="northwindEFModel.FK_OrderDetails_ProductID_ProductID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Products_SupplierID_SupplierID" TypeName="northwindEFModel.FK_Products_SupplierID_SupplierID" StoreEntitySet="Products">
            <EndProperty Name="Suppliers">
              <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="SupplierID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Territories_RegionID_RegionID" TypeName="northwindEFModel.FK_Territories_RegionID_RegionID" StoreEntitySet="Territories">
            <EndProperty Name="Regions">
              <ScalarProperty Name="RegionID" ColumnName="RegionID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="EmployeesTerritories" TypeName="northwindEFModel.EmployeesTerritories" StoreEntitySet="EmployeesTerritories">
            <EndProperty Name="Employees">
              <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          </EntityContainerMapping>
      </Mapping>
    </edmx:Mappings>
  </edmx:Runtime>
  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
  <edmx:Designer>
    <edmx:Connection>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </edmx:Connection>
    <edmx:Options>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
      </DesignerInfoPropertySet>
    </edmx:Options>
    <!-- Diagram content (shape and connector positions) -->
    <edmx:Diagrams>
      <Diagram Name="NorthwindModel" xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <EntityTypeShape EntityType="northwindEFModel.Categories" Width="1.5" PointX="0.75" PointY="1.625" Height="1.9802864583333335" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Customers" Width="1.5" PointX="0.75" PointY="9.625" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Employees" Width="1.5" PointX="2.75" PointY="14.625" Height="4.4802050781250014" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.InternationalOrders" Width="1.5" PointX="5.25" PointY="10.375" Height="1.7879850260416674" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.OrderDetails" Width="1.5" PointX="5.25" PointY="1.5" Height="2.3648893229166656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Orders" Width="1.5" PointX="3" PointY="9.25" Height="3.9033007812499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.PreviousEmployees" Width="1.5" PointX="7.75" PointY="0.75" Height="4.2879036458333317" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Products" Width="1.5" PointX="3" PointY="1" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Regions" Width="1.5" PointX="2.75" PointY="6" Height="1.5956835937499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Suppliers" Width="1.5" PointX="0.75" PointY="4.875" Height="3.5186979166666656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Territories" Width="1.5" PointX="5" PointY="5.875" Height="1.7879850260416674" IsExpanded="true" />
        <AssociationConnector Association="northwindEFModel.FK_Products_CategoryID_CategoryID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="2.6151432291666667" />
          <ConnectorPoint PointX="3" PointY="2.6151432291666667" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Orders_CustomerID_CustomerID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="11.2881982421875" />
          <ConnectorPoint PointX="3" PointY="11.2881982421875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.010416666666667" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.177083333333333" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.25" PointY="11.268992513020834" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="3.75" PointY="9.25" />
          <ConnectorPoint PointX="3.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="2.6824446614583328" />
          <ConnectorPoint PointX="5.25" PointY="2.6824446614583328" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="2.0287223307291664" />
          <ConnectorPoint PointX="5.25" PointY="2.0287223307291664" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Products_SupplierID_SupplierID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="4.326396484375" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Territories_RegionID_RegionID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="6.797841796875" />
          <ConnectorPoint PointX="4.666666666666667" PointY="6.7978417968749989" />
          <ConnectorPoint PointX="4.833333333333333" PointY="6.797841796875" />
          <ConnectorPoint PointX="5" PointY="6.797841796875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.EmployeesTerritories" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="7.6629850260416674" /></AssociationConnector>
        </Diagram></edmx:Diagrams>
  </edmx:Designer>
</edmx:Edmx>

Added testlinq/NorthwindModel.Linq.2008.Designer.cs.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.3053
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

[assembly: global::System.Data.Objects.DataClasses.EdmSchemaAttribute()]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Categories), "Products", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Customers), "Orders", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Orders))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(testlinq.Orders), "InternationalOrders", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.InternationalOrders))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(testlinq.Orders), "OrderDetails", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(testlinq.Products), "OrderDetails", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers", global::System.Data.Metadata.Edm.RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Suppliers), "Products", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions", global::System.Data.Metadata.Edm.RelationshipMultiplicity.One, typeof(testlinq.Regions), "Territories", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Territories))]
[assembly: global::System.Data.Objects.DataClasses.EdmRelationshipAttribute("northwindEFModel", "EmployeesTerritories", "Employees", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Employees), "Territories", global::System.Data.Metadata.Edm.RelationshipMultiplicity.Many, typeof(testlinq.Territories))]

// Original file name:
// Generation date: 8/25/2008 8:54:05 AM
namespace testlinq
{

    /// <summary>
    /// There are no comments for northwindEFEntities in the schema.
    /// </summary>
    public partial class northwindEFEntities : global::System.Data.Objects.ObjectContext
    {
        /// <summary>
        /// Initializes a new northwindEFEntities object using the connection string found in the 'northwindEFEntities' section of the application configuration file.
        /// </summary>
        public northwindEFEntities() :
                base("name=northwindEFEntities", "northwindEFEntities")
        {
            this.OnContextCreated();
        }
        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(string connectionString) :
                base(connectionString, "northwindEFEntities")
        {
            this.OnContextCreated();
        }
        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(global::System.Data.EntityClient.EntityConnection connection) :
                base(connection, "northwindEFEntities")
        {
            this.OnContextCreated();
        }
        partial void OnContextCreated();
        /// <summary>
        /// There are no comments for Categories in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<Categories> Categories
        {
            get
            {
                if ((this._Categories == null))
                {
                    this._Categories = base.CreateQuery<Categories>("[Categories]");
                }
                return this._Categories;
            }
        }
        private global::System.Data.Objects.ObjectQuery<Categories> _Categories;
        /// <summary>
        /// There are no comments for Customers in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<Customers> Customers
        {
            get
            {
                if ((this._Customers == null))
                {
                    this._Customers = base.CreateQuery<Customers>("[Customers]");
                }
                return this._Customers;
            }
        }
        private global::System.Data.Objects.ObjectQuery<Customers> _Customers;
        /// <summary>
        /// There are no comments for Employees in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<Employees> Employees
        {
            get
            {
                if ((this._Employees == null))
                {
                    this._Employees = base.CreateQuery<Employees>("[Employees]");
                }
                return this._Employees;
            }
        }
        private global::System.Data.Objects.ObjectQuery<Employees> _Employees;
        /// <summary>
        /// There are no comments for InternationalOrders in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<InternationalOrders> InternationalOrders
        {
            get
            {
                if ((this._InternationalOrders == null))
                {
                    this._InternationalOrders = base.CreateQuery<InternationalOrders>("[InternationalOrders]");
                }
                return this._InternationalOrders;
            }
        }
        private global::System.Data.Objects.ObjectQuery<InternationalOrders> _InternationalOrders;
        /// <summary>
        /// There are no comments for OrderDetails in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<OrderDetails> OrderDetails
        {
            get
            {
                if ((this._OrderDetails == null))
                {
                    this._OrderDetails = base.CreateQuery<OrderDetails>("[OrderDetails]");
                }
                return this._OrderDetails;
            }
        }
        private global::System.Data.Objects.ObjectQuery<OrderDetails> _OrderDetails;
        /// <summary>
        /// There are no comments for Orders in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<Orders> Orders
        {
            get
            {
                if ((this._Orders == null))
                {
                    this._Orders = base.CreateQuery<Orders>("[Orders]");
                }
                return this._Orders;
            }
        }
        private global::System.Data.Objects.ObjectQuery<Orders> _Orders;
        /// <summary>
        /// There are no comments for PreviousEmployees in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<PreviousEmployees> PreviousEmployees
        {
            get
            {
                if ((this._PreviousEmployees == null))
                {
                    this._PreviousEmployees = base.CreateQuery<PreviousEmployees>("[PreviousEmployees]");
                }
                return this._PreviousEmployees;
            }
        }
        private global::System.Data.Objects.ObjectQuery<PreviousEmployees> _PreviousEmployees;
        /// <summary>
        /// There are no comments for Products in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<Products> Products
        {
            get
            {
                if ((this._Products == null))
                {
                    this._Products = base.CreateQuery<Products>("[Products]");
                }
                return this._Products;
            }
        }
        private global::System.Data.Objects.ObjectQuery<Products> _Products;
        /// <summary>
        /// There are no comments for Regions in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<Regions> Regions
        {
            get
            {
                if ((this._Regions == null))
                {
                    this._Regions = base.CreateQuery<Regions>("[Regions]");
                }
                return this._Regions;
            }
        }
        private global::System.Data.Objects.ObjectQuery<Regions> _Regions;
        /// <summary>
        /// There are no comments for Suppliers in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<Suppliers> Suppliers
        {
            get
            {
                if ((this._Suppliers == null))
                {
                    this._Suppliers = base.CreateQuery<Suppliers>("[Suppliers]");
                }
                return this._Suppliers;
            }
        }
        private global::System.Data.Objects.ObjectQuery<Suppliers> _Suppliers;
        /// <summary>
        /// There are no comments for Territories in the schema.
        /// </summary>
        public global::System.Data.Objects.ObjectQuery<Territories> Territories
        {
            get
            {
                if ((this._Territories == null))
                {
                    this._Territories = base.CreateQuery<Territories>("[Territories]");
                }
                return this._Territories;
            }
        }
        private global::System.Data.Objects.ObjectQuery<Territories> _Territories;
        /// <summary>
        /// There are no comments for Categories in the schema.
        /// </summary>
        public void AddToCategories(Categories categories)
        {
            base.AddObject("Categories", categories);
        }
        /// <summary>
        /// There are no comments for Customers in the schema.
        /// </summary>
        public void AddToCustomers(Customers customers)
        {
            base.AddObject("Customers", customers);
        }
        /// <summary>
        /// There are no comments for Employees in the schema.
        /// </summary>
        public void AddToEmployees(Employees employees)
        {
            base.AddObject("Employees", employees);
        }
        /// <summary>
        /// There are no comments for InternationalOrders in the schema.
        /// </summary>
        public void AddToInternationalOrders(InternationalOrders internationalOrders)
        {
            base.AddObject("InternationalOrders", internationalOrders);
        }
        /// <summary>
        /// There are no comments for OrderDetails in the schema.
        /// </summary>
        public void AddToOrderDetails(OrderDetails orderDetails)
        {
            base.AddObject("OrderDetails", orderDetails);
        }
        /// <summary>
        /// There are no comments for Orders in the schema.
        /// </summary>
        public void AddToOrders(Orders orders)
        {
            base.AddObject("Orders", orders);
        }
        /// <summary>
        /// There are no comments for PreviousEmployees in the schema.
        /// </summary>
        public void AddToPreviousEmployees(PreviousEmployees previousEmployees)
        {
            base.AddObject("PreviousEmployees", previousEmployees);
        }
        /// <summary>
        /// There are no comments for Products in the schema.
        /// </summary>
        public void AddToProducts(Products products)
        {
            base.AddObject("Products", products);
        }
        /// <summary>
        /// There are no comments for Regions in the schema.
        /// </summary>
        public void AddToRegions(Regions regions)
        {
            base.AddObject("Regions", regions);
        }
        /// <summary>
        /// There are no comments for Suppliers in the schema.
        /// </summary>
        public void AddToSuppliers(Suppliers suppliers)
        {
            base.AddObject("Suppliers", suppliers);
        }
        /// <summary>
        /// There are no comments for Territories in the schema.
        /// </summary>
        public void AddToTerritories(Territories territories)
        {
            base.AddObject("Territories", territories);
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.Categories in the schema.
    /// </summary>
    /// <KeyProperties>
    /// CategoryID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Categories")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class Categories : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new Categories object.
        /// </summary>
        /// <param name="categoryID">Initial value of CategoryID.</param>
        /// <param name="categoryName">Initial value of CategoryName.</param>
        public static Categories CreateCategories(long categoryID, string categoryName)
        {
            Categories categories = new Categories();
            categories.CategoryID = categoryID;
            categories.CategoryName = categoryName;
            return categories;
        }
        /// <summary>
        /// There are no comments for Property CategoryID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long CategoryID
        {
            get
            {
                return this._CategoryID;
            }
            set
            {
                this.OnCategoryIDChanging(value);
                this.ReportPropertyChanging("CategoryID");
                this._CategoryID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("CategoryID");
                this.OnCategoryIDChanged();
            }
        }
        private long _CategoryID;
        partial void OnCategoryIDChanging(long value);
        partial void OnCategoryIDChanged();
        /// <summary>
        /// There are no comments for Property CategoryName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string CategoryName
        {
            get
            {
                return this._CategoryName;
            }
            set
            {
                this.OnCategoryNameChanging(value);
                this.ReportPropertyChanging("CategoryName");
                this._CategoryName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("CategoryName");
                this.OnCategoryNameChanged();
            }
        }
        private string _CategoryName;
        partial void OnCategoryNameChanging(string value);
        partial void OnCategoryNameChanged();
        /// <summary>
        /// There are no comments for Property Description in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Description
        {
            get
            {
                return this._Description;
            }
            set
            {
                this.OnDescriptionChanging(value);
                this.ReportPropertyChanging("Description");
                this._Description = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Description");
                this.OnDescriptionChanged();
            }
        }
        private string _Description;
        partial void OnDescriptionChanging(string value);
        partial void OnDescriptionChanged();
        /// <summary>
        /// There are no comments for Property Picture in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public byte[] Picture
        {
            get
            {
                return global::System.Data.Objects.DataClasses.StructuralObject.GetValidValue(this._Picture);
            }
            set
            {
                this.OnPictureChanging(value);
                this.ReportPropertyChanging("Picture");
                this._Picture = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Picture");
                this.OnPictureChanged();
            }
        }
        private byte[] _Picture;
        partial void OnPictureChanging(byte[] value);
        partial void OnPictureChanged();
        /// <summary>
        /// There are no comments for Products in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Products")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityCollection<Products> Products
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products", value);
                }
            }
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.Customers in the schema.
    /// </summary>
    /// <KeyProperties>
    /// CustomerID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Customers")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class Customers : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new Customers object.
        /// </summary>
        /// <param name="customerID">Initial value of CustomerID.</param>
        /// <param name="companyName">Initial value of CompanyName.</param>
        public static Customers CreateCustomers(string customerID, string companyName)
        {
            Customers customers = new Customers();
            customers.CustomerID = customerID;
            customers.CompanyName = companyName;
            return customers;
        }
        /// <summary>
        /// There are no comments for Property CustomerID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string CustomerID
        {
            get
            {
                return this._CustomerID;
            }
            set
            {
                this.OnCustomerIDChanging(value);
                this.ReportPropertyChanging("CustomerID");
                this._CustomerID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("CustomerID");
                this.OnCustomerIDChanged();
            }
        }
        private string _CustomerID;
        partial void OnCustomerIDChanging(string value);
        partial void OnCustomerIDChanged();
        /// <summary>
        /// There are no comments for Property CompanyName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string CompanyName
        {
            get
            {
                return this._CompanyName;
            }
            set
            {
                this.OnCompanyNameChanging(value);
                this.ReportPropertyChanging("CompanyName");
                this._CompanyName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("CompanyName");
                this.OnCompanyNameChanged();
            }
        }
        private string _CompanyName;
        partial void OnCompanyNameChanging(string value);
        partial void OnCompanyNameChanged();
        /// <summary>
        /// There are no comments for Property ContactName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ContactName
        {
            get
            {
                return this._ContactName;
            }
            set
            {
                this.OnContactNameChanging(value);
                this.ReportPropertyChanging("ContactName");
                this._ContactName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ContactName");
                this.OnContactNameChanged();
            }
        }
        private string _ContactName;
        partial void OnContactNameChanging(string value);
        partial void OnContactNameChanged();
        /// <summary>
        /// There are no comments for Property ContactTitle in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ContactTitle
        {
            get
            {
                return this._ContactTitle;
            }
            set
            {
                this.OnContactTitleChanging(value);
                this.ReportPropertyChanging("ContactTitle");
                this._ContactTitle = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ContactTitle");
                this.OnContactTitleChanged();
            }
        }
        private string _ContactTitle;
        partial void OnContactTitleChanging(string value);
        partial void OnContactTitleChanged();
        /// <summary>
        /// There are no comments for Property Address in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Address
        {
            get
            {
                return this._Address;
            }
            set
            {
                this.OnAddressChanging(value);
                this.ReportPropertyChanging("Address");
                this._Address = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Address");
                this.OnAddressChanged();
            }
        }
        private string _Address;
        partial void OnAddressChanging(string value);
        partial void OnAddressChanged();
        /// <summary>
        /// There are no comments for Property City in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string City
        {
            get
            {
                return this._City;
            }
            set
            {
                this.OnCityChanging(value);
                this.ReportPropertyChanging("City");
                this._City = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("City");
                this.OnCityChanged();
            }
        }
        private string _City;
        partial void OnCityChanging(string value);
        partial void OnCityChanged();
        /// <summary>
        /// There are no comments for Property Region in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Region
        {
            get
            {
                return this._Region;
            }
            set
            {
                this.OnRegionChanging(value);
                this.ReportPropertyChanging("Region");
                this._Region = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Region");
                this.OnRegionChanged();
            }
        }
        private string _Region;
        partial void OnRegionChanging(string value);
        partial void OnRegionChanged();
        /// <summary>
        /// There are no comments for Property PostalCode in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string PostalCode
        {
            get
            {
                return this._PostalCode;
            }
            set
            {
                this.OnPostalCodeChanging(value);
                this.ReportPropertyChanging("PostalCode");
                this._PostalCode = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("PostalCode");
                this.OnPostalCodeChanged();
            }
        }
        private string _PostalCode;
        partial void OnPostalCodeChanging(string value);
        partial void OnPostalCodeChanged();
        /// <summary>
        /// There are no comments for Property Country in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Country
        {
            get
            {
                return this._Country;
            }
            set
            {
                this.OnCountryChanging(value);
                this.ReportPropertyChanging("Country");
                this._Country = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Country");
                this.OnCountryChanged();
            }
        }
        private string _Country;
        partial void OnCountryChanging(string value);
        partial void OnCountryChanged();
        /// <summary>
        /// There are no comments for Property Phone in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Phone
        {
            get
            {
                return this._Phone;
            }
            set
            {
                this.OnPhoneChanging(value);
                this.ReportPropertyChanging("Phone");
                this._Phone = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Phone");
                this.OnPhoneChanged();
            }
        }
        private string _Phone;
        partial void OnPhoneChanging(string value);
        partial void OnPhoneChanged();
        /// <summary>
        /// There are no comments for Property Fax in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Fax
        {
            get
            {
                return this._Fax;
            }
            set
            {
                this.OnFaxChanging(value);
                this.ReportPropertyChanging("Fax");
                this._Fax = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Fax");
                this.OnFaxChanged();
            }
        }
        private string _Fax;
        partial void OnFaxChanging(string value);
        partial void OnFaxChanged();
        /// <summary>
        /// There are no comments for Orders in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Orders")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityCollection<Orders> Orders
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders", value);
                }
            }
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.Employees in the schema.
    /// </summary>
    /// <KeyProperties>
    /// EmployeeID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Employees")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class Employees : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new Employees object.
        /// </summary>
        /// <param name="employeeID">Initial value of EmployeeID.</param>
        /// <param name="lastName">Initial value of LastName.</param>
        /// <param name="firstName">Initial value of FirstName.</param>
        public static Employees CreateEmployees(long employeeID, string lastName, string firstName)
        {
            Employees employees = new Employees();
            employees.EmployeeID = employeeID;
            employees.LastName = lastName;
            employees.FirstName = firstName;
            return employees;
        }
        /// <summary>
        /// There are no comments for Property EmployeeID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long EmployeeID
        {
            get
            {
                return this._EmployeeID;
            }
            set
            {
                this.OnEmployeeIDChanging(value);
                this.ReportPropertyChanging("EmployeeID");
                this._EmployeeID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("EmployeeID");
                this.OnEmployeeIDChanged();
            }
        }
        private long _EmployeeID;
        partial void OnEmployeeIDChanging(long value);
        partial void OnEmployeeIDChanged();
        /// <summary>
        /// There are no comments for Property LastName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string LastName
        {
            get
            {
                return this._LastName;
            }
            set
            {
                this.OnLastNameChanging(value);
                this.ReportPropertyChanging("LastName");
                this._LastName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("LastName");
                this.OnLastNameChanged();
            }
        }
        private string _LastName;
        partial void OnLastNameChanging(string value);
        partial void OnLastNameChanged();
        /// <summary>
        /// There are no comments for Property FirstName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string FirstName
        {
            get
            {
                return this._FirstName;
            }
            set
            {
                this.OnFirstNameChanging(value);
                this.ReportPropertyChanging("FirstName");
                this._FirstName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("FirstName");
                this.OnFirstNameChanged();
            }
        }
        private string _FirstName;
        partial void OnFirstNameChanging(string value);
        partial void OnFirstNameChanged();
        /// <summary>
        /// There are no comments for Property Title in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Title
        {
            get
            {
                return this._Title;
            }
            set
            {
                this.OnTitleChanging(value);
                this.ReportPropertyChanging("Title");
                this._Title = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Title");
                this.OnTitleChanged();
            }
        }
        private string _Title;
        partial void OnTitleChanging(string value);
        partial void OnTitleChanged();
        /// <summary>
        /// There are no comments for Property TitleOfCourtesy in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string TitleOfCourtesy
        {
            get
            {
                return this._TitleOfCourtesy;
            }
            set
            {
                this.OnTitleOfCourtesyChanging(value);
                this.ReportPropertyChanging("TitleOfCourtesy");
                this._TitleOfCourtesy = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("TitleOfCourtesy");
                this.OnTitleOfCourtesyChanged();
            }
        }
        private string _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(string value);
        partial void OnTitleOfCourtesyChanged();
        /// <summary>
        /// There are no comments for Property BirthDate in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return this._BirthDate;
            }
            set
            {
                this.OnBirthDateChanging(value);
                this.ReportPropertyChanging("BirthDate");
                this._BirthDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("BirthDate");
                this.OnBirthDateChanged();
            }
        }
        private global::System.Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(global::System.Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();
        /// <summary>
        /// There are no comments for Property HireDate in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return this._HireDate;
            }
            set
            {
                this.OnHireDateChanging(value);
                this.ReportPropertyChanging("HireDate");
                this._HireDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("HireDate");
                this.OnHireDateChanged();
            }
        }
        private global::System.Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(global::System.Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();
        /// <summary>
        /// There are no comments for Property Address in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Address
        {
            get
            {
                return this._Address;
            }
            set
            {
                this.OnAddressChanging(value);
                this.ReportPropertyChanging("Address");
                this._Address = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Address");
                this.OnAddressChanged();
            }
        }
        private string _Address;
        partial void OnAddressChanging(string value);
        partial void OnAddressChanged();
        /// <summary>
        /// There are no comments for Property City in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string City
        {
            get
            {
                return this._City;
            }
            set
            {
                this.OnCityChanging(value);
                this.ReportPropertyChanging("City");
                this._City = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("City");
                this.OnCityChanged();
            }
        }
        private string _City;
        partial void OnCityChanging(string value);
        partial void OnCityChanged();
        /// <summary>
        /// There are no comments for Property Region in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Region
        {
            get
            {
                return this._Region;
            }
            set
            {
                this.OnRegionChanging(value);
                this.ReportPropertyChanging("Region");
                this._Region = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Region");
                this.OnRegionChanged();
            }
        }
        private string _Region;
        partial void OnRegionChanging(string value);
        partial void OnRegionChanged();
        /// <summary>
        /// There are no comments for Property PostalCode in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string PostalCode
        {
            get
            {
                return this._PostalCode;
            }
            set
            {
                this.OnPostalCodeChanging(value);
                this.ReportPropertyChanging("PostalCode");
                this._PostalCode = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("PostalCode");
                this.OnPostalCodeChanged();
            }
        }
        private string _PostalCode;
        partial void OnPostalCodeChanging(string value);
        partial void OnPostalCodeChanged();
        /// <summary>
        /// There are no comments for Property Country in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Country
        {
            get
            {
                return this._Country;
            }
            set
            {
                this.OnCountryChanging(value);
                this.ReportPropertyChanging("Country");
                this._Country = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Country");
                this.OnCountryChanged();
            }
        }
        private string _Country;
        partial void OnCountryChanging(string value);
        partial void OnCountryChanged();
        /// <summary>
        /// There are no comments for Property HomePhone in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string HomePhone
        {
            get
            {
                return this._HomePhone;
            }
            set
            {
                this.OnHomePhoneChanging(value);
                this.ReportPropertyChanging("HomePhone");
                this._HomePhone = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("HomePhone");
                this.OnHomePhoneChanged();
            }
        }
        private string _HomePhone;
        partial void OnHomePhoneChanging(string value);
        partial void OnHomePhoneChanged();
        /// <summary>
        /// There are no comments for Property Extension in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Extension
        {
            get
            {
                return this._Extension;
            }
            set
            {
                this.OnExtensionChanging(value);
                this.ReportPropertyChanging("Extension");
                this._Extension = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Extension");
                this.OnExtensionChanged();
            }
        }
        private string _Extension;
        partial void OnExtensionChanging(string value);
        partial void OnExtensionChanged();
        /// <summary>
        /// There are no comments for Property Photo in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public byte[] Photo
        {
            get
            {
                return global::System.Data.Objects.DataClasses.StructuralObject.GetValidValue(this._Photo);
            }
            set
            {
                this.OnPhotoChanging(value);
                this.ReportPropertyChanging("Photo");
                this._Photo = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Photo");
                this.OnPhotoChanged();
            }
        }
        private byte[] _Photo;
        partial void OnPhotoChanging(byte[] value);
        partial void OnPhotoChanged();
        /// <summary>
        /// There are no comments for Property Notes in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Notes
        {
            get
            {
                return this._Notes;
            }
            set
            {
                this.OnNotesChanging(value);
                this.ReportPropertyChanging("Notes");
                this._Notes = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Notes");
                this.OnNotesChanged();
            }
        }
        private string _Notes;
        partial void OnNotesChanging(string value);
        partial void OnNotesChanged();
        /// <summary>
        /// There are no comments for Property PhotoPath in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string PhotoPath
        {
            get
            {
                return this._PhotoPath;
            }
            set
            {
                this.OnPhotoPathChanging(value);
                this.ReportPropertyChanging("PhotoPath");
                this._PhotoPath = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("PhotoPath");
                this.OnPhotoPathChanged();
            }
        }
        private string _PhotoPath;
        partial void OnPhotoPathChanging(string value);
        partial void OnPhotoPathChanged();
        /// <summary>
        /// There are no comments for Territories in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Territories")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityCollection<Territories> Territories
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories", value);
                }
            }
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.InternationalOrders in the schema.
    /// </summary>
    /// <KeyProperties>
    /// OrderID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="InternationalOrders")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class InternationalOrders : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new InternationalOrders object.
        /// </summary>
        /// <param name="orderID">Initial value of OrderID.</param>
        /// <param name="customsDescription">Initial value of CustomsDescription.</param>
        /// <param name="exciseTax">Initial value of ExciseTax.</param>
        public static InternationalOrders CreateInternationalOrders(long orderID, string customsDescription, decimal exciseTax)
        {
            InternationalOrders internationalOrders = new InternationalOrders();
            internationalOrders.OrderID = orderID;
            internationalOrders.CustomsDescription = customsDescription;
            internationalOrders.ExciseTax = exciseTax;
            return internationalOrders;
        }
        /// <summary>
        /// There are no comments for Property OrderID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long OrderID
        {
            get
            {
                return this._OrderID;
            }
            set
            {
                this.OnOrderIDChanging(value);
                this.ReportPropertyChanging("OrderID");
                this._OrderID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("OrderID");
                this.OnOrderIDChanged();
            }
        }
        private long _OrderID;
        partial void OnOrderIDChanging(long value);
        partial void OnOrderIDChanged();
        /// <summary>
        /// There are no comments for Property CustomsDescription in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string CustomsDescription
        {
            get
            {
                return this._CustomsDescription;
            }
            set
            {
                this.OnCustomsDescriptionChanging(value);
                this.ReportPropertyChanging("CustomsDescription");
                this._CustomsDescription = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("CustomsDescription");
                this.OnCustomsDescriptionChanged();
            }
        }
        private string _CustomsDescription;
        partial void OnCustomsDescriptionChanging(string value);
        partial void OnCustomsDescriptionChanged();
        /// <summary>
        /// There are no comments for Property ExciseTax in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public decimal ExciseTax
        {
            get
            {
                return this._ExciseTax;
            }
            set
            {
                this.OnExciseTaxChanging(value);
                this.ReportPropertyChanging("ExciseTax");
                this._ExciseTax = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("ExciseTax");
                this.OnExciseTaxChanged();
            }
        }
        private decimal _ExciseTax;
        partial void OnExciseTaxChanging(decimal value);
        partial void OnExciseTaxChanged();
        /// <summary>
        /// There are no comments for Orders in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public Orders Orders
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// There are no comments for Orders in the schema.
        /// </summary>
        [global::System.ComponentModel.BrowsableAttribute(false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders", value);
                }
            }
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.OrderDetails in the schema.
    /// </summary>
    /// <KeyProperties>
    /// OrderID
    /// ProductID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="OrderDetails")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class OrderDetails : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new OrderDetails object.
        /// </summary>
        /// <param name="orderID">Initial value of OrderID.</param>
        /// <param name="productID">Initial value of ProductID.</param>
        /// <param name="unitPrice">Initial value of UnitPrice.</param>
        /// <param name="quantity">Initial value of Quantity.</param>
        /// <param name="discount">Initial value of Discount.</param>
        public static OrderDetails CreateOrderDetails(long orderID, long productID, decimal unitPrice, short quantity, float discount)
        {
            OrderDetails orderDetails = new OrderDetails();
            orderDetails.OrderID = orderID;
            orderDetails.ProductID = productID;
            orderDetails.UnitPrice = unitPrice;
            orderDetails.Quantity = quantity;
            orderDetails.Discount = discount;
            return orderDetails;
        }
        /// <summary>
        /// There are no comments for Property OrderID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long OrderID
        {
            get
            {
                return this._OrderID;
            }
            set
            {
                this.OnOrderIDChanging(value);
                this.ReportPropertyChanging("OrderID");
                this._OrderID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("OrderID");
                this.OnOrderIDChanged();
            }
        }
        private long _OrderID;
        partial void OnOrderIDChanging(long value);
        partial void OnOrderIDChanged();
        /// <summary>
        /// There are no comments for Property ProductID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long ProductID
        {
            get
            {
                return this._ProductID;
            }
            set
            {
                this.OnProductIDChanging(value);
                this.ReportPropertyChanging("ProductID");
                this._ProductID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("ProductID");
                this.OnProductIDChanged();
            }
        }
        private long _ProductID;
        partial void OnProductIDChanging(long value);
        partial void OnProductIDChanged();
        /// <summary>
        /// There are no comments for Property UnitPrice in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public decimal UnitPrice
        {
            get
            {
                return this._UnitPrice;
            }
            set
            {
                this.OnUnitPriceChanging(value);
                this.ReportPropertyChanging("UnitPrice");
                this._UnitPrice = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("UnitPrice");
                this.OnUnitPriceChanged();
            }
        }
        private decimal _UnitPrice;
        partial void OnUnitPriceChanging(decimal value);
        partial void OnUnitPriceChanged();
        /// <summary>
        /// There are no comments for Property Quantity in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public short Quantity
        {
            get
            {
                return this._Quantity;
            }
            set
            {
                this.OnQuantityChanging(value);
                this.ReportPropertyChanging("Quantity");
                this._Quantity = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("Quantity");
                this.OnQuantityChanged();
            }
        }
        private short _Quantity;
        partial void OnQuantityChanging(short value);
        partial void OnQuantityChanged();
        /// <summary>
        /// There are no comments for Property Discount in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public float Discount
        {
            get
            {
                return this._Discount;
            }
            set
            {
                this.OnDiscountChanging(value);
                this.ReportPropertyChanging("Discount");
                this._Discount = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("Discount");
                this.OnDiscountChanged();
            }
        }
        private float _Discount;
        partial void OnDiscountChanging(float value);
        partial void OnDiscountChanged();
        /// <summary>
        /// There are no comments for Orders in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public Orders Orders
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// There are no comments for Orders in the schema.
        /// </summary>
        [global::System.ComponentModel.BrowsableAttribute(false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders", value);
                }
            }
        }
        /// <summary>
        /// There are no comments for Products in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public Products Products
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value;
            }
            set
            {
                ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value = value;
            }
        }
        /// <summary>
        /// There are no comments for Products in the schema.
        /// </summary>
        [global::System.ComponentModel.BrowsableAttribute(false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityReference<Products> ProductsReference
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products", value);
                }
            }
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.Orders in the schema.
    /// </summary>
    /// <KeyProperties>
    /// OrderID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Orders")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class Orders : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new Orders object.
        /// </summary>
        /// <param name="orderID">Initial value of OrderID.</param>
        public static Orders CreateOrders(long orderID)
        {
            Orders orders = new Orders();
            orders.OrderID = orderID;
            return orders;
        }
        /// <summary>
        /// There are no comments for Property OrderID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long OrderID
        {
            get
            {
                return this._OrderID;
            }
            set
            {
                this.OnOrderIDChanging(value);
                this.ReportPropertyChanging("OrderID");
                this._OrderID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("OrderID");
                this.OnOrderIDChanged();
            }
        }
        private long _OrderID;
        partial void OnOrderIDChanging(long value);
        partial void OnOrderIDChanged();
        /// <summary>
        /// There are no comments for Property EmployeeID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<long> EmployeeID
        {
            get
            {
                return this._EmployeeID;
            }
            set
            {
                this.OnEmployeeIDChanging(value);
                this.ReportPropertyChanging("EmployeeID");
                this._EmployeeID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("EmployeeID");
                this.OnEmployeeIDChanged();
            }
        }
        private global::System.Nullable<long> _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Nullable<long> value);
        partial void OnEmployeeIDChanged();
        /// <summary>
        /// There are no comments for Property OrderDate in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<global::System.DateTime> OrderDate
        {
            get
            {
                return this._OrderDate;
            }
            set
            {
                this.OnOrderDateChanging(value);
                this.ReportPropertyChanging("OrderDate");
                this._OrderDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("OrderDate");
                this.OnOrderDateChanged();
            }
        }
        private global::System.Nullable<global::System.DateTime> _OrderDate;
        partial void OnOrderDateChanging(global::System.Nullable<global::System.DateTime> value);
        partial void OnOrderDateChanged();
        /// <summary>
        /// There are no comments for Property RequiredDate in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<global::System.DateTime> RequiredDate
        {
            get
            {
                return this._RequiredDate;
            }
            set
            {
                this.OnRequiredDateChanging(value);
                this.ReportPropertyChanging("RequiredDate");
                this._RequiredDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("RequiredDate");
                this.OnRequiredDateChanged();
            }
        }
        private global::System.Nullable<global::System.DateTime> _RequiredDate;
        partial void OnRequiredDateChanging(global::System.Nullable<global::System.DateTime> value);
        partial void OnRequiredDateChanged();
        /// <summary>
        /// There are no comments for Property ShippedDate in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<global::System.DateTime> ShippedDate
        {
            get
            {
                return this._ShippedDate;
            }
            set
            {
                this.OnShippedDateChanging(value);
                this.ReportPropertyChanging("ShippedDate");
                this._ShippedDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("ShippedDate");
                this.OnShippedDateChanged();
            }
        }
        private global::System.Nullable<global::System.DateTime> _ShippedDate;
        partial void OnShippedDateChanging(global::System.Nullable<global::System.DateTime> value);
        partial void OnShippedDateChanged();
        /// <summary>
        /// There are no comments for Property Freight in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<decimal> Freight
        {
            get
            {
                return this._Freight;
            }
            set
            {
                this.OnFreightChanging(value);
                this.ReportPropertyChanging("Freight");
                this._Freight = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("Freight");
                this.OnFreightChanged();
            }
        }
        private global::System.Nullable<decimal> _Freight;
        partial void OnFreightChanging(global::System.Nullable<decimal> value);
        partial void OnFreightChanged();
        /// <summary>
        /// There are no comments for Property ShipName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ShipName
        {
            get
            {
                return this._ShipName;
            }
            set
            {
                this.OnShipNameChanging(value);
                this.ReportPropertyChanging("ShipName");
                this._ShipName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ShipName");
                this.OnShipNameChanged();
            }
        }
        private string _ShipName;
        partial void OnShipNameChanging(string value);
        partial void OnShipNameChanged();
        /// <summary>
        /// There are no comments for Property ShipAddress in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ShipAddress
        {
            get
            {
                return this._ShipAddress;
            }
            set
            {
                this.OnShipAddressChanging(value);
                this.ReportPropertyChanging("ShipAddress");
                this._ShipAddress = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ShipAddress");
                this.OnShipAddressChanged();
            }
        }
        private string _ShipAddress;
        partial void OnShipAddressChanging(string value);
        partial void OnShipAddressChanged();
        /// <summary>
        /// There are no comments for Property ShipCity in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ShipCity
        {
            get
            {
                return this._ShipCity;
            }
            set
            {
                this.OnShipCityChanging(value);
                this.ReportPropertyChanging("ShipCity");
                this._ShipCity = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ShipCity");
                this.OnShipCityChanged();
            }
        }
        private string _ShipCity;
        partial void OnShipCityChanging(string value);
        partial void OnShipCityChanged();
        /// <summary>
        /// There are no comments for Property ShipRegion in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ShipRegion
        {
            get
            {
                return this._ShipRegion;
            }
            set
            {
                this.OnShipRegionChanging(value);
                this.ReportPropertyChanging("ShipRegion");
                this._ShipRegion = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ShipRegion");
                this.OnShipRegionChanged();
            }
        }
        private string _ShipRegion;
        partial void OnShipRegionChanging(string value);
        partial void OnShipRegionChanged();
        /// <summary>
        /// There are no comments for Property ShipPostalCode in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ShipPostalCode
        {
            get
            {
                return this._ShipPostalCode;
            }
            set
            {
                this.OnShipPostalCodeChanging(value);
                this.ReportPropertyChanging("ShipPostalCode");
                this._ShipPostalCode = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ShipPostalCode");
                this.OnShipPostalCodeChanged();
            }
        }
        private string _ShipPostalCode;
        partial void OnShipPostalCodeChanging(string value);
        partial void OnShipPostalCodeChanged();
        /// <summary>
        /// There are no comments for Property ShipCountry in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ShipCountry
        {
            get
            {
                return this._ShipCountry;
            }
            set
            {
                this.OnShipCountryChanging(value);
                this.ReportPropertyChanging("ShipCountry");
                this._ShipCountry = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ShipCountry");
                this.OnShipCountryChanged();
            }
        }
        private string _ShipCountry;
        partial void OnShipCountryChanging(string value);
        partial void OnShipCountryChanged();
        /// <summary>
        /// There are no comments for Customers in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public Customers Customers
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value;
            }
            set
            {
                ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value = value;
            }
        }
        /// <summary>
        /// There are no comments for Customers in the schema.
        /// </summary>
        [global::System.ComponentModel.BrowsableAttribute(false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityReference<Customers> CustomersReference
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers", value);
                }
            }
        }
        /// <summary>
        /// There are no comments for InternationalOrders in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "InternationalOrders")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public InternationalOrders InternationalOrders
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value;
            }
            set
            {
                ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value = value;
            }
        }
        /// <summary>
        /// There are no comments for InternationalOrders in the schema.
        /// </summary>
        [global::System.ComponentModel.BrowsableAttribute(false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityReference<InternationalOrders> InternationalOrdersReference
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders", value);
                }
            }
        }
        /// <summary>
        /// There are no comments for OrderDetails in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "OrderDetails")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails", value);
                }
            }
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.PreviousEmployees in the schema.
    /// </summary>
    /// <KeyProperties>
    /// EmployeeID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="PreviousEmployees")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class PreviousEmployees : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new PreviousEmployees object.
        /// </summary>
        /// <param name="employeeID">Initial value of EmployeeID.</param>
        /// <param name="lastName">Initial value of LastName.</param>
        /// <param name="firstName">Initial value of FirstName.</param>
        public static PreviousEmployees CreatePreviousEmployees(long employeeID, string lastName, string firstName)
        {
            PreviousEmployees previousEmployees = new PreviousEmployees();
            previousEmployees.EmployeeID = employeeID;
            previousEmployees.LastName = lastName;
            previousEmployees.FirstName = firstName;
            return previousEmployees;
        }
        /// <summary>
        /// There are no comments for Property EmployeeID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long EmployeeID
        {
            get
            {
                return this._EmployeeID;
            }
            set
            {
                this.OnEmployeeIDChanging(value);
                this.ReportPropertyChanging("EmployeeID");
                this._EmployeeID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("EmployeeID");
                this.OnEmployeeIDChanged();
            }
        }
        private long _EmployeeID;
        partial void OnEmployeeIDChanging(long value);
        partial void OnEmployeeIDChanged();
        /// <summary>
        /// There are no comments for Property LastName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string LastName
        {
            get
            {
                return this._LastName;
            }
            set
            {
                this.OnLastNameChanging(value);
                this.ReportPropertyChanging("LastName");
                this._LastName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("LastName");
                this.OnLastNameChanged();
            }
        }
        private string _LastName;
        partial void OnLastNameChanging(string value);
        partial void OnLastNameChanged();
        /// <summary>
        /// There are no comments for Property FirstName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string FirstName
        {
            get
            {
                return this._FirstName;
            }
            set
            {
                this.OnFirstNameChanging(value);
                this.ReportPropertyChanging("FirstName");
                this._FirstName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("FirstName");
                this.OnFirstNameChanged();
            }
        }
        private string _FirstName;
        partial void OnFirstNameChanging(string value);
        partial void OnFirstNameChanged();
        /// <summary>
        /// There are no comments for Property Title in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Title
        {
            get
            {
                return this._Title;
            }
            set
            {
                this.OnTitleChanging(value);
                this.ReportPropertyChanging("Title");
                this._Title = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Title");
                this.OnTitleChanged();
            }
        }
        private string _Title;
        partial void OnTitleChanging(string value);
        partial void OnTitleChanged();
        /// <summary>
        /// There are no comments for Property TitleOfCourtesy in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string TitleOfCourtesy
        {
            get
            {
                return this._TitleOfCourtesy;
            }
            set
            {
                this.OnTitleOfCourtesyChanging(value);
                this.ReportPropertyChanging("TitleOfCourtesy");
                this._TitleOfCourtesy = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("TitleOfCourtesy");
                this.OnTitleOfCourtesyChanged();
            }
        }
        private string _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(string value);
        partial void OnTitleOfCourtesyChanged();
        /// <summary>
        /// There are no comments for Property BirthDate in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return this._BirthDate;
            }
            set
            {
                this.OnBirthDateChanging(value);
                this.ReportPropertyChanging("BirthDate");
                this._BirthDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("BirthDate");
                this.OnBirthDateChanged();
            }
        }
        private global::System.Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(global::System.Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();
        /// <summary>
        /// There are no comments for Property HireDate in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return this._HireDate;
            }
            set
            {
                this.OnHireDateChanging(value);
                this.ReportPropertyChanging("HireDate");
                this._HireDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("HireDate");
                this.OnHireDateChanged();
            }
        }
        private global::System.Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(global::System.Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();
        /// <summary>
        /// There are no comments for Property Address in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Address
        {
            get
            {
                return this._Address;
            }
            set
            {
                this.OnAddressChanging(value);
                this.ReportPropertyChanging("Address");
                this._Address = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Address");
                this.OnAddressChanged();
            }
        }
        private string _Address;
        partial void OnAddressChanging(string value);
        partial void OnAddressChanged();
        /// <summary>
        /// There are no comments for Property City in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string City
        {
            get
            {
                return this._City;
            }
            set
            {
                this.OnCityChanging(value);
                this.ReportPropertyChanging("City");
                this._City = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("City");
                this.OnCityChanged();
            }
        }
        private string _City;
        partial void OnCityChanging(string value);
        partial void OnCityChanged();
        /// <summary>
        /// There are no comments for Property Region in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Region
        {
            get
            {
                return this._Region;
            }
            set
            {
                this.OnRegionChanging(value);
                this.ReportPropertyChanging("Region");
                this._Region = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Region");
                this.OnRegionChanged();
            }
        }
        private string _Region;
        partial void OnRegionChanging(string value);
        partial void OnRegionChanged();
        /// <summary>
        /// There are no comments for Property PostalCode in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string PostalCode
        {
            get
            {
                return this._PostalCode;
            }
            set
            {
                this.OnPostalCodeChanging(value);
                this.ReportPropertyChanging("PostalCode");
                this._PostalCode = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("PostalCode");
                this.OnPostalCodeChanged();
            }
        }
        private string _PostalCode;
        partial void OnPostalCodeChanging(string value);
        partial void OnPostalCodeChanged();
        /// <summary>
        /// There are no comments for Property Country in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Country
        {
            get
            {
                return this._Country;
            }
            set
            {
                this.OnCountryChanging(value);
                this.ReportPropertyChanging("Country");
                this._Country = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Country");
                this.OnCountryChanged();
            }
        }
        private string _Country;
        partial void OnCountryChanging(string value);
        partial void OnCountryChanged();
        /// <summary>
        /// There are no comments for Property HomePhone in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string HomePhone
        {
            get
            {
                return this._HomePhone;
            }
            set
            {
                this.OnHomePhoneChanging(value);
                this.ReportPropertyChanging("HomePhone");
                this._HomePhone = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("HomePhone");
                this.OnHomePhoneChanged();
            }
        }
        private string _HomePhone;
        partial void OnHomePhoneChanging(string value);
        partial void OnHomePhoneChanged();
        /// <summary>
        /// There are no comments for Property Extension in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Extension
        {
            get
            {
                return this._Extension;
            }
            set
            {
                this.OnExtensionChanging(value);
                this.ReportPropertyChanging("Extension");
                this._Extension = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Extension");
                this.OnExtensionChanged();
            }
        }
        private string _Extension;
        partial void OnExtensionChanging(string value);
        partial void OnExtensionChanged();
        /// <summary>
        /// There are no comments for Property Photo in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public byte[] Photo
        {
            get
            {
                return global::System.Data.Objects.DataClasses.StructuralObject.GetValidValue(this._Photo);
            }
            set
            {
                this.OnPhotoChanging(value);
                this.ReportPropertyChanging("Photo");
                this._Photo = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Photo");
                this.OnPhotoChanged();
            }
        }
        private byte[] _Photo;
        partial void OnPhotoChanging(byte[] value);
        partial void OnPhotoChanged();
        /// <summary>
        /// There are no comments for Property Notes in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Notes
        {
            get
            {
                return this._Notes;
            }
            set
            {
                this.OnNotesChanging(value);
                this.ReportPropertyChanging("Notes");
                this._Notes = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Notes");
                this.OnNotesChanged();
            }
        }
        private string _Notes;
        partial void OnNotesChanging(string value);
        partial void OnNotesChanged();
        /// <summary>
        /// There are no comments for Property PhotoPath in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string PhotoPath
        {
            get
            {
                return this._PhotoPath;
            }
            set
            {
                this.OnPhotoPathChanging(value);
                this.ReportPropertyChanging("PhotoPath");
                this._PhotoPath = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("PhotoPath");
                this.OnPhotoPathChanged();
            }
        }
        private string _PhotoPath;
        partial void OnPhotoPathChanging(string value);
        partial void OnPhotoPathChanged();
    }
    /// <summary>
    /// There are no comments for northwindEFModel.Products in the schema.
    /// </summary>
    /// <KeyProperties>
    /// ProductID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Products")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class Products : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new Products object.
        /// </summary>
        /// <param name="productID">Initial value of ProductID.</param>
        /// <param name="productName">Initial value of ProductName.</param>
        /// <param name="discontinued">Initial value of Discontinued.</param>
        public static Products CreateProducts(long productID, string productName, bool discontinued)
        {
            Products products = new Products();
            products.ProductID = productID;
            products.ProductName = productName;
            products.Discontinued = discontinued;
            return products;
        }
        /// <summary>
        /// There are no comments for Property ProductID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long ProductID
        {
            get
            {
                return this._ProductID;
            }
            set
            {
                this.OnProductIDChanging(value);
                this.ReportPropertyChanging("ProductID");
                this._ProductID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("ProductID");
                this.OnProductIDChanged();
            }
        }
        private long _ProductID;
        partial void OnProductIDChanging(long value);
        partial void OnProductIDChanged();
        /// <summary>
        /// There are no comments for Property ProductName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ProductName
        {
            get
            {
                return this._ProductName;
            }
            set
            {
                this.OnProductNameChanging(value);
                this.ReportPropertyChanging("ProductName");
                this._ProductName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("ProductName");
                this.OnProductNameChanged();
            }
        }
        private string _ProductName;
        partial void OnProductNameChanging(string value);
        partial void OnProductNameChanged();
        /// <summary>
        /// There are no comments for Property QuantityPerUnit in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string QuantityPerUnit
        {
            get
            {
                return this._QuantityPerUnit;
            }
            set
            {
                this.OnQuantityPerUnitChanging(value);
                this.ReportPropertyChanging("QuantityPerUnit");
                this._QuantityPerUnit = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("QuantityPerUnit");
                this.OnQuantityPerUnitChanged();
            }
        }
        private string _QuantityPerUnit;
        partial void OnQuantityPerUnitChanging(string value);
        partial void OnQuantityPerUnitChanged();
        /// <summary>
        /// There are no comments for Property UnitPrice in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<decimal> UnitPrice
        {
            get
            {
                return this._UnitPrice;
            }
            set
            {
                this.OnUnitPriceChanging(value);
                this.ReportPropertyChanging("UnitPrice");
                this._UnitPrice = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("UnitPrice");
                this.OnUnitPriceChanged();
            }
        }
        private global::System.Nullable<decimal> _UnitPrice;
        partial void OnUnitPriceChanging(global::System.Nullable<decimal> value);
        partial void OnUnitPriceChanged();
        /// <summary>
        /// There are no comments for Property UnitsInStock in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<short> UnitsInStock
        {
            get
            {
                return this._UnitsInStock;
            }
            set
            {
                this.OnUnitsInStockChanging(value);
                this.ReportPropertyChanging("UnitsInStock");
                this._UnitsInStock = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("UnitsInStock");
                this.OnUnitsInStockChanged();
            }
        }
        private global::System.Nullable<short> _UnitsInStock;
        partial void OnUnitsInStockChanging(global::System.Nullable<short> value);
        partial void OnUnitsInStockChanged();
        /// <summary>
        /// There are no comments for Property UnitsOnOrder in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<short> UnitsOnOrder
        {
            get
            {
                return this._UnitsOnOrder;
            }
            set
            {
                this.OnUnitsOnOrderChanging(value);
                this.ReportPropertyChanging("UnitsOnOrder");
                this._UnitsOnOrder = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("UnitsOnOrder");
                this.OnUnitsOnOrderChanged();
            }
        }
        private global::System.Nullable<short> _UnitsOnOrder;
        partial void OnUnitsOnOrderChanging(global::System.Nullable<short> value);
        partial void OnUnitsOnOrderChanged();
        /// <summary>
        /// There are no comments for Property ReorderLevel in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<short> ReorderLevel
        {
            get
            {
                return this._ReorderLevel;
            }
            set
            {
                this.OnReorderLevelChanging(value);
                this.ReportPropertyChanging("ReorderLevel");
                this._ReorderLevel = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("ReorderLevel");
                this.OnReorderLevelChanged();
            }
        }
        private global::System.Nullable<short> _ReorderLevel;
        partial void OnReorderLevelChanging(global::System.Nullable<short> value);
        partial void OnReorderLevelChanged();
        /// <summary>
        /// There are no comments for Property Discontinued in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public bool Discontinued
        {
            get
            {
                return this._Discontinued;
            }
            set
            {
                this.OnDiscontinuedChanging(value);
                this.ReportPropertyChanging("Discontinued");
                this._Discontinued = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("Discontinued");
                this.OnDiscontinuedChanged();
            }
        }
        private bool _Discontinued;
        partial void OnDiscontinuedChanging(bool value);
        partial void OnDiscontinuedChanged();
        /// <summary>
        /// There are no comments for Property DiscontinuedDate in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Nullable<global::System.DateTime> DiscontinuedDate
        {
            get
            {
                return this._DiscontinuedDate;
            }
            set
            {
                this.OnDiscontinuedDateChanging(value);
                this.ReportPropertyChanging("DiscontinuedDate");
                this._DiscontinuedDate = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("DiscontinuedDate");
                this.OnDiscontinuedDateChanged();
            }
        }
        private global::System.Nullable<global::System.DateTime> _DiscontinuedDate;
        partial void OnDiscontinuedDateChanging(global::System.Nullable<global::System.DateTime> value);
        partial void OnDiscontinuedDateChanged();
        /// <summary>
        /// There are no comments for Categories in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public Categories Categories
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value;
            }
            set
            {
                ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value = value;
            }
        }
        /// <summary>
        /// There are no comments for Categories in the schema.
        /// </summary>
        [global::System.ComponentModel.BrowsableAttribute(false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityReference<Categories> CategoriesReference
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories", value);
                }
            }
        }
        /// <summary>
        /// There are no comments for OrderDetails in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "OrderDetails")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails", value);
                }
            }
        }
        /// <summary>
        /// There are no comments for Suppliers in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public Suppliers Suppliers
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value;
            }
            set
            {
                ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value = value;
            }
        }
        /// <summary>
        /// There are no comments for Suppliers in the schema.
        /// </summary>
        [global::System.ComponentModel.BrowsableAttribute(false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityReference<Suppliers> SuppliersReference
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers", value);
                }
            }
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.Regions in the schema.
    /// </summary>
    /// <KeyProperties>
    /// RegionID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Regions")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class Regions : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new Regions object.
        /// </summary>
        /// <param name="regionID">Initial value of RegionID.</param>
        /// <param name="regionDescription">Initial value of RegionDescription.</param>
        public static Regions CreateRegions(long regionID, string regionDescription)
        {
            Regions regions = new Regions();
            regions.RegionID = regionID;
            regions.RegionDescription = regionDescription;
            return regions;
        }
        /// <summary>
        /// There are no comments for Property RegionID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long RegionID
        {
            get
            {
                return this._RegionID;
            }
            set
            {
                this.OnRegionIDChanging(value);
                this.ReportPropertyChanging("RegionID");
                this._RegionID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("RegionID");
                this.OnRegionIDChanged();
            }
        }
        private long _RegionID;
        partial void OnRegionIDChanging(long value);
        partial void OnRegionIDChanged();
        /// <summary>
        /// There are no comments for Property RegionDescription in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string RegionDescription
        {
            get
            {
                return this._RegionDescription;
            }
            set
            {
                this.OnRegionDescriptionChanging(value);
                this.ReportPropertyChanging("RegionDescription");
                this._RegionDescription = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("RegionDescription");
                this.OnRegionDescriptionChanged();
            }
        }
        private string _RegionDescription;
        partial void OnRegionDescriptionChanging(string value);
        partial void OnRegionDescriptionChanged();
        /// <summary>
        /// There are no comments for Territories in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Territories")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityCollection<Territories> Territories
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories", value);
                }
            }
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.Suppliers in the schema.
    /// </summary>
    /// <KeyProperties>
    /// SupplierID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Suppliers")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class Suppliers : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new Suppliers object.
        /// </summary>
        /// <param name="supplierID">Initial value of SupplierID.</param>
        /// <param name="companyName">Initial value of CompanyName.</param>
        public static Suppliers CreateSuppliers(long supplierID, string companyName)
        {
            Suppliers suppliers = new Suppliers();
            suppliers.SupplierID = supplierID;
            suppliers.CompanyName = companyName;
            return suppliers;
        }
        /// <summary>
        /// There are no comments for Property SupplierID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long SupplierID
        {
            get
            {
                return this._SupplierID;
            }
            set
            {
                this.OnSupplierIDChanging(value);
                this.ReportPropertyChanging("SupplierID");
                this._SupplierID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("SupplierID");
                this.OnSupplierIDChanged();
            }
        }
        private long _SupplierID;
        partial void OnSupplierIDChanging(long value);
        partial void OnSupplierIDChanged();
        /// <summary>
        /// There are no comments for Property CompanyName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string CompanyName
        {
            get
            {
                return this._CompanyName;
            }
            set
            {
                this.OnCompanyNameChanging(value);
                this.ReportPropertyChanging("CompanyName");
                this._CompanyName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("CompanyName");
                this.OnCompanyNameChanged();
            }
        }
        private string _CompanyName;
        partial void OnCompanyNameChanging(string value);
        partial void OnCompanyNameChanged();
        /// <summary>
        /// There are no comments for Property ContactName in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ContactName
        {
            get
            {
                return this._ContactName;
            }
            set
            {
                this.OnContactNameChanging(value);
                this.ReportPropertyChanging("ContactName");
                this._ContactName = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ContactName");
                this.OnContactNameChanged();
            }
        }
        private string _ContactName;
        partial void OnContactNameChanging(string value);
        partial void OnContactNameChanged();
        /// <summary>
        /// There are no comments for Property ContactTitle in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string ContactTitle
        {
            get
            {
                return this._ContactTitle;
            }
            set
            {
                this.OnContactTitleChanging(value);
                this.ReportPropertyChanging("ContactTitle");
                this._ContactTitle = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("ContactTitle");
                this.OnContactTitleChanged();
            }
        }
        private string _ContactTitle;
        partial void OnContactTitleChanging(string value);
        partial void OnContactTitleChanged();
        /// <summary>
        /// There are no comments for Property Address in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Address
        {
            get
            {
                return this._Address;
            }
            set
            {
                this.OnAddressChanging(value);
                this.ReportPropertyChanging("Address");
                this._Address = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Address");
                this.OnAddressChanged();
            }
        }
        private string _Address;
        partial void OnAddressChanging(string value);
        partial void OnAddressChanged();
        /// <summary>
        /// There are no comments for Property City in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string City
        {
            get
            {
                return this._City;
            }
            set
            {
                this.OnCityChanging(value);
                this.ReportPropertyChanging("City");
                this._City = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("City");
                this.OnCityChanged();
            }
        }
        private string _City;
        partial void OnCityChanging(string value);
        partial void OnCityChanged();
        /// <summary>
        /// There are no comments for Property Region in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Region
        {
            get
            {
                return this._Region;
            }
            set
            {
                this.OnRegionChanging(value);
                this.ReportPropertyChanging("Region");
                this._Region = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Region");
                this.OnRegionChanged();
            }
        }
        private string _Region;
        partial void OnRegionChanging(string value);
        partial void OnRegionChanged();
        /// <summary>
        /// There are no comments for Property PostalCode in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string PostalCode
        {
            get
            {
                return this._PostalCode;
            }
            set
            {
                this.OnPostalCodeChanging(value);
                this.ReportPropertyChanging("PostalCode");
                this._PostalCode = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("PostalCode");
                this.OnPostalCodeChanged();
            }
        }
        private string _PostalCode;
        partial void OnPostalCodeChanging(string value);
        partial void OnPostalCodeChanged();
        /// <summary>
        /// There are no comments for Property Country in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Country
        {
            get
            {
                return this._Country;
            }
            set
            {
                this.OnCountryChanging(value);
                this.ReportPropertyChanging("Country");
                this._Country = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Country");
                this.OnCountryChanged();
            }
        }
        private string _Country;
        partial void OnCountryChanging(string value);
        partial void OnCountryChanged();
        /// <summary>
        /// There are no comments for Property Phone in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Phone
        {
            get
            {
                return this._Phone;
            }
            set
            {
                this.OnPhoneChanging(value);
                this.ReportPropertyChanging("Phone");
                this._Phone = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Phone");
                this.OnPhoneChanged();
            }
        }
        private string _Phone;
        partial void OnPhoneChanging(string value);
        partial void OnPhoneChanged();
        /// <summary>
        /// There are no comments for Property Fax in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string Fax
        {
            get
            {
                return this._Fax;
            }
            set
            {
                this.OnFaxChanging(value);
                this.ReportPropertyChanging("Fax");
                this._Fax = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("Fax");
                this.OnFaxChanged();
            }
        }
        private string _Fax;
        partial void OnFaxChanging(string value);
        partial void OnFaxChanged();
        /// <summary>
        /// There are no comments for Property HomePage in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string HomePage
        {
            get
            {
                return this._HomePage;
            }
            set
            {
                this.OnHomePageChanging(value);
                this.ReportPropertyChanging("HomePage");
                this._HomePage = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, true);
                this.ReportPropertyChanged("HomePage");
                this.OnHomePageChanged();
            }
        }
        private string _HomePage;
        partial void OnHomePageChanging(string value);
        partial void OnHomePageChanged();
        /// <summary>
        /// There are no comments for Products in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Products")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityCollection<Products> Products
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products", value);
                }
            }
        }
    }
    /// <summary>
    /// There are no comments for northwindEFModel.Territories in the schema.
    /// </summary>
    /// <KeyProperties>
    /// TerritoryID
    /// </KeyProperties>
    [global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Territories")]
    [global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
    [global::System.Serializable()]
    public partial class Territories : global::System.Data.Objects.DataClasses.EntityObject
    {
        /// <summary>
        /// Create a new Territories object.
        /// </summary>
        /// <param name="territoryID">Initial value of TerritoryID.</param>
        /// <param name="territoryDescription">Initial value of TerritoryDescription.</param>
        public static Territories CreateTerritories(long territoryID, string territoryDescription)
        {
            Territories territories = new Territories();
            territories.TerritoryID = territoryID;
            territories.TerritoryDescription = territoryDescription;
            return territories;
        }
        /// <summary>
        /// There are no comments for Property TerritoryID in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public long TerritoryID
        {
            get
            {
                return this._TerritoryID;
            }
            set
            {
                this.OnTerritoryIDChanging(value);
                this.ReportPropertyChanging("TerritoryID");
                this._TerritoryID = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value);
                this.ReportPropertyChanged("TerritoryID");
                this.OnTerritoryIDChanged();
            }
        }
        private long _TerritoryID;
        partial void OnTerritoryIDChanging(long value);
        partial void OnTerritoryIDChanged();
        /// <summary>
        /// There are no comments for Property TerritoryDescription in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable=false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public string TerritoryDescription
        {
            get
            {
                return this._TerritoryDescription;
            }
            set
            {
                this.OnTerritoryDescriptionChanging(value);
                this.ReportPropertyChanging("TerritoryDescription");
                this._TerritoryDescription = global::System.Data.Objects.DataClasses.StructuralObject.SetValidValue(value, false);
                this.ReportPropertyChanged("TerritoryDescription");
                this.OnTerritoryDescriptionChanged();
            }
        }
        private string _TerritoryDescription;
        partial void OnTerritoryDescriptionChanging(string value);
        partial void OnTerritoryDescriptionChanged();
        /// <summary>
        /// There are no comments for Regions in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public Regions Regions
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value;
            }
            set
            {
                ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value = value;
            }
        }
        /// <summary>
        /// There are no comments for Regions in the schema.
        /// </summary>
        [global::System.ComponentModel.BrowsableAttribute(false)]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityReference<Regions> RegionsReference
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions", value);
                }
            }
        }
        /// <summary>
        /// There are no comments for Employees in the schema.
        /// </summary>
        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Employees")]
        [global::System.Xml.Serialization.XmlIgnoreAttribute()]
        [global::System.Xml.Serialization.SoapIgnoreAttribute()]
        [global::System.Runtime.Serialization.DataMemberAttribute()]
        public global::System.Data.Objects.DataClasses.EntityCollection<Employees> Employees
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees", value);
                }
            }
        }
    }
}

Added testlinq/NorthwindModel.Linq.2008.edmx.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
    <Schema Namespace="northwindEFModel.Store" Alias="Self" Provider="System.Data.SQLite.Linq" ProviderManifestToken="ISO8601" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl">
        <EntityContainer Name="northwindEFModelStoreContainer">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Store.Categories" store:Type="Tables" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Store.Customers" store:Type="Tables" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Store.Employees" store:Type="Tables" />
          <EntitySet Name="EmployeesTerritories" EntityType="northwindEFModel.Store.EmployeesTerritories" store:Type="Tables" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.Store.InternationalOrders" store:Type="Tables" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.Store.OrderDetails" store:Type="Tables" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Store.Orders" store:Type="Tables" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.Store.PreviousEmployees" store:Type="Tables" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Store.Products" store:Type="Tables" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Store.Regions" store:Type="Tables" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Store.Suppliers" store:Type="Tables" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Store.Territories" store:Type="Tables" />
          <AssociationSet Name="FK_EmployeesTerritories_EmployeeID_EmployeeID" Association="northwindEFModel.Store.FK_EmployeesTerritories_EmployeeID_EmployeeID">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_EmployeesTerritories_TerritoryID_TerritoryID" Association="northwindEFModel.Store.FK_EmployeesTerritories_TerritoryID_TerritoryID">
            <End Role="Territories" EntitySet="Territories" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.Store.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.Store.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.Store.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.Store.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.Store.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.Store.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.Store.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
        </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CategoryName" Type="nvarchar" Nullable="false" MaxLength="15" />
          <Property Name="Description" Type="nvarchar" />
          <Property Name="Picture" Type="blob" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="nvarchar" Nullable="false" MaxLength="5" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="EmployeesTerritories">
          <Key>
            <PropertyRef Name="EmployeeID" />
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="CustomsDescription" Type="nvarchar" Nullable="false" MaxLength="100" />
          <Property Name="ExciseTax" Type="decimal" Nullable="false" Precision="53" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="ProductID" Type="integer" Nullable="false" />
          <Property Name="UnitPrice" Type="decimal" Nullable="false" Precision="53" />
          <Property Name="Quantity" Type="smallint" Nullable="false" />
          <!--
              NOTE: The "Discount" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbInsertCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Discount" Type="real" Nullable="false" StoreGeneratedPattern="Computed" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CustomerID" Type="nvarchar" MaxLength="5" />
          <Property Name="EmployeeID" Type="integer" />
          <Property Name="OrderDate" Type="datetime" />
          <Property Name="RequiredDate" Type="datetime" />
          <Property Name="ShippedDate" Type="datetime" />
          <!--
              NOTE: The "Freight" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbUpdateCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Freight" Type="decimal" Precision="53" StoreGeneratedPattern="Computed" />
          <Property Name="ShipName" Type="nvarchar" MaxLength="40" />
          <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" />
          <Property Name="ShipCity" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="ProductName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="SupplierID" Type="integer" />
          <Property Name="CategoryID" Type="integer" />
          <Property Name="QuantityPerUnit" Type="nvarchar" MaxLength="20" />
          <Property Name="UnitPrice" Type="decimal" Precision="53" />
          <Property Name="UnitsInStock" Type="smallint" />
          <Property Name="UnitsOnOrder" Type="smallint" />
          <Property Name="ReorderLevel" Type="smallint" />
          <Property Name="Discontinued" Type="bit" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="datetime" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="integer" Nullable="false" />
          <Property Name="RegionDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
          <Property Name="HomePage" Type="nvarchar" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
          <Property Name="TerritoryDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
          <Property Name="RegionID" Type="integer" Nullable="false" />
        </EntityType>
        <Association Name="FK_EmployeesTerritories_EmployeeID_EmployeeID">
          <End Role="Employees" Type="northwindEFModel.Store.Employees" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Employees">
              <PropertyRef Name="EmployeeID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="EmployeeID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_EmployeesTerritories_TerritoryID_TerritoryID">
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Territories">
              <PropertyRef Name="TerritoryID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="TerritoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.Store.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Store.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Customers">
              <PropertyRef Name="CustomerID" />
            </Principal>
            <Dependent Role="Orders">
              <PropertyRef Name="CustomerID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Store.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Categories">
              <PropertyRef Name="CategoryID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="CategoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Store.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Suppliers">
              <PropertyRef Name="SupplierID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="SupplierID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Store.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Regions">
              <PropertyRef Name="RegionID" />
            </Principal>
            <Dependent Role="Territories">
              <PropertyRef Name="RegionID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
      </Schema></edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="northwindEFModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2006/04/edm">
        <EntityContainer Name="northwindEFEntities">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Categories" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Customers" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Employees" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.InternationalOrders" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.OrderDetails" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Orders" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.PreviousEmployees" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Products" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Regions" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Suppliers" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Territories" />
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          <AssociationSet Name="EmployeesTerritories" Association="northwindEFModel.EmployeesTerritories">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="Int64" Nullable="false" />
          <Property Name="CategoryName" Type="String" Nullable="false" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Description" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="Picture" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Categories" ToRole="Products" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="String" Nullable="false" MaxLength="5" Unicode="true" FixedLength="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Customers" ToRole="Orders" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Employees" ToRole="Territories" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="CustomsDescription" Type="String" Nullable="false" MaxLength="100" Unicode="true" FixedLength="false" />
          <Property Name="ExciseTax" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="InternationalOrders" ToRole="Orders" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="UnitPrice" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <Property Name="Quantity" Type="Int16" Nullable="false" />
          <Property Name="Discount" Type="Single" Nullable="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="OrderDetails" ToRole="Orders" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="OrderDetails" ToRole="Products" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="EmployeeID" Type="Int64" />
          <Property Name="OrderDate" Type="DateTime" />
          <Property Name="RequiredDate" Type="DateTime" />
          <Property Name="ShippedDate" Type="DateTime" />
          <Property Name="Freight" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="ShipName" Type="String" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ShipAddress" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="ShipCity" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipRegion" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipPostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="ShipCountry" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Customers" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Orders" ToRole="Customers" />
          <NavigationProperty Name="InternationalOrders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="Orders" ToRole="InternationalOrders" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="Orders" ToRole="OrderDetails" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="ProductName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="QuantityPerUnit" Type="String" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="UnitPrice" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="UnitsInStock" Type="Int16" />
          <Property Name="UnitsOnOrder" Type="Int16" />
          <Property Name="ReorderLevel" Type="Int16" />
          <Property Name="Discontinued" Type="Boolean" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="DateTime" />
          <NavigationProperty Name="Categories" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Products" ToRole="Categories" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="Products" ToRole="OrderDetails" />
          <NavigationProperty Name="Suppliers" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Products" ToRole="Suppliers" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="Int64" Nullable="false" />
          <Property Name="RegionDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Regions" ToRole="Territories" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="Int64" Nullable="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="HomePage" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Suppliers" ToRole="Products" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="Int64" Nullable="false" />
          <Property Name="TerritoryDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Regions" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Territories" ToRole="Regions" />
          <NavigationProperty Name="Employees" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Territories" ToRole="Employees" />
        </EntityType>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="*" />
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        <Association Name="EmployeesTerritories">
          <End Role="Employees" Type="northwindEFModel.Employees" Multiplicity="*" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        </Schema>
    </edmx:ConceptualModels>
    <!-- C-S mapping content -->
    <edmx:Mappings>
      <Mapping Space="C-S" xmlns="urn:schemas-microsoft-com:windows:storage:mapping:CS">
        <EntityContainerMapping StorageEntityContainer="northwindEFModelStoreContainer" CdmEntityContainer="northwindEFEntities">
          <EntitySetMapping Name="Categories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Categories)">
              <MappingFragment StoreEntitySet="Categories">
                <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
                <ScalarProperty Name="CategoryName" ColumnName="CategoryName" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="Picture" ColumnName="Picture" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Customers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Customers)">
              <MappingFragment StoreEntitySet="Customers">
                <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Employees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Employees)">
              <MappingFragment StoreEntitySet="Employees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="InternationalOrders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.InternationalOrders)">
              <MappingFragment StoreEntitySet="InternationalOrders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="CustomsDescription" ColumnName="CustomsDescription" />
                <ScalarProperty Name="ExciseTax" ColumnName="ExciseTax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="OrderDetails">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.OrderDetails)">
              <MappingFragment StoreEntitySet="OrderDetails">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="Quantity" ColumnName="Quantity" />
                <ScalarProperty Name="Discount" ColumnName="Discount" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Orders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Orders)">
              <MappingFragment StoreEntitySet="Orders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="OrderDate" ColumnName="OrderDate" />
                <ScalarProperty Name="RequiredDate" ColumnName="RequiredDate" />
                <ScalarProperty Name="ShippedDate" ColumnName="ShippedDate" />
                <ScalarProperty Name="Freight" ColumnName="Freight" />
                <ScalarProperty Name="ShipName" ColumnName="ShipName" />
                <ScalarProperty Name="ShipAddress" ColumnName="ShipAddress" />
                <ScalarProperty Name="ShipCity" ColumnName="ShipCity" />
                <ScalarProperty Name="ShipRegion" ColumnName="ShipRegion" />
                <ScalarProperty Name="ShipPostalCode" ColumnName="ShipPostalCode" />
                <ScalarProperty Name="ShipCountry" ColumnName="ShipCountry" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="PreviousEmployees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.PreviousEmployees)">
              <MappingFragment StoreEntitySet="PreviousEmployees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Products">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Products)">
              <MappingFragment StoreEntitySet="Products">
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="ProductName" ColumnName="ProductName" />
                <ScalarProperty Name="QuantityPerUnit" ColumnName="QuantityPerUnit" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="UnitsInStock" ColumnName="UnitsInStock" />
                <ScalarProperty Name="UnitsOnOrder" ColumnName="UnitsOnOrder" />
                <ScalarProperty Name="ReorderLevel" ColumnName="ReorderLevel" />
                <ScalarProperty Name="Discontinued" ColumnName="Discontinued" />
                <ScalarProperty Name="DiscontinuedDate" ColumnName="DiscontinuedDate" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Regions">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Regions)">
              <MappingFragment StoreEntitySet="Regions">
                <ScalarProperty Name="RegionID" ColumnName="RegionID" />
                <ScalarProperty Name="RegionDescription" ColumnName="RegionDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Suppliers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Suppliers)">
              <MappingFragment StoreEntitySet="Suppliers">
                <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
                <ScalarProperty Name="HomePage" ColumnName="HomePage" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Territories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Territories)">
              <MappingFragment StoreEntitySet="Territories">
                <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
                <ScalarProperty Name="TerritoryDescription" ColumnName="TerritoryDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <AssociationSetMapping Name="FK_Products_CategoryID_CategoryID" TypeName="northwindEFModel.FK_Products_CategoryID_CategoryID" StoreEntitySet="Products">
            <EndProperty Name="Categories">
              <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="CategoryID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Orders_CustomerID_CustomerID" TypeName="northwindEFModel.FK_Orders_CustomerID_CustomerID" StoreEntitySet="Orders">
            <EndProperty Name="Customers">
              <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
            </EndProperty>
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <Condition ColumnName="CustomerID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_InternationalOrders_OrderID_OrderID" TypeName="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" StoreEntitySet="InternationalOrders">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="InternationalOrders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_OrderID_OrderID" TypeName="northwindEFModel.FK_OrderDetails_OrderID_OrderID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_ProductID_ProductID" TypeName="northwindEFModel.FK_OrderDetails_ProductID_ProductID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Products_SupplierID_SupplierID" TypeName="northwindEFModel.FK_Products_SupplierID_SupplierID" StoreEntitySet="Products">
            <EndProperty Name="Suppliers">
              <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="SupplierID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Territories_RegionID_RegionID" TypeName="northwindEFModel.FK_Territories_RegionID_RegionID" StoreEntitySet="Territories">
            <EndProperty Name="Regions">
              <ScalarProperty Name="RegionID" ColumnName="RegionID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="EmployeesTerritories" TypeName="northwindEFModel.EmployeesTerritories" StoreEntitySet="EmployeesTerritories">
            <EndProperty Name="Employees">
              <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          </EntityContainerMapping>
      </Mapping>
    </edmx:Mappings>
  </edmx:Runtime>
  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
  <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2007/06/edmx">
    <edmx:Connection>
      <DesignerInfoPropertySet>
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </edmx:Connection>
    <edmx:Options>
      <DesignerInfoPropertySet>
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
      </DesignerInfoPropertySet>
    </edmx:Options>
    <!-- Diagram content (shape and connector positions) -->
    <edmx:Diagrams>
      <Diagram Name="NorthwindModel">
        <EntityTypeShape EntityType="northwindEFModel.Categories" Width="1.5" PointX="0.75" PointY="1.625" Height="1.9802864583333335" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Customers" Width="1.5" PointX="0.75" PointY="9.625" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Employees" Width="1.5" PointX="2.75" PointY="14.625" Height="4.4802050781250014" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.InternationalOrders" Width="1.5" PointX="5.25" PointY="10.375" Height="1.7879850260416674" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.OrderDetails" Width="1.5" PointX="5.25" PointY="1.5" Height="2.3648893229166656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Orders" Width="1.5" PointX="3" PointY="9.25" Height="3.9033007812499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.PreviousEmployees" Width="1.5" PointX="7.75" PointY="0.75" Height="4.2879036458333317" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Products" Width="1.5" PointX="3" PointY="1" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Regions" Width="1.5" PointX="2.75" PointY="6" Height="1.5956835937499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Suppliers" Width="1.5" PointX="0.75" PointY="4.875" Height="3.5186979166666656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Territories" Width="1.5" PointX="5" PointY="5.875" Height="1.7879850260416674" IsExpanded="true" />
        <AssociationConnector Association="northwindEFModel.FK_Products_CategoryID_CategoryID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="2.6151432291666667" />
          <ConnectorPoint PointX="3" PointY="2.6151432291666667" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Orders_CustomerID_CustomerID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="11.2881982421875" />
          <ConnectorPoint PointX="3" PointY="11.2881982421875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.010416666666667" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.177083333333333" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.25" PointY="11.268992513020834" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="3.75" PointY="9.25" />
          <ConnectorPoint PointX="3.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="2.6824446614583328" />
          <ConnectorPoint PointX="5.25" PointY="2.6824446614583328" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="2.0287223307291664" />
          <ConnectorPoint PointX="5.25" PointY="2.0287223307291664" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Products_SupplierID_SupplierID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="4.326396484375" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Territories_RegionID_RegionID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="6.797841796875" />
          <ConnectorPoint PointX="4.666666666666667" PointY="6.7978417968749989" />
          <ConnectorPoint PointX="4.833333333333333" PointY="6.797841796875" />
          <ConnectorPoint PointX="5" PointY="6.797841796875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.EmployeesTerritories" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="7.6629850260416674" /></AssociationConnector>
        </Diagram></edmx:Diagrams>
  </edmx:Designer>
</edmx:Edmx>

Added testlinq/NorthwindModel.Linq.2010.Designer.cs.





































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

//------------------------------------------------------------------------------
// <auto-generated>
//    This code was generated from a template.
//
//    Manual changes to this file may cause unexpected behavior in your application.
//    Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.ComponentModel;
using System.Data.EntityClient;
using System.Data.Metadata.Edm;
using System.Data.Objects;
using System.Data.Objects.DataClasses;
using System.Runtime.Serialization;
using System.Xml.Serialization;

[assembly: EdmSchemaAttribute()]
#region EDM Relationship Metadata

[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Categories), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Customers), "Orders", RelationshipMultiplicity.Many, typeof(testlinq.Orders))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "InternationalOrders", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.InternationalOrders), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products", RelationshipMultiplicity.One, typeof(testlinq.Products), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Suppliers), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions", RelationshipMultiplicity.One, typeof(testlinq.Regions), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "EmployeesTerritories", "Employees", RelationshipMultiplicity.Many, typeof(testlinq.Employees), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]

#endregion

namespace testlinq
{
    #region Contexts

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    public partial class northwindEFEntities : ObjectContext
    {
        #region Constructors

        /// <summary>
        /// Initializes a new northwindEFEntities object using the connection string found in the 'northwindEFEntities' section of the application configuration file.
        /// </summary>
        public northwindEFEntities() : base("name=northwindEFEntities", "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(string connectionString) : base(connectionString, "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(EntityConnection connection) : base(connection, "northwindEFEntities")
        {
            OnContextCreated();
        }

        #endregion

        #region Partial Methods

        partial void OnContextCreated();

        #endregion

        #region ObjectSet Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Categories> Categories
        {
            get
            {
                if ((_Categories == null))
                {
                    _Categories = base.CreateObjectSet<Categories>("Categories");
                }
                return _Categories;
            }
        }
        private ObjectSet<Categories> _Categories;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Customers> Customers
        {
            get
            {
                if ((_Customers == null))
                {
                    _Customers = base.CreateObjectSet<Customers>("Customers");
                }
                return _Customers;
            }
        }
        private ObjectSet<Customers> _Customers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Employees> Employees
        {
            get
            {
                if ((_Employees == null))
                {
                    _Employees = base.CreateObjectSet<Employees>("Employees");
                }
                return _Employees;
            }
        }
        private ObjectSet<Employees> _Employees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<InternationalOrders> InternationalOrders
        {
            get
            {
                if ((_InternationalOrders == null))
                {
                    _InternationalOrders = base.CreateObjectSet<InternationalOrders>("InternationalOrders");
                }
                return _InternationalOrders;
            }
        }
        private ObjectSet<InternationalOrders> _InternationalOrders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<OrderDetails> OrderDetails
        {
            get
            {
                if ((_OrderDetails == null))
                {
                    _OrderDetails = base.CreateObjectSet<OrderDetails>("OrderDetails");
                }
                return _OrderDetails;
            }
        }
        private ObjectSet<OrderDetails> _OrderDetails;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Orders> Orders
        {
            get
            {
                if ((_Orders == null))
                {
                    _Orders = base.CreateObjectSet<Orders>("Orders");
                }
                return _Orders;
            }
        }
        private ObjectSet<Orders> _Orders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<PreviousEmployees> PreviousEmployees
        {
            get
            {
                if ((_PreviousEmployees == null))
                {
                    _PreviousEmployees = base.CreateObjectSet<PreviousEmployees>("PreviousEmployees");
                }
                return _PreviousEmployees;
            }
        }
        private ObjectSet<PreviousEmployees> _PreviousEmployees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Products> Products
        {
            get
            {
                if ((_Products == null))
                {
                    _Products = base.CreateObjectSet<Products>("Products");
                }
                return _Products;
            }
        }
        private ObjectSet<Products> _Products;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Regions> Regions
        {
            get
            {
                if ((_Regions == null))
                {
                    _Regions = base.CreateObjectSet<Regions>("Regions");
                }
                return _Regions;
            }
        }
        private ObjectSet<Regions> _Regions;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Suppliers> Suppliers
        {
            get
            {
                if ((_Suppliers == null))
                {
                    _Suppliers = base.CreateObjectSet<Suppliers>("Suppliers");
                }
                return _Suppliers;
            }
        }
        private ObjectSet<Suppliers> _Suppliers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Territories> Territories
        {
            get
            {
                if ((_Territories == null))
                {
                    _Territories = base.CreateObjectSet<Territories>("Territories");
                }
                return _Territories;
            }
        }
        private ObjectSet<Territories> _Territories;

        #endregion
        #region AddTo Methods

        /// <summary>
        /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCategories(Categories categories)
        {
            base.AddObject("Categories", categories);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Customers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCustomers(Customers customers)
        {
            base.AddObject("Customers", customers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Employees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToEmployees(Employees employees)
        {
            base.AddObject("Employees", employees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the InternationalOrders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToInternationalOrders(InternationalOrders internationalOrders)
        {
            base.AddObject("InternationalOrders", internationalOrders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the OrderDetails EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrderDetails(OrderDetails orderDetails)
        {
            base.AddObject("OrderDetails", orderDetails);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Orders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrders(Orders orders)
        {
            base.AddObject("Orders", orders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the PreviousEmployees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToPreviousEmployees(PreviousEmployees previousEmployees)
        {
            base.AddObject("PreviousEmployees", previousEmployees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToProducts(Products products)
        {
            base.AddObject("Products", products);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Regions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToRegions(Regions regions)
        {
            base.AddObject("Regions", regions);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Suppliers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToSuppliers(Suppliers suppliers)
        {
            base.AddObject("Suppliers", suppliers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Territories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToTerritories(Territories territories)
        {
            base.AddObject("Territories", territories);
        }

        #endregion
    }


    #endregion

    #region Entities

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Categories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Categories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Categories object.
        /// </summary>
        /// <param name="categoryID">Initial value of the CategoryID property.</param>
        /// <param name="categoryName">Initial value of the CategoryName property.</param>
        public static Categories CreateCategories(global::System.Int64 categoryID, global::System.String categoryName)
        {
            Categories categories = new Categories();
            categories.CategoryID = categoryID;
            categories.CategoryName = categoryName;
            return categories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 CategoryID
        {
            get
            {
                return _CategoryID;
            }
            set
            {
                if (_CategoryID != value)
                {
                    OnCategoryIDChanging(value);
                    ReportPropertyChanging("CategoryID");
                    _CategoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("CategoryID");
                    OnCategoryIDChanged();
                }
            }
        }
        private global::System.Int64 _CategoryID;
        partial void OnCategoryIDChanging(global::System.Int64 value);
        partial void OnCategoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CategoryName
        {
            get
            {
                return _CategoryName;
            }
            set
            {
                OnCategoryNameChanging(value);
                ReportPropertyChanging("CategoryName");
                _CategoryName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CategoryName");
                OnCategoryNameChanged();
            }
        }
        private global::System.String _CategoryName;
        partial void OnCategoryNameChanging(global::System.String value);
        partial void OnCategoryNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Description
        {
            get
            {
                return _Description;
            }
            set
            {
                OnDescriptionChanging(value);
                ReportPropertyChanging("Description");
                _Description = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Description");
                OnDescriptionChanged();
            }
        }
        private global::System.String _Description;
        partial void OnDescriptionChanging(global::System.String value);
        partial void OnDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Picture
        {
            get
            {
                return StructuralObject.GetValidValue(_Picture);
            }
            set
            {
                OnPictureChanging(value);
                ReportPropertyChanging("Picture");
                _Picture = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Picture");
                OnPictureChanged();
            }
        }
        private global::System.Byte[] _Picture;
        partial void OnPictureChanging(global::System.Byte[] value);
        partial void OnPictureChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Customers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Customers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Customers object.
        /// </summary>
        /// <param name="customerID">Initial value of the CustomerID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Customers CreateCustomers(global::System.String customerID, global::System.String companyName)
        {
            Customers customers = new Customers();
            customers.CustomerID = customerID;
            customers.CompanyName = companyName;
            return customers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomerID
        {
            get
            {
                return _CustomerID;
            }
            set
            {
                if (_CustomerID != value)
                {
                    OnCustomerIDChanging(value);
                    ReportPropertyChanging("CustomerID");
                    _CustomerID = StructuralObject.SetValidValue(value, false);
                    ReportPropertyChanged("CustomerID");
                    OnCustomerIDChanged();
                }
            }
        }
        private global::System.String _CustomerID;
        partial void OnCustomerIDChanging(global::System.String value);
        partial void OnCustomerIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Orders")]
        public EntityCollection<Orders> Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Employees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Employees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Employees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static Employees CreateEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            Employees employees = new Employees();
            employees.EmployeeID = employeeID;
            employees.LastName = lastName;
            employees.FirstName = firstName;
            return employees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="InternationalOrders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class InternationalOrders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new InternationalOrders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="customsDescription">Initial value of the CustomsDescription property.</param>
        /// <param name="exciseTax">Initial value of the ExciseTax property.</param>
        public static InternationalOrders CreateInternationalOrders(global::System.Int64 orderID, global::System.String customsDescription, global::System.Decimal exciseTax)
        {
            InternationalOrders internationalOrders = new InternationalOrders();
            internationalOrders.OrderID = orderID;
            internationalOrders.CustomsDescription = customsDescription;
            internationalOrders.ExciseTax = exciseTax;
            return internationalOrders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomsDescription
        {
            get
            {
                return _CustomsDescription;
            }
            set
            {
                OnCustomsDescriptionChanging(value);
                ReportPropertyChanging("CustomsDescription");
                _CustomsDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CustomsDescription");
                OnCustomsDescriptionChanged();
            }
        }
        private global::System.String _CustomsDescription;
        partial void OnCustomsDescriptionChanging(global::System.String value);
        partial void OnCustomsDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal ExciseTax
        {
            get
            {
                return _ExciseTax;
            }
            set
            {
                OnExciseTaxChanging(value);
                ReportPropertyChanging("ExciseTax");
                _ExciseTax = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ExciseTax");
                OnExciseTaxChanged();
            }
        }
        private global::System.Decimal _ExciseTax;
        partial void OnExciseTaxChanging(global::System.Decimal value);
        partial void OnExciseTaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="OrderDetails")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class OrderDetails : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new OrderDetails object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="unitPrice">Initial value of the UnitPrice property.</param>
        /// <param name="quantity">Initial value of the Quantity property.</param>
        /// <param name="discount">Initial value of the Discount property.</param>
        public static OrderDetails CreateOrderDetails(global::System.Int64 orderID, global::System.Int64 productID, global::System.Decimal unitPrice, global::System.Int16 quantity, global::System.Single discount)
        {
            OrderDetails orderDetails = new OrderDetails();
            orderDetails.OrderID = orderID;
            orderDetails.ProductID = productID;
            orderDetails.UnitPrice = unitPrice;
            orderDetails.Quantity = quantity;
            orderDetails.Discount = discount;
            return orderDetails;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private global::System.Decimal _UnitPrice;
        partial void OnUnitPriceChanging(global::System.Decimal value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int16 Quantity
        {
            get
            {
                return _Quantity;
            }
            set
            {
                OnQuantityChanging(value);
                ReportPropertyChanging("Quantity");
                _Quantity = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Quantity");
                OnQuantityChanged();
            }
        }
        private global::System.Int16 _Quantity;
        partial void OnQuantityChanging(global::System.Int16 value);
        partial void OnQuantityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Single Discount
        {
            get
            {
                return _Discount;
            }
            set
            {
                OnDiscountChanging(value);
                ReportPropertyChanging("Discount");
                _Discount = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discount");
                OnDiscountChanged();
            }
        }
        private global::System.Single _Discount;
        partial void OnDiscountChanging(global::System.Single value);
        partial void OnDiscountChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products")]
        public Products Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Products> ProductsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Orders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Orders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Orders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        public static Orders CreateOrders(global::System.Int64 orderID)
        {
            Orders orders = new Orders();
            orders.OrderID = orderID;
            return orders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int64> EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                OnEmployeeIDChanging(value);
                ReportPropertyChanging("EmployeeID");
                _EmployeeID = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("EmployeeID");
                OnEmployeeIDChanged();
            }
        }
        private Nullable<global::System.Int64> _EmployeeID;
        partial void OnEmployeeIDChanging(Nullable<global::System.Int64> value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> OrderDate
        {
            get
            {
                return _OrderDate;
            }
            set
            {
                OnOrderDateChanging(value);
                ReportPropertyChanging("OrderDate");
                _OrderDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("OrderDate");
                OnOrderDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _OrderDate;
        partial void OnOrderDateChanging(Nullable<global::System.DateTime> value);
        partial void OnOrderDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> RequiredDate
        {
            get
            {
                return _RequiredDate;
            }
            set
            {
                OnRequiredDateChanging(value);
                ReportPropertyChanging("RequiredDate");
                _RequiredDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("RequiredDate");
                OnRequiredDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _RequiredDate;
        partial void OnRequiredDateChanging(Nullable<global::System.DateTime> value);
        partial void OnRequiredDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> ShippedDate
        {
            get
            {
                return _ShippedDate;
            }
            set
            {
                OnShippedDateChanging(value);
                ReportPropertyChanging("ShippedDate");
                _ShippedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ShippedDate");
                OnShippedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _ShippedDate;
        partial void OnShippedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnShippedDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> Freight
        {
            get
            {
                return _Freight;
            }
            set
            {
                OnFreightChanging(value);
                ReportPropertyChanging("Freight");
                _Freight = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Freight");
                OnFreightChanged();
            }
        }
        private Nullable<global::System.Decimal> _Freight;
        partial void OnFreightChanging(Nullable<global::System.Decimal> value);
        partial void OnFreightChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipName
        {
            get
            {
                return _ShipName;
            }
            set
            {
                OnShipNameChanging(value);
                ReportPropertyChanging("ShipName");
                _ShipName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipName");
                OnShipNameChanged();
            }
        }
        private global::System.String _ShipName;
        partial void OnShipNameChanging(global::System.String value);
        partial void OnShipNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipAddress
        {
            get
            {
                return _ShipAddress;
            }
            set
            {
                OnShipAddressChanging(value);
                ReportPropertyChanging("ShipAddress");
                _ShipAddress = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipAddress");
                OnShipAddressChanged();
            }
        }
        private global::System.String _ShipAddress;
        partial void OnShipAddressChanging(global::System.String value);
        partial void OnShipAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCity
        {
            get
            {
                return _ShipCity;
            }
            set
            {
                OnShipCityChanging(value);
                ReportPropertyChanging("ShipCity");
                _ShipCity = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCity");
                OnShipCityChanged();
            }
        }
        private global::System.String _ShipCity;
        partial void OnShipCityChanging(global::System.String value);
        partial void OnShipCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipRegion
        {
            get
            {
                return _ShipRegion;
            }
            set
            {
                OnShipRegionChanging(value);
                ReportPropertyChanging("ShipRegion");
                _ShipRegion = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipRegion");
                OnShipRegionChanged();
            }
        }
        private global::System.String _ShipRegion;
        partial void OnShipRegionChanging(global::System.String value);
        partial void OnShipRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipPostalCode
        {
            get
            {
                return _ShipPostalCode;
            }
            set
            {
                OnShipPostalCodeChanging(value);
                ReportPropertyChanging("ShipPostalCode");
                _ShipPostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipPostalCode");
                OnShipPostalCodeChanged();
            }
        }
        private global::System.String _ShipPostalCode;
        partial void OnShipPostalCodeChanging(global::System.String value);
        partial void OnShipPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCountry
        {
            get
            {
                return _ShipCountry;
            }
            set
            {
                OnShipCountryChanging(value);
                ReportPropertyChanging("ShipCountry");
                _ShipCountry = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCountry");
                OnShipCountryChanged();
            }
        }
        private global::System.String _ShipCountry;
        partial void OnShipCountryChanging(global::System.String value);
        partial void OnShipCountryChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers")]
        public Customers Customers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Customers> CustomersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "InternationalOrders")]
        public InternationalOrders InternationalOrders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<InternationalOrders> InternationalOrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="PreviousEmployees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class PreviousEmployees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new PreviousEmployees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static PreviousEmployees CreatePreviousEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            PreviousEmployees previousEmployees = new PreviousEmployees();
            previousEmployees.EmployeeID = employeeID;
            previousEmployees.LastName = lastName;
            previousEmployees.FirstName = firstName;
            return previousEmployees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Products")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Products : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Products object.
        /// </summary>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="productName">Initial value of the ProductName property.</param>
        /// <param name="discontinued">Initial value of the Discontinued property.</param>
        public static Products CreateProducts(global::System.Int64 productID, global::System.String productName, global::System.Boolean discontinued)
        {
            Products products = new Products();
            products.ProductID = productID;
            products.ProductName = productName;
            products.Discontinued = discontinued;
            return products;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String ProductName
        {
            get
            {
                return _ProductName;
            }
            set
            {
                OnProductNameChanging(value);
                ReportPropertyChanging("ProductName");
                _ProductName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("ProductName");
                OnProductNameChanged();
            }
        }
        private global::System.String _ProductName;
        partial void OnProductNameChanging(global::System.String value);
        partial void OnProductNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String QuantityPerUnit
        {
            get
            {
                return _QuantityPerUnit;
            }
            set
            {
                OnQuantityPerUnitChanging(value);
                ReportPropertyChanging("QuantityPerUnit");
                _QuantityPerUnit = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("QuantityPerUnit");
                OnQuantityPerUnitChanged();
            }
        }
        private global::System.String _QuantityPerUnit;
        partial void OnQuantityPerUnitChanging(global::System.String value);
        partial void OnQuantityPerUnitChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private Nullable<global::System.Decimal> _UnitPrice;
        partial void OnUnitPriceChanging(Nullable<global::System.Decimal> value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsInStock
        {
            get
            {
                return _UnitsInStock;
            }
            set
            {
                OnUnitsInStockChanging(value);
                ReportPropertyChanging("UnitsInStock");
                _UnitsInStock = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsInStock");
                OnUnitsInStockChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsInStock;
        partial void OnUnitsInStockChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsInStockChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsOnOrder
        {
            get
            {
                return _UnitsOnOrder;
            }
            set
            {
                OnUnitsOnOrderChanging(value);
                ReportPropertyChanging("UnitsOnOrder");
                _UnitsOnOrder = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsOnOrder");
                OnUnitsOnOrderChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsOnOrder;
        partial void OnUnitsOnOrderChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsOnOrderChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> ReorderLevel
        {
            get
            {
                return _ReorderLevel;
            }
            set
            {
                OnReorderLevelChanging(value);
                ReportPropertyChanging("ReorderLevel");
                _ReorderLevel = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ReorderLevel");
                OnReorderLevelChanged();
            }
        }
        private Nullable<global::System.Int16> _ReorderLevel;
        partial void OnReorderLevelChanging(Nullable<global::System.Int16> value);
        partial void OnReorderLevelChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Boolean Discontinued
        {
            get
            {
                return _Discontinued;
            }
            set
            {
                OnDiscontinuedChanging(value);
                ReportPropertyChanging("Discontinued");
                _Discontinued = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discontinued");
                OnDiscontinuedChanged();
            }
        }
        private global::System.Boolean _Discontinued;
        partial void OnDiscontinuedChanging(global::System.Boolean value);
        partial void OnDiscontinuedChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> DiscontinuedDate
        {
            get
            {
                return _DiscontinuedDate;
            }
            set
            {
                OnDiscontinuedDateChanging(value);
                ReportPropertyChanging("DiscontinuedDate");
                _DiscontinuedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DiscontinuedDate");
                OnDiscontinuedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _DiscontinuedDate;
        partial void OnDiscontinuedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnDiscontinuedDateChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories")]
        public Categories Categories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Categories> CategoriesReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers")]
        public Suppliers Suppliers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Suppliers> SuppliersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Regions")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Regions : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Regions object.
        /// </summary>
        /// <param name="regionID">Initial value of the RegionID property.</param>
        /// <param name="regionDescription">Initial value of the RegionDescription property.</param>
        public static Regions CreateRegions(global::System.Int64 regionID, global::System.String regionDescription)
        {
            Regions regions = new Regions();
            regions.RegionID = regionID;
            regions.RegionDescription = regionDescription;
            return regions;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 RegionID
        {
            get
            {
                return _RegionID;
            }
            set
            {
                if (_RegionID != value)
                {
                    OnRegionIDChanging(value);
                    ReportPropertyChanging("RegionID");
                    _RegionID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("RegionID");
                    OnRegionIDChanged();
                }
            }
        }
        private global::System.Int64 _RegionID;
        partial void OnRegionIDChanging(global::System.Int64 value);
        partial void OnRegionIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String RegionDescription
        {
            get
            {
                return _RegionDescription;
            }
            set
            {
                OnRegionDescriptionChanging(value);
                ReportPropertyChanging("RegionDescription");
                _RegionDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("RegionDescription");
                OnRegionDescriptionChanged();
            }
        }
        private global::System.String _RegionDescription;
        partial void OnRegionDescriptionChanging(global::System.String value);
        partial void OnRegionDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Suppliers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Suppliers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Suppliers object.
        /// </summary>
        /// <param name="supplierID">Initial value of the SupplierID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Suppliers CreateSuppliers(global::System.Int64 supplierID, global::System.String companyName)
        {
            Suppliers suppliers = new Suppliers();
            suppliers.SupplierID = supplierID;
            suppliers.CompanyName = companyName;
            return suppliers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 SupplierID
        {
            get
            {
                return _SupplierID;
            }
            set
            {
                if (_SupplierID != value)
                {
                    OnSupplierIDChanging(value);
                    ReportPropertyChanging("SupplierID");
                    _SupplierID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("SupplierID");
                    OnSupplierIDChanged();
                }
            }
        }
        private global::System.Int64 _SupplierID;
        partial void OnSupplierIDChanging(global::System.Int64 value);
        partial void OnSupplierIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePage
        {
            get
            {
                return _HomePage;
            }
            set
            {
                OnHomePageChanging(value);
                ReportPropertyChanging("HomePage");
                _HomePage = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePage");
                OnHomePageChanged();
            }
        }
        private global::System.String _HomePage;
        partial void OnHomePageChanging(global::System.String value);
        partial void OnHomePageChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Territories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Territories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Territories object.
        /// </summary>
        /// <param name="territoryID">Initial value of the TerritoryID property.</param>
        /// <param name="territoryDescription">Initial value of the TerritoryDescription property.</param>
        public static Territories CreateTerritories(global::System.Int64 territoryID, global::System.String territoryDescription)
        {
            Territories territories = new Territories();
            territories.TerritoryID = territoryID;
            territories.TerritoryDescription = territoryDescription;
            return territories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 TerritoryID
        {
            get
            {
                return _TerritoryID;
            }
            set
            {
                if (_TerritoryID != value)
                {
                    OnTerritoryIDChanging(value);
                    ReportPropertyChanging("TerritoryID");
                    _TerritoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("TerritoryID");
                    OnTerritoryIDChanged();
                }
            }
        }
        private global::System.Int64 _TerritoryID;
        partial void OnTerritoryIDChanging(global::System.Int64 value);
        partial void OnTerritoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String TerritoryDescription
        {
            get
            {
                return _TerritoryDescription;
            }
            set
            {
                OnTerritoryDescriptionChanging(value);
                ReportPropertyChanging("TerritoryDescription");
                _TerritoryDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("TerritoryDescription");
                OnTerritoryDescriptionChanged();
            }
        }
        private global::System.String _TerritoryDescription;
        partial void OnTerritoryDescriptionChanging(global::System.String value);
        partial void OnTerritoryDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions")]
        public Regions Regions
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Regions> RegionsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Employees")]
        public EntityCollection<Employees> Employees
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees", value);
                }
            }
        }

        #endregion
    }

    #endregion

}

Added testlinq/NorthwindModel.Linq.2010.edmx.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
    <Schema Namespace="northwindEFModel.Store" Alias="Self" Provider="System.Data.SQLite.Linq" ProviderManifestToken="ISO8601" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
        <EntityContainer Name="northwindEFModelStoreContainer">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Store.Categories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Store.Customers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Store.Employees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="EmployeesTerritories" EntityType="northwindEFModel.Store.EmployeesTerritories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.Store.InternationalOrders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.Store.OrderDetails" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Store.Orders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.Store.PreviousEmployees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Store.Products" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Store.Regions" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Store.Suppliers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Store.Territories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <AssociationSet Name="FK_EmployeesTerritories_EmployeeID_EmployeeID" Association="northwindEFModel.Store.FK_EmployeesTerritories_EmployeeID_EmployeeID">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_EmployeesTerritories_TerritoryID_TerritoryID" Association="northwindEFModel.Store.FK_EmployeesTerritories_TerritoryID_TerritoryID">
            <End Role="Territories" EntitySet="Territories" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.Store.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.Store.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.Store.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.Store.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.Store.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.Store.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.Store.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
        </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CategoryName" Type="nvarchar" Nullable="false" MaxLength="15" />
          <Property Name="Description" Type="nvarchar" />
          <Property Name="Picture" Type="blob" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="nvarchar" Nullable="false" MaxLength="5" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="EmployeesTerritories">
          <Key>
            <PropertyRef Name="EmployeeID" />
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="CustomsDescription" Type="nvarchar" Nullable="false" MaxLength="100" />
          <Property Name="ExciseTax" Type="decimal" Nullable="false" Precision="53" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="ProductID" Type="integer" Nullable="false" />
          <Property Name="UnitPrice" Type="decimal" Nullable="false" Precision="53" />
          <Property Name="Quantity" Type="smallint" Nullable="false" />
          <!--
              NOTE: The "Discount" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbInsertCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Discount" Type="real" Nullable="false" StoreGeneratedPattern="Computed" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CustomerID" Type="nvarchar" MaxLength="5" />
          <Property Name="EmployeeID" Type="integer" />
          <Property Name="OrderDate" Type="datetime" />
          <Property Name="RequiredDate" Type="datetime" />
          <Property Name="ShippedDate" Type="datetime" />
          <!--
              NOTE: The "Freight" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbUpdateCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Freight" Type="decimal" Precision="53" StoreGeneratedPattern="Computed" />
          <Property Name="ShipName" Type="nvarchar" MaxLength="40" />
          <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" />
          <Property Name="ShipCity" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="ProductName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="SupplierID" Type="integer" />
          <Property Name="CategoryID" Type="integer" />
          <Property Name="QuantityPerUnit" Type="nvarchar" MaxLength="20" />
          <Property Name="UnitPrice" Type="decimal" Precision="53" />
          <Property Name="UnitsInStock" Type="smallint" />
          <Property Name="UnitsOnOrder" Type="smallint" />
          <Property Name="ReorderLevel" Type="smallint" />
          <Property Name="Discontinued" Type="bit" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="datetime" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="integer" Nullable="false" />
          <Property Name="RegionDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
          <Property Name="HomePage" Type="nvarchar" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
          <Property Name="TerritoryDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
          <Property Name="RegionID" Type="integer" Nullable="false" />
        </EntityType>
        <Association Name="FK_EmployeesTerritories_EmployeeID_EmployeeID">
          <End Role="Employees" Type="northwindEFModel.Store.Employees" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Employees">
              <PropertyRef Name="EmployeeID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="EmployeeID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_EmployeesTerritories_TerritoryID_TerritoryID">
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Territories">
              <PropertyRef Name="TerritoryID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="TerritoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.Store.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Store.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Customers">
              <PropertyRef Name="CustomerID" />
            </Principal>
            <Dependent Role="Orders">
              <PropertyRef Name="CustomerID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Store.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Categories">
              <PropertyRef Name="CategoryID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="CategoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Store.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Suppliers">
              <PropertyRef Name="SupplierID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="SupplierID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Store.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Regions">
              <PropertyRef Name="RegionID" />
            </Principal>
            <Dependent Role="Territories">
              <PropertyRef Name="RegionID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
      </Schema></edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="northwindEFModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
        <EntityContainer Name="northwindEFEntities">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Categories" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Customers" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Employees" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.InternationalOrders" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.OrderDetails" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Orders" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.PreviousEmployees" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Products" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Regions" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Suppliers" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Territories" />
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          <AssociationSet Name="EmployeesTerritories" Association="northwindEFModel.EmployeesTerritories">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="Int64" Nullable="false" />
          <Property Name="CategoryName" Type="String" Nullable="false" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Description" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="Picture" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Categories" ToRole="Products" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="String" Nullable="false" MaxLength="5" Unicode="true" FixedLength="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Customers" ToRole="Orders" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Employees" ToRole="Territories" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="CustomsDescription" Type="String" Nullable="false" MaxLength="100" Unicode="true" FixedLength="false" />
          <Property Name="ExciseTax" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="InternationalOrders" ToRole="Orders" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="UnitPrice" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <Property Name="Quantity" Type="Int16" Nullable="false" />
          <Property Name="Discount" Type="Single" Nullable="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="OrderDetails" ToRole="Orders" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="OrderDetails" ToRole="Products" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="EmployeeID" Type="Int64" />
          <Property Name="OrderDate" Type="DateTime" />
          <Property Name="RequiredDate" Type="DateTime" />
          <Property Name="ShippedDate" Type="DateTime" />
          <Property Name="Freight" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="ShipName" Type="String" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ShipAddress" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="ShipCity" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipRegion" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipPostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="ShipCountry" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Customers" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Orders" ToRole="Customers" />
          <NavigationProperty Name="InternationalOrders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="Orders" ToRole="InternationalOrders" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="Orders" ToRole="OrderDetails" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="ProductName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="QuantityPerUnit" Type="String" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="UnitPrice" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="UnitsInStock" Type="Int16" />
          <Property Name="UnitsOnOrder" Type="Int16" />
          <Property Name="ReorderLevel" Type="Int16" />
          <Property Name="Discontinued" Type="Boolean" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="DateTime" />
          <NavigationProperty Name="Categories" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Products" ToRole="Categories" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="Products" ToRole="OrderDetails" />
          <NavigationProperty Name="Suppliers" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Products" ToRole="Suppliers" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="Int64" Nullable="false" />
          <Property Name="RegionDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Regions" ToRole="Territories" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="Int64" Nullable="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="HomePage" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Suppliers" ToRole="Products" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="Int64" Nullable="false" />
          <Property Name="TerritoryDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Regions" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Territories" ToRole="Regions" />
          <NavigationProperty Name="Employees" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Territories" ToRole="Employees" />
        </EntityType>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="*" />
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        <Association Name="EmployeesTerritories">
          <End Role="Employees" Type="northwindEFModel.Employees" Multiplicity="*" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        </Schema>
    </edmx:ConceptualModels>
    <!-- C-S mapping content -->
    <edmx:Mappings>
      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
        <EntityContainerMapping StorageEntityContainer="northwindEFModelStoreContainer" CdmEntityContainer="northwindEFEntities">
          <EntitySetMapping Name="Categories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Categories)">
              <MappingFragment StoreEntitySet="Categories">
                <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
                <ScalarProperty Name="CategoryName" ColumnName="CategoryName" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="Picture" ColumnName="Picture" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Customers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Customers)">
              <MappingFragment StoreEntitySet="Customers">
                <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Employees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Employees)">
              <MappingFragment StoreEntitySet="Employees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="InternationalOrders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.InternationalOrders)">
              <MappingFragment StoreEntitySet="InternationalOrders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="CustomsDescription" ColumnName="CustomsDescription" />
                <ScalarProperty Name="ExciseTax" ColumnName="ExciseTax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="OrderDetails">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.OrderDetails)">
              <MappingFragment StoreEntitySet="OrderDetails">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="Quantity" ColumnName="Quantity" />
                <ScalarProperty Name="Discount" ColumnName="Discount" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Orders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Orders)">
              <MappingFragment StoreEntitySet="Orders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="OrderDate" ColumnName="OrderDate" />
                <ScalarProperty Name="RequiredDate" ColumnName="RequiredDate" />
                <ScalarProperty Name="ShippedDate" ColumnName="ShippedDate" />
                <ScalarProperty Name="Freight" ColumnName="Freight" />
                <ScalarProperty Name="ShipName" ColumnName="ShipName" />
                <ScalarProperty Name="ShipAddress" ColumnName="ShipAddress" />
                <ScalarProperty Name="ShipCity" ColumnName="ShipCity" />
                <ScalarProperty Name="ShipRegion" ColumnName="ShipRegion" />
                <ScalarProperty Name="ShipPostalCode" ColumnName="ShipPostalCode" />
                <ScalarProperty Name="ShipCountry" ColumnName="ShipCountry" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="PreviousEmployees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.PreviousEmployees)">
              <MappingFragment StoreEntitySet="PreviousEmployees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Products">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Products)">
              <MappingFragment StoreEntitySet="Products">
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="ProductName" ColumnName="ProductName" />
                <ScalarProperty Name="QuantityPerUnit" ColumnName="QuantityPerUnit" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="UnitsInStock" ColumnName="UnitsInStock" />
                <ScalarProperty Name="UnitsOnOrder" ColumnName="UnitsOnOrder" />
                <ScalarProperty Name="ReorderLevel" ColumnName="ReorderLevel" />
                <ScalarProperty Name="Discontinued" ColumnName="Discontinued" />
                <ScalarProperty Name="DiscontinuedDate" ColumnName="DiscontinuedDate" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Regions">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Regions)">
              <MappingFragment StoreEntitySet="Regions">
                <ScalarProperty Name="RegionID" ColumnName="RegionID" />
                <ScalarProperty Name="RegionDescription" ColumnName="RegionDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Suppliers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Suppliers)">
              <MappingFragment StoreEntitySet="Suppliers">
                <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
                <ScalarProperty Name="HomePage" ColumnName="HomePage" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Territories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Territories)">
              <MappingFragment StoreEntitySet="Territories">
                <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
                <ScalarProperty Name="TerritoryDescription" ColumnName="TerritoryDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <AssociationSetMapping Name="FK_Products_CategoryID_CategoryID" TypeName="northwindEFModel.FK_Products_CategoryID_CategoryID" StoreEntitySet="Products">
            <EndProperty Name="Categories">
              <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="CategoryID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Orders_CustomerID_CustomerID" TypeName="northwindEFModel.FK_Orders_CustomerID_CustomerID" StoreEntitySet="Orders">
            <EndProperty Name="Customers">
              <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
            </EndProperty>
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <Condition ColumnName="CustomerID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_InternationalOrders_OrderID_OrderID" TypeName="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" StoreEntitySet="InternationalOrders">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="InternationalOrders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_OrderID_OrderID" TypeName="northwindEFModel.FK_OrderDetails_OrderID_OrderID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_ProductID_ProductID" TypeName="northwindEFModel.FK_OrderDetails_ProductID_ProductID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Products_SupplierID_SupplierID" TypeName="northwindEFModel.FK_Products_SupplierID_SupplierID" StoreEntitySet="Products">
            <EndProperty Name="Suppliers">
              <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="SupplierID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Territories_RegionID_RegionID" TypeName="northwindEFModel.FK_Territories_RegionID_RegionID" StoreEntitySet="Territories">
            <EndProperty Name="Regions">
              <ScalarProperty Name="RegionID" ColumnName="RegionID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="EmployeesTerritories" TypeName="northwindEFModel.EmployeesTerritories" StoreEntitySet="EmployeesTerritories">
            <EndProperty Name="Employees">
              <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          </EntityContainerMapping>
      </Mapping>
    </edmx:Mappings>
  </edmx:Runtime>
  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
  <edmx:Designer>
    <edmx:Connection>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </edmx:Connection>
    <edmx:Options>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
      </DesignerInfoPropertySet>
    </edmx:Options>
    <!-- Diagram content (shape and connector positions) -->
    <edmx:Diagrams>
      <Diagram Name="NorthwindModel" xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <EntityTypeShape EntityType="northwindEFModel.Categories" Width="1.5" PointX="0.75" PointY="1.625" Height="1.9802864583333335" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Customers" Width="1.5" PointX="0.75" PointY="9.625" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Employees" Width="1.5" PointX="2.75" PointY="14.625" Height="4.4802050781250014" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.InternationalOrders" Width="1.5" PointX="5.25" PointY="10.375" Height="1.7879850260416674" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.OrderDetails" Width="1.5" PointX="5.25" PointY="1.5" Height="2.3648893229166656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Orders" Width="1.5" PointX="3" PointY="9.25" Height="3.9033007812499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.PreviousEmployees" Width="1.5" PointX="7.75" PointY="0.75" Height="4.2879036458333317" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Products" Width="1.5" PointX="3" PointY="1" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Regions" Width="1.5" PointX="2.75" PointY="6" Height="1.5956835937499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Suppliers" Width="1.5" PointX="0.75" PointY="4.875" Height="3.5186979166666656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Territories" Width="1.5" PointX="5" PointY="5.875" Height="1.7879850260416674" IsExpanded="true" />
        <AssociationConnector Association="northwindEFModel.FK_Products_CategoryID_CategoryID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="2.6151432291666667" />
          <ConnectorPoint PointX="3" PointY="2.6151432291666667" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Orders_CustomerID_CustomerID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="11.2881982421875" />
          <ConnectorPoint PointX="3" PointY="11.2881982421875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.010416666666667" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.177083333333333" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.25" PointY="11.268992513020834" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="3.75" PointY="9.25" />
          <ConnectorPoint PointX="3.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="2.6824446614583328" />
          <ConnectorPoint PointX="5.25" PointY="2.6824446614583328" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="2.0287223307291664" />
          <ConnectorPoint PointX="5.25" PointY="2.0287223307291664" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Products_SupplierID_SupplierID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="4.326396484375" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Territories_RegionID_RegionID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="6.797841796875" />
          <ConnectorPoint PointX="4.666666666666667" PointY="6.7978417968749989" />
          <ConnectorPoint PointX="4.833333333333333" PointY="6.797841796875" />
          <ConnectorPoint PointX="5" PointY="6.797841796875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.EmployeesTerritories" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="7.6629850260416674" /></AssociationConnector>
        </Diagram></edmx:Diagrams>
  </edmx:Designer>
</edmx:Edmx>

Added testlinq/NorthwindModel.Linq.2012.Designer.cs.





































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

//------------------------------------------------------------------------------
// <auto-generated>
//    This code was generated from a template.
//
//    Manual changes to this file may cause unexpected behavior in your application.
//    Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.ComponentModel;
using System.Data.EntityClient;
using System.Data.Metadata.Edm;
using System.Data.Objects;
using System.Data.Objects.DataClasses;
using System.Runtime.Serialization;
using System.Xml.Serialization;

[assembly: EdmSchemaAttribute()]
#region EDM Relationship Metadata

[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Categories), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Customers), "Orders", RelationshipMultiplicity.Many, typeof(testlinq.Orders))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "InternationalOrders", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.InternationalOrders), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products", RelationshipMultiplicity.One, typeof(testlinq.Products), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Suppliers), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions", RelationshipMultiplicity.One, typeof(testlinq.Regions), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "EmployeesTerritories", "Employees", RelationshipMultiplicity.Many, typeof(testlinq.Employees), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]

#endregion

namespace testlinq
{
    #region Contexts

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    public partial class northwindEFEntities : ObjectContext
    {
        #region Constructors

        /// <summary>
        /// Initializes a new northwindEFEntities object using the connection string found in the 'northwindEFEntities' section of the application configuration file.
        /// </summary>
        public northwindEFEntities() : base("name=northwindEFEntities", "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(string connectionString) : base(connectionString, "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(EntityConnection connection) : base(connection, "northwindEFEntities")
        {
            OnContextCreated();
        }

        #endregion

        #region Partial Methods

        partial void OnContextCreated();

        #endregion

        #region ObjectSet Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Categories> Categories
        {
            get
            {
                if ((_Categories == null))
                {
                    _Categories = base.CreateObjectSet<Categories>("Categories");
                }
                return _Categories;
            }
        }
        private ObjectSet<Categories> _Categories;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Customers> Customers
        {
            get
            {
                if ((_Customers == null))
                {
                    _Customers = base.CreateObjectSet<Customers>("Customers");
                }
                return _Customers;
            }
        }
        private ObjectSet<Customers> _Customers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Employees> Employees
        {
            get
            {
                if ((_Employees == null))
                {
                    _Employees = base.CreateObjectSet<Employees>("Employees");
                }
                return _Employees;
            }
        }
        private ObjectSet<Employees> _Employees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<InternationalOrders> InternationalOrders
        {
            get
            {
                if ((_InternationalOrders == null))
                {
                    _InternationalOrders = base.CreateObjectSet<InternationalOrders>("InternationalOrders");
                }
                return _InternationalOrders;
            }
        }
        private ObjectSet<InternationalOrders> _InternationalOrders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<OrderDetails> OrderDetails
        {
            get
            {
                if ((_OrderDetails == null))
                {
                    _OrderDetails = base.CreateObjectSet<OrderDetails>("OrderDetails");
                }
                return _OrderDetails;
            }
        }
        private ObjectSet<OrderDetails> _OrderDetails;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Orders> Orders
        {
            get
            {
                if ((_Orders == null))
                {
                    _Orders = base.CreateObjectSet<Orders>("Orders");
                }
                return _Orders;
            }
        }
        private ObjectSet<Orders> _Orders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<PreviousEmployees> PreviousEmployees
        {
            get
            {
                if ((_PreviousEmployees == null))
                {
                    _PreviousEmployees = base.CreateObjectSet<PreviousEmployees>("PreviousEmployees");
                }
                return _PreviousEmployees;
            }
        }
        private ObjectSet<PreviousEmployees> _PreviousEmployees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Products> Products
        {
            get
            {
                if ((_Products == null))
                {
                    _Products = base.CreateObjectSet<Products>("Products");
                }
                return _Products;
            }
        }
        private ObjectSet<Products> _Products;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Regions> Regions
        {
            get
            {
                if ((_Regions == null))
                {
                    _Regions = base.CreateObjectSet<Regions>("Regions");
                }
                return _Regions;
            }
        }
        private ObjectSet<Regions> _Regions;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Suppliers> Suppliers
        {
            get
            {
                if ((_Suppliers == null))
                {
                    _Suppliers = base.CreateObjectSet<Suppliers>("Suppliers");
                }
                return _Suppliers;
            }
        }
        private ObjectSet<Suppliers> _Suppliers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Territories> Territories
        {
            get
            {
                if ((_Territories == null))
                {
                    _Territories = base.CreateObjectSet<Territories>("Territories");
                }
                return _Territories;
            }
        }
        private ObjectSet<Territories> _Territories;

        #endregion
        #region AddTo Methods

        /// <summary>
        /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCategories(Categories categories)
        {
            base.AddObject("Categories", categories);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Customers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCustomers(Customers customers)
        {
            base.AddObject("Customers", customers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Employees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToEmployees(Employees employees)
        {
            base.AddObject("Employees", employees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the InternationalOrders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToInternationalOrders(InternationalOrders internationalOrders)
        {
            base.AddObject("InternationalOrders", internationalOrders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the OrderDetails EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrderDetails(OrderDetails orderDetails)
        {
            base.AddObject("OrderDetails", orderDetails);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Orders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrders(Orders orders)
        {
            base.AddObject("Orders", orders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the PreviousEmployees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToPreviousEmployees(PreviousEmployees previousEmployees)
        {
            base.AddObject("PreviousEmployees", previousEmployees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToProducts(Products products)
        {
            base.AddObject("Products", products);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Regions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToRegions(Regions regions)
        {
            base.AddObject("Regions", regions);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Suppliers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToSuppliers(Suppliers suppliers)
        {
            base.AddObject("Suppliers", suppliers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Territories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToTerritories(Territories territories)
        {
            base.AddObject("Territories", territories);
        }

        #endregion
    }


    #endregion

    #region Entities

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Categories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Categories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Categories object.
        /// </summary>
        /// <param name="categoryID">Initial value of the CategoryID property.</param>
        /// <param name="categoryName">Initial value of the CategoryName property.</param>
        public static Categories CreateCategories(global::System.Int64 categoryID, global::System.String categoryName)
        {
            Categories categories = new Categories();
            categories.CategoryID = categoryID;
            categories.CategoryName = categoryName;
            return categories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 CategoryID
        {
            get
            {
                return _CategoryID;
            }
            set
            {
                if (_CategoryID != value)
                {
                    OnCategoryIDChanging(value);
                    ReportPropertyChanging("CategoryID");
                    _CategoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("CategoryID");
                    OnCategoryIDChanged();
                }
            }
        }
        private global::System.Int64 _CategoryID;
        partial void OnCategoryIDChanging(global::System.Int64 value);
        partial void OnCategoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CategoryName
        {
            get
            {
                return _CategoryName;
            }
            set
            {
                OnCategoryNameChanging(value);
                ReportPropertyChanging("CategoryName");
                _CategoryName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CategoryName");
                OnCategoryNameChanged();
            }
        }
        private global::System.String _CategoryName;
        partial void OnCategoryNameChanging(global::System.String value);
        partial void OnCategoryNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Description
        {
            get
            {
                return _Description;
            }
            set
            {
                OnDescriptionChanging(value);
                ReportPropertyChanging("Description");
                _Description = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Description");
                OnDescriptionChanged();
            }
        }
        private global::System.String _Description;
        partial void OnDescriptionChanging(global::System.String value);
        partial void OnDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Picture
        {
            get
            {
                return StructuralObject.GetValidValue(_Picture);
            }
            set
            {
                OnPictureChanging(value);
                ReportPropertyChanging("Picture");
                _Picture = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Picture");
                OnPictureChanged();
            }
        }
        private global::System.Byte[] _Picture;
        partial void OnPictureChanging(global::System.Byte[] value);
        partial void OnPictureChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Customers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Customers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Customers object.
        /// </summary>
        /// <param name="customerID">Initial value of the CustomerID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Customers CreateCustomers(global::System.String customerID, global::System.String companyName)
        {
            Customers customers = new Customers();
            customers.CustomerID = customerID;
            customers.CompanyName = companyName;
            return customers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomerID
        {
            get
            {
                return _CustomerID;
            }
            set
            {
                if (_CustomerID != value)
                {
                    OnCustomerIDChanging(value);
                    ReportPropertyChanging("CustomerID");
                    _CustomerID = StructuralObject.SetValidValue(value, false);
                    ReportPropertyChanged("CustomerID");
                    OnCustomerIDChanged();
                }
            }
        }
        private global::System.String _CustomerID;
        partial void OnCustomerIDChanging(global::System.String value);
        partial void OnCustomerIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Orders")]
        public EntityCollection<Orders> Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Employees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Employees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Employees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static Employees CreateEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            Employees employees = new Employees();
            employees.EmployeeID = employeeID;
            employees.LastName = lastName;
            employees.FirstName = firstName;
            return employees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="InternationalOrders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class InternationalOrders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new InternationalOrders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="customsDescription">Initial value of the CustomsDescription property.</param>
        /// <param name="exciseTax">Initial value of the ExciseTax property.</param>
        public static InternationalOrders CreateInternationalOrders(global::System.Int64 orderID, global::System.String customsDescription, global::System.Decimal exciseTax)
        {
            InternationalOrders internationalOrders = new InternationalOrders();
            internationalOrders.OrderID = orderID;
            internationalOrders.CustomsDescription = customsDescription;
            internationalOrders.ExciseTax = exciseTax;
            return internationalOrders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomsDescription
        {
            get
            {
                return _CustomsDescription;
            }
            set
            {
                OnCustomsDescriptionChanging(value);
                ReportPropertyChanging("CustomsDescription");
                _CustomsDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CustomsDescription");
                OnCustomsDescriptionChanged();
            }
        }
        private global::System.String _CustomsDescription;
        partial void OnCustomsDescriptionChanging(global::System.String value);
        partial void OnCustomsDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal ExciseTax
        {
            get
            {
                return _ExciseTax;
            }
            set
            {
                OnExciseTaxChanging(value);
                ReportPropertyChanging("ExciseTax");
                _ExciseTax = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ExciseTax");
                OnExciseTaxChanged();
            }
        }
        private global::System.Decimal _ExciseTax;
        partial void OnExciseTaxChanging(global::System.Decimal value);
        partial void OnExciseTaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="OrderDetails")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class OrderDetails : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new OrderDetails object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="unitPrice">Initial value of the UnitPrice property.</param>
        /// <param name="quantity">Initial value of the Quantity property.</param>
        /// <param name="discount">Initial value of the Discount property.</param>
        public static OrderDetails CreateOrderDetails(global::System.Int64 orderID, global::System.Int64 productID, global::System.Decimal unitPrice, global::System.Int16 quantity, global::System.Single discount)
        {
            OrderDetails orderDetails = new OrderDetails();
            orderDetails.OrderID = orderID;
            orderDetails.ProductID = productID;
            orderDetails.UnitPrice = unitPrice;
            orderDetails.Quantity = quantity;
            orderDetails.Discount = discount;
            return orderDetails;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private global::System.Decimal _UnitPrice;
        partial void OnUnitPriceChanging(global::System.Decimal value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int16 Quantity
        {
            get
            {
                return _Quantity;
            }
            set
            {
                OnQuantityChanging(value);
                ReportPropertyChanging("Quantity");
                _Quantity = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Quantity");
                OnQuantityChanged();
            }
        }
        private global::System.Int16 _Quantity;
        partial void OnQuantityChanging(global::System.Int16 value);
        partial void OnQuantityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Single Discount
        {
            get
            {
                return _Discount;
            }
            set
            {
                OnDiscountChanging(value);
                ReportPropertyChanging("Discount");
                _Discount = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discount");
                OnDiscountChanged();
            }
        }
        private global::System.Single _Discount;
        partial void OnDiscountChanging(global::System.Single value);
        partial void OnDiscountChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products")]
        public Products Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Products> ProductsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Orders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Orders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Orders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        public static Orders CreateOrders(global::System.Int64 orderID)
        {
            Orders orders = new Orders();
            orders.OrderID = orderID;
            return orders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int64> EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                OnEmployeeIDChanging(value);
                ReportPropertyChanging("EmployeeID");
                _EmployeeID = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("EmployeeID");
                OnEmployeeIDChanged();
            }
        }
        private Nullable<global::System.Int64> _EmployeeID;
        partial void OnEmployeeIDChanging(Nullable<global::System.Int64> value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> OrderDate
        {
            get
            {
                return _OrderDate;
            }
            set
            {
                OnOrderDateChanging(value);
                ReportPropertyChanging("OrderDate");
                _OrderDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("OrderDate");
                OnOrderDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _OrderDate;
        partial void OnOrderDateChanging(Nullable<global::System.DateTime> value);
        partial void OnOrderDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> RequiredDate
        {
            get
            {
                return _RequiredDate;
            }
            set
            {
                OnRequiredDateChanging(value);
                ReportPropertyChanging("RequiredDate");
                _RequiredDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("RequiredDate");
                OnRequiredDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _RequiredDate;
        partial void OnRequiredDateChanging(Nullable<global::System.DateTime> value);
        partial void OnRequiredDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> ShippedDate
        {
            get
            {
                return _ShippedDate;
            }
            set
            {
                OnShippedDateChanging(value);
                ReportPropertyChanging("ShippedDate");
                _ShippedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ShippedDate");
                OnShippedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _ShippedDate;
        partial void OnShippedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnShippedDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> Freight
        {
            get
            {
                return _Freight;
            }
            set
            {
                OnFreightChanging(value);
                ReportPropertyChanging("Freight");
                _Freight = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Freight");
                OnFreightChanged();
            }
        }
        private Nullable<global::System.Decimal> _Freight;
        partial void OnFreightChanging(Nullable<global::System.Decimal> value);
        partial void OnFreightChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipName
        {
            get
            {
                return _ShipName;
            }
            set
            {
                OnShipNameChanging(value);
                ReportPropertyChanging("ShipName");
                _ShipName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipName");
                OnShipNameChanged();
            }
        }
        private global::System.String _ShipName;
        partial void OnShipNameChanging(global::System.String value);
        partial void OnShipNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipAddress
        {
            get
            {
                return _ShipAddress;
            }
            set
            {
                OnShipAddressChanging(value);
                ReportPropertyChanging("ShipAddress");
                _ShipAddress = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipAddress");
                OnShipAddressChanged();
            }
        }
        private global::System.String _ShipAddress;
        partial void OnShipAddressChanging(global::System.String value);
        partial void OnShipAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCity
        {
            get
            {
                return _ShipCity;
            }
            set
            {
                OnShipCityChanging(value);
                ReportPropertyChanging("ShipCity");
                _ShipCity = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCity");
                OnShipCityChanged();
            }
        }
        private global::System.String _ShipCity;
        partial void OnShipCityChanging(global::System.String value);
        partial void OnShipCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipRegion
        {
            get
            {
                return _ShipRegion;
            }
            set
            {
                OnShipRegionChanging(value);
                ReportPropertyChanging("ShipRegion");
                _ShipRegion = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipRegion");
                OnShipRegionChanged();
            }
        }
        private global::System.String _ShipRegion;
        partial void OnShipRegionChanging(global::System.String value);
        partial void OnShipRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipPostalCode
        {
            get
            {
                return _ShipPostalCode;
            }
            set
            {
                OnShipPostalCodeChanging(value);
                ReportPropertyChanging("ShipPostalCode");
                _ShipPostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipPostalCode");
                OnShipPostalCodeChanged();
            }
        }
        private global::System.String _ShipPostalCode;
        partial void OnShipPostalCodeChanging(global::System.String value);
        partial void OnShipPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCountry
        {
            get
            {
                return _ShipCountry;
            }
            set
            {
                OnShipCountryChanging(value);
                ReportPropertyChanging("ShipCountry");
                _ShipCountry = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCountry");
                OnShipCountryChanged();
            }
        }
        private global::System.String _ShipCountry;
        partial void OnShipCountryChanging(global::System.String value);
        partial void OnShipCountryChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers")]
        public Customers Customers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Customers> CustomersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "InternationalOrders")]
        public InternationalOrders InternationalOrders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<InternationalOrders> InternationalOrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="PreviousEmployees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class PreviousEmployees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new PreviousEmployees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static PreviousEmployees CreatePreviousEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            PreviousEmployees previousEmployees = new PreviousEmployees();
            previousEmployees.EmployeeID = employeeID;
            previousEmployees.LastName = lastName;
            previousEmployees.FirstName = firstName;
            return previousEmployees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Products")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Products : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Products object.
        /// </summary>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="productName">Initial value of the ProductName property.</param>
        /// <param name="discontinued">Initial value of the Discontinued property.</param>
        public static Products CreateProducts(global::System.Int64 productID, global::System.String productName, global::System.Boolean discontinued)
        {
            Products products = new Products();
            products.ProductID = productID;
            products.ProductName = productName;
            products.Discontinued = discontinued;
            return products;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String ProductName
        {
            get
            {
                return _ProductName;
            }
            set
            {
                OnProductNameChanging(value);
                ReportPropertyChanging("ProductName");
                _ProductName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("ProductName");
                OnProductNameChanged();
            }
        }
        private global::System.String _ProductName;
        partial void OnProductNameChanging(global::System.String value);
        partial void OnProductNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String QuantityPerUnit
        {
            get
            {
                return _QuantityPerUnit;
            }
            set
            {
                OnQuantityPerUnitChanging(value);
                ReportPropertyChanging("QuantityPerUnit");
                _QuantityPerUnit = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("QuantityPerUnit");
                OnQuantityPerUnitChanged();
            }
        }
        private global::System.String _QuantityPerUnit;
        partial void OnQuantityPerUnitChanging(global::System.String value);
        partial void OnQuantityPerUnitChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private Nullable<global::System.Decimal> _UnitPrice;
        partial void OnUnitPriceChanging(Nullable<global::System.Decimal> value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsInStock
        {
            get
            {
                return _UnitsInStock;
            }
            set
            {
                OnUnitsInStockChanging(value);
                ReportPropertyChanging("UnitsInStock");
                _UnitsInStock = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsInStock");
                OnUnitsInStockChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsInStock;
        partial void OnUnitsInStockChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsInStockChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsOnOrder
        {
            get
            {
                return _UnitsOnOrder;
            }
            set
            {
                OnUnitsOnOrderChanging(value);
                ReportPropertyChanging("UnitsOnOrder");
                _UnitsOnOrder = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsOnOrder");
                OnUnitsOnOrderChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsOnOrder;
        partial void OnUnitsOnOrderChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsOnOrderChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> ReorderLevel
        {
            get
            {
                return _ReorderLevel;
            }
            set
            {
                OnReorderLevelChanging(value);
                ReportPropertyChanging("ReorderLevel");
                _ReorderLevel = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ReorderLevel");
                OnReorderLevelChanged();
            }
        }
        private Nullable<global::System.Int16> _ReorderLevel;
        partial void OnReorderLevelChanging(Nullable<global::System.Int16> value);
        partial void OnReorderLevelChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Boolean Discontinued
        {
            get
            {
                return _Discontinued;
            }
            set
            {
                OnDiscontinuedChanging(value);
                ReportPropertyChanging("Discontinued");
                _Discontinued = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discontinued");
                OnDiscontinuedChanged();
            }
        }
        private global::System.Boolean _Discontinued;
        partial void OnDiscontinuedChanging(global::System.Boolean value);
        partial void OnDiscontinuedChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> DiscontinuedDate
        {
            get
            {
                return _DiscontinuedDate;
            }
            set
            {
                OnDiscontinuedDateChanging(value);
                ReportPropertyChanging("DiscontinuedDate");
                _DiscontinuedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DiscontinuedDate");
                OnDiscontinuedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _DiscontinuedDate;
        partial void OnDiscontinuedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnDiscontinuedDateChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories")]
        public Categories Categories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Categories> CategoriesReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers")]
        public Suppliers Suppliers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Suppliers> SuppliersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Regions")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Regions : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Regions object.
        /// </summary>
        /// <param name="regionID">Initial value of the RegionID property.</param>
        /// <param name="regionDescription">Initial value of the RegionDescription property.</param>
        public static Regions CreateRegions(global::System.Int64 regionID, global::System.String regionDescription)
        {
            Regions regions = new Regions();
            regions.RegionID = regionID;
            regions.RegionDescription = regionDescription;
            return regions;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 RegionID
        {
            get
            {
                return _RegionID;
            }
            set
            {
                if (_RegionID != value)
                {
                    OnRegionIDChanging(value);
                    ReportPropertyChanging("RegionID");
                    _RegionID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("RegionID");
                    OnRegionIDChanged();
                }
            }
        }
        private global::System.Int64 _RegionID;
        partial void OnRegionIDChanging(global::System.Int64 value);
        partial void OnRegionIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String RegionDescription
        {
            get
            {
                return _RegionDescription;
            }
            set
            {
                OnRegionDescriptionChanging(value);
                ReportPropertyChanging("RegionDescription");
                _RegionDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("RegionDescription");
                OnRegionDescriptionChanged();
            }
        }
        private global::System.String _RegionDescription;
        partial void OnRegionDescriptionChanging(global::System.String value);
        partial void OnRegionDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Suppliers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Suppliers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Suppliers object.
        /// </summary>
        /// <param name="supplierID">Initial value of the SupplierID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Suppliers CreateSuppliers(global::System.Int64 supplierID, global::System.String companyName)
        {
            Suppliers suppliers = new Suppliers();
            suppliers.SupplierID = supplierID;
            suppliers.CompanyName = companyName;
            return suppliers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 SupplierID
        {
            get
            {
                return _SupplierID;
            }
            set
            {
                if (_SupplierID != value)
                {
                    OnSupplierIDChanging(value);
                    ReportPropertyChanging("SupplierID");
                    _SupplierID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("SupplierID");
                    OnSupplierIDChanged();
                }
            }
        }
        private global::System.Int64 _SupplierID;
        partial void OnSupplierIDChanging(global::System.Int64 value);
        partial void OnSupplierIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePage
        {
            get
            {
                return _HomePage;
            }
            set
            {
                OnHomePageChanging(value);
                ReportPropertyChanging("HomePage");
                _HomePage = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePage");
                OnHomePageChanged();
            }
        }
        private global::System.String _HomePage;
        partial void OnHomePageChanging(global::System.String value);
        partial void OnHomePageChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Territories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Territories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Territories object.
        /// </summary>
        /// <param name="territoryID">Initial value of the TerritoryID property.</param>
        /// <param name="territoryDescription">Initial value of the TerritoryDescription property.</param>
        public static Territories CreateTerritories(global::System.Int64 territoryID, global::System.String territoryDescription)
        {
            Territories territories = new Territories();
            territories.TerritoryID = territoryID;
            territories.TerritoryDescription = territoryDescription;
            return territories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 TerritoryID
        {
            get
            {
                return _TerritoryID;
            }
            set
            {
                if (_TerritoryID != value)
                {
                    OnTerritoryIDChanging(value);
                    ReportPropertyChanging("TerritoryID");
                    _TerritoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("TerritoryID");
                    OnTerritoryIDChanged();
                }
            }
        }
        private global::System.Int64 _TerritoryID;
        partial void OnTerritoryIDChanging(global::System.Int64 value);
        partial void OnTerritoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String TerritoryDescription
        {
            get
            {
                return _TerritoryDescription;
            }
            set
            {
                OnTerritoryDescriptionChanging(value);
                ReportPropertyChanging("TerritoryDescription");
                _TerritoryDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("TerritoryDescription");
                OnTerritoryDescriptionChanged();
            }
        }
        private global::System.String _TerritoryDescription;
        partial void OnTerritoryDescriptionChanging(global::System.String value);
        partial void OnTerritoryDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions")]
        public Regions Regions
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Regions> RegionsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Employees")]
        public EntityCollection<Employees> Employees
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees", value);
                }
            }
        }

        #endregion
    }

    #endregion

}

Added testlinq/NorthwindModel.Linq.2012.edmx.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
    <Schema Namespace="northwindEFModel.Store" Alias="Self" Provider="System.Data.SQLite.Linq" ProviderManifestToken="ISO8601" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
        <EntityContainer Name="northwindEFModelStoreContainer">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Store.Categories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Store.Customers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Store.Employees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="EmployeesTerritories" EntityType="northwindEFModel.Store.EmployeesTerritories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.Store.InternationalOrders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.Store.OrderDetails" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Store.Orders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.Store.PreviousEmployees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Store.Products" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Store.Regions" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Store.Suppliers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Store.Territories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <AssociationSet Name="FK_EmployeesTerritories_EmployeeID_EmployeeID" Association="northwindEFModel.Store.FK_EmployeesTerritories_EmployeeID_EmployeeID">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_EmployeesTerritories_TerritoryID_TerritoryID" Association="northwindEFModel.Store.FK_EmployeesTerritories_TerritoryID_TerritoryID">
            <End Role="Territories" EntitySet="Territories" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.Store.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.Store.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.Store.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.Store.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.Store.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.Store.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.Store.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
        </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CategoryName" Type="nvarchar" Nullable="false" MaxLength="15" />
          <Property Name="Description" Type="nvarchar" />
          <Property Name="Picture" Type="blob" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="nvarchar" Nullable="false" MaxLength="5" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="EmployeesTerritories">
          <Key>
            <PropertyRef Name="EmployeeID" />
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="CustomsDescription" Type="nvarchar" Nullable="false" MaxLength="100" />
          <Property Name="ExciseTax" Type="decimal" Nullable="false" Precision="53" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="ProductID" Type="integer" Nullable="false" />
          <Property Name="UnitPrice" Type="decimal" Nullable="false" Precision="53" />
          <Property Name="Quantity" Type="smallint" Nullable="false" />
          <!--
              NOTE: The "Discount" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbInsertCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Discount" Type="real" Nullable="false" StoreGeneratedPattern="Computed" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CustomerID" Type="nvarchar" MaxLength="5" />
          <Property Name="EmployeeID" Type="integer" />
          <Property Name="OrderDate" Type="datetime" />
          <Property Name="RequiredDate" Type="datetime" />
          <Property Name="ShippedDate" Type="datetime" />
          <!--
              NOTE: The "Freight" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbUpdateCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Freight" Type="decimal" Precision="53" StoreGeneratedPattern="Computed" />
          <Property Name="ShipName" Type="nvarchar" MaxLength="40" />
          <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" />
          <Property Name="ShipCity" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="ProductName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="SupplierID" Type="integer" />
          <Property Name="CategoryID" Type="integer" />
          <Property Name="QuantityPerUnit" Type="nvarchar" MaxLength="20" />
          <Property Name="UnitPrice" Type="decimal" Precision="53" />
          <Property Name="UnitsInStock" Type="smallint" />
          <Property Name="UnitsOnOrder" Type="smallint" />
          <Property Name="ReorderLevel" Type="smallint" />
          <Property Name="Discontinued" Type="bit" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="datetime" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="integer" Nullable="false" />
          <Property Name="RegionDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
          <Property Name="HomePage" Type="nvarchar" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
          <Property Name="TerritoryDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
          <Property Name="RegionID" Type="integer" Nullable="false" />
        </EntityType>
        <Association Name="FK_EmployeesTerritories_EmployeeID_EmployeeID">
          <End Role="Employees" Type="northwindEFModel.Store.Employees" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Employees">
              <PropertyRef Name="EmployeeID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="EmployeeID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_EmployeesTerritories_TerritoryID_TerritoryID">
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Territories">
              <PropertyRef Name="TerritoryID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="TerritoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.Store.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Store.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Customers">
              <PropertyRef Name="CustomerID" />
            </Principal>
            <Dependent Role="Orders">
              <PropertyRef Name="CustomerID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Store.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Categories">
              <PropertyRef Name="CategoryID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="CategoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Store.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Suppliers">
              <PropertyRef Name="SupplierID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="SupplierID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Store.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Regions">
              <PropertyRef Name="RegionID" />
            </Principal>
            <Dependent Role="Territories">
              <PropertyRef Name="RegionID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
      </Schema></edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="northwindEFModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
        <EntityContainer Name="northwindEFEntities">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Categories" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Customers" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Employees" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.InternationalOrders" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.OrderDetails" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Orders" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.PreviousEmployees" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Products" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Regions" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Suppliers" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Territories" />
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          <AssociationSet Name="EmployeesTerritories" Association="northwindEFModel.EmployeesTerritories">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="Int64" Nullable="false" />
          <Property Name="CategoryName" Type="String" Nullable="false" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Description" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="Picture" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Categories" ToRole="Products" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="String" Nullable="false" MaxLength="5" Unicode="true" FixedLength="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Customers" ToRole="Orders" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Employees" ToRole="Territories" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="CustomsDescription" Type="String" Nullable="false" MaxLength="100" Unicode="true" FixedLength="false" />
          <Property Name="ExciseTax" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="InternationalOrders" ToRole="Orders" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="UnitPrice" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <Property Name="Quantity" Type="Int16" Nullable="false" />
          <Property Name="Discount" Type="Single" Nullable="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="OrderDetails" ToRole="Orders" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="OrderDetails" ToRole="Products" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="EmployeeID" Type="Int64" />
          <Property Name="OrderDate" Type="DateTime" />
          <Property Name="RequiredDate" Type="DateTime" />
          <Property Name="ShippedDate" Type="DateTime" />
          <Property Name="Freight" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="ShipName" Type="String" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ShipAddress" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="ShipCity" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipRegion" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipPostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="ShipCountry" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Customers" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Orders" ToRole="Customers" />
          <NavigationProperty Name="InternationalOrders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="Orders" ToRole="InternationalOrders" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="Orders" ToRole="OrderDetails" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="ProductName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="QuantityPerUnit" Type="String" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="UnitPrice" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="UnitsInStock" Type="Int16" />
          <Property Name="UnitsOnOrder" Type="Int16" />
          <Property Name="ReorderLevel" Type="Int16" />
          <Property Name="Discontinued" Type="Boolean" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="DateTime" />
          <NavigationProperty Name="Categories" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Products" ToRole="Categories" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="Products" ToRole="OrderDetails" />
          <NavigationProperty Name="Suppliers" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Products" ToRole="Suppliers" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="Int64" Nullable="false" />
          <Property Name="RegionDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Regions" ToRole="Territories" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="Int64" Nullable="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="HomePage" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Suppliers" ToRole="Products" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="Int64" Nullable="false" />
          <Property Name="TerritoryDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Regions" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Territories" ToRole="Regions" />
          <NavigationProperty Name="Employees" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Territories" ToRole="Employees" />
        </EntityType>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="*" />
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        <Association Name="EmployeesTerritories">
          <End Role="Employees" Type="northwindEFModel.Employees" Multiplicity="*" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        </Schema>
    </edmx:ConceptualModels>
    <!-- C-S mapping content -->
    <edmx:Mappings>
      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
        <EntityContainerMapping StorageEntityContainer="northwindEFModelStoreContainer" CdmEntityContainer="northwindEFEntities">
          <EntitySetMapping Name="Categories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Categories)">
              <MappingFragment StoreEntitySet="Categories">
                <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
                <ScalarProperty Name="CategoryName" ColumnName="CategoryName" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="Picture" ColumnName="Picture" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Customers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Customers)">
              <MappingFragment StoreEntitySet="Customers">
                <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Employees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Employees)">
              <MappingFragment StoreEntitySet="Employees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="InternationalOrders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.InternationalOrders)">
              <MappingFragment StoreEntitySet="InternationalOrders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="CustomsDescription" ColumnName="CustomsDescription" />
                <ScalarProperty Name="ExciseTax" ColumnName="ExciseTax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="OrderDetails">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.OrderDetails)">
              <MappingFragment StoreEntitySet="OrderDetails">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="Quantity" ColumnName="Quantity" />
                <ScalarProperty Name="Discount" ColumnName="Discount" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Orders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Orders)">
              <MappingFragment StoreEntitySet="Orders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="OrderDate" ColumnName="OrderDate" />
                <ScalarProperty Name="RequiredDate" ColumnName="RequiredDate" />
                <ScalarProperty Name="ShippedDate" ColumnName="ShippedDate" />
                <ScalarProperty Name="Freight" ColumnName="Freight" />
                <ScalarProperty Name="ShipName" ColumnName="ShipName" />
                <ScalarProperty Name="ShipAddress" ColumnName="ShipAddress" />
                <ScalarProperty Name="ShipCity" ColumnName="ShipCity" />
                <ScalarProperty Name="ShipRegion" ColumnName="ShipRegion" />
                <ScalarProperty Name="ShipPostalCode" ColumnName="ShipPostalCode" />
                <ScalarProperty Name="ShipCountry" ColumnName="ShipCountry" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="PreviousEmployees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.PreviousEmployees)">
              <MappingFragment StoreEntitySet="PreviousEmployees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Products">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Products)">
              <MappingFragment StoreEntitySet="Products">
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="ProductName" ColumnName="ProductName" />
                <ScalarProperty Name="QuantityPerUnit" ColumnName="QuantityPerUnit" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="UnitsInStock" ColumnName="UnitsInStock" />
                <ScalarProperty Name="UnitsOnOrder" ColumnName="UnitsOnOrder" />
                <ScalarProperty Name="ReorderLevel" ColumnName="ReorderLevel" />
                <ScalarProperty Name="Discontinued" ColumnName="Discontinued" />
                <ScalarProperty Name="DiscontinuedDate" ColumnName="DiscontinuedDate" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Regions">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Regions)">
              <MappingFragment StoreEntitySet="Regions">
                <ScalarProperty Name="RegionID" ColumnName="RegionID" />
                <ScalarProperty Name="RegionDescription" ColumnName="RegionDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Suppliers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Suppliers)">
              <MappingFragment StoreEntitySet="Suppliers">
                <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
                <ScalarProperty Name="HomePage" ColumnName="HomePage" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Territories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Territories)">
              <MappingFragment StoreEntitySet="Territories">
                <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
                <ScalarProperty Name="TerritoryDescription" ColumnName="TerritoryDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <AssociationSetMapping Name="FK_Products_CategoryID_CategoryID" TypeName="northwindEFModel.FK_Products_CategoryID_CategoryID" StoreEntitySet="Products">
            <EndProperty Name="Categories">
              <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="CategoryID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Orders_CustomerID_CustomerID" TypeName="northwindEFModel.FK_Orders_CustomerID_CustomerID" StoreEntitySet="Orders">
            <EndProperty Name="Customers">
              <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
            </EndProperty>
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <Condition ColumnName="CustomerID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_InternationalOrders_OrderID_OrderID" TypeName="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" StoreEntitySet="InternationalOrders">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="InternationalOrders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_OrderID_OrderID" TypeName="northwindEFModel.FK_OrderDetails_OrderID_OrderID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_ProductID_ProductID" TypeName="northwindEFModel.FK_OrderDetails_ProductID_ProductID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Products_SupplierID_SupplierID" TypeName="northwindEFModel.FK_Products_SupplierID_SupplierID" StoreEntitySet="Products">
            <EndProperty Name="Suppliers">
              <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="SupplierID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Territories_RegionID_RegionID" TypeName="northwindEFModel.FK_Territories_RegionID_RegionID" StoreEntitySet="Territories">
            <EndProperty Name="Regions">
              <ScalarProperty Name="RegionID" ColumnName="RegionID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="EmployeesTerritories" TypeName="northwindEFModel.EmployeesTerritories" StoreEntitySet="EmployeesTerritories">
            <EndProperty Name="Employees">
              <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          </EntityContainerMapping>
      </Mapping>
    </edmx:Mappings>
  </edmx:Runtime>
  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
  <edmx:Designer>
    <edmx:Connection>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </edmx:Connection>
    <edmx:Options>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
      </DesignerInfoPropertySet>
    </edmx:Options>
    <!-- Diagram content (shape and connector positions) -->
    <edmx:Diagrams>
      <Diagram Name="NorthwindModel" xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <EntityTypeShape EntityType="northwindEFModel.Categories" Width="1.5" PointX="0.75" PointY="1.625" Height="1.9802864583333335" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Customers" Width="1.5" PointX="0.75" PointY="9.625" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Employees" Width="1.5" PointX="2.75" PointY="14.625" Height="4.4802050781250014" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.InternationalOrders" Width="1.5" PointX="5.25" PointY="10.375" Height="1.7879850260416674" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.OrderDetails" Width="1.5" PointX="5.25" PointY="1.5" Height="2.3648893229166656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Orders" Width="1.5" PointX="3" PointY="9.25" Height="3.9033007812499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.PreviousEmployees" Width="1.5" PointX="7.75" PointY="0.75" Height="4.2879036458333317" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Products" Width="1.5" PointX="3" PointY="1" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Regions" Width="1.5" PointX="2.75" PointY="6" Height="1.5956835937499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Suppliers" Width="1.5" PointX="0.75" PointY="4.875" Height="3.5186979166666656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Territories" Width="1.5" PointX="5" PointY="5.875" Height="1.7879850260416674" IsExpanded="true" />
        <AssociationConnector Association="northwindEFModel.FK_Products_CategoryID_CategoryID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="2.6151432291666667" />
          <ConnectorPoint PointX="3" PointY="2.6151432291666667" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Orders_CustomerID_CustomerID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="11.2881982421875" />
          <ConnectorPoint PointX="3" PointY="11.2881982421875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.010416666666667" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.177083333333333" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.25" PointY="11.268992513020834" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="3.75" PointY="9.25" />
          <ConnectorPoint PointX="3.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="2.6824446614583328" />
          <ConnectorPoint PointX="5.25" PointY="2.6824446614583328" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="2.0287223307291664" />
          <ConnectorPoint PointX="5.25" PointY="2.0287223307291664" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Products_SupplierID_SupplierID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="4.326396484375" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Territories_RegionID_RegionID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="6.797841796875" />
          <ConnectorPoint PointX="4.666666666666667" PointY="6.7978417968749989" />
          <ConnectorPoint PointX="4.833333333333333" PointY="6.797841796875" />
          <ConnectorPoint PointX="5" PointY="6.797841796875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.EmployeesTerritories" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="7.6629850260416674" /></AssociationConnector>
        </Diagram></edmx:Diagrams>
  </edmx:Designer>
</edmx:Edmx>

Added testlinq/NorthwindModel.Linq.2013.Designer.cs.





































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

//------------------------------------------------------------------------------
// <auto-generated>
//    This code was generated from a template.
//
//    Manual changes to this file may cause unexpected behavior in your application.
//    Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.ComponentModel;
using System.Data.EntityClient;
using System.Data.Metadata.Edm;
using System.Data.Objects;
using System.Data.Objects.DataClasses;
using System.Runtime.Serialization;
using System.Xml.Serialization;

[assembly: EdmSchemaAttribute()]
#region EDM Relationship Metadata

[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Categories), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Customers), "Orders", RelationshipMultiplicity.Many, typeof(testlinq.Orders))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "InternationalOrders", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.InternationalOrders), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products", RelationshipMultiplicity.One, typeof(testlinq.Products), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Suppliers), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions", RelationshipMultiplicity.One, typeof(testlinq.Regions), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "EmployeesTerritories", "Employees", RelationshipMultiplicity.Many, typeof(testlinq.Employees), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]

#endregion

namespace testlinq
{
    #region Contexts

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    public partial class northwindEFEntities : ObjectContext
    {
        #region Constructors

        /// <summary>
        /// Initializes a new northwindEFEntities object using the connection string found in the 'northwindEFEntities' section of the application configuration file.
        /// </summary>
        public northwindEFEntities() : base("name=northwindEFEntities", "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(string connectionString) : base(connectionString, "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(EntityConnection connection) : base(connection, "northwindEFEntities")
        {
            OnContextCreated();
        }

        #endregion

        #region Partial Methods

        partial void OnContextCreated();

        #endregion

        #region ObjectSet Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Categories> Categories
        {
            get
            {
                if ((_Categories == null))
                {
                    _Categories = base.CreateObjectSet<Categories>("Categories");
                }
                return _Categories;
            }
        }
        private ObjectSet<Categories> _Categories;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Customers> Customers
        {
            get
            {
                if ((_Customers == null))
                {
                    _Customers = base.CreateObjectSet<Customers>("Customers");
                }
                return _Customers;
            }
        }
        private ObjectSet<Customers> _Customers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Employees> Employees
        {
            get
            {
                if ((_Employees == null))
                {
                    _Employees = base.CreateObjectSet<Employees>("Employees");
                }
                return _Employees;
            }
        }
        private ObjectSet<Employees> _Employees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<InternationalOrders> InternationalOrders
        {
            get
            {
                if ((_InternationalOrders == null))
                {
                    _InternationalOrders = base.CreateObjectSet<InternationalOrders>("InternationalOrders");
                }
                return _InternationalOrders;
            }
        }
        private ObjectSet<InternationalOrders> _InternationalOrders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<OrderDetails> OrderDetails
        {
            get
            {
                if ((_OrderDetails == null))
                {
                    _OrderDetails = base.CreateObjectSet<OrderDetails>("OrderDetails");
                }
                return _OrderDetails;
            }
        }
        private ObjectSet<OrderDetails> _OrderDetails;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Orders> Orders
        {
            get
            {
                if ((_Orders == null))
                {
                    _Orders = base.CreateObjectSet<Orders>("Orders");
                }
                return _Orders;
            }
        }
        private ObjectSet<Orders> _Orders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<PreviousEmployees> PreviousEmployees
        {
            get
            {
                if ((_PreviousEmployees == null))
                {
                    _PreviousEmployees = base.CreateObjectSet<PreviousEmployees>("PreviousEmployees");
                }
                return _PreviousEmployees;
            }
        }
        private ObjectSet<PreviousEmployees> _PreviousEmployees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Products> Products
        {
            get
            {
                if ((_Products == null))
                {
                    _Products = base.CreateObjectSet<Products>("Products");
                }
                return _Products;
            }
        }
        private ObjectSet<Products> _Products;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Regions> Regions
        {
            get
            {
                if ((_Regions == null))
                {
                    _Regions = base.CreateObjectSet<Regions>("Regions");
                }
                return _Regions;
            }
        }
        private ObjectSet<Regions> _Regions;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Suppliers> Suppliers
        {
            get
            {
                if ((_Suppliers == null))
                {
                    _Suppliers = base.CreateObjectSet<Suppliers>("Suppliers");
                }
                return _Suppliers;
            }
        }
        private ObjectSet<Suppliers> _Suppliers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Territories> Territories
        {
            get
            {
                if ((_Territories == null))
                {
                    _Territories = base.CreateObjectSet<Territories>("Territories");
                }
                return _Territories;
            }
        }
        private ObjectSet<Territories> _Territories;

        #endregion
        #region AddTo Methods

        /// <summary>
        /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCategories(Categories categories)
        {
            base.AddObject("Categories", categories);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Customers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCustomers(Customers customers)
        {
            base.AddObject("Customers", customers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Employees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToEmployees(Employees employees)
        {
            base.AddObject("Employees", employees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the InternationalOrders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToInternationalOrders(InternationalOrders internationalOrders)
        {
            base.AddObject("InternationalOrders", internationalOrders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the OrderDetails EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrderDetails(OrderDetails orderDetails)
        {
            base.AddObject("OrderDetails", orderDetails);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Orders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrders(Orders orders)
        {
            base.AddObject("Orders", orders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the PreviousEmployees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToPreviousEmployees(PreviousEmployees previousEmployees)
        {
            base.AddObject("PreviousEmployees", previousEmployees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToProducts(Products products)
        {
            base.AddObject("Products", products);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Regions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToRegions(Regions regions)
        {
            base.AddObject("Regions", regions);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Suppliers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToSuppliers(Suppliers suppliers)
        {
            base.AddObject("Suppliers", suppliers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Territories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToTerritories(Territories territories)
        {
            base.AddObject("Territories", territories);
        }

        #endregion
    }


    #endregion

    #region Entities

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Categories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Categories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Categories object.
        /// </summary>
        /// <param name="categoryID">Initial value of the CategoryID property.</param>
        /// <param name="categoryName">Initial value of the CategoryName property.</param>
        public static Categories CreateCategories(global::System.Int64 categoryID, global::System.String categoryName)
        {
            Categories categories = new Categories();
            categories.CategoryID = categoryID;
            categories.CategoryName = categoryName;
            return categories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 CategoryID
        {
            get
            {
                return _CategoryID;
            }
            set
            {
                if (_CategoryID != value)
                {
                    OnCategoryIDChanging(value);
                    ReportPropertyChanging("CategoryID");
                    _CategoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("CategoryID");
                    OnCategoryIDChanged();
                }
            }
        }
        private global::System.Int64 _CategoryID;
        partial void OnCategoryIDChanging(global::System.Int64 value);
        partial void OnCategoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CategoryName
        {
            get
            {
                return _CategoryName;
            }
            set
            {
                OnCategoryNameChanging(value);
                ReportPropertyChanging("CategoryName");
                _CategoryName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CategoryName");
                OnCategoryNameChanged();
            }
        }
        private global::System.String _CategoryName;
        partial void OnCategoryNameChanging(global::System.String value);
        partial void OnCategoryNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Description
        {
            get
            {
                return _Description;
            }
            set
            {
                OnDescriptionChanging(value);
                ReportPropertyChanging("Description");
                _Description = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Description");
                OnDescriptionChanged();
            }
        }
        private global::System.String _Description;
        partial void OnDescriptionChanging(global::System.String value);
        partial void OnDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Picture
        {
            get
            {
                return StructuralObject.GetValidValue(_Picture);
            }
            set
            {
                OnPictureChanging(value);
                ReportPropertyChanging("Picture");
                _Picture = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Picture");
                OnPictureChanged();
            }
        }
        private global::System.Byte[] _Picture;
        partial void OnPictureChanging(global::System.Byte[] value);
        partial void OnPictureChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Customers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Customers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Customers object.
        /// </summary>
        /// <param name="customerID">Initial value of the CustomerID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Customers CreateCustomers(global::System.String customerID, global::System.String companyName)
        {
            Customers customers = new Customers();
            customers.CustomerID = customerID;
            customers.CompanyName = companyName;
            return customers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomerID
        {
            get
            {
                return _CustomerID;
            }
            set
            {
                if (_CustomerID != value)
                {
                    OnCustomerIDChanging(value);
                    ReportPropertyChanging("CustomerID");
                    _CustomerID = StructuralObject.SetValidValue(value, false);
                    ReportPropertyChanged("CustomerID");
                    OnCustomerIDChanged();
                }
            }
        }
        private global::System.String _CustomerID;
        partial void OnCustomerIDChanging(global::System.String value);
        partial void OnCustomerIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Orders")]
        public EntityCollection<Orders> Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Employees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Employees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Employees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static Employees CreateEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            Employees employees = new Employees();
            employees.EmployeeID = employeeID;
            employees.LastName = lastName;
            employees.FirstName = firstName;
            return employees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="InternationalOrders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class InternationalOrders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new InternationalOrders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="customsDescription">Initial value of the CustomsDescription property.</param>
        /// <param name="exciseTax">Initial value of the ExciseTax property.</param>
        public static InternationalOrders CreateInternationalOrders(global::System.Int64 orderID, global::System.String customsDescription, global::System.Decimal exciseTax)
        {
            InternationalOrders internationalOrders = new InternationalOrders();
            internationalOrders.OrderID = orderID;
            internationalOrders.CustomsDescription = customsDescription;
            internationalOrders.ExciseTax = exciseTax;
            return internationalOrders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomsDescription
        {
            get
            {
                return _CustomsDescription;
            }
            set
            {
                OnCustomsDescriptionChanging(value);
                ReportPropertyChanging("CustomsDescription");
                _CustomsDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CustomsDescription");
                OnCustomsDescriptionChanged();
            }
        }
        private global::System.String _CustomsDescription;
        partial void OnCustomsDescriptionChanging(global::System.String value);
        partial void OnCustomsDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal ExciseTax
        {
            get
            {
                return _ExciseTax;
            }
            set
            {
                OnExciseTaxChanging(value);
                ReportPropertyChanging("ExciseTax");
                _ExciseTax = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ExciseTax");
                OnExciseTaxChanged();
            }
        }
        private global::System.Decimal _ExciseTax;
        partial void OnExciseTaxChanging(global::System.Decimal value);
        partial void OnExciseTaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="OrderDetails")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class OrderDetails : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new OrderDetails object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="unitPrice">Initial value of the UnitPrice property.</param>
        /// <param name="quantity">Initial value of the Quantity property.</param>
        /// <param name="discount">Initial value of the Discount property.</param>
        public static OrderDetails CreateOrderDetails(global::System.Int64 orderID, global::System.Int64 productID, global::System.Decimal unitPrice, global::System.Int16 quantity, global::System.Single discount)
        {
            OrderDetails orderDetails = new OrderDetails();
            orderDetails.OrderID = orderID;
            orderDetails.ProductID = productID;
            orderDetails.UnitPrice = unitPrice;
            orderDetails.Quantity = quantity;
            orderDetails.Discount = discount;
            return orderDetails;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private global::System.Decimal _UnitPrice;
        partial void OnUnitPriceChanging(global::System.Decimal value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int16 Quantity
        {
            get
            {
                return _Quantity;
            }
            set
            {
                OnQuantityChanging(value);
                ReportPropertyChanging("Quantity");
                _Quantity = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Quantity");
                OnQuantityChanged();
            }
        }
        private global::System.Int16 _Quantity;
        partial void OnQuantityChanging(global::System.Int16 value);
        partial void OnQuantityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Single Discount
        {
            get
            {
                return _Discount;
            }
            set
            {
                OnDiscountChanging(value);
                ReportPropertyChanging("Discount");
                _Discount = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discount");
                OnDiscountChanged();
            }
        }
        private global::System.Single _Discount;
        partial void OnDiscountChanging(global::System.Single value);
        partial void OnDiscountChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products")]
        public Products Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Products> ProductsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Orders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Orders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Orders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        public static Orders CreateOrders(global::System.Int64 orderID)
        {
            Orders orders = new Orders();
            orders.OrderID = orderID;
            return orders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int64> EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                OnEmployeeIDChanging(value);
                ReportPropertyChanging("EmployeeID");
                _EmployeeID = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("EmployeeID");
                OnEmployeeIDChanged();
            }
        }
        private Nullable<global::System.Int64> _EmployeeID;
        partial void OnEmployeeIDChanging(Nullable<global::System.Int64> value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> OrderDate
        {
            get
            {
                return _OrderDate;
            }
            set
            {
                OnOrderDateChanging(value);
                ReportPropertyChanging("OrderDate");
                _OrderDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("OrderDate");
                OnOrderDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _OrderDate;
        partial void OnOrderDateChanging(Nullable<global::System.DateTime> value);
        partial void OnOrderDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> RequiredDate
        {
            get
            {
                return _RequiredDate;
            }
            set
            {
                OnRequiredDateChanging(value);
                ReportPropertyChanging("RequiredDate");
                _RequiredDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("RequiredDate");
                OnRequiredDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _RequiredDate;
        partial void OnRequiredDateChanging(Nullable<global::System.DateTime> value);
        partial void OnRequiredDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> ShippedDate
        {
            get
            {
                return _ShippedDate;
            }
            set
            {
                OnShippedDateChanging(value);
                ReportPropertyChanging("ShippedDate");
                _ShippedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ShippedDate");
                OnShippedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _ShippedDate;
        partial void OnShippedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnShippedDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> Freight
        {
            get
            {
                return _Freight;
            }
            set
            {
                OnFreightChanging(value);
                ReportPropertyChanging("Freight");
                _Freight = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Freight");
                OnFreightChanged();
            }
        }
        private Nullable<global::System.Decimal> _Freight;
        partial void OnFreightChanging(Nullable<global::System.Decimal> value);
        partial void OnFreightChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipName
        {
            get
            {
                return _ShipName;
            }
            set
            {
                OnShipNameChanging(value);
                ReportPropertyChanging("ShipName");
                _ShipName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipName");
                OnShipNameChanged();
            }
        }
        private global::System.String _ShipName;
        partial void OnShipNameChanging(global::System.String value);
        partial void OnShipNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipAddress
        {
            get
            {
                return _ShipAddress;
            }
            set
            {
                OnShipAddressChanging(value);
                ReportPropertyChanging("ShipAddress");
                _ShipAddress = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipAddress");
                OnShipAddressChanged();
            }
        }
        private global::System.String _ShipAddress;
        partial void OnShipAddressChanging(global::System.String value);
        partial void OnShipAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCity
        {
            get
            {
                return _ShipCity;
            }
            set
            {
                OnShipCityChanging(value);
                ReportPropertyChanging("ShipCity");
                _ShipCity = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCity");
                OnShipCityChanged();
            }
        }
        private global::System.String _ShipCity;
        partial void OnShipCityChanging(global::System.String value);
        partial void OnShipCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipRegion
        {
            get
            {
                return _ShipRegion;
            }
            set
            {
                OnShipRegionChanging(value);
                ReportPropertyChanging("ShipRegion");
                _ShipRegion = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipRegion");
                OnShipRegionChanged();
            }
        }
        private global::System.String _ShipRegion;
        partial void OnShipRegionChanging(global::System.String value);
        partial void OnShipRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipPostalCode
        {
            get
            {
                return _ShipPostalCode;
            }
            set
            {
                OnShipPostalCodeChanging(value);
                ReportPropertyChanging("ShipPostalCode");
                _ShipPostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipPostalCode");
                OnShipPostalCodeChanged();
            }
        }
        private global::System.String _ShipPostalCode;
        partial void OnShipPostalCodeChanging(global::System.String value);
        partial void OnShipPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCountry
        {
            get
            {
                return _ShipCountry;
            }
            set
            {
                OnShipCountryChanging(value);
                ReportPropertyChanging("ShipCountry");
                _ShipCountry = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCountry");
                OnShipCountryChanged();
            }
        }
        private global::System.String _ShipCountry;
        partial void OnShipCountryChanging(global::System.String value);
        partial void OnShipCountryChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers")]
        public Customers Customers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Customers> CustomersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "InternationalOrders")]
        public InternationalOrders InternationalOrders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<InternationalOrders> InternationalOrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="PreviousEmployees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class PreviousEmployees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new PreviousEmployees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static PreviousEmployees CreatePreviousEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            PreviousEmployees previousEmployees = new PreviousEmployees();
            previousEmployees.EmployeeID = employeeID;
            previousEmployees.LastName = lastName;
            previousEmployees.FirstName = firstName;
            return previousEmployees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Products")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Products : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Products object.
        /// </summary>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="productName">Initial value of the ProductName property.</param>
        /// <param name="discontinued">Initial value of the Discontinued property.</param>
        public static Products CreateProducts(global::System.Int64 productID, global::System.String productName, global::System.Boolean discontinued)
        {
            Products products = new Products();
            products.ProductID = productID;
            products.ProductName = productName;
            products.Discontinued = discontinued;
            return products;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String ProductName
        {
            get
            {
                return _ProductName;
            }
            set
            {
                OnProductNameChanging(value);
                ReportPropertyChanging("ProductName");
                _ProductName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("ProductName");
                OnProductNameChanged();
            }
        }
        private global::System.String _ProductName;
        partial void OnProductNameChanging(global::System.String value);
        partial void OnProductNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String QuantityPerUnit
        {
            get
            {
                return _QuantityPerUnit;
            }
            set
            {
                OnQuantityPerUnitChanging(value);
                ReportPropertyChanging("QuantityPerUnit");
                _QuantityPerUnit = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("QuantityPerUnit");
                OnQuantityPerUnitChanged();
            }
        }
        private global::System.String _QuantityPerUnit;
        partial void OnQuantityPerUnitChanging(global::System.String value);
        partial void OnQuantityPerUnitChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private Nullable<global::System.Decimal> _UnitPrice;
        partial void OnUnitPriceChanging(Nullable<global::System.Decimal> value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsInStock
        {
            get
            {
                return _UnitsInStock;
            }
            set
            {
                OnUnitsInStockChanging(value);
                ReportPropertyChanging("UnitsInStock");
                _UnitsInStock = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsInStock");
                OnUnitsInStockChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsInStock;
        partial void OnUnitsInStockChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsInStockChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsOnOrder
        {
            get
            {
                return _UnitsOnOrder;
            }
            set
            {
                OnUnitsOnOrderChanging(value);
                ReportPropertyChanging("UnitsOnOrder");
                _UnitsOnOrder = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsOnOrder");
                OnUnitsOnOrderChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsOnOrder;
        partial void OnUnitsOnOrderChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsOnOrderChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> ReorderLevel
        {
            get
            {
                return _ReorderLevel;
            }
            set
            {
                OnReorderLevelChanging(value);
                ReportPropertyChanging("ReorderLevel");
                _ReorderLevel = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ReorderLevel");
                OnReorderLevelChanged();
            }
        }
        private Nullable<global::System.Int16> _ReorderLevel;
        partial void OnReorderLevelChanging(Nullable<global::System.Int16> value);
        partial void OnReorderLevelChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Boolean Discontinued
        {
            get
            {
                return _Discontinued;
            }
            set
            {
                OnDiscontinuedChanging(value);
                ReportPropertyChanging("Discontinued");
                _Discontinued = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discontinued");
                OnDiscontinuedChanged();
            }
        }
        private global::System.Boolean _Discontinued;
        partial void OnDiscontinuedChanging(global::System.Boolean value);
        partial void OnDiscontinuedChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> DiscontinuedDate
        {
            get
            {
                return _DiscontinuedDate;
            }
            set
            {
                OnDiscontinuedDateChanging(value);
                ReportPropertyChanging("DiscontinuedDate");
                _DiscontinuedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DiscontinuedDate");
                OnDiscontinuedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _DiscontinuedDate;
        partial void OnDiscontinuedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnDiscontinuedDateChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories")]
        public Categories Categories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Categories> CategoriesReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers")]
        public Suppliers Suppliers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Suppliers> SuppliersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Regions")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Regions : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Regions object.
        /// </summary>
        /// <param name="regionID">Initial value of the RegionID property.</param>
        /// <param name="regionDescription">Initial value of the RegionDescription property.</param>
        public static Regions CreateRegions(global::System.Int64 regionID, global::System.String regionDescription)
        {
            Regions regions = new Regions();
            regions.RegionID = regionID;
            regions.RegionDescription = regionDescription;
            return regions;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 RegionID
        {
            get
            {
                return _RegionID;
            }
            set
            {
                if (_RegionID != value)
                {
                    OnRegionIDChanging(value);
                    ReportPropertyChanging("RegionID");
                    _RegionID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("RegionID");
                    OnRegionIDChanged();
                }
            }
        }
        private global::System.Int64 _RegionID;
        partial void OnRegionIDChanging(global::System.Int64 value);
        partial void OnRegionIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String RegionDescription
        {
            get
            {
                return _RegionDescription;
            }
            set
            {
                OnRegionDescriptionChanging(value);
                ReportPropertyChanging("RegionDescription");
                _RegionDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("RegionDescription");
                OnRegionDescriptionChanged();
            }
        }
        private global::System.String _RegionDescription;
        partial void OnRegionDescriptionChanging(global::System.String value);
        partial void OnRegionDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Suppliers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Suppliers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Suppliers object.
        /// </summary>
        /// <param name="supplierID">Initial value of the SupplierID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Suppliers CreateSuppliers(global::System.Int64 supplierID, global::System.String companyName)
        {
            Suppliers suppliers = new Suppliers();
            suppliers.SupplierID = supplierID;
            suppliers.CompanyName = companyName;
            return suppliers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 SupplierID
        {
            get
            {
                return _SupplierID;
            }
            set
            {
                if (_SupplierID != value)
                {
                    OnSupplierIDChanging(value);
                    ReportPropertyChanging("SupplierID");
                    _SupplierID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("SupplierID");
                    OnSupplierIDChanged();
                }
            }
        }
        private global::System.Int64 _SupplierID;
        partial void OnSupplierIDChanging(global::System.Int64 value);
        partial void OnSupplierIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePage
        {
            get
            {
                return _HomePage;
            }
            set
            {
                OnHomePageChanging(value);
                ReportPropertyChanging("HomePage");
                _HomePage = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePage");
                OnHomePageChanged();
            }
        }
        private global::System.String _HomePage;
        partial void OnHomePageChanging(global::System.String value);
        partial void OnHomePageChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Territories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Territories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Territories object.
        /// </summary>
        /// <param name="territoryID">Initial value of the TerritoryID property.</param>
        /// <param name="territoryDescription">Initial value of the TerritoryDescription property.</param>
        public static Territories CreateTerritories(global::System.Int64 territoryID, global::System.String territoryDescription)
        {
            Territories territories = new Territories();
            territories.TerritoryID = territoryID;
            territories.TerritoryDescription = territoryDescription;
            return territories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 TerritoryID
        {
            get
            {
                return _TerritoryID;
            }
            set
            {
                if (_TerritoryID != value)
                {
                    OnTerritoryIDChanging(value);
                    ReportPropertyChanging("TerritoryID");
                    _TerritoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("TerritoryID");
                    OnTerritoryIDChanged();
                }
            }
        }
        private global::System.Int64 _TerritoryID;
        partial void OnTerritoryIDChanging(global::System.Int64 value);
        partial void OnTerritoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String TerritoryDescription
        {
            get
            {
                return _TerritoryDescription;
            }
            set
            {
                OnTerritoryDescriptionChanging(value);
                ReportPropertyChanging("TerritoryDescription");
                _TerritoryDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("TerritoryDescription");
                OnTerritoryDescriptionChanged();
            }
        }
        private global::System.String _TerritoryDescription;
        partial void OnTerritoryDescriptionChanging(global::System.String value);
        partial void OnTerritoryDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions")]
        public Regions Regions
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Regions> RegionsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Employees")]
        public EntityCollection<Employees> Employees
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees", value);
                }
            }
        }

        #endregion
    }

    #endregion

}

Added testlinq/NorthwindModel.Linq.2013.edmx.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
    <Schema Namespace="northwindEFModel.Store" Alias="Self" Provider="System.Data.SQLite.Linq" ProviderManifestToken="ISO8601" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
        <EntityContainer Name="northwindEFModelStoreContainer">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Store.Categories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Store.Customers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Store.Employees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="EmployeesTerritories" EntityType="northwindEFModel.Store.EmployeesTerritories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.Store.InternationalOrders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.Store.OrderDetails" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Store.Orders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.Store.PreviousEmployees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Store.Products" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Store.Regions" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Store.Suppliers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Store.Territories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <AssociationSet Name="FK_EmployeesTerritories_EmployeeID_EmployeeID" Association="northwindEFModel.Store.FK_EmployeesTerritories_EmployeeID_EmployeeID">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_EmployeesTerritories_TerritoryID_TerritoryID" Association="northwindEFModel.Store.FK_EmployeesTerritories_TerritoryID_TerritoryID">
            <End Role="Territories" EntitySet="Territories" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.Store.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.Store.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.Store.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.Store.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.Store.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.Store.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.Store.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
        </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CategoryName" Type="nvarchar" Nullable="false" MaxLength="15" />
          <Property Name="Description" Type="nvarchar" />
          <Property Name="Picture" Type="blob" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="nvarchar" Nullable="false" MaxLength="5" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="EmployeesTerritories">
          <Key>
            <PropertyRef Name="EmployeeID" />
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="CustomsDescription" Type="nvarchar" Nullable="false" MaxLength="100" />
          <Property Name="ExciseTax" Type="decimal" Nullable="false" Precision="53" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="ProductID" Type="integer" Nullable="false" />
          <Property Name="UnitPrice" Type="decimal" Nullable="false" Precision="53" />
          <Property Name="Quantity" Type="smallint" Nullable="false" />
          <!--
              NOTE: The "Discount" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbInsertCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Discount" Type="real" Nullable="false" StoreGeneratedPattern="Computed" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CustomerID" Type="nvarchar" MaxLength="5" />
          <Property Name="EmployeeID" Type="integer" />
          <Property Name="OrderDate" Type="datetime" />
          <Property Name="RequiredDate" Type="datetime" />
          <Property Name="ShippedDate" Type="datetime" />
          <!--
              NOTE: The "Freight" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbUpdateCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Freight" Type="decimal" Precision="53" StoreGeneratedPattern="Computed" />
          <Property Name="ShipName" Type="nvarchar" MaxLength="40" />
          <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" />
          <Property Name="ShipCity" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="ProductName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="SupplierID" Type="integer" />
          <Property Name="CategoryID" Type="integer" />
          <Property Name="QuantityPerUnit" Type="nvarchar" MaxLength="20" />
          <Property Name="UnitPrice" Type="decimal" Precision="53" />
          <Property Name="UnitsInStock" Type="smallint" />
          <Property Name="UnitsOnOrder" Type="smallint" />
          <Property Name="ReorderLevel" Type="smallint" />
          <Property Name="Discontinued" Type="bit" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="datetime" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="integer" Nullable="false" />
          <Property Name="RegionDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
          <Property Name="HomePage" Type="nvarchar" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
          <Property Name="TerritoryDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
          <Property Name="RegionID" Type="integer" Nullable="false" />
        </EntityType>
        <Association Name="FK_EmployeesTerritories_EmployeeID_EmployeeID">
          <End Role="Employees" Type="northwindEFModel.Store.Employees" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Employees">
              <PropertyRef Name="EmployeeID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="EmployeeID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_EmployeesTerritories_TerritoryID_TerritoryID">
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Territories">
              <PropertyRef Name="TerritoryID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="TerritoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.Store.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Store.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Customers">
              <PropertyRef Name="CustomerID" />
            </Principal>
            <Dependent Role="Orders">
              <PropertyRef Name="CustomerID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Store.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Categories">
              <PropertyRef Name="CategoryID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="CategoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Store.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Suppliers">
              <PropertyRef Name="SupplierID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="SupplierID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Store.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Regions">
              <PropertyRef Name="RegionID" />
            </Principal>
            <Dependent Role="Territories">
              <PropertyRef Name="RegionID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
      </Schema></edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="northwindEFModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
        <EntityContainer Name="northwindEFEntities">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Categories" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Customers" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Employees" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.InternationalOrders" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.OrderDetails" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Orders" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.PreviousEmployees" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Products" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Regions" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Suppliers" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Territories" />
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          <AssociationSet Name="EmployeesTerritories" Association="northwindEFModel.EmployeesTerritories">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="Int64" Nullable="false" />
          <Property Name="CategoryName" Type="String" Nullable="false" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Description" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="Picture" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Categories" ToRole="Products" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="String" Nullable="false" MaxLength="5" Unicode="true" FixedLength="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Customers" ToRole="Orders" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Employees" ToRole="Territories" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="CustomsDescription" Type="String" Nullable="false" MaxLength="100" Unicode="true" FixedLength="false" />
          <Property Name="ExciseTax" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="InternationalOrders" ToRole="Orders" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="UnitPrice" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <Property Name="Quantity" Type="Int16" Nullable="false" />
          <Property Name="Discount" Type="Single" Nullable="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="OrderDetails" ToRole="Orders" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="OrderDetails" ToRole="Products" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="EmployeeID" Type="Int64" />
          <Property Name="OrderDate" Type="DateTime" />
          <Property Name="RequiredDate" Type="DateTime" />
          <Property Name="ShippedDate" Type="DateTime" />
          <Property Name="Freight" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="ShipName" Type="String" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ShipAddress" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="ShipCity" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipRegion" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipPostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="ShipCountry" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Customers" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Orders" ToRole="Customers" />
          <NavigationProperty Name="InternationalOrders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="Orders" ToRole="InternationalOrders" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="Orders" ToRole="OrderDetails" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="ProductName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="QuantityPerUnit" Type="String" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="UnitPrice" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="UnitsInStock" Type="Int16" />
          <Property Name="UnitsOnOrder" Type="Int16" />
          <Property Name="ReorderLevel" Type="Int16" />
          <Property Name="Discontinued" Type="Boolean" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="DateTime" />
          <NavigationProperty Name="Categories" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Products" ToRole="Categories" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="Products" ToRole="OrderDetails" />
          <NavigationProperty Name="Suppliers" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Products" ToRole="Suppliers" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="Int64" Nullable="false" />
          <Property Name="RegionDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Regions" ToRole="Territories" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="Int64" Nullable="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="HomePage" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Suppliers" ToRole="Products" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="Int64" Nullable="false" />
          <Property Name="TerritoryDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Regions" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Territories" ToRole="Regions" />
          <NavigationProperty Name="Employees" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Territories" ToRole="Employees" />
        </EntityType>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="*" />
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        <Association Name="EmployeesTerritories">
          <End Role="Employees" Type="northwindEFModel.Employees" Multiplicity="*" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        </Schema>
    </edmx:ConceptualModels>
    <!-- C-S mapping content -->
    <edmx:Mappings>
      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
        <EntityContainerMapping StorageEntityContainer="northwindEFModelStoreContainer" CdmEntityContainer="northwindEFEntities">
          <EntitySetMapping Name="Categories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Categories)">
              <MappingFragment StoreEntitySet="Categories">
                <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
                <ScalarProperty Name="CategoryName" ColumnName="CategoryName" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="Picture" ColumnName="Picture" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Customers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Customers)">
              <MappingFragment StoreEntitySet="Customers">
                <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Employees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Employees)">
              <MappingFragment StoreEntitySet="Employees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="InternationalOrders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.InternationalOrders)">
              <MappingFragment StoreEntitySet="InternationalOrders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="CustomsDescription" ColumnName="CustomsDescription" />
                <ScalarProperty Name="ExciseTax" ColumnName="ExciseTax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="OrderDetails">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.OrderDetails)">
              <MappingFragment StoreEntitySet="OrderDetails">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="Quantity" ColumnName="Quantity" />
                <ScalarProperty Name="Discount" ColumnName="Discount" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Orders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Orders)">
              <MappingFragment StoreEntitySet="Orders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="OrderDate" ColumnName="OrderDate" />
                <ScalarProperty Name="RequiredDate" ColumnName="RequiredDate" />
                <ScalarProperty Name="ShippedDate" ColumnName="ShippedDate" />
                <ScalarProperty Name="Freight" ColumnName="Freight" />
                <ScalarProperty Name="ShipName" ColumnName="ShipName" />
                <ScalarProperty Name="ShipAddress" ColumnName="ShipAddress" />
                <ScalarProperty Name="ShipCity" ColumnName="ShipCity" />
                <ScalarProperty Name="ShipRegion" ColumnName="ShipRegion" />
                <ScalarProperty Name="ShipPostalCode" ColumnName="ShipPostalCode" />
                <ScalarProperty Name="ShipCountry" ColumnName="ShipCountry" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="PreviousEmployees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.PreviousEmployees)">
              <MappingFragment StoreEntitySet="PreviousEmployees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Products">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Products)">
              <MappingFragment StoreEntitySet="Products">
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="ProductName" ColumnName="ProductName" />
                <ScalarProperty Name="QuantityPerUnit" ColumnName="QuantityPerUnit" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="UnitsInStock" ColumnName="UnitsInStock" />
                <ScalarProperty Name="UnitsOnOrder" ColumnName="UnitsOnOrder" />
                <ScalarProperty Name="ReorderLevel" ColumnName="ReorderLevel" />
                <ScalarProperty Name="Discontinued" ColumnName="Discontinued" />
                <ScalarProperty Name="DiscontinuedDate" ColumnName="DiscontinuedDate" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Regions">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Regions)">
              <MappingFragment StoreEntitySet="Regions">
                <ScalarProperty Name="RegionID" ColumnName="RegionID" />
                <ScalarProperty Name="RegionDescription" ColumnName="RegionDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Suppliers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Suppliers)">
              <MappingFragment StoreEntitySet="Suppliers">
                <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
                <ScalarProperty Name="HomePage" ColumnName="HomePage" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Territories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Territories)">
              <MappingFragment StoreEntitySet="Territories">
                <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
                <ScalarProperty Name="TerritoryDescription" ColumnName="TerritoryDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <AssociationSetMapping Name="FK_Products_CategoryID_CategoryID" TypeName="northwindEFModel.FK_Products_CategoryID_CategoryID" StoreEntitySet="Products">
            <EndProperty Name="Categories">
              <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="CategoryID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Orders_CustomerID_CustomerID" TypeName="northwindEFModel.FK_Orders_CustomerID_CustomerID" StoreEntitySet="Orders">
            <EndProperty Name="Customers">
              <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
            </EndProperty>
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <Condition ColumnName="CustomerID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_InternationalOrders_OrderID_OrderID" TypeName="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" StoreEntitySet="InternationalOrders">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="InternationalOrders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_OrderID_OrderID" TypeName="northwindEFModel.FK_OrderDetails_OrderID_OrderID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_ProductID_ProductID" TypeName="northwindEFModel.FK_OrderDetails_ProductID_ProductID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Products_SupplierID_SupplierID" TypeName="northwindEFModel.FK_Products_SupplierID_SupplierID" StoreEntitySet="Products">
            <EndProperty Name="Suppliers">
              <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="SupplierID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Territories_RegionID_RegionID" TypeName="northwindEFModel.FK_Territories_RegionID_RegionID" StoreEntitySet="Territories">
            <EndProperty Name="Regions">
              <ScalarProperty Name="RegionID" ColumnName="RegionID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="EmployeesTerritories" TypeName="northwindEFModel.EmployeesTerritories" StoreEntitySet="EmployeesTerritories">
            <EndProperty Name="Employees">
              <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          </EntityContainerMapping>
      </Mapping>
    </edmx:Mappings>
  </edmx:Runtime>
  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
  <edmx:Designer>
    <edmx:Connection>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </edmx:Connection>
    <edmx:Options>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
      </DesignerInfoPropertySet>
    </edmx:Options>
    <!-- Diagram content (shape and connector positions) -->
    <edmx:Diagrams>
      <Diagram Name="NorthwindModel" xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <EntityTypeShape EntityType="northwindEFModel.Categories" Width="1.5" PointX="0.75" PointY="1.625" Height="1.9802864583333335" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Customers" Width="1.5" PointX="0.75" PointY="9.625" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Employees" Width="1.5" PointX="2.75" PointY="14.625" Height="4.4802050781250014" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.InternationalOrders" Width="1.5" PointX="5.25" PointY="10.375" Height="1.7879850260416674" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.OrderDetails" Width="1.5" PointX="5.25" PointY="1.5" Height="2.3648893229166656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Orders" Width="1.5" PointX="3" PointY="9.25" Height="3.9033007812499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.PreviousEmployees" Width="1.5" PointX="7.75" PointY="0.75" Height="4.2879036458333317" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Products" Width="1.5" PointX="3" PointY="1" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Regions" Width="1.5" PointX="2.75" PointY="6" Height="1.5956835937499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Suppliers" Width="1.5" PointX="0.75" PointY="4.875" Height="3.5186979166666656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Territories" Width="1.5" PointX="5" PointY="5.875" Height="1.7879850260416674" IsExpanded="true" />
        <AssociationConnector Association="northwindEFModel.FK_Products_CategoryID_CategoryID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="2.6151432291666667" />
          <ConnectorPoint PointX="3" PointY="2.6151432291666667" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Orders_CustomerID_CustomerID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="11.2881982421875" />
          <ConnectorPoint PointX="3" PointY="11.2881982421875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.010416666666667" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.177083333333333" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.25" PointY="11.268992513020834" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="3.75" PointY="9.25" />
          <ConnectorPoint PointX="3.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="2.6824446614583328" />
          <ConnectorPoint PointX="5.25" PointY="2.6824446614583328" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="2.0287223307291664" />
          <ConnectorPoint PointX="5.25" PointY="2.0287223307291664" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Products_SupplierID_SupplierID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="4.326396484375" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Territories_RegionID_RegionID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="6.797841796875" />
          <ConnectorPoint PointX="4.666666666666667" PointY="6.7978417968749989" />
          <ConnectorPoint PointX="4.833333333333333" PointY="6.797841796875" />
          <ConnectorPoint PointX="5" PointY="6.797841796875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.EmployeesTerritories" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="7.6629850260416674" /></AssociationConnector>
        </Diagram></edmx:Diagrams>
  </edmx:Designer>
</edmx:Edmx>

Added testlinq/NorthwindModel.Linq.2015.Designer.cs.





































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

//------------------------------------------------------------------------------
// <auto-generated>
//    This code was generated from a template.
//
//    Manual changes to this file may cause unexpected behavior in your application.
//    Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.ComponentModel;
using System.Data.EntityClient;
using System.Data.Metadata.Edm;
using System.Data.Objects;
using System.Data.Objects.DataClasses;
using System.Runtime.Serialization;
using System.Xml.Serialization;

[assembly: EdmSchemaAttribute()]
#region EDM Relationship Metadata

[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Categories), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Customers), "Orders", RelationshipMultiplicity.Many, typeof(testlinq.Orders))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "InternationalOrders", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.InternationalOrders), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products", RelationshipMultiplicity.One, typeof(testlinq.Products), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Suppliers), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions", RelationshipMultiplicity.One, typeof(testlinq.Regions), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "EmployeesTerritories", "Employees", RelationshipMultiplicity.Many, typeof(testlinq.Employees), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]

#endregion

namespace testlinq
{
    #region Contexts

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    public partial class northwindEFEntities : ObjectContext
    {
        #region Constructors

        /// <summary>
        /// Initializes a new northwindEFEntities object using the connection string found in the 'northwindEFEntities' section of the application configuration file.
        /// </summary>
        public northwindEFEntities() : base("name=northwindEFEntities", "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(string connectionString) : base(connectionString, "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(EntityConnection connection) : base(connection, "northwindEFEntities")
        {
            OnContextCreated();
        }

        #endregion

        #region Partial Methods

        partial void OnContextCreated();

        #endregion

        #region ObjectSet Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Categories> Categories
        {
            get
            {
                if ((_Categories == null))
                {
                    _Categories = base.CreateObjectSet<Categories>("Categories");
                }
                return _Categories;
            }
        }
        private ObjectSet<Categories> _Categories;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Customers> Customers
        {
            get
            {
                if ((_Customers == null))
                {
                    _Customers = base.CreateObjectSet<Customers>("Customers");
                }
                return _Customers;
            }
        }
        private ObjectSet<Customers> _Customers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Employees> Employees
        {
            get
            {
                if ((_Employees == null))
                {
                    _Employees = base.CreateObjectSet<Employees>("Employees");
                }
                return _Employees;
            }
        }
        private ObjectSet<Employees> _Employees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<InternationalOrders> InternationalOrders
        {
            get
            {
                if ((_InternationalOrders == null))
                {
                    _InternationalOrders = base.CreateObjectSet<InternationalOrders>("InternationalOrders");
                }
                return _InternationalOrders;
            }
        }
        private ObjectSet<InternationalOrders> _InternationalOrders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<OrderDetails> OrderDetails
        {
            get
            {
                if ((_OrderDetails == null))
                {
                    _OrderDetails = base.CreateObjectSet<OrderDetails>("OrderDetails");
                }
                return _OrderDetails;
            }
        }
        private ObjectSet<OrderDetails> _OrderDetails;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Orders> Orders
        {
            get
            {
                if ((_Orders == null))
                {
                    _Orders = base.CreateObjectSet<Orders>("Orders");
                }
                return _Orders;
            }
        }
        private ObjectSet<Orders> _Orders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<PreviousEmployees> PreviousEmployees
        {
            get
            {
                if ((_PreviousEmployees == null))
                {
                    _PreviousEmployees = base.CreateObjectSet<PreviousEmployees>("PreviousEmployees");
                }
                return _PreviousEmployees;
            }
        }
        private ObjectSet<PreviousEmployees> _PreviousEmployees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Products> Products
        {
            get
            {
                if ((_Products == null))
                {
                    _Products = base.CreateObjectSet<Products>("Products");
                }
                return _Products;
            }
        }
        private ObjectSet<Products> _Products;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Regions> Regions
        {
            get
            {
                if ((_Regions == null))
                {
                    _Regions = base.CreateObjectSet<Regions>("Regions");
                }
                return _Regions;
            }
        }
        private ObjectSet<Regions> _Regions;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Suppliers> Suppliers
        {
            get
            {
                if ((_Suppliers == null))
                {
                    _Suppliers = base.CreateObjectSet<Suppliers>("Suppliers");
                }
                return _Suppliers;
            }
        }
        private ObjectSet<Suppliers> _Suppliers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Territories> Territories
        {
            get
            {
                if ((_Territories == null))
                {
                    _Territories = base.CreateObjectSet<Territories>("Territories");
                }
                return _Territories;
            }
        }
        private ObjectSet<Territories> _Territories;

        #endregion
        #region AddTo Methods

        /// <summary>
        /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCategories(Categories categories)
        {
            base.AddObject("Categories", categories);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Customers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCustomers(Customers customers)
        {
            base.AddObject("Customers", customers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Employees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToEmployees(Employees employees)
        {
            base.AddObject("Employees", employees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the InternationalOrders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToInternationalOrders(InternationalOrders internationalOrders)
        {
            base.AddObject("InternationalOrders", internationalOrders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the OrderDetails EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrderDetails(OrderDetails orderDetails)
        {
            base.AddObject("OrderDetails", orderDetails);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Orders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrders(Orders orders)
        {
            base.AddObject("Orders", orders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the PreviousEmployees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToPreviousEmployees(PreviousEmployees previousEmployees)
        {
            base.AddObject("PreviousEmployees", previousEmployees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToProducts(Products products)
        {
            base.AddObject("Products", products);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Regions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToRegions(Regions regions)
        {
            base.AddObject("Regions", regions);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Suppliers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToSuppliers(Suppliers suppliers)
        {
            base.AddObject("Suppliers", suppliers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Territories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToTerritories(Territories territories)
        {
            base.AddObject("Territories", territories);
        }

        #endregion
    }


    #endregion

    #region Entities

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Categories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Categories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Categories object.
        /// </summary>
        /// <param name="categoryID">Initial value of the CategoryID property.</param>
        /// <param name="categoryName">Initial value of the CategoryName property.</param>
        public static Categories CreateCategories(global::System.Int64 categoryID, global::System.String categoryName)
        {
            Categories categories = new Categories();
            categories.CategoryID = categoryID;
            categories.CategoryName = categoryName;
            return categories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 CategoryID
        {
            get
            {
                return _CategoryID;
            }
            set
            {
                if (_CategoryID != value)
                {
                    OnCategoryIDChanging(value);
                    ReportPropertyChanging("CategoryID");
                    _CategoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("CategoryID");
                    OnCategoryIDChanged();
                }
            }
        }
        private global::System.Int64 _CategoryID;
        partial void OnCategoryIDChanging(global::System.Int64 value);
        partial void OnCategoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CategoryName
        {
            get
            {
                return _CategoryName;
            }
            set
            {
                OnCategoryNameChanging(value);
                ReportPropertyChanging("CategoryName");
                _CategoryName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CategoryName");
                OnCategoryNameChanged();
            }
        }
        private global::System.String _CategoryName;
        partial void OnCategoryNameChanging(global::System.String value);
        partial void OnCategoryNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Description
        {
            get
            {
                return _Description;
            }
            set
            {
                OnDescriptionChanging(value);
                ReportPropertyChanging("Description");
                _Description = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Description");
                OnDescriptionChanged();
            }
        }
        private global::System.String _Description;
        partial void OnDescriptionChanging(global::System.String value);
        partial void OnDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Picture
        {
            get
            {
                return StructuralObject.GetValidValue(_Picture);
            }
            set
            {
                OnPictureChanging(value);
                ReportPropertyChanging("Picture");
                _Picture = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Picture");
                OnPictureChanged();
            }
        }
        private global::System.Byte[] _Picture;
        partial void OnPictureChanging(global::System.Byte[] value);
        partial void OnPictureChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Customers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Customers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Customers object.
        /// </summary>
        /// <param name="customerID">Initial value of the CustomerID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Customers CreateCustomers(global::System.String customerID, global::System.String companyName)
        {
            Customers customers = new Customers();
            customers.CustomerID = customerID;
            customers.CompanyName = companyName;
            return customers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomerID
        {
            get
            {
                return _CustomerID;
            }
            set
            {
                if (_CustomerID != value)
                {
                    OnCustomerIDChanging(value);
                    ReportPropertyChanging("CustomerID");
                    _CustomerID = StructuralObject.SetValidValue(value, false);
                    ReportPropertyChanged("CustomerID");
                    OnCustomerIDChanged();
                }
            }
        }
        private global::System.String _CustomerID;
        partial void OnCustomerIDChanging(global::System.String value);
        partial void OnCustomerIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Orders")]
        public EntityCollection<Orders> Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Employees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Employees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Employees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static Employees CreateEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            Employees employees = new Employees();
            employees.EmployeeID = employeeID;
            employees.LastName = lastName;
            employees.FirstName = firstName;
            return employees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="InternationalOrders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class InternationalOrders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new InternationalOrders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="customsDescription">Initial value of the CustomsDescription property.</param>
        /// <param name="exciseTax">Initial value of the ExciseTax property.</param>
        public static InternationalOrders CreateInternationalOrders(global::System.Int64 orderID, global::System.String customsDescription, global::System.Decimal exciseTax)
        {
            InternationalOrders internationalOrders = new InternationalOrders();
            internationalOrders.OrderID = orderID;
            internationalOrders.CustomsDescription = customsDescription;
            internationalOrders.ExciseTax = exciseTax;
            return internationalOrders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomsDescription
        {
            get
            {
                return _CustomsDescription;
            }
            set
            {
                OnCustomsDescriptionChanging(value);
                ReportPropertyChanging("CustomsDescription");
                _CustomsDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CustomsDescription");
                OnCustomsDescriptionChanged();
            }
        }
        private global::System.String _CustomsDescription;
        partial void OnCustomsDescriptionChanging(global::System.String value);
        partial void OnCustomsDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal ExciseTax
        {
            get
            {
                return _ExciseTax;
            }
            set
            {
                OnExciseTaxChanging(value);
                ReportPropertyChanging("ExciseTax");
                _ExciseTax = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ExciseTax");
                OnExciseTaxChanged();
            }
        }
        private global::System.Decimal _ExciseTax;
        partial void OnExciseTaxChanging(global::System.Decimal value);
        partial void OnExciseTaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="OrderDetails")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class OrderDetails : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new OrderDetails object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="unitPrice">Initial value of the UnitPrice property.</param>
        /// <param name="quantity">Initial value of the Quantity property.</param>
        /// <param name="discount">Initial value of the Discount property.</param>
        public static OrderDetails CreateOrderDetails(global::System.Int64 orderID, global::System.Int64 productID, global::System.Decimal unitPrice, global::System.Int16 quantity, global::System.Single discount)
        {
            OrderDetails orderDetails = new OrderDetails();
            orderDetails.OrderID = orderID;
            orderDetails.ProductID = productID;
            orderDetails.UnitPrice = unitPrice;
            orderDetails.Quantity = quantity;
            orderDetails.Discount = discount;
            return orderDetails;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private global::System.Decimal _UnitPrice;
        partial void OnUnitPriceChanging(global::System.Decimal value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int16 Quantity
        {
            get
            {
                return _Quantity;
            }
            set
            {
                OnQuantityChanging(value);
                ReportPropertyChanging("Quantity");
                _Quantity = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Quantity");
                OnQuantityChanged();
            }
        }
        private global::System.Int16 _Quantity;
        partial void OnQuantityChanging(global::System.Int16 value);
        partial void OnQuantityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Single Discount
        {
            get
            {
                return _Discount;
            }
            set
            {
                OnDiscountChanging(value);
                ReportPropertyChanging("Discount");
                _Discount = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discount");
                OnDiscountChanged();
            }
        }
        private global::System.Single _Discount;
        partial void OnDiscountChanging(global::System.Single value);
        partial void OnDiscountChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products")]
        public Products Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Products> ProductsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Orders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Orders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Orders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        public static Orders CreateOrders(global::System.Int64 orderID)
        {
            Orders orders = new Orders();
            orders.OrderID = orderID;
            return orders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int64> EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                OnEmployeeIDChanging(value);
                ReportPropertyChanging("EmployeeID");
                _EmployeeID = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("EmployeeID");
                OnEmployeeIDChanged();
            }
        }
        private Nullable<global::System.Int64> _EmployeeID;
        partial void OnEmployeeIDChanging(Nullable<global::System.Int64> value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> OrderDate
        {
            get
            {
                return _OrderDate;
            }
            set
            {
                OnOrderDateChanging(value);
                ReportPropertyChanging("OrderDate");
                _OrderDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("OrderDate");
                OnOrderDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _OrderDate;
        partial void OnOrderDateChanging(Nullable<global::System.DateTime> value);
        partial void OnOrderDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> RequiredDate
        {
            get
            {
                return _RequiredDate;
            }
            set
            {
                OnRequiredDateChanging(value);
                ReportPropertyChanging("RequiredDate");
                _RequiredDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("RequiredDate");
                OnRequiredDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _RequiredDate;
        partial void OnRequiredDateChanging(Nullable<global::System.DateTime> value);
        partial void OnRequiredDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> ShippedDate
        {
            get
            {
                return _ShippedDate;
            }
            set
            {
                OnShippedDateChanging(value);
                ReportPropertyChanging("ShippedDate");
                _ShippedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ShippedDate");
                OnShippedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _ShippedDate;
        partial void OnShippedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnShippedDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> Freight
        {
            get
            {
                return _Freight;
            }
            set
            {
                OnFreightChanging(value);
                ReportPropertyChanging("Freight");
                _Freight = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Freight");
                OnFreightChanged();
            }
        }
        private Nullable<global::System.Decimal> _Freight;
        partial void OnFreightChanging(Nullable<global::System.Decimal> value);
        partial void OnFreightChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipName
        {
            get
            {
                return _ShipName;
            }
            set
            {
                OnShipNameChanging(value);
                ReportPropertyChanging("ShipName");
                _ShipName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipName");
                OnShipNameChanged();
            }
        }
        private global::System.String _ShipName;
        partial void OnShipNameChanging(global::System.String value);
        partial void OnShipNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipAddress
        {
            get
            {
                return _ShipAddress;
            }
            set
            {
                OnShipAddressChanging(value);
                ReportPropertyChanging("ShipAddress");
                _ShipAddress = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipAddress");
                OnShipAddressChanged();
            }
        }
        private global::System.String _ShipAddress;
        partial void OnShipAddressChanging(global::System.String value);
        partial void OnShipAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCity
        {
            get
            {
                return _ShipCity;
            }
            set
            {
                OnShipCityChanging(value);
                ReportPropertyChanging("ShipCity");
                _ShipCity = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCity");
                OnShipCityChanged();
            }
        }
        private global::System.String _ShipCity;
        partial void OnShipCityChanging(global::System.String value);
        partial void OnShipCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipRegion
        {
            get
            {
                return _ShipRegion;
            }
            set
            {
                OnShipRegionChanging(value);
                ReportPropertyChanging("ShipRegion");
                _ShipRegion = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipRegion");
                OnShipRegionChanged();
            }
        }
        private global::System.String _ShipRegion;
        partial void OnShipRegionChanging(global::System.String value);
        partial void OnShipRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipPostalCode
        {
            get
            {
                return _ShipPostalCode;
            }
            set
            {
                OnShipPostalCodeChanging(value);
                ReportPropertyChanging("ShipPostalCode");
                _ShipPostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipPostalCode");
                OnShipPostalCodeChanged();
            }
        }
        private global::System.String _ShipPostalCode;
        partial void OnShipPostalCodeChanging(global::System.String value);
        partial void OnShipPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCountry
        {
            get
            {
                return _ShipCountry;
            }
            set
            {
                OnShipCountryChanging(value);
                ReportPropertyChanging("ShipCountry");
                _ShipCountry = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCountry");
                OnShipCountryChanged();
            }
        }
        private global::System.String _ShipCountry;
        partial void OnShipCountryChanging(global::System.String value);
        partial void OnShipCountryChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers")]
        public Customers Customers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Customers> CustomersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "InternationalOrders")]
        public InternationalOrders InternationalOrders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<InternationalOrders> InternationalOrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="PreviousEmployees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class PreviousEmployees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new PreviousEmployees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static PreviousEmployees CreatePreviousEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            PreviousEmployees previousEmployees = new PreviousEmployees();
            previousEmployees.EmployeeID = employeeID;
            previousEmployees.LastName = lastName;
            previousEmployees.FirstName = firstName;
            return previousEmployees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Products")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Products : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Products object.
        /// </summary>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="productName">Initial value of the ProductName property.</param>
        /// <param name="discontinued">Initial value of the Discontinued property.</param>
        public static Products CreateProducts(global::System.Int64 productID, global::System.String productName, global::System.Boolean discontinued)
        {
            Products products = new Products();
            products.ProductID = productID;
            products.ProductName = productName;
            products.Discontinued = discontinued;
            return products;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String ProductName
        {
            get
            {
                return _ProductName;
            }
            set
            {
                OnProductNameChanging(value);
                ReportPropertyChanging("ProductName");
                _ProductName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("ProductName");
                OnProductNameChanged();
            }
        }
        private global::System.String _ProductName;
        partial void OnProductNameChanging(global::System.String value);
        partial void OnProductNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String QuantityPerUnit
        {
            get
            {
                return _QuantityPerUnit;
            }
            set
            {
                OnQuantityPerUnitChanging(value);
                ReportPropertyChanging("QuantityPerUnit");
                _QuantityPerUnit = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("QuantityPerUnit");
                OnQuantityPerUnitChanged();
            }
        }
        private global::System.String _QuantityPerUnit;
        partial void OnQuantityPerUnitChanging(global::System.String value);
        partial void OnQuantityPerUnitChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private Nullable<global::System.Decimal> _UnitPrice;
        partial void OnUnitPriceChanging(Nullable<global::System.Decimal> value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsInStock
        {
            get
            {
                return _UnitsInStock;
            }
            set
            {
                OnUnitsInStockChanging(value);
                ReportPropertyChanging("UnitsInStock");
                _UnitsInStock = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsInStock");
                OnUnitsInStockChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsInStock;
        partial void OnUnitsInStockChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsInStockChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsOnOrder
        {
            get
            {
                return _UnitsOnOrder;
            }
            set
            {
                OnUnitsOnOrderChanging(value);
                ReportPropertyChanging("UnitsOnOrder");
                _UnitsOnOrder = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsOnOrder");
                OnUnitsOnOrderChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsOnOrder;
        partial void OnUnitsOnOrderChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsOnOrderChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> ReorderLevel
        {
            get
            {
                return _ReorderLevel;
            }
            set
            {
                OnReorderLevelChanging(value);
                ReportPropertyChanging("ReorderLevel");
                _ReorderLevel = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ReorderLevel");
                OnReorderLevelChanged();
            }
        }
        private Nullable<global::System.Int16> _ReorderLevel;
        partial void OnReorderLevelChanging(Nullable<global::System.Int16> value);
        partial void OnReorderLevelChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Boolean Discontinued
        {
            get
            {
                return _Discontinued;
            }
            set
            {
                OnDiscontinuedChanging(value);
                ReportPropertyChanging("Discontinued");
                _Discontinued = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discontinued");
                OnDiscontinuedChanged();
            }
        }
        private global::System.Boolean _Discontinued;
        partial void OnDiscontinuedChanging(global::System.Boolean value);
        partial void OnDiscontinuedChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> DiscontinuedDate
        {
            get
            {
                return _DiscontinuedDate;
            }
            set
            {
                OnDiscontinuedDateChanging(value);
                ReportPropertyChanging("DiscontinuedDate");
                _DiscontinuedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DiscontinuedDate");
                OnDiscontinuedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _DiscontinuedDate;
        partial void OnDiscontinuedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnDiscontinuedDateChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories")]
        public Categories Categories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Categories> CategoriesReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers")]
        public Suppliers Suppliers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Suppliers> SuppliersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Regions")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Regions : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Regions object.
        /// </summary>
        /// <param name="regionID">Initial value of the RegionID property.</param>
        /// <param name="regionDescription">Initial value of the RegionDescription property.</param>
        public static Regions CreateRegions(global::System.Int64 regionID, global::System.String regionDescription)
        {
            Regions regions = new Regions();
            regions.RegionID = regionID;
            regions.RegionDescription = regionDescription;
            return regions;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 RegionID
        {
            get
            {
                return _RegionID;
            }
            set
            {
                if (_RegionID != value)
                {
                    OnRegionIDChanging(value);
                    ReportPropertyChanging("RegionID");
                    _RegionID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("RegionID");
                    OnRegionIDChanged();
                }
            }
        }
        private global::System.Int64 _RegionID;
        partial void OnRegionIDChanging(global::System.Int64 value);
        partial void OnRegionIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String RegionDescription
        {
            get
            {
                return _RegionDescription;
            }
            set
            {
                OnRegionDescriptionChanging(value);
                ReportPropertyChanging("RegionDescription");
                _RegionDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("RegionDescription");
                OnRegionDescriptionChanged();
            }
        }
        private global::System.String _RegionDescription;
        partial void OnRegionDescriptionChanging(global::System.String value);
        partial void OnRegionDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Suppliers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Suppliers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Suppliers object.
        /// </summary>
        /// <param name="supplierID">Initial value of the SupplierID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Suppliers CreateSuppliers(global::System.Int64 supplierID, global::System.String companyName)
        {
            Suppliers suppliers = new Suppliers();
            suppliers.SupplierID = supplierID;
            suppliers.CompanyName = companyName;
            return suppliers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 SupplierID
        {
            get
            {
                return _SupplierID;
            }
            set
            {
                if (_SupplierID != value)
                {
                    OnSupplierIDChanging(value);
                    ReportPropertyChanging("SupplierID");
                    _SupplierID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("SupplierID");
                    OnSupplierIDChanged();
                }
            }
        }
        private global::System.Int64 _SupplierID;
        partial void OnSupplierIDChanging(global::System.Int64 value);
        partial void OnSupplierIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePage
        {
            get
            {
                return _HomePage;
            }
            set
            {
                OnHomePageChanging(value);
                ReportPropertyChanging("HomePage");
                _HomePage = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePage");
                OnHomePageChanged();
            }
        }
        private global::System.String _HomePage;
        partial void OnHomePageChanging(global::System.String value);
        partial void OnHomePageChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Territories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Territories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Territories object.
        /// </summary>
        /// <param name="territoryID">Initial value of the TerritoryID property.</param>
        /// <param name="territoryDescription">Initial value of the TerritoryDescription property.</param>
        public static Territories CreateTerritories(global::System.Int64 territoryID, global::System.String territoryDescription)
        {
            Territories territories = new Territories();
            territories.TerritoryID = territoryID;
            territories.TerritoryDescription = territoryDescription;
            return territories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 TerritoryID
        {
            get
            {
                return _TerritoryID;
            }
            set
            {
                if (_TerritoryID != value)
                {
                    OnTerritoryIDChanging(value);
                    ReportPropertyChanging("TerritoryID");
                    _TerritoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("TerritoryID");
                    OnTerritoryIDChanged();
                }
            }
        }
        private global::System.Int64 _TerritoryID;
        partial void OnTerritoryIDChanging(global::System.Int64 value);
        partial void OnTerritoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String TerritoryDescription
        {
            get
            {
                return _TerritoryDescription;
            }
            set
            {
                OnTerritoryDescriptionChanging(value);
                ReportPropertyChanging("TerritoryDescription");
                _TerritoryDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("TerritoryDescription");
                OnTerritoryDescriptionChanged();
            }
        }
        private global::System.String _TerritoryDescription;
        partial void OnTerritoryDescriptionChanging(global::System.String value);
        partial void OnTerritoryDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions")]
        public Regions Regions
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Regions> RegionsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Employees")]
        public EntityCollection<Employees> Employees
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees", value);
                }
            }
        }

        #endregion
    }

    #endregion

}

Added testlinq/NorthwindModel.Linq.2015.edmx.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
    <Schema Namespace="northwindEFModel.Store" Alias="Self" Provider="System.Data.SQLite.Linq" ProviderManifestToken="ISO8601" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
        <EntityContainer Name="northwindEFModelStoreContainer">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Store.Categories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Store.Customers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Store.Employees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="EmployeesTerritories" EntityType="northwindEFModel.Store.EmployeesTerritories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.Store.InternationalOrders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.Store.OrderDetails" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Store.Orders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.Store.PreviousEmployees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Store.Products" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Store.Regions" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Store.Suppliers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Store.Territories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <AssociationSet Name="FK_EmployeesTerritories_EmployeeID_EmployeeID" Association="northwindEFModel.Store.FK_EmployeesTerritories_EmployeeID_EmployeeID">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_EmployeesTerritories_TerritoryID_TerritoryID" Association="northwindEFModel.Store.FK_EmployeesTerritories_TerritoryID_TerritoryID">
            <End Role="Territories" EntitySet="Territories" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.Store.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.Store.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.Store.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.Store.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.Store.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.Store.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.Store.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
        </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CategoryName" Type="nvarchar" Nullable="false" MaxLength="15" />
          <Property Name="Description" Type="nvarchar" />
          <Property Name="Picture" Type="blob" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="nvarchar" Nullable="false" MaxLength="5" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="EmployeesTerritories">
          <Key>
            <PropertyRef Name="EmployeeID" />
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="CustomsDescription" Type="nvarchar" Nullable="false" MaxLength="100" />
          <Property Name="ExciseTax" Type="decimal" Nullable="false" Precision="53" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="ProductID" Type="integer" Nullable="false" />
          <Property Name="UnitPrice" Type="decimal" Nullable="false" Precision="53" />
          <Property Name="Quantity" Type="smallint" Nullable="false" />
          <!--
              NOTE: The "Discount" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbInsertCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Discount" Type="real" Nullable="false" StoreGeneratedPattern="Computed" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CustomerID" Type="nvarchar" MaxLength="5" />
          <Property Name="EmployeeID" Type="integer" />
          <Property Name="OrderDate" Type="datetime" />
          <Property Name="RequiredDate" Type="datetime" />
          <Property Name="ShippedDate" Type="datetime" />
          <!--
              NOTE: The "Freight" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbUpdateCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Freight" Type="decimal" Precision="53" StoreGeneratedPattern="Computed" />
          <Property Name="ShipName" Type="nvarchar" MaxLength="40" />
          <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" />
          <Property Name="ShipCity" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="ProductName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="SupplierID" Type="integer" />
          <Property Name="CategoryID" Type="integer" />
          <Property Name="QuantityPerUnit" Type="nvarchar" MaxLength="20" />
          <Property Name="UnitPrice" Type="decimal" Precision="53" />
          <Property Name="UnitsInStock" Type="smallint" />
          <Property Name="UnitsOnOrder" Type="smallint" />
          <Property Name="ReorderLevel" Type="smallint" />
          <Property Name="Discontinued" Type="bit" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="datetime" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="integer" Nullable="false" />
          <Property Name="RegionDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
          <Property Name="HomePage" Type="nvarchar" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
          <Property Name="TerritoryDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
          <Property Name="RegionID" Type="integer" Nullable="false" />
        </EntityType>
        <Association Name="FK_EmployeesTerritories_EmployeeID_EmployeeID">
          <End Role="Employees" Type="northwindEFModel.Store.Employees" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Employees">
              <PropertyRef Name="EmployeeID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="EmployeeID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_EmployeesTerritories_TerritoryID_TerritoryID">
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Territories">
              <PropertyRef Name="TerritoryID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="TerritoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.Store.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Store.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Customers">
              <PropertyRef Name="CustomerID" />
            </Principal>
            <Dependent Role="Orders">
              <PropertyRef Name="CustomerID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Store.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Categories">
              <PropertyRef Name="CategoryID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="CategoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Store.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Suppliers">
              <PropertyRef Name="SupplierID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="SupplierID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Store.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Regions">
              <PropertyRef Name="RegionID" />
            </Principal>
            <Dependent Role="Territories">
              <PropertyRef Name="RegionID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
      </Schema></edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="northwindEFModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
        <EntityContainer Name="northwindEFEntities">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Categories" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Customers" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Employees" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.InternationalOrders" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.OrderDetails" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Orders" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.PreviousEmployees" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Products" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Regions" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Suppliers" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Territories" />
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          <AssociationSet Name="EmployeesTerritories" Association="northwindEFModel.EmployeesTerritories">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="Int64" Nullable="false" />
          <Property Name="CategoryName" Type="String" Nullable="false" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Description" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="Picture" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Categories" ToRole="Products" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="String" Nullable="false" MaxLength="5" Unicode="true" FixedLength="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Customers" ToRole="Orders" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Employees" ToRole="Territories" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="CustomsDescription" Type="String" Nullable="false" MaxLength="100" Unicode="true" FixedLength="false" />
          <Property Name="ExciseTax" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="InternationalOrders" ToRole="Orders" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="UnitPrice" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <Property Name="Quantity" Type="Int16" Nullable="false" />
          <Property Name="Discount" Type="Single" Nullable="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="OrderDetails" ToRole="Orders" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="OrderDetails" ToRole="Products" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="EmployeeID" Type="Int64" />
          <Property Name="OrderDate" Type="DateTime" />
          <Property Name="RequiredDate" Type="DateTime" />
          <Property Name="ShippedDate" Type="DateTime" />
          <Property Name="Freight" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="ShipName" Type="String" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ShipAddress" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="ShipCity" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipRegion" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipPostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="ShipCountry" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Customers" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Orders" ToRole="Customers" />
          <NavigationProperty Name="InternationalOrders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="Orders" ToRole="InternationalOrders" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="Orders" ToRole="OrderDetails" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="ProductName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="QuantityPerUnit" Type="String" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="UnitPrice" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="UnitsInStock" Type="Int16" />
          <Property Name="UnitsOnOrder" Type="Int16" />
          <Property Name="ReorderLevel" Type="Int16" />
          <Property Name="Discontinued" Type="Boolean" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="DateTime" />
          <NavigationProperty Name="Categories" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Products" ToRole="Categories" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="Products" ToRole="OrderDetails" />
          <NavigationProperty Name="Suppliers" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Products" ToRole="Suppliers" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="Int64" Nullable="false" />
          <Property Name="RegionDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Regions" ToRole="Territories" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="Int64" Nullable="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="HomePage" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Suppliers" ToRole="Products" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="Int64" Nullable="false" />
          <Property Name="TerritoryDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Regions" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Territories" ToRole="Regions" />
          <NavigationProperty Name="Employees" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Territories" ToRole="Employees" />
        </EntityType>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="*" />
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        <Association Name="EmployeesTerritories">
          <End Role="Employees" Type="northwindEFModel.Employees" Multiplicity="*" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        </Schema>
    </edmx:ConceptualModels>
    <!-- C-S mapping content -->
    <edmx:Mappings>
      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
        <EntityContainerMapping StorageEntityContainer="northwindEFModelStoreContainer" CdmEntityContainer="northwindEFEntities">
          <EntitySetMapping Name="Categories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Categories)">
              <MappingFragment StoreEntitySet="Categories">
                <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
                <ScalarProperty Name="CategoryName" ColumnName="CategoryName" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="Picture" ColumnName="Picture" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Customers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Customers)">
              <MappingFragment StoreEntitySet="Customers">
                <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Employees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Employees)">
              <MappingFragment StoreEntitySet="Employees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="InternationalOrders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.InternationalOrders)">
              <MappingFragment StoreEntitySet="InternationalOrders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="CustomsDescription" ColumnName="CustomsDescription" />
                <ScalarProperty Name="ExciseTax" ColumnName="ExciseTax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="OrderDetails">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.OrderDetails)">
              <MappingFragment StoreEntitySet="OrderDetails">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="Quantity" ColumnName="Quantity" />
                <ScalarProperty Name="Discount" ColumnName="Discount" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Orders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Orders)">
              <MappingFragment StoreEntitySet="Orders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="OrderDate" ColumnName="OrderDate" />
                <ScalarProperty Name="RequiredDate" ColumnName="RequiredDate" />
                <ScalarProperty Name="ShippedDate" ColumnName="ShippedDate" />
                <ScalarProperty Name="Freight" ColumnName="Freight" />
                <ScalarProperty Name="ShipName" ColumnName="ShipName" />
                <ScalarProperty Name="ShipAddress" ColumnName="ShipAddress" />
                <ScalarProperty Name="ShipCity" ColumnName="ShipCity" />
                <ScalarProperty Name="ShipRegion" ColumnName="ShipRegion" />
                <ScalarProperty Name="ShipPostalCode" ColumnName="ShipPostalCode" />
                <ScalarProperty Name="ShipCountry" ColumnName="ShipCountry" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="PreviousEmployees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.PreviousEmployees)">
              <MappingFragment StoreEntitySet="PreviousEmployees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Products">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Products)">
              <MappingFragment StoreEntitySet="Products">
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="ProductName" ColumnName="ProductName" />
                <ScalarProperty Name="QuantityPerUnit" ColumnName="QuantityPerUnit" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="UnitsInStock" ColumnName="UnitsInStock" />
                <ScalarProperty Name="UnitsOnOrder" ColumnName="UnitsOnOrder" />
                <ScalarProperty Name="ReorderLevel" ColumnName="ReorderLevel" />
                <ScalarProperty Name="Discontinued" ColumnName="Discontinued" />
                <ScalarProperty Name="DiscontinuedDate" ColumnName="DiscontinuedDate" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Regions">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Regions)">
              <MappingFragment StoreEntitySet="Regions">
                <ScalarProperty Name="RegionID" ColumnName="RegionID" />
                <ScalarProperty Name="RegionDescription" ColumnName="RegionDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Suppliers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Suppliers)">
              <MappingFragment StoreEntitySet="Suppliers">
                <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
                <ScalarProperty Name="HomePage" ColumnName="HomePage" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Territories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Territories)">
              <MappingFragment StoreEntitySet="Territories">
                <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
                <ScalarProperty Name="TerritoryDescription" ColumnName="TerritoryDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <AssociationSetMapping Name="FK_Products_CategoryID_CategoryID" TypeName="northwindEFModel.FK_Products_CategoryID_CategoryID" StoreEntitySet="Products">
            <EndProperty Name="Categories">
              <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="CategoryID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Orders_CustomerID_CustomerID" TypeName="northwindEFModel.FK_Orders_CustomerID_CustomerID" StoreEntitySet="Orders">
            <EndProperty Name="Customers">
              <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
            </EndProperty>
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <Condition ColumnName="CustomerID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_InternationalOrders_OrderID_OrderID" TypeName="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" StoreEntitySet="InternationalOrders">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="InternationalOrders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_OrderID_OrderID" TypeName="northwindEFModel.FK_OrderDetails_OrderID_OrderID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_ProductID_ProductID" TypeName="northwindEFModel.FK_OrderDetails_ProductID_ProductID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Products_SupplierID_SupplierID" TypeName="northwindEFModel.FK_Products_SupplierID_SupplierID" StoreEntitySet="Products">
            <EndProperty Name="Suppliers">
              <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="SupplierID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Territories_RegionID_RegionID" TypeName="northwindEFModel.FK_Territories_RegionID_RegionID" StoreEntitySet="Territories">
            <EndProperty Name="Regions">
              <ScalarProperty Name="RegionID" ColumnName="RegionID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="EmployeesTerritories" TypeName="northwindEFModel.EmployeesTerritories" StoreEntitySet="EmployeesTerritories">
            <EndProperty Name="Employees">
              <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          </EntityContainerMapping>
      </Mapping>
    </edmx:Mappings>
  </edmx:Runtime>
  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
  <edmx:Designer>
    <edmx:Connection>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </edmx:Connection>
    <edmx:Options>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
      </DesignerInfoPropertySet>
    </edmx:Options>
    <!-- Diagram content (shape and connector positions) -->
    <edmx:Diagrams>
      <Diagram Name="NorthwindModel" xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <EntityTypeShape EntityType="northwindEFModel.Categories" Width="1.5" PointX="0.75" PointY="1.625" Height="1.9802864583333335" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Customers" Width="1.5" PointX="0.75" PointY="9.625" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Employees" Width="1.5" PointX="2.75" PointY="14.625" Height="4.4802050781250014" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.InternationalOrders" Width="1.5" PointX="5.25" PointY="10.375" Height="1.7879850260416674" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.OrderDetails" Width="1.5" PointX="5.25" PointY="1.5" Height="2.3648893229166656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Orders" Width="1.5" PointX="3" PointY="9.25" Height="3.9033007812499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.PreviousEmployees" Width="1.5" PointX="7.75" PointY="0.75" Height="4.2879036458333317" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Products" Width="1.5" PointX="3" PointY="1" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Regions" Width="1.5" PointX="2.75" PointY="6" Height="1.5956835937499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Suppliers" Width="1.5" PointX="0.75" PointY="4.875" Height="3.5186979166666656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Territories" Width="1.5" PointX="5" PointY="5.875" Height="1.7879850260416674" IsExpanded="true" />
        <AssociationConnector Association="northwindEFModel.FK_Products_CategoryID_CategoryID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="2.6151432291666667" />
          <ConnectorPoint PointX="3" PointY="2.6151432291666667" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Orders_CustomerID_CustomerID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="11.2881982421875" />
          <ConnectorPoint PointX="3" PointY="11.2881982421875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.010416666666667" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.177083333333333" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.25" PointY="11.268992513020834" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="3.75" PointY="9.25" />
          <ConnectorPoint PointX="3.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="2.6824446614583328" />
          <ConnectorPoint PointX="5.25" PointY="2.6824446614583328" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="2.0287223307291664" />
          <ConnectorPoint PointX="5.25" PointY="2.0287223307291664" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Products_SupplierID_SupplierID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="4.326396484375" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Territories_RegionID_RegionID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="6.797841796875" />
          <ConnectorPoint PointX="4.666666666666667" PointY="6.7978417968749989" />
          <ConnectorPoint PointX="4.833333333333333" PointY="6.797841796875" />
          <ConnectorPoint PointX="5" PointY="6.797841796875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.EmployeesTerritories" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="7.6629850260416674" /></AssociationConnector>
        </Diagram></edmx:Diagrams>
  </edmx:Designer>
</edmx:Edmx>

Added testlinq/NorthwindModel.Linq.2017.Designer.cs.





































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

//------------------------------------------------------------------------------
// <auto-generated>
//    This code was generated from a template.
//
//    Manual changes to this file may cause unexpected behavior in your application.
//    Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System;
using System.ComponentModel;
using System.Data.EntityClient;
using System.Data.Metadata.Edm;
using System.Data.Objects;
using System.Data.Objects.DataClasses;
using System.Runtime.Serialization;
using System.Xml.Serialization;

[assembly: EdmSchemaAttribute()]
#region EDM Relationship Metadata

[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Categories), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Customers), "Orders", RelationshipMultiplicity.Many, typeof(testlinq.Orders))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "InternationalOrders", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.InternationalOrders), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders", RelationshipMultiplicity.One, typeof(testlinq.Orders), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products", RelationshipMultiplicity.One, typeof(testlinq.Products), "OrderDetails", RelationshipMultiplicity.Many, typeof(testlinq.OrderDetails), true)]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers", RelationshipMultiplicity.ZeroOrOne, typeof(testlinq.Suppliers), "Products", RelationshipMultiplicity.Many, typeof(testlinq.Products))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions", RelationshipMultiplicity.One, typeof(testlinq.Regions), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]
[assembly: EdmRelationshipAttribute("northwindEFModel", "EmployeesTerritories", "Employees", RelationshipMultiplicity.Many, typeof(testlinq.Employees), "Territories", RelationshipMultiplicity.Many, typeof(testlinq.Territories))]

#endregion

namespace testlinq
{
    #region Contexts

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    public partial class northwindEFEntities : ObjectContext
    {
        #region Constructors

        /// <summary>
        /// Initializes a new northwindEFEntities object using the connection string found in the 'northwindEFEntities' section of the application configuration file.
        /// </summary>
        public northwindEFEntities() : base("name=northwindEFEntities", "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(string connectionString) : base(connectionString, "northwindEFEntities")
        {
            OnContextCreated();
        }

        /// <summary>
        /// Initialize a new northwindEFEntities object.
        /// </summary>
        public northwindEFEntities(EntityConnection connection) : base(connection, "northwindEFEntities")
        {
            OnContextCreated();
        }

        #endregion

        #region Partial Methods

        partial void OnContextCreated();

        #endregion

        #region ObjectSet Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Categories> Categories
        {
            get
            {
                if ((_Categories == null))
                {
                    _Categories = base.CreateObjectSet<Categories>("Categories");
                }
                return _Categories;
            }
        }
        private ObjectSet<Categories> _Categories;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Customers> Customers
        {
            get
            {
                if ((_Customers == null))
                {
                    _Customers = base.CreateObjectSet<Customers>("Customers");
                }
                return _Customers;
            }
        }
        private ObjectSet<Customers> _Customers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Employees> Employees
        {
            get
            {
                if ((_Employees == null))
                {
                    _Employees = base.CreateObjectSet<Employees>("Employees");
                }
                return _Employees;
            }
        }
        private ObjectSet<Employees> _Employees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<InternationalOrders> InternationalOrders
        {
            get
            {
                if ((_InternationalOrders == null))
                {
                    _InternationalOrders = base.CreateObjectSet<InternationalOrders>("InternationalOrders");
                }
                return _InternationalOrders;
            }
        }
        private ObjectSet<InternationalOrders> _InternationalOrders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<OrderDetails> OrderDetails
        {
            get
            {
                if ((_OrderDetails == null))
                {
                    _OrderDetails = base.CreateObjectSet<OrderDetails>("OrderDetails");
                }
                return _OrderDetails;
            }
        }
        private ObjectSet<OrderDetails> _OrderDetails;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Orders> Orders
        {
            get
            {
                if ((_Orders == null))
                {
                    _Orders = base.CreateObjectSet<Orders>("Orders");
                }
                return _Orders;
            }
        }
        private ObjectSet<Orders> _Orders;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<PreviousEmployees> PreviousEmployees
        {
            get
            {
                if ((_PreviousEmployees == null))
                {
                    _PreviousEmployees = base.CreateObjectSet<PreviousEmployees>("PreviousEmployees");
                }
                return _PreviousEmployees;
            }
        }
        private ObjectSet<PreviousEmployees> _PreviousEmployees;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Products> Products
        {
            get
            {
                if ((_Products == null))
                {
                    _Products = base.CreateObjectSet<Products>("Products");
                }
                return _Products;
            }
        }
        private ObjectSet<Products> _Products;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Regions> Regions
        {
            get
            {
                if ((_Regions == null))
                {
                    _Regions = base.CreateObjectSet<Regions>("Regions");
                }
                return _Regions;
            }
        }
        private ObjectSet<Regions> _Regions;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Suppliers> Suppliers
        {
            get
            {
                if ((_Suppliers == null))
                {
                    _Suppliers = base.CreateObjectSet<Suppliers>("Suppliers");
                }
                return _Suppliers;
            }
        }
        private ObjectSet<Suppliers> _Suppliers;

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        public ObjectSet<Territories> Territories
        {
            get
            {
                if ((_Territories == null))
                {
                    _Territories = base.CreateObjectSet<Territories>("Territories");
                }
                return _Territories;
            }
        }
        private ObjectSet<Territories> _Territories;

        #endregion
        #region AddTo Methods

        /// <summary>
        /// Deprecated Method for adding a new object to the Categories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCategories(Categories categories)
        {
            base.AddObject("Categories", categories);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Customers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToCustomers(Customers customers)
        {
            base.AddObject("Customers", customers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Employees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToEmployees(Employees employees)
        {
            base.AddObject("Employees", employees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the InternationalOrders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToInternationalOrders(InternationalOrders internationalOrders)
        {
            base.AddObject("InternationalOrders", internationalOrders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the OrderDetails EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrderDetails(OrderDetails orderDetails)
        {
            base.AddObject("OrderDetails", orderDetails);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Orders EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToOrders(Orders orders)
        {
            base.AddObject("Orders", orders);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the PreviousEmployees EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToPreviousEmployees(PreviousEmployees previousEmployees)
        {
            base.AddObject("PreviousEmployees", previousEmployees);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Products EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToProducts(Products products)
        {
            base.AddObject("Products", products);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Regions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToRegions(Regions regions)
        {
            base.AddObject("Regions", regions);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Suppliers EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToSuppliers(Suppliers suppliers)
        {
            base.AddObject("Suppliers", suppliers);
        }

        /// <summary>
        /// Deprecated Method for adding a new object to the Territories EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
        /// </summary>
        public void AddToTerritories(Territories territories)
        {
            base.AddObject("Territories", territories);
        }

        #endregion
    }


    #endregion

    #region Entities

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Categories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Categories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Categories object.
        /// </summary>
        /// <param name="categoryID">Initial value of the CategoryID property.</param>
        /// <param name="categoryName">Initial value of the CategoryName property.</param>
        public static Categories CreateCategories(global::System.Int64 categoryID, global::System.String categoryName)
        {
            Categories categories = new Categories();
            categories.CategoryID = categoryID;
            categories.CategoryName = categoryName;
            return categories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 CategoryID
        {
            get
            {
                return _CategoryID;
            }
            set
            {
                if (_CategoryID != value)
                {
                    OnCategoryIDChanging(value);
                    ReportPropertyChanging("CategoryID");
                    _CategoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("CategoryID");
                    OnCategoryIDChanged();
                }
            }
        }
        private global::System.Int64 _CategoryID;
        partial void OnCategoryIDChanging(global::System.Int64 value);
        partial void OnCategoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CategoryName
        {
            get
            {
                return _CategoryName;
            }
            set
            {
                OnCategoryNameChanging(value);
                ReportPropertyChanging("CategoryName");
                _CategoryName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CategoryName");
                OnCategoryNameChanged();
            }
        }
        private global::System.String _CategoryName;
        partial void OnCategoryNameChanging(global::System.String value);
        partial void OnCategoryNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Description
        {
            get
            {
                return _Description;
            }
            set
            {
                OnDescriptionChanging(value);
                ReportPropertyChanging("Description");
                _Description = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Description");
                OnDescriptionChanged();
            }
        }
        private global::System.String _Description;
        partial void OnDescriptionChanging(global::System.String value);
        partial void OnDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Picture
        {
            get
            {
                return StructuralObject.GetValidValue(_Picture);
            }
            set
            {
                OnPictureChanging(value);
                ReportPropertyChanging("Picture");
                _Picture = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Picture");
                OnPictureChanged();
            }
        }
        private global::System.Byte[] _Picture;
        partial void OnPictureChanging(global::System.Byte[] value);
        partial void OnPictureChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Customers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Customers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Customers object.
        /// </summary>
        /// <param name="customerID">Initial value of the CustomerID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Customers CreateCustomers(global::System.String customerID, global::System.String companyName)
        {
            Customers customers = new Customers();
            customers.CustomerID = customerID;
            customers.CompanyName = companyName;
            return customers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomerID
        {
            get
            {
                return _CustomerID;
            }
            set
            {
                if (_CustomerID != value)
                {
                    OnCustomerIDChanging(value);
                    ReportPropertyChanging("CustomerID");
                    _CustomerID = StructuralObject.SetValidValue(value, false);
                    ReportPropertyChanged("CustomerID");
                    OnCustomerIDChanged();
                }
            }
        }
        private global::System.String _CustomerID;
        partial void OnCustomerIDChanging(global::System.String value);
        partial void OnCustomerIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Orders")]
        public EntityCollection<Orders> Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Orders>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Employees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Employees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Employees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static Employees CreateEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            Employees employees = new Employees();
            employees.EmployeeID = employeeID;
            employees.LastName = lastName;
            employees.FirstName = firstName;
            return employees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.EmployeesTerritories", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="InternationalOrders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class InternationalOrders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new InternationalOrders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="customsDescription">Initial value of the CustomsDescription property.</param>
        /// <param name="exciseTax">Initial value of the ExciseTax property.</param>
        public static InternationalOrders CreateInternationalOrders(global::System.Int64 orderID, global::System.String customsDescription, global::System.Decimal exciseTax)
        {
            InternationalOrders internationalOrders = new InternationalOrders();
            internationalOrders.OrderID = orderID;
            internationalOrders.CustomsDescription = customsDescription;
            internationalOrders.ExciseTax = exciseTax;
            return internationalOrders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CustomsDescription
        {
            get
            {
                return _CustomsDescription;
            }
            set
            {
                OnCustomsDescriptionChanging(value);
                ReportPropertyChanging("CustomsDescription");
                _CustomsDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CustomsDescription");
                OnCustomsDescriptionChanged();
            }
        }
        private global::System.String _CustomsDescription;
        partial void OnCustomsDescriptionChanging(global::System.String value);
        partial void OnCustomsDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal ExciseTax
        {
            get
            {
                return _ExciseTax;
            }
            set
            {
                OnExciseTaxChanging(value);
                ReportPropertyChanging("ExciseTax");
                _ExciseTax = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ExciseTax");
                OnExciseTaxChanged();
            }
        }
        private global::System.Decimal _ExciseTax;
        partial void OnExciseTaxChanging(global::System.Decimal value);
        partial void OnExciseTaxChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "Orders", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="OrderDetails")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class OrderDetails : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new OrderDetails object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="unitPrice">Initial value of the UnitPrice property.</param>
        /// <param name="quantity">Initial value of the Quantity property.</param>
        /// <param name="discount">Initial value of the Discount property.</param>
        public static OrderDetails CreateOrderDetails(global::System.Int64 orderID, global::System.Int64 productID, global::System.Decimal unitPrice, global::System.Int16 quantity, global::System.Single discount)
        {
            OrderDetails orderDetails = new OrderDetails();
            orderDetails.OrderID = orderID;
            orderDetails.ProductID = productID;
            orderDetails.UnitPrice = unitPrice;
            orderDetails.Quantity = quantity;
            orderDetails.Discount = discount;
            return orderDetails;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Decimal UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private global::System.Decimal _UnitPrice;
        partial void OnUnitPriceChanging(global::System.Decimal value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int16 Quantity
        {
            get
            {
                return _Quantity;
            }
            set
            {
                OnQuantityChanging(value);
                ReportPropertyChanging("Quantity");
                _Quantity = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Quantity");
                OnQuantityChanged();
            }
        }
        private global::System.Int16 _Quantity;
        partial void OnQuantityChanging(global::System.Int16 value);
        partial void OnQuantityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Single Discount
        {
            get
            {
                return _Discount;
            }
            set
            {
                OnDiscountChanging(value);
                ReportPropertyChanging("Discount");
                _Discount = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discount");
                OnDiscountChanged();
            }
        }
        private global::System.Single _Discount;
        partial void OnDiscountChanging(global::System.Single value);
        partial void OnDiscountChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "Orders")]
        public Orders Orders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Orders> OrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Orders>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "Orders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "Products")]
        public Products Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Products> ProductsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Products>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Orders")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Orders : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Orders object.
        /// </summary>
        /// <param name="orderID">Initial value of the OrderID property.</param>
        public static Orders CreateOrders(global::System.Int64 orderID)
        {
            Orders orders = new Orders();
            orders.OrderID = orderID;
            return orders;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 OrderID
        {
            get
            {
                return _OrderID;
            }
            set
            {
                if (_OrderID != value)
                {
                    OnOrderIDChanging(value);
                    ReportPropertyChanging("OrderID");
                    _OrderID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("OrderID");
                    OnOrderIDChanged();
                }
            }
        }
        private global::System.Int64 _OrderID;
        partial void OnOrderIDChanging(global::System.Int64 value);
        partial void OnOrderIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int64> EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                OnEmployeeIDChanging(value);
                ReportPropertyChanging("EmployeeID");
                _EmployeeID = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("EmployeeID");
                OnEmployeeIDChanged();
            }
        }
        private Nullable<global::System.Int64> _EmployeeID;
        partial void OnEmployeeIDChanging(Nullable<global::System.Int64> value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> OrderDate
        {
            get
            {
                return _OrderDate;
            }
            set
            {
                OnOrderDateChanging(value);
                ReportPropertyChanging("OrderDate");
                _OrderDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("OrderDate");
                OnOrderDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _OrderDate;
        partial void OnOrderDateChanging(Nullable<global::System.DateTime> value);
        partial void OnOrderDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> RequiredDate
        {
            get
            {
                return _RequiredDate;
            }
            set
            {
                OnRequiredDateChanging(value);
                ReportPropertyChanging("RequiredDate");
                _RequiredDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("RequiredDate");
                OnRequiredDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _RequiredDate;
        partial void OnRequiredDateChanging(Nullable<global::System.DateTime> value);
        partial void OnRequiredDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> ShippedDate
        {
            get
            {
                return _ShippedDate;
            }
            set
            {
                OnShippedDateChanging(value);
                ReportPropertyChanging("ShippedDate");
                _ShippedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ShippedDate");
                OnShippedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _ShippedDate;
        partial void OnShippedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnShippedDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> Freight
        {
            get
            {
                return _Freight;
            }
            set
            {
                OnFreightChanging(value);
                ReportPropertyChanging("Freight");
                _Freight = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Freight");
                OnFreightChanged();
            }
        }
        private Nullable<global::System.Decimal> _Freight;
        partial void OnFreightChanging(Nullable<global::System.Decimal> value);
        partial void OnFreightChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipName
        {
            get
            {
                return _ShipName;
            }
            set
            {
                OnShipNameChanging(value);
                ReportPropertyChanging("ShipName");
                _ShipName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipName");
                OnShipNameChanged();
            }
        }
        private global::System.String _ShipName;
        partial void OnShipNameChanging(global::System.String value);
        partial void OnShipNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipAddress
        {
            get
            {
                return _ShipAddress;
            }
            set
            {
                OnShipAddressChanging(value);
                ReportPropertyChanging("ShipAddress");
                _ShipAddress = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipAddress");
                OnShipAddressChanged();
            }
        }
        private global::System.String _ShipAddress;
        partial void OnShipAddressChanging(global::System.String value);
        partial void OnShipAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCity
        {
            get
            {
                return _ShipCity;
            }
            set
            {
                OnShipCityChanging(value);
                ReportPropertyChanging("ShipCity");
                _ShipCity = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCity");
                OnShipCityChanged();
            }
        }
        private global::System.String _ShipCity;
        partial void OnShipCityChanging(global::System.String value);
        partial void OnShipCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipRegion
        {
            get
            {
                return _ShipRegion;
            }
            set
            {
                OnShipRegionChanging(value);
                ReportPropertyChanging("ShipRegion");
                _ShipRegion = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipRegion");
                OnShipRegionChanged();
            }
        }
        private global::System.String _ShipRegion;
        partial void OnShipRegionChanging(global::System.String value);
        partial void OnShipRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipPostalCode
        {
            get
            {
                return _ShipPostalCode;
            }
            set
            {
                OnShipPostalCodeChanging(value);
                ReportPropertyChanging("ShipPostalCode");
                _ShipPostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipPostalCode");
                OnShipPostalCodeChanged();
            }
        }
        private global::System.String _ShipPostalCode;
        partial void OnShipPostalCodeChanging(global::System.String value);
        partial void OnShipPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ShipCountry
        {
            get
            {
                return _ShipCountry;
            }
            set
            {
                OnShipCountryChanging(value);
                ReportPropertyChanging("ShipCountry");
                _ShipCountry = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ShipCountry");
                OnShipCountryChanged();
            }
        }
        private global::System.String _ShipCountry;
        partial void OnShipCountryChanging(global::System.String value);
        partial void OnShipCountryChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Orders_CustomerID_CustomerID", "Customers")]
        public Customers Customers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Customers> CustomersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Customers>("northwindEFModel.FK_Orders_CustomerID_CustomerID", "Customers", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_InternationalOrders_OrderID_OrderID", "InternationalOrders")]
        public InternationalOrders InternationalOrders
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<InternationalOrders> InternationalOrdersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<InternationalOrders>("northwindEFModel.FK_InternationalOrders_OrderID_OrderID", "InternationalOrders", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_OrderID_OrderID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_OrderID_OrderID", "OrderDetails", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="PreviousEmployees")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class PreviousEmployees : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new PreviousEmployees object.
        /// </summary>
        /// <param name="employeeID">Initial value of the EmployeeID property.</param>
        /// <param name="lastName">Initial value of the LastName property.</param>
        /// <param name="firstName">Initial value of the FirstName property.</param>
        public static PreviousEmployees CreatePreviousEmployees(global::System.Int64 employeeID, global::System.String lastName, global::System.String firstName)
        {
            PreviousEmployees previousEmployees = new PreviousEmployees();
            previousEmployees.EmployeeID = employeeID;
            previousEmployees.LastName = lastName;
            previousEmployees.FirstName = firstName;
            return previousEmployees;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 EmployeeID
        {
            get
            {
                return _EmployeeID;
            }
            set
            {
                if (_EmployeeID != value)
                {
                    OnEmployeeIDChanging(value);
                    ReportPropertyChanging("EmployeeID");
                    _EmployeeID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("EmployeeID");
                    OnEmployeeIDChanged();
                }
            }
        }
        private global::System.Int64 _EmployeeID;
        partial void OnEmployeeIDChanging(global::System.Int64 value);
        partial void OnEmployeeIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String LastName
        {
            get
            {
                return _LastName;
            }
            set
            {
                OnLastNameChanging(value);
                ReportPropertyChanging("LastName");
                _LastName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("LastName");
                OnLastNameChanged();
            }
        }
        private global::System.String _LastName;
        partial void OnLastNameChanging(global::System.String value);
        partial void OnLastNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String FirstName
        {
            get
            {
                return _FirstName;
            }
            set
            {
                OnFirstNameChanging(value);
                ReportPropertyChanging("FirstName");
                _FirstName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("FirstName");
                OnFirstNameChanged();
            }
        }
        private global::System.String _FirstName;
        partial void OnFirstNameChanging(global::System.String value);
        partial void OnFirstNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Title
        {
            get
            {
                return _Title;
            }
            set
            {
                OnTitleChanging(value);
                ReportPropertyChanging("Title");
                _Title = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Title");
                OnTitleChanged();
            }
        }
        private global::System.String _Title;
        partial void OnTitleChanging(global::System.String value);
        partial void OnTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String TitleOfCourtesy
        {
            get
            {
                return _TitleOfCourtesy;
            }
            set
            {
                OnTitleOfCourtesyChanging(value);
                ReportPropertyChanging("TitleOfCourtesy");
                _TitleOfCourtesy = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("TitleOfCourtesy");
                OnTitleOfCourtesyChanged();
            }
        }
        private global::System.String _TitleOfCourtesy;
        partial void OnTitleOfCourtesyChanging(global::System.String value);
        partial void OnTitleOfCourtesyChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> BirthDate
        {
            get
            {
                return _BirthDate;
            }
            set
            {
                OnBirthDateChanging(value);
                ReportPropertyChanging("BirthDate");
                _BirthDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("BirthDate");
                OnBirthDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _BirthDate;
        partial void OnBirthDateChanging(Nullable<global::System.DateTime> value);
        partial void OnBirthDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> HireDate
        {
            get
            {
                return _HireDate;
            }
            set
            {
                OnHireDateChanging(value);
                ReportPropertyChanging("HireDate");
                _HireDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("HireDate");
                OnHireDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _HireDate;
        partial void OnHireDateChanging(Nullable<global::System.DateTime> value);
        partial void OnHireDateChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePhone
        {
            get
            {
                return _HomePhone;
            }
            set
            {
                OnHomePhoneChanging(value);
                ReportPropertyChanging("HomePhone");
                _HomePhone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePhone");
                OnHomePhoneChanged();
            }
        }
        private global::System.String _HomePhone;
        partial void OnHomePhoneChanging(global::System.String value);
        partial void OnHomePhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Extension
        {
            get
            {
                return _Extension;
            }
            set
            {
                OnExtensionChanging(value);
                ReportPropertyChanging("Extension");
                _Extension = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Extension");
                OnExtensionChanged();
            }
        }
        private global::System.String _Extension;
        partial void OnExtensionChanging(global::System.String value);
        partial void OnExtensionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.Byte[] Photo
        {
            get
            {
                return StructuralObject.GetValidValue(_Photo);
            }
            set
            {
                OnPhotoChanging(value);
                ReportPropertyChanging("Photo");
                _Photo = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Photo");
                OnPhotoChanged();
            }
        }
        private global::System.Byte[] _Photo;
        partial void OnPhotoChanging(global::System.Byte[] value);
        partial void OnPhotoChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Notes
        {
            get
            {
                return _Notes;
            }
            set
            {
                OnNotesChanging(value);
                ReportPropertyChanging("Notes");
                _Notes = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Notes");
                OnNotesChanged();
            }
        }
        private global::System.String _Notes;
        partial void OnNotesChanging(global::System.String value);
        partial void OnNotesChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PhotoPath
        {
            get
            {
                return _PhotoPath;
            }
            set
            {
                OnPhotoPathChanging(value);
                ReportPropertyChanging("PhotoPath");
                _PhotoPath = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PhotoPath");
                OnPhotoPathChanged();
            }
        }
        private global::System.String _PhotoPath;
        partial void OnPhotoPathChanging(global::System.String value);
        partial void OnPhotoPathChanged();

        #endregion

    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Products")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Products : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Products object.
        /// </summary>
        /// <param name="productID">Initial value of the ProductID property.</param>
        /// <param name="productName">Initial value of the ProductName property.</param>
        /// <param name="discontinued">Initial value of the Discontinued property.</param>
        public static Products CreateProducts(global::System.Int64 productID, global::System.String productName, global::System.Boolean discontinued)
        {
            Products products = new Products();
            products.ProductID = productID;
            products.ProductName = productName;
            products.Discontinued = discontinued;
            return products;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 ProductID
        {
            get
            {
                return _ProductID;
            }
            set
            {
                if (_ProductID != value)
                {
                    OnProductIDChanging(value);
                    ReportPropertyChanging("ProductID");
                    _ProductID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("ProductID");
                    OnProductIDChanged();
                }
            }
        }
        private global::System.Int64 _ProductID;
        partial void OnProductIDChanging(global::System.Int64 value);
        partial void OnProductIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String ProductName
        {
            get
            {
                return _ProductName;
            }
            set
            {
                OnProductNameChanging(value);
                ReportPropertyChanging("ProductName");
                _ProductName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("ProductName");
                OnProductNameChanged();
            }
        }
        private global::System.String _ProductName;
        partial void OnProductNameChanging(global::System.String value);
        partial void OnProductNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String QuantityPerUnit
        {
            get
            {
                return _QuantityPerUnit;
            }
            set
            {
                OnQuantityPerUnitChanging(value);
                ReportPropertyChanging("QuantityPerUnit");
                _QuantityPerUnit = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("QuantityPerUnit");
                OnQuantityPerUnitChanged();
            }
        }
        private global::System.String _QuantityPerUnit;
        partial void OnQuantityPerUnitChanging(global::System.String value);
        partial void OnQuantityPerUnitChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Decimal> UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private Nullable<global::System.Decimal> _UnitPrice;
        partial void OnUnitPriceChanging(Nullable<global::System.Decimal> value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsInStock
        {
            get
            {
                return _UnitsInStock;
            }
            set
            {
                OnUnitsInStockChanging(value);
                ReportPropertyChanging("UnitsInStock");
                _UnitsInStock = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsInStock");
                OnUnitsInStockChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsInStock;
        partial void OnUnitsInStockChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsInStockChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> UnitsOnOrder
        {
            get
            {
                return _UnitsOnOrder;
            }
            set
            {
                OnUnitsOnOrderChanging(value);
                ReportPropertyChanging("UnitsOnOrder");
                _UnitsOnOrder = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitsOnOrder");
                OnUnitsOnOrderChanged();
            }
        }
        private Nullable<global::System.Int16> _UnitsOnOrder;
        partial void OnUnitsOnOrderChanging(Nullable<global::System.Int16> value);
        partial void OnUnitsOnOrderChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.Int16> ReorderLevel
        {
            get
            {
                return _ReorderLevel;
            }
            set
            {
                OnReorderLevelChanging(value);
                ReportPropertyChanging("ReorderLevel");
                _ReorderLevel = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ReorderLevel");
                OnReorderLevelChanged();
            }
        }
        private Nullable<global::System.Int16> _ReorderLevel;
        partial void OnReorderLevelChanging(Nullable<global::System.Int16> value);
        partial void OnReorderLevelChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Boolean Discontinued
        {
            get
            {
                return _Discontinued;
            }
            set
            {
                OnDiscontinuedChanging(value);
                ReportPropertyChanging("Discontinued");
                _Discontinued = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Discontinued");
                OnDiscontinuedChanged();
            }
        }
        private global::System.Boolean _Discontinued;
        partial void OnDiscontinuedChanging(global::System.Boolean value);
        partial void OnDiscontinuedChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public Nullable<global::System.DateTime> DiscontinuedDate
        {
            get
            {
                return _DiscontinuedDate;
            }
            set
            {
                OnDiscontinuedDateChanging(value);
                ReportPropertyChanging("DiscontinuedDate");
                _DiscontinuedDate = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DiscontinuedDate");
                OnDiscontinuedDateChanged();
            }
        }
        private Nullable<global::System.DateTime> _DiscontinuedDate;
        partial void OnDiscontinuedDateChanging(Nullable<global::System.DateTime> value);
        partial void OnDiscontinuedDateChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_CategoryID_CategoryID", "Categories")]
        public Categories Categories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Categories> CategoriesReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Categories>("northwindEFModel.FK_Products_CategoryID_CategoryID", "Categories", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_OrderDetails_ProductID_ProductID", "OrderDetails")]
        public EntityCollection<OrderDetails> OrderDetails
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<OrderDetails>("northwindEFModel.FK_OrderDetails_ProductID_ProductID", "OrderDetails", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Suppliers")]
        public Suppliers Suppliers
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Suppliers> SuppliersReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Suppliers>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Suppliers", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Regions")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Regions : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Regions object.
        /// </summary>
        /// <param name="regionID">Initial value of the RegionID property.</param>
        /// <param name="regionDescription">Initial value of the RegionDescription property.</param>
        public static Regions CreateRegions(global::System.Int64 regionID, global::System.String regionDescription)
        {
            Regions regions = new Regions();
            regions.RegionID = regionID;
            regions.RegionDescription = regionDescription;
            return regions;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 RegionID
        {
            get
            {
                return _RegionID;
            }
            set
            {
                if (_RegionID != value)
                {
                    OnRegionIDChanging(value);
                    ReportPropertyChanging("RegionID");
                    _RegionID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("RegionID");
                    OnRegionIDChanged();
                }
            }
        }
        private global::System.Int64 _RegionID;
        partial void OnRegionIDChanging(global::System.Int64 value);
        partial void OnRegionIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String RegionDescription
        {
            get
            {
                return _RegionDescription;
            }
            set
            {
                OnRegionDescriptionChanging(value);
                ReportPropertyChanging("RegionDescription");
                _RegionDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("RegionDescription");
                OnRegionDescriptionChanged();
            }
        }
        private global::System.String _RegionDescription;
        partial void OnRegionDescriptionChanging(global::System.String value);
        partial void OnRegionDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Territories")]
        public EntityCollection<Territories> Territories
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Territories>("northwindEFModel.FK_Territories_RegionID_RegionID", "Territories", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Suppliers")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Suppliers : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Suppliers object.
        /// </summary>
        /// <param name="supplierID">Initial value of the SupplierID property.</param>
        /// <param name="companyName">Initial value of the CompanyName property.</param>
        public static Suppliers CreateSuppliers(global::System.Int64 supplierID, global::System.String companyName)
        {
            Suppliers suppliers = new Suppliers();
            suppliers.SupplierID = supplierID;
            suppliers.CompanyName = companyName;
            return suppliers;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 SupplierID
        {
            get
            {
                return _SupplierID;
            }
            set
            {
                if (_SupplierID != value)
                {
                    OnSupplierIDChanging(value);
                    ReportPropertyChanging("SupplierID");
                    _SupplierID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("SupplierID");
                    OnSupplierIDChanged();
                }
            }
        }
        private global::System.Int64 _SupplierID;
        partial void OnSupplierIDChanging(global::System.Int64 value);
        partial void OnSupplierIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String CompanyName
        {
            get
            {
                return _CompanyName;
            }
            set
            {
                OnCompanyNameChanging(value);
                ReportPropertyChanging("CompanyName");
                _CompanyName = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("CompanyName");
                OnCompanyNameChanged();
            }
        }
        private global::System.String _CompanyName;
        partial void OnCompanyNameChanging(global::System.String value);
        partial void OnCompanyNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactName
        {
            get
            {
                return _ContactName;
            }
            set
            {
                OnContactNameChanging(value);
                ReportPropertyChanging("ContactName");
                _ContactName = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactName");
                OnContactNameChanged();
            }
        }
        private global::System.String _ContactName;
        partial void OnContactNameChanging(global::System.String value);
        partial void OnContactNameChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String ContactTitle
        {
            get
            {
                return _ContactTitle;
            }
            set
            {
                OnContactTitleChanging(value);
                ReportPropertyChanging("ContactTitle");
                _ContactTitle = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("ContactTitle");
                OnContactTitleChanged();
            }
        }
        private global::System.String _ContactTitle;
        partial void OnContactTitleChanging(global::System.String value);
        partial void OnContactTitleChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Address
        {
            get
            {
                return _Address;
            }
            set
            {
                OnAddressChanging(value);
                ReportPropertyChanging("Address");
                _Address = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Address");
                OnAddressChanged();
            }
        }
        private global::System.String _Address;
        partial void OnAddressChanging(global::System.String value);
        partial void OnAddressChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String City
        {
            get
            {
                return _City;
            }
            set
            {
                OnCityChanging(value);
                ReportPropertyChanging("City");
                _City = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("City");
                OnCityChanged();
            }
        }
        private global::System.String _City;
        partial void OnCityChanging(global::System.String value);
        partial void OnCityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Region
        {
            get
            {
                return _Region;
            }
            set
            {
                OnRegionChanging(value);
                ReportPropertyChanging("Region");
                _Region = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Region");
                OnRegionChanged();
            }
        }
        private global::System.String _Region;
        partial void OnRegionChanging(global::System.String value);
        partial void OnRegionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String PostalCode
        {
            get
            {
                return _PostalCode;
            }
            set
            {
                OnPostalCodeChanging(value);
                ReportPropertyChanging("PostalCode");
                _PostalCode = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("PostalCode");
                OnPostalCodeChanged();
            }
        }
        private global::System.String _PostalCode;
        partial void OnPostalCodeChanging(global::System.String value);
        partial void OnPostalCodeChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Country
        {
            get
            {
                return _Country;
            }
            set
            {
                OnCountryChanging(value);
                ReportPropertyChanging("Country");
                _Country = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Country");
                OnCountryChanged();
            }
        }
        private global::System.String _Country;
        partial void OnCountryChanging(global::System.String value);
        partial void OnCountryChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Phone
        {
            get
            {
                return _Phone;
            }
            set
            {
                OnPhoneChanging(value);
                ReportPropertyChanging("Phone");
                _Phone = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Phone");
                OnPhoneChanged();
            }
        }
        private global::System.String _Phone;
        partial void OnPhoneChanging(global::System.String value);
        partial void OnPhoneChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String Fax
        {
            get
            {
                return _Fax;
            }
            set
            {
                OnFaxChanging(value);
                ReportPropertyChanging("Fax");
                _Fax = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Fax");
                OnFaxChanged();
            }
        }
        private global::System.String _Fax;
        partial void OnFaxChanging(global::System.String value);
        partial void OnFaxChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
        [DataMemberAttribute()]
        public global::System.String HomePage
        {
            get
            {
                return _HomePage;
            }
            set
            {
                OnHomePageChanging(value);
                ReportPropertyChanging("HomePage");
                _HomePage = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("HomePage");
                OnHomePageChanged();
            }
        }
        private global::System.String _HomePage;
        partial void OnHomePageChanging(global::System.String value);
        partial void OnHomePageChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Products_SupplierID_SupplierID", "Products")]
        public EntityCollection<Products> Products
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Products>("northwindEFModel.FK_Products_SupplierID_SupplierID", "Products", value);
                }
            }
        }

        #endregion
    }

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName="northwindEFModel", Name="Territories")]
    [Serializable()]
    [DataContractAttribute(IsReference=true)]
    public partial class Territories : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new Territories object.
        /// </summary>
        /// <param name="territoryID">Initial value of the TerritoryID property.</param>
        /// <param name="territoryDescription">Initial value of the TerritoryDescription property.</param>
        public static Territories CreateTerritories(global::System.Int64 territoryID, global::System.String territoryDescription)
        {
            Territories territories = new Territories();
            territories.TerritoryID = territoryID;
            territories.TerritoryDescription = territoryDescription;
            return territories;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.Int64 TerritoryID
        {
            get
            {
                return _TerritoryID;
            }
            set
            {
                if (_TerritoryID != value)
                {
                    OnTerritoryIDChanging(value);
                    ReportPropertyChanging("TerritoryID");
                    _TerritoryID = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("TerritoryID");
                    OnTerritoryIDChanged();
                }
            }
        }
        private global::System.Int64 _TerritoryID;
        partial void OnTerritoryIDChanging(global::System.Int64 value);
        partial void OnTerritoryIDChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=false)]
        [DataMemberAttribute()]
        public global::System.String TerritoryDescription
        {
            get
            {
                return _TerritoryDescription;
            }
            set
            {
                OnTerritoryDescriptionChanging(value);
                ReportPropertyChanging("TerritoryDescription");
                _TerritoryDescription = StructuralObject.SetValidValue(value, false);
                ReportPropertyChanged("TerritoryDescription");
                OnTerritoryDescriptionChanged();
            }
        }
        private global::System.String _TerritoryDescription;
        partial void OnTerritoryDescriptionChanging(global::System.String value);
        partial void OnTerritoryDescriptionChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "FK_Territories_RegionID_RegionID", "Regions")]
        public Regions Regions
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Regions> RegionsReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Regions>("northwindEFModel.FK_Territories_RegionID_RegionID", "Regions", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("northwindEFModel", "EmployeesTerritories", "Employees")]
        public EntityCollection<Employees> Employees
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedCollection<Employees>("northwindEFModel.EmployeesTerritories", "Employees", value);
                }
            }
        }

        #endregion
    }

    #endregion

}

Added testlinq/NorthwindModel.Linq.2017.edmx.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
<?xml version="1.0" encoding="utf-8"?>

<!--
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/
-->

<edmx:Edmx Version="2.0" xmlns:edmx="http://schemas.microsoft.com/ado/2008/10/edmx">
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
    <Schema Namespace="northwindEFModel.Store" Alias="Self" Provider="System.Data.SQLite.Linq" ProviderManifestToken="ISO8601" xmlns="http://schemas.microsoft.com/ado/2009/02/edm/ssdl">
        <EntityContainer Name="northwindEFModelStoreContainer">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Store.Categories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Store.Customers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Store.Employees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="EmployeesTerritories" EntityType="northwindEFModel.Store.EmployeesTerritories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.Store.InternationalOrders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.Store.OrderDetails" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Store.Orders" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.Store.PreviousEmployees" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Store.Products" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Store.Regions" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Store.Suppliers" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Store.Territories" store:Type="Tables" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" />
          <AssociationSet Name="FK_EmployeesTerritories_EmployeeID_EmployeeID" Association="northwindEFModel.Store.FK_EmployeesTerritories_EmployeeID_EmployeeID">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_EmployeesTerritories_TerritoryID_TerritoryID" Association="northwindEFModel.Store.FK_EmployeesTerritories_TerritoryID_TerritoryID">
            <End Role="Territories" EntitySet="Territories" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.Store.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.Store.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.Store.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.Store.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.Store.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.Store.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.Store.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
        </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CategoryName" Type="nvarchar" Nullable="false" MaxLength="15" />
          <Property Name="Description" Type="nvarchar" />
          <Property Name="Picture" Type="blob" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="nvarchar" Nullable="false" MaxLength="5" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="EmployeesTerritories">
          <Key>
            <PropertyRef Name="EmployeeID" />
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="CustomsDescription" Type="nvarchar" Nullable="false" MaxLength="100" />
          <Property Name="ExciseTax" Type="decimal" Nullable="false" Precision="53" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="ProductID" Type="integer" Nullable="false" />
          <Property Name="UnitPrice" Type="decimal" Nullable="false" Precision="53" />
          <Property Name="Quantity" Type="smallint" Nullable="false" />
          <!--
              NOTE: The "Discount" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbInsertCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Discount" Type="real" Nullable="false" StoreGeneratedPattern="Computed" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CustomerID" Type="nvarchar" MaxLength="5" />
          <Property Name="EmployeeID" Type="integer" />
          <Property Name="OrderDate" Type="datetime" />
          <Property Name="RequiredDate" Type="datetime" />
          <Property Name="ShippedDate" Type="datetime" />
          <!--
              NOTE: The "Freight" column is not actually generated by the store;
                    however, it has a default value and can be utilized to test
                    generating an DbUpdateCommandTree with a Returning property
                    value that is not null.
          -->
          <Property Name="Freight" Type="decimal" Precision="53" StoreGeneratedPattern="Computed" />
          <Property Name="ShipName" Type="nvarchar" MaxLength="40" />
          <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" />
          <Property Name="ShipCity" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="ProductName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="SupplierID" Type="integer" />
          <Property Name="CategoryID" Type="integer" />
          <Property Name="QuantityPerUnit" Type="nvarchar" MaxLength="20" />
          <Property Name="UnitPrice" Type="decimal" Precision="53" />
          <Property Name="UnitsInStock" Type="smallint" />
          <Property Name="UnitsOnOrder" Type="smallint" />
          <Property Name="ReorderLevel" Type="smallint" />
          <Property Name="Discontinued" Type="bit" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="datetime" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="integer" Nullable="false" />
          <Property Name="RegionDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
          <Property Name="HomePage" Type="nvarchar" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
          <Property Name="TerritoryDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
          <Property Name="RegionID" Type="integer" Nullable="false" />
        </EntityType>
        <Association Name="FK_EmployeesTerritories_EmployeeID_EmployeeID">
          <End Role="Employees" Type="northwindEFModel.Store.Employees" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Employees">
              <PropertyRef Name="EmployeeID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="EmployeeID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_EmployeesTerritories_TerritoryID_TerritoryID">
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Territories">
              <PropertyRef Name="TerritoryID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="TerritoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.Store.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Store.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Customers">
              <PropertyRef Name="CustomerID" />
            </Principal>
            <Dependent Role="Orders">
              <PropertyRef Name="CustomerID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Store.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Categories">
              <PropertyRef Name="CategoryID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="CategoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Store.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Suppliers">
              <PropertyRef Name="SupplierID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="SupplierID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Store.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Regions">
              <PropertyRef Name="RegionID" />
            </Principal>
            <Dependent Role="Territories">
              <PropertyRef Name="RegionID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
      </Schema></edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="northwindEFModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2008/09/edm">
        <EntityContainer Name="northwindEFEntities">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Categories" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Customers" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Employees" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.InternationalOrders" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.OrderDetails" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Orders" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.PreviousEmployees" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Products" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Regions" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Suppliers" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Territories" />
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          <AssociationSet Name="EmployeesTerritories" Association="northwindEFModel.EmployeesTerritories">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="Int64" Nullable="false" />
          <Property Name="CategoryName" Type="String" Nullable="false" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Description" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="Picture" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Categories" ToRole="Products" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="String" Nullable="false" MaxLength="5" Unicode="true" FixedLength="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Customers" ToRole="Orders" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Employees" ToRole="Territories" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="CustomsDescription" Type="String" Nullable="false" MaxLength="100" Unicode="true" FixedLength="false" />
          <Property Name="ExciseTax" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="InternationalOrders" ToRole="Orders" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="UnitPrice" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <Property Name="Quantity" Type="Int16" Nullable="false" />
          <Property Name="Discount" Type="Single" Nullable="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="OrderDetails" ToRole="Orders" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="OrderDetails" ToRole="Products" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="EmployeeID" Type="Int64" />
          <Property Name="OrderDate" Type="DateTime" />
          <Property Name="RequiredDate" Type="DateTime" />
          <Property Name="ShippedDate" Type="DateTime" />
          <Property Name="Freight" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="ShipName" Type="String" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ShipAddress" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="ShipCity" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipRegion" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipPostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="ShipCountry" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Customers" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Orders" ToRole="Customers" />
          <NavigationProperty Name="InternationalOrders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="Orders" ToRole="InternationalOrders" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="Orders" ToRole="OrderDetails" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="ProductName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="QuantityPerUnit" Type="String" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="UnitPrice" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="UnitsInStock" Type="Int16" />
          <Property Name="UnitsOnOrder" Type="Int16" />
          <Property Name="ReorderLevel" Type="Int16" />
          <Property Name="Discontinued" Type="Boolean" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="DateTime" />
          <NavigationProperty Name="Categories" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Products" ToRole="Categories" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="Products" ToRole="OrderDetails" />
          <NavigationProperty Name="Suppliers" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Products" ToRole="Suppliers" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="Int64" Nullable="false" />
          <Property Name="RegionDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Regions" ToRole="Territories" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="Int64" Nullable="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="HomePage" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Suppliers" ToRole="Products" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="Int64" Nullable="false" />
          <Property Name="TerritoryDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Regions" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Territories" ToRole="Regions" />
          <NavigationProperty Name="Employees" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Territories" ToRole="Employees" />
        </EntityType>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="*" />
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        <Association Name="EmployeesTerritories">
          <End Role="Employees" Type="northwindEFModel.Employees" Multiplicity="*" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        </Schema>
    </edmx:ConceptualModels>
    <!-- C-S mapping content -->
    <edmx:Mappings>
      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2008/09/mapping/cs">
        <EntityContainerMapping StorageEntityContainer="northwindEFModelStoreContainer" CdmEntityContainer="northwindEFEntities">
          <EntitySetMapping Name="Categories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Categories)">
              <MappingFragment StoreEntitySet="Categories">
                <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
                <ScalarProperty Name="CategoryName" ColumnName="CategoryName" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="Picture" ColumnName="Picture" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Customers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Customers)">
              <MappingFragment StoreEntitySet="Customers">
                <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Employees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Employees)">
              <MappingFragment StoreEntitySet="Employees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="InternationalOrders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.InternationalOrders)">
              <MappingFragment StoreEntitySet="InternationalOrders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="CustomsDescription" ColumnName="CustomsDescription" />
                <ScalarProperty Name="ExciseTax" ColumnName="ExciseTax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="OrderDetails">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.OrderDetails)">
              <MappingFragment StoreEntitySet="OrderDetails">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="Quantity" ColumnName="Quantity" />
                <ScalarProperty Name="Discount" ColumnName="Discount" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Orders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Orders)">
              <MappingFragment StoreEntitySet="Orders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="OrderDate" ColumnName="OrderDate" />
                <ScalarProperty Name="RequiredDate" ColumnName="RequiredDate" />
                <ScalarProperty Name="ShippedDate" ColumnName="ShippedDate" />
                <ScalarProperty Name="Freight" ColumnName="Freight" />
                <ScalarProperty Name="ShipName" ColumnName="ShipName" />
                <ScalarProperty Name="ShipAddress" ColumnName="ShipAddress" />
                <ScalarProperty Name="ShipCity" ColumnName="ShipCity" />
                <ScalarProperty Name="ShipRegion" ColumnName="ShipRegion" />
                <ScalarProperty Name="ShipPostalCode" ColumnName="ShipPostalCode" />
                <ScalarProperty Name="ShipCountry" ColumnName="ShipCountry" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="PreviousEmployees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.PreviousEmployees)">
              <MappingFragment StoreEntitySet="PreviousEmployees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Products">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Products)">
              <MappingFragment StoreEntitySet="Products">
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="ProductName" ColumnName="ProductName" />
                <ScalarProperty Name="QuantityPerUnit" ColumnName="QuantityPerUnit" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="UnitsInStock" ColumnName="UnitsInStock" />
                <ScalarProperty Name="UnitsOnOrder" ColumnName="UnitsOnOrder" />
                <ScalarProperty Name="ReorderLevel" ColumnName="ReorderLevel" />
                <ScalarProperty Name="Discontinued" ColumnName="Discontinued" />
                <ScalarProperty Name="DiscontinuedDate" ColumnName="DiscontinuedDate" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Regions">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Regions)">
              <MappingFragment StoreEntitySet="Regions">
                <ScalarProperty Name="RegionID" ColumnName="RegionID" />
                <ScalarProperty Name="RegionDescription" ColumnName="RegionDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Suppliers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Suppliers)">
              <MappingFragment StoreEntitySet="Suppliers">
                <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
                <ScalarProperty Name="HomePage" ColumnName="HomePage" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Territories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Territories)">
              <MappingFragment StoreEntitySet="Territories">
                <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
                <ScalarProperty Name="TerritoryDescription" ColumnName="TerritoryDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <AssociationSetMapping Name="FK_Products_CategoryID_CategoryID" TypeName="northwindEFModel.FK_Products_CategoryID_CategoryID" StoreEntitySet="Products">
            <EndProperty Name="Categories">
              <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="CategoryID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Orders_CustomerID_CustomerID" TypeName="northwindEFModel.FK_Orders_CustomerID_CustomerID" StoreEntitySet="Orders">
            <EndProperty Name="Customers">
              <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
            </EndProperty>
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <Condition ColumnName="CustomerID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_InternationalOrders_OrderID_OrderID" TypeName="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" StoreEntitySet="InternationalOrders">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="InternationalOrders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_OrderID_OrderID" TypeName="northwindEFModel.FK_OrderDetails_OrderID_OrderID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_ProductID_ProductID" TypeName="northwindEFModel.FK_OrderDetails_ProductID_ProductID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Products_SupplierID_SupplierID" TypeName="northwindEFModel.FK_Products_SupplierID_SupplierID" StoreEntitySet="Products">
            <EndProperty Name="Suppliers">
              <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="SupplierID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Territories_RegionID_RegionID" TypeName="northwindEFModel.FK_Territories_RegionID_RegionID" StoreEntitySet="Territories">
            <EndProperty Name="Regions">
              <ScalarProperty Name="RegionID" ColumnName="RegionID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="EmployeesTerritories" TypeName="northwindEFModel.EmployeesTerritories" StoreEntitySet="EmployeesTerritories">
            <EndProperty Name="Employees">
              <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          </EntityContainerMapping>
      </Mapping>
    </edmx:Mappings>
  </edmx:Runtime>
  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
  <edmx:Designer>
    <edmx:Connection>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </edmx:Connection>
    <edmx:Options>
      <DesignerInfoPropertySet xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
      </DesignerInfoPropertySet>
    </edmx:Options>
    <!-- Diagram content (shape and connector positions) -->
    <edmx:Diagrams>
      <Diagram Name="NorthwindModel" xmlns="http://schemas.microsoft.com/ado/2008/10/edmx">
        <EntityTypeShape EntityType="northwindEFModel.Categories" Width="1.5" PointX="0.75" PointY="1.625" Height="1.9802864583333335" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Customers" Width="1.5" PointX="0.75" PointY="9.625" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Employees" Width="1.5" PointX="2.75" PointY="14.625" Height="4.4802050781250014" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.InternationalOrders" Width="1.5" PointX="5.25" PointY="10.375" Height="1.7879850260416674" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.OrderDetails" Width="1.5" PointX="5.25" PointY="1.5" Height="2.3648893229166656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Orders" Width="1.5" PointX="3" PointY="9.25" Height="3.9033007812499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.PreviousEmployees" Width="1.5" PointX="7.75" PointY="0.75" Height="4.2879036458333317" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Products" Width="1.5" PointX="3" PointY="1" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Regions" Width="1.5" PointX="2.75" PointY="6" Height="1.5956835937499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Suppliers" Width="1.5" PointX="0.75" PointY="4.875" Height="3.5186979166666656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Territories" Width="1.5" PointX="5" PointY="5.875" Height="1.7879850260416674" IsExpanded="true" />
        <AssociationConnector Association="northwindEFModel.FK_Products_CategoryID_CategoryID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="2.6151432291666667" />
          <ConnectorPoint PointX="3" PointY="2.6151432291666667" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Orders_CustomerID_CustomerID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="11.2881982421875" />
          <ConnectorPoint PointX="3" PointY="11.2881982421875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.010416666666667" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.177083333333333" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.25" PointY="11.268992513020834" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="3.75" PointY="9.25" />
          <ConnectorPoint PointX="3.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="2.6824446614583328" />
          <ConnectorPoint PointX="5.25" PointY="2.6824446614583328" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="2.0287223307291664" />
          <ConnectorPoint PointX="5.25" PointY="2.0287223307291664" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Products_SupplierID_SupplierID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="4.326396484375" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Territories_RegionID_RegionID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="6.797841796875" />
          <ConnectorPoint PointX="4.666666666666667" PointY="6.7978417968749989" />
          <ConnectorPoint PointX="4.833333333333333" PointY="6.797841796875" />
          <ConnectorPoint PointX="5" PointY="6.797841796875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.EmployeesTerritories" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="7.6629850260416674" /></AssociationConnector>
        </Diagram></edmx:Diagrams>
  </edmx:Designer>
</edmx:Edmx>

Deleted testlinq/NorthwindModel.edmx.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
<?xml version="1.0" encoding="utf-8"?>
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
  <!-- EF Runtime content -->
  <edmx:Runtime>
    <!-- SSDL content -->
    <edmx:StorageModels>
    <Schema Namespace="northwindEFModel.Store" Alias="Self" Provider="System.Data.SQLite" ProviderManifestToken="ISO8601" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl">
        <EntityContainer Name="northwindEFModelStoreContainer">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Store.Categories" store:Type="Tables" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Store.Customers" store:Type="Tables" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Store.Employees" store:Type="Tables" />
          <EntitySet Name="EmployeesTerritories" EntityType="northwindEFModel.Store.EmployeesTerritories" store:Type="Tables" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.Store.InternationalOrders" store:Type="Tables" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.Store.OrderDetails" store:Type="Tables" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Store.Orders" store:Type="Tables" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.Store.PreviousEmployees" store:Type="Tables" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Store.Products" store:Type="Tables" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Store.Regions" store:Type="Tables" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Store.Suppliers" store:Type="Tables" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Store.Territories" store:Type="Tables" />
          <AssociationSet Name="FK_EmployeesTerritories_EmployeeID_EmployeeID" Association="northwindEFModel.Store.FK_EmployeesTerritories_EmployeeID_EmployeeID">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_EmployeesTerritories_TerritoryID_TerritoryID" Association="northwindEFModel.Store.FK_EmployeesTerritories_TerritoryID_TerritoryID">
            <End Role="Territories" EntitySet="Territories" />
            <End Role="EmployeesTerritories" EntitySet="EmployeesTerritories" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.Store.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.Store.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.Store.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.Store.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.Store.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.Store.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.Store.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
        </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CategoryName" Type="nvarchar" Nullable="false" MaxLength="15" />
          <Property Name="Description" Type="nvarchar" />
          <Property Name="Picture" Type="blob" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="nvarchar" Nullable="false" MaxLength="5" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="EmployeesTerritories">
          <Key>
            <PropertyRef Name="EmployeeID" />
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="CustomsDescription" Type="nvarchar" Nullable="false" MaxLength="100" />
          <Property Name="ExciseTax" Type="decimal" Nullable="false" Precision="53" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" />
          <Property Name="ProductID" Type="integer" Nullable="false" />
          <Property Name="UnitPrice" Type="decimal" Nullable="false" Precision="53" />
          <Property Name="Quantity" Type="smallint" Nullable="false" />
          <Property Name="Discount" Type="real" Nullable="false" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CustomerID" Type="nvarchar" MaxLength="5" />
          <Property Name="EmployeeID" Type="integer" />
          <Property Name="OrderDate" Type="datetime" />
          <Property Name="RequiredDate" Type="datetime" />
          <Property Name="ShippedDate" Type="datetime" />
          <Property Name="Freight" Type="decimal" Precision="53" />
          <Property Name="ShipName" Type="nvarchar" MaxLength="40" />
          <Property Name="ShipAddress" Type="nvarchar" MaxLength="60" />
          <Property Name="ShipCity" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipRegion" Type="nvarchar" MaxLength="15" />
          <Property Name="ShipPostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="ShipCountry" Type="nvarchar" MaxLength="15" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="integer" Nullable="false" />
          <Property Name="LastName" Type="nvarchar" Nullable="false" MaxLength="20" />
          <Property Name="FirstName" Type="nvarchar" Nullable="false" MaxLength="10" />
          <Property Name="Title" Type="nvarchar" MaxLength="30" />
          <Property Name="TitleOfCourtesy" Type="nvarchar" MaxLength="25" />
          <Property Name="BirthDate" Type="datetime" />
          <Property Name="HireDate" Type="datetime" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="HomePhone" Type="nvarchar" MaxLength="24" />
          <Property Name="Extension" Type="nvarchar" MaxLength="4" />
          <Property Name="Photo" Type="blob" />
          <Property Name="Notes" Type="nvarchar" />
          <Property Name="PhotoPath" Type="nvarchar" MaxLength="255" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="ProductName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="SupplierID" Type="integer" />
          <Property Name="CategoryID" Type="integer" />
          <Property Name="QuantityPerUnit" Type="nvarchar" MaxLength="20" />
          <Property Name="UnitPrice" Type="decimal" Precision="53" />
          <Property Name="UnitsInStock" Type="smallint" />
          <Property Name="UnitsOnOrder" Type="smallint" />
          <Property Name="ReorderLevel" Type="smallint" />
          <Property Name="Discontinued" Type="bit" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="datetime" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="integer" Nullable="false" />
          <Property Name="RegionDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="integer" Nullable="false" StoreGeneratedPattern="Identity" />
          <Property Name="CompanyName" Type="nvarchar" Nullable="false" MaxLength="40" />
          <Property Name="ContactName" Type="nvarchar" MaxLength="30" />
          <Property Name="ContactTitle" Type="nvarchar" MaxLength="30" />
          <Property Name="Address" Type="nvarchar" MaxLength="60" />
          <Property Name="City" Type="nvarchar" MaxLength="15" />
          <Property Name="Region" Type="nvarchar" MaxLength="15" />
          <Property Name="PostalCode" Type="nvarchar" MaxLength="10" />
          <Property Name="Country" Type="nvarchar" MaxLength="15" />
          <Property Name="Phone" Type="nvarchar" MaxLength="24" />
          <Property Name="Fax" Type="nvarchar" MaxLength="24" />
          <Property Name="HomePage" Type="nvarchar" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="integer" Nullable="false" />
          <Property Name="TerritoryDescription" Type="nvarchar" Nullable="false" MaxLength="50" />
          <Property Name="RegionID" Type="integer" Nullable="false" />
        </EntityType>
        <Association Name="FK_EmployeesTerritories_EmployeeID_EmployeeID">
          <End Role="Employees" Type="northwindEFModel.Store.Employees" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Employees">
              <PropertyRef Name="EmployeeID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="EmployeeID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_EmployeesTerritories_TerritoryID_TerritoryID">
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="1" />
          <End Role="EmployeesTerritories" Type="northwindEFModel.Store.EmployeesTerritories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Territories">
              <PropertyRef Name="TerritoryID" />
            </Principal>
            <Dependent Role="EmployeesTerritories">
              <PropertyRef Name="TerritoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.Store.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.Store.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Store.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Store.Orders" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Customers">
              <PropertyRef Name="CustomerID" />
            </Principal>
            <Dependent Role="Orders">
              <PropertyRef Name="CustomerID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Store.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Categories">
              <PropertyRef Name="CategoryID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="CategoryID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Store.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Store.Products" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Suppliers">
              <PropertyRef Name="SupplierID" />
            </Principal>
            <Dependent Role="Products">
              <PropertyRef Name="SupplierID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Store.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Store.Territories" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Regions">
              <PropertyRef Name="RegionID" />
            </Principal>
            <Dependent Role="Territories">
              <PropertyRef Name="RegionID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
      </Schema></edmx:StorageModels>
    <!-- CSDL content -->
    <edmx:ConceptualModels>
      <Schema Namespace="northwindEFModel" Alias="Self" xmlns="http://schemas.microsoft.com/ado/2006/04/edm">
        <EntityContainer Name="northwindEFEntities">
          <EntitySet Name="Categories" EntityType="northwindEFModel.Categories" />
          <EntitySet Name="Customers" EntityType="northwindEFModel.Customers" />
          <EntitySet Name="Employees" EntityType="northwindEFModel.Employees" />
          <EntitySet Name="InternationalOrders" EntityType="northwindEFModel.InternationalOrders" />
          <EntitySet Name="OrderDetails" EntityType="northwindEFModel.OrderDetails" />
          <EntitySet Name="Orders" EntityType="northwindEFModel.Orders" />
          <EntitySet Name="PreviousEmployees" EntityType="northwindEFModel.PreviousEmployees" />
          <EntitySet Name="Products" EntityType="northwindEFModel.Products" />
          <EntitySet Name="Regions" EntityType="northwindEFModel.Regions" />
          <EntitySet Name="Suppliers" EntityType="northwindEFModel.Suppliers" />
          <EntitySet Name="Territories" EntityType="northwindEFModel.Territories" />
          <AssociationSet Name="FK_Products_CategoryID_CategoryID" Association="northwindEFModel.FK_Products_CategoryID_CategoryID">
            <End Role="Categories" EntitySet="Categories" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Orders_CustomerID_CustomerID" Association="northwindEFModel.FK_Orders_CustomerID_CustomerID">
            <End Role="Customers" EntitySet="Customers" />
            <End Role="Orders" EntitySet="Orders" />
          </AssociationSet>
          <AssociationSet Name="FK_InternationalOrders_OrderID_OrderID" Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="InternationalOrders" EntitySet="InternationalOrders" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_OrderID_OrderID" Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID">
            <End Role="Orders" EntitySet="Orders" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_OrderDetails_ProductID_ProductID" Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID">
            <End Role="Products" EntitySet="Products" />
            <End Role="OrderDetails" EntitySet="OrderDetails" />
          </AssociationSet>
          <AssociationSet Name="FK_Products_SupplierID_SupplierID" Association="northwindEFModel.FK_Products_SupplierID_SupplierID">
            <End Role="Suppliers" EntitySet="Suppliers" />
            <End Role="Products" EntitySet="Products" />
          </AssociationSet>
          <AssociationSet Name="FK_Territories_RegionID_RegionID" Association="northwindEFModel.FK_Territories_RegionID_RegionID">
            <End Role="Regions" EntitySet="Regions" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          <AssociationSet Name="EmployeesTerritories" Association="northwindEFModel.EmployeesTerritories">
            <End Role="Employees" EntitySet="Employees" />
            <End Role="Territories" EntitySet="Territories" />
          </AssociationSet>
          </EntityContainer>
        <EntityType Name="Categories">
          <Key>
            <PropertyRef Name="CategoryID" />
          </Key>
          <Property Name="CategoryID" Type="Int64" Nullable="false" />
          <Property Name="CategoryName" Type="String" Nullable="false" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Description" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="Picture" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Categories" ToRole="Products" />
        </EntityType>
        <EntityType Name="Customers">
          <Key>
            <PropertyRef Name="CustomerID" />
          </Key>
          <Property Name="CustomerID" Type="String" Nullable="false" MaxLength="5" Unicode="true" FixedLength="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Customers" ToRole="Orders" />
        </EntityType>
        <EntityType Name="Employees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Employees" ToRole="Territories" />
        </EntityType>
        <EntityType Name="InternationalOrders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="CustomsDescription" Type="String" Nullable="false" MaxLength="100" Unicode="true" FixedLength="false" />
          <Property Name="ExciseTax" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="InternationalOrders" ToRole="Orders" />
        </EntityType>
        <EntityType Name="OrderDetails">
          <Key>
            <PropertyRef Name="OrderID" />
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="UnitPrice" Type="Decimal" Nullable="false" Precision="53" Scale="0" />
          <Property Name="Quantity" Type="Int16" Nullable="false" />
          <Property Name="Discount" Type="Single" Nullable="false" />
          <NavigationProperty Name="Orders" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="OrderDetails" ToRole="Orders" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="OrderDetails" ToRole="Products" />
        </EntityType>
        <EntityType Name="Orders">
          <Key>
            <PropertyRef Name="OrderID" />
          </Key>
          <Property Name="OrderID" Type="Int64" Nullable="false" />
          <Property Name="EmployeeID" Type="Int64" />
          <Property Name="OrderDate" Type="DateTime" />
          <Property Name="RequiredDate" Type="DateTime" />
          <Property Name="ShippedDate" Type="DateTime" />
          <Property Name="Freight" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="ShipName" Type="String" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ShipAddress" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="ShipCity" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipRegion" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="ShipPostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="ShipCountry" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Customers" Relationship="northwindEFModel.FK_Orders_CustomerID_CustomerID" FromRole="Orders" ToRole="Customers" />
          <NavigationProperty Name="InternationalOrders" Relationship="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" FromRole="Orders" ToRole="InternationalOrders" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_OrderID_OrderID" FromRole="Orders" ToRole="OrderDetails" />
        </EntityType>
        <EntityType Name="PreviousEmployees">
          <Key>
            <PropertyRef Name="EmployeeID" />
          </Key>
          <Property Name="EmployeeID" Type="Int64" Nullable="false" />
          <Property Name="LastName" Type="String" Nullable="false" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Title" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="TitleOfCourtesy" Type="String" MaxLength="25" Unicode="true" FixedLength="false" />
          <Property Name="BirthDate" Type="DateTime" />
          <Property Name="HireDate" Type="DateTime" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="HomePhone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Extension" Type="String" MaxLength="4" Unicode="true" FixedLength="false" />
          <Property Name="Photo" Type="Binary" MaxLength="2147483647" FixedLength="false" />
          <Property Name="Notes" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <Property Name="PhotoPath" Type="String" MaxLength="255" Unicode="true" FixedLength="false" />
        </EntityType>
        <EntityType Name="Products">
          <Key>
            <PropertyRef Name="ProductID" />
          </Key>
          <Property Name="ProductID" Type="Int64" Nullable="false" />
          <Property Name="ProductName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="QuantityPerUnit" Type="String" MaxLength="20" Unicode="true" FixedLength="false" />
          <Property Name="UnitPrice" Type="Decimal" Precision="53" Scale="0" />
          <Property Name="UnitsInStock" Type="Int16" />
          <Property Name="UnitsOnOrder" Type="Int16" />
          <Property Name="ReorderLevel" Type="Int16" />
          <Property Name="Discontinued" Type="Boolean" Nullable="false" />
          <Property Name="DiscontinuedDate" Type="DateTime" />
          <NavigationProperty Name="Categories" Relationship="northwindEFModel.FK_Products_CategoryID_CategoryID" FromRole="Products" ToRole="Categories" />
          <NavigationProperty Name="OrderDetails" Relationship="northwindEFModel.FK_OrderDetails_ProductID_ProductID" FromRole="Products" ToRole="OrderDetails" />
          <NavigationProperty Name="Suppliers" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Products" ToRole="Suppliers" />
        </EntityType>
        <EntityType Name="Regions">
          <Key>
            <PropertyRef Name="RegionID" />
          </Key>
          <Property Name="RegionID" Type="Int64" Nullable="false" />
          <Property Name="RegionDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Territories" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Regions" ToRole="Territories" />
        </EntityType>
        <EntityType Name="Suppliers">
          <Key>
            <PropertyRef Name="SupplierID" />
          </Key>
          <Property Name="SupplierID" Type="Int64" Nullable="false" />
          <Property Name="CompanyName" Type="String" Nullable="false" MaxLength="40" Unicode="true" FixedLength="false" />
          <Property Name="ContactName" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="ContactTitle" Type="String" MaxLength="30" Unicode="true" FixedLength="false" />
          <Property Name="Address" Type="String" MaxLength="60" Unicode="true" FixedLength="false" />
          <Property Name="City" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Region" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="PostalCode" Type="String" MaxLength="10" Unicode="true" FixedLength="false" />
          <Property Name="Country" Type="String" MaxLength="15" Unicode="true" FixedLength="false" />
          <Property Name="Phone" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="Fax" Type="String" MaxLength="24" Unicode="true" FixedLength="false" />
          <Property Name="HomePage" Type="String" MaxLength="2147483647" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Products" Relationship="northwindEFModel.FK_Products_SupplierID_SupplierID" FromRole="Suppliers" ToRole="Products" />
        </EntityType>
        <EntityType Name="Territories">
          <Key>
            <PropertyRef Name="TerritoryID" />
          </Key>
          <Property Name="TerritoryID" Type="Int64" Nullable="false" />
          <Property Name="TerritoryDescription" Type="String" Nullable="false" MaxLength="50" Unicode="true" FixedLength="false" />
          <NavigationProperty Name="Regions" Relationship="northwindEFModel.FK_Territories_RegionID_RegionID" FromRole="Territories" ToRole="Regions" />
          <NavigationProperty Name="Employees" Relationship="northwindEFModel.EmployeesTerritories" FromRole="Territories" ToRole="Employees" />
        </EntityType>
        <Association Name="FK_Products_CategoryID_CategoryID">
          <End Role="Categories" Type="northwindEFModel.Categories" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Orders_CustomerID_CustomerID">
          <End Role="Customers" Type="northwindEFModel.Customers" Multiplicity="0..1" />
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="*" />
        </Association>
        <Association Name="FK_InternationalOrders_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="InternationalOrders" Type="northwindEFModel.InternationalOrders" Multiplicity="0..1" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="InternationalOrders">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_OrderID_OrderID">
          <End Role="Orders" Type="northwindEFModel.Orders" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Orders">
              <PropertyRef Name="OrderID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="OrderID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_OrderDetails_ProductID_ProductID">
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="1" />
          <End Role="OrderDetails" Type="northwindEFModel.OrderDetails" Multiplicity="*" />
          <ReferentialConstraint>
            <Principal Role="Products">
              <PropertyRef Name="ProductID" />
            </Principal>
            <Dependent Role="OrderDetails">
              <PropertyRef Name="ProductID" />
            </Dependent>
          </ReferentialConstraint>
        </Association>
        <Association Name="FK_Products_SupplierID_SupplierID">
          <End Role="Suppliers" Type="northwindEFModel.Suppliers" Multiplicity="0..1" />
          <End Role="Products" Type="northwindEFModel.Products" Multiplicity="*" />
        </Association>
        <Association Name="FK_Territories_RegionID_RegionID">
          <End Role="Regions" Type="northwindEFModel.Regions" Multiplicity="1" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        <Association Name="EmployeesTerritories">
          <End Role="Employees" Type="northwindEFModel.Employees" Multiplicity="*" />
          <End Role="Territories" Type="northwindEFModel.Territories" Multiplicity="*" />
        </Association>
        </Schema>
    </edmx:ConceptualModels>
    <!-- C-S mapping content -->
    <edmx:Mappings>
      <Mapping Space="C-S" xmlns="urn:schemas-microsoft-com:windows:storage:mapping:CS">
        <EntityContainerMapping StorageEntityContainer="northwindEFModelStoreContainer" CdmEntityContainer="northwindEFEntities">
          <EntitySetMapping Name="Categories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Categories)">
              <MappingFragment StoreEntitySet="Categories">
                <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
                <ScalarProperty Name="CategoryName" ColumnName="CategoryName" />
                <ScalarProperty Name="Description" ColumnName="Description" />
                <ScalarProperty Name="Picture" ColumnName="Picture" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Customers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Customers)">
              <MappingFragment StoreEntitySet="Customers">
                <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Employees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Employees)">
              <MappingFragment StoreEntitySet="Employees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="InternationalOrders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.InternationalOrders)">
              <MappingFragment StoreEntitySet="InternationalOrders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="CustomsDescription" ColumnName="CustomsDescription" />
                <ScalarProperty Name="ExciseTax" ColumnName="ExciseTax" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="OrderDetails">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.OrderDetails)">
              <MappingFragment StoreEntitySet="OrderDetails">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="Quantity" ColumnName="Quantity" />
                <ScalarProperty Name="Discount" ColumnName="Discount" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Orders">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Orders)">
              <MappingFragment StoreEntitySet="Orders">
                <ScalarProperty Name="OrderID" ColumnName="OrderID" />
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="OrderDate" ColumnName="OrderDate" />
                <ScalarProperty Name="RequiredDate" ColumnName="RequiredDate" />
                <ScalarProperty Name="ShippedDate" ColumnName="ShippedDate" />
                <ScalarProperty Name="Freight" ColumnName="Freight" />
                <ScalarProperty Name="ShipName" ColumnName="ShipName" />
                <ScalarProperty Name="ShipAddress" ColumnName="ShipAddress" />
                <ScalarProperty Name="ShipCity" ColumnName="ShipCity" />
                <ScalarProperty Name="ShipRegion" ColumnName="ShipRegion" />
                <ScalarProperty Name="ShipPostalCode" ColumnName="ShipPostalCode" />
                <ScalarProperty Name="ShipCountry" ColumnName="ShipCountry" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="PreviousEmployees">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.PreviousEmployees)">
              <MappingFragment StoreEntitySet="PreviousEmployees">
                <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
                <ScalarProperty Name="LastName" ColumnName="LastName" />
                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
                <ScalarProperty Name="Title" ColumnName="Title" />
                <ScalarProperty Name="TitleOfCourtesy" ColumnName="TitleOfCourtesy" />
                <ScalarProperty Name="BirthDate" ColumnName="BirthDate" />
                <ScalarProperty Name="HireDate" ColumnName="HireDate" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="HomePhone" ColumnName="HomePhone" />
                <ScalarProperty Name="Extension" ColumnName="Extension" />
                <ScalarProperty Name="Photo" ColumnName="Photo" />
                <ScalarProperty Name="Notes" ColumnName="Notes" />
                <ScalarProperty Name="PhotoPath" ColumnName="PhotoPath" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Products">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Products)">
              <MappingFragment StoreEntitySet="Products">
                <ScalarProperty Name="ProductID" ColumnName="ProductID" />
                <ScalarProperty Name="ProductName" ColumnName="ProductName" />
                <ScalarProperty Name="QuantityPerUnit" ColumnName="QuantityPerUnit" />
                <ScalarProperty Name="UnitPrice" ColumnName="UnitPrice" />
                <ScalarProperty Name="UnitsInStock" ColumnName="UnitsInStock" />
                <ScalarProperty Name="UnitsOnOrder" ColumnName="UnitsOnOrder" />
                <ScalarProperty Name="ReorderLevel" ColumnName="ReorderLevel" />
                <ScalarProperty Name="Discontinued" ColumnName="Discontinued" />
                <ScalarProperty Name="DiscontinuedDate" ColumnName="DiscontinuedDate" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Regions">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Regions)">
              <MappingFragment StoreEntitySet="Regions">
                <ScalarProperty Name="RegionID" ColumnName="RegionID" />
                <ScalarProperty Name="RegionDescription" ColumnName="RegionDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Suppliers">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Suppliers)">
              <MappingFragment StoreEntitySet="Suppliers">
                <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
                <ScalarProperty Name="CompanyName" ColumnName="CompanyName" />
                <ScalarProperty Name="ContactName" ColumnName="ContactName" />
                <ScalarProperty Name="ContactTitle" ColumnName="ContactTitle" />
                <ScalarProperty Name="Address" ColumnName="Address" />
                <ScalarProperty Name="City" ColumnName="City" />
                <ScalarProperty Name="Region" ColumnName="Region" />
                <ScalarProperty Name="PostalCode" ColumnName="PostalCode" />
                <ScalarProperty Name="Country" ColumnName="Country" />
                <ScalarProperty Name="Phone" ColumnName="Phone" />
                <ScalarProperty Name="Fax" ColumnName="Fax" />
                <ScalarProperty Name="HomePage" ColumnName="HomePage" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <EntitySetMapping Name="Territories">
            <EntityTypeMapping TypeName="IsTypeOf(northwindEFModel.Territories)">
              <MappingFragment StoreEntitySet="Territories">
                <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
                <ScalarProperty Name="TerritoryDescription" ColumnName="TerritoryDescription" />
              </MappingFragment>
            </EntityTypeMapping>
          </EntitySetMapping>
          <AssociationSetMapping Name="FK_Products_CategoryID_CategoryID" TypeName="northwindEFModel.FK_Products_CategoryID_CategoryID" StoreEntitySet="Products">
            <EndProperty Name="Categories">
              <ScalarProperty Name="CategoryID" ColumnName="CategoryID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="CategoryID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Orders_CustomerID_CustomerID" TypeName="northwindEFModel.FK_Orders_CustomerID_CustomerID" StoreEntitySet="Orders">
            <EndProperty Name="Customers">
              <ScalarProperty Name="CustomerID" ColumnName="CustomerID" />
            </EndProperty>
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <Condition ColumnName="CustomerID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_InternationalOrders_OrderID_OrderID" TypeName="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" StoreEntitySet="InternationalOrders">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="InternationalOrders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_OrderID_OrderID" TypeName="northwindEFModel.FK_OrderDetails_OrderID_OrderID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Orders">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_OrderDetails_ProductID_ProductID" TypeName="northwindEFModel.FK_OrderDetails_ProductID_ProductID" StoreEntitySet="OrderDetails">
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <EndProperty Name="OrderDetails">
              <ScalarProperty Name="OrderID" ColumnName="OrderID" />
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Products_SupplierID_SupplierID" TypeName="northwindEFModel.FK_Products_SupplierID_SupplierID" StoreEntitySet="Products">
            <EndProperty Name="Suppliers">
              <ScalarProperty Name="SupplierID" ColumnName="SupplierID" />
            </EndProperty>
            <EndProperty Name="Products">
              <ScalarProperty Name="ProductID" ColumnName="ProductID" />
            </EndProperty>
            <Condition ColumnName="SupplierID" IsNull="false" />
          </AssociationSetMapping>
          <AssociationSetMapping Name="FK_Territories_RegionID_RegionID" TypeName="northwindEFModel.FK_Territories_RegionID_RegionID" StoreEntitySet="Territories">
            <EndProperty Name="Regions">
              <ScalarProperty Name="RegionID" ColumnName="RegionID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          <AssociationSetMapping Name="EmployeesTerritories" TypeName="northwindEFModel.EmployeesTerritories" StoreEntitySet="EmployeesTerritories">
            <EndProperty Name="Employees">
              <ScalarProperty Name="EmployeeID" ColumnName="EmployeeID" />
            </EndProperty>
            <EndProperty Name="Territories">
              <ScalarProperty Name="TerritoryID" ColumnName="TerritoryID" />
            </EndProperty>
          </AssociationSetMapping>
          </EntityContainerMapping>
      </Mapping>
    </edmx:Mappings>
  </edmx:Runtime>
  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
  <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2007/06/edmx">
    <edmx:Connection>
      <DesignerInfoPropertySet>
        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
      </DesignerInfoPropertySet>
    </edmx:Connection>
    <edmx:Options>
      <DesignerInfoPropertySet>
        <DesignerProperty Name="ValidateOnBuild" Value="true" />
      </DesignerInfoPropertySet>
    </edmx:Options>
    <!-- Diagram content (shape and connector positions) -->
    <edmx:Diagrams>
      <Diagram Name="NorthwindModel">
        <EntityTypeShape EntityType="northwindEFModel.Categories" Width="1.5" PointX="0.75" PointY="1.625" Height="1.9802864583333335" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Customers" Width="1.5" PointX="0.75" PointY="9.625" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Employees" Width="1.5" PointX="2.75" PointY="14.625" Height="4.4802050781250014" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.InternationalOrders" Width="1.5" PointX="5.25" PointY="10.375" Height="1.7879850260416674" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.OrderDetails" Width="1.5" PointX="5.25" PointY="1.5" Height="2.3648893229166656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Orders" Width="1.5" PointX="3" PointY="9.25" Height="3.9033007812499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.PreviousEmployees" Width="1.5" PointX="7.75" PointY="0.75" Height="4.2879036458333317" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Products" Width="1.5" PointX="3" PointY="1" Height="3.3263964843749996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Regions" Width="1.5" PointX="2.75" PointY="6" Height="1.5956835937499996" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Suppliers" Width="1.5" PointX="0.75" PointY="4.875" Height="3.5186979166666656" IsExpanded="true" />
        <EntityTypeShape EntityType="northwindEFModel.Territories" Width="1.5" PointX="5" PointY="5.875" Height="1.7879850260416674" IsExpanded="true" />
        <AssociationConnector Association="northwindEFModel.FK_Products_CategoryID_CategoryID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="2.6151432291666667" />
          <ConnectorPoint PointX="3" PointY="2.6151432291666667" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Orders_CustomerID_CustomerID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="11.2881982421875" />
          <ConnectorPoint PointX="3" PointY="11.2881982421875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_InternationalOrders_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.010416666666667" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.177083333333333" PointY="11.268992513020834" />
          <ConnectorPoint PointX="5.25" PointY="11.268992513020834" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_OrderID_OrderID" ManuallyRouted="false">
          <ConnectorPoint PointX="3.75" PointY="9.25" />
          <ConnectorPoint PointX="3.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="7.84568359375" />
          <ConnectorPoint PointX="4.75" PointY="2.6824446614583328" />
          <ConnectorPoint PointX="5.25" PointY="2.6824446614583328" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_OrderDetails_ProductID_ProductID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.5" PointY="2.0287223307291664" />
          <ConnectorPoint PointX="5.25" PointY="2.0287223307291664" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Products_SupplierID_SupplierID" ManuallyRouted="false">
          <ConnectorPoint PointX="2.25" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="5.40625" />
          <ConnectorPoint PointX="4.40625" PointY="4.326396484375" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.FK_Territories_RegionID_RegionID" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="6.797841796875" />
          <ConnectorPoint PointX="4.666666666666667" PointY="6.7978417968749989" />
          <ConnectorPoint PointX="4.833333333333333" PointY="6.797841796875" />
          <ConnectorPoint PointX="5" PointY="6.797841796875" /></AssociationConnector>
        <AssociationConnector Association="northwindEFModel.EmployeesTerritories" ManuallyRouted="false">
          <ConnectorPoint PointX="4.25" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="16.8651025390625" />
          <ConnectorPoint PointX="5.09375" PointY="7.6629850260416674" /></AssociationConnector>
        </Diagram></edmx:Diagrams>
  </edmx:Designer>
</edmx:Edmx>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Changes to testlinq/Program.cs.








1
2



3

4







5





6
7
8
9
10
11





















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































12
13
14
15
16
17
18
19
20
21
22
23







using System;
using System.Collections.Generic;



using System.Linq;

using System.Text;







using System.Data.Objects;






namespace testlinq
{
  class Program
  {
    static void Main(string[] args)





















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































    {
      using (northwindEFEntities db = new northwindEFEntities())
      {
        {
          string entitySQL = "SELECT VALUE o FROM Orders AS o WHERE SQLite.DatePart('yyyy', o.OrderDate) = 1997;";
          ObjectQuery<Orders> query = db.CreateQuery<Orders>(entitySQL);

          foreach (Orders o in query)
          {
            Console.WriteLine(o.ShipPostalCode);
          }
        }
>
>
>
>
>
>
>


>
>
>

>
|
>
>
>
>
>
>
>

>
>
>
>
>





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




|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Transactions;

#if USE_ENTITY_FRAMEWORK_6
using System.Data.Entity.Core;
using System.Data.Entity.Core.EntityClient;
using System.Data.Entity.Core.Objects;
#else
using System.Data.EntityClient;
using System.Data.Objects;
#endif

#if NET_STANDARD_21
using System.Data.SQLite.EF6;
#endif

namespace testlinq
{
  class Program
  {
      private static int Main(string[] args)
      {
          if (Environment.GetEnvironmentVariable("BREAK") != null)
          {
              Console.WriteLine(
                  "Attach a debugger to process {0} and press any key to continue.",
                  Process.GetCurrentProcess().Id);

              try
              {
                  Console.ReadKey(true); /* throw */
              }
              catch (InvalidOperationException) // Console.ReadKey
              {
                  // do nothing.
              }

              Debugger.Break();
          }

#if NET_STANDARD_21
          DbProviderFactories.RegisterFactory("System.Data.SQLite.EF6", SQLiteProviderFactory.Instance);
#endif

          string arg = null;

          if ((args != null) && (args.Length > 0))
              arg = args[0];

          if (arg == null)
              arg = String.Empty;

          arg = arg.Trim().TrimStart('-', '/').ToLowerInvariant();

          switch (arg)
          {
              case "": // String.Empty
              case "old":
                  {
                      return OldTests();
                  }
              case "datetime":
                  {
                      return DateTimeTest();
                  }
              case "datetime2":
                  {
                      string dateTimeFormat = null;

                      if (args.Length > 1)
                          dateTimeFormat = args[1];

                      DateTimeTest2(dateTimeFormat);
                      return 0;
                  }
              case "skip":
                  {
                      int pageSize = 0;

                      if (args.Length > 1)
                      {
                          arg = args[1];

                          if (arg != null)
                              pageSize = int.Parse(arg.Trim());
                      }

                      return SkipTest(pageSize);
                  }
              case "substring":
                  {
                      return SubStringTest();
                  }
#if USE_INTEROP_DLL && INTEROP_EXTENSION_FUNCTIONS
              case "unionall":
                  {
                      return UnionAllTest();
                  }
#endif
              case "endswith":
                  {
                      string value = null;

                      if (args.Length > 1)
                      {
                          value = args[1];

                          if (value != null)
                              value = value.Trim();
                      }

                      return EndsWithTest(value);
                  }
              case "startswith":
                  {
                      string value = null;

                      if (args.Length > 1)
                      {
                          value = args[1];

                          if (value != null)
                              value = value.Trim();
                      }

                      return StartsWithTest(value);
                  }
              case "eftransaction":
                  {
                      bool value = false;

                      if (args.Length > 1)
                      {
                          if (!bool.TryParse(args[1], out value))
                          {
                              Console.WriteLine(
                                  "cannot parse \"{0}\" as boolean",
                                  args[1]);

                              return 1;
                          }
                      }

                      return EFTransactionTest(value);
                  }
              case "insert":
                  {
                      return InsertTest();
                  }
              case "update":
                  {
                      return UpdateTest();
                  }
              case "binaryguid":
                  {
                      bool value = false;

                      if (args.Length > 1)
                      {
                          if (!bool.TryParse(args[1], out value))
                          {
                              Console.WriteLine(
                                  "cannot parse \"{0}\" as boolean",
                                  args[1]);

                              return 1;
                          }
                      }

                      return BinaryGuidTest(value);
                  }
#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_21
              case "binaryguid2":
                  {
                      bool value = false;

                      if (args.Length > 1)
                      {
                          if (!bool.TryParse(args[1], out value))
                          {
                              Console.WriteLine(
                                  "cannot parse \"{0}\" as boolean",
                                  args[1]);

                              return 1;
                          }
                      }

                      return BinaryGuidTest2(value);
                  }
#endif
#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_21
              case "round":
                  {
                      return RoundTest();
                  }
#endif
              case "complexprimarykey":
                  {
                      return ComplexPrimaryKeyTest();
                  }
              default:
                  {
                      Console.WriteLine("unknown test \"{0}\"", arg);
                      return 1;
                  }
          }
      }

      /// <summary>
      /// Attempts to obtain the underlying store connection
      /// (a <see cref="DbConnection" />) from the specified
      /// <see cref="EntityConnection" />.
      /// </summary>
      /// <param name="entityConnection">
      /// The <see cref="EntityConnection" /> to use.
      /// </param>
      /// <returns>
      /// The <see cref="DbConnection" /> -OR- null if it
      /// cannot be determined.
      /// </returns>
      private static DbConnection GetStoreConnection(
          EntityConnection entityConnection
          )
      {
          //
          // NOTE: No entity connection, no store connection.
          //
          if (entityConnection == null)
              return null;

          //
          // HACK: We need the underlying store connection and
          //       the legacy versions of the .NET Framework do
          //       not expose it; therefore, attempt to grab it
          //       by force.
          //
          FieldInfo fieldInfo = typeof(EntityConnection).GetField(
              "_storeConnection", BindingFlags.Instance |
              BindingFlags.NonPublic);

          //
          // NOTE: If the field is not found, just return null.
          //
          if (fieldInfo == null)
              return null;

          return fieldInfo.GetValue(entityConnection) as DbConnection;
      }

      //
      // NOTE: Used to verify that the SUBSTR function is used to
      //       implement the Substring method.
      //
      private static int SubStringTest()
      {
          using (northwindEFEntities db = new northwindEFEntities())
          {
              try
              {
                  bool once = false;

                  var query = db.Customers.Select(
                      p => "test".Substring(1) != null);

                  foreach (var result in query)
                  {
                      if (once)
                          Console.Write(' ');

                      Console.Write(result);

                      once = true;
                  }

                  return 0;
              }
              catch (Exception e)
              {
                  Console.WriteLine(e);
              }
          }

          return 1;
      }

      //
      // NOTE: Used to test the fix for ticket [8b7d179c3c].
      //
      private static int SkipTest(int pageSize)
      {
          using (northwindEFEntities db = new northwindEFEntities())
          {
              bool once = false;
              int count = db.Customers.Count();

              int PageCount = (pageSize != 0) ?
                  (count / pageSize) + ((count % pageSize) == 0 ? 0 : 1) : 1;

              for (int pageIndex = 0; pageIndex < PageCount; pageIndex++)
              {
                  var query = db.Customers.OrderBy(p => p.City).
                      Skip(pageSize * pageIndex).Take(pageSize);

                  foreach (Customers customers in query)
                  {
                      if (once)
                          Console.Write(' ');

                      Console.Write(customers.CustomerID);

                      once = true;
                  }
              }
          }

          return 0;
      }

      //
      // NOTE: Used to test the fix for ticket [59edc1018b].
      //
      private static int EndsWithTest(string value)
      {
          using (northwindEFEntities db = new northwindEFEntities())
          {
              bool once = false;
              var query = from c in db.Customers
                          where c.City.EndsWith(value)
                          orderby c.CustomerID
                          select c;

              foreach (Customers customers in query)
              {
                  if (once)
                      Console.Write(' ');

                  Console.Write(customers.CustomerID);

                  once = true;
              }
          }

          return 0;
      }

      //
      // NOTE: Used to verify the behavior from ticket [00f86f9739].
      //
      private static int StartsWithTest(string value)
      {
          using (northwindEFEntities db = new northwindEFEntities())
          {
              bool once = false;
              var query = from c in db.Customers
                          where c.City.StartsWith(value)
                          orderby c.CustomerID
                          select c;

              foreach (Customers customers in query)
              {
                  if (once)
                      Console.Write(' ');

                  Console.Write(customers.CustomerID);

                  once = true;
              }
          }

          return 0;
      }

#if USE_INTEROP_DLL && INTEROP_EXTENSION_FUNCTIONS
      //
      // NOTE: Used to test the fix for ticket [0a32885109].
      //
      private static int UnionAllTest()
      {
          using (northwindEFEntities db = new northwindEFEntities())
          {
              bool once = false;

              var customers1 = db.Customers.Where(
                  f => f.Orders.Any()).OrderByDescending(
                    f => f.CompanyName).Skip(1).Take(1);

              var customers2 = db.Customers.Where(
                  f => f.Orders.Any()).OrderBy(
                    f => f.CompanyName).Skip(1).Take(1);

              var customers3 = db.Customers.Where(
                  f => f.CustomerID.StartsWith("B")).OrderBy(
                    f => f.CompanyName).Skip(1).Take(1);

              foreach (var customer in customers1)
              {
                  if (once)
                      Console.Write(' ');

                  Console.Write(customer.CustomerID);
                  once = true;
              }

              foreach (var customer in customers2)
              {
                  if (once)
                      Console.Write(' ');

                  Console.Write(customer.CustomerID);
                  once = true;
              }

              foreach (var customer in customers3)
              {
                  if (once)
                      Console.Write(' ');

                  Console.Write(customer.CustomerID);
                  once = true;
              }

              foreach (var customer in customers1.Concat(customers2))
              {
                  if (once)
                      Console.Write(' ');

                  Console.Write(customer.CustomerID);
                  once = true;
              }

              foreach (var customer in
                    customers1.Concat(customers2).Concat(customers3))
              {
                  if (once)
                      Console.Write(' ');

                  Console.Write(customer.CustomerID);
                  once = true;
              }
          }

          return 0;
      }
#endif

      //
      // NOTE: Used to test the fix for ticket [ccfa69fc32].
      //
      private static int EFTransactionTest(bool add)
      {
          //
          // NOTE: Some of these territories already exist and should cause
          //       an exception to be thrown when we try to INSERT them.
          //
          long[] territoryIds = new long[] {
                 1,    2,    3,    4,    5, // NOTE: Success
                 6,    7,    8,    9,   10, // NOTE: Success
              1576, 1577, 1578, 1579, 1580, // NOTE: Success
              1581, 1730, 1833, 2116, 2139, // NOTE: Fail (1581)
              2140, 2141                    // NOTE: Skipped
          };

          if (add)
          {
              using (northwindEFEntities db = new northwindEFEntities())
              {
                  using (TransactionScope scope = new TransactionScope())
                  {
                      //
                      // NOTE: *REQUIRED* This is required so that the
                      //       Entity Framework is prevented from opening
                      //       multiple connections to the underlying SQLite
                      //       database (i.e. which would result in multiple
                      //       IMMEDIATE transactions, thereby failing [later
                      //       on] with locking errors).
                      //
                      db.Connection.Open();

                      foreach (int id in territoryIds)
                      {
                          Territories territories = new Territories();

                          territories.TerritoryID = id;
                          territories.TerritoryDescription = String.Format(
                              "Test Territory #{0}", id);
                          territories.Regions = db.Regions.First();

                          db.AddObject("Territories", territories);
                      }

                      try
                      {
#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_21
                          db.SaveChanges(SaveOptions.None);
#else
                          db.SaveChanges(false);
#endif
                      }
                      catch (Exception e)
                      {
                          Console.WriteLine(e);
                      }
                      finally
                      {
                          scope.Complete();
                          db.AcceptAllChanges();
                      }
                  }
              }
          }
          else
          {
              using (northwindEFEntities db = new northwindEFEntities())
              {
                  bool once = false;
#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_21
                  var query = from t in db.Territories
                    where territoryIds.AsQueryable<long>().Contains<long>(t.TerritoryID)
                    orderby t.TerritoryID
                    select t;

                  foreach (Territories territories in query)
                  {
                      if (once)
                          Console.Write(' ');

                      Console.Write(territories.TerritoryID);

                      once = true;
                  }
#else
                  //
                  // HACK: We cannot use the Contains extension method within a
                  //       LINQ query with the .NET Framework 3.5.
                  //
                  var query = from t in db.Territories
                    orderby t.TerritoryID
                    select t;

                  foreach (Territories territories in query)
                  {
                      if (Array.IndexOf(territoryIds, territories.TerritoryID) == -1)
                          continue;

                      if (once)
                          Console.Write(' ');

                      Console.Write(territories.TerritoryID);

                      once = true;
                  }
#endif
              }
          }

          return 0;
      }

      //
      // NOTE: Used to test the INSERT fix (i.e. an extra semi-colon in
      //       the SQL statement after the actual INSERT statement in
      //       the follow-up SELECT statement).
      //
      private static int InsertTest()
      {
          using (northwindEFEntities db = new northwindEFEntities())
          {
              long orderId = 10248;
              long productId = 1;
              int[] counts = { 0 };

              //
              // NOTE: *REQUIRED* This is required so that the
              //       Entity Framework is prevented from opening
              //       multiple connections to the underlying SQLite
              //       database (i.e. which would result in multiple
              //       IMMEDIATE transactions, thereby failing [later
              //       on] with locking errors).
              //
              db.Connection.Open();

              KeyValuePair<string, object> orderIdPair =
                  new KeyValuePair<string, object>("OrderID", orderId);

              KeyValuePair<string, object> productIdPair =
                  new KeyValuePair<string, object>("ProductID", productId);

              /////////////////////////////////////////////////////////////////

              OrderDetails newOrderDetails = new OrderDetails();

              newOrderDetails.OrderID = orderId;
              newOrderDetails.ProductID = productId;
              newOrderDetails.UnitPrice = (decimal)1.23;
              newOrderDetails.Quantity = 1;
              newOrderDetails.Discount = 0.0f;

              newOrderDetails.OrdersReference.EntityKey = new EntityKey(
                  "northwindEFEntities.Orders",
                  new KeyValuePair<string, object>[] { orderIdPair });

              newOrderDetails.ProductsReference.EntityKey = new EntityKey(
                  "northwindEFEntities.Products",
                  new KeyValuePair<string, object>[] { productIdPair });

              db.AddObject("OrderDetails", newOrderDetails);

              try
              {
                  db.SaveChanges();
                  counts[0]++;
              }
              catch (Exception e)
              {
                  Console.WriteLine(e);
              }
              finally
              {
                  db.AcceptAllChanges();
              }

              Console.WriteLine("inserted {0}", counts[0]);
          }

          return 0;
      }

      //
      // NOTE: Used to test the UPDATE fix (i.e. the missing semi-colon
      //       in the SQL statement between the actual UPDATE statement
      //       and the follow-up SELECT statement).
      //
      private static int UpdateTest()
      {
          long[] orderIds = new long[] {
              0
          };

          using (northwindEFEntities db = new northwindEFEntities())
          {
              int[] counts = { 0, 0 };

              //
              // NOTE: *REQUIRED* This is required so that the
              //       Entity Framework is prevented from opening
              //       multiple connections to the underlying SQLite
              //       database (i.e. which would result in multiple
              //       IMMEDIATE transactions, thereby failing [later
              //       on] with locking errors).
              //
              db.Connection.Open();

              for (int index = 0; index < orderIds.Length; index++)
              {
                  Orders newOrders = new Orders();

                  newOrders.ShipAddress = String.Format(
                      "Test Order Ship Address, Index #{0}",
                      index);

                  db.AddObject("Orders", newOrders);

                  try
                  {
                      db.SaveChanges();
                      counts[0]++;

                      // StoreGeneratedPattern="Identity"
                      orderIds[index] = newOrders.OrderID;

                      // StoreGeneratedPattern="None"
                      newOrders.ShipAddress = String.Format(
                          "New Order Ship Address #{0}",
                          orderIds[index]);

                      // StoreGeneratedPattern="Computed"
                      newOrders.Freight = 1;

                      db.SaveChanges();
                      counts[1]++;
                  }
                  catch (Exception e)
                  {
                      Console.WriteLine(e);
                  }
                  finally
                  {
                      db.AcceptAllChanges();
                  }
              }

              Console.WriteLine(
                  "inserted {0} updated {1}", counts[0], counts[1]);
          }

          return 0;
      }

      //
      // NOTE: Used to test the BinaryGUID fix (i.e. BLOB literal formatting
      //       of GUID values when the BinaryGUID connection property has been
      //       enabled).
      //
      private static int BinaryGuidTest(bool binaryGuid)
      {
          Environment.SetEnvironmentVariable(
              "AppendManifestToken_SQLiteProviderManifest",
              String.Format(";BinaryGUID={0};", binaryGuid));

          using (northwindEFEntities db = new northwindEFEntities())
          {
              string sql = "SELECT VALUE GUID " +
                  "'2d3d2d3d-2d3d-2d3d-2d3d-2d3d2d3d2d3d' " +
                  "FROM Orders AS o WHERE o.OrderID = 10248;";

              ObjectQuery<string> query = db.CreateQuery<string>(sql);

              foreach (string s in query)
                  Console.WriteLine(s);
          }

          Environment.SetEnvironmentVariable(
              "AppendManifestToken_SQLiteProviderManifest",
              null);

          return 0;
      }

#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_21
      //
      // NOTE: Used to test the BinaryGUID connection string property with
      //       the Contains() function (ticket [a4d9c7ee94]).  We cannot
      //       use the Contains extension method within a LINQ query with
      //       the .NET Framework 3.5.
      //
      private static int BinaryGuidTest2(bool binaryGuid)
      {
          Environment.SetEnvironmentVariable(
              "AppendManifestToken_SQLiteProviderManifest",
              String.Format(";BinaryGUID={0};", binaryGuid));

          using (northwindEFEntities db = new northwindEFEntities())
          {
              Guid guid = new Guid("2d3d2d3d-2d3d-2d3d-2d3d-2d3d2d3d2d3d");
              Guid[] guids = new Guid[] { guid };

              bool once = false;
              var query = from t in db.Territories
                          where guids.AsQueryable<Guid>().Contains<Guid>(guid)
                          orderby t.TerritoryID
                          select t;

              foreach (Territories t in query)
              {
                  if (once)
                      Console.Write(' ');

                  Console.Write(t.TerritoryID);

                  once = true;
              }
          }

          Environment.SetEnvironmentVariable(
              "AppendManifestToken_SQLiteProviderManifest",
              null);

          return 0;
      }
#endif

      private static int ComplexPrimaryKeyTest()
      {
          using (northwindEFEntities db = new northwindEFEntities())
          {
              long orderId = 10248;
              long productId = 1;
              int[] counts = { 0, 0 };

              //
              // NOTE: *REQUIRED* This is required so that the
              //       Entity Framework is prevented from opening
              //       multiple connections to the underlying SQLite
              //       database (i.e. which would result in multiple
              //       IMMEDIATE transactions, thereby failing [later
              //       on] with locking errors).
              //
              db.Connection.Open();

              KeyValuePair<string, object> orderIdPair =
                  new KeyValuePair<string, object>("OrderID", orderId);

              KeyValuePair<string, object> productIdPair =
                  new KeyValuePair<string, object>("ProductID", productId);

              /////////////////////////////////////////////////////////////////

              OrderDetails newOrderDetails = new OrderDetails();

              newOrderDetails.OrderID = orderId;
              newOrderDetails.ProductID = productId;
              newOrderDetails.UnitPrice = (decimal)1.23;
              newOrderDetails.Quantity = 1;
              newOrderDetails.Discount = 0.0f;

              newOrderDetails.OrdersReference.EntityKey = new EntityKey(
                  "northwindEFEntities.Orders",
                  new KeyValuePair<string, object>[] { orderIdPair });

              newOrderDetails.ProductsReference.EntityKey = new EntityKey(
                  "northwindEFEntities.Products",
                  new KeyValuePair<string, object>[] { productIdPair });

              db.AddObject("OrderDetails", newOrderDetails);

              try
              {
                  db.SaveChanges();
                  counts[0]++;
              }
              catch (Exception e)
              {
                  Console.WriteLine(e);
              }
              finally
              {
                  db.AcceptAllChanges();
              }

              try
              {
                  db.Refresh(RefreshMode.StoreWins, newOrderDetails);
                  counts[0]++;
              }
              catch (Exception e)
              {
                  Console.WriteLine(e);
              }

              Console.WriteLine("inserted {0}", counts[0]);

              /////////////////////////////////////////////////////////////////

              newOrderDetails.UnitPrice = (decimal)2.34;
              newOrderDetails.Quantity = 2;
              newOrderDetails.Discount = 0.1f;

              try
              {
                  db.SaveChanges();
                  counts[1]++;
              }
              catch (Exception e)
              {
                  Console.WriteLine(e);
              }
              finally
              {
                  db.AcceptAllChanges();
              }

              try
              {
                  db.Refresh(RefreshMode.StoreWins, newOrderDetails);
                  counts[1]++;
              }
              catch (Exception e)
              {
                  Console.WriteLine(e);
              }

              Console.WriteLine("updated {0}", counts[1]);
          }

          return 0;
      }

      private static int DateTimeTest()
      {
          using (northwindEFEntities db = new northwindEFEntities())
          {
              DateTime dateTime = new DateTime(1997, 1, 1, 0, 0, 0, DateTimeKind.Local);
              int c1 = db.Orders.Where(i => i.OrderDate == new DateTime(1997, 1, 1, 0, 0, 0, DateTimeKind.Local)).Count();
              int c2 = db.Orders.Where(i => i.OrderDate == dateTime).Count();
              return c1 == c2 ? 0 : 1;
          }
      }

      private static void DateTimeTest2(
          string dateTimeFormat
          )
      {
#if !NET_STANDARD_20 && !NET_STANDARD_21
          TraceListener listener = new ConsoleTraceListener();
#else
          TraceListener listener = new TextWriterTraceListener(Console.Out);
#endif

          Trace.Listeners.Add(listener);
          Environment.SetEnvironmentVariable("SQLite_ForceLogPrepare", "1");

          if (dateTimeFormat != null)
          {
              Environment.SetEnvironmentVariable(
                  "AppendManifestToken_SQLiteProviderManifest",
                  String.Format(";DateTimeFormat={0};", dateTimeFormat));
          }

          using (northwindEFEntities db = new northwindEFEntities())
          {
              db.Orders.Where(i => i.OrderDate <
                  new DateTime(1997, 1, 1, 0, 0, 0, DateTimeKind.Local)).Count();
          }

          if (dateTimeFormat != null)
          {
              Environment.SetEnvironmentVariable(
                  "AppendManifestToken_SQLiteProviderManifest",
                  null);
          }

          Environment.SetEnvironmentVariable("SQLite_ForceLogPrepare", null);
          Trace.Listeners.Remove(listener);
      }

#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48 || NET_STANDARD_21
      //
      // NOTE: Used to test the ROUND fix (i.e. being able to properly handle
      //       the two argument form).
      //
      private static int RoundTest()
      {
            using (northwindEFEntities db = new northwindEFEntities())
            {
                bool once = false;

                foreach (int[] i in new int[][] {
                        new int[] { 10503, 65 },
                        new int[] { 10503, 14 },
                        new int[] { 10635, 5 }
                    })
                {
                    for (int j = 0; j < 3; j++)
                    {
                        int oid = i[0];
                        int pid = i[1];

                        var query = from o in db.OrderDetails
                                    where o.OrderID == oid && o.ProductID == pid
                                    select new { NewUnitPrice = Math.Round(o.UnitPrice, j) };

                        foreach (object o in query)
                        {
                            if (once)
                                Console.Write(' ');

                            Console.Write("{0}", o);

                            once = true;
                        }
                    }
                }
            }

            return 0;
      }
#endif

    private static int OldTests()
    {
      using (northwindEFEntities db = new northwindEFEntities())
      {
        {
          string entitySQL = "SELECT VALUE o FROM Orders AS o WHERE SQLite.DatePart('yyyy', o.OrderDate) = 1997 ORDER BY o.OrderID;";
          ObjectQuery<Orders> query = db.CreateQuery<Orders>(entitySQL);

          foreach (Orders o in query)
          {
            Console.WriteLine(o.ShipPostalCode);
          }
        }
42
43
44
45
46
47
48

49
50
51
52
53
54
55
          Console.WriteLine(c.CompanyName);
        }

        {
          DateTime dt = new DateTime(1997, 1, 1);
          var query = from order in db.Orders
                      where order.OrderDate < dt

                      select order;

          foreach (Orders o in query)
          {
            Console.WriteLine(o.OrderDate.ToString());
          }
        }







>







1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
          Console.WriteLine(c.CompanyName);
        }

        {
          DateTime dt = new DateTime(1997, 1, 1);
          var query = from order in db.Orders
                      where order.OrderDate < dt
                      orderby order.OrderID
                      select order;

          foreach (Orders o in query)
          {
            Console.WriteLine(o.OrderDate.ToString());
          }
        }
83
84
85
86
87
88
89
90

91
92
93
94
95
96
97
98
99
100

101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132

133
134
135
136
137
138
139
140





141


142
143
144

          db.DeleteObject(cust);
          db.SaveChanges();
        }

        {
          var query = db.Customers.Where(cust => cust.Country == "Denmark")
                          .SelectMany(cust => cust.Orders.Where(o => o.Freight > 5));


          foreach (Orders c in query)
          {
            Console.WriteLine(c.Freight);
          }
        }

        {
          var query = from c in db.Customers
                      where c.Orders.Any(o => o.OrderDate.HasValue == true && o.OrderDate.Value.Year == 1997)

                      select c;

          foreach (Customers c in query)
          {
            Console.WriteLine(c.CompanyName);
          }
        }

        {
          string entitySQL = "SELECT VALUE o FROM Orders AS o WHERE o.Customers.Country <> 'UK' AND o.Customers.Country <> 'Mexico' AND Year(o.OrderDate) = 1997;";
          ObjectQuery<Orders> query = db.CreateQuery<Orders>(entitySQL);

          foreach (Orders o in query)
          {
            Console.WriteLine(o.ShipPostalCode);
          }
        }

        {
          string entitySQL = "SELECT VALUE o FROM Orders AS o WHERE NewGuid() <> NewGuid();";
          ObjectQuery<Orders> query = db.CreateQuery<Orders>(entitySQL);

          foreach (Orders o in query)
          {
            Console.WriteLine(o.ShipPostalCode);
          }
        }

        // This query requires SQLite 3.6.2 to function correctly
        {
          var query = from p in db.Products
                      where p.OrderDetails.Count(od => od.Orders.Customers.Country == p.Suppliers.Country) > 2

                      select p;

          foreach (Products p in query)
          {
            Console.WriteLine(p.ProductName);
          }
        }
      }





      Console.ReadKey();


    }
  }
}







|
>










>









|









|












>








>
>
>
>
>
|
>
>



1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127

          db.DeleteObject(cust);
          db.SaveChanges();
        }

        {
          var query = db.Customers.Where(cust => cust.Country == "Denmark")
                          .SelectMany(cust => cust.Orders.Where(o => o.Freight > 5))
                          .OrderBy(o => o.Customers.CustomerID);

          foreach (Orders c in query)
          {
            Console.WriteLine(c.Freight);
          }
        }

        {
          var query = from c in db.Customers
                      where c.Orders.Any(o => o.OrderDate.HasValue == true && o.OrderDate.Value.Year == 1997)
                      orderby c.CustomerID
                      select c;

          foreach (Customers c in query)
          {
            Console.WriteLine(c.CompanyName);
          }
        }

        {
          string entitySQL = "SELECT VALUE o FROM Orders AS o WHERE o.Customers.Country <> 'UK' AND o.Customers.Country <> 'Mexico' AND Year(o.OrderDate) = 1997 ORDER BY o.OrderID;";
          ObjectQuery<Orders> query = db.CreateQuery<Orders>(entitySQL);

          foreach (Orders o in query)
          {
            Console.WriteLine(o.ShipPostalCode);
          }
        }

        {
          string entitySQL = "SELECT VALUE o FROM Orders AS o WHERE NewGuid() <> NewGuid() ORDER BY o.OrderID;";
          ObjectQuery<Orders> query = db.CreateQuery<Orders>(entitySQL);

          foreach (Orders o in query)
          {
            Console.WriteLine(o.ShipPostalCode);
          }
        }

        // This query requires SQLite 3.6.2 to function correctly
        {
          var query = from p in db.Products
                      where p.OrderDetails.Count(od => od.Orders.Customers.Country == p.Suppliers.Country) > 2
                      orderby p.ProductID
                      select p;

          foreach (Products p in query)
          {
            Console.WriteLine(p.ProductName);
          }
        }
      }

      //
      // NOTE: (JJM) Removed on 2011/07/06, makes it harder to run this EXE via
      //       the new unit test suite.
      //
      // Console.ReadKey();

      return 0;
    }
  }
}

Changes to testlinq/Properties/AssemblyInfo.cs.








1
2
3
4
5
6
7

8

9


10
11
12
13


14

15

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36







using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.

[assembly: AssemblyTitle("testlinq")]

[assembly: AssemblyDescription("")]


[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("testlinq")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2008")]


[assembly: AssemblyTrademark("")]

[assembly: AssemblyCulture("")]


// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8fd19c43-2fa6-487c-9201-47dd59eed056")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers 
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
>
>
>
>
>
>
>

<


|


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

|
|









|



|


|
|
1
2
3
4
5
6
7
8

9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 *
 * Released to the public domain, use at your own risk!
 ********************************************************/

using System.Reflection;

using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
#if USE_ENTITY_FRAMEWORK_6
[assembly: AssemblyTitle("System.Data.SQLite Tester for Entity Framework 6")]
#else
[assembly: AssemblyTitle("System.Data.SQLite Tester for LINQ")]
#endif

[assembly: AssemblyDescription("ADO.NET Data Provider for SQLite")]
[assembly: AssemblyCompany("https://system.data.sqlite.org/")]
[assembly: AssemblyProduct("System.Data.SQLite")]
[assembly: AssemblyCopyright("Public Domain")]

#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components.  If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8fd19c43-2fa6-487c-9201-47dd59eed056")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.119.0")]
[assembly: AssemblyFileVersion("1.0.119.0")]

Changes to testlinq/northwindEF.db.

cannot compute difference between binary files

Added testlinq/test.2010.csproj.



















































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * test.2010.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>10.0.30319</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid Condition="'$(UseEntityFramework6)' == 'false'">{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}</ProjectGuid>
    <ProjectGuid Condition="'$(UseEntityFramework6)' != 'false'">{2975AE0A-F159-4834-A837-5242C6691886}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace Condition="'$(UseEntityFramework6)' == 'false'">testlinq</RootNamespace>
    <RootNamespace Condition="'$(UseEntityFramework6)' != 'false'">testef6</RootNamespace>
    <AssemblyName Condition="'$(UseEntityFramework6)' == 'false'">testlinq</AssemblyName>
    <AssemblyName Condition="'$(UseEntityFramework6)' != 'false'">testef6</AssemblyName>
    <OldToolsVersion>3.5</OldToolsVersion>
    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx40>true</NetFx40>
    <ConfigurationYear>2010</ConfigurationYear>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Runtime.Serialization" />
    <Reference Include="System.Transactions" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Data" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' == 'false'">
    <Reference Include="System.Data.Entity" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' != 'false'">
    <Reference Include="EntityFramework">
      <HintPath>$(SQLiteNetDir)\Externals\EntityFramework\v6.2\lib\net40\EntityFramework.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
             Include="NorthwindModel.Linq.2008.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>NorthwindModel.Linq.2008.edmx</DependentUpon>
    </Compile>
    <Compile Condition="'$(UseEntityFramework6)' == 'false' And
                        '$(TargetFrameworkVersion)' == 'v4.0'"
             Include="NorthwindModel.Linq.2010.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>NorthwindModel.Linq.2010.edmx</DependentUpon>
    </Compile>
    <Compile Condition="'$(UseEntityFramework6)' != 'false' And
                        '$(TargetFrameworkVersion)' == 'v4.0'"
             Include="NorthwindModel.EF6.2010.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>NorthwindModel.EF6.2010.edmx</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
          Include="2008\LINQ\App.config" />
    <None Condition="'$(UseEntityFramework6)' == 'false' And
                     '$(TargetFrameworkVersion)' == 'v4.0'"
          Include="2010\LINQ\App.config" />
    <None Condition="'$(UseEntityFramework6)' != 'false' And
                     '$(TargetFrameworkVersion)' == 'v4.0'"
          Include="2010\EF6\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <EntityDeploy Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
                  Include="NorthwindModel.Linq.2008.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2008.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' == 'false' And
                             '$(TargetFrameworkVersion)' == 'v4.0'"
                  Include="NorthwindModel.Linq.2010.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2010.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' != 'false' And
                             '$(TargetFrameworkVersion)' == 'v4.0'"
                  Include="NorthwindModel.EF6.2010.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.EF6.2010.Designer.cs</LastGenOutput>
    </EntityDeploy>
  </ItemGroup>
  <ItemGroup>
    <Service Include="{C8F2D6AC-F9F4-4E40-A399-22F9A9A5CBD2}" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CloneAndMark32BitOnlyFrameworkTargetName32;
      CloneAndMark32BitOnlySdkToolsTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added testlinq/test.2012.csproj.























































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * test.2012.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid Condition="'$(UseEntityFramework6)' == 'false'">{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}</ProjectGuid>
    <ProjectGuid Condition="'$(UseEntityFramework6)' != 'false'">{2975AE0A-F159-4834-A837-5242C6691886}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace Condition="'$(UseEntityFramework6)' == 'false'">testlinq</RootNamespace>
    <RootNamespace Condition="'$(UseEntityFramework6)' != 'false'">testef6</RootNamespace>
    <AssemblyName Condition="'$(UseEntityFramework6)' == 'false'">testlinq</AssemblyName>
    <AssemblyName Condition="'$(UseEntityFramework6)' != 'false'">testef6</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx45>true</NetFx45>
    <ConfigurationYear>2012</ConfigurationYear>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Runtime.Serialization" />
    <Reference Include="System.Transactions" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Data" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' == 'false'">
    <Reference Include="System.Data.Entity" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' != 'false'">
    <Reference Include="EntityFramework"
               Condition="'$(NetFx40)' != 'false'">
      <HintPath>$(SQLiteNetDir)\Externals\EntityFramework\v6.2\lib\net40\EntityFramework.dll</HintPath>
    </Reference>
    <Reference Include="EntityFramework"
               Condition="'$(NetFx45)' != 'false' Or
                          '$(NetFx451)' != 'false' Or
                          '$(NetFx452)' != 'false' Or
                          '$(NetFx46)' != 'false' Or
                          '$(NetFx461)' != 'false' Or
                          '$(NetFx462)' != 'false' Or
                          '$(NetFx47)' != 'false' Or
                          '$(NetFx471)' != 'false' Or
                          '$(NetFx472)' != 'false' Or
                          '$(NetFx48)' != 'false'">
      <HintPath>$(SQLiteNetDir)\Externals\EntityFramework\v6.2\lib\net45\EntityFramework.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
             Include="NorthwindModel.Linq.2008.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>NorthwindModel.Linq.2008.edmx</DependentUpon>
    </Compile>
    <Compile Condition="'$(UseEntityFramework6)' == 'false' And
                        ('$(TargetFrameworkVersion)' == 'v4.0' Or
                         '$(TargetFrameworkVersion)' == 'v4.5')"
             Include="NorthwindModel.Linq.2012.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>NorthwindModel.Linq.2012.edmx</DependentUpon>
    </Compile>
    <Compile Condition="'$(UseEntityFramework6)' != 'false' And
                        ('$(TargetFrameworkVersion)' == 'v4.0' Or
                         '$(TargetFrameworkVersion)' == 'v4.5')"
             Include="NorthwindModel.EF6.2012.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>NorthwindModel.EF6.2012.edmx</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
          Include="2008\LINQ\App.config" />
    <None Condition="'$(UseEntityFramework6)' == 'false' And
                     ('$(TargetFrameworkVersion)' == 'v4.0' Or
                      '$(TargetFrameworkVersion)' == 'v4.5')"
          Include="2012\LINQ\App.config" />
    <None Condition="'$(UseEntityFramework6)' != 'false' And
                     ('$(TargetFrameworkVersion)' == 'v4.0' Or
                      '$(TargetFrameworkVersion)' == 'v4.5')"
          Include="2012\EF6\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <EntityDeploy Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
                  Include="NorthwindModel.Linq.2008.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2008.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' == 'false' And
                             ('$(TargetFrameworkVersion)' == 'v4.0' Or
                              '$(TargetFrameworkVersion)' == 'v4.5')"
                  Include="NorthwindModel.Linq.2012.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2012.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' != 'false' And
                             ('$(TargetFrameworkVersion)' == 'v4.0' Or
                              '$(TargetFrameworkVersion)' == 'v4.5')"
                  Include="NorthwindModel.EF6.2012.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.EF6.2012.Designer.cs</LastGenOutput>
    </EntityDeploy>
  </ItemGroup>
  <ItemGroup>
    <Service Include="{C8F2D6AC-F9F4-4E40-A399-22F9A9A5CBD2}" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CloneAndMark32BitOnlyFrameworkTargetName32;
      CloneAndMark32BitOnlySdkToolsTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added testlinq/test.2013.csproj.



































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * test.2013.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid Condition="'$(UseEntityFramework6)' == 'false'">{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}</ProjectGuid>
    <ProjectGuid Condition="'$(UseEntityFramework6)' != 'false'">{2975AE0A-F159-4834-A837-5242C6691886}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace Condition="'$(UseEntityFramework6)' == 'false'">testlinq</RootNamespace>
    <RootNamespace Condition="'$(UseEntityFramework6)' != 'false'">testef6</RootNamespace>
    <AssemblyName Condition="'$(UseEntityFramework6)' == 'false'">testlinq</AssemblyName>
    <AssemblyName Condition="'$(UseEntityFramework6)' != 'false'">testef6</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx451>true</NetFx451>
    <ConfigurationYear>2013</ConfigurationYear>
    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Runtime.Serialization" />
    <Reference Include="System.Transactions" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Data" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' == 'false'">
    <Reference Include="System.Data.Entity" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' != 'false'">
    <Reference Include="EntityFramework"
               Condition="'$(NetFx40)' != 'false'">
      <HintPath>$(SQLiteNetDir)\Externals\EntityFramework\v6.2\lib\net40\EntityFramework.dll</HintPath>
    </Reference>
    <Reference Include="EntityFramework"
               Condition="'$(NetFx45)' != 'false' Or
                          '$(NetFx451)' != 'false' Or
                          '$(NetFx452)' != 'false' Or
                          '$(NetFx46)' != 'false' Or
                          '$(NetFx461)' != 'false' Or
                          '$(NetFx462)' != 'false' Or
                          '$(NetFx47)' != 'false' Or
                          '$(NetFx471)' != 'false' Or
                          '$(NetFx472)' != 'false' Or
                          '$(NetFx48)' != 'false'">
      <HintPath>$(SQLiteNetDir)\Externals\EntityFramework\v6.2\lib\net45\EntityFramework.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
             Include="NorthwindModel.Linq.2008.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>NorthwindModel.Linq.2008.edmx</DependentUpon>
    </Compile>
    <Compile Condition="'$(UseEntityFramework6)' == 'false' And
                        ('$(TargetFrameworkVersion)' == 'v4.0' Or
                         '$(TargetFrameworkVersion)' == 'v4.5' Or
                         '$(TargetFrameworkVersion)' == 'v4.5.1')"
             Include="NorthwindModel.Linq.2013.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>NorthwindModel.Linq.2013.edmx</DependentUpon>
    </Compile>
    <Compile Condition="'$(UseEntityFramework6)' != 'false' And
                        ('$(TargetFrameworkVersion)' == 'v4.0' Or
                         '$(TargetFrameworkVersion)' == 'v4.5' Or
                         '$(TargetFrameworkVersion)' == 'v4.5.1')"
             Include="NorthwindModel.EF6.2013.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>NorthwindModel.EF6.2013.edmx</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
          Include="2008\LINQ\App.config" />
    <None Condition="'$(UseEntityFramework6)' == 'false' And
                     ('$(TargetFrameworkVersion)' == 'v4.0' Or
                      '$(TargetFrameworkVersion)' == 'v4.5' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.1')"
          Include="2013\LINQ\App.config" />
    <None Condition="'$(UseEntityFramework6)' != 'false' And
                     ('$(TargetFrameworkVersion)' == 'v4.0' Or
                      '$(TargetFrameworkVersion)' == 'v4.5' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.1')"
          Include="2013\EF6\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <EntityDeploy Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
                  Include="NorthwindModel.Linq.2008.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2008.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' == 'false' And
                             ('$(TargetFrameworkVersion)' == 'v4.0' Or
                              '$(TargetFrameworkVersion)' == 'v4.5' Or
                              '$(TargetFrameworkVersion)' == 'v4.5.1')"
                  Include="NorthwindModel.Linq.2013.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2013.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' != 'false' And
                             ('$(TargetFrameworkVersion)' == 'v4.0' Or
                              '$(TargetFrameworkVersion)' == 'v4.5' Or
                              '$(TargetFrameworkVersion)' == 'v4.5.1')"
                  Include="NorthwindModel.EF6.2013.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.EF6.2013.Designer.cs</LastGenOutput>
    </EntityDeploy>
  </ItemGroup>
  <ItemGroup>
    <Service Include="{C8F2D6AC-F9F4-4E40-A399-22F9A9A5CBD2}" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CloneAndMark32BitOnlyFrameworkTargetName32;
      CloneAndMark32BitOnlySdkToolsTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added testlinq/test.2015.csproj.



















































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * test.2015.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid Condition="'$(UseEntityFramework6)' == 'false'">{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}</ProjectGuid>
    <ProjectGuid Condition="'$(UseEntityFramework6)' != 'false'">{2975AE0A-F159-4834-A837-5242C6691886}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace Condition="'$(UseEntityFramework6)' == 'false'">testlinq</RootNamespace>
    <RootNamespace Condition="'$(UseEntityFramework6)' != 'false'">testef6</RootNamespace>
    <AssemblyName Condition="'$(UseEntityFramework6)' == 'false'">testlinq</AssemblyName>
    <AssemblyName Condition="'$(UseEntityFramework6)' != 'false'">testef6</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx46>true</NetFx46>
    <ConfigurationYear>2015</ConfigurationYear>
    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Runtime.Serialization" />
    <Reference Include="System.Transactions" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Data" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' == 'false'">
    <Reference Include="System.Data.Entity" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' != 'false'">
    <Reference Include="EntityFramework"
               Condition="'$(NetFx40)' != 'false'">
      <HintPath>$(SQLiteNetDir)\Externals\EntityFramework\v6.2\lib\net40\EntityFramework.dll</HintPath>
    </Reference>
    <Reference Include="EntityFramework"
               Condition="'$(NetFx45)' != 'false' Or
                          '$(NetFx451)' != 'false' Or
                          '$(NetFx452)' != 'false' Or
                          '$(NetFx46)' != 'false' Or
                          '$(NetFx461)' != 'false' Or
                          '$(NetFx462)' != 'false' Or
                          '$(NetFx47)' != 'false' Or
                          '$(NetFx471)' != 'false' Or
                          '$(NetFx472)' != 'false' Or
                          '$(NetFx48)' != 'false'">
      <HintPath>$(SQLiteNetDir)\Externals\EntityFramework\v6.2\lib\net45\EntityFramework.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
             Include="NorthwindModel.Linq.2008.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>NorthwindModel.Linq.2008.edmx</DependentUpon>
    </Compile>
    <Compile Condition="'$(UseEntityFramework6)' == 'false' And
                        ('$(TargetFrameworkVersion)' == 'v4.0' Or
                         '$(TargetFrameworkVersion)' == 'v4.5' Or
                         '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                         '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                         '$(TargetFrameworkVersion)' == 'v4.6' Or
                         '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                         '$(TargetFrameworkVersion)' == 'v4.6.2')"
             Include="NorthwindModel.Linq.2015.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>NorthwindModel.Linq.2015.edmx</DependentUpon>
    </Compile>
    <Compile Condition="'$(UseEntityFramework6)' != 'false' And
                        ('$(TargetFrameworkVersion)' == 'v4.0' Or
                         '$(TargetFrameworkVersion)' == 'v4.5' Or
                         '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                         '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                         '$(TargetFrameworkVersion)' == 'v4.6' Or
                         '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                         '$(TargetFrameworkVersion)' == 'v4.6.2')"
             Include="NorthwindModel.EF6.2015.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>NorthwindModel.EF6.2015.edmx</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
          Include="2008\LINQ\App.config" />
    <None Condition="'$(UseEntityFramework6)' == 'false' And
                     ('$(TargetFrameworkVersion)' == 'v4.0' Or
                      '$(TargetFrameworkVersion)' == 'v4.5' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.6' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.2')"
          Include="2015\LINQ\App.config" />
    <None Condition="'$(UseEntityFramework6)' != 'false' And
                     ('$(TargetFrameworkVersion)' == 'v4.0' Or
                      '$(TargetFrameworkVersion)' == 'v4.5' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.6' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.2')"
          Include="2015\EF6\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <EntityDeploy Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
                  Include="NorthwindModel.Linq.2008.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2008.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' == 'false' And
                             ('$(TargetFrameworkVersion)' == 'v4.0' Or
                              '$(TargetFrameworkVersion)' == 'v4.5' Or
                              '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                              '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                              '$(TargetFrameworkVersion)' == 'v4.6' Or
                              '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                              '$(TargetFrameworkVersion)' == 'v4.6.2')"
                  Include="NorthwindModel.Linq.2015.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2015.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' != 'false' And
                             ('$(TargetFrameworkVersion)' == 'v4.0' Or
                              '$(TargetFrameworkVersion)' == 'v4.5' Or
                              '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                              '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                              '$(TargetFrameworkVersion)' == 'v4.6' Or
                              '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                              '$(TargetFrameworkVersion)' == 'v4.6.2')"
                  Include="NorthwindModel.EF6.2015.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.EF6.2015.Designer.cs</LastGenOutput>
    </EntityDeploy>
  </ItemGroup>
  <ItemGroup>
    <Service Include="{C8F2D6AC-F9F4-4E40-A399-22F9A9A5CBD2}" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CloneAndMark32BitOnlyFrameworkTargetName32;
      CloneAndMark32BitOnlySdkToolsTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added testlinq/test.2017.csproj.











































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * test.2017.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid Condition="'$(UseEntityFramework6)' == 'false'">{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}</ProjectGuid>
    <ProjectGuid Condition="'$(UseEntityFramework6)' != 'false'">{2975AE0A-F159-4834-A837-5242C6691886}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace Condition="'$(UseEntityFramework6)' == 'false'">testlinq</RootNamespace>
    <RootNamespace Condition="'$(UseEntityFramework6)' != 'false'">testef6</RootNamespace>
    <AssemblyName Condition="'$(UseEntityFramework6)' == 'false'">testlinq</AssemblyName>
    <AssemblyName Condition="'$(UseEntityFramework6)' != 'false'">testef6</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx46>true</NetFx46>
    <ConfigurationYear>2017</ConfigurationYear>
    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Runtime.Serialization" />
    <Reference Include="System.Transactions" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Data" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' == 'false'">
    <Reference Include="System.Data.Entity" />
  </ItemGroup>
  <ItemGroup Condition="'$(UseEntityFramework6)' != 'false'">
    <Reference Include="EntityFramework"
               Condition="'$(NetFx40)' != 'false'">
      <HintPath>$(SQLiteNetDir)\Externals\EntityFramework\v6.4\lib\net40\EntityFramework.dll</HintPath>
    </Reference>
    <Reference Include="EntityFramework"
               Condition="'$(NetFx45)' != 'false' Or
                          '$(NetFx451)' != 'false' Or
                          '$(NetFx452)' != 'false' Or
                          '$(NetFx46)' != 'false' Or
                          '$(NetFx461)' != 'false' Or
                          '$(NetFx462)' != 'false' Or
                          '$(NetFx47)' != 'false' Or
                          '$(NetFx471)' != 'false' Or
                          '$(NetFx472)' != 'false' Or
                          '$(NetFx48)' != 'false'">
      <HintPath>$(SQLiteNetDir)\Externals\EntityFramework\v6.4\lib\net45\EntityFramework.dll</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Compile Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
             Include="NorthwindModel.Linq.2008.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>NorthwindModel.Linq.2008.edmx</DependentUpon>
    </Compile>
    <Compile Condition="'$(UseEntityFramework6)' == 'false' And
                        ('$(TargetFrameworkVersion)' == 'v4.0' Or
                         '$(TargetFrameworkVersion)' == 'v4.5' Or
                         '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                         '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                         '$(TargetFrameworkVersion)' == 'v4.6' Or
                         '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                         '$(TargetFrameworkVersion)' == 'v4.6.2' Or
                         '$(TargetFrameworkVersion)' == 'v4.7' Or
                         '$(TargetFrameworkVersion)' == 'v4.7.1')"
             Include="NorthwindModel.Linq.2017.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>NorthwindModel.Linq.2017.edmx</DependentUpon>
    </Compile>
    <Compile Condition="'$(UseEntityFramework6)' != 'false' And
                        ('$(TargetFrameworkVersion)' == 'v4.0' Or
                         '$(TargetFrameworkVersion)' == 'v4.5' Or
                         '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                         '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                         '$(TargetFrameworkVersion)' == 'v4.6' Or
                         '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                         '$(TargetFrameworkVersion)' == 'v4.6.2' Or
                         '$(TargetFrameworkVersion)' == 'v4.7' Or
                         '$(TargetFrameworkVersion)' == 'v4.7.1')"
             Include="NorthwindModel.EF6.2017.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>NorthwindModel.EF6.2017.edmx</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
          Include="2008\LINQ\App.config" />
    <None Condition="'$(UseEntityFramework6)' == 'false' And
                     ('$(TargetFrameworkVersion)' == 'v4.0' Or
                      '$(TargetFrameworkVersion)' == 'v4.5' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.6' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.7' Or
                      '$(TargetFrameworkVersion)' == 'v4.7.1')"
          Include="2017\LINQ\App.config" />
    <None Condition="'$(UseEntityFramework6)' != 'false' And
                     ('$(TargetFrameworkVersion)' == 'v4.0' Or
                      '$(TargetFrameworkVersion)' == 'v4.5' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.6' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                      '$(TargetFrameworkVersion)' == 'v4.6.2' Or
                      '$(TargetFrameworkVersion)' == 'v4.7' Or
                      '$(TargetFrameworkVersion)' == 'v4.7.1')"
          Include="2017\EF6\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <EntityDeploy Condition="'$(TargetFrameworkVersion)' == 'v3.5'"
                  Include="NorthwindModel.Linq.2008.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2008.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' == 'false' And
                             ('$(TargetFrameworkVersion)' == 'v4.0' Or
                              '$(TargetFrameworkVersion)' == 'v4.5' Or
                              '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                              '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                              '$(TargetFrameworkVersion)' == 'v4.6' Or
                              '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                              '$(TargetFrameworkVersion)' == 'v4.6.2' Or
                              '$(TargetFrameworkVersion)' == 'v4.7' Or
                              '$(TargetFrameworkVersion)' == 'v4.7.1')"
                  Include="NorthwindModel.Linq.2017.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2017.Designer.cs</LastGenOutput>
    </EntityDeploy>
    <EntityDeploy Condition="'$(UseEntityFramework6)' != 'false' And
                             ('$(TargetFrameworkVersion)' == 'v4.0' Or
                              '$(TargetFrameworkVersion)' == 'v4.5' Or
                              '$(TargetFrameworkVersion)' == 'v4.5.1' Or
                              '$(TargetFrameworkVersion)' == 'v4.5.2' Or
                              '$(TargetFrameworkVersion)' == 'v4.6' Or
                              '$(TargetFrameworkVersion)' == 'v4.6.1' Or
                              '$(TargetFrameworkVersion)' == 'v4.6.2' Or
                              '$(TargetFrameworkVersion)' == 'v4.7' Or
                              '$(TargetFrameworkVersion)' == 'v4.7.1')"
                  Include="NorthwindModel.EF6.2017.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.EF6.2017.Designer.cs</LastGenOutput>
    </EntityDeploy>
  </ItemGroup>
  <ItemGroup>
    <Service Include="{C8F2D6AC-F9F4-4E40-A399-22F9A9A5CBD2}" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CloneAndMark32BitOnlyFrameworkTargetName32;
      CloneAndMark32BitOnlySdkToolsTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added testlinq/testef6.2010.csproj.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * testef6.2010.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <UseEntityFramework6>true</UseEntityFramework6>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\test.2010.csproj" />
</Project>

Added testlinq/testef6.2012.csproj.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * testef6.2012.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <UseEntityFramework6>true</UseEntityFramework6>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\test.2012.csproj" />
</Project>

Added testlinq/testef6.2013.csproj.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * testef6.2013.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
  <PropertyGroup>
    <UseEntityFramework6>true</UseEntityFramework6>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\test.2013.csproj" />
</Project>

Added testlinq/testef6.2015.csproj.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * testef6.2015.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
  <PropertyGroup>
    <UseEntityFramework6>true</UseEntityFramework6>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\test.2015.csproj" />
</Project>

Added testlinq/testef6.2017.csproj.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * testef6.2017.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <UseEntityFramework6>true</UseEntityFramework6>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\test.2017.csproj" />
</Project>

Added testlinq/testef6.NetStandard21.csproj.

































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * testef6.NetStandard21.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="16.0">
  <!--
  ******************************************************************************
  **                     Import .NET Core SDK Properties                      **
  ******************************************************************************
  -->

  <!--
      WARNING: This project cannot use the recommended pattern of having the
               "Project" element simply include the "Sdk" attribute, due to
               the "BuildDependsOn" property not being honored, see:

               https://github.com/Microsoft/msbuild/issues/1680

               Instead, the .NET Core SDK properties file is imported here
               and the corresponding targets file is imported right before
               resetting the "BuildDependsOn" property to include targets
               necessary for this project.
  -->
  <Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

  <!--
  ******************************************************************************
  **                       Project Specific Properties                        **
  ******************************************************************************
  -->

  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{2975AE0A-F159-4834-A837-5242C6691886}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>testef6</RootNamespace>
    <AssemblyName>testef6</AssemblyName>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <IsDotNetStandard>true</IsDotNetStandard>
    <ConfigurationYear>NetStandard21</ConfigurationYear>
    <UseEntityFramework6>true</UseEntityFramework6>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **             Project / .NET Standard 2.1 Specific Properties              **
  ******************************************************************************
  -->

  <PropertyGroup>
    <TargetFramework>netcoreapp3.0</TargetFramework>
    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
    <Deterministic>False</Deterministic>
    <EnableDefaultItems>false</EnableDefaultItems>
    <UseAppHost>false</UseAppHost>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                    .NET Standard 2.1 Specific Targets                    **
  ******************************************************************************
  -->

  <Target Name="CopyToNetStandard21"
          Condition="'$(CopyToNetStandard21)' != 'false' And
                     '$(OutputPath)' != '' And
                     HasTrailingSlash('$(OutputPath)') And
                     Exists('$(OutputPath)')"
          Inputs="$(TargetPath)"
          Outputs="$(TargetPath).CopyToNetStandard21.done">
    <CreateItem Include="$(OutputPath)**">
      <Output ItemName="CopyToNetStandard21Item" TaskParameter="Include" />
    </CreateItem>

    <Copy SourceFiles="@(CopyToNetStandard21Item)"
          DestinationFiles="@(CopyToNetStandard21Item -> '$(OutputPath)..\netstandard2.1\%(RecursiveDir)%(Filename)%(Extension)')" />

    <Touch AlwaysCreate="true"
           Files="$(TargetPath).CopyToNetStandard21.done" />
  </Target>

  <!--
  ******************************************************************************
  **    .NET Standard 2.1 Specific Strong Name Signing Property Overrides     **
  ******************************************************************************
  -->

  <PropertyGroup>
    <!--
        NOTE: Apparently, the .NET Core build system sets the SignAssembly
              property to false; therefore, reset it to true.  Also, delay
              signing is currently non-functional due to the inability to
              run the strong name signing tool (sn.exe).  It behaves badly
              when run against a .NET Core assembly.
    -->
    <SignAssembly>true</SignAssembly>
    <DelaySign>false</DelaySign>

    <!--
        TODO: Why is this needed?  It seems that public signing is quite
              similar to delay signing.  Why is this necessary when not
              running on Windows?
    -->
    <PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                     Import Project Default Settings                      **
  ******************************************************************************
  -->

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />

  <!--
  ******************************************************************************
  **                       Import Project Build Targets                       **
  ******************************************************************************
  -->

  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />

  <!--
  ******************************************************************************
  **               Convert Project Settings To MSBuild Settings               **
  ******************************************************************************
  -->

  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                Project Configuration Specific Properties                 **
  ******************************************************************************
  -->

  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>

  <!--
  ******************************************************************************
  -->

  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>

  <!--
  ******************************************************************************
  **                Project Source Code Files (Unconditional)                 **
  ******************************************************************************
  -->

  <ItemGroup>
    <Compile Include="NorthwindModel.EF6.NetStandard21.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>NorthwindModel.EF6.NetStandard21.edmx</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>

  <!--
  ******************************************************************************
  **                     Project Miscellaneous Data Files                     **
  ******************************************************************************
  -->

  <ItemGroup>
    <None Include="NetStandard21\EF6\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>

  <!--
  ******************************************************************************
  **                          Entity Framework Files                          **
  ******************************************************************************
  -->

  <ItemGroup>
    <EntityDeploy Include="NorthwindModel.EF6.NetStandard21.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.EF6.NetStandard21.Designer.cs</LastGenOutput>
    </EntityDeploy>
  </ItemGroup>

  <!--
  ******************************************************************************
  **                        Library Project References                        **
  ******************************************************************************
  -->

  <ItemGroup>
    <ProjectReference Include="..\System.Data.SQLite.Linq\System.Data.SQLite.EF6.NetStandard21.csproj">
      <Project>{5C2DC333-3ADB-4AA7-BE56-0C675C8EE32E}</Project>
      <Name>System.Data.SQLite.EF6.NetStandard21</Name>
      <Private>False</Private>
    </ProjectReference>
  </ItemGroup>

  <!--
  ******************************************************************************
  **                      .NET Core Assembly References                       **
  ******************************************************************************
  -->

  <ItemGroup>
    <PackageReference Include="EntityFramework" Version="6.4.4" />
  </ItemGroup>

  <!--
  ******************************************************************************
  **                       Import .NET Core SDK Targets                       **
  ******************************************************************************
  -->

  <!--
      WARNING: This project cannot use the recommended pattern of having the
               "Project" element simply include the "Sdk" attribute, see the
               comment at the top of this file for more information.
  -->
  <Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />

  <!--
  ******************************************************************************
  **                           Import Build Targets                           **
  ******************************************************************************
  -->

  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />

  <!--
  ******************************************************************************
  **                  Add Targets To BuildDependsOn Property                  **
  ******************************************************************************
  -->

  <PropertyGroup>
    <BuildDependsOn>
      DetectBuildTool;
      DetectOperatingSystem;
      $(BuildDependsOn);
      CopyToNetStandard21;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added testlinq/testlinq.2008.csproj.

























































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * testlinq.2008.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace>testlinq</RootNamespace>
    <AssemblyName>testlinq</AssemblyName>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    <OldToolsVersion>2.0</OldToolsVersion>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..</SQLiteNetDir>
    <NetFx35>true</NetFx35>
    <ConfigurationYear>2008</ConfigurationYear>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Data.Entity" />
    <Reference Include="System.Runtime.Serialization" />
    <Reference Include="System.Transactions" />
    <Reference Include="System.Xml" />
    <Reference Include="System.Data" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="NorthwindModel.Linq.2008.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>NorthwindModel.Linq.2008.edmx</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="2008\LINQ\App.config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <EntityDeploy Include="NorthwindModel.Linq.2008.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Linq.2008.Designer.cs</LastGenOutput>
    </EntityDeploy>
  </ItemGroup>
  <ItemGroup>
    <Service Include="{C8F2D6AC-F9F4-4E40-A399-22F9A9A5CBD2}" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      CloneAndMark32BitOnlyFrameworkTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added testlinq/testlinq.2010.csproj.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * testlinq.2010.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <UseEntityFramework6>false</UseEntityFramework6>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\test.2010.csproj" />
</Project>

Added testlinq/testlinq.2012.csproj.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * testlinq.2012.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <UseEntityFramework6>false</UseEntityFramework6>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\test.2012.csproj" />
</Project>

Added testlinq/testlinq.2013.csproj.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * testlinq.2013.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
  <PropertyGroup>
    <UseEntityFramework6>false</UseEntityFramework6>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\test.2013.csproj" />
</Project>

Added testlinq/testlinq.2015.csproj.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * testlinq.2015.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
  <PropertyGroup>
    <UseEntityFramework6>false</UseEntityFramework6>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\test.2015.csproj" />
</Project>

Added testlinq/testlinq.2017.csproj.































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * testlinq.2017.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <UseEntityFramework6>false</UseEntityFramework6>
  </PropertyGroup>
  <Import Project="$(MSBuildProjectDirectory)\test.2017.csproj" />
</Project>

Deleted testlinq/testlinq.csproj.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{9D3CF7A6-092A-4B05-B0E4-BEF6944525B3}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>testlinq</RootNamespace>
    <AssemblyName>testlinq</AssemblyName>
    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <PlatformTarget>x86</PlatformTarget>
    <UseVSHostingProcess>false</UseVSHostingProcess>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <UseVSHostingProcess>false</UseVSHostingProcess>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core">
      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    </Reference>
    <Reference Include="System.Data.Entity">
      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    </Reference>
    <Reference Include="System.Runtime.Serialization">
      <RequiredTargetFramework>3.0</RequiredTargetFramework>
    </Reference>
    <Reference Include="System.Security" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml.Linq">
      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    </Reference>
    <Reference Include="System.Data.DataSetExtensions">
      <RequiredTargetFramework>3.5</RequiredTargetFramework>
    </Reference>
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="NorthwindModel.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>NorthwindModel.edmx</DependentUpon>
    </Compile>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.Config" />
    <None Include="northwindEF.db">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
    <EntityDeploy Include="NorthwindModel.edmx">
      <Generator>EntityModelCodeGenerator</Generator>
      <LastGenOutput>NorthwindModel.Designer.cs</LastGenOutput>
    </EntityDeploy>
  </ItemGroup>
  <ItemGroup>
    <Service Include="{C8F2D6AC-F9F4-4E40-A399-22F9A9A5CBD2}" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































Deleted testlinq/testlinq.csproj.user.

1
2
3
4
5
6
7
8
9
10
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <StartWorkingDirectory>
    </StartWorkingDirectory>
    <EnableUnmanagedDebugging>true</EnableUnmanagedDebugging>
  </PropertyGroup>
</Project>
<
<
<
<
<
<
<
<
<
<




















Deleted tools/install/GACWrap.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
//-------------------------------------------------------------
// GACWrap.cs
//
// This implements managed wrappers to GAC API Interfaces
//-------------------------------------------------------------

using System;
using System.Runtime.InteropServices;
using System.Text;

namespace System.GACManagedAccess
{
  //-------------------------------------------------------------
  // Interfaces defined by fusion
  //-------------------------------------------------------------
  [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("e707dcde-d1cd-11d2-bab9-00c04f8eceae")]
  internal interface IAssemblyCache
  {
    [PreserveSig()]
    int UninstallAssembly(
                        int flags,
                        [MarshalAs(UnmanagedType.LPWStr)]
                            String assemblyName,
                        InstallReference refData,
                        out AssemblyCacheUninstallDisposition disposition);

    [PreserveSig()]
    int QueryAssemblyInfo(
                        int flags,
                        [MarshalAs(UnmanagedType.LPWStr)]
                            String assemblyName,
                        ref AssemblyInfo assemblyInfo);
    [PreserveSig()]
    int Reserved(
                        int flags,
                        IntPtr pvReserved,
                        out Object ppAsmItem,
                        [MarshalAs(UnmanagedType.LPWStr)]
                            String assemblyName);
    [PreserveSig()]
    int Reserved(out Object ppAsmScavenger);

    [PreserveSig()]
    int InstallAssembly(
                        int flags,
                        [MarshalAs(UnmanagedType.LPWStr)]
                            String assemblyFilePath,
                        InstallReference refData);
  }// IAssemblyCache

  [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("CD193BC0-B4BC-11d2-9833-00C04FC31D2E")]
  internal interface IAssemblyName
  {
    [PreserveSig()]
    int SetProperty(
            int PropertyId,
            IntPtr pvProperty,
            int cbProperty);

    [PreserveSig()]
    int GetProperty(
            int PropertyId,
            IntPtr pvProperty,
            ref int pcbProperty);

    [PreserveSig()]
    int Finalize();

    [PreserveSig()]
    int GetDisplayName(
            StringBuilder pDisplayName,
            ref int pccDisplayName,
            int displayFlags);

    [PreserveSig()]
    int Reserved(ref Guid guid,
        Object obj1,
        Object obj2,
        String string1,
        Int64 llFlags,
        IntPtr pvReserved,
        int cbReserved,
        out IntPtr ppv);

    [PreserveSig()]
    int GetName(
            ref int pccBuffer,
            StringBuilder pwzName);

    [PreserveSig()]
    int GetVersion(
            out int versionHi,
            out int versionLow);
    [PreserveSig()]
    int IsEqual(
            IAssemblyName pAsmName,
            int cmpFlags);

    [PreserveSig()]
    int Clone(out IAssemblyName pAsmName);
  }// IAssemblyName

  [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("21b8916c-f28e-11d2-a473-00c04f8ef448")]
  internal interface IAssemblyEnum
  {
    [PreserveSig()]
    int GetNextAssembly(
            IntPtr pvReserved,
            out IAssemblyName ppName,
            int flags);
    [PreserveSig()]
    int Reset();
    [PreserveSig()]
    int Clone(out IAssemblyEnum ppEnum);
  }// IAssemblyEnum

  [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("582dac66-e678-449f-aba6-6faaec8a9394")]
  internal interface IInstallReferenceItem
  {
    // A pointer to a FUSION_INSTALL_REFERENCE structure. 
    // The memory is allocated by the GetReference method and is freed when 
    // IInstallReferenceItem is released. Callers must not hold a reference to this 
    // buffer after the IInstallReferenceItem object is released. 
    // This uses the InstallReferenceOutput object to avoid allocation 
    // issues with the interop layer. 
    // This cannot be marshaled directly - must use IntPtr 
    [PreserveSig()]
    int GetReference(
            out IntPtr pRefData,
            int flags,
            IntPtr pvReserced);
  }// IInstallReferenceItem

  [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid("56b1a988-7c0c-4aa2-8639-c3eb5a90226f")]
  internal interface IInstallReferenceEnum
  {
    [PreserveSig()]
    int GetNextInstallReferenceItem(
            out IInstallReferenceItem ppRefItem,
            int flags,
            IntPtr pvReserced);
  }// IInstallReferenceEnum

  public enum AssemblyCommitFlags
  {
    Default = 1,
    Force = 2
  }// enum AssemblyCommitFlags

  public enum AssemblyCacheUninstallDisposition
  {
    Unknown = 0,
    Uninstalled = 1,
    StillInUse = 2,
    AlreadyUninstalled = 3,
    DeletePending = 4,
    HasInstallReference = 5,
    ReferenceNotFound = 6
  }

  [Flags]
  internal enum AssemblyCacheFlags
  {
    GAC = 2,
  }

  internal enum CreateAssemblyNameObjectFlags
  {
    CANOF_DEFAULT = 0,
    CANOF_PARSE_DISPLAY_NAME = 1,
  }

  [Flags]
  internal enum AssemblyNameDisplayFlags
  {
    VERSION = 0x01,
    CULTURE = 0x02,
    PUBLIC_KEY_TOKEN = 0x04,
    PROCESSORARCHITECTURE = 0x20,
    RETARGETABLE = 0x80,
    // This enum will change in the future to include
    // more attributes.
    ALL = VERSION
                                | CULTURE
                                | PUBLIC_KEY_TOKEN
                                | PROCESSORARCHITECTURE
                                | RETARGETABLE
  }

  [StructLayout(LayoutKind.Sequential)]
  public class InstallReference
  {
    public InstallReference(Guid guid, String id, String data)
    {
      cbSize = (int)(2 * IntPtr.Size + 16 + (id.Length + data.Length) * 2);
      flags = 0;
      // quiet compiler warning 
      if (flags == 0) { }
      guidScheme = guid;
      identifier = id;
      description = data;
    }

    public Guid GuidScheme
    {
      get { return guidScheme; }
    }

    public String Identifier
    {
      get { return identifier; }
    }

    public String Description
    {
      get { return description; }
    }

    int cbSize;
    int flags;
    Guid guidScheme;
    [MarshalAs(UnmanagedType.LPWStr)]
    String identifier;
    [MarshalAs(UnmanagedType.LPWStr)]
    String description;
  }

  [StructLayout(LayoutKind.Sequential)]
  internal struct AssemblyInfo
  {
    public int cbAssemblyInfo; // size of this structure for future expansion
    public int assemblyFlags;
    public long assemblySizeInKB;
    [MarshalAs(UnmanagedType.LPWStr)]
    public String currentAssemblyPath;
    public int cchBuf; // size of path buf.
  }

  [ComVisible(false)]
  public class InstallReferenceGuid
  {
    public static bool IsValidGuidScheme(Guid guid)
    {
      return (guid.Equals(UninstallSubkeyGuid) ||
              guid.Equals(FilePathGuid) ||
              guid.Equals(OpaqueGuid) ||
              guid.Equals(Guid.Empty));
    }

    public readonly static Guid UninstallSubkeyGuid = new Guid("8cedc215-ac4b-488b-93c0-a50a49cb2fb8");
    public readonly static Guid FilePathGuid = new Guid("b02f9d65-fb77-4f7a-afa5-b391309f11c9");
    public readonly static Guid OpaqueGuid = new Guid("2ec93463-b0c3-45e1-8364-327e96aea856");
    // these GUID cannot be used for installing into GAC.
    public readonly static Guid MsiGuid = new Guid("25df0fc1-7f97-4070-add7-4b13bbfd7cb8");
    public readonly static Guid OsInstallGuid = new Guid("d16d444c-56d8-11d5-882d-0080c847b195");
  }

  [ComVisible(false)]
  public static class AssemblyCache
  {
    public static void InstallAssembly(String assemblyPath, InstallReference reference, AssemblyCommitFlags flags)
    {
      if (reference != null)
      {
        if (!InstallReferenceGuid.IsValidGuidScheme(reference.GuidScheme))
          throw new ArgumentException("Invalid reference guid.", "guid");
      }

      IAssemblyCache ac = null;

      int hr = 0;

      hr = Utils.CreateAssemblyCache(out ac, 0);
      if (hr >= 0)
      {
        hr = ac.InstallAssembly((int)flags, assemblyPath, reference);
      }

      if (hr < 0)
      {
        Marshal.ThrowExceptionForHR(hr);
      }
    }

    // assemblyName has to be fully specified name. 
    // A.k.a, for v1.0/v1.1 assemblies, it should be "name, Version=xx, Culture=xx, PublicKeyToken=xx".
    // For v2.0 assemblies, it should be "name, Version=xx, Culture=xx, PublicKeyToken=xx, ProcessorArchitecture=xx".
    // If assemblyName is not fully specified, a random matching assembly will be uninstalled. 
    public static void UninstallAssembly(String assemblyName, InstallReference reference, out AssemblyCacheUninstallDisposition disp)
    {
      AssemblyCacheUninstallDisposition dispResult = AssemblyCacheUninstallDisposition.Uninstalled;
      if (reference != null)
      {
        if (!InstallReferenceGuid.IsValidGuidScheme(reference.GuidScheme))
          throw new ArgumentException("Invalid reference guid.", "guid");
      }

      IAssemblyCache ac = null;

      int hr = Utils.CreateAssemblyCache(out ac, 0);
      if (hr >= 0)
      {
        hr = ac.UninstallAssembly(0, assemblyName, reference, out dispResult);
      }

      if (hr < 0)
      {
        Marshal.ThrowExceptionForHR(hr);
      }

      disp = dispResult;
    }

    // See comments in UninstallAssembly
    public static String QueryAssemblyInfo(String assemblyName)
    {
      if (assemblyName == null)
      {
        throw new ArgumentException("Invalid name", "assemblyName");
      }

      AssemblyInfo aInfo = new AssemblyInfo();

      aInfo.cchBuf = 1024;
      // Get a string with the desired length
      aInfo.currentAssemblyPath = new String('\0', aInfo.cchBuf);

      IAssemblyCache ac = null;
      int hr = Utils.CreateAssemblyCache(out ac, 0);
      if (hr >= 0)
      {
        hr = ac.QueryAssemblyInfo(0, assemblyName, ref aInfo);
      }
      if (hr < 0)
      {
        Marshal.ThrowExceptionForHR(hr);
      }

      return aInfo.currentAssemblyPath;
    }
  }

  [ComVisible(false)]
  public class AssemblyCacheEnum
  {
    // null means enumerate all the assemblies
    public AssemblyCacheEnum(String assemblyName)
    {
      IAssemblyName fusionName = null;
      int hr = 0;

      if (assemblyName != null)
      {
        hr = Utils.CreateAssemblyNameObject(
                out fusionName,
                assemblyName,
                CreateAssemblyNameObjectFlags.CANOF_PARSE_DISPLAY_NAME,
                IntPtr.Zero);
      }

      if (hr >= 0)
      {
        hr = Utils.CreateAssemblyEnum(
                out m_AssemblyEnum,
                IntPtr.Zero,
                fusionName,
                AssemblyCacheFlags.GAC,
                IntPtr.Zero);
      }

      if (hr < 0)
      {
        Marshal.ThrowExceptionForHR(hr);
      }
    }

    public String GetNextAssembly()
    {
      int hr = 0;
      IAssemblyName fusionName = null;

      if (done)
      {
        return null;
      }

      // Now get next IAssemblyName from m_AssemblyEnum
      hr = m_AssemblyEnum.GetNextAssembly((IntPtr)0, out fusionName, 0);

      if (hr < 0)
      {
        Marshal.ThrowExceptionForHR(hr);
      }

      if (fusionName != null)
      {
        return GetFullName(fusionName);
      }
      else
      {
        done = true;
        return null;
      }
    }

    private String GetFullName(IAssemblyName fusionAsmName)
    {
      StringBuilder sDisplayName = new StringBuilder(1024);
      int iLen = 1024;

      int hr = fusionAsmName.GetDisplayName(sDisplayName, ref iLen, (int)AssemblyNameDisplayFlags.ALL);
      if (hr < 0)
      {
        Marshal.ThrowExceptionForHR(hr);
      }

      return sDisplayName.ToString();
    }

    private IAssemblyEnum m_AssemblyEnum = null;
    private bool done;
  }// class AssemblyCacheEnum

  public class AssemblyCacheInstallReferenceEnum
  {
    public AssemblyCacheInstallReferenceEnum(String assemblyName)
    {
      IAssemblyName fusionName = null;

      int hr = Utils.CreateAssemblyNameObject(
                  out fusionName,
                  assemblyName,
                  CreateAssemblyNameObjectFlags.CANOF_PARSE_DISPLAY_NAME,
                  IntPtr.Zero);

      if (hr >= 0)
      {
        hr = Utils.CreateInstallReferenceEnum(out refEnum, fusionName, 0, IntPtr.Zero);
      }

      if (hr < 0)
      {
        Marshal.ThrowExceptionForHR(hr);
      }
    }

    public InstallReference GetNextReference()
    {
      IInstallReferenceItem item = null;
      int hr = refEnum.GetNextInstallReferenceItem(out item, 0, IntPtr.Zero);
      if ((uint)hr == 0x80070103)
      {   // ERROR_NO_MORE_ITEMS
        return null;
      }

      if (hr < 0)
      {
        Marshal.ThrowExceptionForHR(hr);
      }

      IntPtr refData;
      InstallReference instRef = new InstallReference(Guid.Empty, String.Empty, String.Empty);

      hr = item.GetReference(out refData, 0, IntPtr.Zero);
      if (hr < 0)
      {
        Marshal.ThrowExceptionForHR(hr);
      }

      Marshal.PtrToStructure(refData, instRef);
      return instRef;
    }

    private IInstallReferenceEnum refEnum;
  }

  internal class Utils
  {
    [DllImport("fusion.dll")]
    internal static extern int CreateAssemblyEnum(
            out IAssemblyEnum ppEnum,
            IntPtr pUnkReserved,
            IAssemblyName pName,
            AssemblyCacheFlags flags,
            IntPtr pvReserved);

    [DllImport("fusion.dll")]
    internal static extern int CreateAssemblyNameObject(
            out IAssemblyName ppAssemblyNameObj,
            [MarshalAs(UnmanagedType.LPWStr)]
                String szAssemblyName,
            CreateAssemblyNameObjectFlags flags,
            IntPtr pvReserved);

    [DllImport("fusion.dll")]
    internal static extern int CreateAssemblyCache(
            out IAssemblyCache ppAsmCache,
            int reserved);

    [DllImport("fusion.dll")]
    internal static extern int CreateInstallReferenceEnum(
            out IInstallReferenceEnum ppRefEnum,
            IAssemblyName pName,
            int dwFlags,
            IntPtr pvReserved);
  }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted tools/install/InstallDesigner.Designer.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
namespace install
{
  partial class InstallDesigner
  {
    /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.IContainer components = null;

    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    protected override void Dispose(bool disposing)
    {
      if (disposing && (components != null))
      {
        components.Dispose();
      }
      base.Dispose(disposing);
    }

    #region Windows Form Designer generated code

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
      System.Windows.Forms.ColumnHeader columnHeader1;
      System.Windows.Forms.Label label1;
      System.Windows.Forms.Label label3;
      System.Windows.Forms.Label label2;
      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InstallDesigner));
      this.installList = new System.Windows.Forms.ListView();
      this.warningPanel = new System.Windows.Forms.Panel();
      this.closeButton = new System.Windows.Forms.Button();
      columnHeader1 = new System.Windows.Forms.ColumnHeader();
      label1 = new System.Windows.Forms.Label();
      label3 = new System.Windows.Forms.Label();
      label2 = new System.Windows.Forms.Label();
      this.warningPanel.SuspendLayout();
      this.SuspendLayout();
      // 
      // columnHeader1
      // 
      columnHeader1.Text = "Environment";
      columnHeader1.Width = 800;
      // 
      // label1
      // 
      label1.AutoSize = true;
      label1.Location = new System.Drawing.Point(13, 13);
      label1.Name = "label1";
      label1.Size = new System.Drawing.Size(325, 13);
      label1.TabIndex = 0;
      label1.Text = "Install SQLite Design-Time Support for the following environments:";
      // 
      // label3
      // 
      label3.AutoSize = true;
      label3.Location = new System.Drawing.Point(0, 0);
      label3.Name = "label3";
      label3.Size = new System.Drawing.Size(13, 13);
      label3.TabIndex = 5;
      label3.Text = "*";
      // 
      // label2
      // 
      label2.Location = new System.Drawing.Point(10, 0);
      label2.Name = "label2";
      label2.Size = new System.Drawing.Size(340, 61);
      label2.TabIndex = 4;
      label2.Text = resources.GetString("label2.Text");
      // 
      // installList
      // 
      this.installList.CheckBoxes = true;
      this.installList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
            columnHeader1});
      this.installList.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
      this.installList.Location = new System.Drawing.Point(13, 30);
      this.installList.Name = "installList";
      this.installList.Size = new System.Drawing.Size(350, 149);
      this.installList.TabIndex = 1;
      this.installList.UseCompatibleStateImageBehavior = false;
      this.installList.View = System.Windows.Forms.View.List;
      this.installList.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.installList_ItemChecked);
      // 
      // warningPanel
      // 
      this.warningPanel.Controls.Add(label3);
      this.warningPanel.Controls.Add(label2);
      this.warningPanel.Location = new System.Drawing.Point(13, 186);
      this.warningPanel.Name = "warningPanel";
      this.warningPanel.Size = new System.Drawing.Size(350, 73);
      this.warningPanel.TabIndex = 2;
      this.warningPanel.Visible = false;
      // 
      // closeButton
      // 
      this.closeButton.DialogResult = System.Windows.Forms.DialogResult.OK;
      this.closeButton.Location = new System.Drawing.Point(288, 270);
      this.closeButton.Name = "closeButton";
      this.closeButton.Size = new System.Drawing.Size(75, 23);
      this.closeButton.TabIndex = 3;
      this.closeButton.Text = "&Close";
      this.closeButton.UseVisualStyleBackColor = true;
      this.closeButton.Click += new System.EventHandler(this.closeButton_Click);
      // 
      // InstallDesigner
      // 
      this.AcceptButton = this.closeButton;
      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
      this.CancelButton = this.closeButton;
      this.ClientSize = new System.Drawing.Size(375, 305);
      this.Controls.Add(this.closeButton);
      this.Controls.Add(this.warningPanel);
      this.Controls.Add(this.installList);
      this.Controls.Add(label1);
      this.Font = new System.Drawing.Font("MS Shell Dlg 2", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
      this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
      this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
      this.MaximizeBox = false;
      this.MinimizeBox = false;
      this.Name = "InstallDesigner";
      this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
      this.Text = "SQLite Designer Installation";
      this.TopMost = true;
      this.warningPanel.ResumeLayout(false);
      this.warningPanel.PerformLayout();
      this.ResumeLayout(false);
      this.PerformLayout();

    }

    #endregion

    private System.Windows.Forms.ListView installList;
    private System.Windows.Forms.Panel warningPanel;
    private System.Windows.Forms.Button closeButton;
  }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































































Deleted tools/install/InstallDesigner.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
/********************************************************
 * ADO.NET 2.0 Data Provider for SQLite Version 3.X
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

namespace install
{
  using System;
  using System.ComponentModel;
  using System.Data;
  using System.Drawing;
  using System.Text;
  using System.Windows.Forms;
  using Microsoft.Win32;
  using System.IO;
  using System.GACManagedAccess;
  using System.Xml;
  using System.Diagnostics;
  using System.Collections.Generic;

  public partial class InstallDesigner : Form
  {
    private static Guid standardDataProviderGuid = new Guid("{0EBAAB6E-CA80-4b4a-8DDF-CBE6BF058C70}");
    private static Guid standardDataSourcesGuid = new Guid("{0EBAAB6E-CA80-4b4a-8DDF-CBE6BF058C71}");
    private static Guid standardCFDataSourcesGuid = new Guid("{0EBAAB6E-CA80-4b4a-8DDF-CBE6BF058C72}");
    private static Guid oledbDataProviderGuid = new Guid("{7F041D59-D76A-44ed-9AA2-FBF6B0548B80}");
    private static Guid oledbAltDataProviderGuid = new Guid("{7F041D59-D76A-44ed-9AA2-FBF6B0548B81}");
    private static Guid jetDataSourcesGuid = new Guid("{466CE797-67A4-4495-B75C-A3FD282E7FC3}");
    private static Guid jetAltDataSourcesGuid = new Guid("{466CE797-67A4-4495-B75C-A3FD282E7FC4}");
    private static string[] compactFrameworks = new string[] { "PocketPC", "SmartPhone", "WindowsCE" };

    internal bool _remove = false;
    //private string _regRoot = "8.0";
    private System.Reflection.Assembly _assm = null;
    private bool _ignoreChecks = true;
    private string _assmLocation;

    private Dictionary<string, string> _regRoots = new Dictionary<string,string>();
    private List<string> _frameworks = new List<string>();

    string SQLiteLocation
    {
      get
      {
        System.Reflection.Assembly assm = SQLite;
        return _assmLocation;
      }
    }

    System.Reflection.Assembly SQLite
    {
      get
      {
        if (_assm == null)
        {
          Environment.CurrentDirectory = Path.GetDirectoryName(typeof(InstallDesigner).Assembly.Location);

          try
          {
            _assmLocation = Path.GetFullPath("..\\System.Data.SQLite.DLL");
            _assm = System.Reflection.Assembly.LoadFrom(_assmLocation);
          }
          catch
          {
          }
        }

        OpenFileDialog dlg = new OpenFileDialog();
        while (_assm == null)
        {
          dlg.Multiselect = false;
          dlg.InitialDirectory = Environment.CurrentDirectory;
          dlg.FileName = "System.Data.SQLite.DLL";
          dlg.Filter = "System.Data.SQLite.DLL|System.Data.SQLite.DLL";
          if (dlg.ShowDialog() == DialogResult.OK)
          {
            try
            {
              _assmLocation = dlg.FileName;
              _assm = System.Reflection.Assembly.LoadFrom(dlg.FileName);
            }
            catch
            {
            }
          }
          else
            throw new ArgumentException("Unable to find or load System.Data.SQLite.DLL");
        }
        return _assm;
      }

      set
      {
        _assm = value;
      }
    }

    public InstallDesigner()
    {
      string[] args = Environment.GetCommandLineArgs();
      RegistryKey key;
      string frameworkpath;

      _regRoots.Add("8.0", "2005");
      _regRoots.Add("9.0", "2008");
      _regRoots.Add("10.0", "2010");

      using (key = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\.NETFramework"))
      {
        frameworkpath = key.GetValue("InstallRoot") as string;
      }

      string[] frameworkfolders = Directory.GetDirectories(frameworkpath);
      foreach (string framework in frameworkfolders)
      {
        // Don't do this on frameworks before 2.0
        string version = Path.GetFileNameWithoutExtension(framework);
        if (String.Compare(version, "v2.0", StringComparison.OrdinalIgnoreCase) < 0)
          continue;

        if (File.Exists(Path.Combine(framework, "CONFIG\\machine.config")))
          _frameworks.Add(Path.GetFileName(framework));
      }

      for (int n = 0; n < args.Length; n++)
      {
        if (String.Compare(args[n], "/regroot", true) == 0 ||
          String.Compare(args[n], "-regroot", true) == 0)
        {
          _regRoots.Add(args[n + 1], args[n + 1]);
          break;
        }
        else if (String.Compare(args[n], "/remove", true) == 0 ||
          String.Compare(args[n], "-remove", true) == 0)
        {
          _remove = true;
        }
      }

      InitializeComponent();

      foreach (KeyValuePair<string, string> pair in _regRoots)
      {
        using (key = Registry.LocalMachine.OpenSubKey("Software\\Microsoft"))
        {
          AddItem(key, pair.Key, "VisualStudio", String.Format("Visual Studio {0} (full editions)", pair.Value), standardDataProviderGuid, null);
          AddItem(key, pair.Key, "VWDExpress", String.Format("Visual Web Developer Express {0} Edition", pair.Value), standardDataProviderGuid, null);

          warningPanel.Visible = (AddItem(key, pair.Key, "VCSExpress", String.Format("Visual C# Express {0} Edition *", pair.Value), oledbDataProviderGuid, oledbAltDataProviderGuid)
           | AddItem(key, pair.Key, "VCExpress", String.Format("Visual C++ Express {0} Edition *", pair.Value), oledbDataProviderGuid, oledbAltDataProviderGuid)
           | AddItem(key, pair.Key, "VBExpress", String.Format("Visual Basic Express {0} Edition *", pair.Value), oledbDataProviderGuid, oledbAltDataProviderGuid)
           | AddItem(key, pair.Key, "VJSExpress", String.Format("Visual J# Express {0} Edition *", pair.Value), oledbDataProviderGuid, oledbAltDataProviderGuid));
        }
        GlobalAddRemove(pair.Key);
      }

      _ignoreChecks = false;
    }

    private bool AddItem(RegistryKey parent, string version, string subkeyname, string itemName, Guid lookFor, object isChecked)
    {
      RegistryKey subkey;

      try
      {
        using (subkey = parent.OpenSubKey(String.Format("{0}\\{1}", subkeyname, version)))
        {
          ListViewItem item = new ListViewItem(itemName);

          item.Tag = new string[] { subkeyname, version };

          // Verify this edition has been installed and its not a fluke that the key exists
          string dir = (string)subkey.GetValue("InstallDir");

          using (RegistryKey subsubkey = subkey.OpenSubKey("Packages"))
          {
            if (subsubkey == null)
              throw new ArgumentException("Edition not installed");
            if (subsubkey.SubKeyCount < 5)
              throw new ArgumentException("Edition not installed");
          }
          
          using (RegistryKey subsubkey = subkey.OpenSubKey("DataProviders"))
          {
            if (subsubkey == null)
              throw new ArgumentException("Edition not installed");
          }

          using (RegistryKey subsubkey = subkey.OpenSubKey(String.Format("DataProviders\\{0}", (isChecked == null) ? lookFor.ToString("B") : ((Guid)isChecked).ToString("B"))))
          {
            if (subsubkey == null)
            {
              DoInstallUninstall(item);
            }
            else
            {
              bool itemChecked = (subsubkey.GetValue(null) != null);
              DoInstallUninstall(item);
              if (_remove == false) item.Checked = itemChecked;
            }
          }

          installList.Items.Add(item);
          if (item.Checked)
          {
            DoInstallUninstall(item);
          }
          return true;
        }
      }
      catch
      {
        return false;
      }
    }

    private void closeButton_Click(object sender, EventArgs e)
    {
      this.Close();
    }

    private void installList_ItemChecked(object sender, ItemCheckedEventArgs e)
    {
      if (_ignoreChecks) return;

      string[] arr = (string[])e.Item.Tag;

      DoInstallUninstall(e.Item);

      GlobalAddRemove(arr[1]);
    }

    private void DoInstallUninstall(ListViewItem Item)
    {
      string[] arr = (string[])Item.Tag;
      if (Item.Checked == false)
      {
        if (Item.Text.IndexOf('*') > -1)
          RestoreJet(arr[0], arr[1]);
        else
          Uninstall(arr[0], arr[1], standardDataProviderGuid, standardDataSourcesGuid);
      }
      else
      {
        if (Item.Text.IndexOf('*') > -1)
          ReplaceJet(arr[0], arr[1]);
        else
          Install(arr[0], arr[1], standardDataProviderGuid, standardDataSourcesGuid);
      }
    }

    private void GlobalAddRemove(string version)
    {
      bool install = false;
//      bool installed;

      //// Check to see if SQLite is installed in the GAC
      //try
      //{
      //  string file = AssemblyCache.QueryAssemblyInfo("System.Data.SQLite");
      //  installed = true;
      //}
      //catch
      //{
      //  installed = false;
      //}

      // Check to see if any checkboxes in the list are checked
      for (int n = 0; n < installList.Items.Count; n++)
      {
        if (installList.Items[n].Checked == true)
        {
          install = true;
          break;
        }
      }

      // If at least 1 item is checked, then install some global settings
      if (install)
      {
        string path = Path.GetDirectoryName(SQLiteLocation);

        foreach (string framework in _frameworks)
        {
          using (RegistryKey key = Registry.LocalMachine.CreateSubKey(String.Format("Software\\Microsoft\\.NETFramework\\{0}\\AssemblyFoldersEx\\SQLite", framework), RegistryKeyPermissionCheck.ReadWriteSubTree))
          {
            key.SetValue(null, path);
          }
        }

        while (String.IsNullOrEmpty(path) == false)
        {
          if (File.Exists(path + "\\CompactFramework\\System.Data.SQLite.DLL") == false)
          {
            path = Path.GetDirectoryName(path);
          }
          else break;
        }

        if (String.IsNullOrEmpty(path) == false)
        {
          path += "\\CompactFramework\\";

          for (int n = 0; n < compactFrameworks.Length; n++)
          {
            using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\.NETCompactFramework\\v2.0.0.0\\{0}\\AssemblyFoldersEx", compactFrameworks[n]), true))
            {

              if (key != null)
              {
                using (RegistryKey subkey = key.CreateSubKey("SQLite", RegistryKeyPermissionCheck.ReadWriteSubTree))
                {
                  subkey.SetValue(null, path);
                }
              }
            }
          }

          for (int n = 0; n < compactFrameworks.Length; n++)
          {
            using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\.NETCompactFramework\\v3.5.0.0\\{0}\\AssemblyFoldersEx", compactFrameworks[n]), true))
            {

              if (key != null)
              {
                using (RegistryKey subkey = key.CreateSubKey("SQLite", RegistryKeyPermissionCheck.ReadWriteSubTree))
                {
                  subkey.SetValue(null, path);
                }
              }
            }
          }
        }

        for (int n = 0; n < 2; n++)
        {
          foreach (string framework in _frameworks)
          {
            // Add factory support to the machine.config file.
            try
            {
              string xmlFileName = Environment.ExpandEnvironmentVariables(String.Format("%WinDir%\\Microsoft.NET\\{0}\\{1}\\CONFIG\\machine.config", (n == 0) ? "Framework" : "Framework64", framework));
              XmlDocument xmlDoc = new XmlDocument();
              xmlDoc.PreserveWhitespace = true;
              xmlDoc.Load(xmlFileName);


              XmlNode xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/add[@invariant=\"System.Data.SQLite\"]");
              if (xmlNode == null)
              {
                XmlNode xmlConfig = xmlDoc.SelectSingleNode("configuration");
                if (xmlConfig != null)
                {
                  XmlNode xmlData = xmlConfig.SelectSingleNode("system.data");
                  if (xmlData == null)
                  {
                    xmlData = xmlDoc.CreateNode(XmlNodeType.Element, "system.data", "");
                    xmlConfig.AppendChild(xmlData);
                  }
                  XmlNode xmlParent = xmlData.SelectSingleNode("DbProviderFactories");
                  if (xmlParent == null)
                  {
                    xmlParent = xmlDoc.CreateNode(XmlNodeType.Element, "DbProviderFactories", "");
                    xmlData.AppendChild(xmlParent);
                  }

                  //xmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "remove", "");
                  //xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("invariant"));
                  //xmlParent.AppendChild(xmlNode);
                  //xmlNode.Attributes.GetNamedItem("invariant").Value = "System.Data.SQLite";

                  xmlNode = xmlDoc.CreateNode(XmlNodeType.Element, "add", "");
                  xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("name"));
                  xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("invariant"));
                  xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("description"));
                  xmlNode.Attributes.SetNamedItem(xmlDoc.CreateAttribute("type"));
                  xmlParent.AppendChild(xmlNode);
                }
              }
              xmlNode.Attributes.GetNamedItem("name").Value = "SQLite Data Provider";
              xmlNode.Attributes.GetNamedItem("invariant").Value = "System.Data.SQLite";
              xmlNode.Attributes.GetNamedItem("description").Value = ".Net Framework Data Provider for SQLite";
              xmlNode.Attributes.GetNamedItem("type").Value = "System.Data.SQLite.SQLiteFactory, " + SQLite.GetName().FullName;

              xmlDoc.Save(xmlFileName);
            }
            catch
            {
            }
          }
        }
      }
      else // No checkboxes are checked, remove some global settings
      {
        try
        {
          foreach (string framework in _frameworks)
          {
            Registry.LocalMachine.DeleteSubKey(String.Format("Software\\Microsoft\\.NETFramework\\{0}\\AssemblyFoldersEx\\SQLite", framework));
          }

          string[] versions = { "v2.0.0.0", "v3.5.0.0" };
          for (int x = 0; x < versions.Length; x++)
          {
            for (int n = 0; n < compactFrameworks.Length; n++)
            {
              using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\.NETCompactFramework\\{1}\\{0}\\DataProviders", compactFrameworks[n], versions[x]), true))
              {
                try
                {
                  if (key != null) key.DeleteSubKey(standardDataProviderGuid.ToString("B"));
                }
                catch
                {
                }
              }
            }
          }

          for (int n = 0; n < compactFrameworks.Length; n++)
          {
            using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\.NETCompactFramework\\v2.0.0.0\\{0}\\AssemblyFoldersEx", compactFrameworks[n]), true))
            {
              try
              {
                if (key != null) key.DeleteSubKey("SQLite");
              }
              catch
              {
              }
            }
          }

          for (int n = 0; n < 2; n++)
          {
            try
            {
              foreach (string framework in _frameworks)
              {
                // Remove any entries in the machine.config if they're still there
                string xmlFileName = Environment.ExpandEnvironmentVariables(String.Format("%WinDir%\\Microsoft.NET\\{0}\\{1}\\CONFIG\\machine.config", (n == 0) ? "Framework" : "Framework64", framework));
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.PreserveWhitespace = true;
                xmlDoc.Load(xmlFileName);

                XmlNode xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/add[@invariant=\"System.Data.SQLite\"]");

                if (xmlNode != null)
                  xmlNode.ParentNode.RemoveChild(xmlNode);

                xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/remove[@invariant=\"System.Data.SQLite\"]");
                if (xmlNode != null)
                  xmlNode.ParentNode.RemoveChild(xmlNode);

                xmlDoc.Save(xmlFileName);
              }
            }
            catch
            {
            }
          }
        }
        catch
        {
        }
      }

      try
      {
        if (!install) // Remove SQLite from the GAC if its there
        {
          AssemblyCacheUninstallDisposition disp;

          string s;
          AssemblyCacheEnum entries = new AssemblyCacheEnum("System.Data.SQLite");
          while (true)
          {
            s = entries.GetNextAssembly();
            if (String.IsNullOrEmpty(s)) break;

            AssemblyCache.UninstallAssembly(s, null, out disp);
          }

          entries = new AssemblyCacheEnum("SQLite.Designer");
          while (true)
          {
            s = entries.GetNextAssembly();
            if (String.IsNullOrEmpty(s)) break;

            AssemblyCache.UninstallAssembly(s, null, out disp);
          }

          entries = new AssemblyCacheEnum("System.Data.SQLite.Linq");
          while (true)
          {
            s = entries.GetNextAssembly();
            if (String.IsNullOrEmpty(s)) break;

            AssemblyCache.UninstallAssembly(s, null, out disp);
          }
          
          SQLite = null;
        }
        else // Install SQLite into the GAC
        {
          byte[] cfdt = Properties.Resources.System_Data_SQLite;
          string tempPath = Path.GetTempPath();
          tempPath = Path.Combine(tempPath, "System.Data.SQLite.DLL");
          using (FileStream fs = File.Open(tempPath, FileMode.Create, FileAccess.Write, FileShare.None))
          {
            fs.Write(cfdt, 0, cfdt.Length);
          }

          try
          {
            AssemblyCache.InstallAssembly(tempPath, null, AssemblyCommitFlags.Default);
            AssemblyCache.InstallAssembly(Path.Combine(Path.GetDirectoryName(SQLiteLocation), "x64\\System.Data.SQLite.DLL"), null, AssemblyCommitFlags.Default);
            AssemblyCache.InstallAssembly(Path.Combine(Path.GetDirectoryName(SQLiteLocation), "itanium\\System.Data.SQLite.DLL"), null, AssemblyCommitFlags.Default);
          }
          catch
          {
          }
          finally
          {
            File.Delete(tempPath);
            if (File.Exists(Path.GetFullPath("..\\System.Data.SQLite.Linq.DLL")) == true)
              AssemblyCache.InstallAssembly(Path.GetFullPath("..\\System.Data.SQLite.Linq.DLL"), null, AssemblyCommitFlags.Default);

            AssemblyCache.InstallAssembly(Path.GetFullPath("SQLite.Designer.DLL"), null, AssemblyCommitFlags.Default);
            AssemblyCache.InstallAssembly(SQLiteLocation, null, AssemblyCommitFlags.Default);
          }
        }
      }
      catch
      {
        throw;
      }

      FixXmlLibPaths(install, version);
    }

    private void ReplaceJet(string keyname, string version)
    {
      using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataProviders", keyname, version), true))
      {
        using (RegistryKey source = key.OpenSubKey(oledbDataProviderGuid.ToString("B")))
        {
          using (RegistryKey dest = key.CreateSubKey(oledbAltDataProviderGuid.ToString("B")))
          {
            if (source == null) return;
            CopyKey(source, dest);
          }
        }
        key.DeleteSubKeyTree(oledbDataProviderGuid.ToString("B"));
      }

      using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataSources", keyname, version), true))
      {
        using (RegistryKey source = key.OpenSubKey(jetDataSourcesGuid.ToString("B")))
        {
          using (RegistryKey dest = key.CreateSubKey(jetAltDataSourcesGuid.ToString("B")))
          {
            if (source == null) return;
            CopyKey(source, dest);
          }
        }
        key.DeleteSubKeyTree(jetDataSourcesGuid.ToString("B"));
      }

      Install(keyname, version, oledbDataProviderGuid, jetDataSourcesGuid);
    }

    private void RestoreJet(string keyname, string version)
    {
      using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataProviders", keyname, version), true))
      {
        using (RegistryKey source = key.OpenSubKey(oledbAltDataProviderGuid.ToString("B")))
        {
          if (source == null) return;
        }
      }

      Uninstall(keyname, version, oledbDataProviderGuid, jetDataSourcesGuid);

      using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataProviders", keyname, version), true))
      {
        using (RegistryKey source = key.OpenSubKey(oledbAltDataProviderGuid.ToString("B")))
        {
          if (source != null)
          {
            using (RegistryKey dest = key.CreateSubKey(oledbDataProviderGuid.ToString("B")))
            {
              CopyKey(source, dest);
            }
            key.DeleteSubKeyTree(oledbAltDataProviderGuid.ToString("B"));
          }
        }
      }

      using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataSources", keyname, version), true))
      {
        using (RegistryKey source = key.OpenSubKey(jetAltDataSourcesGuid.ToString("B")))
        {
          if (source != null)
          {
            using (RegistryKey dest = key.CreateSubKey(jetDataSourcesGuid.ToString("B")))
            {
              CopyKey(source, dest);
            }
            key.DeleteSubKeyTree(jetAltDataSourcesGuid.ToString("B"));
          }
        }
      }
    }

    private void Install(string keyname, string version, Guid provider, Guid source)
    {
      bool usePackage = (keyname == "VisualStudio");

      using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataProviders", keyname, version), true))
      {
        using (RegistryKey subkey = key.CreateSubKey(provider.ToString("B"), RegistryKeyPermissionCheck.ReadWriteSubTree))
        {
          subkey.SetValue(null, ".NET Framework Data Provider for SQLite");
          subkey.SetValue("InvariantName", "System.Data.SQLite");
          subkey.SetValue("Technology", "{77AB9A9D-78B9-4ba7-91AC-873F5338F1D2}");
          subkey.SetValue("CodeBase", Path.GetFullPath("SQLite.Designer.DLL"));
          

          if (usePackage)
           subkey.SetValue("FactoryService", "{DCBE6C8D-0E57-4099-A183-98FF74C64D9D}");

          using (RegistryKey subsubkey = subkey.CreateSubKey("SupportedObjects", RegistryKeyPermissionCheck.ReadWriteSubTree))
          {
            using (RegistryKey subsubsubkey = subsubkey.CreateSubKey("DataConnectionUIControl", RegistryKeyPermissionCheck.ReadWriteSubTree))
            {
              if (!usePackage)
                subsubsubkey.SetValue(null, "SQLite.Designer.SQLiteConnectionUIControl");
            }
            using (RegistryKey subsubsubkey = subsubkey.CreateSubKey("DataConnectionProperties", RegistryKeyPermissionCheck.ReadWriteSubTree))
            {
              if (!usePackage)
                subsubsubkey.SetValue(null, "SQLite.Designer.SQLiteConnectionProperties");
            }

            subsubkey.CreateSubKey("DataObjectSupport").Close();
            subsubkey.CreateSubKey("DataViewSupport").Close();
            using (RegistryKey subsubsubkey = subsubkey.CreateSubKey("DataConnectionSupport", RegistryKeyPermissionCheck.ReadWriteSubTree))
            {
              if (!usePackage)
                subsubsubkey.SetValue(null, "SQLite.Designer.SQLiteDataConnectionSupport");
            }
          }
        }
      }

      using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataSources", keyname, version), true))
      {
        using (RegistryKey subkey = key.CreateSubKey(source.ToString("B"), RegistryKeyPermissionCheck.ReadWriteSubTree))
        {
          subkey.SetValue(null, "SQLite Database File");
          using (RegistryKey subsubkey = subkey.CreateSubKey("SupportingProviders", RegistryKeyPermissionCheck.ReadWriteSubTree))
          {
            subsubkey.CreateSubKey(provider.ToString("B")).Close();
          }
        }
      }

      //try
      //{
      //  using (RegistryKey key = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", true))
      //  {
      //    string libpath = (string)key.GetValue("LIB");
      //    string path = Path.GetDirectoryName(SQLiteLocation);

      //    if (libpath.IndexOf(path, StringComparison.InvariantCultureIgnoreCase) == -1)
      //    {
      //      libpath += (";" + path);
      //      key.SetValue("LIB", libpath);
      //    }
      //  }
      //}
      //catch
      //{
      //}

      string[] versions = { "v2.0.0.0", "v3.5.0.0" };

      for (int x = 0; x < versions.Length; x++)
      {
        for (int n = 0; n < compactFrameworks.Length; n++)
        {
          using (RegistryKey key = Registry.LocalMachine.CreateSubKey(String.Format("Software\\Microsoft\\.NETCompactFramework\\{1}\\{0}\\DataProviders", compactFrameworks[n], versions[x])))
          {
            if (key != null)
            {
              using (RegistryKey subkey = key.CreateSubKey(standardDataProviderGuid.ToString("B"), RegistryKeyPermissionCheck.ReadWriteSubTree))
              {
                subkey.SetValue(null, ".NET Framework Data Provider for SQLite");
                subkey.SetValue("InvariantName", "System.Data.SQLite");
                subkey.SetValue("RuntimeAssembly", "System.Data.SQLite.DLL");
              }
            }
          }
        }
      }

      if (usePackage)
      {
        using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\Packages", keyname, version), true))
        {
          using (RegistryKey subkey = key.CreateSubKey("{DCBE6C8D-0E57-4099-A183-98FF74C64D9C}", RegistryKeyPermissionCheck.ReadWriteSubTree))
          {
            subkey.SetValue(null, "SQLite Designer Package");
            subkey.SetValue("Class", "SQLite.Designer.SQLitePackage");
            subkey.SetValue("CodeBase", Path.GetFullPath("SQLite.Designer.DLL"));
            subkey.SetValue("ID", 400);
            subkey.SetValue("InprocServer32", "mscoree.dll");
            subkey.SetValue("CompanyName", "Black Castle Software, LLC");
            subkey.SetValue("MinEdition", "standard");
            subkey.SetValue("ProductName", "SQLite Data Provider");
            subkey.SetValue("ProductVersion", "1.0");
            using (RegistryKey toolboxKey = subkey.CreateSubKey("Toolbox"))
            {
              toolboxKey.SetValue("Default Items", 3);
            }
          }
        }

        using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\Menus", keyname, version), true))
        {
          key.SetValue("{DCBE6C8D-0E57-4099-A183-98FF74C64D9C}", ", 1000, 3");
        }

        using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\Services", keyname, version), true))
        {
          using (RegistryKey subkey = key.CreateSubKey("{DCBE6C8D-0E57-4099-A183-98FF74C64D9D}", RegistryKeyPermissionCheck.ReadWriteSubTree))
          {
            subkey.SetValue(null, "{DCBE6C8D-0E57-4099-A183-98FF74C64D9C}");
            subkey.SetValue("Name", "SQLite Provider Object Factory");
          }
        }
      }
    }

    private XmlDocument GetConfig(string keyname, string version, out string xmlFileName)
    {
      try
      {
        using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}", keyname, version), true))
        {
          xmlFileName = (string)key.GetValue("InstallDir");
          if (String.Compare(keyname, "VisualStudio", true) == 0)
            xmlFileName += "devenv.exe.config";
          else
            xmlFileName += keyname + ".exe.config";
        }

        XmlDocument xmlDoc = new XmlDocument();
        xmlDoc.PreserveWhitespace = true;
        xmlDoc.Load(xmlFileName);

        return xmlDoc;
      }
      catch
      {
        xmlFileName = null;
      }
      return null;
    }

    private void Uninstall(string keyname, string version, Guid provider, Guid source)
    {
      try
      {
        using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataProviders", keyname, version), true))
        {
          if (key != null) key.DeleteSubKeyTree(provider.ToString("B"));
        }
        using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\DataSources", keyname, version), true))
        {
          if (key != null) key.DeleteSubKeyTree(source.ToString("B"));
        }

        using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\Packages", keyname, version), true))
        {
          if (key != null) key.DeleteSubKeyTree("{DCBE6C8D-0E57-4099-A183-98FF74C64D9C}");
        }

        using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\Services", keyname, version), true))
        {
          if (key != null) key.DeleteSubKeyTree("{DCBE6C8D-0E57-4099-A183-98FF74C64D9D}");
        }

        using (RegistryKey key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\{0}\\{1}\\Menus", keyname, version), true))
        {
          key.DeleteValue("{DCBE6C8D-0E57-4099-A183-98FF74C64D9C}");
        }

        //using (RegistryKey key = Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment", true))
        //{
        //  string libpath = (string)key.GetValue("LIB");
        //  string path = ";" + Path.GetDirectoryName(SQLiteLocation);

        //  libpath = libpath.Replace(path, "");
        //  key.SetValue("LIB", libpath);
        //}
      }
      catch
      {
      }

      // Remove factory support from the development environment config file
      string xmlFileName;
      XmlDocument xmlDoc = GetConfig(keyname, version, out xmlFileName);

      if (xmlDoc == null) return;

      XmlNode xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/add[@invariant=\"System.Data.SQLite\"]");
      if (xmlNode != null)
        xmlNode.ParentNode.RemoveChild(xmlNode);

      xmlNode = xmlDoc.SelectSingleNode("configuration/system.data/DbProviderFactories/remove[@invariant=\"System.Data.SQLite\"]");
      if (xmlNode != null)
        xmlNode.ParentNode.RemoveChild(xmlNode);

      xmlDoc.Save(xmlFileName);
    }


    private static void CopyKey(RegistryKey keySource, RegistryKey keyDest)
    {
      if (keySource.SubKeyCount > 0)
      {
        string[] subkeys = keySource.GetSubKeyNames();
        for (int n = 0; n < subkeys.Length; n++)
        {
          using (RegistryKey subkeysource = keySource.OpenSubKey(subkeys[n]))
          {
            using (RegistryKey subkeydest = keyDest.CreateSubKey(subkeys[n], RegistryKeyPermissionCheck.ReadWriteSubTree))
            {
              CopyKey(subkeysource, subkeydest);
            }
          }
        }
      }
      string[] values = keySource.GetValueNames();
      for (int n = 0; n < values.Length; n++)
      {
        keyDest.SetValue(values[n], keySource.GetValue(values[n]), keySource.GetValueKind(values[n]));
      }
    }

    private void FixXmlLibPaths(bool install, string version)
    {
      string installDir = null;
      RegistryKey key = null;

      try
      {
        key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\VisualStudio\\{0}", version));
        if (key != null)
        {
          try
          {
            installDir = (string)key.GetValue("InstallDir");
          }
          catch
          {
          }
          finally
          {
            if (String.IsNullOrEmpty(installDir))
            {
              ((IDisposable)key).Dispose();
              key = null;
            }
          }
        }

        if (key == null)
        {
          key = Registry.LocalMachine.OpenSubKey(String.Format("Software\\Microsoft\\VCExpress\\{0}", version));
          if (key == null) return;
        }

        try
        {
          installDir = (string)key.GetValue("InstallDir");
        }
        catch
        {
        }
      }
      finally
      {
        if (key != null) ((IDisposable)key).Dispose();
      }

      if (String.IsNullOrEmpty(installDir)) return;

      installDir = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(installDir))), "VC");

      string currentDir;
      string[] lookIn = new string[] { "vcpackages", "bin\\amd64", "bin\\ia64" };
      string sqlitePath = Path.GetDirectoryName(SQLiteLocation);

      foreach (string subfolder in lookIn)
      {
        try
        {
          currentDir = Path.Combine(installDir, subfolder);
          FixXmlLibPaths(currentDir, "VCProjectEngine.DLL*.config", sqlitePath, install);
          FixXmlLibPaths(currentDir, "AMD64.VCPlatform.config", Path.Combine(sqlitePath, "x64"), install);
          FixXmlLibPaths(currentDir, "Itanium.VCPlatform.config", Path.Combine(sqlitePath, "itanium"), install);
          FixXmlLibPaths(currentDir, "WCE.VCPlatform.config", Path.Combine(sqlitePath, "CompactFramework"), install);
        }
        catch
        {
        }
      }

      FixLocalUserPaths(install);
    }

    private void FixLocalUserPaths(bool install)
    {
      string file = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft\\VisualStudio\\8.0\\VCComponents.dat");
      StringBuilder output = new StringBuilder();
      string line;
      string sqlitePath = Path.GetDirectoryName(SQLiteLocation);
      string currPath = sqlitePath;

      try
      {
        using (StreamReader rd = new StreamReader(file))
        {
          while (rd.EndOfStream == false)
          {
            line = rd.ReadLine();
            line = line.Trim();
            if (String.IsNullOrEmpty(line)) continue;
            if (line[0] == '[')
            {
              if (line.IndexOf("Win32", StringComparison.InvariantCultureIgnoreCase) != -1)
                currPath = sqlitePath;
              else if (line.IndexOf("x64", StringComparison.InvariantCultureIgnoreCase) != -1)
                currPath = Path.Combine(sqlitePath, "x64");
              else if (line.IndexOf("Itanium", StringComparison.InvariantCultureIgnoreCase) != -1)
                currPath = Path.Combine(sqlitePath, "x64");
              else if (line.IndexOf("ARM", StringComparison.InvariantCultureIgnoreCase) != -1)
                currPath = Path.Combine(sqlitePath, "CompactFramework");
            }
            else if (line.StartsWith("Reference Dirs", StringComparison.InvariantCultureIgnoreCase) == true)
            {
              int n = line.IndexOf(";" + currPath, StringComparison.InvariantCultureIgnoreCase);
              if (n > -1) line = line.Remove(n, currPath.Length + 1);

              if (install)
              {
                if (line[line.Length - 1] == '=')
                  line += currPath;
                else
                  line += (";" + currPath);
              }
            }

            output.AppendLine(line);
          }
          rd.Close();
        }

        File.Delete(file);
        using (StreamWriter writer = new StreamWriter(file, false, Encoding.Unicode))
        {          
          writer.Write(output.ToString());
          writer.Close();
        }
      }
      catch
      {
      }
    }

    private void FixXmlLibPaths(string path, string lookFor, string sqlitePath, bool install)
    {
      // Win32
      string[] files = Directory.GetFiles(path, lookFor);
      if (files.Length > 0)
      {
        foreach (string file in files)
        {
          FixXmlLibPath(file, sqlitePath, install);
        }
      }
    }

    private void FixXmlLibPath(string fileName, string sqlitePath, bool install)
    {
      XmlDocument xmlDoc = new XmlDocument();
      xmlDoc.PreserveWhitespace = true;
      xmlDoc.Load(fileName);
      
      XmlNodeList xmlNodes = xmlDoc.SelectNodes("VCPlatformConfigurationFile/Platform/Directories");
      if (xmlNodes == null) return;

      foreach(XmlNode xmlNode in xmlNodes)
      {
        string libpath = xmlNode.Attributes.GetNamedItem("Reference").Value;
        if (String.Compare(libpath, sqlitePath, true) == 0)
          libpath = "";
        else
        {
          int n = libpath.IndexOf(";" + sqlitePath, StringComparison.InvariantCultureIgnoreCase);
          if (n > -1) libpath = libpath.Remove(n, sqlitePath.Length + 1);
        }

        if (install)
        {
          if (String.IsNullOrEmpty(libpath)) libpath = sqlitePath;
          else libpath += (";" + sqlitePath);
        }
        xmlNode.Attributes.GetNamedItem("Reference").Value = libpath;
      }

      xmlDoc.Save(fileName);
    }
  }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted tools/install/InstallDesigner.resx.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!-- 
    Microsoft ResX Schema 
    
    Version 2.0
    
    The primary goals of this format is to allow a simple XML format 
    that is mostly human readable. The generation and parsing of the 
    various data types are done through the TypeConverter classes 
    associated with the data types.
    
    Example:
    
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
                
    There are any number of "resheader" rows that contain simple 
    name/value pairs.
    
    Each data row contains a name, and value. The row also contains a 
    type or mimetype. Type corresponds to a .NET class that support 
    text/value conversion through the TypeConverter architecture. 
    Classes that don't support this are serialized and stored with the 
    mimetype set.
    
    The mimetype is used for serialized objects, and tells the 
    ResXResourceReader how to depersist the object. This is currently not 
    extensible. For a given mimetype the value must be set accordingly:
    
    Note - application/x-microsoft.net.object.binary.base64 is the format 
    that the ResXResourceWriter will generate, however the reader can 
    read any of the formats listed below.
    
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array 
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <metadata name="columnHeader1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>False</value>
  </metadata>
  <metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>False</value>
  </metadata>
  <metadata name="label3.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>False</value>
  </metadata>
  <metadata name="label2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    <value>False</value>
  </metadata>
  <data name="label2.Text" xml:space="preserve">
    <value>Due to limitations in some Express Editions, checking affected products above will temporarily replace the Microsoft Jet designer with the SQLite designer.  The Microsoft Jet designer can be restored by un-checking the box(es) above.</value>
  </data>
  <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
  <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
    <value>
        AAABAAYAICAQAAAAAADoAgAAZgAAABAQEAAAAAAAKAEAAE4DAAAgIAAAAQAIAKgIAAB2BAAAEBAAAAEA
        CABoBQAAHg0AACAgAAABACAAqBAAAIYSAAAQEAAAAQAgAGgEAAAuIwAAKAAAACAAAABAAAAAAQAEAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACAgACAAAAAgACAAICAAACAgIAAwMDAAAAA
        /wAA/wAAAP//AP8AAAD/AP8A//8AAP///wAREREREREREXd3d3d3ARERERERERERERF4uLeLiwARERER
        ERERERERe4uHuLgDAREREREREREREXi4t4uLAzARERERERAAAA97i4e4uAMwAREREREXd3d/eLi3i4sD
        MDARERERF/iIj3uLh7i4AzAwERERERf4iI94uLeLiwMwMBEREREX+IiPd3d3d3cDMDARAAERF/iIiPe/
        v3+/sDAwEHdwERf4iIiPe/v3+/sAMHeIdwAH+IiIiPeIiHiIgDB/+ICIh/iIiIiPe/v3+/sAf/+HB3f4
        iIiIiPd3d3d3cBf/gBEX+IiIiIiP/////xERd3ERF/iIiIiIiIiIiHARERERERf4iIiIiIiIiIhwERER
        EREX+IiIiIiIiIiIcBERERERF/iIiIiIiIiIiHARERERERf4iIiIiIiIiIhwEREREREX////////////
        cBERERERF3d3d3d3d3d3d3AREREREREREXgBERF4ARERERERERERERF/ARERfwEREREREREREREReAER
        EXgBEREREREREREREQcBEREHARERERERERERERBwcBEQcHARERERERERERF4iHcBeIh3ARERERERERER
        f/iHAX/4hwEREREREREREX//hwF//4cBEREREREREREX/4ARF/+AEREREREREREREYiBERGIgREREf//
        AB///wAP//8AB///AAP/gAAB/4AAAP+AAAD/gAAA/4AAAMeAAACDgAAAAAAAAAAAAAAAAAAAg4AAA8eA
        AAP/gAAD/4AAA/+AAAP/gAAD/4AAA/+AAAP//Hx///x8f//8fH///Hx///g4P//wEB//8BAf//AQH//4
        OD///Hx/KAAAABAAAAAgAAAAAQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAACA
        gACAAAAAgACAAICAAACAgIAAwMDAAAAA/wAA/wAAAP//AP8AAAD/AP8A//8AAP///wAREREXd3dwERER
        ERe4e4ABERERF4t4sDAREQAHuHuAMBERf3eLeLAwERF/h3d3cDCAgX+Ie/e/AA8Af4iHd3dwgIF/iIiI
        dxEREX////9wERERd3d3d3AREREREQEREREREREYCBERERERERDwERERERERGAgREREREREREREREf4D
        ERH+AYiP/gB3d/AAMDDwAAER8ACIiBAAv38AADAwEANwEfADiIjwA/v3/38AMP4/dwD+P4iI/j+IiP//
        gDAoAAAAIAAAAEAAAAABAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAA
        AACAAIAAgIAAAICAgADA3MAA8MqmAKo/KgD/PyoAAF8qAFVfKgCqXyoA/18qAAB/KgBVfyoAqn8qAP9/
        KgAAnyoAVZ8qAKqfKgD/nyoAAL8qAFW/KgCqvyoA/78qAADfKgBV3yoAqt8qAP/fKgAA/yoAVf8qAKr/
        KgD//yoAAABVAFUAVQCqAFUA/wBVAAAfVQBVH1UAqh9VAP8fVQAAP1UAVT9VAKo/VQD/P1UAAF9VAFVf
        VQCqX1UA/19VAAB/VQBVf1UAqn9VAP9/VQAAn1UAVZ9VAKqfVQD/n1UAAL9VAFW/VQCqv1UA/79VAADf
        VQBV31UAqt9VAP/fVQAA/1UAVf9VAKr/VQD//1UAAAB/AFUAfwCqAH8A/wB/AAAffwBVH38Aqh9/AP8f
        fwAAP38AVT9/AKo/fwD/P38AAF9/AFVffwCqX38A/19/AAB/fwBVf38Aqn9/AP9/fwAAn38AVZ9/AKqf
        fwD/n38AAL9/AFW/fwCqv38A/79/AADffwBV338Aqt9/AP/ffwAA/38AVf9/AKr/fwD//38AAACqAFUA
        qgCqAKoA/wCqAAAfqgBVH6oAqh+qAP8fqgAAP6oAVT+qAKo/qgD/P6oAAF+qAFVfqgCqX6oA/1+qAAB/
        qgBVf6oAqn+qAP9/qgAAn6oAVZ+qAKqfqgD/n6oAAL+qAFW/qgCqv6oA/7+qAADfqgBV36oAqt+qAP/f
        qgAA/6oAVf+qAKr/qgD//6oAAADUAFUA1ACqANQA/wDUAAAf1ABVH9QAqh/UAP8f1AAAP9QAVT/UAKo/
        1AD/P9QAAF/UAFVf1ACqX9QA/1/UAAB/1ABVf9QAqn/UAP9/1AAAn9QAVZ/UAKqf1AD/n9QAAL/UAFW/
        1ACqv9QA/7/UAADf1ABV39QAqt/UAP/f1AAA/9QAVf/UAKr/1AD//9QAVQD/AKoA/wAAH/8AVR//AKof
        /wD/H/8AAD//AFU//wCqP/8A/z//AABf/wBVX/8Aql//AP9f/wAAf/8AVX//AKp//wD/f/8AAJ//AFWf
        /wCqn/8A/5//AAC//wBVv/8Aqr//AP+//wAA3/8AVd//AKrf/wD/3/8AVf//AKr//wD/zMwA/8z/AP//
        MwD//2YA//+ZAP//zAAAfwAAVX8AAKp/AAD/fwAAAJ8AAFWfAACqnwAA/58AAAC/AABVvwAAqr8AAP+/
        AAAA3wAAVd8AAKrfAAD/3wAAVf8AAKr/AAAAACoAVQAqAKoAKgD/ACoAAB8qAFUfKgCqHyoA/x8qAAA/
        KgBVPyoA8Pv/AKSgoACAgIAAAAD/AAD/AAAA//8A/wAAAAAAAAD//wAA////AP39/f39/f39/f39/f39
        /f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39
        /f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/YF9fVlVWVVVVf39/f39/f39/f39
        /f39/f39/f39/f39pcuoylSkpMakVP39/f39/f39/f39/f39/f39/f39/f2pqcvLVMrKpMZ8LP39/f39
        /f39/f39/f39/f39/f39/anP0KkDy6jLpHxUeP39/f39/f39/f39/f39/f39/f39qc/Pz1nLy6ikfFR8
        eP39/f39/f39/f39/f39/f39/f2p0K7QWc+py8Z8VHx8/f39/f39/f39/f0yMTIxMjEyManP0M99z8+t
        z3xUfHz9/f39/f39/f39XggJCYIJgoKDqfb29gf29tDTfFR8fP39/f39/f39/YKzrwgICAirCAiqy9DT
        0IHPy8vLVHx8/f39/f39/f39htH2r6+vrwivCNQIy/eFMS0wWXxUfHz9/VoHNjL9/f2Gs/b29q/2r6+v
        CNQIpVXQLNBUqcvKfP2ChtSCWjX9/YL/9q/29q/2rwjRrwgHqVWpVctVqcul/V7/rwiCMjYyhv//9vav
        9q/2r68Ir4JZhquCMVr3Df39gvb2rwhagl6C//////bR9q/2r/avr68ICAjUhoMx/f2G1P//CV79/Qn/
        //////az9vavr9EIr6+vCKsJhg39/f0Igl6G/f39gv////////b2r/b2r/avCNGvCAiCMv39/f39/f39
        /f2G////////////9q/2r/avrwivCIMx/f39/f39/f39/f2G//////////////b2r/avr68IB/39/f39
        /f39/f39/f2GgoaCgl73Xl5eWl5aWgc2Bzb9/f39/f39/f39/f39/f39/f1eMf39/f39/V4x/f39/f39
        /f39/f39/f39/f39/f39/YIy/f39/f39gjL9/f39/f39/f39/f39/f39/f39/f1aNgcy/f39/Vo2BzL9
        /f39/f39/f39/f39/f39/f39gobUgjYH/f2ChtSCNgf9/f39/f39/f39/f39/f39/f1e/68IgjL9/V7/
        rwiCMv39/f39/f39/f39/f39/f39/ffR/68IB/3999H/rwgH/f39/f39/f39/f39/f39/f39CAj//wle
        /f0ICP//CV79/f39/f39/f39/f39/f39/f39CYL3hv39/f0JgveG/f39/f39/f39/f39/f39/f39/f39
        /f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f3/////////////
        /////8Af///AD///wAf//8AD///AAf//wAH/wAAB/4AAAf8AAAH/AAABhwAAAQMAAAEAAAADAAAAAwMA
        AAOHAAAD/wAAA/+AAAf/wAAP//z8///8/P//+Hh///AwP//wMD//8DA///AwP//4eH///////////ygA
        AAAQAAAAIAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAA
        gACAgAAAgICAAMDcwADwyqYAqj8qAP8/KgAAXyoAVV8qAKpfKgD/XyoAAH8qAFV/KgCqfyoA/38qAACf
        KgBVnyoAqp8qAP+fKgAAvyoAVb8qAKq/KgD/vyoAAN8qAFXfKgCq3yoA/98qAAD/KgBV/yoAqv8qAP//
        KgAAAFUAVQBVAKoAVQD/AFUAAB9VAFUfVQCqH1UA/x9VAAA/VQBVP1UAqj9VAP8/VQAAX1UAVV9VAKpf
        VQD/X1UAAH9VAFV/VQCqf1UA/39VAACfVQBVn1UAqp9VAP+fVQAAv1UAVb9VAKq/VQD/v1UAAN9VAFXf
        VQCq31UA/99VAAD/VQBV/1UAqv9VAP//VQAAAH8AVQB/AKoAfwD/AH8AAB9/AFUffwCqH38A/x9/AAA/
        fwBVP38Aqj9/AP8/fwAAX38AVV9/AKpffwD/X38AAH9/AFV/fwCqf38A/39/AACffwBVn38Aqp9/AP+f
        fwAAv38AVb9/AKq/fwD/v38AAN9/AFXffwCq338A/99/AAD/fwBV/38Aqv9/AP//fwAAAKoAVQCqAKoA
        qgD/AKoAAB+qAFUfqgCqH6oA/x+qAAA/qgBVP6oAqj+qAP8/qgAAX6oAVV+qAKpfqgD/X6oAAH+qAFV/
        qgCqf6oA/3+qAACfqgBVn6oAqp+qAP+fqgAAv6oAVb+qAKq/qgD/v6oAAN+qAFXfqgCq36oA/9+qAAD/
        qgBV/6oAqv+qAP//qgAAANQAVQDUAKoA1AD/ANQAAB/UAFUf1ACqH9QA/x/UAAA/1ABVP9QAqj/UAP8/
        1AAAX9QAVV/UAKpf1AD/X9QAAH/UAFV/1ACqf9QA/3/UAACf1ABVn9QAqp/UAP+f1AAAv9QAVb/UAKq/
        1AD/v9QAAN/UAFXf1ACq39QA/9/UAAD/1ABV/9QAqv/UAP//1ABVAP8AqgD/AAAf/wBVH/8Aqh//AP8f
        /wAAP/8AVT//AKo//wD/P/8AAF//AFVf/wCqX/8A/1//AAB//wBVf/8Aqn//AP9//wAAn/8AVZ//AKqf
        /wD/n/8AAL//AFW//wCqv/8A/7//AADf/wBV3/8Aqt//AP/f/wBV//8Aqv//AP/MzAD/zP8A//8zAP//
        ZgD//5kA///MAAB/AABVfwAAqn8AAP9/AAAAnwAAVZ8AAKqfAAD/nwAAAL8AAFW/AACqvwAA/78AAADf
        AABV3wAAqt8AAP/fAABV/wAAqv8AAAAAKgBVACoAqgAqAP8AKgAAHyoAVR8qAKofKgD/HyoAAD8qAFU/
        KgDw+/8ApKCgAICAgAAAAP8AAP8AAAD//wD/AAAAAAAAAP//AAD///8A/f39/f39/f39/f39/f39/f39
        /f39/YF9fVlVWVVV/f39/f39/f2ly6jGVKTGpCz9/f39/f39qc/Qz1nLqcZUeP39/f39/anQrdBZz8uk
        VHz9/f39/f2p0NDPfc+uz1R8/f39/f0xqfb29vf209BUfP39/f0yr/epgYUxLCx9VHz99f39WtH2r6lV
        pTGlVKmlXv/19V7/9q/2rzAHVf39/f1e/f1e///29q+v1PX9/f39/f39/fdeXlpaBzH9/f39/f39/f39
        /f31/f39/f39/f39/f39/f399f39/f39/f39/f39/f39Xv/1/f39/f39/f39/f39/f1e/f39/f39/f//
        /f38A/39/AH9/fwA/f38AKnQ/ABZz/gAxnzwAHz9sAD9/QAH/f2wBzIx+A8yMf9/qc//f33P/j/PfP9/
        fP0oAAAAIAAAAEAAAAABACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAZpKo/2GMov9bhJz/VX2V/0Bec/9LcIr/RmmE/0Fjf/83V3T/FExpMQAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGrtv/R8fw/ye67/8Vsuz/BWSI/wGn6f8Ao+b/AKDi/wCc
        4P8QbJP/FExpMQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFm34P9azvL/U83y/0PG8f8eb4v/JLnu/xiz
        7f8Nruv/AJ/i/wd7q/8UTGn/FExpMQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWbjg/23W8v9p1fP/WM/y/yl0
        jP83wfD/Kbrv/xu17f8AoeP/BH6x/wdWev8QcJn/FExpMQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABZueL/ftzz/33e
        9P9t2PT/NnmM/0zK8v89xPD/Lb3w/wCj5f8Agrb/BFmA/wZ7p/8Ocpv/AAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFm6
        4/+N5PT/kOX1/4Lf9f9Cfo3/Y9Pz/1HN8v9BxfD/AKbn/wCCtv8AXYX/BH2q/wl5pv8AAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAiXFfRolxX/+Gblv/hGtZ/4FoVf9+ZVL/e2JP/3lg
        TP92XUr/Wbzn/4rh9P+K4fT/iuH0/02Ilv9+3PP/dNjy/2jT8f9o0/H/AIK2/wBdhf8FgbD/CXmm/wAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIlxX0aumYr/0sC2/9C9s//Ou7H/zLmu/8u2
        q//KtKn/x7Km/8awpP9qxOv/3fT7/930+//d9Pv/h5yj/8/w+//P8Pv/u+n6/7Xo+v8AiMD/AF2F/wWB
        sP8Jeab/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAw6+i//Pv7P/m3tr/4NTO/9/S
        yv/dzsf/2szD/9jJwf/Wxr3/1MK6/7q+vv9qxOv/q/D3/6rw9/+d6/b/W5Sf/3fb9P9h0vP/Scnx/zS/
        8P8AXYX/BYKz/wl5pv8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADEsKP/9/Px//Xw
        7v/y7ev/7+rn/+7m4//r49//6N/b/+bc1v/k2NL/4dTO/8TLzv9qxOv/fK6z/3issv8/YGb/K0tT/yVI
        Uf84hp7/KYCd/xZjff8AiMD/CXmm/wAAAAC+r6UxppGDwI12ZPiFbFr4hmtZwIJoVTEAAAAAAAAAAMWx
        pP/59/X/9/Tz//Xy7//z7uz/8Ovo/+/o5P/t5OH/6uHd/+fd2P/k2tT/4tfQ/8XO0P9fsNP/T25x/5/r
        9v8uS1H/n+v2/zJsfP9Dtdj/NcDw/yG37v8LfKz/AAAAALytosDHurD/18fB/8Otof+dg3P/h21awAAA
        AAAAAAAAxbKk//v6+f/5+Pb/+PXz//bz8P/07+7/8uzq//Dq5v/u5uL/6+Pe/+jf2v/l29b/49jS/3Js
        af9Zven/KVhs/1m96f8pV2v/Wb3p/y5hd/9Zven/RrXm/zGt4/8AAAAAsZ6Q+Pn39v/w6uj/3M7G/8Ku
        of+IcF34hm5b/4RrWf/GsqX//f39//z6+v/7+fj/+fb1//fz8v/18O7/8u7s//Dr6P/u5+T/7OTg/+nh
        3P/m3df/uK+r/3Ntav/Ivbb/3M7H/7Cjnv9uZWH/o5KK/8GqnP9sUj7/AAAAAAAAAAC4ppn4+fj3////
        ///w6+j/1snA/5N7avjHsab/s5qK/8azpf////////3+//37+//7+vn/+fj2//f18//18vD/8+/t//Hs
        6f/v6eX/7ebi/+vj3v/o39r/5tvV/+LY0v/g1M3/3c/J/9vMxf/Nuq//xKyg/29VQf8AAAAAAAAAAM3A
        tsDb0sv/+vj3//n49//KvbT/q5eJwAAAAAAAAAAAx7Om///////////////+//38/f/8+/r/+vn4//j2
        9f/38/L/9fDv//Lt6v/w6uf/7ufj/+vk3//p4Nz/5t3X/+TZ0//h1c//39HL/9C9tP/FsKT/cllF/wAA
        AAAAAAAA3NHKMc/Bt8C7qZz4tqOW+MKzqMDEtasxAAAAAAAAAADHtaf///////////////////////7+
        /f/8/Pv/+/r4//r39v/39fL/9vLv//Pv7f/y7On/7+nl/+zl4f/q4t3/597Z/+Xb1f/i19H/08K6/8iz
        qP91XEn/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMi1qMr////a////////
        /////////////////v/9/Pz//Pv6//r4+P/49vT/9vPx//Xw7v/y7er/8Orm/+3m4//r5N//6eDb/+bc
        1//cz8j/y7er/3lfTP8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAiXFfMcWx
        pLL////N////6v////T////////////////+/f3//fz7//v6+f/69vX/9/Tz//Xy7//z7uz/8evo/+/o
        5f/s5eH/6uHd/+Ta1f+Gblz/hm5cRgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAiXFfMcWxpLLDr6LTwK2e6L2pnP+7ppj/t6SV/7Wgkf+xnI3/rpmJ/6uVhf+nkoH/pI59/6CK
        ev+chnX/mIJx/5V+bf+Remj/inJg/4ZuXEYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALOaiv+Ea1n/AAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAs5qK/4RrWf8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAx7Gm/4ZuW/8AAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAADHsab/hm5b/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAvq+lMaaRg8CNdmT4hWxa+IZr
        WcCCaFUxAAAAAAAAAAC+r6UxppGDwI12ZPiFbFr4hmtZwIJoVTEAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAC8raLAx7qw/9fH
        wf/DraH/nYNz/4dtWsAAAAAAAAAAALytosDHurD/18fB/8Otof+dg3P/h21awAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALGe
        kPj59/b/8Oro/9zOxv/CrqH/iHBd+AAAAAAAAAAAsZ6Q+Pn39v/w6uj/3M7G/8Kuof+IcF34AAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAuKaZ+Pn49///////8Ovo/9bJwP+Te2r4AAAAAAAAAAC4ppn4+fj3///////w6+j/1snA/5N7
        avgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAADNwLbA29LL//r49//5+Pf/yr20/6uXicAAAAAAAAAAAM3AtsDb0sv/+vj3//n4
        9//KvbT/q5eJwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAANzRyjHPwbfAu6mc+LajlvjCs6jAxLWrMQAAAAAAAAAA3NHKMc/B
        t8C7qZz4tqOW+MKzqMDEtasxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//
        ////////////////wA///8AH///AA///wAH//8AB///AAf+AAAH/AAAB/wAAAf8AAAEDAAABAwAAAQAA
        AAMAAAADAwAAAwMAAAP/AAAD/wAAA/+AAAf//Pz///z8///wMD//8DA///AwP//wMD//8DA///AwP///
        ////////KAAAABAAAAAgAAAAAQAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAABmkqj/YYyi/1uEnP9VfZX/QF5z/0twiv9GaYT/N1d0/wAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAARq7b/0fH8P8nuu//FbLs/wVkiP8Bp+n/AKPm/wCc4P8UTGn/AAAAAAAA
        AAAAAAAAAAAAAAAAAAAAAAAAAAAAAFm54v9+3PP/fd70/23Y9P82eYz/TMry/z3E8P8Ao+X/BFmA/w5y
        m/8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABZuuP/jeT0/5Dl9f+C3/X/Qn6N/2PT8/9RzfL/AKbn/wBd
        hf8Jeab/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWbzn/4rh9P+K4fT/iuH0/02Ilv9+3PP/dNjy/2jT
        8f8AXYX/CXmm/wAAAAAAAAAAAAAAAAAAAAAAAAAAdVtG/2rE6//d9Pv/3fT7/930+/+HnKP/z/D7/8/w
        +/+16Pr/AF2F/wl5pv8AAAAAAAAAAAAAAAD///8xhW1a/+3m4/+/p5r/asTr/3yus/94rLL/P2Bm/ytL
        U/8lSFH/OIae/xZjff8Jeab/Y0gzO2NIM/9jSDM7////apeAb//28vH/8u3q/+3m4/9fsNP/T25x/zOr
        1/8uS1H/LqnX/zJsfP9Dtdj/Ma3j/66ai///////Y0gz/2NIM/+plIT//fv8//n39//28/D/8u3q/+3n
        4/8pWGz/pox7/ylXa/8AAAAAAAAAAAAAAABjSDM7rpqL/2NIMzv///95sp2O///////8/Pv/+vj3//by
        8f/y7er/6eDb/9/Sy/9pTjr/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////RgAAAAC2oZP/rpqL/6eR
        gf+fiXn/l4Bv/4dvXf94X0z/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAY0gz/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAY0gzP2NIM/9jSDM/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAK6ai///////Y0gz/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
        AAAAAAAAAAAAAAAAAABjSDM/rpqL/2NIMz8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//wAA/AMAAPwB
        AAD8AAAA/AAAAPwAAAD4AAAA4AAAAAAAAAAABwAAAAcAAOgPAAD/fwAA/j8AAP4/AAD+PwAA
</value>
  </data>
</root>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































































































































Added tools/install/Installer.2005.csproj.























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * Installer.2005.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{A41FE2A5-07AD-4CE7-B836-1544634816F5}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace>Installer</RootNamespace>
    <AssemblyName>Installer</AssemblyName>
    <DelaySign>true</DelaySign>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..\..</SQLiteNetDir>
    <NetFx20>true</NetFx20>
    <ConfigurationYear>2005</ConfigurationYear>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.EnterpriseServices" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Installer.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\manifest.xml" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      EmbedExeManifest;
      StrongNameSignFrameworkTargetPath;
      CloneAndMark32BitOnlyFrameworkTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added tools/install/Installer.2008.csproj.

























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * Installer.2008.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{A41FE2A5-07AD-4CE7-B836-1544634816F5}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace>Installer</RootNamespace>
    <AssemblyName>Installer</AssemblyName>
    <DelaySign>true</DelaySign>
    <OldToolsVersion>2.0</OldToolsVersion>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..\..</SQLiteNetDir>
    <NetFx35>true</NetFx35>
    <ConfigurationYear>2008</ConfigurationYear>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.EnterpriseServices" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Installer.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\manifest.xml" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      EmbedExeManifest;
      StrongNameSignFrameworkTargetPath;
      CloneAndMark32BitOnlyFrameworkTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added tools/install/Installer.2010.csproj.































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * Installer.2010.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>10.0.30319</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{A41FE2A5-07AD-4CE7-B836-1544634816F5}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace>Installer</RootNamespace>
    <AssemblyName>Installer</AssemblyName>
    <DelaySign>true</DelaySign>
    <OldToolsVersion>3.5</OldToolsVersion>
    <TargetFrameworkProfile>Client</TargetFrameworkProfile>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..\..</SQLiteNetDir>
    <NetFx40>true</NetFx40>
    <ConfigurationYear>2010</ConfigurationYear>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.EnterpriseServices" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Installer.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\manifest.xml" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      EmbedExeManifest;
      StrongNameSignFrameworkTargetPath;
      StrongNameSignSdkToolsTargetPath;
      CloneAndMark32BitOnlyFrameworkTargetName32;
      CloneAndMark32BitOnlySdkToolsTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added tools/install/Installer.2012.csproj.



























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * Installer.2012.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{A41FE2A5-07AD-4CE7-B836-1544634816F5}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace>Installer</RootNamespace>
    <AssemblyName>Installer</AssemblyName>
    <DelaySign>true</DelaySign>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..\..</SQLiteNetDir>
    <NetFx45>true</NetFx45>
    <ConfigurationYear>2012</ConfigurationYear>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.EnterpriseServices" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Installer.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\manifest.xml" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      EmbedExeManifest;
      StrongNameSignFrameworkTargetPath;
      StrongNameSignSdkToolsTargetPath;
      CloneAndMark32BitOnlyFrameworkTargetName32;
      CloneAndMark32BitOnlySdkToolsTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added tools/install/Installer.2013.csproj.



























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * Installer.2013.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{A41FE2A5-07AD-4CE7-B836-1544634816F5}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace>Installer</RootNamespace>
    <AssemblyName>Installer</AssemblyName>
    <DelaySign>true</DelaySign>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..\..</SQLiteNetDir>
    <NetFx451>true</NetFx451>
    <ConfigurationYear>2013</ConfigurationYear>
    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.EnterpriseServices" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Installer.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\manifest.xml" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      EmbedExeManifest;
      StrongNameSignFrameworkTargetPath;
      StrongNameSignSdkToolsTargetPath;
      CloneAndMark32BitOnlyFrameworkTargetName32;
      CloneAndMark32BitOnlySdkToolsTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added tools/install/Installer.2015.csproj.



























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * Installer.2015.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{A41FE2A5-07AD-4CE7-B836-1544634816F5}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace>Installer</RootNamespace>
    <AssemblyName>Installer</AssemblyName>
    <DelaySign>true</DelaySign>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..\..</SQLiteNetDir>
    <NetFx46>true</NetFx46>
    <ConfigurationYear>2015</ConfigurationYear>
    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.EnterpriseServices" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Installer.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\manifest.xml" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      EmbedExeManifest;
      StrongNameSignFrameworkTargetPath;
      StrongNameSignSdkToolsTargetPath;
      CloneAndMark32BitOnlyFrameworkTargetName32;
      CloneAndMark32BitOnlySdkToolsTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added tools/install/Installer.2017.csproj.



























































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?xml version="1.0" encoding="utf-8"?>
<!--
 *
 * Installer.2017.csproj -
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 *
-->
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{A41FE2A5-07AD-4CE7-B836-1544634816F5}</ProjectGuid>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <OutputType>Exe</OutputType>
    <RootNamespace>Installer</RootNamespace>
    <AssemblyName>Installer</AssemblyName>
    <DelaySign>true</DelaySign>
    <SQLiteNetDir>$(MSBuildProjectDirectory)\..\..</SQLiteNetDir>
    <NetFx47>true</NetFx47>
    <ConfigurationYear>2017</ConfigurationYear>
    <TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
    <Prefer32Bit>false</Prefer32Bit>
  </PropertyGroup>
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Platform.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.Settings.targets" />
  <Import Project="$(SQLiteNetDir)\Targets\SQLite.NET.targets" />
  <PropertyGroup Condition="'$(BinaryOutputPath)' != ''">
    <OutputPath>$(BinaryOutputPath)</OutputPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.EnterpriseServices" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Installer.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\manifest.xml" />
  </ItemGroup>
  <Import Project="$(SQLiteNetDir)\System.Data.SQLite\Targets\System.Data.SQLite.Properties.targets" />
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <BuildDependsOn>
      $(BuildDependsOn);
      EmbedExeManifest;
      StrongNameSignFrameworkTargetPath;
      StrongNameSignSdkToolsTargetPath;
      CloneAndMark32BitOnlyFrameworkTargetName32;
      CloneAndMark32BitOnlySdkToolsTargetName32;
    </BuildDependsOn>
  </PropertyGroup>
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>

Added tools/install/Installer.cs.



















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
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
7464
7465
7466
7467
7468
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
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8030
8031
8032
8033
8034
8035
8036
8037
8038
8039
8040
8041
8042
8043
8044
8045
8046
8047
8048
8049
8050
8051
8052
8053
8054
8055
8056
8057
8058
8059
8060
8061
8062
8063
8064
8065
8066
8067
8068
8069
8070
8071
8072
8073
8074
8075
8076
8077
8078
8079
8080
8081
8082
8083
8084
8085
8086
8087
8088
8089
8090
8091
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8228
8229
8230
8231
8232
8233
8234
8235
8236
8237
8238
8239
8240
8241
8242
8243
8244
8245
8246
8247
8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
8258
8259
8260
8261
8262
8263
8264
8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
8275
8276
8277
8278
8279
8280
8281
8282
8283
8284
8285
8286
8287
8288
8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
8300
8301
8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
8312
8313
8314
8315
8316
8317
8318
8319
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8355
8356
8357
8358
8359
8360
8361
8362
8363
8364
8365
8366
8367
8368
8369
8370
8371
8372
8373
8374
8375
8376
8377
8378
8379
8380
8381
8382
8383
8384
8385
8386
8387
8388
8389
8390
8391
8392
8393
8394
8395
8396
8397
8398
8399
8400
8401
8402
8403
8404
8405
8406
8407
8408
8409
8410
8411
8412
8413
8414
8415
8416
8417
8418
8419
8420
8421
8422
8423
8424
8425
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8436
8437
8438
8439
8440
8441
8442
8443
8444
8445
8446
8447
8448
8449
8450
8451
8452
8453
8454
8455
8456
8457
8458
8459
8460
8461
8462
8463
8464
8465
8466
8467
8468
8469
8470
8471
8472
8473
8474
8475
8476
8477
8478
8479
8480
8481
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8526
8527
8528
8529
8530
8531
8532
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744
8745
8746
8747
8748
8749
8750
8751
8752
8753
8754
8755
8756
8757
8758
8759
8760
8761
8762
8763
8764
8765
8766
8767
8768
8769
8770
8771
8772
8773
8774
8775
8776
8777
8778
8779
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8828
8829
8830
8831
8832
8833
8834
8835
8836
8837
8838
8839
8840
8841
8842
8843
8844
8845
8846
8847
8848
8849
8850
8851
8852
8853
8854
8855
8856
8857
8858
8859
8860
8861
8862
8863
8864
8865
8866
8867
8868
8869
8870
8871
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8882
8883
8884
8885
8886
8887
8888
8889
8890
8891
8892
8893
8894
8895
8896
8897
8898
8899
8900
8901
8902
8903
8904
8905
8906
8907
8908
8909
8910
8911
8912
8913
8914
8915
8916
8917
8918
8919
8920
8921
8922
8923
8924
8925
8926
8927
8928
8929
8930
8931
8932
8933
8934
8935
8936
8937
8938
8939
8940
8941
8942
8943
8944
8945
8946
8947
8948
8949
8950
8951
8952
8953
8954
8955
8956
8957
8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974
8975
8976
8977
8978
8979
8980
8981
8982
8983
8984
8985
8986
8987
8988
8989
8990
8991
8992
8993
8994
8995
8996
8997
8998
8999
9000
9001
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9044
9045
9046
9047
9048
9049
9050
9051
9052
9053
9054
9055
9056
9057
9058
9059
9060
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9173
9174
9175
9176
9177
9178
9179
9180
9181
9182
9183
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9287
9288
9289
9290
9291
9292
9293
9294
9295
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9356
9357
9358
9359
9360
9361
9362
9363
9364
9365
9366
9367
9368
9369
9370
9371
9372
9373
9374
9375
9376
9377
9378
9379
9380
9381
9382
9383
9384
9385
9386
9387
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9489
9490
9491
9492
9493
9494
9495
9496
9497
9498
9499
9500
9501
9502
9503
9504
9505
9506
9507
9508
9509
9510
9511
9512
9513
9514
9515
9516
9517
9518
9519
9520
9521
9522
9523
9524
9525
9526
9527
9528
9529
9530
9531
9532
9533
9534
9535
9536
9537
9538
9539
9540
9541
9542
9543
9544
9545
9546
9547
9548
9549
9550
9551
9552
9553
9554
9555
9556
9557
9558
9559
9560
9561
/*
 * Installer.cs --
 *
 * Written by Joe Mistachkin.
 * Released to the public domain, use at your own risk!
 */

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.EnterpriseServices.Internal;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;

#if WINDOWS
using System.Runtime.InteropServices;
#endif

using System.Security;

#if NET_20 || NET_35
using System.Security.Permissions;
#endif

using System.Text;
using System.Threading;
using System.Windows.Forms;
using System.Xml;
using Microsoft.Win32;

namespace System.Data.SQLite
{
    #region Public Delegates
    internal delegate void TraceCallback(
        string message, /* in */
        string category /* in */
    );

    ///////////////////////////////////////////////////////////////////////////

    internal delegate bool FrameworkConfigCallback(
        string fileName,           /* in */
        string invariantName,      /* in */
        string name,               /* in */
        string description,        /* in */
        string typeName,           /* in */
        AssemblyName assemblyName, /* in */
        string directory,          /* in */
        object clientData,         /* in */
        bool perUser,              /* in */
        bool wow64,                /* in */
        bool throwOnMissing,       /* in */
        bool whatIf,               /* in */
        bool verbose,              /* in */
        ref bool saved,            /* out */
        ref string error           /* out */
    );

    ///////////////////////////////////////////////////////////////////////////

    internal delegate bool FrameworkRegistryCallback(
        Installer.MockRegistryKey rootKey, /* in */
        string frameworkName,              /* in */
        Version frameworkVersion,          /* in */
        string platformName,               /* in */
        string directory,                  /* in */
        object clientData,                 /* in */
        bool perUser,                      /* in */
        bool wow64,                        /* in */
        bool throwOnMissing,               /* in */
        bool whatIf,                       /* in */
        bool verbose,                      /* in */
        ref string error                   /* out */
    );

    ///////////////////////////////////////////////////////////////////////////

    internal delegate bool VisualStudioRegistryCallback(
        Installer.MockRegistryKey rootKey, /* in */
        Version vsVersion,                 /* in */
        string suffix,                     /* in, optional */
        Installer.Package package,         /* in */
        string directory,                  /* in */
        object clientData,                 /* in */
        bool perUser,                      /* in */
        bool wow64,                        /* in */
        bool throwOnMissing,               /* in */
        bool whatIf,                       /* in */
        bool verbose,                      /* in */
        ref string error                   /* out */
    );
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region Public Enumerations
    [Flags()]
    public enum InstallFlags
    {
        #region Normal Values
        None = 0x0,                          // No actions should be taken
        CoreGlobalAssemblyCache = 0x1,       // GAC System.Data.SQLite.dll
        LinqGlobalAssemblyCache = 0x2,       // GAC System.Data.SQLite.Linq.dll
        Ef6GlobalAssemblyCache = 0x4,        // GAC System.Data.SQLite.EF6.dll
        AssemblyFolders = 0x8,               // Registry AssemblyFolders[Ex]
        DbProviderFactory = 0x10,            // machine.config data provider
        VsPackage = 0x20,                    // Registry VS package
        VsPackageGlobalAssemblyCache = 0x40, // GAC SQLite.Designer.dll
        VsDataSource = 0x80,                 // Registry VS data source
        VsDataProvider = 0x100,              // Registry VS data provider
        VsDevEnvSetup = 0x200,               // Runs VS in "/setup" mode
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Composite Values
        FrameworkGlobalAssemblyCache = CoreGlobalAssemblyCache |
                                       LinqGlobalAssemblyCache |
                                       Ef6GlobalAssemblyCache,

        ///////////////////////////////////////////////////////////////////////

        Framework = FrameworkGlobalAssemblyCache | AssemblyFolders |
                    DbProviderFactory,

        ///////////////////////////////////////////////////////////////////////

        VsRegistry = VsPackage | VsDataSource | VsDataProvider,

        Vs = VsRegistry | VsPackageGlobalAssemblyCache | VsDevEnvSetup,

        ///////////////////////////////////////////////////////////////////////

        AllGlobalAssemblyCache = FrameworkGlobalAssemblyCache |
                                 VsPackageGlobalAssemblyCache,

        ///////////////////////////////////////////////////////////////////////

        AllRegistry = AssemblyFolders | VsRegistry,

        ///////////////////////////////////////////////////////////////////////

        Standard = DbProviderFactory | VsRegistry,

        ///////////////////////////////////////////////////////////////////////

        All = Framework | Vs,

        ///////////////////////////////////////////////////////////////////////

        AllExceptGlobalAssemblyCache = All & ~AllGlobalAssemblyCache,
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Suggested Default Values
        Default = All
        #endregion
    }

    ///////////////////////////////////////////////////////////////////////////

    [Flags()]
    public enum ProviderFlags
    {
        #region Normal Values
        None = 0x0,
        SystemEf6MustBeGlobal = 0x1,
        DidLinqForceTrace = 0x2,
        DidEf6ForceTrace = 0x4,
        DidEf6ResolveTrace = 0x8,
        ForceLinqEnabled = 0x10,
        ForceLinqDisabled = 0x20,
        ForceEf6Enabled = 0x40,
        ForceEf6Disabled = 0x80,
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Suggested Default Values
        Default = None
        #endregion
    }

    ///////////////////////////////////////////////////////////////////////////

    [Flags()]
    public enum TracePriority
    {
        #region Normal Values
        None = 0x0,
        Lowest = 0x1,
        Lower = 0x2,
        Low = 0x4,
        MediumLow = 0x8,
        Medium = 0x10,
        MediumHigh = 0x20,
        High = 0x40,
        Higher = 0x80,
        Highest = 0x100,
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Suggested Default Flags
        Default = Medium
        #endregion
    }
    #endregion

    ///////////////////////////////////////////////////////////////////////////

    #region Installer Class
#if NET_40 || NET_45 || NET_451 || NET_452 || NET_46 || NET_461 || NET_462 || NET_47 || NET_471 || NET_472 || NET_48
    [SecurityCritical()]
#else
    [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)]
#endif
    internal static class Installer
    {
        #region Unsafe Native Methods Class
        [SuppressUnmanagedCodeSecurity()]
        private sealed class UnsafeNativeMethods
        {
#if WINDOWS
            #region Native Win32 Constants
            private const int MAX_PATH = 260;

            ///////////////////////////////////////////////////////////////////

            private const int CSIDL_SYSTEMX86 = 0x0029;

            ///////////////////////////////////////////////////////////////////

            private const int SHGFP_TYPE_CURRENT = 0;

            ///////////////////////////////////////////////////////////////////

            private const int S_OK = 0; /* HRESULT */
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Native Windows Methods
            [DllImport("shfolder.dll",
                CallingConvention = CallingConvention.Winapi,
                CharSet = CharSet.Auto, BestFitMapping = false,
                ThrowOnUnmappableChar = true, SetLastError = true)]
            private static extern int SHGetFolderPath(
                IntPtr hWndOwner, int nFolder, IntPtr hToken, uint flags,
                IntPtr buffer /* >= MAX_PATH */);
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Wrapper Methods
            public static string GetSystemDirectory()
            {
                IntPtr buffer = IntPtr.Zero;

                try
                {
                    buffer = Marshal.AllocCoTaskMem(
                        sizeof(char) * (MAX_PATH + 1));

                    if (buffer != IntPtr.Zero)
                    {
                        if (SHGetFolderPath(IntPtr.Zero,
                                CSIDL_SYSTEMX86, IntPtr.Zero,
                                SHGFP_TYPE_CURRENT, buffer) == S_OK)
                        {
                            return Marshal.PtrToStringAuto(buffer);
                        }
                    }
                }
                catch (Exception e)
                {
                    //
                    // TODO: Is this the right error handling solution
                    //       to use at this point?
                    //
                    TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                        debugCallback, traceCallback, String.Format(
                        "Could not get system directory: {0}", e),
                        traceCategory);

                    throw;
                }
                finally
                {
                    if (buffer != IntPtr.Zero)
                    {
                        Marshal.FreeCoTaskMem(buffer);
                        buffer = IntPtr.Zero;
                    }
                }

                return null;
            }
            #endregion
#endif
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Helper Classes
        #region ObjectHelper Class
        private static class ObjectHelper
        {
            public static bool AreEqual(
                object value1,
                object value2
                )
            {
                if ((value1 == null) || (value2 == null))
                    return ((value1 == null) && (value2 == null));

                if (Object.ReferenceEquals(value1, value2))
                    return true;

                return value1.Equals(value2);
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region AnyPair Class
        private sealed class AnyPair<T1, T2> :
            IComparer<AnyPair<T1, T2>>,
            IComparable<AnyPair<T1, T2>>,
            IComparable,
            IEquatable<AnyPair<T1, T2>>,
            IEqualityComparer<AnyPair<T1, T2>>,
            ICloneable
        {
            #region Public Constructors
            //
            // WARNING: This constructor produces an immutable "empty" pair
            //          object.
            //
            public AnyPair()
                : base()
            {
                // do nothing.
            }

            ///////////////////////////////////////////////////////////////////

            public AnyPair(T1 x)
                : this()
            {
                this.x = x;
            }

            ///////////////////////////////////////////////////////////////////

            public AnyPair(T1 x, T2 y)
                : this(x)
            {
                this.y = y;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Properties
            private T1 x;
            public T1 X
            {
                get { return x; }
            }

            ///////////////////////////////////////////////////////////////////

            private T2 y;
            public T2 Y
            {
                get { return y; }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region System.Object Overrides
            public override bool Equals(
                object obj
                )
            {
                AnyPair<T1, T2> anyPair = obj as AnyPair<T1, T2>;

                if (anyPair != null)
                {
                    if (!ObjectHelper.AreEqual(X, anyPair.X))
                        return false;

                    if (!ObjectHelper.AreEqual(Y, anyPair.Y))
                        return false;

                    return true;
                }

                return false;
            }

            ///////////////////////////////////////////////////////////////////

            public override string ToString()
            {
                //
                // TODO: The delimiter here is hard-coded to a space.  This
                //       may need to be changed, e.g. if the use-cases for
                //       this class change.
                //
                return String.Format("{0} {1}", X, Y);
            }

            ///////////////////////////////////////////////////////////////////

            public override int GetHashCode()
            {
                int result = 0;
                T1 x = X;

                if (x != null)
                    result ^= x.GetHashCode();

                T2 y = Y;

                if (y != null)
                    result ^= y.GetHashCode();

                return result;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region IComparer<AnyPair<T1,T2>> Members
            public int Compare(
                AnyPair<T1, T2> x,
                AnyPair<T1, T2> y
                )
            {
                if ((x == null) && (y == null))
                {
                    return 0;
                }
                else if (x == null)
                {
                    return -1;
                }
                else if (y == null)
                {
                    return 1;
                }
                else
                {
                    int result = Comparer<T1>.Default.Compare(x.X, y.X);

                    if (result != 0)
                        return result;

                    return Comparer<T2>.Default.Compare(x.Y, y.Y);
                }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region IComparable<AnyPair<T1,T2>> Members
            public int CompareTo(
                AnyPair<T1, T2> other
                )
            {
                return Compare(this, other);
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region IComparable Members
            public int CompareTo(
                object obj
                )
            {
                AnyPair<T1, T2> anyPair = obj as AnyPair<T1, T2>;

                if (anyPair == null)
                    throw new ArgumentException();

                return CompareTo(anyPair);
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region IEquatable<AnyPair<T1,T2>> Members
            public bool Equals(
                AnyPair<T1, T2> other
                )
            {
                return CompareTo(other) == 0;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region IEqualityComparer<AnyPair<T1,T2>> Members
            public bool Equals(
                AnyPair<T1, T2> x,
                AnyPair<T1, T2> y
                )
            {
                return ObjectHelper.AreEqual(x, y);
            }

            ///////////////////////////////////////////////////////////////////

            public int GetHashCode(
                AnyPair<T1, T2> obj
                )
            {
                return (obj != null) ? obj.GetHashCode() : 0;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region ICloneable Members
            public object Clone()
            {
                return new AnyPair<T1, T2>(X, Y);
            }
            #endregion
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region TraceOps Class
        private static class TraceOps
        {
            #region Private Constants
            private const string DefaultDebugFormat = "#{0:000} @ {1}: {2}";
            private const string DefaultTraceFormat = "#{0:000} @ {1}: {2}";

            private const string Iso8601DateTimeOutputFormat =
                "yyyy.MM.ddTHH:mm:ss.fffffff";
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Private Static Data
            private static object syncRoot = new object();
            private static long nextDebugId;
            private static long nextTraceId;
            private static IList<TraceListener> debugListeners;
            private static TracePriority debugPriority = TracePriority.Default;
            private static TracePriority tracePriority = TracePriority.Default;
            private static string debugFormat = DefaultDebugFormat;
            private static string traceFormat = DefaultTraceFormat;
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Static Properties
            public static TracePriority DebugPriority
            {
                get { lock (syncRoot) { return debugPriority; } }
                set { lock (syncRoot) { debugPriority = value; } }
            }

            ///////////////////////////////////////////////////////////////////

            public static TracePriority TracePriority
            {
                get { lock (syncRoot) { return tracePriority; } }
                set { lock (syncRoot) { tracePriority = value; } }
            }

            ///////////////////////////////////////////////////////////////////

            public static string DebugFormat
            {
                get { lock (syncRoot) { return debugFormat; } }
                set { lock (syncRoot) { debugFormat = value; } }
            }

            ///////////////////////////////////////////////////////////////////

            public static string TraceFormat
            {
                get { lock (syncRoot) { return traceFormat; } }
                set { lock (syncRoot) { traceFormat = value; } }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Interactive Support Methods
            [MethodImpl(MethodImplOptions.NoInlining)]
            public static DialogResult ShowMessage(
                TracePriority tracePriority,
                TraceCallback debugCallback,
                TraceCallback traceCallback,
                Assembly assembly,
                string message,
                string category,
                MessageBoxButtons buttons,
                MessageBoxIcon icon
                )
            {
                DialogResult result = DialogResult.OK;

                DebugAndTrace(tracePriority,
                    debugCallback, traceCallback, message, category);

                if (SystemInformation.UserInteractive)
                {
                    string title = GetAssemblyTitle(assembly);

                    if (title == null)
                        title = Application.ProductName;

                    result = MessageBox.Show(message, title, buttons, icon);

                    DebugAndTrace(tracePriority,
                        debugCallback, traceCallback, String.Format(
                        "User choice of {0}.", ForDisplay(result)),
                        category);

                    return result;
                }

                DebugAndTrace(tracePriority,
                    debugCallback, traceCallback, String.Format(
                    "Default choice of {0}.", ForDisplay(result)),
                    category);

                return result;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Tracing Support Methods
            public static void SetupDebugListeners()
            {
                if (debugListeners == null)
                    debugListeners = new List<TraceListener>();

                debugListeners.Add(new ConsoleTraceListener());
            }

            ///////////////////////////////////////////////////////////////////

            public static long NextDebugId()
            {
                return Interlocked.Increment(ref nextDebugId);
            }

            ///////////////////////////////////////////////////////////////////

            public static long NextTraceId()
            {
                return Interlocked.Increment(ref nextTraceId);
            }

            ///////////////////////////////////////////////////////////////////

            public static string TimeStamp(DateTime dateTime)
            {
                return dateTime.ToString(Iso8601DateTimeOutputFormat);
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static string GetMethodName(
                StackTrace stackTrace,
                int level
                )
            {
                try
                {
                    //
                    // NOTE: If a valid stack trace was not supplied by the
                    //       caller, create one now based on the current
                    //       execution stack.
                    //
                    if (stackTrace == null)
                    {
                        //
                        // NOTE: Grab the current execution stack.
                        //
                        stackTrace = new StackTrace();

                        //
                        // NOTE: Always skip this call frame when we capture
                        //       the stack trace.
                        //
                        level++;
                    }

                    //
                    // NOTE: Get the specified stack frame (always add one to
                    //       skip this method).
                    //
                    StackFrame stackFrame = stackTrace.GetFrame(level);

                    //
                    // NOTE: Get the method for the stack frame.
                    //
                    MethodBase methodBase = stackFrame.GetMethod();

                    //
                    // NOTE: Get the type for the method.
                    //
                    Type type = methodBase.DeclaringType;

                    //
                    // NOTE: Get the name of the method.
                    //
                    string name = methodBase.Name;

                    //
                    // NOTE: Return the properly formatted result.
                    //
                    return String.Format(
                        "{0}{1}{2}", type.Name, Type.Delimiter, name);
                }
                catch
                {
                    // do nothing.
                }

                return null;
            }

            ///////////////////////////////////////////////////////////////////

            public static void DebugCore(
                string message,
                string category
                )
            {
                lock (syncRoot) /* TRANSACTIONAL */
                {
                    if (debugListeners != null)
                    {
                        foreach (TraceListener listener in debugListeners)
                        {
                            listener.WriteLine(message, category);
                            listener.Flush();
                        }
                    }
                }
            }

            ///////////////////////////////////////////////////////////////////

            public static void TraceCore(
                string message,
                string category
                )
            {
                lock (syncRoot) /* TRANSACTIONAL */
                {
                    //
                    // NOTE: Write the message to all the active trace
                    //       listeners.
                    //
                    Trace.WriteLine(message, category);
                    Trace.Flush();
                }
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static string DebugAndTrace(
                TracePriority tracePriority,
                TraceCallback debugCallback,
                TraceCallback traceCallback,
                Exception exception,
                string category
                )
            {
                if (exception != null)
                    return DebugAndTrace(tracePriority, debugCallback,
                        traceCallback, new StackTrace(exception, true), 0,
                        exception.ToString(), category);

                return null;
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static string DebugAndTrace(
                TracePriority tracePriority,
                TraceCallback debugCallback,
                TraceCallback traceCallback,
                string message,
                string category
                )
            {
                return DebugAndTrace(
                    tracePriority, debugCallback, traceCallback, null, 1,
                    message, category);
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            private static string DebugAndTrace(
                TracePriority tracePriority,
                TraceCallback debugCallback,
                TraceCallback traceCallback,
                StackTrace stackTrace,
                int level,
                string message,
                string category
                )
            {
                //
                // NOTE: Always skip this call frame if the stack trace is
                //       going to be captured by GetMethodName.
                //
                if (stackTrace == null)
                    level++;

                //
                // NOTE: Format the message for display (once).
                //
                string formatted = String.Format("{0}: {1}",
                    GetMethodName(stackTrace, level), message);

                //
                // NOTE: If the debug callback is invalid or the trace priority
                //       of this message is less than what we currently want to
                //       debug, skip it.
                //
                if ((debugCallback != null) &&
                    (tracePriority >= DebugPriority))
                {
                    //
                    // NOTE: Invoke the debug callback with the formatted
                    //       message and the category specified by the
                    //       caller.
                    //
                    debugCallback(formatted, category);
                }

                //
                // NOTE: If the trace callback is invalid or the trace priority
                //       of this message is less than what we currently want to
                //       trace, skip it.
                //
                if ((traceCallback != null) &&
                    (tracePriority >= TracePriority))
                {
                    //
                    // NOTE: Invoke the trace callback with the formatted
                    //       message and the category specified by the
                    //       caller.
                    //
                    traceCallback(formatted, category);
                }

                return message;
            }
            #endregion
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region MockRegistry Class
        private sealed class MockRegistry : IDisposable
        {
            #region Public Constructors
            public MockRegistry()
            {
                whatIf = true;
                readOnly = true;
                safe = true;
            }

            ///////////////////////////////////////////////////////////////////

            public MockRegistry(
                bool whatIf
                )
                : this()
            {
                this.whatIf = whatIf;
            }

            ///////////////////////////////////////////////////////////////////

            public MockRegistry(
                bool whatIf,
                bool readOnly
                )
                : this(whatIf)
            {
                this.readOnly = readOnly;
            }

            ///////////////////////////////////////////////////////////////////

            public MockRegistry(
                bool whatIf,
                bool readOnly,
                bool safe
                )
                : this(whatIf, readOnly)
            {
                this.safe = safe;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Properties
            private bool whatIf;
            public bool WhatIf
            {
                get { CheckDisposed(); return whatIf; }
                set { CheckDisposed(); whatIf = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool readOnly;
            public bool ReadOnly
            {
                get { CheckDisposed(); return readOnly; }
                set { CheckDisposed(); readOnly = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool safe;
            public bool Safe
            {
                get { CheckDisposed(); return safe; }
                set { CheckDisposed(); safe = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private MockRegistryKey classesRoot;
            public MockRegistryKey ClassesRoot
            {
                get
                {
                    CheckDisposed();

                    if (classesRoot == null)
                    {
                        classesRoot = new MockRegistryKey(
                            Registry.ClassesRoot, whatIf, readOnly, safe);
                    }

                    return classesRoot;
                }
            }

            ///////////////////////////////////////////////////////////////////

            private MockRegistryKey currentConfig;
            public MockRegistryKey CurrentConfig
            {
                get
                {
                    CheckDisposed();

                    if (currentConfig == null)
                    {
                        currentConfig = new MockRegistryKey(
                            Registry.CurrentConfig, whatIf, readOnly, safe);
                    }

                    return currentConfig;
                }
            }

            ///////////////////////////////////////////////////////////////////

            private MockRegistryKey currentUser;
            public MockRegistryKey CurrentUser
            {
                get
                {
                    CheckDisposed();

                    if (currentUser == null)
                    {
                        currentUser = new MockRegistryKey(
                            Registry.CurrentUser, whatIf, readOnly, safe);
                    }

                    return currentUser;
                }
            }

            ///////////////////////////////////////////////////////////////////

            private MockRegistryKey dynData;
            public MockRegistryKey DynData
            {
                get
                {
                    CheckDisposed();

                    if (dynData == null)
                    {
                        dynData = new MockRegistryKey(
                            Registry.DynData, whatIf, readOnly, safe);
                    }

                    return dynData;
                }
            }

            ///////////////////////////////////////////////////////////////////

            private MockRegistryKey localMachine;
            public MockRegistryKey LocalMachine
            {
                get
                {
                    CheckDisposed();

                    if (localMachine == null)
                    {
                        localMachine = new MockRegistryKey(
                            Registry.LocalMachine, whatIf, readOnly, safe);
                    }

                    return localMachine;
                }
            }

            ///////////////////////////////////////////////////////////////////

            private MockRegistryKey performanceData;
            public MockRegistryKey PerformanceData
            {
                get
                {
                    CheckDisposed();

                    if (performanceData == null)
                    {
                        performanceData = new MockRegistryKey(
                            Registry.PerformanceData, whatIf, readOnly, safe);
                    }

                    return performanceData;
                }
            }

            ///////////////////////////////////////////////////////////////////

            private MockRegistryKey users;
            public MockRegistryKey Users
            {
                get
                {
                    CheckDisposed();

                    if (users == null)
                    {
                        users = new MockRegistryKey(
                            Registry.Users, whatIf, readOnly, safe);
                    }

                    return users;
                }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public "Registry" Methods
#if false
            public object GetValue(
                string keyName,
                string valueName,
                object defaultValue
                )
            {
                CheckDisposed();

                return Registry.GetValue(keyName, valueName, defaultValue);
            }

            ///////////////////////////////////////////////////////////////////

            public void SetValue(
                string keyName,
                string valueName,
                object value
                )
            {
                CheckDisposed();
                CheckReadOnly();

                if (!whatIf)
                    Registry.SetValue(keyName, valueName, value);
            }

            ///////////////////////////////////////////////////////////////////

            public void SetValue(
                string keyName,
                string valueName,
                object value,
                RegistryValueKind valueKind
                )
            {
                CheckDisposed();
                CheckReadOnly();

                if (!whatIf)
                    Registry.SetValue(keyName, valueName, value, valueKind);
            }
#endif
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Private Methods
            private void CheckReadOnly()
            {
                //
                // NOTE: In "read-only" mode, we disallow all write access.
                //
                if (!readOnly)
                    return;

                throw new InvalidOperationException();
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region IDisposable "Pattern" Members
            private bool disposed;
            private void CheckDisposed() /* throw */
            {
                if (!disposed)
                    return;

                throw new ObjectDisposedException(
                    typeof(MockRegistry).Name);
            }

            ///////////////////////////////////////////////////////////////////

            private /* protected virtual */ void Dispose(
                bool disposing
                )
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        if (classesRoot != null)
                        {
                            classesRoot.Close();
                            classesRoot = null;
                        }

                        if (currentConfig != null)
                        {
                            currentConfig.Close();
                            currentConfig = null;
                        }

                        if (currentUser != null)
                        {
                            currentUser.Close();
                            currentUser = null;
                        }

                        if (dynData != null)
                        {
                            dynData.Close();
                            dynData = null;
                        }

                        if (localMachine != null)
                        {
                            localMachine.Close();
                            localMachine = null;
                        }

                        if (performanceData != null)
                        {
                            performanceData.Close();
                            performanceData = null;
                        }

                        if (users != null)
                        {
                            users.Close();
                            users = null;
                        }
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////

                    //
                    // NOTE: This object is now disposed.
                    //
                    disposed = true;
                }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region IDisposable Members
            public void Dispose()
            {
                Dispose(true);
                GC.SuppressFinalize(this);
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Destructor
            ~MockRegistry()
            {
                Dispose(false);
            }
            #endregion
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region MockRegistryKey Class
        internal sealed class MockRegistryKey : IDisposable
        {
            #region Private Constructors
            private MockRegistryKey()
            {
                whatIf = true;
                readOnly = true;
                safe = true;
                noClose = false;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Constructors
            public MockRegistryKey(
                RegistryKey key
                )
                : this()
            {
                this.key = key;
            }

            ///////////////////////////////////////////////////////////////////

            public MockRegistryKey(
                RegistryKey key,
                string subKeyName
                )
                : this(key)
            {
                this.subKeyName = subKeyName;
            }

            ///////////////////////////////////////////////////////////////////

            public MockRegistryKey(
                RegistryKey key,
                string subKeyName,
                bool whatIf
                )
                : this(key, subKeyName)
            {
                this.whatIf = whatIf;
            }

            ///////////////////////////////////////////////////////////////////

            public MockRegistryKey(
                RegistryKey key,
                string subKeyName,
                bool whatIf,
                bool readOnly
                )
                : this(key, subKeyName, whatIf)
            {
                this.readOnly = readOnly;
            }

            ///////////////////////////////////////////////////////////////////

            public MockRegistryKey(
                RegistryKey key,
                string subKeyName,
                bool whatIf,
                bool readOnly,
                bool safe
                )
                : this(key, subKeyName, whatIf, readOnly)
            {
                this.safe = safe;
            }

            ///////////////////////////////////////////////////////////////////

            public MockRegistryKey(
                RegistryKey key,
                bool whatIf
                )
                : this(key, null, whatIf)
            {
                // do nothing.
            }

            ///////////////////////////////////////////////////////////////////

            public MockRegistryKey(
                RegistryKey key,
                bool whatIf,
                bool readOnly
                )
                : this(key, null, whatIf, readOnly)
            {
                // do nothing.
            }

            ///////////////////////////////////////////////////////////////////

            public MockRegistryKey(
                RegistryKey key,
                bool whatIf,
                bool readOnly,
                bool safe
                )
                : this(key, null, whatIf, readOnly, safe)
            {
                // do nothing.
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Methods
            public void Close()
            {
                //
                // NOTE: No disposed check here because calling this method
                //       should be just like calling Dispose.
                //
                Dispose(true);
            }

            ///////////////////////////////////////////////////////////////////

            public void DisableClose()
            {
                CheckDisposed();

                noClose = true;
            }

            ///////////////////////////////////////////////////////////////////

            public void ResetSubKeyName(
                string subKeyName
                )
            {
                CheckDisposed();

                this.subKeyName = subKeyName;
            }

            ///////////////////////////////////////////////////////////////////

            public MockRegistryKey Clone(
                bool whatIf,
                bool readOnly,
                bool safe
                )
            {
                CheckDisposed();

                return new MockRegistryKey(
                    key, subKeyName, this.whatIf || whatIf, this.readOnly ||
                    readOnly, this.safe || safe);
            }

            ///////////////////////////////////////////////////////////////////

            public MockRegistryKey CreateSubKey(
                string subKeyName
                )
            {
                CheckDisposed();
                CheckReadOnly();

                if (key == null)
                    return null;

                if (whatIf)
                {
                    //
                    // HACK: Attempt to open the specified sub-key.  If this
                    //       fails, we'll simply return the wrapped root key
                    //       itself since no writes are allowed in "what-if"
                    //       mode anyhow.
                    //
                    RegistryKey subKey = key.OpenSubKey(subKeyName);

                    if (subKey != null)
                    {
                        return new MockRegistryKey(
                            subKey, whatIf, readOnly, safe);
                    }
                    else
                    {
                        return new MockRegistryKey(
                            key, subKeyName, whatIf, readOnly, safe);
                    }
                }
                else
                {
                    return new MockRegistryKey(
                        key.CreateSubKey(subKeyName), whatIf, readOnly, safe);
                }
            }

            ///////////////////////////////////////////////////////////////////

            public void DeleteSubKey(
                string subKeyName,
                bool throwOnMissing
                )
            {
                CheckDisposed();
                CheckReadOnly();

                if (key == null)
                    return;

                if (!whatIf)
                    key.DeleteSubKey(subKeyName, throwOnMissing);
            }

            ///////////////////////////////////////////////////////////////////

            public void DeleteSubKeyTree(
                string subKeyName
                )
            {
                CheckDisposed();
                CheckReadOnly();

                if (key == null)
                    return;

                if (!whatIf)
                    key.DeleteSubKeyTree(subKeyName);
            }

            ///////////////////////////////////////////////////////////////////

            public void DeleteValue(
                string name,
                bool throwOnMissing
                )
            {
                CheckDisposed();
                CheckReadOnly();

                if (key == null)
                    return;

                if (!whatIf)
                    key.DeleteValue(name, throwOnMissing);
            }

            ///////////////////////////////////////////////////////////////////

            public string[] GetSubKeyNames()
            {
                CheckDisposed();

                if (key == null)
                    return null;

                return key.GetSubKeyNames();
            }

            ///////////////////////////////////////////////////////////////////

            public object GetValue(
                string name,
                object defaultValue
                )
            {
                CheckDisposed();

                if (key == null)
                    return null;

                return key.GetValue(name, defaultValue);
            }

            ///////////////////////////////////////////////////////////////////

            public string[] GetValueNames()
            {
                CheckDisposed();

                if (key == null)
                    return null;

                return key.GetValueNames();
            }

            ///////////////////////////////////////////////////////////////////

            public MockRegistryKey OpenSubKey(
                string subKeyName
                )
            {
                CheckDisposed();

                return OpenSubKey(subKeyName, false);
            }

            ///////////////////////////////////////////////////////////////////

            public MockRegistryKey OpenSubKey(
                string subKeyName,
                bool writable
                )
            {
                CheckDisposed();

                if (writable)
                    CheckReadOnly();

                if (key == null)
                    return null;

                RegistryKey subKey = key.OpenSubKey(
                    subKeyName, whatIf ? false : writable);

                if (subKey == null)
                    return null;

                return new MockRegistryKey(subKey, whatIf, readOnly, safe);
            }

            ///////////////////////////////////////////////////////////////////

            public void SetValue(
                string name,
                object value
                )
            {
                CheckDisposed();
                CheckReadOnly();

                if (key == null)
                    return;

                if (!whatIf)
                    key.SetValue(name, value);
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Properties
            public string Name
            {
                get
                {
                    CheckDisposed();

                    if (key == null)
                        return null;

                    return !String.IsNullOrEmpty(subKeyName) ?
                        RegistryHelper.JoinKeyNames(key.Name, subKeyName) :
                        key.Name;
                }
            }

            ///////////////////////////////////////////////////////////////////

            private RegistryKey key;
            public RegistryKey Key
            {
                get { CheckDisposed(); CheckSafe(); return key; }
            }

            ///////////////////////////////////////////////////////////////////

            private string subKeyName;
            public string SubKeyName
            {
                get { CheckDisposed(); return subKeyName; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool whatIf;
            public bool WhatIf
            {
                get { CheckDisposed(); return whatIf; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool readOnly;
            public bool ReadOnly
            {
                get { CheckDisposed(); return readOnly; }
            }

            ///////////////////////////////////////////////////////////////////

            public bool safe;
            public bool Safe
            {
                get { CheckDisposed(); return safe; }
            }

            ///////////////////////////////////////////////////////////////////

            public bool noClose;
            public bool NoClose
            {
                get { CheckDisposed(); return noClose; }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Private Methods
            private void CheckReadOnly()
            {
                //
                // NOTE: In "read-only" mode, we disallow all write access.
                //
                if (!readOnly)
                    return;

                throw new InvalidOperationException();
            }

            ///////////////////////////////////////////////////////////////////

            private void CheckSafe()
            {
                //
                // NOTE: In "safe" mode, we disallow all direct access to the
                //       contained registry key.
                //
                if (!safe)
                    return;

                throw new InvalidOperationException();
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region System.Object Overrides
            public override string ToString()
            {
                CheckDisposed();

                return this.Name;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Static Methods
            public static bool NameEquals(
                string name1,
                string name2
                )
            {
                return String.Equals(
                    name1, name2, StringComparison.OrdinalIgnoreCase);
            }

            ///////////////////////////////////////////////////////////////////

            public static bool ValueEquals(
                object value1,
                object value2
                )
            {
                if ((value1 == null) || (value2 == null))
                    return ((value1 == null) && (value2 == null));

                if (Object.ReferenceEquals(value1, value2))
                    return true;

                Type type1 = value1.GetType();
                Type type2 = value2.GetType();

                if (!Object.ReferenceEquals(type1, type2))
                    return false;

                if (type1 == typeof(int)) // DWord
                {
                    return ((int)value1 == (int)value2);
                }
                else if (type1 == typeof(long)) // QWord
                {
                    return ((long)value1 == (long)value2);
                }
                else if (type1 == typeof(string)) // String / ExpandString
                {
                    return String.Equals(
                        (string)value1, (string)value2,
                        StringComparison.Ordinal);
                }
                else if (type1 == typeof(string[])) // MultiString
                {
                    string[] array1 = (string[])value1;
                    string[] array2 = (string[])value2;

                    int length1 = array1.Length;

                    if (length1 != array2.Length)
                        return false;

                    for (int index1 = 0; index1 < length1; index1++)
                    {
                        if (!String.Equals(
                                array1[index1], array2[index1],
                                StringComparison.Ordinal))
                        {
                            return false;
                        }
                    }

                    return true;
                }
                else if (type1 == typeof(byte[])) // Binary
                {
                    byte[] array1 = (byte[])value1;
                    byte[] array2 = (byte[])value2;

                    int length1 = array1.Length;

                    if (length1 != array2.Length)
                        return false;

                    for (int index1 = 0; index1 < length1; index1++)
                        if (array1[index1] != array2[index1])
                            return false;

                    return true;
                }

                return false;
            }

            ///////////////////////////////////////////////////////////////////

            public static int ValueHashCode(
                object value
                )
            {
                int result = 0;

                if (value != null)
                {
                    Type type = value.GetType();

                    if ((type == typeof(int)) || // DWord
                        (type == typeof(long)) || // QWord
                        (type == typeof(string))) // String / ExpandString
                    {
                        result = value.GetHashCode();
                    }
                    else if ((type == typeof(string[])) || // MultiString
                        (type == typeof(byte[]))) // Binary
                    {
                        Array array = (Array)value;
                        int length = array.Length;

                        for (int index = 0; index < length; index++)
                        {
                            object element = array.GetValue(index);

                            if (element == null)
                                continue;

                            result ^= element.GetHashCode();
                        }
                    }
                }

                return result;
            }

            ///////////////////////////////////////////////////////////////////

            public static string ValueToString(
                object value,
                string delimiter,
                string nullValue
                )
            {
                string result = null;

                if (value != null)
                {
                    Type type = value.GetType();

                    if ((type == typeof(int)) || // DWord
                        (type == typeof(long)) || // QWord
                        (type == typeof(string))) // String / ExpandString
                    {
                        result = value.ToString();
                    }
                    else if ((type == typeof(string[])) || // MultiString
                        (type == typeof(byte[]))) // Binary
                    {
                        StringBuilder builder = new StringBuilder();
                        Array array = (Array)value;
                        int length = array.Length;

                        for (int index = 0; index < length; index++)
                        {
                            if ((index > 0) && (delimiter != null))
                                builder.Append(delimiter);

                            object element = array.GetValue(index);

                            if (element == null)
                            {
                                if (nullValue != null)
                                    builder.Append(nullValue);

                                continue;
                            }

                            builder.Append(element.ToString());
                        }

                        result = builder.ToString();
                    }
                }

                return result;
            }

            ///////////////////////////////////////////////////////////////////

            public static bool Equals(
                MockRegistryKey key1,
                MockRegistryKey key2
                )
            {
                if ((key1 == null) || (key2 == null))
                    return ((key1 == null) && (key2 == null));

                if (Object.ReferenceEquals(key1, key2))
                    return true;

                return NameEquals(key1.Name, key2.Name);
            }

            ///////////////////////////////////////////////////////////////////

            public static int GetHashCode(
                MockRegistryKey key
                )
            {
                if (key != null)
                {
                    string name = key.Name;

                    if (name != null)
                        return name.GetHashCode();
                }

                return 0;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Implicit Conversion Operators
            //
            // BUGBUG: Remove me?  This should be safe because in "what-if"
            //         mode all keys are opened read-only.
            //
            public static implicit operator RegistryKey(
                MockRegistryKey key
                )
            {
                return (key != null) ? key.Key : null;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region IDisposable "Pattern" Members
            private bool disposed;
            private void CheckDisposed() /* throw */
            {
                if (!disposed)
                    return;

                throw new ObjectDisposedException(
                    typeof(MockRegistryKey).Name);
            }

            ///////////////////////////////////////////////////////////////////

            private /* protected virtual */ void Dispose(
                bool disposing
                )
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        if (key != null)
                        {
                            if (!noClose)
                                key.Close();

                            key = null;
                        }
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////

                    //
                    // NOTE: This object is now disposed.
                    //
                    disposed = true;
                }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region IDisposable Members
            public void Dispose()
            {
                Dispose(true);
                GC.SuppressFinalize(this);
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Destructor
            ~MockRegistryKey()
            {
                Dispose(false);
            }
            #endregion
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region RegistryRootKeyNames Class
        private static class RegistryRootKeyNames
        {
            public const string HKEY_CLASSES_ROOT = "HKEY_CLASSES_ROOT";
            public const string HKCR = "HKCR";

            ///////////////////////////////////////////////////////////////////

            public const string HKEY_CURRENT_CONFIG = "HKEY_CURRENT_CONFIG";
            public const string HKCC = "HKCC";

            ///////////////////////////////////////////////////////////////////

            public const string HKEY_CURRENT_USER = "HKEY_CURRENT_USER";
            public const string HKCU = "HKCU";

            ///////////////////////////////////////////////////////////////////

            public const string HKEY_DYN_DATA = "HKEY_DYN_DATA";
            public const string HKDD = "HKDD";

            ///////////////////////////////////////////////////////////////////

            public const string HKEY_LOCAL_MACHINE = "HKEY_LOCAL_MACHINE";
            public const string HKLM = "HKLM";

            ///////////////////////////////////////////////////////////////////

            public const string HKEY_PERFORMANCE_DATA = "HKEY_PERFORMANCE_DATA";
            public const string HKPD = "HKPD";

            ///////////////////////////////////////////////////////////////////

            public const string HKEY_USERS = "HKEY_USERS";
            public const string HKU = "HKU";
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region RegistryHelper Class
        #region Private Constants
        private const char KeyNameSeparator = '\\';

        ///////////////////////////////////////////////////////////////////////

        private static readonly char[] KeyNameSeparators = {
            KeyNameSeparator
        };
        #endregion

        ///////////////////////////////////////////////////////////////////////

        private static class RegistryHelper
        {
            #region Private Data
            //
            // NOTE: This is used to synchronize access to the list of logged
            //       write operations (just below).
            //
            private static object syncRoot = new object();

            //
            // NOTE: This is the list of registry write operations when it is
            //       set to non-null.
            //
            private static RegistryOperationList operationList;
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Static Properties
            private static MockRegistry readOnlyRegistry;
            public static MockRegistry ReadOnlyRegistry
            {
                get { return readOnlyRegistry; }
            }

            ///////////////////////////////////////////////////////////////////

            private static MockRegistry readWriteRegistry;
            public static MockRegistry ReadWriteRegistry
            {
                get { return readWriteRegistry; }
            }

            ///////////////////////////////////////////////////////////////////

            private static int subKeysCreated;
            public static int SubKeysCreated
            {
                get { return subKeysCreated; }
            }

            ///////////////////////////////////////////////////////////////////

            private static int subKeysDeleted;
            public static int SubKeysDeleted
            {
                get { return subKeysDeleted; }
            }

            ///////////////////////////////////////////////////////////////////

            private static int keyValuesRead;
            public static int KeyValuesRead
            {
                get { return keyValuesRead; }
            }

            ///////////////////////////////////////////////////////////////////

            private static int keyValuesWritten;
            public static int KeyValuesWritten
            {
                get { return keyValuesWritten; }
            }

            ///////////////////////////////////////////////////////////////////

            private static int keyValuesDeleted;
            public static int KeyValuesDeleted
            {
                get { return keyValuesDeleted; }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Static Methods
            public static void EnableOrDisableOperationList(
                bool enable
                )
            {
                lock (syncRoot) /* TRANSACTIONAL */
                {
                    if (enable)
                    {
                        if (operationList == null)
                            operationList = new RegistryOperationList();
                    }
                    else if (operationList != null)
                    {
                        operationList.Dispose();
                        operationList = null;
                    }
                }
            }

            ///////////////////////////////////////////////////////////////////

            public static void ReinitializeDefaultRegistries(
                bool whatIf,
                bool safe
                )
            {
                if (readOnlyRegistry != null)
                {
                    readOnlyRegistry.Dispose();
                    readOnlyRegistry = null;
                }

                if (readWriteRegistry != null)
                {
                    readWriteRegistry.Dispose();
                    readWriteRegistry = null;
                }

                readOnlyRegistry = new MockRegistry(whatIf, true, safe);
                readWriteRegistry = new MockRegistry(whatIf, false, safe);
            }

            ///////////////////////////////////////////////////////////////////

            public static MockRegistryKey GetReadOnlyRootKey(
                string name
                )
            {
                return GetRootKey(readOnlyRegistry, name);
            }

            ///////////////////////////////////////////////////////////////////

            public static MockRegistryKey GetReadWriteRootKey(
                string name
                )
            {
                return GetRootKey(readWriteRegistry, name);
            }

            ///////////////////////////////////////////////////////////////////

            public static MockRegistryKey GetRootKey(
                MockRegistry registry,
                string name
                )
            {
                if (registry == null)
                    return null;

                if (MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKEY_CLASSES_ROOT) ||
                    MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKCR))
                {
                    return registry.ClassesRoot;
                }
                else if (MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKEY_CURRENT_CONFIG) ||
                    MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKCC))
                {
                    return registry.CurrentConfig;
                }
                else if (MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKEY_CURRENT_USER) ||
                    MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKCU))
                {
                    return registry.CurrentUser;
                }
                else if (MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKEY_DYN_DATA) ||
                    MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKDD))
                {
                    return registry.DynData;
                }
                else if (MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKEY_LOCAL_MACHINE) ||
                    MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKLM))
                {
                    return registry.LocalMachine;
                }
                else if (MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKEY_PERFORMANCE_DATA) ||
                    MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKPD))
                {
                    return registry.PerformanceData;
                }
                else if (MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKEY_USERS) ||
                    MockRegistryKey.NameEquals(
                        name, RegistryRootKeyNames.HKU))
                {
                    return registry.Users;
                }

                return null;
            }

            ///////////////////////////////////////////////////////////////////

            public static string JoinKeyNames(
                params string[] names
                )
            {
                if ((names == null) || (names.Length == 0))
                    return null;

                StringBuilder builder = new StringBuilder();

                foreach (string name in names)
                {
                    if (name == null)
                        continue;

                    string newName = name.Trim(KeyNameSeparator);

                    if (String.IsNullOrEmpty(newName))
                        continue;

                    if (builder.Length > 0)
                        builder.Append(KeyNameSeparator);

                    builder.Append(newName);
                }

                return builder.ToString();
            }

            ///////////////////////////////////////////////////////////////////

            public static string JoinKeyNames(
                MockRegistryKey key,
                params string[] names
                )
            {
                string result = JoinKeyNames(names);

                if (key != null)
                    result = JoinKeyNames(key.Name, result);

                return result;
            }

            ///////////////////////////////////////////////////////////////////

            public static string[] SplitKeyName(
                string keyName
                )
            {
                if (keyName == null)
                    return null;

                return keyName.Split(
                    KeyNameSeparators, StringSplitOptions.RemoveEmptyEntries);
            }

            ///////////////////////////////////////////////////////////////////

            public static string LastSubKeyName(
                string keyName
                )
            {
                string[] subKeyNames = SplitKeyName(keyName);

                if ((subKeyNames == null) || (subKeyNames.Length == 0))
                    return null;

                return subKeyNames[subKeyNames.Length - 1];
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static MockRegistryKey OpenSubKey(
                MockRegistryKey rootKey,
                string subKeyName,
                bool writable,
                bool whatIf,
                bool verbose
                )
            {
                if (verbose)
                {
                    TraceOps.DebugAndTrace(writable ?
                        TracePriority.Highest : TracePriority.Higher,
                        debugCallback, traceCallback, String.Format(
                        "rootKey = {0}, subKeyName = {1}, writable = {2}",
                        ForDisplay(rootKey), ForDisplay(subKeyName),
                        ForDisplay(writable)), traceCategory);
                }

                if (rootKey == null)
                    return null;

                //
                // HACK: Always forbid writable access when operating in
                //       "what-if" mode.
                //
                MockRegistryKey key = rootKey.OpenSubKey(
                    subKeyName, whatIf ? false : writable);

                return (key != null) ?
                    new MockRegistryKey(key, whatIf, false, false) : null;
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static MockRegistryKey CreateSubKey(
                MockRegistryKey rootKey,
                string subKeyName,
                bool whatIf,
                bool verbose
                )
            {
                if (verbose)
                {
                    TraceOps.DebugAndTrace(TracePriority.Highest,
                        debugCallback, traceCallback, String.Format(
                        "rootKey = {0}, subKeyName = {1}",
                        ForDisplay(rootKey), ForDisplay(subKeyName)),
                        traceCategory);
                }

                if (rootKey == null)
                    return null;

                try
                {
                    //
                    // HACK: Always open a key, rather than creating one when
                    //       operating in "what-if" mode.
                    //
                    if (whatIf)
                    {
                        //
                        // HACK: Attempt to open the specified sub-key.  If
                        //       this fails, we will simply return the root
                        //       key itself since no writes are allowed in
                        //       "what-if" mode anyhow.
                        //
                        MockRegistryKey key = rootKey.OpenSubKey(subKeyName);

                        if (key != null)
                            return key;

                        //
                        // BUGFIX: The registry key we are supposed to create
                        //         does not exist and we cannot create it since
                        //         this is "what-if" mode.  The problem here is
                        //         this will have a "side-effect" of discarding
                        //         any sub-key name value from within the root
                        //         key specified by the caller (and then passed
                        //         to the MockRegistryKey constructor).  Since
                        //         we still want to use that registry key, we
                        //         need to migrate that sub-key name from the
                        //         root key, by combining it with the sub-key
                        //         name specified by the caller and use the new
                        //         combined sub-key name for the constructor.
                        //
                        string newSubKeyName = subKeyName;

                        AdjustSubKeyNameForWhatIf(rootKey, ref newSubKeyName);

                        return new MockRegistryKey(
                            rootKey, newSubKeyName, whatIf, false, false);
                    }
                    else
                    {
                        return new MockRegistryKey(
                            rootKey.CreateSubKey(subKeyName), whatIf, false,
                            false);
                    }
                }
                finally
                {
                    MaybeLogOperation(GetMethodName(), rootKey, subKeyName);

                    subKeysCreated++;
                }
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static void DeleteSubKey(
                MockRegistryKey rootKey,
                string subKeyName,
                bool throwOnMissing,
                bool whatIf,
                bool verbose
                )
            {
                if (verbose)
                {
                    TraceOps.DebugAndTrace(TracePriority.Highest,
                        debugCallback, traceCallback, String.Format(
                        "rootKey = {0}, subKeyName = {1}",
                        ForDisplay(rootKey), ForDisplay(subKeyName)),
                        traceCategory);
                }

                if (rootKey == null)
                    return;

                if (!whatIf)
                    rootKey.DeleteSubKey(subKeyName, throwOnMissing);

                MaybeLogOperation(GetMethodName(), rootKey, subKeyName);

                subKeysDeleted++;
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static void DeleteSubKeyTree(
                MockRegistryKey rootKey,
                string subKeyName,
                bool whatIf,
                bool verbose
                )
            {
                if (verbose)
                {
                    TraceOps.DebugAndTrace(TracePriority.Highest,
                        debugCallback, traceCallback, String.Format(
                        "rootKey = {0}, subKeyName = {1}",
                        ForDisplay(rootKey), ForDisplay(subKeyName)),
                        traceCategory);
                }

                if (rootKey == null)
                    return;

                if (!whatIf)
                    rootKey.DeleteSubKeyTree(subKeyName);

                MaybeLogOperation(GetMethodName(), rootKey, subKeyName);

                subKeysDeleted++;
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static string[] GetSubKeyNames(
                MockRegistryKey key,
                bool whatIf,
                bool verbose
                )
            {
                if (verbose)
                {
                    TraceOps.DebugAndTrace(TracePriority.High,
                        debugCallback, traceCallback, String.Format(
                        "key = {0}", ForDisplay(key)), traceCategory);
                }

                if (key == null)
                    return null;

                return key.GetSubKeyNames();
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static object GetValue(
                MockRegistryKey key,
                string name,
                object defaultValue,
                bool whatIf,
                bool verbose
                )
            {
                if (verbose)
                {
                    TraceOps.DebugAndTrace(TracePriority.High,
                        debugCallback, traceCallback, String.Format(
                        "key = {0}, name = {1}, defaultValue = {2}",
                        ForDisplay(key), ForDisplay(name),
                        ForDisplay(defaultValue)), traceCategory);
                }

                if (key == null)
                    return null;

                object value = key.GetValue(name, defaultValue);

                keyValuesRead++;

                return value;
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static void SetValue(
                MockRegistryKey key,
                string name,
                object value,
                bool whatIf,
                bool verbose
                )
            {
                if (verbose)
                {
                    TraceOps.DebugAndTrace(TracePriority.Highest,
                        debugCallback, traceCallback, String.Format(
                        "key = {0}, name = {1}, value = {2}",
                        ForDisplay(key), ForDisplay(name), ForDisplay(value)),
                        traceCategory);
                }

                if (key == null)
                    return;

                if (!whatIf)
                    key.SetValue(name, value);

                MaybeLogOperation(GetMethodName(), key, name, value);

                keyValuesWritten++;
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static void DeleteValue(
                MockRegistryKey key,
                string name,
                bool throwOnMissing,
                bool whatIf,
                bool verbose
                )
            {
                if (verbose)
                {
                    TraceOps.DebugAndTrace(TracePriority.Highest,
                        debugCallback, traceCallback, String.Format(
                        "key = {0}, name = {1}", ForDisplay(key),
                        ForDisplay(name)), traceCategory);
                }

                if (key == null)
                    return;

                if (!whatIf)
                    key.DeleteValue(name, throwOnMissing);

                MaybeLogOperation(GetMethodName(), key, name, null);

                keyValuesDeleted++;
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static int WriteOperationList(
                string fileName,
                bool header,
                bool verbose
                )
            {
                int count = 0;

                if (String.IsNullOrEmpty(fileName))
                {
                    if (verbose)
                    {
                        TraceOps.DebugAndTrace(TracePriority.Highest,
                            debugCallback, traceCallback,
                            "Operation log file name not set.",
                            traceCategory);
                    }

                    return count;
                }

                lock (syncRoot) /* TRANSACTIONAL */
                {
                    if (operationList == null)
                    {
                        if (verbose)
                        {
                            TraceOps.DebugAndTrace(TracePriority.Highest,
                                debugCallback, traceCallback,
                                "Operation list is invalid.",
                                traceCategory);
                        }

                        return count;
                    }

                    using (StreamWriter streamWriter = new StreamWriter(
                            fileName))
                    {
                        if (header)
                        {
                            streamWriter.WriteLine(
                                RegistryOperation.GetHeaderLine());
                        }

                        foreach (RegistryOperation operation in operationList)
                        {
                            if (operation == null)
                                continue;

                            streamWriter.WriteLine(operation.ToString());
                            count++;
                        }

                        streamWriter.Flush();
                    }
                }

                if (verbose)
                {
                    TraceOps.DebugAndTrace(TracePriority.Highest,
                        debugCallback, traceCallback, String.Format(
                        "Wrote {0} operations to log file.",
                        count), traceCategory);
                }

                return count;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Private Static Methods
            private static void AdjustSubKeyNameForWhatIf(
                MockRegistryKey rootKey,
                ref string subKeyName
                )
            {
                if (rootKey == null)
                    return;

                string rootKeySubKeyName = rootKey.SubKeyName;

                if (rootKeySubKeyName == null)
                    return;

                subKeyName = (subKeyName != null) ?
                    JoinKeyNames(rootKeySubKeyName, subKeyName) :
                    rootKeySubKeyName;
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            private static string GetMethodName()
            {
                return TraceOps.GetMethodName(null, 1);
            }

            ///////////////////////////////////////////////////////////////////

            private static void MaybeLogOperation(
                string methodName,
                MockRegistryKey key,
                string subKeyName
                )
            {
                MaybeLogOperation(methodName, key, subKeyName, null, null);
            }

            ///////////////////////////////////////////////////////////////////

            private static void MaybeLogOperation(
                string methodName,
                MockRegistryKey key,
                string valueName,
                object value
                )
            {
                MaybeLogOperation(methodName, key, null, valueName, value);
            }

            ///////////////////////////////////////////////////////////////////

            private static void MaybeLogOperation(
                string methodName,
                MockRegistryKey key,
                string subKeyName,
                string valueName,
                object value
                )
            {
                lock (syncRoot) /* TRANSACTIONAL */
                {
                    if (operationList == null)
                        return;

                    if (methodName != null)
                    {
                        string typePrefix = String.Format(
                            "{0}{1}", typeof(RegistryHelper).Name,
                            Type.Delimiter);

                        if (methodName.StartsWith(
                                typePrefix, StringComparison.Ordinal))
                        {
                            methodName = methodName.Substring(
                                typePrefix.Length);
                        }
                    }

                    operationList.Add(new RegistryOperation(
                        methodName, key, subKeyName, valueName, value));
                }
            }
            #endregion
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region RegistryOperationList Class
        [Serializable()]
        private sealed class RegistryOperationList :
            List<RegistryOperation>, IDisposable
        {
            #region Public Constructors
            public RegistryOperationList()
            {
                // do nothing.
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region IDisposable "Pattern" Members
            private bool disposed;
            private void CheckDisposed() /* throw */
            {
                if (!disposed)
                    return;

                throw new ObjectDisposedException(
                    typeof(RegistryOperationList).Name);
            }

            ///////////////////////////////////////////////////////////////////

            private /* protected virtual */ void Dispose(
                bool disposing
                )
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        foreach (RegistryOperation operation in this)
                        {
                            if (operation == null)
                                continue;

                            operation.Dispose();
                        }

                        Clear();
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////

                    //
                    // NOTE: This object is now disposed.
                    //
                    disposed = true;
                }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region IDisposable Members
            public void Dispose()
            {
                Dispose(true);
                GC.SuppressFinalize(this);
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Destructor
            ~RegistryOperationList()
            {
                Dispose(false);
            }
            #endregion
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region RegistryOperation Class
        private sealed class RegistryOperation
        {
            #region Private Constants
            private const char FieldDelimiter = '\t';
            private const string ListElementDelimiter = ", ";
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Constructors
            public RegistryOperation(
                string methodName,
                MockRegistryKey key,
                string subKeyName,
                string valueName,
                object value
                )
            {
                this.methodName = methodName;
                this.subKeyName = subKeyName;
                this.valueName = valueName;
                this.value = value;

                SetKey(key);
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Private Methods
            private void SetKey(
                MockRegistryKey key
                )
            {
                if (key != null)
                {
                    //
                    // NOTE: Make sure this copy of the root registry key
                    //       cannot be used to accidentally make registry
                    //       changes.  Also, prevent this MockRegistryKey
                    //       object from closing its underlying registry
                    //       key as we will need it later.  This instance
                    //       will close it.
                    //
                    this.key = key.Clone(true, true, true);

                    key.DisableClose();
                }
                else
                {
                    this.key = null;
                }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Properties
            private string methodName;
            public string MethodName
            {
                get { CheckDisposed(); return methodName; }
            }

            ///////////////////////////////////////////////////////////////////

            private MockRegistryKey key;
            public MockRegistryKey Key
            {
                get { CheckDisposed(); return key; }
            }

            ///////////////////////////////////////////////////////////////////

            private string subKeyName;
            public string SubKeyName
            {
                get { CheckDisposed(); return subKeyName; }
            }

            ///////////////////////////////////////////////////////////////////

            private string valueName;
            public string ValueName
            {
                get { CheckDisposed(); return valueName; }
            }

            ///////////////////////////////////////////////////////////////////

            private object value;
            public object Value
            {
                get { CheckDisposed(); return value; }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Static Methods
            public static string GetHeaderLine()
            {
                StringBuilder builder = new StringBuilder();

                builder.Append("MethodName");
                builder.Append(FieldDelimiter);
                builder.Append("Key");
                builder.Append(FieldDelimiter);
                builder.Append("SubKeyName");
                builder.Append(FieldDelimiter);
                builder.Append("ValueName");
                builder.Append(FieldDelimiter);
                builder.Append("Value");

                return builder.ToString();
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region System.Object Overrides
            public override string ToString()
            {
                CheckDisposed();

                StringBuilder builder = new StringBuilder();

                builder.Append(ForDisplay(methodName));
                builder.Append(FieldDelimiter);
                builder.Append(ForDisplay(key));
                builder.Append(FieldDelimiter);
                builder.Append(ForDisplay(subKeyName));
                builder.Append(FieldDelimiter);
                builder.Append(ForDisplay(valueName));
                builder.Append(FieldDelimiter);

                builder.Append(ForDisplay(MockRegistryKey.ValueToString(
                    value, ListElementDelimiter, DisplayNull)));

                return builder.ToString();
            }

            ///////////////////////////////////////////////////////////////////

            public override bool Equals(
                object obj
                )
            {
                CheckDisposed();

                RegistryOperation operation = obj as RegistryOperation;

                if (operation == null)
                    return false;

                if (!String.Equals(operation.methodName, methodName))
                    return false;

                if (!MockRegistryKey.Equals(operation.key, key))
                    return false;

                if (!MockRegistryKey.NameEquals(
                        operation.subKeyName, subKeyName))
                {
                    return false;
                }

                if (!String.Equals(operation.valueName, valueName))
                    return false;

                if (!MockRegistryKey.ValueEquals(operation.value, value))
                    return false;

                return true;
            }

            ///////////////////////////////////////////////////////////////////

            public override int GetHashCode()
            {
                CheckDisposed();

                int result = 0;

                if (methodName != null)
                    result ^= methodName.GetHashCode();

                result ^= MockRegistryKey.GetHashCode(key);

                if (subKeyName != null)
                    result ^= subKeyName.GetHashCode();

                if (valueName != null)
                    result ^= valueName.GetHashCode();

                result ^= MockRegistryKey.ValueHashCode(value);

                return result;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region IDisposable "Pattern" Members
            private bool disposed;
            private void CheckDisposed() /* throw */
            {
                if (!disposed)
                    return;

                throw new ObjectDisposedException(
                    typeof(RegistryOperation).Name);
            }

            ///////////////////////////////////////////////////////////////////

            private /* protected virtual */ void Dispose(
                bool disposing
                )
            {
                if (!disposed)
                {
                    if (disposing)
                    {
                        ////////////////////////////////////
                        // dispose managed resources here...
                        ////////////////////////////////////

                        if (key != null)
                        {
                            key.Close();
                            key = null;
                        }
                    }

                    //////////////////////////////////////
                    // release unmanaged resources here...
                    //////////////////////////////////////

                    //
                    // NOTE: This object is now disposed.
                    //
                    disposed = true;
                }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region IDisposable Members
            public void Dispose()
            {
                Dispose(true);
                GC.SuppressFinalize(this);
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Destructor
            ~RegistryOperation()
            {
                Dispose(false);
            }
            #endregion
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region StringList Class
        private sealed class StringList : List<string>
        {
            public StringList()
                : base()
            {
                // do nothing.
            }

            ///////////////////////////////////////////////////////////////////

            public StringList(IEnumerable<string> collection)
                : base(collection)
            {
                // do nothing.
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region StringDictionary Class
        private sealed class StringDictionary : Dictionary<string, string>
        {
            public StringDictionary()
            {
                // do nothing.
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region VersionList Class
        private sealed class VersionList : List<Version>
        {
            public VersionList()
                : base()
            {
                // do nothing.
            }

            ///////////////////////////////////////////////////////////////////

            public VersionList(IEnumerable<Version> collection)
                : base(collection)
            {
                // do nothing.
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region VersionMap Class
        private sealed class VersionMap : Dictionary<string, VersionList>
        {
            public VersionMap()
            {
                // do nothing.
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Package Class
        internal sealed class Package
        {
            #region Public Constructors
            public Package()
            {
                // do nothing.
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Properties
            private string providerInvariantName;
            public string ProviderInvariantName
            {
                get { return providerInvariantName; }
                set { providerInvariantName = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private string factoryTypeName;
            public string FactoryTypeName
            {
                get { return factoryTypeName; }
                set { factoryTypeName = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private AssemblyName providerAssemblyName;
            public AssemblyName ProviderAssemblyName
            {
                get { return providerAssemblyName; }
                set { providerAssemblyName = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private AssemblyName designerAssemblyName;
            public AssemblyName DesignerAssemblyName
            {
                get { return designerAssemblyName; }
                set { designerAssemblyName = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool globalAssemblyCache;
            public bool GlobalAssemblyCache
            {
                get { return globalAssemblyCache; }
                set { globalAssemblyCache = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private Guid packageId;
            public Guid PackageId
            {
                get { return packageId; }
                set { packageId = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private Guid serviceId;
            public Guid ServiceId
            {
                get { return serviceId; }
                set { serviceId = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private Guid dataSourceId;
            public Guid DataSourceId
            {
                get { return dataSourceId; }
                set { dataSourceId = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private Guid dataProviderId;
            public Guid DataProviderId
            {
                get { return dataProviderId; }
                set { dataProviderId = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private Guid adoNetTechnologyId;
            public Guid AdoNetTechnologyId
            {
                get { return adoNetTechnologyId; }
                set { adoNetTechnologyId = value; }
            }
            #endregion
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Configuration Class
        private sealed class Configuration
        {
            #region Private Constants
            private const char Switch = '-';
            private const char AltSwitch = '/';

            ///////////////////////////////////////////////////////////////////

            private static readonly char[] SwitchChars = {
                Switch, AltSwitch
            };

            ///////////////////////////////////////////////////////////////////

            private const string InvariantName = "System.Data.SQLite";
            private const string Ef6InvariantName = "System.Data.SQLite.EF6";

            ///////////////////////////////////////////////////////////////////

            private const string FactoryTypeName =
                "System.Data.SQLite.SQLiteFactory";

            private const string Ef6FactoryTypeName =
                "System.Data.SQLite.EF6.SQLiteProviderFactory";
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Private Static Data
            private static Assembly systemEf6Assembly;
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Private Data
            private AssemblyName coreAssemblyName;
            private AssemblyName linqAssemblyName;
            private AssemblyName ef6AssemblyName;
            private AssemblyName designerAssemblyName;
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Private Constructors
            private Configuration(
                Assembly assembly,
                string logFileName,
                string registryLogFileName,
                string directory,
                string coreFileName,
                string linqFileName,
                string ef6FileName,
                string designerFileName,
                string registryVersion,
                string configVersion,
                string vsVersionSuffix,
                string debugFormat,
                string traceFormat,
                InstallFlags installFlags,
                ProviderFlags providerFlags,
                TracePriority debugPriority,
                TracePriority tracePriority,
                bool perUser,
                bool install,
                bool wow64,
                bool noRuntimeVersion,
                bool noDesktop,
                bool noCompact,
                bool noNetFx20,
                bool noNetFx35,
                bool noNetFx40,
                bool noNetFx45,
                bool noNetFx451,
                bool noNetFx452,
                bool noNetFx46,
                bool noNetFx461,
                bool noNetFx462,
                bool noNetFx47,
                bool noNetFx471,
                bool noNetFx472,
                bool noNetFx48,
                bool noVs2005,
                bool noVs2008,
                bool noVs2010,
                bool noVs2012,
                bool noVs2013,
                bool noVs2015,
                bool noVs2017,
                bool noTrace,
                bool noConsole,
                bool noLog,
                bool throwOnMissing,
                bool whatIf,
                bool debug,
                bool verbose,
                bool confirm
                )
            {
                this.assembly = assembly;
                this.logFileName = logFileName;
                this.registryLogFileName = registryLogFileName;
                this.directory = directory;
                this.coreFileName = coreFileName;
                this.linqFileName = linqFileName;
                this.ef6FileName = ef6FileName;
                this.designerFileName = designerFileName;
                this.registryVersion = registryVersion;
                this.configVersion = configVersion;
                this.vsVersionSuffix = vsVersionSuffix;
                this.debugFormat = debugFormat;
                this.traceFormat = traceFormat;
                this.installFlags = installFlags;
                this.providerFlags = providerFlags;
                this.debugPriority = debugPriority;
                this.tracePriority = tracePriority;
                this.perUser = perUser;
                this.install = install;
                this.wow64 = wow64;
                this.noRuntimeVersion = noRuntimeVersion;
                this.noDesktop = noDesktop;
                this.noCompact = noCompact;
                this.noNetFx20 = noNetFx20;
                this.noNetFx35 = noNetFx35;
                this.noNetFx40 = noNetFx40;
                this.noNetFx45 = noNetFx45;
                this.noNetFx451 = noNetFx451;
                this.noNetFx452 = noNetFx452;
                this.noNetFx46 = noNetFx46;
                this.noNetFx461 = noNetFx461;
                this.noNetFx462 = noNetFx462;
                this.noNetFx47 = noNetFx47;
                this.noNetFx471 = noNetFx471;
                this.noNetFx472 = noNetFx472;
                this.noNetFx48 = noNetFx48;
                this.noVs2005 = noVs2005;
                this.noVs2008 = noVs2008;
                this.noVs2010 = noVs2010;
                this.noVs2012 = noVs2012;
                this.noVs2013 = noVs2013;
                this.noVs2015 = noVs2015;
                this.noVs2017 = noVs2017;
                this.noTrace = noTrace;
                this.noConsole = noConsole;
                this.noLog = noLog;
                this.throwOnMissing = throwOnMissing;
                this.whatIf = whatIf;
                this.debug = debug;
                this.verbose = verbose;
                this.confirm = confirm;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Private Static Methods
            private static void GetDefaultFileNames(
                ref string directory,
                ref string coreFileName,
                ref string linqFileName,
                ref string ef6FileName,
                ref string designerFileName
                )
            {
                if (thisAssembly == null)
                    return;

                directory = Path.GetDirectoryName(thisAssembly.Location);

                if (String.IsNullOrEmpty(directory))
                    return;

                coreFileName = Path.Combine(directory,
                    Installer.CoreFileName);

                linqFileName = Path.Combine(directory,
                    Installer.LinqFileName);

                ef6FileName = Path.Combine(directory,
                    Installer.Ef6FileName);

                designerFileName = Path.Combine(directory,
                    Installer.DesignerFileName);
            }

            ///////////////////////////////////////////////////////////////////

            private static bool CheckOption(
                ref string arg
                )
            {
                string result = arg;

                if (!String.IsNullOrEmpty(result))
                {
                    //
                    // NOTE: Remove all leading switch chars.
                    //
                    result = result.TrimStart(SwitchChars);

                    //
                    // NOTE: How many chars were removed?
                    //
                    int count = arg.Length - result.Length;

                    //
                    // NOTE: Was there at least one?
                    //
                    if (count > 0)
                    {
                        //
                        // NOTE: Ok, replace their original
                        //       argument.
                        //
                        arg = result;

                        //
                        // NOTE: Yes, this is a switch.
                        //
                        return true;
                    }
                }

                return false;
            }

            ///////////////////////////////////////////////////////////////////

            private static bool MatchOption(
                string arg,
                string option
                )
            {
                if ((arg == null) || (option == null))
                    return false;

                return String.Compare(arg, 0, option, 0,
                    arg.Length, StringComparison.OrdinalIgnoreCase) == 0;
            }

            ///////////////////////////////////////////////////////////////////

            private static bool? ParseBoolean(
                string text
                )
            {
                if (!String.IsNullOrEmpty(text))
                {
                    bool value;

                    if (bool.TryParse(text, out value))
                        return value;
                }

                return null;
            }

            ///////////////////////////////////////////////////////////////////

            private static object ParseEnum(
                Type enumType,
                string text,
                bool noCase
                )
            {
                if ((enumType == null) || !enumType.IsEnum)
                    return null;

                if (!String.IsNullOrEmpty(text))
                {
                    try
                    {
                        return Enum.Parse(enumType, text, noCase);
                    }
                    catch
                    {
                        // do nothing.
                    }
                }

                return null;
            }

            ///////////////////////////////////////////////////////////////////

            private static bool IsSystemEf6AssemblyGlobal()
            {
                if (systemEf6Assembly == null)
                    return false;

                return systemEf6Assembly.GlobalAssemblyCache;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Static Methods
            public static void BreakIntoDebugger()
            {
                Console.WriteLine(
                    "Attach a debugger to process {0} and press " +
                    "any key to continue.", (thisProcess != null) ?
                    thisProcess.Id.ToString() : "<unknown>");

                try
                {
                    Console.ReadKey(true); /* throw */
                }
                catch (InvalidOperationException) // Console.ReadKey
                {
                    // do nothing.
                }

                Debugger.Break();
            }

            ///////////////////////////////////////////////////////////////////

            public static Configuration CreateDefault()
            {
                string directory = null;
                string coreFileName = null;
                string linqFileName = null;
                string ef6FileName = null;
                string designerFileName = null;

                GetDefaultFileNames(
                    ref directory, ref coreFileName, ref linqFileName,
                    ref ef6FileName, ref designerFileName);

                return new Configuration(
                    thisAssembly, null, null, directory, coreFileName,
                    linqFileName, ef6FileName, designerFileName, null, null,
                    null, TraceOps.DebugFormat, TraceOps.TraceFormat,
                    InstallFlags.Default, ProviderFlags.Default,
                    TracePriority.Default, TracePriority.Default, false, true,
                    false, false, false, false, false, false, false, false,
                    false, false, false, false, false, false, false, false,
                    false, false, false, false, false, false, false, false,
                    false, false, false, true, true, false, false, false);
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static bool FromArgs(
                string[] args,
                bool strict,
                ref Configuration configuration,
                ref string error
                )
            {
                try
                {
                    if (args == null)
                        return true;

                    if (configuration == null)
                        configuration = Configuration.CreateDefault();

                    int length = args.Length;

                    for (int index = 0; index < length; index++)
                    {
                        string arg = args[index];

                        //
                        // NOTE: Skip any argument that is null (?) or an empty
                        //       string.
                        //
                        if (String.IsNullOrEmpty(arg))
                            continue;

                        //
                        // NOTE: We are going to modify the original argument
                        //       by removing any leading option characters;
                        //       therefore, we use a new string to hold the
                        //       modified argument.
                        //
                        string newArg = arg;

                        //
                        // NOTE: All the supported command line options must
                        //       begin with an option character (e.g. a minus
                        //       or forward slash); attempt to validate that
                        //       now.  If we fail in strict mode, we are done;
                        //       otherwise, just skip this argument and advance
                        //       to the next one.
                        //
                        if (!CheckOption(ref newArg))
                        {
                            error = TraceOps.DebugAndTrace(
                                TracePriority.Lowest, debugCallback,
                                traceCallback, String.Format(
                                "Unsupported command line argument: {0}",
                                ForDisplay(arg)), traceCategory);

                            if (strict)
                                return false;

                            continue;
                        }

                        //
                        // NOTE: All the supported command line options must
                        //       have a value; therefore, attempt to advance
                        //       to it now.  If we fail, we are done.
                        //
                        index++;

                        if (index >= length)
                        {
                            error = TraceOps.DebugAndTrace(
                                TracePriority.Lowest, debugCallback,
                                traceCallback, String.Format(
                                "Missing value for option: {0}",
                                ForDisplay(arg)), traceCategory);

                            if (strict)
                                return false;

                            break;
                        }

                        //
                        // NOTE: Grab the textual value of this command line
                        //       option.
                        //
                        string text = args[index];

                        //
                        // NOTE: Figure out which command line option this is
                        //       (based on a partial name match) and then try
                        //       to interpret the textual value as the correct
                        //       type.
                        //
                        if (MatchOption(newArg, "break"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            if ((bool)value)
                                BreakIntoDebugger();
                        }
                        else if (MatchOption(newArg, "configVersion"))
                        {
                            configuration.configVersion = text;
                        }
                        else if (MatchOption(newArg, "confirm"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.confirm = (bool)value;
                        }
                        else if (MatchOption(newArg, "coreFileName"))
                        {
                            configuration.coreFileName = text;
                        }
                        else if (MatchOption(newArg, "debug"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.debug = (bool)value;
                        }
                        else if (MatchOption(newArg, "debugFormat"))
                        {
                            configuration.debugFormat = text;
                            TraceOps.DebugFormat = configuration.debugFormat;
                        }
                        else if (MatchOption(newArg, "debugPriority"))
                        {
                            object value = ParseEnum(
                                typeof(TracePriority), text, true);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.debugPriority = (TracePriority)value;
                            TraceOps.DebugPriority = configuration.debugPriority;
                        }
                        else if (MatchOption(newArg, "designerFileName"))
                        {
                            configuration.designerFileName = text;
                        }
                        else if (MatchOption(newArg, "directory"))
                        {
                            configuration.directory = text;

                            //
                            // NOTE: *SPECIAL* Must refresh the file names
                            //       here because the underlying directory
                            //       has changed.
                            //
                            string coreFileName = configuration.coreFileName;

                            if (!String.IsNullOrEmpty(coreFileName))
                                coreFileName = Path.GetFileName(coreFileName);

                            if (String.IsNullOrEmpty(coreFileName))
                                coreFileName = Installer.CoreFileName;

                            configuration.coreFileName = Path.Combine(
                                configuration.directory, coreFileName);

                            string linqFileName = configuration.linqFileName;

                            if (!String.IsNullOrEmpty(linqFileName))
                                linqFileName = Path.GetFileName(linqFileName);

                            if (String.IsNullOrEmpty(linqFileName))
                                linqFileName = Installer.LinqFileName;

                            configuration.linqFileName = Path.Combine(
                                configuration.directory, linqFileName);

                            string ef6FileName = configuration.ef6FileName;

                            if (!String.IsNullOrEmpty(ef6FileName))
                                ef6FileName = Path.GetFileName(ef6FileName);

                            if (String.IsNullOrEmpty(ef6FileName))
                                ef6FileName = Installer.Ef6FileName;

                            configuration.ef6FileName = Path.Combine(
                                configuration.directory, ef6FileName);

                            string designerFileName = configuration.designerFileName;

                            if (!String.IsNullOrEmpty(designerFileName))
                                designerFileName = Path.GetFileName(designerFileName);

                            if (String.IsNullOrEmpty(designerFileName))
                                designerFileName = Installer.DesignerFileName;

                            configuration.designerFileName = Path.Combine(
                                configuration.directory, designerFileName);
                        }
                        else if (MatchOption(newArg, "ef6FileName"))
                        {
                            configuration.ef6FileName = text;
                        }
                        else if (MatchOption(newArg, "install"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.install = (bool)value;
                        }
                        else if (MatchOption(newArg, "installFlags"))
                        {
                            object value = ParseEnum(
                                typeof(InstallFlags), text, true);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.installFlags = (InstallFlags)value;
                        }
                        else if (MatchOption(newArg, "linqFileName"))
                        {
                            configuration.linqFileName = text;
                        }
                        else if (MatchOption(newArg, "logFileName"))
                        {
                            configuration.logFileName = text;
                        }
                        else if (MatchOption(newArg, "noCompact"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noCompact = (bool)value;
                        }
                        else if (MatchOption(newArg, "noConsole"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noConsole = (bool)value;
                        }
                        else if (MatchOption(newArg, "noDesktop"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noDesktop = (bool)value;
                        }
                        else if (MatchOption(newArg, "noLog"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noLog = (bool)value;
                        }
                        else if (MatchOption(newArg, "noNetFx20"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noNetFx20 = (bool)value;
                        }
                        else if (MatchOption(newArg, "noNetFx35"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noNetFx35 = (bool)value;
                        }
                        else if (MatchOption(newArg, "noNetFx40"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noNetFx40 = (bool)value;
                        }
                        else if (MatchOption(newArg, "noNetFx45"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noNetFx45 = (bool)value;
                        }
                        else if (MatchOption(newArg, "noNetFx451"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noNetFx451 = (bool)value;
                        }
                        else if (MatchOption(newArg, "noNetFx452"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noNetFx452 = (bool)value;
                        }
                        else if (MatchOption(newArg, "noNetFx46"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noNetFx46 = (bool)value;
                        }
                        else if (MatchOption(newArg, "noNetFx461"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noNetFx461 = (bool)value;
                        }
                        else if (MatchOption(newArg, "noNetFx462"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noNetFx462 = (bool)value;
                        }
                        else if (MatchOption(newArg, "noNetFx47"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noNetFx47 = (bool)value;
                        }
                        else if (MatchOption(newArg, "noNetFx471"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noNetFx471 = (bool)value;
                        }
                        else if (MatchOption(newArg, "noNetFx472"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noNetFx472 = (bool)value;
                        }
                        else if (MatchOption(newArg, "noNetFx48"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noNetFx48 = (bool)value;
                        }
                        else if (MatchOption(newArg, "noRuntimeVersion"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noRuntimeVersion = (bool)value;
                        }
                        else if (MatchOption(newArg, "noTrace"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noTrace = (bool)value;
                        }
                        else if (MatchOption(newArg, "noVs2005"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noVs2005 = (bool)value;
                        }
                        else if (MatchOption(newArg, "noVs2008"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noVs2008 = (bool)value;
                        }
                        else if (MatchOption(newArg, "noVs2010"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noVs2010 = (bool)value;
                        }
                        else if (MatchOption(newArg, "noVs2012"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noVs2012 = (bool)value;
                        }
                        else if (MatchOption(newArg, "noVs2013"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noVs2013 = (bool)value;
                        }
                        else if (MatchOption(newArg, "noVs2015"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noVs2015 = (bool)value;
                        }
                        else if (MatchOption(newArg, "noVs2017"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.noVs2017 = (bool)value;
                        }
                        else if (MatchOption(newArg, "perUser"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.perUser = (bool)value;
                        }
                        else if (MatchOption(newArg, "providerFlags"))
                        {
                            object value = ParseEnum(
                                typeof(ProviderFlags), text, true);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.providerFlags = (ProviderFlags)value;
                        }
                        else if (MatchOption(newArg, "registryLogFileName"))
                        {
                            configuration.registryLogFileName = text;
                        }
                        else if (MatchOption(newArg, "registryVersion"))
                        {
                            configuration.registryVersion = text;
                        }
                        else if (MatchOption(newArg, "strict"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            //
                            // NOTE: Allow the command line arguments to
                            //       override the "strictness" setting
                            //       provided by our caller.
                            //
                            strict = (bool)value;
                        }
                        else if (MatchOption(newArg, "throwOnMissing"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.throwOnMissing = (bool)value;
                        }
                        else if (MatchOption(newArg, "traceFormat"))
                        {
                            configuration.traceFormat = text;
                            TraceOps.TraceFormat = configuration.traceFormat;
                        }
                        else if (MatchOption(newArg, "tracePriority"))
                        {
                            object value = ParseEnum(
                                typeof(TracePriority), text, true);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.tracePriority = (TracePriority)value;
                            TraceOps.TracePriority = configuration.tracePriority;
                        }
                        else if (MatchOption(newArg, "verbose"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.verbose = (bool)value;
                        }
                        else if (MatchOption(newArg, "vsVersionSuffix"))
                        {
                            configuration.vsVersionSuffix = text;
                        }
                        else if (MatchOption(newArg, "whatIf"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.whatIf = (bool)value;
                        }
                        else if (MatchOption(newArg, "wow64"))
                        {
                            bool? value = ParseBoolean(text);

                            if (value == null)
                            {
                                error = TraceOps.DebugAndTrace(
                                    TracePriority.Lowest, debugCallback,
                                    traceCallback, String.Format(
                                    "Invalid {0} boolean value: {1}",
                                    ForDisplay(arg), ForDisplay(text)),
                                    traceCategory);

                                if (strict)
                                    return false;

                                continue;
                            }

                            configuration.wow64 = (bool)value;
                        }
                        else
                        {
                            error = TraceOps.DebugAndTrace(
                                TracePriority.Lowest, debugCallback,
                                traceCallback, String.Format(
                                "Unsupported command line option: {0}",
                                ForDisplay(arg)), traceCategory);

                            if (strict)
                                return false;
                        }
                    }

                    return true;
                }
                catch (Exception e)
                {
                    TraceOps.DebugAndTrace(TracePriority.Highest,
                        debugCallback, traceCallback, e, traceCategory);

                    error = "Failed to modify configuration.";
                }

                return false;
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static bool Process(
                string[] args,
                Configuration configuration,
                bool strict,
                ref string error
                )
            {
                try
                {
                    if (configuration == null)
                    {
                        error = "Invalid configuration.";
                        return false;
                    }

                    Assembly assembly = configuration.assembly;

                    if (assembly == null)
                    {
                        error = "Invalid assembly.";
                        return false;
                    }

                    if (!configuration.noTrace)
                    {
                        if (!configuration.noLog &&
                            String.IsNullOrEmpty(configuration.logFileName))
                        {
                            //
                            // NOTE: Use the default log file name.
                            //
                            configuration.logFileName = GetLogFileName(
                                "trace");
                        }

                        ///////////////////////////////////////////////////////

                        if (!configuration.noConsole)
                        {
                            //
                            // NOTE: In verbose mode, debug output (that meets
                            //       the configured priority criteria) will be
                            //       displayed to the console; otherwise, trace
                            //       output (that meets the configured priority
                            //       criteria) will be displayed to the console.
                            //
                            if (configuration.debug)
                            {
                                //
                                // NOTE: Add the console trace listener to the
                                //       list of trace listeners maintained by
                                //       the TraceOps class (i.e. only messages
                                //       that meet the debug priority will be
                                //       seen on the console).
                                //
                                TraceOps.SetupDebugListeners();
                            }
                            else
                            {
                                //
                                // NOTE: Add the console trace listener to the
                                //       list of built-in trace listeners (i.e.
                                //       only messages that meet the trace
                                //       priority will be seen on the console).
                                //
                                Trace.Listeners.Add(new ConsoleTraceListener());
                            }
                        }

                        ///////////////////////////////////////////////////////

                        if (!configuration.noLog &&
                            !String.IsNullOrEmpty(configuration.logFileName))
                        {
                            Trace.Listeners.Add(new TextWriterTraceListener(
                                configuration.logFileName));

                            //
                            // NOTE: Technically, we created the log file.
                            //
                            filesCreated++;
                        }
                    }

                    //
                    // NOTE: Dump the configuration now in case we need to
                    //       troubleshoot any issues.
                    //
                    if (configuration.debugPriority <= TracePriority.Medium)
                        configuration.Dump(debugCallback);

                    if (configuration.tracePriority <= TracePriority.Medium)
                        configuration.Dump(traceCallback);

                    //
                    // NOTE: Show where we are running from and how we were
                    //       invoked.
                    //
                    string location = assembly.Location;

                    TraceOps.DebugAndTrace(TracePriority.MediumLow,
                        debugCallback, traceCallback, String.Format(
                        "Running executable is: {0}", ForDisplay(location)),
                        traceCategory);

                    TraceOps.DebugAndTrace(TracePriority.MediumLow,
                        debugCallback, traceCallback, String.Format(
                        "Original command line is: {0}",
                        Environment.CommandLine), traceCategory);

                    TraceOps.DebugAndTrace(TracePriority.MediumLow,
                        debugCallback, traceCallback, String.Format(
                        "Running process is {0}.", Is64BitProcess() ?
                            "64-bit" : "32-bit"), traceCategory);

                    if (!configuration.whatIf)
                    {
                        //
                        // NOTE: If the debugger is attached and "what-if"
                        //       mode is [now] disabled, issue a warning.
                        //
                        if (Debugger.IsAttached)
                        {
                            TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                                debugCallback, traceCallback,
                                "Forced to disable \"what-if\" mode with " +
                                "debugger attached.", traceCategory);
                        }
                    }
                    else
                    {
                        TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                            debugCallback, traceCallback,
                            "No actual changes will be made to this " +
                            "system because \"what-if\" mode is enabled.",
                            traceCategory);
                    }

                    //
                    // NOTE: If the registry log file name has been set, its
                    //       value will be used verbatim as the place where
                    //       all registry write operations will (eventually)
                    //       be logged.  Make sure the registry helper class
                    //       has a valid operation list; otherwise, it will
                    //       not perform any logging.
                    //
                    if (configuration.registryLogFileName != null)
                    {
                        RegistryHelper.EnableOrDisableOperationList(true);

                        TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                            debugCallback, traceCallback, String.Format(
                            "Registry logging to file {0} enabled.",
                            ForDisplay(configuration.registryLogFileName)),
                            traceCategory);
                    }

                    //
                    // NOTE: If the command line has not been manually
                    //       confirmed (i.e. via the explicit command line
                    //       option), then stop processing now.  We enforce
                    //       this rule so that simply double-clicking the
                    //       executable will not result in any changes being
                    //       made to the system.
                    //
                    if (!configuration.confirm)
                    {
                        error = "Cannot continue, the \"confirm\" option is " +
                            "not enabled.";

                        return false;
                    }

                    return true;
                }
                catch (Exception e)
                {
                    TraceOps.DebugAndTrace(TracePriority.Highest,
                        debugCallback, traceCallback, e, traceCategory);

                    error = "Failed to process configuration.";
                }

                return false;
            }

            ///////////////////////////////////////////////////////////////////

            [MethodImpl(MethodImplOptions.NoInlining)]
            public static bool CheckRuntimeVersion(
                Configuration configuration,
                bool strict,
                ref string error
                )
            {
                try
                {
                    if (configuration == null)
                    {
                        error = "Invalid configuration.";
                        return false;
                    }

                    //
                    // NOTE: What version of the runtime was the core (primary)
                    //       assembly compiled against (e.g. "v2.0.50727" or
                    //       "v4.0.30319").
                    //
                    string coreImageRuntimeVersion = GetImageRuntimeVersion(
                        configuration.coreFileName);

                    //
                    // NOTE: We allow the actual image runtime checking to be
                    //       bypassed via the "-noRuntimeVersion" command line
                    //       option.  The command line option is intended for
                    //       expert use only.
                    //
                    if (configuration.noRuntimeVersion)
                    {
                        TraceOps.DebugAndTrace(TracePriority.Medium,
                            debugCallback, traceCallback, String.Format(
                            "Assembly is compiled for the .NET Framework {0}; " +
                            "however, installation restrictions based on this " +
                            "fact have been disabled via the command line.",
                            coreImageRuntimeVersion), traceCategory);

                        return true;
                    }

                    //
                    // TODO: Restrict the configuration based on which image
                    //       runtime versions (which more-or-less correspond
                    //       to .NET Framework versions) are supported by the
                    //       versions of Visual Studio that are installed.
                    //
                    if (String.IsNullOrEmpty(coreImageRuntimeVersion))
                    {
                        error = "invalid core file image runtime version";
                        return false;
                    }
                    else if (String.Equals(
                            coreImageRuntimeVersion, CLRv2ImageRuntimeVersion,
                            StringComparison.Ordinal))
                    {
                        //
                        // NOTE: For the CLR v2.0 runtime, make sure we disable
                        //       any attempt to use it for things that require
                        //       an assembly compiled for the CLR v4.0.  It is
                        //       uncertain if this is actually a problem in
                        //       practice as the CLR v4.0 can load and use an
                        //       assembly compiled with the CLR v2.0; however,
                        //       since this project offers both configurations,
                        //       we currently disallow this mismatch.
                        //
                        configuration.noNetFx40 = true;
                        configuration.noNetFx45 = true;
                        configuration.noNetFx451 = true;
                        configuration.noNetFx452 = true;
                        configuration.noNetFx46 = true;
                        configuration.noNetFx461 = true;
                        configuration.noNetFx462 = true;
                        configuration.noNetFx47 = true;
                        configuration.noNetFx471 = true;
                        configuration.noNetFx472 = true;
                        configuration.noNetFx48 = true;
                        configuration.noVs2010 = true;
                        configuration.noVs2012 = true;
                        configuration.noVs2013 = true;
                        configuration.noVs2015 = true;
                        configuration.noVs2017 = true;

                        TraceOps.DebugAndTrace(TracePriority.Medium,
                            debugCallback, traceCallback, String.Format(
                            "Assembly is compiled for the .NET Framework {0}, " +
                            "support for the .NET Framework {1} is now disabled.",
                            CLRv2ImageRuntimeVersion, CLRv4ImageRuntimeVersion),
                            traceCategory);
                    }
                    else if (String.Equals(
                            coreImageRuntimeVersion, CLRv4ImageRuntimeVersion,
                            StringComparison.Ordinal))
                    {
                        //
                        // NOTE: For the CLR v4.0 runtime, make sure we disable
                        //       any attempt to use it for things that require
                        //       an assembly compiled for the CLR v2.0.
                        //
                        configuration.noNetFx20 = true;
                        configuration.noNetFx35 = true;
                        configuration.noVs2005 = true;
                        configuration.noVs2008 = true;

                        TraceOps.DebugAndTrace(TracePriority.Medium,
                            debugCallback, traceCallback, String.Format(
                            "Assembly is compiled for the .NET Framework {0}, " +
                            "support for the .NET Framework {1} is now disabled.",
                            ForDisplay(CLRv4ImageRuntimeVersion),
                            ForDisplay(CLRv2ImageRuntimeVersion)),
                            traceCategory);
                    }
                    else
                    {
                        error = String.Format(
                            "unsupported core file image runtime version " +
                            "{0}, must be {1} or {2}",
                            ForDisplay(coreImageRuntimeVersion),
                            ForDisplay(CLRv2ImageRuntimeVersion),
                            ForDisplay(CLRv4ImageRuntimeVersion));

                        return false;
                    }

                    return true;
                }
                catch (Exception e)
                {
                    TraceOps.DebugAndTrace(TracePriority.Highest,
                        debugCallback, traceCallback, e, traceCategory);

                    error = "Failed to check image runtime version.";
                }

                return false;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Private Methods
            private string GetInvariantName(
                bool trace
                )
            {
                return UseEf6Provider(trace) ?
                    Ef6InvariantName : InvariantName;
            }

            ///////////////////////////////////////////////////////////////////

            private bool IsSystemEf6AssemblyAvailable(
                bool trace
                )
            {
                try
                {
                    if (systemEf6Assembly == null)
                    {
                        systemEf6Assembly = Assembly.ReflectionOnlyLoad(
                            SystemEf6AssemblyName);
                    }

                    if (systemEf6Assembly != null)
                    {
                        if (trace &&
                            !HasFlags(ProviderFlags.DidEf6ResolveTrace, true))
                        {
                            TraceOps.DebugAndTrace(TracePriority.Highest,
                                debugCallback, traceCallback, String.Format(
                                "Entity Framework 6 assembly was " +
                                "resolved to {0}.", ForDisplay(
                                systemEf6Assembly.Location)),
                                traceCategory);

                            providerFlags |= ProviderFlags.DidEf6ResolveTrace;
                        }

                        return true;
                    }
                }
                catch
                {
                    // do nothing.
                }

                if (trace &&
                    !HasFlags(ProviderFlags.DidEf6ResolveTrace, true))
                {
                    TraceOps.DebugAndTrace(TracePriority.Highest,
                        debugCallback, traceCallback,
                        "Entity Framework 6 assembly was not resolved.",
                        traceCategory);

                    providerFlags |= ProviderFlags.DidEf6ResolveTrace;
                }

                return false;
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Methods
            public bool HasFlags(
                InstallFlags hasFlags,
                bool all
                )
            {
                if (all)
                    return ((installFlags & hasFlags) == hasFlags);
                else
                    return ((installFlags & hasFlags) != InstallFlags.None);
            }

            ///////////////////////////////////////////////////////////////////

            public bool HasFlags(
                ProviderFlags hasFlags,
                bool all
                )
            {
                if (all)
                    return ((providerFlags & hasFlags) == hasFlags);
                else
                    return ((providerFlags & hasFlags) != ProviderFlags.None);
            }

            ///////////////////////////////////////////////////////////////////

            public bool IsLinqSupported(
                bool trace
                )
            {
                //
                // NOTE: Check to see if the caller has forced LINQ support to
                //       be enabled -OR- disabled, thereby bypassing the need
                //       for "automatic detection" by this method.
                //
                if (HasFlags(ProviderFlags.ForceLinqEnabled, true))
                {
                    if (trace &&
                        !HasFlags(ProviderFlags.DidLinqForceTrace, true))
                    {
                        TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                            debugCallback, traceCallback,
                            "Forced to enable support for \"Linq\".",
                            traceCategory);

                        providerFlags |= ProviderFlags.DidLinqForceTrace;
                    }

                    return true;
                }
                else if (HasFlags(ProviderFlags.ForceLinqDisabled, true))
                {
                    if (trace &&
                        !HasFlags(ProviderFlags.DidLinqForceTrace, true))
                    {
                        TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                            debugCallback, traceCallback,
                            "Forced to disable support for \"Linq\".",
                            traceCategory);

                        providerFlags |= ProviderFlags.DidLinqForceTrace;
                    }

                    return false;
                }

                //
                // NOTE: Return non-zero if the System.Data.SQLite.Linq
                //       assembly should be processed during the install.
                //       If the target is Visual Studio 2005, this must
                //       return zero.
                //
                return !noNetFx35 || !noNetFx40 || !noNetFx45 ||
                    !noNetFx451 || !noNetFx452 || !noNetFx46 ||
                    !noNetFx461 || !noNetFx462 || !noNetFx47 ||
                    !noNetFx471 || !noNetFx472 || !noNetFx48;
            }

            ///////////////////////////////////////////////////////////////////

            public bool IsEf6Supported(
                bool trace
                )
            {
                //
                // NOTE: Check to see if the caller has forced EF6 support to
                //       be enabled -OR- disabled, thereby bypassing the need
                //       for "automatic detection" by this method.
                //
                if (HasFlags(ProviderFlags.ForceEf6Enabled, true))
                {
                    if (trace &&
                        !HasFlags(ProviderFlags.DidEf6ForceTrace, true))
                    {
                        TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                            debugCallback, traceCallback,
                            "Forced to enable support for \"Ef6\".",
                            traceCategory);

                        providerFlags |= ProviderFlags.DidEf6ForceTrace;
                    }

                    return true;
                }
                else if (HasFlags(ProviderFlags.ForceEf6Disabled, true))
                {
                    if (trace &&
                        !HasFlags(ProviderFlags.DidEf6ForceTrace, true))
                    {
                        TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                            debugCallback, traceCallback,
                            "Forced to disable support for \"Ef6\".",
                            traceCategory);

                        providerFlags |= ProviderFlags.DidEf6ForceTrace;
                    }

                    return false;
                }

                //
                // NOTE: Return non-zero if the System.Data.SQLite.EF6
                //       assembly should be processed during the install.
                //       If the target is Visual Studio 2005 or Visual
                //       Studio 2008, this must return zero.
                //
                if (noNetFx40 &&
                    noNetFx45 && noNetFx451 && noNetFx452 && noNetFx46 &&
                    noNetFx461 && noNetFx462 && noNetFx47 && noNetFx471 &&
                    noNetFx472 && noNetFx48)
                {
                    return false;
                }

                //
                // NOTE: Also, if the EF6 core assembly is unavailable, this
                //       must return zero.
                //
                if (!IsSystemEf6AssemblyAvailable(trace))
                    return false;

                //
                // NOTE: Finally, if the EF6 core assembly is not available
                //       globally [and this is a requirement for the current
                //       install], return zero.
                //
                return HasFlags(ProviderFlags.SystemEf6MustBeGlobal, true) ?
                    IsSystemEf6AssemblyGlobal() : true;
            }

            ///////////////////////////////////////////////////////////////////

            private bool IsEf6AssemblyGlobal()
            {
                if (ef6AssemblyName == null)
                    return false;

                Assembly assembly = Assembly.ReflectionOnlyLoad(
                    ef6AssemblyName.ToString());

                return (assembly != null) && assembly.GlobalAssemblyCache;
            }

            ///////////////////////////////////////////////////////////////////

            public bool UseEf6Provider(
                bool trace
                )
            {
                //
                // NOTE: We cannot use the EF6 assembly as the provider if it
                //       is not supported by this installation.
                //
                if (!IsEf6Supported(trace))
                    return false;

                //
                // NOTE: For the EF6 assembly to be usable as a provider in
                //       the machine configuration file, it must be in the
                //       global assembly cache.
                //
                return IsEf6AssemblyGlobal();
            }

            ///////////////////////////////////////////////////////////////////

            /* REQUIRED */
            public AssemblyName GetCoreAssemblyName(
                bool trace /* NOT USED */
                ) /* throw */
            {
                if (coreAssemblyName == null)
                {
                    coreAssemblyName = AssemblyName.GetAssemblyName(
                        CoreFileName); /* throw */
                }

                return coreAssemblyName;
            }

            ///////////////////////////////////////////////////////////////////

            /* OPTIONAL */
            public AssemblyName GetLinqAssemblyName(
                bool trace
                ) /* throw */
            {
                if (IsLinqSupported(trace) && (linqAssemblyName == null))
                {
                    linqAssemblyName = AssemblyName.GetAssemblyName(
                        LinqFileName); /* throw */
                }

                return linqAssemblyName;
            }

            ///////////////////////////////////////////////////////////////////

            /* OPTIONAL */
            public AssemblyName GetEf6AssemblyName(
                bool trace
                ) /* throw */
            {
                if (IsEf6Supported(trace) && (ef6AssemblyName == null))
                {
                    ef6AssemblyName = AssemblyName.GetAssemblyName(
                        Ef6FileName); /* throw */
                }

                return ef6AssemblyName;
            }

            ///////////////////////////////////////////////////////////////////

            /* REQUIRED */
            public AssemblyName GetDesignerAssemblyName(
                bool trace /* NOT USED */
                ) /* throw */
            {
                if (designerAssemblyName == null)
                {
                    designerAssemblyName = AssemblyName.GetAssemblyName(
                        DesignerFileName); /* throw */
                }

                return designerAssemblyName;
            }

            ///////////////////////////////////////////////////////////////////

            /* REQUIRED */
            public AssemblyName GetProviderAssemblyName(
                bool trace
                ) /* throw */
            {
                return UseEf6Provider(trace) ?
                    GetEf6AssemblyName(trace) : GetCoreAssemblyName(trace);
            }

            ///////////////////////////////////////////////////////////////////

            public string GetConfigInvariantName(
                bool trace
                )
            {
                return GetInvariantName(trace);
            }

            ///////////////////////////////////////////////////////////////////

            public string GetProviderInvariantName(
                bool trace
                )
            {
                return GetInvariantName(trace);
            }

            ///////////////////////////////////////////////////////////////////

            public string GetFactoryTypeName(
                bool trace
                )
            {
                return UseEf6Provider(trace) ?
                    Ef6FactoryTypeName : FactoryTypeName;
            }

            ///////////////////////////////////////////////////////////////////

            public void Dump(
                TraceCallback traceCallback
                )
            {
                if (traceCallback != null)
                {
                    traceCallback(String.Format(NameAndValueFormat,
                        "Assembly", ForDisplay(assembly)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "LogFileName", ForDisplay(logFileName)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "RegistryLogFileName",
                        ForDisplay(registryLogFileName)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "Directory", ForDisplay(directory)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "CoreFileName", ForDisplay(coreFileName)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "LinqFileName", ForDisplay(linqFileName)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "Ef6FileName", ForDisplay(ef6FileName)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "DesignerFileName", ForDisplay(designerFileName)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "RegistryVersion", ForDisplay(registryVersion)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "ConfigVersion", ForDisplay(configVersion)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "VsVersionSuffix", ForDisplay(vsVersionSuffix)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "DebugFormat", ForDisplay(debugFormat)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "TraceFormat", ForDisplay(traceFormat)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "InstallFlags", ForDisplay(installFlags)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "ProviderFlags", ForDisplay(providerFlags)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "DebugPriority", ForDisplay(debugPriority)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "TracePriority", ForDisplay(tracePriority)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "PerUser", ForDisplay(perUser)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "Install", ForDisplay(install)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "Wow64", ForDisplay(wow64)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoRuntimeVersion", ForDisplay(noRuntimeVersion)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoDesktop", ForDisplay(noDesktop)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoCompact", ForDisplay(noCompact)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoNetFx20", ForDisplay(noNetFx20)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoNetFx35", ForDisplay(noNetFx35)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoNetFx40", ForDisplay(noNetFx40)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoNetFx45", ForDisplay(noNetFx45)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoNetFx451", ForDisplay(noNetFx451)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoNetFx452", ForDisplay(noNetFx452)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoNetFx46", ForDisplay(noNetFx46)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoNetFx461", ForDisplay(noNetFx461)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoNetFx462", ForDisplay(noNetFx462)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoNetFx47", ForDisplay(noNetFx47)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoNetFx471", ForDisplay(noNetFx471)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoNetFx472", ForDisplay(noNetFx472)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoNetFx48", ForDisplay(noNetFx48)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoVs2005", ForDisplay(noVs2005)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoVs2008", ForDisplay(noVs2008)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoVs2010", ForDisplay(noVs2010)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoVs2012", ForDisplay(noVs2012)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoVs2013", ForDisplay(noVs2013)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoVs2015", ForDisplay(noVs2015)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoVs2017", ForDisplay(noVs2017)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoTrace", ForDisplay(noTrace)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoConsole", ForDisplay(noConsole)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "NoLog", ForDisplay(noLog)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "ThrowOnMissing", ForDisplay(throwOnMissing)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "WhatIf", ForDisplay(whatIf)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "Debug", ForDisplay(debug)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "Verbose", ForDisplay(verbose)),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "Confirm", ForDisplay(confirm)),
                        traceCategory);

                    ///////////////////////////////////////////////////////////

                    if (assembly != null)
                    {
                        traceCallback(String.Format(NameAndValueFormat,
                            "AssemblyTitle",
                            ForDisplay(GetAssemblyTitle(assembly))),
                            traceCategory);

                        traceCallback(String.Format(NameAndValueFormat,
                            "AssemblyConfiguration",
                            ForDisplay(GetAssemblyConfiguration(assembly))),
                            traceCategory);
                    }

                    ///////////////////////////////////////////////////////////

                    traceCallback(String.Format(NameAndValueFormat,
                        "IsSystemEf6AssemblyAvailable", ForDisplay(
                        IsSystemEf6AssemblyAvailable(false))),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "IsSystemEf6AssemblyGlobal", ForDisplay(
                        IsSystemEf6AssemblyGlobal())),
                        traceCategory);

                    ///////////////////////////////////////////////////////////

                    traceCallback(String.Format(NameAndValueFormat,
                        "IsLinqSupported", ForDisplay(IsLinqSupported(false))),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "IsEf6Supported", ForDisplay(IsEf6Supported(false))),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "IsEf6AssemblyGlobal", ForDisplay(
                        IsEf6AssemblyGlobal())),
                        traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "UseEf6Provider", ForDisplay(UseEf6Provider(false))),
                        traceCategory);

                    ///////////////////////////////////////////////////////////

                    try
                    {
                        traceCallback(String.Format(NameAndValueFormat,
                            "GetCoreAssemblyName", ForDisplay(
                            GetCoreAssemblyName(false))), traceCategory);
                    }
                    catch (Exception e)
                    {
                        traceCallback(String.Format(NameAndValueFormat,
                            "GetCoreAssemblyName", ForDisplay(e)),
                            traceCategory);
                    }

                    ///////////////////////////////////////////////////////////

                    try
                    {
                        traceCallback(String.Format(NameAndValueFormat,
                            "GetLinqAssemblyName", ForDisplay(
                            GetLinqAssemblyName(false))), traceCategory);
                    }
                    catch (Exception e)
                    {
                        traceCallback(String.Format(NameAndValueFormat,
                            "GetLinqAssemblyName", ForDisplay(e)),
                            traceCategory);
                    }

                    ///////////////////////////////////////////////////////////

                    try
                    {
                        traceCallback(String.Format(NameAndValueFormat,
                            "GetEf6AssemblyName", ForDisplay(
                            GetEf6AssemblyName(false))), traceCategory);
                    }
                    catch (Exception e)
                    {
                        traceCallback(String.Format(NameAndValueFormat,
                            "GetEf6AssemblyName", ForDisplay(e)),
                            traceCategory);
                    }

                    ///////////////////////////////////////////////////////////

                    try
                    {
                        traceCallback(String.Format(NameAndValueFormat,
                            "GetDesignerAssemblyName", ForDisplay(
                            GetDesignerAssemblyName(false))), traceCategory);
                    }
                    catch (Exception e)
                    {
                        traceCallback(String.Format(NameAndValueFormat,
                            "GetDesignerAssemblyName", ForDisplay(e)),
                            traceCategory);
                    }

                    ///////////////////////////////////////////////////////////

                    traceCallback(String.Format(NameAndValueFormat,
                        "GetInvariantName", ForDisplay(GetInvariantName(
                        false))), traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "GetConfigInvariantName", ForDisplay(
                        GetConfigInvariantName(false))), traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "GetProviderInvariantName", ForDisplay(
                        GetProviderInvariantName(false))), traceCategory);

                    traceCallback(String.Format(NameAndValueFormat,
                        "GetFactoryTypeName", ForDisplay(
                        GetFactoryTypeName(false))), traceCategory);

                    ///////////////////////////////////////////////////////////

                    try
                    {
                        traceCallback(String.Format(NameAndValueFormat,
                            "GetProviderAssemblyName", ForDisplay(
                            GetProviderAssemblyName(false))), traceCategory);
                    }
                    catch (Exception e)
                    {
                        traceCallback(String.Format(NameAndValueFormat,
                            "GetProviderAssemblyName", ForDisplay(e)),
                            traceCategory);
                    }
                }
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Properties
            private Assembly assembly;
            public Assembly Assembly
            {
                get { return assembly; }
                set { assembly = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private string logFileName;
            public string LogFileName
            {
                get { return logFileName; }
                set { logFileName = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private string registryLogFileName;
            public string RegistryLogFileName
            {
                get { return registryLogFileName; }
                set { registryLogFileName = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private string directory;
            public string Directory
            {
                get { return directory; }
                set { directory = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private string coreFileName;
            public string CoreFileName
            {
                get { return coreFileName; }
                set { coreFileName = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private string linqFileName;
            public string LinqFileName
            {
                get { return linqFileName; }
                set { linqFileName = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private string ef6FileName;
            public string Ef6FileName
            {
                get { return ef6FileName; }
                set { ef6FileName = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private string designerFileName;
            public string DesignerFileName
            {
                get { return designerFileName; }
                set { designerFileName = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private string registryVersion;
            public string RegistryVersion
            {
                get { return registryVersion; }
                set { registryVersion = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private string configVersion;
            public string ConfigVersion
            {
                get { return configVersion; }
                set { configVersion = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private string vsVersionSuffix;
            public string VsVersionSuffix
            {
                get { return vsVersionSuffix; }
                set { vsVersionSuffix = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private string debugFormat;
            public string DebugFormat
            {
                get { return debugFormat; }
                set { debugFormat = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private string traceFormat;
            public string TraceFormat
            {
                get { return traceFormat; }
                set { traceFormat = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private InstallFlags installFlags;
            public InstallFlags InstallFlags
            {
                get { return installFlags; }
                set { installFlags = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private ProviderFlags providerFlags;
            public ProviderFlags ProviderFlags
            {
                get { return providerFlags; }
                set { providerFlags = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private TracePriority debugPriority;
            public TracePriority DebugPriority
            {
                get { return debugPriority; }
                set { debugPriority = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private TracePriority tracePriority;
            public TracePriority TracePriority
            {
                get { return tracePriority; }
                set { tracePriority = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool perUser;
            public bool PerUser
            {
                get { return perUser; }
                set { perUser = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool install;
            public bool Install
            {
                get { return install; }
                set { install = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool wow64;
            public bool Wow64
            {
                get { return wow64; }
                set { wow64 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noRuntimeVersion;
            public bool NoRuntimeVersion
            {
                get { return noRuntimeVersion; }
                set { noRuntimeVersion = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noDesktop;
            public bool NoDesktop
            {
                get { return noDesktop; }
                set { noDesktop = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noCompact;
            public bool NoCompact
            {
                get { return noCompact; }
                set { noCompact = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noNetFx20;
            public bool NoNetFx20
            {
                get { return noNetFx20; }
                set { noNetFx20 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noNetFx35;
            public bool NoNetFx35
            {
                get { return noNetFx35; }
                set { noNetFx35 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noNetFx40;
            public bool NoNetFx40
            {
                get { return noNetFx40; }
                set { noNetFx40 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noNetFx45;
            public bool NoNetFx45
            {
                get { return noNetFx45; }
                set { noNetFx45 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noNetFx451;
            public bool NoNetFx451
            {
                get { return noNetFx451; }
                set { noNetFx451 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noNetFx452;
            public bool NoNetFx452
            {
                get { return noNetFx452; }
                set { noNetFx452 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noNetFx46;
            public bool NoNetFx46
            {
                get { return noNetFx46; }
                set { noNetFx46 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noNetFx461;
            public bool NoNetFx461
            {
                get { return noNetFx461; }
                set { noNetFx461 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noNetFx462;
            public bool NoNetFx462
            {
                get { return noNetFx462; }
                set { noNetFx462 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noNetFx47;
            public bool NoNetFx47
            {
                get { return noNetFx47; }
                set { noNetFx47 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noNetFx471;
            public bool NoNetFx471
            {
                get { return noNetFx471; }
                set { noNetFx471 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noNetFx472;
            public bool NoNetFx472
            {
                get { return noNetFx472; }
                set { noNetFx472 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noNetFx48;
            public bool NoNetFx48
            {
                get { return noNetFx48; }
                set { noNetFx48 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noVs2005;
            public bool NoVs2005
            {
                get { return noVs2005; }
                set { noVs2005 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noVs2008;
            public bool NoVs2008
            {
                get { return noVs2008; }
                set { noVs2008 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noVs2010;
            public bool NoVs2010
            {
                get { return noVs2010; }
                set { noVs2010 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noVs2012;
            public bool NoVs2012
            {
                get { return noVs2012; }
                set { noVs2012 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noVs2013;
            public bool NoVs2013
            {
                get { return noVs2013; }
                set { noVs2013 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noVs2015;
            public bool NoVs2015
            {
                get { return noVs2015; }
                set { noVs2015 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noVs2017;
            public bool NoVs2017
            {
                get { return noVs2017; }
                set { noVs2017 = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noTrace;
            public bool NoTrace
            {
                get { return noTrace; }
                set { noTrace = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noConsole;
            public bool NoConsole
            {
                get { return noConsole; }
                set { noConsole = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool noLog;
            public bool NoLog
            {
                get { return noLog; }
                set { noLog = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool throwOnMissing;
            public bool ThrowOnMissing
            {
                get { return throwOnMissing; }
                set { throwOnMissing = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool whatIf;
            public bool WhatIf
            {
                get { return whatIf; }
                set { whatIf = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool debug;
            public bool Debug
            {
                get { return debug; }
                set { debug = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool verbose;
            public bool Verbose
            {
                get { return verbose; }
                set { verbose = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private bool confirm;
            public bool Confirm
            {
                get { return confirm; }
                set { confirm = value; }
            }
            #endregion
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region FrameworkList Class
        private sealed class FrameworkList
        {
            #region Public Constructors
            public FrameworkList()
            {
                // do nothing.
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Methods
            private MockRegistryKey rootKey;
            public MockRegistryKey RootKey
            {
                get { return rootKey; }
                set { rootKey = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private StringList names;
            public StringList Names
            {
                get { return names; }
                set { names = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private VersionMap versions;
            public VersionMap Versions
            {
                get { return versions; }
                set { versions = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private StringList platformNames;
            public StringList PlatformNames
            {
                get { return platformNames; }
                set { platformNames = value; }
            }
            #endregion
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region VsList Class
        private sealed class VsList
        {
            #region Public Constructors
            public VsList()
            {
                // do nothing.
            }
            #endregion

            ///////////////////////////////////////////////////////////////////

            #region Public Properties
            private MockRegistryKey rootKey;
            public MockRegistryKey RootKey
            {
                get { return rootKey; }
                set { rootKey = value; }
            }

            ///////////////////////////////////////////////////////////////////

            private VersionList versions;
            public VersionList Versions
            {
                get { return versions; }
                set { versions = value; }
            }
            #endregion
        }
        #endregion
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Constant Data
        #region Package & Provider Names
        private const string CoreFileName = "System.Data.SQLite.dll";
        private const string LinqFileName = "System.Data.SQLite.Linq.dll";
        private const string Ef6FileName = "System.Data.SQLite.EF6.dll";
        private const string DesignerFileName = "SQLite.Designer.dll";
        private const string ProviderName = "SQLite Data Provider";
        private const string ProjectName = "System.Data.SQLite";
        private const string LegacyProjectName = "SQLite";

        ///////////////////////////////////////////////////////////////////////

        private const string Description =
            ".NET Framework Data Provider for SQLite";
        #endregion

        ///////////////////////////////////////////////////////////////////////

        private const string DisplayNull = "<null>";
        private const string DisplayEmpty = "<empty>";

        ///////////////////////////////////////////////////////////////////////

        private const string CLRv2ImageRuntimeVersion = "v2.0.50727";
        private const string CLRv4ImageRuntimeVersion = "v4.0.30319";

        ///////////////////////////////////////////////////////////////////////

        private const string SystemEf6AssemblyName = "EntityFramework, " +
            "Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";

        ///////////////////////////////////////////////////////////////////////

        private const string NameAndValueFormat = "{0}: {1}";
        private const string LogFileSuffix = ".log";

        ///////////////////////////////////////////////////////////////////////

        private const string VsDevEnvSetupFormat = "{0}: {1}";

        ///////////////////////////////////////////////////////////////////////

        private const string RootKeyName = "Software";
        private const string Wow64SubKeyName = "Wow6432Node";

        ///////////////////////////////////////////////////////////////////////

        //
        // NOTE: The .NET Framework has both 32-bit and 64-bit editions.
        //
        private static readonly bool NetFxIs32BitOnly = false;

        ///////////////////////////////////////////////////////////////////////

        //
        // NOTE: For now, Visual Studio is always a 32-bit application.
        //
        private static readonly bool VsIs32BitOnly = true;

        ///////////////////////////////////////////////////////////////////////

        private static readonly string VsIdFormat = "B";

        ///////////////////////////////////////////////////////////////////////

        private static readonly string XPathForAddElement =
            "configuration/system.data/DbProviderFactories/add[@invariant=\"{0}\"]";

        private static readonly string XPathForRemoveElement =
            "configuration/system.data/DbProviderFactories/remove[@invariant=\"{0}\"]";
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Private Static Data
        #region Diagnostics & Logging
        //
        // NOTE: Cache the current process and assembly as they do not change
        //       and may be needed in quite a few different places.
        //
        private static Process thisProcess = Process.GetCurrentProcess();
        private static Assembly thisAssembly = Assembly.GetExecutingAssembly();

        ///////////////////////////////////////////////////////////////////////

        //
        // NOTE: The trace category is the same for both the debug and trace
        //       callbacks.
        //
        private static string traceCategory = (thisAssembly != null) ?
            Path.GetFileName(thisAssembly.Location) : null;

        ///////////////////////////////////////////////////////////////////////

        //
        // NOTE: Set the debug and trace logging callbacks used by the
        //       application.
        //
        private static TraceCallback debugCallback = AppDebug;
        private static TraceCallback traceCallback = AppTrace;
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region System Directory
        private static string systemDirectory = null;

#if WINDOWS
        private static string systemDirectoryWow64 = null;
#endif
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Registry Statistics
        private static int filesCreated = 0;
        private static int filesModified = 0;
        private static int filesDeleted = 0;
        #endregion
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Trace Handling
        private static string GetLogFileName(
            string typeName
            ) /* throw */
        {
            string fileName = Path.GetTempFileName();
            string directory = Path.GetDirectoryName(fileName);
            string fileNameOnly = Path.GetFileNameWithoutExtension(fileName);

            string newFileName = Path.Combine(directory, String.Format(
                "{0}{1}{2}", traceCategory, !String.IsNullOrEmpty(typeName) ?
                    "." + typeName : String.Empty, "." + fileNameOnly +
                    LogFileSuffix));

            File.Move(fileName, newFileName);

            return newFileName;
        }

        ///////////////////////////////////////////////////////////////////////

        private static void AppDebug(
            string message,
            string category
            )
        {
            TraceOps.DebugCore(String.Format(
                TraceOps.DebugFormat, TraceOps.NextDebugId(),
                TraceOps.TimeStamp(DateTime.UtcNow), message), category);
        }

        ///////////////////////////////////////////////////////////////////////

        private static void AppTrace(
            string message,
            string category
            )
        {
            TraceOps.TraceCore(String.Format(
                TraceOps.TraceFormat, TraceOps.NextTraceId(),
                TraceOps.TimeStamp(DateTime.UtcNow), message), category);
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Generic Platform Handling
        private static bool Is64BitProcess()
        {
            //
            // NOTE: Returns true if the current process is 64-bit.  If this
            //       is true, we *know* that we must be running on a 64-bit
            //       operating system as well.  However, if this is false, we
            //       do not necessarily know that we are running on a 32-bit
            //       operating system, due to WoW64 (Win32-on-Win64), etc.
            //
            return (IntPtr.Size == sizeof(long)); // NOTE: Pointer is 64-bits?
        }

        ///////////////////////////////////////////////////////////////////////

        private static bool IsSupportedRootKey(
            MockRegistry registry,
            MockRegistryKey rootKey
            )
        {
            return Object.ReferenceEquals(rootKey, registry.CurrentUser) ||
                Object.ReferenceEquals(rootKey, registry.LocalMachine);
        }

        ///////////////////////////////////////////////////////////////////////

        private static string GetRootKeyName(
            bool perUser,
            bool wow64
            )
        {
            //
            // BUGFIX: Apparently, the per-user registry hive does not use
            //         the "Wow6432Node" node to store settings for 32-bit
            //         applications running on a 64-bit operating system.
            //         Ticket [a0677309f0] has further details.
            //
            return RegistryHelper.JoinKeyNames(RootKeyName,
                !perUser && wow64 && Is64BitProcess() ?
                    Wow64SubKeyName : String.Empty);
        }

        ///////////////////////////////////////////////////////////////////////

        private static string GetSystemDirectory(
            bool wow64
            )
        {
#if WINDOWS
            if (wow64)
            {
                if (systemDirectoryWow64 == null)
                {
                    systemDirectoryWow64 =
                        UnsafeNativeMethods.GetSystemDirectory();
                }

                return systemDirectoryWow64;
            }
            else
#endif
            {
                if (systemDirectory == null)
                    systemDirectory = Environment.SystemDirectory;

                return systemDirectory;
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Generic String Handling
        private static string ForDisplay(
            object value
            )
        {
            if (value == null)
                return DisplayNull;

            string result;
            Type type = value.GetType();

            if (type == typeof(XmlElement))
            {
                XmlElement element = (XmlElement)value;

                result = element.OuterXml;
            }
            else if (type == typeof(Version))
            {
                Version version = (Version)value;

                result = String.Format("v{0}", version);
            }
            else if (type == typeof(ProcessStartInfo))
            {
                ProcessStartInfo startInfo = (ProcessStartInfo)value;

                result = String.Format(
                    "fileName = {0}, arguments = {1}, workingDirectory = {2}, " +
                    "useShellExecute = {3}, redirectStandardOutput = {4}, " +
                    "redirectStandardError = {5}", ForDisplay(
                    startInfo.FileName), ForDisplay(startInfo.Arguments),
                    ForDisplay(startInfo.WorkingDirectory), ForDisplay(
                    startInfo.UseShellExecute), ForDisplay(
                    startInfo.RedirectStandardOutput), ForDisplay(
                    startInfo.RedirectStandardError)); /* RECURSIVE */
            }
            else if (type == typeof(Process))
            {
                Process process = (Process)value;

                result = process.Id.ToString();
            }
            else if (type == typeof(DataReceivedEventArgs))
            {
                DataReceivedEventArgs eventArgs = (DataReceivedEventArgs)value;

                result = ForDisplay(eventArgs.Data); /* RECURSIVE */
            }
            else if (type == typeof(MockRegistryKey))
            {
                MockRegistryKey key = (MockRegistryKey)value;

                result = ForDisplay(key.ToString()); /* RECURSIVE */
            }
            else
            {
                result = value.ToString();

                if (result.Length == 0)
                    return DisplayEmpty;

                if (type.IsSubclassOf(typeof(Exception)))
                {
                    result = String.Format(
                        "{0}{1}{0}", Environment.NewLine, result);
                }
                else if (!type.IsSubclassOf(typeof(ValueType)))
                {
                    result = String.Format("\"{0}\"", result);
                }
            }

            return result;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Assembly Attribute Handling
        public static string GetAssemblyConfiguration(
            Assembly assembly
            )
        {
            if (assembly != null)
            {
                try
                {
                    if (assembly.IsDefined(
                            typeof(AssemblyConfigurationAttribute), false))
                    {
                        AssemblyConfigurationAttribute configuration =
                            (AssemblyConfigurationAttribute)
                            assembly.GetCustomAttributes(
                                typeof(AssemblyConfigurationAttribute),
                                false)[0];

                        return configuration.Configuration;
                    }
                }
                catch
                {
                    // do nothing.
                }
            }

            return null;
        }

        ///////////////////////////////////////////////////////////////////////

        public static string GetAssemblyTitle(
            Assembly assembly
            )
        {
            if (assembly != null)
            {
                try
                {
                    if (assembly.IsDefined(
                            typeof(AssemblyTitleAttribute), false))
                    {
                        AssemblyTitleAttribute title =
                            (AssemblyTitleAttribute)
                            assembly.GetCustomAttributes(
                                typeof(AssemblyTitleAttribute), false)[0];

                        return title.Title;
                    }
                }
                catch
                {
                    // do nothing.
                }
            }

            return null;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region .NET Framework Handling
        private static string GetFrameworkRootKeyName(
            bool perUser,
            bool wow64
            )
        {
            return RegistryHelper.JoinKeyNames(
                GetRootKeyName(perUser, wow64),
                "Microsoft", ".NETFramework");
        }

        ///////////////////////////////////////////////////////////////////////

        private static string GetFrameworkKeyName(
            string frameworkName,
            Version frameworkVersion,
            string platformName,
            bool perUser,
            bool wow64
            )
        {
            string frameworkVersionString = (frameworkVersion != null) ?
                "v" + frameworkVersion.ToString() : null;

            return RegistryHelper.JoinKeyNames(
                GetRootKeyName(perUser, wow64), "Microsoft", frameworkName,
                frameworkVersionString, platformName);
        }

        ///////////////////////////////////////////////////////////////////////

        private static string GetImageRuntimeVersion(
            string fileName
            )
        {
            try
            {
                Assembly assembly = Assembly.ReflectionOnlyLoadFrom(
                    fileName); /* throw */

                if (assembly != null)
                    return assembly.ImageRuntimeVersion;
            }
            catch
            {
                // do nothing.
            }

            return null;
        }

        ///////////////////////////////////////////////////////////////////////

        private static string GetFrameworkDirectory(
            MockRegistryKey rootKey,
            Version frameworkVersion,
            bool perUser,
            bool wow64,
            bool whatIf,
            bool verbose
            )
        {
            using (MockRegistryKey key = RegistryHelper.OpenSubKey(
                    rootKey, GetFrameworkRootKeyName(perUser, wow64),
                    false, whatIf, verbose))
            {
                if (key == null)
                    return null;

                object value = RegistryHelper.GetValue(
                    key, "InstallRoot", null, whatIf, verbose);

                if (!(value is string))
                    return null;

                return Path.Combine(
                    (string)value, String.Format("v{0}", frameworkVersion));
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Per-Framework/Platform Handling
        private static void InitializeFrameworkList(
            MockRegistryKey rootKey,
            Configuration configuration,
            ref FrameworkList frameworkList
            )
        {
            if (frameworkList == null)
                frameworkList = new FrameworkList();

            if (frameworkList.RootKey == null)
                frameworkList.RootKey = rootKey;

            ///////////////////////////////////////////////////////////////////

            if (frameworkList.Names == null)
            {
                frameworkList.Names = new StringList();

                if ((configuration == null) || !configuration.NoDesktop)
                    frameworkList.Names.Add(".NETFramework");

                if ((configuration == null) || !configuration.NoCompact)
                {
                    frameworkList.Names.Add(".NETCompactFramework");
                    frameworkList.Names.Add(".NETCompactFramework");
                    frameworkList.Names.Add(".NETCompactFramework");
                }
            }

            ///////////////////////////////////////////////////////////////////

            if (frameworkList.Versions == null)
            {
                frameworkList.Versions = new VersionMap();

                if ((configuration == null) || !configuration.NoDesktop)
                {
                    VersionList desktopVersionList = new VersionList();

                    if ((configuration == null) || !configuration.NoNetFx20)
                        desktopVersionList.Add(new Version(2, 0, 50727));

                    //
                    // NOTE: The .NET Framework 3.5 does not have its own
                    //       directory; however, it still may have assembly
                    //       folders for use in Visual Studio, etc.
                    //
                    if ((configuration == null) || !configuration.NoNetFx35)
                        desktopVersionList.Add(new Version(3, 5));

                    if ((configuration == null) || !configuration.NoNetFx40)
                        desktopVersionList.Add(new Version(4, 0, 30319));

                    //
                    // NOTE: The .NET Framework 4.5 does not have its own
                    //       directory; however, it still may have assembly
                    //       folders for use in Visual Studio, etc.
                    //
                    if ((configuration == null) || !configuration.NoNetFx45)
                        desktopVersionList.Add(new Version(4, 5, 50709));

                    //
                    // NOTE: The .NET Framework 4.5.1 does not have its own
                    //       directory; however, it still may have assembly
                    //       folders for use in Visual Studio, etc.
                    //
                    if ((configuration == null) || !configuration.NoNetFx451)
                        desktopVersionList.Add(new Version(4, 5, 1));

                    //
                    // NOTE: The .NET Framework 4.5.2 does not have its own
                    //       directory; however, it still may have assembly
                    //       folders for use in Visual Studio, etc.
                    //
                    if ((configuration == null) || !configuration.NoNetFx452)
                        desktopVersionList.Add(new Version(4, 5, 2));

                    //
                    // NOTE: The .NET Framework 4.6 does not have its own
                    //       directory; however, it still may have assembly
                    //       folders for use in Visual Studio, etc.
                    //
                    if ((configuration == null) || !configuration.NoNetFx46)
                        desktopVersionList.Add(new Version(4, 6));

                    //
                    // NOTE: The .NET Framework 4.6.1 does not have its own
                    //       directory; however, it still may have assembly
                    //       folders for use in Visual Studio, etc.
                    //
                    if ((configuration == null) || !configuration.NoNetFx461)
                        desktopVersionList.Add(new Version(4, 6, 1));

                    //
                    // NOTE: The .NET Framework 4.6.2 does not have its own
                    //       directory; however, it still may have assembly
                    //       folders for use in Visual Studio, etc.
                    //
                    if ((configuration == null) || !configuration.NoNetFx462)
                        desktopVersionList.Add(new Version(4, 6, 2));

                    //
                    // NOTE: The .NET Framework 4.7 does not have its own
                    //       directory; however, it still may have assembly
                    //       folders for use in Visual Studio, etc.
                    //
                    if ((configuration == null) || !configuration.NoNetFx47)
                        desktopVersionList.Add(new Version(4, 7));

                    //
                    // NOTE: The .NET Framework 4.7.1 does not have its own
                    //       directory; however, it still may have assembly
                    //       folders for use in Visual Studio, etc.
                    //
                    if ((configuration == null) || !configuration.NoNetFx471)
                        desktopVersionList.Add(new Version(4, 7, 1));

                    //
                    // NOTE: The .NET Framework 4.7.2 does not have its own
                    //       directory; however, it still may have assembly
                    //       folders for use in Visual Studio, etc.
                    //
                    if ((configuration == null) || !configuration.NoNetFx472)
                        desktopVersionList.Add(new Version(4, 7, 2));

                    //
                    // NOTE: The .NET Framework 4.8 does not have its own
                    //       directory; however, it still may have assembly
                    //       folders for use in Visual Studio, etc.
                    //
                    if ((configuration == null) || !configuration.NoNetFx48)
                        desktopVersionList.Add(new Version(4, 8));

                    frameworkList.Versions.Add(".NETFramework",
                        desktopVersionList);
                }

                if ((configuration == null) || !configuration.NoCompact)
                {
                    frameworkList.Versions.Add(".NETCompactFramework",
                        new VersionList(new Version[] {
                        new Version(2, 0, 0, 0), new Version(3, 5, 0, 0)
                    }));
                }
            }

            ///////////////////////////////////////////////////////////////////

            if (frameworkList.PlatformNames == null)
            {
                frameworkList.PlatformNames = new StringList();

                if ((configuration == null) || !configuration.NoDesktop)
                    frameworkList.PlatformNames.Add(null);

                if ((configuration == null) || !configuration.NoCompact)
                {
                    frameworkList.PlatformNames.Add("PocketPC");
                    frameworkList.PlatformNames.Add("Smartphone");
                    frameworkList.PlatformNames.Add("WindowsCE");
                }
            }
        }

        ///////////////////////////////////////////////////////////////////////

        private static bool HaveFrameworkDirectory(
            MockRegistryKey rootKey,
            string frameworkName,
            Version frameworkVersion,
            string platformName,
            bool perUser,
            bool wow64,
            bool whatIf,
            bool verbose,
            ref string installDirectory
            )
        {
            string keyName = GetFrameworkKeyName(
                frameworkName, frameworkVersion, platformName, perUser,
                wow64);

            using (MockRegistryKey key = RegistryHelper.OpenSubKey(
                    rootKey, keyName, false, whatIf, verbose))
            {
                if (key == null)
                    return false;

                if (platformName != null) // NOTE: Skip non-desktop.
                    return true;

                string directory = GetFrameworkDirectory(
                    rootKey, frameworkVersion, perUser, wow64, whatIf,
                    verbose);

                if (String.IsNullOrEmpty(directory))
                    return false;

                if (!Directory.Exists(directory))
                    return false;

                TraceOps.DebugAndTrace(TracePriority.Lower,
                    debugCallback, traceCallback, String.Format(
                    ".NET Framework {0} found via directory {1}.",
                    ForDisplay(frameworkVersion), ForDisplay(directory)),
                    traceCategory);

                installDirectory = directory;
                return true;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        private static bool HaveFrameworkRegistry(
            MockRegistryKey rootKey,
            string frameworkName,
            Version frameworkVersion,
            string platformName,
            bool perUser,
            bool wow64,
            bool whatIf,
            bool verbose
            )
        {
            string keyName = GetFrameworkKeyName(
                frameworkName, frameworkVersion, platformName, perUser,
                wow64);

            using (MockRegistryKey key = RegistryHelper.OpenSubKey(
                    rootKey, keyName, false, whatIf, verbose))
            {
                if (key == null)
                    return false;

                if (platformName != null) // NOTE: Skip non-desktop.
                    return true;

                TraceOps.DebugAndTrace(TracePriority.Lower,
                    debugCallback, traceCallback, String.Format(
                    ".NET Framework {0} found via registry {1}.",
                    ForDisplay(frameworkVersion), ForDisplay(keyName)),
                    traceCategory);

                return true;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        [MethodImpl(MethodImplOptions.NoInlining)]
        private static bool ForEachFrameworkConfig(
            MockRegistry registry,
            FrameworkList frameworkList,
            FrameworkConfigCallback callback,
            string version, /* NOTE: Optional. */
            string invariantName,
            string name,
            string description,
            string typeName,
            AssemblyName assemblyName,
            object clientData,
            bool perUser,
            bool wow64,
            bool throwOnMissing,
            bool whatIf,
            bool verbose,
            ref bool saved,
            ref string error
            )
        {
            if (registry == null)
            {
                error = "invalid registry";
                return false;
            }

            if (frameworkList == null)
            {
                error = "invalid framework list";
                return false;
            }

            MockRegistryKey rootKey = frameworkList.RootKey;

            if (rootKey == null)
            {
                error = "invalid root key";
                return false;
            }

            if (!IsSupportedRootKey(registry, rootKey))
            {
                error = "root key must be per-user or per-machine";
                return false;
            }

            if (frameworkList.Names == null)
            {
                error = "no framework names found";
                return false;
            }

            if (frameworkList.Versions == null)
            {
                error = "no framework versions found";
                return false;
            }

            if (frameworkList.PlatformNames == null)
            {
                error = "no platform names found";
                return false;
            }

            if (frameworkList.Names.Count != frameworkList.PlatformNames.Count)
            {
                error = String.Format("framework name count {0} does not " +
                    "match platform name count {1}", frameworkList.Names.Count,
                    frameworkList.PlatformNames.Count);

                return false;
            }

            for (int index = 0; index < frameworkList.Names.Count; index++)
            {
                //
                // NOTE: Grab the name of the framework (e.g. ".NETFramework")
                //       and the name of the platform (e.g. "WindowsCE").
                //
                string frameworkName = frameworkList.Names[index];
                string platformName = frameworkList.PlatformNames[index];

                //
                // NOTE: Skip all non-desktop frameworks (i.e. if the platform
                //       name is not null).
                //
                if (platformName != null)
                    continue;

                //
                // NOTE: Grab the supported versions of this particular
                //       framework.
                //
                VersionList frameworkVersionList;

                if (version != null)
                {
                    //
                    // NOTE: Manual override of the *ONE* framework version
                    //       to process.
                    //
                    frameworkVersionList = new VersionList();
                    frameworkVersionList.Add(new Version(version));
                }
                else
                {
                    if (!frameworkList.Versions.TryGetValue(
                            frameworkName, out frameworkVersionList) ||
                        (frameworkVersionList == null))
                    {
                        continue;
                    }
                }

                foreach (Version frameworkVersion in frameworkVersionList)
                {
                    TraceOps.DebugAndTrace(TracePriority.Lower,
                        debugCallback, traceCallback, String.Format(
                        "frameworkName = {0}, frameworkVersion = {1}, " +
                        "platformName = {2}", ForDisplay(frameworkName),
                        ForDisplay(frameworkVersion),
                        ForDisplay(platformName)), traceCategory);

                    string installDirectory = null;

                    if (!HaveFrameworkDirectory(
                            rootKey, frameworkName, frameworkVersion,
                            platformName, perUser, wow64, whatIf, verbose,
                            ref installDirectory))
                    {
                        TraceOps.DebugAndTrace(TracePriority.Low,
                            debugCallback, traceCallback, String.Format(
                            ".NET Framework {0} directory not found, " +
                            "skipping...", ForDisplay(frameworkVersion)),
                            traceCategory);

                        continue;
                    }

                    if (callback == null)
                        continue;

                    string directory = installDirectory;

                    if (String.IsNullOrEmpty(directory))
                    {
                        TraceOps.DebugAndTrace(TracePriority.Low,
                            debugCallback, traceCallback, String.Format(
                            ".NET Framework {0} directory is invalid, " +
                            "skipping...", ForDisplay(frameworkVersion)),
                            traceCategory);

                        continue;
                    }

                    directory = Path.Combine(directory, "Config");

                    if (!Directory.Exists(directory))
                    {
                        TraceOps.DebugAndTrace(TracePriority.Low,
                            debugCallback, traceCallback, String.Format(
                            ".NET Framework {0} directory {1} does not " +
                            "exist, skipping...", ForDisplay(frameworkVersion),
                            ForDisplay(directory)), traceCategory);

                        continue;
                    }

                    string fileName = Path.Combine(directory, "machine.config");

                    if (!File.Exists(fileName))
                    {
                        TraceOps.DebugAndTrace(TracePriority.Low,
                            debugCallback, traceCallback, String.Format(
                            ".NET Framework {0} file {1} does not exist, " +
                            "skipping...", ForDisplay(frameworkVersion),
                            ForDisplay(fileName)), traceCategory);

                        continue;
                    }

                    bool localSaved = false;

                    if (!callback(
                            fileName, invariantName, name, description,
                            typeName, assemblyName, installDirectory,
                            clientData, perUser, wow64, throwOnMissing,
                            whatIf, verbose, ref localSaved, ref error))
                    {
                        return false;
                    }
                    else
                    {
                        if (localSaved && !saved)
                            saved = true;

                        if (verbose)
                        {
                            TraceOps.DebugAndTrace(TracePriority.Lowest,
                                debugCallback, traceCallback, String.Format(
                                "localSaved = {0}, saved = {1}",
                                ForDisplay(localSaved), ForDisplay(saved)),
                                traceCategory);
                        }
                    }
                }
            }

            return true;
        }

        ///////////////////////////////////////////////////////////////////////

        [MethodImpl(MethodImplOptions.NoInlining)]
        private static bool ForEachFrameworkRegistry(
            MockRegistry registry,
            FrameworkList frameworkList,
            FrameworkRegistryCallback callback,
            string version, /* NOTE: Optional. */
            object clientData,
            bool perUser,
            bool wow64,
            bool throwOnMissing,
            bool whatIf,
            bool verbose,
            ref string error
            )
        {
            if (registry == null)
            {
                error = "invalid registry";
                return false;
            }

            if (frameworkList == null)
            {
                error = "invalid framework list";
                return false;
            }

            MockRegistryKey rootKey = frameworkList.RootKey;

            if (rootKey == null)
            {
                error = "invalid root key";
                return false;
            }

            if (!IsSupportedRootKey(registry, rootKey))
            {
                error = "root key must be per-user or per-machine";
                return false;
            }

            if (frameworkList.Names == null)
            {
                error = "no framework names found";
                return false;
            }

            if (frameworkList.Versions == null)
            {
                error = "no framework versions found";
                return false;
            }

            if (frameworkList.PlatformNames == null)
            {
                error = "no platform names found";
                return false;
            }

            if (frameworkList.Names.Count != frameworkList.PlatformNames.Count)
            {
                error = String.Format("framework name count {0} does not " +
                    "match platform name count {1}", frameworkList.Names.Count,
                    frameworkList.PlatformNames.Count);

                return false;
            }

            for (int index = 0; index < frameworkList.Names.Count; index++)
            {
                //
                // NOTE: Grab the name of the framework (e.g. ".NETFramework")
                //       and the name of the platform (e.g. "WindowsCE").
                //
                string frameworkName = frameworkList.Names[index];
                string platformName = frameworkList.PlatformNames[index];

                //
                // NOTE: Grab the supported versions of this particular
                //       framework.
                //
                VersionList frameworkVersionList;

                if (version != null)
                {
                    //
                    // NOTE: Manual override of the *ONE* framework version
                    //       to process.
                    //
                    frameworkVersionList = new VersionList();
                    frameworkVersionList.Add(new Version(version));
                }
                else
                {
                    if (!frameworkList.Versions.TryGetValue(
                            frameworkName, out frameworkVersionList) ||
                        (frameworkVersionList == null))
                    {
                        continue;
                    }
                }

                foreach (Version frameworkVersion in frameworkVersionList)
                {
                    TraceOps.DebugAndTrace(TracePriority.Lower,
                        debugCallback, traceCallback, String.Format(
                        "frameworkName = {0}, frameworkVersion = {1}, " +
                        "platformName = {2}", ForDisplay(frameworkName),
                        ForDisplay(frameworkVersion),
                        ForDisplay(platformName)), traceCategory);

                    if (!HaveFrameworkRegistry(
                            rootKey, frameworkName, frameworkVersion,
                            platformName, perUser, wow64, whatIf, verbose))
                    {
                        TraceOps.DebugAndTrace(TracePriority.Low,
                            debugCallback, traceCallback, String.Format(
                            ".NET Framework {0} registry not found, " +
                            "skipping...", ForDisplay(frameworkVersion)),
                            traceCategory);

                        continue;
                    }

                    if (callback == null)
                        continue;

                    if (!callback(
                            rootKey, frameworkName, frameworkVersion,
                            platformName, null, clientData, perUser,
                            wow64, throwOnMissing, whatIf, verbose,
                            ref error))
                    {
                        return false;
                    }
                }
            }

            return true;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Per-Visual Studio Version Handling
        private static void InitializeVsList(
            MockRegistryKey rootKey,
            Configuration configuration,
            ref VsList vsList
            )
        {
            if (vsList == null)
                vsList = new VsList();

            if (vsList.RootKey == null)
                vsList.RootKey = rootKey;

            if (vsList.Versions == null)
            {
                vsList.Versions = new VersionList();

                if ((configuration == null) || !configuration.NoVs2005)
                    vsList.Versions.Add(new Version(8, 0)); // 2005

                if ((configuration == null) || !configuration.NoVs2008)
                    vsList.Versions.Add(new Version(9, 0)); // 2008

                if ((configuration == null) || !configuration.NoVs2010)
                    vsList.Versions.Add(new Version(10, 0));// 2010

                if ((configuration == null) || !configuration.NoVs2012)
                    vsList.Versions.Add(new Version(11, 0));// 2012

                if ((configuration == null) || !configuration.NoVs2013)
                    vsList.Versions.Add(new Version(12, 0));// 2013

                if ((configuration == null) || !configuration.NoVs2015)
                    vsList.Versions.Add(new Version(14, 0));// 2015

                if ((configuration == null) || !configuration.NoVs2017)
                    vsList.Versions.Add(new Version(15, 0));// 2017
            }
        }

        ///////////////////////////////////////////////////////////////////////

        private static bool HaveVsVersionDirectory(
            MockRegistryKey rootKey,
            Version vsVersion,
            string suffix,
            bool perUser,
            bool wow64,
            bool whatIf,
            bool verbose,
            ref string installDirectory
            )
        {
            if (vsVersion == null)
                return false;

            string keyName = GetVsKeyName(vsVersion, suffix, perUser, wow64);

            using (MockRegistryKey key = RegistryHelper.OpenSubKey(
                    rootKey, keyName, false, whatIf, verbose))
            {
                if (key == null)
                    return false;

                object value = RegistryHelper.GetValue(
                    key, "InstallDir", null, whatIf, verbose);

                if (!(value is string))
                    return false;

                string directory = (string)value;

                if (String.IsNullOrEmpty(directory))
                    return false;

                if (!Directory.Exists(directory))
                    return false;

                TraceOps.DebugAndTrace(TracePriority.Lower,
                    debugCallback, traceCallback, String.Format(
                    "Visual Studio {0} found in directory {1}.",
                    ForDisplay(vsVersion), ForDisplay(directory)),
                    traceCategory);

                installDirectory = directory;
                return true;
            }
        }

        ///////////////////////////////////////////////////////////////////////

        [MethodImpl(MethodImplOptions.NoInlining)]
        private static bool ForEachVsVersionRegistry(
            MockRegistry registry,
            VsList vsList,
            VisualStudioRegistryCallback callback,
            string suffix,
            Package package,
            object clientData,
            bool perUser,
            bool wow64,
            bool throwOnMissing,
            bool whatIf,
            bool verbose,
            ref string error
            )
        {
            if (registry == null)
            {
                error = "invalid registry";
                return false;
            }

            if (vsList == null)
            {
                error = "invalid VS list";
                return false;
            }

            MockRegistryKey rootKey = vsList.RootKey;

            if (rootKey == null)
            {
                error = "invalid root key";
                return false;
            }

            if (!IsSupportedRootKey(registry, rootKey))
            {
                error = "root key must be per-user or per-machine";
                return false;
            }

            if (vsList.Versions == null)
            {
                error = "no VS versions found";
                return false;
            }

            foreach (Version vsVersion in vsList.Versions)
            {
                TraceOps.DebugAndTrace(TracePriority.Lower,
                    debugCallback, traceCallback, String.Format(
                    "vsVersion = {0}", ForDisplay(vsVersion)),
                    traceCategory);

                string installDirectory = null;

                if (!HaveVsVersionDirectory(
                        rootKey, vsVersion, suffix, perUser, wow64, whatIf,
                        verbose, ref installDirectory))
                {
                    TraceOps.DebugAndTrace(TracePriority.Low,
                        debugCallback, traceCallback, String.Format(
                        "Visual Studio {0} not found, skipping...",
                        ForDisplay(vsVersion)), traceCategory);

                    continue;
                }

                if (callback == null)
                    continue;

                if (!callback(
                        rootKey, vsVersion, suffix, package, installDirectory,
                        clientData, perUser, wow64, throwOnMissing, whatIf,
                        verbose, ref error))
                {
                    return false;
                }
            }

            return true;
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Configuration File Handling
        [MethodImpl(MethodImplOptions.NoInlining)]
        private static bool AddDbProviderFactory(
            string fileName,
            string invariantName,
            string name,
            string description,
            string typeName,
            AssemblyName assemblyName,
            bool whatIf,
            bool verbose,
            ref bool saved,
            ref string error
            )
        {
            bool dirty = false;
            XmlDocument document = new XmlDocument();

            document.PreserveWhitespace = true;
            document.Load(fileName);

            XmlElement addElement = document.SelectSingleNode(
                String.Format(XPathForAddElement, invariantName)) as XmlElement;

            if (addElement == null)
            {
                string[] elementNames = {
                    "system.data", "DbProviderFactories"
                };

                XmlElement previousElement =
                    document.DocumentElement; /* configuration */

                foreach (string elementName in elementNames)
                {
                    addElement = previousElement.SelectSingleNode(
                        elementName) as XmlElement;

                    if (addElement == null)
                    {
                        addElement = document.CreateElement(
                            elementName, String.Empty);

                        previousElement.AppendChild(addElement);
                    }

                    previousElement = addElement;
                }

                addElement = document.CreateElement(
                    "add", String.Empty);

                previousElement.AppendChild(addElement);

                dirty = true;
            }

            if (!String.Equals(addElement.GetAttribute("name"),
                    name, StringComparison.Ordinal))
            {
                addElement.SetAttribute("name", name);
                dirty = true;
            }

            if (!String.Equals(addElement.GetAttribute("invariant"),
                    invariantName, StringComparison.Ordinal))
            {
                addElement.SetAttribute("invariant", invariantName);
                dirty = true;
            }

            if (!String.Equals(addElement.GetAttribute("description"),
                    description, StringComparison.Ordinal))
            {
                addElement.SetAttribute("description", description);
                dirty = true;
            }

            string fullTypeName = String.Format("{0}, {1}",
                typeName, assemblyName);

            if (!String.Equals(addElement.GetAttribute("type"),
                    fullTypeName, StringComparison.Ordinal))
            {
                addElement.SetAttribute("type", fullTypeName);
                dirty = true;
            }

            if (dirty || whatIf)
            {
                if (verbose)
                {
                    TraceOps.DebugAndTrace(TracePriority.Highest,
                        debugCallback, traceCallback, String.Format(
                        "addElement = {0}", ForDisplay(addElement)),
                        traceCategory);
                }

                if (!whatIf)
                    document.Save(fileName);

                filesModified++;

                saved = true;
            }

            return true;
        }

        ///////////////////////////////////////////////////////////////////////

        [MethodImpl(MethodImplOptions.NoInlining)]
        private static bool RemoveDbProviderFactory(
            string fileName,
            string invariantName,
            bool whatIf,
            bool verbose,
            ref bool saved,
            ref string error
            )
        {
            bool dirty = false;
            XmlDocument document = new XmlDocument();

            document.PreserveWhitespace = true;
            document.Load(fileName);

            XmlElement addElement = document.SelectSingleNode(
                String.Format(XPathForAddElement, invariantName)) as XmlElement;

            if (addElement != null)
            {
                addElement.ParentNode.RemoveChild(addElement);
                dirty = true;
            }

            XmlElement removeElement = document.SelectSingleNode(String.Format(
                XPathForRemoveElement, invariantName)) as XmlElement;

            if (removeElement != null)
            {
                removeElement.ParentNode.RemoveChild(removeElement);
                dirty = true;
            }

            if (dirty || whatIf)
            {
                if (verbose)
                {
                    TraceOps.DebugAndTrace(TracePriority.Highest,
                        debugCallback, traceCallback, String.Format(
                        "addElement = {0}, removeElement = {1}",
                        ForDisplay(addElement), ForDisplay(removeElement)),
                        traceCategory);
                }

                if (!whatIf)
                    document.Save(fileName);

                filesModified++;

                saved = true;
            }

            return true;
        }

        ///////////////////////////////////////////////////////////////////////

        private static bool ProcessDbProviderFactory(
            string fileName,
            string invariantName,
            string name,
            string description,
            string typeName,
            AssemblyName assemblyName,
            string directory,
            object clientData,
            bool perUser,
            bool wow64,
            bool throwOnMissing,
            bool whatIf,
            bool verbose,
            ref bool saved,
            ref string error
            )
        {
            AnyPair<string, bool> pair = clientData as AnyPair<string, bool>;

            if (pair == null)
            {
                error = "invalid framework config callback data";
                return false;
            }

            if (pair.Y)
            {
                return RemoveDbProviderFactory(
                    fileName, invariantName, whatIf, verbose, ref saved,
                    ref error) &&
                AddDbProviderFactory(
                    fileName, invariantName, name, description, typeName,
                    assemblyName, whatIf, verbose, ref saved, ref error);
            }
            else
            {
                return RemoveDbProviderFactory(
                    fileName, invariantName, whatIf, verbose, ref saved,
                    ref error);
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Assembly Folders Handling
        private static string GetAssemblyFoldersKeyName(
            string frameworkName,
            Version frameworkVersion,
            string platformName,
            bool perUser,
            bool wow64
            )
        {
            string frameworkVersionString = (frameworkVersion != null) ?
                "v" + frameworkVersion.ToString() : null;

            //
            // NOTE: This registry key appears to always be 32-bit only
            //       (i.e. probably because it is only used by Visual
            //       Studio, which is currently always 32-bit only).
            //
            return RegistryHelper.JoinKeyNames(
                GetRootKeyName(perUser, wow64), "Microsoft", frameworkName,
                frameworkVersionString, platformName, "AssemblyFoldersEx");
        }

        ///////////////////////////////////////////////////////////////////////

        private static bool AddToAssemblyFolders(
            MockRegistryKey rootKey,
            string frameworkName,
            Version frameworkVersion,
            string platformName,
            string subKeyName,
            string directory,
            bool perUser,
            bool wow64,
            bool whatIf,
            bool verbose,
            ref string error
            )
        {
            string keyName = GetAssemblyFoldersKeyName(
                frameworkName, frameworkVersion, platformName, perUser,
                wow64);

            using (MockRegistryKey key = RegistryHelper.OpenSubKey(
                    rootKey, keyName, true, whatIf, verbose))
            {
                if (key == null)
                {
                    error = String.Format(
                        "could not open registry key: {0}",
                        RegistryHelper.JoinKeyNames(rootKey, keyName));

                    return false;
                }

                using (MockRegistryKey subKey = RegistryHelper.CreateSubKey(
                        key, subKeyName, whatIf, verbose))
                {
                    if (subKey == null)
                    {
                        error = String.Format(
                            "could not create registry key: {0}",
                            RegistryHelper.JoinKeyNames(key, subKeyName));

                        return false;
                    }

                    RegistryHelper.SetValue(
                        subKey, null, directory, whatIf, verbose);
                }
            }

            return true;
        }

        ///////////////////////////////////////////////////////////////////////

        private static bool RemoveFromAssemblyFolders(
            MockRegistryKey rootKey,
            string frameworkName,
            Version frameworkVersion,
            string platformName,
            string subKeyName,
            bool perUser,
            bool wow64,
            bool throwOnMissing,
            bool whatIf,
            bool verbose,
            ref string error
            )
        {
            string keyName = GetAssemblyFoldersKeyName(
                frameworkName, frameworkVersion, platformName, perUser,
                wow64);

            using (MockRegistryKey key = RegistryHelper.OpenSubKey(
                    rootKey, keyName, true, whatIf, verbose))
            {
                if (key == null)
                {
                    error = String.Format(
                        "could not open registry key: {0}",
                        RegistryHelper.JoinKeyNames(rootKey, keyName));

                    return false;
                }

                RegistryHelper.DeleteSubKey(
                    key, subKeyName, throwOnMissing, whatIf, verbose);
            }

            return true;
        }

        ///////////////////////////////////////////////////////////////////////

        private static bool ProcessAssemblyFolders(
            MockRegistryKey rootKey,
            string frameworkName,
            Version frameworkVersion,
            string platformName,
            string directory,
            object clientData,
            bool perUser,
            bool wow64,
            bool throwOnMissing,
            bool whatIf,
            bool verbose,
            ref string error
            )
        {
            AnyPair<string, bool> pair = clientData as AnyPair<string, bool>;

            if (pair == null)
            {
                error = "invalid framework callback data";
                return false;
            }

            if (pair.Y)
            {
                return RemoveFromAssemblyFolders(
                    rootKey, frameworkName, frameworkVersion, platformName,
                    LegacyProjectName, perUser, wow64, false, whatIf, verbose,
                    ref error) &&
                AddToAssemblyFolders(
                    rootKey, frameworkName, frameworkVersion, platformName,
                    ProjectName, pair.X, perUser, wow64, whatIf, verbose,
                    ref error);
            }
            else
            {
                return RemoveFromAssemblyFolders(
                    rootKey, frameworkName, frameworkVersion, platformName,
                    ProjectName, perUser, wow64, throwOnMissing, whatIf,
                    verbose, ref error);
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Visual Studio Handling
        private static string GetVsRootKeyName(
            bool perUser,
            bool wow64
            )
        {
            return RegistryHelper.JoinKeyNames(
                GetRootKeyName(perUser, wow64),
                "Microsoft", "VisualStudio");
        }

        ///////////////////////////////////////////////////////////////////////

        private static string GetVsKeyName(
            Version vsVersion,
            string suffix,
            bool perUser,
            bool wow64
            )
        {
            if (vsVersion == null)
                return null;

            return RegistryHelper.JoinKeyNames(
                GetVsRootKeyName(perUser, wow64),
                String.Format("{0}{1}", vsVersion, suffix));
        }

        ///////////////////////////////////////////////////////////////////////

        #region Visual Studio Data Source Handling
        private static bool AddVsDataSource(
            MockRegistryKey rootKey,
            Version vsVersion,
            string suffix,
            Package package,
            bool perUser,
            bool wow64,
            bool whatIf,
            bool verbose,
            ref string error
            )
        {
            if (vsVersion == null)
            {
                error = "invalid VS version";
                return false;
            }

            if (package == null)
            {
                error = "invalid VS package";
                return false;
            }

            string keyName = GetVsKeyName(vsVersion, suffix, perUser, wow64);

            using (MockRegistryKey key = RegistryHelper.OpenSubKey(
                    rootKey, keyName, false, whatIf, verbose))
            {
                if (key == null)
                {
                    error = String.Format(
                        "could not open registry key: {0}",
                        RegistryHelper.JoinKeyNames(rootKey, keyName));

                    return false;
                }

                using (MockRegistryKey subKey = RegistryHelper.OpenSubKey(
                        key, "DataSources", true, whatIf, verbose))
                {
                    if (subKey == null)
                    {
                        error = String.Format(
                            "could not open registry key: {0}",
                            RegistryHelper.JoinKeyNames(key,
                                "DataSources"));

                        return false;
                    }

                    using (MockRegistryKey dataSourceKey =
                            RegistryHelper.CreateSubKey(subKey,
                            package.DataSourceId.ToString(VsIdFormat),
                            whatIf, verbose))
                    {
                        if (dataSourceKey == null)
                        {
                            error = String.Format(
                                "could not create registry key: {0}",
                                RegistryHelper.JoinKeyNames(key,
                                    package.DataSourceId.ToString(
                                        VsIdFormat)));

                            return false;
                        }

                        RegistryHelper.SetValue(
                            dataSourceKey, null, String.Format(
                            "{0} Database File", ProjectName), whatIf,
                            verbose);

                        //
                        // NOTE: This value is new as of 1.0.83.0.
                        //
                        RegistryHelper.SetValue(
                            dataSourceKey, "DefaultProvider",
                            package.DataProviderId.ToString(VsIdFormat),
                            whatIf, verbose);

                        RegistryHelper.CreateSubKey(dataSourceKey,
                            RegistryHelper.JoinKeyNames("SupportingProviders",
                                package.DataProviderId.ToString(VsIdFormat)),
                            whatIf, verbose);
                    }
                }
            }

            return true;
        }

        ///////////////////////////////////////////////////////////////////////

        private static bool RemoveVsDataSource(
            MockRegistryKey rootKey,
            Version vsVersion,
            string suffix,
            Package package,
            bool perUser,
            bool wow64,
            bool whatIf,
            bool verbose,
            ref string error
            )
        {
            if (vsVersion == null)
            {
                error = "invalid VS version";
                return false;
            }

            if (package == null)
            {
                error = "invalid VS package";
                return false;
            }

            string keyName = GetVsKeyName(vsVersion, suffix, perUser, wow64);

            using (MockRegistryKey key = RegistryHelper.OpenSubKey(
                    rootKey, keyName, false, whatIf, verbose))
            {
                if (key == null)
                {
                    error = String.Format(
                        "could not open registry key: {0}",
                        RegistryHelper.JoinKeyNames(rootKey, keyName));

                    return false;
                }

                using (MockRegistryKey subKey = RegistryHelper.OpenSubKey(
                        key, "DataSources", true, whatIf, verbose))
                {
                    if (subKey == null)
                    {
                        error = String.Format(
                            "could not open registry key: {0}",
                            RegistryHelper.JoinKeyNames(key,
                                "DataSources"));

                        return false;
                    }

                    RegistryHelper.DeleteSubKeyTree(
                        subKey, package.DataSourceId.ToString(VsIdFormat),
                        whatIf, verbose);
                }
            }

            return true;
        }

        ///////////////////////////////////////////////////////////////////////

        private static bool ProcessVsDataSource(
            MockRegistryKey rootKey,
            Version vsVersion,
            string suffix,
            Package package,
            string directory,
            object clientData,
            bool perUser,
            bool wow64,
            bool throwOnMissing,
            bool whatIf,
            bool verbose,
            ref string error
            )
        {
            if (package == null)
            {
                error = "invalid VS package";
                return false;
            }

            AnyPair<string, bool> pair = clientData as AnyPair<string, bool>;

            if (pair == null)
            {
                error = "invalid VS callback data";
                return false;
            }

            if (pair.Y)
            {
                return AddVsDataSource(
                    rootKey, vsVersion, suffix, package, perUser, wow64,
                    whatIf, verbose, ref error);
            }
            else
            {
                return RemoveVsDataSource(
                    rootKey, vsVersion, suffix, package, perUser, wow64,
                    whatIf, verbose, ref error);
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Visual Studio Data Provider Handling
        private static bool AddVsDataProvider(
            MockRegistryKey rootKey,
            Version vsVersion,
            string suffix,
            Package package,
            string fileName,
            bool perUser,
            bool wow64,
            bool whatIf,
            bool verbose,
            ref string error
            )
        {
            if (vsVersion == null)
            {
                error = "invalid VS version";
                return false;
            }

            if (package == null)
            {
                error = "invalid VS package";
                return false;
            }

            string keyName = GetVsKeyName(vsVersion, suffix, perUser, wow64);

            using (MockRegistryKey key = RegistryHelper.OpenSubKey(
                    rootKey, keyName, false, whatIf, verbose))
            {
                if (key == null)
                {
                    error = String.Format(
                        "could not open registry key: {0}",
                        RegistryHelper.JoinKeyNames(rootKey, keyName));

                    return false;
                }

                using (MockRegistryKey subKey = RegistryHelper.OpenSubKey(
                        key, "DataProviders", true, whatIf, verbose))
                {
                    if (subKey == null)
                    {
                        error = String.Format(
                            "could not open registry key: {0}",
                            RegistryHelper.JoinKeyNames(key,
                                "DataProviders"));

                        return false;
                    }

                    using (MockRegistryKey dataProviderKey =
                            RegistryHelper.CreateSubKey(subKey,
                            package.DataProviderId.ToString(VsIdFormat),
                            whatIf, verbose))
                    {
                        if (dataProviderKey == null)
                        {
                            error = String.Format(
                                "could not create registry key: {0}",
                                RegistryHelper.JoinKeyNames(key,
                                    package.DataProviderId.ToString(
                                        VsIdFormat)));

                            return false;
                        }

                        RegistryHelper.SetValue(
                            dataProviderKey, null, Description, whatIf,
                            verbose);

                        //
                        // NOTE: This value is new as of 1.0.83.0.  However,
                        //       it should only be set if the package assembly
                        //       and all the assemblies it refers to are being
                        //       placed into the global assembly cache.
                        //
                        if (package.GlobalAssemblyCache)
                        {
                            RegistryHelper.SetValue(
                                dataProviderKey, "Assembly",
                                package.DesignerAssemblyName.ToString(),
                                whatIf, verbose);
                        }

                        //
                        // NOTE: This value is new as of 1.0.83.0.
                        //
                        RegistryHelper.SetValue(
                            dataProviderKey, "AssociatedSource",
                            package.DataSourceId.ToString(VsIdFormat),
                            whatIf, verbose);

                        RegistryHelper.SetValue(
                            dataProviderKey, "InvariantName",
                            package.ProviderInvariantName, whatIf, verbose);

                        RegistryHelper.SetValue(
                            dataProviderKey, "Technology",
                            package.AdoNetTechnologyId.ToString(VsIdFormat),
                            whatIf, verbose);

                        RegistryHelper.SetValue(
                            dataProviderKey, "CodeBase", fileName, whatIf,
                            verbose);

                        RegistryHelper.SetValue(
                            dataProviderKey, "FactoryService",
                            package.ServiceId.ToString(VsIdFormat), whatIf,
                            verbose);

                        RegistryHelper.CreateSubKey(dataProviderKey,
                            RegistryHelper.JoinKeyNames("SupportedObjects",
                                "DataConnectionUIControl"), whatIf, verbose);

                        RegistryHelper.CreateSubKey(dataProviderKey,
                            RegistryHelper.JoinKeyNames("SupportedObjects",
                                "DataConnectionProperties"), whatIf, verbose);

                        RegistryHelper.CreateSubKey(dataProviderKey,
                            RegistryHelper.JoinKeyNames("SupportedObjects",
                                "DataConnectionSupport"), whatIf, verbose);

                        RegistryHelper.CreateSubKey(dataProviderKey,
                            RegistryHelper.JoinKeyNames("SupportedObjects",
                                "DataObjectSupport"), whatIf, verbose);

                        RegistryHelper.CreateSubKey(dataProviderKey,
                            RegistryHelper.JoinKeyNames("SupportedObjects",
                                "DataViewSupport"), whatIf, verbose);
                    }
                }
            }

            return true;
        }

        ///////////////////////////////////////////////////////////////////////

        private static bool RemoveVsDataProvider(
            MockRegistryKey rootKey,
            Version vsVersion,
            string suffix,
            Package package,
            bool perUser,
            bool wow64,
            bool whatIf,
            bool verbose,
            ref string error
            )
        {
            if (vsVersion == null)
            {
                error = "invalid VS version";
                return false;
            }

            string keyName = GetVsKeyName(vsVersion, suffix, perUser, wow64);

            using (MockRegistryKey key = RegistryHelper.OpenSubKey(
                    rootKey, keyName, false, whatIf, verbose))
            {
                if (key == null)
                {
                    error = String.Format(
                        "could not open registry key: {0}",
                        RegistryHelper.JoinKeyNames(rootKey, keyName));

                    return false;
                }

                using (MockRegistryKey subKey = RegistryHelper.OpenSubKey(
                        key, "DataProviders", true, whatIf, verbose))
                {
                    if (subKey == null)
                    {
                        error = String.Format(
                            "could not open registry key: {0}",
                            RegistryHelper.JoinKeyNames(key,
                                "DataProviders"));

                        return false;
                    }

                    RegistryHelper.DeleteSubKeyTree(
                        subKey, package.DataProviderId.ToString(VsIdFormat),
                        whatIf, verbose);
                }
            }

            return true;
        }

        ///////////////////////////////////////////////////////////////////////

        private static bool ProcessVsDataProvider(
            MockRegistryKey rootKey,
            Version vsVersion,
            string suffix,
            Package package,
            string directory,
            object clientData,
            bool perUser,
            bool wow64,
            bool throwOnMissing,
            bool whatIf,
            bool verbose,
            ref string error
            )
        {
            AnyPair<string, bool> pair = clientData as AnyPair<string, bool>;

            if (pair == null)
            {
                error = "invalid VS callback data";
                return false;
            }

            if (pair.Y)
            {
                return AddVsDataProvider(
                    rootKey, vsVersion, suffix, package, pair.X, perUser,
                    wow64, whatIf, verbose, ref error);
            }
            else
            {
                return RemoveVsDataProvider(
                    rootKey, vsVersion, suffix, package, perUser, wow64,
                    whatIf, verbose, ref error);
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Visual Studio Package Handling
        private static void InitializeVsPackage(
            string providerInvariantName,
            string factoryTypeName,
            AssemblyName providerAssemblyName,
            AssemblyName designerAssemblyName,
            bool globalAssemblyCache,
            ref Package package
            )
        {
            if (package == null)
            {
                package = new Package();

                package.ProviderInvariantName = providerInvariantName;
                package.FactoryTypeName = factoryTypeName;
                package.ProviderAssemblyName = providerAssemblyName;
                package.DesignerAssemblyName = designerAssemblyName;
                package.GlobalAssemblyCache = globalAssemblyCache;

                package.AdoNetTechnologyId = new Guid(
                    "77AB9A9D-78B9-4BA7-91AC-873F5338F1D2");

                package.PackageId = new Guid(
                    "DCBE6C8D-0E57-4099-A183-98FF74C64D9C");

                package.ServiceId = new Guid(
                    "DCBE6C8D-0E57-4099-A183-98FF74C64D9D");

                package.DataSourceId = new Guid(
                    "0EBAAB6E-CA80-4B4A-8DDF-CBE6BF058C71");

                package.DataProviderId = new Guid(
                    "0EBAAB6E-CA80-4B4A-8DDF-CBE6BF058C70");
            }
        }

        ///////////////////////////////////////////////////////////////////////

        private static bool AddVsPackage(
            MockRegistryKey rootKey,
            Version vsVersion,
            string suffix,
            Package package,
            string fileName,
            bool perUser,
            bool wow64,
            bool whatIf,
            bool verbose,
            ref string error
            )
        {
            if (vsVersion == null)
            {
                error = "invalid VS version";
                return false;
            }

            if (package == null)
            {
                error = "invalid VS package";
                return false;
            }

            string keyName = GetVsKeyName(vsVersion, suffix, perUser, wow64);

            using (MockRegistryKey key = RegistryHelper.OpenSubKey(
                    rootKey, keyName, false, whatIf, verbose))
            {
                if (key == null)
                {
                    error = String.Format(
                        "could not open registry key: {0}",
                        RegistryHelper.JoinKeyNames(rootKey, keyName));

                    return false;
                }

                using (MockRegistryKey subKey = RegistryHelper.OpenSubKey(
                        key, "Packages", true, whatIf, verbose))
                {
                    if (subKey == null)
                    {
                        error = String.Format(
                            "could not open registry key: {0}",
                            RegistryHelper.JoinKeyNames(key,
                                "Packages"));

                        return false;
                    }

                    //
                    // NOTE: *WARNING* Changing any of these values will likely
                    //       require a new "package load key" (PLK) to be
                    //       generated in order to properly support loading the
                    //       package into Visual Studio 2008 and earlier without
                    //       the matching Visual Studio SDK being installed.
                    //       Please refer to the "SQLite.Designer\plk.txt" file
                    //       for the existing official values and update them if
                    //       necessary.  Also, the newly generated package load
                    //       key itself, which is a 128 character alphanumeric
                    //       string, must be placed in the resource string named
                    //       "400" in the "SQLite.Designer\VSPackage.resx" file
                    //       and then the designer assembly itself must be
                    //       recompiled.  As of this writing (in February 2012),
                    //       the following URL is the proper place to generate
                    //       package load keys:
                    //
                    //       https://msdn.microsoft.com/en-us/vstudio/cc655795
                    //
                    using (MockRegistryKey packageKey =
                            RegistryHelper.CreateSubKey(subKey,
                            package.PackageId.ToString(VsIdFormat), whatIf,
                            verbose))
                    {
                        if (packageKey == null)
                        {
                            error = String.Format(
                                "could not create registry key: {0}",
                                RegistryHelper.JoinKeyNames(key,
                                    package.PackageId.ToString(VsIdFormat)));

                            return false;
                        }

                        RegistryHelper.SetValue(packageKey, null,
                            String.Format("{0} Designer Package", ProjectName),
                            whatIf, verbose);

                        RegistryHelper.SetValue(packageKey, "Class",
                            "SQLite.Designer.SQLitePackage", whatIf, verbose);

                        RegistryHelper.SetValue(packageKey, "CodeBase",
                            fileName, whatIf, verbose);

                        RegistryHelper.SetValue(packageKey, "ID", 400, whatIf,
                            verbose);

                        string directory = GetSystemDirectory(wow64);

                        if (directory == null)
                            directory = String.Empty;

                        RegistryHelper.SetValue(packageKey, "InprocServer32",
                            Path.Combine(directory, "mscoree.dll"),
                            whatIf, verbose);

                        RegistryHelper.SetValue(packageKey, "CompanyName",
                            "https://system.data.sqlite.org/", whatIf, verbose);

                        RegistryHelper.SetValue(packageKey, "MinEdition",
                            "standard", whatIf, verbose);

                        RegistryHelper.SetValue(packageKey, "ProductName",
                            String.Format("{0} Designer Package", ProjectName),
                            whatIf, verbose);

                        RegistryHelper.SetValue(packageKey, "ProductVersion",
                            "1.0", whatIf, verbose);

                        using (MockRegistryKey toolboxKey =
                                RegistryHelper.CreateSubKey(packageKey,
                                "Toolbox", whatIf, verbose))
                        {
                            if (toolboxKey == null)
                            {
                                error = String.Format(
                                    "could not create registry key: {0}",
                                    RegistryHelper.JoinKeyNames(packageKey,
                                        "Toolbox"));

                                return false;
                            }

                            RegistryHelper.SetValue(
                                toolboxKey, "Default Items", 3, whatIf,
                                verbose);
                        }
                    }
                }

                using (MockRegistryKey subKey = RegistryHelper.OpenSubKey(
                        key, "Menus", true, whatIf, verbose))
                {
                    if (subKey == null)
                    {
                        error = String.Format(
                            "could not open registry key: {0}",
                            RegistryHelper.JoinKeyNames(key,
                                "Menus"));

                        return false;
                    }

                    RegistryHelper.SetValue(
                        subKey, package.PackageId.ToString(VsIdFormat),
                        ", 1000, 3", whatIf, verbose);
                }

                using (MockRegistryKey subKey = RegistryHelper.OpenSubKey(
                        key, "Services", true, whatIf, verbose))
                {
                    if (subKey == null)
                    {
                        error = String.Format(
                            "could not open registry key: {0}",
                            RegistryHelper.JoinKeyNames(key,
                                "Services"));

                        return false;
                    }

                    using (MockRegistryKey serviceKey =
                            RegistryHelper.CreateSubKey(subKey,
                            package.ServiceId.ToString(VsIdFormat), whatIf,
                            verbose))
                    {
                        if (serviceKey == null)
                        {
                            error = String.Format(
                                "could not create registry key: {0}",
                                RegistryHelper.JoinKeyNames(key,
                                    package.ServiceId.ToString(VsIdFormat)));

                            return false;
                        }

                        RegistryHelper.SetValue(serviceKey, null,
                            package.PackageId.ToString(VsIdFormat), whatIf,
                            verbose);

                        RegistryHelper.SetValue(serviceKey, "Name",
                            String.Format("{0} Designer Service", ProjectName),
                            whatIf, verbose);
                    }
                }
            }

            return true;
        }

        ///////////////////////////////////////////////////////////////////////

        private static bool RemoveVsPackage(
            MockRegistryKey rootKey,
            Version vsVersion,
            string suffix,
            Package package,
            bool perUser,
            bool wow64,
            bool throwOnMissing,
            bool whatIf,
            bool verbose,
            ref string error
            )
        {
            if (vsVersion == null)
            {
                error = "invalid VS version";
                return false;
            }

            if (package == null)
            {
                error = "invalid VS package";
                return false;
            }

            string keyName = GetVsKeyName(vsVersion, suffix, perUser, wow64);

            using (MockRegistryKey key = RegistryHelper.OpenSubKey(
                    rootKey, keyName, false, whatIf, verbose))
            {
                if (key == null)
                {
                    error = String.Format(
                        "could not open registry key: {0}",
                        RegistryHelper.JoinKeyNames(rootKey, keyName));

                    return false;
                }

                using (MockRegistryKey subKey = RegistryHelper.OpenSubKey(
                        key, "Packages", true, whatIf, verbose))
                {
                    if (subKey == null)
                    {
                        error = String.Format(
                            "could not open registry key: {0}",
                            RegistryHelper.JoinKeyNames(key,
                                "Packages"));

                        return false;
                    }

                    RegistryHelper.DeleteSubKeyTree(
                        subKey, package.PackageId.ToString(VsIdFormat),
                        whatIf, verbose);
                }

                using (MockRegistryKey subKey = RegistryHelper.OpenSubKey(
                        key, "Menus", true, whatIf, verbose))
                {
                    if (subKey == null)
                    {
                        error = String.Format(
                            "could not open registry key: {0}",
                            RegistryHelper.JoinKeyNames(key,
                                "Menus"));

                        return false;
                    }

                    RegistryHelper.DeleteValue(
                        subKey, package.PackageId.ToString(VsIdFormat),
                        throwOnMissing, whatIf, verbose);
                }

                using (MockRegistryKey subKey = RegistryHelper.OpenSubKey(
                        key, "Services", true, whatIf, verbose))
                {
                    if (subKey == null)
                    {
                        error = String.Format(
                            "could not open registry key: {0}",
                            RegistryHelper.JoinKeyNames(key,
                                "Services"));

                        return false;
                    }

                    RegistryHelper.DeleteSubKeyTree(
                        subKey, package.ServiceId.ToString(VsIdFormat),
                        whatIf, verbose);
                }
            }

            return true;
        }

        ///////////////////////////////////////////////////////////////////////

        private static bool ProcessVsPackage(
            MockRegistryKey rootKey,
            Version vsVersion,
            string suffix,
            Package package,
            string directory,
            object clientData,
            bool perUser,
            bool wow64,
            bool throwOnMissing,
            bool whatIf,
            bool verbose,
            ref string error
            )
        {
            AnyPair<string, bool> pair = clientData as AnyPair<string, bool>;

            if (pair == null)
            {
                error = "invalid VS callback data";
                return false;
            }

            if (pair.Y)
            {
                return AddVsPackage(
                    rootKey, vsVersion, suffix, package, pair.X, perUser,
                    wow64, whatIf, verbose, ref error);
            }
            else
            {
                return RemoveVsPackage(
                    rootKey, vsVersion, suffix, package, perUser, wow64,
                    throwOnMissing, whatIf, verbose, ref error);
            }
        }
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Visual Studio Setup Handling
        private static void VsDevEnvSetupOutputDataReceived(
            object sender,
            DataReceivedEventArgs e
            )
        {
            Process process = sender as Process;

            TraceOps.DebugAndTrace(TracePriority.Medium,
                debugCallback, traceCallback, String.Format(
                VsDevEnvSetupFormat, ForDisplay(process),
                ForDisplay(e)), traceCategory);
        }

        ///////////////////////////////////////////////////////////////////////

        private static void VsDevEnvSetupErrorDataReceived(
            object sender,
            DataReceivedEventArgs e
            )
        {
            Process process = sender as Process;

            TraceOps.DebugAndTrace(TracePriority.Medium,
                debugCallback, traceCallback, String.Format(
                VsDevEnvSetupFormat, ForDisplay(process),
                ForDisplay(e)), traceCategory);
        }

        ///////////////////////////////////////////////////////////////////////

        [MethodImpl(MethodImplOptions.NoInlining)]
        private static bool AddVsDevEnvSetup(
            Version vsVersion,
            string directory,
            bool perUser,
            bool whatIf,
            bool verbose,
            ref string error
            )
        {
            if (perUser)
            {
                //
                // NOTE: Visual Studio does not support running in 'setup'
                //       mode on a per-user basis; therefore, skip running
                //       it in that case.
                //
                TraceOps.DebugAndTrace(TracePriority.Medium,
                    debugCallback, traceCallback, String.Format(
                    "Visual Studio {0} 'setup' mode is per-machine only, " +
                    "skipping...", ForDisplay(vsVersion)), traceCategory);

                return true;
            }

            ProcessStartInfo startInfo = new ProcessStartInfo();

            //
            // NOTE: Set the core properties for the process to start.  In this
            //       case, we are starting the primary Visual Studio executable
            //       (devenv.exe) in "setup" mode, so that it can refresh its
            //       list of installed packages and their associated resources.
            //
            startInfo.FileName = Path.Combine(directory, "devenv.exe");
            startInfo.Arguments = "/setup";
            startInfo.WorkingDirectory = directory;

            //
            // NOTE: Set the boolean flag properties that require non-default
            //       values for the process to start.  In this case, we do not
            //       want the shell to be used for starting the process.  In
            //       addition, both standard output and error data should be
            //       redirected, so it can be logged properly.
            //
            startInfo.UseShellExecute = false;
            startInfo.RedirectStandardOutput = true;
            startInfo.RedirectStandardError = true;

            Process process = new Process();

            process.StartInfo = startInfo;

            process.OutputDataReceived += new DataReceivedEventHandler(
                VsDevEnvSetupOutputDataReceived);

            process.ErrorDataReceived += new DataReceivedEventHandler(
                VsDevEnvSetupErrorDataReceived);

            if (verbose)
            {
                TraceOps.DebugAndTrace(TracePriority.Highest,
                    debugCallback, traceCallback, ForDisplay(startInfo),
                    traceCategory);
            }

            //
            // NOTE: In "what-if" mode, do not actually start the process.
            //
            if (!whatIf)
            {
                process.Start();

                if (verbose)
                {
                    TraceOps.DebugAndTrace(TracePriority.Highest,
                        debugCallback, traceCallback, String.Format(
                        "process = {0}", ForDisplay(process)),
                        traceCategory);
                }

                process.BeginOutputReadLine();
                process.BeginErrorReadLine();
                process.WaitForExit();
            }

            return true;
        }

        ///////////////////////////////////////////////////////////////////////

        [MethodImpl(MethodImplOptions.NoInlining)]
        private static bool RemoveVsDevEnvSetup(
            Version vsVersion,
            string directory,
            bool perUser,
            bool whatIf,
            bool verbose,
            ref string error
            )
        {
            //
            // NOTE: Since Visual Studio does not have an 'undo' operation for
            //       its 'setup' mode, simply execute the same command again.
            //       This should force it to refresh its list of installed
            //       packages and their associated resources (i.e. this will
            //       effectively 'remove' the package being processed since
            //       this is being done after all the other changes for the
            //       package removal have been completed).
            //
            if (verbose)
            {
                TraceOps.DebugAndTrace(TracePriority.Highest,
                    debugCallback, traceCallback, String.Format(
                    "Preparing to run Visual Studio {0} 'setup' mode to " +
                    "refresh its configuration.", ForDisplay(vsVersion)),
                    traceCategory);
            }

            return AddVsDevEnvSetup(
                vsVersion, directory, perUser, whatIf, verbose, ref error);
        }

        ///////////////////////////////////////////////////////////////////////

        private static bool ProcessVsDevEnvSetup(
            MockRegistryKey rootKey,
            Version vsVersion,
            string suffix,
            Package package,
            string directory,
            object clientData,
            bool perUser,
            bool wow64,
            bool throwOnMissing,
            bool whatIf,
            bool verbose,
            ref string error
            )
        {
            AnyPair<string, bool> pair = clientData as AnyPair<string, bool>;

            if (pair == null)
            {
                error = "invalid VS callback data";
                return false;
            }

            if (pair.Y)
            {
                return AddVsDevEnvSetup(
                    vsVersion, directory, perUser, whatIf, verbose, ref error);
            }
            else
            {
                return RemoveVsDevEnvSetup(
                    vsVersion, directory, perUser, whatIf, verbose, ref error);
            }
        }
        #endregion
        #endregion

        ///////////////////////////////////////////////////////////////////////

        #region Installer Entry Point
        [MethodImpl(MethodImplOptions.NoInlining)]
        private static int Main(
            string[] args
            )
        {
            #region Debugger Hook
            if (Environment.GetEnvironmentVariable("Break") != null)
                Configuration.BreakIntoDebugger();
            #endregion

            ///////////////////////////////////////////////////////////////////

            try
            {
                Configuration configuration = null;
                string error = null;

                ///////////////////////////////////////////////////////////////

                #region Command Line Processing
                if (!Configuration.FromArgs(
                        args, true, ref configuration, ref error) ||
                    !Configuration.Process(
                        args, configuration, true, ref error) ||
                    !Configuration.CheckRuntimeVersion(
                        configuration, true, ref error))
                {
                    TraceOps.ShowMessage(TracePriority.Highest,
                        debugCallback, traceCallback, thisAssembly,
                        error, traceCategory, MessageBoxButtons.OK,
                        MessageBoxIcon.Error);

                    TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                        debugCallback, traceCallback, "Failure.",
                        traceCategory);

                    return 1; /* FAILURE */
                }
                #endregion

                ///////////////////////////////////////////////////////////////

                #region Error Message for Visual Studio 2017
                if (!configuration.NoVs2017)
                {
                    error = "Visual Studio 2017 is not supported, " +
                        "please see \"https://urn.to/r/vs2017_ddex\" " +
                        "for more information.";

                    TraceOps.ShowMessage(TracePriority.Highest,
                        debugCallback, traceCallback, thisAssembly,
                        error, traceCategory, MessageBoxButtons.OK,
                        MessageBoxIcon.Error);

                    TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                        debugCallback, traceCallback, "Failure.",
                        traceCategory);

                    return 1; /* FAILURE */
                }
                #endregion

                ///////////////////////////////////////////////////////////////

                //
                // NOTE: Setup the "mock" registry per the "what-if" mode.
                //       Since all registry access performed by this installer
                //       uses this "mock" registry, it is impossible for any
                //       actual system changes to occur unless "what-if" mode
                //       is disabled.  Furthermore, protections are in place
                //       to prevent direct access to the wrapped registry keys
                //       when "safe" mode is enabled.
                //
                using (MockRegistry registry = new MockRegistry(
                        configuration.WhatIf, false, false))
                {
                    #region Assembly Name Checks
                    //
                    // NOTE: Query all the assembly names first, before making
                    //       any changes to the system, because these calls
                    //       will throw exceptions if any of the file names do
                    //       not point to a valid managed assembly.  The values
                    //       of these local variables are never used after this
                    //       point; however, do not remove them.
                    //
                    AssemblyName coreAssemblyName =
                        configuration.GetCoreAssemblyName(true); /* NOT USED */

                    AssemblyName linqAssemblyName =
                        configuration.GetLinqAssemblyName(true); /* NOT USED */

                    AssemblyName ef6AssemblyName =
                        configuration.GetEf6AssemblyName(true); /* NOT USED */

                    AssemblyName designerAssemblyName =
                        configuration.GetDesignerAssemblyName(true); /* NOT USED */
                    #endregion

                    ///////////////////////////////////////////////////////////

                    #region System Directory Check
                    //
                    // NOTE: Getting the system directory value here serves
                    //       two purposes:
                    //
                    //       1. It enables us to log the system directory
                    //          value very early in the installation process
                    //          (i.e. even though the value itself is not
                    //          needed until much later).
                    //
                    //       2. Since the value is cached, it prevents an
                    //          exception from being thrown much later during
                    //          the install when the value is queried again
                    //          (i.e. with the same value for the "wow64"
                    //          parameter).
                    //
                    TraceOps.DebugAndTrace(TracePriority.MediumLow,
                        debugCallback, traceCallback, String.Format(
                        "System directory is {0}.", ForDisplay(
                        GetSystemDirectory(configuration.Wow64))),
                        traceCategory); /* throw */
                    #endregion

                    ///////////////////////////////////////////////////////////

                    #region .NET Framework / Visual Studio Data
                    Package package = null;
                    FrameworkList frameworkList = null;
                    VsList vsList = null;

                    ///////////////////////////////////////////////////////////

                    InitializeVsPackage(
                        configuration.GetProviderInvariantName(true),
                        configuration.GetFactoryTypeName(true),
                        configuration.GetProviderAssemblyName(true),
                        configuration.GetDesignerAssemblyName(true),
                        configuration.HasFlags(
                            InstallFlags.AllGlobalAssemblyCache, true) &&
                        configuration.HasFlags(
                            InstallFlags.VsPackageGlobalAssemblyCache, true),
                        ref package);

                    ///////////////////////////////////////////////////////////

                    InitializeFrameworkList(configuration.PerUser ?
                        registry.CurrentUser : registry.LocalMachine,
                        configuration, ref frameworkList);

                    InitializeVsList(configuration.PerUser ?
                        registry.CurrentUser : registry.LocalMachine,
                        configuration, ref vsList);
                    #endregion

                    ///////////////////////////////////////////////////////////

                    #region Shared Client Data Creation
                    object directoryData = new AnyPair<string, bool>(
                        configuration.Directory, configuration.Install);

                    object fileNameData = new AnyPair<string, bool>(
                        configuration.DesignerFileName, configuration.Install);
                    #endregion

                    ///////////////////////////////////////////////////////////

                    #region .NET GAC Install/Remove
                    if (configuration.HasFlags(
                            InstallFlags.AllGlobalAssemblyCache, false))
                    {
                        Publish publish = null;

                        if (!configuration.WhatIf)
                            publish = new Publish();

                        if (configuration.Install)
                        {
                            if (configuration.HasFlags(
                                    InstallFlags.CoreGlobalAssemblyCache,
                                    true))
                            {
                                if (!configuration.WhatIf)
                                {
                                    /* throw */
                                    publish.GacInstall(
                                        configuration.CoreFileName);
                                }

                                TraceOps.DebugAndTrace(TracePriority.Highest,
                                    debugCallback, traceCallback, String.Format(
                                    "GacInstall: assemblyPath = {0}",
                                    ForDisplay(configuration.CoreFileName)),
                                    traceCategory);
                            }

                            ///////////////////////////////////////////////////

                            if (configuration.HasFlags(
                                    InstallFlags.LinqGlobalAssemblyCache,
                                    true) &&
                                configuration.IsLinqSupported(true))
                            {
                                if (!configuration.WhatIf)
                                {
                                    /* throw */
                                    publish.GacInstall(
                                        configuration.LinqFileName);
                                }

                                TraceOps.DebugAndTrace(TracePriority.Highest,
                                    debugCallback, traceCallback, String.Format(
                                    "GacInstall: assemblyPath = {0}",
                                    ForDisplay(configuration.LinqFileName)),
                                    traceCategory);
                            }

                            ///////////////////////////////////////////////////

                            if (configuration.HasFlags(
                                    InstallFlags.Ef6GlobalAssemblyCache,
                                    true) &&
                                configuration.IsEf6Supported(true))
                            {
                                if (!configuration.WhatIf)
                                {
                                    /* throw */
                                    publish.GacInstall(
                                        configuration.Ef6FileName);
                                }

                                TraceOps.DebugAndTrace(TracePriority.Highest,
                                    debugCallback, traceCallback, String.Format(
                                    "GacInstall: assemblyPath = {0}",
                                    ForDisplay(configuration.Ef6FileName)),
                                    traceCategory);
                            }

                            ///////////////////////////////////////////////////

                            if (configuration.HasFlags(
                                    InstallFlags.VsPackageGlobalAssemblyCache,
                                    true))
                            {
                                if (!configuration.WhatIf)
                                {
                                    /* throw */
                                    publish.GacInstall(
                                        configuration.DesignerFileName);
                                }

                                TraceOps.DebugAndTrace(TracePriority.Highest,
                                    debugCallback, traceCallback, String.Format(
                                    "GacInstall: assemblyPath = {0}",
                                    ForDisplay(configuration.DesignerFileName)),
                                    traceCategory);
                            }
                        }
                        else
                        {
                            if (configuration.HasFlags(
                                    InstallFlags.VsPackageGlobalAssemblyCache,
                                    true))
                            {
                                if (!configuration.WhatIf)
                                {
                                    /* throw */
                                    publish.GacRemove(
                                        configuration.DesignerFileName);
                                }

                                TraceOps.DebugAndTrace(TracePriority.Highest,
                                    debugCallback, traceCallback, String.Format(
                                    "GacRemove: assemblyPath = {0}",
                                    ForDisplay(configuration.DesignerFileName)),
                                    traceCategory);
                            }

                            ///////////////////////////////////////////////////

                            if (configuration.HasFlags(
                                    InstallFlags.Ef6GlobalAssemblyCache,
                                    true) &&
                                configuration.IsEf6Supported(true))
                            {
                                if (!configuration.WhatIf)
                                {
                                    /* throw */
                                    publish.GacRemove(
                                        configuration.Ef6FileName);
                                }

                                TraceOps.DebugAndTrace(TracePriority.Highest,
                                    debugCallback, traceCallback, String.Format(
                                    "GacRemove: assemblyPath = {0}",
                                    ForDisplay(configuration.Ef6FileName)),
                                    traceCategory);
                            }

                            ///////////////////////////////////////////////////

                            if (configuration.HasFlags(
                                    InstallFlags.LinqGlobalAssemblyCache,
                                    true) &&
                                configuration.IsLinqSupported(true))
                            {
                                if (!configuration.WhatIf)
                                {
                                    /* throw */
                                    publish.GacRemove(
                                        configuration.LinqFileName);
                                }

                                TraceOps.DebugAndTrace(TracePriority.Highest,
                                    debugCallback, traceCallback, String.Format(
                                    "GacRemove: assemblyPath = {0}",
                                    ForDisplay(configuration.LinqFileName)),
                                    traceCategory);
                            }

                            ///////////////////////////////////////////////////

                            if (configuration.HasFlags(
                                    InstallFlags.CoreGlobalAssemblyCache,
                                    true))
                            {
                                if (!configuration.WhatIf)
                                {
                                    /* throw */
                                    publish.GacRemove(
                                        configuration.CoreFileName);
                                }

                                TraceOps.DebugAndTrace(TracePriority.Highest,
                                    debugCallback, traceCallback, String.Format(
                                    "GacRemove: assemblyPath = {0}",
                                    ForDisplay(configuration.CoreFileName)),
                                    traceCategory);
                            }
                        }
                    }
                    #endregion

                    ///////////////////////////////////////////////////////////

                    #region .NET AssemblyFolders
                    if (configuration.HasFlags(
                            InstallFlags.AssemblyFolders, true))
                    {
                        if (!ForEachFrameworkRegistry(registry,
                                frameworkList, ProcessAssemblyFolders,
                                configuration.RegistryVersion, directoryData,
                                configuration.PerUser,
                                NetFxIs32BitOnly || configuration.Wow64,
                                configuration.ThrowOnMissing,
                                configuration.WhatIf, configuration.Verbose,
                                ref error))
                        {
                            TraceOps.ShowMessage(TracePriority.Highest,
                                debugCallback, traceCallback, thisAssembly,
                                error, traceCategory, MessageBoxButtons.OK,
                                MessageBoxIcon.Error);

                            TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                                debugCallback, traceCallback, "Failure.",
                                traceCategory);

                            return 1; /* FAILURE */
                        }
                    }
                    #endregion

                    ///////////////////////////////////////////////////////////

                    #region .NET DbProviderFactory
                    if (configuration.HasFlags(
                            InstallFlags.DbProviderFactory, true))
                    {
                        bool saved = false;

                        if (!ForEachFrameworkConfig(registry,
                                frameworkList, ProcessDbProviderFactory,
                                configuration.ConfigVersion,
                                configuration.GetConfigInvariantName(true),
                                ProviderName, Description,
                                package.FactoryTypeName,
                                package.ProviderAssemblyName, directoryData,
                                configuration.PerUser,
                                NetFxIs32BitOnly || configuration.Wow64,
                                configuration.ThrowOnMissing,
                                configuration.WhatIf, configuration.Verbose,
                                ref saved, ref error))
                        {
                            TraceOps.ShowMessage(TracePriority.Highest,
                                debugCallback, traceCallback, thisAssembly,
                                error, traceCategory, MessageBoxButtons.OK,
                                MessageBoxIcon.Error);

                            TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                                debugCallback, traceCallback, "Failure.",
                                traceCategory);

                            return 1; /* FAILURE */
                        }
                    }
                    #endregion

                    ///////////////////////////////////////////////////////////

                    #region VS Package
                    if (configuration.HasFlags(
                            InstallFlags.VsPackage, true))
                    {
                        if (!ForEachVsVersionRegistry(registry,
                                vsList, ProcessVsPackage,
                                configuration.VsVersionSuffix, package,
                                fileNameData, configuration.PerUser,
                                VsIs32BitOnly || configuration.Wow64,
                                configuration.ThrowOnMissing,
                                configuration.WhatIf, configuration.Verbose,
                                ref error))
                        {
                            TraceOps.ShowMessage(TracePriority.Highest,
                                debugCallback, traceCallback, thisAssembly,
                                error, traceCategory, MessageBoxButtons.OK,
                                MessageBoxIcon.Error);

                            TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                                debugCallback, traceCallback, "Failure.",
                                traceCategory);

                            return 1; /* FAILURE */
                        }
                    }
                    #endregion

                    ///////////////////////////////////////////////////////////

                    #region VS DataSource
                    if (configuration.HasFlags(
                            InstallFlags.VsDataSource, true))
                    {
                        if (!ForEachVsVersionRegistry(registry,
                                vsList, ProcessVsDataSource,
                                configuration.VsVersionSuffix, package,
                                fileNameData, configuration.PerUser,
                                VsIs32BitOnly || configuration.Wow64,
                                configuration.ThrowOnMissing,
                                configuration.WhatIf, configuration.Verbose,
                                ref error))
                        {
                            TraceOps.ShowMessage(TracePriority.Highest,
                                debugCallback, traceCallback, thisAssembly,
                                error, traceCategory, MessageBoxButtons.OK,
                                MessageBoxIcon.Error);

                            TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                                debugCallback, traceCallback, "Failure.",
                                traceCategory);

                            return 1; /* FAILURE */
                        }
                    }
                    #endregion

                    ///////////////////////////////////////////////////////////

                    #region VS DataProvider
                    if (configuration.HasFlags(
                            InstallFlags.VsDataProvider, true))
                    {
                        if (!ForEachVsVersionRegistry(registry,
                                vsList, ProcessVsDataProvider,
                                configuration.VsVersionSuffix, package,
                                fileNameData, configuration.PerUser,
                                VsIs32BitOnly || configuration.Wow64,
                                configuration.ThrowOnMissing,
                                configuration.WhatIf, configuration.Verbose,
                                ref error))
                        {
                            TraceOps.ShowMessage(TracePriority.Highest,
                                debugCallback, traceCallback, thisAssembly,
                                error, traceCategory, MessageBoxButtons.OK,
                                MessageBoxIcon.Error);

                            TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                                debugCallback, traceCallback, "Failure.",
                                traceCategory);

                            return 1; /* FAILURE */
                        }
                    }
                    #endregion

                    ///////////////////////////////////////////////////////////

                    #region VS DevEnv Setup
                    if (configuration.HasFlags(
                            InstallFlags.VsDevEnvSetup, true))
                    {
                        if (!ForEachVsVersionRegistry(registry,
                                vsList, ProcessVsDevEnvSetup,
                                configuration.VsVersionSuffix, package,
                                fileNameData, configuration.PerUser,
                                VsIs32BitOnly || configuration.Wow64,
                                configuration.ThrowOnMissing,
                                configuration.WhatIf, configuration.Verbose,
                                ref error))
                        {
                            TraceOps.ShowMessage(TracePriority.Highest,
                                debugCallback, traceCallback, thisAssembly,
                                error, traceCategory, MessageBoxButtons.OK,
                                MessageBoxIcon.Error);

                            TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                                debugCallback, traceCallback, "Failure.",
                                traceCategory);

                            return 1; /* FAILURE */
                        }
                    }
                    #endregion

                    ///////////////////////////////////////////////////////////

                    #region Log Summary
                    TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                        debugCallback, traceCallback, String.Format(
                        "subKeysCreated = {0}, subKeysDeleted = {1}, " +
                        "keyValuesRead = {2}, keyValuesWritten = {3}, " +
                        "keyValuesDeleted = {4}",
                        ForDisplay(RegistryHelper.SubKeysCreated),
                        ForDisplay(RegistryHelper.SubKeysDeleted),
                        ForDisplay(RegistryHelper.KeyValuesRead),
                        ForDisplay(RegistryHelper.KeyValuesWritten),
                        ForDisplay(RegistryHelper.KeyValuesDeleted)),
                        traceCategory);

                    TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                        debugCallback, traceCallback, String.Format(
                        "filesCreated = {0}, filesModified = {1}, " +
                        "filesDeleted = {2}", ForDisplay(filesCreated),
                        ForDisplay(filesModified), ForDisplay(filesDeleted)),
                        traceCategory);
                    #endregion

                    ///////////////////////////////////////////////////////////

                    #region Write Registry Log (Optional)
                    //
                    // NOTE: If applicable, write the list of registry write
                    //       operations now.
                    //
                    RegistryHelper.WriteOperationList(
                        configuration.RegistryLogFileName, true,
                        configuration.Verbose);

                    RegistryHelper.EnableOrDisableOperationList(false);
                    #endregion

                    ///////////////////////////////////////////////////////////

                    TraceOps.DebugAndTrace(TracePriority.MediumHigh,
                        debugCallback, traceCallback, "Success.",
                        traceCategory);

                    return 0; /* SUCCESS */
                }
            }
            catch (Exception e)
            {
                TraceOps.DebugAndTrace(TracePriority.Highest,
                    debugCallback, traceCallback, e, traceCategory);

                throw;
            }
        }
        #endregion
    }
    #endregion
}

Deleted tools/install/Program.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace install
{
  static class Program
  {
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    [STAThread]
    static void Main()
    {
      Application.EnableVisualStyles();
      Application.SetCompatibleTextRenderingDefault(false);
      Environment.CurrentDirectory = System.IO.Path.GetDirectoryName(Application.ExecutablePath);

      InstallDesigner designer = new InstallDesigner();
      if (designer._remove == false)
        designer.ShowDialog();
    }
  }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































Changes to tools/install/Properties/AssemblyInfo.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13


14

15

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SQLite Installer")]
[assembly: AssemblyDescription("SQLite ADO.NET 2.0 Design-Time Installer")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("http://sqlite.phxsoftware.com")]
[assembly: AssemblyProduct("SQLite Installer")]
[assembly: AssemblyCopyright("Public Domain")]


[assembly: AssemblyTrademark("")]

[assembly: AssemblyCulture("")]


// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
[assembly: AssemblyVersion("1.0.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]

<





|
<
|
|
|

>
>
|
>
|
>













|
|
1

2
3
4
5
6
7

8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System.Reflection;

using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following 
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("System.Data.SQLite Designer Installer")]

[assembly: AssemblyDescription("ADO.NET Data Provider for SQLite")]
[assembly: AssemblyCompany("https://system.data.sqlite.org/")]
[assembly: AssemblyProduct("System.Data.SQLite")]
[assembly: AssemblyCopyright("Public Domain")]

#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif

// Setting ComVisible to false makes the types in this assembly not visible 
// to COM components.  If you need to access a type in this assembly from 
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//      Build Number
//      Revision
//
[assembly: AssemblyVersion("1.0.119.0")]
[assembly: AssemblyFileVersion("1.0.119.0")]

Deleted tools/install/Properties/Resources.Designer.cs.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:2.0.50727.3053
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace install.Properties {
    using System;
    
    
    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class Resources {
        
        private static global::System.Resources.ResourceManager resourceMan;
        
        private static global::System.Globalization.CultureInfo resourceCulture;
        
        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resources() {
        }
        
        /// <summary>
        ///   Returns the cached ResourceManager instance used by this class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("install.Properties.Resources", typeof(Resources).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }
        
        /// <summary>
        ///   Overrides the current thread's CurrentUICulture property for all
        ///   resource lookups using this strongly typed resource class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }
        
        internal static byte[] System_Data_SQLite {
            get {
                object obj = ResourceManager.GetObject("System_Data_SQLite", resourceCulture);
                return ((byte[])(obj));
            }
        }
    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































Deleted tools/install/Properties/Resources.resx.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!-- 
    Microsoft ResX Schema 
    
    Version 2.0
    
    The primary goals of this format is to allow a simple XML format 
    that is mostly human readable. The generation and parsing of the 
    various data types are done through the TypeConverter classes 
    associated with the data types.
    
    Example:
    
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
                
    There are any number of "resheader" rows that contain simple 
    name/value pairs.
    
    Each data row contains a name, and value. The row also contains a 
    type or mimetype. Type corresponds to a .NET class that support 
    text/value conversion through the TypeConverter architecture. 
    Classes that don't support this are serialized and stored with the 
    mimetype set.
    
    The mimetype is used for serialized objects, and tells the 
    ResXResourceReader how to depersist the object. This is currently not 
    extensible. For a given mimetype the value must be set accordingly:
    
    Note - application/x-microsoft.net.object.binary.base64 is the format 
    that the ResXResourceWriter will generate, however the reader can 
    read any of the formats listed below.
    
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
    
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with 
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array 
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  <data name="System_Data_SQLite" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>..\Resources\System.Data.SQLite.dll;System.Byte[], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </data>
</root>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
























































































































































































































































Deleted tools/install/Resources/System.Data.SQLite.dll.

cannot compute difference between binary files

Added tools/install/Resources/manifest.xml.





















>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="requireAdministrator" />
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>

Deleted tools/install/install.csproj.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProductVersion>9.0.30729</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{71EED886-B5BF-488E-A4AA-1403E393D224}</ProjectGuid>
    <OutputType>WinExe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>install</RootNamespace>
    <AssemblyName>install</AssemblyName>
    <FileUpgradeFlags>
    </FileUpgradeFlags>
    <OldToolsVersion>2.0</OldToolsVersion>
    <UpgradeBackupLocation>
    </UpgradeBackupLocation>
    <PublishUrl>http://localhost/install/</PublishUrl>
    <Install>true</Install>
    <InstallFrom>Web</InstallFrom>
    <UpdateEnabled>true</UpdateEnabled>
    <UpdateMode>Foreground</UpdateMode>
    <UpdateInterval>7</UpdateInterval>
    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
    <UpdatePeriodically>false</UpdatePeriodically>
    <UpdateRequired>false</UpdateRequired>
    <MapFileExtensions>true</MapFileExtensions>
    <ApplicationRevision>0</ApplicationRevision>
    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
    <IsWebBootstrapper>true</IsWebBootstrapper>
    <UseApplicationTrust>false</UseApplicationTrust>
    <BootstrapperEnabled>true</BootstrapperEnabled>
    <ApplicationManifest>install.exe.manifest</ApplicationManifest>
    <ApplicationIcon>install.ico</ApplicationIcon>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>..\..\bin\designer\</OutputPath>
    <DefineConstants>TRACE;DEBUG</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <PlatformTarget>x86</PlatformTarget>
    <UseVSHostingProcess>false</UseVSHostingProcess>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugType>none</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>..\..\bin\designer\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <FileAlignment>512</FileAlignment>
    <PlatformTarget>x86</PlatformTarget>
    <UseVSHostingProcess>false</UseVSHostingProcess>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Data" />
    <Reference Include="System.Deployment" />
    <Reference Include="System.Drawing" />
    <Reference Include="System.Windows.Forms" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="GACWrap.cs">
      <SubType>Code</SubType>
    </Compile>
    <Compile Include="InstallDesigner.cs">
      <SubType>Form</SubType>
    </Compile>
    <Compile Include="InstallDesigner.Designer.cs">
      <DependentUpon>InstallDesigner.cs</DependentUpon>
    </Compile>
    <Compile Include="Program.cs">
    </Compile>
    <Compile Include="Properties\AssemblyInfo.cs" />
    <Compile Include="Properties\Resources.Designer.cs">
      <AutoGen>True</AutoGen>
      <DesignTime>True</DesignTime>
      <DependentUpon>Resources.resx</DependentUpon>
    </Compile>
    <EmbeddedResource Include="InstallDesigner.resx">
      <SubType>Designer</SubType>
      <DependentUpon>InstallDesigner.cs</DependentUpon>
    </EmbeddedResource>
    <EmbeddedResource Include="Properties\Resources.resx">
      <Generator>ResXFileCodeGenerator</Generator>
      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Include="app.config" />
    <None Include="install.exe.manifest" />
  </ItemGroup>
  <ItemGroup>
    <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
      <Visible>False</Visible>
      <ProductName>.NET Framework 2.0 %28x86%29</ProductName>
      <Install>true</Install>
    </BootstrapperPackage>
    <BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
      <Visible>False</Visible>
      <ProductName>.NET Framework 3.0 %28x86%29</ProductName>
      <Install>false</Install>
    </BootstrapperPackage>
    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
      <Visible>False</Visible>
      <ProductName>.NET Framework 3.5</ProductName>
      <Install>false</Install>
    </BootstrapperPackage>
  </ItemGroup>
  <ItemGroup>
    <Content Include="install.ico" />
    <None Include="Resources\System.Data.SQLite.dll" />
  </ItemGroup>
  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
  <PropertyGroup>
    <PostBuildEvent>
    </PostBuildEvent>
  </PropertyGroup>
</Project>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































































Deleted tools/mergebin/MetaData.cpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/********************************************************
 * mergebin
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

#include "StdAfx.h"
#include "MetaData.h"

CMetadata::CStream::operator LPBYTE() const
{
  return m_pbData;
}

CMetadata::CMetadata(CPEFile& peFile) : m_peFile(peFile)
{
  PIMAGE_COR20_HEADER pCor = m_peFile;
  if (!pCor) throw;

  LPBYTE pb = (LPBYTE)m_peFile.GetPtrFromRVA(pCor->MetaData.VirtualAddress);
  LPBYTE pbRoot = pb;
  size_t x;
  if (!pb) throw;

  m_pdwSignature     = (LPDWORD)pb;
  m_pwMajorVersion   = (LPWORD)(m_pdwSignature + 1);
  m_pwMinorVersion   = m_pwMajorVersion + 1;
  m_pdwVersionLength = (LPDWORD)(m_pwMinorVersion + 3);
  m_pszVersion       = (LPSTR)(m_pdwVersionLength + 1);

  pb = (LPBYTE)m_pszVersion;
  x = *m_pdwVersionLength;
  if (x % 4) x += 4 - (x % 4);
  pb += x;
  pb += 2;
  
  m_pwStreams        = (LPWORD)pb;
  m_pStreams = new CStream[*m_pwStreams];
  pb = (LPBYTE)(m_pwStreams + 1);

  for (WORD n = 0; n < *m_pwStreams; n++)
  {
    m_pStreams[n].m_pdwOffset  = (LPDWORD)pb;
    m_pStreams[n].m_pdwSize    = m_pStreams[n].m_pdwOffset + 1;
    m_pStreams[n].m_pszName    = (LPSTR)(m_pStreams[n].m_pdwSize + 1);
    m_pStreams[n].m_pbData     = pbRoot + (*m_pStreams[n].m_pdwOffset);

    x = strlen(m_pStreams[n].m_pszName) + 1;
    if (x % 4) x += 4 - (x % 4);

    pb = (LPBYTE)m_pStreams[n].m_pszName + x;
  }
}

CMetadata::~CMetadata(void)
{
  delete[] m_pStreams;
}

CMetadata::operator CPEFile&() const
{
  return m_peFile;
}

CMetadata::CStream * CMetadata::GetStream(UINT uiStream)
{
  if (uiStream >= *m_pwStreams) return NULL;
  return &m_pStreams[uiStream];
}

CMetadata::CStream * CMetadata::GetStream(LPCSTR pszStreamName)
{
  for (WORD n = 0; n < *m_pwStreams; n++)
  {
    if (_stricmp(pszStreamName, m_pStreams[n].m_pszName) == 0)
      return &m_pStreams[n];
  }
  return NULL;
}

WORD * CMetadata::StreamCount() const
{
  return m_pwStreams;
}

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












































































































































































Deleted tools/mergebin/MetaData.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/********************************************************
 * mergebin
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

#pragma once

#include "pefile.h"

class CMetadata
{
public:
  class CStream
  {
    friend CMetadata;
  public:
    operator LPBYTE() const;

  protected:
    DWORD *m_pdwOffset;
    DWORD *m_pdwSize;
    LPSTR  m_pszName;
    LPBYTE m_pbData;
  };
public:
  CMetadata(CPEFile& peFile);
  virtual ~CMetadata(void);

protected:
  CPEFile& m_peFile;

  DWORD   *m_pdwSignature;
  WORD    *m_pwMajorVersion;
  WORD    *m_pwMinorVersion;
  DWORD   *m_pdwVersionLength;
  LPSTR    m_pszVersion;
  WORD    *m_pwStreams;
  CStream *m_pStreams;

public:
  operator CPEFile&() const;

  WORD *               StreamCount () const;
  CMetadata::CStream * GetStream   (UINT uiStream);
  CMetadata::CStream * GetStream   (LPCSTR pszStreamName);
};
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































Deleted tools/mergebin/MetaDataTables.cpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/********************************************************
 * mergebin
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

#include "StdAfx.h"
#include "MetaDataTables.h"
#include "TableData.h"

CMetadataTables::CMetadataTables(CMetadata& metaData) : m_meta(metaData)
{
  CMetadata::CStream *ps = m_meta.GetStream("#~");
  if (!ps) throw;

  *static_cast<CMetadata::CStream *>(this) = *ps;

  LPBYTE pb = m_pbData + sizeof(DWORD);
  m_pbMajorVersion = pb;
  m_pbMinorVersion = m_pbMajorVersion + 1;
  m_pbHeapOffsetSizes = m_pbMinorVersion + 1;
  // Skip a byte
  m_pullMaskValid = (UINT64 *)(m_pbHeapOffsetSizes + 2);
  m_pullMaskSorted = m_pullMaskValid + 1;

  m_pdwTableLengths = (LPDWORD)(m_pullMaskSorted + 1);

  m_dwTables = 0;
  for (int n = 0; n < 64; n++)
  {
    if ((((*m_pullMaskValid) >> n) & 1) == 1)
    {
      m_pdwTableLengthIndex[n] = &m_pdwTableLengths[m_dwTables ++];
    }
    else
    {
      m_pdwTableLengthIndex[n] = NULL;
    }
  }
  m_pbData = (LPBYTE)(m_pdwTableLengths + m_dwTables);

  for (int n = 0; n < 64; n++)
  {
    if (m_pdwTableLengthIndex[n] && g_arTableTypes[n])
    {
      m_pTables[n] = g_arTableTypes[n](this);
    }
    else
      m_pTables[n] = 0;
  }
}

CMetadataTables::~CMetadataTables(void)
{
  for (int n = 0; n < 64; n++)
  {
    if (m_pTables[n])
      delete m_pTables[n];
  }
}

UINT CMetadataTables::GetStringIndexSize(void)
{
  return ((*m_pbHeapOffsetSizes) & 0x01) == 0 ? sizeof(WORD) : sizeof(DWORD);
}

UINT CMetadataTables::GetGuidIndexSize(void)
{
  return ((*m_pbHeapOffsetSizes) & 0x02) == 0 ? sizeof(WORD) : sizeof(DWORD);
}

UINT CMetadataTables::GetBlobIndexSize(void)
{
  return ((*m_pbHeapOffsetSizes) & 0x04) == 0 ? sizeof(WORD) : sizeof(DWORD);
}

DWORD *CMetadataTables::TableRowCount(UINT uType)
{
  return m_pdwTableLengthIndex[uType];
}

DWORD CMetadataTables::GetMaxIndexSizeOf(UINT * puiTables)
{
  DWORD dwMaxRows = 0;
  DWORD *pdwLength;
  UINT uCount = 0;

  while (*puiTables)
  {
    uCount ++;
    pdwLength = m_pdwTableLengthIndex[*puiTables];
    if (pdwLength)
      dwMaxRows = max(dwMaxRows, pdwLength[0]);

    puiTables ++;
  }

  return (dwMaxRows > 0xFFFF) ? 4 : 2;
  //return (dwMaxRows > (ULONG)(2 << (16 - uCount))) ? 4 : 2;
}

CTableData *CMetadataTables::GetTable(UINT uId)
{
  return m_pTables[uId];
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































































































































Deleted tools/mergebin/MetaDataTables.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/********************************************************
 * mergebin
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

#pragma once
#include "metadata.h"

class CTableData;

class CMetadataTables :
  public CMetadata::CStream
{
  friend CTableData;

public:
  CMetadataTables(CMetadata& metaData);
  virtual ~CMetadataTables(void);

protected:
  CMetadata&  m_meta;
  BYTE       *m_pbMajorVersion;
  BYTE       *m_pbMinorVersion;
  BYTE       *m_pbHeapOffsetSizes;
  UINT64     *m_pullMaskValid;
  UINT64     *m_pullMaskSorted;
  DWORD      *m_pdwTableLengths;

  DWORD      *m_pdwTableLengthIndex[64];
  DWORD       m_dwTables;

  CTableData *m_pTables[64];

public:
  UINT        GetStringIndexSize ();
  UINT        GetGuidIndexSize   ();
  UINT        GetBlobIndexSize   ();
  DWORD       GetMaxIndexSizeOf  (UINT *);

  DWORD *     TableRowCount      (UINT uType);

  CTableData *GetTable           (UINT uId);
};
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































Deleted tools/mergebin/PEFile.cpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
/********************************************************
 * mergebin
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

#include "StdAfx.h"
#include "PEFile.h"

#define MakePtr( cast, ptr, addValue ) (cast)( (DWORD_PTR)(ptr) + (DWORD_PTR)(addValue))

CPEFile::CPEFile(void)
{
  m_hMap = NULL;
  m_hFile = INVALID_HANDLE_VALUE;
  m_pBase = NULL;
}

CPEFile::~CPEFile(void)
{
  Close();
}

HRESULT CPEFile::Open(LPCTSTR pszFile, BOOL bReadOnly)
{
  HRESULT hr = S_OK;
  Close();

  m_hFile = CreateFile(pszFile, GENERIC_READ | ((bReadOnly == FALSE) ? GENERIC_WRITE: 0), FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
  if (m_hFile == INVALID_HANDLE_VALUE)
  {
    hr = HRESULT_FROM_WIN32(GetLastError());
  }
  else
  {
    m_hMap = CreateFileMapping(m_hFile, NULL, (bReadOnly == TRUE) ? PAGE_READONLY:PAGE_READWRITE, 0, 0, NULL);
    if (!m_hMap)
    {
      hr = HRESULT_FROM_WIN32(GetLastError());
    }
    else
    {
      m_pBase = (PIMAGE_DOS_HEADER)MapViewOfFile(m_hMap, FILE_MAP_READ | ((bReadOnly == FALSE) ? FILE_MAP_WRITE:0), 0, 0, 0);
      if (!m_pBase)
      {
        hr = HRESULT_FROM_WIN32(GetLastError());
      }
    }
  }

  if (SUCCEEDED(hr))
  {
    PIMAGE_FILE_HEADER pImageHeader = (PIMAGE_FILE_HEADER)m_pBase;
    if (m_pBase->e_magic != IMAGE_DOS_SIGNATURE)
    {
      hr = HRESULT_FROM_WIN32(ERROR_BAD_FORMAT);
    }

    m_pNTHeader = MakePtr(PIMAGE_NT_HEADERS, m_pBase, m_pBase->e_lfanew);
    if (IsBadReadPtr(m_pNTHeader, sizeof(m_pNTHeader->Signature)))
    {
      hr = HRESULT_FROM_WIN32(ERROR_BAD_FORMAT);
    }
    else
    {
      if (m_pNTHeader->Signature != IMAGE_NT_SIGNATURE)
      {
        hr = HRESULT_FROM_WIN32(ERROR_BAD_FORMAT);
      }
    }
    m_bIs64Bit = (m_pNTHeader->OptionalHeader.Magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC);
  }

  if (FAILED(hr)) Close();

  return hr;
}

void CPEFile::Close(void)
{
  if (m_pBase)
  {
    UnmapViewOfFile(m_pBase);
  }

  if (m_hMap)
    CloseHandle(m_hMap);

  if (m_hFile != INVALID_HANDLE_VALUE)
    CloseHandle(m_hFile);

  m_hMap = NULL;
  m_hFile = INVALID_HANDLE_VALUE;
  m_pBase = NULL;
}

PIMAGE_SECTION_HEADER CPEFile::GetEnclosingSectionHeader(DWORD rva) const
{
  PIMAGE_SECTION_HEADER section;
  
  if (m_bIs64Bit)
    section = IMAGE_FIRST_SECTION((PIMAGE_NT_HEADERS64)m_pNTHeader);
  else
    section = IMAGE_FIRST_SECTION(m_pNTHeader);

  for (UINT i=0; i < m_pNTHeader->FileHeader.NumberOfSections; i++, section++ )
  {
    DWORD size = section->Misc.VirtualSize;
    if (!size)
      size = section->SizeOfRawData;

    if ( (rva >= section->VirtualAddress) && 
      (rva < (section->VirtualAddress + size)))
      return section;
  }
  return NULL;
}

LPVOID CPEFile::GetPtrFromRVA(DWORD rva) const
{
  PIMAGE_SECTION_HEADER pSectionHdr;
  INT delta;

  pSectionHdr = GetEnclosingSectionHeader(rva);
  if ( !pSectionHdr )
    return 0;

  delta = (INT)(pSectionHdr->VirtualAddress-pSectionHdr->PointerToRawData);
  return (PVOID) (((LPBYTE)m_pBase) + rva - delta);
}

PIMAGE_SECTION_HEADER CPEFile::GetSectionHeader(LPCSTR name) const
{
  PIMAGE_SECTION_HEADER section;
  
  if (m_bIs64Bit)
    section = IMAGE_FIRST_SECTION((PIMAGE_NT_HEADERS64)m_pNTHeader);
  else
    section = IMAGE_FIRST_SECTION(m_pNTHeader);

  for (UINT i=0; i < m_pNTHeader->FileHeader.NumberOfSections; i++, section++)
  {
    if (_strnicmp((char *)section->Name,name,IMAGE_SIZEOF_SHORT_NAME) == 0)
      return section;
  }

  return NULL;
}

CPEFile::operator PIMAGE_NT_HEADERS32() const
{
  if (!m_pBase || m_bIs64Bit) return NULL;
  return m_pNTHeader;
}

CPEFile::operator PIMAGE_NT_HEADERS64() const
{
  if (!m_pBase || !m_bIs64Bit) return NULL;
  return (PIMAGE_NT_HEADERS64)m_pNTHeader;
}

CPEFile::operator PIMAGE_DOS_HEADER() const
{
  return m_pBase;
}

CPEFile::operator PIMAGE_COR20_HEADER() const
{
  if (!m_pBase) return NULL;

  DWORD dwRVA;

  if (m_bIs64Bit)
    dwRVA = ((PIMAGE_NT_HEADERS64)m_pNTHeader)->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress;
  else
    dwRVA = m_pNTHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress;
  if (!dwRVA)
  {
    return NULL;
  }

  return ((PIMAGE_COR20_HEADER)GetPtrFromRVA(dwRVA));
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































































































































































































































































































Deleted tools/mergebin/PEFile.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/********************************************************
 * mergebin
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

#pragma once

class CPEFile
{
public:
  CPEFile();
  virtual ~CPEFile(void);

protected:
  HANDLE              m_hMap;
  HANDLE              m_hFile;
  PIMAGE_DOS_HEADER   m_pBase;
  PIMAGE_NT_HEADERS32 m_pNTHeader;
  BOOL                m_bIs64Bit;

public:
  HRESULT Open  (LPCTSTR pszFile, BOOL bReadOnly = TRUE);
  void    Close (void);

  PIMAGE_SECTION_HEADER GetEnclosingSectionHeader (DWORD rva) const;
  LPVOID                GetPtrFromRVA             (DWORD rva) const;
  PIMAGE_SECTION_HEADER GetSectionHeader          (LPCSTR name) const;
  
  operator PIMAGE_DOS_HEADER   () const;
  operator PIMAGE_NT_HEADERS32 () const;
  operator PIMAGE_NT_HEADERS64 () const;
  operator PIMAGE_COR20_HEADER () const;
};
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































Deleted tools/mergebin/ReadMe.txt.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
========================================================================
    CONSOLE APPLICATION : mergebin Project Overview
========================================================================

AppWizard has created this mergebin application for you.  

This file contains a summary of what you will find in each of the files that
make up your mergebin application.


mergebin.vcproj
    This is the main project file for VC++ projects generated using an Application Wizard. 
    It contains information about the version of Visual C++ that generated the file, and 
    information about the platforms, configurations, and project features selected with the
    Application Wizard.

mergebin.cpp
    This is the main application source file.

/////////////////////////////////////////////////////////////////////////////
Other standard files:

StdAfx.h, StdAfx.cpp
    These files are used to build a precompiled header (PCH) file
    named mergebin.pch and a precompiled types file named StdAfx.obj.

/////////////////////////////////////////////////////////////////////////////
Other notes:

AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.

/////////////////////////////////////////////////////////////////////////////
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































Deleted tools/mergebin/StreamTable.cpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "StdAfx.h"
#include "StreamTable.h"

CREATEINSTANCE g_arTableTypes[64] = {
  CStreamTable::CreateInstance<CModuleTable>,
  CStreamTable::CreateInstance<CTypeRefTable>,
  CStreamTable::CreateInstance<CTypeDefTable>,
  NULL,
};

CStreamTable::CStreamTable(CMetadataTables& tables) : m_tables(tables)
{
}

CStreamTable::~CStreamTable(void)
{
}

template<class C>
static CStreamTable * CALLBACK CStreamTable::CreateInstance(CMetadataTables *ptables)
{
  CStreamTable *p = new C(*ptables);
  p->Init();

  return p;
}

void CStreamTable::Init()
{
  m_pbData = m_tables.m_pbData;
  CStreamTable *p;

  for (UINT n = 0; n < GetType(); n++)
  {
    p = m_tables.GetTable(n);
    if (p)
    {
      m_pbData += (p->GetRowSize() * p->GetRowCount());
    }
  }
}

DWORD CStreamTable::GetRowCount()
{
  return *m_tables.TableRowCount(GetType());
}

UINT CStreamTable::GetRowSize()
{
  TABLE_COLUMN *pc = GetColumns();
  UINT ulen = 0;

  while (pc->uSize)
  {
    ulen += pc->uSize;
    pc ++;
  }

  return ulen;
}

UINT CStreamTable::GetColumnCount()
{
  TABLE_COLUMN *pc = GetColumns();
  UINT ucount = 0;

  while (pc->uSize)
  {
    ucount ++;
    pc ++;
  }
  return ucount;
}

LPBYTE CStreamTable::operator[](UINT uRow)
{
  return m_pbData + (uRow * GetRowSize());
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































Deleted tools/mergebin/StreamTable.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#pragma once
#include "MetaDataTables.h"

typedef enum TableTypes
{
  ttModule = 0,
  ttTypeRef = 1,
  ttTypeDef = 2,
  ttFieldPtr = 3, 
  ttField = 4,
  ttMethodPtr = 5,
  ttMethodDef = 6,
  ttParamPtr = 7, 
  ttParam = 8,
  ttInterfaceImpl = 9,
  ttMemberRef = 10,
  ttConstant = 11, 
  ttCustomAttribute = 12,
  ttFieldMarshal = 13,
  ttPermission = 14,
  ttClassLayout = 15, 
  ttFieldLayout = 16,
  ttStandAloneSig = 17,
  ttEventMap = 18,
  ttEventPtr = 19, 
  ttEvent = 20,
  ttPropertyMap = 21,
  ttPropertyPtr = 22,
  ttProperty = 23, 
  ttMethodSemantics = 24,
  ttMethodImpl = 25,
  ttModuleRef = 26,
  ttTypeSpec = 27, 
  ttImplMap = 28, //lidin book is wrong again here?  It has enclog at 28
  ttFieldRVA = 29,
  ttENCLog = 30,
  ttENCMap = 31, 
  ttAssembly = 32,
  ttAssemblyProcessor= 33,
  ttAssemblyOS = 34,
  ttAssemblyRef = 35, 
  ttAssemblyRefProcessor = 36,
  ttAssemblyRefOS = 37,
  ttFile = 38,
  ttExportedType = 39, 
  ttManifestResource = 40,
  ttNestedClass = 41,
  ttTypeTyPar = 42,
  ttMethodTyPar = 43,
} TableTypes;

#define STRING_INDEXSIZE (m_tables.GetStringIndexSize())
#define GUID_INDEXSIZE (m_tables.GetGuidIndexSize())
#define BLOB_INDEXSIZE (m_tables.GetBlobIndexSize())
#define TABLE_ROWCOUNT(x) (m_tables.TableRowCount(x)[0])
#define TABLE_INDEXSIZE(x) (TABLE_ROWCOUNT(x) > 65535 ? 4 : 2)
#define MAX_INDEXSIZE(x) (m_tables.GetMaxIndexSizeOf(x))

class CStreamTable;

typedef CStreamTable* (CALLBACK* CREATEINSTANCE)(CMetadataTables *);

#define DECLARE_TABLE(classname, typ, nam) \
  public: \
  classname##(CMetadataTables& tables) : CStreamTable(tables) {} \
  UINT GetType() { return typ; } \
  LPCTSTR GetName() { return _T(nam); }

typedef struct TABLE_COLUMN
{
  UINT uSize;
  LPCTSTR pszName;
} TABLE_COLUMNS;

#define BEGIN_COLUMN_MAP() \
  protected: \
  TABLE_COLUMN *GetColumns() \
  { \
    static TABLE_COLUMN map[] = {

#define END_COLUMN_MAP() \
      { 0, NULL } \
    }; \
    return map; \
  }

#define COLUMN_ENTRY(name, size) { size, _T(name) },

class CStreamTable
{
public:
  CStreamTable(CMetadataTables& tables);
  virtual ~CStreamTable(void);

  DWORD GetRowCount();
  LPBYTE operator[](UINT uRow);

  virtual UINT GetType() = 0;
  virtual LPCTSTR GetName() = 0;

  template<class C> static CStreamTable * CALLBACK CreateInstance(CMetadataTables *ptables);

protected:
  CMetadataTables& m_tables;
  LPBYTE m_pbData;

  virtual UINT GetRowSize();
  virtual UINT GetColumnCount();

  virtual TABLE_COLUMN *GetColumns() = 0;

private:
  void Init();
};

class CModuleTable : public CStreamTable
{
  DECLARE_TABLE(CModuleTable, ttModule, "Module")
  
  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Generation", sizeof(WORD))
    COLUMN_ENTRY("Name",       STRING_INDEXSIZE)
    COLUMN_ENTRY("Mvid",       GUID_INDEXSIZE)
    COLUMN_ENTRY("EncId",      GUID_INDEXSIZE)
    COLUMN_ENTRY("EncBaseId",  GUID_INDEXSIZE)
  END_COLUMN_MAP()
};

static UINT ResolutionScopeIndex[] = {ttModule, ttModuleRef, ttAssemblyRef, ttTypeRef, 0};

class CTypeRefTable : public CStreamTable
{
  DECLARE_TABLE(CTypeRefTable, ttTypeRef, "TypeRef")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("ResolutionScope", MAX_INDEXSIZE(ResolutionScopeIndex))
    COLUMN_ENTRY("TypeName", STRING_INDEXSIZE)
    COLUMN_ENTRY("TypeNamespace", STRING_INDEXSIZE)
  END_COLUMN_MAP()
};

static UINT TypeDefOrRefIndex[] = {ttTypeDef, ttTypeRef, ttTypeSpec, 0};

class CTypeDefTable : public CStreamTable
{
  DECLARE_TABLE(CTypeDefTable, ttTypeDef, "TypeDef")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Flags", sizeof(DWORD))
    COLUMN_ENTRY("TypeName", STRING_INDEXSIZE)
    COLUMN_ENTRY("TypeNamespace", STRING_INDEXSIZE)
    COLUMN_ENTRY("Extends", MAX_INDEXSIZE(TypeDefOrRefIndex))
    COLUMN_ENTRY("FieldList", TABLE_INDEXSIZE(ttField))
    COLUMN_ENTRY("MethodList", TABLE_INDEXSIZE(ttMethodDef))
  END_COLUMN_MAP()
};

extern CREATEINSTANCE g_arTableTypes[64];
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































































































































































































Deleted tools/mergebin/TableData.cpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/********************************************************
 * mergebin
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

#include "StdAfx.h"
#include "TableData.h"

CREATEINSTANCE g_arTableTypes[64] = {
  CTableData::CreateInstance<CModuleTable>,
  CTableData::CreateInstance<CTypeRefTable>,
  CTableData::CreateInstance<CTypeDefTable>,
  CTableData::CreateInstance<CFieldPtrTable>,
  CTableData::CreateInstance<CFieldTable>,
  CTableData::CreateInstance<CMethodPtrTable>,
  CTableData::CreateInstance<CMethodTable>,
  CTableData::CreateInstance<CParamPtrTable>,
  CTableData::CreateInstance<CParamTable>,
  CTableData::CreateInstance<CInterfaceImplTable>,
  CTableData::CreateInstance<CMemberRefTable>,
  CTableData::CreateInstance<CConstantTable>,
  CTableData::CreateInstance<CCustomAttributeTable>,
  CTableData::CreateInstance<CFieldMarshalTable>,
  CTableData::CreateInstance<CDeclSecurityTable>,
  CTableData::CreateInstance<CClassLayoutTable>,
  CTableData::CreateInstance<CFieldLayoutTable>,
  CTableData::CreateInstance<CStandAloneSigTable>,
  CTableData::CreateInstance<CEventMapTable>,
  CTableData::CreateInstance<CEventPtrTable>,
  CTableData::CreateInstance<CEventTable>,
  CTableData::CreateInstance<CPropertyMapTable>,
  CTableData::CreateInstance<CPropertyPtrTable>,
  CTableData::CreateInstance<CPropertyTable>,
  CTableData::CreateInstance<CMethodSemanticsTable>,
  CTableData::CreateInstance<CMethodImplTable>,
  CTableData::CreateInstance<CModuleRefTable>,
  CTableData::CreateInstance<CTypeSpecTable>,
  CTableData::CreateInstance<CImplMapTable>,
  CTableData::CreateInstance<CFieldRVATable>,
  NULL,
};

CTableData::CTableData(CMetadataTables& tables) : m_tables(tables)
{
  m_uiRowSize = 0;
}

CTableData::~CTableData(void)
{
  if (m_pColumns) 
    delete[] m_pColumns;
}

template<class C>
static CTableData * CALLBACK CTableData::CreateInstance(CMetadataTables *ptables)
{
  CTableData *p = new C(*ptables);
  p->Init();

  return p;
}

void CTableData::Init()
{
  m_pbData = m_tables.m_pbData;
  CTableData *p;
  UINT n = GetType();
  
  while(n--)
  {
    p = m_tables.GetTable(n);
    if (p)
    {
      m_pbData = p->m_pbData + (p->GetRowSize() * p->GetRowCount());
      break;
    }
  }

  m_pColumns = _CreateColumns();
  TABLE_COLUMNS *tc = m_pColumns + 1;

  while (tc->pszName && !tc->dwOffset)
  {
    tc->dwOffset = tc[-1].dwOffset + tc[-1].uSize;
    tc ++;
  }
}

TABLE_COLUMN * CTableData::GetColumns()
{
  return m_pColumns;
}

DWORD CTableData::GetRowCount()
{
  return *m_tables.TableRowCount(GetType());
}

UINT CTableData::GetRowSize()
{
  if (m_uiRowSize == 0)
  {
    TABLE_COLUMN *pc = m_pColumns;

    while (pc->uSize)
    {
      m_uiRowSize += pc->uSize;
      pc ++;
    }
  }

  return m_uiRowSize;
}

UINT CTableData::GetColumnCount()
{
  TABLE_COLUMN *pc = m_pColumns;
  UINT ucount = 0;

  while (pc->uSize)
  {
    ucount ++;
    pc ++;
  }
  return ucount;
}

int CTableData::GetColumnIndex(LPCTSTR pszName)
{
  TABLE_COLUMN *pc = m_pColumns;
  for (int n = 0; pc[n].pszName; n++)
  {
    if (lstrcmpi(pszName, pc[n].pszName) == 0) return n;
  }
  return -1;
}

UINT CTableData::GetColumnSize(UINT uIndex)
{
  return m_pColumns[uIndex].uSize;
}

UINT CTableData::GetColumnSize(LPCTSTR pszName)
{
  int n = GetColumnIndex(pszName);
  if (n < 0) return 0;

  return GetColumnSize(n);
}

LPBYTE CTableData::Column(UINT uRow, UINT uIndex)
{
  TABLE_COLUMN *pc = m_pColumns;
  LPBYTE pb = m_pbData + (uRow * GetRowSize()) + pc[uIndex].dwOffset;

  return pb;
}

LPBYTE CTableData::Column(UINT uRow, LPCTSTR pszName)
{
  int n = GetColumnIndex(pszName);
  if (n < 0) return NULL;
  return Column(uRow, n);
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<












































































































































































































































































































































Deleted tools/mergebin/TableData.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
/********************************************************
 * mergebin
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

#pragma once
#include "MetaDataTables.h"

typedef enum TableTypes
{
  ttModule = 0,
  ttTypeRef = 1,
  ttTypeDef = 2,
  ttFieldPtr = 3, 
  ttField = 4,
  ttMethodPtr = 5,
  ttMethodDef = 6,
  ttParamPtr = 7, 
  ttParam = 8,
  ttInterfaceImpl = 9,
  ttMemberRef = 10,
  ttConstant = 11, 
  ttCustomAttribute = 12,
  ttFieldMarshal = 13,
  ttDeclSecurity = 14,
  ttClassLayout = 15, 
  ttFieldLayout = 16,
  ttStandAloneSig = 17,
  ttEventMap = 18,
  ttEventPtr = 19, 
  ttEvent = 20,
  ttPropertyMap = 21,
  ttPropertyPtr = 22,
  ttProperty = 23, 
  ttMethodSemantics = 24,
  ttMethodImpl = 25,
  ttModuleRef = 26,
  ttTypeSpec = 27, 
  ttImplMap = 28,
  ttFieldRVA = 29,
  ttENCLog = 30,
  ttENCMap = 31, 
  ttAssembly = 32,
  ttAssemblyProcessor= 33,
  ttAssemblyOS = 34,
  ttAssemblyRef = 35, 
  ttAssemblyRefProcessor = 36,
  ttAssemblyRefOS = 37,
  ttFile = 38,
  ttExportedType = 39, 
  ttManifestResource = 40,
  ttNestedClass = 41,
  ttGenericParam = 42,
  ttMethodSpec = 43,
  ttGenericParamConstraint = 44,
} TableTypes;

typedef struct TABLE_COLUMN
{
  UINT uSize;
  LPCTSTR pszName;
  DWORD dwOffset;
} TABLE_COLUMNS;

class CTableData;

/*
** Helpers
*/
#define STRING_INDEXSIZE (m_tables.GetStringIndexSize())
#define GUID_INDEXSIZE (m_tables.GetGuidIndexSize())
#define BLOB_INDEXSIZE (m_tables.GetBlobIndexSize())
#define TABLE_ROWCOUNT(x) (m_tables.TableRowCount(x)[0])
#define TABLE_INDEXSIZE(x) (TABLE_ROWCOUNT(x) > 65535 ? 4 : 2)
#define MAX_INDEXSIZE(x) (m_tables.GetMaxIndexSizeOf(x))

#define DECLARE_TABLE(classname, typ, nam) \
  public: \
  classname##(CMetadataTables& tables) : CTableData(tables) {} \
  UINT GetType() { return typ; } \
  LPCTSTR GetName() { return _T(nam); }

#define BEGIN_COLUMN_MAP() \
  protected: \
  TABLE_COLUMN *_CreateColumns() \
  { \
    TABLE_COLUMN map[] = {

#define END_COLUMN_MAP() \
      { 0, NULL } \
    }; \
    TABLE_COLUMN *p = new TABLE_COLUMN[sizeof(map) / sizeof(TABLE_COLUMN)]; \
    CopyMemory(p, map, sizeof(map)); \
    return p; \
  }

#define COLUMN_ENTRY(name, size) { size, _T(name), 0 },
/*
** End Of Helpers
*/

class CTableData
{
public:
  CTableData(CMetadataTables& tables);
  virtual ~CTableData(void);

  virtual UINT          GetType        () = 0;
  virtual LPCTSTR       GetName        () = 0;
  virtual TABLE_COLUMN *_CreateColumns () = 0;

  template<class C> static CTableData * CALLBACK CreateInstance(CMetadataTables *ptables);

  virtual DWORD         GetRowCount ();
  virtual UINT          GetRowSize  ();

  int           GetColumnIndex (LPCTSTR pszName);
  UINT          GetColumnSize  (UINT uIndex);
  UINT          GetColumnSize  (LPCTSTR pszName);
  UINT          GetColumnCount ();
  LPBYTE        Column         (UINT uRow, UINT uIndex);
  LPBYTE        Column         (UINT uRow, LPCTSTR pszName);
  TABLE_COLUMN *GetColumns     ();

protected:
  CMetadataTables& m_tables;
  LPBYTE           m_pbData;
  UINT             m_uiRowSize;
  TABLE_COLUMN    *m_pColumns;

private:
  void Init ();
};

class CModuleTable : public CTableData
{
  DECLARE_TABLE(CModuleTable, ttModule, "Module")
  
  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Generation", sizeof(WORD))
    COLUMN_ENTRY("Name",       STRING_INDEXSIZE)
    COLUMN_ENTRY("Mvid",       GUID_INDEXSIZE)
    COLUMN_ENTRY("EncId",      GUID_INDEXSIZE)
    COLUMN_ENTRY("EncBaseId",  GUID_INDEXSIZE)
  END_COLUMN_MAP()
};

static UINT TypeDefOrRefIndex[]        = { ttTypeDef,   ttTypeRef,     ttTypeSpec,     0 };
static UINT HasConstantIndex[]         = { ttField,     ttParam,       ttProperty,     0 };
static UINT HasCustomAttributeIndex[]  = { ttMethodDef, ttField,       ttTypeRef,      ttTypeDef,   ttParam,    ttInterfaceImpl, ttMemberRef, ttModule, ttDeclSecurity, ttProperty, ttEvent, ttStandAloneSig, ttModuleRef, ttTypeSpec, ttAssembly, ttAssemblyRef, ttFile, ttExportedType, ttManifestResource, 0 };
static UINT HasFieldMarshalIndex[]     = { ttField,     ttParam,       0 };
static UINT HasDeclSecurityIndex[]     = { ttTypeDef,   ttMethodDef,   ttAssembly,     0 };
static UINT MemberRefParentIndex[]     = { ttTypeDef,   ttTypeRef,     ttModuleRef,    ttMethodDef, ttTypeSpec, 0 };
static UINT HasSemanticsIndex[]        = { ttEvent,     ttProperty,    0 };
static UINT MethodDefOrRefIndex[]      = { ttMethodDef, ttMemberRef,   0 };
static UINT MemberForwardedIndex[]     = { ttField,     ttMethodDef,   0 };
static UINT ImplementationIndex[]      = { ttFile,      ttAssemblyRef, ttExportedType, 0 };
static UINT CustomAttributeTypeIndex[] = { 63,          63,            ttMethodDef,    ttMemberRef, 63,         0 };
static UINT ResolutionScopeIndex[]     = { ttModule,    ttModuleRef,   ttAssemblyRef,  ttTypeRef,   0 };
static UINT TypeOrMethodDefIndex[]     = { ttTypeDef,   ttMethodDef,   0 };

class CTypeRefTable : public CTableData
{
  DECLARE_TABLE(CTypeRefTable, ttTypeRef, "TypeRef")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("ResolutionScope", MAX_INDEXSIZE(ResolutionScopeIndex))
    COLUMN_ENTRY("TypeName",        STRING_INDEXSIZE)
    COLUMN_ENTRY("TypeNamespace",   STRING_INDEXSIZE)
  END_COLUMN_MAP()
};

class CTypeDefTable : public CTableData
{
  DECLARE_TABLE(CTypeDefTable, ttTypeDef, "TypeDef")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Flags",         sizeof(DWORD))
    COLUMN_ENTRY("TypeName",      STRING_INDEXSIZE)
    COLUMN_ENTRY("TypeNamespace", STRING_INDEXSIZE)
    COLUMN_ENTRY("Extends",       MAX_INDEXSIZE(TypeDefOrRefIndex))
    COLUMN_ENTRY("FieldList",     TABLE_INDEXSIZE(ttField))
    COLUMN_ENTRY("MethodList",    TABLE_INDEXSIZE(ttMethodDef))
  END_COLUMN_MAP()
};

class CFieldPtrTable : public CTableData
{
  DECLARE_TABLE(CFieldPtrTable, ttFieldPtr, "FieldPtr")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Field", TABLE_INDEXSIZE(ttField))
  END_COLUMN_MAP()
};

class CFieldTable : public CTableData
{
  DECLARE_TABLE(CFieldTable, ttField, "Field")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Flags",     sizeof(WORD))
    COLUMN_ENTRY("Name",      STRING_INDEXSIZE)
    COLUMN_ENTRY("Signature", BLOB_INDEXSIZE)
  END_COLUMN_MAP()
};

class CMethodPtrTable : public CTableData
{
  DECLARE_TABLE(CMethodPtrTable, ttMethodPtr, "MethodPtr")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Method", TABLE_INDEXSIZE(ttMethodDef))
  END_COLUMN_MAP()
};

class CMethodTable : public CTableData
{
  DECLARE_TABLE(CMethodTable, ttMethodDef, "Method")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("RVA",        sizeof(DWORD))
    COLUMN_ENTRY("ImplFlags",  sizeof(WORD))
    COLUMN_ENTRY("Flags",      sizeof(WORD))
    COLUMN_ENTRY("Name",       STRING_INDEXSIZE)
    COLUMN_ENTRY("Signature",  BLOB_INDEXSIZE)
    COLUMN_ENTRY("Parameters", TABLE_INDEXSIZE(ttParam))
  END_COLUMN_MAP()
};

class CParamPtrTable : public CTableData
{
  DECLARE_TABLE(CParamPtrTable, ttParamPtr, "ParamPtr")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Param", TABLE_INDEXSIZE(ttParam))
  END_COLUMN_MAP()
};

class CParamTable : public CTableData
{
  DECLARE_TABLE(CParamTable, ttParam, "Param")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Flags",    sizeof(WORD))
    COLUMN_ENTRY("Sequence", sizeof(WORD))
    COLUMN_ENTRY("Name",     STRING_INDEXSIZE)
  END_COLUMN_MAP()
};

class CInterfaceImplTable : public CTableData
{
  DECLARE_TABLE(CInterfaceImplTable, ttInterfaceImpl, "Interface")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Class",     TABLE_INDEXSIZE(ttTypeDef))
    COLUMN_ENTRY("Interface", MAX_INDEXSIZE(TypeDefOrRefIndex))
  END_COLUMN_MAP()
};

class CMemberRefTable : public CTableData
{
  DECLARE_TABLE(CMemberRefTable, ttMemberRef, "Member")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Class",     MAX_INDEXSIZE(MemberRefParentIndex))
    COLUMN_ENTRY("Name",      STRING_INDEXSIZE)
    COLUMN_ENTRY("Signature", BLOB_INDEXSIZE)
  END_COLUMN_MAP()
};

class CConstantTable : public CTableData
{
  DECLARE_TABLE(CConstantTable, ttConstant, "Constant")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Type",   sizeof(WORD))
    COLUMN_ENTRY("Parent", MAX_INDEXSIZE(HasConstantIndex))
    COLUMN_ENTRY("Value",  BLOB_INDEXSIZE)
  END_COLUMN_MAP()
};

class CCustomAttributeTable : public CTableData
{
  DECLARE_TABLE(CCustomAttributeTable, ttCustomAttribute, "CustomAttribute")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Parent", MAX_INDEXSIZE(HasCustomAttributeIndex))
    COLUMN_ENTRY("Type",   MAX_INDEXSIZE(CustomAttributeTypeIndex))
    COLUMN_ENTRY("Value",  BLOB_INDEXSIZE)
  END_COLUMN_MAP()
};

class CFieldMarshalTable : public CTableData
{
  DECLARE_TABLE(CFieldMarshalTable, ttFieldMarshal, "FieldMarshal")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Parent",     MAX_INDEXSIZE(HasFieldMarshalIndex))
    COLUMN_ENTRY("NativeType", BLOB_INDEXSIZE)
  END_COLUMN_MAP()
};

class CDeclSecurityTable : public CTableData
{
  DECLARE_TABLE(CDeclSecurityTable, ttDeclSecurity, "DeclSecurity")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Action",        sizeof(WORD))
    COLUMN_ENTRY("Parent",        MAX_INDEXSIZE(HasDeclSecurityIndex))
    COLUMN_ENTRY("PermissionSet", BLOB_INDEXSIZE)
  END_COLUMN_MAP()
};

class CClassLayoutTable : public CTableData
{
  DECLARE_TABLE(CClassLayoutTable, ttClassLayout, "ClassLayout")
  
  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("PackingSize", sizeof(WORD))
    COLUMN_ENTRY("ClassSize",   sizeof(DWORD))
    COLUMN_ENTRY("Parent",      TABLE_INDEXSIZE(ttTypeDef))
  END_COLUMN_MAP()
};

class CFieldLayoutTable : public CTableData
{
  DECLARE_TABLE(CFieldLayoutTable, ttFieldLayout, "FieldLayout")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Offset", sizeof(DWORD))
    COLUMN_ENTRY("Field",  TABLE_INDEXSIZE(ttField))
  END_COLUMN_MAP()
};

class CStandAloneSigTable : public CTableData
{
  DECLARE_TABLE(CStandAloneSigTable, ttStandAloneSig, "StandAloneSig")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Signature", BLOB_INDEXSIZE)
  END_COLUMN_MAP()
};

class CEventMapTable : public CTableData
{
  DECLARE_TABLE(CEventMapTable, ttEventMap, "EventMap")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Parent",    TABLE_INDEXSIZE(ttTypeDef))
    COLUMN_ENTRY("EventList", TABLE_INDEXSIZE(ttEvent))
  END_COLUMN_MAP()
};

class CEventTable : public CTableData
{
  DECLARE_TABLE(CEventTable, ttEvent, "Event")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("EventFlags", sizeof(WORD))
    COLUMN_ENTRY("Name",       STRING_INDEXSIZE)
    COLUMN_ENTRY("EventType",  MAX_INDEXSIZE(TypeDefOrRefIndex))
  END_COLUMN_MAP()
};

class CEventPtrTable : public CTableData
{
  DECLARE_TABLE(CEventPtrTable, ttEventPtr, "EventPtr")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Event", TABLE_INDEXSIZE(ttEvent))
  END_COLUMN_MAP()
};

class CPropertyMapTable : public CTableData
{
  DECLARE_TABLE(CPropertyMapTable, ttPropertyMap, "PropertyMap")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Parent",       TABLE_INDEXSIZE(ttTypeDef))
    COLUMN_ENTRY("PropertyList", TABLE_INDEXSIZE(ttProperty))
  END_COLUMN_MAP()
};

class CPropertyPtrTable : public CTableData
{
  DECLARE_TABLE(CPropertyPtrTable, ttEventPtr, "PropertyPtr")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Property", TABLE_INDEXSIZE(ttProperty))
  END_COLUMN_MAP()
};

class CPropertyTable : public CTableData
{
  DECLARE_TABLE(CPropertyTable, ttProperty, "Property")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Flags", sizeof(WORD))
    COLUMN_ENTRY("Name",  STRING_INDEXSIZE)
    COLUMN_ENTRY("Type",  BLOB_INDEXSIZE)
  END_COLUMN_MAP()
};

class CMethodSemanticsTable : public CTableData
{
  DECLARE_TABLE(CMethodSemanticsTable, ttMethodSemantics, "MethodSemantics")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Semantics",   sizeof(WORD))
    COLUMN_ENTRY("Method",      TABLE_INDEXSIZE(ttMethodDef))
    COLUMN_ENTRY("Association", MAX_INDEXSIZE(HasSemanticsIndex))
  END_COLUMN_MAP()
};

class CMethodImplTable : public CTableData
{
  DECLARE_TABLE(CMethodImplTable, ttMethodImpl, "MethodImpl")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Class",             TABLE_INDEXSIZE(ttTypeDef))
    COLUMN_ENTRY("MethodBody",        MAX_INDEXSIZE(MethodDefOrRefIndex))
    COLUMN_ENTRY("MethodDeclaration", MAX_INDEXSIZE(MethodDefOrRefIndex))
  END_COLUMN_MAP()
};

class CModuleRefTable : public CTableData
{
  DECLARE_TABLE(CModuleRefTable, ttModuleRef, "ModuleRef")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Name", STRING_INDEXSIZE)
  END_COLUMN_MAP()
};

class CTypeSpecTable : public CTableData
{
  DECLARE_TABLE(CTypeSpecTable, ttTypeSpec, "TypeSpec")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("Signature", BLOB_INDEXSIZE)
  END_COLUMN_MAP()
};

class CImplMapTable : public CTableData
{
  DECLARE_TABLE(CImplMapTable, ttImplMap, "ImplMap")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("MappingFlags",    sizeof(WORD))
    COLUMN_ENTRY("MemberForwarded", MAX_INDEXSIZE(MemberForwardedIndex))
    COLUMN_ENTRY("ImportName",      STRING_INDEXSIZE)
    COLUMN_ENTRY("ImportScope",     TABLE_INDEXSIZE(ttModuleRef))
  END_COLUMN_MAP()
};

class CFieldRVATable : public CTableData
{
  DECLARE_TABLE(CFieldRVATable, ttFieldRVA, "FieldRVA")

  BEGIN_COLUMN_MAP()
    COLUMN_ENTRY("RVA",   sizeof(DWORD))
    COLUMN_ENTRY("Field", TABLE_INDEXSIZE(ttField))
  END_COLUMN_MAP()
};

// Only tables up to ttFieldRVA are mapped, because they're all I needed.  If you need the tables beyond that, map them yourself!

typedef CTableData* (CALLBACK* CREATEINSTANCE)(CMetadataTables *);
extern CREATEINSTANCE g_arTableTypes[64];
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted tools/mergebin/mergebin.cpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
/********************************************************
 * mergebin
 * Written by Robert Simpson (robert@blackcastlesoft.com)
 * 
 * Released to the public domain, use at your own risk!
 ********************************************************/

#include "stdafx.h"
#include "MetaData.h"
#include "MetaDataTables.h"
#include "TableData.h"

void DumpCLRInfo(LPCTSTR pszFile);
void MergeModules(LPCTSTR pszAssembly, LPCTSTR pszNative, LPCTSTR pszSection, DWORD dwAdjust);
void DumpCLRPragma(LPCTSTR pszAssembly, LPCTSTR pszSection);
void FixObjFile(LPCTSTR pszFile);

typedef struct EXTRA_STUFF
{
  DWORD dwNativeEntryPoint;
} EXTRA_STUFF, *LPEXTRA_STUFF;

int _tmain(int argc, _TCHAR* argv[])
{
  if (argc == 1)
  {
    _tprintf(_T(
"MERGEBIN - Merges a pure .NET assembly with a native DLL\n \
Syntax: MERGEBIN [/I:assembly] [/S:sectionname assembly nativedll]\n \
/I:assembly            Returns the number of bytes required\n \
                       to consume the assembly\n \
/S:sectionname         The name of the section in the nativedll\n \
                       to insert the CLR data\n \
/P:assembly            Outputs the C++ pragma code that can be used\n \
                       as additional input to a C++ app to reserve\n \
                       a section block large enough for the managed code.\n \
/B:objectfile          Windows CE workaround, changes the attributes of\n \
                       the .BSS section of an object file to generate a\n \
                       DLL that doesn't have a .bss section whos \n \
                       virtualsize is larger than the rawdata size.\n \
The native DLL must have an unused section in it, into which the\n \
.NET assembly will be inserted.  You can do this with the following code:\n \
  #pragma data_seg(\".clr\")\n \
  #pragma comment(linker, \"/SECTION:.clr,ER\")\n \
   char __ph[92316] = {0}; // 92316 is the number of bytes to reserve\n \
  #pragma data_seg()\n \
You would then specify /SECTION:.CLR in the command-line for the location to\n \
insert the .NET assembly.  The number of bytes reserved in the section needs\n \
to be equal to or more than the number of bytes returned by the /I parameter.\n \
\n \
The native DLL must also export a function that calls _CorDllMain in \n \
MSCOREE.DLL.  This function must have the same parameters and calling\n \
conventions as DllMain, and its name must have the word \"CORDLLMAIN\"\n \
in it.\n \
"));
    return 0;
  }

  LPTSTR pszAssembly = NULL;
  LPTSTR pszNative = NULL;
  LPTSTR pszSection = NULL;
  BOOL bDoPragma = FALSE;
  BOOL bDoObj = FALSE;
  DWORD dwAdjust = 0;

  for (int n = 1; n < argc; n++)
  {
    if (argv[n][0] != '-' && argv[n][0] != '/')
    {
      if (pszAssembly == NULL)
        pszAssembly = argv[n];
      else if (pszNative == NULL)
        pszNative = argv[n];
      else
      {
        _tprintf(_T("Too many files specified\n"));
        return 0;
      }
      continue;
    }

    switch(argv[n][1])
    {
    case 'I':
    case 'i':
      pszAssembly = &argv[n][3];
      if (argv[n][2] != ':' || lstrlen(pszAssembly) == 0)
      {
        _tprintf(_T("/I requires an assembly name\n"));
        return 0;
      }
      DumpCLRInfo(pszAssembly);
      return 0;
      break;
    case 'P':
    case 'p':
      pszAssembly = &argv[n][3];
      if (argv[n][2] != ':' || lstrlen(pszAssembly) == 0)
      {
        _tprintf(_T("/P requires an assembly name\n"));
        return 0;
      }
      bDoPragma = TRUE;
      break;
    case 'S':
    case 's':
      pszSection = &argv[n][3];
      if (argv[n][2] != ':' || lstrlen(pszSection) == 0)
      {
        _tprintf(_T("/S requires a section name\n"));
        return 0;
      }
      break;
    //case 'A':
    //case 'a':
    //  if (argv[n][2] != ':')
    //  {
    //    _tprintf(_T("A parameter requires a numeric value\n"));
    //    return 0;
    //  }
    //  dwAdjust = _ttol(&argv[n][3]);
    //  break;
    case 'B':
    case 'b':
      pszAssembly = &argv[n][3];
      if (argv[n][2] != ':' || lstrlen(pszAssembly) == 0)
      {
        _tprintf(_T("/B requires an object file name\n"));
        return 0;
      }
      bDoObj = TRUE;
      break;
    }
  }

  if (pszAssembly && bDoObj)
    FixObjFile(pszAssembly);
  else if (pszAssembly && pszNative && pszSection && !bDoPragma)
    MergeModules(pszAssembly, pszNative, pszSection, dwAdjust);
  else if (pszAssembly && bDoPragma)
    DumpCLRPragma(pszAssembly, pszSection);

  return 0;
}

LPBYTE memstr(LPBYTE buffer, LPCSTR find, DWORD size)
{
	LPBYTE p;
	DWORD findsize = lstrlenA(find);

	for (p = buffer; p <= (buffer-findsize+size); p++)
	{
		if (memcmp(p, find, findsize) == 0)
			return p; /* found */
	}
	return NULL;
}

void FixObjFile(LPCTSTR pszFile)
{
  HANDLE hMap = INVALID_HANDLE_VALUE;
  HANDLE hFile = CreateFile(pszFile, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
  LPBYTE p;
  DWORD dwSize;

  if (hFile == INVALID_HANDLE_VALUE) return;

  dwSize = GetFileSize(hFile, NULL);
  hMap = CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, 0, NULL);
  if (hMap)
  {
    p = (LPBYTE)MapViewOfFile(hMap, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0);
    if (p)
    {
      PIMAGE_SECTION_HEADER section = (PIMAGE_SECTION_HEADER)memstr(p, ".bss", dwSize);

      if (section)
      {
        section->Characteristics &= ~IMAGE_SCN_CNT_UNINITIALIZED_DATA;
        section->Characteristics |= IMAGE_SCN_CNT_INITIALIZED_DATA;
      }
      UnmapViewOfFile(p);
    }
    CloseHandle(hMap);
  }
  CloseHandle(hFile);
}


BOOL GetMinMaxCOR20RVA(CPEFile& file, DWORD& dwMin, DWORD& dwMax)
{
  PIMAGE_COR20_HEADER pCor = file;
  dwMin = MAXDWORD;
  dwMax = 0;

  if (!pCor) return FALSE;

  if (pCor->MetaData.Size) dwMin = min(dwMin, pCor->MetaData.VirtualAddress);
  if (pCor->Resources.Size) dwMin = min(dwMin, pCor->Resources.VirtualAddress);
  if (pCor->StrongNameSignature.Size) dwMin = min(dwMin, pCor->StrongNameSignature.VirtualAddress);
  if (pCor->CodeManagerTable.Size) dwMin = min(dwMin, pCor->CodeManagerTable.VirtualAddress);
  if (pCor->VTableFixups.Size) dwMin = min(dwMin, pCor->VTableFixups.VirtualAddress);
  if (pCor->ExportAddressTableJumps.Size) dwMin = min(dwMin, pCor->ExportAddressTableJumps.VirtualAddress);
  if (pCor->ManagedNativeHeader.Size) dwMin = min(dwMin, pCor->ManagedNativeHeader.VirtualAddress);

  dwMax = max(dwMax, (pCor->MetaData.VirtualAddress + pCor->MetaData.Size));
  dwMax = max(dwMax, (pCor->Resources.VirtualAddress + pCor->Resources.Size));
  dwMax = max(dwMax, (pCor->StrongNameSignature.VirtualAddress + pCor->StrongNameSignature.Size));
  dwMax = max(dwMax, (pCor->CodeManagerTable.VirtualAddress + pCor->CodeManagerTable.Size));
  dwMax = max(dwMax, (pCor->VTableFixups.VirtualAddress + pCor->VTableFixups.Size));
  dwMax = max(dwMax, (pCor->ExportAddressTableJumps.VirtualAddress + pCor->ExportAddressTableJumps.Size));
  dwMax = max(dwMax, (pCor->ManagedNativeHeader.VirtualAddress + pCor->ManagedNativeHeader.Size));

  CMetadata meta(file);
  CMetadataTables tables(meta);
  CTableData *p;
  DWORD *pdwRVA;
  DWORD dwRows;

  for (int n = 0; n < 2; n++)
  {
    p = tables.GetTable((n == 0) ? ttMethodDef : ttFieldRVA);
    if (p)
    {
      dwRows = p->GetRowCount();
      for (UINT uRow = 0; uRow < dwRows; uRow ++)
      {
        pdwRVA = (DWORD *)p->Column(uRow, (UINT)0);
        if (*pdwRVA)
          dwMin = min(dwMin, (*pdwRVA));
      }
    }
  }
  return TRUE;
}

void DumpCLRInfo(LPCTSTR pszFile)
{
  CPEFile peFile;
  HRESULT hr;
  hr = peFile.Open(pszFile);
  if (FAILED(hr)) return;

  DWORD dwMinRVA;
  DWORD dwMaxRVA;

  if (!GetMinMaxCOR20RVA(peFile, dwMinRVA, dwMaxRVA))
  {
    _tprintf(_T("Unable to retrieve .NET assembly information for file %s\n"), pszFile);
    return;
  }

  _tprintf(_T("%d Bytes required to merge %s\n"), (dwMaxRVA - dwMinRVA) + ((PIMAGE_COR20_HEADER)peFile)->cb + sizeof(EXTRA_STUFF), pszFile);
}

void DumpCLRPragma(LPCTSTR pszAssembly, LPCTSTR pszSection)
{
  CPEFile peFile;
  HRESULT hr;
  DWORD dwMinRVA;
  DWORD dwMaxRVA;

  hr = peFile.Open(pszAssembly);
  if (FAILED(hr)) return;
  
  if (pszSection == NULL) pszSection = _T(".clr");

  if (!GetMinMaxCOR20RVA(peFile, dwMinRVA, dwMaxRVA))
  {
    _tprintf(_T("// Unable to retrieve .NET assembly information for file %s\n"), pszAssembly);
    return;
  }

  _tprintf(_T("// This code was automatically generated from assembly\n\
// %s\n\n\
#include <windef.h>\n\n\
#pragma data_seg(push,clrseg,\"%s\")\n\
#pragma comment(linker, \"/SECTION:%s,ER\")\n\
  char __ph[%d] = {0}; // The number of bytes to reserve\n\
#pragma data_seg(pop,clrseg)\n\n\
typedef BOOL (WINAPI *DLLMAIN)(HANDLE, DWORD, LPVOID);\n\
typedef struct EXTRA_STUFF\n\
{\n\
  DWORD dwNativeEntryPoint;\n\
} EXTRA_STUFF, *LPEXTRA_STUFF;\n\n\
__declspec(dllexport) BOOL WINAPI _CorDllMainStub(HANDLE hModule, DWORD dwReason, LPVOID pvReserved)\n\
{\n\
  HANDLE hMod;\n\
  DLLMAIN proc;\n\
  LPEXTRA_STUFF pExtra;\n\n\
  hMod = GetModuleHandle(_T(\"mscoree\"));\n\
  if (hMod)\n\
    proc = (DLLMAIN)GetProcAddress(hMod, _T(\"_CorDllMain\"));\n\
  else\n\
  {\n\
    MEMORY_BASIC_INFORMATION mbi;\n\n\
    VirtualQuery(_CorDllMainStub, &mbi, sizeof(mbi));\n\
    pExtra = (LPEXTRA_STUFF)__ph;\n\
    proc = (DLLMAIN)(pExtra->dwNativeEntryPoint + (DWORD)mbi.AllocationBase);\n\
  }\n\
  return proc(hModule, dwReason, pvReserved);\n\
}\n\
"), pszAssembly, pszSection, pszSection, (dwMaxRVA - dwMinRVA) + ((PIMAGE_COR20_HEADER)peFile)->cb + sizeof(EXTRA_STUFF));
}

/*   When merged, the native DLL's entrypoint must go to _CorDllMain in MSCOREE.DLL.
  ** In order to do this, we need to change the DLL's entrypoint to "something" that will
  ** call CorDllMain.  Since its too much hassle to add imports to the DLL and make drastic
  ** changes to it, we rely on the native DLL to export a function that we can call which will
  ** forward to CorDllMain.  Exported functions are easy to identify and get an RVA for.
  ** The exported function must have the same calling conventions and parameters as DllMain,
  ** and must contain the letters "CORDLLMAIN" in the name.  The search is case-insensitive. */
DWORD GetExportedCorDllMainRVA(CPEFile& file)
{
  PIMAGE_EXPORT_DIRECTORY pExportDir;
  PIMAGE_SECTION_HEADER header;
  INT delta; 
  DWORD i;
  DWORD *pdwFunctions;
  PWORD pwOrdinals;
  DWORD *pszFuncNames;
  DWORD exportsStartRVA;
  DWORD exportsEndRVA;
  CHAR szName[MAX_PATH + 1];
  PIMAGE_NT_HEADERS32 pNT = file;
  PIMAGE_NT_HEADERS64 pNT64 = file;

  if (pNT)
  {
    exportsStartRVA = pNT->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
    exportsEndRVA = exportsStartRVA + pNT->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size;
  }
  else
  {
    exportsStartRVA = pNT64->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
    exportsEndRVA = exportsStartRVA + pNT64->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].Size;
  }

  header = file.GetEnclosingSectionHeader(exportsStartRVA);
  if (!header)
    return 0;

  delta = (INT)(header->VirtualAddress - header->PointerToRawData);

  pExportDir   =  (PIMAGE_EXPORT_DIRECTORY)file.GetPtrFromRVA(exportsStartRVA);
  pdwFunctions =	(PDWORD)file.GetPtrFromRVA(pExportDir->AddressOfFunctions);
  pwOrdinals   =	(PWORD)file.GetPtrFromRVA(pExportDir->AddressOfNameOrdinals);
  pszFuncNames =	(DWORD *)file.GetPtrFromRVA(pExportDir->AddressOfNames);

  for (i = 0; i < pExportDir->NumberOfFunctions; i++, pdwFunctions++)
  {
    DWORD entryPointRVA = *pdwFunctions;

    if ( entryPointRVA == 0 )
      continue;

    for (UINT j = 0; j < pExportDir->NumberOfNames; j++)
    {
      if (pwOrdinals[j] == i)
      {
        lstrcpynA(szName, (LPSTR)file.GetPtrFromRVA(pszFuncNames[j]), MAX_PATH);
        szName[MAX_PATH] = 0;
        CharUpper(szName);
        if (strstr(szName, "CORDLLMAIN") != 0) return entryPointRVA;
      }
    }
  }
  return 0;
}

// Merges a pure .NET assembly with a native DLL, inserting it into the specified section
void MergeModules(LPCTSTR pszAssembly, LPCTSTR pszNative, LPCTSTR pszSection, DWORD dwAdjust)
{
  CPEFile peFile;
  CPEFile peDest;
  HRESULT hr;
  DWORD dwMinRVA;
  DWORD dwMaxRVA;
  DWORD dwDestRVA;
  PIMAGE_SECTION_HEADER pSection;
  LPBYTE pSrc;
  LPBYTE pDest;
  DWORD dwSize;
  DWORD dwNewEntrypoint;
  PIMAGE_COR20_HEADER pCor;
  PIMAGE_NT_HEADERS32 pNT;
  PIMAGE_NT_HEADERS64 pNT64;
  int diffRVA;
  CTableData *p;
  DWORD *pdwRVA;
  DWORD dwRows;
  LPEXTRA_STUFF pExtra;

  // Open the .NET assembly
  hr = peFile.Open(pszAssembly);
  if (FAILED(hr)) return;

  // Scan the .NET assembly and find the block of .NET code specified in the .NET metadata
  if (!GetMinMaxCOR20RVA(peFile, dwMinRVA, dwMaxRVA))
  {
    _tprintf(_T("Unable to retrieve .NET assembly information for file %s\n"), pszAssembly);
    return;
  }
  // Total number of bytes of the block of .NET code we're going to merge
  dwSize = (dwMaxRVA - dwMinRVA) + ((PIMAGE_COR20_HEADER)peFile)->cb;

  // Open the destination file for readwrite access
  hr = peDest.Open(pszNative, FALSE);
  if (FAILED(hr)) return;

  // Make sure it has the section specified in the command-line
  pSection = peDest.GetSectionHeader(pszSection);
  if (!pSection)
  {
    _tprintf(_T("Unable to find section %s in file\n"), pszSection);
    return;
  }

  // If the section isn't large enough, tell the user how large it needs to be
  if (pSection->Misc.VirtualSize < (dwSize + sizeof(EXTRA_STUFF)))
  {
    _tprintf(_T("Not enough room in section for data.  Need %d bytes\n"), dwSize + sizeof(EXTRA_STUFF));
    return;
  }

  /*
  ** Find a new entrypoint to use for the DLL.  The old entrypoint is written into the .NET header
  */
  dwNewEntrypoint = GetExportedCorDllMainRVA(peDest);
  if (!dwNewEntrypoint)
  {
    _tprintf(_T("Native DLL must export a function that calls _CorDllMain, and its name must contain the word \"CorDllMain\".\n"));
    return;
  }

  // Change this section's flags
  pSection->Characteristics = IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_READ;
  dwDestRVA = pSection->VirtualAddress;

  pExtra = (LPEXTRA_STUFF)peDest.GetPtrFromRVA(dwDestRVA);
  dwDestRVA += sizeof(EXTRA_STUFF);

  // If the native DLL has been merged with an assembly beforehand, we need to strip the .NET stuff and restore the entrypoint
  pCor = peDest;
  if (pCor)
  {
    if (pCor->Flags & 0x10)
    {
      pNT = peDest;
      pNT64 = peDest;

      if (pNT)
        pNT->OptionalHeader.AddressOfEntryPoint = pCor->EntryPointToken;
      else
        pNT64->OptionalHeader.AddressOfEntryPoint = pCor->EntryPointToken;
    }
  }

  // Copy the assembly's .NET header into the section
  dwSize = ((PIMAGE_COR20_HEADER)peFile)->cb;
  pSrc = (LPBYTE)(PIMAGE_COR20_HEADER)peFile;
  pDest = (LPBYTE)peDest.GetPtrFromRVA(dwDestRVA);
  CopyMemory(pDest, pSrc, dwSize);

  pNT = peDest;
  pNT64 = peDest;

  // Fixup the NT header on the native DLL to include the new .NET header
  if (pNT)
  {
    pExtra->dwNativeEntryPoint = pNT->OptionalHeader.AddressOfEntryPoint;
    pNT->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress = dwDestRVA;
    pNT->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].Size = dwSize;
  }
  else
  {
    pExtra->dwNativeEntryPoint = pNT64->OptionalHeader.AddressOfEntryPoint;
    pNT64->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].VirtualAddress = dwDestRVA;
    pNT64->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR].Size = dwSize;
  }
  dwDestRVA += dwSize;
  if (dwDestRVA % 4) dwDestRVA += (4 - (dwDestRVA % 4));

  // Copy the .NET block of code and metadata into the section, after the header
  dwSize = dwMaxRVA - dwMinRVA;
  pSrc = (LPBYTE)peFile.GetPtrFromRVA(dwMinRVA);
  pDest = (LPBYTE)peDest.GetPtrFromRVA(dwDestRVA);
  CopyMemory(pDest, pSrc, dwSize);

  // Figure out by how much we need to change the RVA's to compensate for the relocation
  diffRVA = dwDestRVA - dwMinRVA;
  pCor = peDest;

  // Fixup the DLL entrypoints
  if (pNT)
  {
    pNT->OptionalHeader.MajorOperatingSystemVersion = 4;
    pNT->OptionalHeader.MajorSubsystemVersion = 4;
    if (pNT->OptionalHeader.AddressOfEntryPoint != dwNewEntrypoint)
    {
      pCor->EntryPointToken = pNT->OptionalHeader.AddressOfEntryPoint;
      pNT->OptionalHeader.AddressOfEntryPoint = dwNewEntrypoint;
    }
  }
  else
  {
    if (pNT64->OptionalHeader.AddressOfEntryPoint != dwNewEntrypoint)
    {
      pCor->EntryPointToken = pNT64->OptionalHeader.AddressOfEntryPoint;
      pNT64->OptionalHeader.AddressOfEntryPoint = dwNewEntrypoint;
    }
  }
  // Adjust the .NET headers to indicate we're a mixed DLL
  pCor->Flags = (pCor->Flags & 0xFFFE) | 0x10;

  // Fixup the metadata header RVA's
  if (pCor->MetaData.VirtualAddress) pCor->MetaData.VirtualAddress += diffRVA;
  if (pCor->Resources.VirtualAddress) pCor->Resources.VirtualAddress += diffRVA;
  if (pCor->StrongNameSignature.VirtualAddress) pCor->StrongNameSignature.VirtualAddress += diffRVA;
  if (pCor->CodeManagerTable.VirtualAddress) pCor->CodeManagerTable.VirtualAddress += diffRVA;
  if (pCor->VTableFixups.VirtualAddress) pCor->VTableFixups.VirtualAddress += diffRVA;
  if (pCor->ExportAddressTableJumps.VirtualAddress) pCor->ExportAddressTableJumps.VirtualAddress += diffRVA;
  if (pCor->ManagedNativeHeader.VirtualAddress) pCor->ManagedNativeHeader.VirtualAddress += diffRVA;

  CMetadata meta(peDest);
  CMetadataTables tables(meta);

  // Fixup all the RVA's for methods and fields that have them in the .NET code
  for (int n = 0; n < 2; n++)
  {
    p = tables.GetTable((n == 0) ? ttMethodDef : ttFieldRVA);
    if (p)
    {
      dwRows = p->GetRowCount();
      for (UINT uRow = 0; uRow < dwRows; uRow ++)
      {
        pdwRVA = (DWORD *)p->Column(uRow, (UINT)0);
        if (*pdwRVA)
          *pdwRVA = (*pdwRVA) + diffRVA;
      }
    }
  }

  // If this is a CE file, then change the processor to x86
  if (pNT)
  {
    if (pNT->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 
      || pNT->FileHeader.Machine == IMAGE_FILE_MACHINE_ARM)
    {
      pNT->FileHeader.Machine = IMAGE_FILE_MACHINE_I386;
      pNT->OptionalHeader.Subsystem = IMAGE_SUBSYSTEM_WINDOWS_CUI;
    }

    if (pNT->OptionalHeader.Subsystem == IMAGE_SUBSYSTEM_WINDOWS_CUI && (pCor->Flags & 0x08))
    {
      PIMAGE_SECTION_HEADER section = IMAGE_FIRST_SECTION(pNT);
      for (UINT i=0; i < pNT->FileHeader.NumberOfSections; i++, section++)
      {
        if (_tcscmp((LPCSTR)section->Name, _T(".bss")) == 0)
        {
          _tcscpy((LPSTR)section->Name, _T(".idata"));
          //section->Characteristics &= ~IMAGE_SCN_CNT_INITIALIZED_DATA;
          //section->Characteristics |= IMAGE_SCN_CNT_UNINITIALIZED_DATA;
          DWORD dwBSSRVA = section->VirtualAddress;
          LPBYTE pBSS = (LPBYTE)peDest.GetPtrFromRVA(dwBSSRVA);
          for (DWORD u = 0; u < section->SizeOfRawData; u++)
          {
            pBSS[u] = 0;
          }
        }
        if (section->SizeOfRawData < section->Misc.VirtualSize)
        {
          if (_tcscmp((LPCSTR)section->Name, _T(".data")) == 0 && dwAdjust > 0)
          {
            _tprintf(_T("\nWARNING: %s section has a RawData size of %d, less than its VirtualSize of %d, adjusting VirtualSize to %d\n"), section->Name, section->SizeOfRawData, section->Misc.VirtualSize, dwAdjust);
            section->Misc.VirtualSize = dwAdjust;
          }
          else
          {
            _tprintf(_T("\nWARNING: %s section has a RawData size of %d and a VirtualSize of %d, strong named image may not run on Windows CE\n"), section->Name, section->SizeOfRawData, section->Misc.VirtualSize);
          }
        }
      }
    }
  }

  if (pCor->Flags & 0x08)
    _tprintf(_T("\nWARNING: %s must be re-signed before it can be used!\n"), pszNative);

  _tprintf(_T("Success!\n"));
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted tools/mergebin/mergebin.sln.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mergebin", "mergebin.vcproj", "{F9D4C5F6-85FE-4E1A-BCB5-70FB8772FAFB}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Win32 = Debug|Win32
		Release|Win32 = Release|Win32
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{F9D4C5F6-85FE-4E1A-BCB5-70FB8772FAFB}.Debug|Win32.ActiveCfg = Debug|Win32
		{F9D4C5F6-85FE-4E1A-BCB5-70FB8772FAFB}.Debug|Win32.Build.0 = Debug|Win32
		{F9D4C5F6-85FE-4E1A-BCB5-70FB8772FAFB}.Release|Win32.ActiveCfg = Release|Win32
		{F9D4C5F6-85FE-4E1A-BCB5-70FB8772FAFB}.Release|Win32.Build.0 = Release|Win32
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































Deleted tools/mergebin/mergebin.vcproj.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
	ProjectType="Visual C++"
	Version="9.00"
	Name="mergebin"
	ProjectGUID="{F9D4C5F6-85FE-4E1A-BCB5-70FB8772FAFB}"
	RootNamespace="mergebin"
	Keyword="Win32Proj"
	TargetFrameworkVersion="131072"
	>
	<Platforms>
		<Platform
			Name="Win32"
		/>
	</Platforms>
	<ToolFiles>
	</ToolFiles>
	<Configurations>
		<Configuration
			Name="Debug|Win32"
			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
			IntermediateDirectory="$(ConfigurationName)"
			ConfigurationType="1"
			CharacterSet="2"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
				MinimalRebuild="true"
				BasicRuntimeChecks="3"
				RuntimeLibrary="3"
				UsePrecompiledHeader="2"
				WarningLevel="3"
				DebugInformationFormat="4"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				OutputFile="$(ProjectName).exe"
				LinkIncremental="2"
				GenerateDebugInformation="true"
				SubSystem="1"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				TargetMachine="1"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
		<Configuration
			Name="Release|Win32"
			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
			IntermediateDirectory="$(ConfigurationName)"
			ConfigurationType="1"
			CharacterSet="2"
			WholeProgramOptimization="0"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="1"
				FavorSizeOrSpeed="2"
				WholeProgramOptimization="false"
				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
				StringPooling="true"
				ExceptionHandling="0"
				RuntimeTypeInfo="false"
				UsePrecompiledHeader="2"
				WarningLevel="3"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				OutputFile="..\..\bin\tools\$(ProjectName).exe"
				LinkIncremental="1"
				GenerateManifest="false"
				GenerateDebugInformation="true"
				SubSystem="1"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				TargetMachine="1"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
	</Configurations>
	<References>
	</References>
	<Files>
		<Filter
			Name="Source Files"
			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
			>
			<File
				RelativePath=".\mergebin.cpp"
				>
			</File>
			<File
				RelativePath=".\MetaData.cpp"
				>
			</File>
			<File
				RelativePath=".\MetaDataTables.cpp"
				>
			</File>
			<File
				RelativePath=".\PEFile.cpp"
				>
			</File>
			<File
				RelativePath=".\stdafx.cpp"
				>
				<FileConfiguration
					Name="Debug|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						UsePrecompiledHeader="1"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						UsePrecompiledHeader="1"
					/>
				</FileConfiguration>
			</File>
			<File
				RelativePath=".\TableData.cpp"
				>
			</File>
		</Filter>
		<Filter
			Name="Header Files"
			Filter="h;hpp;hxx;hm;inl;inc;xsd"
			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
			>
			<File
				RelativePath=".\MetaData.h"
				>
			</File>
			<File
				RelativePath=".\MetaDataTables.h"
				>
			</File>
			<File
				RelativePath=".\PEFile.h"
				>
			</File>
			<File
				RelativePath=".\stdafx.h"
				>
			</File>
			<File
				RelativePath=".\TableData.h"
				>
			</File>
		</Filter>
		<Filter
			Name="Resource Files"
			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
			>
		</Filter>
		<File
			RelativePath=".\ReadMe.txt"
			>
		</File>
	</Files>
	<Globals>
	</Globals>
</VisualStudioProject>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































































































































































































































































































































































































































































































Deleted tools/mergebin/stdafx.cpp.

1
2
3
4
5
6
7
8
// stdafx.cpp : source file that includes just the standard includes
// mergebin.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"

// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
<
<
<
<
<
<
<
<
















Deleted tools/mergebin/stdafx.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once


#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
#define _WIN32_WINNT 0x0400

#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <tchar.h>
// TODO: reference additional headers your program requires here
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































Deleted tools/setup/exe/setup/ReadMe.txt.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
========================================================================
    WIN32 APPLICATION : setup Project Overview
========================================================================

AppWizard has created this setup application for you.  

This file contains a summary of what you will find in each of the files that
make up your setup application.


setup.vcproj
    This is the main project file for VC++ projects generated using an Application Wizard. 
    It contains information about the version of Visual C++ that generated the file, and 
    information about the platforms, configurations, and project features selected with the
    Application Wizard.

setup.cpp
    This is the main application source file.

/////////////////////////////////////////////////////////////////////////////
AppWizard has created the following resources:

setup.rc
    This is a listing of all of the Microsoft Windows resources that the
    program uses.  It includes the icons, bitmaps, and cursors that are stored
    in the RES subdirectory.  This file can be directly edited in Microsoft
    Visual C++.

Resource.h
    This is the standard header file, which defines new resource IDs.
    Microsoft Visual C++ reads and updates this file.

setup.ico
    This is an icon file, which is used as the application's icon (32x32).
    This icon is included by the main resource file setup.rc.

small.ico
    This is an icon file, which contains a smaller version (16x16)
    of the application's icon. This icon is included by the main resource
    file setup.rc.

/////////////////////////////////////////////////////////////////////////////
Other standard files:

StdAfx.h, StdAfx.cpp
    These files are used to build a precompiled header (PCH) file
    named setup.pch and a precompiled types file named StdAfx.obj.

/////////////////////////////////////////////////////////////////////////////
Other notes:

AppWizard uses "TODO:" comments to indicate parts of the source code you
should add to or customize.

/////////////////////////////////////////////////////////////////////////////
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<














































































































Deleted tools/setup/exe/setup/admin.manifest.

1
2
3
4
5
6
7
8
9
10
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="requireAdministrator"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>
<
<
<
<
<
<
<
<
<
<




















Deleted tools/setup/exe/setup/install.ico.

cannot compute difference between binary files

Deleted tools/setup/exe/setup/resource.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by setup.rc
//
#define IDI_SETUP                       5
#define IDD_SETUP_DIALOG                102
#define IDR_MAINFRAME                   128
#define IDR_MSI1                        130
#define IDC_STATIC                      -1

// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC                     1
#define _APS_NEXT_RESOURCE_VALUE        131
#define _APS_NEXT_COMMAND_VALUE         32771
#define _APS_NEXT_CONTROL_VALUE         1000
#define _APS_NEXT_SYMED_VALUE           110
#endif
#endif
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































Deleted tools/setup/exe/setup/setup.cpp.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// setup.cpp : Defines the entry point for the application.
//

#include "stdafx.h"
#include "setup.h"

int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE /*hPrevInstance*/,
                     LPTSTR    /*lpCmdLine*/,
                     int       /*nCmdShow*/)
{
  HRSRC hRes = FindResource(hInstance, MAKEINTRESOURCE(1), _T("MSI"));
  HGLOBAL hGlob = LoadResource(hInstance, hRes);
  DWORD dwSize = SizeofResource(hInstance, hRes);
  LPVOID pv  = LockResource(hGlob);
  TCHAR szDir[MAX_PATH];
  TCHAR szPath[MAX_PATH];

  GetTempPath(MAX_PATH, szDir);
  GetTempFileName(szDir, _T("tmp"), 0, szPath);
  DeleteFile(szPath);
  lstrcat(szPath, _T(".msi"));

  HANDLE hFile = CreateFile(szPath, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
  WriteFile(hFile, pv, dwSize, &dwSize, NULL);
  CloseHandle(hFile);

  SHELLEXECUTEINFO shex;

  ZeroMemory(&shex, sizeof(shex));

  shex.cbSize = sizeof(shex);
  shex.fMask = SEE_MASK_NOCLOSEPROCESS;

  shex.lpFile = szPath;

  if (ShellExecuteEx(&shex))
  {
    if (shex.hProcess)
    {
      WaitForSingleObject(shex.hProcess, INFINITE);
    }
  }
  while (!DeleteFile(szPath))
    Sleep(250);

  return 0;
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































Deleted tools/setup/exe/setup/setup.h.

1
2
3
#pragma once

#include "resource.h"
<
<
<






Deleted tools/setup/exe/setup/setup.rc.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32

#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//

1 TEXTINCLUDE 
BEGIN
    "resource.h\0"
END

2 TEXTINCLUDE 
BEGIN
    "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
    "#include ""windows.h""\r\n"
    "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
    "\0"
END

3 TEXTINCLUDE 
BEGIN
    "\r\n"
    "\0"
END

#endif    // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
// Version
//

VS_VERSION_INFO VERSIONINFO
 FILEVERSION 1,0,66,0
 PRODUCTVERSION 1,0,0,0
 FILEFLAGSMASK 0x17L
#ifdef _DEBUG
 FILEFLAGS 0x1L
#else
 FILEFLAGS 0x0L
#endif
 FILEOS 0x4L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904b0"
        BEGIN
            VALUE "Comments", "http://sqlite.phxsoftware.com"
            VALUE "FileDescription", "SQLite ADO.NET 2.0/3.5 Setup"
            VALUE "FileVersion", "1.0.66.0"
            VALUE "InternalName", "setup"
            VALUE "LegalCopyright", "Released to the public domain"
            VALUE "OriginalFilename", "setup.exe"
            VALUE "ProductName", "System.Data.SQLite"
            VALUE "ProductVersion", "1.0"
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1200
    END
END


/////////////////////////////////////////////////////////////////////////////
//
// Icon
//

// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_SETUP               ICON                    ".\\install.ico"

/////////////////////////////////////////////////////////////////////////////
//
// MSI
//

1                       MSI                     "..\\..\\sqlite_setup.msi"
#endif    // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////



#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//


/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED

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




















































































































































































































































Deleted tools/setup/exe/setup/setup.vcproj.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
	ProjectType="Visual C++"
	Version="9.00"
	Name="setup"
	ProjectGUID="{BA304689-521B-4E60-A4B7-09558602C1BC}"
	RootNamespace="setup"
	Keyword="Win32Proj"
	TargetFrameworkVersion="131072"
	>
	<Platforms>
		<Platform
			Name="Win32"
		/>
	</Platforms>
	<ToolFiles>
	</ToolFiles>
	<Configurations>
		<Configuration
			Name="Debug|Win32"
			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
			IntermediateDirectory="$(ConfigurationName)"
			ConfigurationType="1"
			CharacterSet="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="0"
				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
				MinimalRebuild="true"
				BasicRuntimeChecks="3"
				RuntimeLibrary="3"
				UsePrecompiledHeader="2"
				WarningLevel="3"
				Detect64BitPortabilityProblems="true"
				DebugInformationFormat="4"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				LinkIncremental="2"
				GenerateDebugInformation="true"
				SubSystem="2"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				TargetMachine="1"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
				AdditionalManifestFiles="admin.manifest"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
		<Configuration
			Name="Release|Win32"
			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
			IntermediateDirectory="$(ConfigurationName)"
			ConfigurationType="1"
			CharacterSet="1"
			WholeProgramOptimization="1"
			>
			<Tool
				Name="VCPreBuildEventTool"
			/>
			<Tool
				Name="VCCustomBuildTool"
			/>
			<Tool
				Name="VCXMLDataGeneratorTool"
			/>
			<Tool
				Name="VCWebServiceProxyGeneratorTool"
			/>
			<Tool
				Name="VCMIDLTool"
			/>
			<Tool
				Name="VCCLCompilerTool"
				Optimization="1"
				InlineFunctionExpansion="1"
				FavorSizeOrSpeed="2"
				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
				UsePrecompiledHeader="2"
			/>
			<Tool
				Name="VCManagedResourceCompilerTool"
			/>
			<Tool
				Name="VCResourceCompilerTool"
			/>
			<Tool
				Name="VCPreLinkEventTool"
			/>
			<Tool
				Name="VCLinkerTool"
				UACExecutionLevel="2"
				SubSystem="2"
				OptimizeReferences="2"
				EnableCOMDATFolding="2"
				RandomizedBaseAddress="1"
				DataExecutionPrevention="0"
				TargetMachine="1"
			/>
			<Tool
				Name="VCALinkTool"
			/>
			<Tool
				Name="VCManifestTool"
			/>
			<Tool
				Name="VCXDCMakeTool"
			/>
			<Tool
				Name="VCBscMakeTool"
			/>
			<Tool
				Name="VCFxCopTool"
			/>
			<Tool
				Name="VCAppVerifierTool"
			/>
			<Tool
				Name="VCPostBuildEventTool"
			/>
		</Configuration>
	</Configurations>
	<References>
	</References>
	<Files>
		<Filter
			Name="Source Files"
			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
			>
			<File
				RelativePath=".\setup.cpp"
				>
			</File>
			<File
				RelativePath=".\stdafx.cpp"
				>
				<FileConfiguration
					Name="Debug|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						UsePrecompiledHeader="1"
					/>
				</FileConfiguration>
				<FileConfiguration
					Name="Release|Win32"
					>
					<Tool
						Name="VCCLCompilerTool"
						UsePrecompiledHeader="1"
					/>
				</FileConfiguration>
			</File>
		</Filter>
		<Filter
			Name="Header Files"
			Filter="h;hpp;hxx;hm;inl;inc;xsd"
			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
			>
			<File
				RelativePath=".\Resource.h"
				>
			</File>
			<File
				RelativePath=".\setup.h"
				>
			</File>
			<File
				RelativePath=".\stdafx.h"
				>
			</File>
		</Filter>
		<Filter
			Name="Resource Files"
			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
			>
			<File
				RelativePath=".\install.ico"
				>
			</File>
			<File
				RelativePath=".\setup.rc"
				>
			</File>
		</Filter>
		<File
			RelativePath=".\ReadMe.txt"
			>
		</File>
		<File
			RelativePath="..\..\sqlite_setup.msi"
			>
		</File>
	</Files>
	<Globals>
	</Globals>
</VisualStudioProject>
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































































































































































































































































































































































































































































































Deleted tools/setup/exe/setup/stdafx.cpp.

1
2
3
4
5
6
7
8
// stdafx.cpp : source file that includes just the standard includes
// setup.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information

#include "stdafx.h"

// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
<
<
<
<
<
<
<
<
















Deleted tools/setup/exe/setup/stdafx.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once

// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER				// Allow use of features specific to Windows XP or later.
#define WINVER 0x0500		// Change this to the appropriate value to target other versions of Windows.
#endif

#ifndef _WIN32_WINNT		// Allow use of features specific to Windows XP or later.                   
#define _WIN32_WINNT 0x0500	// Change this to the appropriate value to target other versions of Windows.
#endif						

#ifndef _WIN32_WINDOWS		// Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif

#ifndef _WIN32_IE			// Allow use of features specific to IE 6.0 or later.
#define _WIN32_IE 0x0500	// Change this to the appropriate value to target other versions of IE.
#endif

#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
// Windows Header Files:
#include <windows.h>

// C RunTime Header Files
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <shellapi.h>

// TODO: reference additional headers your program requires here
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










































































Deleted tools/setup/install.ico.

cannot compute difference between binary files

Deleted tools/setup/sqlite_setup.sln.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "sqlite", "sqlite_setup.vdproj", "{B2C2F7A0-FD29-4249-9AB1-4A38BDA1AB94}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "setup", "exe\setup\setup.vcproj", "{BA304689-521B-4E60-A4B7-09558602C1BC}"
	ProjectSection(ProjectDependencies) = postProject
		{B2C2F7A0-FD29-4249-9AB1-4A38BDA1AB94} = {B2C2F7A0-FD29-4249-9AB1-4A38BDA1AB94}
	EndProjectSection
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Win32 = Debug|Win32
		Release|Win32 = Release|Win32
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{B2C2F7A0-FD29-4249-9AB1-4A38BDA1AB94}.Debug|Win32.ActiveCfg = Debug
		{B2C2F7A0-FD29-4249-9AB1-4A38BDA1AB94}.Debug|Win32.Build.0 = Debug
		{B2C2F7A0-FD29-4249-9AB1-4A38BDA1AB94}.Release|Win32.ActiveCfg = Release
		{B2C2F7A0-FD29-4249-9AB1-4A38BDA1AB94}.Release|Win32.Build.0 = Release
		{BA304689-521B-4E60-A4B7-09558602C1BC}.Debug|Win32.ActiveCfg = Debug|Win32
		{BA304689-521B-4E60-A4B7-09558602C1BC}.Debug|Win32.Build.0 = Debug|Win32
		{BA304689-521B-4E60-A4B7-09558602C1BC}.Release|Win32.ActiveCfg = Release|Win32
		{BA304689-521B-4E60-A4B7-09558602C1BC}.Release|Win32.Build.0 = Release|Win32
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































Deleted tools/setup/sqlite_setup.suo.

cannot compute difference between binary files

Deleted tools/setup/sqlite_setup.vdproj.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
"DeployProject"
{
"VSVersion" = "3:800"
"ProjectType" = "8:{978C614F-708E-4E1A-B201-565925725DBA}"
"IsWebType" = "8:FALSE"
"ProjectName" = "8:sqlite"
"LanguageId" = "3:1033"
"CodePage" = "3:1252"
"UILanguageId" = "3:1033"
"SccProjectName" = "8:"
"SccLocalPath" = "8:"
"SccAuxPath" = "8:"
"SccProvider" = "8:"
    "Hierarchy"
    {
        "Entry"
        {
        "MsmKey" = "8:_055B2BCD025C40A08F3B155843F41702"
        "OwnerKey" = "8:_UNDEFINED"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_17D200EF10AB73D2A0E2D26B279AF28F"
        "OwnerKey" = "8:_A7448E608040319F6C5E12637881B1F6"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_1A571C82DAEBE73A54E0D256CAAD80DF"
        "OwnerKey" = "8:_3578C7AADEF926410602B18EDBBEFFF9"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_2220AA4B8FC0414FAC08D27E052E7953"
        "OwnerKey" = "8:_UNDEFINED"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_244D4945EA335F5E4E54085BFD020CC1"
        "OwnerKey" = "8:_A7448E608040319F6C5E12637881B1F6"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_26E74AC417994018832F9B82462AA3AF"
        "OwnerKey" = "8:_UNDEFINED"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_2C7EDFF06B61482393D94E3A63D90113"
        "OwnerKey" = "8:_UNDEFINED"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_2F1B8EFE95EB431689C8DA9D5BD6B27C"
        "OwnerKey" = "8:_UNDEFINED"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_33349D46CCFB4E16A3F7C6CE1FE6F6C9"
        "OwnerKey" = "8:_UNDEFINED"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_3578C7AADEF926410602B18EDBBEFFF9"
        "OwnerKey" = "8:_244D4945EA335F5E4E54085BFD020CC1"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_40DFF08BA903482D807E715A041CA8B1"
        "OwnerKey" = "8:_UNDEFINED"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_40F352185F3B41A485F42BFC64BF9162"
        "OwnerKey" = "8:_UNDEFINED"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_5E1053CD325EBB535F3F247A35B38F2F"
        "OwnerKey" = "8:_CD3CE5CDAB13405EA6EAAADC95F88D2E"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_5E1053CD325EBB535F3F247A35B38F2F"
        "OwnerKey" = "8:_3578C7AADEF926410602B18EDBBEFFF9"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_5E1053CD325EBB535F3F247A35B38F2F"
        "OwnerKey" = "8:_244D4945EA335F5E4E54085BFD020CC1"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_5E1053CD325EBB535F3F247A35B38F2F"
        "OwnerKey" = "8:_A7448E608040319F6C5E12637881B1F6"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_5E1053CD325EBB535F3F247A35B38F2F"
        "OwnerKey" = "8:_D02FA65544C54EDE80CFCBDE5F083939"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_5E1053CD325EBB535F3F247A35B38F2F"
        "OwnerKey" = "8:_E6DB5A9B08AC4645A19C948BBFDD0348"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_60C2B7171C4DE2785B2909B93E746B5F"
        "OwnerKey" = "8:_A7448E608040319F6C5E12637881B1F6"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_60E2C442F77C48DE8150EBFC86663225"
        "OwnerKey" = "8:_UNDEFINED"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_67BCC20EB4B5AFB1D823AF28F05F85EF"
        "OwnerKey" = "8:_40F352185F3B41A485F42BFC64BF9162"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_823D5E0236764C498DFE3D984D1920B6"
        "OwnerKey" = "8:_UNDEFINED"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_9352653B827F735B8C3BE81D11522ECC"
        "OwnerKey" = "8:_B00FB4712154B7A5894294702C96689D"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_A7448E608040319F6C5E12637881B1F6"
        "OwnerKey" = "8:_CD3CE5CDAB13405EA6EAAADC95F88D2E"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_B00FB4712154B7A5894294702C96689D"
        "OwnerKey" = "8:_A7448E608040319F6C5E12637881B1F6"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_B00FB4712154B7A5894294702C96689D"
        "OwnerKey" = "8:_CD3CE5CDAB13405EA6EAAADC95F88D2E"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_B29C75F5F4D24817846DCEF9951068E1"
        "OwnerKey" = "8:_UNDEFINED"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_B6156897CBBB4E929D9C1F7358CE9E90"
        "OwnerKey" = "8:_UNDEFINED"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_C8E329AC56AD4C88A986481E639F72A5"
        "OwnerKey" = "8:_UNDEFINED"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_CCB664E21F5133181FD1271CE9E1806D"
        "OwnerKey" = "8:_2C7EDFF06B61482393D94E3A63D90113"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_CCB664E21F5133181FD1271CE9E1806D"
        "OwnerKey" = "8:_CE9E3EF0722342DB8DE0860C0DDCD39E"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_CD3CE5CDAB13405EA6EAAADC95F88D2E"
        "OwnerKey" = "8:_UNDEFINED"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_CE9E3EF0722342DB8DE0860C0DDCD39E"
        "OwnerKey" = "8:_UNDEFINED"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_CEFA203C4DAE4417B0E17113DA2684CD"
        "OwnerKey" = "8:_UNDEFINED"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_D02FA65544C54EDE80CFCBDE5F083939"
        "OwnerKey" = "8:_E6DB5A9B08AC4645A19C948BBFDD0348"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_D02FA65544C54EDE80CFCBDE5F083939"
        "OwnerKey" = "8:_A7448E608040319F6C5E12637881B1F6"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_D02FA65544C54EDE80CFCBDE5F083939"
        "OwnerKey" = "8:_244D4945EA335F5E4E54085BFD020CC1"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_D02FA65544C54EDE80CFCBDE5F083939"
        "OwnerKey" = "8:_3578C7AADEF926410602B18EDBBEFFF9"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_D7FECFD3C8164DA7B3712AF54D0CDDAD"
        "OwnerKey" = "8:_UNDEFINED"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_E6DB5A9B08AC4645A19C948BBFDD0348"
        "OwnerKey" = "8:_CD3CE5CDAB13405EA6EAAADC95F88D2E"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_E6DB5A9B08AC4645A19C948BBFDD0348"
        "OwnerKey" = "8:_A7448E608040319F6C5E12637881B1F6"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_E6DB5A9B08AC4645A19C948BBFDD0348"
        "OwnerKey" = "8:_3578C7AADEF926410602B18EDBBEFFF9"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_E6DB5A9B08AC4645A19C948BBFDD0348"
        "OwnerKey" = "8:_244D4945EA335F5E4E54085BFD020CC1"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_UNDEFINED"
        "OwnerKey" = "8:_B29C75F5F4D24817846DCEF9951068E1"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_UNDEFINED"
        "OwnerKey" = "8:_E6DB5A9B08AC4645A19C948BBFDD0348"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_UNDEFINED"
        "OwnerKey" = "8:_D02FA65544C54EDE80CFCBDE5F083939"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_UNDEFINED"
        "OwnerKey" = "8:_CE9E3EF0722342DB8DE0860C0DDCD39E"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_UNDEFINED"
        "OwnerKey" = "8:_CD3CE5CDAB13405EA6EAAADC95F88D2E"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_UNDEFINED"
        "OwnerKey" = "8:_B00FB4712154B7A5894294702C96689D"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_UNDEFINED"
        "OwnerKey" = "8:_A7448E608040319F6C5E12637881B1F6"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_UNDEFINED"
        "OwnerKey" = "8:_60C2B7171C4DE2785B2909B93E746B5F"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_UNDEFINED"
        "OwnerKey" = "8:_5E1053CD325EBB535F3F247A35B38F2F"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_UNDEFINED"
        "OwnerKey" = "8:_40F352185F3B41A485F42BFC64BF9162"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_UNDEFINED"
        "OwnerKey" = "8:_67BCC20EB4B5AFB1D823AF28F05F85EF"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_UNDEFINED"
        "OwnerKey" = "8:_40DFF08BA903482D807E715A041CA8B1"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_UNDEFINED"
        "OwnerKey" = "8:_3578C7AADEF926410602B18EDBBEFFF9"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_UNDEFINED"
        "OwnerKey" = "8:_2C7EDFF06B61482393D94E3A63D90113"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_UNDEFINED"
        "OwnerKey" = "8:_CCB664E21F5133181FD1271CE9E1806D"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_UNDEFINED"
        "OwnerKey" = "8:_244D4945EA335F5E4E54085BFD020CC1"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_UNDEFINED"
        "OwnerKey" = "8:_1A571C82DAEBE73A54E0D256CAAD80DF"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_UNDEFINED"
        "OwnerKey" = "8:_17D200EF10AB73D2A0E2D26B279AF28F"
        "MsmSig" = "8:_UNDEFINED"
        }
        "Entry"
        {
        "MsmKey" = "8:_UNDEFINED"
        "OwnerKey" = "8:_2F1B8EFE95EB431689C8DA9D5BD6B27C"
        "MsmSig" = "8:_UNDEFINED"
        }
    }
    "Configurations"
    {
        "Debug"
        {
        "DisplayName" = "8:Debug"
        "IsDebugOnly" = "11:TRUE"
        "IsReleaseOnly" = "11:FALSE"
        "OutputFilename" = "8:Debug\\sqlite_setup.msi"
        "PackageFilesAs" = "3:4"
        "PackageFileSize" = "3:-2147483648"
        "CabType" = "3:1"
        "Compression" = "3:3"
        "SignOutput" = "11:FALSE"
        "CertificateFile" = "8:"
        "PrivateKeyFile" = "8:"
        "TimeStampServer" = "8:"
        "InstallerBootstrapper" = "3:2"
            "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}"
            {
            "Enabled" = "11:TRUE"
            "PromptEnabled" = "11:TRUE"
            "PrerequisitesLocation" = "2:1"
            "Url" = "8:"
            "ComponentsUrl" = "8:"
                "Items"
                {
                }
            }
        }
        "Release"
        {
        "DisplayName" = "8:Release"
        "IsDebugOnly" = "11:FALSE"
        "IsReleaseOnly" = "11:TRUE"
        "OutputFilename" = "8:sqlite_setup.msi"
        "PackageFilesAs" = "3:2"
        "PackageFileSize" = "3:-2147483648"
        "CabType" = "3:1"
        "Compression" = "3:3"
        "SignOutput" = "11:FALSE"
        "CertificateFile" = "8:"
        "PrivateKeyFile" = "8:"
        "TimeStampServer" = "8:"
        "InstallerBootstrapper" = "3:2"
            "BootstrapperCfg:{63ACBE69-63AA-4F98-B2B6-99F9E24495F2}"
            {
            "Enabled" = "11:FALSE"
            "PromptEnabled" = "11:TRUE"
            "PrerequisitesLocation" = "2:1"
            "Url" = "8:"
            "ComponentsUrl" = "8:"
                "Items"
                {
                    "{EDC2488A-8267-493A-A98E-7D9C3B36CDF3}:Microsoft.Net.Framework.2.0"
                    {
                    "Name" = "8:.NET Framework 2.0"
                    "ProductCode" = "8:Microsoft.Net.Framework.2.0"
                    }
                }
            }
        }
    }
    "Deployable"
    {
        "CustomAction"
        {
            "{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_70EF89170C604410AAB199512D4194A9"
            {
            "Name" = "8:install.exe"
            "Condition" = "8:"
            "Object" = "8:_40DFF08BA903482D807E715A041CA8B1"
            "FileType" = "3:2"
            "InstallAction" = "3:2"
            "Arguments" = "8:"
            "EntryPoint" = "8:"
            "Sequence" = "3:1"
            "Identifier" = "8:_2FB4763D_3341_48AE_8AE5_AC7B45119699"
            "InstallerClass" = "11:FALSE"
            "CustomActionData" = "8:"
            }
            "{4AA51A2D-7D85-4A59-BA75-B0809FC8B380}:_C386182ABAD545D288F427FBAFC865FE"
            {
            "Name" = "8:install.exe"
            "Condition" = "8:"
            "Object" = "8:_40DFF08BA903482D807E715A041CA8B1"
            "FileType" = "3:2"
            "InstallAction" = "3:4"
            "Arguments" = "8:/remove"
            "EntryPoint" = "8:"
            "Sequence" = "3:1"
            "Identifier" = "8:_F0391075_ECEB_4EA0_9EA9_DA922A93406D"
            "InstallerClass" = "11:FALSE"
            "CustomActionData" = "8:"
            }
        }
        "DefaultFeature"
        {
        "Name" = "8:DefaultFeature"
        "Title" = "8:"
        "Description" = "8:"
        }
        "ExternalPersistence"
        {
            "LaunchCondition"
            {
                "{A06ECF26-33A3-4562-8140-9B0E340D4F24}:_2A5202AB8FA440F9AA45DF7B9C7CEAD5"
                {
                "Name" = "8:.NET Framework"
                "Message" = "8:[VSDNETMSG]"
                "Version" = "8:2.0.50727"
                "AllowLaterVersions" = "11:TRUE"
                "InstallUrl" = "8:http://go.microsoft.com/fwlink/?LinkId=9832"
                }
            }
        }
        "File"
        {
            "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_055B2BCD025C40A08F3B155843F41702"
            {
            "SourcePath" = "8:..\\..\\bin\\test.exe.config"
            "TargetName" = "8:test.exe.config"
            "Tag" = "8:"
            "Folder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_17D200EF10AB73D2A0E2D26B279AF28F"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:TRUE"
            "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.VSHelp, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                "ScatterAssemblies"
                {
                    "_17D200EF10AB73D2A0E2D26B279AF28F"
                    {
                    "Name" = "8:Microsoft.VisualStudio.VSHelp.dll"
                    "Attributes" = "3:512"
                    }
                }
            "SourcePath" = "8:Microsoft.VisualStudio.VSHelp.dll"
            "TargetName" = "8:"
            "Tag" = "8:"
            "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:TRUE"
            "IsDependency" = "11:TRUE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_1A571C82DAEBE73A54E0D256CAAD80DF"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:TRUE"
            "AssemblyAsmDisplayName" = "8:Microsoft.MSXML, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
                "ScatterAssemblies"
                {
                    "_1A571C82DAEBE73A54E0D256CAAD80DF"
                    {
                    "Name" = "8:Microsoft.MSXML.dll"
                    "Attributes" = "3:512"
                    }
                }
            "SourcePath" = "8:Microsoft.MSXML.dll"
            "TargetName" = "8:"
            "Tag" = "8:"
            "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:TRUE"
            "IsDependency" = "11:TRUE"
            "IsolateTo" = "8:"
            }
            "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_2220AA4B8FC0414FAC08D27E052E7953"
            {
            "SourcePath" = "8:..\\..\\bin\\CompactFramework\\SQLite.Interop.066.DLL"
            "TargetName" = "8:SQLite.Interop.066.DLL"
            "Tag" = "8:"
            "Folder" = "8:_10C8E86E2EEF451BB40F774C35C5466F"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_244D4945EA335F5E4E54085BFD020CC1"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:TRUE"
            "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                "ScatterAssemblies"
                {
                    "_244D4945EA335F5E4E54085BFD020CC1"
                    {
                    "Name" = "8:Microsoft.VisualStudio.Shell.Interop.8.0.dll"
                    "Attributes" = "3:512"
                    }
                }
            "SourcePath" = "8:Microsoft.VisualStudio.Shell.Interop.8.0.dll"
            "TargetName" = "8:"
            "Tag" = "8:"
            "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:TRUE"
            "IsDependency" = "11:TRUE"
            "IsolateTo" = "8:"
            }
            "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_26E74AC417994018832F9B82462AA3AF"
            {
            "SourcePath" = "8:..\\..\\bin\\x64\\System.Data.SQLite.lib"
            "TargetName" = "8:System.Data.SQLite.lib"
            "Tag" = "8:"
            "Folder" = "8:_66DBD0998AA8499691D4F5E42417697D"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_2C7EDFF06B61482393D94E3A63D90113"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:test, Version=1.0.0.27314, Culture=neutral, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_2C7EDFF06B61482393D94E3A63D90113"
                    {
                    "Name" = "8:test.exe"
                    "Attributes" = "3:512"
                    }
                }
            "SourcePath" = "8:..\\..\\bin\\test.exe"
            "TargetName" = "8:"
            "Tag" = "8:"
            "Folder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_2F1B8EFE95EB431689C8DA9D5BD6B27C"
            {
            "SourcePath" = "8:..\\..\\bin\\itanium\\System.Data.SQLite.DLL"
            "TargetName" = "8:System.Data.SQLite.DLL"
            "Tag" = "8:"
            "Folder" = "8:_0A3DFFBE592540FAA6FF90CCE3B32CA4"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            "AssemblyAsmDisplayName" = "8:System.Data.SQLite, Version=1.0.27.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=IA64"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyRegister" = "3:1"
                "ScatterAssemblies"
                {
                    "_2F1B8EFE95EB431689C8DA9D5BD6B27C"
                    {
                    "Attributes" = "3:512"
                    "Name" = "8:System.Data.SQLite.DLL"
                    }
                }
            }
            "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_33349D46CCFB4E16A3F7C6CE1FE6F6C9"
            {
            "SourcePath" = "8:..\\..\\bin\\System.Data.SQLite.XML"
            "TargetName" = "8:System.Data.SQLite.XML"
            "Tag" = "8:"
            "Folder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_3578C7AADEF926410602B18EDBBEFFF9"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:TRUE"
            "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.TextManager.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                "ScatterAssemblies"
                {
                    "_3578C7AADEF926410602B18EDBBEFFF9"
                    {
                    "Name" = "8:Microsoft.VisualStudio.TextManager.Interop.8.0.dll"
                    "Attributes" = "3:512"
                    }
                }
            "SourcePath" = "8:Microsoft.VisualStudio.TextManager.Interop.8.0.dll"
            "TargetName" = "8:"
            "Tag" = "8:"
            "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:TRUE"
            "IsDependency" = "11:TRUE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_40DFF08BA903482D807E715A041CA8B1"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:install, Version=1.0.0.28513, Culture=neutral, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_40DFF08BA903482D807E715A041CA8B1"
                    {
                    "Name" = "8:install.exe"
                    "Attributes" = "3:512"
                    }
                }
            "SourcePath" = "8:..\\..\\bin\\Designer\\install.exe"
            "TargetName" = "8:"
            "Tag" = "8:"
            "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_40F352185F3B41A485F42BFC64BF9162"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:testce, Version=1.0.0.27290, Culture=neutral, processorArchitecture=MSIL"
                "ScatterAssemblies"
                {
                    "_40F352185F3B41A485F42BFC64BF9162"
                    {
                    "Name" = "8:testce.exe"
                    "Attributes" = "3:512"
                    }
                }
            "SourcePath" = "8:..\\..\\bin\\CompactFramework\\testce.exe"
            "TargetName" = "8:"
            "Tag" = "8:"
            "Folder" = "8:_10C8E86E2EEF451BB40F774C35C5466F"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_5E1053CD325EBB535F3F247A35B38F2F"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:TRUE"
            "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                "ScatterAssemblies"
                {
                    "_5E1053CD325EBB535F3F247A35B38F2F"
                    {
                    "Name" = "8:Microsoft.VisualStudio.OLE.Interop.dll"
                    "Attributes" = "3:512"
                    }
                }
            "SourcePath" = "8:Microsoft.VisualStudio.OLE.Interop.dll"
            "TargetName" = "8:"
            "Tag" = "8:"
            "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:TRUE"
            "IsDependency" = "11:TRUE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_60C2B7171C4DE2785B2909B93E746B5F"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:TRUE"
            "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.ProjectAggregator, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
                "ScatterAssemblies"
                {
                    "_60C2B7171C4DE2785B2909B93E746B5F"
                    {
                    "Name" = "8:Microsoft.VisualStudio.ProjectAggregator.dll"
                    "Attributes" = "3:512"
                    }
                }
            "SourcePath" = "8:Microsoft.VisualStudio.ProjectAggregator.dll"
            "TargetName" = "8:"
            "Tag" = "8:"
            "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:TRUE"
            "IsDependency" = "11:TRUE"
            "IsolateTo" = "8:"
            }
            "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_60E2C442F77C48DE8150EBFC86663225"
            {
            "SourcePath" = "8:..\\..\\Doc\\SQLite.NET.chm"
            "TargetName" = "8:SQLite.NET.chm"
            "Tag" = "8:"
            "Folder" = "8:_CA5E61837F5B452B8169C698979CF05C"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_67BCC20EB4B5AFB1D823AF28F05F85EF"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=1fdb50b1b62b4c84, processorArchitecture=MSIL"
                "ScatterAssemblies"
                {
                    "_67BCC20EB4B5AFB1D823AF28F05F85EF"
                    {
                    "Name" = "8:System.Data.SQLite.DLL"
                    "Attributes" = "3:512"
                    }
                }
            "SourcePath" = "8:System.Data.SQLite.DLL"
            "TargetName" = "8:"
            "Tag" = "8:"
            "Folder" = "8:_10C8E86E2EEF451BB40F774C35C5466F"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:TRUE"
            "IsolateTo" = "8:"
            }
            "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_823D5E0236764C498DFE3D984D1920B6"
            {
            "SourcePath" = "8:..\\..\\bin\\CompactFramework\\SQLite.Interop.066.lib"
            "TargetName" = "8:SQLite.Interop.066.lib"
            "Tag" = "8:"
            "Folder" = "8:_10C8E86E2EEF451BB40F774C35C5466F"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_9352653B827F735B8C3BE81D11522ECC"
            {
            "SourcePath" = "8:dte80a.olb"
            "TargetName" = "8:dte80a.olb"
            "Tag" = "8:"
            "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:TRUE"
            "IsDependency" = "11:TRUE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_A7448E608040319F6C5E12637881B1F6"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:TRUE"
            "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.Shell, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
                "ScatterAssemblies"
                {
                    "_A7448E608040319F6C5E12637881B1F6"
                    {
                    "Name" = "8:Microsoft.VisualStudio.Shell.dll"
                    "Attributes" = "3:512"
                    }
                }
            "SourcePath" = "8:Microsoft.VisualStudio.Shell.dll"
            "TargetName" = "8:"
            "Tag" = "8:"
            "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:TRUE"
            "IsDependency" = "11:TRUE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_B00FB4712154B7A5894294702C96689D"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:TRUE"
            "AssemblyAsmDisplayName" = "8:EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                "ScatterAssemblies"
                {
                    "_B00FB4712154B7A5894294702C96689D"
                    {
                    "Name" = "8:EnvDTE.dll"
                    "Attributes" = "3:512"
                    }
                }
            "SourcePath" = "8:EnvDTE.dll"
            "TargetName" = "8:"
            "Tag" = "8:"
            "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:TRUE"
            "IsDependency" = "11:TRUE"
            "IsolateTo" = "8:"
            }
            "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_B29C75F5F4D24817846DCEF9951068E1"
            {
            "SourcePath" = "8:..\\..\\bin\\x64\\System.Data.SQLite.DLL"
            "TargetName" = "8:System.Data.SQLite.DLL"
            "Tag" = "8:"
            "Folder" = "8:_66DBD0998AA8499691D4F5E42417697D"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            "AssemblyAsmDisplayName" = "8:System.Data.SQLite, Version=1.0.27.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=AMD64"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyRegister" = "3:1"
                "ScatterAssemblies"
                {
                    "_B29C75F5F4D24817846DCEF9951068E1"
                    {
                    "Attributes" = "3:512"
                    "Name" = "8:System.Data.SQLite.DLL"
                    }
                }
            }
            "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_B6156897CBBB4E929D9C1F7358CE9E90"
            {
            "SourcePath" = "8:topband.jpg"
            "TargetName" = "8:topband.jpg"
            "Tag" = "8:"
            "Folder" = "8:_A0841E79B7874F7288672343934C7657"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:TRUE"
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_C8E329AC56AD4C88A986481E639F72A5"
            {
            "SourcePath" = "8:..\\..\\readme.htm"
            "TargetName" = "8:readme.htm"
            "Tag" = "8:"
            "Folder" = "8:_A0841E79B7874F7288672343934C7657"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_CCB664E21F5133181FD1271CE9E1806D"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:System.Data.SQLite, Version=1.0.66.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_CCB664E21F5133181FD1271CE9E1806D"
                    {
                    "Name" = "8:System.Data.SQLite.DLL"
                    "Attributes" = "3:512"
                    }
                }
            "SourcePath" = "8:System.Data.SQLite.DLL"
            "TargetName" = "8:"
            "Tag" = "8:"
            "Folder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:TRUE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_CD3CE5CDAB13405EA6EAAADC95F88D2E"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:SQLite.Designer, Version=1.0.37.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=x86"
                "ScatterAssemblies"
                {
                    "_CD3CE5CDAB13405EA6EAAADC95F88D2E"
                    {
                    "Name" = "8:SQLite.Designer.dll"
                    "Attributes" = "3:512"
                    }
                }
            "SourcePath" = "8:..\\..\\bin\\Designer\\SQLite.Designer.dll"
            "TargetName" = "8:"
            "Tag" = "8:"
            "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_CE9E3EF0722342DB8DE0860C0DDCD39E"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:FALSE"
            "AssemblyAsmDisplayName" = "8:System.Data.SQLite.Linq, Version=2.0.38.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"
                "ScatterAssemblies"
                {
                    "_CE9E3EF0722342DB8DE0860C0DDCD39E"
                    {
                    "Name" = "8:System.Data.SQLite.Linq.dll"
                    "Attributes" = "3:512"
                    }
                }
            "SourcePath" = "8:..\\..\\bin\\System.Data.SQLite.Linq.dll"
            "TargetName" = "8:"
            "Tag" = "8:"
            "Folder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_CEFA203C4DAE4417B0E17113DA2684CD"
            {
            "SourcePath" = "8:..\\..\\bin\\itanium\\System.Data.SQLite.lib"
            "TargetName" = "8:System.Data.SQLite.lib"
            "Tag" = "8:"
            "Folder" = "8:_0A3DFFBE592540FAA6FF90CCE3B32CA4"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_D02FA65544C54EDE80CFCBDE5F083939"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:TRUE"
            "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.TextManager.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                "ScatterAssemblies"
                {
                    "_D02FA65544C54EDE80CFCBDE5F083939"
                    {
                    "Name" = "8:Microsoft.VisualStudio.TextManager.Interop.dll"
                    "Attributes" = "3:512"
                    }
                }
            "SourcePath" = "8:Microsoft.VisualStudio.TextManager.Interop.dll"
            "TargetName" = "8:"
            "Tag" = "8:"
            "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:TRUE"
            "IsDependency" = "11:TRUE"
            "IsolateTo" = "8:"
            }
            "{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_D7FECFD3C8164DA7B3712AF54D0CDDAD"
            {
            "SourcePath" = "8:..\\..\\bin\\System.Data.SQLite.lib"
            "TargetName" = "8:System.Data.SQLite.lib"
            "Tag" = "8:"
            "Folder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "IsolateTo" = "8:"
            }
            "{9F6F8455-1EF1-4B85-886A-4223BCC8E7F7}:_E6DB5A9B08AC4645A19C948BBFDD0348"
            {
            "AssemblyRegister" = "3:1"
            "AssemblyIsInGAC" = "11:TRUE"
            "AssemblyAsmDisplayName" = "8:Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                "ScatterAssemblies"
                {
                    "_E6DB5A9B08AC4645A19C948BBFDD0348"
                    {
                    "Name" = "8:Microsoft.VisualStudio.Shell.Interop.dll"
                    "Attributes" = "3:512"
                    }
                }
            "SourcePath" = "8:Microsoft.VisualStudio.Shell.Interop.dll"
            "TargetName" = "8:"
            "Tag" = "8:"
            "Folder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Vital" = "11:TRUE"
            "ReadOnly" = "11:FALSE"
            "Hidden" = "11:FALSE"
            "System" = "11:FALSE"
            "Permanent" = "11:FALSE"
            "SharedLegacy" = "11:FALSE"
            "PackageAs" = "3:1"
            "Register" = "3:1"
            "Exclude" = "11:TRUE"
            "IsDependency" = "11:TRUE"
            "IsolateTo" = "8:"
            }
        }
        "FileType"
        {
        }
        "Folder"
        {
            "{3C67513D-01DD-4637-8A68-80971EB9504F}:_A0841E79B7874F7288672343934C7657"
            {
            "DefaultLocation" = "8:[ProgramFilesFolder]SQLite.NET"
            "Name" = "8:#1925"
            "AlwaysCreate" = "11:FALSE"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Property" = "8:TARGETDIR"
                "Folders"
                {
                    "{9EF0B969-E518-4E46-987F-47570745A589}:_30C77BF2E6E84D01ADE5FB8BA2F81504"
                    {
                    "Name" = "8:bin"
                    "AlwaysCreate" = "11:FALSE"
                    "Condition" = "8:"
                    "Transitive" = "11:FALSE"
                    "Property" = "8:_BD4105DB73B04559A56BB70C4E151056"
                        "Folders"
                        {
                            "{9EF0B969-E518-4E46-987F-47570745A589}:_0A3DFFBE592540FAA6FF90CCE3B32CA4"
                            {
                            "Name" = "8:Itanium"
                            "AlwaysCreate" = "11:FALSE"
                            "Condition" = "8:"
                            "Transitive" = "11:FALSE"
                            "Property" = "8:_A0744D082A534C0D8F343965933775F9"
                                "Folders"
                                {
                                }
                            }
                            "{9EF0B969-E518-4E46-987F-47570745A589}:_10C8E86E2EEF451BB40F774C35C5466F"
                            {
                            "Name" = "8:CompactFramework"
                            "AlwaysCreate" = "11:FALSE"
                            "Condition" = "8:"
                            "Transitive" = "11:FALSE"
                            "Property" = "8:_ADFF37E4EEE146F2AE9609C07339779A"
                                "Folders"
                                {
                                }
                            }
                            "{9EF0B969-E518-4E46-987F-47570745A589}:_66DBD0998AA8499691D4F5E42417697D"
                            {
                            "Name" = "8:x64"
                            "AlwaysCreate" = "11:FALSE"
                            "Condition" = "8:"
                            "Transitive" = "11:FALSE"
                            "Property" = "8:_7C07DE0299AB478C8BC7AFB40E220305"
                                "Folders"
                                {
                                }
                            }
                            "{9EF0B969-E518-4E46-987F-47570745A589}:_F11D54EE0EEA4BF59B52E621630B6A2E"
                            {
                            "Name" = "8:Designer"
                            "AlwaysCreate" = "11:FALSE"
                            "Condition" = "8:"
                            "Transitive" = "11:FALSE"
                            "Property" = "8:_CA865020181A40EEB518ACF5F89BD66A"
                                "Folders"
                                {
                                }
                            }
                        }
                    }
                    "{9EF0B969-E518-4E46-987F-47570745A589}:_CA5E61837F5B452B8169C698979CF05C"
                    {
                    "Name" = "8:Doc"
                    "AlwaysCreate" = "11:FALSE"
                    "Condition" = "8:"
                    "Transitive" = "11:FALSE"
                    "Property" = "8:_B787482AA405492D998CAAD43761AF61"
                        "Folders"
                        {
                        }
                    }
                }
            }
            "{1525181F-901A-416C-8A58-119130FE478E}:_AB7F365F78A44DE79C7007FB08F7343E"
            {
            "Name" = "8:#1916"
            "AlwaysCreate" = "11:FALSE"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Property" = "8:DesktopFolder"
                "Folders"
                {
                }
            }
            "{1525181F-901A-416C-8A58-119130FE478E}:_E420345AA61B4AF780EEA7BC8AFAF268"
            {
            "Name" = "8:#1919"
            "AlwaysCreate" = "11:FALSE"
            "Condition" = "8:"
            "Transitive" = "11:FALSE"
            "Property" = "8:ProgramMenuFolder"
                "Folders"
                {
                    "{9EF0B969-E518-4E46-987F-47570745A589}:_1B562A9F876E47058AB813C418E24FBF"
                    {
                    "Name" = "8:SQLite.NET"
                    "AlwaysCreate" = "11:FALSE"
                    "Condition" = "8:"
                    "Transitive" = "11:FALSE"
                    "Property" = "8:_85ED61DA38214E1C9AB39E119A89D75B"
                        "Folders"
                        {
                        }
                    }
                }
            }
        }
        "LaunchCondition"
        {
        }
        "Locator"
        {
        }
        "MsiBootstrapper"
        {
        "LangId" = "3:1033"
        "RequiresElevation" = "11:FALSE"
        }
        "Product"
        {
        "Name" = "8:Microsoft Visual Studio"
        "ProductName" = "8:SQLite ADO.NET 2.0/3.5 Provider"
        "ProductCode" = "8:{00257FA9-3622-45E4-8B4B-A792CC5169EB}"
        "PackageCode" = "8:{BCF9616D-927F-4004-8AC3-9A126619FE25}"
        "UpgradeCode" = "8:{78329A82-AFB1-453B-AF00-D46AC911DA89}"
        "RestartWWWService" = "11:FALSE"
        "RemovePreviousVersions" = "11:TRUE"
        "DetectNewerInstalledVersion" = "11:TRUE"
        "InstallAllUsers" = "11:TRUE"
        "ProductVersion" = "8:1.066.0"
        "Manufacturer" = "8:Phoenix Software Solutions, LLC"
        "ARPHELPTELEPHONE" = "8:"
        "ARPHELPLINK" = "8:http://sqlite.phxsoftware.com"
        "Title" = "8:SQLite ADO.NET 2.0/3.5 Provider"
        "Subject" = "8:"
        "ARPCONTACT" = "8:Phoenix Software Solutions, LLC"
        "Keywords" = "8:"
        "ARPCOMMENTS" = "8:"
        "ARPURLINFOABOUT" = "8:"
        "ARPPRODUCTICON" = "8:"
        "ARPIconIndex" = "3:0"
        "SearchPath" = "8:"
        "UseSystemSearchPath" = "11:TRUE"
        "TargetPlatform" = "3:0"
        "PreBuildEvent" = "8:"
        "PostBuildEvent" = "8:"
        "RunPostBuildEvent" = "3:0"
        }
        "Registry"
        {
            "HKLM"
            {
                "Keys"
                {
                }
            }
            "HKCU"
            {
                "Keys"
                {
                }
            }
            "HKCR"
            {
                "Keys"
                {
                }
            }
            "HKU"
            {
                "Keys"
                {
                }
            }
            "HKPU"
            {
                "Keys"
                {
                }
            }
        }
        "Sequences"
        {
        }
        "Shortcut"
        {
            "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_1D4C9AFDF229479AABE410DD0C754667"
            {
            "Name" = "8:Design-Time Configuration"
            "Arguments" = "8:"
            "Description" = "8:"
            "ShowCmd" = "3:1"
            "IconIndex" = "3:32512"
            "Transitive" = "11:FALSE"
            "Target" = "8:_40DFF08BA903482D807E715A041CA8B1"
            "Folder" = "8:_1B562A9F876E47058AB813C418E24FBF"
            "WorkingFolder" = "8:_F11D54EE0EEA4BF59B52E621630B6A2E"
            "Icon" = "8:_40DFF08BA903482D807E715A041CA8B1"
            "Feature" = "8:"
            }
            "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_920202B002F9475288A945B0C8361A44"
            {
            "Name" = "8:SQLite Test Application"
            "Arguments" = "8:"
            "Description" = "8:"
            "ShowCmd" = "3:1"
            "IconIndex" = "3:0"
            "Transitive" = "11:FALSE"
            "Target" = "8:_2C7EDFF06B61482393D94E3A63D90113"
            "Folder" = "8:_1B562A9F876E47058AB813C418E24FBF"
            "WorkingFolder" = "8:_30C77BF2E6E84D01ADE5FB8BA2F81504"
            "Icon" = "8:"
            "Feature" = "8:"
            }
            "{970C0BB2-C7D0-45D7-ABFA-7EC378858BC0}:_CC64AEB6D8A643F7BC8EB95EBC803EB5"
            {
            "Name" = "8:Help"
            "Arguments" = "8:"
            "Description" = "8:"
            "ShowCmd" = "3:1"
            "IconIndex" = "3:0"
            "Transitive" = "11:FALSE"
            "Target" = "8:_60E2C442F77C48DE8150EBFC86663225"
            "Folder" = "8:_1B562A9F876E47058AB813C418E24FBF"
            "WorkingFolder" = "8:_CA5E61837F5B452B8169C698979CF05C"
            "Icon" = "8:"
            "Feature" = "8:"
            }
        }
        "UserInterface"
        {
            "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_027E806A39AD4FCD8E7A4EBE86AD3DF3"
            {
            "UseDynamicProperties" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "SourcePath" = "8:<VsdDialogDir>\\VsdUserInterface.wim"
            }
            "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_349E960F62F043E79FD080CB87E24922"
            {
            "Name" = "8:#1902"
            "Sequence" = "3:2"
            "Attributes" = "3:3"
                "Dialogs"
                {
                    "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_F1CAA16A464043FBB06804165AB31D0C"
                    {
                    "Sequence" = "3:100"
                    "DisplayName" = "8:Finished"
                    "UseDynamicProperties" = "11:TRUE"
                    "IsDependency" = "11:FALSE"
                    "SourcePath" = "8:<VsdDialogDir>\\VsdAdminFinishedDlg.wid"
                        "Properties"
                        {
                            "BannerBitmap"
                            {
                            "Name" = "8:BannerBitmap"
                            "DisplayName" = "8:#1001"
                            "Description" = "8:#1101"
                            "Type" = "3:8"
                            "ContextData" = "8:Bitmap"
                            "Attributes" = "3:4"
                            "Setting" = "3:2"
                            "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90"
                            "UsePlugInResources" = "11:TRUE"
                            }
                        }
                    }
                }
            }
            "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_3CB3696DF5D54FCA98E2BF3D4579451E"
            {
            "Name" = "8:#1901"
            "Sequence" = "3:1"
            "Attributes" = "3:2"
                "Dialogs"
                {
                    "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_1DBE83588B574F75A6233D46A3234D69"
                    {
                    "Sequence" = "3:100"
                    "DisplayName" = "8:Progress"
                    "UseDynamicProperties" = "11:TRUE"
                    "IsDependency" = "11:FALSE"
                    "SourcePath" = "8:<VsdDialogDir>\\VsdProgressDlg.wid"
                        "Properties"
                        {
                            "BannerBitmap"
                            {
                            "Name" = "8:BannerBitmap"
                            "DisplayName" = "8:#1001"
                            "Description" = "8:#1101"
                            "Type" = "3:8"
                            "ContextData" = "8:Bitmap"
                            "Attributes" = "3:4"
                            "Setting" = "3:2"
                            "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90"
                            "UsePlugInResources" = "11:TRUE"
                            }
                            "ShowProgress"
                            {
                            "Name" = "8:ShowProgress"
                            "DisplayName" = "8:#1009"
                            "Description" = "8:#1109"
                            "Type" = "3:5"
                            "ContextData" = "8:1;True=1;False=0"
                            "Attributes" = "3:0"
                            "Setting" = "3:0"
                            "Value" = "3:1"
                            "DefaultValue" = "3:1"
                            "UsePlugInResources" = "11:TRUE"
                            }
                        }
                    }
                }
            }
            "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_573543E04AA54E9387CD1AAF21220444"
            {
            "Name" = "8:#1902"
            "Sequence" = "3:1"
            "Attributes" = "3:3"
                "Dialogs"
                {
                    "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_991B7280E37E4C23A54CC7027F774891"
                    {
                    "Sequence" = "3:100"
                    "DisplayName" = "8:Finished"
                    "UseDynamicProperties" = "11:TRUE"
                    "IsDependency" = "11:FALSE"
                    "SourcePath" = "8:<VsdDialogDir>\\VsdFinishedDlg.wid"
                        "Properties"
                        {
                            "BannerBitmap"
                            {
                            "Name" = "8:BannerBitmap"
                            "DisplayName" = "8:#1001"
                            "Description" = "8:#1101"
                            "Type" = "3:8"
                            "ContextData" = "8:Bitmap"
                            "Attributes" = "3:4"
                            "Setting" = "3:2"
                            "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90"
                            "UsePlugInResources" = "11:TRUE"
                            }
                            "UpdateText"
                            {
                            "Name" = "8:UpdateText"
                            "DisplayName" = "8:#1058"
                            "Description" = "8:#1158"
                            "Type" = "3:15"
                            "ContextData" = "8:"
                            "Attributes" = "3:0"
                            "Setting" = "3:1"
                            "Value" = "8:#1258"
                            "DefaultValue" = "8:#1258"
                            "UsePlugInResources" = "11:TRUE"
                            }
                        }
                    }
                }
            }
            "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_5E0AF2B2658547308882EEE91399D911"
            {
            "Name" = "8:#1901"
            "Sequence" = "3:2"
            "Attributes" = "3:2"
                "Dialogs"
                {
                    "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_82FCCA944F324BA18F0E3E01BCA1E60B"
                    {
                    "Sequence" = "3:100"
                    "DisplayName" = "8:Progress"
                    "UseDynamicProperties" = "11:TRUE"
                    "IsDependency" = "11:FALSE"
                    "SourcePath" = "8:<VsdDialogDir>\\VsdAdminProgressDlg.wid"
                        "Properties"
                        {
                            "BannerBitmap"
                            {
                            "Name" = "8:BannerBitmap"
                            "DisplayName" = "8:#1001"
                            "Description" = "8:#1101"
                            "Type" = "3:8"
                            "ContextData" = "8:Bitmap"
                            "Attributes" = "3:4"
                            "Setting" = "3:2"
                            "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90"
                            "UsePlugInResources" = "11:TRUE"
                            }
                            "ShowProgress"
                            {
                            "Name" = "8:ShowProgress"
                            "DisplayName" = "8:#1009"
                            "Description" = "8:#1109"
                            "Type" = "3:5"
                            "ContextData" = "8:1;True=1;False=0"
                            "Attributes" = "3:0"
                            "Setting" = "3:0"
                            "Value" = "3:1"
                            "DefaultValue" = "3:1"
                            "UsePlugInResources" = "11:TRUE"
                            }
                        }
                    }
                }
            }
            "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_7046F6E46106420BA50AA9A9ED86389A"
            {
            "Name" = "8:#1900"
            "Sequence" = "3:1"
            "Attributes" = "3:1"
                "Dialogs"
                {
                    "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_03C4F0FAD7804F3DAE9A980E584F691E"
                    {
                    "Sequence" = "3:300"
                    "DisplayName" = "8:Confirm Installation"
                    "UseDynamicProperties" = "11:TRUE"
                    "IsDependency" = "11:FALSE"
                    "SourcePath" = "8:<VsdDialogDir>\\VsdConfirmDlg.wid"
                        "Properties"
                        {
                            "BannerBitmap"
                            {
                            "Name" = "8:BannerBitmap"
                            "DisplayName" = "8:#1001"
                            "Description" = "8:#1101"
                            "Type" = "3:8"
                            "ContextData" = "8:Bitmap"
                            "Attributes" = "3:4"
                            "Setting" = "3:2"
                            "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90"
                            "UsePlugInResources" = "11:TRUE"
                            }
                        }
                    }
                    "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_4B4F0FAA5A094FCC952CA8A93DEA0F04"
                    {
                    "Sequence" = "3:100"
                    "DisplayName" = "8:Welcome"
                    "UseDynamicProperties" = "11:TRUE"
                    "IsDependency" = "11:FALSE"
                    "SourcePath" = "8:<VsdDialogDir>\\VsdWelcomeDlg.wid"
                        "Properties"
                        {
                            "BannerBitmap"
                            {
                            "Name" = "8:BannerBitmap"
                            "DisplayName" = "8:#1001"
                            "Description" = "8:#1101"
                            "Type" = "3:8"
                            "ContextData" = "8:Bitmap"
                            "Attributes" = "3:4"
                            "Setting" = "3:2"
                            "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90"
                            "UsePlugInResources" = "11:TRUE"
                            }
                            "CopyrightWarning"
                            {
                            "Name" = "8:CopyrightWarning"
                            "DisplayName" = "8:#1002"
                            "Description" = "8:#1102"
                            "Type" = "3:3"
                            "ContextData" = "8:"
                            "Attributes" = "3:0"
                            "Setting" = "3:2"
                            "Value" = "8:"
                            "DefaultValue" = "8:#1202"
                            "UsePlugInResources" = "11:TRUE"
                            }
                            "Welcome"
                            {
                            "Name" = "8:Welcome"
                            "DisplayName" = "8:#1003"
                            "Description" = "8:#1103"
                            "Type" = "3:3"
                            "ContextData" = "8:"
                            "Attributes" = "3:0"
                            "Setting" = "3:1"
                            "Value" = "8:#1203"
                            "DefaultValue" = "8:#1203"
                            "UsePlugInResources" = "11:TRUE"
                            }
                        }
                    }
                    "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_CAD4CD70D47945E7A7FCD4428405F7FD"
                    {
                    "Sequence" = "3:200"
                    "DisplayName" = "8:Installation Folder"
                    "UseDynamicProperties" = "11:TRUE"
                    "IsDependency" = "11:FALSE"
                    "SourcePath" = "8:<VsdDialogDir>\\VsdFolderDlg.wid"
                        "Properties"
                        {
                            "BannerBitmap"
                            {
                            "Name" = "8:BannerBitmap"
                            "DisplayName" = "8:#1001"
                            "Description" = "8:#1101"
                            "Type" = "3:8"
                            "ContextData" = "8:Bitmap"
                            "Attributes" = "3:4"
                            "Setting" = "3:2"
                            "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90"
                            "UsePlugInResources" = "11:TRUE"
                            }
                            "InstallAllUsersVisible"
                            {
                            "Name" = "8:InstallAllUsersVisible"
                            "DisplayName" = "8:#1059"
                            "Description" = "8:#1159"
                            "Type" = "3:5"
                            "ContextData" = "8:1;True=1;False=0"
                            "Attributes" = "3:0"
                            "Setting" = "3:0"
                            "Value" = "3:1"
                            "DefaultValue" = "3:1"
                            "UsePlugInResources" = "11:TRUE"
                            }
                        }
                    }
                }
            }
            "{DF760B10-853B-4699-99F2-AFF7185B4A62}:_A95B4EFD2C5249848F009D88CBA3739B"
            {
            "Name" = "8:#1900"
            "Sequence" = "3:2"
            "Attributes" = "3:1"
                "Dialogs"
                {
                    "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_101B4B845E67488FB6A0AC097773DA38"
                    {
                    "Sequence" = "3:300"
                    "DisplayName" = "8:Confirm Installation"
                    "UseDynamicProperties" = "11:TRUE"
                    "IsDependency" = "11:FALSE"
                    "SourcePath" = "8:<VsdDialogDir>\\VsdAdminConfirmDlg.wid"
                        "Properties"
                        {
                            "BannerBitmap"
                            {
                            "Name" = "8:BannerBitmap"
                            "DisplayName" = "8:#1001"
                            "Description" = "8:#1101"
                            "Type" = "3:8"
                            "ContextData" = "8:Bitmap"
                            "Attributes" = "3:4"
                            "Setting" = "3:2"
                            "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90"
                            "UsePlugInResources" = "11:TRUE"
                            }
                        }
                    }
                    "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_1AD3D10EBB64435985C57A85063E6CDF"
                    {
                    "Sequence" = "3:100"
                    "DisplayName" = "8:Welcome"
                    "UseDynamicProperties" = "11:TRUE"
                    "IsDependency" = "11:FALSE"
                    "SourcePath" = "8:<VsdDialogDir>\\VsdAdminWelcomeDlg.wid"
                        "Properties"
                        {
                            "BannerBitmap"
                            {
                            "Name" = "8:BannerBitmap"
                            "DisplayName" = "8:#1001"
                            "Description" = "8:#1101"
                            "Type" = "3:8"
                            "ContextData" = "8:Bitmap"
                            "Attributes" = "3:4"
                            "Setting" = "3:2"
                            "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90"
                            "UsePlugInResources" = "11:TRUE"
                            }
                            "CopyrightWarning"
                            {
                            "Name" = "8:CopyrightWarning"
                            "DisplayName" = "8:#1002"
                            "Description" = "8:#1102"
                            "Type" = "3:3"
                            "ContextData" = "8:"
                            "Attributes" = "3:0"
                            "Setting" = "3:2"
                            "Value" = "8:"
                            "DefaultValue" = "8:#1202"
                            "UsePlugInResources" = "11:TRUE"
                            }
                            "Welcome"
                            {
                            "Name" = "8:Welcome"
                            "DisplayName" = "8:#1003"
                            "Description" = "8:#1103"
                            "Type" = "3:3"
                            "ContextData" = "8:"
                            "Attributes" = "3:0"
                            "Setting" = "3:1"
                            "Value" = "8:#1203"
                            "DefaultValue" = "8:#1203"
                            "UsePlugInResources" = "11:TRUE"
                            }
                        }
                    }
                    "{688940B3-5CA9-4162-8DEE-2993FA9D8CBC}:_F5C2368EB13F47EF8808B4E5855A647B"
                    {
                    "Sequence" = "3:200"
                    "DisplayName" = "8:Installation Folder"
                    "UseDynamicProperties" = "11:TRUE"
                    "IsDependency" = "11:FALSE"
                    "SourcePath" = "8:<VsdDialogDir>\\VsdAdminFolderDlg.wid"
                        "Properties"
                        {
                            "BannerBitmap"
                            {
                            "Name" = "8:BannerBitmap"
                            "DisplayName" = "8:#1001"
                            "Description" = "8:#1101"
                            "Type" = "3:8"
                            "ContextData" = "8:Bitmap"
                            "Attributes" = "3:4"
                            "Setting" = "3:2"
                            "Value" = "8:_B6156897CBBB4E929D9C1F7358CE9E90"
                            "UsePlugInResources" = "11:TRUE"
                            }
                        }
                    }
                }
            }
            "{2479F3F5-0309-486D-8047-8187E2CE5BA0}:_F02FDE6DA53449159DF6E6441E2314C9"
            {
            "UseDynamicProperties" = "11:FALSE"
            "IsDependency" = "11:FALSE"
            "SourcePath" = "8:<VsdDialogDir>\\VsdBasicDialogs.wim"
            }
        }
        "MergeModule"
        {
        }
        "ProjectOutput"
        {
        }
    }
}
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































Deleted tools/setup/topband.jpg.

cannot compute difference between binary files

Added www/art/nocopy.gif.

cannot compute difference between binary files

Added www/art/sqlite100.png.

cannot compute difference between binary files

Added www/art/sqlite128.png.

cannot compute difference between binary files

Added www/art/sqlite200.png.

cannot compute difference between binary files

Added www/art/sqlite32.png.

cannot compute difference between binary files

Added www/build.wiki.

















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
<title>Build Procedures</title>
<nowiki>
  <a name="procedures"></a>
  <h2>Build Procedures</h2>

  <p>
    Follow these steps to build the System.Data.SQLite (&quot;SDS&quot;)
    binaries.  Unless otherwise noted, all steps need to be done in the order
    specified.
  </p>

  <p>
    You will need a Visual Studio 2005, Visual Studio 2005 SP1, Visual Studio
    2008, Visual Studio 2008 SP1, Visual Studio 2010, Visual Studio 2010 SP1,
    Visual Studio 2012, Visual Studio 2013, Visual Studio 2015, or Visual Studio
    2017 development environment for this build.  In order to build both the
    managed (C#) and native projects (C++) for a particular solution together,
    the &quot;Professional Edition&quot; (or better) of that particular version
    of Visual Studio is required.
  </p>

  <p>
    The new build system has been setup using modular solution, project, and
    property files.
  </p>

  <p>
    In general, all files with 2005, 2008, 2010, 2012, 2013, 2015, or 2017 in
    the name (e.g. &quot;SQLite.Interop.2005.vcproj&quot;) are files for Visual
    Studio 2005, Visual Studio 2008, Visual Studio 2010, Visual Studio 2012,
    Visual Studio 2013, Visual Studio 2015, or Visual Studio 2017, respectively.
    Files ending in &quot;.vsprops&quot; are property files for a Visual Studio
    2005 or Visual Studio 2008 project.  Files ending in &quot;.props&quot; are
    property files for a the Visual Studio 2010, Visual Studio 2012, Visual
    Studio 2013, Visual Studio 2015, or Visual Studio 2017 project.  When making
    changes, they should be made to the corresponding files for all applicable
    versions of Visual Studio.
  </p>

  <p>
    You can either <a href="#manual">manually build</a> the System.Data.SQLite
    binaries using one of the supplied Visual Studio solutions or follow the
    steps outlined in the <a href="#automated">Automated Build</a> section below.
  </p>

  <a name="assumptions"></a>
  <h2>Build Assumptions &amp; Prerequisites</h2>

  <ol>
    <li>
      We want to ship managed binaries that rely on the .NET Framework 2.0 SP2 (or
      for the LINQ assembly, the .NET Framework 3.5 SP1).  The .NET Framework 2.0
      is very widely deployed and binaries produced for it can also be referenced
      and used successfully from projects using the .NET Framework 4.0.
    </li>

    <li>
      We want to ship native binaries that rely on the Visual C++ 2008 Runtime.
    </li>

    <li>
      We want to ship the separate managed-only &quot;System.Data.SQLite.dll&quot;
      assembly and the &quot;SQLite.Interop.dll&quot; native library.  This will
      make it easier to maintain and deploy the included core SQLite code (in the
      &quot;SQLite.Interop.dll&quot; native library).  We also want to ship the
      &quot;monster DLL&quot; (i.e. the mixed-mode
      &quot;System.Data.SQLite.dll&quot; assembly that includes all the necessary
      native and managed code).  This will make it easier for developers that wish
      to register the assembly in the Global Assembly Cache (GAC).
    </li>

    <li>
      The machine used to prepare the official releases will have the
      <a href="https://www.microsoft.com/downloads/en/details.aspx?FamilyID=ab99342f-5d1a-413d-8319-81da479ab0d7">.NET Framework 3.5 SP1</a>
      and the corresponding
      <a href="https://www.microsoft.com/downloads/details.aspx?FamilyId=E6E1C3DF-A74F-4207-8586-711EBE331CDC">SDK</a>
      installed.
    </li>

    <li>
      The machine used to prepare the official releases will have
      <a href="https://www.jrsoftware.org/isdl.php">Inno Setup 5.5.5</a> or
      higher installed in &quot;%ProgramFiles%\Inno Setup 5&quot; or
      &quot;%ProgramFiles(x86)%\Inno Setup 5&quot; for an 64-bit machines.
      Alternatively, the Inno Setup directory may be included in the PATH
      environment variable.
    </li>

    <li>
      The string &quot;&lt;root&gt;&quot; represents the root directory of your
      local source tree (i.e. the working check-out directory) for the
      System.Data.SQLite project.
    </li>

    <li>
      The string &quot;&lt;year&gt;&quot; represents the version of Visual
      Studio being used (e.g. 2005, 2008, 2010, 2012, 2013, 2015, or 2017).
    </li>

    <li>
      For now, the project will always be built on modern Windows using the .NET
      Framework even when they will eventually be deployed to run under Mono on
      Unix.
    </li>
  </ol>

  <a name="all"></a>
  <h2>All Builds</h2>

  <ol>
    <li>
      Make sure the version information is correct for SQLite in all of the
      following files (<i>this step should not be necessary when using source
      code checked out from the official repository</i>):

      <ul>
        <li>&lt;root&gt;\SQLite.Interop\props\sqlite3.vsprops</li>
        <li>&lt;root&gt;\SQLite.Interop\props\sqlite3.props</li>
      </ul>

      You'll need to update the SQLITE_MANIFEST_VERSION and SQLITE_RC_VERSION
      properties.  This version number should track the release versions of
      SQLite (i.e. <a href="https://www.sqlite.org/changes.html">3.7.x</a>).
    </li>

    <li>
      Make sure the version information is correct for System.Data.SQLite in the
      following files (<i>this step should not be necessary when using source
      code checked out from the official repository</i>):

      <ul>
        <li>&lt;root&gt;\readme.htm</li>
        <li>&lt;root&gt;\Doc\Extra\Provider\dbfactorysupport.html</li>
        <li>&lt;root&gt;\Doc\Extra\Provider\welcome.html</li>
        <li>&lt;root&gt;\NuGet\SQLite.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.Beta.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.Core.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.Core.Beta.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.Core.Test.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.Core.MSIL.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.Core.MSIL.Beta.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.Core.MSIL.Test.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.Core.NetFramework.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.Core.NetStandard.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.EF6.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.EF6.Beta.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.EF6.Test.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.Linq.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.Linq.Beta.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.Linq.Test.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.MSIL.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.MSIL.Beta.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.MSIL.Test.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.Test.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.x86.nuspec</li>
        <li>&lt;root&gt;\NuGet\SQLite.x64.nuspec</li>
        <li>&lt;root&gt;\SQLite.Designer\AssemblyInfo.cs</li>
        <li>&lt;root&gt;\SQLite.Designer\source.extension.vsixmanifest</li>
        <li>&lt;root&gt;\SQLite.Interop\props\SQLite.Interop.2005.vsprops</li>
        <li>&lt;root&gt;\SQLite.Interop\props\SQLite.Interop.2008.vsprops</li>
        <li>&lt;root&gt;\SQLite.Interop\props\SQLite.Interop.2010.props</li>
        <li>&lt;root&gt;\SQLite.Interop\props\SQLite.Interop.2012.props</li>
        <li>&lt;root&gt;\SQLite.Interop\props\SQLite.Interop.2013.props</li>
        <li>&lt;root&gt;\SQLite.Interop\props\SQLite.Interop.2015.props</li>
        <li>&lt;root&gt;\SQLite.Interop\props\SQLite.Interop.2017.props</li>
        <li>&lt;root&gt;\SQLite.Interop\src\generic\interop.h</li>
        <li>&lt;root&gt;\System.Data.SQLite\AssemblyInfo.cs</li>
        <li>&lt;root&gt;\System.Data.SQLite\SQLite3.cs</li>
        <li>&lt;root&gt;\System.Data.SQLite\UnsafeNativeMethods.cs</li>
        <li>&lt;root&gt;\System.Data.SQLite.Linq\AssemblyInfo.cs</li>
        <li>&lt;root&gt;\test\AssemblyInfo.cs</li>
        <li>&lt;root&gt;\test\app.config</li>
        <li>&lt;root&gt;\testce\AssemblyInfo.cs</li>
        <li>&lt;root&gt;\testlinq\2008\LINQ\App.config</li>
        <li>&lt;root&gt;\testlinq\2010\EF6\App.config</li>
        <li>&lt;root&gt;\testlinq\2010\LINQ\App.config</li>
        <li>&lt;root&gt;\testlinq\2012\EF6\App.config</li>
        <li>&lt;root&gt;\testlinq\2012\LINQ\App.config</li>
        <li>&lt;root&gt;\testlinq\2013\EF6\App.config</li>
        <li>&lt;root&gt;\testlinq\2013\LINQ\App.config</li>
        <li>&lt;root&gt;\testlinq\2015\EF6\App.config</li>
        <li>&lt;root&gt;\testlinq\2015\LINQ\App.config</li>
        <li>&lt;root&gt;\testlinq\2017\EF6\App.config</li>
        <li>&lt;root&gt;\testlinq\2017\LINQ\App.config</li>
        <li>&lt;root&gt;\testlinq\Properties\AssemblyInfo.cs</li>
        <li>&lt;root&gt;\Tests\version.eagle</li>
        <li>&lt;root&gt;\tools\install\Properties\AssemblyInfo.cs</li>
      </ul>

      You'll need to update the INTEROP_BUILD_NUMBER, INTEROP_LINKER_VERSION,
      INTEROP_MANIFEST_VERSION, and INTEROP_RC_VERSION properties in the
      &quot;.vsprops&quot; and &quot;.props&quot; files, and the INTEROP_VERSION
      define in &quot;interop.h&quot;.  This version number should track the
      release versions of the System.Data.SQLite packages (i.e.
      <a href="news.wiki">1.0.x</a>).
    </li>
  </ol>

  <a name="manual"></a>
  <h2>Manual Build</h2>

  <ol>
    <li>
      Complete the applicable steps outlined in the <a href="#all">All Builds</a>
      section (above).
    </li>

    <li>
      Open the appropriate solution for your build platform.

      <ul>
        <li>
          The &quot;SQLite.NET.2005.sln&quot; file is the top-level solution
          primarily designed for use with Visual Studio 2005 in the IDE; however,
          it may also be used from the command line with MSBuild 2.0.
        </li>

        <li>
          The &quot;SQLite.NET.2008.sln&quot; file is the top-level solution
          primarily designed for use with Visual Studio 2008 in the IDE; however,
          it may also be used from the command line with MSBuild 3.5.
        </li>

        <li>
          The &quot;SQLite.NET.2010.sln&quot; file is the top-level solution
          primarily designed for use with Visual Studio 2010 in the IDE; however,
          it may also be used from the command line with MSBuild 4.0.
        </li>

        <li>
          The &quot;SQLite.NET.2012.sln&quot; file is the top-level solution
          primarily designed for use with Visual Studio 2012 in the IDE; however,
          it may also be used from the command line with MSBuild 4.0.
        </li>

        <li>
          The &quot;SQLite.NET.2013.sln&quot; file is the top-level solution
          primarily designed for use with Visual Studio 2013 in the IDE; however,
          it may also be used from the command line with MSBuild 4.0.
        </li>

        <li>
          The &quot;SQLite.NET.2015.sln&quot; file is the top-level solution
          primarily designed for use with Visual Studio 2015 in the IDE; however,
          it may also be used from the command line with MSBuild 4.0.
        </li>

        <li>
          The &quot;SQLite.NET.2017.sln&quot; file is the top-level solution
          primarily designed for use with Visual Studio 2017 in the IDE; however,
          it may also be used from the command line with MSBuild 15.0.
        </li>

        <li>
          The &quot;SQLite.NET.2005.MSBuild.sln&quot; file is the top-level
          solution primarily designed for use with MSBuild 2.0 on the command
          line; however, it may also be used from the Visual Studio 2005 IDE.
        </li>

        <li>
          The &quot;SQLite.NET.2008.MSBuild.sln&quot; file is the top-level
          solution primarily designed for use with MSBuild 3.5 on the command
          line; however, it may also be used from the Visual Studio 2008 IDE.
        </li>

        <li>
          The &quot;SQLite.NET.2010.MSBuild.sln&quot; file is the top-level
          solution primarily designed for use with MSBuild 4.0 on the command
          line; however, it may also be used from the Visual Studio 2010 IDE.
        </li>

        <li>
          The &quot;SQLite.NET.2012.MSBuild.sln&quot; file is the top-level
          solution primarily designed for use with MSBuild 4.0 on the command
          line; however, it may also be used from the Visual Studio 2012 IDE.
        </li>

        <li>
          The &quot;SQLite.NET.2013.MSBuild.sln&quot; file is the top-level
          solution primarily designed for use with MSBuild 4.0 on the command
          line; however, it may also be used from the Visual Studio 2013 IDE.
        </li>

        <li>
          The &quot;SQLite.NET.2015.MSBuild.sln&quot; file is the top-level
          solution primarily designed for use with MSBuild 4.0 on the command
          line; however, it may also be used from the Visual Studio 2015 IDE.
        </li>

        <li>
          The &quot;SQLite.NET.2017.MSBuild.sln&quot; file is the top-level
          solution primarily designed for use with MSBuild 15.0 on the command
          line; however, it may also be used from the Visual Studio 2017 IDE.
        </li>
      </ul>
    </li>

    <li>
      Select the desired solution configuration (e.g. ReleaseNativeOnly) and and
      solution platform (e.g. x64), then &quot;Build-&gt;Rebuild Solution&quot;.
      Alternatively, you can select &quot;Build-&gt;Batch Build&quot;,
      &quot;Select All&quot;, and then &quot;Rebuild&quot;.
    </li>
  </ol>

  <a name="automated"></a>
  <h2>Automated Build</h2>

  <ol>
    <li>
      Complete the applicable steps outlined in the <a href="#all">All Builds</a>
      section (above).
    </li>

    <li>
      Make sure the &quot;&lt;root&gt;\bin&quot; and &quot;&lt;root&gt;\obj&quot;
      directories are completely free of all output files.  In theory, you should
      be able to simply delete these directories.
    </li>

    <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

    <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

    <li>
      Enter the following command to build the managed-only binaries:
      <br />
      <br />
      <b>CALL build.bat&nbsp;ReleaseManagedOnly</b>
      <br />
      <br />
    </li>

    <li>
      Make sure everything succeeds with no errors; the log file
      &quot;%TEMP%\System.Data.SQLite.Build_ReleaseManagedOnly_Win32_&lt;year&gt;_Unknown.log&quot;
      may be checked if any errors should occur.
    </li>

    <li>
      Enter the following command to build the binaries for Win32 (x86):&nbsp;
      <br />
      <br />
      <b>CALL build.bat&nbsp;ReleaseNativeOnly&nbsp;Win32</b>
      <br />
      <br />
      <i>You may need to enter the command &quot;<b>setenv&nbsp;/x86</b>&quot;
      first if you are using a &quot;Windows SDK Command Prompt&quot; or
      &quot;Visual Studio Command Prompt&quot; window.</i>
    </li>

    <li>
      Make sure everything succeeds with no errors; the log file
      &quot;%TEMP%\System.Data.SQLite.Build_ReleaseNativeOnly_Win32_&lt;year&gt;_Unknown.log&quot;
      may be checked if any errors should occur.
    </li>

    <li>
      Enter the following command to build the binaries for x64:
      <br />
      <br />
      <b>CALL build.bat&nbsp;ReleaseNativeOnly&nbsp;x64</b>
      <br />
      <br />
      <i>You may need to enter the command&quot;<b>setenv&nbsp;/x64</b>&quot;
      first if you are using a &quot;Windows SDK Command Prompt&quot; or
      &quot;Visual Studio Command Prompt&quot; window.</i>
    </li>

    <li>
      Make sure everything succeeds with no errors; the log file
      &quot;%TEMP%\System.Data.SQLite.Build_ReleaseNativeOnly_x64_&lt;year&gt;_Unknown.log&quot;
      may be checked if any errors should occur.
    </li>

    <li>
      Enter the following command to build the setup binaries for all supported
      build configurations (unfortunately, it is not possible to build the setup
      using the Inno Setup IDE.  It must be done using the provided command line
      tools due to its highly dynamic nature):
      <br />
      <br />
      <b>CALL bake_all.bat</b>
      <br />
      <br />
    </li>

    <li>
      Make sure everything succeeds with no errors.  Inno Setup should produce
      &quot;success&quot; messages very similar to the following:
      <br />
      <br />
      <b>Successful compile (X.XXX sec). Resulting Setup program filename is:
      &nbsp;abc</b>
    </li>
  </ol>

  <a name="mono"></a>
  <h2>Mono Build</h2>

  <ol>
    <li>
      Complete the applicable steps outlined in the <a href="#all">All Builds</a>
      section (above).
    </li>

    <li>
      Make sure the &quot;&lt;root&gt;\bin&quot; and &quot;&lt;root&gt;\obj&quot;
      directories are completely free of all output files.  In theory, you should
      be able to simply delete these directories.
    </li>

    <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

    <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

    <li>
      Enter the following command to build the managed-only binaries for Mono:
      <br />
      <br />
      <b>CALL build_mono.bat</b>
      <br />
      <br />
    </li>

    <li>
      Make sure everything succeeds with no errors; the log file
      &quot;%TEMP%\System.Data.SQLite.Build_ReleaseManagedOnly_Any CPU_&lt;year&gt;_Unknown.log&quot;
      may be checked if any errors should occur.
    </li>
  </ol>

  <a name="netStandard20"></a>
  <h2>.NET Standard 2.0 Build</h2>

  <ol>
    <li>
      Complete the applicable steps outlined in the <a href="#all">All Builds</a>
      section (above).
    </li>

    <li>
      Make sure the &quot;&lt;root&gt;\bin&quot; and &quot;&lt;root&gt;\obj&quot;
      directories are completely free of all output files.  In theory, you should
      be able to simply delete these directories.
    </li>

    <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

    <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

    <li>
      Enter the following command to build the managed-only binaries for .NET
      Standard 2.0:
      <br />
      <br />
      <b>CALL build_net_standard_20.bat</b>
      <br />
      <br />
    </li>

    <li>
      Make sure everything succeeds with no errors; the log file
      &quot;%TEMP%\System.Data.SQLite.Build_ReleaseManagedOnly_Any CPU_NetStandard20_Unknown.log&quot;
      may be checked if any errors should occur.
    </li>
  </ol>

  <a name="netStandard21"></a>
  <h2>.NET Standard 2.1 Build</h2>

  <ol>
    <li>
      Complete the applicable steps outlined in the <a href="#all">All Builds</a>
      section (above).
    </li>

    <li>
      Make sure the &quot;&lt;root&gt;\bin&quot; and &quot;&lt;root&gt;\obj&quot;
      directories are completely free of all output files.  In theory, you should
      be able to simply delete these directories.
    </li>

    <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

    <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

    <li>
      Enter the following command to build the managed-only binaries for .NET
      Standard 2.1:
      <br />
      <br />
      <b>CALL build_net_standard_21.bat</b>
      <br />
      <br />
    </li>

    <li>
      Make sure everything succeeds with no errors; the log file
      &quot;%TEMP%\System.Data.SQLite.Build_ReleaseManagedOnly_Any CPU_NetStandard21_Unknown.log&quot;
      may be checked if any errors should occur.
    </li>
  </ol>
</nowiki>

Added www/checkin.wiki.



















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<title>Check-in Checklist</title>

Before every check-in:

  1.   <b>fossil diff</b> &rarr; No stray changes.

  2.   <b>fossil extra</b> &rarr; No unmanaged files need to be added.

  3.   The check-in will go onto the desired branch.

  4.   The &quot;autosync&quot; setting is enabled. &rarr;
       <ol>
       <li> The check-in will not cause a unintentional fork.
       <li> The local system clock is set correctly.
       </ol>

Before every check-in to <b>trunk</b>:

  5.   No compiler warnings on the development machine.

  6.   Changes will not cause problems on a future <b>bisect</b>.

  7.   Build binaries as outlined on the [./build.wiki | build procedures] page.

  8.   Run unit tests as outlined on the [./test.wiki | test procedures] page.

Added www/contrib_agreement.wiki.



















































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<title>System.Data.SQLite Contributor Agreement</title>

<p>
  This agreement applies to your contribution of material to the
  System.Data.SQLite ADO.NET interfaces (&quot;SDS&quot;) that is mananged by
  Hipp, Wyrick &amp; Company, Inc. (&quot;Hwaci&quot;) and sets out the
  intellectual property rights you grant to Hwaci in the contributed material.
  The terms &quot;contribution&quot; and &quot;contributed material&quot; mean
  any source code, object code, patch, tool, sample, graphic, specification,
  manual, documentation, or any other material posted, submitted, or uploaded
  by you to the SDS project.  The term &quot;you&quot; means the person
  identified and signing at the bottom of this document.  If your contribution
  is on behalf of a company, the term &quot;you&quot; also means the company
  identified in the signature area below.
</p>

<ol>
    <li>
      <p>
        With respect to any worldwide copyrights, or copyright applications and
        registrations, in your contribution:
        <ul>
          <li>
            You hereby assign to Hwaci joint ownership, and to the extent that
            such assignment is or becomes invalid, ineffective or unenforceable,
            you hereby grant to Hwaci a perpetual, irrevocable, non-exclusive,
            worldwide, no-charge, royalty-free, unrestricted license to exercise
            all rights under those copyrights, including the right to sublicense.
          </li>
          <li>
            You agree that both you and Hwaci can do all things in relation to your
            contribution as if each of us were the sole owners, and if one of us
            makes a derivative work of your contribution, the one who makes
            (or has made) the derivative work will be the sole owner of that
            derivative work.
          </li>
          <li>
            You agree that you will not assert any moral rights in your
            contribution against Hwaci, Hwaci's licensees or transferees, or
            any other user or consumer of your contribution.
          </li>
          <li>
            You agree that Hwaci may register a copyright in your contribution and
            exercise all ownership rights associated with it.
          </li>
          <li>
            You agree that neither you nor Hwaci has any duty to consult with,
            obtain the consent of, or pay or render an accounting to the other
            for any use or distribution of your contribution.
          </li>
        </ul>
      </p>
    </li>
    <li>
      <p>
        With respect to any patents you own, or that you can license without payment
        to any third party, and which are relevant to your contribution, you hereby
        grant to Hwaci a perpetual, irrevocable, non-exclusive, worldwide, no-charge,
        royalty-free license to
        make, have made, use, sell, offer to sell, import, and otherwise
        transfer your contribution in whole or in part, alone or in
        combination with or included in any product, work or materials arising
        out of the SDS project, and to sublicense these same rights.
      </p>
    </li>
    <li>
      <p>
        Except as set out above, you keep all right, title, and interest in your
        contribution.  The rights that you grant to Hwaci under this agreement
        are effective on the date that you first submitted your contribution to the
        SDS project, even if your submission took place before the date that
        you sign this agreement.
      </p>
    </li>
    <li>
      <p>
        You represent and warrant the following:
        <ul>
          <li>
            Your contribution is an original work and that you can legally
            grant the rights set out in this agreement.
          </li>
          <li>
            Your contribution does not, to the best of your knowledge and belief,
            violate any third party's copyrights, trademarks, patents,
            or other intellectual property rights.
          </li>
          <li>
            You are authorized to sign this agreement on behalf of your
            company (if appliable).
          </li>
        </ul>
      </p>
    </li>
  </ol>

  <p>
    By filling in the following information and signing your name,
    you agree to be bound by all of the terms
    set forth in this agreement.  Please print clearly.
  </p>

  <center>
    <p>
      <table width="80%" border="1" cellpadding="0" cellspacing="0">
        <tr>
          <td width="20%" valign="top">Your name &amp; email:</td>
          <td width="80%">
            <!-- Replace this line with your name and email -->
            <p>&nbsp;</p>
          </td>
        </tr>
        <tr>
          <td valign="top">Company name:<br>(if applicable)</td>
          <td>
            <!-- Replace this line with your company name -->
            <p>&nbsp;</p>
          </td>
        </tr>
        <tr>
          <td valign="top">Postal address:</td>
          <td>
            <!-- Replace this line and the next line with your postal address -->
            <p>&nbsp;</p>
            <p>&nbsp;</p>
            <p>&nbsp;</p>
          </td>
        </tr>
        <tr>
          <td valign="top">Signature:</td>
          <td>
            <p>&nbsp;</p>
          </td>
        </tr>
        <tr>
          <td valign="top">Date:</td>
          <td>
            <p>&nbsp;</p>
          </td>
        </tr>
      </table>
    </p>
  </center>

  <p>
    Send completed forms to:
    <blockquote>
      Hipp, Wyrick &amp; Company, Inc.<br>
      6200 Maple Cove Lane<br>
      Charlotte, NC 28269-1086<br>
      USA
    </blockquote>
  </p>

Added www/contribute.wiki.

































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<title>Contributing To System.Data.SQLite</title>

Users are encouraged to contributed enhancements back to the System.Data.SQLite
project.  This note outlines some of the procedures for making
useful contributions.

<h2>1.0 Contributor Agreement</h2>

In order to accept your contributions, we <u>must</u> have a
[./contrib_agreement.wiki | Contributor Agreement] on file for you.  We require
this in order to maintain clear title to the System.Data.SQLite code and prevent
the introduction of code with incompatible licenses or other entanglements
that might cause legal problems for System.Data.SQLite users.

If you do not wish to submit a Contributor Agreement, we would still
welcome your suggestions and example code, but we will not use your code
directly - we will be forced to reimplement your changes from scratch which
might take longer.

<h2>2.0 Submitting Patches</h2>

Suggested changes or bug fixes can be submitted by creating a patch
against the current source tree.  Email patches to
<a href="mailto:drh@sqlite.org">drh@sqlite.org</a>.  Be sure to
describe in detail what the patch does and which version of System.Data.SQLite
it is written against.

A contributor agreement is not strictly necessary to submit a patch.
However, without a contributor agreement on file, your patch will be
used for reference only - it will not be applied to the code.  This
may delay acceptance of your patch.

Your patches or changes might not be accepted even if you do have
a contributor agreement on file.  Please do not take this personally
or as an affront to your coding ability.  Sometimes patches are rejected
because they seem to be taking the project in a direction that the
architect does not want to go.  Or, there might be an alternative
implementation of the same feature being prepared separately.

<h2>3.0 Check-in Privileges</h2>

Check-in privileges are granted on a case-by-case basis.   Your chances
of getting check-in privileges are much improved if you have a history
of submitting quality patches and/or making thoughtful posts on the
[https://sqlite.org/forum/forum | SQLite Forum].  A contributor agreement
is, of course, a prerequisite for check-in privileges.</p>

Contributors are asked to make all non-trivial changes on a branch.  A
System.Data.SQLite admin will review the branch and merge the changes
into the trunk.</p>

Contributors are required to following the
[./checkin.wiki | pre-checkin checklist] prior to every checkin to
the System.Data.SQLite self-hosting repository.  This checklist is short and
succinct and should only require a few seconds to follow.  Contributors
should print out a copy of the pre-checkin checklist and keep
it on a notecard beside their workstations, for quick reference.

Contributors should review and try to mimic the coding style
used through the rest of the System.Data.SQLite source code.  Your code should
blend in.  A third-party reader should be unable to distinguish your
code from any other code in the source corpus.

Furthermore, all new code must contain &quot;documentation comments&quot; that
can be successfully processed up by the Microsoft C# compiler.

<h2>4.0 Testing</h2>

System.Data.SQLite has several automated test suites that excercise its base
functionality, but this is an area that needs further work.
(Your contributions here are welcomed!)
Contributors with check-in privileges are expected to run the test suites
on all changes they contribute, and if appropriate add new automated test
scripts to cover their additions.

<h2>5.0 See Also</h2>

  *  [./build.wiki | Build Procedures]
  *  [./test.wiki | Test Procedures]
  *  [./release.wiki | Release Procedures]

Added www/copyright.wiki.

















































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<title>Copyright</title>
<h2>System.Data.SQLite Copyright</h2>

<p>
All files in the
&quot;<a href="/tree?name=System.Data.SQLite.Linq/SQL+Generation">System.Data.SQLite.Linq/SQL Generation</a>&quot;
directory (within the source tree) are covered by the
<a href="https://opensource.org/licenses/ms-pl">Microsoft Public License (MS-PL)</a>.
These files end up being compiled into both the &quot;System.Data.SQLite.Linq&quot;
and &quot;System.Data.SQLite.EF6&quot; assemblies.
</p>

<table align="right" vspace="0" hspace="10" border="1" cellpadding="20">
<tr><td align="center">
<img src="art/nocopy.gif"><br>
System.Data.SQLite is in the<br>
<a href="https://en.wikipedia.org/wiki/Public_Domain">Public Domain</a>
</td></tr>
</table>

<p>
All other code and documentation in System.Data.SQLite has been dedicated to
the <a href="https://en.wikipedia.org/wiki/Public_Domain">public domain</a>
by the authors.
All code authors, and representatives of the companies they work for, have
signed affidavits dedicating their contributions to the public domain and
originals of those signed affidavits are stored in a firesafe at the main
offices of <a href="https://www.hwaci.com">Hwaci</a>.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute
the original System.Data.SQLite code, either in source code form or as a
compiled binary, for any purpose, commercial or non-commercial, and by any
means.
</p>

<h2>Obtaining An Explicit License To Use System.Data.SQLite</h2>

<p>
Even though System.Data.SQLite is in the public domain and does not require
a license, some users want to obtain a license anyway.  Some reasons
for obtaining a license include:
</p>

<ul>
<li> You are using System.Data.SQLite in a jurisdiction that does not recognize
     the public domain.  </li>
<li> You are using System.Data.SQLite in a jurisdiction that does not recognize
     the right of an author to dedicate their work to the public
     domain. </li>
<li> You want to hold a tangible legal document
     as evidence that you have the legal right to use and distribute
     System.Data.SQLite. </li>
<li> Your legal department tells you that you have to purchase a license.
     </li>
</ul>

<p>
If you feel like you really have to purchase a license for System.Data.SQLite,
<a href="https://www.hwaci.com/">Hwaci</a>, the company that employs
the architect and principal developers of System.Data.SQLite, will
<a href="https://www.hwaci.com/cgi-bin/license-step1">sell you
one</a>.
</p>

<h2>Contributed Code</h2>

<p>
In order to keep System.Data.SQLite completely free and unencumbered by
copyright, all new contributors to the System.Data.SQLite code base are asked
to dedicate their contributions to the public domain.
If you want to send a patch or enhancement for possible inclusion in the
System.Data.SQLite source tree, please accompany the patch with the following
statement:
</p>

<blockquote><i>
The author or authors of this code dedicate any and all copyright interest
in this code to the public domain.  We make this dedication for the benefit
of the public at large and to the detriment of our heirs and successors.
We intend this dedication to be an overt act of relinquishment in
perpetuity of all present and future rights to this code under copyright law.
</i></blockquote>

<p>
We are not able to accept patches or changes to
System.Data.SQLite that are not accompanied by a statement such as the above.
In addition, if you make
changes or enhancements as an employee, then a simple statement such as the
above is insufficient.  You must also send by surface mail a copyright release
signed by a company officer.
A signed original of the copyright release should be mailed to:</p>

<blockquote>
Hwaci<br>
6200 Maple Cove Lane<br>
Charlotte, NC 28269<br>
USA
</blockquote>

<p>
A template copyright release is available
in <a href="https://www.sqlite.org/copyright-release.pdf">PDF</a> or
<a href="https://www.sqlite.org/copyright-release.html">HTML</a>.
You can use this release to make future changes.
</p>

Added www/downloads-unsup.wiki.































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
<title>Downloads Page - Unsupported</title>
<nowiki>
  <h1 class="pageHeader">System.Data.SQLite Downloads - Unsupported</h1>

  <table width="100%" cellpadding="5" cellspacing="0">
    <tr bgcolor="#fff1c8">
      <td colspan="3" class="importantHeader">
        <a name="runtimeLibraryNotes"></a>
        <b>Runtime Library Notes</b>
      </td>
    </tr>

    <tr bgcolor="#fff1c8">
      <td colspan="3" class="importantNotes">
        It should be noted that the downloadable packages on this web page that
        include the word &quot;<b>setup</b>&quot; (i.e. the setup packages)
        already include and will attempt to automatically install the required
        version of the Microsoft Visual C++ Runtime Library.
      </td>
    </tr>

    <tr bgcolor="#fff1c8">
      <td colspan="3" class="importantHeader">
        <a name="supportNotesDownloadablePackages"></a>
        <b>Support Notes - Downloadable Packages</b>
      </td>
    </tr>

    <tr bgcolor="#fff1c8">
      <td colspan="3" class="importantNotes">
        This page contains all the downloadable setup packages for the current
        release version of the official &quot;System.Data.SQLite&quot; project.
        This page is the <b>only</b> official distribution point for these
        downloadable packages.  If any of the downloadable packages are obtained
        elsewhere, it is very important to compare their SHA1 hashes to the
        corresponding hashes listed below in order to make sure the contained
        files are the same.
      </td>
    </tr>

    <tr bgcolor="#fff1c8">
      <td colspan="3" class="importantHeader">
        <a name=""></a>
        <b>Design-Time Components for Visual Studio Setup Packages</b>
      </td>
    </tr>

    <tr bgcolor="#fff1c8">
      <td colspan="3" class="importantNotes">
        These setup packages, which contain the <b>Design-Time Components
        for Visual Studio</b> are <a href="news.wiki">no longer officially
        supported</a>.
      </td>
    </tr>
  </table>

  <table width="100%" cellpadding="5">
    <tr>
      <td colspan="3" class="importantHeader">
        <a name="packageTypes"></a>
        <b>Package Types</b>
      </td>
    </tr>

    <tr>
      <td class="importantNotes">
        <ul>
          <li>
            The setup packages are <a href="news.wiki">no longer officially
            supported</a> and are intended to be installed <b>only</b> on
            developer machines and then <b>only</b> when the design-time
            components for Visual Studio are required.  In theory, they can
            be installed on customer machines as well; however, this type of
            deployment is not recommended.
          </li>
        </ul>
      </td>
    </tr>
  </table>

  <table width="100%" cellpadding="5">
    <tr>
      <td align="center">
        <h2 class="pageSubHeader">List of Release Packages</h2>
      </td>
    </tr>
  </table>

  <table width="100%" cellpadding="5">
    <tr>
      <td colspan="4">
        <b>Setups for 32-bit Windows (.NET Framework 2.0 SP2)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx20-setup-bundle-x86-2005"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx20-setup-bundle-x86-2005-1.0.118.0.exe">sqlite-netFx20-setup-bundle-x86-2005-1.0.118.0.exe</a>
        <br />
        (6.35 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package features the mixed-mode assembly and will install all
        the necessary runtime components and dependencies for the x86 version of
        the System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2005
        SP1 runtime for x86 is included.  The .NET Framework 2.0 SP2 is
        required.
        <br />
        <big><b>This is the only setup package that is capable of installing the
        design-time components for Visual Studio 2005.
        <br />
        <br />
        However, if you do not require the design-time components, please
        consider downloading the associated &quot;Precompiled Binaries&quot;
        instead.</b></big>
        <br />
        <br />
        (sha1: d6c5a91280f25d98a79a07927d7c6e86e5a69c0d)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx20-setup-x86-2005"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx20-setup-x86-2005-1.0.118.0.exe">sqlite-netFx20-setup-x86-2005-1.0.118.0.exe</a>
        <br />
        (6.34 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package will install all the necessary runtime components and
        dependencies for the x86 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2005 SP1 runtime for x86 is included.
        The .NET Framework 2.0 SP2 is required.
        <br />
        (sha1: cf2ea1774b3865325dd4106dc8d349b534da3b71)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Setups for 64-bit Windows (.NET Framework 2.0 SP2)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx20-setup-bundle-x64-2005"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx20-setup-bundle-x64-2005-1.0.118.0.exe">sqlite-netFx20-setup-bundle-x64-2005-1.0.118.0.exe</a>
        <br />
        (7.02 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package features the mixed-mode assembly and will install all
        the necessary runtime components and dependencies for the x64 version of
        the System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2005
        SP1 runtime for x64 is included.  The .NET Framework 2.0 SP2 is
        required.
        <br />
        (sha1: 90513db6777d66d659ac1aa7925bb86188fb25cb)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx20-setup-x64-2005"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx20-setup-x64-2005-1.0.118.0.exe">sqlite-netFx20-setup-x64-2005-1.0.118.0.exe</a>
        <br />
        (7.01 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package will install all the necessary runtime components and
        dependencies for the x64 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2005 SP1 runtime for x64 is included.
        The .NET Framework 2.0 SP2 is required.
        <br />
        (sha1: 30ef1920fe05a35974dca1f1e2ca1e4efe3c8c39)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Setups for 32-bit Windows (.NET Framework 3.5 SP1)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx35-setup-bundle-x86-2008"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx35-setup-bundle-x86-2008-1.0.118.0.exe">sqlite-netFx35-setup-bundle-x86-2008-1.0.118.0.exe</a>
        <br />
        (8.39 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package features the mixed-mode assembly and will install all
        the necessary runtime components and dependencies for the x86 version of
        the System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2008
        SP1 runtime for x86 is included.  The .NET Framework 3.5 SP1 is
        required.
        <br />
        <big><b>This is the only setup package that is capable of installing the
        design-time components for Visual Studio 2008.
        <br />
        <br />
        However, if you do not require the design-time components, please
        consider downloading the associated &quot;Precompiled Binaries&quot;
        instead.</b></big>
        <br />
        <br />
        (sha1: 8c6b7b974108720f3287dc3d526dae044f20188a)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx35-setup-x86-2008"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx35-setup-x86-2008-1.0.118.0.exe">sqlite-netFx35-setup-x86-2008-1.0.118.0.exe</a>
        <br />
        (8.37 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package will install all the necessary runtime components and
        dependencies for the x86 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2008 SP1 runtime for x86 is included.
        The .NET Framework 3.5 SP1 is required.
        <br />
        (sha1: 252778990e37f98240351eb94f4e28335631af0a)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Setups for 64-bit Windows (.NET Framework 3.5 SP1)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx35-setup-bundle-x64-2008"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx35-setup-bundle-x64-2008-1.0.118.0.exe">sqlite-netFx35-setup-bundle-x64-2008-1.0.118.0.exe</a>
        <br />
        (9.16 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package features the mixed-mode assembly and will install all
        the necessary runtime components and dependencies for the x64 version of
        the System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2008
        SP1 runtime for x64 is included.  The .NET Framework 3.5 SP1 is
        required.
        <br />
        (sha1: cbd6834777dec8fa78352144b15be67b5de4544f)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx35-setup-x64-2008"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx35-setup-x64-2008-1.0.118.0.exe">sqlite-netFx35-setup-x64-2008-1.0.118.0.exe</a>
        <br />
        (9.15 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package will install all the necessary runtime components and
        dependencies for the x64 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2008 SP1 runtime for x64 is included.
        The .NET Framework 3.5 SP1 is required.
        <br />
        (sha1: dd283b5ed6f0a0b88a5474cc85168da0c2eca9f1)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Setups for 32-bit Windows (.NET Framework 4.0)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx40-setup-bundle-x86-2010"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx40-setup-bundle-x86-2010-1.0.118.0.exe">sqlite-netFx40-setup-bundle-x86-2010-1.0.118.0.exe</a>
        <br />
        (13.98 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package features the mixed-mode assembly and will install all
        the necessary runtime components and dependencies for the x86 version of
        the System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2010
        SP1 runtime for x86 is included.  The .NET Framework 4.0 is required.
        <br />
        <big><b>This is the only setup package that is capable of installing the
        design-time components for Visual Studio 2010.
        <br />
        <br />
        However, if you do not require the design-time components, please
        consider downloading the associated &quot;Precompiled Binaries&quot;
        instead.</b></big>
        <br />
        <br />
        (sha1: f1b738bceeada22c780eda92f9c89d3e8d4a13d7)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx40-setup-x86-2010"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx40-setup-x86-2010-1.0.118.0.exe">sqlite-netFx40-setup-x86-2010-1.0.118.0.exe</a>
        <br />
        (13.96 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package will install all the necessary runtime components and
        dependencies for the x86 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2010 SP1 runtime for x86 is included.
        The .NET Framework 4.0 is required.
        <br />
        (sha1: bac20c9ee15d536f2529b95916bf511f541f2b76)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Setups for 64-bit Windows (.NET Framework 4.0)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx40-setup-bundle-x64-2010"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx40-setup-bundle-x64-2010-1.0.118.0.exe">sqlite-netFx40-setup-bundle-x64-2010-1.0.118.0.exe</a>
        <br />
        (15.25 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package features the mixed-mode assembly and will install all
        the necessary runtime components and dependencies for the x64 version of
        the System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2010
        SP1 runtime for x64 is included.  The .NET Framework 4.0 is required.
        <br />
        (sha1: b0a4f7efc9c2e1fdbb5df40bb29c6c9cc500dd1e)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx40-setup-x64-2010"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx40-setup-x64-2010-1.0.118.0.exe">sqlite-netFx40-setup-x64-2010-1.0.118.0.exe</a>
        <br />
        (15.24 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package will install all the necessary runtime components and
        dependencies for the x64 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2010 SP1 runtime for x64 is included.
        The .NET Framework 4.0 is required.
        <br />
        (sha1: 561ed54fec42e458c041610127af9f4842b45d79)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Setups for 32-bit Windows (.NET Framework 4.5)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx45-setup-bundle-x86-2012"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx45-setup-bundle-x86-2012-1.0.118.0.exe">sqlite-netFx45-setup-bundle-x86-2012-1.0.118.0.exe</a>
        <br />
        (11.39 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package features the mixed-mode assembly and will install all
        the necessary runtime components and dependencies for the x86 version of
        the System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2012
        Update 4 runtime for x86 is included.  The .NET Framework 4.5 is
        required.
        <br />
        <big><b>This is the only setup package that is capable of installing the
        design-time components for Visual Studio 2012.
        <br />
        <br />
        However, if you do not require the design-time components, please
        consider downloading the associated &quot;Precompiled Binaries&quot;
        instead.</b></big>
        <br />
        <br />
        <big><b>Using Entity Framework 6 design-time support may require
        installing the Visual Studio 2012 &quot;flavor&quot; of the
        <a href="https://www.microsoft.com/en-us/download/details.aspx?id=40762">
        Entity Framework 6 Tools for Visual Studio 2012 &amp; 2013</a>.</b></big>
        <br />
        <br />
        (sha1: b9f170c6cb75d71d23570a1162821d9e06845bf7)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx45-setup-x86-2012"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx45-setup-x86-2012-1.0.118.0.exe">sqlite-netFx45-setup-x86-2012-1.0.118.0.exe</a>
        <br />
        (11.43 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package will install all the necessary runtime components and
        dependencies for the x86 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2012 Update 4 runtime for x86 is
        included.  The .NET Framework 4.5 is required.
        <br />
        (sha1: 44e88f6a799d7b30d3d83082465d8bd3aec7bba9)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Setups for 64-bit Windows (.NET Framework 4.5)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx45-setup-bundle-x64-2012"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx45-setup-bundle-x64-2012-1.0.118.0.exe">sqlite-netFx45-setup-bundle-x64-2012-1.0.118.0.exe</a>
        <br />
        (12.06 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package features the mixed-mode assembly and will install all
        the necessary runtime components and dependencies for the x64 version of
        the System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2012
        Update 4 runtime for x64 is included.  The .NET Framework 4.5 is
        required.
        <br />
        (sha1: dffe357952ddb9b8b4bb5632017294063ed2e813)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx45-setup-x64-2012"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx45-setup-x64-2012-1.0.118.0.exe">sqlite-netFx45-setup-x64-2012-1.0.118.0.exe</a>
        <br />
        (12.13 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package will install all the necessary runtime components and
        dependencies for the x64 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2012 Update 4 runtime for x64 is
        included.  The .NET Framework 4.5 is required.
        <br />
        (sha1: 43062378358e3c8e28dc58f24764ea74fe1e157a)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Setups for 32-bit Windows (.NET Framework 4.5.1)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx451-setup-bundle-x86-2013"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx451-setup-bundle-x86-2013-1.0.118.0.exe">sqlite-netFx451-setup-bundle-x86-2013-1.0.118.0.exe</a>
        <br />
        (11.34 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package features the mixed-mode assembly and will install all
        the necessary runtime components and dependencies for the x86 version of
        the System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2013
        Update 2 runtime for x86 is included.  The .NET Framework 4.5.1 is
        required.
        <br />
        <big><b>This is the only setup package that is capable of installing the
        design-time components for Visual Studio 2013.
        <br />
        <br />
        However, if you do not require the design-time components, please
        consider downloading the associated &quot;Precompiled Binaries&quot;
        instead.</b></big>
        <br />
        <br />
        <big><b>Using Entity Framework 6 design-time support may require
        installing the Visual Studio 2013 &quot;flavor&quot; of the
        <a href="https://www.microsoft.com/en-us/download/details.aspx?id=40762">
        Entity Framework 6 Tools for Visual Studio 2012 &amp; 2013</a>.</b></big>
        <br />
        <br />
        (sha1: 91a4dd6a90fefbfd4532d484f1799cbfa156b748)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx451-setup-x86-2013"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx451-setup-x86-2013-1.0.118.0.exe">sqlite-netFx451-setup-x86-2013-1.0.118.0.exe</a>
        <br />
        (11.38 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package will install all the necessary runtime components and
        dependencies for the x86 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2013 Update 2 runtime for x86 is
        included.  The .NET Framework 4.5.1 is required.
        <br />
        (sha1: 7599a08e6c72cb2ffe4b46d64d33102125dc0235)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Setups for 64-bit Windows (.NET Framework 4.5.1)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx451-setup-bundle-x64-2013"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx451-setup-bundle-x64-2013-1.0.118.0.exe">sqlite-netFx451-setup-bundle-x64-2013-1.0.118.0.exe</a>
        <br />
        (12.05 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package features the mixed-mode assembly and will install all
        the necessary runtime components and dependencies for the x64 version of
        the System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2013
        Update 2 runtime for x64 is included.  The .NET Framework 4.5.1 is
        required.
        <br />
        (sha1: 6067dfe92d1257810aa0d923dba836d521d76224)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx451-setup-x64-2013"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx451-setup-x64-2013-1.0.118.0.exe">sqlite-netFx451-setup-x64-2013-1.0.118.0.exe</a>
        <br />
        (12.12 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package will install all the necessary runtime components and
        dependencies for the x64 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2013 Update 2 runtime for x64 is
        included.  The .NET Framework 4.5.1 is required.
        <br />
        (sha1: e1a12a1053804c5c6132babfd97dfb77f3e06704)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Setups for 32-bit Windows (.NET Framework 4.6)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx46-setup-bundle-x86-2015"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx46-setup-bundle-x86-2015-1.0.118.0.exe">sqlite-netFx46-setup-bundle-x86-2015-1.0.118.0.exe</a>
        <br />
        (18.00 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package features the mixed-mode assembly and will install all
        the necessary runtime components and dependencies for the x86 version of
        the System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2015
        Update 3 runtime for x86 is included.  The .NET Framework 4.6 is
        required.
        <br />
        <big><b>This is the only setup package that is capable of installing the
        design-time components for Visual Studio 2015.
        <br />
        <br />
        However, if you do not require the design-time components, please
        consider downloading the associated &quot;Precompiled Binaries&quot;
        instead.</b></big>
        <br />
        <br />
        (sha1: ce76ff9842ab4c8096d467d15b414337022cb535)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx46-setup-x86-2015"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx46-setup-x86-2015-1.0.118.0.exe">sqlite-netFx46-setup-x86-2015-1.0.118.0.exe</a>
        <br />
        (18.17 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package will install all the necessary runtime components and
        dependencies for the x86 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2015 Update 3 runtime for x86 is
        included.  The .NET Framework 4.6 is required.
        <br />
        (sha1: b5132d28f05edad1b92486cf417d0bba4d8cb297)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Setups for 64-bit Windows (.NET Framework 4.6)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx46-setup-bundle-x64-2015"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx46-setup-bundle-x64-2015-1.0.118.0.exe">sqlite-netFx46-setup-bundle-x64-2015-1.0.118.0.exe</a>
        <br />
        (18.85 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package features the mixed-mode assembly and will install all
        the necessary runtime components and dependencies for the x64 version of
        the System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2015
        Update 3 runtime for x64 is included.  The .NET Framework 4.6 is
        required.
        <br />
        (sha1: 8affd54f5b33d1cec2582c217d28a8351aae3198)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx46-setup-x64-2015"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx46-setup-x64-2015-1.0.118.0.exe">sqlite-netFx46-setup-x64-2015-1.0.118.0.exe</a>
        <br />
        (19.09 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This setup package will install all the necessary runtime components and
        dependencies for the x64 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2015 Update 3 runtime for x64 is
        included.  The .NET Framework 4.6 is required.
        <br />
        (sha1: 3e2cbde71f6f888e48a2e7549bc493d14de30fd3)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <a name="legacyVersions"></a>
        <b>Legacy Versions</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a href="https://sourceforge.net/projects/sqlite-dotnet2/files/SQLite%20for%20ADO.NET%202.0/1.0.66.0/SQLite-1.0.66.0-setup.exe/download">SQLite-1.0.66.0-setup.exe</a>
      </td>
      <td width="5"></td>
      <td valign="top">
        Legacy versions may still be found at <a href="https://sourceforge.net/projects/sqlite-dotnet2/">SourceForge</a>, though there have been no
        updates there since April of 2010.
      </td>
    </tr>
  </table>

  <h3 class="pageSubSubHeader">Build Product Names</h3>

  <p>
    Beginning with System.Data.SQLite version 1.0.101.0 (3.12.2), the
    following templates will be used for the names of the build products:

    <ol>
      <li><b>sqlite-</b>framework<b>-setup-</b>cpu<b>-</b>year<b>-</b>version<b>.exe</b></li>
      <li><b>sqlite-</b>framework<b>-setup-bundle-</b>cpu<b>-</b>year<b>-</b>version<b>.exe</b></li>
    </ol>
  </p>

  <p>
    Templates (1) and (2) are used for the setup packages.  Template (2)
    is used for the setup package containing the mixed-mode assembly.
  </p>

  <p>
    The <b>framework</b> in templates (1) and (2) will be one of netFx20,
    netFx35, netFx40, netFx45, netFx451, netFx452, netFx46, netFx461,
    netFx462, netFx47, netFx471, netFx472, netFx48.
  </p>

  <p>
    The <b>cpu</b> in templates (1) and (2) will be one of x86, x64, arm,
    ia64.
  </p>

  <p>
    The <b>year</b> in templates (1) and (2) will be one of 2005, 2008,
    2010, 2012, 2013, 2015, 2017, 20XX, NetStandard20, NetStandard21.
  </p>

  <p>
    The <b>version</b> in templates (1) and (2) is the dot-delimited
    version number of the primary System.Data.SQLite assembly.
  </p>
</nowiki>

Added www/downloads.wiki.



























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
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
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
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
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
<title>Downloads Page</title>
<nowiki>
  <h1 class="pageHeader">System.Data.SQLite Downloads</h1>

  <table width="100%" cellpadding="5" cellspacing="0">
    <tr bgcolor="#fff1c8">
      <td colspan="3" class="importantHeader">
        <a name=""></a>
        <b>Design-Time Components for Visual Studio Setup Packages</b>
      </td>
    </tr>

    <tr bgcolor="#fff1c8">
      <td colspan="3" class="importantNotes">
        The setup packages, which contain the <b>Design-Time Components
        for Visual Studio</b> are <a href="news.wiki">no longer officially
        supported</a> and have now been moved to
        <a href="downloads-unsup.wiki">their own download page</a>.
      </td>
    </tr>

    <tr bgcolor="#fff1c8">
      <td colspan="3" class="importantHeader">
        <a name="runtimeLibraryNotes"></a>
        <b>Runtime Library Notes</b>
      </td>
    </tr>

    <tr bgcolor="#fff1c8">
      <td colspan="3" class="importantNotes">
        All downloadable packages on this web page that do not include
        the word &quot;<b>static</b>&quot; in their file name require the
        appropriate version (e.g. 2005, 2008, 2010, 2012, 2013, 2015, 2017) of
        the Microsoft Visual C++ Runtime Library, to be successfully installed
        on the target machine, prior to making use of the executables contained
        therein.
      </td>
    </tr>

    <tr bgcolor="#fff1c8">
      <td colspan="3" class="importantHeader">
        <a name="msvcDownloads"></a>
        <b>Latest Microsoft Visual C++ Runtime Library Downloads</b>
      </td>
    </tr>

    <tr bgcolor="#fff1c8">
      <td colspan="3" class="importantNotes">
        For detailed information about the latest downloads for each Microsoft
        Visual C++ Runtime Library release, please refer to the following page:
      </td>
    </tr>

    <tr bgcolor="#fff1c8">
      <td class="importantNotes">
        &nbsp;
      </td>
      <td class="importantNotes" align="center">
        <a href="https://support.microsoft.com/kb/2019667">Latest Supported
        Visual C++ Downloads</a>
      </td>
      <td class="importantNotes">
        &nbsp;
      </td>
    </tr>

    <tr bgcolor="#fff1c8">
      <td colspan="3" class="importantHeader">
        <a name="supportNotesDownloadablePackages"></a>
        <b>Support Notes - Downloadable Packages</b>
      </td>
    </tr>

    <tr bgcolor="#fff1c8">
      <td colspan="3" class="importantNotes">
        This page contains all supported downloadable packages (e.g. sources,
        binaries, etc) for the current release version of the official
        &quot;System.Data.SQLite&quot; project.  This page and the associated
        <a href="https://www.nuget.org/profiles/SQLite">NuGet packages</a>
        are the <b>only</b> official distribution points for these downloadable
        packages.  If any of the downloadable packages are obtained elsewhere,
        it is very important to compare their SHA1 hashes to the corresponding
        hashes listed below in order to make sure the contained files are the
        same.
      </td>
    </tr>

    <tr bgcolor="#fff1c8">
      <td colspan="3" class="importantHeader">
        <a name="supportNotesOtherProjects"></a>
        <b>Support Notes - Other Projects</b>
      </td>
    </tr>

    <tr bgcolor="#fff1c8">
      <td colspan="3" class="importantNotes">
        There are several other projects, with widely varying levels of support
        and compatibility, known to use the similar names.  At least one of
        those projects is an unofficial fork of the legacy 1.0.66.0 release,
        modified (by a third-party) to work with Visual Studio 2010 (or higher).
        Only the software contained on this page is directly
        <a href="support.wiki">supported</a> by the maintainers of this project
        (i.e. the <a href="https://www.sqlite.org">SQLite Development Team</a>)
        as we do not necessarily have any knowledge of the other projects that
        use the same (or a similar) name.  That being said, if a particular
        question is related to the core SQLite native library itself, one of the
        <a href="https://www.sqlite.org/support.html">SQLite support options</a>
        is probably the best way to get an answer.
      </td>
    </tr>

    <tr bgcolor="#fff1c8">
      <td colspan="3" class="importantHeader">
        <a name="windowsEmbeddedCompact"></a>
        <b>Windows Embedded Compact</b>
      </td>
    </tr>

    <tr bgcolor="#fff1c8">
      <td colspan="3" class="importantNotes">
        The <a href="#sqlite-netFx35-binary-PocketPC-ARM-2008">Precompiled
        Binaries for Windows CE (.NET Compact Framework)</a> section of this
        page contains several binary packages for Windows Embedded Compact
        2013.  Further information on integrating SQLite into Windows Embedded
        Compact 2013 can be found at the following web site:
      </td>
    </tr>

    <tr bgcolor="#fff1c8">
      <td class="importantNotes">
        &nbsp;
      </td>
      <td class="importantNotes" align="center">
        <a href="https://cesqlite2013.codeplex.com/">SQLite for Windows
        Embedded Compact 2013</a>
      </td>
      <td class="importantNotes">
        &nbsp;
      </td>
    </tr>
  </table>

  <table width="100%" cellpadding="5">
    <tr>
      <td colspan="3" class="importantHeader">
        <a name="releaseNotes"></a>
        <b>Release Notes</b>
      </td>
    </tr>

    <tr>
      <td colspan="3" class="importantNotes">
        The &quot;release notes&quot;, which contain lists of notable changes
        associated with each officially released version, is available on the
        <a href="news.wiki">News</a> page.
      </td>
    </tr>
  </table>

  <table width="100%" cellpadding="5">
    <tr>
      <td colspan="3" class="importantHeader">
        <a name="packageTypes"></a>
        <b>Package Types</b>
      </td>
    </tr>

    <tr>
      <td colspan="3" class="importantNotes">
        There are a wide variety of downloadable packages on this page.
        Each of them is designed to meet the requirements of a particular
        development and/or deployment scenario.
        <br /><br />
        The first step is to determine if the package is to be installed (or
        used) on a developer machine or a customer machine.
      </td>
    </tr>
    <tr>
      <td>
        &nbsp;
      </td>
      <td class="importantNotes">
        <ul>
          <li>
            The source packages are intended primarily for people interested in
            studying the source code that corresponds to a particular release
            version of the project.  The source packages contain no binaries.
            Those interested in studying the latest source code and/or tracking
            the unreleased changes should consider accessing the
            <a href="/index.html/timeline?n=20&y=ci">Fossil repository</a>
            instead.
          </li>
          <br />
          <li>
            The binary packages are intended to be used by developers in order
            to obtain the assembly binaries necessary for development and
            deployment of their applications onto customer machines via
            <a href="https://en.wikipedia.org/wiki/XCOPY_deployment">XCOPY
            deployment</a>.
          </li>
        </ul>
      </td>
      <td>
        &nbsp;
      </td>
    </tr>
    <tr>
      <td colspan="3" class="importantNotes">
        All the &quot;bundle&quot; packages contain the
        &quot;System.Data.SQLite.dll&quot; mixed-mode assembly.  These packages
        should <b>only</b> be used in cases where the assembly binary
        <b>must</b> be deployed to the
        <a href="https://en.wikipedia.org/wiki/Global_Assembly_Cache">Global
        Assembly Cache</a> for some reason (e.g. to support some legacy
        application on customer machines).
        <br /><br />
        All the &quot;static&quot; packages contain either native or mixed-mode
        assembly binaries linked statically to the appropriate version of the
        <a href="https://en.wikipedia.org/wiki/Visual_C++">Visual C++</a>
        runtime.  Typically, these packages are used in cases where customer
        machines may not have the necessary version of the Visual C++ runtime
        installed and it cannot be installed due to limited privileges.
        <br /><br />
        The next step is to identify the version of the
        <a href="https://en.wikipedia.org/wiki/.NET_Framework">.NET Framework</a>
        being targeted by the application.
        Generally, assembly binaries linked against the
        <a href="https://go.microsoft.com/fwlink/?LinkID=32168">.NET Framework
        2.0</a> (or the
        <a href="https://go.microsoft.com/fwlink/?LinkId=124150">.NET Framework
        3.5</a>) will work with the
        <a href="https://go.microsoft.com/fwlink/?LinkID=186913">.NET Framework
        4.0</a> (or higher); however, this is less than ideal.  Furthermore,
        assemblies linked against the .NET Framework 4.0 (or higher)
        <b>cannot</b> be loaded by any versions of the .NET Framework prior to
        4.0.
      </td>
    </tr>

    <tr>
      <td colspan="3" class="importantHeader">
        <a name="nativeLibraryPreLoading"></a>
        <b>Using Native Library Pre-Loading</b>
      </td>
    </tr>

    <tr>
      <td colspan="3" class="importantNotes">
        The final step is to identify the target processor architecture on both
        the development and customer machines.  Generally,
        <a href="https://en.wikipedia.org/wiki/X86">x86</a> binaries will work on
        an <a href="https://en.wikipedia.org/wiki/X64">x64</a> machine running
        <a href="https://en.wikipedia.org/wiki/Windows">Windows</a> (using
        <a href="https://en.wikipedia.org/wiki/WoW64">WoW64</a>).  However, there
        is a problem when using managed code.  If the executable that starts the
        process consists entirely of managed code, it will run with the native
        processor architecture of the machine, which will be x64 on an x64
        machine.  Later on, this will cause assemblies containing any native
        code compiled for x86 (e.g. the &quot;System.Data.SQLite.dll&quot;
        mixed-mode assembly, the &quot;SQLite.Interop.dll&quot; native interop
        assembly, or the &quot;sqlite3.dll&quot; native library) to fail to
        load, typically resulting in a
        <a href="faq.wiki#q12">BadImageFormatException</a> being thrown.
        <br /><br />
        If the development and customer machines may have different processor
        architectures, more than one binary package may be required.  For this
        situation, using the <b>native library pre-loading feature</b> is highly
        recommended.  It is available as of version 1.0.80.0 and enabled by
        default.  In order to take advantage of this feature, the separate
        managed and interop assemblies <b>must</b> be used with XCOPY deployment
        (i.e. this feature is not supported by the mixed-mode assembly, nor when
        the assembly is deployed to the global assembly cache), resulting in an
        application deployment that looks something like this:
      </td>
    </tr>
    <tr>
      <td>
        &nbsp;
      </td>
      <td width="90%" class="importantNotes">
        <ul>
          <li>
            <b>&lt;bin&gt;\App.exe</b> (optional, managed-only application
            executable assembly)
          </li>
          <li>
            <b>&lt;bin&gt;\App.dll</b> (optional, managed-only application
            library assembly)
          </li>
          <li>
            <b>&lt;bin&gt;\System.Data.SQLite.dll</b> (required, managed-only
            core assembly)
          </li>
          <li>
            <b>&lt;bin&gt;\System.Data.SQLite.Linq.dll</b> (optional,
            managed-only LINQ assembly)
          </li>
          <li>
            <b>&lt;bin&gt;\System.Data.SQLite.EF6.dll</b> (optional,
            managed-only EF6 assembly)
          </li>
          <li>
            <b>&lt;bin&gt;\x86\SQLite.Interop.dll</b> (required, x86 native
            interop assembly)
          </li>
          <li>
            <b>&lt;bin&gt;\x64\SQLite.Interop.dll</b> (required, x64 native
            interop assembly)
          </li>
        </ul>
      </td>
      <td>
        &nbsp;
      </td>
    </tr>
    <tr>
      <td colspan="3" class="importantNotes">
        The string &quot;<b>&lt;bin&gt;</b>&quot; above represents the directory
        where the application binaries are to be deployed on the target machine.
        With the native library pre-loading feature enabled and the application
        deployment shown above, the System.Data.SQLite managed-only assembly
        will attempt to automatically detect the processor architecture of the
        current process and pre-load the appropriate native library.
      </td>
    </tr>

    <tr>
      <td colspan="3" class="importantHeader">
        <a name="advancedConfigurationSettings"></a>
        <b>Advanced Configuration Settings</b>
      </td>
    </tr>

    <tr>
      <td colspan="3" class="importantNotes">
        If native library pre-loading feature does not work properly in your
        environment, it can be disabled by setting the
        &quot;No_PreLoadSQLite&quot; environment variable (i.e. to anything)
        prior to loading and/or using the System.Data.SQLite assembly.  There
        are several more environment variables that can be used to influence the
        behavior of the native library pre-loading feature, documented
        <a href="/index.html/artifact?ci=trunk&filename=Doc/Extra/Provider/environment.html">here</a>.
        <br /><br />
        Use of environment variables for configuration settings is not
        supported by the .NET Compact Framework builds of System.Data.SQLite,
        due to limitations imposed by the platform itself.
        <br /><br />
        Alternatively, as of version 1.0.91.0, all configuration settings can be
        specified via an optional
        <a href="/index.html/artifact?ci=trunk&filename=System.Data.SQLite/Configurations/System.Data.SQLite.dll.config">XML configuration file</a>.
        Using the XML configuration file when the primary System.Data.SQLite
        assembly (&quot;System.Data.SQLite.dll&quot;) is being executed from the
        Global Assembly Cache is <b>unsupported</b>.
        <br /><br />
        For each configuration setting, the associated environment variable
        value, if present, will override the value specified via the XML
        configuration file.
        <br /><br />
        For the full .NET Framework, the XML configuration file <b>must</b> be
        named &quot;<b>System.Data.SQLite.dll.config</b>&quot; and it
        <b>must</b> be present in the
        <a href="https://msdn.microsoft.com/en-us/library/system.appdomain.basedirectory%28v=vs.80%29.aspx">base directory for the application domain</a>
        <b>or</b> the directory containing the primary System.Data.SQLite
        assembly as reported by its
        <a href="https://msdn.microsoft.com/en-us/library/system.reflection.assembly.location%28v=vs.80%29.aspx">location</a>
        property; otherwise, it will be ignored.
        <br /><br />
        For the .NET Compact Framework, the XML configuration file <b>must</b>
        be named &quot;<b>System.Data.SQLite.dll.config</b>&quot; and it
        <b>must</b> be present in the directory containing the primary
        System.Data.SQLite assembly; otherwise, it will be ignored.
      </td>
    </tr>

    <tr>
      <td colspan="3" class="importantHeader">
        <a name="deploymentGuidelines"></a>
        <b>Deployment Guidelines</b>
      </td>
    </tr>

    <tr>
      <td colspan="3" class="importantNotes">
        To summarize the above:
      </td>
    </tr>
    <tr>
      <td>
        &nbsp;
      </td>
      <td width="90%" class="importantNotes">
        <ul>
          <li>
            Using XCOPY deployment in conjunction with the native library
            pre-loading feature, especially for customer machines, is highly
            recommended.
          </li>
          <br />
          <li>
            Using the Global Assembly Cache (at all) is not recommended;
            therefore, the &quot;bundle&quot; packages should be avoided unless
            deemed absolutely necessary.
          </li>
          <br />
          <li>
            Using the &quot;static&quot; assembly binaries on development
            machines is not recommended; therefore, the &quot;static&quot;
            packages should be avoided if all the target machines already have
            the Visual C++ runtime installed or it can be easily deployed
            beforehand.
          </li>
          <br />
          <li>
            Choosing the package matching the version of the .NET Framework
            being targeted is highly recommended.
          </li>
          <br />
          <li>
            Choosing the package matching the target processor architecture (for
            both development and customer machines) is almost certainly required
            for proper operation.  Using the native library pre-loading feature
            should help with this.
          </li>
        </ul>
      </td>
      <td>
        &nbsp;
      </td>
    </tr>
  </table>

  <table width="100%" cellpadding="5">
    <tr>
      <td align="center">
        <h2 class="pageSubHeader">List of Release Packages</h2>
      </td>
    </tr>
  </table>

  <table width="100%" cellpadding="5">
    <tr>
      <td colspan="4">
        <b>Source Code</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx-source"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx-source-1.0.118.0.zip">sqlite-netFx-source-1.0.118.0.zip</a>
        <br />
        (7.96 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This ZIP archive contains all current source code for System.Data.SQLite
        1.0.118.0 (3.42.0) combined into a single archive file.
        <br />
        (sha1: b71cac78af1916602a3da81dda27ce3a6e77810b)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx-full-source"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx-full-source-1.0.118.0.zip">sqlite-netFx-full-source-1.0.118.0.zip</a>
        <br />
        (21.03 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This ZIP archive contains all current source code for System.Data.SQLite
        1.0.118.0 (3.42.0) and the extra files needed to run the unit test suite,
        combined into a single archive file.
        <br />
        (sha1: b71927d1bc45af3ff90081f4d9767b08e067c8ac)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Binaries for 32-bit Windows (.NET Framework 2.0 SP2)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx20-binary-bundle-Win32-2005"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx20-binary-bundle-Win32-2005-1.0.118.0.zip">sqlite-netFx20-binary-bundle-Win32-2005-1.0.118.0.zip</a>
        <br />
        (2.17 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x86 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2005 SP1 runtime for x86 and the .NET
        Framework 2.0 SP2 are required.
        <br />
        (sha1: c102d3dc1042e13b23cff0f3f1bcc695fc089eeb)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx20-binary-Win32-2005"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx20-binary-Win32-2005-1.0.118.0.zip">sqlite-netFx20-binary-Win32-2005-1.0.118.0.zip</a>
        <br />
        (2.16 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x86 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2005 SP1
        runtime for x86 and the .NET Framework 2.0 SP2 are required.
        <br />
        (sha1: fcd29236b4a1dc88fd8e5ebb3b072954c0d2dae2)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Binaries for 64-bit Windows (.NET Framework 2.0 SP2)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx20-binary-bundle-x64-2005"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx20-binary-bundle-x64-2005-1.0.118.0.zip">sqlite-netFx20-binary-bundle-x64-2005-1.0.118.0.zip</a>
        <br />
        (2.48 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x64 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2005 SP1 runtime for x64 and the .NET
        Framework 2.0 SP2 are required.
        <br />
        (sha1: b39253eb41c86688643aa6977f2dc5ceb3bee6cf)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx20-binary-x64-2005"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx20-binary-x64-2005-1.0.118.0.zip">sqlite-netFx20-binary-x64-2005-1.0.118.0.zip</a>
        <br />
        (2.47 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x64 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2005 SP1
        runtime for x64 and the .NET Framework 2.0 SP2 are required.
        <br />
        (sha1: 3393b001886358954374f14bc6151dc1c9337976)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Binaries for 32-bit Windows (.NET Framework 3.5 SP1)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx35-binary-bundle-Win32-2008"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx35-binary-bundle-Win32-2008-1.0.118.0.zip">sqlite-netFx35-binary-bundle-Win32-2008-1.0.118.0.zip</a>
        <br />
        (2.62 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x86 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2008 SP1 runtime for x86 and the .NET
        Framework 3.5 SP1 are required.
        <br />
        (sha1: aec2292322d2a15cca0c6889b63e44d15432fade)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx35-binary-Win32-2008"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx35-binary-Win32-2008-1.0.118.0.zip">sqlite-netFx35-binary-Win32-2008-1.0.118.0.zip</a>
        <br />
        (2.61 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x86 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2008 SP1
        runtime for x86 and the .NET Framework 3.5 SP1 are required.
        <br />
        (sha1: 459fbfcc5a9b18a5ac0e18075144adea79421416)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Binaries for 64-bit Windows (.NET Framework 3.5 SP1)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx35-binary-bundle-x64-2008"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx35-binary-bundle-x64-2008-1.0.118.0.zip">sqlite-netFx35-binary-bundle-x64-2008-1.0.118.0.zip</a>
        <br />
        (2.73 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x64 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2008 SP1 runtime for x64 and the .NET
        Framework 3.5 SP1 are required.
        <br />
        (sha1: 3c66fec04965def1ceadbc16d300328c32ccd969)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx35-binary-x64-2008"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx35-binary-x64-2008-1.0.118.0.zip">sqlite-netFx35-binary-x64-2008-1.0.118.0.zip</a>
        <br />
        (2.73 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x64 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2008 SP1
        runtime for x64 and the .NET Framework 3.5 SP1 are required.
        <br />
        (sha1: 0daaa2e19e8a1bb0d0534ea6c099d7c93f193aa0)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Binaries for 32-bit Windows (.NET Framework 4.0)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx40-binary-bundle-Win32-2010"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx40-binary-bundle-Win32-2010-1.0.118.0.zip">sqlite-netFx40-binary-bundle-Win32-2010-1.0.118.0.zip</a>
        <br />
        (2.86 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x86 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2010 SP1 runtime for x86 and the .NET
        Framework 4.0 are required.
        <br />
        (sha1: 4cbae675aa5e7b0518e198a7bacee409e8521725)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx40-binary-Win32-2010"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx40-binary-Win32-2010-1.0.118.0.zip">sqlite-netFx40-binary-Win32-2010-1.0.118.0.zip</a>
        <br />
        (2.86 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x86 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2010 SP1
        runtime for x86 and the .NET Framework 4.0 are required.
        <br />
        (sha1: 07acc3f97e283dcf1e86925ccc71b0df5c8c6f4e)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Binaries for 64-bit Windows (.NET Framework 4.0)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx40-binary-bundle-x64-2010"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx40-binary-bundle-x64-2010-1.0.118.0.zip">sqlite-netFx40-binary-bundle-x64-2010-1.0.118.0.zip</a>
        <br />
        (2.91 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x64 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2010 SP1 runtime for x64 and the .NET
        Framework 4.0 are required.
        <br />
        (sha1: 99370b0ce2928855d4f5a4682c9d2f87246a0c82)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx40-binary-x64-2010"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx40-binary-x64-2010-1.0.118.0.zip">sqlite-netFx40-binary-x64-2010-1.0.118.0.zip</a>
        <br />
        (2.90 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x64 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2010 SP1
        runtime for x64 and the .NET Framework 4.0 are required.
        <br />
        (sha1: 92b02b8416b598cf769aed2061a8f1a04b2ac33c)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Binaries for 32-bit Windows (.NET Framework 4.5)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx45-binary-bundle-Win32-2012"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx45-binary-bundle-Win32-2012-1.0.118.0.zip">sqlite-netFx45-binary-bundle-Win32-2012-1.0.118.0.zip</a>
        <br />
        (2.75 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x86 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2012 Update 4 runtime for x86 and
        the .NET Framework 4.5 are required.
        <br />
        (sha1: 454bb1dc4f4995e36a8a0d9d90ad140a3d621c8d)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx45-binary-Win32-2012"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx45-binary-Win32-2012-1.0.118.0.zip">sqlite-netFx45-binary-Win32-2012-1.0.118.0.zip</a>
        <br />
        (2.81 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x86 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2012
        Update 4 runtime for x86 and the .NET Framework 4.5 are required.
        <br />
        (sha1: a2b4d44cafe4dd4f03c2900d8039307c7c0e4585)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Binaries for 64-bit Windows (.NET Framework 4.5)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx45-binary-bundle-x64-2012"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx45-binary-bundle-x64-2012-1.0.118.0.zip">sqlite-netFx45-binary-bundle-x64-2012-1.0.118.0.zip</a>
        <br />
        (2.80 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x64 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2012 Update 4 runtime for x64 and
        the .NET Framework 4.5 are required.
        <br />
        (sha1: fd86b916bfcf4ac78b8fb8b35a07c527b2c912a3)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx45-binary-x64-2012"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx45-binary-x64-2012-1.0.118.0.zip">sqlite-netFx45-binary-x64-2012-1.0.118.0.zip</a>
        <br />
        (2.90 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x64 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2012
        Update 4 runtime for x64 and the .NET Framework 4.5 are required.
        <br />
        (sha1: 3ef1532e1457626efb5b411973ac81f7e548c03b)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Binaries for 32-bit Windows (.NET Framework 4.5.1)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx451-binary-bundle-Win32-2013"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx451-binary-bundle-Win32-2013-1.0.118.0.zip">sqlite-netFx451-binary-bundle-Win32-2013-1.0.118.0.zip</a>
        <br />
        (2.76 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x86 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2013 Update 2 runtime for x86 and the
        .NET Framework 4.5.1 are required.
        <br />
        (sha1: 6814b497497a75e4bf615f517223baeb2ecdbcbd)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx451-binary-Win32-2013"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx451-binary-Win32-2013-1.0.118.0.zip">sqlite-netFx451-binary-Win32-2013-1.0.118.0.zip</a>
        <br />
        (2.82 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x86 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2013
        Update 2 runtime for x86 and the .NET Framework 4.5.1 are required.
        <br />
        (sha1: bc95beea461b89a97a2d74948346d0c7e0c49a92)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Binaries for 64-bit Windows (.NET Framework 4.5.1)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx451-binary-bundle-x64-2013"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx451-binary-bundle-x64-2013-1.0.118.0.zip">sqlite-netFx451-binary-bundle-x64-2013-1.0.118.0.zip</a>
        <br />
        (2.81 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x64 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2013 Update 2 runtime for x64 and the
        .NET Framework 4.5.1 are required.
        <br />
        (sha1: b34ff3b2c186c01c85e7596b51d69694fdab9e16)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx451-binary-x64-2013"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx451-binary-x64-2013-1.0.118.0.zip">sqlite-netFx451-binary-x64-2013-1.0.118.0.zip</a>
        <br />
        (2.91 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x64 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2013
        Update 2 runtime for x64 and the .NET Framework 4.5.1 are required.
        <br />
        (sha1: 7320f6e605b7e238ae775f60bf2354e3c5425bd0)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Binaries for 32-bit Windows (.NET Framework 4.6)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx46-binary-bundle-Win32-2015"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx46-binary-bundle-Win32-2015-1.0.118.0.zip">sqlite-netFx46-binary-bundle-Win32-2015-1.0.118.0.zip</a>
        <br />
        (3.48 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x86 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2015 Update 3 runtime for x86 and the
        .NET Framework 4.6 are required.
        <br />
        (sha1: 298e7116ef89ecea73e0c75fd0d5dfa3c027b3ff)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx46-binary-Win32-2015"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx46-binary-Win32-2015-1.0.118.0.zip">sqlite-netFx46-binary-Win32-2015-1.0.118.0.zip</a>
        <br />
        (3.70 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x86 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2015
        Update 3 runtime for x86 and the .NET Framework 4.6 are required.
        <br />
        (sha1: fe08afe36a5165863b3b0c9e12f456a7beb8301e)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Binaries for 64-bit Windows (.NET Framework 4.6)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx46-binary-bundle-x64-2015"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx46-binary-bundle-x64-2015-1.0.118.0.zip">sqlite-netFx46-binary-bundle-x64-2015-1.0.118.0.zip</a>
        <br />
        (3.53 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x64 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2015 Update 3 runtime for x64 and the
        .NET Framework 4.6 are required.
        <br />
        (sha1: 676c8cae0a82db4329e7a109fa10c55ebc18bef1)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx46-binary-x64-2015"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx46-binary-x64-2015-1.0.118.0.zip">sqlite-netFx46-binary-x64-2015-1.0.118.0.zip</a>
        <br />
        (3.83 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x64 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2015
        Update 3 runtime for x64 and the .NET Framework 4.6 are required.
        <br />
        (sha1: c7abe212392c752b0f1b140e0db6859c466501f1)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Binaries for Mono on POSIX (.NET Framework 4.5.1)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx451-binary-Mono-2013"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx451-binary-Mono-2013-1.0.118.0.zip">sqlite-netFx451-binary-Mono-2013-1.0.118.0.zip</a>
        <br />
        (1.33 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the managed binaries for the Mono
        version of the System.Data.SQLite 1.0.118.0 (3.42.0) package.  The
        <a href="https://www.mono-project.com/">Mono runtime</a> (4.2.3.4 or
        higher) is required.
        <br />
        (sha1: 98707bd66800c06114d06558511eb5b77f19f980)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Binaries for the .NET Standard 2.0 (.NET Core 2.0)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netStandard20-binary"></a>
        <a href="/downloads/1.0.118.0/sqlite-netStandard20-binary-1.0.118.0.zip">sqlite-netStandard20-binary-1.0.118.0.zip</a>
        <br />
        (0.32 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the managed binaries for the .NET
        Standard 2.0 version of the System.Data.SQLite 1.0.118.0 (3.42.0)
        package.  The <a href="https://dotnet.github.io/">.NET Core</a>
        runtime (2.0 or higher) is required.
        <br />
        (sha1: ffa49bc1cec6c74482796e4f786162bd7fa6cab9)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Binaries for the .NET Standard 2.1 (.NET Core 3.0)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netStandard21-binary"></a>
        <a href="/downloads/1.0.118.0/sqlite-netStandard21-binary-1.0.118.0.zip">sqlite-netStandard21-binary-1.0.118.0.zip</a>
        <br />
        (0.71 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the managed binaries for the .NET
        Standard 2.1 version of the System.Data.SQLite 1.0.118.0 (3.42.0)
        package.  The <a href="https://dotnet.github.io/">.NET Core</a>
        runtime (3.0 or higher) is required.
        <br />
        (sha1: 95871b773c65f8a1e74d0fc5c2f443911264e100)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Statically-Linked Binaries for 32-bit Windows (.NET Framework 2.0 SP2)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx20-static-binary-bundle-Win32-2005"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx20-static-binary-bundle-Win32-2005-1.0.118.0.zip">sqlite-netFx20-static-binary-bundle-Win32-2005-1.0.118.0.zip</a>
        <br />
        (2.36 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x86 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2005 SP1 runtime for x86 is statically
        linked.  The .NET Framework 2.0 SP2 is required.
        <br />
        (sha1: 7bbb3ffb9cc391c6b463dd545ed61ab3d80cb15e)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx20-static-binary-Win32-2005"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx20-static-binary-Win32-2005-1.0.118.0.zip">sqlite-netFx20-static-binary-Win32-2005-1.0.118.0.zip</a>
        <br />
        (2.36 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x86 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2005 SP1
        runtime for x86 is statically linked.  The .NET Framework 2.0 SP2 is
        required.
        <br />
        (sha1: 47e1ef0afb118060443436f1ebab5033191dba1d)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Statically-Linked Binaries for 64-bit Windows (.NET Framework 2.0 SP2)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx20-static-binary-bundle-x64-2005"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx20-static-binary-bundle-x64-2005-1.0.118.0.zip">sqlite-netFx20-static-binary-bundle-x64-2005-1.0.118.0.zip</a>
        <br />
        (2.62 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x64 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2005 SP1 runtime for x64 is statically
        linked.  The .NET Framework 2.0 SP2 is required.
        <br />
        (sha1: 36b9fd78bc740d7c8aea8016642bd9ab96aaed6a)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx20-static-binary-x64-2005"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx20-static-binary-x64-2005-1.0.118.0.zip">sqlite-netFx20-static-binary-x64-2005-1.0.118.0.zip</a>
        <br />
        (2.61 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x64 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2005 SP1
        runtime for x64 is statically linked.  The .NET Framework 2.0 SP2 is
        required.
        <br />
        (sha1: 3e3f9b3e4692337a656d5c6c04c919cdd8f8e89a)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Statically-Linked Binaries for 32-bit Windows (.NET Framework 3.5 SP1)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx35-static-binary-bundle-Win32-2008"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx35-static-binary-bundle-Win32-2008-1.0.118.0.zip">sqlite-netFx35-static-binary-bundle-Win32-2008-1.0.118.0.zip</a>
        <br />
        (2.82 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x86 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2008 SP1 runtime for x86 is statically
        linked.  The .NET Framework 3.5 SP1 is required.
        <br />
        (sha1: 3c68bd551c3d6ff363908388ece0c83cb4292f06)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx35-static-binary-Win32-2008"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx35-static-binary-Win32-2008-1.0.118.0.zip">sqlite-netFx35-static-binary-Win32-2008-1.0.118.0.zip</a>
        <br />
        (2.81 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x86 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2008 SP1
        runtime for x86 is statically linked.  The .NET Framework 3.5 SP1 is
        required.
        <br />
        (sha1: a75124380a8e31d3c868af129508a1d065ca5487)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Statically-Linked Binaries for 64-bit Windows (.NET Framework 3.5 SP1)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx35-static-binary-bundle-x64-2008"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx35-static-binary-bundle-x64-2008-1.0.118.0.zip">sqlite-netFx35-static-binary-bundle-x64-2008-1.0.118.0.zip</a>
        <br />
        (2.89 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x64 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2008 SP1 runtime for x64 is statically
        linked.  The .NET Framework 3.5 SP1 is required.
        <br />
        (sha1: 18e261e601e9da1337a70fef3b69a61e0eeba883)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx35-static-binary-x64-2008"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx35-static-binary-x64-2008-1.0.118.0.zip">sqlite-netFx35-static-binary-x64-2008-1.0.118.0.zip</a>
        <br />
        (2.89 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x64 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2008 SP1
        runtime for x64 is statically linked.  The .NET Framework 3.5 SP1 is
        required.
        <br />
        (sha1: 14475ec77db9d3657b07289eb4468f9f6badcc6d)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Statically-Linked Binaries for 32-bit Windows (.NET Framework 4.0)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx40-static-binary-bundle-Win32-2010"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx40-static-binary-bundle-Win32-2010-1.0.118.0.zip">sqlite-netFx40-static-binary-bundle-Win32-2010-1.0.118.0.zip</a>
        <br />
        (3.06 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x86 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2010 SP1 runtime for x86 is statically
        linked.  The .NET Framework 4.0 is required.
        <br />
        (sha1: b75bb8220923d498bef8e9a7ae2084641a9943ae)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx40-static-binary-Win32-2010"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx40-static-binary-Win32-2010-1.0.118.0.zip">sqlite-netFx40-static-binary-Win32-2010-1.0.118.0.zip</a>
        <br />
        (3.05 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x86 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2010 SP1
        runtime for x86 is statically linked.  The .NET Framework 4.0 is
        required.
        <br />
        (sha1: cae3fa842b32110e59f49522d51c52f0ad39b57e)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Statically-Linked Binaries for 64-bit Windows (.NET Framework 4.0)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx40-static-binary-bundle-x64-2010"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx40-static-binary-bundle-x64-2010-1.0.118.0.zip">sqlite-netFx40-static-binary-bundle-x64-2010-1.0.118.0.zip</a>
        <br />
        (3.08 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x64 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2010 SP1 runtime for x64 is statically
        linked.  The .NET Framework 4.0 is required.
        <br />
        (sha1: e1a32810d03e365df809a6a27363a2426ad2cbbb)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx40-static-binary-x64-2010"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx40-static-binary-x64-2010-1.0.118.0.zip">sqlite-netFx40-static-binary-x64-2010-1.0.118.0.zip</a>
        <br />
        (3.07 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x64 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2010 SP1
        runtime for x64 is statically linked.  The .NET Framework 4.0 is
        required.
        <br />
        (sha1: f63b1434d196a4280cdbe984b30d749871225e90)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Statically-Linked Binaries for 32-bit Windows (.NET Framework 4.5)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx45-static-binary-bundle-Win32-2012"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx45-static-binary-bundle-Win32-2012-1.0.118.0.zip">sqlite-netFx45-static-binary-bundle-Win32-2012-1.0.118.0.zip</a>
        <br />
        (3.07 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x86 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2012 Update 4 runtime for x86 is
        statically linked.  The .NET Framework 4.5 is required.
        <br />
        (sha1: d7895eb5bbc041ee5ee780f59b32ac6567f3463a)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx45-static-binary-Win32-2012"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx45-static-binary-Win32-2012-1.0.118.0.zip">sqlite-netFx45-static-binary-Win32-2012-1.0.118.0.zip</a>
        <br />
        (3.13 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x86 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2012
        Update 4 runtime for x86 is statically linked.  The .NET Framework 4.5
        is required.
        <br />
        (sha1: 7e07b5ce2d7f04b7235e097d4b6ad2b0cdf168a5)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Statically-Linked Binaries for 64-bit Windows (.NET Framework 4.5)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx45-static-binary-bundle-x64-2012"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx45-static-binary-bundle-x64-2012-1.0.118.0.zip">sqlite-netFx45-static-binary-bundle-x64-2012-1.0.118.0.zip</a>
        <br />
        (3.06 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x64 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2012 Update 4 runtime for x64 is
        statically linked.  The .NET Framework 4.5 is required.
        <br />
        (sha1: ac7465c4aea226ce94f748febfe03fb96942178c)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx45-static-binary-x64-2012"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx45-static-binary-x64-2012-1.0.118.0.zip">sqlite-netFx45-static-binary-x64-2012-1.0.118.0.zip</a>
        <br />
        (3.16 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x64 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2012
        Update 4 runtime for x64 is statically linked.  The .NET Framework 4.5
        is required.
        <br />
        (sha1: deed8dadba4f8570624ebdd19f688ebe0c9c5d00)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Statically-Linked Binaries for 32-bit Windows (.NET Framework 4.5.1)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx451-static-binary-bundle-Win32-2013"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx451-static-binary-bundle-Win32-2013-1.0.118.0.zip">sqlite-netFx451-static-binary-bundle-Win32-2013-1.0.118.0.zip</a>
        <br />
        (3.10 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x86 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2013 Update 2 runtime for x86 is
        statically linked.  The .NET Framework 4.5.1 is required.
        <br />
        (sha1: 986e2d90f2f295b6ade17e24290cb1315ed3a8d0)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx451-static-binary-Win32-2013"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx451-static-binary-Win32-2013-1.0.118.0.zip">sqlite-netFx451-static-binary-Win32-2013-1.0.118.0.zip</a>
        <br />
        (3.16 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x86 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2013
        Update 2 runtime for x86 is statically linked.  The .NET Framework 4.5.1
        is required.
        <br />
        (sha1: 3b87ea27d694fa66e4500a90e069d643c56577f2)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Statically-Linked Binaries for 64-bit Windows (.NET Framework 4.5.1)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx451-static-binary-bundle-x64-2013"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx451-static-binary-bundle-x64-2013-1.0.118.0.zip">sqlite-netFx451-static-binary-bundle-x64-2013-1.0.118.0.zip</a>
        <br />
        (3.11 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x64 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2013 Update 2 runtime for x64 is
        statically linked.  The .NET Framework 4.5.1 is required.
        <br />
        (sha1: cdf01831f9b5f7d05d156d08756c955cfc778e7f)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx451-static-binary-x64-2013"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx451-static-binary-x64-2013-1.0.118.0.zip">sqlite-netFx451-static-binary-x64-2013-1.0.118.0.zip</a>
        <br />
        (3.20 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x64 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2013
        Update 2 runtime for x64 is statically linked.  The .NET Framework 4.5.1
        is required.
        <br />
        (sha1: b9c5ec046bf06c7031b4822425139b89aa99563e)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Statically-Linked Binaries for 32-bit Windows (.NET Framework 4.6)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx46-static-binary-bundle-Win32-2015"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx46-static-binary-bundle-Win32-2015-1.0.118.0.zip">sqlite-netFx46-static-binary-bundle-Win32-2015-1.0.118.0.zip</a>
        <br />
        (4.01 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x86 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2015 Update 3 runtime for x86 is
        statically linked.  The .NET Framework 4.6 is required.
        <br />
        (sha1: 2dd4c3d26ca513991baf03273d5c88a3359a05df)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx46-static-binary-Win32-2015"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx46-static-binary-Win32-2015-1.0.118.0.zip">sqlite-netFx46-static-binary-Win32-2015-1.0.118.0.zip</a>
        <br />
        (4.23 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x86 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2015
        Update 3 runtime for x86 is statically linked.  The .NET Framework 4.6
        is required.
        <br />
        (sha1: ba568cd846c2f38d93b9c26786df5d0560696076)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Statically-Linked Binaries for 64-bit Windows (.NET Framework 4.6)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx46-static-binary-bundle-x64-2015"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx46-static-binary-bundle-x64-2015-1.0.118.0.zip">sqlite-netFx46-static-binary-bundle-x64-2015-1.0.118.0.zip</a>
        <br />
        (4.01 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package features the mixed-mode assembly and contains all
        the binaries for the x64 version of the System.Data.SQLite 1.0.118.0
        (3.42.0) package.  The Visual C++ 2015 Update 3 runtime for x64 is
        statically linked.  The .NET Framework 4.6 is required.
        <br />
        (sha1: ba332cf6bf2d35de21da536bb464945ce6b1c9ae)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx46-static-binary-x64-2015"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx46-static-binary-x64-2015-1.0.118.0.zip">sqlite-netFx46-static-binary-x64-2015-1.0.118.0.zip</a>
        <br />
        (4.32 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the x64 version of the
        System.Data.SQLite 1.0.118.0 (3.42.0) package.  The Visual C++ 2015
        Update 3 runtime for x64 is statically linked.  The .NET Framework 4.6
        is required.
        <br />
        (sha1: fa6212548ce82ad27daa59d223404ec8c08825ea)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <b>Precompiled Binaries for Windows CE (.NET Compact Framework)</b>
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx35-binary-PocketPC-ARM-2008"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx35-binary-PocketPC-ARM-2008-1.0.118.0.zip">sqlite-netFx35-binary-PocketPC-ARM-2008-1.0.118.0.zip</a>
        <br />
        (1.70 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the PocketPC version
        of the System.Data.SQLite 1.0.118.0 (3.42.0) package.  The included native
        binaries should work on all supported ARM versions of Windows CE prior
        to Windows Embedded Compact 2013.  The .NET Compact Framework 3.5 is
        required.
        <br />
        (sha1: 4f62797e75f916b848854a37b437131e31b228da)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx39-binary-WinCE-ARM-2012"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx39-binary-WinCE-ARM-2012-1.0.118.0.zip">sqlite-netFx39-binary-WinCE-ARM-2012-1.0.118.0.zip</a>
        <br />
        (1.87 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the Windows Embedded
        Compact 2013 (ARM) version of the System.Data.SQLite 1.0.118.0 (3.42.0)
        package.  The .NET Compact Framework 3.9 is required.
        <br />
        (sha1: 8c4163b7d5965e7e1e7b9af89401964ca1158342)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a name="sqlite-netFx39-binary-WinCE-x86-2012"></a>
        <a href="/downloads/1.0.118.0/sqlite-netFx39-binary-WinCE-x86-2012-1.0.118.0.zip">sqlite-netFx39-binary-WinCE-x86-2012-1.0.118.0.zip</a>
        <br />
        (1.92 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This binary package contains all the binaries for the Windows Embedded
        Compact 2013 (x86) version of the System.Data.SQLite 1.0.118.0 (3.42.0)
        package.  The .NET Compact Framework 3.9 is required.
        <br />
        (sha1: 5e216bd4c99c86a4f2eadf4effcacf2345cdf23a)
      </td>
    </tr>

    <tr>
      <td colspan="4">
        <a name="nuGetPackages"></a>
        <b>Official NuGet Packages</b>
      </td>
    </tr>

    <tr bgcolor="#fff1c8">
      <td colspan="4" class="importantNotes">
        Generally, the official NuGet packages should be obtained from the
        <a href="https://www.nuget.org/profiles/SQLite">NuGet Gallery</a>;
        however, they are also included here as &quot;local downloads&quot; for
        reference.  They should be absolutely identical to those listed on the
        NuGet Gallery with the same name and version.  The SHA1 hashes listed
        below may be used for comparison purposes.
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a href="/downloads/1.0.118.0/System.Data.SQLite.1.0.118.0.nupkg">System.Data.SQLite.1.0.118.0.nupkg</a>
        <br />
        (0.00 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This NuGet package includes all the binaries for both the x86 and x64
        versions of System.Data.SQLite 1.0.118.0 (3.42.0).  The .NET Framework
        3.5 SP1, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, or 4.7.2
        -OR- .NET Core 2.0 is required.  For the included Windows native
        binaries, the version of the Visual C++ runtime corresponding to the
        .NET Framework used by the associated managed assembly is statically
        linked.  For the included Linux native binaries, Ubuntu 16.04 LTS
        compatible runtime libraries are required.  For the included macOS
        native binaries, macOS Sierra compatible runtime libraries are required.
        <br />
        <big><b>This package depends on the &quot;EntityFramework&quot;
        package, version 6.0 or higher (indirectly via the
        &quot;System.Data.SQLite.EF6&quot; package).</b></big>
        <br />
        <br />
        <big><b><i>As of version 1.0.92.0, this package will not directly
        contain any of the required binaries.  Instead, this package will
        depend on the &quot;System.Data.SQLite.Core&quot;,
        &quot;System.Data.SQLite.Linq&quot;, and
        &quot;System.Data.SQLite.EF6&quot; packages.</i></b></big>
        <br />
        <br />
        (sha1: 1e09097b2736af5160b82994c5ab30558230ec0b)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a href="/downloads/1.0.118.0/System.Data.SQLite.Core.1.0.118.0.nupkg">System.Data.SQLite.Core.1.0.118.0.nupkg</a>
        <br />
        (0.00 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This NuGet package contains all the binaries for both the x86 and x64
        versions of System.Data.SQLite 1.0.118.0 (3.42.0), <big><b>except those
        needed to support LINQ and Entity Framework 6</b></big>.  The .NET
        Framework 3.5 SP1, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7,
        4.7.1, or 4.7.2 is required -OR- .NET Core 2.0 is required.  For the
        included Windows native binaries, the version of the Visual C++ runtime
        corresponding to the .NET Framework used by the associated managed
        assembly is statically linked.  For the included Linux native binaries,
        Ubuntu 16.04 LTS compatible runtime libraries are required.  For the
        included macOS native binaries, macOS Sierra compatible runtime
        libraries are required.
        <br />
        <big><b>This package does not depend on any other package.</b></big>
        <br />
        (sha1: b3a43b0ed3f706d3a56e58534773ce27d7b75ad8)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a href="/downloads/1.0.118.0/System.Data.SQLite.Core.MSIL.1.0.118.0.nupkg">System.Data.SQLite.Core.MSIL.1.0.118.0.nupkg</a>
        <br />
        (2.02 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This NuGet package contains the managed binaries for System.Data.SQLite
        1.0.118.0.  The .NET Framework 3.5 SP1, 4.0, 4.5, 4.5.1, 4.5.2, 4.6,
        4.6.1, 4.6.2, 4.7, 4.7.1, or 4.7.2 is required.
        <br />
        <big><b>This package does not depend on any other package.</b></big>
        <br />
        <br />
        <big><b><i>This NuGet package does not include any code from the native
        SQLite core library and will not work properly without the native
        assembly &quot;SQLite.Interop.dll&quot; compiled for the processor
        architecture of the host process being present in a directory in the
        native library search path.</i></b></big>
        <br />
        <br />
        (sha1: 41440ad3cf3b429bcf06080f6fa77b03534730ca)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a href="/downloads/1.0.118.0/System.Data.SQLite.EF6.1.0.118.0.nupkg">System.Data.SQLite.EF6.1.0.118.0.nupkg</a>
        <br />
        (0.27 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This NuGet package contains just the binaries to support Entity
        Framework 6 using System.Data.SQLite 1.0.118.0 (3.42.0).  The .NET
        Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, or
        4.7.2 is required.
        <br />
        <big><b>This package depends on the &quot;EntityFramework&quot;
        package, version 6.0 or higher.</b></big>
        <br />
        (sha1: 68a20c3745ace7bafd02763327b64f4f55d8c139)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a href="/downloads/1.0.118.0/System.Data.SQLite.Linq.1.0.118.0.nupkg">System.Data.SQLite.Linq.1.0.118.0.nupkg</a>
        <br />
        (0.27 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This NuGet package contains just the binaries to support LINQ using
        System.Data.SQLite 1.0.118.0 (3.42.0).  The .NET Framework 3.5 SP1, 4.0,
        4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, or 4.7.2 is required.
        <br />
        <big><b>This package does not depend on any other package.</b></big>
        <br />
        (sha1: 614f58313541cad7bc0d7f2616cc1cca5afa4245)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a href="/downloads/1.0.118.0/System.Data.SQLite.MSIL.1.0.118.0.nupkg">System.Data.SQLite.MSIL.1.0.118.0.nupkg</a>
        <br />
        (0.00 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This NuGet package contains the managed binaries for System.Data.SQLite
        1.0.118.0.  The .NET Framework 3.5 SP1, 4.0, 4.5, 4.5.1, 4.5.2, 4.6,
        4.6.1, 4.6.2, 4.7, 4.7.1, or 4.7.2 is required.
        <br />
        <big><b>This is a legacy package; if possible, please use either the
        &quot;System.Data.SQLite&quot; or &quot;System.Data.SQLite.Core&quot;
        package instead.</b></big>
        <br />
        <br />
        <big><b><i>This NuGet package does not include any code from the native
        SQLite core library and will not work properly without the native
        assembly &quot;SQLite.Interop.dll&quot; compiled for the processor
        architecture of the host process being present in a directory in the
        native library search path.</i></b></big>
        <br />
        <br />
        <big><b><i>As of version 1.0.95.0, this package will not directly
        contain any of the required binaries. Instead, this package will
        depend on the &quot;System.Data.SQLite.Core.MSIL&quot;,
        &quot;System.Data.SQLite.Linq&quot;, and
        &quot;System.Data.SQLite.EF6&quot; packages.</i></b></big>
        <br />
        <br />
        (sha1: d1618b06a74a0fa97ae4d09f381540427819a5c0)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a href="/downloads/1.0.118.0/System.Data.SQLite.x86.1.0.118.0.nupkg">System.Data.SQLite.x86.1.0.118.0.nupkg</a>
        <br />
        (4.82 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This NuGet package contains all the binaries for the x86 version of
        System.Data.SQLite 1.0.118.0 (3.42.0).  The .NET Framework 3.5 SP1,
        4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, or 4.7.2 is
        required.  For the included native binaries, the version of the Visual
        C++ runtime corresponding to the .NET Framework used by the associated
        managed assembly is statically linked.
        <br />
        <big><b>This is a legacy package; if possible, please use either the
        &quot;System.Data.SQLite&quot; or &quot;System.Data.SQLite.Core&quot;
        package instead.</b></big>
        <br />
        (sha1: eb60d6a86d077e5a93dab173d929211cc245b2d0)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a href="/downloads/1.0.118.0/System.Data.SQLite.x64.1.0.118.0.nupkg">System.Data.SQLite.x64.1.0.118.0.nupkg</a>
        <br />
        (5.43 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This NuGet package contains all the binaries for the x64 version of
        System.Data.SQLite 1.0.118.0 (3.42.0).  The .NET Framework 3.5 SP1,
        4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, or 4.7.2 is
        required.  For the included native binaries, the version of the Visual
        C++ runtime corresponding to the .NET Framework used by the associated
        managed assembly is statically linked.
        <br />
        <big><b>This is a legacy package; if possible, please use either the
        &quot;System.Data.SQLite&quot; or &quot;System.Data.SQLite.Core&quot;
        package instead.</b></big>
        <br />
        (sha1: 4f4456dd4d4ba49cad3887c5ad09967a02402bc6)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a href="/downloads/1.0.118.0/Stub.System.Data.SQLite.Core.NetFramework.1.0.118.0.nupkg">Stub.System.Data.SQLite.Core.NetFramework.1.0.118.0.nupkg</a>
        <br />
        (9.85 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This NuGet package contains all the binaries for both the x86 and x64
        versions of System.Data.SQLite 1.0.118.0 (3.42.0), <big><b>except those
        needed to support LINQ and Entity Framework 6</b></big>.  The .NET
        Framework 3.5 SP1, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7,
        4.7.1, or 4.7.2 is required.  For the included Windows native binaries,
        the version of the Visual C++ runtime corresponding to the .NET
        Framework used by the associated managed assembly is statically linked.
        For the included Linux native binaries, Ubuntu 16.04 LTS compatible
        runtime libraries are required.  For the included macOS native binaries,
        macOS Sierra compatible runtime libraries are required.
        <br />
        <big><b>This package does not depend on any other package.</b></big>
        <br />
        (sha1: c9940c474a8e4c5444ecf07963cd0acf37f70297)
      </td>
    </tr>

    <tr>
      <td width="10">&nbsp;</td>
      <td width="30%" valign="top" align="right">
        <a href="/downloads/1.0.118.0/Stub.System.Data.SQLite.Core.NetStandard.1.0.118.0.nupkg">Stub.System.Data.SQLite.Core.NetStandard.1.0.118.0.nupkg</a>
        <br />
        (4.19 MiB)
      </td>
      <td width="5"></td>
      <td valign="top">
        This NuGet package contains all the binaries for both the x86 and x64
        versions of System.Data.SQLite 1.0.118.0 (3.42.0), <big><b>except those
        needed to support LINQ and Entity Framework 6</b></big>.  The .NET Core
        runtime 2.0, 2.1, 2.2, 3.0, or 3.1 is required.  For the included
        Windows native binaries, the version of the Visual C++ runtime
        corresponding to the .NET Framework used by the associated managed
        assembly is statically linked.  For the included Linux native binaries,
        Ubuntu 16.04 LTS compatible runtime libraries are required.  For the
        included macOS native binaries, macOS Sierra compatible runtime
        libraries are required.
        <br />
        <big><b>This package does not depend on any other package.</b></big>
        <br />
        (sha1: 5493bfeb10d47bceb13396d5398a487fe92c9816)
      </td>
    </tr>
  </table>

  <h3 class="pageSubSubHeader">Build Product Names</h3>

  <p>
    Beginning with System.Data.SQLite version 1.0.101.0 (3.12.2), the
    following templates will be used for the names of the build products:

    <ol>
      <li><b>sqlite-netFx-source-</b>version<b>.zip</b></li>
      <li><b>sqlite-netFx-source-</b>version<b>.tar.gz</b></li>
      <li><b>sqlite-netFx-full-source-</b>version<b>.zip</b></li>
      <li><b>sqlite-netFx-full-source-</b>version<b>.tar.gz</b></li>
      <li><b>sqlite-</b>framework<b>-binary-</b>platform<b>-</b>year<b>-</b>version<b>.zip</b></li>
      <li><b>sqlite-</b>framework<b>-binary-bundle-</b>platform<b>-</b>year<b>-</b>version<b>.zip</b></li>
      <li><b>sqlite-</b>framework<b>-static-binary-</b>platform<b>-</b>year<b>-</b>version<b>.zip</b></li>
      <li><b>sqlite-</b>framework<b>-static-binary-bundle-</b>platform<b>-</b>year<b>-</b>version<b>.zip</b></li>
      <li><b>sqlite-netFx-source-</b>date<b>.zip</b></li>
      <li><b>sqlite-netFx-full-source-</b>date<b>.zip</b></li>
      <li><b>System.Data.SQLite.</b>version<b>.nupkg</b></li>
      <li><b>System.Data.SQLite.</b>variant<b>.</b>version<b>.nupkg</b></li>
      <li><b>System.Data.SQLite.</b>variant<b>.</b>releaseType<b>.</b>version<b>.nupkg</b></li>
      <li><b>Stub.System.Data.SQLite.Core.</b>variant<b>.</b>version<b>.nupkg</b></li>
    </ol>
  </p>

  <p>
    Templates (1), (2), (3), and (4) are used for source-code packages.
    Templates (1) and (3) are used for generic source-code packages and
    templates (2) and (4) are used for source-code packages that are
    generally only useful on unix-like platforms.  Templates (3) and (4)
    are used for source-code packages that include the extra files needed
    to run the unit test suite.
  </p>

  <p>
    Templates (5) and (6) are used for the precompiled binary packages.
    Template (6) is used for the precompiled binary package containing the
    mixed-mode assembly.  Templates (7) and (8) are used for the precompiled
    binary packages statically linked to the Visual C++ runtime.  Template
    (8) is used for the precompiled binary package containing the mixed-mode
    assembly statically linked to the Visual C++ runtime.
  </p>

  <p>
    Templates (9) and (10) are used for unofficial pre-release
    &quot;snapshots&quot; of source code.
  </p>

  <p>
    Templates (11), (12), and (13) are used for the official NuGet packages.
  </p>

  <p>
    The <b>framework</b> in templates (5), (6), (7), and (8) will be one of
    netFx20, netFx35, netFx40, netFx45, netFx451, netFx452, netFx46, netFx461,
    netFx462, netFx47, netFx471, netFx472, netFx48.
  </p>

  <p>
    The <b>platform</b> in templates (5), (6), (7), and (8) will be one of
    Win32, x64, PocketPC, PocketPC-ARM, PocketPC-x86, WinCE-ARM, WinCE-x86,
    Mono.
  </p>

  <p>
    The <b>year</b> in templates (5), (6), (7), and (8) will be one of 2005,
    2008, 2010, 2012, 2013, 2015, 2017, 20XX, NetStandard20, NetStandard21.
  </p>

  <p>
    The <b>version</b> in templates (1), (2), (3), (4), (5), (6), (7), (8),
    (11), (12), (13), and (14) is the dot-delimited version number of the
    primary System.Data.SQLite assembly.
  </p>

  <p>
    The <b>date</b> in template (9) and (10) is of the form: YYYYMMDDHHMM
  </p>

  <p>
    The <b>variant</b> in template (12), (13), and (14) will be MSIL, x86,
    or x64.  Alternatively, it may be absent, which represents the default
    variant.
  </p>

  <p>
    The <b>releaseType</b> in template (13) will be Beta or Test.
    Alternatively, it may be absent, which represents the default release type.
    <ul>
    <li>The &quot;Beta&quot; release type is used to indicate that the package
    was intended to be used for
    <a href="https://en.wikipedia.org/wiki/Software_release_life_cycle#Beta">beta</a>
    testing.</li>
    <li>The &quot;Test&quot; release type is used to indicate that the package
    was intended to be used for
    <a href="https://en.wikipedia.org/wiki/Software_release_life_cycle#Release_candidate">release candidate</a>
    testing.</li>
    </ul>
  </p>

  <h3 class="pageSubSubHeader">Canonical Source Code</h3>

  <p>
    The canonical System.Data.SQLite source code is maintained in a Fossil
    repository that is available for anonymous read-only access. Anyone can view
    the repository contents and download historical versions of individual files
    or ZIP archives of historical check-ins.
  </p>

  <p>
    The complete source tree for any
    <a href="/index.html/timeline?n=20&y=ci">check-in</a>
    may always be downloaded using the &quot;Tarball&quot; or &quot;ZIP
    archive&quot; links available from each check-in detail page.
  </p>
</nowiki>

Added www/faq.wiki.





































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
<title>Frequently Asked Questions</title>

<a name="faq"></a>
<h2>Frequently Asked Questions</h2>

<ol>
  <li>
    <a href="#q1">When will the <b>next version</b> of System.Data.SQLite be
    released?</a>
  </li>
  <br>
  <li>
    <a href="#q2">When are you planning on adding feature &quot;X&quot;?</a>
  </li>
  <br>
  <li>
    <a href="#q3">What versions of <b>.NET Framework</b> are supported?</a>
  </li>
  <br>
  <li>
    <a href="#q4">What versions of <b>Visual Studio</b> are supported?</a>
  </li>
  <br>
  <li>
    <a href="#q5">Are <b>NuGet</b> packages available?</a>
  </li>
  <br>
  <li>
    <a href="#q6">How do I build the binaries for <b>Mono</b>?</a>
  </li>
  <br>
  <li>
    <a href="#q7">How do I build the binaries for <b>.NET Compact Framework</b>?</a>
  </li>
  <br>
  <li>
    <a href="#q8">How do I install System.Data.SQLite on a <b>development
    machine</b>?</a>
  </li>
  <br>
  <li>
    <a href="#q9">How do I install System.Data.SQLite on <b>end-user
    machines</b>?</a>
  </li>
  <br>
  <li>
    <a href="#q10">Do I need to add an assembly reference to the
    &quot;<b>sqlite3.dll</b>&quot; or &quot;<b>SQLite.Interop.dll</b>&quot; in
    my project?</a>
  </li>
  <br>
  <li>
    <a href="#q11">Why do I get a <b>DllNotFoundException</b> (for
    &quot;sqlite3.dll&quot; or &quot;SQLite.Interop.dll&quot;) when trying to
    run my application?</a>
  </li>
  <br>
  <li>
    <a href="#q12">Why do I get a <b>BadImageFormatException</b> (for
    &quot;sqlite3.dll&quot; or &quot;SQLite.Interop.dll&quot;) when trying to
    run my application?</a>
  </li>
  <br>
  <li>
    <a href="#q13">Why do I get the error &quot;<b>This assembly is built by a
    runtime newer than the currently loaded runtime and cannot be loaded.</b>
    &quot;?</a>
  </li>
  <br>
  <li>
    <a href="#q14">What is a <b>mixed-mode assembly</b>?</a>
  </li>
  <br>
  <li>
    <a href="#q15">What is a &quot;<b>bundle</b>&quot; package (i.e. from the
    downloads page)?</a>
  </li>
  <br>
  <li>
    <a href="#q16">What is the difference between the &quot;<b>Setup</b>&quot;
    and &quot;<b>Precompiled Binary</b>&quot; packages (i.e. from the downloads
    page)?</a>
  </li>
  <br>
  <li>
    <a href="#q17">Why is System.Data.SQLite <b>leaking</b> memory, resources,
    etc?</a>
  </li>
  <br>
  <li>
    <a href="#q18">What are the <b>support options</b> for System.Data.SQLite?</a>
  </li>
  <br>
  <li>
    <a href="#q19">When the solution is loaded in Visual Studio, why do no files
    show up for several of the projects in the <b>Solution Explorer</b> window?
    </a>
  </li>
  <br>
  <li>
    <a href="#q20">When the System.Data.SQLite project is compiled and run from
    inside Visual Studio, why do I get a <b>DllNotFoundException</b> or a
    <b>BadImageFormatException</b> (for &quot;sqlite3.dll&quot; or
    &quot;SQLite.Interop.dll&quot;) when trying to run or debug the application?
    </a>
  </li>
  <br>
  <li>
    <a href="#q21">Is this behavior a bug? <b>-OR-</b> Is there a quick way to
    view the various lists of tickets for the System.Data.SQLite project?
    </a>
  </li>
  <br>
  <li>
    <a href="#q22">Since upgrading a project to use System.Data.SQLite version
    1.0.82.0 (or later), the database file is <b>still locked</b> after all its
    connections have been closed.  Why is this happening?
    </a>
  </li>
</ol>

<hr>
<a name="q1"></a>
<p>
  <b>(1) When will the next version of System.Data.SQLite be released?</b>
</p>

<p>
  The release schedule for the System.Data.SQLite project is roughly
  synchronized (within about two or three weeks) with that of the
  [https://www.sqlite.org/ | SQLite] core itself.  The release history for the
  System.Data.SQLite project is [./news.wiki | here].
</p>

<hr>
<a name="q2"></a>
<p>
  <b>(2) When are you planning on adding feature &quot;X&quot;?</b>
</p>

<p>
  This question is hard to answer precisely.  It depends on a number of factors,
  including but not limited to:
  <ul>
    <li>
      Can the feature be implemented in a backward compatible manner?
    </li>

    <li>
      Can the feature be implemented in a portable fashion for all the currently
      supported versions of the .NET Framework and/or Visual Studio?
    </li>

    <li>
      Does the feature fit well with the current design of the project?
    </li>

    <li>
      How much time will it take to design, implement, and test the feature?
    </li>

    <li>
      Will the feature benefit the entire community or only a tiny subset
      thereof?
    </li>
  </ul>
</p>

<hr>
<a name="q3"></a>
<p>
  <b>(3) What versions of .NET Framework are supported?</b>
</p>

<p>
  <ul>
    <li>
      The .NET Framework 2.0 SP2 (or higher) for the System.Data.SQLite assembly.
    </li>

    <li>
      The .NET Framework 3.5 SP1 (or higher) for the System.Data.SQLite.Linq
      assembly.
    </li>

    <li>
      The .NET Framework 4.0 (or higher) for the System.Data.SQLite.EF6
      assembly.
    </li>

    <li>
      All sub-projects are fully supported with the .NET Framework 4.0.
    </li>

    <li>
      All sub-projects are fully supported with the .NET Framework 4.5.
    </li>
  </ul>
</p>

<hr>
<a name="q4"></a>
<p>
  <b>(4) What versions of Visual Studio are supported?</b>
</p>

<p>
  Currently, Visual Studio 2005, 2008, 2010, 2012, 2013, 2015, and 2017 are
  supported, including the &quot;Express&quot; editions; however, in order to
  build the entire solution, including the necessary native code, the
  &quot;Professional&quot; edition (or higher) is required.  It may be possible
  to install both Visual C# Express and Visual C++ Express and then build the
  corresponding sub-projects via their respective integrated development
  environments (IDE); however, this configuration has <b>not</b> been tested.
  The design-time components are <b>no longer</b> supported for the Express
  editions due to licensing restrictions.  Due to
  <a href="https://docs.microsoft.com/en-us/visualstudio/extensibility/breaking-changes-2017">changes</a>
  in the Visual Studio package installation model, the design-time components
  do not support Visual Studio 2017 and later versions.  Also, as of
  [./support.wiki | May 1, 2017], the design-time components are <b>no
  longer</b> officially supported.
</p>

<hr>
<a name="q5"></a>
<p>
  <b>(5) Are NuGet packages available?</b>
</p>

<p>
  Yes.
  <ul>
    <b>These are the primary NuGet packages:</b>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite">
      System.Data.SQLite</a>: The SQLite database engine for both x86 and x64
      along with the ADO.NET provider, including support for LINQ and Entity
      Framework 6.
    </li>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite.Core">
      System.Data.SQLite.Core</a>: The SQLite database engine for both x86 and
      x64 along with the ADO.NET provider.
    </li>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite.Core.MSIL">
      System.Data.SQLite.Core.MSIL</a>: Just the managed ADO.NET provider for
      SQLite.
    </li>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite.EF6">
      System.Data.SQLite.EF6</a>: Just support for Entity Framework 6 using
      System.Data.SQLite.
    </li>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite.Linq">
      System.Data.SQLite.Linq</a>: Just support for LINQ using
      System.Data.SQLite.
    </li>

    <li>
      <a href="https://www.nuget.org/packages/Stub.System.Data.SQLite.Core.NetFramework/">
      Stub.System.Data.SQLite.Core.NetFramework</a>: The SQLite database engine
      for both x86 and x64 along with the ADO.NET provider.  This package
      targets the desktop .NET Framework.
    </li>

    <li>
      <a href="https://www.nuget.org/packages/Stub.System.Data.SQLite.Core.NetStandard/">
      Stub.System.Data.SQLite.Core.NetStandard</a>: The SQLite database engine
      for both x86 and x64 along with the ADO.NET provider.  This package
      targets the .NET Standard 2.x.
    </li>
  </ul>
  <br>
  <ul>
    <b>These NuGet packages may contain &quot;beta&quot; code and are not
    intended for production use.</b>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite.Beta">
      System.Data.SQLite.Beta</a>: The SQLite database engine for both x86
      and x64 along with the ADO.NET provider, including support for LINQ
      and Entity Framework 6.
    </li>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite.Core.Beta">
      System.Data.SQLite.Core.Beta</a>: The SQLite database engine for both x86
      and x64 along with the ADO.NET provider.
    </li>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite.Core.MSIL.Beta">
      System.Data.SQLite.Core.MSIL.Beta</a>: Just the managed ADO.NET provider
      for SQLite.
    </li>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite.EF6.Beta">
      System.Data.SQLite.EF6.Beta</a>: Just support for Entity Framework 6
      using System.Data.SQLite.
    </li>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite.Linq.Beta">
      System.Data.SQLite.Linq.Beta</a>: Just support for LINQ using
      System.Data.SQLite.
    </li>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite.MSIL.Beta">
      System.Data.SQLite.MSIL.Beta</a>: Just the managed ADO.NET provider for
      SQLite.
    </li>
  </ul>
  <br>
  <ul>
    <b>These NuGet packages may contain pre-release code and are not intended
    for production use.</b>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite.Core.Test">
      System.Data.SQLite.Core.Test</a>: The SQLite database engine for both x86
      and x64 along with the ADO.NET provider.
    </li>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite.Core.MSIL.Test">
      System.Data.SQLite.Core.MSIL.Test</a>: Just the managed ADO.NET provider
      for SQLite.
    </li>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite.EF6.Test">
      System.Data.SQLite.EF6.Test</a>: Just support for Entity Framework 6
      using System.Data.SQLite.
    </li>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite.Linq.Test">
      System.Data.SQLite.Linq.Test</a>: Just support for LINQ using
      System.Data.SQLite.
    </li>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite.MSIL.Test">
      System.Data.SQLite.MSIL.Test</a>: Just the managed ADO.NET provider for
      SQLite.
    </li>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite.Test">
      System.Data.SQLite.Test</a>: The SQLite database engine for both x86
      and x64 along with the ADO.NET provider, including support for LINQ
      and Entity Framework 6.
    </li>
  </ul>
  <br>
  <ul>
    <b>Finally, there are legacy NuGet packages for backwards compatibility.
    If possible, projects using these should be updated to use either the
    &quot;System.Data.SQLite&quot; or &quot;System.Data.SQLite.Core&quot;
    package instead of using these legacy packages.  These legacy NuGet
    packages should not be used for new projects and may stop receiving
    updates in the future.</b>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite.MSIL">
      System.Data.SQLite.MSIL</a>: Just the managed ADO.NET provider for
      SQLite.
    </li>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite.x86">
      System.Data.SQLite.x86</a>: The SQLite database engine combined with a
      complete ADO.NET provider all rolled into a single mixed-mode assembly
      for x86.
    </li>

    <li>
      <a href="https://www.nuget.org/packages/System.Data.SQLite.x64">
      System.Data.SQLite.x64</a>: The SQLite database engine combined with a
      complete ADO.NET provider all rolled into a single mixed-mode assembly
      for x64.
    </li>
  </ul>
</p>

<hr>
<a name="q6"></a>
<p>
  <b>(6) How do I build the binaries for Mono?</b>
</p>

<p>
  This is documented on the [./build.wiki#mono | build procedures] page.
  Alternatively, there is now a pre-built binary package for Mono on the
  [./downloads.wiki#sqlite-netFx451-binary-Mono-2013 | downloads] page.
</p>

<hr>
<a name="q7"></a>
<p>
  <b>(7) How do I build the binaries for .NET Compact Framework?</b>
</p>

<p>
  This is documented on the [./release.wiki#buildCeBinaries | release procedures]
  page.
</p>

<hr>
<a name="q8"></a>
<p>
  <b>(8) How do I install System.Data.SQLite on a development machine?</b>
</p>

<p>
  Strictly speaking, there is no need to install System.Data.SQLite on any
  development machine (e.g. via the setup).  The recommended way to use the
  assemblies is:

  <ul>
    <li>
      Download the precompiled binary package for your target framework and
      processor architecture (e.g. 32-bit x86, .NET Framework 2.0).
    </li>

    <li>
      Extract the package to a directory named "Externals" inside your project
      directory.
    </li>

    <li>
      Add a reference to the "System.Data.SQLite" assembly from the "Externals"
      directory.
    </li>

    <li>
      If necessary (i.e. you require LINQ support), also add a reference to the
      "System.Data.SQLite.Linq" assembly from the "Externals" directory.
    </li>

    <li>
      If necessary (i.e. you require EF6 support), also add a reference to the
      "System.Data.SQLite.EF6" assembly from the "Externals" directory.
    </li>
  </ul>
</p>

<p>
  Alternatively, when using Visual Studio 2010 or later, you can simply use the
  NuGet package that corresponds to your target processor architecture.
  Installing the assemblies into the Global Assembly Cache is not recommended as
  it may cause conflicts with other applications installed on the machine.
</p>

<hr>
<a name="q9"></a>
<p>
  <b>(9) How do I install System.Data.SQLite on end-user machines?</b>
</p>

<p>
  Strictly speaking, there is no need to install System.Data.SQLite on any
  end-user machine (e.g. via the setup).  The recommended way to deploy the
  assemblies is &quot;application local&quot; (i.e. copy them to the directory
  the application is installed to).  Installing the assemblies into the Global
  Assembly Cache is not recommended as it may cause conflicts with other
  applications installed on the machine.
</p>

<hr>
<a name="q10"></a>
<p>
  <b>(10) Do I need to add an assembly reference to the
  &quot;sqlite3.dll&quot; or &quot;SQLite.Interop.dll&quot; in my project?</b>
</p>

<p>
  No, because they are not managed assemblies and contain no managed code.
</p>

<hr>
<a name="q11"></a>
<p>
  <b>(11) Why do I get a DllNotFoundException (for &quot;sqlite3.dll&quot;
  or &quot;SQLite.Interop.dll&quot;) when trying to run my application?</b>
</p>

<p>
  Either the named dynamic link library (DLL) cannot be located or it cannot be
  loaded due to missing dependencies.  Make sure the named dynamic link library
  is located in the application directory or a directory along the system PATH
  and try again.  Also, be sure the necessary Visual C++ runtime redistributable
  has been installed unless you are using a dynamic link library that was built
  statically linked to it.
</p>

<hr>
<a name="q12"></a>
<p>
  <b>(12) Why do I get a BadImageFormatException (for &quot;sqlite3.dll&quot; or
  &quot;SQLite.Interop.dll&quot;) when trying to run my application?</b>
</p>

<p>
  The named dynamic link library (DLL) contains native code that was built for a
  processor architecture that is not compatible with the current process (e.g.
  you cannot load a 32-bit dynamic link library into a 64-bit process or
  vice-versa).  Another explanation is that the named dynamic link library was
  built for a later version of the CLR than is available in the current process
  (e.g. you cannot load an assembly built for the .NET Framework 4.0 into a .NET
  Framework 2.0 process, regardless of the processor architecture).
</p>

<hr>
<a name="q13"></a>
<p>
  <b>(13) Why do I get the error &quot;This assembly is built by a runtime newer
  than the currently loaded runtime and cannot be loaded.&quot;?</b>
</p>

<p>
  Because the assembly was built for the .NET Framework 4.0 and you are trying
  to load it into a process that is using the .NET Framework 2.0.
</p>

<hr>
<a name="q14"></a>
<p>
  <b>(14) What is a mixed-mode assembly?</b>
</p>

<p>
  A mixed-mode assembly is a dynamic link library that contains both managed
  code and native code for a particular processor architecture.  Since it
  contains native code it can only be loaded into a process that matches the
  processor architecture it was compiled for.  Also see this
  <a href="https://stackoverflow.com/questions/7266936/what-is-a-mixed-mode-assembly">StackOverflow question</a>.
</p>

<hr>
<a name="q15"></a>
<p>
  <b>(15) What is a &quot;bundle&quot; package (i.e. from the downloads page)?</b>
</p>

<p>
  The &quot;bundle&quot; packages listed on the downloads page contains the
  System.Data.SQLite mixed-mode assembly in a file named
  &quot;System.Data.SQLite.dll&quot; (see <a href="#q14">question #14</a>)
  instead of separate &quot;System.Data.SQLite.dll&quot; and
  &quot;SQLite.Interop.dll&quot; files to contain the managed code and native
  code, respectively.
</p>

<hr>
<a name="q16"></a>
<p>
  <b>(16) What is the difference between the &quot;Setup&quot; and
  &quot;Precompiled Binary&quot; packages (i.e. from the downloads page)?</b>
</p>

<p>
  The &quot;Setup&quot; packages are designed to install the necessary files,
  optionally installing the assemblies into the Global Assembly Cache,
  generating native images for the managed assemblies via Ngen, adding Start
  Menu shortcuts, modifying the .NET Framework machine configuration files to
  register the ADO.NET provider, and installing the design-time components for
  Visual Studio.  The &quot;Precompiled Binary&quot; packages are simply ZIP
  files that contain all the binaries compiled for a particular .NET Framework
  and processor architecture.
</p>

<hr>
<a name="q17"></a>
<p>
  <b>(17) Why is System.Data.SQLite leaking memory, resources, etc?</b>
</p>

<p>
  All System.Data.SQLite objects that implement IDisposable, either directly or
  indirectly, should be explicitly disposed when they are no longer needed.  If
  this is the case and you are still seeing a leak of some kind, please file a
  <a href="/index.html/tktnew">ticket</a>.
</p>

<hr>
<a name="q18"></a>
<p>
  <b>(18) What are the support options for System.Data.SQLite?</b>
</p>

<p>
  This is discussed on the [./support.wiki | support] page.
</p>

<hr>
<a name="q19"></a>
<p>
  <b>(19) When the solution is loaded in Visual Studio, why do no files show up
  for several of the projects in the Solution Explorer window?</b>
</p>

<p>
  Several of the sub-projects (i.e. primarily those that build variants of the
  System.Data.SQLite assembly) share an MSBuild &quot;targets&quot; file that
  contains the actual references to the C# source code files.  Unfortunately,
  due to limitations on how Visual Studio reads and interprets MSBuild files at
  design-time, the C# source code files do not show up in the Solution Explorer
  window.  This limitation is largely cosmetic and does <b>not</b> impact the
  correctness of the build process itself, whether in Visual Studio or when
  using MSBuild on the command line.
</p>

<hr>
<a name="q20"></a>
<p>
  <b>(20) When the System.Data.SQLite project is compiled and run from inside
  Visual Studio, why do I get a DllNotFoundException or a BadImageFormatException
  (for &quot;sqlite3.dll&quot; or &quot;SQLite.Interop.dll&quot;) when trying to
  run or debug the application?</b>
</p>

<p>
  When compiling and running a solution from within Visual Studio that uses the
  System.Data.SQLite project (including the test project), it is very important
  to select the correct build configuration and platform.  First, managed
  applications to be debugged inside Visual Studio cannot use the mixed-mode
  assembly (i.e. because it is always compiled to the platform-specific build
  output directory).  This is necessary to properly support building binaries
  for multiple platforms using the same source project files.  Therefore, only
  the &quot;DebugNativeOnly&quot; or &quot;ReleaseNativeOnly&quot; build
  configurations should be selected when running a managed application from
  inside Visual Studio that relies upon the System.Data.SQLite assembly.  These
  build configurations contain a custom post-build step that copies the required
  native assembly to the managed output directory (i.e. to enable running the
  managed binaries in-place).  However, this post-build step will only be
  performed if the selected platform matches that of the operating system (e.g.
  &quot;Win32&quot; for 32-bit Windows and &quot;x64&quot; for 64-bit Windows).
  Therefore, it is good practice to double-check the selected build platform
  against the operating system prior to attempting to run a managed project in
  the solution.
</p>

<hr>
<a name="q21"></a>
<p>
  <b>(21) Is this behavior a bug? -OR- Is there a quick way to view the various
  lists of tickets for the System.Data.SQLite project?</b>
</p>

<p>
  If any behavior is observed that appears to be a bug, it may be reported via
  the <a href="https://sqlite.org/forum/forum">SQLite Forum</a> or by filing a
  <a href="/index.html/tktnew">ticket</a>.  Prior to taking one of these steps,
  it is always prudent to check the various lists of previously filed tickets
  to see if the behavior being observed has already been reported and possibly
  fixed in a subsequent release.
  <ol>
    <li><a href="/index.html/rptview?rn=6">
      The list of tickets actively being worked on.
    </a></li>
    <li><a href="/index.html/rptview?rn=2">
      The list of tickets currently open.
    </a></li>
    <li><a href="/index.html/rptview?rn=4">
      The list of tickets fixed and then closed.
    </a></li>
    <li><a href="/index.html/rptview?rn=7">
      The list of tickets closed without needing a fix.
    </a></li>
  </ol>
</p>

<hr>
<a name="q22"></a>
<p>
  <b>(22) Since upgrading a project to use System.Data.SQLite version 1.0.82.0
  (or later), the database file is still locked after all its connections have
  been closed.  Why is this happening?
</b>
</p>

<p>
  As of version 1.0.82.0, the native resources for a SQLiteConnection object,
  including any native locks on the underlying file, are not fully released
  until all SQLiteCommand, SQLiteDataReader, SQLiteStatement, and SQLiteBackup
  objects associated with that SQLiteConnection object have also been disposed.
  These changes were made to allow the SQLite native resource management to
  integrate better with the
  <a href="https://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29">garbage collection</a>
  semantics used by the
  <a href="https://en.wikipedia.org/wiki/Common_Language_Runtime">Common Language
  Runtime</a>.  Allowing native SQLite resources to be released in a
  non-deterministic order is accomplished through careful use of the
  <a href="https://www.sqlite.org/c3ref/close.html">sqlite3_close_v2()</a> core
  native library routine.
</p>

Added www/features.wiki.







































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<title>Features</title>

<h2>Features</h2>

<ul>
  <li>
    Written from scratch on Visual Studio 2005 specifically for ADO.NET,
    implementing all the base classes and features recently introduced in the
    framework, including automatic transaction enlistment.
  </li>

  <li>
    Supports the Full and Compact .NET Framework, and native C/C++ development.
    100% binary compatible with the original sqlite3.dll.
  </li>

  <li>
    Full support for Mono via a &quot;managed only&quot; provider that runs
    against the official SQLite 3.6.1 or higher library.
  </li>

  <li>Full Entity Framework support (ADO.NET 3.5 SP1).</li>

  <li>
    On the Compact Framework, it is faster than SQL Server Mobile.  SQLite's
    installed size is a fraction of SQL Mobile's.  It uses less memory at
    runtime, runs queries faster, and has a smaller database file size as well.
  </li>

  <li>
    Encrypted database support.  Encrypted databases are fully encrypted and
    support both binary and cleartext password types.
  </li>

  <li>
    Visual Studio design-time Support, works with all versions of Visual Studio
    2005/2008/2010/2012/2013/2015.  It is now unsupported and may not work with
    Visual Studio 2017 as the integration/extensibility model has changed
    significantly.  You can add a SQLite database to the Servers list, design
    queries with the Query Designer, drag-and-drop tables onto a Typed DataSet,
    etc.
    <br />
    <font color="red">
      Due to Visual Studio licensing restrictions, the Express Editions can no
      longer be supported.
    </font>
  </li>

  <li>
    Full SQLite schema editing inside Visual Studio.  You can create/edit tables,
    views, triggers, indexes, check constraints and foreign keys.
  </li>

  <li>
    Single file redistributable (except on Compact Framework).  The core SQLite
    native code and the ADO.NET managed wrapper are combined into one mixed-mode
    assembly.
  </li>

  <li>
    Binaries included for x86, x64, Itanium, and ARM processors.
    <br />
    <font color="red">
      Itanium processor support not currently included.
    </font>
  </li>

  <li>DbProviderFactory support.</li>

  <li>
    Full support for ATTACH'ed databases.  Exposed as <i>Catalogs</i> in the
    schema.  When cloning a connection, all attached databases are automatically
    re-attached to the new connection.
  </li>

  <li>
    DbConnection.GetSchema(...) support includes <i>ReservedWords</i>,
    <i>MetaDataCollections</i>, <i>DataSourceInformation</i>, <i>DataTypes</i>,
    <i>Columns</i>, <i>Tables</i>, <i>Views</i>, <i>ViewColumns</i>,
    <i>Catalogs</i>, <i>Indexes</i>, <i>IndexColumns</i>, <i>ForeignKeys</i> and
    <i>Triggers</i>.
  </li>

  <li>
    Enhanced DbDataReader.GetSchemaTable() functionality returns catalog,
    namespace and detailed schema information even for complex queries.
  </li>

  <li>Named and unnamed parameters.</li>

  <li>
    Full UTF-8 and UTF-16 support, each with optimized pipelines into the native
    database core.
  </li>

  <li>
    Multiple simultaneous DataReaders (one DataReader per Command however).
  </li>

  <li>
    Full support for user-defined scalar and aggregate functions, encapsulated
    into an easy-to-use base class in which only a couple of overrides are
    necessary to implement new SQL functions.
  </li>

  <li>
    Full support for user-defined collating sequences, every bit as simple to
    implement as user-defined functions and uses the same base class.
  </li>

  <li>
    Full source for the entire engine and wrapper.  No copyrights.  Public
    Domain.  100% free for commercial and non-commercial use.
  </li>
</ul>

Added www/index.wiki.































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<title>Home</title>
<nowiki>
  <div class="rightsidebar border2px">
    <h3 align="center">Common Links</h3>
    <ul>
      <li><a href="faq.wiki">Frequently Asked Questions</a></li>
      <li><a href="news.wiki">News</a></li>
      <li><a href="support.wiki">Support</a></li>
      <li><a href="downloads.wiki">Downloads</a></li>
      <li><a href="source.wiki">Source Code</a></li>
      <li><a href="build.wiki">Build Procedures</a></li>
      <li><a href="test.wiki">Test Procedures</a></li>
      <li><a href="release.wiki">Release Procedures</a></li>
      <li><a href="contribute.wiki">Contributing</a></li>
      <li><a href="features.wiki">Features</a></li>
      <li><a href="copyright.wiki">Copyright</a></li>
    </ul>
  </div>
  <h1>News for System.Data.SQLite</h1>
  <p>
    For the most recent news and developments, please see the
    <a href="news.wiki">news page</a>.
  </p>
  <h2>About System.Data.SQLite</h2>
  <p>
    System.Data.SQLite is an ADO.NET provider for
    <a href="https://www.sqlite.org/">SQLite</a>.
  </p>
  <p>
    System.Data.SQLite was started by Robert Simpson.  Robert still has
    commit privileges on this repository but is no longer an active
    contributor.  Development and maintenance work is now mostly performed
    by the SQLite Development Team.  The SQLite team is committed to
    supporting System.Data.SQLite long-term.
  </p>
  <p>
    Legacy versions may still be found at
    <a href="https://sourceforge.net/projects/sqlite-dotnet2/">SourceForge</a>,
    though there have been no updates there since April of 2010.
  </p>
  <p>
    There is no forum on this web site; however, the
    <a href="support.wiki">support page</a> has an updated list of support
    options.
  </p>
  <p>
    Please refer to the
    <a href="downloads.wiki">downloads page</a> for a complete list of
    downloadable packages and information on their use.
  </p>
  <h2>Documentation for System.Data.SQLite</h2>
  <p>
    The documentation corresponding to the most recently released version
    of System.Data.SQLite, which contains detailed information for all
    public types, methods, properties, and events is checked into the
    repository in
    <a href="https://en.wikipedia.org/wiki/Microsoft_Compiled_HTML_Help">
    <i>Microsoft Compiled HTML Help</i> (&quot;CHM&quot;) format</a>.  It
    can also be
    <a href="/index.html/doc/trunk/Doc/SQLite.NET.chm?mimetype=application/x-chm">
    <b>downloaded directly</b></a> via the web interface to the repository.
  </p>
</nowiki>

Added www/news.wiki.















































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
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
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
<title>News</title>

<div align="center"><h2><b>Community Support Policies</b></h2></div>
<div align="center"><h3><b>Effective May 1, 2017</b></h3></div>
<div align="center"><h3><b>Updated May 22, 2021</b></h3></div>

<h4>Legacy CryptoAPI-based (RC4) Codec</h4>

<ul>
  <li>
    It is unsupported.
  </li>
  <li>
    It is disabled in all default build configurations.
  </li>
  <li>
    It may not be possible to build binaries with it enabled.
  </li>
</ul>

<h4>Design-Time Components for Visual Studio</h4>

<ul>
  <li>
    They will still be built and included in the release packages.
  </li>
  <li>
    However, they will no longer be &quot;officially supported&quot;.
  </li>
  <li>
    The forum may still be used to ask questions about them.
  </li>
  <li>
    However, any tickets opened for them will be deleted.
  </li>
  <li>
    Due to
    <a href="https://docs.microsoft.com/en-us/visualstudio/extensibility/breaking-changes-2017">changes</a>
    in the Visual Studio package installation model, they are not
    supported by Visual Studio 2017 and later versions.
  </li>
</ul>

<h4>Release Packages</h4>

<ul>
  <li>
    Release packages for non-current releases will be archived.
  </li>
  <li>
    Access to archived release packages will be granted on a case-by-case basis.
  </li>
</ul>

<div align="center"><h2><b>Version History</b></h2></div>

<p>
    <b>1.0.119.0 - May XX, 2024 <font color="red">(release scheduled)</font></b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_45_3.html|SQLite 3.45.3].</li>
    <li>Update internal resource list of reserved SQL words.</li>
    <li>Avoid NullReferenceException from Path.Combine method when the PublishSingleFile property is enabled for a project. Pursuant to forum post [https://www.sqlite.org/forum/forumpost/66a0d2716a|66a0d2716a].</li>
    <li>Add the VfsName connection string property.</li>
    <li>Fix rarely seen NullReferenceException in the StaticWeakConnectionPool.Add method.</li>
    <li>Revise the calculation used to bind DateTime values. Fix for [bbddfeb773].</li>
</ul>
<p>
    <b>1.0.118.0 - June 10, 2023</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_42_0.html|SQLite 3.42.0].</li>
    <li>Add the ConnectionStringPreview, SqlStringPreview, and Canceled connection events.</li>
    <li>Add support for the sqlite3_is_interrupted core library API. Pursuant to forum post [https://www.sqlite.org/forum/forumpost/b6a707bffb|b6a707bffb].</li>
    <li>Add support for the sqlite_trace_v2 core library API. Pursuant to forum post [https://www.sqlite.org/forum/forumpost/1c418d7edc|1c418d7edc].</li>
    <li>Add TextHexPassword connection string property for use with [https://www.sqlite.org/see|SEE].</li>
    <li>Add SQLite_ForceLogRetry environment variable to force logging of all internal retries during statment preparation and stepping.</li>
    <li>Add StepRetries connection string property to allow the maximum number of retries when stepping a query to be overridden.</li>
    <li>Fix ExecuteScalar and ExecuteNonQuery handling of write transactions that require more than one call to step. Pursuant to forum post [https://www.sqlite.org/forum/forumpost/f4e718891d|f4e718891d].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Parameter names should be case-sensitive. Fix for [e22d357a21].&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.117.0 - November 28, 2022</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_40_0.html|SQLite 3.40.0].</li>
    <li>Add support for creating custom window functions. Pursuant to forum post [https://www.sqlite.org/forum/forumpost/21de219031|21de219031].</li>
    <li>Suppress finalizer calls for SQLite3 objects that are closed. Fix for [ce4d70ea6f].</li>
    <li>Improvements to object disposal diagnostics. Pursuant to [ce4d70ea6f].</li>
    <li>Add MaximumSleepTime property to the SQLiteCommand class and DefaultMaximumSleepTime connection string property.</li>
    <li>Add experimental support for running the test suite using .NET 5 and .NET 6.</li>
    <li>Add experimental support for native sha3 extension.</li>
</ul>
<p>
    <b>1.0.116.0 - June 1, 2022</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_38_5.html|SQLite 3.38.5].</li>
    <li>More flexible connection pooling via the new ISQLiteConnectionPool2 interface.</li>
    <li>Add SQLite_StrongConnectionPool environment variable to prevent pooled connections from being garbage collected.</li>
    <li>Improvements to object disposal handling for database connections.</li>
</ul>
<p>
    <b>1.0.115.5 - November 2, 2021</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/src/info/ca2703c339f76101|SQLite trunk].</li>
    <li>Add Busy event to the SQLiteConnection class. Pursuant to forum post [https://www.sqlite.org/forum/forumpost/08a52f61fc|08a52f61fc].</li>
    <li>Fix metadata UTF-16 string length calculations on Linux. Fix for forum post [https://www.sqlite.org/forum/forumpost/eeaefb84ec|eeaefb84ec].</li>
</ul>
<p>
    <b>1.0.115.0 - August 25, 2021</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_36_0.html|SQLite 3.36.0].</li>
</ul>
<p>
    <b>1.0.114.0 - May 22, 2021</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_35_5.html|SQLite 3.35.5].</li>
    <li>Updated to [https://www.nuget.org/packages/EntityFramework/6.4.4|Entity Framework 6.4.4].</li>
    <li>Add preliminary support for the .NET Framework 4.8.</li>
    <li>Add support for math functions now provided by the SQLite core library.</li>
    <li>Add support for [https://www.sqlite.org/compile.html#enable_update_delete_limit|ORDER BY and LIMIT for UPDATE and DELETE].</li>
    <li>Add TextPassword connection string property for use with [https://www.sqlite.org/see|SEE].</li>
</ul>
<p>
    <b>1.0.113.0 - June 1, 2020</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_32_1.html|SQLite 3.32.1].</li>
    <li>Add SQLite_ForceLogLifecycle environment variable to force logging of calls into key members pertaining to the lifecycle of connections and their associated classes (e.g. LINQ, EF6, etc).</li>
    <li>Support automatic value conversions for columns with a declared type of MEDIUMINT or MEDIUMUINT. Pursuant to [515cb60b10].</li>
</ul>
<p>
    <b>1.0.112.3 - Xxxx XX, 2020</b>
</p>
<ul>
    <li>When using the (unsupported) legacy CryptoAPI-based (RC4) codec, skip encrypting page #1 because that can lead to database corruption and other malfunctions.</li>
    <li>Add SQLite_ForceLogLifecycle environment variable to force logging of calls into key members pertaining to the lifecycle of connections and their associated classes (e.g. LINQ, EF6, etc).</li>
    <li>Support automatic value conversions for columns with a declared type of MEDIUMINT or MEDIUMUINT. Pursuant to [515cb60b10].</li>
</ul>
<p>
    <b>1.0.112.2 - April 27, 2020</b>
</p>
<ul>
    <li>Fix NuGet packaging for .NET Standard 2.1. Fix for [7c73262e6f].</li>
</ul>
<p>
    <b>1.0.112.1 - April 6, 2020</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_31_1.html|SQLite 3.31.1].</li>
    <li>Include the &quot;LINQ&quot; partial classes in the primary managed assembly for .NET Standard 2.1. Fix for [ad28d8e026].</li>
</ul>
<p>
    <b>1.0.112.0 - October 28, 2019</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_30_1.html|SQLite 3.30.1].</li>
    <li>Add preliminary support for .NET Core 3.0 and the .NET Standard 2.1. Pursuant to [ce75d320d0].</li>
    <li>Updated to [https://www.nuget.org/packages/EntityFramework/6.3.0|Entity Framework 6.3.0].</li>
    <li>Add support for new DBCONFIG options from the SQLite core library. Pursuant to [03b6b0edd7].</li>
    <li>Add SetLimitOption method to the SQLiteConnection class.</li>
</ul>
<p>
    <b>1.0.111.0 - June 10, 2019</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_28_0.html|SQLite 3.28.0].</li>
    <li>Add No_SQLiteLog environment variable.</li>
</ul>
<p>
    <b>1.0.110.0 - March 4, 2019</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_27_2.html|SQLite 3.27.2].</li>
    <li>Add HidePassword connection flag to remove the password from the connection string once the database is opened. Pursuant to [23d8d6171e].</li>
    <li>Add experimental StrictConformance connection flag to force strict compliance to the ADO.NET standard. Pursuant to [e36e05e299].</li>
    <li>Add support for the [https://www.sqlite.org/session/c_changesetstart_invert.html|sqlite3changeset_start_v2()] and [https://www.sqlite.org/session/c_changesetstart_invert.html|sqlite3changeset_start_v2_strm()] interfaces.</li>
</ul>
<p>
    <b>1.0.109.0 - August 15, 2018</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_24_0.html|SQLite 3.24.0].</li>
    <li>Updated to [https://www.nuget.org/packages/EntityFramework/6.2.0|Entity Framework 6.2.0].</li>
    <li>Do not attempt to initialize the logging subsystem more than once.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Prevent GetSchemaTable from throwing InvalidCastException. Fix for [baf42ee135].</li>
    <li>Add preliminary support for the .NET Framework 4.7.2.</li>
    <li>Add preliminary support for .NET Core 2.0 and the .NET Standard 2.0. Pursuant to [5c89cecd1b].</li>
    <li>Add simpler overload for the SQLiteBlob.Create method. Pursuant to [dfc8133ba2].</li>
    <li>Add GetFieldAffinity method to the SQLiteDataReader class.</li>
</ul>
<p>
    <b>1.0.108.0 - March 2, 2018</b>
</p>
<ul>
    <li>Support extended result codes when messages are looked up without the SQLite core library.</li>
    <li>Override System.Object members for the SQLiteException class to improve its ToString return value. Pursuant to [53962f9eff].</li>
    <li>More database connection configuration options for the [https://www.sqlite.org/c3ref/db_config.html|sqlite3_db_config()] interface.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Set HResult property of SQLiteException based on the SQLite core library error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Modify experimental WaitForEnlistmentReset method to require a nullable boolean parameter for the value to return when the connection is disposed.&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.107.0 - January 30, 2018</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_22_0.html|SQLite 3.22.0].</li>
    <li>Improve performance of type name lookups by removing superfluous locking and string creation.</li>
    <li>Support asynchronous completion of distributed transactions. Fix for [5cee5409f8].</li>
    <li>Add experimental WaitForEnlistmentReset method to the SQLiteConnection class. Pursuant to [7e1dd697dc].</li>
    <li>Fix some internal memory accounting present only in the debug build.</li>
    <li>Make sure inbound native delegates are unhooked before adding a connection to the pool. Fix for [0e48e80333].</li>
    <li>Add preliminary support for the .NET Framework 4.7.1.</li>
    <li>Updates to internal DbType mapping related lookup tables. Pursuant to [a799e3978f].</li>
</ul>
<p>
    <b>1.0.106.0 - November 2, 2017</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_21_0.html|SQLite 3.21.0].</li>
    <li>Add full support for the native [https://www.sqlite.org/sessionintro.html|session] extension.</li>
    <li>Add BindDecimalAsText and GetDecimalAsText connection flags to force binding and returning of decimal values as text. Pursuant to [b167206ad3].</li>
    <li>Add BindInvariantDecimal and GetInvariantDecimal connection flags, enabled by default, to force binding and returning of decimal values using the invariant culture. Pursuant to [b167206ad3].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add preliminary support for Visual Studio 2017 and the .NET Framework 4.7. This does <b>not</b> include support for the design-time components for Visual Studio, see [8292431f51].</li>
</ul>
<p>
    <b>1.0.105.2 - June 12, 2017</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_19_3.html|SQLite 3.19.3].</li>
    <li>Fix issues that prevented SQLiteBlob creation from succeeding for tables that did not have an integer primary key.</li>
</ul>
<p>
    <b>1.0.105.1 - May 15, 2017</b>
</p>
<ul>
    <li>Prevent culture settings from negatively impacting integer connection string defaults.</li>
    <li>Make sure the &quot;No_SQLiteConnectionNewParser&quot; and &quot;DefaultFlags_SQLiteConnection&quot; setting values end up being cached.</li>
    <li>Cache the XML file name and assembly directory used by the configuration subsystem.</li>
</ul>
<p>
    <b>1.0.105.0 - April 9, 2017</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_18_0.html|SQLite 3.18.0].</li>
    <li>Add experimental support for native sha1 extension.</li>
</ul>
<p>
    <b>1.0.104.0 - December 16, 2016</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_15_2.html|SQLite 3.15.2].</li>
    <li>Add the &quot;%PreLoadSQLite_AssemblyDirectory%&quot;, &quot;%PreLoadSQLite_TargetFramework%&quot;, and &quot;%PreLoadSQLite_XmlConfigDirectory%&quot; [https://system.data.sqlite.org/index.html/artifact?ci=trunk&filename=Doc/Extra/Provider/environment.html|replacement tokens] for use in configuration setting values. Pursuant to [d4728aecb7].</li>
    <li>Prevent the GetByte, GetChar, and GetInt16 methods of the SQLiteDataReader class from throwing exceptions for large integer values. Pursuant to [5535448538].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Use [https://www.sqlite.org/lang_savepoint.html|SAVEPOINTs] to properly implement nested transactions when the new AllowNestedTransactions connection flag is used. Pursuant to [1f7bfff467].</li>
    <li>When converting a Julian Day value to an integer, round to the nearest millisecond first. Pursuant to [69cf6e5dc8].&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.103.0 - September 15, 2016</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_14_2.html|SQLite 3.14.2].</li>
    <li>Add preliminary support for the .NET Framework 4.6.2.</li>
    <li>Change the SQLiteReadValueCallback delegate &quot;eventArgs&quot; parameter to be of type SQLiteReadEventArgs.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Make SQLiteReadValueEventArgs and SQLiteReadArrayEventArgs derive from SQLiteReadEventArgs.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Rename SQLiteReadValueEventArgs.ArrayEventArgs property to ExtraEventArgs.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add No_SQLiteGetSettingValue and No_SQLiteXmlConfigFile environment variables.</li>
    <li>Reduce the number of calls to GetSettingValue from SQLiteConnection. Pursuant to [25d53b48f6].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add NoVerifyTypeAffinity connection flag to disable all type affinity checking.</li>
    <li>Add support for [https://www.sqlite.org/c3ref/blob_open.html|incremental blob I/O].</li>
    <li>Improve support for the [https://www.sqlite.org/c3ref/db_config.html|sqlite3_db_config()] interface. Pursuant to [f64f4aee95].</li>
</ul>
<p>
    <b>1.0.102.0 - June 23, 2016</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_13_0.html|SQLite 3.13.0].</li>
    <li>Update the SQLiteConnection.EnableExtensions method to make use of the new SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION option, when available.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Prevent the SQLiteCommand.ExecuteScalar method from throwing an exception when there are no result columns.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Support per-connection customization for binding parameters and reading values, based on the database type name.</li>
    <li>Add TypeName property to the SQLiteParameter class.</li>
    <li>Add VerifyOnly method to the SQLiteCommand class.</li>
    <li>Add IsReadOnly method to the SQLiteConnection class.</li>
</ul>
<p>
    <b>1.0.101.0 - April 19, 2016</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_12_2.html|SQLite 3.12.2].</li>
    <li>Add binary package release for Mono on POSIX.</li>
</ul>
<p>
    <b>1.0.100.0 - April 15, 2016</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_12_1.html|SQLite 3.12.1].</li>
    <li>Support compiling and using the interop assembly on Linux and Mac OS X.</li>
    <li>Support running the test suite under Mono on Linux and Mac OS X.</li>
    <li>Properly handle NULL values in the &quot;name&quot; column of the results returned by PRAGMA index_info(). Fix for [5251bd0878].</li>
    <li>For column types that resolve to boolean, recognize case-insensitive prefixes of &quot;True&quot; and &quot;False&quot;. Fix for [dbd65441a5].</li>
    <li>Add NoVerifyTextAffinity connection flag to skip type affinity checking when fetching a column value as a string. Pursuant to [dbd65441a5].</li>
    <li>The UnixEpoch DateTime format should use Int64 internally, not Int32.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Avoid using Path.Combine with null values in the native library pre-loader. Fix for [da685c0bac].</li>
    <li>Fix the (unsupported) legacy CryptoAPI-based (RC4) codec so that it no longer prevents page size changes.</li>
</ul>
<p>
    <b>1.0.99.1 - March 31, 2016</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_9_3.html|SQLite 3.9.3].</li>
</ul>
<p>
    <b>1.0.99.0 - December 9, 2015</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_9_2.html|SQLite 3.9.2].</li>
    <li>Add preliminary support for the .NET Framework 4.6.1.</li>
    <li>Fix handling of sqlite3_index_info members not available with older versions of the SQLite core library.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Update and improve documentation comments for the native virtual table methods.</li>
    <li>Permit an existing registered function to be replaced. Fix for [2556655d1b].</li>
    <li>Make GetValue work for boolean columns with textual &quot;True&quot; and &quot;False&quot; values. Fix for [7714b60d61].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add Reset method to the SQLiteCommand class.</li>
    <li>Add FileName property to the SQLiteConnection class.</li>
    <li>Add experimental support for the native json1 and fts5 extensions.</li>
    <li>Add GetDatabaseName, GetTableName, and GetOriginalName methods to the SQLiteDataReader class.</li>
</ul>
<p>
    <b>1.0.98.0 - August 19, 2015</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_8_11_1.html|SQLite 3.8.11.1].</li>
    <li>Add full support for Visual Studio 2015 and the .NET Framework 4.6.</li>
    <li>Add support for creating custom SQL functions using delegates.</li>
    <li>Implement the Substring method for LINQ using the &quot;substr&quot; core SQL function.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Prevent encrypted connections from being used with the connection pool. Pursuant to [89d3a159f1].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Honor the second argument to Math.Round when using LINQ.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Honor the pre-existing flags for connections during the Open method. Fix for [964063da16].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Remove errant semi-colons from the SQL used by LINQ to INSERT and then SELECT rows with composite primary keys. Fix for [9d353b0bd8].</li>
    <li>Refactor INSERT/UPDATE handling (in the LINQ assembly) so it can handle composite and non-integer primary keys. Fix for [41aea496e0].</li>
    <li>Change the base type for the SQLiteConnectionFlags enumeration to long integer.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add extended return codes to the SQLiteErrorCode enumeration. Pursuant to [71bedaca19].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Improve exception handling in all native callbacks implemented in the SQLiteConnection class.</li>
    <li>Add Progress event and ProgressOps connection string property to enable raising progress events during long-running queries.</li>
    <li>Add &quot;Recursive Triggers&quot; connection string property to enable or disable the recursive trigger capability. Pursuant to [3a82ee635b].</li>
    <li>Add NoDefaultFlags connection string property to prevent the default connection flags from being used. Pursuant to [964063da16].</li>
    <li>Add VfsName connection string property to allow a non-default VFS to be used by the SQLite core library.</li>
    <li>Add BusyTimeout connection string property to set the busy timeout to be used by the SQLite core library.</li>
    <li>Add UnbindFunction and UnbindAllFunctions methods to the SQLiteConnection class.</li>
    <li>Enable integration with the [https://www.hwaci.com/sw/sqlite/zipvfs.html|ZipVFS] extension.</li>
</ul>
<p>
    <b>1.0.97.0 - May 26, 2015</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_8_10_2.html|SQLite 3.8.10.2].</li>
    <li>Updated to [https://www.nuget.org/packages/EntityFramework/6.1.3|Entity Framework 6.1.3].</li>
    <li>Improve ADO.NET conformance of the SQLiteDataReader.RecordsAffected property. Fix for [74542e702e].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Prevent the IDataReader.GetDataTypeName method from throwing &quot;No current row&quot; exceptions. Fix for [94252b9059].</li>
    <li>When BinaryGUID handling is off, transform the LINQ parameter types as well. Fix for [a4d9c7ee94].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The IDataReader.GetDataTypeName method should always return the declared type name.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add DefaultFlags_SQLiteConnection environment variable to enable customization of the default connection flags.</li>
    <li>Prevent calls to sqlite3_step() and sqlite3_interrupt() from being interrupted via ThreadAbortException.</li>
    <li>Make sure enabling UseUTF16Encoding sets the schema encoding to UTF-16. Fix for [7c151a2f0e].</li>
</ul>
<p>
    <b>1.0.96.0 - March 5, 2015</b>
</p>
<ul>
    <li>Prevent the IDataReader.GetOrdinal method from throwing &quot;No current row&quot; exceptions. Fix for [c28d7fe915].</li>
    <li>When counting the number of tables in the GetSchemaTable method, do not include those that have a null or empty name. Fix for [92dbf1229a].</li>
</ul>
<p>
    <b>1.0.95.0 - March 2, 2015</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_8_8_3.html|SQLite 3.8.8.3].</li>
    <li>Updated to [https://www.nuget.org/packages/EntityFramework/6.1.2|Entity Framework 6.1.2].</li>
    <li>Modify configuration file transforms performed by the NuGet packages to allow Entity Framework 6 design-time integration to work automatically. Fix for [2be4298631], [abad7c577d], and [417d669435].</li>
    <li>The &quot;System.Data.SQLite.EF6*&quot; and &quot;System.Data.SQLite.Linq*&quot; NuGet packages no longer depend on the &quot;System.Data.SQLite.Core*&quot; packages.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The &quot;System.Data.SQLite.MSIL*&quot; NuGet packages no longer directly include any files; they are now meta-packages.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The &quot;System.Data.SQLite.x86*&quot; and &quot;System.Data.SQLite.x64*&quot; NuGet packages now depend on the &quot;System.Data.SQLite.Linq&quot; and &quot;System.Data.SQLite.EF6&quot; NuGet packages.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Make sure SQL statements generated for DbUpdateCommandTree objects are properly delimited.</li>
    <li>Make sure SQLiteIndexOutputs.ConstraintUsages instances are created prior to calling ISQLiteManagedModule.BestIndex. Fix for [56f511d268].</li>
    <li>Correct marshalling of strings and blobs in the SQLiteValue class. Fix for [85b824b736].</li>
    <li>Various minor performance enhancements to the SQLiteDataReader class. Pursuant to [e122d26e70].</li>
    <li>Defer disposing of connections created by the static SQLiteCommand.Execute method when a data reader is returned. Fix for [daeaf3150a].</li>
    <li>Wrap SELECT statements in parenthesis if they have an ORDER BY, LIMIT, or OFFSET clause and a compound operator is involved. Fix for [0a32885109].</li>
    <li>In the SQLiteDataReader.VerifyType method, remove duplicate &quot;if&quot; statement for the DbType.SByte value and move the remaining &quot;if&quot; to the Int64 affinity.  Fix for [c5cc2fb334].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Handle Julian Day values that fall outside of the supported range for OLE Automation dates. Fix for [3e783eecbe].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Make sure the interop files are copied when publishing a project that refers to a NuGet package containing them. Fix for [e796ac82c1].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Make sure the interop files are copied before the PostBuildEvent. Fix for [f16c93a932].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Modify GetSchemaTable method to avoid setting SchemaTableColumn.IsKey column to true when more than one table is referenced. Fix for [47c6fa04d3].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add AppendManifestToken_SQLiteProviderManifest environment variable to enable better integration between LINQ and the underlying store connection.</li>
    <li>Add SQLite_ForceLogPrepare environment variable to force logging of all prepared SQL regardless of the flags for the associated connection.</li>
    <li>Honor the DateTimeFormat, DateTimeKind, DateTimeFormatString, BinaryGUID connection string and/or provider manifest token properties from within the LINQ assembly. Fix for [8d928c3e88].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add PrepareRetries connection string property to allow the maximum number of retries when preparing a query to be overridden. Fix for [647d282d11].</li>
    <li>Add BindDateTimeWithKind connection flag to force DateTime parameter values to match the DateTimeKind associated with the connection, if applicable. Fix for [a7d04fb111].</li>
</ul>
<p>
    <b>1.0.94.0 - September 9, 2014</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_8_6.html|SQLite 3.8.6].</li>
    <li>Updated to [https://www.nuget.org/packages/EntityFramework/6.1.1|Entity Framework 6.1.1].</li>
    <li>Refactor and simplify NuGet packages in order to support per-solution SQLite interop assembly files.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add RefreshFlags method to the SQLiteDataReader class to forcibly refresh its connection flags.</li>
    <li>Improve automatic detection and handling of the Entity Framework 6 assembly by the design-time components installer. Pursuant to [e634e330a6].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Improve SQLiteDataReader performance slightly by caching the connection flags.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add ClearCachedSettings method to the SQLiteConnection class.</li>
    <li>Add NoConvertSettings connection flag to disable querying of runtime configuration settings from within the SQLiteConvert class. Pursuant to [58ed318f2f].</li>
    <li>Minimize usage of the &quot;Use_SQLiteConvert_DefaultDbType&quot; and &quot;Use_SQLiteConvert_DefaultTypeName&quot; settings. Fix for [58ed318f2f].&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.93.0 - June 23, 2014</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_8_5.html|SQLite 3.8.5].</li>
    <li>Updated to [https://www.nuget.org/packages/EntityFramework/6.1|Entity Framework 6.1].</li>
    <li>Add support for mapping transaction isolation levels to their legacy default values. Pursuant to [56b42d99c1].</li>
    <li>Add support for setting the default DbType and type name used for mappings on a per-connection basis. Pursuant to [3c00ec5b52].</li>
    <li>Add DetectTextAffinity and DetectStringType connection flags to enable automatic detection of column types, when necessary. Pursuant to [3c00ec5b52].</li>
    <li>Add SetChunkSize method to the SQLiteConnection class. Pursuant to [d1c008fa0a].</li>
    <li>Add SharedFlags static property to the SQLiteConnection class.</li>
    <li>Make the ISQLiteSchemaExtensions interface public.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Have the SQLiteProviderFactory class (in the System.Data.SQLite.Linq assembly) implement the IServiceProvider interface.</li>
    <li>Fix bug in documentation generator automation that prevented some internal documentation links from working.</li>
    <li>Fix DateTime constant handling in the LINQ assembly. Fix for [da9f18d039].&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.92.0 - March 19, 2014</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_8_4_1.html|SQLite 3.8.4.1].</li>
    <li>Update the list of keywords returned by SQLiteConnection.GetSchema(&quot;ReservedWords&quot;).&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Raise the static SQLiteConnection.Changed event when any SQLiteCommand or SQLiteDataReader object is closed or disposed.</li>
    <li>Add the SQLiteDataReader.StepCount property to return the number of rows seen so far.</li>
    <li>Add StickyHasRows connection flag to cause the SQLiteDataReader.HasRows property to return non-zero if there were ever any rows in the associated result sets.</li>
    <li>When the TraceWarning connection flag is set, issue warnings about possibly malformed UNC paths. Pursuant to [283344397b].</li>
    <li>Convert the primary NuGet package, &quot;System.Data.SQLite&quot;, into a meta-package.</li>
    <li>Enhancements to the NuGet packages, including the new &quot;modular&quot; packages.</li>
</ul>
<p>
    <b>1.0.91.0 - February 12, 2014</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_8_3_1.html|SQLite 3.8.3.1].</li>
    <li>Refresh all included SQLite core library documentation (e.g. SQL syntax).</li>
    <li>Add support for [https://entityframework.codeplex.com/|Entity Framework 6].</li>
    <li>Add support for per-connection mappings between type names and DbType values. Pursuant to [e87af1d06a].</li>
    <li>Modify the namespace used for all internal classes in the System.Data.SQLite.Linq assembly.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add SQLiteCompileOptions and InteropCompileOptions properties to the SQLiteConnection class to return the compile-time options for the SQLite core library and interop assembly, respectively.</li>
    <li>Add BindInvariantText and ConvertInvariantText connection flags to force the invariant culture to be used when converting parameter values to/from strings.</li>
    <li>Add NoConnectionPool and UseConnectionPool connection flags to disable or enable connection pooling by default.</li>
    <li>Modify handling of the design-time components installer to run Visual Studio <b>devenv.exe /setup</b> after installing the package. This appears to be necessary in some circumstances for Visual Studio 2013. Pursuant to [a47eff2c71].</li>
    <li>Modify the native library pre-loader to support reading settings from an XML configuration file and to be capable of checking more than one directory. Persuant to [f0246d1817].</li>
    <li>Support detecting when the native library pre-loader should use the CodeBase property instead of the Location property as the basis for locating the interop assembly.</li>
    <li>Change the default behavior for the native library pre-loader so it first searches the executing (i.e. System.Data.SQLite) assembly directory and then the application domain directory. Pursuant to [f0246d1817].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Include DbType.AnsiString in the list of types that need special ColumnSize handling. Fix for [0550f0326e].</li>
</ul>
<p>
    <b>1.0.90.0 - December 23, 2013</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_8_2.html|SQLite 3.8.2].</li>
    <li>Add Visual Studio 2013 support to all the applicable solution/project files, their associated supporting files, and the test suite.</li>
    <li>Add Visual Studio 2013 support to the redesigned designer support installer.</li>
    <li>Add support for Windows Embedded Compact 2013.</li>
    <li>Add experimental support for the native regexp extension.</li>
    <li>Never create a new connection wrapper in the SQLiteConnection.Shutdown method.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add experimental GetMemoryStatistics, ReleaseMemory, and Shutdown methods to the SQLiteConnection class.</li>
    <li>Add memory leak detection to the test project for the .NET Compact Framework.</li>
    <li>Add SQLITE_ENABLE_MEMORY_MANAGEMENT compile-time option to the interop assembly.</li>
    <li>Use current isolation level when enlisting into an existing transaction. Fix for [56b42d99c1].</li>
    <li>Better handling of non-error log messages from the SQLite core library. Pursuant to [44df10ea90].</li>
    <li>Add TraceWarning connection flag to enable tracing of type mapping failures and disable tracing of them by default. Pursuant to [6d45c782e4].</li>
    <li>Use 32-bit values to keep track of numeric precision and scale when building the schema table for a query. Fix for [ef2216192d].</li>
</ul>
<p>
    <b>1.0.89.0 - October 28, 2013</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_8_1.html|SQLite 3.8.1].</li>
    <li>Add AutoCommit property to the SQLiteConnection class. Fix for [9ba9346f75].</li>
    <li>Use declared column sizes for the AnsiStringFixedLength and StringFixedLength mapped database types. Fix for [3113734605].</li>
    <li>Check the result of sqlite3_column_name function against NULL.</li>
    <li>Return false for the SQLiteParameterCollection.IsSynchronized property because it is not thread-safe.</li>
    <li>Raise the static SQLiteConnection.Changed event when any SQLiteCommand, SQLiteDataReader, or CriticalHandle derived object instance is created. Fix for [aba4549801].</li>
    <li>Add SQLiteCommand.Execute, SQLiteCommand.ExecuteNonQuery, and SQLiteCommand.ExecuteScalar method overloads that take a CommandBehavior parameter.</li>
    <li>Revise how the extra object data is passed to the static SQLiteConnection.Changed event.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Make sure the database cannot be changed by a query when the CommandBehavior.SchemaOnly flag is used. Fix for [f8dbab8baf].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Fix bug in [https://sourceforge.net/projects/ndoc3|NDoc3] that was preventing some of the MSDN documentation links from working.</li>
    <li>Include the XML documentation files in the NuGet packages. Fix for [5970d5b0a6].</li>
    <li>Add InteropVersion, InteropSourceId, ProviderVersion, and ProviderSourceId properties to the SQLiteConnection class.</li>
    <li>Add experimental support for interfacing with the authorizer callback in the SQLite core library.</li>
    <li>Add experimental support for the native totype extension.</li>
</ul>
<p>
    <b>1.0.88.0 - August 7, 2013</b>
</p>
<ul>
    <li>Various fixes to managed virtual table integration infrastructure.</li>
    <li>Implement workaround for an incorrect PROCESSOR_ARCHITECTURE being reported. Fix for [9ac9862611].</li>
    <li>Modify classes that implement the IDisposable pattern to set the disposed flag after their base classes have been disposed.</li>
    <li>When automatically registering custom functions, use the executing assembly (i.e. System.Data.SQLite) for reference detection. Fix for [4e49a58c4c].</li>
</ul>
<p>
    <b>1.0.87.0 - July 8, 2013</b>
</p>
<ul>
    <li>Add all the necessary infrastructure to allow virtual tables to be implemented in managed code. Fix for [9a544991be].</li>
    <li>The DbType to type name translation needs to prioritize the Entity Framework type names. Fix for [47f4bac575].</li>
    <li>Add DateTimeFormatString connection string property to allow the DateTime format string used for all parsing and formatting to be overridden.</li>
    <li>Add NoFunctions connection flag to skip binding functions registered in the application domain.</li>
    <li>Add several data-types for compatibility purposes. Fix for [fe50b8c2e8].</li>
    <li>Add SQLiteConnection.BindFunction method to facilitate adding custom functions on a per-connection basis.</li>
    <li>When reading a DateTime value, avoid unnecessary string conversions. Fix for [4d87fbc742].</li>
    <li>Modify the index introspection code so that it does not treat PRAGMA table_info &quot;pk&quot; column values as boolean. Fix for [f2c47a01eb].</li>
    <li>Disable use of the new connection string parsing algorithm when the No_SQLiteConnectionNewParser environment variable is set. Pursuant to [bbdda6eae2].</li>
    <li>Rename the ReturnCode property of the SQLiteException class to ResultCode.&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.86.0 - May 23, 2013</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_7_17.html|SQLite 3.7.17].</li>
    <li>Disable use of the AllowPartiallyTrustedCallers attribute when compiled for the .NET Framework 4.0/4.5.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Allow semi-colons in the data source file name. Fix for [e47b3d8346].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>NULL values should be reported as type &quot;object&quot;, not &quot;DBNull&quot;. Fix for [48a6b8e4ca].</li>
</ul>
<p>
    <b>1.0.85.0 - April 18, 2013</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_7_16_2.html|SQLite 3.7.16.2].</li>
    <li>Properly handle embedded NUL characters in parameter and column values. Fix for [3567020edf].</li>
    <li>Make use of the sqlite3_prepare_v2 function when applicable.</li>
    <li>Check for a valid row in the SQLiteDataReader.GetValue method.</li>
    <li>Implement processor architecture detection when running on the .NET Compact Framework (via P/Invoke).</li>
    <li>Support automated testing when running on the .NET Compact Framework 2.0.</li>
    <li>Skip checking loaded assemblies for types tagged with the SQLiteFunction attribute when the No_SQLiteFunctions environment variable is set. Pursuant to [e4c8121f7b].</li>
    <li>Add HexPassword connection string property to work around the inability to include a literal semicolon in a connection string property value. Pursuant to [1c456ae75f].</li>
    <li>Add static Execute method to the SQLiteCommand class.</li>
    <li>Support custom connection pool implementations by adding the ISQLiteConnectionPool interface, the static SQLiteConnection.ConnectionPool property, and the static CreateHandle method in addition to modifying the SQLiteConnectionPool class. Pursuant to [393d954be0].</li>
    <li>Add public constructor to the SQLiteDataAdapter class that allows passing the parseViaFramework parameter to the SQLiteConnection constructor.</li>
    <li>When built with the CHECK_STATE compile-time option, skip throwing exceptions from the SQLiteDataReader class when the object is being disposed.</li>
    <li>Support automatic value conversions for columns with a declared type of BIGUINT, INTEGER8, INTEGER16, INTEGER32, INTEGER64, SMALLUINT, TINYSINT, UNSIGNEDINTEGER, UNSIGNEDINTEGER8, UNSIGNEDINTEGER16, UNSIGNEDINTEGER32, UNSIGNEDINTEGER64, INT8, INT16, INT32, INT64, UINT, UINT8, UINT16, UINT32, UINT64, or ULONG.</li>
    <li>Add BindUInt32AsInt64 connection flag to force binding of UInt32 values as Int64 instead. Pursuant to [c010fa6584].</li>
    <li>Add BindAllAsText and GetAllAsText connection flags to force binding and returning of all values as text.</li>
    <li>Remove AUTOINCREMENT from the column type name map.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Avoid throwing overflow exceptions from the SQLite3.GetValue method for integral column types. Partial fix for [c010fa6584].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Use the legacy connection closing algorithm when built with the INTEROP_LEGACY_CLOSE compile-time option.</li>
    <li>Support using the directory containing the primary managed-only assembly as the basis for native library pre-loading.</li>
    <li>Still further enhancements to the build and test automation.</li>
</ul>
<p>
    <b>1.0.84.0 - January 9, 2013</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_7_15_2.html|SQLite 3.7.15.2].</li>
    <li>Explicitly dispose of all SQLiteCommand objects managed by the DbDataAdapter class. Fix for [6434e23a0f].</li>
    <li>Add Cancel method to the SQLiteConnection class to interrupt a long running query.</li>
    <li>Improve thread safety of the SQLiteLog.LogMessage method.</li>
</ul>
<p>
    <b>1.0.83.0 - December 29, 2012</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_7_15_1.html|SQLite 3.7.15.1].</li>
    <li>Add Visual Studio 2012 support to all the applicable solution/project files, their associated supporting files, and the test suite.</li>
    <li>Add Visual Studio 2012 support to the redesigned designer support installer.</li>
    <li>Allow opened connections to skip adding the extension functions included in the interop assembly via the new NoExtensionFunctions connection flag.</li>
    <li>Support loading of SQLite extensions via the new EnableExtensions and LoadExtension methods of the SQLiteConnection class. Pursuant to [17045010df].</li>
    <li>Remove one set of surrounding single or double quotes from property names and values parsed from the connection string. Fix for [b4cc611998].</li>
    <li>Modify parsing of connection strings to allow property names and values to be quoted.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add ParseViaFramework property to the SQLiteConnection class to allow the built-in (i.e. framework provided) connection string parser to be used when opening a connection. Pursuant to [b4cc611998].</li>
    <li>Add notifications before and after any connection is opened and closed, as well as other related notifications, via the new static Changed event.</li>
    <li>Add an overload of the SQLiteLog.LogMessage method that takes a single string parameter.</li>
    <li>Add an overload of the SQLiteConnection.LogMessage method that takes a SQLiteErrorCode parameter.</li>
    <li>All applicable calls into the SQLite core library now return a SQLiteErrorCode instead of an integer error code.</li>
    <li>Make sure the error code of the SQLiteException class gets serialized.</li>
    <li>Make the test project for the .NET Compact Framework more flexible.</li>
    <li>When available, the new sqlite3_errstr function from the core library is used to get the error message for a specific return code.</li>
    <li>The SetMemoryStatus, Shutdown, ResultCode, ExtendedResultCode, and SetAvRetry methods of the SQLiteConnection class now return a SQLiteErrorCode instead of an integer error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The public constructor for the SQLiteException now takes a SQLiteErrorCode instead of an integer error code.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The ErrorCode property of the SQLiteException is now an Int32, to allow the property inherited from the base class to be properly overridden.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The ErrorCode field of the LogEventArgs is now an object instead of an integer.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>The names and messages associated with the SQLiteErrorCode enumeration values have been normalized to match those in the SQLite core library.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Implement more robust locking semantics for the CriticalHandle derived classes when compiled for the .NET Compact Framework.</li>
    <li>Cache column indexes as they are looked up when using the SQLiteDataReader to improve performance.</li>
    <li>Prevent the SQLiteConnection.Close method from throwing non-fatal exceptions during its disposal.</li>
    <li>Rename the interop assembly functions sqlite3_cursor_rowid, sqlite3_context_collcompare, sqlite3_context_collseq, sqlite3_cursor_rowid, and sqlite3_table_cursor to include an &quot;_interop&quot; suffix.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Prevent the LastInsertRowId, MemoryUsed, and MemoryHighwater connection properties from throwing NotSupportedException when running on the .NET Compact Framework. Fix for [dd45aba387].</li>
    <li>Improve automatic detection of the sqlite3_close_v2 function when compiled to use the standard SQLite library.</li>
    <li>Add protection against ThreadAbortException asynchronously interrupting native resource initialization and finalization.</li>
    <li>Add native logging callback for use with the sqlite3_log function to the interop assembly, enabled via the INTEROP_LOG preprocessor definition.</li>
    <li>Add various diagnostic messages to the interop assembly, enabled via flags in the INTEROP_DEBUG preprocessor definition.</li>
    <li>Further enhancements to the build and test automation.</li>
    <li>Add test automation for the Windows CE binaries.</li>
</ul>
<p>
    <b>1.0.82.0 - September 3, 2012</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_7_14.html|SQLite 3.7.14].</li>
    <li>Properly handle quoted data source values in the connection string. Fix for [8c3bee31c8].</li>
    <li>The [https://www.nuget.org/packages/System.Data.SQLite|primary NuGet package] now supports x86 / x64 and the .NET Framework 2.0 / 4.0 (i.e. in a single package).</li>
    <li>Change the default value for the Synchronous connection string property to Full to match the default used by the SQLite core library itself.&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Add the ability to skip applying default connection settings to opened databases via the new SetDefaults connection string property.</li>
    <li>Add the ability to skip expanding data source file names to their fully qualified paths via the new ToFullPath connection string property.</li>
    <li>Fix the database cleanup ordering in the tests for ticket [343d392b51].</li>
    <li>Add support for the sqlite3_close_v2 function from the SQLite core library.</li>
    <li>Add support for [https://www.sqlite.org/uri.html|URI file names] via the new FullUri connection string property.</li>
    <li>Improve support for the standard SQLite core library in the LINQ assembly and the test suite.</li>
    <li>Add SetMemoryStatus static method to the SQLiteConnection class.</li>
    <li>Improve threaded handling of the delegate used by the SQLiteLog class.</li>
    <li>Add define constants to support enabling or disabling individual groups of trace statements.</li>
</ul>
<p>
    <b>1.0.81.0 - May 27, 2012</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_7_12_1.html|SQLite 3.7.12.1].</li>
    <li>Support compiling the interop assembly without support for the custom extension functions and the CryptoAPI-based (RC4) codec.</li>
    <li>Add DefineConstants property to the SQLiteConnection class to return the list of define constants used when compiling the core managed assembly.</li>
    <li>Add release archive verification tool to the release automation.</li>
    <li>Fix NullReferenceException when calling the SQLiteDataAdapter.FillSchema method on a query that returns multiple result sets. Fix for [3aa50d8413].</li>
    <li>Fix subtle race condition between threads fetching connection handles from the connection pool and any garbage collection (GC) threads that may be running. Fix for [996d13cd87].</li>
    <li>Add missing call to SetTimeout in the SQLite3_UTF16.Open method.</li>
    <li>Add checks to prevent the SQLiteConnectionPool.Remove method from returning any connection handles that are closed or invalid.</li>
    <li>Modify static SQLiteBase helper methods to prevent them from passing IntPtr.Zero to the SQLite native library.</li>
    <li>Remove static locks from the static helper methods in the SQLiteBase class, replacing them with a lock on the connection handle instance being operated upon.</li>
    <li>Revise CriticalHandle derived classes to make them more thread-safe.</li>
    <li>Add connection pool related diagnostic messages when compiled with the DEBUG define constant.</li>
    <li>Add PoolCount property to the SQLiteConnection class to return the number of pool entries for the file name associated with the connection.</li>
    <li>Rename internal SQLiteLastError methods to GetLastError.</li>
    <li>Add assembly file test constraints to all tests that execute the &quot;test.exe&quot; or &quot;testlinq.exe&quot; files.</li>
</ul>
<p>
    <b>1.0.80.0 - April 1, 2012</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_7_11.html|SQLite 3.7.11].</li>
    <li>In the SQLiteFunction class, when calling user-provided methods from a delegate called by native code, avoid throwing exceptions, optionally tracing the caught exceptions. Fix for [8a426d12eb].</li>
    <li>Add Visual Studio 2005 support to all the applicable solution/project files, their associated supporting files, and the test suite.</li>
    <li>Add Visual Studio 2005 support to the redesigned designer support installer.</li>
    <li>Add experimental support for &quot;pre-loading&quot; the native SQLite library based on the processor architecture of the current process. This feature is now enabled by default at compile-time.</li>
    <li>Add support for the native [https://www.sqlite.org/backup.html|SQLite Online Backup API]. Fix for [c71846ed57].</li>
    <li>Acquire and hold a static data lock while checking if the native SQLite library has been initialized to prevent a subtle race condition that can result in superfluous error messages. Fix for [72905c9a77].</li>
    <li>Support tracing of all parameter binding activity and use the connection flags to control what is traced.</li>
    <li>When converting a DateTime instance of an &quot;Unspecified&quot; kind to a string, use the same kind as the connection, if available.</li>
    <li>Add overload of the SQLiteDataReader.GetValues method that returns a NameValueCollection.</li>
    <li>Add static ToUnixEpoch method to the SQLiteConvert class to convert a DateTime value to the number of whole seconds since the Unix epoch.</li>
    <li>In the implicit conversion operators (to IntPtr) for both the SQLiteConnectionHandle and SQLiteStatementHandle classes, return IntPtr.Zero if the instance being converted is null.</li>
    <li>Write warning message to the active trace listeners (for the Debug build configuration only) if a column type or type name cannot be mapped properly. See [4bbf851fa5].</li>
    <li>When tracing SQL statements to be prepared, bypass the internal length limit of the sqlite3_log function by using the SQLiteLog class directly instead. Also, detect null and/or empty strings and emit a special message in that case.</li>
    <li>For the setup, the Visual Studio task should only be initially checked if the GAC task is available and vice-versa.</li>
    <li>Improve compatibility with custom command processors by using __ECHO instead of _ECHO in batch tools.</li>
    <li>Add OpenAndReturn method to the SQLiteConnection class to open a connection and return it.</li>
    <li>Add missing CheckDisposed calls to the SQLiteConnection class.</li>
    <li>Add missing throw statement to the SQLiteConnection class.</li>
    <li>Make sure the interop project uses /fp:precise for Windows CE.</li>
    <li>Regenerate package load key to support loading the designer package into Visual Studio 2008 without having the matching SDK installed.</li>
    <li>Modify transaction object disposal so that it can never cause an exception to be thrown.</li>
</ul>
<p>
    <b>1.0.79.0 - January 28, 2012</b>
</p>
<ul>
    <li>Use the WoW64 registry keys when installing the VS designer components on 64-bit Windows. Fix for [d8491abd0b].</li>
    <li>Correct resource name used by the LINQ assembly to locate several key string resources. Fix for [fbebb30da9].</li>
</ul>
<p>
    <b>1.0.78.0 - January 27, 2012</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_7_10.html|SQLite 3.7.10]
    <li>Redesign the VS designer support installer and integrate it into the setup packages.</li>
    <li>When emitting SQL for foreign keys in the VS designer, be sure to take all returned schema rows into account. Remainder of fix for [b226147b37].</li>
    <li>Add Flags connection string property to control extra behavioral flags for the connection.</li>
    <li>Refactor all IDisposable implementations to conform to best practices, potentially eliminating leaks in certain circumstances.</li>
    <li>Even more enhancements to the build and test automation.</li>
    <li>Support parameter binding to more primitive types, including unsigned integer types.</li>
    <li>Recognize the TIMESTAMP column data type as the DateTime type. Fix for [bb4b04d457].</li>
    <li>Prevent logging superfluous messages having to do with library initialization checking. Fix for [3fc172d1be].</li>
    <li>Support the DateTimeKind and BaseSchemaName connection string properties in the SQLiteConnectionStringBuilder class. Fix for [f3ec1e0066].</li>
    <li>Overloads of the SQLiteConvert.ToDateTime and SQLiteConvert.ToJulianDay methods that do not require an instance should be static. Partial fix for [4bbf851fa5].&nbsp;<b>** Potentially Incompatible Change **</b></li>
</ul>
<p>
    <b>1.0.77.0 - November 28, 2011</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_7_9.html|SQLite 3.7.9]
    <li>More enhancements to the build and test automation.</li>
    <li>Plug native memory leak when closing a database connection containing a statement that cannot be finalized for some reason.</li>
    <li>The SQLite3 class should always attempt to dispose the contained SQLiteConnectionHandle, even when called via the finalizer.</li>
    <li>When compiled with DEBUG defined, emit diagnostic information related to resource cleanup to any TraceListener objects that may be registered.</li>
    <li>Stop characterizing all log messages as errors. From now on, if the errorCode is zero, the message will not be considered an error.</li>
    <li>Never attempt to configure the native logging interface if the SQLite core library has already been initialized for the process. Fix for [2ce0870fad].</li>
    <li>Allow the SQLiteLog class to be used for logging messages without having an open connection.</li>
    <li>Support building the core System.Data.SQLite assemblies using the .NET Framework 4.0 Client Profile. Fix for [566f1ad1e4].</li>
    <li>When generating the schema based on the contents of a SQLiteDataReader, skip flagging columns as unique if the data reader is holding the result of some kind of multi-table construct (e.g. a cross join) because we must allow duplicate values in that case. Fix for [7e3fa93744].</li>
    <li>When returning schema information that may be used by the .NET Framework to construct dynamic SQL, use a fake schema name (instead of null) so that the table names will be properly qualified with the catalog name (i.e. the attached database name). Partial fix for [343d392b51].</li>
    <li>Add SQLiteSourceId property to the SQLiteConnection class to return the SQLite source identifier.</li>
    <li>Add MemoryUsed and MemoryHighwater properties to the SQLiteConnection class to help determine the memory usage of SQLite.</li>
    <li>Add DateTimeKind connection string property to control the DateTimeKind of parsed DateTime values. Partial fix for [343d392b51].&nbsp;<b>** Potentially Incompatible Change **</b></li>
    <li>Improve the robustness of the SQLiteLog class when it will be initialized and unloaded multiple times.</li>
    <li>Fix the name of the interop assembly for Windows CE. Add unit tests to prevent this type of issue from happening again. Fix for [737ca4ff74].</li>
    <li>Formally support the SQL type name BOOLEAN in addition to BOOL. Fix for [544dba0a2f].</li>
    <li>Make sure the SQLiteConvert.TypeNameToDbType method is thread-safe. Fix for [84718e79fa].</li>
</ul>
<p>
    <b>1.0.76.0 - October 4, 2011</b>
</p>
<ul>
    <li>Prevent the domain unload event handler in SQLiteLog from being registered multiple times. Fix for [0d5b1ef362].</li>
    <li>Stop allowing non-default application domains to initialize the SQLiteLog class. Fix for [ac47dd230a].</li>
</ul>
<p>
    <b>1.0.75.0 - October 3, 2011</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_7_8.html|SQLite 3.7.8]
    <li>More enhancements to the build system.</li>
    <li>Add official [https://www.nuget.org/|NuGet] packages for x86 and x64.</li>
    <li>Add Changes and LastInsertRowId properties to the connection class.</li>
    <li>Support more formats when converting data from/to the DateTime type.</li>
    <li>Make all the assembly versioning attributes consistent.</li>
    <li>Add unit testing infrastructure using [https://eagle.to/|Eagle].</li>
    <li>Integrate all legacy unit tests, including the &quot;testlinq&quot; project, into the new test suite.</li>
    <li>Add projects to build the interop assembly statically linked to the Visual C++ runtime. Fix for [53f0c5cbf6].</li>
    <li>Add SQLITE_ENABLE_STAT2 compile-time option to the interop assembly. Fix for [74807fbf27].</li>
    <li>Fix mutex issues exposed when running the test suite with the debug version of SQLite.</li>
    <li>Fix transaction enlistment when repeated attempts are made to enlist in the same transaction. Fix for [ccfa69fc32].</li>
    <li>Support the SQLITE_FCNTL_WIN32_AV_RETRY file control to mitigate the impact of file sharing violations caused by external processes.</li>
    <li>Refactor the logging interface to be thread-safe and self-initializing.</li>
    <li>Shutdown the SQLite native interface when the AppDomain is being unloaded. Fix for [b4a7ddc83f].</li>
    <li>Support Skip operation for LINQ using OFFSET. Fix for [8b7d179c3c].</li>
    <li>Support EndsWith operation for LINQ using SUBSTR. Fix for [59edc1018b].</li>
    <li>Support all SQLite journal modes. Fix for [448d663d11].</li>
    <li>Do not throw exceptions when disposing SQLiteDataReader. Fix for [e1b2e0f769].</li>
    <li>The REAL type should be mapped to System.Double. Fix for [2c630bffa7] and [b0a5990f48].</li>
    <li>Minor optimization to GetParamValueBytes(). Fix for [201128cc88].</li>
    <li>Support the ON UPDATE, ON DELETE, and MATCH clause information when generating schema metadata for foreign keys. Partial fix for [b226147b37]. VS designer changes are not yet tested.</li>
    <li>Fix incorrect resource name for SR.resx in the mixed-mode assembly.</li>
    <li>Reduce the number of String.Compare() calls in the hot path for SQLiteCommand.ExecuteReader().</li>
</ul>
<p>
    <b>1.0.74.0 - July 4, 2011</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_7_7_1.html|SQLite 3.7.7.1]
    <li>Fix incorrect hard-coded .NET Framework version information SQLiteFactory_Linq.cs that was causing IServiceProvider.GetService to fail when running against the .NET Framework 3.5.</li>
    <li>Fix all XML documentation warnings.</li>
    <li>Restore support for the mixed-mode assembly (i.e. the one that can be registered in the Global Assembly Cache).</li>
    <li>Restore support for the Compact Framework.</li>
    <li>Remove unused &quot;using&quot; statements from the System.Data.SQLite and System.Data.SQLite.Linq projects.</li>
    <li>Remove hard-coded System.Data.SQLite.Linq version from SQLiteFactory_Linq.cs</li>
    <li>Modify the setup to support bundled packages (i.e. with the mixed-mode assembly) and standard packages (i.e. with the managed assembly separate from the native interop library).</li>
    <li>Disable the ability to register with the Global Assembly Cache in the standard setup package (i.e. it is available in the bundled setup only).</li>
    <li>Remove PATH modification from the setup.</li>
    <li>Modify the naming scheme for the source, setup, and binary packages to allow for the necessary variants.</li>
    <li>In the build automation, attempt to automatically detect if Visual Studio 2008 and/or 2010 are installed and support building binaries for both at once, when available.</li>
    <li>Add release automation to build the source, setup, and binary packages in all supported build variants.</li>
    <li>Add the testlinq project to the new build system and make it work properly with Visual Studio 2008 and 2010.</li>
</ul>
<p>
    <b>1.0.73.0 - June 2, 2011</b>
</p>
<ul>
    <li>Updated to [https://www.sqlite.org/releaselog/3_7_6_3.html|SQLite 3.7.6.3].</li>
    <li>Minor optimization to GetBytes(). Fix for [8c1650482e].</li>
    <li>Update various assembly information settings.</li>
    <li>Correct System.Data.SQLite.Linq version and resource information. Fix for [6489c5a396] and [133daf50d6].</li>
    <li>Moved log handler from SQLiteConnection object to SQLiteFactory object to prevent if from being prematurely GCed.</li>
    <li>We should block x64 installs on x86 and we should install native only if the setup package itself is native. Fix for [e058ce156e].</li>
</ul>
<p>
    <b>1.0.72.0 - May 1, 2011</b>
</p>
<ul>
    <li>Add the correct directory to the path. Fix for [50515a0c8e].</li>
</ul>
<p>
    <b>1.0.71.0 - April 27, 2011</b>
</p>
<ul>
    <li>Updated to SQLite 3.7.6+ [https://www.sqlite.org/src/info/1bd1484cd7 | &#91;1bd1484cd7&#93;] to get additional Windows error logging.</li>
    <li>Updated setup to optionally add install directory to PATH if GAC option selected.</li>
</ul>
<p>
    <b>1.0.70.0 - April 22, 2011</b>
</p>
<ul>
    <li>Added support for sqlite3_extended_result_codes(), sqlite3_errcode(), and sqlite3_extended_errcode() via SetExtendedResultCodes(), ResultCode(), and ExtendedResultCode().</li>
    <li>Added support for SQLITE_CONFIG_LOG via SQLiteLogEventHandler().</li>
</ul>
<p>
    <b>1.0.69.0 - April 12, 2011</b>
</p>
<ul>
    <li>Code merge with [https://www.sqlite.org/releaselog/3_7_6.html | SQLite 3.7.6].</li>
    <li>New VS2008 and VS2010 solution files.</li>
    <li>Build and packaging automation.</li>
    <li>New Inno Setup files.</li>
    <li>Designer support currently not ready for release.</li>
</ul>
<p>
    <b>1.0.68.0 - February 2011</b>
</p>
<ul>
    <li>Code merge with [https://www.sqlite.org/releaselog/3_7_5.html | SQLite 3.7.5].</li>
    <li>Continuing work on supporting Visual Studio 2010.</li>
</ul>
<p>
    <b>1.0.67.0 - January 3, 2011</b>
</p>
<ul>
    <li>Code merge with [https://www.sqlite.org/releaselog/3_7_4.html | SQLite 3.7.4].</li>
    <li>Continuing work on supporting Visual Studio 2010.</li>
</ul>

Added www/release.wiki.

























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
<title>Release Procedures</title>

<a name="releaseProcedures"></a>
<h2>Release Procedures</h2>

<p>
  Follow these steps to prepare a new release of System.Data.SQLite.
  Unless otherwise noted, all steps need to be done in the order specified.
</p>

<a name="buildBinaries"></a>
<h2>Build Windows x86 &amp; x64 Binaries</h2>

<ol>
  <li>
    The binaries for all supported architectures and platforms must be built
    using procedures very similar to those documented in the normal
    [./build.wiki | build procedures].
  </li>

  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Enter the following commands to build all the x86 and x64 binaries:
    <br />
    <br />
    <b>SET LOGDIR=%ROOT%\Setup\Output</b>
    <br />
    <b>IF NOT EXIST &quot;%LOGDIR%&quot; MKDIR &quot;%LOGDIR%&quot;</b>
    <br />
    <br />
    <b>SET BUILD_FULL=1</b>
    <br />
    <b>SET BUILD_DEBUG=1</b>
    <br />
    <b>CALL build_all.bat</b>
    <br />
    <br />
    <b>REM Copy 2015 core library interop assembly to .NET Standard 2.0...</b>
    <br />
    <b>REM Must be present for .NET Standard 2.0 release step, processor architecture is irrelevant.</b>
    <br />
    <b>XCOPY ..\bin\2015\Win32\DebugNativeOnlyStatic\SQLite.Interop.* ..\bin\NetStandard20\DebugNetStandard20\bin\netstandard2.0 /V /I /F /Y</b>
    <br />
    <b>XCOPY ..\bin\2015\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.* ..\bin\NetStandard20\ReleaseNetStandard20\bin\netstandard2.0 /V /I /F /Y</b>
    <br />
    <br />
    <b>REM Copy 2015 core library interop assembly to .NET Standard 2.1...</b>
    <br />
    <b>REM Must be present for .NET Standard 2.1 release step, processor architecture is irrelevant.</b>
    <br />
    <b>XCOPY ..\bin\2015\Win32\DebugNativeOnlyStatic\SQLite.Interop.* ..\bin\NetStandard21\DebugNetStandard21\bin\netstandard2.1 /V /I /F /Y</b>
    <br />
    <b>XCOPY ..\bin\2015\Win32\ReleaseNativeOnlyStatic\SQLite.Interop.* ..\bin\NetStandard21\ReleaseNetStandard21\bin\netstandard2.1 /V /I /F /Y</b>
  </li>

  <li>
    Make sure everything succeeds with no errors; the console output may be
    checked if any errors should occur.
  </li>
</ol>

<a name="testBinaries"></a>
<h2>Test Windows x86 &amp; x64 Binaries</h2>

<ol>
  <li>
    The binaries for all supported architectures and platforms must be tested
    using procedures very similar to those documented in the normal
    [./test.wiki | test procedures].
  </li>

  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Enter the following commands to test all the x86 or x64 binaries, depending
    on the processor architecture of the current machine:
    <br />
    <br />
    <b>SET TEST_DEBUG=1</b>
    <br />
    <b>CALL test_all.bat</b>
  </li>

  <li>
    Make sure everything succeeds with no errors; the console output may be
    checked if any errors should occur.
  </li>

  <li>
    Locate a machine with a processor architecture different from the one tested
    in the previous step and then repeat all the previous steps.
  </li>
</ol>

<a name="buildCeBinaries"></a>
<h2>Build Windows CE Binaries</h2>

<ol>
  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Enter the following commands to build all the binaries available for Windows
    CE:
    <br />
    <br />
    <b>SET BUILD_FULL=1</b>
    <br />
    <b>SET BUILD_DEBUG=1</b>
    <br />
    <b>CALL build_ce_200x.bat</b>
    <br />
    <br />
    <i>This assumes that Visual Studio 2005 and/or Visual Studio 2008,
    &quot;<b>Professional</b>&quot; edition or &quot;better&quot; and the
    bundled Pocket PC 2003 SDK are installed.</i>
  </li>

  <li>
    Enter the following commands to build all the binaries available for Windows
    Embedded Compact 2013:
    <br />
    <br />
    <b>SET BUILD_FULL=1</b>
    <br />
    <b>SET BUILD_DEBUG=1</b>
    <br />
    <b>CALL build_ce_2013.bat</b>
    <br />
    <br />
    <i>This assumes that Visual Studio 2012, &quot;<b>Professional</b>&quot;
    edition or &quot;better&quot; and the Windows Embedded Compact 2013 Toolkit
    are installed.</i>
  </li>

  <li>
    Make sure everything succeeds with no errors; the console output may be
    checked if any errors should occur.
  </li>
</ol>

<a name="testCeBinariesAutomated"></a>
<h2>Test Windows CE Binaries via Automation</h2>

<ol>
  <li>
    Instead of testing the Windows CE binaries
    <a href="#testCeBinariesManually">manually</a> as described in the next
    section, the following steps may be used.
  </li>

  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Enter the following commands to test all the binaries available for Windows
    CE:
    <br />
    <br />
    <b>SET TEST_DEBUG=1</b>
    <br />
    <b>CALL test_ce_200x.bat</b>
  </li>

  <li>
    Make sure everything succeeds with no errors; the console output may be
    checked if any errors should occur.
  </li>
</ol>

<a name="testCeBinariesManually"></a>
<h2>Test Windows CE Binaries Manually</h2>

<ol>
  <li>
    If the Windows CE binaries were already tested using the
    <a href="#testCeBinariesAutomated">automation</a> described in the previous
    section, skip this section.
  </li>

  <li>
    Launch <b>Visual Studio 2005</b>, &quot;<b>Professional</b>&quot; edition or
    &quot;better&quot; with the bundled Pocket PC 2003 SDK. As of this writing,
    in January 2012, <b>Visual Studio 2010 and later will not work</b> as they
    do not include the necessary built-in support for Windows CE and the .NET
    Compact Framework.
  </li>

  <li>
    Open the &quot;<b>SQLite.NET.2008.sln</b>&quot; solution file in the
    &quot;&lt;root&gt;&quot; directory.
  </li>

  <li>
    Change the active solution configuration to &quot;<b>Debug</b>&quot;.
  </li>

  <li>
    Change the active solution platform to &quot;<b>Pocket PC 2003
    (ARMV4)</b>&quot;.
  </li>

  <li>
    Right-click the &quot;<b>testce</b>&quot; project in the Solution Explorer
    window and select &quot;<b>Set as StartUp Project</b>&quot;.
  </li>

  <li>
    Select &quot;<b>Start Debugging</b>&quot; from the &quot;<b>Debug</b>&quot;
    menu.
  </li>

  <li>
    If any rebuild prompts appear (e.g. &quot;<b>SQLite.Interop.CE.2008</b>&quot;,
    &quot;<b>Would you like to build it?</b>&quot;), select &quot;<b>Yes</b>&quot;.
  </li>

  <li>
    When prompted for the device type to deploy the application to, select the
    &quot;<b>Pocket PC 2003 SE Emulator</b>&quot; device.
  </li>

  <li>
    Make sure all that the tests pass (i.e. they emit &quot;<b>SUCCESS</b>&quot;).
  </li>
</ol>

<a name="buildMonoBinaries"></a>
<h2>Build Mono Binaries</h2>

<ol>
  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Enter the following commands to build all the binaries available for Mono:
    <br />
    <br />
    <b>SET BUILD_FULL=</b>
    <br />
    <b>SET BUILD_DEBUG=1</b>
    <br />
    <b>CALL build_mono.bat</b>
  </li>

  <li>
    Make sure everything succeeds with no errors; the console output may be
    checked if any errors should occur.
  </li>
</ol>

<a name="testNetStandard20Binaries"></a>
<h2>Test .NET Standard 2.0 Binaries</h2>

<ol>
  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Enter the following commands to test all the binaries available for .NET
    Standard 2.0:
    <br />
    <br />
    <b>SET TEST_DEBUG=1</b>
    <br />
    <b>CALL test_net_core_20.bat</b>
  </li>

  <li>
    Make sure everything succeeds with no errors; the console output may be
    checked if any errors should occur.
  </li>
</ol>

<a name="testNetStandard21Binaries"></a>
<h2>Test .NET Standard 2.1 Binaries</h2>

<ol>
  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Enter the following commands to test all the binaries available for .NET
    Standard 2.1:
    <br />
    <br />
    <b>SET TEST_DEBUG=1</b>
    <br />
    <b>CALL test_net_core_30.bat</b>
  </li>

  <li>
    Make sure everything succeeds with no errors; the console output may be
    checked if any errors should occur.
  </li>
</ol>

<a name="updateDocumentation"></a>
<h2>Update Documentation</h2>

<ol>
  <li>
    Update the &quot;&lt;root&gt;\readme.htm&quot; file with information about
    all the major changes since the last released version.
  </li>

  <li>
    Copy those changes to the
    &quot;&lt;root&gt;\Doc\Extra\Provider\version.html&quot; and
    &quot;&lt;root&gt;\www\news.wiki&quot; files, reformatting as necessary
    to fit with the existing document conventions.
  </li>

  <li>Change the current directory to &quot;&lt;root&gt;\Doc&quot;.</li>

  <li>
    Enter the following command to update all documentation that is
    included from upstream (e.g. from the SQLite core library, etc):
    <br />
    <br />
    <b>..\Externals\Eagle\bin\netFramework40\EagleShell.exe -file sync.eagle --verbose</b>
  </li>

  <li>
    Enter the following command to update the embedded SQLite core library
    virtual table documentation:
    <br />
    <br />
    <b>tclsh.exe vtab.tcl</b>
    <br />
    <br />
    <i>This assumes that [https://www.activestate.com/activetcl | ActiveTcl]
    version 8.4 or later has been installed using the default settings.</i>
  </li>

  <li>
    Make sure everything downloads with no errors; the console output may be
    checked if any errors should occur.
  </li>
</ol>

<a name="buildDocumentation"></a>
<h2>Build Documentation</h2>

<ol>
  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Doc&quot;.</li>

  <li>
    Enter the following command to build all the documentation in
    [https://en.wikipedia.org/wiki/Microsoft_Compiled_HTML_Help | CHM]
    format:
    <br />
    <br />
    <b>tclsh.exe buildChm.tcl</b>
    <br />
    <br />
    <i>This assumes that [https://www.activestate.com/activetcl | ActiveTcl]
    version 8.4 or later, the
    [https://www.microsoft.com/download/en/details.aspx?displaylang=en&id=21138 | HTML Help Workshop],
    and [https://sourceforge.net/projects/ndoc3/ | NDoc3] have all been installed using
    the default settings.</i>
  </li>

  <li>
    Make sure everything succeeds with no errors; the console output may be
    checked if any errors should occur.
  </li>
</ol>

<a name="buildSetupPackages"></a>
<h2>Build Setup Release Packages</h2>

<ol>
  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Enter the following commands to build all the setup packages for x86 and x64:
    <br />
    <br />
    <b>SET BAKE_DEBUG=1</b>
    <br />
    <b>CALL bake_all.bat</b>
  </li>

  <li>
    Make sure everything succeeds with no errors; the console output may be
    checked if any errors should occur.
  </li>
</ol>

<a name="buildBinaryPackages"></a>
<h2>Build Windows x86 &amp; x64 Binary Release Packages</h2>

<ol>
  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Enter the following commands to build all the binary release packages for x86
    and x64:
    <br />
    <br />
    <b>SET RELEASE_DEBUG=1</b>
    <br />
    <b>CALL release_all.bat</b>
  </li>

  <li>
    Make sure everything succeeds with no errors; the console output may be
    checked if any errors should occur.
  </li>
</ol>

<a name="buildStaticBinaryPackages"></a>
<h2>Build Windows x86 &amp; x64 Static Binary Release Packages</h2>

<ol>
  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Enter the following commands to build all the static binary release packages
    for x86 and x64:
    <br />
    <br />
    <b>SET RELEASE_DEBUG=1</b>
    <br />
    <b>CALL release_static.bat</b>
  </li>

  <li>
    Make sure everything succeeds with no errors; the console output may be
    checked if any errors should occur.
  </li>
</ol>

<a name="buildCeBinaryPackages"></a>
<h2>Build Windows CE Binary Release Packages</h2>

<ol>
  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Enter the following commands to build all the binary release packages for
    Windows CE:
    <br />
    <br />
    <b>SET RELEASE_DEBUG=1</b>
    <br />
    <b>CALL release_ce_200x.bat</b>
  </li>

  <li>
    Enter the following commands to build all the binary release packages for
    Windows Embedded Compact 2013:
    <br />
    <br />
    <b>SET RELEASE_DEBUG=1</b>
    <br />
    <b>CALL release_ce_2013.bat</b>
  </li>

  <li>
    Make sure everything succeeds with no errors; the console output may be
    checked if any errors should occur.
  </li>
</ol>

<a name="buildMonoBinaryPackages"></a>
<h2>Build Mono Release Packages</h2>

<ol>
  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Enter the following commands to build all the Mono release packages:
    <br />
    <br />
    <b>SET RELEASE_DEBUG=1</b>
    <br />
    <b>CALL release_mono.bat</b>
  </li>

  <li>
    Make sure everything succeeds with no errors; the console output may be
    checked if any errors should occur.
  </li>
</ol>

<a name="buildNetStandard20BinaryPackages"></a>
<h2>Build .NET Standard 2.0 Release Packages</h2>

<ol>
  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Enter the following commands to build all the .NET Standard 2.0 release
    packages:
    <br />
    <br />
    <b>SET RELEASE_DEBUG=1</b>
    <br />
    <b>CALL release_net_standard_20.bat</b>
  </li>

  <li>
    Make sure everything succeeds with no errors; the console output may be
    checked if any errors should occur.
  </li>
</ol>

<a name="buildNetStandard21BinaryPackages"></a>
<h2>Build .NET Standard 2.1 Release Packages</h2>

<ol>
  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Enter the following commands to build all the .NET Standard 2.1 release
    packages:
    <br />
    <br />
    <b>SET RELEASE_DEBUG=1</b>
    <br />
    <b>CALL release_net_standard_21.bat</b>
  </li>

  <li>
    Make sure everything succeeds with no errors; the console output may be
    checked if any errors should occur.
  </li>
</ol>

<a name="buildSourcePackages"></a>
<h2>Build Source Release Packages</h2>

<ol>
  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Enter the following commands to build the &quot;standard&quot; source
    release package:
    <br />
    <br />
    <b>SET ARCHIVE_FULL=</b>
    <br />
    <b>CALL archive.bat</b>
  </li>

  <li>
    Enter the following commands to build the &quot;full&quot; source
    release package:
    <br />
    <br />
    <b>SET ARCHIVE_FULL=1</b>
    <br />
    <b>CALL archive.bat</b>
  </li>

  <li>
    Make sure everything succeeds with no errors; the console output may be
    checked if any errors should occur.
  </li>
</ol>

<a name="buildNuGetPackages"></a>
<h2>Build NuGet Packages</h2>

<ol>
  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Enter the following command to build all the NuGet packages:
    <br />
    <br />
    <b>SET NO_NUGET_XPLATFORM=1</b>
    <br />
    <b>SET NUGET_LEGACY_ONLY=1</b>
    <br />
    <b>CALL build_nuget.bat</b>
    <br />
    <br />
    <i>This assumes that the NuGet binary is available somewhere along the
    [https://en.wikipedia.org/wiki/PATH_%28variable%29 | PATH].<br />Please refer
    to [https://docs.nuget.org/ | NuGet Documentation] for further details.</i>
  </li>

  <li>
    Make sure everything succeeds with no errors; the console output may be
    checked if any errors should occur.
  </li>
</ol>

<a name="verifyAllPackages"></a>
<h2>Verify All Release Packages</h2>

<ol>
  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Enter the following command to build all the source release packages:
    <br />
    <br />
    <b>..\Externals\Eagle\bin\netFramework40\EagleShell.exe -file verify.eagle Output true</b>
    <br />
    <br />
    <i>This assumes that the <a href="https://www.fossil-scm.org/">Fossil</a>,
    <a href="https://sourceforge.net/projects/innounp/">Inno Setup Unpacker</a>,
    <a href="https://www.rarlab.com/">UnRAR</a>, and
    <a href="https://infozip.sourceforge.net/">UnZip</a> binaries are available in the
    locations specified via the &quot;FossilTool&quot;,
    &quot;InnoUnpackTool&quot;, &quot;UnRARTool&quot;, and &quot;UnZipTool&quot;
    environment variables, respectively.</i>
  </li>

  <li>
    Make sure everything succeeds with no errors; the console output may be
    checked if any errors should occur.
    <br />
    <br />
    <i>If errors are generated, the file
    &quot;&lt;root&gt;\Setup\data\verify.lst&quot; may need to be updated to
    account for the files that have been added and/or removed from the release
    archives since the previous release.</i>
  </li>
</ol>

<a name="updateDownloadsPage"></a>
<h2>Update Downloads Page</h2>

<ol>
  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;\Setup&quot;.</li>

  <li>
    Replace the version numbers for the previous release in the local working
    copy of the [./downloads.wiki | downloads page] with the new version numbers
    for System.Data.SQLite and the SQLite core.
  </li>

  <li>
    Enter the following command to update the sizes and hashes on the downloads
    page based on all the built release packages:
    <br />
    <br />
    <b>tclsh.exe updateFileInfo.tcl</b>
    <br />
    <br />
    <i>This assumes that [https://www.activestate.com/activetcl | ActiveTcl]
    version 8.4 or later has been installed using the default settings and that
    the Fossil binary is available somewhere along the
    [https://en.wikipedia.org/wiki/PATH_%28variable%29 | PATH] (i.e. for
    calculating the SHA1 hashes).</i>
  </li>

  <li>
    Make sure everything succeeds with no errors; the console output may be
    checked if any errors should occur.
  </li>
</ol>

<a name="publishRelease"></a>
<h2>Publish Release</h2>

<ol>
  <li>Upload all the release packages to the web site.</li>

  <li>
    Commit pending source code changes to the
    [https://www.fossil-scm.org/ | Fossil] repository.
  </li>

  <li>Tag the release in the Fossil repository.</li>

  <li>
    Push the [https://www.nuget.org/ | NuGet] packages.<br />
    <i>Please refer to [https://docs.nuget.org/ | NuGet Documentation] for
    further details.</i>
  </li>

  <li>
    Announce the release on the
    <a href="https://sqlite.org/forum/forum">SQLite Forum</a>.
  </li>
</ol>

Added www/source.wiki.













































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<title>Source Code</title>

<p>
  Follow these steps to obtain the latest (i.e. unreleased) source code for the
  System.Data.SQLite project.  To obtain the latest officially released source
  code instead, refer to the [./downloads.wiki | downloads page].  Unless
  otherwise noted, all steps need to be performed in the order specified.
</p>

<a name="assumptions"></a>
<h2>Assumptions &amp; Prerequisites</h2>

<p>
  The string &quot;<b>&lt;root&gt;</b>&quot; represents the directory where the
  local working copy of the source tree (a.k.a. the working check-out directory)
  for the System.Data.SQLite project is to reside.  This should be a completely
  empty directory.
</p>

<p>
  The string &quot;<b>&lt;repositories&gt;</b>&quot; represents the directory
  where the local clone of the repository for the System.Data.SQLite project
  (and potentially other projects) is to reside.
</p>

<a name="fossil"></a>
<h2>Obtain &amp; Install Fossil Itself</h2>

<p>
  The [https://www.fossil-scm.org | Fossil] open-source
  [https://en.wikipedia.org/wiki/Distributed_revision_control | distributed version control]
  system is a computer program that must be installed on your machine before you use it.
  Fortunately, installing Fossil is very easy.  Fossil consists of a single
  executable file that you simply download and run.  For convenience, the Fossil
  executable file should be placed in a directory present in your
  [https://en.wikipedia.org/wiki/PATH_%28variable%29 | PATH].  To uninstall
  Fossil, simply delete the executable file.
  [https://www.fossil-scm.org/index.html/doc/tip/www/quickstart.wiki | Detailed instructions]
  for installing and getting started with Fossil are available on the
  [https://www.fossil-scm.org/ | Fossil website].
</p>

<a name="clone"></a>
<h2>Clone Repository (Windows)</h2>

<ol>
  <li>Open a Windows command prompt using &quot;<b>cmd.exe</b>&quot;.</li>

  <li>
    Change the current directory to &quot;<b>&lt;root&gt;</b>&quot; using a
    command similar to:
    <br />
    <br />
    <b>CD /D &lt;root&gt;</b>
  </li>

  <li>
    Enter the following command to create a complete clone (i.e. local copy) of
    the entire source code repository for the System.Data.SQLite project,
    including the entire check-in history:
    <br />
    <br />
    <b>fossil [https://www.fossil-scm.org/index.html/help/clone | clone] https://system.data.sqlite.org/ &lt;repositories&gt;/sds.fossil</b>
  </li>

  <li>
    Please note that the repository itself uses an
    [https://www.fossil-scm.org/index.html/doc/trunk/www/fileformat.wiki | enduring file format]
    stored in a single
    [https://www.fossil-scm.org/index.html/doc/trunk/www/tech_overview.wiki | SQLite database file]
    with a particular schema.
  </li>

  <li>
    In this case, after executing the
    [https://www.fossil-scm.org/index.html/help/clone | clone] command, the local
    clone of the repository will be placed into the &quot;<b>sds.fossil</b>&quot;
    file in the <b>&lt;repositories&gt;</b> directory.
  </li>
</ol>

<a name="working"></a>
<h2>Working Copy (Windows)</h2>

<ol>
  <li>Open a Windows command prompt using &quot;<b>cmd.exe</b>&quot;.</li>

  <li>
    Change the current directory to &quot;<b>&lt;root&gt;</b>&quot; using a
    command similar to:
    <br />
    <br />
    <b>CD /D &lt;root&gt;</b>
  </li>

  <li>
    Enter the following command to create a local working copy of all the files
    that are currently part of the System.Data.SQLite project:
    <br />
    <br />
    <b>fossil [https://www.fossil-scm.org/index.html/help/open | open] &lt;repositories&gt;/sds.fossil</b>
  </li>

  <li>
    The local source tree should now be ready for use as described in the
    [./build.wiki | build procedures] and/or [./test.wiki | test procedures].
  </li>

  <li>
    In the future, to update the local working copy with the latest changes from
    the official System.Data.SQLite repository (i.e. instead of having to
    re-clone the entire thing), enter the following command from the same
    directory where the working copy is located:
    <br />
    <br />
    <b>fossil [https://www.fossil-scm.org/index.html/help/update | update]</b>
  </li>
</ol>

Added www/support.wiki.





















































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<title>Support</title>

<div align="center"><h2><b>Community Support Policies</b></h2></div>
<div align="center"><h3><b>Effective May 1, 2017</b></h3></div>
<div align="center"><h3><b>Updated May 22, 2021</b></h3></div>

<h4>Legacy CryptoAPI-based (RC4) Codec</h4>

<ul>
  <li>
    It is unsupported.
  </li>
  <li>
    It is disabled in all default build configurations.
  </li>
  <li>
    It may not be possible to build binaries with it enabled.
  </li>
</ul>

<h4>Design-Time Components for Visual Studio</h4>

<ul>
  <li>
    They will still be built and included in the release packages.
  </li>
  <li>
    However, they will no longer be &quot;officially supported&quot;.
  </li>
  <li>
    The forum may still be used to ask questions about them.
  </li>
  <li>
    However, any tickets opened for them will be deleted.
  </li>
  <li>
    Due to
    <a href="https://docs.microsoft.com/en-us/visualstudio/extensibility/breaking-changes-2017">changes</a>
    in the Visual Studio package installation model, they are not
    supported by Visual Studio 2017 and later versions.
  </li>
</ul>

<h4>Release Packages</h4>

<ul>
  <li>
    Release packages for non-current releases will be archived.
  </li>
  <li>
    Access to archived release packages will be granted on a case-by-case basis.
  </li>
</ul>

<div align="center"><h2><b>Forum</b></h2></div>

<p>
  SQLite has an active forum and support community and users of the
  System.Data.SQLite project available on this web site are encouraged to
  use these for support questions.
</p>

<p>
  The <a href="https://sqlite.org/forum/forum">SQLite Forum</a> has been
  established to help support SQLite and System.Data.SQLite.
</p>

<p>
  Off-site archives of the (legacy) <b>sqlite-users</b> mailing list are
  available at:
</p>

<ul>
  <li>
    <a href="https://www.mail-archive.com/sqlite-users%40sqlite.org/">
    https://www.mail-archive.com/sqlite-users%40sqlite.org/</a>
    (<b>old address, before mid-February 2015</b>)
  </li>

  <li>
    <a href="https://www.mail-archive.com/sqlite-users%40mailinglists.sqlite.org/">
    https://www.mail-archive.com/sqlite-users%40mailinglists.sqlite.org/</a>
    (<b>new address, after mid-February 2015</b>)
  </li>

  <li>
    <a href="https://marc.info/?l=sqlite-users&r=1&w=2">
    https://marc.info/?l=sqlite-users&r=1&w=2</a>
  </li>

  <li>
    <a href="http://news.gmane.org/gmane.comp.db.sqlite.general">
    http://news.gmane.org/gmane.comp.db.sqlite.general</a>
  </li>
</ul>

<div align="center"><h2><b>Direct E-Mail</b></h2></div>

<p>
  Use the <a href="https://sqlite.org/forum/forum">SQLite Forum</a>.
  Please do <b>not</b> send email directly to the authors of SQLite
  or System.Data.SQLite unless:
</p>

<ul>
  <li>
    You have or intend to acquire a
    <a href="https://www.sqlite.org/support.html">
    professional support contract</a>.
  </li>

  <li>
    You are working on an open source project.
  </li>
</ul>

<p>
  You are welcomed to use SQLite and System.Data.SQLite in closed source,
  proprietary, and/or commercial projects and to ask questions about such
  use on the forum.  But please do not ask to receive free direct technical
  support. The software is free; direct technical support is not.
</p>

Added www/test.wiki.

































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<title>Test Procedures</title>

<a name="assumptions"></a>
<h2>Test Assumptions &amp; Prerequisites</h2>

<ol>
  <li>
    The string &quot;&lt;root&gt;&quot; represents the root directory of your
    local source tree (i.e. the working check-out directory) for the
    System.Data.SQLite project.
  </li>

  <li>
    The string &quot;&lt;year&gt;&quot; represents the version of Visual Studio
    used (e.g. &quot;2005&quot;, &quot;2008&quot;, &quot;2010&quot;,
    &quot;2012&quot;, &quot;2013&quot;, &quot;2015&quot;, or &quot;2017&quot;)
    to build the binaries being tested.
  </li>

  <li>
    The string &quot;&lt;configuration&gt;&quot; represents the build
    configuration for the binaries being tested (e.g. &quot;Debug&quot; or
    &quot;Release&quot;).
  </li>

  <li>
    The string &quot;&lt;platform&gt;&quot; represents the native platform for
    the binaries being tested (e.g. &quot;Win32&quot; or &quot;x64&quot;).
  </li>

  <li>
    The string &quot;&lt;pid&gt;&quot; represents the process identifier for the
    instance of EagleShell being used to run the unit tests (e.g.
    &quot;1234&quot;).
  </li>
</ol>

<a name="procedures"></a>
<h2>Test Procedures</h2>

<p>
  Follow these steps to unit test the System.Data.SQLite (&quot;SDS&quot;)
  binaries.  Unless otherwise noted, all steps need to be done in the order
  specified.
</p>

<p>
  First, you will need a full source check-out for the System.Data.SQLite
  project, including the
  &quot;<a href="/index.html/dir?name=Externals/Eagle">Externals\Eagle</a>&quot;
  directory.
</p>

<p>
  The binaries to test must be [./build.wiki | built] or
  [./downloads.wiki | downloaded].  If the binaries are downloaded, they must be
  placed according to the build output directory structure (e.g.
  &quot;&lt;root&gt;\bin\&lt;year&gt;\&lt;configuration&gt;\bin&quot; for the
  separate managed and interop assemblies or
  &quot;&lt;root&gt;\bin\&lt;year&gt;\&lt;platform&gt;\&lt;configuration&gt;&quot;
  for the mixed-mode assembly).
</p>

<p>
  The new unit tests have been setup using <a href="https://eagle.to/">Eagle</a>
  and its associated unit testing framework, named &quot;Eagle.Test&quot;.
  Eagle itself is an implementation of the <a href="https://www.tcl.tk/">Tcl</a>
  scripting language for the Common Language Runtime (CLR).
  &quot;Eagle.Test&quot; is the unit testing framework for Eagle, packaged as a
  collection of Eagle scripts, based loosely on the implementation of
  <a href="https://www.tcl.tk/man/tcl8.4/TclCmd/tcltest.htm">tcltest</a>.
</p>

<a name="automated"></a>
<h2>Automated Unit Tests</h2>

<ol>
  <li>Open a normal command prompt window with &quot;cmd.exe&quot;.</li>

  <li>Change the current directory to &quot;&lt;root&gt;&quot;.</li>

  <li>
    Enter the following command to run all the unit tests against the binaries
    built with a separate managed and interop assembly:
    <br />
    <br />
    <b>Externals\Eagle\bin\netFramework40\EagleShell.exe&nbsp;-file&nbsp;Tests\all.eagle</b>
  </li>

  <li>
    Enter the following command to run all the unit tests against the binaries
    built with a mixed-mode assembly:
    <br />
    <br />
    <b>Externals\Eagle\bin\netFramework40\EagleShell.exe&nbsp;-initialize&nbsp;-runtimeOption&nbsp;native&nbsp;-file&nbsp;Tests\all.eagle</b>
  </li>

  <li>
    In order to test binaries built with MSBuild 3.5 or Visual Studio 2008 (i.e.
    because the default is to test binaries built with MSBuild 4.0 or Visual
    Studio 2010) add the following command line argument right after
    &quot;<b>Externals\Eagle\bin\netFramework40\EagleShell.exe</b>&quot; in any
    of the above command lines:
    <br />
    <br />
    <b>-anyInitialize&nbsp;&quot;set&nbsp;test_year&nbsp;2008&quot;</b>
  </li>

  <li>
    In order to test binaries built in the &quot;Debug&quot; build configuration
    (i.e. because the default is to test binaries built in the
    &quot;Release&quot; build configuration) add the following command line
    argument right after
    &quot;<b>Externals\Eagle\bin\netFramework40\EagleShell.exe</b>&quot; in any
    of the above command lines:
    <br />
    <br />
    <b>-anyInitialize&nbsp;&quot;set&nbsp;test_configuration&nbsp;Debug&quot;</b>
  </li>

  <li>
    In order to test the native library pre-loader, add the following command
    line argument right after
    &quot;<b>Externals\Eagle\bin\netFramework40\EagleShell.exe</b>&quot;
    in any of the above command lines:
    <br />
    <br />
    <b>-anyInitialize&nbsp;&quot;set&nbsp;no(copySqliteImplicitFiles)&nbsp;1&quot;</b>
  </li>

  <li>
    Make sure all tests pass; the log file
    &quot;%TEMP%\EagleShell.exe.test.&lt;pid&gt;.log&quot; may be checked if any
    errors should occur.  The test suite should produce &quot;success&quot;
    messages very similar to the following:<br /><br />
    PASSED: 504<br />
    SKIPPED: 54<br />
    SKIPPED: name-of-skipped-test-1&nbsp;&#8230;&nbsp;&#8230;<br />
    TOTAL: 558<br />
    SKIP PERCENTAGE: 9.6774%<br />
    PASS PERCENTAGE: 100%<br />
    OVERALL RESULT: SUCCESS<br />
  </li>
</ol>